Built motion from commit cca3fd8e.|2.6.7
authorsupport <support@xcally.com>
Wed, 16 Mar 2022 16:11:16 +0000 (16:11 +0000)
committersupport <support@xcally.com>
Wed, 16 Mar 2022 16:11:16 +0000 (16:11 +0000)
1191 files changed:
apidoc/api_project.js
apidoc/api_project.json
public/index.html
public/scripts/app.2c4dd8b8.js [moved from public/scripts/app.74f92198.js with 52% similarity]
server/api/action/action.attributes.js
server/api/action/action.controller.js
server/api/action/action.model.js
server/api/action/action.rpc.js
server/api/action/index.js
server/api/analyticCustomReport/analyticCustomReport.attributes.js
server/api/analyticCustomReport/analyticCustomReport.controller.js
server/api/analyticCustomReport/analyticCustomReport.model.js
server/api/analyticCustomReport/analyticCustomReport.rpc.js
server/api/analyticCustomReport/index.js
server/api/analyticDefaultReport/analyticDefaultReport.attributes.js
server/api/analyticDefaultReport/analyticDefaultReport.controller.js
server/api/analyticDefaultReport/analyticDefaultReport.model.js
server/api/analyticDefaultReport/analyticDefaultReport.rpc.js
server/api/analyticDefaultReport/index.js
server/api/analyticExtractedReport/analyticExtractedReport.attributes.js
server/api/analyticExtractedReport/analyticExtractedReport.controller.js
server/api/analyticExtractedReport/analyticExtractedReport.model.js
server/api/analyticExtractedReport/analyticExtractedReport.rpc.js
server/api/analyticExtractedReport/index.js
server/api/analyticFieldReport/analyticFieldReport.attributes.js
server/api/analyticFieldReport/analyticFieldReport.controller.js
server/api/analyticFieldReport/analyticFieldReport.model.js
server/api/analyticFieldReport/analyticFieldReport.rpc.js
server/api/analyticFieldReport/index.js
server/api/analyticMetric/analyticMetric.attributes.js
server/api/analyticMetric/analyticMetric.controller.js
server/api/analyticMetric/analyticMetric.model.js
server/api/analyticMetric/analyticMetric.rpc.js
server/api/analyticMetric/index.js
server/api/analyticTreeReport/analyticTreeReport.attributes.js
server/api/analyticTreeReport/analyticTreeReport.controller.js
server/api/analyticTreeReport/analyticTreeReport.model.js
server/api/analyticTreeReport/analyticTreeReport.rpc.js
server/api/analyticTreeReport/index.js
server/api/attachment/attachment.attributes.js
server/api/attachment/attachment.controller.js
server/api/attachment/attachment.model.js
server/api/attachment/attachment.rpc.js
server/api/attachment/index.js
server/api/authActiveDirectory/authActiveDirectory.controller.js
server/api/authActiveDirectory/index.js
server/api/authGoogle/authGoogle.controller.js
server/api/authGoogle/index.js
server/api/authLocal/authLocal.controller.js
server/api/authLocal/index.js
server/api/automation/automation.attributes.js
server/api/automation/automation.controller.js
server/api/automation/automation.model.js
server/api/automation/automation.rpc.js
server/api/automation/index.js
server/api/campaign/campaign.attributes.js
server/api/campaign/campaign.controller.js
server/api/campaign/campaign.model.js
server/api/campaign/campaign.rpc.js
server/api/campaign/index.js
server/api/cannedAnswer/cannedAnswer.attributes.js
server/api/cannedAnswer/cannedAnswer.controller.js
server/api/cannedAnswer/cannedAnswer.model.js
server/api/cannedAnswer/cannedAnswer.rpc.js
server/api/cannedAnswer/index.js
server/api/cdr/cdr.attributes.js
server/api/cdr/cdr.controller.js
server/api/cdr/cdr.model.js
server/api/cdr/cdr.rpc.js
server/api/cdr/index.js
server/api/chatApplication/chatApplication.attributes.js
server/api/chatApplication/chatApplication.controller.js
server/api/chatApplication/chatApplication.model.js
server/api/chatApplication/chatApplication.rpc.js
server/api/chatApplication/index.js
server/api/chatGroup/chatGroup.attributes.js
server/api/chatGroup/chatGroup.controller.js
server/api/chatGroup/chatGroup.events.js
server/api/chatGroup/chatGroup.model.js
server/api/chatGroup/chatGroup.rpc.js
server/api/chatGroup/chatGroup.socket.js
server/api/chatGroup/index.js
server/api/chatInteraction/chatInteraction.attributes.js
server/api/chatInteraction/chatInteraction.controller.js
server/api/chatInteraction/chatInteraction.events.js
server/api/chatInteraction/chatInteraction.model.js
server/api/chatInteraction/chatInteraction.rpc.js
server/api/chatInteraction/chatInteraction.socket.js
server/api/chatInteraction/index.js
server/api/chatInternalMessage/chatInternalMessage.attributes.js
server/api/chatInternalMessage/chatInternalMessage.controller.js
server/api/chatInternalMessage/chatInternalMessage.events.js
server/api/chatInternalMessage/chatInternalMessage.model.js
server/api/chatInternalMessage/chatInternalMessage.rpc.js
server/api/chatInternalMessage/chatInternalMessage.socket.js
server/api/chatInternalMessage/index.js
server/api/chatMessage/chatMessage.attributes.js
server/api/chatMessage/chatMessage.controller.js
server/api/chatMessage/chatMessage.events.js
server/api/chatMessage/chatMessage.model.js
server/api/chatMessage/chatMessage.rpc.js
server/api/chatMessage/chatMessage.socket.js
server/api/chatMessage/index.js
server/api/chatOfflineMessage/chatOfflineMessage.attributes.js
server/api/chatOfflineMessage/chatOfflineMessage.controller.js
server/api/chatOfflineMessage/chatOfflineMessage.events.js
server/api/chatOfflineMessage/chatOfflineMessage.model.js
server/api/chatOfflineMessage/chatOfflineMessage.rpc.js
server/api/chatOfflineMessage/index.js
server/api/chatProactiveAction/chatProactiveAction.attributes.js
server/api/chatProactiveAction/chatProactiveAction.controller.js
server/api/chatProactiveAction/chatProactiveAction.model.js
server/api/chatProactiveAction/chatProactiveAction.rpc.js
server/api/chatProactiveAction/index.js
server/api/chatQueue/chatQueue.attributes.js
server/api/chatQueue/chatQueue.controller.js
server/api/chatQueue/chatQueue.events.js
server/api/chatQueue/chatQueue.model.js
server/api/chatQueue/chatQueue.rpc.js
server/api/chatQueue/chatQueue.socket.js
server/api/chatQueue/index.js
server/api/chatQueueReport/chatQueueReport.attributes.js
server/api/chatQueueReport/chatQueueReport.controller.js
server/api/chatQueueReport/chatQueueReport.model.js
server/api/chatQueueReport/chatQueueReport.rpc.js
server/api/chatQueueReport/index.js
server/api/chatTransferReport/chatTransferReport.attributes.js
server/api/chatTransferReport/chatTransferReport.controller.js
server/api/chatTransferReport/chatTransferReport.model.js
server/api/chatTransferReport/chatTransferReport.rpc.js
server/api/chatTransferReport/index.js
server/api/chatWebsite/chatWebsite.attributes.js
server/api/chatWebsite/chatWebsite.controller.js
server/api/chatWebsite/chatWebsite.events.js
server/api/chatWebsite/chatWebsite.model.js
server/api/chatWebsite/chatWebsite.rpc.js
server/api/chatWebsite/chatWebsite.socket.js
server/api/chatWebsite/index.js
server/api/client-side-logs.js
server/api/cloudProvider/cloudProvider.attributes.js
server/api/cloudProvider/cloudProvider.controller.js
server/api/cloudProvider/cloudProvider.model.js
server/api/cloudProvider/cloudProvider.oauth.js
server/api/cloudProvider/cloudProvider.rpc.js
server/api/cloudProvider/index.js
server/api/cmCompany/cmCompany.attributes.js
server/api/cmCompany/cmCompany.controller.js
server/api/cmCompany/cmCompany.model.js
server/api/cmCompany/cmCompany.rpc.js
server/api/cmCompany/index.js
server/api/cmContact/cmContact.attributes.js
server/api/cmContact/cmContact.controller.js
server/api/cmContact/cmContact.events.js
server/api/cmContact/cmContact.model.js
server/api/cmContact/cmContact.rpc.js
server/api/cmContact/cmContact.socket.js
server/api/cmContact/index.js
server/api/cmContactHasItem/cmContactHasItem.attributes.js
server/api/cmContactHasItem/cmContactHasItem.controller.js
server/api/cmContactHasItem/cmContactHasItem.model.js
server/api/cmContactHasItem/cmContactHasItem.rpc.js
server/api/cmContactHasItem/index.js
server/api/cmCustomField/cmCustomField.attributes.js
server/api/cmCustomField/cmCustomField.controller.js
server/api/cmCustomField/cmCustomField.model.js
server/api/cmCustomField/cmCustomField.rpc.js
server/api/cmCustomField/index.js
server/api/cmHopper/cmHopper.attributes.js
server/api/cmHopper/cmHopper.controller.js
server/api/cmHopper/cmHopper.model.js
server/api/cmHopper/cmHopper.rpc.js
server/api/cmHopper/index.js
server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js
server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js
server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js
server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js
server/api/cmHopperAdditionalPhone/index.js
server/api/cmHopperBlack/cmHopperBlack.attributes.js
server/api/cmHopperBlack/cmHopperBlack.controller.js
server/api/cmHopperBlack/cmHopperBlack.model.js
server/api/cmHopperBlack/cmHopperBlack.rpc.js
server/api/cmHopperBlack/index.js
server/api/cmHopperFinal/cmHopperFinal.attributes.js
server/api/cmHopperFinal/cmHopperFinal.controller.js
server/api/cmHopperFinal/cmHopperFinal.model.js
server/api/cmHopperFinal/cmHopperFinal.rpc.js
server/api/cmHopperFinal/index.js
server/api/cmHopperHistory/cmHopperHistory.attributes.js
server/api/cmHopperHistory/cmHopperHistory.controller.js
server/api/cmHopperHistory/cmHopperHistory.model.js
server/api/cmHopperHistory/cmHopperHistory.rpc.js
server/api/cmHopperHistory/index.js
server/api/cmList/cmList.attributes.js
server/api/cmList/cmList.controller.js
server/api/cmList/cmList.events.js
server/api/cmList/cmList.model.js
server/api/cmList/cmList.rpc.js
server/api/cmList/cmList.socket.js
server/api/cmList/index.js
server/api/condition/condition.attributes.js
server/api/condition/condition.controller.js
server/api/condition/condition.model.js
server/api/condition/condition.rpc.js
server/api/condition/index.js
server/api/contactItemType/contactItemType.attributes.js
server/api/contactItemType/contactItemType.controller.js
server/api/contactItemType/contactItemType.model.js
server/api/contactItemType/contactItemType.rpc.js
server/api/contactItemType/index.js
server/api/dashboard/dashboard.attributes.js
server/api/dashboard/dashboard.controller.js
server/api/dashboard/dashboard.events.js
server/api/dashboard/dashboard.model.js
server/api/dashboard/dashboard.rpc.js
server/api/dashboard/dashboard.socket.js
server/api/dashboard/index.js
server/api/dashboardItem/dashboardItem.attributes.js
server/api/dashboardItem/dashboardItem.controller.js
server/api/dashboardItem/dashboardItem.events.js
server/api/dashboardItem/dashboardItem.model.js
server/api/dashboardItem/dashboardItem.rpc.js
server/api/dashboardItem/dashboardItem.socket.js
server/api/dashboardItem/index.js
server/api/disposition/disposition.attributes.js
server/api/disposition/disposition.controller.js
server/api/disposition/disposition.model.js
server/api/disposition/disposition.rpc.js
server/api/disposition/index.js
server/api/faxAccount/faxAccount.attributes.js
server/api/faxAccount/faxAccount.controller.js
server/api/faxAccount/faxAccount.events.js
server/api/faxAccount/faxAccount.model.js
server/api/faxAccount/faxAccount.rpc.js
server/api/faxAccount/faxAccount.socket.js
server/api/faxAccount/index.js
server/api/faxApplication/faxApplication.attributes.js
server/api/faxApplication/faxApplication.controller.js
server/api/faxApplication/faxApplication.model.js
server/api/faxApplication/faxApplication.rpc.js
server/api/faxApplication/index.js
server/api/faxInteraction/faxInteraction.attributes.js
server/api/faxInteraction/faxInteraction.controller.js
server/api/faxInteraction/faxInteraction.events.js
server/api/faxInteraction/faxInteraction.model.js
server/api/faxInteraction/faxInteraction.rpc.js
server/api/faxInteraction/faxInteraction.socket.js
server/api/faxInteraction/index.js
server/api/faxMessage/faxMessage.attributes.js
server/api/faxMessage/faxMessage.controller.js
server/api/faxMessage/faxMessage.events.js
server/api/faxMessage/faxMessage.model.js
server/api/faxMessage/faxMessage.rpc.js
server/api/faxMessage/faxMessage.socket.js
server/api/faxMessage/index.js
server/api/faxQueue/faxQueue.attributes.js
server/api/faxQueue/faxQueue.controller.js
server/api/faxQueue/faxQueue.events.js
server/api/faxQueue/faxQueue.model.js
server/api/faxQueue/faxQueue.rpc.js
server/api/faxQueue/faxQueue.socket.js
server/api/faxQueue/index.js
server/api/faxQueueReport/faxQueueReport.attributes.js
server/api/faxQueueReport/faxQueueReport.controller.js
server/api/faxQueueReport/faxQueueReport.model.js
server/api/faxQueueReport/faxQueueReport.rpc.js
server/api/faxQueueReport/index.js
server/api/faxTransferReport/faxTransferReport.attributes.js
server/api/faxTransferReport/faxTransferReport.controller.js
server/api/faxTransferReport/faxTransferReport.model.js
server/api/faxTransferReport/faxTransferReport.rpc.js
server/api/faxTransferReport/index.js
server/api/intDeskAccount/index.js
server/api/intDeskAccount/intDeskAccount.attributes.js
server/api/intDeskAccount/intDeskAccount.controller.js
server/api/intDeskAccount/intDeskAccount.model.js
server/api/intDeskAccount/intDeskAccount.rpc.js
server/api/intDeskConfiguration/index.js
server/api/intDeskConfiguration/intDeskConfiguration.attributes.js
server/api/intDeskConfiguration/intDeskConfiguration.controller.js
server/api/intDeskConfiguration/intDeskConfiguration.model.js
server/api/intDeskConfiguration/intDeskConfiguration.rpc.js
server/api/intDeskField/index.js
server/api/intDeskField/intDeskField.attributes.js
server/api/intDeskField/intDeskField.controller.js
server/api/intDeskField/intDeskField.model.js
server/api/intDeskField/intDeskField.rpc.js
server/api/intDynamics365Account/index.js
server/api/intDynamics365Account/intDynamics365Account.attributes.js
server/api/intDynamics365Account/intDynamics365Account.controller.js
server/api/intDynamics365Account/intDynamics365Account.model.js
server/api/intDynamics365Account/intDynamics365Account.rpc.js
server/api/intDynamics365Configuration/index.js
server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js
server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js
server/api/intDynamics365Configuration/intDynamics365Configuration.model.js
server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js
server/api/intDynamics365Field/index.js
server/api/intDynamics365Field/intDynamics365Field.attributes.js
server/api/intDynamics365Field/intDynamics365Field.controller.js
server/api/intDynamics365Field/intDynamics365Field.model.js
server/api/intDynamics365Field/intDynamics365Field.rpc.js
server/api/intFreshdeskAccount/index.js
server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js
server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js
server/api/intFreshdeskAccount/intFreshdeskAccount.model.js
server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js
server/api/intFreshdeskConfiguration/index.js
server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js
server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js
server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js
server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js
server/api/intFreshdeskField/index.js
server/api/intFreshdeskField/intFreshdeskField.attributes.js
server/api/intFreshdeskField/intFreshdeskField.controller.js
server/api/intFreshdeskField/intFreshdeskField.model.js
server/api/intFreshdeskField/intFreshdeskField.rpc.js
server/api/intFreshsalesAccount/index.js
server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js
server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js
server/api/intFreshsalesAccount/intFreshsalesAccount.model.js
server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js
server/api/intFreshsalesConfiguration/index.js
server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js
server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js
server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js
server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js
server/api/intFreshsalesField/index.js
server/api/intFreshsalesField/intFreshsalesField.attributes.js
server/api/intFreshsalesField/intFreshsalesField.controller.js
server/api/intFreshsalesField/intFreshsalesField.model.js
server/api/intFreshsalesField/intFreshsalesField.rpc.js
server/api/intSalesforceAccount/index.js
server/api/intSalesforceAccount/intSalesforceAccount.attributes.js
server/api/intSalesforceAccount/intSalesforceAccount.controller.js
server/api/intSalesforceAccount/intSalesforceAccount.model.js
server/api/intSalesforceAccount/intSalesforceAccount.rpc.js
server/api/intSalesforceConfiguration/index.js
server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js
server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js
server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js
server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js
server/api/intSalesforceField/index.js
server/api/intSalesforceField/intSalesforceField.attributes.js
server/api/intSalesforceField/intSalesforceField.controller.js
server/api/intSalesforceField/intSalesforceField.model.js
server/api/intSalesforceField/intSalesforceField.rpc.js
server/api/intServicenowAccount/index.js
server/api/intServicenowAccount/intServicenowAccount.attributes.js
server/api/intServicenowAccount/intServicenowAccount.controller.js
server/api/intServicenowAccount/intServicenowAccount.model.js
server/api/intServicenowAccount/intServicenowAccount.rpc.js
server/api/intServicenowConfiguration/index.js
server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js
server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js
server/api/intServicenowConfiguration/intServicenowConfiguration.model.js
server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js
server/api/intServicenowField/index.js
server/api/intServicenowField/intServicenowField.attributes.js
server/api/intServicenowField/intServicenowField.controller.js
server/api/intServicenowField/intServicenowField.model.js
server/api/intServicenowField/intServicenowField.rpc.js
server/api/intSugarcrmAccount/index.js
server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js
server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js
server/api/intSugarcrmAccount/intSugarcrmAccount.model.js
server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js
server/api/intSugarcrmConfiguration/index.js
server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js
server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js
server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js
server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js
server/api/intSugarcrmField/index.js
server/api/intSugarcrmField/intSugarcrmField.attributes.js
server/api/intSugarcrmField/intSugarcrmField.controller.js
server/api/intSugarcrmField/intSugarcrmField.model.js
server/api/intSugarcrmField/intSugarcrmField.rpc.js
server/api/intVtigerAccount/index.js
server/api/intVtigerAccount/intVtigerAccount.attributes.js
server/api/intVtigerAccount/intVtigerAccount.controller.js
server/api/intVtigerAccount/intVtigerAccount.model.js
server/api/intVtigerAccount/intVtigerAccount.rpc.js
server/api/intVtigerConfiguration/index.js
server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js
server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js
server/api/intVtigerConfiguration/intVtigerConfiguration.model.js
server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js
server/api/intVtigerField/index.js
server/api/intVtigerField/intVtigerField.attributes.js
server/api/intVtigerField/intVtigerField.controller.js
server/api/intVtigerField/intVtigerField.model.js
server/api/intVtigerField/intVtigerField.rpc.js
server/api/intZendeskAccount/index.js
server/api/intZendeskAccount/intZendeskAccount.attributes.js
server/api/intZendeskAccount/intZendeskAccount.controller.js
server/api/intZendeskAccount/intZendeskAccount.model.js
server/api/intZendeskAccount/intZendeskAccount.rpc.js
server/api/intZendeskConfiguration/index.js
server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js
server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js
server/api/intZendeskConfiguration/intZendeskConfiguration.model.js
server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js
server/api/intZendeskField/index.js
server/api/intZendeskField/intZendeskField.attributes.js
server/api/intZendeskField/intZendeskField.controller.js
server/api/intZendeskField/intZendeskField.model.js
server/api/intZendeskField/intZendeskField.rpc.js
server/api/intZohoAccount/index.js
server/api/intZohoAccount/intZohoAccount.attributes.js
server/api/intZohoAccount/intZohoAccount.controller.js
server/api/intZohoAccount/intZohoAccount.model.js
server/api/intZohoAccount/intZohoAccount.rpc.js
server/api/intZohoConfiguration/index.js
server/api/intZohoConfiguration/intZohoConfiguration.attributes.js
server/api/intZohoConfiguration/intZohoConfiguration.controller.js
server/api/intZohoConfiguration/intZohoConfiguration.model.js
server/api/intZohoConfiguration/intZohoConfiguration.rpc.js
server/api/intZohoField/index.js
server/api/intZohoField/intZohoField.attributes.js
server/api/intZohoField/intZohoField.controller.js
server/api/intZohoField/intZohoField.model.js
server/api/intZohoField/intZohoField.rpc.js
server/api/integration/index.js
server/api/integration/integration.attributes.js
server/api/integration/integration.controller.js
server/api/integration/integration.model.js
server/api/integration/integration.rpc.js
server/api/integrationReport/index.js
server/api/integrationReport/integrationReport.attributes.js
server/api/integrationReport/integrationReport.controller.js
server/api/integrationReport/integrationReport.model.js
server/api/integrationReport/integrationReport.rpc.js
server/api/interval/index.js
server/api/interval/interval.attributes.js
server/api/interval/interval.controller.js
server/api/interval/interval.model.js
server/api/interval/interval.rpc.js
server/api/jira/index.js
server/api/jira/jira.controller.js
server/api/jscriptyAnswerReport/index.js
server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js
server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js
server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js
server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js
server/api/jscriptyProject/index.js
server/api/jscriptyProject/jscriptyProject.attributes.js
server/api/jscriptyProject/jscriptyProject.controller.js
server/api/jscriptyProject/jscriptyProject.model.js
server/api/jscriptyProject/jscriptyProject.rpc.js
server/api/jscriptyQuestionReport/index.js
server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js
server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js
server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js
server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js
server/api/jscriptySessionReport/index.js
server/api/jscriptySessionReport/jscriptySessionReport.attributes.js
server/api/jscriptySessionReport/jscriptySessionReport.controller.js
server/api/jscriptySessionReport/jscriptySessionReport.model.js
server/api/jscriptySessionReport/jscriptySessionReport.rpc.js
server/api/license/index.js
server/api/license/license.attributes.js
server/api/license/license.controller.js
server/api/license/license.model.js
server/api/license/license.rpc.js
server/api/mailAccount/index.js
server/api/mailAccount/mailAccount.attributes.js
server/api/mailAccount/mailAccount.controller.js
server/api/mailAccount/mailAccount.events.js
server/api/mailAccount/mailAccount.model.js
server/api/mailAccount/mailAccount.rpc.js
server/api/mailAccount/mailAccount.socket.js
server/api/mailApplication/index.js
server/api/mailApplication/mailApplication.attributes.js
server/api/mailApplication/mailApplication.controller.js
server/api/mailApplication/mailApplication.model.js
server/api/mailApplication/mailApplication.rpc.js
server/api/mailInteraction/index.js
server/api/mailInteraction/mailInteraction.attributes.js
server/api/mailInteraction/mailInteraction.controller.js
server/api/mailInteraction/mailInteraction.events.js
server/api/mailInteraction/mailInteraction.model.js
server/api/mailInteraction/mailInteraction.rpc.js
server/api/mailInteraction/mailInteraction.socket.js
server/api/mailMessage/index.js
server/api/mailMessage/mailMessage.attributes.js
server/api/mailMessage/mailMessage.controller.js
server/api/mailMessage/mailMessage.events.js
server/api/mailMessage/mailMessage.model.js
server/api/mailMessage/mailMessage.rpc.js
server/api/mailMessage/mailMessage.socket.js
server/api/mailQueue/index.js
server/api/mailQueue/mailQueue.attributes.js
server/api/mailQueue/mailQueue.controller.js
server/api/mailQueue/mailQueue.events.js
server/api/mailQueue/mailQueue.model.js
server/api/mailQueue/mailQueue.rpc.js
server/api/mailQueue/mailQueue.socket.js
server/api/mailQueueReport/index.js
server/api/mailQueueReport/mailQueueReport.attributes.js
server/api/mailQueueReport/mailQueueReport.controller.js
server/api/mailQueueReport/mailQueueReport.model.js
server/api/mailQueueReport/mailQueueReport.rpc.js
server/api/mailServerIn/index.js
server/api/mailServerIn/mailServerIn.attributes.js
server/api/mailServerIn/mailServerIn.model.js
server/api/mailServerIn/mailServerIn.rpc.js
server/api/mailServerOut/index.js
server/api/mailServerOut/mailServerOut.attributes.js
server/api/mailServerOut/mailServerOut.controller.js
server/api/mailServerOut/mailServerOut.model.js
server/api/mailServerOut/mailServerOut.rpc.js
server/api/mailSubstatus/index.js
server/api/mailSubstatus/mailSubstatus.attributes.js
server/api/mailSubstatus/mailSubstatus.controller.js
server/api/mailSubstatus/mailSubstatus.events.js
server/api/mailSubstatus/mailSubstatus.model.js
server/api/mailSubstatus/mailSubstatus.rpc.js
server/api/mailTransferReport/index.js
server/api/mailTransferReport/mailTransferReport.attributes.js
server/api/mailTransferReport/mailTransferReport.controller.js
server/api/mailTransferReport/mailTransferReport.model.js
server/api/mailTransferReport/mailTransferReport.rpc.js
server/api/memberReport/index.js
server/api/memberReport/memberReport.attributes.js
server/api/memberReport/memberReport.controller.js
server/api/memberReport/memberReport.model.js
server/api/memberReport/memberReport.rpc.js
server/api/migration/index.js
server/api/migration/migration.attributes.js
server/api/migration/migration.controller.js
server/api/migration/migration.model.js
server/api/migration/migration.rpc.js
server/api/network/index.js
server/api/network/network.attributes.js
server/api/network/network.controller.js
server/api/network/network.model.js
server/api/network/network.rpc.js
server/api/openchannelAccount/index.js
server/api/openchannelAccount/openchannelAccount.attributes.js
server/api/openchannelAccount/openchannelAccount.controller.js
server/api/openchannelAccount/openchannelAccount.events.js
server/api/openchannelAccount/openchannelAccount.model.js
server/api/openchannelAccount/openchannelAccount.rpc.js
server/api/openchannelAccount/openchannelAccount.socket.js
server/api/openchannelApplication/index.js
server/api/openchannelApplication/openchannelApplication.attributes.js
server/api/openchannelApplication/openchannelApplication.controller.js
server/api/openchannelApplication/openchannelApplication.model.js
server/api/openchannelApplication/openchannelApplication.rpc.js
server/api/openchannelInteraction/index.js
server/api/openchannelInteraction/openchannelInteraction.attributes.js
server/api/openchannelInteraction/openchannelInteraction.controller.js
server/api/openchannelInteraction/openchannelInteraction.events.js
server/api/openchannelInteraction/openchannelInteraction.model.js
server/api/openchannelInteraction/openchannelInteraction.rpc.js
server/api/openchannelInteraction/openchannelInteraction.socket.js
server/api/openchannelMessage/index.js
server/api/openchannelMessage/openchannelMessage.attributes.js
server/api/openchannelMessage/openchannelMessage.controller.js
server/api/openchannelMessage/openchannelMessage.events.js
server/api/openchannelMessage/openchannelMessage.model.js
server/api/openchannelMessage/openchannelMessage.rpc.js
server/api/openchannelMessage/openchannelMessage.socket.js
server/api/openchannelQueue/index.js
server/api/openchannelQueue/openchannelQueue.attributes.js
server/api/openchannelQueue/openchannelQueue.controller.js
server/api/openchannelQueue/openchannelQueue.events.js
server/api/openchannelQueue/openchannelQueue.model.js
server/api/openchannelQueue/openchannelQueue.rpc.js
server/api/openchannelQueue/openchannelQueue.socket.js
server/api/openchannelQueueReport/index.js
server/api/openchannelQueueReport/openchannelQueueReport.attributes.js
server/api/openchannelQueueReport/openchannelQueueReport.controller.js
server/api/openchannelQueueReport/openchannelQueueReport.model.js
server/api/openchannelQueueReport/openchannelQueueReport.rpc.js
server/api/openchannelTransferReport/index.js
server/api/openchannelTransferReport/openchannelTransferReport.attributes.js
server/api/openchannelTransferReport/openchannelTransferReport.controller.js
server/api/openchannelTransferReport/openchannelTransferReport.model.js
server/api/openchannelTransferReport/openchannelTransferReport.rpc.js
server/api/pause/index.js
server/api/pause/pause.attributes.js
server/api/pause/pause.controller.js
server/api/pause/pause.model.js
server/api/pause/pause.rpc.js
server/api/plugin/index.js
server/api/plugin/plugin.attributes.js
server/api/plugin/plugin.controller.js
server/api/plugin/plugin.events.js
server/api/plugin/plugin.model.js
server/api/plugin/plugin.rpc.js
server/api/plugin/plugin.socket.js
server/api/pm2/index.js
server/api/pm2/pm2.controller.js
server/api/realtime/index.js
server/api/realtime/realtime.controller.js
server/api/reportAgentPreview/index.js
server/api/reportAgentPreview/reportAgentPreview.attributes.js
server/api/reportAgentPreview/reportAgentPreview.model.js
server/api/reportAgentPreview/reportAgentPreview.rpc.js
server/api/rpc/index.js
server/api/rpc/rpc.controller.js
server/api/schedule/index.js
server/api/schedule/schedule.attributes.js
server/api/schedule/schedule.controller.js
server/api/schedule/schedule.model.js
server/api/schedule/schedule.rpc.js
server/api/screenRecording/index.js
server/api/screenRecording/screenRecording.attributes.js
server/api/screenRecording/screenRecording.controller.js
server/api/screenRecording/screenRecording.model.js
server/api/screenRecording/screenRecording.rpc.js
server/api/setting/index.js
server/api/setting/setting.attributes.js
server/api/setting/setting.controller.js
server/api/setting/setting.model.js
server/api/setting/setting.rpc.js
server/api/smsAccount/index.js
server/api/smsAccount/smsAccount.attributes.js
server/api/smsAccount/smsAccount.controller.js
server/api/smsAccount/smsAccount.events.js
server/api/smsAccount/smsAccount.model.js
server/api/smsAccount/smsAccount.rpc.js
server/api/smsAccount/smsAccount.socket.js
server/api/smsApplication/index.js
server/api/smsApplication/smsApplication.attributes.js
server/api/smsApplication/smsApplication.controller.js
server/api/smsApplication/smsApplication.model.js
server/api/smsApplication/smsApplication.rpc.js
server/api/smsInteraction/index.js
server/api/smsInteraction/smsInteraction.attributes.js
server/api/smsInteraction/smsInteraction.controller.js
server/api/smsInteraction/smsInteraction.events.js
server/api/smsInteraction/smsInteraction.model.js
server/api/smsInteraction/smsInteraction.rpc.js
server/api/smsInteraction/smsInteraction.socket.js
server/api/smsMessage/index.js
server/api/smsMessage/smsMessage.attributes.js
server/api/smsMessage/smsMessage.controller.js
server/api/smsMessage/smsMessage.events.js
server/api/smsMessage/smsMessage.model.js
server/api/smsMessage/smsMessage.rpc.js
server/api/smsMessage/smsMessage.socket.js
server/api/smsQueue/index.js
server/api/smsQueue/smsQueue.attributes.js
server/api/smsQueue/smsQueue.controller.js
server/api/smsQueue/smsQueue.events.js
server/api/smsQueue/smsQueue.model.js
server/api/smsQueue/smsQueue.rpc.js
server/api/smsQueue/smsQueue.socket.js
server/api/smsQueueReport/index.js
server/api/smsQueueReport/smsQueueReport.attributes.js
server/api/smsQueueReport/smsQueueReport.controller.js
server/api/smsQueueReport/smsQueueReport.model.js
server/api/smsQueueReport/smsQueueReport.rpc.js
server/api/smsTransferReport/index.js
server/api/smsTransferReport/smsTransferReport.attributes.js
server/api/smsTransferReport/smsTransferReport.controller.js
server/api/smsTransferReport/smsTransferReport.model.js
server/api/smsTransferReport/smsTransferReport.rpc.js
server/api/sound/index.js
server/api/sound/sound.attributes.js
server/api/sound/sound.controller.js
server/api/sound/sound.model.js
server/api/sound/sound.rpc.js
server/api/squareMessage/index.js
server/api/squareMessage/squareMessage.attributes.js
server/api/squareMessage/squareMessage.controller.js
server/api/squareMessage/squareMessage.model.js
server/api/squareMessage/squareMessage.rpc.js
server/api/squareOdbc/index.js
server/api/squareOdbc/squareOdbc.attributes.js
server/api/squareOdbc/squareOdbc.controller.js
server/api/squareOdbc/squareOdbc.model.js
server/api/squareOdbc/squareOdbc.rpc.js
server/api/squareProject/index.js
server/api/squareProject/squareProject.attributes.js
server/api/squareProject/squareProject.controller.js
server/api/squareProject/squareProject.events.js
server/api/squareProject/squareProject.model.js
server/api/squareProject/squareProject.rpc.js
server/api/squareProject/squareProject.socket.js
server/api/squareRecording/index.js
server/api/squareRecording/squareRecording.attributes.js
server/api/squareRecording/squareRecording.controller.js
server/api/squareRecording/squareRecording.model.js
server/api/squareRecording/squareRecording.rpc.js
server/api/squareReport/index.js
server/api/squareReport/squareReport.attributes.js
server/api/squareReport/squareReport.controller.js
server/api/squareReport/squareReport.model.js
server/api/squareReport/squareReport.rpc.js
server/api/squareReportDetail/index.js
server/api/squareReportDetail/squareReportDetail.attributes.js
server/api/squareReportDetail/squareReportDetail.controller.js
server/api/squareReportDetail/squareReportDetail.model.js
server/api/squareReportDetail/squareReportDetail.rpc.js
server/api/system/index.js
server/api/system/system.controller.js
server/api/tag/index.js
server/api/tag/tag.attributes.js
server/api/tag/tag.controller.js
server/api/tag/tag.model.js
server/api/tag/tag.rpc.js
server/api/team/index.js
server/api/team/team.attributes.js
server/api/team/team.controller.js
server/api/team/team.events.js
server/api/team/team.model.js
server/api/team/team.rpc.js
server/api/team/team.socket.js
server/api/teamVoicePrefix/teamVoicePrefix.attributes.js
server/api/teamVoicePrefix/teamVoicePrefix.model.js
server/api/teamVoiceQueue/index.js
server/api/teamVoiceQueue/teamVoiceQueue.attributes.js
server/api/teamVoiceQueue/teamVoiceQueue.model.js
server/api/teamVoiceQueue/teamVoiceQueue.rpc.js
server/api/template/index.js
server/api/template/template.attributes.js
server/api/template/template.controller.js
server/api/template/template.model.js
server/api/template/template.rpc.js
server/api/trigger/index.js
server/api/trigger/trigger.attributes.js
server/api/trigger/trigger.controller.js
server/api/trigger/trigger.model.js
server/api/trigger/trigger.rpc.js
server/api/trunk/index.js
server/api/trunk/trunk.attributes.js
server/api/trunk/trunk.controller.js
server/api/trunk/trunk.model.js
server/api/trunk/trunk.rpc.js
server/api/user-setting/index.js
server/api/user-setting/user-setting.attributes.js
server/api/user-setting/user-setting.controller.js
server/api/user-setting/user-setting.events.js
server/api/user-setting/user-setting.model.js
server/api/user-setting/user-setting.socket.js
server/api/user/index.js
server/api/user/user.attributes.js
server/api/user/user.controller.js
server/api/user/user.events.js
server/api/user/user.model.js
server/api/user/user.rpc.js
server/api/user/user.socket.js
server/api/userChatQueue/index.js
server/api/userChatQueue/userChatQueue.attributes.js
server/api/userChatQueue/userChatQueue.model.js
server/api/userChatQueue/userChatQueue.rpc.js
server/api/userFaxQueue/index.js
server/api/userFaxQueue/userFaxQueue.attributes.js
server/api/userFaxQueue/userFaxQueue.model.js
server/api/userFaxQueue/userFaxQueue.rpc.js
server/api/userMailQueue/index.js
server/api/userMailQueue/userMailQueue.attributes.js
server/api/userMailQueue/userMailQueue.model.js
server/api/userMailQueue/userMailQueue.rpc.js
server/api/userNotification/index.js
server/api/userNotification/userNotification.attributes.js
server/api/userNotification/userNotification.controller.js
server/api/userNotification/userNotification.events.js
server/api/userNotification/userNotification.model.js
server/api/userNotification/userNotification.rpc.js
server/api/userNotification/userNotification.socket.js
server/api/userOpenchannelQueue/index.js
server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js
server/api/userOpenchannelQueue/userOpenchannelQueue.model.js
server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js
server/api/userProfile/index.js
server/api/userProfile/userProfile.attributes.js
server/api/userProfile/userProfile.controller.js
server/api/userProfile/userProfile.events.js
server/api/userProfile/userProfile.model.js
server/api/userProfile/userProfile.rpc.js
server/api/userProfile/userProfile.socket.js
server/api/userProfileResource/index.js
server/api/userProfileResource/userProfileResource.attributes.js
server/api/userProfileResource/userProfileResource.controller.js
server/api/userProfileResource/userProfileResource.model.js
server/api/userProfileResource/userProfileResource.rpc.js
server/api/userProfileSection/index.js
server/api/userProfileSection/userProfileSection.attributes.js
server/api/userProfileSection/userProfileSection.controller.js
server/api/userProfileSection/userProfileSection.model.js
server/api/userProfileSection/userProfileSection.rpc.js
server/api/userSmsQueue/index.js
server/api/userSmsQueue/userSmsQueue.attributes.js
server/api/userSmsQueue/userSmsQueue.model.js
server/api/userSmsQueue/userSmsQueue.rpc.js
server/api/userVoicePrefix/userVoicePrefix.attributes.js
server/api/userVoicePrefix/userVoicePrefix.model.js
server/api/userVoiceQueue/index.js
server/api/userVoiceQueue/userVoiceQueue.attributes.js
server/api/userVoiceQueue/userVoiceQueue.model.js
server/api/userVoiceQueue/userVoiceQueue.rpc.js
server/api/userVoiceQueueRt/index.js
server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js
server/api/userVoiceQueueRt/userVoiceQueueRt.events.js
server/api/userVoiceQueueRt/userVoiceQueueRt.model.js
server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js
server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js
server/api/userWhatsappQueue/index.js
server/api/userWhatsappQueue/userWhatsappQueue.attributes.js
server/api/userWhatsappQueue/userWhatsappQueue.model.js
server/api/userWhatsappQueue/userWhatsappQueue.rpc.js
server/api/variable/index.js
server/api/variable/variable.attributes.js
server/api/variable/variable.controller.js
server/api/variable/variable.model.js
server/api/variable/variable.rpc.js
server/api/version/index.js
server/api/version/version.controller.js
server/api/voiceAgentReport/index.js
server/api/voiceAgentReport/voiceAgentReport.attributes.js
server/api/voiceAgentReport/voiceAgentReport.controller.js
server/api/voiceAgentReport/voiceAgentReport.model.js
server/api/voiceAgentReport/voiceAgentReport.rpc.js
server/api/voiceCallReport/index.js
server/api/voiceCallReport/voiceCallReport.attributes.js
server/api/voiceCallReport/voiceCallReport.controller.js
server/api/voiceCallReport/voiceCallReport.model.js
server/api/voiceCallReport/voiceCallReport.rpc.js
server/api/voiceChanSpy/index.js
server/api/voiceChanSpy/voiceChanSpy.attributes.js
server/api/voiceChanSpy/voiceChanSpy.controller.js
server/api/voiceChanSpy/voiceChanSpy.model.js
server/api/voiceChanSpy/voiceChanSpy.rpc.js
server/api/voiceContext/index.js
server/api/voiceContext/voiceContext.attributes.js
server/api/voiceContext/voiceContext.controller.js
server/api/voiceContext/voiceContext.model.js
server/api/voiceContext/voiceContext.rpc.js
server/api/voiceDialReport/index.js
server/api/voiceDialReport/voiceDialReport.attributes.js
server/api/voiceDialReport/voiceDialReport.controller.js
server/api/voiceDialReport/voiceDialReport.model.js
server/api/voiceDialReport/voiceDialReport.rpc.js
server/api/voiceExtension/index.js
server/api/voiceExtension/voiceExtension.attributes.js
server/api/voiceExtension/voiceExtension.controller.js
server/api/voiceExtension/voiceExtension.events.js
server/api/voiceExtension/voiceExtension.model.js
server/api/voiceExtension/voiceExtension.rpc.js
server/api/voiceExtension/voiceExtension.socket.js
server/api/voiceMail/index.js
server/api/voiceMail/voiceMail.attributes.js
server/api/voiceMail/voiceMail.controller.js
server/api/voiceMail/voiceMail.model.js
server/api/voiceMail/voiceMail.rpc.js
server/api/voiceMailMessage/index.js
server/api/voiceMailMessage/voiceMailMessage.attributes.js
server/api/voiceMailMessage/voiceMailMessage.controller.js
server/api/voiceMailMessage/voiceMailMessage.model.js
server/api/voiceMailMessage/voiceMailMessage.rpc.js
server/api/voiceMusicOnHold/index.js
server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js
server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js
server/api/voiceMusicOnHold/voiceMusicOnHold.model.js
server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js
server/api/voicePrefix/index.js
server/api/voicePrefix/voicePrefix.attributes.js
server/api/voicePrefix/voicePrefix.controller.js
server/api/voicePrefix/voicePrefix.events.js
server/api/voicePrefix/voicePrefix.model.js
server/api/voicePrefix/voicePrefix.rpc.js
server/api/voicePrefix/voicePrefix.socket.js
server/api/voiceQueue/index.js
server/api/voiceQueue/voiceQueue.attributes.js
server/api/voiceQueue/voiceQueue.controller.js
server/api/voiceQueue/voiceQueue.events.js
server/api/voiceQueue/voiceQueue.model.js
server/api/voiceQueue/voiceQueue.rpc.js
server/api/voiceQueue/voiceQueue.socket.js
server/api/voiceQueueReport/index.js
server/api/voiceQueueReport/voiceQueueReport.attributes.js
server/api/voiceQueueReport/voiceQueueReport.controller.js
server/api/voiceQueueReport/voiceQueueReport.events.js
server/api/voiceQueueReport/voiceQueueReport.model.js
server/api/voiceQueueReport/voiceQueueReport.rpc.js
server/api/voiceQueueReport/voiceQueueReport.socket.js
server/api/voiceQueuesLog/index.js
server/api/voiceQueuesLog/voiceQueuesLog.attributes.js
server/api/voiceQueuesLog/voiceQueuesLog.controller.js
server/api/voiceQueuesLog/voiceQueuesLog.model.js
server/api/voiceQueuesLog/voiceQueuesLog.rpc.js
server/api/voiceRecording/index.js
server/api/voiceRecording/voiceRecording.attributes.js
server/api/voiceRecording/voiceRecording.controller.js
server/api/voiceRecording/voiceRecording.model.js
server/api/voiceRecording/voiceRecording.rpc.js
server/api/voiceTransferReport/index.js
server/api/voiceTransferReport/voiceTransferReport.attributes.js
server/api/voiceTransferReport/voiceTransferReport.controller.js
server/api/voiceTransferReport/voiceTransferReport.model.js
server/api/voiceTransferReport/voiceTransferReport.rpc.js
server/api/webbar/index.js
server/api/webbar/webbar.controller.js
server/api/whatsappAccount/index.js
server/api/whatsappAccount/whatsappAccount.attributes.js
server/api/whatsappAccount/whatsappAccount.controller.js
server/api/whatsappAccount/whatsappAccount.events.js
server/api/whatsappAccount/whatsappAccount.model.js
server/api/whatsappAccount/whatsappAccount.rpc.js
server/api/whatsappAccount/whatsappAccount.socket.js
server/api/whatsappApplication/index.js
server/api/whatsappApplication/whatsappApplication.attributes.js
server/api/whatsappApplication/whatsappApplication.controller.js
server/api/whatsappApplication/whatsappApplication.model.js
server/api/whatsappApplication/whatsappApplication.rpc.js
server/api/whatsappInteraction/index.js
server/api/whatsappInteraction/whatsappInteraction.attributes.js
server/api/whatsappInteraction/whatsappInteraction.controller.js
server/api/whatsappInteraction/whatsappInteraction.events.js
server/api/whatsappInteraction/whatsappInteraction.model.js
server/api/whatsappInteraction/whatsappInteraction.rpc.js
server/api/whatsappInteraction/whatsappInteraction.socket.js
server/api/whatsappMessage/index.js
server/api/whatsappMessage/whatsappMessage.attributes.js
server/api/whatsappMessage/whatsappMessage.controller.js
server/api/whatsappMessage/whatsappMessage.events.js
server/api/whatsappMessage/whatsappMessage.model.js
server/api/whatsappMessage/whatsappMessage.rpc.js
server/api/whatsappMessage/whatsappMessage.socket.js
server/api/whatsappQueue/index.js
server/api/whatsappQueue/whatsappQueue.attributes.js
server/api/whatsappQueue/whatsappQueue.controller.js
server/api/whatsappQueue/whatsappQueue.events.js
server/api/whatsappQueue/whatsappQueue.model.js
server/api/whatsappQueue/whatsappQueue.rpc.js
server/api/whatsappQueue/whatsappQueue.socket.js
server/api/whatsappQueueReport/index.js
server/api/whatsappQueueReport/whatsappQueueReport.attributes.js
server/api/whatsappQueueReport/whatsappQueueReport.controller.js
server/api/whatsappQueueReport/whatsappQueueReport.model.js
server/api/whatsappQueueReport/whatsappQueueReport.rpc.js
server/api/whatsappTransferReport/index.js
server/api/whatsappTransferReport/whatsappTransferReport.attributes.js
server/api/whatsappTransferReport/whatsappTransferReport.controller.js
server/api/whatsappTransferReport/whatsappTransferReport.model.js
server/api/whatsappTransferReport/whatsappTransferReport.rpc.js
server/app.js
server/components/auth/service.js
server/components/encryptor/index.js
server/components/export/csv.js
server/components/export/pdf.js
server/components/export/xlsx.js
server/components/extensions/rewrite.js
server/components/import/cm/csv.js
server/components/import/cm/csv2.js
server/components/import/cm/csvUpdates.js
server/components/integrations/configuration.js
server/components/interaction/service.js
server/components/license/service.js
server/components/parsers/advancedSearch.js
server/components/parsers/qs.js
server/config/express.js
server/config/license/hardware.js
server/config/license/index.js
server/config/license/util.js
server/config/local.env.js
server/config/logger.js
server/config/pm2/config.js
server/config/pm2/index.js
server/config/schedule/chat.js
server/config/schedule/cloud-provider.js
server/config/schedule/index.js
server/config/schedule/transcribe.js
server/config/schedule/whatsapp.js
server/config/seedContact.js
server/config/seedUsers.js
server/config/socketio.js
server/config/triggers/index.js
server/config/utils.js
server/errors/api.js
server/errors/index.js
server/mysqldb/index.js
server/routes.js
server/rpc/index.js
server/services/agi/channel.js
server/services/agi/error.js
server/services/agi/events.js
server/services/agi/graph/index.js
server/services/agi/index.js
server/services/agi/mailRpc/index.js
server/services/agi/project.js
server/services/agi/reply.js
server/services/agi/rpc/index.js
server/services/agi/scripts/aws/index.js
server/services/agi/scripts/aws/lex/index.js
server/services/agi/scripts/aws/lex/lib/api.js
server/services/agi/scripts/aws/polly/index.js
server/services/agi/scripts/aws/polly/lib/api.js
server/services/agi/scripts/google/asr/index.js
server/services/agi/scripts/google/asr/lib/api.js
server/services/agi/scripts/google/index.js
server/services/agi/scripts/index.js
server/services/agi/scripts/sestek/index.js
server/services/agi/scripts/sestek/nda/index.js
server/services/agi/scripts/tilde/asr/index.js
server/services/agi/scripts/tilde/asr/lib/api.js
server/services/agi/scripts/tilde/index.js
server/services/agi/server.js
server/services/agi/vertices.js
server/services/ami/acw/index.js
server/services/ami/ami.js
server/services/ami/client.js
server/services/ami/dialer/action.js
server/services/ami/dialer/agentComplete.js
server/services/ami/dialer/final.js
server/services/ami/dialer/hangup.js
server/services/ami/dialer/history.js
server/services/ami/dialer/index.js
server/services/ami/dialer/queueCallerAbandon.js
server/services/ami/fax/action.js
server/services/ami/fax/index.js
server/services/ami/fax/rpcDb.js
server/services/ami/fax/util/gs.js
server/services/ami/fax/util/util.js
server/services/ami/index.js
server/services/ami/model/agent.js
server/services/ami/model/campaign.js
server/services/ami/model/channel.js
server/services/ami/model/deskAccount.js
server/services/ami/model/dynamics365Account.js
server/services/ami/model/faxAccount.js
server/services/ami/model/freshdeskAccount.js
server/services/ami/model/freshsalesAccount.js
server/services/ami/model/queueReport.js
server/services/ami/model/salesforceAccount.js
server/services/ami/model/servicenowAccount.js
server/services/ami/model/sugarcrmAccount.js
server/services/ami/model/telephone.js
server/services/ami/model/template.js
server/services/ami/model/trigger.js
server/services/ami/model/trunk.js
server/services/ami/model/voiceExtension.js
server/services/ami/model/voiceQueue.js
server/services/ami/model/vtigerAccount.js
server/services/ami/model/zendeskAccount.js
server/services/ami/model/zohoAccount.js
server/services/ami/preview/action.js
server/services/ami/preview/index.js
server/services/ami/preview/rpcDb.js
server/services/ami/preview/util/util.js
server/services/ami/properties.js
server/services/ami/realtime/index.js
server/services/ami/report/index.js
server/services/ami/report/userReport.js
server/services/ami/report/voiceAgentReport.js
server/services/ami/report/voiceCallReport.js
server/services/ami/report/voiceDialReport.js
server/services/ami/report/voiceQueueReport.js
server/services/ami/rpc/agentReportPreview.js
server/services/ami/rpc/attachment.js
server/services/ami/rpc/campaign.js
server/services/ami/rpc/cmContact.js
server/services/ami/rpc/cmHopper.js
server/services/ami/rpc/cmHopperAdditionalPhone.js
server/services/ami/rpc/cmHopperBlack.js
server/services/ami/rpc/cmHopperFinal.js
server/services/ami/rpc/cmHopperHistory.js
server/services/ami/rpc/faxAccount.js
server/services/ami/rpc/faxMessage.js
server/services/ami/rpc/integrations/desk.js
server/services/ami/rpc/integrations/dynamics365.js
server/services/ami/rpc/integrations/freshdesk.js
server/services/ami/rpc/integrations/freshsales.js
server/services/ami/rpc/integrations/salesforce.js
server/services/ami/rpc/integrations/servicenow.js
server/services/ami/rpc/integrations/sugarcrm.js
server/services/ami/rpc/integrations/vtiger.js
server/services/ami/rpc/integrations/zendesk.js
server/services/ami/rpc/integrations/zoho.js
server/services/ami/rpc/memberReport.js
server/services/ami/rpc/setting.js
server/services/ami/rpc/template.js
server/services/ami/rpc/trigger.js
server/services/ami/rpc/trunk.js
server/services/ami/rpc/user.js
server/services/ami/rpc/voiceAgentReport.js
server/services/ami/rpc/voiceCallReport.js
server/services/ami/rpc/voiceDialReport.js
server/services/ami/rpc/voiceExtension.js
server/services/ami/rpc/voiceQueue.js
server/services/ami/rpc/voiceQueueReport.js
server/services/ami/rpc/voiceQueueRt.js
server/services/ami/rpc/voiceRecording.js
server/services/ami/rpc/voiceTransferReport.js
server/services/ami/server/index.js
server/services/ami/trigger/cmContact/index.js
server/services/ami/trigger/index.js
server/services/ami/trigger/integration/desk.js
server/services/ami/trigger/integration/dynamics365.js
server/services/ami/trigger/integration/freshdesk.js
server/services/ami/trigger/integration/freshsales.js
server/services/ami/trigger/integration/index.js
server/services/ami/trigger/integration/salesforce.js
server/services/ami/trigger/integration/servicenow.js
server/services/ami/trigger/integration/sugarcrm.js
server/services/ami/trigger/integration/util.js
server/services/ami/trigger/integration/vtiger.js
server/services/ami/trigger/integration/zendesk.js
server/services/ami/trigger/integration/zoho.js
server/services/ami/trigger/script/index.js
server/services/ami/trigger/urlforward/index.js
server/services/email/client.js
server/services/email/index.js
server/services/email/lib/email.js
server/services/email/lib/imap.js
server/services/email/lib/smtp.js
server/services/email/lib/utils.js
server/services/email/model/mailAccount.js
server/services/email/realtime/index.js
server/services/email/rpc/mailAccount.js
server/services/email/rpc/setting.js
server/services/email/server/index.js
server/services/express/index.js
server/services/routing/client.js
server/services/routing/index.js
server/services/routing/lib/rule-engine.js
server/services/routing/mailRpc/index.js
server/services/routing/model/agent.js
server/services/routing/model/chatQueue.js
server/services/routing/model/faxQueue.js
server/services/routing/model/interval.js
server/services/routing/model/mailQueue.js
server/services/routing/model/openchannelQueue.js
server/services/routing/model/smsQueue.js
server/services/routing/model/whatsappQueue.js
server/services/routing/realtime/index.js
server/services/routing/rpc/chatInteraction.js
server/services/routing/rpc/chatMessage.js
server/services/routing/rpc/chatQueue.js
server/services/routing/rpc/chatQueueReport.js
server/services/routing/rpc/faxInteraction.js
server/services/routing/rpc/faxMessage.js
server/services/routing/rpc/faxQueue.js
server/services/routing/rpc/faxQueueReport.js
server/services/routing/rpc/interval.js
server/services/routing/rpc/mailInteraction.js
server/services/routing/rpc/mailMessage.js
server/services/routing/rpc/mailQueue.js
server/services/routing/rpc/mailQueueReport.js
server/services/routing/rpc/openchannelInteraction.js
server/services/routing/rpc/openchannelMessage.js
server/services/routing/rpc/openchannelQueue.js
server/services/routing/rpc/openchannelQueueReport.js
server/services/routing/rpc/smsInteraction.js
server/services/routing/rpc/smsMessage.js
server/services/routing/rpc/smsQueue.js
server/services/routing/rpc/smsQueueReport.js
server/services/routing/rpc/user.js
server/services/routing/rpc/whatsappInteraction.js
server/services/routing/rpc/whatsappMessage.js
server/services/routing/rpc/whatsappQueue.js
server/services/routing/rpc/whatsappQueueReport.js
server/services/routing/server/applications/agent.js
server/services/routing/server/applications/amazonlex.js
server/services/routing/server/applications/autoreply.js
server/services/routing/server/applications/close.js
server/services/routing/server/applications/dialogflow.js
server/services/routing/server/applications/dialogflowV2.js
server/services/routing/server/applications/gotoif.js
server/services/routing/server/applications/gotop.js
server/services/routing/server/applications/message.js
server/services/routing/server/applications/noop.js
server/services/routing/server/applications/queue.js
server/services/routing/server/applications/strategy/agent.js
server/services/routing/server/applications/strategy/beepall.js
server/services/routing/server/applications/strategy/index.js
server/services/routing/server/applications/strategy/rrmemory.js
server/services/routing/server/applications/strategy/util.js
server/services/routing/server/applications/system.js
server/services/routing/server/applications/tag.js
server/services/routing/server/applications/tvox.js
server/services/routing/server/applications/utils.js
server/services/routing/server/index.js
server/services/routing/server/interval.js
server/services/xdr/agents.controller.js
server/services/xdr/calls.controller.js
server/services/xdr/core.controller.js
server/services/xdr/dials.controller.js
server/services/xdr/index.js
server/services/xdr/members.controller.js
server/services/xdr/queues.controller.js
server/services/xdr/recordings.controller.js
server/services/xdr/transfers.controller.js
server/services/xdr/utils.js
server/utils/client-side-logger.js
server/utils/loggers.js
server/utils/mask-sensitive-data.js
server/utils/safe-template.js

index 2ff0503..8d4c7e8 100644 (file)
@@ -17,7 +17,7 @@ define({
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2022-03-16T14:49:16.041Z",
+    "time": "2022-03-16T16:03:26.246Z",
     "url": "http://apidocjs.com",
     "version": "0.24.0"
   }
index e594f87..deba531 100644 (file)
@@ -17,7 +17,7 @@
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2022-03-16T14:49:16.041Z",
+    "time": "2022-03-16T16:03:26.246Z",
     "url": "http://apidocjs.com",
     "version": "0.24.0"
   }
index 886c85c..8ee4c1a 100644 (file)
@@ -66,7 +66,7 @@
   <script src="assets/plugins/angular-material-form-builder/dist/angular-material-form-builder.min.js"></script>
   <!-- ANGULAR-MATERIAL-FORM-BUILDER -->
 
-  <script src="scripts/app.74f92198.js"></script>
+  <script src="scripts/app.2c4dd8b8.js"></script>
 
   <!-- CKEDITOR -->
   <script src="assets/plugins/ckeditor/ckeditor.js"></script>
similarity index 52%
rename from public/scripts/app.74f92198.js
rename to public/scripts/app.2c4dd8b8.js
index 201859e..139af59 100644 (file)
@@ -1 +1 @@
-!function(){"use strict";angular.module("app.auth",[])}(),function(){"use strict";angular.module("app.client-side-logging",[])}(),function(){"use strict";angular.module("app.core",["ngAnimate","ngAria","ngCookies","ngMessages","ngResource","ngSanitize","ngMaterial","pascalprecht.translate","ui.router","ui.router.state.events","gridster","ds.clock","angucomplete-alt"])}(),function(){"use strict";function e(e,n){e.state("app.errors_error-404",{url:"/errors/error-404",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.errors_error-404":{templateUrl:"app/errors/404/error-404.html",controller:"Error404Controller as vm"}},params:{status:404,statusText:"",data:{},config:{}},bodyClass:"error-404"}),n.addPart("app/errors/404")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.errors.error-404",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.errors_error-500",{url:"/errors/error-500",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.errors_error-500":{templateUrl:"app/errors/500/error-500.html",controller:"Error500Controller as vm"}},params:{status:500,statusText:"",data:{},config:{}},bodyClass:"error-500"}),n.addPart("app/errors/500")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.errors.error-500",[]).config(e)}(),function(){"use strict";angular.module("app.errors",["app.errors.error-404","app.errors.error-500"])}(),function(){"use strict";function e(e){e.addPart("app/footer")}e.$inject=["$translatePartialLoaderProvider"],angular.module("app.footer",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.forgot",{url:"/forgot",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.forgot":{templateUrl:"app/forgot/forgot.html",controller:"ForgotPasswordController as vm"}},bodyClass:"forgot"}),n.addPart("app/forgot")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.forgot",[]).config(e)}(),function(){"use strict";function e(e){e.addPart("app/header")}e.$inject=["$translatePartialLoaderProvider"],angular.module("app.header",[]).config(e)}(),function(){"use strict";angular.module("motion",["angular-toasty","app.core","app.auth","app.navigation","app.toolbar","app.quick-panel","app.header","app.footer","app.realtime","app.dashboards","app.staff","app.contactmanager","app.voice","app.chat","app.mail","app.sms","app.openchannel","app.fax","app.tools","app.callysquare","app.analytics","app.integrations","app.settings","app.motiondialer","app.help","app.jscripty","app.marketplace","app.plugins","app.video","app.whatsapp","app.login","app.forgot","app.reset","app.errors","app.user-setting","app.client-side-logging"])}(),function(){"use strict";function e(e,n){e.state("app.login",{url:"/login?token&userId",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.login":{templateUrl:"app/login/login.html",controller:"LoginController as vm"}},bodyClass:"login"}),n.addPart("app/login")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.login",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.analytics",{abstract:!0,url:"/analytics"}).state("app.analytics.metrics",{url:"/metrics",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/metrics/metrics.html",controller:"MetricsController as vm"}},resolve:{metrics:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("analyticMetric@get",{fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Metrics",fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1201})}]},authenticate:!0,permissionId:1201,bodyClass:"analytics"}).state("app.analytics.extractedReports",{url:"/extractedReports",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/extractedReports/extractedReports.html",controller:"ExtractedReportsController as vm"}},resolve:{extractedReports:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("analyticExtractedReport@get",{fields:"createdAt,updatedAt,id,name,basename,savename,type,startDate,endDate,status,output,reportId,reportType",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ExtractedReports",fields:"createdAt,updatedAt,id,name,basename,savename,type,startDate,endDate,status,output,reportId,reportType",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1202})}]},authenticate:!0,permissionId:1202,bodyClass:"analytics"}),n.addPart("app/main/apps/analytics")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.analytics",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.analytics.reports"]).config(e)}(),function(){"use strict";function e(e){e.state("app.analytics.reports",{url:"/reports",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/reports/reports.html",controller:"ReportsController as vm"}},resolve:{treeReports:["apiResolver",function(e){return e.resolve("analyticTreeReport@get",{fields:"id,tree",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1203})}]},authenticate:!0,permissionId:1203,bodyClass:"analytics"}).state("app.analytics.reports.edit",{url:"/:id?tab",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/reports/edit/view.html",controller:"ReportController as vm"}},resolve:{report:["apiResolver","$stateParams","$q","describeTable",function(e,n,a,i){var s;return e.resolve("analyticCustomReport@get",{fields:"createdAt,updatedAt,id,name,description,table,conditions,joins",id:n.id}).then(function(e){var n=[];if((s=e).joins)try{s.joins=JSON.parse(s.joins);for(var t=0;t<s.joins.length;t+=1)n.push(i.getColumns(s.joins[t].foreignTable))}catch(e){console.log(e)}return a.all(n)}).then(function(e){for(var n=0;n<e.length;n+=1)s.joins[n].foreignTableFields=_.difference(_.keys(e[n]),["$promise","$resolved"]);return s})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1203})}]},authenticate:!0,permissionId:1203,bodyClass:"analytics"})}e.$inject=["$stateProvider"],angular.module("app.analytics.reports",["ngJsTree"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.callysquare",{abstract:!0,url:"/callysquare"}).state("app.callysquare.odbcs",{url:"/odbcs",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/odbcs/odbcs.html",controller:"OdbcsController as vm"}},resolve:{odbcs:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareOdbc@get",{fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ODBC",fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1101})}]},authenticate:!0,permissionId:1101,bodyClass:"callysquare"}).state("app.callysquare.squareRecordings",{url:"/squareRecordings",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/squareRecordings/squareRecordings.html",controller:"SquareRecordingsController as vm"}},resolve:{squareRecordings:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareRecording@get",{fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio,savePath,format",sort:"-createdAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SquareRecordings",fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio,savePath,format",sort:"-createdAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadCallySquareRecordings",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1102})}]},authenticate:!0,permissionId:1102,bodyClass:"callysquare"}),n.addPart("app/main/apps/callysquare")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.callysquare",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.callysquare.projects"]).config(e)}(),function(){"use strict";function e(e){e.state("app.callysquare.projects",{url:"/projects",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/projects/projects.html",controller:"ProjectsController as vm"}},resolve:{projects:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareProject@get",{fields:"id,name,description,notes",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SquareProjects",fields:"id,name,description,notes",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1103})}]},authenticate:!0,permissionId:1103,bodyClass:"callysquare"}).state("app.callysquare.projects.edit",{url:"/:id",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/projects/edit/view.html",controller:"ProjectController as vm"}},params:{crudPermissions:void 0},resolve:{project:["apiResolver","$stateParams",function(e,n){return e.resolve("squareProject@get",{id:n.id})}],users:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,fullname,role",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Users",mergeResources:!0,fields:"id,fullname,role",sort:"name",nolimit:!0})}],trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",sort:"name",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",type:"inbound",fields:"id,name",sort:"name",nolimit:!0})}],sounds:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("sound@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Sounds",fields:"id,name",sort:"name",nolimit:!0})}],variables:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("variable@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Variables",fields:"id,name",sort:"name",nolimit:!0})}],databases:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareOdbc@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ODBC",fields:"id,name",sort:"name",nolimit:!0})}],projects:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareProject@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SquareProjects",fields:"id,name",sort:"name",nolimit:!0})}],contexts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceContext@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Contexts",fields:"id,name",sort:"name",nolimit:!0})}],intervals:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("interval@get",{fields:"id,name,IntervalId",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Intervals",fields:"id,name,IntervalId",sort:"name",nolimit:!0})}],mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",fields:"id,name",sort:"name",nolimit:!0})}],templates:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("template@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Templates",fields:"id,name",sort:"name",nolimit:!0})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"name",nolimit:!0})}],smsAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsAccount@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"id,name",sort:"name",nolimit:!0})}],pauses:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("pause@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Pauses",fields:"id,name",sort:"name",nolimit:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1103})}]},authenticate:!0,permissionId:1103,bodyClass:"callysquare"})}e.$inject=["$stateProvider"],angular.module("app.callysquare.projects",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.chat",{abstract:!0,url:"/chat"}).state("app.chat.chatQueues",{url:"/chatQueues",views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatQueues/chatQueues.html",controller:"ChatQueuesController as vm"}},resolve:{chatQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("chatQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"chat",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChatQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"chat",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:501})}]},authenticate:!0,permissionId:501,bodyClass:"chat"}).state("app.chat.chatQueues.edit",{url:"/:id?tab",params:{chatQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatQueues/edit/view.html",controller:"ChatQueueController as vm"}},resolve:{chatQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("chatQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:501})}]},authenticate:!0,permissionId:501,bodyClass:"chat"}).state("app.chat.chatWebsites",{url:"/chatWebsites",views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatWebsites/chatWebsites.html",controller:"ChatWebsitesController as vm"}},resolve:{chatWebsites:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("chatWebsite@get",{fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChatWebsites",fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:502})}]},authenticate:!0,permissionId:502,bodyClass:"chat"}).state("app.chat.chatWebsites.edit",{url:"/:id?tab",params:{chatWebsite:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatWebsites/edit/view.html",controller:"ChatWebsiteController as vm"}},resolve:{chatWebsite:["apiResolver","$stateParams",function(e,n){return e.resolve("chatWebsite@get",{fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadAttachments,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:502})}]},authenticate:!0,permissionId:502,bodyClass:"chat"}),n.addPart("app/main/apps/chat")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.chat",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.chat.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.chat.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/chat/views/realtime/realtime.html",controller:"ChatRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:510})}]},authenticate:!0,permissionId:510}).state("app.chat.realtime.agents",{url:"/agents",params:{channel:"chat"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:510}).state("app.chat.realtime.queues",{url:"/queues",controller:"QueuesChatRealtimeController as vm",templateUrl:"app/main/apps/chat/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"ChatQueues":void 0,channel:"chat",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:501})}]},authenticate:!0,permissionId:510})}e.$inject=["$stateProvider"],angular.module("app.chat.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.contactmanager",{abstract:!0,url:"/contactmanager"}).state("app.contactmanager.lists",{url:"/lists",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/lists/lists.html",controller:"ListsController as vm"}},resolve:{lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadContactManagerLists",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:301})}]},authenticate:!0,permissionId:301,bodyClass:"contactmanager"}).state("app.contactmanager.lists.edit",{url:"/:id?tab",params:{list:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/lists/edit/view.html",controller:"ListController as vm"}},resolve:{list:["apiResolver","$stateParams",function(e,n){return e.resolve("cmList@get",{fields:"createdAt,updatedAt,id,name,description,dialPrefix",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:301})}]},authenticate:!0,permissionId:301,bodyClass:"contactmanager"}).state("app.contactmanager.companies",{url:"/companies",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/companies/companies.html",controller:"CompaniesController as vm"}},resolve:{companies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmCompany@get",{fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Companies",fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:302})}]},authenticate:!0,permissionId:302,bodyClass:"contactmanager"}).state("app.contactmanager.companies.edit",{url:"/:id?tab",params:{company:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/companies/edit/view.html",controller:"CompanyController as vm"}},resolve:{company:["apiResolver","$stateParams",function(e,n){return e.resolve("cmCompany@get",{fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:302})}]},authenticate:!0,permissionId:302,bodyClass:"contactmanager"}).state("app.contactmanager.globalCustomFields",{url:"/globalCustomFields",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/globalCustomFields/globalCustomFields.html",controller:"GlobalCustomFieldsController as vm"}},resolve:{globalCustomFields:["apiResolver","Auth",function(e,n){return e.resolve("cmCustomField@get",{fields:"createdAt,updatedAt,id,alias,type,values,required,clickToAction,actionType",sort:"-updatedAt",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:304})}]},authenticate:!0,permissionId:304,bodyClass:"contactmanager"}),n.addPart("app/main/apps/contactmanager")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.contactmanager",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.contactmanager.contacts"]).config(e)}(),function(){"use strict";function e(e){e.state("app.contactmanager.contacts",{url:"/contacts?ListId&CompanyId",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/contacts/contacts.html",controller:"ContactsController as vm"}},resolve:{contacts:["apiResolver","Auth","$stateParams",function(e,n,t){return n.hasRole("admin")?e.resolve("cmContact@get",_.merge({includeAll:!0,sort:"-updatedAt",limit:10,offset:0},t)):e.resolve("userProfile@getResources",_.merge({id:n.getCurrentUser().userProfileId,section:"Contacts",includeAll:!0,sort:"-updatedAt",limit:10,offset:0},t))}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"-updatedAt",nolimit:!0})}],listsMap:["lists",function(e){for(var n={},t=0;t<e.rows.length;t++)n[e.rows[t].id]=e.rows[t].name;return n}],companies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmCompany@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Companies",fields:"id,name",sort:"name",nolimit:!0})}],companiesMap:["companies",function(e){for(var n={},t=0;t<e.rows.length;t++)n[e.rows[t].id]=e.rows[t].name;return n}],tags:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("tag@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Tags",fields:"id,name",sort:"name",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:303})}]},authenticate:!0,permissionId:303,bodyClass:"contactmanager"}).state("app.contactmanager.contacts.edit",{url:"/:id?tab",params:{crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/contacts/edit/view.html",controller:"ContactController as vm"}},resolve:{contact:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@get",{id:n.id}).then(function(e){return e.dateOfBirth&&(e.dateOfBirth=new Date(e.dateOfBirth)),e}).catch(function(e){console.error(e)})}],hoppers:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getHoppers",{id:n.id,fields:"id,phone,scheduledat,priority,recallme,VoiceQueueId,CampaignId,UserId",sort:"-updatedAt",limit:10,offset:0})}],finals:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getHopperFinals",{id:n.id,fields:"id,uniqueid,calleridnum,statedesc,starttime,disposition",sort:"-updatedAt",limit:10,offset:0})}],histories:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getHopperHistories",{id:n.id,fields:"id,uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-updatedAt",limit:10,offset:0})}],jscriptySessions:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getJscriptySessions",{id:n.id,fields:"id,starttime,endtime,membername,projectname",sort:"-starttime",limit:10,offset:0})}],companies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmCompany@get"):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Companies"})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"-updatedAt",nolimit:!0})}],customFields:["apiResolver","contact",function(e,n){return n.ListId?e.resolve("cmList@getCustomFields",{id:n.ListId}):null}],tags:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("tag@get",{sort:"name"}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Tags"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:303})}]},authenticate:!0,permissionId:303,bodyClass:"contactmanager"})}e.$inject=["$stateProvider"],angular.module("app.contactmanager.contacts",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.dashboards",{abstract:!0,url:"/dashboards"}),n.addPart("app/main/apps/dashboards")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.dashboards",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.dashboards.general","app.dashboards.custom"]).config(e)}(),function(){"use strict";function e(e){e.state("app.dashboards.custom",{url:"/custom/:id",views:{"content@app":{templateUrl:"app/main/apps/dashboards/views/custom/custom.html",controller:"DashboardCustomController as vm"}},resolve:{voiceQueues:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("voiceQueue@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"VoiceQueues",mergeResources:!0,fields:"id,name",channel:"voice",nolimit:!0})).then(function(e){return t=e,n.resolve("rpc@getVoiceQueues",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)t&&t.id===e.rows[n].id?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged,a.abandoned+=e.rows[n].abandoned):(a=_.find(t.rows,{id:e.rows[n].id}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged","abandoned"]));return t})}],faxAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("faxAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"FaxAccounts",mergeResources:!0,fields:"id,name",channel:"fax",nolimit:!0})).then(function(e){return t=e,n.resolve("faxInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].FaxAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].FaxAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],chatWebsites:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("chatWebsite@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"ChatWebsites",mergeResources:!0,fields:"id,name",channel:"chat",nolimit:!0})).then(function(e){return t=e,n.resolve("chatInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].ChatWebsiteId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.abandoned+=e.rows[n].abandoned,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].ChatWebsiteId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","abandoned","unmanaged"]));return t})}],smsAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("smsAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"SmsAccounts",mergeResources:!0,fields:"id,name",channel:"sms",nolimit:!0})).then(function(e){return t=e,n.resolve("smsInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].SmsAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].SmsAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],openchannelAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("openchannelAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"OpenchannelAccounts",mergeResources:!0,fields:"id,name",channel:"openchannel",nolimit:!0})).then(function(e){return t=e,n.resolve("openchannelInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].OpenchannelAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].OpenchannelAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],mailAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("mailAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"MailAccounts",mergeResources:!0,fields:"id,name",channel:"mail",nolimit:!0})).then(function(e){return t=e,n.resolve("mailInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].MailAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].MailAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],whatsappAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("whatsappAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"WhatsappAccounts",mergeResources:!0,fields:"id,name",channel:"whatsapp",nolimit:!0})).then(function(e){return t=e,n.resolve("whatsappInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].WhatsappAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].WhatsappAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:100})}]},authenticate:!0,bodyClass:"dashboards"})}e.$inject=["$stateProvider"],angular.module("app.dashboards.custom",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.dashboards.general",{url:"/general",views:{"content@app":{templateProvider:["$stateParams","$templateFactory","Auth","$window",function(e,n,t,a){var i=t.getCurrentUser();return null===a.localStorage.getItem("motion2.user:"+i.id)&&a.localStorage.setItem("motion2.user:"+i.id,JSON.stringify({authenticationType:"google"})),t.isAgent()?n.fromUrl("app/main/apps/dashboards/views/general/agent/agent.general.html",e):n.fromUrl("app/main/apps/dashboards/views/general/user/user.general.html",e)}],controllerProvider:["Auth",function(e){return e.isAgent()?"AgentDashboardGeneralController as vm":"UserDashboardGeneralController as vm"}]}},resolve:{globalUserLists:["apiResolver","Auth",function(e,n){return e.resolve("user@getLists",{id:n.getCurrentUser().id,sort:"name",nolimit:!0})}],globalLists:["apiResolver",function(e){return e.resolve("cmList@get",{sort:"name",nolimit:!0})}],globalTags:["apiResolver",function(e){return e.resolve("tag@get",{sort:"name",nolimit:!0})}],globalCompanies:["apiResolver",function(e){return e.resolve("cmCompany@get",{sort:"name",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"})}e.$inject=["$stateProvider"],angular.module("app.dashboards.general",["ngMaterialDateRangePicker","app.dashboards.general.user"]).config(e)}(),function(){"use strict";function e(e){e.state("app.dashboards.general.voice",{url:"/voice",data:{selectedTab:0},views:{voice:{templateUrl:"app/main/apps/dashboards/views/general/user/voice/user.general.voice.html",controller:"UserVoiceDashboardGeneralController as vm"}},resolve:{rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}],inboundQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"inbound",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",fields:"id,name",type:"inbound",channel:"voice",nolimit:!0})}],outbound:["apiResolver",function(e){return e.resolve("rpc@getOutbound")}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.dialer",{url:"/dialer",data:{selectedTab:1},views:{dialer:{templateUrl:"app/main/apps/dashboards/views/general/user/dialer/user.general.dialer.html",controller:"UserVoiceDashboardDialerController as vm"}},resolve:{rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}],outboundQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"outbound",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",fields:"id,name",type:"outbound",channel:"voice",nolimit:!0})}],rpcCampaigns:["apiResolver",function(e){return e.resolve("rpc@getCampaigns")}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.chat",{url:"/chat",data:{selectedTab:2},views:{chat:{templateUrl:"app/main/apps/dashboards/views/general/user/chat/user.general.chat.html",controller:"UserChatDashboardGeneralController as vm"}},resolve:{chatInteractions:["apiResolver",function(e){return e.resolve("chatInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],chatWebsites:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("chatWebsite@get",{fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,header_offline,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardTranscript,forwardOffline,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,description,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChatWebsites",fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,header_offline,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardTranscript,forwardOffline,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,description,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.mail",{url:"/mail",data:{selectedTab:3},views:{mail:{templateUrl:"app/main/apps/dashboards/views/general/user/mail/user.general.mail.html",controller:"UserMailDashboardGeneralController as vm"}},resolve:{mailInteractions:["apiResolver",function(e){return e.resolve("mailInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,name,provider,key,email,ListId,active,service,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",fields:"createdAt,updatedAt,id,name,provider,key,email,ListId,active,service,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.sms",{url:"/sms",data:{selectedTab:4},views:{sms:{templateUrl:"app/main/apps/dashboards/views/general/user/sms/user.general.sms.html",controller:"UserSmsDashboardGeneralController as vm"}},resolve:{smsInteractions:["apiResolver",function(e){return e.resolve("smsInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],smsAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,phone,type,accountSid,authId,authToken,smsMethod,applicationId,accountId,username,password,senderString,deliveryReport,waitForTheAssignedAgent,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,phone,type,accountSid,authId,authToken,smsMethod,applicationId,accountId,username,password,senderString,deliveryReport,waitForTheAssignedAgent,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.openchannel",{url:"/openchannel",data:{selectedTab:5},views:{openchannel:{templateUrl:"app/main/apps/dashboards/views/general/user/openchannel/user.general.openchannel.html",controller:"UserOpenchannelDashboardGeneralController as vm"}},resolve:{openchannelInteractions:["apiResolver",function(e){return e.resolve("openchannelInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],openchannelAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,description,receiveUri,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OpenchannelAccounts",fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,description,receiveUri,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.fax",{url:"/fax",data:{selectedTab:6},views:{fax:{templateUrl:"app/main/apps/dashboards/views/general/user/fax/user.general.fax.html",controller:"UserFaxDashboardGeneralController as vm"}},resolve:{faxInteractions:["apiResolver",function(e){return e.resolve("faxInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],faxAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxAccounts",fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.whatsapp",{url:"/whatsapp",data:{selectedTab:7},views:{whatsapp:{templateUrl:"app/main/apps/dashboards/views/general/user/whatsapp/user.general.whatsapp.html",controller:"UserWhatsappDashboardGeneralController as vm"}},resolve:{whatsappInteractions:["apiResolver",function(e){return e.resolve("whatsappInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],whatsappAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("whatsappAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,phone,type,accountSid,authId,authToken,whatsappMethod,username,password,senderString,deliveryReport,waitForTheAssignedAgent,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"WhatsappAccounts",fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,phone,type,accountSid,authId,authToken,whatsappMethod,username,password,senderString,deliveryReport,waitForTheAssignedAgent,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,bodyClass:"dashboards"})}e.$inject=["$stateProvider"],angular.module("app.dashboards.general.user",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.fax",{abstract:!0,url:"/fax"}).state("app.fax.faxQueues",{url:"/faxQueues",views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxQueues/faxQueues.html",controller:"FaxQueuesController as vm"}},resolve:{faxQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"fax",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"fax",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:901})}]},authenticate:!0,permissionId:901,bodyClass:"fax"}).state("app.fax.faxQueues.edit",{url:"/:id?tab",params:{faxQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxQueues/edit/view.html",controller:"FaxQueueController as vm"}},resolve:{faxQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("faxQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:901})}]},authenticate:!0,permissionId:901,bodyClass:"fax"}).state("app.fax.faxAccounts",{url:"/faxAccounts",views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxAccounts/faxAccounts.html",controller:"FaxAccountsController as vm"}},resolve:{faxAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxAccounts",fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:902})}]},authenticate:!0,permissionId:902,bodyClass:"fax"}).state("app.fax.faxAccounts.edit",{url:"/:id?tab",params:{faxAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxAccounts/edit/view.html",controller:"FaxAccountController as vm"}},resolve:{faxAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:902})}]},authenticate:!0,permissionId:902,bodyClass:"fax"}),n.addPart("app/main/apps/fax")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.fax",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.fax.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.fax.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/fax/views/realtime/realtime.html",controller:"FaxRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:910})}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.agents",{url:"/agents",params:{channel:"fax"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.trunks",{url:"/trunks",controller:"TrunksFaxRealtimeController as vm",templateUrl:"app/main/apps/fax/views/realtime/trunks/view.html",resolve:{trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}],rpcTrunks:["apiResolver",function(e){return e.resolve("rpc@getTrunks")}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.queues",{url:"/queues",controller:"QueuesFaxRealtimeController as vm",templateUrl:"app/main/apps/fax/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"FaxQueues":void 0,channel:"fax",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:901})}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.accounts",{url:"/accounts",controller:"FaxAccountsRealtimeController as vm",templateUrl:"app/main/apps/fax/views/realtime/accounts/view.html",resolve:{faxAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxAccount@get",{sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxAccounts",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:902})}],rpcFaxAccounts:["apiResolver",function(e){return e.resolve("rpc@getFaxAccounts")}]},authenticate:!0,permissionId:910})}e.$inject=["$stateProvider"],angular.module("app.fax.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.help",{abstract:!0,url:"/help"}),n.addPart("app/main/apps/help")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.help",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.help.about"]).config(e)}(),function(){"use strict";function e(e){e.state("app.help.about",{url:"/about",views:{"content@app":{templateUrl:"app/main/apps/help/views/about/about.html",controller:"AboutController as vm"}},resolve:{info:["apiResolver",function(e){return e.resolve("version@get")}]},authenticate:!0,permissionId:1600,bodyClass:"help"})}e.$inject=["$stateProvider"],angular.module("app.help.about",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.integrations",{abstract:!0,url:"/integrations"}).state("app.integrations.zendeskAccounts",{url:"/zendeskAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zendeskAccounts/zendeskAccounts.html",controller:"ZendeskAccountsController as vm"}},resolve:{zendeskAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intZendeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ZendeskAccounts",fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1301})}]},authenticate:!0,permissionId:1301,bodyClass:"integrations"}).state("app.integrations.zendeskAccounts.edit",{url:"/:id?tab",params:{zendeskAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/view.html",controller:"ZendeskAccountController as vm"}},resolve:{zendeskAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intZendeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1301})}]},authenticate:!0,permissionId:1301,bodyClass:"integrations"}).state("app.integrations.salesforceAccounts",{url:"/salesforceAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/salesforceAccounts/salesforceAccounts.html",controller:"SalesforceAccountsController as vm"}},resolve:{salesforceAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intSalesforceAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SalesforceAccounts",fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1302})}]},authenticate:!0,permissionId:1302,bodyClass:"integrations"}).state("app.integrations.salesforceAccounts.edit",{url:"/:id?tab",params:{salesforceAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/view.html",controller:"SalesforceAccountController as vm"}},resolve:{salesforceAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intSalesforceAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1302})}]},authenticate:!0,permissionId:1302,bodyClass:"integrations"}).state("app.integrations.freshdeskAccounts",{url:"/freshdeskAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/freshdeskAccounts.html",controller:"FreshdeskAccountsController as vm"}},resolve:{freshdeskAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intFreshdeskAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FreshdeskAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1303})}]},authenticate:!0,permissionId:1303,bodyClass:"integrations"}).state("app.integrations.freshdeskAccounts.edit",{url:"/:id?tab",params:{freshdeskAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/view.html",controller:"FreshdeskAccountController as vm"}},resolve:{freshdeskAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intFreshdeskAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1303})}]},authenticate:!0,permissionId:1303,bodyClass:"integrations"}).state("app.integrations.sugarcrmAccounts",{url:"/sugarcrmAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/sugarcrmAccounts.html",controller:"SugarcrmAccountsController as vm"}},resolve:{sugarcrmAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intSugarcrmAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SugarcrmAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1305})}]},authenticate:!0,permissionId:1305,bodyClass:"integrations"}).state("app.integrations.sugarcrmAccounts.edit",{url:"/:id?tab",params:{sugarcrmAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/view.html",controller:"SugarcrmAccountController as vm"}},resolve:{sugarcrmAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intSugarcrmAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1305})}]},authenticate:!0,permissionId:1305,bodyClass:"integrations"}).state("app.integrations.deskAccounts",{url:"/deskAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/deskAccounts/deskAccounts.html",controller:"DeskAccountsController as vm"}},resolve:{deskAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intDeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"DeskAccounts",fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1306})}]},authenticate:!0,permissionId:1306,bodyClass:"integrations"}).state("app.integrations.deskAccounts.edit",{url:"/:id?tab",params:{deskAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/view.html",controller:"DeskAccountController as vm"}},resolve:{deskAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intDeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1306})}]},authenticate:!0,permissionId:1306,bodyClass:"integrations"}).state("app.integrations.zohoAccounts",{url:"/zohoAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zohoAccounts/zohoAccounts.html",controller:"ZohoAccountsController as vm"}},resolve:{zohoAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intZohoAccount@get",{fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ZohoAccounts",fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1307})}]},authenticate:!0,permissionId:1307,bodyClass:"integrations"}).state("app.integrations.zohoAccounts.edit",{url:"/:id?tab",params:{zohoAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/view.html",controller:"ZohoAccountController as vm"}},resolve:{zohoAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intZohoAccount@get",{fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1307})}]},authenticate:!0,permissionId:1307,bodyClass:"integrations"}).state("app.integrations.vtigerAccounts",{url:"/vtigerAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/vtigerAccounts/vtigerAccounts.html",controller:"VtigerAccountsController as vm"}},resolve:{vtigerAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intVtigerAccount@get",{fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VtigerAccounts",fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1308})}]},authenticate:!0,permissionId:1308,bodyClass:"integrations"}).state("app.integrations.vtigerAccounts.edit",{url:"/:id?tab",params:{vtigerAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/view.html",controller:"VtigerAccountController as vm"}},resolve:{vtigerAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intVtigerAccount@get",{fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1308})}]},authenticate:!0,permissionId:1308,bodyClass:"integrations"}).state("app.integrations.dynamics365Accounts",{url:"/dynamics365Accounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/dynamics365Accounts.html",controller:"Dynamics365AccountsController as vm"}},resolve:{dynamics365Accounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intDynamics365Account@get",{fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description,modernAuthentication,CloudProviderId",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dynamics365Accounts",fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data7",sort:"-updatedAt",type:"Dynamics365",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1309})}]},authenticate:!0,permissionId:1309,bodyClass:"integrations"}).state("app.integrations.dynamics365Accounts.edit",{url:"/:id?tab",params:{dynamics365Account:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/view.html",controller:"Dynamics365AccountController as vm"}},resolve:{dynamics365Account:["apiResolver","$stateParams",function(e,n){return e.resolve("intDynamics365Account@get",{fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description,modernAuthentication,CloudProviderId",id:n.id})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data7",sort:"-updatedAt",type:"Dynamics365",limit:10,offset:0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1309})}]},authenticate:!0,permissionId:1309,bodyClass:"integrations"}).state("app.integrations.servicenowAccounts",{url:"/servicenowAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/servicenowAccounts/servicenowAccounts.html",controller:"ServicenowAccountsController as vm"}},resolve:{servicenowAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intServicenowAccount@get",{fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ServicenowAccounts",fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1310})}]},authenticate:!0,permissionId:1310,bodyClass:"integrations"}).state("app.integrations.servicenowAccounts.edit",{url:"/:id?tab",params:{servicenowAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/view.html",controller:"ServicenowAccountController as vm"}},resolve:{servicenowAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intServicenowAccount@get",{fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1310})}]},authenticate:!0,permissionId:1310,bodyClass:"integrations"}).state("app.integrations.freshsalesAccounts",{url:"/freshsalesAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/freshsalesAccounts.html",controller:"FreshsalesAccountsController as vm"}},resolve:{freshsalesAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intFreshsalesAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FreshsalesAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1304})}]},authenticate:!0,permissionId:1304,bodyClass:"integrations"}).state("app.integrations.freshsalesAccounts.edit",{url:"/:id?tab",params:{freshsalesAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/view.html",controller:"FreshsalesAccountController as vm"}},resolve:{freshsalesAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intFreshsalesAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1304})}]},authenticate:!0,permissionId:1304,bodyClass:"integrations"}),n.addPart("app/main/apps/integrations")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.integrations",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.jscripty",{abstract:!0,url:"/jscripty"}).state("app.jscripty.projects",{url:"/projects",views:{"content@app":{templateUrl:"app/main/apps/jscripty/views/projects/projects.html",controller:"JscriptyProjectsController as vm"}},resolve:{projects:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("jscriptyProject@get",{fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Projects",fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadJscriptySessions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1701})}]},authenticate:!0,permissionId:1701,bodyClass:"jscripty"}).state("app.jscripty.projects.edit",{url:"/:id?tab",params:{project:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/jscripty/views/projects/edit/view.html",controller:"JscriptyProjectController as vm"}},resolve:{project:["apiResolver","$stateParams",function(e,n){return e.resolve("jscriptyProject@get",{fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadJscriptySessions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1701})}]},authenticate:!0,permissionId:1701,bodyClass:"jscripty"}),n.addPart("app/main/apps/jscripty")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.jscripty",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.mail",{abstract:!0,url:"/mail"}).state("app.mail.mailQueues",{url:"/mailQueues",views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailQueues/mailQueues.html",controller:"MailQueuesController as vm"}},resolve:{mailQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"mail",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"mail",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:601})}]},authenticate:!0,permissionId:601,bodyClass:"mail"}).state("app.mail.mailQueues.edit",{url:"/:id?tab",params:{mailQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailQueues/edit/view.html",controller:"MailQueueController as vm"}},resolve:{mailQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("mailQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:601})}]},authenticate:!0,permissionId:601,bodyClass:"mail"}).state("app.mail.mailAccounts",{url:"/mailAccounts",views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailAccounts/mailAccounts.html",controller:"MailAccountsController as vm"}},resolve:{mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,name,provider,key,email,ListId,active,service,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",fields:"createdAt,updatedAt,id,name,provider,key,email,ListId,active,service,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:602})}]},authenticate:!0,permissionId:602,bodyClass:"mail"}).state("app.mail.mailAccounts.edit",{url:"/:id?tab",params:{mailAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailAccounts/edit/view.html",controller:"MailAccountController as vm"}},resolve:{mailAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,name,provider,key,email,ListId,active,service,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,name",sort:"name",type:"outlook365"})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadAttachments,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:602})}]},authenticate:!0,permissionId:602,bodyClass:"mail"}).state("app.mail.mailSubtatuses",{url:"/mailSubtatuses",views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailSubtatuses/mailSubtatuses.html",controller:"MailSubstatusesController as vm"}},resolve:{mailSubtatuses:["apiResolver",function(e){return e.resolve("mailSubstatus@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:603})}]},authenticate:!0,permissionId:603,bodyClass:"mail"}),n.addPart("app/main/apps/mail")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.mail",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.mail.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.mail.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/mail/views/realtime/realtime.html",controller:"MailRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:610})}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.agents",{url:"/agents",params:{channel:"mail"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.queues",{url:"/queues",controller:"QueuesMailRealtimeController as vm",templateUrl:"app/main/apps/mail/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"MailQueues":void 0,channel:"mail",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:601})}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.accounts",{url:"/accounts",controller:"MailAccountsRealtimeController as vm",templateUrl:"app/main/apps/mail/views/realtime/accounts/view.html",resolve:{mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:602})}],rpcMailAccounts:["apiResolver",function(e){return e.resolve("rpc@getMailAccounts")}]},authenticate:!0,permissionId:610})}e.$inject=["$stateProvider"],angular.module("app.mail.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.marketplace",{abstract:!0,url:"/marketplace"}).state("app.marketplace.plugins",{url:"/plugins",views:{"content@app":{templateUrl:"app/main/apps/marketplace/views/plugins/plugins.html",controller:"MarketplacePluginsController as vm"}},resolve:{plugins:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("plugin@get",{fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Plugins",fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1801})}]},authenticate:!0,permissionId:1801,bodyClass:"marketplace"}).state("app.marketplace.plugins.edit",{url:"/:id?tab",params:{plugin:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/marketplace/views/plugins/edit/view.html",controller:"MarketplacePluginController as vm"}},resolve:{plugin:["apiResolver","$stateParams",function(e,n){return e.resolve("plugin@get",{fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1801})}]},authenticate:!0,permissionId:1801,bodyClass:"marketplace"}),n.addPart("app/main/apps/marketplace")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.marketplace",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.motiondialer",{abstract:!0,url:"/motiondialer"}).state("app.motiondialer.queueCampaigns",{url:"/queueCampaigns",views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/queueCampaigns.html",controller:"QueueCampaignsController as vm"}},resolve:{queueCampaigns:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,callAdditionalPhoneAfterMin,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe,dialPreviewRecallmeReminder",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,callAdditionalPhoneAfterMin,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1501,bodyClass:"motiondialer"}).state("app.motiondialer.queueCampaigns.edit",{url:"/:id?tab",params:{queueCampaign:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/view.html",controller:"QueueCampaignController as vm"}},resolve:{queueCampaign:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe,dialPreviewRecallmeReminder,callAdditionalPhoneAfterMin",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1501,bodyClass:"motiondialer"}).state("app.motiondialer.ivrCampaigns",{url:"/ivrCampaigns",views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/ivrCampaigns.html",controller:"IvrCampaignsController as vm"}},resolve:{ivrCampaigns:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("campaign@get",{fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",type:"ivr",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"IvrCampaigns",fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",type:"ivr",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1502})}]},authenticate:!0,permissionId:1502,bodyClass:"motiondialer"}).state("app.motiondialer.ivrCampaigns.edit",{url:"/:id?tab",params:{ivrCampaign:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/view.html",controller:"IvrCampaignController as vm"}},resolve:{ivrCampaign:["apiResolver","$stateParams",function(e,n){return e.resolve("campaign@get",{fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1502})}]},authenticate:!0,permissionId:1502,bodyClass:"motiondialer"}),n.addPart("app/main/apps/motiondialer")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.motiondialer",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.motiondialer.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.motiondialer.hopperdate",{url:"/hopperdate",views:{"hopperdate@app":{templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",controller:"HopperdateController as vm"}},resolve:{info:["apiResolver",function(e){return e.resolve("version@get")}]},authenticate:!0,permissionId:1500,bodyClass:"motiondialer"})}e.$inject=["$stateProvider"],angular.module("app.motiondialer.hopperdate",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.motiondialer.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/realtime/realtime.html",controller:"MotionDialerRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1510})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.agents",{url:"/agents",params:{channel:"voice",direction:"outbound"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queues",{url:"/queues",controller:"QueuesMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"QueueCampaigns":void 0,channel:"voice",type:"outbound",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queue_calls",{url:"/queue_calls",controller:"QueueCallsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/queue_calls/view.html",resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}],rpcVoiceQueuesChannels:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueuesChannels")}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.abandonedcalls",{url:"/abandonedcalls",controller:"AbandonedCallsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/abandonedcalls/view.html",resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0})}],dispositions:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("disposition@get",{fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dispositions",fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queue_params",{url:"/queue_params",controller:"QueueParamsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/queue_params/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",fields:"id,name",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.ivr_campaigns",{url:"/ivr_campaigns",controller:"IvrCampaignsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/ivr_campaigns/view.html",resolve:{campaigns:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("campaign@get",{sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"IvrCampaigns",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1502})}],rpcCampaigns:["apiResolver",function(e){return e.resolve("rpc@getCampaigns")}]},authenticate:!0,permissionId:1510})}e.$inject=["$stateProvider"],angular.module("app.motiondialer.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.openchannel",{abstract:!0,url:"/openchannel"}).state("app.openchannel.openchannelQueues",{url:"/openchannelQueues",views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelQueues/openchannelQueues.html",controller:"OpenchannelQueuesController as vm"}},resolve:{openchannelQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("openchannelQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"openchannel",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OpenchannelQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"openchannel",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:801})}]},authenticate:!0,permissionId:801,bodyClass:"openchannel"}).state("app.openchannel.openchannelQueues.edit",{url:"/:id?tab",params:{openchannelQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/view.html",controller:"OpenchannelQueueController as vm"}},resolve:{openchannelQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("openchannelQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:801})}]},authenticate:!0,permissionId:801,bodyClass:"openchannel"}).state("app.openchannel.openchannelAccounts",{url:"/openchannelAccounts",views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/openchannelAccounts.html",controller:"OpenchannelAccountsController as vm"}},resolve:{openchannelAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OpenchannelAccounts",fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:802})}]},authenticate:!0,permissionId:802,bodyClass:"openchannel"}).state("app.openchannel.openchannelAccounts.edit",{url:"/:id?tab",params:{openchannelAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/view.html",controller:"OpenchannelAccountController as vm"}},resolve:{openchannelAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadAttachments,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:802})}]},authenticate:!0,permissionId:802,bodyClass:"openchannel"}),n.addPart("app/main/apps/openchannel")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.openchannel",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.openchannel.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.openchannel.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/realtime/realtime.html",controller:"OpenchannelRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:810})}]},authenticate:!0,permissionId:810}).state("app.openchannel.realtime.agents",{url:"/agents",params:{channel:"openchannel"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:810}).state("app.openchannel.realtime.queues",{url:"/queues",controller:"QueuesOpenchannelRealtimeController as vm",templateUrl:"app/main/apps/openchannel/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"OpenchannelQueues":void 0,channel:"openchannel",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:801})}]},authenticate:!0,permissionId:810})}e.$inject=["$stateProvider"],angular.module("app.openchannel.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.plugins",{abstract:!0,url:"/plugins"}),n.addPart("app/main/apps/plugins")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.plugins",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.plugins.plugin"]).config(e)}(),function(){"use strict";function e(e){e.state("app.plugins.plugin",{url:"/plugin/:id",views:{"content@app":{templateUrl:"app/main/apps/plugins/views/plugin/plugin.html",controller:"PluginController as vm"}},resolve:{},authenticate:!0,bodyClass:"plugins"})}e.$inject=["$stateProvider"],angular.module("app.plugins.plugin",[]).config(e)}(),function(){"use strict";angular.module("app.realtime",[])}(),function(){"use strict";function e(e,n){e.state("app.settings",{abstract:!0,url:"/settings"}).state("app.settings.generals",{url:"/generals",views:{"content@app":{templateUrl:"app/main/apps/settings/views/generals/generals.html",controller:"GeneralsController as vm"}},resolve:{generals:["apiResolver",function(e){return e.resolve("setting@get",{fields:"createdAt,updatedAt,id,min_internal,securePassword,callRecordingEncryption,chatTimeout,phoneBarAutoUpdater,defaultScreenRecordingPath,phoneBarAutoUpdaterUrl,enableEmailPreview,split,splitSizeCsv,splitSizePdf,splitSizeXlsx,searchOnEnterKey,messagesAlignment,phoneBarRememberMeEnabled,rtlSupport,allowedLoginAttempts,blockDuration,loginMailFrequency,language,bucket,transcribe,transcribeRegion,transcribeAccountId,sentiment,sentimentRegion,sentimentAccountId,googleSsoEnabled,enforcePasswordHistory,passwordHistoryLimit,enablePrivacyPolicyEmail,privacyPolicyEmail,enablePrivacyPolicyName,privacyPolicyName,enablePrivacyPolicyNumber,privacyPolicyNumber,chatInteractionsReloadTimeout,mailInteractionsReloadTimeout,openchannelInteractionsReloadTimeout,smsInteractionsReloadTimeout,whatsappInteractionsReloadTimeout,stopRecordingOnTransfer,adSsoEnabled,disabledCookie,previewRecallmeReminderInterval,limitTabs",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.smtps",{url:"/smtps",views:{"content@app":{templateUrl:"app/main/apps/settings/views/smtps/smtps.html",controller:"SmtpController as vm"}},resolve:{mailAccounts:["apiResolver",function(e){return e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,service,provider,name,email,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,description",service:"1",limit:10,offset:0})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,name",sort:"name",type:"outlook365"})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.networks",{url:"/networks",views:{"content@app":{templateUrl:"app/main/apps/settings/views/networks/networks.html",controller:"NetworksController as vm"}},resolve:{networks:["apiResolver",function(e){return e.resolve("network@get",{fields:"createdAt,updatedAt,id,type,value,username,password",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.customizations",{url:"/customizations",views:{"content@app":{templateUrl:"app/main/apps/settings/views/customizations/customizations.html",controller:"CustomizationsController as vm"}},resolve:{customizations:["apiResolver",function(e){return e.resolve("setting@get",{fields:"createdAt,updatedAt,id,defaultLogo,defaultLoginLogo,defaultFavicon,defaultHeaderWhiteLabel,headerWhiteLabel,defaultPageTitle,pageTitle,defaultPreferred",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.cloudProviders",{url:"/cloudProviders",views:{"content@app":{templateUrl:"app/main/apps/settings/views/cloudProviders/cloudProviders.html",controller:"CloudProvidersController as vm"}},resolve:{cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data7",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}),n.addPart("app/main/apps/settings")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.settings",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.settings.updates","app.settings.license","app.settings.system"]).config(e)}(),function(){"use strict";function e(e){e.state("app.settings.license",{url:"/license",views:{"content@app":{templateUrl:"app/main/apps/settings/views/license/license.html",controller:"LicenseController as vm"}},authenticate:!0,permissionId:1400,bodyClass:"settings"})}e.$inject=["$stateProvider"],angular.module("app.settings.license",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.settings.system",{url:"/system?tab",views:{"content@app":{templateUrl:"app/main/apps/settings/views/system/system.html",controller:"SystemController as vm"}},resolve:{system:["apiResolver",function(e){return e.resolve("system@get")}],processes:["apiResolver",function(e){return e.resolve("pm2@get")}]},authenticate:!0,permissionId:1400,bodyClass:"settings"})}e.$inject=["$stateProvider"],angular.module("app.settings.system",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.settings.updates",{url:"/updates",views:{"content@app":{templateUrl:"app/main/apps/settings/views/updates/updates.html",controller:"UpdatesController as vm"}},resolve:{version:["apiResolver",function(e){return e.resolve("version@get",{latest:!0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1400})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"})}e.$inject=["$stateProvider"],angular.module("app.settings.updates",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.sms",{abstract:!0,url:"/sms"}).state("app.sms.smsQueues",{url:"/smsQueues",views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsQueues/smsQueues.html",controller:"SmsQueuesController as vm"}},resolve:{smsQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"sms",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"sms",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:701})}]},authenticate:!0,permissionId:701,bodyClass:"sms"}).state("app.sms.smsQueues.edit",{url:"/:id?tab",params:{smsQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsQueues/edit/view.html",controller:"SmsQueueController as vm"}},resolve:{smsQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("smsQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:701})}]},authenticate:!0,permissionId:701,bodyClass:"sms"}).state("app.sms.smsAccounts",{url:"/smsAccounts",views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsAccounts/smsAccounts.html",controller:"SmsAccountsController as vm"}},resolve:{smsAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:702})}]},authenticate:!0,permissionId:702,bodyClass:"sms"}).state("app.sms.smsAccounts.edit",{url:"/:id?tab",params:{smsAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsAccounts/edit/view.html",controller:"SmsAccountController as vm"}},resolve:{smsAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("smsAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:702})}]},authenticate:!0,permissionId:702,bodyClass:"sms"}),n.addPart("app/main/apps/sms")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.sms",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.sms.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.sms.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/sms/views/realtime/realtime.html",controller:"SmsRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:710})}]},authenticate:!0,permissionId:710}).state("app.sms.realtime.agents",{url:"/agents",params:{channel:"sms"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:710}).state("app.sms.realtime.queues",{url:"/queues",controller:"QueuesSmsRealtimeController as vm",templateUrl:"app/main/apps/sms/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"SmsQueues":void 0,channel:"sms",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:701})}]},authenticate:!0,permissionId:710})}e.$inject=["$stateProvider"],angular.module("app.sms.realtime",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.staff",{abstract:!0,url:"/staff"}).state("app.staff.users",{url:"/users",views:{"content@app":{templateUrl:"app/main/apps/staff/views/users/users.html",controller:"UsersController as vm"}},resolve:{users:["apiResolver",function(e){return e.resolve("user@get",{fields:"createdAt,updatedAt,role,userProfileId,id,fullname,name,email,phone,mobile,userpic,password,description,autointernal,internal,transport,nat,allow,context,callgroup,pickupgroup,passwordResetAt,apiKey,videosupport,disabled,blocked,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay",role:"admin,user",sort:"-updatedAt",userSetting:!0,limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:201})}]},authenticate:!0,permissionId:201,bodyClass:"staff"}).state("app.staff.users.edit",{url:"/:id?tab",params:{user:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/users/edit/view.html",controller:"UserController as vm"}},resolve:{user:["apiResolver","$stateParams",function(e,n){return e.resolve("user@get",{fields:"createdAt,updatedAt,role,userProfileId,id,fullname,name,email,phone,mobile,userpic,password,description,autointernal,internal,transport,nat,allow,context,callgroup,pickupgroup,passwordResetAt,apiKey,videosupport,disabled,blocked,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay",id:n.id,userSetting:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:201})}]},authenticate:!0,permissionId:201,bodyClass:"staff"}).state("app.staff.agents",{url:"/agents",views:{"content@app":{templateUrl:"app/main/apps/staff/views/agents/agents.html",controller:"AgentsController as vm"}},resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay",role:"agent",sort:"-updatedAt",userSetting:!0,limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay",role:"agent",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:202,bodyClass:"staff"}).state("app.staff.agents.edit",{url:"/:id?tab",params:{agent:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/agents/edit/view.html",controller:"AgentController as vm"}},resolve:{agent:["apiResolver","$stateParams",function(e,n){return e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay",id:n.id,userSetting:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:202,bodyClass:"staff"}).state("app.staff.telephones",{url:"/telephones",views:{"content@app":{templateUrl:"app/main/apps/staff/views/telephones/telephones.html",controller:"TelephonesController as vm"}},resolve:{telephones:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",role:"telephone",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Telephones",fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",role:"telephone",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:203})}]},authenticate:!0,permissionId:203,bodyClass:"staff"}).state("app.staff.telephones.edit",{url:"/:id?tab",params:{telephone:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/telephones/edit/view.html",controller:"TelephoneController as vm"}},resolve:{telephone:["apiResolver","$stateParams",function(e,n){return e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:203})}]},authenticate:!0,permissionId:203,bodyClass:"staff"}).state("app.staff.teams",{url:"/teams",views:{"content@app":{templateUrl:"app/main/apps/staff/views/teams/teams.html",controller:"TeamsController as vm"}},resolve:{teams:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("team@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Teams",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:204})}]},authenticate:!0,permissionId:204,bodyClass:"staff"}).state("app.staff.userProfiles",{url:"/userProfiles",views:{"content@app":{templateUrl:"app/main/apps/staff/views/userProfiles/userProfiles.html",controller:"UserProfilesController as vm"}},resolve:{userProfiles:["apiResolver",function(e){return e.resolve("userProfile@get",{fields:"createdAt,updatedAt,id,name,description,crudPermissions,privacyEnabled,downloadAttachments,downloadCallySquareRecordings,downloadContactManagerLists,downloadJscriptySessions,downloadOmnichannelInteractions,downloadScreenRecordings,downloadVoiceRecordings",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:205})}]},authenticate:!0,permissionId:205,bodyClass:"staff"}).state("app.staff.userProfiles.edit",{url:"/:id?tab",params:{userProfile:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/userProfiles/edit/view.html",controller:"UserProfileController as vm"}},resolve:{userProfile:["apiResolver","$stateParams",function(e,n){return e.resolve("userProfile@get",{fields:"createdAt,updatedAt,id,name,description,crudPermissions,privacyEnabled,downloadAttachments,downloadCallySquareRecordings,downloadContactManagerLists,downloadJscriptySessions,downloadOmnichannelInteractions,downloadScreenRecordings,downloadVoiceRecordings",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:205})}]},authenticate:!0,permissionId:205,bodyClass:"staff"}),n.addPart("app/main/apps/staff")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.staff",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.tools",{abstract:!0,url:"/tools"}).state("app.tools.cannedAnswers",{url:"/cannedAnswers",views:{"content@app":{templateUrl:"app/main/apps/tools/views/cannedAnswers/cannedAnswers.html",controller:"CannedAnswersController as vm"}},resolve:{cannedAnswers:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cannedAnswer@get",{fields:"createdAt,updatedAt,id,key,value,description",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"CannedAnswers",fields:"createdAt,updatedAt,id,key,value,description",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1001})}]},authenticate:!0,permissionId:1001,bodyClass:"tools"}).state("app.tools.customDashboards",{url:"/customDashboards",views:{"content@app":{templateUrl:"app/main/apps/tools/views/customDashboards/customDashboards.html",controller:"CustomDashboardsController as vm"}},resolve:{customDashboards:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("dashboard@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"CustomDashboards",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1003})}]},authenticate:!0,permissionId:1003,bodyClass:"tools"}).state("app.tools.customDashboards.edit",{url:"/:id?tab",params:{customDashboard:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/customDashboards/edit/view.html",controller:"CustomDashboardController as vm"}},resolve:{customDashboard:["apiResolver","$stateParams",function(e,n){return e.resolve("dashboard@get",{fields:"createdAt,updatedAt,id,name,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1003})}]},authenticate:!0,permissionId:1003,bodyClass:"tools"}).state("app.tools.intervals",{url:"/intervals",views:{"content@app":{templateUrl:"app/main/apps/tools/views/intervals/intervals.html",controller:"IntervalsController as vm"}},resolve:{intervals:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("interval@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Intervals",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1004})}]},authenticate:!0,permissionId:1004,bodyClass:"tools"}).state("app.tools.intervals.edit",{url:"/:id?tab",params:{interval:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/intervals/edit/view.html",controller:"IntervalController as vm"}},resolve:{interval:["apiResolver","$stateParams",function(e,n){return e.resolve("interval@get",{fields:"createdAt,updatedAt,id,name,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1004})}]},authenticate:!0,permissionId:1004,bodyClass:"tools"}).state("app.tools.pauses",{url:"/pauses",views:{"content@app":{templateUrl:"app/main/apps/tools/views/pauses/pauses.html",controller:"PausesController as vm"}},resolve:{pauses:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("pause@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Pauses",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1005})}]},authenticate:!0,permissionId:1005,bodyClass:"tools"}).state("app.tools.schedules",{url:"/schedules",views:{"content@app":{templateUrl:"app/main/apps/tools/views/schedules/schedules.html",controller:"SchedulesController as vm"}},resolve:{schedules:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("schedule@get",{fields:"createdAt,updatedAt,id,name,CustomReportId,DefaultReportId,output,active,startAt,endAt,cron,subtractNumber,subtractUnit,sendMail,MailAccountId,email,cc,bcc,sendIfEmpty,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Scheduler",fields:"createdAt,updatedAt,id,name,CustomReportId,DefaultReportId,output,active,startAt,endAt,cron,subtractNumber,subtractUnit,sendMail,MailAccountId,email,cc,bcc,sendIfEmpty,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1006})}]},authenticate:!0,permissionId:1006,bodyClass:"tools"}).state("app.tools.sounds",{url:"/sounds",views:{"content@app":{templateUrl:"app/main/apps/tools/views/sounds/sounds.html",controller:"SoundsController as vm"}},resolve:{sounds:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("sound@get",{fields:"createdAt,updatedAt,id,save_name,converted_format,name,audio,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Sounds",fields:"createdAt,updatedAt,id,save_name,converted_format,name,audio,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1007})}]},authenticate:!0,permissionId:1007,bodyClass:"tools"}).state("app.tools.tags",{url:"/tags",views:{"content@app":{templateUrl:"app/main/apps/tools/views/tags/tags.html",controller:"TagsController as vm"}},resolve:{tags:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("tag@get",{fields:"createdAt,updatedAt,id,name,description,color",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Tags",fields:"createdAt,updatedAt,id,name,description,color",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1008})}]},authenticate:!0,permissionId:1008,bodyClass:"tools"}).state("app.tools.templates",{url:"/templates",views:{"content@app":{templateUrl:"app/main/apps/tools/views/templates/templates.html",controller:"TemplatesController as vm"}},resolve:{templates:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("template@get",{fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Templates",fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1009})}]},authenticate:!0,permissionId:1009,bodyClass:"tools"}).state("app.tools.trunks",{url:"/trunks",views:{"content@app":{templateUrl:"app/main/apps/tools/views/trunks/trunks.html",controller:"TrunksController as vm"}},resolve:{trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}]},authenticate:!0,permissionId:1011,bodyClass:"tools"}).state("app.tools.trunks.edit",{url:"/:id?tab",params:{trunk:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/trunks/edit/view.html",controller:"TrunkController as vm"}},resolve:{trunk:["apiResolver","$stateParams",function(e,n){return e.resolve("trunk@get",{fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}]},authenticate:!0,permissionId:1011,bodyClass:"tools"}).state("app.tools.variables",{url:"/variables",views:{"content@app":{templateUrl:"app/main/apps/tools/views/variables/variables.html",controller:"VariablesController as vm"}},resolve:{variables:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("variable@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Variables",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1012})}]},authenticate:!0,permissionId:1012,bodyClass:"tools"}).state("app.tools.contact_item_types",{url:"/contact_item_types",views:{"content@app":{templateUrl:"app/main/apps/tools/views/contact_item_types/contact_item_types.html",controller:"ContactItemTypesController as vm"}},resolve:{contact_item_types:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("contactItemType@get",{fields:"createdAt,updatedAt,id,name,OrderBy,rgbBackgroundColor",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ContactItemType",fields:"createdAt,updatedAt,id,name,OrderBy,rgbBackgroundColor",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1013})}]},authenticate:!0,permissionId:1013,bodyClass:"tools"}),n.addPart("app/main/apps/tools")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.tools",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.tools.dispositions","app.tools.triggers"]).config(e)}(),function(){"use strict";function e(e){e.state("app.tools.dispositions",{url:"/dispositions",views:{"content@app":{templateUrl:"app/main/apps/tools/views/dispositions/dispositions.html",controller:"DispositionsController as vm"}},resolve:{dispositions:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("disposition@get",{fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",WhatsappAccountId:"null",ListId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dispositions",fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",WhatsappAccountId:"null",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1002})}]},authenticate:!0,permissionId:1002,bodyClass:"tools"})}e.$inject=["$stateProvider"],angular.module("app.tools.dispositions",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.tools.triggers",{url:"/triggers",views:{"content@app":{templateUrl:"app/main/apps/tools/views/triggers/triggers.html",controller:"TriggersController as vm"}},resolve:{triggers:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trigger@get",{fields:"createdAt,updatedAt,id,name,channel,status,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Triggers",fields:"createdAt,updatedAt,id,name,channel,status,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1010})}]},authenticate:!0,permissionId:1010,bodyClass:"tools"}).state("app.tools.triggers.edit",{url:"/:id?tab",params:{trigger:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/triggers/edit/view.html",controller:"TriggerController as vm"}},resolve:{trigger:["apiResolver","$stateParams",function(e,n){return e.resolve("trigger@get",{fields:"createdAt,updatedAt,id,name,channel,status,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1010})}]},authenticate:!0,permissionId:1010,bodyClass:"tools"})}e.$inject=["$stateProvider"],angular.module("app.tools.triggers",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.video",{abstract:!0,url:"/video"}).state("app.video.screenRecordings",{url:"/screenRecordings",views:{"content@app":{templateUrl:"app/main/apps/video/views/screenRecordings/screenRecordings.html",controller:"ScreenRecordingsController as vm"}},resolve:{screenRecordings:["apiResolver","Auth","msUtils",function(e,n,t){return n.hasRole("admin")?e.resolve("screenRecording@get",{fields:"createdAt,updatedAt,id,interactionid,channel,format,value,rating,UserId,duration,startedAt,closedAt",createdAt:t.firstLastDayMonth(),includeAll:"true",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ScreenRecordings",fields:"createdAt,updatedAt,id,interactionid,channel,format,value,rating,UserId,duration,startedAt,closedAt",createdAt:t.firstLastDayMonth(),includeAll:"true",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadScreenRecordings",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2001})}]},authenticate:!0,permissionId:2001,bodyClass:"video"}),n.addPart("app/main/apps/video")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.video",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.inboundRoutes",{url:"/inboundRoutes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/inboundRoutes/inboundRoutes.html",controller:"InboundRoutesController as vm"}},resolve:{inboundRoutes:["apiResolver","Auth",function(e,n){return n.isAdmin()?e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"InboundRoutes",fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:402})}]},authenticate:!0,permissionId:402,bodyClass:"voice"}).state("app.voice.inboundRoutes.edit",{url:"/:id?tab",params:{inboundRoute:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/inboundRoutes/edit/view.html",controller:"InboundRouteController as vm"}},resolve:{inboundRoute:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",id:n.id})}],contexts:["apiResolver",function(e){return e.resolve("voiceContext@get",{fields:"id,name",sort:"name"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:402})}]},authenticate:!0,permissionId:402,bodyClass:"voice"})}e.$inject=["$stateProvider"],angular.module("app.voice.inboundRoutes",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.internalRoutes",{url:"/internalRoutes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/internalRoutes/internalRoutes.html",controller:"InternalRoutesController as vm"}},resolve:{internalRoutes:["apiResolver","Auth",function(e,n){return n.isAdmin()?e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"InternalRoutes",fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:404})}]},authenticate:!0,permissionId:404,bodyClass:"voice"}).state("app.voice.internalRoutes.edit",{url:"/:id?tab",params:{internalRoute:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/internalRoutes/edit/view.html",controller:"InternalRouteController as vm"}},resolve:{internalRoute:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",id:n.id})}],contexts:["apiResolver",function(e){return e.resolve("voiceContext@get",{fields:"id,name",sort:"name"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:404})}]},authenticate:!0,permissionId:404,bodyClass:"voice"})}e.$inject=["$stateProvider"],angular.module("app.voice.internalRoutes",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.outboundRoutes",{url:"/outboundRoutes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/outboundRoutes/outboundRoutes.html",controller:"OutboundRoutesController as vm"}},resolve:{outboundRoutes:["apiResolver","Auth",function(e,n){return n.isAdmin()?e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,recordingFormat,cutdigits,description,alias,createdAt,updatedAt",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OutboundRoutes",fields:"id,appdata,type,exten,context,recordingFormat,cutdigits,description,alias,createdAt,updatedAt",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:403})}]},authenticate:!0,permissionId:403,bodyClass:"voice"}).state("app.voice.outboundRoutes.edit",{url:"/:id?tab",params:{outboundRoute:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/outboundRoutes/edit/view.html",controller:"OutboundRouteController as vm"}},resolve:{outboundRoute:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,recordingFormat,cutdigits,description,alias,createdAt,updatedAt",id:n.id})}],contexts:["apiResolver",function(e){return e.resolve("voiceContext@get",{fields:"id,name",sort:"name"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:403})}]},authenticate:!0,permissionId:403,bodyClass:"voice"})}e.$inject=["$stateProvider"],angular.module("app.voice.outboundRoutes",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/voice/views/realtime/realtime.html",controller:"VoiceRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:411})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.agents",{url:"/agents",params:{channel:"voice",direction:"inbound"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.telephones",{url:"/telephones",controller:"TelephonesVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/telephones/view.html",resolve:{telephones:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,fullname,userpic,internal",role:"telephone",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Telephones",fields:"id,fullname,userpic,internal",role:"telephone",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:203})}],rpcTelephones:["apiResolver",function(e){return e.resolve("rpc@getTelephones")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.trunks",{url:"/trunks",controller:"TrunksVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/trunks/view.html",resolve:{trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}],rpcTrunks:["apiResolver",function(e){return e.resolve("rpc@getTrunks")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queues",{url:"/queues",controller:"QueuesVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"VoiceQueues":void 0,channel:"voice",type:"inbound",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queue_calls",{url:"/queue_calls",controller:"QueueCallsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/queue_calls/view.html",resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}],rpcVoiceQueuesChannels:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueuesChannels")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.abandonedcalls",{url:"/abandonedcalls",controller:"AbandonedCallsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/abandonedcalls/view.html",resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0})}],dispositions:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("disposition@get",{fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dispositions",fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queue_params",{url:"/queue_params",controller:"QueueParamsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/queue_params/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",fields:"id,name",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.outbound_calls",{url:"/outbound_calls",controller:"OutboundCallsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/outbound_calls/view.html",resolve:{rpcCalls:["apiResolver",function(e){return e.resolve("rpc@getOutboundChannels")}]},authenticate:!0,permissionId:411})}e.$inject=["$stateProvider"],angular.module("app.voice.realtime",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.voice",{abstract:!0,url:"/voice"}).state("app.voice.voiceQueues",{url:"/voiceQueues",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceQueues/voiceQueues.html",controller:"VoiceQueuesController as vm"}},resolve:{voiceQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:401,bodyClass:"voice"}).state("app.voice.voiceQueues.edit",{url:"/:id?tab",params:{voiceQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceQueues/edit/view.html",controller:"VoiceQueueController as vm"}},resolve:{voiceQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:401,bodyClass:"voice"}).state("app.voice.contexts",{url:"/contexts",views:{"content@app":{templateUrl:"app/main/apps/voice/views/contexts/contexts.html",controller:"ContextsController as vm"}},resolve:{contexts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceContext@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Contexts",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:405})}]},authenticate:!0,permissionId:405,bodyClass:"voice"}).state("app.voice.voicemails",{url:"/voicemails",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voicemails/voicemails.html",controller:"VoicemailsController as vm"}},resolve:{voicemails:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceMail@get",{fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Voicemails",fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:406})}]},authenticate:!0,permissionId:406,bodyClass:"voice"}).state("app.voice.voicemails.edit",{url:"/:id?tab",params:{voicemail:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/voicemails/edit/view.html",controller:"VoicemailController as vm"}},resolve:{voicemail:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceMail@get",{fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:406})}]},authenticate:!0,permissionId:406,bodyClass:"voice"}).state("app.voice.musiconholds",{url:"/musiconholds",views:{"content@app":{templateUrl:"app/main/apps/voice/views/musiconholds/musiconholds.html",controller:"MusicOnHoldsController as vm"}},resolve:{musiconholds:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceMusicOnHold@get",{fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",defaultEntry:"false",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MusicOnHolds",fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",defaultEntry:"false",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:407})}]},authenticate:!0,permissionId:407,bodyClass:"voice"}).state("app.voice.musiconholds.edit",{url:"/:id?tab",params:{musiconhold:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/musiconholds/edit/view.html",controller:"MusicOnHoldController as vm"}},resolve:{musiconhold:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceMusicOnHold@get",{fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:407})}]},authenticate:!0,permissionId:407,bodyClass:"voice"}).state("app.voice.voiceRecordings",{url:"/voiceRecordings",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceRecordings/voiceRecordings.html",controller:"VoiceRecordingsController as vm"}},resolve:{voiceRecordings:["apiResolver","Auth","msUtils",function(e,n,t){return n.hasRole("admin")?e.resolve("voiceRecording@get",{fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",sort:"-createdAt",createdAt:t.firstLastDayMonth(),limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceRecordings",fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",sort:"-createdAt",createdAt:t.firstLastDayMonth(),limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadVoiceRecordings,privacyEnabled",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:408})}]},authenticate:!0,permissionId:408,bodyClass:"voice"}).state("app.voice.voiceRecordings.edit",{url:"/:id?tab",params:{voiceRecording:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceRecordings/edit/view.html",controller:"VoiceRecordingController as vm"}},resolve:{voiceRecording:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceRecording@get",{fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadVoiceRecordings,privacyEnabled",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:408})}]},authenticate:!0,permissionId:408,bodyClass:"voice"}).state("app.voice.chanSpies",{url:"/chanSpies",views:{"content@app":{templateUrl:"app/main/apps/voice/views/chanSpies/chanSpies.html",controller:"ChanSpiesController as vm"}},resolve:{chanSpies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceChanSpy@get",{fields:"createdAt,updatedAt,id,name,prefix,options,auth,password,record,recordingFormat,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChanSpies",fields:"createdAt,updatedAt,id,name,prefix,options,auth,password,record,recordingFormat,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:409})}]},authenticate:!0,permissionId:409,bodyClass:"voice"}).state("app.voice.voicePrefixes",{url:"/voicePrefixes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voicePrefixes/voicePrefixes.html",controller:"VoicePrefixesController as vm"}},resolve:{voicePrefixes:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voicePrefix@get",{fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoicePrefixes",fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:410})}]},authenticate:!0,permissionId:410,bodyClass:"voice"}),n.addPart("app/main/apps/voice")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.voice",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.voice.inboundRoutes","app.voice.outboundRoutes","app.voice.internalRoutes","app.voice.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.whatsapp.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/realtime/realtime.html",controller:"WhatsappRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2110})}]},authenticate:!0,permissionId:2110}).state("app.whatsapp.realtime.agents",{url:"/agents",params:{channel:"whatsapp"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:2110}).state("app.whatsapp.realtime.queues",{url:"/queues",controller:"QueuesWhatsappRealtimeController as vm",templateUrl:"app/main/apps/whatsapp/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"WhatsappQueues":void 0,channel:"whatsapp",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2101})}]},authenticate:!0,permissionId:2110})}e.$inject=["$stateProvider"],angular.module("app.whatsapp.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.whatsapp",{abstract:!0,url:"/whatsapp"}).state("app.whatsapp.whatsappQueues",{url:"/whatsappQueues",views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/whatsappQueues.html",controller:"WhatsappQueuesController as vm"}},resolve:{whatsappQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("whatsappQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"whatsapp",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"WhatsappQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"whatsapp",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2101})}]},authenticate:!0,permissionId:2101,bodyClass:"whatsapp"}).state("app.whatsapp.whatsappQueues.edit",{url:"/:id?tab",params:{whatsappQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/view.html",controller:"WhatsappQueueController as vm"}},resolve:{whatsappQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("whatsappQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2101})}]},authenticate:!0,permissionId:2101,bodyClass:"whatsapp"}).state("app.whatsapp.whatsappAccounts",{url:"/whatsappAccounts",views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/whatsappAccounts.html",controller:"WhatsappAccountsController as vm"}},resolve:{whatsappAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("whatsappAccount@get",{fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description,baseUrl",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"WhatsappAccounts",fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2102})}]},authenticate:!0,permissionId:2102,bodyClass:"whatsapp"}).state("app.whatsapp.whatsappAccounts.edit",{url:"/:id?tab",params:{whatsappAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/view.html",controller:"WhatsappAccountController as vm"}},resolve:{whatsappAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("whatsappAccount@get",{fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description,baseUrl",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2102})}]},authenticate:!0,permissionId:2102,bodyClass:"whatsapp"}),n.addPart("app/main/apps/whatsapp")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.whatsapp",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.whatsapp.realtime"]).config(e)}(),function(){"use strict";angular.module("app.navigation",[]).config(function(){})}(),function(){"use strict";function e(e,n){e.addPart("app/quick-panel")}e.$inject=["$translatePartialLoaderProvider","msApiProvider"],angular.module("app.quick-panel",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.reset",{url:"/reset/:token",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.reset":{templateUrl:"app/reset/reset.html",controller:"ResetPasswordController as vm"}},bodyClass:"reset"}),n.addPart("app/reset")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.reset",[]).config(e)}(),function(){"use strict";function e(e){e.addPart("app/toolbar")}e.$inject=["$translatePartialLoaderProvider"],angular.module("app.toolbar",[]).config(e)}(),function(){"use strict";angular.module("app.user-setting",[])}(),function(){"use strict";function e(e){e.interceptors.push("authInterceptor")}e.$inject=["$httpProvider"],angular.module("app.auth").config(e)}(),function(){"use strict";function e(e){e.onBefore({to:function(e){return!0===e.authenticate}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService;return n.isLoggedIn()?n.retrieveUser().catch(function(){return t.target("app.login",void 0,{reload:!0})}):t.target("app.login",void 0,{reload:!0})}),e.onStart({to:function(e){return"app.login"!==e.name}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService,a=e.$to();if(n.hasRole("agent")&&"app.dashboards.general"!=a.name)return t.target("app.dashboards.general",{redirect:!1},{reload:!0})}),e.onFinish({to:function(e){return"app.help"===e.parent.name}},function(e){var n=e.router.stateService;if("app.help"===e.$to().parent.name){var t=e.injector().get("settingsManager"),a=t?t.get():null;if(!a||!a.viewHelpSection)return n.target("app.dashboards.general",{redirect:!1},{reload:!0})}}),e.onFinish({to:function(e){return e.permissionId}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService,a=e.$to();if(n.hasRole("user")){if(!n.hasPermission(a.permissionId))return t.target("app.dashboards.general",{redirect:!1},{reload:!0});var i=e.params().id?Number(e.params().id):void 0;if(i)return n.hasResourcePermission(a.permissionId,i).catch(function(){return t.target(a.parent.name,{redirect:!1},{reload:!0})})}}),e.onFinish({to:function(e){return"app.dashboards.general"===e.parent.name}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService;e.$to();if(n.hasRole("user")&&!n.hasPermission(100))return t.target("app.dashboards.general",{redirect:!1},{reload:!0})})}e.$inject=["$transitions"],angular.module("app.auth").run(e)}(),function(){"use strict";function e(a,e,o,i,s,r,l,d,c){var m;return{getToken:n,getCurrentUser:u,getPermissions:A,hasChildrenPermissions:function(e){return!!e&&_.some(e,function(e){return t(e)})},hasModulePermissions:function(i){return o(function(a,n){f()?a(!0):r.userProfileSection.get({userProfileId:m.userProfileId}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(_.isEmpty(n))a(!1);else{var t=_.filter(n,function(e){return e.enabled});a(_.some(t,["category",i]))}}).catch(function(e){n(e)})})},hasModulesPermissions:function(s){return o(function(a,n){var i={};f()?(s.forEach(function(e){i[e]=!0}),a(i)):r.userProfileSection.get({userProfileId:m.userProfileId}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(_.isEmpty(n))a({});else{var t=_(n).filter(function(e){return e.enabled&&_.includes(s,e.category)}).uniqBy(function(e){return e.category}).map(function(e){return e.category}).value();t.forEach(function(e){i[e]=!0}),a(i)}}).catch(function(e){n(e)})})},hasRole:function(e){return!!m&&m.role===e},hasPermission:t,hasResourcePermission:function(e,s){return o(function(a,i){return r.userProfileSection.get({userProfileId:m.userProfileId,sectionId:e}).$promise.then(function(e){var n=e.rows[0];if(n.autoAssociation)return a();var t=l.getActiveItem().node;return t.permissions&&!1===t.permissions.association?a():r.userProfileResource.get({sectionId:n.id,nolimit:!0}).$promise.then(function(e){var n=e.rows;_.some(n,["resourceId",s])?a():i()})}).catch(function(e){i("Error retrieving user profile permissions",e)})})},hasSectionPermissions:function(a){return o(function(e,n){var t={};return E().then(function(){_.includes(m.permissions,a)&&(t[a]=!0),e(t)}).catch(function(e){n(e)})})},hasSectionsPermissions:function(a){return o(function(e,n){var t={};if(!f())return E().then(function(){a.forEach(function(e){_.includes(m.permissions,e)&&(t[e]=!0)}),e(t)}).catch(function(e){n(e)});a.forEach(function(e){t[e]=!0}),e(t)})},isAgent:h,isAdmin:f,isLoggedIn:function(){return!!n()},isTelephone:function(){return"telephone"===m.role},isUser:b,login:function(e){return o(function(n,t){r.auth.local(e).$promise.then(function(e){return d.get().secureCookieEnabled?c.set("motion.token",e.token,{secure:!0,sameSite:"none"}):c.set("motion.token",e.token),r.user.get({id:e.id}).$promise}).then(function(e){(m=e).lastLoginAt=moment().format("YYYY-MM-DD HH:mm:ss"),y("LOCAL_LOGIN")}).then(function(){if(h()&&1===m.showWebBar&&m.hotdesk)return a.show({controller:"HotDeskDialogController",controllerAs:"vm",templateUrl:"app/auth/services/hotdesk/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,resolve:{telephones:["apiResolver",function(e){return e.resolve("user@get",{fields:"id,fullname,name,internal",role:"telephone",nolimit:!0})}]}})}).then(function(e){return h()&&0!==m.showWebBar?p(e):f()||b()?g(!0):void 0}).then(function(e){m=_.assign(m,e),n()}).catch(function(e){t(e)})})},logout:function(t){return o(function(e,n){t?(v(),e()):o.resolve().then(function(){return h()&&0!==m.showWebBar?o(function(e,n){r.user.logout({id:m.id,device:"web"}).$promise.then(function(){e()}).catch(function(e){n(e)})}):f()||b()?g(!1):void 0}).then(function(){v(),e()}).catch(function(e){n(e)})})},parseCrudPermissions:function(e){return f()?{readOnly:!1,canEdit:!0,canDelete:!0}:e?{readOnly:!(!_.includes(e,"r")||1!==e.length),canEdit:!!_.includes(e,"e"),canDelete:!!_.includes(e,"d")}:{readOnly:!0,canEdit:!1,canDelete:!1}},queueLogin:p,reloadPermissions:E,removeCookies:v,retrieveUser:function(){return o(function(n,t){r.user.whoami({userSetting:!0}).$promise.then(function(n){return"user"===n.role?A(n.userProfileId).then(function(e){return n.permissions=e,n}):n}).then(function(e){n(m=e)}).catch(function(e){t(e)})})},setCurrentUser:function(e){m=_.merge(m,e)},getAuthenticationType:function(){var e=u(),n=i.localStorage.getItem("motion2.user:"+e.id);if(n)return JSON.parse(n).authenticationType;return"NONE"},loginSSO:function(e){"google"!==e&&y("SSO_LOGIN");return"/api/auth/"+e},loginAD:function(e){return o(function(n,t){r.auth.activedirectory(e).$promise.then(function(e){return d.get().secureCookieEnabled?c.set("motion.token",e.token,{secure:!0,sameSite:"none"}):c.set("motion.token",e.token),r.user.get({id:e.id}).$promise}).then(function(e){(m=e).lastLoginAt=moment().format("YYYY-MM-DD HH:mm:ss"),y("SSO_LOGIN")}).then(function(){if(h()&&1===m.showWebBar&&m.hotdesk)return a.show({controller:"HotDeskDialogController",controllerAs:"vm",templateUrl:"app/auth/services/hotdesk/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,resolve:{telephones:["apiResolver",function(e){return e.resolve("user@get",{fields:"id,fullname,name,internal",role:"telephone",nolimit:!0})}]}})}).then(function(e){return h()&&0!==m.showWebBar?p(e):f()||b()?g(!0):void 0}).then(function(e){m=_.assign(m,e),n()}).catch(function(e){t(e)})})}};function n(){return e.get("motion.token")}function u(){return m}function p(e){return o(function(n,t){r.user.login({id:m.id,device:"web",intrf:e}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}function g(a){return o(function(n,t){var e={online:a,lastLoginAt:a?moment().format("YYYY-MM-DD HH:mm:ss"):void 0};r.user.update({id:m.id},e).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}function v(){e.remove("motion.token"),m&&(i.localStorage.removeItem("motion.user:"+m.id),m=null)}function h(){return"agent"===m.role}function f(){return"admin"===m.role}function b(){return"user"===m.role}function t(e){return!!m&&_.includes(m.permissions,e)}function A(e){var a=[];return o(function(n,t){return e||n(a),r.userProfile.getSections({id:e}).$promise.then(function(e){for(var n=0;n<e.length;n++){var t=e[n];a.push(t.sectionId),t.subsections&&(a=_.concat(a,t.subsections))}return a}).then(function(e){n(e)}).catch(function(e){t("Error retrieving user profile permissions",e)})})}function E(){return o(function(n,t){A(m.userProfileId).then(function(e){m.permissions=e,n()}).catch(function(e){t(e)})})}function y(e){var n=u(),t={authenticationType:e};i.localStorage.setItem("motion2.user:"+n.id,JSON.stringify(t))}}e.$inject=["$mdDialog","$cookies","$q","$window","$document","api","msNavigationService","settingsManager","jscookie"],angular.module("app.auth").factory("Auth",e)}(),function(){"use strict";function e(n,e){this.telephones=e,this.closeDialog=function(e){n.hide(e)},e.count&&(this.name=e.rows[0].name)}e.$inject=["$mdDialog","telephones"],angular.module("app.auth").controller("HotDeskDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s;return{request:function(e){var n=t.get("motion.token");return e.headers=e.headers||{},i.isSameOrigin(e.url)&&n&&(e.headers.Authorization="Bearer "+n),e},responseError:function(e){switch(e.status){case 401:t.remove("motion.token"),(s||(s=a.get("$state"))).go("app.login")}return n.reject(e)}}}e.$inject=["$rootScope","$q","$cookies","$injector","Util"],angular.module("app.auth").factory("authInterceptor",e)}(),function(){"use strict";function e(n){var t={safeCb:function(e){return angular.isFunction(e)?e:angular.noop},urlParse:function(e){var n=document.createElement("a");return n.href=e,""===n.host&&(n.href=n.href),n},isSameOrigin:function(i,e){return i=t.urlParse(i),(e=(e=e&&[].concat(e)||[]).map(t.urlParse)).push(n.location),1<=(e=e.filter(function(e){var n=i.hostname===e.hostname,t=i.protocol===e.protocol,a=i.port===e.port||""===e.port&&("80"===i.port||"443"===i.port);return n&&t&&a})).length}};return t}e.$inject=["$window"],angular.module("app.auth").factory("Util",e)}(),function(){"use strict";function e(e,n,t){var a={initLogger:function(){return i.init({uri:t.baseUrl+"logs/client-logs",initial_state_name:"client-logs",flushInterval:6e4,debounceInterval:10,sizeLimit:300,silent:!1,autoLog:["error"],heartbeat:!1,logUnload:!1,logPerformance:!1}),i.addHeaderBuilder(function(){return(e=n.get("motion.token"))?{Authorization:"Bearer "+e}:{};var e}),i}},i=e.$logger;if(!i)throw new Error("Beaver Logger not found");return a}function n(d,e,t){var n={getLogger:function(l){var e=function(r){return function(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];var a=n[0],i=n.slice(1),s="string"!=typeof a||"string"==typeof a&&0===i.length?l:a,o=1<n.length&&"string"==typeof a?i:n;(function(e,n,t){if(!d.isLoggedIn())return;var a=d.getCurrentUser();if(!a||!a.userSetting.clientSideLoggingEnabled)return;if(i=e,!(c.indexOf(i)>=c.indexOf(m)))return;var i;var s=n,o=t;"string"==typeof n&&void 0===t&&(s=e,o=n);u[e].call(u,s,{data:p(o)})}).call(this,r,s,o)}};return{error:e("error"),warn:e("warn"),info:e("info"),debug:e("debug")}},getLoggingColors:function(){return{disabled:{color:"#616161"},debug:{color:"#283593"},info:{color:"#000000"},warning:{color:"#FBC02D"},error:{color:"#FF5252"}}},flush:a},c=["debug","info","warn","error"],m="debug",u=e.initLogger();function p(t){return Array.isArray(t)?t.map(p):null===t||"object"!=typeof t?t:_.isPlainObject(t)?t:t&&"function"==typeof t.toJSON?t.toJSON():t instanceof Error?Object.getOwnPropertyNames(t).reduce(function(e,n){return e[n]=p(t[n]),e},{}):JSON.parse(JSON.stringifyOnce(t))}function a(){return u.flush()}return t.$on("local:user-setting-updated",function(e,n){n.clientSideLoggingEnabled?t.$broadcast("client-side-logging:enabled"):(a(),t.$broadcast("client-side-logging:disabled")),m=n.clientSideLoggingLevel}),t.$on("local:user-logout",function(){m="debug"}),JSON.stringifyOnce=function(i,s,e){var o=[],r=[];return e||(e=2),JSON.stringify(i,function(e,t){if(2e3<o.length)return"object too long";var a=!1;if(o.forEach(function(e,n){e===t&&(a=n)}),""==e)return o.push(i),r.push("root"),t;if(a+""!="false"&&"object"==typeof t)return"root"==r[a]?"(pointer to root)":"(see "+(t&&t.constructor?t.constructor.name.toLowerCase():typeof t)+" with key "+r[a]+")";var n=e||"(empty key)";return o.push(t),r.push(n),s?s(e,t):t},e)},n}e.$inject=["$window","$cookies","api"],n.$inject=["Auth","clientSideLogger","$rootScope"],angular.module("app.client-side-logging").factory("clientSideLogger",e).service("ClientSideLoggingService",n)}(),function(){"use strict";angular.module("app.core").provider("motionConfig",function(){var t={disableCustomScrollbars:!1,disableMdInkRippleOnMobile:!0,disableCustomScrollbarsOnMobile:!0};this.config=function(e){t=angular.extend({},t,e)},this.$get=function(){var e={getConfig:function(e){if(angular.isUndefined(t[e]))return!1;return t[e]},setConfig:function(e,n){t[e]=n}};return e}})}(),function(){"use strict";function e(e,n,t){n.debugEnabled(!0),e.config({tabindex:!1}),t.config({disableCustomScrollbars:!1,disableCustomScrollbarsOnMobile:!0,disableMdInkRippleOnMobile:!0})}e.$inject=["$ariaProvider","$logProvider","motionConfigProvider"],angular.module("app.core").config(e)}(),function(){"use strict";function e(e,n,t){(n.generate(),t.getConfig("disableMdInkRippleOnMobile")&&e.isMobile())&&angular.element("body").attr("md-no-ink",!0);e.isMobile()&&angular.element("html").addClass("is-mobile");var a=e.detectBrowser();if(a){var i=a.browser+" "+a.version+" "+a.os;angular.element("html").addClass(i)}}e.$inject=["msUtils","motionGenerator","motionConfig"],angular.module("app.core").run(e)}(),function(){"use strict";function e(n,e,t,a,i,s){var l=this;function o(){var e=_.filter(l.searchOptions.conditions,["disabled",!1]),o=[],r="";if(_(e).groupBy("name").forEach(function(e){var n=e[0],t=1<e.length,a=n.query.column;if(t){var i=_(e).groupBy(function(e){return e.query.operator}).mapValues(function(e){return _.chain(e).map(function(e){return e.query.value}).flattenDeep().value()}).value(),s=[];_.keys(i).forEach(function(e){var n=i[e],t=e;_.includes(["$between","$in","$notIn"],e)?t+="["+n+"]":n.forEach(function(e){t+="["+e+"]"}),s.push(t)}),r+=a+":="+s.join(":=")}else r=a+":="+n.query.operator+"["+n.query.value+"]";o.push(r)}),0!==o.length){var n="["+l.searchOptions.matchType+"]";return n+=o.join("||")}}function r(){var e=n.localStorage.getItem("motion2."+s+":"+l.currentUser.id);return e?JSON.parse(e):{}}function d(e){n.localStorage.setItem("motion2."+s+":"+l.currentUser.id,JSON.stringify(e))}function c(){if(s){var e=r();e.advancedSearch=_.omit(l.searchOptions,"fields"),d(e)}}function m(){return!!r().advancedSearch}l.currentUser=t.getCurrentUser(),l.searchOptions={matchType:"$and",conditions:[],fields:i},l.toolbarColor=a,l.onInit=function(){if(s){var e=r();e.hasOwnProperty("advancedSearch")&&(l.searchOptions=_.merge(l.searchOptions,e.advancedSearch))}},l.applyFilter=function(){c(),e.hide({apply:!0,value:o()})},l.clearConditions=function(){l.searchOptions.conditions=[],function(){if(s){var e=r();delete e.advancedSearch,e.query&&delete e.query.search,d(e)}}()},l.minimize=function(){c(),e.hide({apply:!m(),value:o()||m()?!_.isEmpty(l.searchOptions.conditions):void 0})},l.close=function(){e.hide({apply:!m(),value:o()||m()?!_.isEmpty(l.searchOptions.conditions):void 0})}}e.$inject=["$window","$mdDialog","Auth","color","fields","storagePath"],angular.module("app.core").controller("AdvancedSearchController",e)}(),function(){"use strict";function e(a){return{restrict:"A",link:function(e,n,t){e.$watch(t.focusOn,function(e){a(function(){e?n[0].focus():n[0].blur()})})}}}e.$inject=["$timeout"],angular.module("app.core").directive("focusOn",e)}(),function(){"use strict";function e(o,l,d){return{restrict:"E",compile:function(e,n){var s;return n.code||(s=e.html(),e.empty()),function(t,a,r){r.code&&(s=t.$eval(r.code));var i=t.$eval(r.shouldInterpolate);l.when(s).then(function(e){if(e){i&&(e=d(e)(t));var n=angular.element('<pre><code class="highlight" ng-non-bindable></code></pre>');a.append(n),o(function(){!function(e,n){var t=n.find("code"),a=e.split("\n"),i=(a=a.filter(function(e){return e.trim().length}))[0].match(/^\s*/)[0],s=new RegExp("^"+i);a=a.map(function(e){return e.replace(s,"").replace(/\s+$/,"")});var o=hljs.highlight(r.language||r.lang,a.join("\n"),!0);o.value=o.value.replace(/=<span class="hljs-value">""<\/span>/gi,"").replace("<head>","").replace("<head/>",""),t.append(o.value).addClass("highlight")}(e,n)},34,!1)}})}}}}e.$inject=["$timeout","$q","$interpolate"],angular.module("app.core").directive("hljs",e)}(),function(){"use strict";function e(s,o,e,t){var r=this;function n(){var a=r.selectedField.options&&!_.isEmpty(r.selectedField.options.extraOperators),i=r.selectedField.options&&!_.isEmpty(r.selectedField.options.excludedOperators);r.availableOperators=_.filter(r.operators,function(n){var e=!n.applyTo||_.includes(n.applyTo,r.selectedField.type);n.isExtra=a&&_.some(r.selectedField.options.extraOperators,function(e){return e===n.type});var t=_.includes(n.excludeFrom,r.selectedField.type)||i&&_.includes(r.selectedField.options.excludedOperators,n.type);if((e||n.isExtra)&&!t)return n})}function l(n){return e[n.model][n.action](n.params).$promise.then(function(e){if("autocomplete"!==r.selectedField.type)return e.rows;var n=r.searchText?_.filter(e.rows,function(e){e.displayValue="";for(var n=0;n<r.selectedField.options.searchFields.length;n++){var t=e[r.selectedField.options.searchFields[n]]||"";e.displayValue+=t+" "}return _.trimEnd(e.displayValue),_.includes(e.displayValue.toLowerCase(),r.searchText.toLowerCase())}):[];return o.when(n)}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:n.model.toUpperCase()+"."+n.action.toUpperCase(),msg:e.data?JSON.stringify(e.data.message):e.toString()})})}function a(){!r.value||_.isArray(r.value)&&_.isEmpty(r.value)?r.isValidCondition=!1:r.selectedOperator?r.selectedOperator&&"$between"===r.selectedOperator.type?r.isValidCondition=!(!r.endRangeValue||!r.isValidRange):r.isValidCondition=!0:r.isValidCondition=!1}function i(){"number"===r.selectedField.type?_.isNumber(r.endRangeValue)?r.isValidRange=Number(r.endRangeValue)>Number(r.value):r.isValidRange=!0:"date"===r.selectedField.type&&(r.maxDateRange=moment(r.endRangeValue).subtract(1,"day"),r.isValidRange=!0),a()}function d(){var e=m();r.options.conditions.push(e),p()}function c(){var e=m(),n=_.findIndex(r.options.conditions,"style");r.options.conditions.splice(n,1,e),p(),r.pendingCondition.style=null,r.pendingCondition=void 0}function m(){return{name:r.selectedField.name,operator:s.instant("DASHBOARDS."+r.selectedOperator.translate),value:r.value,endValue:r.endRangeValue,displayValue:u(r.value),displayEndValue:u(r.endRangeValue),query:{column:r.selectedField.column,operator:r.selectedOperator.type,value:function(){var e,n=r.value,t=r.endRangeValue;switch(r.selectedField.type){case"date":var a=moment(n).utcOffset(0,!0).format("YYYY-MM-DD");if("$between"===r.selectedOperator.type){var i=moment(t).utcOffset(0,!0).format("YYYY-MM-DD");e=[a,i]}else e=a;break;case"number":e="$between"===r.selectedOperator.type?[n,t]:n;break;case"multiselect":var s=r.selectedField.options.field||"name";e=_.map(n,s);break;case"select":e=n.id;break;case"autocomplete":e=r.selectedOperator.isExtra?n:n.id;break;default:e=n}return e}()},disabled:!1}}function u(e){var n;if(e){switch(r.selectedField.type){case"date":n=moment(e).format("YYYY-MM-DD");break;case"multiselect":var t=_.map(e,function(e){return e.name});n="$eq"===r.selectedOperator.type?t.join(" or "):t.join(" and ");break;case"select":n=e.name;break;case"autocomplete":n=r.selectedOperator.isExtra?e:e.displayValue;break;default:n=e}return n}}function p(){r.value=null,r.endRangeValue=null,r.minDateRange=null,r.maxDateRange=null,r.isValidCondition=!1}r.operators=r.availableOperators=[{type:"$eq",symbol:"=",translate:"EQUALS",excludeFrom:["multiselect"]},{type:"$ne",symbol:"≠",translate:"IS_NOT_EQUAL",excludeFrom:["multiselect"]},{type:"$in",symbol:"∈",translate:"IS_AMONG",applyTo:["multiselect"]},{type:"$notIn",symbol:"∉",translate:"IS_NOT_AMONG",applyTo:["multiselect"]},{type:"$substring",symbol:"⊃",translate:"CONTAINS",applyTo:["text"]},{type:"$startsWith",symbol:"a..",translate:"STARTS_WITH",applyTo:["text"]},{type:"$endsWith",symbol:"..a",translate:"ENDS_WITH",applyTo:["text"]},{type:"$lt",symbol:"<",translate:"IS_LESS_THAN",applyTo:["date","number"]},{type:"$gt",symbol:">",translate:"IS_GREATER_THAN",applyTo:["date","number"]},{type:"$lte",symbol:"≤",translate:"IS_LESS_THAN_OR_EQUAL_TO",applyTo:["date","number"]},{type:"$gte",symbol:"≥",translate:"IS_GREATER_THAN_OR_EQUAL_TO",applyTo:["date","number"]},{type:"$between",symbol:"≬",translate:"IS_BETWEEN",applyTo:["date","number"]}],r.addCondition=d,r.editCondition=function(e){r.pendingCondition=e,r.pendingCondition.style="md-amber-200-bg",r.selectedField=_.find(r.options.fields,["name",r.pendingCondition.name]),n(),r.selectedOperator=_.find(r.availableOperators,["type",r.pendingCondition.query.operator]),"date"===r.selectedField.type&&"string"==typeof r.pendingCondition.value?(r.value=new Date(r.pendingCondition.value),r.minDateRange=moment(r.value).add(1,"day"),r.endRangeValue=r.pendingCondition.endValue?new Date(r.pendingCondition.endValue):void 0):(r.value=r.pendingCondition.value,r.endRangeValue=r.pendingCondition.endValue);r.isValidRange=!0,r.isValidCondition=!0},r.updateCondition=c,r.cancelUpdateCondition=function(){r.pendingCondition.style=null,r.pendingCondition=void 0},r.setConditionStatus=function(e){e.style=e.disabled?void 0:"chip-disabled",e.disabled=!e.disabled},r.removeCondition=function(){_.isEmpty(r.options.conditions)&&r.clearFilter()},r.getValues=function(){{if(r.selectedField.options.routes&&Array.isArray(r.selectedField.options.routes)){var e=angular.copy(r.selectedField.options.routes),n=_.map(e,function(e){return l(e)});return o.all(n).then(function(e){r.selectedField.values=_.flatten(e)})}var t=angular.copy(r.selectedField.options.route);if("autocomplete"===r.selectedField.type)for(var a=0;a<Object.keys(t.params).length;a++){var i=Object.keys(t.params)[a];"@autocomplete"===t.params[i]&&(t.params[i]=r.searchText)}if(!r.selectedField.values)return l(t).then(function(e){r.selectedField.values=_.flatten(e)});r.selectedField.values.forEach(function(e){e.translate&&(e.name=s.instant(e.translate))})}},r.onFieldChange=function(){r.value=void 0,r.endRangeValue=void 0,r.searchText=void 0,r.isValidCondition=!1,n(),r.autoSelectOperator=1===r.availableOperators.length,r.autoSelectOperator||(r.selectedOperator=void 0)},r.onOperatorChange=function(e){r.isValidRange=!0,r.selectedOperator&&(e?e.applyTo?0<_.difference(r.selectedOperator.applyTo,e.applyTo).length&&(r.value=null):r.selectedOperator.applyTo&&(r.value=null):r.value||(r.value=null),"between"!=r.selectedOperator.type&&(r.endRangeValue=null),r.selectedField.options&&!_.isEmpty(r.selectedField.options.extraOperators)&&(r.selectedOperator.isExtra=_.some(r.selectedField.options.extraOperators,function(e){return e===r.selectedOperator.type})));a()},r.onValueChange=function(){r.selectedOperator&&"$between"===r.selectedOperator.type?"number"===r.selectedField.type?i():"date"===r.selectedField.type&&(r.minDateRange=moment(r.value).add(1,"day"),a()):a()},r.checkRange=i,r.handleKeyboardAction=function(){r.pendingCondition?c():d()}}e.$inject=["$translate","$q","api","toasty"],angular.module("app.core").directive("msAdvancedSearch",function(){return{restrict:"E",scope:{options:"=",clearFilter:"&"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-advanced-search/ms-advanced-search.html"}})}(),function(){"use strict";angular.module("app.core").directive("msCard",function(){return{restrict:"E",scope:{templatePath:"=template",card:"=ngModel",vm:"=viewModel"},template:'<div class="ms-card-content-wrapper" ng-include="templatePath" onload="cardTemplateLoaded()"></div>',compile:function(e){return e.addClass("ms-card"),function(e,n){e.cardTemplateLoaded=function(){e.$emit("msCard::cardTemplateLoaded",n)}}}}})}(),function(){"use strict";angular.module("app.core").directive("msChipColor",function(){return{restrict:"A",link:function(e,i,n){n.$observe("msChipColor",function(e){var n=i.parent().parent();if(n.hasClass("md-background-bg md-hue-3")||n.addClass("md-background-bg md-hue-3"),_.isEmpty(e)){var t=n[0].className.split(" "),a=t.indexOf("md-hue-3");t.length=a+1,n[0].className=t.join(" ")}else n.addClass(e)})}}})}(),function(){"use strict";angular.module("app.core").directive("msClickToCall",function(){return{restrict:"E",scope:{type:"=",disabled:"=",target:"=",prefix:"=",license:"="},controller:["$scope","$rootScope","$http","$translate","$document","$mdDialog","Auth","toasty","api",function(t,n,a,i,s,o,e,r,l){function d(e){switch(t.currentUser.showWebBar){case 0:return m("http://127.0.0.1:"+(t.currentUser.phoneBarRemoteControlPort||"9888")+"/api/originate/"+c(e));case 2:return n.$broadcast("webrtc::call",{target:c(e)})}}function c(e){return _.isNil(e)?"":e.replace(/[^\w.+#*\-]+/g,"")}function m(e){return a.get(e).success(function(){r.success({title:"Successful call",msg:"Call properly handled!"})}).error(function(e){r.error({title:"PhoneBar API Error",msg:i.instant("CONTACTMANAGER.ERRORS.PHONEBAR_API")})})}t.currentUser=e.getCurrentUser(),t.privacy=t.currentUser.privacyEnabled,t.showMenu=function(){return t.target&&t.target.indexOf("@")<0&&t.target!=t.currentUser.internal&&t.target!=t.currentUser.name&&(0==t.currentUser.showWebBar&&t.currentUser.phoneBarRemoteControl||2==t.currentUser.showWebBar&&t.license.webrtc)&&!t.disabled},t.call=function(e){return 2!==t.currentUser.showWebBar?(n=e,l.user.getVoicePrefixes({id:t.currentUser.id}).$promise.then(function(e){if(e.count)return o.show({controller:"PrefixDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/prefix/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!0,locals:{prefixes:e,required:t.currentUser.phoneBarPrefixRequired}})}).then(function(e){t.currentUser.phoneBarPrefixRequired?e&&-1!==e&&d(e+n):e&&-1!==e?d(e+n):e||d(n)})):d(e);var n},t.transfer=function(e){switch(t.currentUser.showWebBar){case 0:return m("http://127.0.0.1:"+(t.currentUser.phoneBarRemoteControlPort||"9888")+"/api/transfer?number="+c(e));case 2:n.$broadcast("webrtc::transfer",{target:c(e)})}}}],templateUrl:"app/core/directives/ms-click-to-call/ms-click-to-call.html"}})}(),function(){"use strict";n.$inject=["ClientSideLoggingService","$rootScope","$translate"];var e={bindings:{user:"<"},controller:n,controllerAs:"vm",templateUrl:"app/core/directives/ms-client-side-logging/ms-client-side-logging-icon.html"};function n(e,n,t){var a=this,i=e.getLoggingColors();function s(){a.tooltipHTML=a.user.userSetting.clientSideLoggingEnabled?[t.instant("STAFF.CLIENT_LOGS_ENABLED"),t.instant("STAFF.CLIENT_LOGS_LOGLEVEL",{logLevel:a.user.userSetting.clientSideLoggingLevel}),t.instant("STAFF.CLIENT_LOGS_ENABLED_SINCE",{enabledSince:moment(a.user.userSetting.clientSideLoggingEnabledSince).format("LLLL")})].join("<br>"):t.instant("STAFF.CLIENT_LOGS_DISABLED")}a.tooltipHTML=t.instant("STAFF.CLIENT_LOGS_DISABLED"),a.styleColor=i.disabled,a.styleIcon=a.user.userSetting&&a.user.userSetting.clientSideLoggingEnabled?"icon-checkbox-marked-circle":"icon-close",a.$onInit=function(){if(!a.user.userSetting)return;var e=a.user.userSetting.clientSideLoggingEnabled?a.user.userSetting.clientSideLoggingLevel:"disabled";a.styleColor=i[e],"info"===e&&(a.styleIcon="icon-checkbox-marked-circle-outline");return s()},a.$onDestroy=function(){o()};var o=n.$on("$translateChangeSuccess",s)}angular.module("app.core").component("msClientSideLoggingIcon",e)}(),function(){"use strict";n.$inject=["ClientSideLoggingService","UserSettingService","$q","$translate","$rootScope","$interval"];var e={bindings:{user:"<",onUserUpdate:"&"},controller:n,controllerAs:"vm",templateUrl:"app/core/directives/ms-client-side-logging/ms-client-side-logging.html"};function n(e,t,n,a,i,s){var o=this,r=e.getLoggingColors(),l=null;function d(){l&&s.cancel(l)}o.styleProperties=r.disabled,o.clientSideLoggingEnabledSince="",o.$onInit=function(){m().then(function(){d(),l=s(u,6e4)})},o.$onChanges=function(e){e&&n.resolve().then(m)},o.$onDestroy=function(){d(),c()},o.onEnabledSwitchChange=function(){var e=o.user.userSetting.clientSideLoggingEnabled,n=o.user.userSetting.clientSideLoggingLevel;return p(e,n)},o.onLogLevelSelectionChange=function(){var e=o.user.userSetting.clientSideLoggingEnabled,n=o.user.userSetting.clientSideLoggingLevel;p(e,n)},o.computeStyleForLoggingLevel=function(e){return r[e]};var c=i.$on("$translateChangeSuccess",u);function m(){o.availableClientSideLoggingLevels=Object.keys(r).filter(function(e){return"disabled"!==e});var e=o.user.userSetting&&o.user.userSetting.clientSideLoggingEnabled?o.user.userSetting.clientSideLoggingLevel:"disabled";return o.styleProperties=r[e],u()}function u(){if(o.user.userSetting)return o.user.userSetting.clientSideLoggingEnabled?void(o.clientSideLoggingEnabledSince=a.instant("STAFF.CLIENT_LOGS_ENABLED_SINCE",{enabledSince:moment(moment(o.user.userSetting.clientSideLoggingEnabledSince).format()).fromNow()})):o.clientSideLoggingEnabledSince=""}function p(e,n){return t.updateUserSettingById(o.user.userSetting.id,{clientSideLoggingEnabled:e,clientSideLoggingLevel:n}).then(function(){"function"==typeof o.onUserUpdate&&o.onUserUpdate()})}}angular.module("app.core").component("msClientSideLogging",e)}(),function(){"use strict";function e(i){return{require:"ngModel",priority:1,link:function(e,n,t,a){a.$formatters.push(i.formatter),a.$parsers.push(i.parser)}}}e.$inject=["msDatepickerFixConfig"],angular.module("app.core").provider("msDatepickerFixConfig",function(){var n={formatter:function(e){return e?""===e?e:new Date(e):""},parser:function(e){return e?moment(e).add(moment(e).utcOffset(),"m").toDate():""}};this.config=function(e){n=angular.extend({},n,e)},this.$get=function(){return n}}).directive("msDatepickerFix",e)}(),function(){"use strict";function e(s){return{restrict:"E",scope:{id:"=",model:"=",element:"=",title:"=",path:"="},replace:!0,link:function(n,e){var t=!1,a={};a.id=n.id,_.isNil(n.path)||(a.path=n.path);var i=document.createElement(n.element);i.setAttribute("preload","none"),i.setAttribute("controls","true"),"audio"===n.element&&i.setAttribute("style","width: 265px;"),"video"===n.element&&i.setAttribute("style","max-width: 500px;"),i.setAttribute("title",n.title),i.setAttribute("src"," "),i.onplay=function(e){t||(t=!0,e.preventDefault(),s[n.model].download(a).$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type});i.setAttribute("type",e.type),i.setAttribute("src",URL.createObjectURL(t)),i.play()}).catch(function(e){console.error(e)}))},e.append(i)}}}e.$inject=["api"],angular.module("app.core").directive("msDialogRecording",e)}(),function(){"use strict";function e(i){return{restrict:"A",link:function(t,a){a.bind("click",function(e){var n=i('<div layout="row" class="spinner-overlay" layout-sm="column" layout-align="center center" aria-label="wait"><md-progress-circular md-mode="indeterminate"></md-progress-circular></div>')(t);a.closest("md-dialog").prepend(n)})}}}e.$inject=["$compile"],angular.module("app.core").directive("msDialogSpinner",e)}(),function(){"use strict";function e(){var o=this;function a(e,n,t,a){var i=[];if(0<=t)i.push(e[t]),n.push(e[t]),e.splice(t,1);else{for(var s=0;s<e.length;s++)void 0!==e[s].isValid&&e[s].isValid&&n.push(e[s]);for(s=e.length-1;0<=s;s--)e[s].isValid&&e.splice(s,1);i=n}o.options.transferCallback&&o.options.transferCallback(i,a)}o.canTransfer=function(e,n,t){if(void 0!==e.isValid&&e.isValid)return t?a(n.selectedItems,n.items,n.selectedItems.indexOf(e),t):a(n.items,n.selectedItems,n.items.indexOf(e),t)},o.transfer=a,o.getLine=function(e,n){var t="";if(_.isNil(n))return t;{if(_.isArray(n)){for(var a=0;a<n.length;a++)t+=" "+(e[n[a]]?e[n[a]]:"");return t}return e[n]?e[n]:""}}}angular.module("app.core").directive("msDualMultiselect",function(){return{restrict:"E",scope:{options:"=",readOnly:"=",addDisabled:"<"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-dual-multiselect/ms-dual-multiselect.html"}})}(),function(){"use strict";function e(a){return{restrict:"E",replace:!0,scope:{onReply:"&",ngModel:"=",ctrlMethods:"=",pickerPosition:"=",search:"=",recentEmojis:"=",placeholder:"="},template:'<textarea class="emojionearea"></textarea>',link:function(t,e){var n=e.emojioneArea({pickerPosition:t.pickerPosition,search:t.search,recentEmojis:t.recentEmojis,placeholder:a.instant(t.placeholder||"Type a message"),attributes:{spellcheck:!0},events:{keyup:function(e,n){t.ngModel=this.getText(),t.onReply({event:n,body:this.getText()})},emojibtn_click:function(){t.ngModel=this.getText()}}});t.ngModel&&n[0].emojioneArea.setText(t.ngModel),t.internalControl=t.ctrlMethods||{},t.internalControl.setText=function(e){n[0].emojioneArea.setText(e)},t.internalControl.getText=function(){return n[0].emojioneArea.getText()},t.$watch("ngModel",function(e){e||n[0].emojioneArea.setText("")})}}}e.$inject=["$translate"],angular.module("app.core").directive("msEmojiArea",e)}(),function(){"use strict";angular.module("app.core").directive("msFontFamily",function(){return{restrict:"E",scope:{ngModel:"="},controller:["$scope",function(e){e.fonts=[{option:"Arial",value:"Arial,Helvetica,sans-serif"},{option:"Century Gothic",value:"Century Gothic,Futura,Didact Gothic,san-serif"},{option:"Calibri",value:"Calibri, Verdana, Geneva, sans-serif"},{option:"Comic Sans MS",value:"Comic Sans MS,cursive"},{option:"Courier New",value:"Courier New,Courier,monospace"},{option:"Georgia",value:"Georgia,serif"},{option:"Lucida Sans Unicode",value:"Lucida Sans Unicode,Lucida Grande,sans-serif"},{option:"Tahoma",value:"Tahoma,Geneva,sans-serif"},{option:"Times New Roman",value:"Times New Roman,Times,serif"},{option:"Trebuchet MS",value:"Trebuchet MS,Helvetica,sans-serif"},{option:"Verdana",value:"Verdana,Geneva,sans-serif"}]}],templateUrl:"app/core/directives/ms-font-family/ms-font-family.html"}})}(),function(){"use strict";angular.module("app.core").controller("MsFormWizardController",function(){var n=this;function e(){return n.forms.length}function t(){return 0===n.selectedIndex}function a(){return n.selectedIndex===e()-1}n.forms=[],n.selectedIndex=0,n.registerForm=function(e){n.forms.push(e)},n.previousStep=function(){if(t())return;n.selectedIndex--},n.nextStep=function(){if(a())return;n.selectedIndex++},n.firstStep=function(){n.selectedIndex=0},n.lastStep=function(){n.selectedIndex=e()-1},n.totalSteps=e,n.isFirstStep=t,n.isLastStep=a,n.currentStepInvalid=function(){return angular.isDefined(n.forms[n.selectedIndex])&&n.forms[n.selectedIndex].$invalid},n.previousStepInvalid=function(){return 0<n.selectedIndex&&angular.isDefined(n.forms[n.selectedIndex-1])&&n.forms[n.selectedIndex-1].$invalid},n.formsIncomplete=function(){for(var e=0;e<n.forms.length;e++)if(n.forms[e].$invalid)return!0;return!1},n.resetForm=function(){for(var e=n.selectedIndex=0;e<n.forms.length;e++)n.forms[e].$setPristine(),n.forms[e].$setUntouched()}}).directive("msFormWizard",function(){return{restrict:"E",scope:!0,controller:"MsFormWizardController as msWizard",compile:function(e){return e.addClass("ms-form-wizard"),function(){}}}}).directive("msFormWizardForm",function(){return{restrict:"A",require:["form","^msFormWizard"],compile:function(e){return e.addClass("ms-form-wizard-form"),function(e,n,t,a){var i=a[0],s=a[1];s.registerForm(i)}}}})}(),function(){"use strict";function e(i){return{restrict:"E",scope:{onClose:"&"},transclude:!0,templateUrl:"app/core/directives/ms-info-bar/ms-info-bar.html",link:function(e,n){var t=i.find("ms-info-bar-active"),a="ms-info-bar-active";t.addClass(a),e.removeInfoBar=function(){t.removeClass(a),n.remove(),e.onClose&&e.onClose(),e.$destroy()}}}}e.$inject=["$document"],angular.module("app.core").directive("msInfoBar",e)}(),function(){"use strict";function e(r,a,l,e){var d=this,n={columnCount:5,respectItemOrder:!1,reLayoutDebounce:400,responsive:{md:3,sm:2,xs:1}},t=!0;function i(){t&&e.cancel(t),t=e(function(){!function(){d.containerPos=d.container[0].getBoundingClientRect(),function(){d.columnCount=d.options.columnCount,l("gt-md")?d.columnCount=d.options.columnCount:l("md")?d.columnCount=d.columnCount>d.options.responsive.md?d.options.responsive.md:d.columnCount:l("sm")?d.columnCount=d.columnCount>d.options.responsive.sm?d.options.responsive.sm:d.columnCount:d.columnCount=d.options.responsive.xs;d.columnWidth=d.containerPos.width/d.columnCount}(),r.$broadcast("msMasonry:relayoutStarted"),d.items=d.container.find("ms-masonry-item");for(var e=Array.apply(null,new Array(d.columnCount)).map(function(){return 0}),n=0;n<d.items.length;n++){var t,a,i,s,o=d.items[n];(o=angular.element(o)).scope()&&o.scope().$broadcast("msMasonryItem:startReLayout"),o.css({width:d.columnWidth}),d.options.respectItemOrder?(i=n%d.columnCount,s=e[i]):(s=Math.min.apply(Math,e),i=e.indexOf(s)),e[i]=s+o[0].getBoundingClientRect().height,t=Math.round(i*d.columnWidth),a=s,o.css({transform:"translate3d("+t+"px,"+a+"px,0px)"}),o.addClass("placed"),o.scope()&&o.scope().$broadcast("msMasonryItem:finishReLayout")}}(),r.$broadcast("msMasonry:relayoutFinished")},d.options.reLayoutDebounce)}d.options=null,d.container=[],d.containerPos="",d.columnWidth="",d.items=[],d.reLayout=i,d.initialize=function(){d.options=d.options?angular.extend(n,d.options):n,r.$watch(function(){return d.container.width()},function(e,n){e!==n&&i()})},d.waitImagesLoaded=function(e,n){if("undefined"!=typeof imagesLoaded){var t=a.imagesLoaded(e);t.on("done",function(){n()})}else n()},r.$on("msMasonry:relayout",function(){i()})}function n(o){return{restrict:"AEC",controller:"msMasonryController",compile:function(i,s){return{pre:function(e,n,t,a){a.options=angular.fromJson(s.options||"{}"),a.container=i},post:function(e,n,t,a){o(function(){a.initialize()})}}}}}e.$inject=["$scope","$window","$mdMedia","$timeout"],n.$inject=["$timeout"],angular.module("app.core").controller("msMasonryController",e).directive("msMasonry",n).directive("msMasonryItem",function(){return{restrict:"AEC",require:"^msMasonry",priority:1,link:function(e,n,t,a){a.waitImagesLoaded(n,function(){a.reLayout()}),e.$on("msMasonryItem:finishReLayout",function(){e.$watch(function(){return n.height()},function(e,n){e!==n&&a.reLayout()})}),n.on("$destroy",function(){a.reLayout()})}}})}(),function(){"use strict";function e(t,e,a,i){var s=this;function o(e,n){s.selectedPalette=e,s.selectedHues=n}function r(){o(!(s.selectedColor={palette:"",hue:"",class:""}),!1),d()}function l(e,n){s.selectedColor={palette:e,hue:n,class:"md-"+e+"-"+n+"-bg",bgColorValue:i.rgba(s.palettes[e][n].value),fgColorValue:i.rgba(s.palettes[e][n].contrast)},"obj"!==s.msModelType||angular.equals(s.selectedColor,s.modelCtrl.$viewValue)||d(),o(e,s.palettes[e]),t.$selectedColor=s.selectedColor}function d(){"class"===s.msModelType?s.modelCtrl.$setViewValue(s.selectedColor.class):"obj"===s.msModelType&&s.modelCtrl.$setViewValue(s.selectedColor)}s.palettes=e,s.selectedPalette=!1,s.selectedHues=!1,t.$selectedColor={},s.activateHueSelection=o,s.selectColor=function(e,n){l(e,n),d(),a.hide()},s.removeColor=r,t.$watch("ngModel",function(){if(!s.modelCtrl.$viewValue||""===s.modelCtrl.$viewValue)return void r();var e,n;if("class"===s.msModelType){var t=s.modelCtrl.$viewValue.split("-");n=5<=t.length?(e=t[1]+"-"+t[2],t[3]):(e=t[1],t[2])}else"obj"===s.msModelType&&(e=s.modelCtrl.$viewValue.palette,n=s.modelCtrl.$viewValue.hue||500);l(e,n)})}e.$inject=["$scope","$mdColorPalette","$mdMenu","motionGenerator"],angular.module("app.core").controller("msMaterialColorPickerController",e).directive("msMaterialColorPicker",function(){return{require:["msMaterialColorPicker","ngModel"],restrict:"E",scope:{ngModel:"=",msModelType:"@?"},controller:"msMaterialColorPickerController as vm",transclude:!0,templateUrl:"app/core/directives/ms-material-color-picker/ms-material-color-picker.html",link:function(e,n,t,a,i){var s=a[0];s.modelCtrl=a[1],s.msModelType=e.msModelType||"class",i(e,function(e){(e=e.filter(function(e,n){return 1===n.nodeType})).length&&n.find("ms-color-picker-button").replaceWith(e)})}}})}(),function(){"use strict";function e(p,g,v){return{restrict:"A",link:function(e,n,t){var a="true"===t.msNavIsFolded,i=!1,s=angular.element(p[0].body),o=angular.element('<div id="ms-nav-fold-open-overlay"></div>'),r=angular.element('<div id="ms-nav-fold-close-overlay"></div>'),l=n.parent();function d(){s.addClass("ms-nav-folded"),g.$broadcast("msNav::forceCollapse"),n.scrollTop(0),l.append(o),o.on("mouseenter touchstart",function(e){c(e),i=!0})}function c(e){angular.isDefined(e)&&e.preventDefault(),s.addClass("ms-nav-folded-open"),g.$broadcast("msNav::expandMatchingToggles"),l.find(o).remove(),l.parent().append(r),r.on("mouseenter touchstart",function(e){m(e),i=!1})}function m(e){angular.isDefined(e)&&e.preventDefault(),g.$broadcast("msNav::forceCollapse"),n.scrollTop(0),s.removeClass("ms-nav-folded-open"),l.parent().find(r).remove(),l.append(o),o.on("mouseenter touchstart",function(e){c(e),i=!0})}function u(){s.removeClass("ms-nav-folded ms-nav-folded-open"),g.$broadcast("msNav::expandMatchingToggles"),n.off("mouseenter mouseleave")}v.setFoldable(e,n,a),a?d():u(),e.toggleFold=function(){(a=!a)?d():u()},e.openFolded=c,e.closeFolded=m,e.isNavFoldedOpen=function(){return i},e.$on("$destroy",function(){o.off("mouseenter touchstart"),r.off("mouseenter touchstart"),n.off("mouseenter mouseleave")})}}}function n(t,a,i){return{restrict:"E",scope:{},controller:"MsNavController",compile:function(e){return e.addClass("ms-nav"),function(e){t.$broadcast("msNav::expandMatchingToggles");var n=t.$on("$stateChangeSuccess",function(){t.$broadcast("msNav::expandMatchingToggles"),a.when("navigation").then(function(e){e.close(),i.isNavFoldedOpen()&&i.closeFolded()})});e.$on("$destroy",function(){n()})}}}}function t(m,u,p,g){return{restrict:"A",require:"^msNav",scope:!0,compile:function(e,n){return e.addClass("ms-nav-toggle"),angular.isUndefined(n.collapsed)&&(n.collapsed=!0),e.attr("collapsed",n.collapsed),function(a,i,e,t){var s={expanded:"expanded",expandAnimation:"expand-animation",collapseAnimation:"collapse-animation"},n=i.find("a"),o=[],r=/\(.*\)/g;function l(){return"true"===i.attr("collapsed")}function d(){var e=u.defer();if(!l())return e.reject({error:!0}),e.promise;i.attr("collapsed",!1);var n=angular.element(i.find("ms-nav-toggle-items")[0]);n.css({position:"absolute",visibility:"hidden",display:"block",height:"auto"});var t=n[0].offsetHeight;return n.css({position:"",visibility:"",display:"",height:""}),a.$evalAsync(function(){p.animate(n,{display:"block",height:"0px"},{height:t+"px"},s.expandAnimation).then(function(){n.addClass(s.expanded),n.css({height:""}),e.resolve({success:!0})})}),e.promise}function c(){var e=u.defer();if(l())return e.reject({error:!0}),e.promise;i.attr("collapsed",!0);var n=angular.element(i.find("ms-nav-toggle-items")[0]),t=n[0].offsetHeight;return a.$evalAsync(function(){p.animate(n,{height:t+"px"},{height:"0px"},s.collapseAnimation).then(function(){n.removeClass(s.expanded),n.css({display:"",height:""}),e.resolve({success:!0})})}),e.promise}angular.forEach(n,function(e){var n=angular.element(e).attr("ui-sref");angular.isUndefined(n)||(n=n.replace(r,""),o.push(n))}),t.setToggleItem(i,a),i.children(".ms-nav-button").on("click",function(){if(t.isDisabled())return;t.disable(),l()?(t.clearLockedItems(),a.$emit("msNav::pushToLockedList"),m.$broadcast("msNav::collapse"),d().then(function(){t.enable()})):a.$broadcast("msNav::forceCollapse")}),a.$on("$destroy",function(){i.children(".ms-nav-button").off("click")}),a.$on("msNav::collapse",function(){var e=t.getLockedItems(),n=!1;angular.forEach(e,function(e){angular.equals(e.scope,a)&&(n=!0)}),n||c().then(function(){t.enable()})}),a.$on("msNav::forceCollapse",function(){c().then(function(){t.enable()})}),a.$on("msNav::expandMatchingToggles",function(){var n=g.current.name,t=!1;angular.forEach(o,function(e){n===e&&(t=!0)}),t?d():c()}),a.$on("msNav::pushToLockedList",function(){t.setLockedItem(i,a)})}}}}e.$inject=["$document","$rootScope","msNavFoldService"],n.$inject=["$rootScope","$mdComponentRegistry","msNavFoldService"],t.$inject=["$rootScope","$q","$animate","$state"],angular.module("app.core").factory("msNavFoldService",function(){var t={};return{setFoldable:function(e,n){t={scope:e,element:n}},isNavFoldedOpen:function(){return t.scope.isNavFoldedOpen()},toggleFold:function(){t.scope.toggleFold()},openFolded:function(){t.scope.openFolded()},closeFolded:function(){t.scope.closeFolded()}}}).directive("msNavIsFolded",e).controller("MsNavController",function(){var e=this,n=!1,t=[],a=[];e.isDisabled=function(){return n},e.enable=function(){n=!1},e.disable=function(){n=!0},e.setToggleItem=function(e,n){t.push({element:e,scope:n})},e.getLockedItems=function(){return a},e.setLockedItem=function(e,n){a.push({element:e,scope:n})},e.clearLockedItems=function(){a=[]}}).directive("msNav",n).directive("msNavTitle",function(){return{restrict:"A",compile:function(e){return e.addClass("ms-nav-title"),function(){}}}}).directive("msNavButton",function(){return{restrict:"AE",compile:function(e){return e.addClass("ms-nav-button"),function(){}}}}).directive("msNavToggle",t)}(),function(){"use strict";function e(e,n){e.root?this.navigation=n.getNavigation(e.root):this.navigation=n.getNavigation(),this.toggleHorizontalMobileMenu=function(){angular.element("body").toggleClass("ms-navigation-horizontal-mobile-menu-active")},n.sort()}function n(c,m,u,p){return{restrict:"E",scope:{folded:"=",root:"@"},controller:"MsNavigationController as vm",templateUrl:"app/core/directives/ms-navigation/templates/vertical.html",transclude:!0,compile:function(e){return e.addClass("ms-navigation"),function(e,n){var t=angular.element("body"),a=angular.element('<div id="ms-navigation-fold-expander"></div>'),i=angular.element('<div id="ms-navigation-fold-collapser"></div>'),s=u("navigation");function o(e){if(p.setFolded(e),e)c.$broadcast("msNavigation::collapse"),t.addClass("ms-navigation-folded"),r();else{var n=p.getActiveItem();n&&n.scope.$emit("msNavigation::stateMatched"),t.removeClass("ms-navigation-folded ms-navigation-folded-open"),i.remove()}}function r(){n.parent().append(a),m(function(){a.on("mouseenter touchstart",l)})}function l(e){e&&e.preventDefault(),p.setFoldedOpen(!0);var n=p.getActiveItem();n&&n.scope.$emit("msNavigation::stateMatched"),t.addClass("ms-navigation-folded-open"),a.remove(),t.find("#main").append(i),i.on("mouseenter touchstart",d)}function d(e){e&&e.preventDefault(),p.setFoldedOpen(!1),c.$broadcast("msNavigation::collapse"),t.removeClass("ms-navigation-folded-open"),i.remove(),r()}p.setNavigationScope(e),function(){null===p.getFolded()&&p.setFolded(e.folded);p.getFolded()&&(m(function(){c.$broadcast("msNavigation::collapse")}),t.addClass("ms-navigation-folded"),r())}(),e.$watch(function(){return s.isLockedOpen()},function(e,n){if(!angular.isUndefined(e)&&!angular.equals(e,n)&&p.getFolded())if(e)c.$broadcast("msNavigation::collapse");else{var t=p.getActiveItem();t&&t.scope.$emit("msNavigation::stateMatched")}}),e.$watch("folded",function(e,n){angular.isUndefined(e)||angular.equals(e,n)||o(e)}),e.toggleFolded=function(){o(!p.getFolded())},e.$on("$stateChangeStart",function(){s.close()}),e.$on("$destroy",function(){i.off("mouseenter touchstart"),a.off("mouseenter touchstart")})}}}}function t(t,e,a,i,n,s){var o=this;o.element=e,o.node=t.node,o.hasChildren=void 0,o.collapsed=void 0,o.collapsable=void 0,o.group=void 0,o.animateHeightClass="animate-height",o.toggleCollapsed=function(){o.collapsed?o.expand():o.collapse()},o.collapse=function(){var e=o.element.children("ul"),n=e[0].offsetHeight;t.$evalAsync(function(){o.collapsed=!0,o.element.addClass("collapsing"),i.animate(e,{display:"block",height:n+"px"},{height:"0px"},o.animateHeightClass).then(function(){e.css({display:"",height:""}),o.element.removeClass("collapsing")}),t.$broadcast("msNavigation::collapse")})},o.expand=function(){var e=o.element.children("ul");e.css({position:"absolute",visibility:"hidden",display:"block",height:"auto"});var n=e[0].offsetHeight;e.css({position:"",visibility:"",display:"",height:""}),t.$evalAsync(function(){o.collapsed=!1,o.element.addClass("expanding"),i.animate(e,{display:"block",height:"0px"},{height:n+"px"},o.animateHeightClass).then(function(){e.css({height:""}),o.element.removeClass("expanding")}),a.$broadcast("msNavigation::collapse",o.node._path)})},o.getClass=function(){return o.node.class},o.isHidden=function(){if(angular.isDefined(o.node.hidden)&&angular.isFunction(o.node.hidden))return o.node.hidden();return!1},function(){o.hasChildren=0<o.node.children.length,o.group=!(!angular.isDefined(o.node.group)||!0!==o.node.group),!o.hasChildren||o.group?o.collapsable=!1:o.collapsable=!(!angular.isUndefined(o.node.collapsable)&&"boolean"==typeof o.node.collapsable&&!0!==o.node.collapsable);o.collapsable?o.collapsed=!(!angular.isUndefined(o.node.collapsed)&&"boolean"==typeof o.node.collapsed&&!0!==o.node.collapsed):o.collapsed=!1;if(o.node.state===n.current.name||n.includes(o.node.state)){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(n.params)&&!angular.equals(o.node.stateParams,n.params))return;t.$emit("msNavigation::stateMatched"),s.setActiveItem(o.node,t)}t.$on("msNavigation::stateMatched",function(){o.collapsable&&o.collapsed&&t.$evalAsync(function(){o.collapsed=!1})}),t.$on("msNavigation::collapse",function(e,n){if(!o.collapsed&&o.collapsable)if(angular.isUndefined(n))o.collapse();else{var t=n.split("."),a=[],i=s.getActiveItem();if(i&&(a=i.node._path.split(".")),-1<t.indexOf(o.node._id))return;if(-1<a.indexOf(o.node._id))return;o.collapse()}}),t.$on("$stateChangeSuccess",function(){if(o.node.state===n.current.name){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(n.params)&&!angular.equals(o.node.stateParams,n.params))return;s.setActiveItem(o.node,t),a.$broadcast("msNavigation::collapse",o.node._path)}if(n.includes(o.node.state)){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(n.params)&&!angular.equals(o.node.stateParams,n.params))return;t.$emit("msNavigation::stateMatched")}})}()}function a(n){return{restrict:"E",scope:{root:"@"},controller:"MsNavigationController as vm",templateUrl:"app/core/directives/ms-navigation/templates/horizontal.html",transclude:!0,compile:function(e){return e.addClass("ms-navigation-horizontal"),function(e){n.setNavigationScope(e)}}}}function i(t,e,n,a,i){var s=this;s.element=e,s.node=t.node,s.hasChildren=void 0,s.group=void 0,s.getClass=function(){return s.node.class},function(){if(s.isActive=!1,s.hasChildren=0<s.node.children.length,s.group=!(!angular.isDefined(s.node.group)||!0!==s.node.group),s.node.state===a.current.name||a.includes(s.node.state)){if(angular.isDefined(s.node.stateParams)&&angular.isDefined(a.params)&&!angular.equals(s.node.stateParams,a.params))return;t.$emit("msNavigation::stateMatched"),i.setActiveItem(s.node,t)}t.$on("msNavigation::stateMatched",function(){s.hasChildren&&t.$evalAsync(function(){s.isActive=!0})}),t.$on("msNavigation::clearActive",function(){if(s.hasChildren){var e=[],n=i.getActiveItem();n&&(e=n.node._path.split(".")),-1<e.indexOf(s.node._id)?t.$evalAsync(function(){s.isActive=!0}):t.$evalAsync(function(){s.isActive=!1})}}),t.$on("$stateChangeSuccess",function(){if(s.node.state===a.current.name||a.includes(s.node.state)){if(angular.isDefined(s.node.stateParams)&&angular.isDefined(a.params)&&!angular.equals(s.node.stateParams,a.params))return;i.setActiveItem(s.node,t),n.$broadcast("msNavigation::clearActive")}})}()}function s(i){return{restrict:"A",require:"^msNavigationHorizontalNode",compile:function(e){return e.addClass("ms-navigation-horizontal-item"),function(e,n,t,a){n.on("click",function(){if(!a.hasChildren||i("gt-md"))return;n.toggleClass("expanded")}),e.$on("$destroy",function(){n.off("click")})}}}}e.$inject=["$scope","msNavigationService"],n.$inject=["$rootScope","$timeout","$mdSidenav","msNavigationService"],t.$inject=["$scope","$element","$rootScope","$animate","$state","msNavigationService"],a.$inject=["msNavigationService"],i.$inject=["$scope","$element","$rootScope","$state","msNavigationService"],s.$inject=["$mdMedia"],angular.module("app.core").provider("msNavigationService",function(){var r=angular.injector(["ng"]).get("$log"),l=[];function d(e,n){if(angular.isString(e)){for(var t=e.split("."),a=t[t.length-1],i=function(e){var n=l;if(1===e.length)return n;e.pop();for(var t=0;t<e.length;t++){for(var a=e[t],i=!0,s=0;s<n.length;s++)if(n[s]._id===a){n=n[s].children,i=!1;break}if(i){var o={_id:a,_path:e.join("."),title:a,weight:1,children:[]};n.push(o),n=o.children}}return n}(t),s=!1,o=0;o<i.length;o++)if(i[o]._id===a){s=i[o];break}s?(angular.extend(s,n),s.uisref=u(s)):(n.children=[],!angular.isUndefined(n.weight)&&angular.isNumber(n.weight)||(n.weight=1),n._id=a,n._path=e,n.uisref=u(n),i.push(n))}else r.error("path must be a string (eg. `dashboard.project`)")}function c(e){if(angular.isString(e)){for(var n=l,t=e.split("."),a=0;a<t.length;a++)for(var i=t[a],s=0;s<n.length;s++)if(n[s]._id===i){if(n[s]._path===e)return n.splice(s,1),!0;n=n[s].children;break}return!1}r.error("path must be a string (eg. `dashboard.project`)")}function m(e){e||(e=l).sort(a);for(var n=0;n<e.length;n++){var t=e[n].children;1<t.length&&t.sort(a),0<t.length&&m(t)}}function a(e,n){return parseInt(e.weight)-parseInt(n.weight)}function u(e){var n="";return angular.isDefined(e.state)&&(n=e.state,angular.isDefined(e.stateParams)&&angular.isObject(e.stateParams)&&(n=n+"("+angular.toJson(e.stateParams)+")")),n}this.saveItem=d,this.deleteItem=c,this.sortByWeight=m,this.$get=function(){var t=null,n=null,a=null,i=null,e={saveItem:d,deleteItem:c,sort:m,clearNavigation:function(){l=[],n&&(n.vm.navigation=l)},setActiveItem:function(e,n){t={node:e,scope:n}},getActiveItem:function(){return t},getNavigation:s,getFlatNavigation:o,setNavigationScope:function(e){n=e},setFolded:function(e){a=e},getFolded:function(){return a},setFoldedOpen:function(e){i=e},getFoldedOpen:function(){return i},toggleFolded:function(){n.toggleFolded()},getSectionId:function(n,t){var e=o(),a=_.find(e,function(e){return t?e.route===n&&e.title.toLowerCase()===t.toLowerCase():e.route===n});return a?a.id:0}};return e;function s(e){if(e){for(var n=0;n<l.length;n++)if(l[n]._id===e)return[l[n]];return null}return l}function o(e){var n=s(e);return function e(n){var t=[];for(var a=0;a<n.length;a++){var i=angular.copy(n[a]);i.children=[],t.push(i),0<n[a].children.length&&(t=t.concat(e(n[a].children)))}return t}(n)}}}).controller("MsNavigationController",e).directive("msNavigation",n).controller("MsNavigationNodeController",t).directive("msNavigationNode",function(){return{restrict:"A",bindToController:{node:"=msNavigationNode"},controller:"MsNavigationNodeController as vm",compile:function(e){return e.addClass("ms-navigation-node"),function(e,n,t,a){n.addClass(a.getClass()),a.group&&n.addClass("group")}}}}).directive("msNavigationItem",function(){return{restrict:"A",require:"^msNavigationNode",compile:function(e){return e.addClass("ms-navigation-item"),function(e,n,t,a){a.collapsable&&n.on("click",a.toggleCollapsed),e.$on("$destroy",function(){n.off("click")})}}}}).directive("msNavigationHorizontal",a).controller("MsNavigationHorizontalNodeController",i).directive("msNavigationHorizontalNode",function(){return{restrict:"A",bindToController:{node:"=msNavigationHorizontalNode"},controller:"MsNavigationHorizontalNodeController as vm",compile:function(e){return e.addClass("ms-navigation-horizontal-node"),function(e,n,t,a){n.addClass(a.getClass()),a.group&&n.addClass("group")}}}}).directive("msNavigationHorizontalItem",s)}(),function(){"use strict";function e(p,t,g,e,a,i,n,u,s,o,v,h,f,b,r,A,l){var E=this,d=["ringingId","speakerId","microphoneId","ringingVolume","speakerVolume","microphoneVolume","ringingMute","speakerMute","microphoneMute"],c=JSON.parse(n.localStorage.getItem("motion2.user:"+E.conf.id))||{webrtc:{ringingVolume:.5,speakerVolume:.5,microphoneVolume:1,ringingMute:!1,speakerMute:!1,microphoneMute:!1}};e(function(){},999);var y=l.getLogger("jssip","ms-phonebar");function m(l){var d,c,m;return E.initDeviceInProgress=!0,navigator.mediaDevices.getUserMedia({audio:!0}).then(function(e){return E.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/silence.ogg"),E.soundPlayer.play().catch(function(e){y.error(e.message)}),e.getTracks().forEach(function(e){e.stop()}),navigator.mediaDevices.enumerateDevices()}).then(function(e){var n=_.filter(e,function(e){return"audioinput"===e.kind&&"default"!==e.deviceId&&"communications"!==e.deviceId});if(0<n.length){var t=_.find(e,function(e){return"default"===e.deviceId&&"audioinput"===e.kind});if(m=_.find(n,function(e){return e.groupId===t.groupId}),E.conf.microphoneId&&!l){var a=_.find(n,function(e){return e.deviceId===E.conf.microphoneId});a&&(m=a)}E.conf.microphoneId=m.deviceId}else v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_MICROPHONE_NOT_AVAILABLE"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"});E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0,x("microphone",!1);var i=_.filter(e,function(e){return"audiooutput"===e.kind&&"default"!==e.deviceId&&"communications"!==e.deviceId});if(0<i.length){var s=_.find(e,function(e){return"default"===e.deviceId&&"audiooutput"===e.kind});if(c=d=_.find(i,function(e){return e.groupId===s.groupId}),E.conf.speakerId&&!l){var o=_.find(i,function(e){return e.deviceId===E.conf.speakerId});o&&(c=o)}if(E.conf.speakerId=c.deviceId,E.conf.ringingId&&!l){var r=_.find(i,function(e){return e.deviceId===E.conf.ringingId});r&&(d=r)}E.conf.ringingId=d.deviceId}else v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_SPEAKER_NOT_AVAILABLE"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"});return x("speaker",!1)}).then(function(){return x("ringing",!1)}).then(function(){if(jabra)return jabra.init().then(function(){return E.isJabraInitialized=!0,jabra.getInstallInfo()}).then(function(){return jabra.getUserDeviceMediaExt()}).then(function(e){m&&c&&d&&e&&_.includes([m.groupId,c.groupId,d.groupId],e.deviceInfo.browserGroupId)&&(y.info("Jabra library correctly initialized and device correctly installed"),E.isJabraEnabled=!0,jabra.onHook(),jabra.addEventListener("acceptcall",function(e){var n=_.last(E.sessions);n?"incoming"===n.direction&&n.isInProgress()?E.answer(n):y.error("Unable to find a valid call to answer",e):y.error("Unable to answer the call",e)}.bind(this)),jabra.addEventListener("mute",function(){x("microphone",E.conf.microphoneMute=!0)}.bind(this)),jabra.addEventListener("unmute",function(){E.conf.microphoneMute=!1,x("microphone",!0)}.bind(this)),jabra.addEventListener("flash",function(){E.jabraSession.localHold?E.unhold(E.jabraSession):E.hold(E.jabraSession)}.bind(this)),jabra.addEventListener("endcall",function(){o(function(e){for(var n=null,t=0;t<E.sessions.length;t++)_.has(E.sessions[t],"localHold")&&E.sessions[t].localHold||(n=E.sessions[t]);e(n)}).then(function(e){null!==e&&E.terminate(e)})}.bind(this)))}).catch(function(e){y.warn("Error initializing Jabra integration",e)})}).catch(function(e){y.error("Unable to init media devices",e),"NotFoundError"===e.name&&v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_AUDIO_DEVICES_NOT_AVAILABLE"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"})}).finally(function(){E.initDeviceInProgress=!1,S(),DetectRTC.load(function(){E.conf.hasMicrophone=DetectRTC.hasMicrophone,E.conf.hasSpeakers="Chrome"!==DetectRTC.browser.name&&"Edge"!==DetectRTC.browser.name&&"Opera"!==DetectRTC.browser.name||DetectRTC.hasSpeakers,E.conf.isWebRTCSupported=DetectRTC.isWebRTCSupported,E.conf.osName=DetectRTC.osName,E.conf.osVersion=DetectRTC.osVersion,E.conf.browserName=DetectRTC.browser.name,E.conf.browserVersion=DetectRTC.browser.version,E.conf.license&&E.conf.isWebRTCSupported&&E.conf.hasMicrophone&&E.conf.hasSpeakers&&"https"===E.conf.protocol&&("chrome"===E.conf.browserName.toLowerCase()||"opera"===E.conf.browserName.toLowerCase()||"safari"===E.conf.browserName.toLowerCase())?E.register||E.ua.start():E.conf.license||v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_LICENSE_NOT_ENABELD"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"})}.bind(this))})}function S(){c.webrtc=_.pick(E.conf,d),n.localStorage.setItem("motion2.user:"+E.conf.id,JSON.stringify(c))}function T(e,n,t){y.debug("addCall -> target, inbound, fullname",e,n,t),E.calls.unshift({target:e,fullname:t||e,inbound:n,time:moment().format("HH:mm")}),50<E.calls.length&&E.calls.pop()}function I(e){y.debug("answer -> session",e._request),e.notification&&(e.notification.close(),e.notification=null),E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0,e.answer(E.sessionConf),E.isJabraEnabled&&(jabra.offHook(),E.jabraSession=e)}function O(e,n){y.debug("terminate -> session",e._request),e.notification&&(e.notification.close(),e.notification=null);var t={};if(n?t.status_code=n:e.isEstablished()||(t.status_code=603),e.terminate(t),E.isJabraEnabled)if(0===E.sessions.length)e.localHold&&jabra.resume(),jabra.onHook(),E.jabraSession=null;else{var a=_.last(E.sessions);a.localHold?(jabra.onHook(),jabra.hold(),E.jabraSession=a):jabra.offHook()}}function C(t){return y.debug("getVoiceChannels -> session",t._request),h.rpc.getVoiceChannels().$promise.then(function(e){var n=_.find(e.rows,function(e){return e.sipcalllinkedid===t.call_id?e:e.sipcalluniqueid===t.call_id?e:null});n&&(t.monitor=n.monitor,t.uniqueid=n.uniqueid,t.monitors=n.monitors)})}function w(e){y.debug("onAddstream -> data",e),this.remotePlayer.srcObject=e.stream,this.remotePlayer.play()}function R(){E.canGoInConference=!1,E.isInConference=!1,E.currentconferenceSessions=[]}function x(e,n){switch(e){case"ringing":E.soundPlayer.muted=E.conf.ringingMute,E.conf.ringingId&&E.soundPlayer.setSinkId(E.conf.ringingId).then(function(){E.soundPlayer.volume=E.conf.ringingVolume}).then(function(){n&&S()}).catch(function(e){y.info(e.message,E.conf.ringingId)});break;case"speaker":E.remotePlayer.muted=E.conf.speakerMute,E.conf.speakerId&&E.remotePlayer.setSinkId(E.conf.speakerId).then(function(){E.remotePlayer.volume=E.conf.speakerVolume}).then(function(){n&&S()}).catch(function(e){y.info(e.message,E.conf.speakerId)});break;case"microphone":for(var t=0;t<E.sessions.length;t+=1)E.conf.microphoneMute?E.sessions[t].mute():E.sessions[t].unmute();jabra&&E.isJabraEnabled&&(E.conf.microphoneMute?jabra.mute():jabra.unmute()),n&&S();break;default:y.info("unknown device")}}function N(){E.target="",document.getElementById("ms-target").blur(),document.getElementById("ms-target").value="",p.$broadcast("angucomplete-alt:clearInput","ms-target-wrap")}function D(n){return h.user.getVoicePrefixes({id:E.conf.id}).$promise.then(function(e){if(e.count)return a.show({controller:"PrefixDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/prefix/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{prefixes:e,required:E.conf.phoneBarPrefixRequired}})}).then(function(e){if(E.conf.phoneBarPrefixRequired){if(e&&-1!==e)return e+n}else{if(e&&-1!==e)return e+n;if(!e)return n}})}function P(){if(E.isInConference){var e=E.sessions[0].connection.getReceivers()[0],n=E.sessions[1].connection.getReceivers()[0],t=new MediaStream;t.addTrack(e.track),t.addTrack(n.track);var a=document.getElementById("remote-audio");a.srcObject=t;var i=a.play();void 0!==i&&i.then(function(){}).catch(function(e){y.error(e)})}}function L(e,n,t,a){return y.debug("onReferCallback -> session, textContent, position, delay",e._request,n,t,a),function(){i.show(i.simple().textContent(n).position(t).hideDelay(a)),O(e)}}function k(n){return y.debug("findSessionBySessionId -> sessionId, vm_pb.sessions",n,E.sessions),_.find(E.sessions,function(e){return e.call_id==n})}function M(e,n){return y.debug("callCallback -> url, params",e,n),s({url:e,method:"GET",params:n})}E.currentUser=b.getCurrentUser(),E.direction="right",E.selectedMode="md-scale",E.target="",E.showDialpad=!1,E.soundPlayer=document.getElementById(E.conf.soundPlayerId),E.remotePlayer=document.getElementById(E.conf.remotePlayerId),E.soundPlayer.volume=1,E.sessionConf={mediaConstraints:{audio:!0,video:!1},pcConfig:{iceServers:[]}},E.sessions=[],E.calls=[],E.callbackQueue=[],E.canGoInConference=!1,E.isInConference=!1,E.currentConferenceSessions=[],E.ua=new JsSIP.UA({sockets:[new JsSIP.WebSocketInterface("wss://"+E.conf.host+":"+E.conf.wssPort+"/ws")],uri:new JsSIP.URI("sip",E.conf.name,E.conf.host,5060,null,null).toString(),authorization_user:E.conf.name,ha1:E.conf.ha1,realm:E.conf.realm,user_agent:E.conf.ua,session_timers_refresh_method:"invite",register_expires:E.conf.phoneBarExpires||60,register:!0}),E.conf=_.merge(c.webrtc,E.conf),E.initDeviceInProgress=!1,E.isJabraEnabled=!1,E.isJabraInitialized=!1,E.jabraSession=null,E.jabraClicked=!1,E.buttonClicked=!1,E.originateInProgress=!1,t.bind("keyup",function(e){switch(e.keyCode){case 27:g(function(){E.showDialpad=!1})}}),E.$onInit=function(){m(!1),navigator.mediaDevices.ondevicechange=function(){E.initDeviceInProgress||(E.initDeviceInProgress=!0,jabra&&E.isJabraInitialized?jabra.shutdown().then(function(){E.isJabraInitialized=!1,m(!(E.isJabraEnabled=!1))}).catch(function(e){y.error("Unable to shutdown Jabra library",e)}):m(!0))};var e=[h.network.get({type:"turn",nolimit:!0}).$promise,h.network.get({type:"stun",nolimit:!0}).$promise];o.all(e).then(function(e){var n=e[0].rows,t=e[1].rows,a=[],i=[];t.forEach(function(e){i.push("stun:"+e.value)}),a.push({urls:i}),n.forEach(function(e){var n={urls:"turn:"+e.value};e.username&&(n.username=e.username),e.password&&(n.credential=e.password),a.push(n)}),E.sessionConf.pcConfig={iceServers:a}}),this.ua.on("registered",function(){this.registered=!0}.bind(this)),this.ua.on("unregistered",function(){this.registered=!1}.bind(this)),this.ua.on("newRTCSession",function(e){y.debug("onNewRTCSession -> data",e);var n,t,a,i,s,o=e.session,r=!0,l="",d=0;switch(e.originator){case"local":o.outgoing=!0,o.name=e.request.ruri.user,o.user=e.request.ruri.user,T(o.user,!1),t=e.request.extraHeaders,a="X-callback-url",s=_.find(t,function(e){return _.startsWith(e,a)}),n=!!s&&_.trim(s.replace(a,"").replace(i||":","")),E.isJabraEnabled&&(E.jabraSession&&jabra.resume(),E.jabraSession=o,jabra.offHook());break;case"remote":var c=b.getCurrentUser();c.voicePause&&c.phoneBarDnd&&(r=!1);var m=e.request.getHeader("Call-Type")||"";if(c.ignorePauseForPreviewCalls&&"PREVIEW"===m&&(r=!0),E.originateInProgress&&(r=!1),r&&(o.incoming=!0,o.name=e.request.from.display_name,o.user=e.request.from.uri.user,l=e.request.getHeader("X-Answer-Mode")||"",d=e.request.getHeader("X-Answer-After")||0,function(n){y.debug("getNotification -> session",n._request);var e=n.name?n.name+" <"+n.user+">":n.user;E.currentUser.privacyEnabled&&(e=A.mask(e)),f.create("Incoming call from: ",e,null,function(){I(n)},function(){O(n)},E.conf.autoAnswer).then(function(e){n.notification=e}).catch(function(e){y.error("Error creating notification for incoming call",e)})}(e.session),T(e.session.user,!0),E.isJabraEnabled&&jabra.ring(),E.conf.autoAnswer&&g(function(){o.isInProgress()&&(o.autoAnswer=!0,I(o))},E.conf.autoAnswerDelay?1e3*E.conf.autoAnswerDelay:0),y.debug("xAnswerMode",l),y.debug("xAnswerAfterSec",d),"auto"==l.toLowerCase())){var u=0==d?500:1e3*d;y.debug("auto answer enabled after:"+u+" ms"),g(function(){o.isInProgress()&&(o.autoAnswer=!0,I(o))},u)}}r?(o.call_id=e.request.call_id,n&&M(E.callbackQueue[o.call_id]=n,{call_id:o.call_id}).then(function(){y.info('callbackurl:"'+n+'" called successfully')}).catch(function(e){y.error('fail callbackurl:"'+n+'" err:',e)}),o.connection&&(o.connection.onaddstream=w.bind(this)),o.iceCandidateTimeout=null,o.on("progress",function(e,n){y.debug("onProgress -> session, data",e._request,n),y.error("onProgress -> session, data",e._request,n);var t=!1;switch(n.originator){case"local":this.conf.ringingMute||(this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/incoming-call.ogg"),t=!0);break;case"remote":this.putOtherCallsOnHold(e),this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/outgoing-call.ogg"),t=!0}E.originateInProgress&&(E.originateInProgress=!1),t&&(this.soundPlayer.loop="loop",this.soundPlayer.play().catch(function(e){y.error(e.message)})),C(e).then(function(){var n=E.callbackQueue[e.call_id];n&&M(n,{uniqueid:e.uniqueid,call_id:e.call_id,number_called:e.user}).then(function(){y.info('callbackurl:"'+n+'" called successfully')}).catch(function(e){y.error('fail callbackurl:"'+n+'" err:',e)}).finally(function(){delete E.callbackQueue[e.call_id]})}).catch(function(e){y.error("Unable to retrieve voice channels",e)})}.bind(this,o)),o.on("confirmed",function(e,n){y.debug("onConfirmed -> session, data",e._request,n);var t=document.getElementById("div_session_"+e.id.substr(0,32));t&&$(t).scope().$broadcast("timer-start"),e.confirmed=!0,"remote"===n.originator&&e.connection&&(e.connection.onaddstream=w.bind(this),_.head(e.connection.getRemoteStreams())&&(this.remotePlayer.srcObject=_.head(e.connection.getRemoteStreams()),this.remotePlayer.play())),this.soundPlayer.pause(),this.soundPlayer.loop=null,this.putOtherCallsOnHold(e),e.autoAnswer&&(this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/beep.ogg"),this.soundPlayer.play().catch(function(e){y.error("Unable to play autoAnswer notification",e)})),E.canGoInConference=2==E.sessions.length,C(e).catch(function(e){y.error("Unable to retrieve voice channels",e)})}.bind(this,o)),o.on("hold",function(e,n){y.debug("onHold -> session, data",e._request,n),"local"===n.originator&&(e.localHold=!0)}.bind(this,o)),o.on("unhold",function(e,n){y.debug("onUnhold -> session, data",e._request,n),"local"===n.originator&&(e.localHold=!1)}.bind(this,o)),o.on("ended",function(e,n){if(y.debug("onEnded -> session, data",e._request,n),E.isInConference&&_.includes(E.currentConferenceSessions,e.id)&&(R(),E.buttonClicked=!0),_.remove(this.sessions,{id:e.id}),2!==E.sessions.length&&(E.canGoInConference=!1),E.isJabraEnabled)if(0===E.sessions.length)e.localHold&&jabra.resume(),jabra.onHook(),E.jabraSession=null;else{var t=_.last(E.sessions);t.localHold?(jabra.onHook(),jabra.hold(),E.jabraSession=t):jabra.offHook()}0===E.sessions.length&&E.currentUser.voicePause&&h.user.pause({id:E.currentUser.id,type:_.startsWith(E.currentUser.pauseType,"#")?E.currentUser.pauseType.substring(1):E.currentUser.pauseType}).$promise.catch(function(e){v.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:PAUSEUSER",msg:e.status?JSON.stringify(e.data):e.toString()})}),E.conf.microphoneMute=!1,E.initDevice("microphone",!0)}.bind(this,o)),o.on("failed",function(e,n){if(y.debug("onFailed -> session, data",e._request,n),this.soundPlayer.pause(),this.soundPlayer.loop=null,e.notification&&e.notification.close(),E.isInConference&&_.includes(E.currentConferenceSessions,e.id)&&R(),E.originateInProgress&&(E.originateInProgress=!1),_.remove(this.sessions,{id:e.id}),2!==E.sessions.length&&(E.canGoInConference=!1),E.isJabraEnabled)if(0===E.sessions.length)e.localHold&&jabra.resume(),jabra.onHook(),E.jabraSession=null;else{var t=_.last(E.sessions);t.localHold?(jabra.onHook(),jabra.hold(),E.jabraSession=t):jabra.offHook()}}.bind(this,o)),o.on("icecandidate",function(e,n){y.debug("onIcecandidate -> session, data",e._request,n),null!==e.iceCandidateTimeout&&clearTimeout(e.iceCandidateTimeout),e.iceCandidateTimeout=setTimeout(n.ready,1e3)}.bind(this,o)),E.sessions.push(o),g(function(){p.$apply(),y.debug("onNewRTCSession -> vm_pb.sessions",E.sessions)})):O(o,486)}.bind(this)),r.on("webbar:originate",function(e){y.debug("originateHook -> payload",e);var n=e.callNumber,t=e.callerId,a=e.callbackUrl;E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0;var i=n.replace(/ /g,"");if(i=(i=i.replace(/\(/g,"")).replace(/\)/g,"")){var s=angular.copy(E.sessionConf);s.extraHeaders=[],t&&s.extraHeaders.push("X-CID: "+t),a&&s.extraHeaders.push("X-callback-url: "+a),E.originateInProgress=!0,E.ua.call(i,s)}}.bind(this)),r.on("webbar:hangup",function(e){y.debug("hangupHook -> payload",e);var n=E.sessions;if(e.sessionId&&((n=[]).push(k(e.sessionId)),0==n.length))y.warn("call with session Id "+e.sessionId+" not found");else for(var t=0;t<n.length;t++){var a=n[t];y.info("hangupHook -> sessionToHangup",a),E.terminate(a)}}.bind(this)),r.on("webbar:answer",function(e){var n;y.debug("answerHook -> payload",e),n=e.sessionId?k(e.sessionId):_.find(E.sessions,function(e){return e.incoming&&!e.confirmed}),e.sessionId&&!n&&y.warn("call with session Id "+e.sessionId+" not found"),n&&E.answer(n)}.bind(this)),r.on("webbar:hold",function(e){y.debug("holdHook -> payload",e);var n=E.sessions;if(e.sessionId&&((n=[]).push(k(e.sessionId)),0==n.length))y.warn("call with session Id "+e.sessionId+" not found");else for(var t=0;t<n.length;t++){var a=n[t];E.hold(a)}}.bind(this)),r.on("webbar:unhold",function(e){y.debug("unholdHook -> payload",e);var n=E.sessions;if(e.sessionId&&((n=[]).push(k(e.sessionId)),0==n.length))y.warn("call with session Id "+e.sessionId+" not found");else for(var t=0;t<n.length;t++){var a=n[t];E.unhold(a)}}.bind(this)),r.on("webbar:transfer",function(e){if(y.debug("transferHook -> payload",e),e.sessionId)if(e.transferNumber){var n=k(e.sessionId);n?n.refer(e.transferNumber,{eventHandlers:{requestSucceeded:L(n,"requestSucceeded","top right",3e3),requestFailed:L(n,"requestFailed","top right",3e3)}}):y.warn("call with session Id "+e.sessionId+" not found")}else y.error("transferNumber required");else y.error("sessionId required")}.bind(this)),r.on("webbar:stopmonitors",function(e){if(e.agentId===E.currentUser.id){var n=_.find(E.sessions,["uniqueid",e.uniqueid]);if(!n)return;n.monitors.forEach(function(e){e.status="pause"}),n.monitor=!1}}.bind(this))}.bind(this),E.type=function(e,n){var t=e;switch(E.target||(E.target=""),n&&(E.target+=e,p.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",E.target)),e){case"*":t="asterisk";break;case"#":t="pound"}E.conf.enableDtmfTone&&(E.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/dialpad/"+t+".ogg"),E.soundPlayer.play().catch(function(e){y.error(e.message)}));for(var a=0;a<E.sessions.length;a+=1)E.sessions[a].isEstablished()&&!E.sessions[a].isOnHold().local&&E.sessions[a].sendDTMF(e)},E.call=function(){if(E.target&&E.target!==E.conf.name&&E.target!==E.conf.internal){E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0;var e=E.target.replace(/ /g,"");return D(e=(e=e.replace(/\(/g,"")).replace(/\)/g,"")).then(function(e){e&&E.ua.call(e,E.sessionConf)}).then(function(){N()})}},E.hold=function(e){y.debug("hold -> session",e._request),e.hold({useUpdate:!1}),E.isJabraEnabled&&(jabra.hold(),jabra.onHook())},E.refer=function(n){y.debug("refer -> session",n._request);var e=a.prompt().title("Transfer").textContent("Type the target").placeholder("Target").ariaLabel("Target").ok("Transfer").cancel("Cancel");a.show(e).then(function(e){return D(e.replace(/ /g,"").replace(/\(/g,"").replace(/\)/g,""))}).then(function(e){n.refer(e,{eventHandlers:{requestSucceeded:L(n,"requestSucceeded","top right",3e3),requestFailed:L(n,"requestFailed","top right",3e3)}})})},E.record=function(e){y.debug("record -> session",e._request),a.show({controller:"RecordDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/record/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{session:e,sessions:E.sessions}})},E.unhold=function(e){y.debug("unhold -> session",e._request),e.unhold({useUpdate:!1}),E.putOtherCallsOnHold(e),E.isJabraEnabled&&(jabra.offHook(),jabra.resume())},E.answer=I,E.terminate=O,E.selectSession=function(e){y.debug("selectSession -> session",e._request),E.unhold(e)},E.typeWrapper=function(e){switch(e.key.toLowerCase()){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"*":case"#":E.type(e.key);break;case"enter":E.call()}},E.toggleDialpad=function(){E.showDialpad=!E.showDialpad},E.referAttended=function(e){y.debug("referAttended -> session",e._request),a.show({controller:"ReferAttendedDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/referAttended/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{session:e,sessions:_.reject(E.sessions,{id:e.id}),isJabraEnabled:E.isJabraEnabled}})},E.closeDialpad=function(){E.showDialpad=!1},E.initDevice=x,E.putOtherCallsOnHold=function(e){if(y.debug("putOtherCallsOnHold -> session",e._request),1<E.sessions.length)for(var n=0;n<E.sessions.length;n+=1)E.sessions[n].id===e.id||E.sessions[n].isOnHold().remote||E.sessions[n].hold({useUpdate:!1})},E.targetChanged=function(e){e?/^(\w|\.|\+|#|\*|\(|\)|\s|-)*$/.test(e)?(E.target=e,p.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",E.target)):E.target?p.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",E.target):N():N()},E.targetSelected=function(e){e&&(E.target=e.originalObject.target,E.call(),N())},E.start3WayConf=function(){E.isInConference=!0,E.canGoInConference=!1,E.currentConferenceSessions.push(E.sessions[0].id),E.currentConferenceSessions.push(E.sessions[1].id);var e=new AudioContext,n=E.sessions[0].connection.getSenders()[0],t=E.sessions[0].connection.getReceivers()[0];t.track.addEventListener("unmute",function(){setTimeout(function(){P()},1e3)},!1);var a=E.sessions[1].connection.getSenders()[0],i=E.sessions[1].connection.getReceivers()[0];i.track.addEventListener("unmute",function(){setTimeout(function(){P()},1e3)},!1),E.sessions[0].unhold({useUpdate:!1}),E.sessions[1].unhold({useUpdate:!1}),t.track.enabled=!0,i.track.enabled=!0;var s=new MediaStream,o=e.createMediaStreamDestination();o=(e=new AudioContext).createMediaStreamDestination();var r=e.createMediaStreamSource(new MediaStream([i.track]));r.connect(o),(r=e.createMediaStreamSource(new MediaStream([n.track]))).connect(o),n.replaceTrack(o.stream.getTracks()[0]).then(function(){}),o=e.createMediaStreamDestination(),(r=e.createMediaStreamSource(new MediaStream([t.track]))).connect(o),(r=e.createMediaStreamSource(new MediaStream([a.track]))).connect(o),a.replaceTrack(o.stream.getTracks()[0]).then(function(){s.addTrack(t.track),s.addTrack(i.track);var e=document.getElementById("remote-audio");e.srcObject=s;var n=e.play();void 0!==n&&n.then(function(){}).catch(function(e){y.error(e)})})},E.patchConference=P,p.$on("webrtc::settings",function(e){a.show({controller:"SettingsController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/settings/settings.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{devices:function(){return navigator.mediaDevices.enumerateDevices()}},locals:{conf:E.conf,activeSessions:E.sessions}}).then(function(e){e&&(E.conf=e,E.initDeviceInProgress||(E.initDeviceInProgress=!0,jabra&&E.isJabraInitialized?jabra.shutdown().then(function(){E.isJabraInitialized=!1,m(E.isJabraEnabled=!1)}).catch(function(e){y.error("Unable to shutdown Jabra library",e)}):m(!1)))})}),p.$on("webrtc::logout",function(){E.ua.stop(),jabra&&E.isJabraInitialized&&jabra.shutdown(),navigator.mediaDevices.ondevicechange=function(){}}),p.$on("webrtc::call",function(e,n){y.debug("onRemoteCall -> evt, data",e,n),n.target&&(E.target=n.target,E.call())}),p.$on("webrtc::transfer",function(e,n){if(y.debug("onRemoteTransfer -> evt, data",e,n),n.target)for(var t=0;t<E.sessions.length;t+=1)if(E.sessions[t].isEstablished()&&!E.sessions[t].isOnHold().local)return D(n.target).then(function(e){e&&E.sessions[t].refer(e,{eventHandlers:{requestSucceeded:L(E.sessions[t],"requestSucceeded","top right",3e3),requestFailed:L(E.sessions[t],"requestFailed","top right",3e3)}})})}),p.$on("$destroy",function(){y.debug("$destroy event fired"),r.removeAllListeners("webbar:originate"),r.removeAllListeners("webbar:hangup"),r.removeAllListeners("webbar:answer"),r.removeAllListeners("webbar:hold"),r.removeAllListeners("webbar:unhold"),r.removeAllListeners("webbar:transfer"),r.removeAllListeners("webbar:stopmonitors")})}e.$inject=["$scope","$document","$timeout","$interval","$mdDialog","$mdToast","$window","$translate","$http","$q","toasty","api","motNotification","Auth","socket","privacyManager","ClientSideLoggingService"],angular.module("app.core").controller("MsPhonebarController",e).directive("msPhonebar",function(){return{restrict:"E",scope:{conf:"=",sessions:"="},require:"msPhonebar",controller:"MsPhonebarController",controllerAs:"vm_pb",bindToController:!0,templateUrl:"assets/ms-phonebar/ms-phonebar.html"}})}(),function(){"use strict";function e(n,e,t){var a=this;a.prefixes=e,a.required=t,a.closeDialog=function(e){n.hide(e)},a.keyPress=function(e){13===e.keyCode&&this.call()},a.call=function(){n.hide(a.prefix)}}e.$inject=["$mdDialog","prefixes","required"],angular.module("app.core").controller("PrefixDialogController",e)}(),function(){"use strict";function e(i){return{restrict:"C",controller:["$scope","$element",function(e,n){function t(){n.css("display","inline"),i(a,1e3)}function a(){n.css("display","none"),i(t,1e3)}t()}],replace:!0}}function n(n,i,s,e,t){var o=this;function a(n,e){console.log("startMonitor");var t=i.defer(),a=(e||n.filename.replace(/^.*[\\\/]/,"")).split(".")[0];return s.rpc.startMonitor({uniqueid:o.session.uniqueid,filename:a,format:"wav"}).$promise.then(function(e){n.filename=a+".wav",n.mixmonitorid=e.mixmonitorid,n.status="rec",o.session.monitor=!0,t.resolve(n)}).catch(function(e){t.reject(e)}),t.promise}o.title="Record",o.sessions=e,o.session=t,o.closeDialog=function(){n.hide()},o.addRecording=function(){var e=n.prompt({skipHide:!0}).title("Start new recording").textContent("Type the file name.").placeholder("File name").ariaLabel("File name").initialValue(function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}()).ok("Start").cancel("Cancel");n.show(e).then(function(e){return a({},e)}).then(function(e){o.session.monitors.push(e)})},o.stop=function(n){return console.log("stopMonitor"),s.rpc.stopMonitor({uniqueid:o.session.uniqueid,mixmonitorid:n.mixmonitorid}).$promise.then(function(e){n.status="pause",o.session.monitor=_.includes(o.session.monitors,{status:"rec"})}).catch(function(e){console.error(e)})},o.start=a}e.$inject=["$timeout"],n.$inject=["$mdDialog","$q","api","sessions","session"],angular.module("app.core").directive("msBlink",e).controller("RecordDialogController",n)}(),function(){"use strict";function e(n,s,a,i,e){var o=this;function r(e,n,t,a,i){return console.debug("onTransferCallback -> session, textContent, position, delay",e,n,t,a),function(){s.show(s.simple().textContent(n).position(t).hideDelay(a)),e.terminate(),jabra&&i&&jabra.onHook(),l()}}function l(e){n.hide(e)}o.title="Refer Attended",o.sessions=a,o.session=i,o.isJabraEnabled=e,o.sessionTarget=null,a.length&&(o.target=a[0].user),o.closeDialog=l,o.transfer=function(){var e,n,t=_.find(a,function(e){if(e.user===o.target)return e});n=t.outgoing?(e=t,o.session):(e=o.session,t);n.refer(e.user,{replaces:e,eventHandlers:{requestSucceeded:r(i,"requestSucceeded","top right",3e3,o.isJabraEnabled),requestFailed:r(i,"requestFailed","top right",3e3,o.isJabraEnabled)}})}}e.$inject=["$mdDialog","$mdToast","sessions","session","isJabraEnabled"],angular.module("app.core").controller("ReferAttendedDialogController",e)}(),function(){"use strict";function e(e,s,n,t){var a=this;function i(e,n,t){var a;if(s[t]){if(a=_.find(e,function(e){return e.deviceId===s[t]}))return a.deviceId;var i=_.findIndex(e,function(e){return e.kind===n});if(0<=i)return e[i].deviceId}else(a=_.find(e,function(e){return e.kind===n}))&&(s[t]=a.deviceId);return s[t]||null}_.remove(n,function(e){return"audioinput"===e.kind&&("default"===e.deviceId||"communications"===e.deviceId)||"audiooutput"===e.kind&&("default"===e.deviceId||"communications"===e.deviceId)}),s.ringingId=i(n,"audiooutput","ringingId"),s.speakerId=i(n,"audiooutput","speakerId"),s.microphoneId=i(n,"audioinput","microphoneId"),s.ringingVolume=s.ringingVolume||.5,s.speakerVolume=s.speakerVolume||.5,s.microphoneVolume=s.microphoneVolume||1,s.ringingMute=s.ringingMute||!1,s.speakerMute=s.speakerMute||!1,s.microphoneMute=s.microphoneMute||!1,a.conf=angular.copy(s),a.devices=n,a.activeSessions=t,a.saveSettings=function(){e.hide(a.conf)},a.closeDialog=function(){e.hide()},a.isCompatibleBrowser=function(){return"chrome"===a.conf.browserName.toLowerCase()||"opera"===a.conf.browserName.toLowerCase()||"safari"===a.conf.browserName.toLowerCase()}}e.$inject=["$mdDialog","conf","devices","activeSessions"],angular.module("app.toolbar").controller("SettingsController",e)}(),function(){"use strict";function e(e,t,a){var i=this;function s(e,n,t){r(e).then(function(){n&&!1!==t&&i.search()})}function o(e){var n=e.key;i.pickerModels[n].dateStart?!0===e.useFromToKeys?i.query[n]={from:moment(i.pickerModels[n].dateStart).utcOffset(0,!0).format(),to:moment(i.pickerModels[n].dateEnd).utcOffset(0,!0).add(23,"hours").add(59,"minutes").add(59,"seconds").format()}:i.query[n]={$gte:moment(i.pickerModels[n].dateStart).utcOffset(0,!0).format(),$lte:moment(i.pickerModels[n].dateEnd).utcOffset(0,!0).add(23,"hours").add(59,"minutes").add(59,"seconds").format()}:i.query[n]=void 0,i.search()}function r(e){var n=e.key,t={param:i.query[n],resources:e.options,placeholder:e.placeholder,ngValue:e.ngValue};return a.setPlaceholder(t).then(function(e){i.placeholders[n]=e})}i.pickerModels={},i.placeholders={},i.localizationMap=t.localizationMap,i.onMultiselectInit=function(e){r(e)},i.onDateRangeInit=function(e){var n=e.key;i.query[n]?i.pickerModels[n]=t.setSelectedDate(i.query[n]):i.pickerModels[n]={dateStart:null}},i.onMultiselectSelection=s,i.onDateRangeSelection=o,i.clearDate=function(e){var n=e.key;i.pickerModels[n]={dateStart:null},delete i.query[n],i.search()},i.clearSelection=function(e){var n=e.key,t=e.ngValue||"id";i.query[n]=!1===e.clearAll?[_.head(e.options)[t]]:[],r(e).then(function(){i.search()})},i.selectAll=function(e){var n=e.key,t=e.ngValue||"id";i.query[n]=_.map(e.options,t),r(e).then(function(){i.search()})},e.$on("ms-quick-filter:update",function(e,t){t.filters.forEach(function(e){var n=_.find(i.filters,["name",e]);if(n)switch(n.type){case"date":o(n);break;case"multiselect":s(n,!0,t.update);break;case"select":i.search()}})})}e.$inject=["$scope","dateRangeManager","quickFilterManager"],angular.module("app.core").directive("msQuickFilter",function(){return{restrict:"E",scope:{query:"=",filters:"=",search:"&"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-quick-filter/ms-quick-filter.html"}})}(),function(){"use strict";angular.module("app.core").directive("msRandomClass",function(){return{restrict:"A",scope:{msRandomClass:"="},link:function(e,n){var t=e.msRandomClass[Math.floor(Math.random()*e.msRandomClass.length)];n.addClass(t)}}})}(),function(){"use strict";function e(i){return{restrict:"E",scope:{id:"=",model:"=",download:"="},replace:!0,link:function(n,e){var t=!1,a=document.createElement("audio");n.download||a.setAttribute("controlsList","nodownload"),a.setAttribute("preload","none"),a.setAttribute("controls",""),a.setAttribute("style","width: 265px;"),a.setAttribute("src"," "),a.onplay=function(e){t||(t=!0,e.preventDefault(),i[n.model||"voiceRecording"].download({id:n.id}).$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type});a.setAttribute("type",e.type),a.setAttribute("src",URL.createObjectURL(t)),a.play()}).catch(function(e){console.error(e)}))},e.append(a)}}}e.$inject=["api"],angular.module("app.core").directive("msRecording",e)}(),function(){"use strict";angular.module("app.core").directive("msResponsiveTable",function(){return{restrict:"A",link:function(e,n){var t=angular.element('<div class="ms-responsive-table-wrapper"></div>');n.after(t),t.append(n)}}})}(),function(){"use strict";function e(n,i,s,e){var o=this;function t(){angular.isArray(o.onSearch)?a(o.onSearch):o.onResultClick?(o.resultsLoading=!0,n.$parent.$eval("vm.search(query)",{query:o.query.filter}).then(function(e){a(e)}).catch(function(){a([])}).finally(function(){o.resultsLoading=!1})):o.onSearch()}function a(e){o.expanded&&(void 0===e||angular.isArray(e)||null===e)&&(o.selectedResultIndex=0,o.results=e)}function r(){o.expanded=!0,o.displayOn=!0,n.expand()}function l(e){!1!==e&&(o.query.filter=void 0,o.onResultClick?a(null):t()),o.expanded=!1,n.collapse()}function d(e){o.onResultClick&&o.onResultClick({item:e}),l()}function c(){var e=i.find(".ms-search-bar-results"),n=angular.element(e.find(".result")[o.selectedResultIndex]);if(e&&n){var t=n.position().top-8,a=n.position().top+n.outerHeight()+8;o.ignoreMouseEvents=!0,s.cancel(o.mouseEventIgnoreTimeout),o.mouseEventIgnoreTimeout=s(function(){o.ignoreMouseEvents=!1},250),e.scrollTop()>t&&e.scrollTop(t),a>e.height()+e.scrollTop()&&e.scrollTop(a-e.height())}}o.queryOptions={debounce:o.debounce||0},o.searchOnEnterKey=e.get().searchOnEnterKey||!1,o.resultsLoading=!1,o.results=null,o.selectedResultIndex=0,o.ignoreMouseEvents=!1,o.expandBar=r,o.collapseBar=l,o.blurCollapse=function(){if(!o.collapseOnBlur)return;l()},o.onKeyDown=function(e){var n=e.keyCode;-1<[27,38,40].indexOf(n)&&e.preventDefault();switch(n){case 13:if(!o.onResultClick)return t();if(!o.results)return;d(o.results[o.selectedResultIndex]);break;case 27:l();break;case 38:0<=o.selectedResultIndex-1&&(o.selectedResultIndex--,c());break;case 40:if(!o.results)return;o.selectedResultIndex+1<o.results.length&&(o.selectedResultIndex++,c())}},o.absorbEvent=function(e){e.preventDefault()},o.handleMouseenter=function(e){if(o.ignoreMouseEvents)return;o.selectedResultIndex=e},o.handleResultClick=d,n.$watch("vm.displayOn",function(e){angular.isUndefined(e)||(!0!==e||o.expanded?e||!1===o.expanded||l(!1):r())}),n.$watch("vm.query.filter",function(e,n){if(!angular.isUndefined(e)&&0!==e.length&&!angular.equals(e,n)&&!1!==o.displayOn){if(o.expanded){if(!0===o.searchOnEnterKey&&!o.onResultClick)return;if(o.minChars&&o.minChars>e.length)return}else r();t()}})}function n(a){return{restrict:"E",scope:{query:"=?",debounce:"=?",direction:"@",iconColor:"@",onSearch:"&",onResultClick:"&?",onExpand:"&?",onCollapse:"&?",collapseOnBlur:"<?",minChars:"<?",displayOn:"=?"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-search-bar/ms-search-bar.html",compile:function(e){return e.addClass("ms-search-bar"),{post:function(n,t){n.collapse=function(){if(t.removeClass("expanded"),"down"===n.vm.direction){t.removeClass("down");var e=t.closest("md-toolbar");e&&e.removeClass("h-128")}a.find("body").removeClass("ms-search-bar-expanded")},n.expand=function(){if(t.addClass("expanded"),"down"===n.vm.direction){t.addClass("down");var e=t.closest("md-toolbar");e&&e.addClass("h-128")}a.find("body").addClass("ms-search-bar-expanded")}}}}}}e.$inject=["$scope","$element","$timeout","settingsManager"],n.$inject=["$document"],angular.module("app.core").controller("MsSearchBarController",e).directive("msSearchBar",n)}(),function(){"use strict";function e(e,t,i,o,r,l){var d=this;d.query="",d.queryOptions={debounce:300},d.resultsLoading=!1,d.selectedResultIndex=0,d.ignoreMouseEvents=!1,d.mobileBarActive=!1,d.results=null,d.shortcuts=[],d.sortableOptions={ghostClass:"ghost",forceFallback:!0,fallbackClass:"dragging",onSort:function(){d.saveShortcuts()}},d.populateResults=function(){for(var e=[],n=l.getFlatNavigation(),t=r.defer(),a=0;a<n.length;a++)n[a].uisref&&e.push(n[a]);if(d.query){e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(d.query)))return!0});for(var i=0;i<e.length;i++){e[i].hasShortcut=!1;for(var s=0;s<d.shortcuts.length;s++)if(d.shortcuts[s]._id===e[i]._id){e[i].hasShortcut=!0;break}}}else 0<d.shortcuts.length&&(e=d.shortcuts);return d.selectedResultIndex=0,o(function(){t.resolve(e)},250),t.promise},d.loadShortcuts=function(){var e=r.defer(),n=angular.fromJson(t.get("motion.shortcuts"));angular.isUndefined(n)&&(n=[{title:"Agents",icon:"icon-account-multiple",state:"app.staff.agents",weight:5,children:[],uisref:"app.staff.agents",hasShortcut:!0},{title:"License",icon:"icon-cog",state:"app.settings.license",weight:10,children:[],uisref:"app.settings.license",hasShortcut:!0}],t.put("motion.shortcuts",angular.toJson(n)));return e.resolve(n),e.promise},d.saveShortcuts=function(){var e=r.defer();return t.put("motion.shortcuts",angular.toJson(d.shortcuts)),o(function(){e.resolve({success:!0})},250),e.promise},d.addShortcut=function(e){e.hasShortcut=!0,d.shortcuts.push(e),d.saveShortcuts()},d.removeShortcut=function(e){e.hasShortcut=!1;for(var n=0;n<d.shortcuts.length;n++)d.shortcuts[n]._id===e._id&&(d.shortcuts.splice(n,1),d.query||(0===d.shortcuts.length?d.results=null:n>=d.shortcuts.length&&(d.selectedResultIndex=d.shortcuts.length-1)));d.saveShortcuts()},d.handleResultClick=function(e){e.hasShortcut?d.removeShortcut(e):d.addShortcut(e)},d.absorbEvent=function(e){e.preventDefault()},d.handleKeydown=function(e){var n=e.keyCode;-1<[38,40].indexOf(n)&&e.preventDefault();switch(n){case 13:d.handleResultClick(d.results[d.selectedResultIndex]);break;case 38:0<=d.selectedResultIndex-1&&(d.selectedResultIndex--,d.ensureSelectedResultIsVisible());break;case 40:d.selectedResultIndex+1<d.results.length&&(d.selectedResultIndex++,d.ensureSelectedResultIsVisible())}},d.handleMouseenter=function(e){if(d.ignoreMouseEvents)return;d.selectedResultIndex=e},d.temporarilyIgnoreMouseEvents=function(){d.ignoreMouseEvents=!0,o.cancel(d.mouseEventIgnoreTimeout),d.mouseEventIgnoreTimeout=o(function(){d.ignoreMouseEvents=!1},250)},d.ensureSelectedResultIsVisible=function(){var e=i.find("#ms-shortcut-add-menu").find(".results"),n=angular.element(e.find(".result")[d.selectedResultIndex]);if(e&&n){var t=n.position().top-8,a=n.position().top+n.outerHeight()+8;d.temporarilyIgnoreMouseEvents(),e.scrollTop()>t&&e.scrollTop(t),a>e.height()+e.scrollTop()&&e.scrollTop(a-e.height())}},d.toggleMobileBar=function(){d.mobileBarActive=!d.mobileBarActive},d.loadShortcuts().then(function(e){d.shortcuts=e,0<d.shortcuts.length&&(d.results=e)}),e.$watch("MsShortcuts.query",function(e,n){angular.isUndefined(e)||angular.equals(e,n)||(d.resultsLoading=!0,d.populateResults().then(function(e){d.results=e},function(){d.results=[]}).finally(function(){d.resultsLoading=!1}))})}e.$inject=["$scope","$cookies","$document","$timeout","$q","msNavigationService"],angular.module("app.core").controller("MsShortcutsController",e).directive("msShortcuts",function(){return{restrict:"E",scope:{},require:"msShortcuts",controller:"MsShortcutsController as MsShortcuts",bindToController:{},templateUrl:"app/core/directives/ms-shortcuts/ms-shortcuts.html",compile:function(e){return e.addClass("ms-shortcuts"),function(e,n){}}}})}(),function(){"use strict";angular.module("app.core").directive("msSidenavHelper",function(){return{restrict:"A",require:"^mdSidenav",link:function(e,n,t,a){e.$watch(function(){return a.isOpen()&&!a.isLockedOpen()},function(e){angular.isUndefined(e)||(n.parent().toggleClass("full-height",e),angular.element("html").toggleClass("sidenav-open",e))})}}})}(),function(){"use strict";function e(a){return{restrict:"E",link:function(e,n){var t=e.$on("msSplashScreen::remove",function(){a.leave(n).then(function(){t(),e=n=null})})}}}e.$inject=["$animate"],angular.module("app.core").directive("msSplashScreen",e)}(),function(){"use strict";function e(e){var i=this;function n(){i.setCurrentStep(1)}function t(e){return o(e)?i.steps[e-1].scope.optionalStep:null}function a(e){return o(e)?!!i.steps[e-1].scope.hideStep:null}function s(e){return o(e)?!!t(e)||i.steps[e-1].form.$valid:null}function o(e){return!(angular.isUndefined(e)||e<1||e>i.steps.length)}i.mainForm=void 0,i.orientation="horizontal",i.steps=[],i.currentStep=void 0,i.currentStepNumber=1,i.setOrientation=function(e){i.orientation=e||"horizontal"},i.registerMainForm=function(e){i.mainForm=e},i.registerStep=function(e,n,t){var a={element:e,scope:n,form:t,stepNumber:n.step||i.steps.length+1,stepTitle:n.stepTitle,stepTitleTranslate:n.stepTitleTranslate};return i.steps.push(a),i.steps.sort(function(e,n){return e.stepNumber-n.stepNumber}),a},i.setupSteps=function(){i.setCurrentStep(i.currentStepNumber)},i.resetForm=function(){e(function(){for(var e=0;e<i.steps.length;e++)i.steps[e].form.$setPristine(),i.steps[e].form.$setUntouched();i.mainForm.$setPristine(),i.mainForm.$setUntouched(),n()})},i.setCurrentStep=function(e){if(!o(e))return;if(i.currentStepNumber=e,"horizontal"===i.orientation){for(var n=0;n<i.steps.length;n++)i.steps[n].element.hide();i.steps[i.currentStepNumber-1].element.show()}else if("vertical"===i.orientation){for(var t=0;t<i.steps.length;t++)i.steps[t].element.find(".ms-stepper-step-content").hide();i.steps[i.currentStepNumber-1].element.find(".ms-stepper-step-content").show()}},i.gotoStep=function(e){if(a(e))return;i.setCurrentStep(e)},i.gotoPreviousStep=function(){for(var e=i.currentStepNumber-1,n=e;1<=n;n--)if(!a(n)){e=n;break}i.setCurrentStep(e)},i.gotoNextStep=function(){for(var e=i.currentStepNumber+1,n=e;n<=i.steps.length;n++)if(!a(n)){e=n;break}i.setCurrentStep(e)},i.gotoFirstStep=n,i.gotoLastStep=function(){i.setCurrentStep(i.steps.length)},i.isFirstStep=function(){return 1===i.currentStepNumber},i.isLastStep=function(){return i.currentStepNumber===i.steps.length},i.isStepCurrent=function(e){return o(e)?i.currentStepNumber===e:null},i.isStepDisabled=function(e){if(!o(e))return null;for(var n=!1,t=1;t<e;t++)if(!s(t)){n=!0;break}return n},i.isStepOptional=t,i.isStepHidden=a,i.filterHiddenStep=function(e){return!a(e.stepNumber)},i.isStepValid=s,i.isStepNumberValid=o,i.isFormValid=function(){return i.mainForm.$valid}}function n(o){return{restrict:"A",scope:{},require:["form","msVerticalStepper"],priority:1001,controller:"MsStepperController as MsStepper",bindToController:{model:"=ngModel"},transclude:!0,templateUrl:"app/core/directives/ms-stepper/templates/vertical/vertical.html",compile:function(e){return e.addClass("ms-stepper"),function(e,n,t,a){var i=a[0],s=a[1];o(function(){s.setOrientation("vertical"),s.registerMainForm(i),s.setupSteps()})}}}}e.$inject=["$timeout"],n.$inject=["$timeout"],angular.module("app.core").controller("MsStepperController",e).directive("msHorizontalStepper",function(){return{restrict:"A",scope:{},require:["form","msHorizontalStepper"],priority:1001,controller:"MsStepperController as MsStepper",bindToController:{model:"=ngModel"},transclude:!0,templateUrl:"app/core/directives/ms-stepper/templates/horizontal/horizontal.html",compile:function(e){return e.addClass("ms-stepper"),function(e,n,t,a){var i=a[0],s=a[1];s.setOrientation("horizontal"),s.registerMainForm(i),s.setupSteps()}}}}).directive("msHorizontalStepperStep",function(){return{restrict:"E",require:["form","^msHorizontalStepper"],priority:1e3,scope:{step:"=?",stepTitle:"=?",stepTitleTranslate:"=?",optionalStep:"=?",hideStep:"=?"},compile:function(e){return e.addClass("ms-stepper-step"),function(e,n,t,a){var i=a[0],s=a[1];e.optionalStep=angular.isDefined(t.optionalStep),s.registerStep(n,e,i),n.hide()}}}}).directive("msVerticalStepper",n).directive("msVerticalStepperStep",function(){return{restrict:"E",require:["form","^msVerticalStepper"],priority:1e3,scope:{step:"=?",stepTitle:"=?",stepTitleTranslate:"=?",optionalStep:"=?",hideStep:"=?"},transclude:!0,templateUrl:"app/core/directives/ms-stepper/templates/vertical/step/vertical-step.html",compile:function(e){return e.addClass("ms-stepper-step"),function(e,n,t,a){var i=a[0],s=a[1];e.optionalStep=angular.isDefined(t.optionalStep),e.stepInfo=s.registerStep(n,e,i),e.MsStepper=s,n.find(".ms-stepper-step-content").hide()}}}})}(),function(){"use strict";function e(e){return{restrict:"E",scope:{},transclude:!0,controller:"MsTabScrollController",controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-tab-scroll/ms-tab-scroll.html",compile:function(e){return e.addClass("ms-tab-scroll"),function(e,n){}}}}e.$inject=["$document"],angular.module("app.core").controller("MsTabScrollController",function(){function n(){var e=document.getElementById("bar-container"),n=document.getElementById("tab-container");return n.scrollWidth>e.scrollWidth&&0==e.scrollLeft&&0==n.scrollLeft?"right":n.scrollWidth>e.scrollWidth&&n.scrollLeft>e.scrollLeft&&e.scrollWidth+n.scrollLeft>=n.scrollWidth?"left":n.scrollWidth>e.scrollWidth&&n.scrollLeft>e.scrollLeft&&e.scrollWidth+n.scrollLeft<n.scrollWidth?"both":"none"}this.onTabScroll=function(e){"left"==e?$("#tab-container").stop().animate({scrollLeft:"-=400"},1e3):$("#tab-container").stop().animate({scrollLeft:"+=400"},1e3)},this.canScroll=function(e){switch(n()){case"both":return!0;case"left":return"left"==e;case"right":return"right"==e;case"none":default:return!1}}}).directive("msTabScroll",e)}(),function(){"use strict";function e(m,u){return{scope:!0,require:"^msTimeline",compile:function(e){return e.addClass("ms-timeline-item").addClass("hidden"),function(e,t,n,a){var i=72,s=!1,o=!1,r=a.getScrollEl();!function(){t.find("ms-card")?e.$on("msCard::cardTemplateLoaded",function(e,n){var t=angular.element(n[0]);d(t).then(function(){m(function(){s=!0})})}):d(t).then(function(){m(function(){s=!0})});r.on("scroll",c),c()}();var l=e.$watch(function(){return s&&o},function(e,n){angular.equals(e,n)||e&&(t.removeClass("hidden").addClass("animate"),l())},!0);function d(e){var n=u.defer(),t=e.find("img");return 0<t.length?t.on("load",function(){n.resolve("Image is loaded")}):n.resolve("No images"),n.promise}function c(){r.scrollTop()+r.height()>t.position().top+i&&(m(function(){o=!0}),r.off("scroll",c))}}}}}e.$inject=["$timeout","$q"],angular.module("app.core").controller("MsTimelineController",function(){var n=this;n.scrollEl=void 0,n.setScrollEl=function(e){n.scrollEl=e},n.getScrollEl=function(){return n.scrollEl}}).directive("msTimeline",function(){return{scope:{msTimeline:"=?",loadMore:"&?msTimelineLoadMore"},controller:"MsTimelineController",compile:function(e){return e.addClass("ms-timeline"),function(e,n,t,a){var i=angular.element('<div class="ms-timeline-loader md-accent-bg md-whiteframe-4dp"><span class="spinner"></span></div>');n.append(i);var s={scrollEl:"#content"};s=angular.extend(s,e.msTimeline,{});var o=angular.element(s.scrollEl);a.setScrollEl(o);var r=144;function l(){o.scrollTop()+o.height()+r>i.position().top&&(i.addClass("show"),c(),e.loadMore&&e.loadMore().then(function(){i.removeClass("show"),d()},function(){i.remove()}))}function d(){o.on("scroll",l)}function c(){o.off("scroll",l)}d(),e.$on("$destroy",function(){c()})}}}}).directive("msTimelineItem",e)}(),function(){"use strict";function e(e,n,t,a,i){var r=this;function s(){!function(){r.millis=l().diff(moment(r.startingTime));var e=moment.duration(r.millis),n=e.seconds(),t=e.minutes(),a=e.hours(),i=e.days(),s=e.months(),o=e.years();r.seconds=n<10?"0"+n:n,r.minutes=t<10?"0"+t:t,r.hours=a<10?"0"+a:a,r.days=i<10?"0"+i:i,r.months=s<10?"0"+s:s,r.years=o<10?"0"+o:o,r.timer=0<r.days?r.days+"d ":r.hours+":"+r.minutes+":"+r.seconds}(),r.timeoutId=setTimeout(function(){s(),e.$digest()},r.interval)}function l(e){var n=(e||moment()).utcOffset(r.utcOffset).format("YYYY-MM-DD HH:mm:ss");return moment(n)}function o(){t.resolve().then(function(){return null===r.utcOffset||void 0===r.utcOffset?i.getUTCOffset():r.utcOffset}).then(function(e){return r.utcOffset=e,l()}).catch(function(e){throw e}).then(function(e){var n=r.startTime?moment(r.startTime):void 0;r.startTime?n.isAfter(e,"hour")||n.isBefore(e,"hour")?r.startingTime=l(n):r.startingTime=n:r.startingTime=e,s()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.getDate",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}o(),e.$watch("vm.startTime",function(e,n){angular.isUndefined(e)||0!==e.length&&(angular.equals(e,n)||o())}),e.$on("timer-start",function(){r.startTime=void 0,o()}),n.bind("$destroy",function(){r.timeoutId&&clearTimeout(r.timeoutId)})}e.$inject=["$scope","$element","$q","toasty","settingsManager"],angular.module("app.core").directive("timer",function(){return{restrict:"EA",replace:!1,scope:{startTime:"=?",interval:"=?",utcOffset:"=?"},template:"<span ng-cloak>{{ vm.timer }}</span>",compile:function(){return{pre:function(e,n,t){e.interval=t.interval||1e3}}},controller:e,controllerAs:"vm",bindToController:!0}})}(),function(){"use strict";angular.module("app.core").directive("msTimezone",function(){return{restrict:"E",scope:{ngModel:"=",ngChange:"&"},controller:["$scope",function(e){e.timezone=[{name:"Europe/Andorra",utcOffset:60,offsetStr:"+01:00",countries:["AD"]},{name:"Asia/Dubai",utcOffset:240,offsetStr:"+04:00",countries:["AE","OM"]},{name:"Asia/Kabul",utcOffset:270,offsetStr:"+04:30",countries:["AF"]},{name:"Europe/Tirane",utcOffset:60,offsetStr:"+01:00",countries:["AL"]},{name:"Asia/Yerevan",utcOffset:240,offsetStr:"+04:00",countries:["AM"]},{name:"Antarctica/Rothera",utcOffset:-180,offsetStr:"-03:00",countries:["AQ"]},{name:"Antarctica/Palmer",utcOffset:-180,offsetStr:"-03:00",countries:["AQ"]},{name:"Antarctica/Mawson",utcOffset:300,offsetStr:"+05:00",countries:["AQ"]},{name:"Antarctica/Davis",utcOffset:420,offsetStr:"+07:00",countries:["AQ"]},{name:"Antarctica/Casey",utcOffset:480,offsetStr:"+08:00",countries:["AQ"]},{name:"Antarctica/Vostok",utcOffset:360,offsetStr:"+06:00",countries:["AQ"]},{name:"Antarctica/DumontDUrville",utcOffset:600,offsetStr:"+10:00",countries:["AQ"]},{name:"Antarctica/Syowa",utcOffset:180,offsetStr:"+03:00",countries:["AQ"]},{name:"Antarctica/Troll",utcOffset:0,offsetStr:"+00:00",countries:["AQ"]},{name:"America/Argentina/Buenos_Aires",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Cordoba",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Salta",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Jujuy",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Tucuman",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Catamarca",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/La_Rioja",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/San_Juan",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Mendoza",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/San_Luis",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Rio_Gallegos",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Ushuaia",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"Pacific/Pago_Pago",utcOffset:-660,offsetStr:"-11:00",countries:["AS","UM"]},{name:"Europe/Vienna",utcOffset:60,offsetStr:"+01:00",countries:["AT"]},{name:"Australia/Lord_Howe",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Antarctica/Macquarie",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Hobart",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Currie",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Melbourne",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Sydney",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Broken_Hill",utcOffset:630,offsetStr:"+10:30",countries:["AU"]},{name:"Australia/Brisbane",utcOffset:600,offsetStr:"+10:00",countries:["AU"]},{name:"Australia/Lindeman",utcOffset:600,offsetStr:"+10:00",countries:["AU"]},{name:"Australia/Adelaide",utcOffset:630,offsetStr:"+10:30",countries:["AU"]},{name:"Australia/Darwin",utcOffset:570,offsetStr:"+09:30",countries:["AU"]},{name:"Australia/Perth",utcOffset:480,offsetStr:"+08:00",countries:["AU"]},{name:"Australia/Eucla",utcOffset:525,offsetStr:"+08:45",countries:["AU"]},{name:"Asia/Baku",utcOffset:240,offsetStr:"+04:00",countries:["AZ"]},{name:"America/Barbados",utcOffset:-240,offsetStr:"-04:00",countries:["BB"]},{name:"Asia/Dhaka",utcOffset:360,offsetStr:"+06:00",countries:["BD"]},{name:"Europe/Brussels",utcOffset:60,offsetStr:"+01:00",countries:["BE"]},{name:"Europe/Sofia",utcOffset:120,offsetStr:"+02:00",countries:["BG"]},{name:"Atlantic/Bermuda",utcOffset:-240,offsetStr:"-04:00",countries:["BM"]},{name:"Asia/Brunei",utcOffset:480,offsetStr:"+08:00",countries:["BN"]},{name:"America/La_Paz",utcOffset:-240,offsetStr:"-04:00",countries:["BO"]},{name:"America/Noronha",utcOffset:-120,offsetStr:"-02:00",countries:["BR"]},{name:"America/Belem",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Fortaleza",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Recife",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Araguaina",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Maceio",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Bahia",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Sao_Paulo",utcOffset:-120,offsetStr:"-02:00",countries:["BR"]},{name:"America/Campo_Grande",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Cuiaba",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Santarem",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Porto_Velho",utcOffset:-240,offsetStr:"-04:00",countries:["BR"]},{name:"America/Boa_Vista",utcOffset:-240,offsetStr:"-04:00",countries:["BR"]},{name:"America/Manaus",utcOffset:-240,offsetStr:"-04:00",countries:["BR"]},{name:"America/Eirunepe",utcOffset:-300,offsetStr:"-05:00",countries:["BR"]},{name:"America/Rio_Branco",utcOffset:-300,offsetStr:"-05:00",countries:["BR"]},{name:"America/Nassau",utcOffset:-300,offsetStr:"-05:00",countries:["BS"]},{name:"Asia/Thimphu",utcOffset:360,offsetStr:"+06:00",countries:["BT"]},{name:"Europe/Minsk",utcOffset:180,offsetStr:"+03:00",countries:["BY"]},{name:"America/Belize",utcOffset:-360,offsetStr:"-06:00",countries:["BZ"]},{name:"America/St_Johns",utcOffset:-210,offsetStr:"-03:30",countries:["CA"]},{name:"America/Halifax",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Glace_Bay",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Moncton",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Goose_Bay",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Blanc-Sablon",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Toronto",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Nipigon",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Thunder_Bay",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Iqaluit",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Pangnirtung",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Resolute",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Atikokan",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Rankin_Inlet",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Winnipeg",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Rainy_River",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Regina",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Swift_Current",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Edmonton",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Cambridge_Bay",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Yellowknife",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Inuvik",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Creston",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Dawson_Creek",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Fort_Nelson",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Vancouver",utcOffset:-480,offsetStr:"-08:00",countries:["CA"]},{name:"America/Whitehorse",utcOffset:-480,offsetStr:"-08:00",countries:["CA"]},{name:"America/Dawson",utcOffset:-480,offsetStr:"-08:00",countries:["CA"]},{name:"Indian/Cocos",utcOffset:390,offsetStr:"+06:30",countries:["CC"]},{name:"Europe/Zurich",utcOffset:60,offsetStr:"+01:00",countries:["CH","DE","LI"]},{name:"Africa/Abidjan",utcOffset:0,offsetStr:"+00:00",countries:["CI","BF","GM","GN","ML","MR","SH","SL","SN","ST","TG"]},{name:"Pacific/Rarotonga",utcOffset:-600,offsetStr:"-10:00",countries:["CK"]},{name:"America/Santiago",utcOffset:-180,offsetStr:"-03:00",countries:["CL"]},{name:"Pacific/Easter",utcOffset:-300,offsetStr:"-05:00",countries:["CL"]},{name:"Asia/Shanghai",utcOffset:480,offsetStr:"+08:00",countries:["CN"]},{name:"Asia/Urumqi",utcOffset:360,offsetStr:"+06:00",countries:["CN"]},{name:"America/Bogota",utcOffset:-300,offsetStr:"-05:00",countries:["CO"]},{name:"America/Costa_Rica",utcOffset:-360,offsetStr:"-06:00",countries:["CR"]},{name:"America/Havana",utcOffset:-300,offsetStr:"-05:00",countries:["CU"]},{name:"Atlantic/Cape_Verde",utcOffset:-60,offsetStr:"-01:00",countries:["CV"]},{name:"America/Curacao",utcOffset:-240,offsetStr:"-04:00",countries:["CW","AW","BQ","SX"]},{name:"Indian/Christmas",utcOffset:420,offsetStr:"+07:00",countries:["CX"]},{name:"Asia/Nicosia",utcOffset:120,offsetStr:"+02:00",countries:["CY"]},{name:"Europe/Prague",utcOffset:60,offsetStr:"+01:00",countries:["CZ","SK"]},{name:"Europe/Berlin",utcOffset:60,offsetStr:"+01:00",countries:["DE"]},{name:"Europe/Copenhagen",utcOffset:60,offsetStr:"+01:00",countries:["DK"]},{name:"America/Santo_Domingo",utcOffset:-240,offsetStr:"-04:00",countries:["DO"]},{name:"Africa/Algiers",utcOffset:60,offsetStr:"+01:00",countries:["DZ"]},{name:"America/Guayaquil",utcOffset:-300,offsetStr:"-05:00",countries:["EC"]},{name:"Pacific/Galapagos",utcOffset:-360,offsetStr:"-06:00",countries:["EC"]},{name:"Europe/Tallinn",utcOffset:120,offsetStr:"+02:00",countries:["EE"]},{name:"Africa/Cairo",utcOffset:120,offsetStr:"+02:00",countries:["EG"]},{name:"Africa/El_Aaiun",utcOffset:0,offsetStr:"+00:00",countries:["EH"]},{name:"Europe/Madrid",utcOffset:60,offsetStr:"+01:00",countries:["ES"]},{name:"Africa/Ceuta",utcOffset:60,offsetStr:"+01:00",countries:["ES"]},{name:"Atlantic/Canary",utcOffset:0,offsetStr:"+00:00",countries:["ES"]},{name:"Europe/Helsinki",utcOffset:120,offsetStr:"+02:00",countries:["FI","AX"]},{name:"Pacific/Fiji",utcOffset:720,offsetStr:"+12:00",countries:["FJ"]},{name:"Atlantic/Stanley",utcOffset:-180,offsetStr:"-03:00",countries:["FK"]},{name:"Pacific/Chuuk",utcOffset:600,offsetStr:"+10:00",countries:["FM"]},{name:"Pacific/Pohnpei",utcOffset:660,offsetStr:"+11:00",countries:["FM"]},{name:"Pacific/Kosrae",utcOffset:660,offsetStr:"+11:00",countries:["FM"]},{name:"Atlantic/Faroe",utcOffset:0,offsetStr:"+00:00",countries:["FO"]},{name:"Europe/Paris",utcOffset:60,offsetStr:"+01:00",countries:["FR"]},{name:"Europe/London",utcOffset:0,offsetStr:"+00:00",countries:["GB","GG","IM","JE"]},{name:"Asia/Tbilisi",utcOffset:240,offsetStr:"+04:00",countries:["GE"]},{name:"America/Cayenne",utcOffset:-180,offsetStr:"-03:00",countries:["GF"]},{name:"Africa/Accra",utcOffset:0,offsetStr:"+00:00",countries:["GH"]},{name:"Europe/Gibraltar",utcOffset:60,offsetStr:"+01:00",countries:["GI"]},{name:"America/Godthab",utcOffset:-180,offsetStr:"-03:00",countries:["GL"]},{name:"America/Danmarkshavn",utcOffset:0,offsetStr:"+00:00",countries:["GL"]},{name:"America/Scoresbysund",utcOffset:-60,offsetStr:"-01:00",countries:["GL"]},{name:"America/Thule",utcOffset:-240,offsetStr:"-04:00",countries:["GL"]},{name:"Europe/Athens",utcOffset:120,offsetStr:"+02:00",countries:["GR"]},{name:"Atlantic/South_Georgia",utcOffset:-120,offsetStr:"-02:00",countries:["GS"]},{name:"America/Guatemala",utcOffset:-360,offsetStr:"-06:00",countries:["GT"]},{name:"Pacific/Guam",utcOffset:600,offsetStr:"+10:00",countries:["GU","MP"]},{name:"Africa/Bissau",utcOffset:0,offsetStr:"+00:00",countries:["GW"]},{name:"America/Guyana",utcOffset:-240,offsetStr:"-04:00",countries:["GY"]},{name:"Asia/Hong_Kong",utcOffset:480,offsetStr:"+08:00",countries:["HK"]},{name:"America/Tegucigalpa",utcOffset:-360,offsetStr:"-06:00",countries:["HN"]},{name:"America/Port-au-Prince",utcOffset:-300,offsetStr:"-05:00",countries:["HT"]},{name:"Europe/Budapest",utcOffset:60,offsetStr:"+01:00",countries:["HU"]},{name:"Asia/Jakarta",utcOffset:420,offsetStr:"+07:00",countries:["ID"]},{name:"Asia/Pontianak",utcOffset:420,offsetStr:"+07:00",countries:["ID"]},{name:"Asia/Makassar",utcOffset:480,offsetStr:"+08:00",countries:["ID"]},{name:"Asia/Jayapura",utcOffset:540,offsetStr:"+09:00",countries:["ID"]},{name:"Europe/Dublin",utcOffset:0,offsetStr:"+00:00",countries:["IE"]},{name:"Asia/Jerusalem",utcOffset:120,offsetStr:"+02:00",countries:["IL"]},{name:"Asia/Kolkata",utcOffset:330,offsetStr:"+05:30",countries:["IN"]},{name:"Indian/Chagos",utcOffset:360,offsetStr:"+06:00",countries:["IO"]},{name:"Asia/Baghdad",utcOffset:180,offsetStr:"+03:00",countries:["IQ"]},{name:"Asia/Tehran",utcOffset:210,offsetStr:"+03:30",countries:["IR"]},{name:"Atlantic/Reykjavik",utcOffset:0,offsetStr:"+00:00",countries:["IS"]},{name:"Europe/Rome",utcOffset:60,offsetStr:"+01:00",countries:["IT","SM","VA"]},{name:"America/Jamaica",utcOffset:-300,offsetStr:"-05:00",countries:["JM"]},{name:"Asia/Amman",utcOffset:120,offsetStr:"+02:00",countries:["JO"]},{name:"Asia/Tokyo",utcOffset:540,offsetStr:"+09:00",countries:["JP"]},{name:"Africa/Nairobi",utcOffset:180,offsetStr:"+03:00",countries:["KE","DJ","ER","ET","KM","MG","SO","TZ","UG","YT"]},{name:"Asia/Bishkek",utcOffset:360,offsetStr:"+06:00",countries:["KG"]},{name:"Pacific/Tarawa",utcOffset:720,offsetStr:"+12:00",countries:["KI"]},{name:"Pacific/Enderbury",utcOffset:780,offsetStr:"+13:00",countries:["KI"]},{name:"Pacific/Kiritimati",utcOffset:840,offsetStr:"+14:00",countries:["KI"]},{name:"Asia/Pyongyang",utcOffset:510,offsetStr:"+08:30",countries:["KP"]},{name:"Asia/Seoul",utcOffset:540,offsetStr:"+09:00",countries:["KR"]},{name:"America/Cayman",utcOffset:-300,offsetStr:"-05:00",countries:["KY"]},{name:"Asia/Almaty",utcOffset:360,offsetStr:"+06:00",countries:["KZ"]},{name:"Asia/Qyzylorda",utcOffset:360,offsetStr:"+06:00",countries:["KZ"]},{name:"Asia/Aqtobe",utcOffset:300,offsetStr:"+05:00",countries:["KZ"]},{name:"Asia/Aqtau",utcOffset:300,offsetStr:"+05:00",countries:["KZ"]},{name:"Asia/Oral",utcOffset:300,offsetStr:"+05:00",countries:["KZ"]},{name:"Asia/Beirut",utcOffset:120,offsetStr:"+02:00",countries:["LB"]},{name:"Asia/Colombo",utcOffset:330,offsetStr:"+05:30",countries:["LK"]},{name:"Africa/Monrovia",utcOffset:0,offsetStr:"+00:00",countries:["LR"]},{name:"Europe/Vilnius",utcOffset:120,offsetStr:"+02:00",countries:["LT"]},{name:"Europe/Luxembourg",utcOffset:60,offsetStr:"+01:00",countries:["LU"]},{name:"Europe/Riga",utcOffset:120,offsetStr:"+02:00",countries:["LV"]},{name:"Africa/Tripoli",utcOffset:120,offsetStr:"+02:00",countries:["LY"]},{name:"Africa/Casablanca",utcOffset:0,offsetStr:"+00:00",countries:["MA"]},{name:"Europe/Monaco",utcOffset:60,offsetStr:"+01:00",countries:["MC"]},{name:"Europe/Chisinau",utcOffset:120,offsetStr:"+02:00",countries:["MD"]},{name:"Pacific/Majuro",utcOffset:720,offsetStr:"+12:00",countries:["MH"]},{name:"Pacific/Kwajalein",utcOffset:720,offsetStr:"+12:00",countries:["MH"]},{name:"Asia/Rangoon",utcOffset:390,offsetStr:"+06:30",countries:["MM"]},{name:"Asia/Ulaanbaatar",utcOffset:480,offsetStr:"+08:00",countries:["MN"]},{name:"Asia/Hovd",utcOffset:420,offsetStr:"+07:00",countries:["MN"]},{name:"Asia/Choibalsan",utcOffset:480,offsetStr:"+08:00",countries:["MN"]},{name:"Asia/Macau",utcOffset:480,offsetStr:"+08:00",countries:["MO"]},{name:"America/Martinique",utcOffset:-240,offsetStr:"-04:00",countries:["MQ"]},{name:"Europe/Malta",utcOffset:60,offsetStr:"+01:00",countries:["MT"]},{name:"Indian/Mauritius",utcOffset:240,offsetStr:"+04:00",countries:["MU"]},{name:"Indian/Maldives",utcOffset:300,offsetStr:"+05:00",countries:["MV"]},{name:"America/Mexico_City",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Cancun",utcOffset:-300,offsetStr:"-05:00",countries:["MX"]},{name:"America/Merida",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Monterrey",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Matamoros",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Mazatlan",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Chihuahua",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Ojinaga",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Hermosillo",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Tijuana",utcOffset:-480,offsetStr:"-08:00",countries:["MX"]},{name:"America/Santa_Isabel",utcOffset:-480,offsetStr:"-08:00",countries:["MX"]},{name:"America/Bahia_Banderas",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"Asia/Kuala_Lumpur",utcOffset:480,offsetStr:"+08:00",countries:["MY"]},{name:"Asia/Kuching",utcOffset:480,offsetStr:"+08:00",countries:["MY"]},{name:"Africa/Maputo",utcOffset:120,offsetStr:"+02:00",countries:["MZ","BI","BW","CD","MW","RW","ZM","ZW"]},{name:"Africa/Windhoek",utcOffset:120,offsetStr:"+02:00",countries:["NA"]},{name:"Pacific/Noumea",utcOffset:660,offsetStr:"+11:00",countries:["NC"]},{name:"Pacific/Norfolk",utcOffset:660,offsetStr:"+11:00",countries:["NF"]},{name:"Africa/Lagos",utcOffset:60,offsetStr:"+01:00",countries:["NG","AO","BJ","CD","CF","CG","CM","GA","GQ","NE"]},{name:"America/Managua",utcOffset:-360,offsetStr:"-06:00",countries:["NI"]},{name:"Europe/Amsterdam",utcOffset:60,offsetStr:"+01:00",countries:["NL"]},{name:"Europe/Oslo",utcOffset:60,offsetStr:"+01:00",countries:["NO","SJ"]},{name:"Asia/Kathmandu",utcOffset:345,offsetStr:"+05:45",countries:["NP"]},{name:"Pacific/Nauru",utcOffset:720,offsetStr:"+12:00",countries:["NR"]},{name:"Pacific/Niue",utcOffset:-660,offsetStr:"-11:00",countries:["NU"]},{name:"Pacific/Auckland",utcOffset:780,offsetStr:"+13:00",countries:["NZ","AQ"]},{name:"Pacific/Chatham",utcOffset:825,offsetStr:"+13:45",countries:["NZ"]},{name:"America/Panama",utcOffset:-300,offsetStr:"-05:00",countries:["PA"]},{name:"America/Lima",utcOffset:-300,offsetStr:"-05:00",countries:["PE"]},{name:"Pacific/Tahiti",utcOffset:-600,offsetStr:"-10:00",countries:["PF"]},{name:"Pacific/Marquesas",utcOffset:-570,offsetStr:"-09:30",countries:["PF"]},{name:"Pacific/Gambier",utcOffset:-540,offsetStr:"-09:00",countries:["PF"]},{name:"Pacific/Port_Moresby",utcOffset:600,offsetStr:"+10:00",countries:["PG"]},{name:"Pacific/Bougainville",utcOffset:660,offsetStr:"+11:00",countries:["PG"]},{name:"Asia/Manila",utcOffset:480,offsetStr:"+08:00",countries:["PH"]},{name:"Asia/Karachi",utcOffset:300,offsetStr:"+05:00",countries:["PK"]},{name:"Europe/Warsaw",utcOffset:60,offsetStr:"+01:00",countries:["PL"]},{name:"America/Miquelon",utcOffset:-180,offsetStr:"-03:00",countries:["PM"]},{name:"Pacific/Pitcairn",utcOffset:-480,offsetStr:"-08:00",countries:["PN"]},{name:"America/Puerto_Rico",utcOffset:-240,offsetStr:"-04:00",countries:["PR"]},{name:"Asia/Gaza",utcOffset:120,offsetStr:"+02:00",countries:["PS"]},{name:"Asia/Hebron",utcOffset:120,offsetStr:"+02:00",countries:["PS"]},{name:"Europe/Lisbon",utcOffset:0,offsetStr:"+00:00",countries:["PT"]},{name:"Atlantic/Madeira",utcOffset:0,offsetStr:"+00:00",countries:["PT"]},{name:"Atlantic/Azores",utcOffset:-60,offsetStr:"-01:00",countries:["PT"]},{name:"Pacific/Palau",utcOffset:540,offsetStr:"+09:00",countries:["PW"]},{name:"America/Asuncion",utcOffset:-180,offsetStr:"-03:00",countries:["PY"]},{name:"Asia/Qatar",utcOffset:180,offsetStr:"+03:00",countries:["QA","BH"]},{name:"Indian/Reunion",utcOffset:240,offsetStr:"+04:00",countries:["RE","TF"]},{name:"Europe/Bucharest",utcOffset:120,offsetStr:"+02:00",countries:["RO"]},{name:"Europe/Belgrade",utcOffset:60,offsetStr:"+01:00",countries:["RS","BA","HR","ME","MK","SI"]},{name:"Europe/Kaliningrad",utcOffset:120,offsetStr:"+02:00",countries:["RU"]},{name:"Europe/Moscow",utcOffset:180,offsetStr:"+03:00",countries:["RU"]},{name:"Europe/Simferopol",utcOffset:180,offsetStr:"+03:00",countries:["RU"]},{name:"Europe/Volgograd",utcOffset:180,offsetStr:"+03:00",countries:["RU"]},{name:"Europe/Samara",utcOffset:240,offsetStr:"+04:00",countries:["RU"]},{name:"Asia/Yekaterinburg",utcOffset:300,offsetStr:"+05:00",countries:["RU"]},{name:"Asia/Omsk",utcOffset:360,offsetStr:"+06:00",countries:["RU"]},{name:"Asia/Novosibirsk",utcOffset:360,offsetStr:"+06:00",countries:["RU"]},{name:"Asia/Novokuznetsk",utcOffset:420,offsetStr:"+07:00",countries:["RU"]},{name:"Asia/Krasnoyarsk",utcOffset:420,offsetStr:"+07:00",countries:["RU"]},{name:"Asia/Irkutsk",utcOffset:480,offsetStr:"+08:00",countries:["RU"]},{name:"Asia/Chita",utcOffset:480,offsetStr:"+08:00",countries:["RU"]},{name:"Asia/Yakutsk",utcOffset:540,offsetStr:"+09:00",countries:["RU"]},{name:"Asia/Khandyga",utcOffset:540,offsetStr:"+09:00",countries:["RU"]},{name:"Asia/Vladivostok",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Sakhalin",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Ust-Nera",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Magadan",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Srednekolymsk",utcOffset:660,offsetStr:"+11:00",countries:["RU"]},{name:"Asia/Kamchatka",utcOffset:720,offsetStr:"+12:00",countries:["RU"]},{name:"Asia/Anadyr",utcOffset:720,offsetStr:"+12:00",countries:["RU"]},{name:"Asia/Riyadh",utcOffset:180,offsetStr:"+03:00",countries:["SA","KW","YE"]},{name:"Pacific/Guadalcanal",utcOffset:660,offsetStr:"+11:00",countries:["SB"]},{name:"Indian/Mahe",utcOffset:240,offsetStr:"+04:00",countries:["SC"]},{name:"Africa/Khartoum",utcOffset:180,offsetStr:"+03:00",countries:["SD","SS"]},{name:"Europe/Stockholm",utcOffset:60,offsetStr:"+01:00",countries:["SE"]},{name:"Asia/Singapore",utcOffset:480,offsetStr:"+08:00",countries:["SG"]},{name:"America/Paramaribo",utcOffset:-180,offsetStr:"-03:00",countries:["SR"]},{name:"America/El_Salvador",utcOffset:-360,offsetStr:"-06:00",countries:["SV"]},{name:"Asia/Damascus",utcOffset:120,offsetStr:"+02:00",countries:["SY"]},{name:"America/Grand_Turk",utcOffset:-240,offsetStr:"-04:00",countries:["TC"]},{name:"Africa/Ndjamena",utcOffset:60,offsetStr:"+01:00",countries:["TD"]},{name:"Indian/Kerguelen",utcOffset:300,offsetStr:"+05:00",countries:["TF"]},{name:"Asia/Bangkok",utcOffset:420,offsetStr:"+07:00",countries:["TH","KH","LA","VN"]},{name:"Asia/Dushanbe",utcOffset:300,offsetStr:"+05:00",countries:["TJ"]},{name:"Pacific/Fakaofo",utcOffset:780,offsetStr:"+13:00",countries:["TK"]},{name:"Asia/Dili",utcOffset:540,offsetStr:"+09:00",countries:["TL"]},{name:"Asia/Ashgabat",utcOffset:300,offsetStr:"+05:00",countries:["TM"]},{name:"Africa/Tunis",utcOffset:60,offsetStr:"+01:00",countries:["TN"]},{name:"Pacific/Tongatapu",utcOffset:780,offsetStr:"+13:00",countries:["TO"]},{name:"Europe/Istanbul",utcOffset:120,offsetStr:"+02:00",countries:["TR"]},{name:"America/Port_of_Spain",utcOffset:-240,offsetStr:"-04:00",countries:["TT","AG","AI","BL","DM","GD","GP","KN","LC","MF","MS","VC","VG","VI"]},{name:"Pacific/Funafuti",utcOffset:720,offsetStr:"+12:00",countries:["TV"]},{name:"Asia/Taipei",utcOffset:480,offsetStr:"+08:00",countries:["TW"]},{name:"Europe/Kiev",utcOffset:120,offsetStr:"+02:00",countries:["UA"]},{name:"Europe/Uzhgorod",utcOffset:120,offsetStr:"+02:00",countries:["UA"]},{name:"Europe/Zaporozhye",utcOffset:120,offsetStr:"+02:00",countries:["UA"]},{name:"Pacific/Wake",utcOffset:720,offsetStr:"+12:00",countries:["UM"]},{name:"America/New_York",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Detroit",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Kentucky/Louisville",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Kentucky/Monticello",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Indianapolis",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Vincennes",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Winamac",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Marengo",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Petersburg",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Vevay",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Chicago",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Indiana/Tell_City",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Indiana/Knox",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Menominee",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/North_Dakota/Center",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/North_Dakota/New_Salem",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/North_Dakota/Beulah",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Denver",utcOffset:-420,offsetStr:"-07:00",countries:["US"]},{name:"America/Boise",utcOffset:-420,offsetStr:"-07:00",countries:["US"]},{name:"America/Phoenix",utcOffset:-420,offsetStr:"-07:00",countries:["US"]},{name:"America/Los_Angeles",utcOffset:-480,offsetStr:"-08:00",countries:["US"]},{name:"America/Metlakatla",utcOffset:-480,offsetStr:"-08:00",countries:["US"]},{name:"America/Anchorage",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Juneau",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Sitka",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Yakutat",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Nome",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Adak",utcOffset:-600,offsetStr:"-10:00",countries:["US"]},{name:"Pacific/Honolulu",utcOffset:-600,offsetStr:"-10:00",countries:["US","UM"]},{name:"America/Montevideo",utcOffset:-180,offsetStr:"-03:00",countries:["UY"]},{name:"Asia/Samarkand",utcOffset:300,offsetStr:"+05:00",countries:["UZ"]},{name:"Asia/Tashkent",utcOffset:300,offsetStr:"+05:00",countries:["UZ"]},{name:"America/Caracas",utcOffset:-270,offsetStr:"-04:30",countries:["VE"]},{name:"Asia/Ho_Chi_Minh",utcOffset:420,offsetStr:"+07:00",countries:["VN"]},{name:"Pacific/Efate",utcOffset:660,offsetStr:"+11:00",countries:["VU"]},{name:"Pacific/Wallis",utcOffset:720,offsetStr:"+12:00",countries:["WF"]},{name:"Pacific/Apia",utcOffset:840,offsetStr:"+14:00",countries:["WS"]},{name:"Africa/Johannesburg",utcOffset:120,offsetStr:"+02:00",countries:["ZA","LS","SZ"]}]}],link:function(e,n,t,a){e.updateModel=function(e){a.$setViewValue(e)}},templateUrl:"app/core/directives/ms-timezone/ms-timezone.html"}})}(),function(){"use strict";angular.module("app.core").controller("MsWidgetEngineCounterController",function(){var s=this;s.filter=[],s.filtered=!1,s.fontSize=20,s.label="",s.getCount=function(a){var i=0;if(a){s.fontSize=a.attrs[2]&&a.attrs[2].value?parseInt(a.attrs[2].value)-parseInt(a.attrs[2].value)%2:20;var e=a.attrs.find(function(e){return"attrChannel"===e.name});e||a.attrs.push({name:"attrChannel",value:"voice"}),a.attrs.forEach(function(e,n){if("voice"!==a.attrs[3].value?"talking"===a.attrs[0].value?s.label="Opened":"answered"===a.attrs[0].value?s.label="Managed":s.label=a.attrs[0].value:s.label=a.attrs[0].value,!_.isEmpty(e.value))if(e.name.toLowerCase().includes("voice")){a.attrs[n].value&&a.attrs[n].value.length?(s.filtered=!0,s.filter=_.intersection(a.voiceQueuesSelected,a.attrs[n].value)):(s.filtered=!1,s.filter=a.voiceQueuesSelected);for(var t=0;t<a.voiceQueues.rows.length;t+=1)_.includes(s.filter,a.voiceQueues.rows[t].id)&&(i+=a.voiceQueues.rows[t][a.attrs[0].value]?parseInt(a.voiceQueues.rows[t][a.attrs[0].value]):0)}else if(e.name.toLowerCase().includes("chat")){a.attrs[n].value&&a.attrs[n].value.length?(s.filtered=!0,s.filter=_.intersection(a.chatWebsitesSelected,a.attrs[n].value)):(s.filtered=!1,s.filter=a.chatWebsitesSelected);for(var t=0;t<a.chatWebsites.rows.length;t+=1)_.includes(s.filter,a.chatWebsites.rows[t].id)&&(i+=a.chatWebsites.rows[t][a.attrs[0].value]?parseInt(a.chatWebsites.rows[t][a.attrs[0].value]):0)}else if(e.name.toLowerCase().includes("fax")){a.attrs[n].value&&a.attrs[n].value.length?(s.filtered=!0,s.filter=_.intersection(a.faxAccountsSelected,a.attrs[n].value)):(s.filtered=!1,s.filter=a.faxAccountsSelected);for(var t=0;t<a.faxAccounts.rows.length;t+=1)_.includes(s.filter,a.faxAccounts.rows[t].id)&&(i+=a.faxAccounts.rows[t][a.attrs[0].value]?parseInt(a.faxAccounts.rows[t][a.attrs[0].value]):0)}else if(e.name.toLowerCase().includes("mail")){a.attrs[n].value&&a.attrs[n].value.length?(s.filtered=!0,s.filter=_.intersection(a.mailAccountsSelected,a.attrs[n].value)):(s.filtered=!1,s.filter=a.mailAccountsSelected);for(var t=0;t<a.mailAccounts.rows.length;t+=1)_.includes(s.filter,a.mailAccounts.rows[t].id)&&(i+=a.mailAccounts.rows[t][a.attrs[0].value]?parseInt(a.mailAccounts.rows[t][a.attrs[0].value]):0)}else if(e.name.toLowerCase().includes("openchannel")){a.attrs[n].value&&a.attrs[n].value.length?(s.filtered=!0,s.filter=_.intersection(a.openchannelAccountsSelected,a.attrs[n].value)):(s.filtered=!1,s.filter=a.openchannelAccountsSelected);for(var t=0;t<a.openchannelAccounts.rows.length;t+=1)_.includes(s.filter,a.openchannelAccounts.rows[t].id)&&(i+=a.openchannelAccounts.rows[t][a.attrs[0].value]?parseInt(a.openchannelAccounts.rows[t][a.attrs[0].value]):0)}else if(e.name.toLowerCase().includes("whatsapp")){a.attrs[n].value&&a.attrs[n].value.length?(s.filtered=!0,s.filter=_.intersection(a.whatsappAccountsSelected,a.attrs[n].value)):(s.filtered=!1,s.filter=a.whatsappAccountsSelected);for(var t=0;t<a.whatsappAccounts.rows.length;t+=1)_.includes(s.filter,a.whatsappAccounts.rows[t].id)&&(i+=a.whatsappAccounts.rows[t][a.attrs[0].value]?parseInt(a.whatsappAccounts.rows[t][a.attrs[0].value]):0)}else if(e.name.toLowerCase().includes("sms")){a.attrs[n].value&&a.attrs[n].value.length?(s.filtered=!0,s.filter=_.intersection(a.smsAccountsSelected,a.attrs[n].value)):(s.filtered=!1,s.filter=a.smsAccountsSelected);for(var t=0;t<a.smsAccounts.rows.length;t+=1)_.includes(s.filter,a.smsAccounts.rows[t].id)&&(i+=a.smsAccounts.rows[t][a.attrs[0].value]?parseInt(a.smsAccounts.rows[t][a.attrs[0].value]):0)}})}return i}})}(),function(){"use strict";function e(r,e){var l=this;l.filter=[],l.filtered=!1,l.properties=[],l.multiBarChart={labels:["QUEUE_NAME"],series:["TOTAL"],data:[[50]],options:{responsive:!0,legend:{display:!0,fontColor:"#2196f3"},scales:{xAxes:[{gridLines:{display:!0},ticks:{fontColor:"#2196f3",stepSize:1,beginAtZero:!0}}],yAxes:[{gridLines:{display:!1},ticks:{fontColor:"#2196f3"}}]}}},l.getMultiBarChart=function(e){e&&(e.attrs&&function(e){switch(l.properties=_.map(_.filter(e.attrs,function(e){return e.name&&0<=e.name.indexOf("attrSerie")&&e.value&&"null"!==e.value}),"value"),e.attrs[4].value){case"voice":e.attrs[3].value&&e.attrs[3].value.length?(l.filtered=!0,l.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(l.filtered=!1,l.filter=e.voiceQueuesSelected);break;case"sms":e.attrs[7].value&&e.attrs[7].value.length?(l.filtered=!0,l.filter=_.intersection(e.smsAccountsSelected,e.attrs[7].value)):(l.filtered=!1,l.filter=e.smsAccountsSelected);break;case"mail":e.attrs[5].value&&e.attrs[5].value.length?(l.filtered=!0,l.filter=_.intersection(e.mailAccountsSelected,e.attrs[5].value)):(l.filtered=!1,l.filter=e.mailAccountsSelected);break;case"chat":e.attrs[10].value&&e.attrs[10].value.length?(l.filtered=!0,l.filter=_.intersection(e.chatWebsitesSelected,e.attrs[10].value)):(l.filtered=!1,l.filter=e.chatWebsitesSelected);break;case"fax":e.attrs[6].value&&e.attrs[6].value.length?(l.filtered=!0,l.filter=_.intersection(e.faxAccountsSelected,e.attrs[6].value)):(l.filtered=!1,l.filter=e.faxAccountsSelected);break;case"openchannel":e.attrs[8].value&&e.attrs[8].value.length?(l.filtered=!0,l.filter=_.intersection(e.openchannelAccountsSelected,e.attrs[8].value)):(l.filtered=!1,l.filter=e.openchannelAccountsSelected);break;case"whatsapp":e.attrs[9].value&&e.attrs[9].value.length?(l.filtered=!0,l.filter=_.intersection(e.whatsappAccountsSelected,e.attrs[9].value)):(l.filtered=!1,l.filter=e.whatsappAccountsSelected);break;default:e.attrs[3].value&&e.attrs[3].value.length?(l.filtered=!0,l.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(l.filtered=!1,l.filter=e.voiceQueuesSelected)}if(l.multiBarChart.series.length>l.properties.length){var n=l.multiBarChart.series.length-l.properties.length;l.multiBarChart.series.splice(0,n),l.multiBarChart.data.splice(0,n)}for(var t=0;t<l.properties.length;t+=1){var a="";if(a="voice"!==e.attrs[4].value?"talking"===l.properties[t]?"Opened":"answered"===l.properties[t]?"Managed":l.properties[t]:l.properties[t],l.multiBarChart.series[t]=r.instant("TOOLS."+a.toUpperCase()),_.isNil(l.multiBarChart.data[t])&&(l.multiBarChart.data[t]=[]),l.multiBarChart.labels.length>l.filter.length){var i=l.multiBarChart.labels.length-l.filter.length;l.multiBarChart.labels.splice(0,i),l.multiBarChart.data[t].splice(0,i)}switch(e.attrs[4].value){case"voice":for(var s=0,o=0;s<e.voiceQueues.rows.length;s+=1)_.includes(l.filter,e.voiceQueues.rows[s].id)&&(l.multiBarChart.labels[o]=e.voiceQueues.rows[s].name,l.multiBarChart.data[t][o]=e.voiceQueues.rows[s][l.properties[t]]?parseInt(e.voiceQueues.rows[s][l.properties[t]]):0,o+=1);break;case"sms":for(var s=0,o=0;s<e.smsAccounts.rows.length;s+=1)_.includes(l.filter,e.smsAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.smsAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.smsAccounts.rows[s][l.properties[t]]?parseInt(e.smsAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"chat":for(var s=0,o=0;s<e.chatWebsites.rows.length;s+=1)_.includes(l.filter,e.chatWebsites.rows[s].id)&&(l.multiBarChart.labels[o]=e.chatWebsites.rows[s].name,l.multiBarChart.data[t][o]=e.chatWebsites.rows[s][l.properties[t]]?parseInt(e.chatWebsites.rows[s][l.properties[t]]):0,o+=1);break;case"fax":for(var s=0,o=0;s<e.faxAccounts.rows.length;s+=1)_.includes(l.filter,e.faxAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.faxAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.faxAccounts.rows[s][l.properties[t]]?parseInt(e.faxAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"mail":for(var s=0,o=0;s<e.mailAccounts.rows.length;s+=1)_.includes(l.filter,e.mailAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.mailAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.mailAccounts.rows[s][l.properties[t]]?parseInt(e.mailAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"openchannel":for(var s=0,o=0;s<e.openchannelAccounts.rows.length;s+=1)_.includes(l.filter,e.openchannelAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.openchannelAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.openchannelAccounts.rows[s][l.properties[t]]?parseInt(e.openchannelAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"whatsapp":for(var s=0,o=0;s<e.whatsappAccounts.rows.length;s+=1)_.includes(l.filter,e.whatsappAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.whatsappAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.whatsappAccounts.rows[s][l.properties[t]]?parseInt(e.whatsappAccounts.rows[s][l.properties[t]]):0,o+=1);break;default:for(var s=0,o=0;s<e.voiceQueues.rows.length;s+=1)_.includes(l.filter,e.voiceQueues.rows[s].id)&&(l.multiBarChart.labels[o]=e.voiceQueues.rows[s].name,l.multiBarChart.data[t][o]=e.voiceQueues.rows[s][l.properties[t]]?parseInt(e.voiceQueues.rows[s][l.properties[t]]):0,o+=1)}}}(e),e.foreground&&function(e){l.multiBarChart.options.legend.fontColor=e.foreground;for(var n=0;n<l.multiBarChart.options.scales.xAxes.length;n+=1)l.multiBarChart.options.scales.xAxes[n].ticks.fontColor=e.foreground;for(var t=0;t<l.multiBarChart.options.scales.yAxes.length;t+=1)l.multiBarChart.options.scales.yAxes[t].ticks.fontColor=e.foreground}(e))}}e.$inject=["$translate","socket"],angular.module("app.core").controller("MsWidgetEngineMultibarChartController",e)}(),function(){"use strict";function e(s){var o=this;o.filter=[],o.filtered=!1,o.properties=[],o.pieChart={labels:["ANSWERED"],data:[30],options:{responsive:!0,legend:{display:!0}}},o.getPieChart=function(e){e&&(e.attrs&&function(e){switch(o.properties=_.map(_.filter(e.attrs,function(e){return e.name&&0<=e.name.indexOf("attrSerie")&&e.value&&"null"!==e.value}),"value"),e.attrs[4].value){case"voice":e.attrs[3].value&&e.attrs[3].value.length?(o.filtered=!0,o.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(o.filtered=!1,o.filter=e.voiceQueuesSelected);break;case"sms":e.attrs[7].value&&e.attrs[7].value.length?(o.filtered=!0,o.filter=_.intersection(e.smsAccountsSelected,e.attrs[7].value)):(o.filtered=!1,o.filter=e.smsAccountsSelected);break;case"mail":e.attrs[5].value&&e.attrs[5].value.length?(o.filtered=!0,o.filter=_.intersection(e.mailAccountsSelected,e.attrs[5].value)):(o.filtered=!1,o.filter=e.mailAccountsSelected);break;case"chat":e.attrs[10].value&&e.attrs[10].value.length?(o.filtered=!0,o.filter=_.intersection(e.chatWebsitesSelected,e.attrs[10].value)):(o.filtered=!1,o.filter=e.chatWebsitesSelected);break;case"fax":e.attrs[6].value&&e.attrs[6].value.length?(o.filtered=!0,o.filter=_.intersection(e.faxAccountsSelected,e.attrs[6].value)):(o.filtered=!1,o.filter=e.faxAccountsSelected);break;case"openchannel":e.attrs[8].value&&e.attrs[8].value.length?(o.filtered=!0,o.filter=_.intersection(e.openchannelAccountsSelected,e.attrs[8].value)):(o.filtered=!1,o.filter=e.openchannelAccountsSelected);break;case"whatsapp":e.attrs[9].value&&e.attrs[9].value.length?(o.filtered=!0,o.filter=_.intersection(e.whatsappAccountsSelected,e.attrs[9].value)):(o.filtered=!1,o.filter=e.whatsappAccountsSelected);break;default:e.attrs[3].value&&e.attrs[3].value.length?(o.filtered=!0,o.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(o.filtered=!1,o.filter=e.voiceQueuesSelected)}if(o.pieChart.labels.length>o.properties.length){var n=o.pieChart.labels.length-o.properties.length;o.pieChart.labels.splice(0,n),o.pieChart.data.splice(0,n)}for(var t=0,a=0;t<o.properties.length;t+=1){switch("voice"!==e.attrs[4].value?"talking"===o.properties[t]?o.pieChart.labels[t]=s.instant("TOOLS.OPENED"):"answered"===o.properties[t]?o.pieChart.labels[t]=s.instant("TOOLS.MANAGED"):o.pieChart.labels[t]=s.instant("TOOLS."+o.properties[t].toUpperCase()):o.pieChart.labels[t]=s.instant("TOOLS."+o.properties[t].toUpperCase()),e.attrs[4].value){case"voice":for(var i=0;i<e.voiceQueues.rows.length;i+=1)_.includes(o.filter,e.voiceQueues.rows[i].id)&&(a+=e.voiceQueues.rows[i][o.properties[t]]?parseInt(e.voiceQueues.rows[i][o.properties[t]]):0);break;case"sms":for(var i=0;i<e.smsAccounts.rows.length;i+=1)_.includes(o.filter,e.smsAccounts.rows[i].id)&&(a+=e.smsAccounts.rows[i][o.properties[t]]?parseInt(e.smsAccounts.rows[i][o.properties[t]]):0);break;case"chat":for(var i=0;i<e.chatWebsites.rows.length;i+=1)_.includes(o.filter,e.chatWebsites.rows[i].id)&&(a+=e.chatWebsites.rows[i][o.properties[t]]?parseInt(e.chatWebsites.rows[i][o.properties[t]]):0);break;case"fax":for(var i=0;i<e.faxAccounts.rows.length;i+=1)_.includes(o.filter,e.faxAccounts.rows[i].id)&&(a+=e.faxAccounts.rows[i][o.properties[t]]?parseInt(e.faxAccounts.rows[i][o.properties[t]]):0);break;case"mail":for(var i=0;i<e.mailAccounts.rows.length;i+=1)_.includes(o.filter,e.mailAccounts.rows[i].id)&&(a+=e.mailAccounts.rows[i][o.properties[t]]?parseInt(e.mailAccounts.rows[i][o.properties[t]]):0);break;case"openchannel":for(var i=0;i<e.openchannelAccounts.rows.length;i+=1)_.includes(o.filter,e.openchannelAccounts.rows[i].id)&&(a+=e.openchannelAccounts.rows[i][o.properties[t]]?parseInt(e.openchannelAccounts.rows[i][o.properties[t]]):0);break;case"whatsapp":for(var i=0;i<e.whatsappAccounts.rows.length;i+=1)_.includes(o.filter,e.whatsappAccounts.rows[i].id)&&(a+=e.whatsappAccounts.rows[i][o.properties[t]]?parseInt(e.whatsappAccounts.rows[i][o.properties[t]]):0);break;default:for(var i=0;i<e.voiceQueues.rows.length;i+=1)_.includes(o.filter,e.voiceQueues.rows[i].id)&&(a+=e.voiceQueues.rows[i][o.properties[t]]?parseInt(e.voiceQueues.rows[i][o.properties[t]]):0)}o.pieChart.data[t]=a,a=0}}(e),e.foreground&&(n=e,o.pieChart.options.legend.fontColor=n.foreground));var n}}e.$inject=["$translate"],angular.module("app.core").controller("MsWidgetEnginePieChartController",e)}(),function(){"use strict";function e(e,t,a,i){var s=this;function n(e){s.results=e||{count:0,rows:[]}}function o(){s.query.offset=(s.query.page-1)*s.query.limit,s.promise=i[s.reportRoute].run(s.query,n).$promise}s.countDown=0,s.refresh=0,s.title="",s.columns=[],s.results={rows:[],count:0},s.query={limit:10,page:1,startDate:moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),endDate:moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),output:"web"},s.onInit=function e(n){n&&n.attrs&&(n.attrs[0]&&n.attrs[0].value&&(s.query.id=n.attrs[0].value,i.analyticFieldReport.get({fields:"field,alias",nolimit:!0,DefaultReportId:"default"===n.attrs[0].type?n.attrs[0].value:void 0,CustomReportId:"custom"===n.attrs[0].type?n.attrs[0].value:void 0}).$promise.then(function(e){switch(e&&e.rows&&(s.columns=e.rows),n.attrs[0].type){case"default":s.reportRoute="analyticDefaultReport";break;case"custom":s.reportRoute="analyticCustomReport"}return i[s.reportRoute].get({id:n.attrs[0].value,fields:"id,name"}).$promise}).then(function(e){e&&e.name&&(s.title=e.name),o()}).catch(function(e){console.log(e)})),n.attrs[1]&&n.attrs[1].value&&(s.refresh=parseInt(n.attrs[1].value),!_.isNaN(s.refresh)&&0<s.refresh?(s.countDown=parseInt(n.attrs[1].value),s.interval=a(function(){s.countDown-=1},1e3,0),s.timeout=t(function(){s.interval&&a.cancel(s.interval),e(n)},1e3*s.refresh)):(s.interval&&a.cancel(s.interval),s.timeout&&t.cancel(s.timeout))))},s.getResults=o,s.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n},e.$on("$destroy",function(){s.interval&&a.cancel(s.interval),s.timeout&&t.cancel(s.timeout)})}e.$inject=["$scope","$timeout","$interval","api"],angular.module("app.core").controller("MsWidgetEngineWebReportController",e)}(),function(){"use strict";function e(e,n){this.getTrustedURL=function(e){return n.trustAsResourceUrl(e)}}function n(e){return{restrict:"E",scope:{config:"=?",onEdit:"&?",onDelete:"&?"},require:"msWidgetEngine",controller:"MsWidgetEngineController",controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-widget-engine/ms-widget-engine.html"}}e.$inject=["$mdDialog","$sce"],n.$inject=["$document"],angular.module("app.core").controller("MsWidgetEngineController",e).directive("msWidgetEngine",n)}(),function(){"use strict";function e(e,n){var t=this;t.flipped=!1,t.flip=function(){if(!angular.isDefined(e.flippable)||!0!==e.flippable)return;t.flipped=!t.flipped,n.toggleClass("flipped",t.flipped)}}e.$inject=["$scope","$element"],angular.module("app.core").controller("MsWidgetController",e).directive("msWidget",function(){return{restrict:"E",scope:{flippable:"=?"},controller:"MsWidgetController",transclude:!0,compile:function(e){return e.addClass("ms-widget"),function(e,n,t,a,i){i(function(e){n.empty(),n.append(e)})}}}}).directive("msWidgetFront",function(){return{restrict:"E",require:"^msWidget",transclude:!0,compile:function(e){return e.addClass("ms-widget-front"),function(e,n,t,a,i){i(function(e){n.empty(),n.append(e)}),e.flipWidget=a.flip}}}}).directive("msWidgetBack",function(){return{restrict:"E",require:"^msWidget",transclude:!0,compile:function(e){return e.addClass("ms-widget-back"),function(e,n,t,a,i){i(function(e){n.empty(),n.append(e)}),e.flipWidget=a.flip}}}})}(),function(){"use strict";function e(s,n,o,r){return{restrict:"A",require:"?ngModel",link:function(t,a,e,i){o.isAdmin()||o.isTelephone()||(""!==e.privacy||o.getCurrentUser().privacyEnabled)&&!1!==t.$eval(e.privacy)&&(i?(i.$formatters.push(function(e){if(!e)return e;var n=r.mask(e);return i.$setViewValue(n),i.$render(),i.$viewValue}),i.$parsers.push(function(){return i.$modelValue}),a[0].disabled=!0):n(function(){s(a.contents())(t);var e=a.text();if(e){var n=r.mask(e);a.text(n)}}))}}}e.$inject=["$compile","$timeout","Auth","privacyManager"],angular.module("app.core").directive("privacy",e)}(),function(){"use strict";function e(d,c,t,v){function h(e,n){return"motion2.home."+e+":"+n}function f(e){return _.capitalize(e)+("chat"===e?"Website":"Account")+"Id"}function m(e){return"chat"===e?"Website":"Account"}function b(e,n,t){var a=h(n,t);v.set(a,e)}return{addAccount:function(r,e){var l=e.accounts,d=e.accountId,c=e.filters,m=e.query,u=e.userId,n="get"+_.capitalize(r)+("chat"===r?"Websites":"Accounts"),p=f(r),g=l.rows.length===m[p].length;return t.user[n]({id:u,nolimit:!0}).$promise.then(function(e){var n,t,a,i,s;if(l.rows=e.rows,l.count=e.count,_.find(c,["name","Account"]).options=l.rows,g){var o=(t=d,a=h(n=r,u),i=f(n),(s=v.get(a)).query&&s.query[i]&&s.query[i].push(t),s);o&&b(o,r,u),m[p].push(d)}return g})},removeAccount:function(t,e){var n=e.accounts,a=e.accountId,i=e.filters,s=e.query,o=e.userId,r=f(t),l=s[r].includes(a);return c.resolve().then(function(){var e=function(e,n,t){var a=h(e,n),i=f(e),s=v.get(a);if(s.query&&s.query[i]){var o=s.query[i].indexOf(t);-1<o&&s.query[i].splice(o,1)}return s}(t,o,a);e||(e=s),s[r]=e.query[r],_.remove(n.rows,function(e){return e.id===a}),n.count=n.rows.length,_.find(i,function(e){var n=m(t);return e.name===n}).options=n.rows,1===n.count&&(e.query[r]=[n.rows[0].id],s[r]=[n.rows[0].id]),b(e,t,o)}).then(function(){var e=m(t);d.$broadcast("ms-quick-filter:update",{filters:[e],update:l})})}}}e.$inject=["$rootScope","$q","api","localStorageManager"],angular.module("app.core").factory("agentAccountAssociationManager",e)}(),function(){"use strict";function e(o,r,i,l,d){var e={get:function(s,a){return o(function(n,t){0===a.offset&&(s=void 0);var e=_.merge({},a);i.cmContact.getJourney(e).$promise.then(function(e){var a,n=_(e.rows).uniqBy(function(e){return e.channel}).map("channel").value();return(a=n,o(function(e,n){var t=a.map(function(n){if("voice"!==n){var e="get"+_.startCase(n)+("chat"===n?"Websites":"Accounts");return i.user[e]({id:l.getCurrentUser().id,attributes:["id","name"],nolimit:!0}).$promise.then(function(e){c[n]=e.rows})}});return o.all(t).then(function(){e()}).catch(function(e){n(e)})})).then(function(){return e.rows.forEach(function(e){var n;e.canOpen=function(e){switch(e.channel){case"chat":return!!c.chat&&_.some(c.chat,["id",e.ChatWebsiteId]);case"fax":return!!c.fax&&_.some(c.fax,["id",e.FaxAccountId]);case"mail":return!!c.mail&&_.some(c.mail,["id",e.MailAccountId]);case"openchannel":return!!c.openchannel&&_.some(c.openchannel,["id",e.OpenchannelAccountId]);case"sms":return!!c.sms&&_.some(c.sms,["id",e.SmsAccountId]);case"voice":return!0;case"whatsapp":return!!c.whatsapp&&_.some(c.whatsapp,["id",e.WhatsappAccountId]);default:return!1}}(e),e.dispositionsValues=(n=e).disposition?"("+_.compact([n.disposition,n.secondDisposition,n.thirdDisposition]).join(" - ")+")":"("+r.instant("DASHBOARDS.NO_DISPOSITION_SET")+")",e.style=function(e){switch(e.channel){case"chat":return{color:"green-A700",icon:"icon-hangouts"};case"fax":return{color:"blue-grey-A200",icon:"icon-deskphone"};case"mail":return{color:"teal",icon:"icon-email"};case"openchannel":return{color:"amber-A200",icon:"icon-google-earth"};case"sms":return{color:"orange",icon:"icon-message-text"};case"voice":return{color:"blue-A700",icon:"icon-phone"};case"whatsapp":return{color:"lime-A700",icon:"icon-whatsapp"}}}(e)}),a=s,i=e,o(function(e,n){try{var t={journey:a?_.union(a,i.rows):i.rows};t.loadMore=0<i.count-t.journey.length,e(t)}catch(e){n(e)}});var a,i})}).then(function(e){n(e)}).catch(function(e){d.error({title:r.instant("CONTACTMANAGER.CUSTOMER_JOURNEY"),msg:r.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")}),t(e)})})},getQuery:function(){return{range:{from:moment().subtract(3,"M").startOf("month").format("YYYY-MM-DD HH:mm:ss"),to:moment().endOf("month").format("YYYY-MM-DD HH:mm:ss")},limit:10,offset:0}},getQuickFilters:function(){return[{name:"Channel",key:"channel",type:"select",label:"INTEGRATIONS.CHANNEL",customOptions:[{value:void 0,translate:"DASHBOARDS.ALL"},{value:"voice",translate:"DASHBOARDS.VOICE"},{value:"chat",translate:"DASHBOARDS.CHAT"},{value:"mail",translate:"DASHBOARDS.MAIL"},{value:"sms",translate:"DASHBOARDS.SMS"},{value:"fax",translate:"DASHBOARDS.FAX"},{value:"openchannel",translate:"DASHBOARDS.OPENCHANNEL"},{value:"whatsapp",translate:"DASHBOARDS.WHATSAPP"}]},{name:"Start Date",key:"range",type:"date",label:"DASHBOARDS.SELECT_DATE",useFromToKeys:!0}]}},c={};return e}e.$inject=["$q","$translate","api","Auth","toasty"],angular.module("app.core").factory("customerJourneyManager",e)}(),function(){"use strict";function e(p,e){var g={localizationMap:e,setSelectedDate:function(e){var n=e.$gte?new Date(moment.utc(e.$gte).format("YYYY-MM-DD")):new Date(moment.utc(e.from).format("YYYY-MM-DD")),t=e.$lte?new Date(moment.utc(e.$lte).format("YYYY-MM-DD")):new Date(moment.utc(e.to).format("YYYY-MM-DD")),a={dateStart:new Date(n.getFullYear(),n.getMonth(),n.getDate()),dateEnd:new Date(t.getFullYear(),t.getMonth(),t.getDate())};return a.selectedTemplateName=(i=a,moment(i.dateStart).isSame(i.dateEnd)?(u=i,moment().startOf("day").isSame(u.dateStart)?g.localizationMap.Today:(m=i,moment().subtract(1,"days").startOf("day").isSame(m.dateStart)?g.localizationMap.Yesterday:p("date")(i.dateStart,"dd MMM yyyy"))):(c=i,moment().startOf("isoWeek").isSame(c.dateStart,"day")&&moment().endOf("isoWeek").isSame(c.dateEnd,"day")?g.localizationMap["This Week"]:(d=i,moment().subtract(1,"weeks").startOf("isoWeek").isSame(d.dateStart,"day")&&moment().subtract(1,"weeks").endOf("isoWeek").isSame(d.dateEnd,"day")?g.localizationMap["Last Week"]:(l=i,moment().startOf("month").isSame(l.dateStart,"day")&&moment().endOf("month").isSame(l.dateEnd,"day")?g.localizationMap["This Month"]:(r=i,moment().subtract(1,"months").startOf("month").isSame(r.dateStart,"day")&&moment().subtract(1,"months").endOf("month").isSame(r.dateEnd,"day")?g.localizationMap["Last Month"]:(o=i,moment().startOf("year").isSame(o.dateStart,"day")&&moment().endOf("year").isSame(o.dateEnd,"day")?g.localizationMap["This Year"]:(s=i,moment().subtract(1,"years").startOf("year").isSame(s.dateStart,"day")&&moment().subtract(1,"years").endOf("year").isSame(s.dateEnd,"day")?g.localizationMap["Last Year"]:p("date")(i.dateStart,"dd"+(i.dateStart.getMonth()!==i.dateEnd.getMonth()||i.dateStart.getFullYear()!==i.dateEnd.getFullYear()?" MMM":"")+(i.dateStart.getFullYear()!==i.dateEnd.getFullYear()?" yyyy":""))+" - "+p("date")(i.dateEnd,"dd MMM yyyy")))))))),a;var i,s,o,r,l,d,c,m,u}};return g}e.$inject=["$filter","dateFilterLocalizationFactory"],angular.module("app.core").factory("dateRangeManager",e)}(),function(){"use strict";function e(t,a,n,i,s){var o={},r={},l={},d={};function c(){r=i.getCurrentUser();var e=n.localStorage.getItem("motion2.home:"+r.id);if(l=e?JSON.parse(e).currentSidebarTab:"dashboard",d=n.localStorage.getItem("motion2.home."+l+":"+r.id)){var a=JSON.parse(d);a.drafts?r.privacyEnabled&&Object.keys(a.drafts).forEach(function(e){var n=a.drafts[e].title,t=n.split(/-(.+)/)[1].trim();a.drafts[e].title=n.replace(t,s.mask(t))}):a.drafts={},d=a}else d={drafts:{}};return d.drafts}function m(){_.isEmpty(o.drafts)?delete d.drafts:d.drafts=o.drafts,n.localStorage.setItem("motion2.home."+l+":"+r.id,JSON.stringify(d))}return o.init=function(){o.drafts=c()},o.getByInteraction=function(n){return o.drafts=c(),_.find(_.values(o.drafts),function(e){return e.interaction&&e.interaction.id===n})},o.removeByInteraction=function(n){o.drafts=c();var e=_.find(_.values(o.drafts),function(e){return e.interaction&&e.interaction.id===n});e&&(delete o.drafts[e.id],m())},o.add=function(e){o.drafts=c();var n=a.instant("DASHBOARDS.UNTITLED");e.contact?n=e.contact.firstName||e.contact.email:_.isEmpty(e.message.subject)||(n=e.message.subject);var t={type:"draft",title:e.account.key+" - "+n,channel:e.channel,content:e.message,account:e.account,interaction:e.interaction,id:_.random(1e10),openedAt:new Date,saved:!1};o.drafts[t.id]=t,m()},o.update=function(e){o.drafts=c();var n=o.drafts[e.id];n&&(n.content=e.message,o.drafts[e.id]=n,m())},o.open=function(e){o.drafts=c();var n=o.drafts[e];n&&t.$broadcast("open"+_.startCase(l)+"Draft",n)},o.remove=function(e){o.drafts=c(),o.drafts[e]&&(delete o.drafts[e],m())},o}e.$inject=["$rootScope","$translate","$window","Auth","privacyManager"],angular.module("app.core").factory("draftManager",e)}(),function(){"use strict";function e(s){var o=[];return function(n,e){e||(e="global-exception");var t,a=s.get("ClientSideLoggingService").getLogger("global-exception"),i=o.findIndex(function(e){return e===n});-1<i?(t=i,o.splice(t,1)):(!function(e){if(100<=o.length){var n=o.length-100+1;o.splice(0,n)}o.push(e)}(n),a.error(e,n))}}e.$inject=["$injector"],angular.module("app.core").factory("$exceptionHandler",e)}(),function(){"use strict";function e(i){function s(e,n){var t=i.localStorage.getItem(e),a=t?JSON.parse(t):{};return n?a[n]:a}function o(e,n){return i.localStorage.setItem(e,JSON.stringify(n))}return{get:s,set:o,update:function(e,n,t){var a=s(e);t?a[t]=n:a=n;return o(e,a)}}}e.$inject=["$window"],angular.module("app.core").factory("localStorageManager",e)}(),function(){"use strict";function e(i){function s(e,n){var t=i.get(),a=0;if(t)switch(n){case"email":a=t.privacyPolicyEmail;break;case"number":a=t.privacyPolicyNumber;break;default:a=t.privacyPolicyName}return _.isNil(a)?e:0===a||a>e.length?e.replace(/./g,"*"):e.substring(0,e.length-a).padEnd(e.length,"*")}function o(e){return _.startsWith(e,"<")&&_.endsWith(e,">")&&(e=e.substring(1,e.length-1)),/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function r(e){if(_.startsWith(e,"<")&&_.endsWith(e,">")){var n=!0;e=e.substring(1,e.length-1)}var t=e.split("@")[0],a=e.split("@")[1],i="";return n&&(i+="<"),i+=s(t,"email"),i+="@",i+=s(a,"email"),n&&(i+=">"),i}return{mask:function n(e){t=e,e=t.replace(/\s\s+/g," ").trim();var t;{if(o(e))return r(e);if(/^[+]?[0-9|.|\-|\s]*$/.test(e))return s(e,"number");var a=[],i=e.split(" ");return 1===i.length?s(e):(i.forEach(function(e){a.push(n(e))}),a.join(" "))}}}}e.$inject=["settingsManager"],angular.module("app.core").factory("privacyManager",e)}(),function(){"use strict";function e(n,i){return{setPlaceholder:function(a){var e;return n(function(n){try{if(_.isEmpty(a.resources))e=i.instant("DASHBOARDS.NONE");else if(_.isEmpty(a.param))e=a.placeholder?i.instant(a.placeholder):i.instant("DASHBOARDS.CHOOSE");else if(a.param.length===a.resources.length)e=i.instant("DASHBOARDS.ALL");else{var t=a.ngValue||"id";e=_(a.resources).filter(function(e){return _.includes(a.param,e[t])}).map("name").value().join(", ")}n(e)}catch(e){n(null)}})}}}e.$inject=["$q","$translate"],angular.module("app.core").factory("quickFilterManager",e)}(),function(){"use strict";function e(t,e){var n={checkEveryChannelPauseStatus:function(n){e.getChannels().forEach(function(e){n[e+"Pause"]&&(n[e+"Status"]="pause")})},getAgentStatus:function(e){var n="unknown";n=o(e)?"pause":o(e,!0)?"*pause":function(e){if("idle"!==e.voiceStatus&&e.voicePause)return!(e.voiceStatus="pause");return _.every([e.chatStatus,e.faxStatus,e.mailStatus,e.openchannelStatus,e.smsStatus,e.voiceStatus,e.whatsappStatus],r)}(e)?"idle":"busy";return n},getAgentStatusDisplayValue:function(e){var n=e.globalStatus;"pause"===e.globalStatus?n=e.pauseType||t.instant("VOICE.DEFAULT_PAUSE"):"*pause"===e.globalStatus&&(n="*"+(e.pauseType||t.instant("VOICE.DEFAULT_PAUSE")));return n},getUserUpdateEventOrigin:function(e){var n="call";e.lastLoginAt?n="login":!1===e.online?n="logout":e.pauseType&&(n="pause");return n},sortAgentsByStatus:function(e,t){return e.sort(function(e,n){return e.globalStatus===n.globalStatus?"pause"===e.globalStatus?"DESC"===t?(e.pauseType||"")<(n.pauseType||"")||e.fullname.toLowerCase()>n.fullname.toLowerCase()?1:-1:(e.pauseType||"")<(n.pauseType||"")||e.fullname.toLowerCase()>n.fullname.toLowerCase()?-1:1:"DESC"===t?e.fullname.toLowerCase()<n.fullname.toLowerCase()?1:-1:e.fullname.toLowerCase()<n.fullname.toLowerCase()?-1:1:"DESC"===t?e.globalStatus<n.globalStatus?1:-1:e.globalStatus<n.globalStatus?-1:1})},updateBusyCounter:s,updateQueue:function(e,n,t,a){var i=t.paused;!1===e.online?(t.online=!1,n.loggedInDb-=1,t.paused?(t.paused=!1,n.paused-=1):n.available-=1):t.online?!e[a+"Pause"]||t.paused||o(e,!0)?!e[a+"Pause"]&&t.paused?(t.paused=!1,t.talking||t.busy||(n.paused-=1,n.available+=1)):e[a+"Pause"]&&t.paused&&(t.talking||t.busy||(n.busy-=1,i||(n.paused+=1))):(t.paused=!0,t.talking||t.busy||(i||(n.paused+=1),0<n.available&&(n.available-=1))):(t.online=!0,n.loggedInDb+=1,n.available+=1);s(n)},updateVoiceQueue:function(e,n){e.loggedIn===e.available&&0<e.waiting&&(e.available-=e.waiting);var t=e.loggedIn-e.available-e.talking-e.waiting-n.paused;t<0?(n.paused-=Math.abs(t),n.waitingOrTalking=!0):0<t&&n.waitingOrTalking&&(n.paused+=1,delete n.waitingOrTalking);_.merge(n,_.pick(e,"inbound"===n.type?a:i)),"outbound"===n.type&&_.isNil(e.startPredictive)&&(n.startPredictive=void 0);s(n)}},a=["loggedIn","available","waiting","talking","paused"],i=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused","startPredictive","startProgressive","erlangCalls","erlangCallToSecond","erlangAbandonmentRate","erlangBusyFactor","dialPredictiveInterval","dialPredictiveIntervalMaxThreshold","dialPredictiveIntervalMinThreshold","predictiveIntervalAvailable","predictiveIntervalTotalCalls","predictiveIntervalAnsweredCalls","predictiveIntervalDroppedCallsTimeout","predictiveIntervalDroppedCallsCallersExit","predictiveIntervalAvgHoldtime","predictiveIntervalAvgTalktime"];function s(e){var n=_.filter(e.agents,["busy",!0]).length,t=e.loggedInDb-e.available-e.paused-e.talking-e.waiting;t<0&&(t=0),e.busy=t<n?n:t}function o(e,n){var t=[e.chatPause,e.faxPause,e.mailPause,e.openchannelPause,e.smsPause,e.voicePause,e.whatsappPause];if(!n)return _.every(t);var a=_.filter(t);return 0<a.length&&a.length<t.length}function r(e){if(_.isNil(e))return!0;return _.includes(["idle","unknown","unavailable","ringing"],e)}return n}e.$inject=["$translate","msUtils"],angular.module("app.core").factory("realtimeManager",e)}(),function(){"use strict";function e(e,n){var t={get:function(){return a},getUTCOffset:function(){return null===i?n.setting.getDate().$promise.then(function(e){return i=e.offset}):e.resolve(i)},set:function(e){e&&(a=e.toJSON())}},a={},i=null;return t}e.$inject=["$q","api"],angular.module("app.core").factory("settingsManager",e)}(),function(){"use strict";function e(c,m){function u(e,n,t){if(_.isEmpty(n))return t;for(var a=0;a<n.length;a++){var i=n[a].key,s=_.find(e,function(e){return e[i]===n[a].value});s&&(_.some(t,["id",s.id])||(s.canSelect=!1,t.push(s)))}return t}return{getResources:function(a,i,s,o,r,l,d){return c(function(t,n){o||(o={}),d||(d="get"),a[s][d](o).$promise.then(function(e){var t=e.rows;if("admin"===i.role)return t;var n=m.getSectionId(s,l);return a.userProfileSection.get({userProfileId:i.userProfileId,sectionId:n}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?t:a.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(t,{id:e.resourceId})});return u(t,r,n)}):c.resolve().then(function(){return e=s,_.includes(["voiceContext"],e)?(o.defaultEntry=1,a[s][d](o).$promise.then(function(e){return e.rows})):[];var e}).then(function(e){return u(t,r,e)})})}).then(function(e){var n={rows:_.orderBy(e,[o.sort]),count:e.length};t(n)}).catch(function(e){n(e)})})}}}e.$inject=["$q","msNavigationService"],angular.module("app.core").factory("userProfileManager",e)}(),function(){"use strict";angular.module("app.core").filter("altDate",function(){return function(e){var n=Date.now()-new Date(e);return n<36e5?moment(e).fromNow():n<864e5?moment(e).format("HH:mm"):n<6048e5?moment(e).format("dddd"):moment(e).calendar()}})}(),function(){"use strict";function e(n){return function(e){return n.trustAsHtml(e)}}e.$inject=["$sce"],angular.module("app.core").filter("toTrusted",e).filter("htmlToPlaintext",function(){return function(e){return String(e).replace(/<[^>]+>/gm,"")}}).filter("nospace",function(){return function(e){return e?e.replace(/ /g,""):""}}).filter("humanizeDoc",function(){return function(e){if(e)return"directive"===e.type?e.name.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()}):e.label||e.name}})}(),function(){"use strict";angular.module("app.core").filter("capitalize",function(){return function(e){return e?_.capitalize(e):""}})}(),function(){"use strict";angular.module("app.core").filter("filterByIds",function(){return function(e,n){if(0===e.length||!n)return e;if(0===n.length)return[];for(var t=[],a=0;a<e.length;a++){for(var i=e[a],s=!1,o=0;o<n.length;o++){var r=n[o];if(i.id===r){s=!0;break}}s&&t.push(i)}return t}})}(),function(){"use strict";angular.module("app.core").filter("filterByPropIds",function(){return function(e,n,t){if(0===e.length||!t||0===t.length)return e;for(var a=[],i=0;i<e.length;i++){for(var s=e[i],o=!1,r=0;r<t.length;r++){var l=t[r];if(-1<s[n].indexOf(l)){o=!0;break}}o&&a.push(s)}return a}})}(),function(){"use strict";angular.module("app.core").filter("getOptionByValue",function(){return function(n,e,t){if(void 0===n)return"";if(!e)return"";t||(t="option");var a=_.find(e,function(e){return e.value==n});return a?a[t]:""}})}(),function(){"use strict";angular.module("app.core").filter("orderByDate",function(){return function(e){var n=[];return angular.forEach(e,function(e){n.push(e)}),n.sort(function(e,n){return e.hasOwnProperty("openedAt")&&n.hasOwnProperty("openedAt")?e.openedAt>n.openedAt?1:-1:1}),n}})}(),function(){"use strict";angular.module("app.core").filter("secToTime",function(){return function(e){e&&(e=e.toString().replace(",",""));var n=Math.floor(e/86400),t=e%86400,a=new Date(1e3*t).toISOString().substring(11,19);return a.replace(/^(\d+)/,function(e){return(""+(Number(e)+24*n)).padStart(2,"0")})}})}(),function(){"use strict";angular.module("app.core").filter("snakecase",function(){return function(e){return e?_.snakeCase(e):""}})}(),function(){"use strict";angular.module("app.core").filter("startcase",function(){return function(e){return e?_.startCase(e):""}})}(),function(){"use strict";angular.module("app.core").filter("filterByTags",function(){return function(e,t){if(0===e.length||0===t.length)return e;var a=[];return e.forEach(function(e){var n=t.every(function(n){var t=!1;return e.tags.forEach(function(e){e.name!==n.name||(t=!0)}),t});n&&a.push(e)}),a}}).filter("filterSingleByTags",function(){return function(e,n){if(0!==e.length&&0!==n.length){if(e.length<n.length)return[];var t=[],a=n.every(function(n){var t=!1;return e.forEach(function(e){e.name!==n.name||(t=!0)}),t});return a&&t.push(e),t}}})}(),function(){"use strict";angular.module("app.core").filter("toInteger",function(){return function(e){if(e&&"string"==typeof e)return parseInt(e)}})}(),function(){"use strict";function m(e,n,t,a){this.id=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),this.title=e,this.body=n,this.accept=t,this.reject=a,this.close=i}function u(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}function i(){var t=this;navigator.serviceWorker.ready.then(function(e){e.getNotifications().then(function(e){var n=_.find(e,function(e){return e.data.id===t.id});n&&n.close()})})}angular.module("app.dashboards").provider("motNotification",function(){return{$get:[function(){var d,t,c=[];"serviceWorker"in navigator&&u()?navigator.serviceWorker.register("notification.js").then(function(e){(d=e).update(),d.installing?t=d.installing:d.waiting?t=d.waiting:d.active&&(t=d.active)}).catch(function(e){console.error("Service worker registration failed",e)}):console.error("Service Worker is not supported");return navigator.serviceWorker.addEventListener("message",function(e){if(e.source===t){var n=_.find(c,{id:e.data.id});if(n)switch(e.data.action){case"accept":n.accept&&n.accept();break;case"reject":n.reject&&n.reject()}}}),{create:function(e,i,s,o,r,l){return new Promise(function(t,n){var a;u()&&(window.document.hidden||window.document.mozHidden||window.document.webkitHidden)?(a=new m(e||"MyTitle",i||"MyBody",o,r),c.push(a),a?window.Notification.requestPermission().then(function(e){if("granted"===e)return d.showNotification(a.title,{body:a.body,requireInteraction:!0,icon:s||"assets/images/business/queueCampaigns.jpg",data:{id:a.id},actions:[{action:"accept",title:"Accept"},{action:"reject",title:"Reject"}]})}).then(function(e){if(l){for(var n=0;n<c.length;n++)c[n].close();t()}else t(a)}).catch(function(e){n(e)}):n(new Error("Notification creating error"))):t()})}}}]}})}(),function(){"use strict";function e(l,d,c){return{resolve:function(e,n){var t=e.split("@"),a=t[0],i=t[1],s=n||{};if(!a||!i)return d.error("apiResolver.resolve requires correct action parameter (ResourceName@methodName)"),!1;var o=l.defer(),r=function(e){for(var n=e.split("."),t=c,a=0;a<n.length;a++){if(angular.isUndefined(t[n[a]])){d.error('Resource part "'+n[a]+'" is not defined!'),t=!1;break}t=t[n[a]]}return t||!1}(a);r?r[i](s,function(e){o.resolve(e)},function(e){o.reject(e)}):(d.error('Resource "'+a+'" is not defined in the api service!'),o.reject('Resource "'+a+'" is not defined in the api service!'));return o.promise}}}e.$inject=["$q","$log","api"],angular.module("app.core").factory("apiResolver",e)}(),function(){"use strict";function e(e){return{showLoadingIndicator:function(){e.loadingProgress=!0},hideLoadingIndicator:function(){e.loadingProgress=!1}}}e.$inject=["$rootScope"],angular.module("app.core").factory("LoadingIndicatorService",e)}(),function(){"use strict";angular.module("app.core").provider("msApi",function(){var t=angular.injector(["ng"]).get("$log"),a="",v=[];function n(e){a=e}function i(){return a}function s(e,n){angular.isString(e)?angular.isArray(n)?v[e]={url:a+(n[0]||""),paramDefaults:n[1]||[],actions:n[2]||[],options:n[3]||{}}:t.error('"resource" must be an array and it must follow $resource definition'):t.error('"path" must be a string (eg. `dashboard.project`)')}this.setBaseUrl=n,this.getBaseUrl=i,this.getApiObject=function(){return v},this.register=s,this.$get=["$log","$q","$resource","$rootScope",function(m,u,p,g){var e={setBaseUrl:n,getBaseUrl:i,register:s,resolve:function(e,n){g.$broadcast("msApi::resolveStart");var t=e.split("@"),a=t[0],i=t[1],s=n||{};if(!a||!i)return m.error("msApi.resolve requires correct action parameter (resourceName@methodName)"),!1;var o=u.defer(),r=v[a];if(r){var l=p(r.url,r.paramDefaults,r.actions,r.options);l[i](s,function(e){o.resolve(e),g.$broadcast("msApi::resolveSuccess")},function(e){o.reject(e),g.$broadcast("msApi::resolveError")})}else m.error('Resource "'+a+'" is not defined in the api service!'),o.reject('Resource "'+a+'" is not defined in the api service!');return o.promise},request:function(e,n,t,a){g.$broadcast("msApi::requestStart");var i=e.split("@"),s=i[0],o=i[1],r=n||{};if(!s||!o)return m.error("msApi.resolve requires correct action parameter (resourceName@methodName)"),!1;var l=u.defer(),d=v[s];if(d){var c=p(d.url,d.paramDefaults,d.actions,d.options);c[o](r,function(e){g.$broadcast("msApi::requestSuccess"),l.resolve(e),angular.isDefined(t)&&angular.isFunction(t)&&t(e)},function(e){g.$broadcast("msApi::requestError"),l.reject(e),angular.isDefined(a)&&angular.isFunction(a)&&a(e)})}else m.error('Resource "'+s+'" is not defined in the api service!'),l.reject('Resource "'+s+'" is not defined in the api service!');return l.promise}};return e}]})}(),function(){"use strict";function e(l){var e=new MobileDetect(l.navigator.userAgent),d=null;return{exists:function(e,n){return-1<n.indexOf(e)},detectBrowser:function(){if(d)return d;var e=[{string:l.navigator.userAgent,subString:"Edge",versionSearch:"Edge",identity:"Edge"},{string:l.navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:l.navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:l.navigator.vendor,subString:"Apple",versionSearch:"Version",identity:"Safari"},{prop:l.opera,identity:"Opera"},{string:l.navigator.vendor,subString:"iCab",identity:"iCab"},{string:l.navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:l.navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:l.navigator.vendor,subString:"Camino",identity:"Camino"},{string:l.navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:l.navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:l.navigator.userAgent,subString:"Trident/7",identity:"Explorer",versionSearch:"rv"},{string:l.navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:l.navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],n=[{string:l.navigator.platform,subString:"Win",identity:"Windows"},{string:l.navigator.platform,subString:"Mac",identity:"Mac"},{string:l.navigator.platform,subString:"Linux",identity:"Linux"},{string:l.navigator.platform,subString:"iPhone",identity:"iPhone"},{string:l.navigator.platform,subString:"iPod",identity:"iPod"},{string:l.navigator.platform,subString:"iPad",identity:"iPad"},{string:l.navigator.platform,subString:"Android",identity:"Android"}],i="";function t(e){for(var n=0;n<e.length;n++){var t=e[n].string,a=e[n].prop;if(i=e[n].versionSearch||e[n].identity,t){if(-1!==t.indexOf(e[n].subString))return e[n].identity}else if(a)return e[n].identity}}function a(e){var n=e.indexOf(i);if(-1!==n)return parseInt(e.substring(n+i.length+1))}var s=t(e)||"unknown-browser",o=a(l.navigator.userAgent)||a(l.navigator.appVersion)||"unknown-version",r=t(n)||"unknown-os";return s=s.toLowerCase(),o=s+"-"+o,r=r.toLowerCase(),d={browser:s,version:o,os:r}},getChannels:function(){return["chat","fax","mail","openchannel","sms","voice","whatsapp"]},guidGenerator:function(){var e=function(){return(65536*(1+Math.random())||0).toString(16).substring(1)};return e()+e()+e()+e()+e()+e()},isMobile:function(){return e.mobile()},toggleInArray:function(e,n){-1===n.indexOf(e)?n.push(e):n.splice(n.indexOf(e),1)},firstLastDayMonth:function(){return{$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()}},getEmailProviders:function(){return[{name:"Custom",value:"custom"},{name:"Gmail",value:"gmail"},{name:"Hotmail",value:"hotmail"},{name:"Yahoo",value:"yahoo"},{name:"Outlook365",value:"outlook365"}]}}}e.$inject=["$window"],angular.module("app.core").factory("msUtils",e)}(),function(){"use strict";function e(e,n){var t=this;t.themes=n.themes,t.layoutModes=[{label:"Boxed",value:"boxed"},{label:"Wide",value:"wide"}],t.layoutStyles=[{label:"Vertical Navigation",value:"verticalNavigation",figure:"/assets/images/theme-options/vertical-nav.jpg"},{label:"Vertical Navigation with Fullwidth Toolbar",value:"verticalNavigationFullwidthToolbar",figure:"/assets/images/theme-options/vertical-nav-with-full-toolbar.jpg"},{label:"Vertical Navigation with Fullwidth Toolbar 2",value:"verticalNavigationFullwidthToolbar2",figure:"/assets/images/theme-options/vertical-nav-with-full-toolbar-2.jpg"},{label:"Horizontal Navigation",value:"horizontalNavigation",figure:"/assets/images/theme-options/horizontal-nav.jpg"},{label:"Content with Toolbar",value:"contentWithToolbar",figure:"/assets/images/theme-options/content-with-toolbar.jpg"},{label:"Content Only",value:"contentOnly",figure:"/assets/images/theme-options/content-only.jpg"}],t.layoutMode="wide",t.layoutStyle=e.get("motion.layoutStyle")||"verticalNavigation",t.setActiveTheme=function(e){n.setActiveTheme(e)},t.getActiveTheme=function(){return n.themes.active},t.updateLayoutMode=function(){angular.element("body").toggleClass("boxed","boxed"===t.layoutMode)},t.updateLayoutStyle=function(){e.put("motion.layoutStyle",t.layoutStyle),location.reload()}}function n(n){return{restrict:"E",scope:{},controller:"MsThemeOptionsController as vm",templateUrl:"app/core/theme-options/theme-options.html",compile:function(e){return e.addClass("ms-theme-options"),function(e){e.toggleOptionsSidenav=function(){n("motion-theme-options").toggle()}}}}}e.$inject=["$cookies","motionTheming"],n.$inject=["$mdSidenav"],angular.module("app.core").controller("MsThemeOptionsController",e).directive("msThemeOptions",n)}(),function(){"use strict";function e(i,a,s){var o={};return{generate:function(){var e=angular.copy(s.getRegisteredThemes()),a=angular.copy(s.getRegisteredPalettes());angular.forEach(e,function(t){o[t.name]={},angular.forEach(t.colors,function(e,n){o[t.name][n]={name:e.name,levels:{default:{color:l(a[e.name][e.hues.default].value),contrast1:l(a[e.name][e.hues.default].contrast,1),contrast2:l(a[e.name][e.hues.default].contrast,2),contrast3:l(a[e.name][e.hues.default].contrast,3),contrast4:l(a[e.name][e.hues.default].contrast,4)},hue1:{color:l(a[e.name][e.hues["hue-1"]].value),contrast1:l(a[e.name][e.hues["hue-1"]].contrast,1),contrast2:l(a[e.name][e.hues["hue-1"]].contrast,2),contrast3:l(a[e.name][e.hues["hue-1"]].contrast,3),contrast4:l(a[e.name][e.hues["hue-1"]].contrast,4)},hue2:{color:l(a[e.name][e.hues["hue-2"]].value),contrast1:l(a[e.name][e.hues["hue-2"]].contrast,1),contrast2:l(a[e.name][e.hues["hue-2"]].contrast,2),contrast3:l(a[e.name][e.hues["hue-2"]].contrast,3),contrast4:l(a[e.name][e.hues["hue-2"]].contrast,4)},hue3:{color:l(a[e.name][e.hues["hue-3"]].value),contrast1:l(a[e.name][e.hues["hue-3"]].contrast,1),contrast2:l(a[e.name][e.hues["hue-3"]].contrast,2),contrast3:l(a[e.name][e.hues["hue-3"]].contrast,3),contrast4:l(a[e.name][e.hues["hue-3"]].contrast,4)}}}})}),function(e){var n=angular.copy(e);angular.forEach(n,function(t){angular.forEach(t,function(e,n){t[n]=e.levels,t[n].color=e.levels.default.color,t[n].contrast1=e.levels.default.contrast1,t[n].contrast2=e.levels.default.contrast2,t[n].contrast3=e.levels.default.contrast3,t[n].contrast4=e.levels.default.contrast4,delete t[n].default})}),s.setThemesList(n);var t=i.get("motion.selectedTheme");t?s.setActiveTheme(t):s.setActiveTheme("default")}(o);var r={};angular.forEach(o,function(e,n){var t,a,i,s,o;(r={})["@themeName"]=n,angular.forEach(e,function(e,a){angular.forEach(e.levels,function(e,t){angular.forEach(e,function(e,n){r["@"+a+d(t)+d(n)]=e})})}),t=r,a=new RegExp(Object.keys(t).join("|"),"gi"),i='/* Content hack because they wont fix */\n/* https://github.com/angular/material/pull/8067 */\n[md-theme="@themeName"] md-content.md-hue-1,\nmd-content.md-@themeName-theme.md-hue-1 {\n    color: @backgroundHue1Contrast1;\n    background-color: @backgroundHue1Color;\n}\n\n[md-theme="@themeName"] md-content.md-hue-2,\nmd-content.md-@themeName-theme.md-hue-2 {\n    color: @backgroundHue2Contrast1;\n    background-color: @backgroundHue2Color;\n}\n\n[md-theme="@themeName"] md-content.md-hue-3,\n md-content.md-@themeName-theme.md-hue-3 {\n    color: @backgroundHue3Contrast1;\n    background-color: @backgroundHue3Color;\n}\n\n/* Text Colors */\n[md-theme="@themeName"] a {\n    color: @accentDefaultColor;\n}\n\n[md-theme="@themeName"] .secondary-text,\n[md-theme="@themeName"] .icon {\n    color: @backgroundDefaultContrast2;\n}\n\n[md-theme="@themeName"] .hint-text,\n[md-theme="@themeName"] .disabled-text {\n    color: @backgroundDefaultContrast3;\n}\n\n[md-theme="@themeName"] .fade-text,\n[md-theme="@themeName"] .divider {\n    color: @backgroundDefaultContrast4;\n}\n\n/* Primary */\n[md-theme="@themeName"] .md-primary-bg {\n    background-color: @primaryDefaultColor;\n    color: @primaryDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg .secondary-text,\n[md-theme="@themeName"] .md-primary-bg .icon {\n    color: @primaryDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-primary-bg .hint-text,\n[md-theme="@themeName"] .md-primary-bg .disabled-text {\n    color: @primaryDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg .fade-text,\n[md-theme="@themeName"] .md-primary-bg .divider {\n    color: @primaryDefaultContrast4;\n}\n\n/* Primary, Hue-1 */\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 {\n    background-color: @primaryHue1Color;\n    color: @primaryHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .icon {\n    color: @primaryHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .disabled-text {\n    color: @primaryHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .divider {\n    color: @primaryHue1Contrast4;\n}\n\n/* Primary, Hue-2 */\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 {\n    background-color: @primaryHue2Color;\n    color: @primaryHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .icon {\n    color: @primaryHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .disabled-text {\n    color: @primaryHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .divider {\n    color: @primaryHue2Contrast4;\n}\n\n/* Primary, Hue-3 */\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 {\n    background-color: @primaryHue3Color;\n    color: @primaryHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .icon {\n    color: @primaryHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .disabled-text {\n    color: @primaryHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .divider {\n    color: @primaryHue3Contrast4;\n}\n\n/* Primary foreground */\n[md-theme="@themeName"] .md-primary-fg {\n    color: @primaryDefaultColor !important;\n}\n\n/* Primary foreground, Hue-1 */\n[md-theme="@themeName"] .md-primary-fg.md-hue-1 {\n    color: @primaryHue1Color !important;\n}\n\n/* Primary foreground, Hue-2 */\n[md-theme="@themeName"] .md-primary-fg.md-hue-2 {\n    color: @primaryHue2Color !important;\n}\n\n/* Primary foreground, Hue-3 */\n[md-theme="@themeName"] .md-primary-fg.md-hue-3 {\n    color: @primaryHue3Color !important;\n}\n\n/* Accent */\n[md-theme="@themeName"] .md-accent-bg {\n    background-color: @accentDefaultColor;\n    color: @accentDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg .secondary-text,\n[md-theme="@themeName"] .md-accent-bg .icon {\n    color: @accentDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-accent-bg .hint-text,\n[md-theme="@themeName"] .md-accent-bg .disabled-text {\n    color: @accentDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg .fade-text,\n[md-theme="@themeName"] .md-accent-bg .divider {\n    color: @accentDefaultContrast4;\n}\n\n/* Accent, Hue-1 */\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 {\n    background-color: @accentHue1Color;\n    color: @accentHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .icon {\n    color: @accentHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .disabled-text {\n    color: @accentHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .divider {\n    color: @accentHue1Contrast4;\n}\n\n/* Accent, Hue-2 */\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 {\n    background-color: @accentHue2Color;\n    color: @accentHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .icon {\n    color: @accentHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .disabled-text {\n    color: @accentHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .divider {\n    color: @accentHue2Contrast4;\n}\n\n/* Accent, Hue-3 */\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 {\n    background-color: @accentHue3Color;\n    color: @accentHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .icon {\n    color: @accentHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .disabled-text {\n    color: @accentHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .divider {\n    color: @accentHue3Contrast4;\n}\n\n/* Accent foreground */\n[md-theme="@themeName"] .md-accent-fg {\n    color: @accentDefaultColor !important;\n}\n\n/* Accent foreground, Hue-1 */\n[md-theme="@themeName"] .md-accent-fg.md-hue-1 {\n    color: @accentHue1Color !important;\n}\n\n/* Accent foreground, Hue-2 */\n[md-theme="@themeName"] .md-accent-fg.md-hue-2 {\n    color: @accentHue2Color !important;\n}\n\n/* Accent foreground, Hue-3 */\n[md-theme="@themeName"] .md-accent-fg.md-hue-3 {\n    color: @accentHue3Color !important;\n}\n\n/* Warn */\n[md-theme="@themeName"] .md-warn-bg {\n    background-color: @warnDefaultColor;\n    color: @warnDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg .secondary-text,\n[md-theme="@themeName"] .md-warn-bg .icon {\n    color: @warnDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-warn-bg .hint-text,\n[md-theme="@themeName"] .md-warn-bg .disabled-text {\n    color: @warnDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg .fade-text,\n[md-theme="@themeName"] .md-warn-bg .divider {\n    color: @warnDefaultContrast4;\n}\n\n/* Warn, Hue-1 */\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 {\n    background-color: @warnHue1Color;\n    color: @warnHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .icon {\n    color: @warnHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .disabled-text {\n    color: @warnHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .divider {\n    color: @warnHue1Contrast4;\n}\n\n/* Warn, Hue-2 */\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 {\n    background-color: @warnHue2Color;\n    color: @warnHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .icon {\n    color: @warnHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .disabled-text {\n    color: @warnHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .divider {\n    color: @warnHue2Contrast4;\n}\n\n/* Warn, Hue-3 */\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 {\n    background-color: @warnHue3Color;\n    color: @warnHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .icon {\n    color: @warnHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .disabled-text {\n    color: @warnHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .divider {\n    color: @warnHue3Contrast4;\n}\n\n/* Warn foreground */\n[md-theme="@themeName"] .md-warn-fg {\n    color: @warnDefaultColor !important;\n}\n\n/* Warn foreground, Hue-1 */\n[md-theme="@themeName"] .md-warn-fg.md-hue-1 {\n    color: @warnHue1Color !important;\n}\n\n/* Warn foreground, Hue-2 */\n[md-theme="@themeName"] .md-warn-fg.md-hue-2 {\n    color: @warnHue2Color !important;\n}\n\n/* Warn foreground, Hue-3 */\n[md-theme="@themeName"] .md-warn-fg.md-hue-3 {\n    color: @warnHue3Color !important;\n}\n\n/* Background */\n[md-theme="@themeName"] .md-background-bg {\n    background-color: @backgroundDefaultColor;\n    color: @backgroundDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg .secondary-text,\n[md-theme="@themeName"] .md-background-bg .icon {\n    color: @backgroundDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-background-bg .hint-text,\n[md-theme="@themeName"] .md-background-bg .disabled-text {\n    color: @backgroundDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg .fade-text,\n[md-theme="@themeName"] .md-background-bg .divider {\n    color: @backgroundDefaultContrast4;\n}\n\n/* Background, Hue-1 */\n[md-theme="@themeName"] .md-background-bg.md-hue-1 {\n    background-color: @backgroundHue1Color;\n    color: @backgroundHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .icon {\n    color: @backgroundHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .disabled-text {\n    color: @backgroundHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .divider {\n    color: @backgroundHue1Contrast4;\n}\n\n/* Background, Hue-2 */\n[md-theme="@themeName"] .md-background-bg.md-hue-2 {\n    background-color: @backgroundHue2Color;\n    color: @backgroundHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .icon {\n    color: @backgroundHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .disabled-text {\n    color: @backgroundHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .divider {\n    color: @backgroundHue2Contrast4;\n}\n\n/* Background, Hue-3 */\n[md-theme="@themeName"] .md-background-bg.md-hue-3 {\n    background-color: @backgroundHue3Color;\n    color: @backgroundHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .icon {\n    color: @backgroundHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .disabled-text {\n    color: @backgroundHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .divider {\n    color: @backgroundHue3Contrast4;\n}\n\n/* Background foreground */\n[md-theme="@themeName"] .md-background-fg {\n    color: @backgroundDefaultColor !important;\n}\n\n/* Background foreground, Hue-1 */\n[md-theme="@themeName"] .md-background-fg.md-hue-1 {\n    color: @backgroundHue1Color !important;\n}\n\n/* Background foreground, Hue-2 */\n[md-theme="@themeName"] .md-background-fg.md-hue-2 {\n    color: @backgroundHue2Color !important;\n}\n\n/* Background foreground, Hue-3 */\n[md-theme="@themeName"] .md-background-fg.md-hue-3 {\n    color: @backgroundHue3Color !important;\n}'.replace(a,function(e){return t[e]}),s=angular.element("head"),(o=angular.element('<style type="text/css"></style>')).html(i),s.append(o)})},rgba:l};function l(e,n){var t=n||!1;return 4===e.length&&255===e[0]&&255===e[1]&&255===e[2]&&e.splice(3,4),t&&(e=function(e,n){var t={white:{1:"1",2:"0.7",3:"0.3",4:"0.12"},black:{1:"0.87",2:"0.54",3:"0.26",4:"0.12"}};255===e[0]&&255===e[1]&&255===e[2]?e[3]=t.white[n]:0===e[0]&&0===e[1]&&0===e[2]&&(e[3]=t.black[n]);return e}(e,t)),3===e.length?"rgb("+e.join(",")+")":4===e.length?"rgba("+e.join(",")+")":void a.error("Invalid number of arguments supplied in the color array: "+e.length+"\nThe array must have 3 or 4 colors.")}function d(e){return e.charAt(0).toUpperCase()+e.slice(1)}}e.$inject=["$cookies","$log","motionTheming"],angular.module("app.core").factory("motionGenerator",e)}(),function(){"use strict";angular.module("app.core").constant("motionPalettes",[{name:"motion-blue",options:{50:"#ebf1fa",100:"#c2d4ef",200:"#9ab8e5",300:"#78a0dc",400:"#5688d3",500:"#3470ca",600:"#2e62b1",700:"#275498",800:"#21467e",900:"#1a3865",A100:"#c2d4ef",A200:"#9ab8e5",A400:"#5688d3",A700:"#275498",contrastDefaultColor:"light",contrastDarkColors:"50 100 200 A100",contrastStrongLightColors:"300 400"}},{name:"motion-paleblue",options:{50:"#ececee",100:"#c5c6cb",200:"#9ea1a9",300:"#7d818c",400:"#5c616f",500:"#3c4252",600:"#353a48",700:"#2d323e",800:"#262933",900:"#1e2129",A100:"#c5c6cb",A200:"#9ea1a9",A400:"#5c616f",A700:"#2d323e",contrastDefaultColor:"light",contrastDarkColors:"50 100 200 A100",contrastStrongLightColors:"300 400"}}])}(),function(){"use strict";angular.module("app.core").constant("motionThemes",{default:{primary:{name:"motion-paleblue",hues:{default:"700","hue-1":"500","hue-2":"600","hue-3":"400"}},accent:{name:"light-blue",hues:{default:"600","hue-1":"400","hue-2":"700","hue-3":"A100"}},warn:{name:"red"},background:{name:"grey",hues:{default:"A100","hue-1":"A100","hue-2":"100","hue-3":"300"}}},pinkTheme:{primary:{name:"blue-grey",hues:{default:"800","hue-1":"600","hue-2":"400","hue-3":"A100"}},accent:{name:"pink",hues:{default:"400","hue-1":"300","hue-2":"600","hue-3":"A100"}},warn:{name:"blue"},background:{name:"grey",hues:{default:"A100","hue-1":"A100","hue-2":"100","hue-3":"300"}}},tealTheme:{primary:{name:"motion-blue",hues:{default:"900","hue-1":"600","hue-2":"500","hue-3":"A100"}},accent:{name:"teal",hues:{default:"500","hue-1":"400","hue-2":"600","hue-3":"A100"}},warn:{name:"deep-orange"},background:{name:"grey",hues:{default:"A100","hue-1":"A100","hue-2":"100","hue-3":"300"}}}})}(),function(){"use strict";function e(t,e,n){var a;angular.injector(["ngCookies"]).invoke(["$cookies",function(e){a=e}]);var i=a.getObject("motion.customTheme");i&&(n.custom=i),t.alwaysWatchTheme(!0),angular.forEach(e,function(e){t.definePalette(e.name,e.options)}),angular.forEach(n,function(e,n){t.theme(n).primaryPalette(e.primary.name,e.primary.hues).accentPalette(e.accent.name,e.accent.hues).warnPalette(e.warn.name,e.warn.hues).backgroundPalette(e.background.name,e.background.hues)})}e.$inject=["$mdThemingProvider","motionPalettes","motionThemes"],angular.module("app.core").config(e)}(),function(){"use strict";function e(n,t,e){var a={getRegisteredPalettes:function(){return e.PALETTES},getRegisteredThemes:function(){return e.THEMES},setActiveTheme:function(e){if(angular.isUndefined(a.themes.list[e]))return angular.isUndefined(a.themes.list.default)?void t.error('You must have at least one theme named "default"'):(t.warn('The theme "'+e+'" does not exist! Falling back to the "default" theme.'),a.themes.active.name="default",a.themes.active.theme=a.themes.list.default,void n.put("motion.selectedTheme",a.themes.active.name));a.themes.active.name=e,a.themes.active.theme=a.themes.list[e],n.put("motion.selectedTheme",e)},setThemesList:function(e){a.themes.list=e},themes:{list:{},active:{name:"",theme:{}}}};return a}e.$inject=["$cookies","$log","$mdTheming"],angular.module("app.core").service("motionTheming",e)}(),function(){"use strict";function e(n,s,o,r){this.search=function(n){for(var e=[],t=r.getFlatNavigation(),a=o.defer(),i=0;i<t.length;i+=1)t[i].uisref&&e.push(t[i]);n&&(e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(n)))return!0}));return s(function(){a.resolve(e)},1e3),a.promise},this.searchResultClick=function(e){e.uisref&&(e.stateParams?n.go(e.state,e.stateParams):n.go(e.state))}}e.$inject=["$state","$timeout","$q","msNavigationService"],angular.module("app.errors.error-404").controller("Error404Controller",e)}(),function(){"use strict";function e(e,n){var t=this;t.code="",t.send=!1,t.error=e.params,t.sendReport=function(){n.post("/api/jira",t.error).then(function(e){t.send=!0,e.data&&(t.code=e.data.id)},function(e){t.send=!1})}}e.$inject=["$state","$http"],angular.module("app.errors.error-500").controller("Error500Controller",e)}(),function(){"use strict";function e(e,n,t){var a=this;a.currentUser=e.getCurrentUser(),a.cookieAlertHide=n.get("motion.cookieAlertHide:"+a.currentUser.id)||!1,a.cookieAlertOnClose=function(){n.put("motion.cookieAlertHide:"+a.currentUser.id,!0)},a.onInit=function(){t.setting.get({id:1}).$promise.then(function(e){e&&(a.cookieAlertHide=!e.disabledCookie)})},a.onInit()}e.$inject=["Auth","$cookies","api"],angular.module("app.footer").controller("FooterController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.form={},s.forgotPassword=function(){return i.auth.forgot(s.form).$promise.then(function(){n.success({title:t.instant("FORGOTPASSWORD.LINK_SENT"),msg:t.instant("FORGOTPASSWORD.LINNK_SENT_MESSAGE")})}).catch(function(e){e&&n.error({title:t.instant("FORGOTPASSWORD.PASSWORD_RESET_ERROR"),msg:e.data?e.data.message||e.message||e:e.message||e})})},s.onInit=function(){e.isLoggedIn()&&a.go("app.dashboards.general")}}e.$inject=["Auth","toasty","$translate","$state","api"],angular.module("app.forgot").controller("ForgotPasswordController",e)}(),function(){"use strict";function e(e,n){var t=this;t.currentUser=e.getCurrentUser(),t.newsAlertHide=n.get("motion.newsAlertHide:"+t.currentUser.id)||!1,t.newsAlertOnClose=function(){n.put("motion.newsAlertHide:"+t.currentUser.id,!0)}}e.$inject=["Auth","$cookies"],angular.module("app.header").controller("HeaderController",e)}(),function(){"use strict";function e(e,o){var r={getResourcesByRole:function(e,n,t,a,i,s){return o.getResources(r,e,n,t,a,i,s)}};return r.baseUrl="api/",r.auth=e(r.baseUrl+"auth/local",{},{local:{method:"post",url:r.baseUrl+"auth/local"},forgot:{method:"post",url:r.baseUrl+"auth/local/forgot"},reset:{method:"post",url:r.baseUrl+"auth/local/reset/:token",params:{token:"@token"}},user:{method:"get",url:r.baseUrl+"auth/local/user/:token",params:{token:"@token"}},google:{method:"post",url:r.baseUrl+"auth/google"},activedirectory:{method:"post",url:r.baseUrl+"auth/activedirectory"}}),r.jira=e(r.baseUrl+"jira"),r.rpc=e(r.baseUrl+"rpc",{},{startMonitor:{method:"get",url:r.baseUrl+"rpc/voice/channels/:uniqueid/mixmonitor",params:{uniqueid:"@uniqueid"}},stopMonitor:{method:"get",url:r.baseUrl+"rpc/voice/channels/:uniqueid/stopmixmonitor",params:{uniqueid:"@uniqueid"}},getVoiceChannels:{method:"get",url:r.baseUrl+"rpc/voice/channels"},getVoiceQueues:{method:"get",url:r.baseUrl+"rpc/voice/queues"},getChatQueues:{method:"get",url:r.baseUrl+"rpc/chat/queues"},getMailQueues:{method:"get",url:r.baseUrl+"rpc/mail/queues"},getSmsQueues:{method:"get",url:r.baseUrl+"rpc/sms/queues"},getWhatsappQueues:{method:"get",url:r.baseUrl+"rpc/whatsapp/queues"},getOpenchannelQueues:{method:"get",url:r.baseUrl+"rpc/openchannel/queues"},getFaxQueues:{method:"get",url:r.baseUrl+"rpc/fax/queues"},getVoiceQueuesPreview:{method:"get",url:r.baseUrl+"rpc/voice/queues/preview/:id"},getVoiceQueuesChannels:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels"},getVoiceQueuesChannel:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels/:uniqueid"},getVoiceQueuesChannelHangup:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels/:uniqueid/hangup"},getVoiceQueuesChannelRedirect:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels/:uniqueid/redirect/:exten"},getOutbound:{method:"get",url:r.baseUrl+"rpc/outbound"},getOutboundChannels:{method:"get",url:r.baseUrl+"rpc/outbound/channels"},getAgents:{method:"get",url:r.baseUrl+"rpc/agents"},setAgentCapacity:{method:"put",url:r.baseUrl+"rpc/agents/:id/capacity",params:{id:"@id"}},getTelephones:{method:"get",url:r.baseUrl+"rpc/telephones"},getTrunks:{method:"get",url:r.baseUrl+"rpc/trunks"},getCampaigns:{method:"get",url:r.baseUrl+"rpc/campaigns"},getMailAccounts:{method:"get",url:r.baseUrl+"rpc/mail/accounts"},getFaxAccounts:{method:"get",url:r.baseUrl+"rpc/fax/accounts"},getChatQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/chat/queues/waitinginteractions"},getMailQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/mail/queues/waitinginteractions"},getOpenchannelQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/openchannel/queues/waitinginteractions"},getOpenchannelQueuesIdWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/openchannel/queues/:id/waitinginteractions"},getSmsQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/sms/queues/waitinginteractions"},getFaxQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/fax/queues/waitinginteractions"},getWhatsappQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/whatsapp/queues/waitinginteractions"},mailQueueNotify:{method:"post",url:r.baseUrl+"rpc/mail/queues/:id/notify",params:{id:"@id"}},chatQueueNotify:{method:"post",url:r.baseUrl+"rpc/chat/queues/:id/notify",params:{id:"@id"}},faxQueueNotify:{method:"post",url:r.baseUrl+"rpc/fax/queues/:id/notify",params:{id:"@id"}},smsQueueNotify:{method:"post",url:r.baseUrl+"rpc/sms/queues/:id/notify",params:{id:"@id"}},openchannelQueueNotify:{method:"post",url:r.baseUrl+"rpc/openchannel/queues/:id/notify",params:{id:"@id"}},agentNotify:{method:"post",url:r.baseUrl+"rpc/agents/:id/notify",params:{id:"@id"}}}),r.version=e(r.baseUrl+"version",{},{fetch:{method:"get",url:r.baseUrl+"version/fetch"},reset:{method:"get",url:r.baseUrl+"version/reset"},pull:{method:"get",url:r.baseUrl+"version/pull"},restart:{method:"get",url:r.baseUrl+"version/restart"},migrations:{method:"get",url:r.baseUrl+"version/migrations"}}),r.system=e(r.baseUrl+"system",{},{killProcess:{method:"get",url:r.baseUrl+"system/process/:pid/kill",params:{pid:"@pid"}}}),r.pm2=e(r.baseUrl+"pm2/:id",{id:"@id"},{update:{method:"put",isArray:!0}}),r.user=e(r.baseUrl+"users/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"users/describe"},clone:{method:"post",url:r.baseUrl+"users/:id/clone",params:{includeAll:"@includeAll"}},addContacts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/contacts"},bulkCreate:{isArray:!1,method:"post",url:r.baseUrl+"users/create_many"},changePassword:{isArray:!1,method:"put",url:r.baseUrl+"users/:id/password"},addQueues:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/queues"},removeQueues:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/queues"},addAvatar:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/avatar"},getAvatar:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/avatar"},getOpenTabs:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/open_tabs"},getContacts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/contacts"},getQueues:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/queues"},getVoiceQueuesRt:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/queues_rt"},getGroups:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/groups"},getRecordings:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/recordings"},getScreenRecordings:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/screen_recordings"},getChatInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/chat/interactions"},getOpenchannelInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/openchannel/interactions"},getMailInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/mail/interactions"},getSmsInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/sms/interactions"},getFaxInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/fax/interactions"},getWhatsappInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/whatsapp/interactions"},login:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/login"},logout:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/logout"},pause:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/pause"},unpause:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/unpause"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/teams"},getLists:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/lists"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/agents"},addChatInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/chat_interactions"},removeChatInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/chat_interactions"},addMailInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/mail_interactions"},removeMailInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/mail_interactions"},addFaxInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/fax_interactions"},removeFaxInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/fax_interactions"},addSmsInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/sms_interactions"},removeSmsInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/sms_interactions"},addOpenchannelInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/openchannel_interactions"},removeOpenchannelInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/openchannel_interactions"},addWhatsappInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/whatsapp_interactions"},removeWhatsappInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/whatsapp_interactions"},getVoicePrefixes:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/prefixes"},getFaxAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/fax_accounts"},addFaxAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/fax_accounts"},removeFaxAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/fax_accounts"},getMailAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/mail_accounts"},addMailAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/mail_accounts"},removeMailAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/mail_accounts"},getOpenchannelAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/openchannel_accounts"},addOpenchannelAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/openchannel_accounts"},removeOpenchannelAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/openchannel_accounts"},getSmsAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/sms_accounts"},addSmsAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/sms_accounts"},removeSmsAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/sms_accounts"},getChatWebsites:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/chat_websites"},addChatWebsites:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/chat_websites"},removeChatWebsites:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/chat_websites"},getWhatsappAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/whatsapp_accounts"},addWhatsappAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/whatsapp_accounts"},removeWhatsappAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/whatsapp_accounts"},getSquareProjects:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/square_projects"},addSquareProjects:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/square_projects"},removeSquareProjects:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/square_projects"},getScheduledCalls:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/scheduled_calls"},getApiKey:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/api_key"},createApiKey:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/api_key"},removeApiKey:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/api_key"},whoami:{isArray:!1,method:"get",url:r.baseUrl+"users/whoami"},getPresence:{isArray:!1,method:"get",url:r.baseUrl+"users/presence"}}),r.voiceChanSpy=e(r.baseUrl+"voice/chanspy/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/chanspy/describe"},clone:{method:"post",url:r.baseUrl+"voice/chanspy/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceContext=e(r.baseUrl+"voice/contexts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/contexts/describe"},clone:{method:"post",url:r.baseUrl+"voice/contexts/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceExtension=e(r.baseUrl+"voice/extensions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/extensions/describe"},clone:{method:"post",url:r.baseUrl+"voice/extensions/:id/clone",params:{includeAll:"@includeAll"}},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"voice/extensions/:id/applications"}}),r.voiceMusicOnHold=e(r.baseUrl+"voice/mohs/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/mohs/describe"},clone:{method:"post",url:r.baseUrl+"voice/mohs/:id/clone",params:{includeAll:"@includeAll"}},addSound:{isArray:!1,method:"post",url:r.baseUrl+"voice/mohs/:id/sounds"},removeSound:{isArray:!1,method:"delete",url:r.baseUrl+"voice/mohs/:id/sounds/:id2"},getSounds:{isArray:!1,method:"get",url:r.baseUrl+"voice/mohs/:id/sounds"}}),r.voiceQueue=e(r.baseUrl+"voice/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/queues/describe"},clone:{method:"post",url:r.baseUrl+"voice/queues/:id/clone",params:{includeAll:"@includeAll"}},getHoppers:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hopper_finals"},getHopperBlacks:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hopper_black"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"voice/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"voice/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/users"},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/members"},getLists:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/lists"},addLists:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/lists"},removeLists:{isArray:!0,method:"delete",url:r.baseUrl+"voice/queues/:id/lists"},getBlackLists:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/blacklists"},addBlackLists:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/blacklists"},removeBlackLists:{isArray:!0,method:"delete",url:r.baseUrl+"voice/queues/:id/blacklists"}}),r.voiceRecording=e(r.baseUrl+"voice/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/recordings/describe"},clone:{method:"post",url:r.baseUrl+"voice/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"voice/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},downloads:{isArray:!1,method:"get",url:r.baseUrl+"voice/recordings/:id/downloads"},runTranscribe:{isArray:!1,method:"post",url:r.baseUrl+"voice/recordings/:id/transcribe"},downloadTranscribe:{isArray:!1,method:"get",url:r.baseUrl+"voice/recordings/:id/transcribe",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.screenRecording=e(r.baseUrl+"screen/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"screen/recordings/describe"},clone:{method:"post",url:r.baseUrl+"screen/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"screen/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.voiceMail=e(r.baseUrl+"voice/mails/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/mails/describe"},clone:{method:"post",url:r.baseUrl+"voice/mails/:id/clone",params:{includeAll:"@includeAll"}},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"voice/mails/:id/messages"}}),r.voiceMailMessage=e(r.baseUrl+"voice/mails/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/mails/messages/describe"},clone:{method:"post",url:r.baseUrl+"voice/mails/messages/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"voice/mails/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.voiceCallReport=e(r.baseUrl+"voice/calls/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/calls/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/calls/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceDialReport=e(r.baseUrl+"voice/dials/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/dials/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/dials/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceAgentReport=e(r.baseUrl+"voice/agents/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/agents/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/agents/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceQueueReport=e(r.baseUrl+"voice/queues/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/queues/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/queues/reports/:id/clone",params:{includeAll:"@includeAll"}},getVoiceQueuesReport:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/reports/index"}}),r.memberReport=e(r.baseUrl+"members/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"members/reports/describe"},clone:{method:"post",url:r.baseUrl+"members/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.trunk=e(r.baseUrl+"trunks/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"trunks/describe"},clone:{method:"post",url:r.baseUrl+"trunks/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceTransferReport=e(r.baseUrl+"voice/transfers/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/transfers/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/transfers/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailServerOut=e(r.baseUrl+"mail/out_servers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/out_servers/describe"},clone:{method:"post",url:r.baseUrl+"mail/out_servers/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailAccount=e(r.baseUrl+"mail/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/accounts/describe"},clone:{method:"post",url:r.baseUrl+"mail/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/canned_answers"},getImap:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/in_servers"},addImap:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/in_servers"},removeImap:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/in_servers"},getSmtp:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/out_servers"},addSmtp:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/out_servers"},removeSmtp:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/out_servers"},addInteraction:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/applications"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/messages"},send:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/send"},verifySmtp:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/verify"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"mail/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/users"}}),r.mailQueue=e(r.baseUrl+"mail/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/queues/describe"},clone:{method:"post",url:r.baseUrl+"mail/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"mail/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"mail/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"mail/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"mail/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"mail/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"mail/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"mail/queues/:id/users"}}),r.mailSubstatus=e(r.baseUrl+"mail/substatuses/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/substatuses/describe"},clone:{method:"post",url:r.baseUrl+"mail/substatuses/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailInteraction=e(r.baseUrl+"mail/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/interactions/describe"},clone:{method:"post",url:r.baseUrl+"mail/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"mail/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"mail/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"mail/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"mail/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"mail/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.mailMessage=e(r.baseUrl+"mail/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/messages/describe"},clone:{method:"post",url:r.baseUrl+"mail/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"mail/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"mail/messages/:id/reject"},download:{isArray:!1,method:"get",url:r.baseUrl+"mail/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.mailApplication=e(r.baseUrl+"mail/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/applications/describe"},clone:{method:"post",url:r.baseUrl+"mail/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailQueueReport=e(r.baseUrl+"mail/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"mail/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.dashboard=e(r.baseUrl+"dashboards/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"dashboards/describe"},clone:{method:"post",url:r.baseUrl+"dashboards/:id/clone",params:{includeAll:"@includeAll"}},addItem:{isArray:!1,method:"post",url:r.baseUrl+"dashboards/:id/items"},getItems:{isArray:!1,method:"get",url:r.baseUrl+"dashboards/:id/items"}}),r.dashboardItem=e(r.baseUrl+"dashboards/items/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"dashboards/items/describe"},clone:{method:"post",url:r.baseUrl+"dashboards/items/:id/clone",params:{includeAll:"@includeAll"}}}),r.faxAccount=e(r.baseUrl+"fax/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/accounts/describe"},clone:{method:"post",url:r.baseUrl+"fax/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"fax/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"fax/accounts/:id/canned_answers"},addInteraction:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/applications"},addAccountApplications:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/addaccountapplications"},updateAccountApplications:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/updateaccountapplications"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/messages"},send:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/send"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"fax/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"fax/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/users"}}),r.faxApplication=e(r.baseUrl+"fax/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/applications/describe"},clone:{method:"post",url:r.baseUrl+"fax/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.faxInteraction=e(r.baseUrl+"fax/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/interactions/describe"},clone:{method:"post",url:r.baseUrl+"fax/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"fax/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"fax/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"fax/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"fax/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"fax/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.faxMessage=e(r.baseUrl+"fax/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/messages/describe"},clone:{method:"post",url:r.baseUrl+"fax/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"fax/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"fax/messages/:id/reject"},download:{isArray:!1,method:"get",url:r.baseUrl+"fax/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.faxQueue=e(r.baseUrl+"fax/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/queues/describe"},clone:{method:"post",url:r.baseUrl+"fax/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"fax/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"fax/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"fax/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"fax/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"fax/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"fax/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"fax/queues/:id/users"}}),r.faxQueueReport=e(r.baseUrl+"fax/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"fax/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.smsAccount=e(r.baseUrl+"sms/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/accounts/describe"},clone:{method:"post",url:r.baseUrl+"sms/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"sms/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"sms/accounts/:id/canned_answers"},notify:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/notify"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/applications"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/interactions"},send:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/send"},status:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/status"},statusGet:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/status"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"sms/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"sms/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/users"}}),r.smsApplication=e(r.baseUrl+"sms/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/applications/describe"},clone:{method:"post",url:r.baseUrl+"sms/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.smsInteraction=e(r.baseUrl+"sms/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/interactions/describe"},clone:{method:"post",url:r.baseUrl+"sms/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"sms/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"sms/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"sms/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"sms/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"sms/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.smsMessage=e(r.baseUrl+"sms/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/messages/describe"},clone:{method:"post",url:r.baseUrl+"sms/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"sms/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"sms/messages/:id/reject"},status:{isArray:!1,method:"post",url:r.baseUrl+"sms/messages/:id/status"}}),r.smsQueue=e(r.baseUrl+"sms/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/queues/describe"},clone:{method:"post",url:r.baseUrl+"sms/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"sms/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"sms/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"sms/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"sms/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"sms/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"sms/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"sms/queues/:id/users"}}),r.openchannelAccount=e(r.baseUrl+"openchannel/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/accounts/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/accounts/:id/canned_answers"},notify:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/notify"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/applications"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/interactions"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"openchannel/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/users"},send:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/send"}}),r.openchannelApplication=e(r.baseUrl+"openchannel/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/applications/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.openchannelInteraction=e(r.baseUrl+"openchannel/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/interactions/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.openchannelMessage=e(r.baseUrl+"openchannel/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/messages/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"openchannel/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"openchannel/messages/:id/reject"}}),r.openchannelQueue=e(r.baseUrl+"openchannel/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/queues/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"openchannel/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"openchannel/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/queues/:id/users"}}),r.chatWebsite=e(r.baseUrl+"chat/websites/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/websites/describe"},clone:{method:"post",url:r.baseUrl+"chat/websites/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"chat/websites/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"chat/websites/:id/canned_answers"},addLogo:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/logo"},addAvatar:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/avatar"},addCustomerAvatar:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/customer_avatar"},addSystemAvatar:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/system_avatar"},getLogo:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/logo"},getAvatar:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/avatar"},getCustomerAvatar:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/customer_avatar"},getSystemAvatar:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/system_avatar"},notify:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/notify"},offline:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/offline"},addInteraction:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/interactions"},getSnippet:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/snippet"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/applications"},addProactiveActions:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/proactive_actions"},getProactiveActions:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/proactive_actions"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/fields"},getOfflineMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/offline_messages"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"chat/websites/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"chat/websites/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/users"}}),r.openchannelQueueReport=e(r.baseUrl+"openchannel/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatApplication=e(r.baseUrl+"chat/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/applications/describe"},clone:{method:"post",url:r.baseUrl+"chat/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatInteraction=e(r.baseUrl+"chat/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/interactions/describe"},clone:{method:"post",url:r.baseUrl+"chat/interactions/:id/clone",params:{includeAll:"@includeAll"}},createVidaooSession:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/vidaoo"},customUpdate:{isArray:!1,method:"put",url:r.baseUrl+"chat/interactions/:id/custom_update"},abandon:{isArray:!1,method:"put",url:r.baseUrl+"chat/interactions/:id/abandon"},attachmentUpload:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/attachment_upload"},attachmentDownload:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/attachment_download"},close:{isArray:!1,method:"put",url:r.baseUrl+"chat/interactions/:id/close"},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/messages"},getMyMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/my_messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"chat/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.chatMessage=e(r.baseUrl+"chat/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/messages/describe"},clone:{method:"post",url:r.baseUrl+"chat/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"chat/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"chat/messages/:id/reject"}}),r.chatOfflineMessage=e(r.baseUrl+"chat/offline_messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/offline_messages/describe"},clone:{method:"post",url:r.baseUrl+"chat/offline_messages/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatQueue=e(r.baseUrl+"chat/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/queues/describe"},clone:{method:"post",url:r.baseUrl+"chat/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"chat/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"chat/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"chat/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"chat/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"chat/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"chat/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"chat/queues/:id/users"}}),r.chatGroup=e(r.baseUrl+"chat/groups/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/groups/describe"},clone:{method:"post",url:r.baseUrl+"chat/groups/:id/clone",params:{includeAll:"@includeAll"}},getUnread:{isArray:!1,method:"get",url:r.baseUrl+"chat/groups/:id/unread"},addMembers:{isArray:!0,method:"post",url:r.baseUrl+"chat/groups/:id/members"},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"chat/groups/:id/members"},removeMembers:{isArray:!1,method:"delete",url:r.baseUrl+"chat/groups/:id/members"},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"chat/groups/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/groups/:id/messages"}}),r.chatProactiveAction=e(r.baseUrl+"chat/proactive_actions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/proactive_actions/describe"},clone:{method:"post",url:r.baseUrl+"chat/proactive_actions/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmCompany=e(r.baseUrl+"cm/companies/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/companies/describe"},clone:{method:"post",url:r.baseUrl+"cm/companies/:id/clone",params:{includeAll:"@includeAll"}},addContacts:{isArray:!1,method:"post",url:r.baseUrl+"cm/companies/:id/contacts"},getContacts:{isArray:!1,method:"get",url:r.baseUrl+"cm/companies/:id/contacts"}}),r.cmContact=e(r.baseUrl+"cm/contacts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/contacts/describe"},clone:{method:"post",url:r.baseUrl+"cm/contacts/:id/clone",params:{includeAll:"@includeAll"}},merge:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/merge"},bulkCreate:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/create_many"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/tags"},setAdditionalPhones:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/phones"},getAdditionalPhones:{isArray:!0,method:"get",url:r.baseUrl+"cm/contacts/:id/phones"},duplicateAdditionalPhones:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/duplicateAdditionalPhones"},rescheduleAdditionalPhones:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/rescheduleAdditionalPhones"},getHoppers:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/hopper_finals"},getJscriptySessions:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/jscripty_sessions"},uploadCsv:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/csv"},upload:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/upload"},import:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/upload/:id"},importUpdates:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/uploadUpdates/:id"},getJourney:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/journey"}}),r.cmHopper=e(r.baseUrl+"cm/hopper/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper/:id/clone",params:{includeAll:"@includeAll"}},getPreview:{isArray:!1,method:"post",url:r.baseUrl+"cm/hopper/preview"},getPreviewRecall:{isArray:!1,method:"get",url:r.baseUrl+"cm/hopper/:id/previewrecall"},getOpenContacts:{isArray:!1,method:"get",url:r.baseUrl+"cm/hopper/opencontacts"},getTimezones:{isArray:!1,method:"get",url:r.baseUrl+"cm/hopper/timezones"},getTimezone:{isArray:!1,method:"post",url:r.baseUrl+"cm/hopper/timezone"}}),r.cmHopperBlack=e(r.baseUrl+"cm/hopper_black/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper_black/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper_black/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmHopperFinal=e(r.baseUrl+"cm/hopper_final/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper_final/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper_final/:id/clone",params:{includeAll:"@includeAll"}},countContactsQueueCampaignHopperFinal:{isArray:!0,method:"get",url:r.baseUrl+"cm/hopper_final/voice/queue/countAttributes/:id"},countContactsIvrCampaignHopperFinal:{isArray:!0,method:"get",url:r.baseUrl+"cm/hopper_final/campaign/countAttributes/:id"},moveContactsQueueCampaignHopperFinal:{isArray:!0,method:"post",url:r.baseUrl+"cm/hopper_final/voice/queue/moveContacts/:id"},moveContactsIvrCampaignHopperFinal:{isArray:!0,method:"post",url:r.baseUrl+"cm/hopper_final/voice/campaign/moveContacts/:id"},checkContactHopper:{isArray:!1,method:"post",url:r.baseUrl+"cm/hopper_final/checkContactHopper"}}),r.cmHopperHistory=e(r.baseUrl+"cm/hopper_history/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper_history/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper_history/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmCustomField=e(r.baseUrl+"cm/custom_fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/custom_fields/describe"},clone:{method:"post",url:r.baseUrl+"cm/custom_fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.action=e(r.baseUrl+"actions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"actions/describe"},clone:{method:"post",url:r.baseUrl+"actions/:id/clone",params:{includeAll:"@includeAll"}}}),r.automation=e(r.baseUrl+"automations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"automations/describe"},clone:{method:"post",url:r.baseUrl+"automations/:id/clone",params:{includeAll:"@includeAll"}},addConditions:{isArray:!1,method:"post",url:r.baseUrl+"automations/:id/conditions"},getConditions:{isArray:!1,method:"get",url:r.baseUrl+"automations/:id/conditions"},addActions:{isArray:!1,method:"post",url:r.baseUrl+"automations/:id/actions"},getActions:{isArray:!1,method:"get",url:r.baseUrl+"automations/:id/actions"}}),r.cannedAnswer=e(r.baseUrl+"canned_answers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"canned_answers/describe"},clone:{method:"post",url:r.baseUrl+"canned_answers/:id/clone",params:{includeAll:"@includeAll"}}}),r.disposition=e(r.baseUrl+"dispositions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"dispositions/describe"},clone:{method:"post",url:r.baseUrl+"dispositions/:id/clone",params:{includeAll:"@includeAll"}}}),r.condition=e(r.baseUrl+"conditions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"conditions/describe"},clone:{method:"post",url:r.baseUrl+"conditions/:id/clone",params:{includeAll:"@includeAll"}}}),r.interval=e(r.baseUrl+"intervals/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"intervals/describe"},clone:{method:"post",url:r.baseUrl+"intervals/:id/clone",params:{includeAll:"@includeAll"}},addInterval:{isArray:!1,method:"post",url:r.baseUrl+"intervals/:id/sub_intervals"},getIntervals:{isArray:!1,method:"get",url:r.baseUrl+"intervals/:id/sub_intervals"},addIntervals:{isArray:!0,method:"post",url:r.baseUrl+"intervals/:id/sub_intervals/create_many"}}),r.pause=e(r.baseUrl+"pauses/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"pauses/describe"},clone:{method:"post",url:r.baseUrl+"pauses/:id/clone",params:{includeAll:"@includeAll"}}}),r.cdr=e(r.baseUrl+"cdr/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cdr/describe"},clone:{method:"post",url:r.baseUrl+"cdr/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceQueuesLog=e(r.baseUrl+"voiceQueuesLog/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voiceQueuesLog/describe"},clone:{method:"post",url:r.baseUrl+"voiceQueuesLog/:id/clone",params:{includeAll:"@includeAll"}}}),r.schedule=e(r.baseUrl+"schedules/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"schedules/describe"},clone:{method:"post",url:r.baseUrl+"schedules/:id/clone",params:{includeAll:"@includeAll"}},run:{isArray:!1,method:"get",url:r.baseUrl+"schedules/:id/run"}}),r.sound=e(r.baseUrl+"sounds/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sounds/describe"},clone:{method:"post",url:r.baseUrl+"sounds/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"sounds/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},delete:{isArray:!1,method:"delete",url:r.baseUrl+"sounds/:id"}}),r.tag=e(r.baseUrl+"tags/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"tags/describe"},clone:{method:"post",url:r.baseUrl+"tags/:id/clone",params:{includeAll:"@includeAll"}}}),r.contactItemType=e(r.baseUrl+"contact_item_types/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"contact_item_types/describe"},clone:{method:"post",url:r.baseUrl+"contact_item_types/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmContactHasItem=e(r.baseUrl+"cm_contact_has_items/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm_contact_has_items/describe"},clone:{method:"post",url:r.baseUrl+"cm_contact_has_items/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmHopperAdditionalPhone=e(r.baseUrl+"cm_hopper_additional_phones/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm_hopper_additional_phones/describe"},clone:{method:"post",url:r.baseUrl+"cm_hopper_additional_phones/:id/clone",params:{includeAll:"@includeAll"}}}),r.template=e(r.baseUrl+"templates/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"templates/describe"},clone:{method:"post",url:r.baseUrl+"templates/:id/clone",params:{includeAll:"@includeAll"}}}),r.trigger=e(r.baseUrl+"triggers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"triggers/describe"},clone:{method:"post",url:r.baseUrl+"triggers/:id/clone",params:{includeAll:"@includeAll"}},addAllCondition:{isArray:!1,method:"post",url:r.baseUrl+"triggers/:id/all_conditions"},addAnyCondition:{isArray:!1,method:"post",url:r.baseUrl+"triggers/:id/any_conditions"},getAllConditions:{isArray:!1,method:"get",url:r.baseUrl+"triggers/:id/all_conditions"},getAnyConditions:{isArray:!1,method:"get",url:r.baseUrl+"triggers/:id/any_conditions"},addAction:{isArray:!1,method:"post",url:r.baseUrl+"triggers/:id/actions"},getActions:{isArray:!1,method:"get",url:r.baseUrl+"triggers/:id/actions"}}),r.variable=e(r.baseUrl+"variables/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"variables/describe"},clone:{method:"post",url:r.baseUrl+"variables/:id/clone",params:{includeAll:"@includeAll"}}}),r.integration=e(r.baseUrl+"integrations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/:id/clone",params:{includeAll:"@includeAll"}}}),r.integrationReport=e(r.baseUrl+"integrations/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/reports/describe"},clone:{method:"post",url:r.baseUrl+"integrations/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.analyticCustomReport=e(r.baseUrl+"analytics/custom_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/custom_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/custom_reports/:id/clone",params:{includeAll:"@includeAll"}},preview:{isArray:!0,method:"get",url:r.baseUrl+"analytics/custom_reports/:id/preview"},run:{isArray:!1,method:"get",url:r.baseUrl+"analytics/custom_reports/:id/run"},query:{isArray:!1,method:"get",url:r.baseUrl+"analytics/custom_reports/:id/query"}}),r.analyticDefaultReport=e(r.baseUrl+"analytics/default_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/default_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/default_reports/:id/clone",params:{includeAll:"@includeAll"}},preview:{isArray:!0,method:"get",url:r.baseUrl+"analytics/default_reports/:id/preview"},run:{isArray:!1,method:"get",url:r.baseUrl+"analytics/default_reports/:id/run"},query:{isArray:!1,method:"get",url:r.baseUrl+"analytics/default_reports/:id/query"}}),r.analyticExtractedReport=e(r.baseUrl+"analytics/extracted_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/extracted_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/extracted_reports/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"analytics/extracted_reports/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.analyticMetric=e(r.baseUrl+"analytics/metrics/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/metrics/describe"},clone:{method:"post",url:r.baseUrl+"analytics/metrics/:id/clone",params:{includeAll:"@includeAll"}}}),r.analyticFieldReport=e(r.baseUrl+"analytics/field_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/field_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/field_reports/:id/clone",params:{includeAll:"@includeAll"}},bulkCreate:{method:"post",url:r.baseUrl+"analytics/field_reports/create_many",isArray:!0},bulkDestroy:{method:"delete",url:r.baseUrl+"analytics/field_reports/destroy_many",isArray:!0},addFields:{isArray:!0,method:"post",url:r.baseUrl+"analytics/field_reports/:id/create_many"}}),r.analyticTreeReport=e(r.baseUrl+"analytics/tree_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/tree_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/tree_reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.intSalesforceAccount=e(r.baseUrl+"integrations/salesforce/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/salesforce/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/salesforce/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/salesforce/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/accounts/:id/fields"}}),r.intSalesforceConfiguration=e(r.baseUrl+"integrations/salesforce/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/salesforce/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/salesforce/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/configurations/:id/descriptions"}}),r.intSalesforceField=e(r.baseUrl+"integrations/salesforce/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/salesforce/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/salesforce/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intSugarcrmAccount=e(r.baseUrl+"integrations/sugarcrm/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/sugarcrm/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/fields"}}),r.intSugarcrmConfiguration=e(r.baseUrl+"integrations/sugarcrm/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/descriptions"}}),r.intSugarcrmField=e(r.baseUrl+"integrations/sugarcrm/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/sugarcrm/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/sugarcrm/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intDeskAccount=e(r.baseUrl+"integrations/desk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/desk/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/desk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/desk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/accounts/:id/fields"}}),r.intDeskConfiguration=e(r.baseUrl+"integrations/desk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/desk/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/desk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"integrations/desk/configurations/:id/tags"}}),r.intDeskField=e(r.baseUrl+"integrations/desk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/desk/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/desk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intZohoAccount=e(r.baseUrl+"integrations/zoho/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zoho/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zoho/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/zoho/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/accounts/:id/fields"}}),r.intZohoConfiguration=e(r.baseUrl+"integrations/zoho/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zoho/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zoho/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/configurations/:id/descriptions"}}),r.intZohoField=e(r.baseUrl+"integrations/zoho/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zoho/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zoho/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intZendeskAccount=e(r.baseUrl+"integrations/zendesk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zendesk/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zendesk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/zendesk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/accounts/:id/fields"}}),r.intZendeskConfiguration=e(r.baseUrl+"integrations/zendesk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zendesk/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zendesk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"integrations/zendesk/configurations/:id/tags"}}),r.intZendeskField=e(r.baseUrl+"integrations/zendesk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zendesk/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zendesk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intFreshdeskAccount=e(r.baseUrl+"integrations/freshdesk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshdesk/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshdesk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/freshdesk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/accounts/:id/fields"}}),r.intFreshdeskConfiguration=e(r.baseUrl+"integrations/freshdesk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshdesk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"integrations/freshdesk/configurations/:id/tags"}}),r.intFreshdeskField=e(r.baseUrl+"integrations/freshdesk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshdesk/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshdesk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intVtigerAccount=e(r.baseUrl+"integrations/vtiger/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/vtiger/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/vtiger/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/vtiger/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/accounts/:id/fields"}}),r.intVtigerConfiguration=e(r.baseUrl+"integrations/vtiger/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/vtiger/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/vtiger/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/configurations/:id/descriptions"}}),r.intVtigerField=e(r.baseUrl+"integrations/vtiger/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/vtiger/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/vtiger/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intServicenowAccount=e(r.baseUrl+"integrations/servicenow/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/servicenow/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/servicenow/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/servicenow/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/accounts/:id/fields"}}),r.intServicenowConfiguration=e(r.baseUrl+"integrations/servicenow/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/servicenow/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/servicenow/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/configurations/:id/descriptions"}}),r.intServicenowField=e(r.baseUrl+"integrations/servicenow/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/servicenow/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/servicenow/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intDynamics365Account=e(r.baseUrl+"integrations/dynamics365/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/dynamics365/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/dynamics365/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/dynamics365/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/accounts/:id/fields"}}),r.intDynamics365Configuration=e(r.baseUrl+"integrations/dynamics365/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/dynamics365/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/:id/descriptions"}}),r.intDynamics365Field=e(r.baseUrl+"integrations/dynamics365/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/dynamics365/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/dynamics365/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intFreshsalesAccount=e(r.baseUrl+"integrations/freshsales/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshsales/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshsales/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/freshsales/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/accounts/:id/fields"}}),r.intFreshsalesConfiguration=e(r.baseUrl+"integrations/freshsales/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshsales/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshsales/configurations/:id/clone",params:{includeAll:"@includeAll"}},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/configurations/:id/descriptions"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/configurations/:id/fields"}}),r.intFreshsalesField=e(r.baseUrl+"integrations/freshsales/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshsales/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshsales/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.network=e(r.baseUrl+"networks/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"networks/describe"},clone:{method:"post",url:r.baseUrl+"networks/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatQueueReport=e(r.baseUrl+"chat/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"chat/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatInternalMessage=e(r.baseUrl+"chat/internal/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/internal/messages/describe"},clone:{method:"post",url:r.baseUrl+"chat/internal/messages/:id/clone",params:{includeAll:"@includeAll"}},getUsers:{isArray:!1,method:"get",url:r.baseUrl+"chat/internal/messages/users"}}),r.jscriptyAnswerReport=e(r.baseUrl+"jscripty/answers/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/answers/reports/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/answers/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.jscriptyQuestionReport=e(r.baseUrl+"jscripty/questions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/questions/reports/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/questions/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.jscriptySessionReport=e(r.baseUrl+"jscripty/sessions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/sessions/reports/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/sessions/reports/:id/clone",params:{includeAll:"@includeAll"}},getQuestions:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/sessions/reports/:id/questions"}}),r.smsQueueReport=e(r.baseUrl+"sms/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"sms/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.squareReport=e(r.baseUrl+"square/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/reports/describe"},clone:{method:"post",url:r.baseUrl+"square/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.squareReportDetail=e(r.baseUrl+"square/details/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/details/reports/describe"},clone:{method:"post",url:r.baseUrl+"square/details/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.jscriptyProject=e(r.baseUrl+"jscripty/projects/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/projects/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/projects/:id/clone",params:{includeAll:"@includeAll"}},getSessions:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/projects/:id/sessions"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/projects/:id/answers"},getSummary:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/projects/:id/summary",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.setting=e(r.baseUrl+"settings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"settings/describe"},clone:{method:"post",url:r.baseUrl+"settings/:id/clone",params:{includeAll:"@includeAll"}},addLogo:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/logo"},addLogoLogin:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/logo_login"},getLogo:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/logo"},getLogoLogin:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/logo_login"},gdpr:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/gdpr"},addPreferred:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/preferred"},getPreferred:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/preferred"},addFavicon:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/favicon"},getFavicon:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/favicon"},getDate:{isArray:!1,method:"get",url:r.baseUrl+"settings/now"}}),r.squareOdbc=e(r.baseUrl+"square/odbc/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/odbc/describe"},clone:{method:"post",url:r.baseUrl+"square/odbc/:id/clone",params:{includeAll:"@includeAll"}},test:{isArray:!1,method:"get",url:r.baseUrl+"square/odbc/:id/test"}}),r.squareProject=e(r.baseUrl+"square/projects/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/projects/describe"},clone:{method:"post",url:r.baseUrl+"square/projects/:id/clone",params:{includeAll:"@includeAll"}},addUsers:{isArray:!0,method:"post",url:r.baseUrl+"square/projects/:id/users"},removeUsers:{isArray:!1,method:"delete",url:r.baseUrl+"square/projects/:id/users"},getUsers:{isArray:!1,method:"get",url:r.baseUrl+"square/projects/:id/users"}}),r.squareRecording=e(r.baseUrl+"square/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/recordings/describe"},clone:{method:"post",url:r.baseUrl+"square/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"square/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.squareMessage=e(r.baseUrl+"square/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/messages/describe"},clone:{method:"post",url:r.baseUrl+"square/messages/:id/clone",params:{includeAll:"@includeAll"}}}),r.team=e(r.baseUrl+"teams/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"teams/describe"},clone:{method:"post",url:r.baseUrl+"teams/:id/clone",params:{includeAll:"@includeAll"}},getQueues:{isArray:!0,method:"get",url:r.baseUrl+"teams/:id/queues"},addQueues:{isArray:!0,method:"post",url:r.baseUrl+"teams/:id/queues"},removeQueues:{isArray:!1,method:"delete",url:r.baseUrl+"teams/:id/queues"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"teams/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"teams/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"teams/:id/users"}}),r.license=e(r.baseUrl+"license/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"license/describe"},clone:{method:"post",url:r.baseUrl+"license/:id/clone",params:{includeAll:"@includeAll"}},downloadLogFile:{isArray:!1,method:"get",url:r.baseUrl+"license/download_log_file",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.campaign=e(r.baseUrl+"campaigns/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"campaigns/describe"},clone:{method:"post",url:r.baseUrl+"campaigns/:id/clone",params:{includeAll:"@includeAll"}},getHoppers:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hopper_finals"},getHopperBlacks:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hopper_black"},getLists:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/lists"},addLists:{isArray:!0,method:"post",url:r.baseUrl+"campaigns/:id/lists"},removeLists:{isArray:!0,method:"delete",url:r.baseUrl+"campaigns/:id/lists"},getBlackLists:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/blacklists"},addBlackLists:{isArray:!0,method:"post",url:r.baseUrl+"campaigns/:id/blacklists"},removeBlackLists:{isArray:!0,method:"delete",url:r.baseUrl+"campaigns/:id/blacklists"}}),r.migration=e(r.baseUrl+"migrations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"migrations/describe"},clone:{method:"post",url:r.baseUrl+"migrations/:id/clone",params:{includeAll:"@includeAll"}}}),r.attachment=e(r.baseUrl+"attachments/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"attachments/describe"},clone:{method:"post",url:r.baseUrl+"attachments/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"attachments/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.plugin=e(r.baseUrl+"plugins/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"plugins/describe"},clone:{method:"post",url:r.baseUrl+"plugins/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"plugins/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},upload:{isArray:!1,method:"post",url:r.baseUrl+"plugins/"},delete:{isArray:!1,method:"delete",url:r.baseUrl+"plugins/:id"},webhookGet:{isArray:!1,method:"get",url:r.baseUrl+"plugins/webhook"},webhookPost:{isArray:!1,method:"post",url:r.baseUrl+"plugins/webhook"}}),r.mailTransferReport=e(r.baseUrl+"mail/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"mail/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatTransferReport=e(r.baseUrl+"chat/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"chat/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.faxTransferReport=e(r.baseUrl+"fax/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"fax/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.openchannelTransferReport=e(r.baseUrl+"openchannel/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.smsTransferReport=e(r.baseUrl+"sms/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"sms/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmList=e(r.baseUrl+"cm/lists/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/lists/describe"},clone:{method:"post",url:r.baseUrl+"cm/lists/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"cm/lists/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"cm/lists/:id/dispositions"},addContacts:{isArray:!1,method:"post",url:r.baseUrl+"cm/lists/:id/contacts"},getContacts:{isArray:!0,method:"get",url:r.baseUrl+"cm/lists/:id/contacts"},getContactsCsv:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/contacts/csv",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},addCustomField:{isArray:!1,method:"post",url:r.baseUrl+"cm/lists/:id/fields"},getCustomFields:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/fields"},getGlobalCustomFields:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/global_fields"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"cm/lists/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"cm/lists/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/users"}}),r.voicePrefix=e(r.baseUrl+"voice/prefixes/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/prefixes/describe"},clone:{method:"post",url:r.baseUrl+"voice/prefixes/:id/clone",params:{includeAll:"@includeAll"}},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"voice/prefixes/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"voice/prefixes/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"voice/prefixes/:id/users"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"voice/prefixes/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"voice/prefixes/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"voice/prefixes/:id/teams"}}),r.userProfile=e(r.baseUrl+"userProfiles/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userProfiles/describe"},clone:{method:"post",url:r.baseUrl+"userProfiles/:id/clone",params:{includeAll:"@includeAll"}},addSections:{isArray:!0,method:"post",url:r.baseUrl+"userProfiles/:id/sections"},removeSections:{isArray:!1,method:"delete",url:r.baseUrl+"userProfiles/:id/sections"},getSections:{isArray:!0,method:"get",url:r.baseUrl+"userProfiles/:id/sections"},addResources:{isArray:!0,method:"post",url:r.baseUrl+"userProfiles/:id/resources"},removeResources:{isArray:!1,method:"delete",url:r.baseUrl+"userProfiles/:id/resources"},getResources:{isArray:!1,method:"get",url:r.baseUrl+"userProfiles/:id/resources"}}),r.userProfileSection=e(r.baseUrl+"userProfile/sections/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userProfile/sections/describe"},clone:{method:"post",url:r.baseUrl+"userProfile/sections/:id/clone",params:{includeAll:"@includeAll"}}}),r.userProfileResource=e(r.baseUrl+"userProfile/resources/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userProfile/resources/describe"},clone:{method:"post",url:r.baseUrl+"userProfile/resources/:id/clone",params:{includeAll:"@includeAll"}}}),r.userNotification=e(r.baseUrl+"userNotifications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userNotifications/describe"},clone:{method:"post",url:r.baseUrl+"userNotifications/:id/clone",params:{includeAll:"@includeAll"}},sendUserNotification:{isArray:!1,method:"post",url:r.baseUrl+"userNotifications/"}}),r.whatsappAccount=e(r.baseUrl+"whatsapp/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/accounts/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/accounts/:id/canned_answers"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/users"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/applications"},notify:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/notify"},send:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/send"}}),r.whatsappApplication=e(r.baseUrl+"whatsapp/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/applications/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.whatsappInteraction=e(r.baseUrl+"whatsapp/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/interactions/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.whatsappMessage=e(r.baseUrl+"whatsapp/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/messages/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"whatsapp/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"whatsapp/messages/:id/reject"},status:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/messages/:id/status"}}),r.whatsappQueueReport=e(r.baseUrl+"whatsapp/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.whatsappTransferReport=e(r.baseUrl+"whatsapp/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.whatsappQueue=e(r.baseUrl+"whatsapp/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/queues/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"whatsapp/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"whatsapp/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/queues/:id/users"}}),r.cloudProvider=e(r.baseUrl+"cloudProviders/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cloudProviders/describe"},clone:{method:"post",url:r.baseUrl+"cloudProviders/:id/clone",params:{includeAll:"@includeAll"}},oauth2MicrosoftAuthorize:{method:"get",url:r.baseUrl+"cloudProviders/:id/oauth2/microsoft/authorize"}}),r.realtime=e(r.baseUrl+"realtime",{},{getAgents:{isArray:!1,method:"get",url:r.baseUrl+"realtime/agents"},getQueues:{isArray:!1,method:"get",url:r.baseUrl+"realtime/queues"}}),r.userSetting=e(r.baseUrl+"user-settings/:id",{id:"@id"},{update:{method:"put",isArray:!1}}),r}e.$inject=["$resource","userProfileManager"],angular.module("motion").factory("api",e)}(),function(){"use strict";function e(e,n){n.setConfig({position:"top-right",sound:!1,html:!0,theme:"material"}),e.useLoader("$translatePartialLoader",{urlTemplate:"{part}/i18n/{lang}.json"}),e.preferredLanguage("en"),e.fallbackLanguage("en"),e.useSanitizeValueStrategy(null)}e.$inject=["$translateProvider","toastyConfigProvider"],angular.module("motion").config(e)}(),function(){"use strict";angular.module("motion")}(),function(){"use strict";function e(e,n,t,a){var i=this;i.themes=e.themes,i.direction="ltr";var s=t.get("motion.language");s&&(n.use(s),0<=["ar","fa","he"].indexOf(s)&&a.setting.get({id:1}).$promise.then(function(e){e&&e.rtlSupport&&(i.direction="rtl")}).catch(function(e){e&&toasty.error({title:"Error",msg:e.data?e.data.message||e.message||e:e.message||e})}))}e.$inject=["motionTheming","$translate","$cookies","api"],angular.module("motion").controller("IndexController",e)}(),function(){"use strict";function e(a,i){return function(e){var n=new Date,t=new Date(e);return t.getDate()===n.getDate()&&t.getMonth()===n.getMonth()&&t.getFullYear()===n.getFullYear()?a("date")(t.getTime(),"shortTime"):t.getDate()===n.getDate()-1&&t.getMonth()===n.getMonth()&&t.getFullYear()===n.getFullYear()?i.instant("DASHBOARDS.YESTERDAY")+" "+a("date")(t.getTime(),"shortTime"):a("date")(t.getTime(),"MMM d, y h:mm a")}}function n(e){return{Today:e.instant("DASHBOARDS.TODAY"),Yesterday:e.instant("DASHBOARDS.YESTERDAY"),"This Week":e.instant("DASHBOARDS.THIS_WEEK"),"Last Week":e.instant("DASHBOARDS.LAST_WEEK"),"This Month":e.instant("DASHBOARDS.THIS_MONTH"),"Last Month":e.instant("DASHBOARDS.LAST_MONTH"),"This Year":e.instant("DASHBOARDS.THIS_YEAR"),"Last Year":e.instant("DASHBOARDS.LAST_YEAR"),January:e.instant("DASHBOARDS.JANUARY"),February:e.instant("DASHBOARDS.FEBRUARY"),March:e.instant("DASHBOARDS.MARCH"),April:e.instant("DASHBOARDS.APRIL"),May:e.instant("DASHBOARDS.MAY"),June:e.instant("DASHBOARDS.JUNE"),July:e.instant("DASHBOARDS.JULY"),August:e.instant("DASHBOARDS.AUGUST"),September:e.instant("DASHBOARDS.SEPTEMBER"),October:e.instant("DASHBOARDS.OCTOBER"),November:e.instant("DASHBOARDS.NOVEMBER"),December:e.instant("DASHBOARDS.DECEMBER"),Mon:e.instant("DASHBOARDS.MON"),Tue:e.instant("DASHBOARDS.TUE"),Wed:e.instant("DASHBOARDS.WED"),Thu:e.instant("DASHBOARDS.THU"),Fri:e.instant("DASHBOARDS.FRI"),Sat:e.instant("DASHBOARDS.SAT"),Sun:e.instant("DASHBOARDS.SUN")}}e.$inject=["$filter","$translate"],n.$inject=["$translate"],angular.module("motion").filter("limitObjectFromTo",function(){return function(e,n,t){var a,i={},s=0;for(a in e)if(t<=s&&(i[a]=e[a]),++s===t+n)break;return i}}).filter("formatdate",e).factory("IndexFactory",function(){var e=[{value:"jan"},{value:"feb"},{value:"mar"},{value:"apr"},{value:"may"},{value:"jun"},{value:"jul"},{value:"aug"},{value:"sep"},{value:"oct"},{value:"nov"},{value:"dec"}],n=[{value:"1"},{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"10"},{value:"11"},{value:"12"}],t=[{value:"mon"},{value:"tue"},{value:"wed"},{value:"thu"},{value:"fri"},{value:"sat"},{value:"sun"}],a=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];return{getMonthName:function(){return e},getMonthNumber:function(){return n},getDaysOfWeek:function(){return t},getDaysOfMonth:function(){return a}}}).factory("dateFilterLocalizationFactory",n).factory("jscookie",function(){return Cookies}).factory("Sequence",function(){return{enqueue:function(e){this.tail=this.tail?this.tail.finally(e):e()}}})}(),function(){"use strict";function e(e,n,t){var a;t.html5Mode(!0),n.otherwise("/dashboards/general"),angular.injector(["ngCookies"]).invoke(["$cookies",function(e){a=e}]);var i=a.get("motion.layoutStyle")||"verticalNavigation",s={verticalNavigation:{main:"app/core/layouts/vertical-navigation.html",toolbar:"app/toolbar/layouts/vertical-navigation/toolbar.html",navigation:"app/navigation/layouts/vertical-navigation/navigation.html",header:"app/header/layouts/vertical-navigation/header.html",footer:"app/footer/layouts/vertical-navigation/footer.html"},verticalNavigationFullwidthToolbar:{main:"app/core/layouts/vertical-navigation-fullwidth-toolbar.html",toolbar:"app/toolbar/layouts/vertical-navigation-fullwidth-toolbar/toolbar.html",navigation:"app/navigation/layouts/vertical-navigation/navigation.html"},verticalNavigationFullwidthToolbar2:{main:"app/core/layouts/vertical-navigation-fullwidth-toolbar-2.html",toolbar:"app/toolbar/layouts/vertical-navigation-fullwidth-toolbar-2/toolbar.html",navigation:"app/navigation/layouts/vertical-navigation-fullwidth-toolbar-2/navigation.html"},horizontalNavigation:{main:"app/core/layouts/horizontal-navigation.html",toolbar:"app/toolbar/layouts/horizontal-navigation/toolbar.html",navigation:"app/navigation/layouts/horizontal-navigation/navigation.html"},contentOnly:{main:"app/core/layouts/content-only.html",toolbar:"",navigation:""},contentWithToolbar:{main:"app/core/layouts/content-with-toolbar.html",toolbar:"app/toolbar/layouts/content-with-toolbar/toolbar.html",navigation:""}};e.state("app",{abstract:!0,views:{"main@":{templateUrl:s[i].main,controller:"MainController as vm"},"toolbar@app":{templateUrl:s[i].toolbar,controller:"ToolbarController as vm"},"navigation@app":{templateUrl:s[i].navigation,controller:"NavigationController as vm"},"quickPanel@app":{templateUrl:"app/quick-panel/quick-panel.html",controller:"QuickPanelController as vm"},"header@app":{templateUrl:s[i].header,controller:"HeaderController as vm"},"footer@app":{templateUrl:s[i].footer,controller:"FooterController as vm"}},resolve:{license:["apiResolver",function(e){return e.resolve("license@get")}],setting:["apiResolver","settingsManager",function(e,n){return e.resolve("setting@get",{id:1}).then(function(e){return n.set(e),e})}]}})}e.$inject=["$stateProvider","$urlRouterProvider","$locationProvider"],angular.module("motion").config(e)}(),function(){"use strict";function e(e,n){e.onStart({},n.showLoadingIndicator),e.onFinish({},n.hideLoadingIndicator)}e.$inject=["$transitions","LoadingIndicatorService"],angular.module("motion").run(e)}(),function(){"use strict";function e(a,e){var i,o={};function s(){a.$broadcast("socket:connect"),i&&i.connected||(i=io({query:e.getCurrentUser()?"id="+e.getCurrentUser().id:void 0,transports:["websocket","polling"]})).once("disconnect",n)}function n(e){i.once("connect",s),"logout"===e?i.removeAllListeners():a.$broadcast("socket:disconnect"),i&&i.connected&&i.disconnect()}function r(e,n,t){o[e]||(o[e]=[]),o[e].push({wrapper:n,fn:t})}return{connect:s,disconnect:n,getListeners:function(e){return e?o[e]:o},on:function(e,n){n=n||angular.noop,i||s();var t=function(){var e=arguments;a.$applyAsync(function(){n.apply(i,e)})};r(e,t,n),i.on(e,t)},onWithoutApply:function(e,n){n=n||angular.noop,i||s();var t=function(){n.apply(i,arguments)};r(e,t,n),i.on(e,t)},emit:function(e,n,t){t=t||angular.noop,i||s(),i.emit(e,n,function(){var e=arguments;a.$applyAsync(function(){t.apply(i,e)})})},removeAllListeners:function(e){var n;i||s(),i.removeAllListeners(e),n=e,_.isEmpty(o[n])||delete o[n]},removeListener:function(e,n){i||s();var t=function(e,n){var t=o[e];if(!_.isEmpty(t))for(var a=0;a<t.length;a++){var i=t[a];if(i.fn===n){var s=i.wrapper;return t.splice(a,1),s}}}(e,n);i.removeListener(e,t)}}}e.$inject=["$rootScope","Auth"],angular.module("motion").factory("socket",e)}(),function(){"use strict";function e(n,t,e,a,i,s,o,r){var l=this;l.progresslogin=!1,l.googleSsoEnabled=!1,l.adSsoEnabled=!1,l.login=function(){return l.progresslogin=!0,l.message="",s.login(l.form).then(function(){return n.go("app.dashboards.general")}).catch(function(e){l.message=e.data?e.data.message:e.message}).finally(function(){l.progresslogin=!1})},l.loginOauth=function(e){l.message="",t.location.href=s.loginSSO(e)},l.loginAD=function(){return l.progresslogin=!0,l.message="",s.loginAD(l.form).then(function(){return n.go("app.dashboards.general")}).catch(function(e){l.message=e.data?e.data.message:e.message}).finally(function(){l.progresslogin=!1})},l.onInit=function(){{if(n.params.token&&n.params.userId)return s.removeCookies(),l.progresslogin=!0,o.secureCookieEnabled?r.set("motion.token",n.params.token,{secure:!0,sameSite:"none"}):r.set("motion.token",n.params.token),i.user.get({id:n.params.userId}).$promise.then(function(e){e&&(s.setCurrentUser(e),n.go("app.dashboards.general"))}).finally(function(){l.progresslogin=!1});s.isLoggedIn()&&n.go("app.dashboards.general")}l.googleSsoEnabled=o.googleSsoEnabled,l.adSsoEnabled=o.adSsoEnabled},l.onInit()}e.$inject=["$state","$window","$cookies","$timeout","api","Auth","setting","jscookie"],angular.module("app.login").controller("LoginController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="ANALYTICS.EDIT_EXTRACTEDREPORT",g.extractedReport=angular.copy(l),g.extractedReports=r,g.newExtractedReport=!1,g.extractedReport||(g.extractedReport={},g.title="ANALYTICS.NEW_EXTRACTEDREPORT",g.newExtractedReport=!0),g.addNewExtractedReport=function(){g.errors=[],d.analyticExtractedReport.save(g.extractedReport).$promise.then(function(e){g.extractedReports.unshift(e.toJSON()),o.success({title:"ExtractedReport properly created",msg:g.extractedReport.name?g.extractedReport.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticExtractedReport.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveExtractedReport=function(){g.errors=[],d.analyticExtractedReport.update({id:g.extractedReport.id},g.extractedReport).$promise.then(function(e){var n=_.find(g.extractedReports,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ExtractedReport properly saved!",msg:g.extractedReport.name?g.extractedReport.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticExtractedReport.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteExtractedReport=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The extractedReport will be deleted.").ariaLabel("Delete ExtractedReport").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.analyticExtractedReport.delete({id:g.extractedReport.id}).$promise.then(function(){_.remove(g.extractedReports,{id:g.extractedReport.id}),o.success({title:"ExtractedReport properly deleted!",msg:(g.extractedReport.name||"extractedReport")+" has been deleted!"}),v(g.extractedReport)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticExtractedReport.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","extractedReports","extractedReport","api","Auth","license","setting","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditExtractedReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.extractedReports=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="extractedReports",f.listOrder="",f.listOrderAsc=null,f.selectedExtractedReports=[],f.query={fields:"createdAt,updatedAt,id,name,basename,savename,type,startDate,endDate,status,output,reportId,reportType",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditExtractedReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/extractedReports/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{extractedReport:e,extractedReports:f.extractedReports.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.downloadfile2=function(s,e){return m.analyticExtractedReport.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.savename;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("extractedReport")+"?").htmlContent("<b>"+(e.name||"extractedReport")+"</b> will be deleted.").ariaLabel("delete extractedReport").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getExtractedReports=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.analyticExtractedReport.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ExtractedReports",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditExtractedReport=function(e,n){i.show({controller:"CreateOrEditExtractedReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/extractedReports/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{extractedReport:n,extractedReports:f.extractedReports.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteExtractedReport=y,f.exportSelectedExtractedReports=function(){var e=angular.copy(f.selectedExtractedReports);return f.selectedExtractedReports=[],e},f.deleteSelectedExtractedReports=function(e){var n=i.confirm().title("Are you sure want to delete the selected extractedReports?").htmlContent("<b>"+f.selectedExtractedReports.length+" selected</b> will be deleted.").ariaLabel("delete ExtractedReports").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedExtractedReports.forEach(function(e){y(e)}),f.selectedExtractedReports=[]})},f.deselectExtractedReports=function(){f.selectedExtractedReports=[]},f.selectAllExtractedReports=function(){f.selectedExtractedReports=f.extractedReports.rows};var b=!0,A=1;function E(e){f.extractedReports=e||{count:0,rows:[]}}function y(e){m.analyticExtractedReport.delete({id:e.id}).$promise.then(function(){_.remove(f.extractedReports.rows,{id:e.id}),f.extractedReports.count-=1,f.extractedReports.rows.length||f.getExtractedReports(),p.success({title:_.startCase("ExtractedReport")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEanalyticExtractedReport"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEanalyticExtractedReport",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getExtractedReports())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","extractedReports","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.analytics").controller("ExtractedReportsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="ANALYTICS.EDIT_METRIC",g.metric=angular.copy(l),g.metrics=r,g.newMetric=!1,g.metric||(g.metric={table:"report_agent"},g.title="ANALYTICS.NEW_METRIC",g.newMetric=!0),g.addNewMetric=function(){g.errors=[],d.analyticMetric.save(g.metric).$promise.then(function(e){g.metrics.unshift(e.toJSON()),o.success({title:"Metric properly created",msg:g.metric.name?g.metric.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticMetric.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticMetric.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMetric=function(){g.errors=[],d.analyticMetric.update({id:g.metric.id},g.metric).$promise.then(function(e){var n=_.find(g.metrics,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Metric properly saved!",msg:g.metric.name?g.metric.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticMetric.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticMetric.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMetric=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The metric will be deleted.").ariaLabel("Delete Metric").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.analyticMetric.delete({id:g.metric.id}).$promise.then(function(){_.remove(g.metrics,{id:g.metric.id}),o.success({title:"Metric properly deleted!",msg:(g.metric.name||"metric")+" has been deleted!"}),v(g.metric)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticMetric.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticMetric.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","metrics","metric","api","Auth","license","setting","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditMetricDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.metrics=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="metrics",f.listOrder="",f.listOrderAsc=null,f.selectedMetrics=[],f.query={fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,page:1},f.arraytable=_.keyBy([{option:"Agent Report",value:"'report_agent'"},{option:"Call Report",value:"'report_call'"},{option:"CDR",value:"'cdr'"},{option:"Chat Website",value:"'chat_websites'"},{option:"Chat Interaction",value:"'chat_interactions'"},{option:"Chat Messages",value:"'chat_messages'"},{option:"Chat Offline Messages",value:"'chat_offline_messages'"},{option:"Chat Queues",value:"'chat_queues'"},{option:"Chat Report Queue",value:"'report_chat_queue'"},{option:"Chat Report Transfer",value:"'report_chat_transfer'"},{option:"Companies",value:"'cm_companies'"},{option:"Call transfer report",value:"'report_call_transfer'"},{option:"Contacts",value:"'cm_contacts'"},{option:"CSquare Report",value:"'report_square'"},{option:"CSquare Details Report",value:"'report_square_details'"},{option:"Dial Report",value:"'report_dial'"},{option:"Dialer Hopper Processing",value:"'cm_hopper'"},{option:"Dialer Hopper Logs",value:"'cm_hopper_history'"},{option:"Dialer Hopper Final",value:"'cm_hopper_final'"},{option:"Email Account",value:"'mail_accounts'"},{option:"Email Interaction",value:"'mail_interactions'"},{option:"Email Messages",value:"'mail_messages'"},{option:"Email Queues",value:"'mail_queues'"},{option:"Email Report Queue",value:"'report_mail_queue'"},{option:"Email Report Transfer",value:"'report_mail_transfer'"},{option:"Fax Account",value:"'fax_accounts'"},{option:"Fax Interaction",value:"'fax_interactions'"},{option:"Fax Messages",value:"'fax_messages'"},{option:"Fax Queues",value:"'fax_queues'"},{option:"Fax Report Queue",value:"'report_fax_queue'"},{option:"Fax Report Transfer",value:"'report_fax_transfer'"},{option:"Jscripty Sessions",value:"'report_jscripty_sessions'"},{option:"Jscripty Questions",value:"'report_jscripty_questions'"},{option:"Jscripty Answers",value:"'report_jscripty_answers'"},{option:"Lists",value:"'cm_lists'"},{option:"Member Report",value:"'report_member'"},{option:"Openchannel Account",value:"'openchannel_accounts'"},{option:"Openchannel Interaction",value:"'openchannel_interactions'"},{option:"Openchannel Messages",value:"'openchannel_messages'"},{option:"Openchannel Queues",value:"'openchannel_queues'"},{option:"Openchannel Report Queue",value:"'report_openchannel_queue'"},{option:"Openchannel Report Transfer",value:"'report_openchannel_transfer'"},{option:"Queue Report",value:"'report_queue'"},{option:"SMS Account",value:"'sms_accounts'"},{option:"SMS Interaction",value:"'sms_interactions'"},{option:"SMS Messages",value:"'sms_messages'"},{option:"SMS Queues",value:"'sms_queues'"},{option:"SMS Report Queue",value:"'report_sms_queue'"},{option:"SMS Report Transfer",value:"'report_sms_transfer'"},{option:"Users",value:"'users'"},{option:"Voice Recordings",value:"'voice_recordings'"},{option:"Whatsapp Account",value:"'whatsapp_accounts'"},{option:"Whatsapp Interaction",value:"'whatsapp_interactions'"},{option:"Whatsapp Messages",value:"'whatsapp_messages'"},{option:"Whatsapp Queues",value:"'whatsapp_queues'"},{option:"Whatsapp Report Queue",value:"'report_whatsapp_queue'"},{option:"Whatsapp Report Transfer",value:"'report_whatsapp_transfer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditMetricDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/metrics/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{metric:e,metrics:f.metrics.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("metric")+"?").htmlContent("<b>"+(e.name||"metric")+"</b> will be deleted.").ariaLabel("delete metric").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getMetrics=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.analyticMetric.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Metrics",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMetric=function(e,n){i.show({controller:"CreateOrEditMetricDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/metrics/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{metric:n,metrics:f.metrics.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteMetric=y,f.exportSelectedMetrics=function(){var e=angular.copy(f.selectedMetrics);return f.selectedMetrics=[],e},f.deleteSelectedMetrics=function(e){var n=i.confirm().title("Are you sure want to delete the selected metrics?").htmlContent("<b>"+f.selectedMetrics.length+" selected</b> will be deleted.").ariaLabel("delete Metrics").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMetrics.forEach(function(e){y(e)}),f.selectedMetrics=[]})},f.deselectMetrics=function(){f.selectedMetrics=[]},f.selectAllMetrics=function(){f.selectedMetrics=f.metrics.rows};var b=!0,A=1;function E(e){f.metrics=e||{count:0,rows:[]}}function y(e){m.analyticMetric.delete({id:e.id}).$promise.then(function(){_.remove(f.metrics.rows,{id:e.id}),f.metrics.count-=1,f.metrics.rows.length||f.getMetrics(),p.success({title:_.startCase("Metric")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEanalyticMetric"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEanalyticMetric",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMetrics())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","metrics","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.analytics").controller("MetricsController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o){var r=this;function l(){n.hide()}r.errors=[],r.report=angular.copy(t),r.report.name+="-copy",r.treeCustomData=o,r.treeCustomConfig={core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:["wholerow"]},r.treeCustomEvents={select_node:function(e,n){r.currentNode=n.node}},r.copyReport=function(){var t;r.errors=[],i.analyticCustomReport.save({name:r.report.name,description:r.report.description,table:r.report.table,conditions:r.report.conditions,joins:r.report.joins,parent:r.currentNode.id}).$promise.then(function(e){t=e,a.success({title:"Report properly copied!",msg:r.report.name?r.report.name+" has been copied!":""});var n={fields:"field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0};return n["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=r.report.id,i.analyticFieldReport.get(n).$promise}).then(function(e){var e=_.map(e.rows,function(e){return _.extend({},e,{CustomReportId:t.id})});return i.analyticFieldReport.bulkCreate(e).$promise}).then(function(){a.success({title:"Fields copied!",msg:"Fields has been copied!"}),l()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:COPYREPORT",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$location","$mdDialog","toasty","report","api","apiName","treeCustomData"],angular.module("app.analytics").controller("CopyReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;function m(){n.hide()}c.errors=[],c.joinTables=[],c.title="ANALYTICS.EDIT_REPORT",c.crudPermissions=d,c.report=angular.copy(i),c.reports=a,c.newReport=!1,c.tables=l.getMap(),c.joinTypes=[{key:"join",value:"Join"},{key:"left_join",value:"Left Join"},{key:"right_join",value:"Right Join"},{key:"cross_join",value:"Cross Join"}],c.report||(c.report={name:"",table:"report_agent",description:"",parent:r.id},c.title="ANALYTICS.NEW_REPORT",c.newReport=!0),c.addNewReport=function(){c.errors=[],c.report.joins=_.map(c.joinTables||[],function(e){return{parentKey:e.parentKey,foreignTable:e.name,foreignKey:e.foreignKey,type:e.type.toLowerCase()}}),c.report.joins=JSON.stringify(c.report.joins),s[o].save(c.report).$promise.then(function(e){c.reports.unshift(e),t.success({title:"Report properly created",msg:c.report.name?c.report.name+" has been created!":""}),m()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReport.save"}];for(var n=0;n<e.data.errors.length;n++)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticReport.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.saveReport=function(){c.errors=[],s[o].update({id:c.report.id},c.report).$promise.then(function(e){var n=_.find(c.reports,{id:e.id});n&&_.merge(n,e),t.success({title:"Report properly saved!",msg:c.report.name?c.report.name+" has been saved!":""}),m()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReport.update"}];for(var n=0;n<e.data.errors.length;n++)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticReport.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.deleteReport=function(){c.errors=[];var e=n.confirm().title("Are you sure?").content("The report will be deleted.").ariaLabel("Delete Report").ok("Delete").cancel("Cancel").targetEvent(event);n.show(e).then(function(){s[o].delete({id:c.report.id}).$promise.then(function(){_.remove(c.reports,{id:c.report.id}),t.success({title:"Report properly deleted!",msg:c.report.name?c.report.name+" has been deleted!":""}),m()}).catch(function(e){c.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReport.delete"}]})},function(){})},c.closeDialog=m,c.selectedTableChange=function(e){e&&(delete c.selectedItem,c.joinTables.push(e))},c.removeJoin=function(e){c.joinTables.splice(e,1)},c.getFields=function(n,t,e){var a=_.find(c.tables,{name:e});a&&a.api&&s[a.api].describe().$promise.then(function(e){n[t]=_.difference(_.keys(e),["$promise","$resolved"])}).catch(function(e){console.error(e)})}}e.$inject=["$location","$mdDialog","toasty","reports","report","api","apiName","currentNode","describeTable","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditReportDialogController",e)}(),function(){"use strict";function e(i,s,o,e){var r=this;r.report={},r.conditions=e.getConditions,r.init=function(e,n){r.report=e,r.report.condition=angular.fromJson(e.conditions)||{group:{operator:"AND",rules:[]}},r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1};for(var t=0;t<r.report.condition.group.rules.length;t++)if(r.report.condition.group.rules[t].field){var a=r.report.condition.group.rules[t].field.split(".");1===a.length&&(r.report.condition.group.rules[t].field=r.report.table+"."+r.report.condition.group.rules[t].field)}s.getColumns(r.report.table).then(function(e){r.columns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt"])}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE",msg:e.data?JSON.stringify(e.data):e.toString()})})},r.addCondition=function(e){e.unshift({condition:"=",field:"",value:""})},r.addGroup=function(e){e.push({group:{operator:"AND",rules:[]}})},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the item?").htmlContent("The item will be deleted.").ariaLabel("delete item").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){e.splice(n,1)},function(){console.log("CANCEL")})},r.isValueByCondition=function(e){return!_.includes(["IS NULL","IS NOT NULL","IS EMPTY","IS NOT EMPTY"],e)}}e.$inject=["$mdDialog","describeTable","toasty","sqlUtil"],angular.module("app.analytics").controller("ReportConditionsController",e)}(),function(){"use strict";function e(a){var i={report_call_transfer:"voiceTransferReport",cm_companies:"cmCompany",cm_contacts:"cmContact",cm_hopper:"cmHopper",cm_hopper_final:"cmHopperFinal",cm_hopper_history:"cmHopperHistory",cm_lists:"cmList",chat_websites:"chatWebsite",chat_queues:"chatQueue",chat_interactions:"chatInteraction",chat_messages:"chatMessage",chat_offline_messages:"chatOfflineMessage",report_chat_queue:"chatQueueReport",report_chat_transfer:"chatTransferReport",mail_accounts:"mailAccount",mail_queues:"mailQueue",mail_interactions:"mailInteraction",mail_messages:"mailMessage",report_mail_queue:"mailQueueReport",report_mail_transfer:"mailTransferReport",openchannel_accounts:"openchannelAccount",openchannel_queues:"openchannelQueue",openchannel_interactions:"openchannelInteraction",openchannel_messages:"openchannelMessage",report_openchannel_queue:"openchannelQueueReport",report_openchannel_transfer:"openchannelTransferReport",sms_accounts:"smsAccount",sms_queues:"smsQueue",sms_interactions:"smsInteraction",sms_messages:"smsMessage",report_sms_queue:"smsQueueReport",report_sms_transfer:"smsTransferReport",fax_accounts:"faxAccount",fax_queues:"faxQueue",fax_interactions:"faxInteraction",fax_messages:"faxMessage",report_fax_transfer:"faxTransferReport",report_fax_queue:"faxQueueReport",report_call:"voiceCallReport",report_agent:"voiceAgentReport",report_square:"squareReport",report_member:"memberReport",report_queue:"voiceQueueReport",report_square_details:"squareReportDetail",report_dial:"voiceDialReport",report_jscripty_sessions:"jscriptySessionReport",report_jscripty_questions:"jscriptyQuestionReport",report_jscripty_answers:"jscriptyAnswerReport",users:"user",voice_recordings:"voiceRecording",cdr:"cdr",whatsapp_accounts:"whatsappAccount",whatsapp_queues:"whatsappQueue",whatsapp_interactions:"whatsappInteraction",whatsapp_messages:"whatsappMessage",report_whatsapp_queue:"whatsappQueueReport",report_whatsapp_transfer:"whatsappTransferReport"};return{getMap:function(){var t=[];return _.forIn(i,function(e,n){t.push({name:n,api:e})}),t},getColumns:function(e){var n=i[e],t={};return"cm_contacts"===e&&(t.analytics=!0),a[n].describe(t).$promise}}}e.$inject=["api"],angular.module("app.analytics").factory("describeTable",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;(u.errors=[],u.title="Edit Report Field",u.report=i,u.reportField=angular.copy(o),u.reportFields=s,u.metrics=r,u.columns=l,u.sqlUtil=d,u.newReportField=!1,u.crudPermissions=m,u.reportField)?(u.reportField.type=u.reportField.custom?"custom":u.reportField.MetricId?"metric":"column",u.reportField.field&&!u.reportField.custom&&_.isNil(u.reportField.MetricId)&&1===u.reportField.field.split(".").length&&(u.reportField.field=u.report.table+"."+u.reportField.field)):(u.reportField={type:"column",function:null,format:null,groupBy:!1,orderBy:null},u.title="New Report Field",u.newReportField=!0);function p(){t.hide()}u.addNewReportField=function(){u.errors=[],u.reportField.custom="custom"===u.reportField.type,u.reportField.MetricId="metric"===u.reportField.type?u.reportField.MetricId:null,u.reportField.CustomReportId=u.report.id,c.analyticFieldReport.save(u.reportField).$promise.then(function(e){u.reportFields.push(e),a.success({title:"Report field properly created",msg:u.reportField.field?u.reportField.field+" has been created!":u.reportField.type+" has been created!"}),p()}).catch(function(e){u.errors=e.data.errors||[{message:e.toString(),type:"api.analyticFieldReport.save"}]})},u.saveReportField=function(){u.errors=[],u.reportField.custom="custom"===u.reportField.type,u.reportField.MetricId="metric"===u.reportField.type?u.reportField.MetricId:null,c.analyticFieldReport.update({id:u.reportField.id},u.reportField).$promise.then(function(e){var n=_.find(u.reportFields,{id:e.id});n&&_.merge(n,e),a.success({title:"Report Field properly saved!",msg:u.reportField.field?u.reportField.field+" has been saved!":""}),p()}).catch(function(e){u.errors=e.data.errors||[{message:e.toString(),type:"api.analyticFieldReport.update"}]})},u.deleteReportField=function(e){u.errors=[];var n=t.confirm().title("Are you sure?").content("The field will be deleted.").ariaLabel("Delete Report").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){c.analyticFieldReport.delete({id:u.reportField.id}).$promise.then(function(){_.remove(u.reportFields,{id:u.reportField.id}),a.success({title:"Report Field properly deleted!",msg:u.reportField.field?u.reportField.field+" has been deleted!":""}),p()}).catch(function(e){u.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReportField.delete"}]})},function(){})},u.closeDialog=p}e.$inject=["$scope","$location","$mdDialog","toasty","report","reportFields","reportField","metrics","columns","sqlUtil","api","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditReportFieldDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;c.report={},c.reportFields={count:0,rows:[]},c.functions=_.keyBy(l.getFunctions,"value"),c.formats=_.keyBy(l.getFormats,"value"),c.groupBy=_.keyBy(l.getGroupBy,"value"),c.orderBy=_.keyBy(l.getOrderBy,"value"),c.selectedReportFields=[],c.query={fields:"createdAt,updatedAt,id,field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0},c.sortableTable={animation:100,onSort:function(e){o.analyticFieldReport.addFields({id:c.report.id},e.models).$promise.then(function(e){c.reportFields.rows=e}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDFIELDS"})})}},c.init=function(e,n){c.report=e,c.query.CustomReportId=c.report.id,c.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},c.sortableTable.disabled=!c.crudPermissions.canEdit,r.getColumns(c.report.table).then(function(e){return c.columns=_.difference(_.keys(e),["$promise","$resolved"]),o.analyticMetric.get({fields:"id,name,metric,table",nolimit:!0}).$promise}).then(function(e){c.metrics=e.rows}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.getReportFields()},c.deleteConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>"+e.field+"</b> will be deleted.").ariaLabel("delete field").targetEvent(n).ok("OK").cancel("CANCEL");a.show(t).then(function(){p(e)},function(){console.log("CANCEL")})},c.success=u,c.getReportFields=function(){c.promise=o.analyticFieldReport.get(c.query,u).$promise},c.createOrEditReportField=function(e,n){a.show({controller:"CreateOrEditReportFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/edit/field/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{report:c.report,reportField:n,reportFields:c.reportFields.rows,metrics:c.metrics,columns:c.columns,setting:null,crudPermissions:c.crudPermissions}})},c.deleteReportField=p,c.deleteSelectedReportFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+c.selectedReportFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){c.selectedReportFields.forEach(function(e){p(e)}),c.selectedReportFields=[]})},c.getMetricName=function(e){var n=_.find(c.metrics,{id:e});return n?n.name:d.instant("ANALYTICS.NO_METRIC_FOUND")},c.getMetricValue=function(e){var n=_.find(c.metrics,{id:e});return n?n.metric:d.instant("ANALYTICS.NO_METRIC_FOUND")};var m=!0;function u(e){c.reportFields=e||{count:0,rows:[]}}function p(e){o.analyticFieldReport.delete({id:e.id}).$promise.then(function(){c.selectedReportFields=[],_.remove(c.reportFields.rows,{id:e.id}),c.reportFields.count-=1,c.reportFields.rows.length||c.getReportFields(),s.success({title:"Field deleted!",msg:e.field?e.field+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}n.$watch("vm_rf.query.filter",function(e,n){m?t(function(){m=!1}):c.getReportFields()})}e.$inject=["$cookies","$scope","$timeout","$mdDialog","$document","toasty","api","describeTable","sqlUtil","$translate"],angular.module("app.analytics").controller("ReportFieldsController",e)}(),function(){"use strict";angular.module("app.analytics").factory("sqlUtil",function(){return{getFunctions:[{value:"SUM",option:function(e){return"SUM ("+e+")"}},{value:"COUNT",option:function(e){return"COUNT ("+e+")"}},{value:"COUNT DISTINCT",option:function(e){return"COUNT (DISTINCT "+e+")"}},{value:"MAX",option:function(e){return"MAX ("+e+")"}},{value:"MIN",option:function(e){return"MIN ("+e+")"}},{value:"AVG",option:function(e){return"AVG ("+e+")"}},{value:"GROUP_CONCAT",option:function(e){return"GROUP_CONCAT ("+e+")"}},{value:"GROUP_CONCAT ASC",option:function(e){return"GROUP_CONCAT ("+e+" ORDER BY "+e+" ASC)"}},{value:"GROUP_CONCAT DESC",option:function(e){return"GROUP_CONCAT ("+e+" ORDER BY "+e+" DESC)"}}],getFormats:[{value:"SEC_TO_TIME",option:function(e){return"SEC_TO_TIME ("+e+")"}},{value:"DATE",option:function(e){return"DATE ("+e+")"}},{value:"HOUR",option:function(e){return"HOUR ("+e+")"}},{value:"ROUND",option:function(e){return"ROUND ("+e+")"}},{value:"UNIX_TIMESTAMP",option:function(e){return"UNIX_TIMESTAMP ("+e+")"}}],getGroupBy:[{value:!1,option:function(){return"No"}},{value:!0,option:function(e){return"GROUP BY "+e}}],getOrderBy:[{value:"ASC",option:function(e){return"ORDER BY "+e+" ASC"}},{value:"DESC",option:function(e){return"ORDER BY "+e+" DESC"}}],getConditions:["=","!=","<","<=",">",">=","LIKE","NOT LIKE","IS NULL","IS NOT NULL","IS EMPTY","IS NOT EMPTY"]}})}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;function r(e){return _.isArray(e)}o.report=a||{},o.userProfileSection=s&&1==s.count?s.rows[0]:null,o.crudPermissions=i.parseCrudPermissions(o.userProfileSection?o.userProfileSection.crudPermissions:null),o.selectedTab=e.params.tab||0,o.gotoReports=function(){e.go("app.analytics.reports",{},{reload:"app.analytics.reports"})},o.saveReport=function(){o.report.conditions=angular.toJson(o.report.condition),t.analyticCustomReport.update({id:o.report.id},_.omit(o.report,"joins")).$promise.then(function(){n.success({title:"Report updated!",msg:o.report.name?o.report.name+" has been updated!":""})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETreport",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.previewReport=function(){o.columns=[],o.rows=[],o.error=!1,t.analyticFieldReport.get({fields:"field,alias",nolimit:!0,CustomReportId:o.report.id}).$promise.then(function(e){return o.columns=e?e.rows:[],t.analyticCustomReport.preview({id:o.report.id}).$promise}).then(function(e){o.rows=e}).catch(function(e){console.log(e),o.error={title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:analyticFieldReport",msg:e.data?e.data.message:e.toString(),sql:e.data&&e.data.parent?e.data.parent.sql:"NO QUERY"},n.error(o.error)})},o.queryReport=function(){return o.queryResult="Loading...",t.analyticCustomReport.query({id:o.report.id}).$promise.then(function(e){o.queryResult=e.sql}).catch(function(e){o.queryResult="",console.log(e),o.error={title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:analyticFieldReport",msg:e.data?e.data.message:e.toString(),sql:e.data&&e.data.parent?e.data.parent.sql:"NO QUERY"},n.error(o.error)})},o.mapArray=function(e,n){if(r(e))return _.map(e,n).join(",");return""},o.isArray=r,o.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n}}e.$inject=["$state","toasty","api","report","Auth","userProfileSection"],angular.module("app.analytics").controller("ReportController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;o.errors=[],o.report=angular.copy(a),o.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n},o.closeDialog=function(){n.hide()},function(){o.columns=[],o.rows=[],o.error=!1;var e={fields:"field,alias",nolimit:!0};e["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=o.report.id,o.promise=i.analyticFieldReport.get(e).$promise.then(function(e){return o.columns=e?e.rows:[],i[s].preview({id:o.report.id}).$promise}).then(function(e){o.rows=e}).catch(function(e){console.log(e),o.error={title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:analyticFieldReport",msg:e.data?e.data.message:e.toString(),sql:e.data&&e.data.parent?e.data.parent.sql:"NO QUERY"},t.error(o.error)})}()}e.$inject=["$location","$mdDialog","toasty","report","api","apiName"],angular.module("app.analytics").controller("PreviewReportDialogController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,n,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.reports={count:0,rows:[]},p.userProfile=r,p.userProfileSection=l&&1==l.count?l.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.selectedReports=[],p.query={fields:"createdAt,updatedAt,id,name,description,table,parent,conditions,joins",limit:10,page:1,sort:"-updatedAt"},p.apiName=null,p.currentPath="",p.customTree=!0,p.editstate=function(e,n){s.go("app.analytics.reports.edit",{id:e.id,crudPermissions:p.crudPermissions})},p.copydialog=function(e,n){i.show({controller:"CopyReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/copy/dialog.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName,treeCustomData:p.treeCustomInstance.jstree(!0).get_json("#")}}).finally(function(){})},p.previewdialog=function(e,n){i.show({controller:"PreviewReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/preview/dialog.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName}})},p.rundialog=function(e,n){i.show({controller:"RunReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/run/dialog.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName,currentPath:p.currentPath}})},p.downloadfile=function(a,e){var i;d.analyticMetric.get({fields:"id,name,metric,table",nolimit:!0}).$promise.then(function(e){i=_.keyBy(e.rows,"id");var n={fields:"field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0};return n["analyticCustomReport"===p.apiName?"CustomReportId":"DefaultReportId"]=a.id,d.analyticFieldReport.get(n).$promise}).then(function(e){for(var n=0;n<e.rows.length;n+=1)e.rows[n].MetricId&&(e.rows[n].field=i[e.rows[n].MetricId].metric,e.rows[n].custom=!0),delete e.rows[n].MetricId;var t=o.document.createElement("a");t.href="data:text/json;charset=utf-8,"+o.encodeURIComponent(angular.toJson({name:a.name,description:a.description,table:a.table,conditions:a.conditions,joins:a.joins,fields:e.rows})),t.download=a.name+".json",t.target="_self",t.click(),m.success({title:"Report downloaded!",msg:a.name?a.name+" has been downloaded!":""})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DOWNLOADJSON",msg:e.data?JSON.stringify(e.data):e.toString()})})},p.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the report?").htmlContent("<b>"+e.name+"</b> will be deleted.").ariaLabel("delete report").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){b(e)},function(){console.log("CANCEL")})},p.success=h,p.getReports=f,p.createOrEditReport=function(e,n){i.show({controller:"CreateOrEditReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{report:n,reports:p.reports.rows,apiName:p.apiName,currentNode:p.currentNode,setting:null,crudPermissions:p.crudPermissions}})},p.importReport=function(e,n,t){if("application/json"===e.file.type){var a=new FileReader;a.onload=function(e){console.log(e.target.result);try{var t=atob(e.target.result.split(",")[1]);t=angular.fromJson(t),d.analyticCustomReport.save({name:t.name,description:t.description,table:t.table,conditions:t.conditions,joins:t.joins,parent:p.currentNode.id}).$promise.then(function(n){p.reports.rows.unshift(n),m.success({title:"Report saved!",msg:n.name?n.name+" has been saved!":""});var e=_.map(t.fields,function(e){return _.extend({},e,{CustomReportId:n.id})});return d.analyticFieldReport.bulkCreate(e).$promise}).then(function(e){m.success({title:"Fields saved!",msg:"Fields has been saved!"})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETanalyticReport",msg:e.data?JSON.stringify(e.data):e.toString()})})}catch(e){console.error(e),m.error({title:"Decode File Error",msg:e.toString()})}},a.readAsDataURL(e.file)}else m.error({title:"Format Error",msg:"Please use only json files"})},p.deleteReport=b,p.exportSelectedReports=function(){var e=angular.copy(p.selectedReports);return p.selectedReports=[],e},p.deleteSelectedReports=function(e){var n=i.confirm().title("Are you sure want to delete the selected reports?").htmlContent("<b>"+p.selectedReports.length+" selected</b> will be deleted.").ariaLabel("delete Reports").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){p.selectedReports.forEach(function(e){b(e)}),p.selectedReports=[]})},p.deselectReports=function(){p.selectedReports=[]},p.selectAllReports=function(){p.selectedReports=p.reports.rows},p.treeDefaultData=c.rows[0]?angular.fromJson(c.rows[0].tree):[],p.treeCustomData=c.rows[1]?angular.fromJson(c.rows[1].tree):[],p.treeDefaultConfig=S(!1),p.treeCustomConfig=S(!0),p.treeDefaultEvents=T(!1),p.treeCustomEvents=T(!0);var g=!0,v=1;function h(e){p.reports=e||{count:0,rows:[]}}function f(){if(p.query.offset=(p.query.page-1)*p.query.limit,p.apiName)if("admin"===p.currentUser.role||p.userProfileSection.autoAssociation)p.promise=d[p.apiName].get(p.query,h).$promise;else{var a=[];p.promise=d[p.apiName].get(p.query).$promise.then(function(e){return 0<(a=e&&e.rows?e.rows:[]).length?d.userProfileResource.get({sectionId:p.userProfileSection.id,type:"analyticDefaultReport"===p.apiName?"DefaultReports":"CustomReports"}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(0<n.length){var t=[];return a.forEach(function(e){_.find(n,["resourceId",e.id])&&t.push(e)}),h({count:t.length,rows:t})}return h(null)}):h(null)})}}function b(e){p.apiName&&d[p.apiName].delete({id:e.id}).$promise.then(function(){_.remove(p.reports.rows,{id:e.id}),p.reports.count-=1,p.reports.rows.length||p.getReports(),m.success({title:"Report deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.analyticreport.delete"}];for(var n=0;n<e.data.errors.length;n++)m.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticreport.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function A(e,n){p.treeDefaultInstance.jstree(!0).deselect_all(),p.treeDefaultInstance.jstree(!0).close_all(),p.currentNode=n.node,p.currentNode.custom=!0,p.currentPath=p.treeCustomInstance.jstree(!0).get_path(p.currentNode).join("/ "),p.apiName="analyticCustomReport",p.query.parent=n.node.id,f()}function E(e,n){p.treeCustomInstance.jstree(!0).deselect_all(),p.treeCustomInstance.jstree(!0).close_all(),p.currentNode=n.node,p.currentNode.custom=!1,p.currentPath=p.treeDefaultInstance.jstree(!0).get_path(p.currentNode).join("/ "),p.apiName="analyticDefaultReport",p.query.parent=n.node.id,f()}function y(e,n){var t,a,i;"rename_node"===e.type&&(a=(t=n).node.id,i="","custom"===t.node.parent?t.node.id.includes("custom_report_")||(i="custom_report_"+t.text):i=t.node.parent+"_"+t.text,p.treeCustomInstance.jstree(!0).set_id(t.node,"custom_report_"+i.toLowerCase()),t.node.a_attr.id=t.node.a_attr.id.replace(a,t.node.id),t.node.li_attr.id=t.node.id);var s=angular.toJson(p.treeCustomInstance.jstree(!0).get_json("#"));d.analyticTreeReport.update({id:2,tree:s}).$promise.then(function(){c.rows[1]&&(c.rows[1].tree=s),m.success({title:"Node Updated",msg:n.node.text?n.node.text+" has been updated!":"Node has been updated!"})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEanalyticTreeReport",msg:e.data?JSON.stringify(e.data):e.toString()})})}function S(e){return{core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:e?["contextmenu","dnd","search","state","wholerow"]:["search","state","wholerow"],contextmenu:{items:function(t){var e={};return p.crudPermissions.canEdit&&_.assign(e,{create:{label:n.instant("ANALYTICS.CREATE"),action:function(){t=p.treeCustomInstance.jstree(!0).create_node(t),p.treeCustomInstance.jstree(!0).edit(t)}},rename:{_disabled:"#"===t.parent,label:n.instant("ANALYTICS.RENAME"),action:function(){p.treeCustomInstance.jstree(!0).edit(t)}}}),p.crudPermissions.canDelete&&_.assign(e,{remove:{_disabled:"#"===t.parent,label:n.instant("ANALYTICS.REMOVE"),action:function(){var e=i.confirm().title("Are you sure want to delete the node?").htmlContent("<b>"+(t.text?t.text:"Node")+"</b> and its subnode will be deleted.").ariaLabel("delete node").ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,n=p.treeCustomInstance.jstree(!0).get_parent(t);n=p.treeCustomInstance.jstree(!0).get_node(n),p.treeCustomInstance.jstree(!0).delete_node(t),e=[t.id].concat(t.children_d||[]),d.analyticCustomReport.get({parent:e.join(","),fields:"id,name"}).$promise.then(function(e){e&&e.rows&&e.rows.forEach(function(e){b(e)})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEreportsByParents",msg:e.data?JSON.stringify(e.data):e.toString()})}),p.treeCustomInstance.jstree(!0).select_node(n)})}}}),e}}}}function T(e){return e?{create_node:y,rename_node:y,move_node:y,delete_node:y,select_node:A}:{select_node:E}}e.$watch("vm.query.filter",function(e,n){g?t(function(){g=!1}):(n||(v=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=v),p.getReports())}),e.$watch("vm.search",function(e,n){p.treeDefaultInstance&&p.treeDefaultInstance.jstree(!0).search(e),p.treeCustomInstance&&p.treeCustomInstance.jstree(!0).search(e)})}e.$inject=["$scope","$timeout","$document","$mdDialog","$state","$window","$translate","userProfile","userProfileSection","api","treeReports","toasty","Auth"],angular.module("app.analytics").controller("ReportsController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r){var l=this;function d(){l.export={id:l.report.id,name:l.report.name,startDate:new Date(moment().startOf("day")),endDate:new Date(moment().endOf("day")),output:"xlsx",fullPath:r?r+"/"+l.report.name:l.report.name}}function c(){t.hide()}l.errors=[],l.report=angular.copy(n),l.export={},l.runReport=function(n){l.errors=[],l.exportDate=_.assign({},l.export,{startDate:moment(l.export.startDate).format("YYYY-MM-DD HH:mm:ss"),endDate:moment(l.export.endDate).format("YYYY-MM-DD HH:mm:ss")}),i[s].run(l.exportDate).$promise.then(function(e){"web"===l.export.output?t.show({controller:"WebReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/run/web/dialog.html",parent:angular.element(o.body),targetEvent:n,skipHide:!0,locals:{apiName:s,exportDate:l.exportDate,results:e},resolve:{columns:["apiResolver",function(e){var n={fields:"field,alias",nolimit:!0};return n["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=l.report.id,e.resolve("analyticFieldReport@get",n)}]}}):(a.success({title:"Report properly run!",msg:l.report.name?l.report.name+" has been run!":""}),c())}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},l.closeDialog=c,(l.refreshDate=d)()}e.$inject=["$location","$mdDialog","toasty","report","api","apiName","$document","currentPath"],angular.module("app.analytics").controller("RunReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o){var r=this;function l(e){r.results=e||{count:0,rows:[]}}r.errors=[],r.columns=a?a.rows:[],r.results=i||{rows:[],count:0},r.query={limit:10,page:1},r.closeDialog=function(){e.hide()},r.getResults=function(){o.offset=(r.query.page-1)*r.query.limit,o.limit=r.query.limit,r.promise=t[s].run(o,l).$promise},r.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n}}e.$inject=["$mdDialog","toasty","api","columns","results","apiName","exportDate"],angular.module("app.analytics").controller("WebReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CALLYSQUARE.EDIT_ODBC",g.odbc=angular.copy(l),g.odbcs=r,g.newOdbc=!1,g.odbc||(g.odbc={},g.title="CALLYSQUARE.NEW_ODBC",g.newOdbc=!0),g.addNewOdbc=function(){g.errors=[],d.squareOdbc.save(g.odbc).$promise.then(function(e){g.odbcs.unshift(e.toJSON()),o.success({title:"Odbc properly created",msg:g.odbc.name?g.odbc.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareOdbc.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareOdbc.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOdbc=function(){g.errors=[],d.squareOdbc.update({id:g.odbc.id},g.odbc).$promise.then(function(e){var n=_.find(g.odbcs,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Odbc properly saved!",msg:g.odbc.name?g.odbc.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareOdbc.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareOdbc.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOdbc=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The odbc will be deleted.").ariaLabel("Delete Odbc").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.squareOdbc.delete({id:g.odbc.id}).$promise.then(function(){_.remove(g.odbcs,{id:g.odbc.id}),o.success({title:"Odbc properly deleted!",msg:(g.odbc.name||"odbc")+" has been deleted!"}),v(g.odbc)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareOdbc.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareOdbc.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","odbcs","odbc","api","Auth","license","setting","crudPermissions"],angular.module("app.callysquare").controller("CreateOrEditOdbcDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.odbcs=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="odbcs",f.listOrder="",f.listOrderAsc=null,f.selectedODBC=[],f.query={fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditOdbcDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/odbcs/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{odbc:e,odbcs:f.odbcs.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.testtestOdbc=function(e,n){return m.squareOdbc.test({id:e.id}).$promise.then(function(){p.success({title:"Square ODBC properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"Square ODBC properly tested",msg:e.data?JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("odbc")+"?").htmlContent("<b>"+(e.name||"odbc")+"</b> will be deleted.").ariaLabel("delete odbc").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getODBC=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.squareOdbc.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ODBC",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditOdbc=function(e,n){i.show({controller:"CreateOrEditOdbcDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/odbcs/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{odbc:n,odbcs:f.odbcs.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteOdbc=y,f.exportSelectedODBC=function(){var e=angular.copy(f.selectedODBC);return f.selectedODBC=[],e},f.deleteSelectedODBC=function(e){var n=i.confirm().title("Are you sure want to delete the selected odbcs?").htmlContent("<b>"+f.selectedODBC.length+" selected</b> will be deleted.").ariaLabel("delete Odbcs").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedODBC.forEach(function(e){y(e)}),f.selectedODBC=[]})},f.deselectODBC=function(){f.selectedODBC=[]},f.selectAllODBC=function(){f.selectedODBC=f.odbcs.rows};var b=!0,A=1;function E(e){f.odbcs=e||{count:0,rows:[]}}function y(e){m.squareOdbc.delete({id:e.id}).$promise.then(function(){_.remove(f.odbcs.rows,{id:e.id}),f.odbcs.count-=1,f.odbcs.rows.length||f.getODBC(),p.success({title:_.startCase("Odbc")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsquareOdbc"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsquareOdbc",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getODBC())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","odbcs","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.callysquare").controller("OdbcsController",e)}(),function(){"use strict";function e(n,t,a,i,s,e,o,r,l,d){var c=this;function m(e){n.hide(e)}c.errors=[],c.title="CALLYSQUARE.EDIT_PROJECT",c.crudPermissions=d,c.project=angular.copy(o),c.newWindow=!0,c.projects=e,c.newProject=!1,c.openFromEditor=l,c.project||(c.project={name:"",description:""},c.title="CALLYSQUARE.NEW_PROJECT",c.newProject=!0),c.addNewProject=function(){c.errors=[],r.squareProject.save(c.project).$promise.then(function(e){return r.user.addSquareProjects({id:i.getCurrentUser().id,ids:[e.id]}).$promise,e}).then(function(e){c.projects.unshift(e),s.success({title:"Project properly created",msg:c.project.name?c.project.name+" has been created!":""}),m(e),c.openFromEditor&&(c.newWindow?t.open("/callysquare/projects/"+e.id,"_blank"):a.go("app.callysquare.projects.edit",{id:e.id}))}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.save"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareProject.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.saveProject=function(){c.errors=[],r.squareProject.update({id:c.project.id},c.project).$promise.then(function(e){var n=_.find(c.projects,{id:e.id});n&&_.merge(n,e),s.success({title:"Project properly saved!",msg:c.project.name?c.project.name+" has been saved!":""}),m(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.update"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareProject.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.deleteProject=function(){c.errors=[];var e=n.confirm().title("Are you sure?").content("The project will be deleted.").ariaLabel("Delete Project").ok("Delete").cancel("Cancel").targetEvent(event);n.show(e).then(function(){r.squareProject.delete({id:c.project.id}).$promise.then(function(){return r.squareProject.getUsers({id:c.project.id}).$promise}).then(function(e){for(var n=[],t=e.rows,a=0;a<t.length;a++)n.push(r.user.removeSquareProjects({id:i.getCurrentUser().id,ids:[c.project.id]}).$promise);return $q.all(n)}).then(function(){_.remove(c.projects,{id:c.project.id}),s.success({title:"Project properly deleted!",msg:c.project.name?c.project.name+" has been deleted!":""}),m(c.project)}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.delete"}]})},function(){})},c.closeDialog=m}e.$inject=["$mdDialog","$window","$state","Auth","toasty","projects","project","api","openFromEditor","crudPermissions"],angular.module("app.callysquare").controller("CreateOrEditSquareProjectDialogController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o,r,l,d,c,m,u,p,g,v,h,f,b,A,E,y,S,T,I,O,C,w,R,x,N,D){var P=this,L={playback:["file_id"],answer:["timeout"],menu:["file_id","digit","response","retry"],getdigits:["file_id","variable_id","mindigit","maxdigit","retry"],getsecretdigits:["file_id","variable_id","mindigit","maxdigit","hiddendigitsnum","retry"],vswitch:["variable_id"],database:["odbc_id","query"],ext_dial:["trunk_name","phone","timeout"],set:["variable_id"],math:["variable_id"],gotoc:["context","extension","priority"],system:["command"],agi:["command"],gotoif:["condition"],saydigits:["digits"],saynumber:["number"],sayphonetic:["text"],record:["file","timeout"],goal:["goalname"],dial:["sip_id","timeout"],queue:["queue_id","timeout"],callback:["list_id","name","phone","delay"],gotoiftime:["interval_id"],voicemail:["mailbox"],subproject:["project_id"],sendSMS:["sms_account_id","to","sms_text"],sendMail:["account_id","to"],sendFax:["account_id","to","attachment_path"],google_cloud_tts:["apiKey","google_cloud_tts_text_type","text"],tts:["text"],ispeechtts:["text","key","speed"],ispeechasr:["key","timeout"],custom_app:["application"],googleasr:["key","timeout"],awspolly:["aws_access_key_id","aws_secret_access_key","text","aws_text_type"],lumenvoxtts:["text"],sestektts:["text"],lumenvoxasr:["grammar"],sestekasr:["grammar"],tildeasr:["appid","appsecret","uri"],login:["findBy"],pause:["findBy","pause_id"],unpause:["findBy"],logout:["findBy"],dialogflow:["key","text","dialogflow_language"],awslex:["aws_access_key_id","aws_secret_access_key","aws_lex_region","aws_bot_name","text"],sesteknda:["text","ndauth_url","username","password","ndassistant_url"],restapi:["url","method"],mrcpsynth:["text"],mrcprecog:["grammar"],dialogflowV2:["dialogflowV2_project_id","client_email","private_key","dialogflowV2_language","text"]},k={queue:["file_id"],database:["variable_id"],pause:["pause_id"]},M={sendMail:["to","cc","bcc"],voicemail:["mailbox"]};function U(e,n,t,a){return _.map(e,function(e){return{value:e[n],option:e[t],group:a?e[a]:void 0,canSelect:void 0===e.canSelect||e.canSelect}})}function F(){var e=Number(_.find(P.attributes,{name:"sip_id"}).value);if(!_.some(d,{id:e})&&0<e)return t.user.get({id:e,fields:"id,fullname,role"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,d.push(n),P.values.sip_id=U(d,"id","fullname","role")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_USER",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.sip_id=U(d,"id","fullname","role")}function $(){var e=Number(_.find(P.attributes,{name:"list_id"}).value);if(!_.some(E,{id:e})&&0<e)return t.cmList.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,E.push(n),P.values.list_id=U(E,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_LIST",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.list_id=U(E,"id","name")}function q(){var e=Number(_.find(P.attributes,{name:"trunk_id"}).value);if(!_.some(c,{id:e})&&0<e)return t.trunk.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,c.push(n),P.values.trunk_id=U(c,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TRUNK",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.trunk_id=U(c,"id","name")}function G(){var e=_.find(P.attributes,{name:"trunk_name"}).value;if(!_.some(c,{name:e})&&e)return t.trunk.get({name:e,fields:"id,name"}).$promise.then(function(e){if(0<e.count&&0<e.rows.length){var n=e.rows[0];n.canSelect=!1,c.push(n),P.values.trunk_name=U(c,"name","name")}}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TRUNK",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.trunk_name=U(c,"name","name")}function H(){var e=Number(_.find(P.attributes,{name:"queue_id"}).value);if(!_.some(m,{id:e})&&0<e)return t.voiceQueue.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,m.push(n),P.values.queue_id=U(m,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_QUEUE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.queue_id=U(m,"id","name")}function V(){var e=Number(_.find(P.attributes,{name:"file_id"}).value);if(!_.some(u,{id:e})&&0<e)return t.sound.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,u.push(n),P.values.file_id=U(u,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_SOUND",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.file_id=U(u,"id","name")}function B(){var e=Number(_.find(P.attributes,{name:"variable_id"}).value);if(!_.some(p,{id:e})&&0<e)return t.variable.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,p.push(n),P.values.variable_id=U(p,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_VARIABLE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.variable_id=U(p,"id","name")}function Q(){var e=Number(_.find(P.attributes,{name:"odbc_id"}).value);if(!_.some(g,{id:e})&&0<e)return t.squareOdbc.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,g.push(n),P.values.odbc_id=U(g,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_ODBC",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.odbc_id=U(g,"id","name")}function W(){var e=Number(_.find(P.attributes,{name:"project_id"}).value);if(!_.some(v,{id:e})&&0<e)return t.squareProject.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,v.push(n),P.values.project_id=U(v,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_PROJECT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.project_id=U(v,"id","name")}function j(){var e=Number(_.find(P.attributes,{name:"context"}).value);if(!_.some(h,{id:e})&&0<e)return t.voiceContext.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,h.push(n),P.values.context=U(h,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_CONTEXT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.context=U(h,"id","name")}function Y(){var e=Number(_.find(P.attributes,{name:"interval_id"}).value);if(!_.some(f,{id:e})&&0<e)return t.interval.get({id:e,fields:"id,name,IntervalId"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,f.push(n),P.values.interval_id=U(f,"id","name","IntervalId")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_INTERVAL",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.interval_id=U(f,"id","name","IntervalId")}function z(){var e=Number(_.find(P.attributes,{name:"account_id"}).value);if(!_.some(b,{id:e})&&0<e)return t.mailAccount.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,b.push(n),P.values.account_id=U(b,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_MAIL_ACCOUNT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.account_id=U(b,"id","name")}function J(){var e=Number(_.find(P.attributes,{name:"sms_account_id"}).value);if(!_.some(O,{id:e})&&0<e)return t.smsAccount.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,O.push(n),P.values.sms_account_id=U(O,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_SMS_ACCOUNT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.sms_account_id=U(O,"id","name")}function K(){var e=Number(_.find(P.attributes,{name:"template_id"}).value);if(!_.some(A,{id:e})&&0<e)return t.template.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,A.push(n),P.values.template_id=U(A,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TEMPLATE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.template_id=U(A,"id","name")}function X(){var e=Number(_.find(P.attributes,{name:"pause_id"}).value);if(!_.some(C,{id:e})&&0<e)return t.pause.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,C.push(n),P.values.pause_id=U(C,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_PAUSE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.pause_id=U(C,"id","name")}P.cellName=y.tagName,P.attributes=_.map(y.attributes,function(e){return{name:e.name,value:e.value,defaultValue:k[P.cellName]&&_.includes(k[P.cellName],e.name),required:L[P.cellName]&&_.includes(L[P.cellName],e.name),help:M[P.cellName]&&_.includes(M[P.cellName],e.name)}}),P.values={authMethod:[{value:"noauth",option:"NO AUTH"},{value:"hmac",option:"HMAC"}],answer:[{value:"yes",option:"Yes"},{value:"no",option:"No"}],ndagenerate_audio:[{value:1,option:"Yes"},{value:0,option:"No"}],ndaactivity_type:[{value:"message",option:"Message"},{value:"conversationUpdate",option:"Conversation Update"},{value:"contactRelationUpdate",option:"Contact Relation Update"},{value:"endOfConversation",option:"End of Conversation"}],hiddendigitspos:[{value:"first",option:"First"},{value:"last",option:"Last"}],recordingFormat:[{value:"wav",option:"Wav"},{value:"gsm",option:"Gsm"}],intkey:[{value:"#",option:"#"},{value:"*",option:"*"}],beep:[{value:"BEEP",option:"Yes"},{value:"NOBEEP",option:"No"}],model:e,ispeech_asr_language:i,ispeech_tts_language:o,languageCode:r,ssmlGender:[{value:"FEMALE",option:"Female"},{value:"MALE",option:"Male"}],google_tts_language:l,google_asr_language:s,google_cloud_tts_text_type:[{value:"text",option:"Text"},{value:"ssml",option:"SSML"}],aws_polly_region:I,aws_polly_voice:T,aws_text_type:[{value:"text",option:"Text"},{value:"ssml",option:"SSML"}],callback_priority:[{option:"Highest",value:4},{option:"High",value:3},{option:"Medium",value:2},{option:"Low",value:1},{option:"Lowest",value:0}],findBy:[{value:"internal",option:"Internal"},{value:"phone",option:"Phone"},{value:"mobile",option:"Mobile"}],dialogflow_language:w,dialogflowV2_language:R,aws_lex_region:x,method:[{value:"GET",option:"GET"},{value:"POST",option:"POST"},{value:"PUT",option:"PUT"},{value:"DELETE",option:"DELETE"}]},P.crudPermissions=D,P.onInit=function(){N.hasRole("admin")?(e={sip_id:U(d,"id","fullname","role"),trunk_name:U(c,"name","name"),trunk_id:U(c,"id","name"),queue_id:U(m,"id","name"),file_id:U(u,"id","name"),variable_id:U(p,"id","name"),odbc_id:U(g,"id","name"),project_id:U(v,"id","name"),context:U(h,"id","name"),interval_id:(t=f,a="id",i="name",s="IntervalId",o=_.filter(t,function(e){return null===e[s]}),r=[],_.forEach(o,function(n){r.push({value:n[a],option:n[i]});var e=_.filter(t,function(e){return e[s]===n.id});_.forEach(e,function(e){r.push({value:e[a],option:" - "+e[i]})})}),r),account_id:U(b,"id","name"),template_id:U(A,"id","name"),list_id:U(E,"id","name"),sms_account_id:U(O,"id","name"),pause_id:U(C,"id","name")},n=_.merge(P.values,e),P.values=n):function(){for(var e=["sip_id","trunk_name","trunk_id","queue_id","file_id","variable_id","odbc_id","project_id","context","interval_id","account_id","template_id","list_id","sms_account_id","pause_id"],n=0;n<P.attributes.length;n++)if(_.includes(e,P.attributes[n].name))switch(P.attributes[n].name){case"sip_id":F();break;case"trunk_name":G();break;case"trunk_id":q();break;case"queue_id":H();break;case"file_id":V();break;case"variable_id":B();break;case"odbc_id":Q();break;case"project_id":W();break;case"context":j();break;case"interval_id":Y();break;case"account_id":z();break;case"template_id":K();break;case"list_id":$();break;case"sms_account_id":J();break;case"pause_id":X()}}();var e,n,t,a,i,s,o,r},P.closeDialog=function(e){e&&S(P.attributes),n.hide()},P.getMap=U}e.$inject=["$mdDialog","api","toasty","ispeechAsrModel","ispeechAsrLanguage","googleAsrLanguage","ispeechTtsLanguage","googleCloudTtslanguageCode","googleTtsLanguage","users","trunks","queues","sounds","variables","databases","projects","contexts","intervals","mailAccounts","templates","lists","cell","saveCallback","awsPollyVoice","awsPollyRegion","smsAccounts","pauses","dialogFlowLanguage","dialogFlowV2Language","awsLexRegion","Auth","crudPermissions"],angular.module("app.callysquare").controller("MxGraphDialogController",e)}(),function(){"use strict";angular.module("app.callysquare").directive("stringToNumber",function(){return{require:"ngModel",link:function(e,n,t,a){a.$parsers.push(function(e){return""+e}),a.$formatters.push(function(e){return parseFloat(e)})}}})}(),function(){"use strict";angular.module("app.callysquare").factory("ispeechAsrModel",function(){return[{value:"0",option:"Default"},{value:"date",option:"Date"},{value:"usmoney",option:"US Money"},{value:"numbersto9",option:"Numbers to 9"},{value:"numbersto99",option:"Numbers to 99"},{value:"numbersto999",option:"Numbers to 999"},{value:"time",option:"Time"},{value:"phonenumber",option:"Phone number"},{value:"streets",option:"Streets"},{value:"citystate",option:"US City/States"}]}).factory("ispeechAsrLanguage",function(){return[{value:"en-US",option:"English (US)"},{value:"en-CA",option:"English (Canada)"},{value:"en-GB",option:"English (UK)"},{value:"en-AU",option:"English (Australia)"},{value:"es-ES",option:"Spanish (Spain)"},{value:"es-MX",option:"Spanish (Mexico)"},{value:"it-IT",option:"Italian (Italy) / Finnish (Finland)"},{value:"fr-FR",option:"German (Germany)"},{value:"fr-CA",option:"French (Canada)"},{value:"pl-PL",option:"Polish (Poland)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"ca-ES",option:"Catalan (Catalan)"},{value:"zh-TW",option:"Chinese (Taiwan)"},{value:"da-DK",option:"Danish (Denmark)"},{value:"ja-JP",option:"Japanese (Japan)"},{value:"ko-KR",option:"Korean (Korea)"},{value:"nl-NL",option:"Dutch (Netherlands)"},{value:"nb-NO",option:"Norwegian (Norway)"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"ru-RU",option:"Russian (Russia)"},{value:"sv-SE",option:"Swedish (Sweden)"},{value:"zh-CN",option:"Chinese (China)"},{value:"zh-HK",option:"Chinese (Hong Kong)"}]}).factory("ispeechTtsLanguage",function(){return[{value:"usenglishfemale",option:"US English Female"},{value:"usenglishmale",option:"US English Male"},{value:"ukenglishfemale",option:"UK English Female"},{value:"ukenglishmale",option:"UK English Male"},{value:"auenglishfemale",option:"Australian English"},{value:"usspanishfemale",option:"US Spanish Female"},{value:"usspanishmale",option:"US Spanish Male"},{value:"chchinesefemale",option:"Chinese Female"},{value:"chchinesemale",option:"Chinese Male"},{value:"hkchinesefemale",option:"Hong Kong Cantonese Female"},{value:"twchinesefemale",option:"Taiwan Chinese Female"},{value:"jpjapanesefemale",option:"Japanese Female"},{value:"jpjapanesemale",option:"Japanese Male"},{value:"krkoreanfemale",option:"Korean Female"},{value:"krkoreanmale",option:"Korean Male"},{value:"caenglishfemale",option:"Canadian English Female"},{value:"huhungarianfemale",option:"Hungarian Female"},{value:"brportuguesefemale",option:"Brazilian Portuguese Female"},{value:"eurportuguesefemale",option:"European Portuguese Female"},{value:"eurportuguesemale",option:"European Portuguese Male"},{value:"eurspanishfemale",option:"European Spanish Female"},{value:"eurspanishmale",option:"European Spanish Male"},{value:"eurcatalanfemale",option:"European Catalan Female"},{value:"eurczechfemale",option:"European Czech Female"},{value:"eurdanishfemale",option:"European Danish Female"},{value:"eurfinnishfemale",option:"European Finnish Female"},{value:"eurfrenchfemale",option:"European French Female"},{value:"eurfrenchmale",option:"European French Male"},{value:"eurnorwegianfemale",option:"European Norwegian Female"},{value:"eurdutchfemale",option:"European Dutch Female"},{value:"eurpolishfemale",option:"European Polish Female"},{value:"euritalianfemale",option:"European Italian Female"},{value:"euritalianmale",option:"European Italian Male"},{value:"eurturkishfemale",option:"European Turkish Female"},{value:"eurturkishmale",option:"European Turkish Male"},{value:"eurgermanfemale",option:"European German Female"},{value:"eurgermanmale",option:"European German Male"},{value:"rurussianfemale",option:"Russian Female"},{value:"rurussianmale",option:"Russian Male"},{value:"swswedishfemale",option:"Swedish Female"},{value:"cafrenchfemale",option:"Canadian French Female"},{value:"cafrenchmale",option:"Canadian French Male"}]}).factory("googleCloudTtslanguageCode",function(){return[{value:"af-ZA",option:"Afrikaans (South Africa)"},{value:"ar-XA",option:"Arabic"},{value:"bn-IN",option:"Bengali (India)"},{value:"bg-BG",option:"Bulgarian (Bulgaria)"},{value:"ca-ES",option:"Catalan (Spain)"},{value:"yue-HK",option:"Chinese (Hong Kong)"},{value:"cs-CZ",option:"Czech (Czech Republic)"},{value:"da-DK",option:"Danish (Denmark)"},{value:"nl-BE",option:"Dutch (Belgium)"},{value:"nl-NL",option:"Dutch (Netherlands)"},{value:"en-AU",option:"English (Australian)"},{value:"en-IN",option:"English (India)"},{value:"en-GB",option:"English (UK)"},{value:"en-US",option:"English (US)"},{value:"fi-FI",option:"Finnish (Finland)"},{value:"fil-PH",option:"Filipino (Philippines)"},{value:"fr-CA",option:"French (Canada)"},{value:"fr-FR",option:"French (France)"},{value:"de-DE",option:"German (Germany)"},{value:"el-GR",option:"Greek (Greece)"},{value:"gu-IN",option:"Gujarati (India)"},{value:"hi-IN",option:"Hindi (India)"},{value:"hu-HU",option:"Hungarian (Hungary)"},{value:"is-IS",option:"Icelandic (Iceland)"},{value:"id-ID",option:"Indonesian (Indonesia)"},{value:"it-IT",option:"Italian (Italy)"},{value:"ja-JP",option:"Japanese (Japan)"},{value:"kn-IN",option:"Kannada (India)"},{value:"ko-KR",option:"Korean (South Korea)"},{value:"lv-LV",option:"Latvian (Latvia)"},{value:"ms-MY",option:"Malay (Malaysia)"},{value:"ml-IN",option:"Malayalam (India)"},{value:"cmn-CN",option:"Mandarin Chinese"},{value:"nb-NO",option:"Norwegian (Norway)"},{value:"pl-PL",option:"Polish (Poland)"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"ro-RO",option:"Romanian (Romania)"},{value:"ru-RU",option:"Russian (Russia)"},{value:"sr-RS",option:"Serbian (Cyrillic)"},{value:"sk-SK",option:"Slovak (Slovakia)"},{value:"es-ES",option:"Spanish (Spain)"},{value:"es-US",option:"Spanish (US)"},{value:"sv-SE",option:"Swedish (Sweden)"},{value:"ta-IN",option:"Tamil (India)"},{value:"te-IN",option:"Telugu (India)\t"},{value:"th-TH",option:"Thai (Thailand)"},{value:"tr-TR",option:"Turkish (Turkey)"},{value:"uk-UA",option:"Ukrainian (Ukraine)"},{value:"vi-VN",option:"Vietnamese (Vietnam)"}]}).factory("googleTtsLanguage",function(){return[{value:"af",option:"Afrikaans"},{value:"sq",option:"Albanian"},{value:"am",option:"Amharic"},{value:"ar",option:"Arabic"},{value:"hy",option:"Armenian"},{value:"az",option:"Azerbaijani"},{value:"eu",option:"Basque"},{value:"be",option:"Belarusian"},{value:"bn",option:"Bengali"},{value:"bh",option:"Bihari"},{value:"bs",option:"Bosnian"},{value:"br",option:"Breton"},{value:"bg",option:"Bulgarian"},{value:"km",option:"Cambodian"},{value:"ca",option:"Catalan"},{value:"zh-CN",option:"Chinese (Simplified)"},{value:"zh-TW",option:"Chinese (Traditional)"},{value:"co",option:"Corsican"},{value:"hr",option:"Croatian"},{value:"cs",option:"Czech"},{value:"da",option:"Danish"},{value:"nl",option:"Dutch"},{value:"en",option:"English"},{value:"eo",option:"Esperanto"},{value:"et",option:"Estonian"},{value:"fo",option:"Faroese"},{value:"tl",option:"Filipino"},{value:"fi",option:"Finnish"},{value:"fr",option:"French"},{value:"fy",option:"Frisian"},{value:"gl",option:"Galician"},{value:"ka",option:"Georgian"},{value:"de",option:"German"},{value:"el",option:"Greek"},{value:"gn",option:"Guarani"},{value:"gu",option:"Gujarati"},{value:"xx-hacker",option:"Hacker"},{value:"ha",option:"Hausa"},{value:"iw",option:"Hebrew"},{value:"hi",option:"Hindi"},{value:"hu",option:"Hungarian"},{value:"is",option:"Icelandic"},{value:"id",option:"Indonesian"},{value:"ia",option:"Interlingua"},{value:"ga",option:"Irish"},{value:"it",option:"Italian"},{value:"jw",option:"Javanese"},{value:"ja",option:"Japanese"},{value:"kn",option:"Kannada"},{value:"kk",option:"Kazakh"},{value:"rw",option:"Kinyarwanda"},{value:"rn",option:"Kirundi"},{value:"xx-klingon",option:"Klingon"},{value:"ku",option:"Kurdish"},{value:"ko",option:"Korean"},{value:"ky",option:"Kyrgyz"},{value:"lo",option:"Laothian"},{value:"la",option:"Latin"},{value:"lv",option:"Latvian"},{value:"ln",option:"Lingala"},{value:"lt",option:"Lithuanian"},{value:"mk",option:"Macedonian"},{value:"mg",option:"Malagasy"},{value:"ml",option:"Malayalam"},{value:"mt",option:"Maltese"},{value:"mi",option:"Maori"},{value:"mr",option:"Marathi"},{value:"mo",option:"Moldavian"},{value:"mn",option:"Mongolian"},{value:"sr-ME",option:"Montenegrin"},{value:"ne",option:"Nepali"},{value:"no",option:"Norwegian"},{value:"nn",option:"Norwegian (Nynorsk)"},{value:"oc",option:"Occitan"},{value:"or",option:"Oriya"},{value:"om",option:"Oromo"},{value:"ps",option:"Pashto"},{value:"fa",option:"Persian"},{value:"xx-pirate",option:"Pirate"},{value:"pl",option:"Polish"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"pa",option:"Punjabi"},{value:"qu",option:"Quechua"},{value:"ro",option:"Romanian"},{value:"rm",option:"Romansh"},{value:"ru",option:"Russian"},{value:"gd",option:"Scots Gaelic"},{value:"sr",option:"Serbian"},{value:"sh",option:"Serbo-Croatian"},{value:"st",option:"Sesotho"},{value:"sn",option:"Shona"},{value:"sd",option:"Sindhi"},{value:"si",option:"Sinhalese"},{value:"sk",option:"Slovak"},{value:"sl",option:"Slovenian"},{value:"so",option:"Somali"},{value:"es",option:"Spanish"},{value:"su",option:"Sundanese"},{value:"sw",option:"Swahili"},{value:"sv",option:"Swedish"},{value:"tg",option:"Tajik"},{value:"ta",option:"Tamil"},{value:"tt",option:"Tatar"},{value:"te",option:"Telugu"},{value:"th",option:"Thai"},{value:"ti",option:"Tigrinya"},{value:"to",option:"Tonga"},{value:"tr",option:"Turkish"},{value:"tk",option:"Turkmen"},{value:"tw",option:"Twi"},{value:"ug",option:"Uighur"},{value:"uk",option:"Ukrainian"},{value:"ur",option:"Urdu"},{value:"uz",option:"Uzbek"},{value:"vi",option:"Vietnamese"},{value:"cy",option:"Welsh"},{value:"xh",option:"Xhosa"},{value:"yi",option:"Yiddish"},{value:"yo",option:"Yoruba"},{value:"zu",option:"Zulu"}]}).factory("googleAsrLanguage",function(){return[{option:"Afrikaans (South Africa)",value:"af-ZA"},{option:"Albanian (Albania)",value:"sq-AL"},{option:"Amharic (Ethiopia)",value:"am-ET"},{option:"Arabic (Algeria)",value:"ar-DZ"},{option:"Arabic (Bahrain)",value:"ar-BH"},{option:"Arabic (Egypt)",value:"ar-EG"},{option:"Arabic (Iraq)",value:"ar-IQ"},{option:"Arabic (Israel)",value:"ar-IL"},{option:"Arabic (Jordan)",value:"ar-JO"},{option:"Arabic (Kuwait)",value:"ar-KW"},{option:"Arabic (Lebanon)",value:"ar-LB"},{option:"Arabic (Morocco)",value:"ar-MA"},{option:"Arabic (Oman)",value:"ar-OM"},{option:"Arabic (Qatar)",value:"ar-QA"},{option:"Arabic (Saudi Arabia)",value:"ar-SA"},{option:"Arabic (State of Palestine)",value:"ar-PS"},{option:"Arabic (Tunisia)",value:"ar-TN"},{option:"Arabic (United Arab Emirates)",value:"ar-AE"},{option:"Arabic (Yemen)",value:"ar-YE"},{option:"Armenian (Armenia)",value:"hy-AM"},{option:"Azerbaijani (Azerbaijan)",value:"az-AZ"},{option:"Basque (Spain)",value:"eu-ES"},{option:"Bengali (Bangladesh)",value:"bn-BD"},{option:"Bengali (India)",value:"bn-IN"},{option:"Bosnian (Bosnia and Herzegovina)",value:"bs-BA"},{option:"Bulgarian (Bulgaria)",value:"bg-BG"},{option:"Burmese (Myanmar)",value:"my-MM"},{option:"Catalan (Spain)",value:"ca-ES"},{option:"Chinese, Cantonese (Traditional Hong Kong)",value:"yue-Hant-HK"},{option:"Chinese, Mandarin (Simplified, China)",value:"cmn-Hans-CN"},{option:"Croatian (Croatia)",value:"hr-HR"},{option:"Czech (Czech Republic)",value:"cs-CZ"},{option:"Danish (Denmark)",value:"da-DK"},{option:"Dutch (Belgium)",value:"nl-BE"},{option:"Dutch (Netherlands)",value:"nl-NL"},{option:"English (Australia)",value:"en-AU"},{option:"English (Canada)",value:"en-CA"},{option:"English (Ghana)",value:"en-GH"},{option:"English (Hong Kong)",value:"en-HK"},{option:"English (India)",value:"en-IN"},{option:"English (Ireland)",value:"en-IE"},{option:"English (Kenya)",value:"en-KE"},{option:"English (New Zealand)",value:"en-NZ"},{option:"English (Nigeria)",value:"en-NG"},{option:"English (Pakistan)",value:"en-PK"},{option:"English (Philippines)",value:"en-PH"},{option:"English (Singapore)",value:"en-SG"},{option:"English (South Africa)",value:"en-ZA"},{option:"English (Tanzania)",value:"en-TZ"},{option:"English (United Kingdom)",value:"en-GB"},{option:"English (United States)",value:"en-US"},{option:"Estonian (Estonia)",value:"et-EE"},{option:"Filipino (Philippines)",value:"fil-PH"},{option:"Finnish (Finland)",value:"fi-FI"},{option:"French (Belgium)",value:"fr-BE"},{option:"French (Canada)",value:"fr-CA"},{option:"French (France)",value:"fr-FR"},{option:"French (Switzerland)",value:"fr-CH"},{option:"Galician (Spain)",value:"gl-ES"},{option:"Georgian (Georgia)",value:"ka-GE"},{option:"German (Austria)",value:"de-AT"},{option:"German (Germany)",value:"de-DE"},{option:"German (Switzerland)",value:"de-CH"},{option:"Greek (Greece)",value:"el-GR"},{option:"Gujarati (India)",value:"gu-IN"},{option:"Hebrew (Israel)",value:"iw-IL"},{option:"Hindi (India)",value:"hi-IN"},{option:"Hungarian (Hungary)",value:"hu-HU"},{option:"Icelandic (Iceland)",value:"is-IS"},{option:"Indonesian (Indonesia)",value:"id-ID"},{option:"Italian (Italy)",value:"it-IT"},{option:"Italian (Switzerland)",value:"it-CH"},{option:"Japanese (Japan)",value:"ja-JP"},{option:"Javanese (Indonesia)",value:"jv-ID"},{option:"Kannada (India)",value:"kn-IN"},{option:"Kazakh (Kazakhstan)",value:"kk-KZ"},{option:"Khmer (Cambodia)",value:"km-KH"},{option:"Korean (South Korea)",value:"ko-KR"},{option:"Lao (Laos)",value:"lo-LA"},{option:"Latvian (Latvia)",value:"lv-LV"},{option:"Lithuanian (Lithuania)",value:"lt-LT"},{option:"Macedonian (North Macedonia)",value:"mk-MK"},{option:"Malay (Malaysia)",value:"ms-MY"},{option:"Malayalam (India)",value:"ml-IN"},{option:"Marathi (India)",value:"mr-IN"},{option:"Mongolian (Mongolia)",value:"mn-MN"},{option:"Nepali (Nepal)",value:"ne-NP"},{option:"Norwegian BokmÃ¥l (Norway)",value:"no-NO"},{option:"Persian (Iran)",value:"fa-IR"},{option:"Polish (Poland)",value:"pl-PL"},{option:"Portuguese (Brazil)",value:"pt-BR"},{option:"Portuguese (Portugal)",value:"pt-PT"},{option:"Punjabi (Gurmukhi India)",value:"pa-Guru-IN"},{option:"Romanian (Romania)",value:"ro-RO"},{option:"Russian (Russia)",value:"ru-RU"},{option:"Serbian (Serbia)",value:"sr-RS"},{option:"Sinhala (Sri Lanka)",value:"si-LK"},{option:"Slovak (Slovakia)",value:"sk-SK"},{option:"Slovenian (Slovenia)",value:"sl-SI"},{option:"Spanish (Argentina)",value:"es-AR"},{option:"Spanish (Bolivia)",value:"es-BO"},{option:"Spanish (Chile)",value:"es-CL"},{option:"Spanish (Colombia)",value:"es-CO"},{option:"Spanish (Costa Rica)",value:"es-CR"},{option:"Spanish (Dominican Republic)",value:"es-DO"},{option:"Spanish (Ecuador)",value:"es-EC"},{option:"Spanish (El Salvador)",value:"es-SV"},{option:"Spanish (Guatemala)",value:"es-GT"},{option:"Spanish (Honduras)",value:"es-HN"},{option:"Spanish (Mexico)",value:"es-MX"},{option:"Spanish (Nicaragua)",value:"es-NI"},{option:"Spanish (Panama)",value:"es-PA"},{option:"Spanish (Paraguay)",value:"es-PY"},{option:"Spanish (Peru)",value:"es-PE"},{option:"Spanish (Puerto Rico)",value:"es-PR"},{option:"Spanish (Spain)",value:"es-ES"},{option:"Spanish (United States)",value:"es-US"},{option:"Spanish (Uruguay)",value:"es-UY"},{option:"Spanish (Venezuela)",value:"es-VE"},{option:"Sundanese (Indonesia)",value:"su-ID"},{option:"Swahili (Kenya)",value:"sw-KE"},{option:"Swahili (Tanzania)",value:"sw-TZ"},{option:"Swedish (Sweden)",value:"sv-SE"},{option:"Tamil (India)",value:"ta-IN"},{option:"Tamil (Malaysia)",value:"ta-MY"},{option:"Tamil (Singapore)",value:"ta-SG"},{option:"Tamil (Sri Lanka)",value:"ta-LK"},{option:"Telugu (India)",value:"te-IN"},{option:"Thai (Thailand)",value:"th-TH"},{option:"Turkish (Turkey)",value:"tr-TR"},{option:"Ukrainian (Ukraine)",value:"uk-UA"},{option:"Urdu (India)",value:"ur-IN"},{option:"Urdu (Pakistan)",value:"ur-PK"},{option:"Uzbek (Uzbekistan)",value:"uz-UZ"},{option:"Vietnamese (Vietnam)",value:"vi-VN"},{option:"Zulu (South Africa)",value:"zu-ZA"}]}).factory("awsPollyVoice",function(){return[{value:"Zeina",option:"Zeina (Arabic, Female)"},{value:"Zhiyu",option:"Zhiyu (Chinese, Mandarin, Female)"},{value:"Naja",option:"Naja (Danish, Female)"},{value:"Mads",option:"Mads (Danish, Male)"},{value:"Lotte",option:"Lotte (Dutch, Female)"},{value:"Ruben",option:"Ruben (Dutch, Male)"},{value:"Nicole",option:"Nicole (English, Australian, Female)"},{value:"Olivia",option:"Olivia (English, Austrialian, Female)"},{value:"Russell",option:"Russell (English, Austrialian, Male)"},{value:"Amy",option:"Amy (English, British, Female)"},{value:"Emma",option:"Emma (English, British, Female)"},{value:"Brian",option:"Brian (English, British, Male)"},{value:"Aditi",option:"Aditi (English, Indian, Female)"},{value:"Raveena",option:"Raveena (English, Indian, Female)"},{value:"Aria",option:"Aria (English, New Zealand, Female)"},{value:"Ayanda",option:"Ayanda (English, South African, Female)"},{value:"Joanna",option:"Joanna (English, US, Female)"},{value:"Ivy",option:"Ivy (English, US, Female)"},{value:"Joey",option:"Joey (English, US, Male)"},{value:"Justin",option:"Justin (English, US, Male)"},{value:"Kendra",option:"Kendra (English, US, Female)"},{value:"Kimberly",option:"Kimberly (English, US, Female)"},{value:"Salli",option:"Salli (English, US, Female)"},{value:"Kevin",option:"Kevin (English, US, Male)"},{value:"Matthew",option:"Matthew (English, US, Male)"},{value:"Geraint",option:"Geraint (English, Welsh, Male)"},{value:"Celine",option:"Celine (French, Female)"},{value:"Mathieu",option:"Mathieu (French, Male)"},{value:"Léa",option:"Léa (French, Male)"},{value:"Chantal",option:"Chantal (French, Canadian, Female)"},{value:"Gabrielle",option:"Gabrielle (French, Canadian, Female)"},{value:"Vicki",option:"Vicki (German , Female)"},{value:"Hans",option:"Hans (German, Male)"},{value:"Marlene",option:"Marlene (German, Female)"},{value:"Aditi",option:"Aditi (Hindi , Female)"},{value:"Karl",option:"Karl (Icelandic, Male)"},{value:"Dora",option:"Dora (Icelandic, Female)"},{value:"Carla",option:"Carla (Italian, Female)"},{value:"Giorgio",option:"Giorgio (Italian, Male)"},{value:"Bianca",option:"Bianca (Italian, Male)"},{value:"Mizuki",option:"Mizuki (Japanese, Female)"},{value:"Takumi",option:"Takumi (Japanese, Male)"},{value:"Seoyeon",option:"Seoyeon (Korean, Female)"},{value:"Liv",option:"Liv (Norwegian, Female)"},{value:"Ewa",option:"Ewa (Polish, Female)"},{value:"Jacek",option:"Jacek (Polish, Male)"},{value:"Jan",option:"Jan (Polish, Male)"},{value:"Maja",option:"Maja (Polish, Female)"},{value:"Camila",option:"Camila (Portuguese, Brazilian, Female)"},{value:"Ricardo",option:"Ricardo (Portuguese, Brazilian, Male)"},{value:"Vitoria",option:"Vitoria (Portuguese, Brazilian, Female)"},{value:"Cristiano",option:"Cristiano (Portuguese, Male)"},{value:"Ines",option:"Ines (Portuguese, Female)"},{value:"Carmen",option:"Carmen (Romanian, Female)"},{value:"Maxim",option:"Maxim (Russian, Male)"},{value:"Tatyana",option:"Tatyana (Russian, Female)"},{value:"Conchita",option:"Conchita (Spanish, European, Female)"},{value:"Lucia",option:"Lucia (Spanish, European, Female)"},{value:"Enrique",option:"Enrique (Spanish, European, Male)"},{value:"Mia",option:"Mia (Spanish, Mexican, Female)"},{value:"Miguel",option:"Miguel (Spanish, US, Male)"},{value:"Penelope",option:"Penelope (Spanish, US, Female)"},{value:"Lupe",option:"Lupe (Spanish, US, Female)"},{value:"Astrid",option:"Astrid (Swedish, Female)"},{value:"Filiz",option:"Filiz (Turkish, Female)"},{value:"Gwyneth",option:"Gwyneth (Welsh , Female)"}]}).factory("awsPollyRegion",function(){return[{value:"us-east-1",option:"US East (N. Virginia)"},{value:"us-east-2",option:"US East (Ohio)"},{value:"us-west-1",option:"US West (N. California)"},{value:"us-west-2",option:"US West (Oregon)"},{value:"ca-central-1",option:"Canada (Central)"},{value:"eu-west-1",option:"EU (Ireland)"},{value:"eu-central-1",option:"EU (Frankfurt)"},{value:"eu-west-2",option:"EU (London)"},{value:"eu-west-3",option:"EU (Paris)"},{value:"ap-southeast-1",option:"Asia Pacific (Singapore)"},{value:"ap-southeast-2",option:"Asia Pacific (Sydney)"},{value:"ap-northeast-2",option:"Asia Pacific (Seoul)"},{value:"ap-northeast-1",option:"Asia Pacific (Tokyo)"},{value:"ap-south-1",option:"Asia Pacific (Mumbai)"},{value:"sa-east-1",option:"South America (São Paulo)"}]}).factory("awsLexRegion",function(){return[{value:"us-east-1",option:"US East (N. Virginia)"},{value:"us-west-2",option:"US West (Oregon)"},{value:"eu-west-1",option:"EU (Ireland)"},{value:"ap-southeast-2",option:"Asia Pacific (Sydney)"}]}).factory("dialogFlowLanguage",function(){return[{value:"da",option:"Danish"},{value:"en",option:"English"},{value:"de",option:"German"},{value:"it",option:"Italian"},{value:"es",option:"Spanish"},{value:"fr",option:"French"},{value:"id",option:"Indonesian"},{value:"ja",option:"Japanese"},{value:"ko",option:"Korean (South Korea)"},{value:"nl",option:"Dutch"},{value:"no",option:"Norwegian"},{value:"pt",option:"Portuguese (European)"},{value:"pt-br",option:"Portuguese (Nrazilian)"},{value:"ru",option:"Russian"},{value:"sv",option:"Swedish"},{value:"th",option:"Thai"},{value:"uk",option:"Ukrainian"},{value:"zh-CN",option:"Chinese (Simplified)"},{value:"zh-HK",option:"Chinese (Hong Kong)"},{value:"zh-TW",option:"Chinese (Traditional)"}]}).factory("dialogFlowV2Language",function(){return[{value:"zh-HK",option:"Chinese (Cantonese)"},{value:"zh-CN",option:"Chinese (Simplified)"},{value:"zh-TW",option:"Chinese (Traditional)"},{value:"da",option:"Danish"},{value:"nl",option:"Dutch"},{value:"en",option:"English"},{value:"en-AU",option:"English (Australia)"},{value:"en-CA",option:"English (Canada)"},{value:"en-GB",option:"English (Great Britain)"},{value:"en-IN",option:"English (India)"},{value:"en-US",option:"English (US)"},{value:"fr",option:"French"},{value:"fr-CA",option:"French (Canada)"},{value:"fr-FR",option:"France (France)"},{value:"de",option:"German"},{value:"hi",option:"Hindi"},{value:"id",option:"Indonesian"},{value:"it",option:"Italian"},{value:"ja",option:"Japanese"},{value:"ko",option:"Korean"},{value:"no",option:"Norwegian"},{value:"pl",option:"Polish"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"ru",option:"Russian"},{value:"es",option:"Spanish"},{value:"es-419",option:"Spanish (Latin America)"},{value:"es-ES",option:"Spanish (Spain)"},{value:"sw",option:"Swedish"},{value:"th",option:"Thai"},{value:"tr",option:"Turkish"},{value:"uk",option:"Ukrainian"}]})}(),function(){"use strict";function e(n,e,t,a){var i=this;i.project={preproduction:t},i.closeDialog=function(e){e?(a(i.project.preproduction),n.hide(i.project.preproduction)):n.hide()}}e.$inject=["$mdDialog","toasty","currentXML","saveCallback"],angular.module("app.callysquare").controller("MxGraphEditXMLController",e)}(),function(){"use strict";function e(n,t){var a=this;function i(e){e?(t(e),n.hide(e)):n.hide()}a.errors=[],a.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:5242880,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},a.ngFlow={flow:{}},a.dropping=!1,a.closeDialog=i,a.fileAdded=function(e){a.errors=[];_.includes(["xml"],e.getExtension())||a.errors.push({message:"The extension "+e.getExtension()+" is not supported!"});5242880<e.size&&a.errors.push({message:"The file is too big. The max allowed size is 5MB"});if(!a.errors.length){var n=new FileReader;n.onload=function(e){i(e.target.result)},n.readAsText(e.file)}}}e.$inject=["$mdDialog","saveCallback"],angular.module("app.callysquare").controller("MxGraphImportXMLController",e)}(),function(){"use strict";function e(n,t,e,a){var i=this;i.project=_.clone(e),i.closeDialog=function(){n.hide()},i.save=function(){i.errors=[],a.squareProject.update({id:i.project.id},{notes:i.project.notes,description:i.project.description}).$promise.then(function(e){t.success({title:"Project updated!",msg:i.project.name?i.project.name+" has been updated!":""}),n.hide(e)}).catch(function(e){console.error(e),i.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.update"}]})}}e.$inject=["$mdDialog","toasty","project","api"],angular.module("app.callysquare").controller("MxGraphUpdateInfoController",e)}(),function(){"use strict";function e(n,e,t,a,i){var s=this;s.projects=t,s.id="",s.newWindow=!0,s.closeDialog=function(e){s.errors=[],e?(n.hide(),s.newWindow?a.open("/callysquare/projects/"+s.id,"_blank"):i.go("app.callysquare.projects.edit",{id:s.id})):n.hide()}}e.$inject=["$mdDialog","toasty","projects","$window","$state"],angular.module("app.callysquare").controller("MxGraphOpenProjectController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o){var r=this;function l(){return a.squareProject.getUsers({id:r.project.id,fields:"id,name,fullname,internal",nolimit:!0,role:"user"}).$promise.then(function(e){return r.selectedItems=e.rows?_.map(e.rows,function(e){return e}):[],r.dualMultiselectOptions.selectedItems=r.selectedItems,a.user.get({fields:"id,fullname,name,internal",role:"user",nolimit:!0}).$promise}).then(function(e){r.items=e.rows?_.map(e.rows,function(e){return e}):[],r.dualMultiselectOptions.items=_.differenceBy(r.items,r.selectedItems,"id")}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETUSERS",msg:e.status?JSON.stringify(e.data):e.toString()})})}r.project=n,r.penalty=0,r.items=[],r.selectedItems=[],r.closeDialog=function(){e.hide()},r.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("CALLYSQUARE.ALL_USERS"),labelSelected:s.instant("CALLYSQUARE.SELECTED_USERS"),transferCallback:function(e,n){a.squareProject[n?"removeUsers":"addUsers"]({id:r.project.id,ids:_.map(e,"id"),penalty:r.penalty||0}).$promise.then(function(){t.success({title:"Project properly "+(n?"removed":"added"),msg:"Project has been "+(n?"removed":"added")+"!"}),n||l()}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:squareProjects.ADDUSERS",msg:e.status?JSON.stringify(e.data):e.toString()})})}},l()}e.$inject=["$mdDialog","toasty","api","project","projects","$translate","Auth"],angular.module("app.callysquare").controller("ProjectspermissionaddController",e)}(),function(){"use strict";function e(n,t,e,a,i,s,o){var r=this;r.project=angular.copy(e),r.project.name+="_new",r.project.preproduction=a,r.newWindow=!0,r.closeDialog=function(){n.hide()},r.save=function(){delete r.project.id,i.squareProject.save(r.project).$promise.then(function(e){t.success({title:"Project properly created",msg:r.project.name?r.project.name+" has been created!":""}),n.hide(e),r.newWindow?s.open("/callysquare/projects/"+e.id,"_blank"):o.go("app.callysquare.projects.edit",{id:e.id})}).catch(function(e){console.error(e),r.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.save"}]})}}e.$inject=["$mdDialog","toasty","project","currentXML","api","$window","$state"],angular.module("app.callysquare").controller("MxGraphSaveProjectAsController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,r,n,l,d,c,m,u,p,g,v,h,f,b,A,E,y,S,T){var I=this;I.currentUser=T.getCurrentUser(),I.project=n||{},I.userProfileSection=S&&1==S.count?S.rows[0]:null,I.crudPermissions=T.parseCrudPermissions(I.userProfileSection?I.userProfileSection.crudPermissions:null),I.onInit=function(){new EditorUi(I,new Editor,document.getElementById("geEditor")).openString(I.project.preproduction,I.project.name,I.project)},I.saveOrPublishProject=function(e,n){var t={preproduction:e};n&&(t.production=e);r.squareProject.update({id:I.project.id},t).$promise.then(function(e){o.success({title:"Project "+(n?"published":"saved")+"!",msg:I.project.name?I.project.name+" has been "+(n?"published":"saved")+"!":""}),I.project.preproduction=e.preproduction}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsquareProject",msg:e.data?JSON.stringify(e.data):e.toString()})})},I.openDialog=function(e,n){a.show({controller:"MxGraphDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/dialog/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{users:l.rows||[],trunks:d.rows||[],queues:c.rows||[],sounds:m.rows||[],variables:u.rows||[],databases:p.rows||[],contexts:g.rows||[],projects:v.rows||[],intervals:h.rows||[],mailAccounts:f.rows||[],smsAccounts:E.rows||[],pauses:y.rows||[],templates:b.rows||[],lists:A.rows||[],cell:e,saveCallback:n,crudPermissions:I.crudPermissions}})},I.newProject=function(e){a.show({controller:"CreateOrEditSquareProjectDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/create/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{project:e,projects:v.rows,openFromEditor:!0,license:null,setting:null,crudPermissions:I.crudPermissions}})},I.openProject=function(){a.show({controller:"MxGraphOpenProjectController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/open/open.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{projects:v.rows||[]}})},I.saveProjectAs=function(e){a.show({controller:"MxGraphSaveProjectAsController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/saveAs/saveAs.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{project:I.project,currentXML:e}}).then(function(e){e&&v.rows.push(e)})},I.newVariable=function(n){return i(function(a,n){return r.userProfileSection.get({userProfileId:I.currentUser.userProfileId,sectionId:1012}).$promise.then(function(e){var n=e.rows?e.rows[0]:null,t=T.parseCrudPermissions(n?n.crudPermissions:null);a(t)}).catch(function(e){n(e)})}).then(function(e){e.canEdit?a.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{variable:n,variables:u.rows,license:null,setting:null,crudPermissions:e}}):o.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_CREATION_MESSAGE")})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"API:NEW_VARIABLE",msg:e.data?JSON.stringify(e.data):e.toString()})})},I.updateInfo=function(e){a.show({controller:"MxGraphUpdateInfoController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/info/info.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:I.project}}).then(function(e){e&&_.merge(I.project,e)})},I.editXML=function(e,n){a.show({controller:"MxGraphEditXMLController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/edit/edit.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{currentXML:e,saveCallback:n}}).then(function(e){e&&(I.project.preproduction=e)})},I.importXML=function(e){a.show({controller:"MxGraphImportXMLController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/import/import.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{saveCallback:e}}).then(function(e){e&&(I.project.preproduction=e)})},I.gotoProjects=function(){e.go("app.callysquare.projects",{},{reload:"app.callysquare.projects"})}}e.$inject=["$state","$document","$mdDialog","$q","$translate","toasty","api","project","users","trunks","queues","sounds","variables","databases","contexts","projects","intervals","mailAccounts","templates","lists","smsAccounts","pauses","userProfileSection","Auth"],angular.module("app.callysquare").controller("ProjectController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.projects=a||{count:0,rows:[]},p.userProfile=i,p.userProfileSection=s&&1==s.count?s.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.listOrder="",p.listOrderAsc=null,p.selectedProjects=[],p.query={fields:"id,name,description,notes",sort:"-updatedAt",limit:10,page:1},p.editstate=function(e,n){t.go("app.callysquare.projects.edit",{id:e.id,crudPermissions:p.crudPermissions})},p.deleteconfirm=function(e,n){var t=l.confirm().title("Are you sure want to delete the project?").htmlContent("<b>"+e.name+"</b> will be deleted.").ariaLabel("delete project").targetEvent(n).ok("OK").cancel("CANCEL");l.show(t).then(function(){f(e)},function(){console.log("CANCEL")})},p.success=h,p.getProjects=function(){p.query.offset=(p.query.page-1)*p.query.limit,u.hasRole("admin")?p.promise=o.squareProject.get(p.query,h).$promise:(p.query.id=p.userProfile.id,p.query.section="SquareProjects",p.promise=o.userProfile.getResources(p.query,h).$promise)},p.createOrEditProject=function(e,n){l.show({controller:"CreateOrEditSquareProjectDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/create/dialog.html",parent:angular.element(d.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:n,projects:p.projects.rows,openFromEditor:null,setting:null,crudPermissions:p.crudPermissions}})},p.deleteProject=f,p.exportSelectedProjects=function(){var e=angular.copy(p.selectedProjects);return p.selectedProjects=[],e},p.deleteSelectedProjects=function(e){var n=l.confirm().title("Are you sure want to delete the selected projects?").htmlContent("<b>"+p.selectedProjects.length+" selected</b> will be deleted.").ariaLabel("delete Projects").targetEvent(e).ok("OK").cancel("CANCEL");l.show(n).then(function(){p.selectedProjects.forEach(function(e){f(e)}),p.selectedProjects=[]})},p.deselectProjects=function(){p.selectedProjects=[]},p.selectAllProjects=function(){p.selectedProjects=p.projects.rows};var g=!0,v=1;function h(e){p.projects=e||{count:0,rows:[]}}function f(e){o.squareProject.delete({id:e.id}).$promise.then(function(){_.remove(p.projects.rows,{id:e.id}),p.projects.count-=1,p.projects.rows.length||p.getProjects(),m.success({title:"Project deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.project.delete"}];for(var n=0;n<e.data.errors.length;n++)m.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.project.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){g?c(function(){g=!1}):(n||(v=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=v),p.getProjects())})}e.$inject=["$scope","$state","$mdSidenav","projects","userProfile","userProfileSection","api","msUtils","$mdDialog","$document","$timeout","toasty","Auth"],angular.module("app.callysquare").controller("ProjectsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CALLYSQUARE.EDIT_SQUARERECORDING",g.squareRecording=angular.copy(l),g.squareRecordings=r,g.newSquareRecording=!1,g.squareRecording||(g.squareRecording={},g.title="CALLYSQUARE.NEW_SQUARERECORDING",g.newSquareRecording=!0),g.addNewSquareRecording=function(){g.errors=[],d.squareRecording.save(g.squareRecording).$promise.then(function(e){g.squareRecordings.unshift(e.toJSON()),o.success({title:"SquareRecording properly created",msg:g.squareRecording.name?g.squareRecording.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareRecording.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSquareRecording=function(){g.errors=[],d.squareRecording.update({id:g.squareRecording.id},g.squareRecording).$promise.then(function(e){var n=_.find(g.squareRecordings,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SquareRecording properly saved!",msg:g.squareRecording.name?g.squareRecording.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareRecording.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSquareRecording=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The squareRecording will be deleted.").ariaLabel("Delete SquareRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.squareRecording.delete({id:g.squareRecording.id}).$promise.then(function(){_.remove(g.squareRecordings,{id:g.squareRecording.id}),o.success({title:"SquareRecording properly deleted!",msg:(g.squareRecording.name||"squareRecording")+" has been deleted!"}),v(g.squareRecording)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareRecording.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","squareRecordings","squareRecording","api","Auth","license","setting","crudPermissions"],angular.module("app.callysquare").controller("CreateOrEditSquareRecordingDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.squareRecordings=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="squareRecordings",f.listOrder="",f.listOrderAsc=null,f.selectedSquareRecordings=[],f.query={fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio,savePath,format",sort:"-createdAt",limit:10,page:1},f.downloadfile2=function(s,e){return m.squareRecording.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.uniqueid+s.format;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("squareRecording")+"?").htmlContent("<b>"+(e.name||"squareRecording")+"</b> will be deleted.").ariaLabel("delete squareRecording").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSquareRecordings=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.squareRecording.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SquareRecordings",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSquareRecording=function(e,n){i.show({controller:"CreateOrEditSquareRecordingDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/squareRecordings/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{squareRecording:n,squareRecordings:f.squareRecordings.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSquareRecording=y,f.exportSelectedSquareRecordings=function(){var e=angular.copy(f.selectedSquareRecordings);return f.selectedSquareRecordings=[],e},f.deleteSelectedSquareRecordings=function(e){var n=i.confirm().title("Are you sure want to delete the selected squareRecordings?").htmlContent("<b>"+f.selectedSquareRecordings.length+" selected</b> will be deleted.").ariaLabel("delete SquareRecordings").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSquareRecordings.forEach(function(e){y(e)}),f.selectedSquareRecordings=[]})},f.deselectSquareRecordings=function(){f.selectedSquareRecordings=[]},f.selectAllSquareRecordings=function(){f.selectedSquareRecordings=f.squareRecordings.rows};var b=!0,A=1;function E(e){f.squareRecordings=e||{count:0,rows:[]}}function y(e){m.squareRecording.delete({id:e.id}).$promise.then(function(){_.remove(f.squareRecordings.rows,{id:e.id}),f.squareRecordings.count-=1,f.squareRecordings.rows.length||f.getSquareRecordings(),p.success({title:_.startCase("SquareRecording")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsquareRecording"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsquareRecording",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSquareRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","squareRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.callysquare").controller("SquareRecordingsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.chatQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="chatQueues",f.listOrder="",f.listOrderAsc=null,f.selectedChatQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"chat",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.chat.chatQueues.edit",{id:e.id,chatQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"ChatQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:f.chatQueues?f.chatQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:f.chatQueues?f.chatQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("chatQueue")+"?").htmlContent("<b>"+(e.name||"chatQueue")+"</b> will be deleted.").ariaLabel("delete chatQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.chat.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.chat.realtime.queues",{})}},f.success=E,f.getChatQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.chatQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ChatQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditChatQueue=function(e,n){i.show({controller:"CreateOrEditChatQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatQueue:n,chatQueues:f.chatQueues.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteChatQueue=y,f.exportSelectedChatQueues=function(){var e=angular.copy(f.selectedChatQueues);return f.selectedChatQueues=[],e},f.deleteSelectedChatQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected chatQueues?").htmlContent("<b>"+f.selectedChatQueues.length+" selected</b> will be deleted.").ariaLabel("delete ChatQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedChatQueues.forEach(function(e){y(e)}),f.selectedChatQueues=[]})},f.deselectChatQueues=function(){f.selectedChatQueues=[]},f.selectAllChatQueues=function(){f.selectedChatQueues=f.chatQueues.rows};var b=!0,A=1;function E(e){f.chatQueues=e||{count:0,rows:[]}}function y(e){m.chatQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.chatQueues.rows,{id:e.id}),f.chatQueues.count-=1,f.chatQueues.rows.length||f.getChatQueues(),p.success({title:_.startCase("ChatQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEchatQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEchatQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getChatQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chatQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.chat").controller("ChatQueuesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CHAT.EDIT_CHATQUEUE",g.chatQueue=angular.copy(l),g.chatQueues=r,g.newChatQueue=!1,g.chatQueue||(g.chatQueue={strategy:"beepall",timeout:10},g.title="CHAT.NEW_CHATQUEUE",g.newChatQueue=!0),g.addNewChatQueue=function(){g.errors=[],d.chatQueue.save(g.chatQueue).$promise.then(function(e){g.chatQueues.unshift(e.toJSON()),o.success({title:"ChatQueue properly created",msg:g.chatQueue.name?g.chatQueue.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatQueue=function(){g.errors=[],d.chatQueue.update({id:g.chatQueue.id},g.chatQueue).$promise.then(function(e){var n=_.find(g.chatQueues,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ChatQueue properly saved!",msg:g.chatQueue.name?g.chatQueue.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatQueue=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chatQueue will be deleted.").ariaLabel("Delete ChatQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.chatQueue.delete({id:g.chatQueue.id}).$promise.then(function(){_.remove(g.chatQueues,{id:g.chatQueue.id}),o.success({title:"ChatQueue properly deleted!",msg:(g.chatQueue.name||"chatQueue")+" has been deleted!"}),v(g.chatQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chatQueues","chatQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.chatQueue.getAgents({id:c.chatQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserChatQueue?"penalty "+e.UserChatQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.chatQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.removeAgents({id:c.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.addAgents({id:c.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CHAT.ALL_AGENTS"),labelSelected:r.instant("CHAT.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","chatQueue","chatQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.chat").controller("ChatQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.chatQueue.getTeams({id:l.chatQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.chatQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("CHAT.ALL_TEAMS"),labelSelected:t.instant("CHAT.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.removeTeams({id:l.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.addTeams({id:l.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","chatQueue","$translate","Auth","crudPermissions"],angular.module("app.chat").controller("ChatQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.chatQueue=c||e.params.chatQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"ChatQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:u.chatQueues?u.chatQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:u.chatQueues?u.chatQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoChatQueues=function(){e.go("app.chat.chatQueues",{},{reload:"app.chat.chatQueues"})},u.saveChatQueue=function(){r.chatQueue.update({id:u.chatQueue.id},u.chatQueue).$promise.then(function(){l.success({title:"ChatQueue updated!",msg:u.chatQueue.name?u.chatQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","chatQueue","userProfileSection"],angular.module("app.chat").controller("ChatQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.chatWebsites=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="chatWebsites",f.listOrder="",f.listOrderAsc=null,f.selectedChatWebsites=[],f.query={fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",sort:"-updatedAt",limit:10,page:1},f.arrayagentIdentifier=_.keyBy([{option:"WebsiteAlias",value:"'website_alias'"},{option:"AgentAlias",value:"'agent_alias'"},{option:"AgentFullname",value:"'agent_fullname'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayheader_shape=_.keyBy([{option:"Rounded",value:"'rounded'"},{option:"Squared",value:"'squared'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayalignment=_.keyBy([{option:"bottom_right",value:"'bottom_right'"},{option:"right",value:"'right'"},{option:"left",value:"'left'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymessagesAlignment=_.keyBy([{option:"alternate",value:"'alternate'"},{option:"centered",value:"'centered'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayratingType=_.keyBy([{option:"Star",value:"'star'"},{option:"Thumb",value:"'thumb'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.chat.chatWebsites.edit",{id:e.id,chatWebsite:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.chat.chatWebsites.edit",{id:e.id,tab:10})},f.offlinemessagesgoto=function(e,n){t.go("app.chat.chatWebsites.edit",{id:e.id,tab:11})},f.agentadddialog=function(e,n){i.show({controller:"ChatWebsiteagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatWebsite:e,chatWebsites:f.chatWebsites?f.chatWebsites.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("chatWebsite")+"?").htmlContent("<b>"+(e.name||"chatWebsite")+"</b> will be deleted.").ariaLabel("delete chatWebsite").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getChatWebsites=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.chatWebsite.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ChatWebsites",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditChatWebsite=function(e,n){i.show({controller:"CreateOrEditChatWebsiteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:n,chatWebsites:f.chatWebsites.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteChatWebsite=y,f.exportSelectedChatWebsites=function(){var e=angular.copy(f.selectedChatWebsites);return f.selectedChatWebsites=[],e},f.deleteSelectedChatWebsites=function(e){var n=i.confirm().title("Are you sure want to delete the selected chatWebsites?").htmlContent("<b>"+f.selectedChatWebsites.length+" selected</b> will be deleted.").ariaLabel("delete ChatWebsites").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedChatWebsites.forEach(function(e){y(e)}),f.selectedChatWebsites=[]})},f.deselectChatWebsites=function(){f.selectedChatWebsites=[]},f.selectAllChatWebsites=function(){f.selectedChatWebsites=f.chatWebsites.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.chatWebsite&&(t=_.find(f.lists,{id:Number(f.chatWebsite.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.chatWebsite&&(a=_.find(f.lists,{id:Number(f.chatWebsite.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.interval,{id:e.resourceId})}),t=null;if(f.chatWebsite&&(t=_.find(f.interval,{id:Number(f.chatWebsite.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.interval,{id:t.id});a.canSelect=!1,n.push(a)}f.interval=n})}else{var t=[],a=null;f.chatWebsite&&(a=_.find(f.interval,{id:Number(f.chatWebsite.IntervalId)}));for(var i=0;i<f.interval.length;i++)a&&f.interval[i].id===a.id&&(f.interval[i].canSelect=!1,t.push(f.interval[i]));f.interval=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.chatWebsites=e||{count:0,rows:[]}}function y(e){m.chatWebsite.delete({id:e.id}).$promise.then(function(){_.remove(f.chatWebsites.rows,{id:e.id}),f.chatWebsites.count-=1,f.chatWebsites.rows.length||f.getChatWebsites(),p.success({title:_.startCase("ChatWebsite")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getChatWebsites())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chatWebsites","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.chat").controller("ChatWebsitesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CHAT.EDIT_CHATWEBSITE",g.chatWebsite=angular.copy(l),g.chatWebsites=r,g.newChatWebsite=!1,g.chatWebsite||(g.chatWebsite={remote:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),header_shape:"rounded",alignment:"bottom_right",verticalAlignment:30,labelText:"CHAT",messagesAlignment:"alternate",IntervalId:"null",timezone:"null",waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300,vidaooTopic:"Generated by XCALLY Motion",vidaooNote:"Meeting generated for interaction #{{interaction.id}} by {{agent.name}}"},g.title="CHAT.NEW_CHATWEBSITE",g.newChatWebsite=!0),n.params.id&&(g.chatWebsite.ChatWebsiteId=n.params.id),g.addNewChatWebsite=function(){g.errors=[],d.chatWebsite.save(g.chatWebsite).$promise.then(function(e){g.chatWebsites.unshift(e.toJSON()),o.success({title:"ChatWebsite properly created",msg:g.chatWebsite.name?g.chatWebsite.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatWebsite.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatWebsite=function(){g.errors=[],d.chatWebsite.update({id:g.chatWebsite.id},g.chatWebsite).$promise.then(function(e){var n=_.find(g.chatWebsites,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ChatWebsite properly saved!",msg:g.chatWebsite.name?g.chatWebsite.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatWebsite.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatWebsite=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chatWebsite will be deleted.").ariaLabel("Delete ChatWebsite").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.chatWebsite.delete({id:g.chatWebsite.id}).$promise.then(function(){_.remove(g.chatWebsites,{id:g.chatWebsite.id}),o.success({title:"ChatWebsite properly deleted!",msg:(g.chatWebsite.name||"chatWebsite")+" has been deleted!"}),v(g.chatWebsite)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatWebsite.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.chatWebsite&&(t=_.find(g.lists,{id:Number(g.chatWebsite.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.chatWebsite&&(a=_.find(g.lists,{id:Number(g.chatWebsite.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),t=null;if(g.chatWebsite&&(t=_.find(g.interval,{id:Number(g.chatWebsite.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.interval,{id:t.id});a.canSelect=!1,n.push(a)}g.interval=n})}else{var t=[],a=null;g.chatWebsite&&(a=_.find(g.interval,{id:Number(g.chatWebsite.IntervalId)}));for(var i=0;i<g.interval.length;i++)a&&g.interval[i].id===a.id&&(g.interval[i].canSelect=!1,t.push(g.interval[i]));g.interval=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chatWebsites","chatWebsite","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatWebsiteDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.chatWebsiteApps.rows.length){var t=r.chatWebsiteApps.rows[n]?r.chatWebsiteApps.rows[n]:r.chatWebsiteApps.rows[0];i.show({controller:"EditChatWebsiteApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsiteApp:t,chatWebsite:r.chatWebsite,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.chatWebsiteApps.rows[n]=e:r.chatWebsiteApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.chatWebsiteApps.rows.length;t++,0){var a=r.chatWebsiteApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.chatWebsite.context,a.exten=r.chatWebsite.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.chatWebsite.addApplications({id:r.chatWebsite.id},_.sortBy(n,"priority")).$promise.then(function(e){r.chatWebsiteApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.chatWebsiteApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.chatWebsite={},r.chatWebsiteApps={count:0,rows:[]},r.selectedChatWebsiteApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"ChatQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"chatQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:501}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",role:"agent",sort:"name",nolimit:!0},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]},{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"tvox",appType:"tvox",type:"tvox",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"serviceid",name:"serviceid",type:"text",param:0},{title:"channelid",name:"channelid",type:"text",param:1},{title:"tvoxurl",name:"tvoxurl",type:"text",param:2},{title:"tvoxloginurl",name:"tvoxloginurl",type:"text",param:3},{title:"tvoxsessionurl",name:"tvoxsessionurl",type:"text",param:4},{title:"tvoxusername",name:"tvoxusername",type:"text",param:5},{title:"tvoxpasswd",name:"tvoxpasswd",type:"password",param:6},{title:"motionurlonring",name:"motionurlonring",type:"text",param:7},{title:"motionurlonanswer",name:"motionurlonanswer",type:"text",param:8},{title:"motiontitle",name:"motiontitle",type:"text",param:9},{title:"motionurl",name:"motionurl",type:"text",param:10}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.chatWebsite=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getChatWebsiteApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.chatWebsiteApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getChatWebsiteApps=function(){r.promise=o.chatWebsite.getApplications(r.query,t).$promise},r.editChatWebsiteApp=n,r.editInterval=function(e,n){if(r.chatWebsiteApps.rows.length){var t=r.chatWebsiteApps.rows[n]?r.chatWebsiteApps.rows[n]:r.chatWebsiteApps.rows[0];i.show({controller:"EditChatWebsiteAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteChatWebsiteApp=function(e){_.remove(r.chatWebsiteApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedChatWebsiteApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedChatWebsiteApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedChatWebsiteApps.forEach(function(e){_.remove(r.chatWebsiteApps.rows,{id:e.id})}),r.selectedChatWebsiteApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.chat").controller("ChatWebsiteActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.chatWebsite.getAgents({id:c.chatWebsite.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserChatWebsite?"penalty "+e.UserChatWebsite.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.chatWebsite=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.chatWebsite.removeAgents({id:c.chatWebsite.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.chatWebsite.addAgents({id:c.chatWebsite.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CHAT.ALL_AGENTS"),labelSelected:r.instant("CHAT.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","chatWebsite","chatWebsites","realtime","$translate","Auth","crudPermissions"],angular.module("app.chat").controller("ChatWebsiteagentaddController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/avatar".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsiteagentAvatarController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditChatWebsiteAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("chat")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.chatQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.chatQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:501}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteApptagDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.tvox=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tvox.appdata)switch(l.tvox.appType?l.tvox.appType.toLowerCase():l.tvox.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tvox.appdata.split(",");l.tvox.key=d[0],l.tvox.language=d[1],l.tvox.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tvox.appdata.split(",");l.tvox.projectId=d[0],l.tvox.clientEmail=d[1],l.tvox.privateKey=d[2],l.tvox.language=d[3],l.tvox.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tvox.appdata.split(",");l.tvox.accesskeyid=d[0],l.tvox.secretaccesskey=d[1],l.tvox.lexregion=d[2],l.tvox.botname=d[3],l.tvox.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tvox.appdata.split(",");l.tvox.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tvox.text=d.slice(1,d.length).join(",");break;case"message":l.tvox.text=l.tvox.appdata;break;case"set":l.tvox.name=l.tvox.appdata.split("=")[0],l.tvox.value=l.tvox.appdata.split("=")[1];break;case"agi":l.tvox.project=l.tvox.appdata;break;default:var c=l.tvox.appdata.split(",");l.tvox.serviceid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.tvox.channelid=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.tvox.tvoxurl=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.tvox.tvoxloginurl=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.tvox.tvoxsessionurl=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10),l.tvox.tvoxusername=_.isEmpty(c[5])?c[5]:isNaN(c[5])?c[5]:parseInt(c[5],10),l.tvox.tvoxpasswd=_.isEmpty(c[6])?c[6]:isNaN(c[6])?c[6]:parseInt(c[6],10),l.tvox.motionurlonring=_.isEmpty(c[7])?c[7]:isNaN(c[7])?c[7]:parseInt(c[7],10),l.tvox.motionurlonanswer=_.isEmpty(c[8])?c[8]:isNaN(c[8])?c[8]:parseInt(c[8],10),l.tvox.motiontitle=_.isEmpty(c[9])?c[9]:isNaN(c[9])?c[9]:parseInt(c[9],10),l.tvox.motionurl=_.isEmpty(c[10])?c[10]:isNaN(c[10])?c[10]:parseInt(c[10],10)}function m(e){n.hide(e)}l.tvox.type&&"outbound"===l.tvox.type.toLowerCase()&&"outbounddial"===l.tvox.appType.toLowerCase()&&(l.tvox.prefix=l.tvox.phone?l.tvox.phone.split("$")[0]:void 0,l.tvox.callerId=l.tvox.callerID?"CALLERID(all)="+l.tvox.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.tvox.type&&"outbound"===l.tvox.type.toLowerCase()&&"outboundDial"===l.tvox.appType&&(l.tvox.phone=i.cutdigits?(l.tvox.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tvox.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tvox.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tvox.options+="U(xcally-mixmonitor-context)"):l.tvox.options=l.tvox.options.replace("U(xcally-mixmonitor-context)",""));if(l.tvox.appType&&"custom"===l.tvox.appType);else switch((l.tvox.app||l.tvox.appType).toLowerCase()){case"set":l.tvox.appdata=l.tvox.name+"="+l.tvox.value;break;case"custom":break;default:e[0]=l.tvox.serviceid,e[1]=l.tvox.channelid,e[2]=l.tvox.tvoxurl,e[3]=l.tvox.tvoxloginurl,e[4]=l.tvox.tvoxsessionurl,e[5]=l.tvox.tvoxusername,e[6]=l.tvox.tvoxpasswd,e[7]=l.tvox.motionurlonring,e[8]=l.tvox.motionurlonanswer,e[9]=l.tvox.motiontitle,e[10]=l.tvox.motionurl,l.tvox.appdata=e.join(",")}m(l.tvox)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteApptvoxDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.chatWebsiteChatCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatWebsite.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteChatCannedAnswers.rows,{id:e.id}),m.chatWebsiteChatCannedAnswers.count-=1,m.chatWebsiteChatCannedAnswers.rows.length||p(),l.success({title:"ChatCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteChatCannedAnswers={count:0,rows:[]},m.selectedChatWebsiteChatCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.ChatWebsiteId=m.chatWebsite.id,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the chatCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("chatCannedAnswer #")+e.id||"chatCannedAnswer")+"</b> will be deleted.").ariaLabel("delete chatCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getChatWebsiteChatCannedAnswers=p,m.createOrEditChatWebsiteChatCannedAnswer=function(e,n){o.show({controller:"CreateOrEditChatCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/chatCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,chatCannedAnswer:n,chatCannedAnswers:m.chatWebsiteChatCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedChatWebsiteChatCannedAnswers=function(){var e=angular.copy(m.selectedChatWebsiteChatCannedAnswers);return m.selectedChatWebsiteChatCannedAnswers=[],e},m.deleteChatWebsiteChatCannedAnswer=g,m.deleteSelectedChatWebsiteChatCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected chatCannedAnswers?").htmlContent("<b>"+m.selectedChatWebsiteChatCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete chatCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteChatCannedAnswers.forEach(function(e){g(e)}),m.selectedChatWebsiteChatCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteChatCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CHAT.EDIT_CHATCANNEDANSWER",g.chatCannedAnswer=angular.copy(l),g.chatCannedAnswers=r,g.newChatCannedAnswer=!1,g.chatCannedAnswer||(g.chatCannedAnswer={},g.title="CHAT.NEW_CHATCANNEDANSWER",g.newChatCannedAnswer=!0),n.params.id&&(g.chatCannedAnswer.ChatWebsiteId=n.params.id),g.addNewChatCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.chatCannedAnswer).$promise.then(function(e){g.chatCannedAnswers.unshift(e.toJSON()),o.success({title:"ChatCannedAnswer properly created",msg:g.chatCannedAnswer.name?g.chatCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.chatCannedAnswer.id},g.chatCannedAnswer).$promise.then(function(e){var n=_.find(g.chatCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ChatCannedAnswer properly saved!",msg:g.chatCannedAnswer.name?g.chatCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chatCannedAnswer will be deleted.").ariaLabel("Delete ChatCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.chatCannedAnswer.id}).$promise.then(function(){_.remove(g.chatCannedAnswers,{id:g.chatCannedAnswer.id}),o.success({title:"ChatCannedAnswer properly deleted!",msg:(g.chatCannedAnswer.name||"chatCannedAnswer")+" has been deleted!"}),v(g.chatCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chatCannedAnswers","chatCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.chatWebsite.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.chatWebsite=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.ChatWebsiteId=m.chatWebsite.id,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.chatWebsite.id,field:"ChatWebsiteId",route:"chatWebsite"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.chat").controller("ChatWebsiteDispositionsController",e)}(),function(){"use strict";function e(t,e,a){var i=this;i.chatWebsite={},i.offlineForm={},i.buttons=[{type:"label",name:"Label",icon:"icon-label"},{type:"chooseFromList",name:"Select",icon:"icon-playlist-plus"},{type:"input",name:"Input",icon:"icon-keyboard"},{type:"textarea",name:"Textarea",icon:"icon-format-text"},{type:"multipleChoices",name:"Radio Buttons",icon:"icon-radiobox-marked"},{type:"checkboxes",name:"Checkboxes",icon:"icon-checkbox-multiple-marked-outline"},{type:"agreement",name:"Agreement",icon:"icon-checkbox-marked-outline"},{type:"upload",name:"Upload",icon:"icon-upload"}],i.init=function(e){i.fields=[],i.customFields=[],i.uselessFields=["id","createdAt","updatedAt","ListId","CompanyId","$promise","$resolved"],i.chatWebsite=e,_.isEmpty(i.chatWebsite.offlineForm)&&(i.chatWebsite.offlineForm={items:[],fromKey:null});a.cmList.getCustomFields({id:i.chatWebsite.ListId}).$promise.then(function(e){for(var n=0;n<e.rows.length;n++)i.customFields.push({key:"cf_"+e.rows[n].id,value:e.rows[n].alias});return a.cmContact.describe().$promise}).then(function(e){for(var n=_.keys(e),t=0;t<n.length;t++)_.includes(i.uselessFields,n[t])||_.startsWith(n[t],"cf_")||i.fields.unshift({key:n[t],value:n[t]});return a.variable.get().$promise}).then(function(e){return i.variables=e.rows,a.mailAccount.get({fields:"id,name",raw:!0}).$promise.then(function(e){i.email_accounts=e.rows})}).catch(function(e){console.error(e)})},i.up=function(e,n){if(0!==n){var t=i.chatWebsite.offlineForm.items[n-1];i.chatWebsite.offlineForm.items[n]=t,i.chatWebsite.offlineForm.items[n-1]=angular.copy(e),i.chatWebsite.offlineForm.fromKey===n?i.chatWebsite.offlineForm.fromKey--:i.chatWebsite.offlineForm.fromKey===n-1&&i.chatWebsite.offlineForm.fromKey++}},i.down=function(e,n){if(n!==i.chatWebsite.offlineForm.items.length-1){var t=i.chatWebsite.offlineForm.items[n+1];i.chatWebsite.offlineForm.items[n]=t,i.chatWebsite.offlineForm.items[n+1]=angular.copy(e),i.chatWebsite.offlineForm.fromKey===n?i.chatWebsite.offlineForm.fromKey++:i.chatWebsite.offlineForm.fromKey===n+1&&i.chatWebsite.offlineForm.fromKey--}},i.add=function(e){i.chatWebsite.offlineForm.items.push({type:e,cmField:null,variable:null})},i.remove=function(e){var n=t.confirm().title("The component will be deleted.").textContent("Are you sure?").ariaLabel("Lucky day").ok("Ok").cancel("Cancel");t.show(n).then(function(){i.chatWebsite.offlineForm.items.splice(e,1)})},i.card_type="offline",i.email_accounts=[]}e.$inject=["$mdDialog","$document","api"],angular.module("app.chat").controller("ChatWebsiteofflineFormController",e)}(),function(){"use strict";function e(t,e,a){var i=this;i.chatWebsite={},i.onlineForm={},i.buttons=[{type:"label",name:"Label",icon:"icon-label"},{type:"chooseFromList",name:"Select",icon:"icon-playlist-plus"},{type:"input",name:"Input",icon:"icon-keyboard"},{type:"textarea",name:"Textarea",icon:"icon-format-text"},{type:"multipleChoices",name:"Radio Buttons",icon:"icon-radiobox-marked"},{type:"checkboxes",name:"Checkboxes",icon:"icon-checkbox-multiple-marked-outline"},{type:"agreement",name:"Agreement",icon:"icon-checkbox-marked-outline"}],i.init=function(e){i.fields=[],i.customFields=[],i.uselessFields=["id","createdAt","updatedAt","ListId","CompanyId","$promise","$resolved"],i.chatWebsite=e,_.isEmpty(i.chatWebsite.onlineForm)&&(i.chatWebsite.onlineForm={items:[],fromKey:null});a.cmList.getCustomFields({id:i.chatWebsite.ListId}).$promise.then(function(e){for(var n=0;n<e.rows.length;n++)i.customFields.push({key:"cf_"+e.rows[n].id,value:e.rows[n].alias});return a.cmContact.describe().$promise}).then(function(e){for(var n=_.keys(e),t=0;t<n.length;t++)_.includes(i.uselessFields,n[t])||_.startsWith(n[t],"cf_")||i.fields.unshift({key:n[t],value:n[t]});return a.variable.get().$promise}).then(function(e){return i.variables=e.rows,a.mailAccount.get({fields:"id,name",raw:!0}).$promise.then(function(e){i.email_accounts=e.rows})}).catch(function(e){console.error(e)})},i.up=function(e,n){if(0!==n){var t=i.chatWebsite.onlineForm.items[n-1];i.chatWebsite.onlineForm.items[n]=t,i.chatWebsite.onlineForm.items[n-1]=angular.copy(e),i.chatWebsite.onlineForm.fromKey===n?i.chatWebsite.onlineForm.fromKey--:i.chatWebsite.onlineForm.fromKey===n-1&&i.chatWebsite.onlineForm.fromKey++}},i.down=function(e,n){if(n!==i.chatWebsite.onlineForm.items.length-1){var t=i.chatWebsite.onlineForm.items[n+1];i.chatWebsite.onlineForm.items[n]=t,i.chatWebsite.onlineForm.items[n+1]=angular.copy(e),i.chatWebsite.onlineForm.fromKey===n?i.chatWebsite.onlineForm.fromKey++:i.chatWebsite.onlineForm.fromKey===n+1&&i.chatWebsite.onlineForm.fromKey--}},i.add=function(e){i.chatWebsite.onlineForm.items.push({type:e,cmField:null,variable:null})},i.remove=function(e){var n=t.confirm().title("The component will be deleted.").textContent("Are you sure?").ariaLabel("Lucky day").ok("Ok").cancel("Cancel");t.show(n).then(function(){i.chatWebsite.onlineForm.fromKey===e&&(i.chatWebsite.onlineForm.fromKey=null),i.chatWebsite.onlineForm.items.splice(e,1),i.chatWebsite.onlineForm.items.length||(i.chatWebsite.onlineForm.fromKey=null)})},i.card_type="online",i.email_accounts=[]}e.$inject=["$mdDialog","$document","api"],angular.module("app.chat").controller("ChatWebsiteonlineFormController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/customer_avatar".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsitecustomerAvatarController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"chatWebsite",action:"getDispositions",field:"name",params:{id:m.chatWebsite.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.chatWebsiteInteractions=e||{count:0,rows:[]};for(var n=0;n<m.chatWebsiteInteractions.rows.length;n+=1){var t=m.chatWebsiteInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatInteraction.get(m.query,p).$promise}function v(e){d.chatInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteInteractions.rows,{id:e.id}),m.chatWebsiteInteractions.count-=1,m.chatWebsiteInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteInteractions={count:0,rows:[]},m.selectedChatWebsiteInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.ChatWebsiteId=m.chatWebsite.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Customer Ip",column:"customerIp",type:"text",options:{excludedOperators:["$eq","$ne","$startsWith","$endsWith"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.chatInteractionDownload=function(s,e,n){return d.chatInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="chat-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getChatWebsiteInteractions=g,m.createOrEditChatWebsiteInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,interaction:n,interactions:m.chatWebsiteInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spychatInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"chat",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"chat.chatWebsites"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||ChatWebsiteId:=$eq["+m.chatWebsite.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedChatWebsiteInteractions=function(){var e=angular.copy(m.selectedChatWebsiteInteractions);return m.selectedChatWebsiteInteractions=[],e},m.deleteChatWebsiteInteraction=v,m.deleteSelectedChatWebsiteInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedChatWebsiteInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteInteractions.forEach(function(e){v(e)}),m.selectedChatWebsiteInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteInteractionsController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/logo".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsitelogoController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.chatWebsiteOfflineMessages=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatWebsite.getOfflineMessages(m.query,u).$promise}function g(e){d.chatOfflineMessage.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteOfflineMessages.rows,{id:e.id}),m.chatWebsiteOfflineMessages.count-=1,m.chatWebsiteOfflineMessages.rows.length||p(),l.success({title:"OfflineMessage deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteOfflineMessages={count:0,rows:[]},m.selectedChatWebsiteOfflineMessages=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,attachments,Contact.firstName,ContactId,ChatWebsiteId",sort:"-createdAt",limit:10,page:1},m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the offlineMessage?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("offlineMessage #")+e.id||"offlineMessage")+"</b> will be deleted.").ariaLabel("delete offlineMessage").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getChatWebsiteOfflineMessages=p,m.createOrEditChatWebsiteOfflineMessage=function(e,n){o.show({controller:"CreateOrEditOfflineMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,offlineMessage:n,offlineMessages:m.chatWebsiteOfflineMessages.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.showOfflineMessageChatWebsiteOfflineMessage=function(e,t){o.show({controller:"ShowOfflineMessageOfflineMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,resolve:{message:["apiResolver","$stateParams",function(e,n){return e.resolve("chatOfflineMessage@get",{fields:"id,body",id:t.id})}],attachments:["apiResolver","$stateParams",function(e,n){return e.resolve("attachment@get",{fields:"id,name",ChatOfflineMessageId:t.id})}]}})},m.exportSelectedChatWebsiteOfflineMessages=function(){var e=angular.copy(m.selectedChatWebsiteOfflineMessages);return m.selectedChatWebsiteOfflineMessages=[],e},m.deleteChatWebsiteOfflineMessage=g,m.deleteSelectedChatWebsiteOfflineMessages=function(e){var n=o.confirm().title("Are you sure want to delete the selected offlineMessages?").htmlContent("<b>"+m.selectedChatWebsiteOfflineMessages.length+" selected</b> will be deleted.").ariaLabel("delete offlineMessages").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteOfflineMessages.forEach(function(e){g(e)}),m.selectedChatWebsiteOfflineMessages=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteOfflineMessagesController",e)}(),function(){"use strict";function e(n,e,t,a,i){var s=this;s.title="CHAT.OFFLINE_MESSAGE",s.message=a,s.attachments=i.rows,s.closeDialog=function(e){n.hide(e)},s.download=function(i){return e.attachment.download({id:i.id}).$promise.then(function(e){if(e){var n=new Blob([e.buffer],{type:e.type}),t=document.createElement("a"),a=window.URL.createObjectURL(n);t.href=a,t.target="_self",t.download=i.name,document.body.appendChild(t),t.click(),setTimeout(function(){document.body.removeChild(t),window.URL.revokeObjectURL(a)},100)}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"ATTACHMENTS:GET",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.isHtml=_.isNil(s.message.body.match(/\s?<!doctype html>|(<html\b[^>]*>|<body\b[^>]*>|<x-[^>]+>)+/i))}e.$inject=["$mdDialog","api","toasty","message","attachments"],angular.module("app.chat").controller("ShowOfflineMessageOfflineMessageDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.chatWebsiteProactiveActions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatWebsite.getProactiveActions(m.query,u).$promise}function g(e){d.chatProactiveAction.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteProactiveActions.rows,{id:e.id}),m.chatWebsiteProactiveActions.count-=1,m.chatWebsiteProactiveActions.rows.length||p(),l.success({title:"ChatProactiveAction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteProactiveActions={count:0,rows:[]},m.selectedChatWebsiteProactiveActions=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,name,type,selector,timeout",limit:10,page:1},m.arraytype=_.keyBy([{option:"MouseOver",value:"'mouseOver'"},{option:"Timeout",value:"'timeout'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.ChatWebsiteId=m.chatWebsite.id,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the chatProactiveAction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("chatProactiveAction #")+e.id||"chatProactiveAction")+"</b> will be deleted.").ariaLabel("delete chatProactiveAction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getChatWebsiteProactiveActions=p,m.createOrEditChatWebsiteChatProactiveAction=function(e,n){o.show({controller:"CreateOrEditChatProactiveActionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/proactive/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,chatProactiveAction:n,proactive:m.chatWebsiteProactiveActions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedChatWebsiteProactiveActions=function(){var e=angular.copy(m.selectedChatWebsiteProactiveActions);return m.selectedChatWebsiteProactiveActions=[],e},m.deleteChatWebsiteChatProactiveAction=g,m.deleteSelectedChatWebsiteProactiveActions=function(e){var n=o.confirm().title("Are you sure want to delete the selected proactive?").htmlContent("<b>"+m.selectedChatWebsiteProactiveActions.length+" selected</b> will be deleted.").ariaLabel("delete proactive").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteProactiveActions.forEach(function(e){g(e)}),m.selectedChatWebsiteProactiveActions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteProactiveActionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CHAT.EDIT_CHATPROACTIVEACTION",g.chatProactiveAction=angular.copy(l),g.proactive=r,g.newChatProactiveAction=!1,g.chatProactiveAction||(g.chatProactiveAction={type:"mouseOver"},g.title="CHAT.NEW_CHATPROACTIVEACTION",g.newChatProactiveAction=!0),n.params.id&&(g.chatProactiveAction.ChatWebsiteId=n.params.id),g.addNewChatProactiveAction=function(){g.errors=[],d.chatProactiveAction.save(g.chatProactiveAction).$promise.then(function(e){g.proactive.unshift(e.toJSON()),o.success({title:"ChatProactiveAction properly created",msg:g.chatProactiveAction.name?g.chatProactiveAction.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatProactiveAction.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatProactiveAction.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatProactiveAction=function(){g.errors=[],d.chatProactiveAction.update({id:g.chatProactiveAction.id},g.chatProactiveAction).$promise.then(function(e){var n=_.find(g.proactive,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ChatProactiveAction properly saved!",msg:g.chatProactiveAction.name?g.chatProactiveAction.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatProactiveAction.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatProactiveAction.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatProactiveAction=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chatProactiveAction will be deleted.").ariaLabel("Delete ChatProactiveAction").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.chatProactiveAction.delete({id:g.chatProactiveAction.id}).$promise.then(function(){_.remove(g.proactive,{id:g.chatProactiveAction.id}),o.success({title:"ChatProactiveAction properly deleted!",msg:(g.chatProactiveAction.name||"chatProactiveAction")+" has been deleted!"}),v(g.chatProactiveAction)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatProactiveAction.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatProactiveAction.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","proactive","chatProactiveAction","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatProactiveActionDialogController",e)}(),function(){"use strict";function e(e){var n=this;n.chatWebsite={},n.init=function(e){n.chatWebsite=e,n.start="\n\x3c!-- START Motion Chat Script --\x3e",n.script='\n    <script src="'+n.chatWebsite.remote+"/api/chat/websites/"+n.chatWebsite.id+"/snippet?token="+n.chatWebsite.token+'"><\/script>',n.end="\n\x3c!-- START Motion Chat Script --\x3e"},n.info={},e.$watch("vm_ac.chatWebsite.remote",function(e){n.script='\n    <script src="'+n.chatWebsite.remote+"/api/chat/websites/"+n.chatWebsite.id+"/snippet?token="+n.chatWebsite.token+'"><\/script>'})}e.$inject=["$scope"],angular.module("app.chat").controller("ChatWebsiteScriptController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/system_avatar".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsitesystemAvatarController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.chatWebsite=c||e.params.chatWebsite||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.agentadddialog=function(e,n){t.show({controller:"ChatWebsiteagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatWebsite:e,chatWebsites:p.chatWebsites?p.chatWebsites.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoChatWebsites=function(){e.go("app.chat.chatWebsites",{},{reload:"app.chat.chatWebsites"})},p.saveChatWebsite=function(){r.chatWebsite.update({id:p.chatWebsite.id},p.chatWebsite).$promise.then(function(){l.success({title:"ChatWebsite updated!",msg:p.chatWebsite.name?p.chatWebsite.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.chatWebsite&&(t=_.find(p.lists,{id:Number(p.chatWebsite.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.chatWebsite&&(a=_.find(p.lists,{id:Number(p.chatWebsite.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){p.interval=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){p.interval=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.interval,{id:e.resourceId})}),t=null;if(p.chatWebsite&&(t=_.find(p.interval,{id:Number(p.chatWebsite.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.interval,{id:t.id});a.canSelect=!1,n.push(a)}p.interval=n})}else{var t=[],a=null;p.chatWebsite&&(a=_.find(p.interval,{id:Number(p.chatWebsite.IntervalId)}));for(var i=0;i<p.interval.length;i++)a&&p.interval[i].id===a.id&&(p.interval[i].canSelect=!1,t.push(p.interval[i]));p.interval=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","chatWebsite","userProfile","userProfileSection"],angular.module("app.chat").controller("ChatWebsiteController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=["loggedIn","available","waiting","paused"],g=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"ChatQueues":void 0,channel:"chat",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("CHAT.CHATQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditChatQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatQueue:n,chatQueues:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatQueue:n,chatQueues:u.queues.rows,realtime:!1,crudPermissions:u.crudPermissions}})},r.on("chat_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,p))}),r.on("userChatQueue:save",function(e){var n=_.find(u.queues.rows,["id",e.ChatQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("userChatQueue:remove",function(e){var n=_.find(u.queues.rows,["id",e.ChatQueueId]);n&&(0<n.loggedInDb&&n.loggedInDb--,_.remove(n.agents,["id",e.UserId]))}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"chat")})}),e.$on("$destroy",function(){r.removeAllListeners("chat_queue:save"),r.removeAllListeners("userChatQueue:remove"),r.removeAllListeners("userChatQueue:save"),r.removeAllListeners("user:update"),g&&n.cancel(g)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.chat").controller("QueuesChatRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.chat.realtime.agents":this.selectedTab=0;break;case"app.chat.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.chat.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.chat.realtime.agents");break;case 1:t.go("app.chat.realtime.queues");break;default:t.go("app.chat.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.chat").controller("ChatRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.companies=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="companies",f.listOrder="",f.listOrderAsc=null,f.selectedCompanies=[],f.query={fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){a.go("app.contactmanager.companies.edit",{id:e.id,company:e,crudPermissions:f.crudPermissions})},f.gotocontactsgoto=function(t,e){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{CompanyId:t.id}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{CompanyId:t.id})}},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("company")+"?").htmlContent("<b>"+(e.name||"company")+"</b> will be deleted.").ariaLabel("delete company").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getCompanies=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cmCompany.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Companies",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditCompany=function(e,n){i.show({controller:"CreateOrEditCompanyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/companies/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{company:n,companies:f.companies.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteCompany=y,f.exportSelectedCompanies=function(){var e=angular.copy(f.selectedCompanies);return f.selectedCompanies=[],e},f.deleteSelectedCompanies=function(e){var n=i.confirm().title("Are you sure want to delete the selected companies?").htmlContent("<b>"+f.selectedCompanies.length+" selected</b> will be deleted.").ariaLabel("delete Companys").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedCompanies.forEach(function(e){y(e)}),f.selectedCompanies=[]})},f.deselectCompanies=function(){f.selectedCompanies=[]},f.selectAllCompanies=function(){f.selectedCompanies=f.companies.rows};var b=!0,A=1;function E(e){f.companies=e||{count:0,rows:[]}}function y(e){m.cmCompany.delete({id:e.id}).$promise.then(function(){_.remove(f.companies.rows,{id:e.id}),f.companies.count-=1,f.companies.rows.length||f.getCompanies(),p.success({title:_.startCase("Company")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmCompany"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcmCompany",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getCompanies())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","companies","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.contactmanager").controller("CompaniesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_COMPANY",g.company=angular.copy(l),g.companies=r,g.newCompany=!1,g.company||(g.company={},g.title="CONTACTMANAGER.NEW_COMPANY",g.newCompany=!0),g.addNewCompany=function(){g.errors=[],d.cmCompany.save(g.company).$promise.then(function(e){g.companies.unshift(e.toJSON()),o.success({title:"Company properly created",msg:g.company.name?g.company.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCompany.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCompany.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCompany=function(){g.errors=[],d.cmCompany.update({id:g.company.id},g.company).$promise.then(function(e){var n=_.find(g.companies,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Company properly saved!",msg:g.company.name?g.company.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCompany.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCompany.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCompany=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The company will be deleted.").ariaLabel("Delete Company").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmCompany.delete({id:g.company.id}).$promise.then(function(){_.remove(g.companies,{id:g.company.id}),o.success({title:"Company properly deleted!",msg:(g.company.name||"company")+" has been deleted!"}),v(g.company)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCompany.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCompany.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","companies","company","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditCompanyDialogController",e)}(),function(){"use strict";function e(a,e,n,t,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.company=c||a.params.company||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=a.params.tab||0,u.gotogoto=function(t,e){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{CompanyId:t.id}):l.info({title:i.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:i.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{CompanyId:t.id})}},u.alert=l.info,u.gotoCompanies=function(){a.go("app.contactmanager.companies",{},{reload:"app.contactmanager.companies"})},u.saveCompany=function(){r.cmCompany.update({id:u.company.id},u.company).$promise.then(function(){l.success({title:"Company updated!",msg:u.company.name?u.company.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmCompany",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","company","userProfileSection"],angular.module("app.contactmanager").controller("CompanyController",e)}(),function(){"use strict";function e(n,i,t,a,e,s,o,r,l,d,c,m,u,p,g,v,h,f,b){var A=this;A.currentUser=f.getCurrentUser(),A.license=b,A.userProfile=r,A.userProfileSection=l&&1==l.count?l.rows[0]:null,A.crudPermissions=f.parseCrudPermissions(A.userProfileSection?A.userProfileSection.crudPermissions:null);var E=60,y=1024*E*1024;A.ngFlowOptions={target:"api/cm/contacts/upload",singleFile:!0,maxChunkRetries:1,chunkSize:y,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},A.contacts=c||{count:0,rows:[]},A.options={hidden:!1,hover:!1,isOpen:!1},A.table="cm_contacts",A.selectedContacts=[],A.lists=m||{rows:[],count:0},A.companies=p||{rows:[],count:0},A.tags=v||{rows:[],count:0},A.listsMap=u,A.companiesMap=g,A.selectedTags=[],A.selectedList=null,A.selectedCompany=null,A.query=_.merge({includeAll:!0,sort:"-updatedAt",limit:10,offset:0,page:1},e),A.editdialog=function(e,n){a.go("app.contactmanager.contacts.edit",{id:e.id,crudPermissions:A.crudPermissions})},A.deleteconfirm=function(e,n){var t=s.confirm().title("Are you sure want to delete the contact?").htmlContent("<b>"+(e.firstName||e.email||e.phone||"Contact")+"</b> will be deleted.").ariaLabel("delete contact").targetEvent(n).ok("OK").cancel("CANCEL");s.show(t).then(function(){O(e)})},A.success=I,A.getContacts=function(){A.query.offset=(A.query.page-1)*A.query.limit,f.hasRole("admin")?A.promise=d.cmContact.get(A.query,I).$promise:(A.query.id=A.userProfile.id,A.query.ListId=A.query.ListId?A.query.ListId:_.map(A.lists.rows,"id"),A.query.CompanyId=A.query.CompanyId?A.query.CompanyId:_(A.companies.rows).filter({canSelect:void 0}).map("id").value(),A.query.section="Contacts",A.promise=d.userProfile.getResources(A.query,I).$promise)},A.getAssignedCompanies=function(){if(!f.hasRole("admin")){var e=_(A.contacts.rows).map(function(e){return{id:e.CompanyId}}).uniqBy("id").filter(function(e){return e.id&&0<e.id}).pullAllBy(A.companies.rows,"id").value();if(!_.isEmpty(e)){var n=[];e.forEach(function(e){n.push(d.cmCompany.get({id:e.id,fields:"id,name"}).$promise)}),o.all(n).then(function(e){e.forEach(function(e){var n=e.toJSON();n.canSelect=!1,A.companies.rows.push(n);var t={};t[n.id]=n.name,A.companiesMap=_.assignIn(A.companiesMap,t)})}).catch(function(e){h.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_COMPANY",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}}},A.mergeContact=function(e,n){s.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",nolimit:!0})}]},locals:{contacts:A.contacts.rows}})},A.duplicateContact=function(e,n){s.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",nolimit:!0})}]},locals:{contacts:A.contacts.rows}})},A.createOrEditContact=function(e,n){n&&n.dateOfBirth&&(n.dateOfBirth=new Date(n.dateOfBirth));s.show({controller:"CreateOrEditContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{ListId:A.query.ListId||a.params.ListId,CompanyId:A.query.CompanyId||a.params.CompanyId,contact:n,contacts:A.contacts.rows,companies:A.companies,lists:A.lists,setting:null,crudPermissions:A.crudPermissions}})},A.deleteContact=O,A.exportSelectedContacts=function(){var e=angular.copy(A.selectedContacts);return A.selectedContacts=[],e},A.deleteSelectedContacts=function(e){var n=s.confirm().title("Are you sure want to delete the selected contacts?").htmlContent("<b>"+A.selectedContacts.length+" selected</b> will be deleted.").ariaLabel("delete Contacts").targetEvent(e).ok("OK").cancel("CANCEL");s.show(n).then(function(){A.selectedContacts.forEach(function(e){O(e)}),A.selectedContacts=[]})},A.deselectContacts=function(){A.selectedContacts=[]},A.selectAllContacts=function(){A.selectedContacts=A.contacts.rows},A.createTag=function(e){var n=s.prompt().title("What would you name your tag?").placeholder("Tag name").ariaLabel("Tag name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(function(e){if(e)return d.tag.save({name:e});h.error({title:"Error creating tag!",msg:"Invalid tag name."})}).then(function(e){e&&(A.tags.rows.push(e),h.success({title:"Tag properly created!",msg:e.tag?e.name+" has been created!":""}))})},A.createList=function(e){var n=s.prompt().title("What would you name your list?").placeholder("List name").ariaLabel("List name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(function(e){if(e)return d.cmList.save({name:e});h.error({title:"Error creating list!",msg:"Invalid list name."})}).then(function(e){e&&(A.lists.rows.push(e),h.success({title:"List properly created!",msg:e.name?e.name+" has been created!":""}))})},A.createCompany=function(e){var n=s.prompt().title("What would you name your company?").placeholder("Company name").ariaLabel("Company name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(function(e){if(e)return d.cmCompany.save({name:e});h.error({title:"Error creating company!",msg:"Invalid company name."})}).then(function(e){e&&(A.companies.rows.push(e),h.success({title:"Company properly created!",msg:e.name?e.name+" has been created!":""}))})},A.importContacts=function(e,n,t){var a=JSON.parse(n);s.show({controller:"ImportContactsDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/import/import.html",parent:angular.element(i.body),clickOutsideToClose:!1,locals:{lists:m,companies:p,file:a.file,fields:a.fields,license:A.license}}).then(function(){A.getContacts()}).catch(function(e){console.error()})},A.importContactsUpdates=function(e,n,t){var a=JSON.parse(n);s.show({controller:"ImportContactsUpdatesDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/import/importUpdates.html",parent:angular.element(i.body),clickOutsideToClose:!1,locals:{lists:m,companies:p,file:a.file,fields:a.fields,license:A.license}}).then(function(){A.getContacts()}).catch(function(e){console.error()})},A.hasPermission=function(){return f.hasPermission(303)||f.hasRole("admin")},A.fileAdded=function(e){var n=["csv"];if(!_.includes(n,e.getExtension()))return h.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(e.size>y)return h.error({title:"File too big",msg:"The max allowed size is "+E+"MB"}),!1;return!0},a.params.ListId&&(A.selectedList=a.params.ListId),a.params.CompanyId&&(A.selectedCompany=a.params.CompanyId),n.$watch("vm.options.isOpen",function(e){e?t(function(){n.tooltipVisible=A.options.isOpen},600):n.tooltipVisible=A.options.isOpen});var S=!0,T=1;function I(e){A.contacts=e||{count:0,rows:[]}}function O(e){d.cmContact.delete({id:e.id}).$promise.then(function(){_.remove(A.contacts.rows,{id:e.id}),A.contacts.count-=1,A.contacts.rows.length||A.getContacts(),h.success({title:"Contact deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){A.errors=e.data.errors||[{message:e.toString(),type:"api.contact.delete"}];for(var n=0;n<e.data.errors.length;n++)h.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else h.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}n.$watch("vm.query.filter",function(e,n){S?t(function(){S=!1}):(n||(T=A.query.page),e!==n&&(A.query.page=1),e||(A.query.page=T),A.getContacts())},!0),n.$watch("vm.selectedList",function(e,n){e!==n&&(A.query.ListId=A.selectedList||void 0,A.getContacts())}),n.$watch("vm.selectedCompany",function(e,n){e!==n&&(A.query.CompanyId=A.selectedCompany||void 0,A.getContacts())}),n.$watch("vm.selectedTags",function(e,n){(e.length||n.length)&&A.getContacts()})}e.$inject=["$scope","$document","$timeout","$state","$stateParams","$mdDialog","$q","userProfile","userProfileSection","api","contacts","lists","listsMap","companies","companiesMap","tags","toasty","Auth","license"],angular.module("app.contactmanager").controller("ContactsController",e)}(),function(){"use strict";function e(t,e,a,n,i,s,o,r,l,d,c){var m=this;if(m.errors=[],m.title="CONTACTMANAGER.EDIT_CONTACT",m.crudPermissions=c,m.contact=angular.copy(o),m.additionalItemTypes=[],m.additionalItems=[],m.contacts=n||{rows:[],count:0},m.lists=i||{rows:[],count:0},m.companies=s||{rows:[],count:0},m.customFields={rows:[],count:0},m.newContact=!1,m.newPhone=function(e){return{phone:e,color:"gray"}},m.contactItemTypes=[],m.contact)delete m.contact.List,f(m.contact.ListId),d.cmContact.getAdditionalPhones({id:o.id}).$promise.then(function(e){var n=_.map(e,"item"),t=_.map(e,"description");m.additionalItemTypes=_.map(e,"ItemTypeId");var a=_.map(e,"ItemType.rgbBackgroundColor"),i=_.map(e,"ItemType.name");m.additionalItems=[];for(var s=0;s<n.length;s++)m.additionalItems.push({phone:n[s],type:i[s],color:a[s],description:t[s]})}).catch(function(e){console.log(e)});else{m.contact={ListId:r?parseInt(r,10):void 0,CompanyId:l?parseInt(l,10):void 0};var u=_.map(m.contact.Phones,"item"),p=_.map(m.contact.Phones,"description");m.additionalItemTypes=_.map(m.contact.Phones,"ItemTypeId");var g=_.map(m.contact.Phones,"ItemType.rgbBackgroundColor"),v=_.map(m.contact.Phones,"ItemType.name");m.additionalItems=[];for(var h=0;h<u.length;h++)m.additionalItems.push({phone:u[h],type:v[h],color:g[h],description:p[h]});m.title="CONTACTMANAGER.NEW_CONTACT",m.newContact=!0,b()}function f(e){if(e)return d.cmList.getCustomFields({id:e}).$promise.then(function(e){if(e){m.customFields=e;var n=_.map(m.customFields.rows,function(e){return"cf_"+e.id});return d.cmContact.get({id:m.contact.id,attributes:n,raw:!0}).$promise.then(function(e){m.contact=_.merge(m.contact,e)})}}).then(function(){m.customFields.rows.forEach(function(e){"datetime"===e.type&&m.contact["cf_"+e.id]&&(m.contact["cf_"+e.id]=A(m.contact["cf_"+e.id]))}),Object.keys(m.contact).forEach(function(e){if(_.startsWith(e,"cf_")){var n=e.split("_")[1];_.some(m.customFields.rows,["id",Number(n)])||delete m.contact["cf_"+n]}})}).catch(function(e){console.error(e)});m.customFields={rows:[],count:0}}function b(){return d.cmList.getGlobalCustomFields().$promise.then(function(e){if(e){m.customFields=e;_.map(m.customFields.rows,function(e){return"cf_"+e.id})}else;}).catch(function(e){console.error(e)})}function A(e){return null===e?void 0:new Date(e)}function E(){t.hide()}d.contactItemType.get({fields:"id,name,rgbBackgroundColor"}).$promise.then(function(e){m.contactItemTypes=e.rows}),m.addNewContact=function(){m.errors=[],d.cmContact.save(m.contact).$promise.then(function(e){m.contacts.unshift(e),d.cmContact.setAdditionalPhones({id:e.id,items:m.additionalItems,item_types:m.additionalItemTypes}).$promise.then(function(){a.success({title:"Contact properly created",msg:m.contact.name?m.contact.name+" has been created!":""}),E()})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contacts.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveContact=function(){m.errors=[],d.cmContact.update({id:m.contact.id},m.contact).$promise.then(function(e){var n=_.find(m.contacts,{id:e.id});n&&_.merge(n,e)}).then(function(){return d.cmContact.setAdditionalPhones({id:o.id,items:m.additionalItems,item_types:m.additionalItemTypes}).$promise.then(function(){a.success({title:"Contact properly saved!",msg:m.contact.name?m.contact.name+" has been saved!":""}),E()})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.contact.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteContact=function(e){m.errors=[];var n=t.confirm().title("Are you sure?").content("The contact will be deleted.").ariaLabel("Delete Contact").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){d.cmContact.delete({id:m.contact.id}).$promise.then(function(){_.remove(m.contacts,{id:m.contact.id}),a.success({title:"Contact properly deleted!",msg:m.contact.name?m.contact.name+" has been deleted!":""}),E()}).catch(function(e){console.error(e),m.errors=e.data.errors||[{message:e.toString(),type:"api.contact.delete"}]})},function(){})},m.closeDialog=E,m.getCustomFields=f,m.getDateFromString=A,e.$watch("vm.contact.ListId",function(e,n){_.isNil(e)&&b()})}e.$inject=["$mdDialog","$scope","toasty","contacts","lists","companies","contact","ListId","CompanyId","api","crudPermissions"],angular.module("app.tools").controller("CreateOrEditContactDialogController",e).directive("customChip",function(){return{restrict:"A",scope:!1,link:function(e,n,t){n.parent().parent().css("background",e.$chip.color)}}})}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this;function r(){e.hide()}o.errors=[],o.title="CONTACTMANAGER.COPY_CONTACT",o.contact=angular.copy(n),o.lists=i||{rows:[],count:0},o.addNewContact=function(){o.errors=[];var n=o.contact.id;delete o.contact.id,o.contact.tags&&!o.contact.tags.length&&delete o.contact.tags;s.cmContact.save(o.contact).$promise.then(function(e){return a.unshift(e),s.cmContact.duplicateAdditionalPhones({id:n,fromContactId:n,toContactId:e.id}).$promise.then(function(){t.success({title:"Contact properly created",msg:o.contact.name?o.contact.name+" has been created!":""}),r()})}).catch(function(e){console.error(e),o.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}]})},o.closeDialog=r}e.$inject=["$mdDialog","toasty","contact","contacts","lists","api"],angular.module("app.tools").controller("DuplicateContactDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(e){a.hide(e)}d.errors=[],d.title="CONTACTMANAGER.EDIT_HOPPER",d.hopper=angular.copy(o),d.hoppers=s,d.newHopper=!1,d.crudPermissions=l,d.hopper||(d.hopper={},d.title="CONTACTMANAGER.NEW_HOPPER",d.newHopper=!0),d.saveHopper=function(){d.errors=[],r.cmHopper.update({id:d.hopper.id},d.hopper).$promise.then(function(e){var n=_.find(d.hoppers,{id:e.id});n&&_.merge(n,e),i.success({title:"Hopper properly saved!",msg:d.hopper.name?d.hopper.name+" has been saved!":""}),c(e)}).catch(function(e){console.error(e),d.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}]})},d.getDateFromString=function(e){return null===e?void 0:new Date(e)},d.closeDialog=c}e.$inject=["$scope","$state","$location","$mdDialog","toasty","hoppers","hopper","api","crudPermissions"],angular.module("app.contactmanager.contacts").controller("EditHopperDialogController",e)}(),function(){"use strict";function e(a,t,e,i,s,n,o,r,l,d,c,m,u,p,g,v,h,f,b,A,E,y){var S=this;function T(n){return function(e){S[n]=e||{count:0,rows:[]}}}function I(){S.queryHopper.offset=(S.queryHopper.page-1)*S.queryHopper.limit,S.queryHopper.id=S.contact.id,S.promise=r.cmContact.getHoppers(S.queryHopper,T("hoppers")).$promise}function O(){S.queryFinal.offset=(S.queryFinal.page-1)*S.queryFinal.limit,S.queryFinal.id=S.contact.id,S.promise=r.cmContact.getHopperFinals(S.queryFinal,T("finals")).$promise}function C(){S.queryHistory.offset=(S.queryHistory.page-1)*S.queryHistory.limit,S.queryHistory.id=S.contact.id,S.promise=r.cmContact.getHopperHistories(S.queryHistory,T("histories")).$promise}function w(e){S.journeyIsLoading=!0;var n=_.merge(S.journeyOptions,{id:S.contact.id,offset:e||0});return y.get(S.journey,n).then(function(e){S.journey=e.journey,S.canLoadMoreJourney=e.loadMore}).finally(function(){S.journeyIsLoading=!1})}S.currentUser=A.getCurrentUser(),S.license=b,S.journey=[],S.contact=l||{},S.hoppers=d||{rows:[],count:0},S.finals=c||{rows:[],count:0},S.histories=m||{rows:[],count:0},S.companies=p||{rows:[],count:0},S.lists=g||{rows:[],count:0},S.customFields=v||{rows:[],count:0},S.tags=h||{rows:[],count:0},S.jscriptySessions=f||{rows:[],count:0},S.journeyOptions=y.getQuery(),S.quickFilters=y.getQuickFilters(),S.journeyTimelineOptions={scrollEl:"#journey-content"},S.additionalItems=[],S.additionalItemTypes=[],S.contactItemTypes=[],S.firstDayMonth=new Date(moment().startOf("month").subtract(1,"seconds").utcOffset(0,!0).format()),S.lastDayMonth=new Date(moment().endOf("month").subtract(1,"day").utcOffset(0,!0).format()),S.userProfileSection=E&&1==E.count?E.rows[0]:null,S.crudPermissions=A.parseCrudPermissions(S.userProfileSection?S.userProfileSection.crudPermissions:null),S.arraypriority=_.keyBy([{option:"Highest",value:"'4'"},{option:"High",value:"'3'"},{option:"Medium",value:"'2'"},{option:"Low",value:"'1'"},{option:"Lowest",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),S.queryHopper={fields:"id,phone,scheduledat,priority,recallme,VoiceQueueId,CampaignId,UserId",sort:"-updatedAt",limit:10,page:1},S.queryFinal={fields:"id,uniqueid,calleridnum,statedesc,starttime,disposition",sort:"-id",limit:10,page:1},S.queryHistory={fields:"id,uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-id",limit:10,page:1},S.queryJscriptySession={fields:"id,starttime,endtime,membername,projectname",sort:"-starttime",limit:10,page:1},S.selectedTab=e.params.tab||0,S.onInit=function(){A.hasRole("admin")||(function(){if(!_.some(S.companies.rows,{id:S.contact.CompanyId}))r.cmCompany.get({id:S.contact.CompanyId,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,S.companies.rows.push(n)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_COMPANY",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}(),function(){var e=_.map(S.contact.Tags,function(e){return{id:e.id,name:e.name}});if(!_.isEmpty(e))for(var n=0;n<e.length;n++)_.some(S.tags.rows,{id:e.id})||(e[n].canSelect=!1,S.tags.rows.push(e[n]))}());return r.user.get({fields:"id,fullname",nolimit:!0}).$promise.then(function(e){S.users=e||{count:0,rows:[]},S.usersMap=_.mapValues(_.keyBy(S.users.rows,"id"),"fullname"),S.Tags=_.map(S.contact.Tags,"id");var n=_.map(S.contact.Phones,"item"),t=_.map(S.contact.Phones,"description");S.additionalItemTypes=_.map(S.contact.Phones,"ItemTypeId");var a=_.map(S.contact.Phones,"ItemType.rgbBackgroundColor"),i=_.map(S.contact.Phones,"ItemType.name"),s=_.map(S.contact.Phones,"ItemType.id");S.additionalItems=[];for(var o=0;o<n.length;o++)S.additionalItems.push({phone:n[o],type:i[o],ItemTypeId:s[o],color:a[o],description:t[o]})}).then(function(e){r.contactItemType.get({fields:"id,name,rgbBackgroundColor"}).$promise.then(function(e){S.contactItemTypes=e.rows})}).finally(function(){S.contact&&w()})},S.gotoContacts=function(){e.go("app.contactmanager.contacts",{},{reload:!0,notify:!0})},S.duplicateContact=function(e){s.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,resolve:{lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name"}):e.resolve("userProfile@getResources",{id:S.currentUser.userProfileId,section:"Lists",fields:"id,name"})}]},locals:{contacts:u.rows,contact:l}})},S.saveContact=function(){r.cmContact.update({id:S.contact.id},S.contact).$promise.then(function(){o.success({title:"Contact updated!",msg:S.contact.name?S.contact.name+" has been updated!":""})}).then(function(){return r.cmContact.setTags({id:S.contact.id,ids:S.Tags}).$promise}).then(function(){return r.cmContact.setAdditionalPhones({id:S.contact.id,items:S.additionalItems}).$promise}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEcontact",msg:e.data?JSON.stringify(e.data):e.toString()})})},S.editCompany=function(e,n){var t=_.find(S.companies.rows,{id:n});s.show({controller:"CreateOrEditCompanyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/companies/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{companies:[],license:null,setting:null,crudPermissions:!1===t.canSelect?{readOnly:!0,canEdit:!1,canDelete:!1}:r.userProfileSection.get({userProfileId:S.currentUser.userProfileId,sectionId:302}).$promise.then(function(e){var n=e.rows?e.rows[0]:null;return A.parseCrudPermissions(n?n.crudPermissions:null)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"API:GET_COMPANY_SECTION",msg:e.data?JSON.stringify(e.data):e.toString()})})},resolve:{company:["apiResolver",function(e){return e.resolve("cmCompany@get",{id:n})}]}})},S.onSelectList=function(e){if(S.contact.ListId){var n=s.confirm().title("You are selecting the list number: "+S.contact.ListId).textContent("Warning! You won't select a different list for the contact "+S.contact.firstName||S.contact.lastName||S.contact.id).targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(S.onSelectListSuccess).catch(function(){S.contact.ListId=null})}},S.onSelectListSuccess=function(){return r.cmList.getCustomFields({id:S.contact.ListId}).$promise.then(function(e){S.customFields=e||{rows:[],count:0}}).catch(function(e){console.error(e)})},S.getDateFromString=function(e){return null===e?void 0:new Date(e)},S.getHoppers=I,S.getFinals=O,S.getHistories=C,S.getJscriptySessions=function(){S.queryJscriptySession.offset=(S.queryJscriptySession.page-1)*S.queryJscriptySession.limit,S.queryJscriptySession.id=S.contact.id,S.promise=r.cmContact.getJscriptySessions(S.queryJscriptySession,T("jscriptySessions")).$promise},S.deleteconfirm=function(n,e){var t=s.confirm().title("Are you sure want to delete the agent?").htmlContent("<b>"+(n.phone||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){var e;e=n,r.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(S.hoppers.rows,{id:e.id}),S.hoppers.count--,S.hoppers.rows.length||S.getHoppers(),o.success({title:"Hopper deleted!",msg:e.phone?e.phone+" has been deleted!":""})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEhopper",msg:e.data?JSON.stringify(e.data):e.toString()})})},function(){console.log("CANCEL")})},S.editHopper=function(e,n){s.show({controller:"HopperdateController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopper:n,hoppers:S.hoppers.rows,license:null,setting:null,crudPermissions:S.crudPermissions}})},S.createOrEditIvrCampaignHopper=function(e,n){s.show({controller:"CreateOrEditHopperCampaignIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hoppers/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopper:n,hoppers:S.hoppers.rows,license:null,setting:null,crudPermissions:S.crudPermissions}})},S.newPhone=function(e){return{phone:e,color:"gray"}},S.getCustomerJourney=w,S.loadMoreJourney=function(){return n(function(e,n){var t=S.journey.length;return e(w(t))})},S.moveUp=function(e){N(e,e-1)},S.moveDown=function(e){N(e,e+1)};var R=!0,x=1;function N(e,n){var t=S.additionalItems[n];S.additionalItems[n]=S.additionalItems[e],S.additionalItems[e]=t,a.additionalPhonesForm.$setDirty()}a.$watch("vm.queryHopper.filter",function(e,n){R?t(function(){R=!1}):(n||(x=S.queryHopper.page),e!==n&&(S.queryHopper.page=1),e||(S.queryHopper.page=x),I())}),a.$watch("vm.queryFinal.filter",function(e,n){R?t(function(){R=!1}):(n||(x=S.queryFinal.page),e!==n&&(S.queryFinal.page=1),e||(S.queryFinal.page=x),O())}),a.$watch("vm.queryHistory.filter",function(e,n){R?t(function(){R=!1}):(n||(x=S.queryHistory.page),e!==n&&(S.queryHistory.page=1),e||(S.queryHistory.page=x),C())})}e.$inject=["$scope","$timeout","$state","$document","$mdDialog","$q","toasty","api","contact","hoppers","finals","histories","contacts","companies","lists","customFields","tags","jscriptySessions","license","Auth","userProfileSection","customerJourneyManager"],angular.module("app.contactmanager.contacts").controller("ContactController",e).directive("customChip",function(){return{restrict:"A",scope:!1,link:function(e,n,t){n.parent().parent().css("background",e.$chip.color)}}})}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;g.processing=!1,g.stopping=!0,g.license=p,g.pid=0,g.result={finish:!1,rows:0,affectedRows:0,failedRows:0,duplicatedRows:0,errors:[]},g.contactFields=[{key:"firstName",required:!0},{key:"lastName",required:!1},{key:"phone",required:!0},{key:"mobile",required:!1},{key:"email",required:!1},{key:"dateOfBirth",required:!1},{key:"country",required:!1},{key:"city",required:!1},{key:"street",required:!1},{key:"postalCode",required:!1},{key:"fax",required:!1}],g.motionBullFields=[{key:"UserId",required:!1},{key:"scheduledat",required:!1},{key:"priority",required:!1},{key:"dialTimezone",required:!1}],g.contactItemTypes=[],l.contactItemType.get({fields:"id,name,orderBy"}).$promise.then(function(e){var n=e.rows;console.log(n);for(var t=0;t<n.length;t++)g.contactItemTypes.push({key:n[t].name,required:!1})}),g.binding={},g.duplicate=[],g.lists=s||{rows:[],count:0},g.companies=o||{rows:[],count:0},g.customFields={rows:[],count:0},g.fields=u||[],g.closeDialog=function(){d.removeAllListeners("contact:import:"+v),n.hide()},g.onChangeList=function(){return l.cmList.getCustomFields({id:g.ListId}).$promise.then(function(e){g.customFields=e}).catch(function(e){console.error(e)})},g.uploadCsv=function(){g.processing=moment(),l.cmContact.import({id:m.filename,binding:g.binding,ListId:g.ListId,CompanyId:g.CompanyId,duplicates:g.duplicates,socket_timestamp:v}).$promise.then(function(e){g.stopping=!1,e&&e.pid&&(g.pid=e.pid)}).catch(function(e){g.processing=!1,r.error({title:"Import process failed!",msg:"Please retry with a new file"})})},g.getHeaderErrors=function(){var e=u;return e.push("contact_import_error"),e},g.getArrayErrors=function(){for(var e=[],n=0;n<g.result.errors.length;n+=1){var t=g.result.errors[n].row;t.contact_import_error=g.result.errors[n].message,e.push(t)}return e},g.stopUpload=function(){if(g.stopping=!0,g.pid)return l.system.killProcess({pid:g.pid}).$promise.then(function(e){r.success({title:"CSV import process stopped!",msg:"Import has been stopped!"})}).catch(function(e){r.error({title:"CSV stop import process failed!",msg:"pid is unknown"})})};var v=moment().unix();d.on("contact:import:"+v,function(t){i(function(){if(g.result.rows=t.rows,t.errors)for(var e=0;e<t.errors.length;e++)g.result.errors.push(t.errors[e]);if(t.finish){g.result.finish=!0,g.result.affectedRows=t.affectedRows,g.result.failedRows=g.result.errors.length;var n=g.result.rows-g.result.affectedRows-g.result.errors.length;n&&0<n&&(g.duplicates.length?g.result.duplicatedRows=n:g.result.failedRows+=n),g.result.elapsed=moment().diff(g.processing,"seconds")}})}),c.$on("$destroy",function(){d.removeAllListeners("contact:import:"+v)})}e.$inject=["$cookies","$mdDialog","$interval","$q","$timeout","lists","companies","toasty","api","socket","$scope","file","fields","license"],angular.module("app.tools").controller("ImportContactsDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;g.processing=!1,g.stopping=!0,g.license=p,g.pid=0,g.result={finish:!1,rows:0,affectedRows:0,failedRows:0,duplicatedRows:0,errors:[]},g.contactFields=[{key:"id",required:!0},{key:"firstName",required:!1},{key:"lastName",required:!1},{key:"phone",required:!0},{key:"mobile",required:!1},{key:"email",required:!1},{key:"dateOfBirth",required:!1},{key:"country",required:!1},{key:"city",required:!1},{key:"street",required:!1},{key:"postalCode",required:!1},{key:"fax",required:!1}],g.motionBullFields=[{key:"UserId",required:!1},{key:"scheduledat",required:!1},{key:"priority",required:!1}],g.contactItemTypes=[],l.contactItemType.get({fields:"id,name,orderBy"}).$promise.then(function(e){for(var n=e.rows,t=0;t<n.length;t++)g.contactItemTypes.push({key:n[t].name,required:!1})}),g.binding={},g.duplicate=[],g.lists=s||{rows:[],count:0},g.companies=o||{rows:[],count:0},g.customFields={rows:[],count:0},g.fields=u||[],g.closeDialog=function(){d.removeAllListeners("contact:import:"+v),n.hide()},g.onChangeList=function(){return l.cmList.getCustomFields({id:g.ListId}).$promise.then(function(e){g.customFields=e}).catch(function(e){console.error(e)})},g.uploadCsv=function(){g.processing=moment(),l.cmContact.importUpdates({id:m.filename,binding:g.binding,ListId:g.ListId,CompanyId:g.CompanyId,duplicates:g.duplicates,socket_timestamp:v}).$promise.then(function(e){g.stopping=!1,e&&e.pid&&(g.pid=e.pid)}).catch(function(e){g.processing=!1,r.error({title:"Import process failed!",msg:"Please retry with a new file"})})},g.getHeaderErrors=function(){var e=u;return e.push("contact_import_error"),e},g.getArrayErrors=function(){for(var e=[],n=0;n<g.result.errors.length;n+=1){var t=g.result.errors[n].row;t.contact_import_error=g.result.errors[n].message,e.push(t)}return e},g.stopUpload=function(){if(g.stopping=!0,g.pid)return l.system.killProcess({pid:g.pid}).$promise.then(function(e){r.success({title:"CSV import process stopped!",msg:"Import has been stopped!"})}).catch(function(e){r.error({title:"CSV stop import process failed!",msg:"pid is unknown"})})};var v=moment().unix();d.on("contact:import:"+v,function(t){i(function(){if(g.result.rows=t.rows,t.errors)for(var e=0;e<t.errors.length;e++)g.result.errors.push(t.errors[e]);if(t.finish){g.result.finish=!0,g.result.affectedRows=t.affectedRows,g.result.failedRows=g.result.errors.length;var n=g.result.rows-g.result.affectedRows-g.result.errors.length;n&&0<n&&(g.duplicates.length?g.result.duplicatedRows=n:g.result.failedRows+=n),g.result.elapsed=moment().diff(g.processing,"seconds")}})}),c.$on("$destroy",function(){d.removeAllListeners("contact:import:"+v)})}e.$inject=["$cookies","$mdDialog","$interval","$q","$timeout","lists","companies","toasty","api","socket","$scope","file","fields","license"],angular.module("app.tools").controller("ImportContactsUpdatesDialogController",e)}(),function(){"use strict";function e(i,e,s,n,o,t,r){var a=this;a.errors=[],a.title="CONTACTMANAGER.MERGE_CONTACT",a.contact=angular.copy(n),a.lists=t||[],a.change=function(){a.searchTerm?r.cmContact.get({fields:"id,firstName,lastName,phone,email",filter:a.searchTerm,ListId:n.ListId}).$promise.then(function(e){a.contacts=e.rows}).catch(function(e){console.error(e)}):a.contacts=[]},a.showConfirm=function(e,n,t){var a=i.confirm({skipHide:!0}).title("Would you like to merge your contacs?").textContent("All unfilled values of the contact #"+t.id+" will be overwritten by the fields of the contact #"+n.id+".").targetEvent(e).ok("Ok").cancel("Cancel");i.show(a).then(function(){return r.cmContact.merge({to:t.id,from:n.id}).$promise}).then(function(e){i.hide({new:e,to:t,from:n}),_.remove(o,{id:t.id}),_.remove(o,{id:n.id}),o.unshift(e)}).then(function(){s.success({title:"Contact properly merged!"})}).catch(function(e){e&&e.status&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:MERGE_CONTACT",msg:e.data?JSON.stringify(e.data):e.toString()})})},a.closeDialog=function(){i.hide()}}e.$inject=["$mdDialog","$scope","toasty","contact","contacts","lists","api"],angular.module("app.tools").controller("MergeContactDialogController",e)}(),function(){"use strict";function e(a,e,n,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){t.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_GLOBALCUSTOMFIELD",g.sortable={animation:800,sort:!0,onSort:function(e){a.globalCustomFieldForm.$pristine=!1}},g.globalCustomField=l,g.globalCustomFields=r,g.newGlobalCustomField=!1,g.globalCustomField||(g.globalCustomField={type:"text",actionType:"voice"},g.title="CONTACTMANAGER.NEW_GLOBALCUSTOMFIELD",g.newGlobalCustomField=!0),a.$watch("vm.globalCustomField.type",function(e,n){if(e!==n)switch(e){case"text":g.globalCustomField.values="";break;case"select":g.globalCustomField.values=[]}}),g.addNewGlobalCustomField=function(){g.errors=[],d.cmCustomField.save(g.globalCustomField).$promise.then(function(e){g.globalCustomFields.unshift(e.toJSON()),o.success({title:"GlobalCustomField properly created",msg:g.globalCustomField.name?g.globalCustomField.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveGlobalCustomField=function(){g.errors=[],d.cmCustomField.update({id:g.globalCustomField.id},g.globalCustomField).$promise.then(function(e){var n=_.find(g.globalCustomFields,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"GlobalCustomField properly saved!",msg:g.globalCustomField.name?g.globalCustomField.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteGlobalCustomField=function(e){g.errors=[];var n=t.confirm().title("Are you sure?").content("The globalCustomField will be deleted.").ariaLabel("Delete GlobalCustomField").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){d.cmCustomField.delete({id:g.globalCustomField.id}).$promise.then(function(){_.remove(g.globalCustomFields,{id:g.globalCustomField.id}),o.success({title:"GlobalCustomField properly deleted!",msg:(g.globalCustomField.name||"globalCustomField")+" has been deleted!"}),v(g.globalCustomField)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.addItem=function(e){e.push({value:"New Item"}),a.globalCustomFieldForm.$pristine=!1},g.removeItem=function(e,n){e.splice(n,1),a.globalCustomFieldForm.$pristine=!1},g.removeItems=function(e){for(var n=e.length,t=0;t<n;t++)e.splice(0,1);a.globalCustomFieldForm.$pristine=!1},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","globalCustomFields","globalCustomField","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditGlobalCustomFieldDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.globalCustomFields=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="globalCustomFields",f.listOrder="",f.listOrderAsc=null,f.selectedGlobalCustomFields=[],f.query={fields:"createdAt,updatedAt,id,alias,type,values,required,clickToAction,actionType",sort:"-updatedAt",ListId:"null",limit:10,page:1},f.arraytype=_.keyBy([{option:"Text",value:"'text'"},{option:"Select",value:"'select'"},{option:"Number",value:"'number'"},{option:"Switch",value:"'switch'"},{option:"Datetime",value:"'datetime'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayactionType=_.keyBy([{option:"Voice",value:"'voice'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditGlobalCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/globalCustomFields/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{globalCustomField:e,globalCustomFields:f.globalCustomFields.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("globalCustomField")+"?").htmlContent("<b>"+(e.name||"globalCustomField")+"</b> will be deleted.").ariaLabel("delete globalCustomField").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getGlobalCustomFields=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cmCustomField.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="GlobalCustomFields",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditGlobalCustomField=function(e,n){i.show({controller:"CreateOrEditGlobalCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/globalCustomFields/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{globalCustomField:n,globalCustomFields:f.globalCustomFields.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteGlobalCustomField=y,f.exportSelectedGlobalCustomFields=function(){var e=angular.copy(f.selectedGlobalCustomFields);return f.selectedGlobalCustomFields=[],e},f.deleteSelectedGlobalCustomFields=function(e){var n=i.confirm().title("Are you sure want to delete the selected globalCustomFields?").htmlContent("<b>"+f.selectedGlobalCustomFields.length+" selected</b> will be deleted.").ariaLabel("delete GlobalCustomFields").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedGlobalCustomFields.forEach(function(e){y(e)}),f.selectedGlobalCustomFields=[]})},f.deselectGlobalCustomFields=function(){f.selectedGlobalCustomFields=[]},f.selectAllGlobalCustomFields=function(){f.selectedGlobalCustomFields=f.globalCustomFields.rows};var b=!0,A=1;function E(e){f.globalCustomFields=e||{count:0,rows:[]}}function y(e){m.cmCustomField.delete({id:e.id}).$promise.then(function(){_.remove(f.globalCustomFields.rows,{id:e.id}),f.globalCustomFields.count-=1,f.globalCustomFields.rows.length||f.getGlobalCustomFields(),p.success({title:_.startCase("GlobalCustomField")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmCustomField"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcmCustomField",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getGlobalCustomFields())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","globalCustomFields","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.contactmanager").controller("GlobalCustomFieldsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_LIST",g.list=angular.copy(l),g.lists=r,g.newList=!1,g.list||(g.list={},g.title="CONTACTMANAGER.NEW_LIST",g.newList=!0),g.addNewList=function(){g.errors=[],d.cmList.save(g.list).$promise.then(function(e){g.lists.unshift(e.toJSON()),o.success({title:"List properly created",msg:g.list.name?g.list.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmList.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveList=function(){g.errors=[],d.cmList.update({id:g.list.id},g.list).$promise.then(function(e){var n=_.find(g.lists,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"List properly saved!",msg:g.list.name?g.list.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmList.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteList=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The list will be deleted.").ariaLabel("Delete List").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmList.delete({id:g.list.id}).$promise.then(function(){_.remove(g.lists,{id:g.list.id}),o.success({title:"List properly deleted!",msg:(g.list.name||"list")+" has been deleted!"}),v(g.list)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmList.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","lists","list","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditListDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.cmList.getAgents({id:c.list.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserList?"penalty "+e.UserList.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.list=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.cmList.removeAgents({id:c.list.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.cmList.addAgents({id:c.list.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CONTACTMANAGER.ALL_AGENTS"),labelSelected:r.instant("CONTACTMANAGER.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","list","lists","realtime","$translate","Auth","crudPermissions"],angular.module("app.contactmanager").controller("ListagentaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.listCustomFields=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.cmList.getCustomFields(m.query,u).$promise}function g(e){d.cmCustomField.delete({id:e.id}).$promise.then(function(){_.remove(m.listCustomFields.rows,{id:e.id}),m.listCustomFields.count-=1,m.listCustomFields.rows.length||p(),l.success({title:"CustomField deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcmList"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.list={},m.listCustomFields={count:0,rows:[]},m.selectedListCustomFields=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,alias,type,values,required,clickToAction,actionType",limit:10,page:1},m.arraytype=_.keyBy([{option:"Text",value:"'text'"},{option:"Select",value:"'select'"},{option:"Number",value:"'number'"},{option:"Switch",value:"'switch'"},{option:"Datetime",value:"'datetime'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.arrayactionType=_.keyBy([{option:"Voice",value:"'voice'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n){m.list=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.ListId=m.list.id,m.query.id=m.list.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the customField?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("customField #")+e.id||"customField")+"</b> will be deleted.").ariaLabel("delete customField").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getListCustomFields=p,m.createOrEditListCustomField=function(e,n){o.show({controller:"CreateOrEditCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/customFields/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{list:m.list,customField:n,customFields:m.listCustomFields.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedListCustomFields=function(){var e=angular.copy(m.selectedListCustomFields);return m.selectedListCustomFields=[],e},m.deleteListCustomField=g,m.deleteSelectedListCustomFields=function(e){var n=o.confirm().title("Are you sure want to delete the selected customFields?").htmlContent("<b>"+m.selectedListCustomFields.length+" selected</b> will be deleted.").ariaLabel("delete customFields").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedListCustomFields.forEach(function(e){g(e)}),m.selectedListCustomFields=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.contactmanager").controller("ListCustomFieldsController",e)}(),function(){"use strict";function e(a,e,n,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){t.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_CUSTOMFIELD",g.sortable={animation:800,sort:!0,onSort:function(e){a.customFieldForm.$pristine=!1}},g.customField=l,g.customFields=r,g.newCustomField=!1,g.customField||(g.customField={type:"text",actionType:"voice"},g.title="CONTACTMANAGER.NEW_CUSTOMFIELD",g.newCustomField=!0),e.params.id&&(g.customField.ListId=e.params.id),a.$watch("vm.customField.type",function(e,n){if(e!==n)switch(e){case"text":g.customField.values="";break;case"select":g.customField.values=[]}}),g.addNewCustomField=function(){g.errors=[],d.cmList.addCustomField({id:e.params.id},g.customField).$promise.then(function(e){g.customFields.unshift(e.toJSON()),o.success({title:"CustomField properly created",msg:g.customField.name?g.customField.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCustomField=function(){g.errors=[],d.cmCustomField.update({id:g.customField.id},g.customField).$promise.then(function(e){var n=_.find(g.customFields,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"CustomField properly saved!",msg:g.customField.name?g.customField.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCustomField=function(e){g.errors=[];var n=t.confirm().title("Are you sure?").content("The customField will be deleted.").ariaLabel("Delete CustomField").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){d.cmCustomField.delete({id:g.customField.id}).$promise.then(function(){_.remove(g.customFields,{id:g.customField.id}),o.success({title:"CustomField properly deleted!",msg:(g.customField.name||"customField")+" has been deleted!"}),v(g.customField)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.addItem=function(e){e.push({value:"New Item"}),a.customFieldForm.$pristine=!1},g.removeItem=function(e,n){e.splice(n,1),a.customFieldForm.$pristine=!1},g.removeItems=function(e){for(var n=e.length,t=0;t<n;t++)e.splice(0,1);a.customFieldForm.$pristine=!1},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","customFields","customField","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditCustomFieldDialogController",e)}(),function(){"use strict";function e(a,e,t,i,s,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.list=c||a.params.list||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=a.params.tab||0,u.gotogoto=function(t,e){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{ListId:t.id}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{ListId:t.id})}},u.agentadddialog=function(e,n){t.show({controller:"ListagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{list:e,lists:u.lists?u.lists.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoLists=function(){a.go("app.contactmanager.lists",{},{reload:"app.contactmanager.lists"})},u.saveList=function(){r.cmList.update({id:u.list.id},u.list).$promise.then(function(){l.success({title:"List updated!",msg:u.list.name?u.list.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","list","userProfileSection"],angular.module("app.contactmanager").controller("ListController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.cmList.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.list=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.ListId=m.list.id,m.query.id=m.list.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.list.id,field:"ListId",route:"cmList"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.contactmanager").controller("ListDispositionsController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.lists=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="lists",f.listOrder="",f.listOrderAsc=null,f.selectedLists=[],f.query={fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){a.go("app.contactmanager.lists.edit",{id:e.id,list:e,crudPermissions:f.crudPermissions})},f.gotocontactsgoto=function(t,e){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{ListId:t.id}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{ListId:t.id})}},f.exportcsvcontactsexport=function(i,e){return m.cmList.getContactsCsv({id:i.id,nolimit:!0}).$promise.then(function(e){if(void 0!==e.length){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download","exportContacts_"+i.id+".csv"),a.click()}else p.info({title:"EXPORT",msg:"The list is empty"})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data):e.toString()})})},f.agentadddialog=function(e,n){i.show({controller:"ListagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{list:e,lists:f.lists?f.lists.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("list")+"?").htmlContent("<b>"+(e.name||"list")+"</b> will be deleted.").ariaLabel("delete list").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getLists=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cmList.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Lists",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditList=function(e,n){i.show({controller:"CreateOrEditListDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{list:n,lists:f.lists.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteList=y,f.exportSelectedLists=function(){var e=angular.copy(f.selectedLists);return f.selectedLists=[],e},f.deleteSelectedLists=function(e){var n=i.confirm().title("Are you sure want to delete the selected lists?").htmlContent("<b>"+f.selectedLists.length+" selected</b> will be deleted.").ariaLabel("delete Lists").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedLists.forEach(function(e){y(e)}),f.selectedLists=[]})},f.deselectLists=function(){f.selectedLists=[]},f.selectAllLists=function(){f.selectedLists=f.lists.rows};var b=!0,A=1;function E(e){f.lists=e||{count:0,rows:[]}}function y(e){m.cmList.delete({id:e.id}).$promise.then(function(){_.remove(f.lists.rows,{id:e.id}),f.lists.count-=1,f.lists.rows.length||f.getLists(),p.success({title:_.startCase("List")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmList"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcmList",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getLists())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","lists","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.contactmanager").controller("ListsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;function b(){return a.smsAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.smsAccounts=e,a.smsInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].SmsAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.smsAccounts.rows,{id:e.rows[t].SmsAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.smsAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.smsAccounts=n})})}function A(){return a.faxAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.faxAccounts=e,a.faxInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].FaxAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.faxAccounts.rows,{id:e.rows[t].FaxAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.faxAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.faxAccounts=n})})}function E(){return a.openchannelAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.openchannelAccounts=e,a.openchannelInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].OpenchannelAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.openchannelAccounts.rows,{id:e.rows[t].OpenchannelAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.openchannelAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.openchannelAccounts=n})})}function y(){return a.whatsappAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.whatsappAccounts=e,a.whatsappInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].WhatsappAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.whatsappAccounts.rows,{id:e.rows[t].WhatsappAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.whatsappAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.whatsappAccounts=n})})}function S(){return a.chatWebsite.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.chatWebsites=e,a.chatInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].ChatWebsiteId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.abandoned+=e.rows[t].abandoned,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.chatWebsites.rows,{id:e.rows[t].ChatWebsiteId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","abandoned","unmanaged"]));return f.chatWebsites}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.chatWebsites=n})})}function T(){return a.mailAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.mailAccounts=e,a.mailInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].MailAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.mailAccounts.rows,{id:e.rows[t].MailAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.mailAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.mailAccounts=n})})}function I(){for(var e=0;e<f.customDashboard.widgets.length;e+=1)f.customDashboard.widgets[e].voiceQueuesSelected=f.voiceQueuesSelected,f.customDashboard.widgets[e].chatWebsitesSelected=f.chatWebsitesSelected,f.customDashboard.widgets[e].smsAccountsSelected=f.smsAccountsSelected,f.customDashboard.widgets[e].faxAccountsSelected=f.faxAccountsSelected,f.customDashboard.widgets[e].mailAccountsSelected=f.mailAccountsSelected,f.customDashboard.widgets[e].openchannelAccountsSelected=f.openchannelAccountsSelected,f.customDashboard.widgets[e].whatsappAccountsSelected=f.whatsappAccountsSelected}f.currentUser=s.getCurrentUser(),f.userProfile=v,f.userProfileSection=h&&1===h.count?h.rows[0]:null,f.crudPermissions=s.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.customDashboard={},f.voiceQueues=l&&l.count?l:{count:0,rows:[]},f.voiceQueuesSelected=l&&l.count?_.map(l.rows,"id"):[],f.faxAccounts=d&&d.count?d:{count:0,rows:[]},f.faxAccountsSelected=d&&d.count?_.map(d.rows,"id"):[],f.chatWebsites=c&&c.count?c:{count:0,rows:[]},f.chatWebsitesSelected=c&&c.count?_.map(c.rows,"id"):[],f.smsAccounts=m&&m.count?m:{count:0,rows:[]},f.smsAccountsSelected=m&&m.count?_.map(m.rows,"id"):[],f.mailAccounts=u&&u.count?u:{count:0,rows:[]},f.mailAccountsSelected=u&&u.count?_.map(u.rows,"id"):[],f.openchannelAccounts=p&&p.count?p:{count:0,rows:[]},f.openchannelAccountsSelected=p&&p.count?_.map(p.rows,"id"):[],f.whatsappAccounts=g&&g.count?g:{count:0,rows:[]},f.whatsappAccountsSelected=g&&g.count?_.map(g.rows,"id"):[],f.interval=n(function(){},1e3),f.goToEdit=function(){e.go("app.tools.customDashboards.edit",{customDashboard:f.customDashboard,id:f.customDashboard.id,tab:1})},f.setFilter=function(e){o.show({controller:"FilterDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/custom/filter/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{vm_parent:f}}).then(function(e){f=e,I()})},f.updateWidget=I,i.onWithoutApply("voice_queue:save",function(e){var n=_.find(f.voiceQueues.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.onWithoutApply("sms_account:save",function(e){var n=_.find(f.smsAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("smsInteraction:update",b),i.on("smsInteraction:save",b),i.onWithoutApply("fax_account:save",function(e){var n=_.find(f.faxAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("faxInteraction:update",A),i.on("faxInteraction:save",A),i.onWithoutApply("mail_account:save",function(e){var n=_.find(f.mailAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("mailInteraction:update",T),i.on("mailInteraction:save",T),i.onWithoutApply("openchannel_account:save",function(e){var n=_.find(f.openchannelAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("openchannelInteraction:update",E),i.on("openchannelInteraction:save",E),i.onWithoutApply("whatsapp_account:save",function(e){var n=_.find(f.whatsappAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("whatsappInteraction:update",y),i.on("whatsappInteraction:save",y),i.onWithoutApply("chat_website:save",function(e){var n=_.find(f.chatWebsites.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("chatInteraction:update",S),i.on("chatInteraction:save",S),a.dashboard.get({id:e.params.id}).$promise.then(function(e){if(e)return f.customDashboard=e,f.customDashboard.widgets=[],f.customDashboard.preview=!0,f.customDashboard.draggable={enabled:!1},f.customDashboard.resizable={enabled:!1},a.dashboard.getItems({id:f.customDashboard.id}).$promise}).then(function(e){if(e&&e.count&&e.rows)for(var n=0;n<e.rows.length;n+=1)e.rows[n].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+e.rows[n].type+"/ms-widget-engine."+e.rows[n].type+".html",e.rows[n].voiceQueues=f.voiceQueues,e.rows[n].voiceQueuesSelected=f.voiceQueuesSelected,e.rows[n].faxAccounts=f.faxAccounts,e.rows[n].faxAccountsSelected=f.faxAccountsSelected,e.rows[n].mailAccounts=f.mailAccounts,e.rows[n].mailAccountsSelected=f.mailAccountsSelected,e.rows[n].smsAccounts=f.smsAccounts,e.rows[n].smsAccountsSelected=f.smsAccountsSelected,e.rows[n].chatWebsites=f.chatWebsites,e.rows[n].chatWebsitesSelected=f.chatWebsitesSelected,e.rows[n].openchannelAccounts=f.openchannelAccounts,e.rows[n].openchannelAccountsSelected=f.openchannelAccountsSelected,e.rows[n].whatsappAccounts=f.whatsappAccounts,e.rows[n].whatsappAccountsSelected=f.whatsappAccountsSelected,f.customDashboard.widgets.push(e.rows[n])}).catch(function(){f.customDashboard=void 0}),t.$on("$destroy",function(){i.removeAllListeners("voice_queue:save"),i.removeAllListeners("sms_account:save"),i.removeAllListeners("fax_account:save"),i.removeAllListeners("mail_account:save"),i.removeAllListeners("openchannel_account:save"),i.removeAllListeners("whatsapp_account:save"),i.removeAllListeners("chat_website:save"),i.removeAllListeners("chatInteraction:save"),i.removeAllListeners("chatInteraction:update"),i.removeAllListeners("smsInteraction:save"),i.removeAllListeners("smsInteraction:update"),i.removeAllListeners("openchannelInteraction:save"),i.removeAllListeners("openchannelInteraction:update"),i.removeAllListeners("mailInteraction:save"),i.removeAllListeners("mailInteraction:update"),i.removeAllListeners("faxInteraction:save"),i.removeAllListeners("faxInteraction:update"),i.removeAllListeners("whatsappInteraction:save"),i.removeAllListeners("whatsappInteraction:update"),f.interval&&n.cancel(f.interval)})}e.$inject=["$state","$interval","$scope","api","socket","Auth","$mdDialog","$document","voiceQueues","faxAccounts","chatWebsites","smsAccounts","mailAccounts","openchannelAccounts","whatsappAccounts","userProfile","userProfileSection"],angular.module("app.dashboards.custom").controller("DashboardCustomController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;function m(){a.hide(c.parent)}c.title="DASHBOARDS.SETFILTERS",c.currentUser=l.getCurrentUser(),c.parent=d,c.onChangeFilter=function(e){for(var n=0;n<c.parent.customDashboard.widgets.length;n+=1)switch(e){case"voice":c.parent.customDashboard.widgets[n].voiceQueuesSelected=c.parent.voiceQueuesSelected;break;case"sms":c.parent.customDashboard.widgets[n].smsAccountsSelected=c.parent.smsAccountsSelected;break;case"chat":c.parent.customDashboard.widgets[n].chatAccountsSelected=c.parent.chatAccountsSelected;break;case"fax":c.parent.customDashboard.widgets[n].faxAccountsSelected=c.parent.faxAccountsSelected;break;case"mail":c.parent.customDashboard.widgets[n].mailAccountsSelected=c.parent.mailAccountsSelected;break;case"openchannel":c.parent.customDashboard.widgets[n].openchannelAccountsSelected=c.parent.openchannelAccountsSelected;break;case"whatsapp":c.parent.customDashboard.widgets[n].whatsappAccountsSelected=c.parent.whatsappAccountsSelected}},c.confirm=function(){m()},c.closeDialog=m}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","api","Auth","vm_parent"],angular.module("app.tools").controller("FilterDialogController",e)}(),function(){"use strict";function e(e,s,i,c,o,r,m,n,l,t,u,a,d,p,g,v,h,f,b,A,E){var y=this;y.license=v,y.setting=h,y.detectBrowser=b.detectBrowser(),y.user=n.getCurrentUser(),y.currentTab=0,y.notifications={},y.tabs={},y.agentCapacity={},y.autoClose=!1,y.acceptedNotifications=[],y.autoanswerTimeout,y.globalUserLists=a||{count:0,rows:[]},y.globalLists=d||{count:0,rows:[]},y.globalCompanies=p||{count:0,rows:[]},y.globalTags=g||{count:0,rows:[]};var S=E.getLogger("dashboard","agent.general.contact");function T(e){var n={};for(var t in y.tabs)y.tabs.hasOwnProperty(t)&&(n[t]=_.pick(y.tabs[t],["type","title","channel","icon","color","autoCreate","id","saved","badges","openedAt"]),_.isNil(y.tabs[t].contact)||(n[t].contact=_.pick(y.tabs[t].contact,["id","ListId"])),_.isNil(y.tabs[t].calls)||(n[t].calls=y.tabs[t].calls),y.tabs[t].interaction&&(n[t].interaction=_.pick(y.tabs[t].interaction,["id","OpenchannelAccountId","MailAccountId","ChatWebsiteId","FaxAccountId","SmsAccountId","WhatsappAccountId","closed","draft"])));var a=JSON.parse(i.localStorage.getItem("motion2.user:"+y.user.id));a?(a.tabs=n,a.currentTab=y.currentTab,a.autoClose=y.autoClose):a={tabs:n,currentTab:y.currentTab,autoClose:y.autoClose},i.localStorage.setItem("motion2.user:"+y.user.id,JSON.stringify(a)),e&&I(e)}function I(e){if(_.isNil(e)||e&&"interaction"===e.type){var n={id:y.user.id,online:!0,capacity:{mail:0,fax:0,sms:0,whatsapp:0,openchannel:0,chat:0},interaction:{mail:[],fax:[],sms:[],whatsapp:[],openchannel:[],chat:[]}};for(var t in y.tabs)y.tabs.hasOwnProperty(t)&&n.capacity.hasOwnProperty(y.tabs[t].channel)&&y.tabs[t].interaction&&!y.tabs[t].interaction.closed&&(n.capacity[y.tabs[t].channel]+=1,n.interaction[y.tabs[t].channel].push(y.tabs[t].interaction.id));if(!_.isEqual(y.agentCapacity,n.capacity))return y.agentCapacity=n.capacity,l.rpc.setAgentCapacity(n)}}function O(e){y.tabs[e.id]&&(!function(e){if(e.channel&&e.interaction)l.user["remove"+_.upperFirst(e.channel)+"Interactions"]({id:y.user.id,ids:[e.interaction.id]}).$promise.catch(function(e){S.error(e)})}(y.tabs[e.id]),delete y.tabs[e.id],y.currentTab=0,T(e))}function C(e){Object.keys(y.tabs).length!==y.setting.limitTabs?(e.id=_.random(1e10),e.openedAt=(new Date).toISOString(),e.saved=!1,e.badges=0,y.tabs[e.id]=e,y.currentTab=e.id,T(e)):u.warning({title:"",msg:c.instant("DASHBOARD.LIMIT_TABS_REACHED")})}function w(n){return _.find(y.tabs,function(e){return"interaction"===e.type&&e.interaction&&e.interaction.id==n.interactionId&&e.channel==n.channel})}function R(n,t){var e,a,i={type:"contact",title:n?(e=n,a="",e&&(e.firstName||e.lastName?(e.firstName&&(a+=e.firstName+" "),e.lastName&&(a+=e.lastName)):e.phone&&(a=e.phone)),a=y.user.privacyEnabled?A.mask(a):a):c.instant("DASHBOARDS.NEW_CONTACT"),icon:"icon-account-circle",color:"red",contact:n,calls:t?[t]:[],autoCreate:t?t.autoCreate:0};if(t&&(t.answertime||(t.answertime=t.agentconnectAt),(t.agentcompleteAt||t.endtime)&&U(t)),n){var s=_.find(y.tabs,function(e){return e.contact&&e.contact.id?"contact"===e.type&&e.contact&&e.contact.id==n.id:"contact"===e.type&&e.contact&&e.contact.phone==n.phone});if(s){if(t)return l.voiceCallReport.get({uniqueid:t.uniqueid}).$promise.then(function(e){(e&&0<e.rows.length&&(t.disposedAt=_.first(e.rows).endtime),s.calls)?_.find(s.calls,function(e){return e.uniqueid===t.uniqueid})||s.calls.push(t):s.calls=[t];y.currentTab=s.id})}else{if(n.ListId)return l.disposition.get({ListId:n.ListId,nolimit:!0}).$promise.then(function(e){return i.dispositions=e,l.cmList.getCustomFields({id:n.ListId,nolimit:!0}).$promise}).then(function(e){i.customFields=e}).catch(F()).finally(function(){C(i)});C(i)}}else C(i)}function x(n,t){var e=_.find(y.tabs,function(e){return"interaction"===e.type&&e.interaction&&e.interaction.id===t.id&&e.channel===n});e?(e.isDraft=t.isDraft||!1,y.currentTab=e.id):C(e={type:"interaction",title:n?n.toUpperCase():"openchannel",icon:function(e){switch(e){case"chat":return"icon-hangouts";case"mail":return"icon-email";case"sms":return"icon-message-text";case"openchannel":return"icon-google-earth";case"fax":return"icon-deskphone";case"whatsapp":return"icon-whatsapp";default:return"icon-hangouts"}}(n),color:function(e){switch(e){case"chat":return"green-A700";case"mail":return"teal";case"sms":return"orange";case"openchannel":return"amber-A200";case"fax":return"blue-grey-A200";case"whatsapp":return"lime-A700";default:return"grey"}}(n),channel:n,interaction:t,isDraft:t.isDraft||!1})}function N(e){var n=0;switch(e){case"chat":n=105;break;case"mail":n=106;break;case"sms":n=107;break;case"openchannel":n=108;break;case"fax":n=109;break;case"whatsapp":n=114}return 0<n&&_.includes(y.user.permissions,n)}function D(t){f.isSupported()?f.requestPermission().then(function(){var e,n;n={autoClose:!0,duration:10,showOnPageHidden:!0,icon:"../../../../../../../assets/images/avatars/customer.png",body:(e=t).queue?"Queue: "+e.queue:"",focusOnclick:!0,closeOnClick:!0},f.show(e.title,n)},function(e){S.error("Please enable browser notifications!",e)}):S.error("Browser notifications are not supported by the browser. Normal notifications will be used.")}function P(n){u.wait({title:n.title,msg:n.msg||"",showClose:!1,clickToClose:!1,timeout:!1,sound:n.sound,html:!0,shake:n.shake||!1,onAdd:function(){y.notifications[n.uniqueid]=this.id},onAccept:function(){if(L(n),l[n.channel+"Message"])return l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id,manual:!0}).$promise.then(function(e){y.acceptedNotifications.push(n.id),y.autoanswerTimeout=null,x(e.channel,e.interaction),u.success({title:"Message properly accepted!",msg:"Message has been accepted!"})}).catch(F())},onReject:function(){if(L(n),_.isNil(y.autoanswerTimeout)||(r.cancel(y.autoanswerTimeout),y.autoanswerTimeout=null),l[n.channel+"Message"])return l[n.channel+"Message"].reject({id:n.id,UserId:y.user.id}).$promise.then(function(){u.success({title:"Message properly rejected!",msg:"Message has been rejected!"})}).catch(F())}})}function L(e){e&&e.uniqueid&&y.notifications[e.uniqueid]&&(u.clear(y.notifications[e.uniqueid]),delete y.notifications[e.uniqueid])}function k(n){var t=n.uniqueid;for(var e in S.debug("onVoiceChannelRemove -> evt",n),y.tabs)if(y.tabs.hasOwnProperty(e)){var a=y.tabs[e];if(a.calls){S.debug("onVoiceChannelRemove ->  key, tab, tab.calls",e,a,a.calls);var i=_.findIndex(a.calls,function(e){return e.uniqueid===t});i<0&&0<=(i=_.findIndex(a.calls,function(e){return e.uniqueid===n.linkedid}))&&(t=n.linkedid),0<=i&&!a.calls[i].disposedAt?(S.debug("Allowing disposition for call %s",a.calls[i].uniqueid),U(a.calls[i])):S.debug("Call %s not found or already completed",a.calls[i].uniqueid),a.contact&&a.contact.id&&r(M(t,a.contact.id,a),1e3)}}T()}function M(n,e,t){return function(){if(_.find(t.calls,function(e){return e.uniqueid===n}))return l.voiceCallReport.update({id:n,ContactId:e}).$promise.catch(function(e){S.error(e)})}}function U(e){e.disposedAt=new Date}function F(){return function(e){if(404===e.status)u.warning({title:c.instant("DASHBOARDS.ATTENTION"),msg:c.instant("DASHBOARDS.ACCEPT_ELSEWHERE")});else if(e.data&&e.data.errors&&e.data.errors.length){y.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var n=0;n<e.data.errors.length;n+=1)u.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else u.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelMessage.accept",msg:e.data?JSON.stringify(e.data.message):e.toString()})}}function $(e){l.cmHopper.update({id:e,recallmeNotifiedDate:null}).$promise.then(function(e){S.debug(e)}).catch(function(e){S.error(e)}).finally(function(){q(e)})}function q(e){y.toasty.clear(y.notifications[e])}y.onClickTab=function(e){y.currentTab=e,T(y.tabs[e])},y.isActiveTab=function(e){return e===y.currentTab},y.alreadyExistsTab=w,y.addContactTab=R,y.addInteractionTab=x,y.addTab=C,y.removeTab=O,y.updateLocalStorage=T,y.closeTab=function(e){var n=!1,t=s.confirm().title("interaction"===e.type?"Do you want to close the interaction?":"Are you sure want to close the "+e.type+"?").textContent("interaction"===e.type?"":"The "+e.type+" has been modified. Closing will lose all changes!").ariaLabel("Close Contact").ok("interaction"===e.type?"YES":"OK").cancel("interaction"===e.type?"NO":"CANCEL");{if(!e.saved){var a=y.user.voicePause||y.user.chatPause||y.user.mailPause||y.user.openchannelPause||y.user.faxPause;return"interaction"===e.type&&(n=e.interaction.Account.mandatoryDisposition),s.show(t).then(function(){"interaction"===e.type&&s.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(o.body),onRemoving:function(){y.user&&n&&!a&&l.user.unpause({id:y.user.id}).$promise.catch(function(e){S.error(e)})},clickOutsideToClose:!n,escapeToClose:!n,locals:{user:y.user,channel:e.channel,interaction:e.interaction}}),O(e)}).catch(function(){"interaction"===e.type&&O(e)})}if(_.forEach(e.calls,function(e){e.mandatoryDisposition&&(n=!0)}),"contact"===e.type&&0<e.calls.length){if(!n)return t._options.textContent="There is a call that hasn't been disposed yet.",s.show(t).then(function(){O(e)});var i=s.alert().title("Warning").textContent("There is a call that hasn't been disposed yet.").ok("OK");s.show(i).finally(function(){i=void 0})}else O(e)}},y.dialPreviewRecallReminder=function(e){var n,t,a,i,s;if(e&&e.hopper){if(i=m("formatdate")(e.hopper.scheduledat),s=e.hopper,e.hopper.Contact&&(n=e.hopper.Contact),e.hopper.List&&(t=e.hopper.List),e.hopper.id&&(a=e.hopper.id),a&&n&&t&&n.firstName){var o=n.firstName;n.lastName&&(o=o+" "+n.lastName);var r=s.phone||n.phone;y.user.privacyEnabled&&(o=A.mask(o),r=A.mask(r));var l=c.instant("DASHBOARDS.RECALLME_CALL_REMINDER"),d="<div>          <span>"+c.instant("DASHBOARDS.UPCOMING_RECALLME_CALL")+"</span><br>          <span>"+c.instant("DASHBOARDS.CONTACT_NAME")+": "+o+"</span><br>          <span>"+c.instant("DASHBOARDS.CONTACT_PHONE")+": "+r+"</span><br>          <span>"+c.instant("DASHBOARDS.SCHEDULED_TIME")+": "+i+"</span><br>          <span>"+c.instant("DASHBOARDS.LIST_NAME")+": "+t.name+"</span><br>          </div>";S.debug(e),u.info({title:l,msg:d,showClose:!0,clickToClose:!0,timeout:6e4,html:!0,onAdd:function(){y.notifications[a]=this.id},onAccept:function(){delete y.notifications[a],y.openContactTab(a)},onReject:function(){delete y.notifications[a],$(a)},onRemove:function(){setTimeout(function(){y.notifications[a]&&(delete y.notifications[a],$(a))},1e3)}})}}else S.warn("Response does not contain hopper",e)},y.openContactTab=function(e){y.openPreviewDialog(e),q(e)},y.openPreviewDialog=function(e){l.cmHopper.getPreviewRecall({id:e}).$promise.then(function(e){var n=angular.element("#toolbar").scope();n&&n.vm.openPreviewDialog(e,!0)})},y.toasty=u,function(){var e=i.localStorage.getItem("motion2.user:"+y.user.id);if(e)try{e=JSON.parse(e),y.tabs=e.tabs?e.tabs:{},y.currentTab=e.currentTab?e.currentTab:0,y.autoClose=!!e.autoClose&&e.autoClose,I(y.tabs[y.currentTab]),S.debug("Tabs initiated correctly")}catch(e){S.error(e)}}(),e.$on("$destroy",function(){for(var e in y.notifications)y.notifications.hasOwnProperty(e)&&L({uniqueid:e});t.removeAllListeners("trigger:contactmanager"),t.removeAllListeners("trigger:jscripty"),t.removeAllListeners("trigger:browser:url"),t.removeAllListeners("trigger:browser:popup"),t.removeAllListeners("notification:save"),t.removeAllListeners("notification:remove"),t.removeAllListeners("voice_queue_channel:remove"),t.removeAllListeners("voice_outbound_channel:remove")}),t.on("trigger:contactmanager",function(n){_.isNil(n.contacts)||1!==n.contacts.length?s.show({controller:"ContactSelectionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/contact/selection/dialog.html",parent:angular.element(o.body),locals:{contacts:n.contacts,callNumber:n.evt.routeId?n.evt.destcalleridnum:n.evt.calleridnum}}).then(function(e){R(e,n.evt)}):R(n.contact,n.evt)}),t.on("trigger:jscripty",function(t){return l.jscriptyProject.get({id:t.ProjectId}).$promise.then(function(n){if(n){if(!_.isUndefined(t["xmd-contactid"]))return l.cmContact.get({id:t["xmd-contactid"]}).$promise.then(function(e){try{n.formData=Mustache.render(n.formData,_.merge(t,{user:y.user,contact:e}))}catch(e){S.error(e)}C({type:"jscripty",title:n.name,icon:"icon-script",color:"grey",project:n,call:t,contact:e})}).catch(F());try{n.formData=Mustache.render(n.formData,_.merge(t,{user:y.user}))}catch(e){S.error(e)}C({type:"jscripty",title:n.name,icon:"icon-script",color:"grey",project:n,call:t})}}).catch(F())}),t.on("trigger:bot",function(n){var t=n.calleridname&&"<unknown>"!==n.calleridname?n.calleridname:n.calleridnum,a=n.calleridnum;return l.squareMessage.get({fields:"id",limit:1,offset:0,uniqueid:n.uniqueid}).$promise.then(function(e){e.count&&C({type:"bot",title:t+" <"+a+">",icon:"fas fa-robot",color:"pink",data:{uniqueid:n.uniqueid}})})}),t.on("trigger:browser:url",function(e){if(e&&e.uri)if(e.uri=_.replace(e.uri,"&lt%3B",""),e.uri=_.replace(e.uri,"=&gt%3B=",""),e.uriLocation)switch(e.uriLocation){case"0":i.open(e.uri);break;case"1":i.open(e.uri,"_blank","width="+(e.windowWidth||"800")+",height="+e.windowHeight||"600");break;case"2":C({type:"iframe",title:e.uri,icon:"icon-google-earth",color:"blue",src:e.uri});break;default:i.open(e.uri)}else i.open(e.uri)}),t.on("trigger:browser:popup",function(e){e&&e.html&&C({type:"popup",title:e.calleridnum||"popup",icon:"icon-tablet",color:"grey",html:e.html})}),t.on("notification:save",function(n){if(N(n.channel)&&n&&n.uniqueid){D(n);var e=w(n);if(e){if(l[n.channel+"Message"])return y.currentTab!==e.id&&(e.badges+=1),y.acceptedNotifications.push(n.id),l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id}).$promise.catch(F())}else{var t="mail"==n.channel?"email":n.channel,a=y.user[t+"AutoanswerDelay"]?1e3*y.user[t+"AutoanswerDelay"]:0;if(y.user[t+"Autoanswer"]&&y.license[n.channel]&&N(n.channel)){if(0<a)P(n),y.autoanswerTimeout=r(function(){if(l[n.channel+"Message"]&&!_.includes(y.acceptedNotifications,n.id))return l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id,manual:!0}).$promise.then(function(e){y.acceptedNotifications.push(n.id),x(e.channel,e.interaction),L(n)}).catch(F())},y.user[t+"AutoanswerDelay"]?1e3*y.user[t+"AutoanswerDelay"]:0);else if(l[n.channel+"Message"])return l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id,manual:!0}).$promise.then(function(e){y.acceptedNotifications.push(n.id),x(e.channel,e.interaction)}).catch(F())}else P(n)}}}),t.on("notification:remove",L),t.on("voice_queue_channel:remove",k),t.on("voice_outbound_channel:remove",k),t.on("user:dialPreviewRecallReminder",y.dialPreviewRecallReminder)}e.$inject=["$scope","$mdDialog","$window","$translate","$document","$timeout","$filter","Auth","api","socket","toasty","globalUserLists","globalLists","globalCompanies","globalTags","license","setting","desktopNotification","msUtils","privacyManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentDashboardGeneralController",e)}(),function(){"use strict";angular.module("app.dashboards").provider("desktopNotification",function(){var f={autoClose:!0,duration:5,showOnPageHidden:!1};return{config:function(e){for(var n in e)f.hasOwnProperty(n)&&null!=e[n]&&(f[n]=e[n])},$get:["$q","$timeout","$window","PERMISSIONS",function(e,u,n,p){var g=n.Notification||n.mozNotification||n.webkitNotification;return{isSupported:v,currentPermission:h,requestPermission:function(){if(!v())return e.reject("Notification API not supported");var t=e.defer();Promise.resolve(g.requestPermission)==g.requestPermission?g.requestPermission().then(function(e){p.GRANTED===e?t.resolve(e):t.reject(e)}):g.requestPermission(function(e,n){p.GRANTED===e?t.resolve(e):t.reject(e)});return t.promise},show:function(e,n){if(n=n||{},!v()||(t=e,a=n,i=angular.isString(t),s=!a.onClick||angular.isFunction(a.onClick),!i||!s)||function(e){if(e||f.showOnPageHidden)return!(window.document.hidden||window.document.mozHidden||window.document.webkitHidden)}(n.showOnPageHidden)||h()!==p.GRANTED)return;var t,a,i,s;var o=new g(e,n),r=n.duration||f.duration,l=void 0===n.autoClose?f.autoClose:n.autoClose;o.onclick=function(){n.onClick&&n.onClick(),n.focusOnclick&&window.focus(),n.closeOnClick&&o.close()},l&&(d=o,c=r,m=1e3*c,u(d.close.bind(d),m,!1));var d,c,m;return o},permissions:{default:p.DEFAULT,granted:p.GRANTED,denied:p.DENIED}};function v(){return!(void 0===g)}function h(){return(g||{}).permission}}]}}).provider("msNavigationAgentService",function(){var r=angular.injector(["ng"]).get("$log"),l=[];function n(e,n){if(angular.isString(e)){for(var t=e.split("."),a=t[t.length-1],i=function(e){var n=l;if(1===e.length)return n;e.pop();for(var t=0;t<e.length;t++){for(var a=e[t],i=!0,s=0;s<n.length;s++)if(n[s]._id===a){n=n[s].children,i=!1;break}if(i){var o={_id:a,_path:e.join("."),title:a,weight:1,children:[]};n.push(o),n=o.children}}return n}(t),s=!1,o=0;o<i.length;o++)if(i[o]._id===a){s=i[o];break}s?(angular.extend(s,n),s.uisref=d(s)):(n.children=[],!angular.isUndefined(n.weight)&&angular.isNumber(n.weight)||(n.weight=1),n._id=a,n._path=e,n.uisref=d(n),i.push(n))}else r.error("path must be a string (eg. `dashboard.project`)")}function d(e){var n="";return angular.isDefined(e.state)&&(n=e.state,angular.isDefined(e.stateParams)&&angular.isObject(e.stateParams)&&(n=n+"("+angular.toJson(e.stateParams)+")")),n}this.saveItem=n,this.deleteItem=function(e){if(!angular.isString(e))return void r.error("path must be a string (eg. `dashboard.project`)");for(var n=l,t=e.split("."),a=0;a<t.length;a++)for(var i=t[a],s=0;s<n.length;s++)if(n[s]._id===i){if(n[s]._path===e)return n.splice(s,1),!0;n=n[s].children;break}return!1},this.$get=function(){var e={saveItem:n,getNavigation:function(e){if(e){for(var n=0;n<l.length;n++)if(l[n]._id===e)return[l[n]];return null}return l}};return e}}).constant("PERMISSIONS",{DEFAULT:"default",GRANTED:"granted",DENIED:"denied"})}(),function(){"use strict";function e(t){var a=this;a.setting={},a.messages={count:0,rows:[]},a.showInteraction=!1,a.init=function(e,n){{if(a.setting=n,a.tab=e,a.tab.saved=!0,a.tab&&a.tab.data&&a.tab.data.uniqueid)return t.squareMessage.get({uniqueid:a.tab.data.uniqueid}).$promise.then(function(e){a.messages=e}).finally(function(){a.showInteraction=!0});a.showInteraction=!0}},a.getMessagesAlignment=function(e){switch(a.setting.messagesAlignment){case"left":return"in"==e.direction?e.direction:"out-left-aligned";case"right":return"in"==e.direction?"in-right-aligned":e.direction;default:return e.direction}}}e.$inject=["api"],angular.module("app.dashboards").controller("AgentGeneralBotController",e)}(),function(){"use strict";function e(a,d,c,t,m,i,u,p,s,o,e,r,l,n){var g=this;g.user=s.getCurrentUser(),g.detectBrowser=e.detectBrowser(),g.additionalItemTypes=[],g.additionalItems=[],g.contactItemTypes=[],g.newPhone=function(e){return{phone:e,color:"gray"}},g.journey=[],g.queryHopper={fields:"id,phone,scheduledat",sort:"-updatedAt",limit:10,page:1},g.queryFinal={fields:"uniqueid,calleridnum,statedesc,starttime,disposition,secondDisposition,thirdDisposition",sort:"-updatedAt",limit:10,page:1},g.queryHistory={fields:"uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-updatedAt",limit:10,page:1},g.hoppers={rows:[],count:0},g.finals={rows:[],count:0},g.histories={rows:[],count:0},g.journeyOptions=r.getQuery(),g.quickFilters=r.getQuickFilters(),g.addNewContact=h,g.saveContact=function(){g.errors=[],u.cmContact.update({id:g.contact.id},g.contact).$promise.then(function(e){var n=e.firstName||e.phone;return g.tab.title=g.user.privacyEnabled?l.mask(n):n,g.tab.contact=g.contact,m.$parent.vm.updateLocalStorage(),u.user.addContacts({id:s.getCurrentUser().id,ids:[e.id]})}).then(function(){return u.cmContact.setTags({id:g.contact.id,ids:g.tab.Tags}).$promise}).then(function(){return u.cmContact.setAdditionalPhones({id:g.contact.id,items:g.additionalItems,item_types:g.additionalItemTypes}).$promise.then(function(){g.detailForm.$pristine=!0,g.customFieldsForm.$pristine=!0,p.success({title:"Contact properly updated!",msg:g.contact.name?g.contact.name+" has been updated!":""})})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.getCustomFields=function(e){return u.cmList.getCustomFields({id:e}).$promise.then(function(e){g.tab.customFields=e}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"LIST:GETCustomFields",msg:e.data?JSON.stringify(e.data):e.toString()})})},g.call=m.$parent.vm.call,g.disposeCall=function(e,i){if(g.newContact)return void p.error({title:"ATTENTION",msg:"Please save the contact before disposing!"});d.show({controller:"DisposeCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/contact/dispose/dialog.html",parent:angular.element(c.body),targetEvent:i,clickOutsideToClose:!i.mandatoryDisposition,escapeToClose:!i.mandatoryDisposition,resolve:{globalDispositions:["apiResolver",function(e){return e.resolve("disposition@get",{MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0})}]},onRemoving:function(){g.user&&i.mandatoryDisposition&&u.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{dispositions:g.tab.dispositions,contact:g.contact,call:i,availableCalls:g.tab.calls.length,autoClose:m.$parent.vm.autoClose}}).then(function(e){var n=e[0];for(var t in m.$parent.vm.autoClose=e[1],n&&("BLACKLIST"===n?p.success({title:o.instant("DASHBOARDS.INFO"),msg:o.instant("DASHBOARDS.CALL_DISPOSED")+" "+n}):"RECALLME"===n||"RESCHEDULE"===n||p.success({title:o.instant("DASHBOARDS.INFO"),msg:o.instant("DASHBOARDS.CALL_SAVED")})),m.$parent.$parent.$parent.vm.tabs)if(m.$parent.$parent.$parent.vm.tabs.hasOwnProperty(t)){var a=m.$parent.$parent.$parent.vm.tabs[t];_.remove(a.calls,function(e){return e.uniqueid===i.uniqueid})}0===g.tab.calls.length&&m.$parent.vm.autoClose&&m.$parent.vm.removeTab(g.tab),m.$parent.vm.updateLocalStorage()})},g.checkCallStatus=function(n){return g.checkingCallStatus=!0,u.voiceCallReport.get({uniqueid:n.uniqueid}).$promise.then(function(e){e&&0<e.rows.length&&(n.disposedAt=_.first(e.rows).endtime)}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"VOICE_CALL_REPORT:GET",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){g.checkingCallStatus=!1})},g.duplicateContact=function(e){d.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(c.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:g.contact.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:s.getCurrentUser().id,fields:"id,name"})}]},locals:{contacts:[]}})},g.mergeContact=function(e){d.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(c.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:g.contact.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:s.getCurrentUser().id,fields:"id,name"})}]},locals:{contacts:[]}}).then(function(e){if(e){for(var n in m.$parent.$parent.$parent.vm.tabs)if(m.$parent.$parent.$parent.vm.tabs.hasOwnProperty(n)){var t=m.$parent.$parent.$parent.vm.tabs[n];t&&t.contact&&(e.from&&e.from.id&&e.from.id===t.contact.id&&m.$parent.$parent.$parent.vm.removeTab(t),e.to&&e.to.id&&e.to.id===t.contact.id&&m.$parent.$parent.$parent.vm.removeTab(t))}e.new&&m.$parent.$parent.$parent.vm.addContactTab(e.new)}})},g.getDateFromString=y,g.addJscriptyTab=function(e){try{e.formData=Mustache.render(e.formData,{contact:g.contact,user:g.user})}catch(e){v.error(e)}try{m.$parent.$parent.$parent.vm.addTab({type:"jscripty",title:e.name,icon:"icon-script",color:"grey",project:e,contact:g.contact})}catch(e){p.error({title:"ERROR OPENING JSCRIPTY PROJECT",msg:"The project cannot be started"+JSON.stringify(e)})}},g.getHoppers=b,g.getFinals=A,g.getHistories=E,g.getJscriptyProjects=function(){if(g.jscriptyProjects)return;return g.loadingJscriptyProjects=!0,u.jscriptyProject.get({fields:"createdAt,updatedAt,id,name,description,createdAt,formData,enableUncompleteSave",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){g.jscriptyProjects=e||{count:0,rows:[]}}).catch(function(){p.error({title:o.instant("JSCRIPTY.JSCRIPTY"),msg:o.instant("CONTACTMANAGER.NOTIFICATIONS.JSCRIPTY_GET_ERROR")})}).finally(function(){g.loadingJscriptyProjects=!1})},g.getAccounts=function(n){if(g[n+"Accounts"])return;var e="get"+_.startCase(n)+"Accounts";return g.loadingAccounts=!0,u.user[e]({id:g.user.id,attributes:["id","name"],nolimit:!0}).$promise.then(function(e){g[n+"Accounts"]=e||{count:0,rows:[]}}).catch(function(){p.error({title:o.instant(n.toUpperCase()+"."+n.toUpperCase()+"ACCOUNTS"),msg:o.instant("CONTACTMANAGER.NOTIFICATIONS.ACCOUNTS_GET_ERROR",{channel:o.instant("DASHBOARDS."+n.toUpperCase())})})}).finally(function(){g.loadingAccounts=!1})},g.composeInteraction=function(e,o,r,n){var l=o.toLowerCase();d.show({controller:"Compose"+o+"InteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/"+o.toLowerCase()+"/dialog.html",parent:angular.element(c.body),clickOutsideToClose:!1,locals:{account:r,message:{to:"mail"==l?n:n.split(",")},type:"new",interaction:{Contact:g.contact}},fullscreen:!0}).then(function(s){if(!s||_.isNil(s.message)||!s.message.savedAsDraft)return u[l+"Account"].send({id:r.id},s).$promise.then(function(e){if("Mail"===o){var n=e;if(n&&n.Messages&&n.Messages.length){if(s.attachments&&s.attachments.length)for(var t=0;t<s.attachments.length;t+=1)u.attachment.update({id:s.attachments[t].id},{MailMessageId:_.head(n.Messages).id});if(p.success({title:"Message properly sent!",msg:"Message has been sent!"}),n.closed){n.disposition=null;var a=!r.mandatoryDisposition,i=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause;d.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(c.body),onRemoving:function(){g.user&&r.mandatoryDisposition&&!i&&u.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},clickOutsideToClose:a,escapeToClose:a,locals:{user:g.user,channel:"mail",interaction:n}})}else m.$parent.vm.addInteractionTab("mail",n)}}else p.success({title:"Message properly sent!",msg:"Message has been sent!"}),m.$parent.vm.addInteractionTab(l,e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"fax"===l?p.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:o.toUpperCase()+"ACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});var e={type:"draft",channel:"mail",account:r,contact:g.contact,id:g.tab.id,openedAt:new Date,saved:!1,title:r.key+" - Untitled",content:s.message},n=a.localStorage.getItem("motion2.home.mail:"+g.user.id);if(n){var t=JSON.parse(n);t.drafts||(t.drafts={}),n=t}else n={drafts:{}};n.drafts[g.tab.id]=e,a.localStorage.setItem("motion2.home.mail:"+g.user.id,JSON.stringify(n))})},g.init=function(n,e){return g.tab=n,m.$watchGroup(["vm.detailForm.$pristine","vm.customFieldsForm.$pristine"],function(e){g.tab.saved=e[0]&&e[1]}),g.license=e,g.contact=g.tab.contact,g.newContact=!1,g.currentTab=0,u.user.get({fields:"id,fullname",nolimit:!0}).$promise.then(function(e){g.users=e||{count:0,rows:[]},g.usersMap=_.mapValues(_.keyBy(g.users.rows,"id"),"fullname")}).then(function(){for(var e=[],n=0;n<g.tab.calls.length;n++){var t=g.tab.calls[n];e.push(u.voiceCallReport.get({uniqueid:t.uniqueid}).$promise.then(function(e){e&&0<e.rows.length&&(t.disposedAt=_.first(e.rows).endtime)}))}return i.all(e)}).then(function(){return u.user.getLists({id:g.user.id,nolimit:!0}).$promise}).then(function(e){if(g.lists=e||{count:0,rows:[]},g.contact&&g.contact.ListId){if(g.list=_.find(g.lists.rows,{id:g.contact.ListId}),g.list)return;return u.cmList.get({id:g.contact.ListId}).$promise.then(function(e){e&&(g.list=e,g.lists.rows=_.unionBy(g.lists.rows,[g.list]))})}}).then(function(){if(g.contact&&g.contact.id){var e={id:g.contact.id,ListId:g.contact.ListId,limit:1,offset:0,sort:"-updatedAt"};return u.cmContact.get(e).$promise.then(function(e){return g.contact=e,g.tab.contact=e,u.user.addContacts({id:g.user.id,ids:[g.contact.id]})}).then(function(){if(g.contact.ListId)return u.disposition.get({ListId:g.contact.ListId,nolimit:!0}).$promise.then(function(e){return g.tab.dispositions=e,u.cmList.getCustomFields({id:g.contact.ListId,nolimit:!0}).$promise}).then(function(e){g.tab.customFields=e})}).then(function(){try{g.tab.companies=m.$parent.$parent.$parent.vm.globalCompanies,g.tab.tags=m.$parent.$parent.$parent.vm.globalTags,g.tab.autoCreate=0}catch(e){}u.contactItemType.get({}).$promise.then(function(e){g.contactItemTypes=e.rows}).then(function(){u.cmContact.getAdditionalPhones({id:g.contact.id}).$promise.then(function(e){var n=_.map(e,"item"),t=_.map(e,"description");g.additionalItemTypes=_.map(e,"ItemTypeId");var a=_.map(e,"ItemType.rgbBackgroundColor"),i=_.map(e,"ItemType.name");g.additionalItems=[];for(var s=0;s<n.length;s++)g.additionalItems.push({phone:n[s],type:i[s],color:a[s],description:t[s]})}).catch(function(e){console.log(e)})}),b(),A(),E()}).then(function(){return u.cmContact.getTags({id:g.contact.id}).$promise.then(function(e){g.tab.Tags=_.map(e.rows,"id")})})}return g.newContact=!0,n.autoCreate?h():void 0}).finally(function(){g.contact&&g.contact.id&&(S(),g.contact.dateOfBirth=y(g.contact.dateOfBirth))})},g.hasPermission=function(e){return s.hasPermission(e)},g.openInteraction=function(e){try{return m.$parent.$parent.$parent.vm.addInteractionTab(e.channel,e)}catch(e){p.error({title:o.instant("CONTACTMANAGER.CUSTOMER_JOURNEY"),msg:o.instant("CONTACTMANAGER.NOTIFICATIONS.INTERACTION_OPEN_ERROR")})}},g.getCustomerJourney=S,g.loadMoreJourney=function(){return i(function(e){var n=g.journey.length;return e(S(n))})};var v=n.getLogger("agent.general.contact");function h(){g.errors=[],u.cmContact.save(g.contact).$promise.then(function(e){g.contact.id=e.id,g.newContact=!1;var n=e.firstName||e.phone;return g.tab.title=g.user.privacyEnabled?l.mask(n):n,g.tab.contact=g.contact,u.user.addContacts({id:s.getCurrentUser().id,ids:[e.id]})}).then(function(){g.detailForm.$pristine=!0,g.customFieldsForm.$pristine=!0,p.success({title:"Contact properly created",msg:g.contact.firstName?g.contact.firstName+" has been created!":""})}).then(function(){return u.cmContact.setTags({id:g.contact.id,ids:g.tab.Tags}).$promise}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}function f(n){return function(e){g[n]=e||{count:0,rows:[]}}}function b(){g.contact&&g.contact.id&&(g.queryHopper.ContactId=g.contact.id,g.queryHopper.offset=(g.queryHopper.page-1)*g.queryHopper.limit,g.promise=u.cmHopper.get(g.queryHopper,f("hoppers")).$promise)}function A(){g.contact&&g.contact.id&&(g.queryFinal.ContactId=g.contact.id,g.queryFinal.offset=(g.queryFinal.page-1)*g.queryFinal.limit,g.promise=u.cmHopperFinal.get(g.queryFinal,f("finals")).$promise)}function E(){g.contact&&g.contact.id&&(g.queryHistory.ContactId=g.contact.id,g.queryHistory.offset=(g.queryHistory.page-1)*g.queryHistory.limit,g.promise=u.cmHopperHistory.get(g.queryHistory,f("histories")).$promise)}function y(e){return null===e?void 0:new Date(e)}function S(e){g.journeyIsLoading=!0;var n=_.merge(g.journeyOptions,{id:g.contact.id,offset:e||0});return r.get(g.journey,n).then(function(e){g.journey=e.journey,g.canLoadMoreJourney=e.loadMore}).finally(function(){g.journeyIsLoading=!1})}m.$on("$destroy",function(){}),m.$watch("currentTab",function(){1===g.currentTab&&(b(),A(),E())});var T=!0,I=1;m.$watch("queryHopper.filter",function(e,n){T?t(function(){T=!1}):(n||(I=g.queryHopper.page),e!==n&&(g.queryHopper.page=1),e||(g.queryHopper.page=I),b())}),m.$watch("queryFinal.filter",function(e,n){T?t(function(){T=!1}):(n||(I=g.queryFinal.page),e!==n&&(g.queryFinal.page=1),e||(g.queryFinal.page=I),A())}),m.$watch("queryHistory.filter",function(e,n){T?t(function(){T=!1}):(n||(I=g.queryHistory.page),e!==n&&(g.queryHistory.page=1),e||(g.queryHistory.page=I),E())})}e.$inject=["$window","$mdDialog","$document","$timeout","$scope","$q","api","toasty","Auth","$translate","msUtils","customerJourneyManager","privacyManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentGeneralContactController",e)}(),function(){"use strict";function e(n,t,i,s,o,e,a,r,l,d,c,m,u,p,g){var v=this;v.user=d.getCurrentUser(),v.isReschedule=!1,v.recallme=!1,v.queueCampaign=void 0,v.queueCampaigns={count:0,rows:[]},v.dispositions=_.orderBy(_.concat([],e.rows,a.rows),["name"],["asc"]),v.contact=l,v.call=r,v.note=v.call.note||void 0,v.dialerCall=!1,v.hasBlackLists=!1,v.contactTZTime,v.availableCalls=m,v.autoClose=u,v.recalcTZTime=b,v.hopper={minDate:new Date,dateTime:new Date,scheduledAt:new Date},p.$watch("vm.contact.dialTimezone",function(){b()});var h=g.getLogger("dashboard","agent.general.contact.dispose");function f(){return i(function(n){o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name,dialActive,dialMethod",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){v.queueCampaigns=e||{count:0,rows:[]},n()}).catch(function(e){h.error(e),s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.getBlackLists",msg:e.data?JSON.stringify(e.data):e.toString()})})})}function b(){var e=v.dialerCall?Number(v.call["xmd-voicequeueid"]):v.queueCampaign?v.queueCampaign.id:v.call["xmd-campaignid"]?Number(v.call["xmd-campaignid"]):null;if(e)o.voiceQueue.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(v.hopper.dialTimezone=e.dialTimezone,_.isNil(v.contact.dialTimezone)&&(v.contact.dialTimezone=v.hopper.dialTimezone),n)o.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;o.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledAt=moment(v.hopper.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})});else{o.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledAt=moment(v.hopper.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}});else{o.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledAt=moment(v.hopper.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}}function A(){var e=v.selectedDisposition?v.selectedDisposition.name.toLowerCase():void 0;return{id:v.call.uniqueid,disposition:v.firstLevelDisposition?v.firstLevelDisposition.name:null,secondDisposition:v.secondLevelDisposition?v.secondLevelDisposition.name:null,thirdDisposition:v.thirdLevelDisposition?v.thirdLevelDisposition.name:null,dispositionat:moment(),amd:"amd"===e,fax:"fax"===e,blacklist:"blacklist"===e,recallme:"recallme"===e,UserId:"recallme"===e?d.getCurrentUser().id:null,OwnerId:d.getCurrentUser().id}}function E(e){t.hide([e,v.autoClose])}v.call&&v.call.variables&&v.call.variables["xmd-voicequeueid"]?(v.dialerCall=!0,o.voiceQueue.getBlackLists({id:v.call.variables["xmd-voicequeueid"]}).$promise.then(function(e){e&&e.rows&&0<e.rows.length&&(v.hasBlackLists=!0)}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.getBlackLists",msg:e.data?JSON.stringify(e.data):e.toString()})})):f(),v.onDispositionChange=function(e){switch(e){case"first":v.selectedDisposition=v.firstLevelDisposition,v.anySecondLevelDisposition=_.some(v.dispositions,["ParentId",v.firstLevelDisposition.id]),v.secondLevelDisposition=void 0,v.thirdLevelDisposition=void 0,v.anyThirdLevelDisposition=!1;break;case"second":v.selectedDisposition=v.secondLevelDisposition,v.anyThirdLevelDisposition=_.some(v.dispositions,["ParentId",v.secondLevelDisposition.id]);break;case"third":v.selectedDisposition=v.thirdLevelDisposition}},v.clearDispositionSelection=function(e){"second"===e?(v.secondLevelDisposition=void 0,v.thirdLevelDisposition=void 0,v.selectedDisposition=v.firstLevelDisposition):"third"===e&&(v.thirdLevelDisposition=void 0,v.selectedDisposition=v.secondLevelDisposition)},v.saveDisposition=function(e){v.selectedDisposition=_.isNil(e)?v.selectedDisposition:{name:e},e&&(v.firstLevelDisposition=v.selectedDisposition);v.call.note=v.note,o.voiceCallReport.update({id:v.call.uniqueid,userDisposition:v.firstLevelDisposition?v.firstLevelDisposition.name:null,userSecondDisposition:v.secondLevelDisposition?v.secondLevelDisposition.name:null,userThirdDisposition:v.thirdLevelDisposition?v.thirdLevelDisposition.name:null,note:v.note,UserId:d.getCurrentUser().id,ContactId:v.contact.id}).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEVOICECALLREPORT",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.voiceRecording.get({uniqueid:v.call.uniqueid}).$promise.then(function(e){if(e)for(var n=0;n<e.rows.length;n+=1)o.voiceRecording.update({id:e.rows[n].id,userDisposition:v.firstLevelDisposition?v.firstLevelDisposition.name:null,userSecondDisposition:v.secondLevelDisposition?v.secondLevelDisposition.name:null,userThirdDisposition:v.thirdLevelDisposition?v.thirdLevelDisposition.name:null}).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEVOICERECORDING",msg:e.data?JSON.stringify(e.data):e.toString()})})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEVOICERECORDING",msg:e.data?JSON.stringify(e.data):e.toString()})}),v.dialerCall&&(o.cmHopperFinal.update(A()).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECMHOPPERFINAL",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.cmHopperHistory.update(A()).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECMHOPPERHISTORY",msg:e.data?JSON.stringify(e.data):e.toString()})}));if(_.isNil(v.selectedDisposition))E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"");else switch(v.selectedDisposition.name.toLowerCase()){case"blacklist":v.call&&v.call.variables&&v.call.variables["xmd-voicequeueid"]&&function(e){if(e)o.voiceQueue.getBlackLists({id:e,type:"outbound",fields:"id"}).$promise.then(function(e){var n=[];if(e&&0<e.count){for(var t=0;t<e.rows.length;t+=1){var a=angular.copy(v.contact);delete a.id,a.ListId=e.rows[t].id,n.push(o.cmContact.save(a).$promise)}return i.all(n)}s.success({title:c.instant("DASHBOARDS.INFO"),msg:c.instant("DASHBOARDS.NOTAVAILABLE")+" "+v.selectedDisposition}),v.selectedDisposition=void 0}).then(function(e){e&&E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEBLACKLIST",msg:e.data?JSON.stringify(e.data):e.toString()}),E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")})}(v.call.variables["xmd-voicequeueid"]);break;case"reschedule":v.isReschedule=!0,v.recallme=!1;break;case"recallme":v.isReschedule=!0,v.recallme=!0,v.user.selectRecallMeCampaign&&f().then(function(){v.originalCampaign=_.find(v.queueCampaigns.rows,["id",v.call.variables["xmd-voicequeueid"]]);var e=JSON.parse(n.localStorage.getItem("motion2.user:"+v.user.id));v.queueCampaign=e.previewCampaignId?_.find(v.queueCampaigns.rows,["id",Number(e.previewCampaignId)]):v.originalCampaign});break;default:E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")}},v.closeDialog=function(){t.cancel()},v.saveReschedule=function(){v.disable=!0;var e=null;v.queueCampaign?e=v.queueCampaign.id:v.dialerCall&&(e=Number(v.call["xmd-voicequeueid"]));return o.cmHopper.save({phone:v.contact.phone,UserId:v.recallme?d.getCurrentUser().id:null,ContactId:v.contact.id,ListId:v.contact.ListId,VoiceQueueId:e,scheduledat:moment(v.hopper.scheduledAt).format("YYYY-MM-DD HH:mm:ss"),dialTimezone:v.contact.dialTimezone,priority:3,recallme:v.recallme,OwnerId:d.getCurrentUser().id}).$promise.then(function(e){o.cmContact.rescheduleAdditionalPhones({id:v.contact.id,hopperId:e.id}).$promise.catch(function(e){console.log(e)})}).then(function(){if(v.dialerCall&&(o.cmHopperFinal.update({id:v.call.uniqueid,rescheduled:!0,rescheduledat:moment(v.hopper.scheduledAt).format("YYYY-MM-DD HH:mm:ss"),recallme:v.recallme}).$promise.catch(function(e){h.error(e)}),v.user.selectRecallMeCampaign)){var e=JSON.parse(n.localStorage.getItem("motion2.user:"+v.user.id));e.previewCampaignId=v.queueCampaign.id,n.localStorage.setItem("motion2.user:"+v.user.id,JSON.stringify(e))}}).then(function(){return o.cmContact.update({id:v.contact.id,dialTimezone:v.contact.dialTimezone})}).then(function(){s.success({title:c.instant("DASHBOARDS.INFO"),msg:c.instant("DASHBOARDS.CALL_DISPOSED")+" "+(v.recallme?c.instant("DASHBOARDS.RECALLME"):c.instant("DASHBOARDS.RESCHEDULE"))})}).catch(function(e){h.error(e),E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")}).finally(function(){v.disable=!1,E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")})}}e.$inject=["$window","$mdDialog","$q","toasty","api","dispositions","globalDispositions","call","contact","Auth","$translate","availableCalls","autoClose","$scope","ClientSideLoggingService"],angular.module("app.staff").controller("DisposeCallDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.call=l,u.contact=r,u.hopper={minDate:new Date,dateTime:new Date},u.closeDialog=function(){a.cancel()},u.saveDialog=function(){return u.disable=!0,o.cmHopper.save({phone:u.contact.phone,UserId:c?d.getCurrentUser().id:null,ContactId:u.contact.id,ListId:u.contact.ListId,VoiceQueueId:Number(u.call["xmd-voicequeueid"]),scheduledat:moment(u.hopper.dateTime).format("YYYY-MM-DD HH:mm:ss"),priority:3,recallme:c,OwnerId:d.getCurrentUser().id}).$promise.then(function(){o.cmHopperFinal.update({id:u.call.uniqueid,rescheduled:!0,rescheduledat:moment(u.hopper.dateTime).format("YYYY-MM-DD HH:mm:ss"),recallme:c}).$promise}).then(function(){s.success({title:m.instant("DASHBOARDS.INFO"),msg:m.instant("DASHBOARDS.CALL_DISPOSED")+" "+(c?m.instant("DASHBOARDS.RECALLME"):m.instant("DASHBOARDS.RESCHEDULE"))}),a.hide()}).catch(function(e){a.cancel(e)}).finally(function(){u.disable=!1})}}e.$inject=["$scope","$state","$location","$mdDialog","$timeout","toasty","api","contact","call","Auth","recallme","$translate"],angular.module("app.staff").controller("RescheduleCallDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s){var o=this;o.callNumber=i,o.page=1,o.onInit=function(){n.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){o.lists=_.chain(e.rows).keyBy("id").mapValues("name").value(),n.cmCustomField.get({fields:"id,alias",nolimit:!0}).$promise.then(function(e){o.customFields=e.rows,o.contacts=_.map(t,function(t){return Object.keys(t).forEach(function(e){if(Number(t[e])===Number(o.callNumber))if(e.startsWith("cf_")){var n=_.find(o.customFields,["id",Number(_.trimStart(e,"cf_"))]);t.matchingField=n?n.alias:a.instant("DASHBOARDS.UNKNOWN")}else t.matchingField=e}),t})})}).then(function(){o.paginatedContacts=_.chunk(t,4)}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.get",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},o.selectContact=function(){e.hide(o.selectedContact)}}e.$inject=["$mdDialog","$translate","api","contacts","callNumber","toasty"],angular.module("app.dashboards").controller("ContactSelectionController",e)}(),function(){"use strict";function e(e,n){var t=n(function(){},999);e.$on("$destroy",function(){t&&(n.cancel(t),t=null)})}e.$inject=["$scope","$interval"],angular.module("app.dashboards").controller("AgentHomeAbandonedController",e)}(),function(){"use strict";function e(e,n,a,i,t,s,o,r,l,d){var c=this;function m(){return o.disposition.get({fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}).$promise.then(function(e){return c.dispositions=e?e.rows:[],o.user.getQueues({id:r.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise}).then(function(e){c.queues=e||{count:0,rows:[]},c.queuesMap=_.mapValues(_.keyBy(c.queues.rows,"name"),"name"),c.defaultQueues=c.queues.rows?_.map(c.queues.rows,"name").join(","):void 0}).then(function(){c.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:c.currentUser.name,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_CAMPAIGN",options:c.queues.rows,ngValue:"name",clearAll:!1}]}).catch(function(e){console.log(e)}).finally(function(){var e=t.localStorage.getItem("motion2.home.abandoned.bull.calls:"+c.currentUser.id);if(e)(e=JSON.parse(e)).query&&(c.query=_.merge(e.query,c.query));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};c.query.createdAt=n}c.isSearchBarVisible=!!c.query.filter,u()})}function u(){c.query.queue=c.query.queue||c.defaultQueues.split(","),c.query.offset=(c.query.page-1)*c.query.limit;var e={query:c.query};t.localStorage.setItem("motion2.home.abandoned.bull.calls:"+c.currentUser.id,JSON.stringify(e)),c.promise=o.voiceQueueReport.getVoiceQueuesReport(c.query,p).$promise}function p(e){c.abandonedCalls=e||{count:0,rows:[]},c.refresh=!0}c.showTooltip=!1,c.refresh=!0,c.disable=[],c.dispositions={count:0,rows:[]},c.currentUser=r.getCurrentUser(),c.queues={},c.abandonedCalls={count:0,rows:[]},c.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition",type:"outbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},c.getAbandonedCalls=u,c.refreshAbandonedCalls=function(){c.showTooltip=!1,u()},c.onInit=m,c.reserved=function(e){e&&(c.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:e.assigned?c.currentUser.name:null,assigned:e.assigned}).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[e.id]=!1,e.lastAssignedTo=e.assigned?c.currentUser.name:null}))},c.dispose=function(t){a.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(i.body),targetEvent:t,locals:{dispositions:c.dispositions,call:t}}).then(function(e){if(e){c.disable[t.id]=!0;var n={id:t.id,lastAssignedTo:t.assigned?c.currentUser.name:null,assigned:t.assigned,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null};o.voiceQueueReport.update(n).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[t.id]=!1,t.disposition=e.firstLevel,t.secondDisposition=e.secondLevel,t.thirdDisposition=e.thirdLevel})}})},c.call=e.$parent.$parent.$parent.$parent.vm.call,c.transfer=e.$parent.$parent.$parent.$parent.vm.transfer,c.webcall=e.$parent.$parent.$parent.$parent.vm.webcall,c.webtransfer=e.$parent.$parent.$parent.$parent.vm.webtransfer,l.onWithoutApply("voiceQueueReport:save",function(e){c.queuesMap&&"outbound"===e.type&&c.queuesMap[e.queue]&&(c.showTooltip=!0)}),l.onWithoutApply("voiceQueueReport:update",function(e){if(e){var n=_.findIndex(c.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(c.abandonedCalls.rows[n],e)}}),m(),e.$on("$destroy",function(){l.removeAllListeners("voiceQueueReport:save"),l.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeAbandonedBullController",e)}(),function(){"use strict";function e(n,e,t){var a=this;a.dispositions=e,a.call=t,a.note=a.call.note||void 0,a.onDispositionChange=function(e){switch(e){case"first":a.selectedDisposition=a.firstLevelDisposition,a.anySecondLevelDisposition=_.some(a.dispositions,["ParentId",a.firstLevelDisposition.id]),a.secondLevelDisposition=void 0,a.thirdLevelDisposition=void 0,a.anyThirdLevelDisposition=!1;break;case"second":a.selectedDisposition=a.secondLevelDisposition,a.anyThirdLevelDisposition=_.some(a.dispositions,["ParentId",a.secondLevelDisposition.id]);break;case"third":a.selectedDisposition=a.thirdLevelDisposition}},a.clearDispositionSelection=function(e){"second"===e?(a.secondLevelDisposition=void 0,a.thirdLevelDisposition=void 0,a.selectedDisposition=a.firstLevelDisposition):"third"===e&&(a.thirdLevelDisposition=void 0,a.selectedDisposition=a.secondLevelDisposition)},a.saveDisposition=function(){a.call.note=a.note;var e={firstLevel:a.firstLevelDisposition?a.firstLevelDisposition.name:void 0,secondLevel:a.secondLevelDisposition?a.secondLevelDisposition.name:void 0,thirdLevel:a.thirdLevelDisposition?a.thirdLevelDisposition.name:void 0};n.hide(e)},a.closeDialog=function(){n.cancel()}}e.$inject=["$mdDialog","dispositions","call"],angular.module("app.dashboards").controller("DisposeAbandonedCallDialogController",e)}(),function(){"use strict";function e(e,n,a,i,t,s,o,r,l,d){var c=this;function m(){return o.disposition.get({fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}).$promise.then(function(e){return c.dispositions=e?e.rows:[],o.user.getQueues({id:r.getCurrentUser().id,fields:"id,name",channel:"voice",type:"inbound",nolimit:!0}).$promise}).then(function(e){c.queues=e||{count:0,rows:[]},c.queuesMap=_.mapValues(_.keyBy(c.queues.rows,"name"),"name"),c.defaultQueues=c.queues.rows?_.map(c.queues.rows,"name").join(","):void 0}).then(function(){c.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:c.currentUser.name,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_QUEUE",options:c.queues.rows,ngValue:"name",clearAll:!1}]}).catch(function(e){console.log(e)}).finally(function(){var e=t.localStorage.getItem("motion2.home.abandoned.voice.calls:"+c.currentUser.id);if(e)(e=JSON.parse(e)).query&&(c.query=_.merge(e.query,c.query));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};c.query.createdAt=n}c.isSearchBarVisible=!!c.query.filter,u()})}function u(){c.query.queue=c.query.queue||c.defaultQueues.split(","),c.query.offset=(c.query.page-1)*c.query.limit;var e={query:c.query};t.localStorage.setItem("motion2.home.abandoned.voice.calls:"+c.currentUser.id,JSON.stringify(e)),c.promise=o.voiceQueueReport.getVoiceQueuesReport(c.query,p).$promise}function p(e){c.abandonedCalls=e||{count:0,rows:[]},c.refresh=!0}c.showTooltip=!1,c.refresh=!0,c.disable=[],c.dispositions={count:0,rows:[]},c.currentUser=r.getCurrentUser(),c.queues={},c.abandonedCalls={count:0,rows:[]},c.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition",type:"inbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},c.getAbandonedCalls=u,c.refreshAbandonedCalls=function(){c.showTooltip=!1,u()},c.onInit=m,c.reserved=function(e){e&&(c.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:e.assigned?c.currentUser.name:null,assigned:e.assigned}).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[e.id]=!1,e.lastAssignedTo=e.assigned?c.currentUser.name:null}))},c.dispose=function(t){a.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(i.body),targetEvent:t,locals:{dispositions:c.dispositions,call:t}}).then(function(e){if(e){c.disable[t.id]=!0;var n={id:t.id,lastAssignedTo:t.assigned?c.currentUser.name:null,assigned:t.assigned,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null};o.voiceQueueReport.update(n).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[t.id]=!1,t.disposition=e.firstLevel,t.secondDisposition=e.secondLevel,t.thirdDisposition=e.thirdLevel})}})},c.call=e.$parent.$parent.$parent.$parent.vm.call,c.transfer=e.$parent.$parent.$parent.$parent.vm.transfer,c.webcall=e.$parent.$parent.$parent.$parent.vm.webcall,c.webtransfer=e.$parent.$parent.$parent.$parent.vm.webtransfer,l.onWithoutApply("voiceQueueReport:save",function(e){c.queuesMap&&"inbound"===e.type&&c.queuesMap[e.queue]&&(c.showTooltip=!0)}),l.onWithoutApply("voiceQueueReport:update",function(e){if(e){var n=_.findIndex(c.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(c.abandonedCalls.rows[n],e)}}),m(),e.$on("$destroy",function(){l.removeAllListeners("voiceQueueReport:save"),l.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeAbandonedVoiceController",e)}(),function(){"use strict";function e(n,a,t,e,i){var s=this;function o(){var e=angular.element(".agent-general-home-navbar button.current")[0];e&&e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}s.user=t.getCurrentUser(),s.license={},s.plugin={},s.setting={},s.sidebar="dashboard",s.draftManager=i,s.navigation=e.getNavigation(),s.addContactTab=n.$parent.vm.addContactTab,s.addInteractionTab=n.$parent.vm.addInteractionTab,s.init=function(e,n){s.license=e,s.setting=n;var t=a.localStorage.getItem("motion2.home:"+s.user.id);if(t){try{t=JSON.parse(t),s.sidebar=t.currentSidebarTab?t.currentSidebarTab:"dashboard"}catch(e){console.error(e),s.sidebar="dashboard"}"mail"===s.sidebar&&s.draftManager.init()}},s.changeSidebarTab=function(e){s.sidebar=e.view,"plugin"===s.sidebar&&(s.plugin=e.stateParams,s.pluginId=e.id,n.$broadcast("pluginUpdated",{plugin:s.plugin}));a.localStorage.setItem("motion2.home:"+s.user.id,JSON.stringify({currentSidebarTab:e.view}))},s.hasPermission=function(e){return t.hasPermission(e)},angular.element(a).on("resize",o),n.$on("$destroy",function(){angular.element(a).off("resize",o)}),n.$watch("vm_home.sidebar",function(e,n){"mail"===e?s.draftManager.init():s.draftManager.drafts={}})}e.$inject=["$scope","$window","Auth","msNavigationAgentService","draftManager"],angular.module("app.dashboards").controller("AgentGeneralHomeController",e)}(),function(){"use strict";function e(t,n,i,s,a,o,r,l,e,d,c,m,u,p){var g=this;g.user=e.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.chatInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,ChatWebsiteId:[]},g.sectionColor="green-A700",g.onInit=function(e,n){return g.license=e,g.setting=n,l.user.getChatWebsites({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.chatAccounts=e||{count:0,rows:[]},l.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Website",key:"ChatWebsiteId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.chatAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Customer Ip",column:"customerIp",type:"text",options:{excludedOperators:["$eq","$ne","$startsWith","$endsWith"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Website",column:"ChatWebsiteId",type:"multiselect",options:{route:{model:"user",action:"getChatWebsites",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){r.resolve().then(function(){var e=m.get("motion2.home.chat:"+g.user.id,"query");e&&(g.query=_.merge(g.query,e),g.query.sort&&0<=g.query.sort.indexOf("lastMessage")&&(g.query=_.omit(g.query,"sort")),g.query.includeAll=!0,g.isSearchBarVisible=!(g.query.search||!g.query.filter)),1===g.chatAccounts.rows.length&&(g.query.ChatWebsiteId=[g.chatAccounts.rows[0].id])}).catch(function(e){v.error(e)}).then(function(){y(g.query.page)}),d.on("chatInteraction:save",O),d.on("chatInteraction:update",O),d.on("chatInteractionTags:save",C),d.on("chatMessage:save",w),d.on("chatMessage:update",w),d.on("user_has_chat_interactions:save",T),d.on("user_has_chat_interactions:remove",I),d.on("userChatWebsite:save",f),d.on("userChatWebsite:remove",b),0<g.setting.chatInteractionsReloadTimeout&&R()})},g.success=E,g.getChatInteractions=y,g.showChatInteraction=function(e,n){t.$parent.vm.addInteractionTab("chat",n)},g.downloadChatInteraction=function(e,s,n){l.chatInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="chat-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadChatInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&l.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"chat",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getChatWebsiteLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.chat"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.chat");function h(e){return{accounts:g.chatAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.ChatWebsiteId);u.addAccount("chat",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.ChatWebsiteId);u.removeAccount("chat",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.chatAccounts.rows,function(e){return{model:"chatWebsite",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.chatInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.chatInteractions=e||{count:0,rows:[]};for(var n=0;n<g.chatInteractions.rows.length;n+=1)S(g.chatInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=a.localStorage.getItem("motion2.home.chat:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,a.localStorage.setItem("motion2.home.chat:"+g.user.id,JSON.stringify(n)),g.promise=l.chatInteraction.get(g.query,E).$promise}function S(e){"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.chatInteractions.rows,{id:e.ChatInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.chatInteractions.rows,{id:e.ChatInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.chatInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.chatInteractions.rows=_.orderBy(g.chatInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.chatInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.chatInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.chatInteractions.rows,{id:e.ChatInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.chatInteractionsReloadTimeout)}t.$on("$destroy",function(){d.removeAllListeners("chatMessage:save"),d.removeAllListeners("chatMessage:update"),d.removeAllListeners("chatInteraction:save"),d.removeAllListeners("chatInteractionTags:save"),d.removeAllListeners("chatInteraction:update"),d.removeAllListeners("user_has_chat_interactions:save"),d.removeAllListeners("user_has_chat_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeChatController",e)}(),function(){"use strict";function e(t,n,e,a,i,s,o,r){var l=this;function d(e){l.searchInProgress=!1,l.contacts=e||{count:0,rows:[]}}function c(e,n){l.searchInProgress=!0,o.cmContact.describe({id:l.query.ListId}).$promise.then(function(e){return _(e.toJSON()).omit("UserId").values().map(function(e){return function(e){var n={name:_.startCase(e.displayName),column:e.columnName,options:{}};if(e.custom)switch(e.custom.type){case"text":n.type="text";break;case"select":n.type="multiselect",n.values=_.map(JSON.parse(e.custom.values),function(e,n){return{id:n,name:e.value,value:e.value}}),n.options.field="name";break;case"switch":n.type="select",n.values=[{id:1,translate:"DASHBOARDS.ENABLED"},{id:0,translate:"DASHBOARDS.DISABLED"}],n.options.excludedOperators=["$ne"];break;case"number":n.type="number";break;case"datetime":n.type="date"}else switch(e.columnName){case"dateOfBirth":n.type="date";break;case"CompanyId":n.name="Company",n.type="autocomplete",n.options.route={model:"cmCompany",action:"get",params:{fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;case"ListId":n.name="List",n.type="autocomplete",n.options.route={model:"user",action:"getLists",params:{id:l.currentUser.id,fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;default:_.includes(e.type.toLowerCase(),"int")?n.type="number":_.includes(e.type.toLowerCase(),"date")?n.type="date":n.type="text"}return n}(e)}).value()}).then(function(e){l.advancedSearch.fields=e;var n=_.findIndex(e,function(e){return _.startsWith(e.column,"cf_")})||e.length-1;n<0&&(n=e.length),l.advancedSearch.fields.splice(n,0,{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"DESCRIBE_CM_CONTACTS",msg:e.data?JSON.stringify(e.data.message):e.toString()})}),e||(l.query.page=1),l.query.offset=(l.query.page-1)*l.query.limit;var t=i.localStorage.getItem("motion2.home.contacts:"+l.currentUser.id);(t=t?JSON.parse(t):{}).query=l.query,i.localStorage.setItem("motion2.home.contacts:"+l.currentUser.id,JSON.stringify(t)),l.promise=o.cmContact.get(l.query,d).$promise}l.currentUser=s.getCurrentUser(),l.lists={},l.contacts={count:0,rows:[]},l.tags={count:0,rows:[]},l.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1},l.advancedSearch={fields:[]},l.sectionColor="red",l.getContacts=c,l.refreshContacts=function(){c()},l.mergeContact=function(e,n){a.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.duplicateContact=function(e,n){a.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.openContact=function(e){return o.cmContact.get({id:e}).$promise.then(function(e){n.$parent.vm.addContactTab(e)})},l.call=n.$parent.vm.call,l.onInit=function(){o.user.getLists({id:l.currentUser.id,fields:"id,name,dialPrefix",sort:"name",nolimit:!0}).$promise.then(function(e){return l.lists=e||{count:0,rows:[]},l.listsMap=_.keyBy(l.lists.rows,"id"),o.tag.get({sort:"name"}).$promise}).then(function(e){l.tags=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"List",key:"ListId",type:"multiselect",label:"CONTACTMANAGER.SELECT_LIST",options:l.lists.rows,clearAll:!1},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:l.tags.rows,placeholder:"DASHBOARDS.TAGS"}]}).catch(function(e){console.error(e)}).finally(function(){var e=i.localStorage.getItem("motion2.home.contacts:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.merge(l.query,e.query),_.isEmpty(l.lists.rows)?l.query.ListId=[]:_.isEmpty(l.query.ListId)&&(l.query.ListId=_(l.lists.rows).map("id").take().value()))}catch(e){console.log(e)}else l.query.ListId=_.map(l.lists.rows,"id");l.isSearchBarVisible=!(l.query.search||!l.query.filter),c()})},l.openAdvancedSearch=function(){a.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{color:l.sectionColor,fields:l.advancedSearch.fields,storagePath:"home.contacts"},fullscreen:!0}).then(function(e){l.isSearchBarVisible=!(e.value||!l.query.filter),e.apply&&(l.query.search=e.value,c())}).catch(function(e){r.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}}e.$inject=["$document","$scope","$timeout","$mdDialog","$window","Auth","api","toasty"],angular.module("app.dashboards").controller("AgentHomeContactsController",e)}(),function(){"use strict";function e(e,n){var t=n(function(){},999);e.$on("$destroy",function(){t&&(n.cancel(t),t=null)})}e.$inject=["$scope","$interval"],angular.module("app.dashboards").controller("AgentHomeDashboardController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["type","waiting","dialMethod","dialActive"];function u(e){c.voiceQueuesTotal=e.count?e.count:0,c.voiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.voiceQueues,function(e,n){c.rpcVoiceQueues[n]&&(c.voiceQueues[n].waiting=c.rpcVoiceQueues[n].waiting||0)})}c.voiceQueues={},c.voiceQueuesTotal=0,c.rpcVoiceQueues={},c.getVoiceQueues={},c.rpcVoiceQueuesChannels={},c.addVoiceQueuesChannels={},c.deleteVoiceQueuesChannels=[],c.load=!0,c.query={id:r.getCurrentUser().id,fields:"id,name,type,dialMethod,dialActive",channel:"voice",type:"outbound",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=u,c.getVoiceQueues=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,u).$promise},c.getSize=function(e){return _.size(e)},c.onSaveQueue=function(e){c.voiceQueues[e.id]&&c.rpcVoiceQueues[e.id]&&(c.rpcVoiceQueues[e.id]=e,_.merge(c.voiceQueues[e.id],_.pick(e,m)))},c.onSaveChannel=function(e){"outbound"===e.type&&(e.queuecallerleaveAt?(delete c.rpcVoiceQueuesChannels[e.uniqueid],c.load&&c.deleteVoiceQueuesChannels.push(e.uniqueid)):(c.rpcVoiceQueuesChannels[e.uniqueid]=e,c.load&&(c.addVoiceQueuesChannels[e.uniqueid]=e)))},c.onUserVoiceQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getVoiceQueues()},c.onSaveVoiceQueue=function(e){_.isNil(e)||(c.rpcVoiceQueues[e.id]=_.pick(e,m))},c.onUpdateVoiceQueue=function(e){_.isNil(e)||(c.rpcVoiceQueues[e.id]&&_.merge(c.rpcVoiceQueues[e.id],_.pick(e,m)),c.voiceQueues[e.id]&&_.merge(c.voiceQueues[e.id],_.pick(e,m)))},c.onRemoveVoiceQueue=function(e){_.isNil(e)||(delete c.rpcVoiceQueues[e.id],delete c.voiceQueues[e.id])},l.onWithoutApply("voice_queue:save",c.onSaveQueue),l.onWithoutApply("voice_queue_channel:save",c.onSaveChannel),l.onWithoutApply("userVoiceQueue:save",c.onUserVoiceQueue),l.onWithoutApply("userVoiceQueue:remove",c.onUserVoiceQueue),l.onWithoutApply("voiceQueue:save",c.onSaveVoiceQueue),l.onWithoutApply("voiceQueue:remove",c.onRemoveVoiceQueue),l.onWithoutApply("voiceQueue:update",c.onUpdateVoiceQueue),o.rpc.getVoiceQueues().$promise.then(function(e){return c.rpcVoiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},o.rpc.getVoiceQueuesChannels().$promise}).then(function(e){c.rpcVoiceQueuesChannels=e?_.keyBy(e.rows?_.filter(e.rows,{type:"outbound",queuecallerleaveAt:null}):[],"uniqueid"):{}}).catch(function(e){console.error(e)}).finally(function(){_.merge(c.rpcVoiceQueuesChannels,c.addVoiceQueuesChannels);for(var e=0;e<c.deleteVoiceQueuesChannels.length;e+=1)delete c.rpcVoiceQueuesChannels[c.deleteVoiceQueuesChannels[e]];c.load=!1,c.addVoiceQueuesChannels={},c.deleteVoiceQueuesChannels=[],c.getVoiceQueues()});var p=!0,g=1;e.$watch("vm_dc.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=g),c.getVoiceQueues())}),e.$on("$destroy",function(){l.removeAllListeners("voice_queue:save"),l.removeAllListeners("voice_queue_channel:save"),l.removeAllListeners("userVoiceQueue:save"),l.removeAllListeners("userVoiceQueue:remove"),l.removeAllListeners("voiceQueue:save"),l.removeAllListeners("voiceQueue:update"),l.removeAllListeners("voiceQueue:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardBullController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcChatQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.chatQueuesTotal=e.count?e.count:0,c.chatQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.chatQueues,function(e,n){c.rpcChatQueues[n]&&(c.chatQueues[n].waiting=c.rpcChatQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.chatQueues={},c.chatQueuesTotal=0,c.rpcChatQueues={},c.paginatedInteractions=[],c.deleteChatQueuesWaitingInteractions=[],c.rpcChatQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"chat",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getChatQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.chatQueues[e.id]&&c.rpcChatQueues[e.id]&&(_.merge(c.rpcChatQueues[e.id],_.pick(e,m)),_.merge(c.chatQueues[e.id],_.pick(e,m)))},c.onSaveChatQueue=function(e){_.isNil(e)||(c.rpcChatQueues[e.id]=_.pick(e,m))},c.onUpdateChatQueue=function(e){_.isNil(e)||(c.rpcChatQueues[e.id]&&_.merge(c.rpcChatQueues[e.id],_.pick(e,m)),c.chatQueues[e.id]&&_.merge(c.chatQueues[e.id],_.pick(e,m)))},c.onRemoveChatQueue=function(e){_.isNil(e)||(delete c.rpcChatQueues[e.id],delete c.chatQueues[e.id])},c.onSaveUserChatQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getChatQueues()},c.onRemoveUserChatQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getChatQueues()},c.onSaveChatQueueChannel=function(e){c.chatQueues[e.queue_id]&&(c.rpcChatQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveChatQueueChannel=function(e){delete c.rpcChatQueuesWaitingInteractions[e.id],u&&c.deleteChatQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("chat_queue:save",c.onSaveQueue),l.onWithoutApply("chatQueue:save",c.onSaveChatQueue),l.onWithoutApply("chatQueue:update",c.onUpdateChatQueue),l.onWithoutApply("chatQueue:remove",c.onRemoveChatQueue),l.onWithoutApply("userChatQueue:save",c.onSaveUserChatQueue),l.onWithoutApply("userChatQueue:remove",c.onRemoveUserChatQueue),l.onWithoutApply("chat_queue_waiting_interaction:save",c.onSaveChatQueueChannel),l.onWithoutApply("chat_queue_waiting_interaction:remove",c.onRemoveChatQueueChannel),o.rpc.getChatQueues().$promise.then(function(e){c.rpcChatQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"chat"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getChatQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcChatQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteChatQueuesWaitingInteractions.length;e+=1)delete c.rpcChatQueuesWaitingInteractions[c.deleteChatQueuesWaitingInteractions[e]];u=!1,c.deleteChatQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getChatQueues())}),e.$on("$destroy",function(){l.removeAllListeners("chat_queue:save"),l.removeAllListeners("chatQueue:save"),l.removeAllListeners("chatQueue:update"),l.removeAllListeners("chatQueue:remove"),l.removeAllListeners("userChatQueue:save"),l.removeAllListeners("userChatQueue:remove"),l.removeAllListeners("chat_queue_waiting_interaction:save"),l.removeAllListeners("chat_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelChatController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcFaxQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.faxQueuesTotal=e.count?e.count:0,c.faxQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.faxQueues,function(e,n){c.rpcFaxQueues[n]&&(c.faxQueues[n].waiting=c.rpcFaxQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.faxQueues={},c.faxQueuesTotal=0,c.rpcFaxQueues={},c.paginatedInteractions=[],c.deleteFaxQueuesWaitingInteractions=[],c.rpcFaxQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"fax",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getFaxQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.faxQueues[e.id]&&c.rpcFaxQueues[e.id]&&(_.merge(c.rpcFaxQueues[e.id],_.pick(e,m)),_.merge(c.faxQueues[e.id],_.pick(e,m)))},c.onSaveFaxQueue=function(e){_.isNil(e)||(c.rpcFaxQueues[e.id]=_.pick(e,m))},c.onUpdateFaxQueue=function(e){_.isNil(e)||(c.rpcFaxQueues[e.id]&&_.merge(c.rpcFaxQueues[e.id],_.pick(e,m)),c.faxQueues[e.id]&&_.merge(c.faxQueues[e.id],_.pick(e,m)))},c.onRemoveFaxQueue=function(e){_.isNil(e)||(delete c.rpcFaxQueues[e.id],delete c.faxQueues[e.id])},c.onSaveUserFaxQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getFaxQueues()},c.onRemoveUserFaxQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getFaxQueues()},c.onSaveFaxQueueChannel=function(e){c.faxQueues[e.queue_id]&&(c.rpcFaxQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveFaxQueueChannel=function(e){delete c.rpcFaxQueuesWaitingInteractions[e.id],u&&c.deleteFaxQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("fax_queue:save",c.onSaveQueue),l.onWithoutApply("faxQueue:save",c.onSaveFaxQueue),l.onWithoutApply("faxQueue:update",c.onUpdateFaxQueue),l.onWithoutApply("faxQueue:remove",c.onRemoveFaxQueue),l.onWithoutApply("userFaxQueue:save",c.onSaveUserFaxQueue),l.onWithoutApply("userFaxQueue:remove",c.onRemoveUserFaxQueue),l.onWithoutApply("fax_queue_waiting_interaction:save",c.onSaveFaxQueueChannel),l.onWithoutApply("fax_queue_waiting_interaction:remove",c.onRemoveFaxQueueChannel),o.rpc.getFaxQueues().$promise.then(function(e){c.rpcFaxQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"fax"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getFaxQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcFaxQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteFaxQueuesWaitingInteractions.length;e+=1)delete c.rpcFaxQueuesWaitingInteractions[c.deleteFaxQueuesWaitingInteractions[e]];u=!1,c.deleteFaxQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getFaxQueues())}),e.$on("$destroy",function(){l.removeAllListeners("fax_queue:save"),l.removeAllListeners("faxQueue:save"),l.removeAllListeners("faxQueue:update"),l.removeAllListeners("faxQueue:remove"),l.removeAllListeners("userFaxQueue:save"),l.removeAllListeners("userFaxQueue:remove"),l.removeAllListeners("fax_queue_waiting_interaction:save"),l.removeAllListeners("fax_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelFaxController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcMailQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.mailQueuesTotal=e.count?e.count:0,c.mailQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.mailQueues,function(e,n){c.rpcMailQueues[n]&&(c.mailQueues[n].waiting=c.rpcMailQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.mailQueues={},c.mailQueuesTotal=0,c.rpcMailQueues={},c.paginatedInteractions=[],c.deleteMailQueuesWaitingInteractions=[],c.rpcMailQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"mail",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getMailQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.mailQueues[e.id]&&c.rpcMailQueues[e.id]&&(_.merge(c.rpcMailQueues[e.id],_.pick(e,m)),_.merge(c.mailQueues[e.id],_.pick(e,m)))},c.onSaveMailQueue=function(e){_.isNil(e)||(c.rpcMailQueues[e.id]=_.pick(e,m))},c.onUpdateMailQueue=function(e){_.isNil(e)||(c.rpcMailQueues[e.id]&&_.merge(c.rpcMailQueues[e.id],_.pick(e,m)),c.mailQueues[e.id]&&_.merge(c.mailQueues[e.id],_.pick(e,m)))},c.onRemoveMailQueue=function(e){_.isNil(e)||(delete c.rpcMailQueues[e.id],delete c.mailQueues[e.id])},c.onSaveUserMailQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getMailQueues()},c.onRemoveUserMailQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getMailQueues()},c.onSaveMailQueueChannel=function(e){c.mailQueues[e.queue_id]&&(c.rpcMailQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveMailQueueChannel=function(e){delete c.rpcMailQueuesWaitingInteractions[e.id],u&&c.deleteMailQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("mail_queue:save",c.onSaveQueue),l.onWithoutApply("mailQueue:save",c.onSaveMailQueue),l.onWithoutApply("mailQueue:update",c.onUpdateMailQueue),l.onWithoutApply("mailQueue:remove",c.onRemoveMailQueue),l.onWithoutApply("userMailQueue:save",c.onSaveUserMailQueue),l.onWithoutApply("userMailQueue:remove",c.onRemoveUserMailQueue),l.onWithoutApply("mail_queue_waiting_interaction:save",c.onSaveMailQueueChannel),l.onWithoutApply("mail_queue_waiting_interaction:remove",c.onRemoveMailQueueChannel),o.rpc.getMailQueues().$promise.then(function(e){c.rpcMailQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"mail"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getMailQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcMailQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteMailQueuesWaitingInteractions.length;e+=1)delete c.rpcMailQueuesWaitingInteractions[c.deleteMailQueuesWaitingInteractions[e]];u=!1,c.deleteMailQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getMailQueues())}),e.$on("$destroy",function(){l.removeAllListeners("mail_queue:save"),l.removeAllListeners("mailQueue:save"),l.removeAllListeners("mailQueue:update"),l.removeAllListeners("mailQueue:remove"),l.removeAllListeners("userMailQueue:save"),l.removeAllListeners("userMailQueue:remove"),l.removeAllListeners("mail_queue_waiting_interaction:save"),l.removeAllListeners("mail_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelMailController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcOpenchannelQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.openchannelQueuesTotal=e.count?e.count:0,c.openchannelQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.openchannelQueues,function(e,n){c.rpcOpenchannelQueues[n]&&(c.openchannelQueues[n].waiting=c.rpcOpenchannelQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.openchannelQueues={},c.openchannelQueuesTotal=0,c.rpcOpenchannelQueues={},c.paginatedInteractions=[],c.deleteOpenchannelQueuesWaitingInteractions=[],c.rpcOpenchannelQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"openchannel",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getOpenchannelQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.openchannelQueues[e.id]&&c.rpcOpenchannelQueues[e.id]&&(_.merge(c.rpcOpenchannelQueues[e.id],_.pick(e,m)),_.merge(c.openchannelQueues[e.id],_.pick(e,m)))},c.onSaveOpenchannelQueue=function(e){_.isNil(e)||(c.rpcOpenchannelQueues[e.id]=_.pick(e,m))},c.onUpdateOpenchannelQueue=function(e){_.isNil(e)||(c.rpcOpenchannelQueues[e.id]&&_.merge(c.rpcOpenchannelQueues[e.id],_.pick(e,m)),c.openchannelQueues[e.id]&&_.merge(c.openchannelQueues[e.id],_.pick(e,m)))},c.onRemoveOpenchannelQueue=function(e){_.isNil(e)||(delete c.rpcOpenchannelQueues[e.id],delete c.openchannelQueues[e.id])},c.onSaveUserOpenchannelQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getOpenchannelQueues()},c.onRemoveUserOpenchannelQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getOpenchannelQueues()},c.onSaveOpenchannelQueueChannel=function(e){c.openchannelQueues[e.queue_id]&&(c.rpcOpenchannelQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveOpenchannelQueueChannel=function(e){delete c.rpcOpenchannelQueuesWaitingInteractions[e.id],u&&c.deleteOpenchannelQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("openchannel_queue:save",c.onSaveQueue),l.onWithoutApply("openchannelQueue:save",c.onSaveOpenchannelQueue),l.onWithoutApply("openchannelQueue:update",c.onUpdateOpenchannelQueue),l.onWithoutApply("openchannelQueue:remove",c.onRemoveOpenchannelQueue),l.onWithoutApply("userOpenchannelQueue:save",c.onSaveUserOpenchannelQueue),l.onWithoutApply("userOpenchannelQueue:remove",c.onRemoveUserOpenchannelQueue),l.onWithoutApply("openchannel_queue_waiting_interaction:save",c.onSaveOpenchannelQueueChannel),l.onWithoutApply("openchannel_queue_waiting_interaction:remove",c.onRemoveOpenchannelQueueChannel),o.rpc.getOpenchannelQueues().$promise.then(function(e){c.rpcOpenchannelQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"openchannel"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getOpenchannelQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcOpenchannelQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteOpenchannelQueuesWaitingInteractions.length;e+=1)delete c.rpcOpenchannelQueuesWaitingInteractions[c.deleteOpenchannelQueuesWaitingInteractions[e]];u=!1,c.deleteOpenchannelQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getOpenchannelQueues())}),e.$on("$destroy",function(){l.removeAllListeners("openchannel_queue:save"),l.removeAllListeners("openchannelQueue:save"),l.removeAllListeners("openchannelQueue:update"),l.removeAllListeners("openchannelQueue:remove"),l.removeAllListeners("userOpenchannelQueue:save"),l.removeAllListeners("userOpenchannelQueue:remove"),l.removeAllListeners("openchannel_queue_waiting_interaction:save"),l.removeAllListeners("openchannel_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelOpenchannelController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcSmsQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.smsQueuesTotal=e.count?e.count:0,c.smsQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.smsQueues,function(e,n){c.rpcSmsQueues[n]&&(c.smsQueues[n].waiting=c.rpcSmsQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.smsQueues={},c.smsQueuesTotal=0,c.rpcSmsQueues={},c.paginatedInteractions=[],c.deleteSmsQueuesWaitingInteractions=[],c.rpcSmsQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"sms",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getSmsQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.smsQueues[e.id]&&c.rpcSmsQueues[e.id]&&(_.merge(c.rpcSmsQueues[e.id],_.pick(e,m)),_.merge(c.smsQueues[e.id],_.pick(e,m)))},c.onSaveSmsQueue=function(e){_.isNil(e)||(c.rpcSmsQueues[e.id]=_.pick(e,m))},c.onUpdateSmsQueue=function(e){_.isNil(e)||(c.rpcSmsQueues[e.id]&&_.merge(c.rpcSmsQueues[e.id],_.pick(e,m)),c.smsQueues[e.id]&&_.merge(c.smsQueues[e.id],_.pick(e,m)))},c.onRemoveSmsQueue=function(e){_.isNil(e)||(delete c.rpcSmsQueues[e.id],delete c.smsQueues[e.id])},c.onSaveUserSmsQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getSmsQueues()},c.onRemoveUserSmsQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getSmsQueues()},c.onSaveSmsQueueChannel=function(e){c.smsQueues[e.queue_id]&&(c.rpcSmsQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveSmsQueueChannel=function(e){delete c.rpcSmsQueuesWaitingInteractions[e.id],u&&c.deleteSmsQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("sms_queue:save",c.onSaveQueue),l.onWithoutApply("smsQueue:save",c.onSaveSmsQueue),l.onWithoutApply("smsQueue:update",c.onUpdateSmsQueue),l.onWithoutApply("smsQueue:remove",c.onRemoveSmsQueue),l.onWithoutApply("userSmsQueue:save",c.onSaveUserSmsQueue),l.onWithoutApply("userSmsQueue:remove",c.onRemoveUserSmsQueue),l.onWithoutApply("sms_queue_waiting_interaction:save",c.onSaveSmsQueueChannel),l.onWithoutApply("sms_queue_waiting_interaction:remove",c.onRemoveSmsQueueChannel),o.rpc.getSmsQueues().$promise.then(function(e){c.rpcSmsQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"sms"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getSmsQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcSmsQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteSmsQueuesWaitingInteractions.length;e+=1)delete c.rpcSmsQueuesWaitingInteractions[c.deleteSmsQueuesWaitingInteractions[e]];u=!1,c.deleteSmsQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getSmsQueues())}),e.$on("$destroy",function(){l.removeAllListeners("sms_queue:save"),l.removeAllListeners("smsQueue:save"),l.removeAllListeners("smsQueue:update"),l.removeAllListeners("smsQueue:remove"),l.removeAllListeners("userSmsQueue:save"),l.removeAllListeners("userSmsQueue:remove"),l.removeAllListeners("sms_queue_waiting_interaction:save"),l.removeAllListeners("sms_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelSmsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["type","waiting","dialMethod","dialActive"];function u(e){c.voiceQueuesTotal=e.count?e.count:0,c.voiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.voiceQueues,function(e,n){c.rpcVoiceQueues[n]&&(c.voiceQueues[n].waiting=c.rpcVoiceQueues[n].waiting||0)})}c.voiceQueues={},c.voiceQueuesTotal=0,c.rpcVoiceQueues={},c.getVoiceQueues={},c.rpcVoiceQueuesChannels={},c.addVoiceQueuesChannels={},c.deleteVoiceQueuesChannels=[],c.load=!0,c.query={id:r.getCurrentUser().id,fields:"id,name,type,dialMethod,dialActive",channel:"voice",type:"inbound",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=u,c.getVoiceQueues=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,u).$promise},c.getSize=function(e){return _.size(e)},c.onSaveQueue=function(e){c.voiceQueues[e.id]&&c.rpcVoiceQueues[e.id]&&(c.rpcVoiceQueues[e.id]=e,_.merge(c.voiceQueues[e.id],_.pick(e,m)))},c.onSaveChannel=function(e){"inbound"===e.type&&(e.queuecallerleaveAt?(delete c.rpcVoiceQueuesChannels[e.uniqueid],c.load&&c.deleteVoiceQueuesChannels.push(e.uniqueid)):(c.rpcVoiceQueuesChannels[e.uniqueid]=e,c.load&&(c.addVoiceQueuesChannels[e.uniqueid]=e)))},c.onUserVoiceQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getVoiceQueues()},c.onSaveVoiceQueue=function(e){_.isNil(e)||(c.rpcVoiceQueues[e.id]=_.pick(e,m))},c.onUpdateVoiceQueue=function(e){_.isNil(e)||(c.rpcVoiceQueues[e.id]&&_.merge(c.rpcVoiceQueues[e.id],_.pick(e,m)),c.voiceQueues[e.id]&&_.merge(c.voiceQueues[e.id],_.pick(e,m)))},c.onRemoveVoiceQueue=function(e){_.isNil(e)||(delete c.rpcVoiceQueues[e.id],delete c.voiceQueues[e.id])},l.onWithoutApply("voice_queue:save",c.onSaveQueue),l.onWithoutApply("voice_queue_channel:save",c.onSaveChannel),l.onWithoutApply("userVoiceQueue:save",c.onUserVoiceQueue),l.onWithoutApply("userVoiceQueue:remove",c.onUserVoiceQueue),l.onWithoutApply("voiceQueue:save",c.onSaveVoiceQueue),l.onWithoutApply("voiceQueue:remove",c.onRemoveVoiceQueue),l.onWithoutApply("voiceQueue:update",c.onUpdateVoiceQueue),o.user.getQueues(c.query).$promise.then(function(e){return c.myQueues=e,o.rpc.getVoiceQueues().$promise}).then(function(e){for(var n=e.rows,t=_.keyBy(n,"id"),a=0;a<c.myQueues.count;a++){var i=c.myQueues.rows[a];c.rpcVoiceQueues[i.id]=t[i.id]}return o.rpc.getVoiceQueuesChannels().$promise}).then(function(e){c.rpcVoiceQueuesChannels=e?_.keyBy(e.rows?_.filter(e.rows,function(e){return!("inbound"!==e.type||e.queuecallerleaveAt||!_.find(c.myQueues.rows,{name:e.queue}))}):[],"uniqueid"):{}}).catch(function(e){console.error(e)}).finally(function(){_.merge(c.rpcVoiceQueuesChannels,c.addVoiceQueuesChannels);for(var e=0;e<c.deleteVoiceQueuesChannels.length;e+=1)delete c.rpcVoiceQueuesChannels[c.deleteVoiceQueuesChannels[e]];c.load=!1,c.addVoiceQueuesChannels={},c.deleteVoiceQueuesChannels=[],c.getVoiceQueues()});var p=!0,g=1;e.$watch("vm_dc.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=g),c.getVoiceQueues())}),e.$on("$destroy",function(){l.removeAllListeners("voice_queue:save"),l.removeAllListeners("voice_queue_channel:save"),l.removeAllListeners("userVoiceQueue:save"),l.removeAllListeners("userVoiceQueue:remove"),l.removeAllListeners("voiceQueue:save"),l.removeAllListeners("voiceQueue:update"),l.removeAllListeners("voiceQueue:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardVoiceController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcWhatsappQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.whatsappQueuesTotal=e.count?e.count:0,c.whatsappQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.whatsappQueues,function(e,n){c.rpcWhatsappQueues[n]&&(c.whatsappQueues[n].waiting=c.rpcWhatsappQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.whatsappQueues={},c.whatsappQueuesTotal=0,c.rpcWhatsappQueues={},c.paginatedInteractions=[],c.deleteWhatsappQueuesWaitingInteractions=[],c.rpcWhatsappQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"whatsapp",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getWhatsappQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.whatsappQueues[e.id]&&c.rpcWhatsappQueues[e.id]&&(_.merge(c.rpcWhatsappQueues[e.id],_.pick(e,m)),_.merge(c.whatsappQueues[e.id],_.pick(e,m)))},c.onSaveWhatsappQueue=function(e){_.isNil(e)||(c.rpcWhatsappQueues[e.id]=_.pick(e,m))},c.onUpdateWhatsappQueue=function(e){_.isNil(e)||(c.rpcWhatsappQueues[e.id]&&_.merge(c.rpcWhatsappQueues[e.id],_.pick(e,m)),c.whatsappQueues[e.id]&&_.merge(c.whatsappQueues[e.id],_.pick(e,m)))},c.onRemoveWhatsappQueue=function(e){_.isNil(e)||(delete c.rpcWhatsappQueues[e.id],delete c.whatsappQueues[e.id])},c.onSaveUserWhatsappQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getWhatsappQueues()},c.onRemoveUserWhatsappQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getWhatsappQueues()},c.onSaveWhatsappQueueChannel=function(e){c.whatsappQueues[e.queue_id]&&(c.rpcWhatsappQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveWhatsappQueueChannel=function(e){delete c.rpcWhatsappQueuesWaitingInteractions[e.id],u&&c.deleteWhatsappQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("whatsapp_queue:save",c.onSaveQueue),l.onWithoutApply("whatsappQueue:save",c.onSaveWhatsappQueue),l.onWithoutApply("whatsappQueue:update",c.onUpdateWhatsappQueue),l.onWithoutApply("whatsappQueue:remove",c.onRemoveWhatsappQueue),l.onWithoutApply("userWhatsappQueue:save",c.onSaveUserWhatsappQueue),l.onWithoutApply("userWhatsappQueue:remove",c.onRemoveUserWhatsappQueue),l.onWithoutApply("whatsapp_queue_waiting_interaction:save",c.onSaveWhatsappQueueChannel),l.onWithoutApply("whatsapp_queue_waiting_interaction:remove",c.onRemoveWhatsappQueueChannel),o.rpc.getWhatsappQueues().$promise.then(function(e){c.rpcWhatsappQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"whatsapp"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getWhatsappQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcWhatsappQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteWhatsappQueuesWaitingInteractions.length;e+=1)delete c.rpcWhatsappQueuesWaitingInteractions[c.deleteWhatsappQueuesWaitingInteractions[e]];u=!1,c.deleteWhatsappQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getWhatsappQueues())}),e.$on("$destroy",function(){l.removeAllListeners("whatsapp_queue:save"),l.removeAllListeners("whatsappQueue:save"),l.removeAllListeners("whatsappQueue:update"),l.removeAllListeners("whatsappQueue:remove"),l.removeAllListeners("userWhatsappQueue:save"),l.removeAllListeners("userWhatsappQueue:remove"),l.removeAllListeners("whatsapp_queue_waiting_interaction:save"),l.removeAllListeners("whatsapp_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelWhatsappController",e)}(),function(){"use strict";function e(a,t,i,s,o,n,r,l,e,d,c,m,u,p){var g=this;g.user=e.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.faxInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,FaxAccountId:[]},g.sectionColor="blue-grey",g.onInit=function(e,n){return g.license=e,g.setting=n,l.user.getFaxAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.faxAccounts=e||{count:0,rows:[]},l.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"FaxAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.faxAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"FaxAccountId",type:"multiselect",options:{route:{model:"user",action:"getFaxAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){r.resolve().then(function(){var e=m.get("motion2.home.fax:"+g.user.id,"query");e&&(g.query=_.merge(g.query,e),g.query.sort&&0<=g.query.sort.indexOf("lastMessage")&&(g.query=_.omit(g.query,"sort")),g.query.includeAll=!0,g.isSearchBarVisible=!(g.query.search||!g.query.filter)),1===g.faxAccounts.rows.length&&(g.query.FaxAccountId=[g.faxAccounts.rows[0].id])}).catch(function(e){v.error(e)}).then(function(){y(g.query.page)}),d.on("faxInteraction:save",O),d.on("faxInteraction:update",O),d.on("faxInteractionTags:save",C),d.on("faxMessage:save",w),d.on("faxMessage:update",w),d.on("user_has_fax_interactions:save",T),d.on("user_has_fax_interactions:remove",I),d.on("userFaxAccount:save",f),d.on("userFaxAccount:remove",b)})},g.success=E,g.getFaxInteractions=y,g.showFaxInteraction=function(e,n){a.$parent.vm.addInteractionTab("fax",n)},g.downloadFaxInteraction=function(e,s,n){l.faxInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="fax-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadFaxInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&l.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"fax",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?n.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return n.instant("DASHBOARDS.NOT_ASSIGNED")},g.getFaxAccountLabel=function(e){if(e.Account)return e.Account.key;return n.instant("DASHBOARDS.UNKNOWN")},g.composeFaxInteraction=function(e,t){i.show({controller:"ComposeFaxInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/fax/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return l.faxAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("fax",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.fax"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.fax");function h(e){return{accounts:g.faxAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.FaxAccountId);u.addAccount("fax",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.FaxAccountId);u.removeAccount("fax",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.faxAccounts.rows,function(e){return{model:"faxAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.faxInteractionsReloadTimeout&&function(e){e&&g.interactionsInterval&&t.cancel(g.interactionsInterval);g.interactionsInterval=t(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.faxInteractionsReloadTimeout)}(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.faxInteractions=e||{count:0,rows:[]};for(var n=0;n<g.faxInteractions.rows.length;n+=1)S(g.faxInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=o.localStorage.getItem("motion2.home.fax:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,o.localStorage.setItem("motion2.home.fax:"+g.user.id,JSON.stringify(n)),g.promise=l.faxInteraction.get(g.query,E).$promise}function S(e){e.contactInfo=e.Contact?e.Contact.fax:void 0,"Unknown"===e.contactName&&(e.contactName=n.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.faxInteractions.rows,{id:e.FaxInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.faxInteractions.rows,{id:e.FaxInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.faxInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.faxInteractions.rows=_.orderBy(g.faxInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else y(g.query.page)}}function C(e){if(e){var n=_.find(g.faxInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.faxInteractions.rows,{id:e.FaxInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}a.$on("$destroy",function(){d.removeAllListeners("faxMessage:save"),d.removeAllListeners("faxMessage:update"),d.removeAllListeners("faxInteraction:save"),d.removeAllListeners("faxInteractionTags:save"),d.removeAllListeners("faxInteraction:update"),d.removeAllListeners("user_has_fax_interactions:save"),d.removeAllListeners("user_has_fax_interactions:remove"),g.interactionsInterval&&t.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeFaxController",e)}(),function(){"use strict";function e(o,n,r,l,m,t,a,d,e,i,c,u,s,p,g){var v=this;v.user=e.getCurrentUser(),v.license={},v.setting={},v.tags={count:0,rows:[]},v.mailInteractions={count:0,rows:[]},v.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,MailAccountId:[]},v.sectionColor="teal",v.onInit=function(e,n){return v.license=e,v.setting=n,d.user.getMailAccounts({id:v.user.id,nolimit:!0}).$promise.then(function(e){return v.mailAccounts=e||{count:0,rows:[]},d.tag.get({sort:"name"}).$promise}).then(function(e){v.tags=e||{count:0,rows:[]}}).then(function(){return d.mailSubstatus.get({nolimit:!0}).$promise}).then(function(e){v.subStatuses=e||{count:0,rows:[]}}).then(function(){v.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Substatus",key:"substatus",type:"select",label:"DASHBOARDS.SELECT_SUBSTATUS",options:v.subStatuses.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NONE"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name",ngIf:"closed === 0"},{name:"Account",key:"MailAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:v.mailAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:v.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:v.tags.rows,placeholder:"DASHBOARDS.TAGS"}],v.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"plainBody",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Substatus",column:"substatus",type:"multiselect",options:{field:"name",route:{model:"mailSubstatus",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"MailAccountId",type:"multiselect",options:{route:{model:"user",action:"getMailAccounts",params:{id:v.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:E("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:E("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:E("third")}}]}}).catch(function(e){h.error(e)}).finally(function(){a.resolve().then(function(){var e=s.get("motion2.home.mail:"+v.user.id,"query");e&&(v.query=_.merge(v.query,e),v.query.sort&&0<=v.query.sort.indexOf("lastMessage")&&(v.query=_.omit(v.query,"sort")),v.query.includeAll=!0,v.isSearchBarVisible=!(v.query.search||!v.query.filter)),1===v.mailAccounts.rows.length&&(v.query.MailAccountId=[v.mailAccounts.rows[0].id])}).catch(function(e){h.error(e)}).then(function(){S(v.query.page)}),i.on("mailInteraction:save",w),i.on("mailInteraction:update",w),i.on("mailInteractionTags:save",R),i.on("mailMessage:save",x),i.on("mailMessage:update",x),i.on("user_has_mail_interactions:save",O),i.on("user_has_mail_interactions:remove",C),i.on("userMailAccount:save",b),i.on("userMailAccount:remove",A),0<v.setting.mailInteractionsReloadTimeout&&N()})},v.success=y,v.getMailInteractions=S,v.showMailInteraction=T,v.downloadMailInteraction=function(e,s,n){d.mailInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="mail-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadMailInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.disposeInteraction=function(e,n){var t=v.user.voicePause||v.user.chatPause||v.user.mailPause||v.user.openchannelPause||v.user.faxPause,a=!n.Account.mandatoryDisposition;r.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(l.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){v.user&&n.Account.mandatoryDisposition&&!t&&d.user.unpause({id:v.user.id}).$promise.catch(function(e){h.error(e)})},locals:{user:v.user,channel:"mail",interaction:n}})},v.getContactLabel=I,v.getAgentLabel=function(e){if(e.UserId)return e.UserId===v.user.id?t.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return t.instant("DASHBOARDS.NOT_ASSIGNED")},v.getMailAccountLabel=function(e){if(e.Account)return e.Account.key;return t.instant("DASHBOARDS.UNKNOWN")},v.composeMailInteraction=function(e,s){r.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",parent:angular.element(l.body),clickOutsideToClose:!1,locals:{account:s,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){if(!e.message||!e.message.savedAsDraft){var i=e;return d.mailAccount.send({id:s.id},i).$promise.then(function(e){if(e&&e.Messages&&e.Messages.length){if(i.attachments&&i.attachments.length)for(var n=0;n<i.attachments.length;n+=1)d.attachment.update({id:i.attachments[n].id},{MailMessageId:_.head(e.Messages).id});if(c.success({title:"Message properly sent!",msg:"Message has been sent!"}),e.closed){e.disposition=null;var t=!s.mandatoryDisposition,a=v.user.voicePause||v.user.chatPause||v.user.mailPause||v.user.openchannelPause||v.user.faxPause;r.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(l.body),onRemoving:function(){v.user&&s.mandatoryDisposition&&!a&&d.user.unpause({id:v.user.id}).$promise.catch(function(e){h.error(e)})},clickOutsideToClose:t,escapeToClose:t,locals:{user:v.user,channel:"mail",interaction:e}})}else o.$parent.vm.addInteractionTab("mail",e)}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"MAILACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}var n={channel:"mail",account:s,message:e.message,contact:e.contact};u.add(n)}})},v.openAdvancedSearch=function(){r.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(l.body),clickOutsideToClose:!1,locals:{color:v.sectionColor,fields:v.advancedSearch.fields,storagePath:"home.mail"},fullscreen:!0}).then(function(e){v.isSearchBarVisible=!(e.value||!v.query.filter),e.apply&&(v.query.search=e.value,S())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var h=g.getLogger("agent.general.mail");function f(e){return{accounts:v.mailAccounts,accountId:e,filters:v.quickFilters,query:v.query,userId:v.user.id}}function b(e){if(e.UserId===v.user.id){var n=f(e.MailAccountId);p.addAccount("mail",n).then(function(e){e&&S()}).catch(function(e){h.error(e)})}}function A(e){if(e.UserId===v.user.id){var n=f(e.MailAccountId);p.removeAccount("mail",n).catch(function(e){h.error(e)})}}function E(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(v.mailAccounts.rows,function(e){return{model:"mailAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function y(e){!v.reloadingInteractions&&0<v.setting.mailInteractionsReloadTimeout&&N(!0),v.searchInProgress=!1,v.reloadingInteractions=!1,v.mailInteractions=e||{count:0,rows:[]};for(var n=0;n<v.mailInteractions.rows.length;n+=1)I(v.mailInteractions.rows[n])}function S(e){v.searchInProgress=!0,e||(v.query.page=1),(void 0===v.query.closed||null===v.query.closed||v.query.closed)&&delete v.query.substatus,v.query.offset=(v.query.page-1)*v.query.limit;var n=m.localStorage.getItem("motion2.home.mail:"+v.user.id);(n=n?JSON.parse(n):{}).query=v.query,m.localStorage.setItem("motion2.home.mail:"+v.user.id,JSON.stringify(n)),v.promise=d.mailInteraction.get(v.query,y).$promise}function T(e,n){o.$parent.vm.addInteractionTab("mail",n)}function I(e){_.isEmpty(e.to)||!e.Account||_.includes(e.to,e.Account.email)?e.contactInfo=e.Contact?e.Contact.email:void 0:e.contactInfo=e.to.split("<").pop().split(">")[0],"Unknown"===e.contactName&&(e.contactName=t.instant("DASHBOARDS.UNKNOWN"))}function O(e){var n=_.find(v.mailInteractions.rows,{id:e.MailInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function C(e){var n=_.find(v.mailInteractions.rows,{id:e.MailInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function w(e){if(e){var n=_.find(v.mailInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),v.query.sort){var t=_.startsWith(v.query.sort,"-")?"desc":"asc";v.mailInteractions.rows=_.orderBy(v.mailInteractions.rows,_.trimStart(v.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===v.setting.mailInteractionsReloadTimeout&&S(v.query.page)}}function R(e){if(e){var n=_.find(v.mailInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function x(e){if(e&&!e.secret){var n=_.find(v.mailInteractions.rows,{id:e.MailInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function N(e){e&&v.interactionsInterval&&n.cancel(v.interactionsInterval),v.interactionsInterval=n(function(){v.reloadingInteractions=!0,v.searchInProgress||S()},1e3*v.setting.mailInteractionsReloadTimeout)}o.$on("openMailDraft",function(e,s){s.interaction?(s.interaction.isDraft=!0,T(null,s.interaction)):r.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",parent:angular.element(l.body),clickOutsideToClose:!1,locals:{account:s.account,message:s.content,type:"draft",interaction:{}},fullscreen:!0}).then(function(e){if(e){if(!e.message||!e.message.savedAsDraft){var i=e;return d.mailAccount.send({id:s.account.id},i).$promise.then(function(e){if(u.remove(s.id),e&&e.Messages&&e.Messages.length){if(i.attachments&&i.attachments.length)for(var n=0;n<i.attachments.length;n+=1)d.attachment.update({id:i.attachments[n].id},{MailMessageId:_.head(e.Messages).id});if(c.success({title:"Message properly sent!",msg:"Message has been sent!"}),e.closed){e.disposition=null;var t=!s.account.mandatoryDisposition,a=v.user.voicePause||v.user.chatPause||v.user.mailPause||v.user.openchannelPause||v.user.faxPause;r.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(l.body),onRemoving:function(){v.user&&s.account.mandatoryDisposition&&!a&&d.user.unpause({id:v.user.id}).$promise.catch(function(e){h.error(e)})},clickOutsideToClose:t,escapeToClose:t,locals:{user:v.user,channel:"mail",interaction:e}})}else o.$parent.vm.addInteractionTab("mail",e)}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"MAILACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}var n={id:s.id,channel:"mail",account:e.account,message:e.message};u.update(n)}})}),v.resetTooltipPosition=function(e){var n=angular.element(e.currentTarget).children()[1],t=angular.element(n);t.css("top",""),t.css("left",""),t.css("bottom","")},v.adjustTooltipPosition=function(e){var n=angular.element(e.currentTarget).children(),t=n[0],a=n[1],i=angular.element(t),s=angular.element(a),o=m.innerHeight,r=i.offset(),l=r.top,d=r.left,c=o<216+l;s.css("left",d),c?(s.css("top",""),s.css("bottom",o-l)):(s.css("bottom",""),s.css("top",l))},o.$on("$destroy",function(){i.removeAllListeners("mailMessage:save"),i.removeAllListeners("mailMessage:update"),i.removeAllListeners("mailInteraction:save"),i.removeAllListeners("mailInteractionTags:save"),i.removeAllListeners("mailInteraction:update"),i.removeAllListeners("user_has_mail_interactions:save"),i.removeAllListeners("user_has_mail_interactions:remove"),v.interactionsInterval&&n.cancel(v.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","draftManager","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeMailController",e)}(),function(){"use strict";function e(t,a,e,i,n,s,o,r){var l=this;function d(e){l.searchInProgress=!1,l.contacts=e||{count:0,rows:[]}}function c(e,n){l.searchInProgress=!0,s.cmContact.describe({id:l.query.ListId}).$promise.then(function(e){return _(e.toJSON()).omit("UserId").values().map(function(e){return function(e){var n={name:_.startCase(e.displayName),column:e.columnName,options:{}};if(e.custom)switch(e.custom.type){case"text":n.type="text";break;case"select":n.type="multiselect",n.values=_.map(JSON.parse(e.custom.values),function(e,n){return{id:n,name:e.value,value:e.value}}),n.options.field="name";break;case"switch":n.type="select",n.values=[{id:1,translate:"DASHBOARDS.ENABLED"},{id:0,translate:"DASHBOARDS.DISABLED"}],n.options.excludedOperators=["$ne"];break;case"number":n.type="number";break;case"datetime":n.type="date"}else switch(e.columnName){case"dateOfBirth":n.type="date";break;case"CompanyId":n.name="Company",n.type="autocomplete",n.options.route={model:"cmCompany",action:"get",params:{fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;case"ListId":n.name="List",n.type="autocomplete",n.options.route={model:"user",action:"getLists",params:{id:l.currentUser.id,fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;default:_.includes(e.type.toLowerCase(),"int")?n.type="number":_.includes(e.type.toLowerCase(),"date")?n.type="date":n.type="text"}return n}(e)}).value()}).then(function(e){l.advancedSearch.fields=e;var n=_.findIndex(e,function(e){return _.startsWith(e.column,"cf_")})||e.length-1;n<0&&(n=e.length),l.advancedSearch.fields.splice(n,0,{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"DESCRIBE_CM_CONTACTS",msg:e.data?JSON.stringify(e.data.message):e.toString()})}),e||(l.query.page=1),l.query.offset=(l.query.page-1)*l.query.limit;var t=o.localStorage.getItem("motion2.home.mycontacts:"+l.currentUser.id);(t=t?JSON.parse(t):{}).query=l.query,o.localStorage.setItem("motion2.home.mycontacts:"+l.currentUser.id,JSON.stringify(t)),l.query.search&&(l.advancedQuery=_.omit(l.query,"id")),l.promise=l.query.search?s.cmContact.get(l.advancedQuery,d).$promise:s.user.getContacts(l.query,d).$promise}l.currentUser=n.getCurrentUser(),l.lists={},l.contacts={count:0,rows:[]},l.tags={count:0,rows:[]},l.query={includeAll:!0,id:l.currentUser.id,sort:"-updatedAt",limit:10,page:1},l.advancedSearch={fields:[]},l.sectionColor="red",l.getContacts=c,l.refreshContacts=function(){c()},l.mergeContact=function(e,n){i.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.duplicateContact=function(e,n){i.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.openContact=function(e,n){a.$parent.vm.addContactTab(n)},l.call=a.$parent.vm.call,l.onInit=function(){s.cmList.get({fields:"id,name,dialPrefix",sort:"name",nolimit:!0}).$promise.then(function(e){return l.lists=e||{count:0,rows:[]},l.listsMap=_.keyBy(l.lists.rows,"id"),s.tag.get({sort:"name"}).$promise}).then(function(e){l.tags=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"List",key:"ListId",type:"multiselect",label:"CONTACTMANAGER.SELECT_LIST",options:l.lists.rows,clearAll:!1},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:l.tags.rows,placeholder:"DASHBOARDS.TAGS"}]}).catch(function(e){console.error(e)}).finally(function(){var e=o.localStorage.getItem("motion2.home.mycontacts:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.merge(l.query,e.query),_.isEmpty(l.lists.rows)?l.query.ListId=[]:_.isEmpty(l.query.ListId)&&(l.query.ListId=_(l.lists.rows).map("id").take().value()))}catch(e){console.error(e)}else l.query.ListId=_.map(l.lists.rows,"id");l.isSearchBarVisible=!(l.query.search||!l.query.filter),c()})},l.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{color:l.sectionColor,fields:l.advancedSearch.fields,storagePath:"home.mycontacts"},fullscreen:!0}).then(function(e){l.isSearchBarVisible=!(e.value||!l.query.filter),e.apply&&(l.query.search=e.value?e.value+="||User:=$eq["+l.currentUser.id+"]":e.value,c())}).catch(function(e){r.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}}e.$inject=["$document","$scope","$timeout","$mdDialog","Auth","api","$window","toasty"],angular.module("app.dashboards").controller("AgentHomeMyContactsController",e)}(),function(){"use strict";function e(a,n,i,s,t,o,r,l,e,d,c,m,u,p){var g=this;g.user=e.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.openchannelInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,OpenchannelAccountId:[]},g.sectionColor="amber",g.onInit=function(e,n){return g.license=e,g.setting=n,l.user.getOpenchannelAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.openchannelAccounts=e||{count:0,rows:[]},l.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"OpenchannelAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.openchannelAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"OpenchannelAccountId",type:"multiselect",options:{route:{model:"user",action:"getOpenchannelAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){r.resolve().then(function(){var e=m.get("motion2.home.openchannel:"+g.user.id,"query");e&&(g.query=_.merge(g.query,e),g.query.sort&&0<=g.query.sort.indexOf("lastMessage")&&(g.query=_.omit(g.query,"sort")),g.query.includeAll=!0,g.isSearchBarVisible=!(g.query.search||!g.query.filter)),1===g.openchannelAccounts.rows.length&&(g.query.OpenchannelAccountId=[g.openchannelAccounts.rows[0].id])}).catch(function(e){v.error(e)}).then(function(){y(g.query.page)}),d.on("openchannelInteraction:save",O),d.on("openchannelInteraction:update",O),d.on("openchannelInteractionTags:save",C),d.on("openchannelMessage:save",w),d.on("openchannelMessage:update",w),d.on("user_has_openchannel_interactions:save",T),d.on("user_has_openchannel_interactions:remove",I),d.on("userOpenchannelAccount:save",f),d.on("userOpenchannelAccount:remove",b),0<g.setting.openchannelInteractionsReloadTimeout&&R()})},g.success=E,g.getOpenchannelInteractions=y,g.showOpenchannelInteraction=function(e,n){a.$parent.vm.addInteractionTab("openchannel",n)},g.downloadOpenchannelInteraction=function(e,s,n){l.openchannelInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="openchannel-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadOpenchannelInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&l.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"openchannel",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getOpenchannelAccountLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.composeOpenchannelInteraction=function(e,t){i.show({controller:"ComposeOpenchannelInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/openchannel/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return l.openchannelAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("openchannel",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"OPENCHANNELACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.openchannel"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.openchannel");function h(e){return{accounts:g.openchannelAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.OpenchannelAccountId);u.addAccount("openchannel",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.OpenchannelAccountId);u.removeAccount("openchannel",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.openchannelAccounts.rows,function(e){return{model:"openchannelAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.openchannelInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.openchannelInteractions=e||{count:0,rows:[]};for(var n=0;n<g.openchannelInteractions.rows.length;n+=1)S(g.openchannelInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=t.localStorage.getItem("motion2.home.openchannel:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,t.localStorage.setItem("motion2.home.openchannel:"+g.user.id,JSON.stringify(n)),g.promise=l.openchannelInteraction.get(g.query,E).$promise}function S(e){"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.openchannelInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.openchannelInteractions.rows=_.orderBy(g.openchannelInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.openchannelInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.openchannelInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.openchannelInteractionsReloadTimeout)}a.$on("$destroy",function(){d.removeAllListeners("openchannelMessage:save"),d.removeAllListeners("openchannelMessage:update"),d.removeAllListeners("openchannelInteraction:save"),d.removeAllListeners("openchannelInteractionTags:save"),d.removeAllListeners("openchannelInteraction:update"),d.removeAllListeners("user_has_openchannel_interactions:save"),d.removeAllListeners("user_has_openchannel_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeOpenchannelController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(e,n,t){d.license=e,d.setting=n,d.plugin=t}d.currentUser=o.getCurrentUser(),d.plugin={},d.onInit=c,d.getTrustedURL=function(){return s.trustAsResourceUrl(d.plugin.agentUrl)},c(),n.$on("pluginUpdated",function(e,n){d.plugin=n.plugin})}e.$inject=["$document","$scope","$timeout","$mdDialog","$stateParams","$sce","Auth","api","$window"],angular.module("app.dashboards").controller("AgentHomePluginsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(){d.agentsQuery.offset=(d.agentsQuery.page-1)*d.agentsQuery.limit,l.update("motion2.home.presence.agents:"+d.currentUser.id,d.agentsQuery,"query"),i.user.getPresence(d.agentsQuery).$promise.then(function(e){d.agents={count:e.count,rows:_.filter(e.rows,function(e){return e.id!==d.currentUser.id})}}).catch(function(){r.error({title:t.instant("DASHBOARDS.AGENT_PRESENCE"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")})})}function m(){d.queuesQuery.offset=(d.queuesQuery.page-1)*d.queuesQuery.limit,l.update("motion2.home.presence.queues:"+d.currentUser.id,d.queuesQuery,"query"),i.voiceQueue.get(d.queuesQuery).$promise.then(function(e){return d.voiceQueues=e||{rows:[],count:0},i.rpc.getVoiceQueuesChannels().$promise.then(function(e){e.rows.forEach(function(e){var n=_.find(d.voiceQueues.rows,["name",e.name]);n&&(n.calls||(n.calls=[]),n.calls.push(e))})})}).catch(function(){r.error({title:t.instant("VOICE.VOICEQUEUES"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")})})}function u(e){return 0===d.selectedTab?e:"xcallyQueueExtension"+e}function p(e,n,t,a){var i=_.find(d.agents.rows,["id",e]);i&&(i.status=!1===n?"offline":a?"pause":"unavailable"===t?t:_.includes(["idle","unknown","ringing",null,void 0],t)?"online":"busy")}function g(e){e.id!==d.currentUser.id&&p(e.id,e.online,e.voiceStatus,e.voicePause)}d.currentUser=s.getCurrentUser(),d.agents={count:0,rows:[]},d.agentsQuery={fields:"id,name,internal,online",role:"agent",sort:"name",limit:10,page:1},d.queuesQuery={fields:"id,name",type:"inbound",sort:"name",limit:10,page:1},d.onAgentsTabSelection=function(){if(d.agentsQuery.filter||d.agentsQuery.teams||d.agentsQuery.queues)return;_.merge(d.agentsQuery,l.get("motion2.home.presence.agents:"+d.currentUser.id,"query")),d.isSearchBarVisible=!!d.agentsQuery.filter,a.all([a(function(n,e){i.team.get({fields:"id,name",sort:"name",nolimit:!0}).$promise.then(function(e){d.teams=e||{rows:[],count:0},n()}).catch(function(){r.error({title:t.instant("STAFF.TEAMS"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")}),e()})}),a(function(n,e){i.voiceQueue.get({fields:"id,name",type:"inbound",sort:"name",nolimit:!0}).$promise.then(function(e){d.queues=e||{rows:[],count:0},n()}).catch(function(){r.error({title:t.instant("VOICE.VOICEQUEUES"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")}),e()})})]).then(function(){d.quickFilters=[{name:"Team",key:"teams",type:"multiselect",label:"DASHBOARDS.SELECT_TEAM",options:d.teams.rows},{name:"Queue",key:"queues",type:"multiselect",label:"DASHBOARDS.SELECT_QUEUE",options:d.queues.rows}],c()}).catch(function(){r.error({title:t.instant("DASHBOARDS.AGENT_PRESENCE"),msg:t.instant("DASHBOARDS.ERRORS.FAILED_INITIALIZATION")})})},d.onQueuesTabSelection=function(){if(d.queuesQuery.filter)return;_.merge(d.queuesQuery,l.get("motion2.home.presence.queues:"+d.currentUser.id,"query")),d.isSearchBarVisible=!!d.queuesQuery.filter,m()},d.getAgents=c,d.getVoiceQueues=m,d.originateCall=function(e){n.$broadcast("webrtc::call",{target:u(e)})},d.transferCall=function(e){n.$broadcast("webrtc::transfer",{target:u(e)})},o.on("user:presence",function(e){if(e.id===d.currentUser.id)return;p(e.id,e.online,e.voiceStatus,e.voicePause)}),o.on("user:update",g),o.on("voice_queue_presence:save",function(e){if(!d.voiceQueues&&d.voiceQueues.rows)return;var n=_.find(d.voiceQueues.rows,["name",e.name]);if(!n)return;n.calls||(n.calls=[]);if(_.some(n.calls,["uniqueid",e.uniqueid]))return;n.calls.push(e)}),o.on("voice_queue_presence:remove",function(e){var n=_.find(d.voiceQueues.rows,["name",e.name]);if(!n)return;_.remove(n.calls,["uniqueid",e.uniqueid])}),e.$on("$destroy",function(){o.removeListener("user:update",g),o.removeAllListeners("user:presence"),o.removeAllListeners("voice_queue_presence:save"),o.removeAllListeners("voice_queue_presence:remove")})}e.$inject=["$scope","$rootScope","$translate","$q","api","Auth","socket","toasty","localStorageManager"],angular.module("app.dashboards").controller("AgentHomePresenceController",e)}(),function(){"use strict";function e(e,t,n,a,o,i){var s=this;function r(e){s.searchInProgress=!1,s.voiceRecordings=e||{count:0,rows:[]}}function l(){s.searchInProgress=!0,s.query.offset=(s.query.page-1)*s.query.limit;var e={query:s.query};t.localStorage.setItem("motion2.home.recordings:"+s.currentUser.id,JSON.stringify(e)),s.promise=a.voiceRecording.get(s.query,r).$promise}s.currentUser=i.getCurrentUser(),s.voiceRecordings={},s.table="voiceRecordings",s.query={UserId:s.currentUser.id,fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,rating,audio,transcribeStatus,UserId",sort:"-updatedAt",limit:10,page:1,type:null},s.downloadfile=function(i,e){return a.voiceRecording.download({id:i.id,exists:!0}).$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download",i.uniqueid+i.format),a.click()}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.downloadtranscribe=function(s,e){return a.voiceRecording.downloadTranscribe({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.uniqueid;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.success=r,s.getVoiceRecordings=l,s.onInit=function(){s.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Type",key:"type",type:"select",label:"VOICE.SELECT_TYPE",customOptions:[{value:"internal",translate:"VOICE.INTERNAL"},{value:"inbound",translate:"VOICE.INBOUND"},{value:"outbound",translate:"VOICE.OUTBOUND"},{value:"dialer",translate:"VOICE.DIALER"},{value:null,translate:"VOICE.ALL"}]}];var e=t.localStorage.getItem("motion2.home.recordings:"+s.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(s.query=_.merge(s.query,e.query))}catch(e){console.error(e)}else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};s.query.createdAt=n}s.isSearchBarVisible=!!s.query.filter,l()}}e.$inject=["$scope","$window","$timeout","api","toasty","Auth"],angular.module("app.dashboards").controller("AgentHomeRecordingsController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,r,n){var l=this;function d(e){l.searchInProgress=!1,l.scheduledCalls=e||{count:0,rows:[]}}l.currentUser=n.getCurrentUser(),l.priorities=["Lowest","Low","Medium","High","Highest"],l.crudPermissions={readOnly:!1,canEdit:!0,canDelete:!0},l.scheduledCalls={},l.query={id:l.currentUser.id,fields:"id,phone,scheduledat,recallme,priority,UserId,OwnerId,dialTimezone",sort:"scheduledat",limit:10,page:1},l.queueCampaigns={rows:[],count:0},l.success=d,l.getScheduledCalls=function(){l.searchInProgress=!0,l.query.id=l.currentUser.id,l.query.includeAll=!0,l.query.offset=(l.query.page-1)*l.query.limit,l.query.fields="id,phone,scheduledat,recallme,priority,UserId,OwnerId,dialTimezone";var e={query:l.query};t.localStorage.setItem("motion2.home.scheduled:"+l.currentUser.id,JSON.stringify(e)),l.promise=r.user.getScheduledCalls(l.query,d).$promise},l.onInit=function(){r.user.getQueues({id:n.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){l.queueCampaigns=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"Start Date",key:"scheduledat",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Campaigns",key:"VoiceQueueId",type:"multiselect",label:"MOTIONDIALER.SELECT_CAMPAIGN",options:l.queueCampaigns.rows}]}).catch(function(e){console.error(e)}).finally(function(){var e=t.localStorage.getItem("motion2.home.scheduled:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.omit(e.query,["filter"]))}catch(e){console.error(e)}else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};l.query.scheduledat=n}l.getScheduledCalls()})},l.isDateBeforeToday=function(e){return moment(e).isBefore(moment())},l.createOrEditQueueCampaignHopper=function(e,n){i.show({controller:"CreateOrEditHopperVoiceQueueIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hoppers/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:null,hopper:n,hoppers:l.scheduledCalls.rows,license:null,setting:null,crudPermissions:l.crudPermissions}})},l.deleteConfirm=function(n,e){var t=i.confirm().title("Are you sure want to delete the scheduled call?").htmlContent("<b>Scheduled call</b> will be deleted.").ariaLabel("delete scheduled call").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){var e;e=n,r.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(l.scheduledCalls.rows,{id:e.id}),l.scheduledCalls.count-=1,l.scheduledCalls.rows.length||l.getScheduledCalls(),o.success({title:"Scheduled call deleted!",msg:e.name?"Scheduled call has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETE_HOPPER"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETE_HOPPER",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){console.log("CANCEL")})};var c=!0,m=1;e.$watch("vm.query.filter",function(e,n){c?a(function(){c=!1}):(n||(m=l.query.page),e!==n&&(l.query.page=1),e||(l.query.page=m),l.getScheduledCalls())})}e.$inject=["$scope","$window","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.dashboards").controller("AgentHomeScheduledCallsController",e)}(),function(){"use strict";function e(a,n,i,s,t,o,r,l,e,d,c,m,u,p){var g=this;g.user=e.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.smsInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,SmsAccountId:[]},g.sectionColor="orange",g.onInit=function(e,n){return g.license=e,g.setting=n,l.user.getSmsAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.smsAccounts=e||{count:0,rows:[]},l.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"SmsAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.smsAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"SmsAccountId",type:"multiselect",options:{route:{model:"user",action:"getSmsAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){r.resolve().then(function(){var e=m.get("motion2.home.sms:"+g.user.id,"query");e&&(g.query=_.merge(g.query,e),g.query.sort&&0<=g.query.sort.indexOf("lastMessage")&&(g.query=_.omit(g.query,"sort")),g.query.includeAll=!0,g.isSearchBarVisible=!(g.query.search||!g.query.filter)),1===g.smsAccounts.rows.length&&(g.query.SmsAccountId=[g.smsAccounts.rows[0].id])}).catch(function(e){v.error(e)}).then(function(){y(g.query.page)}),d.on("smsInteraction:save",O),d.on("smsInteraction:update",O),d.on("smsInteractionTags:save",C),d.on("smsMessage:save",w),d.on("smsMessage:update",w),d.on("user_has_sms_interactions:save",T),d.on("user_has_sms_interactions:remove",I),d.on("userSmsAccount:save",f),d.on("userSmsAccount:remove",b),0<g.setting.smsInteractionsReloadTimeout&&R()})},g.success=E,g.getSmsInteractions=y,g.showSmsInteraction=function(e,n){a.$parent.vm.addInteractionTab("sms",n)},g.downloadSmsInteraction=function(e,s,n){l.smsInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="sms-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadSmsInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&l.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"sms",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getSmsAccountLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.composeSmsInteraction=function(e,t){i.show({controller:"ComposeSmsInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/sms/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return l.smsAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("sms",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SMSACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.sms"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.sms");function h(e){return{accounts:g.smsAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.SmsAccountId);u.addAccount("sms",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.SmsAccountId);u.removeAccount("sms",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.smsAccounts.rows,function(e){return{model:"smsAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.smsInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.smsInteractions=e||{count:0,rows:[]};for(var n=0;n<g.smsInteractions.rows.length;n+=1)S(g.smsInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=t.localStorage.getItem("motion2.home.sms:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,t.localStorage.setItem("motion2.home.sms:"+g.user.id,JSON.stringify(n)),g.promise=l.smsInteraction.get(g.query,E).$promise}function S(e){e.contactInfo=e.Contact?e.Contact.mobile:void 0,"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.smsInteractions.rows,{id:e.SmsInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.smsInteractions.rows,{id:e.SmsInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.smsInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.smsInteractions.rows=_.orderBy(g.smsInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.smsInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.smsInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.smsInteractions.rows,{id:e.SmsInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.smsInteractionsReloadTimeout)}a.$on("$destroy",function(){d.removeAllListeners("smsMessage:save"),d.removeAllListeners("smsMessage:update"),d.removeAllListeners("smsInteraction:save"),d.removeAllListeners("smsInteractionTags:save"),d.removeAllListeners("smsInteraction:update"),d.removeAllListeners("user_has_sms_interactions:save"),d.removeAllListeners("user_has_sms_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeSmsController",e)}(),function(){"use strict";function e(n,t,a,i,e,s,o,r){var l=this;function d(e){l.searchInProgress=!1,l.voiceCalls=e||{count:0,rows:[]}}function c(){l.searchInProgress=!0,l.query.offset=(l.query.page-1)*l.query.limit;var e={query:l.query};s.localStorage.setItem("motion2.home.voice:"+l.currentUser.id,JSON.stringify(e)),l.promise=a.voiceCallReport.get(l.query,d).$promise}l.currentUser=e.getCurrentUser(),l.voiceCalls={},l.table="voiceCalls",l.query={UserId:l.currentUser.id,fields:"id,type,uniqueid,tag,starttime,endtime,source,destination,userDisposition,userSecondDisposition,userThirdDisposition,note,duration,billableseconds,answertime",sort:"-updatedAt",limit:10,page:1,type:null},l.success=d,l.getVoiceCalls=c,l.onInit=function(){return a.tag.get({sort:"name"}).$promise.then(function(e){l.tags=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Type",key:"type",type:"select",label:"VOICE.SELECT_TYPE",customOptions:[{value:"internal",translate:"VOICE.INTERNAL"},{value:"inbound",translate:"VOICE.INBOUND"},{value:"outbound",translate:"VOICE.OUTBOUND"},{value:"dialer",translate:"VOICE.DIALER"},{value:null,translate:"VOICE.ALL"}]}]}).catch(function(e){i.error({title:"Init error",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}),l.tags={count:0,rows:[]}}).finally(function(){var e=s.localStorage.getItem("motion2.home.voice:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.merge(l.query,e.query))}catch(e){console.error(e)}else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};l.query.createdAt=n}l.isSearchBarVisible=!!l.query.filter,c()})},l.showDetails=function(e){n.show({controller:"AgentHomeVoiceDetailsController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/voice/details/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{call:e}})}}e.$inject=["$mdDialog","$document","api","toasty","Auth","$window","$scope","$timeout"],angular.module("app.dashboards").controller("AgentHomeVoiceController",e)}(),function(){"use strict";function e(e,n){this.call=n,this.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","call"],angular.module("app.dashboards").controller("AgentHomeVoiceDetailsController",e)}(),function(){"use strict";function e(a,n,i,s,t,o,r,l,e,d,c,m,u,p){var g=this;g.user=e.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.whatsappInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,WhatsappAccountId:[]},g.sectionColor="lime-A700",g.onInit=function(e,n){return g.license=e,g.setting=n,l.user.getWhatsappAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.whatsappAccounts=e||{count:0,rows:[]},l.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"WhatsappAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.whatsappAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"WhatsappAccountId",type:"multiselect",options:{route:{model:"user",action:"getWhatsappAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){r.resolve().then(function(){var e=m.get("motion2.home.whatsapp:"+g.user.id,"query");e&&(g.query=_.merge(g.query,e),g.query.sort&&0<=g.query.sort.indexOf("lastMessage")&&(g.query=_.omit(g.query,"sort")),g.query.includeAll=!0,g.isSearchBarVisible=!(g.query.search||!g.query.filter)),1===g.whatsappAccounts.rows.length&&(g.query.WhatsappAccountId=[g.whatsappAccounts.rows[0].id])}).catch(function(e){v.error(e)}).then(function(){y(g.query.page)}),d.on("whatsappInteraction:save",O),d.on("whatsappInteraction:update",O),d.on("whatsappInteractionTags:save",C),d.on("whatsappMessage:save",w),d.on("whatsappMessage:update",w),d.on("user_has_whatsapp_interactions:save",T),d.on("user_has_whatsapp_interactions:remove",I),d.on("userWhatsappAccount:save",f),d.on("userWhatsappAccount:remove",b),0<g.setting.whatsappInteractionsReloadTimeout&&R()})},g.success=E,g.getWhatsappInteractions=y,g.showWhatsappInteraction=function(e,n){a.$parent.vm.addInteractionTab("whatsapp",n)},g.downloadWhatsappInteraction=function(e,s,n){l.whatsappInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="whatsapp-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadWhatsappInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&l.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"whatsapp",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getWhatsappAccountLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.composeWhatsappInteraction=function(e,t){i.show({controller:"ComposeWhatsappInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/whatsapp/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return l.whatsappAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("whatsapp",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"WHATSAPPACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.whatsapp"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.whatsapp");function h(e){return{accounts:g.whatsappAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.WhatsappAccountId);u.addAccount("whatsapp",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.WhatsappAccountId);u.removeAccount("whatsapp",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.whatsappAccounts.rows,function(e){return{model:"whatsappAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.whatsappInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.whatsappInteractions=e||{count:0,rows:[]};for(var n=0;n<g.whatsappInteractions.rows.length;n+=1)S(g.whatsappInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=t.localStorage.getItem("motion2.home.whatsapp:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,t.localStorage.setItem("motion2.home.whatsapp:"+g.user.id,JSON.stringify(n)),g.promise=l.whatsappInteraction.get(g.query,E).$promise}function S(e){e.contactInfo=e.Contact?e.Contact.mobile:void 0,"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.whatsappInteractions.rows,{id:e.WhatsappInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.whatsappInteractions.rows,{id:e.WhatsappInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.whatsappInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.whatsappInteractions.rows=_.orderBy(g.whatsappInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.whatsappInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.whatsappInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.whatsappInteractions.rows,{id:e.WhatsappInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.whatsappInteractionsReloadTimeout)}a.$on("$destroy",function(){d.removeAllListeners("whatsappMessage:save"),d.removeAllListeners("whatsappMessage:update"),d.removeAllListeners("whatsappInteraction:save"),d.removeAllListeners("whatsappInteractionTags:save"),d.removeAllListeners("whatsappInteraction:update"),d.removeAllListeners("user_has_whatsapp_interactions:save"),d.removeAllListeners("user_has_whatsapp_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeWhatsappController",e)}(),function(){"use strict";function e(e,n){var t=this;t.setting={},t.messages={count:0,rows:[]},t.showInteraction=!1,t.init=function(e,n){t.setting=n,t.tab=e,t.tab.saved=!0},t.getTrustedURL=function(){return n.trustAsResourceUrl(t.tab.src)}}e.$inject=["$scope","$sce"],angular.module("app.dashboards").controller("AgentGeneralIframeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v){var h=this,f=25,b=1024*f*1024;function A(){var e=h.user.voicePause||h.user.chatPause||h.user.mailPause||h.user.openchannelPause||h.user.faxPause,n=!h.tab.interaction.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(t.body),clickOutsideToClose:n,escapeToClose:n,onRemoving:function(){h.user&&h.interaction.Account.mandatoryDisposition&&!e&&l.user.unpause({id:h.user.id}).$promise.catch(function(e){d.error(e.data?e.data.message:e.toString())})},locals:{user:h.user,channel:h.tab.channel,interaction:h.tab.interaction}}).then(function(e){h.tab.saved=Boolean(e),e&&a.$parent.$parent.$parent.vm.closeTab(h.tab)})}function E(e,n){h.tab.message=n,i.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:h.tab.message,type:e,interaction:h.interaction},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){if(e)if(e.message&&e.message.savedAsDraft)h.draft?p.update({id:h.draft.id,channel:"mail",account:h.account,message:e.message,contact:h.contact,interaction:h.interaction}):p.add({channel:"mail",account:h.account,message:e.message,contact:h.contact,interaction:h.interaction}),h.draft=p.getByInteraction(h.tab.interaction.id);else{var n=e;n&&S(n),n.Interaction&&h.interaction&&h.interaction.id&&(n.Interaction.id=h.interaction.id,l.mailInteraction.update(n.Interaction).$promise.then(function(e){e&&e.closed?(h.tab.saved=!0,h.interaction.closed=!0,A()):null!==n.Interaction.substatus&&(h.tab.saved=!0,h.tab.interaction.substatus=n.Interaction.substatus,a.$parent.$parent.$parent.vm.closeTab(h.tab))}).catch(function(e){d.error(e.data?e.data.message:e.toString())}))}}).finally(function(){h.tab.isDraft=!1})}function y(){"mail"!==h.tab.channel&&n(function(){var e=angular.element(t.find("md-content[name*='interaction-content-"+h.tab.id+"']"));e&&e[0]&&(e[0].scrollTop=e[0].scrollHeight)},0)}function S(i){if(i)return i["chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId"]=h.interaction["chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId"],i[_.capitalize(h.tab.channel)+"InteractionId"]=h.interaction.id,i.UserId=h.user.id,i.ContactId=h.interaction.ContactId,i.direction="out",i.secret=Boolean(h.tab.spy||i.secret),l[h.tab.channel+"Message"].save(i).$promise.then(function(e){if(e&&e.id&&!_.isEmpty(i.attachments)){for(var n=[],t=0;t<i.attachments.length;t++){var a=i.attachments[t];a.MailMessageId?n.push(l.attachment.clone({id:a.id},{name:a.name,basename:a.basename,type:a.type,MailMessageId:e.id}).$promise):n.push(l.attachment.update({id:a.id},{MailMessageId:e.id}).$promise)}return s.all(n)}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:SENDMESSAGE",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){"mail"===h.tab.channel&&i.isDraft&&(p.removeByInteraction(h.interaction.id),h.draft=null),h.tab.areaText="",y()})}function T(e){switch(h.tab.channel){case"mail":h.draft.content.originalMessage=e?_.find(h.interaction.Messages,["id",e]):h.interaction.Messages[h.interaction.Messages.length-1],E(h.draft.type,h.draft.content)}}function I(e){h.journeyIsLoading=!0;var n=_.merge(h.journeyOptions,{id:h.contact.id,offset:e||0});return g.get(h.journey,n).then(function(e){h.journey=e.journey,h.canLoadMoreJourney=e.loadMore}).finally(function(){h.journeyIsLoading=!1})}h.showFooter=!1,h.BTNLoadMore=0,h.showInteraction=!1,h.user=c.getCurrentUser(),h.detectBrowser=u.detectBrowser(),h.journey=[],h.acceptedMessages=[],h.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:b,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},h.ngFlow={flow:{}},h.selectedMailShowDetails={},h.selectedMailShowSystemMessage={},h.setting={},h.ctrlMethods={},h.embedOptions={fontSmiley:!0,sanitizeHtml:!0,emoji:!0,link:!0,linkTarget:"_blank"},h.journeyOptions=g.getQuery(),h.quickFilters=g.getQuickFilters(),h.init=function(e,n){h.tab=e,h.tab.saved=!0,h.tab.badges=0,h.setting=n||{},h.tab&&h.tab.channel&&h.tab.interaction&&(h.interaction=h.tab.interaction,l[h.tab.channel+"Interaction"].get({id:h.tab.interaction.id,includeAll:!0}).$promise.then(function(e){return e&&(h.interaction=e,h.tab.interaction=e),h.tab.saved=h.interaction.closed,h.queryMessage={id:h.interaction.id,includeAll:!0},"mail"===h.tab.channel?(h.queryMessage.sort="-id",h.queryMessage.offset=0,h.queryMessage.limit=3,h.queryMessage.inlineCss=!0):(h.queryMessage.sort="id",h.queryMessage.nolimit=!0),l[h.tab.channel+"Interaction"].getMessages(h.queryMessage).$promise}).then(function(e){return e&&(h.BTNLoadMore=e.count-h.queryMessage.limit),h.messages=e||{count:0,rows:[]},l["chat"===h.tab.channel?"chatWebsite":h.tab.channel+"Account"].get({id:h.interaction["chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId"]}).$promise}).then(function(e){if(h.account=e,h.tab.title=h.account.key||h.account.name,h.interaction.ContactId)return l.cmContact.get({id:h.interaction.ContactId}).$promise}).then(function(e){return e&&(h.contact=e),h.showInteraction=!0,h.contact?h.tab.title+=" - "+(h.user.privacyEnabled?v.mask(h.contact.firstName):h.contact.firstName):h.tab.title+=" - "+r.instant(h.tab.channel.toUpperCase()+".UNKNOWN"),l.user.get({fields:"id,fullname",nolimit:!0}).$promise}).then(function(e){h.users=e||{count:0,rows:[]},h.usersMap=_.mapValues(_.keyBy(h.users.rows,"id"),"fullname")}).then(function(){if(h.tab.channel&&h.interaction)return l.user["add"+_.upperFirst(h.tab.channel)+"Interactions"]({id:h.user.id,ids:[h.interaction.id]})}).then(function(){return l.mailSubstatus.get({sort:"name",nolimit:!0}).$promise}).then(function(e){h.subStatuses=e||{count:0,rows:[]}}).catch(function(){h.showInteraction=!0}).finally(function(){h.contact&&I(),function(){switch(h.user.role){case"admin":return h.downloadPermissions={attachments:!0,interactions:!0};case"agent":return h.downloadPermissions={attachments:h.user.downloadAttachments,interactions:h.user.downloadOmnichannelInteractions};case"user":l.userProfile.get({id:h.user.userProfileId,fields:"downloadAttachments,downloadOmnichannelInteractions"}).$promise.then(function(e){h.downloadPermissions={attachments:e.downloadAttachments,interactions:e.downloadOmnichannelInteractions}}).catch(function(){h.downloadPermissions={attachments:!1,interactions:!1}})}}(),function(){if(!h.tab.spy&&!h.interaction.closed){var t=[];if(h.messages.rows.forEach(function(e){if("in"===e.direction&&!e.read){var n=0===t.length;t.push(l[h.tab.channel+"Message"].accept({id:e.id,UserId:h.user.id,manual:n}).$promise),h.acceptedMessages.push(e.id)}}),"mail"===h.tab.channel){var e=_(h.interaction.Messages).filter({read:!1,direction:"in"}).differenceBy(h.messages.rows,"id").value();e.forEach(function(e){t.push(l.mailMessage.accept({id:e.id,UserId:h.user.id}).$promise),h.acceptedMessages.push(e.id)})}s.all(t)}}(),y(),m.on(h.tab.channel+"Message:save",h.onMessageSave),m.on(h.tab.channel+"Message:update",h.onMessageSave),m.on(h.tab.channel+"Interaction:save",h.onInteractionSave),m.on(h.tab.channel+"Interaction:update",h.onInteractionSave),m.on("user_has_"+h.tab.channel+"_interactions:save",h.onInteractionOpen),m.on("user_has_"+h.tab.channel+"_interactions:remove",h.onInteractionClose),h.tab.areaText=h.tab.areaText?h.tab.areaText:"",h.showFooter=!0,"mail"===h.tab.channel&&(h.draft=p.getByInteraction(h.tab.interaction.id),h.tab.isDraft&&(h.tab.interaction.closed?(p.removeByInteraction(h.tab.interaction.id),h.draft=null):T()))}))},h.getLabelByMessage=function(e){var n="loading...";if(e)return"in"===e.direction?e.Contact?e.Contact.firstName||"Anonymous":n:e.UserId?h.usersMap?h.usersMap[e.UserId]:n:"System"},h.openContact=function(e,n){try{h.tab&&!h.tab.spy&&a.$parent.$parent.$parent.vm.addContactTab(n||h.contact)}catch(e){d.error({title:"ERROR OPEN CONTACT",msg:"Unable to open the contact"})}},h.openInteraction=function(e){try{if(e.MailAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("mail",e);if(e.ChatWebsiteId)return a.$parent.$parent.$parent.vm.addInteractionTab("chat",e);if(e.SmsAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("sms",e);if(e.WhatsappAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("whatsapp",e);if(e.OpenchannelAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("openchannel",e);if(e.FaxAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("fax",e)}catch(e){d.error({title:"ERROR OPEN INTERACTION",msg:"Customer Journey can't open the interaction"})}},h.disposeInteraction=A,h.tagInteraction=function(){i.show({controller:"TagInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/tag/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,skipHide:Boolean(h.tab.spy),resolve:{tags:["apiResolver",function(e){return e.resolve("tag@get",{sort:"name",nolimit:!0,fields:"id,name,color"})}]},locals:{channel:h.tab.channel,interaction:h.tab.interaction}})},h.composeMailInteraction=function(n,e){if(e.inReplyTo){var t=_.find(h.messages.rows,{messageId:e.inReplyTo});if(!t)return l.mailMessage.get({messageId:e.inReplyTo}).$promise.then(function(e){E(n,e&&e.count?e.rows[0]:void 0)}).catch(function(e){d.error(e.data?e.data.message:e.toString()),E(n,void 0)});E(n,t)}else E(n,e)},h.composeFaxInteraction=function(e){var n={to:[]};n.to.push(h.contact.fax),i.show({controller:"ComposeFaxInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/fax/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0}).then(function(e){return l.faxAccount.send({id:h.account.id},e).$promise.then(function(e){d.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("fax",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else d.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()})})})},h.composeSmsInteraction=function(e,n){i.show({controller:"ComposeSmsInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/sms/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.composeWhatsappInteraction=function(e,n){i.show({controller:"ComposeWhatsappInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/whatsapp/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.composeChatInteraction=function(e,n){i.show({controller:"ComposeChatInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/chat/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.composeOpenchannelInteraction=function(e,n){i.show({controller:"ComposeOpenchannelInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/openchannel/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.transferLastMessage=function(){if(h.interaction){var e=_.findLast(h.messages.rows,function(e){return"in"===e.direction});e?i.show({controller:"TransferMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/transfer/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,interaction:h.interaction,message:e,channel:h.tab.channel},resolve:{agents:["apiResolver",function(e){var n={fields:"id,name",$id:{ne:h.user.id},role:"agent",online:!0,sort:"name",nolimit:!0};return n[h.tab.channel+"Pause"]=!1,e.resolve("user@get",n)}],queues:["apiResolver",function(e){return e.resolve(h.tab.channel+"Queue@get",{fields:"id,name",sort:"name",nolimit:!0})}]}}).then(function(e){h.tab.saved=Boolean(e),e&&a.$parent.$parent.$parent.vm.closeTab(h.tab)}):d.error({title:"Invalid transfer",msg:"Message not found!"})}},h.downloadMessage=function(s,e){h.tab.channel&&s.id&&l[h.tab.channel+"Message"].download({id:s.id,attachments:e}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=h.tab.channel+"-message"+s.id+".eml";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.downloadMessage.get",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.downloadInteraction=function(s,e){h.tab.channel&&s.id&&l[h.tab.channel+"Interaction"].download({id:s.id,attachments:e}).$promise.then(function(e){var n=[e.buffer],t=h.tab.channel+"-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.inteactionMessage.get",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.openDraft=T,h.createVidaooSession=function(e){var n={id:e.id,account:e.Account,contact:e.Contact};return l.chatInteraction.createVidaooSession(n).$promise.then(function(){d.success({title:"Start Video Call",msg:"Session properly created."})}).catch(function(){d.error({title:"Start Video Call",msg:"Unable to create session!"})})},h.reply=function(e,n){if(e&&13===e.keyCode&&e.shiftKey)return;if(e&&13!==e.keyCode)return;if(""===n.trim())return;S(function(e){var n={},t="chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId";n[t]=h.interaction[t].toString(),n[_.capitalize(h.tab.channel)+"InteractionId"]=h.interaction.id,("sms"===h.tab.channel||"whatsapp"===h.tab.channel)&&(n.phone=h.interaction.phone);e&&(n.UserId=h.user.id,n.ContactId=h.interaction.ContactId,n.body=e);return n}(n.trim()))},h.upload=function(){h.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},h.ngFlow.flow.upload()},h.fileAdded=function(e){if(e.size>b)return d.error({title:"File too big",msg:"The max allowed size is "+f+"MB"}),!1;return!0},h.fileSuccess=function(e,n){var t=JSON.parse(n),a=t.name;"chat"===h.tab.channel&&(a='<a href="'+(h.account.remote?h.account.remote:o.protocol()+"://"+o.host())+"/api/chat/interactions/"+h.interaction.id+"/attachment_download?attachId="+t.id+"&token="+h.account.token+'" target="_self">'+t.name+"</a>");S({body:a,AttachmentId:t.id})},h.onMessageSave=function(e){if(e&&h.interaction.id!=e[_.capitalize(h.tab.channel)+"InteractionId"])return;var n=!1;h.messages?n=_.find(h.messages.rows,{id:e.id}):h.messages={rows:[],count:0};n?_.merge(n,e):("mail"===h.tab.channel?h.messages.rows.unshift(e):h.messages.rows.push(e),y())},h.onInteractionSave=function(e){if(e&&h.interaction.id!==e.id)return;e.closed&&(h.tab.saved=!0);_.merge(h.interaction,e)},h.searchTextChange=function(n){var t=s.defer(),a=[],e={},i="chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId";return e.filter=n,e[i]=h.account.id,l.cannedAnswer.get(e).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},h.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:h.user,account:h.account,interaction:h.interaction,contact:h.interaction&&h.interaction.Contact?h.interaction.Contact:{}};""!==h.tab.areaText&&(h.tab.areaText+=" "),h.tab.areaText+=e(t),h.ctrlMethods.setText(h.tab.areaText)}catch(e){""!==h.tab.areaText&&(h.tab.areaText+=" "),h.tab.areaText+=n.value,h.ctrlMethods.setText(h.tab.areaText)}h.selectedItem=null,h.changeDisplayCannedAnswerInputValue()}},h.getMessagesAlignment=function(e){if(e.secret&&h.user.id!=e.UserId)return"in";switch(h.setting.messagesAlignment){case"left":return"in"==e.direction?e.direction:"out-left-aligned";case"right":return"in"==e.direction?"in-right-aligned":e.direction;default:return e.direction}},h.displayCannedAnswerInput=!1,h.changeDisplayCannedAnswerInputValue=function(){h.displayCannedAnswerInput=!h.displayCannedAnswerInput},h.setAs=function(e){h.tab.channel&&h.interaction&&h.interaction.id&&l[h.tab.channel+"Interaction"].update({id:h.interaction.id,substatus:e}).$promise.catch(function(e){d.error(e.data?e.data.message:e.toString())})},h.markAsUnread=function(){if(h.tab.channel&&h.interaction&&h.interaction.id)if(h.acceptedMessages.length)for(var e=0;e<h.acceptedMessages.length;e+=1)l[h.tab.channel+"Message"].update({id:h.acceptedMessages[e],read:!1,UserId:null});else for(var n=0;n<h.messages.rows.length;n+=1)if("in"===h.messages.rows[n].direction){h.messages.rows[n].UserId===h.user.id?l[h.tab.channel+"Message"].update({id:h.messages.rows[n].id,read:!1,UserId:null}):d.error({title:"You can't mark as unread",msg:"You are not the owner of the last message!"});break}h.tab.saved=!0,a.$parent.$parent.$parent.vm.closeTab(h.tab)},h.getAttachments=function(n){return l.attachment.get({MailMessageId:n.id}).$promise.then(function(e){e&&e.rows&&(n.attachments=e.rows)}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"ATTACHMENTS:GET",msg:e.data?JSON.stringify(e.data):e.toString()})})},h.getAttachment=function(i){return l.attachment.download({id:i.id}).$promise.then(function(e){if(e){var n=new Blob([e.buffer],{type:e.type}),t=document.createElement("a"),a=window.URL.createObjectURL(n);t.href=a,t.target="_self",t.download=i.name,document.body.appendChild(t),t.click(),setTimeout(function(){document.body.removeChild(t),window.URL.revokeObjectURL(a)},100)}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"ATTACHMENTS:GET",msg:e.data?JSON.stringify(e.data):e.toString()})})},h.htmlToPlaintext=function(e){return e?String(e).replace(/<[^>]+>/gm,""):""},h.onInteractionOpen=function(e){var n;h.interaction.id==e[_.upperFirst(h.tab.channel)+"InteractionId"]&&(h.interaction.Users&&(n=_.find(h.interaction.Users,{id:e.UserId})),n||h.interaction.Users.push({id:e.UserId}))},h.onInteractionClose=function(e){h.interaction.id==e[_.upperFirst(h.tab.channel)+"InteractionId"]&&h.interaction.Users&&_.remove(h.interaction.Users,{id:e.UserId})},h.getCustomerJourney=I,h.loadNextPage=function(){var t=s.defer();if(h.queryMessage)return h.queryMessage.offset=h.messages.rows.length,l[h.tab.channel+"Interaction"].getMessages(h.queryMessage).$promise.then(function(e){for(var n=0;n<e.rows.length;n+=1)h.messages.rows.push(e.rows[n]),h.interaction.closed||"in"!==e.rows[n].direction||e.rows[n].read||(l[h.tab.channel+"Message"].accept({id:e.rows[n].id,UserId:h.user.id}),h.acceptedMessages.push(e.rows[n].id));return 0<e.rows.length&&(h.BTNLoadMore=h.BTNLoadMore-e.rows.length),t.resolve(e)}).catch(function(e){return t.reject(e)});return t.reject()},h.interactionTimelineOptions={scrollEl:"#interaction-content"},h.loadMoreJourney=function(){return s(function(e){var n=h.journey.length;return e(I(n))})},h.journeyTimelineOptions={scrollEl:"#journey-content"},a.$on("$destroy",function(){m.removeAllListeners(h.tab.channel+"Message:save"),m.removeAllListeners(h.tab.channel+"Message:update"),m.removeAllListeners(h.tab.channel+"Interaction:save"),m.removeAllListeners(h.tab.channel+"Interaction:update"),m.removeAllListeners("user_has_"+h.tab.channel+"_interactions:save"),m.removeAllListeners("user_has_"+h.tab.channel+"_interactions:remove")})}function n(a){return{scope:{ngBindHtmlUnsafe:"="},template:"<div ng-bind-html='trustedHtml'></div>",link:function(t){t.updateView=function(){var e,n=_.replace(t.ngBindHtmlUnsafe,'<div id="xm-mail-content"','<a style="cursor:pointer" class="toggle-details md-accent-color" onclick="document.getElementById(\''+(e="xm-mail-content-"+Math.floor(9999*Math.random()+1))+"').style.display='block'; this.parentNode.removeChild(this)\">See More</a><div id=\""+e+'" style="display:none"');t.trustedHtml=a.trustAsHtml(n)},t.$watch("ngBindHtmlUnsafe",function(e){t.updateView(e)})}}}e.$inject=["$cookies","$timeout","$document","$scope","$mdDialog","$q","$location","$translate","api","toasty","Auth","socket","msUtils","draftManager","customerJourneyManager","privacyManager"],n.$inject=["$sce"],angular.module("app.dashboards").directive("ngBindHtmlUnsafe",n).controller("AgentGeneralInteractionController",e)}(),function(){"use strict";angular.module("app.dashboards").factory("Emojis",function(){return{watchEmbedData:!1,sanitizeHtml:!1,fontSmiley:!1,emoji:!0,link:!0,linkTarget:"_blank",pdf:{embed:!0},image:{embed:!0},audio:{embed:!0},basicVideo:!1,gdevAuth:"xxxxxxxx",video:{embed:!1,width:null,height:null,ytTheme:"dark",details:!1,thumbnailQuality:"medium",autoPlay:!0},twitchtvEmbed:!0,dailymotionEmbed:!0,tedEmbed:!0,dotsubEmbed:!0,liveleakEmbed:!0,ustreamEmbed:!0,soundCloudEmbed:!0,soundCloudOptions:{height:160,themeColor:"f50000",autoPlay:!1,hideRelated:!1,showComments:!0,showUser:!0,showReposts:!1,visual:!1,download:!1},spotifyEmbed:!0,tweetEmbed:!0,tweetOptions:{maxWidth:550,hideMedia:!1,hideThread:!1,align:"none",lang:"en"},code:{highlight:!0,lineNumbers:!1},codepenEmbed:!0,codepenHeight:300,jsfiddleEmbed:!0,jsfiddleHeight:300,jsbinEmbed:!0,jsbinHeight:300,plunkerEmbed:!0,githubgistEmbed:!0,ideoneEmbed:!0,ideoneHeight:300}})}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,ChatAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e.mobile&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.mobile&&(n+=e.lastName+" ");return n+="<"+e.mobile+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId)return l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,mobile"}).$promise.then(function(e){return e.rows});return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e.mobile;if(t=n,/^(\+|\d)[0-9]{7,16}$/.test(t))return n;var t;return d.error("Mobile "+n+" is not valid"),null},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeChatInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this,m=25,u=1024*m*1024;c.separatorKeys=[a.KEY_CODE.ENTER,a.KEY_CODE.COMMA,a.KEY_CODE.TAB],c.message={from:i.localstationid,to:_.isNil(s.to)||_.isEmpty(s.to)?[]:s.to,attachments:[]},c.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:u,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},c.ngFlow={flow:{}},c.send=function(e){1===c.message.attachments.length?c.message.to.length?(s.draft=void 0,t.hide({from:c.message.from,to:c.message.to,attach:c.message.attachments.length,attachments:c.message.attachments})):l.error("To is mandatory"):l.error("Attachment is mandatory")},c.upload=function(){c.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},c.ngFlow.flow.upload()},c.fileSuccess=function(e,n){try{(n=JSON.parse(n)).size=e.size,c.message.attachments.push(n)}catch(e){console.error(e)}},c.fileAdded=function(e){var n=["pdf","tif"];if(!_.includes(n,e.getExtension()))return l.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extensions: "+n.join()}),!1;if(e.size>u)return l.error({title:"File too big",msg:"The max allowed size is "+m+"MB"}),!1;return!0},c.getContact=function(e){var n="";e.firstName&&e.firstName!==e.fax&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.fax&&(n+=e.lastName+" ");return n+="<"+e.fax+">"},c.contactSearch=function(e){return i&&i.ListId?r.cmContact.get({ListId:i.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,fax"}).$promise.then(function(e){return e.rows}):[]},c.transformContact=function(e){var n=e;if(_.isObject(e))return e.fax;if(t=n,!/[&\/\\#,()$~%.'":;*?<>{}\s\\|a-zA-Z\pS!òàùè…_§°çéì-]/.test(t))return n;var t;return l.error("Fax "+n+" is not valid"),null},c.closeDialog=function(){s.draft=c.message,t.cancel()}}e.$inject=["$cookies","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q"],angular.module("app.dashboards").controller("ComposeFaxInteractionDialogController",e)}(),function(){"use strict";function e(n,e,i,t,a,s,o,r,l,d,c,m,u,p){var g=this,v=25,h=1024*v*1024;g.currentUser=m.getCurrentUser(),g.secret="note"===r,g.hiddenCC=!0,g.hiddenBCC=!0,g.verifySmtp=!0,g.errors=[],g.separatorKeys=[t.KEY_CODE.ENTER,t.KEY_CODE.COMMA,t.KEY_CODE.TAB],g.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,MailAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},g.selectedItemChange=function(n){if(n&&n.value&&g.ckEditorInstance)try{var e=_.template(n.value),t={user:g.currentUser,account:s,interaction:u,contact:u&&u.Contact?u.Contact:{}};g.ckEditorInstance.insertHtml(e(t))}catch(e){console.error(e),g.ckEditorInstance.insertHtml(n.value)}document.getElementById("html-area").focus(),g.selectedItem=null},g.onReadyEditor=function(e){try{g.ckEditorInstance=CKEDITOR.instances["html-area"]}catch(e){console.error("Unable to get Html Editor instance",e)}},_.templateSettings.interpolate=/{{([\s\S]+?)}}/g,g.fromTemplate=_.template("{{ name }} <{{ email }}>"),g.replyTemplate=_.template("On {{ date }}, at {{ time }}, {{ from }} wrote:"),g.forwardTemplate=_.template("Begin forwarded message:<br><br><strong>From:</strong> {{ from }}<br><strong>Subject:</strong> {{ subject }}<br><strong>Date:</strong> {{ date }}, at {{ time }}<br><strong>To:</strong> {{ to }}"),g.message={from:g.fromTemplate({name:s.name,email:s.email||s.Smtp.user}),to:[],cc:[],bcc:[],body:S(),type:r,attachments:[],showLastMessage:!0},g.draft=null,g.ckeditor={skin:"office2013",startupFocus:!0,language:"en",allowedContent:!0,extraPlugins:"font,colorbutton,autogrow,autoembed,autocorrect,googlethisterm,pastebase64",toolbarGroups:[{name:"styles",groups:["styles"]},{name:"clipboard",groups:["undo"]},{name:"colors",groups:["colors"]},{name:"basicstyles",groups:["basicstyles"]},{name:"paragraph",groups:["list","indent","align"]}],autoGrow_onStartup:!0,autoGrow_minHeight:g.secret?160:300,autoGrow_maxHeight:e.innerHeight-400,autocorrect_enabled:!0,disableNativeSpellChecker:!1,enterMode:CKEDITOR.ENTER_BR,font_defaultLabel:s.fontFamily?s.fontFamily.split(",")[0]:"Arial",fontSize_defaultLabel:s.fontSize||"12",removePlugins:"magicline"};for(var f=[],b=8;b<=72;b++)f.push(b+"/"+b+"pt");g.ckeditor.fontSize_sizes=f.join(";"),g.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:h,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},g.ngFlow={flow:{}},g.reply=function(e){angular.isDefined(o)&&(g.message.type="reply",g.message.to="in"===o.direction?o.from.split(","):o.to.split(","),g.message.subject=_.startsWith(o.subject,"Re:")?o.subject:"Re: "+o.subject,g.message.inReplyTo=o.messageId,g.message.body=S(),g.message.attachments=[],e&&o.cc&&(g.hiddenCC=!1,g.message.cc=o.cc.split(",")),g.message.showLastMessage=!1)},g.newMail=function(){angular.isDefined(o)&&(g.message.type="new",g.message.to=o.to?o.to.split(","):[])},g.forward=function(){if(angular.isDefined(o)){if(g.message.type="forward",g.message.subject=_.startsWith(o.subject,"Fwd:")?o.subject:"Fwd: "+o.subject,g.message.body=S(),o.Attachments&&o.Attachments.length)for(var e=0;e<o.Attachments.length;e++)g.message.attachments.push(o.Attachments[e]);g.message.showLastMessage=!1}},g.editDraft=function(){g.isDraft=!0,angular.isDefined(o)&&(o.savedAsDraft=!1,g.message=angular.copy(o),_.isEmpty(g.message.cc)||(g.hiddenCC=!1),_.isEmpty(g.message.bcc)||(g.hiddenBCC=!1))},g.send=function(e,n,t){if(!A&&g.message.to&&g.message.body)if(g.message.to.length)if(_.isEmpty(g.message.subject)){var a=i.confirm({skipHide:!0}).title("Warning").textContent("This message has no subject. Are you sure you want to send it?").ariaLabel("Warning").targetEvent(e).ok("Send Anyway").cancel("Cancel");i.show(a).then(function(){E(n,t)})}else E(n,t);else d.error("To is mandatory");A=!1},g.note=function(){g.type="note",g.secret=!0,g.message.body='<div style="font-family:'+s.fontFamily+";font-size:"+s.fontSize+'pt"><p></p></div>'},g.addNote=function(){g.message.body&&i.hide({secret:!0,body:g.message.body,attach:g.message.attachments.length,attachments:g.message.attachments})},g.upload=function(e){g.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+n.get("motion.token")},g.ngFlow.flow.upload()},g.fileSuccess=function(e,n){try{(n=JSON.parse(n)).size=e.size,g.message.attachments.push(n)}catch(e){console.error(e)}},g.removeAttachment=function(e){g.message.attachments=_.reject(g.message.attachments,{id:e.id}),e.MailMessageId||l.attachment.delete({id:e.id}).$promise.catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.attachment.delete",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.fileAdded=function(e){if(e.size>h)return d.error({title:"File too big",msg:"The max allowed size is "+v+"MB"}),!1;return!0},g.getContact=function(e){var n="";e.firstName&&e.firstName!==e.email&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.email&&(n+=e.lastName+" ");return n+="<"+e.email+">"},g.contactSearch=function(e){return s&&s.ListId?l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,email"}).$promise.then(function(e){return e.rows}):[]},g.transformContact=function(e,n){if(_.isObject(e))return(g.contact=e).email;if(_.isString(e)){if(y(e))return g.contact={email:e},e;for(var t=e.split(","),a=0;a<t.length;a+=1)y(t[a])?_.isArray(n)&&_.indexOf(n,t[a])<0&&n.push(t[a]):d.error("Email "+t[a]+" is not valid");return g.contact={email:e.split(",")[0]},null}return d.error("Email field is not valid"),null},g.saveDraft=function(){g.message.savedAsDraft=!0,g.draft=p.getByInteraction(u.id);var e={account:s,message:g.message,contact:g.contact,interaction:u};if(g.draft&&!g.isDraft){var n=i.confirm({skipHide:!0}).title(a.instant("DASHBOARDS.DRAFT_SAVE_WARNING_TITLE")).content(a.instant("DASHBOARDS.DRAFT_SAVE_WARNING_MESSAGE")).ariaLabel("Save draft").ok(a.instant("DASHBOARDS.OVERWRITE")).cancel(a.instant("DASHBOARDS.CANCEL"));i.show(n).then(function(){i.hide(e)})}else i.hide(e)},g.closeDialog=function(){i.cancel()},g.loadLastMessage=function(){g.message.body+=T(g.message.type)};var A=!(g.keyPress=function(e){13===e.keyCode&&(A=!0)});switch(r){case"reply":g.reply(!1);break;case"replyAll":g.reply(!0);break;case"forward":g.forward();break;case"draft":g.editDraft();break;case"new":g.newMail();break;case"note":g.note()}function E(e,n){var t={from:g.message.from,to:g.message.to.join(","),cc:g.message.cc.join(","),bcc:g.message.bcc.join(","),subject:g.message.subject,body:g.message.showLastMessage?g.message.body:g.message.body+T(g.message.type),inReplyTo:g.message.inReplyTo,attach:g.message.attachments.length,attachments:g.message.attachments,Interaction:{lastMsgDirection:"out",substatus:n},isDraft:g.isDraft};t.html='<div id="xm-mail-content">'+_.replace(t.body,'<div id="xm-mail-content"',"<div")+"</div>",e&&(t.Interaction.closed=!0),i.hide(t)}function y(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)}function S(){return'<div style="font-family:'+s.fontFamily+";font-size:"+s.fontSize+'pt">'+function(){if(_.isNil(s.template))return"";try{return _.template(s.template)({user:g.currentUser,account:s,interaction:u,contact:u&&u.Contact?u.Contact:{}})}catch(e){return console.error(e),""}}()+"</div>"}function T(e){var n='<div id="xm-mail-content"><blockquote type="cite">';switch(e){case"reply":case"replyAll":n+=g.replyTemplate({date:moment(o.createdAt).format("D MMM YYYY")||"",time:moment(o.createdAt).format("HH:mm")||"",from:_.escape(o.from)||""});break;case"forward":n+=g.forwardTemplate({date:moment(o.createdAt).format("D MMM YYYY")||"",time:moment(o.createdAt).format("HH:mm")||"",from:_.escape(o.from)||"",to:_.escape(o.to)||"",subject:_.escape(o.subject)||""})}var t,a,i=g.message.showLastMessage&&o.originalMessage||g.isDraft?o.originalMessage.body:o.body;return n+="<br><br>",n+=(t=i?_.replace(i,'<div id="xm-mail-content"',"<div"):"",(a=t.match(/\<body[^>]*\>([^]*)\<\/body/m))?a[1]:t),n+="</blockquote></div>",e?n:""}l.mailSubstatus.get({nolimit:!0}).$promise.then(function(e){g.subStatuses=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}),g.secret||l.mailAccount.verifySmtp({id:s.id}).$promise.catch(function(e){g.verifySmtp=!1,g.errors.push({message:e.data,type:e.status}),g.errors.push({message:"You can't reply or send an email. Please contact the administrator!",type:"500"})})}e.$inject=["$cookies","$window","$mdDialog","$mdConstant","$translate","account","message","type","api","toasty","$q","Auth","interaction","draftManager"],angular.module("app.dashboards").controller("ComposeMailInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,OpenchannelAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e[s.mapKey]&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e[s.mapKey]&&(n+=e.lastName+" ");return n+="<"+e[s.mapKey]+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId){var n="firstName,lastName,phone,mobile";return s.mapKey&&(n+=","+s.mapKey),l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:n}).$promise.then(function(e){return e.rows})}return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e[s.mapKey];return n},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeOpenchannelInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,SmsAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e.mobile&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.mobile&&(n+=e.lastName+" ");return n+="<"+e.mobile+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId)return l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,mobile"}).$promise.then(function(e){return e.rows});return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e.mobile;if(t=n,/^(\+|\d)[0-9]{7,16}$/.test(t))return n;var t;return d.error("Mobile "+n+" is not valid"),null},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeSmsInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,WhatsappAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e.mobile&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.mobile&&(n+=e.lastName+" ");return n+="<"+e.mobile+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId)return l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,mobile"}).$promise.then(function(e){return e.rows});return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e.mobile;if(t=n,/^(\+|\d)[0-9]{7,16}$/.test(t))return n;var t;return d.error("Mobile "+n+" is not valid"),null},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeWhatsappInteractionDialogController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.errors=[],r.dispositions=[],r.interaction=angular.copy(e),r.interaction.disposition||(r.interaction.disposition=null),r.channel=i,r.apiRoute=r.channel+"Interaction",r.apiAccountRoute=r.channel+("chat"===r.channel?"Website":"Account"),r.accountProperty=_.capitalize(r.channel)+("chat"===r.channel?"Website":"Account")+"Id",r.firstLevelDisposition=null,r.mandatoryDisposition=!1,r.mandatoryDispositionPause="",r.wasUserInPause=s.voicePause||s.chatPause||s.mailPause||s.openchannelPause||s.faxPause,r.onInit=function(){var n=[],t={fields:"id,name,level,ParentId",sort:"name",nolimit:!0};t[r.accountProperty]=e[r.accountProperty],a[r.apiAccountRoute].get({id:e[r.accountProperty]}).$promise.then(function(e){return r.mandatoryDisposition=e.mandatoryDisposition,r.mandatoryDisposition&&(r.mandatoryDispositionPause=e.mandatoryDispositionPause.name),a.disposition.get(t).$promise}).then(function(e){return e.rows.length&&(n=_.concat(n,e.rows)),a.disposition.get({MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}).$promise}).then(function(e){e.rows.length&&(n=_.concat(n,e.rows))}).catch(function(e){console.error(e)}).finally(function(){r.dispositions=_.orderBy(n,["name"],["asc"]),r.mandatoryDisposition&&!r.wasUserInPause&&a.user.pause({id:s.id,type:r.mandatoryDispositionPause||"DEFAULT PAUSE"}).$promise.then(function(e){}).catch(function(e){console.error(e)})})},r.onDispositionChange=function(e){"first"===e?(r.anySecondLevelDisposition=!!r.firstLevelDisposition&&_.some(r.dispositions,["ParentId",r.firstLevelDisposition.id]),r.firstLevelDisposition||(r.secondLevelDisposition=void 0)):"second"===e&&(r.anyThirdLevelDisposition=_.some(r.dispositions,["ParentId",r.secondLevelDisposition.id]))},r.clearDispositionSelection=function(e){"second"===e?(r.secondLevelDisposition=void 0,r.thirdLevelDisposition=void 0):"third"===e&&(r.thirdLevelDisposition=void 0)},r.saveDisposition=function(){r.errors=[],r.interaction.UserId=s.id,r.interaction.closed=!0,r.interaction.closeReason="agent",r.interaction.disposition=r.firstLevelDisposition?r.firstLevelDisposition.name:null,r.interaction.secondDisposition=r.secondLevelDisposition?r.secondLevelDisposition.name:void 0,r.interaction.thirdDisposition=r.thirdLevelDisposition?r.thirdLevelDisposition.name:void 0,a[r.apiRoute]?a[r.apiRoute].update(_.pick(r.interaction,["MailAccountId","FaxAccountId","SmsAccountId","WhatsappAccountId","ChatWebsiteId","OpenchannelAccountId","closed","closeReason","disposition","secondDisposition","thirdDisposition","id","note","UserId"])).$promise.then(function(e){r.interaction=e,"mail"===r.channel&&o.removeByInteraction(r.interaction.id),t.success({title:"Interaction properly closed!",msg:"Interaction has been closed!"})}).then(function(){l(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.variable.update"}];for(var n=0;n<e.data.errors.length;n++)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})}):l(!1)},r.closeDialog=l}e.$inject=["$mdDialog","toasty","api","interaction","channel","user","draftManager"],angular.module("app.dashboards").controller("DisposeInteractionDialogController",e)}(),function(){"use strict";function e(n,t,e,a,i,s){var o=this;function r(e){n.hide(e)}o.errors=[],o.tags=s,o.interaction=angular.copy(a),o.interaction.Tags=_.map(o.interaction.Tags,function(e){return{id:e.id,name:e.name,color:e.color}}),o.channel=i,o.autocompleteRequireMatch=!0,o.saveTag=function(){{if(o.errors=[],e[o.apiRoute])return e[o.apiRoute].addTags({id:o.interaction.id,ids:_.map(o.interaction.Tags,"id")}).$promise.then(function(){t.success({title:"Interaction properly tagged!",msg:"Interaction has been tagged!"}),a.Tags=o.interaction.Tags,r(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})});r(!1)}},o.closeDialog=r,o.apiRoute=o.channel+"Interaction"}e.$inject=["$mdDialog","toasty","api","interaction","channel","tags"],angular.module("app.dashboards").controller("TagInteractionDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r,l,d){var c=this;function m(e){n.hide(e)}c.channel=s.toLowerCase(),c.message=o,c.account=r,c.agents=l,c.queues=d,c.transfer={id:0,type:c.account.queueTransfer?"queue":"agent"},c.onTransfer=function(){m(!0),e(function(){var e="agent"===c.transfer.type?"agentNotify":c.channel+"QueueNotify";return a.rpc[e]({id:c.transfer.id,messageId:c.message.id,channel:c.channel}).$promise.then(function(){i.success({title:t.instant("DASHBOARDS.INFO"),msg:"queue"===c.transfer.type?t.instant("DASHBOARDS.NOTIFICATIONS.TRANSFER_QUEUE_EXECUTED"):t.instant("DASHBOARDS.NOTIFICATIONS.TRANSFER_AGENT_EXECUTED")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.rpc.notify"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.rpc.notify",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},5e3)},c.closeDialog=m}e.$inject=["$mdDialog","$timeout","$translate","api","toasty","channel","message","account","agents","queues"],angular.module("app.dashboards").controller("TransferMessageDialogController",e)}(),function(){"use strict";function e(i,m,s,e,u,o,r,t,n,a,l){var p=this;function d(){try{i.$parent.$parent.$parent.vm.updateLocalStorage()}catch(e){o.error({title:"ERROR UPDATE LOCAL TABS",msg:"Error updating locally stored tabs"})}}function c(t,e){var n,a,l=[],d=[],c=r.getCurrentUser();(n=c,a=m.defer(),p.project.sendUnpauseOnSubmit?u.user.unpause({id:n.id}).$promise.then(function(e){a.resolve()}).catch(function(e){console.log("err"),a.resolve()}):a.resolve(),a.promise).then(function(){return u.jscriptySessionReport.save({starttime:p.starttime,membername:p.call&&p.call.membername?p.call.membername:c.name,calleridname:p.call&&p.call.calleridname?p.call.calleridname:void 0,calleridnum:p.call&&p.call.calleridnum?p.call.calleridnum:void 0,queue:p.call&&p.call.queue?p.call.queue:void 0,uniqueid:p.call&&p.call.uniqueid?p.call.uniqueid:void 0,VoiceQueueId:p.call&&p.call["xmd-voicequeueid"]?p.call["xmd-voicequeueid"]:void 0,ProjectId:p.project&&p.project.id?p.project.id:void 0,projectname:p.project&&p.project.name?p.project.name:void 0,ContactId:p.contact&&p.contact.id?p.contact.id:void 0,completed:e}).$promise}).then(function(e){if(e)for(var n=p.getResponseSheetHeaders(),t=p.getResponseSheetRow(),a=p.getQuestionWithResponseList(),i=0;i<n.length;i+=1)if(!_.isEmpty(String(t[i]))){try{l.push(u.jscriptyQuestionReport.save({question:n[i],answer:"date"===a[i].type?moment(String(t[i])).format("YYYY-MM-DD"):"time"===a[i].type?moment(String(t[i])).format("HH:mm"):String(t[i]),questionId:a[i].id,membername:p.call&&p.call.membername?p.call.membername:c.name,calleridname:p.call&&p.call.calleridname?p.call.calleridname:void 0,calleridnum:p.call&&p.call.calleridnum?p.call.calleridnum:void 0,queue:p.call&&p.call.queue?p.call.queue:void 0,uniqueid:p.call&&p.call.uniqueid?p.call.uniqueid:void 0,SessionId:e.id,ProjectId:p.project.id,projectname:p.project.name}))}catch(e){console.error("Unable to convert question",e)}for(var s=String(t[i]).split(";"),o=0;o<s.length;o+=1){var r=s[o].trim();try{d.push(u.jscriptyAnswerReport.save({question:n[i],questionId:a[i].id,answer:"date"===a[i].type?moment(r).format("YYYY-MM-DD"):"time"===a[i].type?moment(r).format("HH:mm"):r,membername:p.call&&p.call.membername?p.call.membername:c.name,calleridname:p.call&&p.call.calleridname?p.call.calleridname:void 0,calleridnum:p.call&&p.call.calleridnum?p.call.calleridnum:void 0,queue:p.call&&p.call.queue?p.call.queue:void 0,uniqueid:p.call&&p.call.uniqueid?p.call.uniqueid:void 0,SessionId:e.id,ProjectId:p.project.id,projectname:p.project.name}))}catch(e){console.error("Unable to convert answer",e)}}}return m.all(l).then(function(){return m.all(d).then(function(){return e})})}).then(function(e){e?t.resolve(!0):t.reject()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()});t.reject()})}p.formViewer={},p.showResetButton=!0,p.showIncompleteSubmitButton=!1,p.detectBrowser=l.detectBrowser(),p.onSubmit=function(e,n){var t=m.defer();if(n){var a=s.confirm().title("Would you like to save your survey?").textContent("").ariaLabel("survey").targetEvent(e).ok("YES").cancel("NO");s.show(a).then(function(){c(t,!1)},function(){t.resolve()})}else c(t,!0);return t.promise.then(function(e){e&&(o.success({title:"Session saved",msg:"Your survey session has been properly saved!"}),function(e){try{i.$parent.$parent.$parent.vm.removeTab(e)}catch(e){o.error({title:"ERROR REMOVE TAB",msg:"Error while removing tab"})}}(p.tab))}).catch(function(e){o.error({title:"Session save error",msg:"There has been an error while trying to save your survey session!"})})},p.openContact=function(e,n){try{i.$parent.$parent.$parent.vm.addContactTab(n)}catch(e){o.error({title:"ERROR OPEN CONTACT",msg:"Jscripty can't open the contact"})}},p.isJsonString=function(e){if(_.isNil(e))return!1;try{JSON.parse(e)}catch(e){return!1}return!0},p.getResponseSheet=function(){return e.getResponseSheet(p.project.formData,p.project.responseData,!1)},p.getResponseSheetRow=function(){return e.getResponseSheetRow(p.project.formData,p.project.responseData)},p.getResponseSheetHeaders=function(){return e.getResponseSheetHeaders(p.project.formData,!1)},p.getQuestionWithResponseList=function(){return e.getQuestionWithResponseList(p.project.formData,p.project.responseData)},p.init=function(e){p.tab=e,p.tab&&(p.call=p.tab.call,p.starttime=p.tab.openedAt,p.contact=p.tab.contact,p.project=p.tab.project,p.project&&(_.isObjectLike(p.project.formData)?p.project.formData=p.project.formData:p.isJsonString(p.project.formData)?p.project.formData=JSON.parse(p.project.formData):p.project.formData=void 0,p.project.responseData=p.project.responseData||{},void 0!==p.project.currentPage&&a(function(){n.$broadcast("mwForm.pageEvents.changePage",{page:p.project.currentPage})}),i.$on("mwForm.pageEvents.pageCurrentChanged",function(e,n){if(n.currentPage&&(p.project.currentPage=n.currentPage.number-1,d(),p.project.enableUncompleteSave&&(1<=n.currentPage.number&&n.currentPage.number<p.project.formData.pages.length?p.showIncompleteSubmitButton=!0:p.showIncompleteSubmitButton=!1),p.project.formData&&p.project.formData.pages))for(var t=0,a=p.project.formData.pages.length;t<a;t++)if(n.currentPage.number<t+1&&p.project.formData.pages[t].elements)for(var i=0,s=p.project.formData.pages[t].elements.length;i<s;i++)"question"===p.project.formData.pages[t].elements[i].type&&p.project.formData.pages[t].elements[i].question&&delete p.project.responseData[p.project.formData.pages[t].elements[i].question.id]})))},p.resetViewer=function(e){if(p.formViewer.reset){var n=s.confirm().title(t.instant("JSCRIPTY.DO_YOU_WANT_TO_RESET_SESSION")).content(t.instant("JSCRIPTY.ALL_SURVEY_DATA_WILL_BE_LOST")).textContent("").ariaLabel("survey").targetEvent(e).ok(t.instant("JSCRIPTY.YES")).cancel(t.instant("JSCRIPTY.NO"));s.show(n).then(function(){p.showIncompleteSubmitButton=!1,p.project.currentPage=void 0,d(),p.formViewer.reset()})}}}e.$inject=["$scope","$q","$mdDialog","mwFormResponseUtils","api","toasty","Auth","$translate","$rootScope","$timeout","msUtils"],angular.module("app.dashboards").controller("AgentGeneralJscriptyController",e)}(),function(){"use strict";function e(t,a,e,n,i){var s=this;function o(){return function(e){if(404===e.status)a.info({title:t.instant("DASHBOARDS.ATTENTION"),msg:t.instant("DASHBOARDS.ACCEPT_ELSEWHERE")});else if(e.data&&e.data.errors&&e.data.errors.length){s.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelMessage.accept",msg:e.data?JSON.stringify(e.data.message):e.toString()})}}s.notification=e,s.user=i.getCurrentUser(),s.accept=function(e){{if(n[s.notification.channel+"Message"])return n[s.notification.channel+"Message"].accept({id:s.notification.id,UserId:s.user.id,manual:!0}).$promise.then(function(e){a.success({title:"Message properly accepted!",msg:"Message has been accepted!"})}).catch(o());a.error({title:"API:ERROR",msg:"API accept message not found: "+s.notification.channel+"Message"})}},s.reject=function(e){{if(n[s.notification.channel+"Message"])return n[s.notification.channel+"Message"].reject({id:s.notification.id,UserId:s.user.id}).$promise.then(function(e){a.success({title:"Message properly rejected!",msg:"Message has been rejected!"})}).catch(o());a.error({title:"API:ERROR",msg:"API reject message not found: "+s.notification.channel+"Message"})}}}e.$inject=["$translate","toasty","notification","api","Auth"],angular.module("app.dashboards").controller("NotificationController",e)}(),function(){"use strict";angular.module("app.dashboards").controller("AgentGeneralPopupController",function(){var n=this;n.init=function(e){n.tab=e,n.tab&&(n.tab.saved=!0,n.html=n.tab.html)}})}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&"abandoned"===e.disposition?(i.inbound.abandoned+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)):e.closed&&!e.UserId&&e.disposition?(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)):e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.chatWebsites,{id:_.toNumber(e.ChatWebsiteId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.chatWebsites=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveChatInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateChatInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("chatInteraction:save",i.onSaveChatInteraction),n.on("chatInteraction:update",i.onUpdateChatInteraction),function(){if(0<Object.keys(i.chatWebsites).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("chatInteraction:save"),n.removeAllListeners("chatInteraction:update")})}e.$inject=["$scope","socket","chatInteractions","chatWebsites"],angular.module("app.dashboards").controller("UserChatDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r){var l=this;function d(){s({queues:l.outboundQueues,rpcQueues:l.rpcQueues}).then(function(e){l.inbound=e})}function c(){o({rpcCampaigns:l.rpcCampaigns}).then(function(e){l.ivr=e})}l.outboundQueues=a?_.keyBy(a.rows?a.rows:[],"id"):{},l.rpcQueues=i?_.keyBy(i.rows?i.rows:[],"id"):{},l.rpcCampaigns=r?_.keyBy(r.rows?r.rows:[],"id"):{},l.ivr={originated:0,limitCalls:0},l.inbound={waiting:0,talking:0,pTalking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0,outboundDropCallsDayCallersExit:0,outboundDropCallsDayTimeout:0},l.onSaveQueue=function(e){l.outboundQueues[e.id]&&l.rpcQueues[e.id]&&(l.rpcQueues[e.id]=e)},l.onSaveCampaign=function(e){l.rpcCampaigns[e.id]&&(l.rpcCampaigns[e.id]=e)},t.onWithoutApply("voice_queue:save",l.onSaveQueue),l.interval=n(function(){d(),c()},999),t.onWithoutApply("campaign:save",l.onSaveCampaign),d(),c(),e.$on("$destroy",function(){t.removeListener("voice_queue:save",l.onSaveQueue),t.removeAllListeners("campaign:save"),l.interval&&n.cancel(l.interval)})}e.$inject=["$scope","$interval","socket","outboundQueues","rpcQueues","initializeRealtimeQueue","initializeRealtimeCampaign","rpcCampaigns"],angular.module("app.dashboards").controller("UserVoiceDashboardDialerController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.faxAccounts,{id:_.toNumber(e.FaxAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.faxAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveFaxInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateFaxInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("faxInteraction:save",i.onSaveFaxInteraction),n.on("faxInteraction:update",i.onUpdateFaxInteraction),function(){if(0<Object.keys(i.faxAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("faxInteraction:save"),n.removeAllListeners("faxInteraction:update")})}e.$inject=["$scope","socket","faxInteractions","faxAccounts"],angular.module("app.dashboards").controller("UserFaxDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.mailAccounts,{id:_.toNumber(e.MailAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.mailAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveMailInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateMailInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("mailInteraction:save",i.onSaveMailInteraction),n.on("mailInteraction:update",i.onUpdateMailInteraction),function(){if(0<Object.keys(i.mailAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("mailInteraction:save"),n.removeAllListeners("mailInteraction:update")})}e.$inject=["$scope","socket","mailInteractions","mailAccounts"],angular.module("app.dashboards").controller("UserMailDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.openchannelAccounts,{id:_.toNumber(e.OpenchannelAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.openchannelAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveOpenchannelInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateOpenchannelInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("openchannelInteraction:save",i.onSaveOpenchannelInteraction),n.on("openchannelInteraction:update",i.onUpdateOpenchannelInteraction),function(){if(0<Object.keys(i.openchannelAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("openchannelInteraction:save"),n.removeAllListeners("openchannelInteraction:update")})}e.$inject=["$scope","socket","openchannelInteractions","openchannelAccounts"],angular.module("app.dashboards").controller("UserOpenchannelDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.smsAccounts,{id:_.toNumber(e.SmsAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.smsAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveSmsInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateSmsInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("smsInteraction:save",i.onSaveSmsInteraction),n.on("smsInteraction:update",i.onUpdateSmsInteraction),function(){if(0<Object.keys(i.smsAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("smsInteraction:save"),n.removeAllListeners("smsInteraction:update")})}e.$inject=["$scope","socket","smsInteractions","smsAccounts"],angular.module("app.dashboards").controller("UserSmsDashboardGeneralController",e)}(),function(){"use strict";function e(t){var i=[],s=function(){var t=i[0],a={waiting:0,talking:0,pTalking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0,originated:0,outboundDropCallsDayCallersExit:0,outboundDropCallsDayTimeout:0};_.forIn(t.queues,function(e,n){t.rpcQueues[n]&&(a.waiting+=t.rpcQueues[n].waiting||0,a.talking+=(t.rpcQueues[n].talking||0)+(t.rpcQueues[n].pTalking||0),a.answered+=t.rpcQueues[n].answered||0,a.abandoned+=t.rpcQueues[n].abandoned||0,a.sumHoldTime+=t.rpcQueues[n].sumHoldTime||0,a.sumBillable+=t.rpcQueues[n].sumBillable||0,a.total+=t.rpcQueues[n].total||0,a.originated+=t.rpcQueues[n].originated||0,a.outboundDropCallsDayCallersExit+=t.rpcQueues[n].outboundDropCallsDayCallersExit||0,a.outboundDropCallsDayTimeout+=t.rpcQueues[n].outboundDropCallsDayTimeout||0)});var e=a.total-a.answered-a.abandoned;a.unmanaged=0<e?e:0,a.avgHoldTime=Math.round(0<a.total?a.sumHoldTime/a.total:0),a.avgHoldTime=new Date(1e3*a.avgHoldTime).toISOString().substr(11,8),a.avgTalkTime=Math.round(0<a.answered?a.sumBillable/a.answered:0),a.avgTalkTime=new Date(1e3*a.avgTalkTime).toISOString().substr(11,8),a.answerRate=Math.round((0<a.total?a.answered/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.abandonRate=Math.round((0<a.total?a.abandoned/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.outboundDropRate=Math.round((0<a.total?a.outboundDropCallsDayTimeout/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.outboundAbandonRate=Math.round((0<a.total?a.outboundDropCallsDayCallersExit/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.outboundanswerRate=0<100-a.outboundDropRate-a.outboundAbandonRate&&a.total?100-a.outboundDropRate-a.outboundAbandonRate:0,i.shift(),t.defer.resolve(a),0<i.length&&s()};return function(e){var n=t.defer();return i.push({queues:e.queues,rpcQueues:e.rpcQueues,defer:n}),1===i.length&&s(),n.promise}}function n(t){var i=[],s=function(){var t=i[0],a={originated:0,limitCalls:0};_.forIn(t.rpcCampaigns,function(e,n){t.rpcCampaigns[n]&&(a.originated+=t.rpcCampaigns[n].originated||0,a.limitCalls+=t.rpcCampaigns[n].limitCalls||0)}),i.shift(),t.defer.resolve(a),0<i.length&&s()};return function(e){var n=t.defer();return i.push({rpcCampaigns:e.rpcCampaigns,defer:n}),1===i.length&&s(),n.promise}}function t(t,a,e){var i=this;i.license=e,i.onInit=function(){if(i.hasDashboardPermissions=!a.hasRole("user")||a.hasPermission(101),i.hasDashboardPermissions){var e=t.current.name;switch(e){case"app.dashboards.general":n=[],i.license.voice&&n.push("app.dashboards.general.voice"),i.license.dialer&&n.push("app.dashboards.general.dialer"),i.license.chat&&n.push("app.dashboards.general.chat"),i.license.mail&&n.push("app.dashboards.general.mail"),i.license.messaging&&n.push("app.dashboards.general.sms"),i.license.openchannel&&n.push("app.dashboards.general.openchannel"),i.license.fax&&n.push("app.dashboards.general.fax"),i.license.whatsapp&&n.push("app.dashboards.general.whatsapp"),0<n.length&&t.go(_.first(n));break;case"app.dashboards.general.voice":i.selectedTab=0;break;case"app.dashboards.general.dialer":i.selectedTab=1;break;case"app.dashboards.general.chat":i.selectedTab=2;break;case"app.dashboards.general.mail":i.selectedTab=3;break;case"app.dashboards.general.sms":i.selectedTab=4;break;case"app.dashboards.general.openchannel":i.selectedTab=5;break;case"app.dashboards.general.fax":i.selectedTab=6;break;case"app.dashboards.general.whatsapp":i.selectedTab=7}}var n}}e.$inject=["$q"],n.$inject=["$q"],t.$inject=["$state","Auth","license"],angular.module("app.dashboards").factory("initializeRealtimeQueue",e).factory("initializeRealtimeCampaign",n).controller("UserDashboardGeneralController",t)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;function r(){s({queues:o.inboundQueues,rpcQueues:o.rpcQueues}).then(function(e){o.inbound=e})}o.inboundQueues=t?_.keyBy(t.rows?t.rows:[],"id"):{},o.rpcQueues=a?_.keyBy(a.rows?a.rows:[],"id"):{},o.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},o.outbound=i||{answered:0,sumBillable:0,sumDuration:0,sumHoldTime:0,total:0},o.onSaveQueue=function(e){o.inboundQueues[e.id]&&o.rpcQueues[e.id]&&(o.rpcQueues[e.id]=e,r())},o.onSaveOutbound=function(e){o.outbound=e},n.on("voice_queue:save",o.onSaveQueue),n.on("voice_outbound:save",o.onSaveOutbound),r(),e.$on("$destroy",function(){n.removeListener("voice_queue:save",o.onSaveQueue),n.removeAllListeners("voice_outbound:save")})}e.$inject=["$scope","socket","inboundQueues","rpcQueues","outbound","initializeRealtimeQueue"],angular.module("app.dashboards").controller("UserVoiceDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.whatsappAccounts,{id:_.toNumber(e.WhatsappAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.whatsappAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveWhatsappInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateWhatsappInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("whatsappInteraction:save",i.onSaveWhatsappInteraction),n.on("whatsappInteraction:update",i.onUpdateWhatsappInteraction),function(){if(0<Object.keys(i.whatsappAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("whatsappInteraction:save"),n.removeAllListeners("whatsappInteraction:update")})}e.$inject=["$scope","socket","whatsappInteractions","whatsappAccounts"],angular.module("app.dashboards").controller("UserWhatsappDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="FAX.EDIT_FAXACCOUNT",g.faxAccount=angular.copy(l),g.faxAccounts=r,g.newFaxAccount=!1,g.faxAccount||(g.faxAccount={waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="FAX.NEW_FAXACCOUNT",g.newFaxAccount=!0),n.params.id&&(g.faxAccount.FaxAccountId=n.params.id),g.addNewFaxAccount=function(){g.errors=[],d.faxAccount.addAccountApplications(g.faxAccount).$promise.then(function(e){g.faxAccounts.unshift(e.toJSON()),o.success({title:"FaxAccount properly created",msg:g.faxAccount.name?g.faxAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFaxAccount=function(){g.errors=[],d.faxAccount.updateAccountApplications(g.faxAccount).$promise.then(function(e){var n=_.find(g.faxAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FaxAccount properly saved!",msg:g.faxAccount.name?g.faxAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFaxAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The faxAccount will be deleted.").ariaLabel("Delete FaxAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.faxAccount.delete({id:g.faxAccount.id}).$promise.then(function(){_.remove(g.faxAccounts,{id:g.faxAccount.id}),o.success({title:"FaxAccount properly deleted!",msg:(g.faxAccount.name||"faxAccount")+" has been deleted!"}),v(g.faxAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})}),t=null;if(g.faxAccount&&(t=_.find(g.trunks,{id:Number(g.faxAccount.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.trunks,{id:t.id});a.canSelect=!1,n.push(a)}g.trunks=n})}else{var t=[],a=null;g.faxAccount&&(a=_.find(g.trunks,{id:Number(g.faxAccount.TrunkId)}));for(var i=0;i<g.trunks.length;i++)a&&g.trunks[i].id===a.id&&(g.trunks[i].canSelect=!1,t.push(g.trunks[i]));g.trunks=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.faxAccount&&(t=_.find(g.lists,{id:Number(g.faxAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.faxAccount&&(a=_.find(g.lists,{id:Number(g.faxAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","faxAccounts","faxAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.fax").controller("CreateOrEditFaxAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.faxAccountApps.rows.length){var t=r.faxAccountApps.rows[n]?r.faxAccountApps.rows[n]:r.faxAccountApps.rows[0];i.show({controller:"EditFaxAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccountApp:t,faxAccount:r.faxAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.faxAccountApps.rows[n]=e:r.faxAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.faxAccountApps.rows.length;t++,0){var a=r.faxAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.faxAccount.context,a.exten=r.faxAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.faxAccount.addApplications({id:r.faxAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.faxAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.faxAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.faxAccount={},r.faxAccountApps={count:0,rows:[]},r.selectedFaxAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"FaxQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"faxQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:901}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,defaultValue:300,required:!0,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",role:"agent",nolimit:!0},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.faxAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getFaxAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.faxAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getFaxAccountApps=function(){r.promise=o.faxAccount.getApplications(r.query,t).$promise},r.editFaxAccountApp=n,r.editInterval=function(e,n){if(r.faxAccountApps.rows.length){var t=r.faxAccountApps.rows[n]?r.faxAccountApps.rows[n]:r.faxAccountApps.rows[0];i.show({controller:"EditFaxAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteFaxAccountApp=function(e){_.remove(r.faxAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedFaxAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedFaxAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedFaxAccountApps.forEach(function(e){_.remove(r.faxAccountApps.rows,{id:e.id})}),r.selectedFaxAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.fax").controller("FaxAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.faxAccount.getAgents({id:c.faxAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserFaxAccount?"penalty "+e.UserFaxAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.faxAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.faxAccount.removeAgents({id:c.faxAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.faxAccount.addAgents({id:c.faxAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("FAX.ALL_AGENTS"),labelSelected:r.instant("FAX.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","faxAccount","faxAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.fax").controller("FaxAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditFaxAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("fax")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.faxQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.faxQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:901}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountApptagDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.faxAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.faxAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.FaxAccountId=m.faxAccount.id,m.query.id=m.faxAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.faxAccount.id,field:"FaxAccountId",route:"faxAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.fax").controller("FaxAccountDispositionsController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"faxAccount",action:"getDispositions",field:"name",params:{id:m.faxAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.faxAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.faxAccountInteractions.rows.length;n+=1){var t=m.faxAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.faxInteraction.get(m.query,p).$promise}function v(e){d.faxInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.faxAccountInteractions.rows,{id:e.id}),m.faxAccountInteractions.count-=1,m.faxAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETfaxAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?(e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""),e.contactInfo=e.Contact.fax):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.faxAccount={},m.faxAccountInteractions={count:0,rows:[]},m.selectedFaxAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.faxAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.FaxAccountId=m.faxAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.faxInteractionDownload=function(s,e,n){return d.faxInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="fax-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getFaxAccountInteractions=g,m.createOrEditFaxAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccount:m.faxAccount,interaction:n,interactions:m.faxAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spyfaxInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"fax",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"fax.faxAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||FaxAccountId:=$eq["+m.faxAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedFaxAccountInteractions=function(){var e=angular.copy(m.selectedFaxAccountInteractions);return m.selectedFaxAccountInteractions=[],e},m.deleteFaxAccountInteraction=v,m.deleteSelectedFaxAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedFaxAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedFaxAccountInteractions.forEach(function(e){v(e)}),m.selectedFaxAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.fax").controller("FaxAccountInteractionsController",e)}(),function(){"use strict";function e(t,e,a,i,s,n,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=n,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=e.protocol()+"://"+e.host(),p.faxAccount=c||t.params.faxAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=t.params.tab||0,p.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.fax.realtime.accounts",{}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.fax.realtime.accounts",{})}},p.agentadddialog=function(e,n){a.show({controller:"FaxAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxAccount:e,faxAccounts:p.faxAccounts?p.faxAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoFaxAccounts=function(){t.go("app.fax.faxAccounts",{},{reload:"app.fax.faxAccounts"})},p.saveFaxAccount=function(){r.faxAccount.updateAccountApplications(p.faxAccount).$promise.then(function(){l.success({title:"FaxAccount updated!",msg:p.faxAccount.name?p.faxAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.trunks=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.trunks=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.trunks,{id:e.resourceId})}),t=null;if(p.faxAccount&&(t=_.find(p.trunks,{id:Number(p.faxAccount.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.trunks,{id:t.id});a.canSelect=!1,n.push(a)}p.trunks=n})}else{var t=[],a=null;p.faxAccount&&(a=_.find(p.trunks,{id:Number(p.faxAccount.TrunkId)}));for(var i=0;i<p.trunks.length;i++)a&&p.trunks[i].id===a.id&&(p.trunks[i].canSelect=!1,t.push(p.trunks[i]));p.trunks=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.faxAccount&&(t=_.find(p.lists,{id:Number(p.faxAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.faxAccount&&(a=_.find(p.lists,{id:Number(p.faxAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","faxAccount","userProfile","userProfileSection"],angular.module("app.fax").controller("FaxAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.faxAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="faxAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedFaxAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},f.arrayecm=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayminrate=_.keyBy([{option:"2400",value:"'2400'"},{option:"4800",value:"'4800'"},{option:"7200",value:"'7200'"},{option:"9600",value:"'9600'"},{option:"12000",value:"'12000'"},{option:"14400",value:"'14400'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymaxrate=_.keyBy([{option:"2400",value:"'2400'"},{option:"4800",value:"'4800'"},{option:"7200",value:"'7200'"},{option:"9600",value:"'9600'"},{option:"12000",value:"'12000'"},{option:"14400",value:"'14400'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytech=_.keyBy([{option:"SIP",value:"'SIP'"},{option:"IAX",value:"'IAX'"},{option:"DADHI",value:"'DADHI'"},{option:"KHOMP",value:"'KHOMP'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.fax.faxAccounts.edit",{id:e.id,faxAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.fax.faxAccounts.edit",{id:e.id,tab:5})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.fax.realtime.accounts",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.fax.realtime.accounts",{})}},f.agentadddialog=function(e,n){i.show({controller:"FaxAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxAccount:e,faxAccounts:f.faxAccounts?f.faxAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("faxAccount")+"?").htmlContent("<b>"+(e.name||"faxAccount")+"</b> will be deleted.").ariaLabel("delete faxAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getFaxAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.faxAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FaxAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFaxAccount=function(e,n){i.show({controller:"CreateOrEditFaxAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccount:n,faxAccounts:f.faxAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteFaxAccount=y,f.exportSelectedFaxAccounts=function(){var e=angular.copy(f.selectedFaxAccounts);return f.selectedFaxAccounts=[],e},f.deleteSelectedFaxAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected faxAccounts?").htmlContent("<b>"+f.selectedFaxAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FaxAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFaxAccounts.forEach(function(e){y(e)}),f.selectedFaxAccounts=[]})},f.deselectFaxAccounts=function(){f.selectedFaxAccounts=[]},f.selectAllFaxAccounts=function(){f.selectedFaxAccounts=f.faxAccounts.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(f.trunks,{id:e.resourceId})}),a=null;a=[],f.faxAccounts.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(f.trunks,{id:e.id});n.canSelect=!1,t.push(n)}}),f.trunks=t})}else{var t=[],a=[];f.faxAccounts.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)});for(var i=0;i<f.trunks.length;i++){_.some(a,{id:f.trunks[i].id})&&(f.trunks[i].canSelect=!1,t.push(f.trunks[i]))}f.trunks=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.faxAccount&&(t=_.find(f.lists,{id:Number(f.faxAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.faxAccount&&(a=_.find(f.lists,{id:Number(f.faxAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.faxAccounts=e||{count:0,rows:[]}}function y(e){m.faxAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.faxAccounts.rows,{id:e.id}),f.faxAccounts.count-=1,f.faxAccounts.rows.length||f.getFaxAccounts(),p.success({title:_.startCase("FaxAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEfaxAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEfaxAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFaxAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","faxAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.fax").controller("FaxAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="FAX.EDIT_FAXQUEUE",g.faxQueue=angular.copy(l),g.faxQueues=r,g.newFaxQueue=!1,g.faxQueue||(g.faxQueue={strategy:"beepall",timeout:10},g.title="FAX.NEW_FAXQUEUE",g.newFaxQueue=!0),g.addNewFaxQueue=function(){g.errors=[],d.faxQueue.save(g.faxQueue).$promise.then(function(e){g.faxQueues.unshift(e.toJSON()),o.success({title:"FaxQueue properly created",msg:g.faxQueue.name?g.faxQueue.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFaxQueue=function(){g.errors=[],d.faxQueue.update({id:g.faxQueue.id},g.faxQueue).$promise.then(function(e){var n=_.find(g.faxQueues,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FaxQueue properly saved!",msg:g.faxQueue.name?g.faxQueue.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFaxQueue=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The faxQueue will be deleted.").ariaLabel("Delete FaxQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.faxQueue.delete({id:g.faxQueue.id}).$promise.then(function(){_.remove(g.faxQueues,{id:g.faxQueue.id}),o.success({title:"FaxQueue properly deleted!",msg:(g.faxQueue.name||"faxQueue")+" has been deleted!"}),v(g.faxQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","faxQueues","faxQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.fax").controller("CreateOrEditFaxQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.faxQueue.getAgents({id:c.faxQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserFaxQueue?"penalty "+e.UserFaxQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.faxQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.removeAgents({id:c.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.addAgents({id:c.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("FAX.ALL_AGENTS"),labelSelected:r.instant("FAX.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","faxQueue","faxQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.fax").controller("FaxQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.faxQueue.getTeams({id:l.faxQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.faxQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("FAX.ALL_TEAMS"),labelSelected:t.instant("FAX.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.removeTeams({id:l.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.addTeams({id:l.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","faxQueue","$translate","Auth","crudPermissions"],angular.module("app.fax").controller("FaxQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.faxQueue=c||e.params.faxQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"FaxQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:u.faxQueues?u.faxQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:u.faxQueues?u.faxQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoFaxQueues=function(){e.go("app.fax.faxQueues",{},{reload:"app.fax.faxQueues"})},u.saveFaxQueue=function(){r.faxQueue.update({id:u.faxQueue.id},u.faxQueue).$promise.then(function(){l.success({title:"FaxQueue updated!",msg:u.faxQueue.name?u.faxQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","faxQueue","userProfileSection"],angular.module("app.fax").controller("FaxQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.faxQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="faxQueues",f.listOrder="",f.listOrderAsc=null,f.selectedFaxQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"fax",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.fax.faxQueues.edit",{id:e.id,faxQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"FaxQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:f.faxQueues?f.faxQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:f.faxQueues?f.faxQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("faxQueue")+"?").htmlContent("<b>"+(e.name||"faxQueue")+"</b> will be deleted.").ariaLabel("delete faxQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.fax.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.fax.realtime.queues",{})}},f.success=E,f.getFaxQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.faxQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FaxQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFaxQueue=function(e,n){i.show({controller:"CreateOrEditFaxQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxQueue:n,faxQueues:f.faxQueues.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteFaxQueue=y,f.exportSelectedFaxQueues=function(){var e=angular.copy(f.selectedFaxQueues);return f.selectedFaxQueues=[],e},f.deleteSelectedFaxQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected faxQueues?").htmlContent("<b>"+f.selectedFaxQueues.length+" selected</b> will be deleted.").ariaLabel("delete FaxQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFaxQueues.forEach(function(e){y(e)}),f.selectedFaxQueues=[]})},f.deselectFaxQueues=function(){f.selectedFaxQueues=[]},f.selectAllFaxQueues=function(){f.selectedFaxQueues=f.faxQueues.rows};var b=!0,A=1;function E(e){f.faxQueues=e||{count:0,rows:[]}}function y(e){m.faxQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.faxQueues.rows,{id:e.id}),f.faxQueues.count-=1,f.faxQueues.rows.length||f.getFaxQueues(),p.success({title:_.startCase("FaxQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEfaxQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEfaxQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFaxQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","faxQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.fax").controller("FaxQueuesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){_.forIn(p.faxAccounts,function(e,n){p.rpcFaxAccounts[n]&&_.merge(e,p.rpcFaxAccounts[n])}),_.forIn(p.faxAccounts,function(n,e){var t={id:e,sort:"-id",direction:"in",limit:1,offset:0,$gte:"createdAt,"+moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),fields:"id,createdAt"};s.faxAccount.getMessages(t).$promise.then(function(e){return e&&(n.in=e.count||0,n.lastIn=e.rows&&e.rows.length?e.rows[0].createdAt:void 0),t.direction="out",s.faxAccount.getMessages(t).$promise}).then(function(e){e&&(n.out=e.count||0,n.lastOut=e.rows&&e.rows.length?e.rows[0].createdAt:void 0)}).catch(function(e){console.log(e)})})}p.currentUser=u.getCurrentUser(),p.count=l&&l.count?l.count:0,p.faxAccounts=l?_.keyBy(l.rows?l.rows:[],"id"):{},p.rpcFaxAccounts=d?_.keyBy(d.rows?d.rows:[],"id"):{},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.query={sort:"-name",limit:10,page:1},p.success=f,p.$onInit=g,p.getFaxAccounts=function(){p.query.offset=(p.query.page-1)*p.query.limit,u.hasRole("admin")?p.promise=s.faxAccount.get(p.query,f).$promise:(p.query.id=p.userProfile.id,p.query.section="FaxAccounts",p.promise=s.userProfile.getResources(p.query,f).$promise)},p.onSave=function(e){p.faxAccounts[e.id]&&_.merge(p.faxAccounts[e.id],e)},p.onFaxMessageSave=function(e){p.faxAccounts[e.FaxAccountId]&&("in"==e.direction?(p.faxAccounts[e.FaxAccountId].in+=1,p.faxAccounts[e.FaxAccountId].lastIn=e.createdAt):(p.faxAccounts[e.FaxAccountId].out+=1,p.faxAccounts[e.FaxAccountId].lastOut=e.createdAt))},p.goToFaxAccount=function(e,n){i.go("app.fax.faxAccounts.edit",{id:n.id,faxAccount:n})},p.order=[],_.forIn(p.faxAccounts,function(e,n){p.order.push(e.id)}),o.on("faxAccount:save",p.onSave),o.on("faxAccount:update",p.onSave),o.on("faxMessage:save",p.onFaxMessageSave);var v=!0,h=1;function f(e){if(p.faxAccounts=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){p.order=[];for(var n=0;n<e.rows.length;n++)p.order.push(e.rows[n].id)}g()}e.$watch("vm.query.filter",function(e,n){v?t(function(){v=!1}):(n||(h=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=h),p.getFaxAccounts())}),e.$on("$destroy",function(){o.removeAllListeners("faxAccount:save"),o.removeAllListeners("faxAccount:update"),o.removeAllListeners("faxMessage:save")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$state","api","socket","toasty","faxAccounts","rpcFaxAccounts","userProfile","userProfileSection","Auth"],angular.module("app.fax").controller("FaxAccountsRealtimeController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=["loggedIn","available","waiting","paused"],g=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"FaxQueues":void 0,channel:"fax",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("FAX.FAXQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditFaxQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxQueue:n,faxQueues:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxQueue:n,faxQueues:u.queues.rows,realtime:!1,crudPermissions:u.crudPermissions}})},r.on("fax_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,p))}),r.on("userFaxQueue:save",function(e){var n=_.find(u.queues.rows,["id",e.FaxQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("userFaxQueue:remove",function(e){var n=_.find(u.queues.rows,["id",e.FaxQueueId]);n&&(0<n.loggedInDb&&n.loggedInDb--,_.remove(n.agents,["id",e.UserId]))}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"fax")})}),e.$on("$destroy",function(){r.removeAllListeners("fax_queue:save"),r.removeAllListeners("userFaxQueue:remove"),r.removeAllListeners("userFaxQueue:save"),r.removeAllListeners("user:update"),g&&n.cancel(g)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.fax").controller("QueuesFaxRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.fax.realtime.agents":this.selectedTab=0;break;case"app.fax.realtime.trunks":this.selectedTab=1;break;case"app.fax.realtime.queues":this.selectedTab=2;break;case"app.fax.realtime.accounts":this.selectedTab=3;break;default:this.selectedTab=0,t.go("app.fax.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.fax.realtime.agents");break;case 1:t.go("app.fax.realtime.trunks");break;case 2:t.go("app.fax.realtime.queues");break;case 3:t.go("app.fax.realtime.accounts");break;default:t.go("app.fax.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.fax").controller("FaxRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m){var u=this,p=["status","stateRegistry","registry","host","port","internal","state","status"];function g(){for(var e,n=0;n<u.trunks.length;n+=1)0<=(e=_.findIndex(u.rpcTrunks,["id",u.trunks[n].id]))&&_.merge(u.trunks[n],_.pick(u.rpcTrunks[e],p))}function v(e,n,t){0<=n&&_.merge(e[n],_.pick(t,p))}u.currentUser=m.getCurrentUser(),u.count=a.count,u.trunks=a?a.rows:[],u.rpcTrunks=i&&i.rows?i.rows:[],u.query={fields:"id,name",active:!0,sort:"-updatedAt",limit:10,page:1},u.statusClass=r.status,u.stateClass=r.state,u.userProfile=d,u.userProfileSection=c&&1==c.count?c.rows[0]:null,u.crudPermissions=m.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.success=b,u.$onInit=g,u.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},u.getTrunks=function(){u.query.offset=(u.query.page-1)*u.query.limit,m.hasRole("admin")?u.promise=s.trunk.get(u.query,b).$promise:(u.query.id=u.userProfile.id,u.query.section="Trunks",u.promise=s.userProfile.getResources(u.query,b).$promise)},u.goToTrunk=function(e,n){l.go("app.tools.trunks.edit",{id:n.id})},u.onSave=function(e){var n=_.findIndex(u.trunks,["id",e.id]),t=_.findIndex(u.rpcTrunks,["id",e.id]);v(u.trunks,n,e),v(u.rpcTrunks,t,e)},o.on("trunk:save",u.onSave);var h=!0,f=1;function b(e){u.count=e.count,u.trunks=e&&e.rows?e.rows:[],g()}e.$watch("vm.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=u.query.page),e!==n&&(u.query.page=1),e||(u.query.page=f),u.getTrunks())}),e.$on("$destroy",function(){o.removeAllListeners("trunk:save")})}e.$inject=["$scope","$timeout","$mdDialog","trunks","rpcTrunks","api","socket","helperClasses","$state","userProfile","userProfileSection","Auth"],angular.module("app.fax").controller("TrunksFaxRealtimeController",e)}(),function(){"use strict";function e(e,n){this.info=e,this.license=n}e.$inject=["info","license"],angular.module("app.help.about").controller("AboutController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_DESKACCOUNT",g.deskAccount=angular.copy(l),g.deskAccounts=r,g.newDeskAccount=!1,g.deskAccount||(g.deskAccount={type:"integrationTab",authType:"basic",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_DESKACCOUNT",g.newDeskAccount=!0),g.addNewDeskAccount=function(){g.errors=[],d.intDeskAccount.save(g.deskAccount).$promise.then(function(e){g.deskAccounts.unshift(e.toJSON()),o.success({title:"DeskAccount properly created",msg:g.deskAccount.name?g.deskAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDeskAccount=function(){g.errors=[],d.intDeskAccount.update({id:g.deskAccount.id},g.deskAccount).$promise.then(function(e){var n=_.find(g.deskAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"DeskAccount properly saved!",msg:g.deskAccount.name?g.deskAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDeskAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The deskAccount will be deleted.").ariaLabel("Delete DeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intDeskAccount.delete({id:g.deskAccount.id}).$promise.then(function(){_.remove(g.deskAccounts,{id:g.deskAccount.id}),o.success({title:"DeskAccount properly deleted!",msg:(g.deskAccount.name||"deskAccount")+" has been deleted!"}),v(g.deskAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","deskAccounts","deskAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDeskAccountDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.deskAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="deskAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedDeskAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayauthType=_.keyBy([{option:"Basic",value:"'basic'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.deskAccounts.edit",{id:e.id,deskAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intDeskAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"DeskAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"DeskAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("deskAccount")+"?").htmlContent("<b>"+(e.name||"deskAccount")+"</b> will be deleted.").ariaLabel("delete deskAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getDeskAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intDeskAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="DeskAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditDeskAccount=function(e,n){i.show({controller:"CreateOrEditDeskAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{deskAccount:n,deskAccounts:f.deskAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteDeskAccount=y,f.exportSelectedDeskAccounts=function(){var e=angular.copy(f.selectedDeskAccounts);return f.selectedDeskAccounts=[],e},f.deleteSelectedDeskAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected deskAccounts?").htmlContent("<b>"+f.selectedDeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete DeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedDeskAccounts.forEach(function(e){y(e)}),f.selectedDeskAccounts=[]})},f.deselectDeskAccounts=function(){f.selectedDeskAccounts=[]},f.selectAllDeskAccounts=function(){f.selectedDeskAccounts=f.deskAccounts.rows};var b=!0,A=1;function E(e){f.deskAccounts=e||{count:0,rows:[]}}function y(e){m.intDeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.deskAccounts.rows,{id:e.id}),f.deskAccounts.count-=1,f.deskAccounts.rows.length||f.getDeskAccounts(),p.success({title:_.startCase("DeskAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintDeskAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintDeskAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getDeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","deskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("DeskAccountsController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intDeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intDeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intDeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.deskAccount={},o.deskConfiguration={},o.configurations=[],o.selectedDeskConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.deskAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intDeskAccount.getConfigurations({id:o.deskAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getDeskConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getDeskConfiguration=function(e){o.deskConfiguration=o.configurations[e],o.selectedDeskConfiguration=e,i.intDeskConfiguration.getSubjects({id:o.deskConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intDeskConfiguration.getDescriptions({id:o.deskConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intDeskConfiguration.getFields({id:o.deskConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),i.intDeskConfiguration.getTags({id:o.deskConfiguration.id}).$promise.then(function(e){o.selectedTags=e.rows?_.map(e.rows,"id"):[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditDeskConfiguration=function(e,n){a.show({controller:"CreateOrEditDeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{deskConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getDeskConfiguration(0)})},o.deleteDeskConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the deskConfiguration?").htmlContent("<b>"+(n.name||"deskConfiguration")+"</b> will be deleted.").ariaLabel("delete deskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intDeskConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"DeskConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getDeskConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedTags=[],o.selectTagsChanged=function(e){i.intDeskConfiguration.setTags({id:o.deskConfiguration.id,ids:o.selectedTags}).$promise.then(function(){s.success({title:"Tags set!",msg:"Tags has been set!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},i.tag.get({nolimit:!0,sort:"name"}).$promise.then(function(e){o.tags=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("DeskAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_DESKCONFIGURATION",g.deskConfiguration=angular.copy(l),g.configurations=r,g.newDeskConfiguration=!1,g.deskConfiguration||(g.deskConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_DESKCONFIGURATION",g.newDeskConfiguration=!0),g.addNewDeskConfiguration=function(){g.errors=[],d.intDeskAccount.addConfiguration({id:n.params.id},g.deskConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"DeskConfiguration properly created",msg:g.deskConfiguration.name?g.deskConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDeskConfiguration=function(){g.errors=[],d.intDeskConfiguration.update({id:g.deskConfiguration.id},g.deskConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"DeskConfiguration properly saved!",msg:g.deskConfiguration.name?g.deskConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDeskConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The deskConfiguration will be deleted.").ariaLabel("Delete DeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intDeskConfiguration.delete({id:g.deskConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.deskConfiguration.id}),o.success({title:"DeskConfiguration properly deleted!",msg:(g.deskConfiguration.name||"deskConfiguration")+" has been deleted!"}),v(g.deskConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","deskConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDeskConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDeskField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDeskField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intDeskField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDeskAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDeskAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.deskAccount=c||e.params.deskAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoDeskAccounts=function(){e.go("app.integrations.deskAccounts",{},{reload:"app.integrations.deskAccounts"})},u.saveDeskAccount=function(){r.intDeskAccount.update({id:u.deskAccount.id},u.deskAccount).$promise.then(function(){l.success({title:"DeskAccount updated!",msg:u.deskAccount.name?u.deskAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintDeskAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","deskAccount","userProfileSection"],angular.module("app.integrations").controller("DeskAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this;function h(e){a.hide(e)}v.currentUser=m.getCurrentUser(),v.errors=[],v.setting=p,v.license=u,v.crudPermissions=g,v.hasModulePermissions={},v.passwordPattern=v.setting&&v.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",v.title="INTEGRATIONS.EDIT_DYNAMICS365ACCOUNT",v.dynamics365Account=angular.copy(l),v.dynamics365Accounts=r,v.cloudProviders=d,v.newDynamics365Account=!1,v.dynamics365Account||(v.dynamics365Account={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),modernAuthentication:!1},v.title="INTEGRATIONS.NEW_DYNAMICS365ACCOUNT",v.newDynamics365Account=!0),v.addNewDynamics365Account=function(){v.errors=[],c.intDynamics365Account.save(v.dynamics365Account).$promise.then(function(e){v.dynamics365Accounts.unshift(e.toJSON()),o.success({title:"Dynamics365Account properly created",msg:v.dynamics365Account.name?v.dynamics365Account.name+" has been created!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Account.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Account.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.saveDynamics365Account=function(){v.errors=[],c.intDynamics365Account.update({id:v.dynamics365Account.id},v.dynamics365Account).$promise.then(function(e){var n=_.find(v.dynamics365Accounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Dynamics365Account properly saved!",msg:v.dynamics365Account.name?v.dynamics365Account.name+" has been saved!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Account.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Account.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.deleteDynamics365Account=function(e){v.errors=[];var n=a.confirm().title("Are you sure?").content("The dynamics365Account will be deleted.").ariaLabel("Delete Dynamics365Account").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intDynamics365Account.delete({id:v.dynamics365Account.id}).$promise.then(function(){_.remove(v.dynamics365Accounts,{id:v.dynamics365Account.id}),o.success({title:"Dynamics365Account properly deleted!",msg:(v.dynamics365Account.name||"dynamics365Account")+" has been deleted!"}),h(v.dynamics365Account)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Account.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Account.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},v.getDateFromString=function(e){return null===e?void 0:new Date(e)},v.closeDialog=h}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","dynamics365Accounts","dynamics365Account","cloudProviders","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDynamics365AccountDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=h,b.setting=f,b.currentUser=v.getCurrentUser(),b.dynamics365Accounts=l||{count:0,rows:[]},b.cloudProviders=d||{count:0,rows:[]},b.userProfile=c,b.userProfileSection=m&&1==m.count?m.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.table="dynamics365Accounts",b.listOrder="",b.listOrderAsc=null,b.selectedDynamics365Accounts=[],b.query={fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description,modernAuthentication",sort:"-updatedAt",limit:10,page:1},b.editstate=function(e,n){t.go("app.integrations.dynamics365Accounts.edit",{id:e.id,dynamics365Account:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,n){return u.intDynamics365Account.getFields({id:e.id,test:!0}).$promise.then(function(){g.success({title:"Dynamics365Account properly tested",msg:"Connection succeded!"})}).catch(function(e){g.error({title:"Dynamics365Account properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},b.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("dynamics365Account")+"?").htmlContent("<b>"+(e.name||"dynamics365Account")+"</b> will be deleted.").ariaLabel("delete dynamics365Account").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getDynamics365Accounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,v.hasRole("admin")?b.promise=u.intDynamics365Account.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Dynamics365Accounts",b.promise=u.userProfile.getResources(b.query,y).$promise)},b.createOrEditDynamics365Account=function(e,n){i.show({controller:"CreateOrEditDynamics365AccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{dynamics365Account:n,dynamics365Accounts:b.dynamics365Accounts.rows,cloudProviders:b.cloudProviders.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteDynamics365Account=S,b.exportSelectedDynamics365Accounts=function(){var e=angular.copy(b.selectedDynamics365Accounts);return b.selectedDynamics365Accounts=[],e},b.deleteSelectedDynamics365Accounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected dynamics365Accounts?").htmlContent("<b>"+b.selectedDynamics365Accounts.length+" selected</b> will be deleted.").ariaLabel("delete Dynamics365Accounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){b.selectedDynamics365Accounts.forEach(function(e){S(e)}),b.selectedDynamics365Accounts=[]})},b.deselectDynamics365Accounts=function(){b.selectedDynamics365Accounts=[]},b.selectAllDynamics365Accounts=function(){b.selectedDynamics365Accounts=b.dynamics365Accounts.rows};var A=!0,E=1;function y(e){b.dynamics365Accounts=e||{count:0,rows:[]}}function S(e){u.intDynamics365Account.delete({id:e.id}).$promise.then(function(){_.remove(b.dynamics365Accounts.rows,{id:e.id}),b.dynamics365Accounts.count-=1,b.dynamics365Accounts.rows.length||b.getDynamics365Accounts(),g.success({title:_.startCase("Dynamics365Account")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintDynamics365Account"}];for(var n=0;n<e.data.errors.length;n++)g.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else g.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintDynamics365Account",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){A?o(function(){A=!1}):(n||(E=b.query.page),e!==n&&(b.query.page=1),e||(b.query.page=E),b.getDynamics365Accounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","dynamics365Accounts","cloudProviders","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("Dynamics365AccountsController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intDynamics365Field.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intDynamics365Field.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intDynamics365Field.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.dynamics365Account={},o.dynamics365Configuration={},o.configurations=[],o.selectedDynamics365Configuration=-1,o.crudPermissions,o.init=function(e,n){o.dynamics365Account=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intDynamics365Account.getConfigurations({id:o.dynamics365Account.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getDynamics365Configuration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getDynamics365Configuration=function(e){o.advancedForm&&o.advancedForm.$setPristine();o.dynamics365Configuration=o.configurations[e],o.selectedDynamics365Configuration=e,i.intDynamics365Configuration.getSubjects({id:o.dynamics365Configuration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intDynamics365Configuration.getDescriptions({id:o.dynamics365Configuration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intDynamics365Configuration.getFields({id:o.dynamics365Configuration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditDynamics365Configuration=function(e,n){a.show({controller:"CreateOrEditDynamics365ConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{dynamics365Configuration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getDynamics365Configuration(0)})},o.deleteDynamics365Configuration=function(e,n){var t=a.confirm().title("Are you sure want to delete the dynamics365Configuration?").htmlContent("<b>"+(n.name||"dynamics365Configuration")+"</b> will be deleted.").ariaLabel("delete dynamics365Configuration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intDynamics365Configuration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"Dynamics365Configuration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getDynamics365Configuration(0)})},function(){console.log("CANCEL")})},o.saveDynamics365Configuration=function(){o.errors=[],i.intDynamics365Configuration.update({id:o.dynamics365Configuration.id},o.dynamics365Configuration).$promise.then(function(e){var n=_.find(o.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.advancedForm.$setPristine(),s.success({title:"Dynamics365Configuration properly saved!",msg:o.dynamics365Configuration.name?o.dynamics365Configuration.name+" has been saved!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){o.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.update"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("Dynamics365AccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_DYNAMICS365CONFIGURATION",g.dynamics365Configuration=angular.copy(l),g.configurations=r,g.newDynamics365Configuration=!1,g.dynamics365Configuration||(g.dynamics365Configuration={channel:"voice",type:"inbound",ticketType:"incident"},g.title="INTEGRATIONS.NEW_DYNAMICS365CONFIGURATION",g.newDynamics365Configuration=!0),g.addNewDynamics365Configuration=function(){g.errors=[],d.intDynamics365Account.addConfiguration({id:n.params.id},g.dynamics365Configuration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"Dynamics365Configuration properly created",msg:g.dynamics365Configuration.name?g.dynamics365Configuration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDynamics365Configuration=function(){g.errors=[],d.intDynamics365Configuration.update({id:g.dynamics365Configuration.id},g.dynamics365Configuration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Dynamics365Configuration properly saved!",msg:g.dynamics365Configuration.name?g.dynamics365Configuration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDynamics365Configuration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The dynamics365Configuration will be deleted.").ariaLabel("Delete Dynamics365Configuration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intDynamics365Configuration.delete({id:g.dynamics365Configuration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.dynamics365Configuration.id}),o.success({title:"Dynamics365Configuration properly deleted!",msg:(g.dynamics365Configuration.name||"dynamics365Configuration")+" has been deleted!"}),v(g.dynamics365Configuration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","dynamics365Configuration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDynamics365ConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDynamics365Field.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDynamics365Field.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intDynamics365Field.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDynamics365Account.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDynamics365AccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.dynamics365Account=c||e.params.dynamics365Account||{},p.cloudProviders=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.alert=l.info,p.gotoDynamics365Accounts=function(){e.go("app.integrations.dynamics365Accounts",{},{reload:"app.integrations.dynamics365Accounts"})},p.saveDynamics365Account=function(){r.intDynamics365Account.update({id:p.dynamics365Account.id},p.dynamics365Account).$promise.then(function(){l.success({title:"Dynamics365Account updated!",msg:p.dynamics365Account.name?p.dynamics365Account.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintDynamics365Account",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","dynamics365Account","cloudProviders","userProfileSection"],angular.module("app.integrations").controller("Dynamics365AccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHDESKACCOUNT",g.freshdeskAccount=angular.copy(l),g.freshdeskAccounts=r,g.newFreshdeskAccount=!1,g.freshdeskAccount||(g.freshdeskAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_FRESHDESKACCOUNT",g.newFreshdeskAccount=!0),g.addNewFreshdeskAccount=function(){g.errors=[],d.intFreshdeskAccount.save(g.freshdeskAccount).$promise.then(function(e){g.freshdeskAccounts.unshift(e.toJSON()),o.success({title:"FreshdeskAccount properly created",msg:g.freshdeskAccount.name?g.freshdeskAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshdeskAccount=function(){g.errors=[],d.intFreshdeskAccount.update({id:g.freshdeskAccount.id},g.freshdeskAccount).$promise.then(function(e){var n=_.find(g.freshdeskAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshdeskAccount properly saved!",msg:g.freshdeskAccount.name?g.freshdeskAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshdeskAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshdeskAccount will be deleted.").ariaLabel("Delete FreshdeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshdeskAccount.delete({id:g.freshdeskAccount.id}).$promise.then(function(){_.remove(g.freshdeskAccounts,{id:g.freshdeskAccount.id}),o.success({title:"FreshdeskAccount properly deleted!",msg:(g.freshdeskAccount.name||"freshdeskAccount")+" has been deleted!"}),v(g.freshdeskAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","freshdeskAccounts","freshdeskAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshdeskAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intFreshdeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intFreshdeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intFreshdeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.freshdeskAccount={},o.freshdeskConfiguration={},o.configurations=[],o.selectedFreshdeskConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.freshdeskAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intFreshdeskAccount.getConfigurations({id:o.freshdeskAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getFreshdeskConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getFreshdeskConfiguration=function(e){o.freshdeskConfiguration=o.configurations[e],o.selectedFreshdeskConfiguration=e,i.intFreshdeskConfiguration.getSubjects({id:o.freshdeskConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intFreshdeskConfiguration.getDescriptions({id:o.freshdeskConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intFreshdeskConfiguration.getFields({id:o.freshdeskConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),i.intFreshdeskConfiguration.getTags({id:o.freshdeskConfiguration.id}).$promise.then(function(e){o.selectedTags=e.rows?_.map(e.rows,"id"):[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditFreshdeskConfiguration=function(e,n){a.show({controller:"CreateOrEditFreshdeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshdeskConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getFreshdeskConfiguration(0)})},o.deleteFreshdeskConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the freshdeskConfiguration?").htmlContent("<b>"+(n.name||"freshdeskConfiguration")+"</b> will be deleted.").ariaLabel("delete freshdeskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intFreshdeskConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"FreshdeskConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getFreshdeskConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedTags=[],o.selectTagsChanged=function(e){i.intFreshdeskConfiguration.setTags({id:o.freshdeskConfiguration.id,ids:o.selectedTags}).$promise.then(function(){s.success({title:"Tags set!",msg:"Tags has been set!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},i.tag.get({nolimit:!0,sort:"name"}).$promise.then(function(e){o.tags=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("FreshdeskAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHDESKCONFIGURATION",g.freshdeskConfiguration=angular.copy(l),g.configurations=r,g.newFreshdeskConfiguration=!1,g.freshdeskConfiguration||(g.freshdeskConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_FRESHDESKCONFIGURATION",g.newFreshdeskConfiguration=!0),g.addNewFreshdeskConfiguration=function(){g.errors=[],d.intFreshdeskAccount.addConfiguration({id:n.params.id},g.freshdeskConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"FreshdeskConfiguration properly created",msg:g.freshdeskConfiguration.name?g.freshdeskConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshdeskConfiguration=function(){g.errors=[],d.intFreshdeskConfiguration.update({id:g.freshdeskConfiguration.id},g.freshdeskConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshdeskConfiguration properly saved!",msg:g.freshdeskConfiguration.name?g.freshdeskConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshdeskConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshdeskConfiguration will be deleted.").ariaLabel("Delete FreshdeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshdeskConfiguration.delete({id:g.freshdeskConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.freshdeskConfiguration.id}),o.success({title:"FreshdeskConfiguration properly deleted!",msg:(g.freshdeskConfiguration.name||"freshdeskConfiguration")+" has been deleted!"}),v(g.freshdeskConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","freshdeskConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshdeskConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshdeskField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshdeskField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intFreshdeskField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intFreshdeskAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshdeskAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.freshdeskAccount=c||e.params.freshdeskAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoFreshdeskAccounts=function(){e.go("app.integrations.freshdeskAccounts",{},{reload:"app.integrations.freshdeskAccounts"})},u.saveFreshdeskAccount=function(){r.intFreshdeskAccount.update({id:u.freshdeskAccount.id},u.freshdeskAccount).$promise.then(function(){l.success({title:"FreshdeskAccount updated!",msg:u.freshdeskAccount.name?u.freshdeskAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintFreshdeskAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","freshdeskAccount","userProfileSection"],angular.module("app.integrations").controller("FreshdeskAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.freshdeskAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="freshdeskAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedFreshdeskAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.freshdeskAccounts.edit",{id:e.id,freshdeskAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intFreshdeskAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"FreshdeskAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"FreshdeskAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("freshdeskAccount")+"?").htmlContent("<b>"+(e.name||"freshdeskAccount")+"</b> will be deleted.").ariaLabel("delete freshdeskAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getFreshdeskAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intFreshdeskAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FreshdeskAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFreshdeskAccount=function(e,n){i.show({controller:"CreateOrEditFreshdeskAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshdeskAccount:n,freshdeskAccounts:f.freshdeskAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteFreshdeskAccount=y,f.exportSelectedFreshdeskAccounts=function(){var e=angular.copy(f.selectedFreshdeskAccounts);return f.selectedFreshdeskAccounts=[],e},f.deleteSelectedFreshdeskAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected freshdeskAccounts?").htmlContent("<b>"+f.selectedFreshdeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FreshdeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFreshdeskAccounts.forEach(function(e){y(e)}),f.selectedFreshdeskAccounts=[]})},f.deselectFreshdeskAccounts=function(){f.selectedFreshdeskAccounts=[]},f.selectAllFreshdeskAccounts=function(){f.selectedFreshdeskAccounts=f.freshdeskAccounts.rows};var b=!0,A=1;function E(e){f.freshdeskAccounts=e||{count:0,rows:[]}}function y(e){m.intFreshdeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.freshdeskAccounts.rows,{id:e.id}),f.freshdeskAccounts.count-=1,f.freshdeskAccounts.rows.length||f.getFreshdeskAccounts(),p.success({title:_.startCase("FreshdeskAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintFreshdeskAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintFreshdeskAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFreshdeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","freshdeskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("FreshdeskAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHSALESACCOUNT",g.freshsalesAccount=angular.copy(l),g.freshsalesAccounts=r,g.newFreshsalesAccount=!1,g.freshsalesAccount||(g.freshsalesAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_FRESHSALESACCOUNT",g.newFreshsalesAccount=!0),g.addNewFreshsalesAccount=function(){g.errors=[],d.intFreshsalesAccount.save(g.freshsalesAccount).$promise.then(function(e){g.freshsalesAccounts.unshift(e.toJSON()),o.success({title:"FreshsalesAccount properly created",msg:g.freshsalesAccount.name?g.freshsalesAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshsalesAccount=function(){g.errors=[],d.intFreshsalesAccount.update({id:g.freshsalesAccount.id},g.freshsalesAccount).$promise.then(function(e){var n=_.find(g.freshsalesAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshsalesAccount properly saved!",msg:g.freshsalesAccount.name?g.freshsalesAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshsalesAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshsalesAccount will be deleted.").ariaLabel("Delete FreshsalesAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshsalesAccount.delete({id:g.freshsalesAccount.id}).$promise.then(function(){_.remove(g.freshsalesAccounts,{id:g.freshsalesAccount.id}),o.success({title:"FreshsalesAccount properly deleted!",msg:(g.freshsalesAccount.name||"freshsalesAccount")+" has been deleted!"}),v(g.freshsalesAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","freshsalesAccounts","freshsalesAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshsalesAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intFreshsalesField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intFreshsalesField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intFreshsalesField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.freshsalesAccount={},o.freshsalesConfiguration={},o.configurations=[],o.selectedFreshsalesConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.freshsalesAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intFreshsalesAccount.getConfigurations({id:o.freshsalesAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getFreshsalesConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getFreshsalesConfiguration=function(e){o.freshsalesConfiguration=o.configurations[e],o.selectedFreshsalesConfiguration=e,i.intFreshsalesConfiguration.getSubjects({id:o.freshsalesConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intFreshsalesConfiguration.getDescriptions({id:o.freshsalesConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intFreshsalesConfiguration.getFields({id:o.freshsalesConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditFreshsalesConfiguration=function(e,n){a.show({controller:"CreateOrEditFreshsalesConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshsalesConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getFreshsalesConfiguration(0)})},o.deleteFreshsalesConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the freshsalesConfiguration?").htmlContent("<b>"+(n.name||"freshsalesConfiguration")+"</b> will be deleted.").ariaLabel("delete freshsalesConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intFreshsalesConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"FreshsalesConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getFreshsalesConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditFreshsalesAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.freshsalesConfiguration,account:o.freshsalesAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditFreshsalesAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.freshsalesConfiguration,account:o.freshsalesAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditFreshsalesAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.freshsalesConfiguration,account:o.freshsalesAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("FreshsalesAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHSALESCONFIGURATION",g.freshsalesConfiguration=angular.copy(l),g.configurations=r,g.newFreshsalesConfiguration=!1,g.freshsalesConfiguration||(g.freshsalesConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_FRESHSALESCONFIGURATION",g.newFreshsalesConfiguration=!0),g.addNewFreshsalesConfiguration=function(){g.errors=[],d.intFreshsalesAccount.addConfiguration({id:n.params.id},g.freshsalesConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"FreshsalesConfiguration properly created",msg:g.freshsalesConfiguration.name?g.freshsalesConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshsalesConfiguration=function(){g.errors=[],d.intFreshsalesConfiguration.update({id:g.freshsalesConfiguration.id},g.freshsalesConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshsalesConfiguration properly saved!",msg:g.freshsalesConfiguration.name?g.freshsalesConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshsalesConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshsalesConfiguration will be deleted.").ariaLabel("Delete FreshsalesConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshsalesConfiguration.delete({id:g.freshsalesConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.freshsalesConfiguration.id}),o.success({title:"FreshsalesConfiguration properly deleted!",msg:(g.freshsalesConfiguration.name||"freshsalesConfiguration")+" has been deleted!"}),v(g.freshsalesConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","freshsalesConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshsalesConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshsalesField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshsalesField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intFreshsalesField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intFreshsalesAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshsalesAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.freshsalesAccount=c||e.params.freshsalesAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoFreshsalesAccounts=function(){e.go("app.integrations.freshsalesAccounts",{},{reload:"app.integrations.freshsalesAccounts"})},u.saveFreshsalesAccount=function(){r.intFreshsalesAccount.update({id:u.freshsalesAccount.id},u.freshsalesAccount).$promise.then(function(){l.success({title:"FreshsalesAccount updated!",msg:u.freshsalesAccount.name?u.freshsalesAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintFreshsalesAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","freshsalesAccount","userProfileSection"],angular.module("app.integrations").controller("FreshsalesAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.freshsalesAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="freshsalesAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedFreshsalesAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.freshsalesAccounts.edit",{id:e.id,freshsalesAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intFreshsalesAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"FreshsalesAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"FreshsalesAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("freshsalesAccount")+"?").htmlContent("<b>"+(e.name||"freshsalesAccount")+"</b> will be deleted.").ariaLabel("delete freshsalesAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getFreshsalesAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intFreshsalesAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FreshsalesAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFreshsalesAccount=function(e,n){i.show({controller:"CreateOrEditFreshsalesAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshsalesAccount:n,freshsalesAccounts:f.freshsalesAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteFreshsalesAccount=y,f.exportSelectedFreshsalesAccounts=function(){var e=angular.copy(f.selectedFreshsalesAccounts);return f.selectedFreshsalesAccounts=[],e},f.deleteSelectedFreshsalesAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected freshsalesAccounts?").htmlContent("<b>"+f.selectedFreshsalesAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FreshsalesAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFreshsalesAccounts.forEach(function(e){y(e)}),f.selectedFreshsalesAccounts=[]})},f.deselectFreshsalesAccounts=function(){f.selectedFreshsalesAccounts=[]},f.selectAllFreshsalesAccounts=function(){f.selectedFreshsalesAccounts=f.freshsalesAccounts.rows};var b=!0,A=1;function E(e){f.freshsalesAccounts=e||{count:0,rows:[]}}function y(e){m.intFreshsalesAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.freshsalesAccounts.rows,{id:e.id}),f.freshsalesAccounts.count-=1,f.freshsalesAccounts.rows.length||f.getFreshsalesAccounts(),p.success({title:_.startCase("FreshsalesAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintFreshsalesAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintFreshsalesAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFreshsalesAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","freshsalesAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("FreshsalesAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SALESFORCEACCOUNT",g.salesforceAccount=angular.copy(l),g.salesforceAccounts=r,g.newSalesforceAccount=!1,g.salesforceAccount||(g.salesforceAccount={type:"integrationTab",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_SALESFORCEACCOUNT",g.newSalesforceAccount=!0),g.addNewSalesforceAccount=function(){g.errors=[],d.intSalesforceAccount.save(g.salesforceAccount).$promise.then(function(e){g.salesforceAccounts.unshift(e.toJSON()),o.success({title:"SalesforceAccount properly created",msg:g.salesforceAccount.name?g.salesforceAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSalesforceAccount=function(){g.errors=[],d.intSalesforceAccount.update({id:g.salesforceAccount.id},g.salesforceAccount).$promise.then(function(e){var n=_.find(g.salesforceAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SalesforceAccount properly saved!",msg:g.salesforceAccount.name?g.salesforceAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSalesforceAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The salesforceAccount will be deleted.").ariaLabel("Delete SalesforceAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSalesforceAccount.delete({id:g.salesforceAccount.id}).$promise.then(function(){_.remove(g.salesforceAccounts,{id:g.salesforceAccount.id}),o.success({title:"SalesforceAccount properly deleted!",msg:(g.salesforceAccount.name||"salesforceAccount")+" has been deleted!"}),v(g.salesforceAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","salesforceAccounts","salesforceAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSalesforceAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function n(){return"Case"===o.salesforceConfiguration.ticketType&&("lead"===o.salesforceConfiguration.moduleCreate||_.includes(["lead","contact_lead","account_contact_lead"],o.salesforceConfiguration.moduleSearch))}function r(){return _.includes(["lead","contact_lead","account_contact_lead"],o.salesforceConfiguration.moduleSearch)}function l(){return _.includes(["contact","contact_lead","account_contact_lead"],o.salesforceConfiguration.moduleSearch)}function d(){return _.includes(["account","account_contact_lead"],o.salesforceConfiguration.moduleSearch)}function c(){return i.intSalesforceConfiguration.update({id:o.salesforceConfiguration.id},o.salesforceConfiguration).$promise.then(function(){s.success({title:"Module updated!",msg:"Module has been updated!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function m(e){i.intSalesforceField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function u(e){i.intSalesforceField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(e){i.intSalesforceField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.salesforceAccount={},o.salesforceConfiguration={},o.configurations=[],o.selectedSalesforceConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.salesforceAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intSalesforceAccount.getConfigurations({id:o.salesforceAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getSalesforceConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getSalesforceConfiguration=function(e){o.salesforceConfiguration=o.configurations[e],o.salesforceConfiguration.isLead=n(),o.salesforceConfiguration.isLeadSearch=r(),o.salesforceConfiguration.isContactSearch=l(),o.salesforceConfiguration.isAccountSearch=d(),o.selectedSalesforceConfiguration=e,i.intSalesforceConfiguration.getSubjects({id:o.salesforceConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intSalesforceConfiguration.getDescriptions({id:o.salesforceConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intSalesforceConfiguration.getFields({id:o.salesforceConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditSalesforceConfiguration=function(e,n){a.show({controller:"CreateOrEditSalesforceConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{salesforceConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getSalesforceConfiguration(0)})},o.deleteSalesforceConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the salesforceConfiguration?").htmlContent("<b>"+(n.name||"salesforceConfiguration")+"</b> will be deleted.").ariaLabel("delete salesforceConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intSalesforceConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"SalesforceConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getSalesforceConfiguration(0)})},function(){console.log("CANCEL")})},o.selectChangedAdvanced=function(){o.salesforceConfiguration.isLead=n(),o.salesforceConfiguration.isLeadSearch=r(),o.salesforceConfiguration.isContactSearch=l(),o.salesforceConfiguration.isAccountSearch=d(),c()},o.salesforceConfiguration.isLead=!1,o.salesforceConfiguration.isLeadSearch=!1,o.salesforceConfiguration.isContactSearch=!1,o.salesforceConfiguration.isAccountSearch=!1,o.checkIsLead=n,o.checkIsLeadSearch=r,o.checkIsContactSearch=l,o.checkIsAccountSearch=d,o.saveSalesforceConfiguration=c,o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){m(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){m(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){u(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){u(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){p(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){p(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("SalesforceAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SALESFORCECONFIGURATION",g.salesforceConfiguration=angular.copy(l),g.configurations=r,g.newSalesforceConfiguration=!1,g.salesforceConfiguration||(g.salesforceConfiguration={channel:"voice",type:"inbound",ticketType:"Task"},g.title="INTEGRATIONS.NEW_SALESFORCECONFIGURATION",g.newSalesforceConfiguration=!0),g.addNewSalesforceConfiguration=function(){g.errors=[],d.intSalesforceAccount.addConfiguration({id:n.params.id},g.salesforceConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"SalesforceConfiguration properly created",msg:g.salesforceConfiguration.name?g.salesforceConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSalesforceConfiguration=function(){g.errors=[],d.intSalesforceConfiguration.update({id:g.salesforceConfiguration.id},g.salesforceConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SalesforceConfiguration properly saved!",msg:g.salesforceConfiguration.name?g.salesforceConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSalesforceConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The salesforceConfiguration will be deleted.").ariaLabel("Delete SalesforceConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSalesforceConfiguration.delete({id:g.salesforceConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.salesforceConfiguration.id}),o.success({title:"SalesforceConfiguration properly deleted!",msg:(g.salesforceConfiguration.name||"salesforceConfiguration")+" has been deleted!"}),v(g.salesforceConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","salesforceConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSalesforceConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSalesforceField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSalesforceField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intSalesforceField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSalesforceAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSalesforceAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.salesforceAccount=c||e.params.salesforceAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoSalesforceAccounts=function(){e.go("app.integrations.salesforceAccounts",{},{reload:"app.integrations.salesforceAccounts"})},u.saveSalesforceAccount=function(){r.intSalesforceAccount.update({id:u.salesforceAccount.id},u.salesforceAccount).$promise.then(function(){l.success({title:"SalesforceAccount updated!",msg:u.salesforceAccount.name?u.salesforceAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintSalesforceAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","salesforceAccount","userProfileSection"],angular.module("app.integrations").controller("SalesforceAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.salesforceAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="salesforceAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedSalesforceAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.salesforceAccounts.edit",{id:e.id,salesforceAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intSalesforceAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"SalesforceAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"SalesforceAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("salesforceAccount")+"?").htmlContent("<b>"+(e.name||"salesforceAccount")+"</b> will be deleted.").ariaLabel("delete salesforceAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSalesforceAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intSalesforceAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SalesforceAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSalesforceAccount=function(e,n){i.show({controller:"CreateOrEditSalesforceAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{salesforceAccount:n,salesforceAccounts:f.salesforceAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSalesforceAccount=y,f.exportSelectedSalesforceAccounts=function(){var e=angular.copy(f.selectedSalesforceAccounts);return f.selectedSalesforceAccounts=[],e},f.deleteSelectedSalesforceAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected salesforceAccounts?").htmlContent("<b>"+f.selectedSalesforceAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SalesforceAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSalesforceAccounts.forEach(function(e){y(e)}),f.selectedSalesforceAccounts=[]})},f.deselectSalesforceAccounts=function(){f.selectedSalesforceAccounts=[]},f.selectAllSalesforceAccounts=function(){f.selectedSalesforceAccounts=f.salesforceAccounts.rows};var b=!0,A=1;function E(e){f.salesforceAccounts=e||{count:0,rows:[]}}function y(e){m.intSalesforceAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.salesforceAccounts.rows,{id:e.id}),f.salesforceAccounts.count-=1,f.salesforceAccounts.rows.length||f.getSalesforceAccounts(),p.success({title:_.startCase("SalesforceAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintSalesforceAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintSalesforceAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSalesforceAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","salesforceAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("SalesforceAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SERVICENOWACCOUNT",g.servicenowAccount=angular.copy(l),g.servicenowAccounts=r,g.newServicenowAccount=!1,g.servicenowAccount||(g.servicenowAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_SERVICENOWACCOUNT",g.newServicenowAccount=!0),g.addNewServicenowAccount=function(){g.errors=[],d.intServicenowAccount.save(g.servicenowAccount).$promise.then(function(e){g.servicenowAccounts.unshift(e.toJSON()),o.success({title:"ServicenowAccount properly created",msg:g.servicenowAccount.name?g.servicenowAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveServicenowAccount=function(){g.errors=[],d.intServicenowAccount.update({id:g.servicenowAccount.id},g.servicenowAccount).$promise.then(function(e){var n=_.find(g.servicenowAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ServicenowAccount properly saved!",msg:g.servicenowAccount.name?g.servicenowAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteServicenowAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The servicenowAccount will be deleted.").ariaLabel("Delete ServicenowAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intServicenowAccount.delete({id:g.servicenowAccount.id}).$promise.then(function(){_.remove(g.servicenowAccounts,{id:g.servicenowAccount.id}),o.success({title:"ServicenowAccount properly deleted!",msg:(g.servicenowAccount.name||"servicenowAccount")+" has been deleted!"}),v(g.servicenowAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","servicenowAccounts","servicenowAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditServicenowAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intServicenowField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intServicenowField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intServicenowField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.servicenowAccount={},o.servicenowConfiguration={},o.configurations=[],o.selectedServicenowConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.servicenowAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intServicenowAccount.getConfigurations({id:o.servicenowAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getServicenowConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getServicenowConfiguration=function(e){o.servicenowConfiguration=o.configurations[e],o.selectedServicenowConfiguration=e,i.intServicenowConfiguration.getSubjects({id:o.servicenowConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intServicenowConfiguration.getDescriptions({id:o.servicenowConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intServicenowConfiguration.getFields({id:o.servicenowConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditServicenowConfiguration=function(e,n){a.show({controller:"CreateOrEditServicenowConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{servicenowConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getServicenowConfiguration(0)})},o.deleteServicenowConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the servicenowConfiguration?").htmlContent("<b>"+(n.name||"servicenowConfiguration")+"</b> will be deleted.").ariaLabel("delete servicenowConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intServicenowConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"ServicenowConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getServicenowConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("ServicenowAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SERVICENOWCONFIGURATION",g.servicenowConfiguration=angular.copy(l),g.configurations=r,g.newServicenowConfiguration=!1,g.servicenowConfiguration||(g.servicenowConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_SERVICENOWCONFIGURATION",g.newServicenowConfiguration=!0),g.addNewServicenowConfiguration=function(){g.errors=[],d.intServicenowAccount.addConfiguration({id:n.params.id},g.servicenowConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"ServicenowConfiguration properly created",msg:g.servicenowConfiguration.name?g.servicenowConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveServicenowConfiguration=function(){g.errors=[],d.intServicenowConfiguration.update({id:g.servicenowConfiguration.id},g.servicenowConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ServicenowConfiguration properly saved!",msg:g.servicenowConfiguration.name?g.servicenowConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteServicenowConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The servicenowConfiguration will be deleted.").ariaLabel("Delete ServicenowConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intServicenowConfiguration.delete({id:g.servicenowConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.servicenowConfiguration.id}),o.success({title:"ServicenowConfiguration properly deleted!",msg:(g.servicenowConfiguration.name||"servicenowConfiguration")+" has been deleted!"}),v(g.servicenowConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","servicenowConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditServicenowConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intServicenowField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intServicenowField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intServicenowField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intServicenowAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditServicenowAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.servicenowAccount=c||e.params.servicenowAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoServicenowAccounts=function(){e.go("app.integrations.servicenowAccounts",{},{reload:"app.integrations.servicenowAccounts"})},u.saveServicenowAccount=function(){r.intServicenowAccount.update({id:u.servicenowAccount.id},u.servicenowAccount).$promise.then(function(){l.success({title:"ServicenowAccount updated!",msg:u.servicenowAccount.name?u.servicenowAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintServicenowAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","servicenowAccount","userProfileSection"],angular.module("app.integrations").controller("ServicenowAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.servicenowAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="servicenowAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedServicenowAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.servicenowAccounts.edit",{id:e.id,servicenowAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intServicenowAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"ServicenowAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"ServicenowAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("servicenowAccount")+"?").htmlContent("<b>"+(e.name||"servicenowAccount")+"</b> will be deleted.").ariaLabel("delete servicenowAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getServicenowAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intServicenowAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ServicenowAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditServicenowAccount=function(e,n){i.show({controller:"CreateOrEditServicenowAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{servicenowAccount:n,servicenowAccounts:f.servicenowAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteServicenowAccount=y,f.exportSelectedServicenowAccounts=function(){var e=angular.copy(f.selectedServicenowAccounts);return f.selectedServicenowAccounts=[],e},f.deleteSelectedServicenowAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected servicenowAccounts?").htmlContent("<b>"+f.selectedServicenowAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ServicenowAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedServicenowAccounts.forEach(function(e){y(e)}),f.selectedServicenowAccounts=[]})},f.deselectServicenowAccounts=function(){f.selectedServicenowAccounts=[]},f.selectAllServicenowAccounts=function(){f.selectedServicenowAccounts=f.servicenowAccounts.rows};var b=!0,A=1;function E(e){f.servicenowAccounts=e||{count:0,rows:[]}}function y(e){m.intServicenowAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.servicenowAccounts.rows,{id:e.id}),f.servicenowAccounts.count-=1,f.servicenowAccounts.rows.length||f.getServicenowAccounts(),p.success({title:_.startCase("ServicenowAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintServicenowAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintServicenowAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getServicenowAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","servicenowAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("ServicenowAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SUGARCRMACCOUNT",g.sugarcrmAccount=angular.copy(l),g.sugarcrmAccounts=r,g.newSugarcrmAccount=!1,g.sugarcrmAccount||(g.sugarcrmAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_SUGARCRMACCOUNT",g.newSugarcrmAccount=!0),g.addNewSugarcrmAccount=function(){g.errors=[],d.intSugarcrmAccount.save(g.sugarcrmAccount).$promise.then(function(e){g.sugarcrmAccounts.unshift(e.toJSON()),o.success({title:"SugarcrmAccount properly created",msg:g.sugarcrmAccount.name?g.sugarcrmAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSugarcrmAccount=function(){g.errors=[],d.intSugarcrmAccount.update({id:g.sugarcrmAccount.id},g.sugarcrmAccount).$promise.then(function(e){var n=_.find(g.sugarcrmAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SugarcrmAccount properly saved!",msg:g.sugarcrmAccount.name?g.sugarcrmAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSugarcrmAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The sugarcrmAccount will be deleted.").ariaLabel("Delete SugarcrmAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSugarcrmAccount.delete({id:g.sugarcrmAccount.id}).$promise.then(function(){_.remove(g.sugarcrmAccounts,{id:g.sugarcrmAccount.id}),o.success({title:"SugarcrmAccount properly deleted!",msg:(g.sugarcrmAccount.name||"sugarcrmAccount")+" has been deleted!"}),v(g.sugarcrmAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","sugarcrmAccounts","sugarcrmAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSugarcrmAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intSugarcrmField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intSugarcrmField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intSugarcrmField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.sugarcrmAccount={},o.sugarcrmConfiguration={},o.configurations=[],o.selectedSugarcrmConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.sugarcrmAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intSugarcrmAccount.getConfigurations({id:o.sugarcrmAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getSugarcrmConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getSugarcrmConfiguration=function(e){o.sugarcrmConfiguration=o.configurations[e],o.selectedSugarcrmConfiguration=e,i.intSugarcrmConfiguration.getSubjects({id:o.sugarcrmConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intSugarcrmConfiguration.getDescriptions({id:o.sugarcrmConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intSugarcrmConfiguration.getFields({id:o.sugarcrmConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditSugarcrmConfiguration=function(e,n){a.show({controller:"CreateOrEditSugarcrmConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{sugarcrmConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getSugarcrmConfiguration(0)})},o.deleteSugarcrmConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the sugarcrmConfiguration?").htmlContent("<b>"+(n.name||"sugarcrmConfiguration")+"</b> will be deleted.").ariaLabel("delete sugarcrmConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intSugarcrmConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"SugarcrmConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getSugarcrmConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("SugarcrmAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SUGARCRMCONFIGURATION",g.sugarcrmConfiguration=angular.copy(l),g.configurations=r,g.newSugarcrmConfiguration=!1,g.sugarcrmConfiguration||(g.sugarcrmConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_SUGARCRMCONFIGURATION",g.newSugarcrmConfiguration=!0),g.addNewSugarcrmConfiguration=function(){g.errors=[],d.intSugarcrmAccount.addConfiguration({id:n.params.id},g.sugarcrmConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"SugarcrmConfiguration properly created",msg:g.sugarcrmConfiguration.name?g.sugarcrmConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSugarcrmConfiguration=function(){g.errors=[],d.intSugarcrmConfiguration.update({id:g.sugarcrmConfiguration.id},g.sugarcrmConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SugarcrmConfiguration properly saved!",msg:g.sugarcrmConfiguration.name?g.sugarcrmConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSugarcrmConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The sugarcrmConfiguration will be deleted.").ariaLabel("Delete SugarcrmConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSugarcrmConfiguration.delete({id:g.sugarcrmConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.sugarcrmConfiguration.id}),o.success({title:"SugarcrmConfiguration properly deleted!",msg:(g.sugarcrmConfiguration.name||"sugarcrmConfiguration")+" has been deleted!"}),v(g.sugarcrmConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","sugarcrmConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSugarcrmConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSugarcrmField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSugarcrmField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intSugarcrmField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSugarcrmAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSugarcrmAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.sugarcrmAccount=c||e.params.sugarcrmAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoSugarcrmAccounts=function(){e.go("app.integrations.sugarcrmAccounts",{},{reload:"app.integrations.sugarcrmAccounts"})},u.saveSugarcrmAccount=function(){r.intSugarcrmAccount.update({id:u.sugarcrmAccount.id},u.sugarcrmAccount).$promise.then(function(){l.success({title:"SugarcrmAccount updated!",msg:u.sugarcrmAccount.name?u.sugarcrmAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintSugarcrmAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","sugarcrmAccount","userProfileSection"],angular.module("app.integrations").controller("SugarcrmAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.sugarcrmAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="sugarcrmAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedSugarcrmAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.sugarcrmAccounts.edit",{id:e.id,sugarcrmAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intSugarcrmAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"SugarcrmAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"SugarcrmAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("sugarcrmAccount")+"?").htmlContent("<b>"+(e.name||"sugarcrmAccount")+"</b> will be deleted.").ariaLabel("delete sugarcrmAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSugarcrmAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intSugarcrmAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SugarcrmAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSugarcrmAccount=function(e,n){i.show({controller:"CreateOrEditSugarcrmAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{sugarcrmAccount:n,sugarcrmAccounts:f.sugarcrmAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSugarcrmAccount=y,f.exportSelectedSugarcrmAccounts=function(){var e=angular.copy(f.selectedSugarcrmAccounts);return f.selectedSugarcrmAccounts=[],e},f.deleteSelectedSugarcrmAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected sugarcrmAccounts?").htmlContent("<b>"+f.selectedSugarcrmAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SugarcrmAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSugarcrmAccounts.forEach(function(e){y(e)}),f.selectedSugarcrmAccounts=[]})},f.deselectSugarcrmAccounts=function(){f.selectedSugarcrmAccounts=[]},f.selectAllSugarcrmAccounts=function(){f.selectedSugarcrmAccounts=f.sugarcrmAccounts.rows};var b=!0,A=1;function E(e){f.sugarcrmAccounts=e||{count:0,rows:[]}}function y(e){m.intSugarcrmAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.sugarcrmAccounts.rows,{id:e.id}),f.sugarcrmAccounts.count-=1,f.sugarcrmAccounts.rows.length||f.getSugarcrmAccounts(),p.success({title:_.startCase("SugarcrmAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintSugarcrmAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintSugarcrmAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSugarcrmAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","sugarcrmAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("SugarcrmAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_VTIGERACCOUNT",g.vtigerAccount=angular.copy(l),g.vtigerAccounts=r,g.newVtigerAccount=!1,g.vtigerAccount||(g.vtigerAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_VTIGERACCOUNT",g.newVtigerAccount=!0),g.addNewVtigerAccount=function(){g.errors=[],d.intVtigerAccount.save(g.vtigerAccount).$promise.then(function(e){g.vtigerAccounts.unshift(e.toJSON()),o.success({title:"VtigerAccount properly created",msg:g.vtigerAccount.name?g.vtigerAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVtigerAccount=function(){g.errors=[],d.intVtigerAccount.update({id:g.vtigerAccount.id},g.vtigerAccount).$promise.then(function(e){var n=_.find(g.vtigerAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"VtigerAccount properly saved!",msg:g.vtigerAccount.name?g.vtigerAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVtigerAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The vtigerAccount will be deleted.").ariaLabel("Delete VtigerAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intVtigerAccount.delete({id:g.vtigerAccount.id}).$promise.then(function(){_.remove(g.vtigerAccounts,{id:g.vtigerAccount.id}),o.success({title:"VtigerAccount properly deleted!",msg:(g.vtigerAccount.name||"vtigerAccount")+" has been deleted!"}),v(g.vtigerAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","vtigerAccounts","vtigerAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditVtigerAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intVtigerField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intVtigerField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intVtigerField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.vtigerAccount={},o.vtigerConfiguration={},o.configurations=[],o.selectedVtigerConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.vtigerAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intVtigerAccount.getConfigurations({id:o.vtigerAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getVtigerConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getVtigerConfiguration=function(e){o.vtigerConfiguration=o.configurations[e],o.selectedVtigerConfiguration=e,i.intVtigerConfiguration.getSubjects({id:o.vtigerConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intVtigerConfiguration.getDescriptions({id:o.vtigerConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intVtigerConfiguration.getFields({id:o.vtigerConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditVtigerConfiguration=function(e,n){a.show({controller:"CreateOrEditVtigerConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{vtigerConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getVtigerConfiguration(0)})},o.deleteVtigerConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the vtigerConfiguration?").htmlContent("<b>"+(n.name||"vtigerConfiguration")+"</b> will be deleted.").ariaLabel("delete vtigerConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intVtigerConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"VtigerConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getVtigerConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("VtigerAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_VTIGERCONFIGURATION",g.vtigerConfiguration=angular.copy(l),g.configurations=r,g.newVtigerConfiguration=!1,g.vtigerConfiguration||(g.vtigerConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_VTIGERCONFIGURATION",g.newVtigerConfiguration=!0),g.addNewVtigerConfiguration=function(){g.errors=[],d.intVtigerAccount.addConfiguration({id:n.params.id},g.vtigerConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"VtigerConfiguration properly created",msg:g.vtigerConfiguration.name?g.vtigerConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVtigerConfiguration=function(){g.errors=[],d.intVtigerConfiguration.update({id:g.vtigerConfiguration.id},g.vtigerConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"VtigerConfiguration properly saved!",msg:g.vtigerConfiguration.name?g.vtigerConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVtigerConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The vtigerConfiguration will be deleted.").ariaLabel("Delete VtigerConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intVtigerConfiguration.delete({id:g.vtigerConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.vtigerConfiguration.id}),o.success({title:"VtigerConfiguration properly deleted!",msg:(g.vtigerConfiguration.name||"vtigerConfiguration")+" has been deleted!"}),v(g.vtigerConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","vtigerConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditVtigerConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intVtigerField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intVtigerField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intVtigerField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intVtigerAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditVtigerAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.vtigerAccount=c||e.params.vtigerAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoVtigerAccounts=function(){e.go("app.integrations.vtigerAccounts",{},{reload:"app.integrations.vtigerAccounts"})},u.saveVtigerAccount=function(){r.intVtigerAccount.update({id:u.vtigerAccount.id},u.vtigerAccount).$promise.then(function(){l.success({title:"VtigerAccount updated!",msg:u.vtigerAccount.name?u.vtigerAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintVtigerAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","vtigerAccount","userProfileSection"],angular.module("app.integrations").controller("VtigerAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.vtigerAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="vtigerAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedVtigerAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.vtigerAccounts.edit",{id:e.id,vtigerAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intVtigerAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"VtigerAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"VtigerAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("vtigerAccount")+"?").htmlContent("<b>"+(e.name||"vtigerAccount")+"</b> will be deleted.").ariaLabel("delete vtigerAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVtigerAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intVtigerAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="VtigerAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVtigerAccount=function(e,n){i.show({controller:"CreateOrEditVtigerAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{vtigerAccount:n,vtigerAccounts:f.vtigerAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteVtigerAccount=y,f.exportSelectedVtigerAccounts=function(){var e=angular.copy(f.selectedVtigerAccounts);return f.selectedVtigerAccounts=[],e},f.deleteSelectedVtigerAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected vtigerAccounts?").htmlContent("<b>"+f.selectedVtigerAccounts.length+" selected</b> will be deleted.").ariaLabel("delete VtigerAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVtigerAccounts.forEach(function(e){y(e)}),f.selectedVtigerAccounts=[]})},f.deselectVtigerAccounts=function(){f.selectedVtigerAccounts=[]},f.selectAllVtigerAccounts=function(){f.selectedVtigerAccounts=f.vtigerAccounts.rows};var b=!0,A=1;function E(e){f.vtigerAccounts=e||{count:0,rows:[]}}function y(e){m.intVtigerAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.vtigerAccounts.rows,{id:e.id}),f.vtigerAccounts.count-=1,f.vtigerAccounts.rows.length||f.getVtigerAccounts(),p.success({title:_.startCase("VtigerAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintVtigerAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintVtigerAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVtigerAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","vtigerAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("VtigerAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZENDESKACCOUNT",g.zendeskAccount=angular.copy(l),g.zendeskAccounts=r,g.newZendeskAccount=!1,g.zendeskAccount||(g.zendeskAccount={type:"integrationTab",authType:"password",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_ZENDESKACCOUNT",g.newZendeskAccount=!0),g.addNewZendeskAccount=function(){g.errors=[],d.intZendeskAccount.save(g.zendeskAccount).$promise.then(function(e){g.zendeskAccounts.unshift(e.toJSON()),o.success({title:"ZendeskAccount properly created",msg:g.zendeskAccount.name?g.zendeskAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZendeskAccount=function(){g.errors=[],d.intZendeskAccount.update({id:g.zendeskAccount.id},g.zendeskAccount).$promise.then(function(e){var n=_.find(g.zendeskAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZendeskAccount properly saved!",msg:g.zendeskAccount.name?g.zendeskAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZendeskAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zendeskAccount will be deleted.").ariaLabel("Delete ZendeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZendeskAccount.delete({id:g.zendeskAccount.id}).$promise.then(function(){_.remove(g.zendeskAccounts,{id:g.zendeskAccount.id}),o.success({title:"ZendeskAccount properly deleted!",msg:(g.zendeskAccount.name||"zendeskAccount")+" has been deleted!"}),v(g.zendeskAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","zendeskAccounts","zendeskAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZendeskAccountDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZendeskField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZendeskField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intZendeskField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intZendeskAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZendeskAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.zendeskAccount=c||e.params.zendeskAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoZendeskAccounts=function(){e.go("app.integrations.zendeskAccounts",{},{reload:"app.integrations.zendeskAccounts"})},u.saveZendeskAccount=function(){r.intZendeskAccount.update({id:u.zendeskAccount.id},u.zendeskAccount).$promise.then(function(){l.success({title:"ZendeskAccount updated!",msg:u.zendeskAccount.name?u.zendeskAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintZendeskAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","zendeskAccount","userProfileSection"],angular.module("app.integrations").controller("ZendeskAccountController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intZendeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intZendeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intZendeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.zendeskAccount={},o.zendeskConfiguration={},o.zendeskConfigurations=[],o.selectedZendeskConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.zendeskAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intZendeskAccount.getConfigurations({id:o.zendeskAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.zendeskConfigurations=e.rows?e.rows:[],o.zendeskConfigurations.length&&o.getZendeskConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getZendeskConfiguration=function(e){o.zendeskConfiguration=o.zendeskConfigurations[e],o.selectedZendeskConfiguration=e,i.intZendeskConfiguration.getSubjects({id:o.zendeskConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intZendeskConfiguration.getDescriptions({id:o.zendeskConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intZendeskConfiguration.getFields({id:o.zendeskConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),i.intZendeskConfiguration.getTags({id:o.zendeskConfiguration.id}).$promise.then(function(e){o.selectedTags=e.rows?_.map(e.rows,"id"):[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditZendeskConfiguration=function(e,n){a.show({controller:"CreateOrEditZendeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/zendeskConfigurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{zendeskConfiguration:n,zendeskConfigurations:o.zendeskConfigurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getZendeskConfiguration(0)})},o.deleteZendeskConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the zendeskConfiguration?").htmlContent("<b>"+(n.name||"zendeskConfiguration")+"</b> will be deleted.").ariaLabel("delete zendeskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intZendeskConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.zendeskConfigurations,{id:n.id}),s.success({title:"ZendeskConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getZendeskConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedTags=[],o.selectTagsChanged=function(e){i.intZendeskConfiguration.setTags({id:o.zendeskConfiguration.id,ids:o.selectedTags}).$promise.then(function(){s.success({title:"Tags set!",msg:"Tags has been set!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},i.tag.get({nolimit:!0,sort:"name"}).$promise.then(function(e){o.tags=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("ZendeskAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZENDESKCONFIGURATION",g.zendeskConfiguration=angular.copy(l),g.zendeskConfigurations=r,g.newZendeskConfiguration=!1,g.zendeskConfiguration||(g.zendeskConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_ZENDESKCONFIGURATION",g.newZendeskConfiguration=!0),g.addNewZendeskConfiguration=function(){g.errors=[],d.intZendeskAccount.addConfiguration({id:n.params.id},g.zendeskConfiguration).$promise.then(function(e){g.zendeskConfigurations.unshift(e.toJSON()),o.success({title:"ZendeskConfiguration properly created",msg:g.zendeskConfiguration.name?g.zendeskConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZendeskConfiguration=function(){g.errors=[],d.intZendeskConfiguration.update({id:g.zendeskConfiguration.id},g.zendeskConfiguration).$promise.then(function(e){var n=_.find(g.zendeskConfigurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZendeskConfiguration properly saved!",msg:g.zendeskConfiguration.name?g.zendeskConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZendeskConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zendeskConfiguration will be deleted.").ariaLabel("Delete ZendeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZendeskConfiguration.delete({id:g.zendeskConfiguration.id}).$promise.then(function(){_.remove(g.zendeskConfigurations,{id:g.zendeskConfiguration.id}),o.success({title:"ZendeskConfiguration properly deleted!",msg:(g.zendeskConfiguration.name||"zendeskConfiguration")+" has been deleted!"}),v(g.zendeskConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","zendeskConfigurations","zendeskConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZendeskConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.zendeskAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="zendeskAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedZendeskAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayauthType=_.keyBy([{option:"Password",value:"'password'"},{option:"Token",value:"'token'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.zendeskAccounts.edit",{id:e.id,zendeskAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intZendeskAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"ZendeskAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"ZendeskAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("zendeskAccount")+"?").htmlContent("<b>"+(e.name||"zendeskAccount")+"</b> will be deleted.").ariaLabel("delete zendeskAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getZendeskAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intZendeskAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ZendeskAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditZendeskAccount=function(e,n){i.show({controller:"CreateOrEditZendeskAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{zendeskAccount:n,zendeskAccounts:f.zendeskAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteZendeskAccount=y,f.exportSelectedZendeskAccounts=function(){var e=angular.copy(f.selectedZendeskAccounts);return f.selectedZendeskAccounts=[],e},f.deleteSelectedZendeskAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected zendeskAccounts?").htmlContent("<b>"+f.selectedZendeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ZendeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedZendeskAccounts.forEach(function(e){y(e)}),f.selectedZendeskAccounts=[]})},f.deselectZendeskAccounts=function(){f.selectedZendeskAccounts=[]},f.selectAllZendeskAccounts=function(){f.selectedZendeskAccounts=f.zendeskAccounts.rows};var b=!0,A=1;function E(e){f.zendeskAccounts=e||{count:0,rows:[]}}function y(e){m.intZendeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.zendeskAccounts.rows,{id:e.id}),f.zendeskAccounts.count-=1,f.zendeskAccounts.rows.length||f.getZendeskAccounts(),p.success({title:_.startCase("ZendeskAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintZendeskAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintZendeskAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getZendeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","zendeskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("ZendeskAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZOHOACCOUNT",g.zohoAccount=angular.copy(l),g.zohoAccounts=r,g.newZohoAccount=!1,g.zohoAccount||(g.zohoAccount={host:"zoho.com",zone:"EU",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_ZOHOACCOUNT",g.newZohoAccount=!0),g.addNewZohoAccount=function(){g.errors=[],d.intZohoAccount.save(g.zohoAccount).$promise.then(function(e){g.zohoAccounts.unshift(e.toJSON()),o.success({title:"ZohoAccount properly created",msg:g.zohoAccount.name?g.zohoAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZohoAccount=function(){g.errors=[],d.intZohoAccount.update({id:g.zohoAccount.id},g.zohoAccount).$promise.then(function(e){var n=_.find(g.zohoAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZohoAccount properly saved!",msg:g.zohoAccount.name?g.zohoAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZohoAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zohoAccount will be deleted.").ariaLabel("Delete ZohoAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZohoAccount.delete({id:g.zohoAccount.id}).$promise.then(function(){_.remove(g.zohoAccounts,{id:g.zohoAccount.id}),o.success({title:"ZohoAccount properly deleted!",msg:(g.zohoAccount.name||"zohoAccount")+" has been deleted!"}),v(g.zohoAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","zohoAccounts","zohoAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZohoAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intZohoField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intZohoField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intZohoField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.zohoAccount={},o.zohoConfiguration={},o.configurations=[],o.selectedZohoConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.zohoAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intZohoAccount.getConfigurations({id:o.zohoAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getZohoConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getZohoConfiguration=function(e){o.zohoConfiguration=o.configurations[e],o.selectedZohoConfiguration=e,i.intZohoConfiguration.getSubjects({id:o.zohoConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intZohoConfiguration.getDescriptions({id:o.zohoConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intZohoConfiguration.getFields({id:o.zohoConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditZohoConfiguration=function(e,n){a.show({controller:"CreateOrEditZohoConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{zohoConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getZohoConfiguration(0)})},o.deleteZohoConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the zohoConfiguration?").htmlContent("<b>"+(n.name||"zohoConfiguration")+"</b> will be deleted.").ariaLabel("delete zohoConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intZohoConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"ZohoConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getZohoConfiguration(0)})},function(){console.log("CANCEL")})},o.selectChangedAdvanced=function(){i.intZohoConfiguration.update({id:o.zohoConfiguration.id},o.zohoConfiguration).$promise.then(function(){s.success({title:"Module updated!",msg:"Module has been updated!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("ZohoAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZOHOCONFIGURATION",g.zohoConfiguration=angular.copy(l),g.configurations=r,g.newZohoConfiguration=!1,g.zohoConfiguration||(g.zohoConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_ZOHOCONFIGURATION",g.newZohoConfiguration=!0),g.addNewZohoConfiguration=function(){g.errors=[],d.intZohoAccount.addConfiguration({id:n.params.id},g.zohoConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"ZohoConfiguration properly created",msg:g.zohoConfiguration.name?g.zohoConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZohoConfiguration=function(){g.errors=[],d.intZohoConfiguration.update({id:g.zohoConfiguration.id},g.zohoConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZohoConfiguration properly saved!",msg:g.zohoConfiguration.name?g.zohoConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZohoConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zohoConfiguration will be deleted.").ariaLabel("Delete ZohoConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZohoConfiguration.delete({id:g.zohoConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.zohoConfiguration.id}),o.success({title:"ZohoConfiguration properly deleted!",msg:(g.zohoConfiguration.name||"zohoConfiguration")+" has been deleted!"}),v(g.zohoConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","zohoConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZohoConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZohoField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZohoField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intZohoField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intZohoAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZohoAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.zohoAccount=c||e.params.zohoAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoZohoAccounts=function(){e.go("app.integrations.zohoAccounts",{},{reload:"app.integrations.zohoAccounts"})},u.saveZohoAccount=function(){r.intZohoAccount.update({id:u.zohoAccount.id},u.zohoAccount).$promise.then(function(){l.success({title:"ZohoAccount updated!",msg:u.zohoAccount.name?u.zohoAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintZohoAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","zohoAccount","userProfileSection"],angular.module("app.integrations").controller("ZohoAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.zohoAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="zohoAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedZohoAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arrayhost=_.keyBy([{option:"zoho.com",value:"'zoho.com'"},{option:"zoho.eu",value:"'zoho.eu'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayzone=_.keyBy([{option:"US",value:"'US'"},{option:"AU",value:"'AU'"},{option:"EU",value:"'EU'"},{option:"IN",value:"'IN'"},{option:"CN",value:"'CN'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.zohoAccounts.edit",{id:e.id,zohoAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intZohoAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"ZohoAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"ZohoAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("zohoAccount")+"?").htmlContent("<b>"+(e.name||"zohoAccount")+"</b> will be deleted.").ariaLabel("delete zohoAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getZohoAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intZohoAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ZohoAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditZohoAccount=function(e,n){i.show({controller:"CreateOrEditZohoAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{zohoAccount:n,zohoAccounts:f.zohoAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteZohoAccount=y,f.exportSelectedZohoAccounts=function(){var e=angular.copy(f.selectedZohoAccounts);return f.selectedZohoAccounts=[],e},f.deleteSelectedZohoAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected zohoAccounts?").htmlContent("<b>"+f.selectedZohoAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ZohoAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedZohoAccounts.forEach(function(e){y(e)}),f.selectedZohoAccounts=[]})},f.deselectZohoAccounts=function(){f.selectedZohoAccounts=[]},f.selectAllZohoAccounts=function(){f.selectedZohoAccounts=f.zohoAccounts.rows};var b=!0,A=1;function E(e){f.zohoAccounts=e||{count:0,rows:[]}}function y(e){m.intZohoAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.zohoAccounts.rows,{id:e.id}),f.zohoAccounts.count-=1,f.zohoAccounts.rows.length||f.getZohoAccounts(),p.success({title:_.startCase("ZohoAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintZohoAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintZohoAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getZohoAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","zohoAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("ZohoAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="JSCRIPTY.EDIT_PROJECT",g.project=angular.copy(l),g.projects=r,g.newProject=!1,g.project||(g.project={enableUncompleteSave:!0,sendUnpauseOnSubmit:!0},g.title="JSCRIPTY.NEW_PROJECT",g.newProject=!0),g.addNewProject=function(){g.errors=[],d.jscriptyProject.save(g.project).$promise.then(function(e){g.projects.unshift(e.toJSON()),o.success({title:"Project properly created",msg:g.project.name?g.project.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveProject=function(){g.errors=[],d.jscriptyProject.update({id:g.project.id},g.project).$promise.then(function(e){var n=_.find(g.projects,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Project properly saved!",msg:g.project.name?g.project.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteProject=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The project will be deleted.").ariaLabel("Delete Project").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.jscriptyProject.delete({id:g.project.id}).$promise.then(function(){_.remove(g.projects,{id:g.project.id}),o.success({title:"Project properly deleted!",msg:(g.project.name||"project")+" has been deleted!"}),v(g.project)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","projects","project","api","Auth","license","setting","crudPermissions"],angular.module("app.jscripty").controller("CreateOrEditProjectDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o){var r=this;r.currentUser=i.getCurrentUser(),r.project={},r.localizationMap=o;var l=new Date;r.pickerModel={dateStart:new Date(l.getFullYear(),l.getMonth(),1),dateEnd:new Date(l.getFullYear(),l.getMonth()+1,0),selectedTemplate:"TM"},r.init=function(e,n){r.project=e,r.userProfile=n,r.getAnswers()},r.getSummary=function(){return a.jscriptyProject.getSummary({id:r.project.id,startTime:{$gte:r.pickerModel.dateStart,$lte:moment(r.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format()},nolimit:!0}).$promise.then(function(e){if(void 0!==e.length){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download","jscriptyProjectSummary_"+r.project.id+".csv"),a.click()}else s.info({title:"EXPORT",msg:"No answers available"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.getSummary",msg:e.data?JSON.stringify(e.data):e.toString()})})},r.getAnswers=function(){return r.hasIdAnswers=!1,a.jscriptyProject.getAnswers({id:r.project.id,sort:"-createdAt,questionId",createdAt:{$gte:moment(r.pickerModel.dateStart).add(0,"hours").add(0,"minutes").add(0,"seconds").utcOffset(0,!0).format(),$lte:moment(r.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").utcOffset(0,!0).format()},nolimit:!0}).$promise.then(function(e){if(e&&e.rows&&e.hasOwnProperty("count")){r.answers={};for(var n=0,t=e.count;n<t;n++)e.rows[n].questionId&&(r.hasIdAnswers=!0,r.answers.hasOwnProperty(e.rows[n].questionId)||(r.answers[e.rows[n].questionId]={question:e.rows[n].question,answers:{},sum:0}),""===e.rows[n].answer&&(e.rows[n].answer="NO_ANSWER"),r.answers[e.rows[n].questionId].answers[e.rows[n].answer]?r.answers[e.rows[n].questionId].answers[e.rows[n].answer]+=1:r.answers[e.rows[n].questionId].answers[e.rows[n].answer]=1,r.answers[e.rows[n].questionId].sum+=1)}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETANSWERS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$mdDialog","$document","$window","api","Auth","toasty","dateFilterLocalizationFactory"],angular.module("app.jscripty").controller("ProjectAnswersController",e)}(),function(){"use strict";angular.module("app.jscripty").controller("ProjectBuilderController",function(){var n=this;n.project={},n.optionsBuilder={questionTypes:["text","textarea","radio","checkbox","select","number","date","time","email","range","url"],elementTypes:["question","paragraph"]},n.init=function(e){n.project=e,_.isObjectLike(e.formData)?n.project.formData=e.formData:n.isJsonString(e.formData)?n.project.formData=JSON.parse(e.formData):n.project.formData={}},n.isJsonString=function(e){if(_.isNil(e))return!1;try{JSON.parse(e)}catch(e){return!1}return!0}})}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newProject=!0,r.project=angular.copy(i),r.projects=s,r.title=o.instant("JSCRIPTY.CLONE_PROJECT"),i&&i.name&&(r.title+=": "+i.name),r.cloneProject=function(){return e.jscriptyProject.clone({id:i.id},r.project).$promise.then(function(e){r.projects.unshift(e.toJSON()),a.success({title:"Project properly cloned",msg:r.project.name?r.project.name+" has been cloned!":""}),t.go("app.jscripty.projects.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","project","projects","$translate"],angular.module("app.jscripty").controller("ProjectcloneController",e)}(),function(){"use strict";function e(a,i,n){var o=this;o.project={},o.responseData={},o.formViewer={},o.init=function(e){o.project=e,n.$on("mwForm.pageEvents.pageCurrentChanged",function(e,n){if(n.currentPage&&o.project.formData&&o.project.formData.pages)for(var t=0,a=o.project.formData.pages.length;t<a;t++)if(n.currentPage.number<t+1&&o.project.formData.pages[t].elements)for(var i=0,s=o.project.formData.pages[t].elements.length;i<s;i++)"question"===o.project.formData.pages[t].elements[i].type&&o.project.formData.pages[t].elements[i].question&&delete o.responseData[o.project.formData.pages[t].elements[i].question.id]})},o.onSubmit=function(e){var n=a.defer(),t=i.confirm().title("Would you like to save your survey?").textContent("").ariaLabel("survey").targetEvent(e).ok("SAVE").cancel("CANCEL");return i.show(t).then(function(){n.resolve(!0)},function(){n.reject()}),n.promise},o.resetViewer=function(){o.formViewer.reset&&o.formViewer.reset()}}e.$inject=["$q","$mdDialog","$scope"],angular.module("app.jscripty").controller("ProjectViewerController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.projectSessions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.jscriptyProject.getSessions(m.query,u).$promise}function g(e){d.jscriptySessionReport.delete({id:e.id}).$promise.then(function(){_.remove(m.projectSessions.rows,{id:e.id}),m.projectSessions.count-=1,m.projectSessions.rows.length||p(),l.success({title:"Session deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETjscriptyProject"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETjscriptyProject",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.project={},m.projectSessions={count:0,rows:[]},m.selectedProjectSessions=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,starttime,endtime,membername,calleridnum,completed",sort:"-starttime",limit:10,page:1},m.init=function(e,n,t){m.project=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.id=m.project.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the session?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("session #")+e.id||"session")+"</b> will be deleted.").ariaLabel("delete session").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getProjectSessions=p,m.createOrEditProjectSession=function(e,n){o.show({controller:"CreateOrEditSessionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:m.project,session:n,sessions:m.projectSessions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.showQuestionsProjectSession=function(e,t){o.show({controller:"ShowQuestionsSessionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,resolve:{questions:["apiResolver","$stateParams",function(e,n){return e.resolve("jscriptySessionReport@getQuestions",{fields:"question,answer",sort:"id",id:t.id})}]},locals:{project:m.project,session:t}})},m.exportSelectedProjectSessions=function(){var e=angular.copy(m.selectedProjectSessions);return m.selectedProjectSessions=[],e},m.deleteProjectSession=g,m.deleteSelectedProjectSessions=function(e){var n=o.confirm().title("Are you sure want to delete the selected sessions?").htmlContent("<b>"+m.selectedProjectSessions.length+" selected</b> will be deleted.").ariaLabel("delete sessions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedProjectSessions.forEach(function(e){g(e)}),m.selectedProjectSessions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.jscripty").controller("ProjectSessionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){this.title="JSCRIPTY.SESSION_RESULTS",this.session=s,this.questions=o,this.project=r,this.closeDialog=function(e){a.hide(e)}}e.$inject=["$scope","$state","$location","$mdDialog","toasty","session","questions","project","api"],angular.module("app.jscripty").controller("ShowQuestionsSessionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.project=c||e.params.project||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.clonedialog=function(e,n){t.show({controller:"ProjectcloneController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/clone/clone.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{project:e,projects:p.projects?p.projects.rows:[],crudPermissions:p.crudPermissions}})},p.alert=l.info,p.gotoProjects=function(){e.go("app.jscripty.projects",{},{reload:"app.jscripty.projects"})},p.saveProject=function(){r.jscriptyProject.update({id:p.project.id},p.project).$promise.then(function(){l.success({title:"Project updated!",msg:p.project.name?p.project.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETjscriptyProject",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","project","userProfile","userProfileSection"],angular.module("app.jscripty").controller("JscriptyProjectController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.projects=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="projects",f.listOrder="",f.listOrderAsc=null,f.selectedProjects=[],f.query={fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.jscripty.projects.edit",{id:e.id,project:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"ProjectcloneController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{project:e,projects:f.projects?f.projects.rows:[],crudPermissions:f.crudPermissions}})},f.sessionsgoto=function(e,n){t.go("app.jscripty.projects.edit",{id:e.id,tab:3})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("project")+"?").htmlContent("<b>"+(e.name||"project")+"</b> will be deleted.").ariaLabel("delete project").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getProjects=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.jscriptyProject.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Projects",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditProject=function(e,n){i.show({controller:"CreateOrEditProjectDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:n,projects:f.projects.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteProject=y,f.exportSelectedProjects=function(){var e=angular.copy(f.selectedProjects);return f.selectedProjects=[],e},f.deleteSelectedProjects=function(e){var n=i.confirm().title("Are you sure want to delete the selected projects?").htmlContent("<b>"+f.selectedProjects.length+" selected</b> will be deleted.").ariaLabel("delete Projects").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedProjects.forEach(function(e){y(e)}),f.selectedProjects=[]})},f.deselectProjects=function(){f.selectedProjects=[]},f.selectAllProjects=function(){f.selectedProjects=f.projects.rows};var b=!0,A=1;function E(e){f.projects=e||{count:0,rows:[]}}function y(e){m.jscriptyProject.delete({id:e.id}).$promise.then(function(){_.remove(f.projects.rows,{id:e.id}),f.projects.count-=1,f.projects.rows.length||f.getProjects(),p.success({title:_.startCase("Project")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEjscriptyProject"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEjscriptyProject",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getProjects())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","projects","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.jscripty").controller("JscriptyProjectsController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o,r,l,d,c,m,u){var p,g=this;function v(e){t.hide(e)}g.currentUser=l.getCurrentUser(),g.errors=[],g.setting=c,g.license=d,g.crudPermissions=m,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.mailAccount=angular.copy(s),g.mailAccounts=n,g.cloudProviders=o,g.providers=u.getEmailProviders(),g.newMailAccount=!1,g.mailAccount||(g.mailAccount={active:!0,service:"null",authentication:!0,fontSize:13,waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.newMailAccount=!0),e.params.id&&(g.mailAccount.MailAccountId=e.params.id),g.addNewMailAccount=function(){g.errors=[],r.mailAccount.save(g.mailAccount).$promise.then(function(e){g.mailAccounts.unshift(e.toJSON()),i.success({title:a.instant("MAIL.NOTIFICATIONS.ACCOUNT_CREATED_SUCCESS_TITLE")}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailAccount=function(){g.errors=[],r.mailAccount.update({id:g.mailAccount.id},g.mailAccount).$promise.then(function(e){var n=_.find(g.mailAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),i.success({title:a.instant("MAIL.NOTIFICATIONS.ACCOUNT_SAVED_SUCCESS_TITLE")}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailAccount.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailAccount=function(e){if(g.mailAccount.service)return i.error({title:"Mail Account not deleted!",msg:"You can't remove service account"});g.errors=[];var n=t.confirm().title(a.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_TITLE")).content(a.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_MESSAGE",{name:g.mailAccount.name})).ariaLabel("Delete Mail Account").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){r.mailAccount.delete({id:g.mailAccount.id}).$promise.then(function(){_.remove(g.mailAccounts,{id:g.mailAccount.id}),i.success({title:a.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETED_SUCCESS_TITLE")}),v(g.mailAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.onProviderChange=function(){"custom"!==g.mailAccount.provider&&(g.mailAccount.authentication=!0);"outlook365"!==g.mailAccount.provider&&(g.mailAccount.modernAuthentication=!1)},g.closeDialog=v,p=[{key:"id",value:Number(g.mailAccount.ListId)}],r.getResourcesByRole(g.currentUser,"cmList",{fields:"id,name",sort:"name",nolimit:"true"},p).then(function(e){g.lists=e.rows}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$mdDialog","$translate","toasty","mailAccounts","mailAccount","cloudProviders","api","Auth","license","setting","crudPermissions","msUtils"],angular.module("app.mail").controller("CreateOrEditMailAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.mailAccountApps.rows.length){var t=r.mailAccountApps.rows[n]?r.mailAccountApps.rows[n]:r.mailAccountApps.rows[0];i.show({controller:"EditMailAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccountApp:t,mailAccount:r.mailAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.mailAccountApps.rows[n]=e:r.mailAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.mailAccountApps.rows.length;t++,0){var a=r.mailAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.mailAccount.context,a.exten=r.mailAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.mailAccount.addApplications({id:r.mailAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.mailAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.mailAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.mailAccount={},r.mailAccountApps={count:0,rows:[]},r.selectedMailAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"MailQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"mailQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:601}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",nolimit:!0,role:"agent"},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Reply_Type",name:"replyType",type:"select",defaultValue:"1",values:[{option:"Reply",value:"0"},{option:"Reply All",value:"1"}],required:!0,param:1},{title:"Text",name:"text",type:"html",required:!0,param:2}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.mailAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getMailAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.mailAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getMailAccountApps=function(){r.promise=o.mailAccount.getApplications(r.query,t).$promise},r.editMailAccountApp=n,r.editInterval=function(e,n){if(r.mailAccountApps.rows.length){var t=r.mailAccountApps.rows[n]?r.mailAccountApps.rows[n]:r.mailAccountApps.rows[0];i.show({controller:"EditMailAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteMailAccountApp=function(e){_.remove(r.mailAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedMailAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedMailAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedMailAccountApps.forEach(function(e){_.remove(r.mailAccountApps.rows,{id:e.id})}),r.selectedMailAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.mail").controller("MailAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.mailAccount.getAgents({id:c.mailAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserMailAccount?"penalty "+e.UserMailAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.mailAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.mailAccount.removeAgents({id:c.mailAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.mailAccount.addAgents({id:c.mailAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("MAIL.ALL_AGENTS"),labelSelected:r.instant("MAIL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","mailAccount","mailAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.mail").controller("MailAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.agent.text=d.slice(2,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.autoreply.text=d.slice(2,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.replyType=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.autoreply.text=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.autoreply.times=1,l.autoreply.replyType=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.replyType,e[2]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.close.text=d.slice(2,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.gotoif.text=d.slice(2,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.gotop.text=d.slice(2,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditMailAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.noop.text=d.slice(2,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.queue.text=d.slice(2,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("mail")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.mailQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.mailQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:601}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.system.text=d.slice(2,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.tag.text=d.slice(2,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"mailAccount",action:"getDispositions",field:"name",params:{id:m.mailAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.mailAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.mailAccountInteractions.rows.length;n+=1){var t=m.mailAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,(void 0===m.query.closed||null===m.query.closed||m.query.closed)&&delete m.query.substatus,m.promise=d.mailInteraction.get(m.query,p).$promise}function v(e){d.mailInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.mailAccountInteractions.rows,{id:e.id}),m.mailAccountInteractions.count-=1,m.mailAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETmailAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){_.isEmpty(e.to)||_.includes(e.to,m.mailAccount.email)?e.contactInfo=e.Contact?e.Contact.email:void 0:(e.contactName=e.to.split(" <")[0],e.contactInfo=e.to.split("<").pop().split(">")[0]),"Unknown"===e.contactName&&(e.contactName=i.instant("MAIL.UNKNOWN"))}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.mailAccount={},m.mailAccountInteractions={count:0,rows:[]},m.selectedMailAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.mailAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.MailAccountId=m.mailAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"plainBody",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Substatus",column:"substatus",type:"multiselect",options:{field:"name",route:{model:"mailSubstatus",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){return d.mailSubstatus.get({nolimit:!0}).$promise.then(function(e){m.subStatuses=e||{count:0,rows:[]}})}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Substatus",key:"substatus",type:"select",label:"DASHBOARDS.SELECT_SUBSTATUS",options:m.subStatuses.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NONE"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name",ngIf:"closed === 0"},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.mailInteractionDownload=function(s,e,n){return d.mailInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="mail-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getMailAccountInteractions=g,m.createOrEditMailAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:m.mailAccount,interaction:n,interactions:m.mailAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spymailInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"mail",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"mail.mailAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||MailAccountId:=$eq["+m.mailAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedMailAccountInteractions=function(){var e=angular.copy(m.selectedMailAccountInteractions);return m.selectedMailAccountInteractions=[],e},m.deleteMailAccountInteraction=v,m.deleteSelectedMailAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedMailAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedMailAccountInteractions.forEach(function(e){v(e)}),m.selectedMailAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.mail").controller("MailAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.mailAccountMailCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.mailAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.mailAccountMailCannedAnswers.rows,{id:e.id}),m.mailAccountMailCannedAnswers.count-=1,m.mailAccountMailCannedAnswers.rows.length||p(),l.success({title:"MailCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETmailAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.mailAccount={},m.mailAccountMailCannedAnswers={count:0,rows:[]},m.selectedMailAccountMailCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.mailAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.MailAccountId=m.mailAccount.id,m.query.id=m.mailAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the mailCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("mailCannedAnswer #")+e.id||"mailCannedAnswer")+"</b> will be deleted.").ariaLabel("delete mailCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getMailAccountMailCannedAnswers=p,m.createOrEditMailAccountMailCannedAnswer=function(e,n){o.show({controller:"CreateOrEditMailCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/mailCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:m.mailAccount,mailCannedAnswer:n,mailCannedAnswers:m.mailAccountMailCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedMailAccountMailCannedAnswers=function(){var e=angular.copy(m.selectedMailAccountMailCannedAnswers);return m.selectedMailAccountMailCannedAnswers=[],e},m.deleteMailAccountMailCannedAnswer=g,m.deleteSelectedMailAccountMailCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected mailCannedAnswers?").htmlContent("<b>"+m.selectedMailAccountMailCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete mailCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedMailAccountMailCannedAnswers.forEach(function(e){g(e)}),m.selectedMailAccountMailCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.mail").controller("MailAccountMailCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MAIL.EDIT_MAILCANNEDANSWER",g.mailCannedAnswer=angular.copy(l),g.mailCannedAnswers=r,g.newMailCannedAnswer=!1,g.mailCannedAnswer||(g.mailCannedAnswer={},g.title="MAIL.NEW_MAILCANNEDANSWER",g.newMailCannedAnswer=!0),n.params.id&&(g.mailCannedAnswer.MailAccountId=n.params.id),g.addNewMailCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.mailCannedAnswer).$promise.then(function(e){g.mailCannedAnswers.unshift(e.toJSON()),o.success({title:"MailCannedAnswer properly created",msg:g.mailCannedAnswer.name?g.mailCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.mailCannedAnswer.id},g.mailCannedAnswer).$promise.then(function(e){var n=_.find(g.mailCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MailCannedAnswer properly saved!",msg:g.mailCannedAnswer.name?g.mailCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The mailCannedAnswer will be deleted.").ariaLabel("Delete MailCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.mailCannedAnswer.id}).$promise.then(function(){_.remove(g.mailCannedAnswers,{id:g.mailCannedAnswer.id}),o.success({title:"MailCannedAnswer properly deleted!",msg:(g.mailCannedAnswer.name||"mailCannedAnswer")+" has been deleted!"}),v(g.mailCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mailCannedAnswers","mailCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.mailAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.mailAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.MailAccountId=m.mailAccount.id,m.query.id=m.mailAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.mailAccount.id,field:"MailAccountId",route:"mailAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.mail").controller("MailAccountDispositionsController",e)}(),function(){"use strict";function e(t,a,i,s,e,n,o,r,l,d,c,m,u,p,g){var v,h,f=this;f.currentUser=d.getCurrentUser(),f.license=n,f.setting=o,f.passwordPattern=f.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",f.mailAccount=c||t.params.mailAccount||{},f.cloudProviders=m||{rows:[],count:0},f.userProfile=u,f.userProfileSection=p&&1==p.count?p.rows[0]:null,f.crudPermissions=d.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.hasModulePermissions={},f.selectedTab=t.params.tab||0,f.providers=g.getEmailProviders(),f.originalProvider=f.mailAccount.provider,f.goToRealtime=function(){return d.hasRole("admin")?t.go("app.mail.realtime.accounts",{}):r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n&&n.enabled)return t.go("app.mail.realtime.accounts",{});l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})})},f.addAgent=function(e,n){a.show({controller:"MailAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailAccount:e,mailAccounts:f.mailAccounts?f.mailAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.goToMailAccounts=function(){t.go("app.mail.mailAccounts",{},{reload:"app.mail.mailAccounts"})},f.saveMailAccount=function(){var e=angular.copy(f.mailAccount);"custom"===e.provider?e.provider=null:(f.originalProvider!==e.provider&&(e.Imap.modernAuthentication?e.Imap.password=null:e.Imap.CloudProviderId=null),e.Smtp.user=e.Imap.user,e.Smtp.pass=e.Imap.password,e.Imap.modernAuthentication||(e.Imap.CloudProviderId=null),e.Smtp.modernAuthentication=e.Imap.modernAuthentication,e.Smtp.CloudProviderId=e.Imap.CloudProviderId,e.Imap=_.omit(e.Imap,["host","port","service"]),e.Smtp=_.omit(e.Smtp,["host","port","secure","service"]));r.mailAccount.update({id:f.mailAccount.id},e).$promise.then(function(){f.originalProvider=e.provider,l.success({title:s.instant("MAIL.NOTIFICATIONS.ACCOUNT_SAVED_SUCCESS_TITLE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},f.onProviderChange=function(){"custom"!==f.mailAccount.provider&&(f.mailAccount.authentication=!0);"outlook365"!==f.mailAccount.provider&&(f.mailAccount.Imap.modernAuthentication=!1)},e.all((h=[{key:"id",value:Number(f.mailAccount.ListId)}],r.getResourcesByRole(f.currentUser,"cmList",{fields:"id,name",sort:"name",nolimit:"true"},h).then(function(e){f.lists=e.rows}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})})),(v=[{key:"id",value:Number(f.mailAccount.mandatoryDispositionPauseId)}],r.getResourcesByRole(f.currentUser,"pause",{fields:"id,name",sort:"name",nolimit:"true"},v).then(function(e){f.pauses=e.rows}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})})))}e.$inject=["$state","$mdDialog","$document","$translate","$q","license","setting","api","toasty","Auth","mailAccount","cloudProviders","userProfile","userProfileSection","msUtils"],angular.module("app.mail").controller("MailAccountController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,n,r,l,d,c,m,u,p){var g=this;function v(e){g.mailAccounts=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.hasRole("admin")?g.promise=d.mailAccount.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="MailAccounts",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){if(e.service)return c.error({msg:o.instant("MAIL.NOTIFICATIONS.ACCOUNT_SERVICE_DELETE")});d.mailAccount.delete({id:e.id}).$promise.then(function(){_.remove(g.mailAccounts.rows,{id:e.id}),g.mailAccounts.count-=1,g.mailAccounts.rows.length||h(),c.success({title:o.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailAccount"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.mailAccounts=n||{count:0,rows:[]},g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedMailAccounts=[],g.query={fields:"createdAt,updatedAt,id,name,provider,key,email,ListId,active,service,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},g.editstate=function(e){t.go("app.mail.mailAccounts.edit",{id:e.id,mailAccount:e,crudPermissions:g.crudPermissions})},g.verifySMTP=function(e){return e&&e.id?d.mailAccount.verifySmtp({id:e.id}).$promise.then(function(){c.success({title:o.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_SUCCESS_TITLE")})}).catch(function(e){c.error({title:o.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_FAIL_TITLE"),msg:e.data?JSON.stringify(e.data):e.toString()})}):c.error({title:o.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_FAIL_TITLE"),msg:o.instant("MAIL.NOTIFICATIONS.UNKNOWN_SMTP_SERVER")})},g.goToInteractions=function(e){t.go("app.mail.mailAccounts.edit",{id:e.id,tab:"custom"===e.provider?7:6})},g.goToRealtime=function(){return m.hasRole("admin")?t.go("app.mail.realtime.accounts",{}):d.userProfileSection.get({userProfileId:m.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n&&n.enabled)return t.go("app.mail.realtime.accounts",{});c.info({title:o.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:o.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})})},g.addAgent=function(e,n){a.show({controller:"MailAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailAccount:e,mailAccounts:g.mailAccounts?g.mailAccounts.rows:[],crudPermissions:g.crudPermissions,realtime:!1}})},g.deleteconfirm=function(e,n){var t=a.confirm().title(o.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_TITLE")).content(o.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_MESSAGE",{name:e.name})).ariaLabel("delete mail account").targetEvent(n).ok("OK").cancel(o.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.success=v,g.getMailAccounts=h,g.createOrEditMailAccount=function(e,n){a.show({controller:"CreateOrEditMailAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:n,mailAccounts:g.mailAccounts.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions},resolve:{cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,name",sort:"name",type:"outlook365"})}]}})},g.deleteMailAccount=f,g.exportSelectedMailAccounts=function(){var e=angular.copy(g.selectedMailAccounts);return g.selectedMailAccounts=[],e},g.deleteSelectedMailAccounts=function(e){var n=a.confirm().title(o.instant("MAIL.NOTIFICATIONS.ACCOUNTS_DELETE_TITLE")).content(o.instant("MAIL.NOTIFICATIONS.ACCOUNTS_DELETE_MESSAGE",{total:g.selectedMailAccounts.length})).ariaLabel("delete mail accounts").targetEvent(e).ok("OK").cancel(o.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedMailAccounts.forEach(function(e){f(e)}),g.selectedMailAccounts=[],c.success({title:o.instant("MAIL.NOTIFICATIONS.ACCOUNTS_DELETED_SUCCESS_TITLE")})})},g.deselectMailAccounts=function(){g.selectedMailAccounts=[]},g.selectAllMailAccounts=function(){g.selectedMailAccounts=g.mailAccounts.rows};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?s(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","mailAccounts","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.mail").controller("MailAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MAIL.EDIT_MAILQUEUE",g.mailQueue=angular.copy(l),g.mailQueues=r,g.newMailQueue=!1,g.mailQueue||(g.mailQueue={strategy:"beepall",timeout:10},g.title="MAIL.NEW_MAILQUEUE",g.newMailQueue=!0),g.addNewMailQueue=function(){g.errors=[],d.mailQueue.save(g.mailQueue).$promise.then(function(e){g.mailQueues.unshift(e.toJSON()),o.success({title:"MailQueue properly created",msg:g.mailQueue.name?g.mailQueue.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailQueue=function(){g.errors=[],d.mailQueue.update({id:g.mailQueue.id},g.mailQueue).$promise.then(function(e){var n=_.find(g.mailQueues,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MailQueue properly saved!",msg:g.mailQueue.name?g.mailQueue.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailQueue=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The mailQueue will be deleted.").ariaLabel("Delete MailQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.mailQueue.delete({id:g.mailQueue.id}).$promise.then(function(){_.remove(g.mailQueues,{id:g.mailQueue.id}),o.success({title:"MailQueue properly deleted!",msg:(g.mailQueue.name||"mailQueue")+" has been deleted!"}),v(g.mailQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mailQueues","mailQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.mailQueue.getAgents({id:c.mailQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserMailQueue?"penalty "+e.UserMailQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.mailQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.removeAgents({id:c.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.addAgents({id:c.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("MAIL.ALL_AGENTS"),labelSelected:r.instant("MAIL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","mailQueue","mailQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.mail").controller("MailQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.mailQueue.getTeams({id:l.mailQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.mailQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MAIL.ALL_TEAMS"),labelSelected:t.instant("MAIL.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.removeTeams({id:l.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.addTeams({id:l.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","mailQueue","$translate","Auth","crudPermissions"],angular.module("app.mail").controller("MailQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.mailQueue=c||e.params.mailQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"MailQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:u.mailQueues?u.mailQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:u.mailQueues?u.mailQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoMailQueues=function(){e.go("app.mail.mailQueues",{},{reload:"app.mail.mailQueues"})},u.saveMailQueue=function(){r.mailQueue.update({id:u.mailQueue.id},u.mailQueue).$promise.then(function(){l.success({title:"MailQueue updated!",msg:u.mailQueue.name?u.mailQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","mailQueue","userProfileSection"],angular.module("app.mail").controller("MailQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.mailQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="mailQueues",f.listOrder="",f.listOrderAsc=null,f.selectedMailQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"mail",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.mail.mailQueues.edit",{id:e.id,mailQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"MailQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:f.mailQueues?f.mailQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:f.mailQueues?f.mailQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("mailQueue")+"?").htmlContent("<b>"+(e.name||"mailQueue")+"</b> will be deleted.").ariaLabel("delete mailQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.mail.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.mail.realtime.queues",{})}},f.success=E,f.getMailQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.mailQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="MailQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMailQueue=function(e,n){i.show({controller:"CreateOrEditMailQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailQueue:n,mailQueues:f.mailQueues.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteMailQueue=y,f.exportSelectedMailQueues=function(){var e=angular.copy(f.selectedMailQueues);return f.selectedMailQueues=[],e},f.deleteSelectedMailQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected mailQueues?").htmlContent("<b>"+f.selectedMailQueues.length+" selected</b> will be deleted.").ariaLabel("delete MailQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMailQueues.forEach(function(e){y(e)}),f.selectedMailQueues=[]})},f.deselectMailQueues=function(){f.selectedMailQueues=[]},f.selectAllMailQueues=function(){f.selectedMailQueues=f.mailQueues.rows};var b=!0,A=1;function E(e){f.mailQueues=e||{count:0,rows:[]}}function y(e){m.mailQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.mailQueues.rows,{id:e.id}),f.mailQueues.count-=1,f.mailQueues.rows.length||f.getMailQueues(),p.success({title:_.startCase("MailQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEmailQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMailQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","mailQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.mail").controller("MailQueuesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MAIL.EDIT_MAILSUBSTATUS",g.mailSubstatus=angular.copy(l),g.mailSubtatuses=r,g.newMailSubstatus=!1,g.mailSubstatus||(g.mailSubstatus={},g.title="MAIL.NEW_MAILSUBSTATUS",g.newMailSubstatus=!0),g.addNewMailSubstatus=function(){g.errors=[],d.mailSubstatus.save(g.mailSubstatus).$promise.then(function(e){g.mailSubtatuses.unshift(e.toJSON()),o.success({title:"MailSubstatus properly created",msg:g.mailSubstatus.name?g.mailSubstatus.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailSubstatus.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailSubstatus.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailSubstatus=function(){g.errors=[],d.mailSubstatus.update({id:g.mailSubstatus.id},g.mailSubstatus).$promise.then(function(e){var n=_.find(g.mailSubtatuses,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MailSubstatus properly saved!",msg:g.mailSubstatus.name?g.mailSubstatus.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailSubstatus.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailSubstatus.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailSubstatus=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The mailSubstatus will be deleted.").ariaLabel("Delete MailSubstatus").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.mailSubstatus.delete({id:g.mailSubstatus.id}).$promise.then(function(){_.remove(g.mailSubtatuses,{id:g.mailSubstatus.id}),o.success({title:"MailSubstatus properly deleted!",msg:(g.mailSubstatus.name||"mailSubstatus")+" has been deleted!"}),v(g.mailSubstatus)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailSubstatus.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailSubstatus.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mailSubtatuses","mailSubstatus","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailSubstatusDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.mailSubtatuses=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="mailSubtatuses",f.listOrder="",f.listOrderAsc=null,f.selectedMailSubstatuses=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditMailSubstatusDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailSubtatuses/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailSubstatus:e,mailSubtatuses:f.mailSubtatuses.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("mailSubstatus")+"?").htmlContent("<b>"+(e.name||"mailSubstatus")+"</b> will be deleted.").ariaLabel("delete mailSubstatus").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getMailSubstatuses=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.mailSubstatus.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="MailSubstatuses",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMailSubstatus=function(e,n){i.show({controller:"CreateOrEditMailSubstatusDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailSubtatuses/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailSubstatus:n,mailSubtatuses:f.mailSubtatuses.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteMailSubstatus=y,f.exportSelectedMailSubstatuses=function(){var e=angular.copy(f.selectedMailSubstatuses);return f.selectedMailSubstatuses=[],e},f.deleteSelectedMailSubstatuses=function(e){var n=i.confirm().title("Are you sure want to delete the selected mailSubtatuses?").htmlContent("<b>"+f.selectedMailSubstatuses.length+" selected</b> will be deleted.").ariaLabel("delete MailSubstatuss").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMailSubstatuses.forEach(function(e){y(e)}),f.selectedMailSubstatuses=[]})},f.deselectMailSubstatuses=function(){f.selectedMailSubstatuses=[]},f.selectAllMailSubstatuses=function(){f.selectedMailSubstatuses=f.mailSubtatuses.rows};var b=!0,A=1;function E(e){f.mailSubtatuses=e||{count:0,rows:[]}}function y(e){m.mailSubstatus.delete({id:e.id}).$promise.then(function(){_.remove(f.mailSubtatuses.rows,{id:e.id}),f.mailSubtatuses.count-=1,f.mailSubtatuses.rows.length||f.getMailSubstatuses(),p.success({title:_.startCase("MailSubstatus")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailSubstatus"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEmailSubstatus",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMailSubstatuses())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","mailSubtatuses","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.mail").controller("MailSubstatusesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){_.forIn(p.mailAccounts,function(e,n){p.rpcMailAccounts[n]&&_.merge(e,p.rpcMailAccounts[n])}),_.forIn(p.mailAccounts,function(n,e){var t={id:e,sort:"-id",direction:"in",limit:1,offset:0,$gte:"createdAt,"+moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),fields:"id,createdAt"};s.mailAccount.getMessages(t).$promise.then(function(e){return e&&(n.in=e.count||0,n.lastIn=e.rows&&e.rows.length?e.rows[0].createdAt:void 0),t.direction="out",s.mailAccount.getMessages(t).$promise}).then(function(e){e&&(n.out=e.count||0,n.lastOut=e.rows&&e.rows.length?e.rows[0].createdAt:void 0)}).catch(function(e){console.log(e)})})}p.currentUser=u.getCurrentUser(),p.count=l&&l.count?l.count:0,p.mailAccounts=l?_.keyBy(l.rows?l.rows:[],"id"):{},p.rpcMailAccounts=d?_.keyBy(d.rows?d.rows:[],"id"):{},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.query={sort:"-name",limit:10,page:1},p.success=f,p.$onInit=g,p.getMailAccounts=function(){p.query.offset=(p.query.page-1)*p.query.limit,u.hasRole("admin")?p.promise=s.mailAccount.get(p.query,f).$promise:(p.query.id=p.userProfile.id,p.query.section="MailAccounts",p.promise=s.userProfile.getResources(p.query,f).$promise)},p.onSave=function(e){p.mailAccounts[e.id]&&_.merge(p.mailAccounts[e.id],e)},p.onMailMessageSave=function(e){p.mailAccounts[e.MailAccountId]&&("in"==e.direction?(p.mailAccounts[e.MailAccountId].in+=1,p.mailAccounts[e.MailAccountId].lastIn=e.createdAt):(p.mailAccounts[e.MailAccountId].out+=1,p.mailAccounts[e.MailAccountId].lastOut=e.createdAt))},p.goToMailAccount=function(e,n){i.go("app.mail.mailAccounts.edit",{id:n.id,mailAccount:n})},p.verifySmtp=function(e,n){{if(n&&n.id)return s.mailAccount.verifySmtp({id:n.id}).$promise.then(function(){r.success({title:"Smtp properly verified",msg:"Connection succeded!"})}).catch(function(e){r.error({title:"Smtp properly verified",msg:e.data?JSON.stringify(e.data):e.toString()})});r.error({title:"Smtp properly verified",msg:"Smpt id unknown"})}},p.order=[],_.forIn(p.mailAccounts,function(e,n){p.order.push(e.id)}),o.on("mailAccount:save",p.onSave),o.on("mailAccount:update",p.onSave),o.on("mailMessage:save",p.onMailMessageSave);var v=!0,h=1;function f(e){if(p.mailAccounts=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){p.order=[];for(var n=0;n<e.rows.length;n++)p.order.push(e.rows[n].id)}g()}e.$watch("vm.query.filter",function(e,n){v?t(function(){v=!1}):(n||(h=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=h),p.getMailAccounts())}),e.$on("$destroy",function(){o.removeAllListeners("mailAccount:save"),o.removeAllListeners("mailAccount:update"),o.removeAllListeners("mailMessage:save")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$state","api","socket","toasty","mailAccounts","rpcMailAccounts","userProfile","userProfileSection","Auth"],angular.module("app.mail").controller("MailAccountsRealtimeController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=["loggedIn","available","waiting","paused"],g=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"MailQueues":void 0,channel:"mail",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("MAIL.MAILQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditMailQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailQueue:n,mailQueues:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailQueue:n,mailQueues:u.queues.rows,realtime:!1,crudPermissions:u.crudPermissions}})},r.on("mail_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,p))}),r.on("userMailQueue:save",function(e){var n=_.find(u.queues.rows,["id",e.MailQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("userMailQueue:remove",function(e){var n=_.find(u.queues.rows,["id",e.MailQueueId]);n&&(0<n.loggedInDb&&n.loggedInDb--,_.remove(n.agents,["id",e.UserId]))}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"mail")})}),e.$on("$destroy",function(){r.removeAllListeners("mail_queue:save"),r.removeAllListeners("userMailQueue:remove"),r.removeAllListeners("userMailQueue:save"),r.removeAllListeners("user:update"),g&&n.cancel(g)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.mail").controller("QueuesMailRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.mail.realtime.agents":this.selectedTab=0;break;case"app.mail.realtime.queues":this.selectedTab=1;break;case"app.mail.realtime.accounts":this.selectedTab=2;break;default:this.selectedTab=0,t.go("app.mail.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.mail.realtime.agents");break;case 1:t.go("app.mail.realtime.queues");break;case 2:t.go("app.mail.realtime.accounts");break;default:t.go("app.mail.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.mail").controller("MailRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MARKETPLACE.EDIT_PLUGIN",g.plugin=angular.copy(l),g.plugins=r,g.newPlugin=!1,g.plugin||(g.plugin={},g.title="MARKETPLACE.NEW_PLUGIN",g.newPlugin=!0),g.addNewPlugin=function(){g.errors=[],d.plugin.save(g.plugin).$promise.then(function(e){g.plugins.unshift(e.toJSON()),o.success({title:"Plugin properly created",msg:g.plugin.name?g.plugin.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savePlugin=function(){g.errors=[],d.plugin.update({id:g.plugin.id},g.plugin).$promise.then(function(e){var n=_.find(g.plugins,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Plugin properly saved!",msg:g.plugin.name?g.plugin.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletePlugin=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The plugin will be deleted.").ariaLabel("Delete Plugin").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.plugin.delete({id:g.plugin.id}).$promise.then(function(){_.remove(g.plugins,{id:g.plugin.id}),o.success({title:"Plugin properly deleted!",msg:(g.plugin.name||"plugin")+" has been deleted!"}),v(g.plugin)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","plugins","plugin","api","Auth","license","setting","crudPermissions"],angular.module("app.marketplace").controller("CreateOrEditPluginDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.plugin=c||e.params.plugin||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoPlugins=function(){e.go("app.marketplace.plugins",{},{reload:"app.marketplace.plugins"})},u.savePlugin=function(){r.plugin.update({id:u.plugin.id},u.plugin).$promise.then(function(){l.success({title:"Plugin updated!",msg:u.plugin.name?u.plugin.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETplugin",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","plugin","userProfileSection"],angular.module("app.marketplace").controller("MarketplacePluginController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.plugins=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="plugins",f.listOrder="",f.listOrderAsc=null,f.selectedPlugins=[],f.query={fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"-updatedAt",limit:10,page:1},f.installing=!1,f.arraysidebar=_.keyBy([{option:"Always",value:"'always'"},{option:"Admin Only",value:"'adminOnly'"},{option:"Agent Only",value:"'agentOnly'"},{option:"Never",value:"'never'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.installplugin=function(e){{if("script"!==e.type)return e.active=!0,m.plugin.update({id:e.id},e).$promise.then(function(){p.success({title:"Plugin installed!",msg:e.name?e.name+" has been installed!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});f.installing=!0,m.pm2.save({name:e.scriptName,script:e.path+"/"+e.scriptPath}).$promise.then(function(){return e.active=!0,m.plugin.update({id:e.id},e).$promise}).then(function(){f.installing=!1,p.success({title:"Plugin installed!",msg:e.name?e.name+" has been installed!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.save"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.save",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}},f.editstate=function(e,n){t.go("app.marketplace.plugins.edit",{id:e.id,plugin:e,crudPermissions:f.crudPermissions})},f.stopplugin=function(e,n){var t=i.confirm().title("Are you sure want to stop the plugin attached process?").htmlContent("<b>"+(e.name||"plugin")+"</b> attached process will be stoppped.").ariaLabel("stop plugin process").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){var t;t=e,m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var n=_.find(e.rows,{name:t.scriptName});if(!n)throw new Error("No corresponding process found");m.pm2.update({id:n.pm_id,status:"stopped"}).$promise.then(function(){p.success({title:"Process stopped!",msg:"Attached pm2 process successfully stopped"})})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){console.log("CANCEL")})},f.restartplugin=function(e,n){var t=i.confirm().title("Are you sure want to restart the plugin attached process?").htmlContent("<b>"+(e.name||"plugin")+"</b> attached process will be restarted.").ariaLabel("restart plugin process").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){var t;t=e,m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var n=_.find(e.rows,{name:t.scriptName});if(!n)throw new Error("No corresponding process found");m.pm2.update({id:n.pm_id,status:"online"}).$promise.then(function(){p.success({title:"Process restarted!",msg:"Attached pm2 process successfully restarted"})})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){console.log("CANCEL")})},f.downloadfile2=function(s,e){return m.plugin.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.name.replace(" ","_").toLowerCase()+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.uninstallplugin=function(e,n){var t=i.confirm().title("Are you sure want to uninstall the plugin?").htmlContent("<b>"+(e.name||"plugin")+"</b> will be uninstalled.").ariaLabel("uninstall plugin").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){!function(t){"script"===t.type&&m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var n=_.find(e.rows,{name:t.scriptName});if(!n)throw new Error("No corresponding process found");m.pm2.delete({id:n.pm_id,name:t.scriptName}).$promise}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});t.active=!1,m.plugin.update({id:t.id},t).$promise.then(function(){p.success({title:"Plugin uninstalled!",msg:t.name?t.name+" has been uninstalled!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}(e)},function(){console.log("CANCEL")})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("plugin")+"?").htmlContent("<b>"+(e.name||"plugin")+"</b> will be deleted.").ariaLabel("delete plugin").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getPlugins=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.plugin.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Plugins",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditPlugin=function(e,n){i.show({controller:"CreateOrEditPluginDialogController",controllerAs:"vm",templateUrl:"app/main/apps/marketplace/views/plugins/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{plugin:n,plugins:f.plugins.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletePlugin=y,f.exportSelectedPlugins=function(){var e=angular.copy(f.selectedPlugins);return f.selectedPlugins=[],e},f.deleteSelectedPlugins=function(e){var n=i.confirm().title("Are you sure want to delete the selected plugins?").htmlContent("<b>"+f.selectedPlugins.length+" selected</b> will be deleted.").ariaLabel("delete Plugins").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedPlugins.forEach(function(e){y(e)}),f.selectedPlugins=[]})},f.deselectPlugins=function(){f.selectedPlugins=[]},f.selectAllPlugins=function(){f.selectedPlugins=f.plugins.rows},f.uploadPlugin=function(e){i.show({controller:"UploadPluginDialogController",controllerAs:"vm",templateUrl:"app/main/apps/marketplace/views/plugins/upload/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{plugins:f.plugins.rows}})};var b=!0,A=1;function E(e){f.plugins=e||{count:0,rows:[]}}function y(t){t.active&&"script"==t.type&&m.pm2.get().$promise.then(function(e){if(!e||!e.rows)return p.error({title:"Plugin not deleted!",msg:"Failed to retrieve pm2 processes"});var n=_.find(e.rows,{name:t.scriptName});n?m.pm2.delete({id:n.pm_id,name:t.scriptName}).$promise:console.log("No '%s' process found",t.scriptName)}).catch(function(e){return p.error({title:"PM2 process not found!",msg:"Failed to delete the attached pm2 process"})}),m.plugin.delete({id:t.id}).$promise.then(function(){_.remove(f.plugins.rows,{id:t.id}),f.plugins.count-=1,f.plugins.rows.length||f.getPlugins(),p.success({title:_.startCase("Plugin")+" deleted!",msg:t.name?t.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEplugin"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEplugin",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getPlugins())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","plugins","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.marketplace").controller("MarketplacePluginsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this,r=4,l=1024*r*1024;o.currentUser=s.getCurrentUser(),o.errors=[],o.title="MARKETPLACE.UPLOAD_PLUGIN",o.plugins=a,o.uploadPlugins=[],o.uploadState="none",o.plugin={},o.ngFlowOptions={maxChunkRetries:1,chunkSize:l,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0,target:"api/plugins"},o.ngFlow={flow:{}},o.dropping=!1,o.fileAdded=function(e){var n=["zip"];if(!_.includes(n,e.getExtension()))return t.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(e.size>l)return t.error({title:"File too big",msg:"The max allowed size is "+r+"MB"}),!1;return o.plugin={id:e.uniqueIdentifier,file:e},o.uploadPlugins.unshift(o.plugin),!0},o.upload=function(){o.uploadState="uploading",o.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},o.ngFlow.flow.opts.query={role:o.currentUser.role,userProfileId:o.currentUser.userProfileId},o.ngFlow.flow.upload()},o.fileSuccess=function(a,e){o.plugins.unshift(JSON.parse(e)),angular.forEach(o.uploadPlugins,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result}}})},o.uploadError=function(e,n){o.ngFlow.flow.cancel(),t.error({title:"Upload error",msg:"Cannot upload the plugin"}),o.uploadState="failed"},o.uploadComplete=function(){"failed"!==o.uploadState&&(o.uploadState="completed",t.success({title:"Upload completed",msg:o.plugin.file.name+" uploaded successfully"}))},o.closeDialog=function(){n.hide()}}e.$inject=["$cookies","$mdDialog","toasty","plugins","api","Auth"],angular.module("app.marketplace").controller("UploadPluginDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this;function h(e){a.hide(e)}v.currentUser=c.getCurrentUser(),v.errors=[],v.setting=u,v.license=m,v.crudPermissions=p,v.hasModulePermissions={},v.passwordPattern=v.setting&&v.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",v.title="MOTIONDIALER.EDIT_HOPPER",v.hopper=angular.copy(l),v.hoppers=r,v.newHopper=!1,v.contact,v.dateTime,v.hopper||(v.hopper={},v.title="MOTIONDIALER.NEW_HOPPER",v.newHopper=!0),n.params.id&&("IvrCampaign"===g?v.hopper.CampaignId=n.params.id:"QueueCampaign"==g?v.hopper.VoiceQueueId=n.params.id:v.hopper.ContactId=n.params.id),v.addNewHopper=function(){v.errors=[],d.cmHopper.save(v.hopper).$promise.then(function(e){v.hoppers.unshift(e.toJSON()),o.success({title:"Hopper properly created",msg:v.hopper.name?v.hopper.name+" has been created!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.saveHopper=function(){var t,a,i,s;v.errors=[],v.hopper.UserId=v.hopper.recallme?v.hopper.UserId:null,v.hopper.OwnerId=c.getCurrentUser().id,d.cmHopper.get({id:v.hopper.id,attributes:["scheduledat"]}).$promise.then(function(e){t=_.isNil(e)||_.isEmpty(e)?moment().format("YYYY-MM-DD HH:mm:ss"):e.scheduledat}).finally(function(){v.hopper.dialTimezone=v.contact.dialTimezone,d.cmHopper.update({id:v.hopper.id},_.omit(v.hopper,["VoiceQueueId","CampaignId","ContactId","ListId"])).$promise.then(function(e){a=e,d.cmContact.get({id:a.ContactId,attributes:["firstName","lastName"]}).$promise.then(function(e){_.isNil(e)||_.isNil(e.firstName)||(i=e.firstName,_.isNil(e.lastName)||(i+=" "+e.lastName))}).catch(function(){i=void 0}).finally(function(){d.voiceQueue.get({raw:!1,id:a.VoiceQueueId,attributes:["name"]}).$promise.then(function(e){s=e.name}).catch(function(e){s=void 0}).finally(function(){d.cmHopperHistory.save({state:24,statedesc:"Edited",scheduledat:t,calleridnum:a.phone,calleridname:i,campaigntype:a.VoiceQueueId?"queue":"ivr",campaign:s,editedat:moment().format("YYYY-MM-DD HH:mm:ss"),edited:!0,ListId:a.ListId,UserId:c.getCurrentUser().id,VoiceQueueId:a.VoiceQueueId,CampaignId:a.CampaignId,ContactId:a.ContactId,callback:a.callback,callbackuniqueid:a.callbackuniqueid,countbusyretry:a.countbusyretry,countcongestionretry:a.countcongestionretry,countglobal:a.countglobal,countnoanswerretry:a.countnoanswerretry,followuptime:a.followuptime,recallme:a.recallme}).$promise.then(function(){d.cmContact.update({id:a.ContactId,dialTimezone:v.contact.dialTimezone})})})});var n=_.find(v.hoppers,{id:e.id});n&&_.merge(n,_.pick(e.toJSON(),_.keys(n))),o.success({title:"Hopper properly saved!",msg:v.hopper.name?v.hopper.name+" has been saved!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})})},v.deleteHopper=function(e){v.errors=[];var n=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmHopper.delete({id:v.hopper.id}).$promise.then(function(){_.remove(v.hoppers,{id:v.hopper.id}),o.success({title:"Hopper properly deleted!",msg:(v.hopper.name||"hopper")+" has been deleted!"}),h(v.hopper)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},v.getDateFromString=function(e){return null===e?void 0:new Date(e)},v.closeDialog=h,v.recalcTZTime=function(){if(_.isNil(v.hopper.VoiceQueueId)){var e=v.hopper.CampaignId;d.campaign.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(v.hopper.dialTimezone=e.dialTimezone,n)d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.hopper.scheduledat=moment(v.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})});else{d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledat=moment(v.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}})}else{var e=v.hopper.VoiceQueueId;e&&d.voiceQueue.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(v.hopper.dialTimezone=e.dialTimezone,n)d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.hopper.scheduledat=moment(v.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})});else{d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledat=moment(v.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}})}},c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){v.agents=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){v.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(v.agents,{id:e.resourceId})}),t=null;if(v.hopper&&(t=_.find(v.agents,{id:Number(v.hopper.UserId)})),t&&!_.some(n,["id",t.id])){var a=_.find(v.agents,{id:t.id});a.canSelect=!1,n.push(a)}v.agents=n})}else{var t=[],a=null;v.hopper&&(a=_.find(v.agents,{id:Number(v.hopper.UserId)}));for(var i=0;i<v.agents.length;i++)a&&v.agents[i].id===a.id&&(v.agents[i].canSelect=!1,t.push(v.agents[i]));v.agents=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.cmContact.get({id:v.hopper.ContactId,fields:"dialTimezone"}).$promise.then(function(e){var n;v.contact=e,_.isNil(v.hopper.VoiceQueueId)?(n=v.hopper.CampaignId)&&d.campaign.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;v.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.dateTime=moment(v.hopper.scheduledat).add(n-t,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.dateTime=moment(v.hopper.scheduledat).add(n-0,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):(n=v.hopper.VoiceQueueId)&&d.voiceQueue.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;v.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.dateTime=moment(v.hopper.scheduledat).add(n-t,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.dateTime=moment(v.hopper.scheduledat).add(n-0,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","hoppers","hopper","api","Auth","license","setting","crudPermissions","from"],angular.module("app.motiondialer").controller("HopperdateController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_IVRCAMPAIGN",g.ivrCampaign=angular.copy(l),g.ivrCampaigns=r,g.newIvrCampaign=!1,g.ivrCampaign||(g.ivrCampaign={active:!0,type:"ivr",dialCheckDuplicateType:"always",dialCutDigit:0,limitCalls:30,dialRandomLastDigitCallerIdNumber:0,dialOriginateTimeout:30,dialGlobalMaxRetry:4,dialCongestionMaxRetry:3,dialCongestionRetryFrequency:150,dialBusyMaxRetry:3,dialBusyRetryFrequency:150,dialNoAnswerMaxRetry:3,dialNoAnswerRetryFrequency:150,dialNoSuchNumberMaxRetry:3,dialNoSuchNumberRetryFrequency:150,dialDropMaxRetry:3,dialDropRetryFrequency:150,dialAbandonedMaxRetry:3,dialAbandonedRetryFrequency:150,dialMachineMaxRetry:3,dialMachineRetryFrequency:150,dialAgentRejectMaxRetry:3,dialAgentRejectRetryFrequency:150,dialOrderByScheduledAt:"ASC",dialGlobalInterval:"07:00-22:00,*,*,*",dialAMDInitialSilence:2500,dialAMDGreeting:1500,dialAMDAfterGreetingSilence:800,dialAMDTotalAnalysisTime:5e3,dialAMDMinWordLength:100,dialAMDBetweenWordsSilence:50,dialAMDMaximumNumberOfWords:3,dialAMDSilenceThreshold:256,dialAMDMaximumWordLength:5e3},g.title="MOTIONDIALER.NEW_IVRCAMPAIGN",g.newIvrCampaign=!0),g.addNewIvrCampaign=function(){g.errors=[],d.campaign.save(g.ivrCampaign).$promise.then(function(e){g.ivrCampaigns.unshift(e.toJSON()),o.success({title:"IvrCampaign properly created",msg:g.ivrCampaign.name?g.ivrCampaign.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveIvrCampaign=function(){g.errors=[],d.campaign.update({id:g.ivrCampaign.id},g.ivrCampaign).$promise.then(function(e){var n=_.find(g.ivrCampaigns,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"IvrCampaign properly saved!",msg:g.ivrCampaign.name?g.ivrCampaign.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteIvrCampaign=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The ivrCampaign will be deleted.").ariaLabel("Delete IvrCampaign").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.campaign.delete({id:g.ivrCampaign.id}).$promise.then(function(){_.remove(g.ivrCampaigns,{id:g.ivrCampaign.id}),o.success({title:"IvrCampaign properly deleted!",msg:(g.ivrCampaign.name||"ivrCampaign")+" has been deleted!"}),v(g.ivrCampaign)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){g.trunks=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){g.trunks=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})});g.trunks.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),g.trunks=n})}else g.trunks=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.projects=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.projects=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.projects,{id:e.resourceId})}),t=null;if(g.ivrCampaign&&(t=_.find(g.projects,{id:Number(g.ivrCampaign.SquareProjectId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.projects,{id:t.id});a.canSelect=!1,n.push(a)}g.projects=n})}else{var t=[],a=null;g.ivrCampaign&&(a=_.find(g.projects,{id:Number(g.ivrCampaign.SquareProjectId)}));for(var i=0;i<g.projects.length;i++)a&&g.projects[i].id===a.id&&(g.projects[i].canSelect=!1,t.push(g.projects[i]));g.projects=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),t=null;if(g.ivrCampaign&&(t=_.find(g.interval,{id:Number(g.ivrCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.interval,{id:t.id});a.canSelect=!1,n.push(a)}g.interval=n})}else{var t=[],a=null;g.ivrCampaign&&(a=_.find(g.interval,{id:Number(g.ivrCampaign.IntervalId)}));for(var i=0;i<g.interval.length;i++)a&&g.interval[i].id===a.id&&(g.interval[i].canSelect=!1,t.push(g.interval[i]));g.interval=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","ivrCampaigns","ivrCampaign","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditIvrCampaignDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.ivrCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.ivrCampaign=n,d.crudPermissions=l,d.apiRoute="campaign",d.getApi="getBlackLists",d.addApi="addBlackLists",d.removeApi="removeBlackLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","ivrCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("IvrCampaignblacklistaddController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newIvrCampaign=!0,r.ivrCampaign=angular.copy(i),r.ivrCampaigns=s,r.title=o.instant("MOTIONDIALER.CLONE_IVRCAMPAIGN"),i&&i.name&&(r.title+=": "+i.name),r.cloneIvrCampaign=function(){return e.campaign.clone({id:i.id},r.ivrCampaign).$promise.then(function(e){r.ivrCampaigns.unshift(e.toJSON()),a.success({title:"IvrCampaign properly cloned",msg:r.ivrCampaign.name?r.ivrCampaign.name+" has been cloned!":""}),t.go("app.motiondialer.ivrCampaigns.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","ivrCampaign","ivrCampaigns","$translate"],angular.module("app.motiondialer").controller("IvrCampaigncloneController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHopperBlacks=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHopperBlacks(m.query,u).$promise}function g(e){d.hopperBlack.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHopperBlacks.rows,{id:e.id}),m.ivrCampaignHopperBlacks.count-=1,m.ivrCampaignHopperBlacks.rows.length||p(),l.success({title:"HopperBlack deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.ivrCampaign={},m.ivrCampaignHopperBlacks={count:0,rows:[]},m.selectedIvrCampaignHopperBlacks=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,ContactId,phone",sort:"-id",limit:10,page:1},m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperBlack?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperBlack #")+e.id||"hopperBlack")+"</b> will be deleted.").ariaLabel("delete hopperBlack").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHopperBlacks=p,m.createOrEditIvrCampaignHopperBlack=function(e,n){o.show({controller:"CreateOrEditHopperBlackDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperBlacks/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopperBlack:n,hopperBlacks:m.ivrCampaignHopperBlacks.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIvrCampaignHopperBlacks=function(){var e=angular.copy(m.selectedIvrCampaignHopperBlacks);return m.selectedIvrCampaignHopperBlacks=[],e},m.deleteIvrCampaignHopperBlack=g,m.deleteSelectedIvrCampaignHopperBlacks=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperBlacks?").htmlContent("<b>"+m.selectedIvrCampaignHopperBlacks.length+" selected</b> will be deleted.").ariaLabel("delete hopperBlacks").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperBlacks.forEach(function(e){g(e)}),m.selectedIvrCampaignHopperBlacks=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperBlacksController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHopperFinals=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHopperFinals(m.query,u).$promise}function g(e){d.hopperFinal.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHopperFinals.rows,{id:e.id}),m.ivrCampaignHopperFinals.count-=1,m.ivrCampaignHopperFinals.rows.length||p(),l.success({title:"HopperFinal deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function v(a){d.cmHopperFinal.checkContactHopper(a).$promise.then(function(e){l.info({title:"The contact is in the hopper",msg:"Contact ID "+e.ContactId})}).catch(function(e){var n,t;"Not Found"===e.data?d.cmHopper.save((n=a,t={},t.phone=n.calleridnum,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=0,t.countcongestionretry=0,t.countnoanswerretry=0,t.countglobal=0,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=n.deleted?null:n.UserId,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.priority=n.recallme?3:2,t.recallme=!!n.recallme,t)).$promise.then(function(e){var n,t;l.info({title:"Restored Contact",msg:"Contact ID "+e.ContactId}),e.ContactId&&d.cmHopperHistory.save(((t={}).calleridnum=(n=a).calleridnum,t.calleridname=n.calleridname,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=n.countbusyretry,t.countcongestionretry=n.countcongestionretry,t.countnoanswerretry=n.countnoanswerretry,t.countglobal=n.countglobal,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=c.getCurrentUser().id,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.editedat=moment().format("YYYY-MM-DD HH:mm:ss"),t.edited=!0,t.state=25,t.statedesc="Restored",t.campaign=n.campaign,t.campaigntype=n.VoiceQueueId?"queue":"ivr",t))}).catch(function(e){_.isNil(e.data)||"Validation error"!==e.data.message?l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}):l.info({title:"The contact is in the hopper",msg:"Contact ID "+a.ContactId})}):l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.contacts={},m.ivrCampaign={},m.ivrCampaignHopperFinals={count:0,rows:[]},m.selectedIvrCampaignHopperFinals=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,countglobal,scheduledat,starttime,responsetime,endtime,disposition,ListId,UserId,VoiceQueueId,CampaignId,recallme,deleted,campaign",sort:"-id",limit:10,page:1},m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperFinal?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperFinal #")+e.id||"hopperFinal")+"</b> will be deleted.").ariaLabel("delete hopperFinal").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHopperFinals=p,m.createOrEditIvrCampaignHopperFinal=function(e,n){o.show({controller:"CreateOrEditHopperFinalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperFinals/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopperFinal:n,hopperFinals:m.ivrCampaignHopperFinals.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIvrCampaignHopperFinals=function(){var e=angular.copy(m.selectedIvrCampaignHopperFinals);return m.selectedIvrCampaignHopperFinals=[],e},m.deleteIvrCampaignHopperFinal=g,m.deleteSelectedIvrCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperFinals?").htmlContent("<b>"+m.selectedIvrCampaignHopperFinals.length+" selected</b> will be deleted.").ariaLabel("delete hopperFinals").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperFinals.forEach(function(e){g(e)}),m.selectedIvrCampaignHopperFinals=[]})},m.moveIvrCampaignHopperFinal=v,m.moveContactsIvrCampaignHopperFinal=function(e){d.cmHopperFinal.moveContactsIvrCampaignHopperFinal({id:m.query.id,state:e}).$promise.then(function(e){_.isNil(e)&&_.isNil(e[0])?l.info({title:"Restored Contacts",msg:"0"}):l.info({title:"Restored Contacts",msg:JSON.stringify(e[0].affectedRows)})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.countContactsIvrCampaignHopperFinal=function(e){d.cmHopperFinal.countContactsIvrCampaignHopperFinal({id:e}).$promise.then(function(e){_.merge(m.contacts,e[0])}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.moveConfirm=function(e,n){var t=o.confirm().title("Are you sure want to restore the contact?").htmlContent("<b>Contact</b> will be restored.").ariaLabel("Restore Contact").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.moveSelectedIvrCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to restore the selected contacts?").htmlContent("<b> Contacts selected</b> will be restored.").ariaLabel("Restore Contacts").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperFinals.forEach(function(e){v(e)}),m.selectedIvrCampaignHopperFinals=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperFinalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHopperHistories=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHopperHistories(m.query,u).$promise}function g(e){d.hopperHistory.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHopperHistories.rows,{id:e.id}),m.ivrCampaignHopperHistories.count-=1,m.ivrCampaignHopperHistories.rows.length||p(),l.success({title:"HopperHistory deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.ivrCampaign={},m.ivrCampaignHopperHistories={count:0,rows:[]},m.selectedIvrCampaignHopperHistories=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,scheduledat,starttime,responsetime,endtime",sort:"-id",limit:10,page:1},m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperHistory?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperHistory #")+e.id||"hopperHistory")+"</b> will be deleted.").ariaLabel("delete hopperHistory").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHopperHistories=p,m.createOrEditIvrCampaignHopperHistory=function(e,n){o.show({controller:"CreateOrEditHopperHistoryDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperHistories/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopperHistory:n,hopperHistories:m.ivrCampaignHopperHistories.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIvrCampaignHopperHistories=function(){var e=angular.copy(m.selectedIvrCampaignHopperHistories);return m.selectedIvrCampaignHopperHistories=[],e},m.deleteIvrCampaignHopperHistory=g,m.deleteSelectedIvrCampaignHopperHistories=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperHistories?").htmlContent("<b>"+m.selectedIvrCampaignHopperHistories.length+" selected</b> will be deleted.").ariaLabel("delete hopperHistories").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperHistories.forEach(function(e){g(e)}),m.selectedIvrCampaignHopperHistories=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperHistoriesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHoppers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHoppers(m.query,u).$promise}function g(e){d.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHoppers.rows,{id:e.id}),m.ivrCampaignHoppers.count-=1,m.ivrCampaignHoppers.rows.length||p(),l.success({title:"Hopper deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.ivrCampaign={},m.ivrCampaignHoppers={count:0,rows:[]},m.selectedIvrCampaignHoppers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,ContactId,phone,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,scheduledat,priority",sort:"-updatedAt",limit:10,page:1},m.arraypriority=_.keyBy([{option:"Highest",value:"'4'"},{option:"High",value:"'3'"},{option:"Medium",value:"'2'"},{option:"Low",value:"'1'"},{option:"Lowest",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopper?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopper #")+e.id||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHoppers=p,m.createOrEditIvrCampaignHopper=function(e,n){o.show({controller:"HopperdateController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopper:n,hoppers:m.ivrCampaignHoppers.rows,license:null,setting:null,crudPermissions:m.crudPermissions,from:"IvrCampaign"}})},m.exportSelectedIvrCampaignHoppers=function(){var e=angular.copy(m.selectedIvrCampaignHoppers);return m.selectedIvrCampaignHoppers=[],e},m.deleteIvrCampaignHopper=g,m.deleteSelectedIvrCampaignHoppers=function(e){var n=o.confirm().title("Are you sure want to delete the selected hoppers?").htmlContent("<b>"+m.selectedIvrCampaignHoppers.length+" selected</b> will be deleted.").ariaLabel("delete hoppers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHoppers.forEach(function(e){g(e)}),m.selectedIvrCampaignHoppers=[]})},c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.agents,{id:e.resourceId})});m.agents.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),m.agents=n})}else m.agents=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHoppersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_HOPPER",g.hopper=angular.copy(l),g.hoppers=r,g.newHopper=!1,g.hopper||(g.hopper={},g.title="MOTIONDIALER.NEW_HOPPER",g.newHopper=!0),n.params.id&&(g.hopper.CampaignId=n.params.id),g.addNewHopper=function(){g.errors=[],d.cmHopper.save(g.hopper).$promise.then(function(e){g.hoppers.unshift(e.toJSON()),o.success({title:"Hopper properly created",msg:g.hopper.name?g.hopper.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveHopper=function(){var t,a,i,s;g.errors=[],g.hopper.UserId=g.hopper.recallme?g.hopper.UserId:null,g.hopper.OwnerId=c.getCurrentUser().id,d.cmHopper.get({id:g.hopper.id,attributes:["scheduledat"]}).$promise.then(function(e){t=_.isNil(e)||_.isEmpty(e)?moment().format("YYYY-MM-DD HH:mm:ss"):e.scheduledat}).finally(function(){d.cmHopper.update({id:g.hopper.id},_.omit(g.hopper,["VoiceQueueId","CampaignId","ContactId","ListId"])).$promise.then(function(e){a=e,d.cmContact.get({id:a.ContactId,attributes:["firstName","lastName"]}).$promise.then(function(e){_.isNil(e)||_.isNil(e.firstName)||(i=e.firstName,_.isNil(e.lastName)||(i+=" "+e.lastName))}).catch(function(){i=void 0}).finally(function(){d.campaign.get({raw:!1,id:a.CampaignId,attributes:["name"]}).$promise.then(function(e){s=e.name}).catch(function(e){s=void 0}).finally(function(){d.cmHopperHistory.save({state:24,statedesc:"Edited",scheduledat:t,calleridnum:a.phone,calleridname:i,campaigntype:a.VoiceQueueId?"queue":"ivr",campaign:s,editedat:moment().format("YYYY-MM-DD HH:mm:ss"),edited:!0,ListId:a.ListId,UserId:c.getCurrentUser().id,VoiceQueueId:a.VoiceQueueId,CampaignId:a.CampaignId,ContactId:a.ContactId,callback:a.callback,callbackuniqueid:a.callbackuniqueid,countbusyretry:a.countbusyretry,countcongestionretry:a.countcongestionretry,countglobal:a.countglobal,countnoanswerretry:a.countnoanswerretry,followuptime:a.followuptime,recallme:a.recallme})})});var n=_.find(g.hoppers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Hopper properly saved!",msg:g.hopper.name?g.hopper.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})})},g.deleteHopper=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmHopper.delete({id:g.hopper.id}).$promise.then(function(){_.remove(g.hoppers,{id:g.hopper.id}),o.success({title:"Hopper properly deleted!",msg:(g.hopper.name||"hopper")+" has been deleted!"}),v(g.hopper)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.agents,{id:e.resourceId})});g.agents.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),g.agents=n})}else g.agents=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","hoppers","hopper","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditHopperCampaignIdDialogController",e)}(),function(){"use strict";function e(t,a){var i=this;i.ivrCampaign={},i.init=function(n){i.ivrCampaign=n,t.cmHopper.get({limit:0,CampaignId:n.id}).$promise.then(function(e){return i.total=e.count||0,t.cmHopper.get({limit:0,CampaignId:n.id,active:!1,countbusyretry:0,countcongestionretry:0,countnoanswerretry:0,countnosuchnumberretry:0,countdropretry:0,countabandonedretry:0,countmachineretry:0,countagentrejectretry:0}).$promise}).then(function(e){return i.fresh=e.count||0,t.cmHopperFinal.get({limit:0,CampaignId:n.id}).$promise}).then(function(e){i.closed=e.count||0}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["api","toasty"],angular.module("app.motiondialer").controller("IvrCampaignHopperStatisticsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.ivrCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.ivrCampaign=n,d.crudPermissions=l,d.apiRoute="campaign",d.getApi="getLists",d.addApi="addLists",d.removeApi="removeLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","ivrCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("IvrCampaignlistaddController",e)}(),function(){"use strict";function e(e,n,a,i,s,t,o,r){var l=this;function d(){n.hide()}function c(e,n){var t=n.id;o.enqueue(function(){return i.campaign.removeLists({id:e,ids:t}).$promise.then(function(){return i.campaign.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){a.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:queueCampaign.RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}l.selected=[],l.items=t||[],l.loading=!1,l.closeDialog=d,l.exists=function(e,n){return-1<n.indexOf(e)},l.toggle=function(e,n){var t=n.indexOf(e);-1<t?n.splice(t,1):n.push(e)},l.isIndeterminate=function(){return 0!==l.selected.length&&l.selected.length!==l.items.length},l.isChecked=function(){return l.selected.length===l.items.length},l.toggleAll=function(){l.selected.length===l.items.length?l.selected=[]:(0===l.selected.length||0<l.selected.length)&&(l.selected=l.items.slice(0))},l.listSelected=function(){l.loading=!0,r(function(e,n){for(var t=0;t<l.selected.length;t+=1)c(s.id,l.selected[t]);var a;a=e,o.enqueue(function(){return a()})}).finally(function(){l.loading=!1,d()})}}e.$inject=["$scope","$mdDialog","toasty","api","ivrCampaign","listsCampaign","Sequence","$q"],angular.module("app.motiondialer").controller("IvrCampaignresetlistController",e)}(),function(){"use strict";function e(t,e,i,s,a,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.ivrCampaign=c||t.params.ivrCampaign||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.clonedialog=function(e,n){i.show({controller:"IvrCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.listadddialog=function(e,n){i.show({controller:"IvrCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.blacklistadddialog=function(e,n){i.show({controller:"IvrCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.resetlistdialog=function(n,t){r.campaign.getLists({id:n.id,fields:"id,name",nolimit:!0}).$promise.then(function(a){if(_.isNil(a.rows)||_.isEmpty(a.rows))l.info({title:"Campaign Without Lists"});else if(1===a.rows.length){var e=i.confirm().title("Are you sure want to reset the list "+a.rows[0].name+" ?").htmlContent("<b>"+a.rows[0].name+"</b> will be reset.").ariaLabel("Reset List").targetEvent(t).ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,n,t;e=u.ivrCampaign.id,n=a.rows[0],t=n.id,r.campaign.removeLists({id:e,ids:t}).$promise.then(function(){return r.campaign.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){l.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ivrCampaign.REMOVELIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}else i.show({controller:"IvrCampaignresetlistController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/resetlist/resetlist.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!1,locals:{ivrCampaign:n,listsCampaign:a?a.rows:[]}})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})},u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.ivr_campaigns",{}):l.info({title:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.ivr_campaigns",{})}},u.alert=l.info,u.gotoIvrCampaigns=function(){t.go("app.motiondialer.ivrCampaigns",{},{reload:"app.motiondialer.ivrCampaigns"})},u.saveIvrCampaign=function(){r.campaign.update({id:u.ivrCampaign.id},u.ivrCampaign).$promise.then(function(){l.success({title:"IvrCampaign updated!",msg:u.ivrCampaign.name?u.ivrCampaign.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.trunks,{id:e.resourceId})});u.trunks.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.trunks=n})}else u.trunks=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),t=null;if(u.ivrCampaign&&(t=_.find(u.projects,{id:Number(u.ivrCampaign.SquareProjectId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.projects,{id:t.id});a.canSelect=!1,n.push(a)}u.projects=n})}else{var t=[],a=null;u.ivrCampaign&&(a=_.find(u.projects,{id:Number(u.ivrCampaign.SquareProjectId)}));for(var i=0;i<u.projects.length;i++)a&&u.projects[i].id===a.id&&(u.projects[i].canSelect=!1,t.push(u.projects[i]));u.projects=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.interval,{id:e.resourceId})}),t=null;if(u.ivrCampaign&&(t=_.find(u.interval,{id:Number(u.ivrCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.interval,{id:t.id});a.canSelect=!1,n.push(a)}u.interval=n})}else{var t=[],a=null;u.ivrCampaign&&(a=_.find(u.interval,{id:Number(u.ivrCampaign.IntervalId)}));for(var i=0;i<u.interval.length;i++)a&&u.interval[i].id===a.id&&(u.interval[i].canSelect=!1,t.push(u.interval[i]));u.interval=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","ivrCampaign","userProfileSection"],angular.module("app.motiondialer").controller("IvrCampaignController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.ivrCampaigns=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="ivrCampaigns",f.listOrder="",f.listOrderAsc=null,f.selectedIvrCampaigns=[],f.query={fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",type:"ivr",sort:"-updatedAt",limit:10,page:1},f.arraydialCheckDuplicateType=_.keyBy([{option:"ALWAYS",value:"'always'"},{option:"NEVER",value:"'never'"},{option:"ONLY_IF_OPEN",value:"'onlyIfOpen'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialOrderByScheduledAt=_.keyBy([{option:"DESC",value:"'DESC'"},{option:"ASC",value:"'ASC'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.motiondialer.ivrCampaigns.edit",{id:e.id,ivrCampaign:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"IvrCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:f.ivrCampaigns?f.ivrCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.listadddialog=function(e,n){i.show({controller:"IvrCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:f.ivrCampaigns?f.ivrCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.blacklistadddialog=function(e,n){i.show({controller:"IvrCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:f.ivrCampaigns?f.ivrCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("ivrCampaign")+"?").htmlContent("<b>"+(e.name||"ivrCampaign")+"</b> will be deleted.").ariaLabel("delete ivrCampaign").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.ivr_campaigns",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.ivr_campaigns",{})}},f.success=E,f.getIvrCampaigns=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.campaign.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="IvrCampaigns",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditIvrCampaign=function(e,n){i.show({controller:"CreateOrEditIvrCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:n,ivrCampaigns:f.ivrCampaigns.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteIvrCampaign=y,f.exportSelectedIvrCampaigns=function(){var e=angular.copy(f.selectedIvrCampaigns);return f.selectedIvrCampaigns=[],e},f.deleteSelectedIvrCampaigns=function(e){var n=i.confirm().title("Are you sure want to delete the selected ivrCampaigns?").htmlContent("<b>"+f.selectedIvrCampaigns.length+" selected</b> will be deleted.").ariaLabel("delete IvrCampaigns").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedIvrCampaigns.forEach(function(e){y(e)}),f.selectedIvrCampaigns=[]})},f.deselectIvrCampaigns=function(){f.selectedIvrCampaigns=[]},f.selectAllIvrCampaigns=function(){f.selectedIvrCampaigns=f.ivrCampaigns.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){f.trunks=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){f.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.trunks,{id:e.resourceId})});f.trunks.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),f.trunks=n})}else f.trunks=[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.projects=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.projects=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(f.projects,{id:e.resourceId})}),a=null;a=[],f.ivrCampaigns.rows.forEach(function(e){var n=_.find(f.projects,{id:Number(e.SquareProjectId)});a.push(n)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(f.projects,{id:e.id});n.canSelect=!1,t.push(n)}}),f.projects=t})}else{var t=[],a=[];f.ivrCampaigns.rows.forEach(function(e){var n=_.find(f.projects,{id:Number(e.SquareProjectId)});a.push(n)});for(var i=0;i<f.projects.length;i++){_.some(a,{id:f.projects[i].id})&&(f.projects[i].canSelect=!1,t.push(f.projects[i]))}f.projects=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.interval,{id:e.resourceId})}),t=null;if(f.ivrCampaign&&(t=_.find(f.interval,{id:Number(f.ivrCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.interval,{id:t.id});a.canSelect=!1,n.push(a)}f.interval=n})}else{var t=[],a=null;f.ivrCampaign&&(a=_.find(f.interval,{id:Number(f.ivrCampaign.IntervalId)}));for(var i=0;i<f.interval.length;i++)a&&f.interval[i].id===a.id&&(f.interval[i].canSelect=!1,t.push(f.interval[i]));f.interval=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.ivrCampaigns=e||{count:0,rows:[]}}function y(e){m.campaign.delete({id:e.id}).$promise.then(function(){_.remove(f.ivrCampaigns.rows,{id:e.id}),f.ivrCampaigns.count-=1,f.ivrCampaigns.rows.length||f.getIvrCampaigns(),p.success({title:_.startCase("IvrCampaign")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcampaign"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getIvrCampaigns())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","ivrCampaigns","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.motiondialer").controller("IvrCampaignsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_QUEUECAMPAIGN",g.queueCampaign=angular.copy(l),g.queueCampaigns=r,g.newQueueCampaign=!1,g.queueCampaign||(g.queueCampaign={dialActive:!0,type:"outbound",dialCheckDuplicateType:"always",dialCutDigit:0,autopause:"no",ringinuse:"no",timeoutrestart:"no",setinterfacevar:"no",setqueuevar:"no",setqueueentryvar:"no",dialOrderByScheduledAt:"ASC",dialGlobalInterval:"07:00-22:00,*,*,*",dialAMDInitialSilence:2500,dialAMDGreeting:1500,dialAMDAfterGreetingSilence:800,dialAMDTotalAnalysisTime:5e3,dialAMDMinWordLength:100,dialAMDBetweenWordsSilence:50,dialAMDMaximumNumberOfWords:3,dialAMDSilenceThreshold:256,dialAMDMaximumWordLength:5e3,dialMethod:"progressive",dialPowerLevel:1,dialPredictiveOptimization:"dropRate",dialPredictiveOptimizationPercentage:3,dialPredictiveInterval:10,dialLimitQueue:0,dialRandomLastDigitCallerIdNumber:0,dialOriginateTimeout:30,dialQueueOptions:"tTxX",dialQueueTimeout:3,strategy:"rrmemory",timeout:3,retry:3,weight:1,dialGlobalMaxRetry:4,dialCongestionMaxRetry:3,dialCongestionRetryFrequency:150,dialBusyMaxRetry:3,dialBusyRetryFrequency:150,dialNoAnswerMaxRetry:3,dialNoAnswerRetryFrequency:150,dialNoSuchNumberMaxRetry:3,dialNoSuchNumberRetryFrequency:150,dialDropMaxRetry:3,dialDropRetryFrequency:150,dialAbandonedMaxRetry:3,dialAbandonedRetryFrequency:150,dialMachineMaxRetry:3,dialMachineRetryFrequency:150,dialAgentRejectMaxRetry:3,dialAgentRejectRetryFrequency:150,callAdditionalPhoneAfterMin:3,dialPredictiveIntervalMaxThreshold:20,dialPredictiveIntervalMinThreshold:10},g.title="MOTIONDIALER.NEW_QUEUECAMPAIGN",g.newQueueCampaign=!0),g.addNewQueueCampaign=function(){g.errors=[],d.voiceQueue.save(g.queueCampaign).$promise.then(function(e){g.queueCampaigns.unshift(e.toJSON()),o.success({title:"QueueCampaign properly created",msg:g.queueCampaign.name?g.queueCampaign.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveQueueCampaign=function(){g.errors=[],d.voiceQueue.update({id:g.queueCampaign.id},g.queueCampaign).$promise.then(function(e){var n=_.find(g.queueCampaigns,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"QueueCampaign properly saved!",msg:g.queueCampaign.name?g.queueCampaign.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteQueueCampaign=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The queueCampaign will be deleted.").ariaLabel("Delete QueueCampaign").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceQueue.delete({id:g.queueCampaign.id}).$promise.then(function(){_.remove(g.queueCampaigns,{id:g.queueCampaign.id}),o.success({title:"QueueCampaign properly deleted!",msg:(g.queueCampaign.name||"queueCampaign")+" has been deleted!"}),v(g.queueCampaign)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})}),t=null;if(g.queueCampaign&&(t=_.find(g.trunks,{id:Number(g.queueCampaign.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.trunks,{id:t.id});a.canSelect=!1,n.push(a)}g.trunks=n})}else{var t=[],a=null;g.queueCampaign&&(a=_.find(g.trunks,{id:Number(g.queueCampaign.TrunkId)}));for(var i=0;i<g.trunks.length;i++)a&&g.trunks[i].id===a.id&&(g.trunks[i].canSelect=!1,t.push(g.trunks[i]));g.trunks=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),t=null;if(g.queueCampaign&&(t=_.find(g.interval,{id:Number(g.queueCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.interval,{id:t.id});a.canSelect=!1,n.push(a)}g.interval=n})}else{var t=[],a=null;g.queueCampaign&&(a=_.find(g.interval,{id:Number(g.queueCampaign.IntervalId)}));for(var i=0;i<g.interval.length;i++)a&&g.interval[i].id===a.id&&(g.interval[i].canSelect=!1,t.push(g.interval[i]));g.interval=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","queueCampaigns","queueCampaign","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditQueueCampaignDialogController",e)}(),function(){"use strict";function e(e,l,a,d,n,t,i,s,o,r){var c=this;function m(){return l(function(t,n){return l(function(n,t){return d.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(n,t){return d.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:o.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),l(function(n,t){return d.voiceQueue.getAgents({id:c.queueCampaign.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=o.getCurrentUser(),c.queueCampaign=n,c.crudPermissions=r,c.penalty=0,c.realtime=i,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return o.hasRole("admin")?m().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):l(function(t,n){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,l(function(e,n){_.isEmpty(t)?e():d.voiceQueue.removeAgents({id:c.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return r=n,l(function(e,n){if(_.isEmpty(r))e();else{for(var t=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);t.push(d.voiceQueue.addAgents({id:c.queueCampaign.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty "),realtime:c.realtime||!1}).$promise)}l.all(t).then(function(){e()}).catch(function(e){n(e)})}});var r}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),a.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("MOTIONDIALER.ALL_AGENTS"),labelSelected:s.instant("MOTIONDIALER.SELECTED_AGENTS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var t=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","queueCampaigns","realtime","$translate","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.queueCampaign=n,d.crudPermissions=l,d.apiRoute="voiceQueue",d.getApi="getBlackLists",d.addApi="addBlackLists",d.removeApi="removeBlackLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignblacklistaddController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newQueueCampaign=!0,r.queueCampaign=angular.copy(i),r.queueCampaigns=s,r.title=o.instant("MOTIONDIALER.CLONE_QUEUECAMPAIGN"),i&&i.name&&(r.title+=": "+i.name),r.cloneQueueCampaign=function(){return e.voiceQueue.clone({id:i.id},r.queueCampaign).$promise.then(function(e){r.queueCampaigns.unshift(e.toJSON()),a.success({title:"QueueCampaign properly cloned",msg:r.queueCampaign.name?r.queueCampaign.name+" has been cloned!":""}),t.go("app.motiondialer.queueCampaigns.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","queueCampaign","queueCampaigns","$translate"],angular.module("app.motiondialer").controller("QueueCampaigncloneController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHopperBlacks=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHopperBlacks(m.query,u).$promise}function g(e){d.hopperBlack.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHopperBlacks.rows,{id:e.id}),m.queueCampaignHopperBlacks.count-=1,m.queueCampaignHopperBlacks.rows.length||p(),l.success({title:"HopperBlack deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.queueCampaign={},m.queueCampaignHopperBlacks={count:0,rows:[]},m.selectedQueueCampaignHopperBlacks=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,ContactId,phone",sort:"-id",limit:10,page:1},m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperBlack?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperBlack #")+e.id||"hopperBlack")+"</b> will be deleted.").ariaLabel("delete hopperBlack").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHopperBlacks=p,m.createOrEditQueueCampaignHopperBlack=function(e,n){o.show({controller:"CreateOrEditHopperBlackDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperBlacks/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopperBlack:n,hopperBlacks:m.queueCampaignHopperBlacks.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedQueueCampaignHopperBlacks=function(){var e=angular.copy(m.selectedQueueCampaignHopperBlacks);return m.selectedQueueCampaignHopperBlacks=[],e},m.deleteQueueCampaignHopperBlack=g,m.deleteSelectedQueueCampaignHopperBlacks=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperBlacks?").htmlContent("<b>"+m.selectedQueueCampaignHopperBlacks.length+" selected</b> will be deleted.").ariaLabel("delete hopperBlacks").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperBlacks.forEach(function(e){g(e)}),m.selectedQueueCampaignHopperBlacks=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperBlacksController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHopperFinals=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHopperFinals(m.query,u).$promise}function g(e){d.hopperFinal.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHopperFinals.rows,{id:e.id}),m.queueCampaignHopperFinals.count-=1,m.queueCampaignHopperFinals.rows.length||p(),l.success({title:"HopperFinal deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function v(a){d.cmHopperFinal.checkContactHopper(a).$promise.then(function(e){l.info({title:"The contact is in the hopper",msg:"Contact ID "+e.ContactId})}).catch(function(e){var n,t;"Not Found"===e.data?d.cmHopper.save((n=a,t={},t.phone=n.calleridnum,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=0,t.countcongestionretry=0,t.countnoanswerretry=0,t.countglobal=0,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=n.deleted?null:n.UserId,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.priority=n.recallme?3:2,t.recallme=!!n.recallme,t)).$promise.then(function(e){var n,t;l.info({title:"Restored Contact",msg:"Contact ID "+e.ContactId}),e.ContactId&&d.cmHopperHistory.save(((t={}).calleridnum=(n=a).calleridnum,t.calleridname=n.calleridname,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=n.countbusyretry,t.countcongestionretry=n.countcongestionretry,t.countnoanswerretry=n.countnoanswerretry,t.countglobal=n.countglobal,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=c.getCurrentUser().id,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.editedat=moment().format("YYYY-MM-DD HH:mm:ss"),t.edited=!0,t.state=25,t.statedesc="Restored",t.campaign=n.campaign,t.campaigntype=n.VoiceQueueId?"queue":"ivr",t))}).catch(function(e){_.isNil(e.data)||"Validation error"!==e.data.message?l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}):l.info({title:"The contact is in the hopper",msg:"Contact ID "+a.ContactId})}):l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.contacts={},m.queueCampaign={},m.queueCampaignHopperFinals={count:0,rows:[]},m.selectedQueueCampaignHopperFinals=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,countglobal,scheduledat,starttime,responsetime,endtime,disposition,secondDisposition,thirdDisposition,ListId,UserId,VoiceQueueId,CampaignId,recallme,deleted,campaign",sort:"-id",limit:10,page:1},m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperFinal?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperFinal #")+e.id||"hopperFinal")+"</b> will be deleted.").ariaLabel("delete hopperFinal").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHopperFinals=p,m.createOrEditQueueCampaignHopperFinal=function(e,n){o.show({controller:"CreateOrEditHopperFinalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperFinals/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopperFinal:n,hopperFinals:m.queueCampaignHopperFinals.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedQueueCampaignHopperFinals=function(){var e=angular.copy(m.selectedQueueCampaignHopperFinals);return m.selectedQueueCampaignHopperFinals=[],e},m.deleteQueueCampaignHopperFinal=g,m.deleteSelectedQueueCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperFinals?").htmlContent("<b>"+m.selectedQueueCampaignHopperFinals.length+" selected</b> will be deleted.").ariaLabel("delete hopperFinals").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperFinals.forEach(function(e){g(e)}),m.selectedQueueCampaignHopperFinals=[]})},m.moveQueueCampaignHopperFinal=v,m.moveContactsQueueCampaignHopperFinal=function(e){d.cmHopperFinal.moveContactsQueueCampaignHopperFinal({id:m.query.id,state:e}).$promise.then(function(e){_.isNil(e)&&_.isNil(e[0])?l.info({title:"Restored Contacts",msg:"0"}):l.info({title:"Restored Contacts",msg:JSON.stringify(e[0].affectedRows)})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.countContactsQueueCampaignHopperFinal=function(e){d.cmHopperFinal.countContactsQueueCampaignHopperFinal({id:e}).$promise.then(function(e){_.merge(m.contacts,e[0])}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.moveConfirm=function(e,n){var t=o.confirm().title("Are you sure want to restore the contact?").htmlContent("<b>Contact</b> will be restored.").ariaLabel("Restore Contact").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.moveSelectedQueueCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to restore the selected contacts?").htmlContent("<b> Contacts selected</b> will be restored.").ariaLabel("Restore Contacts").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperFinals.forEach(function(e){v(e)}),m.selectedQueueCampaignHopperFinals=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperFinalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHopperHistories=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHopperHistories(m.query,u).$promise}function g(e){d.hopperHistory.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHopperHistories.rows,{id:e.id}),m.queueCampaignHopperHistories.count-=1,m.queueCampaignHopperHistories.rows.length||p(),l.success({title:"HopperHistory deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.queueCampaign={},m.queueCampaignHopperHistories={count:0,rows:[]},m.selectedQueueCampaignHopperHistories=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,scheduledat,starttime,responsetime,endtime",sort:"-id",limit:10,page:1},m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperHistory?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperHistory #")+e.id||"hopperHistory")+"</b> will be deleted.").ariaLabel("delete hopperHistory").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHopperHistories=p,m.createOrEditQueueCampaignHopperHistory=function(e,n){o.show({controller:"CreateOrEditHopperHistoryDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperHistories/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopperHistory:n,hopperHistories:m.queueCampaignHopperHistories.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedQueueCampaignHopperHistories=function(){var e=angular.copy(m.selectedQueueCampaignHopperHistories);return m.selectedQueueCampaignHopperHistories=[],e},m.deleteQueueCampaignHopperHistory=g,m.deleteSelectedQueueCampaignHopperHistories=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperHistories?").htmlContent("<b>"+m.selectedQueueCampaignHopperHistories.length+" selected</b> will be deleted.").ariaLabel("delete hopperHistories").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperHistories.forEach(function(e){g(e)}),m.selectedQueueCampaignHopperHistories=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperHistoriesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHoppers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHoppers(m.query,u).$promise}function g(e){d.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHoppers.rows,{id:e.id}),m.queueCampaignHoppers.count-=1,m.queueCampaignHoppers.rows.length||p(),l.success({title:"Hopper deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.queueCampaign={},m.queueCampaignHoppers={count:0,rows:[]},m.selectedQueueCampaignHoppers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,ContactId,phone,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,scheduledat,priority,recallme,UserId",sort:"-updatedAt",limit:10,page:1},m.arraypriority=_.keyBy([{option:"Highest",value:"'4'"},{option:"High",value:"'3'"},{option:"Medium",value:"'2'"},{option:"Low",value:"'1'"},{option:"Lowest",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopper?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopper #")+e.id||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHoppers=p,m.createOrEditQueueCampaignHopper=function(e,n){o.show({controller:"HopperdateController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopper:n,hoppers:m.queueCampaignHoppers.rows,license:null,setting:null,crudPermissions:m.crudPermissions,from:"QueueCampaign"}})},m.exportSelectedQueueCampaignHoppers=function(){var e=angular.copy(m.selectedQueueCampaignHoppers);return m.selectedQueueCampaignHoppers=[],e},m.deleteQueueCampaignHopper=g,m.deleteSelectedQueueCampaignHoppers=function(e){var n=o.confirm().title("Are you sure want to delete the selected hoppers?").htmlContent("<b>"+m.selectedQueueCampaignHoppers.length+" selected</b> will be deleted.").ariaLabel("delete hoppers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHoppers.forEach(function(e){g(e)}),m.selectedQueueCampaignHoppers=[]})},c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.agents,{id:e.resourceId})}),t=null;if(m.queueCampaign&&(t=_.find(m.agents,{id:Number(m.queueCampaign.UserId)})),t&&!_.some(n,["id",t.id])){var a=_.find(m.agents,{id:t.id});a.canSelect=!1,n.push(a)}m.agents=n})}else{var t=[],a=null;m.queueCampaign&&(a=_.find(m.agents,{id:Number(m.queueCampaign.UserId)}));for(var i=0;i<m.agents.length;i++)a&&m.agents[i].id===a.id&&(m.agents[i].canSelect=!1,t.push(m.agents[i]));m.agents=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHoppersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}function h(){console.log("recalcTZTime hopper",g.hopper);var e=g.hopper.Queue.id;if(e)d.voiceQueue.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(g.hopper.dialTimezone=e.dialTimezone,n)d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),_.isNil(g.dateTime)||(g.hopper.scheduledat=moment(g.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss"))})});else{d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),_.isNil(g.dateTime)||(g.hopper.scheduledat=moment(g.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss"))})}});else{d.cmHopper.getTimezone({id:g.hopper.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),g.hopper.scheduledat=moment(g.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_HOPPER",g.hopper=angular.copy(l),g.hoppers=r,g.newHopper=!1,g.recalcTZTime=h,e.$watch("vm.contact.dialTimezone",function(){h()}),g.hopper||(g.hopper={},g.title="MOTIONDIALER.NEW_HOPPER",g.newHopper=!0),n.params.id&&(g.hopper.VoiceQueueId=n.params.id),g.addNewHopper=function(){g.errors=[],d.cmHopper.save(g.hopper).$promise.then(function(e){g.hoppers.unshift(e.toJSON()),o.success({title:"Hopper properly created",msg:g.hopper.name?g.hopper.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveHopper=function(){var t,a,i,s;g.errors=[],g.hopper.UserId=g.hopper.recallme?g.hopper.UserId:null,g.hopper.OwnerId=c.getCurrentUser().id,g.hopper.dialTimezone=g.contact.dialTimezone,d.cmHopper.get({id:g.hopper.id,attributes:["scheduledat"]}).$promise.then(function(e){t=_.isNil(e)||_.isEmpty(e)?moment().format("YYYY-MM-DD HH:mm:ss"):e.scheduledat}).finally(function(){d.cmHopper.update({id:g.hopper.id},_.omit(g.hopper,["VoiceQueueId","CampaignId","ContactId","ListId"])).$promise.then(function(e){a=e,d.cmContact.get({id:a.ContactId,attributes:["firstName","lastName"]}).$promise.then(function(e){_.isNil(e)||_.isNil(e.firstName)||(i=e.firstName,_.isNil(e.lastName)||(i+=" "+e.lastName))}).catch(function(){i=void 0}).finally(function(){d.voiceQueue.get({raw:!1,id:a.VoiceQueueId,attributes:["name"]}).$promise.then(function(e){s=e.name}).catch(function(e){s=void 0}).finally(function(){d.cmHopperHistory.save({state:24,statedesc:"Edited",scheduledat:t,calleridnum:a.phone,calleridname:i,campaigntype:a.VoiceQueueId?"queue":"ivr",campaign:s,editedat:moment().format("YYYY-MM-DD HH:mm:ss"),edited:!0,ListId:a.ListId,UserId:c.getCurrentUser().id,VoiceQueueId:a.VoiceQueueId,CampaignId:a.CampaignId,ContactId:a.ContactId,callback:a.callback,callbackuniqueid:a.callbackuniqueid,countbusyretry:a.countbusyretry,countcongestionretry:a.countcongestionretry,countglobal:a.countglobal,countnoanswerretry:a.countnoanswerretry,followuptime:a.followuptime,recallme:a.recallme}).$promise.then(function(){d.cmContact.update({id:a.ContactId,dialTimezone:g.contact.dialTimezone})})})});var n=_.find(g.hoppers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Hopper properly saved!",msg:g.hopper.name?g.hopper.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})})},g.deleteHopper=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmHopper.delete({id:g.hopper.id}).$promise.then(function(){_.remove(g.hoppers,{id:g.hopper.id}),o.success({title:"Hopper properly deleted!",msg:(g.hopper.name||"hopper")+" has been deleted!"}),v(g.hopper)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.dateTime,g.contact,d.cmContact.get({id:g.hopper.Contact.id,fields:"dialTimezone"}).$promise.then(function(e){var n;g.contact=e,console.log("initTZTime hopper",g.hopper),_.isNil(g.hopper.Queue.id)?(n=g.hopper.Campaign.id)&&d.campaign.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;g.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;g.dateTime=moment(g.hopper.scheduledat).add(n-t,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),g.dateTime=moment(g.hopper.scheduledat).add(n-0,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):(n=g.hopper.Queue.id)&&d.voiceQueue.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;g.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;g.dateTime=moment(g.hopper.scheduledat).add(n-t,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),g.dateTime=moment(g.hopper.scheduledat).add(n-0,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})})}),g.closeDialog=v,c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.agents,{id:e.resourceId})}),t=null;if(g.hopper&&(t=_.find(g.agents,{id:Number(g.hopper.UserId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.agents,{id:t.id});a.canSelect=!1,n.push(a)}g.agents=n})}else{var t=[],a=null;g.hopper&&(a=_.find(g.agents,{id:Number(g.hopper.UserId)}));for(var i=0;i<g.agents.length;i++)a&&g.agents[i].id===a.id&&(g.agents[i].canSelect=!1,t.push(g.agents[i]));g.agents=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","hoppers","hopper","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditHopperVoiceQueueIdDialogController",e)}(),function(){"use strict";function e(t,a){var i=this;i.queueCampaign={},i.init=function(n){i.queueCampaign=n,t.cmHopper.get({limit:0,VoiceQueueId:n.id}).$promise.then(function(e){return i.total=e.count||0,t.cmHopper.get({limit:0,VoiceQueueId:n.id,active:!1,countbusyretry:0,countcongestionretry:0,countnoanswerretry:0,countnosuchnumberretry:0,countdropretry:0,countabandonedretry:0,countmachineretry:0,countagentrejectretry:0}).$promise}).then(function(e){return i.fresh=e.count||0,t.cmHopperFinal.get({limit:0,VoiceQueueId:n.id}).$promise}).then(function(e){i.closed=e.count||0}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["api","toasty"],angular.module("app.motiondialer").controller("QueueCampaignHopperStatisticsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.queueCampaign=n,d.crudPermissions=l,d.apiRoute="voiceQueue",d.getApi="getLists",d.addApi="addLists",d.removeApi="removeLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignlistaddController",e)}(),function(){"use strict";function e(e,n,a,i,s,t,o,r){var l=this;function d(){n.hide()}function c(e,n){var t=n.id;o.enqueue(function(){return i.voiceQueue.removeLists({id:e,ids:t}).$promise.then(function(){return i.voiceQueue.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){a.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:queueCampaign.RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}l.selected=[],l.items=t||[],l.loading=!1,l.closeDialog=d,l.exists=function(e,n){return-1<n.indexOf(e)},l.toggle=function(e,n){var t=n.indexOf(e);-1<t?n.splice(t,1):n.push(e)},l.isIndeterminate=function(){return 0!==l.selected.length&&l.selected.length!==l.items.length},l.isChecked=function(){return l.selected.length===l.items.length},l.toggleAll=function(){l.selected.length===l.items.length?l.selected=[]:(0===l.selected.length||0<l.selected.length)&&(l.selected=l.items.slice(0))},l.listSelected=function(){l.loading=!0,r(function(e,n){for(var t=0;t<l.selected.length;t+=1)c(s.id,l.selected[t]);var a;a=e,o.enqueue(function(){return a()})}).finally(function(){l.loading=!1,d()})}}e.$inject=["$scope","$mdDialog","toasty","api","queueCampaign","listsCampaign","Sequence","$q"],angular.module("app.motiondialer").controller("QueueCampaignresetlistController",e)}(),function(){"use strict";function e(e,i,a,s,n,t,o,r){var l=this;function d(){return i(function(t,n){return i(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:i(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),i(function(n,t){return s.voiceQueue.getTeams({id:l.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.queueCampaign=n,l.crudPermissions=r,l.penalty=0,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"penalty",labelAll:t.instant("MOTIONDIALER.ALL_TEAMS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_TEAMS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+l.penalty});var t=_.xorWith(l.startingSelectedItems,l.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):i(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceWith(l.selectedItems,l.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,i(function(e,n){_.isEmpty(t)?e():s.voiceQueue.removeTeams({id:l.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return a=n,i(function(e,n){if(!_.isEmpty(a)){var t=_.map(a,function(e){return{id:e.id,penalty:_.trim(e.penalty,"penalty ")}});return s.voiceQueue.addTeams({id:l.queueCampaign.id,teams:t}).$promise.then(function(){e()}).catch(function(e){n(e)})}e()});var a}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),a.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","$translate","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignteamaddController",e)}(),function(){"use strict";function e(t,e,i,s,a,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.queueCampaign=c||t.params.queueCampaign||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.clonedialog=function(e,n){i.show({controller:"QueueCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.listadddialog=function(e,n){i.show({controller:"QueueCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.blacklistadddialog=function(e,n){i.show({controller:"QueueCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.teamadddialog=function(e,n){i.show({controller:"QueueCampaignteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){i.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.resetlistdialog=function(n,t){r.voiceQueue.getLists({id:n.id,fields:"id,name",nolimit:!0}).$promise.then(function(a){if(_.isNil(a.rows)||_.isEmpty(a.rows))l.info({title:"Campaign Without Lists"});else if(1===a.rows.length){var e=i.confirm().title("Are you sure want to reset the list "+a.rows[0].name+" ?").htmlContent("<b>"+a.rows[0].name+"</b> will be reset.").ariaLabel("Reset List").targetEvent(t).ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,n,t;e=u.queueCampaign.id,n=a.rows[0],t=n.id,r.voiceQueue.removeLists({id:e,ids:t}).$promise.then(function(){return r.voiceQueue.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){l.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:queueCampaign.REMOVELIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}else i.show({controller:"QueueCampaignresetlistController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/resetlist/resetlist.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!1,locals:{queueCampaign:n,listsCampaign:a?a.rows:[]}})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})},u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.queues",{}):l.info({title:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.queues",{})}},u.alert=l.info,u.gotoQueueCampaigns=function(){t.go("app.motiondialer.queueCampaigns",{},{reload:"app.motiondialer.queueCampaigns"})},u.saveQueueCampaign=function(){r.voiceQueue.update({id:u.queueCampaign.id},u.queueCampaign).$promise.then(function(){l.success({title:"QueueCampaign updated!",msg:u.queueCampaign.name?u.queueCampaign.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MUSICONHOLDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:407}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.musiconholds,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.musiconholds,{name:u.queueCampaign.musiconhold})),t&&!_.some(n,["id",t.id])){var a=_.find(u.musiconholds,{id:t.id});a.canSelect=!1,n.push(a)}u.musiconholds=n}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true",defaultEntry:1}).$promise.then(function(e){u.musiconholds=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmusiconholds",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.trunks,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.trunks,{id:Number(u.queueCampaign.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.trunks,{id:t.id});a.canSelect=!1,n.push(a)}u.trunks=n})}else{var t=[],a=null;u.queueCampaign&&(a=_.find(u.trunks,{id:Number(u.queueCampaign.TrunkId)}));for(var i=0;i<u.trunks.length;i++)a&&u.trunks[i].id===a.id&&(u.trunks[i].canSelect=!1,t.push(u.trunks[i]));u.trunks=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.projects,{name:u.queueCampaign.dialQueueProject})),t&&!_.some(n,["id",t.id])){var a=_.find(u.projects,{id:t.id});a.canSelect=!1,n.push(a)}u.projects=n})}else{var t=[],a=null;u.queueCampaign&&(a=_.find(u.projects,{name:u.queueCampaign.dialQueueProject}));for(var i=0;i<u.projects.length;i++)a&&u.projects[i].id===a.id&&(u.projects[i].canSelect=!1,t.push(u.projects[i]));u.projects=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.interval,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.interval,{id:Number(u.queueCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.interval,{id:t.id});a.canSelect=!1,n.push(a)}u.interval=n})}else{var t=[],a=null;u.queueCampaign&&(a=_.find(u.interval,{id:Number(u.queueCampaign.IntervalId)}));for(var i=0;i<u.interval.length;i++)a&&u.interval[i].id===a.id&&(u.interval[i].canSelect=!1,t.push(u.interval[i]));u.interval=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.pauses=n})}else u.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","queueCampaign","userProfileSection"],angular.module("app.motiondialer").controller("QueueCampaignController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.queueCampaigns=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="queueCampaigns",f.listOrder="",f.listOrderAsc=null,f.selectedQueueCampaigns=[],f.query={fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,callAdditionalPhoneAfterMin,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,page:1},f.arraydialCheckDuplicateType=_.keyBy([{option:"ALWAYS",value:"'always'"},{option:"NEVER",value:"'never'"},{option:"ONLY_IF_OPEN",value:"'onlyIfOpen'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayautopause=_.keyBy([{option:"Yes",value:"'all'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayringinuse=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytimeoutrestart=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymonitor_format=_.keyBy([{option:"Inactive",value:"''"},{option:"wav",value:"'wav'"},{option:"wav49",value:"'wav49'"},{option:"gsm",value:"'gsm'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetinterfacevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueuevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueueentryvar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialOrderByScheduledAt=_.keyBy([{option:"DESC",value:"'DESC'"},{option:"ASC",value:"'ASC'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialMethod=_.keyBy([{option:"Progressive",value:"'progressive'"},{option:"PowerDialing",value:"'power'"},{option:"Predictive",value:"'predictive'"},{option:"Preview",value:"'preview'"},{option:"BookedProgressive",value:"'booked'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialPredictiveOptimization=_.keyBy([{option:"AgentBusyFactor",value:"'agentBusyFactor'"},{option:"DropRate",value:"'dropRate'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraystrategy=_.keyBy([{option:"Round Robin Memory",value:"'rrmemory'"},{option:"Round Robin",value:"'roundrobin'",ngIf:"vm.queueCampaign.dialMethod === 'booked'"},{option:"Least Recent",value:"'leastrecent'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Fewest Calls",value:"'fewestcalls'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Random",value:"'random'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Linear",value:"'linear'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Weight Random",value:"'wrandom'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.motiondialer.queueCampaigns.edit",{id:e.id,queueCampaign:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"QueueCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.listadddialog=function(e,n){i.show({controller:"QueueCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.blacklistadddialog=function(e,n){i.show({controller:"QueueCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.teamadddialog=function(e,n){i.show({controller:"QueueCampaignteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("queueCampaign")+"?").htmlContent("<b>"+(e.name||"queueCampaign")+"</b> will be deleted.").ariaLabel("delete queueCampaign").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.queues",{})}},f.success=E,f.getQueueCampaigns=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="QueueCampaigns",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditQueueCampaign=function(e,n){i.show({controller:"CreateOrEditQueueCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:n,queueCampaigns:f.queueCampaigns.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteQueueCampaign=y,f.exportSelectedQueueCampaigns=function(){var e=angular.copy(f.selectedQueueCampaigns);return f.selectedQueueCampaigns=[],e},f.deleteSelectedQueueCampaigns=function(e){var n=i.confirm().title("Are you sure want to delete the selected queueCampaigns?").htmlContent("<b>"+f.selectedQueueCampaigns.length+" selected</b> will be deleted.").ariaLabel("delete QueueCampaigns").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedQueueCampaigns.forEach(function(e){y(e)}),f.selectedQueueCampaigns=[]})},f.deselectQueueCampaigns=function(){f.selectedQueueCampaigns=[]},f.selectAllQueueCampaigns=function(){f.selectedQueueCampaigns=f.queueCampaigns.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(f.trunks,{id:e.resourceId})}),a=null;a=[],f.queueCampaigns.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(f.trunks,{id:e.id});n.canSelect=!1,t.push(n)}}),f.trunks=t})}else{var t=[],a=[];f.queueCampaigns.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)});for(var i=0;i<f.trunks.length;i++){_.some(a,{id:f.trunks[i].id})&&(f.trunks[i].canSelect=!1,t.push(f.trunks[i]))}f.trunks=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.interval,{id:e.resourceId})}),t=null;if(f.queueCampaign&&(t=_.find(f.interval,{id:Number(f.queueCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.interval,{id:t.id});a.canSelect=!1,n.push(a)}f.interval=n})}else{var t=[],a=null;f.queueCampaign&&(a=_.find(f.interval,{id:Number(f.queueCampaign.IntervalId)}));for(var i=0;i<f.interval.length;i++)a&&f.interval[i].id===a.id&&(f.interval[i].canSelect=!1,t.push(f.interval[i]));f.interval=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.queueCampaigns=e||{count:0,rows:[]}}function y(e){m.voiceQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.queueCampaigns.rows,{id:e.id}),f.queueCampaigns.count-=1,f.queueCampaigns.rows.length||f.getQueueCampaigns(),p.success({title:_.startCase("QueueCampaign")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getQueueCampaigns())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","queueCampaigns","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.motiondialer").controller("QueueCampaignsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(){return[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",options:g.agents.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_CAMPAIGN",options:g.queues.rows,ngValue:"name"}]}function h(){return g.refresh=!1,0===g.queues.count?f(null):(g.query.queue=1===g.queues.count?g.queues.rows[0].name:g.query.queue,void 0===g.query.queue&&(g.query.queue=_.map(g.queues.rows,"name")),_.isEmpty(g.query.queue)?f(null):(g.query.offset=(g.query.page-1)*g.query.limit,i.localStorage.setItem("motion2.realtime.abandoned.bull.abandonedCalls:"+g.currentUser.id,JSON.stringify({query:_.omit(g.query,"queue")})),void(g.promise=o.voiceQueueReport.getVoiceQueuesReport(g.query,f).$promise)))}function f(e){g.abandonedCalls=e||{count:0,rows:[]},!1,g.refresh=!0}g.currentUser=d.getCurrentUser(),g.agents=u||[],g.dispositions=p.rows,g.abandonedCalls={count:0,rows:[]},g.showTooltip=!1,g.refresh=!0,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=d.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition",type:"outbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},g.getAbandonedCalls=h,g.refreshAbandonedCalls=function(){g.showTooltip=!1,h()},g.assignTo=function(e,n){e&&o.voiceQueueReport.update({id:e.id,lastAssignedTo:n?n.name:null,assigned:!!n}).$promise.catch(function(e){console.log(e)})},g.dispose=function(t){n.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(a.body),targetEvent:t,locals:{dispositions:g.dispositions,call:t}}).then(function(e){if(e){var n={id:t.id,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null};o.voiceQueueReport.update(n).$promise.catch(function(e){console.log(e)})}})},g.onSaveVoiceQueueReport=function(e){e&&g.queuesMap&&"outbound"===queue.type&&g.queuesMap[e.queue]&&(g.showTooltip=!0)},g.onUpdateVoiceQueueReport=function(e){if(e){var n=_.findIndex(g.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(g.abandonedCalls.rows[n],e)}},c.onWithoutApply("voiceQueueReport:save",g.onSaveVoiceQueueReport),c.on("voiceQueueReport:update",g.onUpdateVoiceQueueReport),function(){var e=i.localStorage.getItem("motion2.realtime.abandoned.bull.abandonedCalls:"+g.currentUser.id);if(e)(e=JSON.parse(e))&&e.query&&(g.query=_.merge(e.query,_.omit(g.query,["sort","limit","page"])),g.query=_.omit(g.query,"filter"));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};g.query.createdAt=n}d.hasRole("admin")?o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){g.quickFilters=v(),h()}):o.userProfile.getResources({id:g.currentUser.userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){g.quickFilters=v(),h()})}();var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?t(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())}),e.$on("$destroy",function(){c.removeAllListeners("voiceQueueReport:save"),c.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","userProfile","userProfileSection","Auth","socket","toasty","agents","dispositions"],angular.module("app.motiondialer").controller("AbandonedCallsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o,r,l,d,c,m){var u=this,p=["name","active","limitCalls","message","originated","IntervalId","SquareProjectId","Trunk","TrunkId","ivrAnswerCallsDay","dialQueueProject","ivrTotalCallsDays","description"];function g(){_.forIn(u.campaigns,function(e,n){u.rpcCampaigns[n]&&_.merge(e,_.pick(u.rpcCampaigns[n],p))})}u.currentUser=m.getCurrentUser(),u.count=o.count,u.campaigns=o?_.keyBy(o.rows?o.rows:[],"id"):{},u.rpcCampaigns=s?_.keyBy(s.rows?s.rows:[],"id"):{},u.userProfile=d,u.userProfileSection=c&&1==c.count?c.rows[0]:null,u.crudPermissions=m.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={sort:"-updatedAt",limit:10,page:1},u.success=f,u.getCampaigns=function(){u.query.offset=(u.query.page-1)*u.query.limit,m.hasRole("admin")?u.promise=r.campaign.get(u.query,f).$promise:(u.query.id=u.userProfile.id,u.query.section="IvrCampaigns",u.promise=r.userProfile.getResources(u.query,f).$promise)},u.onSave=function(e){u.campaigns[e.id]&&(_.merge(u.campaigns[e.id],_.pick(e,p)),_.merge(u.rpcCampaigns[e.id],_.pick(e,p)))},u.$onInit=g,u.createOrEditIvrCampaign=function(e,n){a.show({controller:"CreateOrEditIvrCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:n,ivrCampaigns:_.values(u.campaigns),license:null,setting:null,crudPermissions:u.crudPermissions}})},l.onWithoutApply("campaign:save",u.onSave),u.interval=n(function(){},999);var v=!0,h=1;function f(e){u.count=e.count,u.campaigns=e?_.keyBy(e.rows?e.rows:[],"id"):{},g()}e.$watch("vm.query.filter",function(e,n){v?t(function(){v=!1}):(n||(h=u.query.page),e!==n&&(u.query.page=1),e||(u.query.page=h),u.getCampaigns())}),e.$on("$destroy",function(){l.removeAllListeners("campaign:save"),u.interval&&n.cancel(u.interval)})}e.$inject=["$scope","$timeout","$mdDialog","$document","$interval","rpcCampaigns","campaigns","api","socket","userProfile","userProfileSection","Auth"],angular.module("app.motiondialer").controller("IvrCampaignsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,n,a,o,t,i,s,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.queues=t?_.keyBy(t.rows?t.rows:[],"name"):{},p.rpcVoiceQueuesChannelsTmp=i?_.keyBy(i.rows?_.filter(i.rows,{type:"outbound"}):[],"uniqueid"):{},p.rpcVoiceQueuesChannels={},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.queryChannels={limit:10,page:1},p.getAvailableAgents=function(){p.availableAgents=null,s.rpc.getAgents().$promise.then(function(e){for(var n=[],t=e?e.rows:[],a=_.filter(t,{online:!0,voicePause:!1,voiceStatus:"idle"}),i=0;i<a.length;i++){var s=_.find(o.rows,["id",a[i].id]);s&&n.push(s)}p.availableAgents=n}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.getSize=function(e){return _.size(e)},p.$onInit=function(){_.forIn(p.rpcVoiceQueuesChannelsTmp,function(e,n){_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[n]=e)})},p.onSave=function(e){"outbound"===e.type&&_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[e.uniqueid]=e)},p.onRemove=function(e){p.rpcVoiceQueuesChannels[e.uniqueid]&&delete p.rpcVoiceQueuesChannels[e.uniqueid]},p.hangup=function(n){return s.rpc.getVoiceQueuesChannelHangup({uniqueid:n}).$promise.then(function(e){d.success({title:"Channel "+n+" properly hangup!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToAgent=function(n,e,t){return s.rpc.getVoiceQueuesChannelRedirect({uniqueid:n,exten:e,context:t}).$promise.then(function(e){d.success({title:"Channel "+n+" properly redirect!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToNumber=function(e,n){var t=a.prompt().title("Which number do you want transfer the call to?").placeholder("Number").targetEvent(e).ok("Ok").cancel("Cancel");return a.show(t).then(function(e){return s.rpc.getVoiceQueuesChannelRedirect({uniqueid:n,exten:e}).$promise}).then(function(e){d.success({title:"Channel "+n+" properly redirect!",msg:e.message||""})}).catch(function(e){e&&d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},r.on("voice_queue_channel:save",p.onSave),r.on("voice_queue_channel:remove",p.onRemove),e.$on("$destroy",function(){r.removeAllListeners("voice_queue_channel:save"),r.removeAllListeners("voice_queue_channel:remove")})}e.$inject=["$scope","$timeout","$mdDialog","agents","queues","rpcVoiceQueuesChannels","api","socket","helperClasses","toasty","userProfile","userProfileSection","Auth"],angular.module("app.motiondialer").controller("QueueCallsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["total","answered","sumHoldTime","sumDuration","sumBillable","outboundNoAnswerCallsDay","outboundBusyCallsDay","outboundCongestionCallsDay","outboundNoSuchCallsDay","outboundUnknownCallsDay","outboundDropCallsDayTimeout","outboundDropCallsDayCallersExit","outboundBlacklistCallsDay","outboundOriginateFailureCallsDay","outboundAnswerAgiCallsDay","outboundReCallsDay","outboundRejectCallsDay"];function u(){_.forIn(c.queues,function(e,n){c.rpcQueues[n]&&_.merge(e,_.pick(c.rpcQueues[n],m))})}c.count=a.count,c.queues=a?_.keyBy(a.rows?a.rows:[],"id"):{},c.rpcQueues=i?_.keyBy(i.rows?i.rows:[],"id"):{},c.userProfile=r,c.userProfileSection=l&&1==l.count?l.rows[0]:null,c.crudPermissions=d.parseCrudPermissions(c.userProfileSection?c.userProfileSection.crudPermissions:null),d.hasRole("admin")?c.query={type:"outbound",fields:"id,name",sort:"-updatedAt",limit:10,page:1}:c.query={id:d.getCurrentUser().id,channel:"voice",type:"outbound",fields:"id,name",sort:"-updatedAt",limit:10,page:1},c.success=v,c.getQueues=function(){c.query.offset=(c.query.page-1)*c.query.limit,d.hasRole("admin")?c.promise=s.voiceQueue.get(c.query,v).$promise:(c.query.id=c.userProfile.id,c.query.section="QueueCampaigns",c.promise=s.userProfile.getResources(c.query,v).$promise)},c.onSave=function(e){c.queues[e.id]&&_.merge(c.queues[e.id],_.pick(e,m))},c.$onInit=u,o.onWithoutApply("voice_queue:save",c.onSave),c.interval=n(function(){},999);var p=!0,g=1;function v(e){c.count=e.count,c.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},u()}e.$watch("vm.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=g),c.getQueues())}),e.$on("$destroy",function(){o.removeAllListeners("voice_queue:save"),c.interval&&n.cancel(c.interval)})}e.$inject=["$scope","$timeout","$interval","queues","rpcQueues","api","socket","userProfile","userProfileSection","Auth"],angular.module("app.motiondialer").controller("QueueParamsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"QueueCampaigns":void 0,channel:"voice",type:"outbound",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("VOICE.VOICEQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditQueueCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:n,queueCampaigns:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:n,queueCampaigns:u.queues.rows,realtime:!0,crudPermissions:u.crudPermissions}})},u.showPredictiveQueueCampaignInfo=function(e,n){t.show({controller:"PredictiveQueueCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/realtime/queues/predictive/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:n}})},r.onWithoutApply("voice_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&m.updateVoiceQueue(e,n)}),r.on("userVoiceQueueRt:save",function(e){var n=_.find(u.queues.rows,["id",e.MotionDialerQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("user:agentconnect",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);if(n){if(!t.agentconnected)return;t.queue?n.talking=!0:n.busy=!0,m.updateBusyCounter(e)}})}),r.on("user:agentcomplete",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&(n.talking?n.talking=!1:n.busy&&(n.busy=!1),m.updateBusyCounter(e))})}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"voice")})}),e.$on("$destroy",function(){r.removeAllListeners("voice_queue:save"),r.removeAllListeners("userVoiceQueueRt:save"),r.removeAllListeners("user:agentconnect"),r.removeAllListeners("user:agentcomplete"),r.removeAllListeners("user:update"),p&&n.cancel(p)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.motiondialer").controller("QueuesMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,n,t){this.queueCampaign=t,this.addMinutes=function(e,n){return moment(e).add("m",n).format("HH:mm:ss")},this.setFormatTime=function(e){return moment(e).format("HH:mm:ss")},this.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$interval","queueCampaign"],angular.module("app.motiondialer").controller("PredictiveQueueCampaignDialogController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.motiondialer.realtime.agents":this.selectedTab=0;break;case"app.motiondialer.realtime.queues":this.selectedTab=1;break;case"app.motiondialer.realtime.queue_calls":this.selectedTab=2;break;case"app.motiondialer.realtime.abandonedcalls":this.selectedTab=3;break;case"app.motiondialer.realtime.queue_params":this.selectedTab=4;break;case"app.motiondialer.realtime.ivr_campaigns":this.selectedTab=5;break;default:this.selectedTab=0,t.go("app.motiondialer.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.motiondialer.realtime.agents");break;case 1:t.go("app.motiondialer.realtime.queues");break;case 2:t.go("app.motiondialer.realtime.queue_calls");break;case 3:t.go("app.motiondialer.realtime.abandonedcalls");break;case 4:t.go("app.motiondialer.realtime.queue_params");break;case 5:t.go("app.motiondialer.realtime.ivr_campaigns");break;default:t.go("app.motiondialer.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.motiondialer").controller("MotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="OPENCHANNEL.EDIT_OPENCHANNELACCOUNT",g.openchannelAccount=angular.copy(l),g.openchannelAccounts=r,g.newOpenchannelAccount=!1,g.openchannelAccount||(g.openchannelAccount={waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="OPENCHANNEL.NEW_OPENCHANNELACCOUNT",g.newOpenchannelAccount=!0),n.params.id&&(g.openchannelAccount.OpenchannelAccountId=n.params.id),g.addNewOpenchannelAccount=function(){g.errors=[],d.openchannelAccount.save(g.openchannelAccount).$promise.then(function(e){g.openchannelAccounts.unshift(e.toJSON()),o.success({title:"OpenchannelAccount properly created",msg:g.openchannelAccount.name?g.openchannelAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOpenchannelAccount=function(){g.errors=[],d.openchannelAccount.update({id:g.openchannelAccount.id},g.openchannelAccount).$promise.then(function(e){var n=_.find(g.openchannelAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"OpenchannelAccount properly saved!",msg:g.openchannelAccount.name?g.openchannelAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOpenchannelAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The openchannelAccount will be deleted.").ariaLabel("Delete OpenchannelAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.openchannelAccount.delete({id:g.openchannelAccount.id}).$promise.then(function(){_.remove(g.openchannelAccounts,{id:g.openchannelAccount.id}),o.success({title:"OpenchannelAccount properly deleted!",msg:(g.openchannelAccount.name||"openchannelAccount")+" has been deleted!"}),v(g.openchannelAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.openchannelAccount&&(t=_.find(g.lists,{id:Number(g.openchannelAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.openchannelAccount&&(a=_.find(g.lists,{id:Number(g.openchannelAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","openchannelAccounts","openchannelAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.openchannelAccountApps.rows.length){var t=r.openchannelAccountApps.rows[n]?r.openchannelAccountApps.rows[n]:r.openchannelAccountApps.rows[0];i.show({controller:"EditOpenchannelAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccountApp:t,openchannelAccount:r.openchannelAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.openchannelAccountApps.rows[n]=e:r.openchannelAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.openchannelAccountApps.rows.length;t++,0){var a=r.openchannelAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.openchannelAccount.context,a.exten=r.openchannelAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.openchannelAccount.addApplications({id:r.openchannelAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.openchannelAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.openchannelAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.openchannelAccount={},r.openchannelAccountApps={count:0,rows:[]},r.selectedOpenchannelAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:4,help:!0}]},{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"OpenchannelQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"openchannelQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:801}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,defaultValue:300,required:!0,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",role:"agent",nolimit:!0},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.openchannelAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getOpenchannelAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.openchannelAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getOpenchannelAccountApps=function(){r.promise=o.openchannelAccount.getApplications(r.query,t).$promise},r.editOpenchannelAccountApp=n,r.editInterval=function(e,n){if(r.openchannelAccountApps.rows.length){var t=r.openchannelAccountApps.rows[n]?r.openchannelAccountApps.rows[n]:r.openchannelAccountApps.rows[0];i.show({controller:"EditOpenchannelAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteOpenchannelAccountApp=function(e){_.remove(r.openchannelAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedOpenchannelAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedOpenchannelAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedOpenchannelAccountApps.forEach(function(e){_.remove(r.openchannelAccountApps.rows,{id:e.id})}),r.selectedOpenchannelAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.openchannelAccount.getAgents({id:c.openchannelAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserOpenchannelAccount?"penalty "+e.UserOpenchannelAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.openchannelAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.openchannelAccount.removeAgents({id:c.openchannelAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.openchannelAccount.addAgents({id:c.openchannelAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("OPENCHANNEL.ALL_AGENTS"),labelSelected:r.instant("OPENCHANNEL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","openchannelAccount","openchannelAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.openchannel").controller("OpenchannelAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditOpenchannelAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("openChannel")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.openchannelQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.openchannelQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:801}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"openchannelAccount",action:"getDispositions",field:"name",params:{id:m.openchannelAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.openchannelAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.openchannelAccountInteractions.rows.length;n+=1){var t=m.openchannelAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.openchannelInteraction.get(m.query,p).$promise}function v(e){d.openchannelInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.openchannelAccountInteractions.rows,{id:e.id}),m.openchannelAccountInteractions.count-=1,m.openchannelAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETopenchannelAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.from?e.contactName=e.from:e.Contact?e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""):e.contactName=i.instant("OPENCHANNEL.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.openchannelAccount={},m.openchannelAccountInteractions={count:0,rows:[]},m.selectedOpenchannelAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.openchannelAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.OpenchannelAccountId=m.openchannelAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.openchannelInteractionDownload=function(s,e,n){return d.openchannelInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="openchannel-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getOpenchannelAccountInteractions=g,m.createOrEditOpenchannelAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:m.openchannelAccount,interaction:n,interactions:m.openchannelAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spyopenchannelInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"openchannel",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"openchannel.openchannelAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||OpenchannelAccountId:=$eq["+m.openchannelAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedOpenchannelAccountInteractions=function(){var e=angular.copy(m.selectedOpenchannelAccountInteractions);return m.selectedOpenchannelAccountInteractions=[],e},m.deleteOpenchannelAccountInteraction=v,m.deleteSelectedOpenchannelAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedOpenchannelAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedOpenchannelAccountInteractions.forEach(function(e){v(e)}),m.selectedOpenchannelAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.openchannelAccountOpenchannelCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.openchannelAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.openchannelAccountOpenchannelCannedAnswers.rows,{id:e.id}),m.openchannelAccountOpenchannelCannedAnswers.count-=1,m.openchannelAccountOpenchannelCannedAnswers.rows.length||p(),l.success({title:"OpenchannelCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETopenchannelAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.openchannelAccount={},m.openchannelAccountOpenchannelCannedAnswers={count:0,rows:[]},m.selectedOpenchannelAccountOpenchannelCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.openchannelAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.OpenchannelAccountId=m.openchannelAccount.id,m.query.id=m.openchannelAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the openchannelCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("openchannelCannedAnswer #")+e.id||"openchannelCannedAnswer")+"</b> will be deleted.").ariaLabel("delete openchannelCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getOpenchannelAccountOpenchannelCannedAnswers=p,m.createOrEditOpenchannelAccountOpenchannelCannedAnswer=function(e,n){o.show({controller:"CreateOrEditOpenchannelCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/openchannelCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:m.openchannelAccount,openchannelCannedAnswer:n,openchannelCannedAnswers:m.openchannelAccountOpenchannelCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedOpenchannelAccountOpenchannelCannedAnswers=function(){var e=angular.copy(m.selectedOpenchannelAccountOpenchannelCannedAnswers);return m.selectedOpenchannelAccountOpenchannelCannedAnswers=[],e},m.deleteOpenchannelAccountOpenchannelCannedAnswer=g,m.deleteSelectedOpenchannelAccountOpenchannelCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected openchannelCannedAnswers?").htmlContent("<b>"+m.selectedOpenchannelAccountOpenchannelCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete openchannelCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedOpenchannelAccountOpenchannelCannedAnswers.forEach(function(e){g(e)}),m.selectedOpenchannelAccountOpenchannelCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountOpenchannelCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="OPENCHANNEL.EDIT_OPENCHANNELCANNEDANSWER",g.openchannelCannedAnswer=angular.copy(l),g.openchannelCannedAnswers=r,g.newOpenchannelCannedAnswer=!1,g.openchannelCannedAnswer||(g.openchannelCannedAnswer={},g.title="OPENCHANNEL.NEW_OPENCHANNELCANNEDANSWER",g.newOpenchannelCannedAnswer=!0),n.params.id&&(g.openchannelCannedAnswer.OpenchannelAccountId=n.params.id),g.addNewOpenchannelCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.openchannelCannedAnswer).$promise.then(function(e){g.openchannelCannedAnswers.unshift(e.toJSON()),o.success({title:"OpenchannelCannedAnswer properly created",msg:g.openchannelCannedAnswer.name?g.openchannelCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOpenchannelCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.openchannelCannedAnswer.id},g.openchannelCannedAnswer).$promise.then(function(e){var n=_.find(g.openchannelCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"OpenchannelCannedAnswer properly saved!",msg:g.openchannelCannedAnswer.name?g.openchannelCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOpenchannelCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The openchannelCannedAnswer will be deleted.").ariaLabel("Delete OpenchannelCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.openchannelCannedAnswer.id}).$promise.then(function(){_.remove(g.openchannelCannedAnswers,{id:g.openchannelCannedAnswer.id}),o.success({title:"OpenchannelCannedAnswer properly deleted!",msg:(g.openchannelCannedAnswer.name||"openchannelCannedAnswer")+" has been deleted!"}),v(g.openchannelCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","openchannelCannedAnswers","openchannelCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.openchannelAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.openchannelAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.OpenchannelAccountId=m.openchannelAccount.id,m.query.id=m.openchannelAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.openchannelAccount.id,field:"OpenchannelAccountId",route:"openchannelAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountDispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.openchannelAccount=c||e.params.openchannelAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.agentadddialog=function(e,n){t.show({controller:"OpenchannelAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelAccount:e,openchannelAccounts:p.openchannelAccounts?p.openchannelAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoOpenchannelAccounts=function(){e.go("app.openchannel.openchannelAccounts",{},{reload:"app.openchannel.openchannelAccounts"})},p.saveOpenchannelAccount=function(){r.openchannelAccount.update({id:p.openchannelAccount.id},p.openchannelAccount).$promise.then(function(){l.success({title:"OpenchannelAccount updated!",msg:p.openchannelAccount.name?p.openchannelAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.openchannelAccount&&(t=_.find(p.lists,{id:Number(p.openchannelAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.openchannelAccount&&(a=_.find(p.lists,{id:Number(p.openchannelAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.cmContact.describe({id:p.openchannelAccount.ListId}).$promise.then(function(e){p.fields=[];e=_.values(e.toJSON());for(var n=["id","createdAt","updatedAt","deletedAt","scheduledat","ListId","CompanyId"],t=0;t<e.length;t++)_.includes(n,e[t].columnName)||p.fields.push(e[t])}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FIELDS",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","openchannelAccount","userProfile","userProfileSection"],angular.module("app.openchannel").controller("OpenchannelAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.openchannelAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="openchannelAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedOpenchannelAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.openchannel.openchannelAccounts.edit",{id:e.id,openchannelAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.openchannel.openchannelAccounts.edit",{id:e.id,tab:5})},f.agentadddialog=function(e,n){i.show({controller:"OpenchannelAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelAccount:e,openchannelAccounts:f.openchannelAccounts?f.openchannelAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("openchannelAccount")+"?").htmlContent("<b>"+(e.name||"openchannelAccount")+"</b> will be deleted.").ariaLabel("delete openchannelAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getOpenchannelAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.openchannelAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="OpenchannelAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditOpenchannelAccount=function(e,n){i.show({controller:"CreateOrEditOpenchannelAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:n,openchannelAccounts:f.openchannelAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteOpenchannelAccount=y,f.exportSelectedOpenchannelAccounts=function(){var e=angular.copy(f.selectedOpenchannelAccounts);return f.selectedOpenchannelAccounts=[],e},f.deleteSelectedOpenchannelAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected openchannelAccounts?").htmlContent("<b>"+f.selectedOpenchannelAccounts.length+" selected</b> will be deleted.").ariaLabel("delete OpenchannelAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedOpenchannelAccounts.forEach(function(e){y(e)}),f.selectedOpenchannelAccounts=[]})},f.deselectOpenchannelAccounts=function(){f.selectedOpenchannelAccounts=[]},f.selectAllOpenchannelAccounts=function(){f.selectedOpenchannelAccounts=f.openchannelAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.openchannelAccount&&(t=_.find(f.lists,{id:Number(f.openchannelAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.openchannelAccount&&(a=_.find(f.lists,{id:Number(f.openchannelAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.openchannelAccounts=e||{count:0,rows:[]}}function y(e){m.openchannelAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.openchannelAccounts.rows,{id:e.id}),f.openchannelAccounts.count-=1,f.openchannelAccounts.rows.length||f.getOpenchannelAccounts(),p.success({title:_.startCase("OpenchannelAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEopenchannelAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getOpenchannelAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","openchannelAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.openchannel").controller("OpenchannelAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="OPENCHANNEL.EDIT_OPENCHANNELQUEUE",g.openchannelQueue=angular.copy(l),g.openchannelQueues=r,g.newOpenchannelQueue=!1,g.openchannelQueue||(g.openchannelQueue={strategy:"beepall",timeout:10},g.title="OPENCHANNEL.NEW_OPENCHANNELQUEUE",g.newOpenchannelQueue=!0),g.addNewOpenchannelQueue=function(){g.errors=[],d.openchannelQueue.save(g.openchannelQueue).$promise.then(function(e){g.openchannelQueues.unshift(e.toJSON()),o.success({title:"OpenchannelQueue properly created",msg:g.openchannelQueue.name?g.openchannelQueue.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOpenchannelQueue=function(){g.errors=[],d.openchannelQueue.update({id:g.openchannelQueue.id},g.openchannelQueue).$promise.then(function(e){var n=_.find(g.openchannelQueues,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"OpenchannelQueue properly saved!",msg:g.openchannelQueue.name?g.openchannelQueue.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOpenchannelQueue=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The openchannelQueue will be deleted.").ariaLabel("Delete OpenchannelQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.openchannelQueue.delete({id:g.openchannelQueue.id}).$promise.then(function(){_.remove(g.openchannelQueues,{id:g.openchannelQueue.id}),o.success({title:"OpenchannelQueue properly deleted!",msg:(g.openchannelQueue.name||"openchannelQueue")+" has been deleted!"}),v(g.openchannelQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","openchannelQueues","openchannelQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.openchannelQueue.getAgents({id:c.openchannelQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserOpenchannelQueue?"penalty "+e.UserOpenchannelQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.openchannelQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.removeAgents({id:c.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.addAgents({id:c.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("OPENCHANNEL.ALL_AGENTS"),labelSelected:r.instant("OPENCHANNEL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","openchannelQueue","openchannelQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.openchannel").controller("OpenchannelQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.openchannelQueue.getTeams({id:l.openchannelQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.openchannelQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("OPENCHANNEL.ALL_TEAMS"),labelSelected:t.instant("OPENCHANNEL.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.removeTeams({id:l.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.addTeams({id:l.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","openchannelQueue","$translate","Auth","crudPermissions"],angular.module("app.openchannel").controller("OpenchannelQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.openchannelQueue=c||e.params.openchannelQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"OpenchannelQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:u.openchannelQueues?u.openchannelQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:u.openchannelQueues?u.openchannelQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoOpenchannelQueues=function(){e.go("app.openchannel.openchannelQueues",{},{reload:"app.openchannel.openchannelQueues"})},u.saveOpenchannelQueue=function(){r.openchannelQueue.update({id:u.openchannelQueue.id},u.openchannelQueue).$promise.then(function(){l.success({title:"OpenchannelQueue updated!",msg:u.openchannelQueue.name?u.openchannelQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","openchannelQueue","userProfileSection"],angular.module("app.openchannel").controller("OpenchannelQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.openchannelQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="openchannelQueues",f.listOrder="",f.listOrderAsc=null,f.selectedOpenchannelQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"openchannel",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.openchannel.openchannelQueues.edit",{id:e.id,openchannelQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"OpenchannelQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:f.openchannelQueues?f.openchannelQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:f.openchannelQueues?f.openchannelQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("openchannelQueue")+"?").htmlContent("<b>"+(e.name||"openchannelQueue")+"</b> will be deleted.").ariaLabel("delete openchannelQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:810}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.openchannel.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.openchannel.realtime.queues",{})}},f.success=E,f.getOpenchannelQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.openchannelQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="OpenchannelQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditOpenchannelQueue=function(e,n){i.show({controller:"CreateOrEditOpenchannelQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelQueue:n,openchannelQueues:f.openchannelQueues.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteOpenchannelQueue=y,f.exportSelectedOpenchannelQueues=function(){var e=angular.copy(f.selectedOpenchannelQueues);return f.selectedOpenchannelQueues=[],e},f.deleteSelectedOpenchannelQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected openchannelQueues?").htmlContent("<b>"+f.selectedOpenchannelQueues.length+" selected</b> will be deleted.").ariaLabel("delete OpenchannelQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedOpenchannelQueues.forEach(function(e){y(e)}),f.selectedOpenchannelQueues=[]})},f.deselectOpenchannelQueues=function(){f.selectedOpenchannelQueues=[]},f.selectAllOpenchannelQueues=function(){f.selectedOpenchannelQueues=f.openchannelQueues.rows};var b=!0,A=1;function E(e){f.openchannelQueues=e||{count:0,rows:[]}}function y(e){m.openchannelQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.openchannelQueues.rows,{id:e.id}),f.openchannelQueues.count-=1,f.openchannelQueues.rows.length||f.getOpenchannelQueues(),p.success({title:_.startCase("OpenchannelQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEopenchannelQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEopenchannelQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getOpenchannelQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","openchannelQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.openchannel").controller("OpenchannelQueuesController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=["loggedIn","available","waiting","paused"],g=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"OpenchannelQueues":void 0,channel:"openchannel",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("OPENCHANNEL.OPENCHANNELQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditOpenchannelQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelQueue:n,openchannelQueues:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelQueue:n,openchannelQueues:u.queues.rows,realtime:!1,crudPermissions:u.crudPermissions}})},r.on("openchannel_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,p))}),r.on("userOpenchannelQueue:save",function(e){var n=_.find(u.queues.rows,["id",e.OpenchannelQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("userOpenchannelQueue:remove",function(e){var n=_.find(u.queues.rows,["id",e.OpenchannelQueueId]);n&&(0<n.loggedInDb&&n.loggedInDb--,_.remove(n.agents,["id",e.UserId]))}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"openchannel")})}),e.$on("$destroy",function(){r.removeAllListeners("openchannel_queue:save"),r.removeAllListeners("userOpenchannelQueue:remove"),r.removeAllListeners("userOpenchannelQueue:save"),r.removeAllListeners("user:update"),g&&n.cancel(g)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.openchannel").controller("QueuesOpenchannelRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.openchannel.realtime.agents":this.selectedTab=0;break;case"app.openchannel.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.openchannel.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.openchannel.realtime.agents");break;case 1:t.go("app.openchannel.realtime.queues");break;default:t.go("app.openchannel.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.openchannel").controller("OpenchannelRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;o.currentUser=s.getCurrentUser(),o.plugin={},o.getTrustedURL=function(){return t.trustAsResourceUrl(o.plugin.adminUrl)},a.plugin.get({id:e.params.id}).$promise.then(function(e){if(e)return o.plugin=e,a.plugin.get({id:o.plugin.id}).$promise}).catch(function(e){o.plugin=void 0})}e.$inject=["$state","$scope","$sce","api","socket","Auth"],angular.module("app.plugins.plugin").controller("PluginController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this,b=t(function(){},999);function A(){f.agents.rows.forEach(function(e){e.globalStatusDisplayValue=v.getAgentStatusDisplayValue(e)})}function E(){return f.query.offset=(f.query.page-1)*f.query.limit,d.realtime.getAgents(f.query).$promise.then(function(e){f.agents=e,A()}).catch(function(e){m.error({title:o.instant("VOICE.AGENTS"),msg:e.status?JSON.stringify(e.data):e.toString()})})}function y(e,n){if(n)return f.agents.count>f.agents.rows.length?E():(a=n,i=_.remove(f.agents.rows,["id",a]),void(f.agents.count-=i.length));if(f.query.sort.includes("globalStatus")&&(!f.query.globalStatusFilter||"busy"===f.query.globalStatusFilter)){var t="-"===f.query.sort[0]?"DESC":"ASC";if(!1===e)return E();if(!0===e)f.agents.rows=v.sortAgentsByStatus(f.agents.rows,t);else{if(f.agents.count>f.agents.rows.length)return E();f.agents.rows=v.sortAgentsByStatus(f.agents.rows,t)}}var a,i}function S(e){if(0!==f.query.globalQueueFilter.length){var n=e[_.capitalize(f.channel)+"QueueId"];f.query.globalQueueFilter.includes(n)&&E()}}function T(e){if(0!==f.query.globalQueueFilter.length){var n=e[_.capitalize(f.channel)+"QueueId"];f.query.globalQueueFilter.includes(n)&&y(!1,e.UserId)}}f.currentUser=p.getCurrentUser(),f.channel=n.params.channel,f.queueType=n.params.direction,f.agents=r,f.pauses=l||{count:0,rows:[]},f.license=g,f.userProfileSection=u&&1==u.count?u.rows[0]:null,f.crudPermissions=p.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.utcOffset=h,f.query={limit:10,page:1,sort:"fullname",globalStatusFilter:null,pauseTypeFilter:null,globalQueueFilter:[],channel:f.channel},f.getAgents=E,f.logout=function(e){return d.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){m.success({title:"Agent logout",msg:e.fullname+"  properly logout"})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:o.instant("VOICE.LOGOUT"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.addQueue=function(e,n){a.show({controller:"AgentQueueAddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,channel:f.channel,direction:f.queueType,crudPermissions:f.crudPermissions}})},f.pause=function(e,n){return d.user.pause({id:e.id,type:n}).$promise.catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:o.instant("VOICE.PAUSE"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.unpause=function(e){return d.user.unpause({id:e.id}).$promise.catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:o.instant("VOICE.UNPAUSE"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.manageScreenRecording=function(e,n){return d.user.update({id:e.id},{screenrecording:n}).$promise.catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:o.instant("VOICE.SCREENRECORDING"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.clearQueuesSelection=function(){f.query.globalQueueFilter=[]},f.selectAllQueues=function(){f.query.globalQueueFilter=f.queues.rows.map(function(e){return e.id})},f.getQueuesByChannel=function(){if(f.queues&&0<f.queues.count)return;var e={type:f.queueType||"inbound",fields:"id,name",sort:"name",nolimit:"true"},n=f.channel+"Queue";return d.getResourcesByRole(f.currentUser,n,e,null).then(function(e){f.queues=e}).catch(function(e){m.error({title:o.instant("VOICE.QUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},c.on("user:save",function(e){var n=_.find(f.agents.rows,["id",e.id]);n&&(n.voicePause&&"idle"===e.voiceStatus&&delete e.voiceStatus,_.merge(n,e),n.globalStatus=v.getAgentStatus(n),n.globalStatusDisplayValue=v.getAgentStatusDisplayValue(n))}),c.on("user:update",function(e){var n=v.getUserUpdateEventOrigin(e);try{switch(n){case"login":!function(e){var n=!1;f.query.globalStatusFilter?e.loginInPause&&"pause"===f.query.globalStatusFilter?n=!0:e.loginInPause||"idle"!==f.query.globalStatusFilter||(n=!0):n=!0;if(n)E()}(e);break;case"logout":!function(e){if(0===f.agents.count)return;var n=_.find(f.agents.rows,["id",e.id]);{if(!n)return E();y(!1,n.id)}}(e);break;case"pause":t=e,(a=_.find(f.agents.rows,["id",t.id]))?(_.merge(a,t),a.globalStatus=v.getAgentStatus(a),v.checkEveryChannelPauseStatus(a),f.query.globalStatusFilter&&a.globalStatus!==f.query.globalStatusFilter?y(!1,a.id):a.globalStatusDisplayValue=v.getAgentStatusDisplayValue(a)):E()}}catch(e){m.error({title:o.instant("VOICE.AGENTS"),msg:e.toString()})}var t,a}),c.on("user:agentconnect",function(e){try{var n=_.find(f.agents.rows,["id",e.id]);y(!0),e.agentconnected?n?(_.merge(n,_.pick(e,["queue","destconnectedlinenum","routealias"])),y()):y(!1):"busy"!==f.query.globalStatusFilter||n||E()}catch(e){m.error({title:o.instant("VOICE.AGENTS"),msg:e.toString()})}}),c.on("user:agentcomplete",function(e){if("ATTENDED"===e.transfer)return;var n=_.find(f.agents.rows,["id",e.id]);n&&(delete n.queue,delete n.destconnectedlinenum,delete n.routealias,"busy"===f.query.globalStatusFilter?y(!1,e.id):y())}),c.on("userVoiceQueue:save",S),c.on("userVoiceQueue:remove",T),c.on("userChatQueue:save",S),c.on("userChatQueue:remove",T),c.on("userSmsQueue:save",S),c.on("userSmsQueue:remove",T),c.on("userMailQueue:save",S),c.on("userMailQueue:remove",T),c.on("userFaxQueue:save",S),c.on("userFaxQueue:remove",T),c.on("userOpenchannelQueue:save",S),c.on("userOpenchannelQueue:remove",T),c.on("userWhatsappQueue:save",S),c.on("userWhatsappQueue:remove",T),A(),e.$on("$destroy",function(){c.removeAllListeners("user:save"),c.removeAllListeners("user:update"),c.removeAllListeners("user:agentconnect"),c.removeAllListeners("user:agentcomplete"),c.removeAllListeners("userVoiceQueue:save"),c.removeAllListeners("userVoiceQueue:remove"),c.removeAllListeners("userChatQueue:save"),c.removeAllListeners("userChatQueue:remove"),c.removeAllListeners("userSmsQueue:save"),c.removeAllListeners("userSmsQueue:remove"),c.removeAllListeners("userMailQueue:save"),c.removeAllListeners("userMailQueue:remove"),c.removeAllListeners("userFaxQueue:save"),c.removeAllListeners("userFaxQueue:remove"),c.removeAllListeners("userOpenchannelQueue:save"),c.removeAllListeners("userOpenchannelQueue:remove"),c.removeAllListeners("userWhatsappQueue:save"),c.removeAllListeners("userWhatsappQueue:remove"),b&&t.cancel(b)})}e.$inject=["$scope","$state","$interval","$mdDialog","$document","$q","$translate","agents","pauses","api","socket","toasty","userProfileSection","Auth","license","realtimeManager","utcOffset"],angular.module("app.realtime").controller("AgentsRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u){var p=this;function g(e){p.cloudProviders=e||{count:0,rows:[]}}function v(e){r.cloudProvider.delete({id:e.id}).$promise.then(function(){_.remove(p.cloudProviders.rows,{id:e.id}),p.cloudProviders.count-=1,p.cloudProviders.rows.length||p.getAiTools(),d.success({title:s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcloudProvider"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcloudProvider",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}p.license=m,p.setting=u,p.currentUser=c.getCurrentUser(),p.cloudProviders=o||{count:0,rows:[]},p.selectedAiTools=[],p.query={fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data5,data6",sort:"-updatedAt",limit:10,page:1},p.services={AmazonAWS:"AmazonAWS",MicrosoftAzure:"Microsoft Azure"},p.editdialog=function(e,n){a.show({controller:"CreateOrEditCloudProviderDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/cloudProviders/create/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{cloudProvider:e,cloudProviders:p.cloudProviders.rows,license:p.license,setting:null,crudPermissions:p.crudPermissions}})},p.deleteconfirm=function(e,n){var t=a.confirm().title(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_TITLE")).content(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_MESSAGE",{name:e.name})).ariaLabel("delete cloud provider").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){v(e)})},p.success=g,p.getAiTools=function(){p.query.offset=(p.query.page-1)*p.query.limit,c.hasRole("admin")?p.promise=r.cloudProvider.get(p.query,g).$promise:(p.query.id=p.userProfile.id,p.query.section="AiTools",p.promise=r.userProfile.getResources(p.query,g).$promise)},p.createOrEditCloudProvider=function(e,n){a.show({controller:"CreateOrEditCloudProviderDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/cloudProviders/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{cloudProvider:n,cloudProviders:p.cloudProviders.rows,license:p.license,setting:p.setting,crudPermissions:p.crudPermissions}})},p.deleteCloudProvider=v,p.exportSelectedAiTools=function(){var e=angular.copy(p.selectedAiTools);return p.selectedAiTools=[],e},p.deleteSelectedAiTools=function(e){var n=a.confirm().title(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDERS_DELETE_TITLE")).content(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDERS_DELETE_MESSAGE",{total:p.selectedAiTools.length})).ariaLabel("delete CloudProviders").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){p.selectedAiTools.forEach(function(e){v(e)}),p.selectedAiTools=[],d.success({title:s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDERS_DELETED_SUCCESS_TITLE")})})},p.deselectAiTools=function(){p.selectedAiTools=[]},p.selectAllAiTools=function(){p.selectedAiTools=p.cloudProviders.rows},p.authenticateToMicrosoftIdentityPlatform=function(e){return r.cloudProvider.oauth2MicrosoftAuthorize({id:e.id}).$promise.then(function(e){p.loginWindow=n.open(e.url,"_blank","width=800,height=600")})},p.updateClientSecret=function(n,e){return a.show({controller:"UpdateClientSecretController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/cloudProviders/updateSecret/updateSecret.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{cloudProvider:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,service,data3",id:n.id})}]}})},l.on("microsoftAuthorization:success",function(e){p.currentUser.id===e.id&&(p.loginWindow.close(),d.success({msg:s.instant("SETTINGS.NOTIFICATIONS.MICROSOFT_AUTHENTICATION_SUCCESS")}))}),l.on("microsoftAuthorization:error",function(e){p.currentUser.id===e.id&&(p.loginWindow.close(),d.error({msg:s.instant("SETTINGS.NOTIFICATIONS.MICROSOFT_AUTHENTICATION_FAIL")}))}),e.$on("$destroy",function(){l.removeAllListeners("microsoftAuthorization:success"),l.removeAllListeners("microsoftAuthorization:error")});var h=!0,f=1;e.$watch("vm.query.filter",function(e,n){h?i(function(){h=!1}):(n||(f=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=f),p.getAiTools())})}e.$inject=["$scope","$window","$mdDialog","$document","$timeout","$translate","cloudProviders","api","socket","toasty","Auth","license","setting"],angular.module("app.settings").controller("CloudProvidersController",e)}(),function(){"use strict";function e(t,a,i,e,n,s,o,r){var l=this;function d(e){t.hide(e)}l.currentUser=o.getCurrentUser(),l.license=r,l.cloudProvider=angular.copy(n),l.cloudProviders=e,l.newCloudProvider=!1,l.errors=[],l.cloudProvider||(l.cloudProvider={},l.newCloudProvider=!0),l.addNewCloudProvider=function(){l.errors=[],s.cloudProvider.save(l.cloudProvider).$promise.then(function(e){l.cloudProviders.unshift(e.toJSON()),i.success({title:a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_CREATED_SUCCESS_TITLE")}),d(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},l.saveCloudProvider=function(){l.errors=[],s.cloudProvider.update({id:l.cloudProvider.id},l.cloudProvider).$promise.then(function(e){var n=_.find(l.cloudProviders,{id:e.id});n&&_.merge(n,e.toJSON()),i.success({title:a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_SAVED_SUCCESS_TITLE")}),d(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},l.deleteCloudProvider=function(e){l.errors=[];var n=t.confirm().title(a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_TITLE")).content(a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_MESSAGE",{name:l.cloudProvider.name})).ariaLabel("Delete Cloud Provider").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){s.cloudProvider.delete({id:l.cloudProvider.id}).$promise.then(function(){_.remove(l.cloudProviders,{id:l.cloudProvider.id}),i.success({title:a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETED_SUCCESS_TITLE")}),d(l.cloudProvider)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},l.closeDialog=d}e.$inject=["$mdDialog","$translate","toasty","cloudProviders","cloudProvider","api","Auth","license"],angular.module("app.settings").controller("CreateOrEditCloudProviderDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;function o(){e.hide()}s.cloudProvider=i,s.errors=[],s.saveSecret=function(){return s.errors=[],a.cloudProvider.update({id:i.id},{data3:s.newSecret}).$promise.then(function(){t.success({title:n.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_SECRET_UPDATE_SUCCESS_TITLE")}),o()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){s.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.update"}];for(var n=0;n<e.data.errors.length;n+=1)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},s.closeDialog=o}e.$inject=["$mdDialog","$translate","toasty","api","cloudProvider"],angular.module("app.settings").controller("UpdateClientSecretController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SETTINGS.EDIT_CUSTOMIZATION",g.customization=angular.copy(l),g.customizations=r,g.newCustomization=!1,g.customization||(g.customization={},g.title="SETTINGS.NEW_CUSTOMIZATION",g.newCustomization=!0),g.addNewCustomization=function(){g.errors=[],d.setting.save(g.customization).$promise.then(function(e){g.customizations.unshift(e.toJSON()),o.success({title:"Customization properly created",msg:g.customization.name?g.customization.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCustomization=function(){g.errors=[],d.setting.update({id:g.customization.id},g.customization).$promise.then(function(e){var n=_.find(g.customizations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Customization properly saved!",msg:g.customization.name?g.customization.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCustomization=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The customization will be deleted.").ariaLabel("Delete Customization").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.setting.delete({id:g.customization.id}).$promise.then(function(){_.remove(g.customizations,{id:g.customization.id}),o.success({title:"Customization properly deleted!",msg:(g.customization.name||"customization")+" has been deleted!"}),v(g.customization)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","customizations","customization","api","Auth","license","setting","crudPermissions"],angular.module("app.settings").controller("CreateOrEditCustomizationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.currentUser=i.getCurrentUser(),s.license=a,s.customizations=e,s.customization={},s.customizations&&s.customizations.rows&&s.customizations.rows.length&&(s.customization=s.customizations.rows[0]),s.saveCustomization=function(){s.customization.id?n.setting.update({id:s.customization.id},s.customization).$promise.then(function(){t.success({title:"Customization updated!",msg:s.customization.name?s.customization.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})}):n.setting.save(s.customization).$promise.then(function(e){_.merge(s.customization,e),t.success({title:"Customization updated!",msg:s.customization.name?s.customization.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["customizations","api","toasty","license","Auth"],angular.module("app.settings").controller("CustomizationsController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg","ico"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/favicon".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationfaviconController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/logo".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationlogoController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/logo_login".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationlogologinController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/preferred".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationpreferredController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SETTINGS.EDIT_GENERAL",g.general=angular.copy(l),g.generals=r,g.newGeneral=!1,g.general||(g.general={min_internal:1e3,chatTimeout:30,phoneBarAutoUpdater:!0,phoneBarAutoUpdaterUrl:"https://www.xcally.com/bar/phonebar/autoupdater.xml",splitSizeCsv:5e3,splitSizePdf:1e3,splitSizeXlsx:5e3,messagesAlignment:"alternate",phoneBarRememberMeEnabled:!0,allowedLoginAttempts:5,blockDuration:10,loginMailFrequency:10,enforcePasswordHistory:!0,passwordHistoryLimit:3},g.title="SETTINGS.NEW_GENERAL",g.newGeneral=!0),g.addNewGeneral=function(){g.errors=[],d.setting.save(g.general).$promise.then(function(e){g.generals.unshift(e.toJSON()),o.success({title:"General properly created",msg:g.general.name?g.general.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveGeneral=function(){g.errors=[],d.setting.update({id:g.general.id},g.general).$promise.then(function(e){var n=_.find(g.generals,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"General properly saved!",msg:g.general.name?g.general.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteGeneral=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The general will be deleted.").ariaLabel("Delete General").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.setting.delete({id:g.general.id}).$promise.then(function(){_.remove(g.generals,{id:g.general.id}),o.success({title:"General properly deleted!",msg:(g.general.name||"general")+" has been deleted!"}),v(g.general)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,d.cloudProvider.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.cloudProviders=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CLOUDPROVIDERS",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","generals","general","api","Auth","license","setting","crudPermissions"],angular.module("app.settings").controller("CreateOrEditGeneralDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.currentUser=i.getCurrentUser(),s.license=a,s.generals=e,s.general={},s.generals&&s.generals.rows&&s.generals.rows.length&&(s.general=s.generals.rows[0]),_.isNil(s.general.privacyPolicyEmail)||(s.general.enablePrivacyPolicyEmail=!0),_.isNil(s.general.privacyPolicyName)||(s.general.enablePrivacyPolicyName=!0),_.isNil(s.general.privacyPolicyNumber)||(s.general.enablePrivacyPolicyNumber=!0),n.cloudProvider.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){s.cloudProviders=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CLOUDPROVIDERS",msg:e.data?JSON.stringify(e.data):e.toString()})}),s.saveGeneral=function(){s.general.enablePrivacyPolicyEmail||(s.general.privacyPolicyEmail=null),s.general.enablePrivacyPolicyNumber||(s.general.privacyPolicyNumber=null),s.general.enablePrivacyPolicyName||(s.general.privacyPolicyName=null),s.general.id?n.setting.update({id:s.general.id},s.general).$promise.then(function(){t.success({title:"General updated!",msg:s.general.name?s.general.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})}):n.setting.save(s.general).$promise.then(function(e){_.merge(s.general,e),t.success({title:"General updated!",msg:s.general.name?s.general.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.onPrivacyPolicyChange=function(e){switch(e){case"email":s.general.enablePrivacyPolicyEmail&&!s.general.privacyPolicyEmail&&(s.general.privacyPolicyEmail=0);break;case"name":s.general.enablePrivacyPolicyName&&!s.general.privacyPolicyName&&(s.general.privacyPolicyName=0);break;case"number":s.general.enablePrivacyPolicyNumber&&!s.general.privacyPolicyNumber&&(s.general.privacyPolicyNumber=0)}}}e.$inject=["generals","api","toasty","license","Auth"],angular.module("app.settings").controller("GeneralsController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r,l){var d=this;d.license=i||{},d.agents=0,d.users=0,d.telephones=0,d.channels=[{name:"voice",icon:"icon-phone"},{name:"chat",icon:"icon-hangouts"},{name:"mail",icon:"icon-email"},{name:"messaging",icon:"icon-message-text"},{name:"fax",icon:"icon-deskphone"},{name:"openchannel",icon:"icon-google-earth"},{name:"whatsapp",icon:"icon-whatsapp"}],d.modules=[{name:"cm",icon:"icon-account-circle"},{name:"dialer",icon:"icon-crosshairs"},{name:"jscripty",icon:"icon-console"}],d.addons=[{name:"webrtc",icon:"icon-server-plus"},{name:"jaws",icon:"icon-fish"},{name:"custom",icon:"icon-table-edit"},{name:"screenrecording",icon:"icon-video"},{name:"ai",icon:"icon-text-to-speech"}],d.sessions=[{name:"callysquare",icon:"icon-sitemap",restart:!0,label:"channels",enabled:"voice"},{name:"virtual",icon:"icon-dots-horizontal",restart:!1,label:"sessions",enabled:"chat"}],d.others=[{name:"update",icon:"icon-cloud-download"}],d.requestLicense=function(e){t.show({controller:"RequestLicenseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/license/request/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:i,channels:d.channels,modules:d.modules,addons:d.addons,sessions:d.sessions,others:d.others}})},d.updateLicense=function(e){t.show({controller:"UpdateLicenseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/license/update/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:i}})},d.gotoProcess=function(e){a.go("app.settings.system",{tab:1})},d.alert=s.info,d.downloadLogFile=function(){return o.license.downloadLogFile().$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download","license-info.log"),document.body.appendChild(a),a.click(),s.success({title:l.instant("SETTINGS.LICENSE_LOG_FILE"),msg:l.instant("SETTINGS.LICENSE_LOG_FILE_DOWNLOADED")})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DOWNLOADJSON",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.isAdmin=r.isAdmin(),o.user.get({fields:"id",role:"agent",online:!0}).$promise.then(function(e){return d.agents=e&&e.count?e.count:0,o.user.get({fields:"id",role:"user,admin"}).$promise}).then(function(e){return d.users=e&&e.count?e.count:0,o.user.get({fields:"id",role:"telephone"}).$promise}).then(function(e){d.telephones=e&&e.count?e.count:0}).catch(function(e){console.log(e)})}e.$inject=["$document","$window","$mdDialog","$state","license","toasty","api","Auth","$translate"],angular.module("app.settings.license").controller("LicenseController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(){e.hide()}m.errors=[],m.user=d.getCurrentUser(),m.license=angular.copy(t),m.channels=a,m.modules=i,m.addons=s,m.sessions=o,m.others=r,m.license.name=m.user.fullname,m.license.email=m.user.email,m.sendRequest=function(){for(var e in m.errors=[],m.table="||FIELD||OLD||NEW||\n",m.license)m.license.hasOwnProperty(e)&&!_.includes(["$promise","$resolved"],e)&&(t[e]===m.license[e]?m.table+="|"+e+"|"+(void 0!==t[e]?t[e]:"")+"|"+m.license[e]+"|\n":m.table+="|"+e+"|{color:red}"+(void 0!==t[e]?t[e]:"")+"{color}|*"+m.license[e]+"*|\n");l.jira.save({key:"MOTLICENSE",summary:"Motion License Request",description:m.table,issuetype:"License Request"}).$promise.then(function(e){n.success({title:"Request sent!",msg:c.instant("SETTINGS.LICENSE_REQUEST_SENT"),timeout:15e3}),u()}).catch(function(e){console.error(e),m.errors=[{message:c.instant("SETTINGS.JIRA_ERROR_MESSAGE"),type:"api.jira"}]})},m.closeDialog=u}e.$inject=["$mdDialog","toasty","license","channels","modules","addons","sessions","others","api","Auth","$translate"],angular.module("app.settings.license").controller("RequestLicenseDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.errors=[],s.license=angular.copy(t),s.licenseKey,s.updateLicense=function(){return a.license.update({id:1,key:s.licenseKey}).$promise.then(function(e){e&&(e.demo?n.error({title:"License update failed!",msg:"Invalid license key"}):n.success({title:"License properly updated!",msg:"The license has been updated!"}))}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATElicense",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","toasty","license","api","$translate"],angular.module("app.settings.license").controller("UpdateLicenseDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(e){a.hide(e)}p.currentUser=c.getCurrentUser(),p.errors=[],p.setting=u,p.license=m,p.hasModulePermissions={},p.passwordPattern=p.setting&&p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.title="SETTINGS.EDIT_NETWORK",p.network=angular.copy(l),p.networks=r,p.newNetwork=!1,p.network||(p.network={type:"localnet"},p.title="SETTINGS.NEW_NETWORK",p.newNetwork=!0),p.addNewNetwork=function(){p.errors=[],d.network.save(p.network).$promise.then(function(e){p.networks.unshift(e.toJSON()),o.success({title:"Network properly created",msg:p.network.name?p.network.name+" has been created!":""}),g(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.network.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.network.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.saveNetwork=function(){p.errors=[],d.network.update({id:p.network.id},p.network).$promise.then(function(e){var n=_.find(p.networks,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Network properly saved!",msg:p.network.name?p.network.name+" has been saved!":""}),g(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.network.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.network.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.deleteNetwork=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The network will be deleted.").ariaLabel("Delete Network").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.network.delete({id:p.network.id}).$promise.then(function(){_.remove(p.networks,{id:p.network.id}),o.success({title:"Network properly deleted!",msg:(p.network.name||"network")+" has been deleted!"}),g(p.network)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.network.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.network.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},p.getDateFromString=function(e){return null===e?void 0:new Date(e)},p.closeDialog=g}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","networks","network","api","Auth","license","setting"],angular.module("app.settings").controller("CreateOrEditNetworkDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this;v.license=p,v.setting=g,v.currentUser=u.getCurrentUser(),v.networks=l||{count:0,rows:[]},v.table="networks",v.listOrder="",v.listOrderAsc=null,v.selectedNetworks=[],v.query={fields:"createdAt,updatedAt,id,type,value,username,password",sort:"-updatedAt",limit:10,page:1},v.arraytype=_.keyBy([{option:"LocalNET",value:"'localnet'"},{option:"ExternIP",value:"'externip'"},{option:"Turn",value:"'turn'"},{option:"Stun",value:"'stun'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),v.editdialog=function(e,n){i.show({controller:"CreateOrEditNetworkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/networks/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{network:e,networks:v.networks.rows,license:v.license,setting:null,crudPermissions:v.crudPermissions}})},v.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("network")+"?").htmlContent("<b>"+(e.name||"network")+"</b> will be deleted.").ariaLabel("delete network").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){A(e)},function(){console.log("CANCEL")})},v.success=b,v.getNetworks=function(){v.query.offset=(v.query.page-1)*v.query.limit,u.hasRole("admin")?v.promise=d.network.get(v.query,b).$promise:(v.query.id=v.userProfile.id,v.query.section="Networks",v.promise=d.userProfile.getResources(v.query,b).$promise)},v.createOrEditNetwork=function(e,n){i.show({controller:"CreateOrEditNetworkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/networks/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{network:n,networks:v.networks.rows,license:v.license,setting:v.setting,crudPermissions:v.crudPermissions}})},v.deleteNetwork=A,v.exportSelectedNetworks=function(){var e=angular.copy(v.selectedNetworks);return v.selectedNetworks=[],e},v.deleteSelectedNetworks=function(e){var n=i.confirm().title("Are you sure want to delete the selected networks?").htmlContent("<b>"+v.selectedNetworks.length+" selected</b> will be deleted.").ariaLabel("delete Networks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){v.selectedNetworks.forEach(function(e){A(e)}),v.selectedNetworks=[]})},v.deselectNetworks=function(){v.selectedNetworks=[]},v.selectAllNetworks=function(){v.selectedNetworks=v.networks.rows};var h=!0,f=1;function b(e){v.networks=e||{count:0,rows:[]}}function A(e){d.network.delete({id:e.id}).$promise.then(function(){_.remove(v.networks.rows,{id:e.id}),v.networks.count-=1,v.networks.rows.length||v.getNetworks(),m.success({title:_.startCase("Network")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEnetwork"}];for(var n=0;n<e.data.errors.length;n++)m.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEnetwork",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){h?o(function(){h=!1}):(n||(f=v.query.page),e!==n&&(v.query.page=1),e||(v.query.page=f),v.getNetworks())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","networks","api","msUtils","toasty","Auth","license","setting"],angular.module("app.settings").controller("NetworksController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;l.currentUser=o.getCurrentUser(),l.license=s,l.providers=r.getEmailProviders(),l.mailAccounts=e||{rows:[],count:0},l.cloudProviders=t||{rows:[],count:0},l.mailAccount={service:!0,Smtp:{}},0<l.mailAccounts.count&&(l.mailAccount=l.mailAccounts.rows[0]),l.originalProvider=l.mailAccount.provider,l.saveSmtp=function(){var e=angular.copy(l.mailAccount);"custom"===e.provider?e.provider=null:(l.originalProvider!==e.provider&&(e.Smtp.modernAuthentication?e.Smtp.pass=null:e.Smtp.CloudProviderId=null),e.Smtp.modernAuthentication||(e.Smtp.CloudProviderId=null),e.Smtp=_.omit(e.Smtp,["host","port","secure","service"]));l.mailAccount.id?a.mailAccount.update({id:l.mailAccount.id},e).$promise.then(function(){l.originalProvider=e.provider,i.success({msg:n.instant("SETTINGS.NOTIFICATIONS.SMTP_SAVED_SUCCESS_TITLE")})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}):a.mailAccount.save(e).$promise.then(function(e){_.merge(l.mailAccount,e),i.success({msg:n.instant("SETTINGS.NOTIFICATIONS.SMTP_SAVED_SUCCESS_TITLE")})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},l.verifySmtp=function(){a.mailAccount.verifySmtp({id:l.mailAccount.id}).$promise.then(function(){i.success({msg:n.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_SUCCESS_TITLE")})}).catch(function(e){i.error({title:n.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_FAIL_TITLE"),msg:e.data?JSON.stringify(e.data):e.toString(),timeout:1e4})})},l.onProviderChange=function(){"custom"!==l.mailAccount.provider&&(l.mailAccount.authentication=!0);"outlook365"!==l.mailAccount.provider&&(l.mailAccount.Smtp.modernAuthentication=!1)}}e.$inject=["$translate","mailAccounts","cloudProviders","api","toasty","license","Auth","msUtils"],angular.module("app.settings").controller("SmtpController",e)}(),function(){"use strict";function e(e,i,s,n,t,a,o,r){var l,d=this;d.system=t||{},d.processes=a?a.rows:[],d.processLimit=7,d.selectedTab=n.params.tab||0,d.getInfo=function(){return r.system.get().$promise.then(function(e){_.merge(d.system,e)}).catch(d.cancelInterval)},d.getProcesses=function(){return r.pm2.get().$promise.then(function(e){_.merge(d.processes,e?e.rows:[])}).catch(d.cancelInterval)},d.cancelInterval=function(e){i.cancel(l)},d.updateProcess=function(e,n,t){var a=s.confirm().title("Would you like to change the status of the process #"+n+"?").textContent("The status will be changed to: "+t.toUpperCase()).ariaLabel("Lucky day").targetEvent(e).ok("Ok").cancel("Cancel");s.show(a).then(function(){return r.pm2.update({id:n,status:t})}).then(function(){i(d.getProcesses,1e3,1)}).then(function(){o.success({title:"Process updated!",msg:"Status properly changed to: "+t})})},l=i(d.getInfo,5e3),e.$on("$destroy",function(){d.cancelInterval()})}e.$inject=["$scope","$interval","$mdDialog","$state","system","processes","toasty","api"],angular.module("app.settings.system").controller("SystemController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.title="SETTINGS.UPDATE",s.progress=0,s.updating=!0,s.output="Waiting...",s.success=!0,s.interval=n(function(){s.progress<90&&(s.progress+=1)},1e3),s.closeDialog=function(){e.hide()},s.reload=function(){t.location.reload()},s.stopInterval=function(){angular.isDefined(s.interval)&&(n.cancel(s.interval),s.interval=void 0);s.progress=100,s.updating=!1},i.version.fetch().$promise.then(function(e){return s.output=e.output+"...",i.version.reset().$promise}).then(function(e){return s.output=e.output+"...",i.version.pull().$promise}).then(function(e){return s.output=e.output+"...",i.version.migrations().$promise}).then(function(e){return s.output=e.output+"...",i.version.restart().$promise}).then(function(e){s.output="Waiting to restart motion...",a(function(){s.stopInterval()},3e4)}).catch(function(e){s.success=!1,s.stopInterval(),s.output=JSON.stringify(e)})}e.$inject=["$mdDialog","$interval","$window","$timeout","api"],angular.module("app.settings").controller("UpdateDialogController",e)}(),function(){"use strict";function e(t,e,a,n,i){this.version=n||{},this.updateConfirm=function(e){var n=t.confirm().title("Would you like to update your system?").htmlContent('The system request time for the update should be below 1 minute.<br><br>Do you agree the terms of this <a href="http://www.xcally.com/support/eula-xcally-license-en.pdf" target="_blank">End User License Agreement<a>?').ariaLabel("").targetEvent(e).clickOutsideToClose(!0).parent(angular.element(a.body)).ok("I agree").cancel("Disagree");t.show(n).then(function(){t.show({controller:"UpdateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/updates/update/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!1})})}}e.$inject=["$mdDialog","$interval","$document","version","toasty"],angular.module("app.settings").controller("UpdatesController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=["loggedIn","available","waiting","paused"],g=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"SmsQueues":void 0,channel:"sms",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("SMS.SMSQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditSmsQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsQueue:n,smsQueues:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsQueue:n,smsQueues:u.queues.rows,realtime:!1,crudPermissions:u.crudPermissions}})},r.on("sms_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,p))}),r.on("userSmsQueue:save",function(e){var n=_.find(u.queues.rows,["id",e.SmsQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("userSmsQueue:remove",function(e){var n=_.find(u.queues.rows,["id",e.SmsQueueId]);n&&(0<n.loggedInDb&&n.loggedInDb--,_.remove(n.agents,["id",e.UserId]))}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"sms")})}),e.$on("$destroy",function(){r.removeAllListeners("sms_queue:save"),r.removeAllListeners("userSmsQueue:remove"),r.removeAllListeners("userSmsQueue:save"),r.removeAllListeners("user:update"),g&&n.cancel(g)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.sms").controller("QueuesSmsRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.sms.realtime.agents":this.selectedTab=0;break;case"app.sms.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.sms.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.sms.realtime.agents");break;case 1:t.go("app.sms.realtime.queues");break;default:t.go("app.sms.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.sms").controller("SmsRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SMS.EDIT_SMSACCOUNT",g.smsAccount=angular.copy(l),g.smsAccounts=r,g.newSmsAccount=!1,g.smsAccount||(g.smsAccount={remote:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),type:"twilio",waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="SMS.NEW_SMSACCOUNT",g.newSmsAccount=!0),n.params.id&&(g.smsAccount.SmsAccountId=n.params.id),g.addNewSmsAccount=function(){g.errors=[],d.smsAccount.save(g.smsAccount).$promise.then(function(e){g.smsAccounts.unshift(e.toJSON()),o.success({title:"SmsAccount properly created",msg:g.smsAccount.name?g.smsAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmsAccount=function(){g.errors=[],d.smsAccount.update({id:g.smsAccount.id},g.smsAccount).$promise.then(function(e){var n=_.find(g.smsAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SmsAccount properly saved!",msg:g.smsAccount.name?g.smsAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmsAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The smsAccount will be deleted.").ariaLabel("Delete SmsAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.smsAccount.delete({id:g.smsAccount.id}).$promise.then(function(){_.remove(g.smsAccounts,{id:g.smsAccount.id}),o.success({title:"SmsAccount properly deleted!",msg:(g.smsAccount.name||"smsAccount")+" has been deleted!"}),v(g.smsAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.smsAccount&&(t=_.find(g.lists,{id:Number(g.smsAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.smsAccount&&(a=_.find(g.lists,{id:Number(g.smsAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","smsAccounts","smsAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.smsAccountApps.rows.length){var t=r.smsAccountApps.rows[n]?r.smsAccountApps.rows[n]:r.smsAccountApps.rows[0];i.show({controller:"EditSmsAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccountApp:t,smsAccount:r.smsAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.smsAccountApps.rows[n]=e:r.smsAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.smsAccountApps.rows.length;t++,0){var a=r.smsAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.smsAccount.context,a.exten=r.smsAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.smsAccount.addApplications({id:r.smsAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.smsAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.smsAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.smsAccount={},r.smsAccountApps={count:0,rows:[]},r.selectedSmsAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"SmsQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"smsQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:701}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",nolimit:!0,role:"agent"},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]},{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:4,help:!0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.smsAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getSmsAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.smsAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getSmsAccountApps=function(){r.promise=o.smsAccount.getApplications(r.query,t).$promise},r.editSmsAccountApp=n,r.editInterval=function(e,n){if(r.smsAccountApps.rows.length){var t=r.smsAccountApps.rows[n]?r.smsAccountApps.rows[n]:r.smsAccountApps.rows[0];i.show({controller:"EditSmsAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteSmsAccountApp=function(e){_.remove(r.smsAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedSmsAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedSmsAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedSmsAccountApps.forEach(function(e){_.remove(r.smsAccountApps.rows,{id:e.id})}),r.selectedSmsAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.sms").controller("SmsAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.smsAccount.getAgents({id:c.smsAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserSmsAccount?"penalty "+e.UserSmsAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.smsAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.smsAccount.removeAgents({id:c.smsAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.smsAccount.addAgents({id:c.smsAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("SMS.ALL_AGENTS"),labelSelected:r.instant("SMS.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","smsAccount","smsAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.sms").controller("SmsAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditSmsAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("sms")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.smsQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.smsQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:701}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"smsAccount",action:"getDispositions",field:"name",params:{id:m.smsAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.smsAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.smsAccountInteractions.rows.length;n+=1){var t=m.smsAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.smsInteraction.get(m.query,p).$promise}function v(e){d.smsInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.smsAccountInteractions.rows,{id:e.id}),m.smsAccountInteractions.count-=1,m.smsAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETsmsAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?(e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""),e.contactInfo=e.Contact.mobile):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.smsAccount={},m.smsAccountInteractions={count:0,rows:[]},m.selectedSmsAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.smsAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.SmsAccountId=m.smsAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.smsInteractionDownload=function(s,e,n){return d.smsInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="sms-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getSmsAccountInteractions=g,m.createOrEditSmsAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:m.smsAccount,interaction:n,interactions:m.smsAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spysmsInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"sms",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"sms.smsAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||SmsAccountId:=$eq["+m.smsAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedSmsAccountInteractions=function(){var e=angular.copy(m.selectedSmsAccountInteractions);return m.selectedSmsAccountInteractions=[],e},m.deleteSmsAccountInteraction=v,m.deleteSelectedSmsAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedSmsAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedSmsAccountInteractions.forEach(function(e){v(e)}),m.selectedSmsAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.sms").controller("SmsAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.smsAccountSmsCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.smsAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.smsAccountSmsCannedAnswers.rows,{id:e.id}),m.smsAccountSmsCannedAnswers.count-=1,m.smsAccountSmsCannedAnswers.rows.length||p(),l.success({title:"SmsCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETsmsAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.smsAccount={},m.smsAccountSmsCannedAnswers={count:0,rows:[]},m.selectedSmsAccountSmsCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.smsAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.SmsAccountId=m.smsAccount.id,m.query.id=m.smsAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the smsCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("smsCannedAnswer #")+e.id||"smsCannedAnswer")+"</b> will be deleted.").ariaLabel("delete smsCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getSmsAccountSmsCannedAnswers=p,m.createOrEditSmsAccountSmsCannedAnswer=function(e,n){o.show({controller:"CreateOrEditSmsCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/smsCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:m.smsAccount,smsCannedAnswer:n,smsCannedAnswers:m.smsAccountSmsCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedSmsAccountSmsCannedAnswers=function(){var e=angular.copy(m.selectedSmsAccountSmsCannedAnswers);return m.selectedSmsAccountSmsCannedAnswers=[],e},m.deleteSmsAccountSmsCannedAnswer=g,m.deleteSelectedSmsAccountSmsCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected smsCannedAnswers?").htmlContent("<b>"+m.selectedSmsAccountSmsCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete smsCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedSmsAccountSmsCannedAnswers.forEach(function(e){g(e)}),m.selectedSmsAccountSmsCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.sms").controller("SmsAccountSmsCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SMS.EDIT_SMSCANNEDANSWER",g.smsCannedAnswer=angular.copy(l),g.smsCannedAnswers=r,g.newSmsCannedAnswer=!1,g.smsCannedAnswer||(g.smsCannedAnswer={},g.title="SMS.NEW_SMSCANNEDANSWER",g.newSmsCannedAnswer=!0),n.params.id&&(g.smsCannedAnswer.SmsAccountId=n.params.id),g.addNewSmsCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.smsCannedAnswer).$promise.then(function(e){g.smsCannedAnswers.unshift(e.toJSON()),o.success({title:"SmsCannedAnswer properly created",msg:g.smsCannedAnswer.name?g.smsCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmsCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.smsCannedAnswer.id},g.smsCannedAnswer).$promise.then(function(e){var n=_.find(g.smsCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SmsCannedAnswer properly saved!",msg:g.smsCannedAnswer.name?g.smsCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmsCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The smsCannedAnswer will be deleted.").ariaLabel("Delete SmsCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.smsCannedAnswer.id}).$promise.then(function(){_.remove(g.smsCannedAnswers,{id:g.smsCannedAnswer.id}),o.success({title:"SmsCannedAnswer properly deleted!",msg:(g.smsCannedAnswer.name||"smsCannedAnswer")+" has been deleted!"}),v(g.smsCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","smsCannedAnswers","smsCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.smsAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.smsAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.SmsAccountId=m.smsAccount.id,m.query.id=m.smsAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.smsAccount.id,field:"SmsAccountId",route:"smsAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.sms").controller("SmsAccountDispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.smsAccount=c||e.params.smsAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.agentadddialog=function(e,n){t.show({controller:"SmsAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsAccount:e,smsAccounts:p.smsAccounts?p.smsAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoSmsAccounts=function(){e.go("app.sms.smsAccounts",{},{reload:"app.sms.smsAccounts"})},p.saveSmsAccount=function(){r.smsAccount.update({id:p.smsAccount.id},p.smsAccount).$promise.then(function(){l.success({title:"SmsAccount updated!",msg:p.smsAccount.name?p.smsAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.smsAccount&&(t=_.find(p.lists,{id:Number(p.smsAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.smsAccount&&(a=_.find(p.lists,{id:Number(p.smsAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","smsAccount","userProfile","userProfileSection"],angular.module("app.sms").controller("SmsAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.smsAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="smsAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedSmsAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Twilio",value:"'twilio'"},{option:"Skebby",value:"'skebby'"},{option:"Connectel",value:"'connectel'"},{option:"ClickSend",value:"'clicksend'"},{option:"Plivo",value:"'plivo'"},{option:"Infobip",value:"'infobip'"},{option:"Clickatell",value:"'clickatell'"},{option:"Bandwidth",value:"'bandwidth'"},{option:"CSCTelecom",value:"'csc'"},{option:"Intelepeer",value:"'intelepeer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysmsMethod=_.keyBy([{option:"Basic",value:"'SI'"},{option:"Classic",value:"'TI'"},{option:"Classic+",value:"'GP'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.sms.smsAccounts.edit",{id:e.id,smsAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.sms.smsAccounts.edit",{id:e.id,tab:5})},f.agentadddialog=function(e,n){i.show({controller:"SmsAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsAccount:e,smsAccounts:f.smsAccounts?f.smsAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("smsAccount")+"?").htmlContent("<b>"+(e.name||"smsAccount")+"</b> will be deleted.").ariaLabel("delete smsAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSmsAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.smsAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SmsAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSmsAccount=function(e,n){i.show({controller:"CreateOrEditSmsAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:n,smsAccounts:f.smsAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSmsAccount=y,f.exportSelectedSmsAccounts=function(){var e=angular.copy(f.selectedSmsAccounts);return f.selectedSmsAccounts=[],e},f.deleteSelectedSmsAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected smsAccounts?").htmlContent("<b>"+f.selectedSmsAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SmsAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSmsAccounts.forEach(function(e){y(e)}),f.selectedSmsAccounts=[]})},f.deselectSmsAccounts=function(){f.selectedSmsAccounts=[]},f.selectAllSmsAccounts=function(){f.selectedSmsAccounts=f.smsAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.smsAccount&&(t=_.find(f.lists,{id:Number(f.smsAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.smsAccount&&(a=_.find(f.lists,{id:Number(f.smsAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.smsAccounts=e||{count:0,rows:[]}}function y(e){m.smsAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.smsAccounts.rows,{id:e.id}),f.smsAccounts.count-=1,f.smsAccounts.rows.length||f.getSmsAccounts(),p.success({title:_.startCase("SmsAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsmsAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSmsAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","smsAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.sms").controller("SmsAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SMS.EDIT_SMSQUEUE",g.smsQueue=angular.copy(l),g.smsQueues=r,g.newSmsQueue=!1,g.smsQueue||(g.smsQueue={strategy:"beepall",timeout:10},g.title="SMS.NEW_SMSQUEUE",g.newSmsQueue=!0),g.addNewSmsQueue=function(){g.errors=[],d.smsQueue.save(g.smsQueue).$promise.then(function(e){g.smsQueues.unshift(e.toJSON()),o.success({title:"SmsQueue properly created",msg:g.smsQueue.name?g.smsQueue.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmsQueue=function(){g.errors=[],d.smsQueue.update({id:g.smsQueue.id},g.smsQueue).$promise.then(function(e){var n=_.find(g.smsQueues,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SmsQueue properly saved!",msg:g.smsQueue.name?g.smsQueue.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmsQueue=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The smsQueue will be deleted.").ariaLabel("Delete SmsQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.smsQueue.delete({id:g.smsQueue.id}).$promise.then(function(){_.remove(g.smsQueues,{id:g.smsQueue.id}),o.success({title:"SmsQueue properly deleted!",msg:(g.smsQueue.name||"smsQueue")+" has been deleted!"}),v(g.smsQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","smsQueues","smsQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.smsQueue.getAgents({id:c.smsQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserSmsQueue?"penalty "+e.UserSmsQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.smsQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.removeAgents({id:c.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.addAgents({id:c.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("SMS.ALL_AGENTS"),labelSelected:r.instant("SMS.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","smsQueue","smsQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.sms").controller("SmsQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.smsQueue.getTeams({id:l.smsQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.smsQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("SMS.ALL_TEAMS"),labelSelected:t.instant("SMS.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.removeTeams({id:l.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.addTeams({id:l.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","smsQueue","$translate","Auth","crudPermissions"],angular.module("app.sms").controller("SmsQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.smsQueue=c||e.params.smsQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"SmsQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:u.smsQueues?u.smsQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:u.smsQueues?u.smsQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoSmsQueues=function(){e.go("app.sms.smsQueues",{},{reload:"app.sms.smsQueues"})},u.saveSmsQueue=function(){r.smsQueue.update({id:u.smsQueue.id},u.smsQueue).$promise.then(function(){l.success({title:"SmsQueue updated!",msg:u.smsQueue.name?u.smsQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","smsQueue","userProfileSection"],angular.module("app.sms").controller("SmsQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.smsQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="smsQueues",f.listOrder="",f.listOrderAsc=null,f.selectedSmsQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"sms",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.sms.smsQueues.edit",{id:e.id,smsQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"SmsQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:f.smsQueues?f.smsQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:f.smsQueues?f.smsQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("smsQueue")+"?").htmlContent("<b>"+(e.name||"smsQueue")+"</b> will be deleted.").ariaLabel("delete smsQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:710}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.sms.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.sms.realtime.queues",{})}},f.success=E,f.getSmsQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.smsQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SmsQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSmsQueue=function(e,n){i.show({controller:"CreateOrEditSmsQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsQueue:n,smsQueues:f.smsQueues.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSmsQueue=y,f.exportSelectedSmsQueues=function(){var e=angular.copy(f.selectedSmsQueues);return f.selectedSmsQueues=[],e},f.deleteSelectedSmsQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected smsQueues?").htmlContent("<b>"+f.selectedSmsQueues.length+" selected</b> will be deleted.").ariaLabel("delete SmsQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSmsQueues.forEach(function(e){y(e)}),f.selectedSmsQueues=[]})},f.deselectSmsQueues=function(){f.selectedSmsQueues=[]},f.selectAllSmsQueues=function(){f.selectedSmsQueues=f.smsQueues.rows};var b=!0,A=1;function E(e){f.smsQueues=e||{count:0,rows:[]}}function y(e){m.smsQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.smsQueues.rows,{id:e.id}),f.smsQueues.count-=1,f.smsQueues.rows.length||f.getSmsQueues(),p.success({title:_.startCase("SmsQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsmsQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsmsQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSmsQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","smsQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.sms").controller("SmsQueuesController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.agents=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,c.hasRole("admin")?g.promise=l.user.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="Agents",g.promise=l.userProfile.getResources(g.query,v).$promise)}function f(e){l.user.delete({id:e.id}).$promise.then(function(){_.remove(g.agents.rows,{id:e.id}),g.agents.count-=1,g.agents.rows.length||g.getAgents(),d.success({title:_.startCase("Agent")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuser",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=m,g.setting=u,g.currentUser=c.getCurrentUser(),g.agents=s||{count:0,rows:[]},g.userProfile=o,g.userProfileSection=r&&1==r.count?r.rows[0]:null,g.crudPermissions=c.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedAgents=[],g.query={fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay",role:"agent",userSetting:!0,sort:"-updatedAt",limit:10,page:1},g.showWebBarOptions=[{option:"Phonebar",value:0},{option:"External",value:1},{option:"WebRTC",value:2}],g.editstate=function(e){n.go("app.staff.agents.edit",{id:e.id,agent:e,crudPermissions:g.crudPermissions})},g.teamadddialog=function(e,n){a.show({controller:"AgentteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,agents:g.agents?g.agents.rows:[],crudPermissions:g.crudPermissions}})},g.deleteconfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the "+_.startCase("agent")+"?").htmlContent("<b>"+(e.name||"agent")+"</b> will be deleted.").ariaLabel("delete agent").targetEvent(n).ok("OK").cancel("CANCEL");a.show(t).then(function(){f(e)})},g.success=v,g.getAgents=h,g.createOrEditAgent=function(e,n){a.show({controller:"CreateOrEditAgentDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{agent:n,agents:g.agents.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions}})},g.deleteAgent=f,g.exportSelectedAgents=function(){var e=angular.copy(g.selectedAgents);return g.selectedAgents=[],e},g.deleteSelectedAgents=function(e){var n=a.confirm().title("Are you sure want to delete the selected agents?").htmlContent("<b>"+g.selectedAgents.length+" selected</b> will be deleted.").ariaLabel("delete Agents").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){g.selectedAgents.forEach(function(e){f(e)}),g.selectedAgents=[]})},g.deselectAgents=function(){g.selectedAgents=[]},g.selectAllAgents=function(){g.selectedAgents=g.agents.rows};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),g.getAgents())}),p.on("user-setting:update",h),e.$on("$destroy",function(){p.removeListener("user-setting:update",h)})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","agents","userProfile","userProfileSection","api","toasty","Auth","license","setting","socket"],angular.module("app.staff").controller("AgentsController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c){var m=this;function u(){return s.user.get({id:m.agent.id,userSetting:!0}).$promise.then(function(e){m.agent=e})}function p(e){t.hide(e)}m.currentUser=o.getCurrentUser(),m.errors=[],m.setting=l,m.license=r,m.crudPermissions=d,m.hasModulePermissions={},m.passwordPattern=m.setting&&m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.title="STAFF.EDIT_AGENT",m.agent=angular.copy(i),m.agents=n,m.newAgent=!1,m.agent||(m.agent={role:"agent",showWebBar:"0",autointernal:!0,wssPort:8089,type:"friend",context:"from-sip",phoneBarRemoteControl:!0,phoneBarRemoteControlPort:9888,allowmessenger:!0,downloadAttachments:!0,downloadOmnichannelInteractions:!0,downloadVoiceRecordings:!0},m.title="STAFF.NEW_AGENT",m.newAgent=!0),m.addNewAgent=function(){m.errors=[],s.user.save(m.agent).$promise.then(function(e){m.agents.unshift(e.toJSON()),a.success({title:"Agent properly created",msg:m.agent.name?m.agent.name+" has been created!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveAgent=function(){m.errors=[],s.user.update({id:m.agent.id},m.agent).$promise.then(function(e){var n=_.find(m.agents,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"Agent properly saved!",msg:m.agent.name?m.agent.name+" has been saved!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteAgent=function(e){m.errors=[];var n=t.confirm().title("Are you sure?").content("The agent will be deleted.").ariaLabel("Delete Agent").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){s.user.delete({id:m.agent.id}).$promise.then(function(){_.remove(m.agents,{id:m.agent.id}),a.success({title:"Agent properly deleted!",msg:(m.agent.name||"agent")+" has been deleted!"}),p(m.agent)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},m.getDateFromString=function(e){return null===e?void 0:new Date(e)},m.closeDialog=p;var g="user-setting:update:user-"+m.agent.id;c.on(g,u),e.$on("$destroy",function(){c.removeListener(g,u)})}e.$inject=["$scope","$mdDialog","toasty","agents","agent","api","Auth","license","setting","crudPermissions","socket"],angular.module("app.staff").controller("CreateOrEditAgentDialogController",e)}(),function(){"use strict";function e(e,a){var i=this;i.agent={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.agent.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.agent.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.agent=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="api/users/"+i.agent.id+"/avatar",i.agent.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.staff").controller("Agentchange_avatarController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.currentUser=o.getCurrentUser(),r.errors=[],r.setting=s,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.agent=i,r.password="",r.oldPassword="",r.savePassword=function(){r.errors=[];var e={id:r.agent.id,newPassword:r.password};r.currentUser.id==r.agent.id&&(e.oldPassword=r.oldPassword);a.user.changePassword(e).$promise.then(function(){n.success({title:"Agent password properly updated!"}),l()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.agent.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),r.errors=e.data.errors||[{message:e.toString(),type:"api.agent.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.agentForm.password.$setValidity("oldPasswordMatch",!1):t.agentForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","toasty","api","agent","setting","Auth"],angular.module("app.staff").controller("AgentchangepasswordController",e)}(),function(){"use strict";function e(e,n,i,t,s){var o=this;o.agent={},o.navigation=t.getNavigation(),o.crudPermissions,o.init=function(e,n){o.agent=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1}},o.onChange=function(n,t){if((t||n).enabled){if(t)t.enabled=!0,o.agent.permissions.push(t.id);else for(var e=0;e<n.children.length;e++)n.children[e].enabled=!0,o.agent.permissions.push(n.children[e].id);n.enabled=!0,o.agent.permissions.push(n.id)}else if(t)t.enabled=!1,_.remove(o.agent.permissions,function(e){return t.id===e}),_.filter(n.children,{enabled:!1}).length===n.children.length&&(n.enabled=!1,_.remove(o.agent.permissions,function(e){return n.id===e}));else{n.enabled=!1,_.remove(o.agent.permissions,function(e){return n.id===e});for(var a=0;a<n.children.length;a++)n.children[a].enabled=!1,_.remove(o.agent.permissions,function(e){return n.children[a].id===e})}return i.user.update({id:o.agent.id,permissions:_.uniq(o.agent.permissions)}).$promise.then(function(){s.success({title:"agent updated!",msg:o.agent.name?o.agent.name+" has been updated!":""})}).catch(function(e){console.error(e)})}}e.$inject=["$document","$mdDialog","api","msNavigationAgentService","toasty"],angular.module("app.staff").controller("AgentPermissionsController",e)}(),function(){"use strict";function e(e,l,a,d,n,t,i,s,o,r){var c=this;function m(){return l(function(t,n){return l(function(n,t){return d[c.apiName].get({fields:"id,name,strategy,type",channel:c.channel,type:"voice"===c.channel?c.direction:void 0,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(n,t){return d.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:o.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),l(function(n,t){return d.user.getQueues({id:c.agent.id,fields:"id,name,strategy,type,penalty",nolimit:!0,type:"voice"===c.channel?c.direction:void 0,channel:c.channel}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return"voice"===c.channel&&(n.penalty=void 0!==n&&void 0!==e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"penalty 0"),n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=o.getCurrentUser(),c.agent=n,c.crudPermissions=r,c.penalty=0,c.channel=t,c.direction=i,c.apiName=c.channel+"Queue",c.title=s.instant("STAFF.ADD_AGENT_TO_"+("outbound"===c.direction?"QUEUE_CAMPAIGNS":c.channel.toUpperCase()+"_QUEUES")),c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"type",line3:"voice"===c.channel?"penalty":"",labelAll:s.instant("STAFF.ALL_"+("outbound"===c.direction?"QUEUE_CAMPAIGNS":c.channel.toUpperCase()+"_QUEUES")),labelSelected:s.instant("STAFF.SELECTED_"+("outbound"===c.direction?"QUEUE_CAMPAIGNS":c.channel.toUpperCase()+"_QUEUES")),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var t=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});c.pendingChanges=!_.isEmpty(t)}},c.onInit=function(){return o.hasRole("admin")?m().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.status?JSON.stringify(e.data):e.toString()})}):l(function(t,n){var e;switch(c.channel){case"voice":switch(c.direction){case"inbound":e="VoiceQueues";break;case"outbound":e="QueueCampaigns"}break;case"chat":e="ChatQueues";break;case"mail":e="MailQueues";break;case"sms":e="SmsQueues";break;case"openchannel":e="OpenchannelQueues";break;case"fax":e="FaxQueues"}d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:e}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveQueues=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,l(function(e,n){_.isEmpty(t)?e():d.user.removeQueues({id:c.agent.id,ids:_.map(t,"id"),channel:c.channel}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return r=n,l(function(e,n){if(_.isEmpty(r))e();else if("voice"===c.channel){for(var t=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);t.push(d.user.addQueues({id:c.agent.id,ids:_.map(o,"id"),channel:c.channel,penalty:_.trim(s,"penalty ")}).$promise)}l.all(t).then(function(){e()}).catch(function(e){n(e)})}else d.user.addQueues({id:c.agent.id,ids:_.map(r,"id"),channel:c.channel}).$promise.then(function(){e()}).catch(function(e){n(e)})});var r}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),a.success({title:"SUCCESS",msg:"Queues association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:QUEUES_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","agent","channel","direction","$translate","Auth","crudPermissions"],angular.module("app.staff").controller("AgentQueueAddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.user.getTeams({id:l.agent.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.agent=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("STAFF.ALL_TEAMS"),labelSelected:t.instant("STAFF.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.user.removeTeams({id:l.agent.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.user.addTeams({id:l.agent.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","agent","$translate","Auth","crudPermissions"],angular.module("app.staff").controller("AgentteamaddController",e)}(),function(){"use strict";function e(e,n,i,s,t,a,o,r,l,d,c){var m=this;m.currentUser=l.getCurrentUser(),m.license=t,m.setting=a,m.passwordPattern=m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.location=n.protocol()+"://"+n.host(),m.agent=d||e.params.agent||{},m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=l.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.hasModulePermissions={},m.selectedTab=e.params.tab||0,m.queueaddchannel=function(e,n,t,a){i.show({controller:"AgentQueueAddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:m.agents?m.agents.rows:[],channel:n,direction:a||"inbound",crudPermissions:m.crudPermissions}})},m.teamadddialog=function(e,n){i.show({controller:"AgentteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,agents:m.agents?m.agents.rows:[],crudPermissions:m.crudPermissions}})},m.changepassworddialog=function(e,n){i.show({controller:"AgentchangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/changepassword/changepassword.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,setting:a,agents:m.agents?m.agents.rows:[],crudPermissions:m.crudPermissions}})},m.onEnableScreenRecordingByAgentSelection=function(){["phoneBarEnableAutomaticScreenRecording"].forEach(function(e){m.agent.phoneBarEnableScreenRecordingByAgent&&(m.agent[e]=!m.agent.phoneBarEnableScreenRecordingByAgent)})},m.onEnableAutomaticScreenRecordingSelection=function(){["phoneBarEnableScreenRecordingByAgent"].forEach(function(e){m.agent.phoneBarEnableAutomaticScreenRecording&&(m.agent[e]=!m.agent.phoneBarEnableAutomaticScreenRecording)})},m.alert=r.info,m.gotoAgents=function(){e.go("app.staff.agents",{},{reload:"app.staff.agents"})},m.saveAgent=function(){m.agent=_.omit(m.agent,"userpic"),o.user.update({id:m.agent.id},m.agent).$promise.then(function(){r.success({title:"Agent updated!",msg:m.agent.name?m.agent.name+" has been updated!":""})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuser",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.refreshAgent=function(){return o.user.get({id:m.agent.id,userSetting:!0}).$promise.then(function(e){m.agent=e})},l.hasRole("admin")?o.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.contexts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.contexts=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.contexts,{id:e.resourceId})}),t=null;if(m.agent&&(t=_.find(m.contexts,{name:m.agent.context})),t&&!_.some(n,["id",t.id])){var a=_.find(m.contexts,{id:t.id});a.canSelect=!1,n.push(a)}m.contexts=n}):o.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){m.contexts=e.rows||[]})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","license","setting","api","toasty","Auth","agent","userProfileSection"],angular.module("app.staff").controller("AgentController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="STAFF.EDIT_TEAM",g.team=angular.copy(l),g.teams=r,g.newTeam=!1,g.team||(g.team={},g.title="STAFF.NEW_TEAM",g.newTeam=!0),g.addNewTeam=function(){g.errors=[],d.team.save(g.team).$promise.then(function(e){g.teams.unshift(e.toJSON()),o.success({title:"Team properly created",msg:g.team.name?g.team.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.team.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.team.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTeam=function(){g.errors=[],d.team.update({id:g.team.id},g.team).$promise.then(function(e){var n=_.find(g.teams,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Team properly saved!",msg:g.team.name?g.team.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.team.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.team.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTeam=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The team will be deleted.").ariaLabel("Delete Team").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.team.delete({id:g.team.id}).$promise.then(function(){_.remove(g.teams,{id:g.team.id}),o.success({title:"Team properly deleted!",msg:(g.team.name||"team")+" has been deleted!"}),v(g.team)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.team.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.team.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","teams","team","api","Auth","license","setting","crudPermissions"],angular.module("app.staff").controller("CreateOrEditTeamDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.team.getAgents({id:c.team.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserTeam?"penalty "+e.UserTeam.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.team=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.team.removeAgents({id:c.team.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.team.addAgents({id:c.team.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("STAFF.ALL_AGENTS"),labelSelected:r.instant("STAFF.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","team","teams","realtime","$translate","Auth","crudPermissions"],angular.module("app.staff").controller("TeamagentaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.teams=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="teams",f.listOrder="",f.listOrderAsc=null,f.selectedTeams=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditTeamDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{team:e,teams:f.teams.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"TeamagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{team:e,teams:f.teams?f.teams.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("team")+"?").htmlContent("<b>"+(e.name||"team")+"</b> will be deleted.").ariaLabel("delete team").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTeams=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.team.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Teams",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTeam=function(e,n){i.show({controller:"CreateOrEditTeamDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{team:n,teams:f.teams.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTeam=y,f.exportSelectedTeams=function(){var e=angular.copy(f.selectedTeams);return f.selectedTeams=[],e},f.deleteSelectedTeams=function(e){var n=i.confirm().title("Are you sure want to delete the selected teams?").htmlContent("<b>"+f.selectedTeams.length+" selected</b> will be deleted.").ariaLabel("delete Teams").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTeams.forEach(function(e){y(e)}),f.selectedTeams=[]})},f.deselectTeams=function(){f.selectedTeams=[]},f.selectAllTeams=function(){f.selectedTeams=f.teams.rows};var b=!0,A=1;function E(e){f.teams=e||{count:0,rows:[]}}function y(e){m.team.delete({id:e.id}).$promise.then(function(){_.remove(f.teams.rows,{id:e.id}),f.teams.count-=1,f.teams.rows.length||f.getTeams(),p.success({title:_.startCase("Team")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEteam"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEteam",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTeams())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","teams","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.staff").controller("TeamsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="STAFF.EDIT_TELEPHONE",g.telephone=angular.copy(l),g.telephones=r,g.newTelephone=!1,g.telephone||(g.telephone={role:"telephone",autointernal:!0,context:"from-sip"},g.title="STAFF.NEW_TELEPHONE",g.newTelephone=!0),g.addNewTelephone=function(){g.errors=[],d.user.save(g.telephone).$promise.then(function(e){g.telephones.unshift(e.toJSON()),o.success({title:"Telephone properly created",msg:g.telephone.name?g.telephone.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTelephone=function(){g.errors=[],d.user.update({id:g.telephone.id},g.telephone).$promise.then(function(e){var n=_.find(g.telephones,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Telephone properly saved!",msg:g.telephone.name?g.telephone.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.user.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTelephone=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The telephone will be deleted.").ariaLabel("Delete Telephone").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.user.delete({id:g.telephone.id}).$promise.then(function(){_.remove(g.telephones,{id:g.telephone.id}),o.success({title:"Telephone properly deleted!",msg:(g.telephone.name||"telephone")+" has been deleted!"}),v(g.telephone)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.user.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","telephones","telephone","api","Auth","license","setting","crudPermissions"],angular.module("app.staff").controller("CreateOrEditTelephoneDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.currentUser=o.getCurrentUser(),r.errors=[],r.setting=s,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.telephone=i,r.password="",r.oldPassword="",r.savePassword=function(){r.errors=[];var e={id:r.telephone.id,newPassword:r.password};r.currentUser.id==r.telephone.id&&(e.oldPassword=r.oldPassword);a.user.changePassword(e).$promise.then(function(){n.success({title:"Telephone password properly updated!"}),l()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.telephone.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),r.errors=e.data.errors||[{message:e.toString(),type:"api.telephone.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.telephoneForm.password.$setValidity("oldPasswordMatch",!1):t.telephoneForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","toasty","api","telephone","setting","Auth"],angular.module("app.staff").controller("TelephonechangepasswordController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.telephone=c||e.params.telephone||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.changepassworddialog=function(e,n){t.show({controller:"TelephonechangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/telephones/edit/changepassword/changepassword.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{telephone:e,setting:o,telephones:u.telephones?u.telephones.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoTelephones=function(){e.go("app.staff.telephones",{},{reload:"app.staff.telephones"})},u.saveTelephone=function(){r.user.update({id:u.telephone.id},u.telephone).$promise.then(function(){l.success({title:"Telephone updated!",msg:u.telephone.name?u.telephone.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuser",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),t=null;if(u.telephone&&(t=_.find(u.contexts,{name:u.telephone.context})),t&&!_.some(n,["id",t.id])){var a=_.find(u.contexts,{id:t.id});a.canSelect=!1,n.push(a)}u.contexts=n}):r.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){u.contexts=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","telephone","userProfileSection"],angular.module("app.staff").controller("TelephoneController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.telephones=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="telephones",f.listOrder="",f.listOrderAsc=null,f.selectedTelephones=[],f.query={fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",role:"telephone",sort:"-updatedAt",limit:10,page:1},f.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"},{option:"tls",value:"'tls'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayallow=_.keyBy([{option:"ulaw",value:"'ulaw'"},{option:"alaw",value:"'alaw'"},{option:"gsm",value:"'gsm'"},{option:"g722",value:"'g722'"},{option:"g729",value:"'g729'"},{option:"opus",value:"'opus'"},{option:"h264",value:"'h264'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayencryption=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.staff.telephones.edit",{id:e.id,telephone:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("telephone")+"?").htmlContent("<b>"+(e.name||"telephone")+"</b> will be deleted.").ariaLabel("delete telephone").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTelephones=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.user.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Telephones",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTelephone=function(e,n){i.show({controller:"CreateOrEditTelephoneDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/telephones/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{telephone:n,telephones:f.telephones.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTelephone=y,f.exportSelectedTelephones=function(){var e=angular.copy(f.selectedTelephones);return f.selectedTelephones=[],e},f.deleteSelectedTelephones=function(e){var n=i.confirm().title("Are you sure want to delete the selected telephones?").htmlContent("<b>"+f.selectedTelephones.length+" selected</b> will be deleted.").ariaLabel("delete Telephones").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTelephones.forEach(function(e){y(e)}),f.selectedTelephones=[]})},f.deselectTelephones=function(){f.selectedTelephones=[]},f.selectAllTelephones=function(){f.selectedTelephones=f.telephones.rows};var b=!0,A=1;function E(e){f.telephones=e||{count:0,rows:[]}}function y(e){m.user.delete({id:e.id}).$promise.then(function(){_.remove(f.telephones.rows,{id:e.id}),f.telephones.count-=1,f.telephones.rows.length||f.getTelephones(),p.success({title:_.startCase("Telephone")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuser",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTelephones())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","telephones","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.staff").controller("TelephonesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="STAFF.EDIT_USERPROFILE",g.userProfile=angular.copy(l),g.userProfiles=r,g.newUserProfile=!1,g.userProfile||(g.userProfile={crudPermissions:["r"],downloadAttachments:!0,downloadCallySquareRecordings:!0,downloadContactManagerLists:!0,downloadJscriptySessions:!0,downloadOmnichannelInteractions:!0,downloadScreenRecordings:!0,downloadVoiceRecordings:!0},g.title="STAFF.NEW_USERPROFILE",g.newUserProfile=!0),g.addNewUserProfile=function(){g.errors=[],d.userProfile.save(g.userProfile).$promise.then(function(e){var n,t;t=[],(n=e).crudPermissions.forEach(function(e){var n;switch(e){case"r":n="READ_PERMISSION";break;case"e":n="EDIT_PERMISSION";break;case"d":n="DELETE_PERMISSION"}t.push(s.instant("STAFF."+n))}),n.selectedcrudPermissions=t.join(", "),g.userProfiles.unshift(e.toJSON()),o.success({title:"UserProfile properly created",msg:g.userProfile.name?g.userProfile.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveUserProfile=function(){g.errors=[],d.userProfile.update({id:g.userProfile.id},g.userProfile).$promise.then(function(e){var n=_.find(g.userProfiles,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"UserProfile properly saved!",msg:g.userProfile.name?g.userProfile.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteUserProfile=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The userProfile will be deleted.").ariaLabel("Delete UserProfile").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.userProfile.delete({id:g.userProfile.id}).$promise.then(function(){_.remove(g.userProfiles,{id:g.userProfile.id}),o.success({title:"UserProfile properly deleted!",msg:(g.userProfile.name||"userProfile")+" has been deleted!"}),v(g.userProfile)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","userProfiles","userProfile","api","Auth","license","setting","crudPermissions"],angular.module("app.staff").controller("CreateOrEditUserProfileDialogController",e)}(),function(){"use strict";function e(n,a,i,e,t,s,o){var r=this;function l(e){n.hide(e)}r.newUserProfile=!0,r.userProfile=angular.copy(t),r.userProfiles=s,r.title=o.instant("STAFF.CLONE_USERPROFILE"),t&&t.name&&(r.title+=": "+t.name),r.cloneUserProfile=function(){return e.userProfile.clone({id:t.id},r.userProfile).$promise.then(function(e){var n,t;t=[],(n=e).crudPermissions.forEach(function(e){var n;switch(e){case"r":n="READ_PERMISSION";break;case"e":n="EDIT_PERMISSION";break;case"d":n="DELETE_PERMISSION"}t.push(o.instant("STAFF."+n))}),n.selectedcrudPermissions=t.join(", "),r.userProfiles.unshift(e.toJSON()),i.success({title:"UserProfile properly cloned",msg:r.userProfile.name?r.userProfile.name+" has been cloned!":""}),a.go("app.staff.userProfiles.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.clone"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","userProfile","userProfiles","$translate"],angular.module("app.staff").controller("UserProfilecloneController",e)}(),function(){"use strict";function e(t,o,r,l,d,e,n,c){var m=this;function u(e,n){switch(e.allResourcesEnabled="full"===n,n){case"full":return _.find(m.statusList,["tag","full"]);case"partial":return _.find(m.statusList,["tag","partial"]);case"disabled":return _.find(m.statusList,["tag","disabled"]);case"unlicensed":return _.find(m.statusList,["tag","unlicensed"]);case"unknown":default:return _.find(m.statusList,["tag","unknown"])}}function p(e){return l(function(n,t){var o,a;void 0!==e.channel&&_.includes(e.route,"Queue")?(a=e,l(function(n,t){var e=void 0!==a.channel&&"bull"===a.channel?"outbound":"inbound";return d[a.route].get({fields:"id,name,strategy,type",channel:"bull"===a.channel?"voice":a.channel,type:e,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})).then(function(e){n(e)}).catch(function(e){t(e)}):(o=e,l(function(a,n){switch(o.route){case"voiceExtension":var e;switch(o.title){case"InboundRoutes":e="inbound";break;case"OutboundRoutes":e="outbound";break;case"InternalRoutes":e="internal"}break;case"interval":var t=!0;break;case"disposition":var i=!0;break;case"user":var s;switch(o.title){case"Agents":s="agent";break;case"Telephones":s="telephone";break;case"Users":s="user"}}if("Reports"===o.title){if(!o.reportType)return d.analyticDefaultReport.get({nolimit:!0}).$promise.then(function(t){d.analyticCustomReport.get({nolimit:!0}).$promise.then(function(e){var n=_.union(t.rows,e.rows);a({count:n.length,rows:n.rows})})}).catch(function(e){n(e)});switch(o.reportType){case"default":o.route="analyticDefaultReport";break;case"custom":o.route="analyticCustomReport"}}return d[o.route].get({role:s||void 0,type:e||void 0,VoiceExtensionId:e?"null":void 0,IntervalId:t?"null":void 0,MailAccountId:i?"null":void 0,FaxAccountId:i?"null":void 0,SmsAccountId:i?"null":void 0,OpenchannelAccountId:i?"null":void 0,ChatWebsiteId:i?"null":void 0,WhatsappAccountId:i?"null":void 0,ListId:i?"null":void 0,nolimit:!0}).$promise.then(function(e){a(e)}).catch(function(e){n(e)})})).then(function(e){n(e)}).catch(function(e){t(e)})})}function g(e,n,t){var a=e&&0<e.length?e[0]:null;if(!a)return t;var i,s,o=_.find(n,["sectionId",a.id]);return o?(n=_.remove(n,["sectionId",a.id]),(i=a,s=o.id,l(function(n,t){d.userProfileResource.get({sectionId:s}).$promise.then(function(n){return p(i).then(function(e){return _.differenceBy(n.rows,e.rows,"id")})}).then(function(e){_.isEmpty(e)?n():t()}).catch(function(e){t(e)})})).then(function(){return t="full",g(e.shift(),n,t)}).catch(function(e){return l.reject(e)})):void 0}function a(a){var t="Marketplace"===a.title?"AppZone":a.title;m.license?void 0===a.permissions||a.permissions.association?void 0===a.license||m.license[a.license]?d.userProfileSection.get({userProfileId:m.userProfile.id,category:t}).$promise.then(function(e){var n=e&&e.rows&&0<e.rows.length?e.rows:[];if("Dashboards"===a.title)return _.isEmpty(n)?"disabled":n[0].autoAssociation?"full":d.userProfileResource.get({sectionId:n[0].id,resourceId:101}).$promise.then(function(e){return(e&&e.rows?e.rows[0]:null)?"full":"partial"});var t=_.filter(a.children,function(e){return void 0!==e.permissions&&e.permissions.hidden?void 0:e});return n.length!==t.length?0===n.length?"disabled":"partial":_.every(n,["autoAssociation",!0])?"full":g(_.filter(t,function(e){return void 0===e.permissions||e.permissions.association?e:void 0}),n,"partial")}).then(function(e){a.status=u(a,e)}).catch(function(e){var n=e?"unknown":"partial";a.status=u(a,n),e&&c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GETRESOURCES("+t.toUpperCase()+")",msg:e.status?JSON.stringify(e.data):e.toString()})}):a.status=u(a,"unlicensed"):d.userProfileSection.get({userProfileId:m.userProfile.id,sectionId:a.id}).$promise.then(function(e){var n=(e&&1===e.rows.length?e.rows[0]:null)?"full":"disabled";a.status=u(a,n)}):a.status=u(a,"unknown")}m.userProfile={},m.license={},m.navigation=e.getNavigation(),m.modules=m.navigation[0].children,m.statusList=[{id:0,name:"Fully Enabled",color:"green-A700-bg",info:"All resources enabled",tag:"full"},{id:1,name:"Partially Enabled",color:"orange-A700-bg",info:"Some resources enabled",tag:"partial"},{id:2,name:"Disabled",color:"grey-A400-bg",info:"No resources enabled",tag:"disabled"},{id:3,name:"Unlicensed",color:"red-A700-bg",info:"Module not included in the license",tag:"unlicensed"},{id:4,name:"Unknown",color:"grey-A700-bg",info:"Unknown status",tag:"unknown"}],m.dashboardSections=[{title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",id:100}],m.init=function(e,n){m.userProfile=e,m.license=n},m.onChangeEnableAllResources=function(n){var e=void 0!==n.permissions&&!n.permissions.association,a="Marketplace"===n.title?"AppZone":n.title;if("Fully Enabled"!==n.status.name){var i=[];if(e)return i.push({category:a,sectionId:n.id,name:a,enabled:!0,crudPermissions:"red"}),d.userProfile.addSections({id:m.userProfile.id},i).$promise.then(function(){n.status=u(n,"full"),c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_MESSAGE_NO_RESOURCES",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name})})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.ADDSECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()})});var t=o.confirm({skipHide:!0}).title("Warning").textContent(r.instant("STAFF.PERMISSIONS_WARNING_ENABLE_ALL",{sectionName:r.instant(n.translate)})).ariaLabel("Warning").ok(r.instant("STAFF.CONFIRM")).cancel(r.instant("STAFF.CANCEL"));o.show(t).then(function(){switch(a){case"Dashboards":_.map(m.dashboardSections,function(e){i.push({category:a,sectionId:e.id,name:e.title,enabled:!0,autoAssociation:!0,crudPermissions:_.map(m.userProfile.crudPermissions).join("")})});break;default:_.map(n.children,function(e){var n=!(void 0===e.permissions||!e.permissions.hidden);if(!n){var t=e.title;switch(a){case"CallySquare":t="Projects"===t?"SquareProjects":t}i.push({category:a,sectionId:e.id,name:t,enabled:!0,autoAssociation:!0,crudPermissions:_.map(m.userProfile.crudPermissions).join("")})}})}return d.userProfile.addSections({id:m.userProfile.id},i).$promise.then(function(){n.status=u(n,"full"),c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_MESSAGE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name})})})}).catch(function(e){e?c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.ADDSECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()}):n.status=u(n,n.status.tag)})}else if("Fully Enabled"===n.status.name){n.status=u(n,"disabled");var s=[];switch(a){case"Settings":case"Help":s=[n.id];break;case"Dashboards":s=_.map(m.dashboardSections,function(e){return e.id});break;default:s=_.map(n.children,function(e){return e.id})}return d.userProfile.removeSections({id:m.userProfile.id,ids:s}).$promise.then(function(){c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_DISABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_DISABLED_ALL_SUCCESS_MESSAGE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name})})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.REMOVESECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()})})}},m.manageResources=function(e,n){o.show({controller:"UserProfilepermissionsmanageController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!1,locals:{userProfile:m.userProfile,userProfiles:[],section:e}}).then(function(){a(e)})},m.checkSectionResources=a}e.$inject=["$document","$mdDialog","$translate","$q","api","msNavigationService","Auth","toasty"],angular.module("app.staff").controller("UserProfilePermissionsController",e)}(),function(){"use strict";function e(n,t,i,o,r,e,a,l,s,d){var c=this;function m(){var a=void 0!==c.selectedSection.pending&&c.selectedSection.pending;return i(function(t,n){r.userProfileSection.get({userProfileId:c.userProfile.id,sectionId:c.selectedSection.id}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;a||(c.selectedSection.enabled=!!n&&!!n.enabled,c.selectedSection.autoAssociation=!!n&&!!n.autoAssociation,c.selectedSection.crudPermissions=v(n?n.crudPermissions:c.userProfile.crudPermissions)),t(n)}).catch(function(e){n(e)})})}function u(){return i(function(n,t){c.loadedSection?r.userProfileResource.get({sectionId:c.loadedSection.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)}):n(null)})}function p(){return i(function(n,t){void 0!==c.selectedSection.channel&&_.includes(c.selectedSection.route,"Queue")?i(function(n,t){var e=void 0!==c.selectedSection.channel&&"bull"===c.selectedSection.channel?"outbound":"inbound";return r[c.selectedSection.route].get({fields:"id,name,strategy,type",channel:"bull"===c.selectedSection.channel?"voice":c.selectedSection.channel,type:e,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){n(e)}).catch(function(e){t(e)}):i(function(n,t){var e,a;if("voiceExtension"===c.selectedSection.route)switch(c.selectedSection.title){case"InboundRoutes":e="inbound";break;case"OutboundRoutes":e="outbound";break;case"InternalRoutes":e="internal"}if("user"===c.selectedSection.route)switch(c.selectedSection.title){case"Agents":a="agent";break;case"Telephones":a="telephone";break;case"Users":a="user"}if("interval"===c.selectedSection.route)var i=!0;if("disposition"===c.selectedSection.route)var s=!0;if("Reports"===c.selectedSection.title&&(c.selectedSection.route="default"===c.selectedSection.reportType?"analyticDefaultReport":"analyticCustomReport"),"Dashboards"!==c.selectedSection.title)return r[c.selectedSection.route].get({role:a||void 0,type:e||void 0,VoiceExtensionId:e?"null":void 0,IntervalId:i?"null":void 0,MailAccountId:s?"null":void 0,FaxAccountId:s?"null":void 0,SmsAccountId:s?"null":void 0,OpenchannelAccountId:s?"null":void 0,ChatWebsiteId:s?"null":void 0,WhatsappAccountId:s?"null":void 0,ListId:s?"null":void 0,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)});n({count:1,rows:[{id:101,name:l.instant("DASHBOARDS.GENERAL")}]})}).then(function(e){n(e)}).catch(function(e){t(e)})})}function g(){var i=void 0!==c.selectedSection.pending&&c.selectedSection.pending,s=[];return u().then(function(e){var n;return s=e&&e.rows?e.rows:[],"Reports"===c.selectedSection.title&&(c.associatedReports=c.associatedReports?c.associatedReports:s,n=c.associatedReports,s=_.filter(n,{type:"default"===c.selectedSection.reportType?"DefaultReports":"CustomReports"})),void 0===c.selectedSection.permissions||c.selectedSection.permissions.association?p():{rows:[]}}).then(function(e){c.items=e.rows?_.map(e.rows,function(e){var n,t;return"Reports"===c.selectedSection.title&&(e.fullPath=(n=e.parent,t=c.treeStructure[0].text,t=function e(n,t,a){if(!a||_.isEmpty(a.children))return n;var a=_.find(a.children,function(e){return _.includes(t,e.id)?e:void 0});return n+=a?"/"+a.text:"",e(n,t,a)}(t,n,c.treeStructure[0])).replace(" ","_")),e.isValid=!0,e}):[],i||(c.selectedSection.selectedItems=_.map(s,function(e){return _.find(c.items,{id:e.resourceId})}));var n,t=_.differenceBy(c.selectedSection.selectedItems,c.items,"id");switch(_.isEmpty(t)||(c.selectedSection.selectedItems=_.pullAllBy(c.selectedSection.selectedItems,t,"id")),c.selectedSection.title){case"Contexts":c.selectedSection.selectedItems=_.filter(c.items,function(e){return e.defaultEntry?(e.isValid=!1,e):void 0!==_.find(s,{resourceId:e.id})?(e.isValid=!0,e):void 0});break;case"MusicOnHolds":c.selectedSection.selectedItems=_.filter(c.items,function(e){return e.defaultEntry?(e.isValid=!1,e):void 0!==_.find(s,{resourceId:e.id})?(e.isValid=!0,e):void 0});break;case"Reports":var a=(n=c.allReportsSelected,_.filter(n,function(e){return _.startsWith(e.parent,"default"===c.selectedSection.reportType?"motion":"custom")}));c.selectedSection.selectedItems=b(c.selectedSection.selectedItems),c.selectedSection.selectedItems=_.unionBy(c.selectedSection.selectedItems,a,"id")}c.dualMultiselectOptions.selectedItems=c.selectedSection.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.items,c.dualMultiselectOptions.selectedItems,"id")}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET"+c.selectedSection.title.toUpperCase(),msg:e.status?JSON.stringify(e.data):e.toString()})})}function v(e){return e&&(c.selectedSection.allowEdit=!!_.includes(e,"e"),c.selectedSection.allowDelete=!!_.includes(e,"d")),function(){var e=["r"];if(c.selectedSection.allowEdit)e.push("e");else{var n=_.indexOf(e,["e"]);0<n&&c.selectedSection.crudPermissions.replace("e","")}if(c.selectedSection.allowDelete)e.push("d");else{var n=_.indexOf(e,["d"]);0<n&&c.selectedSection.crudPermissions.replace("d","")}return e}()}function h(e){var n=_.findIndex(c.subsections,function(e){return e.id==c.selectedSection.id});c.subsections[n].pending=e,f()}function f(){return c.pendingChanges=_.some(c.subsections,["pending",!0])}function b(e){return _.remove(e,function(e){return _.startsWith(e.parent,"default"===c.selectedSection.reportType?"motion":"custom")})}function A(){_.isEmpty(c.selectedSection.selectedItems)?c.allReportsSelected=_.remove(c.allReportsSelected,function(e){return e.type===("default"===c.selectedSection.reportType?"CustomReports":"DefaultReports")}):c.selectedSection.selectedItems.forEach(function(e){_.some(c.allReportsSelected,{id:e.id,parent:e.parent})||c.allReportsSelected.push(e)})}c.userProfile=e,c.penalty=0,c.section=angular.copy(d),c.title=l.instant("STAFF.PERMISSIONS_SECTION_TITLE",{sectionName:l.instant(c.section.translate)}),c.items=[],c.selectedItems=[],c.subsections=_.filter(c.section.children,function(e){return void 0!==e.permissions&&e.permissions.hidden?void 0:e}),c.dashboardSections=[{title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",id:100}],c.dashboardItems=[],"Dashboards"===c.section.title&&(c.dashboardItems=c.subsections,c.subsections=c.dashboardSections),c.selectedSection=null,c.loadedSection=null,c.allReportsSelected=[],c.closeDialog=function(e){if(c.pendingChanges){var n=t.confirm({skipHide:!0}).title("Warning").textContent(l.instant("STAFF.PERMISSIONS_WARNING_CLOSE")).ariaLabel("Warning").targetEvent(e).ok(l.instant("STAFF.CLOSE")).cancel(l.instant("STAFF.CANCEL"));t.show(n).then(function(){t.hide()})}else t.hide()},c.onChangeSection=function(){return m().then(function(e){if(c.loadedSection=e,"Reports"===c.selectedSection.title)return i(function(n,t){r.analyticTreeReport.get({}).$promise.then(function(e){c.treeReports=e.rows||[],n(c.treeReports)}).catch(function(e){t(e)})}).then(function(){if(!c.selectedSection.reportType)return u().then(function(e){c.allReportsSelected=e?_.map(e.rows,function(e){return{id:e.resourceId,name:e.name,type:e.type}}):[]})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREE_REPORT_STRUCTURE",msg:e.data?JSON.stringify(e.data):e.toString()})});g()}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET"+c.selectedSection.title.toUpperCase(),msg:e.status?JSON.stringify(e.data):e.toString()})})},c.onChangeVisibility=function(){c.selectedSection.enabled=!c.selectedSection.enabled,h(!0)},c.onChangeAutoAssociation=function(){if(!c.selectedSection.autoAssociation){for(var e=[],n=0;n<c.dualMultiselectOptions.items.length;n++)e.push(c.dualMultiselectOptions.items[n]),c.dualMultiselectOptions.selectedItems.push(c.dualMultiselectOptions.items[n]);c.dualMultiselectOptions.items=[],c.dualMultiselectOptions.transferCallback(e,!1)}h(!0)},c.onChangeReportType=function(){c.treeStructure="default"===c.selectedSection.reportType?c.treeReports[0]?angular.fromJson(c.treeReports[0].tree):[]:c.treeReports[1]?angular.fromJson(c.treeReports[1].tree):[],c.selectedSection.selectedItems&&(c.allReportsSelected=b(c.allReportsSelected),A());g()},c.setPermission=function(e){"edit"===e?c.selectedSection.allowEdit=!c.selectedSection.allowEdit:"delete"===e&&(c.selectedSection.allowDelete=!c.selectedSection.allowDelete);c.selectedSection.crudPermissions=v(),h(!0)},c.saveSection=function(){var a="Marketplace"===c.section.title?"AppZone":c.section.title,e=_(c.subsections).filter({pending:!0}).map(function(e){var n="CallySquare"===a&&"Projects"===e.title?"SquareProjects":e.title,t="Reports"===n?c.allReportsSelected:e.selectedItems;return"Integrations"===a&&(e.autoAssociation=!0),{category:a,sectionId:e.id,name:n,enabled:e.enabled,autoAssociation:e.autoAssociation,crudPermissions:_.map(e.crudPermissions).join(""),Resources:_.map(t,function(e){return{name:e.name,resourceId:e.id,type:function(e,n){if("Reports"!==e)return e;{if(n.parent){var t=_.startsWith(n.parent,"motion")?"Default":"Custom";return t+e}return n.type}}(n,e)}})}}).value();return r.userProfile.addSections({id:c.userProfile.id},e).$promise.then(function(){c.subsections.forEach(function(e){e.pending=void 0}),c.associatedReports=null,f(),"Reports"!==c.selectedSection.title||c.selectedSection.reportType||n.userProfileForm.$setPristine(),o.success({title:l.instant("STAFF.NOTIFICATIONS.PERMISSIONS_SAVED_SUCCESS_TITLE",{sectionName:l.instant(a.translate)}),msg:l.instant("STAFF.NOTIFICATIONS.PERMISSIONS_SAVED_SUCCESS_MESSAGE")})}).then(function(){return m().then(function(e){c.loadedSection=e})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.ADDSECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",line4:"fullPath",labelAll:l.instant("STAFF.PERMISSIONS_ALL_RESOURCES"),labelSelected:l.instant("STAFF.PERMISSIONS_SELECTED_RESOURCES"),transferCallback:function(e,n){h(!0),n?(c.selectedSection.selectedItems=_.pullAllBy(c.selectedSection.selectedItems,e,"id"),c.selectedSection.autoAssociation=!1):c.selectedSection.selectedItems=_.unionBy(c.selectedSection.selectedItems,e,"id"),"Reports"===c.selectedSection.title&&A()}}}e.$inject=["$scope","$mdDialog","$q","toasty","api","userProfile","userProfiles","$translate","Auth","section"],angular.module("app.staff").controller("UserProfilepermissionsmanageController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.userProfile=c||e.params.userProfile||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.permissionsmanagedialog=function(e,n){t.show({controller:"UserProfilepermissionsmanageController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:u.userProfiles?u.userProfiles.rows:[],crudPermissions:u.crudPermissions}})},u.clonedialog=function(e,n){t.show({controller:"UserProfilecloneController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/clone/clone.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:u.userProfiles?u.userProfiles.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoUserProfiles=function(){e.go("app.staff.userProfiles",{},{reload:"app.staff.userProfiles"})},u.saveUserProfile=function(){r.userProfile.update({id:u.userProfile.id},u.userProfile).$promise.then(function(){l.success({title:"UserProfile updated!",msg:u.userProfile.name?u.userProfile.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuserProfile",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","userProfile","userProfileSection"],angular.module("app.staff").controller("UserProfileController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.userProfiles=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="userProfiles",f.listOrder="",f.listOrderAsc=null,f.selectedUserProfiles=[],f.query={fields:"createdAt,updatedAt,id,name,description,crudPermissions,privacyEnabled,downloadAttachments,downloadCallySquareRecordings,downloadContactManagerLists,downloadJscriptySessions,downloadOmnichannelInteractions,downloadScreenRecordings,downloadVoiceRecordings",sort:"-updatedAt",limit:10,page:1},f.arraycrudPermissions=_.keyBy([{option:"Read_permission",value:"'r'",disabled:!0},{option:"Edit_permission",value:"'e'"},{option:"Delete_permission",value:"'d'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.userProfiles&&0<f.userProfiles.count&&f.userProfiles.rows.forEach(function(e){var n=[];e.crudPermissions.forEach(function(e){n.push(f.arraycrudPermissions[e].option)});var t=[];n.forEach(function(e){t.push(r.instant("STAFF."+e.toUpperCase()))}),e.selectedcrudPermissions=t.join(", ")}),f.editstate=function(e,n){t.go("app.staff.userProfiles.edit",{id:e.id,userProfile:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"UserProfilecloneController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:f.userProfiles?f.userProfiles.rows:[],crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("userProfile")+"?").htmlContent("<b>"+(e.name||"userProfile")+"</b> will be deleted.").ariaLabel("delete userProfile").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getUserProfiles=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.userProfile.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="UserProfiles",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditUserProfile=function(e,n){i.show({controller:"CreateOrEditUserProfileDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{userProfile:n,userProfiles:f.userProfiles.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteUserProfile=y,f.exportSelectedUserProfiles=function(){var e=angular.copy(f.selectedUserProfiles);return f.selectedUserProfiles=[],e},f.deleteSelectedUserProfiles=function(e){var n=i.confirm().title("Are you sure want to delete the selected userProfiles?").htmlContent("<b>"+f.selectedUserProfiles.length+" selected</b> will be deleted.").ariaLabel("delete UserProfiles").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedUserProfiles.forEach(function(e){y(e)}),f.selectedUserProfiles=[]})},f.deselectUserProfiles=function(){f.selectedUserProfiles=[]},f.selectAllUserProfiles=function(){f.selectedUserProfiles=f.userProfiles.rows};var b=!0,A=1;function E(e){f.userProfiles=e||{count:0,rows:[]}}function y(e){m.userProfile.delete({id:e.id}).$promise.then(function(){_.remove(f.userProfiles.rows,{id:e.id}),f.userProfiles.count-=1,f.userProfiles.rows.length||f.getUserProfiles(),p.success({title:_.startCase("UserProfile")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuserProfile"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuserProfile",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getUserProfiles())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","userProfiles","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.staff").controller("UserProfilesController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c){var m=this;function u(){return s.user.get({id:m.agent.id,userSetting:!0}).$promise.then(function(e){m.user=e})}function p(e){t.hide(e)}m.currentUser=o.getCurrentUser(),m.errors=[],m.setting=l,m.license=r,m.crudPermissions=d,m.hasModulePermissions={},m.passwordPattern=m.setting&&m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.title="STAFF.EDIT_USER",m.user=angular.copy(i),m.users=n,m.newUser=!1,m.user||(m.user={role:"user",autointernal:!0,context:"from-sip"},m.title="STAFF.NEW_USER",m.newUser=!0),m.addNewUser=function(){m.errors=[],s.user.save(m.user).$promise.then(function(e){m.users.unshift(e.toJSON()),a.success({title:"User properly created",msg:m.user.name?m.user.name+" has been created!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveUser=function(){m.errors=[],s.user.update({id:m.user.id},m.user).$promise.then(function(e){var n=_.find(m.users,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"User properly saved!",msg:m.user.name?m.user.name+" has been saved!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteUser=function(e){if(o.getCurrentUser().id===m.user.id)return a.error({title:"User not deleted!",msg:"You can't remove yourself"});m.errors=[];var n=t.confirm().title("Are you sure?").content("The user will be deleted.").ariaLabel("Delete User").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){s.user.delete({id:m.user.id}).$promise.then(function(){_.remove(m.users,{id:m.user.id}),a.success({title:"User properly deleted!",msg:(m.user.name||"user")+" has been deleted!"}),p(m.user)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},m.getDateFromString=function(e){return null===e?void 0:new Date(e)},m.closeDialog=p,s.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.userProfiles=e.rows||[]}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})});var g="user-setting:update:user-"+m.user.id;c.on(g,u),e.$on("$destroy",function(){c.removeListener(g,u)})}e.$inject=["$scope","$mdDialog","toasty","users","user","api","Auth","license","setting","crudPermissions","socket"],angular.module("app.staff").controller("CreateOrEditUserDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;function o(){e.hide()}s.currentUser=i.getCurrentUser(),s.errors=[],s.user=a,s.generateApiKey=function(){s.errors=[],t.user.createApiKey({id:s.user.id}).$promise.then(function(e){s.user.apiKey=e.api_key||"N/A",n.success({title:"User API key updated!"}),o()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.createApiKey",msg:e.data?JSON.stringify(e.data.message):e.toString()}),s.errors=e.data.errors||[{message:e.toString(),type:"api.user.createApiKey"}]})},s.removeApiKey=function(){s.errors=[],t.user.removeApiKey({id:s.user.id}).$promise.then(function(){s.user.apiKey="N/A",n.success({title:"User API key removed!"}),o()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.removeApiKey",msg:e.data?JSON.stringify(e.data.message):e.toString()}),s.errors=e.data.errors||[{message:e.toString(),type:"api.user.removeApiKey"}]})},s.closeDialog=o}e.$inject=["$mdDialog","toasty","api","user","Auth"],angular.module("app.staff").controller("UserapikeymanagerController",e)}(),function(){"use strict";function e(e,a){var i=this;i.user={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.user.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.user.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.user=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="api/users/"+i.user.id+"/avatar",i.user.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.staff").controller("Userchange_avatarController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.currentUser=o.getCurrentUser(),r.errors=[],r.setting=s,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.user=i,r.password="",r.oldPassword="",r.savePassword=function(){r.errors=[];var e={id:r.user.id,newPassword:r.password};r.currentUser.id==r.user.id&&(e.oldPassword=r.oldPassword);a.user.changePassword(e).$promise.then(function(){n.success({title:"User password properly updated!"}),l()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),r.errors=e.data.errors||[{message:e.toString(),type:"api.user.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.userForm.password.$setValidity("oldPasswordMatch",!1):t.userForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","toasty","api","user","setting","Auth"],angular.module("app.staff").controller("UserchangepasswordController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;m.currentUser=l.getCurrentUser(),m.license=i,m.setting=s,m.passwordPattern=m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.location=n.protocol()+"://"+n.host(),m.user=d||e.params.user||{},m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=l.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.hasModulePermissions={},m.selectedTab=e.params.tab||0,m.apikeymanagerdialog=function(e,n){t.show({controller:"UserapikeymanagerController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/edit/apikeymanager/apikeymanager.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{user:e,users:m.users?m.users.rows:[],crudPermissions:m.crudPermissions}})},m.changepassworddialog=function(e,n){t.show({controller:"UserchangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/edit/changepassword/changepassword.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{user:e,setting:s,users:m.users?m.users.rows:[],crudPermissions:m.crudPermissions}})},m.alert=r.info,m.gotoUsers=function(){e.go("app.staff.users",{},{reload:"app.staff.users"})},m.saveUser=function(){m.user=_.omit(m.user,"userpic"),o.user.update({id:m.user.id},m.user).$promise.then(function(){r.success({title:"User updated!",msg:m.user.name?m.user.name+" has been updated!":""})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuser",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.refreshUser=function(){return o.user.get({id:m.user.id,userSetting:!0}).$promise.then(function(e){m.user=e})},o.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.contexts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.userProfiles=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.user.getApiKey({id:m.user.id}).$promise.then(function(e){m.user.apiKey=e.api_key?e.api_key:"N/A"}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_APIKEY",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","license","setting","api","toasty","Auth","user","userProfileSection"],angular.module("app.staff").controller("UserController",e)}(),function(){"use strict";function e(e,t,a,i,s,n,o,r,l,d,c,m,u,p){var g=this;g.license=m,g.setting=u,g.currentUser=c.getCurrentUser(),g.users=n||{count:0,rows:[]},g.userProfile=o,g.userProfileSection=r&&1==r.count?r.rows[0]:null,g.crudPermissions=c.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.table="users",g.listOrder="",g.listOrderAsc=null,g.selectedUsers=[],g.query={fields:"createdAt,updatedAt,role,userProfileId,id,fullname,name,email,phone,mobile,userpic,password,description,autointernal,internal,transport,nat,allow,context,callgroup,pickupgroup,passwordResetAt,apiKey,videosupport,disabled,blocked,adSsoEnabled",role:"admin,user",userSetting:!0,sort:"-updatedAt",limit:10,page:1},g.arrayrole=_.keyBy([{option:"Admin",value:"'admin'"},{option:"User",value:"'user'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"},{option:"tls",value:"'tls'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arrayallow=_.keyBy([{option:"ulaw",value:"'ulaw'"},{option:"alaw",value:"'alaw'"},{option:"gsm",value:"'gsm'"},{option:"g722",value:"'g722'"},{option:"g729",value:"'g729'"},{option:"opus",value:"'opus'"},{option:"h264",value:"'h264'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.editstate=function(e,n){t.go("app.staff.users.edit",{id:e.id,user:e,crudPermissions:g.crudPermissions})},g.deleteconfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the "+_.startCase("user")+"?").htmlContent("<b>"+(e.name||"user")+"</b> will be deleted.").ariaLabel("delete user").targetEvent(n).ok("OK").cancel("CANCEL");a.show(t).then(function(){A(e)},function(){console.log("CANCEL")})},g.success=f,g.getUsers=b,g.createOrEditUser=function(e,n){a.show({controller:"CreateOrEditUserDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{user:n,users:g.users.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions}})},g.deleteUser=A,g.exportSelectedUsers=function(){var e=angular.copy(g.selectedUsers);return g.selectedUsers=[],e},g.deleteSelectedUsers=function(e){var n=a.confirm().title("Are you sure want to delete the selected users?").htmlContent("<b>"+g.selectedUsers.length+" selected</b> will be deleted.").ariaLabel("delete Users").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){g.selectedUsers.forEach(function(e){A(e)}),g.selectedUsers=[]})},g.deselectUsers=function(){g.selectedUsers=[]},g.selectAllUsers=function(){g.selectedUsers=g.users.rows},l.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.userProfiles=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})});var v=!0,h=1;function f(e){g.users=e||{count:0,rows:[]}}function b(){g.query.offset=(g.query.page-1)*g.query.limit,c.hasRole("admin")?g.promise=l.user.get(g.query,f).$promise:(g.query.id=g.userProfile.id,g.query.section="Users",g.promise=l.userProfile.getResources(g.query,f).$promise)}function A(e){l.user.delete({id:e.id}).$promise.then(function(){_.remove(g.users.rows,{id:e.id}),g.users.count-=1,g.users.rows.length||g.getUsers(),d.success({title:_.startCase("User")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuser",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){v?s(function(){v=!1}):(n||(h=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=h),g.getUsers())}),p.on("user-setting:update",b),e.$on("$destroy",function(){p.removeListener("user-setting:update",b)})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","users","userProfile","userProfileSection","api","toasty","Auth","license","setting","socket"],angular.module("app.staff").controller("UsersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.cannedAnswers=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="cannedAnswers",f.listOrder="",f.listOrderAsc=null,f.selectedCannedAnswers=[],f.query={fields:"createdAt,updatedAt,id,key,value,description",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/cannedAnswers/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{cannedAnswer:e,cannedAnswers:f.cannedAnswers.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("cannedAnswer")+"?").htmlContent("<b>"+(e.name||"cannedAnswer")+"</b> will be deleted.").ariaLabel("delete cannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getCannedAnswers=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cannedAnswer.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="CannedAnswers",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditCannedAnswer=function(e,n){i.show({controller:"CreateOrEditCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/cannedAnswers/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{cannedAnswer:n,cannedAnswers:f.cannedAnswers.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteCannedAnswer=y,f.exportSelectedCannedAnswers=function(){var e=angular.copy(f.selectedCannedAnswers);return f.selectedCannedAnswers=[],e},f.deleteSelectedCannedAnswers=function(e){var n=i.confirm().title("Are you sure want to delete the selected cannedAnswers?").htmlContent("<b>"+f.selectedCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete CannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedCannedAnswers.forEach(function(e){y(e)}),f.selectedCannedAnswers=[]})},f.deselectCannedAnswers=function(){f.selectedCannedAnswers=[]},f.selectAllCannedAnswers=function(){f.selectedCannedAnswers=f.cannedAnswers.rows};var b=!0,A=1;function E(e){f.cannedAnswers=e||{count:0,rows:[]}}function y(e){m.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(f.cannedAnswers.rows,{id:e.id}),f.cannedAnswers.count-=1,f.cannedAnswers.rows.length||f.getCannedAnswers(),p.success({title:_.startCase("CannedAnswer")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcannedAnswer"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcannedAnswer",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getCannedAnswers())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","cannedAnswers","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("CannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_CANNEDANSWER",g.cannedAnswer=angular.copy(l),g.cannedAnswers=r,g.newCannedAnswer=!1,g.cannedAnswer||(g.cannedAnswer={},g.title="TOOLS.NEW_CANNEDANSWER",g.newCannedAnswer=!0),g.addNewCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.cannedAnswer).$promise.then(function(e){g.cannedAnswers.unshift(e.toJSON()),o.success({title:"CannedAnswer properly created",msg:g.cannedAnswer.name?g.cannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.cannedAnswer.id},g.cannedAnswer).$promise.then(function(e){var n=_.find(g.cannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"CannedAnswer properly saved!",msg:g.cannedAnswer.name?g.cannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The cannedAnswer will be deleted.").ariaLabel("Delete CannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.cannedAnswer.id}).$promise.then(function(){_.remove(g.cannedAnswers,{id:g.cannedAnswer.id}),o.success({title:"CannedAnswer properly deleted!",msg:(g.cannedAnswer.name||"cannedAnswer")+" has been deleted!"}),v(g.cannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","cannedAnswers","cannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.contact_item_types=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="contact_item_types",f.listOrder="",f.listOrderAsc=null,f.selectedContactItemType=[],f.query={fields:"createdAt,updatedAt,id,name,OrderBy,rgbBackgroundColor",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditContactItemTypeDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/contact_item_types/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{contactItemType:e,contact_item_types:f.contact_item_types.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("contactItemType")+"?").htmlContent("<b>"+(e.name||"contactItemType")+"</b> will be deleted.").ariaLabel("delete contactItemType").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getContactItemType=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.contactItemType.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ContactItemType",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditContactItemType=function(e,n){i.show({controller:"CreateOrEditContactItemTypeDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/contact_item_types/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{contactItemType:n,contact_item_types:f.contact_item_types.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteContactItemType=y,f.exportSelectedContactItemType=function(){var e=angular.copy(f.selectedContactItemType);return f.selectedContactItemType=[],e},f.deleteSelectedContactItemType=function(e){var n=i.confirm().title("Are you sure want to delete the selected contact_item_types?").htmlContent("<b>"+f.selectedContactItemType.length+" selected</b> will be deleted.").ariaLabel("delete ContactItemTypes").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedContactItemType.forEach(function(e){y(e)}),f.selectedContactItemType=[]})},f.deselectContactItemType=function(){f.selectedContactItemType=[]},f.selectAllContactItemType=function(){f.selectedContactItemType=f.contact_item_types.rows};var b=!0,A=1;function E(e){f.contact_item_types=e||{count:0,rows:[]}}function y(e){m.contactItemType.delete({id:e.id}).$promise.then(function(){_.remove(f.contact_item_types.rows,{id:e.id}),f.contact_item_types.count-=1,f.contact_item_types.rows.length||f.getContactItemType(),p.success({title:_.startCase("ContactItemType")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcontactItemType"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcontactItemType",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getContactItemType())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","contact_item_types","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("ContactItemTypesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_CONTACTITEMTYPE",g.contactItemType=angular.copy(l),g.contact_item_types=r,g.newContactItemType=!1,g.contactItemType||(g.contactItemType={rgbBackgroundColor:"#2196f3"},g.title="TOOLS.NEW_CONTACTITEMTYPE",g.newContactItemType=!0),g.addNewContactItemType=function(){g.errors=[],d.contactItemType.save(g.contactItemType).$promise.then(function(e){g.contact_item_types.unshift(e.toJSON()),o.success({title:"ContactItemType properly created",msg:g.contactItemType.name?g.contactItemType.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contactItemType.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contactItemType.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveContactItemType=function(){g.errors=[],isNaN(g.contactItemType.OrderBy)?alert(s.instant("TOOLS.ORDER_BY_NUMERIC")):d.contactItemType.update({id:g.contactItemType.id},g.contactItemType).$promise.then(function(e){var n=_.find(g.contact_item_types,{id:e.id});n&&_.merge(n,_.pick(e.toJSON(),_.keys(n))),o.success({title:"ContactItemType properly saved!",msg:g.contactItemType.name?g.contactItemType.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contactItemType.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contactItemType.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteContactItemType=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The contactItemType will be deleted.").ariaLabel("Delete ContactItemType").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.contactItemType.delete({id:g.contactItemType.id}).$promise.then(function(){_.remove(g.contact_item_types,{id:g.contactItemType.id}),o.success({title:"ContactItemType properly deleted!",msg:(g.contactItemType.name||"contactItemType")+" has been deleted!"}),v(g.contactItemType)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contactItemType.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contactItemType.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","contact_item_types","contactItemType","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditContactItemTypeDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_CUSTOMDASHBOARD",g.customDashboard=angular.copy(l),g.customDashboards=r,g.newCustomDashboard=!1,g.customDashboard||(g.customDashboard={},g.title="TOOLS.NEW_CUSTOMDASHBOARD",g.newCustomDashboard=!0),g.addNewCustomDashboard=function(){g.errors=[],d.dashboard.save(g.customDashboard).$promise.then(function(e){g.customDashboards.unshift(e.toJSON()),o.success({title:"CustomDashboard properly created",msg:g.customDashboard.name?g.customDashboard.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCustomDashboard=function(){g.errors=[],d.dashboard.update({id:g.customDashboard.id},g.customDashboard).$promise.then(function(e){var n=_.find(g.customDashboards,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"CustomDashboard properly saved!",msg:g.customDashboard.name?g.customDashboard.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCustomDashboard=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The customDashboard will be deleted.").ariaLabel("Delete CustomDashboard").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.dashboard.delete({id:g.customDashboard.id}).$promise.then(function(){_.remove(g.customDashboards,{id:g.customDashboard.id}),o.success({title:"CustomDashboard properly deleted!",msg:(g.customDashboard.name||"customDashboard")+" has been deleted!"}),v(g.customDashboard)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","customDashboards","customDashboard","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditCustomDashboardDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.customDashboards=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="customDashboards",f.listOrder="",f.listOrderAsc=null,f.selectedCustomDashboards=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.tools.customDashboards.edit",{id:e.id,customDashboard:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"CustomDashboardcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{customDashboard:e,customDashboards:f.customDashboards?f.customDashboards.rows:[],crudPermissions:f.crudPermissions}})},f.gotodashboardgoto=function(e,n){t.go("app.dashboards.custom",{id:e.id})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("customDashboard")+"?").htmlContent("<b>"+(e.name||"customDashboard")+"</b> will be deleted.").ariaLabel("delete customDashboard").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getCustomDashboards=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.dashboard.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="CustomDashboards",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditCustomDashboard=function(e,n){i.show({controller:"CreateOrEditCustomDashboardDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{customDashboard:n,customDashboards:f.customDashboards.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteCustomDashboard=y,f.exportSelectedCustomDashboards=function(){var e=angular.copy(f.selectedCustomDashboards);return f.selectedCustomDashboards=[],e},f.deleteSelectedCustomDashboards=function(e){var n=i.confirm().title("Are you sure want to delete the selected customDashboards?").htmlContent("<b>"+f.selectedCustomDashboards.length+" selected</b> will be deleted.").ariaLabel("delete CustomDashboards").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedCustomDashboards.forEach(function(e){y(e)}),f.selectedCustomDashboards=[]})},f.deselectCustomDashboards=function(){f.selectedCustomDashboards=[]},f.selectAllCustomDashboards=function(){f.selectedCustomDashboards=f.customDashboards.rows};var b=!0,A=1;function E(e){f.customDashboards=e||{count:0,rows:[]}}function y(e){m.dashboard.delete({id:e.id}).$promise.then(function(){_.remove(f.customDashboards.rows,{id:e.id}),f.customDashboards.count-=1,f.customDashboards.rows.length||f.getCustomDashboards(),p.success({title:_.startCase("CustomDashboard")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdashboard"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdashboard",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getCustomDashboards())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","customDashboards","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("CustomDashboardsController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newCustomDashboard=!0,r.customDashboard=angular.copy(i),r.customDashboards=s,r.title=o.instant("TOOLS.CLONE_CUSTOMDASHBOARD"),i&&i.name&&(r.title+=": "+i.name),r.cloneCustomDashboard=function(){return e.dashboard.clone({id:i.id,includeAll:!0},r.customDashboard).$promise.then(function(e){r.customDashboards.unshift(e.toJSON()),a.success({title:"CustomDashboard properly cloned",msg:r.customDashboard.name?r.customDashboard.name+" has been cloned!":""}),t.go("app.tools.customDashboards.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","customDashboard","customDashboards","$translate"],angular.module("app.tools").controller("CustomDashboardcloneController",e)}(),function(){"use strict";function e(t,a,i,s,o){var r=this;function l(e,n,t){return o.dashboardItem.update(t).$promise.catch(function(e){console.error(e)})}r.customDashboard={},r.init=function(e,n){r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.customDashboard=e,r.customDashboard.draggable={enabled:!0,handle:".draggable",stop:l},r.customDashboard.resizable={enabled:!0,handle:".resizable",stop:l},r.customDashboard.widgets=[];var t=_.map(["chat","fax","mail","openchannel","sms","voice","whatsapp"],function(e){return"voice"===e?o.rpc.getVoiceQueues({fields:"id,name"}).$promise.then(function(e){r.voiceQueues=e}):(a=(t="chat"===(n=e)?n+"Website":n+"Account")+"s",o[t].get({fields:"id,name"}).$promise.then(function(e){r[a]=e||{count:0,rows:[]}}));var n,t,a});return i.all(t).then(function(){return o.dashboard.getItems({id:e.id}).$promise.then(function(e){if(e&&e.count&&e.rows)for(var n=0;n<e.rows.length;n+=1)e.rows[n].voiceQueues=r.voiceQueues,e.rows[n].voiceQueuesSelected=_.map(r.voiceQueues.rows,"id"),e.rows[n].smsAccounts=r.smsAccounts,e.rows[n].smsAccountsSelected=_.map(r.smsAccounts.rows,"id"),e.rows[n].faxAccounts=r.faxAccounts,e.rows[n].faxAccountsSelected=_.map(r.faxAccounts.rows,"id"),e.rows[n].mailAccounts=r.mailAccounts,e.rows[n].mailAccountsSelected=_.map(r.mailAccounts.rows,"id"),e.rows[n].openchannelAccounts=r.openchannelAccounts,e.rows[n].openchannelAccountsSelected=_.map(r.openchannelAccounts.rows,"id"),e.rows[n].chatWebsites=r.chatWebsites,e.rows[n].chatWebsitesSelected=_.map(r.chatWebsites.rows,"id"),e.rows[n].whatsappAccounts=r.whatsappAccounts,e.rows[n].whatsappAccountsSelected=_.map(r.whatsappAccounts.rows,"id"),e.rows[n].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+e.rows[n].type+"/ms-widget-engine."+e.rows[n].type+".html",r.customDashboard.widgets.push(e.rows[n])}).catch(function(e){console.error(e)})})},r.createOrEditWidget=function(e){if(e&&e.attrs)for(var n=0;n<e.attrs.length;n+=1)"attrReport"===e.attrs[n].name&&(e.reportType=e.attrs[n].type),e[e.attrs[n].name]=e.attrs[n].value;t.show({controller:"CreateOrEditDashboardItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/dashboard/dialog.html",parent:angular.element(a.body),clickOutsideToClose:!0,locals:{dashboarditem:e,dashboard:r.customDashboard.widgets,license:null,setting:null,crudPermissions:r.crudPermissions}}).then(function(e){if(e)for(var n=0;n<r.customDashboard.widgets.length;n+=1)r.customDashboard.widgets[n].id===e.id&&(r.customDashboard.widgets[n].attrs=e.attrs,r.customDashboard.widgets[n].voiceQueues=r.voiceQueues,r.customDashboard.widgets[n].voiceQueuesSelected=_.map(r.voiceQueues.rows,"id"),r.customDashboard.widgets[n].smsAccounts=r.smsAccounts,r.customDashboard.widgets[n].smsAccountsSelected=_.map(r.smsAccounts.rows,"id"),r.customDashboard.widgets[n].faxAccounts=r.faxAccounts,r.customDashboard.widgets[n].faxAccountsSelected=_.map(r.faxAccounts.rows,"id"),r.customDashboard.widgets[n].mailAccounts=r.mailAccounts,r.customDashboard.widgets[n].mailAccountsSelected=_.map(r.mailAccounts.rows,"id"),r.customDashboard.widgets[n].openchannelAccounts=r.openchannelAccounts,r.customDashboard.widgets[n].openchannelAccountsSelected=_.map(r.openchannelAccounts.rows,"id"),r.customDashboard.widgets[n].chatWebsites=r.chatWebsites,r.customDashboard.widgets[n].chatWebsitesSelected=_.map(r.chatWebsites.rows,"id"),r.customDashboard.widgets[n].whatsappAccounts=r.whatsappAccounts,r.customDashboard.widgets[n].whatsappAccountsSelected=_.map(r.whatsappAccounts.rows,"id"),r.customDashboard.widgets[n].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+r.customDashboard.widgets[n].type+"/ms-widget-engine."+r.customDashboard.widgets[n].type+".html")})},r.deleteWidget=function(n){var e=t.confirm().title("Would you like to delete "+n.title+"?").textContent("").ariaLabel("Delete Widget").ok("YES").cancel("NO");t.show(e).then(function(){return o.dashboardItem.delete({id:n.id}).$promise.then(function(e){_.remove(r.customDashboard.widgets,{id:n.id}),s.success({title:"Widget deleted!",msg:n.name?n.name+" has been deleted!":"Widget has been deleted!"})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETE.customDashboard"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdashboard",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()});console.error(e)})})}}e.$inject=["$mdDialog","$document","$q","toasty","api"],angular.module("app.tools").controller("CustomDashboardItemsController",e)}(),function(){"use strict";function e(n,e,t,a,o,i,s,r,l,d,c,m,u,p){var g=this;g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_DASHBOARDITEM",g.dashboarditem=angular.copy(l),g.dashboard=r,g.newDashboardItem=!1,g.selectedReport=[],g.query={fields:"createdAt,updatedAt,id,name,description,table,parent,conditions,joins",limit:10,page:1,sort:"-updatedAt"},g.dashboarditem?"web-report"==g.dashboarditem.type&&(g.apiName="custom"===g.dashboarditem.reportType?"analyticCustomReport":"analyticDefaultReport",d[g.apiName].get({fields:"id,name,parent"}).$promise.then(function(e){g.currentReport=_.find(e.rows,{id:g.dashboarditem.attrReport}),g.dashboarditem.report=g.currentReport.name,g.query.parent=g.currentReport.parent})):(g.dashboarditem={type:"counter",attrChannel:"voice",titleFontSize:12,attrUrl:"https://",attrHourFormat:"HH:mm:ss",attrTimezone:"0.00",attrMetric:"total",attrSerie1:"total",attrSerie2:"null",attrSerie3:"null",attrRefresh:10,attrFontSize:20,foreground:"#2196f3",background:"#ffffff"},g.title="TOOLS.NEW_DASHBOARDITEM",g.newDashboardItem=!0),g.addNewDashboardItem=function(){g.errors=[],d.dashboard.addItem({id:e.params.id},g.dashboarditem).$promise.then(function(e){g.dashboard.unshift(e.toJSON()),s.success({title:"DashboardItem properly created",msg:g.dashboarditem.name?g.dashboarditem.name+" has been created!":""}),I(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboardItem.save"}];for(var n=0;n<e.data.errors.length;n+=1)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboardItem.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDashboardItem=function(){g.errors=[],d.dashboardItem.update({id:g.dashboarditem.id},g.dashboarditem).$promise.then(function(e){var n=_.find(g.dashboard,{id:e.id});n&&_.merge(n,e.toJSON()),s.success({title:"DashboardItem properly saved!",msg:g.dashboarditem.name?g.dashboarditem.name+" has been saved!":""}),I(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboardItem.update"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboardItem.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDashboardItem=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The dashboarditem will be deleted.").ariaLabel("Delete DashboardItem").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.dashboardItem.delete({id:g.dashboarditem.id}).$promise.then(function(){_.remove(g.dashboard,{id:g.dashboarditem.id}),s.success({title:"DashboardItem properly deleted!",msg:(g.dashboarditem.name||"dashboarditem")+" has been deleted!"}),I(g.dashboarditem)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboardItem.delete"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboardItem.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.getReports=S,g.selectReport=function(){if(g.dashboarditem.report=g.selectedReport[0].name,g.dashboarditem.attrReport=g.selectedReport[0].id,g.dashboarditem.reportType=g.currentNode.custom?"custom":"default",!g.newDashboardItem){var e={name:"attrReport",type:g.dashboarditem.reportType,value:g.selectedReport[0].id};g.dashboarditem.attrs.splice(_.findIndex(g.dashboarditem.attrs,1,e))}n.dashboarditemForm.report.$setDirty(),a.hide()},g.closeReportDialog=function(){a.hide()},g.onTypeChange=function(){["web-report","iframe","clock","custom"].includes(g.dashboarditem.type)&&(g.dashboarditem.attrEmailAccounts=null,g.dashboarditem.attrFaxAccounts=null,g.dashboarditem.attrSmsAccounts=null,g.dashboarditem.attrOpenchannelAccounts=null,g.dashboarditem.attrWhatsappAccounts=null,g.dashboarditem.attrChatWebsites=null)},g.searchReport=function(){g.treeDefaultData=g.treeReports[0]?angular.fromJson(g.treeReports[0].tree):[],g.treeCustomData=g.treeReports[1]?angular.fromJson(g.treeReports[1].tree):[],g.treeConfig=(n={core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:["wholerow"]},"admin"!==g.currentUser.role?d.userProfileSection.get({fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:g.currentUser.userProfileId,sectionId:1203}).$promise.then(function(e){return g.userProfileSection=e&&1==e.count?e.rows[0]:null,n}).catch(function(e){s.error({title:"ERROR",msg:e.message})}):n),g.treeDefaultEvents=f(!1),g.treeCustomEvents=f(!0),a.show({controller:function(){return g},controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/partialViews/reports/treeReports.html",autoWrap:!0,skipHide:!0});var n},g.closeDialog=I,d.analyticTreeReport.get({}).$promise.then(function(e){g.treeReports=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREEREPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})});var v=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],h=null;function f(e){return e?{loaded:E,select_node:b}:{loaded:y,select_node:A}}function b(e,n){g.treeDefaultInstance.jstree(!0).deselect_all(),g.treeDefaultInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!0,g.currentPath=g.treeCustomInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticCustomReport",g.query.parent=n.node.id,S()}function A(e,n){g.treeCustomInstance.jstree(!0).deselect_all(),g.treeCustomInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!1,g.currentPath=g.treeDefaultInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticDefaultReport",g.query.parent=n.node.id,S()}function E(){if(!g.newDashboardItem&&"analyticCustomReport"===g.apiName){var e=g.treeCustomInstance.jstree(!0).get_node(g.query.parent);b(0,{node:e,selected:e.id})}}function y(){if(!g.newDashboardItem&&"analyticDefaultReport"===g.apiName){var e=g.treeDefaultInstance.jstree(!0).get_node(g.query.parent);A(0,{node:e,selected:e.id})}}function S(){if(g.query.offset=(g.query.page-1)*g.query.limit,g.apiName)if("admin"===g.currentUser.role)g.promise=d[g.apiName].get(g.query,T).$promise;else{if(!g.userProfileSection)return T(null);if(g.userProfileSection.autoAssociation)g.promise=d[g.apiName].get(g.query,T).$promise;else{var a=[];g.promise=d[g.apiName].get(g.query).$promise.then(function(e){return 0<(a=e&&e.rows?e.rows:[]).length?d.userProfileResource.get({sectionId:g.userProfileSection.id,type:"analyticDefaultReport"===g.apiName?"DefaultReports":"CustomReports"}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(0<n.length){var t=[];return a.forEach(function(e){_.find(n,["resourceId",e.id])&&t.push(e)}),T({count:t.length,rows:t})}return T(null)}):T(null)}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_REPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}}function T(e){g.reports=e||{count:0,rows:[]},g.newDashboardItem||g.selectedReport.push(_.find(g.reports.rows,{id:g.currentReport.id}))}function I(e){a.hide(e)}c.hasRole("admin")?d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){g.voiceQueues=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){h=e.rows||[]}).then(function(){for(var e=[],n=0;n<v.length;n++)e.push(d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:v[n].id}).$promise);return o.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<v.length;a++){var i=_.find(n,["sectionId",v[a].id]);if(i)if(i.autoAssociation){var s=[];h.forEach(function(e){e.type===v[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(d.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(t)}).then(function(e){var n=[],t=null;g.dashboarditem&&(t=_.find(h,{id:Number(g.dashboarditem.attrVoiceQueues)}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){n.push(e)})}t&&!_.some(n,["resourceId",t.id])&&h.forEach(function(e){e.id===t.id&&(e.canSelect=!1,n.push(e))}),g.voiceQueues=n}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueues",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.mailAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.mailAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.mailAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.mailAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:MailAccounts}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.mailAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.mailAccount,{id:Number(g.dashboarditem.attrEmailAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.mailAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.mailAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.mailAccount,{id:Number(g.dashboarditem.attrEmailAccounts)}));for(var i=0;i<g.mailAccount.length;i++)a&&g.mailAccount[i].id===a.id&&(g.mailAccount[i].canSelect=!1,t.push(g.mailAccount[i]));g.mailAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.faxAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.faxAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FAXACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.faxAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.faxAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:FaxAccounts}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.faxAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.faxAccount,{id:Number(g.dashboarditem.attrFaxAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.faxAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.faxAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.faxAccount,{id:Number(g.dashboarditem.attrFaxAccounts)}));for(var i=0;i<g.faxAccount.length;i++)a&&g.faxAccount[i].id===a.id&&(g.faxAccount[i].canSelect=!1,t.push(g.faxAccount[i]));g.faxAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.smsAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.smsAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SMSACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.smsAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.smsAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:SmsAccounts}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.smsAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.smsAccount,{id:Number(g.dashboarditem.attrSmsAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.smsAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.smsAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.smsAccount,{id:Number(g.dashboarditem.attrSmsAccounts)}));for(var i=0;i<g.smsAccount.length;i++)a&&g.smsAccount[i].id===a.id&&(g.smsAccount[i].canSelect=!1,t.push(g.smsAccount[i]));g.smsAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.openchannelAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.openchannelAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OPENCHANNELACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.openchannelAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.openchannelAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:OpenchannelAccounts}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.openchannelAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.openchannelAccount,{id:Number(g.dashboarditem.attrOpenchannelAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.openchannelAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.openchannelAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.openchannelAccount,{id:Number(g.dashboarditem.attrOpenchannelAccounts)}));for(var i=0;i<g.openchannelAccount.length;i++)a&&g.openchannelAccount[i].id===a.id&&(g.openchannelAccount[i].canSelect=!1,t.push(g.openchannelAccount[i]));g.openchannelAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.whatsappAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.whatsappAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_WHATSAPPACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.whatsappAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.whatsappAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:WhatsappAccounts}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.whatsappAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.whatsappAccount,{id:Number(g.dashboarditem.attrWhatsappAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.whatsappAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.whatsappAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.whatsappAccount,{id:Number(g.dashboarditem.attrWhatsappAccounts)}));for(var i=0;i<g.whatsappAccount.length;i++)a&&g.whatsappAccount[i].id===a.id&&(g.whatsappAccount[i].canSelect=!1,t.push(g.whatsappAccount[i]));g.whatsappAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.chatWebsite.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.chatWebsite=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CHATWEBSITE",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.chatWebsite.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.chatWebsite=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:ChatWebsites}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.chatWebsite,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.chatWebsite,{id:Number(g.dashboarditem.attrChatWebsites)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.chatWebsite,{id:t.id});a.canSelect=!1,n.push(a)}g.chatWebsite=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.chatWebsite,{id:Number(g.dashboarditem.attrChatWebsites)}));for(var i=0;i<g.chatWebsite.length;i++)a&&g.chatWebsite[i].id===a.id&&(g.chatWebsite[i].canSelect=!1,t.push(g.chatWebsite[i]));g.chatWebsite=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","dashboard","dashboarditem","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditDashboardItemDialogController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.customDashboard=c||t.params.customDashboard||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.clonedialog=function(e,n){a.show({controller:"CustomDashboardcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/clone/clone.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{customDashboard:e,customDashboards:u.customDashboards?u.customDashboards.rows:[],crudPermissions:u.crudPermissions}})},u.gotogoto=function(e,n){t.go("app.dashboards.custom",{id:e.id})},u.alert=l.info,u.gotoCustomDashboards=function(){t.go("app.tools.customDashboards",{},{reload:"app.tools.customDashboards"})},u.saveCustomDashboard=function(){r.dashboard.update({id:u.customDashboard.id},u.customDashboard).$promise.then(function(){l.success({title:"CustomDashboard updated!",msg:u.customDashboard.name?u.customDashboard.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETdashboard",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","customDashboard","userProfileSection"],angular.module("app.tools").controller("CustomDashboardController",e)}(),function(){"use strict";function e(a,i,o,r,e,l,d,n,t,s,c){var m=this;if(m.currentUser=n.getCurrentUser(),m.disposition=angular.copy(e),m.setting=c,m.license=s,m.crudPermissions=t,m.newDisposition=!1,m.errors=[],m.disposition||(m.disposition={level:"first"},m.newDisposition=!0),l){var u=l.field;m.disposition[u]=l.id}function p(){return o(function(t,n){d.disposition.get({fields:"id,name,level,ParentId",sort:"id",nolimit:"true"}).$promise.then(function(e){var n=e.rows||[];return t(n)}).catch(function(e){n(e)})})}function g(e){"first"===e.level?m.firstLevelDisposition=e:(m.anySecondLevelDisposition=!0,m.secondLevelDisposition=e,m.firstLevelDisposition=_.find(m.dispositions,["id",m.secondLevelDisposition.ParentId]),m.firstLevelDisposition||p().then(function(){m.firstLevelDisposition=_.find(m.allDispositions,["id",m.secondLevelDisposition.ParentId]),m.firstLevelDisposition.canSelect=!1,m.dispositions.push(m.firstLevelDisposition)}))}function v(e){a.hide(e)}m.onInit=function(){var n="disposition";l?n=l.route:"user"===m.currentUser.role&&(n="userProfile");var t="get";l?t="getDispositions":"user"===m.currentUser.role&&(t="getResources");var e={fields:"id,name,level,ParentId",id:l?l.id:void 0,section:"user"===m.currentUser.role?"Dispositions":void 0,MailAccountId:l?void 0:"null",FaxAccountId:l?void 0:"null",SmsAccountId:l?void 0:"null",OpenchannelAccountId:l?void 0:"null",ChatWebsiteId:l?void 0:"null",WhatsappAccountId:l?void 0:"null",ListId:l?void 0:"null",sort:"id",nolimit:"true"};(a=n,i=t,s=e,o(function(t,n){d[a][i](s).$promise.then(function(e){var n=e.rows||[];return t(n)}).catch(function(e){n(e)})})).then(function(e){m.dispositions=angular.copy(e),m.newDisposition||function(){if("first"===m.disposition.level)return;if(m.parentDisposition=_.find(m.dispositions,["id",m.disposition.ParentId]),!m.parentDisposition)return p().then(function(e){m.allDispositions=e;for(var n=0;n<m.allDispositions.length;n++){var t=m.allDispositions[n];if(t.id===m.disposition.ParentId){g(t),t.canSelect=!1,m.dispositions.push(t);break}}});g(m.parentDisposition)}()}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:["api",n,t].join(":"),msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});var a,i,s},m.onFirstLevelSelection=function(){m.secondLevelDisposition=void 0,m.anySecondLevelDisposition=_.some(m.dispositions,function(e){return e.ParentId===m.firstLevelDisposition.id&&e.id!=m.disposition.id})},m.addNewDisposition=function(){m.errors=[],m.secondLevelDisposition?(m.disposition.ParentId=m.secondLevelDisposition.id,m.disposition.level="third"):m.firstLevelDisposition&&(m.disposition.ParentId=m.firstLevelDisposition.id,m.disposition.level="second");d.disposition.save(m.disposition).$promise.then(function(e){m.dispositions.unshift(e.toJSON()),r.success({title:i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_CREATED_SUCCESS_TITLE")}),v(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.save"}];for(var n=0;n<e.data.errors.length;n+=1)r.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveDisposition=function(){m.errors=[],m.secondLevelDisposition?(m.disposition.ParentId=m.secondLevelDisposition.id,m.disposition.level="third"):m.firstLevelDisposition&&(m.disposition.ParentId=m.firstLevelDisposition.id,m.disposition.level="second");d.disposition.update({id:m.disposition.id},m.disposition).$promise.then(function(e){var n=_.find(m.dispositions,{id:e.id});n&&_.merge(n,e.toJSON()),r.success({title:i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_SAVED_SUCCESS_TITLE")}),v(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.update"}];for(var n=0;n<e.data.errors.length;n++)r.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteDisposition=function(e){m.errors=[];var n=_.some(m.dispositions,["ParentId",m.disposition.id]),t=a.confirm({skipHide:!0}).title(i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(i.instant("TOOLS.NOTIFICATIONS."+(n?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:m.disposition.name})).ariaLabel("Delete disposition").ok(i.instant("TOOLS.DELETE")).cancel(i.instant("TOOLS.CANCEL")).targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:m.disposition.id}).$promise.then(function(){r.success({title:i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")}),v(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var n=0;n<e.data.errors.length;n++)r.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},m.clearSelection=function(e){"first"===e?(m.firstLevelDisposition=void 0,m.secondLevelDisposition=void 0,m.anySecondLevelDisposition=!1):m.secondLevelDisposition=void 0},m.closeDialog=v}e.$inject=["$mdDialog","$translate","$q","toasty","disposition","model","api","Auth","crudPermissions","license","setting"],angular.module("app.tools").controller("CreateOrEditDispositionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v){var h=this;function f(e){h.dispositions=e||{count:0,rows:[]}}function b(){h.query.offset=(h.query.page-1)*h.query.limit,p.isAdmin()?h.promise=m.disposition.get(h.query,f).$promise:(h.query.id=h.userProfile.id,h.query.section="Dispositions",h.promise=m.userProfile.getResources(h.query,f).$promise)}function A(e){m.disposition.delete({id:e.id}).$promise.then(function(){b(),u.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){h.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)u.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else u.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}h.license=g,h.setting=v,h.currentUser=p.getCurrentUser(),h.dispositions=l||{count:0,rows:[]},h.userProfile=d,h.userProfileSection=c&&1==c.count?c.rows[0]:null,h.crudPermissions=p.parseCrudPermissions(h.userProfileSection?h.userProfileSection.crudPermissions:null),h.selectedDispositions=[],h.levels={first:"1st",second:"2nd",third:"3rd"},h.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",WhatsappAccountId:"null",ListId:"null",limit:10,page:1},h.deleteconfirm=function(e,n){var t=_.some(h.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){A(e)})},h.success=f,h.getDispositions=b,h.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:null,license:h.license,setting:h.setting,crudPermissions:h.crudPermissions}}).then(function(e){!0===e&&b()})},h.deleteDisposition=A,h.exportSelectedDispositions=function(){var e=angular.copy(h.selectedDispositions);return h.selectedDispositions=[],e},h.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:h.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){h.selectedDispositions.forEach(function(e){A(e)}),h.selectedDispositions=[]})},h.deselectDispositions=function(){h.selectedDispositions=[]},h.selectAllDispositions=function(){h.selectedDispositions=h.dispositions.rows};var E=!0,y=1;e.$watch("vm.query.filter",function(e,n){E?o(function(){E=!1}):(n||(y=h.query.page),e!==n&&(h.query.page=1),e||(h.query.page=y),b())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","dispositions","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.tools").controller("DispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_INTERVAL",g.interval=angular.copy(l),g.intervals=r,g.newInterval=!1,g.interval||(g.interval={},g.title="TOOLS.NEW_INTERVAL",g.newInterval=!0),g.addNewInterval=function(){g.errors=[],d.interval.save(g.interval).$promise.then(function(e){g.intervals.unshift(e.toJSON()),o.success({title:"Interval properly created",msg:g.interval.name?g.interval.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveInterval=function(){g.errors=[],d.interval.update({id:g.interval.id},g.interval).$promise.then(function(e){var n=_.find(g.intervals,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Interval properly saved!",msg:g.interval.name?g.interval.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteInterval=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The interval will be deleted.").ariaLabel("Delete Interval").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.interval.delete({id:g.interval.id}).$promise.then(function(){_.remove(g.intervals,{id:g.interval.id}),o.success({title:"Interval properly deleted!",msg:(g.interval.name||"interval")+" has been deleted!"}),v(g.interval)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","intervals","interval","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditIntervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditAppintervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.intervalIntervals=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.interval.getIntervals(m.query,u).$promise}function g(e){d.interval.delete({id:e.id}).$promise.then(function(){_.remove(m.intervalIntervals.rows,{id:e.id}),m.intervalIntervals.count-=1,m.intervalIntervals.rows.length||p(),l.success({title:"Interval deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETinterval"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.interval={},m.intervalIntervals={count:0,rows:[]},m.selectedIntervalIntervals=[],m.crudPermissions,m.sortableTable={animation:100,onSort:function(e){d.interval.addIntervals({id:m.interval.id},e.models).$promise.then(function(e){m.intervalIntervals.rows=e}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:SORTABLETABLE",msg:e.data?JSON.stringify(e.data):e.toString()})})}},m.query={fields:"createdAt,updatedAt,id,name,interval",nolimit:"true",limit:10,page:1},m.init=function(e,n){m.interval=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.sortableTable.disabled=!m.crudPermissions.canEdit,m.query.id=m.interval.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interval?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interval #")+e.id||"interval")+"</b> will be deleted.").ariaLabel("delete interval").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIntervalIntervals=p,m.createOrEditIntervalInterval=function(e,n){o.show({controller:"EditAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/intervals/edit/apps/interval/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:m.interval,interval:n,intervals:m.intervalIntervals.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIntervalIntervals=function(){var e=angular.copy(m.selectedIntervalIntervals);return m.selectedIntervalIntervals=[],e},m.deleteIntervalInterval=g,m.deleteSelectedIntervalIntervals=function(e){var n=o.confirm().title("Are you sure want to delete the selected intervals?").htmlContent("<b>"+m.selectedIntervalIntervals.length+" selected</b> will be deleted.").ariaLabel("delete intervals").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIntervalIntervals.forEach(function(e){g(e)}),m.selectedIntervalIntervals=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("IntervalIntervalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_INTERVAL",g.interval=angular.copy(l),g.intervals=r,g.newInterval=!1,g.interval||(g.interval={},g.title="TOOLS.NEW_INTERVAL",g.newInterval=!0),g.addNewInterval=function(){g.errors=[],d.interval.save(g.interval).$promise.then(function(e){g.intervals.unshift(e.toJSON()),o.success({title:"Interval properly created",msg:g.interval.name?g.interval.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveInterval=function(){g.errors=[],d.interval.update({id:g.interval.id},g.interval).$promise.then(function(e){var n=_.find(g.intervals,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Interval properly saved!",msg:g.interval.name?g.interval.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteInterval=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The interval will be deleted.").ariaLabel("Delete Interval").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.interval.delete({id:g.interval.id}).$promise.then(function(){_.remove(g.intervals,{id:g.interval.id}),o.success({title:"Interval properly deleted!",msg:(g.interval.name||"interval")+" has been deleted!"}),v(g.interval)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","intervals","interval","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditIntervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.interval=c||e.params.interval||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoIntervals=function(){e.go("app.tools.intervals",{},{reload:"app.tools.intervals"})},u.saveInterval=function(){r.interval.update({id:u.interval.id},u.interval).$promise.then(function(){l.success({title:"Interval updated!",msg:u.interval.name?u.interval.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","interval","userProfileSection"],angular.module("app.tools").controller("IntervalController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.intervals=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="intervals",f.listOrder="",f.listOrderAsc=null,f.selectedIntervals=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,page:1},f.editstate=function(e,n){t.go("app.tools.intervals.edit",{id:e.id,interval:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("interval")+"?").htmlContent("<b>"+(e.name||"interval")+"</b> will be deleted.").ariaLabel("delete interval").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getIntervals=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.interval.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Intervals",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditInterval=function(e,n){i.show({controller:"CreateOrEditIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/intervals/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:n,intervals:f.intervals.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteInterval=y,f.exportSelectedIntervals=function(){var e=angular.copy(f.selectedIntervals);return f.selectedIntervals=[],e},f.deleteSelectedIntervals=function(e){var n=i.confirm().title("Are you sure want to delete the selected intervals?").htmlContent("<b>"+f.selectedIntervals.length+" selected</b> will be deleted.").ariaLabel("delete Intervals").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedIntervals.forEach(function(e){y(e)}),f.selectedIntervals=[]})},f.deselectIntervals=function(){f.selectedIntervals=[]},f.selectAllIntervals=function(){f.selectedIntervals=f.intervals.rows};var b=!0,A=1;function E(e){f.intervals=e||{count:0,rows:[]}}function y(e){m.interval.delete({id:e.id}).$promise.then(function(){_.remove(f.intervals.rows,{id:e.id}),f.intervals.count-=1,f.intervals.rows.length||f.getIntervals(),p.success({title:_.startCase("Interval")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEinterval"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEinterval",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getIntervals())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","intervals","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("IntervalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_PAUSE",g.pause=angular.copy(l),g.pauses=r,g.newPause=!1,g.pause||(g.pause={},g.title="TOOLS.NEW_PAUSE",g.newPause=!0),g.addNewPause=function(){g.errors=[],d.pause.save(g.pause).$promise.then(function(e){g.pauses.unshift(e.toJSON()),o.success({title:"Pause properly created",msg:g.pause.name?g.pause.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.pause.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pause.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savePause=function(){g.errors=[],d.pause.update({id:g.pause.id},g.pause).$promise.then(function(e){var n=_.find(g.pauses,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Pause properly saved!",msg:g.pause.name?g.pause.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.pause.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pause.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletePause=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The pause will be deleted.").ariaLabel("Delete Pause").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.pause.delete({id:g.pause.id}).$promise.then(function(){_.remove(g.pauses,{id:g.pause.id}),o.success({title:"Pause properly deleted!",msg:(g.pause.name||"pause")+" has been deleted!"}),v(g.pause)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.pause.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pause.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","pauses","pause","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditPauseDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.pauses=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="pauses",f.listOrder="",f.listOrderAsc=null,f.selectedPauses=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditPauseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/pauses/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{pause:e,pauses:f.pauses.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("pause")+"?").htmlContent("<b>"+(e.name||"pause")+"</b> will be deleted.").ariaLabel("delete pause").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getPauses=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.pause.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Pauses",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditPause=function(e,n){i.show({controller:"CreateOrEditPauseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/pauses/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{pause:n,pauses:f.pauses.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletePause=y,f.exportSelectedPauses=function(){var e=angular.copy(f.selectedPauses);return f.selectedPauses=[],e},f.deleteSelectedPauses=function(e){var n=i.confirm().title("Are you sure want to delete the selected pauses?").htmlContent("<b>"+f.selectedPauses.length+" selected</b> will be deleted.").ariaLabel("delete Pauses").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedPauses.forEach(function(e){y(e)}),f.selectedPauses=[]})},f.deselectPauses=function(){f.selectedPauses=[]},f.selectAllPauses=function(){f.selectedPauses=f.pauses.rows};var b=!0,A=1;function E(e){f.pauses=e||{count:0,rows:[]}}function y(e){m.pause.delete({id:e.id}).$promise.then(function(){_.remove(f.pauses.rows,{id:e.id}),f.pauses.count-=1,f.pauses.rows.length||f.getPauses(),p.success({title:_.startCase("Pause")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEpause"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEpause",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getPauses())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","pauses","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("PausesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;if(g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_SCHEDULE",g.schedule=angular.copy(l),g.schedules=r,g.newSchedule=!1,g.selectedReport=[],g.query={fields:"createdAt,updatedAt,id,name,description,table,parent,conditions,joins",limit:10,page:1,sort:"-updatedAt"},g.schedule){g.apiName=g.schedule.DefaultReportId?"analyticDefaultReport":"analyticCustomReport";var v=g.schedule.DefaultReportId?g.schedule.DefaultReportId:g.schedule.CustomReportId;d[g.apiName].get({fields:"id,name,parent"}).$promise.then(function(e){g.currentReport=_.find(e.rows,{id:v}),g.schedule.report=g.currentReport.name,g.query.parent=g.currentReport.parent})}else g.schedule={output:"xlsx",active:!0,startAt:new Date,endAt:new Date(Date.now()+2592e6),cron:"0 0 * * *",subtractNumber:1,subtractUnit:"days",sendMail:!1,sendIfEmpty:!0},g.title="TOOLS.NEW_SCHEDULE",g.newSchedule=!0;function h(e){return e?{loaded:A,select_node:f}:{loaded:E,select_node:b}}function f(e,n){g.treeDefaultInstance.jstree(!0).deselect_all(),g.treeDefaultInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!0,g.currentPath=g.treeCustomInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticCustomReport",g.query.parent=n.node.id,y()}function b(e,n){g.treeCustomInstance.jstree(!0).deselect_all(),g.treeCustomInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!1,g.currentPath=g.treeDefaultInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticDefaultReport",g.query.parent=n.node.id,y()}function A(){if(!g.newSchedule&&"analyticCustomReport"===g.apiName){var e=g.treeCustomInstance.jstree(!0).get_node(g.query.parent);f(0,{node:e,selected:e.id})}}function E(){if(!g.newSchedule&&"analyticDefaultReport"===g.apiName){var e=g.treeDefaultInstance.jstree(!0).get_node(g.query.parent);b(0,{node:e,selected:e.id})}}function y(){if(g.query.offset=(g.query.page-1)*g.query.limit,g.apiName)if("admin"===g.currentUser.role)g.promise=d[g.apiName].get(g.query,S).$promise;else{if(!g.userProfileSection)return S(null);if(g.userProfileSection.autoAssociation)g.promise=d[g.apiName].get(g.query,S).$promise;else{var a=[];g.promise=d[g.apiName].get(g.query).$promise.then(function(e){return 0<(a=e&&e.rows?e.rows:[]).length?d.userProfileResource.get({sectionId:g.userProfileSection.id,type:"analyticDefaultReport"===g.apiName?"DefaultReports":"CustomReports"}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(0<n.length){var t=[];return a.forEach(function(e){_.find(n,["resourceId",e.id])&&t.push(e)}),S({count:t.length,rows:t})}return S(null)}):S(null)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_REPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}}function S(e){g.reports=e||{count:0,rows:[]},g.newSchedule||g.selectedReport.push(_.find(g.reports.rows,{id:g.currentReport.id}))}function T(e){a.hide(e)}g.addNewSchedule=function(){g.errors=[],d.schedule.save(g.schedule).$promise.then(function(e){g.schedules.unshift(e.toJSON()),o.success({title:"Schedule properly created",msg:g.schedule.name?g.schedule.name+" has been created!":""}),T(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.schedule.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.schedule.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSchedule=function(){g.errors=[],d.schedule.update({id:g.schedule.id},g.schedule).$promise.then(function(e){var n=_.find(g.schedules,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Schedule properly saved!",msg:g.schedule.name?g.schedule.name+" has been saved!":""}),T(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.schedule.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.schedule.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSchedule=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The schedule will be deleted.").ariaLabel("Delete Schedule").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.schedule.delete({id:g.schedule.id}).$promise.then(function(){_.remove(g.schedules,{id:g.schedule.id}),o.success({title:"Schedule properly deleted!",msg:(g.schedule.name||"schedule")+" has been deleted!"}),T(g.schedule)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.schedule.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.schedule.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.getReports=y,g.selectReport=function(){g.schedule.report=g.selectedReport[0].name,g.currentNode.custom?(g.schedule.CustomReportId=g.selectedReport[0].id,delete g.schedule.DefaultReportId):(g.schedule.DefaultReportId=g.selectedReport[0].id,delete g.schedule.CustomReportId);e.scheduleForm.report.$setDirty(),a.hide()},g.closeReportDialog=function(){a.hide()},g.searchReport=function(){g.treeDefaultData=g.treeReports[0]?angular.fromJson(g.treeReports[0].tree):[],g.treeCustomData=g.treeReports[1]?angular.fromJson(g.treeReports[1].tree):[],g.treeConfig=(n={core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:["wholerow"]},"admin"!==g.currentUser.role?d.userProfileSection.get({fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:g.currentUser.userProfileId,sectionId:1203}).$promise.then(function(e){return g.userProfileSection=e&&1==e.count?e.rows[0]:null,n}).catch(function(e){o.error({title:"ERROR",msg:e.message})}):n),g.treeDefaultEvents=h(!1),g.treeCustomEvents=h(!0),a.show({controller:function(){return g},controllerAs:"vm",templateUrl:"app/main/apps/tools/views/schedules/partialViews/reports/treeReports.html",autoWrap:!0,skipHide:!0});var n},g.closeDialog=T,d.analyticTreeReport.get({}).$promise.then(function(e){g.treeReports=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREEREPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.mailAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.mailAccounts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.mailAccounts,{id:e.resourceId})}),t=null;if(g.schedule&&(t=_.find(g.mailAccounts,{id:Number(g.schedule.MailAccountId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.mailAccounts,{id:t.id});a.canSelect=!1,n.push(a)}g.mailAccounts=n})}else{var t=[],a=null;g.schedule&&(a=_.find(g.mailAccounts,{id:Number(g.schedule.MailAccountId)}));for(var i=0;i<g.mailAccounts.length;i++)a&&g.mailAccounts[i].id===a.id&&(g.mailAccounts[i].canSelect=!1,t.push(g.mailAccounts[i]));g.mailAccounts=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","schedules","schedule","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditScheduleDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.schedules=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="schedules",f.listOrder="",f.listOrderAsc=null,f.selectedScheduler=[],f.query={fields:"createdAt,updatedAt,id,name,CustomReportId,DefaultReportId,output,active,startAt,endAt,cron,subtractNumber,subtractUnit,sendMail,MailAccountId,email,cc,bcc,sendIfEmpty,description",sort:"-updatedAt",limit:10,page:1},f.arrayoutput=_.keyBy([{option:"CSV",value:"'csv'"},{option:"PDF",value:"'pdf'"},{option:"Excel",value:"'xlsx'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysubtractUnit=_.keyBy([{option:"Minutes",value:"'minutes'"},{option:"Hours",value:"'hours'"},{option:"Days",value:"'days'"},{option:"Weeks",value:"'weeks'"},{option:"Months",value:"'months'"},{option:"Quarters",value:"'quarters'"},{option:"Years",value:"'years'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditScheduleDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/schedules/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{schedule:e,schedules:f.schedules.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.runconfirm=function(e,n){var t=i.confirm().title("Are you sure want to run the schedule?").htmlContent("<b>"+(e.name||"schedule")+"</b> will be run.").ariaLabel("delete schedule").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){return m.schedule.run({id:e.id}).$promise},function(){console.log("CANCEL")})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("schedule")+"?").htmlContent("<b>"+(e.name||"schedule")+"</b> will be deleted.").ariaLabel("delete schedule").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getScheduler=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.schedule.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Scheduler",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSchedule=function(e,n){i.show({controller:"CreateOrEditScheduleDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/schedules/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{schedule:n,schedules:f.schedules.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSchedule=y,f.exportSelectedScheduler=function(){var e=angular.copy(f.selectedScheduler);return f.selectedScheduler=[],e},f.deleteSelectedScheduler=function(e){var n=i.confirm().title("Are you sure want to delete the selected schedules?").htmlContent("<b>"+f.selectedScheduler.length+" selected</b> will be deleted.").ariaLabel("delete Schedules").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedScheduler.forEach(function(e){y(e)}),f.selectedScheduler=[]})},f.deselectScheduler=function(){f.selectedScheduler=[]},f.selectAllScheduler=function(){f.selectedScheduler=f.schedules.rows},m.analyticTreeReport.get({}).$promise.then(function(e){f.treeReports=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREEREPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.mailAccounts=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.mailAccounts=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.mailAccounts,{id:e.resourceId})}),t=null;if(f.schedule&&(t=_.find(f.mailAccounts,{id:Number(f.schedule.MailAccountId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.mailAccounts,{id:t.id});a.canSelect=!1,n.push(a)}f.mailAccounts=n})}else{var t=[],a=null;f.schedule&&(a=_.find(f.mailAccounts,{id:Number(f.schedule.MailAccountId)}));for(var i=0;i<f.mailAccounts.length;i++)a&&f.mailAccounts[i].id===a.id&&(f.mailAccounts[i].canSelect=!1,t.push(f.mailAccounts[i]));f.mailAccounts=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.schedules=e||{count:0,rows:[]}}function y(e){m.schedule.delete({id:e.id}).$promise.then(function(){_.remove(f.schedules.rows,{id:e.id}),f.schedules.count-=1,f.schedules.rows.length||f.getScheduler(),p.success({title:_.startCase("Schedule")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEschedule"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEschedule",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getScheduler())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","schedules","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("SchedulesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_SOUND",g.sound=angular.copy(l),g.sounds=r,g.newSound=!1,g.sound||(g.sound={},g.title="TOOLS.NEW_SOUND",g.newSound=!0),g.addNewSound=function(){g.errors=[],d.sound.save(g.sound).$promise.then(function(e){g.sounds.unshift(e.toJSON()),o.success({title:"Sound properly created",msg:g.sound.name?g.sound.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.sound.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSound=function(){g.errors=[],d.sound.update({id:g.sound.id},g.sound).$promise.then(function(e){var n=_.find(g.sounds,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Sound properly saved!",msg:g.sound.name?g.sound.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.sound.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSound=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The sound will be deleted.").ariaLabel("Delete Sound").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.sound.delete({id:g.sound.id}).$promise.then(function(){_.remove(g.sounds,{id:g.sound.id}),o.success({title:"Sound properly deleted!",msg:(g.sound.name||"sound")+" has been deleted!"}),v(g.sound)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.sound.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","sounds","sound","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditSoundDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.sounds=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="sounds",f.listOrder="",f.listOrderAsc=null,f.selectedSounds=[],f.query={fields:"createdAt,updatedAt,id,save_name,converted_format,name,audio,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{sound:e,sounds:f.sounds.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.downloadfile2=function(s,e){return m.sound.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.converted_format?s.save_name+"."+s.converted_format:s.save_name;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("sound")+"?").htmlContent("<b>"+(e.name||"sound")+"</b> will be deleted.").ariaLabel("delete sound").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSounds=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.sound.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Sounds",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSound=function(e,n){i.show({controller:"CreateOrEditSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{sound:n,sounds:f.sounds.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSound=y,f.exportSelectedSounds=function(){var e=angular.copy(f.selectedSounds);return f.selectedSounds=[],e},f.deleteSelectedSounds=function(e){var n=i.confirm().title("Are you sure want to delete the selected sounds?").htmlContent("<b>"+f.selectedSounds.length+" selected</b> will be deleted.").ariaLabel("delete Sounds").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSounds.forEach(function(e){y(e)}),f.selectedSounds=[]})},f.deselectSounds=function(){f.selectedSounds=[]},f.selectAllSounds=function(){f.selectedSounds=f.sounds.rows},f.uploadSound=function(e){i.show({controller:"UploadSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/upload/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{sounds:f.sounds.rows}})};var b=!0,A=1;function E(e){f.sounds=e||{count:0,rows:[]}}function y(e){m.sound.delete({id:e.id}).$promise.then(function(){_.remove(f.sounds.rows,{id:e.id}),f.sounds.count-=1,f.sounds.rows.length||f.getSounds(),p.success({title:_.startCase("Sound")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsound"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsound",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSounds())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","sounds","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("SoundsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this,r=15,l=1024*r*1024;o.currentUser=s.getCurrentUser(),o.errors=[],o.title="TOOLS.UPLOAD_SOUND",o.sounds=a,o.uploadSounds=[],o.uploadState="none",o.sound={},o.ngFlowOptions={maxChunkRetries:1,chunkSize:l,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0,target:"api/sounds"},o.ngFlow={flow:{}},o.dropping=!1,o.fileAdded=function(e){var n=["wav","mp3","gsm"];if(!_.includes(n,e.getExtension()))return t.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(e.size>l)return t.error({title:"File too big",msg:"The max allowed size is "+r+"MB"}),!1;return o.sound={id:e.uniqueIdentifier,file:e},o.uploadSounds.unshift(o.sound),!0},o.upload=function(){o.uploadState="uploading",o.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},o.ngFlow.flow.opts.query={role:o.currentUser.role,userProfileId:o.currentUser.userProfileId},o.ngFlow.flow.upload()},o.fileSuccess=function(a,e){o.sounds.unshift(JSON.parse(e)),angular.forEach(o.uploadSounds,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result}}})},o.uploadError=function(e,n){o.ngFlow.flow.cancel(),t.error({title:"Upload error",msg:"Cannot upload the sound"}),o.uploadState="failed"},o.uploadComplete=function(){"failed"!==o.uploadState&&(o.uploadState="completed",t.success({title:"Upload completed",msg:o.sound.file.name+" uploaded successfully"}))},o.closeDialog=function(){n.hide()}}e.$inject=["$cookies","$mdDialog","toasty","sounds","api","Auth"],angular.module("app.tools").controller("UploadSoundDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_TAG",g.tag=angular.copy(l),g.tags=r,g.newTag=!1,g.tag||(g.tag={},g.title="TOOLS.NEW_TAG",g.newTag=!0),g.addNewTag=function(){g.errors=[],d.tag.save(g.tag).$promise.then(function(e){g.tags.unshift(e.toJSON()),o.success({title:"Tag properly created",msg:g.tag.name?g.tag.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.tag.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.tag.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTag=function(){g.errors=[],d.tag.update({id:g.tag.id},g.tag).$promise.then(function(e){var n=_.find(g.tags,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Tag properly saved!",msg:g.tag.name?g.tag.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.tag.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.tag.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTag=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The tag will be deleted.").ariaLabel("Delete Tag").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.tag.delete({id:g.tag.id}).$promise.then(function(){_.remove(g.tags,{id:g.tag.id}),o.success({title:"Tag properly deleted!",msg:(g.tag.name||"tag")+" has been deleted!"}),v(g.tag)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.tag.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.tag.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","tags","tag","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTagDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.tags=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="tags",f.listOrder="",f.listOrderAsc=null,f.selectedTags=[],f.query={fields:"createdAt,updatedAt,id,name,description,color",sort:"name,-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditTagDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/tags/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{tag:e,tags:f.tags.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("tag")+"?").htmlContent("<b>"+(e.name||"tag")+"</b> will be deleted.").ariaLabel("delete tag").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTags=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.tag.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Tags",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTag=function(e,n){i.show({controller:"CreateOrEditTagDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/tags/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{tag:n,tags:f.tags.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTag=y,f.exportSelectedTags=function(){var e=angular.copy(f.selectedTags);return f.selectedTags=[],e},f.deleteSelectedTags=function(e){var n=i.confirm().title("Are you sure want to delete the selected tags?").htmlContent("<b>"+f.selectedTags.length+" selected</b> will be deleted.").ariaLabel("delete Tags").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTags.forEach(function(e){y(e)}),f.selectedTags=[]})},f.deselectTags=function(){f.selectedTags=[]},f.selectAllTags=function(){f.selectedTags=f.tags.rows};var b=!0,A=1;function E(e){f.tags=e||{count:0,rows:[]}}function y(e){m.tag.delete({id:e.id}).$promise.then(function(){_.remove(f.tags.rows,{id:e.id}),f.tags.count-=1,f.tags.rows.length||f.getTags(),p.success({title:_.startCase("Tag")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtag"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtag",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTags())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","tags","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("TagsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_TEMPLATE",g.template=angular.copy(l),g.templates=r,g.newTemplate=!1,g.template||(g.template={},g.title="TOOLS.NEW_TEMPLATE",g.newTemplate=!0),g.addNewTemplate=function(){g.errors=[],d.template.save(g.template).$promise.then(function(e){g.templates.unshift(e.toJSON()),o.success({title:"Template properly created",msg:g.template.name?g.template.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.template.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.template.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTemplate=function(){g.errors=[],d.template.update({id:g.template.id},g.template).$promise.then(function(e){var n=_.find(g.templates,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Template properly saved!",msg:g.template.name?g.template.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.template.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.template.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTemplate=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The template will be deleted.").ariaLabel("Delete Template").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.template.delete({id:g.template.id}).$promise.then(function(){_.remove(g.templates,{id:g.template.id}),o.success({title:"Template properly deleted!",msg:(g.template.name||"template")+" has been deleted!"}),v(g.template)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.template.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.template.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","templates","template","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTemplateDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.templates=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="templates",f.listOrder="",f.listOrderAsc=null,f.selectedTemplates=[],f.query={fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditTemplateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/templates/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{template:e,templates:f.templates.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("template")+"?").htmlContent("<b>"+(e.name||"template")+"</b> will be deleted.").ariaLabel("delete template").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTemplates=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.template.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Templates",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTemplate=function(e,n){i.show({controller:"CreateOrEditTemplateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/templates/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{template:n,templates:f.templates.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTemplate=y,f.exportSelectedTemplates=function(){var e=angular.copy(f.selectedTemplates);return f.selectedTemplates=[],e},f.deleteSelectedTemplates=function(e){var n=i.confirm().title("Are you sure want to delete the selected templates?").htmlContent("<b>"+f.selectedTemplates.length+" selected</b> will be deleted.").ariaLabel("delete Templates").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTemplates.forEach(function(e){y(e)}),f.selectedTemplates=[]})},f.deselectTemplates=function(){f.selectedTemplates=[]},f.selectAllTemplates=function(){f.selectedTemplates=f.templates.rows};var b=!0,A=1;function E(e){f.templates=e||{count:0,rows:[]}}function y(e){m.template.delete({id:e.id}).$promise.then(function(){_.remove(f.templates.rows,{id:e.id}),f.templates.count-=1,f.templates.rows.length||f.getTemplates(),p.success({title:_.startCase("Template")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtemplate"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtemplate",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTemplates())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","templates","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("TemplatesController",e)}(),function(){"use strict";function e(t,a,i,e,n,s,o,r,l,d){var c=this;function m(e){t.hide(e)}c.currentUser=o.getCurrentUser(),c.trigger=angular.copy(n),c.triggers=angular.copy(e),c.setting=l,c.license=r,c.crudPermissions=d,c.newTrigger=!1,c.errors=[],c.trigger||(c.trigger={channel:"voice"},c.newTrigger=!0),c.addNewTrigger=function(){c.errors=[],s.trigger.save(c.trigger).$promise.then(function(e){c.triggers.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.TRIGGER_CREATED_SUCCESS_TITLE")}),m(c.triggers)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.trigger.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.saveTrigger=function(){c.errors=[],s.trigger.update({id:c.trigger.id},c.trigger).$promise.then(function(){c.triggers=_.map(c.triggers,function(e){return e.id===c.trigger.id?c.trigger:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.TRIGGER_SAVED_SUCCESS_TITLE")}),m(c.triggers)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.trigger.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.deleteTrigger=function(e){c.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_MESSAGE",{name:c.trigger.name})).ariaLabel("Delete trigger").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){s.trigger.delete({id:c.trigger.id}).$promise.then(function(){c.triggers=_.filter(c.triggers,function(e){return e.id!==c.trigger.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETED_SUCCESS_TITLE")}),m(c.triggers)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.trigger.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},c.closeDialog=m}e.$inject=["$mdDialog","$translate","toasty","triggers","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTriggerDialogController",e)}(),function(){"use strict";function e(e,a,n,i,t,s,o,r){var l=this;function d(){_.some(l.triggerActions.rows,["action","contactManager"])&&(l.lists||(r.isAdmin()?o.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.lists=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.lists=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.lists,{id:e.resourceId})}),a=null;a=[],l.triggerActions.rows.forEach(function(e){if("contactManager"===e.action){var n=_.find(l.lists,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(l.lists,{id:e.id});n.canSelect=!1,t.push(n)}}),l.lists=t})}else{var t=[],a=[];l.triggerActions.rows.forEach(function(e){if("contactManager"===e.action){var n=_.find(l.lists,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<l.lists.length;i++)_.some(a,{id:l.lists[i].id})&&(l.lists[i].canSelect=!1,t.push(l.lists[i]));l.lists=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(l.triggerActions.rows,["action","integration"])&&_(l.triggerActions.rows).map(function(e){return"integration"===e.action?e.data1:void 0}).compact().uniq().value().forEach(function(e){var n=e+"Accounts";if(!l[n]){var t="int"+_.startCase(e)+"Account";o[t.replace(/\s+/g,"")].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){l[n]=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+n.toUpperCase()+"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}),_.some(l.triggerActions.rows,function(e){return _.includes(["motionbar","browser"],e.action)})&&(l.templates||(r.isAdmin()?o.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){l.templates=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){l.templates=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1009}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.templates,{id:e.resourceId})}),a=null;a=[],l.triggerActions.rows.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(l.templates,{id:Number(e.data2)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(l.templates,{id:e.id});n.canSelect=!1,t.push(n)}}),l.templates=t})}else{var t=[],a=[];l.triggerActions.rows.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(l.templates,{id:Number(e.data2)});a.push(n)}});for(var i=0;i<l.templates.length;i++)_.some(a,{id:l.templates[i].id})&&(l.templates[i].canSelect=!1,t.push(l.templates[i]));l.templates=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(l.triggerActions.rows,["action","jscripty"])&&(l.projects||(r.isAdmin()?o.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.projects=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.projects=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1701}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.projects,{id:e.resourceId})}),a=null;a=[],l.triggerActions.rows.forEach(function(e){if("jscripty"===e.action){var n=_.find(l.projects,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(l.projects,{id:e.id});n.canSelect=!1,t.push(n)}}),l.projects=t})}else{var t=[],a=[];l.triggerActions.rows.forEach(function(e){if("jscripty"===e.action){var n=_.find(l.projects,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<l.projects.length;i++)_.some(a,{id:l.projects[i].id})&&(l.projects[i].canSelect=!1,t.push(l.projects[i]));l.projects=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})})))}function c(e){l.triggerActions=e||{count:0,rows:[]},d()}function m(){l.query.offset=(l.query.page-1)*l.query.limit,l.promise=o.trigger.getActions(l.query,c).$promise}function u(e,n){o.action.delete({id:e.id}).$promise.then(function(){m(),n&&s.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}l.currentUser=r.getCurrentUser(),l.trigger={},l.triggerActions={count:0,rows:[]},l.selectedTriggerActions=[],l.query={fields:"id,action,contact,data1,data2,data3,data4,data5,data6,data7,createdAt,updatedAt",limit:10,page:1},l.integrationTypes={zendesk:"Zendesk",salesforce:"Salesforce",sugarcrm:"SugarCRM",freshdesk:"Freshdesk",desk:"Desk",zoho:"Zoho",vtiger:"vTiger",dynamics365:"Dynamics365",servicenow:"ServiceNow",freshsales:"Freshsales"},l.motionBarOptions={0:"Popup",1:"CTI URL",2:"Windows App"},l.onInit=function(e,n){l.trigger=e,l.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},l.query.ActionId=l.trigger.id,l.query.id=l.trigger.id,m()},l.success=c,l.getTriggerActions=m,l.createOrEditTriggerAction=function(e,n){i.show({controller:"CreateOrEditActionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/actions/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:l.trigger,action:n,actions:l.triggerActions.rows,license:null,setting:null,crudPermissions:l.crudPermissions}}).then(function(e){e&&(l.triggerActions={count:e.length,rows:e},d())})},l.exportSelectedTriggerActions=function(){var e=angular.copy(l.selectedTriggerActions);return l.selectedTriggerActions=[],e},l.deleteConfirm=function(e,n){var t=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETE_TITLE")).ariaLabel("Delete action").targetEvent(n).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(t).then(function(){u(e,!0)})},l.deleteSelectedTriggerActions=function(e){var n=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.ACTIONS_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.ACTIONS_DELETE_MESSAGE",{total:l.selectedTriggerActions.length})).ariaLabel("Delete actions").targetEvent(e).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(n).then(function(){l.selectedTriggerActions.forEach(function(e){u(e)}),l.selectedTriggerActions=[],s.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTIONS_DELETED_SUCCESS_TITLE")})})}}e.$inject=["$scope","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerActionsController",e)}(),function(){"use strict";function e(n,t,a,i,e,s,o,r,l,d,c,m){var u=this;function p(){return new Promise(function(n,t){l.hasSectionsPermissions([1301,1302,1303,1304,1305,1306,1307,1308,1309,1310]).then(function(e){u.hasSectionPermissions=_.merge(u.hasSectionPermissions,e),n(u.hasSectionPermissions)}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SECTIONS_PERMISSIONS",msg:e.data?JSON.stringify(e.data):e.toString()}),t()})})}function g(){r.cmList.getCustomFields({id:u.action.data1,ListId:u.action.data1}).$promise.then(function(e){u.listFields=_.filter(e.rows,["type","text"]),u.listFields.forEach(function(e){e.columnName="cf_"+e.id})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LIST_CUSTOM_FIELDS",msg:e.data?JSON.stringify(e.data):e.toString()})})}function v(){l.isAdmin()?r.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u.templates=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u.templates=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1009}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.templates,{id:e.resourceId})}),a=null;a=[],u.actions.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(u.templates,{id:Number(e.data2)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.templates,{id:e.id});n.canSelect=!1,t.push(n)}}),u.templates=t})}else{var t=[],a=[];u.actions.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(u.templates,{id:Number(e.data2)});a.push(n)}});for(var i=0;i<u.templates.length;i++){_.some(a,{id:u.templates[i].id})&&(u.templates[i].canSelect=!1,t.push(u.templates[i]))}u.templates=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})})}function h(){switch(u.action.action){case"contactManager":u.lists||(l.isAdmin()?r.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.lists=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.lists,{id:e.resourceId})}),a=null;a=[],u.actions.forEach(function(e){if("contactManager"===e.action){var n=_.find(u.lists,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.lists,{id:e.id});n.canSelect=!1,t.push(n)}}),u.lists=t})}else{var t=[],a=[];u.actions.forEach(function(e){if("contactManager"===e.action){var n=_.find(u.lists,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<u.lists.length;i++)_.some(a,{id:u.lists[i].id})&&(u.lists[i].canSelect=!1,t.push(u.lists[i]));u.lists=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})),u.contactFields||r.cmContact.describe({}).$promise.then(function(e){u.contactFields=[],u.customFields=[];for(var n=_.values(e.toJSON()),t=0;t<n.length;t++)_.includes(u.allowedStandardFields,n[t].columnName)?u.contactFields.push(n[t]):_.startsWith(n[t].columnName,"cf_")&&"text"===n[t].custom.type&&u.customFields.push(n[t])}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE_CM_CONTACT",msg:e.data?JSON.stringify(e.data):e.toString()})}),u.action.data3=u.action.data3?u.action.data3.split(","):["phone"],"1"!==u.action.data2||u.action.data4||(u.action.data4="phone");break;case"jscripty":u.projects||(l.isAdmin()?r.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.projects=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.projects=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1701}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),a=null;a=[],u.actions.forEach(function(e){if("jscripty"===e.action){var n=_.find(u.projects,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.projects,{id:e.id});n.canSelect=!1,t.push(n)}}),u.projects=t})}else{var t=[],a=[];u.actions.forEach(function(e){if("jscripty"===e.action){var n=_.find(u.projects,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<u.projects.length;i++)_.some(a,{id:u.projects[i].id})&&(u.projects[i].canSelect=!1,t.push(u.projects[i]));u.projects=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"urlForward":u.action.data5||(u.action.data5=5)}}function f(){u.editAccount||(u.action.data2=void 0,u.action.data3=void 0),u.action.isIntegrationDisabled=!u.newAction&&!function(){switch(u.action.data1){case"zendesk":return u.hasSectionPermissions[1301];case"salesforce":return u.hasSectionPermissions[1302];case"sugarcrm":return u.hasSectionPermissions[1305];case"freshdesk":return u.hasSectionPermissions[1303];case"desk":return u.hasSectionPermissions[1306];case"zoho":return u.hasSectionPermissions[1307];case"vtiger":return u.hasSectionPermissions[1308];case"dynamics365":return u.hasSectionPermissions[1309];case"servicenow":return u.hasSectionPermissions[1310];case"freshsales":return u.hasSectionPermissions[1304]}}();var e="int"+_.capitalize(u.action.data1)+"Account";r[e].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u.accounts=e.rows||[],u.editAccount=!1}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.action.data1.toUpperCase()+"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){u.action.data3=u.action.data3?u.action.data3:void 0;var e="int"+_.capitalize(u.action.data1)+"Configuration";r[e].get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){u.configurations=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.action.data1.toUpperCase()+"CONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})})}function A(){var e=angular.copy(u.action);return _.isArray(e.data3)&&(e.data3=u.action.data3.join(",")),e}function E(e){t.hide(e)}u.currentUser=l.getCurrentUser(),void 0!==s&&"urlForward"===s.action&&s.data5&&(s.data5=parseInt(s.data5)),u.action=angular.copy(s),u.actions=angular.copy(e),u.setting=c,u.license=d,u.crudPermissions=m,u.newAction=!1,u.errors=[],u.trigger=angular.copy(o),u.action?function(){switch(u.editAccount=!0,u.action.action){case"integration":return new Promise(function(e){e(p())}).then(function(){return u.editAccount||(u.action.data2=void 0,u.action.data3=void 0,h()),f()}).then(function(){return b()});case"motionbar":case"browser":v()}u.editAccount=!1}():(u.action={},u.newAction=!0),u.action.ActionId=n.params.id||void 0,u.allowedStandardFields=["phone","mobile","fax"],u.addNewAction=function(){u.errors=[];var e=A();r.trigger.addAction({id:n.params.id},e).$promise.then(function(e){u.actions.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_CREATED_SUCCESS_TITLE")}),E(u.actions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"api.action.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},u.saveAction=function(){u.errors=[];var n=A();r.action.update({id:n.id},n).$promise.then(function(){u.actions=_.map(u.actions,function(e){return e.id===n.id?n:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_SAVED_SUCCESS_TITLE")}),E(u.actions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"api.action.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},u.deleteAction=function(e){u.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETE_TITLE")).ariaLabel("Delete action").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){r.action.delete({id:u.action.id}).$promise.then(function(){u.actions=_.filter(u.actions,function(e){return e.id!==u.action.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETED_SUCCESS_TITLE")}),E(u.actions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"api.action.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},u.onActionInit=function(){l.hasModulePermissions("Integrations").then(function(e){u.hasIntegrationsPermissions=e}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MODULE_PERMISSIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),u.action.action&&h()},u.onIntegrationInit=p,u.onSearchFieldsInit=function(){u.newAction||g()},u.onActionSelection=function(){u.newAction&&(u.action.data1=void 0,u.action.data2=void 0,u.action.data3=void 0,u.action.data4=void 0,u.action.data5="urlForward"===u.action.action?5:void 0,h())},u.onIntegrationSelection=f,u.onListSelection=function(){g()},u.onTypeSelection=function(){"0"!==u.action.data1||u.templates?(u.action.data2=void 0,u.action.data4="1"===u.action.data1?0:void 0):v()},u.onAutocreateSelection=function(){"0"===u.action.data2&&(u.action.data4=void 0);u.action.data4||"1"!==u.action.data2||(u.action.data4="phone")},u.onIntegrationAccountSelection=b,u.closeDialog=E,u.onActionLocationChange=function(){u.editAccount||(u.action.data5=void 0,u.action.data6=void 0)}}e.$inject=["$state","$mdDialog","$translate","toasty","actions","action","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditActionDialogController",e)}(),function(){"use strict";function e(e,l,a,n,i,t,d,c,m){var u=this;function s(){var o,r;"voice"===u.trigger.channel?(_.some(u.allConditions.rows,["field","queue"])&&(u.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,m.isAdmin()?c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){u.queues=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(c.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];u.allConditions.rows.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),u.queues=t}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.allConditions.rows,["field","routeId"])&&(u.outboundRoutes||(m.isAdmin()?c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.outboundRoutes,{id:e.resourceId})}),a=null;a=[],u.triggerAllConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),u.outboundRoutes=t})}else{var t=[],a=[];u.allConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<u.outboundRoutes.length;i++)_.some(a,{id:u.outboundRoutes[i].id})&&(u.outboundRoutes[i].canSelect=!1,t.push(u.outboundRoutes[i]));u.outboundRoutes=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.allConditions.rows,["field","agent"])&&(u.agents||(m.isAdmin()?c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.agents,{id:e.resourceId})}),a=null;a=[],u.triggerAllConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),u.agents=t})}else{var t=[],a=[];u.allConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}});for(var i=0;i<u.agents.length;i++)_.some(a,{id:u.agents[i].id})&&(u.agents[i].canSelect=!1,t.push(u.agents[i]));u.agents=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})})))):("mail"===u.trigger.channel&&c.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.mailSubstatuses=e.rows||[]}).catch(function(){d.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})}),function(){var e,s=u.trigger.channel+("chat"===u.trigger.channel?"Websites":"Accounts"),n=u.trigger.channel+("chat"===u.trigger.channel?"Website":"Account");switch(u.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}m.isAdmin()?c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u[s],{id:e.resourceId})}),a=null;a=[],u.allConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u[s],{id:e.id});n.canSelect=!1,t.push(n)}}),u[s]=t})}else{var t=[],a=[];u.allConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}});for(var i=0;i<u[s].length;i++)_.some(a,{id:u[s][i].id})&&(u[s][i].canSelect=!1,t.push(u[s][i]));u[s]=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}())}function o(e){u.allConditions=e||{count:0,rows:[]},s()}function r(){u.query.offset=(u.query.page-1)*u.query.limit,u.promise=c.trigger.getAllConditions(u.query,o).$promise}function p(e,n){c.condition.delete({id:e.id}).$promise.then(function(){r(),n&&d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}u.currentUser=m.getCurrentUser(),u.trigger={},u.allConditions={count:0,rows:[]},u.selectedAllConditions=[],u.query={fields:"id,field,operator,value,createdAt,updatedAt",limit:10,page:1},u.fields={queue:"Queue",lastevent:"Call_Status",routeId:"OutboundRoute",agent:"Agent",account:"Account",interaction:"Interaction",message:"Message",mailSubstatus:"Mail_Substatus",offlineMessage:"Offline_Message"},u.callStatuses={abandoned:"Abandon",timeout:"Timeout",complete:"Hangup",rejected:"Reject",called:"Ring",connect:"Answer",nosuchnumber:"NoSuchNumber",busy:"Busy",noanswer:"NoAnswer",congestion:"Congestion",agentreject:"AgentReject",amd:"AMD"},u.messageStatuses={in:"Incoming",out:"Outgoing",accept:"Accepted",reject:"Rejected"},u.onInit=function(e,n){u.trigger=e,u.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},u.query.TriggerAllId=u.trigger.id,u.query.id=u.trigger.id,r()},u.success=o,u.getAllConditions=r,u.createOrEditAllCondition=function(e,n){i.show({controller:"CreateOrEditAllConditionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/allconditions/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:u.trigger,allCondition:n,allConditions:u.allConditions.rows,license:null,setting:null,crudPermissions:u.crudPermissions}}).then(function(e){e&&(u.allConditions={count:e.length,rows:e},s())})},u.exportSelectedAllConditions=function(){var e=angular.copy(u.selectedAllConditions);return u.selectedAllConditions=[],e},u.deleteConfirm=function(e,n){var t=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").targetEvent(n).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(t).then(function(){p(e,!0)})},u.deleteSelectedAllConditions=function(e){var n=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_MESSAGE",{total:u.selectedAllConditions.length})).ariaLabel("Delete conditions").targetEvent(e).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(n).then(function(){u.selectedAllConditions.forEach(function(e){p(e)}),u.selectedAllConditions=[],d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETED_SUCCESS_TITLE")})})}}e.$inject=["$scope","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerAllConditionsController",e)}(),function(){"use strict";function e(e,t,l,a,i,n,s,o,d,c,r,m,u){var p=this;function g(){switch(p.allCondition.field){case"queue":p.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,c.isAdmin()?d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){p.queues=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(d.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];p.allConditions.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),p.queues=t}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"routeId":p.outboundRoutes||(c.isAdmin()?d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.outboundRoutes,{id:e.resourceId})}),a=null;a=[],p.allConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),p.outboundRoutes=t})}else{var t=[],a=[];p.allConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.outboundRoutes.length;i++)_.some(a,{id:p.outboundRoutes[i].id})&&(p.outboundRoutes[i].canSelect=!1,t.push(p.outboundRoutes[i]));p.outboundRoutes=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"agent":p.agents||(c.isAdmin()?d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.agents,{id:e.resourceId})}),a=null;a=[],p.allConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),p.agents=t})}else{var t=[],a=[];p.allConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}});for(var i=0;i<p.agents.length;i++)_.some(a,{id:p.agents[i].id})&&(p.agents[i].canSelect=!1,t.push(p.agents[i]));p.agents=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"account":!function(){var e,n=p.trigger.channel+("chat"===p.trigger.channel?"Website":"Account");switch(p.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}c.isAdmin()?d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.accounts,{id:e.resourceId})}),a=null;a=[],p.allConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.accounts,{id:e.id});n.canSelect=!1,t.push(n)}}),p.accounts=t})}else{var t=[],a=[];p.allConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.accounts.length;i++)_.some(a,{id:p.accounts[i].id})&&(p.accounts[i].canSelect=!1,t.push(p.accounts[i]));p.accounts=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}();break;case"mailSubstatus":d.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){p.mailSubstatuses=e.rows||[]}).catch(function(){i.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})})}var o,r}function v(e){t.hide(e)}p.currentUser=c.getCurrentUser(),p.allCondition=angular.copy(s),p.allConditions=angular.copy(n),p.setting=m,p.license=r,p.crudPermissions=u,p.hasModulePermissions={},p.newAllCondition=!1,p.errors=[],p.trigger=angular.copy(o),p.allCondition?g():(p.allCondition={operator:"equals"},p.newAllCondition=!0),p.allCondition.TriggerAllId=e.params.id||void 0,p.callStatuses=[{name:"Abandon",value:"abandoned"},{name:"Timeout",value:"timeout"},{name:"Hangup",value:"complete"},{name:"Reject",value:"rejected"},{name:"Ring",value:"called"},{name:"Answer",value:"connect"},{name:"NoSuchNumber",value:"nosuchnumber"},{name:"Busy",value:"busy"},{name:"NoAnswer",value:"noanswer"},{name:"Congestion",value:"congestion"},{name:"AgentReject",value:"agentreject"},{name:"AMD",value:"amd"}],p.onFieldSelection=function(){p.allCondition.value=void 0,g()},p.addNewAllCondition=function(){p.errors=[],d.trigger.addAllCondition({id:e.params.id},p.allCondition).$promise.then(function(e){p.allConditions.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_CREATED_SUCCESS_TITLE")}),v(p.allConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.saveAllCondition=function(){p.errors=[],d.condition.update({id:p.allCondition.id},p.allCondition).$promise.then(function(){p.allConditions=_.map(p.allConditions,function(e){return e.id===p.allCondition.id?p.allCondition:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_SAVED_SUCCESS_TITLE")}),v(p.allConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.deleteAllCondition=function(e){p.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){d.condition.delete({id:p.allCondition.id}).$promise.then(function(){p.allConditions=_.filter(p.allConditions,function(e){return e.id!==p.allCondition.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")}),v(p.allConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},p.closeDialog=v}e.$inject=["$state","$mdDialog","$q","$translate","toasty","allConditions","allCondition","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditAllConditionDialogController",e)}(),function(){"use strict";function e(e,l,a,n,i,t,d,c,m){var u=this;function s(){var o,r;"voice"===u.trigger.channel?(_.some(u.anyConditions.rows,["field","queue"])&&(u.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,m.isAdmin()?c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){u.queues=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(c.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),u.queues=t}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.anyConditions.rows,["field","routeId"])&&(u.outboundRoutes||(m.isAdmin()?c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.outboundRoutes,{id:e.resourceId})}),a=null;a=[],u.anyConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),u.outboundRoutes=t})}else{var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<u.outboundRoutes.length;i++)_.some(a,{id:u.outboundRoutes[i].id})&&(u.outboundRoutes[i].canSelect=!1,t.push(u.outboundRoutes[i]));u.outboundRoutes=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.anyConditions.rows,["field","agent"])&&(u.agents||(m.isAdmin()?c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.agents,{id:e.resourceId})}),a=null;a=[],u.anyConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),u.agents=t})}else{var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}});for(var i=0;i<u.agents.length;i++)_.some(a,{id:u.agents[i].id})&&(u.agents[i].canSelect=!1,t.push(u.agents[i]));u.agents=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})})))):("mail"===u.trigger.channel&&c.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.mailSubstatuses=e.rows||[]}).catch(function(){d.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})}),function(){var e,s=u.trigger.channel+("chat"===u.trigger.channel?"Websites":"Accounts"),n=u.trigger.channel+("chat"===u.trigger.channel?"Website":"Account");switch(u.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}m.isAdmin()?c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u[s],{id:e.resourceId})}),a=null;a=[],u.anyConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u[s],{id:e.id});n.canSelect=!1,t.push(n)}}),u[s]=t})}else{var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}});for(var i=0;i<u[s].length;i++)_.some(a,{id:u[s][i].id})&&(u[s][i].canSelect=!1,t.push(u[s][i]));u[s]=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}())}function o(e){u.anyConditions=e||{count:0,rows:[]},s()}function r(){u.query.offset=(u.query.page-1)*u.query.limit,u.promise=c.trigger.getAnyConditions(u.query,o).$promise}function p(e,n){c.condition.delete({id:e.id}).$promise.then(function(){r(),n&&d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}u.currentUser=m.getCurrentUser(),u.trigger={},u.anyConditions={count:0,rows:[]},u.selectedAnyConditions=[],u.query={fields:"id,field,operator,value,createdAt,updatedAt",limit:10,page:1},u.fields={queue:"Queue",lastevent:"Call_Status",routeId:"OutboundRoute",agent:"Agent",account:"Account",interaction:"Interaction",message:"Message",mailSubstatus:"Mail_Substatus",offlineMessage:"Offline_Message"},u.callStatuses={abandoned:"Abandon",timeout:"Timeout",complete:"Hangup",rejected:"Reject",called:"Ring",connect:"Answer",nosuchnumber:"NoSuchNumber",busy:"Busy",noanswer:"NoAnswer",congestion:"Congestion",agentreject:"AgentReject",amd:"AMD"},u.messageStatuses={in:"Incoming",out:"Outgoing",accept:"Accepted",reject:"Rejected"},u.onInit=function(e,n){u.trigger=e,u.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},u.query.TriggerAnyId=u.trigger.id,u.query.id=u.trigger.id,r()},u.success=o,u.getAnyConditions=r,u.createOrEditAnyCondition=function(e,n){i.show({controller:"CreateOrEditAnyConditionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/anyconditions/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:u.trigger,anyCondition:n,anyConditions:u.anyConditions.rows,license:null,setting:null,crudPermissions:u.crudPermissions}}).then(function(e){e&&(u.anyConditions={count:e.length,rows:e},s())})},u.exportSelectedAnyConditions=function(){var e=angular.copy(u.selectedAnyConditions);return u.selectedAnyConditions=[],e},u.deleteConfirm=function(e,n){var t=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").targetEvent(n).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(t).then(function(){p(e,!0)})},u.deleteAnyCondition=p,u.deleteSelectedAnyConditions=function(e){var n=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_MESSAGE",{total:u.selectedAnyConditions.length})).ariaLabel("Delete conditions").targetEvent(e).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(n).then(function(){u.selectedAnyConditions.forEach(function(e){p(e)}),u.selectedAnyConditions=[],d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETED_SUCCESS_TITLE")})})}}e.$inject=["$scope","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerAnyConditionsController",e)}(),function(){"use strict";function e(e,t,l,a,i,n,s,o,d,c,r,m,u){var p=this;function g(){switch(p.anyCondition.field){case"queue":p.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,c.isAdmin()?d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){p.queues=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(d.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];p.anyConditions.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),p.queues=t}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"routeId":p.outboundRoutes||(c.isAdmin()?d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.outboundRoutes,{id:e.resourceId})}),a=null;a=[],p.anyConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),p.outboundRoutes=t})}else{var t=[],a=[];p.anyConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.outboundRoutes.length;i++)_.some(a,{id:p.outboundRoutes[i].id})&&(p.outboundRoutes[i].canSelect=!1,t.push(p.outboundRoutes[i]));p.outboundRoutes=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"agent":p.agents||(c.isAdmin()?d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.agents,{id:e.resourceId})}),a=null;a=[],p.anyConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),p.agents=t})}else{var t=[],a=[];p.anyConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}});for(var i=0;i<p.agents.length;i++)_.some(a,{id:p.agents[i].id})&&(p.agents[i].canSelect=!1,t.push(p.agents[i]));p.agents=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"account":!function(){var e,n=p.trigger.channel+("chat"===p.trigger.channel?"Website":"Account");switch(p.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}c.isAdmin()?d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.accounts,{id:e.resourceId})}),a=null;a=[],p.anyConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.accounts,{id:e.id});n.canSelect=!1,t.push(n)}}),p.accounts=t})}else{var t=[],a=[];p.anyConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.accounts.length;i++)_.some(a,{id:p.accounts[i].id})&&(p.accounts[i].canSelect=!1,t.push(p.accounts[i]));p.accounts=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}();break;case"mailSubstatus":d.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){p.mailSubstatuses=e.rows||[]}).catch(function(){i.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})})}var o,r}function v(e){t.hide(e)}p.currentUser=c.getCurrentUser(),p.anyCondition=angular.copy(s),p.anyConditions=angular.copy(n),p.setting=m,p.license=r,p.crudPermissions=u,p.hasModulePermissions={},p.newAnyCondition=!1,p.errors=[],p.trigger=angular.copy(o),p.anyCondition?g():(p.anyCondition={operator:"equals"},p.newAnyCondition=!0),p.anyCondition.TriggerAnyId=e.params.id||void 0,p.callStatuses=[{name:"Abandon",value:"abandoned"},{name:"Timeout",value:"timeout"},{name:"Hangup",value:"complete"},{name:"Reject",value:"rejected"},{name:"Ring",value:"called"},{name:"Answer",value:"connect"},{name:"NoSuchNumber",value:"nosuchnumber"},{name:"Busy",value:"busy"},{name:"NoAnswer",value:"noanswer"},{name:"Congestion",value:"congestion"},{name:"AgentReject",value:"agentreject"},{name:"AMD",value:"amd"}],p.onFieldSelection=function(){p.anyCondition.value=void 0,g()},p.addNewAnyCondition=function(){p.errors=[],d.trigger.addAnyCondition({id:e.params.id},p.anyCondition).$promise.then(function(e){p.anyConditions.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_CREATED_SUCCESS_TITLE")}),v(p.anyConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.saveAnyCondition=function(){p.errors=[],d.condition.update({id:p.anyCondition.id},p.anyCondition).$promise.then(function(){p.anyConditions=_.map(p.anyConditions,function(e){return e.id===p.anyCondition.id?p.anyCondition:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_SAVED_SUCCESS_TITLE")}),v(p.anyConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.deleteAnyCondition=function(e){p.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){d.condition.delete({id:p.anyCondition.id}).$promise.then(function(){p.anyConditions=_.filter(p.anyConditions,function(e){return e.id!==p.allCondition.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")}),v(p.anyConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},p.closeDialog=v}e.$inject=["$state","$mdDialog","$q","$translate","toasty","anyConditions","anyCondition","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditAnyConditionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;d.currentUser=o.getCurrentUser(),d.license=t,d.setting=a,d.trigger=r||e.params.trigger||{},d.selectedTab=e.params.tab||0,e.params.crudPermissions?d.crudPermissions=e.params.crudPermissions:(d.userProfileSection=l&&1==l.count?l.rows[0]:null,d.crudPermissions=o.parseCrudPermissions(d.userProfileSection?d.userProfileSection.crudPermissions:null)),d.gotoTriggers=function(){e.go("app.tools.triggers",{},{reload:"app.tools.triggers"})},d.saveTrigger=function(){i.trigger.update({id:d.trigger.id},d.trigger).$promise.then(function(){s.success({title:n.instant("TOOLS.NOTIFICATIONS.TRIGGER_SAVED_SUCCESS_TITLE")})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$translate","license","setting","api","toasty","Auth","trigger","userProfileSection"],angular.module("app.tools").controller("TriggerController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){n.go("app.tools.triggers.edit",{id:e.id,trigger:e,crudPermissions:g.crudPermissions})}function h(e){g.triggers=e||{count:0,rows:[]}}function f(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.trigger.get(g.query,h).$promise:(g.query.id=g.userProfile.id,g.query.section="Triggers",g.promise=d.userProfile.getResources(g.query,h).$promise)}function b(e,n){d.trigger.delete({id:e.id}).$promise.then(function(){f(),n&&c.success({title:s.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtrigger"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.triggers=o||{count:0,rows:[]},g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedTriggers=[],g.query={fields:"id,name,channel,status,description,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},g.goToEditState=v,g.createOrEditTrigger=function(e,n){if(g.crudPermissions.readOnly||g.crudPermissions.canDelete&&!g.crudPermissions.canEdit)return void v(n);a.show({controller:"CreateOrEditTriggerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:n,triggers:g.triggers.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions}}).then(function(e){e&&(g.triggers={count:e.length,rows:e})})},g.success=h,g.getTriggers=f,g.deleteconfirm=function(e,n){var t=a.confirm().title(s.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_TITLE")).content(s.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_MESSAGE",{name:e.name})).ariaLabel("Delete trigger").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){b(e,!0)})},g.exportSelectedTriggers=function(){var e=angular.copy(g.selectedTriggers);return g.selectedTriggers=[],e},g.deleteSelectedTriggers=function(e){var n=a.confirm().title(s.instant("TOOLS.NOTIFICATIONS.TRIGGERS_DELETE_TITLE")).content(s.instant("TOOLS.NOTIFICATIONS.TRIGGERS_DELETE_MESSAGE",{total:g.selectedTriggers.length})).ariaLabel("Delete triggers").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedTriggers.forEach(function(e){b(e)}),g.selectedTriggers=[],c.success({title:s.instant("TOOLS.NOTIFICATIONS.TRIGGERS_DELETED_SUCCESS_TITLE")})})},g.deselectTriggers=function(){g.selectedTriggers=[]},g.selectAllTriggers=function(){g.selectedTriggers=g.triggers.rows};var A=!0,E=1;e.$watch("vm.query.filter",function(e,n){A?i(function(){A=!1}):(n||(E=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=E),f())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","triggers","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.tools").controller("TriggersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_TRUNK",g.trunk=angular.copy(l),g.trunks=r,g.newTrunk=!1,g.trunk||(g.trunk={active:!0,type:"friend",dtmfmode:"rfc2833",qualify:"yes",t38pt_udptl:"no"},g.title="TOOLS.NEW_TRUNK",g.newTrunk=!0),g.addNewTrunk=function(){g.errors=[],d.trunk.save(g.trunk).$promise.then(function(e){g.trunks.unshift(e.toJSON()),o.success({title:"Trunk properly created",msg:g.trunk.name?g.trunk.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTrunk=function(){g.errors=[],d.trunk.update({id:g.trunk.id},g.trunk).$promise.then(function(e){var n=_.find(g.trunks,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Trunk properly saved!",msg:g.trunk.name?g.trunk.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTrunk=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The trunk will be deleted.").ariaLabel("Delete Trunk").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.trunk.delete({id:g.trunk.id}).$promise.then(function(){_.remove(g.trunks,{id:g.trunk.id}),o.success({title:"Trunk properly deleted!",msg:(g.trunk.name||"trunk")+" has been deleted!"}),v(g.trunk)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","trunks","trunk","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTrunkDialogController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newTrunk=!0,r.trunk=angular.copy(i),r.trunks=s,r.title=o.instant("TOOLS.CLONE_TRUNK"),i&&i.name&&(r.title+=": "+i.name),r.cloneTrunk=function(){return e.trunk.clone({id:i.id},r.trunk).$promise.then(function(e){r.trunks.unshift(e.toJSON()),a.success({title:"Trunk properly cloned",msg:r.trunk.name?r.trunk.name+" has been cloned!":""}),t.go("app.tools.trunks.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","trunk","trunks","$translate"],angular.module("app.tools").controller("TrunkcloneController",e)}(),function(){"use strict";function e(t,e,a,i,s,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.trunk=c||t.params.trunk||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.trunks",{}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.trunks",{})}},u.clonedialog=function(e,n){a.show({controller:"TrunkcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/edit/clone/clone.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{trunk:e,trunks:u.trunks?u.trunks.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoTrunks=function(){t.go("app.tools.trunks",{},{reload:"app.tools.trunks"})},u.saveTrunk=function(){r.trunk.update({id:u.trunk.id},u.trunk).$promise.then(function(){l.success({title:"Trunk updated!",msg:u.trunk.name?u.trunk.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunk",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),t=null;if(u.trunk&&(t=_.find(u.contexts,{name:u.trunk.context})),t&&!_.some(n,["id",t.id])){var a=_.find(u.contexts,{id:t.id});a.canSelect=!1,n.push(a)}u.contexts=n}):r.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){u.contexts=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","trunk","userProfileSection"],angular.module("app.tools").controller("TrunkController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.trunks=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="trunks",f.listOrder="",f.listOrderAsc=null,f.selectedTrunks=[],f.query={fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Friend",value:"'friend'"},{option:"User",value:"'user'"},{option:"Peer",value:"'peer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydtmfmode=_.keyBy([{option:"rfc2833",value:"'rfc2833'"},{option:"info",value:"'info'"},{option:"shortinfo",value:"'shortinfo'"},{option:"inband",value:"'inband'"},{option:"auto",value:"'auto'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayqualify=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayallow=_.keyBy([{option:"ulaw",value:"'ulaw'"},{option:"alaw",value:"'alaw'"},{option:"gsm",value:"'gsm'"},{option:"g723",value:"'g723'"},{option:"g726",value:"'g726'"},{option:"g722",value:"'g722'"},{option:"g729",value:"'g729'"},{option:"ilbc",value:"'ilbc'"},{option:"opus",value:"'opus'"},{option:"h264",value:"'h264'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayinsecure=_.keyBy([{option:"port",value:"'port'"},{option:"invite",value:"'invite'"},{option:"very",value:"'very'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydirectmedia=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"nonat",value:"'nonat'"},{option:"update",value:"'update'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraycallcounter=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayusereqphone=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytrustrpid=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysendrpid=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"pai",value:"'pai'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayencryption=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"},{option:"tls",value:"'tls'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.tools.trunks.edit",{id:e.id,trunk:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"TrunkcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{trunk:e,trunks:f.trunks?f.trunks.rows:[],crudPermissions:f.crudPermissions}})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.trunks",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.trunks",{})}},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("trunk")+"?").htmlContent("<b>"+(e.name||"trunk")+"</b> will be deleted.").ariaLabel("delete trunk").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTrunks=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.trunk.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Trunks",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTrunk=function(e,n){i.show({controller:"CreateOrEditTrunkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{trunk:n,trunks:f.trunks.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTrunk=y,f.exportSelectedTrunks=function(){var e=angular.copy(f.selectedTrunks);return f.selectedTrunks=[],e},f.deleteSelectedTrunks=function(e){var n=i.confirm().title("Are you sure want to delete the selected trunks?").htmlContent("<b>"+f.selectedTrunks.length+" selected</b> will be deleted.").ariaLabel("delete Trunks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTrunks.forEach(function(e){y(e)}),f.selectedTrunks=[]})},f.deselectTrunks=function(){f.selectedTrunks=[]},f.selectAllTrunks=function(){f.selectedTrunks=f.trunks.rows};var b=!0,A=1;function E(e){f.trunks=e||{count:0,rows:[]}}function y(e){m.trunk.delete({id:e.id}).$promise.then(function(){_.remove(f.trunks.rows,{id:e.id}),f.trunks.count-=1,f.trunks.rows.length||f.getTrunks(),p.success({title:_.startCase("Trunk")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtrunk"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtrunk",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTrunks())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","trunks","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("TrunksController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_VARIABLE",g.variable=angular.copy(l),g.variables=r,g.newVariable=!1,g.variable||(g.variable={},g.title="TOOLS.NEW_VARIABLE",g.newVariable=!0),g.addNewVariable=function(){g.errors=[],d.variable.save(g.variable).$promise.then(function(e){g.variables.unshift(e.toJSON()),o.success({title:"Variable properly created",msg:g.variable.name?g.variable.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.variable.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVariable=function(){g.errors=[],d.variable.update({id:g.variable.id},g.variable).$promise.then(function(e){var n=_.find(g.variables,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Variable properly saved!",msg:g.variable.name?g.variable.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.variable.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVariable=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The variable will be deleted.").ariaLabel("Delete Variable").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.variable.delete({id:g.variable.id}).$promise.then(function(){_.remove(g.variables,{id:g.variable.id}),o.success({title:"Variable properly deleted!",msg:(g.variable.name||"variable")+" has been deleted!"}),v(g.variable)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.variable.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","variables","variable","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditVariableDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.variables=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="variables",f.listOrder="",f.listOrderAsc=null,f.selectedVariables=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{variable:e,variables:f.variables.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("variable")+"?").htmlContent("<b>"+(e.name||"variable")+"</b> will be deleted.").ariaLabel("delete variable").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVariables=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.variable.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Variables",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVariable=function(e,n){i.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{variable:n,variables:f.variables.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteVariable=y,f.exportSelectedVariables=function(){var e=angular.copy(f.selectedVariables);return f.selectedVariables=[],e},f.deleteSelectedVariables=function(e){var n=i.confirm().title("Are you sure want to delete the selected variables?").htmlContent("<b>"+f.selectedVariables.length+" selected</b> will be deleted.").ariaLabel("delete Variables").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVariables.forEach(function(e){y(e)}),f.selectedVariables=[]})},f.deselectVariables=function(){f.selectedVariables=[]},f.selectAllVariables=function(){f.selectedVariables=f.variables.rows};var b=!0,A=1;function E(e){f.variables=e||{count:0,rows:[]}}function y(e){m.variable.delete({id:e.id}).$promise.then(function(){_.remove(f.variables.rows,{id:e.id}),f.variables.count-=1,f.variables.rows.length||f.getVariables(),p.success({title:_.startCase("Variable")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvariable"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvariable",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVariables())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","variables","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("VariablesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VIDEO.EDIT_SCREENRECORDING",g.screenRecording=angular.copy(l),g.screenRecordings=r,g.newscreenRecording=!1,g.screenRecording||(g.screenRecording={},g.title="VIDEO.NEW_SCREENRECORDING",g.newscreenRecording=!0),g.addNewscreenRecording=function(){g.errors=[],d.screenRecording.save(g.screenRecording).$promise.then(function(e){g.screenRecordings.unshift(e.toJSON()),o.success({title:"screenRecording properly created",msg:g.screenRecording.name?g.screenRecording.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.screenRecording.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savescreenRecording=function(){g.errors=[],d.screenRecording.update({id:g.screenRecording.id},g.screenRecording).$promise.then(function(e){var n=_.find(g.screenRecordings,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"screenRecording properly saved!",msg:g.screenRecording.name?g.screenRecording.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.screenRecording.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletescreenRecording=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The screenRecording will be deleted.").ariaLabel("Delete screenRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.screenRecording.delete({id:g.screenRecording.id}).$promise.then(function(){_.remove(g.screenRecordings,{id:g.screenRecording.id}),o.success({title:"screenRecording properly deleted!",msg:(g.screenRecording.name||"screenRecording")+" has been deleted!"}),v(g.screenRecording)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.screenRecording.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,d.user.get({fields:"id,name,fullname",sort:"name",nolimit:"true"}).$promise.then(function(e){g.users=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","screenRecordings","screenRecording","api","Auth","license","setting","crudPermissions"],angular.module("app.video").controller("CreateOrEditscreenRecordingDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c,m=this;if(m.loading=!1,m.recording=Object.assign({},i),m.route="screenRecording",m.element=l,m.actionOptions=Object.assign({},s),m.path=r,m.label=o,m.app="video",m.model="screenRecording",console.log("TCL: vm.path",m.path),console.log("TCL: vm.recording[vm.path]",m.recording[m.path]),m.filename=-1<m.recording[m.path].indexOf("/")?m.recording[m.path].substring(m.recording[m.path].lastIndexOf("/")+1):-1<m.recording[m.path].indexOf("\\")?m.recording[m.path].substring(m.recording[m.path].lastIndexOf("\\")+1):m.recording[m.path],m.format=!1,_.isNil(m.recording.format)&&(m.recording.format=m.filename.slice(m.filename.lastIndexOf("."))),(".wav"===m.recording.format&&"audio"===m.element||".mp4"===m.recording.format&&"video"===m.element)&&(m.format=!0),m.found=!0,m.format&&(c=d.defer(),a.screenRecording.download({id:m.recording.id,path:String(m.path)}).$promise.then(function(e){m.format=!0,m.found=!0,c.resolve()}).catch(function(e){console.log("err"),m.format=!1,m.found=!1,c.resolve()}),c.promise),!_.isNil(s.properties)&&s.properties){if(m.properties=Object.assign({},i),Object.keys(i).forEach(function(e){String(e[0].toUpperCase())===String(e[0])&&delete m.properties[e]}),m.propertiesDefault={},!_.isNil(s.propertiesList)&&0<s.propertiesList.length){m.propertiesDefault=Object.assign({},i);var u=s.propertiesList,p=Object.keys(i),g=!0;p.forEach(function(n){g=!0,u.forEach(function(e){String(n)===String(e)&&(g=!1)}),g&&delete m.propertiesDefault[n]}),m.properties=m.propertiesDefault}if(!_.isNil(s.extraData)&&0<s.extraData.length){m.propertiesExtra={};for(var v=s.extraData,h=0;h<v.length;h++)for(var f=v[h].values,b=v[h].model,A=0;A<f.length;A++)m.propertiesExtra[f[A].text]=i[b][f[A].key];m.properties=Object.assign({},m.propertiesDefault,m.propertiesExtra)}}m.closeDialog=function(){n.hide()}}e.$inject=["$scope","$mdDialog","toasty","api","recording","actionOptions","label","varPath","elementTag","$q"],angular.module("app.video").controller("screenRecordingplayController",e)}(),function(){"use strict";function e(e,n,t,a,r,l,i,o,s,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.screenRecordings=s||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="screenRecordings",f.listOrder="",f.listOrderAsc=null,f.selectedScreenRecordings=[],f.query={fields:"createdAt,updatedAt,id,interactionid,channel,format,value,rating,UserId,duration,startedAt,closedAt",createdAt:"@msUtils.firstLastDayMonth()",includeAll:"true",sort:"-updatedAt",limit:10,page:1},f.query.createdAt=u.firstLastDayMonth(),f.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE_RANGE"}],f.playrecording=function(e,n,t,a,i){var s={route:"screenRecording",name:"screenRecordings",model:"screenRecording",singular:"screenRecording"},a=String(a),o=String(t);console.log("TCL:  path",String(t)),r.show({controller:"screenRecordingplayController",controllerAs:"vm",templateUrl:"app/main/apps/video/views/screenRecordings/partialViews/play.html",parent:angular.element(l.body),targetEvent:n,clickOutsideToClose:!0,locals:{recording:e,recordings:f.screenRecordings.rows,license:f.license,setting:null,item:s,actionOptions:{upperTitle:!1,lowerTitle:!0,properties:!0,propertiesIcon:"icon-video",propertiesList:["format","interactionid","duration","startedAt","closedAt","createdAt"],extraData:[{model:"User",values:[{key:"name",text:"agentname"}]}]},label:a,varPath:o,elementTag:String(i)}})},f.downloadfile2=function(e,n){var t=!1,a=_.isNil(e.format)?e.value.substring(e.value.lastIndexOf(".")):e.format;t=".mp4"===a;var s=-1<e.value.lastIndexOf("/")?e.value.substring(e.value.lastIndexOf("/")+1):-1<e.value.lastIndexOf("\\")?e.value.substring(e.value.lastIndexOf("\\")+1):e.value;return m.screenRecording.download({id:e.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"404"===String(e.status)&&!1===t?p.info({title:o.instant("VIDEO.CANT_DOWNLOAD_THIS_FILE"),msg:o.instant("VIDEO.WRONG_EXTENSION")}):"404"===String(e.status)?p.info({title:o.instant("VIDEO.CANT_DOWNLOAD_THIS_FILE"),msg:o.instant("VIDEO.FILE_NOT_FOUND")}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=r.confirm().title("Are you sure want to delete the "+_.startCase("screenRecording")+"?").htmlContent("<b>"+(e.name||"screenRecording")+"</b> will be deleted.").ariaLabel("delete screenRecording").targetEvent(n).ok("OK").cancel("CANCEL");r.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getScreenRecordings=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.screenRecording.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ScreenRecordings",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditscreenRecording=function(e,n){r.show({controller:"CreateOrEditscreenRecordingDialogController",controllerAs:"vm",templateUrl:"app/main/apps/video/views/screenRecordings/create/dialog.html",parent:angular.element(l.body),targetEvent:e,clickOutsideToClose:!0,locals:{screenRecording:n,screenRecordings:f.screenRecordings.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletescreenRecording=y,f.exportSelectedScreenRecordings=function(){var e=angular.copy(f.selectedScreenRecordings);return f.selectedScreenRecordings=[],e},f.deleteSelectedScreenRecordings=function(e){var n=r.confirm().title("Are you sure want to delete the selected screenRecordings?").htmlContent("<b>"+f.selectedScreenRecordings.length+" selected</b> will be deleted.").ariaLabel("delete screenRecordings").targetEvent(e).ok("OK").cancel("CANCEL");r.show(n).then(function(){f.selectedScreenRecordings.forEach(function(e){y(e)}),f.selectedScreenRecordings=[]})},f.deselectScreenRecordings=function(){f.selectedScreenRecordings=[]},f.selectAllScreenRecordings=function(){f.selectedScreenRecordings=f.screenRecordings.rows},f.convertDuration=function(e){var n=Math.floor(e/1e3%60),t=Math.floor(e/6e4%60),a=Math.floor(e/36e5%24),i=a<10?"0"+String(a):String(a),s=t<10?"0"+String(t):String(t),o=n<10?"0"+String(n):String(n);return i+":"+s+":"+o},m.user.get({fields:"id,name,fullname",sort:"name",nolimit:"true"}).$promise.then(function(e){f.users=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.screenRecordings=e||{count:0,rows:[]}}function y(e){m.screenRecording.delete({id:e.id}).$promise.then(function(){_.remove(f.screenRecordings.rows,{id:e.id}),f.screenRecordings.count-=1,f.screenRecordings.rows.length||f.getScreenRecordings(),p.success({title:_.startCase("screenRecording")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEscreenRecording"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEscreenRecording",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getScreenRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","screenRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.video").controller("ScreenRecordingsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(e){return _.isEmpty(e)||isNaN(e)?e:parseInt(e,10)}function m(e){switch(e){case"sound":if(!d.application.appdata)return;return[{key:"save_name",value:d.application.appdata.split("/").pop()}];case"squareProject":if(!d.application.project)return;return[{key:"name",value:d.application.project.split(",")[1]}];case"tag":if(!d.application.tag)return;return[{key:"name",value:d.application.tag}];case"trunk":if(!d.application.trunk)return;return[{key:"name",value:d.application.trunk}];case"user":if(!d.application.user&&!d.application.users)return;return d.application.user?[{key:"name",value:d.application.user.split("/")[1]}]:_.map(d.application.users,function(e){return{key:"name",value:e.split("/")[1]}});case"variable":if(!d.application.name)return;return[{key:"name",value:d.application.name}];case"voiceContext":if(!d.application.context)return;return[{key:"name",value:d.application.context}];case"voiceMail":if(!d.application.voiceMail)return;return[{key:"mailbox",value:d.application.voiceMail.split("@")[0]}];case"voiceQueue":if(!d.application.queue)return;return[{key:"name",value:d.application.queue}]}}function u(){o.getResourcesByRole(d.currentUser,"trunk",{fields:"id,name",sort:"name",nolimit:"true"},m("trunk")).then(function(e){d.trunks=e}).catch(function(){s.error({title:i.instant("TOOLS.TRUNKS"),msg:i.instant("VOICE.NOTIFICATIONS.TRUNKS_GET_ERROR")})})}function p(){o.getResourcesByRole(d.currentUser,"sound",{fields:"id,name,save_name",sort:"name",nolimit:"true"},m("sound")).then(function(e){d.sounds=e}).catch(function(){s.error({title:i.instant("TOOLS.SOUNDS"),msg:i.instant("VOICE.NOTIFICATIONS.SOUNDS_GET_ERROR")})})}function g(){var e={fields:"id,name,role",sort:"name",nolimit:"true"},n=m("user"),t=[o.getResourcesByRole(d.currentUser,"user",_.merge(e,{role:"agent"}),n,"Agents"),o.getResourcesByRole(d.currentUser,"user",_.merge(e,{role:"telephone"}),n,"Telephones")];a.all(t).then(function(e){var n=_(e).flatMap(function(e){return e.rows}).orderBy([function(e){return e.name.toLowerCase()}]).value();d.users={rows:n,count:n.length}}).catch(function(){s.error({title:i.instant("STAFF.USERS"),msg:i.instant("VOICE.NOTIFICATIONS.USERS_GET_ERROR")})})}function v(){(d.application.appdata||"custom"===d.application.appType)&&e.hide(d.application),e.hide()}d.currentUser=r.getCurrentUser(),d.application=angular.copy(n),d.crudPermissions=l,d.errors=[],d.init=function(){d.application.appdata&&function(){var e=[];switch(d.application.appType){case"agi":d.application.project=d.application.appdata;break;case"dial":e=d.application.appdata.split(","),d.application.tech=c(e[0]),d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"externalDial":e=d.application.appdata.split(","),d.application.trunk=e[0].split("/")[1],d.application.phone=e[0].split("/")[2],d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"goTo":e=d.application.appdata.split(","),d.application.context=c(e[0]),d.application.extension=c(e[1]),d.application.priority=c(e[2]);break;case"internalDial":e=d.application.appdata.split(","),d.application.user=c(e[0]),d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"outboundDial":e=d.application.appdata.split(","),d.application.trunk=e[0].split("/")[1],d.application.phone=e[0].split("/")[2],d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]),d.application.prefix=d.application.phone?d.application.phone.split("$")[0]:void 0,d.application.callerId=d.application.callerID?"CALLERID(all)="+d.application.callerID:void 0;break;case"playback":e=d.application.appdata.split(","),d.application.appdata=c(e[0]),d.application.options=c(e[1]);break;case"queue":e=d.application.appdata.split(","),d.application.queue=c(e[0]),d.application.options=c(e[1]),d.application.URL=c(e[2]),d.application.sound=c(e[3]),d.application.timeout=c(e[4]),d.application.agi=c(e[5]),d.application.macro=c(e[6]),d.application.gosub=c(e[7]),d.application.rule=c(e[8]),d.application.position=c(e[9]);break;case"ringGroup":e=d.application.appdata.split(","),d.application.users=e[0].split("&"),d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"set":e=d.application.appdata.split("="),d.application.name=e[0],d.application.value=e[1];break;case"voicemail":e=d.application.appdata.split(","),d.application.voiceMail=c(e[0]),d.application.options=c(e[1])}}();switch(d.application.appType){case"agi":o.getResourcesByRole(d.currentUser,"squareProject",{fields:"id,name",sort:"name",nolimit:"true"},m("squareProject")).then(function(e){d.projects=e}).catch(function(){s.error({title:i.instant("CALLYSQUARE.CALLYSQUARE")+" "+i.instant("CALLYSQUARE.PROJECTS"),msg:i.instant("VOICE.NOTIFICATIONS.CALLYSQUARE_PROJECTS_GET_ERROR")})});break;case"externalDial":u();break;case"goTo":o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:"true"},m("voiceContext")).then(function(e){d.contexts=e}).catch(function(){s.error({title:i.instant("VOICE.CONTEXTS"),msg:i.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});break;case"internalDial":g();break;case"outboundDial":o.getResourcesByRole(d.currentUser,"tag",{fields:"id,name",sort:"name",nolimit:"true"},m("tag")).then(function(e){d.tags=e}).catch(function(){s.error({title:i.instant("TOOLS.TAGS"),msg:i.instant("VOICE.NOTIFICATIONS.TAGS_GET_ERROR")})}),u();break;case"playback":p();break;case"queue":p(),o.getResourcesByRole(d.currentUser,"voiceQueue",{type:"inbound",fields:"id,name,type",sort:"name",nolimit:"true"},m("voiceQueue")).then(function(e){d.queues=e}).catch(function(){s.error({title:i.instant("VOICE.VOICEQUEUES"),msg:i.instant("VOICE.NOTIFICATIONS.QUEUES_GET_ERROR")})});break;case"ringGroup":g();break;case"set":o.getResourcesByRole(d.currentUser,"variable",{fields:"id,name",sort:"name",nolimit:"true"},m("variable")).then(function(e){d.variables=e}).catch(function(){s.error({title:i.instant("TOOLS.VARIABLES"),msg:i.instant("VOICE.NOTIFICATIONS.VARIABLES_GET_ERROR")})});break;case"voicemail":o.getResourcesByRole(d.currentUser,"voiceMail",{fields:"id,mailbox",sort:"mailbox",nolimit:"true"},m("voiceMail")).then(function(e){d.voiceMails=e}).catch(function(){s.error({title:i.instant("VOICE.VOICEMAILS"),msg:i.instant("VOICE.NOTIFICATIONS.VOICEMAILS_GET_ERROR")})})}},d.saveRoutingApp=function(){d.errors=[],function(){var e=[];switch(d.application.appType){case"agi":d.application.appdata=d.application.project;break;case"dial":e[0]=d.application.tech,e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"externalDial":e[0]=["SIP",d.application.trunk,d.application.phone].join("/"),e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"goTo":e[0]=d.application.context,e[1]=d.application.extension,e[2]=d.application.priority,d.application.appdata=e.join(",");break;case"internalDial":e[0]=d.application.user,e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"outboundDial":d.application.phone=t.cutdigits?(d.application.prefix||"")+"${EXTEN:"+t.cutdigits+"}":(d.application.prefix||"")+"${EXTEN}","none"===t.recordingFormat?d.application.options=d.application.options.replace("U(xcally-mixmonitor-context)",""):d.application.options.indexOf("U(xcally-mixmonitor-context)")<0&&(d.application.options+="U(xcally-mixmonitor-context)"),e[0]=["SIP",d.application.trunk,d.application.phone].join("/"),e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"playback":e[0]=d.application.appdata,e[1]=d.application.options,d.application.appdata=e.join(",");break;case"queue":e[0]=d.application.queue,e[1]=d.application.options,e[2]=d.application.URL,e[3]=d.application.sound,e[4]=d.application.timeout,e[5]=d.application.agi,e[6]=d.application.macro,e[7]=d.application.gosub,e[8]=d.application.rule,e[9]=d.application.position,d.application.appdata=e.join(",");break;case"ringGroup":e[0]=d.application.users.join("&"),e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"set":e[0]=d.application.name,e[1]=d.application.value,d.application.appdata=e.join("=");break;case"voicemail":e[0]=d.application.voiceMail,e[1]=d.application.options,d.application.appdata=e.join(",")}}(),v()},d.closeDialog=v}e.$inject=["$mdDialog","$q","$translate","toasty","application","route","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditRoutingAppDialogController",e)}(),function(){"use strict";function e(n,t,e,a,i,s,o,r,l){var d=this;function c(){var e=[{key:"name",value:d.interval.IntervalId}];s.getResourcesByRole(d.currentUser,"interval",{fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0},e).then(function(e){d.intervals=e}).catch(function(){i.error({title:t.instant("TOOLS.INTERVALS"),msg:t.instant("VOICE.NOTIFICATIONS.INTERVALS_GET_ERROR")})})}function m(e){n.hide(e)}d.currentUser=o.getCurrentUser(),d.interval=angular.copy(e),d.intervals=a||{rows:[],count:0},d.types=["always","custom","list"],d.crudPermissions=r,d.errors=[],d.daysOfWeek=l.getDaysOfWeek(),d.monthNumber=l.getMonthNumber(),d.monthName=l.getMonthName(),d.daysOfMonth=l.getDaysOfMonth(),d.initialize=function(){if("*,*,*,*"===d.interval.interval)return d.type=d.interval.IntervalId&&d.interval.application?"list":"always",void("list"===d.type&&c());d.type="custom";var e=d.interval.interval.split(","),n=e[0],t=e[1],a=e[2],i=e[3];if("*"!==n){var s,o=n.split("-")[0],r=n.split("-")[1];(s=new Date).setHours(Number(o.split(":")[0])),s.setMinutes(Number(o.split(":")[1])),d.timeRangeFrom=s,(s=new Date).setHours(Number(r.split(":")[0])),s.setMinutes(Number(r.split(":")[1])),d.timeRangeTo=s}"*"!==t&&(d.dayOfWeekFrom=t.split("-")[0],d.dayOfWeekTo=t.split("-")[1]);"*"!==a&&(d.monthDayFrom=a.split("-")[0],d.monthDayTo=a.split("-")[1]);"*"!==i&&(d.monthFrom=i.split("-")[0],d.monthTo=i.split("-")[1])},d.onTypeChange=function(){"list"===d.type&&0===d.intervals.count&&c()},d.saveInterval=function(){d.errors=[],d.interval.interval=function(){if(["always","list"].includes(d.type))return"*,*,*,*";var e=[];if("*"!==d.timeRangeFrom&&d.timeRangeFrom&&d.timeRangeTo){var n=(d.timeRangeFrom.getHours()<10?"0":"")+d.timeRangeFrom.getHours()+":"+(d.timeRangeFrom.getMinutes()<10?"0":"")+d.timeRangeFrom.getMinutes(),t=(d.timeRangeTo.getHours()<10?"0":"")+d.timeRangeTo.getHours()+":"+(d.timeRangeTo.getMinutes()<10?"0":"")+d.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return d.dayOfWeekFrom?d.dayOfWeekTo?e.push(d.dayOfWeekFrom+"-"+d.dayOfWeekTo):e.push(d.dayOfWeekFrom):e.push("*"),d.monthDayFrom?d.monthDayTo?e.push(d.monthDayFrom+"-"+d.monthDayTo):e.push(d.monthDayFrom):e.push("*"),d.monthFrom?d.monthTo?e.push(d.monthFrom+"-"+d.monthTo):e.push(d.monthFrom):e.push("*"),e.join()}(),"list"!==d.type&&(d.interval.IntervalId=null);m(d.interval)},d.closeDialog=m}e.$inject=["$mdDialog","$translate","interval","intervals","toasty","api","Auth","crudPermissions","IndexFactory"],angular.module("app.voice").controller("EditRoutingIntervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.chanSpies=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="chanSpies",f.listOrder="",f.listOrderAsc=null,f.selectedChanSpies=[],f.query={fields:"createdAt,updatedAt,id,name,prefix,options,auth,password,record,recordingFormat,description",sort:"-updatedAt",limit:10,page:1},f.arrayoptions=_.keyBy([{option:"b: Only spy on channels involved in a bridged call.",value:"'b'"},{option:"B: Instead of whispering on a single channel barge in on both channels involved in the call.",value:"'B'"},{option:"E: Exit when the spied-on channel hangs up.",value:"'E'"},{option:"o: Only listen to audio coming from this channel.",value:"'o'"},{option:"q: Don't play a beep when beginning to spy on a channel, or speak the selected channel name.",value:"'q'"},{option:"s: Skip the playback of the channel type (i.e. SIP, IAX, etc) when speaking the selected channel name.",value:"'s'"},{option:"S: Stop when no more channels are left to spy on.",value:"'S'"},{option:"w: Enable whisper mode, so the spying channel can talk to the spied-on channel.",value:"'w'"},{option:"W: Enable private whisper mode, so the spying channel can talk to the spied-on channel but cannot listen to that channel.",value:"'W'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayrecordingFormat=_.keyBy([{option:"wav",value:"'wav'"},{option:"gsm",value:"'gsm'"},{option:"wav49",value:"'WAV'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditchanSpyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/chanSpies/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chanSpy:e,chanSpies:f.chanSpies.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("chanSpy")+"?").htmlContent("<b>"+(e.name||"chanSpy")+"</b> will be deleted.").ariaLabel("delete chanSpy").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getChanSpies=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceChanSpy.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ChanSpies",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditchanSpy=function(e,n){i.show({controller:"CreateOrEditchanSpyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/chanSpies/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{chanSpy:n,chanSpies:f.chanSpies.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletechanSpy=y,f.exportSelectedChanSpies=function(){var e=angular.copy(f.selectedChanSpies);return f.selectedChanSpies=[],e},f.deleteSelectedChanSpies=function(e){var n=i.confirm().title("Are you sure want to delete the selected chanSpies?").htmlContent("<b>"+f.selectedChanSpies.length+" selected</b> will be deleted.").ariaLabel("delete chanSpys").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedChanSpies.forEach(function(e){y(e)}),f.selectedChanSpies=[]})},f.deselectChanSpies=function(){f.selectedChanSpies=[]},f.selectAllChanSpies=function(){f.selectedChanSpies=f.chanSpies.rows};var b=!0,A=1;function E(e){f.chanSpies=e||{count:0,rows:[]}}function y(e){m.voiceChanSpy.delete({id:e.id}).$promise.then(function(){_.remove(f.chanSpies.rows,{id:e.id}),f.chanSpies.count-=1,f.chanSpies.rows.length||f.getChanSpies(),p.success({title:_.startCase("chanSpy")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceChanSpy"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceChanSpy",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getChanSpies())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chanSpies","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("ChanSpiesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_CHANSPY",g.chanSpy=angular.copy(l),g.chanSpies=r,g.newchanSpy=!1,g.chanSpy||(g.chanSpy={recordingFormat:"wav"},g.title="VOICE.NEW_CHANSPY",g.newchanSpy=!0),g.addNewchanSpy=function(){g.errors=[],d.voiceChanSpy.save(g.chanSpy).$promise.then(function(e){g.chanSpies.unshift(e.toJSON()),o.success({title:"chanSpy properly created",msg:g.chanSpy.name?g.chanSpy.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceChanSpy.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceChanSpy.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savechanSpy=function(){g.errors=[],d.voiceChanSpy.update({id:g.chanSpy.id},g.chanSpy).$promise.then(function(e){var n=_.find(g.chanSpies,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"chanSpy properly saved!",msg:g.chanSpy.name?g.chanSpy.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceChanSpy.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceChanSpy.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletechanSpy=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chanSpy will be deleted.").ariaLabel("Delete chanSpy").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceChanSpy.delete({id:g.chanSpy.id}).$promise.then(function(){_.remove(g.chanSpies,{id:g.chanSpy.id}),o.success({title:"chanSpy properly deleted!",msg:(g.chanSpy.name||"chanSpy")+" has been deleted!"}),v(g.chanSpy)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceChanSpy.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceChanSpy.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chanSpies","chanSpy","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditchanSpyDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.contexts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="contexts",f.listOrder="",f.listOrderAsc=null,f.selectedContexts=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditContextDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/contexts/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{context:e,contexts:f.contexts.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("context")+"?").htmlContent("<b>"+(e.name||"context")+"</b> will be deleted.").ariaLabel("delete context").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getContexts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceContext.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Contexts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditContext=function(e,n){i.show({controller:"CreateOrEditContextDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/contexts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{context:n,contexts:f.contexts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteContext=y,f.exportSelectedContexts=function(){var e=angular.copy(f.selectedContexts);return f.selectedContexts=[],e},f.deleteSelectedContexts=function(e){var n=i.confirm().title("Are you sure want to delete the selected contexts?").htmlContent("<b>"+f.selectedContexts.length+" selected</b> will be deleted.").ariaLabel("delete Contexts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedContexts.forEach(function(e){y(e)}),f.selectedContexts=[]})},f.deselectContexts=function(){f.selectedContexts=[]},f.selectAllContexts=function(){f.selectedContexts=f.contexts.rows};var b=!0,A=1;function E(e){f.contexts=e||{count:0,rows:[]}}function y(e){m.voiceContext.delete({id:e.id}).$promise.then(function(){_.remove(f.contexts.rows,{id:e.id}),f.contexts.count-=1,f.contexts.rows.length||f.getContexts(),p.success({title:_.startCase("Context")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceContext"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceContext",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getContexts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","contexts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("ContextsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_CONTEXT",g.context=angular.copy(l),g.contexts=r,g.newContext=!1,g.context||(g.context={},g.title="VOICE.NEW_CONTEXT",g.newContext=!0),g.addNewContext=function(){g.errors=[],d.voiceContext.save(g.context).$promise.then(function(e){g.contexts.unshift(e.toJSON()),o.success({title:"Context properly created",msg:g.context.name?g.context.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceContext.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceContext.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveContext=function(){g.errors=[],d.voiceContext.update({id:g.context.id},g.context).$promise.then(function(e){var n=_.find(g.contexts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Context properly saved!",msg:g.context.name?g.context.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceContext.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceContext.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteContext=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The context will be deleted.").ariaLabel("Delete Context").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceContext.delete({id:g.context.id}).$promise.then(function(){_.remove(g.contexts,{id:g.context.id}),o.success({title:"Context properly deleted!",msg:(g.context.name||"context")+" has been deleted!"}),v(g.context)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceContext.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceContext.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","contexts","context","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditContextDialogController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l){var d=this;function c(t){return e(function(e,n){o.voiceExtension.addApplications({id:t},d.applications?d.applications.rows:[]).$promise.then(function(){e()}).catch(function(e){n(e)})})}function m(e){t.hide(e)}d.currentUser=r.getCurrentUser(),d.crudPermissions=l,d.inboundRoute=angular.copy(s),d.inboundRoutes=n,d.newInboundRoute=!1,d.hasModulePermissions={},d.errors=[],d.initialize=function(){d.inboundRoute||(d.inboundRoute={appdata:"Inbound Call",type:"inbound",context:"from-voip-provider"},d.newInboundRoute=!0);e=[{key:"name",value:d.inboundRoute.context}],o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){d.contexts=e}).catch(function(){i.error({title:a.instant("VOICE.CONTEXTS"),msg:a.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},d.getRouting=function(){if(d.newinboundRoute)return;var e={sort:"priority",VoiceExtensionId:d.inboundRoute.id,isApp:!0,nolimit:!0};o.voiceExtension.get(e).$promise.then(function(e){d.applications=e||{count:0,rows:[]}})},d.addNewInboundRoute=function(){d.errors=[],o.voiceExtension.save(d.inboundRoute).$promise.then(function(e){c(e.id).then(function(){d.inboundRoutes.unshift(e.toJSON()),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_CREATED_SUCCESS_TITLE")}),m(e)})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.saveInboundRoute=function(){d.errors=[],o.voiceExtension.update({id:d.inboundRoute.id},d.inboundRoute).$promise.then(function(e){var n=_.find(d.inboundRoutes,{id:e.id});if(n&&_.merge(n,e.toJSON()),d.applications)return c(d.inboundRoute.id)}).then(function(){i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")}),m(s)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.deleteInboundRoute=function(e){d.errors=[];var n=t.confirm().title(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:d.inboundRoute.exten})).ariaLabel("Delete inbound route").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){o.voiceExtension.delete({id:d.inboundRoute.id}).$promise.then(function(){_.remove(d.inboundRoutes,{id:d.inboundRoute.id}),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")}),m(d.inboundRoute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},d.closeDialog=m}e.$inject=["$mdDialog","$q","$translate","toasty","inboundRoutes","inboundRoute","api","Auth","crudPermissions"],angular.module("app.voice").controller("CreateOrEditInboundRouteDialogController",e)}(),function(){"use strict";function e(e,i,a,n,s,o,r,t,l,d,c){var m=this;function u(e,n){1===m.applications.rows.length&&1===n&&(n=0);var t=m.applications.rows[n];i.show({controller:"EditRoutingAppDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/dialog.html",parent:angular.element(a.body),targetEvent:e,locals:{application:t,route:m.inboundRoute,crudPermissions:m.crudPermissions}}).then(function(e){e?(m.applications.rows[n].appdata===e.appdata&&"custom"!==e.appType||p(),m.applications.rows[n]=e):t.id||m.applications.rows.splice(n,1)}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(){m.pendingChanges=!0}m.currentUser=t.getCurrentUser(),m.inboundRoute=l||e.params.inboundRoute||{},m.contexts=d,m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=t.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={sort:"priority",VoiceExtensionId:m.inboundRoute.id,isApp:!0,nolimit:!0},m.apps=[{app:"AGI",appAlias:"CallySquare",appType:"agi",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:"Dial",appType:"dial",context:"from-sip",type:"Inbound",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"internalDial",context:"from-sip",type:"Inbound",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"externalDial",context:"from-sip",type:"Inbound",interval:"*,*,*,*",options:"xX"},{app:"Dial",appType:"ringGroup",context:"from-sip",type:"Inbound",interval:"*,*,*,*",options:"xX"},{app:"Playback",appType:"playback",context:"from-sip",type:"Inbound",interval:"*,*,*,*",answer:!0},{app:"Queue",appType:"queue",context:"from-sip",type:"Inbound",options:"xX",appdata:",xX,,,300,,,,,",interval:"*,*,*,*",answer:!0},{app:"Set",appType:"set",context:"from-sip",type:"Inbound",separator:"=",interval:"*,*,*,*"},{app:"Voicemail",appType:"voicemail",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:"goto",appType:"goTo",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:"hangup",appType:"hangup",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:null,appType:"custom",type:"Inbound",interval:"*,*,*,*"}],m.sortableAppsOptions={group:{name:"apps",pull:"clone",put:!1},animation:100,sort:!1},m.sortableRoutingOptions={group:{name:"apps",put:!0},animation:100,disabled:!m.crudPermissions.canEdit,onAdd:function(e){u(e,e.newIndex)},onUpdate:function(){p()}},m.selectedApplications=[],m.onInit=function(){if(t.isAdmin())return;e=[{key:"name",value:m.inboundRoute.context}],o.getResourcesByRole(m.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){m.contexts=e}).catch(function(){r.error({title:s.instant("VOICE.CONTEXTS"),msg:s.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},m.onActionsTabSelection=function(){m.applications||o.voiceExtension.get(m.query).$promise.then(function(e){m.applications=e||{count:0,rows:[]}})},m.gotoInboundRoutes=function(){e.go("app.voice.inboundRoutes",{},{reload:"app.voice.inboundRoutes"})},m.saveInboundRoute=function(){o.voiceExtension.update({id:m.inboundRoute.id},m.inboundRoute).$promise.then(function(){n(function(n,t){if(!m.applications)return n();o.voiceExtension.addApplications({id:m.inboundRoute.id},m.applications.rows).$promise.then(function(e){m.applications.rows=e.rows,n()}).catch(function(e){t(e)})}).then(function(){m.pendingChanges=!1,r.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")})})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.editApplication=u,m.editInterval=function(e,n){var t=m.applications.rows[n];i.show({controller:"EditRoutingIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:void 0,crudPermissions:m.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,p())})},m.deleteApplication=function(e,n,t){var a=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_MESSAGE",{name:e.app})).ariaLabel("Delete application").targetEvent(t).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(a).then(function(){m.applications.rows.splice(n,1),p()})},m.deleteSelectedApplications=function(e){var n=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_MESSAGE",{total:m.selectedApplications.length})).ariaLabel("Delete applications").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedApplications.forEach(function(e){_.remove(m.applications.rows,{id:e.id})}),m.selectedApplications=[],p()})}}e.$inject=["$state","$mdDialog","$document","$q","$translate","api","toasty","Auth","inboundRoute","contexts","userProfileSection"],angular.module("app.voice").controller("InboundRouteController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.inboundRoutes=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.voiceExtension.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="InboundRoutes",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){d.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(g.inboundRoutes.rows,{id:e.id}),g.inboundRoutes.count-=1,g.inboundRoutes.rows.length||h(),c.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceExtension"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.inboundRoutes=o,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedInboundRoutes=[],g.query={fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},g.editRoute=function(e){n.go("app.voice.inboundRoutes.edit",{id:e.id,inboundRoute:e,crudPermissions:g.crudPermissions})},g.createOrEditInboundRoute=function(e,n){a.show({controller:"CreateOrEditInboundRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/inboundRoutes/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{inboundRoute:n,inboundRoutes:g.inboundRoutes.rows,crudPermissions:g.crudPermissions}})},g.success=v,g.getInboundRoutes=h,g.deleteConfirm=function(e,n){var t=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:e.exten})).ariaLabel("Delete extension").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.exportSelectedInboundRoutes=function(){var e=angular.copy(g.selectedInboundRoutes);return g.selectedInboundRoutes=[],e},g.deleteSelectedInboundRoutes=function(e){var n=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_MESSAGE",{total:g.selectedInboundRoutes.length})).ariaLabel("Delete extensions").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedInboundRoutes.forEach(function(e){f(e)}),g.selectedInboundRoutes=[]})};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","inboundRoutes","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.voice").controller("InboundRoutesController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l){var d=this;function c(t){return e(function(e,n){o.voiceExtension.addApplications({id:t},d.applications?d.applications.rows:[]).$promise.then(function(){e()}).catch(function(e){n(e)})})}function m(e){t.hide(e)}d.currentUser=r.getCurrentUser(),d.crudPermissions=l,d.internalRoute=angular.copy(s),d.internalRoutes=n,d.newInternalRoute=!1,d.hasModulePermissions={},d.errors=[],d.initialize=function(){d.internalRoute||(d.internalRoute={appdata:"Internal Call",type:"internal",context:"from-sip"},d.newInternalRoute=!0);e=[{key:"name",value:d.internalRoute.context}],o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){d.contexts=e}).catch(function(){i.error({title:a.instant("VOICE.CONTEXTS"),msg:a.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},d.getRouting=function(){if(d.newInternalRoute)return;var e={sort:"priority",VoiceExtensionId:d.internalRoute.id,isApp:!0,nolimit:!0};o.voiceExtension.get(e).$promise.then(function(e){d.applications=e||{count:0,rows:[]}})},d.addNewInternalRoute=function(){d.errors=[],o.voiceExtension.save(d.internalRoute).$promise.then(function(e){c(e.id).then(function(){d.internalRoutes.unshift(e.toJSON()),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_CREATED_SUCCESS_TITLE")}),m(e)})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.saveInternalRoute=function(){d.errors=[],o.voiceExtension.update({id:d.internalRoute.id},d.internalRoute).$promise.then(function(e){var n=_.find(d.internalRoutes,{id:e.id});if(n&&_.merge(n,e.toJSON()),d.applications)return c(d.internalRoute.id)}).then(function(){i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")}),m(s)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.deleteInternalRoute=function(e){d.errors=[];var n=t.confirm().title(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:d.internalRoute.exten})).ariaLabel("Delete internal route").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){o.voiceExtension.delete({id:d.internalRoute.id}).$promise.then(function(){_.remove(d.internalRoutes,{id:d.internalRoute.id}),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")}),m(d.internalRoute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},d.closeDialog=m}e.$inject=["$mdDialog","$q","$translate","toasty","internalRoutes","internalRoute","api","Auth","crudPermissions"],angular.module("app.voice").controller("CreateOrEditInternalRouteDialogController",e)}(),function(){"use strict";function e(e,i,a,n,s,o,r,t,l,d,c){var m=this;function u(e,n){1===m.applications.rows.length&&1===n&&(n=0);var t=m.applications.rows[n];i.show({controller:"EditRoutingAppDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/dialog.html",parent:angular.element(a.body),targetEvent:e,locals:{application:t,route:m.internalRoute,crudPermissions:m.crudPermissions}}).then(function(e){e?(m.applications.rows[n].appdata===e.appdata&&"custom"!==e.appType||p(),m.applications.rows[n]=e):t.id||m.applications.rows.splice(n,1)}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(){m.pendingChanges=!0}m.currentUser=t.getCurrentUser(),m.internalRoute=l||e.params.internalRoute||{},m.contexts=d,m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=t.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={sort:"priority",VoiceExtensionId:m.internalRoute.id,isApp:!0,nolimit:!0},m.apps=[{app:"AGI",appAlias:"CallySquare",appType:"agi",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:"Dial",appType:"dial",context:"from-sip",type:"Internal",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"internalDial",context:"from-sip",type:"Internal",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"externalDial",context:"from-sip",type:"Internal",interval:"*,*,*,*",options:"xX"},{app:"Dial",appType:"ringGroup",context:"from-sip",type:"Internal",interval:"*,*,*,*",options:"xX"},{app:"Playback",appType:"playback",context:"from-sip",type:"Internal",interval:"*,*,*,*",answer:!0},{app:"Queue",appType:"queue",context:"from-sip",type:"Internal",options:"xX",appdata:",xX,,,300,,,,,",interval:"*,*,*,*",answer:!0},{app:"Set",appType:"set",context:"from-sip",type:"Internal",separator:"=",interval:"*,*,*,*"},{app:"Voicemail",appType:"voicemail",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:"goto",appType:"goTo",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:"hangup",appType:"hangup",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:null,appType:"custom",type:"Internal",interval:"*,*,*,*"}],m.sortableAppsOptions={group:{name:"apps",pull:"clone",put:!1},animation:100,sort:!1},m.sortableRoutingOptions={group:{name:"apps",put:!0},animation:100,disabled:!m.crudPermissions.canEdit,onAdd:function(e){u(e,e.newIndex)},onUpdate:function(){p()}},m.selectedApplications=[],m.onInit=function(){if(t.isAdmin())return;e=[{key:"name",value:m.internalRoute.context}],o.getResourcesByRole(m.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){m.contexts=e}).catch(function(){r.error({title:s.instant("VOICE.CONTEXTS"),msg:s.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},m.onActionsTabSelection=function(){m.applications||o.voiceExtension.get(m.query).$promise.then(function(e){m.applications=e||{count:0,rows:[]}})},m.gotoInternalRoutes=function(){e.go("app.voice.internalRoutes",{},{reload:"app.voice.internalRoutes"})},m.saveInternalRoute=function(){o.voiceExtension.update({id:m.internalRoute.id},m.internalRoute).$promise.then(function(){n(function(n,t){if(!m.applications)return n();o.voiceExtension.addApplications({id:m.internalRoute.id},m.applications.rows).$promise.then(function(e){m.applications.rows=e.rows,n()}).catch(function(e){t(e)})}).then(function(){m.pendingChanges=!1,r.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")})})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.editApplication=u,m.editInterval=function(e,n){var t=m.applications.rows[n];i.show({controller:"EditRoutingIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:void 0,crudPermissions:m.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,p())})},m.deleteApplication=function(e,n,t){var a=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_MESSAGE",{name:e.app})).ariaLabel("Delete application").targetEvent(t).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(a).then(function(){m.applications.rows.splice(n,1),p()})},m.deleteSelectedApplications=function(e){var n=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_MESSAGE",{total:m.selectedApplications.length})).ariaLabel("Delete applications").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedApplications.forEach(function(e){_.remove(m.applications.rows,{id:e.id})}),m.selectedApplications=[],p()})}}e.$inject=["$state","$mdDialog","$document","$q","$translate","api","toasty","Auth","internalRoute","contexts","userProfileSection"],angular.module("app.voice").controller("InternalRouteController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.internalRoutes=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.voiceExtension.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="InternalRoutes",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){d.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(g.internalRoutes.rows,{id:e.id}),g.internalRoutes.count-=1,g.internalRoutes.rows.length||h(),c.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceExtension"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.internalRoutes=o,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedInternalRoutes=[],g.query={fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},g.editRoute=function(e){n.go("app.voice.internalRoutes.edit",{id:e.id,internalRoute:e,crudPermissions:g.crudPermissions})},g.createOrEditInternalRoute=function(e,n){a.show({controller:"CreateOrEditInternalRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/internalRoutes/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{internalRoute:n,internalRoutes:g.internalRoutes.rows,crudPermissions:g.crudPermissions}})},g.success=v,g.getInternalRoutes=h,g.deleteConfirm=function(e,n){var t=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:e.exten})).ariaLabel("Delete extension").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.exportSelectedInternalRoutes=function(){var e=angular.copy(g.selectedInternalRoutes);return g.selectedInternalRoutes=[],e},g.deleteSelectedInternalRoutes=function(e){var n=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_MESSAGE",{total:g.selectedInternalRoutes.length})).ariaLabel("Delete extensions").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedInternalRoutes.forEach(function(e){f(e)}),g.selectedInternalRoutes=[]})};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","internalRoutes","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.voice").controller("InternalRoutesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_MUSICONHOLD",g.musiconhold=angular.copy(l),g.musiconholds=r,g.newMusicOnHold=!1,g.musiconhold||(g.musiconhold={mode:"files"},g.title="VOICE.NEW_MUSICONHOLD",g.newMusicOnHold=!0),g.addNewMusicOnHold=function(){g.errors=[],d.voiceMusicOnHold.save(g.musiconhold).$promise.then(function(e){g.musiconholds.unshift(e.toJSON()),o.success({title:"MusicOnHold properly created",msg:g.musiconhold.name?g.musiconhold.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMusicOnHold=function(){g.errors=[],d.voiceMusicOnHold.update({id:g.musiconhold.id},g.musiconhold).$promise.then(function(e){var n=_.find(g.musiconholds,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MusicOnHold properly saved!",msg:g.musiconhold.name?g.musiconhold.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMusicOnHold=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The musiconhold will be deleted.").ariaLabel("Delete MusicOnHold").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceMusicOnHold.delete({id:g.musiconhold.id}).$promise.then(function(){_.remove(g.musiconholds,{id:g.musiconhold.id}),o.success({title:"MusicOnHold properly deleted!",msg:(g.musiconhold.name||"musiconhold")+" has been deleted!"}),v(g.musiconhold)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","musiconholds","musiconhold","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditMusicOnHoldDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.musiconholdMohSounds=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceMusicOnHold.getSounds(m.query,u).$promise}function g(e){d.voiceMusicOnHold.removeSound({id:t.params.id,id2:e.id}).$promise.then(function(){_.remove(m.musiconholdMohSounds.rows,{id:e.id}),m.musiconholdMohSounds.count-=1,m.musiconholdMohSounds.rows.length||p(),l.success({title:"MohSound deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceMusicOnHold"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.musiconhold={},m.musiconholdMohSounds={count:0,rows:[]},m.selectedMusicOnHoldMohSounds=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,save_name,converted_format,audio",limit:10,page:1},m.init=function(e,n){m.musiconhold=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceMusicOnHoldId=m.musiconhold.id,m.query.id=m.musiconhold.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the mohSound?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("mohSound #")+e.id||"mohSound")+"</b> will be deleted.").ariaLabel("delete mohSound").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.voiceMusicOnHoldDownload=function(s,e,n){return d.sound.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="mohSound"+s.id,a=new Blob(n,{type:e.type});t=s.converted_format?s.save_name+"."+s.converted_format:s.save_name;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=u,m.getMusicOnHoldMohSounds=p,m.createOrEditMusicOnHoldMohSound=function(e,n){o.show({controller:"CreateOrEditMohSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/musiconholds/edit/mohSounds/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{musiconhold:m.musiconhold,mohSound:n,mohSounds:m.musiconholdMohSounds.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedMusicOnHoldMohSounds=function(){var e=angular.copy(m.selectedMusicOnHoldMohSounds);return m.selectedMusicOnHoldMohSounds=[],e},m.deleteMusicOnHoldMohSound=g,m.deleteSelectedMusicOnHoldMohSounds=function(e){var n=o.confirm().title("Are you sure want to delete the selected mohSounds?").htmlContent("<b>"+m.selectedMusicOnHoldMohSounds.length+" selected</b> will be deleted.").ariaLabel("delete mohSounds").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedMusicOnHoldMohSounds.forEach(function(e){g(e)}),m.selectedMusicOnHoldMohSounds=[]})},c.hasRole("admin")?d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){m.sounds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){m.sounds=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.sounds,{id:e.resourceId})}),t=null;if(m.musiconhold&&(t=_.find(m.sounds,{id:Number(m.musiconhold.id)})),t&&!_.some(n,["id",t.id])){var a=_.find(m.sounds,{id:t.id});a.canSelect=!1,n.push(a)}m.sounds=n})}else{var t=[],a=null;m.musiconhold&&(a=_.find(m.sounds,{id:Number(m.musiconhold.id)}));for(var i=0;i<m.sounds.length;i++)a&&m.sounds[i].id===a.id&&(m.sounds[i].canSelect=!1,t.push(m.sounds[i]));m.sounds=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.voice").controller("MusicOnHoldMohSoundsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_MOHSOUND",g.mohSound=angular.copy(l),g.mohSounds=r,g.newMohSound=!1,g.mohSound||(g.mohSound={},g.title="VOICE.NEW_MOHSOUND",g.newMohSound=!0),n.params.id&&(g.mohSound.VoiceMusicOnHoldId=n.params.id),g.addNewMohSound=function(){g.errors=[],d.voiceMusicOnHold.addSound({id:n.params.id},g.mohSound).$promise.then(function(e){g.mohSounds.unshift(e.toJSON()),o.success({title:"MohSound properly created",msg:g.mohSound.name?g.mohSound.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMohSound=function(){g.errors=[],d.voiceMusicOnHold.update({id:g.mohSound.id},g.mohSound).$promise.then(function(e){var n=_.find(g.mohSounds,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MohSound properly saved!",msg:g.mohSound.name?g.mohSound.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMohSound=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The mohSound will be deleted.").ariaLabel("Delete MohSound").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceMusicOnHold.delete({id:g.mohSound.id}).$promise.then(function(){_.remove(g.mohSounds,{id:g.mohSound.id}),o.success({title:"MohSound properly deleted!",msg:(g.mohSound.name||"mohSound")+" has been deleted!"}),v(g.mohSound)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.sounds=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.sounds=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.sounds,{id:e.resourceId})}),t=null;if(g.mohSound&&(t=_.find(g.sounds,{id:Number(g.mohSound.id)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.sounds,{id:t.id});a.canSelect=!1,n.push(a)}g.sounds=n})}else{var t=[],a=null;g.mohSound&&(a=_.find(g.sounds,{id:Number(g.mohSound.id)}));for(var i=0;i<g.sounds.length;i++)a&&g.sounds[i].id===a.id&&(g.sounds[i].canSelect=!1,t.push(g.sounds[i]));g.sounds=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mohSounds","mohSound","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditMohSoundDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.musiconhold=c||e.params.musiconhold||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoMusicOnHolds=function(){e.go("app.voice.musiconholds",{},{reload:"app.voice.musiconholds"})},u.saveMusicOnHold=function(){r.voiceMusicOnHold.update({id:u.musiconhold.id},u.musiconhold).$promise.then(function(){l.success({title:"MusicOnHold updated!",msg:u.musiconhold.name?u.musiconhold.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","musiconhold","userProfileSection"],angular.module("app.voice").controller("MusicOnHoldController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.musiconholds=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="musiconholds",f.listOrder="",f.listOrderAsc=null,f.selectedMusicOnHolds=[],f.query={fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",defaultEntry:"false",limit:10,page:1},f.arraymode=_.keyBy([{option:"Files",value:"'files'"},{option:"Custom",value:"'custom'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysort=_.keyBy([{option:"Random",value:"'random'"},{option:"Alphabetical",value:"'alpha'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.voice.musiconholds.edit",{id:e.id,musiconhold:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("musiconhold")+"?").htmlContent("<b>"+(e.name||"musiconhold")+"</b> will be deleted.").ariaLabel("delete musiconhold").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getMusicOnHolds=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceMusicOnHold.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="MusicOnHolds",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMusicOnHold=function(e,n){i.show({controller:"CreateOrEditMusicOnHoldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/musiconholds/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{musiconhold:n,musiconholds:f.musiconholds.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteMusicOnHold=y,f.exportSelectedMusicOnHolds=function(){var e=angular.copy(f.selectedMusicOnHolds);return f.selectedMusicOnHolds=[],e},f.deleteSelectedMusicOnHolds=function(e){var n=i.confirm().title("Are you sure want to delete the selected musiconholds?").htmlContent("<b>"+f.selectedMusicOnHolds.length+" selected</b> will be deleted.").ariaLabel("delete MusicOnHolds").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMusicOnHolds.forEach(function(e){y(e)}),f.selectedMusicOnHolds=[]})},f.deselectMusicOnHolds=function(){f.selectedMusicOnHolds=[]},f.selectAllMusicOnHolds=function(){f.selectedMusicOnHolds=f.musiconholds.rows};var b=!0,A=1;function E(e){f.musiconholds=e||{count:0,rows:[]}}function y(e){m.voiceMusicOnHold.delete({id:e.id}).$promise.then(function(){_.remove(f.musiconholds.rows,{id:e.id}),f.musiconholds.count-=1,f.musiconholds.rows.length||f.getMusicOnHolds(),p.success({title:_.startCase("MusicOnHold")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceMusicOnHold"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMusicOnHolds())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","musiconholds","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("MusicOnHoldsController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l){var d=this;function c(t){return e(function(e,n){o.voiceExtension.addApplications({id:t},d.applications?d.applications.rows:[]).$promise.then(function(){e()}).catch(function(e){n(e)})})}function m(e){t.hide(e)}d.currentUser=r.getCurrentUser(),d.crudPermissions=l,d.outboundRoute=angular.copy(s),d.outboundRoutes=n,d.newOutboundRoute=!1,d.hasModulePermissions={},d.errors=[],d.initialize=function(){d.outboundRoute||(d.outboundRoute={appdata:"Outbound Call",type:"outbound",context:"from-sip",recordingFormat:"none"},d.newOutboundRoute=!0);e=[{key:"name",value:d.outboundRoute.context}],o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){d.contexts=e}).catch(function(){i.error({title:a.instant("VOICE.CONTEXTS"),msg:a.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},d.getRouting=function(){if(d.newOutboundRoute)return;var e={sort:"priority",VoiceExtensionId:d.outboundRoute.id,isApp:!0,nolimit:!0};o.voiceExtension.get(e).$promise.then(function(e){d.applications=e||{count:0,rows:[]}})},d.addNewOutboundRoute=function(){d.errors=[],o.voiceExtension.save(d.outboundRoute).$promise.then(function(e){c(e.id).then(function(){d.outboundRoutes.unshift(e.toJSON()),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_CREATED_SUCCESS_TITLE")}),m(e)})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.saveOutboundRoute=function(){d.errors=[],o.voiceExtension.update({id:d.outboundRoute.id},d.outboundRoute).$promise.then(function(e){var n=_.find(d.outboundRoutes,{id:e.id});if(n&&_.merge(n,e.toJSON()),d.applications)return c(d.outboundRoute.id)}).then(function(){i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")}),m(s)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.deleteOutboundRoute=function(e){d.errors=[];var n=t.confirm().title(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:d.outboundRoute.exten})).ariaLabel("Delete outbound route").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){o.voiceExtension.delete({id:d.outboundRoute.id}).$promise.then(function(){_.remove(d.outboundRoutes,{id:d.outboundRoute.id}),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")}),m(d.outboundRoute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},d.closeDialog=m}e.$inject=["$mdDialog","$q","$translate","toasty","outboundRoutes","outboundRoute","api","Auth","crudPermissions"],angular.module("app.voice").controller("CreateOrEditOutboundRouteDialogController",e)}(),function(){"use strict";function e(e,i,a,n,s,o,r,t,l,d,c){var m=this;function u(e,n){1===m.applications.rows.length&&1===n&&(n=0);var t=m.applications.rows[n];i.show({controller:"EditRoutingAppDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/dialog.html",parent:angular.element(a.body),targetEvent:e,locals:{application:t,route:m.outboundRoute,crudPermissions:m.crudPermissions}}).then(function(e){e?(m.applications.rows[n].appdata===e.appdata&&"custom"!==e.appType||p(),m.applications.rows[n]=e):t.id||m.applications.rows.splice(n,1)}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(){m.pendingChanges=!0}m.currentUser=t.getCurrentUser(),m.outboundRoute=l||e.params.outboundRoute||{},m.contexts=d,m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=t.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={sort:"priority",VoiceExtensionId:m.outboundRoute.id,isApp:!0,nolimit:!0},m.apps=[{app:"Dial",appType:"outboundDial",context:"from-sip",type:"Outbound",options:"xX",interval:"*,*,*,*"},{app:null,appType:"custom",type:"Outbound",interval:"*,*,*,*"}],m.sortableAppsOptions={group:{name:"apps",pull:"clone",put:!1},animation:100,sort:!1},m.sortableRoutingOptions={group:{name:"apps",put:!0},animation:100,disabled:!m.crudPermissions.canEdit,onAdd:function(e){u(e,e.newIndex)},onUpdate:function(){p()}},m.selectedApplications=[],m.onInit=function(){if(t.isAdmin())return;e=[{key:"name",value:m.outboundRoute.context}],o.getResourcesByRole(m.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){m.contexts=e}).catch(function(){r.error({title:s.instant("VOICE.CONTEXTS"),msg:s.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},m.onActionsTabSelection=function(){m.applications||o.voiceExtension.get(m.query).$promise.then(function(e){m.applications=e||{count:0,rows:[]}})},m.gotoOutboundRoutes=function(){e.go("app.voice.outboundRoutes",{},{reload:"app.voice.outboundRoutes"})},m.saveOutboundRoute=function(){o.voiceExtension.update({id:m.outboundRoute.id},m.outboundRoute).$promise.then(function(){n(function(n,t){if(!m.applications)return n();o.voiceExtension.addApplications({id:m.outboundRoute.id},m.applications.rows).$promise.then(function(e){m.applications.rows=e.rows,n()}).catch(function(e){t(e)})}).then(function(){m.pendingChanges=!1,r.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")})})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.editApplication=u,m.editInterval=function(e,n){var t=m.applications.rows[n];i.show({controller:"EditRoutingIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:void 0,crudPermissions:m.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,p())})},m.deleteApplication=function(e,n,t){var a=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_MESSAGE",{name:e.app})).ariaLabel("Delete application").targetEvent(t).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(a).then(function(){m.applications.rows.splice(n,1),p()})},m.deleteSelectedApplications=function(e){var n=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_MESSAGE",{total:m.selectedApplications.length})).ariaLabel("Delete applications").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedApplications.forEach(function(e){_.remove(m.applications.rows,{id:e.id})}),m.selectedApplications=[],p()})}}e.$inject=["$state","$mdDialog","$document","$q","$translate","api","toasty","Auth","outboundRoute","contexts","userProfileSection"],angular.module("app.voice").controller("OutboundRouteController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.outboundRoutes=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.voiceExtension.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="OutboundRoutes",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){d.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(g.outboundRoutes.rows,{id:e.id}),g.outboundRoutes.count-=1,g.outboundRoutes.rows.length||h(),c.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceExtension"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.outboundRoutes=o,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedOutboundRoutes=[],g.query={fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},g.editRoute=function(e){n.go("app.voice.outboundRoutes.edit",{id:e.id,outboundRoute:e,crudPermissions:g.crudPermissions})},g.createOrEditOutboundRoute=function(e,n){a.show({controller:"CreateOrEditOutboundRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/outboundRoutes/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{outboundRoute:n,outboundRoutes:g.outboundRoutes.rows,crudPermissions:g.crudPermissions}})},g.success=v,g.getOutboundRoutes=h,g.deleteConfirm=function(e,n){var t=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:e.exten})).ariaLabel("Delete extension").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.exportSelectedOutboundRoutes=function(){var e=angular.copy(g.selectedOutboundRoutes);return g.selectedOutboundRoutes=[],e},g.deleteSelectedOutboundRoutes=function(e){var n=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_MESSAGE",{total:g.selectedOutboundRoutes.length})).ariaLabel("Delete extensions").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedOutboundRoutes.forEach(function(e){f(e)}),g.selectedOutboundRoutes=[]})};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","outboundRoutes","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.voice").controller("OutboundRoutesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(){return[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",options:g.agents.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_CAMPAIGN",options:g.queues.rows,ngValue:"name"}]}function h(){return g.refresh=!1,0===g.queues.count?f(null):(g.query.queue=1===g.queues.count?g.queues.rows[0].name:g.query.queue,void 0===g.query.queue&&(g.query.queue=_.map(g.queues.rows,"name")),_.isEmpty(g.query.queue)?f(null):(g.query.offset=(g.query.page-1)*g.query.limit,i.localStorage.setItem("motion2.realtime.abandoned.voice.abandonedCalls:"+g.currentUser.id,JSON.stringify({query:_.omit(g.query,"queue")})),void(g.promise=o.voiceQueueReport.getVoiceQueuesReport(g.query,f).$promise)))}function f(e){g.abandonedCalls=e||{count:0,rows:[]},!1,g.refresh=!0}g.currentUser=d.getCurrentUser(),g.agents=u||[],g.dispositions=p.rows,g.abandonedCalls={count:0,rows:[]},g.showTooltip=!1,g.refresh=!0,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=d.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition",type:"inbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},g.getAbandonedCalls=h,g.refreshAbandonedCalls=function(){g.showTooltip=!1,h()},g.assignTo=function(e,n){e&&o.voiceQueueReport.update({id:e.id,lastAssignedTo:n?n.name:null,assigned:!!n}).$promise.catch(function(e){console.log(e)})},g.dispose=function(t){n.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(a.body),targetEvent:t,locals:{dispositions:g.dispositions,call:t}}).then(function(e){if(e){var n={id:t.id,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null};o.voiceQueueReport.update(n).$promise.catch(function(e){console.log(e)})}})},g.onSaveVoiceQueueReport=function(e){e&&g.queuesMap&&"inbound"===queue.type&&g.queuesMap[e.queue]&&(g.showTooltip=!0)},g.onUpdateVoiceQueueReport=function(e){if(e){var n=_.findIndex(g.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(g.abandonedCalls.rows[n],e)}},c.onWithoutApply("voiceQueueReport:save",g.onSaveVoiceQueueReport),c.on("voiceQueueReport:update",g.onUpdateVoiceQueueReport),function(){var e=i.localStorage.getItem("motion2.realtime.abandoned.voice.abandonedCalls:"+g.currentUser.id);if(e)(e=JSON.parse(e))&&e.query&&(g.query=_.merge(e.query,_.omit(g.query,["sort","limit","page"])),g.query=_.omit(g.query,"filter"));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};g.query.createdAt=n}d.hasRole("admin")?o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name",channel:"voice",type:"inbound",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){g.quickFilters=v(),h()}):o.userProfile.getResources({id:g.currentUser.userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){g.quickFilters=v(),h()})}();var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?t(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())}),e.$on("$destroy",function(){c.removeAllListeners("voiceQueueReport:save"),c.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","userProfile","userProfileSection","Auth","socket","toasty","agents","dispositions"],angular.module("app.voice").controller("AbandonedCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this;o.calls=i||{rows:[],count:0},o.query={limit:10,page:1},o.channelStatus=s.channelStatusOut,o.onSave=function(e){var n=_.find(o.calls.rows,{channel:e.channel});e.channelstatedesc=e.dialstatus?"up":"ring",n?_.merge(n,e):e.channel&&o.calls.rows.push(e)},o.onRemove=function(e){var n=_.findIndex(o.calls.rows,{channel:e.channel});0<=n&&(o.calls.rows[n].status="hangup");t(function(){o.calls.rows.splice(n,1)},5e3)},a.on("voice_outbound_channel:save",o.onSave),a.on("voice_outbound_channel:remove",o.onRemove),e.$on("$destroy",function(){a.removeAllListeners("voice_outbound_channel:save"),a.removeAllListeners("voice_outbound_channel:remove")})}e.$inject=["$scope","$timeout","api","socket","rpcCalls","helperClasses"],angular.module("app.voice").controller("OutboundCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,n,a,o,t,i,s,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.queues=t?_.keyBy(t.rows?t.rows:[],"name"):{},p.rpcVoiceQueuesChannelsTmp=i?_.keyBy(i.rows?_.filter(i.rows,{type:"inbound"}):[],"uniqueid"):{},p.rpcVoiceQueuesChannels={},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.queryChannels={limit:10,page:1},p.getAvailableAgents=function(){p.availableAgents=null,s.rpc.getAgents().$promise.then(function(e){for(var n=[],t=e?e.rows:[],a=_.filter(t,{online:!0,voicePause:!1,voiceStatus:"idle"}),i=0;i<a.length;i++){var s=_.find(o.rows,["id",a[i].id]);s&&n.push(s)}p.availableAgents=n}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.getSize=function(e){return _.size(e)},p.$onInit=function(){_.forIn(p.rpcVoiceQueuesChannelsTmp,function(e,n){_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[n]=e)})},p.onSave=function(e){"inbound"===e.type&&_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[e.uniqueid]=e)},p.onRemove=function(e){p.rpcVoiceQueuesChannels[e.uniqueid]&&delete p.rpcVoiceQueuesChannels[e.uniqueid]},p.hangup=function(n){return s.rpc.getVoiceQueuesChannelHangup({uniqueid:n}).$promise.then(function(e){d.success({title:"Channel "+n+" properly hangup!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToAgent=function(n,e,t){return s.rpc.getVoiceQueuesChannelRedirect({uniqueid:n,exten:e,context:t}).$promise.then(function(e){d.success({title:"Channel "+n+" properly redirect!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToNumber=function(e,n){var t=a.prompt().title("Which number do you want transfer the call to?").placeholder("Number").targetEvent(e).ok("Ok").cancel("Cancel");return a.show(t).then(function(e){return s.rpc.getVoiceQueuesChannelRedirect({uniqueid:n,exten:e}).$promise}).then(function(e){d.success({title:"Channel "+n+" properly redirect!",msg:e.message||""})}).catch(function(e){e&&d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},r.on("voice_queue_channel:save",p.onSave),r.on("voice_queue_channel:remove",p.onRemove),e.$on("$destroy",function(){r.removeAllListeners("voice_queue_channel:save"),r.removeAllListeners("voice_queue_channel:remove")})}e.$inject=["$scope","$timeout","$mdDialog","agents","queues","rpcVoiceQueuesChannels","api","socket","helperClasses","toasty","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("QueueCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["total","answered","unmanaged","abandoned","sumHoldTime","sumDuration","sumBillable"];function u(){_.forIn(c.queues,function(e,n){c.rpcQueues[n]&&_.merge(e,_.pick(c.rpcQueues[n],m))})}c.count=a.count,c.queues=a?_.keyBy(a.rows?a.rows:[],"id"):{},c.rpcQueues=i?_.keyBy(i.rows?i.rows:[],"id"):{},c.userProfile=r,c.userProfileSection=l&&1==l.count?l.rows[0]:null,c.crudPermissions=d.parseCrudPermissions(c.userProfileSection?c.userProfileSection.crudPermissions:null),d.hasRole("admin")?c.query={type:"inbound",fields:"id,name",sort:"-updatedAt",limit:10,page:1}:c.query={id:d.getCurrentUser().id,channel:"voice",type:"inbound",fields:"id,name",sort:"-updatedAt",limit:10,page:1},c.success=v,c.getQueues=function(){c.query.offset=(c.query.page-1)*c.query.limit,d.hasRole("admin")?c.promise=s.voiceQueue.get(c.query,v).$promise:(c.query.id=c.userProfile.id,c.query.section="VoiceQueues",c.promise=s.userProfile.getResources(c.query,v).$promise)},c.onSave=function(e){c.queues[e.id]&&_.merge(c.queues[e.id],_.pick(e,m))},c.$onInit=u,o.onWithoutApply("voice_queue:save",c.onSave),c.interval=n(function(){},999);var p=!0,g=1;function v(e){c.count=e.count,c.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},u()}e.$watch("vm.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=g),c.getQueues())}),e.$on("$destroy",function(){o.removeAllListeners("voice_queue:save"),c.interval&&n.cancel(c.interval)})}e.$inject=["$scope","$timeout","$interval","queues","rpcQueues","api","socket","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("QueueParamsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"VoiceQueues":void 0,channel:"voice",type:"inbound",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("VOICE.VOICEQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditVoiceQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceQueue:n,voiceQueues:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceQueue:n,voiceQueues:u.queues.rows,realtime:!0,crudPermissions:u.crudPermissions}})},r.onWithoutApply("voice_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&m.updateVoiceQueue(e,n)}),r.on("userVoiceQueue:save",function(e){var n=_.find(u.queues.rows,["id",e.VoiceQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("userVoiceQueue:remove",function(e){var n=_.find(u.queues.rows,["id",e.VoiceQueueId]);n&&(0<n.loggedInDb&&n.loggedInDb--,_.remove(n.agents,["id",e.UserId]))}),r.on("user:agentconnect",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);if(n){if(!t.agentconnected)return;t.queue?n.talking=!0:n.busy=!0,m.updateBusyCounter(e)}})}),r.on("user:agentcomplete",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&(n.talking?n.talking=!1:n.busy&&(n.busy=!1),m.updateBusyCounter(e))})}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"voice")})}),e.$on("$destroy",function(){r.removeAllListeners("voice_queue:save"),r.removeAllListeners("userVoiceQueue:remove"),r.removeAllListeners("userVoiceQueue:save"),r.removeAllListeners("user:agentconnect"),r.removeAllListeners("user:agentcomplete"),r.removeAllListeners("user:update"),p&&n.cancel(p)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.voice").controller("QueuesVoiceRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){var a=this;switch(a.selectedTab=0,t.current.name){case"app.voice.realtime.agents":a.selectedTab=0;break;case"app.voice.realtime.telephones":a.selectedTab=1;break;case"app.voice.realtime.trunks":a.selectedTab=2;break;case"app.voice.realtime.queues":a.selectedTab=3;break;case"app.voice.realtime.queue_calls":a.selectedTab=4;break;case"app.voice.realtime.abandonedcalls":a.selectedTab=5;break;case"app.voice.realtime.queue_params":a.selectedTab=6;break;case"app.voice.realtime.outbound_calls":a.selectedTab=7;break;default:a.selectedTab=0,t.go("app.voice.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.voice.realtime.agents");break;case 1:t.go("app.voice.realtime.telephones");break;case 2:t.go("app.voice.realtime.trunks");break;case 3:t.go("app.voice.realtime.queues");break;case 4:t.go("app.voice.realtime.queue_calls");break;case 5:t.go("app.voice.realtime.abandonedcalls");break;case 6:t.go("app.voice.realtime.queue_params");break;case 7:t.go("app.voice.realtime.outbound_calls");break;default:t.go("app.voice.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.voice").controller("VoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c){var m=this,u=["fullname","internal","state","status"];function p(){_.forIn(m.telephones,function(e,n){m.rpcTelephones[n]&&_.merge(e,_.pick(m.rpcTelephones[n],u))})}m.count=a.count,m.attributes=["fullname","internal","state","status","address"],m.telephones=a?_.keyBy(a.rows?a.rows:[],"id"):{},m.rpcTelephones=i?_.keyBy(i.rows?i.rows:[],"id"):{},m.userProfile=l,m.userProfileSection=d&&1==d.count?d.rows[0]:null,m.crudPermissions=c.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={fields:"id,fullname,internal",role:"telephone",sort:"-updatedAt",limit:10,page:1},m.statusClass=r.status,m.stateClass=r.state,m.success=h,m.$onInit=p,m.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},m.getTelephones=function(){m.query.offset=(m.query.page-1)*m.query.limit,c.hasRole("admin")?m.promise=s.user.get(m.query,h).$promise:(m.query.id=m.userProfile.id,m.query.section="Telephones",m.promise=s.userProfile.getResources(m.query,h).$promise)},m.onSave=function(e){m.telephones[e.id]&&_.merge(m.telephones[e.id],_.pick(e,u))},o.on("telephone:save",m.onSave);var g=!0,v=1;function h(e){m.telephones=e?_.keyBy(e.rows?e.rows:[],"id"):{},p()}e.$watch("vm.query.filter",function(e,n){g?t(function(){g=!1}):(n||(v=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=v),m.getTelephones())}),e.$on("$destroy",function(){o.removeAllListeners("telephone:save")})}e.$inject=["$scope","$timeout","$mdDialog","telephones","rpcTelephones","api","socket","helperClasses","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("TelephonesVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m){var u=this,p=["status","stateRegistry","registry","host","port","internal","state","status"];function g(){for(var e,n=0;n<u.trunks.length;n+=1)0<=(e=_.findIndex(u.rpcTrunks,["id",u.trunks[n].id]))&&_.merge(u.trunks[n],_.pick(u.rpcTrunks[e],p))}function v(e,n,t){0<=n&&_.merge(e[n],_.pick(t,p))}u.currentUser=m.getCurrentUser(),u.count=a.count,u.trunks=a?a.rows:[],u.rpcTrunks=i&&i.rows?i.rows:[],u.query={fields:"id,name",active:!0,sort:"-updatedAt",limit:10,page:1},u.statusClass=r.status,u.stateClass=r.state,u.userProfile=d,u.userProfileSection=c&&1==c.count?c.rows[0]:null,u.crudPermissions=m.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.success=b,u.$onInit=g,u.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},u.getTrunks=function(){u.query.offset=(u.query.page-1)*u.query.limit,m.hasRole("admin")?u.promise=s.trunk.get(u.query,b).$promise:(u.query.id=u.userProfile.id,u.query.section="Trunks",u.promise=s.userProfile.getResources(u.query,b).$promise)},u.goToTrunk=function(e,n){l.go("app.tools.trunks.edit",{id:n.id})},u.onSave=function(e){var n=_.findIndex(u.trunks,["id",e.id]),t=_.findIndex(u.rpcTrunks,["id",e.id]);v(u.trunks,n,e),v(u.rpcTrunks,t,e)},o.on("trunk:save",u.onSave);var h=!0,f=1;function b(e){u.count=e.count,u.trunks=e&&e.rows?e.rows:[],g()}e.$watch("vm.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=u.query.page),e!==n&&(u.query.page=1),e||(u.query.page=f),u.getTrunks())}),e.$on("$destroy",function(){o.removeAllListeners("trunk:save")})}e.$inject=["$scope","$timeout","$mdDialog","trunks","rpcTrunks","api","socket","helperClasses","$state","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("TrunksVoiceRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_VOICEMAIL",g.voicemail=angular.copy(l),g.voicemails=r,g.newVoicemail=!1,g.voicemail||(g.voicemail={attach:"no"},g.title="VOICE.NEW_VOICEMAIL",g.newVoicemail=!0),g.addNewVoicemail=function(){g.errors=[],d.voiceMail.save(g.voicemail).$promise.then(function(e){g.voicemails.unshift(e.toJSON()),o.success({title:"Voicemail properly created",msg:g.voicemail.name?g.voicemail.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMail.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVoicemail=function(){g.errors=[],d.voiceMail.update({id:g.voicemail.id},g.voicemail).$promise.then(function(e){var n=_.find(g.voicemails,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Voicemail properly saved!",msg:g.voicemail.name?g.voicemail.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMail.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVoicemail=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The voicemail will be deleted.").ariaLabel("Delete Voicemail").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceMail.delete({id:g.voicemail.id}).$promise.then(function(){_.remove(g.voicemails,{id:g.voicemail.id}),o.success({title:"Voicemail properly deleted!",msg:(g.voicemail.name||"voicemail")+" has been deleted!"}),v(g.voicemail)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMail.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voicemails","voicemail","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditVoicemailDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.voicemailMessages=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceMail.getMessages(m.query,u).$promise}function g(e){d.voiceMailMessage.delete({id:e.id}).$promise.then(function(){_.remove(m.voicemailMessages.rows,{id:e.id}),m.voicemailMessages.count-=1,m.voicemailMessages.rows.length||p(),l.success({title:"Message deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceMail"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMail",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.voicemail={},m.voicemailMessages={count:0,rows:[]},m.selectedVoicemailMessages=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,callerid,duration,audio,stamp,msg_id",sort:"-stamp",limit:10,page:1},m.init=function(e,n){m.voicemail=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.id=m.voicemail.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the message?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("message #")+e.id||"message")+"</b> will be deleted.").ariaLabel("delete message").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.voiceMailMessageDownload=function(s,e,n){return d.voiceMailMessage.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="message"+s.id,a=new Blob(n,{type:e.type});t=s.msg_id+".wav";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=u,m.getVoicemailMessages=p,m.createOrEditVoicemailMessage=function(e,n){o.show({controller:"CreateOrEditMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicemails/edit/messages/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{voicemail:m.voicemail,message:n,messages:m.voicemailMessages.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedVoicemailMessages=function(){var e=angular.copy(m.selectedVoicemailMessages);return m.selectedVoicemailMessages=[],e},m.deleteVoicemailMessage=g,m.deleteSelectedVoicemailMessages=function(e){var n=o.confirm().title("Are you sure want to delete the selected messages?").htmlContent("<b>"+m.selectedVoicemailMessages.length+" selected</b> will be deleted.").ariaLabel("delete messages").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedVoicemailMessages.forEach(function(e){g(e)}),m.selectedVoicemailMessages=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.voice").controller("VoicemailMessagesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.voicemail=c||e.params.voicemail||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoVoicemails=function(){e.go("app.voice.voicemails",{},{reload:"app.voice.voicemails"})},u.saveVoicemail=function(){r.voiceMail.update({id:u.voicemail.id},u.voicemail).$promise.then(function(){l.success({title:"Voicemail updated!",msg:u.voicemail.name?u.voicemail.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMail",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),t=null;if(u.voicemail&&(t=_.find(u.contexts,{name:u.voicemail.context})),t&&!_.some(n,["id",t.id])){var a=_.find(u.contexts,{id:t.id});a.canSelect=!1,n.push(a)}u.contexts=n}):r.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){u.contexts=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","voicemail","userProfileSection"],angular.module("app.voice").controller("VoicemailController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.voicemails=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="voicemails",f.listOrder="",f.listOrderAsc=null,f.selectedVoicemails=[],f.query={fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",sort:"-updatedAt",limit:10,page:1},f.arrayattach=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayenvelope=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydelete=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.voice.voicemails.edit",{id:e.id,voicemail:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voicemail")+"?").htmlContent("<b>"+(e.name||"voicemail")+"</b> will be deleted.").ariaLabel("delete voicemail").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVoicemails=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceMail.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Voicemails",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVoicemail=function(e,n){i.show({controller:"CreateOrEditVoicemailDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicemails/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voicemail:n,voicemails:f.voicemails.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteVoicemail=y,f.exportSelectedVoicemails=function(){var e=angular.copy(f.selectedVoicemails);return f.selectedVoicemails=[],e},f.deleteSelectedVoicemails=function(e){var n=i.confirm().title("Are you sure want to delete the selected voicemails?").htmlContent("<b>"+f.selectedVoicemails.length+" selected</b> will be deleted.").ariaLabel("delete Voicemails").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVoicemails.forEach(function(e){y(e)}),f.selectedVoicemails=[]})},f.deselectVoicemails=function(){f.selectedVoicemails=[]},f.selectAllVoicemails=function(){f.selectedVoicemails=f.voicemails.rows};var b=!0,A=1;function E(e){f.voicemails=e||{count:0,rows:[]}}function y(e){m.voiceMail.delete({id:e.id}).$promise.then(function(){_.remove(f.voicemails.rows,{id:e.id}),f.voicemails.count-=1,f.voicemails.rows.length||f.getVoicemails(),p.success({title:_.startCase("Voicemail")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceMail"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceMail",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVoicemails())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voicemails","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("VoicemailsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_VOICEPREFIX",g.voicePrefix=angular.copy(l),g.voicePrefixes=r,g.newvoicePrefix=!1,g.voicePrefix||(g.voicePrefix={},g.title="VOICE.NEW_VOICEPREFIX",g.newvoicePrefix=!0),g.addNewvoicePrefix=function(){g.errors=[],d.voicePrefix.save(g.voicePrefix).$promise.then(function(e){g.voicePrefixes.unshift(e.toJSON()),o.success({title:"voicePrefix properly created",msg:g.voicePrefix.name?g.voicePrefix.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voicePrefix.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voicePrefix.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savevoicePrefix=function(){g.errors=[],d.voicePrefix.update({id:g.voicePrefix.id},g.voicePrefix).$promise.then(function(e){var n=_.find(g.voicePrefixes,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"voicePrefix properly saved!",msg:g.voicePrefix.name?g.voicePrefix.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voicePrefix.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voicePrefix.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletevoicePrefix=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The voicePrefix will be deleted.").ariaLabel("Delete voicePrefix").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voicePrefix.delete({id:g.voicePrefix.id}).$promise.then(function(){_.remove(g.voicePrefixes,{id:g.voicePrefix.id}),o.success({title:"voicePrefix properly deleted!",msg:(g.voicePrefix.name||"voicePrefix")+" has been deleted!"}),v(g.voicePrefix)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voicePrefix.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voicePrefix.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){g.outboundRoutes=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){g.outboundRoutes=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.outboundRoutes,{id:e.resourceId})}),t=null;if(g.voicePrefix&&(t=_.find(g.outboundRoutes,{id:Number(g.voicePrefix.VoiceExtensionId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.outboundRoutes,{id:t.id});a.canSelect=!1,n.push(a)}g.outboundRoutes=n})}else{var t=[],a=null;g.voicePrefix&&(a=_.find(g.outboundRoutes,{id:Number(g.voicePrefix.VoiceExtensionId)}));for(var i=0;i<g.outboundRoutes.length;i++)a&&g.outboundRoutes[i].id===a.id&&(g.outboundRoutes[i].canSelect=!1,t.push(g.outboundRoutes[i]));g.outboundRoutes=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GEToutboundRoutes",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voicePrefixes","voicePrefix","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditvoicePrefixDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.voicePrefix.getAgents({id:c.voicePrefix.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UservoicePrefix?"penalty "+e.UservoicePrefix.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.voicePrefix=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.removeAgents({id:c.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.addAgents({id:c.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("VOICE.ALL_AGENTS"),labelSelected:r.instant("VOICE.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","voicePrefix","voicePrefixes","realtime","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("voicePrefixagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.voicePrefix.getTeams({id:l.voicePrefix.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.voicePrefix=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("VOICE.ALL_TEAMS"),labelSelected:t.instant("VOICE.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.removeTeams({id:l.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.addTeams({id:l.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","voicePrefix","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("voicePrefixteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.voicePrefixes=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="voicePrefixes",f.listOrder="",f.listOrderAsc=null,f.selectedVoicePrefixes=[],f.query={fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditvoicePrefixDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:f.voicePrefixes.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"voicePrefixagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:f.voicePrefixes?f.voicePrefixes.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.teamadddialog=function(e,n){i.show({controller:"voicePrefixteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:f.voicePrefixes?f.voicePrefixes.rows:[],crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voicePrefix")+"?").htmlContent("<b>"+(e.name||"voicePrefix")+"</b> will be deleted.").ariaLabel("delete voicePrefix").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVoicePrefixes=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voicePrefix.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="VoicePrefixes",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditvoicePrefix=function(e,n){i.show({controller:"CreateOrEditvoicePrefixDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voicePrefix:n,voicePrefixes:f.voicePrefixes.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletevoicePrefix=y,f.exportSelectedVoicePrefixes=function(){var e=angular.copy(f.selectedVoicePrefixes);return f.selectedVoicePrefixes=[],e},f.deleteSelectedVoicePrefixes=function(e){var n=i.confirm().title("Are you sure want to delete the selected voicePrefixes?").htmlContent("<b>"+f.selectedVoicePrefixes.length+" selected</b> will be deleted.").ariaLabel("delete voicePrefixs").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVoicePrefixes.forEach(function(e){y(e)}),f.selectedVoicePrefixes=[]})},f.deselectVoicePrefixes=function(){f.selectedVoicePrefixes=[]},f.selectAllVoicePrefixes=function(){f.selectedVoicePrefixes=f.voicePrefixes.rows},g.hasRole("admin")?m.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){f.outboundRoutes=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){f.outboundRoutes=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.outboundRoutes,{id:e.resourceId})}),t=null;if(f.voicePrefix&&(t=_.find(f.outboundRoutes,{id:Number(f.voicePrefix.VoiceExtensionId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.outboundRoutes,{id:t.id});a.canSelect=!1,n.push(a)}f.outboundRoutes=n})}else{var t=[],a=null;f.voicePrefix&&(a=_.find(f.outboundRoutes,{id:Number(f.voicePrefix.VoiceExtensionId)}));for(var i=0;i<f.outboundRoutes.length;i++)a&&f.outboundRoutes[i].id===a.id&&(f.outboundRoutes[i].canSelect=!1,t.push(f.outboundRoutes[i]));f.outboundRoutes=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GEToutboundRoutes",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.voicePrefixes=e||{count:0,rows:[]}}function y(e){m.voicePrefix.delete({id:e.id}).$promise.then(function(){_.remove(f.voicePrefixes.rows,{id:e.id}),f.voicePrefixes.count-=1,f.voicePrefixes.rows.length||f.getVoicePrefixes(),p.success({title:_.startCase("voicePrefix")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoicePrefix"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoicePrefix",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVoicePrefixes())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voicePrefixes","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("VoicePrefixesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_VOICEQUEUE",g.voiceQueue=angular.copy(l),g.voiceQueues=r,g.newVoiceQueue=!1,g.voiceQueue||(g.voiceQueue={type:"inbound",strategy:"ringall",timeout:15,retry:2,random_periodic_announce:"no",announce_holdtime:"no",announce_position:"no",reportholdtime:"no",autopause:"no",ringinuse:"no",timeoutrestart:"no",setinterfacevar:"no",setqueuevar:"no",setqueueentryvar:"no"},g.title="VOICE.NEW_VOICEQUEUE",g.newVoiceQueue=!0),g.addNewVoiceQueue=function(){g.errors=[],d.voiceQueue.save(g.voiceQueue).$promise.then(function(e){g.voiceQueues.unshift(e.toJSON()),o.success({title:"VoiceQueue properly created",msg:g.voiceQueue.name?g.voiceQueue.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVoiceQueue=function(){g.errors=[],d.voiceQueue.update({id:g.voiceQueue.id},g.voiceQueue).$promise.then(function(e){var n=_.find(g.voiceQueues,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"VoiceQueue properly saved!",msg:g.voiceQueue.name?g.voiceQueue.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVoiceQueue=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The voiceQueue will be deleted.").ariaLabel("Delete VoiceQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceQueue.delete({id:g.voiceQueue.id}).$promise.then(function(){_.remove(g.voiceQueues,{id:g.voiceQueue.id}),o.success({title:"VoiceQueue properly deleted!",msg:(g.voiceQueue.name||"voiceQueue")+" has been deleted!"}),v(g.voiceQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voiceQueues","voiceQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditVoiceQueueDialogController",e)}(),function(){"use strict";function e(e,l,a,d,n,t,i,s,o,r){var c=this;function m(){return l(function(t,n){return l(function(n,t){return d.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(n,t){return d.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:o.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),l(function(n,t){return d.voiceQueue.getAgents({id:c.voiceQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=o.getCurrentUser(),c.voiceQueue=n,c.crudPermissions=r,c.penalty=0,c.realtime=i,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return o.hasRole("admin")?m().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):l(function(t,n){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,l(function(e,n){_.isEmpty(t)?e():d.voiceQueue.removeAgents({id:c.voiceQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return r=n,l(function(e,n){if(_.isEmpty(r))e();else{for(var t=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);t.push(d.voiceQueue.addAgents({id:c.voiceQueue.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty "),realtime:c.realtime||!1}).$promise)}l.all(t).then(function(){e()}).catch(function(e){n(e)})}});var r}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),a.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("VOICE.ALL_AGENTS"),labelSelected:s.instant("VOICE.SELECTED_AGENTS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var t=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","voiceQueue","voiceQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("VoiceQueueagentaddController",e)}(),function(){"use strict";function e(e,i,a,s,n,t,o,r){var l=this;function d(){return i(function(t,n){return i(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:i(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),i(function(n,t){return s.voiceQueue.getTeams({id:l.voiceQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.voiceQueue=n,l.crudPermissions=r,l.penalty=0,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"penalty",labelAll:t.instant("VOICE.ALL_TEAMS"),labelSelected:t.instant("VOICE.SELECTED_TEAMS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+l.penalty});var t=_.xorWith(l.startingSelectedItems,l.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):i(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceWith(l.selectedItems,l.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,i(function(e,n){_.isEmpty(t)?e():s.voiceQueue.removeTeams({id:l.voiceQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return a=n,i(function(e,n){if(!_.isEmpty(a)){var t=_.map(a,function(e){return{id:e.id,penalty:_.trim(e.penalty,"penalty ")}});return s.voiceQueue.addTeams({id:l.voiceQueue.id,teams:t}).$promise.then(function(){e()}).catch(function(e){n(e)})}e()});var a}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),a.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","voiceQueue","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("VoiceQueueteamaddController",e)}(),function(){"use strict";function e(t,e,a,i,s,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.voiceQueue=c||t.params.voiceQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.teamadddialog=function(e,n){a.show({controller:"VoiceQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:u.voiceQueues?u.voiceQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){a.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:u.voiceQueues?u.voiceQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.queues",{}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.queues",{})}},u.alert=l.info,u.gotoVoiceQueues=function(){t.go("app.voice.voiceQueues",{},{reload:"app.voice.voiceQueues"})},u.saveVoiceQueue=function(){r.voiceQueue.update({id:u.voiceQueue.id},u.voiceQueue).$promise.then(function(){l.success({title:"VoiceQueue updated!",msg:u.voiceQueue.name?u.voiceQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MUSICONHOLDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:407}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.musiconholds,{id:e.resourceId})}),t=null;if(u.voiceQueue&&(t=_.find(u.musiconholds,{name:u.voiceQueue.musiconhold})),t&&!_.some(n,["id",t.id])){var a=_.find(u.musiconholds,{id:t.id});a.canSelect=!1,n.push(a)}u.musiconholds=n}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true",defaultEntry:1}).$promise.then(function(e){u.musiconholds=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmusiconholds",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.sound.get({fields:"id,name,save_name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.sounds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.sound.get({fields:"id,name,save_name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.sounds=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.sounds,{id:e.resourceId})});u.sounds.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.sounds=n})}else u.sounds=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.pauses=n})}else u.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","voiceQueue","userProfileSection"],angular.module("app.voice").controller("VoiceQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.voiceQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="voiceQueues",f.listOrder="",f.listOrderAsc=null,f.selectedVoiceQueues=[],f.query={fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Ringall",value:"'ringall'"},{option:"Round Robin Memory",value:"'rrmemory'"},{option:"Least Recent",value:"'leastrecent'"},{option:"Fewest Calls",value:"'fewestcalls'"},{option:"Random",value:"'random'"},{option:"Linear",value:"'linear'"},{option:"Weight Random",value:"'wrandom'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayjoinempty=_.keyBy([{option:"no",value:"'no'",disabled:"vm.voiceQueue.joinempty.length === 1  && vm.voiceQueue.joinempty[0] === 'no'"},{option:"yes",value:"'yes'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'yes'"},{option:"strict",value:"'strict'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'strict'"},{option:"loose",value:"'loose'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'loose'"},{option:"paused",value:"'paused'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'paused'"},{option:"penalty",value:"'penalty'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'penalty'"},{option:"inuse",value:"'inuse'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'inuse'"},{option:"ringing",value:"'ringing'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'ringing'"},{option:"unavailable",value:"'unavailable'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'unavailable'"},{option:"invalid",value:"'invalid'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'invalid'"},{option:"unknown",value:"'unknown'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'unknown'"},{option:"wrapup",value:"'wrapup'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'wrapup'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayleavewhenempty=_.keyBy([{option:"no",value:"'no'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'no'"},{option:"yes",value:"'yes'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'yes'"},{option:"strict",value:"'strict'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'strict'"},{option:"loose",value:"'loose'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'loose'"},{option:"paused",value:"'paused'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'paused'"},{option:"penalty",value:"'penalty'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'penalty'"},{option:"inuse",value:"'inuse'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'inuse'"},{option:"ringing",value:"'ringing'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'ringing'"},{option:"unavailable",value:"'unavailable'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'unavailable'"},{option:"invalid",value:"'invalid'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'invalid'"},{option:"unknown",value:"'unknown'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'unknown'"},{option:"wrapup",value:"'wrapup'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'wrapup'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayrandom_periodic_announce=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayannounce_holdtime=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Once",value:"'once'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayannounce_position=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Limit",value:"'limit'"},{option:"More",value:"'more'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayreportholdtime=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayautopause=_.keyBy([{option:"Yes",value:"'all'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayringinuse=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytimeoutrestart=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymonitor_format=_.keyBy([{option:"Inactive",value:"''"},{option:"wav",value:"'wav'"},{option:"wav49",value:"'wav49'"},{option:"gsm",value:"'gsm'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetinterfacevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueuevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueueentryvar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.voice.voiceQueues.edit",{id:e.id,voiceQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"VoiceQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:f.voiceQueues?f.voiceQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:f.voiceQueues?f.voiceQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voiceQueue")+"?").htmlContent("<b>"+(e.name||"voiceQueue")+"</b> will be deleted.").ariaLabel("delete voiceQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.queues",{})}},f.success=E,f.getVoiceQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="VoiceQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVoiceQueue=function(e,n){i.show({controller:"CreateOrEditVoiceQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceQueue:n,voiceQueues:f.voiceQueues.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteVoiceQueue=y,f.exportSelectedVoiceQueues=function(){var e=angular.copy(f.selectedVoiceQueues);return f.selectedVoiceQueues=[],e},f.deleteSelectedVoiceQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected voiceQueues?").htmlContent("<b>"+f.selectedVoiceQueues.length+" selected</b> will be deleted.").ariaLabel("delete VoiceQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVoiceQueues.forEach(function(e){y(e)}),f.selectedVoiceQueues=[]})},f.deselectVoiceQueues=function(){f.selectedVoiceQueues=[]},f.selectAllVoiceQueues=function(){f.selectedVoiceQueues=f.voiceQueues.rows};var b=!0,A=1;function E(e){f.voiceQueues=e||{count:0,rows:[]}}function y(e){m.voiceQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.voiceQueues.rows,{id:e.id}),f.voiceQueues.count-=1,f.voiceQueues.rows.length||f.getVoiceQueues(),p.success({title:_.startCase("VoiceQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVoiceQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voiceQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("VoiceQueuesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_VOICERECORDING",g.voiceRecording=angular.copy(l),g.voiceRecordings=r,g.newVoiceRecording=!1,g.voiceRecording||(g.voiceRecording={},g.title="VOICE.NEW_VOICERECORDING",g.newVoiceRecording=!0),g.addNewVoiceRecording=function(){g.errors=[],d.voiceRecording.save(g.voiceRecording).$promise.then(function(e){g.voiceRecordings.unshift(e.toJSON()),o.success({title:"VoiceRecording properly created",msg:g.voiceRecording.name?g.voiceRecording.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceRecording.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVoiceRecording=function(){g.errors=[],d.voiceRecording.update({id:g.voiceRecording.id},g.voiceRecording).$promise.then(function(e){var n=_.find(g.voiceRecordings,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"VoiceRecording properly saved!",msg:g.voiceRecording.name?g.voiceRecording.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceRecording.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVoiceRecording=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The voiceRecording will be deleted.").ariaLabel("Delete VoiceRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceRecording.delete({id:g.voiceRecording.id}).$promise.then(function(){_.remove(g.voiceRecordings,{id:g.voiceRecording.id}),o.success({title:"VoiceRecording properly deleted!",msg:(g.voiceRecording.name||"voiceRecording")+" has been deleted!"}),v(g.voiceRecording)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceRecording.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voiceRecordings","voiceRecording","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditVoiceRecordingDialogController",e)}(),function(){"use strict";function e(e,n){var t=this;t.voiceRecording={},t.init=function(e){t.voiceRecording=e}}e.$inject=["api","toasty"],angular.module("app.voice").controller("VoiceRecordingSentimentStatisticsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.voiceRecording=c||e.params.voiceRecording||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.alert=l.info,p.gotoVoiceRecordings=function(){e.go("app.voice.voiceRecordings",{},{reload:"app.voice.voiceRecordings"})},p.saveVoiceRecording=function(){r.voiceRecording.update({id:p.voiceRecording.id},p.voiceRecording).$promise.then(function(){l.success({title:"VoiceRecording updated!",msg:p.voiceRecording.name?p.voiceRecording.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","voiceRecording","userProfile","userProfileSection"],angular.module("app.voice").controller("VoiceRecordingController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,l,r,d,c,m,u,p,g,v,h,f){var b=this;function A(n,e){return m.voiceRecording.runTranscribe({id:n.id,runSentiment:!1}).$promise.then(function(e){p.success({title:l.instant("VOICE.RUNTRANSCRIBE_VOICERECORDING"),msg:l.instant("VOICE.RUNTRANSCRIBE_VOICERECORDING")+" succeded!"}),n.transcribeStatus=e.transcribeStatus}).catch(function(e){p.error({title:l.instant("VOICE.RUNTRANSCRIBE_VOICERECORDING"),msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})}function E(n,e){return m.voiceRecording.runTranscribe({id:n.id,runSentiment:!0}).$promise.then(function(e){p.success({title:l.instant("VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING"),msg:l.instant("VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING")+" succeded!"}),n.transcribeStatus=e.transcribeStatus}).catch(function(e){p.error({title:l.instant("VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING"),msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})}function y(e,n){return m.voiceRecording.runTranscribe({id:e.id,runSentiment:!0}).$promise.then(function(e){p.success({title:l.instant("VOICE.RUNSENTIMENT_VOICERECORDING"),msg:l.instant("VOICE.RUNSENTIMENT_VOICERECORDING")+" succeded!"})}).catch(function(e){p.error({title:l.instant("VOICE.RUNSENTIMENT_VOICERECORDING"),msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})}b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.voiceRecordings=r||{count:0,rows:[]},b.userProfile=d,b.userProfileSection=c&&1==c.count?c.rows[0]:null,b.crudPermissions=g.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.table="voiceRecordings",b.listOrder="",b.listOrderAsc=null,b.selectedVoiceRecordings=[],b.query={fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",sort:"-createdAt",createdAt:"@msUtils.firstLastDayMonth()",limit:10,page:1},b.query.createdAt=u.firstLastDayMonth(),b.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE_RANGE"}],b.editstate=function(e,n){t.go("app.voice.voiceRecordings.edit",{id:e.id,voiceRecording:e,crudPermissions:b.crudPermissions})},b.runtranscriberuntranscribesentiment=A,b.runtranscribesentimentruntranscribesentiment=E,b.runsentimentruntranscribesentiment=y,b.downloadtranscribefile2=function(s,e){var t=!1,n=_.isNil(s.format)?s.value.substring(s.value.lastIndexOf(".")):s.format;t=".mp4"===n;-1<s.value.lastIndexOf("/")?s.value.substring(s.value.lastIndexOf("/")+1):-1<s.value.lastIndexOf("\\")?s.value.substring(s.value.lastIndexOf("\\")+1):s.value;return m.voiceRecording.downloadTranscribe({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.uniqueid+".txt";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"404"===String(e.status)&&!1===t?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.WRONG_EXTENSION")}):"404"===String(e.status)?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.FILE_NOT_FOUND")}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.downloadfile2=function(r,e){var t=!1,n=_.isNil(r.format)?r.value.substring(r.value.lastIndexOf(".")):r.format;t=".mp4"===n;-1<r.value.lastIndexOf("/")?r.value.substring(r.value.lastIndexOf("/")+1):-1<r.value.lastIndexOf("\\")?r.value.substring(r.value.lastIndexOf("\\")+1):r.value;return m.voiceRecording.download({id:r.id}).$promise.then(function(e){var n,t,a=[e.buffer],i="download",s=new Blob(a,{type:e.type});n=r.value,t=-1<n.lastIndexOf("/")?n.substring(n.lastIndexOf("/")+1):-1<n.lastIndexOf("\\")?n.substring(n.lastIndexOf("\\")+1):n,i=(t=t.substring(0,t.lastIndexOf(".")))+r.format;var o=window.document.createElement("a");o.setAttribute("href",URL.createObjectURL(s)),o.setAttribute("download",i),document.body.appendChild(o),o.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"404"===String(e.status)&&!1===t?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.WRONG_EXTENSION")}):"404"===String(e.status)?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.FILE_NOT_FOUND")}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voiceRecording")+"?").htmlContent("<b>"+(e.name||"voiceRecording")+"</b> will be deleted.").ariaLabel("delete voiceRecording").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){O(e)},function(){console.log("CANCEL")})},b.success=I,b.getVoiceRecordings=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceRecording.get(b.query,I).$promise:(b.query.id=b.userProfile.id,b.query.section="VoiceRecordings",b.promise=m.userProfile.getResources(b.query,I).$promise)},b.createOrEditVoiceRecording=function(e,n){i.show({controller:"CreateOrEditVoiceRecordingDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceRecordings/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceRecording:n,voiceRecordings:b.voiceRecordings.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteVoiceRecording=O,b.exportSelectedVoiceRecordings=function(){var e=angular.copy(b.selectedVoiceRecordings);b.selectedVoiceRecordings=[],b.userProfile.privacyEnabled&&_.forEach(e,function(e){e.calleridnum=f.mask(e.calleridnum),e.exten=f.mask(e.exten),e.connectedlinenum=f.mask(e.connectedlinenum),e.membername=f.mask(e.membername)});return e},b.deleteSelectedVoiceRecordings=function(e){var n=i.confirm().title("Are you sure want to delete the selected voiceRecordings?").htmlContent("<b>"+b.selectedVoiceRecordings.length+" selected</b> will be deleted.").ariaLabel("delete VoiceRecordings").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){b.selectedVoiceRecordings.forEach(function(e){O(e)}),b.selectedVoiceRecordings=[]})},b.deselectVoiceRecordings=function(){b.selectedVoiceRecordings=[]},b.selectAllVoiceRecordings=function(){b.selectedVoiceRecordings=b.voiceRecordings.rows},b.runtranscribeSelectedVoiceRecordings=function(n){b.selectedVoiceRecordings.forEach(function(e){A(e,n)}),b.selectedVoiceRecordings=[]},b.runtranscribesentimentSelectedVoiceRecordings=function(n){b.selectedVoiceRecordings.forEach(function(e){E(e,n)}),b.selectedVoiceRecordings=[]},b.runsentimentSelectedVoiceRecordings=function(n){b.selectedVoiceRecordings.forEach(function(e){y(e,n)}),b.selectedVoiceRecordings=[]};var S=!0,T=1;function I(e){b.voiceRecordings=e||{count:0,rows:[]}}function O(e){m.voiceRecording.delete({id:e.id}).$promise.then(function(){_.remove(b.voiceRecordings.rows,{id:e.id}),b.voiceRecordings.count-=1,b.voiceRecordings.rows.length||b.getVoiceRecordings(),p.success({title:_.startCase("VoiceRecording")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceRecording"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceRecording",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){S?o(function(){S=!1}):(n||(T=b.query.page),e!==n&&(b.query.page=1),e||(b.query.page=T),b.getVoiceRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voiceRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","privacyManager"],angular.module("app.voice").controller("VoiceRecordingsController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=["loggedIn","available","waiting","paused"],g=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"WhatsappQueues":void 0,channel:"whatsapp",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("WHATSAPP.WHATSAPPQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditWhatsappQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappQueue:n,whatsappQueues:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"WhatsappQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappQueue:n,whatsappQueues:u.queues.rows,realtime:!1,crudPermissions:u.crudPermissions}})},r.on("whatsapp_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,p))}),r.on("userWhatsappQueue:save",function(e){var n=_.find(u.queues.rows,["id",e.WhatsappQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("userWhatsappQueue:remove",function(e){var n=_.find(u.queues.rows,["id",e.WhatsappQueueId]);n&&(0<n.loggedInDb&&n.loggedInDb--,_.remove(n.agents,["id",e.UserId]))}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"whatsapp")})}),e.$on("$destroy",function(){r.removeAllListeners("whatsapp_queue:save"),r.removeAllListeners("userWhatsappQueue:remove"),r.removeAllListeners("userWhatsappQueue:save"),r.removeAllListeners("user:update"),g&&n.cancel(g)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.whatsapp").controller("QueuesWhatsappRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.whatsapp.realtime.agents":this.selectedTab=0;break;case"app.whatsapp.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.whatsapp.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.whatsapp.realtime.agents");break;case 1:t.go("app.whatsapp.realtime.queues");break;default:t.go("app.whatsapp.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.whatsapp").controller("WhatsappRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(){"twilio"===g.whatsappAccount.type&&(g.whatsappAccount.baseUrl=null)}function h(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="WHATSAPP.EDIT_WHATSAPPACCOUNT",g.whatsappAccount=angular.copy(l),g.whatsappAccounts=r,g.newWhatsappAccount=!1,g.whatsappAccount||(g.whatsappAccount={remote:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),type:"twilio",notificationSound:!0,queueTransferTimeout:300,waitForTheAssignedAgent:10,agentTransferTimeout:300},g.title="WHATSAPP.NEW_WHATSAPPACCOUNT",g.newWhatsappAccount=!0),n.params.id&&(g.whatsappAccount.WhatsappAccountId=n.params.id),g.addNewWhatsappAccount=function(){g.errors=[],v(),d.whatsappAccount.save(g.whatsappAccount).$promise.then(function(e){g.whatsappAccounts.unshift(e.toJSON()),o.success({title:"WhatsappAccount properly created",msg:g.whatsappAccount.name?g.whatsappAccount.name+" has been created!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveWhatsappAccount=function(){g.errors=[],v(),d.whatsappAccount.update({id:g.whatsappAccount.id},g.whatsappAccount).$promise.then(function(e){var n=_.find(g.whatsappAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"WhatsappAccount properly saved!",msg:g.whatsappAccount.name?g.whatsappAccount.name+" has been saved!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteWhatsappAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The whatsappAccount will be deleted.").ariaLabel("Delete WhatsappAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.whatsappAccount.delete({id:g.whatsappAccount.id}).$promise.then(function(){_.remove(g.whatsappAccounts,{id:g.whatsappAccount.id}),o.success({title:"WhatsappAccount properly deleted!",msg:(g.whatsappAccount.name||"whatsappAccount")+" has been deleted!"}),h(g.whatsappAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=h,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.whatsappAccount&&(t=_.find(g.lists,{id:Number(g.whatsappAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.whatsappAccount&&(a=_.find(g.lists,{id:Number(g.whatsappAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){g.pauses=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){g.pauses=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.pauses,{id:e.resourceId})});g.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),g.pauses=n})}else g.pauses=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","whatsappAccounts","whatsappAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.whatsapp").controller("CreateOrEditWhatsappAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.whatsappAccountApps.rows.length){var t=r.whatsappAccountApps.rows[n]?r.whatsappAccountApps.rows[n]:r.whatsappAccountApps.rows[0];i.show({controller:"EditWhatsappAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccountApp:t,whatsappAccount:r.whatsappAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.whatsappAccountApps.rows[n]=e:r.whatsappAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.whatsappAccountApps.rows.length;t++,0){var a=r.whatsappAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.whatsappAccount.context,a.exten=r.whatsappAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.whatsappAccount.addApplications({id:r.whatsappAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.whatsappAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.whatsappAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.whatsappAccount={},r.whatsappAccountApps={count:0,rows:[]},r.selectedWhatsappAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"WhatsappQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"whatsappQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:2102}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",nolimit:!0,role:"agent"},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]},{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:4,help:!0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.whatsappAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getWhatsappAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.whatsappAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getWhatsappAccountApps=function(){r.promise=o.whatsappAccount.getApplications(r.query,t).$promise},r.editWhatsappAccountApp=n,r.editInterval=function(e,n){if(r.whatsappAccountApps.rows.length){var t=r.whatsappAccountApps.rows[n]?r.whatsappAccountApps.rows[n]:r.whatsappAccountApps.rows[0];i.show({controller:"EditWhatsappAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteWhatsappAccountApp=function(e){_.remove(r.whatsappAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedWhatsappAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedWhatsappAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedWhatsappAccountApps.forEach(function(e){_.remove(r.whatsappAccountApps.rows,{id:e.id})}),r.selectedWhatsappAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.whatsappAccount.getAgents({id:c.whatsappAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserWhatsappAccount?"penalty "+e.UserWhatsappAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.whatsappAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.whatsappAccount.removeAgents({id:c.whatsappAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.whatsappAccount.addAgents({id:c.whatsappAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("WHATSAPP.ALL_AGENTS"),labelSelected:r.instant("WHATSAPP.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","whatsappAccount","whatsappAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.whatsapp").controller("WhatsappAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditWhatsappAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("whatsapp")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.whatsappQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.whatsappQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:2102}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"whatsappAccount",action:"getDispositions",field:"name",params:{id:m.whatsappAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.whatsappAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.whatsappAccountInteractions.rows.length;n+=1){var t=m.whatsappAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.whatsappInteraction.get(m.query,p).$promise}function v(e){d.whatsappInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.whatsappAccountInteractions.rows,{id:e.id}),m.whatsappAccountInteractions.count-=1,m.whatsappAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETwhatsappAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.whatsappAccount={},m.whatsappAccountInteractions={count:0,rows:[]},m.selectedWhatsappAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.whatsappAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.WhatsappAccountId=m.whatsappAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.whatsappInteractionDownload=function(s,e,n){return d.whatsappInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="whatsapp-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getWhatsappAccountInteractions=g,m.createOrEditWhatsappAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccount:m.whatsappAccount,interaction:n,interactions:m.whatsappAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spywhatsappInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"whatsapp",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"whatsapp.whatsappAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||WhatsappAccountId:=$eq["+m.whatsappAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedWhatsappAccountInteractions=function(){var e=angular.copy(m.selectedWhatsappAccountInteractions);return m.selectedWhatsappAccountInteractions=[],e},m.deleteWhatsappAccountInteraction=v,m.deleteSelectedWhatsappAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedWhatsappAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedWhatsappAccountInteractions.forEach(function(e){v(e)}),m.selectedWhatsappAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.whatsappAccount=c||e.params.whatsappAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.baseUrl=[{name:"US Production",url:"https://us1.whatsapp.api.sinch.com"},{name:"EU Production",url:"https://eu1.whatsapp.api.sinch.com"}],p.agentadddialog=function(e,n){t.show({controller:"WhatsappAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappAccount:e,whatsappAccounts:p.whatsappAccounts?p.whatsappAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoWhatsappAccounts=function(){e.go("app.whatsapp.whatsappAccounts",{},{reload:"app.whatsapp.whatsappAccounts"})},p.saveWhatsappAccount=function(){"twilio"===p.whatsappAccount.type&&(p.whatsappAccount.baseUrl=null);r.whatsappAccount.update({id:p.whatsappAccount.id},p.whatsappAccount).$promise.then(function(){l.success({title:"WhatsappAccount updated!",msg:p.whatsappAccount.name?p.whatsappAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.whatsappAccount&&(t=_.find(p.lists,{id:Number(p.whatsappAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.whatsappAccount&&(a=_.find(p.lists,{id:Number(p.whatsappAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","whatsappAccount","userProfile","userProfileSection"],angular.module("app.whatsapp").controller("WhatsappAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.whatsappAccountWhatsappCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.whatsappAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.whatsappAccountWhatsappCannedAnswers.rows,{id:e.id}),m.whatsappAccountWhatsappCannedAnswers.count-=1,m.whatsappAccountWhatsappCannedAnswers.rows.length||p(),l.success({title:"WhatsappCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETwhatsappAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.whatsappAccount={},m.whatsappAccountWhatsappCannedAnswers={count:0,rows:[]},m.selectedWhatsappAccountWhatsappCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.whatsappAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.WhatsappAccountId=m.whatsappAccount.id,m.query.id=m.whatsappAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the whatsappCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("whatsappCannedAnswer #")+e.id||"whatsappCannedAnswer")+"</b> will be deleted.").ariaLabel("delete whatsappCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getWhatsappAccountWhatsappCannedAnswers=p,m.createOrEditWhatsappAccountWhatsappCannedAnswer=function(e,n){o.show({controller:"CreateOrEditWhatsappCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/whatsappCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccount:m.whatsappAccount,whatsappCannedAnswer:n,whatsappCannedAnswers:m.whatsappAccountWhatsappCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedWhatsappAccountWhatsappCannedAnswers=function(){var e=angular.copy(m.selectedWhatsappAccountWhatsappCannedAnswers);return m.selectedWhatsappAccountWhatsappCannedAnswers=[],e},m.deleteWhatsappAccountWhatsappCannedAnswer=g,m.deleteSelectedWhatsappAccountWhatsappCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected whatsappCannedAnswers?").htmlContent("<b>"+m.selectedWhatsappAccountWhatsappCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete whatsappCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedWhatsappAccountWhatsappCannedAnswers.forEach(function(e){g(e)}),m.selectedWhatsappAccountWhatsappCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountWhatsappCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="WHATSAPP.EDIT_WHATSAPPCANNEDANSWER",g.whatsappCannedAnswer=angular.copy(l),g.whatsappCannedAnswers=r,g.newWhatsappCannedAnswer=!1,g.whatsappCannedAnswer||(g.whatsappCannedAnswer={},g.title="WHATSAPP.NEW_WHATSAPPCANNEDANSWER",g.newWhatsappCannedAnswer=!0),n.params.id&&(g.whatsappCannedAnswer.WhatsappAccountId=n.params.id),g.addNewWhatsappCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.whatsappCannedAnswer).$promise.then(function(e){g.whatsappCannedAnswers.unshift(e.toJSON()),o.success({title:"WhatsappCannedAnswer properly created",msg:g.whatsappCannedAnswer.name?g.whatsappCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveWhatsappCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.whatsappCannedAnswer.id},g.whatsappCannedAnswer).$promise.then(function(e){var n=_.find(g.whatsappCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"WhatsappCannedAnswer properly saved!",msg:g.whatsappCannedAnswer.name?g.whatsappCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteWhatsappCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The whatsappCannedAnswer will be deleted.").ariaLabel("Delete WhatsappCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.whatsappCannedAnswer.id}).$promise.then(function(){_.remove(g.whatsappCannedAnswers,{id:g.whatsappCannedAnswer.id}),o.success({title:"WhatsappCannedAnswer properly deleted!",msg:(g.whatsappCannedAnswer.name||"whatsappCannedAnswer")+" has been deleted!"}),v(g.whatsappCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","whatsappCannedAnswers","whatsappCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.whatsapp").controller("CreateOrEditWhatsappCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.whatsappAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.whatsappAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.WhatsappAccountId=m.whatsappAccount.id,m.query.id=m.whatsappAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.whatsappAccount.id,field:"WhatsappAccountId",route:"whatsappAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountDispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.whatsappAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="whatsappAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedWhatsappAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description,baseUrl",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Twilio",value:"'twilio'"},{option:"Sinch",value:"'sinch'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.whatsapp.whatsappAccounts.edit",{id:e.id,whatsappAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.whatsapp.whatsappAccounts.edit",{id:e.id,tab:5})},f.agentadddialog=function(e,n){i.show({controller:"WhatsappAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappAccount:e,whatsappAccounts:f.whatsappAccounts?f.whatsappAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("whatsappAccount")+"?").htmlContent("<b>"+(e.name||"whatsappAccount")+"</b> will be deleted.").ariaLabel("delete whatsappAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getWhatsappAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.whatsappAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="WhatsappAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditWhatsappAccount=function(e,n){i.show({controller:"CreateOrEditWhatsappAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccount:n,whatsappAccounts:f.whatsappAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteWhatsappAccount=y,f.exportSelectedWhatsappAccounts=function(){var e=angular.copy(f.selectedWhatsappAccounts);return f.selectedWhatsappAccounts=[],e},f.deleteSelectedWhatsappAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected whatsappAccounts?").htmlContent("<b>"+f.selectedWhatsappAccounts.length+" selected</b> will be deleted.").ariaLabel("delete WhatsappAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedWhatsappAccounts.forEach(function(e){y(e)}),f.selectedWhatsappAccounts=[]})},f.deselectWhatsappAccounts=function(){f.selectedWhatsappAccounts=[]},f.selectAllWhatsappAccounts=function(){f.selectedWhatsappAccounts=f.whatsappAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.whatsappAccount&&(t=_.find(f.lists,{id:Number(f.whatsappAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.whatsappAccount&&(a=_.find(f.lists,{id:Number(f.whatsappAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){f.pauses=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){f.pauses=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.pauses,{id:e.resourceId})});f.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),f.pauses=n})}else f.pauses=[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.whatsappAccounts=e||{count:0,rows:[]}}function y(e){m.whatsappAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.whatsappAccounts.rows,{id:e.id}),f.whatsappAccounts.count-=1,f.whatsappAccounts.rows.length||f.getWhatsappAccounts(),p.success({title:_.startCase("WhatsappAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEwhatsappAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEwhatsappAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getWhatsappAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","whatsappAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.whatsapp").controller("WhatsappAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="WHATSAPP.EDIT_WHATSAPPQUEUE",g.whatsappQueue=angular.copy(l),g.whatsappQueues=r,g.newWhatsappQueue=!1,g.whatsappQueue||(g.whatsappQueue={strategy:"beepall",timeout:10},g.title="WHATSAPP.NEW_WHATSAPPQUEUE",g.newWhatsappQueue=!0),g.addNewWhatsappQueue=function(){g.errors=[],d.whatsappQueue.save(g.whatsappQueue).$promise.then(function(e){g.whatsappQueues.unshift(e.toJSON()),o.success({title:"WhatsappQueue properly created",msg:g.whatsappQueue.name?g.whatsappQueue.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveWhatsappQueue=function(){g.errors=[],d.whatsappQueue.update({id:g.whatsappQueue.id},g.whatsappQueue).$promise.then(function(e){var n=_.find(g.whatsappQueues,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"WhatsappQueue properly saved!",msg:g.whatsappQueue.name?g.whatsappQueue.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteWhatsappQueue=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The whatsappQueue will be deleted.").ariaLabel("Delete WhatsappQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.whatsappQueue.delete({id:g.whatsappQueue.id}).$promise.then(function(){_.remove(g.whatsappQueues,{id:g.whatsappQueue.id}),o.success({title:"WhatsappQueue properly deleted!",msg:(g.whatsappQueue.name||"whatsappQueue")+" has been deleted!"}),v(g.whatsappQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","whatsappQueues","whatsappQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.whatsapp").controller("CreateOrEditWhatsappQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.whatsappQueue.getAgents({id:c.whatsappQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserWhatsappQueue?"penalty "+e.UserWhatsappQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.whatsappQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.removeAgents({id:c.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.addAgents({id:c.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("WHATSAPP.ALL_AGENTS"),labelSelected:r.instant("WHATSAPP.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","whatsappQueue","whatsappQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.whatsapp").controller("WhatsappQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.whatsappQueue.getTeams({id:l.whatsappQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.whatsappQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("WHATSAPP.ALL_TEAMS"),labelSelected:t.instant("WHATSAPP.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.removeTeams({id:l.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.addTeams({id:l.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","whatsappQueue","$translate","Auth","crudPermissions"],angular.module("app.whatsapp").controller("WhatsappQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.whatsappQueue=c||e.params.whatsappQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"WhatsappQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:u.whatsappQueues?u.whatsappQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"WhatsappQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:u.whatsappQueues?u.whatsappQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoWhatsappQueues=function(){e.go("app.whatsapp.whatsappQueues",{},{reload:"app.whatsapp.whatsappQueues"})},u.saveWhatsappQueue=function(){r.whatsappQueue.update({id:u.whatsappQueue.id},u.whatsappQueue).$promise.then(function(){l.success({title:"WhatsappQueue updated!",msg:u.whatsappQueue.name?u.whatsappQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","whatsappQueue","userProfileSection"],angular.module("app.whatsapp").controller("WhatsappQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.whatsappQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="whatsappQueues",f.listOrder="",f.listOrderAsc=null,f.selectedWhatsappQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"whatsapp",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.whatsapp.whatsappQueues.edit",{id:e.id,whatsappQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"WhatsappQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:f.whatsappQueues?f.whatsappQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"WhatsappQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:f.whatsappQueues?f.whatsappQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("whatsappQueue")+"?").htmlContent("<b>"+(e.name||"whatsappQueue")+"</b> will be deleted.").ariaLabel("delete whatsappQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:2110}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.whatsapp.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.whatsapp.realtime.queues",{})}},f.success=E,f.getWhatsappQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.whatsappQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="WhatsappQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditWhatsappQueue=function(e,n){i.show({controller:"CreateOrEditWhatsappQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappQueue:n,whatsappQueues:f.whatsappQueues.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteWhatsappQueue=y,f.exportSelectedWhatsappQueues=function(){var e=angular.copy(f.selectedWhatsappQueues);return f.selectedWhatsappQueues=[],e},f.deleteSelectedWhatsappQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected whatsappQueues?").htmlContent("<b>"+f.selectedWhatsappQueues.length+" selected</b> will be deleted.").ariaLabel("delete WhatsappQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedWhatsappQueues.forEach(function(e){y(e)}),f.selectedWhatsappQueues=[]})},f.deselectWhatsappQueues=function(){f.selectedWhatsappQueues=[]},f.selectAllWhatsappQueues=function(){f.selectedWhatsappQueues=f.whatsappQueues.rows};var b=!0,A=1;function E(e){f.whatsappQueues=e||{count:0,rows:[]}}function y(e){m.whatsappQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.whatsappQueues.rows,{id:e.id}),f.whatsappQueues.count-=1,f.whatsappQueues.rows.length||f.getWhatsappQueues(),p.success({title:_.startCase("WhatsappQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEwhatsappQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEwhatsappQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getWhatsappQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","whatsappQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.whatsapp").controller("WhatsappQueuesController",e)}(),function(){"use strict";function e(n,t,e,a,o,i,s,r,l,d,c,m,u){var p=this;function g(e,n){return{id:e,title:n.name||"NONAME",state:"app.dashboards.custom",stateParams:n,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(e)&&!r.hasRole("admin")}}}function v(e,n){return{id:e,title:n.name||"NONAME",state:"app.plugins.plugin",stateParams:n,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(e)&&!r.hasRole("admin")}}}function h(e,n){var t={user:_.pick(r.getCurrentUser(),["id","name","fullname","email","role","internal","interface"])};n.agentUrl=Mustache.render(n.agentUrl,t),i.saveItem("apps.home.plugin_"+e,{id:e,title:n.name,translate:n.name,state:"plugin_"+n.id,stateParams:n,view:"plugin",icon:n.icon,weight:12,hidden:function(){return!r.hasPermission(e)}})}function f(e){return _.map(e.children,function(e){return e.id})}s.clear(),p.isAgent=function(){return r.getCurrentUser()&&r.hasRole("agent")},o.saveItem("apps",{title:"APPS",group:!0,weight:1,hidden:function(){return r.hasRole("agent")}}),d.version.get().$promise.then(function(e){p.version=e&&e.current?e.current:"UNKNOWN"}).catch(function(){p.version="UNKNOWN"}).finally(function(){o.saveItem("version",{title:"VERSION "+p.version,group:!0,weight:2,hidden:function(){return r.hasRole("agent")}})}),r.isLoggedIn()&&(null===m.userSettings&&m.getUserSettingForUser(),l.gray&&s.warning({msg:e.instant("DASHBOARDS.LICENSE_EXPIRE_REMAINING_DAYS"),showClose:!0,timeout:!1}),d.dashboard.get().$promise.then(function(e){for(var n=0,t=0;t<e.rows.length;t+=1)n=99999+e.rows[t].id,o.saveItem("apps.dashboards.custom_"+n,g(n,e.rows[t]))}),d.plugin.get({active:!0}).$promise.then(function(e){var n=0;if(e.count){var t=_.filter(e.rows,function(e){return"never"!=e.sidebar&&"agentOnly"!=e.sidebar});if(0<t.length){o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",permissions:{hidden:!0},weight:17,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}});for(var a=0;a<t.length;a+=1)n=88888+t[a].id,o.saveItem("apps.plugins.plugin_"+n,v(n,t[a]));o.sort()}var i=_.filter(e.rows,function(e){return"never"!=e.sidebar&&"adminOnly"!=e.sidebar});if(0<i.length)for(var s=0;s<i.length;s+=1)h(n=88888+i[s].id,i[s])}})),l.custom&&!c.defaultPageTitle&&c.pageTitle&&angular.element("#pageTitle").html(c.pageTitle),o.saveItem("apps.dashboards",{id:100,title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",icon:"icon-tile-four",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.dashboards.general",{id:101,title:"General",route:"",translate:"DASHBOARDS.GENERAL",state:"app.dashboards.general",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(101)&&!r.hasRole("admin")}}),o.saveItem("apps.staff",{id:200,title:"Staff",translate:"STAFF.STAFF",icon:"icon-account-multiple",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.staff.users",{id:201,title:"Users",route:"user",translate:"STAFF.USERS",state:"app.staff.users",permissions:{hidden:!0},weight:1,hidden:function(){return r.hasRole("agent")||r.hasRole("user")||!r.hasPermission(201)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.agents",{id:202,title:"Agents",route:"user",translate:"STAFF.AGENTS",state:"app.staff.agents",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(202)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.telephones",{id:203,title:"Telephones",route:"user",translate:"STAFF.TELEPHONES",state:"app.staff.telephones",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(203)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.teams",{id:204,title:"Teams",route:"team",translate:"STAFF.TEAMS",state:"app.staff.teams",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(204)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.userProfiles",{id:205,title:"UserProfiles",route:"userProfile",translate:"STAFF.USERPROFILES",state:"app.staff.userProfiles",permissions:{hidden:!0},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(205)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager",{id:300,title:"ContactManager",translate:"CONTACTMANAGER.CONTACTMANAGER",icon:"icon-account-circle",license:"cm",weight:4,hidden:function(){return!l.cm||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.lists",{id:301,title:"Lists",route:"cmList",translate:"CONTACTMANAGER.LISTS",state:"app.contactmanager.lists",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(301)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.companies",{id:302,title:"Companies",route:"cmCompany",translate:"CONTACTMANAGER.COMPANIES",state:"app.contactmanager.companies",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(302)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.globalCustomFields",{id:304,title:"GlobalCustomFields",route:"cmCustomField",translate:"CONTACTMANAGER.GLOBALCUSTOMFIELDS",state:"app.contactmanager.globalCustomFields",permissions:{association:!1},weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(304)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.contacts",{id:303,title:"Contacts",route:"",translate:"CONTACTMANAGER.CONTACTS",state:"app.contactmanager.contacts",permissions:{association:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(303)&&!r.hasRole("admin")}}),o.saveItem("apps.voice",{id:400,title:"Voice",translate:"VOICE.VOICE",icon:"icon-phone",license:"voice",weight:5,hidden:function(){return!l.voice||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voiceQueues",{id:401,title:"VoiceQueues",route:"voiceQueue",channel:"voice",translate:"VOICE.VOICEQUEUES",state:"app.voice.voiceQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(401)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.contexts",{id:405,title:"Contexts",route:"voiceContext",translate:"VOICE.CONTEXTS",state:"app.voice.contexts",weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(405)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voicemails",{id:406,title:"Voicemails",route:"voiceMail",translate:"VOICE.VOICEMAILS",state:"app.voice.voicemails",weight:6,hidden:function(){return r.hasRole("agent")||!r.hasPermission(406)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.musiconholds",{id:407,title:"MusicOnHolds",route:"voiceMusicOnHold",translate:"VOICE.MUSICONHOLDS",state:"app.voice.musiconholds",weight:7,hidden:function(){return r.hasRole("agent")||!r.hasPermission(407)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voiceRecordings",{id:408,title:"VoiceRecordings",route:"voiceRecording",translate:"VOICE.VOICERECORDINGS",state:"app.voice.voiceRecordings",permissions:{association:!1,loading:!0},weight:8,hidden:function(){return r.hasRole("agent")||!r.hasPermission(408)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.chanSpies",{id:409,title:"ChanSpies",route:"voiceChanSpy",translate:"VOICE.CHANSPIES",state:"app.voice.chanSpies",weight:9,hidden:function(){return r.hasRole("agent")||!r.hasPermission(409)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voicePrefixes",{id:410,title:"VoicePrefixes",route:"voicePrefix",translate:"VOICE.VOICEPREFIXES",state:"app.voice.voicePrefixes",weight:10,hidden:function(){return r.hasRole("agent")||!r.hasPermission(410)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.inboundRoutes",{id:402,title:"InboundRoutes",route:"voiceExtension",translate:"VOICE.INBOUNDROUTES",state:"app.voice.inboundRoutes",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(402)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.outboundRoutes",{id:403,title:"OutboundRoutes",route:"voiceExtension",translate:"VOICE.OUTBOUNDROUTES",state:"app.voice.outboundRoutes",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(403)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.internalRoutes",{id:404,title:"InternalRoutes",route:"voiceExtension",translate:"VOICE.INTERNALROUTES",state:"app.voice.internalRoutes",weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(404)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.realtime",{id:411,title:"Realtime",route:"",translate:"VOICE.REALTIME",state:"app.voice.realtime",permissions:{association:!1,crud:!1},weight:11,hidden:function(){return r.hasRole("agent")||!r.hasPermission(411)&&!r.hasRole("admin")}}),o.saveItem("apps.chat",{id:500,title:"Chat",translate:"CHAT.CHAT",icon:"icon-hangouts",license:"chat",weight:6,hidden:function(){return!l.chat||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.chat.chatQueues",{id:501,title:"ChatQueues",route:"chatQueue",channel:"chat",translate:"CHAT.CHATQUEUES",state:"app.chat.chatQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(501)&&!r.hasRole("admin")}}),o.saveItem("apps.chat.chatWebsites",{id:502,title:"ChatWebsites",route:"chatWebsite",channel:"chat",translate:"CHAT.CHATWEBSITES",state:"app.chat.chatWebsites",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(502)&&!r.hasRole("admin")}}),o.saveItem("apps.chat.realtime",{id:510,title:"Realtime",route:"",translate:"CHAT.REALTIME",state:"app.chat.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(510)&&!r.hasRole("admin")}}),o.saveItem("apps.mail",{id:600,title:"Mail",translate:"MAIL.MAIL",icon:"icon-email",license:"mail",weight:7,hidden:function(){return!l.mail||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.mail.mailQueues",{id:601,title:"MailQueues",route:"mailQueue",channel:"mail",translate:"MAIL.MAILQUEUES",state:"app.mail.mailQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(601)&&!r.hasRole("admin")}}),o.saveItem("apps.mail.mailAccounts",{id:602,title:"MailAccounts",route:"mailAccount",channel:"mail",translate:"MAIL.MAILACCOUNTS",state:"app.mail.mailAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(602)&&!r.hasRole("admin")}}),o.saveItem("apps.mail.mailSubtatuses",{id:603,title:"MailSubstatuses",route:"mailSubstatus",channel:"mail",translate:"MAIL.MAILSUBSTATUSES",state:"app.mail.mailSubtatuses",permissions:{association:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(603)&&!r.hasRole("admin")}}),o.saveItem("apps.mail.realtime",{id:610,title:"Realtime",route:"",translate:"MAIL.REALTIME",state:"app.mail.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(610)&&!r.hasRole("admin")}}),o.saveItem("apps.sms",{id:700,title:"Sms",translate:"SMS.SMS",icon:"icon-message-text",license:"messaging",weight:8,hidden:function(){return!l.messaging||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.sms.smsQueues",{id:701,title:"SmsQueues",route:"smsQueue",channel:"sms",translate:"SMS.SMSQUEUES",state:"app.sms.smsQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(701)&&!r.hasRole("admin")}}),o.saveItem("apps.sms.smsAccounts",{id:702,title:"SmsAccounts",route:"smsAccount",channel:"sms",translate:"SMS.SMSACCOUNTS",state:"app.sms.smsAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(702)&&!r.hasRole("admin")}}),o.saveItem("apps.sms.realtime",{id:710,title:"Realtime",route:"",translate:"SMS.REALTIME",state:"app.sms.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(710)&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel",{id:800,title:"Openchannel",translate:"OPENCHANNEL.OPENCHANNEL",icon:"icon-google-earth",license:"openchannel",weight:9,hidden:function(){return!l.openchannel||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel.openchannelQueues",{id:801,title:"OpenchannelQueues",route:"openchannelQueue",channel:"openChannel",translate:"OPENCHANNEL.OPENCHANNELQUEUES",state:"app.openchannel.openchannelQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(801)&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel.openchannelAccounts",{id:802,title:"OpenchannelAccounts",route:"openchannelAccount",channel:"openChannel",translate:"OPENCHANNEL.OPENCHANNELACCOUNTS",state:"app.openchannel.openchannelAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(802)&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel.realtime",{id:810,title:"Realtime",route:"",translate:"OPENCHANNEL.REALTIME",state:"app.openchannel.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(810)&&!r.hasRole("admin")}}),o.saveItem("apps.fax",{id:900,title:"Fax",translate:"FAX.FAX",icon:"icon-deskphone",license:"fax",weight:10,hidden:function(){return!l.fax||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.fax.faxQueues",{id:901,title:"FaxQueues",route:"faxQueue",channel:"fax",translate:"FAX.FAXQUEUES",state:"app.fax.faxQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(901)&&!r.hasRole("admin")}}),o.saveItem("apps.fax.faxAccounts",{id:902,title:"FaxAccounts",route:"faxAccount",channel:"fax",translate:"FAX.FAXACCOUNTS",state:"app.fax.faxAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(902)&&!r.hasRole("admin")}}),o.saveItem("apps.fax.realtime",{id:910,title:"Realtime",route:"",translate:"FAX.REALTIME",state:"app.fax.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(910)&&!r.hasRole("admin")}}),o.saveItem("apps.tools",{id:1e3,title:"Tools",translate:"TOOLS.TOOLS",icon:"icon-auto-fix",weight:15,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.tools.cannedAnswers",{id:1001,title:"CannedAnswers",route:"cannedAnswer",translate:"TOOLS.CANNEDANSWERS",state:"app.tools.cannedAnswers",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1001)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.customDashboards",{id:1003,title:"CustomDashboards",route:"dashboard",translate:"TOOLS.CUSTOMDASHBOARDS",state:"app.tools.customDashboards",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1003)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.intervals",{id:1004,title:"Intervals",route:"interval",translate:"TOOLS.INTERVALS",state:"app.tools.intervals",weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1004)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.pauses",{id:1005,title:"Pauses",route:"pause",translate:"TOOLS.PAUSES",state:"app.tools.pauses",weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1005)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.schedules",{id:1006,title:"Scheduler",route:"schedule",translate:"TOOLS.SCHEDULER",state:"app.tools.schedules",weight:6,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1006)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.sounds",{id:1007,title:"Sounds",route:"sound",translate:"TOOLS.SOUNDS",state:"app.tools.sounds",weight:7,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1007)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.tags",{id:1008,title:"Tags",route:"tag",translate:"TOOLS.TAGS",state:"app.tools.tags",weight:8,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1008)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.templates",{id:1009,title:"Templates",route:"template",translate:"TOOLS.TEMPLATES",state:"app.tools.templates",weight:9,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1009)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.trunks",{id:1011,title:"Trunks",route:"trunk",translate:"TOOLS.TRUNKS",state:"app.tools.trunks",weight:11,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1011)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.variables",{id:1012,title:"Variables",route:"variable",translate:"TOOLS.VARIABLES",state:"app.tools.variables",weight:12,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1012)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.contact_item_types",{id:1013,title:"ContactItemType",route:"contactItemType",translate:"TOOLS.CONTACTITEMTYPE",state:"app.tools.contact_item_types",weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1013)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.dispositions",{id:1002,title:"Dispositions",route:"disposition",translate:"TOOLS.DISPOSITIONS",state:"app.tools.dispositions",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1002)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.triggers",{id:1010,title:"Triggers",route:"trigger",translate:"TOOLS.TRIGGERS",state:"app.tools.triggers",weight:10,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1010)&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare",{id:1100,title:"CallySquare",translate:"CALLYSQUARE.CALLYSQUARE",icon:"icon-sitemap",license:"voice",weight:13,hidden:function(){return!l.voice||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare.odbcs",{id:1101,title:"ODBC",route:"squareOdbc",translate:"CALLYSQUARE.ODBC",state:"app.callysquare.odbcs",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1101)&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare.squareRecordings",{id:1102,title:"SquareRecordings",route:"squareRecording",translate:"CALLYSQUARE.SQUARERECORDINGS",state:"app.callysquare.squareRecordings",permissions:{association:!1,loading:!0},weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1102)&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare.projects",{id:1103,title:"Projects",route:"squareProject",translate:"CALLYSQUARE.PROJECTS",state:"app.callysquare.projects",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1103)&&!r.hasRole("admin")}}),o.saveItem("apps.analytics",{id:1200,title:"Analytics",translate:"ANALYTICS.ANALYTICS",icon:"icon-chart-line",weight:16,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.analytics.metrics",{id:1201,title:"Metrics",route:"analyticMetric",translate:"ANALYTICS.METRICS",state:"app.analytics.metrics",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1201)&&!r.hasRole("admin")}}),o.saveItem("apps.analytics.extractedReports",{id:1202,title:"ExtractedReports",route:"analyticExtractedReport",translate:"ANALYTICS.EXTRACTEDREPORTS",state:"app.analytics.extractedReports",permissions:{association:!1,loading:!0},weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1202)&&!r.hasRole("admin")}}),o.saveItem("apps.analytics.reports",{id:1203,title:"Reports",route:"",translate:"ANALYTICS.REPORTS",state:"app.analytics.reports",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1203)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations",{id:1300,title:"Integrations",translate:"INTEGRATIONS.INTEGRATIONS",icon:"icon-heart",weight:17,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.zendeskAccounts",{id:1301,title:"ZendeskAccounts",route:"intZendeskAccount",translate:"INTEGRATIONS.ZENDESKACCOUNTS",state:"app.integrations.zendeskAccounts",permissions:{association:!1,loading:!0},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1301)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.salesforceAccounts",{id:1302,title:"SalesforceAccounts",route:"intSalesforceAccount",translate:"INTEGRATIONS.SALESFORCEACCOUNTS",state:"app.integrations.salesforceAccounts",permissions:{association:!1,loading:!0},weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1302)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.freshdeskAccounts",{id:1303,title:"FreshdeskAccounts",route:"intFreshdeskAccount",translate:"INTEGRATIONS.FRESHDESKACCOUNTS",state:"app.integrations.freshdeskAccounts",permissions:{association:!1,loading:!0},weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1303)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.sugarcrmAccounts",{id:1305,title:"SugarcrmAccounts",route:"intSugarcrmAccount",translate:"INTEGRATIONS.SUGARCRMACCOUNTS",state:"app.integrations.sugarcrmAccounts",permissions:{association:!1,loading:!0},weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1305)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.deskAccounts",{id:1306,title:"DeskAccounts",route:"intDeskAccount",translate:"INTEGRATIONS.DESKACCOUNTS",state:"app.integrations.deskAccounts",permissions:{association:!1,loading:!0},weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1306)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.zohoAccounts",{id:1307,title:"ZohoAccounts",route:"intZohoAccount",translate:"INTEGRATIONS.ZOHOACCOUNTS",state:"app.integrations.zohoAccounts",permissions:{association:!1,loading:!0},weight:6,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1307)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.vtigerAccounts",{id:1308,title:"VtigerAccounts",route:"intVtigerAccount",translate:"INTEGRATIONS.VTIGERACCOUNTS",state:"app.integrations.vtigerAccounts",permissions:{association:!1,loading:!0},weight:7,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1308)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.dynamics365Accounts",{id:1309,title:"Dynamics365Accounts",route:"intDynamics365Account",translate:"INTEGRATIONS.DYNAMICS365ACCOUNTS",state:"app.integrations.dynamics365Accounts",permissions:{association:!1,loading:!0},weight:8,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1309)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.servicenowAccounts",{id:1310,title:"ServicenowAccounts",route:"intServicenowAccount",translate:"INTEGRATIONS.SERVICENOWACCOUNTS",state:"app.integrations.servicenowAccounts",permissions:{association:!1,loading:!0},weight:9,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1310)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.freshsalesAccounts",{id:1304,title:"FreshsalesAccounts",route:"intFreshsalesAccount",translate:"INTEGRATIONS.FRESHSALESACCOUNTS",state:"app.integrations.freshsalesAccounts",permissions:{association:!1,loading:!0},weight:10,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1304)&&!r.hasRole("admin")}}),o.saveItem("apps.settings",{id:1400,title:"Settings",translate:"SETTINGS.SETTINGS",icon:"icon-cog",permissions:{hidden:!0},weight:20,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")||r.hasRole("admin")&&!r.getCurrentUser().settingsEnabled}}),o.saveItem("apps.settings.generals",{id:1401,title:"General",route:"setting",translate:"SETTINGS.GENERAL",state:"app.settings.generals",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.smtps",{id:1402,title:"Smtp",route:"mailAccount",translate:"SETTINGS.SMTP",state:"app.settings.smtps",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.networks",{id:1403,title:"Networks",route:"network",translate:"SETTINGS.NETWORKS",state:"app.settings.networks",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.customizations",{id:1407,title:"Customizations",route:"setting",translate:"SETTINGS.CUSTOMIZATIONS",state:"app.settings.customizations",weight:1,hidden:function(){return!l.custom||r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.cloudProviders",{id:1408,title:"AiTools",route:"cloudProvider",translate:"SETTINGS.CLOUD_PROVIDERS",state:"app.settings.cloudProviders",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.updates",{id:1404,title:"Updates",route:"",translate:"SETTINGS.UPDATES",state:"app.settings.updates",weight:1,hidden:function(){return!l.update||r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.license",{id:1405,title:"License",route:"",translate:"SETTINGS.LICENSE",state:"app.settings.license",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.system",{id:1406,title:"System",route:"",translate:"SETTINGS.SYSTEM",state:"app.settings.system",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer",{id:1500,title:"MotionDialer",translate:"MOTIONDIALER.MOTIONDIALER",icon:"icon-fire",license:"dialer",weight:5,hidden:function(){return!l.dialer||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer.queueCampaigns",{id:1501,title:"QueueCampaigns",route:"voiceQueue",channel:"bull",translate:"MOTIONDIALER.QUEUECAMPAIGNS",state:"app.motiondialer.queueCampaigns",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1501)&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer.ivrCampaigns",{id:1502,title:"IvrCampaigns",route:"campaign",translate:"MOTIONDIALER.IVRCAMPAIGNS",state:"app.motiondialer.ivrCampaigns",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1502)&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer.realtime",{id:1510,title:"Realtime",route:"",translate:"MOTIONDIALER.REALTIME",state:"app.motiondialer.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1510)&&!r.hasRole("admin")}}),o.saveItem("apps.help",{id:1600,title:"Help",translate:"HELP.HELP",icon:"icon-help",permissions:{association:!1},weight:21,hidden:function(){return!c.viewHelpSection||r.hasRole("agent")||!r.hasPermission(1600)&&!r.hasRole("admin")}}),o.saveItem("apps.help.about",{id:1601,title:"About",route:"",translate:"HELP.ABOUT",state:"app.help.about",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1600)&&!r.hasRole("admin")}}),o.saveItem("apps.jscripty",{id:1700,title:"jscripty",translate:"JSCRIPTY.JSCRIPTY",icon:"icon-script",license:"jscripty",weight:14,hidden:function(){return!l.jscripty||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.jscripty.projects",{id:1701,title:"Projects",route:"jscriptyProject",translate:"JSCRIPTY.PROJECTS",state:"app.jscripty.projects",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1701)&&!r.hasRole("admin")}}),o.saveItem("apps.marketplace",{id:1800,title:"Marketplace",translate:"MARKETPLACE.MARKETPLACE",icon:"icon-cart",weight:18,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.marketplace.plugins",{id:1801,title:"Plugins",route:"plugin",translate:"MARKETPLACE.PLUGINS",state:"app.marketplace.plugins",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1801)&&!r.hasRole("admin")}}),o.saveItem("apps.video",{id:2e3,title:"Video",translate:"VIDEO.VIDEO",icon:"icon-video",license:"screenrecording",weight:12,hidden:function(){return!l.screenrecording||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.video.screenRecordings",{id:2001,title:"ScreenRecordings",route:"screenRecording",translate:"VIDEO.SCREENRECORDINGS",state:"app.video.screenRecordings",permissions:{association:!1,loading:!0},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2001)&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp",{id:2100,title:"Whatsapp",translate:"WHATSAPP.WHATSAPP",icon:"icon-whatsapp",license:"whatsapp",weight:11,hidden:function(){return!l.whatsapp||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp.whatsappQueues",{id:2101,title:"WhatsappQueues",route:"whatsappQueue",channel:"whatsapp",translate:"WHATSAPP.WHATSAPPQUEUES",state:"app.whatsapp.whatsappQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2101)&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp.whatsappAccounts",{id:2102,title:"WhatsappAccounts",route:"whatsappAccount",channel:"whatsapp",translate:"WHATSAPP.WHATSAPPACCOUNTS",state:"app.whatsapp.whatsappAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2102)&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp.realtime",{id:2110,title:"Realtime",route:"",translate:"WHATSAPP.REALTIME",state:"app.whatsapp.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2110)&&!r.hasRole("admin")}}),o.sort(),i.saveItem("apps",{title:"APPS",group:!0,weight:1}),i.saveItem("apps.home",{id:100,title:"Home",translate:"DASHBOARDS.HOME",icon:"icon-home",weight:1}),i.saveItem("apps.home.dashboard",{id:101,title:"Dashboard",translate:"DASHBOARDS.DASHBOARD",state:"dashboard",view:"dashboard",icon:"icon-tile-four",iconClass:"cyan-500-fg",weight:1,hidden:function(){return!r.hasPermission(101)}}),i.saveItem("apps.home.agentPresence",{id:115,title:"AgentPresence",translate:"DASHBOARDS.AGENT_PRESENCE",state:"agentPresence",view:"agentPresence",icon:"icon-webcam",iconClass:"xenialab-violet-light-fg",weight:2,hidden:function(){return!r.hasPermission(115)}}),i.saveItem("apps.home.contacts",{id:102,title:"Contacts",translate:"DASHBOARDS.CONTACTS",state:"contacts",view:"contacts",icon:"icon-account-circle",iconClass:"red-fg",weight:3,hidden:function(){return!l.cm||!r.hasPermission(102)}}),i.saveItem("apps.home.mycontacts",{id:103,title:"Contacts",translate:"DASHBOARDS.MYCONTACTS",state:"mycontacts",view:"mycontacts",icon:"icon-account-multiple",iconClass:"red-fg",weight:4,hidden:function(){return!l.cm||!r.hasPermission(103)}}),i.saveItem("apps.home.scheduled",{id:113,title:"Scheduled Calls",translate:"DASHBOARDS.SCHEDULED_CALLS",state:"scheduled",view:"scheduled",icon:"icon-calendar-clock",iconClass:"blue-grey-fg",weight:5,hidden:function(){return!l.dialer||!r.hasPermission(113)}}),i.saveItem("apps.home.voice",{id:110,title:"Voice",translate:"DASHBOARDS.VOICE",state:"voice",view:"voice",icon:"icon-phone",iconClass:"blue-A700-fg",weight:6,hidden:function(){return!l.voice||!r.hasPermission(110)}}),i.saveItem("apps.home.abandoned",{id:111,title:"Abandoned",translate:"DASHBOARDS.ABANDONED",state:"abandoned",view:"abandoned",icon:"icon-phone-missed",iconClass:"blue-fg",weight:7,hidden:function(){return!l.voice||!r.hasPermission(111)}}),i.saveItem("apps.home.recordings",{id:104,title:"Recordings",translate:"DASHBOARDS.RECORDINGS",state:"recordings",view:"recordings",icon:"icon-audiobook",iconClass:"indigo-A100-fg",weight:8,hidden:function(){return!l.voice||!r.hasPermission(104)}}),i.saveItem("apps.home.chat",{id:105,title:"Chat",translate:"DASHBOARDS.CHAT",state:"chat",view:"chat",icon:"icon-hangouts",iconClass:"green-A700-fg",weight:9,hidden:function(){return!l.chat||!r.hasPermission(105)}}),i.saveItem("apps.home.mail",{id:106,title:"Mail",translate:"DASHBOARDS.MAIL",state:"mail",view:"mail",icon:"icon-email",iconClass:"teal-fg",weight:10,hidden:function(){return!l.mail||!r.hasPermission(106)}}),i.saveItem("apps.home.sms",{id:107,title:"Sms",translate:"DASHBOARDS.SMS",state:"sms",view:"sms",icon:"icon-message-text",iconClass:"orange-fg",weight:11,hidden:function(){return!l.messaging||!r.hasPermission(107)}}),i.saveItem("apps.home.openchannel",{id:108,title:"Openchannel",translate:"DASHBOARDS.OPENCHANNEL",state:"openchannel",view:"openchannel",icon:"icon-google-earth",iconClass:"amber-fg",weight:12,hidden:function(){return!l.openchannel||!r.hasPermission(108)}}),i.saveItem("apps.home.fax",{id:109,title:"Fax",translate:"DASHBOARDS.FAX",state:"fax",view:"fax",icon:"icon-deskphone",iconClass:"blue-grey-A200-fg",weight:13,hidden:function(){return!l.fax||!r.hasPermission(109)}}),i.saveItem("apps.home.whatsapp",{id:114,title:"Whatsapp",translate:"DASHBOARDS.WHATSAPP",state:"whatsapp",view:"whatsapp",icon:"icon-whatsapp",iconClass:"lime-A700-fg",weight:14,hidden:function(){return!l.whatsapp||!r.hasPermission(114)}}),n.$on("$viewContentAnimationEnded",function(e){e.targetScope.$id===n.$id&&t.$broadcast("msSplashScreen::remove")}),n.$on("socket:connect",function(){t.toastySocketLost&&(s.clear(t.toastySocketLost),t.toastySocketLost=void 0)}),n.$on("socket:disconnect",function(){t.toastySocketLost||s.warning({title:e.instant("TOOLBAR.WARNING"),msg:e.instant("DASHBOARDS.LOST_CONNECTION"),timeout:!1,onAdd:function(){t.toastySocketLost=this.id}})}),n.$on("client-side-logging:enabled",function(){"admin"!==r.getCurrentUser().role&&s.info({title:e.instant("STAFF.CLIENT_LOGS"),msg:e.instant("STAFF.CLIENT_LOGS_ENABLED_MSG")})}),n.$on("client-side-logging:disabled",function(){"admin"!==r.getCurrentUser().role&&s.info({title:e.instant("STAFF.CLIENT_LOGS"),msg:e.instant("STAFF.CLIENT_LOGS_DISABLED_MSG")})}),a.onbeforeunload=function(){r.isTelephone()||u.flush()}}e.$inject=["$scope","$rootScope","$translate","$window","msNavigationService","msNavigationAgentService","toasty","Auth","license","api","setting","UserSettingService","ClientSideLoggingService"],angular.module("motion").controller("MainController",e)}(),function(){"use strict";function e(e,n,t,a,o,r){var i=this;function s(e){if(e&&e.id){var n=99999+e.id;o.saveItem("apps.dashboards.custom_"+n,{id:n,title:e.name||"NONAME",state:"app.dashboards.custom",stateParams:e,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(n)&&!r.hasRole("admin")}})}}function l(e){if(e&&e.id&&"never"!=e.sidebar)if(e.active){if("always"==e.sidebar||"adminOnly"==e.sidebar){o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",weight:17,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1900)&&!r.hasRole("admin")}});var n=88888+e.id;o.saveItem("apps.plugins.plugin_"+n,{id:n,title:e.name||"NONAME",state:"app.plugins.plugin",stateParams:e,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(n)&&!r.hasRole("admin")}}),o.sort()}}else{n=88888+e.id;t=1900,a=n,i=o.getNavigation(),(s=_.find(i[0].children,{id:t}))&&_.some(s.children,{id:a})&&("always"==e.sidebar||"adminOnly"==e.sidebar)&&(o.deleteItem("apps.plugins.plugin_"+n),d(1900)||o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",weight:17,hidden:function(){return!0}}))}var t,a,i,s}function d(e){var n=o.getNavigation(),t=_.find(n[0].children,{id:e});return!!(t&&0<t.children.length)}i.bodyEl=angular.element("body"),i.setting=t,i.$onInit=function(){i.folded="true"===n.get("motion.folded")||!1},i.toggleMsNavigationFolded=function(){i.folded=!i.folded,n.put("motion.folded",i.folded)},i.getLogo=function(){return i.setting.defaultHeaderWhiteLabel?"xCALLY Motion":i.setting.headerWhiteLabel},a.on("dashboard:save",s),a.on("dashboard:update",s),a.on("dashboard:remove",function(e){if(e&&e.id){var n=99999+e.id;o.deleteItem("apps.dashboards.custom_"+n)}}),a.on("plugin:save",l),a.on("plugin:update",l),a.on("plugin:remove",function(e){if(e&&e.id&&"never"!=e.sidebar){var n=88888+e.id;"always"!=e.sidebar&&"adminOnly"!=e.sidebar||(o.deleteItem("apps.plugins.plugin_"+n),d(1900)||o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",weight:17,hidden:function(){return!0}}))}}),e.$on("$stateChangeSuccess",function(){i.bodyEl.removeClass("ms-navigation-horizontal-mobile-menu-active")})}e.$inject=["$scope","$cookies","setting","socket","msNavigationService","Auth"],angular.module("app.navigation").controller("NavigationController",e)}(),function(){"use strict";function e(e,a,i,n,t,s,o,r){var l=this;function d(t){o.isSupported()?o.requestPermission().then(function(){var e,n;n={autoClose:!0,duration:10,showOnPageHidden:!0,icon:"api/users/"+(e=t).FromId+"/avatar",body:e.body||"",focusOnclick:!0,closeOnClick:!0},o.show(a.instant("QUICKPANEL.NEW_INTERNAL_MESSAGE"),n)},function(e){console.error("Please enable browser notifications!",e)}):console.error("Browser notifications are not supported by the browser. Normal notifications will be used.")}l.date=moment().format(),l.currentUser=n.getCurrentUser(),l.license=r,l.unreadTotalMessages=0,l.unreadTotalGroupMessages=0,l.userIsNotPhonebar=function(){return"admin"===l.currentUser.role||"user"===l.currentUser.role||"agent"===l.currentUser.role&&0!==l.currentUser.showWebBar},l.onMessageSave=function(e){e.ToId===l.currentUser.id&&e.FromId!==l.currentUser.id&&!e.read&&e.ChatGroupId&&(l.unreadTotalGroupMessages++,d(e));e.ToId!==l.currentUser.id||e.ChatGroupId||(l.unreadTotalMessages+=1,d(e))},l.onMessageUpdate=function(e){e.ToId===l.currentUser.id&&e.read&&0<l.unreadTotalMessages&&!e.ChatGroupId&&(l.unreadTotalMessages-=1);e.ToId==l.currentUser.id&&e.FromId!==l.currentUser.id&&e.ChatGroupId&&e.read&&0<l.unreadTotalGroupMessages&&l.unreadTotalGroupMessages--},t.on("chatInternalMessage:save",l.onMessageSave),t.on("chatInternalMessage:update",l.onMessageUpdate),s.chatInternalMessage.get({fields:"FromId",ToId:l.currentUser.id,read:!1,nolimit:!0,ChatGroupId:"null"}).$promise.then(function(e){return e&&e.count&&(l.unreadTotalMessages=e.count),s.user.getGroups({id:l.currentUser.id}).$promise}).then(function(e){for(var n=[],t=e.rows,a=0;a<t.length;a++)n.push(s.chatGroup.getUnread({id:t[a].id}).$promise);return i.all(n)}).then(function(e){for(var n=0;n<e.length;n++)l.unreadTotalGroupMessages+=e[n].count}).catch(function(e){console.error(e)}),e.$on("$destroy",function(){t.removeAllListeners("chatInternalMessage:save"),t.removeAllListeners("chatInternalMessage:update")})}e.$inject=["$scope","$translate","$q","Auth","socket","api","desktopNotification","license"],angular.module("app.quick-panel").controller("QuickPanelController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;function p(e){var n=angular.element("#chat-dialog");a(function(){n.animate({scrollTop:n[0].scrollHeight},e)},0)}function g(e){return _.isNil(e)?"":e.replace(/[^\w.+#*\-]+/g,"")}function v(e){return m.get(e).success(function(){n.success({title:"Successful call",msg:"Call properly handled!"})}).error(function(e){n.error({title:"PhoneBar API Error",msg:d.instant("CONTACTMANAGER.ERRORS.PHONEBAR_API")})})}u.currentUser=i.getCurrentUser(),u.user=void 0,u.users={count:0,rows:[]},u.standardDate=moment(0).format("YYYY-MM-DD HH:mm:ss"),u.unreadMessage={},u.replyMessage="",u.disabled=!1,u.init=function(e){u.license=e},u.toggleChat=function(e){if(e){if(!e.allowmessenger&&"agent"===e.role)return n.warning({title:d.instant("QUICKPANEL.WARNING"),msg:d.instant("QUICKPANEL.MESSENGER_DISABLED")}),void(u.user=void 0);u.user=e,u.replyMessage="",t.chatInternalMessage.get({sort:"createdAt",FromId:u.currentUser.id+","+e.id,ToId:u.currentUser.id+","+e.id,ChatGroupId:"null"}).$promise.then(function(e){if(e&&e.rows){u.user.messages=e;for(var n=0;n<u.user.messages.rows.length;n+=1)!1===u.user.messages.rows[n].read&&u.user.messages.rows[n].ToId===u.currentUser.id&&t.chatInternalMessage.update({id:u.user.messages.rows[n].id,read:!0})}}).finally(function(){p(0)})}else u.user=void 0},u.reply=function(){u.disabled=!0;Date.now();if(""===u.replyMessage)return void(u.disabled=!1);var e={FromId:u.currentUser.id,ToId:u.user.id,body:u.replyMessage,read:!1};u.replyMessage="",t.chatInternalMessage.save(e).$promise.then(function(e){u.user.messages.rows.push(e),u.user.lastMessageAt=e.createdAt,u.user.lastMessage=e,p(400)}).catch(function(e){}).finally(function(){u.disabled=!1})},u.onMessageSave=function(e){if(e.ToId===u.currentUser.id&&!e.ChatGroupId){u.user&&u.user.id===e.FromId?(u.user.messages.rows.push(e),p(0),t.chatInternalMessage.update({id:e.id,read:!0})):u.unreadMessage[e.FromId]=u.unreadMessage[e.FromId]?u.unreadMessage[e.FromId]+1:1;var n=_.find(u.users.rows,{id:e.FromId});n&&(n.lastMessageAt=e.createdAt,n.lastMessage=e)}},u.onMessageUpdate=function(e){if((e.FromId===u.currentUser.id||e.ToId===u.currentUser.id)&&!e.ChatGroupId){if(u.user){var n=_.find(u.user.messages.rows,{id:e.id});n&&_.merge(n,e)}var t=_.find(u.users.rows,{id:u.currentUser.id===e.FromId?e.ToId:e.FromId});t&&t.lastMessage&&_.merge(t.lastMessage,e),e.ToId===u.currentUser.id&&e.read&&0<u.unreadMessage[e.FromId]&&(u.unreadMessage[e.FromId]-=1)}},u.onUserUpdate=function(e){var n=_.find(u.users.rows,{id:e.id});n&&(_.isNil(e.online)||n.online===e.online||(n.online=e.online),_.isNil(e.allowmessenger)||n.allowmessenger===e.allowmessenger||(n.allowmessenger=e.allowmessenger))},u.webcall=function(e){c.$broadcast("webrtc::call",{target:g(e)})},u.call=function(e){return v("http://127.0.0.1:"+(u.user.phoneBarRemoteControlPort||"9888")+"/api/originate/"+g(e))},u.transfer=function(e){return v("http://127.0.0.1:"+(u.user.phoneBarRemoteControlPort||"9888")+"/api/transfer?number="+g(e))},s.on("chatInternalMessage:save",u.onMessageSave),s.on("chatInternalMessage:update",u.onMessageUpdate),s.on("user:update",u.onUserUpdate),o("quick-panel").onClose(function(){u.user=void 0}),t.chatInternalMessage.get({fields:"FromId",ToId:u.currentUser.id,read:!1,nolimit:!0,ChatGroupId:"null"}).$promise.then(function(e){u.unreadMessage=_.countBy(e.rows,"FromId")}).catch(function(e){}),t.chatInternalMessage.getUsers().$promise.then(function(e){u.users=e}).catch(function(e){console.error(e)}),e.$on("$destroy",function(){s.removeAllListeners("chatInternalMessage:save"),s.removeAllListeners("chatInternalMessage:update"),s.removeAllListeners("user:update")})}e.$inject=["$scope","toasty","api","$timeout","Auth","socket","$mdSidenav","$q","$interval","$translate","$rootScope","$http"],angular.module("app.quick-panel").controller("ChatInternalController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(e){a.hide(e)}d.errors=[],d.title="QUICKPANEL.EDIT_CHATGROUP",d.group=angular.copy(r),d.currentUser=o.getCurrentUser(),d.members=l,d.newChatGroup=!0,d.group||(d.group={write:!0,members:[]},d.title="QUICKPANEL.NEW_CHATGROUP"),d.saveChatGroup=function(){var t;return d.errors=[],s.chatGroup.save({name:d.group.name,write:d.group.write}).$promise.then(function(e){var n=_.map(d.group.members,"id");return n.unshift(d.currentUser.id),t=e,s.chatGroup.addMembers({id:t.id,ids:n}).$promise}).then(function(){i.success({title:"Group properly saved!",msg:t.name+" has been saved!"}),c(t)}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.closeDialog=c,d.querySearch=function(e){return e?d.members.rows.filter((n=e,t=angular.lowercase(n),function(e){var n=e.name.toLowerCase();return-1!=n.indexOf(t)})):[];var n,t}}e.$inject=["$scope","$state","$location","$mdDialog","toasty","api","Auth","group","members"],angular.module("app.quick-panel").controller("CreateOrEditChatGroupDialogController",e)}(),function(){"use strict";function e(e,t,a,s,n,o,i,r,l,d){var c=this;function m(){delete c.group}function u(e){var n=angular.element("#chat-group-dialog");a(function(){n.animate({scrollTop:n[0].scrollHeight},e)},0)}c.currentUser=i.getCurrentUser(),c.unreadGroupMessages={},c.groups={},c.participants,c.group,c.init=function(e){return c.license=e,r.user.getGroups({id:c.currentUser.id}).$promise.then(function(e){for(var n=0,t=[];n<e.rows.length;n++)e.rows[n].unreadGroupMessages=0,c.groups[e.rows[n].id]=e.rows[n],t.push(r.chatGroup.getUnread({id:e.rows[n].id}).$promise);return o.all(t)}).then(function(e){for(var n=0;n<e.length;n++)c.groups[e[n].id].unreadGroupMessages+=e[n].count}).catch(function(e){console.error(e)})},c.back=m,c.addGroup=function(e,n){s.show({controller:"CreateOrEditChatGroupDialogController",controllerAs:"vm",templateUrl:"app/quick-panel/tabs/groups/create/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{group:e,me:c.currentUser,license:null,setting:null},resolve:{members:function(){return i.hasRole("admin")?r.user.get({role:"agent"}).$promise:r.userProfile.getResources({id:i.getCurrentUser().userProfileId,section:"Agents",role:"agent"}).$promise}}}).then(function(e){e&&(c.groups[e.id]=e)}).catch(function(e){e&&console.error(e.message)})},c.deleteGroup=function(e,n){var t=s.confirm().title("Are you sure want to delete the selected group?").htmlContent("Group <b>"+e.name+"</b> will be deleted.").ariaLabel("delete Group").targetEvent(n).ok("OK").cancel("CANCEL");s.show(t).then(function(){return r.chatGroup.delete({id:e.id}).$promise}).then(function(){delete c.groups[e.id],d.success({title:"Group properly deleted!",msg:e.name+" has been deleted!"})}).catch(function(e){e&&d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatGroup.delete",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.groupsToArray=function(){return _.values(c.groups)},c.showMessageInfo=function(e,i){s.show({controller:"ShowMessageInfoDialogController",controllerAs:"vm",templateUrl:"app/quick-panel/tabs/groups/info/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{message:i},resolve:{data:function(){var a={messages:[]};return r.chatInternalMessage.get({ChatInternalMessageId:i.id}).$promise.then(function(e){var n=[];a.messages=e.rows,a.messages.unshift(i);for(var t=0;t<a.messages.length;t++)n.push(r.user.get({id:a.messages[t].ToId,fields:"id,name,fullname,userpic"}).$promise);return o.all(n)}).then(function(e){return a.users=e,a}).catch(function(e){e&&console.error(e)})}}}).then(function(){}).catch(function(e){e&&console.error(e.message)})},c.toggleChat=function(n){c.group={id:n.id,write:n.write,messages:{}},r.chatGroup.getMembers({id:n.id,fields:"id,name,fullname"}).$promise.then(function(e){return c.group.membersByKeys=_.keyBy(e.rows,"id"),c.group.members=_.differenceBy(e.rows,[{id:c.currentUser.id}],"id"),c.participants=_.map(c.group.members,"fullname").join(", "),r.chatGroup.getMessages({id:n.id,nolimit:!0}).$promise}).then(function(e){for(var n,t=0,a=[];t<e.count;t++)e.rows[t].ToId===c.currentUser.id&&(n=e.rows[t],c.group.messages[n.id]=n,e.rows[t].ToId!=c.currentUser.id||e.rows[t].FromId===c.currentUser.id||n.read||a.push(r.chatInternalMessage.update({id:n.id,read:!0})));return o.all(a)}).then(function(){u(400)}).catch(function(e){console.error(e.message)})},c.reply=function(){if(!c.replyMessage)return;var t={id:c.group.id,FromId:c.currentUser.id,ToId:c.currentUser.id,body:c.replyMessage,read:!0},a=[];c.replyMessage="",r.chatGroup.addMessage(t).$promise.then(function(e){t.read=!1,t.ChatInternalMessageId=e.id;for(var n=0;n<c.group.members.length;n++)c.group.members[n].id!==c.currentUser.id&&(t.ToId=c.group.members[n].id,a.push(r.chatGroup.addMessage(angular.copy(t)).$promise));return o.all(a)}).catch(function(e){console.log(e)})},l.on("chatInternalMessage:save",function(n){if(!c.group&&n.ToId===c.currentUser.id&&n.FromId!==c.currentUser.id&&!n.read&&n.ChatGroupId){var e=c.groups[n.ChatGroupId];if(!e)return r.chatGroup.get({id:n.ChatGroupId}).$promise.then(function(e){e.unreadGroupMessages=1,c.groups[e.id]=e});e.unreadGroupMessages||(e.unreadGroupMessages=0),e.unreadGroupMessages++}c.group&&n.ChatGroupId===c.group.id&&n.ToId===c.currentUser.id&&r.chatInternalMessage.update({id:n.id,read:!0}).$promise.then(function(){var e;e=n,c.group.messages[e.id]=e,u(400)})}),l.on("chatInternalMessage:update",function(e){e.ToId==c.currentUser.id&&e.FromId!==c.currentUser.id&&e.ChatGroupId&&e.read&&(0<c.groups[e.ChatGroupId].unreadGroupMessages&&c.groups[e.ChatGroupId].unreadGroupMessages--,c.group.messages[e.id]&&(c.group.messages[e.id].read=!0))}),l.on("chatGroup:remove",function(e){c.groups[e.id]&&delete c.groups[e.id]}),n("quick-panel").onClose(m),e.$on("$destroy",function(){l.removeAllListeners("chatInternalMessage:save"),l.removeAllListeners("chatInternalMessage:update"),l.removeAllListeners("chatGroup:remove")})}e.$inject=["$scope","$document","$timeout","$mdDialog","$mdSidenav","$q","Auth","api","socket","toasty"],angular.module("app.quick-panel").controller("ChatGroupController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r){this.data=r,this.title="QUICKPANEL.INFO",this.closeDialog=function(){a.hide()}}e.$inject=["$scope","$state","$location","$mdDialog","toasty","api","Auth","data"],angular.module("app.quick-panel").controller("ShowMessageInfoDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;o.form={token:s.token},o.setting={},o.resetPassword=function(){return i.auth.reset(o.form).$promise.then(function(){n.success({title:t.instant("RESETPASSWORD.PASSWORD_RESET"),msg:t.instant("RESETPASSWORD.PASSWORD_RESET_MESSAGE")}),a.go("app.login")}).catch(function(e){e&&n.error({title:t.instant("RESETPASSWORD.PASSWORD_RESET_ERROR"),msg:e.data?e.data.message||e.message||e:e.message||e})})},o.onInit=function(){e.isLoggedIn()&&a.go("app.dashboards.general");return i.setting.gdpr({id:1}).$promise.then(function(e){o.setting=e,o.passwordPattern=o.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:""}).catch(function(e){e&&n.error({title:"Error",msg:e.data?e.data.message||e.message||e:e.message||e})})}}e.$inject=["Auth","toasty","$translate","$state","api","$stateParams"],angular.module("app.reset").controller("ResetPasswordController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;function m(){u()}function u(){s.user.get({id:c.user.id}).$promise.then(function(e){c.user.permissions=e.permissions,c.items=[{font_icon:"icon-hangouts",class:"green-700-fg",label:"chat",title:"TOOLBAR.CHAT",value:"chat",permission:r.chat&&(p(105)||e.chatAutoanswer),enabled:e.chatAutoanswer,delay:e.chatAutoanswerDelay},{font_icon:"icon-email",class:"teal-fg",label:"email",title:"TOOLBAR.EMAIL",value:"email",permission:r.mail&&(p(106)||e.emailAutoanswer),enabled:e.emailAutoanswer,delay:e.emailAutoanswerDelay},{font_icon:"icon-message-text",class:"orange-fg",label:"sms",title:"TOOLBAR.SMS",value:"sms",permission:r.messaging&&(p(107)||e.smsAutoanswer),enabled:e.smsAutoanswer,delay:e.smsAutoanswerDelay},{font_icon:"icon-google-earth",class:"amber-fg",label:"openchannel",title:"TOOLBAR.OPENCHANNEL",value:"openchannel",permission:r.openchannel&&(p(108)||e.openchannelAutoanswer),enabled:e.openchannelAutoanswer,delay:e.openchannelAutoanswerDelay},{font_icon:"icon-deskphone",class:"grey-A200-fg",label:"fax",title:"TOOLBAR.FAX",value:"fax",permission:r.fax&&(p(109)||e.faxAutoanswer),enabled:e.faxAutoanswer,delay:e.faxAutoanswerDelay},{font_icon:"icon-whatsapp",class:"lime-A700-fg",label:"whatsapp",title:"TOOLBAR.WHATSAPP",value:"whatsapp",permission:r.whatsapp&&(p(114)||e.whatsappAutoanswer),enabled:e.whatsappAutoanswer,delay:e.whatsappAutoanswerDelay}]})}function p(e){return _.includes(c.user.permissions,e)}c.items=[],c.closeDialog=function(){a.hide()},c.user=d.getCurrentUser(),u(),o.connect(),o.on("userNotification:recalc:"+c.user.id,m)}e.$inject=["$scope","$state","$location","$mdDialog","toasty","api","socket","license","user","Auth"],angular.module("app.toolbar").controller("AutoAnswerNotificationsDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.errors=[],r.user=i,r.setting=s,r.reset=o,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.savePassword=function(){r.errors=[],a.user.changePassword({id:r.user.id},{oldPassword:r.oldPassword,newPassword:r.password}).$promise.then(function(){n.show(n.simple().textContent("Your password properly updated").position("top right").hideDelay(5e3)),l()}).catch(function(e){console.error(e),r.errors=e.data.errors&&e.data.errors.length?e.data.errors:[{message:e.data.message||"Authorization error",type:"api.user.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.changePasswordForm.password.$setValidity("oldPasswordMatch",!1):t.changePasswordForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","$mdToast","api","user","setting","reset"],angular.module("app.toolbar").controller("ChangePasswordController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o){var r=this;function l(e,n){var t={id:e.id};n?t.recallmeNotifiedDate=null:r.isRecallNotification?t.recallmeNotifiedDate=null:e.recallme||(t.UserId=null),i.cmHopper.update(t)}function d(e){var n=!1;_.isNil(e)||(n=e),l(r.preview,n),t.hide()}function c(e){return i.cmContact.getAdditionalPhones({id:e}).$promise.then(function(e){var n=_.map(e,"item"),t=_.map(e,"description");r.additionalItemTypes=_.map(e,"ItemTypeId");var a=_.map(e,"ItemType.rgbBackgroundColor"),i=_.map(e,"ItemType.name");r.additionalItems=[];for(var s=0;s<n.length;s++)r.additionalItems.push({phone:n[s],type:i[s],color:a[s],description:t[s]})})}r.customFieldsMap=s&&s.rows?_.mapValues(_.keyBy(s.rows,function(e){return"cf_"+e.id}),"name"):{},r.errors=[],r.hopperIds=[],r.additionalItems=[],r.preview=n,r.isRecallNotification=o,r.originated=!1,r.disable=!1,r.disableGetContact=!1,r.hopperIds.push(r.preview.id),r.originatePreview=function(){r.originated=!0,r.disable=!0,_.isEmpty(r.preview)?(a.error({title:"Message",msg:"Contact not available"}),r.disable=!1,r.hopperIds=[],d(!0)):i.rpc.getVoiceQueuesPreview({id:r.preview.id}).$promise.then(function(){d(!0)}).catch(function(e){a.error({title:"Message",msg:e.data}),d(!0)}).finally(function(){r.disable=!1,r.hopperIds=[]})},r.closeDialog=d,r.nextContact=function(){return r.disableGetContact=!0,i.cmHopper.getPreview({hopperIds:r.hopperIds,direction:"next"}).$promise.then(function(e){r.disableGetContact=!1,_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(r.hopperIds=[],t.hide(),a.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(c(e.Contact.id),r.originated||i.cmHopper.update({id:r.preview.id,UserId:null}),r.preview=e,r.hopperIds.push(r.preview.id))}).catch(function(e){if(r.disableGetContact=!1,r.hopperIds=[],404===e.status)r.getFirstAvailableContact();else if(e.data&&e.data.errors&&e.data.errors.length){t.hide();for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.hide(),a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.previousContact=function(){if(r.disableGetContact=!0,1<r.hopperIds.length){var e=_.without(r.hopperIds,r.preview.id);return i.cmHopper.getPreview({hopperIds:e,direction:"prev"}).$promise.then(function(e){r.disableGetContact=!1,_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(r.hopperIds=[],t.hide(),a.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(c(e.Contact.id),_.remove(r.hopperIds,function(e){return e==r.preview.id}),r.originated||i.cmHopper.update({id:r.preview.id,UserId:null}),r.preview=e)}).catch(function(e){if(404===e.status)r.hopperIds=[r.preview.id],a.info({title:"PREVIEW",msg:"PREVIOUS CONTACTS NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length){r.hopperIds=[],t.hide();for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.hopperIds=[],t.hide(),a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}},r.getFirstAvailableContact=function(){return r.disableGetContact=!0,a.info({title:"PREVIEW",msg:"CONTACTS NOT AVAILABLE. REWINDING THE LIST"}),i.cmHopper.getPreview({hopperIds:[r.preview.id],direction:"next"}).$promise.then(function(e){_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(t.hide(),a.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(c(e.Contact.id),r.originated||i.cmHopper.update({id:r.preview.id,UserId:null}),r.preview=e,r.hopperIds.push(r.preview.id))}).catch(function(e){if(t.hide(),404===e.status)a.info({title:"PREVIEW",msg:"CONTACTS NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})}).finally(function(){r.disableGetContact=!1})},r.isCustomField=function(e){return _.startsWith(e,"cf_")},r.isHiddenField=function(e){return _.includes(["Company","CompanyId","ListId","UserId","createdAt","deletedAt","id","dialTimezone","utcOffset","AdditionalPhones","additionalPhones","priority","scheduledat","tags","updatedAt","facebook","twitter","skype","wechat","teams","viber","line","telegram"],e)},r.isNil=function(e){return _.isNil(e)},_.isNil(r.preview)||c(r.preview.Contact.id),e.$on("$destroy",function(){r.originated||l(r.preview,!1)})}e.$inject=["$scope","$mdDialog","toasty","api","preview","customFields","isRecallNotification"],angular.module("app.toolbar").controller("PreviewDialogController",e).directive("customChip",function(){return{restrict:"A",scope:!1,link:function(e,n,t){n.parent().parent().css("background",e.$chip.color)}}})}(),function(){"use strict";function e(n,t,s,a,o,e,i,r,l,d,c,m,u,p,g,v,h,f,b,A,E,y,S){var T,I=this;I.voiceQueues={},I.polling=!0,t.global={search:""},I.pauses=[],I.license=b,I.currentUser=v.getCurrentUser(),I.unreadTotalMessages=0,I.unreadTotalGroupMessages=0,I.contacts=0,"agent"===I.currentUser.role&&(T=E(function(){_.some(I.voiceQueues,{dialMethod:"preview",dialActive:!0})&&I.license.dialer&&I.polling?(I.polling=!1,f.cmHopper.getOpenContacts().$promise.then(function(e){e&&_.isNumber(e.contacts)&&(I.contacts=e.contacts)}).finally(function(){I.polling=!0})):I.contacts=0},14999)),I.setting=A,I.bodyEl=angular.element("body"),I.conf={realm:"asterisk",host:e.host(),protocol:e.protocol(),soundPlayerId:"local-audio",remotePlayerId:"remote-audio",ua:"Motion WebRTC Bar 0.2.0",license:I.license.webrtc,phoneBarExpires:I.currentUser.phoneBarExpires,phoneBarPrefixRequired:I.currentUser.phoneBarPrefixRequired,wssPort:I.currentUser.wssPort},I.webRTCSessions=[],I.autoanswerIconColor="green-700-fg",I.query={id:v.getCurrentUser().id,fields:"id,name,type,dialMethod,dialActive",channel:"voice",nolimit:!0},I.userStatusOptions=[{title:"Online",icon:"icon-checkbox-marked-circle",color:"#4CAF50"},{title:"Away",icon:"icon-clock",color:"#FFC107"},{title:"Do not Disturb",icon:"icon-minus-circle",color:"#F44336"},{title:"Invisible",icon:"icon-checkbox-blank-circle-outline",color:"#BDBDBD"},{title:"Offline",icon:"icon-checkbox-blank-circle-outline",color:"#616161"}],I.languages={ar:{title:"Arabic",translation:"TOOLBAR.ARABIC",code:"ar",flag:"ar"},cs:{title:"Czech",translation:"TOOLBAR.CZECH",code:"cs",flag:"cs"},da:{title:"Danish",translation:"TOOLBAR.DANISH",code:"da",flag:"da"},de:{title:"German",translation:"TOOLBAR.GERMAN",code:"de",flag:"de"},en:{title:"English",translation:"TOOLBAR.ENGLISH",code:"en",flag:"us"},es:{title:"Spanish",translation:"TOOLBAR.SPANISH",code:"es",flag:"es"},fa:{title:"Persian",translation:"TOOLBAR.PERSIAN",code:"fa",flag:"fa"},fi:{title:"Finnish",translation:"TOOLBAR.FINNISH",code:"fi",flag:"fi"},fr:{title:"French",translation:"TOOLBAR.FRENCH",code:"fr",flag:"fr"},he:{title:"Hebrew",translation:"TOOLBAR.HEBREW",code:"he",flag:"he"},hi:{title:"Hindi",translation:"TOOLBAR.HINDI",code:"hi",flag:"hi"},hu:{title:"Hungarian",translation:"TOOLBAR.HUNGARIAN",code:"hu",flag:"hu"},id:{title:"Indonesian",translation:"TOOLBAR.INDONESIAN",code:"id",flag:"id"},it:{title:"Italian",translation:"TOOLBAR.ITALIAN",code:"it",flag:"it"},ja:{title:"Japanese",translation:"TOOLBAR.JAPANESE",code:"ja",flag:"ja"},ko:{title:"Korean",translation:"TOOLBAR.KOREAN",code:"ko",flag:"ko"},lv:{title:"Latvian",translation:"TOOLBAR.LATVIAN",code:"lv",flag:"lv"},nl:{title:"Dutch",translation:"TOOLBAR.DUTCH",code:"nl",flag:"nl"},no:{title:"Norwegian",translation:"TOOLBAR.NORWEGIAN",code:"no",flag:"no"},pl:{title:"Polish",translation:"TOOLBAR.POLISH",code:"pl",flag:"pl"},"pt-BR":{title:"Brazilian",translation:"TOOLBAR.BRAZILIAN",code:"pt-BR",flag:"pt-BR"},"pt-PT":{title:"Portuguese",translation:"TOOLBAR.PORTUGUESE",code:"pt-PT",flag:"pt-PT"},ru:{title:"Russian",translation:"TOOLBAR.RUSSIAN",code:"ru",flag:"ru"},sv:{title:"Swedish",translation:"TOOLBAR.SWEDISH",code:"sv",flag:"sv"},tr:{title:"Turkish",translation:"TOOLBAR.TURKISH",code:"tr",flag:"tr"},"zh-CN":{title:"ChineseSimplified",translation:"TOOLBAR.CHINESESIMPLIFIED",code:"zh-CN",flag:"zh-CN"},"zh-TW":{title:"ChineseTraditional",translation:"TOOLBAR.CHINESETRADITIONAL",code:"zh-TW",flag:"zh-TW"}};var O=["ar","fa","he"],C=S.getLogger("toolbar");function w(){h.connect(),h.on("user:update",I.onUserUpdate),h.on("user:called",I.onUserCalled),h.on("chatInternalMessage:save",I.onInternalMessageSave),h.on("chatInternalMessage:update",I.onInternalMessageUpdate),h.on("userVoiceQueue:save",I.onUserVoiceQueue),h.on("voiceQueue:save",I.onVoiceQueue),h.on("userVoiceQueue:remove",I.onUserVoiceQueue),h.on("voiceQueue:remove",I.onVoiceQueue),h.on("voiceQueue:update",I.onVoiceQueue),h.on("user:forcelogout",M),h.on("userNotification:send",U),h.on("userNotification:recalc:"+I.user.id,F)}function R(){h.disconnect("logout")}function x(e){I.voiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}function N(){I.promise=f.user.getQueues(I.query,x).$promise}function D(e,n,t){n||(n=!1),t||(t={type:"click",target:"button.preview-button"}),c.show({controller:"PreviewDialogController",controllerAs:"vm",templateUrl:"app/toolbar/preview/dialog.html",parent:angular.element(m.body),targetEvent:t,clickOutsideToClose:!0,locals:{preview:e,currentUser:I.currentUser,isRecallNotification:n},resolve:{customFields:["apiResolver",function(e){return e.resolve("cmCustomField@get",{nolimit:!0})}]}})}function P(){return I.license.chat&&(I.hasPermission(105)||I.currentUser.chatAutoanswer)||I.license.mail&&I.hasPermission(106)||I.currentUser.emailAutoanswer||I.license.messaging&&I.hasPermission(107)||I.currentUser.smsAutoanswer||I.license.openchannel&&I.hasPermission(108)||I.currentUser.openchannelAutoanswer||I.license.fax&&I.hasPermission(109)||I.currentUser.faxAutoanswer||I.license.whatsapp&&(I.hasPermission(114)||I.currentUser.whatsappAutoanswer)}function L(e){return R(),s.resolve().then(function(){if(!v.isTelephone())return S.flush()}).then(function(){return v.logout(e)}).then(function(){return t.$broadcast("webrtc::logout"),a.go("app.login")}).catch(function(e){C.error(e)})}function k(e,n){c.show({controller:"ChangePasswordController",controllerAs:"vm",templateUrl:"app/toolbar/changepassword/changepassword.html",parent:angular.element(m.body),targetEvent:e,clickOutsideToClose:!n,escapeToClose:!n,locals:{user:I.user,setting:A,reset:n}})}function M(e){if(C.debug("onForceLogout -> data",e),e.user.id===I.user.id&&0!==I.user.showWebBar)return R(),s.resolve().then(function(){if(!v.isTelephone())return S.flush()}).then(function(){return v.logout(!0)}).then(function(){t.$broadcast("webrtc::logout"),c.show(c.alert().parent(angular.element(m.body)).clickOutsideToClose(!1).escapeToClose(!1).title(r.instant("TOOLBAR.WARNING")).textContent(r.instant("TOOLBAR.USER_FORCE_LOGOUT",{ip:e.ip})).ok("OK")).then(function(){return a.go("app.login")})}).catch(function(e){C.error(e)})}function U(e){var n=e;if(I.currentUser.id===n.recipient){var t=r.instant("TOOLBAR.NOTIFICATION_TITLE",{sender:n.sender}),a=n.description?r.instant("TOOLBAR.NOTIFICATION_TITLE_RECIPIENT",{recipient:n.description}):null;p.wait({title:a?t+" "+a:t,msg:n.content,clickToClose:!1,timeout:!1,sound:n.beep,html:!0})}}function F(e){f.user.get({id:I.currentUser.id}).$promise.then(function(e){I.currentUser.permissions=e.permissions,I.autoanswerIconColor=P()?"green-700-fg":"gray-700-fg"})}I.toggleSidenav=function(e){i(e).toggle()},I.logout=L,I.changeLanguage=function(e){if(!I.languages.hasOwnProperty(e.code)){return void l.show({template:'<md-toast id="language-message" layout="column" layout-align="center start"><div class="md-toast-content">Motion supports multiple translations through angular-translate module, but currently we do not support the selected language. If you want to help us, send us a message.</div></md-toast>',hideDelay:7e3,position:"top right",parent:"#content"})}I.selectedLanguage=e,u.put("motion.language",e.code),r.use(e.code),"app.callysquare.projects.edit"===a.current.name&&d.location.reload();0<=O.indexOf(e.code)?p.info({title:r.instant("TOOLBAR.CHANGE_LANGUAGE_TITLE"),msg:r.instant("TOOLBAR.CHANGE_LANGUAGE_MESSAGE")}):n.$parent.$parent.vm.direction="ltr"},I.setUserStatus=function(e){I.userStatus=e},I.toggleHorizontalMobileMenu=function(){I.bodyEl.toggleClass("ms-navigation-horizontal-mobile-menu-active")},I.toggleMsNavigationFolded=function(){g.toggleFolded()},I.search=function(n){for(var e=[],t=g.getFlatNavigation(),a=s.defer(),i=0;i<t.length;i++)t[i].uisref&&e.push(t[i]);n&&(e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(n)))return!0}));return o(function(){a.resolve(e)},1e3),a.promise},I.searchResultClick=function(e){e.uisref&&(e.stateParams?a.go(e.state,e.stateParams):a.go(e.state))},I.openSettings=function(){t.$broadcast("webrtc::settings")},I.changePassword=k,I.isAgent=function(){return v.getCurrentUser()&&v.hasRole("agent")},I.onUserUpdate=function(e){if(e.id===I.user.id)if("agent"===e.role&&_.isBoolean(e.online)&&!e.online)if(0!==I.user.showWebBar){var n;R();var t=c.confirm({title:r.instant("TOOLBAR.WARNING")+"!",htmlContent:"<span>"+r.instant("TOOLBAR.SOMEONE_LOGGED_YOU_OUT")+"</span><br><span>"+r.instant("TOOLBAR.SESSION_TIMEOUT")+"</span>",ariaLabel:r.instant("TOOLBAR.WARNING")+"!",ok:r.instant("TOOLBAR.STAY_LOGGED"),cancel:r.instant("TOOLBAR.LOGOUT"),onComplete:function(){n=setTimeout(function(){c.cancel()},6e4)}});c.show(t).then(function(){return clearTimeout(n),v.queueLogin().then(function(){w(),_.merge(I.user,e),v.setCurrentUser(I.user)})}).catch(function(){clearTimeout(n),L(!0)})}else L(!0);else _.merge(I.user,e),v.setCurrentUser(I.user)},I.onUserCalled=function(e){if(2===I.currentUser.showWebBar&&"agent"===I.currentUser.role){var n=I.currentUser.privacyEnabled?y.mask(e.calleridnum):e.calleridnum;p.info({title:"WebRTC Popup",msg:"<div>            <span>Call from: "+n+"</span><br>            <span>Queue: "+e.queue+"</span><br>            <span>Extra: "+(e.variables.extravar?e.variables.extravar:"Not defined")+"</span><br>            </div>",showClose:!0,timeout:1e4,html:!0})}},I.pause=function(e){var n=e||"DEFAULT PAUSE";_.some(I.webRTCSessions,["confirmed",!0])&&(n="#"+n);return f.user.pause({id:I.user.id,type:n}).$promise.catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:PAUSEUSER",msg:e.status?JSON.stringify(e.data):e.toString()})})},I.unpause=function(){return f.user.unpause({id:I.user.id}).$promise.catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UNPAUSEUSER",msg:e.status?JSON.stringify(e.data):e.toString()})})},I.preview=function(n){return I.disable=!0,f.cmHopper.getPreview().$promise.then(function(e){_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?p.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"}):D(e,!1,n)}).catch(function(e){if(404===e.status)p.info({title:"PREVIEW",msg:"CONTACT NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length){I.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelMessage.accept",msg:e.data?JSON.stringify(e.data.message):e.toString()})}).finally(function(){I.disable=!1})},I.autoAnswerNotificationsDialog=function(e){if(P()){I.autoanswerNotifications;c.show({controller:"AutoAnswerNotificationsDialogController",controllerAs:"vm",templateUrl:"app/toolbar/autoanswers/dialog.html",parent:angular.element(m.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:I.license,user:I.currentUser}})}else alert(r.instant("TOOLBAR.NO_AUTOANSWER_CONFIGURED"))},I.getLogo=function(){return I.setting.defaultHeaderWhiteLabel?"xCALLY Motion":I.setting.headerWhiteLabel},I.userIsNotPhonebar=function(){return"admin"===I.currentUser.role||"user"===I.currentUser.role||"agent"===I.currentUser.role&&0!==I.currentUser.showWebBar},I.onInternalMessageSave=function(e){e.ToId!==I.currentUser.id||e.ChatGroupId||(I.unreadTotalMessages+=1);e.ToId===I.currentUser.id&&e.FromId!==I.currentUser.id&&!e.read&&e.ChatGroupId&&I.unreadTotalGroupMessages++},I.onInternalMessageUpdate=function(e){e.ToId===I.currentUser.id&&e.read&&0<I.unreadTotalMessages&&!e.ChatGroupId&&(I.unreadTotalMessages-=1);e.ToId===I.currentUser.id&&e.read&&e.ChatGroupId&&0<I.unreadTotalGroupMessages&&I.unreadTotalGroupMessages--},I.onUserVoiceQueue=function(e){_.toInteger(e.UserId)===v.getCurrentUser().id&&N()},I.onVoiceQueue=function(){N()},I.hasPermission=function(e){return _.includes(I.currentUser.permissions,e)},function(){I.user=v.getCurrentUser(),I.conf.ha1=I.user.md5secret,I.conf.id=I.user.id,I.conf.name=I.user.name,I.conf.fullname=I.user.fullname,I.conf.internal=I.user.internal,I.conf.recording=I.user.phoneBarEnableRecording,I.conf.autoAnswer=I.user.phoneBarAutoAnswer,I.conf.enableSettings=I.user.phoneBarEnableSettings,I.conf.enableDtmfTone=I.user.phoneBarEnableDtmfTone,I.conf.autoAnswerDelay=I.user.phoneBarAutoAnswerDelay,I.userStatus=I.userStatusOptions[0];var e=u.get("motion.language");e&&I.languages.hasOwnProperty(e)?I.selectedLanguage=I.languages[e]:I.selectedLanguage=I.languages[r.preferredLanguage()];if(f.pause.get({fields:"name",nolimit:!0}).$promise.then(function(e){I.pauses=e.rows?e.rows:[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETPAUSES",msg:e.status?JSON.stringify(e.data):e.toString()})}),"LOCAL_LOGIN"==v.getAuthenticationType()&&I.setting.securePassword)if(I.user.passwordResetAt){var n=moment(I.user.passwordResetAt).add(I.setting.passwordExpiresDays||90,"day");moment().isAfter(n)?k(null,!0):moment().add(15,"day").isAfter(n)&&p.warning({title:r.instant("TOOLBAR.WARNING")+"!",msg:r.instant("TOOLBAR.PASSWORD_EXPIRE_REMAINING_DAYS")+": "+Math.ceil(n.diff(moment(),"days",!0)),timeout:2e4})}else k(null,!0);F()}(),N(),w(),I.openPreviewDialog=D,f.chatInternalMessage.get({fields:"FromId",ToId:I.currentUser.id,read:!1,nolimit:!0}).$promise.then(function(e){I.unreadTotalMessages=e.rows.length}),n.$on("$destroy",function(){h.removeAllListeners("user:called"),h.removeAllListeners("user:update"),h.removeAllListeners("chatInternalMessage:save"),h.removeAllListeners("chatInternalMessage:update"),h.removeAllListeners("userVoiceQueue:save"),h.removeAllListeners("voiceQueue:save"),h.removeAllListeners("userVoiceQueue:remove"),h.removeAllListeners("voiceQueue:remove"),h.removeAllListeners("voiceQueue:update"),h.removeAllListeners("user:forcelogout"),h.removeAllListeners("userNotification:send"),h.removeAllListeners("userAutoanswerNotification:send"),T&&(E.cancel(T),T=null)})}e.$inject=["$scope","$rootScope","$q","$state","$timeout","$location","$mdSidenav","$translate","$mdToast","$window","$mdDialog","$document","$cookies","toasty","msNavigationService","Auth","socket","api","license","setting","$interval","privacyManager","ClientSideLoggingService"],angular.module("app.toolbar").controller("ToolbarController",e)}(),function(){"use strict";function e(a,i,t,s,e){var n={updateUserSettingById:function(e,n){if("number"==typeof e)return i.userSetting.update({id:e},n).$promise;throw new Error("User setting id is missing")}},o=!1,r=a.getCurrentUser(),l=r?r.userSetting:null,d=function(e){var n="user-setting:update:user-"+e;t.$on("local:user-updated",c),s.on(n,c)};function c(){return o?e(function(e){e(l)}):(o=!0,function(e){var n=a.getCurrentUser(),t=null;t="admin"===n.role&&"number"==typeof e?i.user.get({id:e,userSetting:!0}).$promise:i.user.whoami({userSetting:!0}).$promise;return t.then(function(e){return a.setCurrentUser(e),e.userSetting})}().then(function(e){l=e,t.$emit("local:user-setting-updated",l)}).finally(function(){o=!1}))}return r&&d(r.id),t.$on("local:user-login",d),t.$on("local:user-logout",function(e){var n="user-setting:update:user-"+e;s.removeListener(n,c),l=null}),n}e.$inject=["Auth","api","$rootScope","socket","$q"],angular.module("app.user-setting").service("UserSettingService",e)}();var urlParams=function(e){var n=new Object,t=e.lastIndexOf("?");if(0<t)for(var a=e.substring(t+1).split("&"),i=0;i<a.length;i++)0<(t=a[i].indexOf("="))&&(n[a[i].substring(0,t)]=a[i].substring(t+1));return n}(window.location.href),t0=new Date,MAX_REQUEST_SIZE=10485760,MAX_WIDTH=12e3,MAX_HEIGHT=12e3,EXPORT_URL="http://exp.draw.io/ImageExport2/export",SHARE_HOST="http://localhost:3000",SAVE_URL="api/square/projects/",VARIABLE_URL="/api/variables",STENCIL_PATH="/assets/plugins/square/stencils",SHAPES_PATH="/assets/plugins/square/shapes",IMAGE_PATH="/assets/plugins/square/images",STYLE_PATH="/assets/plugins/square/styles",CSS_PATH="/assets/plugins/square/styles",OPEN_FORM="api/square/projects/open",TEMPLATE_PATH="/assets/plugins/square/templates",RESOURCES_PATH="/assets/plugins/square/resources",RESOURCE_BASE=RESOURCES_PATH+"/grapheditor",CRUD_PERMISSIONS={readOnly:!1,canEdit:!1,canDelete:!1},tapAndHoldStartsConnection=!0,showConnectorImg=!0,mxLoadResources=!1,mxLanguages=["it","fr","ko","es","sv","ru","de","ja","zh-CN","zh-TW","nl","fi","da","pt-BR","pt-PT","no","hi","tr","fa"],mxLanguage="en",match=document.cookie.match(new RegExp("(^| )motion.language=([^;]+)"));match&&mxLanguages.includes(match[2])&&(mxLanguage=match[2]);var mxBasePath="assets/plugins/mxgraph",mxClient={VERSION:"2.0.0.0",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&navigator.userAgent.indexOf("MSIE")<0,IS_OP:0<=navigator.userAgent.indexOf("Opera/"),IS_OT:navigator.userAgent.indexOf("Presto/2.4.")<0&&navigator.userAgent.indexOf("Presto/2.3.")<0&&navigator.userAgent.indexOf("Presto/2.2.")<0&&navigator.userAgent.indexOf("Presto/2.1.")<0&&navigator.userAgent.indexOf("Presto/2.0.")<0&&navigator.userAgent.indexOf("Presto/1.")<0,IS_SF:0<=navigator.userAgent.indexOf("AppleWebKit/")&&navigator.userAgent.indexOf("Chrome/")<0,IS_GC:0<=navigator.userAgent.indexOf("Chrome/"),IS_MT:0<=navigator.userAgent.indexOf("Firefox/")&&navigator.userAgent.indexOf("Firefox/1.")<0&&navigator.userAgent.indexOf("Firefox/2.")<0||0<=navigator.userAgent.indexOf("Iceweasel/")&&navigator.userAgent.indexOf("Iceweasel/1.")<0&&navigator.userAgent.indexOf("Iceweasel/2.")<0||0<=navigator.userAgent.indexOf("SeaMonkey/")&&navigator.userAgent.indexOf("SeaMonkey/1.")<0||0<=navigator.userAgent.indexOf("Iceape/")&&navigator.userAgent.indexOf("Iceape/1.")<0,IS_SVG:0<=navigator.userAgent.indexOf("Firefox/")||0<=navigator.userAgent.indexOf("Iceweasel/")||0<=navigator.userAgent.indexOf("Seamonkey/")||0<=navigator.userAgent.indexOf("Iceape/")||0<=navigator.userAgent.indexOf("Galeon/")||0<=navigator.userAgent.indexOf("Epiphany/")||0<=navigator.userAgent.indexOf("AppleWebKit/")||0<=navigator.userAgent.indexOf("Gecko/")||0<=navigator.userAgent.indexOf("Opera/"),NO_FO:0<=navigator.userAgent.indexOf("Firefox/1.")||0<=navigator.userAgent.indexOf("Iceweasel/1.")||0<=navigator.userAgent.indexOf("Firefox/2.")||0<=navigator.userAgent.indexOf("Iceweasel/2.")||0<=navigator.userAgent.indexOf("SeaMonkey/1.")||0<=navigator.userAgent.indexOf("Iceape/1.")||0<=navigator.userAgent.indexOf("Camino/1.")||0<=navigator.userAgent.indexOf("Epiphany/2.")||0<=navigator.userAgent.indexOf("Opera/")||0<=navigator.userAgent.indexOf("MSIE")||0<=navigator.userAgent.indexOf("Mozilla/2."),IS_VML:"MICROSOFT INTERNET EXPLORER"==navigator.appName.toUpperCase(),IS_MAC:0<navigator.userAgent.toUpperCase().indexOf("MACINTOSH"),IS_TOUCH:0<navigator.userAgent.toUpperCase().indexOf("IPAD")||0<navigator.userAgent.toUpperCase().indexOf("IPOD")||0<navigator.userAgent.toUpperCase().indexOf("IPHONE")||0<navigator.userAgent.toUpperCase().indexOf("ANDROID"),IS_LOCAL:document.location.href.indexOf("http://")<0&&document.location.href.indexOf("https://")<0,isBrowserSupported:function(){return mxClient.IS_VML||mxClient.IS_SVG},link:function(e,n,t){if(t=t||document,mxClient.IS_IE6)t.write('<link rel="'+e+'" href="'+n+'" charset="ISO-8859-1" type="text/css"/>');else{var a=t.createElement("link");a.setAttribute("rel",e),a.setAttribute("href",n),a.setAttribute("charset","ISO-8859-1"),a.setAttribute("type","text/css"),t.getElementsByTagName("head")[0].appendChild(a)}},include:function(e){document.write('<script src="'+e+'"><\/script>')},dispose:function(){for(var e=0;e<mxEvent.objects.length;e++)null!=mxEvent.objects[e].mxListenerList&&mxEvent.removeAllListeners(mxEvent.objects[e])}};if(mxClient.IS_OP&&mxClient.IS_OT?mxClient.CSS_PREFIX="O":mxClient.IS_SF||mxClient.IS_GC?mxClient.CSS_PREFIX="Webkit":mxClient.IS_MT?mxClient.CSS_PREFIX="Moz":mxClient.IS_IE&&9<=document.documentMode&&(mxClient.CSS_PREFIX="ms"),void 0===mxLoadResources&&(mxLoadResources=!0),"undefined"==typeof mxResourceExtension&&(mxResourceExtension=".txt"),"undefined"==typeof mxLoadStylesheets&&(mxLoadStylesheets=!0),void 0!==mxBasePath&&0<mxBasePath.length?("/"==mxBasePath.substring(mxBasePath.length-1)&&(mxBasePath=mxBasePath.substring(0,mxBasePath.length-1)),mxClient.basePath=mxBasePath):mxClient.basePath=".","undefined"!=typeof mxImageBasePath&&0<mxImageBasePath.length?("/"==mxImageBasePath.substring(mxImageBasePath.length-1)&&(mxImageBasePath=mxImageBasePath.substring(0,mxImageBasePath.length-1)),mxClient.imageBasePath=mxImageBasePath):mxClient.imageBasePath=mxClient.basePath+"/images",mxClient.language=void 0!==mxLanguage?mxLanguage:mxClient.IS_IE?navigator.userLanguage:navigator.language,mxClient.defaultLanguage="undefined"!=typeof mxDefaultLanguage?mxDefaultLanguage:"en",mxLoadStylesheets&&mxClient.link("stylesheet",mxClient.basePath+"/css/common.css"),void 0!==mxLanguages&&(mxClient.languages=mxLanguages),mxClient.IS_IE){if(9<=document.documentMode)mxClient.IS_VML=!1,mxClient.IS_SVG=!0;else{8==document.documentMode?(document.namespaces.add(mxClient.VML_PREFIX,"urn:schemas-microsoft-com:vml","#default#VML"),document.namespaces.add(mxClient.OFFICE_PREFIX,"urn:schemas-microsoft-com:office:office","#default#VML")):(document.namespaces.add(mxClient.VML_PREFIX,"urn:schemas-microsoft-com:vml"),document.namespaces.add(mxClient.OFFICE_PREFIX,"urn:schemas-microsoft-com:office:office"));var ss=document.createStyleSheet();ss.cssText="v\\:*{behavior:url(#default#VML)}o\\:*{behavior:url(#default#VML)}",mxLoadStylesheets&&mxClient.link("stylesheet",mxClient.basePath+"/css/explorer.css")}window.attachEvent("onunload",mxClient.dispose)}var mxLog={consoleName:"Console",TRACE:!1,DEBUG:!0,WARN:!0,buffer:"",init:function(){if(null==mxLog.window&&null!=document.body){var e=mxLog.consoleName+" - mxGraph "+mxClient.VERSION,n=document.createElement("table");n.setAttribute("width","100%"),n.setAttribute("height","100%");var t=document.createElement("tbody"),a=document.createElement("tr"),i=document.createElement("td");if(i.style.verticalAlign="top",mxLog.textarea=document.createElement("textarea"),mxLog.textarea.setAttribute("readOnly","true"),mxLog.textarea.style.height="100%",mxLog.textarea.style.resize="none",mxLog.textarea.value=mxLog.buffer,mxLog.textarea.style.width=mxClient.IS_NS&&"BackCompat"!=document.compatMode?"99%":"100%",i.appendChild(mxLog.textarea),a.appendChild(i),t.appendChild(a),a=document.createElement("tr"),mxLog.td=document.createElement("td"),mxLog.td.style.verticalAlign="top",mxLog.td.setAttribute("height","30px"),a.appendChild(mxLog.td),t.appendChild(a),n.appendChild(t),mxLog.addButton("Info",function(e){mxLog.info()}),mxLog.addButton("DOM",function(e){e=mxUtils.getInnerHtml(document.body),mxLog.debug(e)}),mxLog.addButton("Trace",function(e){mxLog.TRACE=!mxLog.TRACE,mxLog.TRACE?mxLog.debug("Tracing enabled"):mxLog.debug("Tracing disabled")}),mxLog.addButton("Copy",function(e){try{mxUtils.copy(mxLog.textarea.value)}catch(e){mxUtils.alert(e)}}),mxLog.addButton("Show",function(e){try{mxUtils.popup(mxLog.textarea.value)}catch(e){mxUtils.alert(e)}}),mxLog.addButton("Clear",function(e){mxLog.textarea.value=""}),a=t=0,a="number"==typeof window.innerWidth?(t=window.innerHeight,window.innerWidth):(t=document.documentElement.clientHeight||document.body.clientHeight,document.body.clientWidth),mxLog.window=new mxWindow(e,n,Math.max(0,a-320),Math.max(0,t-210),300,160),mxLog.window.setMaximizable(!0),mxLog.window.setScrollable(!1),mxLog.window.setResizable(!0),mxLog.window.setClosable(!0),mxLog.window.destroyOnClose=!1,(mxClient.IS_NS||mxClient.IS_IE)&&!mxClient.IS_GC&&!mxClient.IS_SF&&"BackCompat"!=document.compatMode){var s=mxLog.window.getElement();e=function(e,n){mxLog.textarea.style.height=Math.max(0,s.offsetHeight-70)+"px"};mxLog.window.addListener(mxEvent.RESIZE_END,e),mxLog.window.addListener(mxEvent.MAXIMIZE,e),mxLog.window.addListener(mxEvent.NORMALIZE,e),mxLog.textarea.style.height="92px"}}},info:function(){mxLog.writeln(mxUtils.toString(navigator))},addButton:function(e,n){var t=document.createElement("button");mxUtils.write(t,e),mxEvent.addListener(t,"click",n),mxLog.td.appendChild(t)},isVisible:function(){return null!=mxLog.window&&mxLog.window.isVisible()},show:function(){mxLog.setVisible(!0)},setVisible:function(e){null==mxLog.window&&mxLog.init(),null!=mxLog.window&&mxLog.window.setVisible(e)},enter:function(e){if(mxLog.TRACE)return mxLog.writeln("Entering "+e),(new Date).getTime()},leave:function(e,n){if(mxLog.TRACE){var t=0!=n?" ("+((new Date).getTime()-n)+" ms)":"";mxLog.writeln("Leaving "+e+t)}},debug:function(){mxLog.DEBUG&&mxLog.writeln.apply(this,arguments)},warn:function(){mxLog.WARN&&mxLog.writeln.apply(this,arguments)},write:function(){for(var e="",n=0;n<arguments.length;n++)e+=arguments[n],n<arguments.length-1&&(e+=" ");null!=mxLog.textarea?(mxLog.textarea.value+=e,0<=navigator.userAgent.indexOf("Presto/2.5")&&(mxLog.textarea.style.visibility="hidden",mxLog.textarea.style.visibility="visible"),mxLog.textarea.scrollTop=mxLog.textarea.scrollHeight):mxLog.buffer+=e},writeln:function(){for(var e="",n=0;n<arguments.length;n++)e+=arguments[n],n<arguments.length-1&&(e+=" ");mxLog.write(e+"\n")}},mxObjectIdentity={FIELD_NAME:"mxObjectId",counter:0,get:function(e){if("object"==typeof e&&null==e[mxObjectIdentity.FIELD_NAME]){var n=mxUtils.getFunctionName(e.constructor);e[mxObjectIdentity.FIELD_NAME]=n+"#"+mxObjectIdentity.counter++}return e[mxObjectIdentity.FIELD_NAME]},clear:function(e){"object"==typeof e&&delete e[mxObjectIdentity.FIELD_NAME]}};function mxDictionary(){this.clear()}mxDictionary.prototype.map=null,mxDictionary.prototype.clear=function(){this.map={}},mxDictionary.prototype.get=function(e){return e=mxObjectIdentity.get(e),this.map[e]},mxDictionary.prototype.put=function(e,n){var t=mxObjectIdentity.get(e),a=this.map[t];return this.map[t]=n,a},mxDictionary.prototype.remove=function(e){e=mxObjectIdentity.get(e);var n=this.map[e];return delete this.map[e],n},mxDictionary.prototype.getKeys=function(){var e,n=[];for(e in this.map)n.push(e);return n},mxDictionary.prototype.getValues=function(){var e,n=[];for(e in this.map)n.push(this.map[e]);return n},mxDictionary.prototype.visit=function(e){for(var n in this.map)e(n,this.map[n])};var mxResources={resources:[],extension:mxResourceExtension,resourcesEncoded:!1,loadDefaultBundle:!0,loadSpecialBundle:!0,isLanguageSupported:function(e){return null==mxClient.languages||0<=mxUtils.indexOf(mxClient.languages,e)},getDefaultBundle:function(e,n){return mxResources.loadDefaultBundle||!mxResources.isLanguageSupported(n)?e+mxResources.extension:null},getSpecialBundle:function(e,n){if(null==mxClient.languages||!this.isLanguageSupported(n)){var t=n.indexOf("-");0<t&&(n=n.substring(0,t))}return mxResources.loadSpecialBundle&&mxResources.isLanguageSupported(n)&&n!=mxClient.defaultLanguage?e+"_"+n+mxResources.extension:null},add:function(e,n){if((n=null!=n?n:mxClient.language)!=mxConstants.NONE){var t=mxResources.getDefaultBundle(e,n);if(null!=t)try{var a=mxUtils.load(t);a.isReady()&&mxResources.parse(a.getText())}catch(e){}if(null!=(t=mxResources.getSpecialBundle(e,n)))try{(a=mxUtils.load(t)).isReady()&&mxResources.parse(a.getText())}catch(e){}}},parse:function(e){if(null!=e){e=e.split("\n");for(var n=0;n<e.length;n++)if("#"!=e[n].charAt(0)){var t=e[n].indexOf("=");if(0<t){var a=e[n].substring(0,t),i=e[n].length;13==e[n].charCodeAt(i-1)&&i--,t=e[n].substring(t+1,i),this.resourcesEncoded?(t=t.replace(/\\(?=u[a-fA-F\d]{4})/g,"%"),mxResources.resources[a]=unescape(t)):mxResources.resources[a]=t}}}},get:function(e,n,t){if(null==(e=mxResources.resources[e])&&(e=t),null!=e&&null!=n){t=[];for(var a=null,i=0;i<e.length;i++){var s=e.charAt(i);"{"==s?a="":null!=a&&"}"==s?(0<=(a=parseInt(a)-1)&&a<n.length&&t.push(n[a]),a=null):null!=a?a+=s:t.push(s)}e=t.join("")}return e}};function mxPoint(e,n){this.x=null!=e?e:0,this.y=null!=n?n:0}function mxRectangle(e,n,t,a){mxPoint.call(this,e,n),this.width=null!=t?t:0,this.height=null!=a?a:0}mxPoint.prototype.x=null,mxPoint.prototype.y=null,mxPoint.prototype.equals=function(e){return e.x==this.x&&e.y==this.y},mxPoint.prototype.clone=function(){return mxUtils.clone(this)},mxRectangle.prototype=new mxPoint,mxRectangle.prototype.constructor=mxRectangle,mxRectangle.prototype.width=null,mxRectangle.prototype.height=null,mxRectangle.prototype.setRect=function(e,n,t,a){this.x=e,this.y=n,this.width=t,this.height=a},mxRectangle.prototype.getCenterX=function(){return this.x+this.width/2},mxRectangle.prototype.getCenterY=function(){return this.y+this.height/2},mxRectangle.prototype.add=function(e){if(null!=e){var n=Math.min(this.x,e.x),t=Math.min(this.y,e.y),a=Math.max(this.x+this.width,e.x+e.width);e=Math.max(this.y+this.height,e.y+e.height),this.x=n,this.y=t,this.width=a-n,this.height=e-t}},mxRectangle.prototype.grow=function(e){this.x-=e,this.y-=e,this.width+=2*e,this.height+=2*e},mxRectangle.prototype.getPoint=function(){return new mxPoint(this.x,this.y)},mxRectangle.prototype.equals=function(e){return e.x==this.x&&e.y==this.y&&e.width==this.width&&e.height==this.height};var mxEffects={animateChanges:function(l,d,c){var m=0,u=function(){for(var e=!1,n=0;n<d.length;n++){var t=d[n];if(t instanceof mxGeometryChange||t instanceof mxTerminalChange||t instanceof mxValueChange||t instanceof mxChildChange||t instanceof mxStyleChange){var a=l.getView().getState(t.cell||t.child,!1);if(null!=a)if(e=!0,t.constructor!=mxGeometryChange||l.model.isEdge(t.cell))mxUtils.setOpacity(a.shape.node,100*m/10);else{var i=l.getView().scale,s=(t.geometry.x-t.previous.x)*i,o=(t.geometry.y-t.previous.y)*i,r=(t.geometry.width-t.previous.width)*i;i=(t.geometry.height-t.previous.height)*i;0==m?(a.x-=s,a.y-=o,a.width-=r,a.height-=i):(a.x+=s/10,a.y+=o/10,a.width+=r/10,a.height+=i/10),l.cellRenderer.redraw(a),mxEffects.cascadeOpacity(l,t.cell,100*m/10)}}}m<10&&e?(m++,window.setTimeout(u,p)):null!=c&&c()},p=30;u()},cascadeOpacity:function(e,n,t){for(var a=e.model.getChildCount(n),i=0;i<a;i++){var s=e.model.getChildAt(n,i),o=e.getView().getState(s);null!=o&&(mxUtils.setOpacity(o.shape.node,t),mxEffects.cascadeOpacity(e,s,t))}if(null!=(n=e.model.getEdges(n)))for(i=0;i<n.length;i++)null!=(a=e.getView().getState(n[i]))&&mxUtils.setOpacity(a.shape.node,t)},fadeOut:function(e,n,t,a,i,s){a=a||40,i=i||30;var o=n||100;if(mxUtils.setOpacity(e,o),s||null==s){var r=function(){o=Math.max(o-a,0),mxUtils.setOpacity(e,o),0<o?window.setTimeout(r,i):(e.style.visibility="hidden",t&&e.parentNode&&e.parentNode.removeChild(e))};window.setTimeout(r,i)}else e.style.visibility="hidden",t&&e.parentNode&&e.parentNode.removeChild(e)}},mxUtils={errorResource:"none"!=mxClient.language?"error":"",closeResource:"none"!=mxClient.language?"close":"",errorImage:mxClient.imageBasePath+"/error.gif",removeCursors:function(e){if(null!=e.style&&(e.style.cursor=""),null!=(e=e.childNodes))for(var n=e.length,t=0;t<n;t+=1)mxUtils.removeCursors(e[t])},getCurrentStyle:mxClient.IS_IE?function(e){return null!=e?e.currentStyle:null}:function(e){return null!=e?window.getComputedStyle(e,""):null},hasScrollbars:function(e){return null!=(e=mxUtils.getCurrentStyle(e))&&("scroll"==e.overflow||"auto"==e.overflow)},bind:function(e,n){return function(){return n.apply(e,arguments)}},eval:function(a){var b=null;if(0<=a.indexOf("function"))try{eval("var _mxJavaScriptExpression="+a),b=_mxJavaScriptExpression,_mxJavaScriptExpression=null}catch(e){mxLog.warn(e.message+" while evaluating "+a)}else try{b=eval(a)}catch(e){mxLog.warn(e.message+" while evaluating "+a)}return b},findNode:function(e,n,t){var a=e.getAttribute(n);if(null!=a&&a==t)return e;for(e=e.firstChild;null!=e;){if(null!=(a=mxUtils.findNode(e,n,t)))return a;e=e.nextSibling}return null},findNodeByAttribute:9<=document.documentMode?function(e,n,t){var a=null;if(null!=e)if(e.nodeType==mxConstants.NODETYPE_ELEMENT&&e.getAttribute(n)==t)a=e;else for(e=e.firstChild;null!=e&&null==a;)a=mxUtils.findNodeByAttribute(e,n,t),e=e.nextSibling;return a}:mxClient.IS_IE?function(e,n,t){return null==e?null:e.ownerDocument.selectSingleNode("//*[@"+n+"='"+t+"']")}:function(e,n,t){return null==e?null:e.ownerDocument.evaluate("//*[@"+n+"='"+t+"']",e.ownerDocument,null,XPathResult.ANY_TYPE,null).iterateNext()},getFunctionName:function(e){var n=null;if(null!=e)if(null!=e.name)n=e.name;else{for(e=e.toString(),n=9;" "==e.charAt(n);)n++;var t=e.indexOf("(",n);n=e.substring(n,t)}return n},indexOf:function(e,n){if(null!=e&&null!=n)for(var t=0;t<e.length;t++)if(e[t]==n)return t;return-1},remove:function(e,n){var t=null;if("object"==typeof n)for(var a=mxUtils.indexOf(n,e);0<=a;)n.splice(a,1),t=e,a=mxUtils.indexOf(n,e);for(var i in n)n[i]==e&&(delete n[i],t=e);return t},isNode:function(e,n,t,a){return!(null==e||isNaN(e.nodeType)||null!=n&&e.nodeName.toLowerCase()!=n.toLowerCase())&&(null==t||e.getAttribute(t)==a)},getChildNodes:function(e,n){n=n||mxConstants.NODETYPE_ELEMENT;for(var t=[],a=e.firstChild;null!=a;)a.nodeType==n&&t.push(a),a=a.nextSibling;return t},createXmlDocument:function(){var e=null;return document.implementation&&document.implementation.createDocument?e=document.implementation.createDocument("","",null):window.ActiveXObject&&(e=new ActiveXObject("Microsoft.XMLDOM")),e},parseXml:mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?function(e){var n=mxUtils.createXmlDocument();return n.async="false",n.loadXML(e),n}:function(e){return(new DOMParser).parseFromString(e,"text/xml")},clearSelection:document.selection?function(){document.selection.empty()}:window.getSelection?function(){window.getSelection().removeAllRanges()}:void 0,getPrettyXml:function(e,n,t){var a=[];if(null!=e)if(n=n||"  ",t=t||"",e.nodeType==mxConstants.NODETYPE_TEXT)a.push(e.nodeValue);else{a.push(t+"<"+e.nodeName);var i=e.attributes;if(null!=i)for(var s=0;s<i.length;s++){var o=mxUtils.htmlEntities(i[s].nodeValue);a.push(" "+i[s].nodeName+'="'+o+'"')}if(null!=(i=e.firstChild)){for(a.push(">\n");null!=i;)a.push(mxUtils.getPrettyXml(i,n,t+n)),i=i.nextSibling;a.push(t+"</"+e.nodeName+">\n")}else a.push("/>\n")}return a.join("")},removeWhitespace:function(e,n){for(var t=n?e.previousSibling:e.nextSibling;null!=t&&t.nodeType==mxConstants.NODETYPE_TEXT;){var a=n?t.previousSibling:t.nextSibling,i=mxUtils.getTextContent(t);0==mxUtils.trim(i).length&&t.parentNode.removeChild(t),t=a}},htmlEntities:function(e,n){return e=(e=(e=(e=(e=(e||"").replace(/&/g,"&amp;")).replace(/"/g,"&quot;")).replace(/\'/g,"&#39;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;"),(null==n||n)&&(e=e.replace(/\n/g,"&#xa;")),e},isVml:function(e){return null!=e&&"urn:schemas-microsoft-com:vml"==e.tagUrn},getXml:function(e,n){var t="";return null!=e&&(t=null==(t=e.xml)?e.innerHTML?e.innerHTML:(new XMLSerializer).serializeToString(e):t.replace(/\r\n\t[\t]*/g,"").replace(/>\r\n/g,">").replace(/\r\n/g,"\n")),t.replace(/\n/g,n||"&#xa;")},getTextContent:function(e){var n="";return null!=e&&(null!=e.firstChild&&(e=e.firstChild),n=e.nodeValue||""),n},getInnerHtml:mxClient.IS_IE?function(e){return null!=e?e.innerHTML:""}:function(e){return null!=e?(new XMLSerializer).serializeToString(e):""},getOuterHtml:mxClient.IS_IE?function(e){if(null==e)return"";if(null!=e.outerHTML)return e.outerHTML;var n=[];n.push("<"+e.nodeName);var t=e.attributes;if(null!=t)for(var a=0;a<t.length;a++){var i=t[a].nodeValue;null!=i&&0<i.length&&(n.push(" "),n.push(t[a].nodeName),n.push('="'),n.push(i),n.push('"'))}return 0==e.innerHTML.length?n.push("/>"):(n.push(">"),n.push(e.innerHTML),n.push("</"+e.nodeName+">")),n.join("")}:function(e){return null!=e?(new XMLSerializer).serializeToString(e):""},write:function(e,n){var t=e.ownerDocument.createTextNode(n);return null!=e&&e.appendChild(t),t},writeln:function(e,n){var t=e.ownerDocument.createTextNode(n);return null!=e&&(e.appendChild(t),e.appendChild(document.createElement("br"))),t},br:function(e,n){n=n||1;for(var t=null,a=0;a<n;a++)null!=e&&(t=e.ownerDocument.createElement("br"),e.appendChild(t));return t},button:function(e,n,t){return t=(t=null!=t?t:document).createElement("button"),mxUtils.write(t,e),mxEvent.addListener(t,"click",function(e){n(e)}),t},para:function(e,n){var t=document.createElement("p");return mxUtils.write(t,n),null!=e&&e.appendChild(t),t},addTransparentBackgroundFilter:function(e){e.style.filter+="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mxClient.imageBasePath+"/transparent.gif', sizingMethod='scale')"},linkAction:function(e,n,t,a,i){return mxUtils.link(e,n,function(){t.execute(a)},i)},linkInvoke:function(e,n,t,a,i,s){return mxUtils.link(e,n,function(){t[a](i)},s)},link:function(e,n,t,a){var i=document.createElement("span");return i.style.color="blue",i.style.textDecoration="underline",i.style.cursor="pointer",null!=a&&(i.style.paddingLeft=a+"px"),mxEvent.addListener(i,"click",t),mxUtils.write(i,n),null!=e&&e.appendChild(i),i},fit:function(e){var n=parseInt(e.offsetLeft),t=parseInt(e.offsetWidth),a=document.body,i=document.documentElement,s=(a.scrollLeft||i.scrollLeft)+(a.clientWidth||i.clientWidth);s<n+t&&(e.style.left=Math.max(a.scrollLeft||i.scrollLeft,s-t)+"px"),n=parseInt(e.offsetTop),t=parseInt(e.offsetHeight),(s=(a.scrollTop||i.scrollTop)+Math.max(a.clientHeight||0,i.clientHeight))<n+t&&(e.style.top=Math.max(a.scrollTop||i.scrollTop,s-t)+"px")},open:function(e){if(mxClient.IS_NS){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(e){return mxUtils.alert("Permission to read file denied."),""}var n=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);return n.initWithPath(e),n.exists()?((e=Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream)).init(n,1,4,null),(n=Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream)).init(e),n.read(n.available())):(mxUtils.alert("File not found."),"")}return e=(n=new ActiveXObject("Scripting.FileSystemObject").OpenTextFile(e,1)).readAll(),n.close(),e},save:function(e,n){if(mxClient.IS_NS){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(e){return void mxUtils.alert("Permission to write file denied.")}var t=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);t.initWithPath(e),t.exists()||t.create(0,420);var a=Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);a.init(t,34,4,null),a.write(n,n.length),a.flush(),a.close()}else(t=new ActiveXObject("Scripting.FileSystemObject").CreateTextFile(e,!0)).Write(n),t.Close()},saveAs:function(e){var n=document.createElement("iframe");n.setAttribute("src",""),n.style.visibility="hidden",document.body.appendChild(n);try{if(mxClient.IS_NS){var t=n.contentDocument;t.open(),t.write(e),t.close();try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"),n.focus(),saveDocument(t)}catch(e){mxUtils.alert("Permission to save document denied.")}}else(t=n.contentWindow.document).write(e),t.execCommand("SaveAs",!1,document.location)}finally{document.body.removeChild(n)}},copy:function(e){if(window.clipboardData)window.clipboardData.setData("Text",e);else{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");var n=Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);if(n){var t=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);if(t){t.addDataFlavor("text/unicode");var a=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);a.data=e,t.setTransferData("text/unicode",a,2*e.length),n.setData(t,null,Components.interfaces.nsIClipboard.kGlobalClipboard)}}}},load:function(e){return(e=new mxXmlRequest(e,null,"GET",!1)).send(),e},get:function(e,n,t){return new mxXmlRequest(e,null,"GET").send(n,t)},post:function(e,n,t,a){return new mxXmlRequest(e,n).send(t,a)},submit:function(e,n,t,a){return new mxXmlRequest(e,n).simulate(t,a)},loadInto:function(e,n,t){mxClient.IS_IE?n.onreadystatechange=function(){4==n.readyState&&t()}:n.addEventListener("load",t,!1),n.load(e)},getValue:function(e,n,t){return null==(e=null!=e?e[n]:null)&&(e=t),e},getNumber:function(e,n,t){return null==(e=null!=e?e[n]:null)&&(e=t||0),Number(e)},getColor:function(e,n,t){return null==(e=null!=e?e[n]:null)?e=t:e==mxConstants.NONE&&(e=null),e},clone:function(e,n,t){t=null!=t&&t;var a=null;if(null!=e&&"function"==typeof e.constructor){var i;a=new e.constructor;for(i in e)i!=mxObjectIdentity.FIELD_NAME&&(null==n||mxUtils.indexOf(n,i)<0)&&(a[i]=t||"object"!=typeof e[i]?e[i]:mxUtils.clone(e[i]))}return a},equalPoints:function(e,n){if(null==e&&null!=n||null!=e&&null==n||null!=e&&null!=n&&e.length!=n.length)return!1;if(null!=e&&null!=n)for(var t=0;t<e.length;t++)if(e[t]==n[t]||null!=e[t]&&!e[t].equals(n[t]))return!1;return!0},equalEntries:function(e,n){if(null==e&&null!=n||null!=e&&null==n||null!=e&&null!=n&&e.length!=n.length)return!1;if(null!=e&&null!=n)for(var t in e)if(e[t]!=n[t])return!1;return!0},extend:function(e,n){var t=function(){};t.prototype=n.prototype,e.prototype=new t,e.prototype.constructor=e},toString:function(e){var n,t="";for(n in e)try{if(null==e[n])t+=n+" = [null]\n";else if("function"==typeof e[n])t+=n+" => [Function]\n";else if("object"==typeof e[n])t=t+(n+" => [")+mxUtils.getFunctionName(e[n].constructor)+"]\n";else t+=n+" = "+e[n]+"\n"}catch(e){t+=n+"="+e.message}return t},toRadians:function(e){return Math.PI*e/180},arcToCurves:function(e,n,t,a,i,s,o,r,l){if(r-=e,l-=n,0===t||0===a)return h;t=Math.abs(t),a=Math.abs(a);var d=-r/2,c=-l/2,m=Math.cos(i*Math.PI/180);i=m*d+(h=Math.sin(i*Math.PI/180))*c;d=-1*h*d+m*c;r=m*(c=(s=1<(v=(c=i*i)/(g=t*t)+(p=d*d)/(A=a*a))?(t*=Math.sqrt(v),a*=Math.sqrt(v),0):(v=1,s===o&&(v=-1),v*Math.sqrt((g*A-g*p-A*c)/(g*p+A*c))))*t*d/a)-h*(p=-1*s*a*i/t)+r/2,l=h*c+m*p+l/2,s=0<=(g=Math.atan2((d-p)/a,(i-c)/t)-Math.atan2(0,1))?g:2*Math.PI+g,i=0<=(g=Math.atan2((-d-p)/a,(-i-c)/t)-Math.atan2((d-p)/a,(i-c)/t))?g:2*Math.PI+g,0==o&&0<i?i-=2*Math.PI:0!=o&&i<0&&(i+=2*Math.PI),o=2*i/Math.PI,i/=o=Math.ceil(o<0?-1*o:o),d=8/3*Math.sin(i/4)*Math.sin(i/4)/Math.sin(i/2),c=m*t,m*=a,t*=h,a*=h;for(var u=Math.cos(s),p=-d*(c*(b=Math.sin(s))+a*u),g=-d*(t*b-m*u),v=A=0,h=[],f=0;f<o;++f){s+=i;var b,A=c*(u=Math.cos(s))-a*(b=Math.sin(s))+r,E=(v=t*u+m*b+l,-d*(c*b+a*u));u=-d*(t*b-m*u);h[b=6*f]=Number(p+e),h[b+1]=Number(g+n),h[b+2]=Number(A-E+e),h[b+3]=Number(v-u+n),h[b+4]=Number(A+e),h[b+5]=Number(v+n),p=A+E,g=v+u}return h},getBoundingBox:function(e,n){var t=null;if(null!=e&&null!=n&&0!=n){var a=mxUtils.toRadians(n),i=(t=Math.cos(a),Math.sin(a)),s=new mxPoint(e.x+e.width/2,e.y+e.height/2),o=new mxPoint(e.x,e.y),r=new mxPoint((a=new mxPoint(e.x+e.width,e.y)).x,e.y+e.height),l=new mxPoint(e.x,r.y);o=mxUtils.getRotatedPoint(o,t,i,s),a=mxUtils.getRotatedPoint(a,t,i,s),r=mxUtils.getRotatedPoint(r,t,i,s),l=mxUtils.getRotatedPoint(l,t,i,s);(t=new mxRectangle(o.x,o.y,0,0)).add(new mxRectangle(a.x,a.y,0,0)),t.add(new mxRectangle(r.x,r.y,0,0)),t.add(new mxRectangle(l.x,l.y,0,0))}return t},getRotatedPoint:function(e,n,t,a){a=null!=a?a:new mxPoint;var i=e.x-a.x;return new mxPoint(i*n-(e=e.y-a.y)*t+a.x,e*n+i*t+a.y)},getPortConstraints:function(e,n,t,a){return null==(e=mxUtils.getValue(e.style,mxConstants.STYLE_PORT_CONSTRAINT,null))?a:(a=e.toString(),e=mxConstants.DIRECTION_MASK_NONE,0<=a.indexOf(mxConstants.DIRECTION_NORTH)&&(e|=mxConstants.DIRECTION_MASK_NORTH),0<=a.indexOf(mxConstants.DIRECTION_WEST)&&(e|=mxConstants.DIRECTION_MASK_WEST),0<=a.indexOf(mxConstants.DIRECTION_SOUTH)&&(e|=mxConstants.DIRECTION_MASK_SOUTH),0<=a.indexOf(mxConstants.DIRECTION_EAST)&&(e|=mxConstants.DIRECTION_MASK_EAST),e)},reversePortConstraints:function(e){return(e&mxConstants.DIRECTION_MASK_WEST)<<3|(e&mxConstants.DIRECTION_MASK_NORTH)<<1|(e&mxConstants.DIRECTION_MASK_SOUTH)>>1|(e&mxConstants.DIRECTION_MASK_EAST)>>3},findNearestSegment:function(e,n,t){var a=-1;if(0<e.absolutePoints.length)for(var i=e.absolutePoints[0],s=null,o=1;o<e.absolutePoints.length;o++){var r=e.absolutePoints[o];i=mxUtils.ptSegDistSq(i.x,i.y,r.x,r.y,n,t);(null==s||i<s)&&(s=i,a=o-1),i=r}return a},rectangleIntersectsSegment:function(e,n,t){var a=e.y,i=e.x,s=a+e.height,o=i+e.width;e=n.x;var r=t.x;if(n.x>t.x&&(e=t.x,r=n.x),o<r&&(r=o),e<i&&(e=i),r<e)return!1;i=n.y,o=t.y;var l=t.x-n.x;return 1e-7<Math.abs(l)&&(i=(t=(t.y-n.y)/l)*e+(n=n.y-t*n.x),o=t*r+n),o<i&&(n=o,o=i,i=n),s<o&&(o=s),i<a&&(i=a),!(o<i)},contains:function(e,n,t){return e.x<=n&&e.x+e.width>=n&&e.y<=t&&e.y+e.height>=t},intersects:function(e,n){var t=e.width,a=e.height,i=n.width,s=n.height;if(i<=0||s<=0||t<=0||a<=0)return!1;var o=e.x,r=e.y,l=n.x,d=n.y;s+=d,t+=o,a+=r;return((i=i+l)<l||o<i)&&(s<d||r<s)&&(t<o||l<t)&&(a<r||d<a)},intersectsHotspot:function(e,n,t,a,i,s){if(i=null!=i?i:0,s=null!=s?s:0,0<(a=null!=a?a:1)){var o=e.getCenterX(),r=e.getCenterY(),l=e.width,d=e.height,c=mxUtils.getValue(e.style,mxConstants.STYLE_STARTSIZE)*e.view.scale;return 0<c&&(mxUtils.getValue(e.style,mxConstants.STYLE_HORIZONTAL,!0)?(r=e.y+c/2,d=c):(o=e.x+c/2,l=c)),l=Math.max(i,l*a),d=Math.max(i,d*a),0<s&&(l=Math.min(l,s),d=Math.min(d,s)),a=new mxRectangle(o-l/2,r-d/2,l,d),0!=(o=mxUtils.toRadians(mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION)||0))&&(i=Math.cos(-o),s=Math.sin(-o),o=new mxPoint(e.getCenterX(),e.getCenterY()),n=(e=mxUtils.getRotatedPoint(new mxPoint(n,t),i,s,o)).x,t=e.y),mxUtils.contains(a,n,t)}return!0},getOffset:function(e,n){var t=0,a=0;if(null!=n&&n){var i=document.body,s=document.documentElement;t=t+(i.scrollLeft||s.scrollLeft),a=a+(i.scrollTop||s.scrollTop)}for(;e.offsetParent;)t+=e.offsetLeft,a+=e.offsetTop,e=e.offsetParent;return new mxPoint(t,a)},getScrollOrigin:function(e){for(var n=document.body,t=document.documentElement,a=new mxPoint(n.scrollLeft||t.scrollLeft,n.scrollTop||t.scrollTop);null!=e&&e!=n&&e!=t;)!isNaN(e.scrollLeft)&&!isNaN(e.scrollTop)&&(a.x+=e.scrollLeft,a.y+=e.scrollTop),e=e.parentNode;return a},convertPoint:function(e,n,t){var a=mxUtils.getScrollOrigin(e);return(e=mxUtils.getOffset(e)).x-=a.x,e.y-=a.y,new mxPoint(n-e.x,t-e.y)},ltrim:function(e,n){return e.replace(RegExp("^["+(n||"\\s")+"]+","g"),"")},rtrim:function(e,n){return e.replace(RegExp("["+(n||"\\s")+"]+$","g"),"")},trim:function(e,n){return mxUtils.ltrim(mxUtils.rtrim(e,n),n)},isNumeric:function(e){return null!=e&&(null==e.length||0<e.length&&e.indexOf("0x")<0&&e.indexOf("0X")<0)&&!isNaN(e)},mod:function(e,n){return(e%n+n)%n},intersection:function(e,n,t,a,i,s,o,r){var l=(r-s)*(t-e)-(o-i)*(a-n);return o=((o-i)*(n-s)-(r-s)*(e-i))/l,i=((t-e)*(n-s)-(a-n)*(e-i))/l,0<=o&&o<=1&&0<=i&&i<=1?new mxPoint(e+o*(t-e),n+o*(a-n)):null},ptSegDistSq:function(e,n,t,a,i,s){return t=(i-=e)*(t-=e)+(s-=n)*(a-=n)<=0?0:(e=(i=t-i)*t+(s=a-s)*a)<=0?0:e*e/(t*t+a*a),(i=i*i+s*s-t)<0&&(i=0),i},relativeCcw:function(e,n,t,a,i,s){return 0==(e=(i-=e)*(a-=n)-(s-=n)*(t-=e))&&(0<(e=i*t+s*a)&&((e=(i-t)*t+(s-a)*a)<0&&(e=0))),e<0?-1:0<e?1:0},animateChanges:function(e,n){mxEffects.animateChanges.apply(this,arguments)},cascadeOpacity:function(e,n,t){mxEffects.cascadeOpacity.apply(this,arguments)},fadeOut:function(e,n,t,a,i,s){mxEffects.fadeOut.apply(this,arguments)},setOpacity:function(e,n){mxUtils.isVml(e)?e.style.filter=100<=n?null:"alpha(opacity="+n/5+")":mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?e.style.filter=100<=n?null:"alpha(opacity="+n+")":e.style.opacity=n/100},createImage:function(e){var n=null;return mxClient.IS_IE6&&"CSS1Compat"!=document.compatMode?((n=document.createElement(mxClient.VML_PREFIX+":image")).setAttribute("src",e),n.style.borderStyle="none"):((n=document.createElement("img")).setAttribute("src",e),n.setAttribute("border","0")),n},sortCells:function(e,i){i=null==i||i;var s=new mxDictionary;return e.sort(function(e,n){var t=s.get(e);null==t&&(t=mxCellPath.create(e).split(mxCellPath.PATH_SEPARATOR),s.put(e,t));var a=s.get(n);return null==a&&(a=mxCellPath.create(n).split(mxCellPath.PATH_SEPARATOR),s.put(n,a)),0==(t=mxCellPath.compare(t,a))?0:0<t==i?1:-1}),e},getStylename:function(e){return null!=e&&(e=e.split(";")[0]).indexOf("=")<0?e:""},getStylenames:function(e){var n=[];if(null!=e){e=e.split(";");for(var t=0;t<e.length;t++)e[t].indexOf("=")<0&&n.push(e[t])}return n},indexOfStylename:function(e,n){if(null!=e&&null!=n)for(var t=e.split(";"),a=0,i=0;i<t.length;i++){if(t[i]==n)return a;a+=t[i].length+1}return-1},addStylename:function(e,n){return mxUtils.indexOfStylename(e,n)<0&&(null==e?e="":0<e.length&&";"!=e.charAt(e.length-1)&&(e+=";"),e+=n),e},removeStylename:function(e,n){var t=[];if(null!=e)for(var a=e.split(";"),i=0;i<a.length;i++)a[i]!=n&&t.push(a[i]);return t.join(";")},removeAllStylenames:function(e){var n=[];if(null!=e){e=e.split(";");for(var t=0;t<e.length;t++)0<=e[t].indexOf("=")&&n.push(e[t])}return n.join(";")},setCellStyles:function(e,n,t,a){if(null!=n&&0<n.length){e.beginUpdate();try{for(var i=0;i<n.length;i++)if(null!=n[i]){var s=mxUtils.setStyle(e.getStyle(n[i]),t,a);e.setStyle(n[i],s)}}finally{e.endUpdate()}}},setStyle:function(e,n,t){var a=null!=t&&(void 0===t.length||0<t.length);if(null==e||0==e.length)a&&(e=n+"="+t);else{var i=e.indexOf(n+"=");i<0?a&&(a=";"==e.charAt(e.length-1)?"":";",e=e+a+n+"="+t):(n=a?n+"="+t:"",t=e.indexOf(";",i),a||t++,e=e.substring(0,i)+n+(i<t?e.substring(t):""))}return e},setCellStyleFlags:function(e,n,t,a,i){if(null!=n&&0<n.length){e.beginUpdate();try{for(var s=0;s<n.length;s++)if(null!=n[s]){var o=mxUtils.setStyleFlag(e.getStyle(n[s]),t,a,i);e.setStyle(n[s],o)}}finally{e.endUpdate()}}},setStyleFlag:function(e,n,t,a){if(null==e||0==e.length)e=a||null==a?n+"="+t:n+"=0";else{var i=e.indexOf(n+"=");if(i<0)i=";"==e.charAt(e.length-1)?"":";",e=a||null==a?e+i+n+"="+t:e+i+n+"=0";else{var s=e.indexOf(";",i),o="";o=s<0?e.substring(i+n.length+1):e.substring(i+n.length+1,s),o=null==a?parseInt(o)^t:a?parseInt(o)|t:parseInt(o)&~t;e=e.substring(0,i)+n+"="+o+(0<=s?e.substring(s):"")}}return e},getAlignmentAsPoint:function(e,n){var t=0,a=0;return e==mxConstants.ALIGN_CENTER?t=-.5:e==mxConstants.ALIGN_RIGHT&&(t=-1),n==mxConstants.ALIGN_MIDDLE?a=-.5:n==mxConstants.ALIGN_BOTTOM&&(a=-1),new mxPoint(t,a)},getSizeForString:function(e,n,t){n=null!=n?n:mxConstants.DEFAULT_FONTSIZE,t=null!=t?t:mxConstants.DEFAULT_FONTFAMILY;var a=document.createElement("div");return a.style.fontFamily=t,a.style.fontSize=Math.round(n)+"px",a.style.lineHeight=Math.round(n*mxConstants.LINE_HEIGHT)+"px",a.style.position="absolute",a.style.whiteSpace="nowrap",a.style.visibility="hidden",a.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",a.style.zoom="1",a.innerHTML=e,document.body.appendChild(a),e=new mxRectangle(0,0,a.offsetWidth,a.offsetHeight),document.body.removeChild(a),e},getViewXml:function(e,n,t,a,i){a=null!=a?a:0,i=null!=i?i:0,n=null!=n?n:1,null==t&&(t=[e.getModel().getRoot()]);var s=e.getView(),o=null,r=s.isEventsEnabled();s.setEventsEnabled(!1);var l=s.drawPane,d=s.overlayPane;e.dialect==mxConstants.DIALECT_SVG?(s.drawPane=document.createElementNS(mxConstants.NS_SVG,"g"),s.canvas.appendChild(s.drawPane),s.overlayPane=document.createElementNS(mxConstants.NS_SVG,"g")):(s.drawPane=s.drawPane.cloneNode(!1),s.canvas.appendChild(s.drawPane),s.overlayPane=s.overlayPane.cloneNode(!1)),s.canvas.appendChild(s.overlayPane);var c=s.getTranslate();s.translate=new mxPoint(a,i),n=new mxTemporaryCellStates(e.getView(),n,t);try{o=(new mxCodec).encode(e.getView())}finally{n.destroy(),s.translate=c,s.canvas.removeChild(s.drawPane),s.canvas.removeChild(s.overlayPane),s.drawPane=l,s.overlayPane=d,s.setEventsEnabled(r)}return o},getScaleForPageCount:function(e,n,t,a){if(e<1)return 1;a=null!=a?a:0;var i=(t=null!=t?t:mxConstants.PAGE_FORMAT_A4_PORTRAIT).width-2*a;t=t.height-2*a,a=n.getGraphBounds().clone(),n=n.getView().getScale(),a.width/=n,a.height/=n,t=(n=a.width)/a.height/(i/t),a=Math.sqrt(e);var s=Math.sqrt(t);if(t=a*s,a/=s,t<1&&e<a){var o=a/e;a=e,t/=o}for(a<1&&e<t&&(o=t/e,t=e,a/=o),o=Math.ceil(t)*Math.ceil(a),s=0;e<o;){o=Math.floor(t)/t;var r=Math.floor(a)/a;if(1==o&&(o=Math.floor(t-1)/t),1==r&&(r=Math.floor(a-1)/a),t*=o=r<o?o:r,a*=o,o=Math.ceil(t)*Math.ceil(a),10<++s)break}return i*t/n*.99999},show:function(e,n,t,a){if(t=null!=t?t:0,a=null!=a?a:0,null==n?n=window.open().document:n.open(),t=-(i=e.getGraphBounds()).x+t,a=-i.y+a,mxClient.IS_IE){for(var i="<html><head>",s=document.getElementsByTagName("base"),o=0;o<s.length;o++)i+=s[o].outerHTML;for(i+="<style>",o=0;o<document.styleSheets.length;o++)try{i+=document.styleSheets(o).cssText}catch(e){}i+="</style></head>",i+="<body>",i+=e.container.innerHTML,i+="</body>",i+="<html>",n.writeln(i),n.close(),null!=(e=n.body.getElementsByTagName("DIV")[0])&&(e.style.position="absolute",e.style.left=t+"px",e.style.top=a+"px")}else{for(n.writeln("<html"),n.writeln("<head>"),s=document.getElementsByTagName("base"),o=0;o<s.length;o++)n.writeln(mxUtils.getOuterHtml(s[o]));for(s=document.getElementsByTagName("link"),o=0;o<s.length;o++)n.writeln(mxUtils.getOuterHtml(s[o]));for(s=document.getElementsByTagName("style"),o=0;o<s.length;o++)n.writeln(mxUtils.getOuterHtml(s[o]));for(n.writeln("</head>"),n.writeln("</html>"),n.close(),null==n.body&&n.documentElement.appendChild(n.createElement("body")),n.body.style.overflow="auto",e=e.container.firstChild;null!=e;)o=e.cloneNode(!0),n.body.appendChild(o),e=e.nextSibling;null!=(e=n.getElementsByTagName("g")[0])&&(e.setAttribute("transform","translate("+t+","+a+")"),(t=e.ownerSVGElement).setAttribute("width",i.width+Math.max(i.x,0)+3),t.setAttribute("height",i.height+Math.max(i.y,0)+3))}return mxUtils.removeCursors(n.body),n},printScreen:function(e){var n=window.open();mxUtils.show(e,n.document),e=function(){n.focus(),n.print(),n.close()},mxClient.IS_GC?n.setTimeout(e,500):e()},popup:function(e,n){if(n){var t=document.createElement("div");t.style.overflow="scroll",t.style.width="636px",t.style.height="460px";var a=document.createElement("pre");a.innerHTML=mxUtils.htmlEntities(e,!1).replace(/\n/g,"<br>").replace(/ /g,"&nbsp;"),t.appendChild(a),(t=new mxWindow("Popup Window",t,document.body.clientWidth/2-320,(document.body.clientHeight||document.documentElement.clientHeight)/2-240,640,480,!1,!0)).setClosable(!0),t.setVisible(!0)}else mxClient.IS_NS?((t=window.open()).document.writeln("<pre>"+mxUtils.htmlEntities(e)+"</pre"),t.document.close()):((a=(t=window.open()).document.createElement("pre")).innerHTML=mxUtils.htmlEntities(e,!1).replace(/\n/g,"<br>").replace(/ /g,"&nbsp;"),t.document.body.appendChild(a))},alert:function(e){alert(e)},prompt:function(e,n){return prompt(e,n)},confirm:function(e){return confirm(e)},error:function(e,n,t,a){var i=document.createElement("div");i.style.padding="20px";var s=document.createElement("img");s.setAttribute("src",a||mxUtils.errorImage),s.setAttribute("valign","bottom"),s.style.verticalAlign="middle",i.appendChild(s),i.appendChild(document.createTextNode(" ")),i.appendChild(document.createTextNode(" ")),i.appendChild(document.createTextNode(" ")),mxUtils.write(i,e),e=document.body.clientWidth,a=document.body.clientHeight||document.documentElement.clientHeight;var o=new mxWindow(mxResources.get(mxUtils.errorResource)||mxUtils.errorResource,i,(e-n)/2,a/4,n,null,!1,!0);return t&&(mxUtils.br(i),n=document.createElement("p"),t=document.createElement("button"),mxClient.IS_IE?t.style.cssText="float:right":t.setAttribute("style","float:right"),mxEvent.addListener(t,"click",function(e){o.destroy()}),mxUtils.write(t,mxResources.get(mxUtils.closeResource)||mxUtils.closeResource),n.appendChild(t),i.appendChild(n),mxUtils.br(i),o.setClosable(!0)),o.setVisible(!0),o},makeDraggable:function(e,n,t,i,a,s,o,r,l,d){return(e=new mxDragSource(e,t)).dragOffset=new mxPoint(null!=a?a:0,null!=s?s:mxConstants.TOOLTIP_VERTICAL_OFFSET),e.autoscroll=o,e.setGuidesEnabled(!1),null!=l&&(e.highlightDropTargets=l),null!=d&&(e.getDropTarget=d),e.getGraphForEvent=function(e){return"function"==typeof n?n(e):n},null!=i&&(e.createDragElement=function(){return i.cloneNode(!0)},r&&(e.createPreviewElement=function(e){var n=i.cloneNode(!0),t=parseInt(n.style.width),a=parseInt(n.style.height);return n.style.width=Math.round(t*e.view.scale)+"px",n.style.height=Math.round(a*e.view.scale)+"px",n})),e}},mxConstants={DEFAULT_HOTSPOT:.3,MIN_HOTSPOT_SIZE:8,MAX_HOTSPOT_SIZE:0,RENDERING_HINT_EXACT:"exact",RENDERING_HINT_FASTER:"faster",RENDERING_HINT_FASTEST:"fastest",DIALECT_SVG:"svg",DIALECT_VML:"vml",DIALECT_MIXEDHTML:"mixedHtml",DIALECT_PREFERHTML:"preferHtml",DIALECT_STRICTHTML:"strictHtml",NS_SVG:"http://www.w3.org/2000/svg",NS_XHTML:"http://www.w3.org/1999/xhtml",NS_XLINK:"http://www.w3.org/1999/xlink",SHADOWCOLOR:"gray",SHADOW_OFFSET_X:2,SHADOW_OFFSET_Y:3,SHADOW_OPACITY:1,NODETYPE_ELEMENT:1,NODETYPE_ATTRIBUTE:2,NODETYPE_TEXT:3,NODETYPE_CDATA:4,NODETYPE_ENTITY_REFERENCE:5,NODETYPE_ENTITY:6,NODETYPE_PROCESSING_INSTRUCTION:7,NODETYPE_COMMENT:8,NODETYPE_DOCUMENT:9,NODETYPE_DOCUMENTTYPE:10,NODETYPE_DOCUMENT_FRAGMENT:11,NODETYPE_NOTATION:12,TOOLTIP_VERTICAL_OFFSET:16,DEFAULT_VALID_COLOR:"#00FF00",DEFAULT_INVALID_COLOR:"#FF0000",HIGHLIGHT_STROKEWIDTH:3,CURSOR_MOVABLE_VERTEX:"move",CURSOR_MOVABLE_EDGE:"move",CURSOR_LABEL_HANDLE:"default",CURSOR_BEND_HANDLE:"pointer",CURSOR_CONNECT:"pointer",HIGHLIGHT_COLOR:"#00FF00",CONNECT_TARGET_COLOR:"#0000FF",INVALID_CONNECT_TARGET_COLOR:"#FF0000",DROP_TARGET_COLOR:"#0000FF",VALID_COLOR:"#00FF00",INVALID_COLOR:"#FF0000",EDGE_SELECTION_COLOR:"#00FF00",VERTEX_SELECTION_COLOR:"#00FF00",VERTEX_SELECTION_STROKEWIDTH:1,EDGE_SELECTION_STROKEWIDTH:1,VERTEX_SELECTION_DASHED:!0,EDGE_SELECTION_DASHED:!0,GUIDE_COLOR:"#FF0000",GUIDE_STROKEWIDTH:1,OUTLINE_COLOR:"#0099FF",OUTLINE_STROKEWIDTH:mxClient.IS_IE?2:3,HANDLE_SIZE:7,LABEL_HANDLE_SIZE:4,HANDLE_FILLCOLOR:"#00FF00",HANDLE_STROKECOLOR:"black",LABEL_HANDLE_FILLCOLOR:"yellow",CONNECT_HANDLE_FILLCOLOR:"#0000FF",LOCKED_HANDLE_FILLCOLOR:"#FF0000",OUTLINE_HANDLE_FILLCOLOR:"#00FFFF",OUTLINE_HANDLE_STROKECOLOR:"#0033FF",DEFAULT_FONTFAMILY:"Arial,Helvetica",DEFAULT_FONTSIZE:11,LINE_HEIGHT:1.2,DEFAULT_FONTSTYLE:0,DEFAULT_STARTSIZE:40,DEFAULT_MARKERSIZE:6,DEFAULT_IMAGESIZE:24,ENTITY_SEGMENT:30,RECTANGLE_ROUNDING_FACTOR:.15,LINE_ARCSIZE:20,ARROW_SPACING:10,ARROW_WIDTH:30,ARROW_SIZE:30,PAGE_FORMAT_A4_PORTRAIT:new mxRectangle(0,0,826,1169),PAGE_FORMAT_A4_LANDSCAPE:new mxRectangle(0,0,1169,826),PAGE_FORMAT_LETTER_PORTRAIT:new mxRectangle(0,0,850,1100),PAGE_FORMAT_LETTER_LANDSCAPE:new mxRectangle(0,0,1100,850),NONE:"none",STYLE_PERIMETER:"perimeter",STYLE_SOURCE_PORT:"sourcePort",STYLE_TARGET_PORT:"targetPort",STYLE_PORT_CONSTRAINT:"portConstraint",STYLE_OPACITY:"opacity",STYLE_TEXT_OPACITY:"textOpacity",STYLE_OVERFLOW:"overflow",STYLE_ORTHOGONAL:"orthogonal",STYLE_EXIT_X:"exitX",STYLE_EXIT_Y:"exitY",STYLE_EXIT_PERIMETER:"exitPerimeter",STYLE_ENTRY_X:"entryX",STYLE_ENTRY_Y:"entryY",STYLE_ENTRY_PERIMETER:"entryPerimeter",STYLE_WHITE_SPACE:"whiteSpace",STYLE_ROTATION:"rotation",STYLE_FILLCOLOR:"fillColor",STYLE_SWIMLANE_FILLCOLOR:"swimlaneFillColor",STYLE_GRADIENTCOLOR:"gradientColor",STYLE_GRADIENT_DIRECTION:"gradientDirection",STYLE_STROKECOLOR:"strokeColor",STYLE_SEPARATORCOLOR:"separatorColor",STYLE_STROKEWIDTH:"strokeWidth",STYLE_ALIGN:"align",STYLE_VERTICAL_ALIGN:"verticalAlign",STYLE_LABEL_POSITION:"labelPosition",STYLE_VERTICAL_LABEL_POSITION:"verticalLabelPosition",STYLE_IMAGE_ASPECT:"imageAspect",STYLE_IMAGE_ALIGN:"imageAlign",STYLE_IMAGE_VERTICAL_ALIGN:"imageVerticalAlign",STYLE_GLASS:"glass",STYLE_IMAGE:"image",STYLE_IMAGE_WIDTH:"imageWidth",STYLE_IMAGE_HEIGHT:"imageHeight",STYLE_IMAGE_BACKGROUND:"imageBackground",STYLE_IMAGE_BORDER:"imageBorder",STYLE_FLIPH:"flipH",STYLE_FLIPV:"flipV",STYLE_NOLABEL:"noLabel",STYLE_NOEDGESTYLE:"noEdgeStyle",STYLE_LABEL_BACKGROUNDCOLOR:"labelBackgroundColor",STYLE_LABEL_BORDERCOLOR:"labelBorderColor",STYLE_LABEL_PADDING:"labelPadding",STYLE_INDICATOR_SHAPE:"indicatorShape",STYLE_INDICATOR_IMAGE:"indicatorImage",STYLE_INDICATOR_COLOR:"indicatorColor",STYLE_INDICATOR_STROKECOLOR:"indicatorStrokeColor",STYLE_INDICATOR_GRADIENTCOLOR:"indicatorGradientColor",STYLE_INDICATOR_SPACING:"indicatorSpacing",STYLE_INDICATOR_WIDTH:"indicatorWidth",STYLE_INDICATOR_HEIGHT:"indicatorHeight",STYLE_INDICATOR_DIRECTION:"indicatorDirection",STYLE_SHADOW:"shadow",STYLE_SEGMENT:"segment",STYLE_ENDARROW:"endArrow",STYLE_STARTARROW:"startArrow",STYLE_ENDSIZE:"endSize",STYLE_STARTSIZE:"startSize",STYLE_SWIMLANE_LINE:"swimlaneLine",STYLE_ENDFILL:"endFill",STYLE_STARTFILL:"startFill",STYLE_DASHED:"dashed",STYLE_DASH_PATTERN:"dashPattern",STYLE_ROUNDED:"rounded",STYLE_CURVED:"curved",STYLE_ARCSIZE:"arcSize",STYLE_SMOOTH:"smooth",STYLE_SOURCE_PERIMETER_SPACING:"sourcePerimeterSpacing",STYLE_TARGET_PERIMETER_SPACING:"targetPerimeterSpacing",STYLE_PERIMETER_SPACING:"perimeterSpacing",STYLE_SPACING:"spacing",STYLE_SPACING_TOP:"spacingTop",STYLE_SPACING_LEFT:"spacingLeft",STYLE_SPACING_BOTTOM:"spacingBottom",STYLE_SPACING_RIGHT:"spacingRight",STYLE_HORIZONTAL:"horizontal",STYLE_DIRECTION:"direction",STYLE_ELBOW:"elbow",STYLE_FONTCOLOR:"fontColor",STYLE_FONTFAMILY:"fontFamily",STYLE_FONTSIZE:"fontSize",STYLE_FONTSTYLE:"fontStyle",STYLE_AUTOSIZE:"autosize",STYLE_FOLDABLE:"foldable",STYLE_EDITABLE:"editable",STYLE_BENDABLE:"bendable",STYLE_MOVABLE:"movable",STYLE_RESIZABLE:"resizable",STYLE_CLONEABLE:"cloneable",STYLE_DELETABLE:"deletable",STYLE_SHAPE:"shape",STYLE_EDGE:"edgeStyle",STYLE_LOOP:"loopStyle",STYLE_ROUTING_CENTER_X:"routingCenterX",STYLE_ROUTING_CENTER_Y:"routingCenterY",FONT_BOLD:1,FONT_ITALIC:2,FONT_UNDERLINE:4,FONT_SHADOW:8,SHAPE_RECTANGLE:"rectangle",SHAPE_ELLIPSE:"ellipse",SHAPE_DOUBLE_ELLIPSE:"doubleEllipse",SHAPE_RHOMBUS:"rhombus",SHAPE_LINE:"line",SHAPE_IMAGE:"image",SHAPE_ARROW:"arrow",SHAPE_LABEL:"label",SHAPE_CYLINDER:"cylinder",SHAPE_SWIMLANE:"swimlane",SHAPE_CONNECTOR:"connector",SHAPE_ACTOR:"actor",SHAPE_CLOUD:"cloud",SHAPE_TRIANGLE:"triangle",SHAPE_HEXAGON:"hexagon",ARROW_CLASSIC:"classic",ARROW_BLOCK:"block",ARROW_OPEN:"open",ARROW_OVAL:"oval",ARROW_DIAMOND:"diamond",ARROW_DIAMOND_THIN:"diamondThin",ALIGN_LEFT:"left",ALIGN_CENTER:"center",ALIGN_RIGHT:"right",ALIGN_TOP:"top",ALIGN_MIDDLE:"middle",ALIGN_BOTTOM:"bottom",DIRECTION_NORTH:"north",DIRECTION_SOUTH:"south",DIRECTION_EAST:"east",DIRECTION_WEST:"west",DIRECTION_MASK_NONE:0,DIRECTION_MASK_WEST:1,DIRECTION_MASK_NORTH:2,DIRECTION_MASK_SOUTH:4,DIRECTION_MASK_EAST:8,DIRECTION_MASK_ALL:15,ELBOW_VERTICAL:"vertical",ELBOW_HORIZONTAL:"horizontal",EDGESTYLE_ELBOW:"elbowEdgeStyle",EDGESTYLE_ENTITY_RELATION:"entityRelationEdgeStyle",EDGESTYLE_LOOP:"loopEdgeStyle",EDGESTYLE_SIDETOSIDE:"sideToSideEdgeStyle",EDGESTYLE_TOPTOBOTTOM:"topToBottomEdgeStyle",EDGESTYLE_ORTHOGONAL:"orthogonalEdgeStyle",EDGESTYLE_SEGMENT:"segmentEdgeStyle",PERIMETER_ELLIPSE:"ellipsePerimeter",PERIMETER_RECTANGLE:"rectanglePerimeter",PERIMETER_RHOMBUS:"rhombusPerimeter",PERIMETER_TRIANGLE:"trianglePerimeter"};function mxEventObject(e){this.name=e,this.properties=[];for(var n=1;n<arguments.length;n+=2)null!=arguments[n+1]&&(this.properties[arguments[n]]=arguments[n+1])}function mxMouseEvent(e,n){this.evt=e,this.state=n}function mxEventSource(e){this.setEventSource(e)}mxEventObject.prototype.name=null,mxEventObject.prototype.properties=null,mxEventObject.prototype.consumed=!1,mxEventObject.prototype.getName=function(){return this.name},mxEventObject.prototype.getProperties=function(){return this.properties},mxEventObject.prototype.getProperty=function(e){return this.properties[e]},mxEventObject.prototype.isConsumed=function(){return this.consumed},mxEventObject.prototype.consume=function(){this.consumed=!0},mxMouseEvent.prototype.consumed=!1,mxMouseEvent.prototype.evt=null,mxMouseEvent.prototype.graphX=null,mxMouseEvent.prototype.graphY=null,mxMouseEvent.prototype.state=null,mxMouseEvent.prototype.getEvent=function(){return this.evt},mxMouseEvent.prototype.getSource=function(){return mxEvent.getSource(this.evt)},mxMouseEvent.prototype.isSource=function(e){if(null!=e)for(var n=this.getSource();null!=n;){if(n==e.node)return!0;n=n.parentNode}return!1},mxMouseEvent.prototype.getX=function(){return mxEvent.getClientX(this.getEvent())},mxMouseEvent.prototype.getY=function(){return mxEvent.getClientY(this.getEvent())},mxMouseEvent.prototype.getGraphX=function(){return this.graphX},mxMouseEvent.prototype.getGraphY=function(){return this.graphY},mxMouseEvent.prototype.getState=function(){return this.state},mxMouseEvent.prototype.getCell=function(){var e=this.getState();return null!=e?e.cell:null},mxMouseEvent.prototype.isPopupTrigger=function(){return mxEvent.isPopupTrigger(this.getEvent())},mxMouseEvent.prototype.isConsumed=function(){return this.consumed},mxMouseEvent.prototype.consume=function(e){(null==e||e)&&this.evt.preventDefault&&this.evt.preventDefault(),this.evt.returnValue=!1,this.consumed=!0},mxEventSource.prototype.eventListeners=null,mxEventSource.prototype.eventsEnabled=!0,mxEventSource.prototype.eventSource=null,mxEventSource.prototype.isEventsEnabled=function(){return this.eventsEnabled},mxEventSource.prototype.setEventsEnabled=function(e){this.eventsEnabled=e},mxEventSource.prototype.getEventSource=function(){return this.eventSource},mxEventSource.prototype.setEventSource=function(e){this.eventSource=e},mxEventSource.prototype.addListener=function(e,n){null==this.eventListeners&&(this.eventListeners=[]),this.eventListeners.push(e),this.eventListeners.push(n)},mxEventSource.prototype.removeListener=function(e){if(null!=this.eventListeners)for(var n=0;n<this.eventListeners.length;)this.eventListeners[n+1]==e?this.eventListeners.splice(n,2):n+=2},mxEventSource.prototype.fireEvent=function(e,n){if(null!=this.eventListeners&&this.isEventsEnabled()){null==e&&(e=new mxEventObject),null==n&&(n=this.getEventSource()),null==n&&(n=this);for(var t=[n,e],a=0;a<this.eventListeners.length;a+=2){var i=this.eventListeners[a];(null==i||i==e.getName())&&this.eventListeners[a+1].apply(this,t)}}};var mxEvent={objects:[],addListener:function(){var a=function(e,n,t){null==e.mxListenerList&&(e.mxListenerList=[],mxEvent.objects.push(e)),e.mxListenerList.push({name:n,f:t})};return window.addEventListener?function(e,n,t){e.addEventListener(n,t,!1),a(e,n,t)}:function(e,n,t){e.attachEvent("on"+n,t),a(e,n,t)}}(),removeListener:function(){var a=function(e,n,t){if(null!=e.mxListenerList){n=e.mxListenerList.length;for(var a=0;a<n;a++)if(e.mxListenerList[a].f==t){e.mxListenerList.splice(a,1);break}0==e.mxListenerList.length&&(e.mxListenerList=null)}};return window.removeEventListener?function(e,n,t){e.removeEventListener(n,t,!1),a(e,n,t)}:function(e,n,t){e.detachEvent("on"+n,t),a(e,n,t)}}(),removeAllListeners:function(e){var n=e.mxListenerList;if(null!=n)for(;0<n.length;){var t=n[0];mxEvent.removeListener(e,t.name,t.f)}},addGestureListeners:function(e,n,t,a){null!=n&&mxEvent.addListener(e,"mousedown",n),null!=t&&mxEvent.addListener(e,"mousemove",t),null!=a&&mxEvent.addListener(e,"mouseup",a),mxClient.IS_TOUCH&&(null!=n&&mxEvent.addListener(e,"touchstart",n),null!=t&&mxEvent.addListener(e,"touchmove",t),null!=a&&mxEvent.addListener(e,"touchend",a))},removeGestureListeners:function(e,n,t,a){null!=n&&mxEvent.removeListener(e,"mousedown",n),null!=t&&mxEvent.removeListener(e,"mousemove",t),null!=a&&mxEvent.removeListener(e,"mouseup",a),mxClient.IS_TOUCH&&(null!=n&&mxEvent.removeListener(e,"touchstart",n),null!=t&&mxEvent.removeListener(e,"touchmove",t),null!=a&&mxEvent.removeListener(e,"touchend",a))},redirectMouseEvents:function(e,t,n,a,i,s,o){var r=function(e){return"function"==typeof n?n(e):n};mxEvent.addGestureListeners(e,function(e){null!=a?a(e):mxEvent.isConsumed(e)||t.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,r(e)))},function(e){null!=i?i(e):mxEvent.isConsumed(e)||t.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,r(e)))},function(e){null!=s?s(e):mxEvent.isConsumed(e)||t.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,r(e)))}),mxEvent.addListener(e,"dblclick",function(e){if(null!=o)o(e);else if(!mxEvent.isConsumed(e)){var n=r(e);t.dblClick(e,null!=n?n.cell:null)}})},release:function(e){if(null!=e&&(mxEvent.removeAllListeners(e),null!=(e=e.childNodes)))for(var n=e.length,t=0;t<n;t+=1)mxEvent.release(e[t])},addMouseWheelListener:function(t){if(null!=t){var e=function(e){null==e&&(e=window.event);var n=0;0!=(n=!mxClient.IS_NS||mxClient.IS_SF||mxClient.IS_GC?e.wheelDelta/120:-e.detail/2)&&t(e,0<n)};mxClient.IS_NS?mxEvent.addListener(window,mxClient.IS_SF||mxClient.IS_GC?"mousewheel":"DOMMouseScroll",e):mxEvent.addListener(document,"mousewheel",e)}},disableContextMenu:mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?function(e){mxEvent.addListener(e,"contextmenu",function(){return!1})}:function(e){e.setAttribute("oncontextmenu","return false;")},getSource:function(e){return null!=e.srcElement?e.srcElement:e.target},isConsumed:function(e){return null!=e.isConsumed&&e.isConsumed},isLeftMouseButton:function(e){return e.button==(mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?1:0)},isRightMouseButton:function(e){return 2==e.button},isPopupTrigger:function(e){return mxEvent.isRightMouseButton(e)||mxEvent.isShiftDown(e)&&!mxEvent.isControlDown(e)},isShiftDown:function(e){return null!=e&&e.shiftKey},isAltDown:function(e){return null!=e&&e.altKey},isControlDown:function(e){return null!=e&&e.ctrlKey},isMetaDown:function(e){return null!=e&&e.metaKey},getMainEvent:function(e){return"touchstart"!=e.type&&"touchmove"!=e.type||null==e.touches||null==e.touches[0]?"touchend"==e.type&&null!=e.changedTouches&&null!=e.changedTouches[0]&&(e=e.changedTouches[0]):e=e.touches[0],e},getClientX:function(e){return mxEvent.getMainEvent(e).clientX},getClientY:function(e){return mxEvent.getMainEvent(e).clientY},consume:function(e,n,t){t=null==t||t,(null==n||n)&&(e.preventDefault?(t&&e.stopPropagation(),e.preventDefault()):t&&(e.cancelBubble=!0)),e.isConsumed=!0,e.returnValue=!1},LABEL_HANDLE:-1,ROTATION_HANDLE:-2,MOUSE_DOWN:"mouseDown",MOUSE_MOVE:"mouseMove",MOUSE_UP:"mouseUp",ACTIVATE:"activate",RESIZE_START:"resizeStart",RESIZE:"resize",RESIZE_END:"resizeEnd",MOVE_START:"moveStart",MOVE:"move",MOVE_END:"moveEnd",PAN_START:"panStart",PAN:"pan",PAN_END:"panEnd",MINIMIZE:"minimize",NORMALIZE:"normalize",MAXIMIZE:"maximize",HIDE:"hide",SHOW:"show",CLOSE:"close",DESTROY:"destroy",REFRESH:"refresh",SIZE:"size",SELECT:"select",FIRED:"fired",GET:"get",RECEIVE:"receive",CONNECT:"connect",DISCONNECT:"disconnect",SUSPEND:"suspend",RESUME:"resume",MARK:"mark",SESSION:"session",ROOT:"root",POST:"post",OPEN:"open",SAVE:"save",BEFORE_ADD_VERTEX:"beforeAddVertex",ADD_VERTEX:"addVertex",AFTER_ADD_VERTEX:"afterAddVertex",DONE:"done",EXECUTE:"execute",EXECUTED:"executed",BEGIN_UPDATE:"beginUpdate",START_EDIT:"startEdit",END_UPDATE:"endUpdate",END_EDIT:"endEdit",BEFORE_UNDO:"beforeUndo",UNDO:"undo",REDO:"redo",CHANGE:"change",NOTIFY:"notify",LAYOUT_CELLS:"layoutCells",CLICK:"click",SCALE:"scale",TRANSLATE:"translate",SCALE_AND_TRANSLATE:"scaleAndTranslate",UP:"up",DOWN:"down",ADD:"add",REMOVE:"remove",CLEAR:"clear",ADD_CELLS:"addCells",CELLS_ADDED:"cellsAdded",MOVE_CELLS:"moveCells",CELLS_MOVED:"cellsMoved",RESIZE_CELLS:"resizeCells",CELLS_RESIZED:"cellsResized",TOGGLE_CELLS:"toggleCells",CELLS_TOGGLED:"cellsToggled",ORDER_CELLS:"orderCells",CELLS_ORDERED:"cellsOrdered",REMOVE_CELLS:"removeCells",CELLS_REMOVED:"cellsRemoved",GROUP_CELLS:"groupCells",UNGROUP_CELLS:"ungroupCells",REMOVE_CELLS_FROM_PARENT:"removeCellsFromParent",FOLD_CELLS:"foldCells",CELLS_FOLDED:"cellsFolded",ALIGN_CELLS:"alignCells",LABEL_CHANGED:"labelChanged",CONNECT_CELL:"connectCell",CELL_CONNECTED:"cellConnected",SPLIT_EDGE:"splitEdge",FLIP_EDGE:"flipEdge",START_EDITING:"startEditing",ADD_OVERLAY:"addOverlay",REMOVE_OVERLAY:"removeOverlay",UPDATE_CELL_SIZE:"updateCellSize",ESCAPE:"escape",CLICK:"click",DOUBLE_CLICK:"doubleClick",START:"start",RESET:"reset"};function mxXmlRequest(e,n,t,a,i,s){this.url=e,this.params=n,this.method=t||"POST",this.async=null==a||a,this.username=i,this.password=s}mxXmlRequest.prototype.url=null,mxXmlRequest.prototype.params=null,mxXmlRequest.prototype.method=null,mxXmlRequest.prototype.async=null,mxXmlRequest.prototype.binary=!1,mxXmlRequest.prototype.username=null,mxXmlRequest.prototype.password=null,mxXmlRequest.prototype.request=null,mxXmlRequest.prototype.isBinary=function(){return this.binary},mxXmlRequest.prototype.setBinary=function(e){this.binary=e},mxXmlRequest.prototype.getText=function(){return this.request.responseText},mxXmlRequest.prototype.isReady=function(){return 4==this.request.readyState},mxXmlRequest.prototype.getDocumentElement=function(){var e=this.getXml();return null!=e?e.documentElement:null},mxXmlRequest.prototype.getXml=function(){var e=this.request.responseXML;return(9<=document.documentMode||null==e||null==e.documentElement)&&(e=mxUtils.parseXml(this.request.responseText)),e},mxXmlRequest.prototype.getText=function(){return this.request.responseText},mxXmlRequest.prototype.getStatus=function(){return this.request.status},mxXmlRequest.prototype.create=window.XMLHttpRequest?function(){var e=new XMLHttpRequest;return this.isBinary()&&e.overrideMimeType&&e.overrideMimeType("text/plain; charset=x-user-defined"),e}:"undefined"!=typeof ActiveXObject?function(){return new ActiveXObject("Microsoft.XMLHTTP")}:void 0,mxXmlRequest.prototype.send=function(e,n){this.request=this.create(),null!=this.request&&(null!=e&&(this.request.onreadystatechange=mxUtils.bind(this,function(){this.isReady()&&(e(this),this.onreadystatechaange=null)})),this.request.open(this.method,this.url,this.async,this.username,this.password),this.setRequestHeaders(this.request,this.params),this.request.send(this.params))},mxXmlRequest.prototype.setRequestHeaders=function(e,n){null!=n&&e.setRequestHeader("Content-Type","application/x-www-form-urlencoded")},mxXmlRequest.prototype.simulate=function(e,n){var t=null;(e=e||document)==document&&(t=window.onbeforeunload,window.onbeforeunload=null);var a=e.createElement("form");a.setAttribute("method",this.method),a.setAttribute("action",this.url),null!=n&&a.setAttribute("target",n),a.style.display="none",a.style.visibility="hidden";for(var i=0<this.params.indexOf("&")?this.params.split("&"):this.params.split(),s=0;s<i.length;s++){if(0<(o=i[s].indexOf("="))){var o,r=i[s].substring(0,o),l=i[s].substring(o+1);(o=e.createElement("textarea")).setAttribute("name",r),l=l.replace(/\n/g,"&#xa;"),r=e.createTextNode(l),o.appendChild(r),a.appendChild(o)}}e.body.appendChild(a),a.submit(),e.body.removeChild(a),null!=t&&(window.onbeforeunload=t)};var mxClipboard={STEPSIZE:10,insertCount:1,cells:null,isEmpty:function(){return null==mxClipboard.cells},cut:function(e,n){return n=mxClipboard.copy(e,n),mxClipboard.insertCount=0,mxClipboard.removeCells(e,n),n},removeCells:function(e,n){e.removeCells(n)},copy:function(e,n){n=n||e.getSelectionCells();var t=e.getExportableCells(n);return mxClipboard.insertCount=1,mxClipboard.cells=e.cloneCells(t),t},paste:function(e){if(null!=mxClipboard.cells){var n=e.getImportableCells(mxClipboard.cells),t=mxClipboard.insertCount*mxClipboard.STEPSIZE,a=e.getDefaultParent();n=e.importCells(n,t,t,a);mxClipboard.insertCount++,e.setSelectionCells(n)}}};function mxWindow(e,n,t,a,i,s,o,r,l,d){null!=n&&(o=null==o||o,this.content=n,this.init(t,a,i,s,d),this.installMaximizeHandler(),this.installMinimizeHandler(),this.installCloseHandler(),this.setMinimizable(o),this.setTitle(e),(null==r||r)&&this.installMoveHandler(),null!=l&&null!=l.parentNode?l.parentNode.replaceChild(this.div,l):document.body.appendChild(this.div))}function mxForm(e){this.table=document.createElement("table"),this.table.className=e,this.body=document.createElement("tbody"),this.table.appendChild(this.body)}function mxImage(e,n,t){this.src=e,this.width=n,this.height=t}function mxDivResizer(e,n){if("div"==e.nodeName.toLowerCase()){null==n&&(n=window),this.div=e;var t=mxUtils.getCurrentStyle(e);null!=t&&(this.resizeWidth="auto"==t.width,this.resizeHeight="auto"==t.height),mxEvent.addListener(n,"resize",mxUtils.bind(this,function(e){this.handlingResize||(this.handlingResize=!0,this.resize(),this.handlingResize=!1)})),this.resize()}}function mxDragSource(e,n){this.element=e,this.dropHandler=n,mxEvent.addGestureListeners(e,mxUtils.bind(this,this.mouseDown))}function mxToolbar(e){this.container=e}function mxSession(n,e,t,a){this.model=n,this.urlInit=e,this.urlPoll=t,this.urlNotify=a,null!=n&&(this.codec=new mxCodec,this.codec.lookup=function(e){return n.getCell(e)}),n.addListener(mxEvent.NOTIFY,mxUtils.bind(this,function(e,n){var t=n.getProperty("edit");(null!=t&&this.debug||this.connected&&!this.suspended)&&this.notify("<edit>"+this.encodeChanges(t.changes,t.undone)+"</edit>")}))}function mxUndoableEdit(e,n){this.source=e,this.changes=[],this.significant=null==n||n}function mxUndoManager(e){this.size=null!=e?e:100,this.clear()}mxWindow.prototype=new mxEventSource,mxWindow.prototype.constructor=mxWindow,mxWindow.prototype.closeImage=mxClient.imageBasePath+"/close.gif",mxWindow.prototype.minimizeImage=mxClient.imageBasePath+"/minimize.gif",mxWindow.prototype.normalizeImage=mxClient.imageBasePath+"/normalize.gif",mxWindow.prototype.maximizeImage=mxClient.imageBasePath+"/maximize.gif",mxWindow.prototype.resizeImage=mxClient.imageBasePath+"/resize.gif",mxWindow.prototype.visible=!1,mxWindow.prototype.content=!1,mxWindow.prototype.minimumSize=new mxRectangle(0,0,50,40),mxWindow.prototype.title=!1,mxWindow.prototype.content=!1,mxWindow.prototype.destroyOnClose=!0,mxWindow.prototype.init=function(e,n,t,a,i){i=null!=i?i:"mxWindow",this.div=document.createElement("div"),this.div.className=i,this.div.style.left=e+"px",this.div.style.top=n+"px",this.table=document.createElement("table"),this.table.className=i,null!=t&&(mxClient.IS_IE||(this.div.style.width=t+"px"),this.table.style.width=t+"px"),null!=a&&(mxClient.IS_IE||(this.div.style.height=a+"px"),this.table.style.height=a+"px"),e=document.createElement("tbody"),n=document.createElement("tr"),this.title=document.createElement("td"),this.title.className=i+"Title",n.appendChild(this.title),e.appendChild(n),n=document.createElement("tr"),this.td=document.createElement("td"),this.td.className=i+"Pane",this.contentWrapper=document.createElement("div"),this.contentWrapper.className=i+"Pane",this.contentWrapper.style.width="100%",this.contentWrapper.appendChild(this.content),(mxClient.IS_IE||"DIV"!=this.content.nodeName.toUpperCase())&&(this.contentWrapper.style.height="100%"),this.td.appendChild(this.contentWrapper),n.appendChild(this.td),e.appendChild(n),this.table.appendChild(e),this.div.appendChild(this.table),i=mxUtils.bind(this,function(e){this.activate()}),mxEvent.addListener(this.title,"mousedown",i),mxEvent.addListener(this.table,"mousedown",i),mxClient.IS_TOUCH&&(mxEvent.addListener(this.title,"touchstart",i),mxEvent.addListener(this.table,"touchstart",i)),this.hide()},mxWindow.prototype.setTitle=function(e){for(var n=this.title.firstChild;null!=n;){var t=n.nextSibling;n.nodeType==mxConstants.NODETYPE_TEXT&&n.parentNode.removeChild(n),n=t}mxUtils.write(this.title,e||"")},mxWindow.prototype.setScrollable=function(e){navigator.userAgent.indexOf("Presto/2.5")<0&&(this.contentWrapper.style.overflow=e?"auto":"hidden")},mxWindow.prototype.activate=function(){if(mxWindow.activeWindow!=this){var e=null!=(e=mxUtils.getCurrentStyle(this.getElement()))?e.zIndex:3;if(mxWindow.activeWindow){var n=mxWindow.activeWindow.getElement();null!=n&&null!=n.style&&(n.style.zIndex=e)}n=mxWindow.activeWindow,this.getElement().style.zIndex=parseInt(e)+1,(mxWindow.activeWindow=this).fireEvent(new mxEventObject(mxEvent.ACTIVATE,"previousWindow",n))}},mxWindow.prototype.getElement=function(){return this.div},mxWindow.prototype.fit=function(){mxUtils.fit(this.div)},mxWindow.prototype.isResizable=function(){return null!=this.resize&&"none"!=this.resize.style.display},mxWindow.prototype.setResizable=function(e){e?null==this.resize?(this.resize=document.createElement("img"),this.resize.style.position="absolute",this.resize.style.bottom="2px",this.resize.style.right="2px",this.resize.setAttribute("src",mxClient.imageBasePath+"/resize.gif"),this.resize.style.cursor="nw-resize",mxEvent.addGestureListeners(this.resize,mxUtils.bind(this,function(e){this.activate();var a=mxEvent.getClientX(e),i=mxEvent.getClientY(e),s=this.div.offsetWidth,o=this.div.offsetHeight,n=mxUtils.bind(this,function(e){var n=mxEvent.getClientX(e)-a,t=mxEvent.getClientY(e)-i;this.setSize(s+n,o+t),this.fireEvent(new mxEventObject(mxEvent.RESIZE,"event",e)),mxEvent.consume(e)}),t=mxUtils.bind(this,function(e){mxEvent.removeGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.RESIZE_END,"event",e)),mxEvent.consume(e)});mxEvent.addGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.RESIZE_START,"event",e)),mxEvent.consume(e)}),null,null),this.div.appendChild(this.resize)):this.resize.style.display="inline":null!=this.resize&&(this.resize.style.display="none")},mxWindow.prototype.setSize=function(e,n){e=Math.max(this.minimumSize.width,e),n=Math.max(this.minimumSize.height,n),mxClient.IS_IE||(this.div.style.width=e+"px",this.div.style.height=n+"px"),this.table.style.width=e+"px",this.table.style.height=n+"px",mxClient.IS_IE||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px")},mxWindow.prototype.setMinimizable=function(e){this.minimize.style.display=e?"":"none"},mxWindow.prototype.getMinimumSize=function(){return new mxRectangle(0,0,0,this.title.offsetHeight)},mxWindow.prototype.installMinimizeHandler=function(){this.minimize=document.createElement("img"),this.minimize.setAttribute("src",this.minimizeImage),this.minimize.setAttribute("align","right"),this.minimize.setAttribute("title","Minimize"),this.minimize.style.cursor="pointer",this.minimize.style.marginRight="1px",this.minimize.style.display="none",this.title.appendChild(this.minimize);var t=!1,a=null,i=null,e=mxUtils.bind(this,function(e){if(this.activate(),t)t=!1,this.minimize.setAttribute("src",this.minimizeImage),this.minimize.setAttribute("title","Minimize"),this.contentWrapper.style.display="",this.maximize.style.display=a,mxClient.IS_IE||(this.div.style.height=i),this.table.style.height=i,null!=this.resize&&(this.resize.style.visibility=""),this.fireEvent(new mxEventObject(mxEvent.NORMALIZE,"event",e));else{t=!0,this.minimize.setAttribute("src",this.normalizeImage),this.minimize.setAttribute("title","Normalize"),this.contentWrapper.style.display="none",a=this.maximize.style.display,this.maximize.style.display="none",i=this.table.style.height;var n=this.getMinimumSize();0<n.height&&(mxClient.IS_IE||(this.div.style.height=n.height+"px"),this.table.style.height=n.height+"px"),0<n.width&&(mxClient.IS_IE||(this.div.style.width=n.width+"px"),this.table.style.width=n.width+"px"),null!=this.resize&&(this.resize.style.visibility="hidden"),this.fireEvent(new mxEventObject(mxEvent.MINIMIZE,"event",e))}mxEvent.consume(e)});mxEvent.addListener(this.minimize,"mousedown",e),mxClient.IS_TOUCH&&mxEvent.addListener(this.minimize,"touchstart",e)},mxWindow.prototype.setMaximizable=function(e){this.maximize.style.display=e?"":"none"},mxWindow.prototype.installMaximizeHandler=function(){this.maximize=document.createElement("img"),this.maximize.setAttribute("src",this.maximizeImage),this.maximize.setAttribute("align","right"),this.maximize.setAttribute("title","Maximize"),this.maximize.style.cursor="default",this.maximize.style.marginLeft="1px",this.maximize.style.cursor="pointer",this.maximize.style.display="none",this.title.appendChild(this.maximize);var t=!1,a=null,i=null,s=null,o=null,e=mxUtils.bind(this,function(e){if(this.activate(),"none"!=this.maximize.style.display){if(t)t=!1,this.maximize.setAttribute("src",this.maximizeImage),this.maximize.setAttribute("title","Maximize"),this.contentWrapper.style.display="",this.minimize.style.visibility="",this.div.style.left=a+"px",this.div.style.top=i+"px",mxClient.IS_IE||(this.div.style.height=s,this.div.style.width=o,"auto"!=(n=mxUtils.getCurrentStyle(this.contentWrapper)).overflow&&null==this.resize)||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px"),this.table.style.height=s,this.table.style.width=o,null!=this.resize&&(this.resize.style.visibility=""),this.fireEvent(new mxEventObject(mxEvent.NORMALIZE,"event",e));else{if(t=!0,this.maximize.setAttribute("src",this.normalizeImage),this.maximize.setAttribute("title","Normalize"),this.contentWrapper.style.display="",this.minimize.style.visibility="hidden",a=parseInt(this.div.style.left),i=parseInt(this.div.style.top),s=this.table.style.height,o=this.table.style.width,this.div.style.left="0px",this.div.style.top="0px",mxClient.IS_IE||(this.div.style.height=document.body.clientHeight-2+"px",this.div.style.width=document.body.clientWidth-2+"px"),this.table.style.width=document.body.clientWidth-2+"px",this.table.style.height=document.body.clientHeight-2+"px",null!=this.resize&&(this.resize.style.visibility="hidden"),!mxClient.IS_IE){var n=mxUtils.getCurrentStyle(this.contentWrapper);"auto"!=n.overflow&&null==this.resize||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px")}this.fireEvent(new mxEventObject(mxEvent.MAXIMIZE,"event",e))}mxEvent.consume(e)}});mxEvent.addGestureListeners(this.maximize,e),mxEvent.addListener(this.title,"dblclick",e)},mxWindow.prototype.installMoveHandler=function(){this.title.style.cursor="move",mxEvent.addGestureListeners(this.title,mxUtils.bind(this,function(e){var a=mxEvent.getClientX(e),i=mxEvent.getClientY(e),s=this.getX(),o=this.getY(),n=mxUtils.bind(this,function(e){var n=mxEvent.getClientX(e)-a,t=mxEvent.getClientY(e)-i;this.setLocation(s+n,o+t),this.fireEvent(new mxEventObject(mxEvent.MOVE,"event",e)),mxEvent.consume(e)}),t=mxUtils.bind(this,function(e){mxEvent.removeGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.MOVE_END,"event",e)),mxEvent.consume(e)});mxEvent.addGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.MOVE_START,"event",e)),mxEvent.consume(e)}))},mxWindow.prototype.setLocation=function(e,n){this.div.style.left=e+"px",this.div.style.top=n+"px"},mxWindow.prototype.getX=function(){return parseInt(this.div.style.left)},mxWindow.prototype.getY=function(){return parseInt(this.div.style.top)},mxWindow.prototype.installCloseHandler=function(){this.closeImg=document.createElement("img"),this.closeImg.setAttribute("src",this.closeImage),this.closeImg.setAttribute("align","right"),this.closeImg.setAttribute("title","Close"),this.closeImg.style.marginLeft="2px",this.closeImg.style.cursor="pointer",this.closeImg.style.display="none",this.title.insertBefore(this.closeImg,this.title.firstChild),mxEvent.addGestureListeners(this.closeImg,mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.CLOSE,"event",e)),this.destroyOnClose?this.destroy():this.setVisible(!1),mxEvent.consume(e)}))},mxWindow.prototype.setImage=function(e){this.image=document.createElement("img"),this.image.setAttribute("src",e),this.image.setAttribute("align","left"),this.image.style.marginRight="4px",this.image.style.marginLeft="0px",this.image.style.marginTop="-2px",this.title.insertBefore(this.image,this.title.firstChild)},mxWindow.prototype.setClosable=function(e){this.closeImg.style.display=e?"":"none"},mxWindow.prototype.isVisible=function(){return null!=this.div&&"hidden"!=this.div.style.visibility},mxWindow.prototype.setVisible=function(e){null!=this.div&&this.isVisible()!=e&&(e?this.show():this.hide())},mxWindow.prototype.show=function(){this.div.style.visibility="",this.activate();var e=mxUtils.getCurrentStyle(this.contentWrapper);mxClient.IS_IE||"auto"!=e.overflow&&null==this.resize||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px"),this.fireEvent(new mxEventObject(mxEvent.SHOW))},mxWindow.prototype.hide=function(){this.div.style.visibility="hidden",this.fireEvent(new mxEventObject(mxEvent.HIDE))},mxWindow.prototype.destroy=function(){this.fireEvent(new mxEventObject(mxEvent.DESTROY)),null!=this.div&&(mxEvent.release(this.div),this.div.parentNode.removeChild(this.div),this.div=null),this.contentWrapper=this.content=this.title=null},mxForm.prototype.table=null,mxForm.prototype.body=!1,mxForm.prototype.getTable=function(){return this.table},mxForm.prototype.addButtons=function(e,n){var t=document.createElement("tr"),a=document.createElement("td");t.appendChild(a);a=document.createElement("td");var i=document.createElement("button");mxUtils.write(i,mxResources.get("ok")||"OK"),a.appendChild(i),mxEvent.addListener(i,"click",function(){e()}),i=document.createElement("button"),mxUtils.write(i,mxResources.get("cancel")||"Cancel"),a.appendChild(i),mxEvent.addListener(i,"click",function(){n()}),t.appendChild(a),this.body.appendChild(t)},mxForm.prototype.addText=function(e,n){var t=document.createElement("input");return t.setAttribute("type","text"),t.value=n,this.addField(e,t)},mxForm.prototype.addCheckbox=function(e,n){var t=document.createElement("input");return t.setAttribute("type","checkbox"),this.addField(e,t),n&&(t.checked=!0),t},mxForm.prototype.addTextarea=function(e,n,t){var a=document.createElement("textarea");return mxClient.IS_NS&&t--,a.setAttribute("rows",t||2),a.value=n,this.addField(e,a)},mxForm.prototype.addCombo=function(e,n,t){var a=document.createElement("select");return null!=t&&a.setAttribute("size",t),n&&a.setAttribute("multiple","true"),this.addField(e,a)},mxForm.prototype.addOption=function(e,n,t,a){var i=document.createElement("option");mxUtils.writeln(i,n),i.setAttribute("value",t),a&&i.setAttribute("selected",a),e.appendChild(i)},mxForm.prototype.addField=function(e,n){var t=document.createElement("tr"),a=document.createElement("td");return mxUtils.write(a,e),t.appendChild(a),(a=document.createElement("td")).appendChild(n),t.appendChild(a),this.body.appendChild(t),n},mxImage.prototype.src=null,mxImage.prototype.width=null,mxImage.prototype.height=null,mxDivResizer.prototype.resizeWidth=!0,mxDivResizer.prototype.resizeHeight=!0,mxDivResizer.prototype.handlingResize=!1,mxDivResizer.prototype.resize=function(){var e=this.getDocumentWidth(),n=this.getDocumentHeight(),t=parseInt(this.div.style.left),a=parseInt(this.div.style.right),i=parseInt(this.div.style.top),s=parseInt(this.div.style.bottom);this.resizeWidth&&!isNaN(t)&&!isNaN(a)&&0<=t&&0<=a&&0<e-a-t&&(this.div.style.width=e-a-t+"px"),this.resizeHeight&&!isNaN(i)&&!isNaN(s)&&0<=i&&0<=s&&0<n-i-s&&(this.div.style.height=n-i-s+"px")},mxDivResizer.prototype.getDocumentWidth=function(){return document.body.clientWidth},mxDivResizer.prototype.getDocumentHeight=function(){return document.body.clientHeight},mxDragSource.prototype.element=null,mxDragSource.prototype.dropHandler=null,mxDragSource.prototype.dragOffset=null,mxDragSource.prototype.dragElement=null,mxDragSource.prototype.previewElement=null,mxDragSource.prototype.enabled=!0,mxDragSource.prototype.currentGraph=null,mxDragSource.prototype.currentDropTarget=null,mxDragSource.prototype.currentPoint=null,mxDragSource.prototype.currentGuide=null,mxDragSource.prototype.currentHighlight=null,mxDragSource.prototype.autoscroll=!0,mxDragSource.prototype.guidesEnabled=!0,mxDragSource.prototype.gridEnabled=!0,mxDragSource.prototype.highlightDropTargets=!0,mxDragSource.prototype.dragElementZIndex=100,mxDragSource.prototype.dragElementOpacity=70,mxDragSource.prototype.isEnabled=function(){return this.enabled},mxDragSource.prototype.setEnabled=function(e){this.enabled=e},mxDragSource.prototype.isGuidesEnabled=function(){return this.guidesEnabled},mxDragSource.prototype.setGuidesEnabled=function(e){this.guidesEnabled=e},mxDragSource.prototype.isGridEnabled=function(){return this.gridEnabled},mxDragSource.prototype.setGridEnabled=function(e){this.gridEnabled=e},mxDragSource.prototype.getGraphForEvent=function(e){return null},mxDragSource.prototype.getDropTarget=function(e,n,t){return e.getCellAt(n,t)},mxDragSource.prototype.createDragElement=function(e){return this.element.cloneNode(!0)},mxDragSource.prototype.createPreviewElement=function(e){return null},mxDragSource.prototype.mouseDown=function(e){this.enabled&&!mxEvent.isConsumed(e)&&null==this.mouseMoveHandler&&(this.startDrag(e),this.mouseMoveHandler=mxUtils.bind(this,this.mouseMove),this.mouseUpHandler=mxUtils.bind(this,this.mouseUp),mxEvent.addGestureListeners(document,null,this.mouseMoveHandler,this.mouseUpHandler),mxEvent.consume(e,!0,!1))},mxDragSource.prototype.startDrag=function(e){this.dragElement=this.createDragElement(e),this.dragElement.style.position="absolute",this.dragElement.style.zIndex=this.dragElementZIndex,mxUtils.setOpacity(this.dragElement,this.dragElementOpacity)},mxDragSource.prototype.stopDrag=function(e){null!=this.dragElement&&(null!=this.dragElement.parentNode&&this.dragElement.parentNode.removeChild(this.dragElement),this.dragElement=null)},mxDragSource.prototype.graphContainsEvent=function(e,n){var t=mxEvent.getClientX(n),a=mxEvent.getClientY(n),i=mxUtils.getOffset(e.container),s=mxUtils.getScrollOrigin();return t>=i.x-s.x&&a>=i.y-s.y&&t<=i.x-s.x+e.container.offsetWidth&&a<=i.y-s.y+e.container.offsetHeight},mxDragSource.prototype.mouseMove=function(e){if(null!=(n=this.getGraphForEvent(e))&&!this.graphContainsEvent(n,e)&&(n=null),n!=this.currentGraph&&(null!=this.currentGraph&&this.dragExit(this.currentGraph),this.currentGraph=n,null!=this.currentGraph&&this.dragEnter(this.currentGraph)),null!=this.currentGraph&&this.dragOver(this.currentGraph,e),null==this.dragElement||null!=this.previewElement&&"visible"==this.previewElement.style.visibility)null!=this.dragElement&&(this.dragElement.style.visibility="hidden");else{var n=mxEvent.getClientX(e),t=mxEvent.getClientY(e);null==this.dragElement.parentNode&&document.body.appendChild(this.dragElement),this.dragElement.style.visibility="visible",null!=this.dragOffset&&(n+=this.dragOffset.x,t+=this.dragOffset.y),n+=document.body.scrollLeft||document.documentElement.scrollLeft,t+=document.body.scrollTop||document.documentElement.scrollTop,this.dragElement.style.left=n+"px",this.dragElement.style.top=t+"px"}mxEvent.consume(e)},mxDragSource.prototype.mouseUp=function(e){if(null!=this.currentGraph){if(null!=this.currentPoint&&(null==this.previewElement||"hidden"!=this.previewElement.style.visibility)){var n=this.currentGraph.view.scale,t=this.currentGraph.view.translate;this.drop(this.currentGraph,e,this.currentDropTarget,this.currentPoint.x/n-t.x,this.currentPoint.y/n-t.y)}this.dragExit(this.currentGraph)}this.stopDrag(e),mxEvent.removeGestureListeners(document,null,this.mouseMoveHandler,this.mouseUpHandler),this.currentGraph=this.mouseUpHandler=this.mouseMoveHandler=null,mxEvent.consume(e)},mxDragSource.prototype.dragEnter=function(e){e.isMouseDown=!0,this.previewElement=this.createPreviewElement(e),this.isGuidesEnabled()&&null!=this.previewElement&&(this.currentGuide=new mxGuide(e,e.graphHandler.getGuideStates())),this.highlightDropTargets&&(this.currentHighlight=new mxCellHighlight(e,mxConstants.DROP_TARGET_COLOR))},mxDragSource.prototype.dragExit=function(e){this.currentPoint=this.currentDropTarget=null,e.isMouseDown=!1,null!=this.previewElement&&(null!=this.previewElement.parentNode&&this.previewElement.parentNode.removeChild(this.previewElement),this.previewElement=null),null!=this.currentGuide&&(this.currentGuide.destroy(),this.currentGuide=null),null!=this.currentHighlight&&(this.currentHighlight.destroy(),this.currentHighlight=null)},mxDragSource.prototype.dragOver=function(e,n){var t=mxUtils.getOffset(e.container),a=mxUtils.getScrollOrigin(e.container),i=mxEvent.getClientX(n)-t.x+a.x;t=mxEvent.getClientY(n)-t.y+a.y;if(e.autoScroll&&(null==this.autoscroll||this.autoscroll)&&e.scrollPointToVisible(i,t,e.autoExtend),null!=this.currentHighlight&&e.isDropEnabled()&&(this.currentDropTarget=this.getDropTarget(e,i,t),a=e.getView().getState(this.currentDropTarget),this.currentHighlight.highlight(a)),null!=this.previewElement){null==this.previewElement.parentNode&&(e.container.appendChild(this.previewElement),this.previewElement.style.zIndex="3",this.previewElement.style.position="absolute");a=this.isGridEnabled()&&e.isGridEnabledEvent(n);var s=!0;if(null!=this.currentGuide&&this.currentGuide.isEnabledForEvent(n))s=new mxRectangle(0,0,s=parseInt(this.previewElement.style.width),o=parseInt(this.previewElement.style.height)),t=new mxPoint(i,t),t=this.currentGuide.move(s,t,a),s=!1,i=t.x,t=t.y;else if(a){a=e.view.scale;var o=e.view.translate,r=e.gridSize/2;i=(e.snap(i/a-o.x-r)+o.x)*a,t=(e.snap(t/a-o.y-r)+o.y)*a}null!=this.currentGuide&&s&&this.currentGuide.hide(),null!=this.previewOffset&&(i+=this.previewOffset.x,t+=this.previewOffset.y),this.previewElement.style.left=Math.round(i)+"px",this.previewElement.style.top=Math.round(t)+"px",this.previewElement.style.visibility="visible"}this.currentPoint=new mxPoint(i,t)},mxDragSource.prototype.drop=function(e,n,t,a,i){this.dropHandler(e,n,t,a,i),e.container.focus()},mxToolbar.prototype=new mxEventSource,mxToolbar.prototype.constructor=mxToolbar,mxToolbar.prototype.container=null,mxToolbar.prototype.enabled=!0,mxToolbar.prototype.noReset=!1,mxToolbar.prototype.updateDefaultMode=!0,mxToolbar.prototype.addItem=function(e,n,t,a,i,s){var o=document.createElement(null!=n?"img":"button"),r=i||(null!=s?"mxToolbarMode":"mxToolbarItem");return o.className=r,o.setAttribute("src",n),null!=e&&(null!=n?o.setAttribute("title",e):mxUtils.write(o,e)),this.container.appendChild(o),null!=t&&(mxEvent.addListener(o,"click",t),mxClient.IS_TOUCH&&mxEvent.addListener(o,"touchend",t)),e=mxUtils.bind(this,function(e){null!=a?o.setAttribute("src",n):o.style.backgroundColor=""}),mxEvent.addGestureListeners(o,mxUtils.bind(this,function(e){if(null!=a?o.setAttribute("src",a):o.style.backgroundColor="gray",null!=s){null==this.menu&&(this.menu=new mxPopupMenu,this.menu.init());var n=this.currentImg;this.menu.isMenuShowing()&&this.menu.hideMenu(),n!=o&&(this.currentImg=o,this.menu.factoryMethod=s,n=new mxPoint(o.offsetLeft,o.offsetTop+o.offsetHeight),this.menu.popup(n.x,n.y,null,e),this.menu.isMenuShowing()&&(o.className=r+"Selected",this.menu.hideMenu=function(){mxPopupMenu.prototype.hideMenu.apply(this),o.className=r,this.currentImg=null}))}}),null,e),mxEvent.addListener(o,"mouseout",e),o},mxToolbar.prototype.addCombo=function(e){var n=document.createElement("div");n.style.display="inline",n.className="mxToolbarComboContainer";var t=document.createElement("select");return t.className=e||"mxToolbarCombo",n.appendChild(t),this.container.appendChild(n),t},mxToolbar.prototype.addActionCombo=function(e,n){var t=document.createElement("select");return t.className=n||"mxToolbarCombo",this.addOption(t,e,null),mxEvent.addListener(t,"change",function(e){var n=t.options[t.selectedIndex];t.selectedIndex=0,null!=n.funct&&n.funct(e)}),this.container.appendChild(t),t},mxToolbar.prototype.addOption=function(e,n,t){var a=document.createElement("option");return mxUtils.writeln(a,n),"function"==typeof t?a.funct=t:a.setAttribute("value",t),e.appendChild(a),a},mxToolbar.prototype.addSwitchMode=function(e,n,t,a,i){var s=document.createElement("img");return s.initialClassName=i||"mxToolbarMode",s.className=s.initialClassName,s.setAttribute("src",n),s.altIcon=a,null!=e&&s.setAttribute("title",e),mxEvent.addListener(s,"click",mxUtils.bind(this,function(e){null!=(e=this.selectedMode.altIcon)?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",e)):this.selectedMode.className=this.selectedMode.initialClassName,this.updateDefaultMode&&(this.defaultMode=s),null!=(e=(this.selectedMode=s).altIcon)?(s.altIcon=s.getAttribute("src"),s.setAttribute("src",e)):s.className=s.initialClassName+"Selected",this.fireEvent(new mxEventObject(mxEvent.SELECT)),t()})),this.container.appendChild(s),null==this.defaultMode&&(this.defaultMode=s,this.selectMode(s),t()),s},mxToolbar.prototype.addMode=function(e,n,t,a,i,s){s=null==s||s;var o=document.createElement(null!=n?"img":"button");return o.initialClassName=i||"mxToolbarMode",o.className=o.initialClassName,o.setAttribute("src",n),o.altIcon=a,null!=e&&o.setAttribute("title",e),this.enabled&&s&&(mxEvent.addListener(o,"click",mxUtils.bind(this,function(e){this.selectMode(o,t),this.noReset=!1})),mxEvent.addListener(o,"dblclick",mxUtils.bind(this,function(e){this.selectMode(o,t),this.noReset=!0})),null==this.defaultMode&&(this.defaultMode=o,this.defaultFunction=t,this.selectMode(o,t))),this.container.appendChild(o),o},mxToolbar.prototype.selectMode=function(e,n){if(this.selectedMode!=e){if(null!=this.selectedMode){var t=this.selectedMode.altIcon;null!=t?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",t)):this.selectedMode.className=this.selectedMode.initialClassName}this.selectedMode=e,null!=(t=this.selectedMode.altIcon)?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",t)):this.selectedMode.className=this.selectedMode.initialClassName+"Selected",this.fireEvent(new mxEventObject(mxEvent.SELECT,"function",n))}},mxToolbar.prototype.resetMode=function(e){(e||!this.noReset)&&this.selectedMode!=this.defaultMode&&this.selectMode(this.defaultMode,this.defaultFunction)},mxToolbar.prototype.addSeparator=function(e){return this.addItem(null,e,null)},mxToolbar.prototype.addBreak=function(){mxUtils.br(this.container)},mxToolbar.prototype.addLine=function(){var e=document.createElement("hr");e.style.marginRight="6px",e.setAttribute("size","1"),this.container.appendChild(e)},mxToolbar.prototype.destroy=function(){mxEvent.release(this.container),this.selectedMode=this.defaultFunction=this.defaultMode=this.container=null,null!=this.menu&&this.menu.destroy()},mxSession.prototype=new mxEventSource,mxSession.prototype.constructor=mxSession,mxSession.prototype.model=null,mxSession.prototype.urlInit=null,mxSession.prototype.urlPoll=null,mxSession.prototype.urlNotify=null,mxSession.prototype.codec=null,mxSession.prototype.linefeed="&#xa;",mxSession.prototype.escapePostData=!0,mxSession.prototype.significantRemoteChanges=!0,mxSession.prototype.sent=0,mxSession.prototype.received=0,mxSession.prototype.debug=!1,mxSession.prototype.connected=!1,mxSession.prototype.suspended=!1,mxSession.prototype.polling=!1,mxSession.prototype.start=function(){this.debug?(this.connected=!0,this.fireEvent(new mxEventObject(mxEvent.CONNECT))):this.connected||this.get(this.urlInit,mxUtils.bind(this,function(e){this.connected=!0,this.fireEvent(new mxEventObject(mxEvent.CONNECT)),this.poll()}))},mxSession.prototype.suspend=function(){this.connected&&!this.suspended&&(this.suspended=!0,this.fireEvent(new mxEventObject(mxEvent.SUSPEND)))},mxSession.prototype.resume=function(e,n,t){this.connected&&this.suspended&&(this.suspended=!1,this.fireEvent(new mxEventObject(mxEvent.RESUME)),this.polling||this.poll())},mxSession.prototype.stop=function(e){this.connected&&(this.connected=!1),this.fireEvent(new mxEventObject(mxEvent.DISCONNECT,"reason",e))},mxSession.prototype.poll=function(){this.connected&&!this.suspended&&null!=this.urlPoll?(this.polling=!0,this.get(this.urlPoll,mxUtils.bind(this,function(){this.poll()}))):this.polling=!1},mxSession.prototype.notify=function(e,n,t){null!=e&&0<e.length&&(null!=this.urlNotify&&(this.debug?(mxLog.show(),mxLog.debug("mxSession.notify: "+this.urlNotify+" xml="+e)):(e="<message><delta>"+e+"</delta></message>",this.escapePostData&&(e=encodeURIComponent(e)),mxUtils.post(this.urlNotify,"xml="+e,n,t))),this.sent+=e.length,this.fireEvent(new mxEventObject(mxEvent.NOTIFY,"url",this.urlNotify,"xml",e)))},mxSession.prototype.get=function(t,a,n){if(void 0!==mxUtils){var i=mxUtils.bind(this,function(e){null!=n?n(e):this.stop(e)});mxUtils.get(t,mxUtils.bind(this,function(e){if(void 0!==mxUtils)if(e.isReady()&&404!=e.getStatus()){if(this.received+=e.getText().length,this.fireEvent(new mxEventObject(mxEvent.GET,"url",t,"request",e)),this.isValidResponse(e)){if(0<e.getText().length){var n=e.getDocumentElement();null==n?i("Invalid response: "+e.getText()):this.receive(n)}null!=a&&a(e)}}else i("Response not ready")}),function(e){i("Transmission error")})}},mxSession.prototype.isValidResponse=function(e){return e.getText().indexOf("<?php")<0},mxSession.prototype.encodeChanges=function(e,n){for(var t="",a=n?-1:1,i=n?e.length-1:0;0<=i&&i<e.length;i+=a){var s=this.codec.encode(e[i]);t=t+mxUtils.getXml(s,this.linefeed)}return t},mxSession.prototype.receive=function(e){if(null!=e&&e.nodeType==mxConstants.NODETYPE_ELEMENT){var n=e.getAttribute("namespace");for(null!=n&&(this.model.prefix=n+"-"),n=e.firstChild;null!=n;){var t=n.nodeName.toLowerCase();"state"==t?this.processState(n):"delta"==t&&this.processDelta(n),n=n.nextSibling}this.fireEvent(new mxEventObject(mxEvent.RECEIVE,"node",e))}},mxSession.prototype.processState=function(e){new mxCodec(e.ownerDocument).decode(e.firstChild,this.model)},mxSession.prototype.processDelta=function(e){for(e=e.firstChild;null!=e;)"edit"==e.nodeName&&this.processEdit(e),e=e.nextSibling},mxSession.prototype.processEdit=function(e){if(0<(e=this.decodeChanges(e)).length){var n=this.createUndoableEdit(e);this.model.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",n,"changes",e)),this.model.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",n)),this.fireEvent(new mxEventObject(mxEvent.FIRED,"edit",n))}},mxSession.prototype.createUndoableEdit=function(e){var n=new mxUndoableEdit(this.model,this.significantRemoteChanges);return n.changes=e,n.notify=function(){n.source.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",n,"changes",n.changes)),n.source.fireEvent(new mxEventObject(mxEvent.NOTIFY,"edit",n,"changes",n.changes))},n},mxSession.prototype.decodeChanges=function(e){this.codec.document=e.ownerDocument;var n=[];for(e=e.firstChild;null!=e;){var t=this.decodeChange(e);null!=t&&n.push(t),e=e.nextSibling}return n},mxSession.prototype.decodeChange=function(e){var n=null;return e.nodeType==mxConstants.NODETYPE_ELEMENT&&(null!=(n="mxRootChange"==e.nodeName?new mxCodec(e.ownerDocument).decode(e):this.codec.decode(e))&&(n.model=this.model,n.execute(),"mxChildChange"==e.nodeName&&null==n.parent&&this.cellRemoved(n.child))),n},mxSession.prototype.cellRemoved=function(e,n){this.codec.putObject(e.getId(),e);for(var t=this.model.getChildCount(e),a=0;a<t;a++)this.cellRemoved(this.model.getChildAt(e,a))},mxUndoableEdit.prototype.source=null,mxUndoableEdit.prototype.changes=null,mxUndoableEdit.prototype.significant=null,mxUndoableEdit.prototype.undone=!1,mxUndoableEdit.prototype.redone=!1,mxUndoableEdit.prototype.isEmpty=function(){return 0==this.changes.length},mxUndoableEdit.prototype.isSignificant=function(){return this.significant},mxUndoableEdit.prototype.add=function(e){this.changes.push(e)},mxUndoableEdit.prototype.notify=function(){},mxUndoableEdit.prototype.die=function(){},mxUndoableEdit.prototype.undo=function(){if(!this.undone){this.source.fireEvent(new mxEventObject(mxEvent.START_EDIT));for(var e=this.changes.length-1;0<=e;e--){var n=this.changes[e];null!=n.execute?n.execute():null!=n.undo&&n.undo(),this.source.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",n))}this.undone=!0,this.redone=!1,this.source.fireEvent(new mxEventObject(mxEvent.END_EDIT))}this.notify()},mxUndoableEdit.prototype.redo=function(){if(!this.redone){this.source.fireEvent(new mxEventObject(mxEvent.START_EDIT));for(var e=this.changes.length,n=0;n<e;n++){var t=this.changes[n];null!=t.execute?t.execute():null!=t.redo&&t.redo(),this.source.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",t))}this.undone=!1,this.redone=!0,this.source.fireEvent(new mxEventObject(mxEvent.END_EDIT))}this.notify()},mxUndoManager.prototype=new mxEventSource,mxUndoManager.prototype.constructor=mxUndoManager,mxUndoManager.prototype.size=null,mxUndoManager.prototype.history=null,mxUndoManager.prototype.indexOfNextAdd=0,mxUndoManager.prototype.isEmpty=function(){return 0==this.history.length},mxUndoManager.prototype.clear=function(){this.history=[],this.indexOfNextAdd=0,this.fireEvent(new mxEventObject(mxEvent.CLEAR))},mxUndoManager.prototype.canUndo=function(){return 0<this.indexOfNextAdd},mxUndoManager.prototype.undo=function(){for(;0<this.indexOfNextAdd;){var e=this.history[--this.indexOfNextAdd];if(e.undo(),e.isSignificant()){this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",e));break}}},mxUndoManager.prototype.canRedo=function(){return this.indexOfNextAdd<this.history.length},mxUndoManager.prototype.redo=function(){for(var e=this.history.length;this.indexOfNextAdd<e;){var n=this.history[this.indexOfNextAdd++];if(n.redo(),n.isSignificant()){this.fireEvent(new mxEventObject(mxEvent.REDO,"edit",n));break}}},mxUndoManager.prototype.undoableEditHappened=function(e){this.trim(),0<this.size&&this.size==this.history.length&&this.history.shift(),this.history.push(e),this.indexOfNextAdd=this.history.length,this.fireEvent(new mxEventObject(mxEvent.ADD,"edit",e))},mxUndoManager.prototype.trim=function(){if(this.history.length>this.indexOfNextAdd)for(var e=this.history.splice(this.indexOfNextAdd,this.history.length-this.indexOfNextAdd),n=0;n<e.length;n++)e[n].die()};var mxUrlConverter=function(e){var t=!0,a=null,i=null;return{isEnabled:function(){return t},setEnabled:function(e){t=e},getBaseUrl:function(){return a},setBaseUrl:function(e){a=e},getBaseDomain:function(){return a},setBaseDomain:function(e){a=e},isRelativeUrl:function(e){return"http://"!=e.substring(0,7)&&"https://"!=e.substring(0,8)&&"data:image"!=e.substring(0,10)},convert:function(e){if(t&&this.isRelativeUrl(e)){if(null==a){i=location.protocol+"//"+location.host;var n=(a=i+location.pathname).lastIndexOf("/");0<n&&(a=a.substring(0,n+1))}e="/"==e.charAt(0)?i+e:a+e}return e}}};function mxPanningManager(s){this.thread=null,this.active=!1,this.dy=this.dx=this.t0y=this.t0x=this.tdy=this.tdx=0,this.scrollbars=!1,this.scrollTop=this.scrollLeft=0,this.mouseListener={mouseDown:function(e,n){},mouseMove:function(e,n){},mouseUp:mxUtils.bind(this,function(e,n){this.active&&this.stop()})},s.addMouseListener(this.mouseListener),mxEvent.addListener(document,"mouseup",mxUtils.bind(this,function(){this.active&&this.stop()}));var o=mxUtils.bind(this,function(){return this.scrollbars=mxUtils.hasScrollbars(s.container),this.scrollLeft=s.container.scrollLeft,this.scrollTop=s.container.scrollTop,window.setInterval(mxUtils.bind(this,function(){if(this.tdx-=this.dx,this.tdy-=this.dy,this.scrollbars){var e=-s.container.scrollLeft-Math.ceil(this.dx),n=-s.container.scrollTop-Math.ceil(this.dy);s.panGraph(e,n),s.panDx=this.scrollLeft-s.container.scrollLeft,s.panDy=this.scrollTop-s.container.scrollTop,s.fireEvent(new mxEventObject(mxEvent.PAN))}else s.panGraph(this.getDx(),this.getDy())}),this.delay)});this.isActive=function(){return active},this.getDx=function(){return Math.round(this.tdx)},this.getDy=function(){return Math.round(this.tdy)},this.start=function(){this.t0x=s.view.translate.x,this.t0y=s.view.translate.y,this.active=!0},this.panTo=function(e,n,t,a){this.active||this.start(),this.scrollLeft=s.container.scrollLeft,this.scrollTop=s.container.scrollTop,a=null!=a?a:0;var i=s.container;this.dx=e+(null!=t?t:0)-i.scrollLeft-i.clientWidth,this.dx<0&&Math.abs(this.dx)<this.border?this.dx=this.border+this.dx:this.dx=this.handleMouseOut?Math.max(this.dx,0):0,0==this.dx&&(this.dx=e-i.scrollLeft,this.dx=0<this.dx&&this.dx<this.border?this.dx-this.border:this.handleMouseOut?Math.min(0,this.dx):0),this.dy=n+a-i.scrollTop-i.clientHeight,this.dy<0&&Math.abs(this.dy)<this.border?this.dy=this.border+this.dy:this.dy=this.handleMouseOut?Math.max(this.dy,0):0,0==this.dy&&(this.dy=n-i.scrollTop,this.dy=0<this.dy&&this.dy<this.border?this.dy-this.border:this.handleMouseOut?Math.min(0,this.dy):0),0!=this.dx||0!=this.dy?(this.dx*=this.damper,this.dy*=this.damper,null==this.thread&&(this.thread=o())):null!=this.thread&&(window.clearInterval(this.thread),this.thread=null)},this.stop=function(){if(this.active)if(this.active=!1,null!=this.thread&&(window.clearInterval(this.thread),this.thread=null),this.tdy=this.tdx=0,this.scrollbars)s.panDx=0,s.panDy=0,s.fireEvent(new mxEventObject(mxEvent.PAN));else{var e=s.panDx,n=s.panDy;0==e&&0==n||(s.panGraph(0,0),s.view.setTranslate(this.t0x+e/s.view.scale,this.t0y+n/s.view.scale))}},this.destroy=function(){s.removeMouseListener(this.mouseListener)}}function mxPopupMenu(e){null!=(this.factoryMethod=e)&&this.init()}function mxAutoSaveManager(e){this.changeHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.graphModelChanged(n.getProperty("edit").changes)}),this.setGraph(e)}function mxAnimation(e){this.delay=null!=e?e:20}function mxMorphing(e,n,t,a){mxAnimation.call(this,a),this.graph=e,this.steps=null!=n?n:6,this.ease=null!=t?t:1.5}function mxImageBundle(e){this.images=[],this.alt=null!=e&&e}function mxImageExport(){}function mxAbstractCanvas2D(){this.converter=this.createUrlConverter(),this.reset()}function mxXmlCanvas2D(e){mxAbstractCanvas2D.call(this),this.root=e,this.writeDefaults()}function mxSvgCanvas2D(e,n){mxAbstractCanvas2D.call(this),this.root=e,this.gradients=[],this.defs=null,this.styleEnabled=null!=n&&n;var t=null;if(e.ownerDocument!=document)for(t=e;null!=t&&"svg"!=t.nodeName;)t=t.parentNode;null!=t&&(0<t.getElementsByTagName("defs").length&&(this.defs=t.getElementsByTagName("defs")[0]),null==this.defs&&(this.defs=this.createElement("defs"),null!=t.firstChild?t.insertBefore(this.defs,t.firstChild):t.appendChild(this.defs)),this.styleEnabled&&this.defs.appendChild(this.createStyle()))}mxPanningManager.prototype.damper=1/6,mxPanningManager.prototype.delay=10,mxPanningManager.prototype.handleMouseOut=!0,mxPanningManager.prototype.border=0,mxPopupMenu.prototype=new mxEventSource,mxPopupMenu.prototype.constructor=mxPopupMenu,mxPopupMenu.prototype.submenuImage=mxClient.imageBasePath+"/submenu.gif",mxPopupMenu.prototype.zIndex=10006,mxPopupMenu.prototype.factoryMethod=null,mxPopupMenu.prototype.useLeftButtonForPopup=!1,mxPopupMenu.prototype.enabled=!0,mxPopupMenu.prototype.itemCount=0,mxPopupMenu.prototype.autoExpand=!1,mxPopupMenu.prototype.smartSeparators=!1,mxPopupMenu.prototype.labels=!0,mxPopupMenu.prototype.init=function(){this.table=document.createElement("table"),this.table.className="mxPopupMenu",this.tbody=document.createElement("tbody"),this.table.appendChild(this.tbody),this.div=document.createElement("div"),this.div.className="mxPopupMenu",this.div.style.display="inline",this.div.style.zIndex=this.zIndex,this.div.appendChild(this.table),mxEvent.disableContextMenu(this.div)},mxPopupMenu.prototype.isEnabled=function(){return this.enabled},mxPopupMenu.prototype.setEnabled=function(e){this.enabled=e},mxPopupMenu.prototype.isPopupTrigger=function(e){return e.isPopupTrigger()||this.useLeftButtonForPopup&&mxEvent.isLeftMouseButton(e.getEvent())},mxPopupMenu.prototype.addItem=function(e,n,t,a,i,s){a=a||this,this.itemCount++,a.willAddSeparator&&(a.containsItems&&this.addSeparator(a,!0),a.willAddSeparator=!1),a.containsItems=!0;var o=document.createElement("tr");o.className="mxPopupMenuItem";var r=document.createElement("td");return r.className="mxPopupMenuIcon",null!=n?((i=document.createElement("img")).src=n,r.appendChild(i)):null!=i&&((n=document.createElement("div")).className=i,r.appendChild(n)),o.appendChild(r),this.labels&&((r=document.createElement("td")).className="mxPopupMenuItem"+(null==s||s?"":" disabled"),mxUtils.write(r,e),r.align="left",o.appendChild(r),(e=document.createElement("td")).className="mxPopupMenuItem"+(null==s||s?"":" disabled"),e.style.paddingRight="6px",e.style.textAlign="right",o.appendChild(e),null==a.div&&this.createSubmenu(a)),a.tbody.appendChild(o),(null==s||s)&&(mxEvent.addGestureListeners(o,mxUtils.bind(this,function(e){this.eventReceiver=o,a.activeRow!=o&&a.activeRow!=a&&(null!=a.activeRow&&null!=a.activeRow.div.parentNode&&this.hideSubmenu(a),null!=o.div&&(this.showSubmenu(a,o),a.activeRow=o)),mxEvent.consume(e)}),mxUtils.bind(this,function(e){a.activeRow!=o&&a.activeRow!=a&&(null!=a.activeRow&&null!=a.activeRow.div.parentNode&&this.hideSubmenu(a),this.autoExpand&&null!=o.div&&(this.showSubmenu(a,o),a.activeRow=o)),o.className="mxPopupMenuItemHover"}),mxUtils.bind(this,function(e){this.eventReceiver==o&&(a.activeRow!=o&&this.hideMenu(),null!=t&&t(e)),this.eventReceiver=null,mxEvent.consume(e)})),mxEvent.addListener(o,"mouseout",mxUtils.bind(this,function(e){o.className="mxPopupMenuItem"}))),o},mxPopupMenu.prototype.createSubmenu=function(e){e.table=document.createElement("table"),e.table.className="mxPopupMenu",e.tbody=document.createElement("tbody"),e.table.appendChild(e.tbody),e.div=document.createElement("div"),e.div.className="mxPopupMenu",e.div.style.position="absolute",e.div.style.display="inline",e.div.style.zIndex=this.zIndex,e.div.appendChild(e.table);var n=document.createElement("img");n.setAttribute("src",this.submenuImage),td=e.firstChild.nextSibling.nextSibling,td.appendChild(n)},mxPopupMenu.prototype.showSubmenu=function(e,n){if(null!=n.div){n.div.style.left=e.div.offsetLeft+n.offsetLeft+n.offsetWidth-1+"px",n.div.style.top=e.div.offsetTop+n.offsetTop+"px",document.body.appendChild(n.div);var t=parseInt(n.div.offsetLeft),a=parseInt(n.div.offsetWidth),i=document.body,s=document.documentElement;t+a>(i.scrollLeft||s.scrollLeft)+(i.clientWidth||s.clientWidth)&&(n.div.style.left=e.div.offsetLeft-a+(mxClient.IS_IE?6:-6)+"px"),mxUtils.fit(n.div)}},mxPopupMenu.prototype.addSeparator=function(e,n){if(e=e||this,this.smartSeparators&&!n)e.willAddSeparator=!0;else if(null!=e.tbody){e.willAddSeparator=!1;var t=document.createElement("tr"),a=document.createElement("td");a.className="mxPopupMenuIcon",a.style.padding="0 0 0 0px",t.appendChild(a),(a=document.createElement("td")).style.padding="0 0 0 0px",a.setAttribute("colSpan","2");var i=document.createElement("hr");i.setAttribute("size","1"),a.appendChild(i),t.appendChild(a),e.tbody.appendChild(t)}},mxPopupMenu.prototype.popup=function(e,n,t,a){if(null!=this.div&&null!=this.tbody&&null!=this.factoryMethod){for(this.div.style.left=e+"px",this.div.style.top=n+"px";null!=this.tbody.firstChild;)mxEvent.release(this.tbody.firstChild),this.tbody.removeChild(this.tbody.firstChild);this.itemCount=0,this.factoryMethod(this,t,a),0<this.itemCount&&(this.showMenu(),this.fireEvent(new mxEventObject(mxEvent.SHOW)))}},mxPopupMenu.prototype.isMenuShowing=function(){return null!=this.div&&this.div.parentNode==document.body},mxPopupMenu.prototype.showMenu=function(){9<=document.documentMode&&(this.div.style.filter="none"),document.body.appendChild(this.div),mxUtils.fit(this.div)},mxPopupMenu.prototype.hideMenu=function(){null!=this.div&&(null!=this.div.parentNode&&this.div.parentNode.removeChild(this.div),this.hideSubmenu(this),this.containsItems=!1)},mxPopupMenu.prototype.hideSubmenu=function(e){null!=e.activeRow&&(this.hideSubmenu(e.activeRow),null!=e.activeRow.div.parentNode&&e.activeRow.div.parentNode.removeChild(e.activeRow.div),e.activeRow=null)},mxPopupMenu.prototype.destroy=function(){null!=this.div&&(mxEvent.release(this.div),null!=this.div.parentNode&&this.div.parentNode.removeChild(this.div),this.div=null)},mxAutoSaveManager.prototype=new mxEventSource,mxAutoSaveManager.prototype.constructor=mxAutoSaveManager,mxAutoSaveManager.prototype.graph=null,mxAutoSaveManager.prototype.autoSaveDelay=10,mxAutoSaveManager.prototype.autoSaveThrottle=2,mxAutoSaveManager.prototype.autoSaveThreshold=5,mxAutoSaveManager.prototype.ignoredChanges=0,mxAutoSaveManager.prototype.lastSnapshot=0,mxAutoSaveManager.prototype.enabled=!0,mxAutoSaveManager.prototype.changeHandler=null,mxAutoSaveManager.prototype.isEnabled=function(){return this.enabled},mxAutoSaveManager.prototype.setEnabled=function(e){this.enabled=e},mxAutoSaveManager.prototype.setGraph=function(e){null!=this.graph&&this.graph.getModel().removeListener(this.changeHandler),this.graph=e,null!=this.graph&&this.graph.getModel().addListener(mxEvent.CHANGE,this.changeHandler)},mxAutoSaveManager.prototype.save=function(){},mxAutoSaveManager.prototype.graphModelChanged=function(e){(e=((new Date).getTime()-this.lastSnapshot)/1e3)>this.autoSaveDelay||this.ignoredChanges>=this.autoSaveThreshold&&e>this.autoSaveThrottle?(this.save(),this.reset()):this.ignoredChanges++},mxAutoSaveManager.prototype.reset=function(){this.lastSnapshot=(new Date).getTime(),this.ignoredChanges=0},mxAutoSaveManager.prototype.destroy=function(){this.setGraph(null)},mxAnimation.prototype=new mxEventSource,mxAnimation.prototype.constructor=mxAnimation,mxAnimation.prototype.delay=null,mxAnimation.prototype.thread=null,mxAnimation.prototype.startAnimation=function(){null==this.thread&&(this.thread=window.setInterval(mxUtils.bind(this,this.updateAnimation),this.delay))},mxAnimation.prototype.updateAnimation=function(){this.fireEvent(new mxEventObject(mxEvent.EXECUTE))},mxAnimation.prototype.stopAnimation=function(){null!=this.thread&&(window.clearInterval(this.thread),this.thread=null,this.fireEvent(new mxEventObject(mxEvent.DONE)))},mxMorphing.prototype=new mxAnimation,mxMorphing.prototype.constructor=mxMorphing,mxMorphing.prototype.graph=null,mxMorphing.prototype.steps=null,mxMorphing.prototype.step=0,mxMorphing.prototype.ease=null,mxMorphing.prototype.cells=null,mxMorphing.prototype.updateAnimation=function(){var e=new mxCellStatePreview(this.graph);if(null!=this.cells)for(var n=0;n<this.cells.length;n++)this.animateCell(cells[n],e,!1);else this.animateCell(this.graph.getModel().getRoot(),e,!0);this.show(e),(e.isEmpty()||this.step++>=this.steps)&&this.stopAnimation()},mxMorphing.prototype.show=function(e){e.show()},mxMorphing.prototype.animateCell=function(e,n,t){var a=this.graph.getView().getState(e),i=null;if(null!=a&&(i=this.getDelta(a),this.graph.getModel().isVertex(e)&&(0!=i.x||0!=i.y))){var s=this.graph.view.getTranslate(),o=this.graph.view.getScale();i.x+=s.x*o,i.y+=s.y*o,n.moveState(a,-i.x/this.ease,-i.y/this.ease)}if(t&&!this.stopRecursion(a,i))for(a=this.graph.getModel().getChildCount(e),i=0;i<a;i++)this.animateCell(this.graph.getModel().getChildAt(e,i),n,t)},mxMorphing.prototype.stopRecursion=function(e,n){return null!=n&&(0!=n.x||0!=n.y)},mxMorphing.prototype.getDelta=function(e){var n=this.getOriginForCell(e.cell),t=this.graph.getView().getTranslate(),a=this.graph.getView().getScale();return e=new mxPoint(e.x/a-t.x,e.y/a-t.y),new mxPoint((n.x-e.x)*a,(n.y-e.y)*a)},mxMorphing.prototype.getOriginForCell=function(e){var n=null;return null!=e&&(n=this.getOriginForCell(this.graph.getModel().getParent(e)),null!=(e=this.graph.getCellGeometry(e))&&(n.x+=e.x,n.y+=e.y)),null==n&&(n=new mxPoint(-(n=this.graph.view.getTranslate()).x,-n.y)),n},mxImageBundle.prototype.images=null,mxImageBundle.prototype.images=null,mxImageBundle.prototype.putImage=function(e,n,t){this.images[e]={value:n,fallback:t}},mxImageBundle.prototype.getImage=function(e){var n=null;return null!=e&&(null!=(e=this.images[e])&&(n=this.alt?e.fallback:e.value)),n},mxImageExport.prototype.includeOverlays=!1,mxImageExport.prototype.drawState=function(e,n){null!=e&&(this.visitStatesRecursive(e,n,this.drawCellState),this.includeOverlays&&this.visitStatesRecursive(e,n,this.drawOverlays))},mxImageExport.prototype.visitStatesRecursive=function(e,n,t){if(null!=e){t(e,n);for(var a=e.view.graph,i=a.model.getChildCount(e.cell),s=0;s<i;s++){var o=a.view.getState(a.model.getChildAt(e.cell,s));this.visitStatesRecursive(o,n,t)}}},mxImageExport.prototype.drawCellState=function(e,n){e.shape instanceof mxShape&&(n.save(),e.shape.paint(n),n.restore()),null!=e.text&&(n.save(),e.text.paint(n),n.restore())},mxImageExport.prototype.drawOverlays=function(e,t){null!=e.overlays&&e.overlays.visit(function(e,n){n instanceof mxShape&&n.paint(t)})},mxAbstractCanvas2D.prototype.state=null,mxAbstractCanvas2D.prototype.states=null,mxAbstractCanvas2D.prototype.path=null,mxAbstractCanvas2D.prototype.rotateHtml=!0,mxAbstractCanvas2D.prototype.lastX=0,mxAbstractCanvas2D.prototype.lastY=0,mxAbstractCanvas2D.prototype.moveOp="M",mxAbstractCanvas2D.prototype.lineOp="L",mxAbstractCanvas2D.prototype.quadOp="Q",mxAbstractCanvas2D.prototype.curveOp="C",mxAbstractCanvas2D.prototype.closeOp="Z",mxAbstractCanvas2D.prototype.pointerEvents=!1,mxAbstractCanvas2D.prototype.createUrlConverter=function(){return new mxUrlConverter},mxAbstractCanvas2D.prototype.reset=function(){this.state=this.createState(),this.states=[]},mxAbstractCanvas2D.prototype.createState=function(){return{dx:0,dy:0,scale:1,alpha:1,fillColor:null,fillAlpha:1,gradientColor:null,gradientAlpha:1,gradientDirection:null,strokeColor:null,strokeWidth:1,dashed:!1,dashPattern:"3 3",lineCap:"flat",lineJoin:"miter",miterLimit:10,fontColor:"#000000",fontBackgroundColor:null,fontBorderColor:null,fontSize:mxConstants.DEFAULT_FONTSIZE,fontFamily:mxConstants.DEFAULT_FONTFAMILY,fontStyle:0,shadow:!1,shadowColor:mxConstants.SHADOWCOLOR,shadowAlpha:mxConstants.SHADOW_OPACITY,shadowDx:mxConstants.SHADOW_OFFSET_X,shadowDy:mxConstants.SHADOW_OFFSET_Y,rotation:0,rotationCx:0,rotationCy:0}},mxAbstractCanvas2D.prototype.format=function(e){return Math.round(parseFloat(e))},mxAbstractCanvas2D.prototype.addOp=function(){if(null!=this.path&&(this.path.push(arguments[0]),2<arguments.length))for(var e=this.state,n=2;n<arguments.length;n+=2)this.lastX=arguments[n-1],this.lastY=arguments[n],this.path.push(this.format((this.lastX+e.dx)*e.scale)),this.path.push(this.format((this.lastY+e.dy)*e.scale))},mxAbstractCanvas2D.prototype.rotatePoint=function(e,n,t,a,i){return t*=Math.PI/180,mxUtils.getRotatedPoint(new mxPoint(e,n),Math.cos(t),Math.sin(t),new mxPoint(a,i))},mxAbstractCanvas2D.prototype.save=function(){this.states.push(this.state),this.state=mxUtils.clone(this.state)},mxAbstractCanvas2D.prototype.restore=function(){this.state=this.states.pop()},mxAbstractCanvas2D.prototype.scale=function(e){this.state.scale*=e,this.state.strokeWidth*=e},mxAbstractCanvas2D.prototype.translate=function(e,n){this.state.dx+=e,this.state.dy+=n},mxAbstractCanvas2D.prototype.setAlpha=function(e){this.state.alpha=e},mxAbstractCanvas2D.prototype.setFillColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fillColor=e,this.state.gradientColor=null},mxAbstractCanvas2D.prototype.setGradient=function(e,n,t,a,i,s,o,r,l){(t=this.state).fillColor=e,t.fillAlpha=null!=r?r:1,t.gradientColor=n,t.gradientAlpha=null!=l?l:1,t.gradientDirection=o},mxAbstractCanvas2D.prototype.setStrokeColor=function(e){e==mxConstants.NONE&&(e=null),this.state.strokeColor=e},mxAbstractCanvas2D.prototype.setStrokeWidth=function(e){this.state.strokeWidth=e},mxAbstractCanvas2D.prototype.setDashed=function(e){this.state.dashed=e},mxAbstractCanvas2D.prototype.setDashPattern=function(e){this.state.dashPattern=e},mxAbstractCanvas2D.prototype.setLineCap=function(e){this.state.lineCap=e},mxAbstractCanvas2D.prototype.setLineJoin=function(e){this.state.lineJoin=e},mxAbstractCanvas2D.prototype.setMiterLimit=function(e){this.state.miterLimit=e},mxAbstractCanvas2D.prototype.setFontColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fontColor=e},mxAbstractCanvas2D.prototype.setFontBackgroundColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fontBackgroundColor=e},mxAbstractCanvas2D.prototype.setFontBorderColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fontBorderColor=e},mxAbstractCanvas2D.prototype.setFontSize=function(e){this.state.fontSize=e},mxAbstractCanvas2D.prototype.setFontFamily=function(e){this.state.fontFamily=e},mxAbstractCanvas2D.prototype.setFontStyle=function(e){null==e&&(e=0),this.state.fontStyle=e},mxAbstractCanvas2D.prototype.setShadow=function(e){this.state.shadow=e},mxAbstractCanvas2D.prototype.setShadowColor=function(e){e==mxConstants.NONE&&(e=null),this.state.shadowColor=e},mxAbstractCanvas2D.prototype.setShadowAlpha=function(e){this.state.shadowAlpha=e},mxAbstractCanvas2D.prototype.setShadowOffset=function(e,n){this.state.shadowDx=e,this.state.shadowDy=n},mxAbstractCanvas2D.prototype.begin=function(){this.lastY=this.lastX=0,this.path=[]},mxAbstractCanvas2D.prototype.moveTo=function(e,n){this.addOp(this.moveOp,e,n)},mxAbstractCanvas2D.prototype.lineTo=function(e,n){this.addOp(this.lineOp,e,n)},mxAbstractCanvas2D.prototype.quadTo=function(e,n,t,a){this.addOp(this.quadOp,e,n,t,a)},mxAbstractCanvas2D.prototype.curveTo=function(e,n,t,a,i,s){this.addOp(this.curveOp,e,n,t,a,i,s)},mxAbstractCanvas2D.prototype.arcTo=function(e,n,t,a,i,s,o){for(e=mxUtils.arcToCurves(this.lastX,this.lastY,e,n,t,a,i,s,o),n=0;n<e.length;n+=6)this.curveTo(e[n],e[n+1],e[n+2],e[n+3],e[n+4],e[n+5])},mxAbstractCanvas2D.prototype.close=function(e,n,t,a,i,s){this.addOp(this.closeOp)},mxAbstractCanvas2D.prototype.end=function(){},mxUtils.extend(mxXmlCanvas2D,mxAbstractCanvas2D),mxXmlCanvas2D.prototype.textEnabled=!0,mxXmlCanvas2D.prototype.compressed=!0,mxXmlCanvas2D.prototype.writeDefaults=function(){var e;(e=this.createElement("fontfamily")).setAttribute("family",mxConstants.DEFAULT_FONTFAMILY),this.root.appendChild(e),(e=this.createElement("fontsize")).setAttribute("size",mxConstants.DEFAULT_FONTSIZE),this.root.appendChild(e),(e=this.createElement("shadowcolor")).setAttribute("color",mxConstants.SHADOWCOLOR),this.root.appendChild(e),(e=this.createElement("shadowalpha")).setAttribute("alpha",mxConstants.SHADOW_OPACITY),this.root.appendChild(e),(e=this.createElement("shadowoffset")).setAttribute("dx",mxConstants.SHADOW_OFFSET_X),e.setAttribute("dy",mxConstants.SHADOW_OFFSET_Y),this.root.appendChild(e)},mxXmlCanvas2D.prototype.format=function(e){return parseFloat(parseFloat(e).toFixed(2))},mxXmlCanvas2D.prototype.createElement=function(e){return this.root.ownerDocument.createElement(e)},mxXmlCanvas2D.prototype.save=function(){this.compressed&&mxAbstractCanvas2D.prototype.save.apply(this,arguments),this.root.appendChild(this.createElement("save"))},mxXmlCanvas2D.prototype.restore=function(){this.compressed&&mxAbstractCanvas2D.prototype.restore.apply(this,arguments),this.root.appendChild(this.createElement("restore"))},mxXmlCanvas2D.prototype.scale=function(e){if(this.compressed){if(this.state.scale==e)return;mxAbstractCanvas2D.prototype.setAlpha.apply(this,arguments)}var n=this.createElement("scale");n.setAttribute("scale",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.translate=function(e,n){var t=this.createElement("translate");t.setAttribute("dx",this.format(e)),t.setAttribute("dy",this.format(n)),this.root.appendChild(t)},mxXmlCanvas2D.prototype.rotate=function(e,n,t,a,i){var s=this.createElement("rotate");(0!=e||n||t)&&(s.setAttribute("theta",this.format(e)),s.setAttribute("flipH",n?"1":"0"),s.setAttribute("flipV",t?"1":"0"),s.setAttribute("cx",this.format(a)),s.setAttribute("cy",this.format(i)),this.root.appendChild(s))},mxXmlCanvas2D.prototype.setAlpha=function(e){if(this.compressed){if(this.state.alpha==e)return;mxAbstractCanvas2D.prototype.setAlpha.apply(this,arguments)}var n=this.createElement("alpha");n.setAttribute("alpha",this.format(e)),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setFillColor=function(e){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fillColor==e)return;mxAbstractCanvas2D.prototype.setFillColor.apply(this,arguments)}var n=this.createElement("fillcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setGradient=function(e,n,t,a,i,s,o,r,l){if(null!=e&&null!=n){mxAbstractCanvas2D.prototype.setGradient.apply(this,arguments);var d=this.createElement("gradient");d.setAttribute("c1",e),d.setAttribute("c2",n),d.setAttribute("x",this.format(t)),d.setAttribute("y",this.format(a)),d.setAttribute("w",this.format(i)),d.setAttribute("h",this.format(s)),null!=o&&d.setAttribute("direction",o),null!=r&&d.setAttribute("alpha1",r),null!=l&&d.setAttribute("alpha2",l),this.root.appendChild(d)}},mxXmlCanvas2D.prototype.setStrokeColor=function(e){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.strokeColor==e)return;mxAbstractCanvas2D.prototype.setStrokeColor.apply(this,arguments)}var n=this.createElement("strokecolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setStrokeWidth=function(e){if(this.compressed){if(this.state.strokeWidth==e)return;mxAbstractCanvas2D.prototype.setStrokeWidth.apply(this,arguments)}var n=this.createElement("strokewidth");n.setAttribute("width",this.format(e)),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setDashed=function(e){if(this.compressed){if(this.state.dashed==e)return;mxAbstractCanvas2D.prototype.setDashed.apply(this,arguments)}var n=this.createElement("dashed");n.setAttribute("dashed",e?"1":"0"),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setDashPattern=function(e){if(this.compressed){if(this.state.dashPattern==e)return;mxAbstractCanvas2D.prototype.setDashPattern.apply(this,arguments)}var n=this.createElement("dashpattern");n.setAttribute("pattern",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setLineCap=function(e){if(this.compressed){if(this.state.lineCap==e)return;mxAbstractCanvas2D.prototype.setLineCap.apply(this,arguments)}var n=this.createElement("linecap");n.setAttribute("cap",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setLineJoin=function(e){if(this.compressed){if(this.state.lineJoin==e)return;mxAbstractCanvas2D.prototype.setLineJoin.apply(this,arguments)}var n=this.createElement("linejoin");n.setAttribute("join",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setMiterLimit=function(e){if(this.compressed){if(this.state.miterLimit==e)return;mxAbstractCanvas2D.prototype.setMiterLimit.apply(this,arguments)}var n=this.createElement("miterlimit");n.setAttribute("limit",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setFontColor=function(e){if(this.textEnabled){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fontColor==e)return;mxAbstractCanvas2D.prototype.setFontColor.apply(this,arguments)}var n=this.createElement("fontcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontBackgroundColor=function(e){if(this.textEnabled){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fontBackgroundColor==e)return;mxAbstractCanvas2D.prototype.setFontBackgroundColor.apply(this,arguments)}var n=this.createElement("fontbackgroundcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontBorderColor=function(e){if(this.textEnabled){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fontBorderColor==e)return;mxAbstractCanvas2D.prototype.setFontBorderColor.apply(this,arguments)}var n=this.createElement("fontbordercolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontSize=function(e){if(this.textEnabled){if(this.compressed){if(this.state.fontSize==e)return;mxAbstractCanvas2D.prototype.setFontSize.apply(this,arguments)}var n=this.createElement("fontsize");n.setAttribute("size",e),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontFamily=function(e){if(this.textEnabled){if(this.compressed){if(this.state.fontFamily==e)return;mxAbstractCanvas2D.prototype.setFontFamily.apply(this,arguments)}var n=this.createElement("fontfamily");n.setAttribute("family",e),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontStyle=function(e){if(this.textEnabled){if(null==e&&(e=0),this.compressed){if(this.state.fontStyle==e)return;mxAbstractCanvas2D.prototype.setFontStyle.apply(this,arguments)}var n=this.createElement("fontstyle");n.setAttribute("style",e),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setShadow=function(e){if(this.compressed){if(this.state.shadow==e)return;mxAbstractCanvas2D.prototype.setShadow.apply(this,arguments)}var n=this.createElement("shadow");n.setAttribute("enabled",e?"1":"0"),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setShadowColor=function(e){if(this.compressed){if(e==mxConstants.NONE&&(e=null),this.state.shadowColor==e)return;mxAbstractCanvas2D.prototype.setShadowColor.apply(this,arguments)}var n=this.createElement("shadowcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setShadowAlpha=function(e){if(this.compressed){if(this.state.shadowAlpha==e)return;mxAbstractCanvas2D.prototype.setShadowAlpha.apply(this,arguments)}var n=this.createElement("shadowalpha");n.setAttribute("alpha",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setShadowOffset=function(e,n){if(this.compressed){if(this.state.shadowDx==e&&this.state.shadowDy==n)return;mxAbstractCanvas2D.prototype.setShadowOffset.apply(this,arguments)}var t=this.createElement("shadowoffset");t.setAttribute("dx",e),t.setAttribute("dy",n),this.root.appendChild(t)},mxXmlCanvas2D.prototype.rect=function(e,n,t,a){var i=this.createElement("rect");i.setAttribute("x",this.format(e)),i.setAttribute("y",this.format(n)),i.setAttribute("w",this.format(t)),i.setAttribute("h",this.format(a)),this.root.appendChild(i)},mxXmlCanvas2D.prototype.roundrect=function(e,n,t,a,i,s){var o=this.createElement("roundrect");o.setAttribute("x",this.format(e)),o.setAttribute("y",this.format(n)),o.setAttribute("w",this.format(t)),o.setAttribute("h",this.format(a)),o.setAttribute("dx",this.format(i)),o.setAttribute("dy",this.format(s)),this.root.appendChild(o)},mxXmlCanvas2D.prototype.ellipse=function(e,n,t,a){var i=this.createElement("ellipse");i.setAttribute("x",this.format(e)),i.setAttribute("y",this.format(n)),i.setAttribute("w",this.format(t)),i.setAttribute("h",this.format(a)),this.root.appendChild(i)},mxXmlCanvas2D.prototype.image=function(e,n,t,a,i,s,o,r){i=this.converter.convert(i);var l=this.createElement("image");l.setAttribute("x",this.format(e)),l.setAttribute("y",this.format(n)),l.setAttribute("w",this.format(t)),l.setAttribute("h",this.format(a)),l.setAttribute("src",i),l.setAttribute("aspect",s?"1":"0"),l.setAttribute("flipH",o?"1":"0"),l.setAttribute("flipV",r?"1":"0"),this.root.appendChild(l)},mxXmlCanvas2D.prototype.begin=function(){this.root.appendChild(this.createElement("begin")),this.lastY=this.lastX=0},mxXmlCanvas2D.prototype.moveTo=function(e,n){var t=this.createElement("move");t.setAttribute("x",this.format(e)),t.setAttribute("y",this.format(n)),this.root.appendChild(t),this.lastX=e,this.lastY=n},mxXmlCanvas2D.prototype.lineTo=function(e,n){var t=this.createElement("line");t.setAttribute("x",this.format(e)),t.setAttribute("y",this.format(n)),this.root.appendChild(t),this.lastX=e,this.lastY=n},mxXmlCanvas2D.prototype.quadTo=function(e,n,t,a){var i=this.createElement("quad");i.setAttribute("x1",this.format(e)),i.setAttribute("y1",this.format(n)),i.setAttribute("x2",this.format(t)),i.setAttribute("y2",this.format(a)),this.root.appendChild(i),this.lastX=t,this.lastY=a},mxXmlCanvas2D.prototype.curveTo=function(e,n,t,a,i,s){var o=this.createElement("curve");o.setAttribute("x1",this.format(e)),o.setAttribute("y1",this.format(n)),o.setAttribute("x2",this.format(t)),o.setAttribute("y2",this.format(a)),o.setAttribute("x3",this.format(i)),o.setAttribute("y3",this.format(s)),this.root.appendChild(o),this.lastX=i,this.lastY=s},mxXmlCanvas2D.prototype.close=function(){this.root.appendChild(this.createElement("close"))},mxXmlCanvas2D.prototype.text=function(e,n,t,a,i,s,o,r,l,d,c,m){if(this.textEnabled&&null!=i){mxUtils.isNode(i)&&(i=mxUtils.getOuterHtml(i));var u=this.createElement("text");u.setAttribute("x",this.format(e)),u.setAttribute("y",this.format(n)),u.setAttribute("w",this.format(t)),u.setAttribute("h",this.format(a)),u.setAttribute("str",i),null!=s&&u.setAttribute("align",s),null!=o&&u.setAttribute("valign",o),u.setAttribute("wrap",r?"1":"0"),null==l&&(l=""),u.setAttribute("format",l),null!=d&&u.setAttribute("fill",d?"1":"0"),null!=c&&u.setAttribute("clip",c?"1":"0"),null!=m&&u.setAttribute("rotation",m),this.root.appendChild(u)}},mxXmlCanvas2D.prototype.stroke=function(){this.root.appendChild(this.createElement("stroke"))},mxXmlCanvas2D.prototype.fill=function(){this.root.appendChild(this.createElement("fill"))},mxXmlCanvas2D.prototype.fillAndStroke=function(){this.root.appendChild(this.createElement("fillstroke"))},mxUtils.extend(mxSvgCanvas2D,mxAbstractCanvas2D),mxSvgCanvas2D.prototype.node=null,mxSvgCanvas2D.prototype.matchHtmlAlignment=!0,mxSvgCanvas2D.prototype.textEnabled=!0,mxSvgCanvas2D.prototype.foEnabled=!0,mxSvgCanvas2D.prototype.strokeTolerance=0,mxSvgCanvas2D.prototype.refCount=0,mxSvgCanvas2D.prototype.blockImagePointerEvents=!1,mxSvgCanvas2D.prototype.reset=function(){mxAbstractCanvas2D.prototype.reset.apply(this,arguments),this.gradients=[]},mxSvgCanvas2D.prototype.createStyle=function(e){return(e=this.createElement("style")).setAttribute("type","text/css"),mxUtils.write(e,"svg{font-family:"+mxConstants.DEFAULT_FONTFAMILY+";font-size:"+mxConstants.DEFAULT_FONTSIZE+";fill:none;stroke-miterlimit:10}"),e},mxSvgCanvas2D.prototype.createElement=function(e,n){if(null!=this.root.ownerDocument.createElementNS)return this.root.ownerDocument.createElementNS(n||mxConstants.NS_SVG,e);var t=this.root.ownerDocument.createElement(e);return null!=n&&t.setAttribute("xmlns",n),t},mxSvgCanvas2D.prototype.createGradientId=function(e,n,t,a,i){return"#"==e.charAt(0)&&(e=e.substring(1)),"#"==n.charAt(0)&&(n=n.substring(1)),e=e.toLowerCase()+"-"+t,n=n.toLowerCase()+"-"+a,(t=null)==i||i==mxConstants.DIRECTION_SOUTH?t="s":i==mxConstants.DIRECTION_EAST?t="e":(a=e,e=n,n=a,i==mxConstants.DIRECTION_NORTH?t="s":i==mxConstants.DIRECTION_WEST&&(t="e")),"mx-gradient-"+e+"-"+n+"-"+t},mxSvgCanvas2D.prototype.getSvgGradient=function(e,n,t,a,i){var s=this.createGradientId(e,n,t,a,i),o=this.gradients[s];if(null==o){var r=this.root.ownerSVGElement,l=0,d=s+"-"+l;if(null!=r)for(o=r.ownerDocument.getElementById(d);null!=o&&o.ownerSVGElement!=r;)d=s+"-"+l++,o=r.ownerDocument.getElementById(d);else d="id"+ ++this.refCount;null==o&&((o=this.createSvgGradient(e,n,t,a,i)).setAttribute("id",d),null!=this.defs?this.defs.appendChild(o):r.appendChild(o)),this.gradients[s]=o}return o.getAttribute("id")},mxSvgCanvas2D.prototype.createSvgGradient=function(e,n,t,a,i){var s=this.createElement("linearGradient");return s.setAttribute("x1","0%"),s.setAttribute("y1","0%"),s.setAttribute("x2","0%"),s.setAttribute("y2","0%"),null==i||i==mxConstants.DIRECTION_SOUTH?s.setAttribute("y2","100%"):i==mxConstants.DIRECTION_EAST?s.setAttribute("x2","100%"):i==mxConstants.DIRECTION_NORTH?s.setAttribute("y1","100%"):i==mxConstants.DIRECTION_WEST&&s.setAttribute("x1","100%"),t=t<1?";stop-opacity:"+t:"",(i=this.createElement("stop")).setAttribute("offset","0%"),i.setAttribute("style","stop-color:"+e+t),s.appendChild(i),t=a<1?";stop-opacity:"+a:"",(i=this.createElement("stop")).setAttribute("offset","100%"),i.setAttribute("style","stop-color:"+n+t),s.appendChild(i),s},mxSvgCanvas2D.prototype.addNode=function(e,n){var t=this.node,a=this.state;if(null!=t){if("path"==t.nodeName){if(!(null!=this.path&&0<this.path.length))return;t.setAttribute("d",this.path.join(" "))}e&&null!=a.fillColor?this.updateFill():this.styleEnabled||("ellipse"!=t.nodeName||!mxClient.IS_NS||mxClient.IS_GC||mxClient.IS_SF?t.setAttribute("fill","none"):t.setAttribute("fill","transparent"),e=!1),n&&null!=a.strokeColor?this.updateStroke():this.styleEnabled||t.setAttribute("stroke","none"),null!=a.transform&&0<a.transform.length&&t.setAttribute("transform",a.transform),a.shadow&&this.root.appendChild(this.createShadow(t)),0<this.strokeTolerance&&!e&&this.root.appendChild(this.createTolerance(t)),this.pointerEvents&&("path"!=t.nodeName||this.path[this.path.length-1]==this.closeOp)&&t.setAttribute("pointer-events","all"),this.root.appendChild(t)}},mxSvgCanvas2D.prototype.updateFill=function(){var e=this.state;e.alpha<1&&this.node.setAttribute("fill-opacity",e.alpha),null!=e.fillColor&&(null!=e.gradientColor?(e=this.getSvgGradient(e.fillColor,e.gradientColor,e.fillAlpha,e.gradientAlpha,e.gradientDirection),this.node.setAttribute("fill","url(#"+e+")")):this.node.setAttribute("fill",e.fillColor.toLowerCase()))},mxSvgCanvas2D.prototype.updateStroke=function(){var e=this.state;this.node.setAttribute("stroke",e.strokeColor.toLowerCase()),e.alpha<1&&this.node.setAttribute("stroke-opacity",e.alpha);var n=Math.max(1,this.format(e.strokeWidth*e.scale));1!=n&&this.node.setAttribute("stroke-width",n),"path"==this.node.nodeName&&this.updateStrokeAttributes(),e.dashed&&this.node.setAttribute("stroke-dasharray",this.createDashPattern(n))},mxSvgCanvas2D.prototype.updateStrokeAttributes=function(){var e=this.state;if(null!=e.lineJoin&&"miter"!=e.lineJoin&&this.node.setAttribute("stroke-linejoin",e.lineJoin),null!=e.lineCap){var n=e.lineCap;"flat"==n&&(n="butt"),"butt"!=n&&this.node.setAttribute("stroke-linecap",n)}null!=e.miterLimit&&(!this.styleEnabled||10!=e.miterLimit)&&this.node.setAttribute("stroke-miterlimit",e.miterLimit)},mxSvgCanvas2D.prototype.createDashPattern=function(e){var n=this.state.dashPattern.split(" "),t=[];if(0<n.length)for(var a=0;a<n.length;a++)t[a]=Number(n[a])*e;return t.join(" ")},mxSvgCanvas2D.prototype.createTolerance=function(e){e=e.cloneNode(!0);var n=parseFloat(e.getAttribute("stroke-width")||1)+this.strokeTolerance;return e.setAttribute("pointer-events","stroke"),e.setAttribute("visibility","hidden"),e.removeAttribute("stroke-dasharray"),e.setAttribute("stroke-width",n),e.setAttribute("fill","none"),e.setAttribute("stroke",mxClient.IS_OP?"none":"white"),e},mxSvgCanvas2D.prototype.createShadow=function(e){e=e.cloneNode(!0);var n=this.state;return"none"!=e.getAttribute("fill")&&e.setAttribute("fill",n.shadowColor),"none"!=e.getAttribute("stroke")&&e.setAttribute("stroke",n.shadowColor),e.setAttribute("transform","translate("+this.format(n.shadowDx*n.scale)+","+this.format(n.shadowDy*n.scale)+")"+(n.transform||"")),e.setAttribute("opacity",n.shadowAlpha),e},mxSvgCanvas2D.prototype.rotate=function(e,n,t,a,i){if(0!=e||n||t){var s=this.state;if(a+=s.dx,i+=s.dy,a*=s.scale,i*=s.scale,s.transform=s.transform||"",n&&t)e+=180;else if(n^t){var o=n?a:0,r=n?-1:1,l=t?i:0,d=t?-1:1;s.transform+="translate("+this.format(o)+","+this.format(l)+")scale("+this.format(r)+","+this.format(d)+")translate("+this.format(-o)+","+this.format(-l)+")"}(n?!t:t)&&(e*=-1),0!=e&&(s.transform+="rotate("+this.format(e)+","+this.format(a)+","+this.format(i)+")"),s.rotation+=e,s.rotationCx=a,s.rotationCy=i}},mxSvgCanvas2D.prototype.begin=function(){mxAbstractCanvas2D.prototype.begin.apply(this,arguments),this.node=this.createElement("path")},mxSvgCanvas2D.prototype.rect=function(e,n,t,a){var i=this.state,s=this.createElement("rect");s.setAttribute("x",this.format((e+i.dx)*i.scale)),s.setAttribute("y",this.format((n+i.dy)*i.scale)),s.setAttribute("width",this.format(t*i.scale)),s.setAttribute("height",this.format(a*i.scale)),this.node=s},mxSvgCanvas2D.prototype.roundrect=function(e,n,t,a,i,s){this.rect(e,n,t,a),0<i&&this.node.setAttribute("rx",this.format(i*this.state.scale)),0<s&&this.node.setAttribute("ry",this.format(s*this.state.scale))},mxSvgCanvas2D.prototype.ellipse=function(e,n,t,a){var i=this.state,s=this.createElement("ellipse");s.setAttribute("cx",Math.round((e+t/2+i.dx)*i.scale)),s.setAttribute("cy",Math.round((n+a/2+i.dy)*i.scale)),s.setAttribute("rx",t/2*i.scale),s.setAttribute("ry",a/2*i.scale),this.node=s},mxSvgCanvas2D.prototype.image=function(e,n,t,a,i,s,o,r){i=this.converter.convert(i),s=null==s||s,o=null!=o&&o,r=null!=r&&r;var l=this.state;e+=l.dx,n+=l.dy;var d=this.createElement("image");if(d.setAttribute("x",this.format(e*l.scale)),d.setAttribute("y",this.format(n*l.scale)),d.setAttribute("width",this.format(t*l.scale)),d.setAttribute("height",this.format(a*l.scale)),null==d.setAttributeNS?d.setAttribute("xlink:href",i):d.setAttributeNS(mxConstants.NS_XLINK,"href",i),s||d.setAttribute("preserveAspectRatio","none"),l.alpha<1&&d.setAttribute("opacity",l.alpha),i=this.state.transform||"",o||r){var c=s=1,m=0,u=0;o&&(s=-1,m=-t-2*e),r&&(c=-1,u=-a-2*n),i+="scale("+s+","+c+")translate("+m+","+u+")"}0<i.length&&d.setAttribute("transform",i),this.root.appendChild(d),this.blockImagePointerEvents&&(d.setAttribute("style","pointer-events:none"),(d=this.createElement("rect")).setAttribute("visibility","hidden"),d.setAttribute("pointer-events","fill"),d.setAttribute("x",this.format(e*l.scale)),d.setAttribute("y",this.format(n*l.scale)),d.setAttribute("width",this.format(t*l.scale)),d.setAttribute("height",this.format(a*l.scale)),this.root.appendChild(d))},mxSvgCanvas2D.prototype.createDiv=function(e,n,t,a,i){return t=this.state,a="display:inline-block;font-size:"+Math.round(t.fontSize)+"px;font-family:"+t.fontFamily+";color:"+t.fontColor+";line-height:"+Math.round(t.fontSize*mxConstants.LINE_HEIGHT)+"px;"+a,(t.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(a+="font-weight:bold;"),(t.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(a+="font-style:italic;"),(t.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(a+="font-decoration:underline;"),n==mxConstants.ALIGN_CENTER?a+="text-align:center;":n==mxConstants.ALIGN_RIGHT&&(a+="text-align:right;"),n="",null!=t.fontBackgroundColor&&(n+="background-color:"+t.fontBackgroundColor+";"),null!=t.fontBorderColor&&(n+="border:1px solid "+t.fontBorderColor+";"),mxUtils.isNode(e)||((t=document.createElement("textarea")).innerHTML=e.replace(/&lt;/g,"&amp;lt;").replace(/&gt;/g,"&amp;gt;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e=t.value,i?a+=n:0<n.length&&(e='<div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;'+n+'">'+e+"</div>")),!mxClient.IS_IE&&document.createElementNS?((i=document.createElementNS("http://www.w3.org/1999/xhtml","div")).setAttribute("style",a),mxUtils.isNode(e)?this.root.ownerDocument!=document?i.appendChild(e.cloneNode(!0)):i.appendChild(e):i.innerHTML=e,i):(mxUtils.isNode(e)&&this.root.ownerDocument!=document&&(e=e.outerHTML),e=e.replace(/<br>/g,"<br />").replace(/<hr>/g,"<hr />"),mxUtils.parseXml('<div xmlns="http://www.w3.org/1999/xhtml" style="'+a+'">'+e+"</div>").documentElement)},mxSvgCanvas2D.prototype.text=function(e,n,t,a,i,s,o,r,l,d,c,m){if(this.textEnabled&&null!=i){m=null!=m?m:0;var u=this.state;if(e+=u.dx,n+=u.dy,this.foEnabled&&"html"==l){var p="vertical-align:top;";if(c?(p+="overflow:hidden;",0<a&&(p+="max-height:"+Math.round(a)+"px;"),0<t&&(p+="width:"+Math.round(t)+"px;")):d&&(p+="width:"+Math.round(t)+"px;",0<a&&(p+="max-height:"+Math.round(a)+"px;")),r?(!c&&0<t&&(p+="width:"+Math.round(t)+"px;"),p+="white-space:normal;"):p+="white-space:nowrap;",r=this.createElement("g"),u.alpha<1&&r.setAttribute("opacity",u.alpha),(l=this.createElement("foreignObject")).setAttribute("pointer-events","all"),null!=(p=this.createDiv(i,s,o,p,d))){r.appendChild(l),this.root.appendChild(r);var g=0;if(mxClient.IS_IE&&!mxClient.IS_SVG){var v=document.createElement("div");v.style.cssText=p.getAttribute("style"),v.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",v.style.visibility="hidden",v.innerHTML=mxUtils.isNode(i)?i.outerHTML:i,document.body.appendChild(v),g=v.offsetWidth,a=mxClient.IS_QUIRKS&&0<a&&c?Math.min(a,v.offsetHeight+2):v.offsetHeight,v.parentNode.removeChild(v),l.appendChild(p)}else this.root.ownerDocument!=document?(p.style.visibility="hidden",document.body.appendChild(p),g=p.offsetWidth,a=p.offsetHeight,l.appendChild(p),p.style.visibility=""):(l.appendChild(p),g=p.offsetWidth,a=p.offsetHeight);t=d?Math.max(t,g):g,u.alpha<1&&r.setAttribute("opacity",u.alpha),d=i=0,s==mxConstants.ALIGN_CENTER?i-=t/2:s==mxConstants.ALIGN_RIGHT&&(i-=t),e+=i,o==mxConstants.ALIGN_MIDDLE?d-=a/2:o==mxConstants.ALIGN_BOTTOM&&(d-=a),n+=d,s=1!=u.scale?"scale("+u.scale+")":"",0!=u.rotation&&this.rotateHtml?(s+="rotate("+u.rotation+","+t/2+","+a/2+")",e=(n=this.rotatePoint((e+t/2)*u.scale,(n+a/2)*u.scale,u.rotation,u.rotationCx,u.rotationCy)).x-t*u.scale/2,n=n.y-a*u.scale/2):(e*=u.scale,n*=u.scale),0!=m&&(s+="rotate("+m+","+-i+","+-d+")"),r.setAttribute("transform","translate("+Math.round(e)+","+Math.round(n)+")"+s),l.setAttribute("width",Math.round(Math.max(1,t))),l.setAttribute("height",Math.round(Math.max(1,a)))}}else this.plainText(e,n,t,a,i,s,o,r,d,c,m)}},mxSvgCanvas2D.prototype.createClip=function(e,n,t,a){for(var i="mx-clip-"+(e=Math.round(e))+"-"+(n=Math.round(n))+"-"+(t=Math.round(t))+"-"+(a=Math.round(a)),s=0,o=i+"-"+s;null!=document.getElementById(o);)o=i+"-"+ ++s;return clip=this.createElement("clipPath"),clip.setAttribute("id",o),(i=this.createElement("rect")).setAttribute("x",e),i.setAttribute("y",n),i.setAttribute("width",t),i.setAttribute("height",a),clip.appendChild(i),clip},mxSvgCanvas2D.prototype.plainText=function(e,n,t,a,i,s,o,r,l,d,c){c=null!=c?c:0,r=this.state;var m=Math.round(r.fontSize),u=this.createElement("g"),p=r.transform||"";if(0!=c&&(p+="rotate("+c+","+this.format(e*r.scale)+","+this.format(n*r.scale)+")"),d&&0<t&&0<a){var g=e;c=n,s==mxConstants.ALIGN_CENTER?g-=t/2:s==mxConstants.ALIGN_RIGHT&&(g-=t),o==mxConstants.ALIGN_MIDDLE?c-=a/2:o==mxConstants.ALIGN_BOTTOM&&(c-=a),c=this.createClip(g*r.scale-2,c*r.scale-2,t*r.scale+4,a*r.scale+4),null!=this.defs?this.defs.appendChild(c):this.root.appendChild(c),u.setAttribute("clip-path","url(#"+c.getAttribute("id")+")")}this.updateFont(u,s),"start"!=(c=s==mxConstants.ALIGN_RIGHT?"end":s==mxConstants.ALIGN_CENTER?"middle":"start")&&u.setAttribute("text-anchor",c),(!this.styleEnabled||m!=mxConstants.DEFAULT_FONTSIZE)&&u.setAttribute("font-size",Math.round(m*r.scale)+"px"),0<p.length&&u.setAttribute("transform",p),r.alpha<1&&u.setAttribute("opacity",r.alpha);p=i.split("\n"),g=Math.round(m*mxConstants.LINE_HEIGHT);var v=m+(p.length-1)*g;for(c=n+m-1,o==mxConstants.ALIGN_MIDDLE?c-=(a=(this.matchHtmlAlignment&&d&&0<a?Math.min(v,a):v)/2)+1:o==mxConstants.ALIGN_BOTTOM&&(c-=(a=this.matchHtmlAlignment&&d&&0<a?Math.min(v,a):v)+2),a=0;a<p.length;a++)0<p[a].length&&0<mxUtils.trim(p[a]).length&&((d=this.createElement("text")).setAttribute("x",this.format(e*r.scale)),d.setAttribute("y",this.format(c*r.scale)),mxUtils.write(d,p[a]),u.appendChild(d)),c+=g;this.root.appendChild(u),this.addTextBackground(u,i,e,n,t,v,s,o,l)},mxSvgCanvas2D.prototype.updateFont=function(e){var n=this.state;e.setAttribute("fill",n.fontColor),(!this.styleEnabled||n.fontFamily!=mxConstants.DEFAULT_FONTFAMILY)&&e.setAttribute("font-family",n.fontFamily),(n.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&e.setAttribute("font-weight","bold"),(n.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&e.setAttribute("font-style","italic"),(n.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&e.setAttribute("text-decoration","underline")},mxSvgCanvas2D.prototype.addTextBackground=function(e,n,t,a,i,s,o,r,l){var d=this.state;if(null!=d.fontBackgroundColor||null!=d.fontBorderColor){var c=null;null!=(c=l?(o==mxConstants.ALIGN_CENTER?t-=i/2:o==mxConstants.ALIGN_RIGHT&&(t-=i),r==mxConstants.ALIGN_MIDDLE?a-=s/2:r==mxConstants.ALIGN_BOTTOM&&(a-=s),new mxRectangle((t+1)*d.scale,a*d.scale,(i-2)*d.scale,(s+2)*d.scale)):null!=e.getBBox&&this.root.ownerDocument==document?(c=e.getBBox(),n=mxClient.IS_IE&&mxClient.IS_SVG,new mxRectangle(c.x,c.y+(n?0:1),c.width,c.height+(n?1:0))):((c=document.createElement("div")).style.lineHeight=Math.round(d.fontSize*mxConstants.LINE_HEIGHT)+"px",c.style.fontSize=Math.round(d.fontSize)+"px",c.style.fontFamily=d.fontFamily,c.style.whiteSpace="nowrap",c.style.position="absolute",c.style.visibility="hidden",c.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",c.style.zoom="1",(d.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(c.style.fontWeight="bold"),(d.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(c.style.fontStyle="italic"),n=mxUtils.htmlEntities(n,!1),c.innerHTML=n.replace(/\n/g,"<br/>"),document.body.appendChild(c),i=c.offsetWidth,s=c.offsetHeight,c.parentNode.removeChild(c),o==mxConstants.ALIGN_CENTER?t-=i/2:o==mxConstants.ALIGN_RIGHT&&(t-=i),r==mxConstants.ALIGN_MIDDLE?a-=s/2:r==mxConstants.ALIGN_BOTTOM&&(a-=s),new mxRectangle((t+1)*d.scale,(a+2)*d.scale,i*d.scale,(s+1)*d.scale)))&&((n=this.createElement("rect")).setAttribute("fill",d.fontBackgroundColor||"none"),n.setAttribute("stroke",d.fontBorderColor||"none"),n.setAttribute("x",Math.floor(c.x-1)),n.setAttribute("y",Math.floor(c.y-1)),n.setAttribute("width",Math.ceil(c.width+2)),n.setAttribute("height",Math.ceil(c.height)),d=null!=d.fontBorderColor?Math.max(1,this.format(d.scale)):0,n.setAttribute("stroke-width",d),this.root.ownerDocument==document&&1==mxUtils.mod(d,2)&&n.setAttribute("transform","translate(0.5, 0.5)"),e.insertBefore(n,e.firstChild))}},mxSvgCanvas2D.prototype.stroke=function(){this.addNode(!1,!0)},mxSvgCanvas2D.prototype.fill=function(){this.addNode(!0,!1)},mxSvgCanvas2D.prototype.fillAndStroke=function(){this.addNode(!0,!0)};var mxVmlCanvas2D=function(e){mxAbstractCanvas2D.call(this),this.root=e};function mxGuide(e,n){this.graph=e,this.setStates(n)}function mxStencil(e){this.desc=e,this.parseDescription(),this.parseConstraints()}function mxShape(e){this.stencil=e,this.strokewidth=1,this.rotation=0,this.opacity=100,this.flipV=this.flipH=!1}mxUtils.extend(mxVmlCanvas2D,mxAbstractCanvas2D),mxVmlCanvas2D.prototype.node=null,mxVmlCanvas2D.prototype.textEnabled=!0,mxVmlCanvas2D.prototype.moveOp="m",mxVmlCanvas2D.prototype.lineOp="l",mxVmlCanvas2D.prototype.curveOp="c",mxVmlCanvas2D.prototype.closeOp="x",mxVmlCanvas2D.prototype.rotatedHtmlBackground="",mxVmlCanvas2D.prototype.vmlScale=1,mxVmlCanvas2D.prototype.addNode=function(e,n){var t=this.node,a=this.state;if(null!=t){if("shape"==t.nodeName){if(!(null!=this.path&&0<this.path.length))return;t.path=this.path.join(" ")+" e",t.style.width=this.root.style.width,t.style.height=this.root.style.height,t.coordsize=parseInt(t.style.width)+" "+parseInt(t.style.height)}t.strokeweight=this.format(Math.max(1,a.strokeWidth*a.scale/this.vmlScale))+"px",a.shadow&&this.root.appendChild(this.createShadow(t,e&&null!=a.fillColor,n&&null!=a.strokeColor)),n&&null!=a.strokeColor?(t.stroked="true",t.strokecolor=a.strokeColor):t.stroked="false",t.appendChild(this.createStroke()),e&&null!=a.fillColor?t.appendChild(this.createFill()):!this.pointerEvents||"shape"==t.nodeName&&this.path[this.path.length-1]!=this.closeOp?t.filled="false":t.appendChild(this.createTransparentFill()),this.root.appendChild(t)}},mxVmlCanvas2D.prototype.createTransparentFill=function(){var e=document.createElement(mxClient.VML_PREFIX+":fill");return e.src=mxClient.imageBasePath+"/transparent.gif",e.type="tile",e},mxVmlCanvas2D.prototype.createFill=function(){var e=this.state,n=document.createElement(mxClient.VML_PREFIX+":fill");if(n.color=e.fillColor,null!=e.gradientColor){n.type="gradient",n.method="none",n.color2=e.gradientColor;var t=180-e.rotation;t=e.gradientDirection==mxConstants.DIRECTION_WEST?t-(90+("x"==this.root.style.flip?180:0)):e.gradientDirection==mxConstants.DIRECTION_EAST?t+(90+("x"==this.root.style.flip?180:0)):e.gradientDirection==mxConstants.DIRECTION_NORTH?t-(180+("y"==this.root.style.flip?-180:0)):t+("y"==this.root.style.flip?-180:0);"x"!=this.root.style.flip&&"y"!=this.root.style.flip||(t*=-1),n.angle=mxUtils.mod(t,360),n.opacity=100*e.alpha*e.fillAlpha+"%",n.setAttribute(mxClient.OFFICE_PREFIX+":opacity2",100*e.alpha*e.gradientAlpha+"%")}else e.alpha<1&&(n.opacity=100*e.alpha+"%");return n},mxVmlCanvas2D.prototype.createStroke=function(){var e=this.state,n=document.createElement(mxClient.VML_PREFIX+":stroke");return n.endcap=e.lineCap||"flat",n.joinstyle=e.lineJoin||"miter",n.miterlimit=e.miterLimit||"10",e.alpha<1&&(n.opacity=100*e.alpha+"%"),e.dashed&&(n.dashstyle=this.getVmlDashStyle()),n},mxVmlCanvas2D.prototype.getVmlDashStyle=function(){var e="dash";if(null!=this.state.dashPattern){var n=this.state.dashPattern.split(" ");0<n.length&&1==n[0]&&(e="0 2")}return e},mxVmlCanvas2D.prototype.createShadow=function(e,n,t){var a=this.state,i=-a.rotation*(Math.PI/180),s=Math.cos(i),o=(i=Math.sin(i),a.shadowDx*a.scale),r=a.shadowDy*a.scale;"x"==this.root.style.flip?o*=-1:"y"==this.root.style.flip&&(r*=-1);var l=e.cloneNode(!0);return l.style.marginLeft=Math.round(o*s-r*i)+"px",l.style.marginTop=Math.round(o*i+r*s)+"px",8==document.documentMode&&(l.strokeweight=e.strokeweight,"shape"==e.nodeName&&(l.path=this.path.join(" ")+" e",l.style.width=this.root.style.width,l.style.height=this.root.style.height,l.coordsize=parseInt(e.style.width)+" "+parseInt(e.style.height))),t?(l.strokecolor=a.shadowColor,l.appendChild(this.createShadowStroke())):l.stroked="false",n?l.appendChild(this.createShadowFill()):l.filled="false",l},mxVmlCanvas2D.prototype.createShadowFill=function(){var e=document.createElement(mxClient.VML_PREFIX+":fill");return e.color=this.state.shadowColor,e.opacity=100*this.state.alpha*this.state.shadowAlpha+"%",e},mxVmlCanvas2D.prototype.createShadowStroke=function(){var e=this.createStroke();return e.opacity=100*this.state.alpha*this.state.shadowAlpha+"%",e},mxVmlCanvas2D.prototype.rotate=function(e,n,t,a,i){n&&t?e+=180:n?this.root.style.flip="x":t&&(this.root.style.flip="y"),(n?!t:t)&&(e*=-1),this.root.style.rotation=e,this.state.rotation+=e,this.state.rotationCx=a,this.state.rotationCy=i},mxVmlCanvas2D.prototype.begin=function(){mxAbstractCanvas2D.prototype.begin.apply(this,arguments),this.node=document.createElement(mxClient.VML_PREFIX+":shape"),this.node.style.position="absolute"},mxVmlCanvas2D.prototype.quadTo=function(e,n,t,a){var i=this.state,s=(this.lastX+i.dx)*i.scale,o=(this.lastY+i.dy)*i.scale;e=(e+i.dx)*i.scale;o+=2/3*((n=(n+i.dy)*i.scale)-o);var r=(t=(t+i.dx)*i.scale)+2/3*(e-t);n=(a=(a+i.dy)*i.scale)+2/3*(n-a),this.path.push("c "+this.format(s+2/3*(e-s))+" "+this.format(o)+" "+this.format(r)+" "+this.format(n)+" "+this.format(t)+" "+this.format(a)),this.lastX=t/i.scale-i.dx,this.lastY=a/i.scale-i.dy},mxVmlCanvas2D.prototype.createRect=function(e,n,t,a,i){var s=this.state;return(e=document.createElement(e)).style.position="absolute",e.style.left=this.format((n+s.dx)*s.scale)+"px",e.style.top=this.format((t+s.dy)*s.scale)+"px",e.style.width=this.format(a*s.scale)+"px",e.style.height=this.format(i*s.scale)+"px",e},mxVmlCanvas2D.prototype.rect=function(e,n,t,a){this.node=this.createRect(mxClient.VML_PREFIX+":rect",e,n,t,a)},mxVmlCanvas2D.prototype.roundrect=function(e,n,t,a,i,s){this.node=this.createRect(mxClient.VML_PREFIX+":roundrect",e,n,t,a),this.node.setAttribute("arcsize",Math.max(100*i/t,100*s/a)+"%")},mxVmlCanvas2D.prototype.ellipse=function(e,n,t,a){this.node=this.createRect(mxClient.VML_PREFIX+":oval",e,n,t,a)},mxVmlCanvas2D.prototype.image=function(e,n,t,a,i,s,o,r){var l=null;s?((l=this.createRect(mxClient.VML_PREFIX+":rect",e,n,t,a)).stroked="false",(e=document.createElement(mxClient.VML_PREFIX+":fill")).aspect=s?"atmost":"ignore",e.rotate="true",e.type="frame",e.src=i,l.appendChild(e)):(l=this.createRect(mxClient.VML_PREFIX+":image",e,n,t,a)).src=i,o&&r?l.style.rotation="180":o?l.style.flip="x":r&&(l.style.flip="y"),this.state.alpha<1&&(l.style.filter+="alpha(opacity="+100*this.state.alpha+")"),this.root.appendChild(l)},mxVmlCanvas2D.prototype.createDiv=function(e,n,t,a){t=document.createElement("div");var i=this.state,s="";return null!=i.fontBackgroundColor&&(s+="background-color:"+i.fontBackgroundColor+";"),null!=i.fontBorderColor&&(s+="border:1px solid "+i.fontBorderColor+";"),mxUtils.isNode(e)?t.appendChild(e):0<s.length&&!a?((a=document.createElement("div")).style.cssText=s,a.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",a.style.zoom="1",a.innerHTML=e,t.appendChild(a)):(t.style.cssText=s,t.innerHTML=e),(e=t.style).fontSize=Math.round(i.fontSize/this.vmlScale)+"px",e.fontFamily=i.fontFamily,e.color=i.fontColor,e.verticalAlign="top",e.textAlign=n||"left",e.lineHeight=Math.round(i.fontSize*mxConstants.LINE_HEIGHT/this.vmlScale)+"px",(i.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(e.fontWeight="bold"),(i.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(e.fontStyle="italic"),(i.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(e.fontDecoration="underline"),t},mxVmlCanvas2D.prototype.text=function(e,n,t,a,i,s,o,r,l,d,c,m){if(this.textEnabled&&null!=i){var u=this.state;if("html"==l){null!=u.rotation&&(e=(n=this.rotatePoint(e,n,u.rotation,u.rotationCx,u.rotationCy)).x,n=n.y),8==document.documentMode?(e+=u.dx,n+=u.dy):(e*=u.scale,n*=u.scale),(l=8==document.documentMode?document.createElement(mxClient.VML_PREFIX+":group"):document.createElement("div")).style.position="absolute",l.style.display="inline",l.style.left=this.format(e)+"px",l.style.top=this.format(n)+"px",l.style.zoom=u.scale;var p=document.createElement("div");p.style.position="relative",p.style.display="inline";var g=(v=mxUtils.getAlignmentAsPoint(s,o)).x,v=v.y;if(i=this.createDiv(i,s,o,d),s=document.createElement("div"),r?(!c&&0<t&&(i.style.width=Math.round(t)+"px"),i.style.whiteSpace="normal"):i.style.whiteSpace="nowrap",r=u.rotation+(m||0),this.rotateHtml&&0!=r?(s.style.display="inline",s.style.zoom="1",s.appendChild(i),8==document.documentMode&&"DIV"!=this.root.nodeName?(p.appendChild(s),l.appendChild(p)):l.appendChild(s)):8==document.documentMode?(p.appendChild(i),l.appendChild(p)):(i.style.display="inline",l.appendChild(i)),"DIV"!=this.root.nodeName?((m=document.createElement(mxClient.VML_PREFIX+":rect")).stroked="false",m.filled="false",m.appendChild(l),this.root.appendChild(m)):this.root.appendChild(l),c?(i.style.overflow="hidden",0<t&&(i.style.width=Math.round(t)+"px"),0<a&&8==document.documentMode&&(i.style.maxHeight=Math.round(a)+"px")):d&&(i.style.width=t+"px",0<a&&(i.style.maxHeight=Math.round(a)+"px")),this.rotateHtml&&0!=r){t=r*(Math.PI/180),r=parseFloat(parseFloat(Math.cos(t)).toFixed(8)),m=parseFloat(parseFloat(Math.sin(-t)).toFixed(8)),(t%=2*Math.PI)<0&&(t+=2*Math.PI),(t%=Math.PI)>Math.PI/2&&(t=Math.PI-t),o=Math.cos(t);var h=Math.sin(t);8==document.documentMode&&(i.style.display="inline-block",s.style.display="inline-block",p.style.display="inline-block"),i.style.visibility="hidden",document.body.appendChild(i),t=i.offsetWidth,p=i.offsetHeight,mxClient.IS_QUIRKS&&(c||d)&&a<p&&(p=a,i.style.height=p+"px"),c=((a=p)-a*o+t*-h)/2-m*t*(g+.5)+r*a*(v+.5),d=(t-t*o+a*-h)/2+r*t*(g+.5)+m*a*(v+.5),"group"==l.nodeName&&"DIV"==this.root.nodeName?((g=document.createElement("div")).style.display="inline-block",g.style.position="absolute",g.style.left=this.format(e+(d-t/2)*u.scale)+"px",g.style.top=this.format(n+(c-a/2)*u.scale)+"px",l.parentNode.appendChild(g),g.appendChild(l)):(u=8==document.documentMode?1:u.scale,l.style.left=this.format(e+(d-t/2)*u)+"px",l.style.top=this.format(n+(c-a/2)*u)+"px"),s.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11="+r+", M12="+m+", M21="+-m+", M22="+r+", sizingMethod='auto expand')",s.style.backgroundColor=this.rotatedHtmlBackground,this.state.alpha<1&&(s.style.filter+="alpha(opacity="+100*this.state.alpha+")"),i.style.visibility="",s.appendChild(i)}else 8!=document.documentMode?(i.style.verticalAlign="top",this.state.alpha<1&&(l.style.filter="alpha(opacity="+100*this.state.alpha+")"),u=i.parentNode,i.style.visibility="hidden",document.body.appendChild(i),t=i.offsetWidth,p=i.offsetHeight,mxClient.IS_QUIRKS&&c&&a<p&&(p=a,i.style.height=p+"px"),a=p,i.style.visibility="",u.appendChild(i),l.style.left=this.format(e+t*g*this.state.scale)+"px",l.style.top=this.format(n+a*v*this.state.scale)+"px"):(this.state.alpha<1&&(i.style.filter="alpha(opacity="+100*this.state.alpha+")"),p.style.left=100*g+"%",p.style.top=100*v+"%")}else this.plainText(e,n,t,a,mxUtils.htmlEntities(i,!1),s,o,r,l,d,c,m)}},mxVmlCanvas2D.prototype.plainText=function(e,n,t,a,i,s,o,r,l,d,c,m){e=(e+(a=this.state).dx)*a.scale,n=(n+a.dy)*a.scale,(t=document.createElement(mxClient.VML_PREFIX+":shape")).style.width="1px",t.style.height="1px",t.stroked="false",(d=document.createElement(mxClient.VML_PREFIX+":fill")).color=a.fontColor,d.opacity=100*a.alpha+"%",t.appendChild(d),(d=document.createElement(mxClient.VML_PREFIX+":path")).textpathok="true",d.v="m "+this.format(0)+" "+this.format(0)+" l "+this.format(1)+" "+this.format(0),t.appendChild(d),(d=document.createElement(mxClient.VML_PREFIX+":textpath")).style.cssText="v-text-align:"+s,d.style.align=s,d.style.fontFamily=a.fontFamily,d.string=i,d.on="true",s=Math.round(a.fontSize*a.scale/this.vmlScale),d.style.fontSize=s+"px",(a.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(d.style.fontWeight="bold"),(a.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(d.style.fontStyle="italic"),(a.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(d.style.textDecoration="underline"),a=s+((i=i.split("\n")).length-1)*s*mxConstants.LINE_HEIGHT,s=i=0,o==mxConstants.ALIGN_BOTTOM?s=-a/2:o!=mxConstants.ALIGN_MIDDLE&&(s=a/2),null!=m&&(o=(t.style.rotation=m)*(Math.PI/180),i=Math.sin(o)*s,s*=Math.cos(o)),t.appendChild(d),t.style.left=this.format(e-i)+"px",t.style.top=this.format(n+s)+"px",this.root.appendChild(t)},mxVmlCanvas2D.prototype.stroke=function(){this.addNode(!1,!0)},mxVmlCanvas2D.prototype.fill=function(){this.addNode(!0,!1)},mxVmlCanvas2D.prototype.fillAndStroke=function(){this.addNode(!0,!0)},mxGuide.prototype.graph=null,mxGuide.prototype.states=null,mxGuide.prototype.horizontal=!0,mxGuide.prototype.vertical=!0,mxGuide.prototype.guideX=null,mxGuide.prototype.guideY=null,mxGuide.prototype.setStates=function(e){this.states=e},mxGuide.prototype.isEnabledForEvent=function(e){return!0},mxGuide.prototype.getGuideTolerance=function(){return this.graph.gridSize*this.graph.view.scale/2},mxGuide.prototype.createGuideShape=function(e){return(e=new mxPolyline([],mxConstants.GUIDE_COLOR,mxConstants.GUIDE_STROKEWIDTH)).isDashed=!0,e},mxGuide.prototype.move=function(a,e,n){if(null!=this.states&&(this.horizontal||this.vertical)&&null!=a&&null!=e){var t=this.graph.getView().translate,i=this.graph.getView().scale,s=e.x,o=e.y,r=!1,l=!1,d=f=this.getGuideTolerance(),c=f;(f=a.clone()).x+=e.x,f.y+=e.y;var m=f.x,u=f.x+f.width,p=f.getCenterX(),g=f.y,v=f.y+f.height,h=f.getCenterY();e=function(e){e+=this.graph.panDx;var n=!1;if(Math.abs(e-p)<d?(s=e-a.getCenterX(),d=Math.abs(e-p),n=!0):Math.abs(e-m)<d?(s=e-a.x,d=Math.abs(e-m),n=!0):Math.abs(e-u)<d&&(s=e-a.x-a.width,d=Math.abs(e-u),n=!0),n){null==this.guideX&&(this.guideX=this.createGuideShape(!0),this.guideX.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.guideX.pointerEvents=!1,this.guideX.init(this.graph.getView().getOverlayPane()));var t=this.graph.container;e-=this.graph.panDx,this.guideX.points=[new mxPoint(e,-this.graph.panDy),new mxPoint(e,t.scrollHeight-3-this.graph.panDy)]}r=r||n};for(var f=function(e){e+=this.graph.panDy;var n=!1;if(Math.abs(e-h)<c?(o=e-a.getCenterY(),c=Math.abs(e-h),n=!0):Math.abs(e-g)<c?(o=e-a.y,c=Math.abs(e-g),n=!0):Math.abs(e-v)<c&&(o=e-a.y-a.height,c=Math.abs(e-v),n=!0),n){null==this.guideY&&(this.guideY=this.createGuideShape(!1),this.guideY.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.guideY.pointerEvents=!1,this.guideY.init(this.graph.getView().getOverlayPane()));var t=this.graph.container;e-=this.graph.panDy,this.guideY.points=[new mxPoint(-this.graph.panDx,e),new mxPoint(t.scrollWidth-3-this.graph.panDx,e)]}l=l||n},b=0;b<this.states.length;b++){var A=this.states[b];null!=A&&(this.horizontal&&(e.call(this,A.getCenterX()),e.call(this,A.x),e.call(this,A.x+A.width)),this.vertical&&(f.call(this,A.getCenterY()),f.call(this,A.y),f.call(this,A.y+A.height)))}r||null==this.guideX?null!=this.guideX&&(this.guideX.node.style.visibility="visible",this.guideX.redraw()):this.guideX.node.style.visibility="hidden",l||null==this.guideY?null!=this.guideY&&(this.guideY.node.style.visibility="visible",this.guideY.redraw()):this.guideY.node.style.visibility="hidden",n&&(r||(n=a.x-(this.graph.snap(a.x/i-t.x)+t.x)*i,s=this.graph.snap(s/i)*i-n),l||(t=a.y-(this.graph.snap(a.y/i-t.y)+t.y)*i,o=this.graph.snap(o/i)*i-t)),e=new mxPoint(s,o)}return e},mxGuide.prototype.hide=function(){null!=this.guideX&&(this.guideX.node.style.visibility="hidden"),null!=this.guideY&&(this.guideY.node.style.visibility="hidden")},mxGuide.prototype.destroy=function(){null!=this.guideX&&(this.guideX.destroy(),this.guideX=null),null!=this.guideY&&(this.guideY.destroy(),this.guideY=null)},mxStencil.defaultLocalized=!1,mxStencil.prototype.desc=null,mxStencil.prototype.constraints=null,mxStencil.prototype.aspect=null,mxStencil.prototype.w0=null,mxStencil.prototype.h0=null,mxStencil.prototype.bgNode=null,mxStencil.prototype.fgNode=null,mxStencil.prototype.strokewidth=null,mxStencil.prototype.parseDescription=function(){this.fgNode=this.desc.getElementsByTagName("foreground")[0],this.bgNode=this.desc.getElementsByTagName("background")[0],this.w0=Number(this.desc.getAttribute("w")||100),this.h0=Number(this.desc.getAttribute("h")||100);var e=this.desc.getAttribute("aspect");this.aspect=null!=e?e:"variable",e=this.desc.getAttribute("strokewidth"),this.strokewidth=null!=e?e:"1"},mxStencil.prototype.parseConstraints=function(){var e=this.desc.getElementsByTagName("connections")[0];if(null!=e&&(null!=(e=mxUtils.getChildNodes(e))&&0<e.length)){this.constraints=[];for(var n=0;n<e.length;n++)this.constraints.push(this.parseConstraint(e[n]))}},mxStencil.prototype.parseConstraint=function(e){var n=Number(e.getAttribute("x")),t=Number(e.getAttribute("y"));return e="1"==e.getAttribute("perimeter"),new mxConnectionConstraint(new mxPoint(n,t),e)},mxStencil.prototype.evaluateTextAttribute=function(e,n,t){return n=this.evaluateAttribute(e,n,t),e=e.getAttribute("localized"),(mxStencil.defaultLocalized&&null==e||"1"==e)&&(n=mxResources.get(n)),n},mxStencil.prototype.evaluateAttribute=function(e,n,t){return null==(n=e.getAttribute(n))&&(null!=(e=mxUtils.getTextContent(e))&&("function"==typeof(e=mxUtils.eval(e))&&(n=e(t)))),n},mxStencil.prototype.drawShape=function(e,n,t,a,i,s){this.drawChildren(e,n,t,a,i,s,this.bgNode,!1),this.drawChildren(e,n,t,a,i,s,this.fgNode,!0)},mxStencil.prototype.drawChildren=function(e,n,t,a,i,s,o,r){if(null!=o){var l=mxUtils.getValue(n.style,mxConstants.STYLE_DIRECTION,null);for(t=this.computeAspect(n.style,t,a,i,s,l),a=Math.min(t.width,t.height),a="inherit"==this.strokewidth?Number(mxUtils.getNumber(n.style,mxConstants.STYLE_STROKEWIDTH,1)):Number(this.strokewidth)*a,e.setStrokeWidth(a),o=o.firstChild;null!=o;)o.nodeType==mxConstants.NODETYPE_ELEMENT&&this.drawNode(e,n,o,t,r),o=o.nextSibling}},mxStencil.prototype.computeAspect=function(e,n,t,a,i,s){e=n,n=a/this.w0;var o=i/this.h0;if(s="north"==s||"south"==s){o=a/this.h0,n=i/this.w0;var r=(a-i)/2;e+=r,t-=r}return"fixed"==this.aspect&&(n=o=Math.min(n,o),s?(e+=(i-this.w0*n)/2,t+=(a-this.h0*o)/2):(e+=(a-this.w0*n)/2,t+=(i-this.h0*o)/2)),new mxRectangle(e,t,n,o)},mxStencil.prototype.drawNode=function(e,n,t,a,i){var s=t.nodeName,o=a.x,r=a.y,l=a.width,d=a.height,c=Math.min(l,d);if("save"==s)e.save();else if("restore"==s)e.restore();else if("path"==s)for(e.begin(),t=t.firstChild;null!=t;)t.nodeType==mxConstants.NODETYPE_ELEMENT&&this.drawNode(e,n,t,a,i),t=t.nextSibling;else if("close"==s)e.close();else if("move"==s)e.moveTo(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d);else if("line"==s)e.lineTo(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d);else if("quad"==s)e.quadTo(o+Number(t.getAttribute("x1"))*l,r+Number(t.getAttribute("y1"))*d,o+Number(t.getAttribute("x2"))*l,r+Number(t.getAttribute("y2"))*d);else if("curve"==s)e.curveTo(o+Number(t.getAttribute("x1"))*l,r+Number(t.getAttribute("y1"))*d,o+Number(t.getAttribute("x2"))*l,r+Number(t.getAttribute("y2"))*d,o+Number(t.getAttribute("x3"))*l,r+Number(t.getAttribute("y3"))*d);else if("arc"==s)e.arcTo(Number(t.getAttribute("rx"))*l,Number(t.getAttribute("ry"))*d,Number(t.getAttribute("x-axis-rotation")),Number(t.getAttribute("large-arc-flag")),Number(t.getAttribute("sweep-flag")),o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d);else if("rect"==s)e.rect(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,Number(t.getAttribute("w"))*l,Number(t.getAttribute("h"))*d);else if("roundrect"==s)0==(n=t.getAttribute("arcsize"))&&(n=100*mxConstants.RECTANGLE_ROUNDING_FACTOR),c=Number(t.getAttribute("w"))*l,a=Number(t.getAttribute("h"))*d,n=Number(n)/100,n=Math.min(c*n,a*n),e.roundrect(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,c,a,n,n);else if("ellipse"==s)e.ellipse(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,Number(t.getAttribute("w"))*l,Number(t.getAttribute("h"))*d);else if("image"==s)n=this.evaluateAttribute(t,"src",n),e.image(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,Number(t.getAttribute("w"))*l,Number(t.getAttribute("h"))*d,n,!1,"1"==t.getAttribute("flipH"),"1"==t.getAttribute("flipV"));else if("text"==s){if(c=this.evaluateTextAttribute(t,"str",n),a="1"==t.getAttribute("vertical")?-90:0,"0"==t.getAttribute("align-shape")){var m=n.rotation,u=1==mxUtils.getValue(n.style,mxConstants.STYLE_FLIPH,0);n=1==mxUtils.getValue(n.style,mxConstants.STYLE_FLIPV,0),a=u&&n?a-m:u||n?a+m:a-m}a-=t.getAttribute("rotation"),e.text(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,0,0,c,t.getAttribute("align")||"left",t.getAttribute("valign")||"top",!1,"",!1,!1,a)}else if("include-shape"==s)null!=(m=mxStencilRegistry.getStencil(t.getAttribute("name")))&&(o+=Number(t.getAttribute("x"))*l,r+=Number(t.getAttribute("y"))*d,c=Number(t.getAttribute("w"))*l,a=Number(t.getAttribute("h"))*d,m.drawShape(e,n,o,r,c,a));else if("fillstroke"==s)e.fillAndStroke();else if("fill"==s)e.fill();else if("stroke"==s)e.stroke();else if("strokewidth"==s)e.setStrokeWidth(Number(t.getAttribute("width"))*c);else if("dashed"==s)e.setDashed("1"==t.getAttribute("dashed"));else if("dashpattern"==s){if(null!=(t=t.getAttribute("pattern"))){for(t=t.split(" "),l=[],d=0;d<t.length;d++)0<t[d].length&&l.push(Number(t[d])*c);t=l.join(" "),e.setDashPattern(t)}}else"strokecolor"==s?e.setStrokeColor(t.getAttribute("color")):"linecap"==s?e.setLineCap(t.getAttribute("cap")):"linejoin"==s?e.setLineJoin(t.getAttribute("join")):"miterlimit"==s?e.setMiterLimit(Number(t.getAttribute("limit"))):"fillcolor"==s?e.setFillColor(t.getAttribute("color")):"alpha"==s?e.setAlpha(t.getAttribute("alpha")):"fontcolor"==s?e.setFontColor(t.getAttribute("color")):"fontstyle"==s?e.setFontStyle(t.getAttribute("style")):"fontfamily"==s?e.setFontFamily(t.getAttribute("family")):"fontsize"==s&&e.setFontSize(Number(t.getAttribute("size"))*c);i&&("fillstroke"==s||"fill"==s||"stroke"==s)&&e.setShadow(!1)},mxShape.prototype.dialect=null,mxShape.prototype.scale=1,mxShape.prototype.bounds=null,mxShape.prototype.points=null,mxShape.prototype.node=null,mxShape.prototype.style=null,mxShape.prototype.style=null,mxShape.prototype.boundingBox=null,mxShape.prototype.stencil=null,mxShape.prototype.svgStrokeTolerance=6,mxShape.prototype.pointerEvents=!0,mxShape.prototype.stencilPointerEvents=!1,mxShape.prototype.vmlScale=1,mxShape.prototype.init=function(e){null==this.node&&(this.node=this.create(e),null!=e&&e.appendChild(this.node))},mxShape.prototype.isParseVml=function(){return!0},mxShape.prototype.isHtmlAllowed=function(){return!1},mxShape.prototype.getSvgScreenOffset=function(){return 1==mxUtils.mod(Math.max(1,Math.round(this.strokewidth*this.scale)),2)?.5:0},mxShape.prototype.create=function(e){return null!=e.ownerSVGElement?this.createSvg(e):8==document.documentMode||this.dialect==mxConstants.DIALECT_SVG||this.dialect!=mxConstants.DIALECT_VML&&this.isHtmlAllowed()?this.createHtml(e):this.createVml(e)},mxShape.prototype.createSvg=function(){return document.createElementNS(mxConstants.NS_SVG,"g")},mxShape.prototype.createVml=function(){var e=document.createElement(mxClient.VML_PREFIX+":group");return e.style.position="absolute",e},mxShape.prototype.createHtml=function(){var e=document.createElement("div");return e.style.position="absolute",e},mxShape.prototype.reconfigure=function(){this.redraw()},mxShape.prototype.redraw=function(){this.updateBoundsFromPoints(),this.checkBounds()?(this.node.style.visibility="","DIV"==this.node.nodeName&&this.isHtmlAllowed()?this.redrawHtmlShape():this.redrawShape(),this.updateBoundingBox()):(this.node.style.visibility="hidden",this.boundingBox=null)},mxShape.prototype.updateBoundsFromPoints=function(){var e=this.points;if(null!=e&&0<e.length&&null!=e[0]){this.bounds=new mxRectangle(Number(e[0].x),Number(e[0].y),1,1);for(var n=1;n<this.points.length;n++)null!=e[n]&&this.bounds.add(new mxRectangle(Number(e[n].x),Number(e[n].y),1,1))}},mxShape.prototype.checkBounds=function(){return null!=this.bounds&&!isNaN(this.bounds.x)&&!isNaN(this.bounds.y)&&!isNaN(this.bounds.width)&&!isNaN(this.bounds.height)&&0<this.bounds.width&&0<this.bounds.height},mxShape.prototype.createVmlGroup=function(){var e=document.createElement(mxClient.VML_PREFIX+":group");return e.style.position="absolute",e.style.width=this.node.style.width,e.style.height=this.node.style.height,e},mxShape.prototype.redrawShape=function(){var e=this.createCanvas();for(e.pointerEvents=this.pointerEvents;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);this.paint(e),this.node!=e.root&&this.node.insertAdjacentHTML("beforeend",e.root.outerHTML),"DIV"==this.node.nodeName&&8==document.documentMode&&(this.node.style.filter="",(null==this.stencil||!this.stencilPointerEvents)&&mxUtils.addTransparentBackgroundFilter(this.node)),this.destroyCanvas(e)},mxShape.prototype.createCanvas=function(){var e=null,n=null;if(null!=this.node.ownerSVGElement)(e=new mxSvgCanvas2D(this.node,!1)).strokeTolerance=this.svgStrokeTolerance,e.blockImagePointerEvents=mxClient.IS_NS&&!mxClient.IS_SF&&!mxClient.IS_GC,0!=(n=this.getSvgScreenOffset())?this.node.setAttribute("transform","translate("+n+","+n+")"):this.node.removeAttribute("transform");else{this.updateVmlContainer();var t=Math.max(1,Math.round(this.bounds.width)),a=Math.max(1,Math.round(this.bounds.height));n=8==document.documentMode&&this.isParseVml()?this.createVmlGroup():this.node,e=new mxVmlCanvas2D(n,!1);""!=n.tagUrn&&(n.coordsize=t*this.vmlScale+","+a*this.vmlScale,e.scale(this.vmlScale),e.vmlScale=this.vmlScale),n=this.scale,e.translate(-Math.round(this.bounds.x/n),-Math.round(this.bounds.y/n))}return e},mxShape.prototype.updateVmlContainer=function(){this.node.style.left=Math.round(this.bounds.x)+"px",this.node.style.top=Math.round(this.bounds.y)+"px";var e=Math.max(1,Math.round(this.bounds.width)),n=Math.max(1,Math.round(this.bounds.height));this.node.style.width=e+"px",this.node.style.height=n+"px",this.node.style.overflow="visible"},mxShape.prototype.destroyCanvas=function(e){if(e instanceof mxSvgCanvas2D){for(var n in e.gradients){var t=e.gradients[n];t.mxRefCount=(t.mxRefCount||0)+1}this.releaseSvgGradients(this.oldGradients),this.oldGradients=e.gradients}},mxShape.prototype.paint=function(e){var n=this.scale,t=this.bounds.x/n,a=this.bounds.y/n,i=this.bounds.width/n,s=this.bounds.height/n;if(this.isPaintBoundsInverted()){t=t+(o=(i-s)/2),a=a-o;var o=i;i=s,s=o}if(this.updateTransform(e,t,a,i,s),this.configureCanvas(e,t,a,i,s),null!=this.stencil)this.paintStencilShape(e,t,a,i,s);else if(e.setStrokeWidth(this.strokewidth),null!=this.points){for(t=[],a=0;a<this.points.length;a++)t.push(new mxPoint(this.points[a].x/n,this.points[a].y/n));this.paintEdgeShape(e,t)}else this.paintVertexShape(e,t,a,i,s)},mxShape.prototype.configureCanvas=function(e,n,t,a,i){var s=null;null!=this.style&&(s=this.style.dashPattern),e.setAlpha(this.opacity/100),null!=this.isShadow&&e.setShadow(this.isShadow),null!=this.isDashed&&e.setDashed(this.isDashed),null!=s&&e.setDashPattern(s),null!=this.gradient?(n=this.getGradientBounds(e,n,t,a,i),e.setGradient(this.fill,this.gradient,n.x,n.y,n.width,n.height,this.gradientDirection)):e.setFillColor(this.fill),e.setStrokeColor(this.stroke)},mxShape.prototype.getGradientBounds=function(e,n,t,a,i){return new mxRectangle(n,t,a,i)},mxShape.prototype.updateTransform=function(e,n,t,a,i){e.scale(this.scale),e.rotate(this.getShapeRotation(),this.flipH,this.flipV,n+a/2,t+i/2)},mxShape.prototype.paintStencilShape=function(e,n,t,a,i){this.stencilPointerEvents&&(this.dialect==mxConstants.DIALECT_SVG?this.addTransparentBackgroundRectangle(this.node,n,t,a,i):8!=document.documentMode&&this.setTransparentBackgroundImage(this.node)),this.stencil.drawShape(e,this,n,t,a,i)},mxShape.prototype.paintVertexShape=function(e,n,t,a,i){this.paintBackground(e,n,t,a,i),e.setShadow(!1),this.paintForeground(e,n,t,a,i)},mxShape.prototype.paintBackground=function(e,n,t,a,i){},mxShape.prototype.paintForeground=function(e,n,t,a,i){},mxShape.prototype.paintEdgeShape=function(e,n){},mxShape.prototype.getArcSize=function(e,n){var t=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100;return Math.min(e*t,n*t)},mxShape.prototype.paintGlassEffect=function(e,n,t,a,i,s){var o=Math.ceil(this.strokewidth/2);e.setGradient("#ffffff","#ffffff",n,t,a,.6*i,"south",.9,.1),e.begin(),s+=2*o,this.isRounded?(e.moveTo(n-o+s,t-o),e.quadTo(n-o,t-o,n-o,t-o+s),e.lineTo(n-o,t+.4*i),e.quadTo(n+.5*a,t+.7*i,n+a+o,t+.4*i),e.lineTo(n+a+o,t-o+s),e.quadTo(n+a+o,t-o,n+a+o-s,t-o)):(e.moveTo(n-o,t-o),e.lineTo(n-o,t+.4*i),e.quadTo(n+.5*a,t+.7*i,n+a+o,t+.4*i),e.lineTo(n+a+o,t-o)),e.close(),e.fill()},mxShape.prototype.apply=function(e){this.state=e,this.style=e.style,null!=this.style&&(this.fill=mxUtils.getValue(this.style,mxConstants.STYLE_FILLCOLOR,this.fill),this.gradient=mxUtils.getValue(this.style,mxConstants.STYLE_GRADIENTCOLOR,this.gradient),this.gradientDirection=mxUtils.getValue(this.style,mxConstants.STYLE_GRADIENT_DIRECTION,this.gradientDirection),this.opacity=mxUtils.getValue(this.style,mxConstants.STYLE_OPACITY,this.opacity),this.stroke=mxUtils.getValue(this.style,mxConstants.STYLE_STROKECOLOR,this.stroke),this.strokewidth=mxUtils.getNumber(this.style,mxConstants.STYLE_STROKEWIDTH,this.strokewidth),this.spacing=mxUtils.getValue(this.style,mxConstants.STYLE_SPACING,this.spacing),this.startSize=mxUtils.getNumber(this.style,mxConstants.STYLE_STARTSIZE,this.startSize),this.endSize=mxUtils.getNumber(this.style,mxConstants.STYLE_ENDSIZE,this.endSize),this.startArrow=mxUtils.getValue(this.style,mxConstants.STYLE_STARTARROW,this.startArrow),this.endArrow=mxUtils.getValue(this.style,mxConstants.STYLE_ENDARROW,this.endArrow),this.rotation=mxUtils.getValue(this.style,mxConstants.STYLE_ROTATION,this.rotation),this.direction=mxUtils.getValue(this.style,mxConstants.STYLE_DIRECTION,this.direction),this.flipH=1==mxUtils.getValue(this.style,mxConstants.STYLE_FLIPH,0),this.flipV=1==mxUtils.getValue(this.style,mxConstants.STYLE_FLIPV,0),null!=this.stencil&&(this.flipH=1==mxUtils.getValue(this.style,"stencilFlipH",0)||this.flipH,this.flipV=1==mxUtils.getValue(this.style,"stencilFlipV",0)||this.flipV),"north"!=this.direction&&"south"!=this.direction||(e=this.flipH,this.flipH=this.flipV,this.flipV=e),this.isShadow=1==mxUtils.getValue(this.style,mxConstants.STYLE_SHADOW,this.isShadow),this.isDashed=1==mxUtils.getValue(this.style,mxConstants.STYLE_DASHED,this.isDashed),this.isRounded=1==mxUtils.getValue(this.style,mxConstants.STYLE_ROUNDED,this.isRounded),this.glass=1==mxUtils.getValue(this.style,mxConstants.STYLE_GLASS,this.glass),"none"==this.fill&&(this.fill=null),"none"==this.gradient&&(this.gradient=null),"none"==this.stroke&&(this.stroke=null))},mxShape.prototype.setCursor=function(e){null==e&&(e=""),this.cursor=e,null!=this.node&&(this.node.style.cursor=e)},mxShape.prototype.getCursor=function(){return this.cursor},mxShape.prototype.updateBoundingBox=function(){if(null!=this.bounds){var e=this.createBoundingBox();if(null!=e){this.augmentBoundingBox(e);var n=this.getShapeRotation();0!=n&&(e=mxUtils.getBoundingBox(e,n)),e.x=Math.floor(e.x),e.y=Math.floor(e.y),e.width=Math.ceil(e.width),e.height=Math.ceil(e.height)}this.boundingBox=e}},mxShape.prototype.createBoundingBox=function(){var e=this.bounds.clone();if(this.isPaintBoundsInverted()){var n=(e.width-e.height)/2;e.x+=n,e.y-=n,n=e.width,e.width=e.height,e.height=n}return e},mxShape.prototype.augmentBoundingBox=function(e){this.isShadow&&(e.width+=Math.ceil(mxConstants.SHADOW_OFFSET_X*this.scale),e.height+=Math.ceil(mxConstants.SHADOW_OFFSET_Y*this.scale));var n=Math.ceil(this.strokewidth*this.scale);e.grow(Math.ceil(n/2))},mxShape.prototype.isPaintBoundsInverted=function(){return null==this.stencil&&("north"==this.direction||"south"==this.direction)},mxShape.prototype.getRotation=function(){return null!=this.rotation?this.rotation:0},mxShape.prototype.getTextRotation=function(){var e=this.getRotation();return 1!=mxUtils.getValue(this.style,mxConstants.STYLE_HORIZONTAL,1)&&(e+=mxText.prototype.verticalTextRotation),e},mxShape.prototype.getShapeRotation=function(){var e=this.getRotation();return null!=this.direction&&("north"==this.direction?e+=270:"west"==this.direction?e+=180:"south"==this.direction&&(e+=90)),e},mxShape.prototype.addTransparentBackgroundRectangle=function(e,n,t,a,i){(e=document.createElementNS(mxConstants.NS_SVG,"rect")).setAttribute("x",n),e.setAttribute("y",t),e.setAttribute("width",a),e.setAttribute("height",i),e.setAttribute("fill","none"),e.setAttribute("stroke","none"),e.setAttribute("pointer-events","all"),this.node.appendChild(e)},mxShape.prototype.setTransparentBackgroundImage=function(e){e.style.backgroundImage="url('"+mxClient.imageBasePath+"/transparent.gif')"},mxShape.prototype.releaseSvgGradients=function(e){if(null!=e)for(var n in e){var t=e[n];t.mxRefCount=(t.mxRefCount||0)-1,0==t.mxRefCount&&null!=t.parentNode&&t.parentNode.removeChild(t)}},mxShape.prototype.destroy=function(){null!=this.node&&(mxEvent.release(this.node),null!=this.node.parentNode&&this.node.parentNode.removeChild(this.node),this.node=null),this.releaseSvgGradients(this.oldGradients),this.oldGradients=null};var mxStencilRegistry={stencils:[],addStencil:function(e,n){mxStencilRegistry.stencils[e]=n},getStencil:function(e){return mxStencilRegistry.stencils[e]}},mxMarker={markers:[],addMarker:function(e,n){mxMarker.markers[e]=n},createMarker:function(e,n,t,a,i,s,o,r,l,d){var c=mxMarker.markers[t];return null!=c?c(e,n,t,a,i,s,o,r,l,d):null}};function mxActor(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxCloud(e,n,t,a){mxActor.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxRectangleShape(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxEllipse(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxDoubleEllipse(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxRhombus(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxPolyline(e,n,t){mxShape.call(this),this.points=e,this.stroke=n,this.strokewidth=null!=t?t:1}function mxArrow(e,n,t,a,i,s,o){mxShape.call(this),this.points=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1,this.arrowWidth=null!=i?i:mxConstants.ARROW_WIDTH,this.spacing=null!=s?s:mxConstants.ARROW_SPACING,this.endSize=null!=o?o:mxConstants.ARROW_SIZE}function mxText(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f,b,A){mxShape.call(this),this.value=e,this.bounds=n,this.color=null!=i?i:"black",this.align=null!=t?t:"",this.valign=null!=a?a:"",this.family=null!=s?s:mxConstants.DEFAULT_FONTFAMILY,this.size=null!=o?o:mxConstants.DEFAULT_FONTSIZE,this.fontStyle=null!=r?r:mxConstants.DEFAULT_FONTSTYLE,this.spacing=parseInt(l||2),this.spacingTop=this.spacing+parseInt(d||0),this.spacingRight=this.spacing+parseInt(c||0),this.spacingBottom=this.spacing+parseInt(m||0),this.spacingLeft=this.spacing+parseInt(u||0),this.horizontal=null==p||p,this.background=g,this.border=v,this.wrap=null!=h&&h,this.clipped=null!=f&&f,this.overflow=null!=b?b:"visible",this.labelPadding=null!=A?A:0,this.rotation=0}function mxTriangle(){mxActor.call(this)}function mxHexagon(){mxActor.call(this)}function mxLine(e,n,t){mxShape.call(this),this.bounds=e,this.stroke=n,this.strokewidth=null!=t?t:1}function mxImageShape(e,n,t,a,i){mxShape.call(this),this.bounds=e,this.image=n,this.fill=t,this.stroke=a,this.strokewidth=null!=i?i:1,this.shadow=!1}function mxLabel(e,n,t,a){mxRectangleShape.call(this,e,n,t,a)}function mxCylinder(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxConnector(e,n,t){mxPolyline.call(this,e,n,t)}function mxSwimlane(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxGraphLayout(e){this.graph=e}function mxStackLayout(e,n,t,a,i,s){mxGraphLayout.call(this,e),this.horizontal=null==n||n,this.spacing=null!=t?t:0,this.x0=null!=a?a:0,this.y0=null!=i?i:0,this.border=null!=s?s:0}function mxPartitionLayout(e,n,t,a){mxGraphLayout.call(this,e),this.horizontal=null==n||n,this.spacing=t||0,this.border=a||0}function mxCompactTreeLayout(e,n,t){mxGraphLayout.call(this,e),this.horizontal=null==n||n,this.invert=null!=t&&t}function WeightedCellSorter(e,n){this.cell=e,this.weightedValue=n}function mxFastOrganicLayout(e){mxGraphLayout.call(this,e)}function mxCircleLayout(e,n){mxGraphLayout.call(this,e),this.radius=null!=n?n:100}function mxParallelEdgeLayout(e){mxGraphLayout.call(this,e)}function mxCompositeLayout(e,n,t){mxGraphLayout.call(this,e),this.layouts=n,this.master=t}function mxEdgeLabelLayout(e,n){mxGraphLayout.call(this,e)}function mxGraphAbstractHierarchyCell(){this.x=[],this.y=[],this.temp=[]}function mxGraphHierarchyNode(e){mxGraphAbstractHierarchyCell.apply(this,arguments),this.cell=e}function mxGraphHierarchyEdge(e){mxGraphAbstractHierarchyCell.apply(this,arguments),this.edges=e}function mxGraphHierarchyModel(e,n,t,a,i){for(e.getGraph(),this.tightenToSource=i,this.roots=t,this.parent=a,this.vertexMapper={},this.edgeMapper={},this.maxRank=0,t=[],null==n&&(n=this.graph.getChildVertices(a)),this.maxRank=this.SOURCESCANSTARTRANK,this.createInternalCells(e,n,t),a=0;a<n.length;a++){i=t[a].connectsAsSource;for(var s=0;s<i.length;s++){var o=i[s];if(null!=(r=o.edges)&&0<r.length){var r=r[0],l=e.getVisibleTerminal(r,!1);l=mxCellPath.create(l),l=this.vertexMapper[l];t[a]==l&&(l=e.getVisibleTerminal(r,!0),l=mxCellPath.create(l),l=this.vertexMapper[l]),null!=l&&t[a]!=l&&(0==(o.target=l).connectsAsTarget.length&&(l.connectsAsTarget=[]),mxUtils.indexOf(l.connectsAsTarget,o)<0&&l.connectsAsTarget.push(o))}}t[a].temp[0]=1}}function mxHierarchicalLayoutStage(){}function mxMedianHybridCrossingReduction(e){this.layout=e}function MedianCellSorter(){}function mxMinimumCycleRemover(e){this.layout=e}function mxCoordinateAssignment(e,n,t,a,i,s){this.layout=e,this.intraCellSpacing=n,this.interRankCellSpacing=t,this.orientation=a,this.initialX=i,this.parallelEdgeSpacing=s}!function(){function e(e,n,t,a,i,s,o,r,l,d){n=1.118*i*l,r=1.118*s*l,i*=o+l,s*=o+l;var c=a.clone();return c.x-=n,c.y-=r,o=t!=mxConstants.ARROW_CLASSIC?1:.75,a.x+=-i*o-n,a.y+=-s*o-r,function(){e.begin(),e.moveTo(c.x,c.y),e.lineTo(c.x-i-s/2,c.y-s+i/2),t==mxConstants.ARROW_CLASSIC&&e.lineTo(c.x-3*i/4,c.y-3*s/4),e.lineTo(c.x+s/2-i,c.y-s-i/2),e.close(),d?e.fillAndStroke():e.stroke()}}function n(e,n,t,a,i,s,o,r,l,d){r=t==mxConstants.ARROW_DIAMOND?.7071:.9862,n=i*l*r,r*=s*l,i*=o+l,s*=o+l;var c=a.clone();c.x-=n,c.y-=r,a.x+=-i-n,a.y+=-s-r;var m=t==mxConstants.ARROW_DIAMOND?2:3.4;return function(){e.begin(),e.moveTo(c.x,c.y),e.lineTo(c.x-i/2-s/m,c.y+i/m-s/2),e.lineTo(c.x-i,c.y-s),e.lineTo(c.x-i/2+s/m,c.y-s/2-i/m),e.close(),d?e.fillAndStroke():e.stroke()}}mxMarker.addMarker("classic",e),mxMarker.addMarker("block",e),mxMarker.addMarker("open",function(e,n,t,a,i,s,o,r,l,d){n=1.118*i*l,t=1.118*s*l,i*=o+l,s*=o+l;var c=a.clone();return c.x-=n,c.y-=t,a.x+=2*-n,a.y+=2*-t,function(){e.begin(),e.moveTo(c.x-i-s/2,c.y-s+i/2),e.lineTo(c.x,c.y),e.lineTo(c.x+s/2-i,c.y-s-i/2),e.stroke()}}),mxMarker.addMarker("oval",function(e,n,t,a,i,s,o,r,l,d){var c=o/2,m=a.clone();return a.x-=i*c,a.y-=s*c,function(){e.ellipse(m.x-c,m.y-c,o,o),d?e.fillAndStroke():e.stroke()}}),mxMarker.addMarker("diamond",n),mxMarker.addMarker("diamondThin",n)}(),mxUtils.extend(mxActor,mxShape),mxActor.prototype.paintVertexShape=function(e,n,t,a,i){e.translate(n,t),e.begin(),this.redrawPath(e,n,t,a,i),e.fillAndStroke()},mxActor.prototype.redrawPath=function(e,n,t,a,i){n=a/3,e.moveTo(0,i),e.curveTo(0,3*i/5,0,2*i/5,a/2,2*i/5),e.curveTo(a/2-n,2*i/5,a/2-n,0,a/2,0),e.curveTo(a/2+n,0,a/2+n,2*i/5,a/2,2*i/5),e.curveTo(a,2*i/5,a,3*i/5,a,i),e.close()},mxUtils.extend(mxCloud,mxActor),mxCloud.prototype.redrawPath=function(e,n,t,a,i){e.moveTo(.25*a,.25*i),e.curveTo(.05*a,.25*i,0,.5*i,.16*a,.55*i),e.curveTo(0,.66*i,.18*a,.9*i,.31*a,.8*i),e.curveTo(.4*a,i,.7*a,i,.8*a,.8*i),e.curveTo(a,.8*i,a,.6*i,.875*a,.5*i),e.curveTo(a,.3*i,.8*a,.1*i,.625*a,.2*i),e.curveTo(.5*a,.05*i,.3*a,.05*i,.25*a,.25*i),e.close()},mxUtils.extend(mxRectangleShape,mxShape),mxRectangleShape.prototype.isHtmlAllowed=function(){return!this.isRounded&&!this.glass&&0==this.rotation},mxRectangleShape.prototype.paintBackground=function(e,n,t,a,i){if(this.isRounded){var s=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100;s=Math.min(a*s,i*s);e.roundrect(n,t,a,i,s,s)}else e.rect(n,t,a,i);e.fillAndStroke()},mxRectangleShape.prototype.paintForeground=function(e,n,t,a,i){this.glass&&this.paintGlassEffect(e,n,t,a,i,this.getArcSize(a+this.strokewidth,i+this.strokewidth))},mxRectangleShape.prototype.redrawHtmlShape=function(){this.updateHtmlBounds(this.node),this.updateHtmlFilters(this.node),this.updateHtmlColors(this.node)},mxRectangleShape.prototype.updateHtmlBounds=function(e){var n=9<=document.documentMode?0:Math.ceil(this.strokewidth*this.scale);e.style.borderWidth=Math.max(1,n)+"px",e.style.overflow="hidden",e.style.left=Math.round(this.bounds.x-n/2)+"px",e.style.top=Math.round(this.bounds.y-n/2)+"px","CSS1Compat"==document.compatMode&&(n=-n),e.style.width=Math.round(Math.max(0,this.bounds.width+n))+"px",e.style.height=Math.round(Math.max(0,this.bounds.height+n))+"px"},mxRectangleShape.prototype.updateHtmlColors=function(e){var n=this.stroke;null!=n&&n!=mxConstants.NONE?(e.style.borderColor=n,this.isDashed?e.style.borderStyle="dashed":0<this.strokewidth&&(e.style.borderStyle="solid"),e.style.borderWidth=Math.max(1,Math.ceil(this.strokewidth*this.scale))+"px"):e.style.borderWidth="0px",null!=(n=this.fill)&&n!=mxConstants.NONE?(e.style.backgroundColor=n,e.style.backgroundImage="none"):this.pointerEvents?e.style.backgroundColor="transparent":8==document.documentMode?mxUtils.addTransparentBackgroundFilter(e):this.setTransparentBackgroundImage(e)},mxRectangleShape.prototype.updateHtmlFilters=function(e){var n="";if(this.opacity<100&&(n+="alpha(opacity="+this.opacity+")"),this.isShadow&&(n+="progid:DXImageTransform.Microsoft.dropShadow (OffX='"+Math.round(mxConstants.SHADOW_OFFSET_X*this.scale)+"', OffY='"+Math.round(mxConstants.SHADOW_OFFSET_Y*this.scale)+"', Color='"+mxConstants.SHADOWCOLOR+"')"),this.gradient){var t=this.fill,a=this.gradient,i="0",s={east:0,south:1,west:2,north:3},o=null!=this.direction?s[this.direction]:0;null!=this.gradientDirection&&(o=mxUtils.mod(o+s[this.gradientDirection]-1,4)),1==o?(i="1",s=t,t=a,a=s):2==o?(s=t,t=a,a=s):3==o&&(i="1"),n+="progid:DXImageTransform.Microsoft.gradient(startColorStr='"+t+"', endColorStr='"+a+"', gradientType='"+i+"')"}e.style.filter=n},mxUtils.extend(mxEllipse,mxShape),mxEllipse.prototype.paintVertexShape=function(e,n,t,a,i){e.ellipse(n,t,a,i),e.fillAndStroke()},mxUtils.extend(mxDoubleEllipse,mxShape),mxDoubleEllipse.prototype.vmlScale=10,mxDoubleEllipse.prototype.paintBackground=function(e,n,t,a,i){e.ellipse(n,t,a,i),e.fillAndStroke()},mxDoubleEllipse.prototype.paintForeground=function(e,n,t,a,i){var s=Math.min(4,Math.min(a/5,i/5));i-=2*s,0<(a-=2*s)&&0<i&&e.ellipse(n+s,t+s,a,i),e.stroke()},mxUtils.extend(mxRhombus,mxShape),mxRhombus.prototype.paintVertexShape=function(e,n,t,a,i){var s=a/2,o=i/2;e.begin(),e.moveTo(n+s,t),e.lineTo(n+a,t+o),e.lineTo(n+s,t+i),e.lineTo(n,t+o),e.close(),e.fillAndStroke()},mxUtils.extend(mxPolyline,mxShape),mxPolyline.prototype.getRotation=function(){return 0},mxPolyline.prototype.paintEdgeShape=function(e,n){this.paintLine(e,n,this.isRounded)},mxPolyline.prototype.paintLine=function(e,n,t){var a=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2,i=n[0],s=n[n.length-1];e.begin(),e.moveTo(i.x,i.y);for(var o=1;o<n.length-1;o++){var r=n[o],l=i.x-r.x;i=i.y-r.y;if(t&&o<n.length-1&&(0!=l||0!=i)){var d=Math.sqrt(l*l+i*i);l=l*Math.min(a,d/2)/d,i=i*Math.min(a,d/2)/d;e.lineTo(r.x+l,r.y+i),l=(i=n[o+1]).x-r.x,i=i.y-r.y,d=Math.max(1,Math.sqrt(l*l+i*i)),l=l*Math.min(a,d/2)/d,i=i*Math.min(a,d/2)/d,l=r.x+l,i=r.y+i,e.quadTo(r.x,r.y,l,i),r=new mxPoint(l,i)}else e.lineTo(r.x,r.y);i=r}e.lineTo(s.x,s.y),e.stroke()},mxUtils.extend(mxArrow,mxShape),mxArrow.prototype.paintEdgeShape=function(e,n){var t=mxConstants.ARROW_SPACING,a=mxConstants.ARROW_WIDTH,i=mxConstants.ARROW_SIZE,s=n[0],o=n[n.length-1],r=o.x-s.x,l=o.y-s.y,d=(c=Math.sqrt(r*r+l*l))-2*t-i,c=(r=r/c,a*(l=l/c)/3),m=(a=-a*r/3,(i=s.x-c/2+t*r)+c),u=(s=s.y-a/2+t*l)+a,p=m+d*r,g=p+c,v=(d=u+d*l)+a,h=g-3*c,f=v-3*a;e.begin(),e.moveTo(i,s),e.lineTo(m,u),e.lineTo(p,d),e.lineTo(g,v),e.lineTo(o.x-t*r,o.y-t*l),e.lineTo(h,f),e.lineTo(h+c,f+a),e.close(),e.fillAndStroke()},mxUtils.extend(mxText,mxShape),mxText.prototype.baseSpacingTop=0,mxText.prototype.baseSpacingBottom=0,mxText.prototype.baseSpacingLeft=0,mxText.prototype.baseSpacingRight=0,mxText.prototype.replaceLinefeeds=!0,mxText.prototype.verticalTextRotation=-90,mxText.prototype.ignoreClippedStringSize=!0,mxText.prototype.ignoreStringSize=!1,mxText.prototype.isParseVml=function(){return!1},mxText.prototype.isHtmlAllowed=function(){return 8!=document.documentMode},mxText.prototype.getSvgScreenOffset=function(){return 0},mxText.prototype.checkBounds=function(){return!(null==this.bounds||isNaN(this.bounds.x)||isNaN(this.bounds.y)||isNaN(this.bounds.width)||isNaN(this.bounds.height))},mxText.prototype.updateBoundingBox=function(){var e=this.node;8==document.documentMode&&null!=e.firstChild&&(null!=(e=e.firstChild).firstChild&&(e=e.firstChild)),this.boundingBox=this.bounds.clone();var n=this.getTextRotation();if(this.ignoreStringSize||null==e||"fill"==this.overflow||this.clipped&&this.ignoreClippedStringSize)this.boundingBox.x+=this.margin.x*this.boundingBox.width,this.boundingBox.y+=this.margin.y*this.boundingBox.height;else{var t=null,a=null;if(null!=e.ownerSVGElement)if(null!=e.firstChild&&null!=e.firstChild.firstChild&&"foreignObject"==e.firstChild.firstChild.nodeName)e=e.firstChild.firstChild,t=this.wrap?this.bounds.width:parseInt(e.getAttribute("width"))*this.scale,a=parseInt(e.getAttribute("height"))*this.scale;else{if(0==(n=e.getBBox()).width&&0==n.height)return;this.boundingBox=new mxRectangle(n.x,n.y,n.width,n.height),n=0}else a=this.state.view.textDiv,a=null!=this.offsetWidth&&null!=this.offsetHeight?(t=this.wrap?this.bounds.width:this.offsetWidth*this.scale,this.offsetHeight*this.scale):null!=a?(this.updateFont(a),this.updateSize(a),mxUtils.isNode(this.value)?a.innerHTML=this.value.outerHTML:(t=this.replaceLinefeeds?this.value.replace(/\n/g,"<br/>"):this.value,a.innerHTML=t),t=this.wrap?this.bounds.width:a.offsetWidth*this.scale,a.offsetHeight*this.scale):(t=this.wrap?this.bounds.width:e.offsetWidth*this.scale,e.offsetHeight*this.scale);null!=t&&null!=a&&(this.boundingBox=new mxRectangle(this.bounds.x+this.margin.x*t,this.bounds.y+this.margin.y*a,t,a))}null!=this.boundingBox&&(0!=n&&(n=mxUtils.getBoundingBox(this.boundingBox,n),this.boundingBox.x=n.x,this.boundingBox.y=n.y,mxClient.IS_QUIRKS||(this.boundingBox.width=n.width,this.boundingBox.height=n.height)),this.boundingBox.x=Math.floor(this.boundingBox.x),this.boundingBox.y=Math.floor(this.boundingBox.y),this.boundingBox.width=Math.ceil(this.boundingBox.width),this.boundingBox.height=Math.ceil(this.boundingBox.height))},mxText.prototype.getShapeRotation=function(){return 0},mxText.prototype.getTextRotation=function(){return null!=this.state&&null!=this.state.shape?this.state.shape.getTextRotation():0},mxText.prototype.isPaintBoundsInverted=function(){return!this.horizontal&&null!=this.state&&this.state.view.graph.model.isVertex(this.state.cell)},mxText.prototype.configureCanvas=function(e,n,t,a,i){mxShape.prototype.configureCanvas.apply(this,arguments),e.setFontColor(this.color),e.setFontBackgroundColor(this.background),e.setFontBorderColor(this.border),e.setFontFamily(this.family),e.setFontSize(this.size),e.setFontStyle(this.fontStyle)},mxText.prototype.updateVmlContainer=function(){this.node.style.left=Math.round(this.bounds.x)+"px",this.node.style.top=Math.round(this.bounds.y)+"px",this.node.style.width="1px",this.node.style.height="1px",this.node.style.overflow="visible"},mxText.prototype.paint=function(e){var n=this.scale,t=this.bounds.x/n,a=this.bounds.y/n,i=this.bounds.width/n;n=this.bounds.height/n;this.updateTransform(e,t,a,i,n),this.configureCanvas(e,t,a,i,n);var s=mxUtils.isNode(this.value)||this.dialect==mxConstants.DIALECT_STRICTHTML,o=s||e instanceof mxVmlCanvas2D?"html":"",r=this.value;!s&&"html"==o&&(r=mxUtils.htmlEntities(r,!1)),r=!mxUtils.isNode(this.value)&&this.replaceLinefeeds&&"html"==o?r.replace(/\n/g,"<br/>"):r,e.text(t,a,i,n,r,this.align,this.valign,this.wrap,o,"fill"==this.overflow,this.clipped,this.getTextRotation())},mxText.prototype.redrawHtmlShape=function(){var e=this.node.style;e.opacity=this.opacity<1?this.opacity:"",e.overflow="",e.width="",e.height="",this.updateFont(this.node),this.updateSize(this.node),this.updateValue(),this.offsetHeight=this.offsetWidth=null,null!=mxClient.CSS_PREFIX?this.updateHtmlTransform():this.updateHtmlFilter()},mxText.prototype.updateHtmlTransform=function(){var e=this.getTextRotation(),n=this.node.style,t=this.margin.x,a=this.margin.y;0!=e?(n[mxClient.CSS_PREFIX+"TransformOrigin"]=100*-t+"% "+100*-a+"%",n[mxClient.CSS_PREFIX+"Transform"]="translate("+100*t+"%,"+100*a+"%)scale("+this.scale+") rotate("+e+"deg)"):(n[mxClient.CSS_PREFIX+"TransformOrigin"]="0% 0%",n[mxClient.CSS_PREFIX+"Transform"]="scale("+this.scale+")translate("+100*t+"%,"+100*a+"%)"),n.left=Math.round(this.bounds.x)+"px",n.top=Math.round(this.bounds.y)+"px"},mxText.prototype.updateHtmlFilter=function(){var e=this.node.style,n=this.margin.x,t=this.margin.y,a=this.scale;e.filter="";var i=0,s=0;if(null!=(r=null!=this.state?this.state.view.textDiv:null)){if(r.style.overflow="",r.style.height="",r.style.width="",this.updateFont(r),this.updateSize(r),mxUtils.isNode(this.value))r.innerHTML=this.value.outerHTML;else{var o=this.value;this.dialect!=mxConstants.DIALECT_STRICTHTML&&(o=mxUtils.htmlEntities(o,!1)),o=this.replaceLinefeeds?o.replace(/\n/g,"<br/>"):o,r.innerHTML=o}i=r.offsetWidth+2,s=r.offsetHeight+2}else i=this.node.offsetWidth,s=this.node.offsetHeight+1;this.offsetWidth=i,this.offsetHeight=s,r=this.bounds.width/a,o=this.bounds.height/a,mxClient.IS_QUIRKS&&(this.clipped||"fill"==this.overflow)&&0<o?(o=Math.min(o,s),e.height=Math.round(o+1)+"px"):o=s,"fill"!=this.overflow&&(mxClient.IS_QUIRKS&&(this.clipped||this.wrap)&&0<r?(r=Math.min(r,i),e.width=Math.round(r)+"px"):r=i);o*=a;var r=r*a,l=(i=this.getTextRotation()*(Math.PI/180),s=parseFloat(parseFloat(Math.cos(i)).toFixed(8)),parseFloat(parseFloat(Math.sin(-i)).toFixed(8)));(i=i%(2*Math.PI))<0&&(i+=2*Math.PI),(i%=Math.PI)>Math.PI/2&&(i=Math.PI-i);var d=Math.cos(i),c=Math.sin(-i),m=(o-o*d+r*c)/2+l*(n=r*-(n+.5))-s*(t=o*-(t+.5));0!=i&&(e.filter="progid:DXImageTransform.Microsoft.Matrix(M11="+s+", M12="+l+", M21="+-l+", M22="+s+", sizingMethod='auto expand')"),e.zoom=a,e.left=Math.round(this.bounds.x+((r-r*d+o*c)/2-s*n-l*t)-r/2)+"px",e.top=Math.round(this.bounds.y+m-o/2)+"px"},mxText.prototype.updateValue=function(){if(mxUtils.isNode(this.value))this.node.innerHTML="",this.node.appendChild(this.value);else{var e=this.value;this.dialect!=mxConstants.DIALECT_STRICTHTML&&(e=mxUtils.htmlEntities(e,!1));e=this.replaceLinefeeds?e.replace(/\n/g,"<br/>"):e;var n=null!=this.background&&this.background!=mxConstants.NONE?this.background:null,t=null!=this.border&&this.border!=mxConstants.NONE?this.border:null;if(null!=n||null!=t)if("fill"==this.overflow)null!=n&&(this.node.style.backgroundColor=n),null!=t&&(this.node.style.border="1px solid "+t);else{var a="";null!=n&&(a+="background-color:"+n+";"),null!=t&&(a+="border:1px solid "+t+";"),e='<div style="zoom:1;'+a+"display:inline-block;_display:inline;padding-bottom:1px;padding-right:1px;line-height:"+this.node.style.lineHeight+'">'+e+"</div>",this.node.style.lineHeight=""}this.node.innerHTML=e}},mxText.prototype.updateFont=function(e){(e=e.style).lineHeight=Math.round(this.size*mxConstants.LINE_HEIGHT)+"px",e.fontSize=Math.round(this.size)+"px",e.fontFamily=this.family,e.verticalAlign="top",e.color=this.color,e.fontWeight=(this.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD?"bold":"",e.fontStyle=(this.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC?"italic":"",e.fontDecoration=(this.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE?"underline":"",e.textAlign=this.align==mxConstants.ALIGN_CENTER?"center":this.align==mxConstants.ALIGN_RIGHT?"right":"left"},mxText.prototype.updateSize=function(e){var n=Math.round(this.bounds.width/this.scale),t=Math.round(this.bounds.height/this.scale);e=e.style,this.clipped?(e.overflow="hidden",0<t&&(e.maxHeight=t+"px"),0<n&&(e.width=n+"px")):"fill"==this.overflow&&(e.width=n+"px",0<t&&(e.maxHeight=t+"px")),this.wrap?(!this.clipped&&0<n&&(e.width=n+"px"),e.whiteSpace="normal"):e.whiteSpace="nowrap"},mxText.prototype.updateMargin=function(){this.margin=mxUtils.getAlignmentAsPoint(this.align,this.valign)},mxText.prototype.getSpacing=function(){return new mxPoint(this.align==mxConstants.ALIGN_CENTER?(this.spacingLeft-this.spacingRight)/2:this.align==mxConstants.ALIGN_RIGHT?-this.spacingRight-this.baseSpacingRight:this.spacingLeft+this.baseSpacingLeft,this.valign==mxConstants.ALIGN_MIDDLE?(this.spacingTop-this.spacingBottom)/2:this.valign==mxConstants.ALIGN_BOTTOM?-this.spacingBottom-this.baseSpacingBottom:this.spacingTop+this.baseSpacingTop)},mxUtils.extend(mxTriangle,mxActor),mxTriangle.prototype.redrawPath=function(e,n,t,a,i){e.moveTo(0,0),e.lineTo(a,.5*i),e.lineTo(0,i),e.close()},mxUtils.extend(mxHexagon,mxActor),mxHexagon.prototype.redrawPath=function(e,n,t,a,i){e.moveTo(.25*a,0),e.lineTo(.75*a,0),e.lineTo(a,.5*i),e.lineTo(.75*a,i),e.lineTo(.25*a,i),e.lineTo(0,.5*i),e.close()},mxUtils.extend(mxLine,mxShape),mxLine.prototype.paintVertexShape=function(e,n,t,a,i){t+=i/2,e.begin(),e.moveTo(n,t),e.lineTo(n+a,t),e.stroke()},mxUtils.extend(mxImageShape,mxRectangleShape),mxImageShape.prototype.preserveImageAspect=!0,mxImageShape.prototype.getSvgScreenOffset=function(){return mxClient.IS_IE?0:.5},mxImageShape.prototype.apply=function(e){mxShape.prototype.apply.apply(this,arguments),this.gradient=this.stroke=this.fill=null,null!=this.style&&(this.fill=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BACKGROUND),this.stroke=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BORDER),this.preserveImageAspect=1==mxUtils.getNumber(this.style,mxConstants.STYLE_IMAGE_ASPECT,1),this.flipH=this.flipH||1==mxUtils.getValue(this.style,"imageFlipH",0),this.flipV=this.flipV||1==mxUtils.getValue(this.style,"imageFlipV",0))},mxImageShape.prototype.isHtmlAllowed=function(){return!this.preserveImageAspect},mxImageShape.prototype.createHtml=function(){var e=document.createElement("div");return e.style.position="absolute",e},mxImageShape.prototype.paintVertexShape=function(e,n,t,a,i){if(null!=this.image){var s=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BACKGROUND,null),o=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BORDER,null);null==s&&null==o||(e.setFillColor(s),e.setStrokeColor(o),e.rect(n,t,a,i),e.fillAndStroke()),e.image(n,t,a,i,this.image,this.preserveImageAspect,!1,!1)}else mxRectangleShape.prototype.paintBackground.apply(this,arguments)},mxImageShape.prototype.redrawHtmlShape=function(){if(this.node.style.left=Math.round(this.bounds.x)+"px",this.node.style.top=Math.round(this.bounds.y)+"px",this.node.style.width=Math.max(0,Math.round(this.bounds.width))+"px",this.node.style.height=Math.max(0,Math.round(this.bounds.height))+"px",this.node.style.backgroundColor=this.fill||"",this.node.style.borderColor=this.stroke||"",this.node.innerHTML="",null!=this.image){var e=document.createElement(mxClient.IS_IE6||null==mxClient.CSS_PREFIX&&0!=this.rotation?mxClient.VML_PREFIX+":image":"img");e.style.position="absolute",e.src=this.image;var n=this.opacity<100?"alpha(opacity="+this.opacity+")":"";this.node.style.filter=n,this.flipH&&this.flipV?n+="progid:DXImageTransform.Microsoft.BasicImage(rotation=2)":this.flipH?n+="progid:DXImageTransform.Microsoft.BasicImage(mirror=1)":this.flipV&&(n+="progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"),e.style.filter!=n&&(e.style.filter=n),"image"==e.nodeName?e.style.rotation=this.rotation:e.style[mxClient.CSS_PREFIX+"Transform"]="rotate("+this.rotation+"deg)",e.style.width=this.node.style.width,e.style.height=this.node.style.height,this.node.style.backgroundImage="",this.node.appendChild(e)}else this.setTransparentBackgroundImage(this.node)},mxUtils.extend(mxLabel,mxRectangleShape),mxLabel.prototype.imageSize=mxConstants.DEFAULT_IMAGESIZE,mxLabel.prototype.spacing=2,mxLabel.prototype.indicatorSize=10,mxLabel.prototype.indicatorSpacing=2,mxLabel.prototype.init=function(e){mxShape.prototype.init.apply(this,arguments),null!=this.indicatorColor&&null!=this.indicatorShape&&(this.indicator=new this.indicatorShape,this.indicator.dialect=this.dialect,this.indicator.bounds=this.bounds,this.indicator.fill=this.indicatorColor,this.indicator.stroke=this.indicatorColor,this.indicator.gradient=this.indicatorGradientColor,this.indicator.direction=this.indicatorDirection,this.indicator.init(this.node))},mxLabel.prototype.redraw=function(){null!=this.indicator&&(this.indicator.fill=this.indicatorColor,this.indicator.stroke=this.indicatorColor,this.indicator.gradient=this.indicatorGradientColor,this.indicator.direction=this.indicatorDirection),mxShape.prototype.redraw.apply(this,arguments)},mxLabel.prototype.isHtmlAllowed=function(){return mxRectangleShape.prototype.isHtmlAllowed.apply(this,arguments)&&null==this.indicatorColor&&null==this.indicatorShape},mxLabel.prototype.paintForeground=function(e,n,t,a,i){this.paintImage(e,n,t,a,i),this.paintIndicator(e,n,t,a,i),mxRectangleShape.prototype.paintForeground.apply(this,arguments)},mxLabel.prototype.paintImage=function(e,n,t,a,i){null!=this.image&&(n=this.getImageBounds(n,t,a,i),e.image(n.x,n.y,n.width,n.height,this.image,!1,!1,!1))},mxLabel.prototype.getImageBounds=function(e,n,t,a){var i=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_ALIGN,mxConstants.ALIGN_LEFT),s=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE),o=mxUtils.getNumber(this.style,mxConstants.STYLE_IMAGE_WIDTH,mxConstants.DEFAULT_IMAGESIZE),r=mxUtils.getNumber(this.style,mxConstants.STYLE_IMAGE_HEIGHT,mxConstants.DEFAULT_IMAGESIZE),l=mxUtils.getNumber(this.style,mxConstants.STYLE_SPACING,this.spacing)+5;return new mxRectangle(e=i==mxConstants.ALIGN_CENTER?e+(t-o)/2:i==mxConstants.ALIGN_RIGHT?e+(t-o-l):e+l,n=s==mxConstants.ALIGN_TOP?n+l:s==mxConstants.ALIGN_BOTTOM?n+(a-r-l):n+(a-r)/2,o,r)},mxLabel.prototype.paintIndicator=function(e,n,t,a,i){null!=this.indicator?(this.indicator.bounds=this.getIndicatorBounds(n,t,a,i),this.indicator.paint(e)):null!=this.indicatorImage&&(n=this.getIndicatorBounds(n,t,a,i),e.image(n.x,n.y,n.width,n.height,this.indicatorImage,!1,!1,!1))},mxLabel.prototype.getIndicatorBounds=function(e,n,t,a){var i=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_ALIGN,mxConstants.ALIGN_LEFT),s=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE),o=mxUtils.getNumber(this.style,mxConstants.STYLE_INDICATOR_WIDTH,this.indicatorSize),r=mxUtils.getNumber(this.style,mxConstants.STYLE_INDICATOR_HEIGHT,this.indicatorSize),l=this.spacing+5;return new mxRectangle(e=i==mxConstants.ALIGN_RIGHT?e+(t-o-l):i==mxConstants.ALIGN_CENTER?e+(t-o)/2:e+l,n=s==mxConstants.ALIGN_BOTTOM?n+(a-r-l):s==mxConstants.ALIGN_TOP?n+l:n+(a-r)/2,o,r)},mxLabel.prototype.redrawHtmlShape=function(){for(mxRectangleShape.prototype.redrawHtmlShape.apply(this,arguments);this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);if(null!=this.image){var e=document.createElement("img");e.style.position="relative",e.setAttribute("border","0");var n=this.getImageBounds(this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height);n.x-=this.bounds.x,n.y-=this.bounds.y,e.style.left=Math.round(n.x)+"px",e.style.top=Math.round(n.y)+"px",e.style.width=Math.round(n.width)+"px",e.style.height=Math.round(n.height)+"px",e.src=this.image,this.node.appendChild(e)}},mxUtils.extend(mxCylinder,mxShape),mxCylinder.prototype.maxHeight=40,mxCylinder.prototype.svgStrokeTolerance=0,mxCylinder.prototype.paintVertexShape=function(e,n,t,a,i){e.translate(n,t),e.begin(),this.redrawPath(e,n,t,a,i,!1),e.fillAndStroke(),e.setShadow(!1),e.begin(),this.redrawPath(e,n,t,a,i,!0),e.stroke()},mxCylinder.prototype.redrawPath=function(e,n,t,a,i,s){n=Math.min(this.maxHeight,Math.round(i/5)),(s&&null!=this.fill||!s&&null==this.fill)&&(e.moveTo(0,n),e.curveTo(0,2*n,a,2*n,a,n),s||(e.stroke(),e.begin())),s||(e.moveTo(0,n),e.curveTo(0,-n/3,a,-n/3,a,n),e.lineTo(a,i-n),e.curveTo(a,i+n/3,0,i+n/3,0,i-n),e.close())},mxUtils.extend(mxConnector,mxPolyline),mxConnector.prototype.paintEdgeShape=function(e,n){var t=this.createMarker(e,n,!0),a=this.createMarker(e,n,!1);null==this.style||1!=this.style[mxConstants.STYLE_CURVED]?this.paintLine(e,n,this.isRounded):this.paintCurvedLine(e,n),e.setFillColor(this.stroke),e.setShadow(!1),e.setDashed(!1),null!=t&&t(),null!=a&&a()},mxConnector.prototype.paintCurvedLine=function(e,n){e.begin();var t=n[0],a=n.length;for(e.moveTo(t.x,t.y),t=1;t<a-2;t++){var i=n[t],s=n[t+1];e.quadTo(i.x,i.y,(i.x+s.x)/2,(i.y+s.y)/2)}i=n[a-2],s=n[a-1],e.quadTo(i.x,i.y,s.x,s.y),e.stroke()},mxConnector.prototype.createMarker=function(e,n,t){var a=n.length,i=t?n[1]:n[a-2],s=(a=(n=t?n[0]:n[a-1]).x-i.x,n.y-i.y),o=(i=a/(o=Math.max(1,Math.sqrt(a*a+s*s))),a=s/o,s=mxUtils.getNumber(this.style,t?mxConstants.STYLE_STARTSIZE:mxConstants.STYLE_ENDSIZE,mxConstants.DEFAULT_MARKERSIZE),mxUtils.getValue(this.style,t?mxConstants.STYLE_STARTARROW:mxConstants.STYLE_ENDARROW));return mxMarker.createMarker(e,this,o,n,i,a,s,t,this.strokewidth,0!=this.style[t?mxConstants.STYLE_STARTFILL:mxConstants.STYLE_ENDFILL])},mxConnector.prototype.augmentBoundingBox=function(e){mxShape.prototype.augmentBoundingBox.apply(this,arguments);var n=0;mxUtils.getValue(this.style,mxConstants.STYLE_STARTARROW,mxConstants.NONE)!=mxConstants.NONE&&(n=mxUtils.getNumber(this.style,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_MARKERSIZE)+1),mxUtils.getValue(this.style,mxConstants.STYLE_ENDARROW,mxConstants.NONE)!=mxConstants.NONE&&(n=Math.max(n,mxUtils.getNumber(this.style,mxConstants.STYLE_ENDSIZE,mxConstants.DEFAULT_MARKERSIZE))+1),e.grow(Math.ceil(n*this.scale))},mxUtils.extend(mxSwimlane,mxShape),mxSwimlane.prototype.imageSize=16,mxSwimlane.prototype.getGradientBounds=function(e,n,t,a,i){return new mxRectangle(n,t,a,Math.min(i,mxUtils.getValue(this.style,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)))},mxSwimlane.prototype.getRotation=function(){var e=mxShape.prototype.getRotation.apply(this,arguments);return 1!=mxUtils.getValue(this.style,mxConstants.STYLE_HORIZONTAL,1)&&(e+=mxText.prototype.verticalTextRotation),e},mxSwimlane.prototype.getTextRotation=function(){return this.getRotation()},mxSwimlane.prototype.isPaintBoundsInverted=function(){return mxShape.prototype.isPaintBoundsInverted.apply(this,arguments)||1!=mxUtils.getValue(this.style,mxConstants.STYLE_HORIZONTAL,1)},mxSwimlane.prototype.getArcSize=function(e,n,t){return 3*t*(mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100)},mxSwimlane.prototype.paintVertexShape=function(e,n,t,a,i){var s=Math.min(i,mxUtils.getValue(this.style,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)),o=mxUtils.getValue(this.style,mxConstants.STYLE_SWIMLANE_FILLCOLOR,mxConstants.NONE),r=1==mxUtils.getValue(this.style,mxConstants.STYLE_SWIMLANE_LINE,1),l=0;e.translate(n,t),this.isRounded?(l=this.getArcSize(a,i,s),this.paintRoundedSwimlane(e,n,t,a,i,s,l,o,r)):this.paintSwimlane(e,n,t,a,i,s,o,r),o=mxUtils.getValue(this.style,mxConstants.STYLE_SEPARATORCOLOR,mxConstants.NONE),this.paintSeparator(e,a,s,i,o),null!=this.image&&(i=this.getImageBounds(n,s,a,i),e.image(i.x-n,i.y-t,i.width,i.height,this.image,!1,!1,!1)),this.glass&&(e.setShadow(!1),this.paintGlassEffect(e,0,0,a,s,l))},mxSwimlane.prototype.paintSwimlane=function(e,n,t,a,i,s,o,r){o!=mxConstants.NONE&&(e.save(),e.setFillColor(o),e.rect(0,0,a,i),e.fillAndStroke(),e.restore(),e.setShadow(!1)),e.begin(),e.moveTo(0,s),e.lineTo(0,0),e.lineTo(a,0),e.lineTo(a,s),r&&e.close(),e.fillAndStroke(),s<i&&o==mxConstants.NONE&&(e.pointerEvents=!1,e.begin(),e.moveTo(0,s),e.lineTo(0,i),e.lineTo(a,i),e.lineTo(a,s),e.stroke())},mxSwimlane.prototype.paintRoundedSwimlane=function(e,n,t,a,i,s,o,r,l){r!=mxConstants.NONE&&(e.save(),e.setFillColor(r),e.roundrect(0,0,a,i,o,o),e.fillAndStroke(),e.restore(),e.setShadow(!1)),e.begin(),e.moveTo(a,s),e.lineTo(a,o),e.quadTo(a,0,a-Math.min(a/2,o),0),e.lineTo(Math.min(a/2,o),0),e.quadTo(0,0,0,o),e.lineTo(0,s),l&&e.close(),e.fillAndStroke(),s<i&&r==mxConstants.NONE&&(e.pointerEvents=!1,e.begin(),e.moveTo(0,s),e.lineTo(0,i-o),e.quadTo(0,i,Math.min(a/2,o),i),e.lineTo(a-Math.min(a/2,o),i),e.quadTo(a,i,a,i-o),e.lineTo(a,s),e.stroke())},mxSwimlane.prototype.paintSeparator=function(e,n,t,a,i){i!=mxConstants.NONE&&(e.setStrokeColor(i),e.setDashed(!0),e.begin(),e.moveTo(n,t),e.lineTo(n,a),e.stroke(),e.setDashed(!1))},mxSwimlane.prototype.getImageBounds=function(e,n,t,a){return new mxRectangle(e+t-this.imageSize,n,this.imageSize,this.imageSize)},mxGraphLayout.prototype.graph=null,mxGraphLayout.prototype.useBoundingBox=!0,mxGraphLayout.prototype.parent=null,mxGraphLayout.prototype.moveCell=function(e,n,t){},mxGraphLayout.prototype.execute=function(e){},mxGraphLayout.prototype.getGraph=function(){return this.graph},mxGraphLayout.prototype.getConstraint=function(e,n,t,a){return null!=(n=null!=(t=this.graph.view.getState(n))?t.style:this.graph.getCellStyle(n))?n[e]:null},mxGraphLayout.traverse=function(e,n,t,a,i){if(null!=t&&null!=e){n=null==n||n,i=i||[];var s=mxCellPath.create(e);if(null==i[s]&&(null==(a=t(i[s]=e,a))||a)&&0<(a=this.graph.model.getEdgeCount(e)))for(s=0;s<a;s++){var o=this.graph.model.getEdgeAt(e,s),r=this.graph.model.getTerminal(o,!0)==e;n&&!r||(r=this.graph.view.getVisibleTerminal(o,!r),this.traverse(r,n,t,o,i))}}},mxGraphLayout.prototype.isVertexMovable=function(e){return this.graph.isCellMovable(e)},mxGraphLayout.prototype.isVertexIgnored=function(e){return!this.graph.getModel().isVertex(e)||!this.graph.isCellVisible(e)},mxGraphLayout.prototype.isEdgeIgnored=function(e){var n=this.graph.getModel();return!n.isEdge(e)||!this.graph.isCellVisible(e)||null==n.getTerminal(e,!0)||null==n.getTerminal(e,!1)},mxGraphLayout.prototype.setEdgeStyleEnabled=function(e,n){this.graph.setCellStyles(mxConstants.STYLE_NOEDGESTYLE,n?"0":"1",[e])},mxGraphLayout.prototype.setOrthogonalEdge=function(e,n){this.graph.setCellStyles(mxConstants.STYLE_ORTHOGONAL,n?"1":"0",[e])},mxGraphLayout.prototype.getParentOffset=function(e){var n=new mxPoint;if(null!=e&&e!=this.parent){var t=this.graph.getModel();if(t.isAncestor(this.parent,e))for(var a=t.getGeometry(e);e!=this.parent;)n.x+=a.x,n.y+=a.y,e=t.getParent(e),a=t.getGeometry(e)}return n},mxGraphLayout.prototype.setEdgePoints=function(e,n){if(null!=e){var t=this.graph.model,a=t.getGeometry(e);if(null==a?(a=new mxGeometry).setRelative(!0):a=a.clone(),null!=this.parent&&null!=n)for(var i=t.getParent(e),s=(i=this.getParentOffset(i),0);s<n.length;s++)n[s].x-=i.x,n[s].y-=i.y;a.points=n,t.setGeometry(e,a)}},mxGraphLayout.prototype.setVertexLocation=function(e,n,t){var a=this.graph.getModel(),i=a.getGeometry(e),s=null;if(null!=i){if(s=new mxRectangle(n,t,i.width,i.height),this.useBoundingBox){var o=this.graph.getView().getState(e);if(null!=o&&null!=o.text&&null!=o.text.boundingBox){var r=this.graph.getView().scale,l=o.text.boundingBox;o.text.boundingBox.x<o.x&&(n+=(o.x-l.x)/r,s.width=l.width),o.text.boundingBox.y<o.y&&(t+=(o.y-l.y)/r,s.height=l.height)}}null!=this.parent&&(null!=(o=a.getParent(e))&&o!=this.parent&&(n-=(o=this.getParentOffset(o)).x,t-=o.y)),i.x==n&&i.y==t||((i=i.clone()).x=n,i.y=t,a.setGeometry(e,i))}return s},mxGraphLayout.prototype.getVertexBounds=function(e){var n=this.graph.getModel().getGeometry(e);if(this.useBoundingBox&&(null!=(r=this.graph.getView().getState(e))&&null!=r.text&&null!=r.text.boundingBox)){var t=this.graph.getView().scale,a=r.text.boundingBox,i=Math.max(r.x-a.x,0)/t,s=Math.max(r.y-a.y,0)/t,o=Math.max(a.x+a.width-(r.x+r.width),0)/t,r=Math.max(a.y+a.height-(r.y+r.height),0)/t;n=new mxRectangle(n.x-i,n.y-s,n.width+i+o,n.height+s+r)}return null!=this.parent&&(e=this.graph.getModel().getParent(e),n=n.clone(),null!=e&&e!=this.parent&&(e=this.getParentOffset(e),n.x+=e.x,n.y+=e.y)),new mxRectangle(n.x,n.y,n.width,n.height)},mxGraphLayout.prototype.arrangeGroups=function(e,n){this.graph.getModel().beginUpdate();try{for(var t=e.length-1;0<=t;t--){var a=e[t],i=this.graph.getChildVertices(a),s=this.graph.getBoundingBoxFromGeometry(i),o=this.graph.getCellGeometry(a),r=0,l=0;if(this.graph.isSwimlane(a)){var d=this.graph.getStartSize(a);r=d.width,l=d.height}null!=s&&null!=o&&((o=o.clone()).x=o.x+s.x-n-r,o.y=o.y+s.y-n-l,o.width=s.width+2*n+r,o.height=s.height+2*n+l,this.graph.getModel().setGeometry(a,o),this.graph.moveCells(i,n+r-s.x,n+l-s.y))}}finally{this.graph.getModel().endUpdate()}},mxStackLayout.prototype=new mxGraphLayout,mxStackLayout.prototype.constructor=mxStackLayout,mxStackLayout.prototype.horizontal=null,mxStackLayout.prototype.spacing=null,mxStackLayout.prototype.x0=null,mxStackLayout.prototype.y0=null,mxStackLayout.prototype.border=0,mxStackLayout.prototype.keepFirstLocation=!1,mxStackLayout.prototype.fill=!1,mxStackLayout.prototype.resizeParent=!1,mxStackLayout.prototype.resizeLast=!1,mxStackLayout.prototype.wrap=null,mxStackLayout.prototype.isHorizontal=function(){return this.horizontal},mxStackLayout.prototype.moveCell=function(e,n,t){var a=this.graph.getModel(),i=a.getParent(e),s=this.isHorizontal();if(null!=e&&null!=i){var o=0,r=0,l=a.getChildCount(i);for(n=s?n:t,null!=(o=this.graph.getView().getState(i))&&(n-=s?o.x:o.y),o=0;o<l;o++)if((t=a.getChildAt(i,o))!=e&&null!=(t=a.getGeometry(t))){if(t=s?t.x+t.width/2:t.y+t.height/2,r<n&&n<t)break;r=t}s=i.getIndex(e),s=Math.max(0,o-(s<o?1:0)),a.add(i,e,s)}},mxStackLayout.prototype.getParentSize=function(e){var n=this.graph.getModel(),t=n.getGeometry(e);return null!=this.graph.container&&(null==t&&n.isLayer(e)||e==this.graph.getView().currentRoot)&&(t=new mxRectangle(0,0,this.graph.container.offsetWidth-1,this.graph.container.offsetHeight-1)),t},mxStackLayout.prototype.execute=function(e){if(null!=e){var n=this.isHorizontal(),t=this.graph.getModel(),a=this.getParentSize(e),i=0;null!=a&&(i=n?a.height:a.width);i=i-(2*this.spacing+2*this.border);var s=this.x0+this.border,o=this.y0+this.border;if(this.graph.isSwimlane(e)){var r=this.graph.getCellStyle(e),l=mxUtils.getValue(r,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE);n==(r=mxUtils.getValue(r,mxConstants.STYLE_HORIZONTAL,!0))&&(i-=l),n?o+=l:s+=l}t.beginUpdate();try{l=0,r=null;for(var d=t.getChildCount(e),c=0;c<d;c++){var m=t.getChildAt(e,c);if(!this.isVertexIgnored(m)&&this.isVertexMovable(m)){var u=t.getGeometry(m);null!=u&&(u=u.clone(),null!=this.wrap&&null!=r&&(n&&r.x+r.width+u.width+2*this.spacing>this.wrap||!n&&r.y+r.height+u.height+2*this.spacing>this.wrap)&&(r=null,n?o+=l+this.spacing:s+=l+this.spacing,l=0),l=Math.max(l,n?u.height:u.width),null!=r?n?u.x=r.x+r.width+this.spacing:u.y=r.y+r.height+this.spacing:this.keepFirstLocation||(n?u.x=s:u.y=o),n?u.y=o:u.x=s,this.fill&&0<i&&(n?u.height=i:u.width=i),t.setGeometry(m,u),r=u)}}this.resizeParent&&null!=a&&null!=r&&!this.graph.isCellCollapsed(e)?(a=a.clone(),n?a.width=r.x+r.width+this.spacing:a.height=r.y+r.height+this.spacing,t.setGeometry(e,a)):this.resizeLast&&null!=a&&null!=r&&(n?r.width=a.width-r.x-this.spacing:r.height=a.height-r.y-this.spacing)}finally{t.endUpdate()}}},mxPartitionLayout.prototype=new mxGraphLayout,mxPartitionLayout.prototype.constructor=mxPartitionLayout,mxPartitionLayout.prototype.horizontal=null,mxPartitionLayout.prototype.spacing=null,mxPartitionLayout.prototype.border=null,mxPartitionLayout.prototype.resizeVertices=!0,mxPartitionLayout.prototype.isHorizontal=function(){return this.horizontal},mxPartitionLayout.prototype.moveCell=function(e,n,t){var a=(t=this.graph.getModel()).getParent(e);if(null!=e&&null!=a){var i=0,s=0,o=t.getChildCount(a);for(i=0;i<o;i++){var r=t.getChildAt(a,i);if(null!=(r=this.getVertexBounds(r))){if(r=r.x+r.width/2,s<n&&n<r)break;s=r}}n=a.getIndex(e),n=Math.max(0,i-(n<i?1:0)),t.add(a,e,n)}},mxPartitionLayout.prototype.execute=function(e){var n=this.isHorizontal(),t=this.graph.getModel(),a=t.getGeometry(e);if(null!=this.graph.container&&(null==a&&t.isLayer(e)||e==this.graph.getView().currentRoot)&&(a=new mxRectangle(0,0,this.graph.container.offsetWidth-1,this.graph.container.offsetHeight-1)),null!=a){for(var i=[],s=t.getChildCount(e),o=0;o<s;o++){var r=t.getChildAt(e,o);!this.isVertexIgnored(r)&&this.isVertexMovable(r)&&i.push(r)}if(0<(s=i.length)){var l=this.border,d=this.border,c=(c=n?a.height:a.width)-2*this.border;if(e=this.graph.isSwimlane(e)?this.graph.getStartSize(e):new mxRectangle,c-=n?e.height:e.width,l+=e.width,d+=e.height,e=this.border+(s-1)*this.spacing,0<(a=n?(a.width-l-e)/s:(a.height-d-e)/s)){t.beginUpdate();try{for(o=0;o<s;o++){r=i[o];var m=t.getGeometry(r);null!=m&&((m=m.clone()).x=l,m.y=d,n?(this.resizeVertices&&(m.width=a,m.height=c),l+=a+this.spacing):(this.resizeVertices&&(m.height=a,m.width=c),d+=a+this.spacing),t.setGeometry(r,m))}}finally{t.endUpdate()}}}}},mxCompactTreeLayout.prototype=new mxGraphLayout,mxCompactTreeLayout.prototype.constructor=mxCompactTreeLayout,mxCompactTreeLayout.prototype.horizontal=null,mxCompactTreeLayout.prototype.invert=null,mxCompactTreeLayout.prototype.resizeParent=!0,mxCompactTreeLayout.prototype.groupPadding=10,mxCompactTreeLayout.prototype.parentsChanged=null,mxCompactTreeLayout.prototype.moveTree=!1,mxCompactTreeLayout.prototype.levelDistance=10,mxCompactTreeLayout.prototype.nodeDistance=20,mxCompactTreeLayout.prototype.resetEdges=!0,mxCompactTreeLayout.prototype.prefHozEdgeSep=5,mxCompactTreeLayout.prototype.prefVertEdgeOff=4,mxCompactTreeLayout.prototype.minEdgeJetty=8,mxCompactTreeLayout.prototype.channelBuffer=4,mxCompactTreeLayout.prototype.edgeRouting=!0,mxCompactTreeLayout.prototype.isVertexIgnored=function(e){return mxGraphLayout.prototype.isVertexIgnored.apply(this,arguments)||0==this.graph.getConnections(e).length},mxCompactTreeLayout.prototype.isHorizontal=function(){return this.horizontal},mxCompactTreeLayout.prototype.execute=function(e,n){this.parent=e;var t=this.graph.getModel();if(null==n)if(0<this.graph.getEdges(e,t.getParent(e),this.invert,!this.invert,!1).length)n=e;else{if(0<(o=this.graph.findTreeRoots(e,!0,this.invert)).length)for(var a=0;a<o.length;a++)if(!this.isVertexIgnored(o[a])&&0<this.graph.getEdges(o[a],null,this.invert,!this.invert,!1).length){n=o[a];break}}if(null!=n){this.parentsChanged=this.resizeParent?{}:null,t.beginUpdate();try{var i=this.dfs(n,e);if(null!=i){this.layout(i);var s=this.graph.gridSize,o=s;if(!this.moveTree){var r=this.getVertexBounds(n);null!=r&&(s=r.x,o=r.y)}if((r=null)!=(r=this.isHorizontal()?this.horizontalLayout(i,s,o):this.verticalLayout(i,null,s,o))){var l=a=0;r.x<0&&(a=Math.abs(s-r.x)),r.y<0&&(l=Math.abs(o-r.y)),(0!=a||0!=l)&&this.moveNode(i,a,l),this.resizeParent&&this.adjustParents(),this.edgeRouting&&this.localEdgeProcessing(i)}}}finally{t.endUpdate()}}},mxCompactTreeLayout.prototype.moveNode=function(e,n,t){for(e.x+=n,e.y+=t,this.apply(e),e=e.child;null!=e;)this.moveNode(e,n,t),e=e.next},mxCompactTreeLayout.prototype.dfs=function(e,n,t){t=null!=t?t:[];var a=mxCellPath.create(e),i=null;if(null!=e&&null==t[a]&&!this.isVertexIgnored(e)){t[a]=e;i=this.createNode(e),a=this.graph.getModel();var s=null;e=this.graph.getEdges(e,n,this.invert,!this.invert,!1,!0);for(var o=this.graph.getView(),r=0;r<e.length;r++){var l=e[r];if(!this.isEdgeIgnored(l)){this.resetEdges&&this.setEdgePoints(l,null),this.edgeRouting&&(this.setEdgeStyleEnabled(l,!1),this.setEdgePoints(l,null));var d;l=null!=(d=o.getState(l))?d.getVisibleTerminal(this.invert):o.getVisibleTerminal(l,this.invert);null!=(d=this.dfs(l,n,t))&&null!=a.getGeometry(l)&&(null==s?i.child=d:s.next=d,s=d)}}}return i},mxCompactTreeLayout.prototype.layout=function(e){if(null!=e){for(var n=e.child;null!=n;)this.layout(n),n=n.next;null!=e.child?this.attachParent(e,this.join(e)):this.layoutLeaf(e)}},mxCompactTreeLayout.prototype.horizontalLayout=function(e,n,t,a){if(e.x+=n+e.offsetX,e.y+=t+e.offsetY,a=this.apply(e,a),null!=(n=e.child)){a=this.horizontalLayout(n,e.x,e.y,a),t=e.y+n.offsetY;for(var i=n.next;null!=i;)a=this.horizontalLayout(i,e.x+n.offsetX,t,a),t+=i.offsetY,i=i.next}return a},mxCompactTreeLayout.prototype.verticalLayout=function(e,n,t,a,i){if(e.x+=t+e.offsetY,e.y+=a+e.offsetX,i=this.apply(e,i),null!=(n=e.child))for(i=this.verticalLayout(n,e,e.x,e.y,i),t=e.x+n.offsetY,a=n.next;null!=a;)i=this.verticalLayout(a,e,t,e.y+n.offsetX,i),t+=a.offsetY,a=a.next;return i},mxCompactTreeLayout.prototype.attachParent=function(e,n){var t=this.nodeDistance+this.levelDistance,a=(n-e.width)/2-this.nodeDistance,i=a+e.width+2*this.nodeDistance-n;e.child.offsetX=t+e.height,e.child.offsetY=i,e.contour.upperHead=this.createLine(e.height,0,this.createLine(t,i,e.contour.upperHead)),e.contour.lowerHead=this.createLine(e.height,0,this.createLine(t,a,e.contour.lowerHead))},mxCompactTreeLayout.prototype.layoutLeaf=function(e){var n=2*this.nodeDistance;e.contour.upperTail=this.createLine(e.height+n,0),e.contour.upperHead=e.contour.upperTail,e.contour.lowerTail=this.createLine(0,-e.width-n),e.contour.lowerHead=this.createLine(e.height+n,0,e.contour.lowerTail)},mxCompactTreeLayout.prototype.join=function(e){var n=2*this.nodeDistance,t=e.child;e.contour=t.contour;var a=t.width+n,i=a;for(t=t.next;null!=t;){var s=this.merge(e.contour,t.contour);t.offsetY=s+a,t.offsetX=0,i+=s+(a=t.width+n),t=t.next}return i},mxCompactTreeLayout.prototype.merge=function(e,n){for(var t=0,a=0,i=0,s=e.lowerHead,o=n.upperHead;null!=o&&null!=s;){var r=this.offset(t,a,o.dx,o.dy,s.dx,s.dy);a=a+r,i=i+r;t+o.dx<=s.dx?(t+=o.dx,a+=o.dy,o=o.next):(t-=s.dx,a-=s.dy,s=s.next)}return null!=o?(t=this.bridge(e.upperTail,0,0,o,t,a),e.upperTail=null!=t.next?n.upperTail:t,e.lowerTail=n.lowerTail):null==(t=this.bridge(n.lowerTail,t,a,s,0,0)).next&&(e.lowerTail=t),e.lowerHead=n.lowerHead,i},mxCompactTreeLayout.prototype.offset=function(e,n,t,a,i,s){var o;return i<=e||e+t<=0?0:0<(o=0<i*a-t*s?e<0?e*a/t-n:0<e?e*s/i-n:-n:i<e+t?s-(n+(i-e)*a/t):e+t<i?(t+e)*s/i-(n+a):s-(n+a))?o:0},mxCompactTreeLayout.prototype.bridge=function(e,n,t,a,i,s){return n=i+a.dx-n,i=i=0,0==a.dx?i=a.dy:(i=n*a.dy,i/=a.dx),n=this.createLine(n,i,a.next),e.next=this.createLine(0,s+a.dy-i-t,n),n},mxCompactTreeLayout.prototype.createNode=function(e){var n={};return n.cell=e,n.x=0,n.y=0,n.width=0,n.height=0,null!=(e=this.getVertexBounds(e))&&(this.isHorizontal()?(n.width=e.height,n.height=e.width):(n.width=e.width,n.height=e.height)),n.offsetX=0,n.offsetY=0,n.contour={},n},mxCompactTreeLayout.prototype.apply=function(e,n){var t=this.graph.getModel(),a=e.cell,i=t.getGeometry(a);return null!=a&&null!=i&&(this.isVertexMovable(a)&&(i=this.setVertexLocation(a,e.x,e.y),this.resizeParent&&(t=t.getParent(a),a=mxCellPath.create(t),null==this.parentsChanged[a]&&(this.parentsChanged[a]=t))),n=null==n?new mxRectangle(i.x,i.y,i.width,i.height):new mxRectangle(Math.min(n.x,i.x),Math.min(n.y,i.y),Math.max(n.x+n.width,i.x+i.width),Math.max(n.y+n.height,i.y+i.height))),n},mxCompactTreeLayout.prototype.createLine=function(e,n,t){var a={};return a.dx=e,a.dy=n,a.next=t,a},mxCompactTreeLayout.prototype.adjustParents=function(){var e,n=[];for(e in this.parentsChanged)n.push(this.parentsChanged[e]);this.arrangeGroups(mxUtils.sortCells(n,!0),this.groupPadding)},mxCompactTreeLayout.prototype.localEdgeProcessing=function(e){for(this.processNodeOutgoing(e),e=e.child;null!=e;)this.localEdgeProcessing(e),e=e.next},mxCompactTreeLayout.prototype.processNodeOutgoing=function(e){for(var n=e.child,t=e.cell,a=0,i=[];null!=n;){a++;var s=n.x;this.horizontal&&(s=n.y),i.push(new WeightedCellSorter(n,s)),n=n.next}i.sort(WeightedCellSorter.prototype.compare),(s=e.width)>(o=(a+1)*this.prefHozEdgeSep)+2*this.prefHozEdgeSep&&(s-=2*this.prefHozEdgeSep),n=(e=s/a)/2,s>o+2*this.prefHozEdgeSep&&(n+=this.prefHozEdgeSep);s=this.minEdgeJetty-this.prefVertEdgeOff;for(var o=0,r=this.getVertexBounds(t),l=0;l<i.length;l++){for(var d=i[l].cell.cell,c=this.getVertexBounds(d),m=(d=this.graph.getEdgesBetween(t,d,!1),[]),u=0,p=0,g=0;g<d.length;g++)this.horizontal?(u=r.x+r.width,p=r.y+n,m.push(new mxPoint(u,p)),u=r.x+r.width+s,m.push(new mxPoint(u,p)),p=c.y+c.height/2):(u=r.x+n,p=r.y+r.height,m.push(new mxPoint(u,p)),p=r.y+r.height+s,m.push(new mxPoint(u,p)),u=c.x+c.width/2),m.push(new mxPoint(u,p)),this.setEdgePoints(d[g],m);l<a/2?s+=this.prefVertEdgeOff:a/2<l&&(s-=this.prefVertEdgeOff),n+=e,o=Math.max(o,s)}},WeightedCellSorter.prototype.weightedValue=0,WeightedCellSorter.prototype.nudge=!1,WeightedCellSorter.prototype.visited=!1,WeightedCellSorter.prototype.rankIndex=null,WeightedCellSorter.prototype.cell=null,WeightedCellSorter.prototype.compare=function(e,n){return null!=e&&null!=n?n.weightedValue>e.weightedValue?1:n.weightedValue<e.weightedValue?-1:n.nudge?1:-1:0},mxFastOrganicLayout.prototype=new mxGraphLayout,mxFastOrganicLayout.prototype.constructor=mxFastOrganicLayout,mxFastOrganicLayout.prototype.useInputOrigin=!0,mxFastOrganicLayout.prototype.resetEdges=!0,mxFastOrganicLayout.prototype.disableEdgeStyle=!0,mxFastOrganicLayout.prototype.forceConstant=50,mxFastOrganicLayout.prototype.forceConstantSquared=0,mxFastOrganicLayout.prototype.minDistanceLimit=2,mxFastOrganicLayout.prototype.maxDistanceLimit=500,mxFastOrganicLayout.prototype.minDistanceLimitSquared=4,mxFastOrganicLayout.prototype.initialTemp=200,mxFastOrganicLayout.prototype.temperature=0,mxFastOrganicLayout.prototype.maxIterations=0,mxFastOrganicLayout.prototype.iteration=0,mxFastOrganicLayout.prototype.allowedToRun=!0,mxFastOrganicLayout.prototype.isVertexIgnored=function(e){return mxGraphLayout.prototype.isVertexIgnored.apply(this,arguments)||0==this.graph.getConnections(e).length},mxFastOrganicLayout.prototype.execute=function(e){var n=this.graph.getModel();this.vertexArray=[];for(var t=this.graph.getChildVertices(e),a=0;a<t.length;a++)this.isVertexIgnored(t[a])||this.vertexArray.push(t[a]);var i=this.useInputOrigin?this.graph.view.getBounds(this.vertexArray):null,s=this.vertexArray.length;for(this.indices=[],this.dispX=[],this.dispY=[],this.cellLocation=[],this.isMoveable=[],this.neighbours=[],this.radius=[],this.radiusSquared=[],this.forceConstant<.001&&(this.forceConstant=.001),this.forceConstantSquared=this.forceConstant*this.forceConstant,a=0;a<this.vertexArray.length;a++){var o=this.vertexArray[a];this.cellLocation[a]=[];var r=mxCellPath.create(o);this.indices[r]=a;var l=this.getVertexBounds(o),d=l.width,c=l.height,m=l.x,u=l.y;this.cellLocation[a][0]=m+d/2,this.cellLocation[a][1]=u+c/2,this.radius[a]=Math.min(d,c),this.radiusSquared[a]=this.radius[a]*this.radius[a]}n.beginUpdate();try{for(a=0;a<s;a++){this.dispX[a]=0,this.dispY[a]=0,this.isMoveable[a]=this.isVertexMovable(this.vertexArray[a]);var p=this.graph.getConnections(this.vertexArray[a],e);t=this.graph.getOpposites(p,this.vertexArray[a]);for(this.neighbours[a]=[],d=0;d<t.length;d++){this.resetEdges&&this.graph.resetEdge(p[d]),this.disableEdgeStyle&&this.setEdgeStyleEnabled(p[d],!1);r=mxCellPath.create(t[d]);var g=this.indices[r];this.neighbours[a][d]=null!=g?g:a}}for(this.temperature=this.initialTemp,0==this.maxIterations&&(this.maxIterations=20*Math.sqrt(s)),this.iteration=0;this.iteration<this.maxIterations;this.iteration++){if(!this.allowedToRun)return;this.calcRepulsion(),this.calcAttraction(),this.calcPositions(),this.reduceTemperature()}for(e=t=null,a=0;a<this.vertexArray.length;a++)o=this.vertexArray[a],this.isVertexMovable(o)&&(null!=(l=this.getVertexBounds(o))&&(this.cellLocation[a][0]-=l.width/2,this.cellLocation[a][1]-=l.height/2,m=this.graph.snap(this.cellLocation[a][0]),u=this.graph.snap(this.cellLocation[a][1]),this.setVertexLocation(o,m,u),t=null==t?m:Math.min(t,m),e=null==e?u:Math.min(e,u)));a=1-(t||0),o=1-(e||0),null!=i&&(a+=i.x,o+=i.y),this.graph.moveCells(this.vertexArray,a,o)}finally{n.endUpdate()}},mxFastOrganicLayout.prototype.calcPositions=function(){for(var e=0;e<this.vertexArray.length;e++)if(this.isMoveable[e]){(t=Math.sqrt(this.dispX[e]*this.dispX[e]+this.dispY[e]*this.dispY[e]))<.001&&(t=.001);var n=this.dispX[e]/t*Math.min(t,this.temperature),t=this.dispY[e]/t*Math.min(t,this.temperature);this.dispX[e]=0,this.dispY[e]=0,this.cellLocation[e][0]+=n,this.cellLocation[e][1]+=t}},mxFastOrganicLayout.prototype.calcAttraction=function(){for(var e=0;e<this.vertexArray.length;e++)for(var n=0;n<this.neighbours[e].length;n++){var t=this.neighbours[e][n];if(e!=t&&this.isMoveable[e]&&this.isMoveable[t]){(a=(s=this.cellLocation[e][0]-this.cellLocation[t][0])*s+(o=this.cellLocation[e][1]-this.cellLocation[t][1])*o-this.radiusSquared[e]-this.radiusSquared[t])<this.minDistanceLimitSquared&&(a=this.minDistanceLimitSquared);var a,i=Math.sqrt(a),s=s/i*(a=a/this.forceConstant),o=o/i*a;this.dispX[e]-=s,this.dispY[e]-=o,this.dispX[t]+=s,this.dispY[t]+=o}}},mxFastOrganicLayout.prototype.calcRepulsion=function(){for(var e=this.vertexArray.length,n=0;n<e;n++)for(var t=n;t<e;t++){if(!this.allowedToRun)return;if(t!=n&&this.isMoveable[n]&&this.isMoveable[t]){var a=this.cellLocation[n][0]-this.cellLocation[t][0],i=this.cellLocation[n][1]-this.cellLocation[t][1];0==a&&(a=.01+Math.random()),0==i&&(i=.01+Math.random());var s=Math.sqrt(a*a+i*i),o=s-this.radius[n]-this.radius[t];o>this.maxDistanceLimit||(o<this.minDistanceLimit&&(o=this.minDistanceLimit),a=a/s*(o=this.forceConstantSquared/o),i=i/s*o,this.dispX[n]+=a,this.dispY[n]+=i,this.dispX[t]-=a,this.dispY[t]-=i)}}},mxFastOrganicLayout.prototype.reduceTemperature=function(){this.temperature=this.initialTemp*(1-this.iteration/this.maxIterations)},mxCircleLayout.prototype=new mxGraphLayout,mxCircleLayout.prototype.constructor=mxCircleLayout,mxCircleLayout.prototype.radius=null,mxCircleLayout.prototype.moveCircle=!1,mxCircleLayout.prototype.x0=0,mxCircleLayout.prototype.y0=0,mxCircleLayout.prototype.resetEdges=!0,mxCircleLayout.prototype.disableEdgeStyle=!0,mxCircleLayout.prototype.execute=function(e){var n=this.graph.getModel();n.beginUpdate();try{for(var t=0,a=null,i=null,s=[],o=n.getChildCount(e),r=0;r<o;r++){var l=n.getChildAt(e,r);if(this.isVertexIgnored(l))this.isEdgeIgnored(l)||(this.resetEdges&&this.graph.resetEdge(l),this.disableEdgeStyle&&this.setEdgeStyleEnabled(l,!1));else{s.push(l);var d=this.getVertexBounds(l);a=null==a?d.y:Math.min(a,d.y),i=null==i?d.x:Math.min(i,d.x),t=Math.max(t,Math.max(d.width,d.height))}}var c=this.getRadius(s.length,t);this.moveCircle&&(i=this.x0,a=this.y0),this.circle(s,c,i,a)}finally{n.endUpdate()}},mxCircleLayout.prototype.getRadius=function(e,n){return Math.max(e*n/Math.PI,this.radius)},mxCircleLayout.prototype.circle=function(e,n,t,a){for(var i=e.length,s=2*Math.PI/i,o=0;o<i;o++)this.isVertexMovable(e[o])&&this.setVertexLocation(e[o],t+n+n*Math.sin(o*s),a+n+n*Math.cos(o*s))},mxParallelEdgeLayout.prototype=new mxGraphLayout,mxParallelEdgeLayout.prototype.constructor=mxParallelEdgeLayout,mxParallelEdgeLayout.prototype.spacing=20,mxParallelEdgeLayout.prototype.execute=function(e){e=this.findParallels(e),this.graph.model.beginUpdate();try{for(var n in e){var t=e[n];1<t.length&&this.layout(t)}}finally{this.graph.model.endUpdate()}},mxParallelEdgeLayout.prototype.findParallels=function(e){for(var n=this.graph.getModel(),t=[],a=n.getChildCount(e),i=0;i<a;i++){var s=n.getChildAt(e,i);if(!this.isEdgeIgnored(s)){var o=this.getEdgeId(s);null!=o&&(null==t[o]&&(t[o]=[]),t[o].push(s))}}return t},mxParallelEdgeLayout.prototype.getEdgeId=function(e){var n=this.graph.getView(),t=n.getState(e),a=null!=t?t.getVisibleTerminal(!0):n.getVisibleTerminal(e,!0);return e=null!=t?t.getVisibleTerminal(!1):n.getVisibleTerminal(e,!1),null!=a&&null!=e?(a=mxCellPath.create(a),(e=mxCellPath.create(e))<a?e+"-"+a:a+"-"+e):null},mxParallelEdgeLayout.prototype.layout=function(e){var n=e[0];if((o=(t=this.graph.getModel()).getGeometry(t.getTerminal(n,!0)))==(s=t.getGeometry(t.getTerminal(n,!1)))){n=o.x+o.width+this.spacing;for(var t=o.y+o.height/2,a=0;a<e.length;a++)this.route(e[a],n,t),n+=this.spacing}else if(null!=o&&null!=s){n=o.x+o.width/2,t=o.y+o.height/2,a=s.x+s.width/2-n;var i=s.y+s.height/2-t,s=Math.sqrt(a*a+i*i),o=i*this.spacing/s;for(s=a*this.spacing/s,n=n+a/2+o*(e.length-1)/2,t=t+i/2-s*(e.length-1)/2,a=0;a<e.length;a++)this.route(e[a],n,t),n-=o,t+=s}},mxParallelEdgeLayout.prototype.route=function(e,n,t){this.graph.isCellMovable(e)&&this.setEdgePoints(e,[new mxPoint(n,t)])},mxCompositeLayout.prototype=new mxGraphLayout,mxCompositeLayout.prototype.constructor=mxCompositeLayout,mxCompositeLayout.prototype.layouts=null,mxCompositeLayout.prototype.master=null,mxCompositeLayout.prototype.moveCell=function(e,n,t){null!=this.master?this.master.move.apply(this.master,arguments):this.layouts[0].move.apply(this.layouts[0],arguments)},mxCompositeLayout.prototype.execute=function(e){var n=this.graph.getModel();n.beginUpdate();try{for(var t=0;t<this.layouts.length;t++)this.layouts[t].execute.apply(this.layouts[t],arguments)}finally{n.endUpdate()}},mxEdgeLabelLayout.prototype=new mxGraphLayout,mxEdgeLabelLayout.prototype.constructor=mxEdgeLabelLayout,mxEdgeLabelLayout.prototype.execute=function(e){for(var n=this.graph.view,t=this.graph.getModel(),a=[],i=[],s=t.getChildCount(e),o=0;o<s;o++){var r=t.getChildAt(e,o),l=n.getState(r);null!=l&&(this.isVertexIgnored(r)?this.isEdgeIgnored(r)||a.push(l):i.push(l))}this.placeLabels(i,a)},mxEdgeLabelLayout.prototype.placeLabels=function(e,n){var t=this.graph.getModel();t.beginUpdate();try{for(var a=0;a<n.length;a++){var i=n[a];if(null!=i&&null!=i.text&&null!=i.text.boundingBox)for(var s=0;s<e.length;s++){var o=e[s];null!=o&&this.avoid(i,o)}}}finally{t.endUpdate()}},mxEdgeLabelLayout.prototype.avoid=function(e,n){var t=this.graph.getModel(),a=e.text.boundingBox;if(mxUtils.intersects(a,n)){var i=-a.y-a.height+n.y,s=-a.y+n.y+n.height;i=Math.abs(i)<Math.abs(s)?i:s,s=-a.x-a.width+n.x,a=-a.x+n.x+n.width,a=Math.abs(s)<Math.abs(a)?s:a;Math.abs(a)<Math.abs(i)?i=0:a=0,null!=(s=t.getGeometry(e.cell))&&(null!=(s=s.clone()).offset?(s.offset.x+=a,s.offset.y+=i):s.offset=new mxPoint(a,i),t.setGeometry(e.cell,s))}},mxGraphAbstractHierarchyCell.prototype.maxRank=-1,mxGraphAbstractHierarchyCell.prototype.minRank=-1,mxGraphAbstractHierarchyCell.prototype.x=null,mxGraphAbstractHierarchyCell.prototype.y=null,mxGraphAbstractHierarchyCell.prototype.width=0,mxGraphAbstractHierarchyCell.prototype.height=0,mxGraphAbstractHierarchyCell.prototype.nextLayerConnectedCells=null,mxGraphAbstractHierarchyCell.prototype.previousLayerConnectedCells=null,mxGraphAbstractHierarchyCell.prototype.temp=null,mxGraphAbstractHierarchyCell.prototype.getNextLayerConnectedCells=function(e){return null},mxGraphAbstractHierarchyCell.prototype.getPreviousLayerConnectedCells=function(e){return null},mxGraphAbstractHierarchyCell.prototype.isEdge=function(){return!1},mxGraphAbstractHierarchyCell.prototype.isVertex=function(){return!1},mxGraphAbstractHierarchyCell.prototype.getGeneralPurposeVariable=function(e){return null},mxGraphAbstractHierarchyCell.prototype.setGeneralPurposeVariable=function(e,n){return null},mxGraphAbstractHierarchyCell.prototype.setX=function(e,n){this.isVertex()?this.x[0]=n:this.isEdge()&&(this.x[e-this.minRank-1]=n)},mxGraphAbstractHierarchyCell.prototype.getX=function(e){return this.isVertex()?this.x[0]:this.isEdge()?this.x[e-this.minRank-1]:0},mxGraphAbstractHierarchyCell.prototype.setY=function(e,n){this.isVertex()?this.y[0]=n:this.isEdge()&&(this.y[e-this.minRank-1]=n)},mxGraphHierarchyNode.prototype=new mxGraphAbstractHierarchyCell,mxGraphHierarchyNode.prototype.constructor=mxGraphHierarchyNode,mxGraphHierarchyNode.prototype.cell=null,mxGraphHierarchyNode.prototype.connectsAsTarget=[],mxGraphHierarchyNode.prototype.connectsAsSource=[],mxGraphHierarchyNode.prototype.hashCode=!1,mxGraphHierarchyNode.prototype.getRankValue=function(e){return this.maxRank},mxGraphHierarchyNode.prototype.getNextLayerConnectedCells=function(e){if(null==this.nextLayerConnectedCells){this.nextLayerConnectedCells=[],this.nextLayerConnectedCells[0]=[];for(var n=0;n<this.connectsAsTarget.length;n++){var t=this.connectsAsTarget[n];-1==t.maxRank||t.maxRank==e+1?this.nextLayerConnectedCells[0].push(t.source):this.nextLayerConnectedCells[0].push(t)}}return this.nextLayerConnectedCells[0]},mxGraphHierarchyNode.prototype.getPreviousLayerConnectedCells=function(e){if(null==this.previousLayerConnectedCells){this.previousLayerConnectedCells=[],this.previousLayerConnectedCells[0]=[];for(var n=0;n<this.connectsAsSource.length;n++){var t=this.connectsAsSource[n];-1==t.minRank||t.minRank==e-1?this.previousLayerConnectedCells[0].push(t.target):this.previousLayerConnectedCells[0].push(t)}}return this.previousLayerConnectedCells[0]},mxGraphHierarchyNode.prototype.isVertex=function(){return!0},mxGraphHierarchyNode.prototype.getGeneralPurposeVariable=function(e){return this.temp[0]},mxGraphHierarchyNode.prototype.setGeneralPurposeVariable=function(e,n){this.temp[0]=n},mxGraphHierarchyNode.prototype.isAncestor=function(e){if(null!=e&&null!=this.hashCode&&null!=e.hashCode&&this.hashCode.length<e.hashCode.length){if(this.hashCode==e.hashCode)return!0;if(null==this.hashCode||null==this.hashCode)return!1;for(var n=0;n<this.hashCode.length;n++)if(this.hashCode[n]!=e.hashCode[n])return!1;return!0}return!1},mxGraphHierarchyNode.prototype.getCoreCell=function(){return this.cell},mxGraphHierarchyEdge.prototype=new mxGraphAbstractHierarchyCell,mxGraphHierarchyEdge.prototype.constructor=mxGraphHierarchyEdge,mxGraphHierarchyEdge.prototype.edges=null,mxGraphHierarchyEdge.prototype.source=null,mxGraphHierarchyEdge.prototype.target=null,mxGraphHierarchyEdge.prototype.isReversed=!1,mxGraphHierarchyEdge.prototype.invert=function(e){e=this.source,this.source=this.target,this.target=e,this.isReversed=!this.isReversed},mxGraphHierarchyEdge.prototype.getNextLayerConnectedCells=function(e){if(null==this.nextLayerConnectedCells){this.nextLayerConnectedCells=[];for(var n=0;n<this.temp.length;n++)this.nextLayerConnectedCells[n]=[],n==this.temp.length-1?this.nextLayerConnectedCells[n].push(this.source):this.nextLayerConnectedCells[n].push(this)}return this.nextLayerConnectedCells[e-this.minRank-1]},mxGraphHierarchyEdge.prototype.getPreviousLayerConnectedCells=function(e){if(null==this.previousLayerConnectedCells){this.previousLayerConnectedCells=[];for(var n=0;n<this.temp.length;n++)this.previousLayerConnectedCells[n]=[],0==n?this.previousLayerConnectedCells[n].push(this.target):this.previousLayerConnectedCells[n].push(this)}return this.previousLayerConnectedCells[e-this.minRank-1]},mxGraphHierarchyEdge.prototype.isEdge=function(){return!0},mxGraphHierarchyEdge.prototype.getGeneralPurposeVariable=function(e){return this.temp[e-this.minRank-1]},mxGraphHierarchyEdge.prototype.setGeneralPurposeVariable=function(e,n){this.temp[e-this.minRank-1]=n},mxGraphHierarchyEdge.prototype.getCoreCell=function(){return null!=this.edges&&0<this.edges.length?this.edges[0]:null},mxGraphHierarchyModel.prototype.maxRank=null,mxGraphHierarchyModel.prototype.vertexMapper=null,mxGraphHierarchyModel.prototype.edgeMapper=null,mxGraphHierarchyModel.prototype.ranks=null,mxGraphHierarchyModel.prototype.roots=null,mxGraphHierarchyModel.prototype.parent=null,mxGraphHierarchyModel.prototype.dfsCount=0,mxGraphHierarchyModel.prototype.SOURCESCANSTARTRANK=1e8,mxGraphHierarchyModel.prototype.tightenToSource=!1,mxGraphHierarchyModel.prototype.createInternalCells=function(e,n,t){for(var a=e.getGraph(),i=0;i<n.length;i++){t[i]=new mxGraphHierarchyNode(n[i]);var s=mxCellPath.create(n[i]);this.vertexMapper[s]=t[i],s=e.getEdges(n[i]),t[i].connectsAsSource=[];for(var o=0;o<s.length;o++){if((d=e.getVisibleTerminal(s[o],!1))!=n[i]&&d!=n[i]&&e.graph.model.isVertex(d)&&!e.isVertexIgnored(d)){var r=e.getEdgesBetween(n[i],d,!1),l=e.getEdgesBetween(n[i],d,!0),d=mxCellPath.create(r[0]);if(null!=r&&0<r.length&&null==this.edgeMapper[d]&&2*l.length>=r.length){l=new mxGraphHierarchyEdge(r);for(var c=0;c<r.length;c++){var m=r[c];d=mxCellPath.create(m);this.edgeMapper[d]=l,a.resetEdge(m),e.disableEdgeStyle&&(e.setEdgeStyleEnabled(m,!1),e.setOrthogonalEdge(m,!0))}l.source=t[i],mxUtils.indexOf(t[i].connectsAsSource,l)<0&&t[i].connectsAsSource.push(l)}}}t[i].temp[0]=0}},mxGraphHierarchyModel.prototype.initialRank=function(){var e=[];if(null!=this.roots)for(var n=0;n<this.roots.length;n++){var t=mxCellPath.create(this.roots[n]);null!=(t=this.vertexMapper[t])&&e.push(t)}for(var a in this.vertexMapper)(t=this.vertexMapper[a]).temp[0]=-1;for(var i=e.slice();0<e.length;){var s,o;s=(t=e[0]).connectsAsTarget,o=t.connectsAsSource;var r=!0,l=this.SOURCESCANSTARTRANK;for(n=0;n<s.length;n++){var d=s[n];if(5270620!=d.temp[0]){r=!1;break}d=d.source,l=Math.min(l,d.temp[0]-1)}if(r){if(t.temp[0]=l,this.maxRank=Math.min(this.maxRank,l),null!=o)for(n=0;n<o.length;n++)(d=o[n]).temp[0]=5270620,-1==(d=d.target).temp[0]&&(e.push(d),d.temp[0]=-2);e.shift()}else if(n=e.shift(),e.push(t),n==t&&1==e.length)break}for(a in this.vertexMapper)(t=this.vertexMapper[a]).temp[0]-=this.maxRank;for(n=0;n<i.length;n++)for(e=0,s=(t=i[n]).connectsAsSource,a=0;a<s.length;a++)d=(d=s[a]).target,t.temp[0]=Math.max(e,d.temp[0]+1),e=t.temp[0];this.maxRank=this.SOURCESCANSTARTRANK-this.maxRank},mxGraphHierarchyModel.prototype.fixRanks=function(){var s=[];this.ranks=[];for(var e=0;e<this.maxRank+1;e++)s[e]=[],this.ranks[e]=s[e];var n=null;if(null!=this.roots){var t=this.roots;for(n=[],e=0;e<t.length;e++){var a=mxCellPath.create(t[e]);n[e]=this.vertexMapper[a]}}this.visit(function(e,n,t,a,i){if(0==i&&n.maxRank<0&&n.minRank<0&&(s[n.temp[0]].push(n),n.maxRank=n.temp[0],n.minRank=n.temp[0],n.temp[0]=s[n.maxRank].length-1),null!=e&&null!=t&&1<e.maxRank-n.maxRank)for(t.maxRank=e.maxRank,t.minRank=n.maxRank,t.temp=[],t.x=[],t.y=[],e=t.minRank+1;e<t.maxRank;e++)s[e].push(t),t.setGeneralPurposeVariable(e,s[e].length-1)},n,!1,null)},mxGraphHierarchyModel.prototype.visit=function(e,n,t,a){if(null!=n){for(var i=0;i<n.length;i++){var s=n[i];null!=s&&(null==a&&(a={}),t?(s.hashCode=[],s.hashCode[0]=this.dfsCount,s.hashCode[1]=i,this.extendedDfs(null,s,null,e,a,s.hashCode,i,0)):this.dfs(null,s,null,e,a,0))}this.dfsCount++}},mxGraphHierarchyModel.prototype.dfs=function(e,n,t,a,i,s){if(null!=n){var o=mxCellPath.create(n.cell);if(null==i[o])for(a(e,i[o]=n,t,s,0),e=n.connectsAsSource.slice(),t=0;t<e.length;t++)o=e[t],this.dfs(n,o.target,o,a,i,s+1);else a(e,n,t,s,1)}},mxGraphHierarchyModel.prototype.extendedDfs=function(e,n,t,a,i,s,o,r){if(null!=n)if(null==e||null!=n.hashCode&&n.hashCode[0]==e.hashCode[0]||(s=e.hashCode.length+1,n.hashCode=e.hashCode.slice(),n.hashCode[s-1]=o),null==i[o=mxCellPath.create(n.cell)])for(a(e,i[o]=n,t,r,0),e=n.connectsAsSource.slice(),t=0;t<e.length;t++)o=e[t],this.extendedDfs(n,o.target,o,a,i,n.hashCode,t,r+1);else a(e,n,t,r,1)},mxHierarchicalLayoutStage.prototype.execute=function(e){},mxMedianHybridCrossingReduction.prototype=new mxHierarchicalLayoutStage,mxMedianHybridCrossingReduction.prototype.constructor=mxMedianHybridCrossingReduction,mxMedianHybridCrossingReduction.prototype.layout=null,mxMedianHybridCrossingReduction.prototype.maxIterations=24,mxMedianHybridCrossingReduction.prototype.nestedBestRanks=null,mxMedianHybridCrossingReduction.prototype.currentBestCrossings=0,mxMedianHybridCrossingReduction.prototype.iterationsWithoutImprovement=0,mxMedianHybridCrossingReduction.prototype.maxNoImprovementIterations=2,mxMedianHybridCrossingReduction.prototype.execute=function(e){e=this.layout.getModel(),this.nestedBestRanks=[];for(var n=0;n<e.ranks.length;n++)this.nestedBestRanks[n]=e.ranks[n].slice();var t=0,a=this.calculateCrossings(e);for(n=0;n<this.maxIterations&&t<this.maxNoImprovementIterations;n++){this.weightedMedian(n,e),this.transpose(n,e);var i=this.calculateCrossings(e);if(i<a)for(a=i,i=t=0;i<this.nestedBestRanks.length;i++)for(var s=e.ranks[i],o=0;o<s.length;o++){var r=s[o];this.nestedBestRanks[i][r.getGeneralPurposeVariable(i)]=r}else for(t++,i=0;i<this.nestedBestRanks.length;i++)for(s=e.ranks[i],o=0;o<s.length;o++)(r=s[o]).setGeneralPurposeVariable(i,o);if(0==a)break}for(t=[],a=[],n=0;n<e.maxRank+1;n++)a[n]=[],t[n]=a[n];for(n=0;n<this.nestedBestRanks.length;n++)for(i=0;i<this.nestedBestRanks[n].length;i++)a[n].push(this.nestedBestRanks[n][i]);e.ranks=t},mxMedianHybridCrossingReduction.prototype.calculateCrossings=function(e){for(var n=e.ranks.length,t=0,a=1;a<n;a++)t+=this.calculateRankCrossing(a,e);return t},mxMedianHybridCrossingReduction.prototype.calculateRankCrossing=function(e,n){for(var t=0,a=n.ranks[e],i=a.length,s=n.ranks[e-1].length,o=[],r=0;r<i;r++)o[r]=[];for(r=0;r<a.length;r++)for(var l=(c=a[r]).getGeneralPurposeVariable(e),d=c.getPreviousLayerConnectedCells(e),c=0;c<d.length;c++){var m=d[c].getGeneralPurposeVariable(e-1);o[l][m]=201207}for(r=0;r<i;r++)for(c=0;c<s;c++)if(201207==o[r][c]){for(a=r+1;a<i;a++)for(l=0;l<c;l++)201207==o[a][l]&&t++;for(a=0;a<r;a++)for(l=c+1;l<s;l++)201207==o[a][l]&&t++}return t/2},mxMedianHybridCrossingReduction.prototype.transpose=function(e,n){for(var t=!0,a=0;t&&a++<10;)for(var i=1==e%2&&1==a%2,s=(t=!1,0);s<n.ranks.length;s++){for(var o=n.ranks[s],r=[],l=0;l<o.length;l++){(b=(f=o[l]).getGeneralPurposeVariable(s))<0&&(b=l),r[b]=f}var d=b=f=null,c=null,m=null,u=null,p=null,g=null,v=null,h=null;for(l=0;l<o.length-1;l++){if(0==l){for(var f=(v=r[l]).getNextLayerConnectedCells(s),b=v.getPreviousLayerConnectedCells(s),A=(m=[],u=[],0);A<f.length;A++)m[A]=f[A].getGeneralPurposeVariable(s+1);for(A=0;A<b.length;A++)u[A]=b[A].getGeneralPurposeVariable(s-1)}else f=d,b=c,m=p,u=g,v=h;for(d=(h=r[l+1]).getNextLayerConnectedCells(s),c=h.getPreviousLayerConnectedCells(s),p=[],g=[],A=0;A<d.length;A++)p[A]=d[A].getGeneralPurposeVariable(s+1);for(A=0;A<c.length;A++)g[A]=c[A].getGeneralPurposeVariable(s-1);var E=0,y=0;for(A=0;A<m.length;A++)for(var S=0;S<p.length;S++)m[A]>p[S]&&E++,m[A]<p[S]&&y++;for(A=0;A<u.length;A++)for(S=0;S<g.length;S++)u[A]>g[S]&&E++,u[A]<g[S]&&y++;(y<E||y==E&&i)&&(d=v.getGeneralPurposeVariable(s),v.setGeneralPurposeVariable(s,h.getGeneralPurposeVariable(s)),h.setGeneralPurposeVariable(s,d),d=f,c=b,p=m,g=u,h=v,i||(t=!0))}}},mxMedianHybridCrossingReduction.prototype.weightedMedian=function(e,n){var t=0==e%2;if(t)for(var a=n.maxRank-1;0<=a;a--)this.medianRank(a,t);else for(a=1;a<n.maxRank;a++)this.medianRank(a,t)},mxMedianHybridCrossingReduction.prototype.medianRank=function(e,n){for(var t=this.nestedBestRanks[e].length,a=[],i=[],s=0;s<t;s++){var o,r,l=this.nestedBestRanks[e][s],d=new MedianCellSorter;d.cell=l,r=n?e+1:e-1,null!=(o=n?l.getNextLayerConnectedCells(e):l.getPreviousLayerConnectedCells(e))&&0!=o.length?(d.medianValue=this.medianValue(o,r),a.push(d)):i[l.getGeneralPurposeVariable(e)]=!0}for(a.sort(MedianCellSorter.prototype.compare),s=0;s<t;s++)null==i[s]&&(l=a.shift().cell).setGeneralPurposeVariable(e,s)},mxMedianHybridCrossingReduction.prototype.medianValue=function(e,n){for(var t=[],a=0,i=0;i<e.length;i++){var s=e[i];t[a++]=s.getGeneralPurposeVariable(n)}return t.sort(function(e,n){return e-n}),1==a%2?t[Math.floor(a/2)]:2==a?(t[0]+t[1])/2:(s=t[(i=a/2)-1]-t[0],a=t[a-1]-t[i],(t[i-1]*a+t[i]*s)/(s+a))},MedianCellSorter.prototype.medianValue=0,MedianCellSorter.prototype.cell=!1,MedianCellSorter.prototype.compare=function(e,n){return null!=e&&null!=n?n.medianValue>e.medianValue?-1:n.medianValue<e.medianValue?1:0:0},mxMinimumCycleRemover.prototype=new mxHierarchicalLayoutStage,mxMinimumCycleRemover.prototype.constructor=mxMinimumCycleRemover,mxMinimumCycleRemover.prototype.layout=null,mxMinimumCycleRemover.prototype.execute=function(e){var n=this.layout.getModel(),s={},o=mxUtils.clone(n.vertexMapper,null,!0),t=null;if(null!=n.roots){var a=n.roots;t=[];for(e=0;e<a.length;e++){var i=mxCellPath.create(a[e]);t[e]=n.vertexMapper[i]}}if(n.visit(function(e,n,t,a,i){n.isAncestor(e)&&(t.invert(),mxUtils.remove(t,e.connectsAsSource),e.connectsAsTarget.push(t),mxUtils.remove(t,n.connectsAsTarget),n.connectsAsSource.push(t)),e=mxCellPath.create(n.cell),s[e]=n,delete o[e]},t,!0,null),t=null,0<o.lenth&&(t=mxUtils.clone(o,null,!0)),e=mxUtils.clone(s,null,!0),n.visit(function(e,n,t,a,i){n.isAncestor(e)&&(t.invert(),mxUtils.remove(t,e.connectsAsSource),n.connectsAsSource.push(t),e.connectsAsTarget.push(t),mxUtils.remove(t,n.connectsAsTarget)),e=mxCellPath.create(n.cell),s[e]=n,delete o[e]},o,!0,e),a=this.layout.getGraph(),null!=t&&0<t.length)for(n=n.roots,e=0;e<t.length;e++)i=t[e].cell,0==a.getIncomingEdges(i).length&&n.push(i)};var mxHierarchicalEdgeStyle={ORTHOGONAL:1,POLYLINE:2,STRAIGHT:3,CURVE:4};function WeightedCellSorter(e,n){this.cell=e,this.weightedValue=n}function mxHierarchicalLayout(e,n,t){mxGraphLayout.call(this,e),this.orientation=null!=n?n:mxConstants.DIRECTION_NORTH,this.deterministic=null==t||t}function mxGraphModel(e){this.currentEdit=this.createUndoableEdit(),null!=e?this.setRoot(e):this.clear()}function mxRootChange(e,n){this.model=e,this.previous=this.root=n}function mxChildChange(e,n,t,a){this.model=e,this.previous=this.parent=n,this.child=t,this.previousIndex=this.index=a}function mxTerminalChange(e,n,t,a){this.model=e,this.cell=n,this.previous=this.terminal=t,this.source=a}function mxValueChange(e,n,t){this.model=e,this.cell=n,this.previous=this.value=t}function mxStyleChange(e,n,t){this.model=e,this.cell=n,this.previous=this.style=t}function mxGeometryChange(e,n,t){this.model=e,this.cell=n,this.previous=this.geometry=t}function mxCollapseChange(e,n,t){this.model=e,this.cell=n,this.previous=this.collapsed=t}function mxVisibleChange(e,n,t){this.model=e,this.cell=n,this.previous=this.visible=t}function mxCellAttributeChange(e,n,t){this.cell=e,this.attribute=n,this.previous=this.value=t}function mxCell(e,n,t){this.value=e,this.setGeometry(n),this.setStyle(t),null!=this.onInit&&this.onInit()}function mxGeometry(e,n,t,a){mxRectangle.call(this,e,n,t,a)}mxCoordinateAssignment.prototype=new mxHierarchicalLayoutStage,mxCoordinateAssignment.prototype.constructor=mxCoordinateAssignment,mxCoordinateAssignment.prototype.layout=null,mxCoordinateAssignment.prototype.intraCellSpacing=30,mxCoordinateAssignment.prototype.interRankCellSpacing=100,mxCoordinateAssignment.prototype.parallelEdgeSpacing=10,mxCoordinateAssignment.prototype.maxIterations=8,mxCoordinateAssignment.prototype.prefHozEdgeSep=5,mxCoordinateAssignment.prototype.prefVertEdgeOff=2,mxCoordinateAssignment.prototype.minEdgeJetty=12,mxCoordinateAssignment.prototype.channelBuffer=4,mxCoordinateAssignment.prototype.jettyPositions=null,mxCoordinateAssignment.prototype.orientation=mxConstants.DIRECTION_NORTH,mxCoordinateAssignment.prototype.initialX=null,mxCoordinateAssignment.prototype.limitX=null,mxCoordinateAssignment.prototype.currentXDelta=null,mxCoordinateAssignment.prototype.widestRank=null,mxCoordinateAssignment.prototype.rankTopY=null,mxCoordinateAssignment.prototype.rankBottomY=null,mxCoordinateAssignment.prototype.widestRankValue=null,mxCoordinateAssignment.prototype.rankWidths=null,mxCoordinateAssignment.prototype.rankY=null,mxCoordinateAssignment.prototype.fineTuning=!0,mxCoordinateAssignment.prototype.edgeStyle=mxHierarchicalEdgeStyle.POLYLINE,mxCoordinateAssignment.prototype.nextLayerConnectedCache=null,mxCoordinateAssignment.prototype.previousLayerConnectedCache=null,mxCoordinateAssignment.prototype.groupPadding=10,mxCoordinateAssignment.prototype.printStatus=function(){var e=this.layout.getModel();mxLog.show(),mxLog.writeln("======Coord assignment debug=======");for(var n=0;n<e.ranks.length;n++){mxLog.write("Rank ",n," : ");for(var t=e.ranks[n],a=0;a<t.length;a++)mxLog.write(t[a].getGeneralPurposeVariable(n),"  ");mxLog.writeln()}mxLog.writeln("====================================")},mxCoordinateAssignment.prototype.execute=function(e){this.jettyPositions=[],e=this.layout.getModel(),this.currentXDelta=0,this.initialCoords(this.layout.getGraph(),e),this.fineTuning&&this.minNode(e);var n=1e8;if(this.fineTuning)for(var t=0;t<this.maxIterations;t++){if(0!=t&&(this.medianPos(t,e),this.minNode(e)),this.currentXDelta<n){for(var a=0;a<e.ranks.length;a++)for(var i=e.ranks[a],s=0;s<i.length;s++){var o=i[s];o.setX(a,o.getGeneralPurposeVariable(a))}n=this.currentXDelta}else for(a=0;a<e.ranks.length;a++)for(i=e.ranks[a],s=0;s<i.length;s++)(o=i[s]).setGeneralPurposeVariable(a,o.getX(a));this.minPath(this.layout.getGraph(),e),this.currentXDelta=0}this.setCellLocations(this.layout.getGraph(),e)},mxCoordinateAssignment.prototype.minNode=function(e){for(var n=[],t=[],a=[],i=0;i<=e.maxRank;i++){a[i]=e.ranks[i];for(var s=0;s<a[i].length;s++){var o=a[i][s];(r=new WeightedCellSorter(o,i)).rankIndex=s,r.visited=!0,n.push(r),t[o=mxCellPath.create(o.getCoreCell())]=r}}for(e=10*n.length,s=0;0<n.length&&s<=e;){i=(r=n.shift()).cell;var r,l=r.weightedValue,d=parseInt(r.rankIndex),c=(o=i.getNextLayerConnectedCells(l),i.getPreviousLayerConnectedCells(l)),m=o.length,u=c.length,p=this.medianXValue(o,l+1),g=this.medianXValue(c,l-1),v=m+u,h=i.getGeneralPurposeVariable(l),f=h;if(0<v&&(f=(p*m+g*u)/v),m=!1,f<h-1?0==d?(i.setGeneralPurposeVariable(l,f),m=!0):(h=(h=(d=a[l][d-1]).getGeneralPurposeVariable(l))+d.width/2+this.intraCellSpacing+i.width/2)<f?(i.setGeneralPurposeVariable(l,f),m=!0):h<i.getGeneralPurposeVariable(l)-1&&(i.setGeneralPurposeVariable(l,h),m=!0):h+1<f&&(d==a[l].length-1?(i.setGeneralPurposeVariable(l,f),m=!0):f<(h=(h=(d=a[l][d+1]).getGeneralPurposeVariable(l))-d.width/2-this.intraCellSpacing-i.width/2)?(i.setGeneralPurposeVariable(l,f),m=!0):h>i.getGeneralPurposeVariable(l)+1&&(i.setGeneralPurposeVariable(l,h),m=!0)),m){for(i=0;i<o.length;i++)l=o[i],null!=(l=t[l=mxCellPath.create(l.getCoreCell())])&&0==l.visited&&(l.visited=!0,n.push(l));for(i=0;i<c.length;i++)l=c[i],null!=(l=t[l=mxCellPath.create(l.getCoreCell())])&&0==l.visited&&(l.visited=!0,n.push(l))}r.visited=!1,s++}},mxCoordinateAssignment.prototype.medianPos=function(e,n){if(0==e%2)for(var t=n.maxRank;0<t;t--)this.rankMedianPosition(t-1,n,t);else for(t=0;t<n.maxRank-1;t++)this.rankMedianPosition(t+1,n,t)},mxCoordinateAssignment.prototype.rankMedianPosition=function(e,n,t){n=n.ranks[e];for(var a=[],i=[],s=0;s<n.length;s++){var o=n[s];a[s]=new WeightedCellSorter,a[s].cell=o,a[s].rankIndex=s;var r=mxCellPath.create(o.getCoreCell());i[r]=a[s];var l=null;l=t<e?o.getPreviousLayerConnectedCells(e):o.getNextLayerConnectedCells(e);a[s].weightedValue=this.calculatedWeightedValue(o,l)}for(a.sort(WeightedCellSorter.prototype.compare),s=0;s<a.length;s++){r=0,o=a[s].cell,r=0,null!=(l=t<e?o.getPreviousLayerConnectedCells(e).slice():o.getNextLayerConnectedCells(e).slice())&&(r=0<(r=l.length)?this.medianXValue(l,t):o.getGeneralPurposeVariable(e));for(var d=0,c=(l=-1e8,a[s].rankIndex-1);0<=c;){var m;if(null!=(m=i[m=mxCellPath.create(n[c].getCoreCell())])){var u=m.cell;m.visited?(l=u.getGeneralPurposeVariable(e)+u.width/2+this.intraCellSpacing+d+o.width/2,c=-1):(d+=u.width+this.intraCellSpacing,c--)}}for(d=0,u=1e8,c=a[s].rankIndex+1;c<a.length;)if(null!=(m=i[m=mxCellPath.create(n[c].getCoreCell())])){var p=m.cell;m.visited?(u=p.getGeneralPurposeVariable(e)-p.width/2-this.intraCellSpacing-d-o.width/2,c=a.length):(d+=p.width+this.intraCellSpacing,c++)}l<=r&&r<=u?o.setGeneralPurposeVariable(e,r):r<l?(o.setGeneralPurposeVariable(e,l),this.currentXDelta+=l-r):u<r&&(o.setGeneralPurposeVariable(e,u),this.currentXDelta+=r-u),a[s].visited=!0}},mxCoordinateAssignment.prototype.calculatedWeightedValue=function(e,n){for(var t=0,a=0;a<n.length;a++){var i=n[a];e.isVertex()&&i.isVertex()?t++:t=e.isEdge()&&i.isEdge()?t+8:t+2}return t},mxCoordinateAssignment.prototype.medianXValue=function(e,n){if(0==e.length)return 0;for(var t=[],a=0;a<e.length;a++)t[a]=e[a].getGeneralPurposeVariable(n);return t.sort(function(e,n){return e-n}),1==e.length%2?t[Math.floor(e.length/2)]:(t[(a=e.length/2)-1]+t[a])/2},mxCoordinateAssignment.prototype.initialCoords=function(e,n){this.calculateWidestRank(e,n);for(var t=this.widestRank;0<=t;t--)t<n.maxRank&&this.rankCoordinates(t,e,n);for(t=this.widestRank+1;t<=n.maxRank;t++)0<t&&this.rankCoordinates(t,e,n)},mxCoordinateAssignment.prototype.rankCoordinates=function(e,n,t){n=t.ranks[e],t=0;for(var a=this.initialX+(this.widestRankValue-this.rankWidths[e])/2,i=!1,s=0;s<n.length;s++){var o=n[s];if(o.isVertex()){var r=this.layout.getVertexBounds(o.cell);null!=r?this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(o.width=r.width,o.height=r.height):(o.width=r.height,o.height=r.width):i=!0,t=Math.max(t,o.height)}else o.isEdge()&&(r=1,null!=o.edges?r=o.edges.length:mxLog.warn("edge.edges is null"),o.width=(r-1)*this.parallelEdgeSpacing);a+=o.width/2,o.setX(e,a),o.setGeneralPurposeVariable(e,a),a+=o.width/2,a+=this.intraCellSpacing}1==i&&mxLog.warn("At least one cell has no bounds")},mxCoordinateAssignment.prototype.calculateWidestRank=function(e,n){var t=-this.interRankCellSpacing,a=0;this.rankWidths=[],this.rankY=[];for(var i=n.maxRank;0<=i;i--){for(var s=0,o=n.ranks[i],r=this.initialX,l=!1,d=0;d<o.length;d++){var c=o[d];if(c.isVertex()){var m=this.layout.getVertexBounds(c.cell);null!=m?this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(c.width=m.width,c.height=m.height):(c.width=m.height,c.height=m.width):l=!0,s=Math.max(s,c.height)}else c.isEdge()&&(m=1,null!=c.edges?m=c.edges.length:mxLog.warn("edge.edges is null"),c.width=(m-1)*this.parallelEdgeSpacing);r+=c.width/2,c.setX(i,r),c.setGeneralPurposeVariable(i,r),r+=c.width/2,(r+=this.intraCellSpacing)>this.widestRankValue&&(this.widestRankValue=r,this.widestRank=i),this.rankWidths[i]=r}for(1==l&&mxLog.warn("At least one cell has no bounds"),this.rankY[i]=t,r=s/2+a/2+this.interRankCellSpacing,a=s,t=this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_WEST?t+r:t-r,d=0;d<o.length;d++)o[d].setY(i,t)}},mxCoordinateAssignment.prototype.minPath=function(e,n){var t,a=n.edgeMapper;for(t in a){var i=a[t];if(!(i.maxRank-i.minRank-1<1)){for(var s=i.getGeneralPurposeVariable(i.minRank+1),o=!0,r=0,l=i.minRank+2;l<i.maxRank;l++){s!=(d=i.getGeneralPurposeVariable(l))?(o=!1,s=d):r++}if(!o){o=s=0;var d=[],c=[],m=i.getGeneralPurposeVariable(i.minRank+1);for(l=i.minRank+1;l<i.maxRank-1;l++){var u=i.getX(l+1);m==u?(d[l-i.minRank-1]=m,s++):this.repositionValid(n,i,l+1,m)?(d[l-i.minRank-1]=m,s++):m=d[l-i.minRank-1]=u}for(m=i.getX(l),l=i.maxRank-1;l>i.minRank+1;l--)m==(u=i.getX(l-1))?(c[l-i.minRank-2]=m,o++):this.repositionValid(n,i,l-1,m)?(c[l-i.minRank-2]=m,o++):(c[l-i.minRank-2]=i.getX(l-1),m=u);if(r<o||r<s)if(s<=o)for(l=i.maxRank-2;l>i.minRank;l--)i.setX(l,c[l-i.minRank-1]);else if(o<s)for(l=i.minRank+2;l<i.maxRank;l++)i.setX(l,d[l-i.minRank-2])}}}},mxCoordinateAssignment.prototype.repositionValid=function(e,n,t,a){e=e.ranks[t];for(var i=-1,s=0;s<e.length;s++)if(n==e[s]){i=s;break}if(i<0)return!1;if(a<(s=n.getGeneralPurposeVariable(t))){if(0==i)return!0;if(!((t=(t=(e=e[i-1]).getGeneralPurposeVariable(t))+e.width/2+this.intraCellSpacing+n.width/2)<=a))return!1}else if(s<a){if(i==e.length-1)return!0;if(!(a<=(t=(t=(e=e[i+1]).getGeneralPurposeVariable(t))-e.width/2-this.intraCellSpacing-n.width/2)))return!1}return!0},mxCoordinateAssignment.prototype.setCellLocations=function(e,n){this.rankTopY=[],this.rankBottomY=[];for(var t=0;t<n.ranks.length;t++)this.rankTopY[t]=Number.MAX_VALUE,this.rankBottomY[t]=0;t=null,this.layout.resizeParent&&(t={});var a,i=n.edgeMapper,s=n.vertexMapper;for(a in s){var o=s[a];if(this.setVertexLocation(o),this.layout.resizeParent){o=e.model.getParent(o.cell);var r=mxCellPath.create(o);null==t[r]&&(t[r]=o)}}for(a in this.layout.resizeParent&&null!=t&&this.adjustParents(t),(this.edgeStyle==mxHierarchicalEdgeStyle.ORTHOGONAL||this.edgeStyle==mxHierarchicalEdgeStyle.POLYLINE||this.edgeStyle==mxHierarchicalEdgeStyle.CURVE)&&this.localEdgeProcessing(n),i)this.setEdgePosition(i[a])},mxCoordinateAssignment.prototype.adjustParents=function(e){var n,t=[];for(n in e)t.push(e[n]);this.layout.arrangeGroups(mxUtils.sortCells(t,!0),this.groupPadding)},mxCoordinateAssignment.prototype.localEdgeProcessing=function(e){for(var n=0;n<e.ranks.length;n++)for(var t=e.ranks[n],a=0;a<t.length;a++){var i=t[a];if(i.isVertex())for(var s=i.getPreviousLayerConnectedCells(n),o=n-1,r=0;r<2;r++){if(-1<o&&o<e.ranks.length&&null!=s&&0<s.length){for(var l=[],d=0;d<s.length;d++){var c=new WeightedCellSorter(s[d],s[d].getX(o));l.push(c)}l.sort(WeightedCellSorter.prototype.compare);var m=(c=i.x[0]-i.width/2)+i.width,u=s=0;for(o=[],d=0;d<l.length;d++){var p,g=l[d].cell;if(g.isVertex()){p=0==r?i.connectsAsSource:i.connectsAsTarget;for(var v=0;v<p.length;v++)p[v].source!=g&&p[v].target!=g||(s+=p[v].edges.length,u++,o.push(p[v]))}else s+=g.edges.length,u++,o.push(g)}for(i.width>(s+1)*this.prefHozEdgeSep+2*this.prefHozEdgeSep&&(c+=this.prefHozEdgeSep,m-=this.prefHozEdgeSep),c+=(l=(m-c)/s)/2,m=this.minEdgeJetty-this.prefVertEdgeOff,d=u=0;d<o.length;d++){for(g=o[d].edges.length,v=mxCellPath.create(o[d].edges[0]),null==(p=this.jettyPositions[v])&&(p=[],this.jettyPositions[v]=p),d<s/2?m+=this.prefVertEdgeOff:s/2<d&&(m-=this.prefVertEdgeOff),v=0;v<g;v++)p[4*v+2*r]=c,c+=l,p[4*v+2*r+1]=m;u=Math.max(u,m)}}s=i.getNextLayerConnectedCells(n),o=n+1}}},mxCoordinateAssignment.prototype.setEdgePosition=function(e){var n=0;if(101207!=e.temp[0]){var t=e.maxRank,a=e.minRank;t==a&&(t=e.source.maxRank,a=e.target.minRank);for(var i=0,s=mxCellPath.create(e.edges[0]),o=(s=this.jettyPositions[s],e.isReversed?e.target.cell:e.source.cell),r=this.layout.graph,l=0;l<e.edges.length;l++){var d=e.edges[l],c=this.layout.getVisibleTerminal(d,!0),m=r.model.getTerminal(d,!0),u=[],p=e.isReversed;if(c!=o&&(p=!p),null!=s){var g=p?2:0,v=p?this.rankTopY[a]:this.rankBottomY[t],h=s[4*i+1+g];p&&(h=-h),v+=h,g=s[4*i+g],m=r.model.getTerminal(d,!0),this.layout.isPort(m)&&r.model.getParent(m)==c&&(g=null!=(g=r.view.getState(m))?g.x:c.geometry.x+e.source.width*m.geometry.x),this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(u.push(new mxPoint(g,v)),this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(g,v+h))):(u.push(new mxPoint(v,g)),this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(v+h,g)))}for(g=e.x.length-1,v=h=-1,c=e.maxRank-1,p&&(g=0,h=e.x.length,v=1,c=e.minRank+1);e.maxRank!=e.minRank&&g!=h;g+=v){m=e.x[g]+n;var f=(this.rankTopY[c]+this.rankBottomY[c+1])/2,b=(this.rankTopY[c-1]+this.rankBottomY[c])/2;if(p){var A=f;f=b,b=A}this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(u.push(new mxPoint(m,f)),u.push(new mxPoint(m,b))):(u.push(new mxPoint(f,m)),u.push(new mxPoint(b,m))),this.limitX=Math.max(this.limitX,m),c+=v}null!=s&&(g=p?2:0,v=p?this.rankBottomY[t]:this.rankTopY[a],h=s[4*i+3-g],p&&(h=-h),v-=h,g=s[4*i+2-g],p=r.model.getTerminal(d,!1),c=this.layout.getVisibleTerminal(d,!1),this.layout.isPort(p)&&r.model.getParent(p)==c&&(g=null!=(g=r.view.getState(p))?g.x:c.geometry.x+e.target.width*p.geometry.x),this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(g,v-h)),u.push(new mxPoint(g,v))):(this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(v-h,g)),u.push(new mxPoint(v,g)))),e.isReversed&&this.processReversedEdge(e,d),this.layout.setEdgePoints(d,u),n=0==n?this.parallelEdgeSpacing:0<n?-n:-n+this.parallelEdgeSpacing,i++}e.temp[0]=101207}},mxCoordinateAssignment.prototype.setVertexLocation=function(e){var n=e.cell,t=e.x[0]-e.width/2,a=e.y[0]-e.height/2;this.rankTopY[e.minRank]=Math.min(this.rankTopY[e.minRank],a),this.rankBottomY[e.minRank]=Math.max(this.rankBottomY[e.minRank],a+e.height),this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?this.layout.setVertexLocation(n,t,a):this.layout.setVertexLocation(n,a,t),this.limitX=Math.max(this.limitX,t+e.width)},mxCoordinateAssignment.prototype.processReversedEdge=function(e,n){},WeightedCellSorter.prototype.weightedValue=0,WeightedCellSorter.prototype.nudge=!1,WeightedCellSorter.prototype.visited=!1,WeightedCellSorter.prototype.rankIndex=null,WeightedCellSorter.prototype.cell=null,WeightedCellSorter.prototype.compare=function(e,n){return null!=e&&null!=n?n.weightedValue>e.weightedValue?-1:n.weightedValue<e.weightedValue?1:n.nudge?-1:1:0},mxHierarchicalLayout.prototype=new mxGraphLayout,mxHierarchicalLayout.prototype.constructor=mxHierarchicalLayout,mxHierarchicalLayout.prototype.roots=null,mxHierarchicalLayout.prototype.resizeParent=!1,mxHierarchicalLayout.prototype.moveParent=!1,mxHierarchicalLayout.prototype.parentBorder=0,mxHierarchicalLayout.prototype.intraCellSpacing=30,mxHierarchicalLayout.prototype.interRankCellSpacing=100,mxHierarchicalLayout.prototype.interHierarchySpacing=60,mxHierarchicalLayout.prototype.parallelEdgeSpacing=10,mxHierarchicalLayout.prototype.orientation=mxConstants.DIRECTION_NORTH,mxHierarchicalLayout.prototype.fineTuning=!0,mxHierarchicalLayout.prototype.tightenToSource=!0,mxHierarchicalLayout.prototype.disableEdgeStyle=!0,mxHierarchicalLayout.prototype.traverseAncestors=!0,mxHierarchicalLayout.prototype.model=null,mxHierarchicalLayout.prototype.edgesCache=null,mxHierarchicalLayout.prototype.getModel=function(){return this.model},mxHierarchicalLayout.prototype.execute=function(e,n){this.parent=e;var t=this.graph.model;if(this.edgesCache={},null!=n||null!=e){if(null!=n&&null!=e){for(var a=[],i=0;i<n.length;i++)t.isAncestor(e,n[i])&&a.push(n[i]);this.roots=a}else this.roots=n;t.beginUpdate();try{this.run(e),this.resizeParent&&!this.graph.isCellCollapsed(e)&&this.graph.updateGroupBounds([e],this.parentBorder,this.moveParent)}finally{t.endUpdate()}}},mxHierarchicalLayout.prototype.findRoots=function(e,n){var t=[];if(null!=e&&null!=n){var a,i=this.graph.model,s=null,o=-1e5;for(a in n){var r=n[a];if(i.isVertex(r)&&this.graph.isCellVisible(r)){for(var l=this.getEdges(r),d=0,c=0,m=0;m<l.length;m++)this.getVisibleTerminal(l[m],!0)==r?d++:c++;0==c&&0<d&&t.push(r),o<(l=d-c)&&(o=l,s=r)}}0==t.length&&null!=s&&t.push(s)}return t},mxHierarchicalLayout.prototype.getEdges=function(e){var n=mxCellPath.create(e);if(null!=this.edgesCache[n])return this.edgesCache[n];for(var t=this.graph.model,a=[],i=this.graph.isCellCollapsed(e),s=t.getChildCount(e),o=0;o<s;o++){var r=t.getChildAt(e,o);this.isPort(r)?a=a.concat(t.getEdges(r,!0,!0)):!i&&this.graph.isCellVisible(r)||(a=a.concat(t.getEdges(r,!0,!0)))}for(a=a.concat(t.getEdges(e,!0,!0)),t=[],o=0;o<a.length;o++)((i=this.getVisibleTerminal(a[o],!0))==(s=this.getVisibleTerminal(a[o],!1))||i!=s&&(s==e&&(null==this.parent||this.graph.isValidAncestor(i,this.parent,this.traverseAncestors))||i==e&&(null==this.parent||this.graph.isValidAncestor(s,this.parent,this.traverseAncestors))))&&t.push(a[o]);return this.edgesCache[n]=t},mxHierarchicalLayout.prototype.getVisibleTerminal=function(e,n){var t=null!=(t=this.graph.view.getState(e))?t.getVisibleTerminal(n):this.graph.view.getVisibleTerminal(e,n);return this.isPort(t)&&(t=this.graph.model.getParent(t)),t},mxHierarchicalLayout.prototype.run=function(e){var n=[],t=[];if(null==this.roots&&null!=e){var a={};this.filterDescendants(e,a),this.roots=[];var i,s=!0;for(i in a)if(null!=a[i]){s=!1;break}for(;!s;){var o=this.findRoots(e,a);for(s=0;s<o.length;s++){var r=[];n.push(r),this.traverse(o[s],!0,null,t,r,n,a)}for(s=0;s<o.length;s++)this.roots.push(o[s]);for(i in s=!0,a)if(null!=a[i]){s=!1;break}}}else for(s=0;s<roots.length;s++)r=[],n.push(r),traverse(roots.get(s),!0,null,t,r,n,null);for(s=t=0;s<n.length;s++){for(i in a=[],r=n[s])a.push(r[i]);this.model=new mxGraphHierarchyModel(this,a,this.roots,e,this.tightenToSource),this.cycleStage(e),this.layeringStage(),this.crossingStage(e),t=this.placementStage(t,e)}},mxHierarchicalLayout.prototype.filterDescendants=function(e,n){var t=this.graph.model;if(t.isVertex(e)&&e!=this.parent&&this.graph.isCellVisible(e)&&(n[mxCellPath.create(e)]=e),this.traverseAncestors||e==this.parent&&this.graph.isCellVisible(e))for(var a=t.getChildCount(e),i=0;i<a;i++){var s=t.getChildAt(e,i);this.isPort(s)||this.filterDescendants(s,n)}},mxHierarchicalLayout.prototype.isPort=function(e){return!!e.geometry.relative},mxHierarchicalLayout.prototype.getEdgesBetween=function(e,n,t){t=null!=t&&t;for(var a=this.getEdges(e),i=[],s=0;s<a.length;s++){var o=this.getVisibleTerminal(a[s],!0),r=this.getVisibleTerminal(a[s],!1);(o==e&&r==n||!t&&o==n&&r==e)&&i.push(a[s])}return i},mxHierarchicalLayout.prototype.traverse=function(e,n,t,a,i,s,o){if(null!=e&&null!=a){var r=mxCellPath.create(e);if(null!=a[r]||null!=o&&null==o[r]){if(null==i[r])for(t=0;t<s.length;t++)if(null!=(e=s[t])[r]){for(l in i)e[l]=i[l];return s.pop(),e}}else{null==i[r]&&(i[r]=e),null==a[r]&&(a[r]=e),delete o[r];var l=this.getEdges(e);for(t=0;t<l.length;t++)r=this.getVisibleTerminal(l[t],!0)==e,(!n||r)&&(r=this.getVisibleTerminal(l[t],!r),i=this.traverse(r,n,l[t],a,i,s,o))}}return i},mxHierarchicalLayout.prototype.cycleStage=function(e){new mxMinimumCycleRemover(this).execute(e)},mxHierarchicalLayout.prototype.layeringStage=function(){this.model.initialRank(),this.model.fixRanks()},mxHierarchicalLayout.prototype.crossingStage=function(e){new mxMedianHybridCrossingReduction(this).execute(e)},mxHierarchicalLayout.prototype.placementStage=function(e,n){var t=new mxCoordinateAssignment(this,this.intraCellSpacing,this.interRankCellSpacing,this.orientation,e,this.parallelEdgeSpacing);return t.fineTuning=this.fineTuning,t.execute(n),t.limitX+this.interHierarchySpacing},mxGraphModel.prototype=new mxEventSource,mxGraphModel.prototype.constructor=mxGraphModel,mxGraphModel.prototype.root=null,mxGraphModel.prototype.cells=null,mxGraphModel.prototype.maintainEdgeParent=!0,mxGraphModel.prototype.createIds=!0,mxGraphModel.prototype.prefix="",mxGraphModel.prototype.postfix="",mxGraphModel.prototype.nextId=0,mxGraphModel.prototype.currentEdit=null,mxGraphModel.prototype.updateLevel=0,mxGraphModel.prototype.endingUpdate=!1,mxGraphModel.prototype.clear=function(){this.setRoot(this.createRoot())},mxGraphModel.prototype.isCreateIds=function(){return this.createIds},mxGraphModel.prototype.setCreateIds=function(e){this.createIds=e},mxGraphModel.prototype.createRoot=function(){var e=new mxCell;return e.insert(new mxCell),e},mxGraphModel.prototype.getCell=function(e){return null!=this.cells?this.cells[e]:null},mxGraphModel.prototype.filterCells=function(e,n){var t=null;if(null!=e){t=[];for(var a=0;a<e.length;a++)n(e[a])&&t.push(e[a])}return t},mxGraphModel.prototype.getDescendants=function(e){return this.filterDescendants(null,e)},mxGraphModel.prototype.filterDescendants=function(e,n){var t=[];n=n||this.getRoot(),(null==e||e(n))&&t.push(n);for(var a=this.getChildCount(n),i=0;i<a;i++){var s=this.getChildAt(n,i);t=t.concat(this.filterDescendants(e,s))}return t},mxGraphModel.prototype.getRoot=function(e){var n=e||this.root;if(null!=e)for(;null!=e;)n=e,e=this.getParent(e);return n},mxGraphModel.prototype.setRoot=function(e){return this.execute(new mxRootChange(this,e)),e},mxGraphModel.prototype.rootChanged=function(e){var n=this.root;return this.root=e,this.nextId=0,this.cells=null,this.cellAdded(e),n},mxGraphModel.prototype.isRoot=function(e){return null!=e&&this.root==e},mxGraphModel.prototype.isLayer=function(e){return this.isRoot(this.getParent(e))},mxGraphModel.prototype.isAncestor=function(e,n){for(;null!=n&&n!=e;)n=this.getParent(n);return n==e},mxGraphModel.prototype.contains=function(e){return this.isAncestor(this.root,e)},mxGraphModel.prototype.getParent=function(e){return null!=e?e.getParent():null},mxGraphModel.prototype.add=function(e,n,t){if(n!=e&&null!=e&&null!=n){null==t&&(t=this.getChildCount(e));var a=e!=this.getParent(n);this.execute(new mxChildChange(this,e,n,t)),this.maintainEdgeParent&&a&&this.updateEdgeParents(n)}return n},mxGraphModel.prototype.cellAdded=function(e){if(null!=e){if(null==e.getId()&&this.createIds&&e.setId(this.createId(e)),null!=e.getId())if((n=this.getCell(e.getId()))!=e){for(;null!=n;)e.setId(this.createId(e)),n=this.getCell(e.getId());null==this.cells&&(this.cells={}),this.cells[e.getId()]=e}mxUtils.isNumeric(e.getId())&&(this.nextId=Math.max(this.nextId,e.getId()));for(var n=this.getChildCount(e),t=0;t<n;t++)this.cellAdded(this.getChildAt(e,t))}},mxGraphModel.prototype.createId=function(e){return e=this.nextId,this.nextId++,this.prefix+e+this.postfix},mxGraphModel.prototype.updateEdgeParents=function(e,n){n=n||this.getRoot(e);for(var t=this.getChildCount(e),a=0;a<t;a++){var i=this.getChildAt(e,a);this.updateEdgeParents(i,n)}for(i=this.getEdgeCount(e),t=[],a=0;a<i;a++)t.push(this.getEdgeAt(e,a));for(a=0;a<t.length;a++)i=t[a],this.isAncestor(n,i)&&this.updateEdgeParent(i,n)},mxGraphModel.prototype.updateEdgeParent=function(e,n){for(var t=this.getTerminal(e,!0),a=this.getTerminal(e,!1),i=null;null!=t&&!this.isEdge(t)&&null!=t.geometry&&t.geometry.relative;)t=this.getParent(t);for(;null!=a&&!this.isEdge(a)&&null!=a.geometry&&a.geometry.relative;)a=this.getParent(a);if(this.isAncestor(n,t)&&this.isAncestor(n,a)&&(null!=(i=t==a?this.getParent(t):this.getNearestCommonAncestor(t,a))&&(this.getParent(i)!=this.root||this.isAncestor(i,e))&&this.getParent(e)!=i)){if(null!=(t=this.getGeometry(e))){var s=this.getOrigin(this.getParent(e)),o=this.getOrigin(i);a=o.x-s.x,s=o.y-s.y;(t=t.clone()).translate(-a,-s),this.setGeometry(e,t)}this.add(i,e,this.getChildCount(i))}},mxGraphModel.prototype.getOrigin=function(e){var n=null;return null!=e?(n=this.getOrigin(this.getParent(e)),this.isEdge(e)||null!=(e=this.getGeometry(e))&&(n.x+=e.x,n.y+=e.y)):n=new mxPoint,n},mxGraphModel.prototype.getNearestCommonAncestor=function(e,n){if(null!=e&&null!=n&&(null!=(s=mxCellPath.create(n))&&0<s.length)){var t=e,a=mxCellPath.create(t);if(s.length<a.length){t=n;var i=a,s=(a=s,i)}for(;null!=t;){if(i=this.getParent(t),0==s.indexOf(a+mxCellPath.PATH_SEPARATOR)&&null!=i)return t;a=mxCellPath.getParentPath(a),t=i}}return null},mxGraphModel.prototype.remove=function(e){return e==this.root?this.setRoot(null):null!=this.getParent(e)&&this.execute(new mxChildChange(this,null,e)),e},mxGraphModel.prototype.cellRemoved=function(e){if(null!=e&&null!=this.cells){for(var n=this.getChildCount(e)-1;0<=n;n--)this.cellRemoved(this.getChildAt(e,n));null!=this.cells&&null!=e.getId()&&delete this.cells[e.getId()]}},mxGraphModel.prototype.parentForCellChanged=function(e,n,t){var a=this.getParent(e);return null!=n?(n!=a||a.getIndex(e)!=t)&&n.insert(e,t):null!=a&&(t=a.getIndex(e),a.remove(t)),this.contains(a)||null==n?null==n&&this.cellRemoved(e):this.cellAdded(e),a},mxGraphModel.prototype.getChildCount=function(e){return null!=e?e.getChildCount():0},mxGraphModel.prototype.getChildAt=function(e,n){return null!=e?e.getChildAt(n):null},mxGraphModel.prototype.getChildren=function(e){return null!=e?e.children:null},mxGraphModel.prototype.getChildVertices=function(e){return this.getChildCells(e,!0,!1)},mxGraphModel.prototype.getChildEdges=function(e){return this.getChildCells(e,!1,!0)},mxGraphModel.prototype.getChildCells=function(e,n,t){n=null!=n&&n,t=null!=t&&t;for(var a=this.getChildCount(e),i=[],s=0;s<a;s++){var o=this.getChildAt(e,s);(!t&&!n||t&&this.isEdge(o)||n&&this.isVertex(o))&&i.push(o)}return i},mxGraphModel.prototype.getTerminal=function(e,n){return null!=e?e.getTerminal(n):null},mxGraphModel.prototype.setTerminal=function(e,n,t){var a=n!=this.getTerminal(e,t);return this.execute(new mxTerminalChange(this,e,n,t)),this.maintainEdgeParent&&a&&this.updateEdgeParent(e,this.getRoot()),n},mxGraphModel.prototype.setTerminals=function(e,n,t){this.beginUpdate();try{this.setTerminal(e,n,!0),this.setTerminal(e,t,!1)}finally{this.endUpdate()}},mxGraphModel.prototype.terminalForCellChanged=function(e,n,t){var a=this.getTerminal(e,t);return null!=n?n.insertEdge(e,t):null!=a&&a.removeEdge(e,t),a},mxGraphModel.prototype.getEdgeCount=function(e){return null!=e?e.getEdgeCount():0},mxGraphModel.prototype.getEdgeAt=function(e,n){return null!=e?e.getEdgeAt(n):null},mxGraphModel.prototype.getDirectedEdgeCount=function(e,n,t){for(var a=0,i=this.getEdgeCount(e),s=0;s<i;s++){var o=this.getEdgeAt(e,s);o!=t&&this.getTerminal(o,n)==e&&a++}return a},mxGraphModel.prototype.getConnections=function(e){return this.getEdges(e,!0,!0,!1)},mxGraphModel.prototype.getIncomingEdges=function(e){return this.getEdges(e,!0,!1,!1)},mxGraphModel.prototype.getOutgoingEdges=function(e){return this.getEdges(e,!1,!0,!1)},mxGraphModel.prototype.getEdges=function(e,n,t,a){n=null==n||n,t=null==t||t,a=null==a||a;for(var i=this.getEdgeCount(e),s=[],o=0;o<i;o++){var r=this.getEdgeAt(e,o),l=this.getTerminal(r,!0),d=this.getTerminal(r,!1);(a&&l==d||l!=d&&(n&&d==e||t&&l==e))&&s.push(r)}return s},mxGraphModel.prototype.getEdgesBetween=function(e,n,t){t=null!=t&&t;var a=this.getEdgeCount(e),i=this.getEdgeCount(n),s=e,o=a;for(i<a&&(o=i,s=n),a=[],i=0;i<o;i++){var r=this.getEdgeAt(s,i),l=this.getTerminal(r,!0),d=this.getTerminal(r,!1);(l==e&&d==n||!t&&(d==e&&l==n))&&a.push(r)}return a},mxGraphModel.prototype.getOpposites=function(e,n,t,a){t=null==t||t,a=null==a||a;var i=[];if(null!=e)for(var s=0;s<e.length;s++){var o=this.getTerminal(e[s],!0),r=this.getTerminal(e[s],!1);o==n&&null!=r&&r!=n&&a?i.push(r):r==n&&null!=o&&o!=n&&t&&i.push(o)}return i},mxGraphModel.prototype.getTopmostCells=function(e){for(var n=[],t=0;t<e.length;t++){for(var a=e[t],i=!0,s=this.getParent(a);null!=s;){if(0<=mxUtils.indexOf(e,s)){i=!1;break}s=this.getParent(s)}i&&n.push(a)}return n},mxGraphModel.prototype.isVertex=function(e){return null!=e&&e.isVertex()},mxGraphModel.prototype.isEdge=function(e){return null!=e&&e.isEdge()},mxGraphModel.prototype.isConnectable=function(e){return null!=e&&e.isConnectable()},mxGraphModel.prototype.getValue=function(e){return null!=e?e.getValue():null},mxGraphModel.prototype.setValue=function(e,n){return this.execute(new mxValueChange(this,e,n)),n},mxGraphModel.prototype.valueForCellChanged=function(e,n){return e.valueChanged(n)},mxGraphModel.prototype.getGeometry=function(e,n){return null!=e?e.getGeometry():null},mxGraphModel.prototype.setGeometry=function(e,n){return n!=this.getGeometry(e)&&this.execute(new mxGeometryChange(this,e,n)),n},mxGraphModel.prototype.geometryForCellChanged=function(e,n){var t=this.getGeometry(e);return e.setGeometry(n),t},mxGraphModel.prototype.getStyle=function(e){return null!=e?e.getStyle():null},mxGraphModel.prototype.setStyle=function(e,n){return n!=this.getStyle(e)&&this.execute(new mxStyleChange(this,e,n)),n},mxGraphModel.prototype.styleForCellChanged=function(e,n){var t=this.getStyle(e);return e.setStyle(n),t},mxGraphModel.prototype.isCollapsed=function(e){return null!=e&&e.isCollapsed()},mxGraphModel.prototype.setCollapsed=function(e,n){return n!=this.isCollapsed(e)&&this.execute(new mxCollapseChange(this,e,n)),n},mxGraphModel.prototype.collapsedStateForCellChanged=function(e,n){var t=this.isCollapsed(e);return e.setCollapsed(n),t},mxGraphModel.prototype.isVisible=function(e){return null!=e&&e.isVisible()},mxGraphModel.prototype.setVisible=function(e,n){return n!=this.isVisible(e)&&this.execute(new mxVisibleChange(this,e,n)),n},mxGraphModel.prototype.visibleStateForCellChanged=function(e,n){var t=this.isVisible(e);return e.setVisible(n),t},mxGraphModel.prototype.execute=function(e){e.execute(),this.beginUpdate(),this.currentEdit.add(e),this.fireEvent(new mxEventObject(mxEvent.EXECUTE,"change",e)),this.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",e)),this.endUpdate()},mxGraphModel.prototype.beginUpdate=function(){this.updateLevel++,this.fireEvent(new mxEventObject(mxEvent.BEGIN_UPDATE)),1==this.updateLevel&&this.fireEvent(new mxEventObject(mxEvent.START_EDIT))},mxGraphModel.prototype.endUpdate=function(){if(this.updateLevel--,0==this.updateLevel&&this.fireEvent(new mxEventObject(mxEvent.END_EDIT)),!this.endingUpdate){this.endingUpdate=0==this.updateLevel,this.fireEvent(new mxEventObject(mxEvent.END_UPDATE,"edit",this.currentEdit));try{if(this.endingUpdate&&!this.currentEdit.isEmpty()){this.fireEvent(new mxEventObject(mxEvent.BEFORE_UNDO,"edit",this.currentEdit));var e=this.currentEdit;this.currentEdit=this.createUndoableEdit(),e.notify(),this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",e))}}finally{this.endingUpdate=!1}}},mxGraphModel.prototype.createUndoableEdit=function(){var e=new mxUndoableEdit(this,!0);return e.notify=function(){e.source.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",e,"changes",e.changes)),e.source.fireEvent(new mxEventObject(mxEvent.NOTIFY,"edit",e,"changes",e.changes))},e},mxGraphModel.prototype.mergeChildren=function(e,n,t){t=null==t||t,this.beginUpdate();try{var a={};for(var i in this.mergeChildrenImpl(e,n,t,a),a){var s=a[i],o=this.getTerminal(s,!0);null!=o&&(o=a[mxCellPath.create(o)],this.setTerminal(s,o,!0)),null!=(o=this.getTerminal(s,!1))&&(o=a[mxCellPath.create(o)],this.setTerminal(s,o,!1))}}finally{this.endUpdate()}},mxGraphModel.prototype.mergeChildrenImpl=function(e,n,t,a){this.beginUpdate();try{for(var i=e.getChildCount(),s=0;s<i;s++){var o=e.getChildAt(s);if("function"==typeof o.getId){var r=o.getId(),l=null==r||this.isEdge(o)&&t?null:this.getCell(r);if(null==l){var d=o.clone();d.setId(r),d.setTerminal(o.getTerminal(!0),!0),d.setTerminal(o.getTerminal(!1),!1),l=n.insert(d),this.cellAdded(l)}a[mxCellPath.create(o)]=l,this.mergeChildrenImpl(o,l,t,a)}}}finally{this.endUpdate()}},mxGraphModel.prototype.getParents=function(e){var n=[];if(null!=e)for(var t={},a=0;a<e.length;a++){var i=this.getParent(e[a]);if(null!=i){var s=mxCellPath.create(i);null==t[s]&&(t[s]=i,n.push(i))}}return n},mxGraphModel.prototype.cloneCell=function(e){return null!=e?this.cloneCells([e],!0)[0]:null},mxGraphModel.prototype.cloneCells=function(e,n){for(var t={},a=[],i=0;i<e.length;i++)null!=e[i]?a.push(this.cloneCellImpl(e[i],t,n)):a.push(null);for(i=0;i<a.length;i++)null!=a[i]&&this.restoreClone(a[i],e[i],t);return a},mxGraphModel.prototype.cloneCellImpl=function(e,n,t){var a=this.cellCloned(e);if(n[mxObjectIdentity.get(e)]=a,t){t=this.getChildCount(e);for(var i=0;i<t;i++){var s=this.cloneCellImpl(this.getChildAt(e,i),n,!0);a.insert(s)}}return a},mxGraphModel.prototype.cellCloned=function(e){return e.clone()},mxGraphModel.prototype.restoreClone=function(e,n,t){null!=(a=this.getTerminal(n,!0))&&(null!=(a=t[mxObjectIdentity.get(a)])&&a.insertEdge(e,!0)),null!=(a=this.getTerminal(n,!1))&&(null!=(a=t[mxObjectIdentity.get(a)])&&a.insertEdge(e,!1));for(var a=this.getChildCount(e),i=0;i<a;i++)this.restoreClone(this.getChildAt(e,i),this.getChildAt(n,i),t)},mxRootChange.prototype.execute=function(){this.root=this.previous,this.previous=this.model.rootChanged(this.previous)},mxChildChange.prototype.execute=function(){var e=this.model.getParent(this.child),n=null!=e?e.getIndex(this.child):0;null==this.previous&&this.connect(this.child,!1),e=this.model.parentForCellChanged(this.child,this.previous,this.previousIndex),null!=this.previous&&this.connect(this.child,!0),this.parent=this.previous,this.previous=e,this.index=this.previousIndex,this.previousIndex=n},mxChildChange.prototype.connect=function(e,n){n=null==n||n;var t=e.getTerminal(!0),a=e.getTerminal(!1);for(null!=t&&(n?this.model.terminalForCellChanged(e,t,!0):this.model.terminalForCellChanged(e,null,!0)),null!=a&&(n?this.model.terminalForCellChanged(e,a,!1):this.model.terminalForCellChanged(e,null,!1)),e.setTerminal(t,!0),e.setTerminal(a,!1),t=this.model.getChildCount(e),a=0;a<t;a++)this.connect(this.model.getChildAt(e,a),n)},mxTerminalChange.prototype.execute=function(){this.terminal=this.previous,this.previous=this.model.terminalForCellChanged(this.cell,this.previous,this.source)},mxValueChange.prototype.execute=function(){this.value=this.previous,this.previous=this.model.valueForCellChanged(this.cell,this.previous)},mxStyleChange.prototype.execute=function(){this.style=this.previous,this.previous=this.model.styleForCellChanged(this.cell,this.previous)},mxGeometryChange.prototype.execute=function(){this.geometry=this.previous,this.previous=this.model.geometryForCellChanged(this.cell,this.previous)},mxCollapseChange.prototype.execute=function(){this.collapsed=this.previous,this.previous=this.model.collapsedStateForCellChanged(this.cell,this.previous)},mxVisibleChange.prototype.execute=function(){this.visible=this.previous,this.previous=this.model.visibleStateForCellChanged(this.cell,this.previous)},mxCellAttributeChange.prototype.execute=function(){var e=this.cell.getAttribute(this.attribute);null==this.previous?this.cell.value.removeAttribute(this.attribute):this.cell.setAttribute(this.attribute,this.previous),this.previous=e},mxCell.prototype.id=null,mxCell.prototype.value=null,mxCell.prototype.geometry=null,mxCell.prototype.style=null,mxCell.prototype.vertex=!1,mxCell.prototype.edge=!1,mxCell.prototype.connectable=!0,mxCell.prototype.visible=!0,mxCell.prototype.collapsed=!1,mxCell.prototype.parent=null,mxCell.prototype.source=null,mxCell.prototype.target=null,mxCell.prototype.children=null,mxCell.prototype.edges=null,mxCell.prototype.mxTransient="id value parent source target children edges".split(" "),mxCell.prototype.getId=function(){return this.id},mxCell.prototype.setId=function(e){this.id=e},mxCell.prototype.getValue=function(){return this.value},mxCell.prototype.setValue=function(e){this.value=e},mxCell.prototype.valueChanged=function(e){var n=this.getValue();return this.setValue(e),n},mxCell.prototype.getGeometry=function(){return this.geometry},mxCell.prototype.setGeometry=function(e){this.geometry=e},mxCell.prototype.getStyle=function(){return this.style},mxCell.prototype.setStyle=function(e){this.style=e},mxCell.prototype.isVertex=function(){return this.vertex},mxCell.prototype.setVertex=function(e){this.vertex=e},mxCell.prototype.isEdge=function(){return this.edge},mxCell.prototype.setEdge=function(e){this.edge=e},mxCell.prototype.isConnectable=function(){return this.connectable},mxCell.prototype.setConnectable=function(e){this.connectable=e},mxCell.prototype.isVisible=function(){return this.visible},mxCell.prototype.setVisible=function(e){this.visible=e},mxCell.prototype.isCollapsed=function(){return this.collapsed},mxCell.prototype.setCollapsed=function(e){this.collapsed=e},mxCell.prototype.getParent=function(){return this.parent},mxCell.prototype.setParent=function(e){this.parent=e},mxCell.prototype.getTerminal=function(e){return e?this.source:this.target},mxCell.prototype.setTerminal=function(e,n){return n?this.source=e:this.target=e,e},mxCell.prototype.getChildCount=function(){return null==this.children?0:this.children.length},mxCell.prototype.getIndex=function(e){return mxUtils.indexOf(this.children,e)},mxCell.prototype.getChildAt=function(e){return null==this.children?null:this.children[e]},mxCell.prototype.insert=function(e,n){return null!=e&&(null==n&&(n=this.getChildCount(),e.getParent()==this&&n--),e.removeFromParent(),e.setParent(this),null==this.children?(this.children=[],this.children.push(e)):this.children.splice(n,0,e)),e},mxCell.prototype.remove=function(e){var n=null;return null!=this.children&&0<=e&&(null!=(n=this.getChildAt(e))&&(this.children.splice(e,1),n.setParent(null))),n},mxCell.prototype.removeFromParent=function(){if(null!=this.parent){var e=this.parent.getIndex(this);this.parent.remove(e)}},mxCell.prototype.getEdgeCount=function(){return null==this.edges?0:this.edges.length},mxCell.prototype.getEdgeIndex=function(e){return mxUtils.indexOf(this.edges,e)},mxCell.prototype.getEdgeAt=function(e){return null==this.edges?null:this.edges[e]},mxCell.prototype.insertEdge=function(e,n){return null!=e&&(e.removeFromTerminal(n),e.setTerminal(this,n),null==this.edges||e.getTerminal(!n)!=this||mxUtils.indexOf(this.edges,e)<0)&&(null==this.edges&&(this.edges=[]),this.edges.push(e)),e},mxCell.prototype.removeEdge=function(e,n){if(null!=e){if(e.getTerminal(!n)!=this&&null!=this.edges){var t=this.getEdgeIndex(e);0<=t&&this.edges.splice(t,1)}e.setTerminal(null,n)}return e},mxCell.prototype.removeFromTerminal=function(e){var n=this.getTerminal(e);null!=n&&n.removeEdge(this,e)},mxCell.prototype.getAttribute=function(e,n){var t=this.getValue();return(null!=t&&t.nodeType==mxConstants.NODETYPE_ELEMENT?t.getAttribute(e):null)||n},mxCell.prototype.setAttribute=function(e,n){var t=this.getValue();null!=t&&t.nodeType==mxConstants.NODETYPE_ELEMENT&&t.setAttribute(e,n)},mxCell.prototype.clone=function(){var e=mxUtils.clone(this,this.mxTransient);return e.setValue(this.cloneValue()),e},mxCell.prototype.cloneValue=function(){var e=this.getValue();return null!=e&&("function"==typeof e.clone?e=e.clone():isNaN(e.nodeType)||(e=e.cloneNode(!0))),e},mxGeometry.prototype=new mxRectangle,mxGeometry.prototype.constructor=mxGeometry,mxGeometry.prototype.TRANSLATE_CONTROL_POINTS=!0,mxGeometry.prototype.alternateBounds=null,mxGeometry.prototype.sourcePoint=null,mxGeometry.prototype.targetPoint=null,mxGeometry.prototype.points=null,mxGeometry.prototype.offset=null,mxGeometry.prototype.relative=!1,mxGeometry.prototype.swap=function(){if(null!=this.alternateBounds){var e=new mxRectangle(this.x,this.y,this.width,this.height);this.x=this.alternateBounds.x,this.y=this.alternateBounds.y,this.width=this.alternateBounds.width,this.height=this.alternateBounds.height,this.alternateBounds=e}},mxGeometry.prototype.getTerminalPoint=function(e){return e?this.sourcePoint:this.targetPoint},mxGeometry.prototype.setTerminalPoint=function(e,n){return n?this.sourcePoint=e:this.targetPoint=e,e},mxGeometry.prototype.translate=function(e,n){if(this.clone(),this.relative||(this.x+=e,this.y+=n),null!=this.sourcePoint&&(this.sourcePoint.x+=e,this.sourcePoint.y+=n),null!=this.targetPoint&&(this.targetPoint.x+=e,this.targetPoint.y+=n),this.TRANSLATE_CONTROL_POINTS&&null!=this.points)for(var t=this.points.length,a=0;a<t;a++){var i=this.points[a];null!=i&&(i.x+=e,i.y+=n)}};var mxCellPath={PATH_SEPARATOR:".",create:function(e){var n="";if(null!=e)for(var t=e.getParent();null!=t;)n=t.getIndex(e)+mxCellPath.PATH_SEPARATOR+n,t=(e=t).getParent();return 1<(e=n.length)&&(n=n.substring(0,e-1)),n},getParentPath:function(e){if(null!=e){var n=e.lastIndexOf(mxCellPath.PATH_SEPARATOR);if(0<=n)return e.substring(0,n);if(0<e.length)return""}return null},resolve:function(e,n){var t=e;if(null!=n)for(var a=n.split(mxCellPath.PATH_SEPARATOR),i=0;i<a.length;i++)t=t.getChildAt(parseInt(a[i]));return t},compare:function(e,n){for(var t=Math.min(e.length,n.length),a=0,i=0;i<t;i++)if(e[i]!=n[i]){a=0==e[i].length||0==n[i].length?e[i]==n[i]?0:e[i]>n[i]?1:-1:(t=parseInt(e[i]))==(i=parseInt(n[i]))?0:i<t?1:-1;break}return 0==a&&((t=e.length)!=(i=n.length)&&(a=i<t?1:-1)),a}},mxPerimeter={RectanglePerimeter:function(e,n,t,a){n=e.getCenterX();var i=e.getCenterY(),s=Math.atan2(t.y-i,t.x-n),o=new mxPoint(0,0),r=Math.PI,l=Math.PI/2-s,d=Math.atan2(e.height,e.width);return s<-r+d||r-d<s?(o.x=e.x,o.y=i-e.width*Math.tan(s)/2):s<-d?(o.y=e.y,o.x=n-e.height*Math.tan(l)/2):s<d?(o.x=e.x+e.width,o.y=i+e.width*Math.tan(s)/2):(o.y=e.y+e.height,o.x=n+e.height*Math.tan(l)/2),a&&(t.x>=e.x&&t.x<=e.x+e.width?o.x=t.x:t.y>=e.y&&t.y<=e.y+e.height&&(o.y=t.y),t.x<e.x?o.x=e.x:t.x>e.x+e.width&&(o.x=e.x+e.width),t.y<e.y?o.y=e.y:t.y>e.y+e.height&&(o.y=e.y+e.height)),o},EllipsePerimeter:function(e,n,t,a){var i=e.x,s=e.y,o=e.width/2,r=e.height/2,l=i+o,d=s+r;n=t.x,t=t.y;var c=parseInt(n-l),m=parseInt(t-d);if(0==c&&0!=m)return new mxPoint(l,d+r*m/Math.abs(m));if(0==c&&0==m)return new mxPoint(n,t);if(a){if(s<=t&&t<=s+e.height)return e=t-d,e=Math.sqrt(o*o*(1-e*e/(r*r)))||0,n<=i&&(e=-e),new mxPoint(l+e,t);if(i<=n&&n<=i+e.width)return e=n-l,e=Math.sqrt(r*r*(1-e*e/(o*o)))||0,t<=s&&(e=-e),new mxPoint(n,d+e)}return d-=(i=m/c)*l,l=i*(o=(-(e=-2*l*(s=o*o*i*i+r*r))+(r=Math.sqrt(e*e-4*s*(o*o*i*i*l*l+r*r*l*l-o*o*r*r))))/(2*s))+d,d=i*(r=(-e-r)/(2*s))+d,i=Math.sqrt(Math.pow(o-n,2)+Math.pow(l-t,2)),n=Math.sqrt(Math.pow(r-n,2)+Math.pow(d-t,2)),s=t=0,s=i<n?(t=o,l):(t=r,d),new mxPoint(t,s)},RhombusPerimeter:function(e,n,t,a){n=e.x;var i=e.y,s=e.width,o=n+s/2,r=i+(e=e.height)/2,l=t.x;if(t=t.y,o==l)return new mxPoint(o,t<r?i:i+e);if(r==t)return new mxPoint(l<o?n:n+s,r);var d=o,c=r;return a&&(n<=l&&l<=n+s?d=l:i<=t&&t<=i+e&&(c=t)),l<o?t<r?mxUtils.intersection(l,t,d,c,o,i,n,r):mxUtils.intersection(l,t,d,c,o,i+e,n,r):t<r?mxUtils.intersection(l,t,d,c,o,i,n+s,r):mxUtils.intersection(l,t,d,c,o,i+e,n+s,r)},TrianglePerimeter:function(e,n,t,a){var i=(n=null!=n?n.style[mxConstants.STYLE_DIRECTION]:null)==mxConstants.DIRECTION_NORTH||n==mxConstants.DIRECTION_SOUTH,s=e.x,o=e.y,r=e.width,l=s+r/2,d=o+(e=e.height)/2,c=new mxPoint(s,o),m=new mxPoint(s+r,d),u=new mxPoint(s,o+e);n==mxConstants.DIRECTION_NORTH?(c=u,m=new mxPoint(l,o),u=new mxPoint(s+r,o+e)):n==mxConstants.DIRECTION_SOUTH?(m=new mxPoint(l,o+e),u=new mxPoint(s+r,o)):n==mxConstants.DIRECTION_WEST&&(c=new mxPoint(s+r,o),m=new mxPoint(s,d),u=new mxPoint(s+r,o+e));var p=t.x-l,g=t.y-d,v=(p=i?Math.atan2(p,g):Math.atan2(g,p),i?Math.atan2(r,e):Math.atan2(e,r));g=!1,g=n==mxConstants.DIRECTION_NORTH||n==mxConstants.DIRECTION_WEST?-v<p&&p<v:p<-Math.PI+v||p>Math.PI-v,v=null;return null==(v=g?a&&(i&&t.x>=c.x&&t.x<=u.x||!i&&t.y>=c.y&&t.y<=u.y)?i?new mxPoint(t.x,c.y):new mxPoint(c.x,t.y):n==mxConstants.DIRECTION_NORTH?new mxPoint(s+r/2+e*Math.tan(p)/2,o+e):n==mxConstants.DIRECTION_SOUTH?new mxPoint(s+r/2-e*Math.tan(p)/2,o):n==mxConstants.DIRECTION_WEST?new mxPoint(s+r,o+e/2+r*Math.tan(p)/2):new mxPoint(s,o+e/2-r*Math.tan(p)/2):(a&&(a=new mxPoint(l,d),t.y>=o&&t.y<=o+e?(a.x=i?l:n==mxConstants.DIRECTION_WEST?s+r:s,a.y=t.y):t.x>=s&&t.x<=s+r&&(a.x=t.x,a.y=i?n==mxConstants.DIRECTION_NORTH?o+e:o:d),l=a.x,d=a.y),i&&t.x<=s+r/2||!i&&t.y<=o+e/2?mxUtils.intersection(t.x,t.y,l,d,c.x,c.y,m.x,m.y):mxUtils.intersection(t.x,t.y,l,d,m.x,m.y,u.x,u.y)))&&(v=new mxPoint(l,d)),v}};function mxPrintPreview(e,n,t,a,i,s,o,r,l){this.graph=e,this.scale=null!=n?n:1/e.pageScale,this.border=null!=a?a:0,this.pageFormat=null!=t?t:e.pageFormat,this.title=null!=r?r:"Printer-friendly version",this.x0=null!=i?i:0,this.y0=null!=s?s:0,this.borderColor=o,this.pageSelector=null==l||l}function mxStylesheet(){this.styles={},this.putDefaultVertexStyle(this.createDefaultVertexStyle()),this.putDefaultEdgeStyle(this.createDefaultEdgeStyle())}function mxCellState(e,n,t){this.view=e,this.cell=n,this.style=t,this.origin=new mxPoint,this.absoluteOffset=new mxPoint}function mxGraphSelectionModel(e){this.graph=e,this.cells=[]}function mxSelectionChange(e,n,t){this.selectionModel=e,this.added=null!=n?n.slice():null,this.removed=null!=t?t.slice():null}function mxCellEditor(e){this.graph=e}function mxCellRenderer(){}mxPrintPreview.prototype.graph=null,mxPrintPreview.prototype.pageFormat=null,mxPrintPreview.prototype.scale=null,mxPrintPreview.prototype.border=0,mxPrintPreview.prototype.x0=0,mxPrintPreview.prototype.y0=0,mxPrintPreview.prototype.autoOrigin=!0,mxPrintPreview.prototype.printOverlays=!1,mxPrintPreview.prototype.borderColor=null,mxPrintPreview.prototype.title=null,mxPrintPreview.prototype.pageSelector=null,mxPrintPreview.prototype.wnd=null,mxPrintPreview.prototype.pageCount=0,mxPrintPreview.prototype.getWindow=function(){return this.wnd},mxPrintPreview.prototype.getDoctype=function(){var e="";return 8==document.documentMode&&(e='<meta http-equiv="X-UA-Compatible" content="IE=8">'),e},mxPrintPreview.prototype.open=function(e){var n=this.graph.cellRenderer.initializeOverlay,t=null;try{if(this.printOverlays&&(this.graph.cellRenderer.initializeOverlay=function(e,n){n.init(e.view.getDrawPane())}),null==this.wnd){this.wnd=window.open();var a=this.wnd.document,i=this.getDoctype();null!=i&&0<i.length&&a.writeln(i),a.writeln("<html>"),a.writeln("<head>"),this.writeHead(a,e),a.writeln("</head>"),a.writeln('<body class="mxPage">'),mxClient.link("stylesheet",mxClient.basePath+"/css/common.css",a),mxClient.IS_VML&&(a.namespaces.add("v","urn:schemas-microsoft-com:vml"),a.namespaces.add("o","urn:schemas-microsoft-com:office:office"),a.createStyleSheet().cssText="v\\:*{behavior:url(#default#VML)}o\\:*{behavior:url(#default#VML)}",mxClient.link("stylesheet",mxClient.basePath+"/css/explorer.css",a));var s=this.graph.getGraphBounds().clone(),o=this.graph.getView().getScale(),r=o/this.scale,l=this.graph.getView().getTranslate();this.autoOrigin||(this.x0=-l.x*this.scale,this.y0=-l.y*this.scale,s.width+=s.x,s.height+=s.y,s.x=0,this.border=s.y=0),s.width/=r,s.height/=r;var d=this.pageFormat.width-2*this.border,c=this.pageFormat.height-2*this.border,m=Math.max(1,Math.ceil((s.width+this.x0)/d)),u=Math.max(1,Math.ceil((s.height+this.y0)/c));this.pageCount=m*u;var p=mxUtils.bind(this,function(){if(this.pageSelector&&(1<u||1<m)){var e=this.createPageSelector(u,m);if(a.body.appendChild(e),mxClient.IS_IE){e.style.position="absolute";var n=function(){e.style.top=a.body.scrollTop+10+"px"};mxEvent.addListener(this.wnd,"scroll",function(e){n()}),mxEvent.addListener(this.wnd,"resize",function(e){n()})}}});if(e=function(e,n){if(null!=this.borderColor&&(e.style.borderColor=this.borderColor,e.style.borderStyle="solid",e.style.borderWidth="1px"),e.style.background="white",n&&(e.style.pageBreakAfter="always"),mxClient.IS_IE?(a.writeln(e.outerHTML),e.parentNode.removeChild(e)):(e.parentNode.removeChild(e),a.body.appendChild(e)),n){var t=a.createElement("hr");t.className="mxPageBreak",a.body.appendChild(t)}},null!=(f=this.getCoverPages(this.pageFormat.width,this.pageFormat.height)))for(var g=0;g<f.length;g++)e(f[g],!0);var v=this.getAppendices(this.pageFormat.width,this.pageFormat.height);for(g=0;g<u;g++)for(var h=g*c/this.scale-this.y0/this.scale+(s.y-l.y*o)/o,f=0;f<m;f++){if(null==this.wnd)return null;var b=f*d/this.scale-this.x0/this.scale+(s.x-l.x*o)/o,A=g*m+f+1;(t=this.renderPage(this.pageFormat.width,this.pageFormat.height,mxUtils.bind(this,function(e){this.addGraphFragment(-b,-h,this.scale,A,e)}))).setAttribute("id","mxPage-"+A),e(t,null!=v||g<u-1||f<m-1)}if(null!=v)for(g=0;g<v.length;g++)e(v[g],g<v.length);a.writeln("</body>"),a.writeln("</html>"),a.close(),p(),mxEvent.release(a.body)}this.wnd.focus()}catch(e){null!=t&&null!=t.parentNode&&t.parentNode.removeChild(t)}finally{this.graph.cellRenderer.initializeOverlay=n}return this.wnd},mxPrintPreview.prototype.writeHead=function(e,n){null!=this.title&&e.writeln("<title>"+this.title+"</title>"),e.writeln('<style type="text/css">'),e.writeln("@media print {"),e.writeln("  table.mxPageSelector { display: none; }"),e.writeln("  hr.mxPageBreak { display: none; }"),e.writeln("}"),e.writeln("@media screen {"),e.writeln("  table.mxPageSelector { position: fixed; right: 10px; top: 10px;font-family: Arial; font-size:10pt; border: solid 1px darkgray;background: white; border-collapse:collapse; }"),e.writeln("  table.mxPageSelector td { border: solid 1px gray; padding:4px; }"),e.writeln("  body.mxPage { background: gray; }"),e.writeln("}"),null!=n&&e.writeln(n),e.writeln("</style>")},mxPrintPreview.prototype.createPageSelector=function(e,n){var t=this.wnd.document,a=t.createElement("table");a.className="mxPageSelector",a.setAttribute("border","0");for(var i=t.createElement("tbody"),s=0;s<e;s++){for(var o=t.createElement("tr"),r=0;r<n;r++){var l=s*n+r+1,d=t.createElement("td");if(!mxClient.IS_NS||mxClient.IS_SF||mxClient.IS_GC){var c=t.createElement("a");c.setAttribute("href","#mxPage-"+l),mxUtils.write(c,l,t),d.appendChild(c)}else mxUtils.write(d,l,t);o.appendChild(d)}i.appendChild(o)}return a.appendChild(i),a},mxPrintPreview.prototype.renderPage=function(e,n,t){var a=document.createElement("div");try{a.style.width=e+"px",a.style.height=n+"px",a.style.overflow="hidden",a.style.pageBreakInside="avoid",a.style.position="relative";var i=document.createElement("div");i.style.top=this.border+"px",i.style.left=this.border+"px",i.style.width=e-2*this.border+"px",i.style.height=n-2*this.border+"px",i.style.overflow="hidden",this.graph.dialect==mxConstants.DIALECT_VML&&(i.style.position="absolute"),a.appendChild(i),document.body.appendChild(a),t(i)}catch(e){throw a.parentNode.removeChild(a),e}return a},mxPrintPreview.prototype.addGraphFragment=function(e,n,t,a,i){a=this.graph.getView();var s=this.graph.container;this.graph.container=i;var o=a.getCanvas(),r=a.getBackgroundPane(),l=a.getDrawPane(),d=a.getOverlayPane();this.graph.dialect==mxConstants.DIALECT_SVG?a.createSvg():this.graph.dialect==mxConstants.DIALECT_VML?a.createVml():a.createHtml();var c=a.isEventsEnabled();a.setEventsEnabled(!1);var m=this.graph.isEnabled();this.graph.setEnabled(!1);var u=a.getTranslate();a.translate=new mxPoint(e,n),e=null;try{var p=[this.graph.getModel().getRoot()];e=new mxTemporaryCellStates(a,t,p)}finally{if(mxClient.IS_IE)a.overlayPane.innerHTML="";else for(t=i.firstChild;null!=t;)p=t.nextSibling,"svg"==(n=t.nodeName.toLowerCase())?(t.setAttribute("width",parseInt(i.style.width)),t.setAttribute("height",parseInt(i.style.height))):"default"!=t.style.cursor&&"table"!=n&&t.parentNode.removeChild(t),t=p;a.overlayPane.parentNode.removeChild(a.overlayPane),this.graph.setEnabled(m),this.graph.container=s,a.canvas=o,a.backgroundPane=r,a.drawPane=l,a.overlayPane=d,a.translate=u,e.destroy(),a.setEventsEnabled(c)}},mxPrintPreview.prototype.getCoverPages=function(){return null},mxPrintPreview.prototype.getAppendices=function(){return null},mxPrintPreview.prototype.print=function(){var e=this.open();null!=e&&e.print()},mxPrintPreview.prototype.close=function(){null!=this.wnd&&(this.wnd.close(),this.wnd=null)},mxStylesheet.prototype.createDefaultVertexStyle=function(){var e={};return e[mxConstants.STYLE_SHAPE]=mxConstants.SHAPE_RECTANGLE,e[mxConstants.STYLE_PERIMETER]=mxPerimeter.RectanglePerimeter,e[mxConstants.STYLE_VERTICAL_ALIGN]=mxConstants.ALIGN_MIDDLE,e[mxConstants.STYLE_ALIGN]=mxConstants.ALIGN_CENTER,e[mxConstants.STYLE_FILLCOLOR]="#C3D9FF",e[mxConstants.STYLE_STROKECOLOR]="#6482B9",e[mxConstants.STYLE_FONTCOLOR]="#774400",e},mxStylesheet.prototype.createDefaultEdgeStyle=function(){var e={};return e[mxConstants.STYLE_SHAPE]=mxConstants.SHAPE_CONNECTOR,e[mxConstants.STYLE_ENDARROW]=mxConstants.ARROW_CLASSIC,e[mxConstants.STYLE_VERTICAL_ALIGN]=mxConstants.ALIGN_MIDDLE,e[mxConstants.STYLE_ALIGN]=mxConstants.ALIGN_CENTER,e[mxConstants.STYLE_STROKECOLOR]="#6482B9",e[mxConstants.STYLE_FONTCOLOR]="#446299",e},mxStylesheet.prototype.putDefaultVertexStyle=function(e){this.putCellStyle("defaultVertex",e)},mxStylesheet.prototype.putDefaultEdgeStyle=function(e){this.putCellStyle("defaultEdge",e)},mxStylesheet.prototype.getDefaultVertexStyle=function(){return this.styles.defaultVertex},mxStylesheet.prototype.getDefaultEdgeStyle=function(){return this.styles.defaultEdge},mxStylesheet.prototype.putCellStyle=function(e,n){this.styles[e]=n},mxStylesheet.prototype.getCellStyle=function(e,n){var t=n;if(null!=e&&0<e.length)for(var a=e.split(";"),i=(t=null!=t&&";"!=e.charAt(0)?mxUtils.clone(t):{},0);i<a.length;i++){var s=(o=a[i]).indexOf("=");if(0<=s){var o,r=o.substring(0,s);(o=o.substring(s+1))==mxConstants.NONE?delete t[r]:mxUtils.isNumeric(o)?t[r]=parseFloat(o):t[r]=o}else if(null!=(o=this.styles[o]))for(r in o)t[r]=o[r]}return t},mxCellState.prototype=new mxRectangle,mxCellState.prototype.constructor=mxCellState,mxCellState.prototype.view=null,mxCellState.prototype.cell=null,mxCellState.prototype.style=null,mxCellState.prototype.invalid=!0,mxCellState.prototype.invalidOrder=!1,mxCellState.prototype.orderChanged=!1,mxCellState.prototype.origin=null,mxCellState.prototype.absolutePoints=null,mxCellState.prototype.absoluteOffset=null,mxCellState.prototype.visibleSourceState=null,mxCellState.prototype.visibleTargetState=null,mxCellState.prototype.terminalDistance=0,mxCellState.prototype.length=0,mxCellState.prototype.segments=null,mxCellState.prototype.shape=null,mxCellState.prototype.text=null,mxCellState.prototype.getPerimeterBounds=function(e,n){if(e=e||0,n=null!=n?n:new mxRectangle(this.x,this.y,this.width,this.height),null!=this.shape&&null!=this.shape.stencil){var t=this.shape.stencil.computeAspect(this.style,n.x,n.y,n.width,n.height);n.x=t.x,n.y=t.y,n.width=this.shape.stencil.w0*t.width,n.height=this.shape.stencil.h0*t.height}return 0!=e&&n.grow(e),n},mxCellState.prototype.setAbsoluteTerminalPoint=function(e,n){n?(null==this.absolutePoints&&(this.absolutePoints=[]),0==this.absolutePoints.length?this.absolutePoints.push(e):this.absolutePoints[0]=e):null==this.absolutePoints?(this.absolutePoints=[],this.absolutePoints.push(null),this.absolutePoints.push(e)):1==this.absolutePoints.length?this.absolutePoints.push(e):this.absolutePoints[this.absolutePoints.length-1]=e},mxCellState.prototype.setCursor=function(e){null!=this.shape&&this.shape.setCursor(e),null!=this.text&&this.text.setCursor(e)},mxCellState.prototype.getVisibleTerminal=function(e){return null!=(e=this.getVisibleTerminalState(e))?e.cell:null},mxCellState.prototype.getVisibleTerminalState=function(e){return e?this.visibleSourceState:this.visibleTargetState},mxCellState.prototype.setVisibleTerminalState=function(e,n){n?this.visibleSourceState=e:this.visibleTargetState=e},mxCellState.prototype.destroy=function(){this.view.graph.cellRenderer.destroy(this)},mxCellState.prototype.clone=function(){var e=new mxCellState(this.view,this.cell,this.style);if(null!=this.absolutePoints){e.absolutePoints=[];for(var n=0;n<this.absolutePoints.length;n++)e.absolutePoints[n]=this.absolutePoints[n].clone()}return null!=this.origin&&(e.origin=this.origin.clone()),null!=this.absoluteOffset&&(e.absoluteOffset=this.absoluteOffset.clone()),null!=this.boundingBox&&(e.boundingBox=this.boundingBox.clone()),e.terminalDistance=this.terminalDistance,e.segments=this.segments,e.length=this.length,e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e},mxGraphSelectionModel.prototype=new mxEventSource,mxGraphSelectionModel.prototype.constructor=mxGraphSelectionModel,mxGraphSelectionModel.prototype.doneResource="none"!=mxClient.language?"done":"",mxGraphSelectionModel.prototype.updatingSelectionResource="none"!=mxClient.language?"updatingSelection":"",mxGraphSelectionModel.prototype.graph=null,mxGraphSelectionModel.prototype.singleSelection=!1,mxGraphSelectionModel.prototype.isSingleSelection=function(){return this.singleSelection},mxGraphSelectionModel.prototype.setSingleSelection=function(e){this.singleSelection=e},mxGraphSelectionModel.prototype.isSelected=function(e){return null!=e&&0<=mxUtils.indexOf(this.cells,e)},mxGraphSelectionModel.prototype.isEmpty=function(){return 0==this.cells.length},mxGraphSelectionModel.prototype.clear=function(){this.changeSelection(null,this.cells)},mxGraphSelectionModel.prototype.setCell=function(e){null!=e&&this.setCells([e])},mxGraphSelectionModel.prototype.setCells=function(e){if(null!=e){this.singleSelection&&(e=[this.getFirstSelectableCell(e)]);for(var n=[],t=0;t<e.length;t++)this.graph.isCellSelectable(e[t])&&n.push(e[t]);this.changeSelection(n,this.cells)}},mxGraphSelectionModel.prototype.getFirstSelectableCell=function(e){if(null!=e)for(var n=0;n<e.length;n++)if(this.graph.isCellSelectable(e[n]))return e[n];return null},mxGraphSelectionModel.prototype.addCell=function(e){null!=e&&this.addCells([e])},mxGraphSelectionModel.prototype.addCells=function(e){if(null!=e){var n=null;this.singleSelection&&(n=this.cells,e=[this.getFirstSelectableCell(e)]);for(var t=[],a=0;a<e.length;a++)!this.isSelected(e[a])&&this.graph.isCellSelectable(e[a])&&t.push(e[a]);this.changeSelection(t,n)}},mxGraphSelectionModel.prototype.removeCell=function(e){null!=e&&this.removeCells([e])},mxGraphSelectionModel.prototype.removeCells=function(e){if(null!=e){for(var n=[],t=0;t<e.length;t++)this.isSelected(e[t])&&n.push(e[t]);this.changeSelection(null,n)}},mxGraphSelectionModel.prototype.changeSelection=function(e,n){if(null!=e&&0<e.length&&null!=e[0]||null!=n&&0<n.length&&null!=n[0]){var t=new mxSelectionChange(this,e,n);t.execute();var a=new mxUndoableEdit(this,!1);a.add(t),this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",a))}},mxGraphSelectionModel.prototype.cellAdded=function(e){null!=e&&!this.isSelected(e)&&this.cells.push(e)},mxGraphSelectionModel.prototype.cellRemoved=function(e){null!=e&&(0<=(e=mxUtils.indexOf(this.cells,e))&&this.cells.splice(e,1))},mxSelectionChange.prototype.execute=function(){var e=mxLog.enter("mxSelectionChange.execute");if(window.status=mxResources.get(this.selectionModel.updatingSelectionResource)||this.selectionModel.updatingSelectionResource,null!=this.removed)for(var n=0;n<this.removed.length;n++)this.selectionModel.cellRemoved(this.removed[n]);if(null!=this.added)for(n=0;n<this.added.length;n++)this.selectionModel.cellAdded(this.added[n]);n=this.added,this.added=this.removed,this.removed=n,window.status=mxResources.get(this.selectionModel.doneResource)||this.selectionModel.doneResource,mxLog.leave("mxSelectionChange.execute",e),this.selectionModel.fireEvent(new mxEventObject(mxEvent.CHANGE,"added",this.added,"removed",this.removed))},mxCellEditor.prototype.graph=null,mxCellEditor.prototype.textarea=null,mxCellEditor.prototype.editingCell=null,mxCellEditor.prototype.trigger=null,mxCellEditor.prototype.modified=!1,mxCellEditor.prototype.autoSize=!0,mxCellEditor.prototype.emptyLabelText="",mxCellEditor.prototype.textNode="",mxCellEditor.prototype.init=function(){this.textarea=document.createElement("textarea"),this.textarea.className="mxCellEditor",this.textarea.style.position="absolute",this.textarea.style.overflow="visible",this.textarea.setAttribute("cols","20"),this.textarea.setAttribute("rows","4"),mxClient.IS_NS&&(this.textarea.style.resize="none"),mxEvent.addListener(this.textarea,"blur",mxUtils.bind(this,function(e){this.focusLost()})),mxEvent.addListener(this.textarea,"keydown",mxUtils.bind(this,function(e){mxEvent.isConsumed(e)||(113==e.keyCode||this.graph.isEnterStopsCellEditing()&&13==e.keyCode&&!mxEvent.isControlDown(e)&&!mxEvent.isShiftDown(e)?(this.graph.stopEditing(!1),mxEvent.consume(e)):27==e.keyCode?(this.graph.stopEditing(!0),mxEvent.consume(e)):(this.clearOnChange&&(this.clearOnChange=!1,this.textarea.value=""),this.setModified(!0)))})),mxEvent.addListener(this.textarea,"keypress",mxUtils.bind(this,function(e){this.autoSize&&!mxEvent.isConsumed(e)&&setTimeout(mxUtils.bind(this,function(){this.resize()}),0)}))},mxCellEditor.prototype.resize=function(){if(null!=this.textDiv){var e=this.graph.getView().getState(this.editingCell),n=this.graph.isLabelClipped(e.cell),t=this.graph.isWrapping(e.cell);if(this.graph.getModel().isEdge(e.cell))this.bounds.x=e.absoluteOffset.x,this.bounds.y=e.absoluteOffset.y,this.bounds.width=0,this.bounds.height=0;else if(null!=this.bounds){this.bounds.x=e.x,this.bounds.y=e.y,this.bounds.width=e.width,this.bounds.height=e.height,(a=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER))==mxConstants.ALIGN_LEFT?this.bounds.x-=e.width:a==mxConstants.ALIGN_RIGHT&&(this.bounds.x+=e.width),(a=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?this.bounds.y-=e.height:a==mxConstants.ALIGN_BOTTOM&&(this.bounds.y+=e.height)}"\n"!=(a=this.textarea.value).charAt(a.length-1)&&""!=a||(a+="&nbsp;"),a=mxUtils.htmlEntities(a,!1),t?(this.textDiv.style.whiteSpace="normal",this.textDiv.style.width=this.bounds.width+"px"):a=a.replace(/ /g,"&nbsp;"),a=a.replace(/\n/g,"<br/>"),this.textDiv.innerHTML=a;var a=this.textDiv.offsetWidth+30,i=this.textDiv.offsetHeight+16;a=Math.max(a,40),i=Math.max(i,20);n&&(a=Math.min(this.bounds.width-4,a),i=Math.min(this.bounds.height,i));var s=null!=e.text?e.text.margin:null;null==s&&(s=mxUtils.getValue(e.style,mxConstants.STYLE_ALIGN,mxConstants.ALIGN_CENTER),e=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE),s=mxUtils.getAlignmentAsPoint(s,e)),null!=s&&(!n&&t||(this.textarea.style.left=Math.max(0,Math.round(this.bounds.x-s.x*this.bounds.width+s.x*a)-3)+"px"),this.textarea.style.top=Math.max(0,Math.round(this.bounds.y-s.y*this.bounds.height+s.y*i)+4)+"px"),!n&&t||(this.textarea.style.width=a+"px"),this.textarea.style.height=i+"px"}},mxCellEditor.prototype.isModified=function(){return this.modified},mxCellEditor.prototype.setModified=function(e){this.modified=e},mxCellEditor.prototype.focusLost=function(){this.stopEditing(!this.graph.isInvokesStopCellEditing())},mxCellEditor.prototype.startEditing=function(e,n){null==this.textarea&&this.init(),this.stopEditing(!0);var t=this.graph.getView().getState(e);if(null!=t){this.editingCell=e,this.trigger=n,(this.textNode=null)!=t.text&&this.isHideLabel(t)&&(this.textNode=t.text.node,this.textNode.style.visibility="hidden");var a=this.graph.getView().scale,i=(a=mxUtils.getValue(t.style,mxConstants.STYLE_FONTSIZE,mxConstants.DEFAULT_FONTSIZE)*a,mxUtils.getValue(t.style,mxConstants.STYLE_FONTFAMILY,mxConstants.DEFAULT_FONTFAMILY)),s=mxUtils.getValue(t.style,mxConstants.STYLE_FONTCOLOR,"black"),o=mxUtils.getValue(t.style,mxConstants.STYLE_ALIGN,mxConstants.ALIGN_LEFT),r=(mxUtils.getValue(t.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD,l=(mxUtils.getValue(t.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC,d=(mxUtils.getValue(t.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE;this.textarea.style.fontSize=Math.round(a)+"px",this.textarea.style.lineHeight=Math.round(a*mxConstants.LINE_HEIGHT)+"px",this.textarea.style.fontFamily=i,this.textarea.style.textAlign=o,this.textarea.style.color=s,this.textarea.style.fontWeight=r?"bold":"normal",this.textarea.style.fontStyle=l?"italic":"",this.textarea.style.textDecoration=d?"underline":"",this.textarea.style.overflow="auto",this.textarea.style.outline="none",this.bounds=a=this.getEditorBounds(t),this.textarea.style.left=a.x+"px",this.textarea.style.top=a.y+"px",this.textarea.style.width=a.width+"px",this.textarea.style.height=a.height+"px",this.textarea.style.zIndex=5,null==(t=this.getInitialValue(t,n))||0==t.length?(t=this.getEmptyLabelText(),this.clearOnChange=!0):this.clearOnChange=!1,this.setModified(!1),this.textarea.value=t,this.graph.container.appendChild(this.textarea),"none"!=this.textarea.style.display&&(this.autoSize&&(this.textDiv=this.createTextDiv(),document.body.appendChild(this.textDiv),this.resize()),this.textarea.focus(),this.textarea.select())}},mxCellEditor.prototype.createTextDiv=function(){var e=document.createElement("div"),n=e.style;return n.position="absolute",n.whiteSpace="nowrap",n.visibility="hidden",n.display=mxClient.IS_QUIRKS?"inline":"inline-block",n.zoom="1",n.verticalAlign="top",n.lineHeight=this.textarea.style.lineHeight,n.fontSize=this.textarea.style.fontSize,n.fontFamily=this.textarea.style.fontFamily,n.fontWeight=this.textarea.style.fontWeight,n.textAlign=this.textarea.style.textAlign,n.fontStyle=this.textarea.style.fontStyle,n.textDecoration=this.textarea.style.textDecoration,e},mxCellEditor.prototype.stopEditing=function(e){null!=this.editingCell&&(null!=this.textNode&&(this.textNode.style.visibility="visible",this.textNode=null),!e&&this.isModified()&&this.graph.labelChanged(this.editingCell,this.getCurrentValue(),this.trigger),null!=this.textDiv&&(document.body.removeChild(this.textDiv),this.textDiv=null),this.bounds=this.trigger=this.editingCell=null,this.textarea.blur(),this.textarea.parentNode.removeChild(this.textarea))},mxCellEditor.prototype.getInitialValue=function(e,n){return this.graph.getEditingValue(e.cell,n)},mxCellEditor.prototype.getCurrentValue=function(){return this.textarea.value.replace(/\r/g,"")},mxCellEditor.prototype.isHideLabel=function(e){return!0},mxCellEditor.prototype.getMinimumSize=function(e){var n=this.graph.getView().scale;return new mxRectangle(0,0,null==e.text?30:e.text.size*n+20,"left"==this.textarea.style.textAlign?120:40)},mxCellEditor.prototype.getEditorBounds=function(e){var n=this.graph.getModel().isEdge(e.cell),t=this.graph.getView().scale,a=(i=this.getMinimumSize(e)).width,i=i.height,s=parseInt(e.style[mxConstants.STYLE_SPACING]||2)*t,o=parseInt(e.style[mxConstants.STYLE_SPACING_TOP]||0)*t+s,r=parseInt(e.style[mxConstants.STYLE_SPACING_RIGHT]||0)*t+s,l=parseInt(e.style[mxConstants.STYLE_SPACING_BOTTOM]||0)*t+s;t=parseInt(e.style[mxConstants.STYLE_SPACING_LEFT]||0)*t+s,r=new mxRectangle(e.x,e.y,Math.max(a,e.width-t-r),Math.max(i,e.height-o-l));return n?(r.x=e.absoluteOffset.x,r.y=e.absoluteOffset.y,null!=e.text&&null!=e.text.boundingBox&&(0<e.text.boundingBox.x&&(r.x=e.text.boundingBox.x),0<e.text.boundingBox.y&&(r.y=e.text.boundingBox.y))):null!=e.text&&null!=e.text.boundingBox&&(r.x=Math.min(r.x,e.text.boundingBox.x),r.y=Math.min(r.y,e.text.boundingBox.y)),r.x+=t,r.y+=o,null!=e.text&&null!=e.text.boundingBox&&(n?(r.width=Math.max(a,e.text.boundingBox.width),r.height=Math.max(i,e.text.boundingBox.height)):(r.width=Math.max(r.width,e.text.boundingBox.width),r.height=Math.max(r.height,e.text.boundingBox.height))),this.graph.getModel().isVertex(e.cell)&&((n=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER))==mxConstants.ALIGN_LEFT?r.x-=e.width:n==mxConstants.ALIGN_RIGHT&&(r.x+=e.width),(n=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?r.y-=e.height:n==mxConstants.ALIGN_BOTTOM&&(r.y+=e.height)),r},mxCellEditor.prototype.getEmptyLabelText=function(e){return this.emptyLabelText},mxCellEditor.prototype.getEditingCell=function(){return this.editingCell},mxCellEditor.prototype.destroy=function(){null!=this.textarea&&(mxEvent.release(this.textarea),null!=this.textarea.parentNode&&this.textarea.parentNode.removeChild(this.textarea),this.textarea=null)},mxCellRenderer.prototype.defaultEdgeShape=mxConnector,mxCellRenderer.prototype.defaultVertexShape=mxRectangleShape,mxCellRenderer.prototype.defaultTextShape=mxText,mxCellRenderer.prototype.legacyControlPosition=!0,mxCellRenderer.prototype.defaultShapes={},mxCellRenderer.registerShape=function(e,n){mxCellRenderer.prototype.defaultShapes[e]=n},mxCellRenderer.registerShape(mxConstants.SHAPE_RECTANGLE,mxRectangleShape),mxCellRenderer.registerShape(mxConstants.SHAPE_ELLIPSE,mxEllipse),mxCellRenderer.registerShape(mxConstants.SHAPE_RHOMBUS,mxRhombus),mxCellRenderer.registerShape(mxConstants.SHAPE_CYLINDER,mxCylinder),mxCellRenderer.registerShape(mxConstants.SHAPE_CONNECTOR,mxConnector),mxCellRenderer.registerShape(mxConstants.SHAPE_ACTOR,mxActor),mxCellRenderer.registerShape(mxConstants.SHAPE_TRIANGLE,mxTriangle),mxCellRenderer.registerShape(mxConstants.SHAPE_HEXAGON,mxHexagon),mxCellRenderer.registerShape(mxConstants.SHAPE_CLOUD,mxCloud),mxCellRenderer.registerShape(mxConstants.SHAPE_LINE,mxLine),mxCellRenderer.registerShape(mxConstants.SHAPE_ARROW,mxArrow),mxCellRenderer.registerShape(mxConstants.SHAPE_DOUBLE_ELLIPSE,mxDoubleEllipse),mxCellRenderer.registerShape(mxConstants.SHAPE_SWIMLANE,mxSwimlane),mxCellRenderer.registerShape(mxConstants.SHAPE_IMAGE,mxImageShape),mxCellRenderer.registerShape(mxConstants.SHAPE_LABEL,mxLabel),mxCellRenderer.prototype.initialize=function(e,n){var t=e.view.graph.getModel();null!=e.view.graph.container&&null==e.shape&&e.cell!=e.view.currentRoot&&(t.isVertex(e.cell)||t.isEdge(e.cell))&&(this.createShape(e),null==e.shape||null!=n&&!n||(this.initializeShape(e),e.view.graph.ordered||t.isEdge(e.cell)?e.invalidOrder=!0:e.view.graph.keepEdgesInForeground&&null!=this.firstEdge&&(this.firstEdge.parentNode==e.shape.node.parentNode?this.insertState(e,this.firstEdge):this.firstEdge=null),e.shape.scale=e.view.scale,this.createCellOverlays(e),this.installListeners(e)))},mxCellRenderer.prototype.initializeShape=function(e){e.shape.init(e.view.getDrawPane())},mxCellRenderer.prototype.getPreviousStateInContainer=function(e,n){for(var t=null,a=e.view.graph,i=a.getModel(),s=e.cell,o=i.getParent(s);null!=o&&null==t;)t=this.findPreviousStateInContainer(a,o,s,n),s=o,o=i.getParent(s);return t},mxCellRenderer.prototype.findPreviousStateInContainer=function(e,n,t,a){var i=null,s=e.getModel();for(t=null!=t?n.getIndex(t)-1:s.getChildCount(n)-1;0<=t&&null==i;t--)i=this.findPreviousStateInContainer(e,s.getChildAt(n,t),null,a);return null!=i||(null==(i=e.view.getState(n))||null!=i.shape&&null!=i.shape.node&&i.shape.node.parentNode==a)||(i=null),i},mxCellRenderer.prototype.order=function(e){var n=e.shape.node.parentNode,t=this.getPreviousStateInContainer(e,n),a=n.firstChild;null!=t&&(a=t.shape.node,null!=t.text&&null!=t.text.node&&t.text.node.parentNode==n&&(a=t.text.node),a=a.nextSibling),this.insertState(e,a)},mxCellRenderer.prototype.orderEdge=function(e){var n=(t=e.view).graph.getModel();if(t.graph.keepEdgesInForeground)null!=this.firstEdge&&null!=this.firstEdge.parentNode&&this.firstEdge.parentNode==e.shape.node.parentNode||(this.firstEdge=e.shape.node);else if(t.graph.keepEdgesInBackground){var t,a=e.shape.node,i=a.parentNode;n=n.getParent(e.cell);null!=(i=null!=(t=t.getState(n))&&null!=t.shape&&null!=t.shape.node?t.shape.node.nextSibling:i.firstChild)&&i!=a&&this.insertState(e,i)}},mxCellRenderer.prototype.insertState=function(e,n){e.shape.node.parentNode.insertBefore(e.shape.node,n),null!=e.text&&null!=e.text.node&&e.text.node.parentNode==e.shape.node.parentNode&&e.shape.node.parentNode.insertBefore(e.text.node,e.shape.node.nextSibling)},mxCellRenderer.prototype.createShape=function(e){if(null!=e.style){var n=mxStencilRegistry.getStencil(e.style[mxConstants.STYLE_SHAPE]);null!=n?e.shape=new mxShape(n):(n=this.getShapeConstructor(e),e.shape=new n),e.shape.points=e.absolutePoints,e.shape.bounds=new mxRectangle(e.x,e.y,e.width,e.height),e.shape.dialect=e.view.graph.dialect,this.configureShape(e)}},mxCellRenderer.prototype.getShape=function(e){return null!=e?mxCellRenderer.prototype.defaultShapes[e]:null},mxCellRenderer.prototype.getShapeConstructor=function(e){var n=this.getShape(e.style[mxConstants.STYLE_SHAPE]);return null==n&&(n=e.view.graph.getModel().isEdge(e.cell)?this.defaultEdgeShape:this.defaultVertexShape),n},mxCellRenderer.prototype.configureShape=function(e){e.shape.apply(e),e.shape.image=e.view.graph.getImage(e),e.shape.indicatorShape=this.getShape(e.view.graph.getIndicatorShape(e)),e.shape.indicatorColor=e.view.graph.getIndicatorColor(e),e.shape.indicatorGradientColor=e.view.graph.getIndicatorGradientColor(e),e.shape.indicatorDirection=e.style[mxConstants.STYLE_INDICATOR_DIRECTION],e.shape.indicatorImage=e.view.graph.getIndicatorImage(e),this.postConfigureShape(e)},mxCellRenderer.prototype.postConfigureShape=function(e){null!=e.shape&&(this.resolveColor(e,"indicatorColor",mxConstants.STYLE_FILLCOLOR),this.resolveColor(e,"indicatorGradientColor",mxConstants.STYLE_GRADIENTCOLOR),this.resolveColor(e,"fill",mxConstants.STYLE_FILLCOLOR),this.resolveColor(e,"stroke",mxConstants.STYLE_STROKECOLOR),this.resolveColor(e,"gradient",mxConstants.STYLE_GRADIENTCOLOR))},mxCellRenderer.prototype.resolveColor=function(e,n,t){var a=e.shape[n],i=e.view.graph,s=null;"inherit"==a?s=i.model.getParent(e.cell):"swimlane"==a?(s=null!=i.model.getTerminal(e.cell,!1)?i.model.getTerminal(e.cell,!1):e.cell,s=i.getSwimlane(s),t=i.swimlaneIndicatorColorAttribute):"indicated"==a&&(e.shape[n]=e.shape.indicatorColor),null!=s&&(a=i.getView().getState(s),(e.shape[n]=null)!=a&&(e.shape[n]=null!=a.shape&&"indicatorColor"!=n?a.shape[n]:a.style[t]))},mxCellRenderer.prototype.getLabelValue=function(e){return e.view.graph.getLabel(e.cell)},mxCellRenderer.prototype.createLabel=function(t,e){var a=t.view.graph;if(a.getModel().isEdge(t.cell),0<t.style[mxConstants.STYLE_FONTSIZE]||null==t.style[mxConstants.STYLE_FONTSIZE]){var n=a.isHtmlLabel(t.cell)||null!=e&&mxUtils.isNode(e);t.text=new this.defaultTextShape(e,new mxRectangle,t.style[mxConstants.STYLE_ALIGN]||mxConstants.ALIGN_CENTER,a.getVerticalAlign(t),t.style[mxConstants.STYLE_FONTCOLOR],t.style[mxConstants.STYLE_FONTFAMILY],t.style[mxConstants.STYLE_FONTSIZE],t.style[mxConstants.STYLE_FONTSTYLE],t.style[mxConstants.STYLE_SPACING],t.style[mxConstants.STYLE_SPACING_TOP],t.style[mxConstants.STYLE_SPACING_RIGHT],t.style[mxConstants.STYLE_SPACING_BOTTOM],t.style[mxConstants.STYLE_SPACING_LEFT],t.style[mxConstants.STYLE_HORIZONTAL],t.style[mxConstants.STYLE_LABEL_BACKGROUNDCOLOR],t.style[mxConstants.STYLE_LABEL_BORDERCOLOR],a.isWrapping(t.cell)&&a.isHtmlLabel(t.cell),a.isLabelClipped(t.cell),t.style[mxConstants.STYLE_OVERFLOW],t.style[mxConstants.STYLE_LABEL_PADDING]),t.text.opacity=mxUtils.getValue(t.style,mxConstants.STYLE_TEXT_OPACITY,100),t.text.dialect=n?mxConstants.DIALECT_STRICTHTML:t.view.graph.dialect,t.text.state=t,this.initializeLabel(t);var i=!1,s=function(e){var n=t;return(mxClient.IS_TOUCH||i)&&(n=mxEvent.getClientX(e),e=mxEvent.getClientY(e),e=mxUtils.convertPoint(a.container,n,e),n=a.view.getState(a.getCellAt(e.x,e.y))),n};mxEvent.addGestureListeners(t.text.node,mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&(a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,t)),i=a.dialect!=mxConstants.DIALECT_SVG&&"IMG"==mxEvent.getSource(e).nodeName)}),mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,s(e)))}),mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&(a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,s(e))),i=!1)})),mxEvent.addListener(t.text.node,"dblclick",mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&(a.dblClick(e,t.cell),mxEvent.consume(e))}))}},mxCellRenderer.prototype.initializeLabel=function(e){var n=e.view.graph;e.text.dialect!=mxConstants.DIALECT_SVG&&(mxClient.IS_SVG&&mxClient.NO_FO?e.text.init(n.container):mxUtils.isVml(e.view.getDrawPane())&&(null!=e.shape.label?e.text.init(e.shape.label):e.text.init(e.shape.node))),null==e.text.node&&(e.text.init(e.view.getDrawPane()),null!=e.shape&&null!=e.text&&e.shape.node.parentNode.insertBefore(e.text.node,e.shape.node.nextSibling))},mxCellRenderer.prototype.createCellOverlays=function(e){var n=e.view.graph.getCellOverlays(e.cell),t=null;if(null!=n){t=new mxDictionary;for(var a=0;a<n.length;a++){var i=null!=e.overlays?e.overlays.remove(n[a]):null;null==i&&((i=new mxImageShape(new mxRectangle,n[a].image.src)).dialect=e.view.graph.dialect,i.preserveImageAspect=!1,i.overlay=n[a],this.initializeOverlay(e,i),this.installCellOverlayListeners(e,n[a],i),null!=n[a].cursor&&(i.node.style.cursor=n[a].cursor)),t.put(n[a],i)}}null!=e.overlays&&e.overlays.visit(function(e,n){n.destroy()}),e.overlays=t},mxCellRenderer.prototype.initializeOverlay=function(e,n){n.init(e.view.getOverlayPane())},mxCellRenderer.prototype.installCellOverlayListeners=function(n,t,e){var a=n.view.graph;mxEvent.addListener(e.node,"click",function(e){a.isEditing()&&a.stopEditing(!a.isInvokesStopCellEditing()),t.fireEvent(new mxEventObject(mxEvent.CLICK,"event",e,"cell",n.cell))}),mxEvent.addGestureListeners(e.node,function(e){mxEvent.consume(e)},function(e){a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,n))}),mxClient.IS_TOUCH&&mxEvent.addListener(e.node,"touchend",function(e){t.fireEvent(new mxEventObject(mxEvent.CLICK,"event",e,"cell",n.cell))})},mxCellRenderer.prototype.createControl=function(t){var a=t.view.graph,e=a.getFoldingImage(t);if(a.foldingEnabled&&null!=e){if(null==t.control){var n=new mxRectangle(0,0,e.width,e.height);t.control=new mxImageShape(n,e.src),t.control.preserveImageAspect=!1,t.control.dialect=a.dialect,this.initControl(t,t.control,!0,function(e){if(a.isEnabled()){var n=!a.isCellCollapsed(t.cell);a.foldCells(n,!1,[t.cell]),mxEvent.consume(e)}})}}else null!=t.control&&(t.control.destroy(),t.control=null)},mxCellRenderer.prototype.initControl=function(n,e,t,a){var i=n.view.graph;return i.isHtmlLabel(n.cell)&&mxClient.NO_FO&&i.dialect==mxConstants.DIALECT_SVG?(e.dialect=mxConstants.DIALECT_PREFERHTML,e.init(i.container),e.node.style.zIndex=1):e.init(n.view.getOverlayPane()),e=e.innerNode||e.node,a&&(i.isEnabled()&&(e.style.cursor="pointer"),mxEvent.addListener(e,"click",a)),t&&mxEvent.addGestureListeners(e,function(e){i.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,n)),mxEvent.consume(e)},function(e){i.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,n))}),e},mxCellRenderer.prototype.isShapeEvent=function(e,n){return!0},mxCellRenderer.prototype.isLabelEvent=function(e,n){return!0},mxCellRenderer.prototype.installListeners=function(t){var a=t.view.graph,n=function(e){var n=t;return(a.dialect!=mxConstants.DIALECT_SVG&&"IMG"==mxEvent.getSource(e).nodeName||mxClient.IS_TOUCH)&&(n=mxEvent.getClientX(e),e=mxEvent.getClientY(e),e=mxUtils.convertPoint(a.container,n,e),n=a.view.getState(a.getCellAt(e.x,e.y))),n},i=!1;mxEvent.addListener(t.shape.node,"gesturestart",mxUtils.bind(this,function(e){a.lastTouchTime=0,i=!0,mxEvent.consume(e)})),mxEvent.addGestureListeners(t.shape.node,mxUtils.bind(this,function(e){this.isShapeEvent(t,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:t)):i&&mxEvent.consume(e)}),mxUtils.bind(this,function(e){this.isShapeEvent(t,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:n(e))):i&&mxEvent.consume(e)}),mxUtils.bind(this,function(e){this.isShapeEvent(t,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:n(e))):i&&mxEvent.consume(e)}));var s=mxClient.IS_TOUCH?"gestureend":"dblclick";mxEvent.addListener(t.shape.node,s,mxUtils.bind(this,function(e){i=!1,"gestureend"==s?(a.lastTouchTime=0,a.gestureEnabled&&(a.handleGesture(t,e),mxEvent.consume(e))):this.isShapeEvent(t,e)&&(a.dblClick(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:t.cell),mxEvent.consume(e))}))},mxCellRenderer.prototype.redrawLabel=function(e,n){var t=this.getLabelValue(e);if(null==e.text&&null!=t&&(mxUtils.isNode(t)||0<t.length)?this.createLabel(e,t):null==e.text||null!=t&&0!=t.length||(e.text.destroy(),e.text=null),null!=e.text){var a=(i=e.view.graph).isWrapping(e.cell),i=i.isLabelClipped(e.cell),s=this.getLabelBounds(e);!n&&e.text.value==t&&e.text.isWrapping==a&&e.text.isClipping==i&&e.text.scale==e.view.scale&&e.text.bounds.equals(s)||(e.text.value=t,e.text.bounds=s,e.text.scale=this.getTextScale(e),e.text.isWrapping=a,e.text.isClipping=i,e.text.redraw())}},mxCellRenderer.prototype.getTextScale=function(e){return e.view.scale},mxCellRenderer.prototype.getLabelBounds=function(e){var n=e.view.graph,t=e.view.scale,a=n.getModel().isEdge(e.cell),i=new mxRectangle(e.absoluteOffset.x,e.absoluteOffset.y);return e.text.updateMargin(),a?(a=e.text.getSpacing(),i.x+=a.x*t,i.y+=a.y*t,null!=(n=n.getCellGeometry(e.cell))&&(i.width=Math.max(0,e.text.margin.x*n.width*t-e.text.spacingLeft*t-e.text.spacingRight*t),i.height=Math.max(0,e.text.margin.y*n.height*t-e.text.spacingTop*t-e.text.spacingBottom*t))):(e.text.isPaintBoundsInverted()&&(a=i.x,i.x=i.y,i.y=a),i.x+=e.x,i.y+=e.y,i.width=Math.max(1,e.width),i.height=Math.max(1,e.height),n.isSwimlane(e.cell)&&(0<(n=n.getStartSize(e.cell)).width?(a=Math.min(i.width,n.width*t),e.shape.flipH&&(i.x+=i.width-a),i.width=a):0<n.height&&(a=Math.min(i.height,n.height*t),e.shape.flipV&&(i.y+=i.height-a),i.height=a)),this.rotateLabelBounds(e,i)),i},mxCellRenderer.prototype.rotateLabelBounds=function(e,n){if(e.text.isPaintBoundsInverted()){var t=(e.width-e.height)/2;n.x+=t,n.y-=t,t=n.width,n.width=n.height,n.height=t}if(n.x-=e.text.margin.x*n.width,n.y-=e.text.margin.y*n.height,"fill"!=e.style[mxConstants.STYLE_OVERFLOW]){t=e.view.scale;var a=e.text.getSpacing();n.x+=a.x*t,n.y+=a.y*t,n.width=Math.max(0,n.width-e.text.spacingLeft*t-e.text.spacingRight*t),n.height=Math.max(0,n.height-e.text.spacingTop*t-e.text.spacingBottom*t)}var i=e.text.getTextRotation();0!=i&&null!=e&&e.view.graph.model.isVertex(e.cell)&&(t=e.getCenterX(),a=e.getCenterY(),n.x!=t||n.y!=a)&&(i*=Math.PI/180,pt=mxUtils.getRotatedPoint(new mxPoint(n.x,n.y),Math.cos(i),Math.sin(i),new mxPoint(t,a)),n.x=pt.x,n.y=pt.y)},mxCellRenderer.prototype.redrawCellOverlays=function(s,o){if(this.createCellOverlays(s),null!=s.overlays){var r=mxUtils.mod(mxUtils.getValue(s.style,mxConstants.STYLE_ROTATION,0),90),e=mxUtils.toRadians(r),l=Math.cos(e),d=Math.sin(e);s.overlays.visit(function(e,n){var t=n.overlay.getBounds(s);if(!s.view.graph.getModel().isEdge(s.cell)&&null!=s.shape&&0!=r){var a=t.getCenterX(),i=t.getCenterY();a=(i=mxUtils.getRotatedPoint(new mxPoint(a,i),l,d,new mxPoint(s.getCenterX(),s.getCenterY()))).x,i=i.y;t.x=Math.round(a-t.width/2),t.y=Math.round(i-t.height/2)}!o&&null!=n.bounds&&n.scale==s.view.scale&&n.bounds.equals(t)||(n.bounds=t,n.scale=s.view.scale,n.redraw())})}},mxCellRenderer.prototype.redrawControl=function(e,n){if(null!=e.control){var t=this.getControlBounds(e),a=this.legacyControlPosition?mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION,0):e.shape.getTextRotation(),i=e.view.scale;!n&&e.control.scale==i&&e.control.bounds.equals(t)&&e.control.rotation==a||(e.control.rotation=a,e.control.bounds=t,e.control.scale=i,e.control.redraw())}},mxCellRenderer.prototype.getControlBounds=function(e){if(null==e.control)return null;var n=e.control.scale,t=e.control.bounds.width/n,a=(n=e.control.bounds.height/n,e.view.scale),i=e.getCenterX(),s=e.getCenterY();if(!e.view.graph.getModel().isEdge(e.cell)&&(i=e.x+t*a,s=e.y+n*a,null!=e.shape)){var o=e.shape.getShapeRotation();if(this.legacyControlPosition)o=mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION,0);else if(e.shape.isPaintBoundsInverted()){var r=(e.width-e.height)/2;i=i+r,s=s-r}0!=o&&(r=mxUtils.toRadians(o),o=Math.cos(r),r=Math.sin(r),i=(s=mxUtils.getRotatedPoint(new mxPoint(i,s),o,r,new mxPoint(e.getCenterX(),e.getCenterY()))).x,s=s.y)}return e.view.graph.getModel().isEdge(e.cell),new mxRectangle(Math.round(i-t/2*a),Math.round(s-n/2*a),Math.round(t*a),Math.round(n*a))},mxCellRenderer.prototype.redraw=function(e,n,t){if(null!=e.shape){var a=!1;e.view.graph.getModel().isEdge(e.cell),reconfigure=null!=n&&n,this.createControl(e),(e.orderChanged||e.invalidOrder)&&(e.view.graph.ordered?this.order(e):this.orderEdge(e)),!e.orderChanged&&mxUtils.equalEntries(e.shape.style,e.style)||(this.configureShape(e),n=!0),delete e.invalidOrder,delete e.orderChanged,!n&&null!=e.shape.bounds&&e.shape.scale==e.view.scale&&e.shape.bounds.equals(e)&&mxUtils.equalPoints(e.shape.points,e.absolutePoints)||(a=!0,e.shape.points=null!=e.absolutePoints?e.absolutePoints.slice():null,e.shape.bounds=new mxRectangle(e.x,e.y,e.width,e.height),e.shape.scale=e.view.scale,null==t||t?e.shape.redraw():e.shape.updateBoundingBox()),(null==t||t)&&(this.redrawLabel(e,a),this.redrawCellOverlays(e,a),this.redrawControl(e,a))}},mxCellRenderer.prototype.destroy=function(e){null!=e.shape&&(null!=e.text&&(e.text.destroy(),e.text=null),null!=e.overlays&&(e.overlays.visit(function(e,n){n.destroy()}),e.overlays=null),null!=e.control&&(e.control.destroy(),e.control=null),e.shape.destroy(),e.shape=null)};var mxEdgeStyle={EntityRelation:function(e,n,t,a,i){var s=e.view,o=s.graph;a=mxUtils.getValue(e.style,mxConstants.STYLE_SEGMENT,mxConstants.ENTITY_SEGMENT)*s.scale;var r=(d=e.absolutePoints)[0],l=d[d.length-1],d=!1;if(null!=r)(n=new mxCellState).x=r.x,n.y=r.y;else{if(null==n)return;var c=mxUtils.getPortConstraints(n,e,!0,mxConstants.DIRECTION_MASK_NONE);c!=mxConstants.DIRECTION_MASK_NONE?d=c==mxConstants.DIRECTION_MASK_WEST:(r=o.getCellGeometry(n.cell)).relative?d=r.x<=.5:null!=t&&(d=t.x+t.width<n.x)}r=!0,null!=l?((t=new mxCellState).x=l.x,t.y=l.y):null!=t&&((c=mxUtils.getPortConstraints(t,e,!1,mxConstants.DIRECTION_MASK_NONE))!=mxConstants.DIRECTION_MASK_NONE?r=c==mxConstants.DIRECTION_MASK_WEST:(e=o.getCellGeometry(t.cell)).relative?r=e.x<=.5:null!=n&&(r=n.x+n.width<t.x)),null!=n&&null!=t&&(e=d?n.x:n.x+n.width,n=s.getRoutingCenterY(n),o=r?t.x:t.x+t.width,t=s.getRoutingCenterY(t),s=new mxPoint(e+(d?-a:a),n),l=new mxPoint(o+(r?-a:a),t),d==r?(a=d?Math.min(e,o)-a:Math.max(e,o)+a,i.push(new mxPoint(a,n)),i.push(new mxPoint(a,t))):(s.x<l.x==d?(a=n+(t-n)/2,i.push(s),i.push(new mxPoint(s.x,a)),i.push(new mxPoint(l.x,a))):i.push(s),i.push(l)))},Loop:function(e,n,t,a,i){if(null!=n){var s=(t=e.view).graph;null!=(a=null!=a&&0<a.length?a[0]:null)&&(a=t.transformControlPoint(e,a),mxUtils.contains(n,a.x,a.y)&&(a=null));var o=0,r=0,l=0,d=0;s=mxUtils.getValue(e.style,mxConstants.STYLE_SEGMENT,s.gridSize)*t.scale;(e=mxUtils.getValue(e.style,mxConstants.STYLE_DIRECTION,mxConstants.DIRECTION_WEST))==mxConstants.DIRECTION_NORTH||e==mxConstants.DIRECTION_SOUTH?(o=t.getRoutingCenterX(n),r=s):(l=t.getRoutingCenterY(n),d=s),null==a||a.x<n.x||a.x>n.x+n.width?null!=a?(o=a.x,d=Math.max(Math.abs(l-a.y),d)):e==mxConstants.DIRECTION_NORTH?l=n.y-2*r:e==mxConstants.DIRECTION_SOUTH?l=n.y+n.height+2*r:o=e==mxConstants.DIRECTION_EAST?n.x-2*d:n.x+n.width+2*d:null!=a&&(o=t.getRoutingCenterX(n),r=Math.max(Math.abs(o-a.x),d),l=a.y,d=0),i.push(new mxPoint(o-r,l-d)),i.push(new mxPoint(o+r,l+d))}},ElbowConnector:function(e,n,t,a,i){var s=null!=a&&0<a.length?a[0]:null,o=!1,r=!1;if(null!=n&&null!=t)if(null!=s){var l=Math.min(n.x,t.x),d=Math.max(n.x+n.width,t.x+t.width),c=(r=Math.min(n.y,t.y),Math.max(n.y+n.height,t.y+t.height));o=(s=e.view.transformControlPoint(e,s)).y<r||s.y>c,r=s.x<l||s.x>d}else(o=(l=Math.max(n.x,t.x))==(d=Math.min(n.x+n.width,t.x+t.width)))||(r=(r=Math.max(n.y,t.y))==(c=Math.min(n.y+n.height,t.y+t.height)));r||!o&&e.style[mxConstants.STYLE_ELBOW]!=mxConstants.ELBOW_VERTICAL?mxEdgeStyle.SideToSide(e,n,t,a,i):mxEdgeStyle.TopToBottom(e,n,t,a,i)},SideToSide:function(e,n,t,a,i){var s=e.view;a=null!=a&&0<a.length?a[0]:null;var o=(r=e.absolutePoints)[0],r=r[r.length-1];null!=a&&(a=s.transformControlPoint(e,a)),null!=o&&((n=new mxCellState).x=o.x,n.y=o.y),null!=r&&((t=new mxCellState).x=r.x,t.y=r.y),null!=n&&null!=t&&(e=Math.max(n.x,t.x),o=Math.min(n.x+n.width,t.x+t.width),e=null!=a?a.x:o+(e-o)/2,o=s.getRoutingCenterY(n),s=s.getRoutingCenterY(t),null!=a&&(a.y>=n.y&&a.y<=n.y+n.height&&(o=a.y),a.y>=t.y&&a.y<=t.y+t.height&&(s=a.y)),!mxUtils.contains(t,e,o)&&!mxUtils.contains(n,e,o)&&i.push(new mxPoint(e,o)),!mxUtils.contains(t,e,s)&&!mxUtils.contains(n,e,s)&&i.push(new mxPoint(e,s)),1==i.length&&(null!=a?!mxUtils.contains(t,e,a.y)&&!mxUtils.contains(n,e,a.y)&&i.push(new mxPoint(e,a.y)):(s=Math.max(n.y,t.y),n=Math.min(n.y+n.height,t.y+t.height),i.push(new mxPoint(e,s+(n-s)/2)))))},TopToBottom:function(e,n,t,a,i){var s=e.view;a=null!=a&&0<a.length?a[0]:null;var o=(r=e.absolutePoints)[0],r=r[r.length-1];null!=a&&(a=s.transformControlPoint(e,a)),null!=o&&((n=new mxCellState).x=o.x,n.y=o.y),null!=r&&((t=new mxCellState).x=r.x,t.y=r.y),null!=n&&null!=t&&(o=Math.max(n.y,t.y),r=Math.min(n.y+n.height,t.y+t.height),e=s.getRoutingCenterX(n),null!=a&&a.x>=n.x&&a.x<=n.x+n.width&&(e=a.x),o=null!=a?a.y:r+(o-r)/2,!mxUtils.contains(t,e,o)&&!mxUtils.contains(n,e,o)&&i.push(new mxPoint(e,o)),e=null!=a&&a.x>=t.x&&a.x<=t.x+t.width?a.x:s.getRoutingCenterX(t),!mxUtils.contains(t,e,o)&&!mxUtils.contains(n,e,o)&&i.push(new mxPoint(e,o)),1==i.length&&(null!=a&&1==i.length?!mxUtils.contains(t,a.x,o)&&!mxUtils.contains(n,a.x,o)&&i.push(new mxPoint(a.x,o)):(s=Math.max(n.x,t.x),n=Math.min(n.x+n.width,t.x+t.width),i.push(new mxPoint(s+(n-s)/2,o)))))},SegmentConnector:function(e,n,t,a,i){var s=e.absolutePoints,o=!0,r=null,l=s[0];null==l&&null!=n?l=new mxPoint(e.view.getRoutingCenterX(n),e.view.getRoutingCenterY(n)):null!=l&&(l=l.clone());var d=s.length-1;if(null!=a&&0<a.length){r=e.view.transformControlPoint(e,a[0]);for(var c=n,m=s[0],u=!1,p=!1,g=(u=r,a.length),v=0;v<2;v++){var h=null!=m&&m.x==u.x,f=null!=m&&m.y==u.y,b=null!=c&&u.y>=c.y&&u.y<=c.y+c.height;c=null!=c&&u.x>=c.x&&u.x<=c.x+c.width,u=f||null==m&&b,p=h||null==m&&c;if(null!=m&&!f&&!h&&(b||c)){o=!b;break}if(p||u){o=u,1==v&&(o=0==a.length%2?u:p);break}c=t,m=s[d],u=e.view.transformControlPoint(e,a[g-1])}for(o&&(null!=s[0]&&s[0].y!=r.y||null==s[0]&&null!=n&&(r.y<n.y||r.y>n.y+n.height))?i.push(new mxPoint(l.x,r.y)):!o&&(null!=s[0]&&s[0].x!=r.x||null==s[0]&&null!=n&&(r.x<n.x||r.x>n.x+n.width))&&i.push(new mxPoint(r.x,l.y)),o?l.y=r.y:l.x=r.x,v=0;v<a.length;v++)o=!o,r=e.view.transformControlPoint(e,a[v]),o?l.y=r.y:l.x=r.x,i.push(l.clone())}else r=l,o=!0;if(null==(l=s[d])&&null!=t&&(l=new mxPoint(e.view.getRoutingCenterX(t),e.view.getRoutingCenterY(t))),o&&(null!=s[d]&&s[d].y!=r.y||null==s[d]&&null!=t&&(r.y<t.y||r.y>t.y+t.height))?i.push(new mxPoint(l.x,r.y)):!o&&(null!=s[d]&&s[d].x!=r.x||null==s[d]&&null!=t&&(r.x<t.x||r.x>t.x+t.width))&&i.push(new mxPoint(r.x,l.y)),null==s[0]&&null!=n)for(;1<i.length&&mxUtils.contains(n,i[1].x,i[1].y);)i=i.splice(1,1);if(null==s[d]&&null!=t)for(;1<i.length&&mxUtils.contains(t,i[i.length-1].x,i[i.length-1].y);)i=i.splice(i.length-1,1)},orthBuffer:10,dirVectors:[[-1,0],[0,-1],[1,0],[0,1],[-1,0],[0,-1],[1,0]],wayPoints1:[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],routePatterns:[[[513,2308,2081,2562],[513,1090,514,2184,2114,2561],[513,1090,514,2564,2184,2562],[513,2308,2561,1090,514,2568,2308]],[[514,1057,513,2308,2081,2562],[514,2184,2114,2561],[514,2184,2562,1057,513,2564,2184],[514,1057,513,2568,2308,2561]],[[1090,514,1057,513,2308,2081,2562],[2114,2561],[1090,2562,1057,513,2564,2184],[1090,514,1057,513,2308,2561,2568]],[[2081,2562],[1057,513,1090,514,2184,2114,2561],[1057,513,1090,514,2184,2562,2564],[1057,2561,1090,514,2568,2308]]],inlineRoutePatterns:[[null,[2114,2568],null,null],[null,[514,2081,2114,2568],null,null],[null,[2114,2561],null,null],[[2081,2562],[1057,2114,2568],[2184,2562],null]],vertexSeperations:[],limits:[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]],LEFT_MASK:32,TOP_MASK:64,RIGHT_MASK:128,BOTTOM_MASK:256,LEFT:1,TOP:2,RIGHT:4,BOTTOM:8,SIDE_MASK:480,CENTER_MASK:512,SOURCE_MASK:1024,TARGET_MASK:2048,VERTEX_MASK:3072,OrthConnector:function(e,n,t,a,i){var s=e.view.graph,o=null!=n&&s.getModel().isEdge(n.cell);s=null!=t&&s.getModel().isEdge(t.cell);if(null!=a&&0<a.length||o||s)mxEdgeStyle.SegmentConnector(e,n,t,a,i);else{var r=(a=e.absolutePoints)[0],l=a[a.length-1];a=null!=n?n.x:r.x;o=null!=n?n.y:r.y;var d=null!=n?n.width:1,c=null!=n?n.height:1,m=null!=t?t.x:l.x,u=null!=t?t.y:l.y,p=null!=t?t.width:1,g=null!=t?t.height:1,v=(s=e.view.scale*mxEdgeStyle.orthBuffer,[mxConstants.DIRECTION_MASK_ALL,mxConstants.DIRECTION_MASK_ALL]);for(null!=n&&(v[0]=mxUtils.getPortConstraints(n,e,!0,mxConstants.DIRECTION_MASK_ALL)),null!=t&&(v[1]=mxUtils.getPortConstraints(t,e,!1,mxConstants.DIRECTION_MASK_ALL)),e=[0,0],a=[[a,o,d,c],[m,u,p,g]],d=0;d<2;d++)mxEdgeStyle.limits[d][1]=a[d][0]-s,mxEdgeStyle.limits[d][2]=a[d][1]-s,mxEdgeStyle.limits[d][4]=a[d][0]+a[d][2]+s,mxEdgeStyle.limits[d][8]=a[d][1]+a[d][3]+s;for(d=a[0][0]+a[0][2]/2-(a[1][0]+a[1][2]/2),c=a[0][1]+a[0][3]/2-(a[1][1]+a[1][3]/2),d<(o=0)?o=c<0?2:1:c<=0&&(o=3,0==d&&(o=2)),(c=null)!=n&&(c=r),n=[[.5,.5],[.5,.5]],d=0;d<2;d++)null!=c&&(n[d][0]=(c.x-a[d][0])/a[d][2],n[d][0]<.01?e[d]=mxConstants.DIRECTION_MASK_WEST:.99<n[d][0]&&(e[d]=mxConstants.DIRECTION_MASK_EAST),n[d][1]=(c.y-a[d][1])/a[d][3],n[d][1]<.01?e[d]=mxConstants.DIRECTION_MASK_NORTH:.99<n[d][1]&&(e[d]=mxConstants.DIRECTION_MASK_SOUTH)),(c=null)!=t&&(c=l);for(d=a[0][1]-(a[1][1]+a[1][3]),c=a[0][0]-(a[1][0]+a[1][2]),m=a[1][1]-(a[0][1]+a[0][3]),u=a[1][0]-(a[0][0]+a[0][2]),mxEdgeStyle.vertexSeperations[1]=Math.max(c-2*s,0),mxEdgeStyle.vertexSeperations[2]=Math.max(d-2*s,0),mxEdgeStyle.vertexSeperations[4]=Math.max(m-2*s,0),mxEdgeStyle.vertexSeperations[3]=Math.max(u-2*s,0),t=[],l=[],(r=[])[0]=u<=c?mxConstants.DIRECTION_MASK_WEST:mxConstants.DIRECTION_MASK_EAST,l[0]=m<=d?mxConstants.DIRECTION_MASK_NORTH:mxConstants.DIRECTION_MASK_SOUTH,r[1]=mxUtils.reversePortConstraints(r[0]),l[1]=mxUtils.reversePortConstraints(l[0]),c=u<=c?c:u,m=m<=d?d:m,p=!(u=[[0,0],[0,0]]),d=0;d<2;d++)0==e[d]&&(0==(r[d]&v[d])&&(r[d]=mxUtils.reversePortConstraints(r[d])),0==(l[d]&v[d])&&(l[d]=mxUtils.reversePortConstraints(l[d])),u[d][0]=l[d],u[d][1]=r[d]);for(2*s<m&&2*s<c&&(0<(r[0]&v[0])&&0<(l[1]&v[1])?(u[0][0]=r[0],u[0][1]=l[0],u[1][0]=l[1],u[1][1]=r[1],p=!0):0<(l[0]&v[0])&&0<(r[1]&v[1])&&(u[0][0]=l[0],u[0][1]=r[0],u[1][0]=r[1],u[1][1]=l[1],p=!0)),2*s<m&&!p&&(u[0][0]=l[0],u[0][1]=r[0],u[1][0]=l[1],u[1][1]=r[1],p=!0),2*s<c&&!p&&(u[0][0]=r[0],u[0][1]=l[0],u[1][0]=r[1],u[1][1]=l[1]),d=0;d<2;d++)0==e[d]&&(0==(u[d][0]&v[d])&&(u[d][0]=u[d][1]),t[d]=u[d][0]&v[d],t[d]|=(u[d][1]&v[d])<<8,t[d]|=(u[1-d][d]&v[d])<<16,t[d]|=(u[1-d][1-d]&v[d])<<24,0==(15&t[d])&&(t[d]<<=8),0==(3840&t[d])&&(t[d]=15&t[d]|t[d]>>8),0==(983040&t[d])&&(t[d]=65535&t[d]|(251658240&t[d])>>8),e[d]=15&t[d],v[d]==mxConstants.DIRECTION_MASK_WEST||v[d]==mxConstants.DIRECTION_MASK_NORTH||v[d]==mxConstants.DIRECTION_MASK_EAST||v[d]==mxConstants.DIRECTION_MASK_SOUTH)&&(e[d]=v[d]);switch(d=e[0]==mxConstants.DIRECTION_MASK_EAST?3:e[0],v=e[1]==mxConstants.DIRECTION_MASK_EAST?3:e[1],(d-=o)<1&&(d+=4),(v-=o)<1&&(v+=4),v=mxEdgeStyle.routePatterns[d-1][v-1],mxEdgeStyle.wayPoints1[0][0]=a[0][0],mxEdgeStyle.wayPoints1[0][1]=a[0][1],e[0]){case mxConstants.DIRECTION_MASK_WEST:mxEdgeStyle.wayPoints1[0][0]-=s,mxEdgeStyle.wayPoints1[0][1]+=n[0][1]*a[0][3];break;case mxConstants.DIRECTION_MASK_SOUTH:mxEdgeStyle.wayPoints1[0][0]+=n[0][0]*a[0][2],mxEdgeStyle.wayPoints1[0][1]+=a[0][3]+s;break;case mxConstants.DIRECTION_MASK_EAST:mxEdgeStyle.wayPoints1[0][0]+=a[0][2]+s,mxEdgeStyle.wayPoints1[0][1]+=n[0][1]*a[0][3];break;case mxConstants.DIRECTION_MASK_NORTH:mxEdgeStyle.wayPoints1[0][0]+=n[0][0]*a[0][2],mxEdgeStyle.wayPoints1[0][1]-=s}for(r=t=(s=0)<(e[0]&(mxConstants.DIRECTION_MASK_EAST|mxConstants.DIRECTION_MASK_WEST))?0:1,d=l=0;d<v.length;d++){g=(l=15&v[d])==mxConstants.DIRECTION_MASK_EAST?3:l,4<(g+=o)&&(g-=4),c=mxEdgeStyle.dirVectors[g-1],(l=0<g%2?0:1)!=t&&(s++,mxEdgeStyle.wayPoints1[s][0]=mxEdgeStyle.wayPoints1[s-1][0],mxEdgeStyle.wayPoints1[s][1]=mxEdgeStyle.wayPoints1[s-1][1]);var h=0<(v[d]&mxEdgeStyle.TARGET_MASK);p=0<(v[d]&mxEdgeStyle.SOURCE_MASK);15<(m=(m=(v[d]&mxEdgeStyle.SIDE_MASK)>>5)<<o)&&(m>>=4),u=0<(v[d]&mxEdgeStyle.CENTER_MASK),(p||h)&&m<9?(g=0,p=p?0:1,g=u&&0==l?a[p][0]+n[p][0]*a[p][2]:u?a[p][1]+n[p][1]*a[p][3]:mxEdgeStyle.limits[p][m],0==l?0<(m=(g-mxEdgeStyle.wayPoints1[s][0])*c[0])&&(mxEdgeStyle.wayPoints1[s][0]+=c[0]*m):0<(m=(g-mxEdgeStyle.wayPoints1[s][1])*c[1])&&(mxEdgeStyle.wayPoints1[s][1]+=c[1]*m)):u&&(mxEdgeStyle.wayPoints1[s][0]+=c[0]*Math.abs(mxEdgeStyle.vertexSeperations[g]/2),mxEdgeStyle.wayPoints1[s][1]+=c[1]*Math.abs(mxEdgeStyle.vertexSeperations[g]/2)),0<s&&mxEdgeStyle.wayPoints1[s][l]==mxEdgeStyle.wayPoints1[s-1][l]?s--:t=l}for(d=0;d<=s&&(d!=s||((0<(e[1]&(mxConstants.DIRECTION_MASK_EAST|mxConstants.DIRECTION_MASK_WEST))?0:1)==r?0:1)==(s+1)%2);d++)i.push(new mxPoint(mxEdgeStyle.wayPoints1[d][0],mxEdgeStyle.wayPoints1[d][1]))}},getRoutePattern:function(e,n,t,a){var i=e[0]==mxConstants.DIRECTION_MASK_EAST?3:e[0];return e=e[1]==mxConstants.DIRECTION_MASK_EAST?3:e[1],(i-=n)<1&&(i+=4),(e-=n)<1&&(e+=4),n=routePatterns[i-1][e-1],0!=t&&0!=a||null!=inlineRoutePatterns[i-1][e-1]&&(n=inlineRoutePatterns[i-1][e-1]),n}},mxStyleRegistry={values:[],putValue:function(e,n){mxStyleRegistry.values[e]=n},getValue:function(e){return mxStyleRegistry.values[e]},getName:function(e){for(var n in mxStyleRegistry.values)if(mxStyleRegistry.values[n]==e)return n;return null}};function mxGraphView(e){this.graph=e,this.translate=new mxPoint,this.graphBounds=new mxRectangle,this.states=new mxDictionary}function mxCurrentRootChange(e,n){if(this.view=e,this.previous=this.root=n,this.isUp=null==n,!this.isUp)for(var t=this.view.currentRoot,a=this.view.graph.getModel();null!=t;){if(t==n){this.isUp=!0;break}t=a.getParent(t)}}function mxGraph(e,n,t,a){this.mouseListeners=null,this.renderHint=t,this.dialect=mxClient.IS_SVG?mxConstants.DIALECT_SVG:t==mxConstants.RENDERING_HINT_EXACT&&mxClient.IS_VML?mxConstants.DIALECT_VML:t==mxConstants.RENDERING_HINT_FASTEST?mxConstants.DIALECT_STRICTHTML:t==mxConstants.RENDERING_HINT_FASTER?mxConstants.DIALECT_PREFERHTML:mxConstants.DIALECT_MIXEDHTML,this.model=null!=n?n:new mxGraphModel,this.multiplicities=[],this.imageBundles=[],this.cellRenderer=this.createCellRenderer(),this.setSelectionModel(this.createSelectionModel()),this.setStylesheet(null!=a?a:this.createStylesheet()),this.view=this.createGraphView(),this.graphModelChangeListener=mxUtils.bind(this,function(e,n){this.graphModelChanged(n.getProperty("edit").changes)}),this.model.addListener(mxEvent.CHANGE,this.graphModelChangeListener),this.createHandlers(),null!=e&&this.init(e),this.view.revalidate()}function mxCellOverlay(e,n,t,a,i,s){this.image=e,this.tooltip=n,this.align=null!=t?t:this.align,this.verticalAlign=null!=a?a:this.verticalAlign,this.offset=null!=i?i:new mxPoint,this.cursor=null!=s?s:"help"}function mxOutline(e,n){this.source=e,null!=n&&this.init(n)}function mxMultiplicity(e,n,t,a,i,s,o,r,l,d){this.source=e,this.type=n,this.attr=t,this.value=a,this.min=null!=i?i:0,this.max=null!=s?s:"n",this.validNeighbors=o,this.countError=mxResources.get(r)||r,this.typeError=mxResources.get(l)||l,this.validNeighborsAllowed=null==d||d}function mxLayoutManager(e){this.undoHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.beforeUndo(n.getProperty("edit"))}),this.moveHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.cellsMoved(n.getProperty("cells"),n.getProperty("event"))}),this.setGraph(e)}function mxSpaceManager(e,n,t,a){this.resizeHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.cellsResized(n.getProperty("cells"))}),this.foldHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.cellsResized(n.getProperty("cells"))}),this.shiftRightwards=null==n||n,this.shiftDownwards=null==t||t,this.extendParents=null==a||a,this.setGraph(e)}function mxSwimlaneManager(e,n,t,a){this.horizontal=null==n||n,this.addEnabled=null==t||t,this.resizeEnabled=null==a||a,this.addHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.isAddEnabled()&&this.cellsAdded(n.getProperty("cells"))}),this.resizeHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.isResizeEnabled()&&this.cellsResized(n.getProperty("cells"))}),this.setGraph(e)}function mxTemporaryCellStates(e,n,t){if(this.view=e,n=null!=n?n:1,this.oldBounds=e.getGraphBounds(),this.oldStates=e.getStates(),this.oldScale=e.getScale(),e.setStates(new mxDictionary),e.setScale(n),null!=t){n=e.createState(new mxCell);for(var a=0;a<t.length;a++)e.validateBounds(n,t[a]);var i=null;for(a=0;a<t.length;a++){var s=e.validatePoints(n,t[a]);null==i?i=s:i.add(s)}null==i&&(i=new mxRectangle),e.setGraphBounds(i)}}function mxCellStatePreview(e){this.graph=e,this.deltas={}}function mxConnectionConstraint(e,n){this.point=e,this.perimeter=null==n||n}function mxGraphHandler(e){this.graph=e,this.graph.addMouseListener(this),this.panHandler=mxUtils.bind(this,function(){this.updatePreviewShape()}),this.graph.addListener(mxEvent.PAN,this.panHandler)}function mxPanningHandler(e,n){null!=e&&(this.graph=e,this.factoryMethod=n,this.graph.addMouseListener(this),this.init())}function mxCellMarker(e,n,t,a){mxEventSource.call(this),null!=e&&(this.graph=e,this.validColor=null!=n?n:mxConstants.DEFAULT_VALID_COLOR,this.invalidColor=null!=n?t:mxConstants.DEFAULT_INVALID_COLOR,this.hotspot=null!=a?a:mxConstants.DEFAULT_HOTSPOT,this.highlight=new mxCellHighlight(e))}function mxSelectionCellsHandler(e){mxEventSource.call(this),this.graph=e,this.handlers=new mxDictionary,this.graph.addMouseListener(this),this.refreshHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.refresh()}),this.graph.getSelectionModel().addListener(mxEvent.CHANGE,this.refreshHandler),this.graph.getModel().addListener(mxEvent.CHANGE,this.refreshHandler),this.graph.getView().addListener(mxEvent.SCALE,this.refreshHandler),this.graph.getView().addListener(mxEvent.TRANSLATE,this.refreshHandler),this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE,this.refreshHandler),this.graph.getView().addListener(mxEvent.DOWN,this.refreshHandler),this.graph.getView().addListener(mxEvent.UP,this.refreshHandler)}function mxConnectionHandler(e,n){mxEventSource.call(this),null!=e&&(this.graph=e,this.factoryMethod=n,this.init())}function mxConstraintHandler(e){this.graph=e}function mxRubberband(e){null!=e&&(this.graph=e,this.graph.addMouseListener(this),this.panHandler=mxUtils.bind(this,function(){this.repaint()}),this.graph.addListener(mxEvent.PAN,this.panHandler),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})))}function mxVertexHandler(e){null!=e&&(this.state=e,this.init())}function mxEdgeHandler(e){null!=e&&(this.state=e,this.init())}function mxElbowEdgeHandler(e){mxEdgeHandler.call(this,e)}function mxEdgeSegmentHandler(e){mxEdgeHandler.call(this,e)}function mxKeyHandler(e,n){null!=e&&(this.graph=e,this.target=n||document.documentElement,this.normalKeys=[],this.shiftKeys=[],this.controlKeys=[],this.controlShiftKeys=[],mxEvent.addListener(this.target,"keydown",mxUtils.bind(this,function(e){this.keyDown(e)})),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})))}function mxTooltipHandler(e,n){null!=e&&(this.graph=e,this.delay=n||500,this.graph.addMouseListener(this))}function mxCellTracker(e,n,t){mxCellMarker.call(this,e,n),this.graph.addMouseListener(this),null!=t&&(this.getCell=t),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()}))}function mxCellHighlight(e,n,t,a){null!=e&&(this.graph=e,this.highlightColor=null!=n?n:mxConstants.DEFAULT_VALID_COLOR,this.strokeWidth=null!=t?t:mxConstants.HIGHLIGHT_STROKEWIDTH,this.dashed=null!=a&&a,this.repaintHandler=mxUtils.bind(this,function(){this.repaint()}),this.graph.getView().addListener(mxEvent.SCALE,this.repaintHandler),this.graph.getView().addListener(mxEvent.TRANSLATE,this.repaintHandler),this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE,this.repaintHandler),this.graph.getModel().addListener(mxEvent.CHANGE,this.repaintHandler),this.resetHandler=mxUtils.bind(this,function(){this.hide()}),this.graph.getView().addListener(mxEvent.DOWN,this.resetHandler),this.graph.getView().addListener(mxEvent.UP,this.resetHandler))}function mxDefaultKeyHandler(n){if(null!=n){this.editor=n,this.handler=new mxKeyHandler(n.graph);var t=this.handler.escape;this.handler.escape=function(e){t.apply(this,arguments),n.hideProperties(),n.fireEvent(new mxEventObject(mxEvent.ESCAPE,"event",e))}}}function mxDefaultPopupMenu(e){this.config=e}function mxDefaultToolbar(e,n){this.editor=n,null!=e&&null!=n&&this.init(e)}function mxEditor(e){this.actions=[],this.addActions(),null!=document.body&&(this.cycleAttributeValues=[],this.popupHandler=new mxDefaultPopupMenu,this.undoManager=new mxUndoManager,this.graph=this.createGraph(),this.toolbar=this.createToolbar(),this.keyHandler=new mxDefaultKeyHandler(this),this.configure(e),this.graph.swimlaneIndicatorColorAttribute=this.cycleAttributeName,!mxClient.IS_LOCAL&&null!=this.urlInit&&(this.session=this.createSession()),null!=this.onInit&&this.onInit(),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})))}mxStyleRegistry.putValue(mxConstants.EDGESTYLE_ELBOW,mxEdgeStyle.ElbowConnector),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_ENTITY_RELATION,mxEdgeStyle.EntityRelation),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_LOOP,mxEdgeStyle.Loop),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_SIDETOSIDE,mxEdgeStyle.SideToSide),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_TOPTOBOTTOM,mxEdgeStyle.TopToBottom),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_ORTHOGONAL,mxEdgeStyle.OrthConnector),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_SEGMENT,mxEdgeStyle.SegmentConnector),mxStyleRegistry.putValue(mxConstants.PERIMETER_ELLIPSE,mxPerimeter.EllipsePerimeter),mxStyleRegistry.putValue(mxConstants.PERIMETER_RECTANGLE,mxPerimeter.RectanglePerimeter),mxStyleRegistry.putValue(mxConstants.PERIMETER_RHOMBUS,mxPerimeter.RhombusPerimeter),mxStyleRegistry.putValue(mxConstants.PERIMETER_TRIANGLE,mxPerimeter.TrianglePerimeter),mxGraphView.prototype=new mxEventSource,mxGraphView.prototype.constructor=mxGraphView,mxGraphView.prototype.EMPTY_POINT=new mxPoint,mxGraphView.prototype.doneResource="none"!=mxClient.language?"done":"",mxGraphView.prototype.updatingDocumentResource="none"!=mxClient.language?"updatingDocument":"",mxGraphView.prototype.allowEval=!1,mxGraphView.prototype.captureDocumentGesture=!0,mxGraphView.prototype.optimizeVmlReflows=!0,mxGraphView.prototype.rendering=!0,mxGraphView.prototype.graph=null,mxGraphView.prototype.currentRoot=null,mxGraphView.prototype.graphBounds=null,mxGraphView.prototype.scale=1,mxGraphView.prototype.translate=null,mxGraphView.prototype.updateStyle=!1,mxGraphView.prototype.getGraphBounds=function(){return this.graphBounds},mxGraphView.prototype.setGraphBounds=function(e){this.graphBounds=e},mxGraphView.prototype.getBounds=function(e){var n=null;if(null!=e&&0<e.length)for(var t=this.graph.getModel(),a=0;a<e.length;a++)if(t.isVertex(e[a])||t.isEdge(e[a])){var i=this.getState(e[a]);null!=i&&(null==n?n=new mxRectangle(i.x,i.y,i.width,i.height):n.add(i))}return n},mxGraphView.prototype.setCurrentRoot=function(e){if(this.currentRoot!=e){var n=new mxCurrentRootChange(this,e);n.execute();var t=new mxUndoableEdit(this,!1);t.add(n),this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",t)),this.graph.sizeDidChange()}return e},mxGraphView.prototype.scaleAndTranslate=function(e,n,t){var a=this.scale,i=new mxPoint(this.translate.x,this.translate.y);this.scale==e&&this.translate.x==n&&this.translate.y==t||(this.scale=e,this.translate.x=n,this.translate.y=t,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.SCALE_AND_TRANSLATE,"scale",e,"previousScale",a,"translate",this.translate,"previousTranslate",i))},mxGraphView.prototype.getScale=function(){return this.scale},mxGraphView.prototype.setScale=function(e){var n=this.scale;this.scale!=e&&(this.scale=e,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.SCALE,"scale",e,"previousScale",n))},mxGraphView.prototype.getTranslate=function(){return this.translate},mxGraphView.prototype.setTranslate=function(e,n){var t=new mxPoint(this.translate.x,this.translate.y);this.translate.x==e&&this.translate.y==n||(this.translate.x=e,this.translate.y=n,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.TRANSLATE,"translate",this.translate,"previousTranslate",t))},mxGraphView.prototype.refresh=function(){null!=this.currentRoot&&this.clear(),this.revalidate()},mxGraphView.prototype.revalidate=function(){this.invalidate(),this.validate()},mxGraphView.prototype.clear=function(e,n,t){var a=this.graph.getModel();if(e=e||a.getRoot(),n=null!=n&&n,t=null==t||t,this.removeState(e),t&&(n||e!=this.currentRoot)){t=a.getChildCount(e);for(var i=0;i<t;i++)this.clear(a.getChildAt(e,i),n)}else this.invalidate(e)},mxGraphView.prototype.invalidate=function(e,n,t,a){var i=this.graph.getModel();if(e=e||i.getRoot(),n=null==n||n,t=null==t||t,a=null!=a&&a,null!=(o=this.getState(e))&&(o.invalid=!0,a&&(o.orderChanged=!0)),n)for(var s=i.getChildCount(e),o=0;o<s;o++){var r=i.getChildAt(e,o);this.invalidate(r,n,t,a)}if(t)for(a=i.getEdgeCount(e),o=0;o<a;o++)this.invalidate(i.getEdgeAt(e,o),n,t)},mxGraphView.prototype.validate=function(e){var n=mxLog.enter("mxGraphView.validate");window.status=mxResources.get(this.updatingDocumentResource)||this.updatingDocumentResource;var t=null;if(this.optimizeVmlReflows&&null!=this.canvas&&null==this.textDiv&&(8==document.documentMode||mxClient.IS_QUIRKS)){t=this.canvas.style.display,this.canvas.style.display="none";var a=document.createElement("div");a.style.position="absolute",a.style.whiteSpace="nowrap",a.style.visibility="hidden",a.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",a.style.zoom="1",document.body.appendChild(a),this.textDiv=a}e=e||(null!=this.currentRoot?this.currentRoot:this.graph.getModel().getRoot()),this.validateBounds(null,e),null==(e=this.validatePoints(null,e))&&(e=new mxRectangle),this.setGraphBounds(e),this.validateBackground(),null!=t&&(this.canvas.style.display=t,document.body.removeChild(this.textDiv),this.textDiv=null),window.status=mxResources.get(this.doneResource)||this.doneResource,mxLog.leave("mxGraphView.validate",n)},mxGraphView.prototype.createBackgroundPageShape=function(e){return new mxRectangleShape(e,"white","black")},mxGraphView.prototype.validateBackground=function(){var e=this.graph.getBackgroundImage();if(null!=e){if(null==this.backgroundImage||this.backgroundImage.image!=e.src){null!=this.backgroundImage&&this.backgroundImage.destroy();var n=new mxRectangle(0,0,1,1);this.backgroundImage=new mxImageShape(n,e.src),this.backgroundImage.dialect=this.graph.dialect,this.backgroundImage.init(this.backgroundPane),this.backgroundImage.redraw()}this.redrawBackgroundImage(this.backgroundImage,e)}else null!=this.backgroundImage&&(this.backgroundImage.destroy(),this.backgroundImage=null);this.graph.pageVisible?(n=this.getBackgroundPageBounds(),null==this.backgroundPageShape?(this.backgroundPageShape=this.createBackgroundPageShape(n),this.backgroundPageShape.scale=this.scale,this.backgroundPageShape.isShadow=!0,this.backgroundPageShape.dialect=this.graph.dialect,this.backgroundPageShape.init(this.backgroundPane),this.backgroundPageShape.redraw(),mxEvent.addListener(this.backgroundPageShape.node,"dblclick",mxUtils.bind(this,function(e){this.graph.dblClick(e)})),mxEvent.addGestureListeners(this.backgroundPageShape.node,mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){null!=this.graph.tooltipHandler&&this.graph.tooltipHandler.isHideOnHover()&&this.graph.tooltipHandler.hide(),this.graph.isMouseDown&&!mxEvent.isConsumed(e)&&this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))}))):(this.backgroundPageShape.scale=this.scale,this.backgroundPageShape.bounds=n,this.backgroundPageShape.redraw())):null!=this.backgroundPageShape&&(this.backgroundPageShape.destroy(),this.backgroundPageShape=null)},mxGraphView.prototype.getBackgroundPageBounds=function(){var e=this.graph.pageFormat,n=this.scale*this.graph.pageScale;return new mxRectangle(this.scale*this.translate.x,this.scale*this.translate.y,e.width*n,e.height*n)},mxGraphView.prototype.redrawBackgroundImage=function(e,n){e.scale=this.scale,e.bounds.x=this.scale*this.translate.x,e.bounds.y=this.scale*this.translate.y,e.bounds.width=this.scale*n.width,e.bounds.height=this.scale*n.height,e.redraw()},mxGraphView.prototype.validateBounds=function(e,n){var t=this.graph.getModel(),a=this.getState(n,!0);if(null!=a&&a.invalid){if(this.graph.isCellVisible(n)){if(n!=this.currentRoot&&null!=e)if(a.absoluteOffset.x=0,a.absoluteOffset.y=0,a.origin.x=e.origin.x,a.origin.y=e.origin.y,null!=(s=this.graph.getCellGeometry(n))){if(!t.isEdge(n)){var i=s.offset||this.EMPTY_POINT;s.relative?(a.origin.x+=s.x*e.width/this.scale+i.x,a.origin.y+=s.y*e.height/this.scale+i.y):(a.absoluteOffset.x=this.scale*i.x,a.absoluteOffset.y=this.scale*i.y,a.origin.x+=s.x,a.origin.y+=s.y)}if(a.x=this.scale*(this.translate.x+a.origin.x),a.y=this.scale*(this.translate.y+a.origin.y),a.width=this.scale*s.width,a.height=this.scale*s.height,t.isVertex(n)){if(s.relative&&0!=(i=mxUtils.toRadians(e.style[mxConstants.STYLE_ROTATION]||"0"))){var s=Math.cos(i),o=(i=Math.sin(i),new mxPoint(a.getCenterX(),a.getCenterY())),r=new mxPoint(e.getCenterX(),e.getCenterY());s=mxUtils.getRotatedPoint(o,s,i,r);a.x=s.x-a.width/2,a.y=s.y-a.height/2}this.updateVertexLabelOffset(a)}}}else this.removeState(n);null!=(i=this.graph.getChildOffsetForCell(n))&&(a.origin.x+=i.x,a.origin.y+=i.y)}if(null!=a&&(!this.graph.isCellCollapsed(n)||n==this.currentRoot))for(s=t.getChildCount(n),i=0;i<s;i++)o=t.getChildAt(n,i),this.validateBounds(a,o)},mxGraphView.prototype.updateVertexLabelOffset=function(e){var n=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER);n==mxConstants.ALIGN_LEFT?e.absoluteOffset.x-=e.width:n==mxConstants.ALIGN_RIGHT&&(e.absoluteOffset.x+=e.width),(n=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?e.absoluteOffset.y-=e.height:n==mxConstants.ALIGN_BOTTOM&&(e.absoluteOffset.y+=e.height)},mxGraphView.prototype.validatePoints=function(e,n){var t=this.graph.getModel(),a=this.getState(n),i=null;if(null!=a){if(a.invalid){var s=this.graph.getCellGeometry(n);if(null!=s&&t.isEdge(n)){var o=this.getState(this.getVisibleTerminal(n,!0));if(a.setVisibleTerminalState(o,!0),null!=o&&t.isEdge(o.cell)&&!t.isAncestor(o.cell,n)){var r=this.getState(t.getParent(o.cell));this.validatePoints(r,o.cell)}var l=this.getState(this.getVisibleTerminal(n,!1));a.setVisibleTerminalState(l,!1),null!=l&&t.isEdge(l.cell)&&!t.isAncestor(l.cell,n)&&(r=this.getState(t.getParent(l.cell)),this.validatePoints(r,l.cell)),this.updateFixedTerminalPoints(a,o,l),this.updatePoints(a,s.points,o,l),this.updateFloatingTerminalPoints(a,o,l),this.updateEdgeBounds(a),this.updateEdgeLabelOffset(a)}else null!=s&&s.relative&&null!=e&&t.isEdge(e.cell)&&(null!=(s=this.getPoint(e,s))&&(a.x=s.x,a.y=s.y,s.x=s.x/this.scale-this.translate.x,s.y=s.y/this.scale-this.translate.y,a.origin=s,this.childMoved(e,a)));a.invalid=!1,n!=this.currentRoot&&this.graph.cellRenderer.redraw(a,!1,this.isRendering())}(t.isEdge(n)||t.isVertex(n))&&(null!=a.shape&&null!=a.shape.boundingBox&&(i=a.shape.boundingBox.clone()),null!=a.text&&!this.graph.isLabelClipped(a.cell)&&null!=a.text.boundingBox&&(null!=i?i.add(a.text.boundingBox):i=a.text.boundingBox.clone()))}if(null!=a&&(!this.graph.isCellCollapsed(n)||n==this.currentRoot))for(s=t.getChildCount(n),o=0;o<s;o++)r=t.getChildAt(n,o),null!=(r=this.validatePoints(a,r))&&(null==i?i=r:i.add(r));return i},mxGraphView.prototype.childMoved=function(e,n){var t=n.cell;if(!this.graph.isCellCollapsed(t)||t==this.currentRoot)for(var a=this.graph.getModel(),i=a.getChildCount(t),s=0;s<i;s++)this.validateBounds(n,a.getChildAt(t,s))},mxGraphView.prototype.updateFixedTerminalPoints=function(e,n,t){this.updateFixedTerminalPoint(e,n,!0,this.graph.getConnectionConstraint(e,n,!0)),this.updateFixedTerminalPoint(e,t,!1,this.graph.getConnectionConstraint(e,t,!1))},mxGraphView.prototype.updateFixedTerminalPoint=function(e,n,t,a){var i=null;if(null!=a&&(i=this.graph.getConnectionPoint(n,a)),null==i&&null==n){n=this.scale,a=this.translate;var s=e.origin;null!=(i=this.graph.getCellGeometry(e.cell).getTerminalPoint(t))&&(i=new mxPoint(n*(a.x+i.x+s.x),n*(a.y+i.y+s.y)))}e.setAbsoluteTerminalPoint(i,t)},mxGraphView.prototype.updatePoints=function(e,n,t,a){if(null!=e){var i=[];i.push(e.absolutePoints[0]);var s=this.getEdgeStyle(e,n,t,a);if(null!=s)s(e,t=this.getTerminalPort(e,t,!0),a=this.getTerminalPort(e,a,!1),n,i);else if(null!=n)for(s=0;s<n.length;s++)null!=n[s]&&(a=mxUtils.clone(n[s]),i.push(this.transformControlPoint(e,a)));n=e.absolutePoints,i.push(n[n.length-1]),e.absolutePoints=i}},mxGraphView.prototype.transformControlPoint=function(e,n){var t=e.origin;return new mxPoint(this.scale*(n.x+this.translate.x+t.x),this.scale*(n.y+this.translate.y+t.y))},mxGraphView.prototype.getEdgeStyle=function(e,n,t,a){return"string"==typeof(e=null!=t&&t==a?mxUtils.getValue(e.style,mxConstants.STYLE_LOOP,this.graph.defaultLoopStyle):mxUtils.getValue(e.style,mxConstants.STYLE_NOEDGESTYLE,!1)?null:e.style[mxConstants.STYLE_EDGE])&&(null==(n=mxStyleRegistry.getValue(e))&&this.isAllowEval()&&(n=mxUtils.eval(e)),e=n),"function"==typeof e?e:null},mxGraphView.prototype.updateFloatingTerminalPoints=function(e,n,t){var a=e.absolutePoints,i=a[0];null==a[a.length-1]&&null!=t&&this.updateFloatingTerminalPoint(e,t,n,!1),null==i&&null!=n&&this.updateFloatingTerminalPoint(e,n,t,!0)},mxGraphView.prototype.updateFloatingTerminalPoint=function(e,n,t,a){n=this.getTerminalPort(e,n,a);var i=this.getNextPoint(e,t,a),s=this.graph.isOrthogonal(e);t=mxUtils.toRadians(Number(n.style[mxConstants.STYLE_ROTATION]||"0"));var o=new mxPoint(n.getCenterX(),n.getCenterY());if(0!=t){var r=Math.cos(-t),l=Math.sin(-t);i=mxUtils.getRotatedPoint(i,r,l,o)}r=parseFloat(e.style[mxConstants.STYLE_PERIMETER_SPACING]||0),r+=parseFloat(e.style[a?mxConstants.STYLE_SOURCE_PERIMETER_SPACING:mxConstants.STYLE_TARGET_PERIMETER_SPACING]||0),n=this.getPerimeterPoint(n,i,0==t&&s,r),0!=t&&(r=Math.cos(t),l=Math.sin(t),n=mxUtils.getRotatedPoint(n,r,l,o)),e.setAbsoluteTerminalPoint(n,a)},mxGraphView.prototype.getTerminalPort=function(e,n,t){return null!=(e=mxUtils.getValue(e.style,t?mxConstants.STYLE_SOURCE_PORT:mxConstants.STYLE_TARGET_PORT))&&(null!=(e=this.getState(this.graph.getModel().getCell(e)))&&(n=e)),n},mxGraphView.prototype.getPerimeterPoint=function(e,n,t,a){var i=null;if(null!=e){var s=this.getPerimeterFunction(e);null!=s&&null!=n&&(0<(a=this.getPerimeterBounds(e,a)).width||0<a.height)&&(i=s(a,e,n,t)),null==i&&(i=this.getPoint(e))}return i},mxGraphView.prototype.getRoutingCenterX=function(e){var n=null!=e.style&&parseFloat(e.style[mxConstants.STYLE_ROUTING_CENTER_X])||0;return e.getCenterX()+n*e.width},mxGraphView.prototype.getRoutingCenterY=function(e){var n=null!=e.style&&parseFloat(e.style[mxConstants.STYLE_ROUTING_CENTER_Y])||0;return e.getCenterY()+n*e.height},mxGraphView.prototype.getPerimeterBounds=function(e,n){return n=null!=n?n:0,null!=e&&(n+=parseFloat(e.style[mxConstants.STYLE_PERIMETER_SPACING]||0)),e.getPerimeterBounds(n*this.scale)},mxGraphView.prototype.getPerimeterFunction=function(e){if("string"==typeof(e=e.style[mxConstants.STYLE_PERIMETER])){var n=mxStyleRegistry.getValue(e);null==n&&this.isAllowEval()&&(n=mxUtils.eval(e)),e=n}return"function"==typeof e?e:null},mxGraphView.prototype.getNextPoint=function(e,n,t){var a=null;return null!=(e=e.absolutePoints)&&(t||2<e.length||null==n)&&(a=e.length,a=e[t?Math.min(1,a-1):Math.max(0,a-2)]),null==a&&null!=n&&(a=new mxPoint(n.getCenterX(),n.getCenterY())),a},mxGraphView.prototype.getVisibleTerminal=function(e,n){for(var t=this.graph.getModel(),a=t.getTerminal(e,n),i=a;null!=a&&a!=this.currentRoot;)this.graph.isCellVisible(i)&&!this.graph.isCellCollapsed(a)||(i=a),a=t.getParent(a);return t.getParent(i)==t.getRoot()&&(i=null),i},mxGraphView.prototype.updateEdgeBounds=function(e){var n=e.absolutePoints;if(e.length=0,null!=n&&0<n.length){var t=n[0],a=n[n.length-1];if(null==t||null==a)e.cell!=this.currentRoot&&this.clear(e.cell,!0);else{if(t.x!=a.x||t.y!=a.y){var i=a.x-t.x,s=a.y-t.y;e.terminalDistance=Math.sqrt(i*i+s*s)}else e.terminalDistance=0;a=0;var o=[];if(null!=(s=t)){t=s.x;for(var r=s.y,l=t,d=r,c=1;c<n.length;c++){var m=n[c];null!=m&&(i=s.x-m.x,s=s.y-m.y,i=Math.sqrt(i*i+s*s),o.push(i),a+=i,s=m,t=Math.min(s.x,t),r=Math.min(s.y,r),l=Math.max(s.x,l),d=Math.max(s.y,d))}e.length=a,e.segments=o,e.x=t,e.y=r,e.width=Math.max(1,l-t),e.height=Math.max(1,d-r)}}}},mxGraphView.prototype.getPoint=function(e,n){var t=e.getCenterX(),a=e.getCenterY();if(null==e.segments||null!=n&&!n.relative)null!=n&&(null!=(d=n.offset)&&(t+=d.x,a+=d.y));else{for(var i=e.absolutePoints.length,s=(.5+(null!=n?n.x/2:0))*e.length,o=e.segments[0],r=0,l=1;r+o<s&&l<i-1;)r+=o,o=e.segments[l++];if(i=0==o?0:(s-r)/o,s=e.absolutePoints[l-1],l=e.absolutePoints[l],null!=s&&null!=l){if(r=t=a=0,null!=n){a=n.y;var d=n.offset;null!=d&&(t=d.x,r=d.y)}d=l.x-s.x,l=l.y-s.y,t=s.x+d*i+((0==o?0:l/o)*a+t)*this.scale,a=s.y+l*i-((0==o?0:d/o)*a-r)*this.scale}}return new mxPoint(t,a)},mxGraphView.prototype.getRelativePoint=function(e,n,t){if(null!=(i=this.graph.getModel().getGeometry(e.cell))){var a=e.absolutePoints.length;if(i.relative&&1<a){for(var i=e.length,s=e.segments,o=e.absolutePoints[0],r=e.absolutePoints[1],l=mxUtils.ptSegDistSq(o.x,o.y,r.x,r.y,n,t),d=0,c=0,m=0,u=2;u<a;u++)c+=s[u-2],r=e.absolutePoints[u],(o=mxUtils.ptSegDistSq(o.x,o.y,r.x,r.y,n,t))<=l&&(l=o,d=u-1,m=c),o=r;return a=s[d],o=e.absolutePoints[d],l=(r=e.absolutePoints[d+1]).x,s=r.y,s=(l=(e=o.x-l)-(l=n-l))*e+(s=(d=o.y-s)-(s=t-s))*d,a<(e=Math.sqrt(s<=0?0:s*s/(e*e+d*d)))&&(e=a),a=Math.sqrt(mxUtils.ptSegDistSq(o.x,o.y,r.x,r.y,n,t)),-1==mxUtils.relativeCcw(o.x,o.y,r.x,r.y,n,t)&&(a=-a),new mxPoint((i/2-m-e)/i*-2,a/this.scale)}}return new mxPoint},mxGraphView.prototype.updateEdgeLabelOffset=function(e){var n=e.absolutePoints;if(e.absoluteOffset.x=e.getCenterX(),e.absoluteOffset.y=e.getCenterY(),null!=n&&0<n.length&&null!=e.segments)if((i=this.graph.getCellGeometry(e.cell)).relative){null!=(t=this.getPoint(e,i))&&(e.absoluteOffset=t)}else{var t=n[0],a=n[n.length-1];if(null!=t&&null!=a){n=a.x-t.x;var i,s=a.y-t.y,o=a=0;null!=(i=i.offset)&&(a=i.x,o=i.y),i=t.y+s/2+o*this.scale,e.absoluteOffset.x=t.x+n/2+a*this.scale,e.absoluteOffset.y=i}}},mxGraphView.prototype.getState=function(e,n){n=n||!1;var t=null;return null!=e&&(t=this.states.get(e),this.graph.isCellVisible(e)&&(null==t&&n&&this.graph.isCellVisible(e)?(t=this.createState(e),this.states.put(e,t)):n&&null!=t&&this.updateStyle&&(t.style=this.graph.getCellStyle(e)))),t},mxGraphView.prototype.isRendering=function(){return this.rendering},mxGraphView.prototype.setRendering=function(e){this.rendering=e},mxGraphView.prototype.isAllowEval=function(){return this.allowEval},mxGraphView.prototype.setAllowEval=function(e){this.allowEval=e},mxGraphView.prototype.getStates=function(){return this.states},mxGraphView.prototype.setStates=function(e){this.states=e},mxGraphView.prototype.getCellStates=function(e){if(null==e)return this.states;for(var n=[],t=0;t<e.length;t++){var a=this.getState(e[t]);null!=a&&n.push(a)}return n},mxGraphView.prototype.removeState=function(e){var n=null;return null!=e&&(null!=(n=this.states.remove(e))&&(this.graph.cellRenderer.destroy(n),n.destroy())),n},mxGraphView.prototype.createState=function(e){var n=this.graph.getCellStyle(e);return e=new mxCellState(this,e,n),this.graph.cellRenderer.initialize(e,this.isRendering()),e},mxGraphView.prototype.getCanvas=function(){return this.canvas},mxGraphView.prototype.getBackgroundPane=function(){return this.backgroundPane},mxGraphView.prototype.getDrawPane=function(){return this.drawPane},mxGraphView.prototype.getOverlayPane=function(){return this.overlayPane},mxGraphView.prototype.isContainerEvent=function(e){return(e=mxEvent.getSource(e))==this.graph.container||e.parentNode==this.backgroundPane||null!=e.parentNode&&e.parentNode.parentNode==this.backgroundPane||e==this.canvas.parentNode||e==this.canvas||e==this.backgroundPane||e==this.drawPane||e==this.overlayPane},mxGraphView.prototype.isScrollEvent=function(e){var n=mxUtils.getOffset(this.graph.container);e=new mxPoint(e.clientX-n.x,e.clientY-n.y);n=this.graph.container.offsetWidth;var t=this.graph.container.clientWidth;return t<n&&e.x>t+2&&e.x<=n||(n=this.graph.container.offsetHeight,(t=this.graph.container.clientHeight)<n&&e.y>t+2&&e.y<=n)},mxGraphView.prototype.init=function(){this.installListeners();var e=this.graph;e.dialect==mxConstants.DIALECT_SVG?this.createSvg():e.dialect==mxConstants.DIALECT_VML?this.createVml():this.createHtml()},mxGraphView.prototype.installListeners=function(){var a=this.graph,i=a.container;if(null!=i){mxEvent.addGestureListeners(i,mxUtils.bind(this,function(e){mxClient.IS_TOUCH&&a.isEditing()&&a.stopEditing(!a.isInvokesStopCellEditing()),this.isContainerEvent(e)&&(!mxClient.IS_IE&&!mxClient.IS_GC&&!mxClient.IS_OP&&!mxClient.IS_SF||!this.isScrollEvent(e))&&a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.isContainerEvent(e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.isContainerEvent(e)&&a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))})),mxEvent.addListener(i,"dblclick",mxUtils.bind(this,function(e){a.dblClick(e)}));a.addMouseListener({mouseDown:function(e,n){a.panningHandler.hideMenu()},mouseMove:function(){},mouseUp:function(){}}),this.moveHandler=mxUtils.bind(this,function(e){var n,t;null!=a.tooltipHandler&&a.tooltipHandler.isHideOnHover()&&a.tooltipHandler.hide(),this.captureDocumentGesture&&a.isMouseDown&&!mxEvent.isConsumed(e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,(n=e,t=null,mxClient.IS_TOUCH&&(t=mxEvent.getClientX(n),n=mxEvent.getClientY(n),n=mxUtils.convertPoint(i,t,n),t=a.view.getState(a.getCellAt(n.x,n.y))),t)))}),this.endHandler=mxUtils.bind(this,function(e){this.captureDocumentGesture&&a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))}),mxEvent.addGestureListeners(document,null,this.moveHandler,this.endHandler)}},mxGraphView.prototype.createHtml=function(){var e=this.graph.container;null!=e&&(this.canvas=this.createHtmlPane("100%","100%"),this.backgroundPane=this.createHtmlPane("1px","1px"),this.drawPane=this.createHtmlPane("1px","1px"),this.overlayPane=this.createHtmlPane("1px","1px"),this.canvas.appendChild(this.backgroundPane),this.canvas.appendChild(this.drawPane),this.canvas.appendChild(this.overlayPane),e.appendChild(this.canvas),mxClient.IS_QUIRKS&&(e=mxUtils.bind(this,function(e){e=this.getGraphBounds(),this.updateHtmlCanvasSize(e.x+e.width+this.graph.border,e.y+e.height+this.graph.border)}),mxEvent.addListener(window,"resize",e)))},mxGraphView.prototype.updateHtmlCanvasSize=function(e,n){if(null!=this.graph.container){var t=this.graph.container.offsetHeight;this.canvas.style.width=this.graph.container.offsetWidth<e?e+"px":"100%",this.canvas.style.height=t<n?n+"px":"100%"}},mxGraphView.prototype.createHtmlPane=function(e,n){var t=document.createElement("DIV");return null!=e&&null!=n?(t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.width=e,t.style.height=n):t.style.position="relative",t},mxGraphView.prototype.createVml=function(){var e=this.graph.container;if(null!=e){var n=e.offsetWidth,t=e.offsetHeight;this.canvas=this.createVmlPane(n,t),this.backgroundPane=this.createVmlPane(n,t),this.drawPane=this.createVmlPane(n,t),this.overlayPane=this.createVmlPane(n,t),this.canvas.appendChild(this.backgroundPane),this.canvas.appendChild(this.drawPane),this.canvas.appendChild(this.overlayPane),e.appendChild(this.canvas)}},mxGraphView.prototype.createVmlPane=function(e,n){var t=document.createElement(mxClient.VML_PREFIX+":group");return t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.width=e+"px",t.style.height=n+"px",t.setAttribute("coordsize",e+","+n),t.setAttribute("coordorigin","0,0"),t},mxGraphView.prototype.createSvg=function(){var e=this.graph.container;this.canvas=document.createElementNS(mxConstants.NS_SVG,"g"),this.backgroundPane=document.createElementNS(mxConstants.NS_SVG,"g"),this.canvas.appendChild(this.backgroundPane),this.drawPane=document.createElementNS(mxConstants.NS_SVG,"g"),this.canvas.appendChild(this.drawPane),this.overlayPane=document.createElementNS(mxConstants.NS_SVG,"g"),this.canvas.appendChild(this.overlayPane);var n=document.createElementNS(mxConstants.NS_SVG,"svg");n.style.width="100%",n.style.height="100%",n.style.display="block",n.appendChild(this.canvas),null!=e&&(e.appendChild(n),"static"==mxUtils.getCurrentStyle(e).position&&(e.style.position="relative"))},mxGraphView.prototype.destroy=function(){var e=null!=this.canvas?this.canvas.ownerSVGElement:null;null==e&&(e=this.canvas),null!=e&&null!=e.parentNode&&(this.clear(this.currentRoot,!0),mxEvent.removeGestureListeners(document,null,this.moveHandler,this.endHandler),mxEvent.release(this.graph.container),e.parentNode.removeChild(e),this.overlayPane=this.drawPane=this.backgroundPane=this.canvas=this.endHandler=this.moveHandler=null)},mxCurrentRootChange.prototype.execute=function(){var e=this.view.currentRoot;this.view.currentRoot=this.previous,this.previous=e,null!=(e=this.view.graph.getTranslateForRoot(this.view.currentRoot))&&(this.view.translate=new mxPoint(-e.x,-e.y)),this.view.fireEvent(new mxEventObject(this.isUp?mxEvent.UP:mxEvent.DOWN,"root",this.view.currentRoot,"previous",this.previous)),this.isUp?(this.view.clear(this.view.currentRoot,!0),this.view.validate()):this.view.refresh(),this.isUp=!this.isUp},mxLoadResources&&mxResources.add(mxClient.basePath+"/resources/graph"),mxGraph.prototype=new mxEventSource,mxGraph.prototype.constructor=mxGraph,mxGraph.prototype.EMPTY_ARRAY=[],mxGraph.prototype.mouseListeners=null,mxGraph.prototype.isMouseDown=!1,mxGraph.prototype.model=null,mxGraph.prototype.view=null,mxGraph.prototype.stylesheet=null,mxGraph.prototype.selectionModel=null,mxGraph.prototype.cellEditor=null,mxGraph.prototype.cellRenderer=null,mxGraph.prototype.multiplicities=null,mxGraph.prototype.renderHint=null,mxGraph.prototype.dialect=null,mxGraph.prototype.gridSize=10,mxGraph.prototype.gridEnabled=!0,mxGraph.prototype.portsEnabled=!0,mxGraph.prototype.doubleTapEnabled=!0,mxGraph.prototype.doubleTapTimeout=700,mxGraph.prototype.doubleTapTolerance=25,mxGraph.prototype.lastTouchY=0,mxGraph.prototype.lastTouchY=0,mxGraph.prototype.lastTouchTime=0,mxGraph.prototype.gestureEnabled=!0,mxGraph.prototype.tolerance=4,mxGraph.prototype.defaultOverlap=.5,mxGraph.prototype.defaultParent=null,mxGraph.prototype.alternateEdgeStyle=null,mxGraph.prototype.backgroundImage=null,mxGraph.prototype.pageVisible=!1,mxGraph.prototype.pageBreaksVisible=!1,mxGraph.prototype.pageBreakColor="gray",mxGraph.prototype.pageBreakDashed=!0,mxGraph.prototype.minPageBreakDist=20,mxGraph.prototype.preferPageSize=!1,mxGraph.prototype.pageFormat=mxConstants.PAGE_FORMAT_A4_PORTRAIT,mxGraph.prototype.pageScale=1.5,mxGraph.prototype.enabled=!0,mxGraph.prototype.escapeEnabled=!0,mxGraph.prototype.invokesStopCellEditing=!0,mxGraph.prototype.enterStopsCellEditing=!1,mxGraph.prototype.useScrollbarsForPanning=!0,mxGraph.prototype.exportEnabled=!0,mxGraph.prototype.importEnabled=!0,mxGraph.prototype.cellsLocked=!1,mxGraph.prototype.cellsCloneable=!0,mxGraph.prototype.foldingEnabled=!0,mxGraph.prototype.cellsEditable=!0,mxGraph.prototype.cellsDeletable=!0,mxGraph.prototype.cellsMovable=!0,mxGraph.prototype.edgeLabelsMovable=!0,mxGraph.prototype.vertexLabelsMovable=!1,mxGraph.prototype.dropEnabled=!1,mxGraph.prototype.splitEnabled=!0,mxGraph.prototype.cellsResizable=!0,mxGraph.prototype.cellsBendable=!0,mxGraph.prototype.cellsSelectable=!0,mxGraph.prototype.cellsDisconnectable=!0,mxGraph.prototype.autoSizeCells=!1,mxGraph.prototype.autoScroll=!0,mxGraph.prototype.timerAutoScroll=!1,mxGraph.prototype.allowAutoPanning=!1,mxGraph.prototype.ignoreScrollbars=!1,mxGraph.prototype.autoExtend=!0,mxGraph.prototype.maximumGraphBounds=null,mxGraph.prototype.minimumGraphSize=null,mxGraph.prototype.minimumContainerSize=null,mxGraph.prototype.maximumContainerSize=null,mxGraph.prototype.resizeContainer=!1,mxGraph.prototype.border=0,mxGraph.prototype.ordered=!0,mxGraph.prototype.keepEdgesInForeground=!1,mxGraph.prototype.keepEdgesInBackground=!0,mxGraph.prototype.allowNegativeCoordinates=!0,mxGraph.prototype.constrainChildren=!0,mxGraph.prototype.extendParents=!0,mxGraph.prototype.extendParentsOnAdd=!0,mxGraph.prototype.collapseToPreferredSize=!0,mxGraph.prototype.zoomFactor=1.2,mxGraph.prototype.keepSelectionVisibleOnZoom=!1,mxGraph.prototype.centerZoom=!0,mxGraph.prototype.resetViewOnRootChange=!0,mxGraph.prototype.resetEdgesOnResize=!1,mxGraph.prototype.resetEdgesOnMove=!1,mxGraph.prototype.resetEdgesOnConnect=!0,mxGraph.prototype.allowLoops=!1,mxGraph.prototype.defaultLoopStyle=mxEdgeStyle.Loop,mxGraph.prototype.multigraph=!0,mxGraph.prototype.connectableEdges=!1,mxGraph.prototype.allowDanglingEdges=!0,mxGraph.prototype.cloneInvalidEdges=!1,mxGraph.prototype.disconnectOnMove=!0,mxGraph.prototype.labelsVisible=!0,mxGraph.prototype.htmlLabels=!1,mxGraph.prototype.swimlaneSelectionEnabled=!0,mxGraph.prototype.swimlaneNesting=!0,mxGraph.prototype.swimlaneIndicatorColorAttribute=mxConstants.STYLE_FILLCOLOR,mxGraph.prototype.imageBundles=null,mxGraph.prototype.minFitScale=.1,mxGraph.prototype.maxFitScale=8,mxGraph.prototype.panDx=0,mxGraph.prototype.panDy=0,mxGraph.prototype.collapsedImage=new mxImage(mxClient.imageBasePath+"/collapsed.gif",9,9),mxGraph.prototype.expandedImage=new mxImage(mxClient.imageBasePath+"/expanded.gif",9,9),mxGraph.prototype.warningImage=new mxImage("/assets/plugins/mxgraph/images/warning.gif",16,16),mxGraph.prototype.alreadyConnectedResource="none"!=mxClient.language?"alreadyConnected":"",mxGraph.prototype.containsValidationErrorsResource="none"!=mxClient.language?"containsValidationErrors":"",mxGraph.prototype.collapseExpandResource="none"!=mxClient.language?"collapse-expand":"",mxGraph.prototype.init=function(e){this.container=e,this.cellEditor=this.createCellEditor(),this.view.init(),this.sizeDidChange(),mxClient.IS_IE&&(mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})),mxEvent.addListener(e,"selectstart",mxUtils.bind(this,function(){return this.isEditing()}))),8==document.documentMode&&e.insertAdjacentHTML("beforeend",'<v:group style="DISPLAY: none;"></v:group>')},mxGraph.prototype.createHandlers=function(e){this.tooltipHandler=new mxTooltipHandler(this),this.tooltipHandler.setEnabled(!1),this.panningHandler=new mxPanningHandler(this),this.panningHandler.panningEnabled=!1,this.selectionCellsHandler=new mxSelectionCellsHandler(this),this.connectionHandler=new mxConnectionHandler(this),this.connectionHandler.setEnabled(!1),this.graphHandler=new mxGraphHandler(this)},mxGraph.prototype.createSelectionModel=function(){return new mxGraphSelectionModel(this)},mxGraph.prototype.createStylesheet=function(){return new mxStylesheet},mxGraph.prototype.createGraphView=function(){return new mxGraphView(this)},mxGraph.prototype.createCellRenderer=function(){return new mxCellRenderer},mxGraph.prototype.createCellEditor=function(){return new mxCellEditor(this)},mxGraph.prototype.getModel=function(){return this.model},mxGraph.prototype.getView=function(){return this.view},mxGraph.prototype.getStylesheet=function(){return this.stylesheet},mxGraph.prototype.setStylesheet=function(e){this.stylesheet=e},mxGraph.prototype.getSelectionModel=function(){return this.selectionModel},mxGraph.prototype.setSelectionModel=function(e){this.selectionModel=e},mxGraph.prototype.getSelectionCellsForChanges=function(e){for(var n=[],t=0;t<e.length;t++){var a=e[t];if(a.constructor!=mxRootChange){var i=null;a instanceof mxChildChange&&null==a.previous?i=a.child:null!=a.cell&&a.cell instanceof mxCell&&(i=a.cell),null!=i&&mxUtils.indexOf(n,i)<0&&n.push(i)}}return this.getModel().getTopmostCells(n)},mxGraph.prototype.graphModelChanged=function(e){for(var n=0;n<e.length;n++)this.processChange(e[n]);this.removeSelectionCells(this.getRemovedCellsForChanges(e)),this.view.validate(),this.sizeDidChange()},mxGraph.prototype.getRemovedCellsForChanges=function(e){for(var n=[],t=0;t<e.length;t++){var a=e[t];if(a instanceof mxRootChange)break;a instanceof mxChildChange?null!=a.previous&&null==a.parent&&(n=n.concat(this.model.getDescendants(a.child))):a instanceof mxVisibleChange&&(n=n.concat(this.model.getDescendants(a.cell)))}return n},mxGraph.prototype.processChange=function(e){if(e instanceof mxRootChange)this.clearSelection(),this.removeStateForCell(e.previous),this.resetViewOnRootChange&&(this.view.scale=1,this.view.translate.x=0,this.view.translate.y=0),this.fireEvent(new mxEventObject(mxEvent.ROOT));else if(e instanceof mxChildChange){var n=this.model.getParent(e.child);null!=n?this.view.invalidate(e.child,!0,!1,null!=e.previous):(this.removeStateForCell(e.child),this.view.currentRoot==e.child&&this.home()),n!=e.previous&&(null!=n&&this.view.invalidate(n,!1,!1),null!=e.previous&&this.view.invalidate(e.previous,!1,!1))}else e instanceof mxTerminalChange||e instanceof mxGeometryChange?this.view.invalidate(e.cell):e instanceof mxValueChange?this.view.invalidate(e.cell,!1,!1):e instanceof mxStyleChange?(this.view.invalidate(e.cell,!0,!0,!1),this.view.removeState(e.cell)):null!=e.cell&&e.cell instanceof mxCell&&this.removeStateForCell(e.cell)},mxGraph.prototype.removeStateForCell=function(e){for(var n=this.model.getChildCount(e),t=0;t<n;t++)this.removeStateForCell(this.model.getChildAt(e,t));this.view.removeState(e)},mxGraph.prototype.addCellOverlay=function(e,n){null==e.overlays&&(e.overlays=[]),e.overlays.push(n);var t=this.view.getState(e);return null!=t&&this.cellRenderer.redraw(t),this.fireEvent(new mxEventObject(mxEvent.ADD_OVERLAY,"cell",e,"overlay",n)),n},mxGraph.prototype.getCellOverlays=function(e){return e.overlays},mxGraph.prototype.removeCellOverlay=function(e,n){if(null==n)this.removeCellOverlays(e);else{var t=mxUtils.indexOf(e.overlays,n);0<=t?(e.overlays.splice(t,1),0==e.overlays.length&&(e.overlays=null),null!=(t=this.view.getState(e))&&this.cellRenderer.redraw(t),this.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY,"cell",e,"overlay",n))):n=null}return n},mxGraph.prototype.removeCellOverlays=function(e){var n=e.overlays;if(null!=n){e.overlays=null;var t=this.view.getState(e);for(null!=t&&this.cellRenderer.redraw(t),t=0;t<n.length;t++)this.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY,"cell",e,"overlay",n[t]))}return n},mxGraph.prototype.clearCellOverlays=function(e){e=null!=e?e:this.model.getRoot(),this.removeCellOverlays(e);for(var n=this.model.getChildCount(e),t=0;t<n;t++){var a=this.model.getChildAt(e,t);this.clearCellOverlays(a)}},mxGraph.prototype.setCellWarning=function(t,e,n,a){return null!=e&&0<e.length?(e=new mxCellOverlay(n=null!=n?n:this.warningImage,"<font color=red>"+e+"</font>"),a&&e.addListener(mxEvent.CLICK,mxUtils.bind(this,function(e,n){this.isEnabled()&&this.setSelectionCell(t)})),this.addCellOverlay(t,e)):(this.removeCellOverlays(t),null)},mxGraph.prototype.startEditing=function(e){this.startEditingAtCell(null,e)},mxGraph.prototype.startEditingAtCell=function(e,n){null==e&&(null!=(e=this.getSelectionCell())&&!this.isCellEditable(e)&&(e=null)),null!=e&&(this.fireEvent(new mxEventObject(mxEvent.START_EDITING,"cell",e,"event",n)),this.cellEditor.startEditing(e,n))},mxGraph.prototype.getEditingValue=function(e,n){return this.convertValueToString(e)},mxGraph.prototype.stopEditing=function(e){this.cellEditor.stopEditing(e)},mxGraph.prototype.labelChanged=function(e,n,t){this.model.beginUpdate();try{this.cellLabelChanged(e,n,this.isAutoSizeCell(e)),this.fireEvent(new mxEventObject(mxEvent.LABEL_CHANGED,"cell",e,"value",n,"event",t))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellLabelChanged=function(e,n,t){this.model.beginUpdate();try{this.model.setValue(e,n),t&&this.cellSizeUpdated(e,!1)}finally{this.model.endUpdate()}},mxGraph.prototype.escape=function(e){this.stopEditing(!0),this.connectionHandler.reset(),this.graphHandler.reset(),e=this.getSelectionCells();for(var n=0;n<e.length;n++){var t=this.view.getState(e[n]);null!=t&&null!=t.handler&&t.handler.reset()}},mxGraph.prototype.click=function(e){var n=e.getEvent(),t=e.getCell(),a=new mxEventObject(mxEvent.CLICK,"event",n,"cell",t);e.isConsumed()&&a.consume(),this.fireEvent(a),this.isEnabled()&&!mxEvent.isConsumed(n)&&!a.isConsumed()&&(null!=t?this.selectCellForEvent(t,n):(t=null,this.isSwimlaneSelectionEnabled()&&(t=this.getSwimlaneAt(e.getGraphX(),e.getGraphY())),null!=t?this.selectCellForEvent(t,n):this.isToggleEvent(n)||this.clearSelection()))},mxGraph.prototype.dblClick=function(e,n){var t=new mxEventObject(mxEvent.DOUBLE_CLICK,"event",e,"cell",n);this.fireEvent(t),this.isEnabled()&&!mxEvent.isConsumed(e)&&!t.isConsumed()&&null!=n&&this.isCellEditable(n)&&this.startEditingAtCell(n,e)},mxGraph.prototype.scrollPointToVisible=function(e,n,t,a){if(this.timerAutoScroll||!this.ignoreScrollbars&&!mxUtils.hasScrollbars(this.container))this.allowAutoPanning&&!this.panningHandler.active&&(null==this.panningManager&&(this.panningManager=this.createPanningManager()),this.panningManager.panTo(e+this.panDx,n+this.panDy));else{var i=this.container;if(a=null!=a?a:20,e>=i.scrollLeft&&n>=i.scrollTop&&e<=i.scrollLeft+i.clientWidth&&n<=i.scrollTop+i.clientHeight){var s=i.scrollLeft+i.clientWidth-e;if(s<a){if(e=i.scrollLeft,i.scrollLeft+=a-s,t&&e==i.scrollLeft){if(this.dialect==mxConstants.DIALECT_SVG){e=this.view.getDrawPane().ownerSVGElement;var o=this.container.scrollWidth+a-s}else o=Math.max(i.clientWidth,i.scrollWidth)+a-s,e=this.view.getCanvas();e.style.width=o+"px",i.scrollLeft+=a-s}}else(s=e-i.scrollLeft)<a&&(i.scrollLeft-=a-s);(s=i.scrollTop+i.clientHeight-n)<a?(e=i.scrollTop,i.scrollTop+=a-s,e==i.scrollTop&&t&&(this.dialect==mxConstants.DIALECT_SVG?(e=this.view.getDrawPane().ownerSVGElement,n=this.container.scrollHeight+a-s):(n=Math.max(i.clientHeight,i.scrollHeight)+a-s,e=this.view.getCanvas()),e.style.height=n+"px",i.scrollTop+=a-s)):(s=n-i.scrollTop)<a&&(i.scrollTop-=a-s)}}},mxGraph.prototype.createPanningManager=function(){return new mxPanningManager(this)},mxGraph.prototype.getBorderSizes=function(){function e(e){var n=0;n="thin"==e?2:"medium"==e?4:"thick"==e?6:parseInt(e);return isNaN(n)&&(n=0),n}var n=mxUtils.getCurrentStyle(this.container),t=new mxRectangle;return t.x=e(n.borderLeftWidth)+parseInt(n.paddingLeft||0),t.y=e(n.borderTopWidth)+parseInt(n.paddingTop||0),t.width=e(n.borderRightWidth)+parseInt(n.paddingRight||0),t.height=e(n.borderBottomWidth)+parseInt(n.paddingBottom||0),t},mxGraph.prototype.getPreferredPageSize=function(e,n,t){e=this.view.scale;var a=this.view.translate,i=this.pageFormat,s=e*this.pageScale;i=new mxRectangle(0,0,i.width*s,i.height*s);return n=this.pageBreaksVisible?Math.ceil(n/i.width):1,t=this.pageBreaksVisible?Math.ceil(t/i.height):1,new mxRectangle(0,0,n*i.width+2+a.x/e,t*i.height+2+a.y/e)},mxGraph.prototype.sizeDidChange=function(){var e=this.getGraphBounds();if(null!=this.container){var n=this.getBorder(),t=Math.max(0,e.x+e.width+1+n);n=Math.max(0,e.y+e.height+1+n);if(null!=this.minimumContainerSize&&(t=Math.max(t,this.minimumContainerSize.width),n=Math.max(n,this.minimumContainerSize.height)),this.resizeContainer&&this.doResizeContainer(t,n),this.preferPageSize||!mxClient.IS_IE&&this.pageVisible){var a=this.getPreferredPageSize(e,t,n);null!=a&&(t=a.width,n=a.height)}null!=this.minimumGraphSize&&(t=Math.max(t,this.minimumGraphSize.width*this.view.scale),n=Math.max(n,this.minimumGraphSize.height*this.view.scale)),t=Math.ceil(t-1),n=Math.ceil(n-1),this.dialect==mxConstants.DIALECT_SVG?((a=this.view.getDrawPane().ownerSVGElement).style.minWidth=Math.max(1,t)+"px",a.style.minHeight=Math.max(1,n)+"px",a.style.width="100%",a.style.height="100%"):mxClient.IS_QUIRKS?this.view.updateHtmlCanvasSize(Math.max(1,t),Math.max(1,n)):(this.view.canvas.style.minWidth=Math.max(1,t)+"px",this.view.canvas.style.minHeight=Math.max(1,n)+"px"),this.updatePageBreaks(this.pageBreaksVisible,t-1,n-1)}this.fireEvent(new mxEventObject(mxEvent.SIZE,"bounds",e))},mxGraph.prototype.doResizeContainer=function(e,n){if(mxClient.IS_IE)if(mxClient.IS_QUIRKS){var t=this.getBorderSizes();e+=Math.max(2,t.x+t.width+1),n+=Math.max(2,t.y+t.height+1)}else 9<=document.documentMode?(e+=3,n+=5):(e+=1,n+=1);else n+=1;null!=this.maximumContainerSize&&(e=Math.min(this.maximumContainerSize.width,e),n=Math.min(this.maximumContainerSize.height,n)),this.container.style.width=Math.ceil(e)+"px",this.container.style.height=Math.ceil(n)+"px"},mxGraph.prototype.updatePageBreaks=function(e,n,t){var a=this.view.scale,i=this.view.translate,s=this.pageFormat,o=a*this.pageScale;i=new mxRectangle(a*i.x,a*i.y,s.width*o,s.height*o);if(e=e&&Math.min(i.width,i.height)>this.minPageBreakDist,i.x=mxUtils.mod(i.x,i.width),i.y=mxUtils.mod(i.y,i.height),s=e?Math.ceil((n-i.x)/i.width):0,e=e?Math.ceil((t-i.y)/i.height):0,null==this.horizontalPageBreaks&&0<s&&(this.horizontalPageBreaks=[]),null!=this.horizontalPageBreaks){for(o=0;o<=s;o++){var r=[new mxPoint(i.x+o*i.width,1),new mxPoint(i.x+o*i.width,t)];null!=this.horizontalPageBreaks[o]?(this.horizontalPageBreaks[o].scale=1,this.horizontalPageBreaks[o].points=r,this.horizontalPageBreaks[o].redraw()):((r=new mxPolyline(r,this.pageBreakColor,this.scale)).dialect=this.dialect,r.isDashed=this.pageBreakDashed,r.scale=a,r.init(this.view.backgroundPane),r.redraw(),this.horizontalPageBreaks[o]=r)}for(o=s;o<this.horizontalPageBreaks.length;o++)this.horizontalPageBreaks[o].destroy();this.horizontalPageBreaks.splice(s,this.horizontalPageBreaks.length-s)}if(null==this.verticalPageBreaks&&0<e&&(this.verticalPageBreaks=[]),null!=this.verticalPageBreaks){for(o=0;o<=e;o++)r=[new mxPoint(1,i.y+o*i.height),new mxPoint(n,i.y+o*i.height)],null!=this.verticalPageBreaks[o]?(this.verticalPageBreaks[o].scale=1,this.verticalPageBreaks[o].points=r,this.verticalPageBreaks[o].redraw()):((r=new mxPolyline(r,this.pageBreakColor,a)).dialect=this.dialect,r.isDashed=this.pageBreakDashed,r.scale=a,r.init(this.view.backgroundPane),r.redraw(),this.verticalPageBreaks[o]=r);for(o=e;o<this.verticalPageBreaks.length;o++)this.verticalPageBreaks[o].destroy();this.verticalPageBreaks.splice(e,this.verticalPageBreaks.length-e)}},mxGraph.prototype.getCellStyle=function(e){var n=this.model.getStyle(e),t=null;t=this.model.isEdge(e)?this.stylesheet.getDefaultEdgeStyle():this.stylesheet.getDefaultVertexStyle();return null!=n&&(t=this.postProcessCellStyle(this.stylesheet.getCellStyle(n,t))),null==t&&(t=mxGraph.prototype.EMPTY_ARRAY),t},mxGraph.prototype.postProcessCellStyle=function(e){if(null!=e){var n=e[mxConstants.STYLE_IMAGE],t=this.getImageFromBundles(n);null!=t?e[mxConstants.STYLE_IMAGE]=t:t=n,null!=t&&"data:image/"==t.substring(0,11)&&(0<(n=t.indexOf(","))&&(t=t.substring(0,n)+";base64,"+t.substring(n+1)),e[mxConstants.STYLE_IMAGE]=t)}return e},mxGraph.prototype.setCellStyle=function(e,n){if(null!=(n=n||this.getSelectionCells())){this.model.beginUpdate();try{for(var t=0;t<n.length;t++)this.model.setStyle(n[t],e)}finally{this.model.endUpdate()}}},mxGraph.prototype.toggleCellStyle=function(e,n,t){t=t||this.getSelectionCell(),this.toggleCellStyles(e,n,[t])},mxGraph.prototype.toggleCellStyles=function(e,n,t){var a;(n=null!=n&&n,null!=(t=t||this.getSelectionCells())&&0<t.length)&&(null!=(a=null!=(a=this.view.getState(t[0]))?a.style:this.getCellStyle(t[0]))&&(n=mxUtils.getValue(a,e,n)?0:1,this.setCellStyles(e,n,t)))},mxGraph.prototype.setCellStyles=function(e,n,t){t=t||this.getSelectionCells(),mxUtils.setCellStyles(this.model,t,e,n)},mxGraph.prototype.toggleCellStyleFlags=function(e,n,t){this.setCellStyleFlags(e,n,null,t)},mxGraph.prototype.setCellStyleFlags=function(e,n,t,a){if(null!=(a=a||this.getSelectionCells())&&0<a.length){var i;if(null==t)null!=(i=null!=(i=this.view.getState(a[0]))?i.style:this.getCellStyle(a[0]))&&(t=(parseInt(i[e]||0)&n)!=n);mxUtils.setCellStyleFlags(this.model,a,e,n,t)}},mxGraph.prototype.alignCells=function(e,n,t){if(null==n&&(n=this.getSelectionCells()),null!=n&&1<n.length){if(null==t)for(var a=0;a<n.length;a++){var i=this.getCellGeometry(n[a]);if(null!=i&&!this.model.isEdge(n[a]))if(null==t){if(e==mxConstants.ALIGN_CENTER){t=i.x+i.width/2;break}if(e==mxConstants.ALIGN_RIGHT)t=i.x+i.width;else if(e==mxConstants.ALIGN_TOP)t=i.y;else{if(e==mxConstants.ALIGN_MIDDLE){t=i.y+i.height/2;break}t=e==mxConstants.ALIGN_BOTTOM?i.y+i.height:i.x}}else t=e==mxConstants.ALIGN_RIGHT?Math.max(t,i.x+i.width):e==mxConstants.ALIGN_TOP?Math.min(t,i.y):e==mxConstants.ALIGN_BOTTOM?Math.max(t,i.y+i.height):Math.min(t,i.x)}if(null!=t){this.model.beginUpdate();try{for(a=0;a<n.length;a++)null!=(i=this.getCellGeometry(n[a]))&&!this.model.isEdge(n[a])&&(i=i.clone(),e==mxConstants.ALIGN_CENTER?i.x=t-i.width/2:e==mxConstants.ALIGN_RIGHT?i.x=t-i.width:e==mxConstants.ALIGN_TOP?i.y=t:e==mxConstants.ALIGN_MIDDLE?i.y=t-i.height/2:e==mxConstants.ALIGN_BOTTOM?i.y=t-i.height:i.x=t,this.model.setGeometry(n[a],i));this.fireEvent(new mxEventObject(mxEvent.ALIGN_CELLS,"align",e,"cells",n))}finally{this.model.endUpdate()}}}return n},mxGraph.prototype.flipEdge=function(e){if(null!=e&&null!=this.alternateEdgeStyle){this.model.beginUpdate();try{var n=this.model.getStyle(e);null==n||0==n.length?this.model.setStyle(e,this.alternateEdgeStyle):this.model.setStyle(e,null),this.resetEdge(e),this.fireEvent(new mxEventObject(mxEvent.FLIP_EDGE,"edge",e))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.addImageBundle=function(e){this.imageBundles.push(e)},mxGraph.prototype.removeImageBundle=function(e){for(var n=[],t=0;t<this.imageBundles.length;t++)this.imageBundles[t]!=e&&n.push(this.imageBundles[t]);this.imageBundles=n},mxGraph.prototype.getImageFromBundles=function(e){if(null!=e)for(var n=0;n<this.imageBundles.length;n++){var t=this.imageBundles[n].getImage(e);if(null!=t)return t}return null},mxGraph.prototype.orderCells=function(e,n){null==n&&(n=mxUtils.sortCells(this.getSelectionCells(),!0)),this.model.beginUpdate();try{this.cellsOrdered(n,e),this.fireEvent(new mxEventObject(mxEvent.ORDER_CELLS,"back",e,"cells",n))}finally{this.model.endUpdate()}return n},mxGraph.prototype.cellsOrdered=function(e,n){if(null!=e){this.model.beginUpdate();try{for(var t=0;t<e.length;t++){var a=this.model.getParent(e[t]);n?this.model.add(a,e[t],t):this.model.add(a,e[t],this.model.getChildCount(a)-1)}this.fireEvent(new mxEventObject(mxEvent.CELLS_ORDERED,"back",n,"cells",e))}finally{this.model.endUpdate()}}},mxGraph.prototype.groupCells=function(e,n,t){null==t&&(t=mxUtils.sortCells(this.getSelectionCells(),!0)),t=this.getCellsForGroup(t),null==e&&(e=this.createGroupCell(t));var a=this.getBoundsForGroup(e,t,n);if(0<t.length&&null!=a){var i=this.model.getParent(e);null==i&&(i=this.model.getParent(t[0])),this.model.beginUpdate();try{null==this.getCellGeometry(e)&&this.model.setGeometry(e,new mxGeometry);var s=this.model.getChildCount(i);this.cellsAdded([e],i,s,null,null,!1),s=this.model.getChildCount(e),this.cellsAdded(t,e,s,null,null,!1,!1),this.cellsMoved(t,-a.x,-a.y,!1,!0),this.cellsResized([e],[a]),this.fireEvent(new mxEventObject(mxEvent.GROUP_CELLS,"group",e,"border",n,"cells",t))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.getCellsForGroup=function(e){var n=[];if(null!=e&&0<e.length){var t=this.model.getParent(e[0]);n.push(e[0]);for(var a=1;a<e.length;a++)this.model.getParent(e[a])==t&&n.push(e[a])}return n},mxGraph.prototype.getBoundsForGroup=function(e,n,t){return null!=(n=this.getBoundingBoxFromGeometry(n))&&(this.isSwimlane(e)&&(e=this.getStartSize(e),n.x-=e.width,n.y-=e.height,n.width+=e.width,n.height+=e.height),n.x-=t,n.y-=t,n.width+=2*t,n.height+=2*t),n},mxGraph.prototype.createGroupCell=function(e){return(e=new mxCell("")).setVertex(!0),e.setConnectable(!1),e},mxGraph.prototype.ungroupCells=function(e){var n=[];if(null==e){e=this.getSelectionCells();for(var t=[],a=0;a<e.length;a++)0<this.model.getChildCount(e[a])&&t.push(e[a]);e=t}if(null!=e&&0<e.length){this.model.beginUpdate();try{for(a=0;a<e.length;a++){if(null!=(i=this.model.getChildren(e[a]))&&0<i.length){var i=i.slice(),s=this.model.getParent(e[a]),o=this.model.getChildCount(s);this.cellsAdded(i,s,o,null,null,!0),n=n.concat(i)}}this.cellsRemoved(this.addAllEdges(e)),this.fireEvent(new mxEventObject(mxEvent.UNGROUP_CELLS,"cells",e))}finally{this.model.endUpdate()}}return n},mxGraph.prototype.removeCellsFromParent=function(e){null==e&&(e=this.getSelectionCells()),this.model.beginUpdate();try{var n=this.getDefaultParent(),t=this.model.getChildCount(n);this.cellsAdded(e,n,t,null,null,!0),this.fireEvent(new mxEventObject(mxEvent.REMOVE_CELLS_FROM_PARENT,"cells",e))}finally{this.model.endUpdate()}return e},mxGraph.prototype.updateGroupBounds=function(e,n,t){null==e&&(e=this.getSelectionCells()),n=null!=n?n:0,t=null!=t&&t,this.model.beginUpdate();try{for(var a=0;a<e.length;a++){if(null!=(r=this.getCellGeometry(e[a]))){var i=this.getChildCells(e[a]);if(null!=i&&0<i.length){var s=this.getBoundingBoxFromGeometry(i);if(0<s.width&&0<s.height){var o=this.isSwimlane(e[a])?this.getStartSize(e[a]):new mxRectangle,r=r.clone();t&&(r.x+=s.x-o.width-n,r.y+=s.y-o.height-n),r.width=s.width+o.width+2*n,r.height=s.height+o.height+2*n,this.model.setGeometry(e[a],r),this.moveCells(i,-s.x+o.width+n,-s.y+o.height+n)}}}}}finally{this.model.endUpdate()}return e},mxGraph.prototype.cloneCells=function(e,n){n=null==n||n;var t=null;if(null!=e){for(var a={},i=(t=[],0);i<e.length;i++){a[s=mxCellPath.create(e[i])]=e[i],t.push(e[i])}if(0<t.length){var s=this.view.scale,o=this.view.translate;for(t=this.model.cloneCells(e,!0),i=0;i<e.length;i++)if(!n&&this.model.isEdge(t[i])&&null!=this.getEdgeValidationError(t[i],this.model.getTerminal(t[i],!0),this.model.getTerminal(t[i],!1)))t[i]=null;else{var r=this.model.getGeometry(t[i]);if(null!=r){var l=this.view.getState(e[i]),d=this.view.getState(this.model.getParent(e[i]));if(null!=l&&null!=d){var c=d.origin.x;d=d.origin.y;if(this.model.isEdge(t[i])){l=l.absolutePoints;for(var m=this.model.getTerminal(e[i],!0),u=mxCellPath.create(m);null!=m&&null==a[u];)m=this.model.getParent(m),u=mxCellPath.create(m);for(null==m&&r.setTerminalPoint(new mxPoint(l[0].x/s-o.x,l[0].y/s-o.y),!0),m=this.model.getTerminal(e[i],!1),u=mxCellPath.create(m);null!=m&&null==a[u];)m=this.model.getParent(m),u=mxCellPath.create(m);if(null==m&&(m=l.length-1,r.setTerminalPoint(new mxPoint(l[m].x/s-o.x,l[m].y/s-o.y),!1)),null!=(r=r.points))for(l=0;l<r.length;l++)r[l].x+=c,r[l].y+=d}else r.x+=c,r.y+=d}}}}else t=[]}return t},mxGraph.prototype.insertVertex=function(e,n,t,a,i,s,o,r,l){return n=this.createVertex(e,n,t,a,i,s,o,r,l),this.addCell(n,e)},mxGraph.prototype.createVertex=function(e,n,t,a,i,s,o,r,l){return(e=new mxGeometry(a,i,s,o)).relative=null!=l&&l,(t=new mxCell(t,e,r)).setId(n),t.setVertex(!0),t.setConnectable(!0),t},mxGraph.prototype.insertEdge=function(e,n,t,a,i,s){return n=this.createEdge(e,n,t,a,i,s),this.addEdge(n,e,a,i)},mxGraph.prototype.createEdge=function(e,n,t,a,i,s){return(e=new mxCell(t,new mxGeometry,s)).setId(n),e.setEdge(!0),e.geometry.relative=!0,e},mxGraph.prototype.addEdge=function(e,n,t,a,i){return this.addCell(e,n,i,t,a)},mxGraph.prototype.addCell=function(e,n,t,a,i){return this.addCells([e],n,t,a,i)[0]},mxGraph.prototype.addCells=function(e,n,t,a,i){null==n&&(n=this.getDefaultParent()),null==t&&(t=this.model.getChildCount(n)),this.model.beginUpdate();try{this.cellsAdded(e,n,t,a,i,!1,!0),this.fireEvent(new mxEventObject(mxEvent.ADD_CELLS,"cells",e,"parent",n,"index",t,"source",a,"target",i))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsAdded=function(e,n,t,a,i,s,o){if(null!=e&&null!=n&&null!=t){this.model.beginUpdate();try{for(var r=null!=(d=s?this.view.getState(n):null)?d.origin:null,l=new mxPoint(0,0),d=0;d<e.length;d++)if(null==e[d])t--;else{var c=this.model.getParent(e[d]);if(null!=r&&e[d]!=n&&n!=c){var m=this.view.getState(c),u=null!=m?m.origin:l;if(null!=(p=this.model.getGeometry(e[d]))){var p,g=u.x-r.x,v=u.y-r.y;(p=p.clone()).translate(g,v),!p.relative&&this.model.isVertex(e[d])&&!this.isAllowNegativeCoordinates()&&(p.x=Math.max(0,p.x),p.y=Math.max(0,p.y)),this.model.setGeometry(e[d],p)}}n==c&&t+d>this.model.getChildCount(n)&&t--,this.model.add(n,e[d],t+d),this.isExtendParentsOnAdd()&&this.isExtendParent(e[d])&&this.extendParent(e[d]),(null==o||o)&&this.constrainChild(e[d]),null!=a&&this.cellConnected(e[d],a,!0),null!=i&&this.cellConnected(e[d],i,!1)}this.fireEvent(new mxEventObject(mxEvent.CELLS_ADDED,"cells",e,"parent",n,"index",t,"source",a,"target",i,"absolute",s))}finally{this.model.endUpdate()}}},mxGraph.prototype.removeCells=function(e,n){n=null==n||n,null==e&&(e=this.getDeletableCells(this.getSelectionCells())),n&&(e=this.getDeletableCells(this.addAllEdges(e))),this.model.beginUpdate();try{this.cellsRemoved(e),this.fireEvent(new mxEventObject(mxEvent.REMOVE_CELLS,"cells",e,"includeEdges",n))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsRemoved=function(e){if(null!=e&&0<e.length){var n=this.view.scale,t=this.view.translate;this.model.beginUpdate();try{for(var a={},i=0;i<e.length;i++){var s=mxCellPath.create(e[i]);a[s]=e[i]}for(i=0;i<e.length;i++){for(var o=this.getConnections(e[i]),r=0;r<o.length;r++)if(null==a[s=mxCellPath.create(o[r])]){if(null!=(d=this.model.getGeometry(o[r]))){var l=this.view.getState(o[r]);if(null!=l){var d=d.clone(),c=l.getVisibleTerminal(!0)==e[i],m=l.absolutePoints,u=c?0:m.length-1;d.setTerminalPoint(new mxPoint(m[u].x/n-t.x,m[u].y/n-t.y),c),this.model.setTerminal(o[r],null,c),this.model.setGeometry(o[r],d)}}}this.model.remove(e[i])}this.fireEvent(new mxEventObject(mxEvent.CELLS_REMOVED,"cells",e))}finally{this.model.endUpdate()}}},mxGraph.prototype.splitEdge=function(e,n,t,a,i){a=a||0,i=i||0,null==t&&(t=this.cloneCells([e])[0]);var s=this.model.getParent(e),o=this.model.getTerminal(e,!0);this.model.beginUpdate();try{this.cellsMoved(n,a,i,!1,!1),this.cellsAdded(n,s,this.model.getChildCount(s),null,null,!0),this.cellsAdded([t],s,this.model.getChildCount(s),o,n[0],!1),this.cellConnected(e,n[0],!0),this.fireEvent(new mxEventObject(mxEvent.SPLIT_EDGE,"edge",e,"cells",n,"newEdge",t,"dx",a,"dy",i))}finally{this.model.endUpdate()}return t},mxGraph.prototype.toggleCells=function(e,n,t){null==n&&(n=this.getSelectionCells()),t&&(n=this.addAllEdges(n)),this.model.beginUpdate();try{this.cellsToggled(n,e),this.fireEvent(new mxEventObject(mxEvent.TOGGLE_CELLS,"show",e,"cells",n,"includeEdges",t))}finally{this.model.endUpdate()}return n},mxGraph.prototype.cellsToggled=function(e,n){if(null!=e&&0<e.length){this.model.beginUpdate();try{for(var t=0;t<e.length;t++)this.model.setVisible(e[t],n)}finally{this.model.endUpdate()}}},mxGraph.prototype.foldCells=function(e,n,t,a){n=null!=n&&n,null==t&&(t=this.getFoldableCells(this.getSelectionCells(),e)),this.stopEditing(!1),this.model.beginUpdate();try{this.cellsFolded(t,e,n,a),this.fireEvent(new mxEventObject(mxEvent.FOLD_CELLS,"collapse",e,"recurse",n,"cells",t))}finally{this.model.endUpdate()}return t},mxGraph.prototype.cellsFolded=function(e,n,t,a){if(null!=e&&0<e.length){this.model.beginUpdate();try{for(var i=0;i<e.length;i++)if((!a||this.isCellFoldable(e[i],n))&&n!=this.isCellCollapsed(e[i])&&(this.model.setCollapsed(e[i],n),this.swapBounds(e[i],n),this.isExtendParent(e[i])&&this.extendParent(e[i]),t)){var s=this.model.getChildren(e[i]);this.foldCells(s,n,t)}this.fireEvent(new mxEventObject(mxEvent.CELLS_FOLDED,"cells",e,"collapse",n,"recurse",t))}finally{this.model.endUpdate()}}},mxGraph.prototype.swapBounds=function(e,n){if(null!=e){var t=this.model.getGeometry(e);null!=t&&(t=t.clone(),this.updateAlternateBounds(e,t,n),t.swap(),this.model.setGeometry(e,t))}},mxGraph.prototype.updateAlternateBounds=function(e,n,t){if(null!=e&&null!=n){if(t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e),null==n.alternateBounds){var a=n;this.collapseToPreferredSize&&(null!=(e=this.getPreferredSizeForCell(e))&&(a=e,0<(e=mxUtils.getValue(t,mxConstants.STYLE_STARTSIZE))&&(a.height=Math.max(a.height,e)))),n.alternateBounds=new mxRectangle(0,0,a.width,a.height)}if(null!=n.alternateBounds){n.alternateBounds.x=n.x,n.alternateBounds.y=n.y;var i=mxUtils.toRadians(t[mxConstants.STYLE_ROTATION]||"0");0!=i&&(e=n.alternateBounds.getCenterX()-n.getCenterX(),t=n.alternateBounds.getCenterY()-n.getCenterY(),a=Math.cos(i),i=Math.sin(i),n.alternateBounds.x+=a*e-i*t-e,n.alternateBounds.y+=i*e+a*t-t)}}},mxGraph.prototype.addAllEdges=function(e){var n=e.slice();return n.concat(this.getAllEdges(e))},mxGraph.prototype.getAllEdges=function(e){var n=[];if(null!=e)for(var t=0;t<e.length;t++){for(var a=this.model.getEdgeCount(e[t]),i=0;i<a;i++)n.push(this.model.getEdgeAt(e[t],i));a=this.model.getChildren(e[t]),n=n.concat(this.getAllEdges(a))}return n},mxGraph.prototype.updateCellSize=function(e,n){n=null!=n&&n,this.model.beginUpdate();try{this.cellSizeUpdated(e,n),this.fireEvent(new mxEventObject(mxEvent.UPDATE_CELL_SIZE,"cell",e,"ignoreChildren",n))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellSizeUpdated=function(e,n){if(null!=e){this.model.beginUpdate();try{var t=this.getPreferredSizeForCell(e),a=this.model.getGeometry(e);if(null!=t&&null!=a){var i=this.isCellCollapsed(e);a=a.clone();if(this.isSwimlane(e)){var s=this.view.getState(e),o=null!=s?s.style:this.getCellStyle(e),r=this.model.getStyle(e);null==r&&(r=""),mxUtils.getValue(o,mxConstants.STYLE_HORIZONTAL,!0)?(r=mxUtils.setStyle(r,mxConstants.STYLE_STARTSIZE,t.height+8),i&&(a.height=t.height+8),a.width=t.width):(r=mxUtils.setStyle(r,mxConstants.STYLE_STARTSIZE,t.width+8),i&&(a.width=t.width+8),a.height=t.height),this.model.setStyle(e,r)}else a.width=t.width,a.height=t.height;if(!n&&!i){var l=this.view.getBounds(this.model.getChildren(e));if(null!=l){var d=this.view.translate,c=this.view.scale,m=(l.y+l.height)/c-a.y-d.y;a.width=Math.max(a.width,(l.x+l.width)/c-a.x-d.x),a.height=Math.max(a.height,m)}}this.cellsResized([e],[a])}}finally{this.model.endUpdate()}}},mxGraph.prototype.getPreferredSizeForCell=function(e){var n=null;if(null!=e){var t=this.view.getState(e),a=null!=t?t.style:this.getCellStyle(e);if(null!=a&&!this.model.isEdge(e)){var i=a[mxConstants.STYLE_FONTSIZE]||mxConstants.DEFAULT_FONTSIZE,s=0;n=0;null==this.getImage(t)&&null==a[mxConstants.STYLE_IMAGE]||a[mxConstants.STYLE_SHAPE]!=mxConstants.SHAPE_LABEL||(a[mxConstants.STYLE_VERTICAL_ALIGN]==mxConstants.ALIGN_MIDDLE&&(s+=parseFloat(a[mxConstants.STYLE_IMAGE_WIDTH])||mxLabel.prototype.imageSize),a[mxConstants.STYLE_ALIGN]!=mxConstants.ALIGN_CENTER&&(n+=parseFloat(a[mxConstants.STYLE_IMAGE_HEIGHT])||mxLabel.prototype.imageSize)),s+=2*(a[mxConstants.STYLE_SPACING]||0),s+=a[mxConstants.STYLE_SPACING_LEFT]||0,s+=a[mxConstants.STYLE_SPACING_RIGHT]||0,n+=2*(a[mxConstants.STYLE_SPACING]||0),n+=a[mxConstants.STYLE_SPACING_TOP]||0,n+=a[mxConstants.STYLE_SPACING_BOTTOM]||0,null!=(t=this.getFoldingImage(t))&&(s+=t.width+8),n=null!=(t=this.getLabel(e))&&0<t.length?(this.isHtmlLabel(e)||(t=t.replace(/\n/g,"<br>")),e=(i=mxUtils.getSizeForString(t,i,a[mxConstants.STYLE_FONTFAMILY])).width+s,n=i.height+n,mxUtils.getValue(a,mxConstants.STYLE_HORIZONTAL,!0)||(a=n,n=e,e=a),this.gridEnabled&&(e=this.snap(e+this.gridSize/2),n=this.snap(n+this.gridSize/2)),new mxRectangle(0,0,e,n)):new mxRectangle(0,0,a=4*this.gridSize,a)}}return n},mxGraph.prototype.handleGesture=function(e,n){if(.2<Math.abs(1-n.scale)){var t=this.view.scale,a=this.view.translate,i=e.width*n.scale,s=e.height*n.scale,o=e.y-(s-e.height)/2;t=new mxRectangle(this.snap((e.x-(i-e.width)/2)/t)-a.x,this.snap(o/t)-a.y,this.snap(i/t),this.snap(s/t));this.resizeCell(e.cell,t)}},mxGraph.prototype.resizeCell=function(e,n){return this.resizeCells([e],[n])[0]},mxGraph.prototype.resizeCells=function(e,n){this.model.beginUpdate();try{this.cellsResized(e,n),this.fireEvent(new mxEventObject(mxEvent.RESIZE_CELLS,"cells",e,"bounds",n))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsResized=function(e,n){if(null!=e&&null!=n&&e.length==n.length){this.model.beginUpdate();try{for(var t=0;t<e.length;t++){var a=n[t],i=this.model.getGeometry(e[t]);if(null!=i&&(i.x!=a.x||i.y!=a.y||i.width!=a.width||i.height!=a.height)){if((i=i.clone()).relative){var s=i.offset;null!=s&&(s.x+=a.x-i.x,s.y+=a.y-i.y)}else i.x=a.x,i.y=a.y;i.width=a.width,i.height=a.height,!i.relative&&this.model.isVertex(e[t])&&!this.isAllowNegativeCoordinates()&&(i.x=Math.max(0,i.x),i.y=Math.max(0,i.y)),this.model.setGeometry(e[t],i),this.isExtendParent(e[t])&&this.extendParent(e[t])}}this.resetEdgesOnResize&&this.resetEdges(e),this.fireEvent(new mxEventObject(mxEvent.CELLS_RESIZED,"cells",e,"bounds",n))}finally{this.model.endUpdate()}}},mxGraph.prototype.extendParent=function(e){if(null!=e){var n=this.model.getParent(e),t=this.model.getGeometry(n);null!=n&&null!=t&&!this.isCellCollapsed(n)&&(null!=(e=this.model.getGeometry(e))&&(t.width<e.x+e.width||t.height<e.y+e.height))&&((t=t.clone()).width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height),this.cellsResized([n],[t]))}},mxGraph.prototype.importCells=function(e,n,t,a,i){return this.moveCells(e,n,t,!0,a,i)},mxGraph.prototype.moveCells=function(e,n,t,a,i,s){if(n=null!=n?n:0,t=null!=t?t:0,a=null!=a&&a,null!=e&&(0!=n||0!=t||a||null!=i)){this.model.beginUpdate();try{a&&(e=this.cloneCells(e,this.isCloneInvalidEdges()),null==i&&(i=this.getDefaultParent()));var o=this.isAllowNegativeCoordinates();if(null!=i&&this.setAllowNegativeCoordinates(!0),this.cellsMoved(e,n,t,!a&&this.isDisconnectOnMove()&&this.isAllowDanglingEdges(),null==i),this.setAllowNegativeCoordinates(o),null!=i){var r=this.model.getChildCount(i);this.cellsAdded(e,i,r,null,null,!0)}this.fireEvent(new mxEventObject(mxEvent.MOVE_CELLS,"cells",e,"dx",n,"dy",t,"clone",a,"target",i,"event",s))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.cellsMoved=function(e,n,t,a,i){if(null!=e&&(0!=n||0!=t)){this.model.beginUpdate();try{a&&this.disconnectGraph(e);for(var s=0;s<e.length;s++)this.translateCell(e[s],n,t),i&&this.constrainChild(e[s]);this.resetEdgesOnMove&&this.resetEdges(e),this.fireEvent(new mxEventObject(mxEvent.CELLS_MOVED,"cells",e,"dx",t,"dy",t,"disconnect",a))}finally{this.model.endUpdate()}}},mxGraph.prototype.translateCell=function(e,n,t){var a=this.model.getGeometry(e);null!=a&&((a=a.clone()).translate(n,t),!a.relative&&this.model.isVertex(e)&&!this.isAllowNegativeCoordinates()&&(a.x=Math.max(0,a.x),a.y=Math.max(0,a.y)),a.relative&&!this.model.isEdge(e)&&(null==a.offset?a.offset=new mxPoint(n,t):(a.offset.x+=n,a.offset.y+=t)),this.model.setGeometry(e,a))},mxGraph.prototype.getCellContainmentArea=function(e){if(null!=e&&!this.model.isEdge(e)){var n=this.model.getParent(e);if(n==this.getDefaultParent()||n==this.getCurrentRoot())return this.getMaximumGraphBounds();if(null!=n&&n!=this.getDefaultParent())if(null!=(i=this.model.getGeometry(n))){var t=e=0,a=i.width,i=i.height;return this.isSwimlane(n)&&(e=(n=this.getStartSize(n)).width,a-=n.width,t=n.height,i-=n.height),new mxRectangle(e,t,a,i)}}return null},mxGraph.prototype.getMaximumGraphBounds=function(){return this.maximumGraphBounds},mxGraph.prototype.constrainChild=function(e){if(null!=e){var n=this.model.getGeometry(e),t=this.isConstrainChild(e)?this.getCellContainmentArea(e):this.getMaximumGraphBounds();null!=n&&null!=t&&!n.relative&&(n.x<t.x||n.y<t.y||t.width<n.x+n.width||t.height<n.y+n.height)&&(e=this.getOverlap(e),0<t.width&&(n.x=Math.min(n.x,t.x+t.width-(1-e)*n.width)),0<t.height&&(n.y=Math.min(n.y,t.y+t.height-(1-e)*n.height)),n.x=Math.max(n.x,t.x-n.width*e),n.y=Math.max(n.y,t.y-n.height*e))}},mxGraph.prototype.resetEdges=function(e){if(null!=e){for(var n={},t=0;t<e.length;t++){var a=mxCellPath.create(e[t]);n[a]=e[t]}this.model.beginUpdate();try{for(t=0;t<e.length;t++){var i=this.model.getEdges(e[t]);if(null!=i)for(a=0;a<i.length;a++){var s=this.view.getState(i[a]),o=null!=s?s.getVisibleTerminal(!0):this.view.getVisibleTerminal(i[a],!0),r=null!=s?s.getVisibleTerminal(!1):this.view.getVisibleTerminal(i[a],!1),l=mxCellPath.create(o),d=mxCellPath.create(r);(null==n[l]||null==n[d])&&this.resetEdge(i[a])}this.resetEdges(this.model.getChildren(e[t]))}}finally{this.model.endUpdate()}}},mxGraph.prototype.resetEdge=function(e){var n=this.model.getGeometry(e);return null!=n&&null!=n.points&&0<n.points.length&&((n=n.clone()).points=[],this.model.setGeometry(e,n)),e},mxGraph.prototype.getAllConnectionConstraints=function(e,n){return null!=e&&null!=e.shape&&null!=e.shape.stencil?e.shape.stencil.constraints:null},mxGraph.prototype.getConnectionConstraint=function(e,n,t){n=null;var a=e.style[t?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X];if(null!=a){var i=e.style[t?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y];null!=i&&(n=new mxPoint(parseFloat(a),parseFloat(i)))}return a=!1,null!=n&&(a=mxUtils.getValue(e.style,t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,!0)),new mxConnectionConstraint(n,a)},mxGraph.prototype.setConnectionConstraint=function(e,n,t,a){if(null!=a){this.model.beginUpdate();try{null==a||null==a.point?(this.setCellStyles(t?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X,null,[e]),this.setCellStyles(t?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y,null,[e]),this.setCellStyles(t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,null,[e])):null!=a.point&&(this.setCellStyles(t?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X,a.point.x,[e]),this.setCellStyles(t?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y,a.point.y,[e]),a.perimeter?this.setCellStyles(t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,null,[e]):this.setCellStyles(t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,"0",[e]))}finally{this.model.endUpdate()}}},mxGraph.prototype.getConnectionPoint=function(e,n){var t=null;if(null!=e){var a=this.view.getPerimeterBounds(e),i=new mxPoint(a.getCenterX(),a.getCenterY()),s=e.style[mxConstants.STYLE_DIRECTION],o=0;if(null!=s&&("north"==s?o+=270:"west"==s?o+=180:"south"==s&&(o+=90),"north"==s||"south"==s)){a.x+=a.width/2-a.height/2,a.y+=a.height/2-a.width/2;var r=a.width;a.width=a.height,a.height=r}if(null!=n.point){var l=t=1,d=0,c=0;if(this.getModel().isVertex(e.cell)){var m=e.style[mxConstants.STYLE_FLIPH],u=e.style[mxConstants.STYLE_FLIPV];null!=e.shape.stencil&&(m=1==mxUtils.getValue(e.style,"stencilFlipH",0)||m,u=1==mxUtils.getValue(e.style,"stencilFlipV",0)||u),"north"!=s&&"south"!=s||(r=m,m=u,u=r),m&&(t=-1,d=-a.width),u&&(l=-1,c=-a.height)}t=new mxPoint(a.x+n.point.x*a.width*t-d,a.y+n.point.y*a.height*l-c)}s=e.style[mxConstants.STYLE_ROTATION]||0,n.perimeter?(0!=o&&null!=t&&(r=a=0,90==o?r=1:180==o?a=-1:270==s&&(r=-1),t=mxUtils.getRotatedPoint(t,a,r,i)),null!=t&&n.perimeter&&(t=this.view.getPerimeterPoint(e,t,!1))):s+=o,0!=s&&null!=t&&(o=mxUtils.toRadians(s),a=Math.cos(o),r=Math.sin(o),t=mxUtils.getRotatedPoint(t,a,r,i))}return t},mxGraph.prototype.connectCell=function(e,n,t,a){this.model.beginUpdate();try{var i=this.model.getTerminal(e,t);this.cellConnected(e,n,t,a),this.fireEvent(new mxEventObject(mxEvent.CONNECT_CELL,"edge",e,"terminal",n,"source",t,"previous",i))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellConnected=function(e,n,t,a){if(null!=e){this.model.beginUpdate();try{var i=this.model.getTerminal(e,t);this.setConnectionConstraint(e,n,t,a),this.isPortsEnabled()&&(a=null,this.isPort(n)&&(a=n.getId(),n=this.getTerminalForPort(n,t)),this.setCellStyles(t?mxConstants.STYLE_SOURCE_PORT:mxConstants.STYLE_TARGET_PORT,a,[e])),this.model.setTerminal(e,n,t),this.resetEdgesOnConnect&&this.resetEdge(e),this.fireEvent(new mxEventObject(mxEvent.CELL_CONNECTED,"edge",e,"terminal",n,"source",t,"previous",i))}finally{this.model.endUpdate()}}},mxGraph.prototype.disconnectGraph=function(e){if(null!=e){this.model.beginUpdate();try{for(var n=this.view.scale,t=this.view.translate,a={},i=0;i<e.length;i++){a[mxCellPath.create(e[i])]=e[i]}for(i=0;i<e.length;i++)if(this.model.isEdge(e[i])){if(null!=(r=this.model.getGeometry(e[i]))){var s=this.view.getState(e[i]),o=this.view.getState(this.model.getParent(e[i]));if(null!=s&&null!=o){var r=r.clone(),l=-o.origin.x,d=-o.origin.y,c=s.absolutePoints,m=this.model.getTerminal(e[i],!0);if(null!=m&&this.isCellDisconnectable(e[i],m,!0)){for(var u=mxCellPath.create(m);null!=m&&null==a[u];)m=this.model.getParent(m),u=mxCellPath.create(m);null==m&&(r.setTerminalPoint(new mxPoint(c[0].x/n-t.x+l,c[0].y/n-t.y+d),!0),this.model.setTerminal(e[i],null,!0))}var p=this.model.getTerminal(e[i],!1);if(null!=p&&this.isCellDisconnectable(e[i],p,!1)){for(var g=mxCellPath.create(p);null!=p&&null==a[g];)p=this.model.getParent(p),g=mxCellPath.create(p);if(null==p){var v=c.length-1;r.setTerminalPoint(new mxPoint(c[v].x/n-t.x+l,c[v].y/n-t.y+d),!1),this.model.setTerminal(e[i],null,!1)}}this.model.setGeometry(e[i],r)}}}}finally{this.model.endUpdate()}}},mxGraph.prototype.getCurrentRoot=function(){return this.view.currentRoot},mxGraph.prototype.getTranslateForRoot=function(e){return null},mxGraph.prototype.isPort=function(e){return!1},mxGraph.prototype.getTerminalForPort=function(e,n){return this.model.getParent(e)},mxGraph.prototype.getChildOffsetForCell=function(e){return null},mxGraph.prototype.enterGroup=function(e){null!=(e=e||this.getSelectionCell())&&this.isValidRoot(e)&&(this.view.setCurrentRoot(e),this.clearSelection())},mxGraph.prototype.exitGroup=function(){var e=this.model.getRoot(),n=this.getCurrentRoot();if(null!=n){for(var t=this.model.getParent(n);t!=e&&!this.isValidRoot(t)&&this.model.getParent(t)!=e;)t=this.model.getParent(t);t==e||this.model.getParent(t)==e?this.view.setCurrentRoot(null):this.view.setCurrentRoot(t),null!=this.view.getState(n)&&this.setSelectionCell(n)}},mxGraph.prototype.home=function(){var e=this.getCurrentRoot();null!=e&&(this.view.setCurrentRoot(null),null!=this.view.getState(e)&&this.setSelectionCell(e))},mxGraph.prototype.isValidRoot=function(e){return null!=e},mxGraph.prototype.getGraphBounds=function(){return this.view.getGraphBounds()},mxGraph.prototype.getCellBounds=function(e,n,t){var a=[e];if(n&&(a=a.concat(this.model.getEdges(e))),a=this.view.getBounds(a),t){t=this.model.getChildCount(e);for(var i=0;i<t;i++){var s=this.getCellBounds(this.model.getChildAt(e,i),n,!0);null!=a?a.add(s):a=s}}return a},mxGraph.prototype.getBoundingBoxFromGeometry=function(e,n){n=null!=n&&n;var t=null;if(null!=e)for(var a=0;a<e.length;a++)if(n||this.model.isVertex(e[a])){var i=this.getCellGeometry(e[a]);if(null!=i){var s=i.points;if(null!=s&&0<s.length){for(var o=new mxRectangle(s[0].x,s[0].y,0,0),r=function(e){null!=e&&o.add(new mxRectangle(e.x,e.y,0,0))},l=1;l<s.length;l++)r(s[l]);r(i.getTerminalPoint(!0)),r(i.getTerminalPoint(!1))}null==t?t=new mxRectangle(i.x,i.y,i.width,i.height):t.add(i)}}return t},mxGraph.prototype.refresh=function(e){this.view.clear(e,null==e),this.view.validate(),this.sizeDidChange(),this.fireEvent(new mxEventObject(mxEvent.REFRESH))},mxGraph.prototype.snap=function(e){return this.gridEnabled&&(e=Math.round(e/this.gridSize)*this.gridSize),e},mxGraph.prototype.panGraph=function(e,n){if(this.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.container))this.container.scrollLeft=-e,this.container.scrollTop=-n;else{var t=this.view.getCanvas();if(this.dialect==mxConstants.DIALECT_SVG)if(0==e&&0==n){if(mxClient.IS_IE?t.setAttribute("transform","translate("+e+","+n+")"):t.removeAttribute("transform"),null!=this.shiftPreview1){for(var a=this.shiftPreview1.firstChild;null!=a;){var i=a.nextSibling;this.container.appendChild(a),a=i}for(this.shiftPreview1.parentNode.removeChild(this.shiftPreview1),this.shiftPreview1=null,this.container.appendChild(t.parentNode),a=this.shiftPreview2.firstChild;null!=a;)i=a.nextSibling,this.container.appendChild(a),a=i;this.shiftPreview2.parentNode.removeChild(this.shiftPreview2),this.shiftPreview2=null}}else{if(t.setAttribute("transform","translate("+e+","+n+")"),null==this.shiftPreview1){this.shiftPreview1=document.createElement("div"),this.shiftPreview1.style.position="absolute",this.shiftPreview1.style.overflow="visible",this.shiftPreview2=document.createElement("div"),this.shiftPreview2.style.position="absolute",this.shiftPreview2.style.overflow="visible";var s=this.shiftPreview1;for(a=this.container.firstChild;null!=a;)i=a.nextSibling,a!=t.parentNode?s.appendChild(a):s=this.shiftPreview2,a=i;this.container.insertBefore(this.shiftPreview1,t.parentNode),this.container.appendChild(this.shiftPreview2)}this.shiftPreview1.style.left=e+"px",this.shiftPreview1.style.top=n+"px",this.shiftPreview2.style.left=e+"px",this.shiftPreview2.style.top=n+"px"}else t.style.left=e+"px",t.style.top=n+"px";this.panDx=e,this.panDy=n,this.fireEvent(new mxEventObject(mxEvent.PAN))}},mxGraph.prototype.zoomIn=function(){this.zoom(this.zoomFactor)},mxGraph.prototype.zoomOut=function(){this.zoom(1/this.zoomFactor)},mxGraph.prototype.zoomActual=function(){1==this.view.scale?this.view.setTranslate(0,0):(this.view.translate.x=0,this.view.translate.y=0,this.view.setScale(1))},mxGraph.prototype.zoomTo=function(e,n){this.zoom(e/this.view.scale,n)},mxGraph.prototype.zoom=function(e,n){n=null!=n?n:this.centerZoom;var t=this.view.scale*e,a=this.view.getState(this.getSelectionCell());if(this.keepSelectionVisibleOnZoom&&null!=a)a=new mxRectangle(a.x*e,a.y*e,a.width*e,a.height*e),this.view.scale=t,this.scrollRectToVisible(a)||(this.view.revalidate(),this.view.setScale(t));else if(n&&!mxUtils.hasScrollbars(this.container)){a=this.container.offsetWidth;var i=this.container.offsetHeight;if(1<e){var s=(e-1)/(2*t);a=a*-s,i=i*-s}else a*=s=(1/e-1)/(2*this.view.scale),i*=s;this.view.scaleAndTranslate(t,this.view.translate.x+a,this.view.translate.y+i)}else this.view.setScale(t),mxUtils.hasScrollbars(this.container)&&(i=a=0,n&&(a=this.container.offsetWidth*(e-1)/2,i=this.container.offsetHeight*(e-1)/2),this.container.scrollLeft=Math.round(this.container.scrollLeft*e+a),this.container.scrollTop=Math.round(this.container.scrollTop*e+i))},mxGraph.prototype.zoomToRect=function(e){var n=this.container.clientWidth/e.width/(this.container.clientHeight/e.height);e.x=Math.max(0,e.x),e.y=Math.max(0,e.y);var t=Math.min(this.container.scrollWidth,e.x+e.width),a=Math.min(this.container.scrollHeight,e.y+e.height);e.width=t-e.x,e.height=a-e.y,n<1?(t=((n=e.height/n)-e.height)/2,e.height=n,n=Math.min(e.y,t),e.y-=n,a=Math.min(this.container.scrollHeight,e.y+e.height),e.height=a-e.y):(t=((n*=e.width)-e.width)/2,e.width=n,n=Math.min(e.x,t),e.x-=n,t=Math.min(this.container.scrollWidth,e.x+e.width),e.width=t-e.x),n=this.container.clientWidth/e.width,t=this.view.scale*n,mxUtils.hasScrollbars(this.container)?(this.view.setScale(t),this.container.scrollLeft=Math.round(e.x*n),this.container.scrollTop=Math.round(e.y*n)):this.view.scaleAndTranslate(t,this.view.translate.x-e.x/this.view.scale,this.view.translate.y-e.y/this.view.scale)},mxGraph.prototype.fit=function(e,n){if(null!=this.container){e=null!=e?e:0,n=null!=n&&n;var t=this.container.clientWidth,a=this.container.clientHeight,i=this.view.getGraphBounds();n&&null!=i.x&&null!=i.y&&(i.width+=i.x,i.height+=i.y,i.x=0,i.y=0);var s=this.view.scale,o=i.width/s,r=i.height/s;null!=this.backgroundImage&&(o=Math.max(o,this.backgroundImage.width-i.x/s),r=Math.max(r,this.backgroundImage.height-i.y/s));var l=n?e:2*e;t=Math.floor(100*Math.min(t/(o+l),a/(r+l)))/100;null!=this.minFitScale&&(t=Math.max(t,this.minFitScale)),null!=this.maxFitScale&&(t=Math.min(t,this.maxFitScale)),n?this.view.scale!=t&&this.view.setScale(t):mxUtils.hasScrollbars(this.container)?(this.view.setScale(t),null!=i.x&&(this.container.scrollLeft=Math.round(i.x/s)*t-e-Math.max(0,(this.container.clientWidth-o*t)/2)),null!=i.y&&(this.container.scrollTop=Math.round(i.y/s)*t-e-Math.max(0,(this.container.clientHeight-r*t)/2))):this.view.scaleAndTranslate(t,null!=i.x?Math.floor(this.view.translate.x-i.x/s+e+1):e,null!=i.y?Math.floor(this.view.translate.y-i.y/s+e+1):e)}return this.view.scale},mxGraph.prototype.scrollCellToVisible=function(e,n){var t=-this.view.translate.x,a=-this.view.translate.y,i=this.view.getState(e);null!=i&&(t=new mxRectangle(t+i.x,a+i.y,i.width,i.height),n&&null!=this.container&&(a=this.container.clientWidth,i=this.container.clientHeight,t.x=t.getCenterX()-a/2,t.width=a,t.y=t.getCenterY()-i/2,t.height=i),this.scrollRectToVisible(t)&&this.view.setTranslate(this.view.translate.x,this.view.translate.y))},mxGraph.prototype.scrollRectToVisible=function(e){var n=!1;if(null!=e){var t=this.container.offsetWidth,a=this.container.offsetHeight,i=Math.min(t,e.width),s=Math.min(a,e.height);if(mxUtils.hasScrollbars(this.container)){t=this.container,e.x+=this.view.translate.x,e.y+=this.view.translate.y;var o=t.scrollLeft-e.x;a=Math.max(o-t.scrollLeft,0);0<o?t.scrollLeft-=o+2:0<(o=e.x+i-t.scrollLeft-t.clientWidth)&&(t.scrollLeft+=o+2),i=t.scrollTop-e.y,o=Math.max(0,i-t.scrollTop),0<i?t.scrollTop-=i+2:0<(i=e.y+s-t.scrollTop-t.clientHeight)&&(t.scrollTop+=i+2),!this.useScrollbarsForPanning&&(0!=a||0!=o)&&this.view.setTranslate(a,o)}else{o=-this.view.translate.x;var r=-this.view.translate.y,l=this.view.scale;e.x+i>o+t&&(this.view.translate.x-=(e.x+i-t-o)/l,n=!0),e.y+s>r+a&&(this.view.translate.y-=(e.y+s-a-r)/l,n=!0),e.x<o&&(this.view.translate.x+=(o-e.x)/l,n=!0),e.y<r&&(this.view.translate.y+=(r-e.y)/l,n=!0),n&&(this.view.refresh(),null!=this.selectionCellsHandler&&this.selectionCellsHandler.refresh())}}return n},mxGraph.prototype.getCellGeometry=function(e){return this.model.getGeometry(e)},mxGraph.prototype.isCellVisible=function(e){return this.model.isVisible(e)},mxGraph.prototype.isCellCollapsed=function(e){return this.model.isCollapsed(e)},mxGraph.prototype.isCellConnectable=function(e){return this.model.isConnectable(e)},mxGraph.prototype.isOrthogonal=function(e){var n=e.style[mxConstants.STYLE_ORTHOGONAL];return null!=n?n:(e=this.view.getEdgeStyle(e))==mxEdgeStyle.SegmentConnector||e==mxEdgeStyle.ElbowConnector||e==mxEdgeStyle.SideToSide||e==mxEdgeStyle.TopToBottom||e==mxEdgeStyle.EntityRelation||e==mxEdgeStyle.OrthConnector},mxGraph.prototype.isLoop=function(e){var n=e.getVisibleTerminalState(!0);return e=e.getVisibleTerminalState(!1),null!=n&&n==e},mxGraph.prototype.isCloneEvent=function(e){return mxEvent.isControlDown(e)},mxGraph.prototype.isToggleEvent=function(e){return mxClient.IS_MAC?mxEvent.isMetaDown(e):mxEvent.isControlDown(e)},mxGraph.prototype.isGridEnabledEvent=function(e){return null!=e&&!mxEvent.isAltDown(e)},mxGraph.prototype.isConstrainedEvent=function(e){return mxEvent.isShiftDown(e)},mxGraph.prototype.isForceMarqueeEvent=function(e){return mxEvent.isAltDown(e)},mxGraph.prototype.validationAlert=function(e){mxUtils.alert(e)},mxGraph.prototype.isEdgeValid=function(e,n,t){return null==this.getEdgeValidationError(e,n,t)},mxGraph.prototype.getEdgeValidationError=function(e,n,t){if(null!=e&&!this.isAllowDanglingEdges()&&(null==n||null==t))return"";if(null!=e&&null==this.model.getTerminal(e,!0)&&null==this.model.getTerminal(e,!1))return null;if(!this.allowLoops&&n==t&&null!=n||!this.isValidConnection(n,t))return"";if(null==n||null==t)return this.allowDanglingEdges?null:"";var a="";this.multigraph||(1<(i=this.model.getEdgesBetween(n,t,!0)).length||1==i.length&&i[0]!=e)&&(a+=(mxResources.get(this.alreadyConnectedResource)||this.alreadyConnectedResource)+"\n");var i=this.model.getDirectedEdgeCount(n,!0,e),s=this.model.getDirectedEdgeCount(t,!1,e);if(null!=this.multiplicities)for(var o=0;o<this.multiplicities.length;o++){var r=this.multiplicities[o].check(this,e,n,t,i,s);null!=r&&(a+=r)}return null!=(r=this.validateEdge(e,n,t))&&(a+=r),0<a.length?a:null},mxGraph.prototype.validateEdge=function(e,n,t){return null},mxGraph.prototype.validateGraph=function(e,n){e=null!=e?e:this.model.getRoot(),n=null!=n?n:{};for(var t=!0,a=this.model.getChildCount(e),i=0;i<a;i++){var s=this.model.getChildAt(e,i),o=n;this.isValidRoot(s)&&(o={}),null!=(o=this.validateGraph(s,o))?this.setCellWarning(s,o.replace(/\n/g,"<br>")):this.setCellWarning(s,null),t=t&&null==o}return a="",this.isCellCollapsed(e)&&!t&&(a+=(mxResources.get(this.containsValidationErrorsResource)||this.containsValidationErrorsResource)+"\n"),a=this.model.isEdge(e)?a+(this.getEdgeValidationError(e,this.model.getTerminal(e,!0),this.model.getTerminal(e,!1))||""):a+(this.getCellValidationError(e)||""),null!=(i=this.validateCell(e,n))&&(a+=i),null==this.model.getParent(e)&&this.view.validate(),0<a.length||!t?a:null},mxGraph.prototype.getCellValidationError=function(e){var n=this.model.getDirectedEdgeCount(e,!0),t=this.model.getDirectedEdgeCount(e,!1);e=this.model.getValue(e);var a="";if(null!=this.multiplicities)for(var i=0;i<this.multiplicities.length;i++){var s=this.multiplicities[i];s.source&&mxUtils.isNode(e,s.type,s.attr,s.value)&&(0==s.max&&0<n||1==s.min&&0==n||1==s.max&&1<n)?a+=s.countError+"\n":!s.source&&mxUtils.isNode(e,s.type,s.attr,s.value)&&(0==s.max&&0<t||1==s.min&&0==t||1==s.max&&1<t)&&(a+=s.countError+"\n")}return 0<a.length?a:null},mxGraph.prototype.validateCell=function(e,n){return null},mxGraph.prototype.getBackgroundImage=function(){return this.backgroundImage},mxGraph.prototype.setBackgroundImage=function(e){this.backgroundImage=e},mxGraph.prototype.getFoldingImage=function(e){if(null!=e&&this.foldingEnabled&&!this.getModel().isEdge(e.cell)){var n=this.isCellCollapsed(e.cell);if(this.isCellFoldable(e.cell,!n))return n?this.collapsedImage:this.expandedImage}return null},mxGraph.prototype.convertValueToString=function(e){if(null!=(e=this.model.getValue(e))){if(mxUtils.isNode(e))return e.nodeName;if("function"==typeof e.toString)return e.toString()}return""},mxGraph.prototype.getLabel=function(e){var n="";if(this.labelsVisible&&null!=e){var t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);mxUtils.getValue(t,mxConstants.STYLE_NOLABEL,!1)||(n=this.convertValueToString(e))}return n},mxGraph.prototype.isHtmlLabel=function(e){return this.isHtmlLabels()},mxGraph.prototype.isHtmlLabels=function(){return this.htmlLabels},mxGraph.prototype.setHtmlLabels=function(e){this.htmlLabels=e},mxGraph.prototype.isWrapping=function(e){var n=this.view.getState(e);return null!=(e=null!=n?n.style:this.getCellStyle(e))&&"wrap"==e[mxConstants.STYLE_WHITE_SPACE]},mxGraph.prototype.isLabelClipped=function(e){var n=this.view.getState(e);return null!=(e=null!=n?n.style:this.getCellStyle(e))&&"hidden"==e[mxConstants.STYLE_OVERFLOW]},mxGraph.prototype.getTooltip=function(e,t,n,a){var i=null;return null!=e&&(null==e.control||t!=e.control.node&&t.parentNode!=e.control.node||(i=this.collapseExpandResource,i=mxResources.get(i)||i),null==i&&null!=e.overlays&&e.overlays.visit(function(e,n){null!=i||t!=n.node&&t.parentNode!=n.node||(i=n.overlay.toString())}),null==i&&(null!=(n=this.selectionCellsHandler.getHandler(e.cell))&&"function"==typeof n.getTooltipForNode&&(i=n.getTooltipForNode(t))),null==i&&(i=this.getTooltipForCell(e.cell))),i},mxGraph.prototype.getTooltipForCell=function(e){return null!=e&&null!=e.getTooltip?e.getTooltip():this.convertValueToString(e)},mxGraph.prototype.getCursorForCell=function(e){return null},mxGraph.prototype.getStartSize=function(e){var n=new mxRectangle,t=this.view.getState(e);return null!=(e=null!=t?t.style:this.getCellStyle(e))&&(t=parseInt(mxUtils.getValue(e,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)),mxUtils.getValue(e,mxConstants.STYLE_HORIZONTAL,!0)?n.height=t:n.width=t),n},mxGraph.prototype.getImage=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_IMAGE]:null},mxGraph.prototype.getVerticalAlign=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_VERTICAL_ALIGN]||mxConstants.ALIGN_MIDDLE:null},mxGraph.prototype.getIndicatorColor=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_COLOR]:null},mxGraph.prototype.getIndicatorGradientColor=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_GRADIENTCOLOR]:null},mxGraph.prototype.getIndicatorShape=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_SHAPE]:null},mxGraph.prototype.getIndicatorImage=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_IMAGE]:null},mxGraph.prototype.getBorder=function(){return this.border},mxGraph.prototype.setBorder=function(e){this.border=e},mxGraph.prototype.isSwimlane=function(e){var n;if(null!=e&&this.model.getParent(e)!=this.model.getRoot()&&(null!=(n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e))&&!this.model.isEdge(e)))return n[mxConstants.STYLE_SHAPE]==mxConstants.SHAPE_SWIMLANE;return!1},mxGraph.prototype.isResizeContainer=function(){return this.resizeContainer},mxGraph.prototype.setResizeContainer=function(e){this.resizeContainer=e},mxGraph.prototype.isEnabled=function(){return this.enabled},mxGraph.prototype.setEnabled=function(e){this.enabled=e},mxGraph.prototype.isEscapeEnabled=function(){return this.escapeEnabled},mxGraph.prototype.setEscapeEnabled=function(e){this.escapeEnabled=e},mxGraph.prototype.isInvokesStopCellEditing=function(){return this.invokesStopCellEditing},mxGraph.prototype.setInvokesStopCellEditing=function(e){this.invokesStopCellEditing=e},mxGraph.prototype.isEnterStopsCellEditing=function(){return this.enterStopsCellEditing},mxGraph.prototype.setEnterStopsCellEditing=function(e){this.enterStopsCellEditing=e},mxGraph.prototype.isCellLocked=function(e){var n=this.model.getGeometry(e);return this.isCellsLocked()||null!=n&&this.model.isVertex(e)&&n.relative},mxGraph.prototype.isCellsLocked=function(){return this.cellsLocked},mxGraph.prototype.setCellsLocked=function(e){this.cellsLocked=e},mxGraph.prototype.getCloneableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellCloneable(e)}))},mxGraph.prototype.isCellCloneable=function(e){var n=this.view.getState(e);return e=null!=n?n.style:this.getCellStyle(e),this.isCellsCloneable()&&0!=e[mxConstants.STYLE_CLONEABLE]},mxGraph.prototype.isCellsCloneable=function(){return this.cellsCloneable},mxGraph.prototype.setCellsCloneable=function(e){this.cellsCloneable=e},mxGraph.prototype.getExportableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.canExportCell(e)}))},mxGraph.prototype.canExportCell=function(e){return this.exportEnabled},mxGraph.prototype.getImportableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.canImportCell(e)}))},mxGraph.prototype.canImportCell=function(e){return this.importEnabled},mxGraph.prototype.isCellSelectable=function(e){return this.isCellsSelectable()},mxGraph.prototype.isCellsSelectable=function(){return this.cellsSelectable},mxGraph.prototype.setCellsSelectable=function(e){this.cellsSelectable=e},mxGraph.prototype.getDeletableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellDeletable(e)}))},mxGraph.prototype.isCellDeletable=function(e){var n=this.view.getState(e);return e=null!=n?n.style:this.getCellStyle(e),this.isCellsDeletable()&&0!=e[mxConstants.STYLE_DELETABLE]},mxGraph.prototype.isCellsDeletable=function(){return this.cellsDeletable},mxGraph.prototype.setCellsDeletable=function(e){this.cellsDeletable=e},mxGraph.prototype.isLabelMovable=function(e){return!this.isCellLocked(e)&&(this.model.isEdge(e)&&this.edgeLabelsMovable||this.model.isVertex(e)&&this.vertexLabelsMovable)},mxGraph.prototype.getMovableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellMovable(e)}))},mxGraph.prototype.isCellMovable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsMovable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_MOVABLE]},mxGraph.prototype.isCellsMovable=function(){return this.cellsMovable},mxGraph.prototype.setCellsMovable=function(e){this.cellsMovable=e},mxGraph.prototype.isGridEnabled=function(){return this.gridEnabled},mxGraph.prototype.setGridEnabled=function(e){this.gridEnabled=e},mxGraph.prototype.isPortsEnabled=function(){return this.portsEnabled},mxGraph.prototype.setPortsEnabled=function(e){this.portsEnabled=e},mxGraph.prototype.getGridSize=function(){return this.gridSize},mxGraph.prototype.setGridSize=function(e){this.gridSize=e},mxGraph.prototype.getTolerance=function(){return this.tolerance},mxGraph.prototype.setTolerance=function(e){this.tolerance=e},mxGraph.prototype.isVertexLabelsMovable=function(){return this.vertexLabelsMovable},mxGraph.prototype.setVertexLabelsMovable=function(e){this.vertexLabelsMovable=e},mxGraph.prototype.isEdgeLabelsMovable=function(){return this.edgeLabelsMovable},mxGraph.prototype.setEdgeLabelsMovable=function(e){this.edgeLabelsMovable=e},mxGraph.prototype.isSwimlaneNesting=function(){return this.swimlaneNesting},mxGraph.prototype.setSwimlaneNesting=function(e){this.swimlaneNesting=e},mxGraph.prototype.isSwimlaneSelectionEnabled=function(){return this.swimlaneSelectionEnabled},mxGraph.prototype.setSwimlaneSelectionEnabled=function(e){this.swimlaneSelectionEnabled=e},mxGraph.prototype.isMultigraph=function(){return this.multigraph},mxGraph.prototype.setMultigraph=function(e){this.multigraph=e},mxGraph.prototype.isAllowLoops=function(){return this.allowLoops},mxGraph.prototype.setAllowDanglingEdges=function(e){this.allowDanglingEdges=e},mxGraph.prototype.isAllowDanglingEdges=function(){return this.allowDanglingEdges},mxGraph.prototype.setConnectableEdges=function(e){this.connectableEdges=e},mxGraph.prototype.isConnectableEdges=function(){return this.connectableEdges},mxGraph.prototype.setCloneInvalidEdges=function(e){this.cloneInvalidEdges=e},mxGraph.prototype.isCloneInvalidEdges=function(){return this.cloneInvalidEdges},mxGraph.prototype.setAllowLoops=function(e){this.allowLoops=e},mxGraph.prototype.isDisconnectOnMove=function(){return this.disconnectOnMove},mxGraph.prototype.setDisconnectOnMove=function(e){this.disconnectOnMove=e},mxGraph.prototype.isDropEnabled=function(){return this.dropEnabled},mxGraph.prototype.setDropEnabled=function(e){this.dropEnabled=e},mxGraph.prototype.isSplitEnabled=function(){return this.splitEnabled},mxGraph.prototype.setSplitEnabled=function(e){this.splitEnabled=e},mxGraph.prototype.isCellResizable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsResizable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_RESIZABLE]},mxGraph.prototype.isCellsResizable=function(){return this.cellsResizable},mxGraph.prototype.setCellsResizable=function(e){this.cellsResizable=e},mxGraph.prototype.isTerminalPointMovable=function(e,n){return!0},mxGraph.prototype.isCellBendable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsBendable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_BENDABLE]},mxGraph.prototype.isCellsBendable=function(){return this.cellsBendable},mxGraph.prototype.setCellsBendable=function(e){this.cellsBendable=e},mxGraph.prototype.isCellEditable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsEditable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_EDITABLE]},mxGraph.prototype.isCellsEditable=function(){return this.cellsEditable},mxGraph.prototype.setCellsEditable=function(e){this.cellsEditable=e},mxGraph.prototype.isCellDisconnectable=function(e,n,t){return this.isCellsDisconnectable()&&!this.isCellLocked(e)},mxGraph.prototype.isCellsDisconnectable=function(){return this.cellsDisconnectable},mxGraph.prototype.setCellsDisconnectable=function(e){this.cellsDisconnectable=e},mxGraph.prototype.isValidSource=function(e){return null==e&&this.allowDanglingEdges||null!=e&&(!this.model.isEdge(e)||this.connectableEdges)&&this.isCellConnectable(e)},mxGraph.prototype.isValidTarget=function(e){return this.isValidSource(e)},mxGraph.prototype.isValidConnection=function(e,n){return this.isValidSource(e)&&this.isValidTarget(n)},mxGraph.prototype.setConnectable=function(e){this.connectionHandler.setEnabled(e)},mxGraph.prototype.isConnectable=function(e){return this.connectionHandler.isEnabled()},mxGraph.prototype.setTooltips=function(e){this.tooltipHandler.setEnabled(e)},mxGraph.prototype.setPanning=function(e){this.panningHandler.panningEnabled=e},mxGraph.prototype.isEditing=function(e){if(null==this.cellEditor)return!1;var n=this.cellEditor.getEditingCell();return null==e?null!=n:e==n},mxGraph.prototype.isAutoSizeCell=function(e){var n=this.view.getState(e);return e=null!=n?n.style:this.getCellStyle(e),this.isAutoSizeCells()||1==e[mxConstants.STYLE_AUTOSIZE]},mxGraph.prototype.isAutoSizeCells=function(){return this.autoSizeCells},mxGraph.prototype.setAutoSizeCells=function(e){this.autoSizeCells=e},mxGraph.prototype.isExtendParent=function(e){return!this.getModel().isEdge(e)&&this.isExtendParents()},mxGraph.prototype.isExtendParents=function(){return this.extendParents},mxGraph.prototype.setExtendParents=function(e){this.extendParents=e},mxGraph.prototype.isExtendParentsOnAdd=function(){return this.extendParentsOnAdd},mxGraph.prototype.setExtendParentsOnAdd=function(e){this.extendParentsOnAdd=e},mxGraph.prototype.isConstrainChild=function(e){return this.isConstrainChildren()&&!this.getModel().isEdge(this.getModel().getParent(e))},mxGraph.prototype.isConstrainChildren=function(){return this.constrainChildren},mxGraph.prototype.setConstrainChildren=function(e){this.constrainChildren=e},mxGraph.prototype.isAllowNegativeCoordinates=function(){return this.allowNegativeCoordinates},mxGraph.prototype.setAllowNegativeCoordinates=function(e){this.allowNegativeCoordinates=e},mxGraph.prototype.getOverlap=function(e){return this.isAllowOverlapParent(e)?this.defaultOverlap:0},mxGraph.prototype.isAllowOverlapParent=function(e){return!1},mxGraph.prototype.getFoldableCells=function(e,n){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellFoldable(e,n)}))},mxGraph.prototype.isCellFoldable=function(e,n){var t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);return 0<this.model.getChildCount(e)&&0!=t[mxConstants.STYLE_FOLDABLE]},mxGraph.prototype.isValidDropTarget=function(e,n,t){return null!=e&&(this.isSplitEnabled()&&this.isSplitTarget(e,n,t)||!this.model.isEdge(e)&&(this.isSwimlane(e)||0<this.model.getChildCount(e)&&!this.isCellCollapsed(e)))},mxGraph.prototype.isSplitTarget=function(e,n,t){return!(!this.model.isEdge(e)||null==n||1!=n.length||!this.isCellConnectable(n[0])||null!=this.getEdgeValidationError(e,this.model.getTerminal(e,!0),n[0]))&&(t=this.model.getTerminal(e,!0),e=this.model.getTerminal(e,!1),!this.model.isAncestor(n[0],t)&&!this.model.isAncestor(n[0],e))},mxGraph.prototype.getDropTarget=function(e,n,t){if(!this.isSwimlaneNesting())for(var a=0;a<e.length;a++)if(this.isSwimlane(e[a]))return null;if((a=mxUtils.convertPoint(this.container,mxEvent.getClientX(n),mxEvent.getClientY(n))).x-=this.panDx,a.y-=this.panDy,a=this.getSwimlaneAt(a.x,a.y),null==t)t=a;else if(null!=a){for(var i=this.model.getParent(a);null!=i&&this.isSwimlane(i)&&i!=t;)i=this.model.getParent(i);i==t&&(t=a)}for(;null!=t&&!this.isValidDropTarget(t,e,n)&&!this.model.isLayer(t);)t=this.model.getParent(t);return!this.model.isLayer(t)&&mxUtils.indexOf(e,t)<0?t:null},mxGraph.prototype.getDefaultParent=function(){var e=this.defaultParent;return null==e&&(null==(e=this.getCurrentRoot())&&(e=this.model.getRoot(),e=this.model.getChildAt(e,0))),e},mxGraph.prototype.setDefaultParent=function(e){this.defaultParent=e},mxGraph.prototype.getSwimlane=function(e){for(;null!=e&&!this.isSwimlane(e);)e=this.model.getParent(e);return e},mxGraph.prototype.getSwimlaneAt=function(e,n,t){if(null!=(t=t||this.getDefaultParent()))for(var a=this.model.getChildCount(t),i=0;i<a;i++){var s=this.model.getChildAt(t,i),o=this.getSwimlaneAt(e,n,s);if(null!=o)return o;if(this.isSwimlane(s)&&(o=this.view.getState(s),this.intersects(o,e,n)))return s}return null},mxGraph.prototype.getCellAt=function(e,n,t,a,i){if(a=null==a||a,i=null==i||i,null!=(t=null!=t?t:this.getDefaultParent()))for(var s=this.model.getChildCount(t)-1;0<=s;s--){var o=this.model.getChildAt(t,s),r=this.getCellAt(e,n,o,a,i);if(null!=r)return r;if(this.isCellVisible(o)&&(i&&this.model.isEdge(o)||a&&this.model.isVertex(o))&&(r=this.view.getState(o),this.intersects(r,e,n)))return o}return null},mxGraph.prototype.intersects=function(e,n,t){if(null!=e){var a=e.absolutePoints;if(null!=a){e=this.tolerance*this.tolerance;for(var i=a[0],s=1;s<a.length;s++){var o=a[s];if(mxUtils.ptSegDistSq(i.x,i.y,o.x,o.y,n,t)<=e)return!0;i=o}}else if(0!=(i=mxUtils.toRadians(mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION)||0))&&(a=Math.cos(-i),i=Math.sin(-i),s=new mxPoint(e.getCenterX(),e.getCenterY()),n=(i=mxUtils.getRotatedPoint(new mxPoint(n,t),a,i,s)).x,t=i.y),mxUtils.contains(e,n,t))return!0}return!1},mxGraph.prototype.hitsSwimlaneContent=function(e,n,t){var a=this.getView().getState(e);if(e=this.getStartSize(e),null!=a){var i=this.getView().getScale();if(n-=a.x,t-=a.y,0<e.width&&0<n&&n>e.width*i||0<e.height&&0<t&&t>e.height*i)return!0}return!1},mxGraph.prototype.getChildVertices=function(e){return this.getChildCells(e,!0,!1)},mxGraph.prototype.getChildEdges=function(e){return this.getChildCells(e,!1,!0)},mxGraph.prototype.getChildCells=function(e,n,t){for(e=null!=e?e:this.getDefaultParent(),e=this.model.getChildCells(e,null!=n&&n,null!=t&&t),n=[],t=0;t<e.length;t++)this.isCellVisible(e[t])&&n.push(e[t]);return n},mxGraph.prototype.getConnections=function(e,n){return this.getEdges(e,n,!0,!0,!1)},mxGraph.prototype.getIncomingEdges=function(e,n){return this.getEdges(e,n,!0,!1,!1)},mxGraph.prototype.getOutgoingEdges=function(e,n){return this.getEdges(e,n,!1,!0,!1)},mxGraph.prototype.getEdges=function(e,n,t,a,i,s){t=null==t||t,a=null==a||a,i=null==i||i,s=null!=s&&s;for(var o=[],r=this.isCellCollapsed(e),l=this.model.getChildCount(e),d=0;d<l;d++){var c=this.model.getChildAt(e,d);!r&&this.isCellVisible(c)||(o=o.concat(this.model.getEdges(c,t,a)))}for(o=o.concat(this.model.getEdges(e,t,a)),r=[],d=0;d<o.length;d++)l=null!=(c=this.view.getState(o[d]))?c.getVisibleTerminal(!0):this.view.getVisibleTerminal(o[d],!0),c=null!=c?c.getVisibleTerminal(!1):this.view.getVisibleTerminal(o[d],!1),(i&&l==c||l!=c&&(t&&c==e&&(null==n||this.isValidAncestor(l,n,s))||a&&l==e&&(null==n||this.isValidAncestor(c,n,s))))&&r.push(o[d]);return r},mxGraph.prototype.isValidAncestor=function(e,n,t){return t?this.model.isAncestor(n,e):this.model.getParent(e)==n},mxGraph.prototype.getOpposites=function(e,n,t,a){t=null==t||t,a=null==a||a;var i=[],s={};if(null!=e)for(var o=0;o<e.length;o++){var r=null!=(l=this.view.getState(e[o]))?l.getVisibleTerminal(!0):this.view.getVisibleTerminal(e[o],!0),l=null!=l?l.getVisibleTerminal(!1):this.view.getVisibleTerminal(e[o],!1);if(r==n&&null!=l&&l!=n&&a){var d=mxCellPath.create(l);null==s[d]&&(s[d]=l,i.push(l))}else l==n&&null!=r&&r!=n&&t&&(null==s[d=mxCellPath.create(r)]&&(s[d]=r,i.push(r)))}return i},mxGraph.prototype.getEdgesBetween=function(e,n,t){t=null!=t&&t;for(var a=this.getEdges(e),i=[],s=0;s<a.length;s++){var o=null!=(r=this.view.getState(a[s]))?r.getVisibleTerminal(!0):this.view.getVisibleTerminal(a[s],!0),r=null!=r?r.getVisibleTerminal(!1):this.view.getVisibleTerminal(a[s],!1);(o==e&&r==n||!t&&o==n&&r==e)&&i.push(a[s])}return i},mxGraph.prototype.getPointForEvent=function(e,n){var t=mxUtils.convertPoint(this.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),a=this.view.scale,i=this.view.translate,s=0!=n?this.gridSize/2:0;return t.x=this.snap(t.x/a-i.x-s),t.y=this.snap(t.y/a-i.y-s),t},mxGraph.prototype.getCells=function(e,n,t,a,i,s){if(s=null!=s?s:[],0<t||0<a){var o=e+t,r=n+a;if(null!=(i=i||this.getDefaultParent()))for(var l=this.model.getChildCount(i),d=0;d<l;d++){var c=this.model.getChildAt(i,d),m=this.view.getState(c);if(this.isCellVisible(c)&&null!=m){var u=m;0!=(m=mxUtils.getValue(m.style,mxConstants.STYLE_ROTATION)||0)&&(u=mxUtils.getBoundingBox(u,m)),u.x>=e&&u.y+u.height<=r&&u.y>=n&&u.x+u.width<=o?s.push(c):this.getCells(e,n,t,a,c,s)}}}return s},mxGraph.prototype.getCellsBeyond=function(e,n,t,a,i){var s=[];if((a||i)&&(null==t&&(t=this.getDefaultParent()),null!=t))for(var o=this.model.getChildCount(t),r=0;r<o;r++){var l=this.model.getChildAt(t,r),d=this.view.getState(l);this.isCellVisible(l)&&null!=d&&(!a||d.x>=e)&&(!i||d.y>=n)&&s.push(l)}return s},mxGraph.prototype.findTreeRoots=function(e,n,t){n=null!=n&&n,t=null!=t&&t;var a=[];if(null!=e){for(var i=this.getModel(),s=i.getChildCount(e),o=null,r=0,l=0;l<s;l++){var d=i.getChildAt(e,l);if(this.model.isVertex(d)&&this.isCellVisible(d)){for(var c=this.getConnections(d,n?e:null),m=0,u=0,p=0;p<c.length;p++)this.view.getVisibleTerminal(c[p],!0)==d?m++:u++;(t&&0==m&&0<u||!t&&0==u&&0<m)&&a.push(d),r<(c=t?u-m:m-u)&&(r=c,o=d)}}0==a.length&&null!=o&&a.push(o)}return a},mxGraph.prototype.traverse=function(e,n,t,a,i){if(null!=t&&null!=e){n=null==n||n,i=i||[];var s=mxCellPath.create(e);if(null==i[s]&&(null==(a=t(i[s]=e,a))||a)&&0<(a=this.model.getEdgeCount(e)))for(s=0;s<a;s++){var o=this.model.getEdgeAt(e,s),r=this.model.getTerminal(o,!0)==e;n&&!r||(r=this.model.getTerminal(o,!r),this.traverse(r,n,t,o,i))}}},mxGraph.prototype.isCellSelected=function(e){return this.getSelectionModel().isSelected(e)},mxGraph.prototype.isSelectionEmpty=function(){return this.getSelectionModel().isEmpty()},mxGraph.prototype.clearSelection=function(){return this.getSelectionModel().clear()},mxGraph.prototype.getSelectionCount=function(){return this.getSelectionModel().cells.length},mxGraph.prototype.getSelectionCell=function(){return this.getSelectionModel().cells[0]},mxGraph.prototype.getSelectionCells=function(){return this.getSelectionModel().cells.slice()},mxGraph.prototype.setSelectionCell=function(e){this.getSelectionModel().setCell(e)},mxGraph.prototype.setSelectionCells=function(e){this.getSelectionModel().setCells(e)},mxGraph.prototype.addSelectionCell=function(e){this.getSelectionModel().addCell(e)},mxGraph.prototype.addSelectionCells=function(e){this.getSelectionModel().addCells(e)},mxGraph.prototype.removeSelectionCell=function(e){this.getSelectionModel().removeCell(e)},mxGraph.prototype.removeSelectionCells=function(e){this.getSelectionModel().removeCells(e)},mxGraph.prototype.selectRegion=function(e,n){var t=this.getCells(e.x,e.y,e.width,e.height);return this.selectCellsForEvent(t,n),t},mxGraph.prototype.selectNextCell=function(){this.selectCell(!0)},mxGraph.prototype.selectPreviousCell=function(){this.selectCell()},mxGraph.prototype.selectParentCell=function(){this.selectCell(!1,!0)},mxGraph.prototype.selectChildCell=function(){this.selectCell(!1,!1,!0)},mxGraph.prototype.selectCell=function(e,n,t){var a=0<(i=this.selectionModel).cells.length?i.cells[0]:null;1<i.cells.length&&i.clear();var i=null!=a?this.model.getParent(a):this.getDefaultParent(),s=this.model.getChildCount(i);null==a&&0<s?(e=this.model.getChildAt(i,0),this.setSelectionCell(e)):null!=a&&!n||null==this.view.getState(i)||null==this.model.getGeometry(i)?null!=a&&t?0<this.model.getChildCount(a)&&(e=this.model.getChildAt(a,0),this.setSelectionCell(e)):0<s&&(n=i.getIndex(a),e=e?(n++,this.model.getChildAt(i,n%s)):(n--,this.model.getChildAt(i,n<0?s-1:n)),this.setSelectionCell(e)):this.getCurrentRoot()!=i&&this.setSelectionCell(i)},mxGraph.prototype.selectAll=function(e){e=e||this.getDefaultParent(),null!=(e=this.model.getChildren(e))&&this.setSelectionCells(e)},mxGraph.prototype.selectVertices=function(e){this.selectCells(!0,!1,e)},mxGraph.prototype.selectEdges=function(e){this.selectCells(!1,!0,e)},mxGraph.prototype.selectCells=function(n,t,e){e=e||this.getDefaultParent();var a=mxUtils.bind(this,function(e){return null!=this.view.getState(e)&&0==this.model.getChildCount(e)&&(this.model.isVertex(e)&&n||this.model.isEdge(e)&&t)});e=this.model.filterDescendants(a,e),this.setSelectionCells(e)},mxGraph.prototype.selectCellForEvent=function(e,n){var t=this.isCellSelected(e);this.isToggleEvent(n)?t?this.removeSelectionCell(e):this.addSelectionCell(e):(!t||1!=this.getSelectionCount())&&this.setSelectionCell(e)},mxGraph.prototype.selectCellsForEvent=function(e,n){this.isToggleEvent(n)?this.addSelectionCells(e):this.setSelectionCells(e)},mxGraph.prototype.createHandler=function(e){var n=null;return null!=e&&(n=this.model.isEdge(e.cell)?(n=this.view.getEdgeStyle(e),this.isLoop(e)||n==mxEdgeStyle.ElbowConnector||n==mxEdgeStyle.SideToSide||n==mxEdgeStyle.TopToBottom?new mxElbowEdgeHandler(e):n==mxEdgeStyle.SegmentConnector||n==mxEdgeStyle.OrthConnector?new mxEdgeSegmentHandler(e):new mxEdgeHandler(e)):new mxVertexHandler(e)),n},mxGraph.prototype.addMouseListener=function(e){null==this.mouseListeners&&(this.mouseListeners=[]),this.mouseListeners.push(e)},mxGraph.prototype.removeMouseListener=function(e){if(null!=this.mouseListeners)for(var n=0;n<this.mouseListeners.length;n++)if(this.mouseListeners[n]==e){this.mouseListeners.splice(n,1);break}},mxGraph.prototype.updateMouseEvent=function(e){if(null==e.graphX||null==e.graphY){var n=mxUtils.convertPoint(this.container,e.getX(),e.getY());e.graphX=n.x-this.panDx,e.graphY=n.y-this.panDy}},mxGraph.prototype.fireMouseEvent=function(e,n,t){if(null==t&&(t=this),this.updateMouseEvent(n),e==mxEvent.MOUSE_DOWN&&(this.isMouseDown=!0),mxClient.IS_TOUCH&&this.doubleTapEnabled&&e==mxEvent.MOUSE_DOWN){var a=(new Date).getTime();a-this.lastTouchTime<this.doubleTapTimeout&&Math.abs(this.lastTouchX-n.getX())<this.doubleTapTolerance&&Math.abs(this.lastTouchY-n.getY())<this.doubleTapTolerance?(this.lastTouchTime=0,this.dblClick(n.getEvent(),n.getCell()),n.getEvent().cancelBubble=!0):(this.lastTouchX=n.getX(),this.lastTouchY=n.getY(),this.lastTouchTime=a)}if(a=2!=n.getEvent().detail,mxClient.IS_IE&&"CSS1Compat"==document.compatMode&&((null!=this.lastMouseX&&Math.abs(this.lastMouseX-n.getX())>this.doubleTapTolerance||null!=this.lastMouseY&&Math.abs(this.lastMouseY-n.getY())>this.doubleTapTolerance)&&(a=!0),e==mxEvent.MOUSE_UP&&(this.lastMouseX=n.getX(),this.lastMouseY=n.getY())),(e!=mxEvent.MOUSE_UP||this.isMouseDown)&&a){if(e==mxEvent.MOUSE_UP&&(this.isMouseDown=!1),!this.isEditing()&&(mxClient.IS_OP||mxClient.IS_SF||mxClient.IS_GC||mxClient.IS_IE&&mxClient.IS_SVG||n.getEvent().target!=this.container)){if(e==mxEvent.MOUSE_MOVE&&this.isMouseDown&&this.autoScroll&&this.scrollPointToVisible(n.getGraphX(),n.getGraphY(),this.autoExtend),null!=this.mouseListeners)for(t=[t,n],n.getEvent().returnValue=!0,a=0;a<this.mouseListeners.length;a++){var i=this.mouseListeners[a];e==mxEvent.MOUSE_DOWN?i.mouseDown.apply(i,t):e==mxEvent.MOUSE_MOVE?i.mouseMove.apply(i,t):e==mxEvent.MOUSE_UP&&i.mouseUp.apply(i,t)}e==mxEvent.MOUSE_UP&&this.click(n)}}else e==mxEvent.MOUSE_UP&&(this.isMouseDown=!1)},mxGraph.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,null!=this.tooltipHandler&&this.tooltipHandler.destroy(),null!=this.selectionCellsHandler&&this.selectionCellsHandler.destroy(),null!=this.panningHandler&&this.panningHandler.destroy(),null!=this.connectionHandler&&this.connectionHandler.destroy(),null!=this.graphHandler&&this.graphHandler.destroy(),null!=this.cellEditor&&this.cellEditor.destroy(),null!=this.view&&this.view.destroy(),null!=this.model&&null!=this.graphModelChangeListener&&(this.model.removeListener(this.graphModelChangeListener),this.graphModelChangeListener=null),this.container=null)},mxCellOverlay.prototype=new mxEventSource,mxCellOverlay.prototype.constructor=mxCellOverlay,mxCellOverlay.prototype.image=null,mxCellOverlay.prototype.tooltip=null,mxCellOverlay.prototype.align=mxConstants.ALIGN_RIGHT,mxCellOverlay.prototype.verticalAlign=mxConstants.ALIGN_BOTTOM,mxCellOverlay.prototype.offset=null,mxCellOverlay.prototype.cursor=null,mxCellOverlay.prototype.defaultOverlap=.5,mxCellOverlay.prototype.getBounds=function(e){var n=e.view.graph.getModel().isEdge(e.cell),t=e.view.scale,a=null,i=this.image.width,s=this.image.height;return n?a=1==(n=e.absolutePoints).length%2?n[Math.floor(n.length/2)]:(e=n[(a=n.length/2)-1],n=n[a],new mxPoint(e.x+(n.x-e.x)/2,e.y+(n.y-e.y)/2)):((a=new mxPoint).x=this.align==mxConstants.ALIGN_LEFT?e.x:this.align==mxConstants.ALIGN_CENTER?e.x+e.width/2:e.x+e.width,a.y=this.verticalAlign==mxConstants.ALIGN_TOP?e.y:this.verticalAlign==mxConstants.ALIGN_MIDDLE?e.y+e.height/2:e.y+e.height),new mxRectangle(Math.round(a.x-(i*this.defaultOverlap-this.offset.x)*t),Math.round(a.y-(s*this.defaultOverlap-this.offset.y)*t),i*t,s*t)},mxCellOverlay.prototype.toString=function(){return this.tooltip},mxOutline.prototype.source=null,mxOutline.prototype.outline=null,mxOutline.prototype.graphRenderHint=mxConstants.RENDERING_HINT_FASTER,mxOutline.prototype.enabled=!0,mxOutline.prototype.showViewport=!0,mxOutline.prototype.border=10,mxOutline.prototype.sizerSize=8,mxOutline.prototype.updateOnPan=!1,mxOutline.prototype.sizerImage=null,mxOutline.prototype.suspended=!1,mxOutline.prototype.init=function(e){this.outline=new mxGraph(e,this.source.getModel(),this.graphRenderHint,this.source.getStylesheet()),this.outline.foldingEnabled=!1,this.outline.autoScroll=!1;var n=this.outline.graphModelChanged;this.outline.graphModelChanged=mxUtils.bind(this,function(e){!this.suspended&&null!=this.outline&&n.apply(this.outline,arguments)}),mxClient.IS_SVG&&((e=this.outline.getView().getCanvas().parentNode).setAttribute("shape-rendering","optimizeSpeed"),e.setAttribute("image-rendering","optimizeSpeed")),this.outline.labelsVisible=!1,this.outline.setEnabled(!1),this.updateHandler=mxUtils.bind(this,function(e,n){!this.suspended&&!this.active&&this.update()}),this.source.getModel().addListener(mxEvent.CHANGE,this.updateHandler),this.outline.addMouseListener(this),(e=this.source.getView()).addListener(mxEvent.SCALE,this.updateHandler),e.addListener(mxEvent.TRANSLATE,this.updateHandler),e.addListener(mxEvent.SCALE_AND_TRANSLATE,this.updateHandler),e.addListener(mxEvent.DOWN,this.updateHandler),e.addListener(mxEvent.UP,this.updateHandler),mxEvent.addListener(this.source.container,"scroll",this.updateHandler),this.panHandler=mxUtils.bind(this,function(e){this.updateOnPan&&this.updateHandler.apply(this,arguments)}),this.source.addListener(mxEvent.PAN,this.panHandler),this.refreshHandler=mxUtils.bind(this,function(e){this.outline.setStylesheet(this.source.getStylesheet()),this.outline.refresh()}),this.source.addListener(mxEvent.REFRESH,this.refreshHandler),this.bounds=new mxRectangle(0,0,0,0),this.selectionBorder=new mxRectangleShape(this.bounds,null,mxConstants.OUTLINE_COLOR,mxConstants.OUTLINE_STROKEWIDTH),this.selectionBorder.dialect=this.outline.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.selectionBorder.init(this.outline.getView().getOverlayPane()),mxEvent.redirectMouseEvents(this.selectionBorder.node,this.outline),this.selectionBorder.node.style.background="",this.sizer=this.createSizer(),this.sizer.init(this.outline.getView().getOverlayPane()),this.enabled&&(this.sizer.node.style.cursor="pointer"),mxEvent.addListener(this.sizer.node,mxClient.IS_TOUCH?"touchstart":"mousedown",mxUtils.bind(this,function(e){this.outline.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))})),this.selectionBorder.node.style.display=this.showViewport?"":"none",this.sizer.node.style.display=this.selectionBorder.node.style.display,this.selectionBorder.node.style.cursor="move",this.update(!1)},mxOutline.prototype.isEnabled=function(){return this.enabled},mxOutline.prototype.setEnabled=function(e){this.enabled=e},mxOutline.prototype.setZoomEnabled=function(e){this.sizer.node.style.visibility=e?"visible":"hidden"},mxOutline.prototype.refresh=function(){this.update(!0)},mxOutline.prototype.createSizer=function(){var e=null!=this.sizerImage?new mxImageShape(new mxRectangle(0,0,this.sizerImage.width,this.sizerImage.height),this.sizerImage.src):new mxRectangleShape(new mxRectangle(0,0,this.sizerSize,this.sizerSize),mxConstants.OUTLINE_HANDLE_FILLCOLOR,mxConstants.OUTLINE_HANDLE_STROKECOLOR);return e.dialect=this.outline.dialect,e},mxOutline.prototype.getSourceContainerSize=function(){return new mxRectangle(0,0,this.source.container.scrollWidth,this.source.container.scrollHeight)},mxOutline.prototype.getOutlineOffset=function(e){return null},mxOutline.prototype.update=function(e){if(null!=this.source){var n=this.source.view.scale,t=new mxRectangle((t=this.source.getGraphBounds()).x/n+this.source.panDx,t.y/n+this.source.panDy,t.width/n,t.height/n),a=new mxRectangle(0,0,this.source.container.clientWidth/n,this.source.container.clientHeight/n);(s=t.clone()).add(a);var i=this.getSourceContainerSize(),s=(a=Math.max(i.width/n,s.width),n=Math.max(i.height/n,s.height),Math.max(0,this.outline.container.clientWidth-this.border));i=Math.max(0,this.outline.container.clientHeight-this.border);if(0<(s=Math.min(s/a,i/n))){this.outline.getView().scale!=s&&(this.outline.getView().scale=s,e=!0),(a=this.outline.getView()).currentRoot!=this.source.getView().currentRoot&&a.setCurrentRoot(this.source.getView().currentRoot);i=(n=this.source.view.translate).x+this.source.panDx;var o=n.y+this.source.panDy;null!=(s=this.getOutlineOffset(s))&&(i+=s.x,o+=s.y),t.x<0&&(i-=t.x),t.y<0&&(o-=t.y),a.translate.x==i&&a.translate.y==o||(a.translate.x=i,a.translate.y=o,e=!0);t=a.translate,i=(s=this.source.getView().scale)/a.scale,o=1/a.scale;var r=this.source.container;this.bounds=new mxRectangle((t.x-n.x-this.source.panDx)/o,(t.y-n.y-this.source.panDy)/o,r.clientWidth/i,r.clientHeight/i),this.bounds.x+=this.source.container.scrollLeft*a.scale/s,this.bounds.y+=this.source.container.scrollTop*a.scale/s,(t=this.selectionBorder.bounds).x==this.bounds.x&&t.y==this.bounds.y&&t.width==this.bounds.width&&t.height==this.bounds.height||(this.selectionBorder.bounds=this.bounds,this.selectionBorder.redraw()),t=this.sizer.bounds,a=new mxRectangle(this.bounds.x+this.bounds.width-t.width/2,this.bounds.y+this.bounds.height-t.height/2,t.width,t.height),t.x==a.x&&t.y==a.y&&t.width==a.width&&t.height==a.height||(this.sizer.bounds=a,"hidden"!=this.sizer.node.style.visibility&&this.sizer.redraw()),e&&this.outline.view.revalidate()}}},mxOutline.prototype.mouseDown=function(e,n){this.enabled&&this.showViewport&&(this.zoom=n.isSource(this.sizer),this.startX=n.getX(),this.startY=n.getY(),this.active=!0,this.source.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.source.container)?(this.dx0=this.source.container.scrollLeft,this.dy0=this.source.container.scrollTop):this.dy0=this.dx0=0),n.consume()},mxOutline.prototype.mouseMove=function(e,n){if(this.active){this.selectionBorder.node.style.display=this.showViewport?"":"none",this.sizer.node.style.display=this.selectionBorder.node.style.display;var t=n.getX()-this.startX,a=n.getY()-this.startY,i=null;if(this.zoom)a=t/((i=this.source.container).clientWidth/i.clientHeight),i=new mxRectangle(this.bounds.x,this.bounds.y,Math.max(1,this.bounds.width+t),Math.max(1,this.bounds.height+a)),this.selectionBorder.bounds=i,this.selectionBorder.redraw();else{var s=this.outline.getView().scale;i=new mxRectangle(this.bounds.x+t,this.bounds.y+a,this.bounds.width,this.bounds.height);this.selectionBorder.bounds=i,this.selectionBorder.redraw(),t=t/s*this.source.getView().scale,a=a/s*this.source.getView().scale,this.source.panGraph(-t-this.dx0,-a-this.dy0)}t=this.sizer.bounds,this.sizer.bounds=new mxRectangle(i.x+i.width-t.width/2,i.y+i.height-t.height/2,t.width,t.height),"hidden"!=this.sizer.node.style.visibility&&this.sizer.redraw(),n.consume()}},mxOutline.prototype.mouseUp=function(e,n){if(this.active){var t=n.getX()-this.startX,a=n.getY()-this.startY;if(0<Math.abs(t)||0<Math.abs(a)){if(this.zoom){a=this.selectionBorder.bounds.width;var i=this.source.getView().scale;this.source.zoomTo(i-t*i/a,!1)}else this.source.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.source.container)||(this.source.panGraph(0,0),t/=this.outline.getView().scale,a/=this.outline.getView().scale,i=this.source.getView().translate,this.source.getView().setTranslate(i.x-t,i.y-a));this.update(),n.consume()}this.index=null,this.active=!1}},mxOutline.prototype.destroy=function(){null!=this.source&&(this.source.removeListener(this.panHandler),this.source.removeListener(this.refreshHandler),this.source.getModel().removeListener(this.updateHandler),this.source.getView().removeListener(this.updateHandler),mxEvent.addListener(this.source.container,"scroll",this.updateHandler),this.source=null),null!=this.outline&&(this.outline.removeMouseListener(this),this.outline.destroy(),this.outline=null),null!=this.selectionBorder&&(this.selectionBorder.destroy(),this.selectionBorder=null),null!=this.sizer&&(this.sizer.destroy(),this.sizer=null)},mxMultiplicity.prototype.type=null,mxMultiplicity.prototype.attr=null,mxMultiplicity.prototype.value=null,mxMultiplicity.prototype.source=null,mxMultiplicity.prototype.min=null,mxMultiplicity.prototype.max=null,mxMultiplicity.prototype.validNeighbors=null,mxMultiplicity.prototype.validNeighborsAllowed=!0,mxMultiplicity.prototype.countError=null,mxMultiplicity.prototype.typeError=null,mxMultiplicity.prototype.check=function(e,n,t,a,i,s){var o="";return(this.source&&this.checkTerminal(e,t,n)||!this.source&&this.checkTerminal(e,a,n))&&(null!=this.countError&&(this.source&&(0==this.max||i>=this.max)||!this.source&&(0==this.max||s>=this.max))&&(o+=this.countError+"\n"),null!=this.validNeighbors&&null!=this.typeError&&0<this.validNeighbors.length&&(this.checkNeighbors(e,n,t,a)||(o+=this.typeError+"\n"))),0<o.length?o:null},mxMultiplicity.prototype.checkNeighbors=function(e,n,t,a){n=e.model.getValue(t),a=e.model.getValue(a),t=!this.validNeighborsAllowed;for(var i=this.validNeighbors,s=0;s<i.length;s++){if(this.source&&this.checkType(e,a,i[s])){t=this.validNeighborsAllowed;break}if(!this.source&&this.checkType(e,n,i[s])){t=this.validNeighborsAllowed;break}}return t},mxMultiplicity.prototype.checkTerminal=function(e,n,t){return n=e.model.getValue(n),this.checkType(e,n,this.type,this.attr,this.value)},mxMultiplicity.prototype.checkType=function(e,n,t,a,i){return null!=n&&(isNaN(n.nodeType)?n==t:mxUtils.isNode(n,t,a,i))},mxLayoutManager.prototype=new mxEventSource,mxLayoutManager.prototype.constructor=mxLayoutManager,mxLayoutManager.prototype.graph=null,mxLayoutManager.prototype.bubbling=!0,mxLayoutManager.prototype.enabled=!0,mxLayoutManager.prototype.updateHandler=null,mxLayoutManager.prototype.moveHandler=null,mxLayoutManager.prototype.isEnabled=function(){return this.enabled},mxLayoutManager.prototype.setEnabled=function(e){this.enabled=e},mxLayoutManager.prototype.isBubbling=function(){return this.bubbling},mxLayoutManager.prototype.setBubbling=function(e){this.bubbling=e},mxLayoutManager.prototype.getGraph=function(){return this.graph},mxLayoutManager.prototype.setGraph=function(e){if(null!=this.graph){var n=this.graph.getModel();n.removeListener(this.undoHandler),this.graph.removeListener(this.moveHandler)}this.graph=e,null!=this.graph&&((n=this.graph.getModel()).addListener(mxEvent.BEFORE_UNDO,this.undoHandler),this.graph.addListener(mxEvent.MOVE_CELLS,this.moveHandler))},mxLayoutManager.prototype.getLayout=function(e){return null},mxLayoutManager.prototype.beforeUndo=function(e){e=this.getCellsForChanges(e.changes);var n=this.getGraph().getModel();if(this.isBubbling())for(var t=n.getParents(e);0<t.length;)e=e.concat(t),t=n.getParents(t);this.layoutCells(mxUtils.sortCells(e,!1))},mxLayoutManager.prototype.cellsMoved=function(e,n){if(null!=e&&null!=n)for(var t=mxUtils.convertPoint(this.getGraph().container,mxEvent.getClientX(n),mxEvent.getClientY(n)),a=this.getGraph().getModel(),i=0;i<e.length;i++){var s=this.getLayout(a.getParent(e[i]));null!=s&&s.moveCell(e[i],t.x,t.y)}},mxLayoutManager.prototype.getCellsForChanges=function(e){for(var n=[],t={},a=0;a<e.length;a++){if((i=e[a])instanceof mxRootChange)return[];for(var i=this.getCellsForChange(i),s=0;s<i.length;s++)if(null!=i[s]){var o=mxCellPath.create(i[s]);null==t[o]&&(t[o]=i[s],n.push(i[s]))}}return n},mxLayoutManager.prototype.getCellsForChange=function(e){var n=this.getGraph().getModel();return e instanceof mxChildChange?[e.child,e.previous,n.getParent(e.child)]:e instanceof mxTerminalChange||e instanceof mxGeometryChange?[e.cell,n.getParent(e.cell)]:[]},mxLayoutManager.prototype.layoutCells=function(e){if(0<e.length){var n=this.getGraph().getModel();n.beginUpdate();try{for(var t=null,a=0;a<e.length;a++)e[a]!=n.getRoot()&&e[a]!=t&&(t=e[a],this.executeLayout(this.getLayout(t),t));this.fireEvent(new mxEventObject(mxEvent.LAYOUT_CELLS,"cells",e))}finally{n.endUpdate()}}},mxLayoutManager.prototype.executeLayout=function(e,n){null!=e&&null!=n&&e.execute(n)},mxLayoutManager.prototype.destroy=function(){this.setGraph(null)},mxSpaceManager.prototype=new mxEventSource,mxSpaceManager.prototype.constructor=mxSpaceManager,mxSpaceManager.prototype.graph=null,mxSpaceManager.prototype.enabled=!0,mxSpaceManager.prototype.shiftRightwards=!0,mxSpaceManager.prototype.shiftDownwards=!0,mxSpaceManager.prototype.extendParents=!0,mxSpaceManager.prototype.resizeHandler=null,mxSpaceManager.prototype.foldHandler=null,mxSpaceManager.prototype.isCellIgnored=function(e){return!this.getGraph().getModel().isVertex(e)},mxSpaceManager.prototype.isCellShiftable=function(e){return this.getGraph().getModel().isVertex(e)&&this.getGraph().isCellMovable(e)},mxSpaceManager.prototype.isEnabled=function(){return this.enabled},mxSpaceManager.prototype.setEnabled=function(e){this.enabled=e},mxSpaceManager.prototype.isShiftRightwards=function(){return this.shiftRightwards},mxSpaceManager.prototype.setShiftRightwards=function(e){this.shiftRightwards=e},mxSpaceManager.prototype.isShiftDownwards=function(){return this.shiftDownwards},mxSpaceManager.prototype.setShiftDownwards=function(e){this.shiftDownwards=e},mxSpaceManager.prototype.isExtendParents=function(){return this.extendParents},mxSpaceManager.prototype.setExtendParents=function(e){this.extendParents=e},mxSpaceManager.prototype.getGraph=function(){return this.graph},mxSpaceManager.prototype.setGraph=function(e){null!=this.graph&&(this.graph.removeListener(this.resizeHandler),this.graph.removeListener(this.foldHandler)),this.graph=e,null!=this.graph&&(this.graph.addListener(mxEvent.RESIZE_CELLS,this.resizeHandler),this.graph.addListener(mxEvent.FOLD_CELLS,this.foldHandler))},mxSpaceManager.prototype.cellsResized=function(e){if(null!=e){var n=this.graph.getModel();n.beginUpdate();try{for(var t=0;t<e.length;t++)if(!this.isCellIgnored(e[t])){this.cellResized(e[t]);break}}finally{n.endUpdate()}}},mxSpaceManager.prototype.cellResized=function(e){var n=this.getGraph(),t=n.getView(),a=n.getModel(),i=t.getState(e),s=t.getState(a.getParent(e));if(null!=i&&null!=s){var o=this.getCellsToShift(i),r=a.getGeometry(e);if(null!=o&&null!=r){var l=t.translate,d=t.scale,c=(t=i.x-s.origin.x-l.x*d,s=i.y-s.origin.y-l.y*d,l=i.x+i.width,i.y+i.height),m=i.width-r.width*d+t-r.x*d,u=i.height-r.height*d+s-r.y*d,p=1-r.width*d/i.width;i=1-r.height*d/i.height;a.beginUpdate();try{for(r=0;r<o.length;r++)o[r]!=e&&this.isCellShiftable(o[r])&&this.shiftCell(o[r],m,u,t,s,l,c,p,i,this.isExtendParents()&&n.isExtendParent(o[r]))}finally{a.endUpdate()}}}},mxSpaceManager.prototype.shiftCell=function(e,n,t,a,i,s,o,r,l,d){var c=(a=this.getGraph()).getView().getState(e);if(null!=c){var m=a.getModel();if(null!=(p=m.getGeometry(e))){m.beginUpdate();try{if(this.isShiftRightwards())if(c.x>=s)(p=p.clone()).translate(-n,0);else{var u=Math.max(0,c.x-x0);(p=p.clone()).translate(-r*u,0)}if(this.isShiftDownwards())if(c.y>=o)(p=p.clone()).translate(0,-t);else{var p,g=Math.max(0,c.y-i);(p=p.clone()).translate(0,-l*g)}p!=m.getGeometry(e)&&(m.setGeometry(e,p),d&&a.extendParent(e))}finally{m.endUpdate()}}}},mxSpaceManager.prototype.getCellsToShift=function(e){var n=this.getGraph(),t=n.getModel().getParent(e.cell),a=this.isShiftDownwards(),i=this.isShiftRightwards();return n.getCellsBeyond(e.x+(a?0:e.width),e.y+(a&&i?0:e.height),t,i,a)},mxSpaceManager.prototype.destroy=function(){this.setGraph(null)},mxSwimlaneManager.prototype=new mxEventSource,mxSwimlaneManager.prototype.constructor=mxSwimlaneManager,mxSwimlaneManager.prototype.graph=null,mxSwimlaneManager.prototype.enabled=!0,mxSwimlaneManager.prototype.horizontal=!0,mxSwimlaneManager.prototype.addEnabled=!0,mxSwimlaneManager.prototype.resizeEnabled=!0,mxSwimlaneManager.prototype.addHandler=null,mxSwimlaneManager.prototype.resizeHandler=null,mxSwimlaneManager.prototype.isEnabled=function(){return this.enabled},mxSwimlaneManager.prototype.setEnabled=function(e){this.enabled=e},mxSwimlaneManager.prototype.isHorizontal=function(){return this.horizontal},mxSwimlaneManager.prototype.setHorizontal=function(e){this.horizontal=e},mxSwimlaneManager.prototype.isAddEnabled=function(){return this.addEnabled},mxSwimlaneManager.prototype.setAddEnabled=function(e){this.addEnabled=e},mxSwimlaneManager.prototype.isResizeEnabled=function(){return this.resizeEnabled},mxSwimlaneManager.prototype.setResizeEnabled=function(e){this.resizeEnabled=e},mxSwimlaneManager.prototype.getGraph=function(){return this.graph},mxSwimlaneManager.prototype.setGraph=function(e){null!=this.graph&&(this.graph.removeListener(this.addHandler),this.graph.removeListener(this.resizeHandler)),this.graph=e,null!=this.graph&&(this.graph.addListener(mxEvent.ADD_CELLS,this.addHandler),this.graph.addListener(mxEvent.CELLS_RESIZED,this.resizeHandler))},mxSwimlaneManager.prototype.isSwimlaneIgnored=function(e){return!this.getGraph().isSwimlane(e)},mxSwimlaneManager.prototype.isCellHorizontal=function(e){if(this.graph.isSwimlane(e)){var n=this.graph.view.getState(e);return e=null!=n?n.style:this.graph.getCellStyle(e),1==mxUtils.getValue(e,mxConstants.STYLE_HORIZONTAL,1)}return!this.isHorizontal()},mxSwimlaneManager.prototype.cellsAdded=function(e){if(null!=e){var n=this.getGraph().getModel();n.beginUpdate();try{for(var t=0;t<e.length;t++)this.isSwimlaneIgnored(e[t])||this.swimlaneAdded(e[t])}finally{n.endUpdate()}}},mxSwimlaneManager.prototype.swimlaneAdded=function(e){for(var n=this.getGraph().getModel(),t=n.getParent(e),a=n.getChildCount(t),i=null,s=0;s<a;s++){var o=n.getChildAt(t,s);if(o!=e&&!this.isSwimlaneIgnored(o)&&null!=(i=n.getGeometry(o)))break}null!=i&&this.resizeSwimlane(e,i.width,i.height)},mxSwimlaneManager.prototype.cellsResized=function(e){if(null!=e){var n=this.getGraph().getModel();n.beginUpdate();try{for(var t=0;t<e.length;t++)if(!this.isSwimlaneIgnored(e[t])){var a=n.getGeometry(e[t]);if(null!=a){for(var i=new mxRectangle(0,0,a.width,a.height),s=o=e[t];null!=s;){var o=s,r=(s=n.getParent(s),this.graph.isSwimlane(s)?this.graph.getStartSize(s):new mxRectangle);i.width+=r.width,i.height+=r.height}this.resizeSwimlane(o,i.width,i.height)}}}finally{n.endUpdate()}}},mxSwimlaneManager.prototype.resizeSwimlane=function(e,n,t){var a=this.getGraph().getModel();a.beginUpdate();try{if(!this.isSwimlaneIgnored(e))if(null!=(r=a.getGeometry(e))){var i=this.isCellHorizontal(e);(i&&r.height!=t||!i&&r.width!=n)&&(r=r.clone(),i?r.height=t:r.width=n,a.setGeometry(e,r))}var s=this.graph.isSwimlane(e)?this.graph.getStartSize(e):new mxRectangle;n-=s.width,t-=s.height;for(var o=a.getChildCount(e),r=0;r<o;r++){var l=a.getChildAt(e,r);this.resizeSwimlane(l,n,t)}}finally{a.endUpdate()}},mxSwimlaneManager.prototype.destroy=function(){this.setGraph(null)},mxTemporaryCellStates.prototype.view=null,mxTemporaryCellStates.prototype.oldStates=null,mxTemporaryCellStates.prototype.oldBounds=null,mxTemporaryCellStates.prototype.oldScale=null,mxTemporaryCellStates.prototype.destroy=function(){this.view.setScale(this.oldScale),this.view.setStates(this.oldStates),this.view.setGraphBounds(this.oldBounds)},mxCellStatePreview.prototype.graph=null,mxCellStatePreview.prototype.deltas=null,mxCellStatePreview.prototype.count=0,mxCellStatePreview.prototype.isEmpty=function(){return 0==this.count},mxCellStatePreview.prototype.moveState=function(e,n,t,a,i){a=null==a||a,i=null==i||i;var s=mxCellPath.create(e.cell),o=this.deltas[s];return null==o?(o=new mxPoint(n,t),this.deltas[s]=o,this.count++):a?(o.X+=n,o.Y+=t):(o.X=n,o.Y=t),i&&this.addEdges(e),o},mxCellStatePreview.prototype.show=function(e){var n,t=this.graph.getModel(),a=t.getRoot();for(n in this.deltas){var i=mxCellPath.resolve(a,n),s=this.graph.view.getState(i),o=this.deltas[n];i=this.graph.view.getState(t.getParent(i));this.translateState(i,s,o.x,o.y)}for(n in this.deltas)i=mxCellPath.resolve(a,n),s=this.graph.view.getState(i),o=this.deltas[n],i=this.graph.view.getState(t.getParent(i)),this.revalidateState(i,s,o.x,o.y,e)},mxCellStatePreview.prototype.translateState=function(e,n,t,a){if(null!=n){var i=this.graph.getModel();if(i.isVertex(n.cell)){n.invalid=!0,this.graph.view.validateBounds(e,n.cell),e=i.getGeometry(n.cell);var s=mxCellPath.create(n.cell);0==t&&0==a||null==e||e.relative&&null==this.deltas[s]||(n.x+=t,n.y+=a)}for(e=i.getChildCount(n.cell),s=0;s<e;s++)this.translateState(n,this.graph.view.getState(i.getChildAt(n.cell,s)),t,a)}},mxCellStatePreview.prototype.revalidateState=function(e,n,t,a,i){if(null!=n){n.invalid=!0,this.graph.view.validatePoints(e,n.cell);var s=mxCellPath.create(n.cell),o=this.graph.getModel(),r=this.graph.getCellGeometry(n.cell);for(0==t&&0==a||null==r||!r.relative||!o.isVertex(n.cell)||null!=e&&!o.isVertex(e.cell)&&null==this.deltas[s]||(n.x+=t,n.y+=a,this.graph.cellRenderer.redraw(n)),null!=i&&i(n),e=o.getChildCount(n.cell),s=0;s<e;s++)this.revalidateState(n,this.graph.view.getState(o.getChildAt(n.cell,s)),t,a,i)}},mxCellStatePreview.prototype.addEdges=function(e){for(var n=this.graph.getModel(),t=n.getEdgeCount(e.cell),a=0;a<t;a++){var i=this.graph.view.getState(n.getEdgeAt(e.cell,a));null!=i&&this.moveState(i,0,0)}},mxConnectionConstraint.prototype.point=null,mxConnectionConstraint.prototype.perimeter=null,mxGraphHandler.prototype.graph=null,mxGraphHandler.prototype.maxCells=mxClient.IS_IE?20:50,mxGraphHandler.prototype.enabled=!0,mxGraphHandler.prototype.highlightEnabled=!0,mxGraphHandler.prototype.cloneEnabled=!0,mxGraphHandler.prototype.moveEnabled=!0,mxGraphHandler.prototype.guidesEnabled=!1,mxGraphHandler.prototype.guide=null,mxGraphHandler.prototype.currentDx=null,mxGraphHandler.prototype.currentDy=null,mxGraphHandler.prototype.updateCursor=!0,mxGraphHandler.prototype.selectEnabled=!0,mxGraphHandler.prototype.removeCellsFromParent=!0,mxGraphHandler.prototype.connectOnDrop=!1,mxGraphHandler.prototype.scrollOnMove=!0,mxGraphHandler.prototype.minimumSize=6,mxGraphHandler.prototype.previewColor="black",mxGraphHandler.prototype.htmlPreview=!1,mxGraphHandler.prototype.shape=null,mxGraphHandler.prototype.scaleGrid=!1,mxGraphHandler.prototype.rotationEnabled=!0,mxGraphHandler.prototype.isEnabled=function(){return this.enabled},mxGraphHandler.prototype.setEnabled=function(e){this.enabled=e},mxGraphHandler.prototype.isCloneEnabled=function(){return this.cloneEnabled},mxGraphHandler.prototype.setCloneEnabled=function(e){this.cloneEnabled=e},mxGraphHandler.prototype.isMoveEnabled=function(){return this.moveEnabled},mxGraphHandler.prototype.setMoveEnabled=function(e){this.moveEnabled=e},mxGraphHandler.prototype.isSelectEnabled=function(){return this.selectEnabled},mxGraphHandler.prototype.setSelectEnabled=function(e){this.selectEnabled=e},mxGraphHandler.prototype.isRemoveCellsFromParent=function(){return this.removeCellsFromParent},mxGraphHandler.prototype.setRemoveCellsFromParent=function(e){this.removeCellsFromParent=e},mxGraphHandler.prototype.getInitialCellForEvent=function(e){return e.getCell()},mxGraphHandler.prototype.isDelayedSelection=function(e){return this.graph.isCellSelected(e)},mxGraphHandler.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.isEnabled()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(n.getEvent())&&null!=n.getState()){var t=this.getInitialCellForEvent(n);if(this.cell=null,this.delayedSelection=this.isDelayedSelection(t),this.isSelectEnabled()&&!this.delayedSelection&&this.graph.selectCellForEvent(t,n.getEvent()),this.isMoveEnabled()){var a=this.graph.model,i=a.getGeometry(t);this.graph.isCellMovable(t)&&(!a.isEdge(t)||1<this.graph.getSelectionCount()||null!=i.points&&0<i.points.length||null==a.getTerminal(t,!0)||null==a.getTerminal(t,!1)||this.graph.allowDanglingEdges||this.graph.isCloneEvent(n.getEvent())&&this.graph.isCellsCloneable())&&this.start(t,n.getX(),n.getY()),this.cellWasClicked=!0,!mxClient.IS_SF&&!mxClient.IS_GC||"SELECT"!=n.getSource().nodeName?n.consume():mxClient.IS_SF&&"SELECT"==n.getSource().nodeName&&(this.cellWasClicked=!1,this.first=null)}}},mxGraphHandler.prototype.getGuideStates=function(){var e=this.graph.getDefaultParent(),n=this.graph.getModel(),t=mxUtils.bind(this,function(e){return null!=this.graph.view.getState(e)&&n.isVertex(e)&&null!=n.getGeometry(e)&&!n.getGeometry(e).relative});return this.graph.view.getCellStates(n.filterDescendants(t,e))},mxGraphHandler.prototype.getCells=function(e){return!this.delayedSelection&&this.graph.isCellMovable(e)?[e]:this.graph.getMovableCells(this.graph.getSelectionCells())},mxGraphHandler.prototype.getPreviewBounds=function(e){return null!=(e=this.getBoundingBox(e))&&(e.grow(-1,-1),e.width<this.minimumSize&&(e.x-=(this.minimumSize-e.width)/2,e.width=this.minimumSize),e.height<this.minimumSize&&(e.y-=(this.minimumSize-e.height)/2,e.height=this.minimumSize)),e},mxGraphHandler.prototype.getBoundingBox=function(e){var n=null;if(null!=e&&0<e.length)for(var t=this.graph.getModel(),a=0;a<e.length;a++)if(t.isVertex(e[a])||t.isEdge(e[a])){var i=this.graph.view.getState(e[a]);if(null!=i){var s=i;t.isVertex(e[a])&&null!=i.shape&&null!=i.shape.boundingBox&&(s=i.shape.boundingBox),null==n?n=new mxRectangle(s.x,s.y,s.width,s.height):n.add(s)}}return n},mxGraphHandler.prototype.createPreviewShape=function(e){return(e=new mxRectangleShape(e,null,this.previewColor)).isDashed=!0,this.htmlPreview?(e.dialect=mxConstants.DIALECT_STRICTHTML,e.init(this.graph.container)):(e.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()),e.pointerEvents=!1),e},mxGraphHandler.prototype.start=function(e,n,t){this.cell=e,this.first=mxUtils.convertPoint(this.graph.container,n,t),this.cells=this.getCells(this.cell),this.bounds=this.graph.getView().getBounds(this.cells),this.pBounds=this.getPreviewBounds(this.cells),this.guidesEnabled&&(this.guide=new mxGuide(this.graph,this.getGuideStates()))},mxGraphHandler.prototype.useGuidesForEvent=function(e){return null==this.guide||this.guide.isEnabledForEvent(e.getEvent())},mxGraphHandler.prototype.snap=function(e){var n=this.scaleGrid?this.graph.view.scale:1;return e.x=this.graph.snap(e.x/n)*n,e.y=this.graph.snap(e.y/n)*n,e},mxGraphHandler.prototype.mouseMove=function(e,n){var t=this.graph;if(!n.isConsumed()&&t.isMouseDown&&null!=this.cell&&null!=this.first&&null!=this.bounds){var a=(s=mxUtils.convertPoint(t.container,n.getX(),n.getY())).x-this.first.x,i=s.y-this.first.y,s=t.tolerance;if(null!=this.shape||Math.abs(a)>s||Math.abs(i)>s){null==this.highlight&&(this.highlight=new mxCellHighlight(this.graph,mxConstants.DROP_TARGET_COLOR,3)),null==this.shape&&(this.shape=this.createPreviewShape(this.bounds));var o=t.isGridEnabledEvent(n.getEvent());s=!0;if(null!=this.guide&&this.useGuidesForEvent(n))s=!1,a=(i=this.guide.move(this.bounds,new mxPoint(a,i),o)).x,i=i.y;else if(o){var r=t.getView().translate,l=t.getView().scale;o=this.bounds.x-(t.snap(this.bounds.x/l-r.x)+r.x)*l,r=this.bounds.y-(t.snap(this.bounds.y/l-r.y)+r.y)*l,a=(i=this.snap(new mxPoint(a,i))).x-o,i=i.y-r}for(null!=this.guide&&s&&this.guide.hide(),t.isConstrainedEvent(n.getEvent())&&(Math.abs(a)>Math.abs(i)?i=0:a=0),this.currentDx=a,this.currentDy=i,this.updatePreviewShape(),s=null,i=n.getCell(),t.isDropEnabled()&&this.highlightEnabled&&(s=t.getDropTarget(this.cells,n.getEvent(),i)),o=s,r=t.getModel();null!=o&&o!=this.cells[0];)o=r.getParent(o);l=t.isCloneEvent(n.getEvent())&&t.isCellsCloneable()&&this.isCloneEnabled();var d=!1;null==(a=t.getView().getState(s))||null!=o||r.getParent(this.cell)==s&&!l?(this.target=null,this.connectOnDrop&&null!=i&&1==this.cells.length&&t.getModel().isVertex(i)&&t.isCellConnectable(i)&&(null!=(a=t.getView().getState(i))&&(t=null==t.getEdgeValidationError(null,this.cell,i)?mxConstants.VALID_COLOR:mxConstants.INVALID_CONNECT_TARGET_COLOR,this.setHighlightColor(t),d=!0))):(this.target!=s&&(this.target=s,this.setHighlightColor(mxConstants.DROP_TARGET_COLOR)),d=!0),null!=a&&d?this.highlight.highlight(a):this.highlight.hide()}n.consume(),mxEvent.consume(n.getEvent())}else!this.isMoveEnabled()&&!this.isCloneEnabled()||!this.updateCursor||n.isConsumed()||null==n.getState()||t.isMouseDown||(null==(a=t.getCursorForCell(n.getCell()))&&t.isEnabled()&&t.isCellMovable(n.getCell())&&(a=t.getModel().isEdge(n.getCell())?mxConstants.CURSOR_MOVABLE_EDGE:mxConstants.CURSOR_MOVABLE_VERTEX),n.getState().setCursor(a),n.consume())},mxGraphHandler.prototype.updatePreviewShape=function(){null!=this.shape&&(this.shape.bounds=new mxRectangle(Math.round(this.pBounds.x+this.currentDx-this.graph.panDx),Math.round(this.pBounds.y+this.currentDy-this.graph.panDy),this.pBounds.width,this.pBounds.height),this.shape.redraw())},mxGraphHandler.prototype.setHighlightColor=function(e){null!=this.highlight&&this.highlight.setHighlightColor(e)},mxGraphHandler.prototype.mouseUp=function(e,n){if(!n.isConsumed()){var t=this.graph;if(null!=this.cell&&null!=this.first&&null!=this.shape&&null!=this.currentDx&&null!=this.currentDy){var a=t.getView().scale,i=t.isCloneEvent(n.getEvent())&&t.isCellsCloneable()&&this.isCloneEnabled(),s=this.currentDx/a,o=(a=this.currentDy/a,n.getCell());this.connectOnDrop&&null==this.target&&null!=o&&t.getModel().isVertex(o)&&t.isCellConnectable(o)&&t.isEdgeValid(null,this.cell,o)?t.connectionHandler.connect(this.cell,o,n.getEvent()):(o=this.target,t.isSplitEnabled()&&t.isSplitTarget(o,this.cells,n.getEvent())?t.splitEdge(o,this.cells,null,s,a):this.moveCells(this.cells,s,a,i,this.target,n.getEvent()))}else this.isSelectEnabled()&&this.delayedSelection&&null!=this.cell&&this.selectDelayed(n)}this.cellWasClicked&&n.consume(),this.reset()},mxGraphHandler.prototype.selectDelayed=function(e){this.graph.selectCellForEvent(this.cell,e.getEvent())},mxGraphHandler.prototype.reset=function(){this.destroyShapes(),this.delayedSelection=this.cellWasClicked=!1,this.target=this.cell=this.first=this.guides=this.currentDy=this.currentDx=null},mxGraphHandler.prototype.shouldRemoveCellsFromParent=function(e,n,t){if(this.graph.getModel().isVertex(e)){if(e=this.graph.getView().getState(e),t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(t),mxEvent.getClientY(t)),0!=(a=mxUtils.toRadians(mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION)||0))){n=Math.cos(-a);var a=Math.sin(-a),i=new mxPoint(e.getCenterX(),e.getCenterY());t=mxUtils.getRotatedPoint(t,n,a,i)}return null!=e&&!mxUtils.contains(e,t.x,t.y)}return!1},mxGraphHandler.prototype.moveCells=function(e,n,t,a,i,s){a&&(e=this.graph.getCloneableCells(e)),null==i&&this.isRemoveCellsFromParent()&&this.shouldRemoveCellsFromParent(this.graph.getModel().getParent(this.cell),e,s)&&(i=this.graph.getDefaultParent()),e=this.graph.moveCells(e,n-this.graph.panDx/this.graph.view.scale,t-this.graph.panDy/this.graph.view.scale,a,i,s),this.isSelectEnabled()&&this.scrollOnMove&&this.graph.scrollCellToVisible(e[0]),a&&this.graph.setSelectionCells(e)},mxGraphHandler.prototype.destroyShapes=function(){null!=this.shape&&(this.shape.destroy(),this.shape=null),null!=this.guide&&(this.guide.destroy(),this.guide=null),null!=this.highlight&&(this.highlight.destroy(),this.highlight=null)},mxGraphHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),this.graph.removeListener(this.panHandler),this.destroyShapes()},mxPanningHandler.prototype=new mxPopupMenu,mxPanningHandler.prototype.constructor=mxPanningHandler,mxPanningHandler.prototype.graph=null,mxPanningHandler.prototype.triggerX=null,mxPanningHandler.prototype.triggerY=null,mxPanningHandler.prototype.usePopupTrigger=!0,mxPanningHandler.prototype.useLeftButtonForPanning=!1,mxPanningHandler.prototype.selectOnPopup=!0,mxPanningHandler.prototype.clearSelectionOnBackground=!0,mxPanningHandler.prototype.ignoreCell=!1,mxPanningHandler.prototype.previewEnabled=!0,mxPanningHandler.prototype.useGrid=!1,mxPanningHandler.prototype.panningEnabled=!0,mxPanningHandler.prototype.isPanningEnabled=function(){return this.panningEnabled},mxPanningHandler.prototype.setPanningEnabled=function(e){this.panningEnabled=e},mxPanningHandler.prototype.init=function(){mxPopupMenu.prototype.init.apply(this),mxEvent.addListener(this.div,mxClient.IS_TOUCH?"touchmove":"mousemove",mxUtils.bind(this,function(e){this.graph.tooltipHandler.hide()}))},mxPanningHandler.prototype.isPanningTrigger=function(e){var n=e.getEvent();return this.useLeftButtonForPanning&&(this.ignoreCell||null==e.getState())&&mxEvent.isLeftMouseButton(n)||mxEvent.isControlDown(n)&&mxEvent.isShiftDown(n)||this.usePopupTrigger&&mxEvent.isPopupTrigger(n)},mxPanningHandler.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.isEnabled()){this.hideMenu(),this.dx0=-this.graph.container.scrollLeft,this.dy0=-this.graph.container.scrollTop;var t=mxUtils.convertPoint(this.graph.container,n.getX(),n.getY());this.triggerX=t.x,this.triggerY=t.y,this.popupTrigger=this.isPopupTrigger(n),this.panningTrigger=this.isPanningEnabled()&&this.isPanningTrigger(n),this.startX=n.getX(),this.startY=n.getY(),this.panningTrigger&&this.consumePanningTrigger(n)}},mxPanningHandler.prototype.consumePanningTrigger=function(e){e.consume()},mxPanningHandler.prototype.mouseMove=function(e,n){var t=n.getX()-this.startX,a=n.getY()-this.startY;if(this.active)this.previewEnabled&&(this.useGrid&&(t=this.graph.snap(t),a=this.graph.snap(a)),this.graph.panGraph(t+this.dx0,a+this.dy0)),this.fireEvent(new mxEventObject(mxEvent.PAN,"event",n)),n.consume();else if(this.panningTrigger){var i=this.active;this.active=Math.abs(t)>this.graph.tolerance||Math.abs(a)>this.graph.tolerance,!i&&this.active&&this.fireEvent(new mxEventObject(mxEvent.PAN_START,"event",n))}},mxPanningHandler.prototype.mouseUp=function(e,n){var t=Math.abs(n.getX()-this.startX),a=Math.abs(n.getY()-this.startY);if(this.active){if(!this.graph.useScrollbarsForPanning||!mxUtils.hasScrollbars(this.graph.container)){t=n.getX()-this.startX,a=n.getY()-this.startY,this.useGrid&&(t=this.graph.snap(t),a=this.graph.snap(a));var i=this.graph.getView().scale,s=this.graph.getView().translate;this.graph.panGraph(0,0),this.panGraph(s.x+t/i,s.y+a/i)}this.active=!1,this.fireEvent(new mxEventObject(mxEvent.PAN_END,"event",n)),n.consume()}else this.popupTrigger&&t<this.graph.tolerance&&a<this.graph.tolerance&&(t=this.getCellForPopupEvent(n),this.graph.isEnabled()&&this.selectOnPopup&&null!=t&&!this.graph.isCellSelected(t)?this.graph.setSelectionCell(t):this.clearSelectionOnBackground&&null==t&&this.graph.clearSelection(),this.graph.tooltipHandler.hide(),a=mxUtils.getScrollOrigin(),a=new mxPoint(n.getX()+a.x,n.getY()+a.y),this.popup(a.x+1,a.y+1,t,n.getEvent()),n.consume());this.popupTrigger=this.panningTrigger=!1},mxPanningHandler.prototype.getCellForPopupEvent=function(e){return e.getCell()},mxPanningHandler.prototype.panGraph=function(e,n){this.graph.getView().setTranslate(e,n)},mxPanningHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),mxPopupMenu.prototype.destroy.apply(this)},mxUtils.extend(mxCellMarker,mxEventSource),mxCellMarker.prototype.graph=null,mxCellMarker.prototype.enabled=!0,mxCellMarker.prototype.hotspot=mxConstants.DEFAULT_HOTSPOT,mxCellMarker.prototype.hotspotEnabled=!1,mxCellMarker.prototype.validColor=null,mxCellMarker.prototype.invalidColor=null,mxCellMarker.prototype.currentColor=null,mxCellMarker.prototype.validState=null,mxCellMarker.prototype.markedState=null,mxCellMarker.prototype.setEnabled=function(e){this.enabled=e},mxCellMarker.prototype.isEnabled=function(){return this.enabled},mxCellMarker.prototype.setHotspot=function(e){this.hotspot=e},mxCellMarker.prototype.getHotspot=function(){return this.hotspot},mxCellMarker.prototype.setHotspotEnabled=function(e){this.hotspotEnabled=e},mxCellMarker.prototype.isHotspotEnabled=function(){return this.hotspotEnabled},mxCellMarker.prototype.hasValidState=function(){return null!=this.validState},mxCellMarker.prototype.getValidState=function(){return this.validState},mxCellMarker.prototype.getMarkedState=function(){return this.markedState},mxCellMarker.prototype.reset=function(){(this.validState=null)!=this.markedState&&(this.markedState=null,this.unmark())},mxCellMarker.prototype.process=function(e){var n=null;if(this.isEnabled()){var t=null!=(n=this.getState(e))&&this.isValidState(n);e=this.getMarkerColor(e.getEvent(),n,t),this.validState=t?n:null,n==this.markedState&&e==this.currentColor||(this.currentColor=e,null!=n&&null!=this.currentColor?(this.markedState=n,this.mark()):null!=this.markedState&&(this.markedState=null,this.unmark()))}return n},mxCellMarker.prototype.markCell=function(e,n){var t=this.graph.getView().getState(e);null!=t&&(this.currentColor=null!=n?n:this.validColor,this.markedState=t,this.mark())},mxCellMarker.prototype.mark=function(){this.highlight.setHighlightColor(this.currentColor),this.highlight.highlight(this.markedState),this.fireEvent(new mxEventObject(mxEvent.MARK,"state",this.markedState))},mxCellMarker.prototype.unmark=function(){this.mark()},mxCellMarker.prototype.isValidState=function(e){return!0},mxCellMarker.prototype.getMarkerColor=function(e,n,t){return t?this.validColor:this.invalidColor},mxCellMarker.prototype.getState=function(e){var n=this.graph.getView();return cell=this.getCell(e),null!=(n=this.getStateToMark(n.getState(cell)))&&this.intersects(n,e)?n:null},mxCellMarker.prototype.getCell=function(e){return e.getCell()},mxCellMarker.prototype.getStateToMark=function(e){return e},mxCellMarker.prototype.intersects=function(e,n){return!this.hotspotEnabled||mxUtils.intersectsHotspot(e,n.getGraphX(),n.getGraphY(),this.hotspot,mxConstants.MIN_HOTSPOT_SIZE,mxConstants.MAX_HOTSPOT_SIZE)},mxCellMarker.prototype.destroy=function(){this.graph.getView().removeListener(this.resetHandler),this.graph.getModel().removeListener(this.resetHandler),this.highlight.destroy()},mxUtils.extend(mxSelectionCellsHandler,mxEventSource),mxSelectionCellsHandler.prototype.graph=null,mxSelectionCellsHandler.prototype.enabled=!0,mxSelectionCellsHandler.prototype.refreshHandler=null,mxSelectionCellsHandler.prototype.maxHandlers=100,mxSelectionCellsHandler.prototype.handlers=null,mxSelectionCellsHandler.prototype.isEnabled=function(){return this.enabled},mxSelectionCellsHandler.prototype.setEnabled=function(e){this.enabled=e},mxSelectionCellsHandler.prototype.getHandler=function(e){return this.handlers.get(e)},mxSelectionCellsHandler.prototype.reset=function(){this.handlers.visit(function(e,n){n.reset.apply(n)})},mxSelectionCellsHandler.prototype.refresh=function(){var e=this.handlers;this.handlers=new mxDictionary;for(var n=this.graph.getSelectionCells(),t=0;t<n.length;t++){var a=this.graph.view.getState(n[t]);if(null!=a){var i=e.remove(n[t]);null!=i&&(i.state!=a?(i.destroy(),i=null):i.redraw()),null==i&&(i=this.graph.createHandler(a),this.fireEvent(new mxEventObject(mxEvent.ADD,"state",a))),null!=i&&this.handlers.put(n[t],i)}}e.visit(mxUtils.bind(this,function(e,n){this.fireEvent(new mxEventObject(mxEvent.REMOVE,"state",n.state)),n.destroy()}))},mxSelectionCellsHandler.prototype.mouseDown=function(e,n){if(this.graph.isEnabled()&&this.isEnabled()){var t=[e,n];this.handlers.visit(function(e,n){n.mouseDown.apply(n,t)})}},mxSelectionCellsHandler.prototype.mouseMove=function(e,n){if(this.graph.isEnabled()&&this.isEnabled()){var t=[e,n];this.handlers.visit(function(e,n){n.mouseMove.apply(n,t)})}},mxSelectionCellsHandler.prototype.mouseUp=function(e,n){if(this.graph.isEnabled()&&this.isEnabled()){var t=[e,n];this.handlers.visit(function(e,n){n.mouseUp.apply(n,t)})}},mxSelectionCellsHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),null!=this.refreshHandler&&(this.graph.getSelectionModel().removeListener(this.refreshHandler),this.graph.getModel().removeListener(this.refreshHandler),this.graph.getView().removeListener(this.refreshHandler),this.refreshHandler=null)},mxUtils.extend(mxConnectionHandler,mxEventSource),mxConnectionHandler.prototype.graph=null,mxConnectionHandler.prototype.factoryMethod=!0,mxConnectionHandler.prototype.moveIconFront=!1,mxConnectionHandler.prototype.moveIconBack=!1,mxConnectionHandler.prototype.connectImage=null,mxConnectionHandler.prototype.targetConnectImage=!1,mxConnectionHandler.prototype.enabled=!0,mxConnectionHandler.prototype.select=!0,mxConnectionHandler.prototype.createTarget=!1;mxConnectionHandler.prototype.marker=null,mxConnectionHandler.prototype.constraintHandler=null,mxConnectionHandler.prototype.error=null,mxConnectionHandler.prototype.waypointsEnabled=!1,mxConnectionHandler.prototype.tapAndHoldEnabled=!0,mxConnectionHandler.prototype.tapAndHoldDelay=500,mxConnectionHandler.prototype.tapAndHoldInProgress=!1,mxConnectionHandler.prototype.tapAndHoldValid=!1,mxConnectionHandler.prototype.tapAndHoldTolerance=4,mxConnectionHandler.prototype.initialTouchX=0,mxConnectionHandler.prototype.initialTouchY=0,mxConnectionHandler.prototype.ignoreMouseDown=!1,mxConnectionHandler.prototype.first=null,mxConnectionHandler.prototype.connectIconOffset=new mxPoint(0,mxConstants.TOOLTIP_VERTICAL_OFFSET),mxConnectionHandler.prototype.edgeState=null,mxConnectionHandler.prototype.changeHandler=null,mxConnectionHandler.prototype.drillHandler=null,mxConnectionHandler.prototype.mouseDownCounter=0,mxConnectionHandler.prototype.movePreviewAway=mxClient.IS_VML,mxConnectionHandler.prototype.isEnabled=function(){return this.enabled},mxConnectionHandler.prototype.setEnabled=function(e){this.enabled=e},mxConnectionHandler.prototype.isCreateTarget=function(){return this.createTarget},mxConnectionHandler.prototype.setCreateTarget=function(e){this.createTarget=e},mxConnectionHandler.prototype.createShape=function(){var e=new mxPolyline([],mxConstants.INVALID_COLOR);if(e.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()),e.svgStrokeTolerance=0,e.pointerEvents=!1,e.isDashed=!0,this.graph.dialect==mxConstants.DIALECT_SVG)e.node.setAttribute("pointer-events","none");else{var n=mxUtils.bind(this,function(e){return e=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),this.graph.view.getState(this.graph.getCellAt(e.x,e.y))});mxEvent.redirectMouseEvents(e.node,this.graph,n)}return e},mxConnectionHandler.prototype.init=function(){this.graph.addMouseListener(this),this.marker=this.createMarker(),this.constraintHandler=new mxConstraintHandler(this.graph),this.changeHandler=mxUtils.bind(this,function(e){null!=this.iconState&&(this.iconState=this.graph.getView().getState(this.iconState.cell)),null!=this.iconState?this.redrawIcons(this.icons,this.iconState):(this.destroyIcons(this.icons),this.previous=null),this.constraintHandler.reset()}),this.graph.getModel().addListener(mxEvent.CHANGE,this.changeHandler),this.graph.getView().addListener(mxEvent.SCALE,this.changeHandler),this.graph.getView().addListener(mxEvent.TRANSLATE,this.changeHandler),this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE,this.changeHandler),this.drillHandler=mxUtils.bind(this,function(e){this.destroyIcons(this.icons)}),this.graph.addListener(mxEvent.START_EDITING,this.drillHandler),this.graph.getView().addListener(mxEvent.DOWN,this.drillHandler),this.graph.getView().addListener(mxEvent.UP,this.drillHandler)},mxConnectionHandler.prototype.isConnectableCell=function(e){return!0},mxConnectionHandler.prototype.createMarker=function(){var a=new mxCellMarker(this.graph);return a.hotspotEnabled=!0,a.getCell=mxUtils.bind(this,function(e,n){return n=mxCellMarker.prototype.getCell.apply(a,arguments),this.error=null,this.isConnectableCell(n)?(null!=n?this.isConnecting()?null!=this.previous&&(this.error=this.validateConnection(this.previous.cell,n),null!=this.error&&0==this.error.length&&(n=null,this.isCreateTarget()&&(this.error=null))):this.isValidSource(n)||(n=null):this.isConnecting()&&!this.isCreateTarget()&&!this.graph.allowDanglingEdges&&(this.error=""),n):null}),a.isValidState=mxUtils.bind(this,function(e){return this.isConnecting()?null==this.error:mxCellMarker.prototype.isValidState.apply(a,arguments)}),a.getMarkerColor=mxUtils.bind(this,function(e,n,t){return null==this.connectImage||this.isConnecting()?mxCellMarker.prototype.getMarkerColor.apply(a,arguments):null}),a.intersects=mxUtils.bind(this,function(e,n){return!(null==this.connectImage&&!this.isConnecting())||mxCellMarker.prototype.intersects.apply(a,arguments)}),a},mxConnectionHandler.prototype.start=function(e,n,t,a){this.previous=e,this.first=new mxPoint(n,t),this.edgeState=null!=a?a:this.createEdgeState(null),this.marker.currentColor=this.marker.validColor,this.marker.markedState=e,this.marker.mark(),this.fireEvent(new mxEventObject(mxEvent.START,"state",this.previous))},mxConnectionHandler.prototype.isConnecting=function(){return null!=this.first&&null!=this.shape},mxConnectionHandler.prototype.isValidSource=function(e){return this.graph.isValidSource(e)},mxConnectionHandler.prototype.isValidTarget=function(e){return!0},mxConnectionHandler.prototype.validateConnection=function(e,n){return this.isValidTarget(n)?this.graph.getEdgeValidationError(null,e,n):""},mxConnectionHandler.prototype.getConnectImage=function(e){return this.connectImage},mxConnectionHandler.prototype.isMoveIconToFrontForState=function(e){return null!=e.text&&e.text.node.parentNode==this.graph.container||this.moveIconFront},mxConnectionHandler.prototype.createIcons=function(e){if(null==(i=this.getConnectImage(e))||null==e)return null;this.iconState=e;var n=[],t=new mxImageShape(new mxRectangle(0,0,i.width,i.height),i.src,null,null,0);t.preserveImageAspect=!1,this.isMoveIconToFrontForState(e)?(t.dialect=mxConstants.DIALECT_STRICTHTML,t.init(this.graph.container)):(t.dialect=this.graph.dialect==mxConstants.DIALECT_SVG?mxConstants.DIALECT_SVG:mxConstants.DIALECT_VML,t.init(this.graph.getView().getOverlayPane()),this.moveIconBack&&null!=t.node.previousSibling&&t.node.parentNode.insertBefore(t.node,t.node.parentNode.firstChild)),t.node.style.cursor=mxConstants.CURSOR_CONNECT;var a=mxUtils.bind(this,function(){return null!=this.currentState?this.currentState:e}),i=mxUtils.bind(this,function(e){mxEvent.isConsumed(e)||(this.icon=t,this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,a())))});return mxEvent.redirectMouseEvents(t.node,this.graph,a,i),n.push(t),this.redrawIcons(n,this.iconState),n},mxConnectionHandler.prototype.redrawIcons=function(e,n){if(null!=e&&null!=e[0]&&null!=n){var t=this.getIconPosition(e[0],n);e[0].bounds.x=t.x,e[0].bounds.y=t.y,e[0].redraw()}},mxConnectionHandler.prototype.getIconPosition=function(e,n){var t=this.graph.getView().scale,a=n.getCenterX(),i=n.getCenterY();if(this.graph.isSwimlane(n.cell)){a=0!=(s=this.graph.getStartSize(n.cell)).width?n.x+s.width*t/2:a,i=0!=s.height?n.y+s.height*t/2:i;if(0!=(s=mxUtils.toRadians(mxUtils.getValue(n.style,mxConstants.STYLE_ROTATION)||0))){t=Math.cos(s);var s=Math.sin(s),o=new mxPoint(n.getCenterX(),n.getCenterY());a=(i=mxUtils.getRotatedPoint(new mxPoint(a,i),t,s,o)).x,i=i.y}}return new mxPoint(a-e.bounds.width/2,i-e.bounds.height/2)},mxConnectionHandler.prototype.destroyIcons=function(e){if(null!=e){this.iconState=null;for(var n=0;n<e.length;n++)e[n].destroy()}},mxConnectionHandler.prototype.isStartEvent=function(e){return!this.graph.isForceMarqueeEvent(e.getEvent())&&(null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentConstraint||null!=this.previous&&null==this.error&&(null==this.icons||null!=this.icons&&null!=this.icon))},mxConnectionHandler.prototype.mouseDown=function(e,n){if(this.mouseDownCounter++,this.isEnabled()&&this.graph.isEnabled()&&!n.isConsumed()&&!this.isConnecting()&&this.isStartEvent(n)){if(null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentPoint?(this.sourceConstraint=this.constraintHandler.currentConstraint,this.previous=this.constraintHandler.currentFocus,this.first=this.constraintHandler.currentPoint.clone()):this.first=new mxPoint(n.getGraphX(),n.getGraphY()),this.edgeState=this.createEdgeState(n),this.mouseDownCounter=1,this.waypointsEnabled&&null==this.shape&&(this.waypoints=null,this.shape=this.createShape()),null==this.previous&&null!=this.edgeState){var t=this.graph.getPointForEvent(n.getEvent());this.edgeState.cell.geometry.setTerminalPoint(t,!0)}this.fireEvent(new mxEventObject(mxEvent.START,"state",this.previous)),n.consume()}else if(mxClient.IS_TOUCH&&this.tapAndHoldEnabled&&!this.tapAndHoldInProgress&&this.isEnabled()&&this.graph.isEnabled()&&!this.isConnecting()){this.tapAndHoldInProgress=!0,this.initialTouchX=n.getX(),this.initialTouchY=n.getY();var a=this.graph.view.getState(this.marker.getCell(n));this.tapAndHoldThread&&window.clearTimeout(this.tapAndHoldThread),this.tapAndHoldThread=window.setTimeout(mxUtils.bind(this,function(){this.tapAndHoldValid&&this.tapAndHold(n,a),this.tapAndHoldValid=this.tapAndHoldInProgress=!1}),this.tapAndHoldDelay),this.tapAndHoldValid=!0}this.selectedIcon=this.icon,this.icon=null},mxConnectionHandler.prototype.tapAndHold=function(e,n){null!=n&&(this.marker.currentColor=this.marker.validColor,this.marker.markedState=n,this.marker.mark(),this.first=new mxPoint(e.getGraphX(),e.getGraphY()),this.edgeState=this.createEdgeState(e),this.previous=n,this.fireEvent(new mxEventObject(mxEvent.START,"state",this.previous)))},mxConnectionHandler.prototype.isImmediateConnectSource=function(e){return!this.graph.isCellMovable(e.cell)},mxConnectionHandler.prototype.createEdgeState=function(e){return null},mxConnectionHandler.prototype.updateCurrentState=function(e){var n=this.marker.process(e);this.constraintHandler.update(e,null==this.first),this.currentState=n},mxConnectionHandler.prototype.convertWaypoint=function(e){var n=this.graph.getView().getScale(),t=this.graph.getView().getTranslate();e.x=e.x/n-t.x,e.y=e.y/n-t.y},mxConnectionHandler.prototype.mouseMove=function(e,n){if(this.tapAndHoldValid&&(this.tapAndHoldValid=Math.abs(this.initialTouchX-n.getX())<this.tapAndHoldTolerance&&Math.abs(this.initialTouchY-n.getY())<this.tapAndHoldTolerance),n.isConsumed()||!this.ignoreMouseDown&&null==this.first&&this.graph.isMouseDown)this.constraintHandler.reset();else{if(!this.isEnabled()&&null!=this.currentState&&(this.destroyIcons(this.icons),this.currentState=null),(null!=this.first||this.isEnabled()&&this.graph.isEnabled())&&this.updateCurrentState(n),null!=this.first){var t=this.graph.getView().scale,a=null,i=t=new mxPoint(this.graph.snap(n.getGraphX()/t)*t,this.graph.snap(n.getGraphY()/t)*t);null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentPoint&&(a=this.constraintHandler.currentConstraint,i=this.constraintHandler.currentPoint.clone());var s=this.first;if(null!=this.selectedIcon){var o=this.selectedIcon.bounds.width,r=this.selectedIcon.bounds.height;null!=this.currentState&&this.targetConnectImage?(o=this.getIconPosition(this.selectedIcon,this.currentState),this.selectedIcon.bounds.x=o.x,this.selectedIcon.bounds.y=o.y):(o=new mxRectangle(n.getGraphX()+this.connectIconOffset.x,n.getGraphY()+this.connectIconOffset.y,o,r),this.selectedIcon.bounds=o),this.selectedIcon.redraw()}if(null!=this.edgeState){if(this.edgeState.absolutePoints=[null,null!=this.currentState?null:i],this.graph.view.updateFixedTerminalPoint(this.edgeState,this.previous,!0,this.sourceConstraint),null!=this.currentState&&(null==a&&(a=this.graph.getConnectionConstraint(this.edgeState,this.previous,!1)),this.edgeState.setAbsoluteTerminalPoint(null,!1),this.graph.view.updateFixedTerminalPoint(this.edgeState,this.currentState,!1,a)),(s=null)!=this.waypoints)for(s=[],i=0;i<this.waypoints.length;i++)a=this.waypoints[i].clone(),this.convertWaypoint(a),s[i]=a;this.graph.view.updatePoints(this.edgeState,s,this.previous,this.currentState),this.graph.view.updateFloatingTerminalPoints(this.edgeState,this.previous,this.currentState),i=this.edgeState.absolutePoints[this.edgeState.absolutePoints.length-1],s=this.edgeState.absolutePoints[0]}else null!=this.currentState&&null==this.constraintHandler.currentConstraint&&(null!=(o=this.getTargetPerimeterPoint(this.currentState,n))&&(i=o)),null==this.sourceConstraint&&null!=this.previous&&(null!=(o=this.getSourcePerimeterPoint(this.previous,null!=this.waypoints&&0<this.waypoints.length?this.waypoints[0]:i,n))&&(s=o));if(null==this.currentState&&this.movePreviewAway){if(o=s,null!=this.edgeState&&2<this.edgeState.absolutePoints.length&&(null!=(a=this.edgeState.absolutePoints[this.edgeState.absolutePoints.length-2])&&(o=a)),a=i.x-o.x,o=i.y-o.y,0==(r=Math.sqrt(a*a+o*o)))return;i.x-=4*a/r,i.y-=4*o/r}null==this.shape&&(a=Math.abs(t.x-this.first.x),o=Math.abs(t.y-this.first.y),a>this.graph.tolerance||o>this.graph.tolerance)&&(this.shape=this.createShape(),this.updateCurrentState(n)),null!=this.shape&&(null!=this.edgeState?this.shape.points=this.edgeState.absolutePoints:(t=[s],null!=this.waypoints&&(t=t.concat(this.waypoints)),t.push(i),this.shape.points=t),this.drawPreview()),mxEvent.consume(n.getEvent()),n.consume()}else this.isEnabled()&&this.graph.isEnabled()?this.previous!=this.currentState&&null==this.edgeState?(this.destroyIcons(this.icons),(this.icons=null)!=this.currentState&&null==this.error&&(this.icons=this.createIcons(this.currentState),null==this.icons&&(this.currentState.setCursor(mxConstants.CURSOR_CONNECT),n.consume())),this.previous=this.currentState):this.previous==this.currentState&&null!=this.currentState&&null==this.icons&&!this.graph.isMouseDown&&n.consume():this.constraintHandler.reset();if(null!=this.constraintHandler.currentConstraint&&this.marker.reset(),!this.graph.isMouseDown&&null!=this.currentState&&null!=this.icons){for(t=!1,s=n.getSource(),i=0;i<this.icons.length&&!t;i++)t=s==this.icons[i].node||s.parentNode==this.icons[i].node;t||this.updateIcons(this.currentState,this.icons,n)}}},mxConnectionHandler.prototype.getTargetPerimeterPoint=function(e,n){var t=null,a=(i=e.view).getPerimeterFunction(e);if(null!=a){var i,s=null!=this.waypoints&&0<this.waypoints.length?this.waypoints[this.waypoints.length-1]:new mxPoint(this.previous.getCenterX(),this.previous.getCenterY());null!=(i=a(i.getPerimeterBounds(e),this.edgeState,s,!1))&&(t=i)}else t=new mxPoint(e.getCenterX(),e.getCenterY());return t},mxConnectionHandler.prototype.getSourcePerimeterPoint=function(e,n,t){t=null;var a=e.view,i=a.getPerimeterFunction(e),s=new mxPoint(e.getCenterX(),e.getCenterY());if(null!=i){var o=mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION,0),r=-o*(Math.PI/180);0!=o&&(n=mxUtils.getRotatedPoint(new mxPoint(n.x,n.y),Math.cos(r),Math.sin(r),s)),null!=(e=i(a.getPerimeterBounds(e),e,n,!1))&&(0!=o&&(e=mxUtils.getRotatedPoint(new mxPoint(e.x,e.y),Math.cos(-r),Math.sin(-r),s)),t=e)}else t=s;return t},mxConnectionHandler.prototype.updateIcons=function(e,n,t){},mxConnectionHandler.prototype.isStopEvent=function(e){return null!=e.getState()},mxConnectionHandler.prototype.addWaypointForEvent=function(e){var n=mxUtils.convertPoint(this.graph.container,e.getX(),e.getY()),t=Math.abs(n.x-this.first.x);n=Math.abs(n.y-this.first.y);(null!=this.waypoints||1<this.mouseDownCounter&&(t>this.graph.tolerance||n>this.graph.tolerance))&&(null==this.waypoints&&(this.waypoints=[]),t=this.graph.view.scale,n=new mxPoint(this.graph.snap(e.getGraphX()/t)*t,this.graph.snap(e.getGraphY()/t)*t),this.waypoints.push(n))},mxConnectionHandler.prototype.mouseUp=function(e,n){if(!n.isConsumed()&&this.isConnecting()){if(this.waypointsEnabled&&!this.isStopEvent(n))return this.addWaypointForEvent(n),void n.consume();if(null==this.error){var t=null!=this.previous?this.previous.cell:null,a=null;null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(a=this.constraintHandler.currentFocus.cell),null==a&&this.marker.hasValidState()&&(a=this.marker.validState.cell),this.connect(t,a,n.getEvent(),n.getCell())}else null!=this.previous&&null!=this.marker.validState&&this.previous.cell==this.marker.validState.cell&&this.graph.selectCellForEvent(this.marker.source,evt),0<this.error.length&&this.graph.validationAlert(this.error);this.destroyIcons(this.icons),n.consume()}null!=this.first&&this.reset(),this.tapAndHoldValid=this.tapAndHoldInProgress=!1},mxConnectionHandler.prototype.reset=function(){null!=this.shape&&(this.shape.destroy(),this.shape=null),this.destroyIcons(this.icons),this.icons=null,this.marker.reset(),this.constraintHandler.reset(),this.sourceConstraint=this.error=this.previous=this.edgeState=this.selectedIcon=null,this.mouseDownCounter=0,this.icon=this.first=null,this.fireEvent(new mxEventObject(mxEvent.RESET))},mxConnectionHandler.prototype.drawPreview=function(){var e=null==this.error;this.shape.strokewidth=this.getEdgeWidth(e),e=this.getEdgeColor(e),this.shape.stroke=e,this.shape.redraw()},mxConnectionHandler.prototype.getEdgeColor=function(e){return e?mxConstants.VALID_COLOR:mxConstants.INVALID_COLOR},mxConnectionHandler.prototype.getEdgeWidth=function(e){return e?3:1},mxConnectionHandler.prototype.connect=function(e,n,t,a){if(null!=n||this.isCreateTarget()||this.graph.allowDanglingEdges){var i=this.graph.getModel(),s=null;i.beginUpdate();try{if(null!=e&&null==n&&this.isCreateTarget()&&null!=(n=this.createTargetVertex(t,e))){if(null!=(a=this.graph.getDropTarget([n],t,a))&&this.graph.getModel().isEdge(a))a=this.graph.getDefaultParent();else{var o=this.graph.getView().getState(a);if(null!=o){var r=i.getGeometry(n);r.x-=o.origin.x,r.y-=o.origin.y}}this.graph.addCell(n,a)}var l=this.graph.getDefaultParent();if(null!=e&&null!=n&&i.getParent(e)==i.getParent(n)&&i.getParent(i.getParent(e))!=i.getRoot()&&(l=i.getParent(e),null!=e.geometry&&e.geometry.relative&&null!=n.geometry&&n.geometry.relative&&(l=i.getParent(l))),r=o=null,null!=this.edgeState&&(o=this.edgeState.cell.value,r=this.edgeState.cell.style),null!=(s=this.insertEdge(l,null,o,e,n,r))){this.graph.setConnectionConstraint(s,e,!0,this.sourceConstraint),this.graph.setConnectionConstraint(s,n,!1,this.constraintHandler.currentConstraint),null!=this.edgeState&&i.setGeometry(s,this.edgeState.cell.geometry);var d=i.getGeometry(s);if(null==d&&((d=new mxGeometry).relative=!0,i.setGeometry(s,d)),null!=this.waypoints&&0<this.waypoints.length){var c=this.graph.view.scale,m=this.graph.view.translate;for(d.points=[],e=0;e<this.waypoints.length;e++){var u=this.waypoints[e];d.points.push(new mxPoint(u.x/c-m.x,u.y/c-m.y))}}null==n&&((u=this.graph.getPointForEvent(t,!1)).x-=this.graph.panDx/this.graph.view.scale,u.y-=this.graph.panDy/this.graph.view.scale,d.setTerminalPoint(u,!1)),this.fireEvent(new mxEventObject(mxEvent.CONNECT,"cell",s,"event",t,"target",a))}}catch(e){mxLog.show(),mxLog.debug(e.message)}finally{i.endUpdate()}this.select&&this.selectCells(s,n)}},mxConnectionHandler.prototype.selectCells=function(e,n){this.graph.setSelectionCell(e)},mxConnectionHandler.prototype.insertEdge=function(e,n,t,a,i,s){return null==this.factoryMethod?this.graph.insertEdge(e,n,t,a,i,s):(n=this.createEdge(t,a,i,s),this.graph.addEdge(n,e,a,i))},mxConnectionHandler.prototype.createTargetVertex=function(e,n){for(var t=this.graph.getCellGeometry(n);null!=t&&t.relative;)n=this.graph.getModel().getParent(n),t=this.graph.getCellGeometry(n);var a=this.graph.cloneCells([n])[0];if(null!=(t=this.graph.getModel().getGeometry(a))){var i=this.graph.getPointForEvent(e);if(t.x=this.graph.snap(i.x-t.width/2)-this.graph.panDx/this.graph.view.scale,t.y=this.graph.snap(i.y-t.height/2)-this.graph.panDy/this.graph.view.scale,null!=this.first){var s=this.graph.view.getState(n);if(null!=s){var o=this.getAlignmentTolerance();Math.abs(this.graph.snap(this.first.x)-this.graph.snap(i.x))<=o?t.x=s.x:Math.abs(this.graph.snap(this.first.y)-this.graph.snap(i.y))<=o&&(t.y=s.y)}}}return a},mxConnectionHandler.prototype.getAlignmentTolerance=function(){return this.graph.isGridEnabled()?this.graph.gridSize:this.graph.tolerance},mxConnectionHandler.prototype.createEdge=function(e,n,t,a){var i=null;return null!=this.factoryMethod&&(i=this.factoryMethod(n,t,a)),null==i&&((i=new mxCell(e||"")).setEdge(!0),i.setStyle(a),(e=new mxGeometry).relative=!0,i.setGeometry(e)),i},mxConnectionHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),null!=this.shape&&(this.shape.destroy(),this.shape=null),null!=this.marker&&(this.marker.destroy(),this.marker=null),null!=this.constraintHandler&&(this.constraintHandler.destroy(),this.constraintHandler=null),null!=this.changeHandler&&(this.graph.getModel().removeListener(this.changeHandler),this.graph.getView().removeListener(this.changeHandler),this.changeHandler=null),null!=this.drillHandler&&(this.graph.removeListener(this.drillHandler),this.graph.getView().removeListener(this.drillHandler),this.drillHandler=null)},mxConstraintHandler.prototype.pointImage=new mxImage(mxClient.imageBasePath+"/point.gif",5,5),mxConstraintHandler.prototype.graph=null,mxConstraintHandler.prototype.enabled=!0,mxConstraintHandler.prototype.highlightColor=mxConstants.DEFAULT_VALID_COLOR,mxConstraintHandler.prototype.isEnabled=function(){return this.enabled},mxConstraintHandler.prototype.setEnabled=function(e){this.enabled=e},mxConstraintHandler.prototype.reset=function(){if(null!=this.focusIcons){for(var e=0;e<this.focusIcons.length;e++)this.focusIcons[e].destroy();this.focusIcons=null}null!=this.focusHighlight&&(this.focusHighlight.destroy(),this.focusHighlight=null),this.focusPoints=this.currentFocus=this.currentPoint=this.currentFocusArea=this.currentConstraint=null},mxConstraintHandler.prototype.getTolerance=function(){return this.graph.getTolerance()},mxConstraintHandler.prototype.getImageForConstraint=function(e,n,t){return this.pointImage},mxConstraintHandler.prototype.isEventIgnored=function(e,n){return!1},mxConstraintHandler.prototype.update=function(e,n){if(this.isEnabled()&&!this.isEventIgnored(e)){var t=this.getTolerance(),a=new mxRectangle(e.getGraphX()-t,e.getGraphY()-t,2*t,2*t),i=null!=e.getCell()&&this.graph.isCellConnectable(e.getCell());if((null==this.currentFocusArea||!mxUtils.intersects(this.currentFocusArea,a)||null!=e.getState()&&null!=this.currentFocus&&i)&&(this.currentFocusArea=null,e.getState()!=this.currentFocus))if(this.currentFocus=null,this.constraints=null!=e.getState()&&i?this.graph.getAllConnectionConstraints(e.getState(),n):null,null!=this.constraints){if(this.currentFocus=e.getState(),this.currentFocusArea=new mxRectangle(e.getState().x,e.getState().y,e.getState().width,e.getState().height),null!=this.focusIcons){for(i=0;i<this.focusIcons.length;i++)this.focusIcons[i].destroy();this.focusPoints=this.focusIcons=null}for(this.focusIcons=[],this.focusPoints=[],i=0;i<this.constraints.length;i++){var s,o=this.graph.getConnectionPoint(e.getState(),this.constraints[i]),r=(s=this.getImageForConstraint(e.getState(),this.constraints[i],o)).src;(s=new mxImageShape(s=new mxRectangle(o.x-s.width/2,o.y-s.height/2,s.width,s.height),r)).dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,s.preserveImageAspect=!1,s.init(this.graph.getView().getOverlayPane()),null!=s.node.previousSibling&&s.node.parentNode.insertBefore(s.node,s.node.parentNode.firstChild),r=mxUtils.bind(this,function(){return null!=this.currentFocus?this.currentFocus:e.getState()}),s.redraw(),mxEvent.redirectMouseEvents(s.node,this.graph,r),this.currentFocusArea.add(s.bounds),this.focusIcons.push(s),this.focusPoints.push(o)}this.currentFocusArea.grow(t)}else if(null!=this.focusIcons){for(null!=this.focusHighlight&&(this.focusHighlight.destroy(),this.focusHighlight=null),i=0;i<this.focusIcons.length;i++)this.focusIcons[i].destroy();this.focusPoints=this.focusIcons=null}if(this.currentPoint=this.currentConstraint=null,null!=this.focusIcons&&null!=this.constraints&&(null==e.getState()||this.currentFocus==e.getState()))for(i=0;i<this.focusIcons.length;i++)if(mxUtils.intersects(this.focusIcons[i].bounds,a)){this.currentConstraint=this.constraints[i],this.currentPoint=this.focusPoints[i],(t=this.focusIcons[i].bounds.clone()).grow(mxClient.IS_IE?3:2),mxClient.IS_IE&&(t.width-=1,t.height-=1),null==this.focusHighlight?((t=new mxRectangleShape(t,null,this.highlightColor,3)).dialect=this.graph.dialect==mxConstants.DIALECT_SVG?mxConstants.DIALECT_SVG:mxConstants.DIALECT_VML,t.init(this.graph.getView().getOverlayPane()),this.focusHighlight=t,r=mxUtils.bind(this,function(){return null!=this.currentFocus?this.currentFocus:e.getState()}),mxEvent.redirectMouseEvents(t.node,this.graph,r)):(this.focusHighlight.bounds=t,this.focusHighlight.redraw());break}null==this.currentConstraint&&null!=this.focusHighlight&&(this.focusHighlight.destroy(),this.focusHighlight=null)}},mxConstraintHandler.prototype.destroy=function(){this.reset()},mxRubberband.prototype.defaultOpacity=20,mxRubberband.prototype.enabled=!0,mxRubberband.prototype.div=null,mxRubberband.prototype.sharedDiv=null,mxRubberband.prototype.currentX=0,mxRubberband.prototype.currentY=0,mxRubberband.prototype.isEnabled=function(){return this.enabled},mxRubberband.prototype.setEnabled=function(e){this.enabled=e},mxRubberband.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.isEnabled()&&this.graph.isEnabled()&&(this.graph.isForceMarqueeEvent(n.getEvent())||null==n.getState())){var t=mxUtils.getOffset(this.graph.container),a=mxUtils.getScrollOrigin(this.graph.container);if(a.x-=t.x,a.y-=t.y,this.start(n.getX()+a.x,n.getY()+a.y),mxClient.IS_NS&&!mxClient.IS_SF&&!mxClient.IS_GC){var i=this.graph.container,s=function(e){e=new mxMouseEvent(e);var n=mxUtils.convertPoint(i,e.getX(),e.getY());return e.graphX=n.x,e.graphY=n.y,e};this.dragHandler=mxUtils.bind(this,function(e){this.mouseMove(this.graph,s(e))}),this.dropHandler=mxUtils.bind(this,function(e){this.mouseUp(this.graph,s(e))}),mxEvent.addListener(document,"mousemove",this.dragHandler),mxEvent.addListener(document,"mouseup",this.dropHandler)}n.consume(!1)}},mxRubberband.prototype.start=function(e,n){this.first=new mxPoint(e,n)},mxRubberband.prototype.mouseMove=function(e,n){if(!n.isConsumed()&&null!=this.first){var t=mxUtils.getScrollOrigin(this.graph.container),a=mxUtils.getOffset(this.graph.container);t.x-=a.x,t.y-=a.y;a=n.getX()+t.x,t=n.getY()+t.y;var i=this.first.x-a,s=this.first.y-t,o=this.graph.tolerance;(null!=this.div||Math.abs(i)>o||Math.abs(s)>o)&&(null==this.div&&(this.div=this.createShape()),mxUtils.clearSelection(),this.update(a,t),n.consume())}},mxRubberband.prototype.createShape=function(){return null==this.sharedDiv&&(this.sharedDiv=document.createElement("div"),this.sharedDiv.className="mxRubberband",mxUtils.setOpacity(this.sharedDiv,this.defaultOpacity)),this.graph.container.appendChild(this.sharedDiv),this.sharedDiv},mxRubberband.prototype.mouseUp=function(e,n){var t=null!=this.div;this.reset(),t&&(t=new mxRectangle(this.x,this.y,this.width,this.height),this.graph.selectRegion(t,n.getEvent()),n.consume())},mxRubberband.prototype.reset=function(){null!=this.div&&this.div.parentNode.removeChild(this.div),null!=this.dragHandler&&(mxEvent.removeListener(document,"mousemove",this.dragHandler),this.dragHandler=null),null!=this.dropHandler&&(mxEvent.removeListener(document,"mouseup",this.dropHandler),this.dropHandler=null),this.currentY=this.currentX=0,this.div=this.first=null},mxRubberband.prototype.update=function(e,n){this.currentX=e,this.currentY=n,this.repaint()},mxRubberband.prototype.repaint=function(){if(null!=this.div){var e=this.currentX-this.graph.panDx,n=this.currentY-this.graph.panDy;this.x=Math.min(this.first.x,e),this.y=Math.min(this.first.y,n),this.width=Math.max(this.first.x,e)-this.x,this.height=Math.max(this.first.y,n)-this.y,e=mxClient.IS_VML?this.graph.panDy:0,this.div.style.left=this.x+(mxClient.IS_VML?this.graph.panDx:0)+"px",this.div.style.top=this.y+e+"px",this.div.style.width=Math.max(1,this.width)+"px",this.div.style.height=Math.max(1,this.height)+"px"}},mxRubberband.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.graph.removeMouseListener(this),this.graph.removeListener(this.panHandler),this.reset(),null!=this.sharedDiv&&(this.sharedDiv=null))},mxVertexHandler.prototype.graph=null,mxVertexHandler.prototype.state=null,mxVertexHandler.prototype.singleSizer=!1,mxVertexHandler.prototype.index=null,mxVertexHandler.prototype.allowHandleBoundsCheck=!0,mxVertexHandler.prototype.handleImage=null,mxVertexHandler.prototype.tolerance=0,mxVertexHandler.prototype.rotationEnabled=!1,mxVertexHandler.prototype.rotationRaster=!0,mxVertexHandler.prototype.init=function(){if(this.graph=this.state.view.graph,this.selectionBounds=this.getSelectionBounds(this.state),this.bounds=new mxRectangle(this.selectionBounds.x,this.selectionBounds.y,this.selectionBounds.width,this.selectionBounds.height),this.selectionBorder=this.createSelectionShape(this.bounds),this.selectionBorder.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.selectionBorder.pointerEvents=!1,this.selectionBorder.init(this.graph.getView().getOverlayPane()),this.graph.isCellMovable(this.state.cell)&&(this.selectionBorder.node.style.cursor=mxConstants.CURSOR_MOVABLE_VERTEX),mxEvent.redirectMouseEvents(this.selectionBorder.node,this.graph,this.state),mxGraphHandler.prototype.maxCells<=0||this.graph.getSelectionCount()<mxGraphHandler.prototype.maxCells){var e=this.graph.isCellResizable(this.state.cell);if(this.sizers=[],e||this.graph.isLabelMovable(this.state.cell)&&2<=this.state.width&&2<=this.state.height){var n=0;e&&(this.singleSizer||(this.sizers.push(this.createSizer("nw-resize",n++)),this.sizers.push(this.createSizer("n-resize",n++)),this.sizers.push(this.createSizer("ne-resize",n++)),this.sizers.push(this.createSizer("w-resize",n++)),this.sizers.push(this.createSizer("e-resize",n++)),this.sizers.push(this.createSizer("sw-resize",n++)),this.sizers.push(this.createSizer("s-resize",n++))),this.sizers.push(this.createSizer("se-resize",n++))),null!=(e=this.graph.model.getGeometry(this.state.cell))&&!e.relative&&!this.graph.isSwimlane(this.state.cell)&&this.graph.isLabelMovable(this.state.cell)&&(this.labelShape=this.createSizer(mxConstants.CURSOR_LABEL_HANDLE,mxEvent.LABEL_HANDLE,mxConstants.LABEL_HANDLE_SIZE,mxConstants.LABEL_HANDLE_FILLCOLOR),this.sizers.push(this.labelShape))}else this.graph.isCellMovable(this.state.cell)&&!this.graph.isCellResizable(this.state.cell)&&this.state.width<2&&this.state.height<2&&(this.labelShape=this.createSizer(mxConstants.CURSOR_MOVABLE_VERTEX,null,null,mxConstants.LABEL_HANDLE_FILLCOLOR),this.sizers.push(this.labelShape))}this.rotationEnabled&&(mxGraphHandler.prototype.maxCells<=0||this.graph.getSelectionCount()<mxGraphHandler.prototype.maxCells)&&(this.rotationShape=this.createSizer("pointer",mxEvent.ROTATION_HANDLE,mxConstants.HANDLE_SIZE+3,mxConstants.HANDLE_FILLCOLOR),this.sizers.push(this.rotationShape)),this.redraw()},mxVertexHandler.prototype.getSelectionBounds=function(e){return new mxRectangle(Math.round(e.x),Math.round(e.y),Math.round(e.width),Math.round(e.height))},mxVertexHandler.prototype.createSelectionShape=function(e){return(e=new mxRectangleShape(e,null,this.getSelectionColor())).strokewidth=this.getSelectionStrokeWidth(),e.isDashed=this.isSelectionDashed(),e},mxVertexHandler.prototype.getSelectionColor=function(){return mxConstants.VERTEX_SELECTION_COLOR},mxVertexHandler.prototype.getSelectionStrokeWidth=function(){return mxConstants.VERTEX_SELECTION_STROKEWIDTH},mxVertexHandler.prototype.isSelectionDashed=function(){return mxConstants.VERTEX_SELECTION_DASHED},mxVertexHandler.prototype.createSizer=function(e,n,t,a){return t=new mxRectangle(0,0,t=t||mxConstants.HANDLE_SIZE,t),(a=this.createSizerShape(t,n,a)).isHtmlAllowed()&&null!=this.state.text&&this.state.text.node.parentNode==this.graph.container?(a.bounds.height-=1,a.bounds.width-=1,a.dialect=mxConstants.DIALECT_STRICTHTML,a.init(this.graph.container)):(a.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,a.init(this.graph.getView().getOverlayPane())),mxEvent.redirectMouseEvents(a.node,this.graph,this.state),this.graph.isEnabled()&&(a.node.style.cursor=e),this.isSizerVisible(n)||(a.node.style.visibility="hidden"),a},mxVertexHandler.prototype.isSizerVisible=function(e){return!0},mxVertexHandler.prototype.createSizerShape=function(e,n,t){return null!=this.handleImage?(e.width=this.handleImage.width,e.height=this.handleImage.height,new mxImageShape(e,this.handleImage.src)):n==mxEvent.ROTATION_HANDLE?new mxEllipse(e,t||mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR):new mxRectangleShape(e,t||mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR)},mxVertexHandler.prototype.moveSizerTo=function(e,n,t){null!=e&&(e.bounds.x=Math.round(n-e.bounds.width/2),e.bounds.y=Math.round(t-e.bounds.height/2),e.redraw())},mxVertexHandler.prototype.getHandleForEvent=function(e){if(e.isSource(this.rotationShape))return mxEvent.ROTATION_HANDLE;if(e.isSource(this.labelShape))return mxEvent.LABEL_HANDLE;if(null!=this.sizers)for(var n=this.tolerance,t=(n=this.allowHandleBoundsCheck&&(mxClient.IS_IE||0<n)?new mxRectangle(e.getGraphX()-n,e.getGraphY()-n,2*n,2*n):null,0);t<this.sizers.length;t++)if(e.isSource(this.sizers[t])||null!=n&&mxUtils.intersects(this.sizers[t].bounds,n))return t;return null},mxVertexHandler.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(n.getEvent())&&(0<this.tolerance||n.getState()==this.state)){var t=this.getHandleForEvent(n);null!=t&&(this.start(n.getX(),n.getY(),t),n.consume())}},mxVertexHandler.prototype.start=function(e,n,t){e=mxUtils.convertPoint(this.graph.container,e,n),this.startX=e.x,this.startY=e.y,this.index=t,this.selectionBorder.node.style.display=t==mxEvent.ROTATION_HANDLE?"inline":"none",this.preview=this.createSelectionShape(this.bounds),mxClient.IS_SVG&&0!=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0")||null==this.state.text||this.state.text.node.parentNode!=this.graph.container?(this.preview.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.preview.init(this.graph.view.getOverlayPane())):(this.preview.dialect=mxConstants.DIALECT_STRICTHTML,this.preview.init(this.graph.container))},mxVertexHandler.prototype.mouseMove=function(e,n){if(n.isConsumed()||null==this.index)null!=this.getHandleForEvent(n)&&n.consume(!1);else{var t=new mxPoint(n.getGraphX(),n.getGraphY()),a=this.graph.isGridEnabledEvent(n.getEvent()),i=this.graph.getView().scale;if(this.index==mxEvent.LABEL_HANDLE)a&&(t.x=this.graph.snap(t.x/i)*i,t.y=this.graph.snap(t.y/i)*i),this.moveSizerTo(this.sizers[this.sizers.length-1],t.x,t.y);else if(this.index==mxEvent.ROTATION_HANDLE){var s=this.state.x+this.state.width/2-t.x,o=this.state.y+this.state.height/2-t.y;this.currentAlpha=0!=s?180*Math.atan(o/s)/Math.PI+90:o<0?180:0,0<s&&(this.currentAlpha-=180),this.rotationRaster&&(s=t.x-this.state.getCenterX(),o=t.y-this.state.getCenterY(),s=Math.abs(Math.sqrt(s*s+o*o)-this.state.height/2-20),s=Math.max(1,5*Math.min(3,Math.max(0,Math.round(80/Math.abs(s))))),this.currentAlpha=Math.round(this.currentAlpha/s)*s),this.selectionBorder.rotation=this.currentAlpha,this.selectionBorder.redraw()}else{var r=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),l=Math.cos(-r),d=Math.sin(-r),c=new mxPoint(this.state.getCenterX(),this.state.getCenterY()),m=(s=t.x-this.startX,o=t.y-this.startY,t=this.graph.view.translate,d*s+l*o);s=l*s-d*o;this.bounds=this.union(this.selectionBounds,s,m,this.index,a,i,t),l=Math.cos(r),c=(d=Math.sin(r))*(s=(o=new mxPoint(this.bounds.getCenterX(),this.bounds.getCenterY())).x-c.x)+l*(o=o.y-c.y)-o,this.bounds.x+=l*s-d*o-s,this.bounds.y+=c,this.drawPreview()}n.consume()}},mxVertexHandler.prototype.mouseUp=function(e,n){if(!n.isConsumed()&&null!=this.index&&null!=this.state){var t=new mxPoint(n.getGraphX(),n.getGraphY());this.graph.getModel().beginUpdate();try{if(this.index==mxEvent.ROTATION_HANDLE)null!=this.currentAlpha&&this.rotateCell(this.state.cell,this.currentAlpha-(this.state.style[mxConstants.STYLE_ROTATION]||0));else{var a=this.graph.isGridEnabledEvent(n.getEvent()),i=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),s=Math.cos(-i),o=Math.sin(-i),r=(t=o*(r=t.x-this.startX)+s*(l=t.y-this.startY),s*r-o*l),l=t,d=this.graph.view.scale;this.resizeCell(this.state.cell,r/d,l/d,this.index,a)}}finally{this.graph.getModel().endUpdate()}this.reset(),n.consume()}},mxVertexHandler.prototype.rotateCell=function(e,n){var t=this.graph.getModel();if(t.isVertex(e)){if(null!=(s=e==this.state?this.state:this.graph.view.getState(e))&&this.graph.setCellStyles(mxConstants.STYLE_ROTATION,(s.style[mxConstants.STYLE_ROTATION]||0)+n,[e]),this.state.cell!=e&&(null!=(s=this.graph.getCellGeometry(e))&&!s.relative))if(0!=n){var a=this.graph.getModel().getParent(e),i=this.graph.getCellGeometry(a);if(!s.relative&&null!=i){var s,o=mxUtils.toRadians(n),r=(a=Math.cos(o),o=Math.sin(o),new mxPoint(s.getCenterX(),s.getCenterY()));i=new mxPoint(i.width/2,i.height/2),a=mxUtils.getRotatedPoint(r,a,o,i);(s=s.clone()).x=a.x-s.width/2,s.y=a.y-s.height/2,t.setGeometry(e,s)}}else(s=s.clone()).x+=dx,s.y+=dy,t.setGeometry(e,s);for(s=t.getChildCount(e),a=0;a<s;a++)this.rotateCell(t.getChildAt(e,a),n)}},mxVertexHandler.prototype.reset=function(){this.index=this.currentAlpha=null,null!=this.preview&&(this.preview.destroy(),this.preview=null),null!=this.selectionBorder&&(this.selectionBorder.node.style.display="inline",this.selectionBounds=this.getSelectionBounds(this.state),this.bounds=new mxRectangle(this.selectionBounds.x,this.selectionBounds.y,this.selectionBounds.width,this.selectionBounds.height),this.drawPreview())},mxVertexHandler.prototype.resizeCell=function(e,n,t,a,i){var s=this.graph.model.getGeometry(e);if(null!=s)if(a==mxEvent.LABEL_HANDLE)a=this.graph.view.scale,n=(this.labelShape.bounds.getCenterX()-this.startX)/a,t=(this.labelShape.bounds.getCenterY()-this.startY)/a,null==(s=s.clone()).offset?s.offset=new mxPoint(n,t):(s.offset.x+=n,s.offset.y+=t),this.graph.model.setGeometry(e,s);else{if(a=this.union(s,n,t,a,i,1,new mxPoint(0,0)),0!=(r=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"))){n=a.getCenterX()-s.getCenterX(),t=a.getCenterY()-s.getCenterY(),i=Math.cos(r);var o=Math.sin(r),r=i*n-o*t-n;n=o*n+i*t-t,t=a.x-s.x;var l=a.y-s.y,d=i*t-o*l;i=o*t+i*l,a.x+=r,a.y+=n,this.graph.isCellCollapsed(e)||0==r&&0==n||(t=s.x-a.x+d,l=s.y-a.y+i,this.moveChildren(e,t,l))}this.graph.resizeCell(e,a)}},mxVertexHandler.prototype.moveChildren=function(e,n,t){for(var a=this.graph.getModel(),i=a.getChildCount(e),s=0;s<i;s++){var o=a.getChildAt(e,s);if(a.isVertex(o)){var r=this.graph.getCellGeometry(o);null!=r&&!r.relative&&((r=r.clone()).x+=n,r.y+=t,a.setGeometry(o,r))}}},mxVertexHandler.prototype.union=function(e,n,t,a,i,s,o){if(this.singleSizer){o=e.x+e.width+n;var r=e.y+e.height+t;return i&&(o=this.graph.snap(o/s)*s,r=this.graph.snap(r/s)*s),(s=new mxRectangle(e.x,e.y,0,0)).add(new mxRectangle(o,r,0,0)),s}var l=(r=e.x-o.x*s)+e.width,d=e.y-o.y*s;return e=d+e.height,4<a?(e+=t,i&&(e=this.graph.snap(e/s)*s)):a<3&&(d+=t,i&&(d=this.graph.snap(d/s)*s)),0==a||3==a||5==a?(r+=n,i&&(r=this.graph.snap(r/s)*s)):2!=a&&4!=a&&7!=a||(l+=n,i&&(l=this.graph.snap(l/s)*s)),e-=d,(i=l-r)<0&&(r+=i,i=Math.abs(i)),e<0&&(d+=e,e=Math.abs(e)),new mxRectangle(r+o.x*s,d+o.y*s,i,e)},mxVertexHandler.prototype.redraw=function(){this.selectionBounds=this.getSelectionBounds(this.state),this.bounds=new mxRectangle(this.state.x,this.state.y,this.state.width,this.state.height);var e=this.state;if(null!=this.sizers){var n=e.x+e.width,t=e.y+e.height;if(this.singleSizer)this.moveSizerTo(this.sizers[0],n,t);else{var a=e.x+e.width/2,i=e.y+e.height/2;if(1<this.sizers.length){var s=mxUtils.toRadians(e.style[mxConstants.STYLE_ROTATION]||"0"),o=Math.cos(s),r=(s=Math.sin(s),new mxPoint(e.getCenterX(),e.getCenterY())),l=mxUtils.getRotatedPoint(new mxPoint(e.x,e.y),o,s,r);this.moveSizerTo(this.sizers[0],l.x,l.y),l.x=a,l.y=e.y,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[1],l.x,l.y),l.x=n,l.y=e.y,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[2],l.x,l.y),l.x=e.x,l.y=i,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[3],l.x,l.y),l.x=n,l.y=i,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[4],l.x,l.y),l.x=e.x,l.y=t,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[5],l.x,l.y),l.x=a,l.y=t,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[6],l.x,l.y),l.x=n,l.y=t,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[7],l.x,l.y),this.moveSizerTo(this.sizers[8],a+e.absoluteOffset.x,i+e.absoluteOffset.y)}else 2<=this.state.width&&2<=this.state.height?this.moveSizerTo(this.sizers[0],a+e.absoluteOffset.x,i+e.absoluteOffset.y):this.moveSizerTo(this.sizers[0],e.x,e.y)}}null!=this.rotationShape&&(s=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),o=Math.cos(s),s=Math.sin(s),r=new mxPoint(this.state.getCenterX(),this.state.getCenterY()),l=mxUtils.getRotatedPoint(new mxPoint(e.x+e.width/2,e.y-16),o,s,r),this.moveSizerTo(this.rotationShape,l.x,l.y)),this.selectionBorder.rotation=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0"),this.drawPreview()},mxVertexHandler.prototype.drawPreview=function(){null!=this.preview&&(this.preview.bounds=this.bounds,this.preview.node.parentNode==this.graph.container&&(this.preview.bounds.width=Math.max(0,this.preview.bounds.width-1),this.preview.bounds.height=Math.max(0,this.preview.bounds.height-1)),this.preview.rotation=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0"),this.preview.redraw()),this.selectionBorder.bounds=this.bounds,this.selectionBorder.redraw()},mxVertexHandler.prototype.destroy=function(){if(null!=this.preview&&(this.preview.destroy(),this.preview=null),this.selectionBorder.destroy(),this.labelShape=this.selectionBorder=null,null!=this.sizers)for(var e=0;e<this.sizers.length;e++)this.sizers[e].destroy(),this.sizers[e]=null},mxEdgeHandler.prototype.graph=null,mxEdgeHandler.prototype.state=null,mxEdgeHandler.prototype.marker=null,mxEdgeHandler.prototype.constraintHandler=null,mxEdgeHandler.prototype.error=null,mxEdgeHandler.prototype.shape=null,mxEdgeHandler.prototype.bends=null,mxEdgeHandler.prototype.labelShape=null,mxEdgeHandler.prototype.cloneEnabled=!0,mxEdgeHandler.prototype.addEnabled=!1,mxEdgeHandler.prototype.removeEnabled=!1,mxEdgeHandler.prototype.preferHtml=!1,mxEdgeHandler.prototype.allowHandleBoundsCheck=!0,mxEdgeHandler.prototype.snapToTerminals=!1,mxEdgeHandler.prototype.handleImage=null,mxEdgeHandler.prototype.tolerance=0,mxEdgeHandler.prototype.init=function(){if(this.graph=this.state.view.graph,this.marker=this.createMarker(),this.constraintHandler=new mxConstraintHandler(this.graph),this.points=[],this.abspoints=this.getSelectionPoints(this.state),this.shape=this.createSelectionShape(this.abspoints),this.shape.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,this.shape.init(this.graph.getView().getOverlayPane()),this.shape.svgStrokeTolerance=0,this.shape.node.style.cursor=mxConstants.CURSOR_MOVABLE_EDGE,mxEvent.addListener(this.shape.node,"dblclick",mxUtils.bind(this,function(e){this.graph.dblClick(e,this.state.cell)})),mxEvent.addGestureListeners(this.shape.node,mxUtils.bind(this,function(e){this.addEnabled&&this.isAddPointEvent(e)?this.addPoint(this.state,e):this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,this.state))}),mxUtils.bind(this,function(e){var n=this.state.cell;if(null!=this.index){var t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));n=this.graph.getCellAt(t.x,t.y);this.graph.isSwimlane(n)&&this.graph.hitsSwimlaneContent(n,t.x,t.y)&&(n=null)}this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,this.graph.getView().getState(n)))}),mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,this.state))})),this.preferHtml=null!=this.state.text&&this.state.text.node.parentNode==this.graph.container,!this.preferHtml){var e=this.state.getVisibleTerminalState(!0);null!=e&&(this.preferHtml=null!=e.text&&e.text.node.parentNode==this.graph.container),this.preferHtml||null!=(e=this.state.getVisibleTerminalState(!1))&&(this.preferHtml=null!=e.text&&e.text.node.parentNode==this.graph.container)}(this.graph.getSelectionCount()<mxGraphHandler.prototype.maxCells||mxGraphHandler.prototype.maxCells<=0)&&(this.bends=this.createBends()),this.label=new mxPoint(this.state.absoluteOffset.x,this.state.absoluteOffset.y),this.labelShape=new mxRectangleShape(new mxRectangle,mxConstants.LABEL_HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR),this.labelShape.pointerEvents=!1,this.initBend(this.labelShape),this.labelShape.node.style.cursor=mxConstants.CURSOR_LABEL_HANDLE,mxEvent.redirectMouseEvents(this.labelShape.node,this.graph,this.state),this.redraw()},mxEdgeHandler.prototype.isAddPointEvent=function(e){return mxEvent.isShiftDown(e)},mxEdgeHandler.prototype.isRemovePointEvent=function(e){return mxEvent.isShiftDown(e)},mxEdgeHandler.prototype.getSelectionPoints=function(e){return e.absolutePoints},mxEdgeHandler.prototype.createSelectionShape=function(e){return(e=new mxPolyline(e,this.getSelectionColor())).strokewidth=this.getSelectionStrokeWidth(),e.isDashed=this.isSelectionDashed(),e},mxEdgeHandler.prototype.getSelectionColor=function(){return mxConstants.EDGE_SELECTION_COLOR},mxEdgeHandler.prototype.getSelectionStrokeWidth=function(){return mxConstants.EDGE_SELECTION_STROKEWIDTH},mxEdgeHandler.prototype.isSelectionDashed=function(){return mxConstants.EDGE_SELECTION_DASHED},mxEdgeHandler.prototype.isConnectableCell=function(e){return!0},mxEdgeHandler.prototype.createMarker=function(){var e=new mxCellMarker(this.graph),a=this;return e.getCell=function(e){var n=mxCellMarker.prototype.getCell.apply(this,arguments);if(!a.isConnectableCell(n))return null;var t=a.graph.getModel();return(n==a.state.cell||null!=n&&!a.graph.connectableEdges&&t.isEdge(n))&&(n=null),n},e.isValidState=function(e){var n=a.graph.getModel();n=null!=(n=a.graph.view.getTerminalPort(e,a.graph.view.getState(n.getTerminal(a.state.cell,!a.isSource)),!a.isSource))?n.cell:null;return a.error=a.validateConnection(a.isSource?e.cell:n,a.isSource?n:e.cell),null==a.error},e},mxEdgeHandler.prototype.validateConnection=function(e,n){return this.graph.getEdgeValidationError(this.state.cell,e,n)},mxEdgeHandler.prototype.createBends=function(){for(var e=this.state.cell,n=[],t=0;t<this.abspoints.length;t++)if(this.isHandleVisible(t)){var a=t==this.abspoints.length-1;if((a=0==t||a)||this.graph.isCellBendable(e)){var i=this.createHandleShape(t);if(this.initBend(i),mxClient.IS_TOUCH&&i.node.setAttribute("pointer-events","none"),this.isHandleEnabled(t))if(mxClient.IS_TOUCH){var s=mxUtils.bind(this,function(e){return e=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),this.graph.view.getState(this.graph.getCellAt(e.x,e.y))});mxEvent.redirectMouseEvents(i.node,this.graph,s)}else i.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(i.node,this.graph,this.state);n.push(i),a||(this.points.push(new mxPoint(0,0)),i.node.style.visibility="hidden")}}return n},mxEdgeHandler.prototype.isHandleEnabled=function(e){return!0},mxEdgeHandler.prototype.isHandleVisible=function(e){return!0},mxEdgeHandler.prototype.createHandleShape=function(e){return null!=this.handleImage?new mxImageShape(new mxRectangle(0,0,this.handleImage.width,this.handleImage.height),this.handleImage.src):(e=mxConstants.HANDLE_SIZE,this.preferHtml&&(e-=1),new mxRectangleShape(new mxRectangle(0,0,e,e),mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR))},mxEdgeHandler.prototype.initBend=function(e){this.preferHtml?(e.dialect=mxConstants.DIALECT_STRICTHTML,e.init(this.graph.container)):(e.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()))},mxEdgeHandler.prototype.getHandleForEvent=function(e){if(null!=this.bends)for(var n=this.tolerance,t=(n=this.allowHandleBoundsCheck&&(mxClient.IS_IE||0<n)?new mxRectangle(e.getGraphX()-n,e.getGraphY()-n,2*n,2*n):null,0);t<this.bends.length;t++)if((e.isSource(this.bends[t])||null!=n&&mxUtils.intersects(this.bends[t].bounds,n))&&"hidden"!=this.bends[t].node.style.visibility)return t;return!(e.isSource(this.labelShape)&&"hidden"!=this.labelShape.node.style.visibility||e.isSource(this.state.text))||(mxClient.IS_SF||mxClient.IS_GC)&&"SELECT"==e.getSource().nodeName?null:mxEvent.LABEL_HANDLE},mxEdgeHandler.prototype.mouseDown=function(e,n){var t=null;null!=(t=this.getHandleForEvent(n))&&!n.isConsumed()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(n.getEvent())&&(this.removeEnabled&&this.isRemovePointEvent(n.getEvent())?this.removePoint(this.state,t):(t!=mxEvent.LABEL_HANDLE||this.graph.isLabelMovable(n.getCell()))&&this.start(n.getX(),n.getY(),t),n.consume())},mxEdgeHandler.prototype.start=function(e,n,t){this.startX=e,this.startY=n,this.isSource=null!=this.bends&&0==t,this.isTarget=null!=this.bends&&t==this.bends.length-1,this.isLabel=t==mxEvent.LABEL_HANDLE,this.isSource||this.isTarget?(e=this.state.cell,(null==(n=this.graph.model.getTerminal(e,this.isSource))&&this.graph.isTerminalPointMovable(e,this.isSource)||null!=n&&this.graph.isCellDisconnectable(e,n,this.isSource))&&(this.index=t)):this.index=t},mxEdgeHandler.prototype.clonePreviewState=function(e,n){return this.state.clone()},mxEdgeHandler.prototype.getSnapToTerminalTolerance=function(){return this.graph.gridSize*this.graph.view.scale/2},mxEdgeHandler.prototype.getPointForEvent=function(e){var t=new mxPoint(e.getGraphX(),e.getGraphY()),a=this.getSnapToTerminalTolerance(),n=this.graph.getView(),i=!1,s=!1;if(this.snapToTerminals&&0<a){var o=function(e){if(null!=e){var n=e.x;Math.abs(t.x-n)<a&&(t.x=n,i=!0),e=e.y,Math.abs(t.y-e)<a&&(t.y=e,s=!0)}},r=function(e){null!=e&&o.call(this,new mxPoint(n.getRoutingCenterX(e),n.getRoutingCenterY(e)))};if(r.call(this,this.state.getVisibleTerminalState(!0)),r.call(this,this.state.getVisibleTerminalState(!1)),null!=this.abspoints)for(r=0;r<this.abspoints;r++)r!=this.index&&o.call(this,this.abspoints[r])}return this.graph.isGridEnabledEvent(e.getEvent())&&(e=n.scale,r=n.translate,i||(t.x=(this.graph.snap(t.x/e-r.x)+r.x)*e),s||(t.y=(this.graph.snap(t.y/e-r.y)+r.y)*e)),t},mxEdgeHandler.prototype.getPreviewTerminalState=function(e){this.constraintHandler.update(e,this.isSource),this.marker.process(e),e=this.marker.getValidState();var n=null;return null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentConstraint&&this.marker.reset(),null!=e?n=e:null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(n=this.constraintHandler.currentFocus),n},mxEdgeHandler.prototype.getPreviewPoints=function(e){var n=null!=(n=this.graph.getCellGeometry(this.state.cell)).points?n.points.slice():null;return this.isSource||this.isTarget?this.graph.resetEdgesOnConnect&&(n=null):(this.convertPoint(e,!1),null==n?n=[e]:n[this.index-1]=e),n},mxEdgeHandler.prototype.updatePreviewState=function(e,n,t){var a=this.isSource?t:this.state.getVisibleTerminalState(!0),i=this.isTarget?t:this.state.getVisibleTerminalState(!1),s=this.graph.getConnectionConstraint(e,a,!0),o=this.graph.getConnectionConstraint(e,i,!1),r=this.constraintHandler.currentConstraint;null==r&&(r=new mxConnectionConstraint),this.isSource?s=r:this.isTarget&&(o=r),(!this.isSource||null!=a)&&e.view.updateFixedTerminalPoint(e,a,!0,s),(!this.isTarget||null!=i)&&e.view.updateFixedTerminalPoint(e,i,!1,o),(this.isSource||this.isTarget)&&null==t&&(e.setAbsoluteTerminalPoint(n,this.isSource),null==this.marker.getMarkedState()&&(this.error=this.graph.allowDanglingEdges?null:"")),e.view.updatePoints(e,this.points,a,i),e.view.updateFloatingTerminalPoints(e,a,i)},mxEdgeHandler.prototype.mouseMove=function(e,n){if(null!=this.index&&null!=this.marker){var t=this.getPointForEvent(n);if(this.isLabel)this.label.x=t.x,this.label.y=t.y;else{this.points=this.getPreviewPoints(t);var a=this.isSource||this.isTarget?this.getPreviewTerminalState(n):null,i=this.clonePreviewState(t,null!=a?a.cell:null);this.updatePreviewState(i,t,a),this.setPreviewColor(null==this.error?this.marker.validColor:this.marker.invalidColor),this.abspoints=i.absolutePoints,this.active=!0}this.drawPreview(),mxEvent.consume(n.getEvent()),n.consume()}else mxClient.IS_IE&&null!=this.getHandleForEvent(n)&&n.consume(!1)},mxEdgeHandler.prototype.mouseUp=function(e,n){if(null!=this.index&&null!=this.marker){var t=this.state.cell;if(n.getX()!=this.startX||n.getY()!=this.startY)if(null!=this.error)0<this.error.length&&this.graph.validationAlert(this.error);else if(this.isLabel)this.moveLabel(this.state,this.label.x,this.label.y);else if(this.isSource||this.isTarget){var a=null;if(null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(a=this.constraintHandler.currentFocus.cell),null==a&&this.marker.hasValidState()&&(a=this.marker.validState.cell),null!=a)t=this.connect(t,a,this.isSource,this.graph.isCloneEvent(n.getEvent())&&this.cloneEnabled&&this.graph.isCellsCloneable(),n);else if(this.graph.isAllowDanglingEdges()){(a=this.abspoints[this.isSource?0:this.abspoints.length-1]).x=a.x/this.graph.view.scale-this.graph.view.translate.x,a.y=a.y/this.graph.view.scale-this.graph.view.translate.y;var i=this.graph.getView().getState(this.graph.getModel().getParent(t));null!=i&&(a.x-=i.origin.x,a.y-=i.origin.y),a.x-=this.graph.panDx/this.graph.view.scale,a.y-=this.graph.panDy/this.graph.view.scale,this.changeTerminalPoint(t,a,this.isSource)}}else this.active?this.changePoints(t,this.points):(this.graph.getView().invalidate(this.state.cell),this.graph.getView().revalidate(this.state.cell));null!=this.marker&&(this.reset(),t!=this.state.cell&&this.graph.setSelectionCell(t)),n.consume()}},mxEdgeHandler.prototype.reset=function(){this.points=this.label=this.index=this.error=null,this.isTarget=this.isSource=this.isLabel=this.active=!1,this.marker.reset(),this.constraintHandler.reset(),this.setPreviewColor(mxConstants.EDGE_SELECTION_COLOR),this.redraw()},mxEdgeHandler.prototype.setPreviewColor=function(e){null!=this.shape&&(this.shape.stroke=e)},mxEdgeHandler.prototype.convertPoint=function(e,n){var t=this.graph.getView().getScale(),a=this.graph.getView().getTranslate();return n&&(e.x=this.graph.snap(e.x),e.y=this.graph.snap(e.y)),e.x=Math.round(e.x/t-a.x),e.y=Math.round(e.y/t-a.y),null!=(t=this.graph.getView().getState(this.graph.getModel().getParent(this.state.cell)))&&(e.x-=t.origin.x,e.y-=t.origin.y),e},mxEdgeHandler.prototype.moveLabel=function(e,n,t){var a=this.graph.getModel();if(null!=(i=a.getGeometry(e.cell))){var i=i.clone(),s=this.graph.getView().getRelativePoint(e,n,t);i.x=s.x,i.y=s.y;var o=this.graph.getView().scale;i.offset=new mxPoint(0,0),s=this.graph.view.getPoint(e,i),i.offset=new mxPoint((n-s.x)/o,(t-s.y)/o),a.setGeometry(e.cell,i)}},mxEdgeHandler.prototype.connect=function(e,n,t,a,i){var s=(i=this.graph.getModel()).getParent(e);i.beginUpdate();try{if(a){var o=e.clone();i.add(s,o,i.getChildCount(s));var r=i.getTerminal(e,!t);this.graph.connectCell(o,r,!t),e=o}var l=this.constraintHandler.currentConstraint;null==l&&(l=new mxConnectionConstraint),this.graph.connectCell(e,n,t,l)}finally{i.endUpdate()}return e},mxEdgeHandler.prototype.changeTerminalPoint=function(e,n,t){var a=this.graph.getModel(),i=a.getGeometry(e);if(null!=i){a.beginUpdate();try{(i=i.clone()).setTerminalPoint(n,t),a.setGeometry(e,i),this.graph.connectCell(e,null,t,new mxConnectionConstraint)}finally{a.endUpdate()}}},mxEdgeHandler.prototype.changePoints=function(e,n){var t=this.graph.getModel(),a=t.getGeometry(e);null!=a&&((a=a.clone()).points=n,t.setGeometry(e,a))},mxEdgeHandler.prototype.addPoint=function(e,n){var t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(n),mxEvent.getClientY(n)),a=this.graph.isGridEnabledEvent(n);this.convertPoint(t,a),this.addPointAt(e,t.x,t.y),mxEvent.consume(n)},mxEdgeHandler.prototype.addPointAt=function(e,n,t){var a=this.graph.getCellGeometry(e.cell);if(n=new mxPoint(n,t),null!=a){a=a.clone(),t=this.graph.view.translate;var i=this.graph.view.scale;t=mxUtils.findNearestSegment(e,(n.x+t.x)*i,(n.y+t.y)*i),null==a.points?a.points=[n]:a.points.splice(t,0,n),this.graph.getModel().setGeometry(e.cell,a),this.destroy(),this.init()}},mxEdgeHandler.prototype.removePoint=function(e,n){if(0<n&&n<this.abspoints.length-1){var t=this.graph.getCellGeometry(this.state.cell);null!=t&&null!=t.points&&((t=t.clone()).points.splice(n-1,1),this.graph.getModel().setGeometry(e.cell,t),this.destroy(),this.init())}},mxEdgeHandler.prototype.getHandleFillColor=function(e){e=0==e;var n=this.state.cell,t=this.graph.getModel().getTerminal(n,e),a=mxConstants.HANDLE_FILLCOLOR;return null!=t&&!this.graph.isCellDisconnectable(n,t,e)||null==t&&!this.graph.isTerminalPointMovable(n,e)?a=mxConstants.LOCKED_HANDLE_FILLCOLOR:null!=t&&this.graph.isCellDisconnectable(n,t,e)&&(a=mxConstants.CONNECT_HANDLE_FILLCOLOR),a},mxEdgeHandler.prototype.redraw=function(){this.abspoints=this.state.absolutePoints.slice();var e=this.state.cell,n=mxConstants.LABEL_HANDLE_SIZE;if(this.label=new mxPoint(this.state.absoluteOffset.x,this.state.absoluteOffset.y),this.labelShape.bounds=new mxRectangle(Math.round(this.label.x-n/2),Math.round(this.label.y-n/2),n,n),this.labelShape.redraw(),null!=(n=this.graph.getLabel(e))&&0<n.length&&this.graph.isLabelMovable(e)?this.labelShape.node.style.visibility="visible":this.labelShape.node.style.visibility="hidden",null!=this.bends&&0<this.bends.length){var t=this.abspoints.length-1,a=(e=this.abspoints[0],this.abspoints[0].y);n=this.bends[0].bounds;this.bends[0].bounds=new mxRectangle(Math.round(this.abspoints[0].x-n.width/2),Math.round(a-n.height/2),n.width,n.height),this.bends[0].fill=this.getHandleFillColor(0),this.bends[0].redraw();a=this.abspoints[t];var i=this.abspoints[t].x,s=(t=this.abspoints[t].y,this.bends.length-1);n=this.bends[s].bounds;this.bends[s].bounds=new mxRectangle(Math.round(i-n.width/2),Math.round(t-n.height/2),n.width,n.height),this.bends[s].fill=this.getHandleFillColor(s),this.bends[s].redraw(),this.redrawInnerBends(e,a)}this.drawPreview()},mxEdgeHandler.prototype.redrawInnerBends=function(e,n){var t=this.graph.getModel().getGeometry(this.state.cell).points;if(null!=t){null==this.points&&(this.points=[]);for(var a=1;a<this.bends.length-1;a++)if(null!=this.bends[a])if(null!=this.abspoints[a]){var i=this.abspoints[a].x,s=this.abspoints[a].y,o=this.bends[a].bounds;this.bends[a].node.style.visibility="visible",this.bends[a].bounds=new mxRectangle(Math.round(i-o.width/2),Math.round(s-o.height/2),o.width,o.height),this.bends[a].redraw(),this.points[a-1]=t[a-1]}else this.bends[a].destroy(),this.bends[a]=null}},mxEdgeHandler.prototype.drawPreview=function(){if(this.isLabel){var e=mxConstants.LABEL_HANDLE_SIZE;e=new mxRectangle(Math.round(this.label.x-e/2),Math.round(this.label.y-e/2),e,e);this.labelShape.bounds=e,this.labelShape.redraw()}else this.shape.points=this.abspoints,this.shape.redraw()},mxEdgeHandler.prototype.destroy=function(){if(null!=this.marker&&(this.marker.destroy(),this.marker=null),null!=this.shape&&(this.shape.destroy(),this.shape=null),null!=this.labelShape&&(this.labelShape.destroy(),this.labelShape=null),null!=this.constraintHandler&&(this.constraintHandler.destroy(),this.constraintHandler=null),null!=this.bends)for(var e=0;e<this.bends.length;e++)null!=this.bends[e]&&(this.bends[e].destroy(),this.bends[e]=null)},mxUtils.extend(mxElbowEdgeHandler,mxEdgeHandler),mxElbowEdgeHandler.prototype=new mxEdgeHandler,mxElbowEdgeHandler.prototype.constructor=mxElbowEdgeHandler,mxElbowEdgeHandler.prototype.flipEnabled=!0,mxElbowEdgeHandler.prototype.doubleClickOrientationResource="none"!=mxClient.language?"doubleClickOrientation":"",mxElbowEdgeHandler.prototype.createBends=function(){var e=[],n=this.createHandleShape(0);return this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none"),e.push(this.createVirtualBend()),this.points.push(new mxPoint(0,0)),n=this.createHandleShape(2),this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none"),e},mxElbowEdgeHandler.prototype.createVirtualBend=function(){var e=this.createHandleShape();this.initBend(e);var n=this.getCursorForBend();return e.node.style.cursor=n,n=mxUtils.bind(this,function(e){!mxEvent.isConsumed(e)&&this.flipEnabled&&(this.graph.flipEdge(this.state.cell,e),mxEvent.consume(e))}),mxEvent.redirectMouseEvents(e.node,this.graph,this.state,null,null,null,n),this.graph.isCellBendable(this.state.cell)||(e.node.style.display="none"),e},mxElbowEdgeHandler.prototype.getCursorForBend=function(){return this.state.style[mxConstants.STYLE_EDGE]==mxEdgeStyle.TopToBottom||this.state.style[mxConstants.STYLE_EDGE]==mxConstants.EDGESTYLE_TOPTOBOTTOM||(this.state.style[mxConstants.STYLE_EDGE]==mxEdgeStyle.ElbowConnector||this.state.style[mxConstants.STYLE_EDGE]==mxConstants.EDGESTYLE_ELBOW)&&this.state.style[mxConstants.STYLE_ELBOW]==mxConstants.ELBOW_VERTICAL?"row-resize":"col-resize"},mxElbowEdgeHandler.prototype.getTooltipForNode=function(e){var n=null;return null==this.bends||null==this.bends[1]||e!=this.bends[1].node&&e.parentNode!=this.bends[1].node||(n=this.doubleClickOrientationResource,n=mxResources.get(n)||n),n},mxElbowEdgeHandler.prototype.convertPoint=function(e,n){var t=this.graph.getView().getScale(),a=this.graph.getView().getTranslate(),i=this.state.origin;n&&(e.x=this.graph.snap(e.x),e.y=this.graph.snap(e.y)),e.x=Math.round(e.x/t-a.x-i.x),e.y=Math.round(e.y/t-a.y-i.y)},mxElbowEdgeHandler.prototype.redrawInnerBends=function(e,n){var t=null==(t=null!=(t=this.graph.getModel().getGeometry(this.state.cell).points)?t[0]:null)?new mxPoint(e.x+(n.x-e.x)/2,e.y+(n.y-e.y)/2):new mxPoint(this.graph.getView().scale*(t.x+this.graph.getView().translate.x+this.state.origin.x),this.graph.getView().scale*(t.y+this.graph.getView().translate.y+this.state.origin.y)),a=(i=this.bends[1].bounds).width,i=i.height;null==this.handleImage&&(i=a=mxConstants.HANDLE_SIZE);var s=new mxRectangle(Math.round(t.x-a/2),Math.round(t.y-i/2),a,i);null==this.handleImage&&"hidden"!=this.labelShape.node.style.visibility&&mxUtils.intersects(s,this.labelShape.bounds)&&(a+=3,i+=3,s=new mxRectangle(Math.round(t.x-a/2),Math.round(t.y-i/2),a,i)),this.bends[1].bounds=s,this.bends[1].redraw()},mxUtils.extend(mxEdgeSegmentHandler,mxEdgeHandler),mxEdgeSegmentHandler.prototype=new mxElbowEdgeHandler,mxEdgeSegmentHandler.prototype.constructor=mxEdgeSegmentHandler,mxEdgeSegmentHandler.prototype.getPreviewPoints=function(e){if(this.isSource||this.isTarget)return mxElbowEdgeHandler.prototype.getPreviewPoints.apply(this,arguments);this.convertPoint(e,!1);var n=this.state.absolutePoints,t=n[0].clone();this.convertPoint(t,!1);for(var a=[],i=1;i<n.length;i++){var s=n[i].clone();this.convertPoint(s,!1),i==this.index&&(t.x==s.x?(t.x=e.x,s.x=e.x):(t.y=e.y,s.y=e.y)),i<n.length-1&&a.push(s),t=s}if(1==a.length){if(t=this.state.view,i=this.state.getVisibleTerminalState(!0),null!=(s=this.state.getVisibleTerminalState(!1))&null!=i){var o=this.state.origin.x,r=this.state.origin.y;mxUtils.contains(s,a[0].x+o,a[0].y+r)?n[1].y==n[2].y?a[0].y=t.getRoutingCenterY(i)-r:a[0].x=t.getRoutingCenterX(i)-o:mxUtils.contains(i,a[0].x+o,a[0].y+r)&&(n[1].y==n[0].y?a[0].y=t.getRoutingCenterY(s)-r:a[0].x=t.getRoutingCenterX(s)-o)}}else 0==a.length&&(a=[e]);return a},mxEdgeSegmentHandler.prototype.createBends=function(){var e=[],n=this.createHandleShape(0);this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none");var t=this.state.absolutePoints;if(this.graph.isCellBendable(this.state.cell)){null==this.points&&(this.points=[]);for(var a=0;a<t.length-1;a++)n=this.createVirtualBend(),e.push(n),n.node.style.cursor=0==t[a].x-t[a+1].x?"col-resize":"row-resize",this.points.push(new mxPoint(0,0)),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none")}return n=this.createHandleShape(t.length),this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none"),e},mxEdgeSegmentHandler.prototype.redraw=function(){this.refresh(),mxEdgeHandler.prototype.redraw.apply(this,arguments)},mxEdgeSegmentHandler.prototype.refresh=function(){if(null!=this.bends){for(var e=0;e<this.bends.length;e++)null!=this.bends[e]&&(this.bends[e].destroy(),this.bends[e]=null);this.bends=this.createBends()}},mxEdgeSegmentHandler.prototype.redrawInnerBends=function(e,n){if(this.graph.isCellBendable(this.state.cell)){var t=mxConstants.HANDLE_SIZE,a=this.state.absolutePoints;if(null!=a&&1<a.length)for(var i=0;i<this.state.absolutePoints.length-1;i++)if(null!=this.bends[i+1]){e=a[i],n=a[i+1];var s=new mxPoint(e.x+(n.x-e.x)/2,e.y+(n.y-e.y)/2);this.bends[i+1].bounds=new mxRectangle(Math.round(s.x-t/2),Math.round(s.y-t/2),t,t),this.bends[i+1].redraw()}}},mxEdgeSegmentHandler.prototype.changePoints=function(e,n){n=[];var t=this.abspoints;if(1<t.length)for(var a=t[0],i=t[1],s=2;s<t.length;s++){var o=t[s];Math.round(a.x)==Math.round(i.x)&&Math.round(i.x)==Math.round(o.x)||Math.round(a.y)==Math.round(i.y)&&Math.round(i.y)==Math.round(o.y)||(i=(a=i).clone(),this.convertPoint(i,!1),n.push(i)),i=o}mxElbowEdgeHandler.prototype.changePoints.apply(this,arguments)},mxKeyHandler.prototype.graph=null,mxKeyHandler.prototype.target=null,mxKeyHandler.prototype.normalKeys=null,mxKeyHandler.prototype.shiftKeys=null,mxKeyHandler.prototype.controlKeys=null,mxKeyHandler.prototype.controlShiftKeys=null,mxKeyHandler.prototype.enabled=!0,mxKeyHandler.prototype.isEnabled=function(){return this.enabled},mxKeyHandler.prototype.setEnabled=function(e){this.enabled=e},mxKeyHandler.prototype.bindKey=function(e,n){this.normalKeys[e]=n},mxKeyHandler.prototype.bindShiftKey=function(e,n){this.shiftKeys[e]=n},mxKeyHandler.prototype.bindControlKey=function(e,n){this.controlKeys[e]=n},mxKeyHandler.prototype.bindControlShiftKey=function(e,n){this.controlShiftKeys[e]=n},mxKeyHandler.prototype.isControlDown=function(e){return mxEvent.isControlDown(e)},mxKeyHandler.prototype.getFunction=function(e){return null!=e?this.isControlDown(e)?mxEvent.isShiftDown(e)?this.controlShiftKeys[e.keyCode]:this.controlKeys[e.keyCode]:mxEvent.isShiftDown(e)?this.shiftKeys[e.keyCode]:this.normalKeys[e.keyCode]:null},mxKeyHandler.prototype.isGraphEvent=function(e){if((e=mxEvent.getSource(e))==this.target||e.parentNode==this.target||null!=this.graph.cellEditor&&e==this.graph.cellEditor.textarea)return!0;for(;null!=e;){if(e==this.graph.container)return!0;e=e.parentNode}return!1},mxKeyHandler.prototype.keyDown=function(e){if(this.graph.isEnabled()&&!mxEvent.isConsumed(e)&&this.isGraphEvent(e)&&this.isEnabled())if(27==e.keyCode)this.escape(e);else if(!this.graph.isEditing()){var n=this.getFunction(e);null!=n&&(n(e),mxEvent.consume(e))}},mxKeyHandler.prototype.escape=function(e){this.graph.isEscapeEnabled()&&this.graph.escape(e)},mxKeyHandler.prototype.destroy=function(){this.target=null},mxTooltipHandler.prototype.zIndex=10005,mxTooltipHandler.prototype.graph=null,mxTooltipHandler.prototype.delay=null,mxTooltipHandler.prototype.hideOnHover=!1,mxTooltipHandler.prototype.enabled=!0,mxTooltipHandler.prototype.isEnabled=function(){return this.enabled},mxTooltipHandler.prototype.setEnabled=function(e){this.enabled=e},mxTooltipHandler.prototype.isHideOnHover=function(){return this.hideOnHover},mxTooltipHandler.prototype.setHideOnHover=function(e){this.hideOnHover=e},mxTooltipHandler.prototype.init=function(){null!=document.body&&(this.div=document.createElement("div"),this.div.className="mxTooltip",this.div.style.visibility="hidden",this.div.style.zIndex=this.zIndex,document.body.appendChild(this.div),mxEvent.addListener(this.div,"mousedown",mxUtils.bind(this,function(e){this.hideTooltip()})))},mxTooltipHandler.prototype.mouseDown=function(e,n){this.reset(n,!1),this.hideTooltip()},mxTooltipHandler.prototype.mouseMove=function(e,n){n.getX()==this.lastX&&n.getY()==this.lastY||(this.reset(n,!0),(this.isHideOnHover()||n.getState()!=this.state||n.getSource()!=this.node&&(!this.stateSource||null!=n.getState()&&this.stateSource==(n.isSource(n.getState().shape)||!n.isSource(n.getState().text))))&&this.hideTooltip()),this.lastX=n.getX(),this.lastY=n.getY()},mxTooltipHandler.prototype.mouseUp=function(e,n){this.reset(n,!0),this.hideTooltip()},mxTooltipHandler.prototype.resetTimer=function(){null!=this.thread&&(window.clearTimeout(this.thread),this.thread=null)},mxTooltipHandler.prototype.reset=function(e,n){if(this.resetTimer(),n&&this.isEnabled()&&null!=e.getState()&&(null==this.div||"hidden"==this.div.style.visibility)){var t=e.getState(),a=e.getSource(),i=e.getX(),s=e.getY(),o=e.isSource(t.shape)||e.isSource(t.text);this.thread=window.setTimeout(mxUtils.bind(this,function(){if(!this.graph.isEditing()&&!this.graph.panningHandler.isMenuShowing()){var e=this.graph.getTooltip(t,a,i,s);this.show(e,i,s),this.state=t,this.node=a,this.stateSource=o}}),this.delay)}},mxTooltipHandler.prototype.hide=function(){this.resetTimer(),this.hideTooltip()},mxTooltipHandler.prototype.hideTooltip=function(){null!=this.div&&(this.div.style.visibility="hidden")},mxTooltipHandler.prototype.show=function(e,n,t){if(null!=e&&0<e.length){null==this.div&&this.init();var a=mxUtils.getScrollOrigin();this.div.style.left=n+a.x+"px",this.div.style.top=t+mxConstants.TOOLTIP_VERTICAL_OFFSET+a.y+"px",mxUtils.isNode(e)?(this.div.innerHTML="",this.div.appendChild(e)):this.div.innerHTML=e.replace(/\n/g,"<br>"),this.div.style.visibility="",mxUtils.fit(this.div)}},mxTooltipHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),mxEvent.release(this.div),null!=this.div&&null!=this.div.parentNode&&this.div.parentNode.removeChild(this.div),this.div=null},mxUtils.extend(mxCellTracker,mxCellMarker),mxCellTracker.prototype.mouseDown=function(e,n){},mxCellTracker.prototype.mouseMove=function(e,n){this.isEnabled()&&this.process(n)},mxCellTracker.prototype.mouseUp=function(e,n){this.reset()},mxCellTracker.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.graph.removeMouseListener(this),mxCellMarker.prototype.destroy.apply(this))},mxCellHighlight.prototype.keepOnTop=!1,mxCellHighlight.prototype.graph=!0,mxCellHighlight.prototype.state=null,mxCellHighlight.prototype.spacing=2,mxCellHighlight.prototype.resetHandler=null,mxCellHighlight.prototype.setHighlightColor=function(e){this.highlightColor=e,null!=this.shape&&(this.shape.stroke=e)},mxCellHighlight.prototype.drawHighlight=function(){this.shape=this.createShape(),this.repaint(),!this.keepOnTop&&this.shape.node.parentNode.firstChild!=this.shape.node&&this.shape.node.parentNode.insertBefore(this.shape.node,this.shape.node.parentNode.firstChild)},mxCellHighlight.prototype.createShape=function(){var e=null;return(e=this.graph.model.isEdge(this.state.cell)?new mxPolyline(this.state.absolutePoints,this.highlightColor,this.strokeWidth):new mxRectangleShape(new mxRectangle,null,this.highlightColor,this.strokeWidth)).dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()),mxEvent.redirectMouseEvents(e.node,this.graph,this.state),e.svgStrokeTolerance=0,e.pointerEvents=!1,e.isDashed=this.dashed,e},mxCellHighlight.prototype.repaint=function(){if(null!=this.state&&null!=this.shape){var e=0;this.graph.model.isEdge(this.state.cell)?this.shape.points=this.state.absolutePoints:(this.shape.bounds=new mxRectangle(this.state.x-this.spacing,this.state.y-this.spacing,this.state.width+2*this.spacing,this.state.height+2*this.spacing),e=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0")),null!=this.state.shape&&this.shape.setCursor(this.state.shape.getCursor()),0!=e&&(this.shape.rotation=e),this.shape.redraw()}},mxCellHighlight.prototype.hide=function(){this.highlight(null)},mxCellHighlight.prototype.highlight=function(e){this.state!=e&&(null!=this.shape&&(this.shape.destroy(),this.shape=null),this.state=e,null!=this.state&&this.drawHighlight())},mxCellHighlight.prototype.destroy=function(){this.graph.getView().removeListener(this.repaintHandler),this.graph.getModel().removeListener(this.repaintHandler),this.graph.getView().removeListener(this.resetHandler),this.graph.getModel().removeListener(this.resetHandler),null!=this.shape&&(this.shape.destroy(),this.shape=null)},mxDefaultKeyHandler.prototype.editor=null,mxDefaultKeyHandler.prototype.handler=null,mxDefaultKeyHandler.prototype.bindAction=function(e,n,t){var a=mxUtils.bind(this,function(){this.editor.execute(n)});t?this.handler.bindControlKey(e,a):this.handler.bindKey(e,a)},mxDefaultKeyHandler.prototype.destroy=function(){this.handler.destroy(),this.handler=null},mxDefaultPopupMenu.prototype.imageBasePath=null,mxDefaultPopupMenu.prototype.config=null,mxDefaultPopupMenu.prototype.createMenu=function(e,n,t,a){if(null!=this.config){var i=this.createConditions(e,t,a);this.addItems(e,n,t,a,i,this.config.firstChild,null)}},mxDefaultPopupMenu.prototype.addItems=function(e,n,t,a,i,s,o){for(var r=!1;null!=s;){if("add"==s.nodeName){if(null==(l=s.getAttribute("if"))||i[l]){var l=s.getAttribute("as"),d=(l=mxResources.get(l)||l,mxUtils.eval(mxUtils.getTextContent(s))),c=s.getAttribute("action"),m=s.getAttribute("icon"),u=s.getAttribute("iconCls");r&&(n.addSeparator(o),r=!1),null!=m&&this.imageBasePath&&(m=this.imageBasePath+m),l=this.addAction(n,e,l,m,d,c,t,o,u),this.addItems(e,n,t,a,i,s.firstChild,l)}}else"separator"==s.nodeName&&(r=!0);s=s.nextSibling}},mxDefaultPopupMenu.prototype.addAction=function(e,n,t,a,i,s,o,r,l){return e.addItem(t,a,function(e){"function"==typeof i&&i.call(n,n,o,e),null!=s&&n.execute(s,o,e)},r,l)},mxDefaultPopupMenu.prototype.createConditions=function(e,n,t){var a=e.graph.getModel(),i=a.getChildCount(n),s=[];for(s.nocell=null==n,s.ncells=1<e.graph.getSelectionCount(),s.notRoot=a.getRoot()!=a.getParent(e.graph.getDefaultParent()),s.cell=null!=n,a=null!=n&&1==e.graph.getSelectionCount(),s.nonEmpty=a&&0<i,s.expandable=a&&e.graph.isCellFoldable(n,!1),s.collapsable=a&&e.graph.isCellFoldable(n,!0),s.validRoot=a&&e.graph.isValidRoot(n),s.emptyValidRoot=s.validRoot&&0==i,s.swimlane=a&&e.graph.isSwimlane(n),i=this.config.getElementsByTagName("condition"),a=0;a<i.length;a++){var o=mxUtils.eval(mxUtils.getTextContent(i[a])),r=i[a].getAttribute("name");null!=r&&"function"==typeof o&&(s[r]=o(e,n,t))}return s},mxDefaultToolbar.prototype.editor=null,mxDefaultToolbar.prototype.toolbar=null,mxDefaultToolbar.prototype.resetHandler=null,mxDefaultToolbar.prototype.spacing=4,mxDefaultToolbar.prototype.connectOnDrop=!1,mxDefaultToolbar.prototype.init=function(e){null!=e&&(this.toolbar=new mxToolbar(e),this.toolbar.addListener(mxEvent.SELECT,mxUtils.bind(this,function(e,n){var t=n.getProperty("function");this.editor.insertFunction=null!=t?mxUtils.bind(this,function(){t.apply(this,arguments),this.toolbar.resetMode()}):null})),this.resetHandler=mxUtils.bind(this,function(){null!=this.toolbar&&this.toolbar.resetMode(!0)}),this.editor.graph.addListener(mxEvent.DOUBLE_CLICK,this.resetHandler),this.editor.addListener(mxEvent.ESCAPE,this.resetHandler))},mxDefaultToolbar.prototype.addItem=function(e,n,t,a){var i=mxUtils.bind(this,function(){null!=t&&0<t.length&&this.editor.execute(t)});return this.toolbar.addItem(e,n,i,a)},mxDefaultToolbar.prototype.addSeparator=function(e){e=e||mxClient.imageBasePath+"/separator.gif",this.toolbar.addSeparator(e)},mxDefaultToolbar.prototype.addCombo=function(){return this.toolbar.addCombo()},mxDefaultToolbar.prototype.addActionCombo=function(e){return this.toolbar.addActionCombo(e)},mxDefaultToolbar.prototype.addActionOption=function(e,n,t){var a=mxUtils.bind(this,function(){this.editor.execute(t)});this.addOption(e,n,a)},mxDefaultToolbar.prototype.addOption=function(e,n,t){return this.toolbar.addOption(e,n,t)},mxDefaultToolbar.prototype.addMode=function(e,n,t,a,i){var s=mxUtils.bind(this,function(){this.editor.setMode(t),null!=i&&i(this.editor)});return this.toolbar.addSwitchMode(e,n,s,a)},mxDefaultToolbar.prototype.addPrototype=function(e,n,t,a,i,s){var o=function(){return"function"==typeof t?t():null!=t?t.clone():null},r=mxUtils.bind(this,function(e,n){"function"==typeof i?i(this.editor,o(),e,n):this.drop(o(),e,n),this.toolbar.resetMode(),mxEvent.consume(e)});return e=this.toolbar.addMode(e,n,r,a,null,s),this.installDropHandler(e,function(e,n,t){r(n,t)}),e},mxDefaultToolbar.prototype.drop=function(e,n,t){var a=this.editor.graph,i=a.getModel();if(null!=t&&!i.isEdge(t)&&this.connectOnDrop&&a.isCellConnectable(t))this.connect(e,n,t);else{for(;null!=t&&!a.isValidDropTarget(t,[e],n);)t=i.getParent(t);this.insert(e,n,t)}},mxDefaultToolbar.prototype.insert=function(e,n,t){var a=this.editor.graph;if(a.canImportCell(e)){var i=mxEvent.getClientX(n),s=mxEvent.getClientY(n);i=mxUtils.convertPoint(a.container,i,s);return a.isSplitEnabled()&&a.isSplitTarget(t,[e],n)?a.splitEdge(t,[e],null,i.x,i.y):this.editor.addVertex(t,e,i.x,i.y)}return null},mxDefaultToolbar.prototype.connect=function(e,n,t){var a=(n=this.editor.graph).getModel();if(null!=t&&n.isCellConnectable(e)&&n.isEdgeValid(null,t,e)){var i=null;a.beginUpdate();try{var s=a.getGeometry(t),o=a.getGeometry(e).clone();o.x=s.x+(s.width-o.width)/2,o.y=s.y+(s.height-o.height)/2;var r=this.spacing*n.gridSize,l=20*a.getDirectedEdgeCount(t,!0);this.editor.horizontalFlow?o.x+=(o.width+s.width)/2+r+l:o.y+=(o.height+s.height)/2+r+l,e.setGeometry(o);var d=a.getParent(t);if(n.addCell(e,d),n.constrainChild(e),i=this.editor.createEdge(t,e),null==a.getGeometry(i)){var c=new mxGeometry;c.relative=!0,a.setGeometry(i,c)}n.addEdge(i,d,t,e)}finally{a.endUpdate()}n.setSelectionCells([e,i]),n.scrollCellToVisible(e)}},mxDefaultToolbar.prototype.installDropHandler=function(n,t){var a=document.createElement("img");a.setAttribute("src",n.getAttribute("src"));var i=mxUtils.bind(this,function(e){a.style.width=2*n.offsetWidth+"px",a.style.height=2*n.offsetHeight+"px",mxUtils.makeDraggable(n,this.editor.graph,t,a),mxEvent.removeListener(a,"load",i)});mxClient.IS_IE?i():mxEvent.addListener(a,"load",i)},mxDefaultToolbar.prototype.destroy=function(){null!=this.resetHandler&&(this.editor.graph.removeListener("dblclick",this.resetHandler),this.editor.removeListener("escape",this.resetHandler),this.resetHandler=null),null!=this.toolbar&&(this.toolbar.destroy(),this.toolbar=null)},mxLoadResources&&mxResources.add(mxClient.basePath+"/resources/editor"),mxEditor.prototype=new mxEventSource,mxEditor.prototype.constructor=mxEditor,mxEditor.prototype.askZoomResource="none"!=mxClient.language?"askZoom":"",mxEditor.prototype.lastSavedResource="none"!=mxClient.language?"lastSaved":"",mxEditor.prototype.currentFileResource="none"!=mxClient.language?"currentFile":"",mxEditor.prototype.propertiesResource="none"!=mxClient.language?"properties":"",mxEditor.prototype.tasksResource="none"!=mxClient.language?"tasks":"",mxEditor.prototype.helpResource="none"!=mxClient.language?"help":"",mxEditor.prototype.outlineResource="none"!=mxClient.language?"outline":"",mxEditor.prototype.outline=null,mxEditor.prototype.graph=null,mxEditor.prototype.graphRenderHint=null,mxEditor.prototype.toolbar=null,mxEditor.prototype.session=null,mxEditor.prototype.status=null,mxEditor.prototype.popupHandler=null,mxEditor.prototype.undoManager=null,mxEditor.prototype.keyHandler=null,mxEditor.prototype.actions=null,mxEditor.prototype.dblClickAction="edit",mxEditor.prototype.swimlaneRequired=!1,mxEditor.prototype.disableContextMenu=!0,mxEditor.prototype.insertFunction=null,mxEditor.prototype.forcedInserting=!1,mxEditor.prototype.templates=null,mxEditor.prototype.defaultEdge=null,mxEditor.prototype.defaultEdgeStyle=null,mxEditor.prototype.defaultGroup=null,mxEditor.prototype.groupBorderSize=null,mxEditor.prototype.filename=null,mxEditor.prototype.linefeed="&#xa;",mxEditor.prototype.postParameterName="xml",mxEditor.prototype.escapePostData=!0,mxEditor.prototype.urlPost=null,mxEditor.prototype.urlImage=null,mxEditor.prototype.urlInit=null,mxEditor.prototype.urlNotify=null,mxEditor.prototype.urlPoll=null,mxEditor.prototype.horizontalFlow=!1,mxEditor.prototype.layoutDiagram=!1,mxEditor.prototype.swimlaneSpacing=0,mxEditor.prototype.maintainSwimlanes=!1,mxEditor.prototype.layoutSwimlanes=!1,mxEditor.prototype.cycleAttributeValues=null,mxEditor.prototype.cycleAttributeIndex=0,mxEditor.prototype.cycleAttributeName="fillColor",mxEditor.prototype.tasks=null,mxEditor.prototype.tasksWindowImage=null,mxEditor.prototype.tasksTop=20,mxEditor.prototype.help=null,mxEditor.prototype.helpWindowImage=null,mxEditor.prototype.urlHelp=null,mxEditor.prototype.helpWidth=300,mxEditor.prototype.helpHeight=260,mxEditor.prototype.propertiesWidth=240,mxEditor.prototype.propertiesHeight=null,mxEditor.prototype.movePropertiesDialog=!1,mxEditor.prototype.validating=!1,mxEditor.prototype.modified=!1,mxEditor.prototype.isModified=function(){return this.modified},mxEditor.prototype.setModified=function(e){this.modified=e},mxEditor.prototype.addActions=function(){this.addAction("save",function(e){e.save()}),this.addAction("print",function(e){new mxPrintPreview(e.graph,1).open()}),this.addAction("show",function(e){mxUtils.show(e.graph,null,10,10)}),this.addAction("exportImage",function(e){var n=e.getUrlImage();if(null==n||mxClient.IS_LOCAL)e.execute("show");else{var t=mxUtils.getViewXml(e.graph,1);t=mxUtils.getXml(t,"\n");mxUtils.submit(n,e.postParameterName+"="+encodeURIComponent(t),document,"_blank")}}),this.addAction("refresh",function(e){e.graph.refresh()}),this.addAction("cut",function(e){e.graph.isEnabled()&&mxClipboard.cut(e.graph)}),this.addAction("copy",function(e){e.graph.isEnabled()&&mxClipboard.copy(e.graph)}),this.addAction("paste",function(e){e.graph.isEnabled()&&mxClipboard.paste(e.graph)}),this.addAction("delete",function(e){e.graph.isEnabled()&&e.graph.removeCells()}),this.addAction("group",function(e){e.graph.isEnabled()&&e.graph.setSelectionCell(e.groupCells())}),this.addAction("ungroup",function(e){e.graph.isEnabled()&&e.graph.setSelectionCells(e.graph.ungroupCells())}),this.addAction("removeFromParent",function(e){e.graph.isEnabled()&&e.graph.removeCellsFromParent()}),this.addAction("undo",function(e){e.graph.isEnabled()&&e.undo()}),this.addAction("redo",function(e){e.graph.isEnabled()&&e.redo()}),this.addAction("zoomIn",function(e){e.graph.zoomIn()}),this.addAction("zoomOut",function(e){e.graph.zoomOut()}),this.addAction("actualSize",function(e){e.graph.zoomActual()}),this.addAction("fit",function(e){e.graph.fit()}),this.addAction("showProperties",function(e,n){e.showProperties(n)}),this.addAction("selectAll",function(e){e.graph.isEnabled()&&e.graph.selectAll()}),this.addAction("selectNone",function(e){e.graph.isEnabled()&&e.graph.clearSelection()}),this.addAction("selectVertices",function(e){e.graph.isEnabled()&&e.graph.selectVertices()}),this.addAction("selectEdges",function(e){e.graph.isEnabled()&&e.graph.selectEdges()}),this.addAction("edit",function(e,n){e.graph.isEnabled()&&e.graph.isCellEditable(n)&&e.graph.startEditingAtCell(n)}),this.addAction("toBack",function(e,n){e.graph.isEnabled()&&e.graph.orderCells(!0)}),this.addAction("toFront",function(e,n){e.graph.isEnabled()&&e.graph.orderCells(!1)}),this.addAction("enterGroup",function(e,n){e.graph.enterGroup(n)}),this.addAction("exitGroup",function(e){e.graph.exitGroup()}),this.addAction("home",function(e){e.graph.home()}),this.addAction("selectPrevious",function(e){e.graph.isEnabled()&&e.graph.selectPreviousCell()}),this.addAction("selectNext",function(e){e.graph.isEnabled()&&e.graph.selectNextCell()}),this.addAction("selectParent",function(e){e.graph.isEnabled()&&e.graph.selectParentCell()}),this.addAction("selectChild",function(e){e.graph.isEnabled()&&e.graph.selectChildCell()}),this.addAction("collapse",function(e){e.graph.isEnabled()&&e.graph.foldCells(!0)}),this.addAction("collapseAll",function(e){if(e.graph.isEnabled()){var n=e.graph.getChildVertices();e.graph.foldCells(!0,!1,n)}}),this.addAction("expand",function(e){e.graph.isEnabled()&&e.graph.foldCells(!1)}),this.addAction("expandAll",function(e){if(e.graph.isEnabled()){var n=e.graph.getChildVertices();e.graph.foldCells(!1,!1,n)}}),this.addAction("bold",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_BOLD)}),this.addAction("italic",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_ITALIC)}),this.addAction("underline",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_UNDERLINE)}),this.addAction("shadow",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_SHADOW)}),this.addAction("alignCellsLeft",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_LEFT)}),this.addAction("alignCellsCenter",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_CENTER)}),this.addAction("alignCellsRight",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_RIGHT)}),this.addAction("alignCellsTop",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_TOP)}),this.addAction("alignCellsMiddle",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_MIDDLE)}),this.addAction("alignCellsBottom",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_BOTTOM)}),this.addAction("alignFontLeft",function(e){e.graph.setCellStyles(mxConstants.STYLE_ALIGN,mxConstants.ALIGN_LEFT)}),this.addAction("alignFontCenter",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_ALIGN,mxConstants.ALIGN_CENTER)}),this.addAction("alignFontRight",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_ALIGN,mxConstants.ALIGN_RIGHT)}),this.addAction("alignFontTop",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_TOP)}),this.addAction("alignFontMiddle",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE)}),this.addAction("alignFontBottom",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_BOTTOM)}),this.addAction("zoom",function(e){var n=100*e.graph.getView().scale;n=parseFloat(mxUtils.prompt(mxResources.get(e.askZoomResource)||e.askZoomResource,n))/100;isNaN(n)||e.graph.getView().setScale(n)}),this.addAction("toggleTasks",function(e){null!=e.tasks?e.tasks.setVisible(!e.tasks.isVisible()):e.showTasks()}),this.addAction("toggleHelp",function(e){null!=e.help?e.help.setVisible(!e.help.isVisible()):e.showHelp()}),this.addAction("toggleOutline",function(e){null==e.outline?e.showOutline():e.outline.setVisible(!e.outline.isVisible())}),this.addAction("toggleConsole",function(e){mxLog.setVisible(!mxLog.isVisible())})},mxEditor.prototype.createSession=function(){var e=mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.SESSION,"session",e))});return this.connect(this.urlInit,this.urlPoll,this.urlNotify,e)},mxEditor.prototype.configure=function(e){null!=e&&(new mxCodec(e.ownerDocument).decode(e,this),this.resetHistory())},mxEditor.prototype.resetFirstTime=function(){document.cookie="mxgraph=seen; expires=Fri, 27 Jul 2001 02:47:11 UTC; path=/"},mxEditor.prototype.resetHistory=function(){this.lastSnapshot=(new Date).getTime(),this.undoManager.clear(),this.ignoredChanges=0,this.setModified(!1)},mxEditor.prototype.addAction=function(e,n){this.actions[e]=n},mxEditor.prototype.execute=function(n,e,t){var a=this.actions[n];if(null!=a)try{var i=arguments;i[0]=this,a.apply(this,i)}catch(e){throw mxUtils.error("Cannot execute "+n+": "+e.message,280,!0),e}else mxUtils.error("Cannot find action "+n,280,!0)},mxEditor.prototype.addTemplate=function(e,n){this.templates[e]=n},mxEditor.prototype.getTemplate=function(e){return this.templates[e]},mxEditor.prototype.createGraph=function(){var e=new mxGraph(null,null,this.graphRenderHint);return e.setTooltips(!0),e.setPanning(!0),this.installDblClickHandler(e),this.installUndoHandler(e),this.installDrillHandler(e),this.installChangeHandler(e),this.installInsertHandler(e),e.panningHandler.factoryMethod=mxUtils.bind(this,function(e,n,t){return this.createPopupMenu(e,n,t)}),e.connectionHandler.factoryMethod=mxUtils.bind(this,function(e,n){return this.createEdge(e,n)}),this.createSwimlaneManager(e),this.createLayoutManager(e),e},mxEditor.prototype.createSwimlaneManager=function(e){return(e=new mxSwimlaneManager(e,!1)).isHorizontal=mxUtils.bind(this,function(){return this.horizontalFlow}),e.isEnabled=mxUtils.bind(this,function(){return this.maintainSwimlanes}),e},mxEditor.prototype.createLayoutManager=function(a){var e=new mxLayoutManager(a),i=this;return e.getLayout=function(e){var n=null,t=i.graph.getModel();return null!=t.getParent(e)&&(i.layoutSwimlanes&&a.isSwimlane(e)?(null==i.swimlaneLayout&&(i.swimlaneLayout=i.createSwimlaneLayout()),n=i.swimlaneLayout):i.layoutDiagram&&(a.isValidRoot(e)||null==t.getParent(t.getParent(e)))&&(null==i.diagramLayout&&(i.diagramLayout=i.createDiagramLayout()),n=i.diagramLayout)),n},e},mxEditor.prototype.setGraphContainer=function(e){null==this.graph.container&&(this.graph.init(e),this.rubberband=new mxRubberband(this.graph),this.disableContextMenu&&mxEvent.disableContextMenu(e),mxClient.IS_QUIRKS&&new mxDivResizer(e))},mxEditor.prototype.installDblClickHandler=function(a){a.addListener(mxEvent.DOUBLE_CLICK,mxUtils.bind(this,function(e,n){var t=n.getProperty("cell");null!=t&&a.isEnabled()&&null!=this.dblClickAction&&(this.execute(this.dblClickAction,t),n.consume())}))},mxEditor.prototype.installUndoHandler=function(a){var e=mxUtils.bind(this,function(e,n){var t=n.getProperty("edit");this.undoManager.undoableEditHappened(t)});a.getModel().addListener(mxEvent.UNDO,e),a.getView().addListener(mxEvent.UNDO,e),e=function(e,n){var t=n.getProperty("edit").changes;a.setSelectionCells(a.getSelectionCellsForChanges(t))},this.undoManager.addListener(mxEvent.UNDO,e),this.undoManager.addListener(mxEvent.REDO,e)},mxEditor.prototype.installDrillHandler=function(e){var n=mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.ROOT))});e.getView().addListener(mxEvent.DOWN,n),e.getView().addListener(mxEvent.UP,n)},mxEditor.prototype.installChangeHandler=function(s){var e=mxUtils.bind(this,function(e,n){this.setModified(!0),1==this.validating&&s.validateGraph();for(var t=n.getProperty("edit").changes,a=0;a<t.length;a++){var i=t[a];if(i instanceof mxRootChange||i instanceof mxValueChange&&i.cell==this.graph.model.root||i instanceof mxCellAttributeChange&&i.cell==this.graph.model.root){this.fireEvent(new mxEventObject(mxEvent.ROOT));break}}});s.getModel().addListener(mxEvent.CHANGE,e)},mxEditor.prototype.installInsertHandler=function(e){var t=this;e.addMouseListener({mouseDown:function(e,n){null==t.insertFunction||n.isPopupTrigger()||!t.forcedInserting&&null!=n.getState()||(t.graph.clearSelection(),t.insertFunction(n.getEvent(),n.getCell()),this.isActive=!0,n.consume())},mouseMove:function(e,n){this.isActive&&n.consume()},mouseUp:function(e,n){this.isActive&&(this.isActive=!1,n.consume())}})},mxEditor.prototype.createDiagramLayout=function(){var e=this.graph.gridSize,n=new mxStackLayout(this.graph,!this.horizontalFlow,this.swimlaneSpacing,2*e,2*e);return n.isVertexIgnored=function(e){return!n.graph.isSwimlane(e)},n},mxEditor.prototype.createSwimlaneLayout=function(){return new mxCompactTreeLayout(this.graph,this.horizontalFlow)},mxEditor.prototype.createToolbar=function(){return new mxDefaultToolbar(null,this)},mxEditor.prototype.setToolbarContainer=function(e){this.toolbar.init(e),mxClient.IS_QUIRKS&&new mxDivResizer(e)},mxEditor.prototype.setStatusContainer=function(e){null==this.status&&(this.status=e,this.addListener(mxEvent.SAVE,mxUtils.bind(this,function(){var e=(new Date).toLocaleString();this.setStatus((mxResources.get(this.lastSavedResource)||this.lastSavedResource)+": "+e)})),this.addListener(mxEvent.OPEN,mxUtils.bind(this,function(){this.setStatus((mxResources.get(this.currentFileResource)||this.currentFileResource)+": "+this.filename)})),mxClient.IS_QUIRKS&&new mxDivResizer(e))},mxEditor.prototype.setStatus=function(e){null!=this.status&&null!=e&&(this.status.innerHTML=e)},mxEditor.prototype.setTitleContainer=function(n){this.addListener(mxEvent.ROOT,mxUtils.bind(this,function(e){n.innerHTML=this.getTitle()})),mxClient.IS_QUIRKS&&new mxDivResizer(n)},mxEditor.prototype.treeLayout=function(e,n){null!=e&&new mxCompactTreeLayout(this.graph,n).execute(e)},mxEditor.prototype.getTitle=function(){for(var e="",n=this.graph,t=n.getCurrentRoot();null!=t&&null!=n.getModel().getParent(n.getModel().getParent(t));)n.isValidRoot(t)&&(e=" > "+n.convertValueToString(t)+e),t=n.getModel().getParent(t);return this.getRootTitle()+e},mxEditor.prototype.getRootTitle=function(){var e=this.graph.getModel().getRoot();return this.graph.convertValueToString(e)},mxEditor.prototype.undo=function(){this.undoManager.undo()},mxEditor.prototype.redo=function(){this.undoManager.redo()},mxEditor.prototype.groupCells=function(){var e=null!=this.groupBorderSize?this.groupBorderSize:this.graph.gridSize;return this.graph.groupCells(this.createGroup(),e)},mxEditor.prototype.createGroup=function(){return this.graph.getModel().cloneCell(this.defaultGroup)},mxEditor.prototype.open=function(e){if(null!=e){var n=mxUtils.load(e).getXml();this.readGraphModel(n.documentElement),this.filename=e,this.fireEvent(new mxEventObject(mxEvent.OPEN,"filename",e))}},mxEditor.prototype.readGraphModel=function(e){new mxCodec(e.ownerDocument).decode(e,this.graph.getModel()),this.resetHistory()},mxEditor.prototype.save=function(e,n){if(null!=(e=e||this.getUrlPost())&&0<e.length){var t=this.writeGraphModel(n);this.postDiagram(e,t),this.setModified(!1)}this.fireEvent(new mxEventObject(mxEvent.SAVE,"url",e))},mxEditor.prototype.postDiagram=function(n,t){this.escapePostData&&(t=encodeURIComponent(t)),mxUtils.post(n,this.postParameterName+"="+t,mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.POST,"request",e,"url",n,"data",t))}))},mxEditor.prototype.writeGraphModel=function(e){e=null!=e?e:this.linefeed;var n=(new mxCodec).encode(this.graph.getModel());return mxUtils.getXml(n,e)},mxEditor.prototype.getUrlPost=function(){return this.urlPost},mxEditor.prototype.getUrlImage=function(){return this.urlImage},mxEditor.prototype.connect=function(e,n,t,a){var i=null;return mxClient.IS_LOCAL||((i=new mxSession(this.graph.getModel(),e,n,t)).addListener(mxEvent.RECEIVE,mxUtils.bind(this,function(e,n){null!=n.getProperty("node").getAttribute("namespace")&&this.resetHistory()})),i.addListener(mxEvent.DISCONNECT,a),i.addListener(mxEvent.CONNECT,a),i.addListener(mxEvent.NOTIFY,a),i.addListener(mxEvent.GET,a),i.start()),i},mxEditor.prototype.swapStyles=function(e,n){var t=this.graph.getStylesheet().styles[n];this.graph.getView().getStylesheet().putCellStyle(n,this.graph.getStylesheet().styles[e]),this.graph.getStylesheet().putCellStyle(e,t),this.graph.refresh()},mxEditor.prototype.showProperties=function(e){if(null==(e=e||this.graph.getSelectionCell())&&(null==(e=this.graph.getCurrentRoot())&&(e=this.graph.getModel().getRoot())),null!=e){this.graph.stopEditing(!0);var n=(t=mxUtils.getOffset(this.graph.container)).x+10,t=t.y;if(null==this.properties||this.movePropertiesDialog){var a=this.graph.getCellBounds(e);null!=a&&(n+=a.x+Math.min(200,a.width),t+=a.y)}else n=this.properties.getX(),t=this.properties.getY();this.hideProperties(),null!=(e=this.createProperties(e))&&(this.properties=new mxWindow(mxResources.get(this.propertiesResource)||this.propertiesResource,e,n,t,this.propertiesWidth,this.propertiesHeight,!1),this.properties.setVisible(!0))}},mxEditor.prototype.isPropertiesVisible=function(){return null!=this.properties},mxEditor.prototype.createProperties=function(t){var a=this.graph.getModel(),e=a.getValue(t);if(mxUtils.isNode(e)){var n=new mxForm("properties");n.addText("ID",t.getId()).setAttribute("readonly","true");var i=null,s=null,o=null,r=null,l=null;a.isVertex(t)&&(null!=(i=a.getGeometry(t))&&(s=n.addText("top",i.y),o=n.addText("left",i.x),r=n.addText("width",i.width),l=n.addText("height",i.height)));var d=a.getStyle(t),c=n.addText("Style",d||""),m=e.attributes,u=[];for(e=0;e<m.length;e++)u[e]=n.addTextarea(m[e].nodeName,m[e].nodeValue,"label"==m[e].nodeName?4:2);return e=mxUtils.bind(this,function(){this.hideProperties(),a.beginUpdate();try{null!=i&&((i=i.clone()).x=parseFloat(o.value),i.y=parseFloat(s.value),i.width=parseFloat(r.value),i.height=parseFloat(l.value),a.setGeometry(t,i)),0<c.value.length?a.setStyle(t,c.value):a.setStyle(t,null);for(var e=0;e<m.length;e++){var n=new mxCellAttributeChange(t,m[e].nodeName,u[e].value);a.execute(n)}this.graph.isAutoSizeCell(t)&&this.graph.updateCellSize(t)}finally{a.endUpdate()}}),d=mxUtils.bind(this,function(){this.hideProperties()}),n.addButtons(e,d),n.table}return null},mxEditor.prototype.hideProperties=function(){null!=this.properties&&(this.properties.destroy(),this.properties=null)},mxEditor.prototype.showTasks=function(){if(null==this.tasks){var n=document.createElement("div");n.style.padding="4px",n.style.paddingLeft="20px";var e=document.body.clientWidth;(e=new mxWindow(mxResources.get(this.tasksResource)||this.tasksResource,n,e-220,this.tasksTop,200)).setClosable(!0),e.destroyOnClose=!1;var t=mxUtils.bind(this,function(e){mxEvent.release(n),n.innerHTML="",this.createTasks(n)});this.graph.getModel().addListener(mxEvent.CHANGE,t),this.graph.getSelectionModel().addListener(mxEvent.CHANGE,t),this.graph.addListener(mxEvent.ROOT,t),null!=this.tasksWindowImage&&e.setImage(this.tasksWindowImage),this.tasks=e,this.createTasks(n)}this.tasks.setVisible(!0)},mxEditor.prototype.refreshTasks=function(e){null!=this.tasks&&(e=this.tasks.content,mxEvent.release(e),e.innerHTML="",this.createTasks(e))},mxEditor.prototype.createTasks=function(e){},mxEditor.prototype.showHelp=function(e){if(null==this.help){var n=document.createElement("iframe");n.setAttribute("src",mxResources.get("urlHelp")||this.urlHelp),n.setAttribute("height","100%"),n.setAttribute("width","100%"),n.setAttribute("frameBorder","0"),n.style.backgroundColor="white",e=document.body.clientWidth;var t=document.body.clientHeight||document.documentElement.clientHeight,a=new mxWindow(mxResources.get(this.helpResource)||this.helpResource,n,(e-this.helpWidth)/2,(t-this.helpHeight)/3,this.helpWidth,this.helpHeight);a.setMaximizable(!0),a.setClosable(!0),a.destroyOnClose=!1,a.setResizable(!0),null!=this.helpWindowImage&&a.setImage(this.helpWindowImage),mxClient.IS_NS&&(e=function(e){n.setAttribute("height",a.div.offsetHeight-26+"px")},a.addListener(mxEvent.RESIZE_END,e),a.addListener(mxEvent.MAXIMIZE,e),a.addListener(mxEvent.NORMALIZE,e),a.addListener(mxEvent.SHOW,e)),this.help=a}this.help.setVisible(!0)},mxEditor.prototype.showOutline=function(){if(null==this.outline){var e=document.createElement("div");e.style.overflow="hidden",e.style.width="100%",e.style.height="100%",e.style.background="white",e.style.cursor="move";var n=new mxWindow(mxResources.get(this.outlineResource)||this.outlineResource,e,600,480,200,200,!1),t=new mxOutline(this.graph,e);n.setClosable(!0),n.setResizable(!0),n.destroyOnClose=!1,n.addListener(mxEvent.RESIZE_END,function(){t.update()}),this.outline=n,this.outline.outline=t}this.outline.setVisible(!0),this.outline.outline.update(!0)},mxEditor.prototype.setMode=function(e){"select"==e?(this.graph.panningHandler.useLeftButtonForPanning=!1,this.graph.setConnectable(!1)):"connect"==e?(this.graph.panningHandler.useLeftButtonForPanning=!1,this.graph.setConnectable(!0)):"pan"==e&&(this.graph.panningHandler.useLeftButtonForPanning=!0,this.graph.setConnectable(!1))},mxEditor.prototype.createPopupMenu=function(e,n,t){this.popupHandler.createMenu(this,e,n,t)},mxEditor.prototype.createEdge=function(e,n){var t=null;if(null!=this.defaultEdge)t=this.graph.getModel().cloneCell(this.defaultEdge);else{(t=new mxCell("")).setEdge(!0);var a=new mxGeometry;a.relative=!0,t.setGeometry(a)}return null!=(a=this.getEdgeStyle())&&t.setStyle(a),t},mxEditor.prototype.getEdgeStyle=function(){return this.defaultEdgeStyle},mxEditor.prototype.consumeCycleAttribute=function(e){return null!=this.cycleAttributeValues&&0<this.cycleAttributeValues.length&&this.graph.isSwimlane(e)?this.cycleAttributeValues[this.cycleAttributeIndex++%this.cycleAttributeValues.length]:null},mxEditor.prototype.cycleAttribute=function(e){if(null!=this.cycleAttributeName){var n=this.consumeCycleAttribute(e);null!=n&&e.setStyle(e.getStyle()+";"+this.cycleAttributeName+"="+n)}},mxEditor.prototype.addVertex=function(e,n,t,a){for(var i=this.graph.getModel();null!=e&&!this.graph.isValidDropTarget(e);)e=i.getParent(e);e=null!=e?e:this.graph.getSwimlaneAt(t,a);var s=this.graph.getView().scale,o=i.getGeometry(n),r=i.getGeometry(e);if(this.graph.isSwimlane(n)&&!this.graph.swimlaneNesting)e=null;else{if(null==e&&this.swimlaneRequired)return null;if(null!=e&&null!=r){var l=this.graph.getView().getState(e);if(null!=l){if(t-=l.origin.x*s,a-=l.origin.y*s,this.graph.isConstrainedMoving){r=o.width;var d=o.height,c=l.x+l.width;c<t+r&&(t-=t+r-c),(c=l.y+l.height)<a+d&&(a-=a+d-c)}}else null!=r&&(t-=r.x*s,a-=r.y*s)}}(o=o.clone()).x=this.graph.snap(t/s-this.graph.getView().translate.x-this.graph.gridSize/2),o.y=this.graph.snap(a/s-this.graph.getView().translate.y-this.graph.gridSize/2),n.setGeometry(o),null==e&&(e=this.graph.getDefaultParent()),this.cycleAttribute(n),this.fireEvent(new mxEventObject(mxEvent.BEFORE_ADD_VERTEX,"vertex",n,"parent",e)),i.beginUpdate();try{null!=(n=this.graph.addCell(n,e))&&(this.graph.constrainChild(n),this.fireEvent(new mxEventObject(mxEvent.ADD_VERTEX,"vertex",n)))}finally{i.endUpdate()}return null!=n&&(this.graph.setSelectionCell(n),this.graph.scrollCellToVisible(n),this.fireEvent(new mxEventObject(mxEvent.AFTER_ADD_VERTEX,"vertex",n))),n},mxEditor.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,null!=this.tasks&&this.tasks.destroy(),null!=this.outline&&this.outline.destroy(),null!=this.properties&&this.properties.destroy(),null!=this.keyHandler&&this.keyHandler.destroy(),null!=this.rubberband&&this.rubberband.destroy(),null!=this.toolbar&&this.toolbar.destroy(),null!=this.graph&&this.graph.destroy(),this.templates=this.status=null)};var mxCodecRegistry={codecs:[],aliases:[],register:function(e){if(null!=e){var n=e.getName();mxCodecRegistry.codecs[n]=e;var t=mxUtils.getFunctionName(e.template.constructor);t!=n&&mxCodecRegistry.addAlias(t,n)}return e},addAlias:function(e,n){mxCodecRegistry.aliases[e]=n},getCodec:function(e){var n=null;if(null!=e){n=mxUtils.getFunctionName(e);var t=mxCodecRegistry.aliases[n];if(null!=t&&(n=t),null==(n=mxCodecRegistry.codecs[n]))try{n=new mxObjectCodec(new e),mxCodecRegistry.register(n)}catch(e){}}return n}};function mxCodec(e){this.document=e||mxUtils.createXmlDocument(),this.objects=[]}function mxObjectCodec(e,n,t,a){for(var i in this.template=e,this.exclude=null!=n?n:[],this.idrefs=null!=t?t:[],this.mapping=null!=a?a:[],this.reverse={},this.mapping)this.reverse[this.mapping[i]]=i}mxCodec.prototype.document=null,mxCodec.prototype.objects=null,mxCodec.prototype.encodeDefaults=!1,mxCodec.prototype.putObject=function(e,n){return this.objects[e]=n},mxCodec.prototype.getObject=function(e){var n=null;return null!=e&&(null==(n=this.objects[e])&&(null==(n=this.lookup(e))&&(null!=(e=this.getElementById(e))&&(n=this.decode(e))))),n},mxCodec.prototype.lookup=function(e){return null},mxCodec.prototype.getElementById=function(e,n){return mxUtils.findNodeByAttribute(this.document.documentElement,null!=n?n:"id",e)},mxCodec.prototype.getId=function(e){var n=null;return null!=e&&(null==(n=this.reference(e))&&e instanceof mxCell&&(null==(n=e.getId())&&(0==(n=mxCellPath.create(e)).length&&(n="root")))),n},mxCodec.prototype.reference=function(e){return null},mxCodec.prototype.encode=function(e){var n=null;if(null!=e&&null!=e.constructor){var t=mxCodecRegistry.getCodec(e.constructor);null!=t?n=t.encode(this,e):mxUtils.isNode(e)?n=mxClient.IS_IE?e.cloneNode(!0):this.document.importNode(e,!0):mxLog.warn("mxCodec.encode: No codec for "+mxUtils.getFunctionName(e.constructor))}return n},mxCodec.prototype.decode=function(a,b){var c=null;if(null!=a&&a.nodeType==mxConstants.NODETYPE_ELEMENT){var d=null;try{d=eval(a.nodeName)}catch(e){}try{var f=mxCodecRegistry.getCodec(d);null!=f?c=f.decode(this,a,b):(c=a.cloneNode(!0),c.removeAttribute("as"))}catch(e){mxLog.debug("Cannot decode "+a.nodeName+": "+e.message)}}return c},mxCodec.prototype.encodeCell=function(e,n,t){if(n.appendChild(this.encode(e)),null==t||t){t=e.getChildCount();for(var a=0;a<t;a++)this.encodeCell(e.getChildAt(a),n)}},mxCodec.prototype.isCellCodec=function(e){return null!=e&&"function"==typeof e.isCellCodec&&e.isCellCodec()},mxCodec.prototype.decodeCell=function(e,n){n=null==n||n;var t=null;if(null!=e&&e.nodeType==mxConstants.NODETYPE_ELEMENT){if(t=mxCodecRegistry.getCodec(e.nodeName),!this.isCellCodec(t))for(var a=e.firstChild;null!=a&&!this.isCellCodec(t);)t=mxCodecRegistry.getCodec(a.nodeName),a=a.nextSibling;this.isCellCodec(t)||(t=mxCodecRegistry.getCodec(mxCell)),t=t.decode(this,e),n&&this.insertIntoGraph(t)}return t},mxCodec.prototype.insertIntoGraph=function(e){var n=e.parent,t=e.getTerminal(!0),a=e.getTerminal(!1);e.setTerminal(null,!1),e.setTerminal(null,!0),(e.parent=null)!=n&&n.insert(e),null!=t&&t.insertEdge(e,!0),null!=a&&a.insertEdge(e,!1)},mxCodec.prototype.setAttribute=function(e,n,t){null!=n&&null!=t&&e.setAttribute(n,t)},mxObjectCodec.prototype.template=null,mxObjectCodec.prototype.exclude=null,mxObjectCodec.prototype.idrefs=null,mxObjectCodec.prototype.mapping=null,mxObjectCodec.prototype.reverse=null,mxObjectCodec.prototype.getName=function(){return mxUtils.getFunctionName(this.template.constructor)},mxObjectCodec.prototype.cloneTemplate=function(){return new this.template.constructor},mxObjectCodec.prototype.getFieldName=function(e){if(null!=e){var n=this.reverse[e];null!=n&&(e=n)}return e},mxObjectCodec.prototype.getAttributeName=function(e){if(null!=e){var n=this.mapping[e];null!=n&&(e=n)}return e},mxObjectCodec.prototype.isExcluded=function(e,n,t,a){return n==mxObjectIdentity.FIELD_NAME||0<=mxUtils.indexOf(this.exclude,n)},mxObjectCodec.prototype.isReference=function(e,n,t,a){return 0<=mxUtils.indexOf(this.idrefs,n)},mxObjectCodec.prototype.encode=function(e,n){var t=e.document.createElement(this.getName());return n=this.beforeEncode(e,n,t),this.encodeObject(e,n,t),this.afterEncode(e,n,t)},mxObjectCodec.prototype.encodeObject=function(e,n,t){for(var a in e.setAttribute(t,"id",e.getId(n)),n){var i=a,s=n[i];null!=s&&!this.isExcluded(n,i,s,!0)&&(mxUtils.isNumeric(i)&&(i=null),this.encodeValue(e,n,i,s,t))}},mxObjectCodec.prototype.encodeValue=function(e,n,t,a,i){if(null!=a){if(this.isReference(n,t,a,!0)){var s=e.getId(a);if(null==s)return void mxLog.warn("mxObjectCodec.encode: No ID for "+this.getName()+"."+t+"="+a);a=s}s=this.template[t],(null==t||e.encodeDefaults||s!=a)&&(t=this.getAttributeName(t),this.writeAttribute(e,n,t,a,i))}},mxObjectCodec.prototype.writeAttribute=function(e,n,t,a,i){"object"!=typeof a?this.writePrimitiveAttribute(e,n,t,a,i):this.writeComplexAttribute(e,n,t,a,i)},mxObjectCodec.prototype.writePrimitiveAttribute=function(e,n,t,a,i){a=this.convertValueToXml(a),null==t?(n=e.document.createElement("add"),"function"==typeof a?n.appendChild(e.document.createTextNode(a)):e.setAttribute(n,"value",a),i.appendChild(n)):"function"!=typeof a&&e.setAttribute(i,t,a)},mxObjectCodec.prototype.writeComplexAttribute=function(e,n,t,a,i){null!=(e=e.encode(a))?(null!=t&&e.setAttribute("as",t),i.appendChild(e)):mxLog.warn("mxObjectCodec.encode: No node for "+this.getName()+"."+t+": "+a)},mxObjectCodec.prototype.convertValueToXml=function(e){return void 0!==e.length||1!=e&&0!=e||(e=1==e?"1":"0"),e},mxObjectCodec.prototype.convertValueFromXml=function(e){return mxUtils.isNumeric(e)&&(e=parseFloat(e)),e},mxObjectCodec.prototype.beforeEncode=function(e,n,t){return n},mxObjectCodec.prototype.afterEncode=function(e,n,t){return t},mxObjectCodec.prototype.decode=function(e,n,t){var a=n.getAttribute("id"),i=e.objects[a];return null==i&&(i=t||this.cloneTemplate(),null!=a&&e.putObject(a,i)),n=this.beforeDecode(e,n,i),this.decodeNode(e,n,i),this.afterDecode(e,n,i)},mxObjectCodec.prototype.decodeNode=function(e,n,t){null!=n&&(this.decodeAttributes(e,n,t),this.decodeChildren(e,n,t))},mxObjectCodec.prototype.decodeAttributes=function(e,n,t){if(null!=(n=n.attributes))for(var a=0;a<n.length;a++)this.decodeAttribute(e,n[a],t)},mxObjectCodec.prototype.decodeAttribute=function(e,n,t){var a=n.nodeName;if("as"!=a&&"id"!=a){n="value"==a?n.nodeValue:this.convertValueFromXml(n.nodeValue);var i=this.getFieldName(a);if(this.isReference(t,i,n,!1)){if(null==(e=e.getObject(n)))return void mxLog.warn("mxObjectCodec.decode: No object for "+this.getName()+"."+a+"="+n);n=e}this.isExcluded(t,a,n,!1)||(t[a]=n)}},mxObjectCodec.prototype.decodeChildren=function(e,n,t){for(n=n.firstChild;null!=n;){var a=n.nextSibling;n.nodeType==mxConstants.NODETYPE_ELEMENT&&!this.processInclude(e,n,t)&&this.decodeChild(e,n,t),n=a}},mxObjectCodec.prototype.decodeChild=function(e,n,t){var a=this.getFieldName(n.getAttribute("as"));if(null==a||!this.isExcluded(t,a,n,!1)){var i=this.getFieldTemplate(t,a,n),s=null;"add"==n.nodeName?null==(s=n.getAttribute("value"))&&(s=mxUtils.eval(mxUtils.getTextContent(n))):s=e.decode(n,i),this.addObjectValue(t,a,s,i)}},mxObjectCodec.prototype.getFieldTemplate=function(e,n,t){return(e=e[n])instanceof Array&&0<e.length&&(e=null),e},mxObjectCodec.prototype.addObjectValue=function(e,n,t,a){null!=t&&t!=a&&(null!=n&&0<n.length?e[n]=t:e.push(t))},mxObjectCodec.prototype.processInclude=function(e,n,t){if("include"!=n.nodeName)return!1;if(null!=(n=n.getAttribute("name")))try{var a=mxUtils.load(n).getDocumentElement();null!=a&&e.decode(a,t)}catch(e){}return!0},mxObjectCodec.prototype.beforeDecode=function(e,n,t){return n},mxObjectCodec.prototype.afterDecode=function(e,n,t){return t},mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxCell,["children","edges","overlays","mxTransient"],["parent","source","target"]);return e.isCellCodec=function(){return!0},e.isExcluded=function(e,n,t,a){return mxObjectCodec.prototype.isExcluded.apply(this,arguments)||a&&"value"==n&&t.nodeType==mxConstants.NODETYPE_ELEMENT},e.afterEncode=function(e,n,t){if(null!=n.value&&n.value.nodeType==mxConstants.NODETYPE_ELEMENT){var a=t;(t=mxClient.IS_IE?n.value.cloneNode(!0):e.document.importNode(n.value,!0)).appendChild(a),e=a.getAttribute("id"),t.setAttribute("id",e),a.removeAttribute("id")}return t},e.beforeDecode=function(e,n,t){var a=n,i=this.getName();if(n.nodeName!=i?(null!=(a=n.getElementsByTagName(i)[0])&&a.parentNode==n?(mxUtils.removeWhitespace(a,!0),mxUtils.removeWhitespace(a,!1),a.parentNode.removeChild(a)):a=null,t.value=n.cloneNode(!0),null!=(n=t.value.getAttribute("id"))&&(t.setId(n),t.value.removeAttribute("id"))):t.setId(n.getAttribute("id")),null!=a)for(n=0;n<this.idrefs.length;n++){i=this.idrefs[n];var s=a.getAttribute(i);if(null!=s){a.removeAttribute(i);var o=e.objects[s]||e.lookup(s);null==o&&(null!=(s=e.getElementById(s))&&(o=(mxCodecRegistry.codecs[s.nodeName]||this).decode(e,s))),t[i]=o}}return a},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxGraphModel);return e.encodeObject=function(e,n,t){var a=e.document.createElement("root");e.encodeCell(n.getRoot(),a),t.appendChild(a)},e.decodeChild=function(e,n,t){"root"==n.nodeName?this.decodeRoot(e,n,t):mxObjectCodec.prototype.decodeChild.apply(this,arguments)},e.decodeRoot=function(e,n,t){var a=null;for(n=n.firstChild;null!=n;){var i=e.decodeCell(n);null!=i&&null==i.getParent()&&(a=i),n=n.nextSibling}null!=a&&t.setRoot(a)},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxRootChange,["model","previous","root"]);return e.afterEncode=function(e,n,t){return e.encodeCell(n.root,t),t},e.beforeDecode=function(e,n,t){if(null!=n.firstChild&&n.firstChild.nodeType==mxConstants.NODETYPE_ELEMENT){var a=(n=n.cloneNode(!0)).firstChild;for(t.root=e.decodeCell(a,!1),t=a.nextSibling,a.parentNode.removeChild(a),a=t;null!=a;)t=a.nextSibling,e.decodeCell(a),a.parentNode.removeChild(a),a=t}return n},e.afterDecode=function(e,n,t){return t.previous=t.root,t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxChildChange,["model","child","previousIndex"],["parent","previous"]);return e.isReference=function(e,n,t,a){return!("child"!=n||null==e.previous&&a)||0<=mxUtils.indexOf(this.idrefs,n)},e.afterEncode=function(e,n,t){return this.isReference(n,"child",n.child,!0)?t.setAttribute("child",e.getId(n.child)):e.encodeCell(n.child,t),t},e.beforeDecode=function(e,n,t){if(null!=n.firstChild&&n.firstChild.nodeType==mxConstants.NODETYPE_ELEMENT){var a=(n=n.cloneNode(!0)).firstChild;for(t.child=e.decodeCell(a,!1),t=a.nextSibling,a.parentNode.removeChild(a),a=t;null!=a;){if(t=a.nextSibling,a.nodeType==mxConstants.NODETYPE_ELEMENT){var i=a.getAttribute("id");null==e.lookup(i)&&e.decodeCell(a)}a.parentNode.removeChild(a),a=t}}else a=n.getAttribute("child"),t.child=e.getObject(a);return n},e.afterDecode=function(e,n,t){return t.child.parent=t.previous,t.previous=t.parent,t.previousIndex=t.index,t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxTerminalChange,["model","previous"],["cell","terminal"]);return e.afterDecode=function(e,n,t){return t.previous=t.terminal,t},e}());var mxGenericChangeCodec=function(e,a){var n=new mxObjectCodec(e,["model","previous"],["cell"]);return n.afterDecode=function(e,n,t){return mxUtils.isNode(t.cell)&&(t.cell=e.decodeCell(t.cell,!1)),t.previous=t[a],t},n};mxCodecRegistry.register(mxGenericChangeCodec(new mxValueChange,"value")),mxCodecRegistry.register(mxGenericChangeCodec(new mxStyleChange,"style")),mxCodecRegistry.register(mxGenericChangeCodec(new mxGeometryChange,"geometry")),mxCodecRegistry.register(mxGenericChangeCodec(new mxCollapseChange,"collapsed")),mxCodecRegistry.register(mxGenericChangeCodec(new mxVisibleChange,"visible")),mxCodecRegistry.register(mxGenericChangeCodec(new mxCellAttributeChange,"value")),mxCodecRegistry.register(new mxObjectCodec(new mxGraph,"graphListeners eventListeners view container cellRenderer editor selection".split(" "))),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxGraphView);return e.encode=function(e,n){return this.encodeCell(e,n,n.graph.getModel().getRoot())},e.encodeCell=function(e,n,t){var a=n.graph.getModel(),i=n.getState(t),s=a.getParent(t);if(null==s||null!=i){var o=a.getChildCount(t),r=n.graph.getCellGeometry(t),l=null;if(s==a.getRoot()?l="layer":null==s?l="graph":a.isEdge(t)?l="edge":0<o&&null!=r?l="group":a.isVertex(t)&&(l="vertex"),null!=l){var d=e.document.createElement(l);if(null!=n.graph.getLabel(t)&&(d.setAttribute("label",n.graph.getLabel(t)),n.graph.isHtmlLabel(t)&&d.setAttribute("html",!0)),null==s){var c=n.getGraphBounds();null!=c&&(d.setAttribute("x",Math.round(c.x)),d.setAttribute("y",Math.round(c.y)),d.setAttribute("width",Math.round(c.width)),d.setAttribute("height",Math.round(c.height))),d.setAttribute("scale",n.scale)}else if(null!=i&&null!=r){for(c in i.style)"function"==typeof(s=i.style[c])&&"object"==typeof s&&(s=mxStyleRegistry.getName(s)),null!=s&&"function"!=typeof s&&"object"!=typeof s&&d.setAttribute(c,s);if(null!=(s=i.absolutePoints)&&0<s.length){for(r=Math.round(s[0].x)+","+Math.round(s[0].y),c=1;c<s.length;c++)r+=" "+Math.round(s[c].x)+","+Math.round(s[c].y);d.setAttribute("points",r)}else d.setAttribute("x",Math.round(i.x)),d.setAttribute("y",Math.round(i.y)),d.setAttribute("width",Math.round(i.width)),d.setAttribute("height",Math.round(i.height));null!=(c=i.absoluteOffset)&&(0!=c.x&&d.setAttribute("dx",Math.round(c.x)),0!=c.y&&d.setAttribute("dy",Math.round(c.y)))}for(c=0;c<o;c++)null!=(i=this.encodeCell(e,n,a.getChildAt(t,c)))&&d.appendChild(i)}}return d},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxStylesheet);return e.encode=function(e,n){var t,a=e.document.createElement(this.getName());for(t in n.styles){var i=n.styles[t],s=e.document.createElement("add");if(null!=t){for(var o in s.setAttribute("as",t),i){var r=this.getStringValue(o,i[o]);if(null!=r){var l=e.document.createElement("add");l.setAttribute("value",r),l.setAttribute("as",o),s.appendChild(l)}}0<s.childNodes.length&&a.appendChild(s)}}return a},e.getStringValue=function(e,n){var t=typeof n;return"function"==t?n=mxStyleRegistry.getName(style[j]):"object"==t&&(n=null),n},e.decode=function(e,n,t){t=t||new this.template.constructor;var a=n.getAttribute("id");for(null!=a&&(e.objects[a]=t),n=n.firstChild;null!=n;){if(!this.processInclude(e,n,t)&&"add"==n.nodeName&&null!=(a=n.getAttribute("as"))){var i=n.getAttribute("extend"),s=null!=i?mxUtils.clone(t.styles[i]):null;for(null==s&&(null!=i&&mxLog.warn("mxStylesheetCodec.decode: stylesheet "+i+" not found to extend"),s={}),i=n.firstChild;null!=i;){if(i.nodeType==mxConstants.NODETYPE_ELEMENT){var o=i.getAttribute("as");if("add"==i.nodeName){var r=mxUtils.getTextContent(i),l=null;null!=r&&0<r.length?l=mxUtils.eval(r):(l=i.getAttribute("value"),mxUtils.isNumeric(l)&&(l=parseFloat(l))),null!=l&&(s[o]=l)}else"remove"==i.nodeName&&delete s[o]}i=i.nextSibling}t.putCellStyle(a,s)}n=n.nextSibling}return t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultKeyHandler);return e.encode=function(e,n){return null},e.decode=function(e,n,t){if(null!=t)for(n=n.firstChild;null!=n;){if(!this.processInclude(e,n,t)&&"add"==n.nodeName){var a=n.getAttribute("as"),i=n.getAttribute("action"),s=n.getAttribute("control");t.bindAction(a,i,s)}n=n.nextSibling}return t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultToolbar);return e.encode=function(e,n){return null},e.decode=function(e,n,t){if(null!=t){var a=t.editor;for(n=n.firstChild;null!=n;){if(n.nodeType==mxConstants.NODETYPE_ELEMENT&&!this.processInclude(e,n,t))if("separator"==n.nodeName)t.addSeparator();else if("br"==n.nodeName)t.toolbar.addBreak();else if("hr"==n.nodeName)t.toolbar.addLine();else if("add"==n.nodeName){var i=n.getAttribute("as"),s=(i=mxResources.get(i)||i,n.getAttribute("icon")),o=n.getAttribute("pressedIcon"),r=n.getAttribute("action"),l=n.getAttribute("mode"),d=n.getAttribute("template"),c="0"!=n.getAttribute("toggle"),m=mxUtils.getTextContent(n),u=null;if(null!=r)u=t.addItem(i,s,r,o);else if(null!=l){var p=mxUtils.eval(m);u=t.addMode(i,s,l,o,p)}else if(null!=d||null!=m&&0<m.length)u=a.templates[d],d=n.getAttribute("style"),null!=u&&null!=d&&(u=u.clone()).setStyle(d),(d=null)!=m&&0<m.length&&(d=mxUtils.eval(m)),u=t.addPrototype(i,s,u,o,d,c);else if(0<(o=mxUtils.getChildNodes(n)).length)if(null==s)for(d=t.addActionCombo(i),i=0;i<o.length;i++)"separator"==(c=o[i]).nodeName?t.addOption(d,"---"):"add"==c.nodeName&&(s=c.getAttribute("as"),c=c.getAttribute("action"),t.addActionOption(d,s,c));else{var g=null,v=t.addPrototype(i,s,function(){if(null==(e=a.templates[g.value]))return mxLog.warn("Template "+e+" not found"),null;var e=e.clone(),n=g.options[g.selectedIndex].cellStyle;return null!=n&&e.setStyle(n),e},null,null,c);g=t.addCombo();for(mxEvent.addListener(g,"change",function(){t.toolbar.selectMode(v,function(e){return e=mxUtils.convertPoint(a.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),a.addVertex(null,p(),e.x,e.y)}),t.toolbar.noReset=!1}),i=0;i<o.length;i++)"separator"==(c=o[i]).nodeName?t.addOption(g,"---"):"add"==c.nodeName&&(s=c.getAttribute("as"),m=c.getAttribute("template"),t.addOption(g,s,m||d).cellStyle=c.getAttribute("style"))}null!=u&&(null!=(d=n.getAttribute("id"))&&0<d.length&&u.setAttribute("id",d))}n=n.nextSibling}}return t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultPopupMenu);return e.encode=function(e,n){return null},e.decode=function(e,n,t){var a=n.getElementsByTagName("include")[0];return null!=a?this.processInclude(e,a,t):null!=t&&(t.config=n),t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxEditor,"modified lastSnapshot ignoredChanges undoManager graphContainer toolbarContainer".split(" "));return e.afterDecode=function(e,n,t){return null!=(e=n.getAttribute("defaultEdge"))&&(n.removeAttribute("defaultEdge"),t.defaultEdge=t.templates[e]),null!=(e=n.getAttribute("defaultGroup"))&&(n.removeAttribute("defaultGroup"),t.defaultGroup=t.templates[e]),t},e.decodeChild=function(e,n,t){if("Array"==n.nodeName){if("templates"==n.getAttribute("as"))return void this.decodeTemplates(e,n,t)}else if("ui"==n.nodeName)return void this.decodeUi(e,n,t);mxObjectCodec.prototype.decodeChild.apply(this,arguments)},e.decodeUi=function(e,n,t){for(e=n.firstChild;null!=e;){if("add"==e.nodeName){n=e.getAttribute("as");var a=e.getAttribute("element"),i=e.getAttribute("style"),s=null;if(null!=a)null!=(s=document.getElementById(a))&&null!=i&&(s.style.cssText+=";"+i);else{a=parseInt(e.getAttribute("x"));var o=parseInt(e.getAttribute("y")),r=e.getAttribute("width"),l=e.getAttribute("height");(s=document.createElement("div")).style.cssText=i,new mxWindow(mxResources.get(n)||n,s,a,o,r,l,!1,!0).setVisible(!0)}"graph"==n?t.setGraphContainer(s):"toolbar"==n?t.setToolbarContainer(s):"title"==n?t.setTitleContainer(s):"status"==n?t.setStatusContainer(s):"map"==n&&t.setMapContainer(s)}else"resource"==e.nodeName?mxResources.add(e.getAttribute("basename")):"stylesheet"==e.nodeName&&mxClient.link("stylesheet",e.getAttribute("name"));e=e.nextSibling}},e.decodeTemplates=function(e,n,t){null==t.templates&&(t.templates=[]),n=mxUtils.getChildNodes(n);for(var a=0;a<n.length;a++){for(var i=n[a].getAttribute("as"),s=n[a].firstChild;null!=s&&1!=s.nodeType;)s=s.nextSibling;null!=s&&(t.templates[i]=e.decodeCell(s))}},e}()),EditorUi=function(e,n,t){this.projectDesignController=e,this.editor=n||new Editor,this.container=t||document.body;var a=n.graph,i=this;CRUD_PERMISSIONS=this.projectDesignController.crudPermissions;var s=mxUtils.bind(this,function(e){return null==e&&(e=window.event),!!this.isEditingEnabled()&&a.isEditing()});this.container.style.overflow="hidden",(new Image).src=mxPopupMenu.prototype.submenuImage,null!=mxConnectionHandler.prototype.connectImage&&((new Image).src=mxConnectionHandler.prototype.connectImage.src),this.actions=new Actions(this),this.menus=new Menus(this),this.createDivs(),this.refresh(),this.createUi(),this.container==document.body&&(this.menubarContainer.onselectstart=s,this.menubarContainer.onmousedown=s,this.toolbarContainer.onselectstart=s,this.toolbarContainer.onmousedown=s,this.diagramContainer.onselectstart=s,this.diagramContainer.onmousedown=s,this.sidebarContainer.onselectstart=s,this.sidebarContainer.onmousedown=s,this.footerContainer.onselectstart=s,this.footerContainer.onmousedown=s),mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?(mxEvent.addListener(this.diagramContainer,"contextmenu",s),mxEvent.addListener(this.sidebarContainer,"contextmenu",s)):(this.diagramContainer.oncontextmenu=s,this.sidebarContainer.oncontextmenu=s),a.init(this.diagramContainer),a.refresh(),a.setEnabled(this.isEditingEnabled()),a.container.setAttribute("tabindex","0"),a.container.style.cursor="default",a.container.style.backgroundImage="url("+n.gridImage+")",a.container.style.backgroundPosition="-1px -1px",a.container.focus();var o=a.fireMouseEvent;a.fireMouseEvent=function(e,n,t){e==mxEvent.MOUSE_DOWN&&this.container.focus(),o.apply(this,arguments)},this.createMultiplicities(a.multiplicities,["start","finally","end"],[[1,1],[1,1],[0,0]],[[0,0],[0,0],[1,"n"]]),this.createMultiplicities(a.multiplicities,["answer","hangup","dial","ext_dial","queue","voicemail","callback"],[[1,1],[0,0],[0,1],[0,1],[0,1],[1,1],[0,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["login","pause","unpause","logout"],[[1,2],[1,2],[1,2],[1,2]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["set","math"],[[1,1],[1,1]],[[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["background","playback","menu","saydigits","saynumber","sayphonetic","google_cloud_tts","tts","ispeechtts","awspolly","getdigits","getsecretdigits","lumenvoxtts","sestektts","mrcpsynth"],[[1,"n"],[1,1],[1,"n"],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,"n"],[1,"n"],[1,1],[1,1],[1,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["record"],[[1,1]],[[1,"n"]]),this.createMultiplicities(a.multiplicities,["database","ispeechasr","sendSMS","sendMail","sendFax","googleasr","lumenvoxasr","tildeasr","dialogflow","dialogflowV2","awslex","sesteknda","sestekasr","restapi","mrcprecog"],[[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["gotoc","gotoif","gotoiftime","vswitch"],[[0,0],[1,2],[1,2],[1,"n"]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["queuelog","goal"],[[1,1],[1,1]],[[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["noop","system","agi","subproject","custom_app"],[[1,1],[1,1],[0,1],[0,1],[0,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),a.dblClick=function(e,t){var n=new mxEventObject(mxEvent.DOUBLE_CLICK,"event",e,"cell",t);this.fireEvent(n),mxEvent.isConsumed(e)||n.isConsumed()||(this.getModel().isEdge(t)?0<=["background","gotoif","gotoiftime","menu","getdigits","getsecretdigits","vswitch","login","pause","unpause","logout"].indexOf(t.source.value.tagName)&&this.startEditingAtCell(t):this.getModel().isVertex(t)&&i.projectDesignController.openDialog(t.getValue(),function(e){for(var n=0;n<e.length;n+=1)t.setAttribute(e[n].name,e[n].value);a.refresh(t)}),n.consume())},a.panningHandler.autoExpand=!0,a.panningHandler.factoryMethod=mxUtils.bind(this,function(e,n,t){this.isEditingEnabled()&&this.menus.createPopupMenu(e,n,t)}),n.outline.init(this.outlineContainer),mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){a.panningHandler.hideMenu()})),mxClient.IS_TOUCH&&(mxEvent.addListener(a.container,"gesturechange",mxUtils.bind(this,function(e){a.view.getDrawPane().setAttribute("transform","scale("+e.scale+")"),a.view.getOverlayPane().style.visibility="hidden"})),mxEvent.addListener(a.container,"gestureend",mxUtils.bind(this,function(e){a.view.getDrawPane().removeAttribute("transform"),a.zoomToCenter=!0,a.zoom(e.scale),a.view.getOverlayPane().style.visibility="visible"})));var r=this.isEditingEnabled()?this.createKeyHandler(n):null;this.getKeyHandler=function(){return r},mxEvent.addListener(window,"resize",mxUtils.bind(this,function(){this.refresh(),a.sizeDidChange(),this.editor.outline.update(!1),this.editor.outline.outline.sizeDidChange()})),this.init(),this.open(),this.refresh()},EditorUi.prototype.splitSize=mxClient.IS_TOUCH?16:8,EditorUi.prototype.menubarHeight=33,EditorUi.prototype.toolbarHeight=36,EditorUi.prototype.footerHeight=0,EditorUi.prototype.hsplitPosition=204,EditorUi.prototype.vsplitPosition=190,EditorUi.prototype.init=function(){this.addUndoListener(),this.addSelectionListener();var e=this.actions.get("paste"),n=function(){e.setEnabled(!mxClipboard.isEmpty())},t=mxClipboard.cut;mxClipboard.cut=function(){t.apply(this,arguments),n()};var a=mxClipboard.copy;mxClipboard.copy=function(){a.apply(this,arguments),n()}},EditorUi.prototype.isEditingEnabled=function(){return!!CRUD_PERMISSIONS.canEdit},EditorUi.prototype.exportXML=function(e){var n=window.document.createElement("a");n.href="data:attachment/text;charset=utf-8,"+encodeURIComponent(e),n.download=this.editor.filename+".xml",n.target="_self",n.click()},EditorUi.prototype.open=function(){try{null!=window.opener&&null!=window.opener.openFile&&window.opener.openFile.setConsumer(mxUtils.bind(this,function(e,n){try{var t=mxUtils.parseXml(e);this.editor.setGraphXml(t.documentElement),this.editor.modified=!1,this.editor.undoManager.clear(),null!=n&&(this.editor.filename=n)}catch(e){mxUtils.alert(mxResources.get("invalidOrMissingFile")+": "+e.message)}}))}catch(e){}},EditorUi.prototype.openString=function(e,n,t){try{var a=mxUtils.parseXml(e);this.editor.setGraphXml(a.documentElement),this.editor.modified=!1,this.editor.undoManager.clear(),null!=n&&(this.editor.filename=n),null!=t&&(this.editor.data=t)}catch(e){mxUtils.alert(mxResources.get("invalidOrMissingFile")+": "+e.message)}},EditorUi.prototype.validate=function(e,n){for(var t=this.editor.graph,a=(e=null!=e?e:t.model.getRoot(),n=null!=n?n:{},!0),i=t.model.getChildCount(e),s=0;s<i;s++){var o=t.model.getChildAt(e,s),r=n;t.isValidRoot(o)&&(r={}),null!=(r=this.validate(o,r))?t.setCellWarning(o,r.replace(/\n/g,"<br>")):t.setCellWarning(o,null),a=a&&null==r}if(i="",t.model.isVertex(e))switch(e.value.nodeName){case"start":i=this.validateBlock("start")?"":"Only one Start block is allowed\n";break;case"finally":i=this.validateBlock("finally")?"":"Only one Finally block is allowed\n";break;case"playback":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n";break;case"answer":i=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"menu":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n",i+=0<e.value.getAttribute("digit")?"":mxResources.get("wrongMaxDigit")+"\n",i+=0<=e.value.getAttribute("response")?"":mxResources.get("invalidTimeout")+"\n",i+=0<=e.value.getAttribute("retry")?"":mxResources.get("invalidRetry")+"\n";break;case"getdigits":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n",i+=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n",i+=0<e.value.getAttribute("mindigit")?"":mxResources.get("wrongMinDigit")+"\n",i+=0<e.value.getAttribute("maxdigit")?"":mxResources.get("wrongMaxDigit")+"\n",i+=0<=e.value.getAttribute("retry")?"":mxResources.get("invalidRetry")+"\n";break;case"getsecretdigits":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n",i+=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n",i+=0<e.value.getAttribute("mindigit")?"":mxResources.get("wrongMinDigit")+"\n",i+=0<e.value.getAttribute("maxdigit")?"":mxResources.get("wrongMaxDigit")+"\n",i+=0<=e.value.getAttribute("hiddendigitsnum")?"":mxResources.get("wrongHiddenDigitsnum")+"\n",i+=0<=e.value.getAttribute("retry")?"":mxResources.get("invalidRetry")+"\n";break;case"vswitch":i=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n";break;case"database":i=0<e.value.getAttribute("odbc_id")?"":mxResources.get("noDatabaseSelected")+"\n",i+=""!==e.value.getAttribute("query")?"":mxResources.get("missingQuery")+"\n";break;case"set":case"math":i=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n";break;case"gotoc":i=""!==e.value.getAttribute("context")?"":mxResources.get("noContextSelected")+"\n",i+=""!==e.value.getAttribute("extension")?"":mxResources.get("noExtensionSelected")+"\n",i+=1<=e.value.getAttribute("priority")?"":mxResources.get("invalidPriority")+"\n";break;case"system":case"agi":i=""!==e.value.getAttribute("command")?"":mxResources.get("noCommandSelected")+"\n";break;case"gotoif":i=""!==e.value.getAttribute("condition")?"":mxResources.get("noConditionSelected")+"\n";break;case"saydigits":i=""!==e.value.getAttribute("digits")?"":mxResources.get("noDigitsSelected")+"\n";break;case"saynumber":i=""!==e.value.getAttribute("number")?"":mxResources.get("noNumberSelected")+"\n";break;case"sayphonetic":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"record":i=""!==e.value.getAttribute("file")?"":mxResources.get("noFileSelected")+"\n",i+=-1<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"goal":i=""!==e.value.getAttribute("goalname")?"":mxResources.get("noGoalSelected")+"\n";break;case"ext_dial":i="-1"!==e.value.getAttribute("trunk_name")?"":mxResources.get("noTrunkSelected")+"\n",i+=""!==e.value.getAttribute("phone")?"":mxResources.get("noIdentifierSelected")+"\n",i+=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"dial":i=0<e.value.getAttribute("sip_id")?"":mxResources.get("noIdentifierSelected")+"\n",i+=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"queue":i="-1"!==e.value.getAttribute("queue_id")?"":mxResources.get("noQueueSelected")+"\n",i+=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"callback":i="-1"!==e.value.getAttribute("list_id")?"":mxResources.get("noListSelected")+"\n",i+=""!==e.value.getAttribute("name")?"":mxResources.get("noFirstNameSelected")+"\n",i+=""!==e.value.getAttribute("phone")?"":mxResources.get("noPhoneSelected")+"\n",i+=""!==e.value.getAttribute("delay")?"":mxResources.get("invalidDelay")+"\n";break;case"gotoiftime":i=0<e.value.getAttribute("interval_id")?"":mxResources.get("noIntervalSelected")+"\n";break;case"voicemail":i=""!==e.value.getAttribute("mailbox")?"":mxResources.get("noBoxNumberSelected")+"\n";break;case"subproject":i=0<e.value.getAttribute("project_id")?"":mxResources.get("noProjectSelected")+"\n";break;case"sendSMS":i=0<e.value.getAttribute("sms_account_id")?"":mxResources.get("noAccountSelected")+"\n",i+=""!==e.value.getAttribute("to")?"":mxResources.get("noRecipientSelected")+"\n",i+=""!==e.value.getAttribute("sms_text")?"":mxResources.get("noTextSelected")+"\n";break;case"sendMail":i=0<e.value.getAttribute("account_id")?"":mxResources.get("noAccountSelected")+"\n",i+=""!==e.value.getAttribute("to")?"":mxResources.get("noRecipientSelected")+"\n";break;case"sendFax":i=0<e.value.getAttribute("account_id")?"":mxResources.get("noAccountSelected")+"\n",i+=""!==e.value.getAttribute("to")?"":mxResources.get("noRecipientSelected")+"\n",i+=""!==e.value.getAttribute("attachment_path")?"":mxResources.get("noAttachmentSelected")+"\n";break;case"google_cloud_tts":i=""!==e.value.getAttribute("apiKey")?"":mxResources.get("noApiKeySelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"tts":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"awspolly":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("aws_access_key_id")?"":mxResources.get("noAccessKeySelected")+"\n",i+=""!==e.value.getAttribute("aws_secret_access_key")?"":mxResources.get("noSecretAccessKeySelected")+"\n";break;case"awslex":i=""!==e.value.getAttribute("aws_bot_name")?"":mxResources.get("noNameSelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("aws_access_key_id")?"":mxResources.get("noAccessKeySelected")+"\n",i+=""!==e.value.getAttribute("aws_secret_access_key")?"":mxResources.get("noSecretAccessKeySelected")+"\n";break;case"ispeechtts":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("key")?"":mxResources.get("noKeySelected")+"\n",i+=-10<=e.value.getAttribute("speed")&&e.value.getAttribute("speed")<=10?"":mxResources.get("invalidSpeed")+"\n";break;case"lumenvoxtts":case"sestektts":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"lumenvoxasr":case"sestekasr":i=""!==e.value.getAttribute("grammar")?"":mxResources.get("noGrammarSelected")+"\n";break;case"ispeechasr":case"googleasr":i=""!==e.value.getAttribute("key")?"":mxResources.get("noKeySelected")+"\n",i+=-1<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"tildeasr":i=""!==e.value.getAttribute("appid")?"":mxResources.get("noAppIdInserted")+"\n",i+=""!==e.value.getAttribute("appsecret")?"":mxResources.get("noAppSecretInserted")+"\n",i+=""!==e.value.getAttribute("uri")?"":mxResources.get("noUrlInserted")+"\n";break;case"custom_app":i=""!==e.value.getAttribute("application")?"":mxResources.get("noApplicationSelected")+"\n";break;case"login":case"pause":case"unpause":case"logout":i=""!==e.value.getAttribute("findBy")?"":mxResources.get("noFindBySelected")+"\n";break;case"sesteknda":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("ndauth_url")?"":mxResources.get("noUrlInserted")+"\n",i+=""!==e.value.getAttribute("ndassistant_url")?"":mxResources.get("noUrlInserted")+"\n",i+=""!==e.value.getAttribute("username")?"":mxResources.get("noUsernameSelected")+"\n",i+=""!==e.value.getAttribute("password")?"":mxResources.get("noPasswordSelected")+"\n";break;case"restapi":i=""!==e.value.getAttribute("url")?"":mxResources.get("noUrlSelected")+"\n",i+=""!==e.value.getAttribute("method")?"":mxResources.get("noMethodSelected")+"\n";case"mrcpsynth":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"mrcprecog":i=""!==e.value.getAttribute("grammar")?"":mxResources.get("noGrammarSelected")+"\n";break;case"dialogflow":i=""!==e.value.getAttribute("key")?"":mxResources.get("noKeySelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("dialogflow_language")?"":mxResources.get("noDialogflowLanguageSelected")+"\n";break;case"dialogflowV2":i=""!==e.value.getAttribute("dialogflowV2_project_id")?"":mxResources.get("noDialogflowProjectSelected")+"\n",i+=""!==e.value.getAttribute("client_email")?"":mxResources.get("noClientEmailSelected")+"\n",i+=""!==e.value.getAttribute("private_key")?"":mxResources.get("noPrivateKeySelected")+"\n",i+=""!==e.value.getAttribute("dialogflowV2_language")?"":mxResources.get("noDialogflowLanguageSelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n"}if(t.model.isEdge(e))switch(t.model.getCell(e.source.getId()).value.nodeName){case"background":case"menu":if(void 0!==e.getValue()){var l=/^[0-9]+$|^[-]{1}$|^[i]{1}$|^[t]{1}$|^[*]{1}$|^[#]{1}$/;String(e.getValue()).split(",").forEach(function(e){i+=l.test(e)?"":mxResources.get("numberOrAll")+"\n"})}else i=i+mxResources.get("numberOrAll")+"\n";break;case"getsecretdigits":case"getdigits":if(void 0!==e.getValue())i+=(l=/^(x|i|-)$/).test(String(e.getValue()))?"":mxResources.get("numberOrInvalidOrDefault")+"\n";else i=i+mxResources.get("numberOrInvalidOrDefault")+"\n";break;case"gotoif":case"gotoiftime":if(void 0!==e.getValue())i+=(l=/^(true){1}$|^(false){1}$/).test(String(e.getValue()))?"":mxResources.get("trueOrFalse")+"\n";else i=i+mxResources.get("trueOrFalse")+"\n";break;case"login":case"pause":case"unpause":case"logout":if(void 0!==e.getValue())i+=(l=/^(success){1}$|^(failure){1}$/).test(String(e.getValue()))?"":mxResources.get("successOrFailure")+"\n";else i=i+mxResources.get("successOrFailure")+"\n"}return t.isCellCollapsed(e)&&!a&&(i+=(mxResources.get(t.containsValidationErrorsResource)||t.containsValidationErrorsResource)+"\n"),i=t.model.isEdge(e)?i+(t.getEdgeValidationError(e,t.model.getTerminal(e,!0),t.model.getTerminal(e,!1))||""):i+(t.getCellValidationError(e)||""),null!=(s=t.validateCell(e,n))&&(i+=s),null==t.model.getParent(e)&&t.view.validate(),0<i.length||!a?i:null},EditorUi.prototype.validateBlock=function(n){var t=this.editor.graph,e=t.getDefaultParent(),a=0;return e.children.forEach(function(e){t.model.isVertex(e)&&e.value.nodeName==n&&a++}),!(1<a)},EditorUi.prototype.getUrl=function(e){var n=null!=e?e:window.location.pathname,t=0<n.indexOf("?")?1:0;for(var a in urlParams)n+=0==t?"?":"&",n+=a+"="+urlParams[a],t++;return n},EditorUi.prototype.addUndoListener=function(){var e=this.actions.get("undo"),n=this.actions.get("redo"),t=this.editor.undoManager,a=function(){e.setEnabled(t.canUndo()),n.setEnabled(t.canRedo())};t.addListener(mxEvent.ADD,a),t.addListener(mxEvent.UNDO,a),t.addListener(mxEvent.REDO,a),t.addListener(mxEvent.CLEAR,a),a()},EditorUi.prototype.addSelectionListener=function(){var e=mxUtils.bind(this,function(){var e=this.editor.graph,n=!e.isSelectionEmpty(),t=!1,a=!1,i=e.getSelectionCells();if(null!=i)for(var s=0;s<i.length;s++){var o=i[s];if(e.getModel().isEdge(o)&&(a=!0),e.getModel().isVertex(o)&&(t=!0),a&&t)break}var r=["cut","copy","delete","duplicate","bold","italic","style","underline","toFront","toBack","dashed","rounded","shadow","tilt","autosize"];for(s=0;s<r.length;s++)this.actions.get(r[s]).setEnabled(n);this.actions.get("curved").setEnabled(a),this.actions.get("rotation").setEnabled(t),this.actions.get("wordWrap").setEnabled(t),this.actions.get("group").setEnabled(1<e.getSelectionCount()),this.actions.get("ungroup").setEnabled(1==e.getSelectionCount()&&0<e.getModel().getChildCount(e.getSelectionCell()));var l=t&&1==e.getSelectionCount();this.actions.get("removeFromGroup").setEnabled(l&&e.getModel().isVertex(e.getModel().getParent(e.getSelectionCell())));var d=["fontFamily","fontSize","alignment","position","text","format","arrange","linewidth","spacing"];for(s=0;s<d.length;s++)this.menus.get(d[s]).setEnabled(n);d=["line","lineend","linestart"];for(s=0;s<d.length;s++)this.menus.get(d[s]).setEnabled(a);this.actions.get("setAsDefaultEdge").setEnabled(a),this.menus.get("align").setEnabled(1<e.getSelectionCount()),this.menus.get("direction").setEnabled(t||a&&e.isLoop(e.view.getState(e.getSelectionCell()))),this.menus.get("navigation").setEnabled(e.foldingEnabled&&(null!=e.view.currentRoot||1==e.getSelectionCount()&&e.isValidRoot(e.getSelectionCell()))),this.actions.get("home").setEnabled(null!=e.view.currentRoot),this.actions.get("exitGroup").setEnabled(null!=e.view.currentRoot);var c=1==e.getSelectionCount()&&e.isValidRoot(e.getSelectionCell());this.actions.get("enterGroup").setEnabled(c),this.actions.get("expand").setEnabled(c),this.actions.get("collapse").setEnabled(c),this.actions.get("editLink").setEnabled(1==e.getSelectionCount()),this.actions.get("openLink").setEnabled(1==e.getSelectionCount()&&null!=e.getLinkForCell(e.getSelectionCell()))});this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,e),e()},EditorUi.prototype.refresh=function(){var e=mxClient.IS_IE&&(null==document.documentMode||5==document.documentMode),n=this.container.clientWidth+390,t=this.container.clientHeight+190;this.container==document.body&&(n=document.body.clientWidth||document.documentElement.clientWidth,t=e&&document.body.clientHeight||document.documentElement.clientHeight);var a=Math.max(0,Math.min(this.hsplitPosition,n-this.splitSize-20)),i=Math.max(0,Math.min(this.vsplitPosition,t-this.menubarHeight-this.toolbarHeight-this.splitSize-1));this.menubarContainer.style.height=this.menubarHeight+"px",this.toolbarContainer.style.top=this.menubarHeight+"px",this.toolbarContainer.style.height=this.toolbarHeight+"px";var s=this.menubarHeight+this.toolbarHeight;if(mxClient.IS_QUIRKS||(s+=1),this.sidebarContainer.style.top=s+"px",this.sidebarContainer.style.width=a+"px",this.outlineContainer.style.width=a+"px",this.outlineContainer.style.height=i+"px",this.diagramContainer.style.left=this.isEditingEnabled()?a+this.splitSize+"px":"0px",this.diagramContainer.style.top=this.sidebarContainer.style.top,this.hsplit.style.top=this.sidebarContainer.style.top,this.hsplit.style.bottom=this.outlineContainer.style.bottom,this.hsplit.style.left=a+"px",this.vsplit.style.width=this.sidebarContainer.style.width,this.vsplit.style.bottom=i+this.footerHeight+"px",e){this.menubarContainer.style.width=n+"px",this.toolbarContainer.style.width=this.menubarContainer.style.width;var o=t-i-this.splitSize-this.menubarHeight-this.toolbarHeight;this.sidebarContainer.style.height=o+"px",this.diagramContainer.style.width=n-a-this.splitSize+"px";var r=t-this.menubarHeight-this.toolbarHeight;this.diagramContainer.style.height=r+"px",this.hsplit.style.height=r+"px"}else this.sidebarContainer.style.bottom=i+this.splitSize+"px",this.diagramContainer.style.bottom=this.outlineContainer.style.bottom},EditorUi.prototype.createDivs=function(){this.menubarContainer=this.createDiv("geMenubarContainer"),this.toolbarContainer=this.createDiv("geToolbarContainer"),this.sidebarContainer=this.createDiv("geSidebarContainer"),this.outlineContainer=this.createDiv("geOutlineContainer"),this.diagramContainer=this.createDiv("geDiagramContainer"),this.footerContainer=this.createDiv("geFooterContainer"),this.hsplit=this.createDiv("geHsplit"),this.vsplit=this.createDiv("geVsplit"),this.menubarContainer.style.top="0px",this.menubarContainer.style.left="0px",this.menubarContainer.style.right="0px",this.toolbarContainer.style.left="0px",this.toolbarContainer.style.right="0px",this.sidebarContainer.style.left="0px",this.outlineContainer.style.bottom="0px",this.outlineContainer.style.left="0px",this.diagramContainer.style.overflow="scroll",this.diagramContainer.style.right="0px",this.footerContainer.style.left="0px",this.footerContainer.style.right="0px",this.footerContainer.style.bottom="0px",this.vsplit.style.left="0px",this.vsplit.style.height=this.splitSize+"px",this.hsplit.style.width=this.splitSize+"px"},EditorUi.prototype.createUi=function(){this.menubar=this.menus.createMenubar(this.createDiv("geMenubar")),this.menubarContainer.appendChild(this.menubar.container),this.toolbar=this.createToolbar(this.createDiv("geToolbar")),this.toolbarContainer.appendChild(this.toolbar.container),this.sidebar=this.createSidebar(this.sidebarContainer),this.footerContainer.appendChild(this.createFooter()),this.statusContainer=this.createStatusContainer(),this.editor.addListener("statusChanged",mxUtils.bind(this,function(){this.setStatusText(this.editor.getStatus())})),this.setStatusText(this.editor.getStatus()),this.menubar.container.appendChild(this.statusContainer),this.isEditingEnabled()&&(this.container.appendChild(this.sidebarContainer),this.container.appendChild(this.hsplit),this.container.appendChild(this.vsplit)),this.container.appendChild(this.diagramContainer),this.container.appendChild(this.menubarContainer),this.container.appendChild(this.toolbarContainer),this.container.appendChild(this.outlineContainer),this.container.appendChild(this.footerContainer),this.addSplitHandler(this.hsplit,!0,0,mxUtils.bind(this,function(e){this.hsplitPosition=e,this.refresh(),this.editor.graph.sizeDidChange(),this.editor.outline.update(!1),this.editor.outline.outline.sizeDidChange()})),this.addSplitHandler(this.vsplit,!1,this.footerHeight,mxUtils.bind(this,function(e){this.vsplitPosition=e,this.refresh(),this.editor.outline.update(!1),this.editor.outline.outline.sizeDidChange()}))},EditorUi.prototype.createStatusContainer=function(){var e=document.createElement("a");return e.className="geItem geStatus",e},EditorUi.prototype.createStatusContainer=function(){var e=document.createElement("a");return e.className="geItem geStatus",e},EditorUi.prototype.setStatusText=function(e){this.statusContainer.innerHTML=e},EditorUi.prototype.createToolbar=function(e){return new Toolbar(this,e)},EditorUi.prototype.createSidebar=function(e){return new Sidebar(this,e)},EditorUi.prototype.createFooter=function(){return this.createDiv("geFooter")},EditorUi.prototype.createDiv=function(e){var n=document.createElement("div");return n.className=e,n},EditorUi.prototype.createHeader=function(e){return document.createElement(e)},EditorUi.prototype.createForm=function(e){var n=document.createElement("form");return n.className=e,n},EditorUi.prototype.addSplitHandler=function(n,t,a,i){var s=null,o=null;function r(e){if(null!=s){var n=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e));i(Math.max(0,o+(t?n.x-s.x:s.y-n.y)-a)),mxEvent.consume(e)}}function e(e){r(e),o=s=null}mxEvent.addGestureListeners(n,function(e){s=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e)),o=parseInt(t?n.style.left:n.style.bottom),mxEvent.consume(e)}),mxEvent.addListener(document,"mousemove",r),mxEvent.addListener(document,"touchmove",r),mxEvent.addListener(document,"mouseup",e),mxEvent.addListener(document,"touchend",e)},EditorUi.prototype.executeLayout=function(e,n,t){var a=this.editor.graph,i=a.getSelectionCell();n=null!=this.animate?this.animate:n,a.getModel().beginUpdate();try{e.execute(a.getDefaultParent(),i)}catch(e){throw e}finally{if(n&&navigator.userAgent.indexOf("Camino")<0){var s=new mxMorphing(a);s.addListener(mxEvent.DONE,mxUtils.bind(this,function(){a.getModel().endUpdate()})),s.startAnimation()}else a.getModel().endUpdate()}},EditorUi.prototype.createKeyHandler=function(e){var a=this.editor.graph,o=new mxKeyHandler(a);function n(e){if(!a.isSelectionEmpty()){var n=0,t=0;37==e?n=-1:38==e?t=-1:39==e?n=1:40==e&&(t=1),a.moveCells(a.getSelectionCells(),n,t),a.scrollCellToVisible(a.getSelectionCell())}}o.isControlDown=function(e){return mxEvent.isControlDown(e)||mxClient.IS_MAC&&e.metaKey};var t=mxUtils.bind(this,function(e,n,t,a){var i=this.actions.get(t);if(null!=i){var s=function(){i.enabled&&i.funct()};n?a?o.bindControlShiftKey(e,s):o.bindControlKey(e,s):a?o.bindShiftKey(e,s):o.bindKey(e,s)}});return o.enter=function(){},o.bindKey(8,function(){a.foldCells(!0)}),o.bindKey(13,function(){a.foldCells(!1)}),o.bindKey(33,function(){a.exitGroup()}),o.bindKey(34,function(){a.enterGroup()}),o.bindKey(36,function(){a.home()}),o.bindKey(35,function(){a.refresh()}),o.bindKey(37,function(){n(37)}),o.bindKey(38,function(){n(38)}),o.bindKey(39,function(){n(39)}),o.bindKey(40,function(){n(40)}),o.bindKey(113,function(){a.startEditingAtCell()}),t(46,!1,"delete"),t(82,!0,"tilt"),t(83,!0,"save"),t(83,!0,"saveAs",!0),t(107,!1,"zoomIn"),t(109,!1,"zoomOut"),t(65,!0,"selectAll"),t(86,!0,"selectVertices",!0),t(69,!0,"selectEdges",!0),t(69,!0,"export"),t(66,!0,"toBack"),t(70,!0,"toFront"),t(68,!0,"duplicate"),t(90,!0,"undo"),t(89,!0,"redo"),t(88,!0,"cut"),t(67,!0,"copy"),t(81,!0,"connect"),t(86,!0,"paste"),t(71,!0,"group"),t(71,!0,"grid",!0),t(85,!0,"ungroup"),t(112,!1,"about"),t(80,!0,"publish",!0),o},EditorUi.prototype.createMultiplicities=function(e,n,t,a){for(var i=0;i<n.length;i++)e.push(new mxMultiplicity(!0,n[i],null,null,t[i][0],t[i][1],null,mxResources.get(n[i])+mxResources.get("musthave")+t[i][0]+mxResources.get("outgoingedge"),null)),e.push(new mxMultiplicity(!1,n[i],null,null,a[i][0],a[i][1],null,mxResources.get(n[i])+mxResources.get("musthave")+a[i][0]+mxResources.get("incomingedge"),null))};var useLocalStorage=(mxClient.IS_TOUCH||"local"==urlParams.storage)&&"undefined"!=typeof localStorage,fileSupport=null!=window.File&&null!=window.FileReader&&null!=window.FileList,touchStyle=mxClient.IS_TOUCH||"1"==urlParams.touch,counter=0;try{for(var op=window;null!=op.opener&&!isNaN(op.opener.counter);)op=op.opener;null!=op&&(op.counter++,counter=op.counter)}catch(e){}function Sidebar(e,n){this.editorUi=e,this.container=n,this.palettes=new Object,this.taglist=new Object,this.showTooltips=!0,this.graph=new Graph(document.createElement("div"),null,null,this.editorUi.editor.graph.getStylesheet()),this.graph.resetViewOnRootChange=!1,this.graph.foldingEnabled=!1,this.graph.setConnectable(!1),this.graph.autoScroll=!1,this.graph.setTooltips(!1),this.graph.setEnabled(!1),this.graph.container.style.visibility="hidden",this.graph.container.style.position="absolute",this.graph.container.style.overflow="hidden",this.graph.container.style.height="1px",this.graph.container.style.width="1px",mxClient.IS_IE||mxClient.IS_IE11||(this.graph.container.style.display="none"),document.body.appendChild(this.graph.container),this.pointerUpHandler=mxUtils.bind(this,function(){this.showTooltips=!0}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointerup":"mouseup",this.pointerUpHandler),this.pointerDownHandler=mxUtils.bind(this,function(){this.showTooltips=!1,this.hideTooltip()}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointerdown":"mousedown",this.pointerDownHandler),this.pointerMoveHandler=mxUtils.bind(this,function(e){for(var n=mxEvent.getSource(e);null!=n;){if(n==this.currentElt)return;n=n.parentNode}this.hideTooltip()}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointermove":"mousemove",this.pointerMoveHandler),this.pointerOutHandler=mxUtils.bind(this,function(e){null==e.toElement&&null==e.relatedTarget&&this.hideTooltip()}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointerout":"mouseout",this.pointerOutHandler),mxEvent.addListener(n,"scroll",mxUtils.bind(this,function(){this.showTooltips=!0})),this.init(),mxClient.IS_SVG||((new Image).src=IMAGE_PATH+"/tooltip.png")}function Actions(e){this.editorUi=e,this.actions=new Object,this.init()}function Action(e,n,t,a,i){mxEventSource.call(this),this.label=e,this.funct=n,this.enabled=null==t||t,this.iconCls=a,this.shortcut=i}function Menubar(e,n){this.editorUi=e,this.container=n,mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){this.hideMenu()}))}function Menu(e,n){mxEventSource.call(this),this.funct=e,this.enabled=null==n||n}function Toolbar(e,n){this.editorUi=e,this.container=n,this.init(),mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){this.hideMenu()}))}function createCheckbox(e){var n=document.createElement("input");return n.setAttribute("type","checkbox"),e&&n.setAttribute("checked",!0),n}function createDropdownFromApi(e,t,a,i,n,s,o,r){var l=new XMLHttpRequest;l.open("GET",e,!1),l.setRequestHeader("Authorization","Bearer "+n.editor.data.token),l.send(null);var d=[];200===l.status&&(d=JSON.parse(l.response));var c=document.createElement("select"),m=document.createElement("option");return m.text="-- None --",m.value="-1",c.appendChild(m),d.rows.forEach(function(n){r&&n[a]==r||((m=document.createElement("option")).text=n[a],s&&o?(m.value=o,s.forEach(function(e){m.value=m.value.replace("%"+e+"%",n[e])}),m.selected=m.value==t):(m.value=n[i],m.selected=n[i]==t),c.appendChild(m))}),c.className="form-control select2",c}function createDropdownWithOptgroupFromApi(e,n,t,a,i,s){var o=new XMLHttpRequest;o.open("GET",e,!1),o.setRequestHeader("Authorization","Bearer "+i.editor.data.token),o.send(null);var r=[];200===o.status&&(r=JSON.parse(o.response));var l=document.createElement("select"),d=document.createElement("option");d.text="-- None --",d.value="-1",l.appendChild(d);var c=_.groupBy(r.rows,s);for(var m in c)if(c.hasOwnProperty(m)){var u=document.createElement("optgroup");u.label=_.capitalize(m),c[m].forEach(function(e){(d=document.createElement("option")).text=e[t],d.value=e[a],d.selected=e[a]==n,u.appendChild(d)}),l.appendChild(u)}return l.className="form-control select2",l}function createGroupedDropdownFromApi(e,n,t,a,i,s){var o=new XMLHttpRequest;o.open("GET",e,!1),o.setRequestHeader("Authorization","Bearer "+i.editor.data.token),o.send(null);var r=[];200===o.status&&(r=JSON.parse(o.response));var l=document.createElement("select"),d=document.createElement("option");return d.text="-- None --",d.value="0",l.appendChild(d),r.rows.forEach(function(e){(d=document.createElement("option")).className="select-group-father",d.text=e[t].toUpperCase(),d.value=e[a],d.selected=e[a]==n,l.appendChild(d),e[s].forEach(function(e){(d=document.createElement("option")).className="select-group-son",d.text="-"+_.capitalize(e[t]),d.value=e[a],d.selected=e[a]==n,l.appendChild(d)})}),l.className="form-control select2",l}function createDropdownFromArray(e,n){var t=document.createElement("select");for(var a in e){var i=document.createElement("option");i.text=e[a],i.value=a,(0<n||""!=n)&&(i.selected=n===a),t.appendChild(i)}return t.className="form-control select2",t}function createDropdownFromTigerDialList(e){var n=document.createElement("select"),t=[],a=new XMLHttpRequest;try{if(a.open("POST","/api/rest/list/list",!1),a.send(JSON.stringify({page:1,size:6e5})),200===a.status){var i=JSON.parse(a.response);if(0<i.status){var s=i.response.RMI.rows;for(var o in s)t[s[o].id]=s[o].name}}}catch(e){console.log(e)}for(var r in t){var l=document.createElement("option");l.text=t[r],l.value=r,(0<e||""!=e)&&(l.selected=e===r),n.appendChild(l)}return n.className="form-control select2",n}function Dialog(e,n,t,a,i,s,o){var r=0;mxClient.IS_IE&&9!=document.documentMode&&(r=60),t+=r,a+=r;Math.max(0,Math.round((document.body.scrollWidth-t)/2)),Math.max(0,Math.round((Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)-a)/3));var l=e.createDiv("geDialog");l.className="modal fade in center",l.style.display="block",l.style.paddingRight="12px";var d=e.createDiv("geModalDialog");d.className="modal-dialog",d.appendChild(n),l.appendChild(d),null==this.bg&&(this.bg=e.createDiv("background"),this.bg.className="modal-backdrop fade in",mxClient.IS_QUIRKS&&new mxDivResizer(this.bg)),i&&document.body.appendChild(this.bg),document.body.appendChild(l),this.onDialogClose=o,this.container=l}function ImportDialog(t){var e=t.createDiv("modal-content"),n=t.createDiv("modal-header"),a=t.createDiv("modal-body"),i=t.createDiv("modal-footer"),s=t.createHeader("h4");mxUtils.write(s,mxResources.get("import")+" XML");var o=mxUtils.button("",function(){t.hideDialog()});o.className="close",n.appendChild(o),n.appendChild(s);var r=t.createDiv("row"),l=t.createDiv("col-md-12"),d=document.createElement("textarea");d.style.width="100%",d.style.height="374px";var c=document.createElement("input");c.type="file",c.setAttribute("accept","text/xml"),c.addEventListener("change",function(e){var n=e.target.files[0];if(console.log(n),n)if("text/xml"===n.type){var t=new FileReader;t.onload=function(e){var n=e.target.result;mxUtils.write(d,n)},t.readAsText(n)}else alert("Failed to load format file");else alert("Failed to load file")},!1),l.appendChild(c),l.appendChild(d),r.appendChild(l),a.appendChild(r);var m=mxUtils.button(mxResources.get("import"),mxUtils.bind(this,function(e){var n=mxUtils.parseXml(d.value);t.editor.setGraphXml(n.documentElement),t.hideDialog()}));m.className="btn blue";var u=mxUtils.button(mxResources.get("cancel"),function(){t.hideDialog()});u.className="btn default",i.appendChild(m),i.appendChild(u),e.appendChild(n),e.appendChild(a),e.appendChild(i),this.container=e}function AboutDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("about")+" Cally Square");var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=document.createElement("img");r.style.border="0px",r.setAttribute("width","176"),r.setAttribute("width","151"),r.setAttribute("src",IMAGE_PATH+"/logo.png"),a.appendChild(r),mxUtils.br(a),mxUtils.write(a,"Powered by Xenialab "+mxClient.VERSION),mxUtils.br(a);var l=document.createElement("a");l.setAttribute("href","http://www.callysquare.com/"),l.setAttribute("target","_blank"),mxUtils.write(l,"www.callysquare.com"),a.appendChild(l),mxUtils.br(a),mxUtils.br(a);var d=mxUtils.button(mxResources.get("close"),function(){e.hideDialog()});d.className="btn default",i.appendChild(d),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function SaveDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("saveAs"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.editor.getOrCreateFilename(),l=e.createDiv("row"),d=e.createDiv("col-md-4"),c=e.createDiv("col-md-8"),m=document.createElement("label");m.className="control-label pull-right",mxUtils.write(m,mxResources.get("name")),d.appendChild(m);var u=document.createElement("input");u.setAttribute("value",r+"_copy"),u.setAttribute("id","_name"),u.className="form-control",c.appendChild(u),l.appendChild(d),l.appendChild(c),a.appendChild(l);var p=mxUtils.button(mxResources.get("save"),function(){e.saveAs(u.value),e.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function NewDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("new"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.editor.getOrCreateFilename(),l=e.createDiv("row"),d=e.createDiv("col-md-4"),c=e.createDiv("col-md-8"),m=document.createElement("label");m.className="control-label pull-right",mxUtils.write(m,mxResources.get("name")),d.appendChild(m);var u=document.createElement("input");u.setAttribute("value",r+"_new"),u.setAttribute("id","_name"),u.className="form-control",c.appendChild(u),l.appendChild(d),l.appendChild(c),a.appendChild(l);var p=mxUtils.button(mxResources.get("new"),function(){e.new(u.value),e.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function DescriptionDialog(e){console.log(e.editor.data);var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("description"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.createDiv("form-horizontal form-row-seperated"),l="description",d=e.editor.data.description||"",c=e.createDiv("form-group"),m=document.createElement("label");m.className="col-sm-4 control-label",mxUtils.write(m,mxResources.get(l)),c.appendChild(m);var u=document.createElement("input");u.setAttribute("value",d),u.className="form-control",u.setAttribute("id","_description");var p=e.createDiv("col-sm-8");p.appendChild(u),c.appendChild(p),r.appendChild(c),a.appendChild(r);var g=mxUtils.button(mxResources.get("update"),function(){e.description(u.value),e.hideDialog()});g.className="btn blue";var v=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});v.className="btn default",i.appendChild(g),i.appendChild(v),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function VariableDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("variable"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.createDiv("form-horizontal form-row-seperated"),l="name",d="_"+l,c="variable name",m=e.createDiv("form-group"),u=document.createElement("label");u.className="col-sm-4 control-label",mxUtils.write(u,mxResources.get(l)),m.appendChild(u);var p=document.createElement("input");p.setAttribute("value",c),p.className="form-control",p.setAttribute("id",d);var g=e.createDiv("col-sm-8");g.appendChild(p),m.appendChild(g),r.appendChild(m),d="_"+(l="description"),c="variable description",m=e.createDiv("form-group last"),(u=document.createElement("label")).className="col-sm-4 control-label",mxUtils.write(u,mxResources.get(l)),m.appendChild(u);var v=document.createElement("input");v.setAttribute("value",c),v.className="form-control",v.setAttribute("id",d),(g=e.createDiv("col-sm-8")).appendChild(v),m.appendChild(g),r.appendChild(m),a.appendChild(r);var h=mxUtils.button(mxResources.get("new"),function(){e.variable(p.value,v.value),e.hideDialog()});h.className="btn blue";var f=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});f.className="btn default",i.appendChild(h),i.appendChild(f),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function OpenDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("open"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.createDiv("row"),l=e.createDiv("col-md-4"),d=e.createDiv("col-md-8"),c=document.createElement("label");c.className="control-label pull-right",mxUtils.write(c,mxResources.get("name")),l.appendChild(c);var m=new XMLHttpRequest;m.open("GET","/api/square/projects",!1),m.setRequestHeader("Authorization","Bearer "+e.editor.data.token),m.send(null);var u=[];200===m.status&&(u=JSON.parse(m.response));for(var p=document.createElement("select"),g=0;g<u.length;g++){var v=document.createElement("option");v.text=u[g].name,v.value=u[g].id,p.appendChild(v)}p.className="form-control",d.appendChild(p),r.appendChild(l),r.appendChild(d),a.appendChild(r);var h=mxUtils.button(mxResources.get("open"),function(){console.log(p),console.log(p.value),window.open("square/project/"+p.value,"_blank"),e.hideDialog()});h.className="btn blue";var f=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});f.className="btn default",i.appendChild(h),i.appendChild(f),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function RenameDialog(t){var e=t.createDiv("modal-content"),n=t.createDiv("modal-header"),a=t.createDiv("modal-body"),i=t.createDiv("modal-footer"),s=t.createHeader("h4");mxUtils.write(s,mxResources.get("rename"));var o=mxUtils.button("",function(){t.hideDialog()});o.className="close",n.appendChild(o),n.appendChild(s);var r=t.createDiv("row"),l=t.createDiv("col-md-4"),d=t.createDiv("col-md-8"),c=document.createElement("label");c.className="control-label pull-right",mxUtils.write(c,mxResources.get("name")),l.appendChild(c);var m=t.editor.filename,u=document.createElement("input");u.setAttribute("value",m),u.className="form-control",d.appendChild(u),r.appendChild(l),r.appendChild(d),a.appendChild(r);var p=mxUtils.button(mxResources.get("save"),function(){var n=new XMLHttpRequest;n.open("PUT",SAVE_URL+t.editor.data.id,!0),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.setRequestHeader("Authorization","Bearer "+t.editor.data.token),n.send("name="+u.value),n.onload=function(e){200===n.status?(t.editor.setStatus("Project successfully renamed"),t.editor.filename=u.value):(console.log(n.response),t.editor.setStatus(JSON.parse(n.response).errors[0].message))},n.onerror=function(e){mxUtils.alert(n.statusText)},t.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){t.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),e.appendChild(n),e.appendChild(a),e.appendChild(i),this.container=e}function EditFileDialog(n){var e=n.createDiv("modal-content"),t=n.createDiv("modal-header"),a=n.createDiv("modal-body"),i=n.createDiv("modal-footer"),s=n.createHeader("h4");mxUtils.write(s,mxResources.get("edit"));var o=mxUtils.button("",function(){n.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=n.createDiv("row"),l=n.createDiv("col-md-12"),d=document.createElement("textarea");if(d.style.width="100%",d.style.height="374px",d.value=mxUtils.getPrettyXml(n.editor.getGraphXml()),fileSupport){d.addEventListener("dragover",function(e){e.stopPropagation(),e.preventDefault()},!1),d.addEventListener("drop",function(e){if(e.stopPropagation(),e.preventDefault(),0<e.dataTransfer.files.length){var n=e.dataTransfer.files[0],t=new FileReader;t.onload=function(e){d.value=e.target.result},t.readAsText(n)}},!1)}l.appendChild(d),r.appendChild(l),a.appendChild(r);var c=mxUtils.button(mxResources.get("save"),function(){var e=mxUtils.parseXml(d.value);n.editor.setGraphXml(e.documentElement),n.hideDialog()});c.className="btn blue";var m=mxUtils.button(mxResources.get("cancel"),function(){n.hideDialog()});m.className="btn default",i.appendChild(c),i.appendChild(m),e.appendChild(t),e.appendChild(a),e.appendChild(i),this.container=e}function ExportDialog(n){var e=n.createDiv("modal-content"),t=n.createDiv("modal-header"),a=n.createDiv("modal-body form"),i=n.createDiv("modal-footer"),s=n.createHeader("h4");mxUtils.write(s,mxResources.get("export")+" XML");var o=mxUtils.button("",function(){n.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=n.createDiv("form-horizontal form-row-seperated"),l=n.createDiv("form-group last"),d=document.createElement("label");d.className="col-sm-4 control-label",mxUtils.write(d,mxResources.get("filename"));var c=document.createElement("input");c.setAttribute("value",n.editor.getOrCreateFilename()),c.className="form-control";var m=n.createDiv("col-sm-8");m.appendChild(c),l.appendChild(d),l.appendChild(m),r.appendChild(l),a.appendChild(r);var u=mxUtils.button(mxResources.get("export"),mxUtils.bind(this,function(e){n.save(!1);encodeURIComponent(mxUtils.getXml(n.editor.getGraphXml()));new mxXmlRequest(SAVE_URL+n.editor.data.id+"/download","filename="+c.value,"GET").simulate(document,"_blank"),n.hideDialog()}));u.className="btn blue";var p=mxUtils.button(mxResources.get("cancel"),function(){n.hideDialog()});p.className="btn default",i.appendChild(u),i.appendChild(p),e.appendChild(t),e.appendChild(a),e.appendChild(i),this.container=e}function GeneralDialog(i,s){console.log("general");var o=i.editor.graph,e=i.createDiv("md-dialog"),n=i.createDiv("md-toolbar"),t=i.createDiv("md-dialog-content"),a=i.createDiv("md-dialog-actions"),r=i.createHeader("h4");mxUtils.write(r,mxResources.get("edit")+" "+mxResources.get(s.value.nodeName));var l=mxUtils.button("",function(){i.hideDialog()});l.className="close",n.appendChild(l),n.appendChild(r);for(var d=s.value.attributes.length,c=i.createDiv("form-horizontal form-row-seperated"),m=0;m<d;m++){var u,p=s.value.attributes[m].name,g="_"+p,v=s.value.attributes[m].value,h=i.createDiv(m==d-1?"form-group last":"form-group"),f=document.createElement("label");switch(f.className="col-sm-4 control-label",mxUtils.write(f,mxResources.get(p)),h.appendChild(f),p){case"sip_id":u=createDropdownWithOptgroupFromApi("/api/users/all",v,"fullname","id",i,"role");break;case"queue_id":u=createDropdownFromApi("/api/voice/queues",v,"name","name",i);break;case"trunk_name":u=createDropdownFromApi("/api/trunks",v,"name","name",i);break;case"variable_id":u=createDropdownFromApi("/api/variables",v,"name","id",i);break;case"account_id":u="sendMail"==s.value.nodeName?createDropdownFromApi("/api/mail/servers/out",v,"username","id",i):createDropdownFromApi("/api/sms/accounts",v,"name","id",i);break;case"template_id":u=createDropdownFromApi("/api/templates",v,"name","id",i);break;case"context":u=createDropdownFromApi("/api/voice/contexts",v,"name","name",i);break;case"mailbox":u=createDropdownFromApi("/api/voice/voicemails",v,"mailbox","id",i,["mailbox","context"],"%mailbox%@%context%");break;case"model":u=createDropdownFromArray(ISPEECHASRMODEL,v);break;case"ispeech_asr_language":u=createDropdownFromArray(ISPEECHASRLANG,v);break;case"beep":u=createDropdownFromArray(ISPEECHBEEP,v);break;case"hiddendigitspos":u=createDropdownFromArray(SECRETDIGITSPOS,v);break;case"ispeech_tts_language":u=createDropdownFromArray(ISPEECHLANG,v);break;case"google_tts_language":u=createDropdownFromArray(GOOGLETTSLANG,v);break;case"intKey":u=createDropdownFromArray(ASRINTKEYS,v);break;case"recordingFormat":u=createDropdownFromArray(RECORDINGFORMAT,v);break;case"answer":u=createDropdownFromArray(BOOLSELECT,v);break;case"list_id":u=createDropdownFromTigerDialList(v);break;case"interval_id":u=createGroupedDropdownFromApi("/api/intervals",v,"name","id",i,"SubIntervals");break;case"project_id":u=createDropdownFromApi("/api/square/projects",v,"name","id",i,null,null,i.editor.getOrCreateFilename());break;case"odbc_id":u=createDropdownFromApi("/api/square/odbc",v,"name","id",i);break;case"file_id":u=createDropdownFromApi("/api/sounds",v,"display_name","id",i);break;case"timeout":case"digit":case"mindigit":case"maxdigit":case"response":case"retry":case"speed":(u=document.createElement("input")).setAttribute("type","number"),u.setAttribute("min",0),u.setAttribute("max",1e3),u.setAttribute("value",v),u.className="form-control";break;case"text":case"key":case"query":case"condition":case"command":case"body":(u=document.createElement("textarea")).innerHTML=v,u.className="form-control";break;case"sms_text":(u=document.createElement("textarea")).innerHTML=v,u.className="form-control",u.setAttribute("maxlength","160");break;default:(u=document.createElement("input")).setAttribute("value",v),u.className="form-control"}u.setAttribute("id",g);var b=i.createDiv("col-sm-8");if(b.appendChild(u),mxResources.get("help_"+p)){var A=i.createDiv("p");A.className="help-block",mxUtils.write(A,mxResources.get("help_"+p)),b.appendChild(A)}h.appendChild(b),c.appendChild(h)}t.appendChild(c);var E=mxUtils.button(mxResources.get("save"),mxUtils.bind(this,function(e){for(var n=0;n<s.value.attributes.length;n++){var t="_"+s.value.attributes[n].name,a=s.value.attributes[n].name;s.setAttribute(a,document.getElementById(t).value)}o.refresh(s),i.hideDialog()}));E.className="btn blue";var y=mxUtils.button(mxResources.get("cancel"),function(){i.hideDialog()});y.className="btn default",a.appendChild(E),a.appendChild(y),e.appendChild(n),e.appendChild(t),e.appendChild(a),this.container=e}Editor=function(){mxEventSource.call(this),this.init(),this.initStencilRegistry(),this.graph=new Graph,this.outline=new mxOutline(this.graph),this.outline.updateOnPan=!0,this.undoManager=this.createUndoManager(),this.status="",this.filename=null,this.getOrCreateFilename=function(){return this.filename||mxResources.get("drawing",[counter])+".xml"},this.getFilename=function(){return this.filename},this.setStatus=function(e){this.status=e,this.fireEvent(new mxEventObject("statusChanged"))},this.getStatus=function(){return this.status},this.modified=!1,this.graphChangeListener=function(){this.modified=!0},this.graph.getModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(){this.graphChangeListener.apply(this,arguments)})),window.onbeforeunload=mxUtils.bind(this,function(){if(this.modified)return mxResources.get("allChangesLost")}),this.graph.resetViewOnRootChange=!1,this.graph.scrollbars=!0,this.graph.background=null},mxUtils.extend(Editor,mxEventSource),Editor.prototype.gridImage=IMAGE_PATH+"/grid.gif",Editor.prototype.transparentImage=IMAGE_PATH+"/transparent.gif",Editor.prototype.setGraphXml=function(e){var n=new mxCodec(e.ownerDocument);if("mxGraphModel"==e.nodeName){this.graph.view.scale=Number(e.getAttribute("scale")||1),this.graph.gridEnabled="0"!=e.getAttribute("grid"),this.graph.graphHandler.guidesEnabled="0"!=e.getAttribute("guides"),this.graph.setTooltips("0"!=e.getAttribute("tooltips")),this.graph.setConnectable("0"!=e.getAttribute("connect")),this.graph.foldingEnabled="0"!=e.getAttribute("fold"),this.graph.scrollbars="0"!=e.getAttribute("scrollbars"),this.graph.scrollbars||(this.graph.container.scrollLeft=0,this.graph.container.scrollTop=0,this.graph.view.translate.x=Number(e.getAttribute("dx")||0),this.graph.view.translate.y=Number(e.getAttribute("dy")||0)),this.graph.pageVisible="1"==e.getAttribute("page"),this.graph.pageBreaksVisible=this.graph.pageVisible,this.graph.preferPageSize=this.graph.pageBreaksVisible;var t=e.getAttribute("pageScale");this.graph.pageScale=null!=t?t:1.5;var a=e.getAttribute("pageWidth"),i=e.getAttribute("pageHeight");null!=a&&null!=i&&(this.graph.pageFormat=new mxRectangle(0,0,parseFloat(a),parseFloat(i)),this.outline.outline.pageFormat=this.graph.pageFormat);var s=e.getAttribute("background");null!=s&&0<s.length&&(this.graph.background=s),n.decode(e,this.graph.getModel()),this.updateGraphComponents()}},Editor.prototype.getGraphXml=function(){var e=new mxCodec(mxUtils.createXmlDocument()).encode(this.graph.getModel());return 0==this.graph.view.translate.x&&0==this.graph.view.translate.y||(e.setAttribute("dx",Math.round(100*this.graph.view.translate.x)/100),e.setAttribute("dy",Math.round(100*this.graph.view.translate.y)/100)),1!=this.graph.view.scale&&e.setAttribute("scale",Math.round(1e3*this.graph.view.scale)/1e3),e.setAttribute("grid",this.graph.isGridEnabled()?"1":"0"),e.setAttribute("guides",this.graph.graphHandler.guidesEnabled?"1":"0"),e.setAttribute("guides",this.graph.graphHandler.guidesEnabled?"1":"0"),e.setAttribute("tooltips",this.graph.tooltipHandler.isEnabled()?"1":"0"),e.setAttribute("connect",this.graph.connectionHandler.isEnabled()?"1":"0"),e.setAttribute("fold",this.graph.foldingEnabled?"1":"0"),e.setAttribute("page",this.graph.pageVisible?"1":"0"),e.setAttribute("pageScale",this.graph.pageScale),e.setAttribute("pageWidth",this.graph.pageFormat.width),e.setAttribute("pageHeight",this.graph.pageFormat.height),this.graph.scrollbars||e.setAttribute("scrollbars","0"),null!=this.graph.background&&e.setAttribute("background",this.graph.background),e},Editor.prototype.updateGraphComponents=function(){var e=this.graph,n=this.outline;if(null!=e.container&&null!=n.outline.container){null!=e.background?"none"==e.background?e.container.style.backgroundColor="transparent":(null!=e.view.backgroundPageShape&&(e.view.backgroundPageShape.fill=e.background,e.view.backgroundPageShape.reconfigure()),e.container.style.backgroundColor=e.background):e.container.style.backgroundColor="",e.pageVisible?(e.container.style.backgroundColor="#ebebeb",e.container.style.borderStyle="solid",e.container.style.borderColor="#e5e5e5",e.container.style.borderTopWidth="1px",e.container.style.borderLeftWidth="1px",e.container.style.borderRightWidth="0px",e.container.style.borderBottomWidth="0px"):e.container.style.border="",n.outline.container.style.backgroundColor=e.container.style.backgroundColor,n.outline.pageVisible==e.pageVisible&&n.outline.pageScale==e.pageScale||(n.outline.pageScale=e.pageScale,n.outline.pageVisible=e.pageVisible,n.outline.view.validate()),e.scrollbars&&"hidden"==e.container.style.overflow&&!touchStyle?e.container.style.overflow="auto":e.scrollbars&&!touchStyle||(e.container.style.overflow="hidden");var t=mxClient.IS_IE&&9<=document.documentMode?"url("+this.transparentImage+")":"none";e.container.style.backgroundImage=!e.pageVisible&&e.isGridEnabled()?"url("+this.gridImage+")":t,null!=e.view.backgroundPageShape&&(e.view.backgroundPageShape.node.style.backgroundImage=this.graph.isGridEnabled()?"url("+this.gridImage+")":"none")}},Editor.prototype.init=function(){mxClient.IS_IE6&&mxClient.link("stylesheet",CSS_PATH+"/grapheditor-ie6.css"),mxResources.loadDefaultBundle=!1,mxResources.add(RESOURCE_BASE),mxConstants.DEFAULT_HOTSPOT=.3;var e=mxConnectionHandler.prototype.createMarker;mxConnectionHandler.prototype.createMarker=function(){var t=e.apply(this,arguments);return t.intersects=mxUtils.bind(this,function(e,n){return!!this.isConnecting()||mxCellMarker.prototype.intersects.apply(t,arguments)}),t},mxConstants.SHADOWCOLOR="#d0d0d0",mxConstants.HANDLE_FILLCOLOR="#99ccff",mxConstants.HANDLE_STROKECOLOR="#0088cf",mxConstants.VERTEX_SELECTION_COLOR="#00a8ff",mxConstants.OUTLINE_COLOR="#00a8ff",mxConstants.OUTLINE_HANDLE_FILLCOLOR="#99ccff",mxConstants.OUTLINE_HANDLE_STROKECOLOR="#00a8ff",mxConstants.CONNECT_HANDLE_FILLCOLOR="#cee7ff",mxConstants.EDGE_SELECTION_COLOR="#00a8ff",mxConstants.DEFAULT_VALID_COLOR="#00a8ff",mxConstants.LABEL_HANDLE_FILLCOLOR="#cee7ff",mxConstants.GUIDE_COLOR="#0088cf",mxGraph.prototype.pageBreakColor="#c0c0c0",mxGraph.prototype.pageScale=1,mxRubberband.prototype.defaultOpacity=30,mxGraphView.prototype.createBackgroundPageShape=function(e){return new mxRectangleShape(e,this.graph.background||"white","#cacaca")},mxGraphView.prototype.getBackgroundPageBounds=function(){var e=this.getGraphBounds(),n=0<e.width?e.x/this.scale-this.translate.x:0,t=0<e.height?e.y/this.scale-this.translate.y:0,a=e.width/this.scale,i=e.height/this.scale,s=this.graph.pageFormat,o=this.graph.pageScale,r=s.width*o,l=s.height*o,d=Math.floor(Math.min(0,n)/r),c=Math.floor(Math.min(0,t)/l),m=Math.ceil(Math.max(1,n+a)/r)-d,u=Math.ceil(Math.max(1,t+i)/l)-c;return new mxRectangle(this.scale*(this.translate.x+d*r),this.scale*(this.translate.y+c*l),this.scale*m*r,this.scale*u*l)};var t=mxGraph.prototype.panGraph;mxGraph.prototype.panGraph=function(e,n){t.apply(this,arguments),this.dialect==mxConstants.DIALECT_SVG||null==this.view.backgroundPageShape||this.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.container)||(this.view.backgroundPageShape.node.style.marginLeft=e+"px",this.view.backgroundPageShape.node.style.marginTop=n+"px")};var a=this;mxGraphView.prototype.validateBackground=function(){var e=this.graph.getBackgroundImage();if(null!=e){if(null==this.backgroundImage||this.backgroundImage.image!=e.src){null!=this.backgroundImage&&this.backgroundImage.destroy();var n=new mxRectangle(0,0,1,1);this.backgroundImage=new mxImageShape(n,e.src),this.backgroundImage.dialect=this.graph.dialect,this.backgroundImage.init(this.backgroundPane),this.backgroundImage.redraw()}this.redrawBackgroundImage(this.backgroundImage,e)}else null!=this.backgroundImage&&(this.backgroundImage.destroy(),this.backgroundImage=null);if(this.graph.pageVisible){n=this.getBackgroundPageBounds();null==this.backgroundPageShape?(this.backgroundPageShape=this.createBackgroundPageShape(n),this.backgroundPageShape.scale=1,this.backgroundPageShape.isShadow=!0,this.backgroundPageShape.dialect=mxConstants.DIALECT_STRICTHTML,this.backgroundPageShape.init(this.graph.container),this.graph.container.firstChild.style.position="absolute",this.graph.container.insertBefore(this.backgroundPageShape.node,this.graph.container.firstChild),this.backgroundPageShape.redraw(),this.backgroundPageShape.node.className="geBackgroundPage",this.backgroundPageShape.node.style.backgroundPosition="-1px -1px",mxEvent.addListener(this.backgroundPageShape.node,"dblclick",mxUtils.bind(this,function(e){this.graph.dblClick(e)})),mxEvent.addGestureListeners(this.backgroundPageShape.node,mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){null!=this.graph.tooltipHandler&&this.graph.tooltipHandler.isHideOnHover()&&this.graph.tooltipHandler.hide(),this.graph.isMouseDown&&!mxEvent.isConsumed(e)&&this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))}))):(this.backgroundPageShape.scale=1,this.backgroundPageShape.bounds=n,this.backgroundPageShape.redraw()),this.backgroundPageShape.node.style.backgroundImage=this.graph.isGridEnabled()?"url("+a.gridImage+")":"none"}else null!=this.backgroundPageShape&&(this.backgroundPageShape.destroy(),this.backgroundPageShape=null)},mxGraph.prototype.updatePageBreaks=function(e,n,t){var a=this.view.scale,i=this.view.translate,s=this.pageFormat,o=a*this.pageScale,r=this.view.getBackgroundPageBounds();n=r.width,t=r.height;var l=new mxRectangle(a*i.x,a*i.y,s.width*o,s.height*o),d=(e=e&&Math.min(l.width,l.height)>this.minPageBreakDist)?Math.ceil(n/l.width)-1:0,c=e?Math.ceil(t/l.height)-1:0,m=r.x+n,u=r.y+t;if(null==this.horizontalPageBreaks&&0<d&&(this.horizontalPageBreaks=[]),null!=this.horizontalPageBreaks){for(var p=0;p<=d;p++){var g=[new mxPoint(r.x+(p+1)*l.width,r.y),new mxPoint(r.x+(p+1)*l.width,u)];if(null!=this.horizontalPageBreaks[p])this.horizontalPageBreaks[p].scale=1,this.horizontalPageBreaks[p].points=g,this.horizontalPageBreaks[p].redraw();else(v=new mxPolyline(g,this.pageBreakColor,this.scale)).dialect=this.dialect,v.isDashed=this.pageBreakDashed,v.addPipe=!1,v.scale=a,v.init(this.view.backgroundPane),v.redraw(),this.horizontalPageBreaks[p]=v}for(p=d;p<this.horizontalPageBreaks.length;p++)this.horizontalPageBreaks[p].destroy();this.horizontalPageBreaks.splice(d,this.horizontalPageBreaks.length-d)}if(null==this.verticalPageBreaks&&0<c&&(this.verticalPageBreaks=[]),null!=this.verticalPageBreaks){for(p=0;p<=c;p++){var v;g=[new mxPoint(r.x,r.y+(p+1)*l.height),new mxPoint(m,r.y+(p+1)*l.height)];if(null!=this.verticalPageBreaks[p])this.verticalPageBreaks[p].scale=1,this.verticalPageBreaks[p].points=g,this.verticalPageBreaks[p].redraw();else(v=new mxPolyline(g,this.pageBreakColor,a)).dialect=this.dialect,v.isDashed=this.pageBreakDashed,v.addPipe=!1,v.scale=a,v.init(this.view.backgroundPane),v.redraw(),this.verticalPageBreaks[p]=v}for(p=c;p<this.verticalPageBreaks.length;p++)this.verticalPageBreaks[p].destroy();this.verticalPageBreaks.splice(c,this.verticalPageBreaks.length-c)}},mxEdgeHandler.prototype.snapToTerminals=!0,mxGraphHandler.prototype.guidesEnabled=!0;var s=mxGraphHandler.prototype.shouldRemoveCellsFromParent;mxGraphHandler.prototype.shouldRemoveCellsFromParent=function(e,n,t){for(var a=0;a<n.length;a++)if(this.graph.getModel().isVertex(n[a])){var i=this.graph.getCellGeometry(n[a]);if(null!=i&&i.relative)return!1}return s.apply(this,arguments)},mxGuide.prototype.isEnabledForEvent=function(e){return!mxEvent.isAltDown(e)};var r=mxPopupMenu.prototype.addItem;mxPopupMenu.prototype.addItem=function(e,n,t,a,i,s){var o=r.apply(this,arguments);return null==s||s||mxEvent.addListener(o,"mousedown",function(e){mxEvent.consume(e)}),o};var o=mxGraphHandler.prototype.getInitialCellForEvent;mxGraphHandler.prototype.getInitialCellForEvent=function(e){var n=this.graph.getModel(),t=n.getParent(this.graph.getSelectionCell()),a=o.apply(this,arguments),i=n.getParent(a);if(null==t||t!=a&&t!=i)for(;!this.graph.isCellSelected(a)&&!this.graph.isCellSelected(i)&&n.isVertex(i)&&!this.graph.isValidRoot(i);)a=i,i=this.graph.getModel().getParent(a);return a};var l=mxGraphHandler.prototype.isDelayedSelection;mxGraphHandler.prototype.isDelayedSelection=function(e){var n=l.apply(this,arguments),t=this.graph.getModel(),a=t.getParent(this.graph.getSelectionCell()),i=t.getParent(e);return(null==a||a!=e&&a!=i)&&(this.graph.isCellSelected(e)||!t.isVertex(i)||this.graph.isValidRoot(i)||(n=!0)),n},mxGraphHandler.prototype.selectDelayed=function(e){var n=e.getCell();null==n&&(n=this.cell);for(var t=this.graph.getModel(),a=t.getParent(n);this.graph.isCellSelected(n)&&t.isVertex(a)&&!this.graph.isValidRoot(a);)n=a,a=t.getParent(n);this.graph.selectCellForEvent(n,e.getEvent())},mxPanningHandler.prototype.getCellForPopupEvent=function(e){for(var n=e.getCell(),t=this.graph.getModel(),a=t.getParent(n);t.isVertex(a)&&!this.graph.isValidRoot(a);)this.graph.isCellSelected(a)&&(n=a),a=t.getParent(a);return n}},Editor.prototype.createUndoManager=function(){var s=this.graph,t=new mxUndoManager,e=function(e,n){t.undoableEditHappened(n.getProperty("edit"))};s.getModel().addListener(mxEvent.UNDO,e),s.getView().addListener(mxEvent.UNDO,e);var n=function(e,n){for(var t=s.getSelectionCellsForChanges(n.getProperty("edit").changes),a=[],i=1;i<t.length;i++)null!=s.view.getState(t[i])&&a.push(t[i]);s.setSelectionCells(a)};return t.addListener(mxEvent.UNDO,n),t.addListener(mxEvent.REDO,n),t},Editor.prototype.initStencilRegistry=function(){mxStencilRegistry.loadStencilSet(STENCIL_PATH+"/general.xml")},mxStencilRegistry.libraries={},mxStencilRegistry.packages=[],mxStencilRegistry.getStencil=function(e){var n=mxStencilRegistry.stencils[e];if(null==n){var t=mxStencilRegistry.getBasenameForStencil(e);if(null!=t){var a=mxStencilRegistry.libraries[t];if(null!=a){if(null==mxStencilRegistry.packages[t]){mxStencilRegistry.packages[t]=1;for(var i=0;i<a.length;i++){var s=a[i];if(".xml"==s.toLowerCase().substring(s.length-4,s.length))mxStencilRegistry.loadStencilSet(s,null);else if(".js"==s.toLowerCase().substring(s.length-3,s.length)){var o=mxUtils.load(s);null!=o&&eval.call(window,o.getText())}}}}else mxStencilRegistry.loadStencilSet(STENCIL_PATH+"/"+t+".xml",null);n=mxStencilRegistry.stencils[e]}}return n},mxStencilRegistry.getBasenameForStencil=function(e){var n=e.split("."),t=null;if(0<n.length&&"mxgraph"==n[0]){t=n[1];for(var a=2;a<n.length-1;a++)t+="/"+n[a]}return t},mxStencilRegistry.loadStencilSet=function(e,n,t){t=null!=t&&t;var a=mxStencilRegistry.packages[e];if(t||null==a){var i=!1;null==a&&(a=mxUtils.load(e).getXml(),mxStencilRegistry.packages[e]=a,i=!0),mxStencilRegistry.parseStencilSet(a,n,i)}},mxStencilRegistry.parseStencilSet=function(e,n,t){t=null==t||t;var a=e.documentElement,i=a.firstChild,s="",o=a.getAttribute("name");for(null!=o&&(s=o+".");null!=i;){if(i.nodeType==mxConstants.NODETYPE_ELEMENT&&null!=(o=i.getAttribute("name"))){s=s.toLowerCase();var r=o.replace(/ /g,"_");if(t&&mxStencilRegistry.addStencil(s+r.toLowerCase(),new mxStencil(i)),null!=n){var l=i.getAttribute("w"),d=i.getAttribute("h");n(s,r,o,l=null==l?80:parseInt(l,10),d=null==d?80:parseInt(d,10))}}i=i.nextSibling}},OpenFile=function(e){this.producer=null,this.consumer=null,this.done=e},OpenFile.prototype.setConsumer=function(e){this.consumer=e,this.execute()},OpenFile.prototype.setData=function(e,n){this.data=e,this.filename=n,this.execute()},OpenFile.prototype.error=function(e){this.cancel(),mxUtils.alert(e)},OpenFile.prototype.execute=function(){null!=this.consumer&&null!=this.data&&(this.consumer(this.data,this.filename),this.cancel())},OpenFile.prototype.cancel=function(){null!=this.done&&this.done()},Sidebar.prototype.init=function(){var e=STENCIL_PATH;this.addSearchPalette(!0),this.addImagePalette("entry",mxResources.get("entry"),e+"/entry/","_128x128.png",["start","finally","end"],[mxResources.get("start"),mxResources.get("finally"),mxResources.get("end")]),this.addImagePalette("call_management",mxResources.get("call_management"),e+"/call_management/","_128x128.png",["answer","hangup","dial","ext_dial","queue","voicemail","callback"],[mxResources.get("answer"),mxResources.get("hangup"),mxResources.get("dial"),mxResources.get("ext_dial"),mxResources.get("queue"),mxResources.get("voicemail"),mxResources.get("callback")]),this.addImagePalette("agent_management",mxResources.get("agent_management"),e+"/agent_management/","_128x128.png",["login","pause","unpause","logout"],[mxResources.get("login"),mxResources.get("pause"),mxResources.get("unpause"),mxResources.get("logout")]),this.addImagePalette("variable",mxResources.get("variable"),e+"/variable/","_128x128.png",["set","math"],[mxResources.get("set"),mxResources.get("math")]),this.addImagePalette("playback",mxResources.get("playback"),e+"/playback/","_128x128.png",["playback","menu","saydigits","saynumber","sayphonetic","getdigits","getsecretdigits"],[mxResources.get("playback"),mxResources.get("menu"),mxResources.get("saydigits"),mxResources.get("saynumber"),mxResources.get("sayphonetic"),mxResources.get("getdigits"),mxResources.get("getsecretdigits")]),this.addImagePalette("recording",mxResources.get("recording"),e+"/recording/","_128x128.png",["record"],[mxResources.get("record")]),this.addImagePalette("tts","TTS",e+"/tts/","_128x128.png",["google_cloud_tts","tts","ispeechtts","awspolly","lumenvoxtts","sestektts","mrcpsynth"],["Google Cloud TTS","GoogleTTS","ISpeechTTS","AWSPolly","LumenvoxTTS","SestekTTS","MRCPSynth"]),this.addImagePalette("asr","ASR",e+"/asr/","_128x128.png",["googleasr","ispeechasr","lumenvoxasr","tildeasr","sestekasr","mrcprecog"],["GoogleASR","ISpeechASR","LumenvoxASR","TildeASR","SestekASR","MRCPRecog"]),this.addImagePalette("integrationServer",mxResources.get("integrationServer"),e+"/integration_server/","_128x128.png",["database","sendMail","sendSMS","dialogflow","dialogflowV2","awslex","sesteknda","restapi"],[mxResources.get("database"),mxResources.get("sendMail"),mxResources.get("sendSMS"),"Dialogflow","DialogflowV2","AWSLex","SestekNDA","RestAPI"]),this.addImagePalette("callflow",mxResources.get("callflow"),e+"/callflow/","_128x128.png",["gotoc","gotoif","gotoiftime","vswitch"],[mxResources.get("gotoc"),mxResources.get("gotoif"),mxResources.get("gotoiftime"),mxResources.get("vswitch")]),this.addImagePalette("stats",mxResources.get("stats"),e+"/stats/","_128x128.png",["goal"],[mxResources.get("goal")]),this.addImagePalette("general",mxResources.get("general"),e+"/general/","_128x128.png",["noop","system","agi","subproject","custom_app"],[mxResources.get("noop"),mxResources.get("system"),mxResources.get("agi"),mxResources.get("subproject"),mxResources.get("custom_app")])},Sidebar.prototype.collapsedImage=mxClient.IS_SVG?"data:image/gif;base64,R0lGODlhDQANAIABAJmZmf///yH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0Nzc3LCAyMDEwLzAyLzEyLTE3OjMyOjAwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDozNUQyRTJFNjZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDozNUQyRTJFNzZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjFERjc3MEUxNkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjFERjc3MEUyNkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAQAAAQAsAAAAAA0ADQAAAhSMj6lrwAjcC1GyahV+dcZJgeIIFgA7":IMAGE_PATH+"/collapsed.gif",Sidebar.prototype.expandedImage=mxClient.IS_SVG?"data:image/gif;base64,R0lGODlhDQANAIABAJmZmf///yH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0Nzc3LCAyMDEwLzAyLzEyLTE3OjMyOjAwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoxREY3NzBERjZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoxREY3NzBFMDZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjFERjc3MERENkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjFERjc3MERFNkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAQAAAQAsAAAAAA0ADQAAAhGMj6nL3QAjVHIu6azbvPtWAAA7":IMAGE_PATH+"/expanded.gif",Sidebar.prototype.tooltipImage=mxClient.IS_SVG?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAbCAMAAAB7jU7LAAAACVBMVEX///+ZmZn///9Y2COLAAAAA3RSTlP//wDXyg1BAAAAOElEQVR42mXQMQ4AMAgDsWv//+iutcJmIQSk+9dJpVKpVCqVSqVSqZTdncWzF8/NeP7FkxWenPEDOnUBiL3jWx0AAAAASUVORK5CYII=":IMAGE_PATH+"/tooltip.png",Sidebar.prototype.searchImage=mxClient.IS_SVG?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAEaSURBVHjabNGxS5VxFIfxz71XaWuQUJCG/gCHhgTD9VpEETg4aMOlQRp0EoezObgcd220KQiXmpretTAHQRBdojlQEJyukPdt+b1ywfvAGc7wnHP4nlZd1yKijQW8xzNc4Su+ZOYfQ3T6/f4YNvEJYzjELXp4VVXVz263+7cR2niBxAFeZ2YPi3iHR/gYERPDwhpOsd6sz8x/mfkNG3iOlWFhFj8y89J9KvzGXER0GuEaD42mgwHqUtoljbcRsTBCeINpfM/MgZLKPpaxFxGbOCqDXmILN7hoJrTKH+axhxmcYRxP0MIDnOBDZv5q1XUNIuJxifJp+UNV7t7BFM6xeic0RMQ4Bpl5W/ol7GISx/eEUUTECrbx+f8A8xhiZht9zsgAAAAASUVORK5CYII=":IMAGE_PATH+"/search.png",Sidebar.prototype.enableTooltips=!0,Sidebar.prototype.tooltipBorder=16,Sidebar.prototype.tooltipDelay=300,Sidebar.prototype.dropTargetDelay=200,Sidebar.prototype.thumbWidth=36,Sidebar.prototype.thumbHeight=36,Sidebar.prototype.thumbPadding=5<=document.documentMode?0:1,Sidebar.prototype.thumbBorder=2,Sidebar.prototype.sidebarTitleSize=9,Sidebar.prototype.sidebarTitles=!1,Sidebar.prototype.tooltipTitles=!0,Sidebar.prototype.maxTooltipWidth=400,Sidebar.prototype.maxTooltipHeight=400,Sidebar.prototype.addStencilsToIndex=!0,Sidebar.prototype.defaultImageWidth=80,Sidebar.prototype.defaultImageHeight=80,Sidebar.prototype.getOffset=function(e){return{left:(e=e.getBoundingClientRect()).left+window.scrollX,top:e.top+window.scrollY}},Sidebar.prototype.showTooltip=function(c,m,u,p,g,v){if(this.enableTooltips&&this.showTooltips&&this.currentElt!=c){null!=this.thread&&(window.clearTimeout(this.thread),this.thread=null);var e=mxUtils.bind(this,function(){null==this.tooltip&&(this.tooltip=document.createElement("div"),this.tooltip.className="geSidebarTooltip",this.tooltip.style.zIndex=mxPopupMenu.prototype.zIndex-1,document.body.appendChild(this.tooltip),this.graph2=new Graph(this.tooltip,null,null,this.editorUi.editor.graph.getStylesheet()),this.graph2.resetViewOnRootChange=!1,this.graph2.foldingEnabled=!1,this.graph2.gridEnabled=!1,this.graph2.autoScroll=!1,this.graph2.setTooltips(!1),this.graph2.setConnectable(!1),this.graph2.setEnabled(!1),mxClient.IS_SVG||(this.graph2.view.canvas.style.position="relative"),this.tooltipImage=mxUtils.createImage(this.tooltipImage),this.tooltipImage.className="geSidebarTooltipImage",this.tooltipImage.style.zIndex=mxPopupMenu.prototype.zIndex-1,this.tooltipImage.style.position="absolute",this.tooltipImage.style.width="14px",this.tooltipImage.style.height="27px",document.body.appendChild(this.tooltipImage)),this.graph2.model.clear(),this.graph2.view.setTranslate(this.tooltipBorder,this.tooltipBorder),u>this.maxTooltipWidth||p>this.maxTooltipHeight?this.graph2.view.scale=Math.round(100*Math.min(this.maxTooltipWidth/u,this.maxTooltipHeight/p))/100:this.graph2.view.scale=1,this.tooltip.style.display="block",this.graph2.labelsVisible=null==v||v,this.graph2.addCells(m);var e=this.graph2.getGraphBounds(),n=e.width+2*this.tooltipBorder+4,t=e.height+2*this.tooltipBorder;if(mxClient.IS_QUIRKS?(t+=4,this.tooltip.style.overflow="hidden"):this.tooltip.style.overflow="visible",this.tooltipImage.style.visibility="visible",this.tooltip.style.width=n+"px",this.tooltipTitles&&null!=g&&0<g.length){null==this.tooltipTitle?(this.tooltipTitle=document.createElement("div"),this.tooltipTitle.style.borderTop="1px solid gray",this.tooltipTitle.style.textAlign="center",this.tooltipTitle.style.width="100%",this.tooltipTitle.style.overflow="hidden",mxClient.IS_SVG||(this.tooltipTitle.style.position="absolute"),this.tooltipTitle.style.paddingTop="6px",this.tooltip.appendChild(this.tooltipTitle)):this.tooltipTitle.innerHTML="",this.tooltipTitle.style.display="",mxUtils.write(this.tooltipTitle,g);var a=this.tooltipTitle.offsetHeight+10;t+=a,mxClient.IS_SVG?this.tooltipTitle.style.marginTop=2-a+"px":(t-=6,this.tooltipTitle.style.top=t-a+"px")}else null!=this.tooltipTitle&&null!=this.tooltipTitle.parentNode&&(this.tooltipTitle.style.display="none");this.tooltip.style.height=t+"px";var i=-Math.round(e.x-this.tooltipBorder),s=-Math.round(e.y-this.tooltipBorder),o=document.body,r=document.documentElement,l=(o.clientHeight||r.clientHeight,document.getElementById("vertical-navigation").offsetWidth+this.container.clientWidth),d=Math.max(0,this.getOffset(c).top-this.container.scrollTop-t/2+16);mxClient.IS_SVG?0!=i||0!=s?this.graph2.view.canvas.setAttribute("transform","translate("+i+","+s+")"):this.graph2.view.canvas.removeAttribute("transform"):(this.graph2.view.drawPane.style.left=i+"px",this.graph2.view.drawPane.style.top=s+"px"),this.tooltip.style.position="absolute",this.tooltip.style.left=l+"px",this.tooltip.style.top=d+"px",this.tooltipImage.style.left=l-13+"px",this.tooltipImage.style.top=d+t/2-13+"px"});null!=this.tooltip&&"none"!=this.tooltip.style.display?e():this.thread=window.setTimeout(e,this.tooltipDelay),this.currentElt=c}},Sidebar.prototype.hideTooltip=function(){null!=this.thread&&(window.clearTimeout(this.thread),this.thread=null),null!=this.tooltip&&(this.tooltip.style.display="none",this.tooltipImage.style.visibility="hidden",this.currentElt=null)},Sidebar.prototype.addEntry=function(e,n){if(null!=this.taglist&&null!=e&&0<e.length)for(var t=e.toLowerCase().replace(/[\/\,\(\)]/g," ").split(" "),a=0;a<t.length;a++)if(t[a]=t[a].replace(/\.*\d*$/,""),1<t[a].length){var i=this.taglist[t[a]];null==i&&(i={entries:[],dict:new mxDictionary},this.taglist[t[a]]=i),null==i.dict.get(n)&&(i.dict.put(n,n),i.entries.push(n))}return n},Sidebar.prototype.searchEntries=function(e,n,t,a,i){if(null!=this.taglist&&null!=e){for(var s=e.toLowerCase().split(" "),o=new mxDictionary,r=(t+1)*n,l=[],d=0,c=0;c<s.length;c++)if(0<s[c].length){var m=this.taglist[s[c]],u=new mxDictionary;if(null!=m){var p=m.entries;l=[];for(var g=0;g<p.length;g++){m=p[g];if(0==d==(null==o.get(m))&&(u.put(m,m),l.push(m),c==s.length-1&&l.length==r))return void a(l.slice(t*n,r),r,!0)}}else l=[];o=u,d++}var v=l.length;a(l.slice(t*n,(t+1)*n),v,!1)}else a([])},Sidebar.prototype.filterTags=function(e){if(null==e)return null;for(var n=e.split(" "),t=[],a={},i=0;i<n.length;i++)null==a[n[i]]&&(a[n[i]]="1",t.push(n[i]));return t.join(" ")},Sidebar.prototype.cloneCell=function(e,n){var t=e.clone();return null!=n&&(t.value=n),t},Sidebar.prototype.addSearchPalette=function(e){var n=document.createElement("div");n.style.visibility="hidden",this.container.appendChild(n);var r=document.createElement("div");r.className="geSidebar",r.style.boxSizing="border-box",r.style.overflow="hidden",r.style.width="100%",r.style.padding="8px",r.style.paddingTop="14px",r.style.paddingBottom="0px",e||(r.style.display="none");var t=document.createElement("div");t.style.whiteSpace="nowrap",t.style.textOverflow="clip",t.style.paddingBottom="8px",t.style.cursor="default";var a=document.createElement("input");a.setAttribute("placeholder",mxResources.get("searchShapes")),a.setAttribute("type","text"),a.style.fontSize="12px",a.style.overflow="hidden",a.style.boxSizing="border-box",a.style.border="solid 1px #d5d5d5",a.style.borderRadius="4px",a.style.width="100%",a.style.outline="none",a.style.padding="6px",t.appendChild(a);var i,s=document.createElement("img");s.setAttribute("src",Sidebar.prototype.searchImage),s.setAttribute("title",mxResources.get("search")),s.style.position="relative",s.style.left="-18px",mxClient.IS_QUIRKS?(a.style.height="28px",s.style.top="-4px"):s.style.top="2px",s.style.background="url('"+this.editorUi.editor.transparentImage+"')",t.appendChild(s),r.appendChild(t);var l=document.createElement("center"),d=mxUtils.button(mxResources.get("moreResults"),function(){i()});d.style.display="none",d.style.lineHeight="normal",d.style.marginTop="4px",d.style.marginBottom="8px",l.style.paddingTop="4px",l.style.paddingBottom="8px",l.appendChild(d),r.appendChild(l);var c="",m=!1,u=!1,p=0,g=new Object,v=12,h=mxUtils.bind(this,function(){m=!1,this.currentSearch=null;for(var e=r.firstChild;null!=e;){var n=e.nextSibling;e!=t&&e!=l&&e.parentNode.removeChild(e),e=n}});i=mxUtils.bind(this,function(){if(v=4*Math.max(1,Math.floor(this.container.clientWidth/(this.thumbWidth+10))),this.hideTooltip(),""!=a.value){if(null!=l.parentNode&&(c!=a.value&&(h(),c=a.value,g=new Object,u=!1,p=0),!m&&!u)){d.setAttribute("disabled","true"),d.style.display="",d.style.cursor="wait",d.innerHTML=mxResources.get("loading")+"...",m=!0;var o=new Object;this.currentSearch=o,this.searchEntries(c,v,p,mxUtils.bind(this,function(e,n,t){if(this.currentSearch==o){e=null!=e?e:[],m=!1,p++,l.parentNode.removeChild(l);for(var a=0;a<e.length;a++){var i=e[a]();null==g[i.innerHTML]&&(g[i.innerHTML]="1",r.appendChild(e[a]()))}if(t?(d.removeAttribute("disabled"),d.innerHTML=mxResources.get("moreResults")):(d.innerHTML=mxResources.get("reset"),d.style.display="none",u=!0),d.style.cursor="",0==e.length&&1==p){var s=document.createElement("div");s.className="geTitle",s.style.backgroundColor="transparent",s.style.borderColor="transparent",s.style.color="gray",s.style.padding="0px",s.style.margin="0px 8px 0px 8px",s.style.paddingTop="6px",s.style.textAlign="center",s.style.cursor="default",mxUtils.write(s,mxResources.get("noResultsFor",[c])),r.appendChild(s)}r.appendChild(l)}}),mxUtils.bind(this,function(){d.style.cursor=""}))}}else h(),a.value="",c="",g=new Object,d.style.display="none",u=!1,a.focus()}),mxEvent.addListener(a,"keydown",mxUtils.bind(this,function(e){13==e.keyCode&&i()})),mxEvent.addListener(a,"focus",function(){a.style.paddingRight="",s.style.display="none"}),mxEvent.addListener(a,"blur",function(){a.style.paddingRight="20px",s.style.display=""}),a.style.paddingRight="20px",mxEvent.addListener(a,"keyup",mxUtils.bind(this,function(e){""==a.value?(u=!0,d.style.display="none"):a.value!=c?(d.style.display="none",u=!1):m||(d.style.display=u?"none":"")})),mxEvent.addListener(a,"mousedown",function(e){e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0}),mxEvent.addListener(a,"selectstart",function(e){e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0});var o=document.createElement("div");o.appendChild(r),this.container.appendChild(o),this.palettes.search=[n,o]},Sidebar.prototype.createTitle=function(e){var n=document.createElement("a");return n.setAttribute("href","javascript:void(0);"),n.setAttribute("title",mxResources.get("sidebarTooltip")),n.className="geTitle",mxUtils.write(n,e),n},Sidebar.prototype.createThumb=function(e,n,t,a,i,s,o,r,l){this.graph.labelsVisible=null==s||s;var d=mxClient.NO_FO;mxClient.NO_FO=Editor.prototype.originalNoForeignObject,this.graph.view.scaleAndTranslate(1,0,0),this.graph.addCells(e);var c=this.graph.getGraphBounds(),m=Math.floor(100*Math.min((n-2*this.thumbBorder)/c.width,(t-2*this.thumbBorder)/c.height))/100;this.graph.view.scaleAndTranslate(m,Math.floor((n-c.width*m)/2/m-c.x),Math.floor((t-c.height*m)/2/m-c.y));var u=null;if(this.graph.dialect!=mxConstants.DIALECT_SVG||mxClient.NO_FO?(u=this.graph.container.cloneNode(!1)).innerHTML=this.graph.container.innerHTML:u=this.graph.view.getCanvas().ownerSVGElement.cloneNode(!0),this.graph.getModel().clear(),mxClient.NO_FO=d,mxClient.IS_IE6&&(a.style.backgroundImage="url("+this.editorUi.editor.transparentImage+")"),u.style.position="relative",u.style.overflow="hidden",u.style.cursor="move",u.style.left=this.thumbBorder+"px",u.style.top=this.thumbBorder+"px",u.style.width=n+"px",u.style.height=t+"px",u.style.visibility="",u.style.minWidth="",u.style.minHeight="",a.appendChild(u),this.sidebarTitles&&null!=i&&0!=o){var p=mxClient.IS_QUIRKS?2*this.thumbPadding+2:0;a.style.height=this.thumbHeight+p+this.sidebarTitleSize+8+"px";var g=document.createElement("div");g.style.fontSize=this.sidebarTitleSize+"px",g.style.color="#303030",g.style.textAlign="center",g.style.whiteSpace="nowrap",mxClient.IS_IE&&(g.style.height=this.sidebarTitleSize+12+"px"),g.style.paddingTop="4px",mxUtils.write(g,i),a.appendChild(g)}return c},Sidebar.prototype.createItem=function(n,t,a,e,i,s,o){var r=document.createElement("a");r.setAttribute("href","javascript:void(0);"),r.className="geItem",r.style.overflow="hidden";var l=mxClient.IS_QUIRKS?8+2*this.thumbPadding:2*this.thumbBorder;r.style.width=this.thumbWidth+l+"px",r.style.height=this.thumbHeight+l+"px",r.style.padding=this.thumbPadding+"px",mxEvent.addListener(r,"click",function(e){mxEvent.consume(e)}),this.createThumb(n,this.thumbWidth,this.thumbHeight,r,t,a,e,i,s);var d=new mxRectangle(0,0,i,s);if(1<n.length||n[0].vertex){var c=this.createDragSource(r,this.createDropHandler(n,!0,o,d),this.createDragPreview(i,s),n,d);this.addClickHandler(r,c,n),c.isGuidesEnabled=mxUtils.bind(this,function(){return this.editorUi.editor.graph.graphHandler.guidesEnabled})}else if(null!=n[0]&&n[0].edge){c=this.createDragSource(r,this.createDropHandler(n,!1,o,d),this.createDragPreview(i,s),n,d);this.addClickHandler(r,c,n)}return mxClient.IS_IOS||mxEvent.addGestureListeners(r,null,mxUtils.bind(this,function(e){this.showTooltip(r,n,d.width,d.height,t,a)})),r},Sidebar.prototype.createDropHandler=function(g,v,h,f){return h=null==h||h,mxUtils.bind(this,function(e,n,t,a,i){if(e.isEnabled()){if(0<(g=e.getImportableCells(g)).length){e.stopEditing();var s=null!=t&&e.isValidDropTarget(t,g,n),o=null;if(null==t||s||(t=null),!e.isCellLocked(t||e.getDefaultParent())){e.model.beginUpdate();try{if(a=Math.round(a),i=Math.round(i),v&&e.isSplitTarget(t,g,n)){var r=e.cloneCells(g);e.splitEdge(t,r,null,a-f.width/2,i-f.height/2),o=r}else 0<g.length&&(o=e.importCells(g,a,i,t));if(null!=e.layoutManager){var l=e.layoutManager.getLayout(t);if(null!=l)for(var d=e.view.scale,c=e.view.translate,m=(a+c.x)*d,u=(i+c.y)*d,p=0;p<o.length;p++)l.moveCell(o[p],m,u)}h&&e.fireEvent(new mxEventObject("cellsInserted","cells",o))}finally{e.model.endUpdate()}null!=o&&0<o.length&&(e.scrollCellToVisible(o[0]),e.setSelectionCells(o))}}mxEvent.consume(n)}})},Sidebar.prototype.createDragPreview=function(e,n){var t=document.createElement("div");return t.style.border="1px dashed black",t.style.width=e+"px",t.style.height=n+"px",t},Sidebar.prototype.createDragSource=function(e,n,t){var a=mxUtils.makeDraggable(e,this.editorUi.editor.graph,n,t,0,0,this.editorUi.editor.graph.autoscroll,!0,!0);return a.getDropTarget=function(e,n,t){var a=mxDragSource.prototype.getDropTarget.apply(this,arguments);return e.isValidRoot(a)||(a=null),a},a},Sidebar.prototype.addClickHandler=function(e,a){var i=this.editorUi.editor.graph,s=null;mxEvent.addGestureListeners(e,function(e){s=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e))});var o=a.mouseUp;a.mouseUp=function(e){if(!mxEvent.isPopupTrigger(e)&&null==this.currentGraph&&null!=s){var n=i.tolerance;if(Math.abs(s.x-mxEvent.getClientX(e))<=n&&Math.abs(s.y-mxEvent.getClientY(e))<=n){var t=i.getGridSize();a.drop(i,e,null,t,t)}}o.apply(this,arguments),s=null}},Sidebar.prototype.createVertexTemplateEntry=function(e,n,t,a,i,s,o,r){return r=null!=r&&0<r.length?r:i.toLowerCase(),this.addEntry(r,mxUtils.bind(this,function(){return this.createVertexTemplate(e,n,t,a,i,s,o)}))},Sidebar.prototype.createXmlDocument=function(e,n,t,a){var i=mxUtils.createXmlDocument().createElement(e);return i.setAttribute("label",n),t.forEach(function(e,n){i.setAttribute(e,a[n]?a[n]:"")}),i},Sidebar.prototype.createVertexTemplate=function(e,n,t,a,i,s,o,r){var l=[],d=[];switch(a){case"answer":l=["timeout"],d=["0"];break;case"start":l=["answer"],d=["yes"];break;case"googleasr":l=["key","google_asr_language","timeout","intKey","beep"],d=["","it-IT","10","#","BEEP"];break;case"tildeasr":l=["uri","appid","appsecret","timeout","intKey","beep"],d=["wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE","","","10","#","BEEP"];break;case"ispeechasr":l=["key","model","ispeech_asr_language","timeout","intKey","beep"],d=["","","it-IT","10","#","BEEP"];break;case"playback":l=["file_id","opts"],d=["0"];break;case"background":l=["file_id","response","digit"],d=["0","5","1"];break;case"menu":l=["file_id","response","digit","retry","variable_id"],d=["0","5","1","1","0"];break;case"getdigits":l=["file_id","response","mindigit","maxdigit","retry","variable_id"],d=["0","5","1","10","1","0"];break;case"getsecretdigits":l=["file_id","response","mindigit","maxdigit","retry","hiddendigitsnum","hiddendigitspos","variable_id"],d=["0","5","1","10","1","0","first","0"];break;case"custom_app":l=["application","options"],d=["",""];break;case"set":l=["variable_id","variable_value"],d=["0",""];break;case"database":l=["odbc_id","query","variable_id"],d=["0","",""];break;case"noop":l=["output"],d=[];break;case"gotoc":l=["context","extension","priority"],d=["","","1"];break;case"system":l=["variable_id","command"],d=[];break;case"agi":l=["command","args"],d=[];break;case"gotoif":l=["condition"],d=[];break;case"gotoiftime":l=["interval_id"],d=["0"];break;case"vswitch":l=["variable_id"],d=["0"];break;case"saydigits":l=["digits","escape_digits"],d=["","#"];break;case"saynumber":l=["number","escape_digits"],d=["","#"];break;case"sayphonetic":l=["text","escape_digits"],d=["","#"];break;case"record":l=["file","recordingFormat","timeout","escape_digits"],d=["","wav","-1","#"];break;case"dial":l=["sip_id","timeout","opts","url"],d=["0","60"];break;case"ext_dial":l=["phone","trunk_name","timeout","opts","url"],d=["","-1","60"];break;case"google_cloud_tts":l=["apiKey","google_cloud_tts_text_type","text","languageCode","ssmlGender"],d=["","text","","en-US","FEMALE"];break;case"tts":l=["text","google_tts_language"],d=["","it"];break;case"ispeechtts":l=["text","key","ispeech_tts_language","speed","intKey"],d=["","","euritalianfemale","0","#"];break;case"lumenvoxtts":case"sestektts":l=["text","options"],d=["",""];break;case"lumenvoxasr":l=["grammar","options"],d=["",""];break;case"sestekasr":l=["grammar","options"],d=["/usr/local/unimrcp/data/grammar.xml",""];break;case"awspolly":l=["aws_access_key_id","aws_secret_access_key","aws_polly_region","aws_polly_voice","text","aws_text_type"],d=["","","eu-west-1","Amy","","text"];break;case"awslex":l=["aws_access_key_id","aws_secret_access_key","aws_lex_region","aws_bot_name","text"],d=["","","eu-west-1","",""];break;case"queue":l=["queue_id","opts","url","file_id","timeout","agi","macro","gosub","position"],d=["-1","xX","","","300"];break;case"voicemail":l=["mailbox","options"],d=["",""];break;case"subproject":l=["project_id"],d=["0"];break;case"math":l=["operation","variable_id"],d=["","0"];break;case"queuelog":l=["queuename","agent","queue_event","data1","data2","data3","data4","data5"],d=[];break;case"goal":l=["goalname"],d=[];break;case"callback":l=["name","lastName","phone","dialTimezone","list_id","delay","callback_priority"],d=["{CALLERID(name)}","","{CALLERID(num)}","","-1","5","2"];break;case"sendSMS":l=["sms_account_id","to","sms_text"],d=["0"];break;case"sendMail":l=["account_id","to","cc","bcc","subject","text"],d=["0"];break;case"sendFax":l=["account_id","to","choose_attachment","attachment_name","attachment_type","attachment_path"],d=["0"];break;case"login":case"unpause":case"logout":l=["findBy"],d=["internal"];break;case"pause":l=["findBy","pause_id"],d=["internal",""];break;case"dialogflow":l=["key","text","dialogflow_language"],d=["","","it"];break;case"sesteknda":l=["ndauth_url","username","password","ndassistant_url","text","project","ndagenerate_audio","custom_action","custom_action_data","ndaactivity_type"],d=["","","","","","",1,"","","message"];break;case"restapi":l=["url","method","timeout","computedVariables","rawHeaders","rawBody","variable_id"],d=["","GET","5","","","",""];break;case"mrcpsynth":l=["text","options"],d=["",""];break;case"mrcprecog":l=["grammar","options"],d=["",""];break;case"dialogflowV2":l=["dialogflowV2_project_id","client_email","private_key","dialogflowV2_language","text"],d=["","","","en",""];break;default:l=[],d=[]}var c=[new mxCell(this.createXmlDocument(a,i,l,d),new mxGeometry(0,0,n,t),e)];return c[0].vertex=!0,this.createVertexTemplateFromCells(c,n,t,i,s,o,r)},Sidebar.prototype.createVertexTemplateFromCells=function(e,n,t,a,i,s,o){return this.createItem(e,a,i,s,n,t,o)},Sidebar.prototype.createEdgeTemplate=function(e,n,t,a,i,s,o){var r=new mxCell(null!=a?a:"",new mxGeometry(0,0,n,t),e);return r.geometry.setTerminalPoint(new mxPoint(0,t),!0),r.geometry.setTerminalPoint(new mxPoint(n,0),!1),r.geometry.relative=!0,r.edge=!0,this.createEdgeTemplateFromCells([r],n,t,i,s,o)},Sidebar.prototype.createEdgeTemplateFromCells=function(e,n,t,a,i,s){return this.createItem(e,a,i,!0,n,t,s)},Sidebar.prototype.addPaletteFunctions=function(e,n,t,a){this.addPalette(e,n,t,mxUtils.bind(this,function(e){for(var n=0;n<a.length;n++)e.appendChild(a[n](e))}))},Sidebar.prototype.addPalette=function(e,n,t,a){var i=this.createTitle(n);this.container.appendChild(i);var s=document.createElement("div");s.className="geSidebar",mxClient.IS_POINTER&&(s.style.touchAction="none"),mxEvent.addListener(s,"mousemove",mxUtils.bind(this,function(e){mxEvent.getSource(e)==s?s.setAttribute("title",mxResources.get("sidebarTooltip")):s.removeAttribute("title")})),t?(a(s),a=null):s.style.display="none",this.addFoldingHandler(i,s,a);var o=document.createElement("div");return o.appendChild(s),this.container.appendChild(o),null!=e&&(this.palettes[e]=[i,o]),s},Sidebar.prototype.addFoldingHandler=function(t,a,i){var s=!1;(!mxClient.IS_IE||8<=document.documentMode)&&(t.style.backgroundImage="none"==a.style.display?"url('"+this.collapsedImage+"')":"url('"+this.expandedImage+"')"),t.style.backgroundRepeat="no-repeat",t.style.backgroundPosition="0% 50%",mxEvent.addListener(t,"click",mxUtils.bind(this,function(e){if("none"==a.style.display){if(s)a.style.display="block";else if(s=!0,null!=i){t.style.cursor="wait";var n=t.innerHTML;t.innerHTML=mxResources.get("loading")+"...",window.setTimeout(function(){var e=mxClient.NO_FO;mxClient.NO_FO=Editor.prototype.originalNoForeignObject,i(a),mxClient.NO_FO=e,a.style.display="block",t.style.cursor="",t.innerHTML=n},0)}else a.style.display="block";t.style.backgroundImage="url('"+this.expandedImage+"')"}else t.style.backgroundImage="url('"+this.collapsedImage+"')",a.style.display="none";mxEvent.consume(e)}))},Sidebar.prototype.addImagePalette=function(e,n,s,o,r,t,a){for(var l=[],d=0;d<r.length;d++)mxUtils.bind(this,function(e,n,t){if(null==t){var a=e.lastIndexOf("/"),i=e.lastIndexOf(".");t=e.substring(0<=a?a+1:0,0<=i?i:e.length).replace(/[-_]/g," ")}l.push(this.createVertexTemplateEntry("image;html=1;image="+s+e+o,this.defaultImageWidth,this.defaultImageHeight,r[d],n,!1,!0,this.filterTags(t)))})(r[d],null!=t?t[d]:null,null!=a?a[r[d]]:null);this.addPaletteFunctions(e,n,!1,l)},"undefined"!=typeof html4&&(html4.ATTRIBS["a::target"]=0),mxConstants.SHADOW_OPACITY=.25,mxConstants.SHADOWCOLOR="#000000",mxConstants.VML_SHADOWCOLOR="#d0d0d0",mxGraph.prototype.pageBreakColor="#c0c0c0",mxGraph.prototype.pageScale=1,function(){try{if(null!=navigator&&null!=navigator.language){var e=navigator.language.toLowerCase();mxGraph.prototype.pageFormat="en-us"===e||"en-ca"===e||"es-mx"===e?mxConstants.PAGE_FORMAT_LETTER_PORTRAIT:mxConstants.PAGE_FORMAT_A4_PORTRAIT}}catch(e){}}(),mxText.prototype.baseSpacingTop=5,mxText.prototype.baseSpacingBottom=1,mxGraphModel.prototype.ignoreRelativeEdgeParent=!1,mxGraphView.prototype.gridImage=mxClient.IS_SVG?"data:image/gif;base64,R0lGODlhCgAKAJEAAAAAAP///8zMzP///yH5BAEAAAMALAAAAAAKAAoAAAIJ1I6py+0Po2wFADs=":IMAGE_PATH+"/grid.gif",mxGraphView.prototype.gridSteps=4,mxGraphView.prototype.minGridSize=4,mxGraphView.prototype.gridColor="#e0e0e0",mxSvgCanvas2D.prototype.foAltText="[Not supported by viewer]",Graph=function(e,n,t,a){mxGraph.call(this,e,n,t,a),this.setConnectable(!0),this.setDropEnabled(!1),this.setPanning(!0),this.setTooltips(!mxClient.IS_TOUCH),this.setAllowLoops(!1),this.setMultigraph(!1),this.allowAutoPanning=!0,this.resetEdgesOnConnect=!1,this.constrainChildren=!1,this.connectionHandler.targetConnectImage=!0,this.setAllowDanglingEdges(!1),this.connectionHandler.setCreateTarget(!1),this.connectionHandler.isValidSource=function(){return mxConnectionHandler.prototype.isValidSource.apply(this,arguments)&&"2"!=urlParams.connect},this.alternateEdgeStyle="vertical",null==a&&this.loadStylesheet();var i=new mxRubberband(this);this.getRubberband=function(){return i},this.panningHandler.addListener(mxEvent.PAN_START,mxUtils.bind(this,function(){this.container.style.cursor="pointer"})),this.panningHandler.addListener(mxEvent.PAN_END,mxUtils.bind(this,function(){this.container.style.cursor="default"})),this.isHtmlLabel=function(e){var n=this.view.getState(e),t=null!=n?n.style:this.getCellStyle(e);return"1"==t.html||"wrap"==t.whiteSpace},this.cellRenderer.getLabelValue=function(e){var n=mxCellRenderer.prototype.getLabelValue.apply(this,arguments);return"wrap"==e.style.whiteSpace&&1!=e.style.html&&(n=mxUtils.htmlEntities(n,!1)),n},this.isCellLocked=function(e){return!1},this.connectionHandler.tapAndHoldTolerance=16;var s=this.connectionHandler.tapAndHold;this.connectionHandler.tapAndHold=function(e,n){null==n?this.graph.panningHandler.active||(i.start(e.getGraphX(),e.getGraphY()),this.graph.panningHandler.panningTrigger=!1):tapAndHoldStartsConnection?s.apply(this,arguments):this.graph.isCellSelected(n.cell)&&1<this.graph.getSelectionCount()&&this.graph.removeSelectionCell(n.cell)},touchStyle&&this.initTouch()},mxUtils.extend(Graph,mxGraph),Graph.prototype.minFitScale=null,Graph.prototype.maxFitScale=null,Graph.prototype.loadStylesheet=function(){var e=mxUtils.load(STYLE_PATH+"/default.xml").getDocumentElement();new mxCodec(e.ownerDocument).decode(e,this.getStylesheet())},Graph.prototype.flipEdge=function(e){if(null!=e){var n=this.view.getState(e),t=null!=n?n.style:this.getCellStyle(e);if(null!=t){var a=mxUtils.getValue(t,mxConstants.STYLE_ELBOW,mxConstants.ELBOW_HORIZONTAL)==mxConstants.ELBOW_HORIZONTAL?mxConstants.ELBOW_VERTICAL:mxConstants.ELBOW_HORIZONTAL;this.setCellStyles(mxConstants.STYLE_ELBOW,a,[e])}}},Graph.prototype.setDefaultEdge=function(e){if(null!=e&&this.getModel().isEdge(e)){var n=this.getModel().cloneCells([e])[0];null!=n.geometry&&(n.geometry.points=null);var t=n.getStyle();t=mxUtils.setStyle(t,mxConstants.STYLE_ENTRY_X,null),t=mxUtils.setStyle(t,mxConstants.STYLE_ENTRY_Y,null),t=mxUtils.setStyle(t,mxConstants.STYLE_EXIT_X,null),t=mxUtils.setStyle(t,mxConstants.STYLE_EXIT_Y,null),n.setStyle(t),this.connectionHandler.createEdgeState=function(e){return this.graph.view.createState(n)},this.connectionHandler.factoryMethod=function(){return this.graph.cloneCells([n])[0]}}},Graph.prototype.isCellFoldable=function(e){return this.foldingEnabled&&this.isSwimlane(e)},Graph.prototype.isValidRoot=function(e){return this.isSwimlane(e)},Graph.prototype.createGroupCell=function(){var e=mxGraph.prototype.createGroupCell.apply(this,arguments);return e.setStyle("group"),e},Graph.prototype.getTooltipForCell=function(e){var n="";return this.getModel().isVertex(e)?n+=mxResources.get("description_"+e.value.nodeName)||"":this.getModel().isEdge(e)&&(n=mxGraph.prototype.getTooltipForCell.apply(this,arguments)),n},Graph.prototype.convertValueToString=function(e){return null!=e.value&&"object"==typeof e.value?e.value.getAttribute("label"):mxGraph.prototype.convertValueToString.apply(this,arguments)},Graph.prototype.cellLabelChanged=function(e,n,t){if(null!=e.value&&"object"==typeof e.value){var a=e.value.cloneNode(!0);a.setAttribute("label",n),n=a}mxGraph.prototype.cellLabelChanged.apply(this,arguments)},Graph.prototype.setLinkForCell=function(e,n){var t=null;null!=e.value&&"object"==typeof e.value?t=e.value.cloneNode(!0):(t=mxUtils.createXmlDocument().createElement("UserObject")).setAttribute("label",e.value);null!=n&&0<n.length?t.setAttribute("link",n):t.removeAttribute("link"),this.model.setValue(e,t)},Graph.prototype.getLinkForCell=function(e){return null!=e.value&&"object"==typeof e.value?e.value.getAttribute("link"):null},Graph.prototype.initTouch=function(){this.connectionHandler.marker.isEnabled=function(){return null!=this.graph.connectionHandler.first},this.addListener(mxEvent.START_EDITING,function(e,n){this.panningHandler.hideMenu()});var s=!1,o=null;this.updateMouseEvent=function(e){if(mxGraph.prototype.updateMouseEvent.apply(this,arguments),null==e.getState()){var n=this.getCellAt(e.graphX,e.graphY);this.getModel().isEdge(n)&&(e.state=this.view.getState(n),null!=e.state&&null!=e.state.shape&&(this.container.style.cursor=e.state.shape.node.style.cursor))}null==e.getState()&&(this.container.style.cursor="default")},this.fireMouseEvent=function(e,n,t){if(e==mxEvent.MOUSE_DOWN)this.panningHandler.isMenuShowing()?(s=!1,o=null):(o=n.getCell(),s=null!=o?this.isCellSelected(o):this.isSelectionEmpty());else if(e==mxEvent.MOUSE_UP){if(s&&!this.isEditing()){if(!this.panningHandler.isMenuShowing()){var a=mxEvent.getClientX(n.getEvent()),i=mxEvent.getClientY(n.getEvent());this.panningHandler.popup(a+16,i,o,n.getEvent())}return s=!1,o=null,void n.consume()}s=!1,o=null}mxGraph.prototype.fireMouseEvent.apply(this,arguments),e==mxEvent.MOUSE_MOVE&&n.isConsumed()&&(s=!1,o=null)}},function(){if(mxVertexHandler.prototype.rotationEnabled=!0,mxText.prototype.baseSpacingTop=5,mxText.prototype.baseSpacingBottom=1,touchStyle){mxConstants.HANDLE_SIZE=16,mxConstants.LABEL_HANDLE_SIZE=7,mxClient.IS_TOUCH&&(mxVertexHandler.prototype.tolerance=4,mxEdgeHandler.prototype.tolerance=6,Graph.prototype.tolerance=14,Graph.prototype.gridSize=20,mxPanningHandler.prototype.selectOnPopup=!1,mxPanningHandler.prototype.useLeftButtonForPanning=!0,mxPanningHandler.prototype.isPanningTrigger=function(e){var n=e.getEvent();return this.useLeftButtonForPanning&&(this.ignoreCell||null==e.getState())||mxEvent.isControlDown(n)&&mxEvent.isShiftDown(n)||this.usePopupTrigger&&mxEvent.isPopupTrigger(n)});var t=mxGraphHandler.prototype.mouseDown;mxGraphHandler.prototype.mouseDown=function(e,n){t.apply(this,arguments),this.graph.isCellSelected(n.getCell())&&1<this.graph.getSelectionCount()&&(this.delayedSelection=!1)},Graph.prototype.createHandlers=function(e){this.tooltipHandler=new mxTooltipHandler(this),this.tooltipHandler.setEnabled(!1),this.selectionCellsHandler=new mxSelectionCellsHandler(this),this.panningHandler=new mxPanningHandler(this),this.panningHandler.panningEnabled=!1,this.connectionHandler=new mxConnectionHandler(this),this.connectionHandler.setEnabled(!1),this.graphHandler=new mxGraphHandler(this)},mxConnectionHandler.prototype.selectCells=function(e,n){touchStyle&&null!=n?this.graph.setSelectionCell(n):this.graph.setSelectionCell(e)};var a=mxGraph.prototype.dblClick;Graph.prototype.dblClick=function(e,n){if(null==n){var t=mxUtils.convertPoint(this.container,mxEvent.getClientX(e),mxEvent.getClientY(e));n=this.getCellAt(t.x,t.y)}a.call(this,e,n)};var e=new mxImage(IMAGE_PATH+"/touch-handle.png",16,16);mxVertexHandler.prototype.handleImage=e,mxEdgeHandler.prototype.handleImage=e,mxOutline.prototype.sizerImage=e,(new Image).src=e.src;var n=IMAGE_PATH+"/touch-connector.png",i=mxVertexHandler.prototype.init;mxVertexHandler.prototype.init=function(){i.apply(this,arguments),showConnectorImg&&this.graph.connectionHandler.isEnabled()&&this.graph.isCellConnectable(this.state.cell)&&!this.graph.isValidRoot(this.state.cell)&&1==this.graph.getSelectionCount()&&(this.connectorImg=mxUtils.createImage(n),this.connectorImg.style.cursor="pointer",this.connectorImg.style.width="29px",this.connectorImg.style.height="29px",this.connectorImg.style.position="absolute",mxClient.IS_TOUCH||(this.connectorImg.setAttribute("title",mxResources.get("connect")),mxEvent.redirectMouseEvents(this.connectorImg,this.graph,this.state)),this.connectorImg.style.padding="2px",mxEvent.addGestureListeners(this.connectorImg,mxUtils.bind(this,function(e){this.graph.panningHandler.hideMenu();var n=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));this.graph.connectionHandler.start(this.state,n.x,n.y),this.graph.isMouseDown=!0,mxEvent.consume(e)})),this.graph.container.appendChild(this.connectorImg)),this.redrawTools()};var s=mxVertexHandler.prototype.redraw;mxVertexHandler.prototype.redraw=function(){s.apply(this),this.redrawTools()},mxVertexHandler.prototype.redrawTools=function(){null!=this.state&&null!=this.connectorImg&&(mxVertexHandler.prototype.singleSizer?(this.connectorImg.style.left=this.state.x+this.state.width-this.connectorImg.offsetWidth/2+"px",this.connectorImg.style.top=this.state.y-this.connectorImg.offsetHeight/2+"px"):(this.connectorImg.style.left=this.state.x+this.state.width+mxConstants.HANDLE_SIZE/2+4+"px",this.connectorImg.style.top=this.state.y+(this.state.height-this.connectorImg.offsetHeight)/2+"px"))};var o=mxVertexHandler.prototype.destroy;mxVertexHandler.prototype.destroy=function(e,n){o.apply(this,arguments),null!=this.connectorImg&&(this.connectorImg.parentNode.removeChild(this.connectorImg),this.connectorImg=null)},(new Image).src=n}else{var r=new mxImage(IMAGE_PATH+"/connector.png",15,15);if(mxConnectionHandler.prototype.connectImage=r,(new Image).src=r.src,"2"==urlParams.connect){r=new mxImage(IMAGE_PATH+"/connector.png",15,15),i=mxVertexHandler.prototype.init;mxVertexHandler.prototype.init=function(){i.apply(this,arguments),showConnectorImg&&this.graph.connectionHandler.isEnabled()&&this.graph.isCellConnectable(this.state.cell)&&!this.graph.isValidRoot(this.state.cell)&&1==this.graph.getSelectionCount()&&(mxClient.IS_IE&&!mxClient.IS_SVG?(this.connectorImg=document.createElement("div"),this.connectorImg.style.backgroundImage="url("+r.src+")",this.connectorImg.style.backgroundPosition="center",this.connectorImg.style.backgroundRepeat="no-repeat",this.connectorImg.style.width=r.width+4+"px",this.connectorImg.style.height=r.height+4+"px",this.connectorImg.style.display=mxClient.IS_QUIRKS?"inline":"inline-block"):(this.connectorImg=mxUtils.createImage(r.src),this.connectorImg.style.width=r.width+"px",this.connectorImg.style.height=r.height+"px"),this.connectorImg.style.cursor="pointer",this.connectorImg.style.position="absolute",this.connectorImg.setAttribute("title",mxResources.get("connect")),mxEvent.redirectMouseEvents(this.connectorImg,this.graph,this.state),this.connectorImg.style.padding="2px",mxEvent.addListener(this.connectorImg,"mousedown",mxUtils.bind(this,function(e){this.graph.panningHandler.hideMenu();var n=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));this.graph.connectionHandler.start(this.state,n.x,n.y),this.graph.isMouseDown=!0,mxEvent.consume(e)})),this.graph.container.appendChild(this.connectorImg)),this.redrawTools()};s=mxVertexHandler.prototype.redraw;mxVertexHandler.prototype.redraw=function(){s.apply(this),this.redrawTools()},mxVertexHandler.prototype.redrawTools=function(){null!=this.state&&null!=this.connectorImg&&(mxVertexHandler.prototype.singleSizer?(this.connectorImg.style.left=this.state.x+this.state.width-this.connectorImg.offsetWidth/2+"px",this.connectorImg.style.top=this.state.y-this.connectorImg.offsetHeight/2+"px"):(this.connectorImg.style.left=this.state.x+this.state.width+mxConstants.HANDLE_SIZE/2+2+"px",this.connectorImg.style.top=this.state.y+(this.state.height-this.connectorImg.offsetHeight)/2+"px"))};o=mxVertexHandler.prototype.destroy;mxVertexHandler.prototype.destroy=function(e,n){o.apply(this,arguments),null!=this.connectorImg&&(this.connectorImg.parentNode.removeChild(this.connectorImg),this.connectorImg=null)}}}}(),Actions.prototype.init=function(){var n=this.editorUi,l=n.editor,d=l.graph;this.addAction("new",function(){n.projectDesignController.newProject()},CRUD_PERMISSIONS.canEdit),this.addAction("open",function(){n.projectDesignController.openProject()},CRUD_PERMISSIONS.canEdit),this.addAction("save",function(){n.projectDesignController.saveOrPublishProject(mxUtils.getPrettyXml(l.getGraphXml())),n.editor.modified=!1},CRUD_PERMISSIONS.canEdit,null,"Ctrl+S"),this.addAction("saveAs",function(){n.projectDesignController.saveProjectAs(mxUtils.getPrettyXml(l.getGraphXml()))},CRUD_PERMISSIONS.canEdit,null,"Ctrl+Shift+S"),this.addAction("publish",function(){n.editor.setStatus(""),null===n.validate()?(n.projectDesignController.saveOrPublishProject(mxUtils.getPrettyXml(l.getGraphXml()),!0),n.editor.modified=!1):(n.editor.setStatus("...Error publishing! Please check the project and try again!"),setTimeout(function(){n.editor.setStatus("")},3e3))},CRUD_PERMISSIONS.canEdit,null,"Ctrl+Shift+P"),this.addAction("variable",function(){n.projectDesignController.newVariable()},CRUD_PERMISSIONS.canEdit),this.addAction("import",function(){n.projectDesignController.importXML(function(e){l.setGraphXml(mxUtils.parseXml(e).documentElement)})},CRUD_PERMISSIONS.canEdit),this.addAction("export",function(){n.exportXML(mxUtils.getPrettyXml(l.getGraphXml()))},null,null,"Ctrl+E"),this.addAction("editFile",function(){n.projectDesignController.editXML(mxUtils.getPrettyXml(l.getGraphXml()),function(e){l.setGraphXml(mxUtils.parseXml(e).documentElement)})},CRUD_PERMISSIONS.canEdit),this.addAction("print",function(){mxUtils.printScreen(d)},null,"sprite-print","Ctrl+P"),this.addAction("preview",function(){mxUtils.show(d,null,10,10)}),this.addAction("undo",function(){l.undoManager.undo()},null,"sprite-undo","Ctrl+Z"),this.addAction("redo",function(){l.undoManager.redo()},null,"sprite-redo","Ctrl+Y"),this.addAction("cut",function(){mxClipboard.cut(d)},null,"sprite-cut","Ctrl+X"),this.addAction("copy",function(){mxClipboard.copy(d)},null,"sprite-copy","Ctrl+C"),this.addAction("paste",function(){mxClipboard.paste(d)},!1,"sprite-paste","Ctrl+V"),this.addAction("delete",function(){d.removeCells()},null,null,"Delete"),this.addAction("duplicate",function(){var e=d.gridSize;d.setSelectionCells(d.moveCells(d.getSelectionCells(),e,e,!0))},null,null,"Ctrl+D"),this.addAction("selectVertices",function(){d.selectVertices()},null,null,"Ctrl+Shift+V"),this.addAction("selectEdges",function(){d.selectEdges()},null,null,"Ctrl+Shift+E"),this.addAction("selectAll",function(){d.selectAll()},null,null,"Ctrl+A"),this.addAction("home",function(){d.home()},null,null,"Home"),this.addAction("exitGroup",function(){d.exitGroup()},null,null,"Page Up"),this.addAction("enterGroup",function(){d.enterGroup()},null,null,"Page Down"),this.addAction("expand",function(){d.foldCells(!1)},null,null,"Enter"),this.addAction("collapse",function(){d.foldCells(!0)},null,null,"Backspace"),this.addAction("toFront",function(){d.orderCells(!1)},null,null,"Ctrl+F"),this.addAction("toBack",function(){d.orderCells(!0)},null,null,"Ctrl+B"),this.addAction("group",function(){d.setSelectionCell(d.groupCells(null,0))},null,null,"Ctrl+G"),this.addAction("ungroup",function(){d.setSelectionCells(d.ungroupCells())},null,null,"Ctrl+U"),this.addAction("removeFromGroup",function(){d.removeCellsFromParent()}),this.addAction("editLink",function(){var e=d.getSelectionCell(),n=d.getLinkForCell(e);null==n&&(n=""),null!=(n=mxUtils.prompt(mxResources.get("enterValue"),n))&&d.setLinkForCell(e,n)}),this.addAction("openLink",function(){var e=d.getSelectionCell(),n=d.getLinkForCell(e);null!=n&&window.open(n)}),this.addAction("autosize",function(){var e=d.getSelectionCells();if(null!=e){d.getModel().beginUpdate();try{for(var n=0;n<e.length;n++){var t=e[n];d.getModel().getChildCount(t)?d.updateGroupBounds([t],20):d.updateCellSize(t)}}finally{d.getModel().endUpdate()}}}),this.addAction("wordWrap",function(){var e=d.getView().getState(d.getSelectionCell()),n="wrap";null!=e&&"wrap"==e.style[mxConstants.STYLE_WHITE_SPACE]&&(n=null),d.setCellStyles(mxConstants.STYLE_WHITE_SPACE,n)}),this.addAction("rotation",function(){var e="0",n=d.getView().getState(d.getSelectionCell());null!=n&&(e=n.style[mxConstants.STYLE_ROTATION]||e),null!=(e=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("rotation")+" 0-360)",e))&&d.setCellStyles(mxConstants.STYLE_ROTATION,e)}),this.addAction("tilt",function(){var e=d.getSelectionCells();if(null!=e){d.getModel().beginUpdate();try{for(var n=0;n<e.length;n++){var t=e[n];if(d.getModel().isVertex(t)&&0==d.getModel().getChildCount(t)){var a=d.getCellGeometry(t);if(null!=a){(a=a.clone()).x+=a.width/2-a.height/2,a.y+=a.height/2-a.width/2;var i=a.width;a.width=a.height,a.height=i,d.getModel().setGeometry(t,a);var s=d.view.getState(t);if(null!=s){var o=s.style[mxConstants.STYLE_DIRECTION]||"east";"east"==o?o="south":"south"==o?o="west":"west"==o?o="north":"north"==o&&(o="east"),d.setCellStyles(mxConstants.STYLE_DIRECTION,o,[t])}}}}}finally{d.getModel().endUpdate()}}},null,null,"Ctrl+R"),this.addAction("actualSize",function(){d.zoomTo(1)}),this.addAction("zoomIn",function(){d.zoomIn()},null,null,"Add"),this.addAction("zoomOut",function(){d.zoomOut()},null,null,"Subtract"),this.addAction("fitWindow",function(){d.fit()}),this.addAction("fitPage",mxUtils.bind(this,function(){d.pageVisible||this.get("pageView").funct();var e=d.pageFormat,n=d.pageScale,t=d.container.clientWidth-20,a=d.container.clientHeight-20,i=Math.floor(100*Math.min(t/e.width/n,a/e.height/n))/100;d.zoomTo(i),d.container.scrollLeft=Math.round(d.view.translate.x*i-Math.max(10,(d.container.clientWidth-e.width*n*i)/2)),d.container.scrollTop=Math.round(d.view.translate.y*i-Math.max(10,(d.container.clientHeight-e.height*n*i)/2))})),this.addAction("fitPageWidth",mxUtils.bind(this,function(){d.pageVisible||this.get("pageView").funct();var e=d.pageFormat,n=d.pageScale,t=d.container.clientWidth-20,a=Math.floor(100*t/e.width/n)/100;d.zoomTo(a),d.container.scrollLeft=Math.round(d.view.translate.x*a-Math.max(10,(d.container.clientWidth-e.width*n*a)/2)),d.container.scrollTop=Math.round(d.view.translate.y*a-Math.max(10,(d.container.clientHeight-e.height*n*a)/2))})),this.put("customZoom",new Action(mxResources.get("custom"),function(){var e=mxUtils.prompt(mxResources.get("enterValue")+" (%)",parseInt(100*d.getView().getScale()));null!=e&&0<e.length&&!isNaN(parseInt(e))&&d.zoomTo(parseInt(e)/100)}));var e=null;(e=this.addAction("grid",function(){d.setGridEnabled(!d.isGridEnabled()),l.updateGraphComponents()},null,null,"Ctrl+Shift+G")).setToggleAction(!0),e.setSelectedCallback(function(){return d.isGridEnabled()}),(e=this.addAction("guides",function(){d.graphHandler.guidesEnabled=!d.graphHandler.guidesEnabled})).setToggleAction(!0),e.setSelectedCallback(function(){return d.graphHandler.guidesEnabled}),(e=this.addAction("tooltips",function(){d.tooltipHandler.setEnabled(!d.tooltipHandler.isEnabled())})).setToggleAction(!0),e.setSelectedCallback(function(){return d.tooltipHandler.isEnabled()}),(e=this.addAction("navigation",function(){d.foldingEnabled=!d.foldingEnabled,d.view.revalidate()})).setToggleAction(!0),e.setSelectedCallback(function(){return d.foldingEnabled}),(e=this.addAction("scrollbars",function(){if(d.scrollbars=!d.scrollbars,l.updateGraphComponents(),d.scrollbars){var e=d.view.translate.x,n=d.view.translate.y;d.view.translate.x=0,d.view.translate.y=0,d.sizeDidChange(),d.container.scrollLeft-=Math.round(e*d.view.scale),d.container.scrollTop-=Math.round(n*d.view.scale)}else{var t=d.view.translate;d.view.setTranslate(t.x-d.container.scrollLeft/d.view.scale,t.y-d.container.scrollTop/d.view.scale),d.container.scrollLeft=0,d.container.scrollTop=0,d.sizeDidChange()}},!mxClient.IS_TOUCH)).setToggleAction(!0),e.setSelectedCallback(function(){return"auto"==d.container.style.overflow}),(e=this.addAction("pageView",mxUtils.bind(this,function(){d.pageVisible=!d.pageVisible,d.pageBreaksVisible=d.pageVisible,d.preferPageSize=d.pageBreaksVisible,d.view.validate(),d.sizeDidChange(),l.updateGraphComponents(),l.outline.update(),mxUtils.hasScrollbars(d.container)&&(d.pageVisible?(d.container.scrollLeft-=20,d.container.scrollTop-=20):(d.container.scrollLeft+=20,d.container.scrollTop+=20))}))).setToggleAction(!0),e.setSelectedCallback(function(){return d.pageVisible}),(e=this.addAction("connect",function(){d.setConnectable(!d.connectionHandler.isEnabled())},null,null,"Ctrl+Q")).setToggleAction(!0),e.setSelectedCallback(function(){return d.connectionHandler.isEnabled()}),(e=this.addAction("copyConnect",function(){d.connectionHandler.setCreateTarget(!d.connectionHandler.isCreateTarget())})).setToggleAction(!0),e.setSelectedCallback(function(){return d.connectionHandler.isCreateTarget()}),this.addAction("help",function(){window.open("https://wiki.xcallymotion.com/display/XMV/Cally+Square")}),this.put("about",new Action(mxResources.get("about")+" Cally Square",function(){window.open("http://callysquare.com/")},null,null,null));var t=mxUtils.bind(this,function(e,n){this.addAction(e,function(){d.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,n)})});t("bold",mxConstants.FONT_BOLD),t("italic",mxConstants.FONT_ITALIC),t("underline",mxConstants.FONT_UNDERLINE),this.addAction("shadow",function(){d.toggleCellStyles(mxConstants.STYLE_SHADOW)}),this.addAction("dashed",function(){d.toggleCellStyles(mxConstants.STYLE_DASHED)}),this.addAction("rounded",function(){d.toggleCellStyles(mxConstants.STYLE_ROUNDED)}),this.addAction("curved",function(){d.toggleCellStyles(mxConstants.STYLE_CURVED)}),this.addAction("style",function(){var e=d.getSelectionCells();if(null!=e&&0<e.length){var n=d.getModel(),t=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("style")+")",n.getStyle(e[0])||"");null!=t&&d.setCellStyle(t,e)}}),this.addAction("setAsDefaultEdge",function(){d.setDefaultEdge(d.getSelectionCell())}),this.addAction("addWaypoint",function(){var e=d.getSelectionCell();if(null!=e&&d.getModel().isEdge(e)){var n=l.graph.selectionCellsHandler.getHandler(e);if(n instanceof mxEdgeHandler){var t=d.view.translate,a=d.view.scale,i=t.x,s=t.y,o=d.getModel().getParent(e),r=d.getCellGeometry(o);d.getModel().isVertex(o)&&null!=r&&(i+=r.x,s+=r.y),n.addPointAt(n.state,d.panningHandler.triggerX/a-i,d.panningHandler.triggerY/a-s)}}}),this.addAction("removeWaypoint",function(){var e=n.actions.get("removeWaypoint");null!=e.handler&&e.handler.removePoint(e.handler.state,e.index)}),this.addAction("image",function(){var e="",n=d.getView().getState(d.getSelectionCell());if(null!=n&&(e=n.style[mxConstants.STYLE_IMAGE]||e),null!=(e=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("url")+")",e))&&0<e.length){var t=new Image;t.onload=function(){!function(e,n,t){var a=null,i=d.getSelectionCells();d.getModel().beginUpdate();try{if(0==i.length){var s=d.getGridSize();a=i=[d.insertVertex(d.getDefaultParent(),null,"",s,s,n,t)]}if(d.setCellStyles(mxConstants.STYLE_IMAGE,e,i),d.setCellStyles(mxConstants.STYLE_SHAPE,"image",i),1==d.getSelectionCount()&&null!=n&&null!=t){var o=i[0],r=d.getModel().getGeometry(o);null!=r&&((r=r.clone()).width=n,r.height=t,d.getModel().setGeometry(o,r))}}finally{d.getModel().endUpdate()}null!=a&&(d.setSelectionCells(a),d.scrollCellToVisible(a[0]))}(e,t.width,t.height)},t.onerror=function(){mxUtils.alert(mxResources.get("fileNotFound"))},t.src=e}})},Actions.prototype.addAction=function(e,n,t,a,i){return this.put(e,new Action(mxResources.get(e),n,t,a,i))},Actions.prototype.put=function(e,n){return this.actions[e]=n},Actions.prototype.get=function(e){return this.actions[e]},mxUtils.extend(Action,mxEventSource),Action.prototype.setEnabled=function(e){this.enabled!=e&&(this.enabled=e,this.fireEvent(new mxEventObject("stateChanged")))},Action.prototype.setToggleAction=function(e){this.toggleAction=e},Action.prototype.setSelectedCallback=function(e){this.selectedCallback=e},Action.prototype.isSelected=function(){return this.selectedCallback()},Menus=function(e){this.editorUi=e,this.menus=new Object,this.init(),(new Image).src=IMAGE_PATH+"/checkmark.gif"},Menus.prototype.init=function(){var i=this.editorUi.editor.graph;this.put("fontFamily",new Menu(mxUtils.bind(this,function(e,n){for(var t=["Helvetica","Verdana","Times New Roman","Garamond","Comic Sans MS","Courier New","Georgia","Lucida Console","Tahoma"],a=0;a<t.length;a++){this.styleChange(e,t[a],[mxConstants.STYLE_FONTFAMILY],[t[a]],null,n).firstChild.nextSibling.style.fontFamily=t[a]}e.addSeparator(n),this.promptChange(e,mxResources.get("custom"),"",mxConstants.DEFAULT_FONTFAMILY,mxConstants.STYLE_FONTFAMILY,n)}))),this.put("fontSize",new Menu(mxUtils.bind(this,function(e,n){for(var t=[6,8,9,10,11,12,14,18,24,36,48,72],a=0;a<t.length;a++)this.styleChange(e,t[a],[mxConstants.STYLE_FONTSIZE],[t[a]],null,n);e.addSeparator(n),this.promptChange(e,mxResources.get("custom"),"(pt)","12",mxConstants.STYLE_FONTSIZE,n)}))),this.put("linewidth",new Menu(mxUtils.bind(this,function(e,n){for(var t=[1,2,3,4,8,12,16,24],a=0;a<t.length;a++)this.styleChange(e,t[a]+"px",[mxConstants.STYLE_STROKEWIDTH],[t[a]],null,n);e.addSeparator(n),this.promptChange(e,mxResources.get("custom"),"(px)","1",mxConstants.STYLE_STROKEWIDTH,n)}))),this.put("line",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("straight"),[mxConstants.STYLE_EDGE],[null],null,n),this.styleChange(e,mxResources.get("entityRelation"),[mxConstants.STYLE_EDGE],["entityRelationEdgeStyle"],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("horizontal"),[mxConstants.STYLE_EDGE,mxConstants.STYLE_ELBOW],["elbowEdgeStyle","horizontal"],null,n),this.styleChange(e,mxResources.get("vertical"),[mxConstants.STYLE_EDGE,mxConstants.STYLE_ELBOW],["elbowEdgeStyle","vertical"],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("manual"),[mxConstants.STYLE_EDGE],["segmentEdgeStyle"],null,n),this.styleChange(e,mxResources.get("automatic"),[mxConstants.STYLE_EDGE],["orthogonalEdgeStyle"],null,n)}))),this.put("lineend",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("classic"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_CLASSIC],null,n),this.styleChange(e,mxResources.get("openArrow"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_OPEN],null,n),this.styleChange(e,mxResources.get("block"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_BLOCK],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("oval"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_OVAL],null,n),this.styleChange(e,mxResources.get("diamond"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_DIAMOND],null,n),this.styleChange(e,mxResources.get("diamondThin"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_DIAMOND_THIN],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("none"),[mxConstants.STYLE_ENDARROW],[mxConstants.NONE],null,n),e.addSeparator(n),e.addItem(mxResources.get("transparent"),null,function(){i.toggleCellStyles("endFill",!0)},n,null,!0),e.addSeparator(n),this.promptChange(e,mxResources.get("size"),"(px)",mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_ENDSIZE,n)}))),this.put("linestart",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("classic"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_CLASSIC],null,n),this.styleChange(e,mxResources.get("openArrow"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_OPEN],null,n),this.styleChange(e,mxResources.get("block"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_BLOCK],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("oval"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_OVAL],null,n),this.styleChange(e,mxResources.get("diamond"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_DIAMOND],null,n),this.styleChange(e,mxResources.get("diamondThin"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_DIAMOND_THIN],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("none"),[mxConstants.STYLE_STARTARROW],[mxConstants.NONE],null,n),e.addSeparator(n),e.addItem(mxResources.get("transparent"),null,function(){i.toggleCellStyles("startFill",!0)},n,null,!0),e.addSeparator(n),this.promptChange(e,mxResources.get("size"),"(px)",mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_STARTSIZE,n)}))),this.put("spacing",new Menu(mxUtils.bind(this,function(e,n){var t=this.editorUi.actions.get("shadow").enabled,a=this.get("line").enabled;(t||e.showDisabled)&&(this.promptChange(e,mxResources.get("top"),"(px)","0",mxConstants.STYLE_SPACING_TOP,n,t),this.promptChange(e,mxResources.get("right"),"(px)","0",mxConstants.STYLE_SPACING_RIGHT,n,t),this.promptChange(e,mxResources.get("bottom"),"(px)","0",mxConstants.STYLE_SPACING_BOTTOM,n,t),this.promptChange(e,mxResources.get("left"),"(px)","0",mxConstants.STYLE_SPACING_LEFT,n,t),e.addSeparator(n),this.promptChange(e,mxResources.get("global"),"(px)","0",mxConstants.STYLE_SPACING,n,t),this.promptChange(e,mxResources.get("perimeter"),"(px)","0",mxConstants.STYLE_PERIMETER_SPACING,n,t)),(a||e.showDisabled)&&(e.addSeparator(n),this.promptChange(e,mxResources.get("sourceSpacing"),"(px)","0",mxConstants.STYLE_SOURCE_PERIMETER_SPACING,n,a),this.promptChange(e,mxResources.get("targetSpacing"),"(px)","0",mxConstants.STYLE_TARGET_PERIMETER_SPACING,n,a))}))),this.put("format",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItem(e,"style",n)}))),this.put("text",new Menu(mxUtils.bind(this,function(e,n){var t=this.get("text").enabled;e.addSeparator(n),this.addSubmenu("fontFamily",e,n),this.addSubmenu("fontSize",e,n),this.addMenuItems(e,["-","bold","italic","underline","-"],n),this.addSubmenu("alignment",e,n),this.addMenuItem(e,"wordWrap",n),e.addSeparator(n),this.promptChange(e,mxResources.get("textOpacity"),"(%)","100",mxConstants.STYLE_TEXT_OPACITY,n,t),e.addItem(mxResources.get("hide"),null,function(){i.toggleCellStyles(mxConstants.STYLE_NOLABEL,!1)},n,null,t)}))),this.put("alignment",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("leftAlign"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_LEFT],null,n),this.styleChange(e,mxResources.get("center"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_CENTER],null,n),this.styleChange(e,mxResources.get("rightAlign"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_RIGHT],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("topAlign"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_TOP],null,n),this.styleChange(e,mxResources.get("middle"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_MIDDLE],null,n),this.styleChange(e,mxResources.get("bottomAlign"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_BOTTOM],null,n),e.addSeparator(n),this.addSubmenu("position",e,n),this.addSubmenu("spacing",e,n),e.addSeparator(n);var t=this.get("text").enabled;e.addItem(mxResources.get("vertical"),null,function(){i.toggleCellStyles(mxConstants.STYLE_HORIZONTAL,!0)},n,null,t)}))),this.put("position",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("left"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_LEFT,mxConstants.ALIGN_RIGHT],null,n),this.styleChange(e,mxResources.get("center"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_CENTER,mxConstants.ALIGN_CENTER],null,n),this.styleChange(e,mxResources.get("right"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_RIGHT,mxConstants.ALIGN_LEFT],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("top"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_TOP,mxConstants.ALIGN_BOTTOM],null,n),this.styleChange(e,mxResources.get("middle"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_MIDDLE,mxConstants.ALIGN_MIDDLE],null,n),this.styleChange(e,mxResources.get("bottom"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_BOTTOM,mxConstants.ALIGN_TOP],null,n)}))),this.put("direction",new Menu(mxUtils.bind(this,function(e,n){e.addItem(mxResources.get("flipH"),null,function(){i.toggleCellStyles(mxConstants.STYLE_FLIPH,!1)},n),e.addItem(mxResources.get("flipV"),null,function(){i.toggleCellStyles(mxConstants.STYLE_FLIPV,!1)},n),this.addMenuItems(e,["-","tilt","rotation"],n)}))),this.put("align",new Menu(mxUtils.bind(this,function(e,n){e.addItem(mxResources.get("leftAlign"),null,function(){i.alignCells(mxConstants.ALIGN_LEFT)},n),e.addItem(mxResources.get("center"),null,function(){i.alignCells(mxConstants.ALIGN_CENTER)},n),e.addItem(mxResources.get("rightAlign"),null,function(){i.alignCells(mxConstants.ALIGN_RIGHT)},n),e.addSeparator(n),e.addItem(mxResources.get("topAlign"),null,function(){i.alignCells(mxConstants.ALIGN_TOP)},n),e.addItem(mxResources.get("middle"),null,function(){i.alignCells(mxConstants.ALIGN_MIDDLE)},n),e.addItem(mxResources.get("bottomAlign"),null,function(){i.alignCells(mxConstants.ALIGN_BOTTOM)},n)}))),this.put("layout",new Menu(mxUtils.bind(this,function(e,n){e.addItem(mxResources.get("horizontalFlow"),null,mxUtils.bind(this,function(){var e=new mxHierarchicalLayout(i,mxConstants.DIRECTION_WEST);this.editorUi.executeLayout(e,!0,!0)}),n),e.addItem(mxResources.get("verticalFlow"),null,mxUtils.bind(this,function(){var e=new mxHierarchicalLayout(i,mxConstants.DIRECTION_NORTH);this.editorUi.executeLayout(e,!0,!0)}),n)}))),this.put("navigation",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["home","-","exitGroup","enterGroup","-","expand","collapse"],n)}))),this.put("arrange",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["toFront","toBack","-"],n),this.addSubmenu("layout",e,n),e.addSeparator(n),this.addMenuItems(e,["-","group","ungroup","removeFromGroup"],n)}))),this.put("view",new Menu(mxUtils.bind(this,function(n,t){this.addMenuItems(n,["actualSize"],t),n.addSeparator();for(var e=[.25,.5,.75,1,2,4],a=0;a<e.length;a++)!function(e){n.addItem(100*e+"%",null,function(){i.zoomTo(e)},t)}(e[a]);this.addMenuItems(n,["-","zoomIn","zoomOut","-","fitWindow","customZoom","-","fitPage","fitPageWidth"],t)}))),this.put("file",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["new","open","-","save","saveAs","publish","-","variable","-","import","export","-","editFile","description","-","print"],n)}))),this.put("edit",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["undo","redo","-","cut","copy","paste","delete","-","duplicate","-","selectVertices","selectEdges","selectAll"])}))),this.put("help",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["help","-","about"])})))},Menus.prototype.put=function(e,n){this.menus[e]=n},Menus.prototype.get=function(e){return this.menus[e]},Menus.prototype.addSubmenu=function(e,n,t){var a=this.get(e).enabled;if(n.showDisabled||a){var i=n.addItem(mxResources.get(e),null,null,t,null,a);this.addMenu(e,n,i)}},Menus.prototype.addMenu=function(e,n,t){var a=this.get(e);null!=a&&(n.showDisabled||a.enabled)&&this.get(e).execute(n,t)},Menus.prototype.styleChange=function(e,n,t,a,i,s){return e.addItem(n,null,mxUtils.bind(this,function(){var e=this.editorUi.editor.graph;e.getModel().beginUpdate();try{for(var n=0;n<t.length;n++)e.setCellStyles(t[n],a[n])}finally{e.getModel().endUpdate()}}),s,i)},Menus.prototype.promptChange=function(e,n,a,i,s,t,o){return e.addItem(n,null,mxUtils.bind(this,function(){var e=this.editorUi.editor.graph,n=i,t=e.getView().getState(e.getSelectionCell());null!=t&&(n=t.style[s]||n),null!=(n=mxUtils.prompt(mxResources.get("enterValue")+(0<a.length?" "+a:""),n))&&0<n.length&&e.setCellStyles(s,n)}),t,null,o)},Menus.prototype.addMenuItem=function(e,n,t){var a=this.editorUi.actions.get(n);if(null==a||!e.showDisabled&&!a.enabled)return null;var i=e.addItem(a.label,null,a.funct,t,null,a.enabled);return a.toggleAction&&a.isSelected()&&this.addCheckmark(i),this.addShortcut(i,a),i},Menus.prototype.addShortcut=function(e,n){if(null!=n.shortcut){var t=e.firstChild.nextSibling.nextSibling,a=document.createElement("span");a.style.color="gray",mxUtils.write(a,n.shortcut),t.appendChild(a)}},Menus.prototype.addCheckmark=function(e){var n=e.firstChild.nextSibling;n.style.backgroundImage="url("+IMAGE_PATH+"/checkmark.gif)",n.style.backgroundRepeat="no-repeat",n.style.backgroundPosition="2px 50%"},Menus.prototype.addMenuItems=function(e,n,t){for(var a=0;a<n.length;a++)"-"==n[a]?e.addSeparator(t):this.addMenuItem(e,n[a],t)},Menus.prototype.createPopupMenu=function(e,n,t){var a=this.editorUi.editor.graph;if(e.smartSeparators=!0,a.isSelectionEmpty()?this.addMenuItems(e,["undo","redo","-","paste","-"]):(this.addMenuItems(e,["delete","-","cut","copy","-","duplicate"]),1==a.getSelectionCount()&&a.getModel().isEdge(a.getSelectionCell())&&this.addMenuItems(e,["setAsDefaultEdge"]),e.addSeparator()),0<a.getSelectionCount()){if(this.addMenuItems(e,["toFront","toBack","-"]),a.getModel().isEdge(a.getSelectionCell())){var i=!1;if(null!=(n=a.getSelectionCell())&&a.getModel().isEdge(n)){var s=a.selectionCellsHandler.getHandler(n);if(s instanceof mxEdgeHandler&&null!=s.bends&&2<s.bends.length){var o=s.getHandleForEvent(new mxMouseEvent(t)),r=this.editorUi.actions.get("removeWaypoint");r.handler=s,i=0<(r.index=o)&&o<s.bends.length}}this.addMenuItems(e,["-",i?"removeWaypoint":"addWaypoint"])}else 1<a.getSelectionCount()&&(e.addSeparator(),this.addMenuItems(e,["group"]));if(e.addSeparator(),1==a.getSelectionCount())null!=a.getLinkForCell(a.getSelectionCell())&&this.addMenuItems(e,["openLink"])}else this.addMenuItems(e,["-","selectVertices","selectEdges","-","selectAll"])},Menus.prototype.createMenubar=function(e){var n=new Menubar(this.editorUi,e),t=[];t=CRUD_PERMISSIONS.canEdit?["file","edit","view","format","text","arrange","help"]:["file","view","help"];for(var a=0;a<t.length;a++)n.addMenu(mxResources.get(t[a]),this.get(t[a]).funct);return n},Menubar.prototype.hideMenu=function(){null!=this.currentMenu&&this.currentMenu.hideMenu()},Menubar.prototype.addMenu=function(e,n){var t=document.createElement("a");return t.setAttribute("href","javascript:void(0);"),t.className="geItem",mxUtils.write(t,e),this.addMenuHandler(t,n),this.container.appendChild(t),t},Menubar.prototype.getOffset=function(e){return{left:(e=e.getBoundingClientRect()).left+window.scrollX,top:e.top+window.scrollY}},Menubar.prototype.addMenuHandler=function(i,s){if(null!=s){var o=!0,n=mxUtils.bind(this,function(e){if(o&&null==i.enabled||i.enabled){this.editorUi.editor.graph.panningHandler.hideMenu();var n=new mxPopupMenu(s);n.div.className+=" geMenubarMenu",n.smartSeparators=!0,n.showDisabled=!0,n.autoExpand=!0,n.hideMenu=mxUtils.bind(this,function(){mxPopupMenu.prototype.hideMenu.apply(n,arguments),n.destroy(),this.currentMenu=null,this.currentElt=null});var t=this.getOffset(i).left,a=this.getOffset(i).top+i.offsetHeight;n.popup(t,a,null,e),this.currentMenu=n,this.currentElt=i}o=!0,mxEvent.consume(e)});mxEvent.addListener(i,"mousemove",mxUtils.bind(this,function(e){null!=this.currentMenu&&this.currentElt!=i&&(this.hideMenu(),n(e))})),mxEvent.addListener(i,"mousedown",mxUtils.bind(this,function(){o=this.currentElt!=i})),mxEvent.addListener(i,"click",n)}},mxUtils.extend(Menu,mxEventSource),Menu.prototype.setEnabled=function(e){this.enabled!=e&&(this.enabled=e,this.fireEvent(new mxEventObject("stateChanged")))},Menu.prototype.execute=function(e,n){this.funct(e,n)},Toolbar.prototype.init=function(){CRUD_PERMISSIONS.canEdit?this.addItems(["save","publish","-","print","undo","redo","-","copy","cut","paste","delete","-","duplicate","-","actualSize","zoomIn","zoomOut","-"]):this.addItems(["print","actualSize","zoomIn","zoomOut","-"])},Toolbar.prototype.hideMenu=function(){null!=this.currentMenu&&(this.currentMenu.hideMenu(),this.currentMenu.destroy(),this.currentMenu=null)},Toolbar.prototype.addMenu=function(e,n,t,a){var i=this.editorUi.menus.get(a),s=this.addMenuFunction(e,n,t,i.funct);return i.addListener("stateChanged",function(){s.setEnabled(i.enabled)}),s},Toolbar.prototype.addMenuFunction=function(e,n,t,a){var i=t?this.createLabel(e):this.createButton(e);return this.initElement(i,n),this.addMenuHandler(i,t,a),this.container.appendChild(i),i},Toolbar.prototype.addSeparator=function(){var e=document.createElement("div");return e.className="geSeparator",this.container.appendChild(e),e},Toolbar.prototype.addItems=function(e){for(var n=0;n<e.length;n++){var t=e[n];"-"==t?this.addSeparator():this.addItem("geSprite-"+t.toLowerCase(),t)}},Toolbar.prototype.addItem=function(e,n){var t=this.editorUi.actions.get(n),a=null;return null!=t&&((a=this.addButton(e,t.label,t.funct)).setEnabled(t.enabled),t.addListener("stateChanged",function(){a.setEnabled(t.enabled)})),a},Toolbar.prototype.addButton=function(e,n,t){var a=this.createButton(e);return this.initElement(a,n),this.addClickHandler(a,t),this.container.appendChild(a),a},Toolbar.prototype.addSelectionHandler=function(t){var a=this.editorUi.editor.graph,e=function(){for(var e=!a.isSelectionEmpty(),n=0;n<t.length;n++)t[n].setEnabled(e)};a.getSelectionModel().addListener(mxEvent.CHANGE,e),e()},Toolbar.prototype.addEdgeSelectionHandler=function(a){var i=this.editorUi.editor.graph,e=function(){var e=!1;if(!i.isSelectionEmpty())for(var n=i.getSelectionCells(),t=0;t<n.length;t++)if(i.getModel().isEdge(n[t])){e=!0;break}for(t=0;t<a.length;t++)a[t].setEnabled(e)};i.getSelectionModel().addListener(mxEvent.CHANGE,e),e()},Toolbar.prototype.initElement=function(e,n){e.setAttribute("tabindex","0"),null!=n&&e.setAttribute("title",n),this.addEnabledState(e)},Toolbar.prototype.addEnabledState=function(n){var t=n.className;n.setEnabled=function(e){n.enabled=e,n.className=e?t:t+" geDisabled"},n.setEnabled(!0)},Toolbar.prototype.addClickHandler=function(n,t){null!=t&&mxEvent.addListener(n,"click",function(e){n.enabled&&t(e),mxEvent.consume(e)})},Toolbar.prototype.createButton=function(e){var n=document.createElement("a");n.setAttribute("href","javascript:void(0);"),n.className="geButton";var t=document.createElement("div");return t.className="geSprite "+e,n.appendChild(t),n},Toolbar.prototype.createLabel=function(e,n){var t=document.createElement("a");return t.setAttribute("href","javascript:void(0);"),t.className="geLabel",mxUtils.write(t,e),t},Toolbar.prototype.addMenuHandler=function(n,t,a,i){if(null!=a){var s=this.editorUi.editor.graph,o=null;mxEvent.addListener(n,"click",mxUtils.bind(this,function(e){(null==n.enabled||n.enabled)&&(s.panningHandler.hideMenu(),(o=new mxPopupMenu(a)).div.className+=" geToolbarMenu",o.showDisabled=i,o.labels=t,o.autoExpand=!0,o.popup(n.offsetLeft,n.offsetTop+n.offsetHeight+34,null,e),this.currentMenu=o),mxEvent.consume(e)}))}},Dialog.prototype.close=function(){null!=this.onDialogClose&&(this.onDialogClose(),this.onDialogClose=null),this.container.parentNode.removeChild(this.container),this.bg.parentNode.removeChild(this.bg)},angular.module("motion").run(["$templateCache",function(e){"use strict";e.put("app/auth/services/hotdesk/dialog.html",'<md-dialog aria-label="Telephone">\n  <form ng-cloak>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="LOGIN.TELEPHONES">Telephones</span>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <md-select ng-model="vm.name" placeholder="Select a telephone">\n        <md-option value="{{telephone.name}}" ng-repeat="telephone in vm.telephones.rows">{{telephone.fullname}}</md-option>\n      </md-select>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button ng-click="vm.closeDialog(vm.name)" class="send-button md-accent md-raised" aria-label="call" ng-disabled="!vm.name">\n        <span translate="LOGIN.SELECT">SELECT</span>\n      </md-button>\n      \x3c!-- <md-button ng-click="vm.closeDialog()" class="send-button md-accent md-raised" aria-label="cancel">\n                <span translate="LOGIN.CANCEL">Cancel</span>\n            </md-button> --\x3e\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/core/dialogs/advanced-search/dialog.html",'<md-dialog class="advanced-search-dialog" aria-label="Advanced search" flex="70" ng-init="vm.onInit()">\n  <form ng-cloak>\n    <md-toolbar class="advanced-search-dialog-header" ng-class="{{ \'vm.toolbarColor\' }} + \'-bg\'">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="DASHBOARDS.ADVANCED_SEARCH"></span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.minimize()">\n            <md-icon class="no-margin" md-font-icon="icon-window-minimize" aria-label="Minimize dialog"></md-icon>\n          </md-button>\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.close()">\n            <md-icon class="no-margin" md-font-icon="icon-window-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <ms-advanced-search options="vm.searchOptions" clear-filter="vm.clearConditions()"></ms-advanced-search>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button class="md-primary md-raised" aria-label="Clear" ng-disabled="vm.searchOptions.conditions.length === 0" translate="DASHBOARDS.CLEAR" translate-attr-aria-label="DASHBOARDS.CLEAR" ng-click="vm.clearConditions()"></md-button>\n      <md-button class="md-primary md-accent md-raised" aria-label="Apply" ng-disabled="vm.searchOptions.conditions.length === 0" translate="DASHBOARDS.APPLY" translate-attr-aria-label="DASHBOARDS.APPLY" ng-click="vm.applyFilter()"></md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/core/directives/ms-advanced-search/ms-advanced-search.html",'<div layout="column" class="advanced-search-container" flex>\n  <div layout-margin>\n    <md-radio-group ng-model="vm.options.matchType" class="md-primary" layout="row">\n      <md-radio-button value="$and" class="md-primary">{{ \'DASHBOARDS.MEET_ALL_CONDITIONS\' | translate }}\n      </md-radio-button>\n      <md-radio-button value="$or">{{ \'DASHBOARDS.MEET_ANY_CONDITIONS\' | translate }}</md-radio-button>\n    </md-radio-group>\n  </div>\n\n  \x3c!-- ACTIVE CONDITIONS --\x3e\n  <div layout="row" ng-if="vm.options.conditions.length > 0" class="advanced-search-conditions">\n    <md-list>\n      <md-list-item>\n        <md-chips ng-model="vm.options.conditions" class="advanced-search-chips" readonly="true" md-removable="true" md-on-remove="vm.removeCondition()">\n          <md-chip-template ms-chip-color="{{ $chip.style }}">\n            <md-menu md-offset="50 0" ng-class="{\'no-click\': vm.pendingCondition}">\n              <span>\n                <p class="filter-text">{{ $chip.name }}</p>\n                <em ng-show="$chip.operator" class="text-lowercase">{{ $chip.operator }}</em>\n                <strong>{{ $chip.displayValue }}</strong>\n                <em ng-show="$chip.displayEndValue" class="text-lowercase">{{ \'DASHBOARDS.AND\' | translate }}</em>\n                <strong>{{ $chip.displayEndValue }}</strong>\n              </span>\n              <md-menu-content width=2 class="md-dense">\n                <md-menu-item ng-hide="$chip.disabled">\n                  <md-button ng-click="vm.editCondition($chip)">Edit\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.setConditionStatus($chip)">\n                    {{ $chip.disabled ? \'Enable\' : \'Disable\' }}\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </md-chip-template>\n          <button type="button" md-chip-remove class="md-primary remove-filter">\n            <md-icon md-font-icon="icon-cancel" aria-label="Remove Filter"></md-icon>\n          </button>\n        </md-chips>\n      </md-list-item>\n    </md-list>\n  </div>\n\n  \x3c!-- FILTERS --\x3e\n  <div layout="row">\n    <div layout="row" class="advanced-search-bar" layout-margin flex>\n      \x3c!-- FIELD --\x3e\n      <md-input-container flex="35">\n        <md-icon md-font-icon="icon-filter-variant"></md-icon>\n        <md-select class="font-size-12" ng-model="vm.selectedField" ng-change="vm.onFieldChange()" placeholder="{{ \'DASHBOARDS.SELECT_FIELD\' | translate }}" aria-label="Field">\n          <md-option ng-value="field" ng-repeat="field in vm.options.fields">{{ field.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- OPERATOR --\x3e\n      <md-input-container flex="30">\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-select class="font-size-12" ng-model="vm.selectedOperator" ng-change="vm.onOperatorChange(oldValue)" ng-focus="oldValue=vm.selectedOperator" md-selected-text="vm.selectedOperator ? (\'DASHBOARDS.\' + vm.selectedOperator.translate | translate) : (\'DASHBOARDS.SELECT_OPERATOR\' | translate)" ng-disabled="!vm.selectedField" aria-label="Operator">\n          <md-option ng-value="operator" ng-repeat="operator in vm.availableOperators" ng-selected="vm.autoSelectOperator">\n            <div layout="row" class="operators-list">\n              <span class="operator-symbol">\n                {{ operator.symbol }}\n              </span>\n              <span>\n                {{ \'DASHBOARDS.\' + operator.translate | translate }}\n              </span>\n            </div>\n          </md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TEXT INPUT --\x3e\n      <md-input-container ng-if="!vm.selectedField.type || vm.selectedField.type === \'text\'" class="no-errors" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <input type="text" aria-label="Value" ng-model="vm.value" ng-change="vm.onValueChange()" ng-disabled="!vm.selectedField" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}">\n      </md-input-container>\n      \x3c!-- NUMERIC INPUT --\x3e\n      <div ng-if="vm.selectedField.type === \'number\'" flex layout="row" layout-margin class="no-margin">\n        <md-input-container class="no-errors" flex>\n          <md-icon md-font-icon="icon-numeric"></md-icon>\n          <input type="number" aria-label="Value" ng-model="vm.value" ng-change="vm.onValueChange()" ng-disabled="!vm.selectedField" min="0" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ vm.selectedOperator.type === \'$between\' ? \'DASHBOARDS.STARTING_VALUE\' : \'DASHBOARDS.VALUE\' | translate }}">\n        </md-input-container>\n        <md-input-container class="no-errors" ng-if="vm.selectedOperator.type === \'$between\'" ng-class="{\'md-input-invalid\': !vm.isValidRange}" flex>\n          <md-icon md-font-icon=" icon-numeric">\n          </md-icon>\n          <input class="md-input" type="number" aria-label="Value" ng-model="vm.endRangeValue" ng-change="vm.checkRange()" ng-disabled="!vm.value" min="vm.value" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.ENDING_VALUE\' | translate }}">\n          <div ng-if="!vm.isValidRange" class="md-input-message-animation md-input-messages-animation">\n            {{ (\'DASHBOARDS.VALUE_RANGE_CHECK\' | translate) + \' \' + vm.value }}\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- SELECT --\x3e\n      <md-input-container ng-if="vm.selectedField.type === \'select\'" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-select class="font-size-12" ng-model="vm.value" md-on-open="vm.getValues()" ng-change="vm.onValueChange()" ng-model-options="{trackBy: \'$value.id\'}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}" aria-label="Value">\n          <md-option ng-value="item" ng-repeat="item in vm.selectedField.values">{{item.name}}\n          </md-option>\n        </md-select>\n      </md-input-container>\n      \x3c!-- MULTISELECT --\x3e\n      <md-input-container ng-if="vm.selectedField.type === \'multiselect\'" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-select class="font-size-12" multiple ng-model="vm.value" md-on-open="vm.getValues()" ng-change="vm.onValueChange()" ng-model-options="{trackBy: \'$value.id\'}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}" aria-label="Value">\n          <md-option ng-value="item" ng-repeat="item in vm.selectedField.values">{{item.name}}\n          </md-option>\n        </md-select>\n      </md-input-container>\n      \x3c!-- DATE INPUT --\x3e\n      <div ng-if="vm.selectedField.type === \'date\'" flex layout="row">\n        <mdp-date-picker mdp-open-on-click ng-model="vm.value" ng-change="vm.onValueChange()" mdp-max-date="vm.maxDateRange" mdp-placeholder="{{ vm.selectedOperator.type === \'$between\' ? \'DASHBOARDS.STARTING_DATE\' : \'DASHBOARDS.VALUE\' | translate }}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" flex>\n        </mdp-date-picker>\n        <mdp-date-picker mdp-open-on-click ng-if="vm.selectedOperator.type === \'$between\'" ng-change="vm.checkRange()" ng-model="vm.endRangeValue" mdp-min-date="vm.minDateRange" mdp-disabled="!vm.value" mdp-placeholder="{{ \'DASHBOARDS.ENDING_DATE\' | translate }}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" flex>\n        </mdp-date-picker>\n      </div>\n      \x3c!-- AUTOCOMPLETE --\x3e\n      <div layout="row" layout-align="start start" ng-if="vm.selectedField.type === \'autocomplete\' && vm.selectedOperator.type != \'$substring\'" class=" autocomplete-input" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-autocomplete md-selected-item="vm.value" md-selected-item-change="vm.onValueChange()" md-items="item in vm.getValues()" md-search-text="vm.searchText" md-item-text="item.displayValue" md-min-length="4" md-no-cache="true" md-floating-label="{{ \'DASHBOARDS.VALUE\' | translate }}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" flex>\n          <md-item-template>\n            <span md-highlight-text="vm.searchText" md-highlight-flags="i">{{item.displayValue}}</span>\n          </md-item-template>\n        </md-autocomplete>\n      </div>\n      <md-input-container ng-if="vm.selectedField.type === \'autocomplete\' && vm.selectedOperator.type === \'$substring\'" class="no-errors" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <input type="text" aria-label="Value" ng-model="vm.value" ng-change="vm.onValueChange()" ng-disabled="!vm.selectedField" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}">\n      </md-input-container>\n    </div>\n    <md-button class="md-fab md-mini md-primary mt-20" ng-if="!vm.pendingCondition" ng-disabled="!vm.isValidCondition" aria-label="Add filter" ng-click="vm.addCondition()" translate-attr-aria-label="DASHBOARDS.ADD">\n      <md-icon md-font-icon="icon-plus"></md-icon>\n    </md-button>\n    <md-button class="md-fab md-mini mt-20" ng-if="vm.pendingCondition" ng-disabled="!vm.isValidCondition" aria-label="Update filter" ng-click="vm.updateCondition()" translate-attr-aria-label="DASHBOARDS.UPDATE">\n      <md-icon md-font-icon="icon-check"></md-icon>\n    </md-button>\n    <md-button class="md-fab md-mini md-primary mt-20" ng-if="vm.pendingCondition" aria-label="Cancel filter update" ng-click="vm.cancelUpdateCondition()" translate-attr-aria-label="DASHBOARDS.CANCEL">\n      <md-icon md-font-icon="icon-close"></md-icon>\n    </md-button>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-1/template-1.html",'<div class="template-1">\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="content pv-24 ph-16">\n    <div class="title h1" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="subtitle secondary-text" ng-if="card.subtitle">\n      {{card.subtitle}}\n    </div>\n\n    <div class="text pt-16" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-10/template-10.html",'<div class="template-10 p-16">\n  <div class="pb-16" layout="row" layout-align="space-between center">\n    <div class="info">\n      <div class="title secondary-text" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle h2" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n    </div>\n\n    <div class="media ml-16">\n      <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n    </div>\n  </div>\n\n  <div class="text">\n    {{card.text}}\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-2/template-2.html",'<div class="template-2">\n  <div class="header p-16" layout="row" layout-align="start center">\n    <div ng-if="card.avatar">\n      <img class="avatar mr-16" ng-src="{{card.avatar.src}}" alt="{{card.avatar.alt}}">\n    </div>\n\n    <div class="info">\n      <div class="title" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n    </div>\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="text p-16" ng-if="card.text">\n    {{card.text}}\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-3/template-3.html",'<div class="template-3 p-16 teal-bg white-fg" layout="row" layout-align="space-between">\n  <div layout="column" layout-align="space-between">\n    <div class="info">\n      <div class="title h1" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle h3 secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n    </div>\n\n    <div class="cta">\n      <md-button class="m-0">{{card.cta}}</md-button>\n    </div>\n  </div>\n\n  <div class="media pl-16">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-4/template-4.html",'<div class="template-4">\n  <div class="info white-fg ph-16 pv-24">\n    <div class="title h1" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="text" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-5/template-5.html",'<div class="template-5 p-16" layout="row" layout-align="space-between start">\n  <div class="info">\n    <div class="title secondary-text" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="event h2" ng-if="card.event">\n      {{card.event}}\n    </div>\n  </div>\n\n  <div class="media ml-16">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-6/template-6.html",'<div class="template-6">\n  <div class="content pv-24 ph-16">\n    <div class="subtitle secondary-text" ng-if="card.subtitle">\n      {{card.subtitle}}\n    </div>\n\n    <div class="title h2" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="text pt-8" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-7/template-7.html",'<div class="template-7" layout="row" layout-align="space-between">\n  <div class="info" layout="column" layout-align="space-between" layout-fill flex>\n    <div class="p-16">\n      <div class="title h1" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle h4 secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n\n      <div class="text h4 pt-8" ng-if="card.text">\n        {{card.text}}\n      </div>\n    </div>\n\n    <div>\n      <md-divider></md-divider>\n      <div class="p-8" layout="row">\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n      </div>\n    </div>\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-8/template-8.html",'<div class="template-8">\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="content pv-24 ph-16">\n    <div class="title h1" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="subtitle secondary-text" ng-if="card.subtitle">\n      {{card.subtitle}}\n    </div>\n\n    <div class="buttons pt-16">\n      <md-button class="m-0">{{card.button1}}</md-button>\n      <md-button class="m-0 md-accent">{{card.button2}}</md-button>\n    </div>\n\n    <div class="text pt-16" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-9/template-9.html",'<div class="template-9">\n  <div class="header p-16" layout="row" layout-align="start center">\n    <div ng-if="card.avatar">\n      <img class="avatar mr-16" ng-src="{{card.avatar.src}}" alt="{{card.avatar.alt}}">\n    </div>\n\n    <div class="info">\n      <div class="title" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n\n    </div>\n  </div>\n\n  <div class="text ph-16 pb-16" ng-if="card.text">\n    {{card.text}}\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="buttons m-8">\n    <md-button class="md-icon-button mr-16" aria-label="Favorite">\n      <md-icon md-font-icon="icon-heart-outline" class="s24"></md-icon>\n    </md-button>\n    <md-button class="md-icon-button" aria-label="Share">\n      <md-icon md-font-icon="icon-share" class="s24"></md-icon>\n    </md-button>\n  </div>\n\n</div>'),e.put("app/core/directives/ms-click-to-call/ms-click-to-call.html",'<section ng-if="type !== \'button\'">\n  <span ng-if="!showMenu()" privacy="{{ privacy }}" ng-cloak>{{target}}</span>\n  <md-menu ng-if="showMenu()">\n    <a aria-label="Target" ng-click="$mdOpenMenu($event)">\n      <span ng-if="prefix" privacy="{{ privacy }}" ng-cloak>{{prefix}}-</span>\n      <span privacy="{{ privacy }}" ng-cloak>{{target}}</span>\n    </a>\n    <md-menu-content width="2">\n      <md-menu-item>\n        <md-button ng-click="call(prefix ? prefix + target : target)">\n          {{\'DASHBOARDS.CALL_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n      <md-menu-item>\n        <md-button ng-click="transfer(prefix ? prefix + target : target)">\n          {{\'DASHBOARDS.TRANSFER_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n    </md-menu-content>\n  </md-menu>\n</section>\n<section ng-if="type === \'button\'">\n  <md-button ng-if="!showMenu()" ng-disabled="true" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW CALL" aria-label="NEW CALL">\n    <md-icon md-font-icon="icon-phone"></md-icon>\n  </md-button>\n  <md-menu ng-if="showMenu()">\n    <md-button class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW CALL" ng-click="$mdOpenMenu($event)" aria-label="NEW CALL">\n      <md-icon md-font-icon="icon-phone"></md-icon>\n    </md-button>\n    <md-menu-content width="2">\n      <md-menu-item>\n        <md-button ng-click="call(prefix ? prefix + target : target)">\n          {{\'DASHBOARDS.CALL_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n      <md-menu-item>\n        <md-button ng-click="transfer(target)">\n          {{\'DASHBOARDS.TRANSFER_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n    </md-menu-content>\n  </md-menu>\n</section>'),e.put("app/core/directives/ms-client-side-logging/ms-client-side-logging-icon.html",'<md-icon ng-style="vm.styleColor" md-font-icon="{{ vm.styleIcon }}">\n  <md-tooltip class="client-side-logging-tooltip">\n    <span ng-bind-html="vm.tooltipHTML"></span>\n  </md-tooltip>\n</md-icon>'),e.put("app/core/directives/ms-client-side-logging/ms-client-side-logging.html",'<md-content layout="column">\n  <form name="clientSideLoggingSettingsForm">\n    <div flex layout="column" layout-align="stretch center">\n      <div ng-if="vm.user.userSetting.clientSideLoggingEnabled" class="md-amber-500-bg p-10" layout="row" layout-align="start center">\n        <span class="no-margin font-size-14 line-height-30" translate="STAFF.CLIENT_LOGS_ALL_ENABLED_WARNING" flex></span>\n      </div>\n      <md-input-container>\n        <md-switch ng-model="vm.user.userSetting.clientSideLoggingEnabled" aria-label="Manage client side logging" ng-change="vm.onEnabledSwitchChange()">\n          {{ vm.user.userSetting.clientSideLoggingEnabled ? \'STAFF.CLIENT_LOGS_ENABLED\' : \'STAFF.CLIENT_LOGS_DISABLED\' | translate }}\n        </md-switch>\n      </md-input-container>\n      <h2 ng-if="vm.user.userSetting.clientSideLoggingEnabled" class="md-subhead mt-0">{{ vm.clientSideLoggingEnabledSince }}</h2>\n    </div>\n    <div layout="column" layout-align="stretch center">\n      <md-input-container ng-if="vm.user.userSetting.clientSideLoggingEnabled">\n        <label>{{ \'STAFF.CLIENT_LOGS_LOGLEVEL_SELECT\' | translate }}</label>\n        <md-select ng-if="vm.user.userSetting.clientSideLoggingEnabled" ng-model="vm.user.userSetting.clientSideLoggingLevel" placeholder="Debugging level" ng-change="vm.onLogLevelSelectionChange()" flex="30">\n          <md-option ng-value="loggingLevel" ng-repeat="loggingLevel in vm.availableClientSideLoggingLevels">\n            <md-icon ng-style="vm.computeStyleForLoggingLevel(loggingLevel)" md-font-icon="{{ loggingLevel === \'info\' ? \'icon-checkbox-blank-circle-outline\' : \'icon-checkbox-blank-circle\' }}"></md-icon>\n            {{ loggingLevel }}\n          </md-option>\n        </md-select>\n      </md-input-container>\n    </div>\n  </form>\n</md-content>'),e.put("app/core/directives/ms-dual-multiselect/ms-dual-multiselect.html",'<div ng-cloak layout-gt-sm="row" layout="column">\n  <div flex-gt-sm="50" flex="45">\n    <md-input-container class="md-icon-float md-block margin-0">\n      <md-icon md-font-icon="icon-magnify" aria-label="swap"></md-icon>\n      <input ng-model="query" type="text" placeholder="{{ \'STAFF.PERMISSIONS_PLACEHOLDER_SEARCH\' | translate }}">\n    </md-input-container>\n    <md-content class="border h-300">\n      <md-list class="md-dense no-padding" layout-fill layout-align="center center">\n        <md-list-item class="md-3-line" ng-class="{\'read-only-mode\': vm.readOnly || vm.addDisabled}" ng-disabled="vm.readOnly || vm.addDisabled" ng-repeat="item in availableItems = (vm.options.items | filter: query) | orderBy: vm.options.orderBy" ng-click="vm.canTransfer(item, vm.options, false)">\n          <div class="md-list-item-text" layout="column">\n            <h3 ng-if="vm.options.line1">{{vm.getLine(item, vm.options.line1)}}</h3>\n            <h4 ng-if="vm.options.line2">{{vm.getLine(item, vm.options.line2)}}</h4>\n            <p ng-if="vm.options.line3">{{vm.getLine(item, vm.options.line3)}}</p>\n            <p class="ms-dual-multiselect-line-xs" ng-if="vm.options.line4">{{vm.getLine(item, vm.options.line4)}}\n            </p>\n          </div>\n          <md-icon ng-hide="vm.readOnly && !vm.addDisabled" ng-class="{\'add-disabled\': vm.addDisabled}" md-font-icon="icon-arrow-right-bold" aria-label="swap">\n          </md-icon>\n          <md-divider></md-divider>\n        </md-list-item>\n      </md-list>\n    </md-content>\n    <div class="margin-10" layout="row">\n      <span class="h4" flex>{{vm.options.labelAll || \'All Items\'}} ({{availableItems.length}})</span>\n      <md-icon ng-hide="vm.options.showSelectAndDeselectAll === false || vm.readOnly" ng-class="{\'add-disabled\': vm.addDisabled}" ng-disabled="vm.addDisabled" md-font-icon="icon-chevron-double-right" aria-label="swap" ng-click="vm.transfer(vm.options.items, vm.options.selectedItems, -1, false)"></md-icon>\n    </div>\n  </div>\n\n  <div flex="10" layout="row" layout-align="center center">\n    <md-icon md-font-icon="icon-swap-horizontal" aria-label="swap"></md-icon>\n  </div>\n\n  <div flex-gt-sm="50" flex="45">\n    <md-input-container class="md-icon-float md-block margin-0">\n      <md-icon md-font-icon="icon-magnify" aria-label="swap"></md-icon>\n      <input ng-model="selectedQuery" type="text" placeholder="{{ \'STAFF.PERMISSIONS_PLACEHOLDER_SEARCH\' | translate }}">\n    </md-input-container>\n    <md-content class="border h-300">\n      <md-list class="md-dense no-padding" layout-fill layout-align="center center">\n        <md-list-item class="md-3-line" ng-class="{\'read-only-mode\': vm.readOnly || !item.isValid}" ng-disabled="vm.readOnly" ng-repeat="item in associatedItems = (vm.options.selectedItems | filter: selectedQuery) | orderBy: vm.options.orderBy" ng-click="vm.canTransfer(item, vm.options, true)">\n          <md-icon ng-class="{\'hidden\': vm.readOnly || !item.isValid}" md-font-icon="icon-arrow-left-bold" aria-label="swap"></md-icon>\n          <div class="md-list-item-text" layout="column">\n            <h3 ng-if="vm.options.line1">{{vm.getLine(item, vm.options.line1)}}</h3>\n            <h4 ng-if="vm.options.line2">{{vm.getLine(item, vm.options.line2)}}</h4>\n            <p ng-if="vm.options.line3">{{vm.getLine(item, vm.options.line3)}}</p>\n            <p class="ms-dual-multiselect-line-xs" ng-if="vm.options.line4">{{vm.getLine(item, vm.options.line4)}}\n            </p>\n          </div>\n          <md-divider></md-divider>\n        </md-list-item>\n      </md-list>\n    </md-content>\n    <div class="margin-10" layout="row">\n      <md-icon ng-hide="vm.options.showSelectAndDeselectAll === false || vm.readOnly" md-font-icon="icon-chevron-double-left" aria-label="swap" ng-click="vm.transfer(vm.options.selectedItems, vm.options.items, -1, true)"></md-icon>\n      <span class="h4 text-right" flex>{{vm.options.labelSelected || \'Selected Items\'}}\n        ({{associatedItems.length}})</span>\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-font-family/ms-font-family.html",'<md-select ng-model="ngModel" class="no-margin">\n  <md-option ng-repeat="font in fonts" ng-value="font.value"><span ng-style="{\'font-family\': font.value}">{{font.option}}</span>\n  </md-option>\n</md-select>'),e.put("app/core/directives/ms-info-bar/ms-info-bar.html",'<div id="ms-info-bar" layout="row" layout-align="start center" flex>\n  <div id="ms-info-bar-message" ng-transclude flex></div>\n  <md-button id="ms-info-bar-close" class="md-icon-button" aria-label="Close" ng-click="removeInfoBar()">\n    <md-icon md-font-icon="icon-close s20"></md-icon>\n  </md-button>\n</div>'),e.put("app/core/directives/ms-material-color-picker/ms-material-color-picker.html",'<md-menu md-position-mode="target-right target">\n\n  <div ng-click="$mdOpenMenu($event)">\n    <ms-color-picker-button>\n      <md-button aria-label="Row Color" md-menu-origin ng-click="$mdOpenMenu($event)" ng-class="vm.selectedColor.class">\n\n        <span ng-show="vm.selectedColor.palette">\n          {{vm.selectedColor.palette}} {{vm.selectedColor.hue}}\n        </span>\n        <span ng-show="!vm.selectedColor.palette">\n          Select Color\n        </span>\n      </md-button>\n    </ms-color-picker-button>\n  </div>\n\n  <md-menu-content class="ms-material-color-picker-menu-content" layout-column>\n\n    <header ng-class="vm.selectedColor.class || \'md-accent-bg\'" class="md-whiteframe-4dp" layout="row" layout-align="space-between center">\n      <md-button md-prevent-menu-close ng-click="vm.activateHueSelection(false,false)" class="md-icon-button" ng-class="{\'hidden\':!vm.selectedPalette}" aria-label="Palette">\n        <md-icon md-font-icon="icon-arrow-left" class="s20"></md-icon>\n      </md-button>\n\n      <span ng-if="vm.selectedColor.palette">\n        {{vm.selectedColor.palette}} {{vm.selectedColor.hue}}\n      </span>\n\n      <span ng-if="!vm.selectedColor.palette">\n        Select Color\n      </span>\n\n      <md-button class="remove-color-button md-icon-button" ng-click="vm.removeColor()" aria-label="Remove Color">\n        <md-icon md-font-icon="icon-delete" class="s20"></md-icon>\n      </md-button>\n    </header>\n\n    <div class="colors">\n      <div ng-show="!vm.selectedPalette" layout="row" layout-wrap>\n        <div class="color" ng-class="\'md-\'+palette+\'-500-bg\'" ng-repeat="(palette, hues) in vm.palettes" ng-click="vm.activateHueSelection(palette,hues)" layout="row" layout-align="start end" md-prevent-menu-close md-ink-ripple>\n          <span class="label">\n            {{palette}}\n          </span>\n        </div>\n      </div>\n\n      <div ng-show="vm.selectedPalette" layout="row" layout-wrap>\n        <div class="color" ng-class="\'md-\'+vm.selectedPalette+\'-\'+hue+\'-bg\'" ng-repeat="(hue, values) in vm.selectedHues" ng-click="vm.selectColor(vm.selectedPalette,hue)" layout="row" layout-align="start end" md-ink-ripple>\n          <span class="label">\n            {{hue}}\n          </span>\n          <i ng-if="vm.selectedPalette == vm.selectedColor.palette && hue == vm.selectedColor.hue" class="s16 icon-check">\n          </i>\n        </div>\n      </div>\n\n    </div>\n\n  </md-menu-content>\n</md-menu>'),e.put("app/core/directives/ms-navigation/templates/horizontal.html",'<div class="navigation-toggle" hide-gt-sm>\n  <md-button class="md-icon-button" ng-click="vm.toggleHorizontalMobileMenu()" aria-label="Toggle Mobile Navigation">\n    <md-icon md-font-icon="icon-menu"></md-icon>\n  </md-button>\n</div>\n\n<ul class="horizontal">\n  <li ng-repeat="node in vm.navigation" ms-navigation-horizontal-node="node" ng-class="{\'has-children\': vm.hasChildren}" ng-include="\'navigation-horizontal-nested.html\'"></li>\n</ul>\n\n\x3c!-- Nested horizontal navigation template --\x3e\n<script type="text/ng-template" id="navigation-horizontal-nested.html">\n\n  <div ms-navigation-horizontal-item layout="row" ng-if="!vm.isHidden()">\n\n        <div class="ms-navigation-horizontal-button" ng-if="!node.uisref && node.title"\n             ng-class="{\'active md-accent-bg md-accent-fg\': vm.isActive}">\n            <i class="icon s18 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg" style="background: {{node.badge.color}}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s18 arrow" ng-if="vm.hasChildren"></i>\n        </div>\n\n        <a class="ms-navigation-horizontal-button" ui-sref="{{node.uisref}}" ui-sref-active="active md-accent-bg"\n           ng-class="{\'active md-accent-bg md-accent-fg\': vm.isActive}"\n           ng-if="node.uisref && node.title">\n            <i class="icon s18 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg" style="background: {{node.badge.color}}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s18 arrow" ng-if="vm.hasChildren"></i>\n        </a>\n\n    </div>\n\n    <ul ng-if="vm.hasChildren && !vm.isHidden()">\n        <li ng-repeat="node in node.children" ms-navigation-horizontal-node="node"\n            ng-class="{\'has-children\': vm.hasChildren}"\n            ng-include="\'navigation-horizontal-nested.html\'"></li>\n    </ul>\n\n<\/script>\n\x3c!-- / Nested navigation template --\x3e'),e.put("app/core/directives/ms-navigation/templates/vertical.html",'<ul>\n  <li ng-repeat="node in vm.navigation" ms-navigation-node="node" ng-class="{\'collapsed\': vm.collapsed, \'has-children\': vm.hasChildren}" ng-include="\'navigation-nested.html\'"></li>\n</ul>\n\n\x3c!-- Nested navigation template --\x3e\n<script type="text/ng-template" id="navigation-nested.html">\n\n  <div id="{{ node.id }}" ms-navigation-item layout="row" ng-if="!vm.isHidden()">\n\n        <div class="ms-navigation-button" ng-if="!node.uisref && node.title">\n            <i class="icon s16 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg margin-right-20" ng-style="{\'background\': node.badge.color}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s16 arrow" ng-if="vm.collapsable && vm.hasChildren"></i>\n        </div>\n\n        <a class="ms-navigation-button" ui-sref="{{node.uisref}}" ui-sref-active="active md-accent-bg" ng-if="node.uisref && node.title">\n            <i class="icon s16 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg margin-right-20" ng-style="{\'background\': node.badge.color}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s16 arrow" ng-if="vm.collapsable && vm.hasChildren"></i>\n        </a>\n\n    </div>\n\n    <ul ng-if="vm.hasChildren && !vm.isHidden()">\n        <li ng-repeat="node in node.children" ms-navigation-node="node"\n            ng-class="{\'collapsed\': vm.collapsed, \'has-children\': vm.hasChildren}"\n            ng-include="\'navigation-nested.html\'"></li>\n    </ul>\n\n<\/script>\n\x3c!-- / Nested navigation template --\x3e'),e.put("assets/ms-phonebar/ms-phonebar-dialpad.html",'\x3c!-- Dialpad --\x3e\n<md-content ng-if="vm_pb.showDialpad" class="num-pad" layout="column">\n  <section layout="row" layout-align="start center">\n    <span><img class="num-pad-logo" layout-padding src="/api/settings/1/logo" alt="logo" /></span>\n    <span class="md-subhead">Dialpad</span>\n    <div layout="row" layout-align="end center" flex>\n      <md-button class="md-icon-button" ng-click="vm_pb.closeDialpad()">\n        <md-icon md-font-icon="icon-close"></md-icon>\n      </md-button>\n    </div>\n  </section>\n  <md-divider></md-divider>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: 1, l: []}, {n: 2, l: [\'a\', \'b\', \'c\']}, {n: 3, l: [\'d\', \'e\', \'f\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n  </section>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: 4, l: [\'g\', \'h\', \'i\']}, {n: 5, l: [\'j\', \'k\', \'l\']}, {n: 6, l: [\'m\', \'n\', \'o\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n  </section>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: 7, l: [\'p\', \'q\', \'r\', \'s\']}, {n: 8, l: [\'t\', \'u\', \'v\']}, {n: 9, l: [\'w\', \'x\', \'y\', \'z\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n  </section>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: \'*\', l: []}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num" layout="column" layout-align="center center">\n        <div class="txt" layout="column" layout-align="center center">\n          {{item.n}}\n        </div>\n      </div>\n    </div>\n    <div class="span4" ng-repeat="item in ::[{n: 0, l: [\'+\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n    <div class="span4" ng-repeat="item in ::[{n: \'#\', l: []}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num" layout="column" layout-align="center center">\n        <div class="txt" layout="column" layout-align="center center">\n          {{item.n}}\n        </div>\n      </div>\n    </div>\n  </section>\n</md-content>\n\x3c!-- Dialpad --\x3e\n\n\x3c!-- Input&Media Area --\x3e\n<div layout="row" layout-align="start center">\n  <div layout="row" layout-align="center center">\n    \x3c!-- START Ringing Tone--\x3e\n    <md-button class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Ringing" ng-click="vm_pb.conf.ringingMute = !vm_pb.conf.ringingMute; vm_pb.initDevice(\'ringing\', true)" ng-disabled="!vm_pb.registered">\n      <md-icon md-font-icon="{{vm_pb.conf.ringingMute ? \'icon-bell-off\' : \'icon-bell-ring\'}}" class="icon s14" ng-class="vm_pb.conf.ringingMute ? \'red-fg\' : \'grey-fg\'">\n        <md-tooltip><span translate="TOOLBAR.RINGING">Ringing</span></md-tooltip>\n      </md-icon>\n    </md-button>\n    \x3c!-- END Ringing Tone --\x3e\n\n    \x3c!-- START Speaker --\x3e\n    <md-button class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Speaker" ng-click="vm_pb.conf.speakerMute = !vm_pb.conf.speakerMute; vm_pb.initDevice(\'speaker\', true)" ng-disabled="!vm_pb.registered">\n      <md-icon md-font-icon="{{vm_pb.conf.speakerMute ? \'icon-volume-off\' : \'icon-volume\'}}" class="icon s14" ng-class="vm_pb.conf.speakerMute ? \'red-fg\' : \'grey-fg\'">\n        <md-tooltip><span translate="TOOLBAR.SPEAKER">Speaker</span></md-tooltip>\n      </md-icon>\n    </md-button>\n    \x3c!-- END Speaker --\x3e\n\n    \x3c!-- START Microphone --\x3e\n    <md-button ng-disabled="(!vm_pb.registered || vm_pb.sessions.length==0)?true:false" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Microphone" ng-click="vm_pb.conf.microphoneMute = !vm_pb.conf.microphoneMute; vm_pb.initDevice(\'microphone\', true)">\n      <md-icon md-font-icon="{{vm_pb.conf.microphoneMute ? \'icon-microphone-off\' : \'icon-microphone\'}}" class="icon s14" ng-class="vm_pb.conf.microphoneMute ? \'red-fg\' : \'grey-fg\'">\n        <md-tooltip><span translate="TOOLBAR.MICROPHONE">Microphone</span></md-tooltip>\n      </md-icon>\n    </md-button>\n    \x3c!-- END Microphone --\x3e\n\n    \x3c!-- START Registered --\x3e\n    <span>\n      <span class="quantity-indicator md-red-500-bg" ng-class="vm_pb.registered ? \'md-green-500-bg\' : \'md-red-500-bg\'"></span>\n      <md-tooltip><span>{{vm_pb.conf.license ? (vm_pb.registered ? \'TOOLBAR.REGISTERED\' : \'TOOLBAR.NOT_REGISTERED\') : \'TOOLBAR.WEBRTC_LICENSE_NOT_ENABELD\' | translate}}\n          <timer ng-if="vm_pb.registered"></timer>\n        </span>\n      </md-tooltip>\n    </span>\n    \x3c!-- END Registered --\x3e\n  </div>\n  <div layout="column" layout-align="center start">\n    <div layout="row" layout-align="start center">\n      \x3c!-- START Target --\x3e\n      <angucomplete-alt id="ms-target-wrap" pause="10" local-data="vm_pb.calls" search-fields="target" title-field="target" minlength="0" input-class="input-number" disable-input="!vm_pb.registered" match-class="highlight" template-url="assets/ms-phonebar/ms-phonebar-input.html" input-changed="vm_pb.targetChanged" selected-object="vm_pb.targetSelected" clear-selected="true" ng-keypress="vm_pb.typeWrapper($event)" focus-first="true" disable-autocomplete="vm_pb.currentUser.privacyEnabled"></angucomplete-alt>\n      \x3c!-- END Target --\x3e\n\n      \x3c!-- Auto Answer --\x3e\n      <div ng-if="vm_pb.conf.autoAnswer" class="red-fg" style="padding-left: 10px;">\n        <span class="font-size-20">A<span class="font-size-16">A</span></span>\n      </div>\n      \x3c!-- Auto Answer --\x3e\n\n      <md-button class="md-fab md-mini white-bg width-30 height-30" aria-label="Dialpad" ng-click="vm_pb.toggleDialpad()" ng-disabled="!vm_pb.registered">\n        <md-icon md-font-icon="icon-apps" class="icon grey-fg s16"></md-icon>\n      </md-button>\n      <md-button ng-if="vm_pb.target" class="md-fab md-mini white-bg width-25 height-25" aria-label="Call" style="margin-left: 0px;" ng-click="vm_pb.call()">\n        <md-icon md-font-icon="icon-phone" class="icon green-fg s12"></md-icon>\n      </md-button>\n    </div>\n  </div>\n</div>\n\x3c!-- Input&Media Area --\x3e\n\n\x3c!-- START 3WC --\x3e\n<md-button ng-if="vm_pb.canGoInConference" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="3Way" ng-click="vm_pb.start3WayConf();  $event.stopPropagation();">\n  <md-icon md-font-icon="icon-account-multiple-plus" class="icon orange-fg s14"></md-icon>\n  <md-tooltip><span translate="TOOLBAR.CONFERENCE">Conference</span></md-tooltip>\n</md-button>\n\x3c!-- END 3Way --\x3e\n\n\n<div class="toolbar-separator"></div>\n\n\x3c!-- Sessions Area --\x3e\n<div class="sessions" layout="row" layout-align="start center" flex>\n  <div layout="row" layout-align="center center" ng-if="!vm_pb.conf.license">\n    <md-icon md-font-icon="icon-account-alert" class="icon s36 red-fg"></md-icon>\n    <span layout-margin translate="TOOLBAR.WEBRTC_LICENSE_NOT_ENABELD"></span>\n  </div>\n\n  <div id="{{\'div_session_\'+session.id.substr(0,32)}}" ng-repeat="session in vm_pb.sessions" class="session" layout="row" ng-click="(vm_pb.sessions.length > 1) && vm_pb.selectSession(session)">\n    <md-button ng-if="vm_pb.conf.recording && session.confirmed" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Record" ng-click="vm_pb.record(session); $event.stopPropagation();">\n      <md-icon md-font-icon="icon-radiobox-marked" class="icon s14" ng-class="session.monitor ? \'red-fg\' : \'grey-fg\'"></md-icon>\n    </md-button>\n    <div layout="column" layout-align="center start">\n      <span class="session-info">\n        <span ng-if="session.user == session.name" privacy ng-cloak>{{session.user}}</span>\n        <span ng-if="session.user != session.name" privacy ng-cloak>{{session.name}}</span> <span ng-if="session.user != session.name" privacy ng-cloak>{{session.user}}</span>\n      </span>\n      <span class="session-info" layout="row" layout="start center">\n        <timer></timer>\n      </span>\n    </div>\n\n    \x3c!-- START Answer --\x3e\n    <md-button ng-if="session.incoming && !session.confirmed" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Anser" ng-click="vm_pb.answer(session); $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone" class="icon green-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Answer --\x3e\n\n    \x3c!-- START Hangup --\x3e\n    <md-button class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Terminate" ng-click="vm_pb.terminate(session); $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone-hangup" class="icon red-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Hangup --\x3e\n\n    \x3c!-- START Hold/Unhold --\x3e\n    <md-button ng-if="session.confirmed && !vm_pb.isInConference" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Hold" ng-click="(session.localHold ? vm_pb.unhold(session) : vm_pb.hold(session)); $event.stopPropagation();">\n      <md-icon md-font-icon="{{session.localHold ? \'icon-play\' : \'icon-pause\'}}" class="icon grey-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Hold/Unhold --\x3e\n\n    \x3c!-- START Transfer --\x3e\n    <md-button ng-if="session.confirmed && !session.localHold && vm_pb.sessions.length == 1 && !vm_pb.isInConference" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Refer" ng-click="vm_pb.refer(session);  $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END transfer --\x3e\n\n    \x3c!-- START Attended Transfer --\x3e\n    <md-button ng-if="session.confirmed && !session.localHold && vm_pb.sessions.length>1" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Refer Attended" ng-click="vm_pb.referAttended(session);  $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Attended Transfer --\x3e\n  </div>\n</div>\n\x3c!-- Sessions Area --\x3e'),e.put("assets/ms-phonebar/ms-phonebar-input.html",'<div class="angucomplete-holder" ng-class="{\'angucomplete-dropdown-visible\': showDropdown}">\n  <input id="ms-target" ng-model="searchStr" ng-disabled="disableInput" type="text" placeholder="{{placeholder}}" ng-focus="onFocusHandler()" class="{{inputClass}}" ng-focus="resetHideResults()" ng-blur="hideResults($event)" autocapitalize="off" autocorrect="off" autocomplete="off" ng-change="inputChangeHandler(searchStr)" />\n  <div class="angucomplete-dropdown" ng-show="showDropdown && !(!searching && (!results || results.length == 0))">\n    <div class="angucomplete-row" ng-repeat="result in results" ng-click="selectResult(result)" ng-mouseenter="hoverRow($index)" ng-class="{\'angucomplete-selected-row\': $index == currentIndex}">\n      <div layout="row" layout-align="start center">\n        <md-icon md-font-icon="{{result.originalObject.inbound ? \'icon-arrow-bottom-left\' : \'icon-arrow-top-right\'}}" class="icon no-margin s22"></md-icon>\n        <span style="margin-left: 8px;">({{result.originalObject.time}}) - <span class="angucomplete-title" ng-if="matchClass" ng-bind-html="result.title" privacy ng-cloak></span></span>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("assets/ms-phonebar/ms-phonebar.html",'<div layout="row" layout-align="start center" flex>\n  \x3c!-- Audio stream --\x3e\n  <audio id="local-audio" autoplay hidden=true></audio>\n  <audio id="remote-audio" autoplay hidden=true></audio>\n  \x3c!-- Audio stream --\x3e\n\n  \x3c!-- WebRtc PhoneBar --\x3e\n  <div class="phonebar-container" ng-include="\'assets/ms-phonebar/ms-phonebar-dialpad.html\'" layout="row" layout-align="start center" flex></div>\n  \x3c!-- WebRtc PhoneBar --\x3e\n</div>'),e.put("assets/ms-phonebar/prefix/dialog.html",'<md-dialog aria-label="Prefix">\n  <form ng-cloak ng-keypress="vm.keyPress($event)">\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="TOOLBAR.PREFIXES">Prefixes</span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.closeDialog(-1)">\n            <md-icon class="no-margin" md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <md-radio-group ng-model="vm.prefix">\n        <md-radio-button ng-repeat="prefix in vm.prefixes.rows" value="{{prefix.prefix}}" class="md-primary">{{prefix.name}}</md-radio-button>\n        <md-radio-button ng-if="!vm.required" ng-value="null" class="md-primary">no prefix</md-radio-button>\n      </md-radio-group>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button ng-click="vm.call()" class="send-button md-accent md-raised" aria-label="call" md-autofocus ng-disabled="!vm.prefix && vm.required">\n        <span translate="TOOLBAR.CALL">CALL</span>\n      </md-button>\n      <md-button ng-click="vm.closeDialog(-1)" class="send-button md-accent md-raised" aria-label="cancel">\n        <span translate="TOOLBAR.CANCEL">Cancel</span>\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("assets/ms-phonebar/record/dialog.html",'<md-dialog aria-label="Recording" ng-init="vm.onInit()">\n  <form ng-cloak>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="TOOLBAR.RECORDING">Recording</span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding">\n            <md-icon class="no-margin" md-font-icon="icon-plus" aria-label="Add" ng-click="vm.addRecording()"></md-icon>\n          </md-button>\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.closeDialog()">\n            <md-icon class="no-margin" md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-table-container>\n      <table md-table layout-padding>\n        <thead md-head>\n          <tr md-row>\n            <th md-column><span translate="TOOLBAR.FILENAME">File name</span></th>\n            <th md-column><span translate="TOOLBAR.STATUS">Status</span></th>\n            <th md-column><span translate="TOOLBAR.ACTIONS">Actions</span></th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm.session.monitors.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="TOOLBAR.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="monitor in vm.session.monitors">\n            <td md-cell>{{monitor.filename}}</td>\n            <td md-cell class="no-padding">\n              <md-icon md-font-icon="icon-radiobox-marked" class="icon s16" ng-class="(monitor.status == \'rec\') ? \'red-fg ms-blink\' : \'grey-fg\'"></md-icon>\n            </td>\n            <td md-cell class="no-padding">\n              <md-button class="md-fab md-mini white-bg width-35 height-35 margin-5" aria-label="Record" ng-click="(monitor.status == \'rec\') ? vm.stop(monitor) : vm.start(monitor)">\n'+"                <md-icon md-font-icon=\"{{monitor.status == 'rec' ? 'icon-stop' : 'icon-play'}}\" class=\"icon s16\" ng-class=\"monitor.status == 'rec' ? 'grey-fg' : 'red-fg'\"></md-icon>\n              </md-button>\n            </td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n  </form>\n</md-dialog>"),e.put("assets/ms-phonebar/referAttended/dialog.html",'<md-dialog aria-label="Transfer">\n  <form ng-cloak>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="TOOLBAR.ATTENDED_TRANSFER">Transfer</span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.closeDialog()">\n            <md-icon class="no-margin" md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <label translate="TOOLBAR.TARGET">Target</label>\n      <md-input-container class="md-block">\n        <md-select ng-model="vm.target">\n          <md-option ng-repeat="session in vm.sessions" ng-value="session.user">\n            {{ session.name }}\n          </md-option>\n        </md-select>\n      </md-input-container>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button ng-click="vm.transfer()" class="send-button md-accent md-raised" aria-label="transfer" ng-disabled="!vm.target && !vm.sessionId">\n        <span translate="TOOLBAR.TRANSFER">TRANSFER</span>\n      </md-button>\n      <md-button ng-click="vm.closeDialog()" class="send-button md-accent md-raised" aria-label="cancel">\n        <span translate="TOOLBAR.CANCEL">Cancel</span>\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("assets/ms-phonebar/settings/settings.html",'<md-dialog class="md-phonebar-dialog" aria-label="{{vm.name}}">\n  <form name="settingsForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="TOOLBAR.SETTINGS">Settings</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content class="no-padding">\n      <md-tabs md-no-pagination md-stretch-tabs="always">\n        <md-tab label="{{ \'TOOLBAR.PROFILE\' | translate}}">\n          <md-content layout-padding layout="column">\n            <span><span translate="TOOLBAR.FULLNAME">Fullname</span>: {{vm.conf.fullname}}</span>\n            <span><span translate="TOOLBAR.NAME">Name</span>: {{vm.conf.name}}</span>\n            <span><span translate="TOOLBAR.INTERNAL">Internal</span>: {{vm.conf.internal}}</span>\n            <span><span translate="TOOLBAR.BROWSER">Browser</span>: {{vm.conf.browserName}} {{vm.conf.browserVersion}}</span>\n            <span><span translate="TOOLBAR.OS">OS</span>: {{vm.conf.osName}} {{vm.conf.osVersion}}</span>\n          </md-content>\n        </md-tab>\n        <md-tab label="{{ \'TOOLBAR.SERVICES\' | translate}}">\n          <md-content layout-padding>\n            <md-input-container class="md-block">\n              <md-switch ng-model="vm.conf.autoAnswer" aria-label="Auto Answer">\n                <span translate="TOOLBAR.AUTOANSWER">Auto Answer</span>\n                <span>{{ vm.conf.autoAnswerDelay }} [s]</span>\n              </md-switch>\n            </md-input-container>\n          </md-content>\n        </md-tab>\n        <md-tab label="{{ \'TOOLBAR.AUDIO\' | translate}}">\n          <md-content layout-padding>\n            <div class="border brad-5" layout-margin>\n              <md-input-container class="md-block" ng-if="(vm.devices | filter: { kind: \'audiooutput\' }).length">\n                <label translate="TOOLBAR.RINGINGDEVICE">Ringing Device</label>\n                <md-select name="ringingDevice" ng-model="vm.conf.ringingId" required>\n                  <md-option ng-value="device.deviceId" ng-repeat="device in vm.devices | filter: { kind: \'audiooutput\' }">{{ device.label || (\'Speaker \' + ($index + 1)) }}</md-option>\n                </md-select>\n                <div ng-messages="settingsForm[\'ringingDevice\'].$error" ng-show="settingsForm[\'ringingDevice\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <div layout="row" layout-align="space-between center">\n                <md-switch ng-model="vm.conf.ringingMute" aria-label="Mute">\n                  Mute\n                </md-switch>\n\n                <md-slider-container flex="80">\n                  <md-slider flex step="0.1" min="0" max="1" ng-model="vm.conf.ringingVolume" aria-label="volume"></md-slider>\n                </md-slider-container>\n              </div>\n            </div>\n\n            <div class="border brad-5" layout-margin>\n              <md-input-container class="md-block" ng-if="(vm.devices | filter: { kind: \'audiooutput\' }).length">\n                <label translate="TOOLBAR.SPEAKERDEVICE">Speaker Device</label>\n                <md-select name="speakerDevice" ng-model="vm.conf.speakerId" required>\n                  <md-option ng-value="device.deviceId" ng-repeat="device in vm.devices | filter: { kind: \'audiooutput\' }">{{ device.label || (\'Speaker \' + ($index + 1)) }}</md-option>\n                </md-select>\n                <div ng-messages="settingsForm[\'speakerDevice\'].$error" ng-show="settingsForm[\'speakerDevice\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <div layout="row" layout-align="space-between cetner">\n                <md-switch ng-model="vm.conf.speakerMute" aria-label="Mute">\n                  Mute\n                </md-switch>\n\n                <md-slider-container flex="80">\n                  <md-slider flex step="0.1" min="0" max="1" ng-model="vm.conf.speakerVolume" aria-label="volume"></md-slider>\n                </md-slider-container>\n              </div>\n            </div>\n\n            <div class="border brad-5" layout-margin>\n              <md-input-container class="md-block" ng-if="(vm.devices | filter: { kind: \'audioinput\' }).length">\n                <label translate="TOOLBAR.MICROPHONEDEVICE">Microphone Device</label>\n                <md-select name="microphoneDevice" ng-model="vm.conf.microphoneId" required>\n                  <md-option ng-value="device.deviceId" ng-repeat="device in vm.devices | filter: { kind: \'audioinput\' }">{{ device.label || (\'Microphone \' + ($index + 1))}}</md-option>\n                </md-select>\n                <div ng-messages="settingsForm[\'microphoneDevice\'].$error" ng-show="settingsForm[\'microphoneDevice\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n              <div layout="row" layout-align="space-between center">\n                <md-switch ng-disabled="vm.activeSessions.length==0" ng-model="vm.conf.microphoneMute" aria-label="Mute">\n                  Mute\n                </md-switch>\n              </div>\n            </div>\n          </md-content>\n        </md-tab>\n        <md-tab label="{{ \'TOOLBAR.REQUIREMENTS\' | translate}}">\n          <md-content layout-padding>\n            <md-list>\n              <md-list-item>\n                <h3 translate="TOOLBAR.LICENSE">License</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.license ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.license ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.BROWSER_COMPATIBILITY">Browser Compatibility</h3>\n                <md-icon class="md-secondary" ng-class="vm.isCompatibleBrowser() ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.isCompatibleBrowser() ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.HTTPS">HTTPS</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.protocol === \'https\' ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.protocol === \'https\' ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.WEBRTCSUPPORT">WebRTC Support</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.isWebRTCSupported ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.isWebRTCSupported ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.MICROPHONE">Microphone</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.hasMicrophone ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.hasMicrophone ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.SPEAKER">Speaker</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.hasSpeakers ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.hasSpeakers ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n            </md-list>\n          </md-content>\n        </md-tab>\n      </md-tabs>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveSettings()" class="send-button md-accent md-raised" ng-disabled="settingsForm.$invalid || settingsForm.$pristine" aria-label="SAVE" translate="TOOLBAR.SAVE" translate-attr-aria-label="TOOLBAR.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/core/directives/ms-quick-filter/ms-quick-filter.html",'<div ng-cloak layout="row" class="quick-filter-container" flex>\n  <div ng-repeat="filter in vm.filters" ng-if="filter.ngIf ? $eval(\'vm.query.\' + filter.ngIf) : true" layout="column" class="padding-horizontal-16">\n    <span class="font-size-10" translate="{{ filter.label }}" />\n    <md-select ng-if="filter.type === \'select\'" class="font-size-12 no-margin" ng-model="vm.query[filter.key]" ng-change="vm.search()" aria-label="Filter {{ filter.name }}">\n      <md-option ng-repeat="option in filter.options" ng-value="filter.ngValue ? option[filter.ngValue] : option.id">\n        {{ option.name }}</md-option>\n      <md-option ng-repeat="option in filter.customOptions" ng-value="option.value" translate="{{ option.translate }}">\n      </md-option>\n    </md-select>\n\n    <md-select ng-if="filter.type === \'multiselect\'" multiple class="font-size-12 no-margin" ng-init="vm.onMultiselectInit(filter)" ng-model="vm.query[filter.key]" ng-disabled="filter.options.length === 0" ng-change="vm.onMultiselectSelection(filter, isOpen)" md-selected-text="vm.placeholders[filter.key]" aria-label="Filter {{ filter.name }}" md-on-open="isOpen = true" md-on-close="isOpen = false">\n      <md-option ng-repeat="option in filter.options" ng-value="filter.ngValue ? option[filter.ngValue] : option.id" ng-disabled="filter.clearAll === false && vm.query[filter.key].length === 1 && vm.query[filter.key][0] === (filter.ngValue ? option[filter.ngValue] : option.id)">\n        {{ option.name }}</md-option>\n      <md-button ng-if="vm.query[filter.key].length &lt; filter.options.length" ng-click="vm.selectAll(filter)" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.SELECT_ALL\' | translate}}</md-button>\n      <md-button ng-if="vm.query[filter.key].length === filter.options.length" ng-click="vm.clearSelection(filter)" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.CLEAR\' | translate}}</md-button>\n    </md-select>\n\n    <div ng-if="filter.type === \'date\'" layout="row" layout-align="center center">\n      <md-date-range ng-init="vm.onDateRangeInit(filter)" localization-map="vm.localizationMap" ng-model="vm.pickerModels[filter.key]" auto-confirm="true" show-template="true" md-on-select="vm.onDateRangeSelection(filter)" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}">\n      </md-date-range>\n      <md-button ng-if="vm.pickerModels[filter.key].dateStart" ng-click="vm.clearDate(filter)" class="md-icon-button no-margin no-padding width-20 height-20" aria-label="Clear date filter">\n        <md-icon md-font-icon="icon-close" class="quick-filter-date-clear-button s16"></md-icon>\n      </md-button>\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-search-bar/ms-search-bar.html",'<div flex layout="row" layout-align="start center">\n  <label>\n    <md-button class="ms-search-bar-expander md-icon-button" aria-label="Expand Search Bar" ng-click="vm.expandBar()" ng-if="!vm.resultsLoading || !vm.expanded" ng-class="{\'ms-search-button-expanded\': vm.expanded }">\n      <md-icon id="ms-search-bar-icon" md-font-icon="icon-magnify" class="s24" ng-class="{\'{{ vm.iconColor }}\': vm.iconColor && !vm.expanded }"></md-icon>\n    </md-button>\n    <div class="ms-search-bar-loader" layout="row" layout-align="center center" ng-if="vm.resultsLoading && vm.expanded">\n      <md-progress-circular class="md-accent" md-diameter="32" md-mode="indeterminate"></md-progress-circular>\n    </div>\n  </label>\n  <input ng-if="vm.expanded" focus-on="vm.expanded" type="text" placeholder="{{ \'TOOLBAR.SEARCH\' | translate }}" flex ng-model="vm.query.filter" ng-model-options="vm.queryOptions" ng-blur="vm.blurCollapse()" ng-keydown="vm.onKeyDown($event)" />\n  <md-button class="ms-search-bar-collapser md-icon-button" ng-click="vm.collapseBar()" aria-label="Collapse Search Bar">\n    <md-icon md-font-icon="icon-close" class="icon s24"></md-icon>\n  </md-button>\n  <div class="ms-search-bar-results" ng-if="vm.results">\n    <div class="no-results" ng-if="vm.results.length === 0">{{ \'DASHBOARDS.NO_RESULTS_AVAILABLE\' | translate }}</div>\n    <div class="result" ng-repeat="result in vm.results" ng-click="vm.handleResultClick(result)" ng-mouseenter="vm.handleMouseEnter($index)" ng-mousedown="vm.absorbEvent($event)" ng-class="{\'selected\': $index == vm.selectedResultIndex}" md-ink-ripple>\n      <div layout="row" layout-align="start center">\n        <div class="icon-container" layout="row" layout-align="center center">\n          <i ng-if="result.icon" class="icon {{ result.icon }}"></i>\n          <div ng-if="!result.icon" class="square md-accent-bg"></div>\n        </div>\n        <div>\n          <div class="title">{{ result.title }}</div>\n          <div class="description" ng-if="result.description">{{ result.description }}</div>\n        </div>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-shortcuts/ms-shortcuts.html",'<div class="shortcuts-container" layout="row" layout-align="space-between center" flex ng-class="{\'mobile-bar-active\': MsShortcuts.mobileBarActive}">\n\n  <div class="flex-noshrink" layout="row" layout-align="start center" flex>\n    <div class="shortcuts hide show-gt-xs" layout="row" layout-align="start center" ng-if="MsShortcuts.shortcuts.length > 0" ng-sortable="MsShortcuts.sortableOptions">\n      <div ng-repeat="shortcut in MsShortcuts.shortcuts" layout="row" layout-align="center center">\n        <md-button class="md-icon-button shortcut" aria-label="{{shortcut.title}}" ui-sref="{{shortcut.uisref}}">\n          <md-icon ng-if="shortcut.icon" md-font-icon="{{shortcut.icon}}" class="icon s24"></md-icon>\n          <div ng-if="!shortcut.icon" class="first-letter">{{shortcut.title.charAt(0)}}</div>\n          <md-tooltip md-direction="bottom">{{shortcut.title}}</md-tooltip>\n        </md-button>\n      </div>\n    </div>\n\n    \x3c!-- <md-menu md-offset="8 56" class="shortcut-menu hide show-gt-xs">\n            <md-button class="md-icon-button add-shortcut-button" aria-label="Add shortcut"\n                       ng-click="$mdOpenMenu($event)">\n                <md-icon md-menu-origin md-font-icon="icon-star" class="icon amber-600-fg s24"></md-icon>\n                <md-tooltip md-direction="bottom">Click to add/remove shortcut</md-tooltip>\n            </md-button>\n\n            <md-menu-content>\n                <div id="ms-shortcut-add-menu">\n                    <div class="shortcut-search" layout="row" layout-align="start center">\n                        <div class="search-icon" layout="row" layout-align="center center"\n                             ng-if="!MsShortcuts.resultsLoading">\n                            <md-icon md-menu-align-target md-font-icon="icon-magnify" class="icon s24"></md-icon>\n                        </div>\n                        <div class="shortcut-loader" layout="row" layout-align="center center"\n                             ng-if="MsShortcuts.resultsLoading">\n                            <md-progress-circular class="md-accent" md-diameter="20" md-mode="indeterminate">\n                            </md-progress-circular>\n                        </div>\n\n                        <input type="text" placeholder="Search" flex\n                               ng-model="MsShortcuts.query"\n                               ng-model-options="MsShortcuts.queryOptions"\n                               ng-keydown="MsShortcuts.handleKeydown($event)">\n                    </div>\n\n                    <div class="results" ng-if="MsShortcuts.results" >\n                        <div class="no-results" ng-if="MsShortcuts.results.length === 0">No Results!</div>\n\n                        <div class="result" ng-repeat="result in MsShortcuts.results"\n                             ng-click="MsShortcuts.handleResultClick(result)"\n                             ng-mouseenter="MsShortcuts.handleMouseenter($index)"\n                             ng-mousedown="MsShortcuts.absorbEvent($event)"\n                             ng-class="{\'selected\': $index == MsShortcuts.selectedResultIndex}"\n                             md-prevent-menu-close="md-prevent-menu-close"\n                             md-ink-ripple>\n                            <div layout="row" layout-align="start space-between">\n                                <div layout="row" layout-align="start center" flex>\n                                    <div class="icon icon-container" layout="row" layout-align="center center">\n                                        <i ng-if="result.icon" class="{{result.icon}}"></i>\n                                        <div ng-if="!result.icon" class="square md-accent-bg"></div>\n                                    </div>\n                                    <div>\n                                        <div class="title">{{result.title}}</div>\n                                    </div>\n                                </div>\n                                <md-icon md-font-icon="icon-pin" class="icon s18"\n                                         ng-class="{\'fade-text\': !result.hasShortcut}"></md-icon>\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </md-menu-content>\n        </md-menu> --\x3e\n  </div>\n\n  <md-button class="md-icon-button toggle-mobile-menu hide-gt-xs" aria-label="Add shortcut" ng-click="MsShortcuts.toggleMobileBar()">\n    <md-icon md-menu-origin md-font-icon="icon-star" class="icon amber-600-fg s24" ng-hide="MsShortcuts.mobileBarActive"></md-icon>\n    <md-icon md-menu-origin md-font-icon="icon-close" class="icon s24" ng-hide="!MsShortcuts.mobileBarActive"></md-icon>\n  </md-button>\n</div>'),e.put("app/core/directives/ms-stepper/templates/horizontal/horizontal.html",'<div class="ms-stepper-horizontal">\n  <div class="ms-stepper-navigation-wrapper">\n    <div class="ms-stepper-navigation" layout="row" layout-align="center center">\n      <md-button class="ms-stepper-navigation-item" ng-class="{\'current\': MsStepper.isStepCurrent(step.stepNumber), \'valid\': MsStepper.isStepValid(step.stepNumber), \'disabled\': MsStepper.isStepDisabled(step.stepNumber), \'optional\': MsStepper.isStepOptional(step.stepNumber)}" ng-click="MsStepper.gotoStep(step.stepNumber)" ng-disabled="MsStepper.isStepDisabled(step.stepNumber)" ng-repeat="step in MsStepper.steps | filter:MsStepper.filterHiddenStep" layout="row" layout-align="start center">\n\n        <div class="step md-accent-bg" layout="row" layout-align="center center">\n          <span ng-if="!MsStepper.isStepValid(step.stepNumber) || MsStepper.isStepOptional(step.stepNumber)">\n            {{$index + 1}}\n          </span>\n          <span ng-if="MsStepper.isStepValid(step.stepNumber) && !MsStepper.isStepOptional(step.stepNumber)">\n            <i class="icon icon-check s18"></i>\n          </span>\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="title" translate="{{step.stepTitleTranslate}}">{{step.stepTitle}}</div>\n          <div class="subtitle" ng-if="MsStepper.isStepOptional(step.stepNumber)">Optional</div>\n        </div>\n      </md-button>\n    </div>\n  </div>\n\n  <div class="ms-stepper-steps" ng-transclude></div>\n\n  <div class="ms-stepper-controls" layout="row" layout-align="center center">\n    <md-button class="md-accent md-raised" ng-disabled="MsStepper.isFirstStep()" ng-click="MsStepper.gotoPreviousStep()">\n      Back\n    </md-button>\n\n    <div class="ms-stepper-dots">\n      <span ng-repeat="step in MsStepper.steps" ng-hide="MsStepper.isStepHidden(step.stepNumber)" ng-class="{\'selected md-accent-bg\':MsStepper.currentStepNumber === $index + 1}">\n      </span>\n    </div>\n\n    <md-button class="md-accent md-raised" ng-if="!MsStepper.isLastStep()" ng-disabled="!MsStepper.isStepValid(MsStepper.currentStepNumber)" ng-click="MsStepper.gotoNextStep()">\n      Next\n    </md-button>\n\n    <md-button type="submit" class="md-accent md-raised" ng-click="MsStepper.resetForm()" ng-if="MsStepper.isLastStep()" ng-disabled="!MsStepper.isFormValid()">\n      Submit\n    </md-button>\n  </div>\n</div>'),e.put("app/core/directives/ms-stepper/templates/vertical/step/vertical-step.html",'<md-button class="ms-stepper-navigation-item" ng-class="{\'current\': MsStepper.isStepCurrent(stepInfo.stepNumber), \'valid\': MsStepper.isStepValid(stepInfo.stepNumber), \'disabled\': MsStepper.isStepDisabled(stepInfo.stepNumber), \'optional\': MsStepper.isStepOptional(stepInfo.stepNumber)}" ng-click="MsStepper.gotoStep(stepInfo.stepNumber)" ng-disabled="MsStepper.isStepDisabled(stepInfo.stepNumber)" ng-hide="MsStepper.isStepHidden(stepInfo.stepNumber)" aria-label="Stepper navigation button" layout="row" layout-align="start center">\n\n  <div class="step" layout="row" layout-align="center center">\n    <span ng-if="!MsStepper.isStepValid(stepInfo.stepNumber) || MsStepper.isStepOptional(stepInfo.stepNumber)">\n      <i class="icon icon-checkbox-blank-circle-outline s18 md-accent-fg"></i>\n    </span>\n    <span ng-if="MsStepper.isStepValid(stepInfo.stepNumber) && !MsStepper.isStepOptional(stepInfo.stepNumber)">\n      <i class="icon icon-check-circle s18 md-accent-fg"></i>\n    </span>\n  </div>\n\n  <div layout="column" layout-align="start start">\n    <div class="title" ng-if="stepInfo.stepTitleTranslate">{{stepInfo.stepTitleTranslate | translate }}</div>\n    <div class="title" ng-if="!stepInfo.stepTitleTranslate">{{stepInfo.stepTitle}}</div>\n    <div class="subtitle" ng-if="MsStepper.isStepOptional(stepInfo.stepNumber)">Optional</div>\n  </div>\n</md-button>\n\n<div class="ms-stepper-step-content" ng-transclude></div>\n\n<div class="ms-stepper-controls" layout="row" layout-align="start center" ng-show="MsStepper.isStepCurrent(stepInfo.stepNumber)">\n  <md-button class="md-accent md-raised" ng-disabled="MsStepper.isFirstStep()" ng-click="MsStepper.gotoPreviousStep()">\n    Back\n  </md-button>\n\n  <md-button class="md-accent md-raised" ng-if="!MsStepper.isLastStep()" ng-disabled="!MsStepper.isStepValid(MsStepper.currentStepNumber)" ng-click="MsStepper.gotoNextStep()">\n    Next\n  </md-button>\n\n  <md-button type="submit" class="md-accent md-raised" ng-click="MsStepper.resetForm()" ng-if="MsStepper.isLastStep()" ng-disabled="!MsStepper.isFormValid()">\n    Submit\n  </md-button>\n</div>'),e.put("app/core/directives/ms-stepper/templates/vertical/vertical.html",'<div class="ms-stepper-vertical">\n  <div class="ms-stepper-vertical-line"></div>\n  <div class="ms-stepper-steps" ng-transclude></div>\n</div>'),e.put("app/core/directives/ms-tab-scroll/ms-tab-scroll.html",'<div layout="row">\n  <md-button class="md-icon-button md-mini width-25 no-margin scroll-arrow" ng-click="vm.onTabScroll(\'left\')" ng-if="vm.canScroll(\'left\') == true">\n    <md-icon md-font-icon="icon-chevron-left" class="icon s26"></md-icon>\n  </md-button>\n  <div id="bar-container" layout="row" class="bar-container">\n    <div ng-transclude id="tab-container" layout="row" layout-align="start center" class="scroll-container">\n    </div>\n  </div>\n  <md-button class="md-icon-button md-mini width-25 no-margin scroll-arrow" ng-click="vm.onTabScroll(\'right\')" ng-if="vm.canScroll(\'right\') == true">\n    <md-icon md-font-icon="icon-chevron-right" class="icon s26"></md-icon>\n  </md-button>\n</div>'),e.put("app/core/directives/ms-timezone/ms-timezone.html",'<md-select ng-model="ngModel" class="no-margin" ng-change="ngChange()">\n  <md-option ng-value="null">NONE</md-option>\n  <md-option ng-repeat="t in timezone | orderBy:\'utcOffset\'" value="{{t.name}}">{{t.name}} ({{t.offsetStr}})</md-option>\n</md-select>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-counter/ms-widget-engine.counter.html",'<div class="pt-8 pb-32" layout="column" layout-align="center center" layout-fill ng-controller="MsWidgetEngineCounterController as vm">\n  <div ng-class="\'font-size-\' + (vm.fontSize * 3)" ng-style="{\'color\': widget.foreground}">\n    {{ vm.getCount(widget) }}\n  </div>\n  <div ng-class="\'font-size-\' + vm.fontSize" ng-style="{\'color\': widget.foreground}">{{ \'TOOLS.\' +  vm.label | uppercase | translate }}<span ng-if="vm.filtered">*</span></div>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-multibar-chart/ms-widget-engine.multibar-chart.html",'<div ng-controller="MsWidgetEngineMultibarChartController as vm" ng-init="vm.getMultiBarChart(widget)" layout="column" layout-fill>\n\n  <span ng-show="false">{{ vm.getMultiBarChart(widget)}}</span>\n\n  <canvas style="overflow:scroll" id="bar" class="chart-horizontal-bar" chart-data="vm.multiBarChart.data" chart-options="vm.multiBarChart.options" chart-series="vm.multiBarChart.series" chart-labels="vm.multiBarChart.labels">\n  </canvas>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-pie-chart/ms-widget-engine.pie-chart.html",'<div ng-controller="MsWidgetEnginePieChartController as vm" ng-init="vm.getPieChart(widget)" layout="column" layout-fill>\n\n  <span ng-show="false">{{ vm.getPieChart(widget)}}</span>\n\n  <canvas style="overflow:scroll" id="pie" class="chart-pie" chart-data="vm.pieChart.data" chart-labels="vm.pieChart.labels" chart-options="vm.pieChart.options">\n  </canvas>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-web-report/ms-widget-engine.web-report.html",'<div ng-controller="MsWidgetEngineWebReportController as vm" ng-init="vm.onInit(widget)">\n  <dl ng-if="vm.error">\n    <dt class="text-bold">Query Error</dt>\n    <dd>{{vm.error.sql}}</dd>\n    <dt>Message</dt>\n    <dd>{{vm.error.msg}}</dd>\n  </dl>\n  <md-toolbar class="md-table-toolbar md-default">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead">{{vm.title}}</span>\n      <div flex></div>\n      <md-button class="md-icon-button" ng-click="vm.onInit(widget)" aria-label="refresh">\n        <md-icon md-font-icon="icon-refresh"></md-icon>\n      </md-button>\n      <span ng-if="vm.refresh && vm.countDown" class="md-subhead blue-fg">{{vm.countDown}}</span>\n    </div>\n  </md-toolbar>\n  <md-table-container ng-if="!vm.error">\n    <table md-table md-progress="vm.promise">\n      <thead md-head>\n        <tr md-row>\n          <th md-column ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-repeat="row in vm.results.rows">\n          <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n        </tr>\n        <tr md-row ng-if="!vm.results.rows.length">\n          <td md-cell colspan="{{vm.columns.length}}">\n            <div layout="row" layout-align="center center">\n              <span>No Data</span>\n            </div>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.results.count}}" md-on-paginate="vm.getResults" md-page-select></md-table-pagination>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine.html",'<div gridster="vm.config">\n  <ul>\n    <li gridster-item="widget" ng-repeat="widget in vm.config.widgets">\n      <md-card layout-fill>\n        <md-toolbar class="height-40" ng-style="{\'background-color\': widget.background, \'color\': widget.foreground }">\n          <div class="md-toolbar-tools height-40 no-margin" layout="row" layout-align="start center">\n            <a ng-href="{{widget.link ? widget.link : \'javascript:void(0)\'}}" ng-style="{\'color\': widget.foreground, \'font-size\': (widget.titleFontSize || 12) }" class="text-truncate" flex>\n              {{ widget.title || \'No Title\' }}\n            </a>\n            <md-button ng-if="!vm.config.preview" class="draggable md-icon-button width-30 no-margin no-padding" aria-label="Move">\n              <md-tooltip><span translate="TOOLS.MOVE_WIDGET">Move</span></md-tooltip>\n              <md-icon md-font-icon="icon-cursor-move" class="s20" ng-style="{\'color\': widget.foreground}"></md-icon>\n            </md-button>\n            <md-menu ng-if="!vm.config.preview">\n              <md-button ng-click="$mdOpenMenu($event)" class="md-icon-button width-30 no-margin no-padding" aria-label="More">\n                <md-icon md-font-icon="icon-dots-vertical" class="s20" ng-style="{\'color\': widget.foreground}"></md-icon>\n              </md-button>\n              <md-menu-content>\n                <md-menu-item>\n                  <md-button ng-click="vm.onEdit({widget: widget})" translate="TOOLS.EDIT_WIDGET">Edit\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.onDelete({widget: widget})" translate="TOOLS.DELETE_WIDGET">\n                    Delete</md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n\n          </div>\n        </md-toolbar>\n        <md-card-content class="resizable" layout="column" layout-align="center center" flex ng-style="{\'background-color\': widget.background, \'color\': widget.foreground}">\n          <div ng-switch="widget.type" layout-fill>\n            <iframe ng-switch-when="iframe|custom" ng-switch-when-separator="|" ng-src="{{vm.getTrustedURL(widget.attrs[0].value)}}" frameborder=0 style="border:0px; width:100%; height:100%;"></iframe>\n            <ds-widget-clock ng-class="\'font-size-\' + (widget.attrs[2].value || 12)" ng-switch-when="clock" digital-format="widget.attrs[0].value" gmt-offset="widget.attrs[1].value" data-show-digital show-gmt-info></ds-widget-clock>\n            <div ng-switch-default layout-fill>\n              <div ng-include="widget.templateUrl" layout-fill></div>\n            </div>\n          </div>\n        </md-card-content>\n      </md-card>\n    </li>\n  </ul>\n</div>'),e.put("app/core/layouts/content-only.html",'<div id="layout-content-only" class="template-layout" layout="column" flex>\n  <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n</div>'),e.put("app/core/layouts/content-with-toolbar.html",'<div id="layout-content-with-toolbar" class="template-layout" layout="column" flex>\n  <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp" ui-view="toolbar"></md-toolbar>\n  <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n\n  <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n</div>'),e.put("app/core/layouts/horizontal-navigation.html",'<div id="layout-horizontal-navigation" class="template-layout" layout="column" flex>\n\n  <div id="toolbar-navigation-container" class="md-whiteframe-1dp" layout="column" layout-align="space-between start">\n    <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp" ui-view="toolbar"></md-toolbar>\n    <div id="horizontal-navigation" ui-view="navigation" layout="row" layout-align="start end" flex></div>\n  </div>\n\n  <div id="content-container" flex layout="column">\n    <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n  </div>\n\n  <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n\n</div>'),e.put("app/core/layouts/vertical-navigation-fullwidth-toolbar-2.html",'<div id="layout-vertical-navigation-fullwidth-toolbar-2" class="template-layout" layout="column" flex>\n\n  <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp md-accent" ui-view="toolbar"></md-toolbar>\n\n  <div id="main-container" layout="row" flex>\n    <md-sidenav id="vertical-navigation" class="md-primary-bg" md-is-locked-open="$mdMedia(\'gt-sm\')" md-component-id="navigation" ui-view="navigation"></md-sidenav>\n\n    <div id="content-container" flex layout="column">\n      <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n    </div>\n\n    <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n  </div>\n\n\n</div>'),e.put("app/core/layouts/vertical-navigation-fullwidth-toolbar.html",'<div id="layout-vertical-navigation-fullwidth-toolbar" class="template-layout" layout="column" flex>\n\n  <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp md-accent" ui-view="toolbar"></md-toolbar>\n\n  <div id="main-container" layout="row" flex>\n    <md-sidenav id="vertical-navigation" class="md-primary-bg" md-is-locked-open="$mdMedia(\'gt-sm\')" md-component-id="navigation" ui-view="navigation"></md-sidenav>\n\n    <div id="content-container" flex layout="column">\n      <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n    </div>\n\n    <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n  </div>\n\n\n</div>'),e.put("app/core/layouts/vertical-navigation.html",'<div id="header" ui-view="header"></div>\n\n<div id="layout-vertical-navigation" class="template-layout" layout="row" flex>\n\n  <md-sidenav id="vertical-navigation" class="md-primary-bg" md-is-locked-open="$mdMedia(\'gt-sm\')" md-component-id="navigation" ui-view="navigation" ng-if="!vm.isAgent()"></md-sidenav>\n\n  <div id="content-container" flex layout="column">\n    <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp" ui-view="toolbar"></md-toolbar>\n\n    <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n  </div>\n\n  <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n\n</div>\n\n<div id="footer" ui-view="footer"></div>'),e.put("app/core/theme-options/theme-options.html",'<div class="ms-theme-options-button md-primary-bg" ng-click="toggleOptionsSidenav()">\n  <md-icon md-font-icon="icon-cog" class="white-text"></md-icon>\n</div>\n\n<md-sidenav md-component-id="motion-theme-options" class="md-sidenav-right">\n\n  <div class="ms-theme-options-list" layout="column">\n    <div class="theme-option layout-options">\n      <div class="option-title">Layout Style:</div>\n      <md-radio-group layout="row" layout-align="start start" layout-wrap ng-model="vm.layoutStyle" ng-change="vm.updateLayoutStyle()">\n        <md-radio-button ng-repeat="layoutStyle in vm.layoutStyles" ng-value="layoutStyle.value">\n          <div layout="column" layout-align="center center">\n            <img ng-src="{{layoutStyle.figure}}">\n            <span class="text-center font-size-12 mt-8">{{layoutStyle.label}}</span>\n          </div>\n        </md-radio-button>\n      </md-radio-group>\n    </div>\n\n    <md-divider></md-divider>\n\n    <div class="theme-option">\n      <div class="option-title">Layout Mode:</div>\n      <md-radio-group layout="row" layout-align="start center" ng-model="vm.layoutMode" ng-change="vm.updateLayoutMode()">\n        <md-radio-button ng-repeat="layoutMode in vm.layoutModes" ng-value="layoutMode.value">\n          {{layoutMode.label}}\n        </md-radio-button>\n      </md-radio-group>\n    </div>\n\n    <md-divider></md-divider>\n\n    <div class="theme-option color-palettes">\n      <div class="option-title">Color Palette:</div>\n      <div layout="row" layout-align="start start" layout-wrap>\n        <md-button ng-repeat="(themeName, theme) in vm.themes.list" class="md-raised theme-button" layout="row" layout-align="center center" aria-label="{{themeName}}" ng-click="vm.setActiveTheme(themeName)" ng-style="{\'background-color\': theme.primary.color,\'border-color\': theme.accent.color,\'color\': theme.primary.contrast1}" ng-class="{active: vm.getActiveTheme().name === themeName}">\n          <md-icon ng-style="{\'color\': theme.primary.contrast1}" md-font-icon="icon-palette" class="icon s32"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n</md-sidenav>'),e.put("app/errors/404/error-404.html",'<div id="error-404" layout="column" layout-align="center center">\n  <div class="content" layout="column" layout-align="center center">\n    <div class="error-code" translate="ERROR404.CODE">404</div>\n\n    <div class="message" translate="ERROR404.MESSAGE">Sorry but we couldn’t find the page you are looking for</div>\n    <ms-search-bar on-search="vm.search(query)" on-result-click="vm.searchResultClick(item)" debounce="300">Search for anything</ms-search-bar>\n\n    \x3c!-- <div class="search md-whiteframe-1dp" layout="row" layout-align="start center">\n            <md-icon md-font-icon="icon-magnify" class="icon s24"></md-icon>\n            <input ng-model="vm.search" type="text" placeholder="Search for anything" translate translate-attr-placeholder="ERROR404.SEARCH" flex>\n        </div> --\x3e\n\n    <a class="md-button md-raised md-primary back-link" href="/" translate="ERROR404.GO_BACK">Go back to dashboard</a>\n  </div>\n</div>'),e.put("app/errors/500/error-500.html",'<div id="error-500" layout="column" layout-align="center center">\n  <div ng-if="!vm.send" class="content" layout="column" layout-align="center center">\n    <div class="error-code" translate="ERROR500.CODE">500</div>\n    <div class="message" translate="ERROR500.MESSAGE">Well, you broke the internet!</div>\n    <div class="sub-message" translate="ERROR500.SUBMESSAGE">Just kidding, looks like we have an internal issue, please try again in couple minutes\n    </div>\n    <a class="md-button md-raised md-primary back-link" href="/" translate="ERROR500.GO_BACK">Go back to dashboard</a>\n    <md-button class="md-raised md-warn" ng-click="vm.sendReport()" translate="ERROR500.REPORT">Report this problem</md-button>\n  </div>\n  <pre ng-if="!vm.send">\n  {{vm.error}}\n  </pre>\n  <div ng-if="vm.send" class="content" layout="column" layout-align="center center">\n    <div class="error-code">#{{vm.code}}</div>\n    <div class="message" translate="ERROR500.JIRA_MESSAGE">Your request has been received and will be processed shortly.</div>\n    <div class="sub-message" translate="ERROR500.JIRA_SUBMESSAGE">Sorry for the inconvenience. If you have any questions or concerns, please do not hesitate to contact us.</div>\n    <a class="md-button md-raised md-primary back-link" href="/" translate="ERROR500.GO_BACK">Go back to dashboard</a>\n  </div>\n</div>'),e.put("app/footer/layouts/vertical-navigation/footer.html",'<div layout="row" layout-align="start center">\n  <ms-info-bar ng-if="!vm.cookieAlertHide" on-close="vm.cookieAlertOnClose()" class="grey-100-bg">\n    <div layout="row" layout-align="start center">\n      <span translate="FOOTER.COOKIE_LAW" flex class="text-center grey-600-fg"></span>\n    </div>\n  </ms-info-bar>\n</div>'),e.put("app/forgot/forgot.html",'<div id="forgot-password" class="flex-scrollable" layout="column" ng-init="vm.onInit()">\n  <div id="forgot-password-form-wrapper" layout="column" layout-align="center center">\n    <div id="forgot-password-form" class="md-whiteframe-8dp">\n\n      <img src="/api/settings/1/logo_login" alt="logo_login" class="logo_login" />\n\n      <div class="title" translate="FORGOTPASSWORD.TITLE">Recover your password</div>\n\n      <form name="forgotPasswordForm" novalidate>\n        <md-input-container class="md-block" md-no-float>\n          <input type="email" name="email" ng-model="vm.form.email" placeholder="Email address" translate translate-attr-placeholder="FORGOTPASSWORD.EMAIL_ADRESS" ng-pattern="/^.+@.+\\..+$/" required>\n          <div ng-messages="forgotPasswordForm.email.$error" role="alert" multiple>\n            <div ng-message="required">\n              <span translate="FORGOTPASSWORD.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="FORGOTPASSWORD.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-button type="button" ng-click="vm.forgotPassword()" class="md-raised md-accent submit-button" aria-label="RESET MY PASSWORD" ng-disabled="forgotPasswordForm.$invalid || forgotPasswordForm.$pristine" translate="FORGOTPASSWORD.SEND_RESET_LINK" translate-attr-aria-label="FORGOTPASSWORD.SEND_RESET_LINK">\n          SEND RESET LINK\n        </md-button>\n      </form>\n\n      <div class="login" layout="row" layout-align="center center">\n        <a class="link" ui-sref="app.login" translate="FORGOTPASSWORD.GO_BACK">Go back to login</a>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/header/layouts/vertical-navigation/header.html",'\x3c!-- <div layout="row" layout-align="start center">\n    <ms-info-bar ng-if="vm.currentUser.role == \'admin\' && !vm.newsAlertHide" on-close="vm.newsAlertOnClose()" class="green-600-bg white-fg">\n        <div layout="row" layout-align="start center">\n            <md-icon md-font-icon="icon-message-text-outline" class="icon margin-right-10 s20"></md-icon>\n            <div flex hide-xs translate="HEADER.NEWS"></div>\n        </div>\n    </ms-info-bar>\n</div> --\x3e'),e.put("app/login/login.html",'<div id="login" class="flex-scrollable" layout="column">\n  <div id="login-form-wrapper" layout="column" layout-align="center center">\n    <div id="login-form" class="md-whiteframe-8dp">\n\n      <img src="/api/settings/1/logo_login" alt="logo_login" class="logo_login" />\n      \x3c!-- <img src="assets/images/logos/login.png" alt="motion_logo_login" /> --\x3e\n\n      <div class="md-subhead padding-top-45" translate="LOGIN.TITLE">Log in to your account</div>\n\n      <form name="loginForm" novalidate ng-if="!vm.progressLogin">\n        <md-input-container class="md-block" md-no-float>\n          <input type="input" name="name" ng-model="vm.form.name" autofocus aria-label="username" translate translate-attr-placeholder="LOGIN.USERNAME" required>\n          <div ng-messages="loginForm.name.$error" role="alert" multiple>\n            <div ng-message="required">\n              <span translate="LOGIN.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block" md-no-float>\n          <input type="password" name="password" ng-model="vm.form.password" aria-label="password" translate translate-attr-placeholder="LOGIN.PASSWORD" required>\n          <div ng-messages="loginForm.password.$error" role="alert" multiple>\n            <div ng-message="required">\n              <span translate="LOGIN.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <div class="remember-forgot-password" layout="row" layout-xs="column" layout-align="end center">\n          \x3c!-- <md-checkbox class="remember-me" ng-model="data.cb1" aria-label="Remember Me">\n                        <span translate="LOGIN.REMEMBER_ME">Remember Me</span>\n                    </md-checkbox> --\x3e\n          <a ui-sref="app.forgot" class="forgot-password md-accent-color" style="cursor:pointer;" translate="LOGIN.FORGOT_PASSWORD">Forgot Password?</a>\n        </div>\n\n        <b layout="row" layout-align="center center" class="md-padding" ng-if="vm.message">\n          <font color="red">{{vm.message}}</font>\n        </b>\n        <md-button type="submit" ng-click="vm.login()" class="md-raised md-accent submit-button" aria-label="LOGIN" translate="LOGIN.LOG_IN" translate-attr-aria-label="LOGIN.LOG_IN">\n          LOG IN\n        </md-button>\n      </form>\n\n      <md-progress-circular ng-if="vm.progressLogin" md-diameter="96"></md-progress-circular>\n\n      <div ng-if="vm.googleSsoEnabled || vm.adSsoEnabled" class="separator">\n        <span class="text" translate="LOGIN.OR">OR</span>\n      </div>\n\n      <md-button ng-if="vm.googleSsoEnabled" ng-click="vm.loginOauth(\'google\')" class="md-raised google">\n        <div layout="row" layout-align="center center">\n          <span>\n            <md-icon md-font-icon="fab fa-google" class="s16"></md-icon>\n            <span translate="LOGIN.WITH_GOOGLE">Log in with Google</span>\n          </span>\n        </div>\n      </md-button>\n\n      <md-button ng-if="vm.adSsoEnabled" ng-click="vm.loginAD()" class="md-raised ad">\n        <div layout="row" layout-align="center center">\n          <span>\n            <md-icon md-font-icon="fas fa-ad" class="s16"></md-icon>\n            <span style="text-transform: none" translate="LOGIN.WITH_AD">Log in with Active Directory</span>\n          </span>\n        </div>\n      </md-button>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/analytics/views/extractedReports/create/dialog.html",'<md-dialog class="extractedReport-dialog" aria-label="New ExtractedReport">\n  <form name="extractedReportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.REPORTNAME">ReportName</label>\n        <input type="" name="name" ng-model="vm.extractedReport.name" ng-required="true" autofocus>\n\n        <div ng-messages="extractedReportForm[\'name\'].$error" ng-show="extractedReportForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.REPORTNAME_REQUIRED">ReportName field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input type="" name="basename" ng-model="vm.extractedReport.basename" ng-required="true">\n\n        <div ng-messages="extractedReportForm[\'basename\'].$error" ng-show="extractedReportForm[\'basename\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newExtractedReport" ng-click="vm.saveExtractedReport()" class="send-button md-accent md-raised" ng-disabled="extractedReportForm.$invalid || extractedReportForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newExtractedReport" ng-click="vm.addNewExtractedReport()" class="send-button md-accent md-raised" ng-disabled="extractedReportForm.$invalid" aria-label="ADD" translate="ANALYTICS.ADD_EXTRACTEDREPORT" translate-attr-aria-label="ANALYTICS.ADD_EXTRACTEDREPORT">\n          ADD EXTRACTEDREPORT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newExtractedReport" ng-click="vm.deleteExtractedReport($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/extractedReports/extractedReports.html",'<div id="extractedReports" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-chart-line" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="ANALYTICS.EXTRACTEDREPORTS">ExtractedReports</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="ANALYTICS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedExtractedReports.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedExtractedReports =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="ANALYTICS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-extractedReports-count">\n          <span>{{vm.selectedExtractedReports.length}}</span>\n          <span translate="ANALYTICS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="ANALYTICS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllExtractedReports()" translate="ANALYTICS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectExtractedReports()" translate="ANALYTICS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedExtractedReports" csv-label="true" filename="extractedReports.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedExtractedReports($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- EXTRACTEDREPORT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedExtractedReports" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getExtractedReports">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'ANALYTICS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'ANALYTICS.REPORTNAME\' | translate }}</th>\n                <th md-column md-order-by="basename">{{ \'ANALYTICS.NAME\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'ANALYTICS.TYPE\' | translate }}</th>\n                <th md-column md-order-by="startDate">{{ \'ANALYTICS.DATE_RANGE_FROM\' | translate }}</th>\n                <th md-column md-order-by="endDate">{{ \'ANALYTICS.DATE_RANGE_TO\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'ANALYTICS.GENERATED_AT\' | translate }}</th>\n                <th md-column md-order-by="status">{{ \'ANALYTICS.STATUS\' | translate }}</th>\n                <th md-column md-order-by="output">{{ \'ANALYTICS.OUTPUT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.extractedReports.rows.length">\n                <td md-cell colspan="10">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="extractedReport" md-select-id="id" ng-repeat="extractedReport in vm.extractedReports.rows">\n                <td md-cell ng-if="extractedReport.userpic"><img class="avatar" alt="{{extractedReport.name}}" ng-src="api/users/{{extractedReport.id}}/avatar" /></td>\n                <td md-cell ng-if="!extractedReport.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{extractedReport.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="id ">{{extractedReport.id}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="name ">{{extractedReport.name}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="basename ">{{extractedReport.basename}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="type ">{{extractedReport.type}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="startDate ">{{extractedReport.startDate | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="endDate ">{{extractedReport.endDate | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="createdAt ">{{extractedReport.createdAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="status ">{{extractedReport.status}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="output ">{{extractedReport.output}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(extractedReport, $event    )" translate="ANALYTICS.EDIT_EXTRACTEDREPORT">\n                          Edit ExtractedReport\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="extractedReport.status == \'Completed\'">\n\n                        <md-button ng-click="vm.downloadfile2(extractedReport, $event  , \'analytics/extracted_reports\'   )" translate="ANALYTICS.DOWNLOAD_EXTRACTEDREPORT">\n                          Download ExtractedReport\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(extractedReport, $event    )" translate="ANALYTICS.DELETE_EXTRACTEDREPORT">\n                          Delete ExtractedReport\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.extractedReports.count}}" md-on-paginate="vm.getExtractedReports" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / EXTRACTEDREPORT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/analytics/views/metrics/create/dialog.html",'<md-dialog class="metric-dialog" aria-label="New Metric">\n  <form name="metricForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.metric.name" ng-required="true" autofocus>\n\n        <div ng-messages="metricForm[\'name\'].$error" ng-show="metricForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.TABLE">Table</label>\n        <md-select name="table" ng-model="vm.metric.table" required>\n          <md-option ng-value="\'report_agent\'">Agent Report</md-option>\n          <md-option ng-value="\'report_call\'">Call Report</md-option>\n          <md-option ng-value="\'cdr\'">CDR</md-option>\n          <md-option ng-value="\'chat_websites\'">Chat Website</md-option>\n          <md-option ng-value="\'chat_interactions\'">Chat Interaction</md-option>\n          <md-option ng-value="\'chat_messages\'">Chat Messages</md-option>\n          <md-option ng-value="\'chat_offline_messages\'">Chat Offline Messages</md-option>\n          <md-option ng-value="\'chat_queues\'">Chat Queues</md-option>\n          <md-option ng-value="\'report_chat_queue\'">Chat Report Queue</md-option>\n          <md-option ng-value="\'report_chat_transfer\'">Chat Report Transfer</md-option>\n          <md-option ng-value="\'cm_companies\'">Companies</md-option>\n          <md-option ng-value="\'report_call_transfer\'">Call transfer report</md-option>\n          <md-option ng-value="\'cm_contacts\'">Contacts</md-option>\n          <md-option ng-value="\'report_square\'">CSquare Report</md-option>\n          <md-option ng-value="\'report_square_details\'">CSquare Details Report</md-option>\n          <md-option ng-value="\'report_dial\'">Dial Report</md-option>\n          <md-option ng-value="\'cm_hopper\'">Dialer Hopper Processing</md-option>\n          <md-option ng-value="\'cm_hopper_history\'">Dialer Hopper Logs</md-option>\n          <md-option ng-value="\'cm_hopper_final\'">Dialer Hopper Final</md-option>\n          <md-option ng-value="\'mail_accounts\'">Email Account</md-option>\n          <md-option ng-value="\'mail_interactions\'">Email Interaction</md-option>\n          <md-option ng-value="\'mail_messages\'">Email Messages</md-option>\n          <md-option ng-value="\'mail_queues\'">Email Queues</md-option>\n          <md-option ng-value="\'report_mail_queue\'">Email Report Queue</md-option>\n          <md-option ng-value="\'report_mail_transfer\'">Email Report Transfer</md-option>\n          <md-option ng-value="\'fax_accounts\'">Fax Account</md-option>\n          <md-option ng-value="\'fax_interactions\'">Fax Interaction</md-option>\n          <md-option ng-value="\'fax_messages\'">Fax Messages</md-option>\n          <md-option ng-value="\'fax_queues\'">Fax Queues</md-option>\n          <md-option ng-value="\'report_fax_queue\'">Fax Report Queue</md-option>\n          <md-option ng-value="\'report_fax_transfer\'">Fax Report Transfer</md-option>\n          <md-option ng-value="\'report_jscripty_sessions\'">Jscripty Sessions</md-option>\n          <md-option ng-value="\'report_jscripty_questions\'">Jscripty Questions</md-option>\n          <md-option ng-value="\'report_jscripty_answers\'">Jscripty Answers</md-option>\n          <md-option ng-value="\'cm_lists\'">Lists</md-option>\n          <md-option ng-value="\'report_member\'">Member Report</md-option>\n          <md-option ng-value="\'openchannel_accounts\'">Openchannel Account</md-option>\n          <md-option ng-value="\'openchannel_interactions\'">Openchannel Interaction</md-option>\n          <md-option ng-value="\'openchannel_messages\'">Openchannel Messages</md-option>\n          <md-option ng-value="\'openchannel_queues\'">Openchannel Queues</md-option>\n          <md-option ng-value="\'report_openchannel_queue\'">Openchannel Report Queue</md-option>\n          <md-option ng-value="\'report_openchannel_transfer\'">Openchannel Report Transfer</md-option>\n          <md-option ng-value="\'report_queue\'">Queue Report</md-option>\n          <md-option ng-value="\'sms_accounts\'">SMS Account</md-option>\n          <md-option ng-value="\'sms_interactions\'">SMS Interaction</md-option>\n          <md-option ng-value="\'sms_messages\'">SMS Messages</md-option>\n          <md-option ng-value="\'sms_queues\'">SMS Queues</md-option>\n          <md-option ng-value="\'report_sms_queue\'">SMS Report Queue</md-option>\n          <md-option ng-value="\'report_sms_transfer\'">SMS Report Transfer</md-option>\n          <md-option ng-value="\'users\'">Users</md-option>\n          <md-option ng-value="\'voice_recordings\'">Voice Recordings</md-option>\n          <md-option ng-value="\'whatsapp_accounts\'">Whatsapp Account</md-option>\n          <md-option ng-value="\'whatsapp_interactions\'">Whatsapp Interaction</md-option>\n          <md-option ng-value="\'whatsapp_messages\'">Whatsapp Messages</md-option>\n          <md-option ng-value="\'whatsapp_queues\'">Whatsapp Queues</md-option>\n          <md-option ng-value="\'report_whatsapp_queue\'">Whatsapp Report Queue</md-option>\n          <md-option ng-value="\'report_whatsapp_transfer\'">Whatsapp Report Transfer</md-option>\n        </md-select>\n        <div ng-messages="metricForm[\'table\'].$error" ng-show="metricForm[\'table\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.TABLE_REQUIRED">Table field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.METRIC">Metric</label>\n        <input type="text" name="metric" ng-model="vm.metric.metric" ng-required="true">\n\n        <div ng-messages="metricForm[\'metric\'].$error" ng-show="metricForm[\'metric\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.METRIC_REQUIRED">Metric field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.metric.description">\n\n        <div ng-messages="metricForm[\'description\'].$error" ng-show="metricForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMetric" ng-click="vm.saveMetric()" class="send-button md-accent md-raised" ng-disabled="metricForm.$invalid || metricForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMetric" ng-click="vm.addNewMetric()" class="send-button md-accent md-raised" ng-disabled="metricForm.$invalid" aria-label="ADD" translate="ANALYTICS.ADD_METRIC" translate-attr-aria-label="ANALYTICS.ADD_METRIC">\n          ADD METRIC\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMetric" ng-click="vm.deleteMetric($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/metrics/metrics.html",'<div id="metrics" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-chart-line" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="ANALYTICS.METRICS">Metrics</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="ANALYTICS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMetrics.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMetrics =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="ANALYTICS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-metrics-count">\n          <span>{{vm.selectedMetrics.length}}</span>\n          <span translate="ANALYTICS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="ANALYTICS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMetrics()" translate="ANALYTICS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMetrics()" translate="ANALYTICS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMetrics" csv-label="true" filename="metrics.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMetrics($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- METRIC TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMetrics" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMetrics">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'ANALYTICS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'ANALYTICS.NAME\' | translate }}</th>\n                <th md-column md-order-by="table">{{ \'ANALYTICS.TABLE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'ANALYTICS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.metrics.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="metric" md-select-id="id" ng-repeat="metric in vm.metrics.rows">\n                <td md-cell ng-if="metric.userpic"><img class="avatar" alt="{{metric.name}}" ng-src="api/users/{{metric.id}}/avatar" /></td>\n                <td md-cell ng-if="!metric.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{metric.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="id ">{{metric.id}}</td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="name ">{{metric.name}}</td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="table ">{{ vm.arraytable[metric.table].option }}</td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="description ">{{metric.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(metric, $event    )" translate="ANALYTICS.EDIT_METRIC">\n                          Edit Metric\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(metric, $event    )" translate="ANALYTICS.DELETE_METRIC">\n                          Delete Metric\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.metrics.count}}" md-on-paginate="vm.getMetrics" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / METRIC TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD METRIC BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-metric-button" ng-click="vm.createOrEditMetric($event)" aria-label="add metric" translate translate-attr-aria-label="ANALYTICS.ADD_METRIC">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD METRIC BUTTON --\x3e\n</div>'),e.put("app/main/apps/analytics/views/reports/copy/dialog.html",'<md-dialog class="report-dialog" aria-label="Run Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.COPY_REPORT">Copy Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input name="name" ng-model="vm.report.name" required md-autofocus>\n        <div ng-messages="reportForm.name.$error" ng-show="reportForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label translate="ANALYTICS.SELECT_NODE">Select Node</label>\n        <div js-tree="vm.treeCustomConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.copyReport()" class="send-button md-accent md-raised" ng-disabled="!vm.currentNode" aria-label="COPY" translate="ANALYTICS.COPY_REPORT" translate-attr-aria-label="ANALYTICS.COPY_REPORT">\n          COPY REPORT\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/create/dialog.html",'<md-dialog class="report-dialog" aria-label="New Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.report.name" required md-autofocus>\n        <div ng-messages="reportForm.name.$error" ng-show="reportForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newReport">\n        <label translate="ANALYTICS.TABLE">Table</label>\n        <md-select ng-model="vm.report.table" required>\n          <md-option ng-repeat="table in vm.tables | orderBy:\'name\'" ng-value="table.name">{{table.name}}</md-option>\n        </md-select>\n        <div ng-messages="reportForm.table.$error" ng-show="reportForm.table.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.TABLE_REQUIRED">Table field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.report.description">\n        <div ng-messages="reportForm.description.$error" ng-show="reportForm.description.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-autocomplete ng-if="vm.newReport" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-items="table in vm.tables | filter:vm.searchText" md-item-text="table.name" md-min-length="0" md-selected-item-change="vm.selectedTableChange(table)" placeholder="Select the table to Join">\n        <md-item-template>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{table.name}}</span>\n        </md-item-template>\n        <md-not-found>\n          No states matching "{{vm.searchText}}" were found.\n        </md-not-found>\n      </md-autocomplete>\n\n      <md-card ng-if="vm.newReport" md-theme="default" md-theme-watch ng-repeat="table in vm.joinTables">\n        <md-card-title>\n          <md-card-title-text layout="row">\n            <div layout="row" flex="50">\n              <span class="md-subhead">{{table.name}}</span>\n            </div>\n            <div layout="row" layout-align="end center" flex>\n              <md-button class="md-icon-button" ng-click="vm.removeJoin($index)">\n                <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n              </md-button>\n            </div>\n          </md-card-title-text>\n        </md-card-title>\n        <md-card-content>\n          <md-select ng-model="table.parentKey" placeholder="Select the parent key" ng-init="table.parentFields = []; vm.getFields(table, \'parentFields\', vm.report.table)" required>\n            <md-option ng-repeat="field in table.parentFields" ng-value="field">{{field}}</md-option>\n          </md-select>\n          <md-select ng-model="table.foreignKey" placeholder="Select the foreign key" ng-init="table.foreignFields = []; vm.getFields(table, \'foreignFields\', table.name)" required>\n            <md-option ng-repeat="field in table.foreignFields" ng-value="field">{{field}}</md-option>\n          </md-select>\n          <md-select ng-model="table.type" placeholder="Select join type" required>\n            <md-option ng-repeat="join in vm.joinTypes" ng-value="join.key">{{join.value}}</md-option>\n          </md-select>\n        </md-card-content>\n      </md-card>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newReport" ng-click="vm.saveReport()" class="send-button md-accent md-raised" ng-disabled="reportForm.$invalid || reportForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newReport" ng-click="vm.addNewReport()" class="send-button md-accent md-raised" ng-disabled="reportForm.$invalid || reportForm.$pristine" aria-label="ADD" translate="ANALYTICS.ADD_REPORT" translate-attr-aria-label="ANALYTICS.ADD_REPORT">\n          ADD REPORT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newReport" ng-click="vm.deleteReport($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/edit/condition/group.html",'<md-card class="padding-horizontal-15 padding-top-15">\n  <div layout="row" ng-if="vm_rc.crudPermissions.canEdit">\n    <md-input-container class="md-block" flex>\n      <label translate="ANALYTICS.OPERATOR">Operator</label>\n      <md-select ng-model="group.operator" required>\n        <md-option value="AND">AND</md-option>\n        <md-option value="OR">OR</md-option>\n      </md-select>\n      <div ng-messages="conditionsForm.operator.$error" ng-show="conditionsForm.operator.$touched" role="alert">\n        <div ng-message="required">\n          <span translate="ANALYTICS.ERRORS.OPERATOR_REQUIRED">Operator field is required</span>\n        </div>\n      </div>\n    </md-input-container>\n    <md-input-container class="md-block">\n      <md-button class="md-raised md-accent" ng-click="vm_rc.addCondition(group.rules)">\n        <md-icon md-font-icon="icon-plus"></md-icon> {{\'ANALYTICS.CONDITION\' | translate}}\n      </md-button>\n    </md-input-container>\n    <md-input-container class="md-block">\n      <md-button class="md-raised md-accent" ng-click="vm_rc.addGroup(group.rules)">\n        <md-icon md-font-icon="icon-plus"></md-icon> {{\'ANALYTICS.GROUP\' | translate}}\n      </md-button>\n    </md-input-container>\n    <div flex></div>\n    <md-input-container class="md-block" ng-if="parent">\n      <md-button class="md-raised md-warn" ng-click="vm_rc.deleteConfirm(parent, index, $event)">\n        <md-icon md-font-icon="icon-delete"></md-icon> {{\'ANALYTICS.GROUP\' | translate}}\n      </md-button>\n    </md-input-container>\n  </div>\n  <div layout="column" ng-repeat="rule in group.rules track by $index">\n    <div layout="row" ng-if="!rule.group">\n      <md-input-container class="md-block" flex>\n        <label translate="ANALYTICS.COLUMN">COLUMN</label>\n        <md-select name="field" ng-model="rule.field" ng-disabled="!vm_rc.crudPermissions.canEdit" required>\n          <md-optgroup label="{{vm_rc.report.table}}">\n            <md-option ng-repeat="column in vm_rc.columns" value="{{vm_rc.report.table}}.{{column}}">{{column}}</md-option>\n          </md-optgroup>\n          <md-optgroup ng-if="vm_rc.report.joins" ng-repeat="join in vm_rc.report.joins" label="{{join.foreignTable}}">\n            <md-option ng-repeat="field in join.foreignTableFields" value="{{join.foreignTable}}.{{field}}">{{field}}</md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="conditionsForm.field.$error" ng-show="conditionsForm.field.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.COLUMN_REQUIRED">Column field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" flex>\n        <label translate="ANALYTICS.CONDITION">CONDITION</label>\n        <md-select name="condition" ng-model="rule.condition" ng-disabled="!vm_rc.crudPermissions.canEdit" required>\n          <md-option ng-repeat="condition in vm_rc.conditions" ng-value="condition">{{condition}}</md-option>\n        </md-select>\n        <div ng-messages="conditionsForm.condition.$error" ng-show="conditionsForm.condition.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm_rc.isValueByCondition(rule.condition)" class="md-block" flex>\n        <label translate="ANALYTICS.VALUE">VALUE</label>\n        <input type="text" name="value" ng-model="rule.value" ng-disabled="!vm_rc.crudPermissions.canEdit" required md-autofocus>\n        <div ng-messages="conditionsForm.value.$error" ng-show="conditionsForm.value.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm_rc.crudPermissions.canEdit" flex>\n        <md-button class="md-fab md-mini md-warn" aria-label="Delete row" ng-click="vm_rc.deleteConfirm(group.rules, $index, $event)">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </md-input-container>\n    </div>\n    <div ng-if="rule.group" ng-include="\'app/main/apps/analytics/views/reports/edit/condition/group.html\'" ng-init="parent=group.rules;index=$index;group=rule.group"></div>\n  </div>\n</md-card>'),e.put("app/main/apps/analytics/views/reports/edit/field/dialog.html",'<md-dialog class="reportField-dialog" aria-label="New Report Field">\n  <form name="reportFieldForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{vm.title}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <pre></pre>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.reportField.type" ng-change="vm.reportField.field = undefined" required>\n          <md-option value="column">Select a column</md-option>\n          <md-option value="metric">Select an existing metric</md-option>\n          <md-option value="custom">Write a custom metric</md-option>\n        </md-select>\n        <div ng-messages="reportForm.type.$error" ng-show="reportForm.type.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-switch on="vm.reportField.type">\n        <md-input-container class="md-block" ng-switch-when="column">\n          <label translate="ANALYTICS.COLUMN">Column Name</label>\n          <md-select name="column" ng-model="vm.reportField.field" required>\n            <md-optgroup label="{{vm.report.table}}">\n              <md-option ng-repeat="column in vm.columns" value="{{vm.report.table}}.{{column}}">{{column}}</md-option>\n              \x3c!-- <md-option ng-repeat="column in vm.columns" ng-value="">{{column}}</md-option> --\x3e\n            </md-optgroup>\n            <md-optgroup ng-if="vm.report.joins" ng-repeat="join in vm.report.joins" label="{{join.foreignTable}}">\n              <md-option ng-repeat="field in join.foreignTableFields" value="{{join.foreignTable}}.{{field}}">{{field}}</md-option>\n            </md-optgroup>\n          </md-select>\n          <div ng-messages="reportForm.column.$error" ng-show="reportForm.column.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="ANALYTICS.ERRORS.COLUMN_REQUIRED">Column field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" ng-switch-when="metric">\n          <label translate="ANALYTICS.METRIC_NAME">Metric Name</label>\n          <md-select name="metric" ng-model="vm.reportField.MetricId" required>\n            <md-option ng-repeat="metric in vm.metrics" ng-value="metric.id">{{metric.name}}</md-option>\n          </md-select>\n          <div ng-messages="reportForm.metric.$error" ng-show="reportForm.metric.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="ANALYTICS.ERRORS.METRIC_REQUIRED">Metric field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" ng-switch-when="custom">\n          <label translate="ANALYTICS.CUSTOM_METRIC">Custom Metric</label>\n          <input type="text" name="field" ng-model="vm.reportField.field" required md-autofocus>\n          <div ng-messages="reportFieldForm.field.$error" ng-show="reportFieldForm.field.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="ANALYTICS.ERRORS.CUSTOM_METRIC_REQUIRED">Custom Metric field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.reportField.alias" ng-required="vm.reportField.type === \'custom\' || vm.reportField.type === \'metric\'">\n        <div ng-messages="reportFieldForm.alias.$error" ng-show="reportFieldForm.alias.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.reportField.type !== \'metric\'">\n        <label translate="ANALYTICS.FUNCTION">Function</label>\n        <md-select name="function" ng-model="vm.reportField.function">\n          <md-option ng-value="null">No Function</md-option>\n          <md-option ng-repeat="function in vm.sqlUtil.getFunctions" ng-value="function.value">{{function.value}}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.reportField.type !== \'metric\'">\n        <label translate="ANALYTICS.FORMAT">Format</label>\n        <md-select name="format" ng-model="vm.reportField.format">\n          <md-option ng-value="null">No Format</md-option>\n          <md-option ng-repeat="format in vm.sqlUtil.getFormats" ng-value="format.value">{{format.value}}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.GROUP_BY">Group By</label>\n        <md-select name="groupBy" ng-model="vm.reportField.groupBy">\n          <md-option ng-repeat="gb in vm.sqlUtil.getGroupBy" ng-value="gb.value">{{gb.value ? \'Yes\' : \'No\'}}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.ORDER_BY">Order By</label>\n        <md-select name="orderBy" ng-model="vm.reportField.orderBy">\n          <md-option ng-value="null">No Order</md-option>\n          <md-option ng-repeat="ob in vm.sqlUtil.getOrderBy" ng-value="ob.value">{{ob.value}}</md-option>\n        </md-select>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newReportField" ng-click="vm.saveReportField()" class="send-button md-accent md-raised" ng-disabled="reportFieldForm.$invalid || reportFieldForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newReportField" ng-click="vm.addNewReportField()" class="send-button md-accent md-raised" ng-disabled="reportFieldForm.$invalid || reportFieldForm.$pristine" aria-label="ADD" translate="ANALYTICS.ADD_REPORTFIELD" translate-attr-aria-label="ANALYTICS.ADD_REPORTFIELD">\n          ADD REPORT FIELD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newReportField" ng-click="vm.deleteReportField($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/edit/view.html",'<div id="analytics-report" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-reports-button md-icon-button" aria-label="Go to reports" ng-click="vm.gotoReports()" translate translate-attr-aria-label="ANALYTICS.GO_TO_ANALYTICSQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="report-image" hide-xs>\n          <img ng-src="assets/images/business/reports.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.report.id}} {{vm.report.name}}\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="ANALYTICS.CREATED_AT"></span> <span>{{vm.report.createdAt | date:\'medium\'}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span>{{vm.report.description}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div>\n      <md-button type="submit" ng-click="vm.saveReport()" ng-disabled="generalForm.$pristine && conditionsForm.$pristine" class="send-button md-accent md-raised" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="ANALYTICS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="ANALYTICS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="ANALYTICS.NAME">Name</label>\n                <input type="text" name="name" ng-disabled="!vm.crudPermissions.canEdit" ng-model="vm.report.name" required md-autofocus>\n                <div ng-messages="generalForm.name.$error" ng-show="generalForm.name.$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="ANALYTICS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-disabled="!vm.crudPermissions.canEdit" ng-model="vm.report.description">\n                <div ng-messages="generalForm.description.$error" ng-show="generalForm.description.$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="ANALYTICS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="ANALYTICS.FIELDS">FIELDS</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container fields md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ReportFieldsController as vm_rf" ng-init="vm_rf.init(vm.report, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_rf.selectedReportFields.length">\n                <div class="md-toolbar-tools">\n                  <div layout="row" layout-align="start center">\n                    <div layout="column" layout-align="start start">\n                      <div class="md-subhead" translate="ANALYTICS.FIELDS">\n                        <span translate="ANALYTICS.FIELDS">FIELDS</span>\n                      </div>\n                      <div class="h4">\n                        <span translate="ANALYTICS.TABLE">TABLE</span> <span class="text-bold">{{vm.report.table}}</span>\n                      </div>\n                      <div class="h4" ng-if="vm.report.joins && vm.report.joins.length && vm.isArray(vm.report.joins)">\n                        <span>Join</span> <span class="text-bold">{{ vm.mapArray(vm.report.joins, \'foreignTable\') }}</span>\n                      </div>\n                    </div>\n                  </div>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm_rf.query.filter = query" on-collapse="vm_rf.query.filter = undefined" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-if="vm_rf.crudPermissions.canEdit" ng-click="vm_rf.createOrEditReportField($event)" aria-label="add field" translate translate-attr-label="ANALYTICS.ADD_FIELD">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_rf.selectedReportFields.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_rf.selectedReportFields.length}} {{vm_rf.selectedReportFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_rf.deleteSelectedReportFields($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container>\n                <table md-table md-row-select="vm_rf.crudPermissions.canDelete" multiple ng-model="vm_rf.selectedReportFields" md-progress="vm_rf.promise">\n                  <thead md-head md-order="vm_rf.query.sort" md-on-reorder="vm_rf.getReportFields">\n                    <tr md-row>\n                      <th md-column width="10px" ng-if="vm_rf.crudPermissions.canEdit">\n                        <md-icon md-font-icon="icon-drag-vertical"></md-icon>\n                      </th>\n                      <th md-column>Type</th>\n                      <th md-column>Column or Metric</th>\n                      <th md-column>Alias</th>\n                      <th md-column>Function</th>\n                      <th md-column>Format</th>\n                      <th md-column>Group By</th>\n                      <th md-column>Order By</th>\n                      <th md-column width="10px" ng-if="vm_rf.crudPermissions.canEdit"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body ng-sortable="vm_rf.sortableTable">\n                    <tr md-row md-select="reportField" md-select-id="id" ng-repeat="reportField in vm_rf.reportFields.rows">\n                      <td md-cell class="handle" ng-if="vm_rf.crudPermissions.canEdit">\n                        <md-icon md-font-icon="icon-drag-vertical" class="s16"></md-icon>\n                      </td>\n                      <td md-cell>\n                        <div ng-if="reportField.MetricId && !reportField.custom" ng-click="vm_rf.createOrEditReportField($event, reportField)" class="icon icon-shape-plus s16"></div>\n                        <div ng-if="!reportField.MetricId && reportField.custom" ng-click="vm_rf.createOrEditReportField($event, reportField)" class="icon icon-pencil-box-outline s16"></div>\n                        <div ng-if="!reportField.MetricId && !reportField.custom" ng-click="vm_rf.createOrEditReportField($event, reportField)" class="icon icon-view-column s16"></div>\n                      </td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)">{{reportField.MetricId ? vm_rf.getMetricName(reportField.MetricId) : reportField.field}}</td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)">{{reportField.alias}}</td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.function">{{reportField.function}}</span><span ng-if="!reportField.function">--</span></td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.format">{{reportField.format}}</span><span ng-if="!reportField.format">--</span></td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.groupBy">YES</span><span ng-if="!reportField.groupBy">--</span></td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.orderBy">{{reportField.orderBy}}</span><span ng-if="!reportField.orderBy">--</span></td>\n                      <td md-cell class="actions" ng-if="vm_rf.crudPermissions.canEdit">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_rf.createOrEditReportField($event, reportField)" translate="ANALYTICS.EDIT_REPORTFIELD">\n                                Edit Field\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                              <md-button ng-click="vm_rf.deleteConfirm(reportField, $event)" translate="ANALYTICS.DELETE_REPORTFIELD">\n                                Delete Field\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="ANALYTICS.CONDITIONS">CONDITIONS</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container conditions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ReportConditionsController as vm_rc" ng-init="vm_rc.init(vm.report, vm.crudPermissions)">\n              <div class="pb-16" layout="row" layout-align="start center">\n                <div class="h2 secondary-text" translate="ANALYTICS.CONDITION">CONDITION</div>\n              </div>\n              <form name="conditionsForm" novalidate>\n                <div ng-if="vm_rc.report.condition.group" ng-include="\'app/main/apps/analytics/views/reports/edit/condition/group.html\'" ng-init="group=vm_rc.report.condition.group"></div>\n              </form>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab md-on-select="vm.previewReport()">\n        <md-tab-label>\n          <span translate="ANALYTICS.PREVIEW">PREVIEW</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container result md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n              <div ng-if="!vm.error" class="h2 secondary-text" translate="ANALYTICS.LIMITED_RESULT">LIMITED RESULT</div>\n            </div>\n            <dl ng-if="vm.error">\n              <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n              <dd>{{vm.error.sql}}</dd>\n              <dt translate="ANALYTICS.MESSAGE">Message</dt>\n              <dd>{{vm.error.msg}}</dd>\n            </dl>\n            <md-table-container ng-if="!vm.error">\n              <table md-table>\n                <thead md-head>\n                  <tr md-row>\n                    <th ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n                  </tr>\n                </thead>\n                <tbody md-body>\n                  <tr md-row ng-repeat="row in vm.rows">\n                    <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n                  </tr>\n                  <tr md-row ng-if="!vm.rows.length">\n                    <td md-cell colspan="{{vm.columns.length}}"><span translate="ANALYTICS.NO_DATA">NO DATA</span></td>\n                  </tr>\n                </tbody>\n              </table>\n            </md-table-container>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab md-on-select="vm.queryReport()">\n        <md-tab-label>\n          <span>Query</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container result md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n              <div ng-if="!vm.error" class="h2 secondary-text">SQL</div>\n            </div>\n            <dl ng-if="vm.error">\n              <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n              <dd>{{vm.error.sql}}</dd>\n              <dt translate="ANALYTICS.MESSAGE">Message</dt>\n              <dd>{{vm.error.msg}}</dd>\n            </dl>\n            <div ng-if="!vm.error">\n              {{vm.queryResult}}\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/analytics/views/reports/preview/dialog.html",'<md-dialog aria-label="Run Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.PREVIEW_REPORT">Preview Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n          <div ng-if="!vm.error" class="h2 secondary-text" translate="ANALYTICS.LIMITED_RESULT">LIMITED RESULT</div>\n        </div>\n        <dl ng-if="vm.error">\n          <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n          <dd>{{vm.error.sql}}</dd>\n          <dt translate="ANALYTICS.MESSAGE">Message</dt>\n          <dd>{{vm.error.msg}}</dd>\n        </dl>\n        <md-table-container ng-if="!vm.error">\n          <table md-table md-progress="vm.promise">\n            <thead md-head>\n              <tr md-row>\n                <th md-column ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-repeat="row in vm.rows">\n                <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n              </tr>\n              <tr md-row ng-if="!vm.rows.length">\n                <td md-cell colspan="{{vm.columns.length}}"><span translate="ANALYTICS.NO_DATA">NO DATA</span></td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div flex></div>\n      <md-button type="submit" ng-click="vm.closeDialog()" class="md-raised" aria-label="CLOSE" translate="ANALYTICS.CLOSE" translate-attr-aria-label="ANALYTICS.CLOSE">\n        CLOSE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/reports.html",'<div id="reports" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-chart-line" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="ANALYTICS.REPORTS">Reports</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedReports.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedReports =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="ANALYTICS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-reports-count">\n          <span>{{vm.selectedReports.length}}</span>\n          <span translate="ANALYTICS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="ANALYTICS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllReports()" translate="ANALYTICS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectReports()" translate="ANALYTICS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedReports" csv-label="true" filename="reports.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button ng-if="vm.crudPermissions.canDelete && vm.currentNode.custom" class="md-icon-button" ng-click="vm.deleteSelectedReports($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div layout="column" flex="30">\n      <md-card class="padding-top-5 padding-horizontal-10 padding-bottom-0">\n        \x3c!-- SEARCH --\x3e\n        <div layout="row" layout-align="start center">\n          <label for="searchFolder" class="m-0">\n            <md-icon md-font-icon="icon-magnify"></md-icon>\n          </label>\n          <md-input-container md-no-float class="margin-horizontal-0 margin-bottom-0 margin-top-10" flex>\n            <input id="searchFolder" placeholder="Search folder" type="text" ng-model="vm.search" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="ANALYTICS.SEARCH_FOR_FOLDER">\n          </md-input-container>\n        </div>\n        \x3c!-- / SEARCH --\x3e\n      </md-card>\n      <md-card class="padding-10 scrollable">\n        <div js-tree="vm.treeDefaultConfig" tree-events-obj="vm.treeDefaultEvents" ng-model="vm.treeDefaultData" tree="vm.treeDefaultInstance"></div>\n      </md-card>\n      <md-card class="padding-10 scrollable">\n        <div js-tree="vm.treeCustomConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n      </md-card>\n    </div>\n    <md-card flex="70">\n      <md-toolbar class="md-table-toolbar md-default">\n        <div class="md-toolbar-tools">\n          <span class="h2 secondary-text">{{vm.currentNode.text}}</span>\n          <p ng-if="vm.currentPath">\n            <span class="text-boxed">{{vm.currentPath}}</span>\n          </p>\n          <div flex></div>\n          <ms-search-bar on-search="vm.getReports()" query="vm.query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n          <div flow-init flow-file-added="vm.importReport($file, $event, $flow)">\n            <md-button ng-if="vm.crudPermissions.canEdit && vm.currentNode.custom" class="md-icon-button" aria-label="import report" translate translate-attr-label="ANALYTICS.IMPORT_REPORT" flow-btn>\n              <md-icon md-font-icon="icon-upload"></md-icon>\n            </md-button>\n          </div>\n          <md-button ng-if="vm.crudPermissions.canEdit && vm.currentNode.custom" class="md-icon-button" ng-click="vm.createOrEditReport($event)" aria-label="add report" translate translate-attr-label="ANALYTICS.ADD_REPORT">\n            <md-icon md-font-icon="icon-plus"></md-icon>\n          </md-button>\n        </div>\n      </md-toolbar>\n      <md-table-container>\n        <table md-table md-row-select multiple ng-model="vm.selectedReports" md-progress="vm.promise">\n          <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getReports">\n            <tr md-row>\n              <th md-column md-order-by="id" width="10px">{{ \'ANALYTICS.ID\' | translate }}</th>\n              <th md-column md-order-by="name">{{ \'ANALYTICS.NAME\' | translate }}</th>\n              <th md-column md-order-by="description">{{ \'ANALYTICS.DESCRIPTION\' | translate }}</th>\n              <th md-column md-order-by="createdAt">{{ \'ANALYTICS.CREATED_AT\' | translate }}</th>\n              <th md-column width="10px"></th>\n            </tr>\n          </thead>\n          <tbody md-body>\n            <tr md-row ng-hide="vm.reports.rows.length">\n              <td md-cell colspan="5">\n                <div layout="row" layout-align="center center">\n                  <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                </div>\n              </td>\n            </tr>\n            <tr md-row md-select="report" md-select-id="id" ng-repeat="report in vm.reports.rows">\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="id">{{report.id}}</td>\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="name">{{report.name}}</td>\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="description">{{report.description}}</td>\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="createdAt">{{report.createdAt | date:\'medium\'}}</td>\n              <td md-cell class="actions">\n                <md-menu>\n                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                  </md-button>\n\n                  <md-menu-content width="3">\n                    <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                      <md-button ng-click="vm.copydialog(report, $event)" translate="ANALYTICS.COPY_REPORT">\n                        Copy Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item>\n                      <md-button ng-click="vm.previewdialog(report, $event)" translate="ANALYTICS.PREVIEW_REPORT">\n                        Preview Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item>\n                      <md-button ng-click="vm.rundialog(report, $event)" translate="ANALYTICS.RUN_REPORT">\n                        Run Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item>\n                      <md-button ng-click="vm.downloadfile(report, $event)" translate="ANALYTICS.DOWNLOAD_JSON_REPORT">\n                        Download Json Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-divider ng-if="vm.crudPermissions.canEdit && vm.crudPermissions.canDelete && vm.currentNode.custom">\n                    </md-menu-divider>\n                    <md-menu-item ng-if="vm.crudPermissions.canEdit && vm.currentNode.custom">\n                      <md-button ng-click="vm.editstate(report, $event)" translate="ANALYTICS.EDIT_REPORT">\n                        Edit Report\n                      </md-button>\n                    </md-menu-item>\n\n                    <md-menu-item ng-if="vm.crudPermissions.canDelete && vm.currentNode.custom">\n                      <md-button ng-click="vm.deleteconfirm(report, $event)" translate="ANALYTICS.DELETE_REPORT">\n                        Delete Report\n                      </md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </td>\n            </tr>\n          </tbody>\n        </table>\n      </md-table-container>\n\n      <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.reports.count}}" md-on-paginate="vm.getReports" md-page-select></md-table-pagination>\n    </md-card>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/analytics/views/reports/run/dialog.html",'<md-dialog class="report-dialog" aria-label="Run Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.RUN_REPORT">Run Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input name="name" ng-model="vm.export.name" required md-autofocus>\n        <div ng-messages="reportForm.name.$error" ng-show="reportForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.FORMAT">FORMAT</label>\n        <md-select name="format" ng-model="vm.export.output" required>\n          <md-option value="csv">CSV</md-option>\n          <md-option value="xlsx">Excel (XLSX)</md-option>\n          <md-option value="pdf">PDF</md-option>\n          <md-option value="web">Web</md-option>\n        </md-select>\n        <div ng-messages="reportForm.format.$error" ng-show="reportForm.format.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.FORMAT_REQUIRED">Format field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div layout="row">\n        <div class="md-block" flex>\n          <mdp-date-picker mdp-open-on-click required name="dateRangeFrom" mdp-placeholder="Date Range From" mdp-format="YYYY-MM-DD" mdp-max-date="vm.dateRangeTo" ng-model="vm.export.startDate">\n            <div ng-messages="reportForm.dateRangeFrom.$error" ng-show="reportForm.dateRangeFrom.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_REQUIRED">Date Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_INVALID">Date Range From field is invalid</span>\n              </div>\n              <div ng-message="maxDate">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_MAX_INVALID">Date Range From Max field is invalid</span>\n              </div>\n            </div>\n          </mdp-date-picker>\n        </div>\n        <div class="md-block" flex>\n          <mdp-date-picker mdp-open-on-click required name="dateRangeTo" mdp-placeholder="Date Range To" mdp-format="YYYY-MM-DD" mdp-min-date="vm.dateRangeFrom" ng-model="vm.export.endDate">\n            <div ng-messages="reportForm.dateRangeTo.$error" ng-show="reportForm.dateRangeTo.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_TO_REQUIRED">Date Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_TO_INVALID">Date Range From field is invalid</span>\n              </div>\n              <div ng-message="minDate">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_MIN_INVALID">Date Range From Min field is invalid</span>\n              </div>\n            </div>\n          </mdp-date-picker>\n        </div>\n      </div>\n      <div layout="row">\n        <div class="md-block" flex>\n          <mdp-time-picker required name="timeRangeFrom" mdp-placeholder="Time Range From" mdp-format="HH:mm:ss" mdp-auto-switch="true" mdp-max-date="vm.dateRangeTo" ng-model="vm.export.startDate">\n            <div ng-messages="reportForm.timeRangeFrom.$error" ng-show="reportForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_FROM_REQUIRED">Time Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex>\n          <mdp-time-picker required name="timeRangeTo" mdp-placeholder="Time Range To" mdp-format="HH:mm:ss" mdp-auto-switch="true" mdp-min-date="vm.dateRangeFrom" ng-model="vm.export.endDate">\n            <div ng-messages="reportForm.timeRangeTo.$error" ng-show="reportForm.timeRangeTo.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_TO_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.runReport($event)" class="send-button md-accent md-raised" ng-disabled="reportForm.$invalid" aria-label="RUN" translate="ANALYTICS.RUN_REPORT" translate-attr-aria-label="ANALYTICS.RUN_REPORT">\n          RUN REPORT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-click="vm.refreshDate()" aria-label="REFRESH" translate translate-attr-aria-label="ANALYTICS.REFRESH">\n          <md-icon md-font-icon="icon-refresh"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.REFRESH">REFRESH</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/run/web/dialog.html",'<md-dialog class="web-dialog" aria-label="Show Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.WEB_REPORT">Web Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n        </div>\n        <dl ng-if="vm.error">\n          <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n          <dd>{{vm.error.sql}}</dd>\n          <dt translate="ANALYTICS.MESSAGE">Message</dt>\n          <dd>{{vm.error.msg}}</dd>\n        </dl>\n        <md-table-container ng-if="!vm.error">\n          <table md-table md-progress="vm.promise">\n            <thead md-head>\n              <tr md-row>\n                <th md-column ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-repeat="row in vm.results.rows">\n                <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n              </tr>\n              <tr md-row ng-if="!vm.results.rows.length">\n                <td md-cell colspan="{{vm.columns.length}}">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_DATA">NO DATA</span>\n                  </div>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.results.count}}" md-on-paginate="vm.getResults" md-page-select></md-table-pagination>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div flex></div>\n      <md-button type="submit" ng-click="vm.closeDialog()" class="md-raised" aria-label="CLOSE" translate="ANALYTICS.CLOSE" translate-attr-aria-label="ANALYTICS.CLOSE">\n        CLOSE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/odbcs/create/dialog.html",'<md-dialog class="odbc-dialog" aria-label="New Odbc">\n  <form name="odbcForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.odbc.name" ng-required="true" autofocus>\n\n        <div ng-messages="odbcForm[\'name\'].$error" ng-show="odbcForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DSN">DSN</label>\n        <input type="text" name="dsn" ng-model="vm.odbc.dsn" ng-required="true">\n\n        <div class="hint"><span translate="CALLYSQUARE.HELP.DSN"></span></div>\n        <div ng-messages="odbcForm[\'dsn\'].$error" ng-show="odbcForm[\'dsn\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.DSN_REQUIRED">DSN field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.odbc.description">\n\n        <div ng-messages="odbcForm[\'description\'].$error" ng-show="odbcForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOdbc" ng-click="vm.saveOdbc()" class="send-button md-accent md-raised" ng-disabled="odbcForm.$invalid || odbcForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOdbc" ng-click="vm.addNewOdbc()" class="send-button md-accent md-raised" ng-disabled="odbcForm.$invalid" aria-label="ADD" translate="CALLYSQUARE.ADD_ODBC" translate-attr-aria-label="CALLYSQUARE.ADD_ODBC">\n          ADD ODBC\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOdbc" ng-click="vm.deleteOdbc($event)" aria-label="DELETE" translate translate-attr-aria-label="CALLYSQUARE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CALLYSQUARE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/odbcs/odbcs.html",'<div id="odbcs" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-sitemap" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CALLYSQUARE.ODBC">ODBC</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CALLYSQUARE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedODBC.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedODBC =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CALLYSQUARE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-odbcs-count">\n          <span>{{vm.selectedODBC.length}}</span>\n          <span translate="CALLYSQUARE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CALLYSQUARE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllODBC()" translate="CALLYSQUARE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectODBC()" translate="CALLYSQUARE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedODBC" csv-label="true" filename="odbcs.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedODBC($event)" aria-label="delete selected" translate translate-attr-label="CALLYSQUARE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- ODBC TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedODBC" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getODBC">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CALLYSQUARE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CALLYSQUARE.NAME\' | translate }}</th>\n                <th md-column md-order-by="dsn">{{ \'CALLYSQUARE.DSN\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CALLYSQUARE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.odbcs.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CALLYSQUARE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="odbc" md-select-id="id" ng-repeat="odbc in vm.odbcs.rows">\n                <td md-cell ng-if="odbc.userpic"><img class="avatar" alt="{{odbc.name}}" ng-src="api/users/{{odbc.id}}/avatar" /></td>\n                <td md-cell ng-if="!odbc.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{odbc.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="id ">{{odbc.id}}</td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="name ">{{odbc.name}}</td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="dsn ">{{odbc.dsn}}</td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="description ">{{odbc.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CALLYSQUARE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(odbc, $event    )" translate="CALLYSQUARE.EDIT_ODBC">\n                          Edit Odbc\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestOdbc(odbc, $event    )" translate="CALLYSQUARE.TEST_ODBC">\n                          Test Odbc\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(odbc, $event    )" translate="CALLYSQUARE.DELETE_ODBC">\n                          Delete Odbc\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CALLYSQUARE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CALLYSQUARE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CALLYSQUARE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.odbcs.count}}" md-on-paginate="vm.getODBC" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / ODBC TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD ODBC BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-odbc-button" ng-click="vm.createOrEditOdbc($event)" aria-label="add odbc" translate translate-attr-aria-label="CALLYSQUARE.ADD_ODBC">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD ODBC BUTTON --\x3e\n</div>'),e.put("app/main/apps/callysquare/views/projects/create/dialog.html",'<md-dialog class="project-dialog" aria-label="New Project">\n  <form name="projectForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{vm.title | translate}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NAME">Name</label>\n        <input name="name" ng-model="vm.project.name" required md-autofocus ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-disabled="!vm.newProject">\n        <div ng-messages="projectForm.name.$error" ng-show="projectForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DESCRIPTION">Description</label>\n        <input name="description" ng-model="vm.project.description">\n        <div ng-messages="projectForm.description.$error" ng-show="projectForm.description.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.openFromEditor" class="md-block">\n        \x3c!-- Added to check if I\'m opening the dialog directly from the square editor --\x3e\n        <md-switch ng-model="vm.newWindow" aria-label="{{\'CALLYSQUARE.OPEN_NEW_WINDOW\' | translate }}"><span translate="CALLYSQUARE.OPEN_NEW_WINDOW"></span></md-switch>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newProject" ng-click="vm.saveProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid || projectForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newProject" ng-click="vm.addNewProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid || projectForm.$pristine" aria-label="ADD" translate="CALLYSQUARE.ADD_PROJECT" translate-attr-aria-label="CALLYSQUARE.ADD_PROJECT">\n          ADD PROJECT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newProject" ng-click="vm.deleteProject($event)" aria-label="DELETE" translate translate-attr-aria-label="CALLYSQUARE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CALLYSQUARE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/dialog/dialog.html",'<md-dialog class="project-dialog" aria-label="New dialog" ng-init="vm.onInit()">\n  <form name="dialogForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.EDIT"></span> <span translate="CALLYSQUARE.{{vm.cellName | uppercase}}"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block" ng-repeat="attribute in vm.attributes" ng-switch="attribute.name">\n        <label translate="CALLYSQUARE.{{attribute.name | uppercase}}">{{attribute.name | ucfirst }}</label>\n\n        \x3c!--  START SELECT INPUT --\x3e\n        <md-select name="{{attribute.name}}" ng-model="attribute.value" ng-disabled="!vm.crudPermissions.canEdit" ng-switch-when-separator="|" ng-switch-when="answer|trunk_name|trunk_id|queue_id|file_id|variable_id|google_cloud_tts_text_type|google_tts_language|ispeech_tts_language|ispeech_asr_language|google_asr_language|hiddendigitspos|odbc_id|project_id|beep|account_id|interval_id|template_id|list_id|recordingFormat|callback_priority|aws_polly_voice|aws_polly_region|aws_lex_region|sms_account_id|findBy|pause_id|aws_text_type|dialogflow_language|ndagenerate_audio|ndaactivity_type|languageCode|ssmlGender|method|dialogflowV2_language" ng-required="attribute.required">\n          <md-option ng-if="attribute.defaultValue" ng-value="\'\'"> - None - </md-option>\n          <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-disabled="v.canSelect === false">{{v.option}}</md-option>\n          <md-option ng-if="!vm.values[attribute.name].length" value="-1">No {{attribute.name}} available!</md-option>\n        </md-select>\n        \x3c!--  END SELECT INPUT --\x3e\n\n        \x3c!--  START SELECT INPUT --\x3e\n        <md-select name="{{attribute.name}}" ng-model="attribute.value" ng-disabled="!vm.crudPermissions.canEdit" ng-switch-when-separator="|" ng-switch-when="sip_id" ng-required="attribute.required">\n          <md-optgroup label="{{\'CALLYSQUARE.AGENTS\' | translate}}">\n            <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-if="v.group === \'agent\'" ng-disabled="v.canSelect === false">{{v.option}}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{\'CALLYSQUARE.TELEPHONES\' | translate}}">\n            <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-if="v.group === \'telephone\'" ng-disabled="v.canSelect === false">{{v.option}}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{\'CALLYSQUARE.USERS\' | translate}}">\n            <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-if="v.group === \'admin\' || v.group === \'user\'">{{v.option}}</md-option>\n          </md-optgroup>\n          <md-option ng-if="!vm.values[attribute.name].length" value="-1">No {{attribute.name}} available!</md-option>\n        </md-select>\n        \x3c!--  END SELECT INPUT --\x3e\n\n        \x3c!--  START NUMBER INPUT --\x3e\n        <div ng-switch-when="timeout">\n          <div ng-switch="vm.cellName">\n            <input ng-switch-when-separator="|" ng-switch-when="answer|ext_dial|dial|queue" type="number" step="any" name="{{attribute.name}}" min="0" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n            <input ng-switch-when-separator="|" ng-switch-when="record|ispeechasr|googleasr" type="number" step="any" name="{{attribute.name}}" min="-1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n            <input ng-switch-when-separator="|" ng-switch-when="restapi" type="number" step="any" name="{{attribute.name}}" min="1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n            <input ng-switch-default type="number" step="any" name="{{attribute.name}}" min="0" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n          </div>\n        </div>\n        <input ng-switch-when-separator="|" ng-switch-when="speed" type="number" step="any" name="{{attribute.name}}" min="-10" max="-10" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n        <input ng-switch-when-separator="|" ng-switch-when="maxdigit|mindigit|digit" type="number" step="any" name="{{attribute.name}}" min="1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n        <input ng-switch-when-separator="|" ng-switch-when="retry|response|hiddendigitsnum|priority" type="number" step="any" name="{{attribute.name}}" min="1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n        \x3c!--  END NUMBER INPUT --\x3e\n\n        \x3c!--  START TEXTAREA INPUT --\x3e\n        <textarea name="{{attribute.name}}" ng-model="attribute.value" ng-switch-when-separator="|" ng-switch-when="query|sms_text|condition|text|custom_action_data|headers|body|rawHeaders|rawBody|private_key" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit"></textarea>\n        \x3c!--  END TEXTAREA INPUT --\x3e\n\n        \x3c!-- START URL INPUT --\x3e\n        <input ng-switch-when-separator="|" ng-switch-when="ndauth_url|ndassistant_url|url" type="url" name="{{attribute.name}}" ng-model="attribute.value" ng-required="attribute.required">\n        \x3c!-- END URL INPUT --\x3e\n\n        \x3c!--  START TEXT INPUT --\x3e\n        <input ng-switch-default name="{{attribute.name}}" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit">\n        <div class=\'hint\' ng-if="attribute.name === \'text\' && vm.cellName === \'tts\' ">\n          <span translate="CALLYSQUARE.HELP.MAX_TEXT_TTS" class="ng-scope">Max 250 chars are supported</span>\n        </div>\n        \x3c!--  END TEXT INPUT--\x3e\n\n        <div class="hint" ng-if="attribute.help">\n          <span translate="CALLYSQUARE.HELP.{{attribute.name | uppercase}}"></span>\n        </div>\n        <div ng-messages="dialogForm[attribute.name].$error" ng-show="dialogForm[attribute.name].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.FIELD_REQUIRED">The field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="vm.crudPermissions.canEdit">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog(true)" class="send-button md-accent md-raised" ng-disabled="dialogForm.$invalid || dialogForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/edit/edit.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="editForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.EDIT_XML"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label>XML</label>\n        <textarea name="preproduction" ng-model="vm.project.preproduction"></textarea>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog(true)" class="send-button md-accent md-raised" ng-disabled="editForm.$invalid" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/import/import.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="importForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.IMPORT_XML"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div id="xml-uploader" flow-init="vm.ngFlowOptions" flow-name="vm.ngFlow.flow" flow-file-added="vm.fileAdded($file)" flow-drop flow-drag-enter="vm.dropping=true" flow-drag-leave="vm.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n        <div class="drop-text hint-text" layout="row" layout-align="center center">\n          <span translate="CALLYSQUARE.DROP_TO_UPLOAD">Drop to upload</span>\n        </div>\n\n        <div class="upload-button" layout="column" layout-align="center center">\n          <md-button class="md-accent md-raised" flow-btn>\n            Upload\n          </md-button>\n          <span class="secondary-text mt-8" translate="CALLYSQUARE.DROP_TO_UPLOAD_MESSAGE">You can also drop files here to upload. Only XML - Max. 5MB</span>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog()" class="send-button md-accent md-raised" ng-disabled="importForm.$invalid" aria-label="CLOSE" translate="CALLYSQUARE.CLOSE" translate-attr-aria-label="CALLYSQUARE.CLOSE">\n          CLOSE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/info/info.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="descriptionFrom" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.UPDATE_INFO"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DESCRIPTION">Description</label>\n        <input name="description" ng-model="vm.project.description" md-autofocus>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NOTES">Description</label>\n        <textarea name="notes" ng-model="vm.project.notes"></textarea>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.save()" class="send-button md-accent md-raised" ng-disabled="descriptionFrom.$invalid" aria-label="SAVE" translate="CALLYSQUARE.UPDATE_INFO" translate-attr-aria-label="CALLYSQUARE.UPDATE">\n          UPDATE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/open/open.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="openForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.OPEN_PROJECT"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.PROJECT">Project</label>\n        <md-select name="id" ng-model="vm.id" required>\n          <md-option value="{{p.id}}" ng-repeat="p in vm.projects">{{p.name}}</md-option>\n        </md-select>\n        <div ng-messages="openForm.id.$error" ng-show="openForm.id.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.PROJECT_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.newWindow" aria-label="{{\'CALLYSQUARE.OPEN_NEW_WINDOW\' | translate }}"><span translate="CALLYSQUARE.OPEN_NEW_WINDOW"></span></md-switch>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog(true)" class="send-button md-accent md-raised" ng-disabled="openForm.$invalid" aria-label="SAVE" translate="CALLYSQUARE.OPEN_PROJECT" translate-attr-aria-label="CALLYSQUARE.OPEN">\n          OPEN\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/permissionadd/permissionadd.html",'<md-dialog class="projects-dialog" aria-label="projects">\n  <form name="projectsForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CALLYSQUARE.PERMISSIONADD_PROJECTS">Add User Permissions</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions"></ms-dual-multiselect>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/saveAs/saveAs.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="newForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.COPY_PROJECT"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NAME">Name</label>\n        <input name="name" ng-model="vm.project.name" required md-autofocus>\n        <div ng-messages="newForm.name.$error" ng-show="newForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.newWindow" aria-label="{{\'CALLYSQUARE.OPEN_NEW_WINDOW\' | translate }}"><span translate="CALLYSQUARE.OPEN_NEW_WINDOW"></span></md-switch>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.save()" class="send-button md-accent md-raised" ng-disabled="newForm.$invalid" aria-label="SAVE" translate="CALLYSQUARE.COPY_PROJECT" translate-attr-aria-label="CALLYSQUARE.COPY">\n          COPY\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/view.html",'<div id="callysquare-project" class="page-layout simple tabbed" layout="column" ng-init="vm.onInit()">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-projects-button md-icon-button" aria-label="Go to projects" ng-click="vm.gotoProjects()" translate translate-attr-aria-label="CALLYSQUARE.GO_TO_PROJECTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="project-image" hide-xs>\n          <img ng-src="assets/images/business/cprojects.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.project.id}} {{vm.project.name}}\n          </div>\n          <div class="subtitle secondary-text text-truncate">\n            <span ng-if="vm.project.description">{{vm.project.description}} - </span><span translate="CALLYSQUARE.CREATED_AT"></span> <span>{{vm.project.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-if="vm.crudPermissions.canEdit" ng-click="vm.updateInfo($event)" class="md-fab md-yellow-700-bg md-icon-button" aria-label="edit">\n        <md-icon md-font-icon="icon-tooltip-edit"></md-icon>\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <md-content class="callysquare-content">\n\n    <div id="geEditor" class="geEditor"></div>\n\n  </md-content>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/callysquare/views/projects/projects.html",'<div id="projects" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-vector-square" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CALLYSQUARE.PROJECTS">Projects</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    \x3c!-- SEARCH --\x3e\n    <div class="search-input-wrapper" layout="row" layout-align="start center">\n      <label for="search">\n        <md-icon md-font-icon="icon-magnify"></md-icon>\n      </label>\n      <md-input-container md-no-float class="m-0">\n        <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CALLYSQUARE.SEARCH_FOR_ANYONE">\n      </md-input-container>\n    </div>\n    \x3c!-- / SEARCH --\x3e\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedProjects.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedProjects =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CALLYSQUARE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-projects-count">\n          <span>{{vm.selectedProjects.length}}</span>\n          <span translate="CALLYSQUARE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CALLYSQUARE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllProjects()" translate="CALLYSQUARE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectProjects()" translate="CALLYSQUARE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedProjects" csv-label="true" filename="projects.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedProjects($event)" aria-label="delete selected" translate translate-attr-label="CALLYSQUARE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      \x3c!-- PROJECT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedProjects" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getProjects">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'CALLYSQUARE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CALLYSQUARE.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CALLYSQUARE.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="notes">{{ \'CALLYSQUARE.NOTES\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.projects.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CALLYSQUARE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="project" md-select-id="id" ng-repeat="project in vm.projects.rows">\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="id ">{{project.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="name ">{{project.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="description ">{{project.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="notes ">{{project.notes}}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CALLYSQUARE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(project, ev)" translate="CALLYSQUARE.EDIT_PROJECT">\n                          Edit Project\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(project, ev)" translate="CALLYSQUARE.DELETE_PROJECT">\n                          Delete Project\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CALLYSQUARE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CALLYSQUARE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CALLYSQUARE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.projects.count}}" md-on-paginate="vm.getProjects" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PROJECT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD PROJECT BUTTON --\x3e\n  <md-button class="md-fab md-accent md-icon-button" id="add-project-button" ng-if="vm.crudPermissions.canEdit" ng-click="vm.createOrEditProject($event)" aria-label="add project" translate translate-attr-aria-label="CALLYSQUARE.ADD_PROJECT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD PROJECT BUTTON --\x3e\n\n</div>'),e.put("app/main/apps/callysquare/views/squareRecordings/create/dialog.html",'<md-dialog class="squareRecording-dialog" aria-label="New SquareRecording">\n  <form name="squareRecordingForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.FILENAME">Filename</label>\n        <input type="" name="filename" ng-model="vm.squareRecording.filename" ng-required="true" autofocus>\n\n        <div ng-messages="squareRecordingForm[\'filename\'].$error" ng-show="squareRecordingForm[\'filename\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.FILENAME_REQUIRED">Filename field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSquareRecording" ng-click="vm.saveSquareRecording()" class="send-button md-accent md-raised" ng-disabled="squareRecordingForm.$invalid || squareRecordingForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSquareRecording" ng-click="vm.addNewSquareRecording()" class="send-button md-accent md-raised" ng-disabled="squareRecordingForm.$invalid" aria-label="ADD" translate="CALLYSQUARE.ADD_SQUARERECORDING" translate-attr-aria-label="CALLYSQUARE.ADD_SQUARERECORDING">\n          ADD SQUARERECORDING\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSquareRecording" ng-click="vm.deleteSquareRecording($event)" aria-label="DELETE" translate translate-attr-aria-label="CALLYSQUARE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CALLYSQUARE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/squareRecordings/squareRecordings.html",'<div id="squareRecordings" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-sitemap" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CALLYSQUARE.SQUARERECORDINGS">SquareRecordings</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CALLYSQUARE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSquareRecordings.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSquareRecordings =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CALLYSQUARE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-squareRecordings-count">\n          <span>{{vm.selectedSquareRecordings.length}}</span>\n          <span translate="CALLYSQUARE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CALLYSQUARE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSquareRecordings()" translate="CALLYSQUARE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSquareRecordings()" translate="CALLYSQUARE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSquareRecordings" csv-label="true" filename="squareRecordings.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSquareRecordings($event)" aria-label="delete selected" translate translate-attr-label="CALLYSQUARE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SQUARERECORDING TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSquareRecordings" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSquareRecordings">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="filename">{{ \'CALLYSQUARE.FILENAME\' | translate }}</th>\n                <th md-column md-order-by="projectName">{{ \'CALLYSQUARE.PROJECT\' | translate }}</th>\n                <th md-column md-order-by="uniqueid">{{ \'CALLYSQUARE.UNIQUEID\' | translate }}</th>\n                <th md-column md-order-by="callerid">{{ \'CALLYSQUARE.PHONE\' | translate }}</th>\n                <th md-column md-order-by="extension">{{ \'CALLYSQUARE.EXTEN\' | translate }}</th>\n                <th md-column>{{ \'CALLYSQUARE.AUDIO\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'CALLYSQUARE.CREATED_AT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.squareRecordings.rows.length">\n                <td md-cell colspan="8">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CALLYSQUARE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="squareRecording" md-select-id="id" ng-repeat="squareRecording in vm.squareRecordings.rows">\n                <td md-cell ng-if="squareRecording.userpic"><img class="avatar" alt="{{squareRecording.name}}" ng-src="api/users/{{squareRecording.id}}/avatar" /></td>\n                <td md-cell ng-if="!squareRecording.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{squareRecording.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="filename ">{{squareRecording.filename}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="projectName ">{{squareRecording.projectName}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="uniqueid ">{{squareRecording.uniqueid}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="callerid ">{{squareRecording.callerid}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="extension ">{{squareRecording.extension}}</td>\n                <td md-cell class="audio " ng-switch="squareRecording.format">\n                  \x3c!-- audio recording directive --\x3e\n                  <ms-recording ng-switch-when=".wav" id="squareRecording.id" model="\'squareRecording\'"></ms-recording>\n                  \x3c!-- / audio recording directive --\x3e\n                  <span ng-switch-when=".gsm|.WAV" ng-switch-when-separator="|">\n                    <em>{{ \'VOICE.CANT_PLAY_GSM_AUDIO_FILES\' | translate }}</em>\n                  </span>\n                </td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="createdAt ">{{squareRecording.createdAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CALLYSQUARE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadCallySquareRecordings">\n\n                        <md-button ng-click="vm.downloadfile2(squareRecording, $event  , \'square/recordings\'   )" translate="CALLYSQUARE.DOWNLOAD_SQUARERECORDING">\n                          Download SquareRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(squareRecording, $event    )" translate="CALLYSQUARE.DELETE_SQUARERECORDING">\n                          Delete SquareRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CALLYSQUARE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CALLYSQUARE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CALLYSQUARE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.squareRecordings.count}}" md-on-paginate="vm.getSquareRecordings" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SQUARERECORDING TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/chat/views/chatQueues/chatQueues.html",'<div id="chatQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-hangouts" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CHAT.CHATQUEUES">ChatQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CHAT.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedChatQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedChatQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CHAT.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-chatQueues-count">\n          <span>{{vm.selectedChatQueues.length}}</span>\n          <span translate="CHAT.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CHAT.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllChatQueues()" translate="CHAT.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectChatQueues()" translate="CHAT.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedChatQueues" csv-label="true" filename="chatQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedChatQueues($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CHATQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedChatQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChatQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CHAT.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'CHAT.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.chatQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="chatQueue" md-select-id="id" ng-repeat="chatQueue in vm.chatQueues.rows">\n                <td md-cell ng-if="chatQueue.userpic"><img class="avatar" alt="{{chatQueue.name}}" ng-src="api/users/{{chatQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!chatQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{chatQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatQueue, ev) : vm.createOrEditChatQueue($event, chatQueue)" md-cell class="id ">{{chatQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatQueue, ev) : vm.createOrEditChatQueue($event, chatQueue)" md-cell class="name ">{{chatQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatQueue, ev) : vm.createOrEditChatQueue($event, chatQueue)" md-cell class="strategy ">{{ vm.arraystrategy[chatQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(chatQueue, $event    )" translate="CHAT.EDIT_CHATQUEUE">\n                          Edit ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(chatQueue, $event    )" translate="CHAT.TEAMADD_CHATQUEUE">\n                          teamadd ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(chatQueue, $event    )" translate="CHAT.AGENTADD_CHATQUEUE">\n                          agentadd ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(chatQueue, $event    )" translate="CHAT.DELETE_CHATQUEUE">\n                          Delete ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(chatQueue, $event    )" translate="CHAT.GOTOREALTIME_CHATQUEUE">\n                          goToRealtime ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chatQueues.count}}" md-on-paginate="vm.getChatQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CHATQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CHATQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-chatQueue-button" ng-click="vm.createOrEditChatQueue($event)" aria-label="add chatQueue" translate translate-attr-aria-label="CHAT.ADD_CHATQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CHATQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/chat/views/chatQueues/create/dialog.html",'<md-dialog class="chatQueue-dialog" aria-label="New ChatQueue">\n  <form name="chatQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.chatQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newChatQueue">\n\n        <div class="hint"><span translate="CHAT.HELP.NAME"></span></div>\n        <div ng-messages="chatQueueForm[\'name\'].$error" ng-show="chatQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="CHAT.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.chatQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="chatQueueForm[\'strategy\'].$error" ng-show="chatQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.chatQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="chatQueueForm[\'timeout\'].$error" ng-show="chatQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chatQueue.description">\n\n        <div ng-messages="chatQueueForm[\'description\'].$error" ng-show="chatQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatQueue" ng-click="vm.saveChatQueue()" class="send-button md-accent md-raised" ng-disabled="chatQueueForm.$invalid || chatQueueForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatQueue" ng-click="vm.addNewChatQueue()" class="send-button md-accent md-raised" ng-disabled="chatQueueForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATQUEUE" translate-attr-aria-label="CHAT.ADD_CHATQUEUE">\n          ADD CHATQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatQueue" ng-click="vm.deleteChatQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",'<md-dialog class="chatQueue-dialog" aria-label="chatQueue" ng-init="vm.onInit()">\n  <form name="chatQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CHAT.AGENTADD_CHATQUEUE">Add Agent to chatQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",'<md-dialog class="chatQueue-dialog" aria-label="chatQueue" ng-init="vm.onInit()">\n  <form name="chatQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CHAT.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatQueues/edit/view.html",'<div id="chat-chatQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-chatQueues-button md-icon-button" aria-label="Go to chatQueues" ng-click="vm.gotoChatQueues()" translate translate-attr-aria-label="CHAT.GO_TO_CHATQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="chatQueue-image" hide-xs>\n          <img ng-src="assets/images/business/chatQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.chatQueue.id}}\n            <span ng-if="vm.chatQueue.name">{{vm.chatQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CHAT.CREATED_AT"></span> <span>{{vm.chatQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.chatQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="CHAT.TEAMADD_CHATQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.chatQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="CHAT.AGENTADD_CHATQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveChatQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.chatQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="CHAT.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="CHAT.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.chatQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.chatQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.chatQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/chat/views/chatWebsites/chatWebsites.html",'<div id="chatWebsites" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-hangouts" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CHAT.CHATWEBSITES">ChatWebsites</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CHAT.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedChatWebsites.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedChatWebsites =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CHAT.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-chatWebsites-count">\n          <span>{{vm.selectedChatWebsites.length}}</span>\n          <span translate="CHAT.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CHAT.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllChatWebsites()" translate="CHAT.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectChatWebsites()" translate="CHAT.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedChatWebsites" csv-label="true" filename="chatWebsites.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedChatWebsites($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CHATWEBSITE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedChatWebsites" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChatWebsites">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CHAT.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'CHAT.KEY\' | translate }}</th>\n                <th md-column md-order-by="address">{{ \'CHAT.MOTIONADDRESS\' | translate }}</th>\n                <th md-column md-order-by="remote">{{ \'CHAT.MOTIONPROXY\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CHAT.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.chatWebsites.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="chatWebsite" md-select-id="id" ng-repeat="chatWebsite in vm.chatWebsites.rows">\n                <td md-cell ng-if="chatWebsite.userpic"><img class="avatar" alt="{{chatWebsite.name}}" ng-src="api/users/{{chatWebsite.id}}/avatar" /></td>\n                <td md-cell ng-if="!chatWebsite.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{chatWebsite.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="id ">{{chatWebsite.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="name ">{{chatWebsite.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="key ">{{chatWebsite.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="address ">{{chatWebsite.address}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="remote ">{{chatWebsite.remote}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="description ">{{chatWebsite.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(chatWebsite, $event    )" translate="CHAT.EDIT_CHATWEBSITE">\n                          Edit ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(chatWebsite, $event    )" translate="CHAT.INTERACTIONS_CHATWEBSITE">\n                          Interactions ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.offlinemessagesgoto(chatWebsite, $event    )" translate="CHAT.OFFLINEMESSAGES_CHATWEBSITE">\n                          OfflineMessages ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(chatWebsite, $event    )" translate="CHAT.AGENTADD_CHATWEBSITE">\n                          AgentAdd ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(chatWebsite, $event    )" translate="CHAT.DELETE_CHATWEBSITE">\n                          Delete ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chatWebsites.count}}" md-on-paginate="vm.getChatWebsites" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CHATWEBSITE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CHATWEBSITE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-chatWebsite-button" ng-click="vm.createOrEditChatWebsite($event)" aria-label="add chatWebsite" translate translate-attr-aria-label="CHAT.ADD_CHATWEBSITE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CHATWEBSITE BUTTON --\x3e\n</div>'),e.put("app/main/apps/chat/views/chatWebsites/create/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.chatWebsite.name" ng-required="true" autofocus ng-disabled="!vm.newChatWebsite">\n\n        <div ng-messages="chatWebsiteForm[\'name\'].$error" ng-show="chatWebsiteForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.chatWebsite.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="chatWebsiteForm[\'key\'].$error" ng-show="chatWebsiteForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONADDRESS">MotionAddress</label>\n        <input type="url" name="address" ng-model="vm.chatWebsite.address" md-maxlength="255" ng-required="true">\n\n        <div ng-messages="chatWebsiteForm[\'address\'].$error" ng-show="chatWebsiteForm[\'address\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONADDRESS_REQUIRED">MotionAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="CHAT.ERRORS.MOTIONADDRESS_MUST_VALID_URL">MotionAddress must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.MOTIONADDRESS_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionAddress must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONPROXY">MotionProxy</label>\n        <input type="url" name="remote" ng-model="vm.chatWebsite.remote" md-maxlength="255" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="CHAT.HELP.MOTIONPROXY"></span></div>\n        <div ng-messages="chatWebsiteForm[\'remote\'].$error" ng-show="chatWebsiteForm[\'remote\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="CHAT.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.chatWebsite.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="CHAT.HELP.LIST"></span></div>\n        <div ng-messages="chatWebsiteForm[\'ListId\'].$error" ng-show="chatWebsiteForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.INTERVAL">Interval</label>\n        <md-select name="IntervalId" ng-model="vm.chatWebsite.IntervalId">\n          <md-option ng-value="null">Always</md-option>\n          <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteForm[\'IntervalId\'].$error" ng-show="chatWebsiteForm[\'IntervalId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chatWebsite.description">\n\n        <div ng-messages="chatWebsiteForm[\'description\'].$error" ng-show="chatWebsiteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatWebsite" ng-click="vm.saveChatWebsite()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteForm.$invalid || chatWebsiteForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatWebsite" ng-click="vm.addNewChatWebsite()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATWEBSITE" translate-attr-aria-label="CHAT.ADD_CHATWEBSITE">\n          ADD CHATWEBSITE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatWebsite" ng-click="vm.deleteChatWebsite($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",'<md-dialog class="chatWebsite-dialog" aria-label="chatWebsite" ng-init="vm.onInit()">\n  <form name="chatWebsiteForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CHAT.AGENTADD_CHATWEBSITE">Add Agent to chatWebsite</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/agent/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'agent\'].$error" ng-show="chatWebsiteFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'timeout\'].$error" ng-show="chatWebsiteFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/amazonlex/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'accesskeyid\'].$error" ng-show="chatWebsiteFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'secretaccesskey\'].$error" ng-show="chatWebsiteFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'lexregion\'].$error" ng-show="chatWebsiteFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'botname\'].$error" ng-show="chatWebsiteFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="CHAT.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="chatWebsiteFormApp[\'welcomemessage\'].$error" ng-show="chatWebsiteFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/autoreply/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'times\'].$error" ng-show="chatWebsiteFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="chatWebsiteFormApp[\'text\'].$error" ng-show="chatWebsiteFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/close/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'disposition\'].$error" ng-show="chatWebsiteFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/dialogflow/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'key\'].$error" ng-show="chatWebsiteFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'language\'].$error" ng-show="chatWebsiteFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="CHAT.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="chatWebsiteFormApp[\'welcomemessage\'].$error" ng-show="chatWebsiteFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'projectId\'].$error" ng-show="chatWebsiteFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'clientEmail\'].$error" ng-show="chatWebsiteFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="chatWebsiteFormApp[\'privateKey\'].$error" ng-show="chatWebsiteFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'language\'].$error" ng-show="chatWebsiteFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="CHAT.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="chatWebsiteFormApp[\'welcomemessage\'].$error" ng-show="chatWebsiteFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/gotoif/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'condition\'].$error" ng-show="chatWebsiteFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'truepriority\'].$error" ng-show="chatWebsiteFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'falsepriority\'].$error" ng-show="chatWebsiteFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/gotop/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'priority\'].$error" ng-show="chatWebsiteFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/noop/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'value\'].$error" ng-show="chatWebsiteFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/queue/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'queue\'].$error" ng-show="chatWebsiteFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'timeout\'].$error" ng-show="chatWebsiteFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/system/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'command\'].$error" ng-show="chatWebsiteFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'variable\'].$error" ng-show="chatWebsiteFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/tag/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'tag\'].$error" ng-show="chatWebsiteFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/tvox/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.SERVICEID">serviceid</label>\n        <input type="text" name="serviceid" ng-model="vm.tvox.serviceid" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'serviceid\'].$error" ng-show="chatWebsiteFormApp[\'serviceid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.SERVICEID_REQUIRED">serviceid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.CHANNELID">channelid</label>\n        <input type="text" name="channelid" ng-model="vm.tvox.channelid" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'channelid\'].$error" ng-show="chatWebsiteFormApp[\'channelid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.CHANNELID_REQUIRED">channelid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXURL">tvoxurl</label>\n        <input type="text" name="tvoxurl" ng-model="vm.tvox.tvoxurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxurl\'].$error" ng-show="chatWebsiteFormApp[\'tvoxurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXURL_REQUIRED">tvoxurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXLOGINURL">tvoxloginurl</label>\n        <input type="text" name="tvoxloginurl" ng-model="vm.tvox.tvoxloginurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxloginurl\'].$error" ng-show="chatWebsiteFormApp[\'tvoxloginurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXLOGINURL_REQUIRED">tvoxloginurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXSESSIONURL">tvoxsessionurl</label>\n        <input type="text" name="tvoxsessionurl" ng-model="vm.tvox.tvoxsessionurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxsessionurl\'].$error" ng-show="chatWebsiteFormApp[\'tvoxsessionurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXSESSIONURL_REQUIRED">tvoxsessionurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXUSERNAME">tvoxusername</label>\n        <input type="text" name="tvoxusername" ng-model="vm.tvox.tvoxusername" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxusername\'].$error" ng-show="chatWebsiteFormApp[\'tvoxusername\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXUSERNAME_REQUIRED">tvoxusername field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXPASSWD">tvoxpasswd</label>\n        <input type="password" name="tvoxpasswd" ng-model="vm.tvox.tvoxpasswd" placeholder="Password" translate translate-attr-placeholder="CHAT.PASSWORD">\n        <div ng-messages="chatWebsiteFormApp[\'tvoxpasswd\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="CHAT.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONURLONRING">motionurlonring</label>\n        <input type="text" name="motionurlonring" ng-model="vm.tvox.motionurlonring" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motionurlonring\'].$error" ng-show="chatWebsiteFormApp[\'motionurlonring\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONURLONRING_REQUIRED">motionurlonring field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONURLONANSWER">motionurlonanswer</label>\n        <input type="text" name="motionurlonanswer" ng-model="vm.tvox.motionurlonanswer" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motionurlonanswer\'].$error" ng-show="chatWebsiteFormApp[\'motionurlonanswer\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONURLONANSWER_REQUIRED">motionurlonanswer field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONTITLE">motiontitle</label>\n        <input type="text" name="motiontitle" ng-model="vm.tvox.motiontitle" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motiontitle\'].$error" ng-show="chatWebsiteFormApp[\'motiontitle\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONTITLE_REQUIRED">motiontitle field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONURL">motionurl</label>\n        <input type="text" name="motionurl" ng-model="vm.tvox.motionurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motionurl\'].$error" ng-show="chatWebsiteFormApp[\'motionurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONURL_REQUIRED">motionurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/chatCannedAnswers/dialog.html",'<md-dialog class="chatCannedAnswer-dialog" aria-label="New ChatCannedAnswer">\n  <form name="chatCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.chatCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="chatCannedAnswerForm[\'key\'].$error" ng-show="chatCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.chatCannedAnswer.value" required></textarea>\n\n        <div ng-messages="chatCannedAnswerForm[\'value\'].$error" ng-show="chatCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chatCannedAnswer.description">\n\n        <div ng-messages="chatCannedAnswerForm[\'description\'].$error" ng-show="chatCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatCannedAnswer" ng-click="vm.saveChatCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="chatCannedAnswerForm.$invalid || chatCannedAnswerForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatCannedAnswer" ng-click="vm.addNewChatCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="chatCannedAnswerForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATCANNEDANSWER" translate-attr-aria-label="CHAT.ADD_CHATCANNEDANSWER">\n          ADD CHATCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatCannedAnswer" ng-click="vm.deleteChatCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",'<md-dialog class="offlineMessage-dialog" aria-label="New OfflineMessage">\n  <md-toolbar class="md-accent md-hue-2">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span class="title">{{ vm.title | translate }}</span>\n      <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-content flex layout-padding>\n    <pre ng-if="vm.isHtml">{{vm.message.body}}</pre>\n    <div ng-if="!vm.isHtml" ng-bind-html-unsafe="vm.message.body"></div>\n\n    <span ng-repeat="attachment in vm.attachments">\n      <md-button class="md-icon-button no-margin no-padding" ng-click="vm.download(attachment)">\n        <md-icon class="no-margin material-icons" aria-label="Attachment">attach_file</md-icon>\n      </md-button>\n      <span>{{attachment.name}}</span><br />\n    </span>\n  </md-content>\n\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/proactive/dialog.html",'<md-dialog class="chatProactiveAction-dialog" aria-label="New ChatProactiveAction">\n  <form name="chatProactiveActionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.chatProactiveAction.name" ng-required="true" autofocus>\n\n        <div ng-messages="chatProactiveActionForm[\'name\'].$error" ng-show="chatProactiveActionForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.chatProactiveAction.type">\n\n          <md-option ng-value="\'mouseOver\'"> {{ \'CHAT.MOUSEOVER\' | translate }} </md-option>\n\n          <md-option ng-value="\'timeout\'"> {{ \'CHAT.TIMEOUT\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="chatProactiveActionForm[\'type\'].$error" ng-show="chatProactiveActionForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.chatProactiveAction.type === \'mouseOver\'" class="md-block">\n        <label translate="CHAT.SELECTOR">Selector</label>\n        <input type="" name="selector" ng-model="vm.chatProactiveAction.selector" ng-required="true">\n\n        <div ng-messages="chatProactiveActionForm[\'selector\'].$error" ng-show="chatProactiveActionForm[\'selector\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.SELECTOR_REQUIRED">Selector field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.chatProactiveAction.type === \'timeout\'" class="md-block">\n        <label translate="CHAT.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.chatProactiveAction.timeout" min="1" ng-required="true">\n\n        <div ng-messages="chatProactiveActionForm[\'timeout\'].$error" ng-show="chatProactiveActionForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatProactiveAction" ng-click="vm.saveChatProactiveAction()" class="send-button md-accent md-raised" ng-disabled="chatProactiveActionForm.$invalid || chatProactiveActionForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatProactiveAction" ng-click="vm.addNewChatProactiveAction()" class="send-button md-accent md-raised" ng-disabled="chatProactiveActionForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATPROACTIVEACTION" translate-attr-aria-label="CHAT.ADD_CHATPROACTIVEACTION">\n          ADD CHATPROACTIVEACTION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatProactiveAction" ng-click="vm.deleteChatProactiveAction($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/view.html",'<div id="chat-chatWebsite" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-chatWebsites-button md-icon-button" aria-label="Go to chatWebsites" ng-click="vm.gotoChatWebsites()" translate translate-attr-aria-label="CHAT.GO_TO_CHATWEBSITES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="chatWebsite-image" hide-xs>\n          <img ng-src="assets/images/business/chatWebsites.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.chatWebsite.id}}\n            <span ng-if="vm.chatWebsite.name">{{vm.chatWebsite.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CHAT.CREATED_AT"></span> <span>{{vm.chatWebsite.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.chatWebsite, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="CHAT.AGENTADD_CHATWEBSITE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveChatWebsite()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (scriptForm.$invalid) || (intervalForm.$invalid) || (dispositionForm.$invalid) || (appearanceForm.$invalid) || (onlinestatusForm.$invalid) || (offlinestatusForm.$invalid) || (closingformForm.$invalid) || (unmanagedstatusForm.$invalid) || (interactionForm.$invalid) || (whitelabelForm.$invalid) || (logoForm.$invalid) || (agentAvatarForm.$invalid) || (customerAvatarForm.$invalid) || (systemAvatarForm.$invalid) || (chatFormOnlineForm.$invalid) || (chatFormOfflineForm.$invalid) || (proactiveForm.$invalid) || (chatDispositionsForm.$invalid) || (chatCannedAnswersForm.$invalid) || (vidaooForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid) || (offlineMessagesForm.$invalid)" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.chatWebsite.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.chatWebsite.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.MOTIONADDRESS">MotionAddress</label>\n                <input type="url" name="address" ng-model="vm.chatWebsite.address" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'address\'].$error" ng-show="generalForm[\'address\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MOTIONADDRESS_REQUIRED">MotionAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="CHAT.ERRORS.MOTIONADDRESS_MUST_VALID_URL">MotionAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.MOTIONADDRESS_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionAddress must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.chatWebsite.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="CHAT.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.fidelity" class="md-block">\n                <label translate="CHAT.TIMEOUT">Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.chatWebsite.timeout" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.chatWebsite.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.chatWebsite.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="CHAT.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.chatWebsite.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.queueTransfer == true" class="md-block">\n                <label translate="CHAT.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.chatWebsite.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.agentTransfer == true" class="md-block">\n                <label translate="CHAT.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.chatWebsite.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container script md-background-bg md-whiteframe-1dp">\n            <form name="scriptForm" flex="100" novalidate>\n              <div ng-controller="ChatWebsiteScriptController as vm_ac" ng-init="vm_ac.init(vm.chatWebsite)" class="content" md-background-bg>\n                <div class="pb-16" layout="row" layout-align="start center">\n                  <div class="h2 secondary-text" translate="CHAT.SCRIPT">SCRIPT</div>\n                </div>\n\n\n                <md-input-container class="md-block">\n                  <label translate="CHAT.TOKEN">Token</label>\n                  <input type="text" name="token" ng-model="vm_ac.chatWebsite.token" autofocus ng-disabled="true">\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="CHAT.MOTIONPROXY">MotionProxy</label>\n                  <input type="url" name="remote" ng-model="vm_ac.chatWebsite.remote" required>\n                  <div class="hint"><span translate="CHAT.HELP.MOTIONPROXY"></span></div>\n                  <div ng-messages="scriptForm[\'remote\'].$error" ng-show="scriptForm[\'remote\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="CHAT.ERRORS.MOTIONPROXY_REQUIRED">Motion Proxy field is required</span>\n                    </div>\n                    <div ng-message="url">\n                      <span translate="CHAT.ERRORS.MOTIONPROXY_MUST_VALID_URL">Motion Proxy must be a valid url e.g.: http://www.xcally.com</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="CHAT.WEBSITESCRIPT">WebsiteScript</label>\n                  <div>\n                    <pre style="font-size: 13px;">\n                    {{vm_ac.start}} {{vm_ac.script}} {{vm_ac.end}}\n                    </pre>\n                  </div>\n                  <div class="hint"><span translate="CHAT.HELP.COPYSCRIPTTOCLIPBOARD"></span></div>\n                </md-input-container>\n\n              </div>\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container interval md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.INTERVAL">INTERVAL</div>\n            </div>\n            <form name="intervalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.INTERVAL">Interval</label>\n                <md-select name="IntervalId" ng-model="vm.chatWebsite.IntervalId" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Always</md-option>\n                  <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n                </md-select>\n                <div ng-messages="intervalForm[\'IntervalId\'].$error" ng-show="intervalForm[\'IntervalId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.TIMEZONE">Timezone</label>\n                <ms-timezone name="timezone" ng-model="vm.chatWebsite.timezone" ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                <div class="hint"><span translate="CHAT.HELP.TIMEZONE"></span></div>\n                <div ng-messages="intervalForm[\'timezone\'].$error" ng-show="intervalForm[timezone].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.mandatoryDisposition" class="md-block">\n                <label translate="CHAT.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.chatWebsite.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="CHAT.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.SNIPPET">SNIPPET</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container appearance md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.APPEARANCE">APPEARANCE</div>\n            </div>\n            <form name="appearanceForm" novalidate>\n              <div flex md-color-picker ng-model="vm.chatWebsite.color" label="{{\'CHAT.MAINCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.color_button" label="{{\'CHAT.BUTTONCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.textColor" label="{{\'CHAT.TEXTCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.textButtonColor" label="{{\'CHAT.TEXT_BUTTON_COLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.backgroundColor" label="{{\'CHAT.BACKGROUNDCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <md-input-container class="md-block">\n                <label translate="CHAT.FONTSIZE">fontSize</label>\n                <input type="number" name="fontSize" ng-model="vm.chatWebsite.fontSize" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="appearanceForm[\'fontSize\'].$error" ng-show="appearanceForm[\'fontSize\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FONTSIZE_REQUIRED">fontSize field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.FONTSIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">fontSize must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.HEADERSHAPE">headershape</label>\n                <md-select name="header_shape" ng-model="vm.chatWebsite.header_shape" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'rounded\'"> {{ \'CHAT.ROUNDED\' | translate }} </md-option>\n\n                  <md-option ng-value="\'squared\'"> {{ \'CHAT.SQUARED\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="appearanceForm[\'header_shape\'].$error" ng-show="appearanceForm[\'header_shape\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.HEADERSHAPE_REQUIRED">headershape field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.showAgentAvatar" aria-label="ShowAgentAvatar" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.SHOWAGENTAVATAR">ShowAgentAvatar</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.showCustomerAvatar" aria-label="showCustomerAvatar" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.SHOWCUSTOMERAVATAR">showCustomerAvatar</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SNIPPETSWIPEOUT">snippetSwipeOut</label>\n                <md-select name="alignment" ng-model="vm.chatWebsite.alignment" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'bottom_right\'"> {{ \'CHAT.BOTTOM_RIGHT\' | translate }} </md-option>\n\n                  <md-option ng-value="\'right\'"> {{ \'CHAT.RIGHT\' | translate }} </md-option>\n\n                  <md-option ng-value="\'left\'"> {{ \'CHAT.LEFT\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="appearanceForm[\'alignment\'].$error" ng-show="appearanceForm[\'alignment\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SNIPPETSWIPEOUT_REQUIRED">snippetSwipeOut field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.alignment !== \'bottom_right\'" class="md-block">\n                <label translate="CHAT.VERTICALPOSITION">verticalPosition</label>\n                <input type="number" name="verticalAlignment" ng-model="vm.chatWebsite.verticalAlignment" min="0" max="100" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="CHAT.HELP.VERTICALPOSITION"></span></div>\n                <div ng-messages="appearanceForm[\'verticalAlignment\'].$error" ng-show="appearanceForm[\'verticalAlignment\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VERTICALPOSITION_REQUIRED">verticalPosition field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.VERTICALPOSITION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">verticalPosition must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.VERTICALPOSITION_MUST_BE_LESS_THAN_OR_EQUAL_TO">verticalPosition must be a valid greater or equal than</span> <span>100</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.MESSAGESALIGNMENT">messagesAlignment</label>\n                <md-select name="messagesAlignment" ng-model="vm.chatWebsite.messagesAlignment" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'alternate\'"> {{ \'CHAT.ALTERNATE\' | translate }} </md-option>\n\n                  <md-option ng-value="\'centered\'"> {{ \'CHAT.CENTERED\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="appearanceForm[\'messagesAlignment\'].$error" ng-show="appearanceForm[\'messagesAlignment\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MESSAGESALIGNMENT_REQUIRED">messagesAlignment field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.DEFAULTTITLE">defaultTitle</label>\n                <input type="text" name="defaultTitle" ng-model="vm.chatWebsite.defaultTitle" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="appearanceForm[\'defaultTitle\'].$error" ng-show="appearanceForm[\'defaultTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.DEFAULTTITLE_REQUIRED">defaultTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.DEFAULTTITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>defaultTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.LABELTEXT">labelText</label>\n                <input type="text" name="labelText" ng-model="vm.chatWebsite.labelText" md-maxlength="6" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="appearanceForm[\'labelText\'].$error" ng-show="appearanceForm[\'labelText\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.LABELTEXT_REQUIRED">labelText field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.LABELTEXT_MAX_LENGTH" translate-values=\'{max: 6}\'>labelText\n                      must have a maximum length equal to 6</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container onlinestatus md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.ONLINESTATUS">ONLINESTATUS</div>\n            </div>\n            <form name="onlinestatusForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.HEADER_ONLINE">header_online</label>\n                <input type="text" name="header_online" ng-model="vm.chatWebsite.header_online" md-maxlength="255" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="onlinestatusForm[\'header_online\'].$error" ng-show="onlinestatusForm[\'header_online\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.HEADER_ONLINE_REQUIRED">header_online field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.HEADER_ONLINE_MAX_LENGTH" translate-values=\'{max: 255}\'>header_online must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.START_CHAT_BUTTON">start_chat_button</label>\n                <input type="text" name="start_chat_button" ng-model="vm.chatWebsite.start_chat_button" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="onlinestatusForm[\'start_chat_button\'].$error" ng-show="onlinestatusForm[\'start_chat_button\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.START_CHAT_BUTTON_REQUIRED">start_chat_button field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.START_CHAT_BUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>start_chat_button must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container offlinestatus md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.OFFLINESTATUS">OFFLINESTATUS</div>\n            </div>\n            <form name="offlinestatusForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.hideWhenOffline" aria-label="hideWhenOffline" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.HIDEWHENOFFLINE">hideWhenOffline</span></md-switch>\n                <div class="hint"><span translate="CHAT.HELP.HIDEWHENOFFLINE"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.HEADER_OFFLINE">header_offline</label>\n                <input type="text" name="header_offline" ng-model="vm.chatWebsite.header_offline" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'header_offline\'].$error" ng-show="offlinestatusForm[\'header_offline\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.HEADER_OFFLINE_REQUIRED">header_offline field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.HEADER_OFFLINE_MAX_LENGTH" translate-values=\'{max: 255}\'>header_offline must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.OFFLINE_CHAT_BUTTON">offline_chat_button</label>\n                <input type="text" name="offline_chat_button" ng-model="vm.chatWebsite.offline_chat_button" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'offline_chat_button\'].$error" ng-show="offlinestatusForm[\'offline_chat_button\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.OFFLINE_CHAT_BUTTON_REQUIRED">offline_chat_button field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.OFFLINE_CHAT_BUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>offline_chat_button must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.OFFLINEMESSAGESUBJECT">offlineMessageSubject</label>\n                <input type="text" name="offlineMessageSubject" ng-model="vm.chatWebsite.offlineMessageSubject" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'offlineMessageSubject\'].$error" ng-show="offlinestatusForm[\'offlineMessageSubject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGESUBJECT_REQUIRED">offlineMessageSubject field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGESUBJECT_MAX_LENGTH" translate-values=\'{max: 255}\'>offlineMessageSubject must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.OFFLINEMESSAGEBODY">offlineMessageBody</label>\n                <input type="text" name="offlineMessageBody" ng-model="vm.chatWebsite.offlineMessageBody" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'offlineMessageBody\'].$error" ng-show="offlinestatusForm[\'offlineMessageBody\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGEBODY_REQUIRED">offlineMessageBody field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGEBODY_MAX_LENGTH" translate-values=\'{max: 255}\'>offlineMessageBody must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container closingform md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.CLOSINGFORM">CLOSINGFORM</div>\n            </div>\n            <form name="closingformForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CLOSINGMESSAGE">closingMessage</label>\n                <textarea name="closingMessage" ng-model="vm.chatWebsite.closingMessage" md-maxlength="255" required autofocus></textarea>\n\n                <div ng-messages="closingformForm[\'closingMessage\'].$error" ng-show="closingformForm[\'closingMessage\'].$touched" role="alert">\n\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGE_REQUIRED">closingMessage field is required</span>\n                  </div>\n\n\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>closingMessage must have a maximum length equal to 255</span>\n                  </div>\n\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SKIPMESSAGEBUTTON">skipMessageButton</label>\n                <input type="text" name="skipMessageButton" ng-model="vm.chatWebsite.skipMessageButton" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'skipMessageButton\'].$error" ng-show="closingformForm[\'skipMessageButton\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SKIPMESSAGEBUTTON_REQUIRED">skipMessageButton field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SKIPMESSAGEBUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>skipMessageButton must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableRating" aria-label="enableRating" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLERATING">enableRating</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableRating" class="md-block">\n                <label translate="CHAT.RATINGTYPE">ratingType</label>\n                <md-select name="ratingType" ng-model="vm.chatWebsite.ratingType" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'star\'">Star</md-option>\n                  <md-option ng-value="\'thumb\'">Thumb</md-option>\n                </md-select>\n                <div ng-messages="closingformForm[\'ratingType\'].$error" ng-show="closingformForm[\'ratingType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.RATINGTYPE_REQUIRED">ratingType field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableRating && vm.chatWebsite.ratingType === \'star\'" class="md-block">\n                <label translate="CHAT.RATINGSTARSNUMBER">ratingStarsNumber</label>\n                <input type="number" name="ratingStarsNumber" ng-model="vm.chatWebsite.ratingStarsNumber" min="2" max="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'ratingStarsNumber\'].$error" ng-show="closingformForm[\'ratingStarsNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.RATINGSTARSNUMBER_REQUIRED">ratingStarsNumber field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.RATINGSTARSNUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ratingStarsNumber must be a valid greater or equal than</span> <span>2</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.RATINGSTARSNUMBER_MUST_BE_LESS_THAN_OR_EQUAL_TO">ratingStarsNumber must be a valid greater or equal than</span> <span>5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableFeedback" aria-label="enableFeedback" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLEFEEDBACK">enableFeedback</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableFeedback" class="md-block">\n                <label translate="CHAT.FEEDBACKTITLE">feedbackTitle</label>\n                <input type="text" name="feedbackTitle" ng-model="vm.chatWebsite.feedbackTitle" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'feedbackTitle\'].$error" ng-show="closingformForm[\'feedbackTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FEEDBACKTITLE_REQUIRED">feedbackTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FEEDBACKTITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>feedbackTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.forwardTranscript" aria-label="forwardTranscript" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.FORWARDTRANSCRIPT">forwardTranscript</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.forwardTranscript" class="md-block">\n                <label translate="CHAT.FORWARDTRANSCRIPTMESSAGE">forwardTranscriptMessage</label>\n                <input type="text" name="forwardTranscriptMessage" ng-model="vm.chatWebsite.forwardTranscriptMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'forwardTranscriptMessage\'].$error" ng-show="closingformForm[\'forwardTranscriptMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FORWARDTRANSCRIPTMESSAGE_REQUIRED">forwardTranscriptMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FORWARDTRANSCRIPTMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>forwardTranscriptMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CLOSINGMESSAGEBUTTON">closingMessageButton</label>\n                <input type="text" name="closingMessageButton" ng-model="vm.chatWebsite.closingMessageButton" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'closingMessageButton\'].$error" ng-show="closingformForm[\'closingMessageButton\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGEBUTTON_REQUIRED">closingMessageButton field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGEBUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>closingMessageButton must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container unmanagedstatus md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.UNMANAGEDSTATUS">UNMANAGEDSTATUS</div>\n            </div>\n            <form name="unmanagedstatusForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.autoclose" aria-label="autoclose" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.AUTOCLOSE">autoclose</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableUnmanagedNote" aria-label="enableUnmanagedNote" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLEUNMANAGEDNOTE">enableUnmanagedNote</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.UNMANAGEDMESSAGE">unmanagedMessage</label>\n                <input type="text" name="unmanagedMessage" ng-model="vm.chatWebsite.unmanagedMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'unmanagedMessage\'].$error" ng-show="unmanagedstatusForm[\'unmanagedMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.UNMANAGEDMESSAGE_REQUIRED">unmanagedMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.UNMANAGEDMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>unmanagedMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SKIPUNMANAGED">skipUnmanaged</label>\n                <input type="text" name="skipUnmanaged" ng-model="vm.chatWebsite.skipUnmanaged" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'skipUnmanaged\'].$error" ng-show="unmanagedstatusForm[\'skipUnmanaged\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SKIPUNMANAGED_REQUIRED">skipUnmanaged field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SKIPUNMANAGED_MAX_LENGTH" translate-values=\'{max: 255}\'>skipUnmanaged must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableUnmanagedNote" class="md-block">\n                <label translate="CHAT.SENDUNMANAGED">sendUnmanaged</label>\n                <input type="text" name="sendUnmanaged" ng-model="vm.chatWebsite.sendUnmanaged" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'sendUnmanaged\'].$error" ng-show="unmanagedstatusForm[\'sendUnmanaged\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SENDUNMANAGED_REQUIRED">sendUnmanaged field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SENDUNMANAGED_MAX_LENGTH" translate-values=\'{max: 255}\'>sendUnmanaged must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableUnmanagedNote" class="md-block">\n                <label translate="CHAT.NOTETITLE">noteTitle</label>\n                <input type="text" name="noteTitle" ng-model="vm.chatWebsite.noteTitle" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'noteTitle\'].$error" ng-show="unmanagedstatusForm[\'noteTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.NOTETITLE_REQUIRED">noteTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.NOTETITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>noteTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container interaction md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.INTERACTION">INTERACTION</div>\n            </div>\n            <form name="interactionForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.AGENTIDENTIFIER">agentIdentifier</label>\n                <md-select name="agentIdentifier" ng-model="vm.chatWebsite.agentIdentifier" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'website_alias\'"> {{ \'CHAT.WEBSITEALIAS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'agent_alias\'"> {{ \'CHAT.AGENTALIAS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'agent_fullname\'"> {{ \'CHAT.AGENTFULLNAME\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="CHAT.HELP.AGENTIDENTIFIER"></span></div>\n                <div ng-messages="interactionForm[\'agentIdentifier\'].$error" ng-show="interactionForm[\'agentIdentifier\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.AGENTIDENTIFIER_REQUIRED">agentIdentifier field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CUSTOMERALIAS">customerAlias</label>\n                <input type="text" name="customerAlias" ng-model="vm.chatWebsite.customerAlias" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'customerAlias\'].$error" ng-show="interactionForm[\'customerAlias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CUSTOMERALIAS_REQUIRED">customerAlias field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CUSTOMERALIAS_MAX_LENGTH" translate-values=\'{max: 255}\'>customerAlias must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.MESSAGEFONTSIZE">messageFontSize</label>\n                <input type="number" name="messageFontSize" ng-model="vm.chatWebsite.messageFontSize" min="0" max="20" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'messageFontSize\'].$error" ng-show="interactionForm[\'messageFontSize\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MESSAGEFONTSIZE_REQUIRED">messageFontSize field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.MESSAGEFONTSIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">messageFontSize must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.MESSAGEFONTSIZE_MUST_BE_LESS_THAN_OR_EQUAL_TO">messageFontSize must be a valid greater or equal than</span> <span>20</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.agentIdentifier === \'website_alias\'" class="md-block">\n                <label translate="CHAT.WEBSITEALIAS">WebsiteAlias</label>\n                <input type="text" name="agentAlias" ng-model="vm.chatWebsite.agentAlias" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="CHAT.HELP.WEBSITEALIAS"></span></div>\n                <div ng-messages="interactionForm[\'agentAlias\'].$error" ng-show="interactionForm[\'agentAlias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WEBSITEALIAS_REQUIRED">WebsiteAlias field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WEBSITEALIAS_MAX_LENGTH" translate-values=\'{max: 255}\'>WebsiteAlias must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CLOSINGQUESTION">closingQuestion</label>\n                <input type="text" name="closingQuestion" ng-model="vm.chatWebsite.closingQuestion" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'closingQuestion\'].$error" ng-show="interactionForm[\'closingQuestion\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CLOSINGQUESTION_REQUIRED">closingQuestion field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CLOSINGQUESTION_MAX_LENGTH" translate-values=\'{max: 255}\'>closingQuestion must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.FORMSUBMITSUCCESSMESSAGE">formSubmitSuccessMessage</label>\n                <input type="text" name="formSubmitSuccessMessage" ng-model="vm.chatWebsite.formSubmitSuccessMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'formSubmitSuccessMessage\'].$error" ng-show="interactionForm[\'formSubmitSuccessMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FORMSUBMITSUCCESSMESSAGE_REQUIRED">formSubmitSuccessMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FORMSUBMITSUCCESSMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>formSubmitSuccessMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.FORMSUBMITFAILUREMESSAGE">formSubmitFailureMessage</label>\n                <input type="text" name="formSubmitFailureMessage" ng-model="vm.chatWebsite.formSubmitFailureMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'formSubmitFailureMessage\'].$error" ng-show="interactionForm[\'formSubmitFailureMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FORMSUBMITFAILUREMESSAGE_REQUIRED">formSubmitFailureMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FORMSUBMITFAILUREMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>formSubmitFailureMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableCustomerWriting" aria-label="enableCustomerWriting" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLECUSTOMERWRITING">enableCustomerWriting</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="!vm.chatWebsite.enableCustomerWriting" class="md-block">\n                <label translate="CHAT.WAITINGTITLE">waitingTitle</label>\n                <input type="text" name="waitingTitle" ng-model="vm.chatWebsite.waitingTitle" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'waitingTitle\'].$error" ng-show="interactionForm[\'waitingTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WAITINGTITLE_REQUIRED">waitingTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WAITINGTITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>waitingTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="!vm.chatWebsite.enableCustomerWriting" class="md-block">\n                <label translate="CHAT.WAITINGMESSAGE">waitingMessage</label>\n                <textarea name="waitingMessage" ng-model="vm.chatWebsite.waitingMessage" md-maxlength="255" required></textarea>\n\n                <div ng-messages="interactionForm[\'waitingMessage\'].$error" ng-show="interactionForm[\'waitingMessage\'].$touched" role="alert">\n\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WAITINGMESSAGE_REQUIRED">waitingMessage field is required</span>\n                  </div>\n\n\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WAITINGMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>waitingMessage must have a maximum length equal to 255</span>\n                  </div>\n\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.PLACEHOLDERMESSAGE">placeholderMessage</label>\n                <input type="text" name="placeholderMessage" ng-model="vm.chatWebsite.placeholderMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'placeholderMessage\'].$error" ng-show="interactionForm[\'placeholderMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.PLACEHOLDERMESSAGE_REQUIRED">placeholderMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.PLACEHOLDERMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>placeholderMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.download_transcript" aria-label="downloadTranscript" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.DOWNLOADTRANSCRIPT">downloadTranscript</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableCustomerAttachment" aria-label="enableCustomerAttachment" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLECUSTOMERATTACHMENT">enableCustomerAttachment</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableSendButton" aria-label="enableSendButton" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLESENDBUTTON">enableSendButton</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableCustomerCheckmarks" aria-label="enableCustomerCheckmarks" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLECUSTOMERCHECKMARKS">enableCustomerCheckmarks</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SYSTEMALIAS">systemAlias</label>\n                <input type="text" name="systemAlias" ng-model="vm.chatWebsite.systemAlias" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'systemAlias\'].$error" ng-show="interactionForm[\'systemAlias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SYSTEMALIAS_REQUIRED">systemAlias field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SYSTEMALIAS_MAX_LENGTH" translate-values=\'{max: 255}\'>systemAlias must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.license.custom" class="chatWebsite-detail-form-container whitelabel md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.WHITELABEL">WHITELABEL</div>\n            </div>\n            <form name="whitelabelForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.defaultWhiteLabel" aria-label="default" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.DEFAULT">default</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="!vm.chatWebsite.defaultWhiteLabel" class="md-block">\n                <label translate="CHAT.WHITELABEL">whiteLabel</label>\n                <textarea name="whiteLabel" ng-model="vm.chatWebsite.whiteLabel" md-maxlength="255" required></textarea>\n\n                <div ng-messages="whitelabelForm[\'whiteLabel\'].$error" ng-show="whitelabelForm[\'whiteLabel\'].$touched" role="alert">\n\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WHITELABEL_REQUIRED">whiteLabel field is required</span>\n                  </div>\n\n\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WHITELABEL_MAX_LENGTH" translate-values=\'{max: 255}\'>whiteLabel must have a maximum length equal to 255</span>\n                  </div>\n\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.license.custom" class="chatWebsite-detail-form-container logo md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.LOGO">LOGO</div>\n            </div>\n            <div ng-controller="ChatWebsitelogoController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="logoimage in vm_ca.chatWebsite.images" ng-switch="logoimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{logoimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="logoimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{logoimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n          <div class="chatWebsite-detail-form-container agentavatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.AGENTAVATAR">AGENTAVATAR</div>\n            </div>\n            <div ng-controller="ChatWebsiteagentAvatarController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="agentAvatarimage in vm_ca.chatWebsite.images" ng-switch="agentAvatarimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{agentAvatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="agentAvatarimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{agentAvatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n          <div class="chatWebsite-detail-form-container customeravatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.CUSTOMERAVATAR">CUSTOMERAVATAR</div>\n            </div>\n            <div ng-controller="ChatWebsitecustomerAvatarController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="customerAvatarimage in vm_ca.chatWebsite.images" ng-switch="customerAvatarimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{customerAvatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="customerAvatarimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{customerAvatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n          <div class="chatWebsite-detail-form-container systemavatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.SYSTEMAVATAR">SYSTEMAVATAR</div>\n            </div>\n            <div ng-controller="ChatWebsitesystemAvatarController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="systemAvatarimage in vm_ca.chatWebsite.images" ng-switch="systemAvatarimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{systemAvatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="systemAvatarimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{systemAvatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.ONLINE">ONLINE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container chatformonline md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteonlineFormController as vm_fonc" ng-init="vm_fonc.init(vm.chatWebsite)" class="content" md-background-bg layout="column">\n              <div flex>\n                \x3c!-- START Buttons --\x3e\n                <md-button aria-label="comment" class="md-fab md-mini" ng-click="vm_fonc.add(button.type)" ng-repeat="button in vm_fonc.buttons">\n                  <md-tooltip md-direction="top">{{button.name}}</md-tooltip>\n                  <md-icon md-font-icon="{{button.icon}}"></md-icon>\n                </md-button>\n                \x3c!-- END Buttons --\x3e\n              </div>\n\n              <div layout="row" flex>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.BUILDER">BUILDER</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content>\n\n                      <form name="onlineForm" novalidate>\n\n                        \x3c!-- START MapKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.onlineForm.items.length">\n                          <label translate="CHAT.HELP.MAPKEY">MapKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.mapKey">\n                            <md-option ng-value="null">None</md-option>\n\n                            <md-optgroup label="standard">\n                              <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n\n                            <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                              <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END MapKey --\x3e\n\n                        \x3c!-- START FromKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.onlineForm.items.length">\n                          <label translate="CHAT.HELP.FROMKEY">FromKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.onlineForm.fromKey" md-selected-text="vm_fonc.chatWebsite.onlineForm.fromKey != null ? vm_fonc.chatWebsite.onlineForm.items[vm_fonc.chatWebsite.onlineForm.fromKey].props.title : \'None\'">\n                            <md-option ng-value="null">None</md-option>\n                            <md-option ng-repeat="item in vm_fonc.chatWebsite.onlineForm.items" ng-if="item.props.title" ng-value="$index">{{ item.props.title }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END FromKey --\x3e\n\n                        \x3c!-- START EXPANSION PANELS --\x3e\n                        <md-expansion-panel ng-repeat="item in vm_fonc.chatWebsite.onlineForm.items track by $index" md-component-id="{{\'onlinePanel\' + $index}}">\n                          <md-expansion-panel-collapsed md-no-sticky="true">\n                            <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                            </md-button>\n                            <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                            </md-button>\n\n                            <div class="md-title">{{item.props.title || item.type}}</div>\n\n                            <div flex></div>\n                            <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                              <md-icon md-font-icon="icon-chevron-down"></md-icon>\n                            </md-button>\n                          </md-expansion-panel-collapsed>\n\n                          <md-expansion-panel-expanded>\n                            <md-expansion-panel-header>\n                              <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                              </md-button>\n\n                              <div class="md-title">{{item.props.title || item.type}}</div>\n\n                              <div flex></div>\n\n                              <md-button class="md-icon-button md-warn" aria-label="Remove" ng-click="vm_fonc.remove($index)">\n                                <md-icon md-font-icon="icon-delete"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                                <md-icon md-font-icon="icon-chevron-up"></md-icon>\n                              </md-button>\n                            </md-expansion-panel-header>\n\n                            <md-expansion-panel-content>\n                              <form-item type="{{item.type}}" item="item" index="$index"></form-item>\n\n                              <md-input-container class="md-block">\n                                <label translate="CHAT.VARIABLE">Variable</label>\n                                <md-select ng-model="item.variable">\n                                  <md-option ng-value="null">None</md-option>\n                                  <md-option ng-repeat="variable in vm_fonc.variables" ng-value="variable.name">{{ variable.name }}</md-option>\n                                </md-select>\n                              </md-input-container>\n\n                              <md-input-container class="md-block">\n                                <label translate="CHAT.CM_FIELD">Contact Manager Field</label>\n                                <md-select ng-model="item.cmField">\n                                  <md-option ng-value="null">None</md-option>\n\n                                  <md-optgroup label="standard">\n                                    <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n\n                                  <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                                    <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n                                </md-select>\n                              </md-input-container>\n                            </md-expansion-panel-content>\n\n                          </md-expansion-panel-expanded>\n                        </md-expansion-panel>\n                        \x3c!-- END EXPANSION PANELS --\x3e\n                      </form>\n                    </md-card-content>\n                  </md-card>\n                </div>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.PREVIEW">PREVIEW</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content flex>\n                      <form-view form="vm_fonc.chatWebsite.onlineForm" flex="100"></form-view>\n                    </md-card-content>\n                  </md-card>\n                </div>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.OFFLINE">OFFLINE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container chatformoffline md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteofflineFormController as vm_fonc" ng-init="vm_fonc.init(vm.chatWebsite)" class="content" md-background-bg layout="column">\n              <div flex>\n                \x3c!-- START Buttons --\x3e\n                <md-button aria-label="comment" class="md-fab md-mini" ng-click="vm_fonc.add(button.type)" ng-repeat="button in vm_fonc.buttons">\n                  <md-tooltip md-direction="top">{{button.name}}</md-tooltip>\n                  <md-icon md-font-icon="{{button.icon}}"></md-icon>\n                </md-button>\n                \x3c!-- END Buttons --\x3e\n              </div>\n\n              <div layout="row" flex>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.BUILDER">BUILDER</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content>\n\n                      <form name="offlineForm" novalidate>\n                        <md-input-container class="md-block">\n                          <md-switch ng-model="vm_fonc.chatWebsite.forwardOffline" aria-label="forwardOffline"><span translate="CHAT.FORWARD_OFFLINE">forwardOffline</span></md-switch>\n                        </md-input-container>\n\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.forwardOffline">\n                          <label translate="CHAT.FORWARD_OFFLINE_ADDRESS">FORWARD OFFLINE ADDRESS</label>\n                          <input type="text" name="forwardOfflineAddress" ng-model="vm_fonc.chatWebsite.forwardOfflineAddress">\n                          <div class="hint"><span translate="CHAT.HELP.FORWARD_OFFLINE"></span></div>\n                          <div ng-messages="offlineForm[\'forwardOfflineAddress\'].$error" ng-show="offlineForm[\'forwardOfflineAddress\'].$touched" role="alert">\n                            <div ng-message="email">\n                              <span translate="CHAT.ERRORS.EMAIL_MUST_BE_VALID">forwardOffline must be a valid e-mail address</span>\n                            </div>\n                          </div>\n                        </md-input-container>\n\n                        <md-input-container class="md-block">\n                          <md-switch ng-model="vm_fonc.chatWebsite.openNewInteraction" aria-label="openNewInteraction">\n                            <span translate="CHAT.OPEN_NEW_INTERACTION">openNewInteraction</span>\n                          </md-switch>\n                        </md-input-container>\n\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.openNewInteraction">\n                          <label translate="CHAT.EMAIL_ACCOUNT">Email account</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.MailAccountId" required>\n                            <md-option ng-repeat="account in vm_fonc.email_accounts" ng-value="account.id">{{ account.name }}</md-option>\n                          </md-select>\n                          <div ng-messages="offlineForm[\'MailAccountId\'].$error" ng-show="offlineForm[\'MailAccountId\'].$touched" role="alert">\n                            <div ng-message="required">\n                              <span translate="CHAT.ERRORS.EMAIL_ACCOUNT_REQUIRED">Email account field is required</span>\n                            </div>\n                          </div>\n                        </md-input-container>\n\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.openNewInteraction && vm_fonc.chatWebsite.offlineForm.items.length">\n                          <label translate="CHAT.SUBJECT">Subject</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.subjectOffline" md-selected-text="vm_fonc.chatWebsite.subjectOffline != null ? vm_fonc.chatWebsite.subjectOffline : \'None\'">\n                            <md-option ng-value="null">None</md-option>\n                            <md-option ng-repeat="item in vm_fonc.chatWebsite.offlineForm.items" ng-if="item.props.title" ng-value="item.props.title">{{ item.props.title }}</md-option>\n                          </md-select>\n                        </md-input-container>\n\n                        \x3c!-- START MapKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.offlineForm.items.length">\n                          <label translate="CHAT.HELP.MAPKEY">MapKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.mapKeyOffline">\n                            <md-option ng-value="null">None</md-option>\n\n                            <md-optgroup label="standard">\n                              <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n\n                            <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                              <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END MapKey --\x3e\n\n                        \x3c!-- START FromKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.offlineForm.items.length">\n                          <label translate="CHAT.HELP.FROMKEY">FromKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.offlineForm.fromKey" md-selected-text="vm_fonc.chatWebsite.offlineForm.fromKey != null ? vm_fonc.chatWebsite.offlineForm.items[vm_fonc.chatWebsite.offlineForm.fromKey].props.title : \'None\'">\n                            <md-option ng-value="null">None</md-option>\n                            <md-option ng-repeat="item in vm_fonc.chatWebsite.offlineForm.items" ng-if="item.props.title" ng-value="$index">{{ item.props.title }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END FromKey --\x3e\n\n                        \x3c!-- START EXPANSION PANELS --\x3e\n                        <md-expansion-panel ng-repeat="item in vm_fonc.chatWebsite.offlineForm.items track by $index" md-component-id="{{\'offlinePanel\' + $index}}">\n                          <md-expansion-panel-collapsed md-no-sticky="true">\n                            <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                            </md-button>\n                            <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                            </md-button>\n\n                            <div class="md-title">{{item.props.title || item.type}}</div>\n\n                            <div flex></div>\n                            <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                              <md-icon md-font-icon="icon-chevron-down"></md-icon>\n                            </md-button>\n                          </md-expansion-panel-collapsed>\n\n                          <md-expansion-panel-expanded>\n                            <md-expansion-panel-header>\n                              <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                              </md-button>\n\n                              <div class="md-title">{{item.props.title || item.type}}</div>\n\n                              <div flex></div>\n\n                              <md-button class="md-icon-button md-warn" aria-label="Remove" ng-click="vm_fonc.remove($index)">\n                                <md-icon md-font-icon="icon-delete"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                                <md-icon md-font-icon="icon-chevron-up"></md-icon>\n                              </md-button>\n                            </md-expansion-panel-header>\n\n                            <md-expansion-panel-content>\n                              <form-item type="{{item.type}}" item="item" index="$index"></form-item>\n\n\n                              <md-input-container class="md-block" ng-if="item.type != \'upload\'">\n                                <label translate="CHAT.CM_FIELD">Contact Manager Field</label>\n                                <md-select ng-model="item.cmField">\n                                  <md-option ng-value="null">None</md-option>\n\n                                  <md-optgroup label="standard">\n                                    <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n\n                                  <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                                    <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n                                </md-select>\n                              </md-input-container>\n                            </md-expansion-panel-content>\n\n                          </md-expansion-panel-expanded>\n                        </md-expansion-panel>\n                        \x3c!-- END EXPANSION PANELS --\x3e\n                      </form>\n                    </md-card-content>\n                  </md-card>\n                </div>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.PREVIEW">PREVIEW</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content flex>\n                      <form-view form="vm_fonc.chatWebsite.offlineForm" flex="100"></form-view>\n                    </md-card-content>\n                  </md-card>\n                </div>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.PROACTIVEACTIONS">PROACTIVEACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container proactive md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteProactiveActionsController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteProactiveActions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.PROACTIVEACTIONS">ProactiveActions</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteProactiveActions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event)" aria-label="add chatProactiveAction" translate translate-attr-label="CHAT.ADD_CHATPROACTIVEACTION">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteProactiveActions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteProactiveActions.length}} {{vm_dc.selectedChatWebsiteProactiveActions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteProactiveActions" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteProactiveActions($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteProactiveActions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteProactiveActions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="name">\n                        {{ \'CHAT.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="type">\n                        {{ \'CHAT.TYPE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="selector">\n                        {{ \'CHAT.SELECTOR\' | translate }}\n                      </th>\n                      <th md-column md-order-by="timeout">\n                        {{ \'CHAT.TIMEOUT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="chatProactiveAction" md-select-id="id" ng-repeat="chatProactiveAction in vm_dc.chatWebsiteProactiveActions.rows">\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.name}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{ \'CHAT.\' + vm_dc.arraytype[chatProactiveAction.type].option | uppercase | translate }}\n                      </td>\n\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.selector}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.timeout}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{ chatProactiveAction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" translate="CHAT.EDIT_CHATPROACTIVEACTION">\n                                Edit ChatProactiveAction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(chatProactiveAction, $event)" translate="CHAT.DELETE_CHATPROACTIVEACTION">\n                                Delete ChatProactiveAction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteProactiveActions.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_CHATPROACTIVEACTION_AVAILABLE">No chatproactiveaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteProactiveActions.count}}" md-on-paginate="vm_dc.getChatWebsiteProactiveActions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="ChatWebsiteDispositionsController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="chatWebsite-detail-form-container chatdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="CHAT.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add chat dispositions" translate translate-attr-label="CHAT.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="chatWebsites.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'CHAT.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'CHAT.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container chatcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteChatCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteChatCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.CHATCANNEDANSWERS">ChatCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteChatCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event)" aria-label="add chatCannedAnswer" translate translate-attr-label="CHAT.ADD_CHATCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteChatCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteChatCannedAnswers.length}} {{vm_dc.selectedChatWebsiteChatCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteChatCannedAnswers" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteChatCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteChatCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteChatCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'CHAT.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'CHAT.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'CHAT.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="chatCannedAnswer" md-select-id="id" ng-repeat="chatCannedAnswer in vm_dc.chatWebsiteChatCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{ chatCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" translate="CHAT.EDIT_CHATCANNEDANSWER">\n                                Edit ChatCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(chatCannedAnswer, $event)" translate="CHAT.DELETE_CHATCANNEDANSWER">\n                                Delete ChatCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteChatCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_CHATCANNEDANSWER_AVAILABLE">No chatcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteChatCannedAnswers.count}}" md-on-paginate="vm_dc.getChatWebsiteChatCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.VIDEO">VIDEO</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container vidaoo md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.VIDAOO">VIDAOO</div>\n            </div>\n            <form name="vidaooForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.vidaooEscalation" aria-label="vidaooEscalation" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.VIDAOOESCALATION">vidaooEscalation</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOOAPIKEY">vidaooApiKey</label>\n                <input type="text" name="vidaooApiKey" ng-model="vm.chatWebsite.vidaooApiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="vidaooForm[\'vidaooApiKey\'].$error" ng-show="vidaooForm[\'vidaooApiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VIDAOOAPIKEY_REQUIRED">vidaooApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOOTOPIC">vidaooTopic</label>\n                <input type="text" name="vidaooTopic" ng-model="vm.chatWebsite.vidaooTopic" value="Generated by XCALLY Motion" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="vidaooForm[\'vidaooTopic\'].$error" ng-show="vidaooForm[\'vidaooTopic\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VIDAOOTOPIC_REQUIRED">vidaooTopic field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOONOTE">vidaooNote</label>\n                <input type="text" name="vidaooNote" ng-model="vm.chatWebsite.vidaooNote" value="Meeting generated for interaction #{{interaction.id}} by {{agent.name}}" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="vidaooForm[\'vidaooNote\'].$error" ng-show="vidaooForm[\'vidaooNote\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VIDAOONOTE_REQUIRED">vidaooNote field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOOMETADATA">vidaooMetadata</label>\n                <textarea name="vidaooMetadata" ng-model="vm.chatWebsite.vidaooMetadata"></textarea>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteActionsController as vm_ac" ng-init="vm_ac.init(vm.chatWebsite, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="CHAT.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedChatWebsiteApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedChatWebsiteApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedChatWebsiteApps.length}} {{vm_ac.selectedChatWebsiteApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedChatWebsiteApps($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedChatWebsiteApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.chatWebsiteApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editChatWebsiteApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editChatWebsiteApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editChatWebsiteApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editChatWebsiteApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.chatWebsiteApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteInteractionsController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getChatWebsiteInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getChatWebsiteInteractions()" aria-label="refresh Interactions" translate translate-attr-label="CHAT.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteInteractions.length}} {{vm_dc.selectedChatWebsiteInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteInteractions" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteInteractions($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'CHAT.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'CHAT.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'CHAT.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'CHAT.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'CHAT.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.chatWebsiteInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'CHAT.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'CHAT.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spychatInteraction($event, interaction)" translate="CHAT.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || (vm_dc.userProfile.downloadOmnichannelInteractions && vm_dc.userProfile.downloadAttachments)">\n                              <md-button class="md-primary" ng-click="vm_dc.chatInteractionDownload(interaction, $event, true)" translate="CHAT.DOWNLOAD_WITH_ATTACHMENTS">\n                                Download with attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.chatInteractionDownload(interaction, $event)" translate="CHAT.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                                Download without attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="CHAT.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteInteractions.count}}" md-on-paginate="vm_dc.getChatWebsiteInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.OFFLINEMESSAGES">OFFLINEMESSAGES</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container offlinemessages md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteOfflineMessagesController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteOfflineMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.OFFLINEMESSAGES">OfflineMessages</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteOfflineMessages()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteOfflineMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteOfflineMessages.length}} {{vm_dc.selectedChatWebsiteOfflineMessages.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteOfflineMessages" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteOfflineMessages($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteOfflineMessages" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteOfflineMessages">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column>\n                        {{ \'CHAT.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="offlineMessage" md-select-id="id" ng-repeat="offlineMessage in vm_dc.chatWebsiteOfflineMessages.rows">\n                      <td md-cell>\n                        {{offlineMessage.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="offlineMessage.Attachments.length > 0">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{offlineMessage.Contact.firstName}}\n                      </td>\n                      <td md-cell>\n                        {{ offlineMessage.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.showOfflineMessageChatWebsiteOfflineMessage($event, offlineMessage)" translate="CHAT.SHOW_OFFLINEMESSAGE">\n                                SHOW OfflineMessage\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(offlineMessage, $event)" translate="CHAT.DELETE_OFFLINEMESSAGE">\n                                Delete OfflineMessage\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteOfflineMessages.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_OFFLINEMESSAGE_AVAILABLE">No offlinemessage available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteOfflineMessages.count}}" md-on-paginate="vm_dc.getChatWebsiteOfflineMessages" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/chat/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="CHAT.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n        <th md-column>{{ \'CHAT.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'CHAT.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'CHAT.WAITING\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedIn }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="CHAT.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="CHAT.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/chat/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/companies/companies.html",'<div id="companies" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-circle" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.COMPANIES">Companies</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedCompanies.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedCompanies =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-companies-count">\n          <span>{{vm.selectedCompanies.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTMANAGER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllCompanies()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectCompanies()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedCompanies" csv-label="true" filename="companies.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedCompanies($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- COMPANY TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedCompanies" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCompanies">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CONTACTMANAGER.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CONTACTMANAGER.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.companies.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="company" md-select-id="id" ng-repeat="company in vm.companies.rows">\n                <td md-cell ng-if="company.userpic"><img class="avatar" alt="{{company.name}}" ng-src="api/users/{{company.id}}/avatar" /></td>\n                <td md-cell ng-if="!company.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{company.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(company, ev) : vm.createOrEditCompany($event, company)" md-cell class="id ">{{company.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(company, ev) : vm.createOrEditCompany($event, company)" md-cell class="name ">{{company.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(company, ev) : vm.createOrEditCompany($event, company)" md-cell class="description ">{{company.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(company, $event    )" translate="CONTACTMANAGER.EDIT_COMPANY">\n                          Edit Company\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotocontactsgoto(company, $event    )" translate="CONTACTMANAGER.GOTOCONTACTS_COMPANY">\n                          goToContacts Company\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(company, $event    )" translate="CONTACTMANAGER.DELETE_COMPANY">\n                          Delete Company\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.companies.count}}" md-on-paginate="vm.getCompanies" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / COMPANY TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD COMPANY BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-company-button" ng-click="vm.createOrEditCompany($event)" aria-label="add company" translate translate-attr-aria-label="CONTACTMANAGER.ADD_COMPANY">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD COMPANY BUTTON --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/companies/create/dialog.html",'<md-dialog class="company-dialog" aria-label="New Company">\n  <form name="companyForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.company.name" ng-required="true" autofocus>\n\n        <div ng-messages="companyForm[\'name\'].$error" ng-show="companyForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.PHONE">Phone</label>\n        <input type="text" name="phone" ng-model="vm.company.phone">\n\n        <div ng-messages="companyForm[\'phone\'].$error" ng-show="companyForm[\'phone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.VAT">Vat</label>\n        <input type="text" name="vat" ng-model="vm.company.vat">\n\n        <div ng-messages="companyForm[\'vat\'].$error" ng-show="companyForm[\'vat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.VAT_REQUIRED">Vat field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.FAX">Fax</label>\n        <input type="text" name="fax" ng-model="vm.company.fax">\n\n        <div ng-messages="companyForm[\'fax\'].$error" ng-show="companyForm[\'fax\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.FAX_REQUIRED">Fax field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.COMPANYID">CompanyId</label>\n        <input type="text" name="companyId" ng-model="vm.company.companyId">\n\n        <div ng-messages="companyForm[\'companyId\'].$error" ng-show="companyForm[\'companyId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.COMPANYID_REQUIRED">CompanyId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.TYPE">Type</label>\n        <input type="text" name="type" ng-model="vm.company.type">\n\n        <div ng-messages="companyForm[\'type\'].$error" ng-show="companyForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.WEBSITE">Website</label>\n        <input type="text" name="website" ng-model="vm.company.website" md-maxlength="255">\n\n        <div ng-messages="companyForm[\'website\'].$error" ng-show="companyForm[\'website\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.WEBSITE_REQUIRED">Website field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CONTACTMANAGER.ERRORS.WEBSITE_MAX_LENGTH" translate-values=\'{max: 255}\'>Website must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.EMAIL_DOMAIN">Email_Domain</label>\n        <input type="text" name="emailDomain" ng-model="vm.company.emailDomain">\n\n        <div ng-messages="companyForm[\'emailDomain\'].$error" ng-show="companyForm[\'emailDomain\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.EMAIL_DOMAIN_REQUIRED">Email_Domain field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.company.email">\n\n        <div ng-messages="companyForm[\'email\'].$error" ng-show="companyForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="CONTACTMANAGER.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.company.description">\n\n        <div ng-messages="companyForm[\'description\'].$error" ng-show="companyForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCompany" ng-click="vm.saveCompany()" class="send-button md-accent md-raised" ng-disabled="companyForm.$invalid || companyForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCompany" ng-click="vm.addNewCompany()" class="send-button md-accent md-raised" ng-disabled="companyForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_COMPANY" translate-attr-aria-label="CONTACTMANAGER.ADD_COMPANY">\n          ADD COMPANY\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCompany" ng-click="vm.deleteCompany($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/companies/edit/view.html",'<div id="contactmanager-company" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-companies-button md-icon-button" aria-label="Go to companies" ng-click="vm.gotoCompanies()" translate translate-attr-aria-label="CONTACTMANAGER.GO_TO_COMPANIES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="company-image" hide-xs>\n          <img ng-src="assets/images/business/companies.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.company.id}}\n            <span ng-if="vm.company.name">{{vm.company.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CONTACTMANAGER.CREATED_AT"></span> <span>{{vm.company.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.company, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="CONTACTMANAGER.GOTO_COMPANY"></span></md-tooltip>\n        <md-icon md-font-icon="icon-forward"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveCompany()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (addressForm.$invalid) || (shipmentAddressForm.$invalid)" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.GENERAL">GENERAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="company-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.company.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.company.phone" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'phone\'].$error" ng-show="generalForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.VAT">Vat</label>\n                <input type="text" name="vat" ng-model="vm.company.vat" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'vat\'].$error" ng-show="generalForm[\'vat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.VAT_REQUIRED">Vat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.FAX">Fax</label>\n                <input type="text" name="fax" ng-model="vm.company.fax" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'fax\'].$error" ng-show="generalForm[\'fax\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.FAX_REQUIRED">Fax field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.COMPANYID">CompanyId</label>\n                <input type="text" name="companyId" ng-model="vm.company.companyId" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'companyId\'].$error" ng-show="generalForm[\'companyId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.COMPANYID_REQUIRED">CompanyId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.TYPE">Type</label>\n                <input type="text" name="type" ng-model="vm.company.type" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.WEBSITE">Website</label>\n                <input type="text" name="website" ng-model="vm.company.website" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'website\'].$error" ng-show="generalForm[\'website\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.WEBSITE_REQUIRED">Website field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CONTACTMANAGER.ERRORS.WEBSITE_MAX_LENGTH" translate-values=\'{max: 255}\'>Website must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.EMAIL_DOMAIN">Email_Domain</label>\n                <input type="text" name="emailDomain" ng-model="vm.company.emailDomain" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'emailDomain\'].$error" ng-show="generalForm[\'emailDomain\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.EMAIL_DOMAIN_REQUIRED">Email_Domain field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.company.email" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="CONTACTMANAGER.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.company.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.ADDRESS">ADDRESS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="company-detail-form-container address md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.ADDRESS">ADDRESS</div>\n            </div>\n            <form name="addressForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.STREET">Street</label>\n                <input type="text" name="street" ng-model="vm.company.street" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'street\'].$error" ng-show="addressForm[\'street\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.STREET_REQUIRED">Street field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.POSTAL_CODE">Postal_Code</label>\n                <input type="text" name="postalCode" ng-model="vm.company.postalCode" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'postalCode\'].$error" ng-show="addressForm[\'postalCode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.POSTAL_CODE_REQUIRED">Postal_Code field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.CITY">City</label>\n                <input type="text" name="city" ng-model="vm.company.city" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'city\'].$error" ng-show="addressForm[\'city\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.CITY_REQUIRED">City field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n                <input type="text" name="country" ng-model="vm.company.country" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'country\'].$error" ng-show="addressForm[\'country\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.COUNTRY_REQUIRED">Country field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.SHIPMENTADDRESS">SHIPMENTADDRESS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="company-detail-form-container shipmentaddress md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.SHIPMENTADDRESS">SHIPMENTADDRESS</div>\n            </div>\n            <form name="shipmentAddressForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.STREET">Street</label>\n                <input type="text" name="sStreet" ng-model="vm.company.sStreet" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sStreet\'].$error" ng-show="shipmentAddressForm[\'sStreet\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.STREET_REQUIRED">Street field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.POSTAL_CODE">Postal_Code</label>\n                <input type="text" name="sPostalCode" ng-model="vm.company.sPostalCode" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sPostalCode\'].$error" ng-show="shipmentAddressForm[\'sPostalCode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.POSTAL_CODE_REQUIRED">Postal_Code field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.CITY">City</label>\n                <input type="text" name="sCity" ng-model="vm.company.sCity" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sCity\'].$error" ng-show="shipmentAddressForm[\'sCity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.CITY_REQUIRED">City field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n                <input type="text" name="sCountry" ng-model="vm.company.sCountry" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sCountry\'].$error" ng-show="shipmentAddressForm[\'sCountry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.COUNTRY_REQUIRED">Country field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/contactmanager/views/contacts/contacts.html",'<div id="contacts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.CONTACTS">Contacts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    \x3c!-- SEARCH --\x3e\n    <div class="search-input-wrapper" layout="row" layout-align="start center">\n      <label for="search">\n        <md-icon md-font-icon="icon-magnify"></md-icon>\n      </label>\n      <md-input-container md-no-float class="m-0">\n        <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n      </md-input-container>\n    </div>\n    \x3c!-- / SEARCH --\x3e\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedContacts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedContacts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-contacts-count">\n          <span>{{vm.selectedContacts.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllContacts()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectContacts()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedContacts" csv-label="true" filename="contacts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedContacts($event)" aria-label="delete selected" translate translate-attr-label="CONTACTS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      <div layout="row">\n        <div class="column" flex="20">\n          <md-card>\n            <md-card-content>\n              <button layout-align="center center" md-mini-fab ng-click="vm.selectedList = null; vm.selectedCompany = null; vm.selectedTags = []">\n                <md-icon md-font-icon="icon-refresh"></md-icon>{{ \'CONTACTMANAGER.ALL_CONTACTS\' | translate }}\n              </button>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="CONTACTMANAGER.SELECT_LIST">Select a list</label>\n                <md-select placeholder="Select a list" ng-model="vm.selectedList" ng-disabled="vm.lists.count === 0">\n                  <md-option ng-value="null"><em translate="CONTACTMANAGER.ALL">All</em></md-option>\n                  <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="CONTACTMANAGER.SELECT_COMPANY">Select a company</label>\n                <md-select placeholder="Select a company" flex="100" ng-model="vm.selectedCompany" ng-disabled="vm.companies.count === 0">\n                  <md-option ng-value="null"><em translate="CONTACTMANAGER.ALL">All</em></md-option>\n                  <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="CONTACTMANAGER.SELECT_TAGS">Select one or more tags</label>\n                <md-select multiple placeholder="Select one or more tags" flex="100" ng-model="vm.query.tag" ng-change="vm.getContacts()">\n                  <md-option ng-value="tag.id" ng-repeat="tag in vm.tags.rows">{{tag.name}}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n        </div>\n\n        \x3c!-- USER TABLE --\x3e\n        <md-card flex="80">\n          <md-table-container ng-init="vm.getAssignedCompanies()">\n            <table md-table md-row-select multiple ng-model="vm.selectedContacts" md-progress="vm.promise">\n              <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContacts">\n                <tr md-row>\n                  <th md-column md-order-by="id">ID</th>\n                  <th md-column md-order-by="firstName">{{\'CONTACTMANAGER.FULLNAME\' | translate}}</th>\n                  <th md-column md-order-by="phone">{{\'CONTACTMANAGER.PHONE\' | translate}}</th>\n                  <th md-column md-order-by="email">{{\'CONTACTMANAGER.EMAIL\' | translate}}</th>\n                  <th md-column md-order-by="createdAt">{{\'CONTACTMANAGER.CREATED_AT\' | translate}}</th>\n                  <th md-column md-order-by="ListId">{{\'CONTACTMANAGER.LIST\' | translate}}</th>\n                  <th md-column md-order-by="CompanyId">{{\'CONTACTMANAGER.COMPANY\' | translate}}</th>\n                  <th md-column md-order-by="tags">{{\'CONTACTMANAGER.TAGS\' | translate}}</th>\n                  <th md-column width="10px"></th>\n                </tr>\n              </thead>\n              <tbody md-body>\n                <tr md-row ng-hide="vm.contacts.rows.length">\n                  <td md-cell colspan="8">\n                    <div layout="row" layout-align="center center">\n                      <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                  </td>\n                </tr>\n                <tr md-row md-select="contact" md-select-id="id" ng-repeat="contact in vm.contacts.rows">\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="id">{{contact.id}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="firstName" privacy ng-cloak>{{contact.firstName}} {{contact.lastName}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="phone" privacy ng-cloak>{{contact.phone}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="email" privacy ng-cloak>{{contact.email}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="createdAt">{{contact.createdAt | date:\'medium\'}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="list">{{vm.listsMap[contact.ListId]}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="company">{{vm.companiesMap[contact.CompanyId]}}</td>\n                  <td md-cell class="tag">\n                    <div ng-if="contact.Tags.length">\n                      <div ng-if="contact.Tags.length == 1" layout="column" layout-align="center center">\n                        <md-icon md-font-icon="icon-tag" ng-style="{\'color\': contact.Tags[0].color }"></md-icon>\n                        <span class="text-truncate">{{contact.Tags[0].name}}</span>\n                      </div>\n                      <div ng-if="contact.Tags.length > 1" layout="column" layout-align="center center">\n                        <md-tooltip md-direction="left" layout="row">\n                          <span ng-repeat="tag in contact.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                        </md-tooltip>\n                        <md-icon md-font-icon="icon-tag"></md-icon>\n                      </div>\n                    </div>\n                  </td>\n                  <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.editdialog(contact, ev)" translate="CONTACTMANAGER.EDIT_CONTACT">\n                            Edit Contact\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.mergeContact(ev, contact)" translate="CONTACTMANAGER.MERGE_CONTACT">\n                            Merge Contact\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.duplicateContact(ev, contact)" translate="CONTACTMANAGER.DUPLICATE_CONTACT">\n                            Duplicate Contact\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-divider ng-if="vm.crudPermissions.canEdit && vm.crudPermissions.canDelete">\n                        </md-menu-divider>\n                        <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                          <md-button ng-click="vm.deleteconfirm(contact, ev)" translate="CONTACTMANAGER.DELETE_CONTACT">\n                            Delete Contact\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n\n          <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contacts.count}}" md-on-paginate="vm.getContacts" md-page-select></md-table-pagination>\n        </md-card>\n        \x3c!-- / USER TABLE --\x3e\n      </div>\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD USER BUTTON --\x3e\n  <md-fab-speed-dial id="add-contact-button" ng-if="vm.crudPermissions.canEdit" ng-hide="vm.options.hidden" md-direction="up" md-open="vm.options.isOpen" class="md-scale md-fab" ng-class="{ \'md-hover-full\': vm.options.hover }" ng-mouseenter="vm.options.isOpen=true" ng-mouseleave="vm.options.isOpen=false">\n    <md-fab-trigger>\n      <md-button aria-label="menu" class="md-fab md-accent">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n      </md-button>\n    </md-fab-trigger>\n    <md-fab-actions>\n      <md-button class="md-fab md-mini md-primary" flow-btn flow-init="vm.ngFlowOptions" flow-files-submitted="$flow.upload()" flow-file-success="vm.importContactsUpdates($file, $message, $flow)" flow-file-added="vm.fileAdded($file)" aria-label="Select File" translate translate-attr-aria-label="CONTACTMANAGER.UPDATES_EXISTING_CONTACTS">\n        <md-tooltip md-direction="left" md-visible="tooltipVisible" md-autohide="false">\n          {{\'CONTACTMANAGER.UPDATE_EXISTING_CONTACTS\' | translate}}\n        </md-tooltip>\n        <md-icon md-font-icon="icon-upload"></md-icon>\n      </md-button>\n      <md-button class="md-fab md-mini md-warn" flow-btn flow-init="vm.ngFlowOptions" flow-files-submitted="$flow.upload()" flow-file-success="vm.importContacts($file, $message, $flow)" flow-file-added="vm.fileAdded($file)" aria-label="Select File" translate translate-attr-aria-label="CONTACTMANAGER.IMPORT_CONTACTS">\n        <md-tooltip md-direction="left" md-visible="tooltipVisible" md-autohide="false">\n          {{\'CONTACTMANAGER.IMPORT_CONTACTS\' | translate}}\n        </md-tooltip>\n        <md-icon md-font-icon="icon-upload"></md-icon>\n      </md-button>\n      <md-button class="md-fab md-mini md-accent" ng-click="vm.createOrEditContact($event)" aria-label="add contact" translate translate-attr-aria-label="CONTACTMANAGER.ADD_CONTACT">\n        <md-tooltip md-direction="left" md-visible="tooltipVisible" md-autohide="false">\n          {{\'CONTACTMANAGER.ADD_CONTACT\' | translate}}\n        </md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </md-fab-actions>\n  </md-fab-speed-dial>\n  \x3c!-- / ADD USER BUTTON --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/contacts/create/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="New Contact">\n  <form name="contactForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.FIRSTNAME">First name</label>\n        <input name="firstName" ng-model="vm.contact.firstName" required md-autofocus privacy="!vm.crudPermissions.canEdit" ng-cloak>\n\n        <div ng-messages="contactForm.firstName.$error" ng-show="contactForm.firstName.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.FIRSTNAME_REQUIRED">First name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.LASTNAME">Last name</label>\n        <input name="lastName" ng-model="vm.contact.lastName" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.PHONE">Phone</label>\n        <input name="phone" ng-model="vm.contact.phone" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.EMAIL">Email</label>\n        <input name="email" type="email" ng-model="vm.contact.email" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.MOBILE">Mobile</label>\n        <input name="mobile" ng-model="vm.contact.mobile" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.FAX">Fax</label>\n        <input name="fax" ng-model="vm.contact.fax" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.LIST">List</label>\n        <md-select name="list" ng-model="vm.contact.ListId" ng-disabled="vm.contact.id && vm.contact.ListId" ng-change="vm.getCustomFields(vm.contact.ListId)" required>\n          <md-optgroup label="Lists">\n            <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n            <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="contactForm.list.$error" ng-show="contactForm.list.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block" flex-gt-sm="">\n        <md-chips ng-model="vm.additionalItems" md-transform-chip="vm.newPhone($chip)" placeholder="Phone numbers">\n          <md-chip-template custom-chip alt="{{$chip.type}}" title="{{$chip.type}}">\n            {{ $chip.phone }}\n          </md-chip-template>\n        </md-chips>\n      </md-input-container>\n      <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="100">\n        <div class="pb-16" layout="column" layout-align="start center">\n          <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n        </div>\n        <form flex name="additionalPhonesForm" novalidate>\n          <div ng-repeat="additionalPhone in vm.additionalItems">\n            <div layout="row" flex="1">\n              <md-input-container class="md-block" flex="50">\n                <label>{{$index}} - {{additionalPhone.phone}}</label>\n                <md-select ng-model="vm.additionalItemTypes[$index]" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-repeat="value in vm.contactItemTypes" ng-value="value.id">{{value.name}}</md-option>\n                  <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                </md-select>\n              </md-input-container>\n              <md-input-container class="md-block" flex="50">\n                <input ng-model="additionalPhone.description" ng-cloak>\n              </md-input-container>\n            </div>\n          </div>\n        </form>\n      </div>\n\n      <md-input-container>\n        <label translate="CONTACTMANAGER.TIMEZONE">Timezone</label>\n        <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone"></ms-timezone>\n      </md-input-container>\n\n      <div ng-repeat="customField in vm.customFields.rows" class="md-block" ng-switch="customField.type">\n        <div ng-switch-when="datetime">\n          <label>{{customField.alias}}</label>\n          <div>\n            \x3c!-- ng-model="customField.value" --\x3e\n            <mdp-date-picker mdp-open-on-click ng-required="customField.required" mdp-format="YYYY-MM-DD" ng-model="vm.contact[\'cf_\' + customField.id]"></mdp-date-picker>\n            <mdp-time-picker mdp-open-on-click mdp-placeholder="Time" ng-required="customField.required" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.contact[\'cf_\' + customField.id]">\n            </mdp-time-picker>\n          </div>\n        </div>\n\n        <div ng-switch-when="select">\n          <label>{{customField.alias}}</label>\n          <md-select ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n            <md-option ng-repeat="value in customField.values" ng-value="value.value">{{value.value}}</md-option>\n            <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n          </md-select>\n        </div>\n\n        <div ng-switch-when="switch">\n          <md-switch aria-label="{{customField.alias}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-true-value="1" ng-false-value="0">\n            {{customField.alias}}\n          </md-switch>\n        </div>\n\n        <md-input-container ng-switch-default>\n          <label>{{customField.alias}}</label>\n          <input type="{{customField.type}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n        </md-input-container>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.COMPANY">Company</label>\n        <md-select name="company" ng-model="vm.contact.CompanyId">\n          <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows" ng-hide="!vm.contact.CompanyId && company.canSelect === false" ng-disabled="company.canSelect === false">\n            {{company.name}}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <div ng-if="!vm.allFields" layout="row" layout-align="center center">\n        <md-button class="md-accent" ng-click="vm.allFields = true" translate="CONTACTMANAGER.SHOW_ALL_FIELDS">Show All\n          Fields</md-button>\n      </div>\n\n      <md-input-container class="md-block" ng-if="vm.allFields" flex-gt-sm="" ng-init="vm.contact.dateOfBirth = vm.getDateFromString(vm.contact.dateOfBirth)">\n        <label translate="CONTACTMANAGER.DATE_OF_BIRTH">Date of Birth</label>\n        <mdp-date-picker mdp-open-on-click mdp-format="YYYY-MM-DD" name="dateOfBirth" ng-model="vm.contact.dateOfBirth">\n        </mdp-date-picker>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n        <input type="text" name="country" ng-model="vm.contact.country">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.CITY">City</label>\n        <input type="text" name="city" ng-model="vm.contact.city">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.STREET">Street</label>\n        <input type="text" name="street" ng-model="vm.contact.street">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.POSTAL_CODE">Postal Code</label>\n        <input type="text" name="postalCode" ng-model="vm.contact.postalCode">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.NOTES">Notes</label>\n        <input type="text" name="description" ng-model="vm.contact.description">\n      </md-input-container>\n\n      <div ng-if="vm.allFields" layout="row" layout-align="center center">\n        <md-button class="md-accent" ng-click="vm.allFields = false" translate="CONTACTMANAGER.FEWER_FIELDS">Fewer\n          Fields</md-button>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newContact" ng-click="vm.saveContact()" class="send-button md-accent md-raised" ng-disabled="contactForm.$invalid || contactForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newContact" ng-click="vm.addNewContact()" class="send-button md-accent md-raised" ng-disabled="contactForm.$invalid || contactForm.$pristine" aria-label="ADD" translate="CONTACTMANAGER.ADD_CONTACT" translate-attr-aria-label="CONTACTMANAGER.ADD_CONTACT">\n          ADD CONTACT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newContact" ng-click="vm.deleteContact($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="{{ \'CONTACTMANAGER.DUPLICATE_CONTACT\' | translate }}">\n  <form name="contactForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.LIST">List</label>\n        <md-select name="list" ng-model="vm.contact.ListId">\n          <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n        </md-select>\n\n        <div ng-messages="contactForm.list.$error" ng-show="contactForm.list.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.addNewContact()" class="send-button md-accent md-raised" ng-disabled="contactForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_CONTACT" translate-attr-aria-label="CONTACTMANAGER.ADD_CONTACT">\n          ADD CONTACT\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/edit/hoppers/dialog.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div flex class="md-block">\n        <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n          <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="CONTACTMANAGER.ERRORS.DATE_REQUIRED">Date is required</span>\n            </div>\n            <div ng-message="format">\n              <span translate="CONTACTMANAGER.ERRORS.DATE_INVALID">Date is invalid</span>\n            </div>\n          </div>\n        </mdp-date-picker>\n      </div>\n\n      <div flex class="md-block">\n        <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n          <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="CONTACTMANAGER.ERRORS.TIME_REQUIRED">Time is required</span>\n            </div>\n            <div ng-message="format">\n              <span translate="CONTACTMANAGER.ERRORS.TIME_INVALID">Time is invalid</span>\n            </div>\n          </div>\n        </mdp-time-picker>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_HOPPER" translate-attr-aria-label="CONTACTMANAGER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="!vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/edit/view.html",'<div id="cm-contact" class="page-layout simple tabbed" layout="column" ng-init="vm.onInit()">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-contacts-button md-icon-button" aria-label="Go to contacts" ng-click="vm.gotoContacts()" translate translate-attr-aria-label="CONTACTMANAGER.GO_TO_CONTACTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="contact-image" hide-xs>\n          <img ng-src="assets/images/business/contacts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.contact.id}} {{vm.contact.firstName}} {{vm.contact.lastName}}\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CONTACTMANAGER.CREATED_AT"></span> <span>{{vm.contact.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-if="vm.contact.role && vm.contact.role !== \'admin\'" ng-controller="ContactQueueAddButtonController as vm_contact_qa" ng-cloak>\n      <md-fab-speed-dial ng-hide="vm_contact_qa.hidden" md-direction="left" md-open="vm_contact_qa.isOpen" class="md-scale md-fab" ng-class="{ \'md-hover-full\': vm_contact_qa.hover }" ng-mouseenter="vm_contact_qa.isOpen=true" ng-mouseleave="vm_contact_qa.isOpen=false">\n        <md-fab-trigger>\n          <md-button aria-label="menu" class="md-fab md-primary md-icon-button">\n            <md-tooltip md-direction="top" md-visible="tooltipVisible">Channels</md-tooltip>\n            <md-icon md-font-icon="icon-eye" aria-label="channels"></md-icon>\n          </md-button>\n        </md-fab-trigger>\n        <md-fab-actions>\n          <div ng-repeat="channel in vm_contact_qa.channels">\n            <md-button aria-label="{{channel.name}}" class="md-fab md-raised md-icon-button md-mini" ng-click="vm_contact_qa.openDialog($event, vm.contact, channel)">\n              <md-tooltip md-direction="{{channel.direction}}" md-visible="tooltipVisible" md-autohide="false">\n                {{channel.name}}\n              </md-tooltip>\n              <md-icon md-font-icon="{{channel.icon}}" aria-label="{{channel.name}}"></md-icon>\n            </md-button>\n          </div>\n        </md-fab-actions>\n      </md-fab-speed-dial>\n    </div>\n\n    <div ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.duplicateContact($event)" class="md-fab md-warn md-icon-button" aria-label="DUPLICATE">\n        <md-icon md-font-icon="icon-file-multiple"></md-icon>\n      </md-button>\n      <md-button type="submit" ng-click="vm.saveContact()" class="send-button md-accent md-raised" ng-disabled="detailForm.$pristine && customFieldsForm.$pristine && socialForm.$pristine && additionalPhonesForm.$pristine" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.DETAIL">DETAIL</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div layout="row">\n            <div layout="column" flex="70">\n              <md-card class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n                <div class="pb-16" layout="row" layout-align="start center">\n                  <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.PERSONAL_INFO">PERSONAL_INFO\n                  </div>\n                </div>\n                <form name="detailForm" novalidate>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    \x3c!-- fistName --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.FIRSTNAME">First Name</label>\n                      <md-icon md-font-icon="icon-account" class="firstname"></md-icon>\n                      <input type="text" name="firstName" ng-model="vm.contact.firstName" class="text-truncate" required ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                      <div ng-messages="detailForm.firstName.$error" ng-show="detailForm.firstName.$touched" role="alert">\n                        <div ng-message="required">\n                          <span translate="CONTACTMANAGER.ERRORS.FIRSTNAME_REQUIRED">First name field is required</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div flex="5"></div>\n                    \x3c!-- lastName --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.LASTNAME">Last Name</label>\n                      <input type="text" name="lastName" ng-model="vm.contact.lastName" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    \x3c!-- phone --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.PHONE">Phone</label>\n                      <md-icon md-font-icon="icon-phone"></md-icon>\n                      <input type="text" name="phone" ng-model="vm.contact.phone" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                    <div flex="5"></div>\n                    \x3c!-- mobile --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.MOBILE">Mobile</label>\n                      <md-icon md-font-icon="icon-cellphone-iphone"></md-icon>\n                      <input type="text" name="mobile" ng-model="vm.contact.mobile" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    \x3c!-- email --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.EMAIL">Email</label>\n                      <md-icon md-font-icon="icon-email" class="email"></md-icon>\n                      <input type="email" name="email" ng-model="vm.contact.email" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                      <div ng-messages="detailForm.firstName.$error" ng-show="detailForm.firstName.$touched" role="alert">\n                        <div ng-message="email">\n                          <span translate="CONTACTMANAGER.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail\n                            address</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div flex="5"></div>\n                    \x3c!-- fax --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.FAX">Fax</label>\n                      <md-icon md-font-icon="icon-deskphone"></md-icon>\n                      <input type="text" name="fax" ng-model="vm.contact.fax" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.TIMEZONE">Timezone</label>\n                      <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.ADDITIONAL_PHONES">Additional Phones</label>\n                      <md-chips ng-model="vm.additionalItems" md-transform-chip="vm.newPhone($chip)" placeholder="Phone numbers">\n                        <md-chip-template custom-chip alt="{{$chip.type}}" title="{{$chip.type}}">\n                          {{ $chip.phone }}\n                        </md-chip-template>\n                      </md-chips>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="" ng-init="vm.contact.dateOfBirth = vm.getDateFromString(vm.contact.dateOfBirth)">\n                      <label translate="CONTACTMANAGER.DATE_OF_BIRTH">Date of Birth</label>\n                      <mdp-date-picker mdp-open-on-click mdp-format="YYYY-MM-DD" name="dateOfBirth" ng-model="vm.contact.dateOfBirth" mdp-disabled="!vm.crudPermissions.canEdit"></mdp-date-picker>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container ng-if="vm.companies.rows.length" class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.COMPANY">Company</label>\n                      <md-icon md-font-icon="icon-domain"></md-icon>\n                      <md-select name="company" ng-model="vm.contact.CompanyId" ng-disabled="!vm.crudPermissions.canEdit">\n                        <md-optgroup label="Companies">\n                          <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows" ng-disabled="company.canSelect === false">{{company.name}}</md-option>\n                          <md-option ng-value=" null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                        </md-optgroup>\n                      </md-select>\n                      <md-icon class="pointer" ng-show="vm.contact.CompanyId" md-font-icon="icon-information-outline" ng-click="vm.editCompany($event, vm.contact.CompanyId)"></md-icon>\n                    </md-input-container>\n                    <section ng-if="!vm.companies.rows.length" flex-gt-sm="">\n                      <md-icon md-font-icon="icon-briefcase"></md-icon>\n                      <label translate="CONTACTMANAGER.NO_COMPANIES">No Companies</label>\n                    </section>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container ng-if="vm.tags.rows.length" class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.TAGS">Tags</label>\n                      <md-icon md-font-icon="icon-tag"></md-icon>\n                      <md-select ng-model="vm.Tags" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                        <md-optgroup label="Tags">\n                          <md-option ng-value="tag.id" ng-repeat="tag in vm.tags.rows" ng-disabled="tag.canSelect === false">{{tag.name}}</md-option>\n                        </md-optgroup>\n                      </md-select>\n                    </md-input-container>\n                    <section ng-if="!vm.tags.rows.length" flex-gt-sm="">\n                      <md-icon md-font-icon="icon-tag"></md-icon>\n                      <label translate="CONTACTMANAGER.NO_TAG">No Tags</label>\n                      <md-button class="md-accent" translate="CONTACTMANAGER.ADD_TAG">Add Tag</md-button>\n                    </section>\n                  </div>\n\n                  <div ng-if="!vm.allFields" layout="row" layout-align="center center">\n                    <md-button class="md-accent" ng-click="vm.allFields = true" translate="CONTACTMANAGER.SHOW_ALL_FIELDS">Show All Fields</md-button>\n                  </div>\n\n                  <div ng-if="vm.allFields">\n                    <div layout-gt-sm="row" class="layout-gt-sm-row">\n                      \x3c!-- country --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n                        <md-icon md-font-icon="icon-home" class="country"></md-icon>\n                        <input type="text" name="country" ng-model="vm.contact.country" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                      <div flex="5"></div>\n                      \x3c!-- city --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.CITY">City</label>\n                        <input type="text" name="city" ng-model="vm.contact.city" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                    </div>\n\n                    <div layout-gt-sm="row" class="layout-gt-sm-row">\n                      <div flex="5"></div>\n                      \x3c!-- street --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.STREET">Street</label>\n                        <input type="text" name="street" ng-model="vm.contact.street" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                      <div flex="5"></div>\n                      \x3c!-- postalCode --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.POSTALCODE">Postal Code</label>\n                        <input type="text" name="postalCode" ng-model="vm.contact.postalCode" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                    </div>\n\n                    <div layout-gt-sm="row" class="layout-gt-sm-row">\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate translate-attr-placeholder="CONTACTMANAGER.NOTES">Notes</label>\n                        <md-icon md-font-icon="icon-note"></md-icon>\n                        <textarea ng-model="vm.contact.description" type="text" max-rows="4" ng-disabled="!vm.crudPermissions.canEdit"></textarea>\n                      </md-input-container>\n                    </div>\n\n                    <div layout="row" layout-align="center center">\n                      <md-button class="md-accent" ng-click="vm.allFields = false" translate="CONTACTMANAGER.FEWER_FIELDS">Fewer Fields\n                      </md-button>\n                    </div>\n\n                  </div>\n                </form>\n              </md-card>\n              <md-card class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n                <div class="pb-16" layout="row" layout-align="start center">\n                  <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.SOCIAL">Social</div>\n                </div>\n                <form name="socialForm" novalidate>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Facebook</label>\n                      <md-icon md-font-icon="icon-facebook" class="facebook"></md-icon>\n                      <input type="text" name="facebook" ng-model="vm.contact.facebook" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit">\n                    </md-input-container>\n                    <div flex="5"></div>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Twitter</label>\n                      <md-icon md-font-icon="icon-twitter" class="twitter"></md-icon>\n                      <input type="text" name="twitter" ng-model="vm.contact.twitter" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit">\n                    </md-input-container>\n                  </div>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Line</label>\n                      <md-icon md-font-icon="fab fa-line"></md-icon>\n                      <input type="text" name="line" ng-model="vm.contact.line" class="text-truncate">\n                    </md-input-container>\n                    <div flex="5"></div>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Viber</label>\n                      <md-icon md-font-icon="fab fa-viber"></md-icon>\n                      <input type="text" name="viber" ng-model="vm.contact.viber" class="text-truncate">\n                    </md-input-container>\n                  </div>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>WeChat</label>\n                      <md-icon md-font-icon="fab fa-weixin"></md-icon>\n                      <input type="text" name="wechat" ng-model="vm.contact.wechat" class="text-truncate">\n                    </md-input-container>\n                    <div flex="5"></div>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Telegram</label>\n                      <md-icon md-font-icon="icon-telegram"></md-icon>\n                      <input type="text" name="telegram" ng-model="vm.contact.telegram" class="text-truncate">\n                    </md-input-container>\n                  </div>\n                </form>\n              </md-card>\n            </div>\n\n            <div flex></div>\n\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="25">\n              <div class="pb-16" layout="row" layout-align="start center">\n                <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.CUSTOM_FIELDS">CUSTOM FIELDS\n                </div>\n              </div>\n              <form name="customFieldsForm" novalidate>\n                <md-input-container class="md-block">\n                  <label translate translate-attr-placeholder="CONTACTMANAGER.LIST">List</label>\n                  <md-select name="list" ng-model="vm.contact.ListId" md-on-close="vm.onSelectList($event)" ng-disabled="vm.contact.ListId">\n                    <md-optgroup label="Lists">\n                      <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">#{{list.id}} - {{list.name}}\n                      </md-option>\n                      <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                    </md-optgroup>\n                  </md-select>\n                </md-input-container>\n                <div ng-repeat="customField in vm.customFields.rows" ng-switch="customField.type">\n                  <md-input-container class="md-block" ng-switch-when="datetime">\n                    <label>{{customField.alias}}</label>\n                    <div ng-init="vm.contact[\'cf_\' + customField.id] = vm.getDateFromString(vm.contact[\'cf_\' + customField.id])">\n                      <mdp-date-picker mdp-open-on-click ng-required="customField.required" mdp-format="YYYY-MM-DD" ng-model="vm.contact[\'cf_\' + customField.id]"></mdp-date-picker>\n                      <mdp-time-picker mdp-open-on-click mdp-placeholder="Time" ng-required="customField.required" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.contact[\'cf_\' + customField.id]">\n                      </mdp-time-picker>\n                    </div>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="select">\n                    <label>{{customField.alias}}</label>\n                    <md-select ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required" ng-disabled="!vm.crudPermissions.canEdit">\n                      <md-option ng-repeat="value in customField.values" ng-value="value.value">{{value.value}}\n                      </md-option>\n                      <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                    </md-select>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="switch">\n                    <md-switch aria-label="{{customField.alias}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-true-value="1" ng-false-value="0">\n                      {{customField.alias}}\n                    </md-switch>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-default>\n                    <label>{{customField.alias}}</label>\n                    <input type="{{customField.type}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required" ng-disabled="!vm.crudPermissions.canEdit">\n                  </md-input-container>\n                </div>\n              </form>\n            </div>\n\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="25">\n              <div class="pb-16" layout="row" layout-align="start center">\n                <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n              </div>\n              <form name="additionalPhonesForm" novalidate>\n                <div ng-repeat="additionalPhone in vm.additionalItems">\n                  <div layout="row">\n                    <md-button class="md-icon-button" ng-show="!$first" ng-click="vm.moveUp($index)">\n                      <md-tooltip>{{\'CONTACTMANAGER.MOVE_UP\' | translate}}</md-tooltip>\n                      <md-icon md-font-icon="icon-arrow-up"></md-icon>\n                    </md-button>\n                    <md-button class="md-icon-button md-primary" ng-show="!$last" ng-click="vm.moveDown($index)">\n                      <md-tooltip>{{\'CONTACTMANAGER.MOVE_DOWN\' | translate}}</md-tooltip>\n                      <md-icon md-font-icon="icon-arrow-down"></md-icon>\n                    </md-button>\n                  </div>\n                  <div layout="column" style="margin-bottom:5px;border-bottom: 1px solid gray;">\n                    <md-input-container class="md-block">\n                      <label>{{$index}} - {{additionalPhone.phone}}</label>\n                      <md-select ng-model="additionalPhone.ItemTypeId" ng-disabled="!vm.crudPermissions.canEdit">\n                        <md-option ng-repeat="value in vm.contactItemTypes" ng-value="value.id">{{value.name}}</md-option>\n                        <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                      </md-select>\n                    </md-input-container>\n                    <md-input-container class="md-block">\n                      <input ng-model="additionalPhone.description" ng-cloak>\n                    </md-input-container>\n                  </div>\n                </div>\n              </form>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab ng-if="vm.license.dialer">\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.MOTION_BULL">MOTION BULL</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.HOPPER">Hopper</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryHopper.filter = query;" on-collapse="vm.queryHopper.filter = undefined;" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-click="vm.getHoppers()" aria-label="reload" translate translate-attr-label="CONTACTMANAGER.RELOAD">\n                    <md-tooltip>{{\'CONTACTMANAGER.RELOAD\' | translate}}</md-tooltip>\n                    <md-icon md-font-icon="icon-reload"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- HOPPER TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryHopper.sort" md-on-reorder="vm.getHoppers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                      <th md-column md-order-by="phone">{{ \'CONTACTMANAGER.PHONE\' | translate }}</th>\n                      <th md-column md-order-by="scheduledat">{{ \'CONTACTMANAGER.SCHEDULEDAT\' | translate }}</th>\n                      <th md-column md-order-by="priority">{{ \'MOTIONDIALER.PRIORITY\' | translate }}</th>\n                      <th md-column md-order-by="recallme">{{ \'CONTACTMANAGER.RECALLME\' | translate }}</th>\n                      <th md-column md-order-by="VoiceQueueId">{{ \'CONTACTMANAGER.VOICEQUEUEID\' | translate }}</th>\n                      <th md-column md-order-by="CampaignId">{{ \'CONTACTMANAGER.CAMPAIGNID\' | translate }}</th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.hoppers.count">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, hopper) in vm.hoppers.rows">\n                      <td md-cell>{{hopper.id}}</td>\n                      <td md-cell privacy ng-cloak>{{hopper.phone}}</td>\n                      <td md-cell>{{hopper.scheduledat | date:\'medium\'}}</td>\n                      <td md-cell>{{ vm.arraypriority[hopper.priority].option }}</td>\n                      <td md-cell class="recallme ">\n                        <md-icon md-colors="{color: {{hopper.recallme ? \'\\\'green\\\'\' : \'\\\'red\\\'\'}}}" md-font-icon="{{hopper.recallme? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell>{{hopper.VoiceQueueId}}</td>\n                      <td md-cell>{{hopper.CampaignId}}</td>\n                      <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="2">\n                            <md-menu-item>\n                              <md-button ng-if="vm.crudPermissions.canEdit && hopper.VoiceQueueId" ng-click="vm.editHopper($event, hopper)" translate="CONTACTMANAGER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                              <md-button ng-if="vm.crudPermissions.canEdit && hopper.CampaignId" ng-click="vm.createOrEditIvrCampaignHopper($event, hopper)" translate="CONTACTMANAGER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                              <md-button ng-click="vm.crudPermissions.canDelete && vm.deleteconfirm(hopper, $event)" translate="CONTACTMANAGER.DELETE_HOPPER">\n                                Delete Hopper\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryHopper.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryHopper.page" md-total="{{vm.hoppers.count}}" md-on-paginate="vm.getHoppers" md-page-select></md-table-pagination>\n              \x3c!-- / HOPPER TABLE --\x3e\n            </div>\n          </div>\n\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.FINAL">Final</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryFinal.filter = query;" on-collapse="vm.queryFinal.filter = undefined;" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-click="vm.getFinals()" aria-label="reload" translate translate-attr-label="CONTACTMANAGER.RELOAD">\n                    <md-tooltip>{{\'CONTACTMANAGER.RELOAD\' | translate}}</md-tooltip>\n                    <md-icon md-font-icon="icon-reload"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- HOPPER TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryFinal.sort" md-on-reorder="vm.getFinals">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">{{ \'CONTACTMANAGER.UNIQUEID\' | translate }}</th>\n                      <th md-column md-order-by="calleridnum">{{ \'CONTACTMANAGER.PHONE\' | translate }}</th>\n                      <th md-column md-order-by="state">{{ \'CONTACTMANAGER.STATE\' | translate }}</th>\n                      <th md-column md-order-by="starttime">{{ \'CONTACTMANAGER.STARTTIME\' | translate }}</th>\n                      <th md-column md-order-by="disposition">{{ \'CONTACTMANAGER.DISPOSITION\' | translate }}</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.finals.count">\n                      <td md-cell colspan="5">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, final) in vm.finals.rows">\n                      <td md-cell>{{final.uniqueid}}</td>\n                      <td md-cell privacy ng-cloak>{{final.calleridnum}}</td>\n                      <td md-cell>{{final.statedesc}}</td>\n                      <td md-cell>{{final.starttime | date:\'medium\'}}</td>\n                      <td md-cell>{{final.disposition}}</td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryFinal.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryFinal.page" md-total="{{vm.finals.count}}" md-on-paginate="vm.getFinals" md-page-select></md-table-pagination>\n              \x3c!-- / HOPPER TABLE --\x3e\n            </div>\n          </div>\n\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.HISTORY">History</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryHistory.filter = query;" on-collapse="vm.queryHistory.filter = undefined;" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-click="vm.getHistories()" aria-label="reload" translate translate-attr-label="CONTACTMANAGER.RELOAD">\n                    <md-tooltip>{{\'CONTACTMANAGER.RELOAD\' | translate}}</md-tooltip>\n                    <md-icon md-font-icon="icon-reload"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- HOPPER TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryHistory.sort" md-on-reorder="vm.getHistories">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">{{ \'CONTACTMANAGER.UNIQUEID\' | translate }}</th>\n                      <th md-column md-order-by="calleridnum">{{ \'CONTACTMANAGER.PHONE\' | translate }}</th>\n                      <th md-column md-order-by="state">{{ \'CONTACTMANAGER.STATE\' | translate }}</th>\n                      <th md-column md-order-by="scheduledat">{{ \'CONTACTMANAGER.SCHEDULEDAT\' | translate }}</th>\n                      <th md-column md-order-by="starttime">{{ \'CONTACTMANAGER.STARTTIME\' | translate }}</th>\n                      <th md-column md-order-by="endtime">{{ \'CONTACTMANAGER.ENDTIME\' | translate }}</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.histories.count">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, history) in vm.histories.rows">\n                      <td md-cell>{{history.uniqueid}}</td>\n                      <td md-cell privacy ng-cloak>{{history.calleridnum}}</td>\n                      <td md-cell>{{history.statedesc}}</td>\n                      <td md-cell>{{history.scheduledat | date:\'medium\'}}</td>\n                      <td md-cell>{{history.starttime | date:\'medium\'}}</td>\n                      <td md-cell>{{history.endtime | date:\'medium\'}}</td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryHistory.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryHistory.page" md-total="{{vm.histories.count}}" md-on-paginate="vm.getHistories" md-page-select></md-table-pagination>\n              \x3c!-- / HOPPER TABLE --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab ng-if="vm.license.jscripty">\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.JSCRIPTY">JSCRIPTY</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.SESSIONS">Sessions</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryJscriptySession.filter = query;" on-collapse="vm.queryJscriptySession.filter = undefined;" debounce="300"></ms-search-bar>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- SESSION TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryJscriptySession.sort" md-on-reorder="vm.getJscriptySessions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                      <th md-column md-order-by="starttime">{{ \'CONTACTMANAGER.STARTTIME\' | translate }}</th>\n                      <th md-column md-order-by="endtime">{{ \'CONTACTMANAGER.ENDTIME\' | translate }}</th>\n                      <th md-column md-order-by="agent">{{ \'CONTACTMANAGER.AGENT\' | translate }}</th>\n                      <th md-column md-order-by="project">{{ \'CONTACTMANAGER.PROJECT\' | translate }}</th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.jscriptySessions.count">\n                      <td md-cell colspan="6">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, session) in vm.jscriptySessions.rows">\n                      <td md-cell>{{session.id}}</td>\n                      <td md-cell>{{session.starttime | date:\'medium\'}}</td>\n                      <td md-cell>{{session.endtime | date:\'medium\'}}</td>\n                      <td md-cell>{{session.membername}}</td>\n                      <td md-cell>{{session.projectname}}</td>\n                      <td md-cell class="actions"></td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryHopper.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryHopper.page" md-total="{{vm.hoppers.count}}" md-on-paginate="vm.getHoppers" md-page-select></md-table-pagination>\n              \x3c!-- / SESSION TABLE --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.CUSTOMER_JOURNEY">CUSTOMER JOURNEY</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <md-content class="md-padding" id="journey-content">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'">\n            </div>\n          </md-content>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/contactmanager/views/contacts/import/import.html",'<md-dialog class="import-dialog" aria-label="Import contact">\n  <form name="importForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="CONTACTMANAGER.IMPORT_CONTACTS">Import Contacts</span>\n        <md-button ng-if="vm.result.finish || !vm.processing" class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <div md-background-bg layout="row" layout-align="start start">\n      <md-progress-linear ng-disabled="!vm.processing || vm.result.finish" md-mode="indeterminate" class="md-warn"></md-progress-linear>\n    </div>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div>\n        <md-content ng-show="!vm.processing">\n          <div class="form-title" translate="CONTACTMANAGER.CONTACTMANAGER">CONTACT MANAGER</div>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="contactField in vm.contactFields">\n            <label>{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</label>\n            <md-select name="{{contactField.key}}" ng-model="vm.binding[contactField.key]" placeholder="{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}" ng-required="contactField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="contactField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.LIST">List</label>\n            <md-select name="list" ng-model="vm.ListId" placeholder="Select a list" ng-change="vm.onChangeList()" required>\n              <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="customField in vm.customFields.rows">\n            <label>{{customField.alias}}</label>\n            <md-select ng-model="vm.binding[\'cf_\' + customField.id]" placeholder="{{customField.alias}}" ng-required="customField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="customField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.COMPANY">Company</label>\n            <md-select name="company" ng-model="vm.CompanyId" placeholder="Select a company">\n              <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n              <md-option ng-value="null">\n                <em translate="CONTACTMANAGER.NONE">None</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <md-select ng-model="vm.duplicates" placeholder="{{ \'CONTACTMANAGER.CHECK_DUPLICATES\' | translate}}" multiple>\n              <md-option ng-value="contactField.key" ng-repeat="contactField in vm.contactFields">{{ \'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <div ng-if="vm.license.dialer">\n            <div class="form-title" translate="CONTACTMANAGER.MOTIONDIALER">MOTION BULL</div>\n\n            <md-input-container class="md-icon-float md-block" ng-repeat="motionBullField in vm.motionBullFields">\n              <label>{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}</label>\n              <md-select name="{{motionBullField.key}}" ng-model="vm.binding[motionBullField.key]" placeholder="{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}" ng-required="motionBullField.required">\n                <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                <md-option ng-value="null" ng-hide="contactField.required">\n                  <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n                </md-option>\n              </md-select>\n            </md-input-container>\n            <div class="form-title" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n            <div layout="row" ng-repeat="additionalPhone in vm.contactItemTypes" flex>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select name="{{additionalPhone.key}}" ng-model="vm.binding[additionalPhone.key]" placeholder="{{additionalPhone.key}}" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select name="{{additionalPhone.key+\'_description\'}}" ng-model="vm.binding[additionalPhone.key+\'_description\']" placeholder="{{additionalPhone.key}} description" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n            </div>\n          </div>\n\n        </md-content>\n\n        <div class="error-list" ng-if="vm.result.finish">\n          <div class="info" layout="row" layout-align="space-between center">\n            <div>\n              <div class="message">{{\'CONTACTMANAGER.UPLOAD_COMPLETED\' | translate | uppercase}} ({{vm.result.elapsed}}s)</div>\n            </div>\n            <md-button class="md-icon-button">\n              <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n            </md-button>\n          </div>\n        </div>\n\n        <div layout="row" ng-if="vm.processing">\n          \x3c!-- WIDGET PROCESSING --\x3e\n          <ms-widget ng-if="!vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.rows"></span>\n                </div>\n                <div ng-if="vm.processing" class="font-weight-500 secondary-text">Please wait, we are processing your contacts...</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET PROCESSING --\x3e\n          \x3c!-- WIDGET SUCCESS --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 green-fg">\n                  <span ng-bind="vm.result.affectedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.SUCCESS">Success</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET SUCCESS --\x3e\n\n          \x3c!-- WIDGET FAILURE --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 red-fg">\n                  <span ng-bind="vm.result.failedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.FAILURE">Failure</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET FAILURE --\x3e\n\n          \x3c!-- WIDGET DUPLICATES --\x3e\n          <ms-widget ng-if="vm.result.duplicatedRows && vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.duplicatedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.DUPLICATES">Duplicates</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET DUPLICATES --\x3e\n        </div>\n\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row">\n        <md-button ng-if="!vm.processing" ng-disabled="importForm.$invalid || importForm.$pristine" ng-click="vm.uploadCsv()" class="md-accent md-raised" aria-label="UPLOAD" translate="CONTACTMANAGER.UPLOAD" translate-attr-aria-label="CONTACTMANAGER.IMPORT">\n          IMPORT\n        </md-button>\n        <md-button ng-if="vm.processing && !vm.result.finish && !vm.stopping" ng-click="vm.stopUpload()" class="md-accent md-raised" aria-label="Stop Upload" translate="CONTACTMANAGER.STOP" translate-attr-aria-label="CONTACTMANAGER.STOP">\n          STOP\n        </md-button>\n        <md-button ng-if="vm.result.finish && vm.result.errors.length" ng-csv="vm.getArrayErrors()" csv-header="vm.getHeaderErrors()" class="md-accent md-raised" aria-label="Export Errors" filename="contacts_import_errors.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon> {{\'CONTACTMANAGER.EXPORT_ERRORS\' | translate}}\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/import/importUpdates.html",'<md-dialog class="import-dialog" aria-label="Import contact">\n  <form name="importForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="CONTACTMANAGER.UPDATE_EXISTING_CONTACTS">Update Existing Contacts</span>\n        <md-button ng-if="vm.result.finish || !vm.processing" class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <div md-background-bg layout="row" layout-align="start start">\n      <md-progress-linear ng-disabled="!vm.processing || vm.result.finish" md-mode="indeterminate" class="md-warn"></md-progress-linear>\n    </div>\n\n    <md-dialog-content ms-scroll>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div>\n        <md-content ng-show="!vm.processing">\n          <div class="form-title" translate="CONTACTMANAGER.CONTACTMANAGER">CONTACT MANAGER</div>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="contactField in vm.contactFields">\n            <label>{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</label>\n            <md-select name="{{contactField.key}}" ng-model="vm.binding[contactField.key]" placeholder="{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}" ng-required="contactField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="contactField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.LIST">List</label>\n            <md-select name="list" ng-model="vm.ListId" placeholder="Select a list" ng-change="vm.onChangeList()" required>\n              <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="customField in vm.customFields.rows">\n            <label>{{customField.alias}}</label>\n            <md-select ng-model="vm.binding[\'cf_\' + customField.id]" placeholder="{{customField.alias}}" ng-required="customField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="customField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.COMPANY">Company</label>\n            <md-select name="company" ng-model="vm.CompanyId" placeholder="Select a company">\n              <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n              <md-option ng-value="null">\n                <em translate="CONTACTMANAGER.NONE">None</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <md-select ng-model="vm.duplicates" placeholder="{{ \'CONTACTMANAGER.CHECK_DUPLICATES\' | translate}}" multiple>\n              <md-option ng-value="contactField.key" ng-repeat="contactField in vm.contactFields">{{ \'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <div ng-if="vm.license.dialer">\n            <div class="form-title" translate="CONTACTMANAGER.MOTIONDIALER">MOTION BULL</div>\n\n            <md-input-container class="md-icon-float md-block" ng-repeat="motionBullField in vm.motionBullFields">\n              <label>{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}</label>\n              <md-select name="{{motionBullField.key}}" ng-model="vm.binding[motionBullField.key]" placeholder="{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}" ng-required="motionBullField.required">\n                <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                <md-option ng-value="null" ng-hide="contactField.required">\n                  <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n                </md-option>\n              </md-select>\n            </md-input-container>\n            <div class="form-title" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n            <div layout="row" ng-repeat="additionalPhone in vm.contactItemTypes" flex>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select multiple="true" name="{{additionalPhone.key}}" ng-model="vm.binding[additionalPhone.key]" placeholder="{{additionalPhone.key}}" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select multiple="true" name="{{additionalPhone.key+\'_description\'}}" ng-model="vm.binding[additionalPhone.key+\'_description\']" placeholder="{{additionalPhone.key}} description" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n            </div>\n          </div>\n\n        </md-content>\n\n        <div class="error-list" ng-if="vm.result.finish">\n          <div class="info" layout="row" layout-align="space-between center">\n            <div>\n              <div class="message">{{\'CONTACTMANAGER.UPLOAD_COMPLETED\' | translate | uppercase}} ({{vm.result.elapsed}}s)</div>\n            </div>\n            <md-button class="md-icon-button">\n              <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n            </md-button>\n          </div>\n        </div>\n\n        <div layout="row" ng-if="vm.processing">\n          \x3c!-- WIDGET PROCESSING --\x3e\n          <ms-widget ng-if="!vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.rows"></span>\n                </div>\n                <div ng-if="vm.processing" class="font-weight-500 secondary-text">Please wait, we are processing your contacts...</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET PROCESSING --\x3e\n          \x3c!-- WIDGET SUCCESS --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 green-fg">\n                  <span ng-bind="vm.result.affectedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.SUCCESS">Success</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET SUCCESS --\x3e\n\n          \x3c!-- WIDGET FAILURE --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 red-fg">\n                  <span ng-bind="vm.result.failedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.FAILURE">Failure</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET FAILURE --\x3e\n\n          \x3c!-- WIDGET DUPLICATES --\x3e\n          <ms-widget ng-if="vm.result.duplicatedRows && vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.duplicatedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.DUPLICATES">Duplicates</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET DUPLICATES --\x3e\n        </div>\n\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row">\n        <md-button ng-if="!vm.processing" ng-disabled="importForm.$invalid || importForm.$pristine" ng-click="vm.uploadCsv()" class="md-accent md-raised" aria-label="UPLOAD" translate="CONTACTMANAGER.UPLOAD" translate-attr-aria-label="CONTACTMANAGER.IMPORT">\n          IMPORT\n        </md-button>\n        <md-button ng-if="vm.processing && !vm.result.finish && !vm.stopping" ng-click="vm.stopUpload()" class="md-accent md-raised" aria-label="Stop Upload" translate="CONTACTMANAGER.STOP" translate-attr-aria-label="CONTACTMANAGER.STOP">\n          STOP\n        </md-button>\n        <md-button ng-if="vm.result.finish && vm.result.errors.length" ng-csv="vm.getArrayErrors()" csv-header="vm.getHeaderErrors()" class="md-accent md-raised" aria-label="Export Errors" filename="contacts_import_errors.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon> {{\'CONTACTMANAGER.EXPORT_ERRORS\' | translate}}\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/merge/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="Merge Contact">\n  <form name="contactForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block" flex-gt-sm>\n        <label>Filter</label>\n        <input ng-model="vm.searchTerm" name="searchTerm" ng-model-options="{ debounce: 300 }" ng-change="vm.change()">\n      </md-input-container>\n\n      <md-list flex>\n        <md-subheader class="md-no-sticky" ng-hide="vm.contacts.length"><em>Filter doesn\'t match any contact</em></md-subheader>\n        <md-list-item class="md-3-line" ng-repeat="contact in vm.contacts | filter:{ id: \'!\' + vm.contact.id}" ng-click="vm.showConfirm($event, vm.contact, contact)">\n          <img ng-src="assets/images/avatars/profile.png" class="md-avatar" alt="{{contact.who}}" />\n          <div class="md-list-item-text" layout="column">\n            <h3>#{{ contact.id }} - {{ contact.firstName }} {{ contact.lastName }}</h3>\n            <h4>{{ contact.email }}</h4>\n            <p>{{ contact.phone }}</p>\n          </div>\n        </md-list-item>\n      </md-list>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/globalCustomFields/create/dialog.html",'<md-dialog class="globalCustomField-dialog" aria-label="New GlobalCustomField">\n  <form name="globalCustomFieldForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.ALIAS">Alias</label>\n        <input type="" name="alias" ng-model="vm.globalCustomField.alias" ng-required="true" autofocus>\n\n        <div ng-messages="globalCustomFieldForm[\'alias\'].$error" ng-show="globalCustomFieldForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.globalCustomField.type" required ng-disabled="!vm.newGlobalCustomField">\n          <md-option ng-value="\'text\'">Text</md-option>\n          <md-option ng-value="\'select\'">Select</md-option>\n          <md-option ng-value="\'number\'">Number</md-option>\n          <md-option ng-value="\'switch\'">Switch</md-option>\n          <md-option ng-value="\'datetime\'">Datetime</md-option>\n        </md-select>\n        <div ng-messages="globalCustomFieldForm[\'type\'].$error" ng-show="globalCustomFieldForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.globalCustomField.type == \'select\'" class="md-block">\n        <md-list>\n          <md-list-item layout-margin>\n            <md-button class="md-fab md-mini md-secondary" ng-click="vm.addItem(vm.globalCustomField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.ADD">ADD</span></md-tooltip>\n              <md-icon md-font-icon="icon-plus" aria-label="alert error"></md-icon>\n            </md-button>\n            <md-button ng-if="vm.globalCustomField.values.length" class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItems(vm.globalCustomField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE_ALL">Delete All</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list ng-sortable="vm.sortable">\n          <md-list-item ng-repeat="item in vm.globalCustomField.values" style="border: 1px solid #ccc!important; border-radius: 7px;" layout-margin>\n            <div>\n              <md-icon class="s24" style="cursor:move" md-font-icon="icon-drag" aria-label="drag"></md-icon>\n              <input type="text" ng-model="item.value" flex>\n            </div>\n            <md-button class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItem(vm.globalCustomField.values, $index);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list>\n          <md-list-item ng-if="!vm.globalCustomField.values.length" layout="row" layout-align="center center">\n            <em translate="CONTACTMANAGER.NO_AVAILABLE_ITEMS">No Available Items</em>\n          </md-list-item>\n        </md-list>\n      </div>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.globalCustomField.required" aria-label="Required"><span translate="CONTACTMANAGER.REQUIRED">Required</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.globalCustomField.type == \'text\'" class="md-block">\n        <md-switch ng-model="vm.globalCustomField.clickToAction" aria-label="ClickToAction"><span translate="CONTACTMANAGER.CLICKTOACTION">ClickToAction</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.globalCustomField.clickToAction" class="md-block">\n        <label translate="CONTACTMANAGER.ACTIONTYPE">ActionType</label>\n        <md-select name="actionType" ng-model="vm.globalCustomField.actionType">\n          <md-option ng-value="\'voice\'">Voice</md-option>\n        </md-select>\n        <div ng-messages="globalCustomFieldForm[\'actionType\'].$error" ng-show="globalCustomFieldForm[\'actionType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ACTIONTYPE_REQUIRED">ActionType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newGlobalCustomField" ng-click="vm.saveGlobalCustomField()" class="send-button md-accent md-raised" ng-disabled="globalCustomFieldForm.$invalid || globalCustomFieldForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newGlobalCustomField" ng-click="vm.addNewGlobalCustomField()" class="send-button md-accent md-raised" ng-disabled="globalCustomFieldForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_GLOBALCUSTOMFIELD" translate-attr-aria-label="CONTACTMANAGER.ADD_GLOBALCUSTOMFIELD">\n          ADD GLOBALCUSTOMFIELD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newGlobalCustomField" ng-click="vm.deleteGlobalCustomField($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/globalCustomFields/globalCustomFields.html",'<div id="globalCustomFields" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-circle" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.GLOBALCUSTOMFIELDS">GlobalCustomFields</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedGlobalCustomFields.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedGlobalCustomFields =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-globalCustomFields-count">\n          <span>{{vm.selectedGlobalCustomFields.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTMANAGER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllGlobalCustomFields()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectGlobalCustomFields()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedGlobalCustomFields" csv-label="true" filename="globalCustomFields.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedGlobalCustomFields($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- GLOBALCUSTOMFIELD TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedGlobalCustomFields" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getGlobalCustomFields">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                <th md-column md-order-by="alias">{{ \'CONTACTMANAGER.ALIAS\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'CONTACTMANAGER.TYPE\' | translate }}</th>\n                <th md-column md-order-by="required">{{ \'CONTACTMANAGER.REQUIRED\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.globalCustomFields.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="globalCustomField" md-select-id="id" ng-repeat="globalCustomField in vm.globalCustomFields.rows">\n                <td md-cell ng-if="globalCustomField.userpic"><img class="avatar" alt="{{globalCustomField.name}}" ng-src="api/users/{{globalCustomField.id}}/avatar" /></td>\n                <td md-cell ng-if="!globalCustomField.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{globalCustomField.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="id ">{{globalCustomField.id}}</td>\n                <td ng-click="vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="alias ">{{globalCustomField.alias}}</td>\n                <td ng-click="vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="type ">{{ vm.arraytype[globalCustomField.type].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(globalCustomField, ev) : vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="required ">\n                  <md-icon md-colors="{color: {{globalCustomField.required ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{globalCustomField.required ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(globalCustomField, $event    )" translate="CONTACTMANAGER.EDIT_GLOBALCUSTOMFIELD">\n                          Edit GlobalCustomField\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(globalCustomField, $event    )" translate="CONTACTMANAGER.DELETE_GLOBALCUSTOMFIELD">\n                          Delete GlobalCustomField\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.globalCustomFields.count}}" md-on-paginate="vm.getGlobalCustomFields" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / GLOBALCUSTOMFIELD TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD GLOBALCUSTOMFIELD BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-globalCustomField-button" ng-click="vm.createOrEditGlobalCustomField($event)" aria-label="add globalCustomField" translate translate-attr-aria-label="CONTACTMANAGER.ADD_GLOBALCUSTOMFIELD">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD GLOBALCUSTOMFIELD BUTTON --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/lists/create/dialog.html",'<md-dialog class="list-dialog" aria-label="New List">\n  <form name="listForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.list.name" ng-required="true" autofocus>\n\n        <div ng-messages="listForm[\'name\'].$error" ng-show="listForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.list.description">\n\n        <div ng-messages="listForm[\'description\'].$error" ng-show="listForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newList" ng-click="vm.saveList()" class="send-button md-accent md-raised" ng-disabled="listForm.$invalid || listForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newList" ng-click="vm.addNewList()" class="send-button md-accent md-raised" ng-disabled="listForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_LIST" translate-attr-aria-label="CONTACTMANAGER.ADD_LIST">\n          ADD LIST\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newList" ng-click="vm.deleteList($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",'<md-dialog class="list-dialog" aria-label="list" ng-init="vm.onInit()">\n  <form name="listForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CONTACTMANAGER.AGENTADD_LIST">Add Agent to list</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/lists/edit/customFields/dialog.html",'<md-dialog class="customField-dialog" aria-label="New CustomField">\n  <form name="customFieldForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.ALIAS">Alias</label>\n        <input type="" name="alias" ng-model="vm.customField.alias" ng-required="true" autofocus>\n\n        <div ng-messages="customFieldForm[\'alias\'].$error" ng-show="customFieldForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.customField.type" required ng-disabled="!vm.newCustomField">\n          <md-option ng-value="\'text\'">Text</md-option>\n          <md-option ng-value="\'select\'">Select</md-option>\n          <md-option ng-value="\'number\'">Number</md-option>\n          <md-option ng-value="\'switch\'">Switch</md-option>\n          <md-option ng-value="\'datetime\'">Datetime</md-option>\n        </md-select>\n        <div ng-messages="customFieldForm[\'type\'].$error" ng-show="customFieldForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.customField.type == \'select\'" class="md-block">\n        <md-list>\n          <md-list-item layout-margin>\n            <md-button class="md-fab md-mini md-secondary" ng-click="vm.addItem(vm.customField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.ADD">ADD</span></md-tooltip>\n              <md-icon md-font-icon="icon-plus" aria-label="alert error"></md-icon>\n            </md-button>\n            <md-button ng-if="vm.customField.values.length" class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItems(vm.customField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE_ALL">Delete All</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list ng-sortable="vm.sortable">\n          <md-list-item ng-repeat="item in vm.customField.values" style="border: 1px solid #ccc!important; border-radius: 7px;" layout-margin>\n            <div>\n              <md-icon class="s24" style="cursor:move" md-font-icon="icon-drag" aria-label="drag"></md-icon>\n              <input type="text" ng-model="item.value" flex>\n            </div>\n            <md-button class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItem(vm.customField.values, $index);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list>\n          <md-list-item ng-if="!vm.customField.values.length" layout="row" layout-align="center center">\n            <em translate="CONTACTMANAGER.NO_AVAILABLE_ITEMS">No Available Items</em>\n          </md-list-item>\n        </md-list>\n      </div>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customField.required" aria-label="Required"><span translate="CONTACTMANAGER.REQUIRED">Required</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.customField.type == \'text\'" class="md-block">\n        <md-switch ng-model="vm.customField.clickToAction" aria-label="clickToAction"><span translate="CONTACTMANAGER.CLICKTOACTION">clickToAction</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.customField.clickToAction" class="md-block">\n        <label translate="CONTACTMANAGER.ACTIONTYPE">actionType</label>\n        <md-select name="actionType" ng-model="vm.customField.actionType">\n          <md-option ng-value="\'voice\'">Voice</md-option>\n        </md-select>\n        <div ng-messages="customFieldForm[\'actionType\'].$error" ng-show="customFieldForm[\'actionType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ACTIONTYPE_REQUIRED">actionType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCustomField" ng-click="vm.saveCustomField()" class="send-button md-accent md-raised" ng-disabled="customFieldForm.$invalid || customFieldForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCustomField" ng-click="vm.addNewCustomField()" class="send-button md-accent md-raised" ng-disabled="customFieldForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_CUSTOMFIELD" translate-attr-aria-label="CONTACTMANAGER.ADD_CUSTOMFIELD">\n          ADD CUSTOMFIELD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCustomField" ng-click="vm.deleteCustomField($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/lists/edit/view.html",'<div id="contactmanager-list" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-lists-button md-icon-button" aria-label="Go to lists" ng-click="vm.gotoLists()" translate translate-attr-aria-label="CONTACTMANAGER.GO_TO_LISTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="list-image" hide-xs>\n          <img ng-src="assets/images/business/lists.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.list.id}}\n            <span ng-if="vm.list.name">{{vm.list.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CONTACTMANAGER.CREATED_AT"></span> <span>{{vm.list.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.list, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="CONTACTMANAGER.GOTO_LIST"></span></md-tooltip>\n        <md-icon md-font-icon="icon-forward"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.list, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="CONTACTMANAGER.AGENTADD_LIST"></span></md-tooltip>\n        <md-icon md-font-icon="icon-eye"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveList()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (customFieldsForm.$invalid) || (voiceDispositionsForm.$invalid)" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="list-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.list.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.list.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.PREFIX">Prefix</label>\n                <input type="text" name="dialPrefix" ng-model="vm.list.dialPrefix" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'dialPrefix\'].$error" ng-show="generalForm[\'dialPrefix\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.CUSTOMFIELDS">CUSTOMFIELDS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="list-detail-form-container customfields md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ListCustomFieldsController as vm_dc" ng-init="vm_dc.init(vm.list, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedListCustomFields.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.CUSTOMFIELDS">CustomFields</span>\n                  <ms-search-bar on-search="vm_dc.getListCustomFields()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditListCustomField($event)" aria-label="add customField" translate translate-attr-label="CONTACTMANAGER.ADD_CUSTOMFIELD">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedListCustomFields.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedListCustomFields.length}} {{vm_dc.selectedListCustomFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedListCustomFields" csv-label="true" filename="lists.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedListCustomFields($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedListCustomFields" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getListCustomFields">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CONTACTMANAGER.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="alias">\n                        {{ \'CONTACTMANAGER.ALIAS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="type">\n                        {{ \'CONTACTMANAGER.TYPE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="required">\n                        {{ \'CONTACTMANAGER.REQUIRED\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="customField" md-select-id="id" ng-repeat="customField in vm_dc.listCustomFields.rows">\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>\n                        {{customField.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>\n                        {{customField.alias}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>\n                        {{ vm_dc.arraytype[customField.type].option }} </td>\n\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell class="required ">\n                        <md-icon md-colors="{color: {{customField.required ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{customField.required? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditListCustomField($event, customField)" translate="CONTACTMANAGER.EDIT_CUSTOMFIELD">\n                                Edit CustomField\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(customField, $event)" translate="CONTACTMANAGER.DELETE_CUSTOMFIELD">\n                                Delete CustomField\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.listCustomFields.rows.length">\n                      <td md-cell colspan="9">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CONTACTMANAGER.NO_CUSTOMFIELD_AVAILABLE">No customfield available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.listCustomFields.count}}" md-on-paginate="vm_dc.getListCustomFields" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="ListDispositionsController as vm_dc" ng-init="vm_dc.init(vm.list, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="list-detail-form-container voicedispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedListDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="CONTACTMANAGER.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add contactmanager dispositions" translate translate-attr-label="CONTACTMANAGER.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="lists.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'CONTACTMANAGER.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'CONTACTMANAGER.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/contactmanager/views/lists/lists.html",'<div id="lists" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-circle" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.LISTS">Lists</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedLists.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedLists =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-lists-count">\n          <span>{{vm.selectedLists.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTMANAGER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllLists()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectLists()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedLists" csv-label="true" filename="lists.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedLists($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- LIST TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedLists" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getLists">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CONTACTMANAGER.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CONTACTMANAGER.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.lists.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="list" md-select-id="id" ng-repeat="list in vm.lists.rows">\n                <td md-cell ng-if="list.userpic"><img class="avatar" alt="{{list.name}}" ng-src="api/users/{{list.id}}/avatar" /></td>\n                <td md-cell ng-if="!list.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{list.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(list, ev) : vm.createOrEditList($event, list)" md-cell class="id ">{{list.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(list, ev) : vm.createOrEditList($event, list)" md-cell class="name ">{{list.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(list, ev) : vm.createOrEditList($event, list)" md-cell class="description ">{{list.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(list, $event    )" translate="CONTACTMANAGER.EDIT_LIST">\n                          Edit List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotocontactsgoto(list, $event    )" translate="CONTACTMANAGER.GOTOCONTACTS_LIST">\n                          goToContacts List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadContactManagerLists">\n\n                        <md-button ng-click="vm.exportcsvcontactsexport(list, $event    )" translate="CONTACTMANAGER.EXPORTCSVCONTACTS_LIST">\n                          exportCsvContacts List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(list, $event    )" translate="CONTACTMANAGER.AGENTADD_LIST">\n                          AgentAdd List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(list, $event    )" translate="CONTACTMANAGER.DELETE_LIST">\n                          Delete List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.lists.count}}" md-on-paginate="vm.getLists" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / LIST TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD LIST BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-list-button" ng-click="vm.createOrEditList($event)" aria-label="add list" translate translate-attr-aria-label="CONTACTMANAGER.ADD_LIST">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD LIST BUTTON --\x3e\n</div>'),e.put("app/main/apps/dashboards/views/custom/custom.html",'<div ng-if="!vm.customDashboard">\n  <p>Custom Dashboard not available...</p>\n</div>\n<div id="dashboard-custom" ng-if="vm.customDashboard" ng-cloak layout-fill>\n  <md-content>\n    <md-toolbar class="md-default md-accent filter-header">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead">{{vm.customDashboard.name}}</span>\n        <div flex></div>\n        <md-button ng-click="vm.setFilter($event)">\n          <md-tooltip md-direction="top"><span translate="DASHBOARDS.FILTERS"></span></md-tooltip>\n          <md-icon md-font-icon="icon-filter" ng-class=""></md-icon>\n        </md-button>\n        <md-button ng-if="vm.crudPermissions.canEdit" class="md-icon-button" ng-click="vm.goToEdit()" aria-label="goToEdit">\n          <md-tooltip md-direction="top"><span translate="DASHBOARDS.EDIT"></span></md-tooltip>\n          <md-icon md-font-icon="icon-table-edit"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <ms-widget-engine config="vm.customDashboard"></ms-widget-engine>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/custom/filter/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="Set Filter">\n  <form name="FilterForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content style="padding:30px;">\n      <div layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-phone"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_VOICE_QUEUES">Filter Voice Queues</span>\n          </div>\n          <md-select placeholder="Select one or more queues" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'voice\')" ng-model="vm.parent.voiceQueuesSelected" multiple aria-label="voiceQueues">\n            <md-option ng-value="voiceQueue.id" ng-repeat="voiceQueue in vm.parent.voiceQueues.rows">{{\n                            voiceQueue.name }}\n            </md-option>\n          </md-select>\n        </div>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-hangouts"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_CHAT_WEBSITES">Filter Chat\n              Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'chat\')" ng-model="vm.parent.chatWebsitesSelected" multiple aria-label="chatWebsite">\n            <md-option ng-value="chatWebsite.id" ng-repeat="chatWebsite in vm.parent.chatWebsites.rows">{{\n                            chatWebsite.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n      <div class="margin-top-30" layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-message-text"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_SMS_ACCOUNTS">Filter Sms Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'sms\')" ng-model="vm.parent.smsAccountsSelected" multiple aria-label="smsAccount">\n            <md-option ng-value="smsAccount.id" ng-repeat="smsAccount in vm.parent.smsAccounts.rows">{{\n                            smsAccount.name }}</md-option>\n          </md-select>\n        </div>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-deskphone"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_FAX_ACCOUNTS">Filter Fax Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'fax\')" ng-model="vm.parent.faxAccountsSelected" multiple aria-label="faxAccount">\n            <md-option ng-value="faxAccount.id" ng-repeat="faxAccount in vm.parent.faxAccounts.rows">{{\n                            faxAccount.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n      <div class="margin-top-30" layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-email"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_MAIL_ACCOUNTS">Filter Mail\n              Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'mail\')" ng-model="vm.parent.mailAccountsSelected" multiple aria-label="mailAccount">\n            <md-option ng-value="mailAccount.id" ng-repeat="mailAccount in vm.parent.mailAccounts.rows">{{\n                            mailAccount.name }}</md-option>\n          </md-select>\n        </div>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-google-earth"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_OPENCHANNEL_ACCOUNTS">Filter Openchannel\n              Websites</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'openchannel\')" ng-model="vm.parent.openchannelAccountsSelected" multiple aria-label="openchannelAccount">\n            <md-option ng-value="openchannelAccount.id" ng-repeat="openchannelAccount in vm.parent.openchannelAccounts.rows">{{\n                            openchannelAccount.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n      <div class="margin-top-30" layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-whatsapp"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_WHATSAPP_ACCOUNTS">Filter Whatsapp\n              Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'whatsapp\')" ng-model="vm.parent.whatsappAccountsSelected" multiple aria-label="whatsappAccount">\n            <md-option ng-value="whatsappAccount.id" ng-repeat="whatsappAccount in vm.parent.whatsappAccounts.rows">\n              {{whatsappAccount.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.confirm()" class="send-button md-accent md-raised" aria-label="CONFIRM" translate="DASHBOARDS.CONFIRM" translate-attr-aria-label="DASHBOARDS.CONFIRM">\n          CONFIRM\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/agent.general.html",'<div id="agent-general" layout="column">\n  <div layout="row" layout-align="start center" class="md-primary-bg">\n    <md-button class="md-raised no-margin width-50" style="border-radius: 0px" ng-class="{\'md-primary\': !vm.isActiveTab(0)}" ng-click="vm.onClickTab(0)" aria-label="home">\n      <md-tooltip md-direction="bottom" md-delay="500">Home</md-tooltip>\n      <md-icon md-font-icon="icon-home" class="icon"></md-icon>\n    </md-button>\n\n    <ms-tab-scroll style="overflow: hidden;">\n      <div layout="column" ng-repeat="(key, tab) in vm.tabs | orderByDate " ng-click="vm.onClickTab(tab.id)" ng-class="{\'grey-50-bg\': vm.isActiveTab(tab.id)}">\n        <div style="height: 34px" layout="row" layout-align="space-between center">\n          <md-icon md-font-icon="{{tab.icon}}" class="icon s16 margin-horizontal-5" ng-class="tab.color + \'-fg\'">\n          </md-icon>\n          <span class="text-truncate font-size-12" ng-class="vm.isActiveTab(tab.id) ? \'black-fg\' : \'grey-300-fg\'">\n            {{tab.title}}\n            <span ng-if="tab.badges" class="badge md-white-fg md-red-bg">{{tab.badges}}</span></span>\n          <md-button class="md-icon-button md-mini no-margin" ng-class="vm.isActiveTab(tab.id) ? \'md-primary\' : \'grey-300-fg\'" aria-label="close" ng-click="vm.closeTab(tab); $event.stopPropagation()">\n            <md-icon md-font-icon="icon-close-circle-outline" class="icon s16"></md-icon>\n          </md-button>\n        </div>\n        <div style="height: 2px" ng-class="vm.isActiveTab(tab.id) ? tab.color + \'-bg\' : \'\'"></div>\n      </div>\n    </ms-tab-scroll>\n  </div>\n  \x3c!-- home --\x3e\n  <div layout="row" class="agent-content overflow-hidden" ng-if="vm.isActiveTab(0)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.html\'" ng-controller="AgentGeneralHomeController as vm_home" ng-init="vm_home.init(vm.license, vm.setting)"></div>\n  \x3c!-- other tabs --\x3e\n  <div ng-if="tab.id !== 0 && vm.isActiveTab(tab.id)" ng-repeat="(key, tab) in vm.tabs | orderByDate " ng-switch="tab.type" flex layout="column">\n    <div ng-switch-when="contact" ng-class="{{tab.type}}" flex layout="column">\n      <div class="agent-content" flex layout="column" ng-if="vm.isActiveTab(tab.id)" ng-include="\'app/main/apps/dashboards/views/general/agent/contact/agent.general.contact.html\'" ng-controller="AgentGeneralContactController as vm" ng-init="vm.init(tab,$parent.vm.license)"></div>\n    </div>\n    <div ng-switch-when="popup" ng-class="{{tab.type}}" flex layout="column">\n      <div flex layout="column" ng-if="vm.isActiveTab(tab.id)" ng-include="\'app/main/apps/dashboards/views/general/agent/popup/agent.general.popup.html\'" ng-controller="AgentGeneralPopupController as vm" ng-init="vm.init(tab)"></div>\n    </div>\n    <div ng-switch-when="jscripty" ng-class="{{tab.type}}" flex layout="column">\n      <div class="agent-content" ng-if="vm.isActiveTab(tab.id)" ng-include="\'app/main/apps/dashboards/views/general/agent/jscripty/agent.general.jscripty.html\'" ng-controller="AgentGeneralJscriptyController as vm" ng-init="vm.init(tab)"></div>\n    </div>\n    <div ng-switch-when="bot" ng-class="{{tab.type}}" flex layout="column">\n      <div id="interaction-app" flex layout="column" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/bot/agent.general.bot.html\'" ng-controller="AgentGeneralBotController as vm" ng-init="vm.init(tab, $parent.vm.setting)"></div>\n    </div>\n    <div ng-switch-when="interaction" ng-class="{{tab.type}}" flex layout="column">\n      <div id="interaction-app" flex layout="column" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.html\'" ng-controller="AgentGeneralInteractionController as vm" ng-init="vm.init(tab, $parent.vm.setting)">\n      </div>\n    </div>\n    <div ng-switch-when="iframe" ng-class="{{tab.type}}" flex layout="column">\n      <div id="iframe" flex layout="column" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/iframe/agent.general.iframe.html\'" ng-controller="AgentGeneralIframeController as vm" ng-init="vm.init(tab, $parent.vm.setting)">\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/bot/agent.general.bot.html",'\x3c!-- CONTENT CARD --\x3e\n<md-content class="content-card" layout="row" layout-fill>\n\n  <div ng-if="!vm.showInteraction" class="start-point" flex layout="column" layout-align="center center">\n    <div class="big-circle md-whiteframe-4dp">\n      <md-icon class="s128 md-accent pink-fg" md-font-icon="fas fa-robot"></md-icon>\n    </div>\n    <span class="app-title" translate="DASHBOARDS.WAITING">Waiting</span>\n    <span class="hide show-gt-md secondary-text" translate="DASHBOARDS.LOADING_INTERACTION">We are loading the\n      interaction...</span>\n  </div>\n\n  <div ng-if="vm.showInteraction" flex layout="row">\n    <md-card flex="100" class="interaction">\n      \x3c!-- TOOLBAR --\x3e\n      <md-toolbar class="interaction-toolbar">\n        <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n          <md-icon md-font-icon="fas fa-robot" class="s20 pink-fg"></md-icon>\n          <div class="padding-left-10" layout="column" layout-align="center start" flex>\n            <div class="font-size-14" layout="row" layout-align="start center" layout-fill>\n              <span>#{{vm.tab.data.uniqueid}} - {{vm.tab.title}}</span>\n            </div>\n          </div>\n          <div layout="row" layout-align="end center">\n\n          </div>\n        </div>\n      </md-toolbar>\n      \x3c!-- / TOOLBAR --\x3e\n\n      \x3c!-- CONTENT --\x3e\n      <md-content id="interaction-content" name="{{\'interaction-content-\' + vm.tab.id}}" flex layout-wrap>\n        <div class="interaction-messages">\n          \x3c!-- MESSAGES --\x3e\n          <div layout="row" ng-repeat="message in vm.messages.rows" class="md-padding message-row" ng-class="vm.getMessagesAlignment(message)">\n            <img ng-if="message.direction ===\'in\'" src="assets/images/avatars/customer.png" class="avatar" />\n            <img ng-if="message.direction ===\'out\'" class="avatar" src="assets/images/avatars/robot.png">\n\n            <div class="bubble" ng-switch="message.direction">\n              <div>\n                <div ng-switch-when="in" class="time secondary-text">\n                  {{vm.tab.title}} - {{message.createdAt | date: \'medium\'}}\n                </div>\n                <div ng-switch-when="out" class="time secondary-text" layout="row" layout-align="end center">\n                  <div layout-padding>\n                    System - {{message.createdAt | date: \'medium\'}}\n                  </div>\n                  <div>\n                    <md-icon class="s18" md-font-icon="icon-check-all md-accent"></md-icon>\n                  </div>\n                </div>\n              </div>\n              <div ng-bind-html="message.body | embed:vm.emojiOptions" class="message" layout="row" layout-align="end center"></div>\n            </div>\n          </div>\n          \x3c!-- / MESSAGES --\x3e\n        </div>\n      </md-content>\n      \x3c!-- / CONTENT --\x3e\n    </md-card>\n  </div>\n</md-content>\n\x3c!-- / CONTENT CARD --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/contact/agent.general.contact.html",'<md-tabs md-selected="vm.currentTab" md-dynamic-height>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.DETAIL">Detail</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content>\n        <div layout="row" class="pr-10">\n          <div layout="row" flex="75" class="flex-scrollable only-x">\n            <md-card ng-repeat="call in vm.tab.calls track by call.uniqueid" class="call-info-card">\n              <md-progress-linear md-mode="indeterminate" ng-if="vm.checkingCallStatus"></md-progress-linear>\n              <md-card-header layout="row" layout-align="space-between">\n                <span ng-if="call.answertime" class="text-boxed indigo-100-bg ml-0">\n                  <timer start-time="call.answertime"></timer>\n                  <md-tooltip md-direction="bottom">\n                    {{ \'DASHBOARDS.ELAPSED_ANSWERED\' | translate }}\n                  </md-tooltip>\n                </span>\n                <span ng-if="call.disposedAt" class="text-boxed amber-200-bg">\n                  <timer start-time="call.disposedAt"></timer>\n                  <md-tooltip md-direction="bottom">\n                    {{ \'DASHBOARDS.ELAPSED_DISPOSED\' | translate }}\n                  </md-tooltip>\n                </span>\n                <md-button class="md-icon-button no-margin reload-button" ng-click="vm.checkCallStatus(call)" ng-disabled="vm.checkingCallStatus">\n                  <md-icon md-font-icon="icon-reload" class="s22"></md-icon>\n                  <md-tooltip md-direction="bottom">\n                    {{ \'DASHBOARDS.RELOAD\' | translate }}\n                  </md-tooltip>\n                </md-button>\n              </md-card-header>\n              <md-divider></md-divider>\n              <md-card-content>\n                <div layout="column" layout-align="space-between start" class="word-break-all mr-16">\n                  <div layout="row" layout-align="start center">\n                    <md-icon md-font-icon="{{ call.routeId ? \'icon-phone-outgoing\' : \'icon-phone-incoming\'}}" class="s20 mr-5">\n                    </md-icon>\n                    <span class="h2" privacy ng-cloak>{{ call.routeId ? call.destcalleridnum : call.calleridnum }}</span>\n                  </div>\n\n                  <div class="subtitle h4 secondary-text" ng-if="call.calleridname && call.calleridname != \'<unknown>\' && !call.routeId">\n                    <md-icon md-font-icon="icon-account" class="s20"></md-icon>\n                    Name: <span privacy ng-cloak>{{ call.calleridname }}</span>\n                    <div ng-if="(vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum}).length>0">\n                      <span ng-style="{\'color\':(vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum})[0].color} ">\n                        {{ (vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum})[0].description }} -\n                        {{ (vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum})[0].type }}\n                      </span>\n                    </div>\n                  </div>\n\n                  <div class="text h4 pt-8" ng-if="call.queue">\n                    <md-icon md-font-icon="icon-stackoverflow" class="s20"></md-icon>\n                    Queue: {{call.queue}}\n                  </div>\n                  <div class="text h4 pt-8" ng-if="call.variables.extravar">\n                    <md-icon md-font-icon="icon-minus" class="s20"></md-icon>\n                    Extra: {{call.variables.extravar}}\n                  </div>\n                </div>\n                <div layout="row" layout-align="center end" class="mt-8">\n                  <md-button ng-if="call.disposedAt" type="submit" ng-click="vm.disposeCall($event, call)" class="send-button md-accent md-raised mr-0 mv-0">\n                    {{ \'DASHBOARDS.DISPOSE\' | translate}}\n                  </md-button>\n                </div>\n              </md-card-content>\n            </md-card>\n          </div>\n          <div flex="25" layout="row" layout-md="column" layout-sm="column" layout-align="end center" layout-align-md="center center">\n            <md-button type="submit" ng-click="vm.mergeContact($event)" class="send-button md-raised md-accent ng-scope" ng-if="!vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="merge">\n              <md-tooltip md-direction="top"><span translate="DASHBOARDS.MERGE"></span></md-tooltip>\n              <md-icon md-font-icon="icon-source-fork"></md-icon>\n            </md-button>\n            <md-button type="submit" ng-click="vm.duplicateContact($event)" class="send-button md-raised md-accent ng-scope" ng-if="!vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="duplicate">\n              <md-tooltip md-direction="top"><span translate="DASHBOARDS.DUPLICATE"></span></md-tooltip>\n              <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n            </md-button>\n            <md-button type="submit" ng-click="vm.addNewContact($event)" class="send-button md-accent md-raised" ng-if="vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="add">\n              {{ \'DASHBOARDS.ADD\'| translate }}\n            </md-button>\n            <md-button type="submit" ng-click="vm.saveContact($event)" class="send-button md-accent md-raised" ng-if="!vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="save">\n              {{ \'DASHBOARDS.SAVE\' | translate }}\n            </md-button>\n          </div>\n        </div>\n        <div layout="row">\n          <div layout="column" flex="75">\n            <md-card layout-padding>\n              <div class="h2 secondary-text text-truncate" translate="DASHBOARDS.PERSONAL_INFO">\n                PERSONAL_INFO</div>\n              <div class="subtitle secondary-text">\n                <span translate="CONTACTMANAGER.CREATED_AT"></span>\n                <span>{{vm.contact.createdAt | date:\'medium\'}}</span>\n              </div>\n\n              <form name="vm.detailForm" novalidate>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.FIRSTNAME">First Name</label>\n                      <md-icon md-font-icon="icon-account" class="firstname"></md-icon>\n                      <input type="text" name="firstName" ng-model="vm.contact.firstName" class="text-truncate" required privacy ng-cloak>\n                      <div ng-messages="vm.detailForm.firstName.$error" ng-show="vm.detailForm.firstName.$touched" role="alert">\n                        <div ng-message="required">\n                          <span translate="DASHBOARDS.ERRORS.FIRSTNAME_REQUIRED">First name\n                            field is required</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.jscripty" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="JSCRIPTY PROJECTS" ng-click="$mdOpenMenu($event); vm.getJscriptyProjects();" aria-label="jscripty">\n                          <md-icon md-font-icon="icon-script"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingJscriptyProjects">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingJscriptyProjects && vm.jscriptyProjects.count > 0" ng-repeat="project in vm.jscriptyProjects.rows">\n                            <md-button ng-click="vm.addJscriptyTab(project, $event)">\n                              <md-icon md-font-icon="icon-script"></md-icon>\n                              {{project.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingJscriptyProjects && (!vm.jscriptyProjects || vm.jscriptyProjects.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_JSCRIPTY_PROJECTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-script"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.LASTNAME">Last Name</label>\n                    <input type="text" name="lastName" ng-model="vm.contact.lastName" class="text-truncate" privacy ng-cloak>\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.PHONE">Phone</label>\n                      <md-icon md-font-icon="icon-phone"></md-icon>\n                      <input type="text" name="phone" ng-model="vm.contact.phone" class="text-truncate" privacy ng-cloak>\n                      <div class="hint"><span ng-show="!vm.user.phoneBarRemoteControl || !vm.contact.phone" translate="CONTACTMANAGER.HELP.PHONEBAR_API"></span></div>\n                    </md-input-container>\n                    <div>\n                      \x3c!-- click to call directive --\x3e\n                      <ms-click-to-call target="vm.contact.phone" prefix="vm.list ? vm.list.dialPrefix : null" license="vm.license" type="\'button\'"></ms-click-to-call>\n                      \x3c!--  / click to call directive --\x3e\n                    </div>\n                  </div>\n                  <div flex="5"></div>\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.MOBILE">Mobile</label>\n                      <md-icon md-font-icon="icon-cellphone-iphone"></md-icon>\n                      <input type="text" name="mobile" ng-model="vm.contact.mobile" class="text-truncate" privacy ng-cloak>\n                      <div class="hint"><span ng-show="!vm.user.phoneBarRemoteControl || !vm.contact.mobile" translate="CONTACTMANAGER.HELP.PHONEBAR_API"></span></div>\n                    </md-input-container>\n                    <div>\n                      \x3c!-- click to call directive --\x3e\n                      <ms-click-to-call target="vm.contact.mobile" prefix="vm.list ? vm.list.dialPrefix : null" license="vm.license" type="\'button\'"></ms-click-to-call>\n                      \x3c!--  / click to call directive --\x3e\n                    </div>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.messaging || !vm.hasPermission(107) || !vm.contact.mobile" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW SMS" ng-click="$mdOpenMenu($event); vm.getAccounts(\'sms\')" aria-label="sms">\n                          <md-icon md-font-icon="icon-message-text"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.smsAccounts.count > 0" ng-repeat="account in vm.smsAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Sms\', account, vm.contact.mobile)">\n                              <md-icon md-font-icon="icon-message-text"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.smsAccounts || vm.smsAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_SMS_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-message-text"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.whatsapp || !vm.hasPermission(114) || !vm.contact.mobile" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW WHATSAPP" ng-click="$mdOpenMenu($event); vm.getAccounts(\'whatsapp\')" aria-label="whatsapp">\n                          <md-icon md-font-icon="icon-whatsapp"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.whatsappAccounts.count > 0" ng-repeat="account in vm.whatsappAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Whatsapp\', account, vm.contact.mobile)">\n                              <md-icon md-font-icon="icon-whatsapp"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.whatsappAccounts || vm.whatsappAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_WHATSAPP_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-whatsapp"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.EMAIL">Email</label>\n                      <md-icon md-font-icon="icon-email" class="email"></md-icon>\n                      <input type="email" name="email" ng-model="vm.contact.email" class="text-truncate" privacy ng-cloak>\n                      <div ng-messages="vm.detailForm.firstName.$error" ng-show="vm.detailForm.firstName.$touched" role="alert">\n                        <div ng-message="email">\n                          <span translate="DASHBOARDS.ERRORS.EMAIL_MUST_VALID">Email must be a\n                            valid e-mail address</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.mail || !vm.hasPermission(106) || !vm.contact.email" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW EMAIL" ng-click="$mdOpenMenu($event); vm.getAccounts(\'mail\')" aria-label="email">\n                          <md-icon md-font-icon="icon-email"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.mailAccounts.count > 0" ng-repeat="account in vm.mailAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Mail\', account, vm.contact.email)">\n                              <md-icon md-font-icon="icon-email"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.mailAccounts || vm.mailAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_MAIL_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-email"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                  <div flex="5"></div>\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.FAX">Fax</label>\n                      <md-icon md-font-icon="icon-deskphone"></md-icon>\n                      <input type="text" name="fax" ng-model="vm.contact.fax" privacy ng-cloak>\n                    </md-input-container>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.fax || !vm.hasPermission(109) || !vm.contact.fax" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW FAX" ng-click="$mdOpenMenu($event); vm.getAccounts(\'fax\')" aria-label="fax">\n                          <md-icon md-font-icon="icon-deskphone"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.faxAccounts.count > 0" ng-repeat="account in vm.faxAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Fax\', account, vm.contact.fax)">\n                              <md-icon md-font-icon="icon-deskphone"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.faxAccounts || vm.faxAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_FAX_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-deskphone"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                </div>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <md-chips ng-model="vm.additionalItems" md-transform-chip="vm.newPhone($chip)" placeholder="Phone numbers">\n                      <md-chip-template custom-chip alt="{{$chip.type}}" title="{{$chip.type}}">\n                        {{ $chip.phone }}\n                      </md-chip-template>\n                    </md-chips>\n                  </md-input-container>\n                  <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="25">\n                    <div class="pb-16" layout="row" layout-align="start center">\n                      <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n                    </div>\n                    <form name="additionalPhonesForm" novalidate>\n                      <div ng-repeat="additionalPhone in vm.additionalItems" layout="column">\n                        <md-input-container class="md-block">\n                          <label>{{$index}} - {{additionalPhone.phone}}</label>\n                          <md-select ng-model="vm.additionalItemTypes[$index]">\n                            <md-option ng-repeat="value in vm.contactItemTypes" ng-value="value.id">{{value.name}}</md-option>\n                            <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                          </md-select>\n                        </md-input-container>\n                        <md-input-container class="md-block">\n                          <input ng-model="additionalPhone.description" ng-cloak>\n                        </md-input-container>\n                      </div>\n                    </form>\n                  </div>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.DATE_OF_BIRTH">Date of Birth</label>\n                    <mdp-date-picker mdp-open-on-click mdp-format="YYYY-MM-DD" name="dateOfBirth" ng-model="vm.contact.dateOfBirth"></mdp-date-picker>\n                  </md-input-container>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n                    <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" autofocus>\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.COMPANY">Company</label>\n                    <md-icon md-font-icon="icon-domain" class="email"></md-icon>\n                    <md-select name="company" ng-model="vm.contact.CompanyId">\n                      <md-option ng-value="company.id" ng-repeat="company in vm.tab.companies.rows">{{company.name}}\n                      </md-option>\n                      <md-option ng-value="null"><em translate="DASHBOARDS.NONE">None</em>\n                      </md-option>\n                    </md-select>\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.TAG">TAG</label>\n                    <md-icon md-font-icon="icon-tag"></md-icon>\n                    <md-select ng-model="vm.tab.Tags" multiple>\n                      <md-option ng-value="tag.id" ng-repeat="tag in vm.tab.tags.rows">\n                        {{tag.name}}</md-option>\n                    </md-select>\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.COUNTRY">Country</label>\n                    <md-icon md-font-icon="icon-home" class="country"></md-icon>\n                    <input type="text" name="country" ng-model="vm.contact.country" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.CITY">City</label>\n                    <input type="text" name="city" ng-model="vm.contact.city">\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.STREET">Street</label>\n                    <input type="text" name="street" ng-model="vm.contact.street">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.POSTALCODE">Postal Code</label>\n                    <input type="text" name="postalCode" ng-model="vm.contact.postalCode">\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate translate-attr-placeholder="DASHBOARDS.NOTES">Notes</label>\n                    <md-icon md-font-icon="icon-note"></md-icon>\n                    <textarea ng-model="vm.contact.description" type="text" max-rows="4"></textarea>\n                  </md-input-container>\n                </div>\n              </form>\n            </md-card>\n            <md-card layout-padding>\n              <div class="h2 secondary-text text-truncate" translate="DASHBOARDS.SOCIAL">Social</div>\n              <form name="vm.socialForm" novalidate>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Facebook</label>\n                    <md-icon md-font-icon="icon-facebook" class="facebook"></md-icon>\n                    <input type="text" name="facebook" ng-model="vm.contact.facebook" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Twitter</label>\n                    <md-icon md-font-icon="icon-twitter" class="twitter"></md-icon>\n                    <input type="text" name="twitter" ng-model="vm.contact.twitter" class="text-truncate">\n                  </md-input-container>\n                </div>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Line</label>\n                    <md-icon md-font-icon="fab fa-line"></md-icon>\n                    <input type="text" name="line" ng-model="vm.contact.line" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Viber</label>\n                    <md-icon md-font-icon="fab fa-viber"></md-icon>\n                    <input type="text" name="viber" ng-model="vm.contact.viber" class="text-truncate">\n                  </md-input-container>\n                </div>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>WeChat</label>\n                    <md-icon md-font-icon="fab fa-weixin"></md-icon>\n                    <input type="text" name="wechat" ng-model="vm.contact.wechat" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Telegram</label>\n                    <md-icon md-font-icon="icon-telegram"></md-icon>\n                    <input type="text" name="telegram" ng-model="vm.contact.telegram" class="text-truncate">\n                  </md-input-container>\n                </div>\n              </form>\n            </md-card>\n          </div>\n          <div flex="25" layout="column" layout-padding>\n            <md-card flex="100" layout-padding>\n              <div class="h2 secondary-text text-truncate" translate="DASHBOARDS.CUSTOM_FIELDS">CUSTOM\n                FIELDS</div>\n              <form name="vm.customFieldsForm" novalidate>\n\n                \x3c!-- START INPUT LIST --\x3e\n                <md-input-container class="md-block">\n                  <label translate translate-attr-placeholder="DASHBOARDS.LIST">List</label>\n                  <md-select name="list" ng-disabled="!vm.newContact" ng-model="vm.contact.ListId" ng-change="vm.getCustomFields(vm.contact.ListId)" required>\n                    <md-optgroup label="Lists">\n                      <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">#{{list.id}} - {{list.name}}\n                      </md-option>\n                    </md-optgroup>\n                  </md-select>\n                </md-input-container>\n                \x3c!-- END INPUT LIST --\x3e\n\n                <div ng-repeat="customField in vm.tab.customFields.rows" ng-switch="customField.type">\n                  <md-input-container class="md-block" ng-switch-when="datetime">\n                    <label>{{customField.alias}}<span ng-if="customField.required">*</span></label>\n                    <div ng-init="vm.contact[\'cf_\' + customField.id] = vm.getDateFromString(vm.contact[\'cf_\' + customField.id])">\n                      <mdp-date-picker mdp-open-on-click ng-required="customField.required" mdp-format="YYYY-MM-DD" ng-model="vm.contact[\'cf_\' + customField.id]">\n                      </mdp-date-picker>\n                      <mdp-time-picker mdp-open-on-click mdp-placeholder="Time" ng-required="customField.required" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.contact[\'cf_\' + customField.id]">\n                      </mdp-time-picker>\n                    </div>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="select">\n                    <label>{{customField.alias}}<span ng-if="customField.required">*</span></label>\n                    <md-select ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n                      <md-option ng-repeat="value in customField.values" ng-value="value.value">\n                        {{value.value}}</md-option>\n                      <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em>\n                      </md-option>\n                    </md-select>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="switch">\n                    <md-switch aria-label="{{customField.alias}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-true-value="1" ng-false-value="0">\n                      {{customField.alias}}<span ng-if="customField.required">*</span>\n                    </md-switch>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-default>\n                    <div layout-gt-sm="row" class="layout-gt-sm-row"></div>\n                    <div layout="row" flex>\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label>{{customField.alias}}<span ng-if="customField.required">*</span></label>\n                        <input type="{{customField.type}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n                      </md-input-container>\n                      <ms-click-to-call ng-if="customField.clickToAction && customField.actionType === \'voice\'" target="vm.contact[\'cf_\' + customField.id]" prefix="vm.list ? vm.list.dialPrefix : null" license="vm.license" type="\'button\'"></ms-click-to-call>\n                    </div>\n                  </md-input-container>\n                </div>\n              </form>\n            </md-card>\n          </div>\n        </div>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.CUSTOMER_JOURNEY">Customer Journey</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content class="md-padding" id="journey-content">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'">\n        </div>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n</md-tabs>'),e.put("app/main/apps/dashboards/views/general/agent/contact/dispose/dialog.html",'<md-dialog class="agent-dialog" aria-label="agent dispose">\n  <form name="disposition" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.DISPOSE"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" ng-if="!vm.call.mandatoryDisposition">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div ng-if="!vm.isReschedule">\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.DISPOSITION">Disposition</label>\n          <md-select name="disposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onDispositionChange(\'first\')" required>\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' } : true">\n              {{ disposition.name }}</md-option>\n          </md-select>\n          <div ng-messages="dispositionForm.disposition.$error" ng-show="dispositionForm.disposition.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="DASHBOARDS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n            <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition" ng-change="vm.onDispositionChange(\'second\')">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearDispositionSelection(\'second\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear second level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <div ng-if="vm.secondLevelDisposition && vm.anyThirdLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</label>\n            <md-select name="thirdLevelDisposition" ng-model="vm.thirdLevelDisposition" ng-change="vm.onDispositionChange(\'third\')">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'third\', ParentId: vm.secondLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.thirdLevelDisposition" ng-click="vm.clearDispositionSelection(\'third\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear third level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.NOTE">Note</label>\n          <textarea ng-model="vm.note" md-maxlength="255" max-rows="5" autofocus></textarea>\n        </md-input-container>\n        <md-input-container class="md-block" ng-if="vm.availableCalls === 1">\n          <md-switch ng-model="vm.autoClose" aria-label="Auto Close">\n            <span translate="DASHBOARDS.AUTOCLOSE">Automatically close contact tab after disposal</span>\n          </md-switch>\n        </md-input-container>\n      </div>\n      <div ng-if="vm.isReschedule">\n        <div layout="row">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click required name="date" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-change="vm.recalcTZTime()" mdp-min-date="vm.hopper.minDate" ng-model="vm.hopper.dateTime">\n              <div ng-messages="disposition.date.$error" ng-show="disposition.date.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="DASHBOARDS.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="DASHBOARDS.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click required name="time" mdp-placeholder="Time" ng-change="vm.recalcTZTime()" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.dateTime">\n              <div ng-messages="disposition.time.$error" ng-show="disposition.time.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="DASHBOARDS.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="DASHBOARDS.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </div>\n        <div layout="row">\n          <div flex class="md-block">\n            <md-input-container class="md-block" flex-gt-sm="">\n              <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n              <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" autofocus>\n            </md-input-container>\n          </div>\n          <div flex class="md-block">\n            <md-input-container class="md-block">\n              <label translate="DASHBOARDS.SYSTEM_TIME">System time</label>\n              <input type="text" readonly value="{{vm.hopper.scheduledAt}}">\n            </md-input-container>\n          </div>\n        </div>\n        <div ng-if="(!vm.dialer || (vm.dialer && vm.recallme && vm.user.selectRecallMeCampaign)) && vm.queueCampaigns.rows.length > 0" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.CAMPAIGN">Campaign</label>\n            <md-select name="queueCampaign" ng-model="vm.queueCampaign" required>\n              <md-option ng-value="queueCampaign" ng-repeat="queueCampaign in vm.queueCampaigns.rows">\n                <md-icon md-font-icon="icon-checkbox-blank-circle" ng-class="{\'green-fg\': queueCampaign.dialActive}" aria-label="Status">\n                </md-icon>\n                {{ queueCampaign.name }}\n              </md-option>\n            </md-select>\n            <div ng-messages="disposition.queueCampaign.$error" ng-show="disposition.queueCampaign.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="DASHBOARDS.ERRORS.CAMPAIGN_REQUIRED">Campaign field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions ng-if="!vm.isReschedule" layout="row">\n      <md-button ng-disabled="disposition.$invalid || disposition.$pristine" class="send-button md-raised md-accent" ng-click="vm.saveDisposition()" ms-dialog-spinner>\n        {{(vm.selectedDisposition.name ? \'DASHBOARDS.DISPOSE\' : \'DASHBOARDS.SAVE\') | translate}}\n      </md-button>\n      <md-button class="send-button md-raised md-primary" translate="DASHBOARDS.RESCHEDULE" ng-click="vm.saveDisposition(\'reschedule\')">\n        Reschedule\n      </md-button>\n      <md-button class="send-button md-accent md-raised" translate="DASHBOARDS.RECALLME" ng-click="vm.saveDisposition(\'recallme\')">\n        Recall Me\n      </md-button>\n      <span flex></span>\n      <md-button ng-if="vm.hasBlackLists" class="md-raised md-warn" translate="DASHBOARDS.BLACKLIST" ng-click="vm.saveDisposition(\'blacklist\')">\n        Blacklist\n      </md-button>\n    </md-dialog-actions>\n    <md-dialog-actions ng-if="vm.isReschedule" layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveReschedule()" class="send-button md-accent md-raised" ng-disabled="disposition.$invalid || disposition.$pristine || vm.disable" aria-label="SAVE" translate="DASHBOARDS.SAVE" translate-attr-aria-label="DASHBOARDS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/contact/reschedule/dialog.html",'<md-dialog class="agent-dialog" aria-label="New Agent">\n  <form name="dateTime" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div layout="row">\n        <div flex class="md-block">\n          <mdp-date-picker mdp-open-on-click required name="date" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" mdp-min-date="vm.hopper.minDate" ng-model="vm.hopper.dateTime">\n            <div ng-messages="dateTime.date.$error" ng-show="dateTime.date.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="DASHBOARDS.ERRORS.DATE_REQUIRED">Date is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="DASHBOARDS.ERRORS.DATE_INVALID">Date is invalid</span>\n              </div>\n            </div>\n          </mdp-date-picker>\n        </div>\n\n        <div flex class="md-block">\n          <mdp-time-picker mdp-open-on-click required name="time" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.dateTime">\n            <div ng-messages="dateTime.time.$error" ng-show="dateTime.time.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="DASHBOARDS.ERRORS.TIME_REQUIRED">Time is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="DASHBOARDS.ERRORS.TIME_INVALID">Time is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-disabled="vm.disable" ng-click="vm.saveDialog()" class="send-button md-accent md-raised" ng-disabled="dateTime.$invalid || dateTime.$pristine" aria-label="SAVE" translate="DASHBOARDS.SAVE" translate-attr-aria-label="DASHBOARDS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/contact/selection/dialog.html",'<md-dialog ng-init="vm.onInit()" class="contact-trigger-dialog" aria-label="Select contact" ng-cloak>\n  <md-toolbar class="red-bg">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span class="title">{{ \'DASHBOARDS.SELECT_CONTACT\' | translate }}</span>\n    </div>\n  </md-toolbar>\n  <md-dialog-content class="h-400 pv-16">\n    <div layout="row" class="p-10">\n      <span class="font-size-16">{{ \'DASHBOARDS.MULTIPLE_CONTACTS_FOUND\' | translate }}<strong>&nbsp;{{ vm.callNumber }}</strong>.</span>\n      <span class="font-size-16">&nbsp;{{ \'DASHBOARDS.WHICH_ONE_TO_USE\' | translate }}</span>\n    </div>\n    <md-grid-list md-cols-xs="1" md-cols="2" md-row-height="fit" ng-class="vm.paginatedContacts[vm.page - 1].length > 2 ? \'two-rows-layout\' : \'one-row-layout\'" flex>\n      <md-grid-tile ng-repeat="contact in vm.paginatedContacts[vm.page - 1]" md-rowspan="1">\n        <md-card layout="column" class="contact-info" no-padding no-margin ng-click="vm.selectedContact = contact;" ng-class="{ \'light-blue-50-bg\' : vm.selectedContact && vm.selectedContact.id === contact.id }" flex>\n          <md-card-title class="pt-16">\n            <md-card-title-text layout-align="center start">\n              <span class="font-size-16 text-bold">#{{ contact.id }} -\n                <span privacy ng-cloak>{{ contact.firstName }} {{ contact.lastName }}</span>\n              </span>\n              <em class="font-size-12">{{ \'DASHBOARDS.LAST_UPDATED\' | translate }}: {{ contact.updatedAt }}</em>\n              <span class="font-size-12">{{ \'DASHBOARDS.LIST\' | translate }}: {{ vm.lists[contact.ListId] }}</span>\n            </md-card-title-text>\n            <md-button class="md-icon-button no-margin" aria-label="Selected">\n              <md-icon md-font-icon="{{ vm.selectedContact && vm.selectedContact.id === contact.id ? \'icon-checkbox-marked-circle\' : \'icon-checkbox-blank-circle-outline\' }}" ng-class="{ \'green-fg\': vm.selectedContact && vm.selectedContact.id === contact.id }"></md-icon>\n            </md-button>\n          </md-card-title>\n          <md-divider></md-divider>\n          <md-card-content layout="row" layout-align="center start" class="p-10">\n            <span class="font-size-16">{{ \'DASHBOARDS.MATCHING_FIELD\' | translate }}:\n              <strong privacy ng-cloak>{{ contact.matchingField }}</strong>\n            </span>\n          </md-card-content>\n        </md-card>\n      </md-grid-tile>\n    </md-grid-list>\n  </md-dialog-content>\n  <md-dialog-actions layout="row">\n    <div ng-if="vm.paginatedContacts.length > 1" layout="row" layout-align="center center" flex>\n      <md-button ng-click="vm.page = vm.page - 1;" class="md-icon-button no-margin" ng-class="{ \'hidden\': vm.page <= 1 }" aria-label="Previous page">\n        <md-icon md-font-icon="icon-chevron-double-left"></md-icon>\n      </md-button>\n      <span>{{ \'DASHBOARDS.PAGE\' | translate }} {{ vm.page }} {{ \'DASHBOARDS.OF\' | translate }}\n        {{ vm.paginatedContacts.length }}</span>\n      <md-button ng-click="vm.page = vm.page + 1;" class="md-icon-button no-margin" ng-class="{ \'hidden\': !vm.paginatedContacts[vm.page] }" aria-label="Next page">\n        <md-icon md-font-icon="icon-chevron-double-right"></md-icon>\n      </md-button>\n    </div>\n    <md-button ng-click="vm.selectContact()" class="select-button md-accent md-raised" ng-disabled="!vm.selectedContact" aria-label="Select" translate="DASHBOARDS.SELECT" translate-attr-aria-label="DASHBOARDS.SELECT">\n      SELECT\n    </md-button>\n  </md-dialog-actions>\n</md-dialog>vc'),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/agent.general.abandoned.html",'<div ng-cloak>\n  <md-content>\n    <md-tabs md-selected="vm.selectedTab" md-dynamic-height md-border-bottom>\n      <md-tab ng-if="vm_home.hasPermission(110)" label="{{\'DASHBOARDS.VOICE\' | translate}}">\n        <md-content ng-if="vm.selectedTab === 0" ng-include="\'app/main/apps/dashboards/views/general/agent/home/abandoned/voice/agent.general.abandoned.voice.html\'" ng-controller="AgentHomeAbandonedVoiceController as vm_voice">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(110) && vm_home.license.dialer" label="{{\'DASHBOARDS.MOTION_BULL\' | translate}}">\n        <md-content ng-if="vm.selectedTab === 1" ng-include="\'app/main/apps/dashboards/views/general/agent/home/abandoned/bull/agent.general.abandoned.bull.html\'" ng-controller="AgentHomeAbandonedBullController as vm_bull">\n        </md-content>\n      </md-tab>\n    </md-tabs>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/bull/agent.general.abandoned.bull.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header blue-bg" ng-class="{\'h-128\' : vm_bull.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n      <ms-search-bar on-search="vm_bull.getAbandonedCalls()" query="vm_bull.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm_bull.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm_bull.quickFilters" query="vm_bull.query" search="vm_bull.getAbandonedCalls()"></ms-quick-filter>\n      <md-button class="md-icon-button reload-list" ng-click="vm_bull.refresh && vm_bull.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip ng-if="vm_bull.showTooltip" md-visible="vm_bull.showTooltip">\n          {{\'DASHBOARDS.CLICKRELOAD\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm_bull.promise">\n      <thead md-head md-order="vm_bull.query.sort" md-on-reorder="vm_bull.getAbandonedCalls">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n          <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n          <th md-column md-order-by="queuecallerexitAt">{{\'DASHBOARDS.QUEUECALLEREXITAT\' | translate}}</th>\n          <th md-column md-order-by="queuecallerexitreason">{{\'DASHBOARDS.QUEUECALLEREXITREASON\' | translate}}\n          </th>\n          <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="secondDisposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="thirdDisposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.RESERVED\' | translate}}</th>\n          <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm_bull.abandonedCalls.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="abandonedCall in vm_bull.abandonedCalls.rows">\n          <td md-cell class="id">{{abandonedCall.id}}</td>\n          <td md-cell class="firstName" privacy ng-cloak>{{abandonedCall.calleridname}}</td>\n          <td md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="abandonedCall.calleridnum" license="vm_home.license" disabled="abandonedCall.lastAssignedTo !== vm_bull.currentUser.name">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="list">{{vm_bull.queuesMap[abandonedCall.queue]}}</td>\n          <td md-cell class="list">\n            {{abandonedCall.queuecallerabandonAt ? (abandonedCall.queuecallerabandonAt | formatdate) : (abandonedCall.queuecallerexitAt | formatdate) }}\n          </td>\n          <td md-cell class="list">\n            {{abandonedCall.queuecallerexitAt ? (abandonedCall.queuecallerexitAt | formatdate) : undefined }}\n          </td>\n          <td md-cell class="list">{{abandonedCall.queuecallerexitreason}}</td>\n          <td md-cell class="list">{{ abandonedCall.disposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.secondDisposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.thirdDisposition }}</td>\n          <td md-cell class="actions">\n            <md-switch no-margin ng-if="abandonedCall.lastAssignedTo === vm_bull.currentUser.name || !abandonedCall.lastAssignedTo" ng-disabled="vm_bull.disable[abandonedCall.id]" ng-model="abandonedCall.assigned" aria-label="reserved" ng-change="vm_bull.reserved(abandonedCall)">\n            </md-switch>\n          </td>\n          <td md-cell class="list">{{abandonedCall.lastAssignedTo}}</td>\n          <td md-cell class="actions">\n            <md-menu ng-if="abandonedCall.lastAssignedTo === vm_bull.currentUser.name">\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="1">\n                <md-menu-item>\n                  <md-button ng-click="vm_bull.dispose(abandonedCall)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm_bull.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_bull.query.page" md-total="{{vm_bull.abandonedCalls.count}}" md-on-paginate="vm_bull.getAbandonedCalls" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",'<md-dialog class="agent-dialog" aria-label="agent dispose">\n  <form name="disposition" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.DISPOSE"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div>\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.DISPOSITION">Disposition</label>\n          <md-select name="disposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onDispositionChange(\'first\')" required>\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' } : true">\n              {{ disposition.name }}</md-option>\n          </md-select>\n          <div ng-messages="dispositionForm.disposition.$error" ng-show="dispositionForm.disposition.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="DASHBOARDS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n            <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition" ng-change="vm.onDispositionChange(\'second\')">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearDispositionSelection(\'second\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear second level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <div ng-if="vm.secondLevelDisposition && vm.anyThirdLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</label>\n            <md-select name="thirdLevelDisposition" ng-model="vm.thirdLevelDisposition" ng-change="vm.onDispositionChange(\'third\')">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'third\', ParentId: vm.secondLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.thirdLevelDisposition" ng-click="vm.clearDispositionSelection(\'third\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear third level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.NOTE">Note</label>\n          <textarea ng-model="vm.note" md-maxlength="255" max-rows="5" autofocus></textarea>\n        </md-input-container>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button ng-disabled="disposition.$invalid || disposition.$pristine" class="send-button md-raised md-accent" ng-click="vm.saveDisposition()">\n'+"          {{(vm.selectedDisposition.name ? 'DASHBOARDS.DISPOSE' : 'DASHBOARDS.SAVE') | translate}}\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>"),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/voice/agent.general.abandoned.voice.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header blue-bg" ng-class="{\'h-128\' : vm_voice.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n      <ms-search-bar on-search="vm_voice.getAbandonedCalls()" query="vm_voice.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm_voice.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm_voice.quickFilters" query="vm_voice.query" search="vm_voice.getAbandonedCalls()"></ms-quick-filter>\n      <md-button class="md-icon-button reload-list" ng-click="vm_voice.refresh && vm_voice.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip ng-if="vm_voice.showTooltip" md-visible="vm_voice.showTooltip">\n          {{\'DASHBOARDS.CLICKRELOAD\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm_voice.promise">\n      <thead md-head md-order="vm_voice.query.sort" md-on-reorder="vm_voice.getAbandonedCalls">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n          <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n          <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="secondDisposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="thirdDisposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.RESERVED\' | translate}}</th>\n          <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm_voice.abandonedCalls.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="abandonedCall in vm_voice.abandonedCalls.rows">\n          <td md-cell class="id">{{abandonedCall.id}}</td>\n          <td md-cell class="firstName" privacy ng-cloak>{{abandonedCall.calleridname}}</td>\n          <td md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="abandonedCall.calleridnum" license="vm_home.license" disabled="abandonedCall.lastAssignedTo !== vm_voice.currentUser.name">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="list">{{vm_voice.queuesMap[abandonedCall.queue]}}</td>\n          <td md-cell class="list">\n            {{abandonedCall.queuecallerabandonAt ? (abandonedCall.queuecallerabandonAt | formatdate) : (abandonedCall.queuecallerexitAt | formatdate) }}\n          </td>\n          <td md-cell class="list">{{ abandonedCall.disposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.secondDisposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.thirdDisposition }}</td>\n          <td md-cell class="actions">\n            <md-switch no-margin ng-if="abandonedCall.lastAssignedTo === vm_voice.currentUser.name || !abandonedCall.lastAssignedTo" ng-disabled="vm_voice.disable[abandonedCall.id]" ng-model="abandonedCall.assigned" aria-label="reserved" ng-change="vm_voice.reserved(abandonedCall)">\n            </md-switch>\n          </td>\n          <td md-cell class="list">{{abandonedCall.lastAssignedTo}}</td>\n          <td md-cell class="actions">\n            <md-menu ng-if="abandonedCall.lastAssignedTo === vm_voice.currentUser.name">\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="1">\n                <md-menu-item>\n                  <md-button ng-click="vm_voice.dispose(abandonedCall)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm_voice.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_voice.query.page" md-total="{{vm_voice.abandonedCalls.count}}" md-on-paginate="vm_voice.getAbandonedCalls" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/agent.general.home.html",'<div layout="column" layout-align="start center" class="agent-general-home-navbar md-primary-bg width-50">\n  <div ng-repeat="node in vm_home.navigation">\n    <div ng-repeat="home in node.children">\n      <md-button ng-repeat="button in home.children  | orderBy:\'weight\'" ng-if="!button.hidden()" class="md-raised width-50 height-50 no-margin" style="border-radius: 0px" aria-label="{{button.state}}" ng-click="vm_home.changeSidebarTab(button)" ng-class="{\'md-primary\': vm_home.sidebar != button.state}">\n        <md-tooltip md-direction="right" md-delay="500"><span translate="{{button.translate}}"></span>\n        </md-tooltip>\n        <md-icon md-font-icon="{{button.icon}}" ng-class="button.iconClass"></md-icon>\n      </md-button>\n    </div>\n  </div>\n</div>\n<div class="agent-general-home-sections" layout="column" flex>\n  <div layout="column" flex>\n    <div ng-switch="vm_home.sidebar" style="overflow-y: auto; overflow-x: hidden" flex>\n      <div ng-switch-when="agentPresence" class="home-agent-presence">\n        <div ng-if="vm_home.hasPermission(115)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/presence/agent.general.presence.html\'" ng-controller="AgentHomePresenceController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(115)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="contacts" class="home-contacts">\n        <div ng-if="vm_home.hasPermission(102) && vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/contacts/agent.general.contacts.html\'" ng-controller="AgentHomeContactsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(102) || !vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="mycontacts" class="home-mycontacts">\n        <div ng-if="vm_home.hasPermission(103) && vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/mycontacts/agent.general.mycontacts.html\'" ng-controller="AgentHomeMyContactsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(103) || !vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="scheduled" class="home-scheduled">\n        <div ng-if="vm_home.hasPermission(113) && vm_home.license.dialer" ng-include="\'app/main/apps/dashboards/views/general/agent/home/scheduled/agent.general.scheduled.html\'" ng-controller="AgentHomeScheduledCallsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(113) || !vm_home.license.dialer" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="voice" class="home-voice">\n        <div ng-if="vm_home.hasPermission(110) && vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/voice/agent.general.voice.html\'" ng-controller="AgentHomeVoiceController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(110) || !vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="abandoned" class="home-abandoned">\n        <div ng-if="vm_home.hasPermission(111) && vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/abandoned/agent.general.abandoned.html\'" ng-controller="AgentHomeAbandonedController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(111) || !vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="recordings" class="home-recordings">\n        <div ng-if="vm_home.hasPermission(104) && vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/recordings/agent.general.recordings.html\'" ng-controller="AgentHomeRecordingsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(104) || !vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="chat" class="home-chat">\n        <div ng-if="vm_home.hasPermission(105) && vm_home.license.chat" ng-include="\'app/main/apps/dashboards/views/general/agent/home/chat/agent.general.chat.html\'" ng-controller="AgentHomeChatController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(105) || !vm_home.license.chat" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="mail" class="home-mail">\n        <div ng-if="vm_home.hasPermission(106) && vm_home.license.mail" ng-include="\'app/main/apps/dashboards/views/general/agent/home/mail/agent.general.mail.html\'" ng-controller="AgentHomeMailController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(106) || !vm_home.license.mail" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="sms" class="home-sms">\n        <div ng-if="vm_home.hasPermission(107) && vm_home.license.messaging" ng-include="\'app/main/apps/dashboards/views/general/agent/home/sms/agent.general.sms.html\'" ng-controller="AgentHomeSmsController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(107) || !vm_home.license.messaging" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="openchannel" class="home-openchannel">\n        <div ng-if="vm_home.hasPermission(108) && vm_home.license.openchannel" ng-include="\'app/main/apps/dashboards/views/general/agent/home/openchannel/agent.general.openchannel.html\'" ng-controller="AgentHomeOpenchannelController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(108) || !vm_home.license.openchannel" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="fax" class="home-fax">\n        <div ng-if="vm_home.hasPermission(109) && vm_home.license.fax" ng-include="\'app/main/apps/dashboards/views/general/agent/home/fax/agent.general.fax.html\'" ng-controller="AgentHomeFaxController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(109) || !vm_home.license.fax" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="whatsapp" class="home-whatsapp">\n        <div ng-if="vm_home.hasPermission(114) && vm_home.license.whatsapp" ng-include="\'app/main/apps/dashboards/views/general/agent/home/whatsapp/agent.general.whatsapp.html\'" ng-controller="AgentHomeWhatsappController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(114) || !vm_home.license.whatsapp" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="plugin" class="home-plugin" layout-fill>\n        <div ng-if="vm_home.hasPermission(vm_home.pluginId)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/plugins/agent.general.plugins.html\'" ng-controller="AgentHomePluginsController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting, vm_home.plugin)" layout-fill></div>\n        <div ng-if="!vm_home.hasPermission(vm_home.pluginId)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-default class="home-default">\n        <div ng-if="vm_home.hasPermission(101)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/agent.general.dashboard.html\'" ng-controller=" AgentHomeDashboardController  as vm"></div>\n        <div ng-if="!vm_home.hasPermission(101)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n    </div>\n  </div>\n  <div ng-if="(vm_home.draftManager.drafts | json) != \'{}\'" layout="column" class="draft-manager-bar">\n    <ms-tab-scroll>\n      <div layout="column" ng-repeat="(key, draft) in vm_home.draftManager.drafts" class="grey-50-bg" ng-click="vm_home.draftManager.open(draft.id)">\n        <div class="draft-manager-tab" layout="row" layout-align="space-between center">\n          <md-icon md-font-icon="icon-pencil" class="icon s16 margin-horizontal-5 black-fg"></md-icon>\n          <span class="text-truncate font-size-12 black-fg">{{draft.title}}</span>\n          <md-button class="md-icon-button md-mini no-margin md-primary" aria-label="close" ng-click="vm_home.draftManager.remove(draft.id)">\n            <md-icon md-font-icon="icon-close-circle-outline" class="icon s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </ms-tab-scroll>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html",'<md-content layout="row" layout-align="space-around center" flex layout-padding layout-wrap>\n  <div layout="column" layout-align="space-around center" flex="50">\n    <span class="font-size-40 text-center">{{ \'DASHBOARDS.WELCOME_TO_MOTION\' | translate }}!</span>\n    <span class="font-size-30 text-center" translate="DASHBOARDS.WELCOME_MESSAGE">Use the left sidebar to navigate through available sections.</span>\n  </div>\n\n  <div layout="column" flex="50">\n    <img src="assets/images/avatars/permissions.png" alt="permissions">\n  </div>\n</md-content>'),e.put("app/main/apps/dashboards/views/general/agent/home/chat/agent.general.chat.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.CHAT_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getChatInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getChatInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getChatInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChatInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.WEBSITE\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.chatInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.chatInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell class="chatAccount">\n            {{ vm.getChatWebsiteLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showChatInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Chat\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions && vm.user.downloadAttachments">\n                  <md-button ng-click="vm.downloadChatInteraction($event, interaction, true)" translate="CHAT.DOWNLOAD_WITH_ATTACHMENTS">\n                    Download with attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadChatInteraction($event, interaction)" translate="CHAT.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                    Download without attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chatInteractions.count}}" md-on-paginate="vm.getChatInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/contacts/agent.general.contacts.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.CONTACTS">Contacts</span>\n      <ms-search-bar on-search="vm.getContacts()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getContacts()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" ng-click="vm.refreshContacts($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button ng-if="vm.lists.rows && vm.lists.rows.length" class="md-icon-button create-new" ng-click="vm.openContact()" aria-label="Add contact" translate translate-attr-label="DASHBOARDS.ADD_CONTACT">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContacts">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="firstName">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="phone">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="mobile">{{\'DASHBOARDS.MOBILE\' | translate}}</th>\n          <th md-column md-order-by="fax">{{\'DASHBOARDS.FAX\' | translate}}</th>\n          <th md-column md-order-by="email">{{\'DASHBOARDS.EMAIL\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.CREATEDAT\' | translate}}</th>\n          <th md-column md-order-by="ListId">{{\'DASHBOARDS.LIST\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.contacts.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="contact in vm.contacts.rows">\n          <td ng-click="vm.openContact(contact.id)" md-cell class="id">{{contact.id}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="firstName" privacy ng-cloak>{{contact.firstName}}\n            {{contact.lastName}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.phone" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="mobile">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.mobile" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="fax" privacy ng-cloak>{{contact.fax}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="email" privacy ng-cloak>{{contact.email}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="createdAt">{{contact.createdAt | formatdate}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="list">{{vm.listsMap[contact.ListId].name}}\n          <td md-cell class="tag">\n            <div ng-if="contact.Tags.length">\n              <div ng-if="contact.Tags.length == 1" layout="column" layout-align="center center">\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': contact.Tags[0].color }"></md-icon>\n                <span class="text-truncate">{{contact.Tags[0].name}}</span>\n              </div>\n              <div ng-if="contact.Tags.length > 1" layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in contact.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag"></md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.openContact(contact.id)" translate="DASHBOARDS.EDIT">\n                    Edit Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.mergeContact($event, contact)" translate="DASHBOARDS.MERGE">\n                    Merge Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.duplicateContact($event, contact)" translate="DASHBOARDS.DUPLICATE">\n                    Duplicate Contact\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contacts.count}}" md-on-paginate="vm.getContacts" md-page-select></md-table-pagination>\n\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/agent.general.dashboard.html",'<div ng-cloak>\n  <md-content>\n    <md-tabs md-dynamic-height md-border-bottom>\n      <md-tab ng-if="vm_home.hasPermission(110) && vm_home.license.voice" label="{{\'DASHBOARDS.VOICE\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/voice/agent.general.dashboard.voice.html\'" ng-controller="AgentHomeDashboardVoiceController as vm_voice" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(110) && vm_home.license.dialer" label="{{\'DASHBOARDS.MOTION_BULL\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/bull/agent.general.dashboard.bull.html\'" ng-controller="AgentHomeDashboardBullController as vm_bull" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(105) && vm_home.license.chat" label="{{\'DASHBOARDS.CHAT\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/chat/agent.general.dashboard.chat.html\'" ng-controller="AgentHomeDashboardMultiChannelChatController as vm_chat" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(106) && vm_home.license.mail" label="{{\'DASHBOARDS.MAIL\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/mail/agent.general.dashboard.mail.html\'" ng-controller="AgentHomeDashboardMultiChannelMailController as vm_mail" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(107) && vm_home.license.messaging" label="{{\'DASHBOARDS.SMS\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/sms/agent.general.dashboard.sms.html\'" ng-controller="AgentHomeDashboardMultiChannelSmsController as vm_sms" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(108) && vm_home.license.openchannel" label="{{\'DASHBOARDS.OPENCHANNEL\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/openchannel/agent.general.dashboard.openchannel.html\'" ng-controller="AgentHomeDashboardMultiChannelOpenchannelController as vm_openchannel" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(109) && vm_home.license.fax" label="{{\'DASHBOARDS.FAX\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/fax/agent.general.dashboard.fax.html\'" ng-controller="AgentHomeDashboardMultiChannelFaxController as vm_fax" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(114) && vm_home.license.whatsapp" label="{{\'DASHBOARDS.WHATSAPP\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/whatsapp/agent.general.dashboard.whatsapp.html\'" ng-controller="AgentHomeDashboardMultiChannelWhatsappController as vm_whatsapp" class="md-padding">\n        </md-content>\n      </md-tab>\n    </md-tabs>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/bull/agent.general.dashboard.bull.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header red-900-bg">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="VOICE.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_bull.promise">\n        <thead md-head md-order="vm_bull.query.sort" md-on-reorder="vm_bull.getVoiceQueues">\n          <tr md-row>\n            <th md-column>{{ \'VOICE.NAME\' | translate }}</th>\n            <th md-column>{{ \'VOICE.TYPE\' | translate }}</th>\n            <th md-column>{{ \'VOICE.WAITING\' | translate }}</th>\n            <th ng-if="voiceQueue.type === \'outbound\'" md-column>{{ \'VOICE.ACTIVE\' | translate }}</th>\n            \x3c!-- <th md-column md-order-by="active">{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_bull.getSize(vm_bull.voiceQueues)">\n            <td md-cell colspan="4">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, voiceQueue) in vm_bull.voiceQueues">\n            <td md-cell class="name">{{voiceQueue.name}}</td>\n            <td ng-if="voiceQueue.type === \'outbound\'" md-cell class="waiting">{{voiceQueue.dialMethod}}</td>\n            <td md-cell class="waiting">{{voiceQueue.waiting || 0}}</td>\n            <td md-cell ng-if="voiceQueue.type === \'outbound\'" class="dialActive ">\n              <md-icon md-colors="{color: {{voiceQueue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{voiceQueue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n            </td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_bull.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_bull.query.page" md-total="{{vm_bull.voiceQueuesTotal}}" md-on-paginate="vm_bull.getVoiceQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header red-900-bg">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'VOICE.DID\' | translate }}</th>\n            <th md-column>{{ \'VOICE.QUEUE\' | translate }}</th>\n            <th md-column>{{ \'VOICE.CALLER\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_bull.getSize(vm_bull.rpcVoiceQueuesChannels)">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, channel) in vm_bull.rpcVoiceQueuesChannels | limitObjectFromTo: vm_bull.queryChannels.limit:(vm_bull.queryChannels.page - 1) * vm_bull.queryChannels.limit">\n            <td md-cell>{{channel.exten}}</td>\n            <td md-cell>{{channel.queue}}</td>\n            <td md-cell privacy ng-cloak>{{channel.calleridnum}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_bull.queryChannels.limit" md-page="vm_bull.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_bull.getSize(vm_bull.rpcVoiceQueuesChannels)}}" md-page-select>\n    </md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/chat/agent.general.dashboard.chat.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_chat.getColorByChannel(\'chat\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_chat.promise">\n        <thead md-head md-order="vm_chat.query.sort" md-on-reorder="vm_chat.getChatQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_chat.getSize(vm_chat.chatQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_chat.chatQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_chat.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_chat.query.page" md-total="{{vm_chat.chatQueuesTotal}}" md-on-paginate="vm_chat.getChatQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_chat.getColorByChannel(\'chat\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_chat.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_chat.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_chat.queryChannels.limit" md-page="vm_chat.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_chat.paginatedInteractions.length}}" md-on-paginate="vm_chat.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/fax/agent.general.dashboard.fax.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_fax.getColorByChannel(\'fax\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_fax.promise">\n        <thead md-head md-order="vm_fax.query.sort" md-on-reorder="vm_fax.getFaxQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_fax.getSize(vm_fax.faxQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_fax.faxQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_fax.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_fax.query.page" md-total="{{vm_fax.faxQueuesTotal}}" md-on-paginate="vm_fax.getFaxQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_fax.getColorByChannel(\'fax\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_fax.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_fax.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_fax.queryChannels.limit" md-page="vm_fax.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_fax.paginatedInteractions.length}}" md-on-paginate="vm_fax.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/mail/agent.general.dashboard.mail.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_mail.getColorByChannel(\'mail\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_mail.promise">\n        <thead md-head md-order="vm_mail.query.sort" md-on-reorder="vm_mail.getMailQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_mail.getSize(vm_mail.mailQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_mail.mailQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_mail.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_mail.query.page" md-total="{{vm_mail.mailQueuesTotal}}" md-on-paginate="vm_mail.getMailQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_mail.getColorByChannel(\'mail\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_mail.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_mail.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_mail.queryChannels.limit" md-page="vm_mail.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_mail.paginatedInteractions.length}}" md-on-paginate="vm_mail.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/openchannel/agent.general.dashboard.openchannel.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_openchannel.getColorByChannel(\'openchannel\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_openchannel.promise">\n        <thead md-head md-order="vm_openchannel.query.sort" md-on-reorder="vm_openchannel.getOpenchannelQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_openchannel.getSize(vm_openchannel.openchannelQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_openchannel.openchannelQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_openchannel.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_openchannel.query.page" md-total="{{vm_openchannel.openchannelQueuesTotal}}" md-on-paginate="vm_openchannel.getOpenchannelQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_openchannel.getColorByChannel(\'openchannel\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_openchannel.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_openchannel.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_openchannel.queryChannels.limit" md-page="vm_openchannel.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_openchannel.paginatedInteractions.length}}" md-on-paginate="vm_openchannel.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/sms/agent.general.dashboard.sms.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_sms.getColorByChannel(\'sms\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_sms.promise">\n        <thead md-head md-order="vm_sms.query.sort" md-on-reorder="vm_sms.getSmsQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_sms.getSize(vm_sms.smsQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_sms.smsQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_sms.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_sms.query.page" md-total="{{vm_sms.smsQueuesTotal}}" md-on-paginate="vm_sms.getSmsQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_sms.getColorByChannel(\'sms\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_sms.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_sms.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_sms.queryChannels.limit" md-page="vm_sms.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_sms.paginatedInteractions.length}}" md-on-paginate="vm_sms.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/voice/agent.general.dashboard.voice.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header blue-A700-bg ">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="VOICE.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_voice.promise">\n        <thead md-head md-order="vm_voice.query.sort" md-on-reorder="vm_voice.getVoiceQueues">\n          <tr md-row>\n            <th md-column>{{ \'VOICE.NAME\' | translate }}</th>\n            <th md-column>{{ \'VOICE.WAITING\' | translate }}</th>\n            <th ng-if="voiceQueue.type === \'outbound\'" md-column>{{ \'VOICE.ACTIVE\' | translate }}</th>\n            \x3c!-- <th md-column md-order-by="active">{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_voice.getSize(vm_voice.voiceQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, voiceQueue) in vm_voice.voiceQueues">\n            <td md-cell class="name">{{voiceQueue.name}}</td>\n            <td ng-if="voiceQueue.type === \'outbound\'" md-cell class="waiting">{{voiceQueue.dialMethod}}</td>\n            <td md-cell class="waiting">{{voiceQueue.waiting || 0}}</td>\n            <td md-cell ng-if="voiceQueue.type === \'outbound\'" class="dialActive ">\n              <md-icon md-colors="{color: {{voiceQueue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{voiceQueue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n            </td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_voice.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_voice.query.page" md-total="{{vm_voice.voiceQueuesTotal}}" md-on-paginate="vm_voice.getVoiceQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header blue-A700-bg ">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'VOICE.DID\' | translate }}</th>\n            <th md-column>{{ \'VOICE.QUEUE\' | translate }}</th>\n            <th md-column>{{ \'VOICE.CALLER\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_voice.getSize(vm_voice.rpcVoiceQueuesChannels)">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, channel) in vm_voice.rpcVoiceQueuesChannels | limitObjectFromTo: vm_voice.queryChannels.limit:(vm_voice.queryChannels.page - 1) * vm_voice.queryChannels.limit">\n            <td md-cell>{{channel.exten}}</td>\n            <td md-cell>{{channel.queue}}</td>\n            <td md-cell privacy ng-cloak>{{channel.calleridnum}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_voice.queryChannels.limit" md-page="vm_voice.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_voice.getSize(vm_voice.rpcVoiceQueuesChannels)}}" md-page-select>\n    </md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/whatsapp/agent.general.dashboard.whatsapp.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_whatsapp.getColorByChannel(\'whatsapp\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_whatsapp.promise">\n        <thead md-head md-order="vm_whatsapp.query.sort" md-on-reorder="vm_whatsapp.getWhatsappQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_whatsapp.getSize(vm_whatsapp.whatsappQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_whatsapp.whatsappQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_whatsapp.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_whatsapp.query.page" md-total="{{vm_whatsapp.whatsappQueuesTotal}}" md-on-paginate="vm_whatsapp.getWhatsappQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_whatsapp.getColorByChannel(\'whatsapp\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_whatsapp.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_whatsapp.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_whatsapp.queryChannels.limit" md-page="vm_whatsapp.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_whatsapp.paginatedInteractions.length}}" md-on-paginate="vm_whatsapp.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/fax/agent.general.fax.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.FAX_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getFaxInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getFaxInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getFaxInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.faxAccounts.rows && vm.faxAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="faxAccount in vm.faxAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeFaxInteraction($event, faxAccount)">\n              {{ faxAccount.name }} ({{ faxAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.faxInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.faxInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell class="faxAccount">\n            {{ vm.getFaxAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showFaxInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Fax\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadFaxInteraction($event, interaction)" translate="DASHBOARDS.DOWNLOAD">\n                    Download Fax\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.faxInteractions.count}}" md-on-paginate="vm.getFaxInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/mail/agent.general.mail.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.MAIL_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getMailInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getMailInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getMailInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.mailAccounts.rows && vm.mailAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="mailAccount in vm.mailAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeMailInteraction($event, mailAccount)">\n              {{ mailAccount.name }} ({{ mailAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="subject">{{\'DASHBOARDS.SUBJECT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.mailInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.mailInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <div ng-if="vm.setting.enableEmailPreview && interaction.lastMsgText" class="tooltip-preview" ng-mouseleave="vm.resetTooltipPosition($event)" ng-mouseenter="vm.adjustTooltipPosition($event)">\n              <span class="text-truncate font-size-12 subject-text">{{ interaction.subject }}</span>\n              <md-card class="tooltip-preview-text">\n                <md-card-content><span class="email-preview-message">{{ interaction.lastMsgText }}</span>\n                </md-card-content>\n              </md-card>\n            </div>\n            <span ng-if="!interaction.lastMsgText || !vm.setting.enableEmailPreview"><span class="text-truncate font-size-12 subject-text">{{ interaction.subject }}</span></span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell class="mailAccount">\n            {{ vm.getMailAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showMailInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Mail\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions && vm.user.downloadAttachments">\n                  <md-button ng-click="vm.downloadMailInteraction($event, interaction, true)" translate="MAIL.DOWNLOAD_WITH_ATTACHMENTS">\n                    Download with attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadMailInteraction($event, interaction)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                    Download without attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailInteractions.count}}" md-on-paginate="vm.getMailInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/mycontacts/agent.general.mycontacts.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.MYCONTACTS">My Contacts</span>\n      <ms-search-bar on-search="vm.getContacts()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getContacts()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" ng-click="vm.refreshContacts($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button ng-if="vm.lists.rows && vm.lists.rows.length" class="md-icon-button create-new" ng-click="vm.openContact($event)" aria-label="Add contact" translate translate-attr-label="DASHBOARDS.ADD_CONTACT">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContacts">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="firstName">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="phone">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="mobile">{{\'DASHBOARDS.MOBILE\' | translate}}</th>\n          <th md-column md-order-by="fax">{{\'DASHBOARDS.FAX\' | translate}}</th>\n          <th md-column md-order-by="email">{{\'DASHBOARDS.EMAIL\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.CREATEDAT\' | translate}}</th>\n          <th md-column md-order-by="ListId">{{\'DASHBOARDS.LIST\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.contacts.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="contact in vm.contacts.rows">\n          <td ng-click="vm.openContact($event, contact)" md-cell class="id">{{contact.id}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="firstName" privacy ng-cloak>\n            {{contact.firstName}} {{contact.lastName}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.phone" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="mobile">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.mobile" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="fax" privacy ng-cloak>\n            {{contact.fax}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="email" privacy ng-cloak>{{contact.email}}\n          </td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="createdAt">{{contact.createdAt |\n            formatdate}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="list">\n            {{vm.listsMap[contact.ListId].name}}</td>\n          <td md-cell class="tag">\n            <div ng-if="contact.Tags.length">\n              <div ng-if="contact.Tags.length == 1" layout="column" layout-align="center center">\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': contact.Tags[0].color }"></md-icon>\n                <span class="text-truncate">{{contact.Tags[0].name}}</span>\n              </div>\n              <div ng-if="contact.Tags.length > 1" layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in contact.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag"></md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.openContact($event, contact)" translate="DASHBOARDS.EDIT">\n                    Edit Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.mergeContact($event, contact)" translate="DASHBOARDS.MERGE">\n                    Merge Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.duplicateContact($event, contact)" translate="DASHBOARDS.DUPLICATE">\n                    Duplicate Contact\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contacts.count}}" md-on-paginate="vm.getContacts" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/openchannel/agent.general.openchannel.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.OPENCHANNEL_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getOpenchannelInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getOpenchannelInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getOpenchannelInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.openchannelAccounts.rows && vm.openchannelAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="openchannelAccount in vm.openchannelAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeOpenchannelInteraction($event, openchannelAccount)" ng-disabled="!openchannelAccount.replyUri">\n              {{ openchannelAccount.name }} ({{ openchannelAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOpenchannelInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.openchannelInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.openchannelInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell class="openchannelAccount">\n            {{ vm.getOpenchannelAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showOpenchannelInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Openchannel\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions && vm.user.downloadAttachments">\n                  <md-button ng-click="vm.downloadOpenchannelInteraction($event, interaction, true)" translate="OPENCHANNEL.DOWNLOAD_WITH_ATTACHMENTS">\n                    Download with attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadOpenchannelInteraction($event, interaction)" translate="OPENCHANNEL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                    Download without attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.openchannelInteractions.count}}" md-on-paginate="vm.getOpenchannelInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/plugins/agent.general.plugins.html",'<div id="plugin" ng-if="vm.plugin" ng-cloak layout-fill>\n  <iframe ng-src="{{vm.getTrustedURL()}}" frameborder=0 style="border:0px; width:100%; height:100%;"></iframe>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/presence/agent.general.presence.html",'<div ng-cloak>\n  <md-content>\n    <md-tabs md-selected="vm.selectedTab" md-dynamic-height md-border-bottom>\n      <md-tab label="{{\'DASHBOARDS.AGENTS\' | translate}}" md-on-select="vm.onAgentsTabSelection()">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.agents.html\'">\n        </md-content>\n      </md-tab>\n      <md-tab label="{{\'DASHBOARDS.QUEUES\' | translate}}" md-on-select="vm.onQueuesTabSelection()">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.queues.html\'">\n        </md-content>\n      </md-tab>\n    </md-tabs>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.agents.html",'<md-card ngCloak>\n  <md-toolbar class="md-table-toolbar md-default table-header xenialab-violet-light-bg" ng-class="{\'h-128\' : vm.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.AGENTS"></span>\n      <ms-search-bar on-search="vm.getAgents()" query="vm.agentsQuery" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.agentsQuery" search="vm.getAgents()"></ms-quick-filter>\n      <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getAgents()">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.agentsQuery.sort" md-on-reorder="vm.getAgents">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="name">{{\'DASHBOARDS.NAME\' | translate}}</th>\n          <th md-column md-order-by="internal">{{\'VOICE.INTERNAL\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column class="no-padding width-70"></th>\n          <th md-column class="width-70"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.agents.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="agent in vm.agents.rows">\n          <td md-cell>{{agent.id}}</td>\n          <td md-cell>{{agent.name}}</td>\n          <td md-cell>{{agent.internal}}</td>\n          <td md-cell>\n            <div layout="row">\n              <div layout="column" layout-align="center center">\n                <span class="text-boxed width-70 text-center md-background-bg bl bt padding-5" ng-class="{\'online\':\'lime-300-bg\',\'offline\':\'red-A200-bg\',\'pause\':\'amber-200-bg\',\'busy\':\'indigo-100-bg\'}[agent.status]">{{\n                  agent.status | uppercase }}</span>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="no-padding width-70">\n            <md-button ng-if="agent.status !== \'offline\'" ng-click="vm.originateCall(agent.name)" class="md-fab md-mini md-raised" aria-label="Dial">\n              <md-icon md-font-icon="icon-phone" class="icon green-fg s20">\n                <md-tooltip><span translate="VOICE.DIAL"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n          <td md-cell class="width-70">\n            <md-button ng-if="agent.status !== \'offline\'" ng-click="vm.transferCall(agent.name)" class="md-fab md-mini md-raised" aria-label="Transfer">\n              <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s20">\n                <md-tooltip><span translate="DASHBOARDS.TRANSFER"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.agentsQuery.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.agentsQuery.page" md-total="{{vm.agents.count}}" md-on-paginate="vm.getAgents" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.queues.html",'<md-card ngCloak>\n  <md-toolbar class="md-table-toolbar md-default table-header xenialab-violet-light-bg" ng-class="{\'h-128\' : vm.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.QUEUES"></span>\n      <ms-search-bar on-search="vm.getVoiceQueues()" query="vm.queuesQuery" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.queuesQuery.sort" md-on-reorder="vm.getVoiceQueues">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="name">{{\'DASHBOARDS.NAME\' | translate}}</th>\n          <th md-column md-order-by="name">{{\'VOICE.CALLS\' | translate}}</th>\n          <th md-column class="no-padding width-70"></th>\n          <th md-column class="width-70"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.voiceQueues.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="queue in vm.voiceQueues.rows">\n          <td md-cell>{{queue.id}}</td>\n          <td md-cell>{{queue.name}}</td>\n          <td md-cell>{{queue.calls.length || 0}}</td>\n          <td md-cell class="no-padding width-70">\n            <md-button ng-click="vm.originateCall(queue.name)" class="md-fab md-mini md-raised" aria-label="Dial">\n              <md-icon md-font-icon="icon-phone" class="icon green-fg s20">\n                <md-tooltip><span translate="VOICE.DIAL"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n          <td md-cell class="width-70">\n            <md-button ng-click="vm.transferCall(queue.name)" class="md-fab md-mini md-raised" aria-label="Transfer">\n              <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s20">\n                <md-tooltip><span translate="DASHBOARDS.TRANSFER"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.queuesQuery.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queuesQuery.page" md-total="{{vm.voiceQueues.count}}" md-on-paginate="vm.getVoiceQueues" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/recordings/agent.general.recordings.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header indigo-A100-bg" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="VOICE.RECORDINGS">Recordings</span>\n      <ms-search-bar on-search="vm.getVoiceRecordings()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getVoiceRecordings()">\n      </ms-quick-filter>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceRecordings">\n        <tr md-row>\n          <th md-column md-order-by="type">{{ \'VOICE.TYPE\' | translate }}</th>\n          <th md-column md-order-by="uniqueid">{{ \'VOICE.UNIQUEID\' | translate }}</th>\n          <th md-column md-order-by="calleridnum">{{ \'VOICE.CALLER\' | translate }}</th>\n          <th md-column md-order-by="exten">{{ \'VOICE.CALLED\' | translate }}</th>\n          <th md-column md-order-by="connectedlinenum">{{ \'VOICE.CONNECTED\' | translate }}</th>\n          <th md-column md-order-by="queue">{{ \'VOICE.QUEUE\' | translate }}</th>\n          <th md-column md-order-by="rating">{{ \'VOICE.RATING\' | translate }}</th>\n          <th md-column>{{ \'VOICE.AUDIO\' | translate }}</th>\n          <th md-column md-order-by="createdAt">{{ \'VOICE.DATE\' | translate }}</th>\n          <th md-column width="10px" ng-if="vm.currentUser.downloadVoiceRecordings"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.voiceRecordings.rows.length">\n          <td md-cell colspan="{{ vm.currentUser.downloadVoiceRecordings ? 10 : 9}}">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="voiceRecording in vm.voiceRecordings.rows">\n          <td md-cell class="type">{{voiceRecording.type}}</td>\n          <td md-cell class="uniqueid">{{voiceRecording.uniqueid}}</td>\n          <td md-cell class="calleridnum">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceRecording.calleridnum" license="vm_home.license">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="exten">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceRecording.exten" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="connectedlinenum">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceRecording.connectedlinenum" license="vm_home.license">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="queue">{{voiceRecording.queue}}</td>\n          <td md-cell class="rating">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-show="voiceRecording.rating" ng-repeat="rating in [1,2,3,4,5] | limitTo:voiceRecording.rating"></md-icon><span ng-hide="voiceRecording.rating" translate="VOICE.NO_RATING">No rating</span>\n          </td>\n          <td md-cell class="audio" ng-switch="voiceRecording.format">\n            \x3c!-- audio recording directive --\x3e\n            <ms-recording ng-switch-when=".wav" id="voiceRecording.id"></ms-recording>\n            \x3c!-- / audio recording directive --\x3e\n            <span ng-switch-when=".gsm">\n              <em>{{ \'VOICE.CANT_PLAY_GSM_AUDIO_FILES\' | translate }}</em>\n            </span>\n          </td>\n          <td md-cell class="createdAt ">{{voiceRecording.createdAt | date:\'medium\' }}</td>\n          <td md-cell class="actions" ng-if="vm.currentUser.downloadVoiceRecordings">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.downloadfile(voiceRecording, $event)" translate="VOICE.DOWNLOAD_VOICERECORDING">\n                    Download VoiceRecording\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="voiceRecording.transcribeStatus == \'COMPLETED\'">\n                  <md-button ng-click="vm.downloadtranscribe(voiceRecording, $event)" translate="VOICE.DOWNLOADTRANSCRIBE_VOICERECORDING">\n                    Download Transcribe\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceRecordings.count}}" md-on-paginate="vm.getVoiceRecordings" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/scheduled/agent.general.scheduled.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header blue-grey-bg" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="MOTIONDIALER.SCHEDULED_CALLS">Scheduled Calls</span>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getScheduledCalls()">\n      </ms-quick-filter>\n      <md-button class="md-icon-button reload-list" ng-click="vm.getScheduledCalls()" aria-label="Refresh scheduled calls" translate translate-attr-label="MOTIONDIALER.REFRESH_SCHEDULED_CALLS">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip>{{\'MOTIONDIALER.REFRESH_SCHEDULED_CALLS\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getScheduledCalls">\n        <tr md-row>\n          <th md-column>{{\'MOTIONDIALER.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="phone">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n          <th md-column md-order-by="scheduledat">{{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}</th>\n          <th md-column>{{ \'MOTIONDIALER.PRIORITY\' | translate }}</th>\n          <th md-column md-order-by="recallme">{{ \'MOTIONDIALER.RECALLME\' | translate }}</th>\n          <th md-column>{{ \'MOTIONDIALER.CAMPAIGN\' | translate }}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.scheduledCalls.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="scheduledCall in vm.scheduledCalls.rows">\n          <td md-cell privacy ng-cloak>{{scheduledCall.Contact.firstName}} {{scheduledCall.Contact.lastName}}</td>\n          <td md-cell>\n            <ms-click-to-call target="scheduledCall.phone" license="vm_home.license"></ms-click-to-call>\n          </td>\n          <td md-colors="{color: {{ vm.isDateBeforeToday(scheduledCall.scheduledat) ? \'\\\'red\\\'\' : \'\\\'green\\\'\' }}}" md-cell>{{ scheduledCall.scheduledat | date:\'medium\' }}</td>\n          <td md-cell>{{ vm.priorities[scheduledCall.priority] }}</td>\n          <td md-cell>\n            <md-icon md-colors="{color: {{ scheduledCall.recallme && scheduledCall.UserId == vm.currentUser.id ? \'\\\'green\\\'\' : \'\\\'grey\\\'\' }}}" md-font-icon="{{ scheduledCall.recallme  && scheduledCall.UserId == vm.currentUser.id ? \'icon-check\' : \'icon-close\' }}">\n            </md-icon>\n          </td>\n          <td md-cell>\n            <md-icon md-colors="{color: {{ scheduledCall.Queue.dialActive? \'\\\'green\\\'\' : \'\\\'red\\\'\' }}}" md-font-icon="icon-checkbox-blank-circle"></md-icon> {{scheduledCall.Queue.name}}\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.createOrEditQueueCampaignHopper($event, scheduledCall)" translate="MOTIONDIALER.EDIT_HOPPER">\n                    Edit Hopper\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.deleteConfirm(scheduledCall, $event)" translate="MOTIONDIALER.DELETE_HOPPER">\n                    Delete Hopper\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.scheduledCalls.count}}" md-on-paginate="vm.getScheduledCalls" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/sms/agent.general.sms.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.SMS_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getSmsInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getSmsInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getSmsInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.smsAccounts.rows && vm.smsAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="smsAccount in vm.smsAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeSmsInteraction($event, smsAccount)">\n              {{ smsAccount.name }} ({{ smsAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSmsInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.smsInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.smsInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell class="smsAccount">\n            {{ vm.getSmsAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showSmsInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Sms\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadSmsInteraction($event, interaction)" translate="DASHBOARDS.DOWNLOAD">\n                    Download Sms\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.smsInteractions.count}}" md-on-paginate="vm.getSmsInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/voice/agent.general.voice.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header blue-A700-bg" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="VOICE.CALLS">Calls</span>\n      <ms-search-bar on-search="vm.getVoiceCalls()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getVoiceCalls()">\n      </ms-quick-filter>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceCalls">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'VOICE.ID\' | translate}}</th>\n          <th md-column md-order-by="type">{{ \'VOICE.TYPE\' | translate }}</th>\n          <th md-column md-order-by="source">{{ \'VOICE.SOURCE\' | translate }}</th>\n          <th md-column md-order-by="destination">{{ \'VOICE.DESTINATION\' | translate }}</th>\n          <th md-column md-order-by="starttime">{{ \'VOICE.STARTEDAT\' | translate }}</th>\n          <th md-column md-order-by="endtime">{{ \'VOICE.ENDEDAT\' | translate }}</th>\n          <th md-column md-order-by="userDisposition">{{ \'VOICE.DISPOSITION\' | translate }}</th>\n          <th md-column md-order-by="userSecondDisposition">{{ \'VOICE.SECOND_LEVEL_DISPOSITION\' | translate }}</th>\n          <th md-column md-order-by="userThirdDisposition">{{ \'VOICE.THIRD_LEVEL_DISPOSITION\' | translate }}</th>\n          <th md-column>{{ \'VOICE.NOTE\' | translate }}</th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.voiceCalls.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="voiceCall in vm.voiceCalls.rows" ng-click="vm.showDetails(voiceCall, $event)">\n          <td md-cell class="type">{{voiceCall.id}}</td>\n          <td md-cell class="type">{{ \'VOICE.\' + voiceCall.type.toUpperCase() | translate}}</td>\n          <td md-cell class="source">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceCall.source" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="destination">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceCall.destination" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="starttime">{{voiceCall.starttime | date:\'medium\' }}</td>\n          <td md-cell class="endtime">{{voiceCall.endtime | date:\'medium\' }}</td>\n          <td md-cell class="disposition">{{ voiceCall.userDisposition}}</td>\n          <td md-cell class="disposition">{{ voiceCall.userSecondDisposition}}</td>\n          <td md-cell class="disposition">{{ voiceCall.userThirdDisposition}}</td>\n          <td md-cell class="note">\n            <md-icon ng-if="voiceCall.note" md-font-icon="icon-clipboard-outline"></md-icon>\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.showDetails(voiceCall, $event)" translate="VOICE.DETAILS">\n                    Show Details\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceCalls.count}}" md-on-paginate="vm.getVoiceCalls" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/voice/details/dialog.html",'<md-dialog class="details-dialog" aria-label="details">\n  <md-toolbar class="md-background-bg">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span ng-if="!vm.interaction.closed" class="title" translate="VOICE.DETAILS"></span>\n      <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-dialog-content>\n    <md-list flex>\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.UNIQUEID">Uniqueid</p>\n          <h4>{{vm.call.uniqueid}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.TYPE">Type</p>\n          <h4>{{vm.call.type ? vm.call.type : \'no type\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.SOURCE">Source</p>\n          <h4 privacy ng-cloak>{{vm.call.source ? vm.call.source : \'unknown\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.DESTINATION">Destination</p>\n          <h4 privacy ng-cloak>{{vm.call.destination ? vm.call.destination : \'unknown\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.STARTEDAT">Started At</p>\n          <h4>{{vm.call.starttime | date:\'medium\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.ANSWEREDAT">Answered At</p>\n          <h4>{{vm.call.answertime ? (vm.call.answertime | date:\'medium\') : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.ENDEDAT">Ended At</p>\n          <h4>{{vm.call.endtime ? (vm.call.endtime | date:\'medium\') : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.DURATION">Duration</p>\n          <h4>{{vm.call.duration ? vm.call.duration : \'--\'}}s</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.BILLABLESECONDS">Billable Seconds</p>\n          <h4>{{vm.call.billableseconds ? vm.call.billableseconds : \'--\'}}s</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.DISPOSITION">Disposition</p>\n          <h4>{{vm.call.userDisposition ? vm.call.userDisposition : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</p>\n          <h4>{{vm.call.userSecondDisposition ? vm.call.userSecondDisposition : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</p>\n          <h4>{{vm.call.userThirdDisposition ? vm.call.userThirdDisposition : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.NOTE">Note</p>\n          <h4>{{vm.call.note ? vm.call.note : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n    </md-list>\n  </md-dialog-content>\n\n  <md-dialog-actions layout="row" layout-align="space-between center">\n    <md-button type="button" ng-click="vm.closeDialog()" class="send-button md-accent md-raised" aria-label="DISPOSE" translate="VOICE.CLOSE" translate-attr-aria-label="VOICE.DISPOSE">\n      CLOSE\n    </md-button>\n  </md-dialog-actions>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/home/whatsapp/agent.general.whatsapp.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.WHATSAPP_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getWhatsappInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getWhatsappInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getWhatsappInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.whatsappAccounts.rows && vm.whatsappAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="whatsappAccount in vm.whatsappAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeWhatsappInteraction($event, whatsappAccount)">\n              {{ whatsappAccount.name }} ({{ whatsappAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getWhatsappInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.whatsappInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.whatsappInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell class="whatsappAccount">\n            {{ vm.getWhatsappAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showWhatsappInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Whatsapp\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadWhatsappInteraction($event, interaction)" translate="DASHBOARDS.DOWNLOAD">\n                    Download Whatsapp\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.whatsappInteractions.count}}" md-on-paginate="vm.getWhatsappInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/iframe/agent.general.iframe.html",'<md-content layout="row" layout-fill>\n\n  <div flex layout="row">\n\n    <iframe ng-src="{{vm.getTrustedURL()}}" frameborder=0 style="width: 100%; height: 100%; border:0px;"></iframe>\n\n  </div>\n\n</md-content>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",'<md-dialog id="agent-general-dialog" aria-label="Spy Dialog">\n  <div id="interaction-app" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.html\'"></div>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.html",'\x3c!-- CONTENT CARD --\x3e\n<md-content class="content-card" layout="row" layout-fill>\n\n  <div ng-if="!vm.showInteraction" class="start-point" flex layout="column" layout-align="center center" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.loading.html\'"></div>\n\n  <div ng-if="vm.showInteraction" flex layout="row">\n\n    <md-card flex="75" class="interaction">\n\n      <md-content class="interaction-agents" layout="row" layout-align="start center" ng-if="!vm.interaction.closed && vm.interaction.Users.length">\n        <strong layout-margin translate="DASHBOARDS.CURRENTLY_IN_USE_BY">Currently in use by </strong>\n\n        <div ng-repeat="u in vm.interaction.Users">\n          <img class="avatar-small" ng-src="api/users/{{u.id}}/avatar">\n          <md-tooltip> {{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : vm.usersMap[u.id] | translate }}\n          </md-tooltip>\n        </div>\n      </md-content>\n\n      \x3c!-- TOOLBAR --\x3e\n      <md-toolbar class="interaction-toolbar" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.html\'">\n      </md-toolbar>\n      \x3c!-- / TOOLBAR --\x3e\n\n      \x3c!-- CONTENT --\x3e\n      <md-content id="interaction-content" name="{{\'interaction-content-\' + vm.tab.id}}" flex layout-wrap>\n        <div class="interaction-messages" ng-switch="vm.tab.channel">\n          <div ng-switch-when="mail">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.mail.html\'">\n            </div>\n          </div>\n          <div ng-switch-default>\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.html\'">\n            </div>\n          </div>\n        </div>\n      </md-content>\n      \x3c!-- / CONTENT --\x3e\n\n      \x3c!-- FOOTER --\x3e\n      <div ng-if="\n            !vm.interaction.closed && ( vm.tab.channel == \'chat\' \n            || (vm.tab.channel == \'openchannel\' && vm.account.replyUri) \n            || (vm.tab.channel == \'sms\' && !vm.tab.spy) \n            || (vm.tab.channel == \'whatsapp\' && !vm.tab.spy) )\n             && (vm.user.role !== \'admin\' && vm.user.role !== \'user\')" class="interaction-footer flex-noshrink" layout="row" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.footer.html\'">\n      </div>\n      \x3c!-- / FOOTER--\x3e\n    </md-card>\n\n    <md-card layout="column" flex class="info" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.html\'">\n    </md-card>\n  </div>\n</md-content>\n\x3c!-- / CONTENT CARD --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/chat/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="CHAT.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="CHAT.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="CHAT.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="CHAT.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mobile" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'CHAT.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'CHAT.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.ChatAccountId" md-font-icon="icon-earth" aria-label="alert chat" class="s16"></md-icon>\n          <md-icon ng-if="item.ChatAccountId" md-font-icon="icon-message-text" aria-label="alert chat" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n\n        <md-not-found>\n          <span translate="CHAT.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/fax/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="FAX.SEND">SEND</span>\n          </md-button>\n          <md-button ng-disabled="vm.message.attachments.length === 1" class="md-fab md-mini md-white-bg" aria-label="attachment" translate-attr-aria-label="DASHBOARDS.ATTACHMENT" flow-btn flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-init="vm.ngFlowOptions" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)">\n            <md-icon md-font-icon="icon-paperclip" class="red-fg"></md-icon>\n          </md-button>\n        </div>\n        <span class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="FAX.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block to">\n        <label translate="FAX.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete ng-hide="vm.message.to.length === 1" md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.fax" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" ng-if="composeForm.$dirty">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n          <div ng-message="md-max-chips">You reached the maximum amount of chips</div>\n        </div>\n      </md-input-container>\n      <div class="attachment-list" ng-if="vm.message.attachments.length" layout="row" layout-wrap>\n        <div class="attachment" layout="row" layout-align="space-between center" ng-repeat="attachment in vm.message.attachments">\n          <div>\n            <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            <span class="filename">{{attachment.name}}</span>\n            <span class="size">({{attachment.size | byteFmt: 0}})</span>\n          </div>\n          <md-button class="md-icon-button" aria-label="Delete attachment" translate translate-attr-aria-label="FAX.DELETE_ATTACHMENT">\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message" ng-class="{\'mail-no-secret\': !vm.secret}" ng-cloak>\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar ng-class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <div ng-if="!vm.secret" class="md-button md-raised blue-bg no-padding">\n            <button class="white-fg margin-horizontal-10" aria-label="Send message" ng-disabled="!vm.verifySmtp" ng-click="vm.send($event, false, null)">\n              <span>{{ \'MAIL.SEND\' | translate | uppercase }}</span>\n            </button>\n            <span class="white-fg secondary-text vertical-divider"></span>\n            <md-menu>\n              <button ng-disabled="!vm.verifySmtp" class="white-fg margin-left-0" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-menu-down" class="icon s24"></md-icon>\n              </button>\n              <md-menu-content width="2">\n                <md-menu-item ng-if="vm.subStatuses.rows.length">\n                  <md-menu>\n                    <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="MAIL.SEND_AS">\n                      Send as\n                    </md-button>\n                    <md-menu-content>\n                      <md-menu-item ng-repeat="subStatus in vm.subStatuses.rows">\n                        <md-button ng-click="vm.send($event, false, subStatus.name)">\n                          {{subStatus.name}}\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.send($event, true, null)" translate="MAIL.SEND_AND_CLOSE">\n                    Send and Close\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </div>\n          <md-button ng-if="!vm.secret" class=" md-button md-raised blue-bg white-fg margin-horizontal-10" aria-label="Save draft" ng-click="vm.saveDraft()">\n            <span>{{ (vm.isDraft ? \'DASHBOARDS.UPDATE_DRAFT\' : \'DASHBOARDS.SAVE_AS_DRAFT\') | translate | uppercase }}</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="MAIL.ADD_NOTE">Add note</span>\n          </md-button>\n          <md-button ng-disabled="!vm.verifySmtp" class="md-fab md-mini md-white-bg" aria-label="attachment" translate-attr-aria-label="DASHBOARDS.ATTACHMENT" flow-btn flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload($files)" flow-init="vm.ngFlowOptions" flow-file-success="vm.fileSuccess($file, $message)" flow-file-added="vm.fileAdded($file)">\n            <md-icon md-font-icon="icon-paperclip" class="red-fg"></md-icon>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="MAIL.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to" ng-class="{\'hidden-cc\': vm.hiddenCC, \'hidden-bcc\': vm.hiddenBCC}">\n        <label translate="MAIL.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" ng-keypress="vm.keyPress($event)" md-transform-chip="vm.transformContact($chip, vm.message.to)" md-separator-keys="vm.separatorKeys" md-require-match="false" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.email" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n        <div class="cc-bcc" layout="row" layout-align="start center">\n          <div class="show-cc" ng-show="vm.hiddenCC" ng-click="vm.hiddenCC = false">CC</div>\n          <div class="show-bcc" ng-show="vm.hiddenBCC" ng-click="vm.hiddenBCC = false">BCC</div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="!vm.secret" class="md-block" ng-hide="vm.hiddenCC">\n        <label translate="MAIL.CC">Cc</label>\n        <md-chips name="cc" ng-model="vm.message.cc" ng-keypress="vm.keyPress($event)" md-transform-chip="vm.transformContact($chip, vm.message.cc)" md-separator-keys="vm.separatorKeys" md-require-match="false" required>\n          <md-autocomplete md-search-text="vm.searchCc" md-items="contact in vm.contactSearch(vm.searchCc)" md-item-text="contact.email" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n      </md-input-container>\n      <md-input-container ng-if="!vm.secret" class="md-block" ng-hide="vm.hiddenBCC">\n        <label translate="MAIL.BCC">Bcc</label>\n        <md-chips name="bcc" ng-model="vm.message.bcc" ng-keypress="vm.keyPress($event)" md-transform-chip="vm.transformContact($chip, vm.message.bcc)" md-separator-keys="vm.separatorKeys" md-require-match="false" required>\n          <md-autocomplete md-search-text="vm.searchBcc" md-items="contact in vm.contactSearch(vm.searchBcc)" md-item-text="contact.email" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n      </md-input-container>\n      <md-input-container ng-if="!vm.secret" class="md-block no-margin">\n        <label translate="MAIL.SUBJECT">Subject</label>\n        <input ng-model="vm.message.subject" type="text" ng-keypress="vm.keyPress($event)">\n      </md-input-container>\n      <div class="attachment-list" ng-if="vm.message.attachments.length" layout="row" layout-wrap>\n        <div class="attachment" layout="row" layout-align="space-between center" ng-repeat="attachment in vm.message.attachments">\n          <div>\n            <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            <span class="filename">{{attachment.name}}</span>\n            <span class="size" ng-if="attachment.size">({{attachment.size | byteFmt: 0}})</span>\n          </div>\n          <md-button ng-click="vm.removeAttachment(attachment)" class="md-icon-button" aria-label="Delete attachment" translate translate-attr-aria-label="MAIL.DELETE_ATTACHMENT">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="padding-top-5">\n        <textarea ckeditor="vm.ckeditor" id="html-area" ng-model="vm.message.body" md-select-on-focus="" ready="vm.onReadyEditor()"></textarea>\n      </div>\n      <md-switch ng-if="!vm.message.showLastMessage && !vm.secret" ng-model="vm.message.showLastMessage" ng-change="vm.loadLastMessage()" aria-label="load last message"><span translate="MAIL.SHOW_ORIGINAL_MESSAGE">Show original message</span></md-switch>\n      <md-autocomplete ng-if="!vm.secret" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'MAIL.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin" ng-keypress="vm.keyPress($event)">\n        <md-item-template>\n          <md-icon ng-if="!item.MailAccountId" md-font-icon="icon-earth" aria-label="alert email" class="s16">\n          </md-icon>\n          <md-icon ng-if="item.MailAccountId" md-font-icon="icon-email" aria-label="alert email" class="s16 teal-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{ item.key }} -\n            {{ item.value | htmlToPlaintext }}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="MAIL.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/openchannel/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="OPENCHANNEL.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="OPENCHANNEL.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="OPENCHANNEL.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="OPENCHANNEL.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mapkey" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'OPENCHANNEL.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'OPENCHANNEL.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.OpenchannelAccountId" md-font-icon="icon-earth" aria-label="alert openchannel" class="s16"></md-icon>\n          <md-icon ng-if="item.OpenchannelAccountId" md-font-icon="icon-message-text" aria-label="alert openchannel" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="OPENCHANNEL.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/sms/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="SMS.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="SMS.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="SMS.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="SMS.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mobile" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'SMS.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'SMS.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.SmsAccountId" md-font-icon="icon-earth" aria-label="alert sms" class="s16"></md-icon>\n          <md-icon ng-if="item.SmsAccountId" md-font-icon="icon-message-text" aria-label="alert sms" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="SMS.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/whatsapp/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="WHATSAPP.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="WHATSAPP.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="WHATSAPP.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="WHATSAPP.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mobile" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'WHATSAPP.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'WHATSAPP.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.WhatsappAccountId" md-font-icon="icon-earth" aria-label="alert whatsapp" class="s16">\n          </md-icon>\n          <md-icon ng-if="item.WhatsappAccountId" md-font-icon="icon-message-text" aria-label="alert whatsapp" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="WHATSAPP.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",'<md-dialog class="disposition-dialog" aria-label="disposition" ng-init="vm.onInit()">\n  <form name="dispositionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span ng-if="!vm.interaction.closed" class="title" translate="DASHBOARDS.DISPOSE"></span>\n        <span ng-if="vm.interaction.closed" class="title" translate="DASHBOARDS.INFO"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" ng-if="!vm.mandatoryDisposition">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="DASHBOARDS.DISPOSITION">Disposition</label>\n        <md-select name="disposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onDispositionChange(\'first\')" required>\n          <md-option ng-value="null" ng-if="!vm.mandatoryDisposition">NONE</md-option>\n          <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' } : true">\n            {{ disposition.name }}</md-option>\n        </md-select>\n        <div ng-messages="dispositionForm.disposition.$error" ng-show="dispositionForm.disposition.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="DASHBOARDS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n          <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition" ng-change="vm.onDispositionChange(\'second\')">\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id } : true">\n              {{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearDispositionSelection(\'second\')" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear second level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <div ng-if="vm.secondLevelDisposition && vm.anyThirdLevelDisposition" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</label>\n          <md-select name="thirdLevelDisposition" ng-model="vm.thirdLevelDisposition">\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'third\', ParentId: vm.secondLevelDisposition.id } : true" ng-disabled="disposition.canSelect === false">{{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.thirdLevelDisposition" ng-click="vm.clearDispositionSelection(\'third\')" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear third level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="DASHBOARDS.NOTE">Note</label>\n        <textarea ng-model="vm.interaction.note" md-maxlength="255" max-rows="5" autofocus></textarea>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveDisposition()" ms-dialog-spinner class="send-button md-accent md-raised" ng-if="!vm.interaction.closed && (vm.firstLevelDisposition || vm.secondLevelDisposition || vm.thirdLevelDisposition)" aria-label="CLOSE_AND_DISPOSE" translate="DASHBOARDS.CLOSE_AND_DISPOSE" translate-attr-aria-label="DASHBOARDS.CLOSE_AND_DISPOSE">\n          CLOSE AND DISPOSE\n        </md-button>\n        <md-button type="submit" ng-click="vm.saveDisposition(false)" ms-dialog-spinner class="send-button md-accent md-raised" ng-if="!vm.interaction.closed && !vm.firstLevelDisposition" ng-disabled="vm.mandatoryDisposition" aria-label="CLOSE_WITHOUT_DISPOSE" translate="DASHBOARDS.CLOSE_WITHOUT_DISPOSE" translate-attr-aria-label="DASHBOARDS.CLOSE_WITHOUT_DISPOSE">\n          CLOSE WITHOUT DISPOSE\n        </md-button>\n        <md-button type="submit" ng-click="vm.saveDisposition()" ms-dialog-spinner class="send-button md-accent md-raised" ng-if="vm.interaction.closed" ng-disabled="vm.mandatoryDisposition && !vm.firstLevelDisposition" aria-label="DISPOSE" translate="DASHBOARDS.DISPOSE" translate-attr-aria-label="DASHBOARDS.DISPOSE">\n          DISPOSE\n        </md-button>\n        <div ng-if="vm.mandatoryDisposition">\n          <md-icon md-font-icon="icon-information-outline" aria-label="Mandatory Disposition"></md-icon>\n          <span class="no-margin font-size-12 line-height-30" translate="DASHBOARDS.HELP.MANDATORY_DISPOSITION_ENABLED"></span>\n        </div>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/tag/dialog.html",'<md-dialog class="tag-dialog" aria-label="tag">\n  <form name="tagForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.TAGS"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <md-chips ng-model="vm.interaction.Tags" md-autocomplete-snap md-require-match="vm.autocompleteRequireMatch">\n          <md-autocomplete ng-blur="vm.searchText = \'\'" md-min-length="0" md-selected-item-change="vm.selectedItemChange" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-items="item in vm.tags.rows | filter:{ name: vm.searchText }" md-item-text="item.name" placeholder="Search for a tag">\n            <span md-highlight-text="vm.searchText">{{item.name}}</span>\n          </md-autocomplete>\n          <md-chip-template>\n            <span>\n              <strong>{{$chip.name}}</strong>\n            </span>\n          </md-chip-template>\n        </md-chips>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveTag(false)" ng-disabled="tagForm.$pristine" class="send-button md-accent md-raised" aria-label="TAG" translate="DASHBOARDS.SAVE" translate-attr-aria-label="DASHBOARDS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/transfer/dialog.html",'<md-dialog class="disposition-dialog" aria-label="disposition">\n  <form name="transferForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.TRANSFER"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog(false)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="DASHBOARDS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.transfer.type">\n          <md-option ng-value="\'queue\'" ng-if="vm.account.queueTransfer">Queue</md-option>\n          <md-option ng-value="\'agent\'" ng-if="vm.account.agentTransfer">Agent</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.transfer.type === \'queue\'">\n        <label translate="DASHBOARDS.QUEUES">Queues</label>\n        <md-select name="queue" ng-model="vm.transfer.id" required>\n          <md-option ng-value="queue.id" ng-repeat="queue in vm.queues.rows">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="transferForm.queue.$error" ng-show="transferForm.queue.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="DASHBOARDS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.transfer.type === \'agent\'">\n        <label translate="DASHBOARDS.AGENTS">Agents</label>\n        <md-select name="agent" ng-model="vm.transfer.id" required>\n          <md-option ng-value="agent.id" ng-repeat="agent in vm.agents.rows">{{\n            agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="transferForm.agent.$error" ng-show="transferForm.agent.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="DASHBOARDS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.onTransfer(true)" ng-disabled="transferForm.$pristine" class="send-button md-accent md-raised" aria-label="DASHBOARDS.TRANSFER" translate="DASHBOARDS.TRANSFER" translate-attr-aria-label="DASHBOARDS.TRANSFER">\n          TRANSFER\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.footer.html",'\x3c!-- REPLY FORM --\x3e\n<div ng-show="vm.showFooter" layout="column" layout-align="center center" flex>\n  <div layout="row" layout-align="center center" style="flex-grow: 1; align-self: stretch" flex>\n    \x3c!-- msEmojyArea directive --\x3e\n    <ms-emoji-area ng-if="vm.tab.channel != \'fax\'" on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.tab.areaText" placeholder="vm.tab.channel.toUpperCase() + \'.INSERT_MESSAGE_HERE\'"></ms-emoji-area>\n    \x3c!-- / msEmojyArea directive --\x3e\n\n    <div layout="row" layout-align="end center">\n      <md-button ng-if="vm.tab.channel != \'fax\'" style="margin:1px;" class="md-icon-button md-mini" ng-click="vm.changeDisplayCannedAnswerInputValue()" aria-label="Search canned answer" translate translate-attr-aria-label="DASHBOARDS.SEND_MESSAGE">\n        <md-icon md-font-icon="icon-auto-fix" class="green-fg"></md-icon>\n      </md-button>\n\n      <md-button ng-if="vm.tab.channel == \'openchannel\' || vm.tab.channel == \'chat\' || vm.tab.channel == \'fax\'" style="margin:1px;" class="md-icon-button md-warn md-mini" aria-label="attachment" translate-attr-aria-label="DASHBOARDS.ATTACHMENT" flow-btn flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-init="vm.ngFlowOptions" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)">\n        <md-icon md-font-icon="icon-paperclip"></md-icon>\n      </md-button>\n    </div>\n  </div>\n\n  <md-autocomplete ng-hide="!vm.displayCannedAnswerInput" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" placeholder="{{ \'DASHBOARDS.CANNED_ANSWER_SEARCH\' | translate}}" class="cannedarea input-show-hide">\n    <md-item-template>\n      <md-icon ng-if="!item[vm.tab.channel === \'chat\' ? \'ChatWebsiteId\' : _.capitalize(vm.tab.channel) + \'AccountId\']" md-font-icon="icon-earth" aria-label="alert channel" class="s16"></md-icon>\n      <md-icon ng-if="item[vm.tab.channel === \'chat\' ? \'ChatWebsiteId\' : _.capitalize(vm.tab.channel) + \'AccountId\']" md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" aria-label="alert channel" class="s16" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n      <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n    </md-item-template>\n\n    <md-not-found>\n      <span translate="DASHBOARDS.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n    </md-not-found>\n  </md-autocomplete>\n</div>\n\x3c!-- / REPLY FORM --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.chat.html",'<div ng-init="item = item || vm.interaction">\n  <md-list-item class="md-2-line" ng-if="item.browserName">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.BROWSER_NAME">Browser Name</p>\n      <h4>{{ item.browserName }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.osName">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.OS_NAME">OS Name</p>\n      <h4>{{ item.osName }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.deviceModel">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DEVICE_MODEL">Device Model</p>\n      <h4>{{ item.deviceModel }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.referer">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.REFERER">Referer</p>\n      <h4>{{ item.referer }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.customerIp">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CUSTOMER_IP">Originating IP Address</p>\n      <h4>{{ item.customerIp }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.customerPort">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CUSTOMER_PORT">Originating TCP Port</p>\n      <h4>{{ item.customerPort }}</h4>\n    </div>\n  </md-list-item>\n  <md-divider ng-if="item.closed && item.ratingValue != null || item.ratingMessage"></md-divider>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.ratingValue != null">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.RATING">Rating</p>\n      <md-icon md-font-icon="icon-star" style="color:red" ng-show="!item.ratingType || item.ratingType == \'star\'" ng-repeat="ratingValue in [1,2,3,4,5] | limitTo:item.ratingValue"></md-icon>\n      <md-icon md-font-icon="icon-thumb-up" style="color:green" ng-show="item.ratingType && item.ratingType == \'thumb\' && item.ratingValue == 1"></md-icon>\n      <md-icon md-font-icon="icon-thumb-down" style="color:red" ng-show="item.ratingType && item.ratingType == \'thumb\' && item.ratingValue == 0"></md-icon>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.ratingMessage">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.FEEDBACK">Feedback</p>\n      <h4 style="overflow-wrap: break-word; white-space: normal">{{ item.ratingMessage }}</h4>\n    </div>\n  </md-list-item>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.html",'<md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.CONTACT">Contact</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content class="md-padding">\n        <form name="contactForm" class="md-inline-form" novalidate>\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-account"></md-icon>\n            <label translate="DASHBOARDS.NAME">Name</label>\n            <input type="text" name="firstName" ng-model="vm.contact.firstName" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-email"></md-icon>\n            <label translate="DASHBOARDS.EMAIL">Email</label>\n            <input type="email" name="email" ng-model="vm.contact.email" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n            <label translate="DASHBOARDS.PHONE">Phone</label>\n            <input type="text" name="phone" ng-model="vm.contact.phone" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-cellphone-iphone"></md-icon>\n            <label translate="DASHBOARDS.MOBILE">Mobile</label>\n            <input type="text" name="mobile" ng-model="vm.contact.mobile" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-deskphone"></md-icon>\n            <label translate="DASHBOARDS.FAX">Fax</label>\n            <input type="text" name="fax" ng-model="vm.contact.fax" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <div ng-if="!vm.tab.spy" layout="row" layout-align="center center">\n            <md-button class="md-raised md-accent" ng-click="vm.openContact(ev)" translate="DASHBOARDS.MORE">\n              More\n            </md-button>\n          </div>\n        </form>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.INTERACTION">Interaction</span>\n    </md-tab-label>\n    <md-tab-body>\n      <div layout="column" layout-align="space-between center" class="md-padding">\n        <md-icon class="s42" md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n        <span ng-if="vm.interaction.closed" class="md-background-bg red-fg font-size-14">#{{vm.interaction.id}} - <span translate="DASHBOARDS.CLOSED"></span></span>\n        <span ng-if="!vm.interaction.closed" class="md-background-bg green-fg font-size-14">#{{vm.interaction.id}} -\n          <span translate="DASHBOARDS.OPENED"></span></span>\n        <span ng-if="!vm.interaction.closed && vm.interaction.substatus" class="md-background-bg green-fg font-size-14">{{vm.interaction.substatus}}</span>\n      </div>\n      <md-divider></md-divider>\n      <md-list flex>\n        <md-list-item class="md-2-line">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.WEBSITE" ng-if="vm.tab.channel == \'chat\'">Website</p>\n            <p translate="DASHBOARDS.ACCOUNT" ng-if="vm.tab.channel != \'chat\'">Account</p>\n            <h4>{{vm.account.name}}</h4>\n          </div>\n        </md-list-item>\n\n        <md-list-item class="md-2-line">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.AGENT">Agent</p>\n            <h4>{{vm.agent.fullname || vm.usersMap[vm.interaction.UserId]}}</h4>\n          </div>\n        </md-list-item>\n\n        <md-list-item class="md-2-line" ng-if="vm.interaction.externalUrl">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.EXTERNAL_URL">External URL</p>\n            <a href="{{vm.interaction.externalUrl}}" target="_blank">\n              <h4>{{vm.interaction.externalUrl}}</h4>\n            </a>\n          </div>\n        </md-list-item>\n\n        <md-list-item class="md-2-line">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.CREATED_AT">Created At</p>\n            <h4>{{vm.interaction.createdAt | date: \'medium\'}}</h4>\n          </div>\n        </md-list-item>\n\n        <div ng-switch="vm.tab.channel">\n          <div ng-switch-when="chat">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.chat.html\'">\n            </div>\n          </div>\n          <div ng-switch-when="mail">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.mail.html\'">\n            </div>\n          </div>\n          <div ng-switch-when="openchannel">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.openchannel.html\'">\n            </div>\n          </div>\n        </div>\n\n        <md-list-item class="md-2-line" ng-if="vm.interaction.Tags.length">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.TAGS">Tags</p>\n            <div class="tags padding-bottom-5" layout="row" layout-align="start center" layout-wrap>\n              <div class="tag margin-right-5 margin-top-5 margin-bottom-5" layout="row" layout-align="center center" ng-repeat="tag in vm.interaction.Tags">\n                <div class="tag-color" ng-style="{\'background\': tag.color}"></div>\n                <div class="tag-label">{{tag.name}}</div>\n              </div>\n            </div>\n          </div>\n        </md-list-item>\n\n        <md-divider ng-if="vm.interaction.closed"></md-divider>\n\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.CLOSED_AT">Closed At</p>\n            <h4>{{vm.interaction.closedAt | date: \'medium\'}}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed && vm.interaction.disposition">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.DISPOSITION">Disposition</p>\n            <h4>{{ vm.interaction.disposition }}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed && vm.interaction.secondDisposition">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</p>\n            <h4>{{ vm.interaction.secondDisposition }}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed && vm.interaction.thirdDisposition">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</p>\n            <h4>{{ vm.interaction.thirdDisposition }}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-3-line md-long-text" ng-if="vm.interaction.closed && vm.interaction.note">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.NOTE">NOTE</p>\n            <h4 style="overflow-wrap: break-word; white-space: normal">{{ vm.interaction.note }}</h4>\n          </div>\n        </md-list-item>\n      </md-list>\n    </md-tab-body>\n  </md-tab>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.CUSTOMER_JOURNEY">Journey</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content class="md-padding">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'">\n        </div>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n</md-tabs>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.all.html",'<md-divider></md-divider>\n<md-list flex>\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.AGENT">Agent</p>\n      <h4>{{ vm.agent.fullname || vm.usersMap[item.UserId] || \'DASHBOARDS.NOT_ASSIGNED\' | translate }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.externalUrl">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.EXTERNAL_URL">External URL</p>\n      <a href="{{ item.externalUrl }}" target="_blank">\n        <h4>{{ item.externalUrl }}</h4>\n      </a>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CREATED_AT">Created At</p>\n      <h4>{{ item.createdAt | date: \'medium\' }}</h4>\n    </div>\n  </md-list-item>\n  <div ng-if="item.channel === \'chat\'">\n    <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.chat.html\'">\n    </div>\n  </div>\n  <div ng-if="item.channel === \'mail\'">\n    <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.mail.html\'">\n    </div>\n  </div>\n  <md-divider ng-if="item.closed"></md-divider>\n  <md-list-item class="md-2-line" ng-if="item.closed">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CLOSED_AT">Closed At</p>\n      <h4>{{ item.closedAt | date: \'medium\' }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.disposition">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DISPOSITION">Disposition</p>\n      <h4>{{ item.disposition }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.secondDisposition">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</p>\n      <h4>{{ item.secondDisposition }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.thirdDisposition">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</p>\n      <h4>{{ item.thirdDisposition }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-3-line md-long-text" ng-if="item.closed && item.note">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.NOTE">NOTE</p>\n      <h4 style="overflow-wrap: break-word; white-space: normal">{{ item.note }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item ng-if="item.Tags.length">\n    <p class="padding-horizontal-15 grey-fg">Tags</p>\n    <div class="tags padding-bottom-5" layout="row" layout-align="start center" layout-wrap>\n      <div class="tag margin-right-5 margin-top-5 margin-bottom-5" layout="row" layout-align="center center" ng-repeat="tag in item.Tags">\n        <div class="tag-color" ng-style="{\'background\': tag.color}"></div>\n        <div class="tag-label">{{ tag.name }}</div>\n      </div>\n    </div>\n  </md-list-item>\n</md-list>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html",'<div layout-margin layout="row" layout-align="center center">\n  <ms-quick-filter filters="vm.quickFilters" query="vm.journeyOptions" search="vm.getCustomerJourney()">\n  </ms-quick-filter>\n</div>\n\n<md-content id="journey-content" flex layout-wrap>\n  <div ng-if="vm.journeyIsLoading" layout="row" layout-align="center center">\n    <md-progress-circular class="md-accent" md-diameter="48" md-mode="indeterminate"></md-progress-circular>\n  </div>\n  <div id="timeline" layout="column" ng-if="vm.journey && vm.journey.length && !vm.journeyIsLoading" ms-timeline="vm.journeyTimelineOptions" ms-timeline-load-more="vm.loadMoreJourney()">\n    \x3c!-- TIMELINE ITEM --\x3e\n    <div class="ms-timeline-item" layout-align="center center" ng-repeat="item in vm.journey">\n      <div class="timeline-card">\n        <md-card class="channel" ng-class="{\'md-grey-200-bg\': item.id == vm.interaction.id}">\n          <div layout="row" layout-align="space-between center">\n            <div class="header p-6" layout="row" layout-align="start center" ng-cloak>\n              <md-button class="md-fab md-mini no-click" aria-label="icon-channel" ng-class="{{ \'item.style.color\' }} + \'-bg\'">\n                <md-icon md-font-icon="{{ item.style.icon }}"></md-icon>\n              </md-button>\n              <div class="info" layout="column" ng-init="item.showMore = false">\n                <span class="font-size-12 text-truncate" ng-if="item.destination">\n                  #{{item.id}} - <span privacy ng-cloak>{{ item.destination }}</span>\n                </span>\n                <span class="font-size-12 text-truncate" ng-if="!item.destination">\n                  #{{item.id}} - {{ item.Account.key }}\n                </span>\n                <span class="font-size-10">{{item.createdAt | date: \'medium\'}}</span>\n                <span>\n                  <a class="toggle-details md-accent-color" ng-click="item.showMore = !item.showMore" translate="{{ item.showMore ? \'DASHBOARDS.HIDE_DETAILS\' : \'DASHBOARDS.SHOW_DETAILS\' }}">\n                  </a>\n                </span>\n              </div>\n            </div>\n            <span>\n              <img ng-if="item.UserId" class="avatar" ng-src="api/users/{{item.UserId}}/avatar">\n              <md-tooltip md-direction="left">{{item.Owner.fullname || item.User.fullname}}</md-tooltip>\n            </span>\n          </div>\n          <div ng-if="item.showMore">\n            <div ng-if="item.channel !== \'voice\'" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.all.html\'">\n            </div>\n            <div ng-if="item.channel === \'voice\'" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.voice.html\'">\n            </div>\n          </div>\n          <md-divider></md-divider>\n          <div ng-if="item.id != vm.interaction.id" layout="row" layout-align="space-around center">\n            <div ng-if="item.closed && item.channel !== \'voice\'" class="text-truncate text-boxed-light">\n              <span class="red-fg" title="{{ \'DASHBOARDS.STATUS\' | translate}} : {{ \'DASHBOARDS.CLOSED\' | translate }} {{ item.dispositionsValues }}">\n                {{ \'DASHBOARDS.STATUS\' | translate}} : {{ \'DASHBOARDS.CLOSED\' | translate}} {{ item.dispositionsValues\n                }}\n              </span>\n            </div>\n            <span class="text-boxed md-background-bg green-fg" ng-if="!item.closed && item.channel !== \'voice\'" title="{{ \'DASHBOARDS.STATUS\' | translate}}: {{ \'DASHBOARDS.OPENED\' | translate}}">\n              {{ \'DASHBOARDS.STATUS\' | translate}}:\n              {{ \'DASHBOARDS.OPENED\' | translate}}\n              <span ng-if="item.substatus"> - {{ item.substatus }}</span>\n            </span>\n            <span ng-if="item.channel === \'voice\'" class="text-boxed md-background-bg red-fg" title="{{ item.userDisposition ? (\'DASHBOARDS.DISPOSITION\' | translate) + \':\' : \'\'}} {{ item.userDisposition ?\n                item.userDisposition : (\'DASHBOARDS.NO_DISPOSITION_SET\' | translate) }}">\n              {{ item.userDisposition ? (\'DASHBOARDS.DISPOSITION\' | translate) + \':\' : \'\'}} {{ item.userDisposition ?\n              item.userDisposition : (\'DASHBOARDS.NO_DISPOSITION_SET\' | translate) }}\n            </span>\n            <span ng-if="item.channel === \'voice\' && item.userSecondDisposition" class="text-boxed md-background-bg red-fg" title="{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}: {{ item.userSecondDisposition }}">\n              {{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:\n              {{ item.userSecondDisposition }}\n            </span>\n            <span ng-if="item.channel === \'voice\' && item.userThirdDisposition" class="text-boxed md-background-bg red-fg" title="{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}: {{ item.userThirdDisposition }}">\n              {{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:\n              {{ item.userThirdDisposition }}\n            </span>\n            <div flex></div>\n            <md-button ng-if="!vm.tab.spy && vm.user.role === \'agent\' && item.canOpen && item.channel !== \'voice\'" class="md-icon-button" aria-label="go" ng-click="vm.openInteraction(item)">\n              <md-icon md-font-icon="icon-open-in-new" class="s20"></md-icon>\n            </md-button>\n          </div>\n        </md-card>\n      </div>\n    </div>\n\n    <div ng-if="vm.canLoadMoreJourney" layout="row" layout-align="center center" class="ng-scope layout-align-center-center layout-row keep-on-top">\n      <md-button class="md-raised md-accent md-button ng-scope md-default-theme md-ink-ripple" type="button" ng-click="vm.loadMoreJourney()" translate="DASHBOARDS.MORE">\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / TIMELINE ITEM --\x3e\n</md-content>\n\n<div ng-if="!vm.journey || vm.journey.length === 0" layout="row" layout-align="center center">\n  <em translate="DASHBOARDS.NO_DATA_AVAILABLE">No data available</em>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.voice.html",'<md-divider></md-divider>\n\n<md-list flex>\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.TYPE">Type</p>\n      <h4>{{ item.type ? item.type : \'no type\' }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.SOURCE">Source</p>\n      <h4 privacy ng-cloak>{{ item.source ? item.source : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DESTINATION">Destination</p>\n      <h4 privacy ng-cloak>{{ item.destination ? item.destination : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.UNIQUEID">Uniqueid</p>\n      <h4>{{ item.uniqueid ? item.uniqueid : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CALLERID">Caller Id</p>\n      <h4 privacy ng-cloak>{{ item.callerid ? item.callerid : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.STARTEDAT">Started At</p>\n      <h4>{{ item.starttime | date:\'medium\' }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.END_AT">End At</p>\n      <h4>{{ item.endtime | date:\'medium\' }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DURATION">Duration</p>\n      <h4>{{ item.duration ? item.duration : \'--\' }}s</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.NOTE">Note</p>\n      <h4>{{ item.note ? item.note : \'--\' }}</h4>\n    </div>\n  </md-list-item>\n</md-list>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.mail.html",'<div ng-init="item = item || vm.interaction">\n  <md-list-item class="md-2-line" ng-if="item.subject">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.SUBJECT">Subject</p>\n      <h4>{{ item.subject }}</h4>\n    </div>\n  </md-list-item>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.openchannel.html",'<div ng-init="item = item || vm.interaction">\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.VISIBILITY">Visibility</p>\n      <h4 translate="{{ item.threadId ? \'DASHBOARDS.PUBLIC\' : \'DASHBOARDS.PRIVATE\'}}"></h4>\n    </div>\n  </md-list-item>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.html",'\x3c!-- MESSAGES --\x3e\n<div layout="row" ng-repeat="message in vm.messages.rows" class="md-padding message-row" ng-class="vm.getMessagesAlignment(message)">\n  <img ng-if="message.direction ===\'in\'" src="assets/images/avatars/customer.png" class="avatar" />\n  <img ng-if="message.direction ===\'out\' && message.UserId && !message.secret" ng-src="api/users/{{message.UserId}}/avatar" class="avatar" />\n  <img ng-if="message.direction ===\'out\' && message.UserId && message.secret" ng-src="api/users/{{message.UserId}}/avatar" class="avatar" />\n  <img ng-if="message.direction ===\'out\' && !message.UserId" class="avatar" src="assets/images/avatars/robot.png">\n  <md-button ng-if="vm.tab.channel === \'fax\'" class="md-fab md-mini no-margin" aria-label="Download" ng-click="vm.downloadMessage(message)">\n    <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n  </md-button>\n\n  <div class="bubble" ng-class="{\'md-yellow-200-bg\': message.secret}" ng-switch="message.direction">\n    <div ng-if="message.secret">\n      <div class="time secondary-text" layout="row" layout-align="end center">\n        <div layout-padding>\n          <span privacy ng-cloak>{{ vm.getLabelByMessage(message) }}</span>\n          <span> - {{message.createdAt | date: \'medium\'}}</span>\n        </div>\n        <div ng-if="message.id">\n          <md-icon class="s18" md-font-icon="icon-lock"></md-icon>\n        </div>\n      </div>\n    </div>\n    <div ng-if="!message.secret">\n      <div ng-switch-when="in" class="time secondary-text" ng-click="message.Contact && vm.openContact(ev, message.Contact)">\n        <span privacy ng-cloak>{{ vm.getLabelByMessage(message) }}</span>\n        <span> - {{message.createdAt | date: \'medium\'}}</span>\n      </div>\n      <div ng-switch-when="out" class="time secondary-text" layout="row" layout-align="end center">\n        <div layout-padding>\n          <span privacy ng-cloak>{{ vm.getLabelByMessage(message) }}</span>\n          <span> - {{message.createdAt | date: \'medium\'}}</span>\n        </div>\n        <div ng-if="message.id && vm.tab.channel !== \'fax\'">\n          <md-icon ng-if="!message.read" class="s18" md-font-icon="icon-check"></md-icon>\n          <md-icon ng-if="message.read" class="s18" md-font-icon="icon-check-all md-accent"></md-icon>\n        </div>\n        <div ng-if="message.id && vm.tab.channel === \'fax\'">\n          <md-icon ng-if="!message.read && !(message.failMessage )" class="s18" md-font-icon="icon-check"></md-icon>\n          <md-icon ng-if="message.read" class="s18" md-font-icon="icon-check-all md-accent"></md-icon>\n          <span ng-if="!message.read && message.failMessage" class="s18 red-900-fg"> {{ message.failMessage }}</span>\n          <md-icon ng-if="!message.read && message.failMessage" class="s18 red-900-fg" md-font-icon="icon-close md-accent"></md-icon>\n        </div>\n      </div>\n    </div>\n    <div ng-if="message.AttachmentId" layout="row" layout-align="end center">\n      <md-button ng-if="vm.downloadPermissions.attachments" class="md-raised md-accent" ng-click="vm.getAttachment({id: message.AttachmentId, name: vm.htmlToPlaintext(message.body)})">\n        <span>{{vm.htmlToPlaintext(message.body)}}</span>\n        <md-icon md-font-icon="icon-download"></md-icon>\n      </md-button>\n      <div ng-if="!vm.downloadPermissions.attachments" class="disabled-button">\n        <span>{{vm.htmlToPlaintext(message.body)}}</span>\n        <md-icon md-font-icon="icon-download"></md-icon>\n      </div>\n    </div>\n    <div ng-if="!message.AttachmentId" class="message" layout="row" layout-align="end center">\n      <span ng-bind-html="message.body | embed: vm.embedOptions"></span>\n    </div>\n  </div>\n</div>\n\x3c!-- / MESSAGES --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.mail.html",'<div ms-timeline="vm.interactionTimelineOptions" ms-timeline-load-more="vm.loadNextPage()">\n  <div ng-repeat="message in vm.messages.rows track by message.id" ng-init="vm.selectedMailShowSystemMessage[message.id] = false">\n    <md-card ng-if="message.secret" class="md-padding md-yellow-100-bg" layout="column">\n      <div layout="row" layout-align="start center">\n        <img class="avatar" ng-src="api/users/{{message.UserId}}/avatar">\n        <div layout="column">\n          <span class="grey-fg">{{vm.agent.fullname || vm.usersMap[message.UserId]}}</span>\n          <span class="grey-fg">{{message.createdAt | date:\'medium\'}}</span>\n        </div>\n      </div>\n      <div layout="row" layout-align="center center" layout-fill ng-if="message.attach && vm.downloadPermissions.attachments">\n        <div flex>\n          <md-divider></md-divider>\n        </div>\n        <md-menu>\n          <md-button aria-label="attachments" class="md-icon-button" ng-click="vm.getAttachments(message); $mdOpenMenu($event);">\n            <md-tooltip md-direction="bottom"><span translate="MAIL.ATTACHMENTS">Attachments</span>\n            </md-tooltip>\n            <div layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="icon s24"></md-icon>\n              <span>{{message.attach}}</span>\n            </div>\n          </md-button>\n          <md-menu-content width="4">\n            <div layout="column" layout-align="center center" ng-if="!message.attachments">\n              <md-progress-circular md-mode="indeterminate"></md-progress-circular>\n              <span translate="MAIL.ATTACHMENTS">Attachments</span>\n            </div>\n            <md-menu-item ng-if="message.attachments" ng-repeat="attachment in message.attachments">\n              <md-button ng-click="vm.getAttachment(attachment)">\n                {{ attachment.name || (\'attachment-\' + $index) }}</md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n        <div flex>\n          <md-divider></md-divider>\n        </div>\n      </div>\n      <div class="padding-top-5" ng-bind-html-unsafe="message.body"></div>\n    </md-card>\n    <div ng-if="!message.secret">\n      <div layout="row" layout-align="center center" ng-if="message.direction == \'out\' && !message.UserId && !vm.selectedMailShowSystemMessage[message.id]">\n        <md-button class="md-raised blue-grey-300-bg white-fg" ng-click="vm.selectedMailShowSystemMessage[message.id] = !vm.selectedMailShowSystemMessage[message.id]">\n          [{{message.createdAt | date: \'medium\'}}] {{ \'MAIL.SHOW_AUTOREPLY\' | translate }}</md-button>\n      </div>\n      <md-card layout="column" class="md-padding message-row" ng-if="message.direction == \'in\' || (message.direction == \'out\' && (message.UserId || vm.selectedMailShowSystemMessage[message.id]))">\n        <md-content class="mail-content">\n          <div class="info" layout="row" layout-align="space-between start">\n            <div layout="column" layout-align="start start">\n              <div layout="row" layout-align="start start">\n                <div layout="column" layout-align="start start">\n                  <div class="name" ng-click="message.Contact && vm.openContact(ev, message.Contact)">\n                    <strong privacy ng-cloak>{{message.from}}</strong>\n                    <md-icon ng-if="message.attach" md-font-icon="icon-paperclip" class="s16">\n                    </md-icon>\n                  </div>\n                  <div class="name">\n                    <div>{{message.subject}}</div>\n                  </div>\n                  <div class="name" layout="row" layout-align="start center"><span translate="MAIL.TO">To</span>: <span class="padding-left-5 subject text-truncate" privacy ng-cloak>{{ message.originTo || message.to\n                      }}</span>\n                  </div>\n                  <div class="name padding-top-10" layout="row" layout-align="start center" ng-if="message.direction == \'in\' && message.originCc && message.originCc.indexOf(vm.account.email) >= 0">\n                    <em><span class="blue-grey" translate="MAIL.YOU_ARE_REGISTERED_AS_A">You are\n                        registered as a</span> <span class="blue-grey">CC</span></em>\n                  </div>\n                  <div class="name padding-top-10" layout="row" layout-align="start center" ng-if="message.direction == \'in\' && message.bcc && message.bcc.indexOf(vm.account.email) >= 0">\n                    <em><span class="red-fg" translate="MAIL.YOU_ARE_REGISTERED_AS_A">You are\n                        registered as a</span> <span class="red-fg">BCC</span></em>\n                  </div>\n                </div>\n              </div>\n\n              <a class="toggle-details md-accent-color" ng-hide="vm.selectedMailShowDetails[message.id]" ng-click="vm.selectedMailShowDetails[message.id] = !vm.selectedMailShowDetails[message.id]" translate="MAIL.SHOW_DETAILS">\n                Show Details\n              </a>\n              <a class="toggle-details md-accent-color" ng-show="vm.selectedMailShowDetails[message.id]" ng-click="vm.selectedMailShowDetails[message.id] = !vm.selectedMailShowDetails[message.id]" translate="MAIL.HIDE_DETAILS">\n                Hide Details\n              </a>\n              <div ng-show="vm.selectedMailShowDetails[message.id]" class="details" layout="row" layout-align="start start">\n                <div layout="column">\n                  <span class="title" translate="MAIL.DATE">Date:</span>\n                  <span class="title" translate="MAIL.FROM">From:</span>\n                  <span class="title" translate="MAIL.TO">To:</span>\n                  \x3c!-- NOTE: Start retrocompatibility with replyCc 2.0.66 --\x3e\n                  <span class="title" translate="MAIL.CC" ng-if="message.direction === \'in\' && message.originCc">Cc:</span>\n                  <span class="title" translate="MAIL.CC" ng-if="message.direction === \'in\' && !message.originCc && !message.originTo && message.cc">Cc:</span>\n                  <span class="title" translate="MAIL.CC" ng-if="message.direction === \'out\' && message.cc">Cc:</span>\n                  \x3c!-- End retrocompatibility --\x3e\n                  <span class="title" translate="MAIL.BCC" ng-if="message.bcc">Bcc:</span>\n                  <span class="title" translate="MAIL.ACCEPTED" ng-if="message.UserId && message.direction ===\'in\'">Accepted:</span>\n                </div>\n\n                <div layout="column">\n                  <span class="detail">{{message.createdAt | date:\'medium\'}}</span>\n                  <span class="detail" privacy ng-cloak>{{message.from}}</span>\n                  <span class="detail" privacy ng-cloak>{{message.originTo || message.to}}</span>\n                  \x3c!-- NOTE: Start retrocompatibility with replyCc 2.0.66 --\x3e\n                  <span class="detail" ng-if="message.direction === \'in\' && message.originCc" privacy ng-cloak>{{\n                    message.originCc }}</span>\n                  <span class="detail" ng-if="message.direction === \'in\' && !message.originCc && !message.originTo && message.cc" privacy ng-cloak>{{ message.cc }}</span>\n                  <span class="detail" ng-if="message.direction === \'out\' && message.cc" privacy ng-cloak>{{ message.cc\n                    }}</span>\n                  \x3c!-- End retrocompatibility --\x3e\n                  <span class="detail" ng-if="message.bcc" privacy ng-cloak>{{message.bcc}}</span>\n                  <span class="detail" ng-if="message.UserId && message.direction ===\'in\'">{{vm.usersMap[message.UserId]}}</span>\n                </div>\n              </div>\n            </div>\n\n            <div layout="row" layout-align="center center">\n              <div layout="column" layout-align="center end" class="md-padding">\n                <span class="grey-fg" ng-if="message.direction ===\'in\'" privacy>{{message.from.indexOf(vm.contact.email)\n                  >= 0 ? vm.contact.firstName + \' \' + vm.contact.lastName : \'*\' + message.from}}</span>\n                <span class="grey-fg" ng-if="message.direction ===\'out\' && message.UserId">{{vm.agent.fullname ||\n                  vm.usersMap[message.UserId]}}</span>\n                <span class="grey-fg" ng-if="message.direction ===\'out\' && !message.UserId">System</span>\n                <span class="grey-fg">{{message.createdAt | date:\'medium\'}}</span>\n              </div>\n              <img ng-if="message.direction ===\'in\'" ng-src="assets/images/avatars/customer.png" class="avatar" alt="customer" />\n              <img ng-if="message.direction ===\'out\' && message.UserId" class="avatar" ng-src="api/users/{{message.UserId}}/avatar">\n              <img ng-if="message.direction ===\'out\' && !message.UserId" class="avatar" src="assets/images/avatars/robot.png">\n            </div>\n          </div>\n\n          <div layout="row" layout-align="center center" layout-fill>\n            <div flex>\n              <md-divider></md-divider>\n            </div>\n            <div>\n              <div class="interaction-reply-button-container">\n                <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DRAFT">Draft</span>\n                </md-tooltip>\n                <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="draft" ng-disabled="!vm.draft" ng-click="vm.openDraft(message.id)">\n                  <md-icon md-font-icon="icon-pencil-box" class="icon s24"></md-icon>\n                </md-button>\n              </div>\n              <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="reply" ng-click="vm.composeMailInteraction(\'reply\', message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY">Reply</span></md-tooltip>\n                <md-icon md-font-icon="icon-reply" class="icon s24"></md-icon>\n              </md-button>\n              <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="replyAll" ng-click="vm.composeMailInteraction(\'replyAll\', message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY_ALL">Reply All</span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-reply-all" class="icon s24"></md-icon>\n              </md-button>\n              <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="forward" ng-click="vm.composeMailInteraction(\'forward\', message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.FORWARD">Forward</span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-forward" class="icon s24"></md-icon>\n              </md-button>\n              <md-button ng-if="!message.attach && vm.downloadPermissions.interactions" class="md-icon-button" aria-label="forward" ng-click="vm.downloadMessage(message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.DOWNLOAD">Download</span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n              </md-button>\n              <md-menu ng-if="message.attach && vm.downloadPermissions.interactions" class="no-margin" md-position-mode="target-right target">\n                <md-button class="md-icon-button" ng-click="$mdOpenMenu()" aria-label="download">\n                  <md-tooltip md-direction="bottom"><span translate="MAIL.DOWNLOAD">Download</span>\n                  </md-tooltip>\n                  <md-icon md-font-icon="icon-download"></md-icon>\n                </md-button>\n                <md-menu-content width="2">\n                  <md-menu-item ng-if="vm.downloadPermissions.attachments">\n                    <md-button ng-click="vm.downloadMessage(message, true)" translate="MAIL.DOWNLOAD_WITH_ATTACHMENTS">\n                      Download with attachments\n                    </md-button>\n                  </md-menu-item>\n                  <md-menu-item>\n                    <md-button ng-click="vm.downloadMessage(message)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                      Download without attachments\n                    </md-button>\n                  </md-menu-item>\n                </md-menu-content>\n              </md-menu>\n              <md-menu ng-if="message.attach && vm.downloadPermissions.attachments">\n                <md-button aria-label="attachments" class="md-icon-button" ng-click="vm.getAttachments(message); $mdOpenMenu($event);">\n                  <md-tooltip md-direction="bottom"><span translate="MAIL.ATTACHMENTS">Attachments</span></md-tooltip>\n                  <div layout="row" layout-align="start center">\n                    <md-icon md-font-icon="icon-paperclip" class="icon s24"></md-icon>\n                    <span>{{message.attach}}</span>\n                  </div>\n                </md-button>\n                <md-menu-content width="4">\n                  <div layout="column" layout-align="center center" ng-if="!message.attachments">\n                    <md-progress-circular md-mode="indeterminate"></md-progress-circular>\n                    <span translate="MAIL.ATTACHMENTS">Attachments</span>\n                  </div>\n                  <md-menu-item ng-if="message.attachments" ng-repeat="attachment in message.attachments">\n                    <md-button ng-click="vm.getAttachment(attachment)">\n                      {{ attachment.name || (\'attachment-\' + $index) }}</md-button>\n                  </md-menu-item>\n                </md-menu-content>\n              </md-menu>\n            </div>\n            <div flex>\n              <md-divider></md-divider>\n            </div>\n          </div>\n\n          <md-content ng-bind-html-unsafe="message.body"></md-content>\n        </md-content>\n      </md-card>\n    </div>\n    <div ng-hide="!(vm.BTNLoadMore > 0)" layout="row" layout-align="center center" class="ng-scope layout-align-center-center layout-row">\n      <md-button class="md-raised md-accent md-button ng-scope md-default-theme md-ink-ripple" type="button" ng-disabled="!(vm.BTNLoadMore > 0)" ng-click="vm.loadNextPage()" translate="DASHBOARDS.MORE">\n      </md-button>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.loading.html",'<div class="big-circle md-whiteframe-4dp">\n  <md-icon class="s128 md-accent" md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n</div>\n<span class="app-title" translate="DASHBOARDS.WAITING">Waiting</span>\n<span class="hide show-gt-md secondary-text" translate="DASHBOARDS.LOADING_INTERACTION">We are loading the\n  interaction...</span>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.chat.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeChatInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="CHAT.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.fax.html",'<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="reply" ng-click="vm.composeFaxInteraction(\'new\')">\n  <md-tooltip md-direction="bottom"><span translate="FAX.REPLY">Reply</span></md-tooltip>\n  <md-icon md-font-icon="icon-reply" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="Download" ng-click="vm.downloadInteraction(vm.interaction)" ng-if="vm.downloadPermissions.interactions">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n  <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.html",'<div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n  <md-icon md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" class="s20" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n  <div class="padding-left-10" layout="column" layout-align="center start" flex>\n    <div class="font-size-14" layout="row" layout-align="start center" layout-fill>\n      <span>#{{vm.interaction.id}} - {{vm.account.key}}</span>\n      <div layout="row" layout-align="center center" class="p-8">\n        <md-icon ng-if="vm.tab.channel === \'openchannel\' && vm.interaction.threadId" md-font-icon="fas fa-users" class="s16">\n          <md-tooltip><span translate="DASHBOARDS.PUBLIC_INTERACTION">The interaction is public</span></md-tooltip>\n        </md-icon>\n        <md-icon ng-if="vm.interaction.attach" md-font-icon="icon-paperclip" class="s16"></md-icon>\n      </div>\n      <span class="red-fg padding-left-25" ng-if="vm.interaction.closed" translate="DASHBOARDS.CLOSED">CLOSED</span>\n      <span class="green-fg padding-left-25" ng-if="!vm.interaction.closed"><span translate="DASHBOARDS.OPENED">OPENED</span><span ng-if="vm.interaction.substatus"> -\n          {{vm.interaction.substatus}}</span></span>\n      <div layout="row" layout-align="center center" class="blue-grey-300-fg padding-left-40" ng-if="!vm.interaction.closed">\n        <timer start-time="vm.interaction.createdAt"></timer>\n        <md-icon md-font-icon="icon-timelapse" class="s16 padding-left-5"></md-icon>\n      </div>\n    </div>\n    <div class="tags" layout="row" layout-align="start center" ng-if="vm.interaction.Tags.length" ng-class="{\'padding-top-5\': vm.interaction.Tags.length}">\n      <div class="tag margin-right-5" layout="row" layout-align="center center" ng-repeat="tag in vm.interaction.Tags">\n        <div class="tag-color" ng-style="{\'background\': tag.color}"></div>\n        <div class="tag-label">{{tag.name}}</div>\n      </div>\n    </div>\n  </div>\n  <div layout="row" layout-align="end center">\n    <div ng-switch="vm.tab.channel">\n      <div ng-switch-when="mail">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.mail.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="fax">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.fax.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="sms">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.sms.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="whatsapp">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.whatsapp.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="chat">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.chat.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="openchannel">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.openchannel.html\'">\n        </div>\n      </div>\n    </div>\n    <md-menu ng-if="[\'fax\', \'sms\', \'whatsapp\'].indexOf(vm.tab.channel) < 0 && vm.downloadPermissions.interactions" class="no-margin" md-position-mode="target-right target">\n      <md-button class="md-icon-button" ng-click="$mdOpenMenu()" aria-label="download">\n        <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n        <md-icon md-font-icon="icon-download"></md-icon>\n      </md-button>\n      <md-menu-content width="2">\n        <md-menu-item ng-if="vm.downloadPermissions.attachments">\n          <md-button ng-click="vm.downloadInteraction(vm.interaction, true)" translate="DASHBOARDS.DOWNLOAD_WITH_ATTACHMENTS">\n            Download with attachments\n          </md-button>\n        </md-menu-item>\n        <md-menu-item>\n          <md-button ng-click="vm.downloadInteraction(vm.interaction)" translate="DASHBOARDS.DOWNLOAD_WITHOUT_ATTACHMENTS">\n            Download without attachments\n          </md-button>\n        </md-menu-item>\n      </md-menu-content>\n    </md-menu>\n    <md-menu class="no-margin" ng-if="!vm.interaction.disposition" md-position-mode="target-right target">\n      <md-button class="md-icon-button" ng-click="$mdOpenMenu()" aria-label="more">\n        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n      </md-button>\n\n      <md-menu-content width="2">\n\n        <md-menu-item ng-if="vm.tab.channel === \'chat\' && !vm.interaction.closed && !vm.tab.spy && vm.account.vidaooEscalation && vm.account.vidaooApiKey">\n          <md-button ng-click="vm.createVidaooSession(vm.interaction)" translate="DASHBOARDS.VIDAOOSESSION">\n            Start Video Call\n          </md-button>\n        </md-menu-item>\n\n        <md-menu-item>\n          <md-button ng-click="vm.tagInteraction()" translate="DASHBOARDS.TAG">\n            Tag\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="vm.account.queueTransfer || vm.account.agentTransfer">\n          <md-button ng-click="vm.transferLastMessage()" translate="DASHBOARDS.TRANSFER">\n            Transfer\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.interaction.closed && vm.tab.channel == \'mail\' && (vm.subStatuses.rows.length || vm.interaction.substatus != null)">\n          <md-menu>\n            <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.SET_AS">\n              Set as\n            </md-button>\n            <md-menu-content>\n              <md-menu-item ng-if="vm.interaction.substatus != null">\n                <md-button ng-click="vm.setAs(null)" translate="DASHBOARDS.NONE">\n                  None\n                </md-button>\n              </md-menu-item>\n              <md-menu-item ng-repeat="subStatus in vm.subStatuses.rows">\n                <md-button ng-click="vm.setAs(subStatus.name)">\n                  {{subStatus.name}}\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.interaction.closed && vm.tab.channel == \'mail\' && vm.account.markAsUnread">\n          <md-button ng-click="vm.markAsUnread()" translate="DASHBOARDS.MARK_AS_UNREAD">\n            Unread\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.tab.spy && !vm.interaction.closed">\n          <md-button ng-click="vm.disposeInteraction()" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n            Close and Dispose\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.tab.spy && vm.interaction.closed && !vm.interaction.disposition">\n          <md-button ng-click="vm.disposeInteraction(ev)" translate="DASHBOARDS.DISPOSE">\n            Dispose\n          </md-button>\n        </md-menu-item>\n      </md-menu-content>\n    </md-menu>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.mail.html",'<div class="interaction-reply-button-container">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DRAFT">Draft</span></md-tooltip>\n  <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="draft" ng-disabled="!vm.draft" ng-click="vm.openDraft()">\n    <md-icon ng-cloak md-font-icon="icon-pencil-box" class="icon s24" ng-class="vm.draft ? \'red-500-fg\' : \'grey-fg\'"></md-icon>\n  </md-button>\n</div>\n<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="reply" ng-click="vm.composeMailInteraction(\'reply\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY">Reply</span></md-tooltip>\n  <md-icon md-font-icon="icon-reply" class="icon s24"></md-icon>\n</md-button>\n<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="replyAll" ng-click="vm.composeMailInteraction(\'replyAll\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY_ALL">Reply All</span></md-tooltip>\n  <md-icon md-font-icon="icon-reply-all" class="icon s24"></md-icon>\n</md-button>\n<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="forward" ng-click="vm.composeMailInteraction(\'forward\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.FORWARD">Forward</span></md-tooltip>\n  <md-icon md-font-icon="icon-forward" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeMailInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.openchannel.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeOpenchannelInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="OPENCHANNEL.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.sms.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeSmsInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="SMS.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="Download" ng-click="vm.downloadInteraction(vm.interaction)" ng-if="vm.downloadPermissions.interactions">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n  <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.whatsapp.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeWhatsappInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="WHATSAPP.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="Download" ng-click="vm.downloadInteraction(vm.interaction)" ng-if="vm.downloadPermissions.interactions">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n  <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/jscripty/agent.general.jscripty.html",'<md-content class="md-padding" layout="column" layout-align="center center">\n  <div layout="row" layout-align="center center">\n    <span ng-if="!vm.tab.saved" class="text-boxed md-green-bg">\n      <timer start-time="vm.starttime"></timer>\n    </span>\n    <span ng-if="vm.contact" class="text-boxed md-gray-bg font-weight-900">{{vm.contact.firstName}} {{vm.contact.lastName}} {{vm.contact.phone}}</span>\n    <md-button ng-if="vm.showResetButton" ng-click="vm.resetViewer()" md-no-ink class="md-raised md-accent orange-bg">\n      <md-icon md-font-icon="icon-rotate-left" class="icon s16"></md-icon> {{\'JSCRIPTY.RESET_SESSION\' | translate}}\n    </md-button>\n    <md-button ng-if="vm.contact" ng-click="vm.openContact($event, vm.contact)" md-no-ink class="md-raised md-accent" translate="JSCRIPTY.OPEN_CONTACT"></md-button>\n    <md-button ng-if="vm.showIncompleteSubmitButton" ng-click="vm.onSubmit($event, true)" md-no-ink class="md-raised md-accent green-bg" translate="JSCRIPTY.SUBMIT"></md-button>\n  </div>\n  <h1 ng-if="!vm.project.formData"><span translate="JSCRIPTY.PROJECT_NOT_AVAILABLE">Project is not available. Please contact the administrator</span></h1>\n  <mw-form-viewer ng-if="vm.project.formData" form-data="vm.project.formData" response-data="vm.project.responseData" on-submit="vm.onSubmit($event)" template-data="call" api="vm.formViewer"></mw-form-viewer>\n</md-content>'),e.put("app/main/apps/dashboards/views/general/agent/notification/dialog.html",'\x3c!-- <md-toast> --\x3e\n<div class="md-padding" layout="column" layout-align="center center">\n  <span class="md-title">#{{vm.notification.id}} {{vm.notification.title}}</span>\n  <span class="md-subhead" ng-if="vm.notification.queue">{{vm.notification.queue}}</span>\n  <div class="padding-top-5" layout="row">\n    <md-button class="md-raised md-accent" ng-click="vm.accept($event)" translate="DASHBOARDS.ACCEPT">\n      ACCEPT\n    </md-button>\n    <md-button class="md-raised md-warn" ng-click="vm.reject($event)" translate="DASHBOARDS.REJECT">\n      REJECT\n    </md-button>\n  </div>\n</div>\n\x3c!-- </md-toast> --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/popup/agent.general.popup.html",'<md-content class="md-padding" flex>\n  <div ng-if="vm.html" ng-bind-html="vm.html"></div>\n  <h1 ng-if="!vm.html">Template is empty. Please contact the administrator</h1>\n</md-content>'),e.put("app/main/apps/dashboards/views/general/user/chat/user.general.chat.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-hangouts" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-52 line-height-72">\n            {{vm.inbound.abandoned || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ABANDONED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.ABANDONED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDONED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgTalkTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_MANAGED_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_MANAGED_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_MANAGED_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ABANDONED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.ABANDONED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDONED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/dialer/user.general.dialer.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-outgoing" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_MOTION_BULL_STATS">Today Motion Bull STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-timelapse"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{(vm.inbound.talking || 0) + (vm.inbound.pTalking || 0)}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_TALKING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_TALKING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_TALKING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-missed"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-52 line-height-72">\n            {{vm.inbound.outboundDropCallsDayCallersExit || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDONED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDONED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDON_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-outgoing"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.outboundDropCallsDayTimeout || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.DROPPED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.DROPPED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.DROPPED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-dots"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.originated || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ORIGINATED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.ORIGINATED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ORIGINATED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgTalkTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_AVG_TALK_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.outboundanswerRate || 0 |number : 1}}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWER_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWER_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWER_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.outboundAbandonRate || 0}}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDON_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDON_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ABANDON_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.outboundDropRate }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.DROP_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.DROP_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.DROP_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET OUTBOUND --\x3e\n\n\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-outgoing" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_IVR_CAMPAIGNS_STATS">Today IVR campaigns stats</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-dots"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.ivr.originated || 0}}/{{vm.ivr.limitCalls || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ORIGINATED\' | translate | uppercase}}/{{\'DASHBOARDS.LIMITED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.LIMITED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ORIGINATEDLIMITED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET IVR --\x3e'),e.put("app/main/apps/dashboards/views/general/user/fax/user.general.fax.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-deskphone" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/mail/user.general.mail.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-email" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/openchannel/user.general.openchannel.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-google-earth" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/sms/user.general.sms.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-message-text" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/user.general.html",'<div id="dashboard-general" ng-init="vm.onInit()" class="page-layout simple right-sidenav" layout="row">\n  \x3c!-- CENTER --\x3e\n  <div class="center" flex>\n    \x3c!-- CONTENT --\x3e\n    <div class="content">\n      <md-tabs ng-if="vm.hasDashboardPermissions" md-selected="vm.selectedTab" md-dynamic-height>\n        <md-tab ng-if="vm.license.voice" label="{{\'DASHBOARDS.VOICE\' | translate}}" ui-sref="app.dashboards.general.voice">\n          <div ui-view="voice"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.dialer" label="{{\'DASHBOARDS.MOTIONDIALER\' | translate}}" ui-sref="app.dashboards.general.dialer">\n          <div ui-view="dialer"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.chat" label="{{\'DASHBOARDS.CHAT\' | translate}}" ui-sref="app.dashboards.general.chat">\n          <div ui-view="chat"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.mail" label="{{\'DASHBOARDS.MAIL\' | translate}}" ui-sref="app.dashboards.general.mail">\n          <div ui-view="mail"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.messaging" label="{{\'DASHBOARDS.SMS\' | translate}}" ui-sref="app.dashboards.general.sms">\n          <div ui-view="sms"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.openchannel" label="{{\'DASHBOARDS.OPENCHANNEL\' | translate}}" ui-sref="app.dashboards.general.openchannel">\n          <div ui-view="openchannel"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.fax" label="{{\'DASHBOARDS.FAX\' | translate}}" ui-sref="app.dashboards.general.fax">\n          <div ui-view="fax"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.whatsapp" label="{{\'DASHBOARDS.WHATSAPP\' | translate}}" ui-sref="app.dashboards.general.whatsapp">\n          <div ui-view="whatsapp"></div>\n        </md-tab>\n      </md-tabs>\n    </div>\n    \x3c!-- END CONTENT --\x3e\n\n    <md-content ng-if="!vm.hasDashboardPermissions" layout="row" layout-align="space-around center" flex layout-padding layout-wrap>\n      <div layout="column" layout-align="space-around center" flex="50">\n        <span class="font-size-40 text-center">{{ \'DASHBOARDS.WELCOME_TO_MOTION\' | translate }}!</span>\n        <span class="font-size-30 text-center" translate="DASHBOARDS.WELCOME_MESSAGE">Use the left sidebar to\n          navigate through available sections.</span>\n      </div>\n\n      <div layout="column" flex="50">\n        <img src="assets/images/avatars/permissions.png" alt="permissions">\n      </div>\n    </md-content>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/user/voice/user.general.voice.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-incoming" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INBOUND_STATS">Today Inbound STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-timelapse"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_TALKING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_TALKING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_TALKING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-missed"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-52 line-height-72">\n            {{vm.inbound.abandoned || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDONED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDONED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ABANDONED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-incoming"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-timer-sand"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgTalkTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_AVG_TALK_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWER_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWER_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWER_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDON_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDON_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDON_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-dots"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e\n\n\x3c!-- WIDGET OUTBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-outgoing" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_OUTBOUND_STATS">Today Outbound STATS</div>\n  </div>\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-outgoing"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.outbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.outbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OUTBOUND_ANSWERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.OUTBOUND_ANSWERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OUTBOUND_ANSWERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-clock"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{vm.outbound.sumDuration || 0 | secToTime | date:\'HH:mm:ss\'}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOT_DURATION\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.TOT_DURATION_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOT_DURATION\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-division"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{vm.outbound.total ? ((vm.outbound.sumDuration / vm.outbound.total) | number: 0) : 0 | secToTime | date:\'HH:mm:ss\'}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_DURATION\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_DURATION_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_DURATION\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-42 line-height-72">\n            {{vm.outbound.total ? (vm.outbound.answered / vm.outbound.total * 100) : 0 | number: 1}}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OUTBOUND_ANSWER_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.OUTBOUND_ANSWER_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OUTBOUND_ANSWER_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET OUTBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/whatsapp/user.general.whatsapp.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-whatsapp" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/fax/views/faxAccounts/create/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.faxAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="faxAccountForm[\'name\'].$error" ng-show="faxAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.faxAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="faxAccountForm[\'key\'].$error" ng-show="faxAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="FAX.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TRUNK">trunk</label>\n        <md-select name="TrunkId" ng-model="vm.faxAccount.TrunkId" required>\n          <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountForm[\'TrunkId\'].$error" ng-show="faxAccountForm[\'TrunkId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TRUNK_REQUIRED">trunk field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.LOCALSTATIONID">localstationid</label>\n        <input type="text" name="localstationid" ng-model="vm.faxAccount.localstationid" ng-required="true">\n\n        <div class="hint"><span translate="FAX.HELP.LOCALSTATIONID"></span></div>\n        <div ng-messages="faxAccountForm[\'localstationid\'].$error" ng-show="faxAccountForm[\'localstationid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.LOCALSTATIONID_REQUIRED">localstationid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.faxAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountForm[\'ListId\'].$error" ng-show="faxAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.faxAccount.description">\n\n        <div ng-messages="faxAccountForm[\'description\'].$error" ng-show="faxAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFaxAccount" ng-click="vm.saveFaxAccount()" class="send-button md-accent md-raised" ng-disabled="faxAccountForm.$invalid || faxAccountForm.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFaxAccount" ng-click="vm.addNewFaxAccount()" class="send-button md-accent md-raised" ng-disabled="faxAccountForm.$invalid" aria-label="ADD" translate="FAX.ADD_FAXACCOUNT" translate-attr-aria-label="FAX.ADD_FAXACCOUNT">\n          ADD FAXACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFaxAccount" ng-click="vm.deleteFaxAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="FAX.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="FAX.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",'<md-dialog class="faxAccount-dialog" aria-label="faxAccount" ng-init="vm.onInit()">\n  <form name="faxAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="FAX.AGENTADD_FAXACCOUNT">Add Agent to faxAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/agent/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'agent\'].$error" ng-show="faxAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'timeout\'].$error" ng-show="faxAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/close/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'disposition\'].$error" ng-show="faxAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'condition\'].$error" ng-show="faxAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'truepriority\'].$error" ng-show="faxAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'falsepriority\'].$error" ng-show="faxAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'priority\'].$error" ng-show="faxAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/noop/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'value\'].$error" ng-show="faxAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/queue/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'queue\'].$error" ng-show="faxAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'timeout\'].$error" ng-show="faxAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/system/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'command\'].$error" ng-show="faxAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'variable\'].$error" ng-show="faxAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/tag/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'tag\'].$error" ng-show="faxAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/view.html",'<div id="fax-faxAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-faxAccounts-button md-icon-button" aria-label="Go to faxAccounts" ng-click="vm.gotoFaxAccounts()" translate translate-attr-aria-label="FAX.GO_TO_FAXACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="faxAccount-image" hide-xs>\n          <img ng-src="assets/images/business/faxAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.faxAccount.id}}\n            <span ng-if="vm.faxAccount.name">{{vm.faxAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="FAX.CREATED_AT"></span> <span>{{vm.faxAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.faxAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="FAX.GOTO_FAXACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.faxAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="FAX.AGENTADD_FAXACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFaxAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (advancedForm.$invalid) || (dispositionForm.$invalid) || (faxDispositionsForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="FAX.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.faxAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.faxAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="FAX.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.HEADERINFO">headerinfo</label>\n                <input type="text" name="headerinfo" ng-model="vm.faxAccount.headerinfo" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.HEADERINFO"></span></div>\n                <div ng-messages="generalForm[\'headerinfo\'].$error" ng-show="generalForm[\'headerinfo\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.HEADERINFO_REQUIRED">headerinfo field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.TRUNK">trunk</label>\n                <md-select name="TrunkId" ng-model="vm.faxAccount.TrunkId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkId\'].$error" ng-show="generalForm[\'TrunkId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.TRUNK_REQUIRED">trunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.LOCALSTATIONID">localstationid</label>\n                <input type="text" name="localstationid" ng-model="vm.faxAccount.localstationid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.LOCALSTATIONID"></span></div>\n                <div ng-messages="generalForm[\'localstationid\'].$error" ng-show="generalForm[\'localstationid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.LOCALSTATIONID_REQUIRED">localstationid field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.faxAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.faxAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.faxAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="faxAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="FAX.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.faxAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="faxAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.faxAccount.queueTransfer == true" class="md-block">\n                <label translate="FAX.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.faxAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.faxAccount.agentTransfer == true" class="md-block">\n                <label translate="FAX.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.faxAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="FAX.ECM">ECM</label>\n                <md-select name="ecm" ng-model="vm.faxAccount.ecm" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.ECM"></span></div>\n                <div ng-messages="advancedForm[\'ecm\'].$error" ng-show="advancedForm[\'ecm\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.ECM_REQUIRED">ECM field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.MINRATE">minrate</label>\n                <md-select name="minrate" ng-model="vm.faxAccount.minrate" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'2400\'">2400</md-option>\n                  <md-option ng-value="\'4800\'">4800</md-option>\n                  <md-option ng-value="\'7200\'">7200</md-option>\n                  <md-option ng-value="\'9600\'">9600</md-option>\n                  <md-option ng-value="\'12000\'">12000</md-option>\n                  <md-option ng-value="\'14400\'">14400</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.MINRATE"></span></div>\n                <div ng-messages="advancedForm[\'minrate\'].$error" ng-show="advancedForm[\'minrate\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MINRATE_REQUIRED">minrate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.MAXRATE">maxrate</label>\n                <md-select name="maxrate" ng-model="vm.faxAccount.maxrate" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'2400\'">2400</md-option>\n                  <md-option ng-value="\'4800\'">4800</md-option>\n                  <md-option ng-value="\'7200\'">7200</md-option>\n                  <md-option ng-value="\'9600\'">9600</md-option>\n                  <md-option ng-value="\'12000\'">12000</md-option>\n                  <md-option ng-value="\'14400\'">14400</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.MAXRATE"></span></div>\n                <div ng-messages="advancedForm[\'maxrate\'].$error" ng-show="advancedForm[\'maxrate\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MAXRATE_REQUIRED">maxrate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.MODEM">modem</label>\n                <input type="text" name="modem" ng-model="vm.faxAccount.modem" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.MODEM"></span></div>\n                <div ng-messages="advancedForm[\'modem\'].$error" ng-show="advancedForm[\'modem\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MODEM_REQUIRED">modem field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.GATEWAY">gateway</label>\n                <input type="text" name="gateway" ng-model="vm.faxAccount.gateway" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.GATEWAY"></span></div>\n                <div ng-messages="advancedForm[\'gateway\'].$error" ng-show="advancedForm[\'gateway\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.GATEWAY_REQUIRED">gateway field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.FAXDETECT">faxdetect</label>\n                <input type="text" name="faxdetect" ng-model="vm.faxAccount.faxdetect" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.FAXDETECT"></span></div>\n                <div ng-messages="advancedForm[\'faxdetect\'].$error" ng-show="advancedForm[\'faxdetect\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.FAXDETECT_REQUIRED">faxdetect field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.T38TIMEOUT">t38timeout</label>\n                <input type="number" name="t38timeout" ng-model="vm.faxAccount.t38timeout" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.T38TIMEOUT"></span></div>\n                <div ng-messages="advancedForm[\'t38timeout\'].$error" ng-show="advancedForm[\'t38timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.T38TIMEOUT_REQUIRED">t38timeout field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.SIP">SIP</label>\n                <md-select name="tech" ng-model="vm.faxAccount.tech" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'SIP\'">SIP</md-option>\n                  <md-option ng-value="\'IAX\'">IAX</md-option>\n                  <md-option ng-value="\'DADHI\'">DADHI</md-option>\n                  <md-option ng-value="\'KHOMP\'">KHOMP</md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'tech\'].$error" ng-show="advancedForm[\'tech\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.SIP_REQUIRED">SIP field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="faxAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.faxAccount.mandatoryDisposition" class="md-block">\n                <label translate="FAX.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.faxAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="FaxAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.faxAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="faxAccount-detail-form-container faxdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedFaxAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="FAX.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add fax dispositions" translate translate-attr-label="FAX.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="faxAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'FAX.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'FAX.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="FaxAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.faxAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="FAX.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedFaxAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedFaxAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedFaxAccountApps.length}} {{vm_ac.selectedFaxAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedFaxAccountApps($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedFaxAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.faxAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editFaxAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editFaxAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editFaxAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editFaxAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.faxAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="FaxAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.faxAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedFaxAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="FAX.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getFaxAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getFaxAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getFaxAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="FAX.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedFaxAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedFaxAccountInteractions.length}} {{vm_dc.selectedFaxAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedFaxAccountInteractions" csv-label="true" filename="faxAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedFaxAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedFaxAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getFaxAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'FAX.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'FAX.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'FAX.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'FAX.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'FAX.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'FAX.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'FAX.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.faxAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'FAX.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'FAX.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spyfaxInteraction($event, interaction)" translate="FAX.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.faxInteractionDownload(interaction, $event)" translate="FAX.DOWNLOAD_INTERACTION">\n                                Download\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="FAX.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.faxAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="FAX.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.faxAccountInteractions.count}}" md-on-paginate="vm_dc.getFaxAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/fax/views/faxAccounts/faxAccounts.html",'<div id="faxAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-deskphone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="FAX.FAXACCOUNTS">FaxAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="FAX.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFaxAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFaxAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="FAX.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-faxAccounts-count">\n          <span>{{vm.selectedFaxAccounts.length}}</span>\n          <span translate="FAX.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="FAX.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFaxAccounts()" translate="FAX.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFaxAccounts()" translate="FAX.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFaxAccounts" csv-label="true" filename="faxAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFaxAccounts($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FAXACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFaxAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'FAX.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'FAX.KEY\' | translate }}</th>\n                <th md-column md-order-by="TrunkId">{{ \'FAX.TRUNK\' | translate }}</th>\n                <th md-column md-order-by="localstationid">{{ \'FAX.LOCALSTATIONID\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'FAX.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.faxAccounts.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="faxAccount" md-select-id="id" ng-repeat="faxAccount in vm.faxAccounts.rows">\n                <td md-cell ng-if="faxAccount.userpic"><img class="avatar" alt="{{faxAccount.name}}" ng-src="api/users/{{faxAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!faxAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{faxAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="id ">{{faxAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="name ">{{faxAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="key ">{{faxAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="TrunkId ">{{ (vm.trunks | filter : {\'id\':faxAccount.TrunkId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="localstationid ">{{faxAccount.localstationid}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="description ">{{faxAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(faxAccount, $event    )" translate="FAX.EDIT_FAXACCOUNT">\n                          Edit FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(faxAccount, $event    )" translate="FAX.INTERACTIONS_FAXACCOUNT">\n                          Interactions FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(faxAccount, $event    )" translate="FAX.GOTOREALTIME_FAXACCOUNT">\n                          goToRealtime FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(faxAccount, $event    )" translate="FAX.AGENTADD_FAXACCOUNT">\n                          AgentAdd FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(faxAccount, $event    )" translate="FAX.DELETE_FAXACCOUNT">\n                          Delete FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.faxAccounts.count}}" md-on-paginate="vm.getFaxAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FAXACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FAXACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-faxAccount-button" ng-click="vm.createOrEditFaxAccount($event)" aria-label="add faxAccount" translate translate-attr-aria-label="FAX.ADD_FAXACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FAXACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/fax/views/faxQueues/create/dialog.html",'<md-dialog class="faxQueue-dialog" aria-label="New FaxQueue">\n  <form name="faxQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.faxQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newFaxQueue">\n\n        <div class="hint"><span translate="FAX.HELP.NAME"></span></div>\n        <div ng-messages="faxQueueForm[\'name\'].$error" ng-show="faxQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="FAX.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.faxQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="faxQueueForm[\'strategy\'].$error" ng-show="faxQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.faxQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="faxQueueForm[\'timeout\'].$error" ng-show="faxQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.faxQueue.description">\n\n        <div ng-messages="faxQueueForm[\'description\'].$error" ng-show="faxQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFaxQueue" ng-click="vm.saveFaxQueue()" class="send-button md-accent md-raised" ng-disabled="faxQueueForm.$invalid || faxQueueForm.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFaxQueue" ng-click="vm.addNewFaxQueue()" class="send-button md-accent md-raised" ng-disabled="faxQueueForm.$invalid" aria-label="ADD" translate="FAX.ADD_FAXQUEUE" translate-attr-aria-label="FAX.ADD_FAXQUEUE">\n          ADD FAXQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFaxQueue" ng-click="vm.deleteFaxQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="FAX.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="FAX.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",'<md-dialog class="faxQueue-dialog" aria-label="faxQueue" ng-init="vm.onInit()">\n  <form name="faxQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="FAX.AGENTADD_FAXQUEUE">Add Agent to faxQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",'<md-dialog class="faxQueue-dialog" aria-label="faxQueue" ng-init="vm.onInit()">\n  <form name="faxQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="FAX.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxQueues/edit/view.html",'<div id="fax-faxQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-faxQueues-button md-icon-button" aria-label="Go to faxQueues" ng-click="vm.gotoFaxQueues()" translate translate-attr-aria-label="FAX.GO_TO_FAXQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="faxQueue-image" hide-xs>\n          <img ng-src="assets/images/business/faxQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.faxQueue.id}}\n            <span ng-if="vm.faxQueue.name">{{vm.faxQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="FAX.CREATED_AT"></span> <span>{{vm.faxQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.faxQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="FAX.TEAMADD_FAXQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.faxQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="FAX.AGENTADD_FAXQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFaxQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="FAX.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.faxQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="FAX.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="FAX.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.faxQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.faxQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.faxQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/fax/views/faxQueues/faxQueues.html",'<div id="faxQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-deskphone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="FAX.FAXQUEUES">FaxQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="FAX.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFaxQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFaxQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="FAX.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-faxQueues-count">\n          <span>{{vm.selectedFaxQueues.length}}</span>\n          <span translate="FAX.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="FAX.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFaxQueues()" translate="FAX.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFaxQueues()" translate="FAX.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFaxQueues" csv-label="true" filename="faxQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFaxQueues($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FAXQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFaxQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'FAX.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'FAX.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.faxQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="faxQueue" md-select-id="id" ng-repeat="faxQueue in vm.faxQueues.rows">\n                <td md-cell ng-if="faxQueue.userpic"><img class="avatar" alt="{{faxQueue.name}}" ng-src="api/users/{{faxQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!faxQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{faxQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxQueue, ev) : vm.createOrEditFaxQueue($event, faxQueue)" md-cell class="id ">{{faxQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxQueue, ev) : vm.createOrEditFaxQueue($event, faxQueue)" md-cell class="name ">{{faxQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxQueue, ev) : vm.createOrEditFaxQueue($event, faxQueue)" md-cell class="strategy ">{{ vm.arraystrategy[faxQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(faxQueue, $event    )" translate="FAX.EDIT_FAXQUEUE">\n                          Edit FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(faxQueue, $event    )" translate="FAX.TEAMADD_FAXQUEUE">\n                          teamadd FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(faxQueue, $event    )" translate="FAX.AGENTADD_FAXQUEUE">\n                          agentadd FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(faxQueue, $event    )" translate="FAX.DELETE_FAXQUEUE">\n                          Delete FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(faxQueue, $event    )" translate="FAX.GOTOREALTIME_FAXQUEUE">\n                          goToRealtime FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.faxQueues.count}}" md-on-paginate="vm.getFaxQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FAXQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FAXQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-faxQueue-button" ng-click="vm.createOrEditFaxQueue($event)" aria-label="add faxQueue" translate translate-attr-aria-label="FAX.ADD_FAXQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FAXQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/fax/views/realtime/accounts/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="FAX.ACCOUNTS">Accounts</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.vm.getFaxAccounts()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- AGENT TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxAccounts">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate}}</th>\n        <th md-column>{{\'FAX.KEY\' | translate}}</th>\n        <th md-column>{{\'FAX.TOTAL\' | translate}}</th>\n        <th md-column>{{\'FAX.IN\' | translate}}</th>\n        <th md-column>{{\'FAX.OUT\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.faxAccounts">\n        <td md-cell colspan="4">\n          <div layout="row" layout-align="center center">\n            <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="vm.faxAccounts[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n        <td md-cell>{{vm.faxAccounts[value].name}}</td>\n        <td md-cell>{{vm.faxAccounts[value].key}}</td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{(vm.faxAccounts[value].in || 0) + (vm.faxAccounts[value].out || 0)}}</span>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-down-bold blue-fg"></md-icon>\n            </span>\n            <span class="md-capture blue-fg">{{vm.faxAccounts[value].in || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.in">{{vm.faxAccounts[value].lastIn ?  (vm.faxAccounts[value].lastIn | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-up-bold green-fg"></md-icon>\n            </span>\n            <span class="md-capture green-fg">{{vm.faxAccounts[value].out || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.out">{{vm.faxAccounts[value].lastOut ?  (vm.faxAccounts[value].lastOut | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-button ng-click="vm.goToFaxAccount($event, vm.faxAccounts[value])" translate="FAX.EDIT_ACCOUNT">\n                  Edit Account\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getFaxAccounts" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/fax/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="FAX.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n        <th md-column>{{ \'FAX.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'FAX.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'FAX.WAITING\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedIn }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="FAX.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="FAX.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/fax/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.TRUNKS">Trunks</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.ACCOUNTS">Accounts</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/fax/views/realtime/trunks/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="FAX.TRUNKS">Telephones</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getTrunks()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- TRUNKS TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head>\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTrunks">\n        <tr md-row>\n          <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n          <th md-column>{{ \'FAX.TRUNK_STATUS\' | translate }}</th>\n          <th md-column>{{ \'FAX.REGISTRY\' | translate }}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.trunks">\n        <td md-cell colspan="3">\n          <div layout="row" layout-align="center center">\n            <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(id, trunk) in vm.trunks">\n        <td md-cell>{{trunk.name}}</td>\n        <td md-cell>\n          <i ng-class="vm.statusClass[trunk.status.toLowerCase()]">\n            <md-tooltip>{{\'FAX.\' + trunk.status | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.status === \'registered\'" class="text-boxed">{{trunk.address}}</span>\n        </td>\n        <td md-cell>\n          <i ng-if="trunk.registry" ng-class="(trunk.stateRegistry.toLowerCase() === \'registered\') ? \'green-300-fg icon-checkbox-marked-circle\' : \'red-300-fg icon-close-circle\'">\n            <md-tooltip>{{\'FAX.\' + trunk.stateRegistry | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.registry && trunk.host && trunk.port" class="text-boxed">{{trunk.host}}:{{trunk.port}}</span>\n          <span ng-if="!trunk.registry" translate="FAX.NO_REGISTRY">\n            No Registry\n          </span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item>\n                <md-button ng-click="vm.goToTrunk($event, trunk)" translate="FAX.EDIT_TRUNK">\n                  Edit Trunk\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getTrunks" md-page-select></md-table-pagination>\n\x3c!-- / TRUNKS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/help/views/about/about.html",'<div id="maintenance" class="flex-scrollable" layout="column">\n  <div id="maintenance-form-wrapper" layout="column" layout-align="center center">\n    <div id="maintenance-form" class="md-whiteframe-8dp">\n      <div>\n        <img src="/api/settings/1/logo_login" alt="logo_login" />\n      </div>\n\n      <br>\n\n      <div>\n        <div class="info-line">\n          <div class="title">Useful pages</div>\n        </div>\n        <section layout="row" flex layout-sm="column" layout-align="center center" layout-wrap>\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button grey-bg" href="https://wiki.xcallymotion.com/display/XMV" target="_blank">\n              <md-icon md-font-icon="icon-wikipedia"></md-icon>\n            </a>\n            <div class="info"><a href="https://wiki.xcallymotion.com/display/XMV" target="_blank">Wiki</a></div>\n          </div>\n\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button md-accent" href="/apidoc" target="_blank">\n              <md-icon md-font-icon="icon-apple-mobileme"></md-icon>\n            </a>\n            <div class="info"><a href="/apidoc" target="_blank">Motion API</a></div>\n          </div>\n\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button orange-bg" href="http://www.xcally.com/bar/phonebar/Setup.msi" target="_blank">\n              <md-icon md-font-icon="icon-headphones"></md-icon>\n            </a>\n            <div class="info"><a href="https://www.xcally.com/bar/phonebar/Setup.msi" target="_blank">Phonebar Download</a></div>\n          </div>\n\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button green-bg" href="/demo" target="_blank">\n              <md-icon md-font-icon="icon-console"></md-icon>\n            </a>\n            <div class="info"><a href="/demo" target="_blank">Playground</a></div>\n          </div>\n\n        </section>\n\n        <br>\n\n        <div class="info-line" ng-if="!vm.license.custom">\n          <div class="title">Follow us on</div>\n        </div>\n        <section ng-if="!vm.license.custom" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n          <a class="md-fab md-mini md-button blue-900-bg" href="https://www.facebook.com/xcallymotion" target="_blank">\n            <md-icon md-font-icon="icon-facebook"></md-icon>\n          </a>\n\n          <a class="md-fab md-mini md-button" href="https://twitter.com/xcallymotion" target="_blank">\n            <md-icon md-font-icon="icon-twitter"></md-icon>\n          </a>\n          <a class="md-fab md-mini md-button md-warn" href="https://plus.google.com/+Xcally" target="_blank">\n            <md-icon md-font-icon="icon-google-plus"></md-icon>\n          </a>\n          <a class="md-fab md-mini md-button light-blue-800-bg" href="https://www.linkedin.com/company/xcally" target="_blank">\n            <md-icon md-font-icon="icon-linkedin"></md-icon>\n          </a>\n        </section>\n\n        <br ng-if="!vm.license.custom">\n\n        <div class="info-line" ng-if="!vm.license.custom">\n          <div class="title" translate="HELP.CONTACT_US">Contact Us</div>\n        </div>\n        <div class="info-line" ng-if="!vm.license.custom">\n          <div class="info"><a href="mailto:support@xcally.com" target="_top">support@xcally.com</a></div>\n        </div>\n\n        <br ng-if="!vm.license.custom">\n\n        <div class="info">xCALLY Motion <u>{{vm.info.current}}</u> | <a href="https://wiki.xcallymotion.com/display/XMV/Motion+GUI#MotionGUI-Version{{vm.info.current}}" target="_blank">Changelog</a></div>\n\n        <br>\n\n        <div class="info" ng-if="!vm.license.custom">xCALLY© 2016 - 2018 | Powered by Xenialab | <a href="http://www.xcally.com/support/eula-xcally-license-en.pdf" target="_blank">EULA</a></div>\n\n        <br ng-if="!vm.license.custom">\n\n        <div class="info" ng-if="!vm.license.custom"><a href="https://www.xenialab.com/" target="_blank">www.xenialab.com</a> | <a href="https://www.xcallymotion.com/" target="_blank">www.xcallymotion.com</a></div>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/integrations/views/deskAccounts/create/dialog.html",'<md-dialog class="deskAccount-dialog" aria-label="New DeskAccount">\n  <form name="deskAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.deskAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="deskAccountForm[\'name\'].$error" ng-show="deskAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.deskAccount.type" required>\n\n          <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n          <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="deskAccountForm[\'type\'].$error" ng-show="deskAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.deskAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="deskAccountForm[\'remoteUri\'].$error" ng-show="deskAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n        <md-select name="authType" ng-model="vm.deskAccount.authType" required>\n          <md-option ng-value="\'basic\'">Basic</md-option>\n        </md-select>\n        <div ng-messages="deskAccountForm[\'authType\'].$error" ng-show="deskAccountForm[\'authType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.deskAccount.authType == \'basic\'" class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.deskAccount.username" ng-required="true">\n\n        <div ng-messages="deskAccountForm[\'username\'].$error" ng-show="deskAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.deskAccount.authType == \'basic\'">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.deskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="deskAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.deskAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="deskAccountForm[\'serverUrl\'].$error" ng-show="deskAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.deskAccount.description">\n\n        <div ng-messages="deskAccountForm[\'description\'].$error" ng-show="deskAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDeskAccount" ng-click="vm.saveDeskAccount()" class="send-button md-accent md-raised" ng-disabled="deskAccountForm.$invalid || deskAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDeskAccount" ng-click="vm.addNewDeskAccount()" class="send-button md-accent md-raised" ng-disabled="deskAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DESKACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_DESKACCOUNT">\n          ADD DESKACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDeskAccount" ng-click="vm.deleteDeskAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/deskAccounts/deskAccounts.html",'<div id="deskAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.DESKACCOUNTS">DeskAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedDeskAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedDeskAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-deskAccounts-count">\n          <span>{{vm.selectedDeskAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllDeskAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectDeskAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedDeskAccounts" csv-label="true" filename="deskAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedDeskAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- DESKACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedDeskAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getDeskAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.deskAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="deskAccount" md-select-id="id" ng-repeat="deskAccount in vm.deskAccounts.rows">\n                <td md-cell ng-if="deskAccount.userpic"><img class="avatar" alt="{{deskAccount.name}}" ng-src="api/users/{{deskAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!deskAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{deskAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="id ">{{deskAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="name ">{{deskAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="remoteUri ">{{deskAccount.remoteUri}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="username ">{{deskAccount.username}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(deskAccount, $event    )" translate="INTEGRATIONS.EDIT_DESKACCOUNT">\n                          Edit DeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(deskAccount, $event    )" translate="INTEGRATIONS.TEST_DESKACCOUNT">\n                          Test DeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(deskAccount, $event    )" translate="INTEGRATIONS.DELETE_DESKACCOUNT">\n                          Delete DeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.deskAccounts.count}}" md-on-paginate="vm.getDeskAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / DESKACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD DESKACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-deskAccount-button" ng-click="vm.createOrEditDeskAccount($event)" aria-label="add deskAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_DESKACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD DESKACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/deskAccounts/edit/configurations/dialog.html",'<md-dialog class="deskConfiguration-dialog" aria-label="New DeskConfiguration">\n  <form name="deskConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.deskConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="deskConfigurationForm[\'name\'].$error" ng-show="deskConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.deskConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="deskConfigurationForm[\'channel\'].$error" ng-show="deskConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.deskConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="deskConfigurationForm[\'type\'].$error" ng-show="deskConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDeskConfiguration" ng-click="vm.saveDeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="deskConfigurationForm.$invalid || deskConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDeskConfiguration" ng-click="vm.addNewDeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="deskConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DESKCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_DESKCONFIGURATION">\n          ADD DESKCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDeskConfiguration" ng-click="vm.deleteDeskConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",'<md-dialog class="deskAccount-item-dialog" aria-label="New Item">\n  <form name="deskAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="deskAccountItemForm.type.$error" ng-show="deskAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="deskAccountItemForm.content.$error" ng-show="deskAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="deskAccountItemForm.key.$error" ng-show="deskAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="deskAccountItemForm.keyType.$error" ng-show="deskAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="deskAccountItemForm.keyContent.$error" ng-show="deskAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="deskAccountItemForm.variableName.$error" ng-show="deskAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="deskAccountItemForm.customField.$error" ng-show="deskAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="deskAccountItemForm.$invalid || deskAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="deskAccountItemForm.$invalid || deskAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="deskAccountItemForm.type.$error" ng-show="deskAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="deskAccountItemForm.option.$error" ng-show="deskAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="deskAccountItemForm.content.$error" ng-show="deskAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="deskAccountItemForm.variableName.$error" ng-show="deskAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="deskAccountItemForm.type.$error" ng-show="deskAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="deskAccountItemForm.content.$error"\n          ng-show="deskAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="deskAccountItemForm.variableName.$error"\n          ng-show="deskAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/deskAccounts/edit/view.html",'<div id="integrations-deskAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-deskAccounts-button md-icon-button" aria-label="Go to deskAccounts" ng-click="vm.gotoDeskAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_DESKACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="deskAccount-image" hide-xs>\n          <img ng-src="assets/images/business/deskAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.deskAccount.id}}\n            <span ng-if="vm.deskAccount.name">{{vm.deskAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.deskAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveDeskAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="deskAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.deskAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.deskAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n                  <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.deskAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n                <md-select name="authType" ng-model="vm.deskAccount.authType" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'basic\'">Basic</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'authType\'].$error" ng-show="generalForm[\'authType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.deskAccount.authType == \'basic\'" class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.deskAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.deskAccount.authType == \'basic\'">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.deskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.deskAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.deskAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="deskAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="DeskAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.deskAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDeskConfiguration($event)" class="md-icon-button" aria-label="create deskConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="deskConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedDeskConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getDeskConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ deskConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteDeskConfiguration($event, deskConfiguration)" translate="INTEGRATIONS.DELETE_DESKCONFIGURATION">\n                            Delete DeskConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.TAGS">TAGS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-table-container class="md-whiteframe-1dp padding-20">\n                        <md-input-container class="md-block">\n                          <label translate="INTEGRATIONS.TAGS">Tags</label>\n                          <md-select ng-model="vm_cc.selectedTags" ng-change="vm_cc.selectTagsChanged($event)" multiple>\n                            <md-option ng-value="tag.id" ng-repeat="tag in vm_cc.tags">{{ tag.name }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDeskConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/create/dialog.html",'<md-dialog class="dynamics365Account-dialog" aria-label="New Dynamics365Account">\n  <form name="dynamics365AccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.dynamics365Account.name" ng-required="true" autofocus>\n\n        <div ng-messages="dynamics365AccountForm[\'name\'].$error" ng-show="dynamics365AccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.dynamics365Account.modernAuthentication">\n          <span translate="INTEGRATIONS.MODERN_AUTHENTICATION">Modern Authentication</span>\n        </md-switch>\n        \x3c!-- <div class="hint"><span translate="INTEGRATIONS.HELP.MODERN_AUTHENTICATION"></span></div> --\x3e\n      </md-input-container>\n\n      <div ng-if="vm.dynamics365Account.modernAuthentication == false">\n\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.USERNAME">Username</label>\n          <input type="text" name="username" ng-model="vm.dynamics365Account.username" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'username\'].$error" ng-show="dynamics365AccountForm[\'username\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.PASSWORD">Password</label>\n          <input type="password" name="password" ng-model="vm.dynamics365Account.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" ng-required="true">\n          <div ng-messages="dynamics365AccountForm[\'password\'].$error" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.URI">Uri</label>\n          <input type="url" name="remoteUri" ng-model="vm.dynamics365Account.remoteUri" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'remoteUri\'].$error" ng-show="dynamics365AccountForm[\'remoteUri\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n            </div>\n            <div ng-message="url">\n              <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.TENANTID">TenantId</label>\n          <input type="text" name="tenantId" ng-model="vm.dynamics365Account.tenantId" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'tenantId\'].$error" ng-show="dynamics365AccountForm[\'tenantId\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.TENANTID_REQUIRED">TenantId field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n          <input type="text" name="clientId" ng-model="vm.dynamics365Account.clientId" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'clientId\'].$error" ng-show="dynamics365AccountForm[\'clientId\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n          <input type="text" name="clientSecret" ng-model="vm.dynamics365Account.clientSecret" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'clientSecret\'].$error" ng-show="dynamics365AccountForm[\'clientSecret\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n          <input type="url" name="serverUrl" ng-model="vm.dynamics365Account.serverUrl" value="LOCALIP" ng-required="true">\n\n          <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n          <div ng-messages="dynamics365AccountForm[\'serverUrl\'].$error" ng-show="dynamics365AccountForm[\'serverUrl\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n            </div>\n            <div ng-message="url">\n              <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n            </div>\n          </div>\n        </md-input-container>\n\n      </div>\n\n      <div ng-if="vm.dynamics365Account.modernAuthentication == true">\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.CLOUD_PROVIDER">Cloud Provider</label>\n          <md-select ng-model="vm.dynamics365Account.CloudProviderId" placeholder="Cloud Provider connection" ng-required="true">\n            <md-option value="{{provider.id}}" ng-repeat="provider in vm.cloudProviders">{{provider.name}}</md-option>\n          </md-select>\n        </md-input-container>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.dynamics365Account.description">\n\n        <div ng-messages="dynamics365AccountForm[\'description\'].$error" ng-show="dynamics365AccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDynamics365Account" ng-click="vm.saveDynamics365Account()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountForm.$invalid || dynamics365AccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDynamics365Account" ng-click="vm.addNewDynamics365Account()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DYNAMICS365ACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_DYNAMICS365ACCOUNT">\n          ADD DYNAMICS365ACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDynamics365Account" ng-click="vm.deleteDynamics365Account($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/dynamics365Accounts.html",'<div id="dynamics365Accounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.DYNAMICS365ACCOUNTS">Dynamics365Accounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedDynamics365Accounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedDynamics365Accounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-dynamics365Accounts-count">\n          <span>{{vm.selectedDynamics365Accounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllDynamics365Accounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectDynamics365Accounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedDynamics365Accounts" csv-label="true" filename="dynamics365Accounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedDynamics365Accounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- DYNAMICS365ACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedDynamics365Accounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getDynamics365Accounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="modernAuthentication">{{ \'INTEGRATIONS.MODERN_AUTHENTICATION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.dynamics365Accounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="dynamics365Account" md-select-id="id" ng-repeat="dynamics365Account in vm.dynamics365Accounts.rows">\n                <td md-cell ng-if="dynamics365Account.userpic"><img class="avatar" alt="{{dynamics365Account.name}}" ng-src="api/users/{{dynamics365Account.id}}/avatar" /></td>\n                <td md-cell ng-if="!dynamics365Account.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{dynamics365Account.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(dynamics365Account, ev) : vm.createOrEditDynamics365Account($event, dynamics365Account)" md-cell class="id ">{{dynamics365Account.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(dynamics365Account, ev) : vm.createOrEditDynamics365Account($event, dynamics365Account)" md-cell class="name ">{{dynamics365Account.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(dynamics365Account, ev) : vm.createOrEditDynamics365Account($event, dynamics365Account)" md-cell class="modernAuthentication ">\n                  <md-icon md-colors="{color: {{dynamics365Account.modernAuthentication ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{dynamics365Account.modernAuthentication ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(dynamics365Account, $event    )" translate="INTEGRATIONS.EDIT_DYNAMICS365ACCOUNT">\n                          Edit Dynamics365Account\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(dynamics365Account, $event    )" translate="INTEGRATIONS.TEST_DYNAMICS365ACCOUNT">\n                          Test Dynamics365Account\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.crudPermissions === 0 || vm.currentUser.role === \'admin\'">\n\n                        <md-button ng-click="vm.deleteconfirm(dynamics365Account, $event    )" translate="INTEGRATIONS.DELETE_DYNAMICS365ACCOUNT">\n                          Delete Dynamics365Account\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.dynamics365Accounts.count}}" md-on-paginate="vm.getDynamics365Accounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / DYNAMICS365ACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD DYNAMICS365ACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-dynamics365Account-button" ng-click="vm.createOrEditDynamics365Account($event)" aria-label="add dynamics365Account" translate translate-attr-aria-label="INTEGRATIONS.ADD_DYNAMICS365ACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD DYNAMICS365ACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/edit/configurations/dialog.html",'<md-dialog class="dynamics365Configuration-dialog" aria-label="New Dynamics365Configuration">\n  <form name="dynamics365ConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.dynamics365Configuration.name" ng-required="true" autofocus>\n\n        <div ng-messages="dynamics365ConfigurationForm[\'name\'].$error" ng-show="dynamics365ConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.dynamics365Configuration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dynamics365ConfigurationForm[\'channel\'].$error" ng-show="dynamics365ConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.dynamics365Configuration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dynamics365ConfigurationForm[\'type\'].$error" ng-show="dynamics365ConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TICKETTYPE">TicketType</label>\n        <md-select name="ticketType" ng-model="vm.dynamics365Configuration.ticketType" required>\n\n          <md-option ng-value="\'incident\'"> {{ \'INTEGRATIONS.CASE\' | translate }} </md-option>\n\n          <md-option ng-value="\'phonecall\'"> {{ \'INTEGRATIONS.PHONECALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dynamics365ConfigurationForm[\'ticketType\'].$error" ng-show="dynamics365ConfigurationForm[\'ticketType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TICKETTYPE_REQUIRED">TicketType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDynamics365Configuration" ng-click="vm.saveDynamics365Configuration()" class="send-button md-accent md-raised" ng-disabled="dynamics365ConfigurationForm.$invalid || dynamics365ConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDynamics365Configuration" ng-click="vm.addNewDynamics365Configuration()" class="send-button md-accent md-raised" ng-disabled="dynamics365ConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DYNAMICS365CONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_DYNAMICS365CONFIGURATION">\n          ADD DYNAMICS365CONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDynamics365Configuration" ng-click="vm.deleteDynamics365Configuration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",'<md-dialog class="dynamics365Account-item-dialog" aria-label="New Item">\n  <form name="dynamics365AccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="dynamics365AccountItemForm.type.$error" ng-show="dynamics365AccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="dynamics365AccountItemForm.content.$error" ng-show="dynamics365AccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="dynamics365AccountItemForm.key.$error" ng-show="dynamics365AccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="dynamics365AccountItemForm.keyType.$error" ng-show="dynamics365AccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="dynamics365AccountItemForm.keyContent.$error" ng-show="dynamics365AccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="dynamics365AccountItemForm.variableName.$error" ng-show="dynamics365AccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="dynamics365AccountItemForm.customField.$error" ng-show="dynamics365AccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountItemForm.$invalid || dynamics365AccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountItemForm.$invalid || dynamics365AccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="dynamics365AccountItemForm.type.$error" ng-show="dynamics365AccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="dynamics365AccountItemForm.option.$error" ng-show="dynamics365AccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="dynamics365AccountItemForm.content.$error" ng-show="dynamics365AccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="dynamics365AccountItemForm.variableName.$error" ng-show="dynamics365AccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="dynamics365AccountItemForm.type.$error" ng-show="dynamics365AccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="dynamics365AccountItemForm.content.$error"\n          ng-show="dynamics365AccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="dynamics365AccountItemForm.variableName.$error"\n          ng-show="dynamics365AccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/edit/view.html",'<div id="integrations-dynamics365Account" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-dynamics365Accounts-button md-icon-button" aria-label="Go to dynamics365Accounts" ng-click="vm.gotoDynamics365Accounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_DYNAMICS365ACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="dynamics365Account-image" hide-xs>\n          <img ng-src="assets/images/business/dynamics365Accounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.dynamics365Account.id}}\n            <span ng-if="vm.dynamics365Account.name">{{vm.dynamics365Account.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.dynamics365Account.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveDynamics365Account()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="dynamics365Account-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.dynamics365Account.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.dynamics365Account.modernAuthentication">\n                  <span translate="INTEGRATIONS.MODERN_AUTHENTICATION">Modern Authentication</span>\n                </md-switch>\n                \x3c!-- <div class="hint"><span translate="INTEGRATIONS.HELP.MODERN_AUTHENTICATION"></span></div> --\x3e\n              </md-input-container>\n\n              <div ng-if="vm.dynamics365Account.modernAuthentication == true">\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.CLOUD_PROVIDER">Cloud Provider</label>\n                  <md-select ng-model="vm.dynamics365Account.CloudProviderId" placeholder="Cloud Provider connection" ng-required="true">\n                    <md-option value="{{provider.id}}" ng-repeat="provider in vm.cloudProviders.rows">{{provider.name}}</md-option>\n                  </md-select>\n                </md-input-container>\n              </div>\n\n              <div ng-if="vm.dynamics365Account.modernAuthentication == false">\n\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.USERNAME">Username</label>\n                  \x3c!-- <input type="text" name="username" ng-model="vm.dynamics365Account.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit"> --\x3e\n                  <input type="text" name="username" ng-model="vm.dynamics365Account.username" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n                  <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                    </div>\n                  </div>\n                </md-input-container>\n\n\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                  <input type="password" name="password" ng-model="vm.dynamics365Account.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" ng-required="vm.dynamics365Account.modernAuthentication == false">\n                  <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                    </div>\n                    <div ng-message="pattern">\n                      <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                    </div>\n                  </div>\n                </md-input-container>\n\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.URI">Uri</label>\n                  <input type="url" name="remoteUri" ng-model="vm.dynamics365Account.remoteUri" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                    </div>\n                    <div ng-message="url">\n                      <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.TENANTID">TenantId</label>\n                  <input type="text" name="tenantId" ng-model="vm.dynamics365Account.tenantId" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'tenantId\'].$error" ng-show="generalForm[\'tenantId\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.TENANTID_REQUIRED">TenantId field is required</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n                  <input type="text" name="clientId" ng-model="vm.dynamics365Account.clientId" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'clientId\'].$error" ng-show="generalForm[\'clientId\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n                  <input type="text" name="clientSecret" ng-model="vm.dynamics365Account.clientSecret" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'clientSecret\'].$error" ng-show="generalForm[\'clientSecret\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                  <input type="url" name="serverUrl" ng-model="vm.dynamics365Account.serverUrl" value="LOCALIP" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                  <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                    </div>\n                    <div ng-message="url">\n                      <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                    </div>\n                  </div>\n                </md-input-container>\n\n              </div>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.dynamics365Account.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="dynamics365Account-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="Dynamics365AccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.dynamics365Account, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDynamics365Configuration($event)" class="md-icon-button" aria-label="create dynamics365Configuration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="dynamics365Configuration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedDynamics365Configuration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getDynamics365Configuration($index)">\n                    <span class="text-truncate" flex="80">{{ dynamics365Configuration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteDynamics365Configuration($event, dynamics365Configuration)" translate="INTEGRATIONS.DELETE_DYNAMICS365CONFIGURATION">\n                            Delete Dynamics365Configuration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.ADVANCED">ADVANCED</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <div class="dynamics365Account-detail-form-container general md-background-bg">\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="INTEGRATIONS.ADVANCED">ADVANCED</div>\n                        </div>\n                        <form name="vm_cc.advancedForm" novalidate>\n                          <md-input-container class="md-block">\n                            <label translate="INTEGRATIONS.MODULECREATE">Module Create</label>\n                            <md-select name="type" ng-model="vm_cc.dynamics365Configuration.moduleCreate" required>\n                              <md-option ng-value="\'contact\'">{{\'INTEGRATIONS.DYNAMIC365CONTACT\' | translate}}</md-option>\n                              <md-option ng-value="\'nothing\'">{{\'INTEGRATIONS.DYNAMIC365NOTHING\' | translate}}</md-option>\n                            </md-select>\n                            <div ng-messages="vm_cc.advancedForm[\'moduleCreate\'].$error" ng-show="vm_cc.advancedForm[\'moduleCreate\'].$touched" role="alert">\n                              <div ng-message="required">\n                                <span translate="INTEGRATIONS.ERRORS.MODULECREATE_REQUIRED">Type field is required</span>\n                              </div>\n                            </div>\n                          </md-input-container>\n\n\n                          <md-input-container class="md-block">\n                            <md-switch ng-model="vm_cc.dynamics365Configuration.openNewTab">\n                              <span translate="INTEGRATIONS.OPENNEWTAB">Open new tab</span>\n                            </md-switch>\n                          </md-input-container>\n\n\n                          <md-input-container class="md-block">\n                            <label translate="INTEGRATIONS.ADDITIONALSEARCHCONTACT">Additional search contact</label>\n                            <input type="" name="additionalSearchContact" ng-model="vm_cc.dynamics365Configuration.additionalSearchContact" autofocus>\n                          </md-input-container>\n                          <div layout="row" layout-align="end center">\n                            <md-button type="submit" ng-click="vm_cc.saveDynamics365Configuration()" class="send-button md-accent md-raised" ng-disabled="vm_cc.advancedForm.$invalid || vm_cc.advancedForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n                              SAVE\n                            </md-button>\n                          </div>\n                        </form>\n                      </div>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDynamics365Configuration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n          </div>\n\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/create/dialog.html",'<md-dialog class="freshdeskAccount-dialog" aria-label="New FreshdeskAccount">\n  <form name="freshdeskAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.freshdeskAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshdeskAccountForm[\'name\'].$error" ng-show="freshdeskAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.freshdeskAccount.username" ng-required="true">\n\n        <div ng-messages="freshdeskAccountForm[\'username\'].$error" ng-show="freshdeskAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.freshdeskAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="freshdeskAccountForm[\'remoteUri\'].$error" ng-show="freshdeskAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n        <input type="text" name="apiKey" ng-model="vm.freshdeskAccount.apiKey" ng-required="true">\n\n        <div ng-messages="freshdeskAccountForm[\'apiKey\'].$error" ng-show="freshdeskAccountForm[\'apiKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.freshdeskAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="freshdeskAccountForm[\'serverUrl\'].$error" ng-show="freshdeskAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.freshdeskAccount.description">\n\n        <div ng-messages="freshdeskAccountForm[\'description\'].$error" ng-show="freshdeskAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshdeskAccount" ng-click="vm.saveFreshdeskAccount()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountForm.$invalid || freshdeskAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshdeskAccount" ng-click="vm.addNewFreshdeskAccount()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHDESKACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHDESKACCOUNT">\n          ADD FRESHDESKACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshdeskAccount" ng-click="vm.deleteFreshdeskAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/edit/configurations/dialog.html",'<md-dialog class="freshdeskConfiguration-dialog" aria-label="New FreshdeskConfiguration">\n  <form name="freshdeskConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.freshdeskConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshdeskConfigurationForm[\'name\'].$error" ng-show="freshdeskConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.freshdeskConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshdeskConfigurationForm[\'channel\'].$error" ng-show="freshdeskConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.freshdeskConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshdeskConfigurationForm[\'type\'].$error" ng-show="freshdeskConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshdeskConfiguration" ng-click="vm.saveFreshdeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshdeskConfigurationForm.$invalid || freshdeskConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshdeskConfiguration" ng-click="vm.addNewFreshdeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshdeskConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHDESKCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHDESKCONFIGURATION">\n          ADD FRESHDESKCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshdeskConfiguration" ng-click="vm.deleteFreshdeskConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",'<md-dialog class="freshdeskAccount-item-dialog" aria-label="New Item">\n  <form name="freshdeskAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="freshdeskAccountItemForm.type.$error" ng-show="freshdeskAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="freshdeskAccountItemForm.content.$error" ng-show="freshdeskAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="freshdeskAccountItemForm.key.$error" ng-show="freshdeskAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="freshdeskAccountItemForm.keyType.$error" ng-show="freshdeskAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="freshdeskAccountItemForm.keyContent.$error" ng-show="freshdeskAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="freshdeskAccountItemForm.variableName.$error" ng-show="freshdeskAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="freshdeskAccountItemForm.customField.$error" ng-show="freshdeskAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountItemForm.$invalid || freshdeskAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountItemForm.$invalid || freshdeskAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="freshdeskAccountItemForm.type.$error" ng-show="freshdeskAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="freshdeskAccountItemForm.option.$error" ng-show="freshdeskAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="freshdeskAccountItemForm.content.$error" ng-show="freshdeskAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="freshdeskAccountItemForm.variableName.$error" ng-show="freshdeskAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="freshdeskAccountItemForm.type.$error" ng-show="freshdeskAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="freshdeskAccountItemForm.content.$error"\n          ng-show="freshdeskAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="freshdeskAccountItemForm.variableName.$error"\n          ng-show="freshdeskAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/edit/view.html",'<div id="integrations-freshdeskAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-freshdeskAccounts-button md-icon-button" aria-label="Go to freshdeskAccounts" ng-click="vm.gotoFreshdeskAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_FRESHDESKACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="freshdeskAccount-image" hide-xs>\n          <img ng-src="assets/images/business/freshdeskAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.freshdeskAccount.id}}\n            <span ng-if="vm.freshdeskAccount.name">{{vm.freshdeskAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.freshdeskAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFreshdeskAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshdeskAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.freshdeskAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.freshdeskAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.freshdeskAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n                <input type="text" name="apiKey" ng-model="vm.freshdeskAccount.apiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'apiKey\'].$error" ng-show="generalForm[\'apiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.freshdeskAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.freshdeskAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshdeskAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="FreshdeskAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.freshdeskAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshdeskConfiguration($event)" class="md-icon-button" aria-label="create freshdeskConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="freshdeskConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedFreshdeskConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getFreshdeskConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ freshdeskConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteFreshdeskConfiguration($event, freshdeskConfiguration)" translate="INTEGRATIONS.DELETE_FRESHDESKCONFIGURATION">\n                            Delete FreshdeskConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.TAGS">TAGS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-table-container class="md-whiteframe-1dp padding-20">\n                        <md-input-container class="md-block">\n                          <label translate="INTEGRATIONS.TAGS">Tags</label>\n                          <md-select ng-model="vm_cc.selectedTags" ng-change="vm_cc.selectTagsChanged($event)" multiple>\n                            <md-option ng-value="tag.id" ng-repeat="tag in vm_cc.tags">{{ tag.name }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshdeskConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/freshdeskAccounts.html",'<div id="freshdeskAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.FRESHDESKACCOUNTS">FreshdeskAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFreshdeskAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFreshdeskAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-freshdeskAccounts-count">\n          <span>{{vm.selectedFreshdeskAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFreshdeskAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFreshdeskAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFreshdeskAccounts" csv-label="true" filename="freshdeskAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFreshdeskAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FRESHDESKACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFreshdeskAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFreshdeskAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.freshdeskAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="freshdeskAccount" md-select-id="id" ng-repeat="freshdeskAccount in vm.freshdeskAccounts.rows">\n                <td md-cell ng-if="freshdeskAccount.userpic"><img class="avatar" alt="{{freshdeskAccount.name}}" ng-src="api/users/{{freshdeskAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!freshdeskAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{freshdeskAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="id ">{{freshdeskAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="name ">{{freshdeskAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="username ">{{freshdeskAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="remoteUri ">{{freshdeskAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(freshdeskAccount, $event    )" translate="INTEGRATIONS.EDIT_FRESHDESKACCOUNT">\n                          Edit FreshdeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(freshdeskAccount, $event    )" translate="INTEGRATIONS.TEST_FRESHDESKACCOUNT">\n                          Test FreshdeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(freshdeskAccount, $event    )" translate="INTEGRATIONS.DELETE_FRESHDESKACCOUNT">\n                          Delete FreshdeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.freshdeskAccounts.count}}" md-on-paginate="vm.getFreshdeskAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FRESHDESKACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FRESHDESKACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-freshdeskAccount-button" ng-click="vm.createOrEditFreshdeskAccount($event)" aria-label="add freshdeskAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_FRESHDESKACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FRESHDESKACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/create/dialog.html",'<md-dialog class="freshsalesAccount-dialog" aria-label="New FreshsalesAccount">\n  <form name="freshsalesAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.freshsalesAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshsalesAccountForm[\'name\'].$error" ng-show="freshsalesAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.freshsalesAccount.username" ng-required="true">\n\n        <div ng-messages="freshsalesAccountForm[\'username\'].$error" ng-show="freshsalesAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.freshsalesAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="freshsalesAccountForm[\'remoteUri\'].$error" ng-show="freshsalesAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n        <input type="text" name="apiKey" ng-model="vm.freshsalesAccount.apiKey" ng-required="true">\n\n        <div ng-messages="freshsalesAccountForm[\'apiKey\'].$error" ng-show="freshsalesAccountForm[\'apiKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.freshsalesAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="freshsalesAccountForm[\'serverUrl\'].$error" ng-show="freshsalesAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.freshsalesAccount.description">\n\n        <div ng-messages="freshsalesAccountForm[\'description\'].$error" ng-show="freshsalesAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshsalesAccount" ng-click="vm.saveFreshsalesAccount()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountForm.$invalid || freshsalesAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshsalesAccount" ng-click="vm.addNewFreshsalesAccount()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHSALESACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHSALESACCOUNT">\n          ADD FRESHSALESACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshsalesAccount" ng-click="vm.deleteFreshsalesAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/edit/configurations/dialog.html",'<md-dialog class="freshsalesConfiguration-dialog" aria-label="New FreshsalesConfiguration">\n  <form name="freshsalesConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.freshsalesConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshsalesConfigurationForm[\'name\'].$error" ng-show="freshsalesConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.freshsalesConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshsalesConfigurationForm[\'channel\'].$error" ng-show="freshsalesConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.freshsalesConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshsalesConfigurationForm[\'type\'].$error" ng-show="freshsalesConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshsalesConfiguration" ng-click="vm.saveFreshsalesConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshsalesConfigurationForm.$invalid || freshsalesConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshsalesConfiguration" ng-click="vm.addNewFreshsalesConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshsalesConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHSALESCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHSALESCONFIGURATION">\n          ADD FRESHSALESCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshsalesConfiguration" ng-click="vm.deleteFreshsalesConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",'<md-dialog class="freshsalesAccount-item-dialog" aria-label="New Item">\n  <form name="freshsalesAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="freshsalesAccountItemForm.type.$error" ng-show="freshsalesAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="freshsalesAccountItemForm.content.$error" ng-show="freshsalesAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="freshsalesAccountItemForm.key.$error" ng-show="freshsalesAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="freshsalesAccountItemForm.keyType.$error" ng-show="freshsalesAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="freshsalesAccountItemForm.keyContent.$error" ng-show="freshsalesAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="freshsalesAccountItemForm.variableName.$error" ng-show="freshsalesAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="freshsalesAccountItemForm.customField.$error" ng-show="freshsalesAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountItemForm.$invalid || freshsalesAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountItemForm.$invalid || freshsalesAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="freshsalesAccountItemForm.type.$error" ng-show="freshsalesAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="freshsalesAccountItemForm.option.$error" ng-show="freshsalesAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="freshsalesAccountItemForm.content.$error" ng-show="freshsalesAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="freshsalesAccountItemForm.variableName.$error" ng-show="freshsalesAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="freshsalesAccountItemForm.type.$error" ng-show="freshsalesAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="freshsalesAccountItemForm.content.$error"\n          ng-show="freshsalesAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="freshsalesAccountItemForm.variableName.$error"\n          ng-show="freshsalesAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/edit/view.html",'<div id="integrations-freshsalesAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-freshsalesAccounts-button md-icon-button" aria-label="Go to freshsalesAccounts" ng-click="vm.gotoFreshsalesAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_FRESHSALESACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="freshsalesAccount-image" hide-xs>\n          <img ng-src="assets/images/business/freshsalesAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.freshsalesAccount.id}}\n            <span ng-if="vm.freshsalesAccount.name">{{vm.freshsalesAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.freshsalesAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFreshsalesAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshsalesAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.freshsalesAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.freshsalesAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.freshsalesAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n                <input type="text" name="apiKey" ng-model="vm.freshsalesAccount.apiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'apiKey\'].$error" ng-show="generalForm[\'apiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.freshsalesAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.freshsalesAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshsalesAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="FreshsalesAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.freshsalesAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshsalesConfiguration($event)" class="md-icon-button" aria-label="create freshsalesConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="freshsalesConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedFreshsalesConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getFreshsalesConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ freshsalesConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteFreshsalesConfiguration($event, freshsalesConfiguration)" translate="INTEGRATIONS.DELETE_FRESHSALESCONFIGURATION">\n                            Delete FreshsalesConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshsalesConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/freshsalesAccounts.html",'<div id="freshsalesAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.FRESHSALESACCOUNTS">FreshsalesAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFreshsalesAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFreshsalesAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-freshsalesAccounts-count">\n          <span>{{vm.selectedFreshsalesAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFreshsalesAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFreshsalesAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFreshsalesAccounts" csv-label="true" filename="freshsalesAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFreshsalesAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FRESHSALESACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFreshsalesAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFreshsalesAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.freshsalesAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="freshsalesAccount" md-select-id="id" ng-repeat="freshsalesAccount in vm.freshsalesAccounts.rows">\n                <td md-cell ng-if="freshsalesAccount.userpic"><img class="avatar" alt="{{freshsalesAccount.name}}" ng-src="api/users/{{freshsalesAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!freshsalesAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{freshsalesAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="id ">{{freshsalesAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="name ">{{freshsalesAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="username ">{{freshsalesAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="remoteUri ">{{freshsalesAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(freshsalesAccount, $event    )" translate="INTEGRATIONS.EDIT_FRESHSALESACCOUNT">\n                          Edit FreshsalesAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(freshsalesAccount, $event    )" translate="INTEGRATIONS.TEST_FRESHSALESACCOUNT">\n                          Test FreshsalesAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(freshsalesAccount, $event    )" translate="INTEGRATIONS.DELETE_FRESHSALESACCOUNT">\n                          Delete FreshsalesAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.freshsalesAccounts.count}}" md-on-paginate="vm.getFreshsalesAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FRESHSALESACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FRESHSALESACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-freshsalesAccount-button" ng-click="vm.createOrEditFreshsalesAccount($event)" aria-label="add freshsalesAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_FRESHSALESACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FRESHSALESACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/salesforceAccounts/create/dialog.html",'<md-dialog class="salesforceAccount-dialog" aria-label="New SalesforceAccount">\n  <form name="salesforceAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.salesforceAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="salesforceAccountForm[\'name\'].$error" ng-show="salesforceAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.salesforceAccount.type" required>\n\n          <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n          <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceAccountForm[\'type\'].$error" ng-show="salesforceAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.salesforceAccount.username" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'username\'].$error" ng-show="salesforceAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.salesforceAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'remoteUri\'].$error" ng-show="salesforceAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.salesforceAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="salesforceAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n        <input type="text" name="clientId" ng-model="vm.salesforceAccount.clientId" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'clientId\'].$error" ng-show="salesforceAccountForm[\'clientId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n        <input type="text" name="clientSecret" ng-model="vm.salesforceAccount.clientSecret" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'clientSecret\'].$error" ng-show="salesforceAccountForm[\'clientSecret\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.SECURITYTOKEN">SecurityToken</label>\n        <input type="text" name="securityToken" ng-model="vm.salesforceAccount.securityToken" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'securityToken\'].$error" ng-show="salesforceAccountForm[\'securityToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.SECURITYTOKEN_REQUIRED">SecurityToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.salesforceAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="salesforceAccountForm[\'serverUrl\'].$error" ng-show="salesforceAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.salesforceAccount.description">\n\n        <div ng-messages="salesforceAccountForm[\'description\'].$error" ng-show="salesforceAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSalesforceAccount" ng-click="vm.saveSalesforceAccount()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountForm.$invalid || salesforceAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSalesforceAccount" ng-click="vm.addNewSalesforceAccount()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SALESFORCEACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_SALESFORCEACCOUNT">\n          ADD SALESFORCEACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSalesforceAccount" ng-click="vm.deleteSalesforceAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/salesforceAccounts/edit/configurations/dialog.html",'<md-dialog class="salesforceConfiguration-dialog" aria-label="New SalesforceConfiguration">\n  <form name="salesforceConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.salesforceConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="salesforceConfigurationForm[\'name\'].$error" ng-show="salesforceConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.salesforceConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceConfigurationForm[\'channel\'].$error" ng-show="salesforceConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.salesforceConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceConfigurationForm[\'type\'].$error" ng-show="salesforceConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TICKETTYPE">TicketType</label>\n        <md-select name="ticketType" ng-model="vm.salesforceConfiguration.ticketType" required>\n\n          <md-option ng-value="\'Task\'"> {{ \'INTEGRATIONS.TASK\' | translate }} </md-option>\n\n          <md-option ng-value="\'Case\'"> {{ \'INTEGRATIONS.CASE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceConfigurationForm[\'ticketType\'].$error" ng-show="salesforceConfigurationForm[\'ticketType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TICKETTYPE_REQUIRED">TicketType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSalesforceConfiguration" ng-click="vm.saveSalesforceConfiguration()" class="send-button md-accent md-raised" ng-disabled="salesforceConfigurationForm.$invalid || salesforceConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSalesforceConfiguration" ng-click="vm.addNewSalesforceConfiguration()" class="send-button md-accent md-raised" ng-disabled="salesforceConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SALESFORCECONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_SALESFORCECONFIGURATION">\n          ADD SALESFORCECONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSalesforceConfiguration" ng-click="vm.deleteSalesforceConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",'<md-dialog class="salesforceAccount-item-dialog" aria-label="New Item">\n  <form name="salesforceAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="salesforceAccountItemForm.type.$error" ng-show="salesforceAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="salesforceAccountItemForm.content.$error" ng-show="salesforceAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="salesforceAccountItemForm.key.$error" ng-show="salesforceAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="salesforceAccountItemForm.keyType.$error" ng-show="salesforceAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="salesforceAccountItemForm.keyContent.$error" ng-show="salesforceAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="salesforceAccountItemForm.variableName.$error" ng-show="salesforceAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="salesforceAccountItemForm.customField.$error" ng-show="salesforceAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountItemForm.$invalid || salesforceAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountItemForm.$invalid || salesforceAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="salesforceAccountItemForm.type.$error" ng-show="salesforceAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="salesforceAccountItemForm.option.$error" ng-show="salesforceAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="salesforceAccountItemForm.content.$error" ng-show="salesforceAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="salesforceAccountItemForm.variableName.$error" ng-show="salesforceAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="salesforceAccountItemForm.type.$error" ng-show="salesforceAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="salesforceAccountItemForm.content.$error"\n          ng-show="salesforceAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="salesforceAccountItemForm.variableName.$error"\n          ng-show="salesforceAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/salesforceAccounts/edit/view.html",'<div id="integrations-salesforceAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-salesforceAccounts-button md-icon-button" aria-label="Go to salesforceAccounts" ng-click="vm.gotoSalesforceAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_SALESFORCEACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="salesforceAccount-image" hide-xs>\n          <img ng-src="assets/images/business/salesforceAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.salesforceAccount.id}}\n            <span ng-if="vm.salesforceAccount.name">{{vm.salesforceAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.salesforceAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSalesforceAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="salesforceAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.salesforceAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.salesforceAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n                  <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.salesforceAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.salesforceAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.salesforceAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n                <input type="text" name="clientId" ng-model="vm.salesforceAccount.clientId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'clientId\'].$error" ng-show="generalForm[\'clientId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n                <input type="text" name="clientSecret" ng-model="vm.salesforceAccount.clientSecret" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'clientSecret\'].$error" ng-show="generalForm[\'clientSecret\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.SECURITYTOKEN">SecurityToken</label>\n                <input type="text" name="securityToken" ng-model="vm.salesforceAccount.securityToken" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'securityToken\'].$error" ng-show="generalForm[\'securityToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.SECURITYTOKEN_REQUIRED">SecurityToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.salesforceAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.salesforceAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="salesforceAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="SalesforceAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.salesforceAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSalesforceConfiguration($event)" class="md-icon-button" aria-label="create salesforceConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="salesforceConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedSalesforceConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getSalesforceConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ salesforceConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteSalesforceConfiguration($event, salesforceConfiguration)" translate="INTEGRATIONS.DELETE_SALESFORCECONFIGURATION">\n                            Delete SalesforceConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.ADVANCED">\n                        ADVANCED\n                      </span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_SEARCH"></label>\n                        <md-select ng-model="vm_cc.salesforceConfiguration.moduleSearch" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'account_contact_lead\', value: \'Account & Contact & Lead\'}, {key: \'contact_lead\', value: \'Contact & Lead\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}, {key: \'account\', value: \'Account\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_CREATE"></label>\n                        <md-select ng-model="vm_cc.salesforceConfiguration.moduleCreate" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'nothing\', value: \'Nothing\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}, {key: \'account\', value: \'Account\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isLead">\n                        <label translate="INTEGRATIONS.LEADID"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.leadId" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.LEADID"></span></div>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isAccountSearch">\n                        <label translate="INTEGRATIONS.ADDITIONALSEARCHACCOUNT"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.additionalSearchAccount" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.ADDITIONALSEARCHACCOUNT"></span></div>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isContactSearch">\n                        <label translate="INTEGRATIONS.ADDITIONALSEARCHCONTACT"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.additionalSearchContact" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.ADDITIONALSEARCHCONTACT"></span></div>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isLeadSearch">\n                        <label translate="INTEGRATIONS.ADDITIONALSEARCHLEAD"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.additionalSearchLead" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.ADDITIONALSEARCHLEAD"></span></div>\n                      </div>\n\n                      <md-button type="submit" ng-click="vm_cc.saveSalesforceConfiguration()" ng-disabled="!vm_cc.crudPermissions.canEdit" class="send-button md-accent md-raised" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n                        SAVE\n                      </md-button>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSalesforceConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/salesforceAccounts/salesforceAccounts.html",'<div id="salesforceAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.SALESFORCEACCOUNTS">SalesforceAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSalesforceAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSalesforceAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-salesforceAccounts-count">\n          <span>{{vm.selectedSalesforceAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSalesforceAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSalesforceAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSalesforceAccounts" csv-label="true" filename="salesforceAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSalesforceAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SALESFORCEACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSalesforceAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSalesforceAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.salesforceAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="salesforceAccount" md-select-id="id" ng-repeat="salesforceAccount in vm.salesforceAccounts.rows">\n                <td md-cell ng-if="salesforceAccount.userpic"><img class="avatar" alt="{{salesforceAccount.name}}" ng-src="api/users/{{salesforceAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!salesforceAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{salesforceAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="id ">{{salesforceAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="name ">{{salesforceAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="username ">{{salesforceAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="remoteUri ">{{salesforceAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(salesforceAccount, $event    )" translate="INTEGRATIONS.EDIT_SALESFORCEACCOUNT">\n                          Edit SalesforceAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(salesforceAccount, $event    )" translate="INTEGRATIONS.TEST_SALESFORCEACCOUNT">\n                          Test SalesforceAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(salesforceAccount, $event    )" translate="INTEGRATIONS.DELETE_SALESFORCEACCOUNT">\n                          Delete SalesforceAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.salesforceAccounts.count}}" md-on-paginate="vm.getSalesforceAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SALESFORCEACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SALESFORCEACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-salesforceAccount-button" ng-click="vm.createOrEditSalesforceAccount($event)" aria-label="add salesforceAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_SALESFORCEACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SALESFORCEACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/servicenowAccounts/create/dialog.html",'<md-dialog class="servicenowAccount-dialog" aria-label="New ServicenowAccount">\n  <form name="servicenowAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.servicenowAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="servicenowAccountForm[\'name\'].$error" ng-show="servicenowAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.servicenowAccount.username" ng-required="true">\n\n        <div ng-messages="servicenowAccountForm[\'username\'].$error" ng-show="servicenowAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.servicenowAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="servicenowAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.servicenowAccount.email" ng-required="true">\n\n        <div ng-messages="servicenowAccountForm[\'email\'].$error" ng-show="servicenowAccountForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="INTEGRATIONS.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.HOST">Host</label>\n        <input type="url" name="remoteUri" ng-model="vm.servicenowAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="servicenowAccountForm[\'remoteUri\'].$error" ng-show="servicenowAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.servicenowAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="servicenowAccountForm[\'serverUrl\'].$error" ng-show="servicenowAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.servicenowAccount.description">\n\n        <div ng-messages="servicenowAccountForm[\'description\'].$error" ng-show="servicenowAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newServicenowAccount" ng-click="vm.saveServicenowAccount()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountForm.$invalid || servicenowAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newServicenowAccount" ng-click="vm.addNewServicenowAccount()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SERVICENOWACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_SERVICENOWACCOUNT">\n          ADD SERVICENOWACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newServicenowAccount" ng-click="vm.deleteServicenowAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/servicenowAccounts/edit/configurations/dialog.html",'<md-dialog class="servicenowConfiguration-dialog" aria-label="New ServicenowConfiguration">\n  <form name="servicenowConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.servicenowConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="servicenowConfigurationForm[\'name\'].$error" ng-show="servicenowConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.servicenowConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="servicenowConfigurationForm[\'channel\'].$error" ng-show="servicenowConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.servicenowConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="servicenowConfigurationForm[\'type\'].$error" ng-show="servicenowConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newServicenowConfiguration" ng-click="vm.saveServicenowConfiguration()" class="send-button md-accent md-raised" ng-disabled="servicenowConfigurationForm.$invalid || servicenowConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newServicenowConfiguration" ng-click="vm.addNewServicenowConfiguration()" class="send-button md-accent md-raised" ng-disabled="servicenowConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SERVICENOWCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_SERVICENOWCONFIGURATION">\n          ADD SERVICENOWCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newServicenowConfiguration" ng-click="vm.deleteServicenowConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",'<md-dialog class="servicenowAccount-item-dialog" aria-label="New Item">\n  <form name="servicenowAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="servicenowAccountItemForm.type.$error" ng-show="servicenowAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="servicenowAccountItemForm.content.$error" ng-show="servicenowAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="servicenowAccountItemForm.key.$error" ng-show="servicenowAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="servicenowAccountItemForm.keyType.$error" ng-show="servicenowAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="servicenowAccountItemForm.keyContent.$error" ng-show="servicenowAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="servicenowAccountItemForm.variableName.$error" ng-show="servicenowAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="servicenowAccountItemForm.customField.$error" ng-show="servicenowAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountItemForm.$invalid || servicenowAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountItemForm.$invalid || servicenowAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="servicenowAccountItemForm.type.$error" ng-show="servicenowAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="servicenowAccountItemForm.option.$error" ng-show="servicenowAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="servicenowAccountItemForm.content.$error" ng-show="servicenowAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="servicenowAccountItemForm.variableName.$error" ng-show="servicenowAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="servicenowAccountItemForm.type.$error" ng-show="servicenowAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="servicenowAccountItemForm.content.$error"\n          ng-show="servicenowAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="servicenowAccountItemForm.variableName.$error"\n          ng-show="servicenowAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/servicenowAccounts/edit/view.html",'<div id="integrations-servicenowAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-servicenowAccounts-button md-icon-button" aria-label="Go to servicenowAccounts" ng-click="vm.gotoServicenowAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_SERVICENOWACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="servicenowAccount-image" hide-xs>\n          <img ng-src="assets/images/business/servicenowAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.servicenowAccount.id}}\n            <span ng-if="vm.servicenowAccount.name">{{vm.servicenowAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.servicenowAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveServicenowAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="servicenowAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.servicenowAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.servicenowAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.servicenowAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.servicenowAccount.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="INTEGRATIONS.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.HOST">Host</label>\n                <input type="url" name="remoteUri" ng-model="vm.servicenowAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.servicenowAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.servicenowAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="servicenowAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="ServicenowAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.servicenowAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditServicenowConfiguration($event)" class="md-icon-button" aria-label="create servicenowConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="servicenowConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedServicenowConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getServicenowConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ servicenowConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteServicenowConfiguration($event, servicenowConfiguration)" translate="INTEGRATIONS.DELETE_SERVICENOWCONFIGURATION">\n                            Delete ServicenowConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditServicenowConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/servicenowAccounts/servicenowAccounts.html",'<div id="servicenowAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.SERVICENOWACCOUNTS">ServicenowAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedServicenowAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedServicenowAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-servicenowAccounts-count">\n          <span>{{vm.selectedServicenowAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllServicenowAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectServicenowAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedServicenowAccounts" csv-label="true" filename="servicenowAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedServicenowAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SERVICENOWACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedServicenowAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getServicenowAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'INTEGRATIONS.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.HOST\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.servicenowAccounts.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="servicenowAccount" md-select-id="id" ng-repeat="servicenowAccount in vm.servicenowAccounts.rows">\n                <td md-cell ng-if="servicenowAccount.userpic"><img class="avatar" alt="{{servicenowAccount.name}}" ng-src="api/users/{{servicenowAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!servicenowAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{servicenowAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="id ">{{servicenowAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="name ">{{servicenowAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="username ">{{servicenowAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="email ">{{servicenowAccount.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="remoteUri ">{{servicenowAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(servicenowAccount, $event    )" translate="INTEGRATIONS.EDIT_SERVICENOWACCOUNT">\n                          Edit ServicenowAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(servicenowAccount, $event    )" translate="INTEGRATIONS.TEST_SERVICENOWACCOUNT">\n                          Test ServicenowAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.crudPermissions === 0 || vm.currentUser.role === \'admin\'">\n\n                        <md-button ng-click="vm.deleteconfirm(servicenowAccount, $event    )" translate="INTEGRATIONS.DELETE_SERVICENOWACCOUNT">\n                          Delete ServicenowAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.servicenowAccounts.count}}" md-on-paginate="vm.getServicenowAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SERVICENOWACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SERVICENOWACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-servicenowAccount-button" ng-click="vm.createOrEditServicenowAccount($event)" aria-label="add servicenowAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_SERVICENOWACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SERVICENOWACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/create/dialog.html",'<md-dialog class="sugarcrmAccount-dialog" aria-label="New SugarcrmAccount">\n  <form name="sugarcrmAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.sugarcrmAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="sugarcrmAccountForm[\'name\'].$error" ng-show="sugarcrmAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.sugarcrmAccount.username" ng-required="true">\n\n        <div ng-messages="sugarcrmAccountForm[\'username\'].$error" ng-show="sugarcrmAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.sugarcrmAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="sugarcrmAccountForm[\'remoteUri\'].$error" ng-show="sugarcrmAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.sugarcrmAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="sugarcrmAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.sugarcrmAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="sugarcrmAccountForm[\'serverUrl\'].$error" ng-show="sugarcrmAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.sugarcrmAccount.description">\n\n        <div ng-messages="sugarcrmAccountForm[\'description\'].$error" ng-show="sugarcrmAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSugarcrmAccount" ng-click="vm.saveSugarcrmAccount()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountForm.$invalid || sugarcrmAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSugarcrmAccount" ng-click="vm.addNewSugarcrmAccount()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SUGARCRMACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_SUGARCRMACCOUNT">\n          ADD SUGARCRMACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSugarcrmAccount" ng-click="vm.deleteSugarcrmAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/edit/configurations/dialog.html",'<md-dialog class="sugarcrmConfiguration-dialog" aria-label="New SugarcrmConfiguration">\n  <form name="sugarcrmConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.sugarcrmConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="sugarcrmConfigurationForm[\'name\'].$error" ng-show="sugarcrmConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.sugarcrmConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="sugarcrmConfigurationForm[\'channel\'].$error" ng-show="sugarcrmConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.sugarcrmConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="sugarcrmConfigurationForm[\'type\'].$error" ng-show="sugarcrmConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSugarcrmConfiguration" ng-click="vm.saveSugarcrmConfiguration()" class="send-button md-accent md-raised" ng-disabled="sugarcrmConfigurationForm.$invalid || sugarcrmConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSugarcrmConfiguration" ng-click="vm.addNewSugarcrmConfiguration()" class="send-button md-accent md-raised" ng-disabled="sugarcrmConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SUGARCRMCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_SUGARCRMCONFIGURATION">\n          ADD SUGARCRMCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSugarcrmConfiguration" ng-click="vm.deleteSugarcrmConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",'<md-dialog class="sugarcrmAccount-item-dialog" aria-label="New Item">\n  <form name="sugarcrmAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="sugarcrmAccountItemForm.content.$error" ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="sugarcrmAccountItemForm.key.$error" ng-show="sugarcrmAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="sugarcrmAccountItemForm.keyType.$error" ng-show="sugarcrmAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="sugarcrmAccountItemForm.keyContent.$error" ng-show="sugarcrmAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="sugarcrmAccountItemForm.variableName.$error" ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="sugarcrmAccountItemForm.customField.$error" ng-show="sugarcrmAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountItemForm.$invalid || sugarcrmAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountItemForm.$invalid || sugarcrmAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="sugarcrmAccountItemForm.option.$error" ng-show="sugarcrmAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="sugarcrmAccountItemForm.content.$error" ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="sugarcrmAccountItemForm.variableName.$error" ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="sugarcrmAccountItemForm.content.$error"\n          ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="sugarcrmAccountItemForm.variableName.$error"\n          ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/edit/view.html",'<div id="integrations-sugarcrmAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-sugarcrmAccounts-button md-icon-button" aria-label="Go to sugarcrmAccounts" ng-click="vm.gotoSugarcrmAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_SUGARCRMACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="sugarcrmAccount-image" hide-xs>\n          <img ng-src="assets/images/business/sugarcrmAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.sugarcrmAccount.id}}\n            <span ng-if="vm.sugarcrmAccount.name">{{vm.sugarcrmAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.sugarcrmAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSugarcrmAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="sugarcrmAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.sugarcrmAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.sugarcrmAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.sugarcrmAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.sugarcrmAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.sugarcrmAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.sugarcrmAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="sugarcrmAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="SugarcrmAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.sugarcrmAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSugarcrmConfiguration($event)" class="md-icon-button" aria-label="create sugarcrmConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="sugarcrmConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedSugarcrmConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getSugarcrmConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ sugarcrmConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteSugarcrmConfiguration($event, sugarcrmConfiguration)" translate="INTEGRATIONS.DELETE_SUGARCRMCONFIGURATION">\n                            Delete SugarcrmConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSugarcrmConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/sugarcrmAccounts.html",'<div id="sugarcrmAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.SUGARCRMACCOUNTS">SugarcrmAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSugarcrmAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSugarcrmAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-sugarcrmAccounts-count">\n          <span>{{vm.selectedSugarcrmAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSugarcrmAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSugarcrmAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSugarcrmAccounts" csv-label="true" filename="sugarcrmAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSugarcrmAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SUGARCRMACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSugarcrmAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSugarcrmAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.sugarcrmAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="sugarcrmAccount" md-select-id="id" ng-repeat="sugarcrmAccount in vm.sugarcrmAccounts.rows">\n                <td md-cell ng-if="sugarcrmAccount.userpic"><img class="avatar" alt="{{sugarcrmAccount.name}}" ng-src="api/users/{{sugarcrmAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!sugarcrmAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{sugarcrmAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="id ">{{sugarcrmAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="name ">{{sugarcrmAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="username ">{{sugarcrmAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="remoteUri ">{{sugarcrmAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(sugarcrmAccount, $event    )" translate="INTEGRATIONS.EDIT_SUGARCRMACCOUNT">\n                          Edit SugarcrmAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(sugarcrmAccount, $event    )" translate="INTEGRATIONS.TEST_SUGARCRMACCOUNT">\n                          Test SugarcrmAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.deleteconfirm(sugarcrmAccount, $event    )" translate="INTEGRATIONS.DELETE_SUGARCRMACCOUNT">\n                          Delete SugarcrmAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.sugarcrmAccounts.count}}" md-on-paginate="vm.getSugarcrmAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SUGARCRMACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SUGARCRMACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-sugarcrmAccount-button" ng-click="vm.createOrEditSugarcrmAccount($event)" aria-label="add sugarcrmAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_SUGARCRMACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SUGARCRMACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/vtigerAccounts/create/dialog.html",'<md-dialog class="vtigerAccount-dialog" aria-label="New VtigerAccount">\n  <form name="vtigerAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.vtigerAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="vtigerAccountForm[\'name\'].$error" ng-show="vtigerAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.vtigerAccount.description">\n\n        <div ng-messages="vtigerAccountForm[\'description\'].$error" ng-show="vtigerAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.VTIGER_USER_NAME">vTiger_User_Name</label>\n        <input type="text" name="username" ng-model="vm.vtigerAccount.username" ng-required="true">\n\n        <div ng-messages="vtigerAccountForm[\'username\'].$error" ng-show="vtigerAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.VTIGER_USER_NAME_REQUIRED">vTiger_User_Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.ACCESS_KEY">Access_Key</label>\n        <input type="text" name="accessKey" ng-model="vm.vtigerAccount.accessKey" ng-required="true">\n\n        <div ng-messages="vtigerAccountForm[\'accessKey\'].$error" ng-show="vtigerAccountForm[\'accessKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.ACCESS_KEY_REQUIRED">Access_Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.HOST">Host</label>\n        <input type="url" name="remoteUri" ng-model="vm.vtigerAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="vtigerAccountForm[\'remoteUri\'].$error" ng-show="vtigerAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.vtigerAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="vtigerAccountForm[\'serverUrl\'].$error" ng-show="vtigerAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVtigerAccount" ng-click="vm.saveVtigerAccount()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountForm.$invalid || vtigerAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVtigerAccount" ng-click="vm.addNewVtigerAccount()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_VTIGERACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_VTIGERACCOUNT">\n          ADD VTIGERACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVtigerAccount" ng-click="vm.deleteVtigerAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/vtigerAccounts/edit/configurations/dialog.html",'<md-dialog class="vtigerConfiguration-dialog" aria-label="New VtigerConfiguration">\n  <form name="vtigerConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.vtigerConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="vtigerConfigurationForm[\'name\'].$error" ng-show="vtigerConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.vtigerConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="vtigerConfigurationForm[\'channel\'].$error" ng-show="vtigerConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.vtigerConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="vtigerConfigurationForm[\'type\'].$error" ng-show="vtigerConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVtigerConfiguration" ng-click="vm.saveVtigerConfiguration()" class="send-button md-accent md-raised" ng-disabled="vtigerConfigurationForm.$invalid || vtigerConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVtigerConfiguration" ng-click="vm.addNewVtigerConfiguration()" class="send-button md-accent md-raised" ng-disabled="vtigerConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_VTIGERCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_VTIGERCONFIGURATION">\n          ADD VTIGERCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVtigerConfiguration" ng-click="vm.deleteVtigerConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",'<md-dialog class="vtigerAccount-item-dialog" aria-label="New Item">\n  <form name="vtigerAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="vtigerAccountItemForm.content.$error" ng-show="vtigerAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="vtigerAccountItemForm.key.$error" ng-show="vtigerAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="vtigerAccountItemForm.keyType.$error" ng-show="vtigerAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="vtigerAccountItemForm.keyContent.$error" ng-show="vtigerAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="vtigerAccountItemForm.variableName.$error" ng-show="vtigerAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="vtigerAccountItemForm.customField.$error" ng-show="vtigerAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountItemForm.$invalid || vtigerAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountItemForm.$invalid || vtigerAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="vtigerAccountItemForm.option.$error" ng-show="vtigerAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="vtigerAccountItemForm.content.$error" ng-show="vtigerAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="vtigerAccountItemForm.variableName.$error" ng-show="vtigerAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="vtigerAccountItemForm.content.$error"\n          ng-show="vtigerAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="vtigerAccountItemForm.variableName.$error"\n          ng-show="vtigerAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/vtigerAccounts/edit/view.html",'<div id="integrations-vtigerAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-vtigerAccounts-button md-icon-button" aria-label="Go to vtigerAccounts" ng-click="vm.gotoVtigerAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_VTIGERACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="vtigerAccount-image" hide-xs>\n          <img ng-src="assets/images/business/vtigerAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.vtigerAccount.id}}\n            <span ng-if="vm.vtigerAccount.name">{{vm.vtigerAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.vtigerAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVtigerAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="vtigerAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.vtigerAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.vtigerAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.VTIGER_USER_NAME">vTiger_User_Name</label>\n                <input type="text" name="username" ng-model="vm.vtigerAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.VTIGER_USER_NAME_REQUIRED">vTiger_User_Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.ACCESS_KEY">Access_Key</label>\n                <input type="text" name="accessKey" ng-model="vm.vtigerAccount.accessKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'accessKey\'].$error" ng-show="generalForm[\'accessKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.ACCESS_KEY_REQUIRED">Access_Key field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.HOST">Host</label>\n                <input type="url" name="remoteUri" ng-model="vm.vtigerAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.vtigerAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="vtigerAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="VtigerAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.vtigerAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditVtigerConfiguration($event)" class="md-icon-button" aria-label="create vtigerConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="vtigerConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedVtigerConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getVtigerConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ vtigerConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteVtigerConfiguration($event, vtigerConfiguration)" translate="INTEGRATIONS.DELETE_VTIGERCONFIGURATION">\n                            Delete VtigerConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditVtigerConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/vtigerAccounts/vtigerAccounts.html",'<div id="vtigerAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.VTIGERACCOUNTS">VtigerAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVtigerAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVtigerAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-vtigerAccounts-count">\n          <span>{{vm.selectedVtigerAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVtigerAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVtigerAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVtigerAccounts" csv-label="true" filename="vtigerAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVtigerAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VTIGERACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVtigerAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVtigerAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.VTIGER_USER_NAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.HOST\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.vtigerAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="vtigerAccount" md-select-id="id" ng-repeat="vtigerAccount in vm.vtigerAccounts.rows">\n                <td md-cell ng-if="vtigerAccount.userpic"><img class="avatar" alt="{{vtigerAccount.name}}" ng-src="api/users/{{vtigerAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!vtigerAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{vtigerAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="id ">{{vtigerAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="name ">{{vtigerAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="username ">{{vtigerAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="remoteUri ">{{vtigerAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(vtigerAccount, $event    )" translate="INTEGRATIONS.EDIT_VTIGERACCOUNT">\n                          Edit VtigerAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(vtigerAccount, $event    )" translate="INTEGRATIONS.TEST_VTIGERACCOUNT">\n                          Test VtigerAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(vtigerAccount, $event    )" translate="INTEGRATIONS.DELETE_VTIGERACCOUNT">\n                          Delete VtigerAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.vtigerAccounts.count}}" md-on-paginate="vm.getVtigerAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VTIGERACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VTIGERACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-vtigerAccount-button" ng-click="vm.createOrEditVtigerAccount($event)" aria-label="add vtigerAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_VTIGERACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VTIGERACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/zendeskAccounts/create/dialog.html",'<md-dialog class="zendeskAccount-dialog" aria-label="New ZendeskAccount">\n  <form name="zendeskAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.zendeskAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="zendeskAccountForm[\'name\'].$error" ng-show="zendeskAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.zendeskAccount.type" required>\n\n          <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n          <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zendeskAccountForm[\'type\'].$error" ng-show="zendeskAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.zendeskAccount.username" ng-required="true">\n\n        <div ng-messages="zendeskAccountForm[\'username\'].$error" ng-show="zendeskAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.zendeskAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="zendeskAccountForm[\'remoteUri\'].$error" ng-show="zendeskAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n        <md-select name="authType" ng-model="vm.zendeskAccount.authType" required>\n          <md-option ng-value="\'password\'">Password</md-option>\n          <md-option ng-value="\'token\'">Token</md-option>\n        </md-select>\n        <div ng-messages="zendeskAccountForm[\'authType\'].$error" ng-show="zendeskAccountForm[\'authType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.zendeskAccount.authType == \'password\'">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.zendeskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="zendeskAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.zendeskAccount.authType == \'token\'" class="md-block">\n        <label translate="INTEGRATIONS.TOKEN">Token</label>\n        <input type="text" name="token" ng-model="vm.zendeskAccount.token" ng-required="true">\n\n        <div ng-messages="zendeskAccountForm[\'token\'].$error" ng-show="zendeskAccountForm[\'token\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TOKEN_REQUIRED">Token field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.zendeskAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="zendeskAccountForm[\'serverUrl\'].$error" ng-show="zendeskAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.zendeskAccount.description">\n\n        <div ng-messages="zendeskAccountForm[\'description\'].$error" ng-show="zendeskAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZendeskAccount" ng-click="vm.saveZendeskAccount()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountForm.$invalid || zendeskAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZendeskAccount" ng-click="vm.addNewZendeskAccount()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZENDESKACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_ZENDESKACCOUNT">\n          ADD ZENDESKACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZendeskAccount" ng-click="vm.deleteZendeskAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",'<md-dialog class="zendeskAccount-item-dialog" aria-label="New Item">\n  <form name="zendeskAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="zendeskAccountItemForm.type.$error" ng-show="zendeskAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="zendeskAccountItemForm.content.$error" ng-show="zendeskAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="zendeskAccountItemForm.key.$error" ng-show="zendeskAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="zendeskAccountItemForm.keyType.$error" ng-show="zendeskAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="zendeskAccountItemForm.keyContent.$error" ng-show="zendeskAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="zendeskAccountItemForm.variableName.$error" ng-show="zendeskAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="zendeskAccountItemForm.customField.$error" ng-show="zendeskAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountItemForm.$invalid || zendeskAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountItemForm.$invalid || zendeskAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="zendeskAccountItemForm.type.$error" ng-show="zendeskAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="zendeskAccountItemForm.option.$error" ng-show="zendeskAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="zendeskAccountItemForm.content.$error" ng-show="zendeskAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="zendeskAccountItemForm.variableName.$error" ng-show="zendeskAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="zendeskAccountItemForm.type.$error" ng-show="zendeskAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="zendeskAccountItemForm.content.$error"\n          ng-show="zendeskAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="zendeskAccountItemForm.variableName.$error"\n          ng-show="zendeskAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/zendeskAccounts/edit/view.html",'<div id="integrations-zendeskAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-zendeskAccounts-button md-icon-button" aria-label="Go to zendeskAccounts" ng-click="vm.gotoZendeskAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_ZENDESKACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="zendeskAccount-image" hide-xs>\n          <img ng-src="assets/images/business/zendeskAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.zendeskAccount.id}}\n            <span ng-if="vm.zendeskAccount.name">{{vm.zendeskAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.zendeskAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveZendeskAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (zendeskConfigurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zendeskAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.zendeskAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.zendeskAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n                  <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.zendeskAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.zendeskAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n                <md-select name="authType" ng-model="vm.zendeskAccount.authType" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'password\'">Password</md-option>\n                  <md-option ng-value="\'token\'">Token</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'authType\'].$error" ng-show="generalForm[\'authType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.zendeskAccount.authType == \'password\'">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.zendeskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container ng-if="vm.zendeskAccount.authType == \'token\'" class="md-block">\n                <label translate="INTEGRATIONS.TOKEN">Token</label>\n                <input type="text" name="token" ng-model="vm.zendeskAccount.token" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'token\'].$error" ng-show="generalForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TOKEN_REQUIRED">Token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.zendeskAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.zendeskAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zendeskAccount-detail-form-container zendeskconfigurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.ZENDESKCONFIGURATIONS">ZENDESKCONFIGURATIONS</div>\n            </div>\n            <div ng-controller="ZendeskAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.zendeskAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZendeskConfiguration($event)" class="md-icon-button" aria-label="create zendeskConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="zendeskConfiguration in vm_cc.zendeskConfigurations" class="border-top" md-colors="{background: (vm_cc.selectedZendeskConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getZendeskConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ zendeskConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteZendeskConfiguration($event, zendeskConfiguration)" translate="INTEGRATIONS.DELETE_ZENDESKCONFIGURATION">\n                            Delete ZendeskConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.zendeskConfigurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.TAGS">TAGS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-table-container class="md-whiteframe-1dp padding-20">\n                        <md-input-container class="md-block">\n                          <label translate="INTEGRATIONS.TAGS">Tags</label>\n                          <md-select ng-model="vm_cc.selectedTags" ng-change="vm_cc.selectTagsChanged($event)" multiple>\n                            <md-option ng-value="tag.id" ng-repeat="tag in vm_cc.tags">{{ tag.name }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.zendeskConfigurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZendeskConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/zendeskAccounts/edit/zendeskConfigurations/dialog.html",'<md-dialog class="zendeskConfiguration-dialog" aria-label="New ZendeskConfiguration">\n  <form name="zendeskConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.zendeskConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="zendeskConfigurationForm[\'name\'].$error" ng-show="zendeskConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.zendeskConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zendeskConfigurationForm[\'channel\'].$error" ng-show="zendeskConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.zendeskConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zendeskConfigurationForm[\'type\'].$error" ng-show="zendeskConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZendeskConfiguration" ng-click="vm.saveZendeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="zendeskConfigurationForm.$invalid || zendeskConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZendeskConfiguration" ng-click="vm.addNewZendeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="zendeskConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZENDESKCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_ZENDESKCONFIGURATION">\n          ADD ZENDESKCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZendeskConfiguration" ng-click="vm.deleteZendeskConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zendeskAccounts/zendeskAccounts.html",'<div id="zendeskAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.ZENDESKACCOUNTS">ZendeskAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedZendeskAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedZendeskAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-zendeskAccounts-count">\n          <span>{{vm.selectedZendeskAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllZendeskAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectZendeskAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedZendeskAccounts" csv-label="true" filename="zendeskAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedZendeskAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- ZENDESKACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedZendeskAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getZendeskAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.zendeskAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="zendeskAccount" md-select-id="id" ng-repeat="zendeskAccount in vm.zendeskAccounts.rows">\n                <td md-cell ng-if="zendeskAccount.userpic"><img class="avatar" alt="{{zendeskAccount.name}}" ng-src="api/users/{{zendeskAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!zendeskAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{zendeskAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="id ">{{zendeskAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="name ">{{zendeskAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="username ">{{zendeskAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="remoteUri ">{{zendeskAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(zendeskAccount, $event    )" translate="INTEGRATIONS.EDIT_ZENDESKACCOUNT">\n                          Edit ZendeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(zendeskAccount, $event    )" translate="INTEGRATIONS.TEST_ZENDESKACCOUNT">\n                          Test ZendeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(zendeskAccount, $event    )" translate="INTEGRATIONS.DELETE_ZENDESKACCOUNT">\n                          Delete ZendeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.zendeskAccounts.count}}" md-on-paginate="vm.getZendeskAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / ZENDESKACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD ZENDESKACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-zendeskAccount-button" ng-click="vm.createOrEditZendeskAccount($event)" aria-label="add zendeskAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_ZENDESKACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD ZENDESKACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/zohoAccounts/create/dialog.html",'<md-dialog class="zohoAccount-dialog" aria-label="New ZohoAccount">\n  <form name="zohoAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.zohoAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="zohoAccountForm[\'name\'].$error" ng-show="zohoAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.HOST">Host</label>\n        <md-select name="host" ng-model="vm.zohoAccount.host" required>\n          <md-option ng-value="\'zoho.com\'">zoho.com</md-option>\n          <md-option ng-value="\'zoho.eu\'">zoho.eu</md-option>\n        </md-select>\n        <div ng-messages="zohoAccountForm[\'host\'].$error" ng-show="zohoAccountForm[\'host\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.ZONE">Zone</label>\n        <md-select name="zone" ng-model="vm.zohoAccount.zone" required>\n          <md-option ng-value="\'US\'">US</md-option>\n          <md-option ng-value="\'AU\'">AU</md-option>\n          <md-option ng-value="\'EU\'">EU</md-option>\n          <md-option ng-value="\'IN\'">IN</md-option>\n          <md-option ng-value="\'CN\'">CN</md-option>\n        </md-select>\n        <div class="hint"><span translate="INTEGRATIONS.HELP.ZONE"></span></div>\n        <div ng-messages="zohoAccountForm[\'zone\'].$error" ng-show="zohoAccountForm[\'zone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.ZONE_REQUIRED">Zone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n        <input type="text" name="clientId" ng-model="vm.zohoAccount.clientId" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTID"></span></div>\n        <div ng-messages="zohoAccountForm[\'clientId\'].$error" ng-show="zohoAccountForm[\'clientId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n        <input type="text" name="clientSecret" ng-model="vm.zohoAccount.clientSecret" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTSECRET"></span></div>\n        <div ng-messages="zohoAccountForm[\'clientSecret\'].$error" ng-show="zohoAccountForm[\'clientSecret\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CODE">Code</label>\n        <input type="text" name="code" ng-model="vm.zohoAccount.code" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.CODE"></span></div>\n        <div ng-messages="zohoAccountForm[\'code\'].$error" ng-show="zohoAccountForm[\'code\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CODE_REQUIRED">Code field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.zohoAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="zohoAccountForm[\'serverUrl\'].$error" ng-show="zohoAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.zohoAccount.description">\n\n        <div ng-messages="zohoAccountForm[\'description\'].$error" ng-show="zohoAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZohoAccount" ng-click="vm.saveZohoAccount()" class="send-button md-accent md-raised" ng-disabled="zohoAccountForm.$invalid || zohoAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZohoAccount" ng-click="vm.addNewZohoAccount()" class="send-button md-accent md-raised" ng-disabled="zohoAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZOHOACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_ZOHOACCOUNT">\n          ADD ZOHOACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZohoAccount" ng-click="vm.deleteZohoAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zohoAccounts/edit/configurations/dialog.html",'<md-dialog class="zohoConfiguration-dialog" aria-label="New ZohoConfiguration">\n  <form name="zohoConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.zohoConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="zohoConfigurationForm[\'name\'].$error" ng-show="zohoConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.zohoConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zohoConfigurationForm[\'channel\'].$error" ng-show="zohoConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.zohoConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zohoConfigurationForm[\'type\'].$error" ng-show="zohoConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZohoConfiguration" ng-click="vm.saveZohoConfiguration()" class="send-button md-accent md-raised" ng-disabled="zohoConfigurationForm.$invalid || zohoConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZohoConfiguration" ng-click="vm.addNewZohoConfiguration()" class="send-button md-accent md-raised" ng-disabled="zohoConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZOHOCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_ZOHOCONFIGURATION">\n          ADD ZOHOCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZohoConfiguration" ng-click="vm.deleteZohoConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",'<md-dialog class="zohoAccount-item-dialog" aria-label="New Item">\n  <form name="zohoAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="zohoAccountItemForm.type.$error" ng-show="zohoAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="zohoAccountItemForm.content.$error" ng-show="zohoAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="zohoAccountItemForm.key.$error" ng-show="zohoAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="zohoAccountItemForm.keyType.$error" ng-show="zohoAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="zohoAccountItemForm.keyContent.$error" ng-show="zohoAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="zohoAccountItemForm.variableName.$error" ng-show="zohoAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="zohoAccountItemForm.customField.$error" ng-show="zohoAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="zohoAccountItemForm.$invalid || zohoAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="zohoAccountItemForm.$invalid || zohoAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="zohoAccountItemForm.type.$error" ng-show="zohoAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="zohoAccountItemForm.option.$error" ng-show="zohoAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="zohoAccountItemForm.content.$error" ng-show="zohoAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="zohoAccountItemForm.variableName.$error" ng-show="zohoAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="zohoAccountItemForm.type.$error" ng-show="zohoAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="zohoAccountItemForm.content.$error"\n          ng-show="zohoAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="zohoAccountItemForm.variableName.$error"\n          ng-show="zohoAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/zohoAccounts/edit/view.html",'<div id="integrations-zohoAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-zohoAccounts-button md-icon-button" aria-label="Go to zohoAccounts" ng-click="vm.gotoZohoAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_ZOHOACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="zohoAccount-image" hide-xs>\n          <img ng-src="assets/images/business/zohoAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.zohoAccount.id}}\n            <span ng-if="vm.zohoAccount.name">{{vm.zohoAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.zohoAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveZohoAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zohoAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.zohoAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.HOST">Host</label>\n                <md-select name="host" ng-model="vm.zohoAccount.host" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'zoho.com\'">zoho.com</md-option>\n                  <md-option ng-value="\'zoho.eu\'">zoho.eu</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.ZONE">Zone</label>\n                <md-select name="zone" ng-model="vm.zohoAccount.zone" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'US\'">US</md-option>\n                  <md-option ng-value="\'AU\'">AU</md-option>\n                  <md-option ng-value="\'EU\'">EU</md-option>\n                  <md-option ng-value="\'IN\'">IN</md-option>\n                  <md-option ng-value="\'CN\'">CN</md-option>\n                </md-select>\n                <div class="hint"><span translate="INTEGRATIONS.HELP.ZONE"></span></div>\n                <div ng-messages="generalForm[\'zone\'].$error" ng-show="generalForm[\'zone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.ZONE_REQUIRED">Zone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n                <input type="text" name="clientId" ng-model="vm.zohoAccount.clientId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTID"></span></div>\n                <div ng-messages="generalForm[\'clientId\'].$error" ng-show="generalForm[\'clientId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n                <input type="text" name="clientSecret" ng-model="vm.zohoAccount.clientSecret" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTSECRET"></span></div>\n                <div ng-messages="generalForm[\'clientSecret\'].$error" ng-show="generalForm[\'clientSecret\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CODE">Code</label>\n                <input type="text" name="code" ng-model="vm.zohoAccount.code" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.CODE"></span></div>\n                <div ng-messages="generalForm[\'code\'].$error" ng-show="generalForm[\'code\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CODE_REQUIRED">Code field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.REFRESHTOKEN">RefreshToken</label>\n                <input type="text" name="refreshToken" ng-model="vm.zohoAccount.refreshToken" disabled>\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.REFRESHTOKEN"></span></div>\n                <div ng-messages="generalForm[\'refreshToken\'].$error" ng-show="generalForm[\'refreshToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.REFRESHTOKEN_REQUIRED">RefreshToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.zohoAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.zohoAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zohoAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="ZohoAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.zohoAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZohoConfiguration($event)" class="md-icon-button" aria-label="create zohoConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="zohoConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedZohoConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getZohoConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ zohoConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteZohoConfiguration($event, zohoConfiguration)" translate="INTEGRATIONS.DELETE_ZOHOCONFIGURATION">\n                            Delete ZohoConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.ADVANCED">\n                        ADVANCED\n                      </span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_SEARCH"></label>\n                        <md-select ng-model="vm_cc.zohoConfiguration.moduleSearch" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'contact_lead\', value: \'Contact & Lead\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_CREATE"></label>\n                        <md-select ng-model="vm_cc.zohoConfiguration.moduleCreate" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'nothing\', value: \'Nothing\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZohoConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/zohoAccounts/zohoAccounts.html",'<div id="zohoAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.ZOHOACCOUNTS">ZohoAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedZohoAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedZohoAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-zohoAccounts-count">\n          <span>{{vm.selectedZohoAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllZohoAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectZohoAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedZohoAccounts" csv-label="true" filename="zohoAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedZohoAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- ZOHOACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedZohoAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getZohoAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="host">{{ \'INTEGRATIONS.HOST\' | translate }}</th>\n                <th md-column md-order-by="zone">{{ \'INTEGRATIONS.ZONE\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.zohoAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="zohoAccount" md-select-id="id" ng-repeat="zohoAccount in vm.zohoAccounts.rows">\n                <td md-cell ng-if="zohoAccount.userpic"><img class="avatar" alt="{{zohoAccount.name}}" ng-src="api/users/{{zohoAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!zohoAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{zohoAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="id ">{{zohoAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="name ">{{zohoAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="host ">{{ vm.arrayhost[zohoAccount.host].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="zone ">{{ vm.arrayzone[zohoAccount.zone].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(zohoAccount, $event    )" translate="INTEGRATIONS.EDIT_ZOHOACCOUNT">\n                          Edit ZohoAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(zohoAccount, $event    )" translate="INTEGRATIONS.TEST_ZOHOACCOUNT">\n                          Test ZohoAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(zohoAccount, $event    )" translate="INTEGRATIONS.DELETE_ZOHOACCOUNT">\n                          Delete ZohoAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.zohoAccounts.count}}" md-on-paginate="vm.getZohoAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / ZOHOACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD ZOHOACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-zohoAccount-button" ng-click="vm.createOrEditZohoAccount($event)" aria-label="add zohoAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_ZOHOACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD ZOHOACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/jscripty/views/projects/create/dialog.html",'<md-dialog class="project-dialog" aria-label="New Project">\n  <form name="projectForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="JSCRIPTY.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.project.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newProject">\n\n        <div class="hint"><span translate="JSCRIPTY.HELP.NAME"></span></div>\n        <div ng-messages="projectForm[\'name\'].$error" ng-show="projectForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="JSCRIPTY.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="JSCRIPTY.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="JSCRIPTY.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.project.description">\n\n        <div ng-messages="projectForm[\'description\'].$error" ng-show="projectForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="JSCRIPTY.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newProject" ng-click="vm.saveProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid || projectForm.$pristine" aria-label="SAVE" translate="JSCRIPTY.SAVE" translate-attr-aria-label="JSCRIPTY.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newProject" ng-click="vm.addNewProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid" aria-label="ADD" translate="JSCRIPTY.ADD_PROJECT" translate-attr-aria-label="JSCRIPTY.ADD_PROJECT">\n          ADD PROJECT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newProject" ng-click="vm.deleteProject($event)" aria-label="DELETE" translate translate-attr-aria-label="JSCRIPTY.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="JSCRIPTY.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/jscripty/views/projects/edit/clone/clone.html",'<md-dialog class="project-dialog" aria-label="Clone Project">\n  <form name="projectForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="JSCRIPTY.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.project.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newProject">\n\n        <div class="hint"><span translate="JSCRIPTY.HELP.NAME"></span></div>\n        <div ng-messages="projectForm[\'name\'].$error" ng-show="projectForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="JSCRIPTY.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="JSCRIPTY.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid" aria-label="CLONE" translate="JSCRIPTY.CLONE_PROJECT" translate-attr-aria-label="JSCRIPTY.CLONE_PROJECT">\n        CLONE PROJECT\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",'<md-dialog class="session-dialog" aria-label="New Session">\n  <form name="sessionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <md-list>\n        <md-subheader class="md-no-sticky">\n          <div class="margin-bottom-5"><span translate="JSCRIPTY.ANSWERS">Answers</span></div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.STARTTIME" class="ng-scope font-weight-700">Start Time</span>: <span class="ng-binding">{{vm.session.starttime | date:\'medium\'}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.MEMBERNAME" class="ng-scope font-weight-700">Member Name</span>: <span class="ng-binding">{{vm.session.membername}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.PROJECT" class="ng-scope font-weight-700">Project</span>: <span class="ng-binding">{{vm.project.name}}</span>\n          </div>\n        </md-subheader>\n        <md-list-item ng-if="vm.questions.rows.length" class="md-2-line contact-item" ng-repeat="question in vm.questions.rows">\n          <div class="md-list-item-text compact">\n            <h3>{{$index+1}}. {{question.question}}</h3>\n            <p>{{question.answer}}</p>\n          </div>\n          <md-divider ng-if="!$last"></md-divider>\n        </md-list-item>\n        <md-list-item ng-if="!vm.questions.rows.length" class="md-2-line contact-item">\n          <div class="md-list-item-text compact">\n            <h3><span class="text-boxed-light" translate="JSCRIPTY.NO_RESULTS_AVAILABLE">No results available</span></h3>\n          </div>\n        </md-list-item>\n      </md-list>\n\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/jscripty/views/projects/edit/view.html",'<div id="jscripty-project" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-projects-button md-icon-button" aria-label="Go to projects" ng-click="vm.gotoProjects()" translate translate-attr-aria-label="JSCRIPTY.GO_TO_PROJECTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="project-image" hide-xs>\n          <img ng-src="assets/images/business/projects.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.project.id}}\n            <span ng-if="vm.project.name">{{vm.project.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.CREATED_AT"></span> <span>{{vm.project.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.project, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="JSCRIPTY.CLONE_PROJECT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveProject()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (builderForm.$invalid) || (previewForm.$invalid) || (sessionsForm.$invalid) || (answersForm.$invalid)" translate="JSCRIPTY.SAVE" translate-attr-aria-label="JSCRIPTY.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="JSCRIPTY.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="JSCRIPTY.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.project.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="JSCRIPTY.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="JSCRIPTY.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="JSCRIPTY.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.project.enableUncompleteSave" aria-label="EnableUncompleteSave" ng-disabled="!vm.crudPermissions.canEdit"><span translate="JSCRIPTY.ENABLEUNCOMPLETESAVE">EnableUncompleteSave</span></md-switch>\n                <div class="hint"><span translate="JSCRIPTY.HELP.ENABLEUNCOMPLETESAVE"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.project.sendUnpauseOnSubmit" aria-label="SendUnpauseOnSubmit" ng-disabled="!vm.crudPermissions.canEdit"><span translate="JSCRIPTY.SENDUNPAUSEONSUBMIT">SendUnpauseOnSubmit</span></md-switch>\n                <div class="hint"><span translate="JSCRIPTY.HELP.SENDUNPAUSEONSUBMIT"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="JSCRIPTY.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.project.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="JSCRIPTY.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.BUILDER">BUILDER</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container builder md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ProjectBuilderController as vm_bc" ng-init="vm_bc.init(vm.project)">\n              <mw-form-builder ng-if="vm_bc.project.formData" form-data="vm_bc.project.formData" options="vm_bc.optionsBuilder" read-only="false"></mw-form-builder>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.PREVIEW">PREVIEW</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container preview md-background-bg md-whiteframe-1dp">\n            <div layout="column" layout-align="center" ng-controller="ProjectViewerController as vm_vc" ng-init="vm_vc.init(vm.project)">\n              <div layout="row" layout-align="center">\n                <md-button class="md-raised md-accent" aria-label="Reset" ng-click="vm_vc.resetViewer()">\n                  Reset\n                </md-button>\n              </div>\n              <mw-form-viewer ng-if="vm_vc.project.formData" form-data="vm_vc.project.formData" response-data="vm_vc.responseData" on-submit="vm_vc.onSubmit($event)" api="vm_vc.formViewer"></mw-form-viewer>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.SESSIONS">SESSIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container sessions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ProjectSessionsController as vm_dc" ng-init="vm_dc.init(vm.project, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedProjectSessions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="JSCRIPTY.SESSIONS">Sessions</span>\n                  <ms-search-bar on-search="vm_dc.getProjectSessions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedProjectSessions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedProjectSessions.length}} {{vm_dc.selectedProjectSessions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedProjectSessions" csv-label="true" filename="projects.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedProjectSessions($event)" aria-label="delete selected" translate translate-attr-label="JSCRIPTY.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedProjectSessions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getProjectSessions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'JSCRIPTY.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'JSCRIPTY.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'JSCRIPTY.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="membername">\n                        {{ \'JSCRIPTY.MEMBERNAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'JSCRIPTY.CALLERIDNUM\' | translate }}\n                      </th>\n                      <th md-column md-order-by="completed">\n                        {{ \'JSCRIPTY.COMPLETE\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="session" md-select-id="id" ng-repeat="session in vm_dc.projectSessions.rows">\n                      <td md-cell>\n                        {{session.id}}\n                      </td>\n                      <td md-cell>\n                        {{ session.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ session.endtime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{session.membername}}\n                      </td>\n                      <td md-cell>\n                        {{session.calleridnum}}\n                      </td>\n                      <td md-cell class="completed ">\n                        <md-icon md-colors="{color: {{session.completed ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{session.completed? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="JSCRIPTY.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.showQuestionsProjectSession($event, session)" translate="JSCRIPTY.SHOW_QUESTIONS_SESSION">\n                                Results Session\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(session, $event)" translate="JSCRIPTY.DELETE_SESSION">\n                                Delete Session\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.projectSessions.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="JSCRIPTY.NO_SESSION_AVAILABLE">No session available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'JSCRIPTY.PAGE\' | translate}}:\', rowsPerPage: \'{{\'JSCRIPTY.ROWSPERPAGE\' | translate}}:\', of: \'{{\'JSCRIPTY.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.projectSessions.count}}" md-on-paginate="vm_dc.getProjectSessions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.ANSWERS">ANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container answers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ProjectAnswersController as vm_an" ng-init="vm_an.init(vm.project, vm.userProfile)">\n              <div class="pb-16" layout="row">\n                <div class="h2 secondary-text" translate="JSCRIPTY.ANSWERS" flex>Answers</div>\n                <div layout="row" layout-align="space-between center" flex>\n                  <md-date-range localization-map="vm_an.localizationMap" ng-model="vm_an.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm_an.getAnswers()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                  <md-button type="button" ng-if="vm_an.currentUser.role === \'admin\' || vm_an.userProfile.downloadJscriptySessions" ng-disabled="!vm_an.answers" ng-click="vm_an.getSummary($event)" class="md-accent md-raised md-button ng-scope md-default-theme md-ink-ripple md-green-500-bg md-icon-button" title="{{\'JSCRIPTY.EXPORT_TO_CSV\' | translate}}">\n                    <md-icon md-font-icon="icon-file-excel" class="md-default-theme md-font material-icons icon-file-excel"></md-icon>\n                  </md-button>\n                </div>\n              </div>\n              <div layout="row">\n                <md-card class="md-whiteframe-1dp" ng-if="vm_an.answers && vm_an.hasIdAnswers" flex>\n                  <md-list>\n                    <md-list-item class="md-2-line contact-item" ng-repeat="(key, question) in vm_an.answers">\n                      <div class="md-list-item-text compact" layout-padding>\n                        <h3>{{question.question}}</h3>\n                        <md-table-container>\n                          <table md-table>\n                            <thead md-head>\n                              <tr md-row>\n                                <th md-column></th>\n                                <th md-column>#</th>\n                                <th md-column>%</th>\n                              </tr>\n                            </thead>\n                            <tbody md-body>\n                              <tr md-row ng-repeat="(key, value) in question.answers">\n                                <td md-cell>{{key}}</td>\n                                <td md-cell width="20px">{{value}}</td>\n                                <td md-cell width="20px">{{value*100/question.sum | number:1}}</td>\n                              </tr>\n                              <tr md-row>\n                                <td md-cell><b>{{\'JSCRIPTY.TOTAL\' | translate}}</b></td>\n                                <td md-cell width="20px"><b>{{question.sum}}</b></td>\n                                <td md-cell width="20px"><b>100</b></td>\n                              </tr>\n                            </tbody>\n                          </table>\n                        </md-table-container>\n                      </div>\n                      <md-divider ng-if="!$last"></md-divider>\n                    </md-list-item>\n                  </md-list>\n                </md-card>\n                <span ng-if="!vm_an.answers || !vm_an.hasIdAnswers" class="text-boxed-light" translate="JSCRIPTY.NO_ANSWERS_AVAILABLE">No answers available</span>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/jscripty/views/projects/projects.html",'<div id="projects" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-script" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="JSCRIPTY.PROJECTS">Projects</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="JSCRIPTY.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedProjects.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedProjects =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="JSCRIPTY.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-projects-count">\n          <span>{{vm.selectedProjects.length}}</span>\n          <span translate="JSCRIPTY.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="JSCRIPTY.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllProjects()" translate="JSCRIPTY.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectProjects()" translate="JSCRIPTY.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedProjects" csv-label="true" filename="projects.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedProjects($event)" aria-label="delete selected" translate translate-attr-label="JSCRIPTY.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- PROJECT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedProjects" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getProjects">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'JSCRIPTY.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'JSCRIPTY.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'JSCRIPTY.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'JSCRIPTY.CREATED_AT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.projects.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="JSCRIPTY.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="project" md-select-id="id" ng-repeat="project in vm.projects.rows">\n                <td md-cell ng-if="project.userpic"><img class="avatar" alt="{{project.name}}" ng-src="api/users/{{project.id}}/avatar" /></td>\n                <td md-cell ng-if="!project.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{project.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="id ">{{project.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="name ">{{project.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="description ">{{project.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="createdAt ">{{project.createdAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="JSCRIPTY.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(project, $event    )" translate="JSCRIPTY.EDIT_PROJECT">\n                          Edit Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(project, $event    )" translate="JSCRIPTY.CLONE_PROJECT">\n                          clone Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.sessionsgoto(project, $event    )" translate="JSCRIPTY.SESSIONS_PROJECT">\n                          Sessions Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.deleteconfirm(project, $event    )" translate="JSCRIPTY.DELETE_PROJECT">\n                          Delete Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'JSCRIPTY.PAGE\' | translate}}:\', rowsPerPage: \'{{\'JSCRIPTY.ROWSPERPAGE\' | translate}}:\', of: \'{{\'JSCRIPTY.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.projects.count}}" md-on-paginate="vm.getProjects" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PROJECT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD PROJECT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-project-button" ng-click="vm.createOrEditProject($event)" aria-label="add project" translate translate-attr-aria-label="JSCRIPTY.ADD_PROJECT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD PROJECT BUTTON --\x3e\n</div>'),e.put("app/main/apps/mail/views/mailAccounts/create/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newMailAccount ? \'MAIL.NEW_MAILACCOUNT\' : \'MAIL.EDIT_MAILACCOUNT\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.mailAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="mailAccountForm[\'name\'].$error" ng-show="mailAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.mailAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="mailAccountForm[\'key\'].$error" ng-show="mailAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="MAIL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.EMAIL_ADDRESS">Email Address</label>\n        <input type="email" name="email" ng-model="vm.mailAccount.email" ng-required="true">\n\n        <div ng-messages="mailAccountForm[\'email\'].$error" ng-show="mailAccountForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.EMAIL_ADDRESS_REQUIRED">Email Address field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="MAIL.ERRORS.EMAIL_ADDRESS_MUST_VALID">Email Address must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.mailAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountForm[\'ListId\'].$error" ng-show="mailAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.mailAccount.active" aria-label="Active"><span translate="MAIL.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.newMailAccount" class="md-block">\n        <label translate="MAIL.SERVICE">Service</label>\n        <md-select name="provider" ng-model="vm.mailAccount.provider" ng-change="vm.onProviderChange()" required>\n          <md-option ng-value="provider.value" ng-repeat="provider in vm.providers">{{ provider.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountForm[\'provider\'].$error" ng-show="mailAccountForm[\'provider\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.SERVICE_REQUIRED">Service field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.newMailAccount && vm.mailAccount.provider === \'custom\'">\n        <div layout="row">\n          <md-input-container class="md-block mr-20 mb-0" flex>\n            <label translate="MAIL.IMAP_HOST">IMAP_Host</label>\n            <input type="text" name="Imap.host" ng-model="vm.mailAccount.Imap.host" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Imap.host\'].$error" ng-show="mailAccountForm[\'Imap.host\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.IMAP_HOST_REQUIRED">IMAP_Host field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block mb-0">\n            <label translate="MAIL.IMAP_PORT">IMAP Port</label>\n            <input type="number" name="Imap.port" ng-model="vm.mailAccount.Imap.port" value="465" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Imap.port\'].$error" ng-show="mailAccountForm[\'Imap.port\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.IMAP_PORT_REQUIRED">IMAP Port field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n        </div>\n      </div>\n\n      <div ng-if="vm.newMailAccount && vm.mailAccount.provider === \'custom\'">\n        <div layout="row">\n          <md-input-container class="md-block mr-20 mb-0" flex>\n            <label translate="MAIL.SMTP_HOST">SMTP Host</label>\n            <input type="text" name="Smtp.host" ng-model="vm.mailAccount.Smtp.host" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Smtp.host\'].$error" ng-show="mailAccountForm[\'Smtp.host\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.SMTP_HOST_REQUIRED">SMTP Host field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block mb-0">\n            <label translate="MAIL.SMTP_PORT">SMTP Port</label>\n            <input type="number" name="Smtp.port" ng-model="vm.mailAccount.Smtp.port" value="465" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Smtp.port\'].$error" ng-show="mailAccountForm[\'Smtp.port\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.SMTP_PORT_REQUIRED">SMTP Port field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n        </div>\n      </div>\n\n      <md-input-container ng-if="vm.newMailAccount && vm.mailAccount.provider === \'custom\'" class="md-block pt-0">\n        <md-switch ng-model="vm.mailAccount.authentication" aria-label="Authentication"><span translate="MAIL.AUTHENTICATION">Authentication</span></md-switch>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.newMailAccount && vm.mailAccount.provider === \'outlook365\'" class="md-block">\n        <md-switch ng-model="vm.mailAccount.modernAuthentication" aria-label="Modern Authentication" class="no-margin-bottom"><span translate="MAIL.MODERN_AUTHENTICATION">Modern Authentication</span></md-switch>\n      </md-input-container>\n\n      <div ng-if="vm.newMailAccount && vm.mailAccount.authentication && vm.mailAccount.provider">\n        <md-input-container class="md-block">\n          <label translate="MAIL.USERNAME">Username</label>\n          <input type="text" name="username" ng-model="vm.mailAccount.username" ng-required="true">\n          <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n          <div ng-messages="mailAccountForm[\'username\'].$error" ng-show="mailAccountForm[\'username\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.mailAccount.modernAuthentication" class="md-block">\n          <label translate="MAIL.CLOUD_PROVIDER">Cloud Provider</label>\n          <md-select name="cloudProvider" ng-model="vm.mailAccount.CloudProviderId" required>\n            <md-option ng-value="cloudProvider.id" ng-repeat="cloudProvider in vm.cloudProviders.rows">{{ cloudProvider.name }}</md-option>\n          </md-select>\n          <div class="hint"><span translate="MAIL.HELP.CLOUD_PROVIDER"></span></div>\n          <div ng-messages="mailAccountForm[\'cloudProvider\'].$error" ng-show="mailAccountForm[\'cloudProvider\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="!vm.mailAccount.modernAuthentication" class="md-block">\n          <label translate="MAIL.PASSWORD">Password</label>\n          <input type="password" name="password" ng-model="vm.mailAccount.password" translate-attr-placeholder="MAIL.PASSWORD" required>\n          <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n          <div ng-messages="mailAccountForm[\'password\'].$error" role="alert">\n            <div ng-message="required">\n              <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailAccount.description">\n        <div ng-messages="mailAccountForm[\'description\'].$error" ng-show="mailAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailAccount" ng-click="vm.saveMailAccount()" class="send-button md-accent md-raised" ng-disabled="mailAccountForm.$invalid || mailAccountForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailAccount" ng-click="vm.addNewMailAccount()" class="send-button md-accent md-raised" ng-disabled="mailAccountForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILACCOUNT" translate-attr-aria-label="MAIL.ADD_MAILACCOUNT">\n          ADD MAIL ACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailAccount" ng-click="vm.deleteMailAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",'<md-dialog class="mailAccount-dialog" aria-label="mailAccount" ng-init="vm.onInit()">\n  <form name="mailAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MAIL.AGENTADD_MAILACCOUNT">Add Agent to mailAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/agent/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'agent\'].$error" ng-show="mailAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'timeout\'].$error" ng-show="mailAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'times\'].$error" ng-show="mailAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.REPLY_TYPE">Reply_Type</label>\n        <md-select name="replyType" ng-model="vm.autoreply.replyType" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="0">Reply</md-option>\n          <md-option ng-value="1">Reply All</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'replyType\'].$error" ng-show="mailAccountFormApp[\'replyType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.REPLY_TYPE_REQUIRED">Reply_Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label class="md-caption grey-fg" translate="MAIL.TEXT">Text</label>\n        <textarea aria-label="Text text" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.autoreply.text"></textarea>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/close/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'disposition\'].$error" ng-show="mailAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'condition\'].$error" ng-show="mailAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'truepriority\'].$error" ng-show="mailAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'falsepriority\'].$error" ng-show="mailAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'priority\'].$error" ng-show="mailAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/noop/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'value\'].$error" ng-show="mailAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/queue/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'queue\'].$error" ng-show="mailAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'timeout\'].$error" ng-show="mailAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/system/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'command\'].$error" ng-show="mailAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'variable\'].$error" ng-show="mailAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/tag/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'tag\'].$error" ng-show="mailAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/mailCannedAnswers/dialog.html",'<md-dialog class="mailCannedAnswer-dialog" aria-label="New MailCannedAnswer">\n  <form name="mailCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.mailCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="mailCannedAnswerForm[\'key\'].$error" ng-show="mailCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label class="md-caption grey-fg" translate="MAIL.VALUE">Value</label>\n        <textarea aria-label="Value value" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.mailCannedAnswer.value"></textarea>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailCannedAnswer.description">\n\n        <div ng-messages="mailCannedAnswerForm[\'description\'].$error" ng-show="mailCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailCannedAnswer" ng-click="vm.saveMailCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="mailCannedAnswerForm.$invalid || mailCannedAnswerForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailCannedAnswer" ng-click="vm.addNewMailCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="mailCannedAnswerForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILCANNEDANSWER" translate-attr-aria-label="MAIL.ADD_MAILCANNEDANSWER">\n          ADD MAILCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailCannedAnswer" ng-click="vm.deleteMailCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/view.html",'<div id="mail-mailAccount" class="page-layout simple tabbed" layout="column">\n\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-mailAccounts-button md-icon-button" aria-label="Go to mailAccounts" ng-click="vm.goToMailAccounts()" translate translate-attr-aria-label="MAIL.GO_TO_MAILACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="mailAccount-image" hide-xs>\n          <img ng-src="assets/images/business/mailAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.mailAccount.id}}\n            <span ng-if="vm.mailAccount.name">{{vm.mailAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MAIL.CREATED_AT"></span> <span>{{vm.mailAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.goToRealtime()" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="MAIL.GOTO_MAILACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.addAgent(vm.mailAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="MAIL.AGENTADD_MAILACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveMailAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (credentialsForm.$invalid) || (templateForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (imapForm.$invalid) || (smtpForm.$invalid) || (dispositionForm.$invalid) || (mailDispositionsForm.$invalid) || (mailCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.mailAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.mailAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="MAIL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.SERVICE">Service</label>\n                <md-select name="provider" ng-model="vm.mailAccount.provider" ng-change="vm.onProviderChange()" class="mb-20" required>\n                  <md-option ng-value="provider.value" ng-repeat="provider in vm.providers">{{ provider.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'provider\'].$error" ng-show="generalForm[\'provider\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.EMAIL_ADDRESS">Email_Address</label>\n                <input type="email" name="email" ng-model="vm.mailAccount.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.EMAIL_ADDRESS_REQUIRED">Email_Address field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="MAIL.ERRORS.EMAIL_ADDRESS_MUST_VALID">Email_Address must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.mailAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.active" aria-label="Active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.markAsUnread" aria-label="mark_as_unread" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.MARK_AS_UNREAD">mark_as_unread</span></md-switch>\n                <div class="hint"><span translate="MAIL.HELP.MARK_AS_UNREAD"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.mailAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.mailAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.mailAccount.provider !== \'custom\'">\n        <md-tab-label>\n          <span translate="MAIL.AUTHENTICATION">Authentication</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container authentication md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.CREDENTIALS">Credentials</div>\n            </div>\n            <form name="credentialsForm" novalidate>\n              <md-input-container ng-if="vm.mailAccount.provider === \'outlook365\'" class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.modernAuthentication" aria-label="Modern Authentication" class="no-margin-bottom"><span translate="MAIL.MODERN_AUTHENTICATION">Modern Authentication</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.mailAccount.Imap.user" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n                <div ng-messages="credentialsForm[\'username\'].$error" ng-show="credentialsForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.Imap.modernAuthentication" class="md-block">\n                <label translate="MAIL.CLOUD_PROVIDER">Cloud Provider</label>\n                <md-select name="cloudProvider" ng-model="vm.mailAccount.Imap.CloudProviderId" required>\n                  <md-option ng-value="cloudProvider.id" ng-repeat="cloudProvider in vm.cloudProviders.rows">{{ cloudProvider.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MAIL.HELP.CLOUD_PROVIDER"></span></div>\n                <div ng-messages="credentialsForm[\'cloudProvider\'].$error" ng-show="credentialsForm[\'cloudProvider\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="!vm.mailAccount.Imap.modernAuthentication" class="md-block">\n                <label translate="MAIL.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.mailAccount.Imap.password" placeholder="Password" translate translate-attr-placeholder="MAIL.PASSWORD" required>\n                <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n                <div ng-messages="credentialsForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container imap md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.IMAP">IMAP</div>\n            </div>\n            <form name="imapForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.tls" aria-label="ssl" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.SSL">ssl</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.MAILBOX">Mailbox</label>\n                <input type="text" name="Imap.mailbox" ng-model="vm.mailAccount.Imap.mailbox" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.mailbox\'].$error" ng-show="imapForm[\'Imap.mailbox\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.MAILBOX_REQUIRED">mailbox field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.CONNTIMEOUT">Connection Timeout</label>\n                <input type="number" name="Imap.connTimeout" ng-model="vm.mailAccount.Imap.connTimeout" min="1" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.connTimeout\'].$error" ng-show="imapForm[\'Imap.connTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_REQUIRED">Connection Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Connection Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.AUTHTIMEOUT">Authorization Timeout</label>\n                <input type="number" name="Imap.authTimeout" ng-model="vm.mailAccount.Imap.authTimeout" min="1" value="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.authTimeout\'].$error" ng-show="imapForm[\'Imap.authTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_REQUIRED">Authorizazion Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Authorizazion Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.mailAccount.provider === \'custom\'">\n        <md-tab-label>\n          <span translate="MAIL.IMAP">IMAP</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container imap md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.IMAP">IMAP</div>\n            </div>\n            <form name="imapForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.IMAP_HOST">IMAP_Host</label>\n                <input type="text" name="Imap.host" ng-model="vm.mailAccount.Imap.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.host\'].$error" ng-show="imapForm[\'Imap.host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.IMAP_HOST_REQUIRED">IMAP_Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.IMAP_PORT">IMAP_Port</label>\n                <input type="number" name="Imap.port" ng-model="vm.mailAccount.Imap.port" value="465" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.port\'].$error" ng-show="imapForm[\'Imap.port\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.IMAP_PORT_REQUIRED">IMAP_Port field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.tls" aria-label="ssl" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.SSL">ssl</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.authentication" aria-label="Authentication" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.AUTHENTICATION">Authentication</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.Imap.authentication" class="md-block">\n                <label translate="MAIL.USERNAME">Username</label>\n                <input type="text" name="Imap.user" ng-model="vm.mailAccount.Imap.user" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n                <div ng-messages="imapForm[\'Imap.user\'].$error" ng-show="imapForm[\'Imap.user\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.mailAccount.Imap.authentication">\n                <label translate="MAIL.PASSWORD">Password</label>\n                <input type="password" name="Imap.password" ng-model="vm.mailAccount.Imap.password" placeholder="Password" translate translate-attr-placeholder="MAIL.PASSWORD" required>\n                <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n                <div ng-messages="imapForm[\'Imap.password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.MAILBOX">Mailbox</label>\n                <input type="text" name="Imap.mailbox" ng-model="vm.mailAccount.Imap.mailbox" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.mailbox\'].$error" ng-show="imapForm[\'Imap.mailbox\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.MAILBOX_REQUIRED">mailbox field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.CONNTIMEOUT">Connection Timeout</label>\n                <input type="number" name="Imap.connTimeout" ng-model="vm.mailAccount.Imap.connTimeout" min="1" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.connTimeout\'].$error" ng-show="imapForm[\'Imap.connTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_REQUIRED">Connection Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Connection Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.AUTHTIMEOUT">Authorization Timeout</label>\n                <input type="number" name="Imap.authTimeout" ng-model="vm.mailAccount.Imap.authTimeout" min="1" value="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.authTimeout\'].$error" ng-show="imapForm[\'Imap.authTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_REQUIRED">Authorization Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Authorization Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.mailAccount.provider === \'custom\'">\n        <md-tab-label>\n          <span translate="MAIL.SMTP">SMTP</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container smtp md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.SMTP">SMTP</div>\n            </div>\n            <form name="smtpForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.SMTP_HOST">SMTP_Host</label>\n                <input type="text" name="Smtp.host" ng-model="vm.mailAccount.Smtp.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="smtpForm[\'Smtp.host\'].$error" ng-show="smtpForm[\'Smtp.host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.SMTP_HOST_REQUIRED">SMTP_Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.SMTP_PORT">SMTP_Port</label>\n                <input type="number" name="Smtp.port" ng-model="vm.mailAccount.Smtp.port" value="465" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="smtpForm[\'Smtp.port\'].$error" ng-show="smtpForm[\'Smtp.port\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.SMTP_PORT_REQUIRED">SMTP_Port field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Smtp.secure" aria-label="Secure" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.SECURE">Secure</span></md-switch>\n                <div class="hint"><span translate="MAIL.HELP.SECURE"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Smtp.authentication" aria-label="Authentication" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.AUTHENTICATION">Authentication</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.Smtp.authentication" class="md-block">\n                <label translate="MAIL.USERNAME">Username</label>\n                <input type="text" name="Smtp.user" ng-model="vm.mailAccount.Smtp.user" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n                <div ng-messages="smtpForm[\'Smtp.user\'].$error" ng-show="smtpForm[\'Smtp.user\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.mailAccount.Smtp.authentication">\n                <label translate="MAIL.PASSWORD">Password</label>\n                <input type="password" name="Smtp.pass" ng-model="vm.mailAccount.Smtp.pass" placeholder="Password" translate translate-attr-placeholder="MAIL.PASSWORD" required>\n                <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n                <div ng-messages="smtpForm[\'Smtp.pass\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container template md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.TEMPLATE">TEMPLATE</div>\n            </div>\n            <form name="templateForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.FONT_FAMILY">Font_Family</label>\n                <ms-font-family name="fontFamily" ng-model="vm.mailAccount.fontFamily" required></ms-font-family>\n                <div class="hint"><span translate="MAIL.HELP.FONT_FAMILY"></span></div>\n                <div ng-messages="templateForm[\'fontFamily\'].$error" ng-show="templateForm[fontFamily].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FONT_FAMILY_REQUIRED">Font_Family field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.FONT_SIZE">Font_Size</label>\n                <input type="number" name="fontSize" ng-model="vm.mailAccount.fontSize" min="8" max="72" value="13" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MAIL.HELP.FONT_SIZE"></span></div>\n                <div ng-messages="templateForm[\'fontSize\'].$error" ng-show="templateForm[\'fontSize\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FONT_SIZE_REQUIRED">Font_Size field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.FONT_SIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Font_Size must be a valid greater or equal than</span> <span>8</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.FONT_SIZE_MUST_BE_LESS_THAN_OR_EQUAL_TO">Font_Size must be a valid greater or equal than</span> <span>72</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="MAIL.TEMPLATE">Template</label>\n                <textarea aria-label="Template template" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.mailAccount.template"></textarea>\n              </div>\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="MAIL.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.mailAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.queueTransfer == true" class="md-block">\n                <label translate="MAIL.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.mailAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.agentTransfer == true" class="md-block">\n                <label translate="MAIL.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.mailAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.mandatoryDisposition" class="md-block">\n                <label translate="MAIL.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.mailAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MAIL.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="MailAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.mailAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="mailAccount-detail-form-container maildispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMailAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="MAIL.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add mail dispositions" translate translate-attr-label="MAIL.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="mailAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'MAIL.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container mailcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MailAccountMailCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.mailAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMailAccountMailCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MAIL.MAILCANNEDANSWERS">MailCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getMailAccountMailCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event)" aria-label="add mailCannedAnswer" translate translate-attr-label="MAIL.ADD_MAILCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedMailAccountMailCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedMailAccountMailCannedAnswers.length}} {{vm_dc.selectedMailAccountMailCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedMailAccountMailCannedAnswers" csv-label="true" filename="mailAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedMailAccountMailCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedMailAccountMailCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getMailAccountMailCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'MAIL.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'MAIL.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'MAIL.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'MAIL.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'MAIL.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="mailCannedAnswer" md-select-id="id" ng-repeat="mailCannedAnswer in vm_dc.mailAccountMailCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{mailCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{mailCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>{{mailCannedAnswer.value | htmlToPlaintext }}</td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{mailCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{ mailCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" translate="MAIL.EDIT_MAILCANNEDANSWER">\n                                Edit MailCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(mailCannedAnswer, $event)" translate="MAIL.DELETE_MAILCANNEDANSWER">\n                                Delete MailCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.mailAccountMailCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MAIL.NO_MAILCANNEDANSWER_AVAILABLE">No mailcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.mailAccountMailCannedAnswers.count}}" md-on-paginate="vm_dc.getMailAccountMailCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MailAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.mailAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="MAIL.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedMailAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedMailAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedMailAccountApps.length}} {{vm_ac.selectedMailAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedMailAccountApps($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedMailAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.mailAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editMailAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editMailAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editMailAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editMailAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.mailAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MailAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.mailAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMailAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MAIL.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getMailAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getMailAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getMailAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="MAIL.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedMailAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedMailAccountInteractions.length}} {{vm_dc.selectedMailAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedMailAccountInteractions" csv-label="true" filename="mailAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedMailAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedMailAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getMailAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'MAIL.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'MAIL.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="subject">\n                        {{ \'MAIL.SUBJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'MAIL.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'MAIL.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'MAIL.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'MAIL.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'MAIL.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.mailAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <div class="width-300">\n                          <span class="text-truncate font-size-12">\n                            {{interaction.subject}}\n                          </span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'MAIL.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'MAIL.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spymailInteraction($event, interaction)" translate="MAIL.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || (vm_dc.userProfile.downloadOmnichannelInteractions && vm_dc.userProfile.downloadAttachments)">\n                              <md-button class="md-primary" ng-click="vm_dc.mailInteractionDownload(interaction, $event, true)" translate="MAIL.DOWNLOAD_WITH_ATTACHMENTS">\n                                Download with attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.mailInteractionDownload(interaction, $event)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                                Download without attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="MAIL.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.mailAccountInteractions.rows.length">\n                      <td md-cell colspan="13">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MAIL.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.mailAccountInteractions.count}}" md-on-paginate="vm_dc.getMailAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n</div>'),e.put("app/main/apps/mail/views/mailAccounts/mailAccounts.html",'<div id="mailAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-email" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MAIL.MAILACCOUNTS">MailAccounts</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MAIL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n\n  <div ng-show="vm.selectedMailAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMailAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MAIL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-mailAccounts-count">\n          <span>{{vm.selectedMailAccounts.length}}</span>\n          <span translate="MAIL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MAIL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMailAccounts()" translate="MAIL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMailAccounts()" translate="MAIL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMailAccounts" csv-label="true" filename="mailAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMailAccounts($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMailAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailAccounts">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                <th md-column md-order-by="provider">{{ \'MAIL.SERVICE\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'MAIL.KEY\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'MAIL.EMAIL_ADDRESS\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'MAIL.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'MAIL.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.mailAccounts.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="mailAccount" md-select-id="id" ng-repeat="mailAccount in vm.mailAccounts.rows" ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)">\n                <td md-cell class="id">{{mailAccount.id}}</td>\n                <td md-cell class="name">{{mailAccount.name}}</td>\n                <td md-cell class="provider">{{ mailAccount.provider ? (mailAccount.provider | startcase) : (\'MAIL.CUSTOM\' | translate) }}</td>\n                <td md-cell class="key">{{mailAccount.key}}</td>\n                <td md-cell class="email">{{mailAccount.email}}</td>\n                <td md-cell class="active">\n                  <md-icon md-colors="{color: {{mailAccount.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{mailAccount.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td md-cell class="description ">{{mailAccount.description}}</td>\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(mailAccount, $event)" translate="MAIL.EDIT_MAILACCOUNT">\n                          Edit Email Account\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.verifySMTP(mailAccount, $event)" translate="MAIL.VERIFYSMTP_MAILACCOUNT">\n                          Verify SMTP\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.goToInteractions(mailAccount, $event)" translate="MAIL.INTERACTIONS_MAILACCOUNT">\n                          Go To Interactions\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.goToRealtime()" translate="MAIL.GOTOREALTIME_MAILACCOUNT">\n                          Go To Realtime\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.addAgent(mailAccount, $event)" translate="MAIL.AGENTADD_MAILACCOUNT">\n                          Add Agent To Email Account\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(mailAccount, $event)" translate="MAIL.DELETE_MAILACCOUNT">\n                          Delete Email Account\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailAccounts.count}}" md-on-paginate="vm.getMailAccounts" md-page-select></md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-mailAccount-button" ng-click="vm.createOrEditMailAccount($event)" aria-label="add mailAccount" translate translate-attr-aria-label="MAIL.ADD_MAILACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n\n</div>'),e.put("app/main/apps/mail/views/mailQueues/create/dialog.html",'<md-dialog class="mailQueue-dialog" aria-label="New MailQueue">\n  <form name="mailQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.mailQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newMailQueue">\n\n        <div class="hint"><span translate="MAIL.HELP.NAME"></span></div>\n        <div ng-messages="mailQueueForm[\'name\'].$error" ng-show="mailQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MAIL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.mailQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="mailQueueForm[\'strategy\'].$error" ng-show="mailQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.mailQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="mailQueueForm[\'timeout\'].$error" ng-show="mailQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailQueue.description">\n\n        <div ng-messages="mailQueueForm[\'description\'].$error" ng-show="mailQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailQueue" ng-click="vm.saveMailQueue()" class="send-button md-accent md-raised" ng-disabled="mailQueueForm.$invalid || mailQueueForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailQueue" ng-click="vm.addNewMailQueue()" class="send-button md-accent md-raised" ng-disabled="mailQueueForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILQUEUE" translate-attr-aria-label="MAIL.ADD_MAILQUEUE">\n          ADD MAILQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailQueue" ng-click="vm.deleteMailQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",'<md-dialog class="mailQueue-dialog" aria-label="mailQueue" ng-init="vm.onInit()">\n  <form name="mailQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MAIL.AGENTADD_MAILQUEUE">Add Agent to mailQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",'<md-dialog class="mailQueue-dialog" aria-label="mailQueue" ng-init="vm.onInit()">\n  <form name="mailQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MAIL.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailQueues/edit/view.html",'<div id="mail-mailQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-mailQueues-button md-icon-button" aria-label="Go to mailQueues" ng-click="vm.gotoMailQueues()" translate translate-attr-aria-label="MAIL.GO_TO_MAILQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="mailQueue-image" hide-xs>\n          <img ng-src="assets/images/business/mailQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.mailQueue.id}}\n            <span ng-if="vm.mailQueue.name">{{vm.mailQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MAIL.CREATED_AT"></span> <span>{{vm.mailQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.mailQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="MAIL.TEAMADD_MAILQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.mailQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="MAIL.AGENTADD_MAILQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveMailQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.mailQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="MAIL.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.mailQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.mailQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.mailQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/mail/views/mailQueues/mailQueues.html",'<div id="mailQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-email" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MAIL.MAILQUEUES">MailQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MAIL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMailQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMailQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MAIL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-mailQueues-count">\n          <span>{{vm.selectedMailQueues.length}}</span>\n          <span translate="MAIL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MAIL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMailQueues()" translate="MAIL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMailQueues()" translate="MAIL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMailQueues" csv-label="true" filename="mailQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMailQueues($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- MAILQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMailQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'MAIL.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.mailQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="mailQueue" md-select-id="id" ng-repeat="mailQueue in vm.mailQueues.rows">\n                <td md-cell ng-if="mailQueue.userpic"><img class="avatar" alt="{{mailQueue.name}}" ng-src="api/users/{{mailQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!mailQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{mailQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailQueue, ev) : vm.createOrEditMailQueue($event, mailQueue)" md-cell class="id ">{{mailQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailQueue, ev) : vm.createOrEditMailQueue($event, mailQueue)" md-cell class="name ">{{mailQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailQueue, ev) : vm.createOrEditMailQueue($event, mailQueue)" md-cell class="strategy ">{{ vm.arraystrategy[mailQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(mailQueue, $event    )" translate="MAIL.EDIT_MAILQUEUE">\n                          Edit MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(mailQueue, $event    )" translate="MAIL.TEAMADD_MAILQUEUE">\n                          teamadd MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(mailQueue, $event    )" translate="MAIL.AGENTADD_MAILQUEUE">\n                          agentadd MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(mailQueue, $event    )" translate="MAIL.DELETE_MAILQUEUE">\n                          Delete MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(mailQueue, $event    )" translate="MAIL.GOTOREALTIME_MAILQUEUE">\n                          goToRealtime MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailQueues.count}}" md-on-paginate="vm.getMailQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / MAILQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD MAILQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-mailQueue-button" ng-click="vm.createOrEditMailQueue($event)" aria-label="add mailQueue" translate translate-attr-aria-label="MAIL.ADD_MAILQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD MAILQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/mail/views/mailSubtatuses/create/dialog.html",'<md-dialog class="mailSubstatus-dialog" aria-label="New MailSubstatus">\n  <form name="mailSubstatusForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.mailSubstatus.name" ng-required="true" autofocus>\n\n        <div ng-messages="mailSubstatusForm[\'name\'].$error" ng-show="mailSubstatusForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailSubstatus.description">\n\n        <div ng-messages="mailSubstatusForm[\'description\'].$error" ng-show="mailSubstatusForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailSubstatus" ng-click="vm.saveMailSubstatus()" class="send-button md-accent md-raised" ng-disabled="mailSubstatusForm.$invalid || mailSubstatusForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailSubstatus" ng-click="vm.addNewMailSubstatus()" class="send-button md-accent md-raised" ng-disabled="mailSubstatusForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILSUBSTATUS" translate-attr-aria-label="MAIL.ADD_MAILSUBSTATUS">\n          ADD MAILSUBSTATUS\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailSubstatus" ng-click="vm.deleteMailSubstatus($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailSubtatuses/mailSubtatuses.html",'<div id="mailSubtatuses" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-email" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MAIL.MAILSUBSTATUSES">MailSubstatuses</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MAIL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMailSubstatuses.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMailSubstatuses =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MAIL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-mailSubtatuses-count">\n          <span>{{vm.selectedMailSubstatuses.length}}</span>\n          <span translate="MAIL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MAIL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMailSubstatuses()" translate="MAIL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMailSubstatuses()" translate="MAIL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMailSubstatuses" csv-label="true" filename="mailSubtatuses.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMailSubstatuses($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- MAILSUBSTATUS TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMailSubstatuses" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailSubstatuses">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'MAIL.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.mailSubtatuses.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="mailSubstatus" md-select-id="id" ng-repeat="mailSubstatus in vm.mailSubtatuses.rows">\n                <td md-cell ng-if="mailSubstatus.userpic"><img class="avatar" alt="{{mailSubstatus.name}}" ng-src="api/users/{{mailSubstatus.id}}/avatar" /></td>\n                <td md-cell ng-if="!mailSubstatus.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{mailSubstatus.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditMailSubstatus($event, mailSubstatus)" md-cell class="id ">{{mailSubstatus.id}}</td>\n                <td ng-click="vm.createOrEditMailSubstatus($event, mailSubstatus)" md-cell class="name ">{{mailSubstatus.name}}</td>\n                <td ng-click="vm.createOrEditMailSubstatus($event, mailSubstatus)" md-cell class="description ">{{mailSubstatus.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(mailSubstatus, $event    )" translate="MAIL.EDIT_MAILSUBSTATUS">\n                          Edit MailSubstatus\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(mailSubstatus, $event    )" translate="MAIL.DELETE_MAILSUBSTATUS">\n                          Delete MailSubstatus\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailSubtatuses.count}}" md-on-paginate="vm.getMailSubstatuses" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / MAILSUBSTATUS TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD MAILSUBSTATUS BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-mailSubstatus-button" ng-click="vm.createOrEditMailSubstatus($event)" aria-label="add mailSubstatus" translate translate-attr-aria-label="MAIL.ADD_MAILSUBSTATUS">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD MAILSUBSTATUS BUTTON --\x3e\n</div>'),e.put("app/main/apps/mail/views/realtime/accounts/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MAIL.ACCOUNTS">Accounts</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.vm.getMailAccounts()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- AGENT TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailAccounts">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate}}</th>\n        <th md-column>{{\'MAIL.KEY\' | translate}}</th>\n        <th md-column>{{\'MAIL.TOTAL\' | translate}}</th>\n        <th md-column>{{\'MAIL.IN\' | translate}}</th>\n        <th md-column>{{\'MAIL.OUT\' | translate}}</th>\n        <th md-column>{{\'MAIL.IMAP_STATUS\' | translate}}</th>\n        <th md-column>{{\'MAIL.SMTP_STATUS\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.mailAccounts">\n        <td md-cell colspan="4">\n          <div layout="row" layout-align="center center">\n            <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="vm.mailAccounts[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n        <td md-cell>{{vm.mailAccounts[value].name}}</td>\n        <td md-cell>{{vm.mailAccounts[value].key}}</td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{(vm.mailAccounts[value].in || 0) + (vm.mailAccounts[value].out || 0)}}</span>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-down-bold blue-fg"></md-icon>\n            </span>\n            <span class="md-capture blue-fg">{{vm.mailAccounts[value].in || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.in">{{vm.mailAccounts[value].lastIn ?  (vm.mailAccounts[value].lastIn | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-up-bold green-fg"></md-icon>\n            </span>\n            <span class="md-capture green-fg">{{vm.mailAccounts[value].out || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.out">{{vm.mailAccounts[value].lastOut ?  (vm.mailAccounts[value].lastOut | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row" layout-align="start center">\n            <div layout="column" layout-align="center center">\n              <md-button class="md-icon-button" aria-label="Status">\n                <md-tooltip>{{vm.mailAccounts[value].Imap.messageStatus}}</md-tooltip>\n                <div ng-switch="vm.mailAccounts[value].Imap.status">\n                  <md-icon ng-switch-when="error" md-font-icon="icon-alert yellow-fg"></md-icon>\n                  <md-icon ng-switch-when="disabled" md-font-icon="icon-close grey-fg"></md-icon>\n                  <md-icon ng-switch-default md-font-icon="icon-checkbox-marked-circle-outline green-fg"></md-icon>\n                </div>\n              </md-button>\n              <span class="md-caption grey-fg">{{ (\'MAIL.\' + vm.mailAccounts[value].Imap.status.toUpperCase()) | translate}}</span>\n            </div>\n            <span class="text-boxed" ng-if="vm.mailAccounts[value].active && (vm.mailAccounts[value].Imap.lastSync && vm.mailAccounts[value].Imap.lastSync != \'\')">{{vm.mailAccounts[value].Imap.lastSync | date: \'shortTime\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row" layout-align="start center" ng-if="vm.mailAccounts[value].Smtp.status">\n            <div layout="column" layout-align="center center">\n              <md-button class="md-icon-button" aria-label="Status">\n                <md-tooltip>{{vm.mailAccounts[value].Smtp.messageStatus}}</md-tooltip>\n                <md-icon md-font-icon="{{ vm.mailAccounts[value].Smtp.status == \'error\' ? \'icon-alert yellow-fg\' : \'icon-checkbox-marked-circle-outline green-fg\'}}"></md-icon>\n              </md-button>\n              <span class="md-caption grey-fg">{{ (\'MAIL.\' + vm.mailAccounts[value].Smtp.status.toUpperCase()) | translate}}</span>\n            </div>\n            <span class="text-boxed">{{vm.mailAccounts[value].Smtp.lastSync | date: \'shortTime\'}}</span>\n          </div>\n          <span class="md-caption grey-fg" ng-if="!vm.mailAccounts[value].Smtp.status">{{ \'MAIL.NEVER_VERIFIED\' | translate }}</span>\n        </td>\n        <td md-cell class="actions">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-button ng-click="vm.goToMailAccount($event, vm.mailAccounts[value])" translate="MAIL.EDIT_ACCOUNT">\n                  Edit Account\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.verifySmtp($event, vm.mailAccounts[value])" translate="MAIL.VERIFY_SMTP">\n                  Verify Smtp\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getMailAccounts" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/mail/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MAIL.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n        <th md-column>{{ \'MAIL.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'MAIL.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'MAIL.WAITING\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedIn }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="MAIL.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="MAIL.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/mail/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.ACCOUNTS">Accounts</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/marketplace/views/plugins/create/dialog.html",'<md-dialog class="plugin-dialog" aria-label="New Plugin">\n  <form name="pluginForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.plugin.name" ng-required="true" autofocus>\n\n        <div ng-messages="pluginForm[\'name\'].$error" ng-show="pluginForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.TYPE">Type</label>\n        <input type="text" name="type" ng-model="vm.plugin.type" ng-disabled="!vm.newPlugin">\n\n        <div ng-messages="pluginForm[\'type\'].$error" ng-show="pluginForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.plugin.active" aria-label="Active" ng-disabled="!vm.newPlugin"><span translate="MARKETPLACE.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.plugin.description">\n\n        <div ng-messages="pluginForm[\'description\'].$error" ng-show="pluginForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.ICON">Icon</label>\n        <input type="text" name="icon" ng-model="vm.plugin.icon" ng-required="true">\n\n        <div ng-messages="pluginForm[\'icon\'].$error" ng-show="pluginForm[\'icon\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.ICON_REQUIRED">Icon field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.SIDEBAR">Sidebar</label>\n        <md-select name="sidebar" ng-model="vm.plugin.sidebar" required>\n          <md-option ng-value="\'always\'">Always</md-option>\n          <md-option ng-value="\'adminOnly\'">Admin Only</md-option>\n          <md-option ng-value="\'agentOnly\'">Agent Only</md-option>\n          <md-option ng-value="\'never\'">Never</md-option>\n        </md-select>\n        <div ng-messages="pluginForm[\'sidebar\'].$error" ng-show="pluginForm[\'sidebar\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.SIDEBAR_REQUIRED">Sidebar field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'adminOnly\'" class="md-block">\n        <label translate="MARKETPLACE.ADMINURL">AdminUrl</label>\n        <input type="text" name="adminUrl" ng-model="vm.plugin.adminUrl">\n\n        <div ng-messages="pluginForm[\'adminUrl\'].$error" ng-show="pluginForm[\'adminUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.ADMINURL_REQUIRED">AdminUrl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'agentOnly\'" class="md-block">\n        <label translate="MARKETPLACE.AGENTURL">AgentUrl</label>\n        <input type="text" name="agentUrl" ng-model="vm.plugin.agentUrl">\n\n        <div ng-messages="pluginForm[\'agentUrl\'].$error" ng-show="pluginForm[\'agentUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.AGENTURL_REQUIRED">AgentUrl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n        <label translate="MARKETPLACE.SCRIPTNAME">ScriptName</label>\n        <input type="text" name="scriptName" ng-model="vm.plugin.scriptName" ng-disabled="!vm.newPlugin">\n\n        <div ng-messages="pluginForm[\'scriptName\'].$error" ng-show="pluginForm[\'scriptName\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.SCRIPTNAME_REQUIRED">ScriptName field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n        <label translate="MARKETPLACE.SCRIPTPATH">ScriptPath</label>\n        <input type="text" name="scriptPath" ng-model="vm.plugin.scriptPath" ng-required="true">\n\n        <div ng-messages="pluginForm[\'scriptPath\'].$error" ng-show="pluginForm[\'scriptPath\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.SCRIPTPATH_REQUIRED">ScriptPath field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.VERSION">Version</label>\n        <input type="text" name="version" ng-model="vm.plugin.version" ng-disabled="!vm.newPlugin">\n\n        <div ng-messages="pluginForm[\'version\'].$error" ng-show="pluginForm[\'version\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.VERSION_REQUIRED">Version field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newPlugin" ng-click="vm.savePlugin()" class="send-button md-accent md-raised" ng-disabled="pluginForm.$invalid || pluginForm.$pristine" aria-label="SAVE" translate="MARKETPLACE.SAVE" translate-attr-aria-label="MARKETPLACE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newPlugin" ng-click="vm.addNewPlugin()" class="send-button md-accent md-raised" ng-disabled="pluginForm.$invalid" aria-label="ADD" translate="MARKETPLACE.ADD_PLUGIN" translate-attr-aria-label="MARKETPLACE.ADD_PLUGIN">\n          ADD PLUGIN\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newPlugin" ng-click="vm.deletePlugin($event)" aria-label="DELETE" translate translate-attr-aria-label="MARKETPLACE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MARKETPLACE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/marketplace/views/plugins/edit/view.html",'<div id="marketplace-plugin" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-plugins-button md-icon-button" aria-label="Go to plugins" ng-click="vm.gotoPlugins()" translate translate-attr-aria-label="MARKETPLACE.GO_TO_PLUGINS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="plugin-image" hide-xs>\n          <img ng-src="assets/images/business/plugins.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.plugin.id}}\n            <span ng-if="vm.plugin.name">{{vm.plugin.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MARKETPLACE.CREATED_AT"></span> <span>{{vm.plugin.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.savePlugin()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="MARKETPLACE.SAVE" translate-attr-aria-label="MARKETPLACE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MARKETPLACE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="plugin-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MARKETPLACE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.plugin.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.TYPE">Type</label>\n                <input type="text" name="type" ng-model="vm.plugin.type" disabled>\n\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.plugin.active" aria-label="Active" ng-disabled="true"><span translate="MARKETPLACE.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.plugin.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.ICON">Icon</label>\n                <input type="text" name="icon" ng-model="vm.plugin.icon" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'icon\'].$error" ng-show="generalForm[\'icon\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.ICON_REQUIRED">Icon field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.SIDEBAR">Sidebar</label>\n                <md-select name="sidebar" ng-model="vm.plugin.sidebar" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'always\'">Always</md-option>\n                  <md-option ng-value="\'adminOnly\'">Admin Only</md-option>\n                  <md-option ng-value="\'agentOnly\'">Agent Only</md-option>\n                  <md-option ng-value="\'never\'">Never</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'sidebar\'].$error" ng-show="generalForm[\'sidebar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.SIDEBAR_REQUIRED">Sidebar field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'adminOnly\'" class="md-block">\n                <label translate="MARKETPLACE.ADMINURL">AdminUrl</label>\n                <input type="text" name="adminUrl" ng-model="vm.plugin.adminUrl" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'adminUrl\'].$error" ng-show="generalForm[\'adminUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.ADMINURL_REQUIRED">AdminUrl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'agentOnly\'" class="md-block">\n                <label translate="MARKETPLACE.AGENTURL">AgentUrl</label>\n                <input type="text" name="agentUrl" ng-model="vm.plugin.agentUrl" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'agentUrl\'].$error" ng-show="generalForm[\'agentUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.AGENTURL_REQUIRED">AgentUrl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n                <label translate="MARKETPLACE.SCRIPTNAME">ScriptName</label>\n                <input type="text" name="scriptName" ng-model="vm.plugin.scriptName" disabled>\n\n                <div ng-messages="generalForm[\'scriptName\'].$error" ng-show="generalForm[\'scriptName\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.SCRIPTNAME_REQUIRED">ScriptName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n                <label translate="MARKETPLACE.SCRIPTPATH">ScriptPath</label>\n                <input type="text" name="scriptPath" ng-model="vm.plugin.scriptPath" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'scriptPath\'].$error" ng-show="generalForm[\'scriptPath\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.SCRIPTPATH_REQUIRED">ScriptPath field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.VERSION">Version</label>\n                <input type="text" name="version" ng-model="vm.plugin.version" disabled>\n\n                <div ng-messages="generalForm[\'version\'].$error" ng-show="generalForm[\'version\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.VERSION_REQUIRED">Version field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/marketplace/views/plugins/plugins.html",'<div id="plugins" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MARKETPLACE.PLUGINS">Plugins</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MARKETPLACE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedPlugins.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedPlugins =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MARKETPLACE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-plugins-count">\n          <span>{{vm.selectedPlugins.length}}</span>\n          <span translate="MARKETPLACE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MARKETPLACE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllPlugins()" translate="MARKETPLACE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectPlugins()" translate="MARKETPLACE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedPlugins" csv-label="true" filename="plugins.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedPlugins($event)" aria-label="delete selected" translate translate-attr-label="MARKETPLACE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      <div ng-if="vm.installing">\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="column" layout-align="center center">\n            <span class="md-title md-accent-fg padding-20 text-bold" translate="MARKETPLACE.INSTALLING">Installing</span>\n            <md-progress-linear md-mode="indeterminate" class="md-accent padding-20"></md-progress-linear>\n          </div>\n        </md-card>\n      </div>\n\n      \x3c!-- PLUGIN TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedPlugins" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getPlugins">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="name">{{ \'MARKETPLACE.NAME\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'MARKETPLACE.TYPE\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'MARKETPLACE.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'MARKETPLACE.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="version">{{ \'MARKETPLACE.VERSION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.plugins.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MARKETPLACE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="plugin" md-select-id="id" ng-repeat="plugin in vm.plugins.rows">\n                <td md-cell ng-if="plugin.userpic"><img class="avatar" alt="{{plugin.name}}" ng-src="api/users/{{plugin.id}}/avatar" /></td>\n                <td md-cell ng-if="!plugin.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{plugin.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="name ">{{plugin.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="type ">{{plugin.type}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{plugin.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{plugin.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="description ">{{plugin.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="version ">{{plugin.version}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MARKETPLACE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && !plugin.active">\n\n                        <md-button ng-click="vm.installplugin(plugin, $event    )" translate="MARKETPLACE.INSTALL_PLUGIN">\n                          Install Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(plugin, $event    )" translate="MARKETPLACE.EDIT_PLUGIN">\n                          Edit Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active && plugin.type == \'script\'">\n\n                        <md-button ng-click="vm.stopplugin(plugin, $event    )" translate="MARKETPLACE.STOP_PLUGIN">\n                          Stop Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active && plugin.type == \'script\'">\n\n                        <md-button ng-click="vm.restartplugin(plugin, $event    )" translate="MARKETPLACE.RESTART_PLUGIN">\n                          Restart Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.downloadfile2(plugin, $event  , \'plugins\'   )" translate="MARKETPLACE.DOWNLOAD_PLUGIN">\n                          Download Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active">\n\n                        <md-button ng-click="vm.uninstallplugin(plugin, $event    )" translate="MARKETPLACE.UNINSTALL_PLUGIN">\n                          Uninstall Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(plugin, $event    )" translate="MARKETPLACE.DELETE_PLUGIN">\n                          Delete Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MARKETPLACE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MARKETPLACE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MARKETPLACE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.plugins.count}}" md-on-paginate="vm.getPlugins" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PLUGIN TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- UPLOAD PLUGIN BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="upload-plugin-button" ng-click="vm.uploadPlugin($event)" aria-label="upload plugin" translate translate-attr-aria-label="MARKETPLACE.UPLOAD_PLUGIN">\n    <md-icon md-font-icon="icon-upload"></md-icon>\n  </md-button>\n  \x3c!-- / UPLOAD PLUGIN BUTTON --\x3e\n</div>'),e.put("app/main/apps/marketplace/views/plugins/upload/dialog.html",'<md-dialog class="upload-dialog" aria-label="Upload ">\n  <form name="uploadForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div id="plugin-uploader" ng-hide="vm.uploadState == \'uploading\'" flow-init="vm.ngFlowOptions" flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)" flow-error="vm.uploadError($file, $message)" flow-complete="vm.uploadComplete()" flow-drop flow-drag-enter="vm.dropping=true" flow-drag-leave="vm.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n        <div class="drop-text hint-text" layout="row" layout-align="center center">\n          <span translate="MARKETPLACE.DROP_TO_UPLOAD">Drop to upload</span>\n        </div>\n\n        <div class="upload-button" layout="column" layout-align="center center">\n          <md-button class="md-accent md-raised" flow-btn>\n            Upload\n          </md-button>\n          <span class="secondary-text mt-8" translate="MARKETPLACE.DROP_TO_UPLOAD_MESSAGE">You can also drop your file here to upload.</span>\n        </div>\n      </div>\n\n      <div layout="column" layout-align="space-between center" ng-show="vm.uploadState == \'uploading\'">\n        <div>\n          <span translate="MARKETPLACE.UPLOADING">Uploading</span>\n          <span>{{vm.plugin.file.name}}</span>\n        </div>\n        <md-progress-linear md-mode="indeterminate"></md-progress-linear>\n      </div>\n\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center"></div>\n      <div layout="row">\n        <md-button ng-click="vm.closeDialog()" ng-hide="vm.uploadState == \'uploading\'" class="md-accent md-raised" aria-label="FINISH" translate="MARKETPLACE.FINISH" translate-attr-aria-label="MARKETPLACE.FINISH">\n          FINISH\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/hopperdate/hopperdate.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content ms-scroll>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <label translate="MOTIONDIALER.SCHEDULEDAT">ScheduledAt</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" ng-change="vm.recalcTZTime()" mdp-format="YYYY-MM-DD" ng-model="vm.dateTime">\n              <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" ng-change="vm.recalcTZTime()" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.dateTime">\n              <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n\n        </md-content>\n      </div>\n      <md-input-container class="md-block">\n        <div layout="row">\n          <div flex class="md-block">\n            <md-input-container class="md-block" flex-gt-sm="">\n              <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n              <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" ng-change="vm.recalcTZTime()" autofocus>\n            </md-input-container>\n          </div>\n          <div flex class="md-block">\n            <md-input-container class="md-block">\n              <label translate="DASHBOARDS.SYSTEM_TIME">System time</label>\n              <input type="text" readonly value="{{vm.hopper.scheduledat}}">\n            </md-input-container>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.PRIORITY">Priority</label>\n        <md-select name="priority" ng-model="vm.hopper.priority">\n          <md-option ng-value="\'4\'">Highest</md-option>\n          <md-option ng-value="\'3\'">High</md-option>\n          <md-option ng-value="\'2\'">Medium</md-option>\n          <md-option ng-value="\'1\'">Low</md-option>\n          <md-option ng-value="\'0\'">Lowest</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PRIORITY"></span></div>\n        <div ng-messages="hopperForm[\'priority\'].$error" ng-show="hopperForm[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.hopper.recallme" aria-label="RecallAgent"><span translate="MOTIONDIALER.RECALLAGENT">RecallAgent</span></md-switch>\n\n      </md-input-container>\n      <md-input-container ng-if="vm.hopper.recallme" class="md-block">\n        <label translate="MOTIONDIALER.AGENT">Agent</label>\n        <md-select name="UserId" ng-model="vm.hopper.UserId" required>\n          <md-option ng-value="UserId.id" ng-repeat="UserId in vm.agents" ng-disabled="UserId.canSelect === false">{{ UserId.name }}</md-option>\n        </md-select>\n        <div ng-messages="hopperForm[\'UserId\'].$error" ng-show="hopperForm[\'UserId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_HOPPER" translate-attr-aria-label="MOTIONDIALER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/create/dialog.html",'<md-dialog class="ivrCampaign-dialog" aria-label="New IvrCampaign">\n  <form name="ivrCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.ivrCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newIvrCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="ivrCampaignForm[\'name\'].$error" ng-show="ivrCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.ivrCampaign.active" aria-label="Active"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n        <md-select name="TrunkId" ng-model="vm.ivrCampaign.TrunkId" required>\n          <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'TrunkId\'].$error" ng-show="ivrCampaignForm[\'TrunkId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n        <md-select name="IntervalId" ng-model="vm.ivrCampaign.IntervalId" required>\n          <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'IntervalId\'].$error" ng-show="ivrCampaignForm[\'IntervalId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n        <md-select name="dialCheckDuplicateType" ng-model="vm.ivrCampaign.dialCheckDuplicateType" required>\n\n          <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n          <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n          <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'dialCheckDuplicateType\'].$error" ng-show="ivrCampaignForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CALLYSQUAREPROJECT">CallySquareProject</label>\n        <md-select name="SquareProjectId" ng-model="vm.ivrCampaign.SquareProjectId" required>\n          <md-option ng-value="SquareProjectId.id" ng-repeat="SquareProjectId in vm.projects" ng-disabled="SquareProjectId.canSelect === false">{{ SquareProjectId.name }}</md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'SquareProjectId\'].$error" ng-show="ivrCampaignForm[\'SquareProjectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT_REQUIRED">CallySquareProject field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CONCURRENTCALLS">ConcurrentCalls</label>\n        <input type="number" name="limitCalls" ng-model="vm.ivrCampaign.limitCalls" min="1" max="200" value="30" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.CONCURRENTCALLS"></span></div>\n        <div ng-messages="ivrCampaignForm[\'limitCalls\'].$error" ng-show="ivrCampaignForm[\'limitCalls\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_REQUIRED">ConcurrentCalls field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>200</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.ivrCampaign.description">\n\n        <div ng-messages="ivrCampaignForm[\'description\'].$error" ng-show="ivrCampaignForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newIvrCampaign" ng-click="vm.saveIvrCampaign()" class="send-button md-accent md-raised" ng-disabled="ivrCampaignForm.$invalid || ivrCampaignForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newIvrCampaign" ng-click="vm.addNewIvrCampaign()" class="send-button md-accent md-raised" ng-disabled="ivrCampaignForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_IVRCAMPAIGN" translate-attr-aria-label="MOTIONDIALER.ADD_IVRCAMPAIGN">\n          ADD IVRCAMPAIGN\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newIvrCampaign" ng-click="vm.deleteIvrCampaign($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",'<md-dialog class="ivrCampaign-dialog" aria-label="ivrCampaign" ng-init="vm.onInit()">\n  <form name="ivrCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.BLACKLISTADD_IVRCAMPAIGN">Add List in IVRCAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",'<md-dialog class="ivrCampaign-dialog" aria-label="Clone IvrCampaign">\n  <form name="ivrCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.ivrCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newIvrCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="ivrCampaignForm[\'name\'].$error" ng-show="ivrCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneIvrCampaign()" class="send-button md-accent md-raised" ng-disabled="ivrCampaignForm.$invalid" aria-label="CLONE" translate="MOTIONDIALER.CLONE_IVRCAMPAIGN" translate-attr-aria-label="MOTIONDIALER.CLONE_IVRCAMPAIGN">\n        CLONE IVRCAMPAIGN\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/hoppers/dialog.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <label translate="MOTIONDIALER.SCHEDULEDAT">ScheduledAt</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n              <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n              <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.PRIORITY">Priority</label>\n        <md-select name="priority" ng-model="vm.hopper.priority">\n          <md-option ng-value="\'4\'">Highest</md-option>\n          <md-option ng-value="\'3\'">High</md-option>\n          <md-option ng-value="\'2\'">Medium</md-option>\n          <md-option ng-value="\'1\'">Low</md-option>\n          <md-option ng-value="\'0\'">Lowest</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PRIORITY"></span></div>\n        <div ng-messages="hopperForm[\'priority\'].$error" ng-show="hopperForm[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_HOPPER" translate-attr-aria-label="MOTIONDIALER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",'<md-dialog class="ivrCampaign-dialog" aria-label="ivrCampaign" ng-init="vm.onInit()">\n  <form name="ivrCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.LISTADD_IVRCAMPAIGN">Add List in IVRCAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/resetlist/resetlist.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.RESETLIST ">Reset List</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-disabled="vm.loading" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-hide="vm.loading">\n      <div layout="row" layout-wrap flex>\n        <div flex-xs flex="50">\n          <md-checkbox aria-label="Select All" ng-checked="vm.isChecked()" md-indeterminate="vm.isIndeterminate()" ng-click="vm.toggleAll()">\n            <span ng-if="vm.isChecked()" translate="MOTIONDIALER.UNSELECTALL"></span>\n            <span ng-if="!vm.isChecked()" translate="MOTIONDIALER.SELECTALL"></span>\n          </md-checkbox>\n        </div>\n        <div flex-xs flex="50">\n        </div>\n        <div flex="{{vm.items.length > 10 ? 50 : 100 }}" ng-repeat="item in vm.items">\n          <md-checkbox ng-checked="vm.exists(item, vm.selected)" ng-click="vm.toggle(item, vm.selected)">\n            {{ item.name | limitTo:40 }}\n          </md-checkbox>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions ng-hide="vm.loading" layout="row" layout-align="end center">\n      <div>\n      </div>\n      <md-button type="submit" ng-click="vm.listSelected()" class="send-button md-accent md-raised" ng-disabled="vm.loading" aria-label="RESET" translate="MOTIONDIALER.RESET" translate-attr-aria-label="MOTIONDIALER.RESET">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n    <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n      <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n    </div>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/view.html",'<div id="motiondialer-ivrCampaign" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-ivrCampaigns-button md-icon-button" aria-label="Go to ivrCampaigns" ng-click="vm.gotoIvrCampaigns()" translate translate-attr-aria-label="MOTIONDIALER.GO_TO_IVRCAMPAIGNS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="ivrCampaign-image" hide-xs>\n          <img ng-src="assets/images/business/ivrCampaigns.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.ivrCampaign.id}}\n            <span ng-if="vm.ivrCampaign.name">{{vm.ivrCampaign.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MOTIONDIALER.CREATED_AT"></span> <span>{{vm.ivrCampaign.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.ivrCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="MOTIONDIALER.CLONE_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.listadddialog(vm.ivrCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="listadd">\n        <md-tooltip><span translate="MOTIONDIALER.LISTADD_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-format-list-numbers"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.blacklistadddialog(vm.ivrCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="blacklistadd">\n        <md-tooltip><span translate="MOTIONDIALER.BLACKLISTADD_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-block-helper"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.resetlistdialog(vm.ivrCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="resetlist">\n        <md-tooltip><span translate="MOTIONDIALER.RESETLIST_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-restore"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.ivrCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="MOTIONDIALER.GOTO_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveIvrCampaign()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (campaignForm.$invalid) || (originateForm.$invalid) || (globalForm.$invalid) || (congestionForm.$invalid) || (busyForm.$invalid) || (noanswerForm.$invalid) || (nosuchnumberForm.$invalid) || (dropForm.$invalid) || (abandonedForm.$invalid) || (machineForm.$invalid) || (agentrejectForm.$invalid) || (advancedForm.$invalid) || (globalintervalForm.$invalid) || (timezoneForm.$invalid) || (amdForm.$invalid) || (hopperStatisticsForm.$invalid) || (hoppersForm.$invalid) || (hopperHistoriesForm.$invalid) || (hopperFinalsForm.$invalid) || (hopperBlacksForm.$invalid)" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.ivrCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.ivrCampaign.active" aria-label="Active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n                <md-select name="TrunkId" ng-model="vm.ivrCampaign.TrunkId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkId\'].$error" ng-show="generalForm[\'TrunkId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BACKUPTRUNK">BackupTrunk</label>\n                <md-select name="TrunkBackupId" ng-model="vm.ivrCampaign.TrunkBackupId" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="TrunkBackupId.id" ng-repeat="TrunkBackupId in vm.trunks" ng-disabled="TrunkBackupId.canSelect === false">{{ TrunkBackupId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkBackupId\'].$error" ng-show="generalForm[\'TrunkBackupId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BACKUPTRUNK_REQUIRED">BackupTrunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n                <md-select name="IntervalId" ng-model="vm.ivrCampaign.IntervalId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'IntervalId\'].$error" ng-show="generalForm[\'IntervalId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n                <md-select name="dialCheckDuplicateType" ng-model="vm.ivrCampaign.dialCheckDuplicateType" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n                  <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'dialCheckDuplicateType\'].$error" ng-show="generalForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CUTDIGIT">CutDigit</label>\n                <input type="number" name="dialCutDigit" ng-model="vm.ivrCampaign.dialCutDigit" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'dialCutDigit\'].$error" ng-show="generalForm[\'dialCutDigit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_REQUIRED">CutDigit field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_LESS_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.ivrCampaign.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container campaign md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</div>\n            </div>\n            <form name="campaignForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECT">CallySquareProject</label>\n                <md-select name="SquareProjectId" ng-model="vm.ivrCampaign.SquareProjectId" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="SquareProjectId.id" ng-repeat="SquareProjectId in vm.projects" ng-disabled="SquareProjectId.canSelect === false">{{ SquareProjectId.name }}</md-option>\n                </md-select>\n                <div ng-messages="campaignForm[\'SquareProjectId\'].$error" ng-show="campaignForm[\'SquareProjectId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT_REQUIRED">CallySquareProject field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONCURRENTCALLS">ConcurrentCalls</label>\n                <input type="number" name="limitCalls" ng-model="vm.ivrCampaign.limitCalls" min="1" max="200" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONCURRENTCALLS"></span></div>\n                <div ng-messages="campaignForm[\'limitCalls\'].$error" ng-show="campaignForm[\'limitCalls\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_REQUIRED">ConcurrentCalls field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>200</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container originate md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ORIGINATE">ORIGINATE</div>\n            </div>\n            <form name="originateForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNAME">OriginateCallerIdName</label>\n                <input type="text" name="dialOriginateCallerIdName" ng-model="vm.ivrCampaign.dialOriginateCallerIdName" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNAME"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdName\'].$error" ng-show="originateForm[\'dialOriginateCallerIdName\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNAME_REQUIRED">OriginateCallerIdName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNUMBER">OriginateCallerIdNumber</label>\n                <input type="text" name="dialOriginateCallerIdNumber" ng-model="vm.ivrCampaign.dialOriginateCallerIdNumber" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdNumber\'].$error" ng-show="originateForm[\'dialOriginateCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNUMBER_REQUIRED">OriginateCallerIdNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.RANDOMLASTDIGITCALLERIDNUMBER">RandomLastDigitCallerIdNumber</label>\n                <input type="number" name="dialRandomLastDigitCallerIdNumber" ng-model="vm.ivrCampaign.dialRandomLastDigitCallerIdNumber" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RANDOMLASTDIGITCALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$error" ng-show="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_REQUIRED">RandomLastDigitCallerIdNumber field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_LESS_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATETIMEOUT">OriginateTimeout</label>\n                <input type="number" name="dialOriginateTimeout" ng-model="vm.ivrCampaign.dialOriginateTimeout" min="1" max="999" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATETIMEOUT"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateTimeout\'].$error" ng-show="originateForm[\'dialOriginateTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_REQUIRED">OriginateTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.PREFIX">Prefix</label>\n                <input type="text" name="dialPrefix" ng-model="vm.ivrCampaign.dialPrefix" ng-pattern="/^\\d+$/" value="" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREFIX"></span></div>\n                <div ng-messages="originateForm[\'dialPrefix\'].$error" ng-show="originateForm[\'dialPrefix\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_MUST_VALID_PATTERN" translate-values="{ regex: \'/^\\d+$/\' }">Prefix must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.RETRYANDFREQUENCY">RETRYANDFREQUENCY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container global md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBAL">GLOBAL</div>\n            </div>\n            <form name="globalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALMAXRETRY">GlobalMaxRetry</label>\n                <input type="number" name="dialGlobalMaxRetry" ng-model="vm.ivrCampaign.dialGlobalMaxRetry" min="1" max="999" value="4" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALMAXRETRY"></span></div>\n                <div ng-messages="globalForm[\'dialGlobalMaxRetry\'].$error" ng-show="globalForm[\'dialGlobalMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_REQUIRED">GlobalMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container congestion md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CONGESTION">CONGESTION</div>\n            </div>\n            <form name="congestionForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONMAXRETRY">CongestionMaxRetry</label>\n                <input type="number" name="dialCongestionMaxRetry" ng-model="vm.ivrCampaign.dialCongestionMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONMAXRETRY"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionMaxRetry\'].$error" ng-show="congestionForm[\'dialCongestionMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_REQUIRED">CongestionMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONRETRYTIME">CongestionRetryTime</label>\n                <input type="number" name="dialCongestionRetryFrequency" ng-model="vm.ivrCampaign.dialCongestionRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONRETRYTIME"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionRetryFrequency\'].$error" ng-show="congestionForm[\'dialCongestionRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_REQUIRED">CongestionRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container busy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.BUSY">BUSY</div>\n            </div>\n            <form name="busyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYMAXRETRY">BusyMaxRetry</label>\n                <input type="number" name="dialBusyMaxRetry" ng-model="vm.ivrCampaign.dialBusyMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYMAXRETRY"></span></div>\n                <div ng-messages="busyForm[\'dialBusyMaxRetry\'].$error" ng-show="busyForm[\'dialBusyMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_REQUIRED">BusyMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYRETRYTIME">BusyRetryTime</label>\n                <input type="number" name="dialBusyRetryFrequency" ng-model="vm.ivrCampaign.dialBusyRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYRETRYTIME"></span></div>\n                <div ng-messages="busyForm[\'dialBusyRetryFrequency\'].$error" ng-show="busyForm[\'dialBusyRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_REQUIRED">BusyRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container noanswer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOANSWER">NOANSWER</div>\n            </div>\n            <form name="noanswerForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERMAXRETRY">NoAnswerMaxRetry</label>\n                <input type="number" name="dialNoAnswerMaxRetry" ng-model="vm.ivrCampaign.dialNoAnswerMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERMAXRETRY"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerMaxRetry\'].$error" ng-show="noanswerForm[\'dialNoAnswerMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_REQUIRED">NoAnswerMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERRETRYTIME">NoAnswerRetryTime</label>\n                <input type="number" name="dialNoAnswerRetryFrequency" ng-model="vm.ivrCampaign.dialNoAnswerRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERRETRYTIME"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerRetryFrequency\'].$error" ng-show="noanswerForm[\'dialNoAnswerRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_REQUIRED">NoAnswerRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container nosuchnumber md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOSUCHNUMBER">NOSUCHNUMBER</div>\n            </div>\n            <form name="nosuchnumberForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERMAXRETRY">NoSuchNumberMaxRetry</label>\n                <input type="number" name="dialNoSuchNumberMaxRetry" ng-model="vm.ivrCampaign.dialNoSuchNumberMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERMAXRETRY"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_REQUIRED">NoSuchNumberMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERRETRYTIME">NoSuchNumberRetryTime</label>\n                <input type="number" name="dialNoSuchNumberRetryFrequency" ng-model="vm.ivrCampaign.dialNoSuchNumberRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERRETRYTIME"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_REQUIRED">NoSuchNumberRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container drop md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.DROP">DROP</div>\n            </div>\n            <form name="dropForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPMAXRETRY">DropMaxRetry</label>\n                <input type="number" name="dialDropMaxRetry" ng-model="vm.ivrCampaign.dialDropMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPMAXRETRY"></span></div>\n                <div ng-messages="dropForm[\'dialDropMaxRetry\'].$error" ng-show="dropForm[\'dialDropMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_REQUIRED">DropMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPRETRYTIME">DropRetryTime</label>\n                <input type="number" name="dialDropRetryFrequency" ng-model="vm.ivrCampaign.dialDropRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPRETRYTIME"></span></div>\n                <div ng-messages="dropForm[\'dialDropRetryFrequency\'].$error" ng-show="dropForm[\'dialDropRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_REQUIRED">DropRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container abandoned md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ABANDONED">ABANDONED</div>\n            </div>\n            <form name="abandonedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDMAXRETRY">AbandonedMaxRetry</label>\n                <input type="number" name="dialAbandonedMaxRetry" ng-model="vm.ivrCampaign.dialAbandonedMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDMAXRETRY"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedMaxRetry\'].$error" ng-show="abandonedForm[\'dialAbandonedMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_REQUIRED">AbandonedMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDRETRYTIME">AbandonedRetryTime</label>\n                <input type="number" name="dialAbandonedRetryFrequency" ng-model="vm.ivrCampaign.dialAbandonedRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDRETRYTIME"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedRetryFrequency\'].$error" ng-show="abandonedForm[\'dialAbandonedRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_REQUIRED">AbandonedRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container machine md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.MACHINE">MACHINE</div>\n            </div>\n            <form name="machineForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINEMAXRETRY">MachineMaxRetry</label>\n                <input type="number" name="dialMachineMaxRetry" ng-model="vm.ivrCampaign.dialMachineMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINEMAXRETRY"></span></div>\n                <div ng-messages="machineForm[\'dialMachineMaxRetry\'].$error" ng-show="machineForm[\'dialMachineMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_REQUIRED">MachineMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINERETRYTIME">MachineRetryTime</label>\n                <input type="number" name="dialMachineRetryFrequency" ng-model="vm.ivrCampaign.dialMachineRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINERETRYTIME"></span></div>\n                <div ng-messages="machineForm[\'dialMachineRetryFrequency\'].$error" ng-show="machineForm[\'dialMachineRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_REQUIRED">MachineRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container agentreject md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AGENTREJECT">AGENTREJECT</div>\n            </div>\n            <form name="agentrejectForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTMAXRETRY">AgentRejectMaxRetry</label>\n                <input type="number" name="dialAgentRejectMaxRetry" ng-model="vm.ivrCampaign.dialAgentRejectMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTMAXRETRY"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectMaxRetry\'].$error" ng-show="agentrejectForm[\'dialAgentRejectMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_REQUIRED">AgentRejectMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTRETRYTIME">AgentRejectRetryTime</label>\n                <input type="number" name="dialAgentRejectRetryFrequency" ng-model="vm.ivrCampaign.dialAgentRejectRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTRETRYTIME"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$error" ng-show="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_REQUIRED">AgentRejectRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALORDERBYSCHEDULEDAT">DialOrderByScheduledAt</label>\n                <md-select name="dialOrderByScheduledAt" ng-model="vm.ivrCampaign.dialOrderByScheduledAt" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'DESC\'"> {{ \'MOTIONDIALER.DESC\' | translate }} </md-option>\n\n                  <md-option ng-value="\'ASC\'"> {{ \'MOTIONDIALER.ASC\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALORDERBYSCHEDULEDAT"></span></div>\n                <div ng-messages="advancedForm[\'dialOrderByScheduledAt\'].$error" ng-show="advancedForm[\'dialOrderByScheduledAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALORDERBYSCHEDULEDAT_REQUIRED">DialOrderByScheduledAt field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container globalinterval md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBALINTERVAL">GLOBALINTERVAL</div>\n            </div>\n            <form name="globalintervalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALINTERVAL">GlobalInterval</label>\n                <input type="text" name="dialGlobalInterval" ng-model="vm.ivrCampaign.dialGlobalInterval" value="07:00-22:00,*,*,*" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALINTERVAL"></span></div>\n                <div ng-messages="globalintervalForm[\'dialGlobalInterval\'].$error" ng-show="globalintervalForm[\'dialGlobalInterval\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALINTERVAL_REQUIRED">GlobalInterval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container timezone md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.TIMEZONE">TIMEZONE</div>\n            </div>\n            <form name="timezoneForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TIMEZONE">Timezone</label>\n                <ms-timezone name="dialTimezone" ng-model="vm.ivrCampaign.dialTimezone" autofocus ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEZONE"></span></div>\n                <div ng-messages="timezoneForm[\'dialTimezone\'].$error" ng-show="timezoneForm[dialTimezone].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container amd md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AMD">AMD</div>\n            </div>\n            <form name="amdForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.ivrCampaign.dialAMDActive" aria-label="AMDActive" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AMDACTIVE">AMDActive</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDACTIVE"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDINITIALSILENCE">AMDInitialSilence</label>\n                <input type="number" name="dialAMDInitialSilence" ng-model="vm.ivrCampaign.dialAMDInitialSilence" min="0" value="2500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDINITIALSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDInitialSilence\'].$error" ng-show="amdForm[\'dialAMDInitialSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_REQUIRED">AMDInitialSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDInitialSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDGREETING">AMDGreeting</label>\n                <input type="number" name="dialAMDGreeting" ng-model="vm.ivrCampaign.dialAMDGreeting" min="0" value="1500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDGREETING"></span></div>\n                <div ng-messages="amdForm[\'dialAMDGreeting\'].$error" ng-show="amdForm[\'dialAMDGreeting\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_REQUIRED">AMDGreeting field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDGreeting must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDAFTERGREETINGSILENCE">AMDAfterGreetingSilence</label>\n                <input type="number" name="dialAMDAfterGreetingSilence" ng-model="vm.ivrCampaign.dialAMDAfterGreetingSilence" min="0" value="800" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDAFTERGREETINGSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDAfterGreetingSilence\'].$error" ng-show="amdForm[\'dialAMDAfterGreetingSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_REQUIRED">AMDAfterGreetingSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDAfterGreetingSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDTOTALANALYSISTIME">AMDTotalAnalysisTime</label>\n                <input type="number" name="dialAMDTotalAnalysisTime" ng-model="vm.ivrCampaign.dialAMDTotalAnalysisTime" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDTOTALANALYSISTIME"></span></div>\n                <div ng-messages="amdForm[\'dialAMDTotalAnalysisTime\'].$error" ng-show="amdForm[\'dialAMDTotalAnalysisTime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_REQUIRED">AMDTotalAnalysisTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDTotalAnalysisTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMINWORDLENGTH">AMDMinWordLength</label>\n                <input type="number" name="dialAMDMinWordLength" ng-model="vm.ivrCampaign.dialAMDMinWordLength" min="0" value="100" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMINWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMinWordLength\'].$error" ng-show="amdForm[\'dialAMDMinWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_REQUIRED">AMDMinWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMinWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDBETWEENWORDSSILENCE">AMDBetweenWordsSilence</label>\n                <input type="number" name="dialAMDBetweenWordsSilence" ng-model="vm.ivrCampaign.dialAMDBetweenWordsSilence" min="0" value="50" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDBETWEENWORDSSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDBetweenWordsSilence\'].$error" ng-show="amdForm[\'dialAMDBetweenWordsSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_REQUIRED">AMDBetweenWordsSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDBetweenWordsSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMNUMBEROFWORDS">AMDMaximumNumberOfWords</label>\n                <input type="number" name="dialAMDMaximumNumberOfWords" ng-model="vm.ivrCampaign.dialAMDMaximumNumberOfWords" min="0" value="3" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMNUMBEROFWORDS"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumNumberOfWords\'].$error" ng-show="amdForm[\'dialAMDMaximumNumberOfWords\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_REQUIRED">AMDMaximumNumberOfWords field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumNumberOfWords must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDSILENCETHRESHOLD">AMDSilenceThreshold</label>\n                <input type="number" name="dialAMDSilenceThreshold" ng-model="vm.ivrCampaign.dialAMDSilenceThreshold" min="0" max="32767" value="256" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDSILENCETHRESHOLD"></span></div>\n                <div ng-messages="amdForm[\'dialAMDSilenceThreshold\'].$error" ng-show="amdForm[\'dialAMDSilenceThreshold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_REQUIRED">AMDSilenceThreshold field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_LESS_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>32767</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMWORDLENGTH">AMDMaximumWordLength</label>\n                <input type="number" name="dialAMDMaximumWordLength" ng-model="vm.ivrCampaign.dialAMDMaximumWordLength" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumWordLength\'].$error" ng-show="amdForm[\'dialAMDMaximumWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_REQUIRED">AMDMaximumWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HOPPERS">HOPPERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperstatistics md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperStatisticsController as vm_hs" ng-init="vm_hs.init(vm.ivrCampaign)">\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERWIDGET">Hoppers</span>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_hs.init(vm.ivrCampaign)" aria-label="refresh Hopper" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              \x3c!-- WIDGET GROUP --\x3e\n              <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n                \x3c!-- WIDGET 1 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{(vm_hs.total || 0) + (vm_hs.closed || 0)}}</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.TOTAL\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 1 --\x3e\n\n                \x3c!-- WIDGET 2 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.fresh || 0}} ({{vm_hs.total ? ((((vm_hs.fresh || 0) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.FRESH\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 2 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.total ? (vm_hs.total - (vm_hs.fresh || 0)) : 0}} ({{vm_hs.total ? ((((vm_hs.total - (vm_hs.fresh || 0)) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.OPEN\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.closed ? (vm_hs.closed || 0) : 0}} ({{vm_hs.closed ? ((((vm_hs.closed) * 100)/(vm_hs.closed + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.CLOSED\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n              </div>\n              \x3c!-- / WIDGET GROUP --\x3e\n            </div>\n\n          </div>\n          <div class="ivrCampaign-detail-form-container hoppers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHoppersController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERS">Hoppers</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHoppers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getIvrCampaignHoppers()" aria-label="refresh Hoppers" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHoppers.length}} {{vm_dc.selectedIvrCampaignHoppers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHoppers" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedIvrCampaignHoppers($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHoppers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHoppers">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="priority">\n                        {{ \'MOTIONDIALER.PRIORITY\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopper" md-select-id="id" ng-repeat="hopper in vm_dc.ivrCampaignHoppers.rows">\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.ContactId}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell privacy ng-cloak>\n                        {{hopper.phone}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countcongestionretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countbusyretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnoanswerretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnosuchnumberretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countdropretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countabandonedretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countmachineretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countagentrejectretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{ hopper.scheduledat | formatdate }}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{ vm_dc.arraypriority[hopper.priority].option }} </td>\n\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" translate="MOTIONDIALER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(hopper, $event)" translate="MOTIONDIALER.DELETE_HOPPER">\n                                Delete Hopper\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHoppers.rows.length">\n                      <td md-cell colspan="15">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPER_AVAILABLE">No hopper available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHoppers.count}}" md-on-paginate="vm_dc.getIvrCampaignHoppers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HISTORY">HISTORY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperhistories md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperHistoriesController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERHISTORIES">HopperHistories</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHopperHistories()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getIvrCampaignHopperHistories()" aria-label="refresh HopperHistories" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERHISTORIES">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHopperHistories.length}} {{vm_dc.selectedIvrCampaignHopperHistories.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHopperHistories" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHopperHistories" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHopperHistories">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperHistory" md-select-id="id" ng-repeat="hopperHistory in vm_dc.ivrCampaignHopperHistories.rows">\n                      <td md-cell>\n                        {{hopperHistory.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.scheduledat | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.endtime | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHopperHistories.rows.length">\n                      <td md-cell colspan="11">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERHISTORY_AVAILABLE">No hopperhistory available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHopperHistories.count}}" md-on-paginate="vm_dc.getIvrCampaignHopperHistories" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.FINAL">FINAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperfinals md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperFinalsController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERFINALS">HopperFinals</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHopperFinals()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getIvrCampaignHopperFinals()" aria-label="refresh HopperFinals" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERFINALS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                  <td md-cell class="actions">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="vm_dc.countContactsIvrCampaignHopperFinal(vm_dc.query.id); $mdOpenMenu($event);">\n                        <md-icon md-font-icon="icon-backup-restore"></md-icon>\n                        <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(3)">\n                            <span translate="MOTIONDIALER.NOANSWER ">NoAnswer</span>\n                            <span class="badge">({{vm_dc.contacts.noAnswerContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(5)">\n                            <span translate="MOTIONDIALER.BUSY ">Busy</span>\n                            <span class="badge">({{vm_dc.contacts.busyContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(8)">\n                            <span translate="MOTIONDIALER.CONGESTION ">Congestion</span>\n                            <span class="badge">({{vm_dc.contacts.congestionContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(10)">\n                            <span translate="MOTIONDIALER.DROPPED ">Drop</span>\n                            <span class="badge">({{vm_dc.contacts.dropContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(11)">\n                            <span translate="MOTIONDIALER.ABANDONED ">Abandoned</span>\n                            <span class="badge">({{vm_dc.contacts.abandonedContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(22)">\n                            <span translate="MOTIONDIALER.RECALLFAILEDTIMEOUT">Recall</span>\n                            <span class="badge">({{vm_dc.contacts.reCallContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(0)">\n                            <span translate="MOTIONDIALER.NO_SUCH_NUMBER">NoSuchNumber</span>\n                            <span class="badge">({{vm_dc.contacts.noSuchContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item>\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(19)">\n                            <span translate="MOTIONDIALER.ANSWERING_MACHINE">AnsweringMachine</span>\n                            <span class="badge">({{vm_dc.contacts.answeringMachine}})</span>\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHopperFinals.length}} {{vm_dc.selectedIvrCampaignHopperFinals.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHopperFinals" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.moveSelectedIvrCampaignHopperFinals($event)" aria-label="move selected" translate translate-attr-label="MOTIONDIALER.MOVE_SELECTED">\n                    <md-icon md-font-icon="icon-restore"></md-icon>\n                    <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHopperFinals" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHopperFinals">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="disposition">\n                        {{ \'MOTIONDIALER.DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperFinal" md-select-id="id" ng-repeat="hopperFinal in vm_dc.ivrCampaignHopperFinals.rows">\n                      <td md-cell>\n                        {{hopperFinal.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countcongestionretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countbusyretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnoanswerretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnosuchnumberretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countdropretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countabandonedretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countmachineretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countagentrejectretry}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.endtime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.disposition}}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.moveConfirm(hopperFinal, $event)" translate="MOTIONDIALER.MOVE_HOPPERFINAL">\n                                Move HopperFinal\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHopperFinals.rows.length">\n                      <td md-cell colspan="28">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERFINAL_AVAILABLE">No hopperfinal available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHopperFinals.count}}" md-on-paginate="vm_dc.getIvrCampaignHopperFinals" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.BLACKLIST">BLACKLIST</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperblacks md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperBlacksController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERBLACKS">HopperBlacks</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHopperBlacks()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHopperBlacks.length}} {{vm_dc.selectedIvrCampaignHopperBlacks.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHopperBlacks" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHopperBlacks" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHopperBlacks">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperBlack" md-select-id="id" ng-repeat="hopperBlack in vm_dc.ivrCampaignHopperBlacks.rows">\n                      <td md-cell>\n                        {{hopperBlack.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperBlack.phone}}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHopperBlacks.rows.length">\n                      <td md-cell colspan="4">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERBLACK_AVAILABLE">No hopperblack available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHopperBlacks.count}}" md-on-paginate="vm_dc.getIvrCampaignHopperBlacks" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/ivrCampaigns.html",'<div id="ivrCampaigns" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-fire" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MOTIONDIALER.IVRCAMPAIGNS">IvrCampaigns</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MOTIONDIALER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedIvrCampaigns.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedIvrCampaigns =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MOTIONDIALER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-ivrCampaigns-count">\n          <span>{{vm.selectedIvrCampaigns.length}}</span>\n          <span translate="MOTIONDIALER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MOTIONDIALER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllIvrCampaigns()" translate="MOTIONDIALER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectIvrCampaigns()" translate="MOTIONDIALER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedIvrCampaigns" csv-label="true" filename="ivrCampaigns.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedIvrCampaigns($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- IVRCAMPAIGN TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedIvrCampaigns" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getIvrCampaigns">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MOTIONDIALER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'MOTIONDIALER.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="TrunkId">{{ \'MOTIONDIALER.TRUNK\' | translate }}</th>\n                <th md-column md-order-by="SquareProjectId">{{ \'MOTIONDIALER.CALLYSQUAREPROJECT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.ivrCampaigns.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="ivrCampaign" md-select-id="id" ng-repeat="ivrCampaign in vm.ivrCampaigns.rows">\n                <td md-cell ng-if="ivrCampaign.userpic"><img class="avatar" alt="{{ivrCampaign.name}}" ng-src="api/users/{{ivrCampaign.id}}/avatar" /></td>\n                <td md-cell ng-if="!ivrCampaign.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{ivrCampaign.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="id ">{{ivrCampaign.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="name ">{{ivrCampaign.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{ivrCampaign.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{ivrCampaign.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="TrunkId ">{{ (vm.trunks | filter : {\'id\':ivrCampaign.TrunkId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="SquareProjectId ">{{ (vm.projects | filter : {\'id\':ivrCampaign.SquareProjectId} : true)[0].name }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(ivrCampaign, $event    )" translate="MOTIONDIALER.EDIT_IVRCAMPAIGN">\n                          Edit IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(ivrCampaign, $event    )" translate="MOTIONDIALER.CLONE_IVRCAMPAIGN">\n                          clone IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.listadddialog(ivrCampaign, $event    )" translate="MOTIONDIALER.LISTADD_IVRCAMPAIGN">\n                          listadd IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.blacklistadddialog(ivrCampaign, $event    )" translate="MOTIONDIALER.BLACKLISTADD_IVRCAMPAIGN">\n                          blacklistadd IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(ivrCampaign, $event    )" translate="MOTIONDIALER.DELETE_IVRCAMPAIGN">\n                          Delete IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(ivrCampaign, $event    )" translate="MOTIONDIALER.GOTOREALTIME_IVRCAMPAIGN">\n                          goToRealtime IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.ivrCampaigns.count}}" md-on-paginate="vm.getIvrCampaigns" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / IVRCAMPAIGN TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD IVRCAMPAIGN BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-ivrCampaign-button" ng-click="vm.createOrEditIvrCampaign($event)" aria-label="add ivrCampaign" translate translate-attr-aria-label="MOTIONDIALER.ADD_IVRCAMPAIGN">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD IVRCAMPAIGN BUTTON --\x3e\n</div>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/create/dialog.html",'<md-dialog class="queueCampaign-dialog" aria-label="New QueueCampaign">\n  <form name="queueCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.queueCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newQueueCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="queueCampaignForm[\'name\'].$error" ng-show="queueCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.queueCampaign.dialActive" aria-label="Active"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n        <md-select name="TrunkId" ng-model="vm.queueCampaign.TrunkId" required>\n          <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n        </md-select>\n        <div ng-messages="queueCampaignForm[\'TrunkId\'].$error" ng-show="queueCampaignForm[\'TrunkId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n        <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n        <md-select name="IntervalId" ng-model="vm.queueCampaign.IntervalId" required>\n          <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n        </md-select>\n        <div ng-messages="queueCampaignForm[\'IntervalId\'].$error" ng-show="queueCampaignForm[\'IntervalId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n        <md-select name="dialCheckDuplicateType" ng-model="vm.queueCampaign.dialCheckDuplicateType" required>\n\n          <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n          <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n          <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="queueCampaignForm[\'dialCheckDuplicateType\'].$error" ng-show="queueCampaignForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.METHOD">Method</label>\n        <md-select name="dialMethod" ng-model="vm.queueCampaign.dialMethod" required>\n          <md-option ng-value="\'progressive\'">Progressive</md-option>\n          <md-option ng-value="\'power\'">PowerDialing</md-option>\n          <md-option ng-value="\'predictive\'">Predictive</md-option>\n          <md-option ng-value="\'preview\'">Preview</md-option>\n          <md-option ng-value="\'booked\'">BookedProgressive</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.METHOD"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialMethod\'].$error" ng-show="queueCampaignForm[\'dialMethod\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.METHOD_REQUIRED">Method field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'power\'" class="md-block">\n        <span translate="MOTIONDIALER.POWERLEVEL">PowerLevel</span>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.POWERLEVEL"></span></div>\n        <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPowerLevel" min="1" max="10" step="0.1" class="md-accent"></md-slider>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n        <label translate="MOTIONDIALER.PREDICTIVEOPTIMIZATION">PredictiveOptimization</label>\n        <md-select name="dialPredictiveOptimization" ng-model="vm.queueCampaign.dialPredictiveOptimization">\n\n          <md-option ng-value="\'agentBusyFactor\'"> {{ \'MOTIONDIALER.AGENTBUSYFACTOR\' | translate }} </md-option>\n\n          <md-option ng-value="\'dropRate\'"> {{ \'MOTIONDIALER.DROPRATE\' | translate }} </md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATION"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialPredictiveOptimization\'].$error" ng-show="queueCampaignForm[\'dialPredictiveOptimization\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PREDICTIVEOPTIMIZATION_REQUIRED">PredictiveOptimization field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n        <span translate="MOTIONDIALER.PREDICTIVEOPTIMIZATIONPERCENTAGE">PredictiveOptimizationPercentage</span>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATIONPERCENTAGE"></span></div>\n        <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveOptimizationPercentage" min="1" max="95" step="0.1" class="md-accent"></md-slider>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n        <span translate="MOTIONDIALER.PREDICTIVEINTERVAL">PredictiveInterval</span>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEINTERVAL"></span></div>\n        <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveInterval" min="5" max="30" step="1" class="md-accent"></md-slider>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n        <label translate="MOTIONDIALER.MAXCONCURRENTCALLS">MaxConcurrentCalls</label>\n        <input type="number" name="dialLimitQueue" ng-model="vm.queueCampaign.dialLimitQueue" min="0" max="9999" value="0" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.MAXCONCURRENTCALLS"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialLimitQueue\'].$error" ng-show="queueCampaignForm[\'dialLimitQueue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_REQUIRED">MaxConcurrentCalls field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>9999</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n        <label translate="MOTIONDIALER.QUEUETIMEOUT">QueueTimeout</label>\n        <input type="number" name="dialQueueTimeout" ng-model="vm.queueCampaign.dialQueueTimeout" min="1" max="999" value="3" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.QUEUETIMEOUT"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialQueueTimeout\'].$error" ng-show="queueCampaignForm[\'dialQueueTimeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_REQUIRED">QueueTimeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>999</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.AGENTTIMEOUT">AgentTimeout</label>\n        <input type="number" name="timeout" ng-model="vm.queueCampaign.timeout" min="0" value="3" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTTIMEOUT"></span></div>\n        <div ng-messages="queueCampaignForm[\'timeout\'].$error" ng-show="queueCampaignForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_REQUIRED">AgentTimeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentTimeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.queueCampaign.description">\n\n        <div ng-messages="queueCampaignForm[\'description\'].$error" ng-show="queueCampaignForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newQueueCampaign" ng-click="vm.saveQueueCampaign()" class="send-button md-accent md-raised" ng-disabled="queueCampaignForm.$invalid || queueCampaignForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newQueueCampaign" ng-click="vm.addNewQueueCampaign()" class="send-button md-accent md-raised" ng-disabled="queueCampaignForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_QUEUECAMPAIGN" translate-attr-aria-label="MOTIONDIALER.ADD_QUEUECAMPAIGN">\n          ADD QUEUECAMPAIGN\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newQueueCampaign" ng-click="vm.deleteQueueCampaign($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.AGENTADD_QUEUECAMPAIGN">Add Agent to queueCampaign</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="MOTIONDIALER.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="queueCampaignForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.BLACKLISTADD_QUEUECAMPAIGN">Add List in QUEUECAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",'<md-dialog class="queueCampaign-dialog" aria-label="Clone QueueCampaign">\n  <form name="queueCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.queueCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newQueueCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="queueCampaignForm[\'name\'].$error" ng-show="queueCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.queueCampaign.dialActive" aria-label="Active"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneQueueCampaign()" class="send-button md-accent md-raised" ng-disabled="queueCampaignForm.$invalid" aria-label="CLONE" translate="MOTIONDIALER.CLONE_QUEUECAMPAIGN" translate-attr-aria-label="MOTIONDIALER.CLONE_QUEUECAMPAIGN">\n        CLONE QUEUECAMPAIGN\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/hoppers/dialog.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <label translate="MOTIONDIALER.SCHEDULEDAT">ScheduledAt</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.dateTime" ng-change="vm.recalcTZTime()">\n              <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.dateTime" ng-change="vm.recalcTZTime()">\n              <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <div layout="row">\n        <div flex class="md-block">\n          <md-input-container class="md-block" flex-gt-sm="">\n            <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n            <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" autofocus>\n          </md-input-container>\n        </div>\n        <div flex class="md-block">\n          <md-input-container class="md-block">\n            <label translate="DASHBOARDS.SYSTEM_TIME">System time</label>\n            <input type="text" readonly value="{{vm.hopper.scheduledat}}">\n          </md-input-container>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.PRIORITY">Priority</label>\n        <md-select name="priority" ng-model="vm.hopper.priority">\n          <md-option ng-value="\'4\'">Highest</md-option>\n          <md-option ng-value="\'3\'">High</md-option>\n          <md-option ng-value="\'2\'">Medium</md-option>\n          <md-option ng-value="\'1\'">Low</md-option>\n          <md-option ng-value="\'0\'">Lowest</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PRIORITY"></span></div>\n        <div ng-messages="hopperForm[\'priority\'].$error" ng-show="hopperForm[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.hopper.recallme" aria-label="RecallAgent"><span translate="MOTIONDIALER.RECALLAGENT">RecallAgent</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.hopper.recallme" class="md-block">\n        <label translate="MOTIONDIALER.AGENT">Agent</label>\n        <md-select name="UserId" ng-model="vm.hopper.UserId" required>\n          <md-option ng-value="UserId.id" ng-repeat="UserId in vm.agents" ng-disabled="UserId.canSelect === false">{{ UserId.name }}</md-option>\n        </md-select>\n        <div ng-messages="hopperForm[\'UserId\'].$error" ng-show="hopperForm[\'UserId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_HOPPER" translate-attr-aria-label="MOTIONDIALER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.LISTADD_QUEUECAMPAIGN">Add List in QUEUECAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/resetlist/resetlist.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.RESETLIST ">Reset List</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-disabled="vm.loading" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-hide="vm.loading">\n      <div layout="row" layout-wrap flex>\n        <div flex-xs flex="50">\n          <md-checkbox aria-label="Select All" ng-checked="vm.isChecked()" md-indeterminate="vm.isIndeterminate()" ng-click="vm.toggleAll()">\n            <span ng-if="vm.isChecked()" translate="MOTIONDIALER.UNSELECTALL"></span>\n            <span ng-if="!vm.isChecked()" translate="MOTIONDIALER.SELECTALL"></span>\n          </md-checkbox>\n        </div>\n        <div flex-xs flex="50">\n        </div>\n        <div flex="{{vm.items.length > 10 ? 50 : 100 }}" ng-repeat="item in vm.items">\n          <md-checkbox ng-checked="vm.exists(item, vm.selected)" ng-click="vm.toggle(item, vm.selected)">\n            {{ item.name | limitTo:40 }}\n          </md-checkbox>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions ng-hide="vm.loading" layout="row" layout-align="end center">\n      <div>\n      </div>\n      <md-button type="submit" ng-click="vm.listSelected()" class="send-button md-accent md-raised" ng-disabled="vm.loading" aria-label="RESET" translate="MOTIONDIALER.RESET" translate-attr-aria-label="MOTIONDIALER.RESET">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n    <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n      <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n    </div>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="MOTIONDIALER.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="queueCampaignForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/view.html",'<div id="motiondialer-queueCampaign" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-queueCampaigns-button md-icon-button" aria-label="Go to queueCampaigns" ng-click="vm.gotoQueueCampaigns()" translate translate-attr-aria-label="MOTIONDIALER.GO_TO_QUEUECAMPAIGNS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="queueCampaign-image" hide-xs>\n          <img ng-src="assets/images/business/queueCampaigns.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.queueCampaign.id}}\n            <span ng-if="vm.queueCampaign.name">{{vm.queueCampaign.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MOTIONDIALER.CREATED_AT"></span> <span>{{vm.queueCampaign.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.queueCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="MOTIONDIALER.CLONE_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.listadddialog(vm.queueCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="listadd">\n        <md-tooltip><span translate="MOTIONDIALER.LISTADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-format-list-numbers"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.blacklistadddialog(vm.queueCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="blacklistadd">\n        <md-tooltip><span translate="MOTIONDIALER.BLACKLISTADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-block-helper"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.queueCampaign, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="MOTIONDIALER.TEAMADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.queueCampaign, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="MOTIONDIALER.AGENTADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.resetlistdialog(vm.queueCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="resetlist">\n        <md-tooltip><span translate="MOTIONDIALER.RESETLIST_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-restore"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.queueCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="MOTIONDIALER.GOTO_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveQueueCampaign()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (campaignForm.$invalid) || (queueForm.$invalid) || (originateForm.$invalid) || (globalForm.$invalid) || (congestionForm.$invalid) || (busyForm.$invalid) || (noanswerForm.$invalid) || (nosuchnumberForm.$invalid) || (dropForm.$invalid) || (abandonedForm.$invalid) || (machineForm.$invalid) || (agentrejectForm.$invalid) || (additionalphonesForm.$invalid) || (advancedForm.$invalid) || (advancedpreviewForm.$invalid) || (thresholdsForm.$invalid) || (recallmeForm.$invalid) || (globalintervalForm.$invalid) || (timezoneForm.$invalid) || (amdForm.$invalid) || (hopperStatisticsForm.$invalid) || (hoppersForm.$invalid) || (hopperHistoriesForm.$invalid) || (hopperFinalsForm.$invalid) || (hopperBlacksForm.$invalid)" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.queueCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialActive" aria-label="Active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n                <md-select name="TrunkId" ng-model="vm.queueCampaign.TrunkId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkId\'].$error" ng-show="generalForm[\'TrunkId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BACKUPTRUNK">BackupTrunk</label>\n                <md-select name="TrunkBackupId" ng-model="vm.queueCampaign.TrunkBackupId" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="TrunkBackupId.id" ng-repeat="TrunkBackupId in vm.trunks" ng-disabled="TrunkBackupId.canSelect === false">{{ TrunkBackupId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkBackupId\'].$error" ng-show="generalForm[\'TrunkBackupId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BACKUPTRUNK_REQUIRED">BackupTrunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n                <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n                <md-select name="IntervalId" ng-model="vm.queueCampaign.IntervalId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'IntervalId\'].$error" ng-show="generalForm[\'IntervalId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n                <md-select name="dialCheckDuplicateType" ng-model="vm.queueCampaign.dialCheckDuplicateType" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n                  <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'dialCheckDuplicateType\'].$error" ng-show="generalForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CUTDIGIT">CutDigit</label>\n                <input type="number" name="dialCutDigit" ng-model="vm.queueCampaign.dialCutDigit" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'dialCutDigit\'].$error" ng-show="generalForm[\'dialCutDigit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_REQUIRED">CutDigit field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_LESS_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.queueCampaign.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container campaign md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</div>\n            </div>\n            <form name="campaignForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.METHOD">Method</label>\n                <md-select name="dialMethod" ng-model="vm.queueCampaign.dialMethod" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'progressive\'">Progressive</md-option>\n                  <md-option ng-value="\'power\'">PowerDialing</md-option>\n                  <md-option ng-value="\'predictive\'">Predictive</md-option>\n                  <md-option ng-value="\'preview\'">Preview</md-option>\n                  <md-option ng-value="\'booked\'">BookedProgressive</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.METHOD"></span></div>\n                <div ng-messages="campaignForm[\'dialMethod\'].$error" ng-show="campaignForm[\'dialMethod\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.METHOD_REQUIRED">Method field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'power\'" class="md-block">\n                <span translate="MOTIONDIALER.POWERLEVEL">PowerLevel</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.POWERLEVEL"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPowerLevel" min="1" max="10" step="0.1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <label translate="MOTIONDIALER.PREDICTIVEOPTIMIZATION">PredictiveOptimization</label>\n                <md-select name="dialPredictiveOptimization" ng-model="vm.queueCampaign.dialPredictiveOptimization" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'agentBusyFactor\'"> {{ \'MOTIONDIALER.AGENTBUSYFACTOR\' | translate }} </md-option>\n\n                  <md-option ng-value="\'dropRate\'"> {{ \'MOTIONDIALER.DROPRATE\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATION"></span></div>\n                <div ng-messages="campaignForm[\'dialPredictiveOptimization\'].$error" ng-show="campaignForm[\'dialPredictiveOptimization\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.PREDICTIVEOPTIMIZATION_REQUIRED">PredictiveOptimization field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEOPTIMIZATIONPERCENTAGE">PredictiveOptimizationPercentage</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATIONPERCENTAGE"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveOptimizationPercentage" min="1" max="95" step="0.1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEINTERVAL">PredictiveInterval</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEINTERVAL"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveInterval" min="5" max="30" step="1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n                <label translate="MOTIONDIALER.MAXCONCURRENTCALLS">MaxConcurrentCalls</label>\n                <input type="number" name="dialLimitQueue" ng-model="vm.queueCampaign.dialLimitQueue" min="0" max="9999" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MAXCONCURRENTCALLS"></span></div>\n                <div ng-messages="campaignForm[\'dialLimitQueue\'].$error" ng-show="campaignForm[\'dialLimitQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_REQUIRED">MaxConcurrentCalls field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>9999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTTIMEOUT">AgentTimeout</label>\n                <input type="number" name="timeout" ng-model="vm.queueCampaign.timeout" min="0" value="3" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTTIMEOUT"></span></div>\n                <div ng-messages="campaignForm[\'timeout\'].$error" ng-show="campaignForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_REQUIRED">AgentTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentTimeout must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container queue md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.QUEUE">QUEUE</div>\n            </div>\n            <form name="queueForm" novalidate>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.QUEUEOPTIONS">QueueOptions</label>\n                <input type="text" name="dialQueueOptions" ng-model="vm.queueCampaign.dialQueueOptions" value="tTxX" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="queueForm[\'dialQueueOptions\'].$error" ng-show="queueForm[\'dialQueueOptions\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUEOPTIONS_REQUIRED">QueueOptions field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.QUEUETIMEOUT">QueueTimeout</label>\n                <input type="number" name="dialQueueTimeout" ng-model="vm.queueCampaign.dialQueueTimeout" min="1" max="999" value="3" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.QUEUETIMEOUT"></span></div>\n                <div ng-messages="queueForm[\'dialQueueTimeout\'].$error" ng-show="queueForm[\'dialQueueTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_REQUIRED">QueueTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'booked\' || vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.queueCampaign.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'rrmemory\'">Round Robin Memory</md-option>\n                  <md-option ng-value="\'roundrobin\'" ng-if="vm.queueCampaign.dialMethod === \'booked\'">Round Robin</md-option>\n                  <md-option ng-value="\'leastrecent\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Least Recent</md-option>\n                  <md-option ng-value="\'fewestcalls\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Fewest Calls</md-option>\n                  <md-option ng-value="\'random\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Random</md-option>\n                  <md-option ng-value="\'linear\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Linear</md-option>\n                  <md-option ng-value="\'wrandom\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Weight Random</md-option>\n                </md-select>\n                <div ng-messages="queueForm[\'strategy\'].$error" ng-show="queueForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.RETRY">Retry</label>\n                <input type="number" name="retry" ng-model="vm.queueCampaign.retry" min="0" value="3" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RETRY"></span></div>\n                <div ng-messages="queueForm[\'retry\'].$error" ng-show="queueForm[\'retry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RETRY_REQUIRED">Retry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.RETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Retry must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.WRAPUPTIME">WrapupTime</label>\n                <input type="number" name="wrapuptime" ng-model="vm.queueCampaign.wrapuptime" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.WRAPUPTIME"></span></div>\n                <div ng-messages="queueForm[\'wrapuptime\'].$error" ng-show="queueForm[\'wrapuptime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.WRAPUPTIME_REQUIRED">WrapupTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.WRAPUPTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WrapupTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.WEIGHT">Weight</label>\n                <input type="number" name="weight" ng-model="vm.queueCampaign.weight" min="0" value="1" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.WEIGHT"></span></div>\n                <div ng-messages="queueForm[\'weight\'].$error" ng-show="queueForm[\'weight\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.WEIGHT_REQUIRED">Weight field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.WEIGHT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Weight must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.MUSICONHOLD">MusicOnHold</label>\n                <md-select name="musiconhold" ng-model="vm.queueCampaign.musiconhold" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="musiconhold.name" ng-repeat="musiconhold in vm.musiconholds" ng-disabled="musiconhold.canSelect === false">{{ musiconhold.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MUSICONHOLD"></span></div>\n                <div ng-messages="queueForm[\'musiconhold\'].$error" ng-show="queueForm[\'musiconhold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MUSICONHOLD_REQUIRED">MusicOnHold field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECT">CallySquareProject</label>\n                <md-select name="dialQueueProject" ng-model="vm.queueCampaign.dialQueueProject" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject.name" ng-repeat="dialQueueProject in vm.projects" ng-disabled="dialQueueProject.canSelect === false">{{ dialQueueProject.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECT"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject\'].$error" ng-show="queueForm[\'dialQueueProject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT_REQUIRED">CallySquareProject field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECT2">CallySquareProject2</label>\n                <md-select name="dialQueueProject2" ng-model="vm.queueCampaign.dialQueueProject2" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject2.name" ng-repeat="dialQueueProject2 in vm.projects" ng-disabled="dialQueueProject2.canSelect === false">{{ dialQueueProject2.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECT2"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject2\'].$error" ng-show="queueForm[\'dialQueueProject2\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT2_REQUIRED">CallySquareProject2 field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'preview\' || vm.queueCampaign.dialMethod === \'booked\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECTPREVIEW">CallySquareProjectPreview</label>\n                <md-select name="dialQueueProject" ng-model="vm.queueCampaign.dialQueueProject" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject.name" ng-repeat="dialQueueProject in vm.projects" ng-disabled="dialQueueProject.canSelect === false">{{ dialQueueProject.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECTPREVIEW"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject\'].$error" ng-show="queueForm[\'dialQueueProject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECTPREVIEW_REQUIRED">CallySquareProjectPreview field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'preview\' || vm.queueCampaign.dialMethod === \'booked\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECTPREVIEW2">CallySquareProjectPreview2</label>\n                <md-select name="dialQueueProject2" ng-model="vm.queueCampaign.dialQueueProject2" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject2.name" ng-repeat="dialQueueProject2 in vm.projects" ng-disabled="dialQueueProject2.canSelect === false">{{ dialQueueProject2.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECTPREVIEW2"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject2\'].$error" ng-show="queueForm[\'dialQueueProject2\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECTPREVIEW2_REQUIRED">CallySquareProjectPreview2 field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialQueueProject2 && (vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\')" class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialAgiAfterHangupAgent" aria-label="RunIfHangupAgent" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.RUNIFHANGUPAGENT">RunIfHangupAgent</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RUNIFHANGUPAGENT"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container originate md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ORIGINATE">ORIGINATE</div>\n            </div>\n            <form name="originateForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNAME">OriginateCallerIdName</label>\n                <input type="text" name="dialOriginateCallerIdName" ng-model="vm.queueCampaign.dialOriginateCallerIdName" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNAME"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdName\'].$error" ng-show="originateForm[\'dialOriginateCallerIdName\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNAME_REQUIRED">OriginateCallerIdName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNUMBER">OriginateCallerIdNumber</label>\n                <input type="text" name="dialOriginateCallerIdNumber" ng-model="vm.queueCampaign.dialOriginateCallerIdNumber" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdNumber\'].$error" ng-show="originateForm[\'dialOriginateCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNUMBER_REQUIRED">OriginateCallerIdNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.RANDOMLASTDIGITCALLERIDNUMBER">RandomLastDigitCallerIdNumber</label>\n                <input type="number" name="dialRandomLastDigitCallerIdNumber" ng-model="vm.queueCampaign.dialRandomLastDigitCallerIdNumber" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RANDOMLASTDIGITCALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$error" ng-show="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_REQUIRED">RandomLastDigitCallerIdNumber field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_LESS_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATETIMEOUT">OriginateTimeout</label>\n                <input type="number" name="dialOriginateTimeout" ng-model="vm.queueCampaign.dialOriginateTimeout" min="1" max="999" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATETIMEOUT"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateTimeout\'].$error" ng-show="originateForm[\'dialOriginateTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_REQUIRED">OriginateTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.PREFIX">Prefix</label>\n                <input type="text" name="dialPrefix" ng-model="vm.queueCampaign.dialPrefix" ng-pattern="/^\\d+$/" value="" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREFIX"></span></div>\n                <div ng-messages="originateForm[\'dialPrefix\'].$error" ng-show="originateForm[\'dialPrefix\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_MUST_VALID_PATTERN" translate-values="{ regex: \'/^\\d+$/\' }">Prefix must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.RETRYANDFREQUENCY">RETRYANDFREQUENCY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container global md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBAL">GLOBAL</div>\n            </div>\n            <form name="globalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALMAXRETRY">GlobalMaxRetry</label>\n                <input type="number" name="dialGlobalMaxRetry" ng-model="vm.queueCampaign.dialGlobalMaxRetry" min="1" max="999" value="4" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALMAXRETRY"></span></div>\n                <div ng-messages="globalForm[\'dialGlobalMaxRetry\'].$error" ng-show="globalForm[\'dialGlobalMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_REQUIRED">GlobalMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container congestion md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CONGESTION">CONGESTION</div>\n            </div>\n            <form name="congestionForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONMAXRETRY">CongestionMaxRetry</label>\n                <input type="number" name="dialCongestionMaxRetry" ng-model="vm.queueCampaign.dialCongestionMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONMAXRETRY"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionMaxRetry\'].$error" ng-show="congestionForm[\'dialCongestionMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_REQUIRED">CongestionMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONRETRYTIME">CongestionRetryTime</label>\n                <input type="number" name="dialCongestionRetryFrequency" ng-model="vm.queueCampaign.dialCongestionRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONRETRYTIME"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionRetryFrequency\'].$error" ng-show="congestionForm[\'dialCongestionRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_REQUIRED">CongestionRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container busy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.BUSY">BUSY</div>\n            </div>\n            <form name="busyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYMAXRETRY">BusyMaxRetry</label>\n                <input type="number" name="dialBusyMaxRetry" ng-model="vm.queueCampaign.dialBusyMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYMAXRETRY"></span></div>\n                <div ng-messages="busyForm[\'dialBusyMaxRetry\'].$error" ng-show="busyForm[\'dialBusyMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_REQUIRED">BusyMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYRETRYTIME">BusyRetryTime</label>\n                <input type="number" name="dialBusyRetryFrequency" ng-model="vm.queueCampaign.dialBusyRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYRETRYTIME"></span></div>\n                <div ng-messages="busyForm[\'dialBusyRetryFrequency\'].$error" ng-show="busyForm[\'dialBusyRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_REQUIRED">BusyRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container noanswer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOANSWER">NOANSWER</div>\n            </div>\n            <form name="noanswerForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERMAXRETRY">NoAnswerMaxRetry</label>\n                <input type="number" name="dialNoAnswerMaxRetry" ng-model="vm.queueCampaign.dialNoAnswerMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERMAXRETRY"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerMaxRetry\'].$error" ng-show="noanswerForm[\'dialNoAnswerMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_REQUIRED">NoAnswerMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERRETRYTIME">NoAnswerRetryTime</label>\n                <input type="number" name="dialNoAnswerRetryFrequency" ng-model="vm.queueCampaign.dialNoAnswerRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERRETRYTIME"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerRetryFrequency\'].$error" ng-show="noanswerForm[\'dialNoAnswerRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_REQUIRED">NoAnswerRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container nosuchnumber md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOSUCHNUMBER">NOSUCHNUMBER</div>\n            </div>\n            <form name="nosuchnumberForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERMAXRETRY">NoSuchNumberMaxRetry</label>\n                <input type="number" name="dialNoSuchNumberMaxRetry" ng-model="vm.queueCampaign.dialNoSuchNumberMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERMAXRETRY"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_REQUIRED">NoSuchNumberMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERRETRYTIME">NoSuchNumberRetryTime</label>\n                <input type="number" name="dialNoSuchNumberRetryFrequency" ng-model="vm.queueCampaign.dialNoSuchNumberRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERRETRYTIME"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_REQUIRED">NoSuchNumberRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container drop md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.DROP">DROP</div>\n            </div>\n            <form name="dropForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPMAXRETRY">DropMaxRetry</label>\n                <input type="number" name="dialDropMaxRetry" ng-model="vm.queueCampaign.dialDropMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPMAXRETRY"></span></div>\n                <div ng-messages="dropForm[\'dialDropMaxRetry\'].$error" ng-show="dropForm[\'dialDropMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_REQUIRED">DropMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPRETRYTIME">DropRetryTime</label>\n                <input type="number" name="dialDropRetryFrequency" ng-model="vm.queueCampaign.dialDropRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPRETRYTIME"></span></div>\n                <div ng-messages="dropForm[\'dialDropRetryFrequency\'].$error" ng-show="dropForm[\'dialDropRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_REQUIRED">DropRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container abandoned md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ABANDONED">ABANDONED</div>\n            </div>\n            <form name="abandonedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDMAXRETRY">AbandonedMaxRetry</label>\n                <input type="number" name="dialAbandonedMaxRetry" ng-model="vm.queueCampaign.dialAbandonedMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDMAXRETRY"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedMaxRetry\'].$error" ng-show="abandonedForm[\'dialAbandonedMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_REQUIRED">AbandonedMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDRETRYTIME">AbandonedRetryTime</label>\n                <input type="number" name="dialAbandonedRetryFrequency" ng-model="vm.queueCampaign.dialAbandonedRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDRETRYTIME"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedRetryFrequency\'].$error" ng-show="abandonedForm[\'dialAbandonedRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_REQUIRED">AbandonedRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container machine md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.MACHINE">MACHINE</div>\n            </div>\n            <form name="machineForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINEMAXRETRY">MachineMaxRetry</label>\n                <input type="number" name="dialMachineMaxRetry" ng-model="vm.queueCampaign.dialMachineMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINEMAXRETRY"></span></div>\n                <div ng-messages="machineForm[\'dialMachineMaxRetry\'].$error" ng-show="machineForm[\'dialMachineMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_REQUIRED">MachineMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINERETRYTIME">MachineRetryTime</label>\n                <input type="number" name="dialMachineRetryFrequency" ng-model="vm.queueCampaign.dialMachineRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINERETRYTIME"></span></div>\n                <div ng-messages="machineForm[\'dialMachineRetryFrequency\'].$error" ng-show="machineForm[\'dialMachineRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_REQUIRED">MachineRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container agentreject md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AGENTREJECT">AGENTREJECT</div>\n            </div>\n            <form name="agentrejectForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTMAXRETRY">AgentRejectMaxRetry</label>\n                <input type="number" name="dialAgentRejectMaxRetry" ng-model="vm.queueCampaign.dialAgentRejectMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTMAXRETRY"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectMaxRetry\'].$error" ng-show="agentrejectForm[\'dialAgentRejectMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_REQUIRED">AgentRejectMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTRETRYTIME">AgentRejectRetryTime</label>\n                <input type="number" name="dialAgentRejectRetryFrequency" ng-model="vm.queueCampaign.dialAgentRejectRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTRETRYTIME"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$error" ng-show="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_REQUIRED">AgentRejectRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container additionalphones md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADDITIONALPHONES">ADDITIONALPHONES</div>\n            </div>\n            <form name="additionalphonesForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CALLADDITIONALPHONEAFTERMIN">CallAdditionalPhoneAfterMin</label>\n                <input type="number" name="callAdditionalPhoneAfterMin" ng-model="vm.queueCampaign.callAdditionalPhoneAfterMin" min="1" max="99999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="additionalphonesForm[\'callAdditionalPhoneAfterMin\'].$error" ng-show="additionalphonesForm[\'callAdditionalPhoneAfterMin\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLADDITIONALPHONEAFTERMIN_REQUIRED">CallAdditionalPhoneAfterMin field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CALLADDITIONALPHONEAFTERMIN_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CallAdditionalPhoneAfterMin must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CALLADDITIONALPHONEAFTERMIN_MUST_BE_LESS_THAN_OR_EQUAL_TO">CallAdditionalPhoneAfterMin must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="queueCampaign-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.acw" aria-label="AfterCallWork" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AFTERCALLWORK">AfterCallWork</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORK"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.acw" class="md-block">\n                <label translate="MOTIONDIALER.AFTERCALLWORKDURATION">AfterCallWorkDuration</label>\n                <input type="number" name="acwTimeout" ng-model="vm.queueCampaign.acwTimeout" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORKDURATION"></span></div>\n                <div ng-messages="advancedForm[\'acwTimeout\'].$error" ng-show="advancedForm[\'acwTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_REQUIRED">AfterCallWorkDuration field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AfterCallWorkDuration must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AUTOPAUSE">AutoPause</label>\n                <md-select name="autopause" ng-model="vm.queueCampaign.autopause" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'all\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AUTOPAUSE"></span></div>\n                <div ng-messages="advancedForm[\'autopause\'].$error" ng-show="advancedForm[\'autopause\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AUTOPAUSE_REQUIRED">AutoPause field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.RINGINUSE">RingInUse</label>\n                <md-select name="ringinuse" ng-model="vm.queueCampaign.ringinuse" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RINGINUSE"></span></div>\n                <div ng-messages="advancedForm[\'ringinuse\'].$error" ng-show="advancedForm[\'ringinuse\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RINGINUSE_REQUIRED">RingInUse field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MEMBERDELAY">MemberDelay</label>\n                <input type="number" name="memberdelay" ng-model="vm.queueCampaign.memberdelay" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MEMBERDELAY"></span></div>\n                <div ng-messages="advancedForm[\'memberdelay\'].$error" ng-show="advancedForm[\'memberdelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MEMBERDELAY_REQUIRED">MemberDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MEMBERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MemberDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TIMEOUTRESTART">TimeoutRestart</label>\n                <md-select name="timeoutrestart" ng-model="vm.queueCampaign.timeoutrestart" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEOUTRESTART"></span></div>\n                <div ng-messages="advancedForm[\'timeoutrestart\'].$error" ng-show="advancedForm[\'timeoutrestart\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TIMEOUTRESTART_REQUIRED">TimeoutRestart field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MONITORFORMAT">MonitorFormat</label>\n                <md-select name="monitor_format" ng-model="vm.queueCampaign.monitor_format" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'wav49\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MONITORFORMAT"></span></div>\n                <div ng-messages="advancedForm[\'monitor_format\'].$error" ng-show="advancedForm[\'monitor_format\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MONITORFORMAT_REQUIRED">MonitorFormat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONTEXT">Context</label>\n                <input type="text" name="context" ng-model="vm.queueCampaign.context" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONTEXT"></span></div>\n                <div ng-messages="advancedForm[\'context\'].$error" ng-show="advancedForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.SETINTERFACEVARIABLES">SetInterfaceVariables</label>\n                <md-select name="setinterfacevar" ng-model="vm.queueCampaign.setinterfacevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.SETINTERFACEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setinterfacevar\'].$error" ng-show="advancedForm[\'setinterfacevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.SETINTERFACEVARIABLES_REQUIRED">SetInterfaceVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.SETQUEUEVARIABLES">SetQueueVariables</label>\n                <md-select name="setqueuevar" ng-model="vm.queueCampaign.setqueuevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.SETQUEUEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueuevar\'].$error" ng-show="advancedForm[\'setqueuevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.SETQUEUEVARIABLES_REQUIRED">SetQueueVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.SETQUEUEENTRYVARIABLES">SetQueueEntryVariables</label>\n                <md-select name="setqueueentryvar" ng-model="vm.queueCampaign.setqueueentryvar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.SETQUEUEENTRYVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueueentryvar\'].$error" ng-show="advancedForm[\'setqueueentryvar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.SETQUEUEENTRYVARIABLES_REQUIRED">SetQueueEntryVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALORDERBYSCHEDULEDAT">DialOrderByScheduledAt</label>\n                <md-select name="dialOrderByScheduledAt" ng-model="vm.queueCampaign.dialOrderByScheduledAt" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'DESC\'"> {{ \'MOTIONDIALER.DESC\' | translate }} </md-option>\n\n                  <md-option ng-value="\'ASC\'"> {{ \'MOTIONDIALER.ASC\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALORDERBYSCHEDULEDAT"></span></div>\n                <div ng-messages="advancedForm[\'dialOrderByScheduledAt\'].$error" ng-show="advancedForm[\'dialOrderByScheduledAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALORDERBYSCHEDULEDAT_REQUIRED">DialOrderByScheduledAt field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.mandatoryDisposition" class="md-block">\n                <label translate="MOTIONDIALER.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.queueCampaign.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="advancedForm[\'mandatoryDispositionPauseId\'].$error" ng-show="advancedForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod === \'preview\' || vm.queueCampaign.dialMethod === \'booked\'" class="queueCampaign-detail-form-container advancedpreview md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADVANCEDPREVIEW">ADVANCEDPREVIEW</div>\n            </div>\n            <form name="advancedpreviewForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.acw" aria-label="AfterCallWork" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AFTERCALLWORK">AfterCallWork</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORK"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.acw" class="md-block">\n                <label translate="MOTIONDIALER.AFTERCALLWORKDURATION">AfterCallWorkDuration</label>\n                <input type="number" name="acwTimeout" ng-model="vm.queueCampaign.acwTimeout" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORKDURATION"></span></div>\n                <div ng-messages="advancedpreviewForm[\'acwTimeout\'].$error" ng-show="advancedpreviewForm[\'acwTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_REQUIRED">AfterCallWorkDuration field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AfterCallWorkDuration must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MONITORFORMAT">MonitorFormat</label>\n                <md-select name="monitor_format" ng-model="vm.queueCampaign.monitor_format" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'wav49\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MONITORFORMAT"></span></div>\n                <div ng-messages="advancedpreviewForm[\'monitor_format\'].$error" ng-show="advancedpreviewForm[\'monitor_format\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MONITORFORMAT_REQUIRED">MonitorFormat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALORDERBYSCHEDULEDAT">DialOrderByScheduledAt</label>\n                <md-select name="dialOrderByScheduledAt" ng-model="vm.queueCampaign.dialOrderByScheduledAt" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'DESC\'"> {{ \'MOTIONDIALER.DESC\' | translate }} </md-option>\n\n                  <md-option ng-value="\'ASC\'"> {{ \'MOTIONDIALER.ASC\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALORDERBYSCHEDULEDAT"></span></div>\n                <div ng-messages="advancedpreviewForm[\'dialOrderByScheduledAt\'].$error" ng-show="advancedpreviewForm[\'dialOrderByScheduledAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALORDERBYSCHEDULEDAT_REQUIRED">DialOrderByScheduledAt field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.mandatoryDisposition" class="md-block">\n                <label translate="MOTIONDIALER.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.queueCampaign.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="advancedpreviewForm[\'mandatoryDispositionPauseId\'].$error" ng-show="advancedpreviewForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod === \'predictive\'" class="queueCampaign-detail-form-container thresholds md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.THRESHOLDS">THRESHOLDS</div>\n            </div>\n            <form name="thresholdsForm" novalidate>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEMAXTHRESHOLD">PredictiveMaxThreshold</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEMAXTHRESHOLD"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveIntervalMaxThreshold" min="1" max="100" step="1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEMINTHRESHOLD">PredictiveMinThreshold</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEMINTHRESHOLD"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveIntervalMinThreshold" min="1" max="100" step="1" class="md-accent"></md-slider>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container recallme md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.RECALLME">RECALLME</div>\n            </div>\n            <form name="recallmeForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALRECALLMETIMEOUT">DialRecallMeTimeout</label>\n                <input type="number" name="dialRecallMeTimeout" ng-model="vm.queueCampaign.dialRecallMeTimeout" min="1" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALRECALLMETIMEOUT"></span></div>\n                <div ng-messages="recallmeForm[\'dialRecallMeTimeout\'].$error" ng-show="recallmeForm[\'dialRecallMeTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALRECALLMETIMEOUT_REQUIRED">DialRecallMeTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DIALRECALLMETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DialRecallMeTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialRecallInQueue" aria-label="DialRecallInQueue" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.DIALRECALLINQUEUE">DialRecallInQueue</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALRECALLINQUEUE"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'preview\'" class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialPreviewAutoRecallMe" aria-label="Preview_Auto_Recall_Me" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.PREVIEW_AUTO_RECALL_ME">Preview_Auto_Recall_Me</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREVIEW_AUTO_RECALL_ME"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'preview\'" class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialPreviewRecallmeReminder" aria-label="Preview_Recall_Me_Reminder" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.PREVIEW_RECALL_ME_REMINDER">Preview_Recall_Me_Reminder</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREVIEW_RECALL_ME_REMINDER"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="queueCampaign-detail-form-container globalinterval md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBALINTERVAL">GLOBALINTERVAL</div>\n            </div>\n            <form name="globalintervalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALINTERVAL">GlobalInterval</label>\n                <input type="text" name="dialGlobalInterval" ng-model="vm.queueCampaign.dialGlobalInterval" value="07:00-22:00,*,*,*" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALINTERVAL"></span></div>\n                <div ng-messages="globalintervalForm[\'dialGlobalInterval\'].$error" ng-show="globalintervalForm[\'dialGlobalInterval\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALINTERVAL_REQUIRED">GlobalInterval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="queueCampaign-detail-form-container timezone md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.TIMEZONE">TIMEZONE</div>\n            </div>\n            <form name="timezoneForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TIMEZONE">Timezone</label>\n                <ms-timezone name="dialTimezone" ng-model="vm.queueCampaign.dialTimezone" autofocus ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEZONE"></span></div>\n                <div ng-messages="timezoneForm[\'dialTimezone\'].$error" ng-show="timezoneForm[dialTimezone].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="queueCampaign-detail-form-container amd md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AMD">AMD</div>\n            </div>\n            <form name="amdForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialAMDActive" aria-label="AMDActive" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AMDACTIVE">AMDActive</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDACTIVE"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDINITIALSILENCE">AMDInitialSilence</label>\n                <input type="number" name="dialAMDInitialSilence" ng-model="vm.queueCampaign.dialAMDInitialSilence" min="0" value="2500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDINITIALSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDInitialSilence\'].$error" ng-show="amdForm[\'dialAMDInitialSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_REQUIRED">AMDInitialSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDInitialSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDGREETING">AMDGreeting</label>\n                <input type="number" name="dialAMDGreeting" ng-model="vm.queueCampaign.dialAMDGreeting" min="0" value="1500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDGREETING"></span></div>\n                <div ng-messages="amdForm[\'dialAMDGreeting\'].$error" ng-show="amdForm[\'dialAMDGreeting\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_REQUIRED">AMDGreeting field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDGreeting must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDAFTERGREETINGSILENCE">AMDAfterGreetingSilence</label>\n                <input type="number" name="dialAMDAfterGreetingSilence" ng-model="vm.queueCampaign.dialAMDAfterGreetingSilence" min="0" value="800" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDAFTERGREETINGSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDAfterGreetingSilence\'].$error" ng-show="amdForm[\'dialAMDAfterGreetingSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_REQUIRED">AMDAfterGreetingSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDAfterGreetingSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDTOTALANALYSISTIME">AMDTotalAnalysisTime</label>\n                <input type="number" name="dialAMDTotalAnalysisTime" ng-model="vm.queueCampaign.dialAMDTotalAnalysisTime" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDTOTALANALYSISTIME"></span></div>\n                <div ng-messages="amdForm[\'dialAMDTotalAnalysisTime\'].$error" ng-show="amdForm[\'dialAMDTotalAnalysisTime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_REQUIRED">AMDTotalAnalysisTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDTotalAnalysisTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMINWORDLENGTH">AMDMinWordLength</label>\n                <input type="number" name="dialAMDMinWordLength" ng-model="vm.queueCampaign.dialAMDMinWordLength" min="0" value="100" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMINWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMinWordLength\'].$error" ng-show="amdForm[\'dialAMDMinWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_REQUIRED">AMDMinWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMinWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDBETWEENWORDSSILENCE">AMDBetweenWordsSilence</label>\n                <input type="number" name="dialAMDBetweenWordsSilence" ng-model="vm.queueCampaign.dialAMDBetweenWordsSilence" min="0" value="50" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDBETWEENWORDSSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDBetweenWordsSilence\'].$error" ng-show="amdForm[\'dialAMDBetweenWordsSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_REQUIRED">AMDBetweenWordsSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDBetweenWordsSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMNUMBEROFWORDS">AMDMaximumNumberOfWords</label>\n                <input type="number" name="dialAMDMaximumNumberOfWords" ng-model="vm.queueCampaign.dialAMDMaximumNumberOfWords" min="0" value="3" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMNUMBEROFWORDS"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumNumberOfWords\'].$error" ng-show="amdForm[\'dialAMDMaximumNumberOfWords\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_REQUIRED">AMDMaximumNumberOfWords field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumNumberOfWords must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDSILENCETHRESHOLD">AMDSilenceThreshold</label>\n                <input type="number" name="dialAMDSilenceThreshold" ng-model="vm.queueCampaign.dialAMDSilenceThreshold" min="0" max="32767" value="256" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDSILENCETHRESHOLD"></span></div>\n                <div ng-messages="amdForm[\'dialAMDSilenceThreshold\'].$error" ng-show="amdForm[\'dialAMDSilenceThreshold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_REQUIRED">AMDSilenceThreshold field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_LESS_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>32767</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMWORDLENGTH">AMDMaximumWordLength</label>\n                <input type="number" name="dialAMDMaximumWordLength" ng-model="vm.queueCampaign.dialAMDMaximumWordLength" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumWordLength\'].$error" ng-show="amdForm[\'dialAMDMaximumWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_REQUIRED">AMDMaximumWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HOPPERS">HOPPERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperstatistics md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperStatisticsController as vm_hs" ng-init="vm_hs.init(vm.queueCampaign)">\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERWIDGET">Hoppers</span>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_hs.init(vm.queueCampaign)" aria-label="refresh Hopper" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              \x3c!-- WIDGET GROUP --\x3e\n              <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n                \x3c!-- WIDGET 1 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{(vm_hs.total || 0) + (vm_hs.closed || 0)}}</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.TOTAL\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 1 --\x3e\n\n                \x3c!-- WIDGET 2 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.fresh || 0}} ({{vm_hs.total ? ((((vm_hs.fresh || 0) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.FRESH\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 2 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.total ? (vm_hs.total - (vm_hs.fresh || 0)) : 0}} ({{vm_hs.total ? ((((vm_hs.total - (vm_hs.fresh || 0)) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.OPEN\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.closed ? (vm_hs.closed || 0) : 0}} ({{vm_hs.closed ? ((((vm_hs.closed) * 100)/(vm_hs.closed + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.CLOSED\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n              </div>\n              \x3c!-- / WIDGET GROUP --\x3e\n            </div>\n\n          </div>\n          <div class="queueCampaign-detail-form-container hoppers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHoppersController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERS">Hoppers</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHoppers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getQueueCampaignHoppers()" aria-label="refresh Hoppers" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHoppers.length}} {{vm_dc.selectedQueueCampaignHoppers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHoppers" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedQueueCampaignHoppers($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHoppers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHoppers">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="priority">\n                        {{ \'MOTIONDIALER.PRIORITY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="recallme">\n                        {{ \'MOTIONDIALER.RECALLAGENT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopper" md-select-id="id" ng-repeat="hopper in vm_dc.queueCampaignHoppers.rows">\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.ContactId}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell privacy ng-cloak>\n                        {{hopper.phone}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countcongestionretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countbusyretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnoanswerretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnosuchnumberretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countdropretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countabandonedretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countmachineretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countagentrejectretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{ hopper.scheduledat | formatdate }}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{ vm_dc.arraypriority[hopper.priority].option }} </td>\n\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell class="recallme ">\n                        <md-icon md-colors="{color: {{hopper.recallme ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{hopper.recallme? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" translate="MOTIONDIALER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(hopper, $event)" translate="MOTIONDIALER.DELETE_HOPPER">\n                                Delete Hopper\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHoppers.rows.length">\n                      <td md-cell colspan="17">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPER_AVAILABLE">No hopper available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHoppers.count}}" md-on-paginate="vm_dc.getQueueCampaignHoppers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HISTORY">HISTORY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperhistories md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperHistoriesController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERHISTORIES">HopperHistories</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHopperHistories()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getQueueCampaignHopperHistories()" aria-label="refresh HopperHistories" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERHISTORIES">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHopperHistories.length}} {{vm_dc.selectedQueueCampaignHopperHistories.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHopperHistories" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHopperHistories" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHopperHistories">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperHistory" md-select-id="id" ng-repeat="hopperHistory in vm_dc.queueCampaignHopperHistories.rows">\n                      <td md-cell>\n                        {{hopperHistory.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.scheduledat | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.endtime | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHopperHistories.rows.length">\n                      <td md-cell colspan="11">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERHISTORY_AVAILABLE">No hopperhistory available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHopperHistories.count}}" md-on-paginate="vm_dc.getQueueCampaignHopperHistories" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.FINAL">FINAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperfinals md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperFinalsController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERFINALS">HopperFinals</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHopperFinals()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getQueueCampaignHopperFinals()" aria-label="refresh HopperFinals" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERFINALS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                  <td md-cell class="actions">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="vm_dc.countContactsQueueCampaignHopperFinal(vm_dc.query.id); $mdOpenMenu($event);">\n                        <md-icon md-font-icon="icon-backup-restore"></md-icon>\n                        <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(3)">\n                            <span translate="MOTIONDIALER.NOANSWER ">NoAnswer</span>\n                            <span class="badge">({{vm_dc.contacts.noAnswerContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(5)">\n                            <span translate="MOTIONDIALER.BUSY ">Busy</span>\n                            <span class="badge">({{vm_dc.contacts.busyContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(8)">\n                            <span translate="MOTIONDIALER.CONGESTION ">Congestion</span>\n                            <span class="badge">({{vm_dc.contacts.congestionContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(10)">\n                            <span translate="MOTIONDIALER.DROPPED ">Drop</span>\n                            <span class="badge">({{vm_dc.contacts.dropContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(11)">\n                            <span translate="MOTIONDIALER.ABANDONED ">Abandoned</span>\n                            <span class="badge">({{vm_dc.contacts.abandonedContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(22)">\n                            <span translate="MOTIONDIALER.RECALLFAILEDTIMEOUT">Recall</span>\n                            <span class="badge">({{vm_dc.contacts.reCallContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(0)">\n                            <span translate="MOTIONDIALER.NO_SUCH_NUMBER">NoSuchNumber</span>\n                            <span class="badge">({{vm_dc.contacts.noSuchContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item>\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(19)">\n                            <span translate="MOTIONDIALER.ANSWERING_MACHINE">AnsweringMachine</span>\n                            <span class="badge">({{vm_dc.contacts.answeringMachine}})</span>\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHopperFinals.length}} {{vm_dc.selectedQueueCampaignHopperFinals.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHopperFinals" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.moveSelectedQueueCampaignHopperFinals($event)" aria-label="move selected" translate translate-attr-label="MOTIONDIALER.MOVE_SELECTED">\n                    <md-icon md-font-icon="icon-restore"></md-icon>\n                    <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHopperFinals" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHopperFinals">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="disposition">\n                        {{ \'MOTIONDIALER.DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="secondDisposition">\n                        {{ \'MOTIONDIALER.SECOND_LEVEL_DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="thirdDisposition">\n                        {{ \'MOTIONDIALER.THIRD_LEVEL_DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperFinal" md-select-id="id" ng-repeat="hopperFinal in vm_dc.queueCampaignHopperFinals.rows">\n                      <td md-cell>\n                        {{hopperFinal.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countcongestionretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countbusyretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnoanswerretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnosuchnumberretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countdropretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countabandonedretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countmachineretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countagentrejectretry}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.endtime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.disposition}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.secondDisposition}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.thirdDisposition}}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.moveConfirm(hopperFinal, $event)" translate="MOTIONDIALER.MOVE_HOPPERFINAL">\n                                Move HopperFinal\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHopperFinals.rows.length">\n                      <td md-cell colspan="30">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERFINAL_AVAILABLE">No hopperfinal available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHopperFinals.count}}" md-on-paginate="vm_dc.getQueueCampaignHopperFinals" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.BLACKLIST">BLACKLIST</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperblacks md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperBlacksController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERBLACKS">HopperBlacks</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHopperBlacks()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHopperBlacks.length}} {{vm_dc.selectedQueueCampaignHopperBlacks.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHopperBlacks" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHopperBlacks" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHopperBlacks">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperBlack" md-select-id="id" ng-repeat="hopperBlack in vm_dc.queueCampaignHopperBlacks.rows">\n                      <td md-cell>\n                        {{hopperBlack.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperBlack.phone}}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHopperBlacks.rows.length">\n                      <td md-cell colspan="4">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERBLACK_AVAILABLE">No hopperblack available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHopperBlacks.count}}" md-on-paginate="vm_dc.getQueueCampaignHopperBlacks" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/queueCampaigns.html",'<div id="queueCampaigns" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-fire" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MOTIONDIALER.QUEUECAMPAIGNS">QueueCampaigns</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MOTIONDIALER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedQueueCampaigns.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedQueueCampaigns =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MOTIONDIALER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-queueCampaigns-count">\n          <span>{{vm.selectedQueueCampaigns.length}}</span>\n          <span translate="MOTIONDIALER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MOTIONDIALER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllQueueCampaigns()" translate="MOTIONDIALER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectQueueCampaigns()" translate="MOTIONDIALER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedQueueCampaigns" csv-label="true" filename="queueCampaigns.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedQueueCampaigns($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- QUEUECAMPAIGN TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedQueueCampaigns" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueueCampaigns">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MOTIONDIALER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                <th md-column md-order-by="dialActive">{{ \'MOTIONDIALER.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="TrunkId">{{ \'MOTIONDIALER.TRUNK\' | translate }}</th>\n                <th md-column md-order-by="dialMethod">{{ \'MOTIONDIALER.METHOD\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'MOTIONDIALER.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.queueCampaigns.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="queueCampaign" md-select-id="id" ng-repeat="queueCampaign in vm.queueCampaigns.rows">\n                <td md-cell ng-if="queueCampaign.userpic"><img class="avatar" alt="{{queueCampaign.name}}" ng-src="api/users/{{queueCampaign.id}}/avatar" /></td>\n                <td md-cell ng-if="!queueCampaign.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{queueCampaign.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="id ">{{queueCampaign.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="name ">{{queueCampaign.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="dialActive ">\n                  <md-icon md-colors="{color: {{queueCampaign.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{queueCampaign.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="TrunkId ">{{ (vm.trunks | filter : {\'id\':queueCampaign.TrunkId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="dialMethod ">{{ vm.arraydialMethod[queueCampaign.dialMethod].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="strategy ">{{ vm.arraystrategy[queueCampaign.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(queueCampaign, $event    )" translate="MOTIONDIALER.EDIT_QUEUECAMPAIGN">\n                          Edit QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(queueCampaign, $event    )" translate="MOTIONDIALER.CLONE_QUEUECAMPAIGN">\n                          clone QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.listadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.LISTADD_QUEUECAMPAIGN">\n                          listadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.blacklistadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.BLACKLISTADD_QUEUECAMPAIGN">\n                          blacklistadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.TEAMADD_QUEUECAMPAIGN">\n                          teamadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.AGENTADD_QUEUECAMPAIGN">\n                          agentadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(queueCampaign, $event    )" translate="MOTIONDIALER.DELETE_QUEUECAMPAIGN">\n                          Delete QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(queueCampaign, $event    )" translate="MOTIONDIALER.GOTOREALTIME_QUEUECAMPAIGN">\n                          goToRealtime QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queueCampaigns.count}}" md-on-paginate="vm.getQueueCampaigns" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / QUEUECAMPAIGN TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD QUEUECAMPAIGN BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-queueCampaign-button" ng-click="vm.createOrEditQueueCampaign($event)" aria-label="add queueCampaign" translate translate-attr-aria-label="MOTIONDIALER.ADD_QUEUECAMPAIGN">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD QUEUECAMPAIGN BUTTON --\x3e\n</div>'),e.put("app/main/apps/motiondialer/views/realtime/abandonedcalls/view.html",'<md-toolbar class="md-table-toolbar md-default table-header">\n  <div class="md-toolbar-tools" layout="row" layout-align="center center">\n    <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n    <ms-search-bar on-search="vm.getAbandonedCalls()" query="vm.query" on-collapse="vm.query.filter = undefined" debounce="300">\n    </ms-search-bar>\n    <div flex></div>\n\n    <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getAbandonedCalls()"></ms-quick-filter>\n\n    <md-button class="md-icon-button" ng-click="vm.refresh && vm.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n      <md-icon md-font-icon="icon-reload"></md-icon>\n      <md-tooltip ng-if="vm.showTooltip" md-visible="vm.showTooltip">{{\'DASHBOARDS.CLICKRELOAD\' | translate}}\n      </md-tooltip>\n    </md-button>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAbandonedCalls">\n      <tr md-row>\n        <th md-column md-order-by="id">ID</th>\n        <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n        <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n        <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n        <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n        <th md-column md-order-by="queuecallerexitAt">{{\'DASHBOARDS.QUEUECALLEREXITAT\' | translate}}</th>\n        <th md-column md-order-by="queuecallerexitreason">{{\'DASHBOARDS.QUEUECALLEREXITREASON\' | translate}}</th>\n        <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.abandonedCalls.rows.length">\n        <td md-cell colspan="12">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="call in vm.abandonedCalls.rows">\n        <td md-cell class="id">{{call.id}}</td>\n        <td md-cell class="firstName" privacy ng-cloak>{{call.calleridname}}</td>\n        <td md-cell class="list" privacy ng-cloak>{{call.calleridnum}}</td>\n        <td md-cell class="list">{{vm.queuesMap[call.queue]}}</td>\n        <td md-cell class="list">\n          {{call.queuecallerabandonAt ? (call.queuecallerabandonAt | formatdate) : (call.queuecallerexitAt | formatdate) }}\n        </td>\n        <td md-cell class="list">{{call.queuecallerexitAt ? (call.queuecallerexitAt | formatdate) : undefined }}\n        </td>\n        <td md-cell class="list">{{call.queuecallerexitreason}}</td>\n        <td md-cell class="list">{{call.lastAssignedTo}}</td>\n        <td md-cell class="list">{{ call.disposition }}</td>\n        <td md-cell class="list">{{ call.secondDisposition }}</td>\n        <td md-cell class="list">{{ call.thirdDisposition }}</td>\n        <td md-cell class="actions">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="2">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-menu>\n                  <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.ASSIGNTO">\n                    Assigned\n                    to</md-button>\n                  <md-menu-content>\n                    <md-menu-item ng-if="call.lastAssignedTo">\n                      <md-button ng-click="vm.assignTo(call)"><em translate="DASHBOARDS.NONE">Not Assigned</em>\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.agents.rows.length" ng-repeat="agent in vm.agents.rows">\n                      <md-button ng-click="vm.assignTo(call,agent)">{{agent.name}}</md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.dispose(call)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">\n                  Dispose\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.abandonedCalls.count}}" md-on-paginate="vm.getAbandonedCalls" md-page-select></md-table-pagination>'),e.put("app/main/apps/motiondialer/views/realtime/ivr_campaigns/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.IVR_CAMPAIGNS">Ivr Campaigns</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getCampaigns()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- QUEUE TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCampaigns">\n      <tr md-row>\n        <th md-column>{{\'MOTIONDIALER.NAME\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TOTAL\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TOTAL_MANAGED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.LIMITED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.ORIGINATED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.MESSAGE\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.CALLYSQUAREPROJECT\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TRUNK\' | translate }}</th>\n        <th md-column>{{\'MOTIONDIALER.ACTIVE\' | translate }}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.campaigns">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(id, campaign) in vm.campaigns">\n        <td md-cell>\n          <span>{{campaign.name}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.ivrTotalCallsDays || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.ivrAnswerCallsDay || 0}} ({{(campaign.ivrTotalCallsDays) ? (campaign.ivrAnswerCallsDay || 0) * 100/(campaign.ivrTotalCallsDays ) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.limitCalls || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.originated || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.message ? (\'MOTIONDIALER.\'+campaign.message | translate) : \'--\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.dialQueueProject || \'--\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{campaign.Trunk ? campaign.Trunk.name : \'--\'}}</span>\n        </td>\n        <td md-cell>\n          <md-icon md-colors="{color: {{campaign.active ? \'\\\'green\\\'\' : \'\\\'red\\\'\'}}}" md-font-icon="{{campaign.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.createOrEditIvrCampaign($event, campaign)" translate="MOTIONDIALER.EDIT_CAMPAIGN">\n                  Edit Campaign\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getCampaigns" md-page-select></md-table-pagination>\n\x3c!-- / QUEUE TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/motiondialer/views/realtime/queue_calls/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.QUEUE_CALLS">Queue Calls</span>\n  </div>\n</md-toolbar>\n\x3c!-- QUEUES TABLE --\x3e\n<md-table-container>\n  <table md-table>\n    <thead md-head>\n      <tr md-row>\n        <th md-column width="30px"></th>\n        <th md-column>{{ \'MOTIONDIALER.DID\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.QUEUE\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.CALLER\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.AGENT\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.DURATION\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.getSize(vm.rpcVoiceQueuesChannels)">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(key, channel) in vm.rpcVoiceQueuesChannels | limitObjectFromTo: vm.queryChannels.limit:(vm.queryChannels.page - 1) * vm.queryChannels.limit">\n        <td md-cell>\n          <md-icon ng-if="channel.queuecallerleaveAt" md-font-icon="icon-phone-in-talk green-fg"></md-icon>\n          <md-icon ng-if="!channel.queuecallerleaveAt" md-font-icon="icon-phone-incoming md-accent"></md-icon>\n        </td>\n        <td md-cell>{{channel.exten}}</td>\n        <td md-cell>{{channel.queue}}</td>\n        <td md-cell privacy ng-cloak>{{channel.calleridnum}}</td>\n        <td md-cell>\n          <span ng-if="channel.queuecallerleaveAt">\n            {{channel.connectedlinename}}, {{channel.connectedlinenum}}\n            <span class="text-boxed">\n              <timer start-time="channel.queuecallerleaveAt"></timer>\n            </span>\n          </span>\n          <span ng-if="!channel.queuecallerleaveAt" class="text-boxed">\n            {{ \'MOTIONDIALER.WAITING_FOR_AGENT\' | translate }}\n            <timer start-time="channel.queuecallerjoinAt"></timer>\n          </span>\n        </td>\n        <td md-cell>\n          <span class="text-boxed">\n            <timer start-time="channel.queuecallerjoinAt"></timer>\n          </span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="2">\n              <md-menu-item>\n                <md-button ng-click="vm.hangup(channel.uniqueid)" translate="MOTIONDIALER.HANGUP">\n                  Hangup\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.redirectToNumber($event, channel.uniqueid)" translate="MOTIONDIALER.REDIRECT_TO_NUMBER">\n                  Number\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-menu class="no-margin">\n                  <md-button ng-mouseenter="vm.getAvailableAgents()" translate="MOTIONDIALER.REDIRECT_TO_AGENT">\n                    Redirect to Agent</md-button>\n                  <md-menu-content>\n                    <md-menu-item ng-if="!vm.availableAgents">\n                      <md-progress-circular class="md-accent auto-margin" md-diameter="32" md-mode="indeterminate">\n                      </md-progress-circular>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.availableAgents.length > 0" ng-repeat="agent in vm.availableAgents">\n                      <md-button ng-click="vm.redirectToAgent(channel.uniqueid, agent.name, agent.context)">\n                        {{agent.name}}</md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.availableAgents.length === 0">\n                      <span>No agents available</span>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.queryChannels.limit" md-page="vm.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm.getSize(vm.rpcVoiceQueuesChannels)}}" md-page-select></md-table-pagination>\n\x3c!-- / QUEUES TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/motiondialer/views/realtime/queue_params/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.QUEUE_PARAMETERS">Params</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- QUEUE TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column>{{\'\n                                MOTIONDIALER.NAME\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.TOTAL\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.TOTAL_OFFERED\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.MANAGED\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.ABANDONED\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.DROPPED\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.AVG_HOLD_TIME\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.AVG_DURATION\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.AVG_BILLABLE\' | translate}}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(id, queue) in vm.queues">\n        <td md-cell>\n          <span>{{queue.name}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{(queue.answered + queue.outboundNoAnswerCallsDay + queue.outboundBusyCallsDay + queue.outboundCongestionCallsDay + queue.outboundNoSuchCallsDay + queue.outboundUnknownCallsDay + queue.outboundDropCallsDayTimeout + queue.outboundDropCallsDayCallersExit + queue.outboundBlacklistCallsDay + queue.outboundOriginateFailureCallsDay + queue.outboundAnswerAgiCallsDay + queue.outboundReCallsDay + queue.outboundRejectCallsDay )|| 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{queue.total || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered || 0}} ({{(queue.answered) ? (100 - (((queue.outboundDropCallsDayTimeout || 0) * 100/(queue.total)) | number:1 ) - (((queue.outboundDropCallsDayCallersExit || 0) * 100/(queue.total )) | number:1 )  ) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.outboundDropCallsDayCallersExit || 0}} ({{(queue.outboundDropCallsDayCallersExit) ? (queue.outboundDropCallsDayCallersExit || 0) * 100/(queue.total ) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.outboundDropCallsDayTimeout || 0}} ({{(queue.outboundDropCallsDayTimeout) ? (queue.outboundDropCallsDayTimeout || 0) * 100/(queue.total) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.total ? (queue.sumHoldTime / queue.total) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.total ? (queue.sumDuration / queue.total) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered ? ((queue.sumBillable || 0) / queue.answered) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>\n\x3c!-- / QUEUE TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/motiondialer/views/realtime/queues/predictive/dialog.html",'<md-dialog class="predictive-dialog" aria-label="New predictive">\n  <md-toolbar class="md-accent md-hue-2">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span class="title">{{ vm.queueCampaign.name }} Info</span>\n      <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-dialog-content class="text-center">\n    <ds-widget-clock data-show-digital></ds-widget-clock>\n    <div ng-if="!vm.queueCampaign.startProgressive && !vm.queueCampaign.startPredictive">\n      <div class="md-title"><span translate="MOTIONDIALER.PREDICTIVE_IS_NOT_RUNNING">Predictive is not running</span></div>\n    </div>\n\n    <div ng-if="vm.queueCampaign.startProgressive && !vm.queueCampaign.startPredictive" class="m-10">\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-headline"><span translate="MOTIONDIALER.DATA_COLLECTION_IN_PROGRESSIVE">Data collection in progressive</span></div>\n          <div class="md-subhead">({{vm.queueCampaign.dialPredictiveInterval}} minutes)</div>\n        </div>\n      </div>\n\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.STARTTIME">Start Time</span></div>\n          <div class="md-headline">{{ vm.setFormatTime(vm.queueCampaign.startProgressive) }}</div>\n        </div>\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.ENDTIME">End Time</span></div>\n          <div class="md-headline">\n            {{ vm.addMinutes(vm.queueCampaign.startProgressive, vm.queueCampaign.dialPredictiveInterval) }}\n          </div>\n        </div>\n      </div>\n      <div>\n        <span class="text-boxed blue-bg white-fg">\n          {{vm.queueCampaign.message ? (\'MOTIONDIALER.\' + vm.queueCampaign.message | translate) : \'--\'}}\n        </span>\n      </div>\n    </div>\n    <div ng-if="vm.queueCampaign.startPredictive" class="m-10">\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-headline"><span translate="MOTIONDIALER.PREDICTIVE_IS_RUNNING">Predictive is runnning</span></div>\n          <div class="md-subhead">({{vm.queueCampaign.dialPredictiveInterval}} minutes)</div>\n        </div>\n      </div>\n\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.STARTTIME">Start Time</span></div>\n          <div class="md-headline">{{ vm.setFormatTime(vm.queueCampaign.startPredictive) }}</div>\n        </div>\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.ENDTIME">End Time</span></div>\n          <div class="md-headline">\n            {{ vm.addMinutes(vm.queueCampaign.startPredictive, vm.queueCampaign.dialPredictiveInterval) }}\n          </div>\n        </div>\n      </div>\n      <div>\n        <span class="text-boxed blue-bg white-fg">\n          {{vm.queueCampaign.message ? (\'MOTIONDIALER.\' + vm.queueCampaign.message | translate) : \'--\'}}\n        </span>\n      </div>\n      <div class="row">\n        <md-card>\n          <md-toolbar class="md-table-toolbar md-default">\n            <div class="md-toolbar-tools">\n              <span class="md-subhead">Predictive - {{ \'MOTIONDIALER.PREVIOUS_INTERVAL\' | translate }}</span>\n            </div>\n          </md-toolbar>\n          <md-table-container>\n            <table md-table>\n              <tbody md-body>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.TOTAL_CALLS">Total Calls</span></td>\n                  <td md-cell>{{ vm.queueCampaign.predictiveIntervalTotalCalls }}</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.ANSWERED_CALLS">Total Calls</span></td>\n                  <td md-cell>{{ vm.queueCampaign.predictiveIntervalAnsweredCalls }}</td>\n                </tr>\n                \x3c!-- Temporaneamente non mostrate perchè contengono anche i dati dell\'intervallo corrente --\x3e\n                \x3c!-- <tr md-row>\n                                    <td md-cell>Dropped Calls Timeout</td>\n                                    <td md-cell>{{ vm.queueCampaign.predictiveIntervalDroppedCallsTimeout }}</td>\n                                </tr>\n                                <tr md-row>\n                                    <td md-cell>Dropped Calls Caller Exit</td>\n                                    <td md-cell>{{ vm.queueCampaign.predictiveIntervalDroppedCallsCallersExit }}\n                                    </td>\n                                </tr> --\x3e\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.AVG_HOLD_TIME">AVG Hold Time</span></td>\n                  <td md-cell>~ {{ vm.queueCampaign.predictiveIntervalAvgHoldtime | number:0 }}s</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.AVG_TALK_TIME">AVG Talk Time</span></td>\n                  <td md-cell>~ {{ vm.queueCampaign.predictiveIntervalAvgTalktime | number:0 }}s</td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n        </md-card>\n        <md-card>\n          <md-toolbar class="md-table-toolbar md-default">\n            <div class="md-toolbar-tools">\n              <span class="md-subhead">ErlangB - {{ \'MOTIONDIALER.CURRENT_INTERVAL\' | translate }}</span>\n            </div>\n          </md-toolbar>\n          <md-table-container>\n            <table md-table>\n              <tbody md-body>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.SCHEDULED_CALLS">Scheduled Calls</span></td>\n                  <td md-cell>{{ vm.queueCampaign.erlangCalls }}</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.ONE_CALL_EVERY">One call every</span></td>\n                  <td md-cell>~ {{ vm.queueCampaign.erlangCallToSecond | number:0 }}s</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.DROPRATE">Drop Rate</span></td>\n                  <td md-cell>{{ vm.queueCampaign.erlangAbandonmentRate * 100 | number:2 }}%</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.AGENTBUSYFACTOR">Agent Busy Factor</span></td>\n                  <td md-cell>{{ vm.queueCampaign.erlangBusyFactor * 100 | number:2 }}%</td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n        </md-card>\n      </div>\n    </div>\n\n\n  </md-dialog-content>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.TALKING\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.BUSY\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.WAITING\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.ORIGINATED_TEXT\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.MESSAGE\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.METHOD\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.TRUNK\' | translate }}</th>\n        <th md-column md-order-by="dialActive">{{ \'MOTIONDIALER.ACTIVE\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="12">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedInDb }} ({{ queue.loggedIn }})</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.talking  + queue.pTalking}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedInDb - queue.available - queue.paused - queue.talking - queue.waiting\n               }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.originated }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{ queue.message ? (\'MOTIONDIALER.\'+queue.message | translate) : \'--\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.dialMethod || 0 }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{ queue.Trunk ? queue.Trunk.name : \'--\' }}</span>\n        </td>\n        <td md-cell>\n          <md-icon md-colors="{color: {{queue.dialActive ? \'\\\'green\\\'\' : \'\\\'red\\\'\'}}}" md-font-icon="{{queue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="MOTIONDIALER.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item ng-if="queue.dialMethod == \'predictive\'">\n                <md-button ng-click="vm.showPredictiveQueueCampaignInfo($event, queue)" translate="MOTIONDIALER.SHOW_PREDICTIVE_QUEUE_CAMPAIGN_INFO">\n                  Show Predictive Info\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="MOTIONDIALER.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/motiondialer/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.QUEUE_CALLS">Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.ABANDONEDCALLS">Abandoned Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.QUEUE_PARAMS">Queue Parameters</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.IVR_CAMPAIGNS">Ivr Campaigns</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/create/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.openchannelAccount.name" ng-required="true" autofocus ng-disabled="!vm.newOpenchannelAccount">\n\n        <div ng-messages="openchannelAccountForm[\'name\'].$error" ng-show="openchannelAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.openchannelAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="openchannelAccountForm[\'key\'].$error" ng-show="openchannelAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.REPLYURI">replyUri</label>\n        <input type="url" name="replyUri" ng-model="vm.openchannelAccount.replyUri">\n\n        <div class="hint"><span translate="OPENCHANNEL.HELP.REPLYURI"></span></div>\n        <div ng-messages="openchannelAccountForm[\'replyUri\'].$error" ng-show="openchannelAccountForm[\'replyUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.REPLYURI_REQUIRED">replyUri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="OPENCHANNEL.ERRORS.REPLYURI_MUST_VALID_URL">replyUri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.openchannelAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.LIST"></span></div>\n        <div ng-messages="openchannelAccountForm[\'ListId\'].$error" ng-show="openchannelAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.openchannelAccount.description">\n\n        <div ng-messages="openchannelAccountForm[\'description\'].$error" ng-show="openchannelAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOpenchannelAccount" ng-click="vm.saveOpenchannelAccount()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountForm.$invalid || openchannelAccountForm.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOpenchannelAccount" ng-click="vm.addNewOpenchannelAccount()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountForm.$invalid" aria-label="ADD" translate="OPENCHANNEL.ADD_OPENCHANNELACCOUNT" translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELACCOUNT">\n          ADD OPENCHANNELACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOpenchannelAccount" ng-click="vm.deleteOpenchannelAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="OPENCHANNEL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="OPENCHANNEL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",'<md-dialog class="openchannelAccount-dialog" aria-label="openchannelAccount" ng-init="vm.onInit()">\n  <form name="openchannelAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="OPENCHANNEL.AGENTADD_OPENCHANNELACCOUNT">Add Agent to openchannelAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/agent/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'agent\'].$error" ng-show="openchannelAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'timeout\'].$error" ng-show="openchannelAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/amazonlex/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'accesskeyid\'].$error" ng-show="openchannelAccountFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'secretaccesskey\'].$error" ng-show="openchannelAccountFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'lexregion\'].$error" ng-show="openchannelAccountFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'botname\'].$error" ng-show="openchannelAccountFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="openchannelAccountFormApp[\'welcomemessage\'].$error" ng-show="openchannelAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'times\'].$error" ng-show="openchannelAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="openchannelAccountFormApp[\'text\'].$error" ng-show="openchannelAccountFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/close/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'disposition\'].$error" ng-show="openchannelAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/dialogflow/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'key\'].$error" ng-show="openchannelAccountFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'language\'].$error" ng-show="openchannelAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="openchannelAccountFormApp[\'welcomemessage\'].$error" ng-show="openchannelAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'projectId\'].$error" ng-show="openchannelAccountFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'clientEmail\'].$error" ng-show="openchannelAccountFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="openchannelAccountFormApp[\'privateKey\'].$error" ng-show="openchannelAccountFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'language\'].$error" ng-show="openchannelAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="openchannelAccountFormApp[\'welcomemessage\'].$error" ng-show="openchannelAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'condition\'].$error" ng-show="openchannelAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'truepriority\'].$error" ng-show="openchannelAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'falsepriority\'].$error" ng-show="openchannelAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'priority\'].$error" ng-show="openchannelAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/noop/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'value\'].$error" ng-show="openchannelAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/queue/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'queue\'].$error" ng-show="openchannelAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'timeout\'].$error" ng-show="openchannelAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/system/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'command\'].$error" ng-show="openchannelAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'variable\'].$error" ng-show="openchannelAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/tag/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'tag\'].$error" ng-show="openchannelAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/openchannelCannedAnswers/dialog.html",'<md-dialog class="openchannelCannedAnswer-dialog" aria-label="New OpenchannelCannedAnswer">\n  <form name="openchannelCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.openchannelCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="openchannelCannedAnswerForm[\'key\'].$error" ng-show="openchannelCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.openchannelCannedAnswer.value" required></textarea>\n\n        <div ng-messages="openchannelCannedAnswerForm[\'value\'].$error" ng-show="openchannelCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.openchannelCannedAnswer.description">\n\n        <div ng-messages="openchannelCannedAnswerForm[\'description\'].$error" ng-show="openchannelCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOpenchannelCannedAnswer" ng-click="vm.saveOpenchannelCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="openchannelCannedAnswerForm.$invalid || openchannelCannedAnswerForm.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOpenchannelCannedAnswer" ng-click="vm.addNewOpenchannelCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="openchannelCannedAnswerForm.$invalid" aria-label="ADD" translate="OPENCHANNEL.ADD_OPENCHANNELCANNEDANSWER" translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELCANNEDANSWER">\n          ADD OPENCHANNELCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOpenchannelCannedAnswer" ng-click="vm.deleteOpenchannelCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="OPENCHANNEL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="OPENCHANNEL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/view.html",'<div id="openchannel-openchannelAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-openchannelAccounts-button md-icon-button" aria-label="Go to openchannelAccounts" ng-click="vm.gotoOpenchannelAccounts()" translate translate-attr-aria-label="OPENCHANNEL.GO_TO_OPENCHANNELACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="openchannelAccount-image" hide-xs>\n          <img ng-src="assets/images/business/openchannelAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.openchannelAccount.id}}\n            <span ng-if="vm.openchannelAccount.name">{{vm.openchannelAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="OPENCHANNEL.CREATED_AT"></span> <span>{{vm.openchannelAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.openchannelAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="OPENCHANNEL.AGENTADD_OPENCHANNELACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveOpenchannelAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (proxyForm.$invalid) || (dispositionForm.$invalid) || (openchannelDispositionsForm.$invalid) || (openchannelCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.openchannelAccount.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.openchannelAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="OPENCHANNEL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.REPLYURI">replyUri</label>\n                <input type="url" name="replyUri" ng-model="vm.openchannelAccount.replyUri" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="OPENCHANNEL.HELP.REPLYURI"></span></div>\n                <div ng-messages="generalForm[\'replyUri\'].$error" ng-show="generalForm[\'replyUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.REPLYURI_REQUIRED">replyUri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="OPENCHANNEL.ERRORS.REPLYURI_MUST_VALID_URL">replyUri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.openchannelAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="OPENCHANNEL.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.openchannelAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.MAPKEY">MapKey</label>\n                <md-select name="mapKey" ng-model="vm.openchannelAccount.mapKey" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">None</md-option>\n                  <md-optgroup label="standard">\n                    <md-option ng-value="mapKey.columnName" ng-repeat="mapKey in vm.fields" ng-if="!mapKey.columnName.toString().startsWith(\'cf_\')" ng-disabled="mapKey.canSelect === false">{{ mapKey.displayName }}</md-option>\n                  </md-optgroup>\n                  <md-optgroup label="custom">\n                    <md-option ng-value="mapKey.columnName" ng-repeat="mapKey in vm.fields" ng-if="mapKey.columnName.toString().startsWith(\'cf_\')" ng-disabled="mapKey.canSelect === false">{{ mapKey.displayName }}</md-option>\n                  </md-optgroup>\n                </md-select>\n                <div ng-messages="generalForm[\'mapKey\'].$error" ng-show="generalForm[\'mapKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.MAPKEY_REQUIRED">MapKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.openchannelAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.RECEIVEURI">receiveUri</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-receiveUri" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-receiveUri" name="receiveUri" ng-value="vm.location + \'/api/openchannel/accounts/\' + vm.openchannelAccount.id + \'/notify\'" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="OPENCHANNEL.HELP.RECEIVEURI"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="openchannelAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="OPENCHANNEL.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.openchannelAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="openchannelAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.openchannelAccount.queueTransfer == true" class="md-block">\n                <label translate="OPENCHANNEL.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.openchannelAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.openchannelAccount.agentTransfer == true" class="md-block">\n                <label translate="OPENCHANNEL.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.openchannelAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container proxy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.PROXY">PROXY</div>\n            </div>\n            <form name="proxyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.TOKEN">token</label>\n                <input type="text" name="token" ng-model="vm.openchannelAccount.token" autofocus disabled>\n\n                <div class="hint"><span translate="OPENCHANNEL.HELP.TOKEN"></span></div>\n                <div ng-messages="proxyForm[\'token\'].$error" ng-show="proxyForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.TOKEN_REQUIRED">token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="openchannelAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.openchannelAccount.mandatoryDisposition" class="md-block">\n                <label translate="OPENCHANNEL.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.openchannelAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="OPENCHANNEL.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="OpenchannelAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.openchannelAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="openchannelAccount-detail-form-container openchanneldispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedOpenchannelAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="OPENCHANNEL.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add openchannel dispositions" translate translate-attr-label="OPENCHANNEL.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="openchannelAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'OPENCHANNEL.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container openchannelcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="OpenchannelAccountOpenchannelCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.openchannelAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="OPENCHANNEL.OPENCHANNELCANNEDANSWERS">OpenchannelCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getOpenchannelAccountOpenchannelCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event)" aria-label="add openchannelCannedAnswer" translate translate-attr-label="OPENCHANNEL.ADD_OPENCHANNELCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length}} {{vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedOpenchannelAccountOpenchannelCannedAnswers" csv-label="true" filename="openchannelAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedOpenchannelAccountOpenchannelCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getOpenchannelAccountOpenchannelCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'OPENCHANNEL.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'OPENCHANNEL.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'OPENCHANNEL.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'OPENCHANNEL.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'OPENCHANNEL.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="openchannelCannedAnswer" md-select-id="id" ng-repeat="openchannelCannedAnswer in vm_dc.openchannelAccountOpenchannelCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{ openchannelCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" translate="OPENCHANNEL.EDIT_OPENCHANNELCANNEDANSWER">\n                                Edit OpenchannelCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(openchannelCannedAnswer, $event)" translate="OPENCHANNEL.DELETE_OPENCHANNELCANNEDANSWER">\n                                Delete OpenchannelCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.openchannelAccountOpenchannelCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="OPENCHANNEL.NO_OPENCHANNELCANNEDANSWER_AVAILABLE">No openchannelcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.openchannelAccountOpenchannelCannedAnswers.count}}" md-on-paginate="vm_dc.getOpenchannelAccountOpenchannelCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="OpenchannelAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.openchannelAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="OPENCHANNEL.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedOpenchannelAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedOpenchannelAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedOpenchannelAccountApps.length}} {{vm_ac.selectedOpenchannelAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedOpenchannelAccountApps($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedOpenchannelAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.openchannelAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editOpenchannelAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editOpenchannelAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editOpenchannelAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editOpenchannelAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.openchannelAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="OpenchannelAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.openchannelAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedOpenchannelAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="OPENCHANNEL.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getOpenchannelAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getOpenchannelAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getOpenchannelAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="OPENCHANNEL.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedOpenchannelAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedOpenchannelAccountInteractions.length}} {{vm_dc.selectedOpenchannelAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedOpenchannelAccountInteractions" csv-label="true" filename="openchannelAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedOpenchannelAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedOpenchannelAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getOpenchannelAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'OPENCHANNEL.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'OPENCHANNEL.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'OPENCHANNEL.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'OPENCHANNEL.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'OPENCHANNEL.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'OPENCHANNEL.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'OPENCHANNEL.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.openchannelAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'OPENCHANNEL.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'OPENCHANNEL.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spyopenchannelInteraction($event, interaction)" translate="OPENCHANNEL.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || (vm_dc.userProfile.downloadOmnichannelInteractions && vm_dc.userProfile.downloadAttachments)">\n                              <md-button class="md-primary" ng-click="vm_dc.openchannelInteractionDownload(interaction, $event, true)" translate="OPENCHANNEL.DOWNLOAD_WITH_ATTACHMENTS">\n                                Download with attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.openchannelInteractionDownload(interaction, $event)" translate="OPENCHANNEL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                                Download without attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="OPENCHANNEL.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.openchannelAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="OPENCHANNEL.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.openchannelAccountInteractions.count}}" md-on-paginate="vm_dc.getOpenchannelAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/openchannelAccounts.html",'<div id="openchannelAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-google-earth" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="OPENCHANNEL.OPENCHANNELACCOUNTS">OpenchannelAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="OPENCHANNEL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedOpenchannelAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedOpenchannelAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="OPENCHANNEL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-openchannelAccounts-count">\n          <span>{{vm.selectedOpenchannelAccounts.length}}</span>\n          <span translate="OPENCHANNEL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="OPENCHANNEL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllOpenchannelAccounts()" translate="OPENCHANNEL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectOpenchannelAccounts()" translate="OPENCHANNEL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedOpenchannelAccounts" csv-label="true" filename="openchannelAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedOpenchannelAccounts($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- OPENCHANNELACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedOpenchannelAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOpenchannelAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'OPENCHANNEL.KEY\' | translate }}</th>\n                <th md-column md-order-by="replyUri">{{ \'OPENCHANNEL.REPLYURI\' | translate }}</th>\n                <th md-column md-order-by="ListId">{{ \'OPENCHANNEL.LIST\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'OPENCHANNEL.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.openchannelAccounts.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="openchannelAccount" md-select-id="id" ng-repeat="openchannelAccount in vm.openchannelAccounts.rows">\n                <td md-cell ng-if="openchannelAccount.userpic"><img class="avatar" alt="{{openchannelAccount.name}}" ng-src="api/users/{{openchannelAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!openchannelAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{openchannelAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="id ">{{openchannelAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="name ">{{openchannelAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="key ">{{openchannelAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="replyUri ">{{openchannelAccount.replyUri}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="ListId ">{{ (vm.lists | filter : {\'id\':openchannelAccount.ListId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="description ">{{openchannelAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(openchannelAccount, $event    )" translate="OPENCHANNEL.EDIT_OPENCHANNELACCOUNT">\n                          Edit OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(openchannelAccount, $event    )" translate="OPENCHANNEL.INTERACTIONS_OPENCHANNELACCOUNT">\n                          Interactions OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(openchannelAccount, $event    )" translate="OPENCHANNEL.AGENTADD_OPENCHANNELACCOUNT">\n                          AgentAdd OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(openchannelAccount, $event    )" translate="OPENCHANNEL.DELETE_OPENCHANNELACCOUNT">\n                          Delete OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.openchannelAccounts.count}}" md-on-paginate="vm.getOpenchannelAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / OPENCHANNELACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD OPENCHANNELACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-openchannelAccount-button" ng-click="vm.createOrEditOpenchannelAccount($event)" aria-label="add openchannelAccount" translate translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD OPENCHANNELACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/openchannel/views/openchannelQueues/create/dialog.html",'<md-dialog class="openchannelQueue-dialog" aria-label="New OpenchannelQueue">\n  <form name="openchannelQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.openchannelQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newOpenchannelQueue">\n\n        <div class="hint"><span translate="OPENCHANNEL.HELP.NAME"></span></div>\n        <div ng-messages="openchannelQueueForm[\'name\'].$error" ng-show="openchannelQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="OPENCHANNEL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.openchannelQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="openchannelQueueForm[\'strategy\'].$error" ng-show="openchannelQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.openchannelQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="openchannelQueueForm[\'timeout\'].$error" ng-show="openchannelQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.openchannelQueue.description">\n\n        <div ng-messages="openchannelQueueForm[\'description\'].$error" ng-show="openchannelQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOpenchannelQueue" ng-click="vm.saveOpenchannelQueue()" class="send-button md-accent md-raised" ng-disabled="openchannelQueueForm.$invalid || openchannelQueueForm.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOpenchannelQueue" ng-click="vm.addNewOpenchannelQueue()" class="send-button md-accent md-raised" ng-disabled="openchannelQueueForm.$invalid" aria-label="ADD" translate="OPENCHANNEL.ADD_OPENCHANNELQUEUE" translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELQUEUE">\n          ADD OPENCHANNELQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOpenchannelQueue" ng-click="vm.deleteOpenchannelQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="OPENCHANNEL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="OPENCHANNEL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",'<md-dialog class="openchannelQueue-dialog" aria-label="openchannelQueue" ng-init="vm.onInit()">\n  <form name="openchannelQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="OPENCHANNEL.AGENTADD_OPENCHANNELQUEUE">Add Agent to openchannelQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",'<md-dialog class="openchannelQueue-dialog" aria-label="openchannelQueue" ng-init="vm.onInit()">\n  <form name="openchannelQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="OPENCHANNEL.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelQueues/edit/view.html",'<div id="openchannel-openchannelQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-openchannelQueues-button md-icon-button" aria-label="Go to openchannelQueues" ng-click="vm.gotoOpenchannelQueues()" translate translate-attr-aria-label="OPENCHANNEL.GO_TO_OPENCHANNELQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="openchannelQueue-image" hide-xs>\n          <img ng-src="assets/images/business/openchannelQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.openchannelQueue.id}}\n            <span ng-if="vm.openchannelQueue.name">{{vm.openchannelQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="OPENCHANNEL.CREATED_AT"></span> <span>{{vm.openchannelQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.openchannelQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="OPENCHANNEL.TEAMADD_OPENCHANNELQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.openchannelQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="OPENCHANNEL.AGENTADD_OPENCHANNELQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveOpenchannelQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.openchannelQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="OPENCHANNEL.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="OPENCHANNEL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.openchannelQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.openchannelQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.openchannelQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/openchannel/views/openchannelQueues/openchannelQueues.html",'<div id="openchannelQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-google-earth" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="OPENCHANNEL.OPENCHANNELQUEUES">OpenchannelQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="OPENCHANNEL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedOpenchannelQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedOpenchannelQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="OPENCHANNEL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-openchannelQueues-count">\n          <span>{{vm.selectedOpenchannelQueues.length}}</span>\n          <span translate="OPENCHANNEL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="OPENCHANNEL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllOpenchannelQueues()" translate="OPENCHANNEL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectOpenchannelQueues()" translate="OPENCHANNEL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedOpenchannelQueues" csv-label="true" filename="openchannelQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedOpenchannelQueues($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- OPENCHANNELQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedOpenchannelQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOpenchannelQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'OPENCHANNEL.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.openchannelQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="openchannelQueue" md-select-id="id" ng-repeat="openchannelQueue in vm.openchannelQueues.rows">\n                <td md-cell ng-if="openchannelQueue.userpic"><img class="avatar" alt="{{openchannelQueue.name}}" ng-src="api/users/{{openchannelQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!openchannelQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{openchannelQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelQueue, ev) : vm.createOrEditOpenchannelQueue($event, openchannelQueue)" md-cell class="id ">{{openchannelQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelQueue, ev) : vm.createOrEditOpenchannelQueue($event, openchannelQueue)" md-cell class="name ">{{openchannelQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelQueue, ev) : vm.createOrEditOpenchannelQueue($event, openchannelQueue)" md-cell class="strategy ">{{ vm.arraystrategy[openchannelQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(openchannelQueue, $event    )" translate="OPENCHANNEL.EDIT_OPENCHANNELQUEUE">\n                          Edit OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(openchannelQueue, $event    )" translate="OPENCHANNEL.TEAMADD_OPENCHANNELQUEUE">\n                          teamadd OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(openchannelQueue, $event    )" translate="OPENCHANNEL.AGENTADD_OPENCHANNELQUEUE">\n                          agentadd OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(openchannelQueue, $event    )" translate="OPENCHANNEL.DELETE_OPENCHANNELQUEUE">\n                          Delete OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(openchannelQueue, $event    )" translate="OPENCHANNEL.GOTOREALTIME_OPENCHANNELQUEUE">\n                          goToRealtime OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.openchannelQueues.count}}" md-on-paginate="vm.getOpenchannelQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / OPENCHANNELQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD OPENCHANNELQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-openchannelQueue-button" ng-click="vm.createOrEditOpenchannelQueue($event)" aria-label="add openchannelQueue" translate translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD OPENCHANNELQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/openchannel/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="OPENCHANNEL.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n        <th md-column>{{ \'OPENCHANNEL.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'OPENCHANNEL.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'OPENCHANNEL.WAITING\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedIn }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="OPENCHANNEL.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="OPENCHANNEL.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/openchannel/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/plugins/views/plugin/plugin.html",'<div ng-if="!vm.plugin">\n  <p>Plugin not available...</p>\n</div>\n<div id="plugin" ng-if="vm.plugin" ng-cloak layout-fill>\n  <iframe ng-src="{{vm.getTrustedURL()}}" frameborder=0 style="border:0px; width:100%; height:100%;"></iframe>\n</div>'),e.put("app/main/apps/realtime/views/agents/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools quick-filter-container">\n    <span class="md-subhead" translate="VOICE.AGENTS">Agents</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getAgents()" query="vm.query" debounce="300"></ms-search-bar>\n    <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = null; vm.getAgents()" aria-label="Status filter">\n      <md-option ng-value="null">{{ \'VOICE.ALL\' | translate }}</md-option>\n      <md-option value="pause">{{ \'VOICE.PAUSE\' | translate }}</md-option>\n      <md-option value="*pause">{{ \'VOICE.PARTIALPAUSE\' | translate }}</md-option>\n      <md-option value="busy">{{ \'VOICE.BUSY\' | translate }}</md-option>\n      <md-option value="idle">{{ \'VOICE.IDLE\' | translate }}</md-option>\n    </md-select>\n    <md-select ng-if="vm.query.globalStatusFilter === \'pause\' || vm.query.globalStatusFilter === \'*pause\'" ng-model="vm.query.pauseTypeFilter" class="md-caption ml-16" ng-change="vm.getAgents()">\n      <md-option ng-value="null">{{ \'VOICE.ALL\' | translate }}</md-option>\n      <md-option value="DEFAULT PAUSE">{{ \'VOICE.DEFAULT_PAUSE\' | translate | uppercase }}</md-option>\n      <md-option value="ACW">ACW</md-option>\n      <md-option value="LOGININPAUSE">{{ \'STAFF.LOGININPAUSE\' | translate | uppercase }}</md-option>\n      <md-option value="Auto-Pause">{{ \'VOICE.AUTOPAUSE\' | translate | uppercase }}</md-option>\n      <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n    </md-select>\n    <md-select ng-model="vm.query.globalQueueFilter" multiple class="md-caption margin-left-10 mw-150" placeholder="{{ \'DASHBOARDS.SELECT_QUEUE\' | translate }}" md-on-open="vm.getQueuesByChannel()" md-on-close="vm.getAgents()">\n      <md-button ng-click="vm.selectAllQueues()" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.SELECT_ALL\' | translate}}</md-button>\n      <md-option ng-value="queue.id" ng-repeat="queue in vm.queues.rows">{{\n        queue.name }}</md-option>\n      <md-button ng-click="vm.clearQueuesSelection()" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.CLEAR\' | translate}}</md-button>\n    </md-select>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.getAgents">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAgents">\n      <tr md-row>\n        <th class="bv text-center" colspan="5">{{ \'VOICE.AGENT\' | translate }}</th>\n        <th class="bv bl text-center" colspan="2">{{ \'VOICE.VOICE\' | translate }}</th>\n        <th ng-if="vm.license.chat" class="bv bl text-center" colspan="2">{{ \'CHAT.CHAT\' | translate }}</th>\n        <th ng-if="vm.license.mail" class="bv bl text-center" colspan="2">{{ \'MAIL.MAIL\' | translate }}</th>\n        <th ng-if="vm.license.messaging" class="bv bl text-center" colspan="2">{{ \'SMS.SMS\' | translate }}</th>\n        <th ng-if="vm.license.openchannel" class="bv bl text-center" colspan="2">\n          {{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n        <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n        <th ng-if="vm.license.whatsapp" class="bv bl text-center" colspan="2">\n          {{ \'WHATSAPP.WHATSAPP\' | translate }}</th>\n        <th width="10px" class="bt bl" rowspan="2"></th>\n      </tr>\n      <tr md-row>\n        <th class="bl" colspan="2" md-column md-order-by="fullname">\n          {{ \'VOICE.NAME\' | translate }}</th>\n        <th class="bl custom-column" md-column md-order-by="globalStatus">\n          {{ \'VOICE.STATUS\' | translate }}</th>\n        <th class="bl custom-column" md-column md-order-by="lastLoginAt">\n          {{ \'VOICE.LOGIN_TIME\' | translate }}</th>\n        <th class="bl custom-column" md-column md-order-by="lastPauseAt">\n          {{ \'VOICE.PAUSE_TIME\' | translate }}</th>\n        <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n        <th class="bl custom-column">Info</th>\n        <th ng-if="vm.license.chat" class="bl text-center">{{ \'CHAT.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.chat" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'CHAT.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.mail" class="bl text-center">{{ \'MAIL.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.mail" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'MAIL.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.messaging" class="bl text-center">{{ \'SMS.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.messaging" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'SMS.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.openchannel" class="bl text-center">{{ \'OPENCHANNEL.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.openchannel" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'OPENCHANNEL.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.fax" class="bl text-center">{{ \'FAX.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.fax" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'FAX.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.whatsapp" class="bl text-center">{{ \'WHATSAPP.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.whatsapp" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'WHATSAPP.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.agents.count > 0">\n        <td md-cell colspan="19">\n          <div layout="row" layout-align="center center">\n            <span>{{ \'VOICE.NO_AGENT_ONLINE\' | translate }}</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-select="agent" md-select-id="id" ng-repeat="agent in vm.agents.rows">\n        <td class="bt padding-5">\n          <div layout="row" layout-align="start center">\n            <img class="avatar" ng-src="{{agent.userpic && \'api/users/\'+ agent.id +\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n            <div layout="column">\n              <span>{{agent.fullname}}</span>\n              <span>{{agent.internal}}</span>\n            </div>\n          </div>\n        </td>\n        <td class="bt padding-5">\n          <div layout="row" layout-align="start center" ng-if="vm.license.screenrecording && (agent.phoneBarEnableScreenRecordingByAgent || agent.phoneBarEnableAutomaticScreenRecording)">\n            <div class="column">\n              <span>\n                <md-icon md-font-icon="icon-camcorder-box" ng-class="agent.screenrecording ? \'green-fg\' : \'grey-fg\'" aria-hidden="true">\n                  <md-tooltip>\n                    {{ agent.screenrecording ? \'VOICE.TOOLTIP_SCREENRECORDING_ON\' : \'VOICE.TOOLTIP_SCREENRECORDING_OFF\'\n                    | translate }}\n                  </md-tooltip>\n                </md-icon>\n              </span>\n            </div>\n          </div>\n        </td>\n        <td class="bt text-center">\n'+"          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','busy':'indigo-100-bg','*pause':'amber-50-bg','pause':'amber-200-bg'}[agent.globalStatus]\">\n            <span ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\">{{ 'VOICE.PAUSE' | translate | uppercase }} (</span>{{\n              ['pause', '*pause'].includes(agent.globalStatus) ? \n                ((agent.globalStatusDisplayValue === 'DEFAULT PAUSE' ? ('VOICE.DEFAULT_PAUSE' | translate) : agent.globalStatusDisplayValue) | uppercase) : \n                ('VOICE.' + (agent.globalStatusDisplayValue | uppercase) | translate | uppercase) }}<span ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\">)</span>\n          </span>\n        </td>\n        <td class=\"bt custom-column\">\n          <timer start-time=\"agent.lastLoginAt\" utc-offset=\"vm.utcOffset\"></timer>\n        </td>\n        <td class=\"bt custom-column\">\n          <timer ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\" start-time=\"agent.lastPauseAt\" utc-offset=\"vm.utcOffset\"></timer>\n        </td>\n        <td class=\"bt bl text-center\">\n          <span ng-if=\"!agent.onhold\" class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','talking':'indigo-100-bg','ringing':'orange-400-bg','pause':'amber-200-bg'}[agent.voiceStatus]\">\n            {{ 'VOICE.' + (agent.voiceStatus | uppercase) | translate | uppercase }}</span>\n          <span ng-if=\"agent.onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">\n            {{ 'VOICE.ONHOLD' | translate | uppercase }}</span>\n        </td>\n        <td class=\"bt bl\">\n          <div layout=\"column\" ng-if=\"agent.voiceStatus === 'talking' || agent.voiceStatus === 'ringing'\">\n            <span ng-if=\"agent.queue\" class=\"padding-5\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\">{{\n              agent.queue }}</span>\n            <span ng-if=\"agent.destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\" privacy ng-cloak>{{\n              agent.destconnectedlinenum }}</span>\n            <span ng-if=\"agent.routealias\" class=\"padding-5\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\">{{\n              agent.routealias }}</span>\n            <span class=\"padding-5\" ng-if=\"agent.queue || agent.destconnectedlinenum\">\n              <timer start-time=\"agent.voiceStatusTime\" utc-offset=\"vm.utcOffset\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\">\n              </timer>\n            </span>\n          </div>\n        </td>\n        <td class=\"bt bl text-center\" ng-if=\"vm.license.chat\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.chatStatus]\">\n            {{ 'VOICE.' + (agent.chatStatus | uppercase) | translate | uppercase }}</span>\n        </td>\n        <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.chatStatus]\">\n          {{ agent.chatCurrentCapacity }}</td>\n        <td class=\"bl bt text-center\" ng-if=\"vm.license.mail\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.mailStatus]\">\n            {{ 'VOICE.' + (agent.mailStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.mailStatus]\">\n          {{ agent.mailCurrentCapacity }}</td>\n        <td class=\"bl bt text-center\" ng-if=\"vm.license.messaging\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.smsStatus]\">\n            {{ 'VOICE.' + (agent.smsStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.smsStatus]\">\n          {{ agent.smsCurrentCapacity }}</td>\n        <td class=\"bt bl text-center\" ng-if=\"vm.license.openchannel\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.openchannelStatus]\">\n            {{ 'VOICE.' + (agent.openchannelStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.openchannelStatus]\">\n          {{ agent.openchannelCurrentCapacity }}</td>\n        <td class=\"bt bl text-center\" ng-if=\"vm.license.fax\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.faxStatus]\">\n            {{ 'VOICE.' + (agent.faxStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.faxStatus]\">\n          {{ agent.faxCurrentCapacity }}</td>\n        <td class=\"bl bt text-center\" ng-if=\"vm.license.whatsapp\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.whatsappStatus]\">\n            {{ 'VOICE.' + (agent.whatsappStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.whatsapp\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.whatsappStatus]\">\n          {{ agent.whatsappCurrentCapacity }}</td>\n        <td class=\"bl bt padding-5 text-center\" ng-if=\"vm.crudPermissions.canEdit\">\n          <md-menu>\n            <md-button class=\"md-icon-button\" aria-label=\"More\" translate translate-attr-aria-label=\"STAFF.MORE\" ng-click=\"$mdOpenMenu($event)\">\n              <md-icon md-font-icon=\"icon-dots-vertical\"></md-icon>\n            </md-button>\n            <md-menu-content width=\"4\">\n              <md-menu-item>\n                <md-button ng-click=\"vm.logout(agent, $event)\" translate=\"VOICE.LOGOUT\">\n                  Logout\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click=\"vm.addQueue(agent, $event)\" translate=\"{{ vm.channel.toUpperCase() + '.AGENTADD_QUEUE' }}\">\n                  Add Agent In Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item ng-if=\"vm.license.screenrecording && agent.phoneBarEnableScreenRecordingByAgent\">\n                <md-menu>\n                  <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"VOICE.SCREENRECORDING\">Manage Screen Recording\n                  </md-button>\n                  <md-menu-content>\n                    <md-menu-item>\n                      <md-button ng-click=\"vm.manageScreenRecording(agent, !agent.screenrecording)\" translate=\"{{ agent.screenrecording ? 'VOICE.STOP_SCREENRECORDING' : 'VOICE.START_SCREENRECORDING' }}\" aria-label=\"Screen Recording\">\n                      </md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item>\n                <md-menu>\n                  <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"VOICE.PAUSE\">Pause</md-button>\n                  <md-menu-content>\n                    <md-menu-item>\n                      <md-button ng-disabled=\"agent.voicePause && 'DEFAULT PAUSE' === agent.pauseType\" ng-click=\"vm.pause(agent)\">\n                        <em translate=\"VOICE.DEFAULT_PAUSE\">Default Pause</em>\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if=\"vm.pauses.rows.length\" ng-repeat=\"pause in vm.pauses.rows\">\n                      <md-button ng-disabled=\"agent.voicePause && pause.name === agent.pauseType\" ng-click=\"vm.pause(agent, pause.name)\">{{pause.name}}\n                      </md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\">\n                <md-button ng-click=\"vm.unpause(agent)\" translate=\"VOICE.UNPAUSE\">\n                  Unpause\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n<md-table-pagination md-label=\"{page: '{{'VOICE.PAGE' | translate}}:', rowsPerPage: '{{'VOICE.ROWSPERPAGE' | translate}}:', of: '{{'VOICE.OF' | translate}}'}\" md-limit=\"vm.query.limit\" md-limit-options=\"[10, 15, 20, 50, 100, 250]\" md-page=\"vm.query.page\" md-total=\"{{vm.agents.count}}\" md-on-paginate=\"vm.getAgents\" md-page-select></md-table-pagination>"),e.put("app/main/apps/settings/views/cloudProviders/cloudProviders.html",'<div id="cloudProviders" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.CLOUD_PROVIDERS">Cloud Providers</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SETTINGS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedAiTools.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedAiTools =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SETTINGS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-cloudProviders-count">\n          <span>{{vm.selectedAiTools.length}}</span>\n          <span translate="SETTINGS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SETTINGS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllAiTools()" translate="SETTINGS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectAiTools()" translate="SETTINGS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedAiTools" csv-label="true" filename="cloudProviders.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-click="vm.deleteSelectedAiTools($event)" aria-label="delete selected" translate translate-attr-label="SETTINGS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CLOUDPROVIDER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedAiTools" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAiTools">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SETTINGS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'SETTINGS.NAME\' | translate }}</th>\n                <th md-column md-order-by="service">{{ \'SETTINGS.SERVICE\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.cloudProviders.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SETTINGS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="cloudProvider" md-select-id="id" ng-repeat="cloudProvider in vm.cloudProviders.rows">\n                <td ng-click="vm.createOrEditCloudProvider($event, cloudProvider)" md-cell class="id">{{cloudProvider.id}}</td>\n                <td ng-click="vm.createOrEditCloudProvider($event, cloudProvider)" md-cell class="name">{{cloudProvider.name}}</td>\n                <td ng-click="vm.createOrEditCloudProvider($event, cloudProvider)" md-cell class="service">{{ vm.services[cloudProvider.service] }}</td>\n\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SETTINGS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="cloudProvider.service === \'MicrosoftAzure\'">\n                        <md-button ng-click="vm.authenticateToMicrosoftIdentityPlatform(cloudProvider)" translate="SETTINGS.AUTHENTICATE">\n                          Authenticate\n                        </md-button>\n                      </md-menu-item>\n\n                      <md-menu-item ng-if="cloudProvider.service === \'MicrosoftAzure\'">\n                        <md-button ng-click="vm.updateClientSecret(cloudProvider, $event)" translate="SETTINGS.UPDATE_CLIENT_SECRET">\n                          Update Client Secret\n                        </md-button>\n                      </md-menu-item>\n\n                      <md-menu-item>\n                        <md-button ng-click="vm.editdialog(cloudProvider, $event)" translate="SETTINGS.EDIT_CLOUDPROVIDER">\n                          Edit CloudProvider\n                        </md-button>\n                      </md-menu-item>\n\n                      <md-menu-item>\n                        <md-button ng-click="vm.deleteconfirm(cloudProvider, $event)" translate="SETTINGS.DELETE_CLOUDPROVIDER">\n                          Delete CloudProvider\n                        </md-button>\n                      </md-menu-item>\n\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SETTINGS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SETTINGS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SETTINGS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.cloudProviders.count}}" md-on-paginate="vm.getAiTools" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CLOUDPROVIDER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CLOUDPROVIDER BUTTON --\x3e\n  <md-button class="md-fab md-accent" id="add-cloudProvider-button" ng-click="vm.createOrEditCloudProvider($event)" aria-label="add cloudProvider" translate translate-attr-aria-label="SETTINGS.ADD_CLOUDPROVIDER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CLOUDPROVIDER BUTTON --\x3e\n</div>'),e.put("app/main/apps/settings/views/cloudProviders/create/dialog.html",'<md-dialog class="cloudProvider-dialog" aria-label="New CloudProvider">\n  <form name="cloudProviderForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ (vm.newCloudProvider ? \'SETTINGS.NEW_CLOUDPROVIDER\' : \'SETTINGS.EDIT_CLOUDPROVIDER\') | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.cloudProvider.name" ng-required="true" autofocus>\n\n        <div ng-messages="cloudProviderForm[\'name\'].$error" ng-show="cloudProviderForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.SERVICE">Service</label>\n        <md-select name="service" ng-model="vm.cloudProvider.service" required ng-disabled="!vm.newCloudProvider">\n          <md-option ng-if="vm.license.ai" ng-value="\'AmazonAWS\'">AmazonAWS</md-option>\n          <md-option ng-value="\'MicrosoftAzure\'">Microsoft Azure</md-option>\n        </md-select>\n        <div ng-messages="cloudProviderForm[\'service\'].$error" ng-show="cloudProviderForm[\'service\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.SERVICE_REQUIRED">Service field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.cloudProvider.service == \'MicrosoftAzure\'" class="md-block">\n        <label translate="SETTINGS.TYPE">Type</label>\n        <md-select name="service" ng-model="vm.cloudProvider.type" required ng-disabled="!vm.newCloudProvider">\n          <md-option ng-value="\'Outlook365\'">Outlook365</md-option>\n          <md-option ng-value="\'Dynamics365\'">Dynamics365</md-option>\n        </md-select>\n        <div ng-messages="cloudProviderForm[\'type\'].$error" ng-show="cloudProviderForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.cloudProvider.service == \'AmazonAWS\'" class="md-block">\n        <label translate="SETTINGS.ACCESSKEY">AccessKey</label>\n        <input type="text" name="data2" ng-model="vm.cloudProvider.data2" ng-required="true">\n\n        <div ng-messages="cloudProviderForm[\'data2\'].$error" ng-show="cloudProviderForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.ACCESSKEY_REQUIRED">AccessKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.cloudProvider.service == \'AmazonAWS\'" class="md-block">\n        <label translate="SETTINGS.SECRETACCESSKEY">SecretAccesskey</label>\n        <input type="text" name="data1" ng-model="vm.cloudProvider.data1" ng-required="true">\n\n        <div ng-messages="cloudProviderForm[\'data1\'].$error" ng-show="cloudProviderForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.SECRETACCESSKEY_REQUIRED">SecretAccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div ng-if="vm.cloudProvider.service == \'MicrosoftAzure\'">\n        <md-input-container class="md-block">\n          <label translate="SETTINGS.APPLICATION_ID">Application Id</label>\n          <input type="text" name="data1" ng-model="vm.cloudProvider.data1" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data1\'].$error" ng-show="cloudProviderForm[\'data1\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block">\n          <label translate="SETTINGS.TENANT_ID">Tenant Id</label>\n          <input type="text" name="data2" ng-model="vm.cloudProvider.data2" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data2\'].$error" ng-show="cloudProviderForm[\'data2\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container ng-if="vm.newCloudProvider" class="md-block">\n          <label translate="SETTINGS.CLIENT_SECRET">Client Secret</label>\n          <input type="password" name="data3" ng-model="vm.cloudProvider.data3" ng-required="true">\n          <div class="hint"><span translate="SETTINGS.HELP.CLIENT_SECRET"></span></div>\n\n          <div ng-messages="cloudProviderForm[\'data3\'].$error" ng-show="cloudProviderForm[\'data3\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block">\n          <label translate="SETTINGS.REDIRECT_URI">Redirect Uri</label>\n          <input type="url" name="data4" ng-model="vm.cloudProvider.data4" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data4\'].$error" ng-show="cloudProviderForm[\'data4\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n            <div ng-message="url">\n              <span translate="SETTINGS.ERRORS.WRONG_FORMAT"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container ng-if="vm.cloudProvider.type == \'Dynamics365\'" class="md-block">\n          <label translate="SETTINGS.REMOTE_URI">Remote Uri</label>\n          <input type="url" name="data7" ng-model="vm.cloudProvider.data7" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data7\'].$error" ng-show="cloudProviderForm[\'data7\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n            <div ng-message="url">\n              <span translate="SETTINGS.ERRORS.WRONG_FORMAT"></span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newCloudProvider" ng-click="vm.saveCloudProvider()" class="send-button md-accent md-raised" ng-disabled="cloudProviderForm.$invalid || cloudProviderForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newCloudProvider" ng-click="vm.addNewCloudProvider()" class="send-button md-accent md-raised" ng-disabled="cloudProviderForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_CLOUDPROVIDER" translate-attr-aria-label="SETTINGS.ADD_CLOUDPROVIDER">\n          ADD CLOUDPROVIDER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-click="vm.deleteCloudProvider($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/cloudProviders/updateSecret/updateSecret.html",'<md-dialog class="cloudProvider-dialog" aria-label="update client secret">\n  <form name="updateSecretForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'SETTINGS.UPDATE_CLIENT_SECRET\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.user.id">\n        <label translate="SETTINGS.CLIENT_SECRET">Current Client Secret</label>\n        <input type="text" name="currentSecret" ng-model="vm.cloudProvider.data3" disabled>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.NEW_CLIENT_SECRET">New Client Secret</label>\n        <input type="password" name="secret" ng-model="vm.newSecret" required>\n        <div ng-messages="updateSecretForm.secret.$error" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">New Client Secret field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveSecret()" class="send-button md-accent md-raised" ng-disabled="updateSecretForm.$invalid || updateSecretForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/customizations/create/dialog.html",'<md-dialog class="customization-dialog" aria-label="New Customization">\n  <form name="customizationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultLogo" aria-label="Default_Logo"><span translate="SETTINGS.DEFAULT_LOGO">Default_Logo</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultLoginLogo" aria-label="Default_Login_Logo"><span translate="SETTINGS.DEFAULT_LOGIN_LOGO">Default_Login_Logo</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultFavicon" aria-label="Default_Favicon"><span translate="SETTINGS.DEFAULT_FAVICON">Default_Favicon</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultHeaderWhiteLabel" aria-label="Default_Header_WhiteLabel"><span translate="SETTINGS.DEFAULT_HEADER_WHITELABEL">Default_Header_WhiteLabel</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.customization.defaultHeaderWhiteLabel" class="md-block">\n        <label translate="SETTINGS.HEADER_WHITELABEL">Header_WhiteLabel</label>\n        <input type="text" name="headerWhiteLabel" ng-model="vm.customization.headerWhiteLabel" ng-required="true">\n\n        <div ng-messages="customizationForm[\'headerWhiteLabel\'].$error" ng-show="customizationForm[\'headerWhiteLabel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.HEADER_WHITELABEL_REQUIRED">Header_WhiteLabel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultPageTitle" aria-label="Default_Page_Title"><span translate="SETTINGS.DEFAULT_PAGE_TITLE">Default_Page_Title</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.customization.defaultPageTitle" class="md-block">\n        <label translate="SETTINGS.PAGE_TITLE">Page_Title</label>\n        <input type="text" name="pageTitle" ng-model="vm.customization.pageTitle" ng-required="true">\n\n        <div ng-messages="customizationForm[\'pageTitle\'].$error" ng-show="customizationForm[\'pageTitle\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.PAGE_TITLE_REQUIRED">Page_Title field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.license.preferred" class="md-block">\n        <md-switch ng-model="vm.customization.defaultPreferred" aria-label="Default_Preferred"><span translate="SETTINGS.DEFAULT_PREFERRED">Default_Preferred</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCustomization" ng-click="vm.saveCustomization()" class="send-button md-accent md-raised" ng-disabled="customizationForm.$invalid || customizationForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCustomization" ng-click="vm.addNewCustomization()" class="send-button md-accent md-raised" ng-disabled="customizationForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_CUSTOMIZATION" translate-attr-aria-label="SETTINGS.ADD_CUSTOMIZATION">\n          ADD CUSTOMIZATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCustomization" ng-click="vm.deleteCustomization($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/customizations/customizations.html",'<div id="customizations" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.CUSTOMIZATIONS">Customizations</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div>\n      <md-button type="submit" ng-click="vm.saveCustomization()" ng-disabled="(customizationsForm.$pristine && logoForm.$pristine && logologinForm.$pristine && preferredForm.$pristine && faviconForm.$pristine) || (customizationsForm.$invalid || logoForm.$invalid || logologinForm.$invalid || preferredForm.$invalid || faviconForm.$invalid)" class="send-button md-accent md-raised" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      <div class="customization-detail-form-container customizations md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.CUSTOMIZATIONS">CUSTOMIZATIONS</div>\n        </div>\n        <form name="customizationsForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultLogo" aria-label="Default_Logo"><span translate="SETTINGS.DEFAULT_LOGO">Default_Logo</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultLoginLogo" aria-label="Default_Login_Logo"><span translate="SETTINGS.DEFAULT_LOGIN_LOGO">Default_Login_Logo</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultFavicon" aria-label="Default_Favicon"><span translate="SETTINGS.DEFAULT_FAVICON">Default_Favicon</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultHeaderWhiteLabel" aria-label="Default_Header_WhiteLabel"><span translate="SETTINGS.DEFAULT_HEADER_WHITELABEL">Default_Header_WhiteLabel</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="!vm.customization.defaultHeaderWhiteLabel" class="md-block">\n            <label translate="SETTINGS.HEADER_WHITELABEL">Header_WhiteLabel</label>\n            <input type="text" name="headerWhiteLabel" ng-model="vm.customization.headerWhiteLabel" ng-required="true">\n\n            <div ng-messages="customizationsForm[\'headerWhiteLabel\'].$error" ng-show="customizationsForm[\'headerWhiteLabel\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.HEADER_WHITELABEL_REQUIRED">Header_WhiteLabel field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultPageTitle" aria-label="Default_Page_Title"><span translate="SETTINGS.DEFAULT_PAGE_TITLE">Default_Page_Title</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="!vm.customization.defaultPageTitle" class="md-block">\n            <label translate="SETTINGS.PAGE_TITLE">Page_Title</label>\n            <input type="text" name="pageTitle" ng-model="vm.customization.pageTitle" ng-required="true">\n\n            <div ng-messages="customizationsForm[\'pageTitle\'].$error" ng-show="customizationsForm[\'pageTitle\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PAGE_TITLE_REQUIRED">Page_Title field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.license.preferred" class="md-block">\n            <md-switch ng-model="vm.customization.defaultPreferred" aria-label="Default_Preferred"><span translate="SETTINGS.DEFAULT_PREFERRED">Default_Preferred</span></md-switch>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div ng-if="!vm.customization.defaultLogo" class="customization-detail-form-container logo md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.LOGO">LOGO</div>\n        </div>\n        <div ng-controller="CustomizationlogoController as vm_cl" ng-init="vm_cl.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cl.ngFlowOptions" flow-name="vm_cl.ngFlow.flow" flow-files-submitted="vm_cl.upload()" flow-file-added="vm_cl.fileAdded($file)" flow-file-success="vm_cl.fileSuccess($file, $message)" flow-complete="vm_cl.uploadComplete()" flow-drop flow-drag-enter="vm_cl.dropping=true" flow-drag-leave="vm_cl.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="logoimage in vm_cl.customization.images" ng-switch="logoimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{logoimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="logoimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{logoimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n      <div ng-if="!vm.customization.defaultLoginLogo" class="customization-detail-form-container logologin md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.LOGOLOGIN">LOGOLOGIN</div>\n        </div>\n        <div ng-controller="CustomizationlogologinController as vm_cll" ng-init="vm_cll.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cll.ngFlowOptions" flow-name="vm_cll.ngFlow.flow" flow-files-submitted="vm_cll.upload()" flow-file-added="vm_cll.fileAdded($file)" flow-file-success="vm_cll.fileSuccess($file, $message)" flow-complete="vm_cll.uploadComplete()" flow-drop flow-drag-enter="vm_cll.dropping=true" flow-drag-leave="vm_cll.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="logologinimage in vm_cll.customization.images" ng-switch="logologinimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{logologinimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="logologinimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{logologinimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n      <div ng-if="!vm.customization.defaultPreferred && vm.license.preferred" class="customization-detail-form-container preferred md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.PREFERRED">PREFERRED</div>\n        </div>\n        <div ng-controller="CustomizationpreferredController as vm_cp" ng-init="vm_cp.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cp.ngFlowOptions" flow-name="vm_cp.ngFlow.flow" flow-files-submitted="vm_cp.upload()" flow-file-added="vm_cp.fileAdded($file)" flow-file-success="vm_cp.fileSuccess($file, $message)" flow-complete="vm_cp.uploadComplete()" flow-drop flow-drag-enter="vm_cp.dropping=true" flow-drag-leave="vm_cp.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="preferredimage in vm_cp.customization.images" ng-switch="preferredimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{preferredimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="preferredimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{preferredimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n      <div ng-if="!vm.customization.defaultFavicon" class="customization-detail-form-container favicon md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.FAVICON">FAVICON</div>\n        </div>\n        <div ng-controller="CustomizationfaviconController as vm_cf" ng-init="vm_cf.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cf.ngFlowOptions" flow-name="vm_cf.ngFlow.flow" flow-files-submitted="vm_cf.upload()" flow-file-added="vm_cf.fileAdded($file)" flow-file-success="vm_cf.fileSuccess($file, $message)" flow-complete="vm_cf.uploadComplete()" flow-drop flow-drag-enter="vm_cf.dropping=true" flow-drag-leave="vm_cf.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG, ICO - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="faviconimage in vm_cf.customization.images" ng-switch="faviconimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{faviconimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="faviconimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{faviconimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/settings/views/generals/create/dialog.html",'<md-dialog class="general-dialog" aria-label="New General">\n  <form name="generalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newGeneral" ng-click="vm.saveGeneral()" class="send-button md-accent md-raised" ng-disabled="generalForm.$invalid || generalForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newGeneral" ng-click="vm.addNewGeneral()" class="send-button md-accent md-raised" ng-disabled="generalForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_GENERAL" translate-attr-aria-label="SETTINGS.ADD_GENERAL">\n          ADD GENERAL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newGeneral" ng-click="vm.deleteGeneral($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/generals/generals.html",'<div id="generals" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.GENERAL">General</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div>\n      <md-button type="submit" ng-click="vm.saveGeneral()" ng-disabled="(globalForm.$pristine && motionbarForm.$pristine && reportForm.$pristine && agentOmniDesktopInterfaceForm.$pristine && screenRecordingForm.$pristine && securityForm.$pristine && imapGeneralSettingsForm.$pristine && SSOForm.$pristine && aiToolsForm.$pristine) || (globalForm.$invalid || motionbarForm.$invalid || reportForm.$invalid || agentOmniDesktopInterfaceForm.$invalid || screenRecordingForm.$invalid || securityForm.$invalid || imapGeneralSettingsForm.$invalid || SSOForm.$invalid || aiToolsForm.$invalid)" class="send-button md-accent md-raised" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      <div class="general-detail-form-container global md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.GLOBAL">GLOBAL</div>\n        </div>\n        <form name="globalForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.MIN_INTERNAL">Min_Internal</label>\n            <input type="number" name="min_internal" ng-model="vm.general.min_internal" min="0" value="1000" ng-required="true" autofocus>\n\n            <div ng-messages="globalForm[\'min_internal\'].$error" ng-show="globalForm[\'min_internal\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MIN_INTERNAL_REQUIRED">Min_Internal field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.MIN_INTERNAL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Min_Internal must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.CHATTIMEOUT">chatTimeout</label>\n            <input type="number" name="chatTimeout" ng-model="vm.general.chatTimeout" min="0" value="30" ng-required="true">\n\n            <div ng-messages="globalForm[\'chatTimeout\'].$error" ng-show="globalForm[\'chatTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.CHATTIMEOUT_REQUIRED">chatTimeout field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.CHATTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">chatTimeout must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.rtlSupport" aria-label="RtlSupport"><span translate="SETTINGS.RTLSUPPORT">RtlSupport</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.RTLSUPPORT"></span></div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.stopRecordingOnTransfer" aria-label="Stop_Recording_On_Voice_Call_Transfer"><span translate="SETTINGS.STOP_RECORDING_ON_VOICE_CALL_TRANSFER">Stop_Recording_On_Voice_Call_Transfer</span></md-switch>\n          </md-input-container>\n        </form>\n      </div>\n\n      <div class="general-detail-form-container motionbar md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.MOTIONBAR">MOTIONBAR</div>\n        </div>\n        <form name="motionbarForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.phoneBarAutoUpdater" aria-label="MotionbarAutoUpdater"><span translate="SETTINGS.MOTIONBARAUTOUPDATER">MotionbarAutoUpdater</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.phoneBarAutoUpdater" class="md-block">\n            <label translate="SETTINGS.MOTIONBARAUTOUPDATERURL">MotionbarAutoUpdaterUrl</label>\n            <input type="url" name="phoneBarAutoUpdaterUrl" ng-model="vm.general.phoneBarAutoUpdaterUrl" value="https://www.xcally.com/bar/phonebar/autoupdater.xml" ng-required="vm.general.phoneBarAutoUpdater">\n\n            <div ng-messages="motionbarForm[\'phoneBarAutoUpdaterUrl\'].$error" ng-show="motionbarForm[\'phoneBarAutoUpdaterUrl\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MOTIONBARAUTOUPDATERURL_REQUIRED">MotionbarAutoUpdaterUrl field is required</span>\n              </div>\n              <div ng-message="url">\n                <span translate="SETTINGS.ERRORS.MOTIONBARAUTOUPDATERURL_MUST_VALID_URL">MotionbarAutoUpdaterUrl must be a valid url http://www.xcally.com</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.phoneBarRememberMeEnabled" aria-label="MotionbarRememberMe"><span translate="SETTINGS.MOTIONBARREMEMBERME">MotionbarRememberMe</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.MOTIONBARREMEMBERME"></span></div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container report md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.REPORT">REPORT</div>\n        </div>\n        <form name="reportForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.split" aria-label="Split"><span translate="SETTINGS.SPLIT">Split</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.split" class="md-block">\n            <label translate="SETTINGS.SPLITSIZECSV">SplitSizeCsv</label>\n            <input type="number" name="splitSizeCsv" ng-model="vm.general.splitSizeCsv" value="5000">\n\n            <div ng-messages="reportForm[\'splitSizeCsv\'].$error" ng-show="reportForm[\'splitSizeCsv\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SPLITSIZECSV_REQUIRED">SplitSizeCsv field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.split" class="md-block">\n            <label translate="SETTINGS.SPLITSIZEPDF">SplitSizePdf</label>\n            <input type="number" name="splitSizePdf" ng-model="vm.general.splitSizePdf" value="1000">\n\n            <div ng-messages="reportForm[\'splitSizePdf\'].$error" ng-show="reportForm[\'splitSizePdf\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SPLITSIZEPDF_REQUIRED">SplitSizePdf field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.split" class="md-block">\n            <label translate="SETTINGS.SPLITSIZEXLSX">SplitSizeXlsx</label>\n            <input type="number" name="splitSizeXlsx" ng-model="vm.general.splitSizeXlsx" value="5000">\n\n            <div ng-messages="reportForm[\'splitSizeXlsx\'].$error" ng-show="reportForm[\'splitSizeXlsx\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SPLITSIZEXLSX_REQUIRED">SplitSizeXlsx field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container agentomnidesktopinterface md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.AGENTOMNIDESKTOPINTERFACE">AGENTOMNIDESKTOPINTERFACE</div>\n        </div>\n        <form name="agentOmniDesktopInterfaceForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.enableEmailPreview" aria-label="EnableEmailPreview"><span translate="SETTINGS.ENABLEEMAILPREVIEW">EnableEmailPreview</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.searchOnEnterKey" aria-label="Search_On_Enter_Key"><span translate="SETTINGS.SEARCH_ON_ENTER_KEY">Search_On_Enter_Key</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.SEARCH_ON_ENTER_KEY"></span></div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.MESSAGESALIGNMENT">messagesAlignment</label>\n            <md-select name="messagesAlignment" ng-model="vm.general.messagesAlignment">\n              <md-option ng-value="\'alternate\'">Alternate</md-option>\n              <md-option ng-value="\'left\'">Left</md-option>\n              <md-option ng-value="\'right\'">Right</md-option>\n            </md-select>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'messagesAlignment\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'messagesAlignment\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MESSAGESALIGNMENT_REQUIRED">messagesAlignment field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.CHAT_INTERACTIONS_RELOAD_TIMEOUT">Chat_Interactions_Reload_Timeout</label>\n            <input type="number" name="chatInteractionsReloadTimeout" ng-model="vm.general.chatInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'chatInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'chatInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.CHAT_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Chat_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.MAIL_INTERACTIONS_RELOAD_TIMEOUT">Mail_Interactions_Reload_Timeout</label>\n            <input type="number" name="mailInteractionsReloadTimeout" ng-model="vm.general.mailInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'mailInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'mailInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MAIL_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Mail_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.OPENCHANNEL_INTERACTIONS_RELOAD_TIMEOUT">Openchannel_Interactions_Reload_Timeout</label>\n            <input type="number" name="openchannelInteractionsReloadTimeout" ng-model="vm.general.openchannelInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'openchannelInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'openchannelInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.OPENCHANNEL_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Openchannel_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.SMS_INTERACTIONS_RELOAD_TIMEOUT">Sms_Interactions_Reload_Timeout</label>\n            <input type="number" name="smsInteractionsReloadTimeout" ng-model="vm.general.smsInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'smsInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'smsInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SMS_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Sms_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.WHATSAPP_INTERACTIONS_RELOAD_TIMEOUT">Whatsapp_Interactions_Reload_Timeout</label>\n            <input type="number" name="whatsappInteractionsReloadTimeout" ng-model="vm.general.whatsappInteractionsReloadTimeout">\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'whatsappInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'whatsappInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.WHATSAPP_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Whatsapp_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.PREVIEW_RECALLME_REMINDER_INTERVAL">Preview_Recallme_Reminder_Interval</label>\n            <input type="number" name="previewRecallmeReminderInterval" ng-model="vm.general.previewRecallmeReminderInterval" min="1">\n            <div class="hint"><span translate="SETTINGS.HELP.PREVIEW_RECALLME_REMINDER_INTERVAL"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'previewRecallmeReminderInterval\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'previewRecallmeReminderInterval\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PREVIEW_RECALLME_REMINDER_INTERVAL_REQUIRED">Preview_Recallme_Reminder_Interval field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PREVIEW_RECALLME_REMINDER_INTERVAL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Preview_Recallme_Reminder_Interval must be a valid greater or equal than</span> <span>1</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.LIMIT_TABS">limitTabs</label>\n            <input type="number" name="limitTabs" ng-model="vm.general.limitTabs" min="0" value="20">\n            <div class="hint"><span translate="SETTINGS.HELP.LIMIT_TABS"></span></div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div ng-if="vm.license.screenrecording" class="general-detail-form-container screenrecording md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.SCREENRECORDING">SCREENRECORDING</div>\n        </div>\n        <form name="screenRecordingForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.DEFAULTSCREENRECORDINGPATH">defaultScreenRecordingPath</label>\n            <input type="text" name="defaultScreenRecordingPath" ng-model="vm.general.defaultScreenRecordingPath" autofocus>\n\n            <div class="hint"><span translate="SETTINGS.HELP.DEFAULTSCREENRECORDINGPATH"></span></div>\n            <div ng-messages="screenRecordingForm[\'defaultScreenRecordingPath\'].$error" ng-show="screenRecordingForm[\'defaultScreenRecordingPath\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.DEFAULTSCREENRECORDINGPATH_REQUIRED">defaultScreenRecordingPath field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container security md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.SECURITY">SECURITY</div>\n        </div>\n        <form name="securityForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.securePassword" aria-label="Security_Suite"><span translate="SETTINGS.SECURITY_SUITE">Security_Suite</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.SECURITY_SUITE"></span></div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.callRecordingEncryption" aria-label="Call_Recording_Encryption"><span translate="SETTINGS.CALL_RECORDING_ENCRYPTION">Call_Recording_Encryption</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.ALLOWEDLOGINATTEMPTS">allowedLoginAttempts</label>\n            <input type="number" name="allowedLoginAttempts" ng-model="vm.general.allowedLoginAttempts" value="5" ng-required="true">\n\n            <div ng-messages="securityForm[\'allowedLoginAttempts\'].$error" ng-show="securityForm[\'allowedLoginAttempts\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.ALLOWEDLOGINATTEMPTS_REQUIRED">allowedLoginAttempts field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.BLOCKDURATION">blockDuration</label>\n            <input type="number" name="blockDuration" ng-model="vm.general.blockDuration" value="10" ng-required="true">\n\n            <div ng-messages="securityForm[\'blockDuration\'].$error" ng-show="securityForm[\'blockDuration\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.BLOCKDURATION_REQUIRED">blockDuration field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.enforcePasswordHistory" aria-label="Enforce_Password_History"><span translate="SETTINGS.ENFORCE_PASSWORD_HISTORY">Enforce_Password_History</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.ENFORCE_PASSWORD_HISTORY"></span></div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enforcePasswordHistory" class="md-block">\n            <label translate="SETTINGS.PASSWORD_HISTORY_LIMIT">Password_History_Limit</label>\n            <input type="number" name="passwordHistoryLimit" ng-model="vm.general.passwordHistoryLimit" min="2" max="5" value="3">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PASSWORD_HISTORY_LIMIT"></span></div>\n            <div ng-messages="securityForm[\'passwordHistoryLimit\'].$error" ng-show="securityForm[\'passwordHistoryLimit\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PASSWORD_HISTORY_LIMIT_REQUIRED">Password_History_Limit field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PASSWORD_HISTORY_LIMIT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Password_History_Limit must be a valid greater or equal than</span> <span>2</span>\n              </div>\n              <div ng-message="max">\n                <span translate="SETTINGS.ERRORS.PASSWORD_HISTORY_LIMIT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Password_History_Limit must be a valid greater or equal than</span> <span>5</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block no-margin-bottom">\n            <md-switch ng-change="vm.onPrivacyPolicyChange(\'email\')" ng-model="vm.general.enablePrivacyPolicyEmail" aria-label="Privacy_Policy_Email"><span translate="SETTINGS.PRIVACY_POLICY_EMAIL">Privacy_Policy_Email</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enablePrivacyPolicyEmail" class="md-block no-margin-top">\n\n            <input type="number" name="privacyPolicyEmail" ng-model="vm.general.privacyPolicyEmail" min="0" value="0" ng-required="true">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PRIVACY_POLICY"></span></div>\n            <div ng-messages="securityForm[\'privacyPolicyEmail\'].$error" ng-show="securityForm[\'privacyPolicyEmail\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_EMAIL_REQUIRED">Privacy_Policy_Email field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_EMAIL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Privacy_Policy_Email must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block no-margin-bottom">\n            <md-switch ng-change="vm.onPrivacyPolicyChange(\'name\')" ng-model="vm.general.enablePrivacyPolicyName" aria-label="Privacy_Policy_Name"><span translate="SETTINGS.PRIVACY_POLICY_NAME">Privacy_Policy_Name</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enablePrivacyPolicyName" class="md-block no-margin-top">\n\n            <input type="number" name="privacyPolicyName" ng-model="vm.general.privacyPolicyName" min="0" value="0" ng-required="true">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PRIVACY_POLICY"></span></div>\n            <div ng-messages="securityForm[\'privacyPolicyName\'].$error" ng-show="securityForm[\'privacyPolicyName\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NAME_REQUIRED">Privacy_Policy_Name field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NAME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Privacy_Policy_Name must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block no-margin-bottom">\n            <md-switch ng-change="vm.onPrivacyPolicyChange(\'number\')" ng-model="vm.general.enablePrivacyPolicyNumber" aria-label="Privacy_Policy_Number"><span translate="SETTINGS.PRIVACY_POLICY_NUMBER">Privacy_Policy_Number</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enablePrivacyPolicyNumber" class="md-block no-margin-top">\n\n            <input type="number" name="privacyPolicyNumber" ng-model="vm.general.privacyPolicyNumber" min="0" value="0" ng-required="true">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PRIVACY_POLICY"></span></div>\n            <div ng-messages="securityForm[\'privacyPolicyNumber\'].$error" ng-show="securityForm[\'privacyPolicyNumber\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NUMBER_REQUIRED">Privacy_Policy_Number field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Privacy_Policy_Number must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.disabledCookie" aria-label="Disabled_Cookie"><span translate="SETTINGS.DISABLED_COOKIE">Disabled_Cookie</span></md-switch>\n          </md-input-container>\n        </form>\n      </div>\n\n      <div class="general-detail-form-container imapgeneralsettings md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.IMAPGENERALSETTINGS">IMAPGENERALSETTINGS</div>\n        </div>\n        <form name="imapGeneralSettingsForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.LOGINMAILFREQUENCY">loginMailFrequency</label>\n            <input type="number" name="loginMailFrequency" ng-model="vm.general.loginMailFrequency" min="10" value="10" ng-required="true" autofocus>\n\n            <div class="hint"><span translate="SETTINGS.HELP.LOGINMAILFREQUENCY"></span></div>\n            <div ng-messages="imapGeneralSettingsForm[\'loginMailFrequency\'].$error" ng-show="imapGeneralSettingsForm[\'loginMailFrequency\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.LOGINMAILFREQUENCY_REQUIRED">loginMailFrequency field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.LOGINMAILFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">loginMailFrequency must be a valid greater or equal than</span> <span>10</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container sso md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.SSO">SSO</div>\n        </div>\n        <form name="SSOForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.googleSsoEnabled" aria-label="Google_SSO_enabled"><span translate="SETTINGS.GOOGLE_SSO_ENABLED">Google_SSO_enabled</span></md-switch>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.adSsoEnabled" aria-label="AD_SSO_enabled"><span translate="SETTINGS.AD_SSO_ENABLED">AD_SSO_enabled</span></md-switch>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div ng-if="vm.license.ai" class="general-detail-form-container aitools md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.AITOOLS">AITOOLS</div>\n        </div>\n        <form name="aiToolsForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.LANGUAGE">Language</label>\n            <md-select name="language" ng-model="vm.general.language" autofocus required>\n              <md-option ng-value="\'en-US\'">US English</md-option>\n              <md-option ng-value="\'en-AU\'">Australian English</md-option>\n              <md-option ng-value="\'en-GB\'">British English</md-option>\n              <md-option ng-value="\'en-AB\'">Scottish English</md-option>\n              <md-option ng-value="\'en-WL\'">Welsh English</md-option>\n              <md-option ng-value="\'en-IE\'">English (Ireland)</md-option>\n              <md-option ng-value="\'en-IN\'">Indian English</md-option>\n              <md-option ng-value="\'hi-IN\'">Hindi (India)</md-option>\n              <md-option ng-value="\'fr-CA\'">Canadian French</md-option>\n              <md-option ng-value="\'fr-FR\'">French</md-option>\n              <md-option ng-value="\'de-DE\'">German</md-option>\n              <md-option ng-value="\'de-CH\'">German (Switzerland)</md-option>\n              <md-option ng-value="\'it-IT\'">Italian</md-option>\n              <md-option ng-value="\'es-ES\'">Spanish</md-option>\n              <md-option ng-value="\'es-Us\'">US Spanish</md-option>\n              <md-option ng-value="\'pt-BR\'">Brazilian Portuguese</md-option>\n              <md-option ng-value="\'pt-PT\'">Portuguese(Portugal)</md-option>\n              <md-option ng-value="\'ar-SA\'">Modern Standard Arabic</md-option>\n              <md-option ng-value="\'ar-AE\'">Arabic</md-option>\n              <md-option ng-value="\'zh-CN\'">Chinese Mandarin - Mainland</md-option>\n              <md-option ng-value="\'ja-JP\'">Japanese (Japan)</md-option>\n              <md-option ng-value="\'ko-KR\'">Korean (Korea)</md-option>\n              <md-option ng-value="\'he-IL\'">Hebrew (Israel) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'ms-MY\'">Malay (Malaysia) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'fa-IR\'">Farsi (Iran) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'ru-RU\'">Russian (Russia) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'te-IN\'">Telugu(India) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'ta-IN\'">Tamil - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'nl-NL\'">Dutch - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'tr-TR\'">Turkish (Turkey) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'id-ID\'">Indonesian(Indonesia) - This language is not available for the Sentiment Analysis</md-option>\n            </md-select>\n            <div ng-messages="aiToolsForm[\'language\'].$error" ng-show="aiToolsForm[\'language\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.LANGUAGE_REQUIRED">Language field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.BUCKET">Bucket</label>\n            <input type="text" name="bucket" ng-model="vm.general.bucket" ng-required="true">\n\n            <div ng-messages="aiToolsForm[\'bucket\'].$error" ng-show="aiToolsForm[\'bucket\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.BUCKET_REQUIRED">Bucket field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.transcribe" aria-label="Transcribe"><span translate="SETTINGS.TRANSCRIBE">Transcribe</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.transcribe == true" class="md-block">\n            <label translate="SETTINGS.TRANSCRIBEREGION">TranscribeRegion</label>\n            <md-select name="transcribeRegion" ng-model="vm.general.transcribeRegion" required>\n              <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n              <md-option ng-value="\'us-east-2\'">US East (Ohio)</md-option>\n              <md-option ng-value="\'us-east-2\'">US West (N. California)</md-option>\n              <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n              <md-option ng-value="\'ap-south-1\'">Asia Pacific (Mumbai)</md-option>\n              <md-option ng-value="\'ap-east-1\'">Asia Pacific (Hong Kong)</md-option>\n              <md-option ng-value="\'ap-northeast-2\'">Asia Pacific (Seoul)</md-option>\n              <md-option ng-value="\'ap-southeast-1\'">Asia Pacific (Singapore)</md-option>\n              <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n              <md-option ng-value="\'ap-northeast-1\'">Asia Pacific (Tokyo)</md-option>\n              <md-option ng-value="\'ca-central-1\'">Canada (Central)</md-option>\n              <md-option ng-value="\'eu-central-1\'">Europe (Frankfurt)</md-option>\n              <md-option ng-value="\'eu-west-1\'">Europe (Ireland)</md-option>\n              <md-option ng-value="\'eu-west-2\'">Europe (London)</md-option>\n              <md-option ng-value="\'eu-west-3\'">Europe (Paris)</md-option>\n              <md-option ng-value="\'me-south-1\'">Middle East (Bahrain)</md-option>\n              <md-option ng-value="\'sa-east-1\'">South America (São Paulo)</md-option>\n            </md-select>\n            <div ng-messages="aiToolsForm[\'transcribeRegion\'].$error" ng-show="aiToolsForm[\'transcribeRegion\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.TRANSCRIBEREGION_REQUIRED">TranscribeRegion field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.transcribe == true" class="md-block">\n            <label translate="SETTINGS.TRANSCRIBEACCOUNT">TranscribeAccount</label>\n            <md-select name="transcribeAccountId" ng-model="vm.general.transcribeAccountId" required>\n              <md-option ng-value="transcribeAccountId.id" ng-repeat="transcribeAccountId in vm.cloudProviders" ng-disabled="transcribeAccountId.canSelect === false">{{ transcribeAccountId.name }}</md-option>\n            </md-select>\n            <div ng-messages="aiToolsForm[\'transcribeAccountId\'].$error" ng-show="aiToolsForm[\'transcribeAccountId\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.TRANSCRIBEACCOUNT_REQUIRED">TranscribeAccount field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n'+"          <md-input-container ng-if=\"vm.general.transcribe == true && vm.general.language != 'he-IL' && vm.general.language != 'ms-MY' && vm.general.language != 'fa-IR' && vm.general.language != 'ru-RU' && vm.general.language != 'te-IN' && vm.general.language != 'ta-IN' && vm.general.language != 'nl-NL' && vm.general.language != 'tr-TR' && vm.general.language != 'id-ID'\" class=\"md-block\">\n            <md-switch ng-model=\"vm.general.sentiment\" aria-label=\"SentimentAnalysis\"><span translate=\"SETTINGS.SENTIMENTANALYSIS\">SentimentAnalysis</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if=\"vm.general.sentiment == true && vm.general.transcribe == true && vm.general.language != 'he-IL' && vm.general.language != 'ms-MY' && vm.general.language != 'fa-IR' && vm.general.language != 'ru-RU' && vm.general.language != 'te-IN' && vm.general.language != 'ta-IN' && vm.general.language != 'nl-NL' && vm.general.language != 'tr-TR' && vm.general.language != 'id-ID'\" class=\"md-block\">\n            <label translate=\"SETTINGS.SENTIMENTREGION\">SentimentRegion</label>\n            <md-select name=\"sentimentRegion\" ng-model=\"vm.general.sentimentRegion\" required>\n              <md-option ng-value=\"'us-east-1'\">US East (N. Virginia)</md-option>\n              <md-option ng-value=\"'us-east-2'\">US East (Ohio)</md-option>\n              <md-option ng-value=\"'us-west-2'\">US West (Oregon)</md-option>\n              <md-option ng-value=\"'ap-south-1'\">Asia Pacific (Mumbai)</md-option>\n              <md-option ng-value=\"'ap-northeast-2'\">Asia Pacific (Seoul)</md-option>\n              <md-option ng-value=\"'ap-southeast-1'\">Asia Pacific (Singapore)</md-option>\n              <md-option ng-value=\"'ap-southeast-2'\">Asia Pacific (Sydney)</md-option>\n              <md-option ng-value=\"'ap-northeast-1'\">Asia Pacific (Tokyo)</md-option>\n              <md-option ng-value=\"'ca-central-1'\">Canada (Central)</md-option>\n              <md-option ng-value=\"'eu-central-1'\">Europe (Frankfurt)</md-option>\n              <md-option ng-value=\"'eu-west-1'\">Europe (Ireland)</md-option>\n              <md-option ng-value=\"'eu-west-2'\">Europe (London)</md-option>\n            </md-select>\n            <div ng-messages=\"aiToolsForm['sentimentRegion'].$error\" ng-show=\"aiToolsForm['sentimentRegion'].$touched\" role=\"alert\">\n              <div ng-message=\"required\">\n                <span translate=\"SETTINGS.ERRORS.SENTIMENTREGION_REQUIRED\">SentimentRegion field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if=\"vm.general.sentiment == true && vm.general.transcribe == true && vm.general.language != 'he-IL' && vm.general.language != 'ms-MY' && vm.general.language != 'fa-IR' && vm.general.language != 'ru-RU' && vm.general.language != 'te-IN' && vm.general.language != 'ta-IN' && vm.general.language != 'nl-NL' && vm.general.language != 'tr-TR' && vm.general.language != 'id-ID'\" class=\"md-block\">\n            <label translate=\"SETTINGS.SENTIMENTACCOUNT\">SentimentAccount</label>\n            <md-select name=\"sentimentAccountId\" ng-model=\"vm.general.sentimentAccountId\" required>\n              <md-option ng-value=\"sentimentAccountId.id\" ng-repeat=\"sentimentAccountId in vm.cloudProviders\" ng-disabled=\"sentimentAccountId.canSelect === false\">{{ sentimentAccountId.name }}</md-option>\n            </md-select>\n            <div ng-messages=\"aiToolsForm['sentimentAccountId'].$error\" ng-show=\"aiToolsForm['sentimentAccountId'].$touched\" role=\"alert\">\n              <div ng-message=\"required\">\n                <span translate=\"SETTINGS.ERRORS.SENTIMENTACCOUNT_REQUIRED\">SentimentAccount field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>"),e.put("app/main/apps/settings/views/license/license.html",'<div id="license" class="page-layout simple fullwidth doc-page">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.LICENSE">LICENSE</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    \x3c!-- <div>\n                <md-button type="submit" ng-click="vm.requestLicense()" class="send-button md-raised" translate="SETTINGS.REQUEST_LICENSE" translate-attr-aria-label="SETTINGS.REQUEST_LICENSE">\n                    REQUEST LICENSE\n                </md-button>\n            </div> --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      \x3c!-- LICENSE CARD --\x3e\n      <div layout="row" flex>\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="row" layout-align="center">\n            <div flex layout="row" layout-align="start center">\n              <div ng-if="!vm.license.custom">\n                <a href="https://www.xcally.com/plans.html" target="_blank" class="md-button md-fab green-A700-bg" aria-label="Eat cake">\n                  <md-tooltip><span translate="SETTINGS.PRICES">Prices</span></md-tooltip>\n                  <md-icon md-font-icon="icon-coin"></md-icon>\n                </a>\n              </div>\n            </div>\n            <div flex>\n              <div ng-switch="vm.license.months" class="text-center">\n                <span ng-switch-when="1" class="md-title md-accent-fg text-bold">{{ \'SETTINGS.PLAN\' | translate }}: <span translate="SETTINGS.MONTH_TO_MONTH">MONTH TO MONTH</span></span>\n                <span ng-switch-when="12" class="md-title md-accent-fg text-bold">{{ \'SETTINGS.PLAN\' | translate }}: <span translate="SETTINGS.ANNUALLY">ANNUALLY</span></span>\n                <span ng-switch-when="36" class="md-title md-accent-fg text-bold">{{ \'SETTINGS.PLAN\' | translate }}: <span translate="SETTINGS.PERPETUAL">PERPETUAL</span></span>\n              </div>\n            </div>\n            <div flex layout="row" layout-align="end center">\n              <div>\n                <md-button type="submit" ng-click="vm.updateLicense()" class="md-button md-fab md-accent">\n                  <md-tooltip><span translate="SETTINGS.UPDATE_LICENSE">License</span></md-tooltip>\n                  <md-icon md-font-icon="icon-pencil"></md-icon>\n                </md-button>\n                <md-button type="submit" ng-if="vm.isAdmin" ng-click="vm.downloadLogFile()" class="md-button md-fab md-accent">\n                  <md-tooltip><span translate="SETTINGS.DOWNLOAD_LICENSE_LOG_FILE">Download license log file</span></md-tooltip>\n                  <md-icon md-font-icon="icon-download"></md-icon>\n                </md-button>\n              </div>\n            </div>\n          </div>\n\n          <span ng-if="!vm.license.demo && !vm.license.gray && vm.license.months != 36" class="md-subhead md-warn-fg text-center">{{ \'SETTINGS.EXPIRATION_DATE\' | translate }}: {{vm.license.expiration | date: \'longDate\'}}</span>\n          <span class="text-center padding-bottom-10"> {{ vm.license.machineUuid !== vm.license.uuid ? \'SETTINGS.OLD_TOKEN\' : \'SETTINGS.TOKEN\' | translate }}: <span ngclipboard data-clipboard-target="#licenseUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});" id="licenseUuid" class="hover-token text-italic text-bold">{{vm.license.uuid}}</span>\n            \x3c!--<md-button class="md-button md-fab md-accent" ngclipboard data-clipboard-target="#licenseUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n            <md-tooltip><span translate="SETTINGS.COPY_LICENSE">Copy</span></md-tooltip>\n            <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n          </md-button>--\x3e\n          </span>\n\n          <div layout="column">\n            <span ng-if="vm.license.grayReason == \'changed\'" class="blink md-subhead md-warn-fg text-center">{{ \'SETTINGS.NEW_TOKEN_DETECTED\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10"> {{\'SETTINGS.NEW_TOKEN\' | translate }}: <span id="licenseMachineUuid" ngclipboard data-clipboard-target="#licenseMachineUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});" class="hover-token text-italic text-bold">{{vm.license.machineUuid}}</span>\n              \x3c!--<md-button class="md-button md-fab md-accent" ngclipboard data-clipboard-target="#licenseMachineUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                <md-tooltip><span translate="SETTINGS.COPY_LICENSE">Copy</span></md-tooltip>                \n                <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n              </md-button>--\x3e\n            </span>\n            <span ng-if="vm.license.gray" class="blink md-subhead md-warn-fg text-center">{{ \'SETTINGS.EXPIRATION_GRAY_PERIOD\' | translate }}: {{vm.license.deadline | date: \'longDate\'}}</span>\n            <span ng-if="vm.license.gray" class="text-center padding-bottom-10 text-italic text-bold"> {{\'SETTINGS.EXPIRATION_REASON\' | translate }} </span>\n            <span ng-if="vm.license.grayReason == \'disabled\'" class="text-center padding-bottom-10"> {{\'SETTINGS.EXPIRATION_REASON_MESSAGE_DISABLED\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10"> {{\'SETTINGS.EXPIRATION_REASON_MESSAGE_CHANGED\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10"> {{\'SETTINGS.EXPIRATION_CHANGED_ADVISE\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10">{{ \'SETTINGS.SEND_EMAIL_TO\' | translate }}: <a href="mailto:license@xcally.com?subject=New%20token%20detected&body=Hi xCALLY, New Token: {{vm.license.machineUuid}}, Old token: {{vm.license.uuid}}">license@xcally.com</a>.</span>\n            <span ng-if="vm.license.grayReason == \'disabled\'" class="text-center padding-bottom-10">{{ \'SETTINGS.SEND_EMAIL_TO\' | translate }}: <a href="mailto:license@xcally.com?subject=License%20disabled&body=Hi xCALLY, My Token: {{vm.license.machineUuid}}">license@xcally.com</a>.</span>\n          </div>\n\n          <div ng-if="vm.license.demo" layout="column">\n            <span class="md-subhead md-warn-fg text-center">{{ \'SETTINGS.TRIAL_VERSION\' | translate }}</span>\n            <span class="md-subhead md-warn-fg text-center"><a href="https://www.xcally.com/en/index.html#pricing-table2-h" target="_blank">{{ \'SETTINGS.PRICES\' | translate}}</a></span>\n          </div>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.STAFF\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" flex="33">\n              <md-icon md-font-icon="icon-account" class="md-avatar-icon"></md-icon>\n              <div class="md-list-item-text">\n                <h3>{{ vm.license.users || 0 }} <span ng-class="{\'red-fg\': vm.license.users <= vm.users && vm.license.users > 0}">({{vm.license.users >= vm.users ? vm.users : vm.license.users}})</span></h3>\n                <p translate="SETTINGS.USERS">Users</p>\n              </div>\n            </md-list-item>\n            <md-list-item class="md-2-line" flex="33">\n              <md-icon md-font-icon="icon-headphones" class="md-avatar-icon"></md-icon>\n              <div class="md-list-item-text">\n                <h3>{{ vm.license.agents || 0 }} <span ng-class="{\'red-fg\': (vm.license.agents <= vm.agents && vm.license.agents > 0) }">({{vm.license.agents >= vm.agents ? vm.agents : vm.license.agents}})</span></h3>\n                <p translate="SETTINGS.AGENTS">Agents</p>\n              </div>\n            </md-list-item>\n            <md-list-item class="md-2-line" flex="33">\n              <md-icon md-font-icon="icon-phone" class="md-avatar-icon"></md-icon>\n              <div class="md-list-item-text">\n                <h3>{{ vm.license.telephones || 0 }} <span ng-class="{\'red-fg\': vm.license.telephones <= vm.telephones && vm.license.telephones > 0}">({{vm.license.telephones >= vm.telephones ? vm.telephones : vm.license.telephones}})</span></h3>\n                <p translate="SETTINGS.TELEPHONES">Telephones</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.CHANNELS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item flex="33" class="md-2-line" ng-repeat="channel in vm.channels | limitTo:3">\n              <md-icon md-font-icon="{{channel.icon}}" class="md-avatar-icon" ng-class="vm.license[channel.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{channel.name | uppercase}}"></h3>\n                <p ng-class="vm.license[channel.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[channel.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item flex="33" class="md-2-line" ng-repeat="channel in vm.channels | limitTo:3:3">\n              <md-icon md-font-icon="{{channel.icon}}" class="md-avatar-icon" ng-class="vm.license[channel.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{channel.name | uppercase}}"></h3>\n                <p ng-class="vm.license[channel.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[channel.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item flex="33" class="md-2-line" ng-repeat="channel in vm.channels | limitTo:3:6">\n              <md-icon md-font-icon="{{channel.icon}}" class="md-avatar-icon" ng-class="vm.license[channel.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{channel.name | uppercase}}"></h3>\n                <p ng-class="vm.license[channel.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[channel.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.MODULES\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="module in vm.modules" flex="33">\n              <md-icon md-font-icon="{{module.icon}}" class="md-avatar-icon" ng-class="vm.license[module.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{module.name | uppercase}}"></h3>\n                <p ng-class="vm.license[module.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[module.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.SESSIONS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <div ng-repeat="session in vm.sessions" flex="33">\n              <md-list-item class="md-2-line">\n                <md-icon md-font-icon="{{session.icon}}" class="md-avatar-icon" ng-class="vm.license[session.enabled] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n                <div class="md-list-item-text">\n                  <div layout="row" layout="start center">\n                    <h3 translate="SETTINGS.{{session.name | uppercase}}"></h3>\n                    <button ng-if="session.restart" ng-click="vm.gotoProcess($event)" class="md-mini" aria-label="restart">\n                      <md-tooltip>Restart</md-tooltip>\n                      <md-icon md-font-icon="icon-reload"></md-icon>\n                    </button>\n                  </div>\n                  <p ng-if="vm.license[session.name] && vm.license[session.enabled]" class="green-A700-fg">{{vm.license[session.name]}} {{ \'SETTINGS.\' + session.label | uppercase | translate }}</p>\n                  <p ng-if="!vm.license[session.name] && vm.license[session.enabled]" class="green-A700-fg">UNLIMITED {{ \'SETTINGS.\' + session.label | uppercase | translate }}</p>\n                  <p ng-if="!vm.license[session.enabled]" class="red-A700-fg">{{ \'SETTINGS.DISABLED\' | translate }}</p>\n                </div>\n              </md-list-item>\n\n            </div>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.ADDONS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="addon in vm.addons | limitTo:3" flex="33">\n              <md-icon md-font-icon="{{addon.icon}}" class="md-avatar-icon" ng-class="vm.license[addon.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{addon.name | uppercase}}"></h3>\n                <p ng-class="vm.license[addon.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[addon.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="addon in vm.addons | limitTo:3:3" flex="33">\n              <md-icon md-font-icon="{{addon.icon}}" class="md-avatar-icon" ng-class="vm.license[addon.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{addon.name | uppercase}}"></h3>\n                <p ng-class="vm.license[addon.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[addon.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.OTHERS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="other in vm.others | limitTo:3" flex="33">\n              <md-icon md-font-icon="{{other.icon}}" class="md-avatar-icon" ng-class="vm.license[other.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{other.name | uppercase}}"></h3>\n                <p ng-class="vm.license[other.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[other.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="other in vm.others | limitTo:3:3" flex="33">\n              <md-icon md-font-icon="{{other.icon}}" class="md-avatar-icon" ng-class="vm.license[other.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{other.name | uppercase}}"></h3>\n'+"                <p ng-class=\"vm.license[other.name] ? 'green-A700-fg' : 'red-A700-fg'\">{{ 'SETTINGS.' + (vm.license[other.name] ? 'ENABLED' : 'DISABLED') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n        </md-card>\n      </div>\n      \x3c!-- / LICENSE CARD --\x3e\n\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>"),e.put("app/main/apps/settings/views/license/request/dialog.html",'<md-dialog class="request-dialog" aria-label="Send Request">\n  <form name="requestForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="SETTINGS.REQUEST_LICENSE">Request License</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.license.name" required>\n        <div ng-messages="requestForm.name.$error" ng-show="requestForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.NAME_REQUIRED">Address field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.license.email" required>\n        <div ng-messages="requestForm.email.$error" ng-show="requestForm.email.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="SETTINGS.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.PLAN">Plan</label>\n        <md-select name="plan" ng-model="vm.license.months" required>\n          <md-option ng-value="1"><span translate="SETTINGS.MONTH_TO_MONTH">MONTH TO MONTH</span></md-option>\n          <md-option ng-value="12"><span translate="SETTINGS.ANNUALLY">ANNUALLY</span></md-option>\n          <md-option ng-value="36"><span translate="SETTINGS.PERPETUAL">PERPETUAL</span></md-option>\n        </md-select>\n        <div ng-messages="requestForm.plan.$error" ng-show="requestForm.plan.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.PLAN_REQUIRED">Plan field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.STAFF\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-input-container class="md-block" flex>\n          <label translate="SETTINGS.USERS">Users</label>\n          <input type="number" name="users" ng-model="vm.license.users" required>\n          <div ng-messages="requestForm.users.$error" ng-show="requestForm.users.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.USERS_REQUIRED">Users field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" flex>\n          <label translate="SETTINGS.AGENTS">Agents</label>\n          <input type="number" name="agents" ng-model="vm.license.agents" required>\n          <div ng-messages="requestForm.agents.$error" ng-show="requestForm.agents.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.AGENTS_REQUIRED">Agents field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" flex>\n          <label translate="SETTINGS.TELEPHONES">Telephones</label>\n          <input type="number" name="telephones" ng-model="vm.license.telephones" required>\n          <div ng-messages="requestForm.telephones.$error" ng-show="requestForm.telephones.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.TELEPHONES_REQUIRED">Telephones field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.CHANNELS\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[channel.name]" aria-label="{{channel.name}}" ng-repeat="channel in vm.channels | limitTo:3"><span translate="SETTINGS.{{channel.name | uppercase}}"></span></md-switch>\n        <md-switch ng-model="vm.license[channel.name]" aria-label="{{channel.name}}" ng-repeat="channel in vm.channels | limitTo:3:3"><span translate="SETTINGS.{{channel.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.MODULES\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[module.name]" aria-label="{{module.name}}" ng-repeat="module in vm.modules"><span translate="SETTINGS.{{module.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.SESSIONS\' | translate }}</md-subheader>\n      <div layout="row">\n        <md-input-container ng-repeat="session in vm.sessions" class="md-block" flex="50">\n          <label>{{ \'SETTINGS.\' + session.name | uppercase | translate }} ({{ \'SETTINGS.\' + session.label | uppercase | translate }})</label>\n          <input type="number" name="{{session.name}}" ng-model="vm.license[session.name]" required>\n          <div class="hint"><span>0={{ \'SETTINGS.UNLIMITED_CHANNELS\' | translate }}</span></div>\n          <div ng-messages="requestForm[session.name].$error" ng-show="requestForm[session.name].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.CHANNEL_REQUIRED">Mandatory field</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.ADDONS\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[addon.name]" aria-label="{{module.name}}" ng-repeat="addon in vm.addons"><span translate="SETTINGS.{{addon.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.OTHERS\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[other.name]" aria-label="{{other.name}}" ng-repeat="other in vm.others"><span translate="SETTINGS.{{other.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.DESCRIPTION">Description</label>\n        <textarea name="description" ng-model="vm.license.description"></textarea>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.sendRequest()" class="send-button md-accent md-raised" ng-disabled="requestForm.$invalid || requestForm.$pristine" aria-label="SEND" translate="SETTINGS.SEND" translate-attr-aria-label="SETTINGS.SEND">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/license/update/dialog.html",'<md-dialog class="update-dialog" aria-label="Update License">\n  <form name="updateForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="SETTINGS.UPDATE_LICENSE">Update License</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-content layout="row">\n        <span class="md-title" translate="SETTINGS.UPDATE_LICENSE_MANUALLY">Do you want to update your license manually?</span>\n      </md-content>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.ENTER_LICENSE">Enter your license</label>\n        <textarea name="key" ng-model="vm.licenseKey" required></textarea>\n        <div ng-messages="updateForm.name.$error" ng-show="updateForm.key.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.LICENSE_REQUIRED">License key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.updateLicense()" class="send-button md-accent md-raised" ng-disabled="updateForm.$invalid || updateForm.$pristine" aria-label="UPDATE" translate="SETTINGS.UPDATE" translate-attr-aria-label="SETTINGS.UPDATE">\n          UPDATE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/networks/create/dialog.html",'<md-dialog class="network-dialog" aria-label="New Network">\n  <form name="networkForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.network.type" autofocus required>\n          <md-option ng-value="\'localnet\'">LocalNET</md-option>\n          <md-option ng-value="\'externip\'">ExternIP</md-option>\n          <md-option ng-value="\'turn\'">Turn</md-option>\n          <md-option ng-value="\'stun\'">Stun</md-option>\n        </md-select>\n        <div ng-messages="networkForm[\'type\'].$error" ng-show="networkForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'localnet\'" class="md-block">\n        <label translate="SETTINGS.LOCALNETADDRESS">localNetAddress</label>\n        <input type="text" name="value" ng-model="vm.network.value" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/" ng-required="true">\n\n        <div class="hint"><span translate="SETTINGS.HELP.LOCALNETADDRESS"></span></div>\n        <div ng-messages="networkForm[\'value\'].$error" ng-show="networkForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.LOCALNETADDRESS_REQUIRED">localNetAddress field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SETTINGS.ERRORS.LOCALNETADDRESS_MUST_VALID_PATTERN" translate-values="{ regex: \'/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/\' }">localNetAddress must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'externip\'" class="md-block">\n        <label translate="SETTINGS.ADDRESS">Address</label>\n        <input type="text" name="value" ng-model="vm.network.value" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/" ng-required="true">\n\n        <div class="hint"><span translate="SETTINGS.HELP.ADDRESS"></span></div>\n        <div ng-messages="networkForm[\'value\'].$error" ng-show="networkForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.ADDRESS_REQUIRED">Address field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SETTINGS.ERRORS.ADDRESS_MUST_VALID_PATTERN" translate-values="{ regex: \'/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/\' }">Address must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'turn\' || vm.network.type == \'stun\'" class="md-block">\n        <label translate="SETTINGS.ADDRESS">Address</label>\n        <input type="text" name="value" ng-model="vm.network.value" ng-required="true">\n\n        <div ng-messages="networkForm[\'value\'].$error" ng-show="networkForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.ADDRESS_REQUIRED">Address field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'turn\'" class="md-block">\n        <label translate="SETTINGS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.network.username" ng-required="vm.network.type == \'turn\'">\n\n        <div class="hint"><span translate="SETTINGS.HELP.USERNAME"></span></div>\n        <div ng-messages="networkForm[\'username\'].$error" ng-show="networkForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'turn\'" class="md-block">\n        <label translate="SETTINGS.PASSWORD">Password</label>\n        <input type="text" name="password" ng-model="vm.network.password" ng-required="vm.network.type == \'turn\'">\n\n        <div class="hint"><span translate="SETTINGS.HELP.PASSWORD"></span></div>\n        <div ng-messages="networkForm[\'password\'].$error" ng-show="networkForm[\'password\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newNetwork" ng-click="vm.saveNetwork()" class="send-button md-accent md-raised" ng-disabled="networkForm.$invalid || networkForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newNetwork" ng-click="vm.addNewNetwork()" class="send-button md-accent md-raised" ng-disabled="networkForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_NETWORK" translate-attr-aria-label="SETTINGS.ADD_NETWORK">\n          ADD NETWORK\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-click="vm.deleteNetwork($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/networks/networks.html",'<div id="networks" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.NETWORKS">Networks</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SETTINGS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedNetworks.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedNetworks =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SETTINGS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-networks-count">\n          <span>{{vm.selectedNetworks.length}}</span>\n          <span translate="SETTINGS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SETTINGS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllNetworks()" translate="SETTINGS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectNetworks()" translate="SETTINGS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedNetworks" csv-label="true" filename="networks.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-click="vm.deleteSelectedNetworks($event)" aria-label="delete selected" translate translate-attr-label="SETTINGS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- NETWORK TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedNetworks" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getNetworks">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SETTINGS.ID\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'SETTINGS.TYPE\' | translate }}</th>\n                <th md-column md-order-by="value">{{ \'SETTINGS.ADDRESS\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'SETTINGS.CREATED_AT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.networks.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SETTINGS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="network" md-select-id="id" ng-repeat="network in vm.networks.rows">\n                <td md-cell ng-if="network.userpic"><img class="avatar" alt="{{network.name}}" ng-src="api/users/{{network.id}}/avatar" /></td>\n                <td md-cell ng-if="!network.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{network.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="id ">{{network.id}}</td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="type ">{{ vm.arraytype[network.type].option }}</td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="value ">{{network.value}}</td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="createdAt ">{{network.createdAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SETTINGS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.editdialog(network, $event    )" translate="SETTINGS.EDIT_NETWORK">\n                          Edit Network\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.deleteconfirm(network, $event    )" translate="SETTINGS.DELETE_NETWORK">\n                          Delete Network\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SETTINGS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SETTINGS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SETTINGS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.networks.count}}" md-on-paginate="vm.getNetworks" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / NETWORK TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD NETWORK BUTTON --\x3e\n  <md-button class="md-fab md-accent" id="add-network-button" ng-click="vm.createOrEditNetwork($event)" aria-label="add network" translate translate-attr-aria-label="SETTINGS.ADD_NETWORK">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD NETWORK BUTTON --\x3e\n</div>'),e.put("app/main/apps/settings/views/smtps/smtps.html",'<div id="smtps" class="page-layout simple left-sidenav inner-sidenav">\n\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.SMTP">Smtp</span>\n      </div>\n    </div>\n\n    <div>\n      <md-button type="submit" ng-click="vm.verifySmtp()" ng-disabled="!vm.mailAccount.id" class="send-button md-accent md-raised" translate="SETTINGS.VERIFY" translate-attr-aria-label="SETTINGS.VERIFY">\n        VERIFY\n      </md-button>\n      <md-button type="submit" ng-click="vm.saveSmtp()" ng-disabled="(generalForm.$pristine) || (generalForm.$invalid)" class="send-button md-accent md-raised" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    <div class="main scrollable">\n      <div class="smtp-detail-form-container general md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.GENERAL">GENERAL</div>\n        </div>\n        <form name="generalForm" novalidate>\n\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.ACCOUNTNAME">Name</label>\n            <input type="text" name="name" ng-model="vm.mailAccount.name" ng-required="true" autofocus>\n            <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Name field required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.DESCRIPTION">Description</label>\n            <input type="" name="description" ng-model="vm.mailAccount.description">\n          </md-input-container>\n\n          <md-input-container class="md-block mt-0">\n            <label translate="SETTINGS.EMAILADDRESS">Email Address</label>\n            <input type="email" name="email" ng-model="vm.mailAccount.email" ng-required="true">\n            <div class="hint"><span translate="SETTINGS.HELP.EMAILADDRESS"></span></div>\n            <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Email Address field required</span>\n              </div>\n              <div ng-message="email">\n                <span translate="SETTINGS.ERRORS.WRONG_FORMAT">Email Address must be a valid e-mail address</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <md-input-container class="md-block mt-30">\n            <label translate="SETTINGS.SMTP_SERVICE">Service</label>\n            <md-select name="provider" ng-model="vm.mailAccount.provider" ng-change="vm.onProviderChange()" required>\n              <md-option ng-value="provider.value" ng-repeat="provider in vm.providers">{{ provider.name }}</md-option>\n            </md-select>\n            <div ng-messages="generalForm[\'provider\'].$error" ng-show="generalForm[\'provider\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Service field required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <div ng-if="vm.mailAccount.provider === \'custom\'">\n            <md-input-container class="md-block mt-30">\n              <label translate="SETTINGS.SMTP_HOST">Host</label>\n              <input type="text" name="host" ng-model="vm.mailAccount.Smtp.host" ng-required="true">\n              <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Host field required</span>\n                </div>\n              </div>\n            </md-input-container>\n            <md-input-container class="md-block">\n              <label translate="SETTINGS.SMTP_PORT">Port</label>\n              <input type="number" name="port" ng-model="vm.mailAccount.Smtp.port" value="465" ng-required="true">\n              <div ng-messages="generalForm[\'port\'].$error" ng-show="generalForm[\'port\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Port field required</span>\n                </div>\n              </div>\n            </md-input-container>\n            <md-input-container class="md-block">\n              <md-switch ng-model="vm.mailAccount.Smtp.secure" aria-label="SMTP Secure"><span translate="SETTINGS.SMTP_SECURE">Secure</span></md-switch>\n              <div class="hint"><span translate="SETTINGS.HELP.SMTP_SECURE"></span></div>\n            </md-input-container>\n            <md-input-container class="md-block">\n              <md-switch ng-model="vm.mailAccount.Smtp.authentication" aria-label="SMTP Authentication"><span translate="SETTINGS.SMTP_AUTHENTICATION">Authentication</span></md-switch>\n            </md-input-container>\n          </div>\n\n          <div ng-if="vm.mailAccount.Smtp.authentication || (vm.mailAccount.provider && vm.mailAccount.provider !== \'custom\')">\n            <md-input-container ng-if="vm.mailAccount.provider === \'outlook365\'" class="md-block">\n              <md-switch ng-model="vm.mailAccount.Smtp.modernAuthentication" aria-label="Modern Authentication" class="no-margin-bottom"><span translate="MAIL.MODERN_AUTHENTICATION">Modern Authentication</span></md-switch>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="SETTINGS.SMTP_USERNAME">Username</label>\n              <input type="text" name="username" ng-model="vm.mailAccount.Smtp.user" ng-required="true">\n              <div class="hint"><span translate="SETTINGS.HELP.SMTP_USERNAME"></span></div>\n              <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Username field required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container ng-if="vm.mailAccount.Smtp.modernAuthentication" class="md-block">\n              <label translate="MAIL.CLOUD_PROVIDER">Cloud Provider</label>\n              <md-select name="cloudProvider" ng-model="vm.mailAccount.Smtp.CloudProviderId" required>\n                <md-option ng-value="cloudProvider.id" ng-repeat="cloudProvider in vm.cloudProviders.rows">{{ cloudProvider.name }}</md-option>\n              </md-select>\n              <div class="hint"><span translate="MAIL.HELP.CLOUD_PROVIDER"></span></div>\n              <div ng-messages="generalForm[\'cloudProvider\'].$error" ng-show="generalForm[\'cloudProvider\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container ng-if="!vm.mailAccount.Smtp.modernAuthentication" class="md-block">\n              <label translate="SETTINGS.SMTP_PASSWORD">Password</label>\n              <input type="password" name="password" ng-model="vm.mailAccount.Smtp.pass" placeholder="Password" translate translate-attr-placeholder="SETTINGS.PASSWORD" required>\n              <div class="hint"><span translate="SETTINGS.HELP.SMTP_PASSWORD"></span></div>\n              <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Password field required</span>\n                </div>\n              </div>\n            </md-input-container>\n          </div>\n        </form>\n      </div>\n    </div>\n\n  </div>\n</div>'),e.put("app/main/apps/settings/views/system/system.html",'<div id="system" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.SYSTEM">SYSTEM</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" md-border-bottom flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SETTINGS.GENERAL">GENERAL</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="system-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n            <md-card class="md-whiteframe-1dp padding-20" layout="row" layout-xs="column" layout-wrap>\n              <ms-widget flex="50" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg">\n                    <div class="h3">OS</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{vm.system.system.manufacturer}} {{vm.system.system.model}}</div>\n                        <div class="h4">{{vm.system.cpu.manufacturer}} {{vm.system.cpu.brand}} - {{vm.system.cpu.speed}} GHz - {{vm.system.cpu.cores}} Cores</div>\n                        <div class="h4">{{vm.system.os.distro}} - {{vm.system.os.release}} - Kernel: {{vm.system.os.kernel}}</div>\n                        <div class="h4">Node.js: {{vm.system.node}}</div>\n                        <div class="h4">Host: {{vm.system.os.hostname}} - Uptime: {{vm.system.time.uptime / 60 | number:0}} m</div>\n                        <div class="h4">TimeZone: {{vm.system.time.timezone}} ({{vm.system.time.timezoneName}})</div>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n              <ms-widget flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-1">\n                    <div class="h3">CPU</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="pb-8" layout="row" layout-align="space-between start">\n                          <span class="h3" translate="SETTINGS.AVG_LOAD">AVG Load</span>\n                          <span class="h3 secondary-text font-weight-500">{{vm.system.currentLoad.avgload * 100 | number:0}}%</span>\n                        </div>\n                        <md-progress-linear class="red" md-mode="determinate" value="{{vm.system.currentLoad.avgload * 100 | number:0}}"></md-progress-linear>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n              <ms-widget flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-3">\n                    <div class="h3">MEM</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{\'SETTINGS.TOTAL\' | translate}}: {{vm.system.mem.total / 1024 / 1024 / 1024 | number:0}} GB</div>\n                        <div class="h4">{{\'SETTINGS.FREE\' | translate}}: {{vm.system.mem.available / 1024 / 1024 / 1024 | number:0}} GB</div>\n                        <div class="h4">{{\'SETTINGS.USED\' | translate}}: {{vm.system.mem.active / 1024 / 1024 / 1024 | number:0}} GB</div>\n                      </div>\n                      <div class="p-16 pb-32">\n                        <div class="pb-8" layout="row" layout-align="space-between start">\n                          <span class="h3" translate="SETTINGS.USED">Used</span>\n                          <span class="h3 secondary-text font-weight-500">{{(vm.system.mem.active / vm.system.mem.total) * 100 | number : 0}}%</span>\n                        </div>\n                        <md-progress-linear class="md-warn" md-mode="determinate" value="{{(vm.system.mem.active / vm.system.mem.total) * 100 | number : 0 }}"></md-progress-linear>\n\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n            </md-card>\n\n            <md-card class="md-whiteframe-1dp padding-20" layout="row" layout-xs="column" layout-wrap>\n              <ms-widget ng-repeat="disk in vm.system.fsSize" flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-3">\n                    <div class="h3">DISK {{$index + 1}}</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{\'SETTINGS.FILE_SYSTEM\' | translate}}: {{disk.fs}}</div>\n                        <div class="h4">{{\'SETTINGS.MOUNT_POINT\' | translate}}: "{{disk.mount}}"</div>\n                        <div class="h4">{{\'SETTINGS.TOTAL\' | translate}}: {{disk.size / 1024 / 1024 / 1024 | number:0}} GB</div>\n                        <div class="h4">{{\'SETTINGS.USED\' | translate}}: {{disk.used / 1024 / 1024 / 1024 | number:0}} GB</div>\n                      </div>\n                      <div class="p-16 pb-32">\n                        <div class="pb-8" layout="row" layout-align="space-between start">\n                          <span class="h3" translate="SETTINGS.USED">Used</span>\n                          <span class="h4 secondary-text font-weight-500">{{disk.use | number:0}}%</span>\n                        </div>\n                        <md-progress-linear class="red" md-mode="determinate" value="{{disk.use | number:0}}"></md-progress-linear>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n            </md-card>\n\n            <md-card class="md-whiteframe-1dp padding-20" layout="row" layout-xs="column" layout-wrap>\n              <ms-widget ng-repeat="net in vm.system.net" flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-3">\n                    <div class="h3">NET {{$index + 1}}</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{\'SETTINGS.INTERFACE\' | translate}}: {{net.iface}}</div>\n                        <div class="h4">IPv4: {{net.ip4}}</div>\n                        <div class="h4">IPv6: {{net.ip6}}</div>\n                        <div class="h4">MAC: {{net.mac}}</div>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n            </md-card>\n\n            <md-card class="md-whiteframe-1dp padding-20" layout="row">\n              <div flex>\n                <md-toolbar class="md-table-toolbar md-default">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="SETTINGS.TOP_N_PROCESSES" translate-values="{value: vm.processLimit}"></span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm.searchTerm1 = query" on-collapse="vm.searchTerm1 = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table>\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column>pid</th>\n                        <th md-column>{{\'SETTINGS.NAME\' | translate}}</th>\n                        <th md-column>{{\'SETTINGS.STATE\' | translate}}</th>\n                        <th md-column>pmem</th>\n                        <th md-column>pcpu</th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-repeat="process in vm.system.processes.list | limitTo: vm.processLimit | filter: vm.searchTerm1 | orderBy:\'-pcpu\'">\n                        <td md-cell>{{process.pid}}</td>\n                        <td md-cell>{{process.command}}</td>\n                        <td md-cell>\n                          <span class="text-boxed white-fg" ng-class="{\n                          \'green-600-bg\': process.state == \'running\',\n                          \'yellow-600-bg\': process.state == \'sleeping\',\n                          \'red-600-bg\': process.state == \'blocked\'}">{{process.state | uppercase}}</span>\n                        </td>\n                        <td md-cell>{{process.pmem}}%</td>\n                        <td md-cell>{{process.pcpu}}%</td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n              </div>\n            </md-card>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SETTINGS.PROCESSES">PROCESSES</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="system-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <md-card class="md-whiteframe-1dp padding-20" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SETTINGS.MOTION_PROCESS_MANAGEMENT"></span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.searchTerm2 = query" on-collapse="vm.searchTerm2 = undefined" debounce="300"></ms-search-bar>\n                  <md-button ng-click="vm.getProcesses()" class="md-icon-button" aria-label="Reload">\n                    <md-icon md-font-icon="icon-reload" class="s24"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container>\n                <table md-table>\n                  <thead md-head>\n                    <tr md-row>\n                      <th md-column>id</th>\n                      <th md-column>pid</th>\n                      <th md-column>{{\'SETTINGS.NAME\' | translate}}</th>\n                      <th md-column>{{\'SETTINGS.STATE\' | translate}}</th>\n                      <th md-column>MEM</th>\n                      <th md-column>CPU</th>\n                      <th md-column width="20px">Actions</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-repeat="process in vm.processes | filter: vm.searchTerm2 | orderBy:\'-monit.cpu\'">\n                      <td md-cell>{{process.pm_id}}</td>\n                      <td md-cell>{{process.pid}}</td>\n                      <td md-cell>{{process.name == \'agi\' ? \'agi (Cally Square IVR)\' : process.name}}</td>\n                      <td md-cell>\n                        <span class="text-boxed white-fg" ng-class="{\'green-600-bg\': process.pm2_env.status == \'online\', \'red-600-bg\': process.pm2_env.status == \'stopped\'}">{{process.pm2_env.status | uppercase}}</span>\n                      </td>\n                      <td md-cell>{{process.monit.memory / 1024 / 1024 | number:0}} MB</td>\n                      <td md-cell>{{process.monit.cpu}}%</td>\n                      <td md-cell>\n                        <md-button ng-if="process.pm2_env.status !== \'online\'" ng-click="vm.updateProcess($event, process.pm_id, \'online\')" class="md-icon-button" aria-label="Play">\n                          <md-icon md-font-icon="icon-play" class="s24"></md-icon>\n                        </md-button>\n                        <md-button ng-if="process.pm2_env.status === \'online\'" ng-click="vm.updateProcess($event, process.pm_id, \'stopped\')" class="md-icon-button" aria-label="Stop">\n                          <md-icon md-font-icon="icon-stop" class="s24"></md-icon>\n                        </md-button>\n                      </td>\n                    </tr>\n                  </tbody>\n                  <tfoot md-foot>\n                    <tr md-row>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                      <td md-cell>{{ (vm.processes | map: \'monit.memory\' | sum) / 1024 / 1024 | number:0 }} MB</td>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                    </tr>\n                  </tfoot>\n                </table>\n              </md-table-container>\n            </md-card>\n            <md-card class="md-whiteframe-1dp padding-20" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SETTINGS.USEFUL_COMMANDS"></span>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-table-container>\n                <table md-table>\n                  <thead md-head>\n                    <tr md-row>\n                      <th md-column width="30%">{{\'SETTINGS.COMMAND\' | translate}}</th>\n                      <th md-column>{{\'SETTINGS.DESCRIPTION\' | translate}}</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr>\n                      <td md-cell class="no-border">pm2 list</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_LIST\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 start &lt;id | name&gt;</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_START\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 stop &lt;id | name | all&gt;</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_STOP\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 restart &lt;id | name&gt;</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_RESTART\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 logs [id | name]</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_LOGS\' | translate}}</td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n            </md-card>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/settings/views/updates/update/dialog.html",'<md-dialog aria-label="Update">\n  <form name="updateForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n      </div>\n    </md-toolbar>\n\n    <div md-background-bg layout="row" layout-align="start start">\n      <md-progress-linear md-mode="determinate" value="{{vm.progress}}" class="md-warn"></md-progress-linear>\n    </div>\n\n    <md-dialog-content>\n      <div layout="row" layout-align="center center">\n        <div ng-if="vm.updating" layout="column" layout-align="center center">\n          <span class="text-center md-title">Grab a quick coffee and</span>\n          <span class="text-center md-title">get back here as soon as completed!</span>\n          <span class="text-center md-title">{{vm.output}}</span>\n        </div>\n        <div ng-if="!vm.updating">\n          <div ng-if="vm.success" layout="column" layout-align="center center">\n            <span class="text-center md-title">Update Completed! Thank you for your time.</span>\n            <span class="text-center md-title">In order to complete the update,</span>\n            <span class="text-center md-title">please click on reload button</span>\n          </div>\n          <div ng-if="!vm.success" layout="column" layout-align="center center">\n            <span class="text-center md-title">Update Error!</span>\n            <span class="text-center md-title">Please contact your administrator!</span>\n            <span class="text-center md-title">{{vm.output}}</span>\n          </div>\n        </div>\n        <img src="assets/images/business/users.jpg" alt="" width="128" height="128" />\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions ng-if="!vm.updating" layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.reload()" class="send-button md-warm md-raised" aria-label="RELOAD" translate="SETTINGS.RELOAD" translate-attr-aria-label="SETTINGS.RELOAD">\n          RELOAD\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/updates/updates.html",'<div id="updates" class="page-layout simple fullwidth doc-page">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.UPDATES">UPDATES</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      \x3c!-- UPDATE CARD --\x3e\n      <div layout="row" ng-if="!vm.updating">\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="column" layout-align="center center">\n\n            <span class="md-title md-accent-fg padding-20 text-bold" translate="SETTINGS.CURRENT_VERSION">CURRENT VERSION</span>\n\n            <span class="md-display-3 padding-20">{{vm.version.current}}</span>\n\n            <md-button href="https://wiki.xcallymotion.com/display/XMV/Motion+GUI#MotionGUI-Version{{vm.version.current}}" target="_blank" class="md-accent" title="CHANGELOG" aria-label="CHANGELOG" translate="SETTINGS.CHANGELOG" translate-attr-aria-label="SETTINGS.CHANGELOG">\n              CHANGELOG\n            </md-button>\n          </div>\n        </md-card>\n        <md-card class="md-whiteframe-20dp padding-20" flex ng-if="vm.version.current != vm.version.latest">\n          <div layout="column" layout-align="center center">\n\n            <span class="md-title md-warn-fg padding-20 text-bold" translate="SETTINGS.NEW_VERSION">NEW VERSION</span>\n\n            <span class="md-display-3 padding-20">{{vm.version.latest}}</span>\n\n            <md-button href="https://wiki.xcallymotion.com/display/XMV/Motion+GUI#MotionGUI-Version{{vm.version.latest}}" target="_blank" class="md-accent" title="CHANGELOG" aria-label="CHANGELOG" translate="SETTINGS.CHANGELOG" translate-attr-aria-label="SETTINGS.CHANGELOG">\n              CHANGELOG\n            </md-button>\n            <md-button ng-click="vm.updateConfirm($event)" class="md-raised md-warn" aria-label="CHANGELOG" translate="SETTINGS.UPDATE" translate-attr-aria-label="SETTINGS.UPDATE">UPDATE</md-button>\n          </div>\n        </md-card>\n        <md-card class="md-whiteframe-1dp padding-20" flex ng-if="vm.version.current == vm.version.latest">\n          <div layout="column" layout-align="center center">\n\n            <span class="md-title md-warn-fg padding-20 text-bold" translate="SETTINGS.REMOTE_VERSION">REMOTE VERSION</span>\n\n            <span class="md-subhead padding-20" translate="SETTINGS.NO_NEW_VERSION_AVAILABLE">NO NEW VERSION AVAILABLE</span>\n          </div>\n        </md-card>\n      </div>\n      \x3c!-- / UPDATE CARD --\x3e\n\n      <div ng-if="vm.updating">\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="column" layout-align="center center">\n            <span class="md-title md-accent-fg padding-20 text-bold" translate="SETTINGS.UPDATING">...</span>\n            <md-progress-linear md-mode="determinate" class="md-accent padding-20" value="{{vm.progress}}"></md-progress-linear>\n            <span class="md-display-1 padding-5 text-center">Grab a quick coffee and</span>\n            <span class="md-display-1 padding-5 text-center">get back here as soon as completed</span>\n            <img src="assets/images/business/users.jpg" alt="" width="40%" height="40%" />\n          </div>\n        </md-card>\n      </div>\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/sms/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="SMS.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'SMS.NAME\' | translate }}</th>\n        <th md-column>{{ \'SMS.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'SMS.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'SMS.WAITING\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedIn }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="SMS.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="SMS.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/sms/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/sms/views/smsAccounts/create/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.smsAccount.name" ng-required="true" autofocus ng-disabled="!vm.newSmsAccount">\n\n        <div ng-messages="smsAccountForm[\'name\'].$error" ng-show="smsAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.smsAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'key\'].$error" ng-show="smsAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.MOTIONPROXY">MotionProxy</label>\n        <input type="url" name="remote" ng-model="vm.smsAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="SMS.HELP.MOTIONPROXY"></span></div>\n        <div ng-messages="smsAccountForm[\'remote\'].$error" ng-show="smsAccountForm[\'remote\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="SMS.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.smsAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="SMS.HELP.LIST"></span></div>\n        <div ng-messages="smsAccountForm[\'ListId\'].$error" ng-show="smsAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.smsAccount.type" required>\n          <md-option ng-value="\'twilio\'">Twilio</md-option>\n          <md-option ng-value="\'skebby\'">Skebby</md-option>\n          <md-option ng-value="\'connectel\'">Connectel</md-option>\n          <md-option ng-value="\'clicksend\'">ClickSend</md-option>\n          <md-option ng-value="\'plivo\'">Plivo</md-option>\n          <md-option ng-value="\'infobip\'">Infobip</md-option>\n          <md-option ng-value="\'clickatell\'">Clickatell</md-option>\n          <md-option ng-value="\'bandwidth\'">Bandwidth</md-option>\n          <md-option ng-value="\'csc\'">CSCTelecom</md-option>\n          <md-option ng-value="\'intelepeer\'">Intelepeer</md-option>\n        </md-select>\n        <div ng-messages="smsAccountForm[\'type\'].$error" ng-show="smsAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.PHONE">Phone</label>\n        <input type="text" name="phone" ng-model="vm.smsAccount.phone" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'phone\'].$error" ng-show="smsAccountForm[\'phone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'twilio\'" class="md-block">\n        <label translate="SMS.ACCOUNTSID">AccountSID</label>\n        <input type="text" name="accountSid" ng-model="vm.smsAccount.accountSid" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'accountSid\'].$error" ng-show="smsAccountForm[\'accountSid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'plivo\'" class="md-block">\n        <label translate="SMS.AUTHID">AuthID</label>\n        <input type="text" name="authId" ng-model="vm.smsAccount.authId" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'authId\'].$error" ng-show="smsAccountForm[\'authId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AUTHID_REQUIRED">AuthID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'twilio\' || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'plivo\'" class="md-block">\n        <label translate="SMS.AUTHTOKEN">AuthToken</label>\n        <input type="text" name="authToken" ng-model="vm.smsAccount.authToken" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'authToken\'].$error" ng-show="smsAccountForm[\'authToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'skebby\'" class="md-block">\n        <label translate="SMS.METHOD">Method</label>\n        <md-select name="smsMethod" ng-model="vm.smsAccount.smsMethod" required>\n          <md-option ng-value="\'SI\'">Basic</md-option>\n          <md-option ng-value="\'TI\'">Classic</md-option>\n          <md-option ng-value="\'GP\'">Classic+</md-option>\n        </md-select>\n        <div ng-messages="smsAccountForm[\'smsMethod\'].$error" ng-show="smsAccountForm[\'smsMethod\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.METHOD_REQUIRED">Method field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'" class="md-block">\n        <label translate="SMS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.smsAccount.username" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'username\'].$error" ng-show="smsAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'">\n        <label translate="SMS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.smsAccount.password" placeholder="Password" translate translate-attr-placeholder="SMS.PASSWORD" required>\n        <div ng-messages="smsAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SMS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'csc\'" class="md-block">\n        <label translate="SMS.BASEURL">BaseURL</label>\n        <input type="text" name="baseUrl" ng-model="vm.smsAccount.baseUrl" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'baseUrl\'].$error" ng-show="smsAccountForm[\'baseUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.BASEURL_REQUIRED">BaseURL field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\' || vm.smsAccount.type == \'intelepeer\'" class="md-block">\n        <label translate="SMS.APIKEY">ApiKey</label>\n        <input type="text" name="apiKey" ng-model="vm.smsAccount.apiKey" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'apiKey\'].$error" ng-show="smsAccountForm[\'apiKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n        <label translate="SMS.ACCOUNTID">AccountId</label>\n        <input type="text" name="accountId" ng-model="vm.smsAccount.accountId" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'accountId\'].$error" ng-show="smsAccountForm[\'accountId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.ACCOUNTID_REQUIRED">AccountId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n        <label translate="SMS.APPLICATIONID">ApplicationID</label>\n        <input type="text" name="applicationId" ng-model="vm.smsAccount.applicationId" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'applicationId\'].$error" ng-show="smsAccountForm[\'applicationId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.APPLICATIONID_REQUIRED">ApplicationID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.smsAccount.description">\n\n        <div ng-messages="smsAccountForm[\'description\'].$error" ng-show="smsAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSmsAccount" ng-click="vm.saveSmsAccount()" class="send-button md-accent md-raised" ng-disabled="smsAccountForm.$invalid || smsAccountForm.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSmsAccount" ng-click="vm.addNewSmsAccount()" class="send-button md-accent md-raised" ng-disabled="smsAccountForm.$invalid" aria-label="ADD" translate="SMS.ADD_SMSACCOUNT" translate-attr-aria-label="SMS.ADD_SMSACCOUNT">\n          ADD SMSACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmsAccount" ng-click="vm.deleteSmsAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="SMS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SMS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",'<md-dialog class="smsAccount-dialog" aria-label="smsAccount" ng-init="vm.onInit()">\n  <form name="smsAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="SMS.AGENTADD_SMSACCOUNT">Add Agent to smsAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/agent/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'agent\'].$error" ng-show="smsAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'timeout\'].$error" ng-show="smsAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/amazonlex/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'accesskeyid\'].$error" ng-show="smsAccountFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'secretaccesskey\'].$error" ng-show="smsAccountFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'lexregion\'].$error" ng-show="smsAccountFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'botname\'].$error" ng-show="smsAccountFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="SMS.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="smsAccountFormApp[\'welcomemessage\'].$error" ng-show="smsAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'times\'].$error" ng-show="smsAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="smsAccountFormApp[\'text\'].$error" ng-show="smsAccountFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/close/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'disposition\'].$error" ng-show="smsAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/dialogflow/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'key\'].$error" ng-show="smsAccountFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'language\'].$error" ng-show="smsAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="SMS.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="smsAccountFormApp[\'welcomemessage\'].$error" ng-show="smsAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'projectId\'].$error" ng-show="smsAccountFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'clientEmail\'].$error" ng-show="smsAccountFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="smsAccountFormApp[\'privateKey\'].$error" ng-show="smsAccountFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'language\'].$error" ng-show="smsAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="SMS.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="smsAccountFormApp[\'welcomemessage\'].$error" ng-show="smsAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'condition\'].$error" ng-show="smsAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'truepriority\'].$error" ng-show="smsAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'falsepriority\'].$error" ng-show="smsAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'priority\'].$error" ng-show="smsAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/noop/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'value\'].$error" ng-show="smsAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/queue/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'queue\'].$error" ng-show="smsAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'timeout\'].$error" ng-show="smsAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/system/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'command\'].$error" ng-show="smsAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'variable\'].$error" ng-show="smsAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/tag/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'tag\'].$error" ng-show="smsAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/smsCannedAnswers/dialog.html",'<md-dialog class="smsCannedAnswer-dialog" aria-label="New SmsCannedAnswer">\n  <form name="smsCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.smsCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="smsCannedAnswerForm[\'key\'].$error" ng-show="smsCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.smsCannedAnswer.value" required></textarea>\n\n        <div ng-messages="smsCannedAnswerForm[\'value\'].$error" ng-show="smsCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.smsCannedAnswer.description">\n\n        <div ng-messages="smsCannedAnswerForm[\'description\'].$error" ng-show="smsCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSmsCannedAnswer" ng-click="vm.saveSmsCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="smsCannedAnswerForm.$invalid || smsCannedAnswerForm.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSmsCannedAnswer" ng-click="vm.addNewSmsCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="smsCannedAnswerForm.$invalid" aria-label="ADD" translate="SMS.ADD_SMSCANNEDANSWER" translate-attr-aria-label="SMS.ADD_SMSCANNEDANSWER">\n          ADD SMSCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmsCannedAnswer" ng-click="vm.deleteSmsCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="SMS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SMS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/view.html",'<div id="sms-smsAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-smsAccounts-button md-icon-button" aria-label="Go to smsAccounts" ng-click="vm.gotoSmsAccounts()" translate translate-attr-aria-label="SMS.GO_TO_SMSACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="smsAccount-image" hide-xs>\n          <img ng-src="assets/images/business/smsAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.smsAccount.id}}\n            <span ng-if="vm.smsAccount.name">{{vm.smsAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="SMS.CREATED_AT"></span> <span>{{vm.smsAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.smsAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="SMS.AGENTADD_SMSACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSmsAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (proxyForm.$invalid) || (dispositionForm.$invalid) || (smsDispositionsForm.$invalid) || (smsCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="SMS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.smsAccount.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.smsAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="SMS.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.smsAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="SMS.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.smsAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'twilio\'">Twilio</md-option>\n                  <md-option ng-value="\'skebby\'">Skebby</md-option>\n                  <md-option ng-value="\'connectel\'">Connectel</md-option>\n                  <md-option ng-value="\'clicksend\'">ClickSend</md-option>\n                  <md-option ng-value="\'plivo\'">Plivo</md-option>\n                  <md-option ng-value="\'infobip\'">Infobip</md-option>\n                  <md-option ng-value="\'clickatell\'">Clickatell</md-option>\n                  <md-option ng-value="\'bandwidth\'">Bandwidth</md-option>\n                  <md-option ng-value="\'csc\'">CSCTelecom</md-option>\n                  <md-option ng-value="\'intelepeer\'">Intelepeer</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.smsAccount.phone" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'phone\'].$error" ng-show="generalForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'twilio\'" class="md-block">\n                <label translate="SMS.ACCOUNTSID">AccountSID</label>\n                <input type="text" name="accountSid" ng-model="vm.smsAccount.accountSid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'accountSid\'].$error" ng-show="generalForm[\'accountSid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'plivo\'" class="md-block">\n                <label translate="SMS.AUTHID">AuthID</label>\n                <input type="text" name="authId" ng-model="vm.smsAccount.authId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'authId\'].$error" ng-show="generalForm[\'authId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AUTHID_REQUIRED">AuthID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'twilio\' || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'plivo\'" class="md-block">\n                <label translate="SMS.AUTHTOKEN">AuthToken</label>\n                <input type="text" name="authToken" ng-model="vm.smsAccount.authToken" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'authToken\'].$error" ng-show="generalForm[\'authToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'skebby\'" class="md-block">\n                <label translate="SMS.METHOD">Method</label>\n                <md-select name="smsMethod" ng-model="vm.smsAccount.smsMethod" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'SI\'">Basic</md-option>\n                  <md-option ng-value="\'TI\'">Classic</md-option>\n                  <md-option ng-value="\'GP\'">Classic+</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'smsMethod\'].$error" ng-show="generalForm[\'smsMethod\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.METHOD_REQUIRED">Method field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.smsAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'">\n                <label translate="SMS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.smsAccount.password" placeholder="Password" translate translate-attr-placeholder="SMS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="SMS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container ng-if="vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'csc\'" class="md-block">\n                <label translate="SMS.BASEURL">BaseURL</label>\n                <input type="text" name="baseUrl" ng-model="vm.smsAccount.baseUrl" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'baseUrl\'].$error" ng-show="generalForm[\'baseUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.BASEURL_REQUIRED">BaseURL field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\' || vm.smsAccount.type == \'intelepeer\'" class="md-block">\n                <label translate="SMS.APIKEY">ApiKey</label>\n                <input type="text" name="apiKey" ng-model="vm.smsAccount.apiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'apiKey\'].$error" ng-show="generalForm[\'apiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.ACCOUNTID">AccountId</label>\n                <input type="text" name="accountId" ng-model="vm.smsAccount.accountId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'accountId\'].$error" ng-show="generalForm[\'accountId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.ACCOUNTID_REQUIRED">AccountId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.APPLICATIONID">ApplicationID</label>\n                <input type="text" name="applicationId" ng-model="vm.smsAccount.applicationId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'applicationId\'].$error" ng-show="generalForm[\'applicationId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.APPLICATIONID_REQUIRED">ApplicationID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'plivo\'|| vm.smsAccount.type == \'csc\'|| vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'intelepeer\'" class="md-block">\n                <label translate="SMS.SENDERSTRING">SenderString</label>\n                <input type="text" name="senderString" ng-model="vm.smsAccount.senderString" md-maxlength="11" ng-pattern="/^[A-Za-z0-9\\.\\s]*$/i" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'senderString\'].$error" ng-show="generalForm[\'senderString\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.SENDERSTRING_REQUIRED">SenderString field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="SMS.ERRORS.SENDERSTRING_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\s]*$/i\' }">SenderString must be valid pattern </span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="SMS.ERRORS.SENDERSTRING_MAX_LENGTH" translate-values=\'{max: 11}\'>SenderString must have a maximum length equal to 11</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="(vm.smsAccount.type == \'skebby\' && vm.smsAccount.smsMethod == \'GP\') || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\'" class="md-block">\n                <md-switch ng-model="vm.smsAccount.deliveryReport" aria-label="deliveryReport" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.DELIVERYREPORT">deliveryReport</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.smsAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.smsAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.RECEIVEURL">receiveUrl</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-receiveUrl" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-receiveUrl" name="receiveUrl" ng-value="vm.smsAccount.remote + \'/api/sms/accounts/\' + vm.smsAccount.id + \'/notify?token=\' + vm.smsAccount.token" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="SMS.HELP.RECEIVEURL"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="( ((vm.smsAccount.type == \'skebby\' && vm.smsAccount.smsMethod == \'GP\') || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\') && vm.smsAccount.deliveryReport) || vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.DELIVERYREPORTURL">deliveryReportUrl</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-deliveryReportUrl" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-deliveryReportUrl" name="deliveryReportUrl" ng-value="vm.smsAccount.remote + \'/api/sms/accounts/\' + vm.smsAccount.id + \'/status?token=\' + vm.smsAccount.token + (vm.smsAccount.type == \'csc\' ? \'&message-id={message-id}&state={state}\' : \'\')" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="SMS.HELP.DELIVERYREPORTURL"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="smsAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="SMS.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.smsAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="smsAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.queueTransfer == true" class="md-block">\n                <label translate="SMS.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.smsAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.agentTransfer == true" class="md-block">\n                <label translate="SMS.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.smsAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container proxy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.PROXY">PROXY</div>\n            </div>\n            <form name="proxyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="SMS.TOKEN">token</label>\n                <input type="text" name="token" ng-model="vm.smsAccount.token" autofocus disabled>\n\n                <div ng-messages="proxyForm[\'token\'].$error" ng-show="proxyForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.TOKEN_REQUIRED">token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.MOTIONPROXY">MotionProxy</label>\n                <input type="url" name="remote" ng-model="vm.smsAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="SMS.HELP.MOTIONPROXY"></span></div>\n                <div ng-messages="proxyForm[\'remote\'].$error" ng-show="proxyForm[\'remote\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="SMS.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="SMS.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="smsAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.mandatoryDisposition" class="md-block">\n                <label translate="SMS.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.smsAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="SMS.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="SmsAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.smsAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="smsAccount-detail-form-container smsdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedSmsAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="SMS.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add sms dispositions" translate translate-attr-label="SMS.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="smsAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'SMS.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'SMS.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'SMS.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container smscannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="SmsAccountSmsCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.smsAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedSmsAccountSmsCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SMS.SMSCANNEDANSWERS">SmsCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getSmsAccountSmsCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event)" aria-label="add smsCannedAnswer" translate translate-attr-label="SMS.ADD_SMSCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedSmsAccountSmsCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedSmsAccountSmsCannedAnswers.length}} {{vm_dc.selectedSmsAccountSmsCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedSmsAccountSmsCannedAnswers" csv-label="true" filename="smsAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedSmsAccountSmsCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedSmsAccountSmsCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getSmsAccountSmsCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'SMS.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'SMS.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'SMS.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'SMS.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'SMS.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="smsCannedAnswer" md-select-id="id" ng-repeat="smsCannedAnswer in vm_dc.smsAccountSmsCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{ smsCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" translate="SMS.EDIT_SMSCANNEDANSWER">\n                                Edit SmsCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(smsCannedAnswer, $event)" translate="SMS.DELETE_SMSCANNEDANSWER">\n                                Delete SmsCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.smsAccountSmsCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="SMS.NO_SMSCANNEDANSWER_AVAILABLE">No smscannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.smsAccountSmsCannedAnswers.count}}" md-on-paginate="vm_dc.getSmsAccountSmsCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="SmsAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.smsAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="SMS.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedSmsAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedSmsAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedSmsAccountApps.length}} {{vm_ac.selectedSmsAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedSmsAccountApps($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedSmsAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.smsAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editSmsAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editSmsAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editSmsAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editSmsAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.smsAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="SmsAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.smsAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedSmsAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SMS.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getSmsAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getSmsAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getSmsAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="SMS.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedSmsAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedSmsAccountInteractions.length}} {{vm_dc.selectedSmsAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedSmsAccountInteractions" csv-label="true" filename="smsAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedSmsAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedSmsAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getSmsAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'SMS.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'SMS.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'SMS.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'SMS.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'SMS.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'SMS.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'SMS.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.smsAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'SMS.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'SMS.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spysmsInteraction($event, interaction)" translate="SMS.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.smsInteractionDownload(interaction, $event)" translate="SMS.DOWNLOAD_INTERACTION">\n                                Download\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="SMS.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.smsAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="SMS.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.smsAccountInteractions.count}}" md-on-paginate="vm_dc.getSmsAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/sms/views/smsAccounts/smsAccounts.html",'<div id="smsAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-message-text" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SMS.SMSACCOUNTS">SmsAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SMS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSmsAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSmsAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SMS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-smsAccounts-count">\n          <span>{{vm.selectedSmsAccounts.length}}</span>\n          <span translate="SMS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SMS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSmsAccounts()" translate="SMS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSmsAccounts()" translate="SMS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSmsAccounts" csv-label="true" filename="smsAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSmsAccounts($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SMSACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSmsAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSmsAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SMS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'SMS.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'SMS.KEY\' | translate }}</th>\n                <th md-column md-order-by="ListId">{{ \'SMS.LIST\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'SMS.TYPE\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'SMS.PHONE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'SMS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.smsAccounts.rows.length">\n                <td md-cell colspan="8">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="smsAccount" md-select-id="id" ng-repeat="smsAccount in vm.smsAccounts.rows">\n                <td md-cell ng-if="smsAccount.userpic"><img class="avatar" alt="{{smsAccount.name}}" ng-src="api/users/{{smsAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!smsAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{smsAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="id ">{{smsAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="name ">{{smsAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="key ">{{smsAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="ListId ">{{ (vm.lists | filter : {\'id\':smsAccount.ListId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="type ">{{ vm.arraytype[smsAccount.type].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="phone ">{{smsAccount.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="description ">{{smsAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(smsAccount, $event    )" translate="SMS.EDIT_SMSACCOUNT">\n                          Edit SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(smsAccount, $event    )" translate="SMS.INTERACTIONS_SMSACCOUNT">\n                          Interactions SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(smsAccount, $event    )" translate="SMS.AGENTADD_SMSACCOUNT">\n                          AgentAdd SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(smsAccount, $event    )" translate="SMS.DELETE_SMSACCOUNT">\n                          Delete SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.smsAccounts.count}}" md-on-paginate="vm.getSmsAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SMSACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SMSACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-smsAccount-button" ng-click="vm.createOrEditSmsAccount($event)" aria-label="add smsAccount" translate translate-attr-aria-label="SMS.ADD_SMSACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SMSACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/sms/views/smsQueues/create/dialog.html",'<md-dialog class="smsQueue-dialog" aria-label="New SmsQueue">\n  <form name="smsQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.smsQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newSmsQueue">\n\n        <div class="hint"><span translate="SMS.HELP.NAME"></span></div>\n        <div ng-messages="smsQueueForm[\'name\'].$error" ng-show="smsQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SMS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.smsQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="smsQueueForm[\'strategy\'].$error" ng-show="smsQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.smsQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="smsQueueForm[\'timeout\'].$error" ng-show="smsQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.smsQueue.description">\n\n        <div ng-messages="smsQueueForm[\'description\'].$error" ng-show="smsQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSmsQueue" ng-click="vm.saveSmsQueue()" class="send-button md-accent md-raised" ng-disabled="smsQueueForm.$invalid || smsQueueForm.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSmsQueue" ng-click="vm.addNewSmsQueue()" class="send-button md-accent md-raised" ng-disabled="smsQueueForm.$invalid" aria-label="ADD" translate="SMS.ADD_SMSQUEUE" translate-attr-aria-label="SMS.ADD_SMSQUEUE">\n          ADD SMSQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmsQueue" ng-click="vm.deleteSmsQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="SMS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SMS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",'<md-dialog class="smsQueue-dialog" aria-label="smsQueue" ng-init="vm.onInit()">\n  <form name="smsQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="SMS.AGENTADD_SMSQUEUE">Add Agent to smsQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",'<md-dialog class="smsQueue-dialog" aria-label="smsQueue" ng-init="vm.onInit()">\n  <form name="smsQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="SMS.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsQueues/edit/view.html",'<div id="sms-smsQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-smsQueues-button md-icon-button" aria-label="Go to smsQueues" ng-click="vm.gotoSmsQueues()" translate translate-attr-aria-label="SMS.GO_TO_SMSQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="smsQueue-image" hide-xs>\n          <img ng-src="assets/images/business/smsQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.smsQueue.id}}\n            <span ng-if="vm.smsQueue.name">{{vm.smsQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="SMS.CREATED_AT"></span> <span>{{vm.smsQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.smsQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="SMS.TEAMADD_SMSQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.smsQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="SMS.AGENTADD_SMSQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSmsQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="SMS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.smsQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="SMS.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="SMS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.smsQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.smsQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.smsQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/sms/views/smsQueues/smsQueues.html",'<div id="smsQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-message-text" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SMS.SMSQUEUES">SmsQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SMS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSmsQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSmsQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SMS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-smsQueues-count">\n          <span>{{vm.selectedSmsQueues.length}}</span>\n          <span translate="SMS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SMS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSmsQueues()" translate="SMS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSmsQueues()" translate="SMS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSmsQueues" csv-label="true" filename="smsQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSmsQueues($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SMSQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSmsQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSmsQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SMS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'SMS.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'SMS.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.smsQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="smsQueue" md-select-id="id" ng-repeat="smsQueue in vm.smsQueues.rows">\n                <td md-cell ng-if="smsQueue.userpic"><img class="avatar" alt="{{smsQueue.name}}" ng-src="api/users/{{smsQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!smsQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{smsQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsQueue, ev) : vm.createOrEditSmsQueue($event, smsQueue)" md-cell class="id ">{{smsQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsQueue, ev) : vm.createOrEditSmsQueue($event, smsQueue)" md-cell class="name ">{{smsQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsQueue, ev) : vm.createOrEditSmsQueue($event, smsQueue)" md-cell class="strategy ">{{ vm.arraystrategy[smsQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(smsQueue, $event    )" translate="SMS.EDIT_SMSQUEUE">\n                          Edit SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(smsQueue, $event    )" translate="SMS.TEAMADD_SMSQUEUE">\n                          teamadd SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(smsQueue, $event    )" translate="SMS.AGENTADD_SMSQUEUE">\n                          agentadd SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(smsQueue, $event    )" translate="SMS.DELETE_SMSQUEUE">\n                          Delete SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(smsQueue, $event    )" translate="SMS.GOTOREALTIME_SMSQUEUE">\n                          goToRealtime SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.smsQueues.count}}" md-on-paginate="vm.getSmsQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SMSQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SMSQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-smsQueue-button" ng-click="vm.createOrEditSmsQueue($event)" aria-label="add smsQueue" translate translate-attr-aria-label="SMS.ADD_SMSQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SMSQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/agents/agents.html",'<div id="agents" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.AGENTS">Agents</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedAgents.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedAgents =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-agents-count">\n          <span>{{vm.selectedAgents.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllAgents()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectAgents()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedAgents" csv-label="true" filename="agents.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedAgents($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- AGENT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedAgents" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAgents">\n              <tr md-row>\n                <th md-column width="20px"></th>\n                <th md-column md-order-by="fullname">{{ \'STAFF.FULLNAME\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="showWebBar">{{ \'STAFF.SHOWWEBCONTROL\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'STAFF.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'STAFF.PHONE\' | translate }}</th>\n                <th md-column md-order-by="mobile">{{ \'STAFF.MOBILE\' | translate }}</th>\n                <th md-column md-order-by="internal">{{ \'STAFF.INTERNAL\' | translate }}</th>\n                <th md-column md-order-by="disabled">{{ \'STAFF.DISABLED\' | translate }}</th>\n                <th md-column md-order-by="blocked">{{ \'STAFF.BLOCKED\' | translate }}</th>\n                <th md-column>{{ \'STAFF.CLIENT_LOGS\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.agents.rows.length">\n                <td md-cell colspan="10">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="agent" md-select-id="id" ng-repeat="agent in vm.agents.rows">\n                <td md-cell ng-if="agent.userpic"><img class="avatar" alt="{{agent.name}}" ng-src="api/users/{{agent.id}}/avatar" /></td>\n                <td md-cell ng-if="!agent.userpic"><img class="avatar" alt="{{agent.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="fullname font-weight-600">{{agent.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="name">{{agent.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="showWebBar">{{ agent.showWebBar | getOptionByValue: vm.showWebBarOptions }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="email">{{agent.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="phone">{{agent.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="mobile">{{agent.mobile}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="internal">{{agent.internal}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="disabled">\n                  <md-icon md-colors="{color: {{agent.disabled ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{agent.disabled ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="blocked">\n                  <md-icon md-colors="{color: {{agent.blocked ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{agent.blocked ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="client-side-logging">\n                  <ms-client-side-logging-icon user="agent"></ms-client-side-logging-icon>\n                </td>\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(agent, $event    )" translate="STAFF.EDIT_AGENT">\n                          Edit Agent\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item>\n                        <md-button ng-click="vm.teamadddialog(agent, $event    )" translate="STAFF.TEAMADD_AGENT">\n                          teamadd Agent\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(agent, $event    )" translate="STAFF.DELETE_AGENT">\n                          Delete Agent\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.agents.count}}" md-on-paginate="vm.getAgents" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / AGENT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD AGENT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-agent-button" ng-click="vm.createOrEditAgent($event)" aria-label="add agent" translate translate-attr-aria-label="STAFF.ADD_AGENT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD AGENT BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/agents/create/dialog.html",'<md-dialog class="agent-dialog" aria-label="New Agent">\n  <form name="agentForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.FULLNAME">Fullname</label>\n        <input type="text" name="fullname" ng-model="vm.agent.fullname" ng-required="true" autofocus>\n\n        <div ng-messages="agentForm[\'fullname\'].$error" ng-show="agentForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.USERNAME">Username</label>\n        <input type="text" name="name" ng-model="vm.agent.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" ng-disabled="!vm.newAgent">\n\n        <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n        <div ng-messages="agentForm[\'name\'].$error" ng-show="agentForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.agent.alias">\n\n        <div ng-messages="agentForm[\'alias\'].$error" ng-show="agentForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.SHOWWEBCONTROL">ShowWebControl</label>\n        <md-select name="showWebBar" ng-model="vm.agent.showWebBar">\n          <md-option ng-value="0">Phonebar</md-option>\n          <md-option ng-value="1">External</md-option>\n          <md-option ng-value="2">WebRTC</md-option>\n        </md-select>\n        <div ng-messages="agentForm[\'showWebBar\'].$error" ng-show="agentForm[\'showWebBar\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.SHOWWEBCONTROL_REQUIRED">ShowWebControl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.agent.email" ng-required="true">\n\n        <div ng-messages="agentForm[\'email\'].$error" ng-show="agentForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newAgent">\n        <label translate="STAFF.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.agent.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="STAFF.PASSWORD" required>\n        <div ng-messages="agentForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newAgent  && (vm.newAgent)">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="agentForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newAgent" class="md-block">\n        <md-switch ng-model="vm.agent.autointernal" aria-label="AutoInternal"><span translate="STAFF.AUTOINTERNAL">AutoInternal</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.agent.autointernal" class="md-block">\n        <label translate="STAFF.INTERNAL">Internal</label>\n        <input type="text" name="internal" ng-model="vm.agent.internal" ng-required="true" ng-disabled="!vm.newAgent">\n\n        <div ng-messages="agentForm[\'internal\'].$error" ng-show="agentForm[\'internal\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.agent.description">\n\n        <div ng-messages="agentForm[\'description\'].$error" ng-show="agentForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newAgent" class="md-block">\n        <md-switch ng-model="vm.agent.voicemail" aria-label="Voicemail"><span translate="STAFF.VOICEMAIL">Voicemail</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.agent.userSetting">\n        <ms-client-side-logging user="vm.agent"></ms-client-side-logging>\n      </md-input-container>\n      <md-input-container ng-if="vm.agent.showWebBar == 0" class="md-block">\n        <md-switch ng-model="vm.agent.phoneBarRemoteControl" aria-label="RemoteControl"><span translate="STAFF.REMOTECONTROL">RemoteControl</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.agent.phoneBarRemoteControl && vm.agent.showWebBar == 0" class="md-block">\n        <label translate="STAFF.REMOTECONTROLPORT">RemoteControlPort</label>\n        <input type="number" name="phoneBarRemoteControlPort" ng-model="vm.agent.phoneBarRemoteControlPort" value="9888" ng-required="true">\n\n        <div ng-messages="agentForm[\'phoneBarRemoteControlPort\'].$error" ng-show="agentForm[\'phoneBarRemoteControlPort\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.REMOTECONTROLPORT_REQUIRED">RemoteControlPort field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newUser" class="md-block">\n        <md-switch ng-model="vm.agent.voicemail" aria-label="Voicemail"><span translate="STAFF.VOICEMAIL">Voicemail</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAgent" ng-click="vm.saveAgent()" class="send-button md-accent md-raised" ng-disabled="agentForm.$invalid || agentForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAgent" ng-click="vm.addNewAgent()" class="send-button md-accent md-raised" ng-disabled="agentForm.$invalid" aria-label="ADD" translate="STAFF.ADD_AGENT" translate-attr-aria-label="STAFF.ADD_AGENT">\n          ADD AGENT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAgent" ng-click="vm.deleteAgent($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/changepassword/changepassword.html",'<md-dialog class="agent-dialog" aria-label="{{vm.name}}">\n  <form name="agentForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.CHANGE_PASSWORD\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.agent.id">\n        <label translate="STAFF.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="STAFF.OLD_PASSWORD" required>\n        <div ng-messages="agentForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" translate ng-pattern="vm.passwordPattern" translate-attr-placeholder="STAFF.NEW_PASSWORD" required>\n        <div ng-messages="agentForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is\n              required</span>\n          </div>\n\n\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain\n              at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric\n              character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="STAFF.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n\n\n\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="agentForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is\n              required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did\n              not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="agentForm.$invalid || agentForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",'<md-dialog class="agent-dialog" aria-label="agent" ng-init="vm.onInit()">\n  <form name="agentForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2>{{vm.title}}</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin" ng-if="vm.agent.role === \'agent\' && vm.channel === \'voice\'">\n        <label translate="STAFF.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="agentForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" add-disabled="vm.channel === \'voice\' && vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveQueues()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",'<md-dialog class="agent-dialog" aria-label="agent" ng-init="vm.onInit()">\n  <form name="agentForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="STAFF.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/view.html",'<div id="staff-agent" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-agents-button md-icon-button" aria-label="Go to agents" ng-click="vm.gotoAgents()" translate translate-attr-aria-label="STAFF.GO_TO_AGENTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="agent-image" hide-xs>\n          <img ng-src="assets/images/business/agents.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.agent.id}}\n            <span ng-if="vm.agent.name">{{vm.agent.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.agent.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div ng-cloak>\n      <md-fab-speed-dial md-direction="left" class="md-scale md-fab">\n        <md-fab-trigger>\n          <md-button aria-label="menu" class="md-fab md-primary md-icon-button">\n            <md-tooltip md-direction="top" md-visible="false"><span translate="STAFF.CHANNELS">Channels</span></md-tooltip>\n            <md-icon md-font-icon="icon-stackoverflow" aria-label="queueadd"></md-icon>\n          </md-button>\n        </md-fab-trigger>\n        <md-fab-actions>\n          <md-button aria-label="voice" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'voice\', $event, \'inbound\')">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="VOICE.VOICE">Voice</span></md-tooltip>\n            <md-icon md-font-icon="icon-phone" aria-label="voice"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.dialer" aria-label="motion bull" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'voice\', $event, \'outbound\')">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="MOTIONDIALER.MOTIONDIALER">Motion Bull</span></md-tooltip>\n            <md-icon md-font-icon="icon-fire" aria-label="motion bull"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.chat" aria-label="chat" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'chat\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="CHAT.CHAT">Chat</span></md-tooltip>\n            <md-icon md-font-icon="icon-hangouts" aria-label="chat"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.mail" aria-label="mail" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'mail\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="MAIL.MAIL">Email</span></md-tooltip>\n            <md-icon md-font-icon="icon-email" aria-label="mail"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.messaging" aria-label="sms" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'sms\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="SMS.SMS">Sms</span></md-tooltip>\n            <md-icon md-font-icon="icon-message-text" aria-label="sms"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.openchannel" aria-label="openchannel" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'openchannel\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="OPENCHANNEL.OPENCHANNEL">Openchannel</span></md-tooltip>\n            <md-icon md-font-icon="icon-google-earth" aria-label="openchannel"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.fax" aria-label="fax" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'fax\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="FAX.FAX">Fax</span></md-tooltip>\n            <md-icon md-font-icon="icon-deskphone" aria-label="fax"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.whatsapp" aria-label="whatsapp" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'whatsapp\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="WHATSAPP.WHATSAPP">whatsapp</span></md-tooltip>\n            <md-icon md-font-icon="icon-whatsapp" aria-label="whatsapp"></md-icon>\n          </md-button>\n        </md-fab-actions>\n      </md-fab-speed-dial>\n    </div>\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.agent, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="STAFF.TEAMADD_AGENT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.changepassworddialog(vm.agent, $event)" class="md-fab md-warn md-icon-button" aria-label="changepassword">\n        <md-tooltip><span translate="STAFF.CHANGEPASSWORD_AGENT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-key-variant"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveAgent()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(personal_infoForm.$invalid) || (security_suiteForm.$invalid) || (change_avatarForm.$invalid) || (generalForm.$invalid) || (capacityForm.$invalid) || (settingsForm.$invalid) || (remote_controlForm.$invalid) || (sipForm.$invalid) || (callforwardingForm.$invalid) || (settings_webrtcForm.$invalid) || (sip_webrtcForm.$invalid) || (general_permissionsForm.$invalid) || (download_permissionsForm.$invalid) || (permissionsForm.$invalid) || (autoAnswerForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.PERSONAL_INFO">PERSONAL_INFO</div>\n            </div>\n            <form name="personal_infoForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.FULLNAME">Fullname</label>\n                <input type="text" name="fullname" ng-model="vm.agent.fullname" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'fullname\'].$error" ng-show="personal_infoForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.USERNAME">Username</label>\n                <input type="text" name="name" ng-model="vm.agent.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" disabled>\n                <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n                <div ng-messages="personal_infoForm[\'name\'].$error" ng-show="personal_infoForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.agent.alias" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'alias\'].$error" ng-show="personal_infoForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SHOWWEBCONTROL">ShowWebControl</label>\n                <md-select name="showWebBar" ng-model="vm.agent.showWebBar" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="0">Phonebar</md-option>\n                  <md-option ng-value="1">External</md-option>\n                  <md-option ng-value="2">WebRTC</md-option>\n                </md-select>\n                <div ng-messages="personal_infoForm[\'showWebBar\'].$error" ng-show="personal_infoForm[\'showWebBar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SHOWWEBCONTROL_REQUIRED">ShowWebControl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.agent.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'email\'].$error" ng-show="personal_infoForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.agent.phone" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'phone\'].$error" ng-show="personal_infoForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MOBILE">Mobile</label>\n                <input type="text" name="mobile" ng-model="vm.agent.mobile" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'mobile\'].$error" ng-show="personal_infoForm[\'mobile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MOBILE_REQUIRED">Mobile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 1" class="md-block">\n                <md-switch ng-model="vm.agent.hotdesk" aria-label="Hotdesk" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.HOTDESK">Hotdesk</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.loginInPause" aria-label="LoginInPause" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.LOGININPAUSE">LoginInPause</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.agent.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'description\'].$error" ng-show="personal_infoForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container security_suite md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SECURITY_SUITE">SECURITY_SUITE</div>\n            </div>\n            <form name="security_suiteForm" novalidate>\n              <md-input-container ng-if="vm.agent.passwordResetAt != null" class="md-block">\n                <label translate="STAFF.LAST_PASSWORD_RESET_AT">Last_Password_Reset_At</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.agent.passwordResetAt" autofocus disabled>\n                <div class="hint"><span translate="STAFF.HELP.LAST_PASSWORD_RESET_AT"></span></div>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.LAST_PASSWORD_RESET_AT_REQUIRED">Last_Password_Reset_At field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.passwordResetAt == null" class="md-block">\n                <label translate="STAFF.NO_PASSWORD_CHANGE">No_Password_Change</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.agent.passwordResetAt" disabled>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NO_PASSWORD_CHANGE_REQUIRED">No_Password_Change field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.disabled" aria-label="Disabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DISABLED">Disabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.DISABLED"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.disabled == 0" class="md-block">\n                <md-switch ng-model="vm.agent.blocked" aria-label="Blocked" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.BLOCKED">Blocked</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.BLOCKED"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.privacyEnabled" aria-label="Mask_Sensitive_Data" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container authentication md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.AUTHENTICATION">AUTHENTICATION</div>\n            </div>\n            <form name="authenticationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.adSsoEnabled" aria-label="AD_SSO_Enabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AD_SSO_ENABLED">AD_SSO_Enabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.AD_SSO_ENABLED"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container change_avatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CHANGE_AVATAR">CHANGE_AVATAR</div>\n            </div>\n            <div ng-controller="Agentchange_avatarController as vm_ca" ng-init="vm_ca.init(vm.agent, vm.crudPermissions)" class="agent-detail-form-container md-background-bg md-whiteframe-1dp">\n              <div id="agent-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="change_avatarimage in vm_ca.agent.images" ng-switch="change_avatarimage.type">\n                    <div class="agent-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{change_avatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="change_avatarimage.file">\n                    </div>\n                    <div class="agent-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{change_avatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.VOICE">VOICE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container ng-if="!vm.agent.autointernal" class="md-block">\n                <label translate="STAFF.INTERNAL">Internal</label>\n                <input type="text" name="internal" ng-model="vm.agent.internal" ng-required="true" autofocus disabled>\n                <div ng-messages="generalForm[\'internal\'].$error" ng-show="generalForm[\'internal\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar != 2" class="md-block">\n                <label translate="STAFF.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.agent.transport" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'" ng-if="vm.agent.showWebBar == 1">ws</md-option>\n                  <md-option ng-value="\'wss\'" ng-if="vm.agent.showWebBar == 1">wss</md-option>\n                  <md-option ng-value="\'tls\'" ng-if="vm.agent.showWebBar == 1">tls</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.TRANSPORT"></span></div>\n                <div ng-messages="generalForm[\'transport\'].$error" ng-show="generalForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.HOST">Host</label>\n                <input type="text" name="host" ng-model="vm.agent.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.HOST"></span></div>\n                <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAT">NAT</label>\n                <md-select name="nat" ng-model="vm.agent.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAT_REQUIRED">NAT field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.agent.type" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'friend\'">Friend</md-option>\n                  <md-option ng-value="\'user\'">User</md-option>\n                  <md-option ng-value="\'peer\'">Peer</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.TYPE"></span></div>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.agent.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLERID">CallerId</label>\n                <input type="text" name="callerid" ng-model="vm.agent.callerid" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'callerid\'].$error" ng-show="generalForm[\'callerid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLERID_REQUIRED">CallerId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.agent.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLGROUP">Callgroup</label>\n                <input type="text" name="callgroup" ng-model="vm.agent.callgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.CALLGROUP"></span></div>\n                <div ng-messages="generalForm[\'callgroup\'].$error" ng-show="generalForm[\'callgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLGROUP_REQUIRED">Callgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PICKUPGROUP">Pickupgroup</label>\n                <input type="text" name="pickupgroup" ng-model="vm.agent.pickupgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.PICKUPGROUP"></span></div>\n                <div ng-messages="generalForm[\'pickupgroup\'].$error" ng-show="generalForm[\'pickupgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PICKUPGROUP_REQUIRED">Pickupgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.chanspy" aria-label="chanSpy" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.CHANSPY">chanSpy</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.agent.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'videosupport\'].$error" ng-show="generalForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MONITOREXTENSION">MonitorExtension</label>\n                <md-select name="extensionMonitor" ng-model="vm.agent.extensionMonitor" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'WAV\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'extensionMonitor\'].$error" ng-show="generalForm[\'extensionMonitor\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MONITOREXTENSION_REQUIRED">MonitorExtension field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.OTHER_CHANNELS">OTHER_CHANNELS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container capacity md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CAPACITY">CAPACITY</div>\n            </div>\n            <form name="capacityForm" novalidate>\n              <md-input-container ng-if="vm.license.chat" class="md-block">\n                <label translate="STAFF.CHATCAPACITY">ChatCapacity</label>\n                <input type="number" name="chatCapacity" ng-model="vm.agent.chatCapacity" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.CHATCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'chatCapacity\'].$error" ng-show="capacityForm[\'chatCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CHATCAPACITY_REQUIRED">ChatCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.CHATCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ChatCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.mail" class="md-block">\n                <label translate="STAFF.MAILCAPACITY">MailCapacity</label>\n                <input type="number" name="mailCapacity" ng-model="vm.agent.mailCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.MAILCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'mailCapacity\'].$error" ng-show="capacityForm[\'mailCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MAILCAPACITY_REQUIRED">MailCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.MAILCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MailCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.messaging" class="md-block">\n                <label translate="STAFF.SMSCAPACITY">SMSCapacity</label>\n                <input type="number" name="smsCapacity" ng-model="vm.agent.smsCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SMSCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'smsCapacity\'].$error" ng-show="capacityForm[\'smsCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SMSCAPACITY_REQUIRED">SMSCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.SMSCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">SMSCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.openchannel" class="md-block">\n                <label translate="STAFF.OPENCHANNELCAPACITY">OpenchannelCapacity</label>\n                <input type="number" name="openchannelCapacity" ng-model="vm.agent.openchannelCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.OPENCHANNELCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'openchannelCapacity\'].$error" ng-show="capacityForm[\'openchannelCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.OPENCHANNELCAPACITY_REQUIRED">OpenchannelCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.OPENCHANNELCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">OpenchannelCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.fax" class="md-block">\n                <label translate="STAFF.FAXCAPACITY">FaxCapacity</label>\n                <input type="number" name="faxCapacity" ng-model="vm.agent.faxCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.FAXCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'faxCapacity\'].$error" ng-show="capacityForm[\'faxCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.FAXCAPACITY_REQUIRED">FaxCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.FAXCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">FaxCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.whatsapp" class="md-block">\n                <label translate="STAFF.WHATSAPPCAPACITY">WhatsappCapacity</label>\n                <input type="number" name="whatsappCapacity" ng-model="vm.agent.whatsappCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.WHATSAPPCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'whatsappCapacity\'].$error" ng-show="capacityForm[\'whatsappCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.WHATSAPPCAPACITY_REQUIRED">WhatsappCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.WHATSAPPCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WhatsappCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container auto_answer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.AUTO_ANSWER">AUTO_ANSWER</div>\n            </div>\n            <form name="autoAnswerForm" novalidate>\n              <md-input-container ng-if="vm.license.chat" class="md-block">\n                <md-switch ng-model="vm.agent.chatAutoanswer" aria-label="chatAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.CHAT_AUTOANSWER">ChatAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.chatAutoanswer" class="md-block">\n                  <label translate="STAFF.CHAT_AUTOANSWERDELAY">ChatAutoAnswerDelay</label>\n                  <input type="number" name="chatAutoAnswerDelay" ng-model="vm.agent.chatAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.mail" class="md-block">\n                <md-switch ng-model="vm.agent.emailAutoanswer" aria-label="emailAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.EMAIL_AUTOANSWER">EmailAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.emailAutoanswer" class="md-block">\n                  <label translate="STAFF.EMAIL_AUTOANSWERDELAY">EmailAutoAnswerDelay</label>\n                  <input type="number" name="emailAutoAnswerDelay" ng-model="vm.agent.emailAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.messaging" class="md-block">\n                <md-switch ng-model="vm.agent.smsAutoanswer" aria-label="smsAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.SMS_AUTOANSWER">SmsAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.smsAutoanswer" class="md-block">\n                  <label translate="STAFF.SMS_AUTOANSWERDELAY">SmsAutoAnswerDelay</label>\n                  <input type="number" name="smsAutoAnswerDelay" ng-model="vm.agent.smsAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.openchannel" class="md-block">\n                <md-switch ng-model="vm.agent.openchannelAutoanswer" aria-label="openchannelAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.OPENCHANNEL_AUTOANSWER">openchannelAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.openchannelAutoanswer" class="md-block">\n                  <label translate="STAFF.OPENCHANNEL_AUTOANSWERDELAY">openchannelAutoAnswerDelay</label>\n                  <input type="number" name="openchannelAutoAnswerDelay" ng-model="vm.agent.openchannelAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.fax" class="md-block">\n                <md-switch ng-model="vm.agent.faxAutoanswer" aria-label="faxAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.FAX_AUTOANSWER">faxAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.faxAutoanswer" class="md-block">\n                  <label translate="STAFF.FAX_AUTOANSWERDELAY">faxAutoAnswerDelay</label>\n                  <input type="number" name="faxAutoAnswerDelay" ng-model="vm.agent.faxAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.whatsapp" class="md-block">\n                <md-switch ng-model="vm.agent.whatsappAutoanswer" aria-label="whatsappAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.WHATSAPP_AUTOANSWER">whatsappAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.whatsappAutoanswer" class="md-block">\n                  <label translate="STAFF.WHATSAPP_AUTOANSWERDELAY">whatsappAutoAnswerDelay</label>\n                  <input type="number" name="whatsappAutoAnswerDelay" ng-model="vm.agent.whatsappAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.agent.showWebBar == 0">\n        <md-tab-label>\n          <span translate="STAFF.MOTIONBAR">MOTIONBAR</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container settings md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SETTINGS">SETTINGS</div>\n            </div>\n            <form name="settingsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableSettings" aria-label="EnableSettings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLESETTINGS">EnableSettings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarAutoAnswer" aria-label="AutoAnswer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AUTOANSWER">AutoAnswer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarAutoAnswer" class="md-block">\n                <label translate="STAFF.AUTOANSWERDELAY">AutoAnswerDelay</label>\n                <input type="number" name="phoneBarAutoAnswerDelay" ng-model="vm.agent.phoneBarAutoAnswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="settingsForm[\'phoneBarAutoAnswerDelay\'].$error" ng-show="settingsForm[\'phoneBarAutoAnswerDelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_REQUIRED">AutoAnswerDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AutoAnswerDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarRingInUse" aria-label="RingInUse" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.RINGINUSE">RingInUse</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableRecording" aria-label="EnableRecording" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLERECORDING">EnableRecording</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableDtmfTone" aria-label="EnableDtmfTone" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEDTMFTONE">EnableDtmfTone</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarDnd" aria-label="Dnd" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DND">Dnd</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarUnansweredCallBadge" aria-label="UnansweredCallBadge" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.UNANSWEREDCALLBADGE">UnansweredCallBadge</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 0" class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableJaws" aria-label="EnableJawsIntegration" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEJAWSINTEGRATION">EnableJawsIntegration</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 0 && vm.license.screenrecording" class="md-block">\n                <md-switch ng-change="vm.onEnableScreenRecordingByAgentSelection()" ng-model="vm.agent.phoneBarEnableScreenRecordingByAgent" aria-label="EnableScreenRecordingByAgent" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLESCREENRECORDINGBYAGENT">EnableScreenRecordingByAgent</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 0 && vm.license.screenrecording" class="md-block">\n                <md-switch ng-change="vm.onEnableAutomaticScreenRecordingSelection()" ng-model="vm.agent.phoneBarEnableAutomaticScreenRecording" aria-label="EnableAutomaticScreenRecording" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEAUTOMATICSCREENRECORDING">EnableAutomaticScreenRecording</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.ENABLEAUTOMATICSCREENRECORDING"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container remote_control md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.REMOTE_CONTROL">REMOTE_CONTROL</div>\n            </div>\n            <form name="remote_controlForm" novalidate>\n              <md-input-container ng-if="vm.agent.showWebBar == 0" class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarRemoteControl" aria-label="RemoteControl" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.REMOTECONTROL">RemoteControl</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarRemoteControl && vm.agent.showWebBar == 0" class="md-block">\n                <label translate="STAFF.REMOTECONTROLPORT">RemoteControlPort</label>\n                <input type="number" name="phoneBarRemoteControlPort" ng-model="vm.agent.phoneBarRemoteControlPort" value="9888" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="remote_controlForm[\'phoneBarRemoteControlPort\'].$error" ng-show="remote_controlForm[\'phoneBarRemoteControlPort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.REMOTECONTROLPORT_REQUIRED">RemoteControlPort field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container sip md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SIP">SIP</div>\n            </div>\n            <form name="sipForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SIPEXPIRES">SipExpires</label>\n                <input type="number" name="phoneBarExpires" ng-model="vm.agent.phoneBarExpires" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SIPEXPIRES"></span></div>\n                <div ng-messages="sipForm[\'phoneBarExpires\'].$error" ng-show="sipForm[\'phoneBarExpires\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SIPEXPIRES_REQUIRED">SipExpires field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SIPPORT">SipPort</label>\n                <input type="number" name="phoneBarListenPort" ng-model="vm.agent.phoneBarListenPort" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SIPPORT"></span></div>\n                <div ng-messages="sipForm[\'phoneBarListenPort\'].$error" ng-show="sipForm[\'phoneBarListenPort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SIPPORT_REQUIRED">SipPort field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container callforwarding md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CALLFORWARDING">CALLFORWARDING</div>\n            </div>\n            <form name="callforwardingForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarUnconditional" aria-label="Unconditional" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.UNCONDITIONAL">Unconditional</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarUnconditional" class="md-block">\n                <label translate="STAFF.UNCONDITIONALNUMBER">UnconditionalNumber</label>\n                <input type="text" name="phoneBarUnconditionalNumber" ng-model="vm.agent.phoneBarUnconditionalNumber" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="callforwardingForm[\'phoneBarUnconditionalNumber\'].$error" ng-show="callforwardingForm[\'phoneBarUnconditionalNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.UNCONDITIONALNUMBER_REQUIRED">UnconditionalNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.agent.showWebBar == 2">\n        <md-tab-label>\n          <span translate="STAFF.WEBRTC">WEBRTC</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container settings_webrtc md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SETTINGS_WEBRTC">SETTINGS_WEBRTC</div>\n            </div>\n            <form name="settings_webrtcForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DTLSCERTFILE">dtlscertfile</label>\n                <input type="text" name="dtlscertfile" ng-model="vm.agent.dtlscertfile" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.DTLSCERTFILE"></span></div>\n                <div ng-messages="settings_webrtcForm[\'dtlscertfile\'].$error" ng-show="settings_webrtcForm[\'dtlscertfile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DTLSCERTFILE_REQUIRED">dtlscertfile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DTLSPRIVATEKEY">dtlsprivatekey</label>\n                <input type="text" name="dtlsprivatekey" ng-model="vm.agent.dtlsprivatekey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.DTLSPRIVATEKEY"></span></div>\n                <div ng-messages="settings_webrtcForm[\'dtlsprivatekey\'].$error" ng-show="settings_webrtcForm[\'dtlsprivatekey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DTLSPRIVATEKEY_REQUIRED">dtlsprivatekey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.WSS_PORT">WSS_Port</label>\n                <input type="number" name="wssPort" ng-model="vm.agent.wssPort" min="0" value="8089" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.WSS_PORT"></span></div>\n                <div ng-messages="settings_webrtcForm[\'wssPort\'].$error" ng-show="settings_webrtcForm[\'wssPort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.WSS_PORT_REQUIRED">WSS_Port field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.WSS_PORT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WSS_Port must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableSettings" aria-label="EnableSettings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLESETTINGS">EnableSettings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarAutoAnswer" aria-label="AutoAnswer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AUTOANSWER">AutoAnswer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarAutoAnswer" class="md-block">\n                <label translate="STAFF.AUTOANSWERDELAY">AutoAnswerDelay</label>\n                <input type="number" name="phoneBarAutoAnswerDelay" ng-model="vm.agent.phoneBarAutoAnswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="settings_webrtcForm[\'phoneBarAutoAnswerDelay\'].$error" ng-show="settings_webrtcForm[\'phoneBarAutoAnswerDelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_REQUIRED">AutoAnswerDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AutoAnswerDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableRecording" aria-label="EnableRecording" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLERECORDING">EnableRecording</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableDtmfTone" aria-label="EnableDtmfTone" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEDTMFTONE">EnableDtmfTone</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarDnd" aria-label="Dnd" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DND">Dnd</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.ignorePauseForPreviewCalls" aria-label="Ignore agent break status for preview calls" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.IGNORE_AGENT_BREAK_STATUS_FOR_PREVIEW_CALLS">Ignore agent break status for preview calls</span></md-switch>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container sip_webrtc md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SIP_WEBRTC">SIP_WEBRTC</div>\n            </div>\n            <form name="sip_webrtcForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SIPEXPIRES">SipExpires</label>\n                <input type="number" name="phoneBarExpires" ng-model="vm.agent.phoneBarExpires" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SIPEXPIRES"></span></div>\n                <div ng-messages="sip_webrtcForm[\'phoneBarExpires\'].$error" ng-show="sip_webrtcForm[\'phoneBarExpires\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SIPEXPIRES_REQUIRED">SipExpires field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.PERMISSIONS">PERMISSIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container general_permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL_PERMISSIONS">GENERAL_PERMISSIONS</div>\n            </div>\n            <form name="general_permissionsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.allowmessenger" aria-label="EnableMessenger" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEMESSENGER">EnableMessenger</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarPrefixRequired" aria-label="PrefixRequired" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.PREFIXREQUIRED">PrefixRequired</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.selectRecallMeCampaign" aria-label="Select_RecallMe_Campaign" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.SELECT_RECALLME_CAMPAIGN">Select_RecallMe_Campaign</span></md-switch>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container download_permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.DOWNLOAD_PERMISSIONS">DOWNLOAD_PERMISSIONS</div>\n            </div>\n            <form name="download_permissionsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.downloadAttachments" aria-label="Attachments" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ATTACHMENTS">Attachments</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.downloadOmnichannelInteractions" aria-label="Omnichannel_Interactions" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.OMNICHANNEL_INTERACTIONS">Omnichannel_Interactions</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.downloadVoiceRecordings" aria-label="Voice_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.VOICE_RECORDINGS">Voice_Recordings</span></md-switch>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.PERMISSIONS">PERMISSIONS</div>\n            </div>\n            <div ng-controller="AgentPermissionsController as vm_pc" ng-init="vm_pc.init(vm.agent, vm.crudPermissions)" class="agent-detail-form-container">\n              <md-list ng-repeat="father in vm_pc.navigation[0].children" ng-include="\'permission-nested.html\'" ng-if="vm_pc.agent.role !== \'admin\' && !father.hidden()"></md-list>\n              \x3c!-- Nested navigation template --\x3e\n              <script type="text/ng-template" id="permission-nested.html">\n                <md-list-item>\n        <md-icon md-font-icon="{{father.icon}}"></md-icon>\n        <p translate="{{father.translate}}">{{ father.title }}</p>\n        <md-switch class="md-secondary" ng-model="father.enabled" ng-change="vm_pc.onChange(father)" ng-init="father.enabled = vm_pc.agent.permissions.includes(father.id)" \n                  ng-disabled="!vm_pc.crudPermissions.canEdit"></md-switch>\n      </md-list-item>\n      <md-divider></md-divider>\n      <md-list>\n        <md-list-item ng-repeat="child in father.children" ng-if="child.id !== 201">\n          <md-icon ng-if="child.icon" md-font-icon="{{child.icon}}"></md-icon>\n          <p translate="{{child.translate}}">{{ child.title }}</p>\n          <md-switch ng-model="child.enabled" ng-change="vm_pc.onChange(father, child)" ng-init="child.enabled = vm_pc.agent.permissions.includes(child.id)"\n                    ng-disabled="!vm_pc.crudPermissions.canEdit"></md-switch>\n          </md-list-item>\n      </md-list>\n  <\/script>\n              \x3c!-- / Nested navigation template --\x3e\n              <span ng-if="vm_pc.agent.role === \'admin\'" class="md-headline" translate="STAFF.ALL_MODULES_AVAILABLE">All modules are already available.</span>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.CLIENT_LOGS">CLIENT-SIDE LOGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container client_logs md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CLIENT_LOGS">\n                CLIENT-SIDE LOGS\n              </div>\n            </div>\n            <ms-client-side-logging user="vm.agent" on-user-update="vm.refreshAgent()"></ms-client-side-logging>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/staff/views/teams/create/dialog.html",'<md-dialog class="team-dialog" aria-label="New Team">\n  <form name="teamForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.team.name" ng-required="true" autofocus>\n\n        <div ng-messages="teamForm[\'name\'].$error" ng-show="teamForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.team.description">\n\n        <div ng-messages="teamForm[\'description\'].$error" ng-show="teamForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTeam" ng-click="vm.saveTeam()" class="send-button md-accent md-raised" ng-disabled="teamForm.$invalid || teamForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTeam" ng-click="vm.addNewTeam()" class="send-button md-accent md-raised" ng-disabled="teamForm.$invalid" aria-label="ADD" translate="STAFF.ADD_TEAM" translate-attr-aria-label="STAFF.ADD_TEAM">\n          ADD TEAM\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTeam" ng-click="vm.deleteTeam($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/teams/edit/agentadd/agentadd.html",'<md-dialog class="team-dialog" aria-label="team" ng-init="vm.onInit()">\n  <form name="teamForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="STAFF.AGENTADD_TEAM">Add Agent to team</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/teams/teams.html",'<div id="teams" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.TEAMS">Teams</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTeams.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTeams =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-teams-count">\n          <span>{{vm.selectedTeams.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTeams()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTeams()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTeams" csv-label="true" filename="teams.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTeams($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TEAM TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTeams" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTeams">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'STAFF.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'STAFF.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.teams.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="team" md-select-id="id" ng-repeat="team in vm.teams.rows">\n                <td md-cell ng-if="team.userpic"><img class="avatar" alt="{{team.name}}" ng-src="api/users/{{team.id}}/avatar" /></td>\n                <td md-cell ng-if="!team.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{team.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditTeam($event, team)" md-cell class="id ">{{team.id}}</td>\n                <td ng-click="vm.createOrEditTeam($event, team)" md-cell class="name ">{{team.name}}</td>\n                <td ng-click="vm.createOrEditTeam($event, team)" md-cell class="description ">{{team.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(team, $event    )" translate="STAFF.EDIT_TEAM">\n                          Edit Team\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(team, $event    )" translate="STAFF.AGENTADD_TEAM">\n                          AgentAdd Team\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(team, $event    )" translate="STAFF.DELETE_TEAM">\n                          Delete Team\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.teams.count}}" md-on-paginate="vm.getTeams" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TEAM TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TEAM BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-team-button" ng-click="vm.createOrEditTeam($event)" aria-label="add team" translate translate-attr-aria-label="STAFF.ADD_TEAM">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TEAM BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/telephones/create/dialog.html",'<md-dialog class="telephone-dialog" aria-label="New Telephone">\n  <form name="telephoneForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.ACCOUNTNAME">Accountname</label>\n        <input type="text" name="fullname" ng-model="vm.telephone.fullname" ng-required="true" autofocus>\n\n        <div ng-messages="telephoneForm[\'fullname\'].$error" ng-show="telephoneForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.ACCOUNTNAME_REQUIRED">Accountname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.USERNAME">Username</label>\n        <input type="text" name="name" ng-model="vm.telephone.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" ng-disabled="!vm.newTelephone">\n\n        <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n        <div ng-messages="telephoneForm[\'name\'].$error" ng-show="telephoneForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.telephone.email" ng-required="true">\n\n        <div ng-messages="telephoneForm[\'email\'].$error" ng-show="telephoneForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newTelephone">\n        <label translate="STAFF.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.telephone.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="STAFF.PASSWORD" required>\n        <div ng-messages="telephoneForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.newTelephone  && (vm.newTelephone)">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="telephoneForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.telephone.description">\n\n        <div ng-messages="telephoneForm[\'description\'].$error" ng-show="telephoneForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newTelephone" class="md-block">\n        <md-switch ng-model="vm.telephone.autointernal" aria-label="AutoInternal"><span translate="STAFF.AUTOINTERNAL">AutoInternal</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.telephone.autointernal" class="md-block">\n        <label translate="STAFF.INTERNAL">Internal</label>\n        <input type="text" name="internal" ng-model="vm.telephone.internal" ng-required="true" ng-disabled="!vm.newTelephone">\n\n        <div ng-messages="telephoneForm[\'internal\'].$error" ng-show="telephoneForm[\'internal\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newTelephone" class="md-block">\n        <md-switch ng-model="vm.telephone.voicemail" aria-label="Voicemail"><span translate="STAFF.VOICEMAIL">Voicemail</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTelephone" ng-click="vm.saveTelephone()" class="send-button md-accent md-raised" ng-disabled="telephoneForm.$invalid || telephoneForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTelephone" ng-click="vm.addNewTelephone()" class="send-button md-accent md-raised" ng-disabled="telephoneForm.$invalid" aria-label="ADD" translate="STAFF.ADD_TELEPHONE" translate-attr-aria-label="STAFF.ADD_TELEPHONE">\n          ADD TELEPHONE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTelephone" ng-click="vm.deleteTelephone($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/telephones/edit/changepassword/changepassword.html",'<md-dialog class="telephone-dialog" aria-label="{{vm.name}}">\n  <form name="telephoneForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.CHANGE_PASSWORD\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.telephone.id">\n        <label translate="STAFF.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="STAFF.OLD_PASSWORD" required>\n        <div ng-messages="telephoneForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" translate ng-pattern="vm.passwordPattern" translate-attr-placeholder="STAFF.NEW_PASSWORD" required>\n        <div ng-messages="telephoneForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is\n              required</span>\n          </div>\n\n\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain\n              at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric\n              character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="STAFF.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n\n\n\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="telephoneForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is\n              required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did\n              not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="telephoneForm.$invalid || telephoneForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/telephones/edit/view.html",'<div id="staff-telephone" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-telephones-button md-icon-button" aria-label="Go to telephones" ng-click="vm.gotoTelephones()" translate translate-attr-aria-label="STAFF.GO_TO_TELEPHONES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="telephone-image" hide-xs>\n          <img ng-src="assets/images/business/telephones.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.telephone.id}}\n            <span ng-if="vm.telephone.name">{{vm.telephone.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.telephone.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.changepassworddialog(vm.telephone, $event)" class="md-fab md-warn md-icon-button" aria-label="changepassword">\n        <md-tooltip><span translate="STAFF.CHANGEPASSWORD_TELEPHONE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-key-variant"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveTelephone()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(accountForm.$invalid) || (generalForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="telephone-detail-form-container account md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.ACCOUNT">ACCOUNT</div>\n            </div>\n            <form name="accountForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ACCOUNTNAME">Accountname</label>\n                <input type="text" name="fullname" ng-model="vm.telephone.fullname" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'fullname\'].$error" ng-show="accountForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ACCOUNTNAME_REQUIRED">Accountname field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.USERNAME">Username</label>\n                <input type="text" name="name" ng-model="vm.telephone.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" disabled>\n\n                <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n                <div ng-messages="accountForm[\'name\'].$error" ng-show="accountForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.telephone.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'email\'].$error" ng-show="accountForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.telephone.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'description\'].$error" ng-show="accountForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.telephone.phone" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'phone\'].$error" ng-show="accountForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MOBILE">Mobile</label>\n                <input type="text" name="mobile" ng-model="vm.telephone.mobile" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'mobile\'].$error" ng-show="accountForm[\'mobile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MOBILE_REQUIRED">Mobile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.VOICE">VOICE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="telephone-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container ng-if="!vm.telephone.autointernal" class="md-block">\n                <label translate="STAFF.INTERNAL">Internal</label>\n                <input type="text" name="internal" ng-model="vm.telephone.internal" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'internal\'].$error" ng-show="generalForm[\'internal\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.telephone.transport" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'">ws</md-option>\n                  <md-option ng-value="\'wss\'">wss</md-option>\n                  <md-option ng-value="\'tls\'">tls</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.TRANSPORT"></span></div>\n                <div ng-messages="generalForm[\'transport\'].$error" ng-show="generalForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAT">NAT</label>\n                <md-select name="nat" ng-model="vm.telephone.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAT_REQUIRED">NAT field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.telephone.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLERID">CallerId</label>\n                <input type="text" name="callerid" ng-model="vm.telephone.callerid" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'callerid\'].$error" ng-show="generalForm[\'callerid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLERID_REQUIRED">CallerId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.telephone.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLGROUP">Callgroup</label>\n                <input type="text" name="callgroup" ng-model="vm.telephone.callgroup" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="STAFF.HELP.CALLGROUP"></span></div>\n                <div ng-messages="generalForm[\'callgroup\'].$error" ng-show="generalForm[\'callgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLGROUP_REQUIRED">Callgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PICKUPGROUP">Pickupgroup</label>\n                <input type="text" name="pickupgroup" ng-model="vm.telephone.pickupgroup" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="STAFF.HELP.PICKUPGROUP"></span></div>\n                <div ng-messages="generalForm[\'pickupgroup\'].$error" ng-show="generalForm[\'pickupgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PICKUPGROUP_REQUIRED">Pickupgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.telephone.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'videosupport\'].$error" ng-show="generalForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ENCRYPTION">Encryption</label>\n                <md-select name="encryption" ng-model="vm.telephone.encryption" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ENCRYPTION"></span></div>\n                <div ng-messages="generalForm[\'encryption\'].$error" ng-show="generalForm[\'encryption\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ENCRYPTION_REQUIRED">Encryption field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/staff/views/telephones/telephones.html",'<div id="telephones" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.TELEPHONES">Telephones</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTelephones.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTelephones =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-telephones-count">\n          <span>{{vm.selectedTelephones.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTelephones()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTelephones()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTelephones" csv-label="true" filename="telephones.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTelephones($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TELEPHONE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTelephones" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTelephones">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="fullname">{{ \'STAFF.ACCOUNTNAME\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'STAFF.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="internal">{{ \'STAFF.INTERNAL\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.telephones.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="telephone" md-select-id="id" ng-repeat="telephone in vm.telephones.rows">\n                <td md-cell ng-if="telephone.userpic"><img class="avatar" alt="{{telephone.name}}" ng-src="api/users/{{telephone.id}}/avatar" /></td>\n                <td md-cell ng-if="!telephone.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{telephone.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="fullname font-weight-600">{{telephone.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="name ">{{telephone.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="email ">{{telephone.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="internal ">{{telephone.internal}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(telephone, $event    )" translate="STAFF.EDIT_TELEPHONE">\n                          Edit Telephone\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(telephone, $event    )" translate="STAFF.DELETE_TELEPHONE">\n                          Delete Telephone\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.telephones.count}}" md-on-paginate="vm.getTelephones" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TELEPHONE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TELEPHONE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-telephone-button" ng-click="vm.createOrEditTelephone($event)" aria-label="add telephone" translate translate-attr-aria-label="STAFF.ADD_TELEPHONE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TELEPHONE BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/userProfiles/create/dialog.html",'<md-dialog class="userProfile-dialog" aria-label="New UserProfile">\n  <form name="userProfileForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.userProfile.name" ng-required="true" autofocus ng-disabled="!vm.newUserProfile">\n\n        <div ng-messages="userProfileForm[\'name\'].$error" ng-show="userProfileForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.userProfile.description">\n\n        <div ng-messages="userProfileForm[\'description\'].$error" ng-show="userProfileForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CRUDPERMISSIONS">CrudPermissions</label>\n        <md-select name="crudPermissions" ng-model="vm.userProfile.crudPermissions" multiple required>\n\n          <md-option ng-value="\'r\'" disabled> {{ \'STAFF.READ_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'e\'"> {{ \'STAFF.EDIT_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'d\'"> {{ \'STAFF.DELETE_PERMISSION\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="userProfileForm[\'crudPermissions\'].$error" ng-show="userProfileForm[\'crudPermissions\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CRUDPERMISSIONS_REQUIRED">CrudPermissions field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.userProfile.privacyEnabled" aria-label="Mask_Sensitive_Data"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n        <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newUserProfile" ng-click="vm.saveUserProfile()" class="send-button md-accent md-raised" ng-disabled="userProfileForm.$invalid || userProfileForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newUserProfile" ng-click="vm.addNewUserProfile()" class="send-button md-accent md-raised" ng-disabled="userProfileForm.$invalid" aria-label="ADD" translate="STAFF.ADD_USERPROFILE" translate-attr-aria-label="STAFF.ADD_USERPROFILE">\n          ADD USERPROFILE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newUserProfile" ng-click="vm.deleteUserProfile($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/userProfiles/edit/clone/clone.html",'<md-dialog class="userProfile-dialog" aria-label="Clone UserProfile">\n  <form name="userProfileForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.userProfile.name" ng-required="true" autofocus ng-disabled="!vm.newUserProfile">\n\n        <div ng-messages="userProfileForm[\'name\'].$error" ng-show="userProfileForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.userProfile.description">\n\n        <div ng-messages="userProfileForm[\'description\'].$error" ng-show="userProfileForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CRUDPERMISSIONS">CrudPermissions</label>\n        <md-select name="crudPermissions" ng-model="vm.userProfile.crudPermissions" multiple required>\n\n          <md-option ng-value="\'r\'" disabled> {{ \'STAFF.READ_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'e\'"> {{ \'STAFF.EDIT_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'d\'"> {{ \'STAFF.DELETE_PERMISSION\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="userProfileForm[\'crudPermissions\'].$error" ng-show="userProfileForm[\'crudPermissions\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CRUDPERMISSIONS_REQUIRED">CrudPermissions field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.userProfile.privacyEnabled" aria-label="Mask_Sensitive_Data"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n        <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneUserProfile()" class="send-button md-accent md-raised" ng-disabled="userProfileForm.$invalid" aria-label="CLONE" translate="STAFF.CLONE_USERPROFILE" translate-attr-aria-label="STAFF.CLONE_USERPROFILE">\n        CLONE USERPROFILE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",'<md-dialog class="userProfile-dialog" aria-label="userProfile">\n  <form name="userProfileForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2>{{vm.title}}</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog($event)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div layout="column" class="padding-bottom-10">\n        <div layout="row" class="padding-bottom-10">\n          <md-input-container flex class="no-margin">\n            <label translate="STAFF.SECTIONS">Sections</label>\n            <md-select name="sections" ng-model="vm.selectedSection" placeholder="{{\'STAFF.PERMISSIONS_SELECT_SECTION\' | translate}}" ng-change="vm.onChangeSection()" required>\n              <md-option ng-value="subsection" ng-repeat="subsection in vm.subsections" ng-selected="{{vm.subsections.length === 1 ? \'true\' : \'false\'}}">{{subsection.translate | translate}}</md-option>\n            </md-select>\n          </md-input-container>\n          <div layout="row" ng-show="vm.selectedSection" class="margin-left-10">\n            <md-button ng-switch="vm.selectedSection.enabled" class="md-icon-button md-fab md-mini size-8 padding-10" ng-class="vm.selectedSection.enabled ? \'blue-500-bg\' : \'grey-A400-bg\'" ng-click="vm.onChangeVisibility()" aria-label="Visibility">\n              <md-icon ng-switch-when="true" md-font-icon="icon-eye" aria-label="Visible section">\n                <md-tooltip>{{\'STAFF.PERMISSIONS_SECTION_HIDE\' | translate}}</md-tooltip>\n              </md-icon>\n              <md-icon ng-switch-when="false" md-font-icon="icon-eye-off" aria-label="Hidden section">\n                <md-tooltip>{{\'STAFF.PERMISSIONS_SECTION_SHOW\' | translate}}</md-tooltip>\n              </md-icon>\n            </md-button>\n            <div>\n              <md-button class="md-icon-button md-fab md-mini size-8 green-A700-bg no-margin" ng-disabled="true">\n                <md-icon md-font-icon="icon-monitor" class="md-background-fg" aria-label="Read permission">\n                  <md-tooltip>{{\'STAFF.READ_PERMISSION\' | translate}}</md-tooltip>\n                </md-icon>\n              </md-button>\n              <md-button class="md-icon-button md-fab md-mini size-8 no-margin" ng-class="vm.selectedSection.allowEdit ? \'green-A700-bg\' : \'grey-A400-bg\'" ng-click="vm.setPermission(\'edit\')">\n                <md-icon md-font-icon="icon-pencil" aria-label="Edit permission">\n                  <md-tooltip>{{\'STAFF.EDIT_PERMISSION\' | translate}}</md-tooltip>\n                </md-icon>\n              </md-button>\n              <md-button class="md-icon-button md-fab md-mini size-8 no-margin" ng-class="vm.selectedSection.allowDelete ? \'green-A700-bg\' : \'grey-A400-bg\'" ng-click="vm.setPermission(\'delete\')">\n                <md-icon md-font-icon="icon-delete" aria-label="Delete permission">\n                  <md-tooltip>{{\'STAFF.DELETE_PERMISSION\' | translate}}</md-tooltip>\n                </md-icon>\n              </md-button>\n            </div>\n          </div>\n        </div>\n        <div layout="row" ng-show="vm.selectedSection" class="margin-left-10" ng-if="!vm.selectedSection.permissions || vm.selectedSection.permissions.association">\n          <md-switch ng-model="vm.selectedSection.autoAssociation" class="no-margin padding-right-10" aria-label="Auto association" ng-change="vm.onChangeAutoAssociation()">\n          </md-switch>\n          <p class="no-margin font-size-12 line-height-30">{{\'STAFF.PERMISSIONS_AUTO_ASSOCIATION_INFO\' | translate}}</p>\n        </div>\n        <div layout="row" ng-show="vm.selectedSection && vm.selectedSection.title === \'Reports\' && !vm.selectedSection.autoAssociation" class="margin-bottom-10 margin-top-30" ng-if="!vm.selectedSection.permissions || vm.selectedSection.permissions.association">\n          <md-input-container flex class="no-margin">\n            <label translate="STAFF.REPORT_TYPE">Report Type</label>\n            <md-select name="type" ng-model="vm.selectedSection.reportType" placeholder="{{\'STAFF.PERMISSIONS_SELECT_REPORT_TYPE\' | translate}}" ng-change="vm.onChangeReportType()" required>\n              <md-option ng-value="\'default\'">Default</md-option>\n              <md-option ng-value="\'custom\'">Custom</md-option>\n            </md-select>\n          </md-input-container>\n        </div>\n        <div ng-show="vm.selectedSection && vm.selectedSection.title === \'Dashboards\'" class="user-profile-section-help margin-bottom-10 margin-top-20">\n          <md-icon md-font-icon="icon-help" aria-label="Dashboards help"></md-icon>\n          <span class="no-margin font-size-12 line-height-30" translate="STAFF.HELP.CUSTOM_DASHBOARDS_PERMISSIONS"></span>\n        </div>\n      </div>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" ng-if="!vm.selectedSection.permissions || vm.selectedSection.permissions.association" ng-hide="vm.selectedSection.autoAssociation"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center">\n      <div>\n        <md-icon md-font-icon="icon-information-outline" aria-label="Delete permission"></md-icon>\n        <span class="no-margin font-size-12 line-height-30" translate="STAFF.HELP.SAVE_PERMISSIONS"></span>\n      </div>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveSection()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/userProfiles/edit/view.html",'<div id="staff-userProfile" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-userProfiles-button md-icon-button" aria-label="Go to userProfiles" ng-click="vm.gotoUserProfiles()" translate translate-attr-aria-label="STAFF.GO_TO_USERPROFILES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="userProfile-image" hide-xs>\n          <img ng-src="assets/images/business/userProfiles.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.userProfile.id}}\n            <span ng-if="vm.userProfile.name">{{vm.userProfile.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.userProfile.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.userProfile, $event)" class="md-fab md-amber-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="STAFF.CLONE_USERPROFILE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveUserProfile()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (modulesForm.$invalid) || (download_permissionsForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="userProfile-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.userProfile.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.userProfile.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CRUDPERMISSIONS">CrudPermissions</label>\n                <md-select name="crudPermissions" ng-model="vm.userProfile.crudPermissions" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'r\'" disabled> {{ \'STAFF.READ_PERMISSION\' | translate }} </md-option>\n\n                  <md-option ng-value="\'e\'"> {{ \'STAFF.EDIT_PERMISSION\' | translate }} </md-option>\n\n                  <md-option ng-value="\'d\'"> {{ \'STAFF.DELETE_PERMISSION\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'crudPermissions\'].$error" ng-show="generalForm[\'crudPermissions\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CRUDPERMISSIONS_REQUIRED">CrudPermissions field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.privacyEnabled" aria-label="Mask_Sensitive_Data" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.PERMISSIONS">PERMISSIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="userProfile-detail-form-container modules md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.MODULES">MODULES</div>\n            </div>\n            <div ng-controller="UserProfilePermissionsController as vm_pc" ng-init="vm_pc.init(vm.userProfile, vm.license)" class="userProfile-detail-form-container">\n              <md-grid-list flex md-cols-gt-xs="2" md-cols-gt-sm="2" md-cols-gt-md="4" md-cols-gt-lg="6" md-row-height-gt-xs="2:1" md-row-height-gt-sm="3:1" md-row-height-gt-md="3:1" gt-xs-gutter="4px" gt-sm-gutter="4px" gt-md-gutter="16px" gt-lg-gutter="16px">\n                <md-grid-tile ng-repeat="father in vm_pc.modules" ng-if="vm_pc.userProfile.role !== \'admin\' && !father.permissions.hidden" md-colspan="2">\n                  <md-card flex-xs flex-gt-xs="90" layout="column" no-padding no-margin>\n                    <md-card-header>\n                      <md-card-avatar>\n                        <md-icon class="md-avatar-icon auto-size" md-font-icon="{{father.icon}}" ng-class="{ true: father.status.color }[true]">\n                          <md-tooltip>{{ father.status.info }}</md-tooltip>\n                        </md-icon>\n                      </md-card-avatar>\n                      <md-card-header-text layout-align="center start">\n                        <span class="md-title" translate="{{father.translate}}">{{ father.title }}</span>\n                      </md-card-header-text>\n                      <md-card-actions class="no-margin" layout="row" ng-init="vm_pc.checkSectionResources(father)" ng-if="father.status.tag != \'unlicensed\'">\n                        <md-switch class="auto-height no-margin" ng-model="father.allResourcesEnabled" ng-change="vm_pc.onChangeEnableAllResources(father)" aria-label="Enable all"></md-switch>\n                        <md-button class="md-mini auto-width" aria-label="Manage" ng-click="vm_pc.manageResources(father)" ng-hide="father.permissions && !father.permissions.association">\n                          <md-tooltip>{{\'STAFF.PERMISSIONS_MANAGE\' | translate}}\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-cog"></md-icon>\n                        </md-button>\n                      </md-card-actions>\n                      <md-card-header-text ng-if="father.status.tag === \'unlicensed\'" layout-align="center end">\n                        <span class="md-subhead red-A700-fg">{{ father.status.name }}</span>\n                      </md-card-header-text>\n                    </md-card-header>\n                  </md-card>\n                </md-grid-tile>\n              </md-grid-list>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.DOWNLOADS">DOWNLOADS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="userProfile-detail-form-container download_permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.DOWNLOAD_PERMISSIONS">DOWNLOAD_PERMISSIONS</div>\n            </div>\n            <form name="download_permissionsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadAttachments" aria-label="Attachments" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ATTACHMENTS">Attachments</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadCallySquareRecordings" aria-label="CallySquare_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.CALLYSQUARE_RECORDINGS">CallySquare_Recordings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadContactManagerLists" aria-label="Contact_Manager_Lists" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.CONTACT_MANAGER_LISTS">Contact_Manager_Lists</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadJscriptySessions" aria-label="Jscripty_Sessions" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.JSCRIPTY_SESSIONS">Jscripty_Sessions</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadOmnichannelInteractions" aria-label="Omnichannel_Interactions" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.OMNICHANNEL_INTERACTIONS">Omnichannel_Interactions</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadScreenRecordings" aria-label="Screen_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.SCREEN_RECORDINGS">Screen_Recordings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadVoiceRecordings" aria-label="Voice_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.VOICE_RECORDINGS">Voice_Recordings</span></md-switch>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/staff/views/userProfiles/userProfiles.html",'<div id="userProfiles" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.USERPROFILES">UserProfiles</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedUserProfiles.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedUserProfiles =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-userProfiles-count">\n          <span>{{vm.selectedUserProfiles.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllUserProfiles()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectUserProfiles()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedUserProfiles" csv-label="true" filename="userProfiles.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedUserProfiles($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- USERPROFILE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedUserProfiles" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getUserProfiles">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'STAFF.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'STAFF.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="crudPermissions">{{ \'STAFF.CRUDPERMISSIONS\' | translate }}</th>\n                <th md-column md-order-by="privacyEnabled">{{ \'STAFF.MASK_SENSITIVE_DATA\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.userProfiles.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="userProfile" md-select-id="id" ng-repeat="userProfile in vm.userProfiles.rows">\n                <td md-cell ng-if="userProfile.userpic"><img class="avatar" alt="{{userProfile.name}}" ng-src="api/users/{{userProfile.id}}/avatar" /></td>\n                <td md-cell ng-if="!userProfile.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{userProfile.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="id ">{{userProfile.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="name ">{{userProfile.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="description ">{{userProfile.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="crudPermissions ">{{userProfile.selectedcrudPermissions}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="privacyEnabled ">\n                  <md-icon md-colors="{color: {{userProfile.privacyEnabled ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{userProfile.privacyEnabled ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(userProfile, $event    )" translate="STAFF.EDIT_USERPROFILE">\n                          Edit UserProfile\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(userProfile, $event    )" translate="STAFF.CLONE_USERPROFILE">\n                          clone UserProfile\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' && user.id !== vm.currentUser.id">\n\n                        <md-button ng-click="vm.deleteconfirm(userProfile, $event    )" translate="STAFF.DELETE_USERPROFILE">\n                          Delete UserProfile\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.userProfiles.count}}" md-on-paginate="vm.getUserProfiles" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / USERPROFILE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD USERPROFILE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-userProfile-button" ng-click="vm.createOrEditUserProfile($event)" aria-label="add userProfile" translate translate-attr-aria-label="STAFF.ADD_USERPROFILE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD USERPROFILE BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/users/create/dialog.html",'<md-dialog class="user-dialog" aria-label="New User">\n  <form name="userForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.ROLE">Role</label>\n        <md-select name="role" ng-model="vm.user.role" autofocus required ng-disabled="!vm.newUser">\n          <md-option ng-value="\'admin\'">Admin</md-option>\n          <md-option ng-value="\'user\'">User</md-option>\n        </md-select>\n        <div ng-messages="userForm[\'role\'].$error" ng-show="userForm[\'role\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.ROLE_REQUIRED">Role field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.user.role === \'user\'" class="md-block">\n        <label translate="STAFF.USERPROFILE">UserProfile</label>\n        <md-select name="userProfileId" ng-model="vm.user.userProfileId" required>\n          <md-option ng-value="userProfileId.id" ng-repeat="userProfileId in vm.userProfiles" ng-disabled="userProfileId.canSelect === false">{{ userProfileId.name }}</md-option>\n        </md-select>\n        <div ng-messages="userForm[\'userProfileId\'].$error" ng-show="userForm[\'userProfileId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERPROFILE_REQUIRED">UserProfile field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.FULLNAME">Fullname</label>\n        <input type="text" name="fullname" ng-model="vm.user.fullname" ng-required="true">\n\n        <div ng-messages="userForm[\'fullname\'].$error" ng-show="userForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.USERNAME">Username</label>\n        <input type="text" name="name" ng-model="vm.user.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" ng-disabled="!vm.newUser">\n\n        <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n        <div ng-messages="userForm[\'name\'].$error" ng-show="userForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.user.email" ng-required="true">\n\n        <div ng-messages="userForm[\'email\'].$error" ng-show="userForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newUser">\n        <label translate="STAFF.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.user.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="STAFF.PASSWORD" required>\n        <div ng-messages="userForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newUser  && (vm.newUser)">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="userForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.user.description">\n\n        <div ng-messages="userForm[\'description\'].$error" ng-show="userForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newUser" class="md-block">\n        <md-switch ng-model="vm.user.autointernal" aria-label="AutoInternal"><span translate="STAFF.AUTOINTERNAL">AutoInternal</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.user.autointernal" class="md-block">\n        <label translate="STAFF.INTERNAL">Internal</label>\n        <input type="text" name="internal" ng-model="vm.user.internal" ng-required="true" ng-disabled="!vm.newUser">\n\n        <div ng-messages="userForm[\'internal\'].$error" ng-show="userForm[\'internal\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.user.userSetting">\n        <ms-client-side-logging user="vm.user"></ms-client-side-logging>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newUser" ng-click="vm.saveUser()" class="send-button md-accent md-raised" ng-disabled="userForm.$invalid || userForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newUser" ng-click="vm.addNewUser()" class="send-button md-accent md-raised" ng-disabled="userForm.$invalid" aria-label="ADD" translate="STAFF.ADD_USER" translate-attr-aria-label="STAFF.ADD_USER">\n          ADD USER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newUser" ng-click="vm.deleteUser($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/users/edit/apikeymanager/apikeymanager.html",'<md-dialog class="user-dialog" aria-label="{{vm.name}}">\n  <form name="userForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.MANAGE_API_KEY\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-card layout-fill layout-padding>\n      <textarea class="api-key-area" ng-model="vm.user.apiKey" rows="6" disabled></textarea>\n    </md-card>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.generateApiKey()" class="send-button md-accent md-raised" aria-label="Generate" translate="{{ vm.user.apiKey === \'N/A\' ? \'STAFF.GENERATE\' : \'STAFF.REGENERATE\' }}" translate-attr-aria-label="STAFF.GENERATE">\n          Generate\n        </md-button>\n        <md-button type="submit" ng-click="vm.removeApiKey()" class="send-button md-accent md-raised" aria-label="Remove" translate="STAFF.REMOVE" translate-attr-aria-label="STAFF.DELETE">\n          Delete\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/users/edit/changepassword/changepassword.html",'<md-dialog class="user-dialog" aria-label="{{vm.name}}">\n  <form name="userForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.CHANGE_PASSWORD\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.user.id">\n        <label translate="STAFF.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="STAFF.OLD_PASSWORD" required>\n        <div ng-messages="userForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" translate ng-pattern="vm.passwordPattern" translate-attr-placeholder="STAFF.NEW_PASSWORD" required>\n        <div ng-messages="userForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is\n              required</span>\n          </div>\n\n\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain\n              at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric\n              character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="STAFF.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n\n\n\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="userForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is\n              required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did\n              not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="userForm.$invalid || userForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/users/edit/view.html",'<div id="staff-user" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-users-button md-icon-button" aria-label="Go to users" ng-click="vm.gotoUsers()" translate translate-attr-aria-label="STAFF.GO_TO_USERS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="user-image" hide-xs>\n          <img ng-src="assets/images/business/users.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.user.id}}\n            <span ng-if="vm.user.name">{{vm.user.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.user.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.apikeymanagerdialog(vm.user, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="apikeymanager">\n        <md-tooltip><span translate="STAFF.APIKEYMANAGER_USER"></span></md-tooltip>\n        <md-icon md-font-icon="fab fa-hubspot"></md-icon>\n      </md-button>\n    </div>\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.changepassworddialog(vm.user, $event)" class="md-fab md-warn md-icon-button" aria-label="changepassword">\n        <md-tooltip><span translate="STAFF.CHANGEPASSWORD_USER"></span></md-tooltip>\n        <md-icon md-font-icon="icon-key-variant"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveUser()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(personal_infoForm.$invalid) || (security_suiteForm.$invalid) || (change_avatarForm.$invalid) || (generalForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="user-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.PERSONAL_INFO">PERSONAL_INFO</div>\n            </div>\n            <form name="personal_infoForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ROLE">Role</label>\n                <md-select name="role" ng-model="vm.user.role" autofocus required disabled>\n                  <md-option ng-value="\'admin\'">Admin</md-option>\n                  <md-option ng-value="\'user\'">User</md-option>\n                </md-select>\n                <div ng-messages="personal_infoForm[\'role\'].$error" ng-show="personal_infoForm[\'role\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ROLE_REQUIRED">Role field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.role === \'user\'" class="md-block">\n                <label translate="STAFF.USERPROFILE">UserProfile</label>\n                <md-select name="userProfileId" ng-model="vm.user.userProfileId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="userProfileId.id" ng-repeat="userProfileId in vm.userProfiles" ng-disabled="userProfileId.canSelect === false">{{ userProfileId.name }}</md-option>\n                </md-select>\n                <div ng-messages="personal_infoForm[\'userProfileId\'].$error" ng-show="personal_infoForm[\'userProfileId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERPROFILE_REQUIRED">UserProfile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.FULLNAME">Fullname</label>\n                <input type="text" name="fullname" ng-model="vm.user.fullname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'fullname\'].$error" ng-show="personal_infoForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.USERNAME">Username</label>\n                <input type="text" name="name" ng-model="vm.user.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" disabled>\n                <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n                <div ng-messages="personal_infoForm[\'name\'].$error" ng-show="personal_infoForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.user.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'email\'].$error" ng-show="personal_infoForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.user.phone" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'phone\'].$error" ng-show="personal_infoForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MOBILE">Mobile</label>\n                <input type="text" name="mobile" ng-model="vm.user.mobile" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'mobile\'].$error" ng-show="personal_infoForm[\'mobile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MOBILE_REQUIRED">Mobile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.user.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'description\'].$error" ng-show="personal_infoForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="user-detail-form-container security_suite md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SECURITY_SUITE">SECURITY_SUITE</div>\n            </div>\n            <form name="security_suiteForm" novalidate>\n              <md-input-container ng-if="vm.user.passwordResetAt != null" class="md-block">\n                <label translate="STAFF.LAST_PASSWORD_RESET_AT">Last_Password_Reset_At</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.user.passwordResetAt" autofocus disabled>\n                <div class="hint"><span translate="STAFF.HELP.LAST_PASSWORD_RESET_AT"></span></div>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.LAST_PASSWORD_RESET_AT_REQUIRED">Last_Password_Reset_At field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.passwordResetAt == null" class="md-block">\n                <label translate="STAFF.NO_PASSWORD_CHANGE">No_Password_Change</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.user.passwordResetAt" disabled>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NO_PASSWORD_CHANGE_REQUIRED">No_Password_Change field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.APIKEY">ApiKey</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-apiKey" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: \'API Key copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-apiKey" name="apiKey" ng-model="vm.user.apiKey" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="STAFF.HELP.APIKEY"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.id != vm.currentUser.id && vm.currentUser.role == \'admin\'" class="md-block">\n                <md-switch ng-model="vm.user.disabled" aria-label="Disabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DISABLED">Disabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.DISABLED"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.id != vm.currentUser.id && vm.currentUser.role == \'admin\' && vm.user.disabled == 0" class="md-block">\n                <md-switch ng-model="vm.user.blocked" aria-label="Blocked" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.BLOCKED">Blocked</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.BLOCKED"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="user-detail-form-container authentication md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.AUTHENTICATION">AUTHENTICATION</div>\n            </div>\n            <form name="authenticationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.user.adSsoEnabled" aria-label="AD_SSO_Enabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AD_SSO_ENABLED">AD_SSO_Enabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.AD_SSO_ENABLED"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="user-detail-form-container change_avatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CHANGE_AVATAR">CHANGE_AVATAR</div>\n            </div>\n            <div ng-controller="Userchange_avatarController as vm_ca" ng-init="vm_ca.init(vm.user, vm.crudPermissions)" class="user-detail-form-container md-background-bg md-whiteframe-1dp">\n              <div id="user-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="change_avatarimage in vm_ca.user.images" ng-switch="change_avatarimage.type">\n                    <div class="user-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{change_avatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="change_avatarimage.file">\n                    </div>\n                    <div class="user-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{change_avatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.VOICE">VOICE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="user-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container ng-if="!vm.user.autointernal" class="md-block">\n                <label translate="STAFF.INTERNAL">Internal</label>\n                <input type="text" name="internal" ng-model="vm.user.internal" ng-required="true" autofocus disabled>\n                <div ng-messages="generalForm[\'internal\'].$error" ng-show="generalForm[\'internal\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.user.transport" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'">ws</md-option>\n                  <md-option ng-value="\'wss\'">wss</md-option>\n                  <md-option ng-value="\'tls\'">tls</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'transport\'].$error" ng-show="generalForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAT">NAT</label>\n                <md-select name="nat" ng-model="vm.user.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAT_REQUIRED">NAT field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.user.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.user.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLGROUP">Callgroup</label>\n                <input type="text" name="callgroup" ng-model="vm.user.callgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.CALLGROUP"></span></div>\n                <div ng-messages="generalForm[\'callgroup\'].$error" ng-show="generalForm[\'callgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLGROUP_REQUIRED">Callgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PICKUPGROUP">Pickupgroup</label>\n                <input type="text" name="pickupgroup" ng-model="vm.user.pickupgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.PICKUPGROUP"></span></div>\n                <div ng-messages="generalForm[\'pickupgroup\'].$error" ng-show="generalForm[\'pickupgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PICKUPGROUP_REQUIRED">Pickupgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.user.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'videosupport\'].$error" ng-show="generalForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.CLIENT_LOGS">CLIENT-SIDE LOGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="user-detail-form-container client_logs md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CLIENT_LOGS">\n                CLIENT-SIDE LOGS\n              </div>\n            </div>\n            <ms-client-side-logging user="vm.user" on-user-update="vm.refreshUser()"></ms-client-side-logging>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/staff/views/users/users.html",'<div id="users" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.USERS">Users</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedUsers.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedUsers =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-users-count">\n          <span>{{vm.selectedUsers.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllUsers()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectUsers()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedUsers" csv-label="true" filename="users.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- USER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedUsers" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getUsers">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="role">{{ \'STAFF.ROLE\' | translate }}</th>\n                <th md-column md-order-by="userProfileId">{{ \'STAFF.USERPROFILE\' | translate }}</th>\n                <th md-column md-order-by="fullname">{{ \'STAFF.FULLNAME\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'STAFF.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'STAFF.PHONE\' | translate }}</th>\n                <th md-column md-order-by="mobile">{{ \'STAFF.MOBILE\' | translate }}</th>\n                <th md-column md-order-by="internal">{{ \'STAFF.INTERNAL\' | translate }}</th>\n                <th md-column md-order-by="disabled">{{ \'STAFF.DISABLED\' | translate }}</th>\n                <th md-column md-order-by="blocked">{{ \'STAFF.BLOCKED\' | translate }}</th>\n                <th md-column>{{ \'STAFF.CLIENT_LOGS\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.users.rows.length">\n                <td md-cell colspan="11">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="user" md-select-id="id" ng-repeat="user in vm.users.rows">\n                <td md-cell ng-if="user.userpic"><img class="avatar" alt="{{user.name}}" ng-src="api/users/{{user.id}}/avatar" /></td>\n                <td md-cell ng-if="!user.userpic"><img class="avatar" alt="{{user.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="role ">{{ vm.arrayrole[user.role].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="userProfileId font-weight-600">{{ (vm.userProfiles | filter : {\'id\':user.userProfileId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="fullname font-weight-600">{{user.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="name ">{{user.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="email ">{{user.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="phone ">{{user.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="mobile ">{{user.mobile}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="internal ">{{user.internal}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="disabled ">\n                  <md-icon md-colors="{color: {{user.disabled ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{user.disabled ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="blocked ">\n                  <md-icon md-colors="{color: {{user.blocked ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{user.blocked ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditAgent($event, user)" md-cell class="client-side-logging">\n                  <ms-client-side-logging-icon user="user"></ms-client-side-logging-icon>\n                </td>\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(user, $event    )" translate="STAFF.EDIT_USER">\n                          Edit User\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' && user.id !== vm.currentUser.id">\n                        <md-button ng-click="vm.deleteconfirm(user, $event    )" translate="STAFF.DELETE_USER">\n                          Delete User\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.users.count}}" md-on-paginate="vm.getUsers" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / USER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD USER BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-user-button" ng-click="vm.createOrEditUser($event)" aria-label="add user" translate translate-attr-aria-label="STAFF.ADD_USER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD USER BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/cannedAnswers/cannedAnswers.html",'<div id="cannedAnswers" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.CANNEDANSWERS">CannedAnswers</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedCannedAnswers.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedCannedAnswers =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-cannedAnswers-count">\n          <span>{{vm.selectedCannedAnswers.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllCannedAnswers()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectCannedAnswers()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedCannedAnswers" csv-label="true" filename="cannedAnswers.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CANNEDANSWER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedCannedAnswers" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCannedAnswers">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'TOOLS.KEY\' | translate }}</th>\n                <th md-column md-order-by="value">{{ \'TOOLS.VALUE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.cannedAnswers.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="cannedAnswer" md-select-id="id" ng-repeat="cannedAnswer in vm.cannedAnswers.rows">\n                <td md-cell ng-if="cannedAnswer.userpic"><img class="avatar" alt="{{cannedAnswer.name}}" ng-src="api/users/{{cannedAnswer.id}}/avatar" /></td>\n                <td md-cell ng-if="!cannedAnswer.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{cannedAnswer.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="id ">{{cannedAnswer.id}}</td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="key ">{{cannedAnswer.key}}</td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="value ">{{cannedAnswer.value}}</td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="description ">{{cannedAnswer.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(cannedAnswer, $event    )" translate="TOOLS.EDIT_CANNEDANSWER">\n                          Edit CannedAnswer\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(cannedAnswer, $event    )" translate="TOOLS.DELETE_CANNEDANSWER">\n                          Delete CannedAnswer\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.cannedAnswers.count}}" md-on-paginate="vm.getCannedAnswers" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CANNEDANSWER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CANNEDANSWER BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-cannedAnswer-button" ng-click="vm.createOrEditCannedAnswer($event)" aria-label="add cannedAnswer" translate translate-attr-aria-label="TOOLS.ADD_CANNEDANSWER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CANNEDANSWER BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/cannedAnswers/create/dialog.html",'<md-dialog class="cannedAnswer-dialog" aria-label="New CannedAnswer">\n  <form name="cannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.cannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="cannedAnswerForm[\'key\'].$error" ng-show="cannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 255}\'>Key must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.cannedAnswer.value" required></textarea>\n\n        <div ng-messages="cannedAnswerForm[\'value\'].$error" ng-show="cannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.cannedAnswer.description">\n\n        <div ng-messages="cannedAnswerForm[\'description\'].$error" ng-show="cannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCannedAnswer" ng-click="vm.saveCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="cannedAnswerForm.$invalid || cannedAnswerForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCannedAnswer" ng-click="vm.addNewCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="cannedAnswerForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_CANNEDANSWER" translate-attr-aria-label="TOOLS.ADD_CANNEDANSWER">\n          ADD CANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCannedAnswer" ng-click="vm.deleteCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/contact_item_types/contact_item_types.html",'<div id="contact_item_types" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.CONTACTITEMTYPE">ContactItemType</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedContactItemType.length > 0" class="selected-bar header animate-slide-down md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedContactItemType =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-contact_item_types-count">\n          <span>{{vm.selectedContactItemType.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllContactItemType()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectContactItemType()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedContactItemType" csv-label="true" filename="contact_item_types.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedContactItemType($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable" ms-scroll>\n\n\n      \x3c!-- CONTACTITEMTYPE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedContactItemType" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContactItemType">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="OrderBy">{{ \'TOOLS.ORDER_BY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.contact_item_types.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="contactItemType" md-select-id="id" ng-repeat="contactItemType in vm.contact_item_types.rows">\n                <td md-cell ng-if="contactItemType.userpic"><img class="avatar" alt="{{contactItemType.name}}" ng-src="api/users/{{contactItemType.id}}/avatar" /></td>\n                <td md-cell ng-if="!contactItemType.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{contactItemType.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditContactItemType($event, contactItemType)" md-cell class="id ">{{contactItemType.id}}</td>\n                <td ng-click="vm.createOrEditContactItemType($event, contactItemType)" md-cell class="name ">{{contactItemType.name}}</td>\n                <td ng-click="vm.createOrEditContactItemType($event, contactItemType)" md-cell class="OrderBy ">{{contactItemType.OrderBy}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(contactItemType, $event    )" translate="TOOLS.EDIT_CONTACTITEMTYPE">\n                          Edit ContactItemType\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(contactItemType, $event    )" translate="TOOLS.DELETE_CONTACTITEMTYPE">\n                          Delete ContactItemType\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contact_item_types.count}}" md-on-paginate="vm.getContactItemType" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CONTACTITEMTYPE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CONTACTITEMTYPE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-contactItemType-button" ng-click="vm.createOrEditContactItemType($event)" aria-label="add contactItemType" translate translate-attr-aria-label="TOOLS.ADD_CONTACTITEMTYPE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CONTACTITEMTYPE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/contact_item_types/create/dialog.html",'<md-dialog class="contactItemType-dialog" aria-label="New ContactItemType">\n  <form name="contactItemTypeForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content ms-scroll>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.contactItemType.name" ng-required="true" autofocus>\n\n        <div ng-messages="contactItemTypeForm[\'name\'].$error" ng-show="contactItemTypeForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.ORDER_BY">Order_by</label>\n        <input type="integer" name="OrderBy" ng-model="vm.contactItemType.OrderBy" ng-required="true">\n\n        <div ng-messages="contactItemTypeForm[\'OrderBy\'].$error" ng-show="contactItemTypeForm[\'OrderBy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ORDER_BY_REQUIRED">Order_by field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div flex md-color-picker ng-model="vm.contactItemType.rgbBackgroundColor" label="{{\'TOOLS.RGBBACKGROUNDCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newContactItemType" ng-click="vm.saveContactItemType()" class="send-button md-accent md-raised" ng-disabled="contactItemTypeForm.$invalid || contactItemTypeForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newContactItemType" ng-click="vm.addNewContactItemType()" class="send-button md-accent md-raised" ng-disabled="contactItemTypeForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_CONTACTITEMTYPE" translate-attr-aria-label="TOOLS.ADD_CONTACTITEMTYPE">\n          ADD CONTACTITEMTYPE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newContactItemType" ng-click="vm.deleteContactItemType($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/create/dialog.html",'<md-dialog class="customDashboard-dialog" aria-label="New CustomDashboard">\n  <form name="customDashboardForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.customDashboard.name" ng-required="true" autofocus>\n\n        <div ng-messages="customDashboardForm[\'name\'].$error" ng-show="customDashboardForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.customDashboard.description">\n\n        <div ng-messages="customDashboardForm[\'description\'].$error" ng-show="customDashboardForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCustomDashboard" ng-click="vm.saveCustomDashboard()" class="send-button md-accent md-raised" ng-disabled="customDashboardForm.$invalid || customDashboardForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCustomDashboard" ng-click="vm.addNewCustomDashboard()" class="send-button md-accent md-raised" ng-disabled="customDashboardForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_CUSTOMDASHBOARD" translate-attr-aria-label="TOOLS.ADD_CUSTOMDASHBOARD">\n          ADD CUSTOMDASHBOARD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCustomDashboard" ng-click="vm.deleteCustomDashboard($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/customDashboards.html",'<div id="customDashboards" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.CUSTOMDASHBOARDS">CustomDashboards</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedCustomDashboards.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedCustomDashboards =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-customDashboards-count">\n          <span>{{vm.selectedCustomDashboards.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllCustomDashboards()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectCustomDashboards()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedCustomDashboards" csv-label="true" filename="customDashboards.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedCustomDashboards($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CUSTOMDASHBOARD TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedCustomDashboards" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCustomDashboards">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.customDashboards.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="customDashboard" md-select-id="id" ng-repeat="customDashboard in vm.customDashboards.rows">\n                <td md-cell ng-if="customDashboard.userpic"><img class="avatar" alt="{{customDashboard.name}}" ng-src="api/users/{{customDashboard.id}}/avatar" /></td>\n                <td md-cell ng-if="!customDashboard.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{customDashboard.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(customDashboard, ev) : vm.createOrEditCustomDashboard($event, customDashboard)" md-cell class="id ">{{customDashboard.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(customDashboard, ev) : vm.createOrEditCustomDashboard($event, customDashboard)" md-cell class="name ">{{customDashboard.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(customDashboard, ev) : vm.createOrEditCustomDashboard($event, customDashboard)" md-cell class="description ">{{customDashboard.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(customDashboard, $event    )" translate="TOOLS.EDIT_CUSTOMDASHBOARD">\n                          Edit CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(customDashboard, $event    )" translate="TOOLS.CLONE_CUSTOMDASHBOARD">\n                          clone CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotodashboardgoto(customDashboard, $event    )" translate="TOOLS.GOTODASHBOARD_CUSTOMDASHBOARD">\n                          goToDashboard CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(customDashboard, $event    )" translate="TOOLS.DELETE_CUSTOMDASHBOARD">\n                          Delete CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.customDashboards.count}}" md-on-paginate="vm.getCustomDashboards" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CUSTOMDASHBOARD TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CUSTOMDASHBOARD BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-customDashboard-button" ng-click="vm.createOrEditCustomDashboard($event)" aria-label="add customDashboard" translate translate-attr-aria-label="TOOLS.ADD_CUSTOMDASHBOARD">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CUSTOMDASHBOARD BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/customDashboards/edit/clone/clone.html",'<md-dialog class="customDashboard-dialog" aria-label="Clone CustomDashboard">\n  <form name="customDashboardForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.customDashboard.name" ng-required="true" autofocus>\n\n        <div ng-messages="customDashboardForm[\'name\'].$error" ng-show="customDashboardForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneCustomDashboard()" class="send-button md-accent md-raised" ng-disabled="customDashboardForm.$invalid" aria-label="CLONE" translate="TOOLS.CLONE_CUSTOMDASHBOARD" translate-attr-aria-label="TOOLS.CLONE_CUSTOMDASHBOARD">\n        CLONE CUSTOMDASHBOARD\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/edit/dashboard/dialog.html",'<md-dialog class="dashboarditem-dialog" aria-label="New DashboardItem">\n  <form name="dashboarditemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.dashboarditem.type" ng-change="vm.onTypeChange()" autofocus ng-disabled="!vm.newDashboardItem">\n\n          <md-option ng-value="\'counter\'"> {{ \'TOOLS.COUNTER\' | translate }} </md-option>\n\n          <md-option ng-value="\'multibar-chart\'"> {{ \'TOOLS.MULTIBARCHART\' | translate }} </md-option>\n\n          <md-option ng-value="\'pie-chart\'"> {{ \'TOOLS.PIECHART\' | translate }} </md-option>\n\n          <md-option ng-value="\'web-report\'"> {{ \'TOOLS.WEBREPORT\' | translate }} </md-option>\n\n          <md-option ng-value="\'iframe\'"> {{ \'TOOLS.IFRAME\' | translate }} </md-option>\n\n          <md-option ng-value="\'clock\'"> {{ \'TOOLS.CLOCK\' | translate }} </md-option>\n\n          <md-option ng-value="\'custom\'"> {{ \'TOOLS.CUSTOMTYPE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'type\'].$error" ng-show="dashboarditemForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\',\'counter\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.CHANNEL">Channel</label>\n        <md-select name="attrChannel" ng-model="vm.dashboarditem.attrChannel" required>\n\n          <md-option ng-value="\'chat\'"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n\n          <md-option ng-value="\'mail\'"> {{ \'TOOLS.EMAIL\' | translate }} </md-option>\n\n          <md-option ng-value="\'sms\'"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n\n          <md-option ng-value="\'openchannel\'"> {{ \'TOOLS.OPENCHANNEL\' | translate }} </md-option>\n\n          <md-option ng-value="\'fax\'"> {{ \'TOOLS.FAX\' | translate }} </md-option>\n\n          <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n\n          <md-option ng-value="\'whatsapp\'"> {{ \'TOOLS.WHATSAPP\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrChannel\'].$error" ng-show="dashboarditemForm[\'attrChannel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="![\'web-report\', \'iframe\',\'clock\', \'custom\'].includes(vm.dashboarditem.type)">\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'mail\'" class="md-block">\n          <label translate="TOOLS.FILTEREMAILACCOUNTS">FilterEmailAccounts</label>\n          <md-select name="attrEmailAccounts" ng-model="vm.dashboarditem.attrEmailAccounts" multiple>\n            <md-option ng-value="attrEmailAccounts.id" ng-repeat="attrEmailAccounts in vm.mailAccount" ng-disabled="attrEmailAccounts.canSelect === false">{{ attrEmailAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrEmailAccounts\'].$error" ng-show="dashboarditemForm[\'attrEmailAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTEREMAILACCOUNTS_REQUIRED">FilterEmailAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'fax\'" class="md-block">\n          <label translate="TOOLS.FILTERFAXACCOUNTS">FilterFaxAccounts</label>\n          <md-select name="attrFaxAccounts" ng-model="vm.dashboarditem.attrFaxAccounts" multiple>\n            <md-option ng-value="attrFaxAccounts.id" ng-repeat="attrFaxAccounts in vm.faxAccount" ng-disabled="attrFaxAccounts.canSelect === false">{{ attrFaxAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrFaxAccounts\'].$error" ng-show="dashboarditemForm[\'attrFaxAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERFAXACCOUNTS_REQUIRED">FilterFaxAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'sms\'" class="md-block">\n          <label translate="TOOLS.FILTERSMSACCOUNTS">FilterSmsAccounts</label>\n          <md-select name="attrSmsAccounts" ng-model="vm.dashboarditem.attrSmsAccounts" multiple>\n            <md-option ng-value="attrSmsAccounts.id" ng-repeat="attrSmsAccounts in vm.smsAccount" ng-disabled="attrSmsAccounts.canSelect === false">{{ attrSmsAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrSmsAccounts\'].$error" ng-show="dashboarditemForm[\'attrSmsAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERSMSACCOUNTS_REQUIRED">FilterSmsAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'openchannel\'" class="md-block">\n          <label translate="TOOLS.FILTEROPENCHANNELACCOUNTS">FilterOpenchannelAccounts</label>\n          <md-select name="attrOpenchannelAccounts" ng-model="vm.dashboarditem.attrOpenchannelAccounts" multiple>\n            <md-option ng-value="attrOpenchannelAccounts.id" ng-repeat="attrOpenchannelAccounts in vm.openchannelAccount" ng-disabled="attrOpenchannelAccounts.canSelect === false">{{ attrOpenchannelAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrOpenchannelAccounts\'].$error" ng-show="dashboarditemForm[\'attrOpenchannelAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTEROPENCHANNELACCOUNTS_REQUIRED">FilterOpenchannelAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'whatsapp\'" class="md-block">\n          <label translate="TOOLS.FILTERWHATSAPPACCOUNTS">FilterWhatsappAccounts</label>\n          <md-select name="attrWhatsappAccounts" ng-model="vm.dashboarditem.attrWhatsappAccounts" multiple>\n            <md-option ng-value="attrWhatsappAccounts.id" ng-repeat="attrWhatsappAccounts in vm.whatsappAccount" ng-disabled="attrWhatsappAccounts.canSelect === false">{{ attrWhatsappAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrWhatsappAccounts\'].$error" ng-show="dashboarditemForm[\'attrWhatsappAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERWHATSAPPACCOUNTS_REQUIRED">FilterWhatsappAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'chat\'" class="md-block">\n          <label translate="TOOLS.FILTERCHATWEBSITES">FilterChatWebsites</label>\n          <md-select name="attrChatWebsites" ng-model="vm.dashboarditem.attrChatWebsites" multiple>\n            <md-option ng-value="attrChatWebsites.id" ng-repeat="attrChatWebsites in vm.chatWebsite" ng-disabled="attrChatWebsites.canSelect === false">{{ attrChatWebsites.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrChatWebsites\'].$error" ng-show="dashboarditemForm[\'attrChatWebsites\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERCHATWEBSITES_REQUIRED">FilterChatWebsites field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\', \'counter\'].includes(vm.dashboarditem.type) && vm.dashboarditem.attrChannel === \'voice\'" class="md-block">\n        <label translate="TOOLS.FILTERVOICEQUEUES">FilterVoiceQueues</label>\n        <md-select name="attrVoiceQueues" ng-model="vm.dashboarditem.attrVoiceQueues" multiple>\n          <md-option ng-value="attrVoiceQueues.id" ng-repeat="attrVoiceQueues in vm.voiceQueues" ng-disabled="attrVoiceQueues.canSelect === false">{{ attrVoiceQueues.name }}</md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrVoiceQueues\'].$error" ng-show="dashboarditemForm[\'attrVoiceQueues\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FILTERVOICEQUEUES_REQUIRED">FilterVoiceQueues field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TITLE">Title</label>\n        <input type="text" name="title" ng-model="vm.dashboarditem.title" md-maxlength="255" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'title\'].$error" ng-show="dashboarditemForm[\'title\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TITLE_REQUIRED">Title field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.TITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>Title must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TITLEFONTSIZE">TitleFontSize</label>\n        <input type="number" name="titleFontSize" ng-model="vm.dashboarditem.titleFontSize" value="12">\n\n        <div ng-messages="dashboarditemForm[\'titleFontSize\'].$error" ng-show="dashboarditemForm[\'titleFontSize\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TITLEFONTSIZE_REQUIRED">TitleFontSize field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'iframe\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="attrUrl" ng-model="vm.dashboarditem.attrUrl" value="https://" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrUrl\'].$error" ng-show="dashboarditemForm[\'attrUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'custom\'" class="md-block">\n        <label translate="TOOLS.PATH">Path</label>\n        <input type="text" name="attrPath" ng-model="vm.dashboarditem.attrPath" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrPath\'].$error" ng-show="dashboarditemForm[\'attrPath\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.PATH_REQUIRED">Path field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'clock\'" class="md-block">\n        <label translate="TOOLS.FORMAT">Format</label>\n        <input type="text" name="attrHourFormat" ng-model="vm.dashboarditem.attrHourFormat" value="HH:mm:ss" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrHourFormat\'].$error" ng-show="dashboarditemForm[\'attrHourFormat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FORMAT_REQUIRED">Format field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'clock\'" class="md-block">\n        <label translate="TOOLS.TIMEZONE">Timezone</label>\n        <md-select name="attrTimezone" ng-model="vm.dashboarditem.attrTimezone" required>\n          <md-option ng-value="\'-12.00\'">GMT-12.00</md-option>\n          <md-option ng-value="\'-11.00\'">GMT-11.00</md-option>\n          <md-option ng-value="\'-10.00\'">GMT-10.00</md-option>\n          <md-option ng-value="\'-9.00\'">GMT-9.00</md-option>\n          <md-option ng-value="\'-8.00\'">GMT-8.00</md-option>\n          <md-option ng-value="\'-7.00\'">GMT-7.00</md-option>\n          <md-option ng-value="\'-6.00\'">GMT-6.00</md-option>\n          <md-option ng-value="\'-5.00\'">GMT-5.00</md-option>\n          <md-option ng-value="\'-4.00\'">GMT-4.00</md-option>\n          <md-option ng-value="\'-3.30\'">GMT-3.30</md-option>\n          <md-option ng-value="\'-3.00\'">GMT-3.00</md-option>\n          <md-option ng-value="\'-2.00\'">GMT-2.00</md-option>\n          <md-option ng-value="\'-1.00\'">GMT-1.00</md-option>\n          <md-option ng-value="\'0.00\'">GMT 0.00</md-option>\n          <md-option ng-value="\'1.00\'">GMT+1.00</md-option>\n          <md-option ng-value="\'2.00\'">GMT+2.00</md-option>\n          <md-option ng-value="\'3.00\'">GMT+3.00</md-option>\n          <md-option ng-value="\'3.30\'">GMT+3.30</md-option>\n          <md-option ng-value="\'4.00\'">GMT+4.00</md-option>\n          <md-option ng-value="\'4.30\'">GMT+4.30</md-option>\n          <md-option ng-value="\'5.00\'">GMT+5.00</md-option>\n          <md-option ng-value="\'5.30\'">GMT+5.30</md-option>\n          <md-option ng-value="\'5.45\'">GMT+5.45</md-option>\n          <md-option ng-value="\'6.00\'">GMT+6.00</md-option>\n          <md-option ng-value="\'6.30\'">GMT+6.30</md-option>\n          <md-option ng-value="\'7.00\'">GMT+7.00</md-option>\n          <md-option ng-value="\'8.00\'">GMT+8.00</md-option>\n          <md-option ng-value="\'9.00\'">GMT+9.00</md-option>\n          <md-option ng-value="\'9.30\'">GMT+9.30</md-option>\n          <md-option ng-value="\'10.00\'">GMT+10.00</md-option>\n          <md-option ng-value="\'11.00\'">GMT+11.00</md-option>\n          <md-option ng-value="\'12.00\'">GMT+12.00</md-option>\n          <md-option ng-value="\'13.00\'">GMT+13.00</md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrTimezone\'].$error" ng-show="dashboarditemForm[\'attrTimezone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type === \'counter\'" class="md-block">\n        <label translate="TOOLS.METRIC">Metric</label>\n        <md-select name="attrMetric" ng-model="vm.dashboarditem.attrMetric" required>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrMetric\'].$error" ng-show="dashboarditemForm[\'attrMetric\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.METRIC_REQUIRED">Metric field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.SERIE1">Serie1</label>\n        <md-select name="attrSerie1" ng-model="vm.dashboarditem.attrSerie1" required>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrSerie1\'].$error" ng-show="dashboarditemForm[\'attrSerie1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SERIE1_REQUIRED">Serie1 field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.SERIE2">Serie2</label>\n        <md-select name="attrSerie2" ng-model="vm.dashboarditem.attrSerie2">\n\n          <md-option ng-value="\'null\'"> {{ \'TOOLS.NONE\' | translate }} </md-option>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrSerie2\'].$error" ng-show="dashboarditemForm[\'attrSerie2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SERIE2_REQUIRED">Serie2 field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.SERIE3">Serie3</label>\n        <md-select name="attrSerie3" ng-model="vm.dashboarditem.attrSerie3">\n\n          <md-option ng-value="\'null\'"> {{ \'TOOLS.NONE\' | translate }} </md-option>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrSerie3\'].$error" ng-show="dashboarditemForm[\'attrSerie3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SERIE3_REQUIRED">Serie3 field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'web-report\'" class="md-block">\n        <label translate="TOOLS.REPORT">Report</label>\n        <input type="search" name="report" ng-model="vm.dashboarditem.report" ng-required="true" autocomplete="off" ng-click="vm.searchReport()">\n        <md-icon md-font-icon="icon-magnify" ng-click="vm.searchReport()" aria-label="Search Report"></md-icon>\n        <div ng-messages="dashboarditemForm[\'report\'].$error" ng-show="dashboarditemForm[\'report\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REPORT_REQUIRED">Report field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'web-report\'" class="md-block">\n        <label translate="TOOLS.REFRESH">Refresh</label>\n        <input type="number" name="attrRefresh" ng-model="vm.dashboarditem.attrRefresh" min="5" value="10" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrRefresh\'].$error" ng-show="dashboarditemForm[\'attrRefresh\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REFRESH_REQUIRED">Refresh field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="TOOLS.ERRORS.REFRESH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Refresh must be a valid greater or equal than</span> <span>5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'counter\', \'clock\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.FONTSIZE">FontSize</label>\n        <input type="number" name="attrFontSize" ng-model="vm.dashboarditem.attrFontSize" min="12" max="40" value="20" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrFontSize\'].$error" ng-show="dashboarditemForm[\'attrFontSize\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FONTSIZE_REQUIRED">FontSize field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="TOOLS.ERRORS.FONTSIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">FontSize must be a valid greater or equal than</span> <span>12</span>\n          </div>\n          <div ng-message="max">\n            <span translate="TOOLS.ERRORS.FONTSIZE_MUST_BE_LESS_THAN_OR_EQUAL_TO">FontSize must be a valid greater or equal than</span> <span>40</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div flex md-color-picker ng-model="vm.dashboarditem.foreground" label="{{\'TOOLS.FOREGROUND\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n      <div flex md-color-picker ng-model="vm.dashboarditem.background" label="{{\'TOOLS.BACKGROUND\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.LINK">link</label>\n        <input type="url" name="link" ng-model="vm.dashboarditem.link">\n\n        <div ng-messages="dashboarditemForm[\'link\'].$error" ng-show="dashboarditemForm[\'link\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LINK_REQUIRED">link field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.LINK_MUST_VALID_URL">link must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDashboardItem" ng-click="vm.saveDashboardItem()" class="send-button md-accent md-raised" ng-disabled="dashboarditemForm.$invalid || dashboarditemForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDashboardItem" ng-click="vm.addNewDashboardItem()" class="send-button md-accent md-raised" ng-disabled="dashboarditemForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_DASHBOARDITEM" translate-attr-aria-label="TOOLS.ADD_DASHBOARDITEM">\n          ADD DASHBOARDITEM\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDashboardItem" ng-click="vm.deleteDashboardItem($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/edit/view.html",'<div id="tools-customDashboard" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-customDashboards-button md-icon-button" aria-label="Go to customDashboards" ng-click="vm.gotoCustomDashboards()" translate translate-attr-aria-label="TOOLS.GO_TO_CUSTOMDASHBOARDS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="customDashboard-image" hide-xs>\n          <img ng-src="assets/images/business/customDashboards.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.customDashboard.id}}\n            <span ng-if="vm.customDashboard.name">{{vm.customDashboard.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{vm.customDashboard.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.customDashboard, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="TOOLS.CLONE_CUSTOMDASHBOARD"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.customDashboard, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="TOOLS.GOTO_CUSTOMDASHBOARD"></span></md-tooltip>\n        <md-icon md-font-icon="icon-forward"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveCustomDashboard()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (dashboardForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="customDashboard-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.customDashboard.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.customDashboard.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.DASHBOARD">DASHBOARD</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="customDashboard-detail-form-container dashboard md-background-bg md-whiteframe-1dp">\n            <div ng-controller="CustomDashboardItemsController as vm_cd" ng-init="vm_cd.init(vm.customDashboard, vm.crudPermissions)" class="customDashboard-detail-form-container no-padding no-margin" layout="column">\n              <div ng-if="vm_cd.customDashboard.widgets.length">\n                <md-button class="md-fab md-mini md-accent" ng-click="vm_cd.createOrEditWidget()" ng-if="vm_cd.crudPermissions.canEdit" aria-label="add item">\n                  <md-tooltip>{{ \'TOOLS.ADD_WIDGET\' | translate }}</md-tooltip>\n                  <md-icon md-font-icon="icon-plus"></md-icon>\n                </md-button>\n                <md-content flex>\n                  <ms-widget-engine config="vm_cd.customDashboard" on-edit="vm_cd.createOrEditWidget(widget)" on-delete="vm_cd.deleteWidget(widget)"></ms-widget-engine>\n                </md-content>\n              </div>\n              <div ng-if="!vm_cd.customDashboard.widgets.length" layout="row" layout-align="center center" flex>\n                <md-button class="width-130 height-130 md-accent md-raised" ng-click="vm_cd.createOrEditWidget()" aria-label="add item" layout="column">\n                  <md-icon md-font-icon="icon-plus-circle" class="s50"></md-icon>\n                  <span layout-wrap translate="TOOLS.ADD_WIDGET"></span>\n                </md-button>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/tools/views/customDashboards/partialViews/reports/treeReports.html",'<md-dialog class="report-selection-dialog" aria-label="Report Selection" flex="60">\n  <md-toolbar>\n    <div class="md-toolbar-tools">\n      <h2>Select Report</h2>\n      <span flex></span>\n      <md-button class="md-icon-button" ng-click="vm.closeReportDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-dialog-content>\n    <div class="content" md-background-bg layout="row" layout-align="start start">\n      <div layout="column" flex="30">\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeDefaultEvents" ng-model="vm.treeDefaultData" tree="vm.treeDefaultInstance"></div>\n        </md-card>\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n        </md-card>\n      </div>\n      <md-card flex="70">\n        <md-toolbar class="md-table-toolbar md-default">\n          <div class="md-toolbar-tools">\n            <span class="h2 secondary-text">{{vm.currentNode.text}}</span>\n            <p ng-if="vm.currentPath">\n              <span class="text-boxed">{{vm.currentPath}}</span>\n            </p>\n          </div>\n        </md-toolbar>\n        <md-table-container>\n          <table md-table md-row-select ng-model="vm.selectedReport" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getReports">\n              <tr md-row>\n                <th md-column md-order-by="id" width="10px">{{ "ANALYTICS.ID" | translate }}</th>\n                <th md-column md-order-by="name">{{ "ANALYTICS.NAME" | translate }}</th>\n                <th md-column md-order-by="description">{{ "ANALYTICS.DESCRIPTION" | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ "ANALYTICS.CREATED_AT" | translate }}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.reports.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="report" md-select-id="id" ng-repeat="report in vm.reports.rows">\n                <td md-cell class="id">{{ report.id }}</td>\n                <td md-cell class="name">{{ report.name }}</td>\n                <td md-cell class="description">{{ report.description }}</td>\n                <td md-cell class="createdAt">{{ report.createdAt | date: "medium" }}</td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{ \'ANALYTICS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'ANALYTICS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'ANALYTICS.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10]" md-page="vm.query.page" md-total="{{ vm.reports.count }}" md-on-paginate="vm.getReports" md-page-select></md-table-pagination>\n      </md-card>\n    </div>\n  </md-dialog-content>\n  <md-dialog-actions layout="row">\n    <span flex></span>\n    <md-button class="md-raised" ng-click="vm.closeReportDialog()">CANCEL</md-button>\n    <md-button class="md-accent md-raised" ng-click="vm.selectReport()">CONFIRM</md-button>\n  </md-dialog-actions>\n</md-dialog>'),e.put("app/main/apps/tools/views/dispositions/create/dialog.html",'<md-dialog ng-init="vm.onInit()" class="disposition-dialog" aria-label="New Disposition">\n  <form name="dispositionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newDisposition ? \'TOOLS.NEW_DISPOSITION\' : \'TOOLS.EDIT_DISPOSITION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.disposition.name" md-maxlength="255" required md-autofocus>\n        <div ng-messages="dispositionForm[\'name\'].$error" ng-show="dispositionForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.NAME_MAX_LENGTH" translate-values=\'{max: 255}\'>Name must have a maximum length\n              equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.disposition.description" md-maxlength="255">\n        <div ng-messages="dispositionForm[\'description\'].$error" ng-show="dispositionForm[\'description\'].$touched" role="alert">\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_MAX_LENGTH" translate-values=\'{max: 255}\'>Description must have a\n              maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.newDisposition && vm.dispositions.length > 0 || vm.disposition.ParentId" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="TOOLS.FIRST_LEVEL_DISPOSITION">First Level Disposition</label>\n          <md-select name="firstLevelDisposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onFirstLevelSelection()">\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' }" ng-disabled="disposition.canSelect === false">{{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.firstLevelDisposition" ng-click="vm.clearSelection(\'first\'); dispositionForm.$setDirty();" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear first level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="TOOLS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n          <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition">\n            <md-option ng-value="disposition" ng-if="disposition.id != vm.disposition.id" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id }" ng-disabled="disposition.canSelect === false">{{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearSelection(\'second\'); dispositionForm.$setDirty();" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear first level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDisposition" ng-click="vm.saveDisposition()" class="send-button md-accent md-raised" ng-disabled="dispositionForm.$invalid || dispositionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDisposition" ng-click="vm.addNewDisposition()" class="send-button md-accent md-raised" ng-disabled="dispositionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_DISPOSITION" translate-attr-aria-label="TOOLS.ADD_DISPOSITION">\n          ADD DISPOSITION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDisposition" ng-click="vm.deleteDisposition($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/dispositions/dispositions.html",'<div id="dispositions" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.DISPOSITIONS">Dispositions</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedDispositions.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedDispositions = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-dispositions-count">\n          <span>{{vm.selectedDispositions.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllDispositions()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectDispositions()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedDispositions" csv-label="true" filename="dispositions.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      <div layout="row">\n        <div class="column" flex="20">\n          <md-card>\n            <md-card-content>\n              <button layout-align="center center" md-mini-fab ng-click="vm.query.level = null; vm.getDispositions()">\n                <div layout="row" layout-align="start center">\n                  <md-icon md-font-icon="icon-refresh"></md-icon>\n                  <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                </div>\n              </button>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm.query.level" ng-change="vm.getDispositions()">\n                  <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                  <md-option ng-value="key" ng-repeat="(key, value) in vm.levels">{{ value }}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n        </div>\n        \x3c!-- DISPOSITION TABLE --\x3e\n        <md-card flex="80">\n          <md-table-container>\n            <table md-table md-row-select multiple ng-model="vm.selectedDispositions" md-progress="vm.promise">\n              <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getDispositions">\n                <tr md-row>\n                  <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                  <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                  <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                  <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                  <th md-column width="10px"></th>\n                </tr>\n              </thead>\n              <tbody md-body>\n                <tr md-row ng-hide="vm.dispositions.rows.length">\n                  <td md-cell colspan="5">\n                    <div layout="row" layout-align="center center">\n                      <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                  </td>\n                </tr>\n                <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm.dispositions.rows">\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                  </td>\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                    {{ vm.levels[disposition.level] }}</td>\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                    {{disposition.name}}</td>\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                    {{disposition.description}}</td>\n                  <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        \x3c!-- SUBACTIONS --\x3e\n                        \x3c!-- ACTIONS --\x3e\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                            Edit Disposition\n                          </md-button>\n                        </md-menu-item>\n                        \x3c!-- SUBACTIONS --\x3e\n                        \x3c!-- ACTIONS --\x3e\n                        <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                          <md-button ng-click="vm.deleteconfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                            Delete Disposition\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n          <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.dispositions.count}}" md-on-paginate="vm.getDispositions" md-page-select>\n          </md-table-pagination>\n        </md-card>\n        \x3c!-- / DISPOSITION TABLE --\x3e\n      </div>\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n  \x3c!-- ADD DISPOSITION BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-disposition-button" ng-click="vm.createOrEditDisposition($event)" aria-label="add disposition" translate translate-attr-aria-label="TOOLS.ADD_DISPOSITION">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD DISPOSITION BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/intervals/create/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.interval.name" ng-required="true" autofocus>\n\n        <div ng-messages="intervalForm[\'name\'].$error" ng-show="intervalForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.interval.description">\n\n        <div ng-messages="intervalForm[\'description\'].$error" ng-show="intervalForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInterval" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInterval" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInterval" ng-click="vm.deleteInterval($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/intervals/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input ng-model="vm.interval.name" type="text" name="name" placeholder="{{\'TOOLS.NAME\' | translate}}" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" md-autofocus required>\n        <div ng-messages="intervalForm.name.$error" ng-show="intervalForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/intervals/edit/intervals/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.interval.name" ng-required="true" autofocus>\n\n        <div ng-messages="intervalForm[\'name\'].$error" ng-show="intervalForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInterval" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInterval" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInterval" ng-click="vm.deleteInterval($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/intervals/edit/view.html",'<div id="tools-interval" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-intervals-button md-icon-button" aria-label="Go to intervals" ng-click="vm.gotoIntervals()" translate translate-attr-aria-label="TOOLS.GO_TO_INTERVALS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="interval-image" hide-xs>\n          <img ng-src="assets/images/business/intervals.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.interval.id}}\n            <span ng-if="vm.interval.name">{{vm.interval.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{vm.interval.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveInterval()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (intervalsForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="interval-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.interval.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.interval.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.INTERVALS">INTERVALS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="interval-detail-form-container intervals md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IntervalIntervalsController as vm_dc" ng-init="vm_dc.init(vm.interval, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIntervalIntervals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="TOOLS.INTERVALS">Intervals</span>\n                  <ms-search-bar on-search="vm_dc.getIntervalIntervals()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditIntervalInterval($event)" aria-label="add interval" translate translate-attr-label="TOOLS.ADD_INTERVAL">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIntervalIntervals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIntervalIntervals.length}} {{vm_dc.selectedIntervalIntervals.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIntervalIntervals" csv-label="true" filename="intervals.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedIntervalIntervals($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIntervalIntervals" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIntervalIntervals">\n                    <tr md-row>\n                      <th md-column width="10px"></th>\n                      <th md-column md-order-by="id">\n                        {{ \'TOOLS.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="name">\n                        {{ \'TOOLS.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="interval">\n                        {{ \'TOOLS.INTERVAL\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'TOOLS.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body ng-sortable="vm_dc.sortableTable">\n                    <tr md-row md-select="interval" md-select-id="id" ng-repeat="interval in vm_dc.intervalIntervals.rows">\n                      <td md-cell>\n                        <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{interval.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{interval.name}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{interval.interval}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{ interval.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" translate="TOOLS.EDIT_INTERVAL">\n                                Edit Interval\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interval, $event)" translate="TOOLS.DELETE_INTERVAL">\n                                Delete Interval\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.intervalIntervals.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="TOOLS.NO_INTERVALS_AVAILABLE">No intervals available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/tools/views/intervals/intervals.html",'<div id="intervals" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.INTERVALS">Intervals</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedIntervals.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedIntervals =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-intervals-count">\n          <span>{{vm.selectedIntervals.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllIntervals()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectIntervals()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedIntervals" csv-label="true" filename="intervals.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedIntervals($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- INTERVAL TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedIntervals" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getIntervals">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.intervals.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="interval" md-select-id="id" ng-repeat="interval in vm.intervals.rows">\n                <td md-cell ng-if="interval.userpic"><img class="avatar" alt="{{interval.name}}" ng-src="api/users/{{interval.id}}/avatar" /></td>\n                <td md-cell ng-if="!interval.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{interval.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(interval, ev) : vm.createOrEditInterval($event, interval)" md-cell class="id ">{{interval.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(interval, ev) : vm.createOrEditInterval($event, interval)" md-cell class="name ">{{interval.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(interval, ev) : vm.createOrEditInterval($event, interval)" md-cell class="description ">{{interval.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(interval, $event    )" translate="TOOLS.EDIT_INTERVAL">\n                          Edit Interval\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(interval, $event    )" translate="TOOLS.DELETE_INTERVAL">\n                          Delete Interval\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.intervals.count}}" md-on-paginate="vm.getIntervals" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / INTERVAL TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD INTERVAL BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-interval-button" ng-click="vm.createOrEditInterval($event)" aria-label="add interval" translate translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD INTERVAL BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/pauses/create/dialog.html",'<md-dialog class="pause-dialog" aria-label="New Pause">\n  <form name="pauseForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.pause.name" ng-required="true" autofocus>\n\n        <div ng-messages="pauseForm[\'name\'].$error" ng-show="pauseForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.pause.description">\n\n        <div ng-messages="pauseForm[\'description\'].$error" ng-show="pauseForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newPause" ng-click="vm.savePause()" class="send-button md-accent md-raised" ng-disabled="pauseForm.$invalid || pauseForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newPause" ng-click="vm.addNewPause()" class="send-button md-accent md-raised" ng-disabled="pauseForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_PAUSE" translate-attr-aria-label="TOOLS.ADD_PAUSE">\n          ADD PAUSE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newPause" ng-click="vm.deletePause($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/pauses/pauses.html",'<div id="pauses" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.PAUSES">Pauses</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedPauses.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedPauses =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-pauses-count">\n          <span>{{vm.selectedPauses.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllPauses()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectPauses()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedPauses" csv-label="true" filename="pauses.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedPauses($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- PAUSE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedPauses" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getPauses">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.pauses.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="pause" md-select-id="id" ng-repeat="pause in vm.pauses.rows">\n                <td md-cell ng-if="pause.userpic"><img class="avatar" alt="{{pause.name}}" ng-src="api/users/{{pause.id}}/avatar" /></td>\n                <td md-cell ng-if="!pause.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{pause.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditPause($event, pause)" md-cell class="id ">{{pause.id}}</td>\n                <td ng-click="vm.createOrEditPause($event, pause)" md-cell class="name ">{{pause.name}}</td>\n                <td ng-click="vm.createOrEditPause($event, pause)" md-cell class="description ">{{pause.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(pause, $event    )" translate="TOOLS.EDIT_PAUSE">\n                          Edit Pause\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(pause, $event    )" translate="TOOLS.DELETE_PAUSE">\n                          Delete Pause\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.pauses.count}}" md-on-paginate="vm.getPauses" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PAUSE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD PAUSE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-pause-button" ng-click="vm.createOrEditPause($event)" aria-label="add pause" translate translate-attr-aria-label="TOOLS.ADD_PAUSE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD PAUSE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/schedules/create/dialog.html",'<md-dialog class="schedule-dialog" aria-label="New Schedule">\n  <form name="scheduleForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.schedule.name" ng-required="true" autofocus>\n\n        <div ng-messages="scheduleForm[\'name\'].$error" ng-show="scheduleForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.REPORT">Report</label>\n        <input type="search" name="report" ng-model="vm.schedule.report" ng-required="true" autocomplete="off" ng-click="vm.searchReport()">\n        <md-icon md-font-icon="icon-magnify" ng-click="vm.searchReport()" aria-label="Search Report"></md-icon>\n        <div ng-messages="scheduleForm[\'report\'].$error" ng-show="scheduleForm[\'report\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REPORT_REQUIRED">Report field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.OUTPUT">Output</label>\n        <md-select name="output" ng-model="vm.schedule.output" required>\n          <md-option ng-value="\'csv\'">CSV</md-option>\n          <md-option ng-value="\'pdf\'">PDF</md-option>\n          <md-option ng-value="\'xlsx\'">Excel</md-option>\n        </md-select>\n        <div ng-messages="scheduleForm[\'output\'].$error" ng-show="scheduleForm[\'output\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OUTPUT_REQUIRED">Output field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.schedule.active" aria-label="Active"><span translate="TOOLS.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <div class="md-block">\n        <label translate="TOOLS.VALIDITYSTART">ValidityStart</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click required name="startAtDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.schedule.startAt" ng-init="vm.schedule.startAt = vm.getDateFromString(vm.schedule.startAt)">\n              <div ng-messages="scheduleForm.dateRangeFrom.$error" ng-show="scheduleForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click required name="startAtTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.schedule.startAt" ng-init="vm.schedule.startAt = vm.getDateFromString(vm.schedule.startAt)">\n              <div ng-messages="scheduleForm.timeRangeFrom.$error" ng-show="scheduleForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <div class="md-block">\n        <label translate="TOOLS.VALIDITYEND">ValidityEnd</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click required name="endAtDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.schedule.endAt" ng-init="vm.schedule.endAt = vm.getDateFromString(vm.schedule.endAt)">\n              <div ng-messages="scheduleForm.dateRangeFrom.$error" ng-show="scheduleForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click required name="endAtTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.schedule.endAt" ng-init="vm.schedule.endAt = vm.getDateFromString(vm.schedule.endAt)">\n              <div ng-messages="scheduleForm.timeRangeFrom.$error" ng-show="scheduleForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <div flex class="md-block">\n        <label> {{ \'TOOLS.CRON\' | translate }} ({{vm.schedule.cron}})</label>\n        <cron-selection name="cron" ng-model="vm.schedule.cron" template="assets/angular-cron-jobs/template.html" required></cron-selection>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.LAST">Last</label>\n        <input type="number" name="subtractNumber" ng-model="vm.schedule.subtractNumber" value="1" ng-required="true">\n\n        <div ng-messages="scheduleForm[\'subtractNumber\'].$error" ng-show="scheduleForm[\'subtractNumber\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LAST_REQUIRED">Last field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.LASTUNIT">LastUnit</label>\n        <md-select name="subtractUnit" ng-model="vm.schedule.subtractUnit" required>\n          <md-option ng-value="\'minutes\'">Minutes</md-option>\n          <md-option ng-value="\'hours\'">Hours</md-option>\n          <md-option ng-value="\'days\'">Days</md-option>\n          <md-option ng-value="\'weeks\'">Weeks</md-option>\n          <md-option ng-value="\'months\'">Months</md-option>\n          <md-option ng-value="\'quarters\'">Quarters</md-option>\n          <md-option ng-value="\'years\'">Years</md-option>\n        </md-select>\n        <div ng-messages="scheduleForm[\'subtractUnit\'].$error" ng-show="scheduleForm[\'subtractUnit\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LASTUNIT_REQUIRED">LastUnit field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.schedule.sendMail" aria-label="SendMail"><span translate="TOOLS.SENDMAIL">SendMail</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.MAILACCOUNT">MailAccount</label>\n        <md-select name="MailAccountId" ng-model="vm.schedule.MailAccountId" required>\n          <md-option ng-value="MailAccountId.id" ng-repeat="MailAccountId in vm.mailAccounts" ng-disabled="MailAccountId.canSelect === false">{{ MailAccountId.name }}</md-option>\n        </md-select>\n        <div ng-messages="scheduleForm[\'MailAccountId\'].$error" ng-show="scheduleForm[\'MailAccountId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.MAILACCOUNT_REQUIRED">MailAccount field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.EMAILADDRESS">EmailAddress</label>\n        <input type="text" name="email" ng-model="vm.schedule.email" ng-required="true">\n\n        <div class="hint"><span translate="TOOLS.HELP.EMAILADDRESS"></span></div>\n        <div ng-messages="scheduleForm[\'email\'].$error" ng-show="scheduleForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EMAILADDRESS_REQUIRED">EmailAddress field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.EMAILCCADDRESS">EmailCcAddress</label>\n        <input type="text" name="cc" ng-model="vm.schedule.cc">\n\n        <div class="hint"><span translate="TOOLS.HELP.EMAILCCADDRESS"></span></div>\n        <div ng-messages="scheduleForm[\'cc\'].$error" ng-show="scheduleForm[\'cc\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EMAILCCADDRESS_REQUIRED">EmailCcAddress field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.EMAILBCCADDRESS">EmailBccAddress</label>\n        <input type="text" name="bcc" ng-model="vm.schedule.bcc">\n\n        <div class="hint"><span translate="TOOLS.HELP.EMAILBCCADDRESS"></span></div>\n        <div ng-messages="scheduleForm[\'bcc\'].$error" ng-show="scheduleForm[\'bcc\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EMAILBCCADDRESS_REQUIRED">EmailBccAddress field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <md-switch ng-model="vm.schedule.sendIfEmpty" aria-label="SendIfEmpty"><span translate="TOOLS.SENDIFEMPTY">SendIfEmpty</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="" name="description" ng-model="vm.schedule.description">\n\n        <div ng-messages="scheduleForm[\'description\'].$error" ng-show="scheduleForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSchedule" ng-click="vm.saveSchedule()" class="send-button md-accent md-raised" ng-disabled="scheduleForm.$invalid || scheduleForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSchedule" ng-click="vm.addNewSchedule()" class="send-button md-accent md-raised" ng-disabled="scheduleForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_SCHEDULE" translate-attr-aria-label="TOOLS.ADD_SCHEDULE">\n          ADD SCHEDULE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSchedule" ng-click="vm.deleteSchedule($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/schedules/partialViews/reports/treeReports.html",'<md-dialog class="report-selection-dialog" aria-label="Report Selection" flex="60">\n  <md-toolbar>\n    <div class="md-toolbar-tools">\n      <h2>Select Report</h2>\n      <span flex></span>\n      <md-button class="md-icon-button" ng-click="vm.closeReportDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-dialog-content>\n    <div class="content" md-background-bg layout="row" layout-align="start start">\n      <div layout="column" flex="30">\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeDefaultEvents" ng-model="vm.treeDefaultData" tree="vm.treeDefaultInstance"></div>\n        </md-card>\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n        </md-card>\n      </div>\n      <md-card flex="70">\n        <md-toolbar class="md-table-toolbar md-default">\n          <div class="md-toolbar-tools">\n            <span class="h2 secondary-text">{{vm.currentNode.text}}</span>\n            <p ng-if="vm.currentPath">\n              <span class="text-boxed">{{vm.currentPath}}</span>\n            </p>\n          </div>\n        </md-toolbar>\n        <md-table-container>\n          <table md-table md-row-select ng-model="vm.selectedReport" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getReports">\n              <tr md-row>\n                <th md-column md-order-by="id" width="10px">{{ "ANALYTICS.ID" | translate }}</th>\n                <th md-column md-order-by="name">{{ "ANALYTICS.NAME" | translate }}</th>\n                <th md-column md-order-by="description">{{ "ANALYTICS.DESCRIPTION" | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ "ANALYTICS.CREATED_AT" | translate }}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.reports.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="report" md-select-id="id" ng-repeat="report in vm.reports.rows">\n                <td md-cell class="id">{{ report.id }}</td>\n                <td md-cell class="name">{{ report.name }}</td>\n                <td md-cell class="description">{{ report.description }}</td>\n                <td md-cell class="createdAt">{{ report.createdAt | date: "medium" }}</td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{ \'ANALYTICS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'ANALYTICS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'ANALYTICS.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10]" md-page="vm.query.page" md-total="{{ vm.reports.count }}" md-on-paginate="vm.getReports" md-page-select></md-table-pagination>\n      </md-card>\n    </div>\n  </md-dialog-content>\n  <md-dialog-actions layout="row">\n    <span flex></span>\n    <md-button class="md-raised" ng-click="vm.closeReportDialog()">CANCEL</md-button>\n    <md-button class="md-accent md-raised" ng-click="vm.selectReport()">CONFIRM</md-button>\n  </md-dialog-actions>\n</md-dialog>'),e.put("app/main/apps/tools/views/schedules/schedules.html",'<div id="schedules" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.SCHEDULER">Scheduler</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedScheduler.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedScheduler =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-schedules-count">\n          <span>{{vm.selectedScheduler.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllScheduler()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectScheduler()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedScheduler" csv-label="true" filename="schedules.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedScheduler($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SCHEDULE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedScheduler" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getScheduler">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'TOOLS.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="startAt">{{ \'TOOLS.VALIDITYSTART\' | translate }}</th>\n                <th md-column md-order-by="endAt">{{ \'TOOLS.VALIDITYEND\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.schedules.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="schedule" md-select-id="id" ng-repeat="schedule in vm.schedules.rows">\n                <td md-cell ng-if="schedule.userpic"><img class="avatar" alt="{{schedule.name}}" ng-src="api/users/{{schedule.id}}/avatar" /></td>\n                <td md-cell ng-if="!schedule.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{schedule.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="id ">{{schedule.id}}</td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="name ">{{schedule.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(schedule, ev) : vm.createOrEditSchedule($event, schedule)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{schedule.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{schedule.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="startAt ">{{schedule.startAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="endAt ">{{schedule.endAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="description ">{{schedule.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(schedule, $event    )" translate="TOOLS.EDIT_SCHEDULE">\n                          Edit Schedule\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.runconfirm(schedule, $event    )" translate="TOOLS.RUN_SCHEDULE">\n                          Run Schedule\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(schedule, $event    )" translate="TOOLS.DELETE_SCHEDULE">\n                          Delete Schedule\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.schedules.count}}" md-on-paginate="vm.getScheduler" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SCHEDULE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SCHEDULE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-schedule-button" ng-click="vm.createOrEditSchedule($event)" aria-label="add schedule" translate translate-attr-aria-label="TOOLS.ADD_SCHEDULE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SCHEDULE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/sounds/create/dialog.html",'<md-dialog class="sound-dialog" aria-label="New Sound">\n  <form name="soundForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.sound.name" ng-required="true" autofocus>\n\n        <div ng-messages="soundForm[\'name\'].$error" ng-show="soundForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.sound.description">\n\n        <div ng-messages="soundForm[\'description\'].$error" ng-show="soundForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSound" ng-click="vm.saveSound()" class="send-button md-accent md-raised" ng-disabled="soundForm.$invalid || soundForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSound" ng-click="vm.addNewSound()" class="send-button md-accent md-raised" ng-disabled="soundForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_SOUND" translate-attr-aria-label="TOOLS.ADD_SOUND">\n          ADD SOUND\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSound" ng-click="vm.deleteSound($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/sounds/sounds.html",'<div id="sounds" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.SOUNDS">Sounds</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSounds.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSounds =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-sounds-count">\n          <span>{{vm.selectedSounds.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSounds()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSounds()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSounds" csv-label="true" filename="sounds.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSounds($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SOUND TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSounds" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSounds">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="audio">{{ \'TOOLS.AUDIO\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.sounds.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="sound" md-select-id="id" ng-repeat="sound in vm.sounds.rows">\n                <td md-cell ng-if="sound.userpic"><img class="avatar" alt="{{sound.name}}" ng-src="api/users/{{sound.id}}/avatar" /></td>\n                <td md-cell ng-if="!sound.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{sound.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditSound($event, sound)" md-cell class="id ">{{sound.id}}</td>\n                <td ng-click="vm.createOrEditSound($event, sound)" md-cell class="name ">{{sound.name}}</td>\n                <td md-cell class="audio ">\n                  \x3c!-- audio recording directive --\x3e\n                  <ms-recording id="sound.id" model="\'sound\'"></ms-recording>\n                  \x3c!-- / audio recording directive --\x3e\n                </td>\n                <td ng-click="vm.createOrEditSound($event, sound)" md-cell class="description ">{{sound.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(sound, $event    )" translate="TOOLS.EDIT_SOUND">\n                          Edit Sound\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.downloadfile2(sound, $event  , \'sounds\'   )" translate="TOOLS.DOWNLOAD_SOUND">\n                          Download Sound\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(sound, $event    )" translate="TOOLS.DELETE_SOUND">\n                          Delete Sound\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.sounds.count}}" md-on-paginate="vm.getSounds" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SOUND TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- UPLOAD SOUND BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="upload-sound-button" ng-click="vm.uploadSound($event)" aria-label="upload sound" translate translate-attr-aria-label="TOOLS.UPLOAD_SOUND">\n    <md-icon md-font-icon="icon-upload"></md-icon>\n  </md-button>\n  \x3c!-- / UPLOAD SOUND BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/sounds/upload/dialog.html",'<md-dialog class="upload-dialog" aria-label="Upload ">\n  <form name="uploadForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div id="sound-uploader" ng-hide="vm.uploadState == \'uploading\'" flow-init="vm.ngFlowOptions" flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)" flow-error="vm.uploadError($file, $message)" flow-complete="vm.uploadComplete()" flow-drop flow-drag-enter="vm.dropping=true" flow-drag-leave="vm.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n        <div class="drop-text hint-text" layout="row" layout-align="center center">\n          <span translate="TOOLS.DROP_TO_UPLOAD">Drop to upload</span>\n        </div>\n\n        <div class="upload-button" layout="column" layout-align="center center">\n          <md-button class="md-accent md-raised" flow-btn>\n            Upload\n          </md-button>\n          <span class="secondary-text mt-8" translate="TOOLS.DROP_TO_UPLOAD_MESSAGE">You can also drop your file here to upload.</span>\n        </div>\n      </div>\n\n      <div layout="column" layout-align="space-between center" ng-show="vm.uploadState == \'uploading\'">\n        <div>\n          <span translate="TOOLS.UPLOADING">Uploading</span>\n          <span>{{vm.sound.file.name}}</span>\n        </div>\n        <md-progress-linear md-mode="indeterminate"></md-progress-linear>\n      </div>\n\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center"></div>\n      <div layout="row">\n        <md-button ng-click="vm.closeDialog()" ng-hide="vm.uploadState == \'uploading\'" class="md-accent md-raised" aria-label="FINISH" translate="TOOLS.FINISH" translate-attr-aria-label="TOOLS.FINISH">\n          FINISH\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/tags/create/dialog.html",'<md-dialog class="tag-dialog" aria-label="New Tag">\n  <form name="tagForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.tag.name" ng-required="true" autofocus>\n\n        <div ng-messages="tagForm[\'name\'].$error" ng-show="tagForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.tag.description">\n\n        <div ng-messages="tagForm[\'description\'].$error" ng-show="tagForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div flex md-color-picker ng-model="vm.tag.color" label="{{\'TOOLS.COLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTag" ng-click="vm.saveTag()" class="send-button md-accent md-raised" ng-disabled="tagForm.$invalid || tagForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTag" ng-click="vm.addNewTag()" class="send-button md-accent md-raised" ng-disabled="tagForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TAG" translate-attr-aria-label="TOOLS.ADD_TAG">\n          ADD TAG\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTag" ng-click="vm.deleteTag($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/tags/tags.html",'<div id="tags" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TAGS">Tags</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTags.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTags =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-tags-count">\n          <span>{{vm.selectedTags.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTags()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTags()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTags" csv-label="true" filename="tags.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTags($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TAG TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTags" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTags">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="color">{{ \'TOOLS.COLOR\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.tags.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="tag" md-select-id="id" ng-repeat="tag in vm.tags.rows">\n                <td md-cell ng-if="tag.userpic"><img class="avatar" alt="{{tag.name}}" ng-src="api/users/{{tag.id}}/avatar" /></td>\n                <td md-cell ng-if="!tag.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{tag.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="id ">{{tag.id}}</td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="name ">{{tag.name}}</td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="description ">{{tag.description}}</td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="color ">{{tag.color}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(tag, $event    )" translate="TOOLS.EDIT_TAG">\n                          Edit Tag\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(tag, $event    )" translate="TOOLS.DELETE_TAG">\n                          Delete Tag\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.tags.count}}" md-on-paginate="vm.getTags" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TAG TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TAG BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-tag-button" ng-click="vm.createOrEditTag($event)" aria-label="add tag" translate translate-attr-aria-label="TOOLS.ADD_TAG">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TAG BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/templates/create/dialog.html",'<md-dialog class="template-dialog" aria-label="New Template">\n  <form name="templateForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.template.name" ng-required="true" autofocus>\n\n        <div ng-messages="templateForm[\'name\'].$error" ng-show="templateForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label class="md-caption grey-fg" translate="TOOLS.CONTENT">Content</label>\n        <textarea aria-label="Content html" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.template.html"></textarea>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.template.description">\n\n        <div ng-messages="templateForm[\'description\'].$error" ng-show="templateForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTemplate" ng-click="vm.saveTemplate()" class="send-button md-accent md-raised" ng-disabled="templateForm.$invalid || templateForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTemplate" ng-click="vm.addNewTemplate()" class="send-button md-accent md-raised" ng-disabled="templateForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TEMPLATE" translate-attr-aria-label="TOOLS.ADD_TEMPLATE">\n          ADD TEMPLATE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTemplate" ng-click="vm.deleteTemplate($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/templates/templates.html",'<div id="templates" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TEMPLATES">Templates</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTemplates.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTemplates =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-templates-count">\n          <span>{{vm.selectedTemplates.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTemplates()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTemplates()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTemplates" csv-label="true" filename="templates.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTemplates($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TEMPLATE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTemplates" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTemplates">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.templates.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="template" md-select-id="id" ng-repeat="template in vm.templates.rows">\n                <td md-cell ng-if="template.userpic"><img class="avatar" alt="{{template.name}}" ng-src="api/users/{{template.id}}/avatar" /></td>\n                <td md-cell ng-if="!template.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{template.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditTemplate($event, template)" md-cell class="id ">{{template.id}}</td>\n                <td ng-click="vm.createOrEditTemplate($event, template)" md-cell class="name ">{{template.name}}</td>\n                <td ng-click="vm.createOrEditTemplate($event, template)" md-cell class="description ">{{template.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(template, $event    )" translate="TOOLS.EDIT_TEMPLATE">\n                          Edit Template\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(template, $event    )" translate="TOOLS.DELETE_TEMPLATE">\n                          Delete Template\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.templates.count}}" md-on-paginate="vm.getTemplates" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TEMPLATE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TEMPLATE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-template-button" ng-click="vm.createOrEditTemplate($event)" aria-label="add template" translate translate-attr-aria-label="TOOLS.ADD_TEMPLATE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TEMPLATE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/triggers/create/dialog.html",'<md-dialog class="trigger-dialog" aria-label="New Trigger">\n  <form name="triggerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newTrigger ? \'TOOLS.NEW_TRIGGER\' : \'TOOLS.EDIT_TRIGGER\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.trigger.name" required md-autofocus>\n        <div ng-messages="triggerForm[\'name\'].$error" ng-show="triggerForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.trigger.channel" required ng-disabled="!vm.newTrigger">\n          <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n          <md-option ng-value="\'openchannel\'" ng-if="vm.license.openchannel"> {{ \'TOOLS.OPENCHANNEL\' | translate }}\n          </md-option>\n          <md-option ng-value="\'chat\'" ng-if="vm.license.chat"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n          <md-option ng-value="\'mail\'" ng-if="vm.license.mail"> {{ \'TOOLS.MAIL\' | translate }} </md-option>\n          <md-option ng-value="\'sms\'" ng-if="vm.license.messaging"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n          <md-option ng-value="\'fax\'" ng-if="vm.license.fax"> {{ \'TOOLS.FAX\' | translate }} </md-option>\n          <md-option ng-value="\'whatsapp\'" ng-if="vm.license.whatsapp"> {{ \'TOOLS.WHATSAPP\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="triggerForm[\'channel\'].$error" ng-show="triggerForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.trigger.status" aria-label="Status"><span translate="TOOLS.STATUS">Status</span>\n        </md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.trigger.description">\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{ error.message }}</span>\n            <span class="type">({{ error.type }})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTrigger" ng-click="vm.saveTrigger()" class="send-button md-accent md-raised" ng-disabled="triggerForm.$invalid || triggerForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTrigger" ng-click="vm.addNewTrigger()" class="send-button md-accent md-raised" ng-disabled="triggerForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TRIGGER" translate-attr-aria-label="TOOLS.ADD_TRIGGER">\n          ADD TRIGGER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTrigger" ng-click="vm.deleteTrigger($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/actions/actions.html",'<div ng-controller="TriggerActionsController as vm_dc" ng-init="vm_dc.onInit(vm.trigger, vm.crudPermissions)">\r\n  <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedTriggerActions.length">\r\n    <div class="md-toolbar-tools">\r\n      <span class="md-subhead" translate="TOOLS.ACTIONS">Actions</span>\r\n      <ms-search-bar on-search="vm_dc.getTriggerActions()" query="vm_dc.query" debounce="300" direction="down">\r\n      </ms-search-bar>\r\n      <div flex></div>\r\n      <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditTriggerAction($event)" aria-label="add action" translate translate-attr-label="TOOLS.ADD_ACTION">\r\n        <md-icon md-font-icon="icon-plus"></md-icon>\r\n      </md-button>\r\n    </div>\r\n  </md-toolbar>\r\n  <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedTriggerActions.length">\r\n    <div class="md-toolbar-tools">\r\n      <span class="md-subhead">{{ vm_dc.selectedTriggerActions.length }}\r\n        {{ vm_dc.selectedTriggerActions.length > 1 ? \'items\' : \'item\' }} selected</span>\r\n      <div flex></div>\r\n      <button class="md-icon-button" ng-csv="vm_dc.exportSelectedTriggerActions" csv-label="true" filename="triggers.csv">\r\n        <md-icon md-font-icon="icon-file-excel"></md-icon>\r\n      </button>\r\n      <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedTriggerActions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\r\n        <md-icon md-font-icon="icon-delete"></md-icon>\r\n      </md-button>\r\n    </div>\r\n  </md-toolbar>\r\n  <md-table-container class="font-size-12">\r\n    <table md-table md-row-select multiple ng-model="vm_dc.selectedTriggerActions" md-progress="vm_dc.promise">\r\n      <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getTriggerActions">\r\n        <tr md-row>\r\n          <th md-column md-order-by="id">\r\n            {{ \'TOOLS.ID\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="action">\r\n            {{ \'TOOLS.ACTION\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="data1">\r\n            {{ \'TOOLS.TYPE\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="data2">\r\n            {{ \'TOOLS.INFO\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="createdAt">\r\n            {{ \'TOOLS.CREATED_AT\' | translate }}\r\n          </th>\r\n          <th md-column width="10px"></th>\r\n        </tr>\r\n      </thead>\r\n      <tbody md-body>\r\n        <tr md-row md-select="action" md-select-id="id" ng-repeat="action in vm_dc.triggerActions.rows">\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>\r\n            {{ action.id }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>\r\n            {{ \'TOOLS.\' + (action.action | snakecase | uppercase) | translate }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\'" md-cell>\r\n            {{ action.data1 === \'1\' ? \'CTI URL\' : \'Popup\' }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'contactManager\'" md-cell>\r\n            {{ (vm_dc.lists | filter : {\'id\':(action.data1 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'contactManager\'" md-cell>\r\n            {{ action.data2 === \'1\' ? \'TOOLS.YES\' : \'TOOLS.NO\' | uppercase | translate }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'urlForward\'" md-cell>\r\n            {{ action.data1 }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="!action.data1" md-cell>\r\n            {{ action.data1 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="!action.data2" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'urlForward\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'script\' && action.data2" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'script\' && action.data1" md-cell>\r\n            {{ action.data1 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'jscripty\'" md-cell>\r\n            {{ (vm_dc.projects | filter : {\'id\':(action.data1 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\'" md-cell>\r\n            {{ vm_dc.integrationTypes[action.data1] }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'zendesk\'" md-cell>\r\n            {{ (vm_dc.zendeskAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'desk\'" md-cell>\r\n            {{ (vm_dc.deskAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'zoho\'" md-cell>\r\n            {{ (vm_dc.zohoAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'salesforce\'" md-cell>\r\n            {{ (vm_dc.salesforceAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'sugarcrm\'" md-cell>\r\n            {{ (vm_dc.sugarcrmAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'freshdesk\'" md-cell>\r\n            {{ (vm_dc.freshdeskAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'vtiger\'" md-cell>\r\n            {{ (vm_dc.vtigerAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'dynamics365\'" md-cell>\r\n            {{ (vm_dc.dynamics365Accounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'servicenow\'" md-cell>\r\n            {{ (vm_dc.servicenowAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'freshsales\'" md-cell>\r\n            {{ (vm_dc.freshsalesAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\'" md-cell>\r\n            {{ vm_dc.motionBarOptions[action.data1] }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 === \'1\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 === \'2\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 === \'0\'" md-cell>\r\n            {{ (vm_dc.templates | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\' && action.data1 === \'0\'" md-cell>\r\n            {{ (vm_dc.templates | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\' && action.data1 === \'1\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>\r\n            {{ action.createdAt | formatdate }}\r\n          </td>\r\n          <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\r\n            <md-menu>\r\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\r\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\r\n              </md-button>\r\n              <md-menu-content width="3">\r\n                <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\r\n                  <md-button ng-click="vm_dc.createOrEditTriggerAction($event, action)" translate="TOOLS.EDIT_ACTION">\r\n                    Edit Action\r\n                  </md-button>\r\n                </md-menu-item>\r\n                <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\r\n                  <md-button ng-click="vm_dc.deleteConfirm(action, $event)" translate="TOOLS.DELETE_ACTION">\r\n                    Delete Action\r\n                  </md-button>\r\n                </md-menu-item>\r\n              </md-menu-content>\r\n            </md-menu>\r\n          </td>\r\n        </tr>\r\n        <tr md-row ng-if="!vm_dc.triggerActions.rows.length">\r\n          <td md-cell colspan="5">\r\n            <div layout="row" layout-align="center center">\r\n              <span class="text-boxed-light" translate="TOOLS.NO_ACTION_AVAILABLE">No action\r\n                available</span>\r\n            </div>\r\n          </td>\r\n        </tr>\r\n      </tbody>\r\n    </table>\r\n  </md-table-container>\r\n  <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{ vm_dc.triggerActions.count }}" md-on-paginate="vm_dc.getTriggerActions" md-page-select>\r\n  </md-table-pagination>\r\n</div>'),e.put("app/main/apps/tools/views/triggers/edit/actions/create/dialog.html",'<md-dialog class="action-dialog" aria-label="New Action">\n  <form name="actionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newAction ? \'TOOLS.NEW_ACTION\' : \'TOOLS.EDIT_ACTION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.ACTION">Action</label>\n        <md-select name="action" ng-model="vm.action.action" ng-init="vm.onActionInit()" ng-change="vm.onActionSelection()" md-autofocus required ng-disabled="!vm.newAction">\n          <md-option ng-value="\'contactManager\'" ng-if="vm.trigger.channel == \'voice\'">\n            {{ \'TOOLS.CONTACT_MANAGER\' | translate }} </md-option>\n          <md-option ng-value="\'integration\'" ng-if="vm.trigger.channel == \'voice\' && ((vm.newAction && vm.hasIntegrationsPermissions) || !vm.newAction)">\n            {{ \'TOOLS.INTEGRATIONS\' | translate }} </md-option>\n          <md-option ng-value="\'motionbar\'"> {{ \'TOOLS.MOTIONBAR\' | translate }} </md-option>\n          <md-option ng-value="\'jscripty\'"> {{ \'TOOLS.JSCRIPTY\' | translate }} </md-option>\n          <md-option ng-value="\'urlForward\'"> {{ \'TOOLS.URL_FORWARD\' | translate }} </md-option>\n          <md-option ng-value="\'browser\'"> {{ \'TOOLS.BROWSER\' | translate }} </md-option>\n          <md-option ng-value="\'bot\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.BOT\' | translate }} </md-option>\n          <md-option ng-value="\'script\'"> {{ \'TOOLS.SCRIPT\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'action\'].$error" ng-show="actionForm[\'action\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACTION_REQUIRED">Action field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'jscripty\'" class="md-block">\n        <label translate="TOOLS.PROJECT">Project</label>\n        <md-select name="data1" ng-model="vm.action.data1" required>\n          <md-option ng-value="\'\'+data1.id" ng-repeat="data1 in vm.projects" ng-disabled="data1.canSelect === false">\n            {{ data1.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.PROJECT_REQUIRED">Project field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\'" class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-change="vm.onTypeSelection()" required>\n          <md-option ng-value="\'0\'">Popup</md-option>\n          <md-option ng-value="\'1\'">CTI URL</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.LIST">List</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-change="vm.onListSelection()" required>\n          <md-option ng-value="\'\'+data1.id" ng-repeat="data1 in vm.lists" ng-disabled="data1.canSelect === false">\n            {{ data1.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.SEARCH_FIELDS">Search fields</label>\n        <md-select name="fields" ng-model="vm.action.data3" ng-init="vm.onSearchFieldsInit()" multiple required>\n          <md-optgroup label="{{ \'TOOLS.STANDARD\' | translate }}">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.contactFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.LIST\' | translate }}" ng-if="vm.listFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.listFields">\n              {{ field.name }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.GLOBALS\' | translate }}" ng-if="vm.customFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.customFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SEARCH_FIELDS_REQUIRED">Search fields field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.AUTOCREATECONTACT">Create contact automatically</label>\n        <md-select name="data2" ng-model="vm.action.data2" ng-change="vm.onAutocreateSelection()" required>\n          <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n          <md-option ng-value="\'0\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AUTOCREATECONTACT_REQUIRED">AutoCreateContact field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\' && vm.action.data2 === \'1\'" class="md-block">\n        <label translate="TOOLS.AUTOCREATE_FIELD">Autocreate field</label>\n        <md-select name="autocreateField" ng-model="vm.action.data4" ng-required="vm.action.data2 === \'1\'">\n          <md-optgroup label="{{ \'TOOLS.STANDARD\' | translate }}">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.contactFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.LIST\' | translate }}" ng-if="vm.listFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.listFields">\n              {{ field.name }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.GLOBALS\' | translate }}" ng-if="vm.customFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.customFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="actionForm[\'data4\'].$error" ng-show="actionForm[\'data4\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AUTOCREATE_FIELD_REQUIRED">Autocreate field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.IGNOREDIALERCONTACTID">Ignore dialer contact Id</label>\n        <md-select name="data5" ng-model="vm.action.data5" required>\n          <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n          <md-option ng-value="\'0\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data5\'].$error" ng-show="actionForm[\'data5\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.IGNOREDIALERCONTACTID_REQUIRED">Ignore dialer contact Id field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="data1" ng-model="vm.action.data1" required>\n          <md-option ng-value="\'GET\'">GET</md-option>\n          <md-option ng-value="\'POST\'">POST</md-option>\n          <md-option ng-value="\'PUT\'">PUT</md-option>\n          <md-option ng-value="\'DELETE\'">DELETE</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.TIMEOUT">Timeout</label>\n        <input type="number" name="data5" ng-model="vm.action.data5" min="1" max="10" ng-required="true">\n        <div class="hint"><span translate="TOOLS.HELP.TIMEOUT"></span></div>\n        <div ng-messages="actionForm[\'data5\'].$error" ng-show="actionForm[\'data5\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="TOOLS.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n              equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="TOOLS.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n              equal than</span> <span>10</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.HEADERS">Headers</label>\n        <textarea name="data6" ng-model="vm.action.data6"></textarea>\n        <div class="hint"><span translate="TOOLS.HELP.HEADERS"></span></div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\' && (vm.action.data1 == \'POST\' || vm.action.data1 == \'PUT\')" class="md-block">\n        <label translate="TOOLS.BODY">Body</label>\n        <textarea name="data7" ng-model="vm.action.data7"></textarea>\n        <div class="hint"><span translate="TOOLS.HELP.BODY"></span></div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'script\'" class="md-block">\n        <label translate="TOOLS.SCRIPT_TYPE">Script_Type</label>\n        <input type="input" name="data2" ng-model="vm.action.data2">\n        <div class="hint"><span translate="TOOLS.HELP.SCRIPT_TYPE"></span></div>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SCRIPT_TYPE_REQUIRED">Script_Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'script\'" class="md-block">\n        <label translate="TOOLS.SCRIPT_INFO">Script_Info</label>\n        <input type="input" name="data1" ng-model="vm.action.data1">\n        <div class="hint"><span translate="TOOLS.HELP.SCRIPT_INFO"></span></div>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SCRIPT_INFO_REQUIRED">Script_Info field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'script\'" class="md-block">\n        <label translate="TOOLS.SCRIPT">Script</label>\n        <textarea name="data3" ng-model="vm.action.data3" required></textarea>\n        <div class="hint"><span translate="TOOLS.HELP.SCRIPT"></span></div>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SCRIPT_REQUIRED">Script field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'integration\'" class="md-block">\n        <label translate="TOOLS.INTEGRATION">Integration</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-init="vm.onIntegrationInit()" ng-change="vm.onIntegrationSelection()" required>\n          <md-option ng-value="\'desk\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1306]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1306])">Desk</md-option>\n          <md-option ng-value="\'dynamics365\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1309]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1309])">Dynamics365</md-option>\n          <md-option ng-value="\'freshdesk\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1303]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1303])">Freshdesk</md-option>\n          <md-option ng-value="\'freshsales\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1304]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1304])">Freshsales</md-option>\n          <md-option ng-value="\'salesforce\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1302]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1302])">Salesforce</md-option>\n          <md-option ng-value="\'servicenow\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1310]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1310])">ServiceNow</md-option>\n          <md-option ng-value="\'sugarcrm\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1305]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1305])">SugarCRM</md-option>\n          <md-option ng-value="\'vtiger\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1308]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1308])">vTiger</md-option>\n          <md-option ng-value="\'zendesk\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1301]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1301])">Zendesk</md-option>\n          <md-option ng-value="\'zoho\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1307]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1307])">Zoho</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.INTEGRATION_REQUIRED">Integration field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'integration\' && vm.action.data1" class="md-block">\n        <label translate="TOOLS.ACCOUNT">Account</label>\n        <md-select name="data2" ng-model="vm.action.data2" ng-change="vm.onIntegrationAccountSelection()" ng-disabled="vm.action.isIntegrationDisabled" required>\n          <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.accounts">{{ data2.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED">Account field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'integration\'  && vm.action.data1 && vm.action.data2" class="md-block">\n        <label translate="TOOLS.CONFIGURATION">Configuration</label>\n        <md-select name="data3" ng-model="vm.action.data3" required ng-disabled="vm.action.isIntegrationDisabled">\n          <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.configurations | filter : { AccountId: (vm.action.data2 | toInteger) } : true">{{\n            data3.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.CONFIGURATION_REQUIRED">Configuration field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\'" class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-change="vm.onTypeSelection()" required>\n          <md-option ng-value="\'0\'">Popup</md-option>\n          <md-option ng-value="\'1\'">CTI URL</md-option>\n          <md-option ng-value="\'2\'">Windows App</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'2\'" class="md-block">\n        <label translate="TOOLS.APPLICATION">Application</label>\n        <input type="text" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.APPLICATION_REQUIRED">Application field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'2\'" class="md-block">\n        <label translate="TOOLS.ARGUMENTS">Arguments</label>\n        <input type="text" name="data3" ng-model="vm.action.data3">\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ARGUMENTS_REQUIRED">Arguments field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'0\'" class="md-block">\n        <label translate="TOOLS.TEMPLATE">Template</label>\n        <md-select name="data2" ng-model="vm.action.data2" required>\n          <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.templates" ng-disabled="data2.canSelect === false">\n            {{ data2.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TEMPLATE_REQUIRED">Template field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data1 == \'0\'" class="md-block">\n        <label translate="TOOLS.TEMPLATE">Template</label>\n        <md-select name="data2" ng-model="vm.action.data2" required>\n          <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.templates" ng-disabled="data2.canSelect === false">\n            {{ data2.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TEMPLATE_REQUIRED">Template field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="(vm.action.action == \'motionbar\' || vm.action.action == \'browser\') && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.EVENTVARIABLES">EventVariables</label>\n        <md-select name="data3" ng-model="vm.action.data3" required>\n          <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n          <md-option ng-value="\'0\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n        </md-select>\n        <div class="hint"><span translate="TOOLS.HELP.EVENTVARIABLES"></span></div>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EVENTVARIABLES_REQUIRED">EventVariables field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.LOCATION">Location</label>\n        <md-select name="data4" ng-model="vm.action.data4" required ng-change="vm.onActionLocationChange()">\n          <md-option ng-value="0"> {{ \'TOOLS.NEW_TAB\' | translate }} </md-option>\n          <md-option ng-value="1"> {{ \'TOOLS.NEW_WINDOW\' | translate }} </md-option>\n          <md-option ng-value="2"> {{ \'TOOLS.MOTION_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data4\'].$error" ng-show="actionForm[\'data4\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LOCATION_REQUIRED">Location field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data4 == \'1\'" class="md-block">\n        <label translate="TOOLS.WINDOWWIDTH">WindowWidth</label>\n        <input type="text" name="data5" ng-model="vm.action.data5">\n        <div ng-messages="actionForm[\'data5\'].$error" ng-show="actionForm[\'data5\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.WINDOWWIDTH_REQUIRED">WindowWidth field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data4 == \'1\'" class="md-block">\n        <label translate="TOOLS.WINDOWHEIGHT">WindowHeight</label>\n        <input type="text" name="data6" ng-model="vm.action.data6">\n        <div ng-messages="actionForm[\'data6\'].$error" ng-show="actionForm[\'data6\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.WINDOWHEIGHT_REQUIRED">WindowHeight field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAction" ng-click="vm.saveAction()" class="send-button md-accent md-raised" ng-disabled="actionForm.$invalid || actionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAction" ng-click="vm.addNewAction()" class="send-button md-accent md-raised" ng-disabled="actionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_ACTION" translate-attr-aria-label="TOOLS.ADD_ACTION">\n          ADD ACTION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAction" ng-click="vm.deleteAction($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/allconditions/allconditions.html",'<div ng-controller="TriggerAllConditionsController as vm_dc" ng-init="vm_dc.onInit(vm.trigger, vm.crudPermissions)">\n  <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedAllConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="TOOLS.ALLCONDITIONS">All Conditions</span>\n      <ms-search-bar on-search="vm_dc.getAllConditions()" query="vm_dc.query" debounce="300" direction="down">\n      </ms-search-bar>\n      <div flex></div>\n      <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditAllCondition($event)" aria-label="add allCondition" translate translate-attr-label="TOOLS.ADD_ALLCONDITION">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedAllConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead">{{ vm_dc.selectedAllConditions.length }}\n        {{ vm_dc.selectedAllConditions.length > 1 ? \'items\' : \'item\' }} selected</span>\n      <div flex></div>\n      <button class="md-icon-button" ng-csv="vm_dc.exportSelectedAllConditions" csv-label="true" filename="triggers.csv">\n        <md-icon md-font-icon="icon-file-excel"></md-icon>\n      </button>\n      <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedAllConditions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n        <md-icon md-font-icon="icon-delete"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container class="font-size-12">\n    <table md-table md-row-select multiple ng-model="vm_dc.selectedAllConditions" md-progress="vm_dc.promise">\n      <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getAllConditions">\n        <tr md-row>\n          <th md-column md-order-by="id">\n            {{ \'TOOLS.ID\' | translate }}\n          </th>\n          <th md-column md-order-by="field">\n            {{ \'TOOLS.FIELD\' | translate }}\n          </th>\n          <th md-column md-order-by="operator">\n            {{ \'TOOLS.OPERATOR\' | translate }}\n          </th>\n          <th md-column md-order-by="value">\n            {{ \'TOOLS.VALUE\' | translate }}\n          </th>\n          <th md-column md-order-by="createdAt">\n            {{ \'TOOLS.CREATED_AT\' | translate }}\n          </th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row md-select="allCondition" md-select-id="id" ng-repeat="allCondition in vm_dc.allConditions.rows">\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ allCondition.id }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ \'TOOLS.\' + vm_dc.fields[allCondition.field] | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ \'TOOLS.\' + allCondition.operator | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="!allCondition.value" md-cell>\n            {{ allCondition.value }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'chat\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.chatWebsites | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'mail\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.mailAccounts | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'sms\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.smsAccounts | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'whatsapp\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.whatsappAccounts | filter : {\'id\': (allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'fax\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.faxAccounts | filter : {\'id\': (allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'openchannel\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.openchannelAccounts | filter : {\'id\': (allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'queue\'" md-cell>\n            {{ (vm_dc.queues | filter : {\'name\':allCondition.value} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'routeId\'" md-cell>\n            {{ (vm_dc.outboundRoutes | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].exten }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'agent\'" md-cell>\n            {{ (vm_dc.agents | filter : {\'name\':allCondition.value} : true)[0].fullname }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'lastevent\'" md-cell>\n            {{ vm_dc.callStatuses[allCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel != \'voice\' && allCondition.field == \'interaction\'" md-cell>\n            {{ allCondition.value | capitalize }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel != \'voice\' && allCondition.field == \'message\'" md-cell>\n            {{ vm_dc.messageStatuses[allCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'mail\' && allCondition.field == \'mailSubstatus\'" md-cell>\n            {{ allCondition.value === \'null\' ? (\'TOOLS.NONE\' | translate) : (vm_dc.mailSubstatuses | filter : {\'name\': allCondition.value } : true)[0].name }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'chat\' && allCondition.field == \'offlineMessage\'" md-cell>\n            {{allCondition.value}} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ allCondition.createdAt | formatdate }}\n          </td>\n          <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="3">\n                <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                  <md-button ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" translate="TOOLS.EDIT_ALLCONDITION">\n                    Edit AllCondition\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                  <md-button ng-click="vm_dc.deleteConfirm(allCondition, $event)" translate="TOOLS.DELETE_ALLCONDITION">\n                    Delete AllCondition\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n        <tr md-row ng-if="!vm_dc.allConditions.rows.length">\n          <td md-cell colspan="5">\n            <div layout="row" layout-align="center center">\n              <span class="text-boxed-light" translate="TOOLS.NO_ALLCONDITION_AVAILABLE">No condition\n                available</span>\n            </div>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{ vm_dc.allConditions.count }}" md-on-paginate="vm_dc.getAllConditions" md-page-select>\n  </md-table-pagination>\n</div>'),e.put("app/main/apps/tools/views/triggers/edit/allconditions/create/dialog.html",'<md-dialog class="allCondition-dialog" aria-label="New AllCondition">\n  <form name="allConditionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newAllCondition ? \'TOOLS.NEW_ALLCONDITION\' : \'TOOLS.EDIT_ALLCONDITION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.FIELD">Field</label>\n        <md-select name="field" ng-model="vm.allCondition.field" ng-change="vm.onFieldSelection()" md-autofocus required>\n          <md-option ng-value="\'queue\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.QUEUE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'lastevent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.CALL_STATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'routeId\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.OUTBOUNDROUTE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'agent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.AGENT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'account\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.ACCOUNT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'interaction\'" ng-if="vm.trigger.channel != \'voice\'">\n            {{ \'TOOLS.INTERACTION\' | translate }} </md-option>\n          <md-option ng-value="\'message\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.MESSAGE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'mailSubstatus\'" ng-if="vm.trigger.channel == \'mail\'"> {{ \'TOOLS.MAIL_SUBSTATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'offlineMessage\'" ng-if="vm.trigger.channel == \'chat\'"> {{ \'TOOLS.OFFLINE_MESSAGE\' | translate }}\n          </md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'field\'].$error" ng-show="allConditionForm[\'field\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FIELD_REQUIRED">Field field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.OPERATOR">Operator</label>\n        <md-select name="operator" ng-model="vm.allCondition.operator" required>\n          <md-option ng-value="\'equals\'"> {{ \'TOOLS.EQUALS\' | translate }} </md-option>\n          <md-option ng-value="\'not_equals\'"> {{ \'TOOLS.NOT_EQUALS\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'operator\'].$error" ng-show="allConditionForm[\'operator\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OPERATOR_REQUIRED">Operator field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'account\'" class="md-block">\n        <label translate="TOOLS.ACCOUNT">Account</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.accounts" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED">Account field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'queue\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.QUEUE">Queue</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.queues" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'routeId\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.OUTBOUNDROUTE">OutboundRoute</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.outboundRoutes" ng-disabled="value.canSelect === false">\n            {{ value.exten }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OUTBOUNDROUTE_REQUIRED">OutboundRoute field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'agent\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.AGENT">Agent</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.agents" ng-disabled="value.canSelect === false">\n            {{ value.fullname }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'lastevent\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="status.value" ng-repeat="status in vm.callStatuses">\n            {{ status.name }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'mailSubstatus\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="mailSubstatus.name" ng-repeat="mailSubstatus in vm.mailSubstatuses">\n            {{ mailSubstatus.name }}</md-option>\n          <md-option ng-value="\'null\'">{{\'TOOLS.NONE\' | translate}}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'interaction\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="\'opened\'">Opened</md-option>\n          <md-option ng-value="\'closed\'">Closed</md-option>\n          <md-option ng-if="vm.trigger.channel==\'mail\'" ng-value="\'substatus\'">SubStatus</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'message\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="\'in\'">Incoming</md-option>\n          <md-option ng-value="\'out\'">Outgoing</md-option>\n          <md-option ng-value="\'accept\'">Accepted</md-option>\n          <md-option ng-value="\'reject\'">Rejected</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'offlineMessage\' && vm.trigger.channel == \'chat\'" class="md-block">\n        <label translate="TOOLS.CHAT">Chat</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="\'created\'">Created</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAllCondition" ng-click="vm.saveAllCondition()" class="send-button md-accent md-raised" ng-disabled="allConditionForm.$invalid || allConditionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAllCondition" ng-click="vm.addNewAllCondition()" class="send-button md-accent md-raised" ng-disabled="allConditionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_ALLCONDITION" translate-attr-aria-label="TOOLS.ADD_ALLCONDITION">\n          ADD ALLCONDITION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAllCondition" ng-click="vm.deleteAllCondition($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/anyconditions/anyconditions.html",'<div ng-controller="TriggerAnyConditionsController as vm_dc" ng-init="vm_dc.onInit(vm.trigger, vm.crudPermissions)">\n  <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedAnyConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="TOOLS.ANYCONDITIONS">AnyConditions</span>\n      <ms-search-bar on-search="vm_dc.getAnyConditions()" query="vm_dc.query" debounce="300" direction="down"></ms-search-bar>\n      <div flex></div>\n      <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditAnyCondition($event)" aria-label="add anyCondition" translate translate-attr-label="TOOLS.ADD_ANYCONDITION">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedAnyConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead">{{ vm_dc.selectedAnyConditions.length }}\n        {{ vm_dc.selectedAnyConditions.length > 1 ? \'items\' : \'item\' }} selected</span>\n      <div flex></div>\n      <button class="md-icon-button" ng-csv="vm_dc.exportSelectedAnyConditions" csv-label="true" filename="triggers.csv">\n        <md-icon md-font-icon="icon-file-excel"></md-icon>\n      </button>\n      <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedAnyConditions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n        <md-icon md-font-icon="icon-delete"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container class="font-size-12">\n    <table md-table md-row-select multiple ng-model="vm_dc.selectedAnyConditions" md-progress="vm_dc.promise">\n      <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getAnyConditions">\n        <tr md-row>\n          <th md-column md-order-by="id">\n            {{ \'TOOLS.ID\' | translate }}\n          </th>\n          <th md-column md-order-by="field">\n            {{ \'TOOLS.FIELD\' | translate }}\n          </th>\n          <th md-column md-order-by="operator">\n            {{ \'TOOLS.OPERATOR\' | translate }}\n          </th>\n          <th md-column md-order-by="value">\n            {{ \'TOOLS.VALUE\' | translate }}\n          </th>\n          <th md-column md-order-by="createdAt">\n            {{ \'TOOLS.CREATED_AT\' | translate }}\n          </th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row md-select="anyCondition" md-select-id="id" ng-repeat="anyCondition in vm_dc.anyConditions.rows">\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ anyCondition.id}}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ \'TOOLS.\' + vm_dc.fields[anyCondition.field] | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ \'TOOLS.\' + anyCondition.operator | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="!anyCondition.value" md-cell>\n            {{ anyCondition.value }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'chat\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.chatWebsites | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'mail\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.mailAccounts | filter : {\'id\':(anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'sms\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.smsAccounts | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, allCondition)" ng-if="vm.trigger.channel == \'whatsapp\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.whatsappAccounts | filter : {\'id\':(anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'fax\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.faxAccounts | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'openchannel\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.openchannelAccounts | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'queue\'" md-cell>\n            {{ (vm_dc.queues | filter : {\'name\':anyCondition.value} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'routeId\'" md-cell>\n            {{ (vm_dc.outboundRoutes | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].exten }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'agent\'" md-cell>\n            {{ (vm_dc.agents | filter : {\'name\':anyCondition.value} : true)[0].fullname }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'lastevent\'" md-cell>\n            {{ vm_dc.callStatuses[anyCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel != \'voice\' && anyCondition.field == \'interaction\'" md-cell>\n            {{ anyCondition.value | capitalize }} </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel != \'voice\' && anyCondition.field == \'message\'" md-cell>\n            {{ vm_dc.messageStatuses[anyCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'mail\' && anyCondition.field == \'mailSubstatus\'" md-cell>\n            {{ anyCondition.value === \'null\' ? (\'TOOLS.NONE\' | translate) : (vm_dc.mailSubstatuses | filter : {\'name\': anyCondition.value } : true)[0].name }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'chat\' && anyCondition.field == \'offlineMessage\'" md-cell>\n            {{anyCondition.value}} </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ anyCondition.createdAt | formatdate }}\n          </td>\n          <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="3">\n                <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                  <md-button ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" translate="TOOLS.EDIT_ANYCONDITION">\n                    Edit AnyCondition\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                  <md-button ng-click="vm_dc.deleteConfirm(anyCondition, $event)" translate="TOOLS.DELETE_ANYCONDITION">\n                    Delete AnyCondition\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n        <tr md-row ng-if="!vm_dc.anyConditions.rows.length">\n          <td md-cell colspan="5">\n            <div layout="row" layout-align="center center">\n              <span class="text-boxed-light" translate="TOOLS.NO_ANYCONDITION_AVAILABLE">No anycondition\n                available</span>\n            </div>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{ vm_dc.anyConditions.count }}" md-on-paginate="vm_dc.getAnyConditions" md-page-select>\n  </md-table-pagination>\n</div>'),e.put("app/main/apps/tools/views/triggers/edit/anyconditions/create/dialog.html",'<md-dialog class="anyCondition-dialog" aria-label="New AnyCondition">\n  <form name="anyConditionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newAnyCondition ? \'TOOLS.NEW_ANYCONDITION\' : \'TOOLS.EDIT_ANYCONDITION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.FIELD">Field</label>\n        <md-select name="field" ng-model="vm.anyCondition.field" ng-change="vm.onFieldSelection()" md-autofocus required>\n          <md-option ng-value="\'queue\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.QUEUE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'lastevent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.CALL_STATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'routeId\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.OUTBOUNDROUTE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'agent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.AGENT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'account\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.ACCOUNT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'interaction\'" ng-if="vm.trigger.channel != \'voice\'">\n            {{ \'TOOLS.INTERACTION\' | translate }} </md-option>\n          <md-option ng-value="\'message\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.MESSAGE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'mailSubstatus\'" ng-if="vm.trigger.channel == \'mail\'"> {{ \'TOOLS.MAIL_SUBSTATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'offlineMessage\'" ng-if="vm.trigger.channel == \'chat\'"> {{ \'TOOLS.OFFLINE_MESSAGE\' | translate }}\n          </md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'field\'].$error" ng-show="anyConditionForm[\'field\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FIELD_REQUIRED">Field field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.OPERATOR">Operator</label>\n        <md-select name="operator" ng-model="vm.anyCondition.operator" required>\n          <md-option ng-value="\'equals\'"> {{ \'TOOLS.EQUALS\' | translate }} </md-option>\n          <md-option ng-value="\'not_equals\'"> {{ \'TOOLS.NOT_EQUALS\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'operator\'].$error" ng-show="anyConditionForm[\'operator\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OPERATOR_REQUIRED">Operator field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'account\'" class="md-block">\n        <label translate="TOOLS.ACCOUNT">Account</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.accounts" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED">Account field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'queue\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.QUEUE">Queue</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.queues" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'routeId\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.OUTBOUNDROUTE">OutboundRoute</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.outboundRoutes" ng-disabled="value.canSelect === false">\n            {{ value.exten }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OUTBOUNDROUTE_REQUIRED">OutboundRoute field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'agent\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.AGENT">Agent</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.agents" ng-disabled="value.canSelect === false">\n            {{ value.fullname }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'lastevent\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="status.value" ng-repeat="status in vm.callStatuses">\n            {{ status.name }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'mailSubstatus\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="mailSubstatus.name" ng-repeat="mailSubstatus in vm.mailSubstatuses">\n            {{ mailSubstatus.name }}</md-option>\n          <md-option ng-value="\'null\'">{{\'TOOLS.NONE\' | translate}}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'interaction\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="\'opened\'">Opened</md-option>\n          <md-option ng-value="\'closed\'">Closed</md-option>\n          <md-option ng-if="vm.trigger.channel==\'mail\'" ng-value="\'substatus\'">SubStatus</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'message\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="\'in\'">Incoming</md-option>\n          <md-option ng-value="\'out\'">Outgoing</md-option>\n          <md-option ng-value="\'accept\'">Accepted</md-option>\n          <md-option ng-value="\'reject\'">Rejected</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'offlineMessage\' && vm.trigger.channel == \'chat\'" class="md-block">\n        <label translate="TOOLS.CHAT">Chat</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="\'created\'">Created</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAnyCondition" ng-click="vm.saveAnyCondition()" class="send-button md-accent md-raised" ng-disabled="anyConditionForm.$invalid || anyConditionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAnyCondition" ng-click="vm.addNewAnyCondition()" class="send-button md-accent md-raised" ng-disabled="anyConditionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_ANYCONDITION" translate-attr-aria-label="TOOLS.ADD_ANYCONDITION">\n          ADD ANYCONDITION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAnyCondition" ng-click="vm.deleteAnyCondition($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/view.html",'<div id="tools-trigger" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-triggers-button md-icon-button" aria-label="Go to triggers" ng-click="vm.gotoTriggers()" translate translate-attr-aria-label="TOOLS.GO_TO_TRIGGERS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="trigger-image" hide-xs>\n          <img ng-src="assets/images/business/triggers.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">#{{ vm.trigger.id }}\n            <span ng-if="vm.trigger.name">{{ vm.trigger.name }}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{ vm.trigger.createdAt | date:\'medium\' }}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveTrigger()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (allconditionsForm.$invalid) || (anyconditionsForm.$invalid) || (actionsForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trigger-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.trigger.name" required autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CHANNEL">Channel</label>\n                <md-select name="channel" ng-model="vm.trigger.channel" required disabled>\n                  <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n                  <md-option ng-value="\'openchannel\'" ng-if="vm.license.openchannel">\n                    {{ \'TOOLS.OPENCHANNEL\' | translate }} </md-option>\n                  <md-option ng-value="\'chat\'" ng-if="vm.license.chat"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n                  <md-option ng-value="\'mail\'" ng-if="vm.license.mail"> {{ \'TOOLS.MAIL\' | translate }} </md-option>\n                  <md-option ng-value="\'sms\'" ng-if="vm.license.messaging"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n                  <md-option ng-value="\'fax\'" ng-if="vm.license.fax"> {{ \'TOOLS.FAX\' | translate }} </md-option>\n                  <md-option ng-value="\'whatsapp\'" ng-if="vm.license.whatsapp"> {{ \'TOOLS.WHATSAPP\' | translate }}\n                  </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'channel\'].$error" ng-show="generalForm[\'channel\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.trigger.status" aria-label="Status" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="TOOLS.STATUS">Status</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.trigger.description" ng-disabled="!vm.crudPermissions.canEdit">\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.CONDITIONS&ACTIONS">CONDITIONS&ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trigger-detail-form-container allconditions md-background-bg md-whiteframe-1dp" ng-include="\'app/main/apps/tools/views/triggers/edit/allconditions/allconditions.html\'">\n          </div>\n          <div class="trigger-detail-form-container anyconditions md-background-bg md-whiteframe-1dp" ng-include="\'app/main/apps/tools/views/triggers/edit/anyconditions/anyconditions.html\'">\n          </div>\n          <div class="trigger-detail-form-container actions md-background-bg md-whiteframe-1dp" ng-include="\'app/main/apps/tools/views/triggers/edit/actions/actions.html\'">\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/tools/views/triggers/triggers.html",'<div id="triggers" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TRIGGERS">Triggers</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTriggers.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedTriggers =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-triggers-count">\n          <span>{{ vm.selectedTriggers.length }}</span>\n          <span translate="TOOLS.SELECTED">Selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTriggers()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTriggers()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTriggers" csv-label="true" filename="triggers.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTriggers($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      \x3c!-- TRIGGER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTriggers" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTriggers">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="channel">{{ \'TOOLS.CHANNEL\' | translate }}</th>\n                <th md-column md-order-by="status">{{ \'TOOLS.STATUS\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.triggers.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="trigger" md-select-id="id" ng-repeat="trigger in vm.triggers.rows">\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="id ">{{ trigger.id }}</td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="name ">{{ trigger.name }}</td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="channel ">\n                  {{ \'TOOLS.\' + trigger.channel | uppercase | translate }}</td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="status ">\n                  <md-icon md-colors="{color: {{ trigger.status ? \'\\\'green\\\'\' : \'\\\'grey\\\'\' }}}" md-font-icon="{{ trigger.status ? \'icon-check\' : \'icon-close\' }}"></md-icon>\n                </td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="description ">\n                  {{ trigger.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.goToEditState(trigger)" translate="TOOLS.EDIT_TRIGGER">\n                          Edit Trigger\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(trigger, $event)" translate="TOOLS.DELETE_TRIGGER">\n                          Delete Trigger\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.triggers.count }}" md-on-paginate="vm.getTriggers" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TRIGGER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n  \x3c!-- ADD TRIGGER BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-trigger-button" ng-click="vm.createOrEditTrigger($event)" aria-label="add trigger" translate translate-attr-aria-label="TOOLS.ADD_TRIGGER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TRIGGER BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/trunks/create/dialog.html",'<md-dialog class="trunk-dialog" aria-label="New Trunk">\n  <form name="trunkForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.trunk.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newTrunk">\n\n        <div class="hint"><span translate="TOOLS.HELP.NAME"></span></div>\n        <div ng-messages="trunkForm[\'name\'].$error" ng-show="trunkForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.trunk.active" aria-label="active"><span translate="TOOLS.ACTIVE">active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.HOST">host</label>\n        <input type="text" name="host" ng-model="vm.trunk.host" ng-required="true">\n\n        <div class="hint"><span translate="TOOLS.HELP.HOST"></span></div>\n        <div ng-messages="trunkForm[\'host\'].$error" ng-show="trunkForm[\'host\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.HOST_REQUIRED">host field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.SECRET">secret</label>\n        <input type="password" name="secret" ng-model="vm.trunk.secret" placeholder="Password" translate translate-attr-placeholder="TOOLS.PASSWORD">\n        <div class="hint"><span translate="TOOLS.HELP.SECRET"></span></div>\n        <div ng-messages="trunkForm[\'secret\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DEFAULTUSER">defaultuser</label>\n        <input type="text" name="defaultuser" ng-model="vm.trunk.defaultuser">\n\n        <div class="hint"><span translate="TOOLS.HELP.DEFAULTUSER"></span></div>\n        <div ng-messages="trunkForm[\'defaultuser\'].$error" ng-show="trunkForm[\'defaultuser\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DEFAULTUSER_REQUIRED">defaultuser field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.REGISTRY">registry</label>\n        <input type="text" name="registry" ng-model="vm.trunk.registry">\n\n        <div class="hint"><span translate="TOOLS.HELP.REGISTRY"></span></div>\n        <div ng-messages="trunkForm[\'registry\'].$error" ng-show="trunkForm[\'registry\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REGISTRY_REQUIRED">registry field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.trunk.description">\n\n        <div ng-messages="trunkForm[\'description\'].$error" ng-show="trunkForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTrunk" ng-click="vm.saveTrunk()" class="send-button md-accent md-raised" ng-disabled="trunkForm.$invalid || trunkForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTrunk" ng-click="vm.addNewTrunk()" class="send-button md-accent md-raised" ng-disabled="trunkForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TRUNK" translate-attr-aria-label="TOOLS.ADD_TRUNK">\n          ADD TRUNK\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTrunk" ng-click="vm.deleteTrunk($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/trunks/edit/clone/clone.html",'<md-dialog class="trunk-dialog" aria-label="Clone Trunk">\n  <form name="trunkForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.trunk.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newTrunk">\n\n        <div class="hint"><span translate="TOOLS.HELP.NAME"></span></div>\n        <div ng-messages="trunkForm[\'name\'].$error" ng-show="trunkForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.trunk.active" aria-label="active"><span translate="TOOLS.ACTIVE">active</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneTrunk()" class="send-button md-accent md-raised" ng-disabled="trunkForm.$invalid" aria-label="CLONE" translate="TOOLS.CLONE_TRUNK" translate-attr-aria-label="TOOLS.CLONE_TRUNK">\n        CLONE TRUNK\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/trunks/edit/view.html",'<div id="tools-trunk" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-trunks-button md-icon-button" aria-label="Go to trunks" ng-click="vm.gotoTrunks()" translate translate-attr-aria-label="TOOLS.GO_TO_TRUNKS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="trunk-image" hide-xs>\n          <img ng-src="assets/images/business/trunks.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.trunk.id}}\n            <span ng-if="vm.trunk.name">{{vm.trunk.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{vm.trunk.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.trunk, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="TOOLS.GOTO_TRUNK"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.trunk, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="TOOLS.CLONE_TRUNK"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveTrunk()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (advancedForm.$invalid) || (otherFieldsForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trunk-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.trunk.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="TOOLS.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="TOOLS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.trunk.active" aria-label="active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="TOOLS.ACTIVE">active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.HOST">host</label>\n                <input type="text" name="host" ng-model="vm.trunk.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.HOST"></span></div>\n                <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.HOST_REQUIRED">host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.SECRET">secret</label>\n                <input type="password" name="secret" ng-model="vm.trunk.secret" placeholder="Password" translate translate-attr-placeholder="TOOLS.PASSWORD">\n                <div class="hint"><span translate="TOOLS.HELP.SECRET"></span></div>\n                <div ng-messages="generalForm[\'secret\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="TOOLS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DEFAULTUSER">defaultuser</label>\n                <input type="text" name="defaultuser" ng-model="vm.trunk.defaultuser" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.DEFAULTUSER"></span></div>\n                <div ng-messages="generalForm[\'defaultuser\'].$error" ng-show="generalForm[\'defaultuser\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DEFAULTUSER_REQUIRED">defaultuser field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CONTEXT">context</label>\n                <md-select name="context" ng-model="vm.trunk.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.CONTEXT"></span></div>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CONTEXT_REQUIRED">context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CALLERID">callerid</label>\n                <input type="text" name="callerid" ng-model="vm.trunk.callerid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.CALLERID"></span></div>\n                <div ng-messages="generalForm[\'callerid\'].$error" ng-show="generalForm[\'callerid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CALLERID_REQUIRED">callerid field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.trunk.type" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'friend\'">Friend</md-option>\n                  <md-option ng-value="\'user\'">User</md-option>\n                  <md-option ng-value="\'peer\'">Peer</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.TYPE"></span></div>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DTMFMODE">dtmfmode</label>\n                <md-select name="dtmfmode" ng-model="vm.trunk.dtmfmode" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'rfc2833\'">rfc2833</md-option>\n                  <md-option ng-value="\'info\'">info</md-option>\n                  <md-option ng-value="\'shortinfo\'">shortinfo</md-option>\n                  <md-option ng-value="\'inband\'">inband</md-option>\n                  <md-option ng-value="\'auto\'">auto</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.DTMFMODE"></span></div>\n                <div ng-messages="generalForm[\'dtmfmode\'].$error" ng-show="generalForm[\'dtmfmode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DTMFMODE_REQUIRED">dtmfmode field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAT">nat</label>\n                <md-select name="nat" ng-model="vm.trunk.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAT_REQUIRED">nat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.QUALIFY">qualify</label>\n                <md-select name="qualify" ng-model="vm.trunk.qualify" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.QUALIFY"></span></div>\n                <div ng-messages="generalForm[\'qualify\'].$error" ng-show="generalForm[\'qualify\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.QUALIFY_REQUIRED">qualify field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.trunk.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g723\'">g723</md-option>\n                  <md-option ng-value="\'g726\'">g726</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'ilbc\'">ilbc</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.INSECURE">insecure</label>\n                <md-select name="insecure" ng-model="vm.trunk.insecure" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'port\'">port</md-option>\n                  <md-option ng-value="\'invite\'">invite</md-option>\n                  <md-option ng-value="\'very\'">very</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.INSECURE"></span></div>\n                <div ng-messages="generalForm[\'insecure\'].$error" ng-show="generalForm[\'insecure\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.INSECURE_REQUIRED">insecure field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CALL_LIMIT">call_limit</label>\n                <input type="number" name="call_limit" ng-model="vm.trunk.call_limit" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.CALL_LIMIT"></span></div>\n                <div ng-messages="generalForm[\'call_limit\'].$error" ng-show="generalForm[\'call_limit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CALL_LIMIT_REQUIRED">call_limit field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.trunk.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trunk-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.REGISTRY">registry</label>\n                <input type="text" name="registry" ng-model="vm.trunk.registry" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.REGISTRY"></span></div>\n                <div ng-messages="advancedForm[\'registry\'].$error" ng-show="advancedForm[\'registry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.REGISTRY_REQUIRED">registry field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DIRECTMEDIA">directmedia</label>\n                <md-select name="directmedia" ng-model="vm.trunk.directmedia" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'nonat\'">nonat</md-option>\n                  <md-option ng-value="\'update\'">update</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.DIRECTMEDIA"></span></div>\n                <div ng-messages="advancedForm[\'directmedia\'].$error" ng-show="advancedForm[\'directmedia\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DIRECTMEDIA_REQUIRED">directmedia field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CALLCOUNTER">callcounter</label>\n                <md-select name="callcounter" ng-model="vm.trunk.callcounter" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.CALLCOUNTER"></span></div>\n                <div ng-messages="advancedForm[\'callcounter\'].$error" ng-show="advancedForm[\'callcounter\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CALLCOUNTER_REQUIRED">callcounter field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.FROMDOMAIN">fromdomain</label>\n                <input type="text" name="fromdomain" ng-model="vm.trunk.fromdomain" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.FROMDOMAIN"></span></div>\n                <div ng-messages="advancedForm[\'fromdomain\'].$error" ng-show="advancedForm[\'fromdomain\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.FROMDOMAIN_REQUIRED">fromdomain field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.FROMUSER">fromuser</label>\n                <input type="text" name="fromuser" ng-model="vm.trunk.fromuser" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.FROMUSER"></span></div>\n                <div ng-messages="advancedForm[\'fromuser\'].$error" ng-show="advancedForm[\'fromuser\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.FROMUSER_REQUIRED">fromuser field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.OUTBOUNDPROXY">outboundproxy</label>\n                <input type="text" name="outboundproxy" ng-model="vm.trunk.outboundproxy" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.OUTBOUNDPROXY"></span></div>\n                <div ng-messages="advancedForm[\'outboundproxy\'].$error" ng-show="advancedForm[\'outboundproxy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.OUTBOUNDPROXY_REQUIRED">outboundproxy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.ADD_PHONE_TO_URI">Add_phone_to_URI</label>\n                <md-select name="usereqphone" ng-model="vm.trunk.usereqphone" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.ADD_PHONE_TO_URI"></span></div>\n                <div ng-messages="advancedForm[\'usereqphone\'].$error" ng-show="advancedForm[\'usereqphone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.ADD_PHONE_TO_URI_REQUIRED">Add_phone_to_URI field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.TRUST_REMOTE_PARTY_ID">Trust_Remote_Party_ID</label>\n                <md-select name="trustrpid" ng-model="vm.trunk.trustrpid" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.TRUST_REMOTE_PARTY_ID"></span></div>\n                <div ng-messages="advancedForm[\'trustrpid\'].$error" ng-show="advancedForm[\'trustrpid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.TRUST_REMOTE_PARTY_ID_REQUIRED">Trust_Remote_Party_ID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.SEND_REMOTE_PARTY_ID_HEADER">Send_Remote_Party_ID_header</label>\n                <md-select name="sendrpid" ng-model="vm.trunk.sendrpid" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n\n                  <md-option ng-value="\'pai\'"> {{ \'TOOLS.PAI\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.SEND_REMOTE_PARTY_ID_HEADER"></span></div>\n                <div ng-messages="advancedForm[\'sendrpid\'].$error" ng-show="advancedForm[\'sendrpid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.SEND_REMOTE_PARTY_ID_HEADER_REQUIRED">Send_Remote_Party_ID_header field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.ENCRYPTION">encryption</label>\n                <md-select name="encryption" ng-model="vm.trunk.encryption" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.ENCRYPTION"></span></div>\n                <div ng-messages="advancedForm[\'encryption\'].$error" ng-show="advancedForm[\'encryption\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.ENCRYPTION_REQUIRED">encryption field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.PORT">port</label>\n                <input type="number" name="port" ng-model="vm.trunk.port" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.PORT"></span></div>\n                <div ng-messages="advancedForm[\'port\'].$error" ng-show="advancedForm[\'port\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.PORT_REQUIRED">port field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.trunk.transport" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'">ws</md-option>\n                  <md-option ng-value="\'wss\'">wss</md-option>\n                  <md-option ng-value="\'tls\'">tls</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.TRANSPORT"></span></div>\n                <div ng-messages="advancedForm[\'transport\'].$error" ng-show="advancedForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.T38PT_UDPTL">t38pt_udptl</label>\n                <input type="string" name="t38pt_udptl" ng-model="vm.trunk.t38pt_udptl" value="no" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.T38PT_UDPTL"></span></div>\n                <div ng-messages="advancedForm[\'t38pt_udptl\'].$error" ng-show="advancedForm[\'t38pt_udptl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.T38PT_UDPTL_REQUIRED">t38pt_udptl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.trunk.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'videosupport\'].$error" ng-show="advancedForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.OTHERFIELDS">OTHERFIELDS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trunk-detail-form-container otherfields md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.OTHERFIELDS">OTHERFIELDS</div>\n            </div>\n            <form name="otherFieldsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.OTHERFIELDS">otherFields</label>\n                <textarea name="otherFields" ng-model="vm.trunk.otherFields" autofocus></textarea>\n                <div class="hint"><span translate="TOOLS.HELP.OTHERFIELDS"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/tools/views/trunks/trunks.html",'<div id="trunks" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TRUNKS">Trunks</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTrunks.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTrunks =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-trunks-count">\n          <span>{{vm.selectedTrunks.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTrunks()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTrunks()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTrunks" csv-label="true" filename="trunks.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTrunks($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TRUNK TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTrunks" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTrunks">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'TOOLS.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="host">{{ \'TOOLS.HOST\' | translate }}</th>\n                <th md-column md-order-by="registry">{{ \'TOOLS.REGISTRY\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.trunks.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="trunk" md-select-id="id" ng-repeat="trunk in vm.trunks.rows">\n                <td md-cell ng-if="trunk.userpic"><img class="avatar" alt="{{trunk.name}}" ng-src="api/users/{{trunk.id}}/avatar" /></td>\n                <td md-cell ng-if="!trunk.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{trunk.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="id ">{{trunk.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="name ">{{trunk.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{trunk.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{trunk.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="host ">{{trunk.host}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="registry ">{{trunk.registry}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="description ">{{trunk.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(trunk, $event    )" translate="TOOLS.EDIT_TRUNK">\n                          Edit Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(trunk, $event    )" translate="TOOLS.CLONE_TRUNK">\n                          clone Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(trunk, $event    )" translate="TOOLS.GOTOREALTIME_TRUNK">\n                          goToRealtime Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(trunk, $event    )" translate="TOOLS.DELETE_TRUNK">\n                          Delete Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.trunks.count}}" md-on-paginate="vm.getTrunks" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TRUNK TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TRUNK BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-trunk-button" ng-click="vm.createOrEditTrunk($event)" aria-label="add trunk" translate translate-attr-aria-label="TOOLS.ADD_TRUNK">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TRUNK BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/variables/create/dialog.html",'<md-dialog class="variable-dialog" aria-label="New Variable">\n  <form name="variableForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.variable.name" ng-required="true" autofocus>\n\n        <div ng-messages="variableForm[\'name\'].$error" ng-show="variableForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.variable.description">\n\n        <div ng-messages="variableForm[\'description\'].$error" ng-show="variableForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVariable" ng-click="vm.saveVariable()" class="send-button md-accent md-raised" ng-disabled="variableForm.$invalid || variableForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVariable" ng-click="vm.addNewVariable()" class="send-button md-accent md-raised" ng-disabled="variableForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_VARIABLE" translate-attr-aria-label="TOOLS.ADD_VARIABLE">\n          ADD VARIABLE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVariable" ng-click="vm.deleteVariable($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/variables/variables.html",'<div id="variables" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.VARIABLES">Variables</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVariables.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVariables =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-variables-count">\n          <span>{{vm.selectedVariables.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVariables()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVariables()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVariables" csv-label="true" filename="variables.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVariables($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VARIABLE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVariables" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVariables">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.variables.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="variable" md-select-id="id" ng-repeat="variable in vm.variables.rows">\n                <td md-cell ng-if="variable.userpic"><img class="avatar" alt="{{variable.name}}" ng-src="api/users/{{variable.id}}/avatar" /></td>\n                <td md-cell ng-if="!variable.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{variable.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditVariable($event, variable)" md-cell class="id ">{{variable.id}}</td>\n                <td ng-click="vm.createOrEditVariable($event, variable)" md-cell class="name ">{{variable.name}}</td>\n                <td ng-click="vm.createOrEditVariable($event, variable)" md-cell class="description ">{{variable.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(variable, $event    )" translate="TOOLS.EDIT_VARIABLE">\n                          Edit Variable\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(variable, $event    )" translate="TOOLS.DELETE_VARIABLE">\n                          Delete Variable\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.variables.count}}" md-on-paginate="vm.getVariables" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VARIABLE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VARIABLE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-variable-button" ng-click="vm.createOrEditVariable($event)" aria-label="add variable" translate translate-attr-aria-label="TOOLS.ADD_VARIABLE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VARIABLE BUTTON --\x3e\n</div>'),e.put("app/main/apps/video/views/screenRecordings/create/dialog.html",'<md-dialog class="screenRecording-dialog" aria-label="New screenRecording">\n  <form name="screenRecordingForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VIDEO.RATING">Rating</label>\n        <md-select name="rating" ng-model="vm.screenRecording.rating" autofocus ng-disabled="!vm.newscreenRecording && !vm.crudPermissions.canEdit">\n          <md-option ng-value="null">{{\'VIDEO.NO_RATING\' | translate}}</md-option>\n          <md-option value="1">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1]"></md-icon>\n          </md-option>\n          <md-option value="2">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2]"></md-icon>\n          </md-option>\n          <md-option value="3">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3]"></md-icon>\n          </md-option>\n          <md-option value="4">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4]"></md-icon>\n          </md-option>\n          <md-option value="5">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4,5]"></md-icon>\n          </md-option>\n        </md-select>\n        <div ng-messages="screenRecordingForm[\'rating\'].$error" ng-show="screenRecordingForm[rating].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VIDEO.ERRORS.RATING_REQUIRED">Rating field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newscreenRecording" ng-click="vm.savescreenRecording()" class="send-button md-accent md-raised" ng-disabled="screenRecordingForm.$invalid || screenRecordingForm.$pristine" aria-label="SAVE" translate="VIDEO.SAVE" translate-attr-aria-label="VIDEO.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newscreenRecording" ng-click="vm.addNewscreenRecording()" class="send-button md-accent md-raised" ng-disabled="screenRecordingForm.$invalid" aria-label="ADD" translate="VIDEO.ADD_SCREENRECORDING" translate-attr-aria-label="VIDEO.ADD_SCREENRECORDING">\n          ADD SCREENRECORDING\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newscreenRecording" ng-click="vm.deletescreenRecording($event)" aria-label="DELETE" translate translate-attr-aria-label="VIDEO.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VIDEO.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/video/views/screenRecordings/partialViews/play.html",'<md-dialog class="play-dialog" aria-label="play">\n  <form name="playForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="{{ vm.app.toUpperCase() }}.{{  vm.label.toUpperCase() }}">Play Recording</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-disabled="vm.loading" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-hide="vm.loading">\n      <div layout="row" layout-sm flex>\n        \x3c!-- VIRTUAL field --\x3e\n        <md-card>\n\n          <md-card-title ng-if="vm.actionOptions.upperTitle">\n            <md-card-title-text>\n              <span class="md-headline">{{ vm.filename }}</span>\n              <span class="md-subhead"><span translate="{{ vm.app.toUpperCase() }}.UPDATEDAT"></span>: {{ vm.recording.updatedAt}}</span>\n            </md-card-title-text>\n          </md-card-title>\n\n          \x3c!-- video recording directive --\x3e\n          <ms-dialog-recording ng-if="vm.format" id="vm.recording.id" title="vm.filename" element="vm.element" model="vm.route" path="vm.path" class="md-card-image"></ms-dialog-recording>\n          \x3c!-- / video recording directive --\x3e\n\n          <span ng-if="!vm.format">\n            <em ng-if="vm.found">{{ vm.app.toUpperCase() + \'.CANT_PLAY_THIS_FILE\' | translate }}</em>\n            <em ng-if="!vm.found">{{ vm.app.toUpperCase() + \'.FILE_NOT_FOUND\' | translate }}</em>\n          </span>\n\n          <md-card-title ng-if="vm.actionOptions.lowerTitle">\n            <md-card-title-text>\n              <span class="md-headline">{{ vm.filename }}</span>\n              <span class="md-subhead"><span translate="{{ vm.app.toUpperCase() }}.UPDATEDAT"></span>:{{ vm.recording.updatedAt}}</span>\n              <span ng-if="vm.actionOptions.properties" class="md-subhead"><span translate="{{ vm.app.toUpperCase() }}.PROPERTIES"></span>:</span>\n            </md-card-title-text>\n          </md-card-title>\n\n          <md-card-content ng-if="vm.actionOptions.properties">\n            <md-list>\n              <md-list-item class="md-2-line" ng-repeat="(key,value) in vm.properties" ng-click="null" ng-if="key != \'value\' && key != \'updatedAt\' && key != \'queue\'">\n\n                <md-icon ng-if="vm.icon" class="md-avatar-icon" md-font-icon="vm.actionOptions.propertiesIcon" class="s24"></md-icon>\n\n                <div class="md-list-item-text" layout="column">\n                  <p><b><span translate="{{ vm.app.toUpperCase() }}.{{ key.toUpperCase() }}"></span></b></p>\n                  <p>{{ value }}\n                    <p>\n                </div>\n              </md-list-item>\n            </md-list>\n          </md-card-content>\n\n\n        </md-card>\n      </div>\n    </md-dialog-content>\n    <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n      <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n    </div>\n  </form>\n</md-dialog>'),e.put("app/main/apps/video/views/screenRecordings/screenRecordings.html",'<div id="screenRecordings" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-video" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VIDEO.SCREENRECORDINGS">ScreenRecordings</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VIDEO.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getScreenRecordings()"></ms-quick-filter>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedScreenRecordings.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedScreenRecordings =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VIDEO.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-screenRecordings-count">\n          <span>{{vm.selectedScreenRecordings.length}}</span>\n          <span translate="VIDEO.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VIDEO.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllScreenRecordings()" translate="VIDEO.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectScreenRecordings()" translate="VIDEO.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedScreenRecordings" csv-label="true" filename="screenRecordings.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedScreenRecordings($event)" aria-label="delete selected" translate translate-attr-label="VIDEO.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SCREENRECORDING TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedScreenRecordings" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getScreenRecordings">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VIDEO.ID\' | translate }}</th>\n                <th md-column md-order-by="rating">{{ \'VIDEO.RATING\' | translate }}</th>\n                <th md-column md-order-by="UserId">{{ \'VIDEO.AGENT\' | translate }}</th>\n                <th md-column md-order-by="duration">{{ \'VIDEO.DURATION\' | translate }}</th>\n                <th md-column md-order-by="startedAt">{{ \'VIDEO.RECORDSTARTTIME\' | translate }}</th>\n                <th md-column md-order-by="closedAt">{{ \'VIDEO.RECORDENDTIME\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.screenRecordings.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VIDEO.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="screenRecording" md-select-id="id" ng-repeat="screenRecording in vm.screenRecordings.rows">\n                <td md-cell ng-if="screenRecording.userpic"><img class="avatar" alt="{{screenRecording.name}}" ng-src="api/users/{{screenRecording.id}}/avatar" /></td>\n                <td md-cell ng-if="!screenRecording.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{screenRecording.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="id ">{{screenRecording.id}}</td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="rating ">\n                  <md-icon md-font-icon="icon-star" style="color:red" ng-show="screenRecording.rating" ng-repeat="rating in [1,2,3,4,5] | limitTo:screenRecording.rating"></md-icon><span ng-hide="screenRecording.rating" translate="VIDEO.NO_RATING">No rating</span>\n                </td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="UserId ">{{ (vm.users | filter : {\'id\':screenRecording.UserId} : true)[0].fullname }}</td>\n                <td md-cell><span ng-bind="vm.convertDuration(screenRecording.duration)"></span></td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="startedAt ">{{screenRecording.startedAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="closedAt ">{{screenRecording.closedAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VIDEO.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.playrecording(screenRecording, $event  , \'value\'  , \'play_screenrecording\'  , \'video\' )" translate="VIDEO.PLAY_SCREENRECORDING">\n                          play screenRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadScreenRecordings">\n\n                        <md-button ng-click="vm.downloadfile2(screenRecording, $event  , \'screen/recordings\'   )" translate="VIDEO.DOWNLOAD_SCREENRECORDING">\n                          Download screenRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(screenRecording, $event    )" translate="VIDEO.DELETE_SCREENRECORDING">\n                          Delete screenRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VIDEO.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VIDEO.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VIDEO.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.screenRecordings.count}}" md-on-paginate="vm.getScreenRecordings" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SCREENRECORDING TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/routing/dialog.html",'<md-dialog ng-init="vm.init()" class="voice-routing-dialog" aria-label="New routing application">\n  <form name="routingAppForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'VOICE.EDIT_\' + vm.application.appType | uppercase | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-switch="vm.application.appType">\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div ng-switch-when="agi">\n        <div ng-include="\'app/main/apps/voice/routing/views/agi.html\'"></div>\n      </div>\n      <div ng-switch-when="custom">\n        <div ng-include="\'app/main/apps/voice/routing/views/custom.html\'"></div>\n      </div>\n      <div ng-switch-when="dial">\n        <div ng-include="\'app/main/apps/voice/routing/views/dial.html\'"></div>\n      </div>\n      <div ng-switch-when="externalDial">\n        <div ng-include="\'app/main/apps/voice/routing/views/externalDial.html\'"></div>\n      </div>\n      <div ng-switch-when="goTo">\n        <div ng-include="\'app/main/apps/voice/routing/views/goTo.html\'"></div>\n      </div>\n      <div ng-switch-when="hangup">\n        <div ng-include="\'app/main/apps/voice/routing/views/hangup.html\'"></div>\n      </div>\n      <div ng-switch-when="internalDial">\n        <div ng-include="\'app/main/apps/voice/routing/views/internalDial.html\'"></div>\n      </div>\n      <div ng-switch-when="outboundDial">\n        <div ng-include="\'app/main/apps/voice/routing/views/outboundDial.html\'"></div>\n      </div>\n      <div ng-switch-when="playback">\n        <div ng-include="\'app/main/apps/voice/routing/views/playback.html\'"></div>\n      </div>\n      <div ng-switch-when="queue">\n        <div ng-include="\'app/main/apps/voice/routing/views/queue.html\'"></div>\n      </div>\n      <div ng-switch-when="ringGroup">\n        <div ng-include="\'app/main/apps/voice/routing/views/ringGroup.html\'"></div>\n      </div>\n      <div ng-switch-when="set">\n        <div ng-include="\'app/main/apps/voice/routing/views/set.html\'"></div>\n      </div>\n      <div ng-switch-when="voicemail">\n        <div ng-include="\'app/main/apps/voice/routing/views/voicemail.html\'"></div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveRoutingApp()" class="send-button md-accent md-raised" ng-disabled="routingAppForm.$invalid || routingAppForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/routing/interval/dialog.html",'<md-dialog ng-init="vm.initialize()" class="interval-dialog" aria-label="Edit Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'TOOLS.EDIT_INTERVAL\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.crudPermissions.canEdit" ng-change="vm.onTypeChange()">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | startcase }}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.crudPermissions.canEdit" required>\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals.rows" ng-disabled="interval.canSelect === false">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | startcase }}</span></md-option>\n          </md-select>\n        </md-input-container>\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | startcase }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | startcase }}</span></md-option>\n          </md-select>\n        </md-input-container>\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | startcase }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="start center">\n      <md-button type="submit" ng-if="vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/routing/views/agi.html",'<md-input-container class="md-block">\n  <label translate="VOICE.PROJECT">Project</label>\n  <md-select name="project" ng-model="vm.application.project" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'agi://127.0.0.1/square,{{project.name}}\'" ng-repeat="project in vm.projects.rows" ng-disabled="project.canSelect === false">{{ project.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'project\'].$error" ng-show="routingAppForm[\'project\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PROJECT_REQUIRED">Project field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/custom.html",'<md-input-container class="md-block">\n  <label translate="VOICE.APPLICATION_NAME">Application_Name</label>\n  <input type="text" name="app" ng-model="vm.application.app" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'app\'].$error" ng-show="routingAppForm[\'app\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.APPLICATION_NAME_REQUIRED">Application_Name field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.ARGUMENTS">Arguments</label>\n  <input type="text" name="appdata" ng-model="vm.application.appdata" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'appdata\'].$error" ng-show="routingAppForm[\'appdata\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.ARGUMENTS_REQUIRED">Arguments field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/dial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.TECHNOLOGY/RESOURCE">Technology/Resource</label>\n  <input type="text" name="tech" ng-model="vm.application.tech" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'tech\'].$error" ng-show="routingAppForm[\'tech\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TECHNOLOGY/RESOURCE_REQUIRED">Technology/Resource field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/externalDial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.TRUNK">Trunk</label>\n  <md-select name="trunk" ng-model="vm.application.trunk" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="trunk.name" ng-repeat="trunk in vm.trunks.rows" ng-disabled="trunk.canSelect === false">{{\n      trunk.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'trunk\'].$error" ng-show="routingAppForm[\'trunk\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.PHONE">Phone</label>\n  <input type="text" name="phone" ng-model="vm.application.phone" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'phone\'].$error" ng-show="routingAppForm[\'phone\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/goTo.html",'<md-input-container class="md-block">\n  <label translate="VOICE.CONTEXT">Context</label>\n  <md-select name="context" ng-model="vm.application.context" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{\n      context.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'context\'].$error" ng-show="routingAppForm[\'context\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.EXTENSION">Extension</label>\n  <input type="text" name="extension" ng-model="vm.application.extension" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'extension\'].$error" ng-show="routingAppForm[\'extension\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.EXTENSION_REQUIRED">Extension field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.PRIORITY">Priority</label>\n  <input type="text" name="priority" ng-model="vm.application.priority" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'priority\'].$error" ng-show="routingAppForm[\'priority\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/hangup.html","<md-input-container class=\"md-block\">\n  <label translate=\"VOICE.HANGUP_CAUSE\">Hangup_Cause</label>\n  <md-select name=\"appdata\" ng-model=\"vm.application.appdata\" autofocus required ng-disabled=\"!vm.crudPermissions.canEdit\">\n    <md-option ng-value=\"'1'\"> {{ 'VOICE.HANGUPCAUSE_1' | translate }} </md-option>\n    <md-option ng-value=\"'16'\"> {{ 'VOICE.HANGUPCAUSE_16' | translate }} </md-option>\n    <md-option ng-value=\"'17'\"> {{ 'VOICE.HANGUPCAUSE_17' | translate }} </md-option>\n    <md-option ng-value=\"'18'\"> {{ 'VOICE.HANGUPCAUSE_18' | translate }} </md-option>\n    <md-option ng-value=\"'21'\"> {{ 'VOICE.HANGUPCAUSE_21' | translate }} </md-option>\n    <md-option ng-value=\"'22'\"> {{ 'VOICE.HANGUPCAUSE_22' | translate }} </md-option>\n    <md-option ng-value=\"'27'\"> {{ 'VOICE.HANGUPCAUSE_27' | translate }} </md-option>\n    <md-option ng-value=\"'38'\"> {{ 'VOICE.HANGUPCAUSE_38' | translate }} </md-option>\n    <md-option ng-value=\"'41'\"> {{ 'VOICE.HANGUPCAUSE_41' | translate }} </md-option>\n  </md-select>\n  <div ng-messages=\"routingAppForm['appdata'].$error\" ng-show=\"routingAppForm['appdata'].$touched\" role=\"alert\">\n    <div ng-message=\"required\">\n      <span translate=\"VOICE.ERRORS.HANGUP_CAUSE_REQUIRED\">Hangup_Cause field is required</span>\n    </div>\n  </div>\n</md-input-container>"),e.put("app/main/apps/voice/routing/views/internalDial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.USER">User</label>\n  <md-select name="user" ng-model="vm.application.user" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'SIP/{{user.name}}\'" ng-repeat="user in vm.users.rows" ng-disabled="user.canSelect === false">\n      {{ user.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'user\'].$error" ng-show="routingAppForm[\'user\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.USER_REQUIRED">User field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/outboundDial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.TRUNK">Trunk</label>\n  <md-select name="trunk" ng-model="vm.application.trunk" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="trunk.name" ng-repeat="trunk in vm.trunks.rows" ng-disabled="trunk.canSelect === false">{{\n      trunk.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'trunk\'].$error" ng-show="routingAppForm[\'trunk\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.CALLER_ID">Caller_ID</label>\n  <input type="text" name="callerID" ng-model="vm.application.callerID" ng-disabled="!vm.crudPermissions.canEdit">\n  <div class="hint"><span translate="VOICE.HELP.CALLER_ID"></span></div>\n  <div ng-messages="routingAppForm[\'callerID\'].$error" ng-show="routingAppForm[\'callerID\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.CALLER_ID_REQUIRED">Caller_ID field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.PREFIX">Prefix</label>\n  <input type="text" name="prefix" ng-model="vm.application.prefix" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'prefix\'].$error" ng-show="routingAppForm[\'prefix\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TAGS">Tags</label>\n  <md-select name="tag" ng-model="vm.application.tag" ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'--\'">None</md-option>\n    <md-option ng-value="tag.name" ng-repeat="tag in vm.tags.rows" ng-disabled="tag.canSelect === false">{{ tag.name }}\n    </md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'tag\'].$error" ng-show="routingAppForm[\'tag\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TAGS_REQUIRED">Tags field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/playback.html",'<md-input-container class="md-block">\n  <label translate="VOICE.AUDIO_FILES">Audio_Files</label>\n  <md-select name="sound" ng-model="vm.application.appdata" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/{{sound.save_name}}\'" ng-repeat="sound in vm.sounds.rows" ng-disabled="sound.canSelect === false">{{ sound.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'sound\'].$error" ng-show="routingAppForm[\'sound\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.AUDIO_FILES_REQUIRED">Audio_Files field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <md-switch ng-model="vm.application.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</span></md-switch>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/queue.html",'<md-input-container class="md-block">\n  <label translate="VOICE.QUEUE">Queue</label>\n  <md-select name="queue" ng-model="vm.application.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="queue.name" ng-repeat="queue in vm.queues.rows" ng-disabled="queue.canSelect === false">{{\n      queue.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'queue\'].$error" ng-show="routingAppForm[\'queue\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="URL" ng-model="vm.application.URL" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'URL\'].$error" ng-show="routingAppForm[\'URL\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.ANNOUNCE_OVERRIDES">Announce_Overrides</label>\n  <md-select name="sound" ng-model="vm.application.sound" ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'\'">None</md-option>\n    <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/{{sound.save_name}}\'" ng-repeat="sound in vm.sounds.rows" ng-disabled="sound.canSelect === false">{{ sound.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'sound\'].$error" ng-show="routingAppForm[\'sound\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.ANNOUNCE_OVERRIDES_REQUIRED">Announce_Overrides field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.AGI">Agi</label>\n  <input type="text" name="agi" ng-model="vm.application.agi" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'agi\'].$error" ng-show="routingAppForm[\'agi\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.AGI_REQUIRED">Agi field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.MACRO">Macro</label>\n  <input type="text" name="macro" ng-model="vm.application.macro" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'macro\'].$error" ng-show="routingAppForm[\'macro\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.MACRO_REQUIRED">Macro field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.GOSUB">GoSub</label>\n  <input type="text" name="gosub" ng-model="vm.application.gosub" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'gosub\'].$error" ng-show="routingAppForm[\'gosub\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.GOSUB_REQUIRED">GoSub field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.RULE">Rule</label>\n  <input type="text" name="rule" ng-model="vm.application.rule" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'rule\'].$error" ng-show="routingAppForm[\'rule\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.RULE_REQUIRED">Rule field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.POSITION">Position</label>\n  <input type="number" name="position" ng-model="vm.application.position" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'position\'].$error" ng-show="routingAppForm[\'position\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.POSITION_REQUIRED">Position field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.POSITION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Position must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <md-switch ng-model="vm.application.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</span></md-switch>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/ringGroup.html",'<md-input-container class="md-block">\n  <label translate="VOICE.USER">User</label>\n  <md-select name="user" ng-model="vm.application.users" autofocus multiple required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'SIP/{{user.name}}\'" ng-repeat="user in vm.users.rows" ng-disabled="user.canSelect === false">\n      {{ user.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'user\'].$error" ng-show="routingAppForm[\'user\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.USER_REQUIRED">User field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/set.html",'<md-input-container class="md-block">\n  <label translate="VOICE.VARIABLE">Variable</label>\n  <md-select name="variable" ng-model="vm.application.name" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="variable.name" ng-repeat="variable in vm.variables.rows" ng-disabled="variable.canSelect === false">{{\n      variable.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'variable\'].$error" ng-show="routingAppForm[\'variable\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.VALUE">Value</label>\n  <input type="text" name="value" ng-model="vm.application.value" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'value\'].$error" ng-show="routingAppForm[\'value\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.VALUE_REQUIRED">Value field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/voicemail.html",'<md-input-container class="md-block">\n  <label translate="VOICE.MAILBOX@CONTEXT">Mailbox@Context</label>\n  <md-select name="voiceMail" ng-model="vm.application.voiceMail" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'{{voiceMail.mailbox}}@from-voicemail\'" ng-repeat="voiceMail in vm.voiceMails.rows" ng-disabled="voiceMail.canSelect === false">{{ voiceMail.mailbox }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'voiceMail\'].$error" ng-show="routingAppForm[\'voiceMail\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.MAILBOX@CONTEXT_REQUIRED">Mailbox@Context field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/views/chanSpies/chanSpies.html",'<div id="chanSpies" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.CHANSPIES">ChanSpies</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedChanSpies.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedChanSpies =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-chanSpies-count">\n          <span>{{vm.selectedChanSpies.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllChanSpies()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectChanSpies()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedChanSpies" csv-label="true" filename="chanSpies.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedChanSpies($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CHANSPY TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedChanSpies" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChanSpies">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="prefix">{{ \'VOICE.PREFIX\' | translate }}</th>\n                <th md-column md-order-by="auth">{{ \'VOICE.AUTH\' | translate }}</th>\n                <th md-column md-order-by="record">{{ \'VOICE.RECORD\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.chanSpies.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="chanSpy" md-select-id="id" ng-repeat="chanSpy in vm.chanSpies.rows">\n                <td md-cell ng-if="chanSpy.userpic"><img class="avatar" alt="{{chanSpy.name}}" ng-src="api/users/{{chanSpy.id}}/avatar" /></td>\n                <td md-cell ng-if="!chanSpy.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{chanSpy.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="id ">{{chanSpy.id}}</td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="name ">{{chanSpy.name}}</td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="prefix ">{{chanSpy.prefix}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chanSpy, ev) : vm.createOrEditchanSpy($event, chanSpy)" md-cell class="auth ">\n                  <md-icon md-colors="{color: {{chanSpy.auth ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{chanSpy.auth ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chanSpy, ev) : vm.createOrEditchanSpy($event, chanSpy)" md-cell class="record ">\n                  <md-icon md-colors="{color: {{chanSpy.record ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{chanSpy.record ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="description ">{{chanSpy.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(chanSpy, $event    )" translate="VOICE.EDIT_CHANSPY">\n                          Edit chanSpy\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(chanSpy, $event    )" translate="VOICE.DELETE_CHANSPY">\n                          Delete chanSpy\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chanSpies.count}}" md-on-paginate="vm.getChanSpies" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CHANSPY TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CHANSPY BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-chanSpy-button" ng-click="vm.createOrEditchanSpy($event)" aria-label="add chanSpy" translate translate-attr-aria-label="VOICE.ADD_CHANSPY">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CHANSPY BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/chanSpies/create/dialog.html",'<md-dialog class="chanSpy-dialog" aria-label="New chanSpy">\n  <form name="chanSpyForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.chanSpy.name" ng-required="true" autofocus>\n\n        <div ng-messages="chanSpyForm[\'name\'].$error" ng-show="chanSpyForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PREFIX">Prefix</label>\n        <input type="text" name="prefix" ng-model="vm.chanSpy.prefix" ng-required="true">\n\n        <div ng-messages="chanSpyForm[\'prefix\'].$error" ng-show="chanSpyForm[\'prefix\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.OPTIONS">Options</label>\n        <md-select name="options" ng-model="vm.chanSpy.options" multiple required>\n          <md-option ng-value="\'b\'">b: Only spy on channels involved in a bridged call.</md-option>\n          <md-option ng-value="\'B\'">B: Instead of whispering on a single channel barge in on both channels involved in the call.</md-option>\n          <md-option ng-value="\'E\'">E: Exit when the spied-on channel hangs up.</md-option>\n          <md-option ng-value="\'o\'">o: Only listen to audio coming from this channel.</md-option>\n          <md-option ng-value="\'q\'">q: Don\'t play a beep when beginning to spy on a channel, or speak the selected channel name.</md-option>\n          <md-option ng-value="\'s\'">s: Skip the playback of the channel type (i.e. SIP, IAX, etc) when speaking the selected channel name.</md-option>\n          <md-option ng-value="\'S\'">S: Stop when no more channels are left to spy on.</md-option>\n          <md-option ng-value="\'w\'">w: Enable whisper mode, so the spying channel can talk to the spied-on channel.</md-option>\n          <md-option ng-value="\'W\'">W: Enable private whisper mode, so the spying channel can talk to the spied-on channel but cannot listen to that channel.</md-option>\n        </md-select>\n        <div ng-messages="chanSpyForm[\'options\'].$error" ng-show="chanSpyForm[\'options\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.chanSpy.auth" aria-label="Auth"><span translate="VOICE.AUTH">Auth</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.chanSpy.auth">\n        <label translate="VOICE.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.chanSpy.password" placeholder="Password" translate translate-attr-placeholder="VOICE.PASSWORD" required>\n        <div ng-messages="chanSpyForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.chanSpy.record" aria-label="Record"><span translate="VOICE.RECORD">Record</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.chanSpy.record" class="md-block">\n        <label translate="VOICE.RECORDINGFORMAT">recordingFormat</label>\n        <md-select name="recordingFormat" ng-model="vm.chanSpy.recordingFormat" required>\n          <md-option ng-value="\'wav\'">wav</md-option>\n          <md-option ng-value="\'gsm\'">gsm</md-option>\n          <md-option ng-value="\'WAV\'">wav49</md-option>\n        </md-select>\n        <div ng-messages="chanSpyForm[\'recordingFormat\'].$error" ng-show="chanSpyForm[\'recordingFormat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.RECORDINGFORMAT_REQUIRED">recordingFormat field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chanSpy.description">\n\n        <div ng-messages="chanSpyForm[\'description\'].$error" ng-show="chanSpyForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newchanSpy" ng-click="vm.savechanSpy()" class="send-button md-accent md-raised" ng-disabled="chanSpyForm.$invalid || chanSpyForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newchanSpy" ng-click="vm.addNewchanSpy()" class="send-button md-accent md-raised" ng-disabled="chanSpyForm.$invalid" aria-label="ADD" translate="VOICE.ADD_CHANSPY" translate-attr-aria-label="VOICE.ADD_CHANSPY">\n          ADD CHANSPY\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newchanSpy" ng-click="vm.deletechanSpy($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/contexts/contexts.html",'<div id="contexts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.CONTEXTS">Contexts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedContexts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedContexts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-contexts-count">\n          <span>{{vm.selectedContexts.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllContexts()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectContexts()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedContexts" csv-label="true" filename="contexts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedContexts($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CONTEXT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedContexts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContexts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.contexts.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="context" md-select-id="id" ng-repeat="context in vm.contexts.rows">\n                <td md-cell ng-if="context.userpic"><img class="avatar" alt="{{context.name}}" ng-src="api/users/{{context.id}}/avatar" /></td>\n                <td md-cell ng-if="!context.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{context.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditContext($event, context)" md-cell class="id ">{{context.id}}</td>\n                <td ng-click="vm.createOrEditContext($event, context)" md-cell class="name ">{{context.name}}</td>\n                <td ng-click="vm.createOrEditContext($event, context)" md-cell class="description ">{{context.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(context, $event    )" translate="VOICE.EDIT_CONTEXT">\n                          Edit Context\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(context, $event    )" translate="VOICE.DELETE_CONTEXT">\n                          Delete Context\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contexts.count}}" md-on-paginate="vm.getContexts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CONTEXT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CONTEXT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-context-button" ng-click="vm.createOrEditContext($event)" aria-label="add context" translate translate-attr-aria-label="VOICE.ADD_CONTEXT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CONTEXT BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/contexts/create/dialog.html",'<md-dialog class="context-dialog" aria-label="New Context">\n  <form name="contextForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.context.name" ng-required="true" autofocus>\n\n        <div ng-messages="contextForm[\'name\'].$error" ng-show="contextForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.context.description">\n\n        <div ng-messages="contextForm[\'description\'].$error" ng-show="contextForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newContext" ng-click="vm.saveContext()" class="send-button md-accent md-raised" ng-disabled="contextForm.$invalid || contextForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newContext" ng-click="vm.addNewContext()" class="send-button md-accent md-raised" ng-disabled="contextForm.$invalid" aria-label="ADD" translate="VOICE.ADD_CONTEXT" translate-attr-aria-label="VOICE.ADD_CONTEXT">\n          ADD CONTEXT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newContext" ng-click="vm.deleteContext($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/inboundRoutes/create/dialog.html",'<md-dialog ng-init="vm.initialize()" class="inbound-route-dialog" aria-label="New InboundRoute">\n  <form name="inboundrouteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newInboundRoute ? \'VOICE.NEW_INBOUNDROUTE\' : \'VOICE.EDIT_INBOUNDROUTE\' | translate\n          }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n        <input type="text" name="exten" ng-model="vm.inboundRoute.exten" ng-required="true" autofocus>\n        <div ng-messages="inboundrouteForm[\'exten\'].$error" ng-show="inboundrouteForm[\'exten\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CONTEXT">Context</label>\n        <md-select name="context" ng-model="vm.inboundRoute.context" required>\n          <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n        </md-select>\n        <div ng-messages="inboundrouteForm[\'context\'].$error" ng-show="inboundrouteForm[\'context\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.inboundRoute.alias" ng-change="vm.getRouting()">\n        <div ng-messages="inboundrouteForm[\'alias\'].$error" ng-show="inboundrouteForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.inboundRoute.description">\n        <div ng-messages="inboundrouteForm[\'description\'].$error" ng-show="inboundrouteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInboundRoute" ng-click="vm.saveInboundRoute()" class="send-button md-accent md-raised" ng-disabled="inboundrouteForm.$invalid || inboundrouteForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInboundRoute" ng-click="vm.addNewInboundRoute()" class="send-button md-accent md-raised" ng-disabled="inboundrouteForm.$invalid" aria-label="ADD" translate="VOICE.ADD_INBOUNDROUTE" translate-attr-aria-label="VOICE.ADD_INBOUNDROUTE">\n          ADD INBOUNDROUTE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInboundRoute" ng-click="vm.deleteInboundRoute($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/inboundRoutes/edit/view.html",'<div ng-init="vm.onInit()" id="voice-inbound-route" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-inbound-routes-button md-icon-button" aria-label="Go to inbound routes" ng-click="vm.gotoInboundRoutes()" translate translate-attr-aria-label="VOICE.GO_TO_INBOUNDROUTES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="inbound-route-image" hide-xs>\n          <img ng-src="assets/images/business/inboundroutes.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.inboundRoute.id}}\n            <span ng-if="vm.inboundRoute.exten">{{vm.inboundRoute.exten}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.inboundRoute.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveInboundRoute()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (actionsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- /HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      \x3c!-- SETTINGS TAB --\x3e\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="inbound-route-detail-form-container md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.inboundRoute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'exten\'].$error" ng-show="generalForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.inboundRoute.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.inboundRoute.alias" ng-change="vm.onActionsTabSelection()" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'alias\'].$error" ng-show="generalForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.inboundRoute.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /SETTINGS TAB --\x3e\n      \x3c!-- ACTIONS TAB --\x3e\n      <md-tab md-on-select="vm.onActionsTabSelection()">\n        <md-tab-label>\n          <span translate="VOICE.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="inbound-route-detail-form-container no-padding no-margin">\n            <div class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- APPLICATIONS LIST --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm.crudPermissions.canEdit">\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider class="no-margin"></md-divider>\n                <md-list ng-sortable="vm.sortableAppsOptions">\n                  <md-list-item class="handle" ng-repeat="a in vm.apps">\n                    <div layout="row">\n                      <md-icon md-font-icon="icon-apps" class="s16 mr-15"></md-icon>\n                      <p class="text-truncate" translate="VOICE.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias ||\n                        a.appType}}</p>\n                    </div>\n                  </md-list-item>\n                </md-list>\n              </div>\n              \x3c!-- /APPLICATIONS LIST --\x3e\n              <div flex></div>\n              \x3c!-- ROUTING --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm.crudPermissions.canEdit ? 75 : 100}}">\n                <div ng-if="vm.pendingChanges" class="p-10 md-amber-300-bg">\n                  <md-icon md-font-icon="icon-information-outline" aria-label="Save reminder"></md-icon>\n                  <span class="no-margin font-size-12 line-height-30" translate="VOICE.HELP.SAVE_ROUTES"></span>\n                </div>\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar query="vm.query" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm.selectedApplications.length}}\n                      {{vm.selectedApplications.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedApplications($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm.selectedApplications">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm.sortableRoutingOptions">\n                      <tr md-row md-select="a" md-select-id="id" ng-repeat="a in vm.applications.rows | filter:vm.query.filter as results">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)">{{a.app.toLowerCase() ===\n                          \'agi\' ? \'Cally-Square\' : a.app | ucfirst}}<span ng-if="a.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)"><span class="text-truncate actionAppData">{{a.appdata}}</span></td>\n                        <td md-cell ng-click="vm.editInterval($event, $index)">{{a.IntervalId ? \'From List\' :\n                          a.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{a.IntervalId ? \'From List\' : (a.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell ng-if="!vm.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editApplication($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                <md-button ng-click="vm.deleteApplication(a, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-class="{ \'ng-cloak\': results.length > 0 }">\n                        <td md-cell colspan="6">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No applications\n                            available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                    <tfoot md-foot>\n                      <tr md-row>\n                        <td md-cell colspan="7">\n                          <span><em translate="VOICE.LEGEND.CUSTOM_APPLICATION">(*) - Custom application.</em></span>\n                        </td>\n                      </tr>\n                    </tfoot>\n                  </table>\n                </md-table-container>\n              </div>\n              \x3c!-- /ROUTING --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /ACTIONS TAB --\x3e\n    </md-tabs>\n  </div>\n  \x3c!-- /CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/inboundRoutes/inboundRoutes.html",'<div id="inbound-routes" class="page-layout simple left-sidenav inner-sidenav">\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.INBOUNDROUTES">InboundRoutes</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n  <div ng-show="vm.selectedInboundRoutes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedInboundRoutes = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-inbound-routes-count">\n          <span>{{ vm.selectedInboundRoutes.length }}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInboundRoutes = vm.inboundRoutes.rows" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInboundRoutes = []" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedInboundRoutes" csv-label="true" filename="inbound_routes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedInboundRoutes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedInboundRoutes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getInboundRoutes">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.PHONENUMBER\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.inboundRoutes.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="route" md-select-id="id" ng-repeat="route in vm.inboundRoutes.rows">\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInboundRoute($event, route)" md-cell class="id ">{{ route.id }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInboundRoute($event, route)" md-cell class="exten ">{{ route.exten }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInboundRoute($event, route)" md-cell class="description ">{{ route.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editRoute(route)" translate="VOICE.EDIT_INBOUNDROUTE">\n                          Edit InboundRoute\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteConfirm(route, $event)" translate="VOICE.DELETE_INBOUNDROUTE">\n                          Delete InboundRoute\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'VOICE.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'VOICE.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'VOICE.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.inboundRoutes.count }}" md-on-paginate="vm.getInboundRoutes" md-page-select>\n        </md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-inbound-route-button" ng-click="vm.createOrEditInboundRoute($event)" aria-label="add inbound route" translate translate-attr-aria-label="VOICE.ADD_INBOUNDROUTE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n</div>'),e.put("app/main/apps/voice/views/internalRoutes/create/dialog.html",'<md-dialog ng-init="vm.initialize()" class="internal-route-dialog" aria-label="New InternalRoute">\n  <form name="internalrouteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newInternalRoute ? \'VOICE.NEW_INTERNALROUTE\' : \'VOICE.EDIT_INTERNALROUTE\' | translate\n          }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n        <input type="text" name="exten" ng-model="vm.internalRoute.exten" ng-required="true" autofocus>\n        <div ng-messages="internalrouteForm[\'exten\'].$error" ng-show="internalrouteForm[\'exten\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CONTEXT">Context</label>\n        <md-select name="context" ng-model="vm.internalRoute.context" required>\n          <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n        </md-select>\n        <div ng-messages="internalrouteForm[\'context\'].$error" ng-show="internalrouteForm[\'context\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.internalRoute.alias" ng-change="vm.getRouting()">\n        <div ng-messages="internalrouteForm[\'alias\'].$error" ng-show="internalrouteForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.internalRoute.description">\n        <div ng-messages="internalrouteForm[\'description\'].$error" ng-show="internalrouteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInternalRoute" ng-click="vm.saveInternalRoute()" class="send-button md-accent md-raised" ng-disabled="internalrouteForm.$invalid || internalrouteForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInternalRoute" ng-click="vm.addNewInternalRoute()" class="send-button md-accent md-raised" ng-disabled="internalrouteForm.$invalid" aria-label="ADD" translate="VOICE.ADD_INTERNALROUTE" translate-attr-aria-label="VOICE.ADD_INTERNALROUTE">\n          ADD INTERNALROUTE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInternalRoute" ng-click="vm.deleteInternalRoute($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/internalRoutes/edit/view.html",'<div ng-init="vm.onInit()" id="voice-internal-route" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-internal-routes-button md-icon-button" aria-label="Go to internal routes" ng-click="vm.gotoInternalRoutes()" translate translate-attr-aria-label="VOICE.GO_TO_INTERNALROUTES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="internal-route-image" hide-xs>\n          <img ng-src="assets/images/business/internalroutes.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.internalRoute.id}}\n            <span ng-if="vm.internalRoute.exten">{{vm.internalRoute.exten}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.internalRoute.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveInternalRoute()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (actionsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- /HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      \x3c!-- SETTINGS TAB --\x3e\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="internal-route-detail-form-container md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.internalRoute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'exten\'].$error" ng-show="generalForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.internalRoute.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.internalRoute.alias" ng-change="vm.onActionsTabSelection()" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'alias\'].$error" ng-show="generalForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.internalRoute.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /SETTINGS TAB --\x3e\n      \x3c!-- ACTIONS TAB --\x3e\n      <md-tab md-on-select="vm.onActionsTabSelection()">\n        <md-tab-label>\n          <span translate="VOICE.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="internal-route-detail-form-container no-padding no-margin">\n            <div class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- APPLICATIONS LIST --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm.crudPermissions.canEdit">\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider class="no-margin"></md-divider>\n                <md-list ng-sortable="vm.sortableAppsOptions">\n                  <md-list-item class="handle" ng-repeat="a in vm.apps">\n                    <div layout="row">\n                      <md-icon md-font-icon="icon-apps" class="s16 mr-15"></md-icon>\n                      <p class="text-truncate" translate="VOICE.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias ||\n                        a.appType}}</p>\n                    </div>\n                  </md-list-item>\n                </md-list>\n              </div>\n              \x3c!-- /APPLICATIONS LIST --\x3e\n              <div flex></div>\n              \x3c!-- ROUTING --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm.crudPermissions.canEdit ? 75 : 100}}">\n                <div ng-if="vm.pendingChanges" class="p-10 md-amber-300-bg">\n                  <md-icon md-font-icon="icon-information-outline" aria-label="Save reminder"></md-icon>\n                  <span class="no-margin font-size-12 line-height-30" translate="VOICE.HELP.SAVE_ROUTES"></span>\n                </div>\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar query="vm.query" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm.selectedApplications.length}}\n                      {{vm.selectedApplications.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedApplications($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm.selectedApplications">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm.sortableRoutingOptions">\n                      <tr md-row md-select="a" md-select-id="id" ng-repeat="a in vm.applications.rows | filter:vm.query.filter as results">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)">{{a.app.toLowerCase() ===\n                          \'agi\' ? \'Cally-Square\' : a.app | ucfirst}}<span ng-if="a.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)"><span class="text-truncate actionAppData">{{a.appdata}}</span></td>\n                        <td md-cell ng-click="vm.editInterval($event, $index)">{{a.IntervalId ? \'From List\' :\n                          a.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{a.IntervalId ? \'From List\' : (a.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell ng-if="!vm.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editApplication($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                <md-button ng-click="vm.deleteApplication(a, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-class="{ \'ng-cloak\': results.length > 0 }">\n                        <td md-cell colspan="6">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No applications\n                            available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                    <tfoot md-foot>\n                      <tr md-row>\n                        <td md-cell colspan="7">\n                          <span><em translate="VOICE.LEGEND.CUSTOM_APPLICATION">(*) - Custom application.</em></span>\n                        </td>\n                      </tr>\n                    </tfoot>\n                  </table>\n                </md-table-container>\n              </div>\n              \x3c!-- /ROUTING --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /ACTIONS TAB --\x3e\n    </md-tabs>\n  </div>\n  \x3c!-- /CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/internalRoutes/internalRoutes.html",'<div id="internal-routes" class="page-layout simple left-sidenav inner-sidenav">\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.INTERNALROUTES">InternalRoutes</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n  <div ng-show="vm.selectedInternalRoutes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedInternalRoutes = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-internal-routes-count">\n          <span>{{ vm.selectedInternalRoutes.length }}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInternalRoutes = vm.internalRoutes.rows" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInternalRoutes = []" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedInternalRoutes" csv-label="true" filename="internal_routes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedInternalRoutes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedInternalRoutes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getInternalRoutes">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.PHONENUMBER\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.internalRoutes.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="route" md-select-id="id" ng-repeat="route in vm.internalRoutes.rows">\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInternalRoute($event, route)" md-cell class="id ">{{ route.id }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInternalRoute($event, route)" md-cell class="exten ">{{ route.exten }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInternalRoute($event, route)" md-cell class="description ">{{ route.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editRoute(route)" translate="VOICE.EDIT_INTERNALROUTE">\n                          Edit InternalRoute\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteConfirm(route, $event)" translate="VOICE.DELETE_INTERNALROUTE">\n                          Delete InternalRoute\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'VOICE.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'VOICE.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'VOICE.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.internalRoutes.count }}" md-on-paginate="vm.getInternalRoutes" md-page-select>\n        </md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-internal-route-button" ng-click="vm.createOrEditInternalRoute($event)" aria-label="add internal route" translate translate-attr-aria-label="VOICE.ADD_INTERNALROUTE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n</div>'),e.put("app/main/apps/voice/views/musiconholds/create/dialog.html",'<md-dialog class="musiconhold-dialog" aria-label="New MusicOnHold">\n  <form name="musiconholdForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.musiconhold.name" ng-required="true" autofocus ng-disabled="!vm.newMusicOnHold">\n\n        <div ng-messages="musiconholdForm[\'name\'].$error" ng-show="musiconholdForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.MODE">Mode</label>\n        <md-select name="mode" ng-model="vm.musiconhold.mode" required ng-disabled="!vm.newMusicOnHold">\n\n          <md-option ng-value="\'files\'"> {{ \'VOICE.FILES\' | translate }} </md-option>\n\n          <md-option ng-value="\'custom\'"> {{ \'VOICE.CUSTOM\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="musiconholdForm[\'mode\'].$error" ng-show="musiconholdForm[\'mode\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.MODE_REQUIRED">Mode field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n        <label translate="VOICE.DIRECTORY">Directory</label>\n        <input type="" name="directory" ng-model="vm.musiconhold.directory">\n\n        <div ng-messages="musiconholdForm[\'directory\'].$error" ng-show="musiconholdForm[\'directory\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DIRECTORY_REQUIRED">Directory field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n        <label translate="VOICE.APPLICATION">Application</label>\n        <input type="text" name="application" ng-model="vm.musiconhold.application" ng-required="true">\n\n        <div ng-messages="musiconholdForm[\'application\'].$error" ng-show="musiconholdForm[\'application\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.APPLICATION_REQUIRED">Application field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.musiconhold.mode == \'files\'" class="md-block">\n        <label translate="VOICE.SORT">Sort</label>\n        <md-select name="sort" ng-model="vm.musiconhold.sort">\n\n          <md-option ng-value="\'random\'"> {{ \'VOICE.RANDOM\' | translate }} </md-option>\n\n          <md-option ng-value="\'alpha\'"> {{ \'VOICE.ALPHABETICAL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="musiconholdForm[\'sort\'].$error" ng-show="musiconholdForm[\'sort\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.SORT_REQUIRED">Sort field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMusicOnHold" ng-click="vm.saveMusicOnHold()" class="send-button md-accent md-raised" ng-disabled="musiconholdForm.$invalid || musiconholdForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMusicOnHold" ng-click="vm.addNewMusicOnHold()" class="send-button md-accent md-raised" ng-disabled="musiconholdForm.$invalid" aria-label="ADD" translate="VOICE.ADD_MUSICONHOLD" translate-attr-aria-label="VOICE.ADD_MUSICONHOLD">\n          ADD MUSICONHOLD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMusicOnHold" ng-click="vm.deleteMusicOnHold($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/musiconholds/edit/mohSounds/dialog.html",'<md-dialog class="mohSound-dialog" aria-label="New MohSound">\n  <form name="mohSoundForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.FILE">File</label>\n        <md-select name="id" ng-model="vm.mohSound.id" autofocus>\n          <md-option ng-value="id.id" ng-repeat="id in vm.sounds" ng-disabled="id.canSelect === false">{{ id.name }}</md-option>\n        </md-select>\n        <div ng-messages="mohSoundForm[\'id\'].$error" ng-show="mohSoundForm[\'id\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.FILE_REQUIRED">File field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMohSound" ng-click="vm.saveMohSound()" class="send-button md-accent md-raised" ng-disabled="mohSoundForm.$invalid || mohSoundForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMohSound" ng-click="vm.addNewMohSound()" class="send-button md-accent md-raised" ng-disabled="mohSoundForm.$invalid" aria-label="ADD" translate="VOICE.ADD_MOHSOUND" translate-attr-aria-label="VOICE.ADD_MOHSOUND">\n          ADD MOHSOUND\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMohSound" ng-click="vm.deleteMohSound($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/musiconholds/edit/view.html",'<div id="voice-musiconhold" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-musiconholds-button md-icon-button" aria-label="Go to musiconholds" ng-click="vm.gotoMusicOnHolds()" translate translate-attr-aria-label="VOICE.GO_TO_MUSICONHOLDS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="musiconhold-image" hide-xs>\n          <img ng-src="assets/images/business/musiconholds.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.musiconhold.id}}\n            <span ng-if="vm.musiconhold.name">{{vm.musiconhold.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.musiconhold.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveMusicOnHold()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (mohSoundsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="musiconhold-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.musiconhold.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MODE">Mode</label>\n                <md-select name="mode" ng-model="vm.musiconhold.mode" required disabled>\n\n                  <md-option ng-value="\'files\'"> {{ \'VOICE.FILES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'custom\'"> {{ \'VOICE.CUSTOM\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'mode\'].$error" ng-show="generalForm[\'mode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MODE_REQUIRED">Mode field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n                <label translate="VOICE.DIRECTORY">Directory</label>\n                <input type="" name="directory" ng-model="vm.musiconhold.directory" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'directory\'].$error" ng-show="generalForm[\'directory\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DIRECTORY_REQUIRED">Directory field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n                <label translate="VOICE.APPLICATION">Application</label>\n                <input type="text" name="application" ng-model="vm.musiconhold.application" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'application\'].$error" ng-show="generalForm[\'application\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.APPLICATION_REQUIRED">Application field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.musiconhold.mode == \'files\'" class="md-block">\n                <label translate="VOICE.SORT">Sort</label>\n                <md-select name="sort" ng-model="vm.musiconhold.sort" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'random\'"> {{ \'VOICE.RANDOM\' | translate }} </md-option>\n\n                  <md-option ng-value="\'alpha\'"> {{ \'VOICE.ALPHABETICAL\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'sort\'].$error" ng-show="generalForm[\'sort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SORT_REQUIRED">Sort field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.AUDIOFILES">AUDIOFILES</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="musiconhold-detail-form-container mohsounds md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MusicOnHoldMohSoundsController as vm_dc" ng-init="vm_dc.init(vm.musiconhold, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMusicOnHoldMohSounds.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="VOICE.MOHSOUNDS">MohSounds</span>\n                  <ms-search-bar on-search="vm_dc.getMusicOnHoldMohSounds()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditMusicOnHoldMohSound($event)" aria-label="add mohSound" translate translate-attr-label="VOICE.ADD_MOHSOUND">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedMusicOnHoldMohSounds.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedMusicOnHoldMohSounds.length}} {{vm_dc.selectedMusicOnHoldMohSounds.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedMusicOnHoldMohSounds" csv-label="true" filename="musiconholds.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedMusicOnHoldMohSounds($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedMusicOnHoldMohSounds" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getMusicOnHoldMohSounds">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'VOICE.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="audio">\n                        {{ \'VOICE.AUDIO\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'VOICE.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="mohSound" md-select-id="id" ng-repeat="mohSound in vm_dc.musiconholdMohSounds.rows">\n                      <td md-cell>\n                        {{mohSound.id}}\n                      </td>\n                      <td md-cell>\n                        \x3c!-- audio recording directive --\x3e\n                        <ms-recording id="mohSound.id" model="\'sound\'"></ms-recording>\n                        \x3c!-- / audio recording directive --\x3e\n                      </td>\n                      <td md-cell>\n                        {{ mohSound.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(mohSound, $event)" translate="VOICE.DELETE_MOHSOUND">\n                                Delete MohSound\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.musiconholdMohSounds.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="VOICE.NO_MOHSOUND_AVAILABLE">No mohsound available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.musiconholdMohSounds.count}}" md-on-paginate="vm_dc.getMusicOnHoldMohSounds" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/musiconholds/musiconholds.html",'<div id="musiconholds" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.MUSICONHOLDS">MusicOnHolds</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMusicOnHolds.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMusicOnHolds =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-musiconholds-count">\n          <span>{{vm.selectedMusicOnHolds.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMusicOnHolds()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMusicOnHolds()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMusicOnHolds" csv-label="true" filename="musiconholds.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMusicOnHolds($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- MUSICONHOLD TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMusicOnHolds" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMusicOnHolds">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="mode">{{ \'VOICE.MODE\' | translate }}</th>\n                <th md-column md-order-by="sort">{{ \'VOICE.SORT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.musiconholds.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="musiconhold" md-select-id="id" ng-repeat="musiconhold in vm.musiconholds.rows">\n                <td md-cell ng-if="musiconhold.userpic"><img class="avatar" alt="{{musiconhold.name}}" ng-src="api/users/{{musiconhold.id}}/avatar" /></td>\n                <td md-cell ng-if="!musiconhold.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{musiconhold.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="id ">{{musiconhold.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="name ">{{musiconhold.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="mode ">{{ \'VOICE.\' + vm.arraymode[musiconhold.mode].option | uppercase | translate }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="sort ">{{ \'VOICE.\' + vm.arraysort[musiconhold.sort].option | uppercase | translate }}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(musiconhold, $event    )" translate="VOICE.EDIT_MUSICONHOLD">\n                          Edit MusicOnHold\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(musiconhold, $event    )" translate="VOICE.DELETE_MUSICONHOLD">\n                          Delete MusicOnHold\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.musiconholds.count}}" md-on-paginate="vm.getMusicOnHolds" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / MUSICONHOLD TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD MUSICONHOLD BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-musiconhold-button" ng-click="vm.createOrEditMusicOnHold($event)" aria-label="add musiconhold" translate translate-attr-aria-label="VOICE.ADD_MUSICONHOLD">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD MUSICONHOLD BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/outboundRoutes/create/dialog.html",'<md-dialog ng-init="vm.initialize()" class="outbound-route-dialog" aria-label="New OutboundRoute">\n  <form name="outboundrouteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newOutboundRoute ? \'VOICE.NEW_OUTBOUNDROUTE\' : \'VOICE.EDIT_OUTBOUNDROUTE\' | translate\n          }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n        <input type="text" name="exten" ng-model="vm.outboundRoute.exten" ng-required="true" autofocus>\n        <div ng-messages="outboundrouteForm[\'exten\'].$error" ng-show="outboundrouteForm[\'exten\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CONTEXT">Context</label>\n        <md-select name="context" ng-model="vm.outboundRoute.context" required>\n          <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n        </md-select>\n        <div ng-messages="outboundrouteForm[\'context\'].$error" ng-show="outboundrouteForm[\'context\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.RECORDING">Recording</label>\n        <md-select name="recordingFormat" ng-model="vm.outboundRoute.recordingFormat" ng-change="vm.getRouting()" required>\n          <md-option ng-value="\'none\'">none</md-option>\n          <md-option ng-value="\'wav\'">wav</md-option>\n          <md-option ng-value="\'WAV\'">wav49</md-option>\n          <md-option ng-value="\'gsm\'">gsm</md-option>\n        </md-select>\n        <div class="hint"><span translate="VOICE.HELP.RECORDING"></span></div>\n        <div ng-messages="outboundrouteForm[\'recordingFormat\'].$error" ng-show="outboundrouteForm[\'recordingFormat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.RECORDING_REQUIRED">Recording field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CUTDIGITS">CutDigits</label>\n        <input type="number" name="cutdigits" ng-model="vm.outboundRoute.cutdigits" min="0">\n        <div ng-messages="outboundrouteForm[\'cutdigits\'].$error" ng-show="outboundrouteForm[\'cutdigits\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CUTDIGITS_REQUIRED">CutDigits field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="VOICE.ERRORS.CUTDIGITS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigits must be a valid greater\n              or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.outboundRoute.alias" ng-change="vm.getRouting()">\n        <div ng-messages="outboundrouteForm[\'alias\'].$error" ng-show="outboundrouteForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.outboundRoute.description">\n        <div ng-messages="outboundrouteForm[\'description\'].$error" ng-show="outboundrouteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOutboundRoute" ng-click="vm.saveOutboundRoute()" class="send-button md-accent md-raised" ng-disabled="outboundrouteForm.$invalid || outboundrouteForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOutboundRoute" ng-click="vm.addNewOutboundRoute()" class="send-button md-accent md-raised" ng-disabled="outboundrouteForm.$invalid" aria-label="ADD" translate="VOICE.ADD_OUTBOUNDROUTE" translate-attr-aria-label="VOICE.ADD_OUTBOUNDROUTE">\n          ADD OUTBOUNDROUTE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOutboundRoute" ng-click="vm.deleteOutboundRoute($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/outboundRoutes/edit/view.html",'<div ng-init="vm.onInit()" id="voice-outbound-route" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-outbound-routes-button md-icon-button" aria-label="Go to outbound routes" ng-click="vm.gotoOutboundRoutes()" translate translate-attr-aria-label="VOICE.GO_TO_OUTBOUNDROUTES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="outbound-route-image" hide-xs>\n          <img ng-src="assets/images/business/outboundroutes.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.outboundRoute.id}}\n            <span ng-if="vm.outboundRoute.exten">{{vm.outboundRoute.exten}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.outboundRoute.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveOutboundRoute()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (actionsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- /HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      \x3c!-- SETTINGS TAB --\x3e\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="outbound-route-detail-form-container md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.outboundRoute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'exten\'].$error" ng-show="generalForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.outboundRoute.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RECORDING">Recording</label>\n                <md-select name="recordingFormat" ng-model="vm.outboundRoute.recordingFormat" ng-change="vm.onActionsTabSelection()" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'none\'">none</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'WAV\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.RECORDING"></span></div>\n                <div ng-messages="generalForm[\'recordingFormat\'].$error" ng-show="generalForm[\'recordingFormat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RECORDING_REQUIRED">Recording field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CUTDIGITS">CutDigits</label>\n                <input type="number" name="cutdigits" ng-model="vm.outboundRoute.cutdigits" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'cutdigits\'].$error" ng-show="generalForm[\'cutdigits\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CUTDIGITS_REQUIRED">CutDigits field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.CUTDIGITS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigits must be a valid\n                      greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.outboundRoute.alias" ng-change="vm.onActionsTabSelection()" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'alias\'].$error" ng-show="generalForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.outboundRoute.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /SETTINGS TAB --\x3e\n      \x3c!-- ACTIONS TAB --\x3e\n      <md-tab md-on-select="vm.onActionsTabSelection()">\n        <md-tab-label>\n          <span translate="VOICE.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="outbound-route-detail-form-container no-padding no-margin">\n            <div class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- APPLICATIONS LIST --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm.crudPermissions.canEdit">\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider class="no-margin"></md-divider>\n                <md-list ng-sortable="vm.sortableAppsOptions">\n                  <md-list-item class="handle" ng-repeat="a in vm.apps">\n                    <div layout="row">\n                      <md-icon md-font-icon="icon-apps" class="s16 mr-15"></md-icon>\n                      <p class="text-truncate" translate="VOICE.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias ||\n                        a.appType}}</p>\n                    </div>\n                  </md-list-item>\n                </md-list>\n              </div>\n              \x3c!-- /APPLICATIONS LIST --\x3e\n              <div flex></div>\n              \x3c!-- ROUTING --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm.crudPermissions.canEdit ? 75 : 100}}">\n                <div ng-if="vm.pendingChanges" class="p-10 md-amber-300-bg">\n                  <md-icon md-font-icon="icon-information-outline" aria-label="Save reminder"></md-icon>\n                  <span class="no-margin font-size-12 line-height-30" translate="VOICE.HELP.SAVE_ROUTES"></span>\n                </div>\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar query="vm.query" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm.selectedApplications.length}}\n                      {{vm.selectedApplications.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedApplications($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm.selectedApplications">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm.sortableRoutingOptions">\n                      <tr md-row md-select="a" md-select-id="id" ng-repeat="a in vm.applications.rows | filter:vm.query.filter as results">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)">{{a.app.toLowerCase() ===\n                          \'agi\' ? \'Cally-Square\' : a.app | ucfirst}}<span ng-if="a.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)"><span class="text-truncate actionAppData">{{a.appdata}}</span></td>\n                        <td md-cell ng-click="vm.editInterval($event, $index)">{{a.IntervalId ? \'From List\' :\n                          a.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{a.IntervalId ? \'From List\' : (a.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell ng-if="!vm.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editApplication($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                <md-button ng-click="vm.deleteApplication(a, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-class="{ \'ng-cloak\': results.length > 0 }">\n                        <td md-cell colspan="6">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No applications\n                            available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                    <tfoot md-foot>\n                      <tr md-row>\n                        <td md-cell colspan="7">\n                          <span><em translate="VOICE.LEGEND.CUSTOM_APPLICATION">(*) - Custom application.</em></span>\n                        </td>\n                      </tr>\n                    </tfoot>\n                  </table>\n                </md-table-container>\n              </div>\n              \x3c!-- /ROUTING --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /ACTIONS TAB --\x3e\n    </md-tabs>\n  </div>\n  \x3c!-- /CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/outboundRoutes/outboundRoutes.html",'<div id="outbound-routes" class="page-layout simple left-sidenav inner-sidenav">\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.OUTBOUNDROUTES">OutboundRoutes</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n  <div ng-show="vm.selectedOutboundRoutes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedOutboundRoutes = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-outbound-routes-count">\n          <span>{{ vm.selectedOutboundRoutes.length }}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectedOutboundRoutes = vm.outboundRoutes.rows" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.selectedOutboundRoutes = []" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedOutboundRoutes" csv-label="true" filename="outbound_routes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedOutboundRoutes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedOutboundRoutes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOutboundRoutes">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.PHONENUMBER\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.outboundRoutes.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="route" md-select-id="id" ng-repeat="route in vm.outboundRoutes.rows">\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditOutboundRoute($event, route)" md-cell class="id ">{{ route.id }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditOutboundRoute($event, route)" md-cell class="exten ">{{ route.exten }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditOutboundRoute($event, route)" md-cell class="description ">{{ route.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editRoute(route)" translate="VOICE.EDIT_OUTBOUNDROUTE">\n                          Edit OutboundRoute\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteConfirm(route, $event)" translate="VOICE.DELETE_OUTBOUNDROUTE">\n                          Delete OutboundRoute\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'VOICE.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'VOICE.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'VOICE.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.outboundRoutes.count }}" md-on-paginate="vm.getOutboundRoutes" md-page-select>\n        </md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-outbound-route-button" ng-click="vm.createOrEditOutboundRoute($event)" aria-label="add outbound route" translate translate-attr-aria-label="VOICE.ADD_OUTBOUNDROUTE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n</div>'),e.put("app/main/apps/voice/views/realtime/abandonedcalls/view.html",'<md-toolbar class="md-table-toolbar md-default table-header">\n  <div class="md-toolbar-tools" layout="row" layout-align="center center">\n    <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n    <ms-search-bar on-search="vm.getAbandonedCalls()" query="vm.query" on-collapse="vm.query.filter = undefined" debounce="300">\n    </ms-search-bar>\n    <div flex></div>\n\n    <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getAbandonedCalls()"></ms-quick-filter>\n\n    <md-button class="md-icon-button" ng-click="vm.refresh && vm.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n      <md-icon md-font-icon="icon-reload"></md-icon>\n      <md-tooltip ng-if="vm.showTooltip" md-visible="vm.showTooltip">{{\'DASHBOARDS.CLICKRELOAD\' | translate}}\n      </md-tooltip>\n    </md-button>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAbandonedCalls">\n      <tr md-row>\n        <th md-column md-order-by="id">ID</th>\n        <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n        <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n        <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n        <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n        <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.abandonedCalls.rows.length">\n        <td md-cell colspan="12">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="call in vm.abandonedCalls.rows">\n        <td md-cell class="id">{{call.id}}</td>\n        <td md-cell class="firstName" privacy ng-cloak>{{call.calleridname}}</td>\n        <td md-cell class="list" privacy ng-cloak>{{call.calleridnum}}</td>\n        <td md-cell class="list">{{vm.queuesMap[call.queue]}}</td>\n        <td md-cell class="list">\n          {{call.queuecallerabandonAt ? (call.queuecallerabandonAt | formatdate) : (call.queuecallerexitAt | formatdate) }}\n        </td>\n        <td md-cell class="list">{{call.lastAssignedTo}}</td>\n        <td md-cell class="list">{{ call.disposition }}</td>\n        <td md-cell class="list">{{ call.secondDisposition }}</td>\n        <td md-cell class="list">{{ call.thirdDisposition }}</td>\n        <td md-cell class="actions">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="2">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-menu>\n                  <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.ASSIGNTO">\n                    Assigned\n                    to</md-button>\n                  <md-menu-content>\n                    <md-menu-item ng-if="call.lastAssignedTo">\n                      <md-button ng-click="vm.assignTo(call)"><em translate="DASHBOARDS.NONE">Not Assigned</em>\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.agents.rows.length" ng-repeat="agent in vm.agents.rows">\n                      <md-button ng-click="vm.assignTo(call,agent)">{{agent.name}}</md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.dispose(call)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">\n                  Dispose\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.abandonedCalls.count}}" md-on-paginate="vm.getAbandonedCalls" md-page-select></md-table-pagination>'),e.put("app/main/apps/voice/views/realtime/outbound_calls/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.OUTBOUND_CALLS">Ooutbound Calls</span>\n  </div>\n</md-toolbar>\n\n\x3c!-- OUTBOUNDS TABLE --\x3e\n<md-table-container>\n  <table md-table>\n    <thead md-head>\n      <tr md-row>\n        <th md-column width="30px"></th>\n        <th md-column>{{ \'VOICE.SOURCE\' | translate }}</th>\n        <th md-column>{{ \'VOICE.DESTINATION\' | translate }}</th>\n        <th md-column>{{ \'VOICE.ALIAS\' | translate }}</th>\n        <th md-column>{{ \'VOICE.DURATION\' | translate }}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.calls.rows.length">\n        <td md-cell colspan="5">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="call in vm.calls.rows | filter: vm.query.filter | limitTo: vm.query.limit: (vm.query.page - 1) * vm.query.limit">\n        <td md-cell>\n          <i ng-class="vm.channelStatus[call.channelstatedesc.toLowerCase()]"></i>\n        </td>\n        <td md-cell privacy ng-cloak>\n          {{call.calleridname}}, {{call.calleridnum}}\n          <span class="text-boxed" ng-if="call.answered">\n            <timer ng-if="call.answertime" start-time="call.answertime"></timer>\n          </span>\n        </td>\n        <td md-cell privacy ng-cloak>{{call.exten}}</td>\n        <td md-cell>{{call.routealias}}</td>\n        <td md-cell>\n          <span class="text-boxed" ng-if="call.channelstatedesc.toLowerCase() !== \'hangup\'">\n            <timer ng-if="call.starttime" start-time="call.starttime"></timer>\n          </span>\n          <span class="text-boxed" ng-if="call.channelstatedesc.toLowerCase() === \'hangup\'" translate="VOICE.CLOSING">Closing</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.calls.count}}"></md-table-pagination>\n\x3c!-- / OUTBOUNDS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/realtime/queue_calls/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.QUEUE_CALLS">Queue Calls</span>\n  </div>\n</md-toolbar>\n\x3c!-- QUEUES TABLE --\x3e\n<md-table-container>\n  <table md-table>\n    <thead md-head>\n      <tr md-row>\n        <th md-column width="30px"></th>\n        <th md-column>{{ \'VOICE.DID\' | translate }}</th>\n        <th md-column>{{ \'VOICE.ALIAS\' | translate }}</th>\n        <th md-column>{{ \'VOICE.QUEUE\' | translate }}</th>\n        <th md-column>{{ \'VOICE.CALLER\' | translate }}</th>\n        <th md-column>{{ \'VOICE.AGENT\' | translate }}</th>\n        <th md-column>{{ \'VOICE.DURATION\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.getSize(vm.rpcVoiceQueuesChannels)">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(key, channel) in vm.rpcVoiceQueuesChannels | limitObjectFromTo: vm.queryChannels.limit:(vm.queryChannels.page - 1) * vm.queryChannels.limit">\n        <td md-cell>\n          <md-icon ng-if="channel.queuecallerleaveAt" md-font-icon="icon-phone-in-talk green-fg"></md-icon>\n          <md-icon ng-if="!channel.queuecallerleaveAt" md-font-icon="icon-phone-incoming md-accent"></md-icon>\n        </td>\n        <td md-cell>{{channel.exten}}</td>\n        <td md-cell>{{channel.routealias}}</td>\n        <td md-cell>{{channel.queue}}</td>\n        <td md-cell privacy ng-cloak>\n          <span>{{channel.calleridname}}, {{channel.calleridnum}}</span>\n        </td>\n        <td md-cell>\n          <span ng-if="channel.queuecallerleaveAt">\n            {{channel.connectedlinename}}, {{channel.connectedlinenum}}\n            <span class="text-boxed">\n              <timer start-time="channel.queuecallerleaveAt"></timer>\n            </span>\n          </span>\n          <span ng-if="!channel.queuecallerleaveAt" class="text-boxed">\n            {{ \'VOICE.WAITING_FOR_AGENT\' | translate }}\n            <timer start-time="channel.queuecallerjoinAt"></timer>\n          </span>\n        </td>\n        <td md-cell>\n          <span class="text-boxed">\n            <timer start-time="channel.queuecallerjoinAt"></timer>\n          </span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="2">\n              <md-menu-item>\n                <md-button ng-click="vm.hangup(channel.uniqueid)" translate="VOICE.HANGUP">\n                  Hangup\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.redirectToNumber($event, channel.uniqueid)" translate="VOICE.REDIRECT_TO_NUMBER">\n                  Number\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-menu class="no-margin">\n                  <md-button ng-mouseenter="vm.getAvailableAgents()" translate="VOICE.REDIRECT_TO_AGENT">\n                    Redirect to Agent</md-button>\n                  <md-menu-content>\n                    <md-menu-item ng-if="!vm.availableAgents">\n                      <md-progress-circular class="md-accent auto-margin" md-diameter="32" md-mode="indeterminate">\n                      </md-progress-circular>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.availableAgents.length > 0" ng-repeat="agent in vm.availableAgents">\n                      <md-button ng-click="vm.redirectToAgent(channel.uniqueid, agent.name, agent.context)">\n                        {{agent.name}}</md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.availableAgents.length === 0">\n                      <span>No agents available</span>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.queryChannels.limit" md-page="vm.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm.getSize(vm.rpcVoiceQueuesChannels)}}" md-page-select></md-table-pagination>\n\x3c!-- / QUEUES TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/realtime/queue_params/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.QUEUE_PARAMETERS">Params</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- QUEUE TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column>{{\'\n                        VOICE.NAME\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.TOTAL_OFFERED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.ANSWERED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.ABANDONED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.UNMANAGED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.AVG_HOLD_TIME\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.AVG_DURATION\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.AVG_BILLABLE\' | translate}}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(id, queue) in vm.queues">\n        <td md-cell>\n          <span>{{queue.name}}</span>\n        </td>\n        <td md-cell>\n          \x3c!-- <span class="font-size-20 grey-fg">{{queue.total || 0}}</span> --\x3e\n          <span class="font-size-20 grey-fg">{{ (queue.answered || 0) + (queue.abandoned || 0) + (queue.unmanaged || 0) }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered || 0}} ({{(queue.total) ? (queue.answered || 0) * 100/queue.total : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.abandoned || 0}} ({{(queue.total) ? (queue.abandoned || 0) * 100/queue.total : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.unmanaged || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.total ? ((queue.sumHoldTime || 0) / queue.total) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{(queue.total ? ((queue.sumDuration || 0) / queue.total) : 0) | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered ? ((queue.sumBillable || 0) / queue.answered) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>\n\x3c!-- / QUEUE TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n        <th md-column>{{ \'VOICE.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'VOICE.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'VOICE.TALKING\' | translate }}</th>\n        <th md-column>{{ \'VOICE.BUSY\' | translate }}</th>\n        <th md-column>{{ \'VOICE.WAITING\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedInDb }} ({{ queue.loggedIn }})</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.talking }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.busy }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="VOICE.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="VOICE.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/voice/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.TELEPHONES">Telephones</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.TRUNKS">Trunks</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.QUEUE_CALLS">Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ABANDONEDCALLS">Abandoned Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.QUEUE_PARAMS">Queue Parameters</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.OUTBOUND_CALLS">Outbound Calls</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/realtime/telephones/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.TELEPHONES">Telephones</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getTelephones()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- AGENT TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTelephones">\n      <tr md-row>\n        <th md-column md-order-by="fullname">{{ \'VOICE.ACCOUNTNAME\' | translate }}</th>\n        <th md-column md-order-by="internal">{{ \'VOICE.INTERNAL\' | translate }}</th>\n        <th md-column>{{ \'VOICE.PHONE_STATE\' | translate }}</th>\n        <th md-column>{{ \'VOICE.PHONE_STATUS\' | translate }}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.telephones">\n        <td md-cell colspan="4">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="telephone" md-select-id="id" ng-repeat="(id, telephone) in vm.telephones">\n        <td md-cell>{{telephone.fullname}}</td>\n        <td md-cell>{{telephone.internal}}</td>\n        <td md-cell>\n          <i ng-class="vm.stateClass[telephone.state]">\n            <md-tooltip>{{\'VOICE.\' + telephone.state | uppercase | translate}}</md-tooltip>\n          </i>\n        </td>\n        <td md-cell>\n          <i ng-class="vm.statusClass[telephone.status]">\n            <md-tooltip>{{\'VOICE.\' + telephone.status | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="telephone.status === \'registered\'" class="text-boxed">{{telephone.address}}</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getTelephones" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/realtime/trunks/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.TRUNKS">Telephones</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getTrunks()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- TRUNKS TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head>\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTrunks">\n        <tr md-row>\n          <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n          <th md-column>{{ \'VOICE.TRUNK_STATUS\' | translate }}</th>\n          <th md-column>{{ \'VOICE.REGISTRY\' | translate }}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.trunks">\n        <td md-cell colspan="3">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(id, trunk) in vm.trunks">\n        <td md-cell>{{trunk.name}}</td>\n        <td md-cell>\n          <i ng-class="vm.statusClass[trunk.status.toLowerCase()]">\n            <md-tooltip>{{\'VOICE.\' + trunk.status | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.status === \'registered\'" class="text-boxed">{{trunk.address}}</span>\n        </td>\n        <td md-cell>\n          <i ng-if="trunk.registry" ng-class="(trunk.stateRegistry.toLowerCase() === \'registered\') ? \'green-300-fg icon-checkbox-marked-circle\' : \'red-300-fg icon-close-circle\'">\n            <md-tooltip>{{\'VOICE.\' + trunk.stateRegistry | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.registry && trunk.host && trunk.port" class="text-boxed">{{trunk.host}}:{{trunk.port}}</span>\n          <span ng-if="!trunk.registry" translate="VOICE.NO_REGISTRY">\n            No Registry\n          </span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item>\n                <md-button ng-click="vm.goToTrunk($event, trunk)" translate="VOICE.EDIT_TRUNK">\n                  Edit Trunk\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getTrunks" md-page-select></md-table-pagination>\n\x3c!-- / TRUNKS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/voicemails/create/dialog.html",'<md-dialog class="voicemail-dialog" aria-label="New Voicemail">\n  <form name="voicemailForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.FULLNAME">FullName</label>\n        <input type="text" name="fullname" ng-model="vm.voicemail.fullname" ng-required="true" autofocus>\n\n        <div ng-messages="voicemailForm[\'fullname\'].$error" ng-show="voicemailForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.FULLNAME_REQUIRED">FullName field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.voicemail.email" ng-required="vm.voicemail.attach === \'yes\'">\n\n        <div ng-messages="voicemailForm[\'email\'].$error" ng-show="voicemailForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="VOICE.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.voicemail.password" placeholder="Password" translate translate-attr-placeholder="VOICE.PASSWORD" required>\n        <div ng-messages="voicemailForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.newVoicemail ">\n        <label translate="VOICE.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="voicemailForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="VOICE.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="VOICE.MAILBOX">MailBox</label>\n        <input type="text" name="mailbox" ng-model="vm.voicemail.mailbox" ng-required="true" ng-disabled="!vm.newVoicemail">\n\n        <div ng-messages="voicemailForm[\'mailbox\'].$error" ng-show="voicemailForm[\'mailbox\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.MAILBOX_REQUIRED">MailBox field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ATTACH">Attach</label>\n        <md-select name="attach" ng-model="vm.voicemail.attach">\n\n          <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n          <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="voicemailForm[\'attach\'].$error" ng-show="voicemailForm[\'attach\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ATTACH_REQUIRED">Attach field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVoicemail" ng-click="vm.saveVoicemail()" class="send-button md-accent md-raised" ng-disabled="voicemailForm.$invalid || voicemailForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVoicemail" ng-click="vm.addNewVoicemail()" class="send-button md-accent md-raised" ng-disabled="voicemailForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICEMAIL" translate-attr-aria-label="VOICE.ADD_VOICEMAIL">\n          ADD VOICEMAIL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVoicemail" ng-click="vm.deleteVoicemail($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicemails/edit/view.html",'<div id="voice-voicemail" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-voicemails-button md-icon-button" aria-label="Go to voicemails" ng-click="vm.gotoVoicemails()" translate translate-attr-aria-label="VOICE.GO_TO_VOICEMAILS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="voicemail-image" hide-xs>\n          <img ng-src="assets/images/business/voicemails.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.voicemail.id}}\n            <span ng-if="vm.voicemail.name">{{vm.voicemail.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.voicemail.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVoicemail()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (advancedForm.$invalid) || (messagesForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voicemail-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.FULLNAME">FullName</label>\n                <input type="text" name="fullname" ng-model="vm.voicemail.fullname" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'fullname\'].$error" ng-show="generalForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.FULLNAME_REQUIRED">FullName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.voicemail.email" ng-required="vm.voicemail.attach === \'yes\'" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="VOICE.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.voicemail.password" placeholder="Password" translate translate-attr-placeholder="VOICE.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="VOICE.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block" ng-if="vm.newVoicemail ">\n                <label translate="VOICE.CONFIRM_PASSWORD">Confirm Password</label>\n                <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n                <div ng-messages="generalForm.confirmPassword.$error" role="alert" multiple>\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n                  </div>\n                  <div ng-message="passwordMatch">\n                    <span translate="VOICE.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAILBOX">MailBox</label>\n                <input type="text" name="mailbox" ng-model="vm.voicemail.mailbox" ng-required="true" disabled>\n\n                <div ng-messages="generalForm[\'mailbox\'].$error" ng-show="generalForm[\'mailbox\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAILBOX_REQUIRED">MailBox field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.VOICEMAIL_CONTEXT">Voicemail_Context</label>\n                <md-select name="context" ng-model="vm.voicemail.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.VOICEMAIL_CONTEXT"></span></div>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.VOICEMAIL_CONTEXT_REQUIRED">Voicemail_Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voicemail-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TIMEZONE">TimeZone</label>\n                <input type="text" name="tz" ng-model="vm.voicemail.tz" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'tz\'].$error" ng-show="advancedForm[\'tz\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TIMEZONE_REQUIRED">TimeZone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ATTACH">Attach</label>\n                <md-select name="attach" ng-model="vm.voicemail.attach" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'attach\'].$error" ng-show="advancedForm[\'attach\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ATTACH_REQUIRED">Attach field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ENVELOPE">Envelope</label>\n                <md-select name="envelope" ng-model="vm.voicemail.envelope" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'envelope\'].$error" ng-show="advancedForm[\'envelope\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ENVELOPE_REQUIRED">Envelope field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DELETE">Delete</label>\n                <md-select name="delete" ng-model="vm.voicemail.delete" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'delete\'].$error" ng-show="advancedForm[\'delete\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DELETE_REQUIRED">Delete field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.EMAILBODY">EmailBody</label>\n                <input type="text" name="emailbody" ng-model="vm.voicemail.emailbody" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'emailbody\'].$error" ng-show="advancedForm[\'emailbody\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.EMAILBODY_REQUIRED">EmailBody field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.EMAILSUBJECT">EmailSubject</label>\n                <input type="text" name="emailsubject" ng-model="vm.voicemail.emailsubject" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'emailsubject\'].$error" ng-show="advancedForm[\'emailsubject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.EMAILSUBJECT_REQUIRED">EmailSubject field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAXSECONDS">MaxSeconds</label>\n                <input type="number" name="maxsecs" ng-model="vm.voicemail.maxsecs" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'maxsecs\'].$error" ng-show="advancedForm[\'maxsecs\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAXSECONDS_REQUIRED">MaxSeconds field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MAXSECONDS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxSeconds must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAXMESSAGES">MaxMessages</label>\n                <input type="number" name="maxmsg" ng-model="vm.voicemail.maxmsg" min="0" max="9999" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'maxmsg\'].$error" ng-show="advancedForm[\'maxmsg\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAXMESSAGES_REQUIRED">MaxMessages field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MAXMESSAGES_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxMessages must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="VOICE.ERRORS.MAXMESSAGES_MUST_BE_LESS_THAN_OR_EQUAL_TO">MaxMessages must be a valid greater or equal than</span> <span>9999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.MESSAGES">MESSAGES</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voicemail-detail-form-container messages md-background-bg md-whiteframe-1dp">\n            <div ng-controller="VoicemailMessagesController as vm_dc" ng-init="vm_dc.init(vm.voicemail, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedVoicemailMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="VOICE.MESSAGES">Messages</span>\n                  <ms-search-bar on-search="vm_dc.getVoicemailMessages()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedVoicemailMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedVoicemailMessages.length}} {{vm_dc.selectedVoicemailMessages.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedVoicemailMessages" csv-label="true" filename="voicemails.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedVoicemailMessages($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedVoicemailMessages" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getVoicemailMessages">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'VOICE.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="callerid">\n                        {{ \'VOICE.CALLER_ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="duration">\n                        {{ \'VOICE.DURATION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="audio">\n                        {{ \'VOICE.AUDIO\' | translate }}\n                      </th>\n                      <th md-column md-order-by="stamp">\n                        {{ \'VOICE.RECEIVED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="message" md-select-id="id" ng-repeat="message in vm_dc.voicemailMessages.rows">\n                      <td md-cell>\n                        {{message.id}}\n                      </td>\n                      <td md-cell>\n                        {{message.callerid}}\n                      </td>\n                      <td md-cell>\n                        {{message.duration}}\n                      </td>\n                      <td md-cell>\n                        \x3c!-- audio recording directive --\x3e\n                        <ms-recording id="message.id" model="\'voiceMailMessage\'"></ms-recording>\n                        \x3c!-- / audio recording directive --\x3e\n                      </td>\n                      <td md-cell>\n                        {{ message.stamp | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(message, $event)" translate="VOICE.DELETE_MESSAGE">\n                                Delete Message\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.voicemailMessages.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="VOICE.NO_MESSAGE_AVAILABLE">No message available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.voicemailMessages.count}}" md-on-paginate="vm_dc.getVoicemailMessages" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/voicemails/voicemails.html",'<div id="voicemails" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICEMAILS">Voicemails</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoicemails.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoicemails =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voicemails-count">\n          <span>{{vm.selectedVoicemails.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoicemails()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoicemails()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoicemails" csv-label="true" filename="voicemails.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoicemails($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICEMAIL TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoicemails" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoicemails">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="fullname">{{ \'VOICE.FULLNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'VOICE.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="mailbox">{{ \'VOICE.MAILBOX\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voicemails.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voicemail" md-select-id="id" ng-repeat="voicemail in vm.voicemails.rows">\n                <td md-cell ng-if="voicemail.userpic"><img class="avatar" alt="{{voicemail.name}}" ng-src="api/users/{{voicemail.id}}/avatar" /></td>\n                <td md-cell ng-if="!voicemail.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voicemail.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="id ">{{voicemail.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="fullname ">{{voicemail.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="email ">{{voicemail.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="mailbox ">{{voicemail.mailbox}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(voicemail, $event    )" translate="VOICE.EDIT_VOICEMAIL">\n                          Edit Voicemail\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voicemail, $event    )" translate="VOICE.DELETE_VOICEMAIL">\n                          Delete Voicemail\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voicemails.count}}" md-on-paginate="vm.getVoicemails" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICEMAIL TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VOICEMAIL BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-voicemail-button" ng-click="vm.createOrEditVoicemail($event)" aria-label="add voicemail" translate translate-attr-aria-label="VOICE.ADD_VOICEMAIL">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VOICEMAIL BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/voicePrefixes/create/dialog.html",'<md-dialog class="voicePrefix-dialog" aria-label="New voicePrefix">\n  <form name="voicePrefixForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.voicePrefix.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus>\n\n        <div class="hint"><span translate="VOICE.HELP.NAME"></span></div>\n        <div ng-messages="voicePrefixForm[\'name\'].$error" ng-show="voicePrefixForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.OUTBOUNDROUTE">OutboundRoute</label>\n        <md-select name="VoiceExtensionId" ng-model="vm.voicePrefix.VoiceExtensionId" required>\n          <md-option ng-value="VoiceExtensionId.id" ng-repeat="VoiceExtensionId in vm.outboundRoutes" ng-disabled="VoiceExtensionId.canSelect === false">{{ VoiceExtensionId.exten }}</md-option>\n        </md-select>\n        <div ng-messages="voicePrefixForm[\'VoiceExtensionId\'].$error" ng-show="voicePrefixForm[\'VoiceExtensionId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.OUTBOUNDROUTE_REQUIRED">OutboundRoute field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CALLERIDALL">CallerIdAll</label>\n        <input type="text" name="callerIdAll" ng-model="vm.voicePrefix.callerIdAll" ng-pattern="/&quot;(.*)&quot;\\s&lt;(.*?)&gt;$/">\n\n        <div class="hint"><span translate="VOICE.HELP.CALLERIDALL"></span></div>\n        <div ng-messages="voicePrefixForm[\'callerIdAll\'].$error" ng-show="voicePrefixForm[\'callerIdAll\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CALLERIDALL_REQUIRED">CallerIdAll field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.CALLERIDALL_MUST_VALID_PATTERN" translate-values="{ regex: \'/&quot;(.*)&quot;\\s&lt;(.*?)&gt;$/\' }">CallerIdAll must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.voicePrefix.description">\n\n        <div ng-messages="voicePrefixForm[\'description\'].$error" ng-show="voicePrefixForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newvoicePrefix" ng-click="vm.savevoicePrefix()" class="send-button md-accent md-raised" ng-disabled="voicePrefixForm.$invalid || voicePrefixForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newvoicePrefix" ng-click="vm.addNewvoicePrefix()" class="send-button md-accent md-raised" ng-disabled="voicePrefixForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICEPREFIX" translate-attr-aria-label="VOICE.ADD_VOICEPREFIX">\n          ADD VOICEPREFIX\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newvoicePrefix" ng-click="vm.deletevoicePrefix($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicePrefixes/edit/agentadd/agentadd.html",'<md-dialog class="voicePrefix-dialog" aria-label="voicePrefix" ng-init="vm.onInit()">\n  <form name="voicePrefixForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.AGENTADD_VOICEPREFIX">Add Agent to voicePrefix</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicePrefixes/edit/teamadd/teamadd.html",'<md-dialog class="voicePrefix-dialog" aria-label="voicePrefix" ng-init="vm.onInit()">\n  <form name="voicePrefixForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicePrefixes/voicePrefixes.html",'<div id="voicePrefixes" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICEPREFIXES">VoicePrefixes</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoicePrefixes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoicePrefixes =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voicePrefixes-count">\n          <span>{{vm.selectedVoicePrefixes.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoicePrefixes()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoicePrefixes()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoicePrefixes" csv-label="true" filename="voicePrefixes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoicePrefixes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICEPREFIX TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoicePrefixes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoicePrefixes">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="VoiceExtensionId">{{ \'VOICE.OUTBOUNDROUTE\' | translate }}</th>\n                <th md-column md-order-by="callerIdAll">{{ \'VOICE.CALLERIDALL\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voicePrefixes.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voicePrefix" md-select-id="id" ng-repeat="voicePrefix in vm.voicePrefixes.rows">\n                <td md-cell ng-if="voicePrefix.userpic"><img class="avatar" alt="{{voicePrefix.name}}" ng-src="api/users/{{voicePrefix.id}}/avatar" /></td>\n                <td md-cell ng-if="!voicePrefix.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voicePrefix.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="id ">{{voicePrefix.id}}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="name ">{{voicePrefix.name}}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="VoiceExtensionId ">{{ (vm.outboundRoutes | filter : {\'id\':voicePrefix.VoiceExtensionId} : true)[0].exten }}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="callerIdAll ">{{voicePrefix.callerIdAll}}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="description ">{{voicePrefix.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(voicePrefix, $event    )" translate="VOICE.EDIT_VOICEPREFIX">\n                          Edit voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(voicePrefix, $event    )" translate="VOICE.AGENTADD_VOICEPREFIX">\n                          AgentAdd voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(voicePrefix, $event    )" translate="VOICE.TEAMADD_VOICEPREFIX">\n                          teamadd voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voicePrefix, $event    )" translate="VOICE.DELETE_VOICEPREFIX">\n                          Delete voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voicePrefixes.count}}" md-on-paginate="vm.getVoicePrefixes" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICEPREFIX TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VOICEPREFIX BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-voicePrefix-button" ng-click="vm.createOrEditvoicePrefix($event)" aria-label="add voicePrefix" translate translate-attr-aria-label="VOICE.ADD_VOICEPREFIX">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VOICEPREFIX BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/voiceQueues/create/dialog.html",'<md-dialog class="voiceQueue-dialog" aria-label="New VoiceQueue">\n  <form name="voiceQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.voiceQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newVoiceQueue">\n\n        <div class="hint"><span translate="VOICE.HELP.NAME"></span></div>\n        <div ng-messages="voiceQueueForm[\'name\'].$error" ng-show="voiceQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.voiceQueue.strategy" required>\n          <md-option ng-value="\'ringall\'">Ringall</md-option>\n          <md-option ng-value="\'rrmemory\'">Round Robin Memory</md-option>\n          <md-option ng-value="\'leastrecent\'">Least Recent</md-option>\n          <md-option ng-value="\'fewestcalls\'">Fewest Calls</md-option>\n          <md-option ng-value="\'random\'">Random</md-option>\n          <md-option ng-value="\'linear\'">Linear</md-option>\n          <md-option ng-value="\'wrandom\'">Weight Random</md-option>\n        </md-select>\n        <div ng-messages="voiceQueueForm[\'strategy\'].$error" ng-show="voiceQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.voiceQueue.description">\n\n        <div ng-messages="voiceQueueForm[\'description\'].$error" ng-show="voiceQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVoiceQueue" ng-click="vm.saveVoiceQueue()" class="send-button md-accent md-raised" ng-disabled="voiceQueueForm.$invalid || voiceQueueForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVoiceQueue" ng-click="vm.addNewVoiceQueue()" class="send-button md-accent md-raised" ng-disabled="voiceQueueForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICEQUEUE" translate-attr-aria-label="VOICE.ADD_VOICEQUEUE">\n          ADD VOICEQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVoiceQueue" ng-click="vm.deleteVoiceQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",'<md-dialog class="voiceQueue-dialog" aria-label="voiceQueue" ng-init="vm.onInit()">\n  <form name="voiceQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.AGENTADD_VOICEQUEUE">Add Agent to voiceQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="VOICE.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="voiceQueueForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",'<md-dialog class="voiceQueue-dialog" aria-label="voiceQueue" ng-init="vm.onInit()">\n  <form name="voiceQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="VOICE.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="voiceQueueForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceQueues/edit/view.html",'<div id="voice-voiceQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-voiceQueues-button md-icon-button" aria-label="Go to voiceQueues" ng-click="vm.gotoVoiceQueues()" translate translate-attr-aria-label="VOICE.GO_TO_VOICEQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="voiceQueue-image" hide-xs>\n          <img ng-src="assets/images/business/voiceQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.voiceQueue.id}}\n            <span ng-if="vm.voiceQueue.name">{{vm.voiceQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.voiceQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.voiceQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="VOICE.TEAMADD_VOICEQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.voiceQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="VOICE.AGENTADD_VOICEQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.voiceQueue, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="VOICE.GOTO_VOICEQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVoiceQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (settingsForm.$invalid) || (announcementsForm.$invalid) || (advancedForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.voiceQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="VOICE.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.voiceQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ringall\'">Ringall</md-option>\n                  <md-option ng-value="\'rrmemory\'">Round Robin Memory</md-option>\n                  <md-option ng-value="\'leastrecent\'">Least Recent</md-option>\n                  <md-option ng-value="\'fewestcalls\'">Fewest Calls</md-option>\n                  <md-option ng-value="\'random\'">Random</md-option>\n                  <md-option ng-value="\'linear\'">Linear</md-option>\n                  <md-option ng-value="\'wrandom\'">Weight Random</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TIMEOUT">Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.voiceQueue.timeout" min="0" value="15" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.TIMEOUT"></span></div>\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAXLENGTH">MaxLength</label>\n                <input type="number" name="maxlen" ng-model="vm.voiceQueue.maxlen" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.MAXLENGTH"></span></div>\n                <div ng-messages="generalForm[\'maxlen\'].$error" ng-show="generalForm[\'maxlen\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAXLENGTH_REQUIRED">MaxLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MAXLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RETRY">Retry</label>\n                <input type="number" name="retry" ng-model="vm.voiceQueue.retry" min="0" value="2" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.RETRY"></span></div>\n                <div ng-messages="generalForm[\'retry\'].$error" ng-show="generalForm[\'retry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RETRY_REQUIRED">Retry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.RETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Retry must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.WRAPUPTIME">WrapupTime</label>\n                <input type="number" name="wrapuptime" ng-model="vm.voiceQueue.wrapuptime" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.WRAPUPTIME"></span></div>\n                <div ng-messages="generalForm[\'wrapuptime\'].$error" ng-show="generalForm[\'wrapuptime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.WRAPUPTIME_REQUIRED">WrapupTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.WRAPUPTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WrapupTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.WEIGHT">Weight</label>\n                <input type="number" name="weight" ng-model="vm.voiceQueue.weight" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.WEIGHT"></span></div>\n                <div ng-messages="generalForm[\'weight\'].$error" ng-show="generalForm[\'weight\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.WEIGHT_REQUIRED">Weight field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.WEIGHT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Weight must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.JOINWHENEMPTY">JoinWhenEmpty</label>\n                <md-select name="joinempty" ng-model="vm.voiceQueue.joinempty" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'no\'" ng-disabled="vm.voiceQueue.joinempty.length === 1  && vm.voiceQueue.joinempty[0] === \'no\'">no</md-option>\n                  <md-option ng-value="\'yes\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'yes\'">yes</md-option>\n                  <md-option ng-value="\'strict\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'strict\'">strict</md-option>\n                  <md-option ng-value="\'loose\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'loose\'">loose</md-option>\n                  <md-option ng-value="\'paused\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'paused\'">paused</md-option>\n                  <md-option ng-value="\'penalty\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'penalty\'">penalty</md-option>\n                  <md-option ng-value="\'inuse\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'inuse\'">inuse</md-option>\n                  <md-option ng-value="\'ringing\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'ringing\'">ringing</md-option>\n                  <md-option ng-value="\'unavailable\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'unavailable\'">unavailable</md-option>\n                  <md-option ng-value="\'invalid\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'invalid\'">invalid</md-option>\n                  <md-option ng-value="\'unknown\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'unknown\'">unknown</md-option>\n                  <md-option ng-value="\'wrapup\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'wrapup\'">wrapup</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.JOINWHENEMPTY"></span></div>\n                <div ng-messages="generalForm[\'joinempty\'].$error" ng-show="generalForm[\'joinempty\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.JOINWHENEMPTY_REQUIRED">JoinWhenEmpty field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.LEAVEWHENEMPTY">LeaveWhenEmpty</label>\n                <md-select name="leavewhenempty" ng-model="vm.voiceQueue.leavewhenempty" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'no\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'no\'">no</md-option>\n                  <md-option ng-value="\'yes\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'yes\'">yes</md-option>\n                  <md-option ng-value="\'strict\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'strict\'">strict</md-option>\n                  <md-option ng-value="\'loose\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'loose\'">loose</md-option>\n                  <md-option ng-value="\'paused\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'paused\'">paused</md-option>\n                  <md-option ng-value="\'penalty\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'penalty\'">penalty</md-option>\n                  <md-option ng-value="\'inuse\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'inuse\'">inuse</md-option>\n                  <md-option ng-value="\'ringing\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'ringing\'">ringing</md-option>\n                  <md-option ng-value="\'unavailable\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'unavailable\'">unavailable</md-option>\n                  <md-option ng-value="\'invalid\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'invalid\'">invalid</md-option>\n                  <md-option ng-value="\'unknown\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'unknown\'">unknown</md-option>\n                  <md-option ng-value="\'wrapup\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'wrapup\'">wrapup</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.LEAVEWHENEMPTY"></span></div>\n                <div ng-messages="generalForm[\'leavewhenempty\'].$error" ng-show="generalForm[\'leavewhenempty\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.LEAVEWHENEMPTY_REQUIRED">LeaveWhenEmpty field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MUSICONHOLD">MusicOnHold</label>\n                <md-select name="musiconhold" ng-model="vm.voiceQueue.musiconhold" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="musiconhold.name" ng-repeat="musiconhold in vm.musiconholds" ng-disabled="musiconhold.canSelect === false">{{ musiconhold.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MUSICONHOLD"></span></div>\n                <div ng-messages="generalForm[\'musiconhold\'].$error" ng-show="generalForm[\'musiconhold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MUSICONHOLD_REQUIRED">MusicOnHold field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCETOAGENT">AnnounceToAgent</label>\n                <md-select name="announce" ng-model="vm.voiceQueue.announce" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'FALSE\'">None</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + announce.save_name" ng-repeat="announce in vm.sounds" ng-disabled="announce.canSelect === false">{{ announce.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCETOAGENT"></span></div>\n                <div ng-messages="generalForm[\'announce\'].$error" ng-show="generalForm[\'announce\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCETOAGENT_REQUIRED">AnnounceToAgent field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.voiceQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ANNOUNCEMENTS">ANNOUNCEMENTS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceQueue-detail-form-container settings md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.SETTINGS">SETTINGS</div>\n            </div>\n            <form name="settingsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCEFREQUENCY">AnnounceFrequency</label>\n                <input type="number" name="announce_frequency" ng-model="vm.voiceQueue.announce_frequency" min="0" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCEFREQUENCY"></span></div>\n                <div ng-messages="settingsForm[\'announce_frequency\'].$error" ng-show="settingsForm[\'announce_frequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCEFREQUENCY_REQUIRED">AnnounceFrequency field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.ANNOUNCEFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AnnounceFrequency must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MINANNOUNCEFREQUENCY">MinAnnounceFrequency</label>\n                <input type="number" name="min_announce_frequency" ng-model="vm.voiceQueue.min_announce_frequency" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.MINANNOUNCEFREQUENCY"></span></div>\n                <div ng-messages="settingsForm[\'min_announce_frequency\'].$error" ng-show="settingsForm[\'min_announce_frequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MINANNOUNCEFREQUENCY_REQUIRED">MinAnnounceFrequency field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MINANNOUNCEFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MinAnnounceFrequency must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PERIODICANNOUNCEFREQUENCY">PeriodicAnnounceFrequency</label>\n                <input type="number" name="periodic_announce_frequency" ng-model="vm.voiceQueue.periodic_announce_frequency" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.PERIODICANNOUNCEFREQUENCY"></span></div>\n                <div ng-messages="settingsForm[\'periodic_announce_frequency\'].$error" ng-show="settingsForm[\'periodic_announce_frequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PERIODICANNOUNCEFREQUENCY_REQUIRED">PeriodicAnnounceFrequency field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.PERIODICANNOUNCEFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">PeriodicAnnounceFrequency must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RANDOMPERIODICANNOUNCE">RandomPeriodicAnnounce</label>\n                <md-select name="random_periodic_announce" ng-model="vm.voiceQueue.random_periodic_announce" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.RANDOMPERIODICANNOUNCE"></span></div>\n                <div ng-messages="settingsForm[\'random_periodic_announce\'].$error" ng-show="settingsForm[\'random_periodic_announce\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RANDOMPERIODICANNOUNCE_REQUIRED">RandomPeriodicAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCEHOLDTIME">AnnounceHoldtime</label>\n                <md-select name="announce_holdtime" ng-model="vm.voiceQueue.announce_holdtime" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'once\'">Once</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCEHOLDTIME"></span></div>\n                <div ng-messages="settingsForm[\'announce_holdtime\'].$error" ng-show="settingsForm[\'announce_holdtime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCEHOLDTIME_REQUIRED">AnnounceHoldtime field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCECALLERPOSITION">AnnounceCallerPosition</label>\n                <md-select name="announce_position" ng-model="vm.voiceQueue.announce_position" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'limit\'">Limit</md-option>\n                  <md-option ng-value="\'more\'">More</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCECALLERPOSITION"></span></div>\n                <div ng-messages="settingsForm[\'announce_position\'].$error" ng-show="settingsForm[\'announce_position\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCECALLERPOSITION_REQUIRED">AnnounceCallerPosition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCEPOSITIONLIMIT">AnnouncePositionLimit</label>\n                <input type="number" name="announce_position_limit" ng-model="vm.voiceQueue.announce_position_limit" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCEPOSITIONLIMIT"></span></div>\n                <div ng-messages="settingsForm[\'announce_position_limit\'].$error" ng-show="settingsForm[\'announce_position_limit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCEPOSITIONLIMIT_REQUIRED">AnnouncePositionLimit field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.REPORTHOLDTIMEAGENT">ReportHoldtimeAgent</label>\n                <md-select name="reportholdtime" ng-model="vm.voiceQueue.reportholdtime" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.REPORTHOLDTIMEAGENT"></span></div>\n                <div ng-messages="settingsForm[\'reportholdtime\'].$error" ng-show="settingsForm[\'reportholdtime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.REPORTHOLDTIMEAGENT_REQUIRED">ReportHoldtimeAgent field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="voiceQueue-detail-form-container announcements md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.ANNOUNCEMENTS">ANNOUNCEMENTS</div>\n            </div>\n            <form name="announcementsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PERIODICANNOUNCE">PeriodicAnnounce</label>\n                <md-select name="periodic_announce" ng-model="vm.voiceQueue.periodic_announce" autofocus multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Default</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + periodic_announce.save_name" ng-repeat="periodic_announce in vm.sounds" ng-disabled="periodic_announce.canSelect === false">{{ periodic_announce.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.PERIODICANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'periodic_announce\'].$error" ng-show="announcementsForm[\'periodic_announce\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PERIODICANNOUNCE_REQUIRED">PeriodicAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.HOLDTIMEANNOUNCE">HoldTimeAnnounce</label>\n                <md-select name="queue_reporthold" ng-model="vm.voiceQueue.queue_reporthold" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_reporthold.save_name" ng-repeat="queue_reporthold in vm.sounds" ng-disabled="queue_reporthold.canSelect === false">{{ queue_reporthold.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.HOLDTIMEANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_reporthold\'].$error" ng-show="announcementsForm[\'queue_reporthold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.HOLDTIMEANNOUNCE_REQUIRED">HoldTimeAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.YOUARENEXTANNOUNCE">YouareNextAnnounce</label>\n                <md-select name="queue_youarenext" ng-model="vm.voiceQueue.queue_youarenext" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_youarenext.save_name" ng-repeat="queue_youarenext in vm.sounds" ng-disabled="queue_youarenext.canSelect === false">{{ queue_youarenext.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.YOUARENEXTANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_youarenext\'].$error" ng-show="announcementsForm[\'queue_youarenext\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.YOUARENEXTANNOUNCE_REQUIRED">YouareNextAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.THEREAREANNOUNCE">ThereareAnnounce</label>\n                <md-select name="queue_thereare" ng-model="vm.voiceQueue.queue_thereare" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_thereare.save_name" ng-repeat="queue_thereare in vm.sounds" ng-disabled="queue_thereare.canSelect === false">{{ queue_thereare.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.THEREAREANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_thereare\'].$error" ng-show="announcementsForm[\'queue_thereare\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.THEREAREANNOUNCE_REQUIRED">ThereareAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.WAITINGCALLSANNOUNCE">WaitingCallsAnnounce</label>\n                <md-select name="queue_callswaiting" ng-model="vm.voiceQueue.queue_callswaiting" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_callswaiting.save_name" ng-repeat="queue_callswaiting in vm.sounds" ng-disabled="queue_callswaiting.canSelect === false">{{ queue_callswaiting.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.WAITINGCALLSANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_callswaiting\'].$error" ng-show="announcementsForm[\'queue_callswaiting\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.WAITINGCALLSANNOUNCE_REQUIRED">WaitingCallsAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ESTIMATEDHOLDTIMEANNOUNCE">EstimatedHoldTimeAnnounce</label>\n                <md-select name="queue_holdtime" ng-model="vm.voiceQueue.queue_holdtime" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_holdtime.save_name" ng-repeat="queue_holdtime in vm.sounds" ng-disabled="queue_holdtime.canSelect === false">{{ queue_holdtime.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ESTIMATEDHOLDTIMEANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_holdtime\'].$error" ng-show="announcementsForm[\'queue_holdtime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ESTIMATEDHOLDTIMEANNOUNCE_REQUIRED">EstimatedHoldTimeAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MINUTESANNOUNCE">MinutesAnnounce</label>\n                <md-select name="queue_minutes" ng-model="vm.voiceQueue.queue_minutes" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_minutes.save_name" ng-repeat="queue_minutes in vm.sounds" ng-disabled="queue_minutes.canSelect === false">{{ queue_minutes.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MINUTESANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_minutes\'].$error" ng-show="announcementsForm[\'queue_minutes\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MINUTESANNOUNCE_REQUIRED">MinutesAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MINUTEANNOUNCE">MinuteAnnounce</label>\n                <md-select name="queue_minute" ng-model="vm.voiceQueue.queue_minute" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_minute.save_name" ng-repeat="queue_minute in vm.sounds" ng-disabled="queue_minute.canSelect === false">{{ queue_minute.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MINUTEANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_minute\'].$error" ng-show="announcementsForm[\'queue_minute\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MINUTEANNOUNCE_REQUIRED">MinuteAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SECONDSANNOUNCE">SecondsAnnounce</label>\n                <md-select name="queue_seconds" ng-model="vm.voiceQueue.queue_seconds" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_seconds.save_name" ng-repeat="queue_seconds in vm.sounds" ng-disabled="queue_seconds.canSelect === false">{{ queue_seconds.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SECONDSANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_seconds\'].$error" ng-show="announcementsForm[\'queue_seconds\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SECONDSANNOUNCE_REQUIRED">SecondsAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.THANKYOUANNOUNCE">ThankYouAnnounce</label>\n                <md-select name="queue_thankyou" ng-model="vm.voiceQueue.queue_thankyou" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_thankyou.save_name" ng-repeat="queue_thankyou in vm.sounds" ng-disabled="queue_thankyou.canSelect === false">{{ queue_thankyou.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.THANKYOUANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_thankyou\'].$error" ng-show="announcementsForm[\'queue_thankyou\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.THANKYOUANNOUNCE_REQUIRED">ThankYouAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceQueue-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.voiceQueue.acw" aria-label="AfterCallWork" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.AFTERCALLWORK">AfterCallWork</span></md-switch>\n                <div class="hint"><span translate="VOICE.HELP.AFTERCALLWORK"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.voiceQueue.acw" class="md-block">\n                <label translate="VOICE.AFTERCALLWORKDURATION">AfterCallWorkDuration</label>\n                <input type="number" name="acwTimeout" ng-model="vm.voiceQueue.acwTimeout" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.AFTERCALLWORKDURATION"></span></div>\n                <div ng-messages="advancedForm[\'acwTimeout\'].$error" ng-show="advancedForm[\'acwTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.AFTERCALLWORKDURATION_REQUIRED">AfterCallWorkDuration field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.AFTERCALLWORKDURATION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AfterCallWorkDuration must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.AUTOPAUSE">AutoPause</label>\n                <md-select name="autopause" ng-model="vm.voiceQueue.autopause" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'all\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.AUTOPAUSE"></span></div>\n                <div ng-messages="advancedForm[\'autopause\'].$error" ng-show="advancedForm[\'autopause\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.AUTOPAUSE_REQUIRED">AutoPause field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RINGINUSE">RingInUse</label>\n                <md-select name="ringinuse" ng-model="vm.voiceQueue.ringinuse" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.RINGINUSE"></span></div>\n                <div ng-messages="advancedForm[\'ringinuse\'].$error" ng-show="advancedForm[\'ringinuse\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RINGINUSE_REQUIRED">RingInUse field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MEMBERDELAY">MemberDelay</label>\n                <input type="number" name="memberdelay" ng-model="vm.voiceQueue.memberdelay" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.MEMBERDELAY"></span></div>\n                <div ng-messages="advancedForm[\'memberdelay\'].$error" ng-show="advancedForm[\'memberdelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MEMBERDELAY_REQUIRED">MemberDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MEMBERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MemberDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TIMEOUTRESTART">TimeoutRestart</label>\n                <md-select name="timeoutrestart" ng-model="vm.voiceQueue.timeoutrestart" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.TIMEOUTRESTART"></span></div>\n                <div ng-messages="advancedForm[\'timeoutrestart\'].$error" ng-show="advancedForm[\'timeoutrestart\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TIMEOUTRESTART_REQUIRED">TimeoutRestart field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MONITORFORMAT">MonitorFormat</label>\n                <md-select name="monitor_format" ng-model="vm.voiceQueue.monitor_format" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'wav49\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MONITORFORMAT"></span></div>\n                <div ng-messages="advancedForm[\'monitor_format\'].$error" ng-show="advancedForm[\'monitor_format\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MONITORFORMAT_REQUIRED">MonitorFormat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <input type="text" name="context" ng-model="vm.voiceQueue.context" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.CONTEXT"></span></div>\n                <div ng-messages="advancedForm[\'context\'].$error" ng-show="advancedForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SETINTERFACEVARIABLES">SetInterfaceVariables</label>\n                <md-select name="setinterfacevar" ng-model="vm.voiceQueue.setinterfacevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SETINTERFACEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setinterfacevar\'].$error" ng-show="advancedForm[\'setinterfacevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SETINTERFACEVARIABLES_REQUIRED">SetInterfaceVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SETQUEUEVARIABLES">SetQueueVariables</label>\n                <md-select name="setqueuevar" ng-model="vm.voiceQueue.setqueuevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SETQUEUEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueuevar\'].$error" ng-show="advancedForm[\'setqueuevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SETQUEUEVARIABLES_REQUIRED">SetQueueVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SETQUEUEENTRYVARIABLES">SetQueueEntryVariables</label>\n                <md-select name="setqueueentryvar" ng-model="vm.voiceQueue.setqueueentryvar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SETQUEUEENTRYVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueueentryvar\'].$error" ng-show="advancedForm[\'setqueueentryvar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SETQUEUEENTRYVARIABLES_REQUIRED">SetQueueEntryVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SERVICELEVEL">ServiceLevel</label>\n                <input type="number" name="servicelevel" ng-model="vm.voiceQueue.servicelevel" min="0" max="100" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.SERVICELEVEL"></span></div>\n                <div ng-messages="advancedForm[\'servicelevel\'].$error" ng-show="advancedForm[\'servicelevel\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SERVICELEVEL_REQUIRED">ServiceLevel field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.SERVICELEVEL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ServiceLevel must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="VOICE.ERRORS.SERVICELEVEL_MUST_BE_LESS_THAN_OR_EQUAL_TO">ServiceLevel must be a valid greater or equal than</span> <span>100</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.voiceQueue.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.voiceQueue.mandatoryDisposition" class="md-block">\n                <label translate="VOICE.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.voiceQueue.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="advancedForm[\'mandatoryDispositionPauseId\'].$error" ng-show="advancedForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/voiceQueues/voiceQueues.html",'<div id="voiceQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICEQUEUES">VoiceQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoiceQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoiceQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voiceQueues-count">\n          <span>{{vm.selectedVoiceQueues.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoiceQueues()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoiceQueues()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoiceQueues" csv-label="true" filename="voiceQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoiceQueues($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICEQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoiceQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'VOICE.STRATEGY\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voiceQueues.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voiceQueue" md-select-id="id" ng-repeat="voiceQueue in vm.voiceQueues.rows">\n                <td md-cell ng-if="voiceQueue.userpic"><img class="avatar" alt="{{voiceQueue.name}}" ng-src="api/users/{{voiceQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!voiceQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voiceQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="id ">{{voiceQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="name ">{{voiceQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="strategy ">{{ vm.arraystrategy[voiceQueue.strategy].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="description ">{{voiceQueue.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(voiceQueue, $event    )" translate="VOICE.EDIT_VOICEQUEUE">\n                          Edit VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(voiceQueue, $event    )" translate="VOICE.TEAMADD_VOICEQUEUE">\n                          teamadd VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(voiceQueue, $event    )" translate="VOICE.AGENTADD_VOICEQUEUE">\n                          agentadd VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voiceQueue, $event    )" translate="VOICE.DELETE_VOICEQUEUE">\n                          Delete VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(voiceQueue, $event    )" translate="VOICE.GOTOREALTIME_VOICEQUEUE">\n                          goToRealtime VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceQueues.count}}" md-on-paginate="vm.getVoiceQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICEQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VOICEQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-voiceQueue-button" ng-click="vm.createOrEditVoiceQueue($event)" aria-label="add voiceQueue" translate translate-attr-aria-label="VOICE.ADD_VOICEQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VOICEQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/voiceRecordings/create/dialog.html",'<md-dialog class="voiceRecording-dialog" aria-label="New VoiceRecording">\n  <form name="voiceRecordingForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.RATING">Rating</label>\n        <md-select name="rating" ng-model="vm.voiceRecording.rating" autofocus ng-disabled="!vm.newVoiceRecording && !vm.crudPermissions.canEdit">\n          <md-option ng-value="null">{{\'VOICE.NO_RATING\' | translate}}</md-option>\n          <md-option value="1">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1]"></md-icon>\n          </md-option>\n          <md-option value="2">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2]"></md-icon>\n          </md-option>\n          <md-option value="3">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3]"></md-icon>\n          </md-option>\n          <md-option value="4">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4]"></md-icon>\n          </md-option>\n          <md-option value="5">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4,5]"></md-icon>\n          </md-option>\n        </md-select>\n        <div ng-messages="voiceRecordingForm[\'rating\'].$error" ng-show="voiceRecordingForm[rating].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.RATING_REQUIRED">Rating field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVoiceRecording" ng-click="vm.saveVoiceRecording()" class="send-button md-accent md-raised" ng-disabled="voiceRecordingForm.$invalid || voiceRecordingForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVoiceRecording" ng-click="vm.addNewVoiceRecording()" class="send-button md-accent md-raised" ng-disabled="voiceRecordingForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICERECORDING" translate-attr-aria-label="VOICE.ADD_VOICERECORDING">\n          ADD VOICERECORDING\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVoiceRecording" ng-click="vm.deleteVoiceRecording($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceRecordings/edit/view.html",'<div id="voice-voiceRecording" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-voiceRecordings-button md-icon-button" aria-label="Go to voiceRecordings" ng-click="vm.gotoVoiceRecordings()" translate translate-attr-aria-label="VOICE.GO_TO_VOICERECORDINGS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="voiceRecording-image" hide-xs>\n          <img ng-src="assets/images/business/voiceRecordings.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.voiceRecording.id}}\n            <span ng-if="vm.voiceRecording.name">{{vm.voiceRecording.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.voiceRecording.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVoiceRecording()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(voiceRecordingsForm.$invalid) || (transcriptForm.$invalid) || (sentimentAnalysisForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.GENERAL">GENERAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceRecording-detail-form-container voicerecordings md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.VOICERECORDINGS">VOICERECORDINGS</div>\n            </div>\n            <form name="voiceRecordingsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TYPE">Type</label>\n                <input type="" name="type" ng-model="vm.voiceRecording.type" autofocus disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'type\'].$error" ng-show="voiceRecordingsForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.UNIQUEID">UniqueId</label>\n                <input type="" name="uniqueid" ng-model="vm.voiceRecording.uniqueid" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'uniqueid\'].$error" ng-show="voiceRecordingsForm[\'uniqueid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.UNIQUEID_REQUIRED">UniqueId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CALLER">Caller</label>\n                <input type="" name="calleridnum" ng-model="vm.voiceRecording.calleridnum" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'calleridnum\'].$error" ng-show="voiceRecordingsForm[\'calleridnum\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CALLER_REQUIRED">Caller field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CALLED">Called</label>\n                <input type="" name="exten" ng-model="vm.voiceRecording.exten" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'exten\'].$error" ng-show="voiceRecordingsForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CALLED_REQUIRED">Called field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONNECTED">Connected</label>\n                <input type="" name="connectedlinenum" ng-model="vm.voiceRecording.connectedlinenum" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'connectedlinenum\'].$error" ng-show="voiceRecordingsForm[\'connectedlinenum\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONNECTED_REQUIRED">Connected field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.QUEUE">Queue</label>\n                <input type="" name="queue" ng-model="vm.voiceRecording.queue" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'queue\'].$error" ng-show="voiceRecordingsForm[\'queue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.AGENT">Agent</label>\n                <input type="text" name="membername" ng-model="vm.voiceRecording.membername" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'membername\'].$error" ng-show="voiceRecordingsForm[\'membername\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RATING">Rating</label>\n                <md-select name="rating" ng-model="vm.voiceRecording.rating" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">{{\'VOICE.NO_RATING\' | translate}}</md-option>\n                  <md-option value="1">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1]"></md-icon>\n                  </md-option>\n                  <md-option value="2">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2]"></md-icon>\n                  </md-option>\n                  <md-option value="3">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3]"></md-icon>\n                  </md-option>\n                  <md-option value="4">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4]"></md-icon>\n                  </md-option>\n                  <md-option value="5">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4,5]"></md-icon>\n                  </md-option>\n                </md-select>\n                <div ng-messages="voiceRecordingsForm[\'rating\'].$error" ng-show="voiceRecordingsForm[rating].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RATING_REQUIRED">Rating field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DISPOSITION">Disposition</label>\n                <input type="text" name="userDisposition" ng-model="vm.voiceRecording.userDisposition" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'userDisposition\'].$error" ng-show="voiceRecordingsForm[\'userDisposition\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SECOND_LEVEL_DISPOSITION">Second_Level_Disposition</label>\n                <input type="text" name="userSecondDisposition" ng-model="vm.voiceRecording.userSecondDisposition" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'userSecondDisposition\'].$error" ng-show="voiceRecordingsForm[\'userSecondDisposition\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SECOND_LEVEL_DISPOSITION_REQUIRED">Second_Level_Disposition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.THIRD_LEVEL_DISPOSITION">Third_Level_Disposition</label>\n                <input type="text" name="userThirdDisposition" ng-model="vm.voiceRecording.userThirdDisposition" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'userThirdDisposition\'].$error" ng-show="voiceRecordingsForm[\'userThirdDisposition\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.THIRD_LEVEL_DISPOSITION_REQUIRED">Third_Level_Disposition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.license.ai">\n        <md-tab-label>\n          <span translate="VOICE.TRANSCRIPTANALYSIS">TRANSCRIPTANALYSIS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceRecording-detail-form-container transcript md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.TRANSCRIPT">TRANSCRIPT</div>\n            </div>\n            <form name="transcriptForm" novalidate>\n              <md-input-container ng-if="vm.voiceRecording.transcribeStatus == \'COMPLETED\'" class="md-block">\n                <label translate="VOICE.TEXT">Text</label>\n                <textarea name="fileText" ng-model="vm.voiceRecording.fileText" autofocus ng-disabled="true"></textarea>\n              </md-input-container>\n              <md-input-container ng-if="vm.voiceRecording.transcribeStatus == \'FAILED\'" class="md-block">\n                <label translate="VOICE.FAILUREREASON">FailureReason</label>\n                <textarea name="failureReason" ng-model="vm.voiceRecording.failureReason" ng-disabled="true"></textarea>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="voiceRecording-detail-form-container sentimentanalysis md-background-bg md-whiteframe-1dp">\n            <div ng-controller="VoiceRecordingSentimentStatisticsController as vm_ss" ng-init="vm_ss.init(vm.voiceRecording)">\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="VOICE.SENTIMENTANALYSIS" style="width: 50px;">Sentiment Analysis</span>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- WIDGET GROUP --\x3e\n              <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n                \x3c!-- WIDGET 1 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8 sentiment" ng-class="vm_ss.voiceRecording.sentiment">\n                        {{vm_ss.voiceRecording.sentiment}}\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 1 --\x3e\n\n                \x3c!-- WIDGET 2 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sPositive || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_POSITIVE\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 2 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sNegative || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_NEGATIVE\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n                \x3c!-- WIDGET 4 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sNeutral || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_NEUTRAL\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 4 --\x3e\n\n                \x3c!-- WIDGET 5 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sMixed || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_MIXED\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 5 --\x3e\n\n              </div>\n              \x3c!-- / WIDGET GROUP --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/voiceRecordings/voiceRecordings.html",'<div id="voiceRecordings" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICERECORDINGS">VoiceRecordings</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getVoiceRecordings()"></ms-quick-filter>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoiceRecordings.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoiceRecordings =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voiceRecordings-count">\n          <span>{{vm.selectedVoiceRecordings.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoiceRecordings()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoiceRecordings()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoiceRecordings" csv-label="true" filename="voiceRecordings.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.license.ai" ng-click="vm.runtranscribesentimentSelectedVoiceRecordings($event)" aria-label="transcribesentiment selected" translate translate-attr-label="VOICERECORDINGS.TRANSCRIBESENTIMENT_SELECTED">\n          <md-icon md-font-icon="icon-text-to-speech"></md-icon>\n          <md-tooltip>{{\'VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button" ng-if="vm.license.ai" ng-click="vm.runtranscribeSelectedVoiceRecordings($event)" aria-label="transcribe selected" translate translate-attr-label="VOICERECORDINGS.TRANSCRIBE_SELECTED">\n          <md-icon md-font-icon="icon-format-size"></md-icon>\n          <md-tooltip>{{\'VOICE.RUNTRANSCRIBE_VOICERECORDING\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button" ng-if="vm.license.ai" ng-click="vm.runsentimentSelectedVoiceRecordings($event)" aria-label="transcribe selected" translate translate-attr-label="VOICERECORDINGS.SENTIMENT_SELECTED">\n          <md-icon md-font-icon="icon-heart-outline"></md-icon>\n          <md-tooltip>{{\'VOICE.RUNSENTIMENT_VOICERECORDING\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoiceRecordings($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICERECORDING TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoiceRecordings" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceRecordings">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="type">{{ \'VOICE.TYPE\' | translate }}</th>\n                <th md-column md-order-by="uniqueid">{{ \'VOICE.UNIQUEID\' | translate }}</th>\n                <th md-column md-order-by="calleridnum">{{ \'VOICE.CALLER\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.CALLED\' | translate }}</th>\n                <th md-column md-order-by="connectedlinenum">{{ \'VOICE.CONNECTED\' | translate }}</th>\n                <th md-column md-order-by="queue">{{ \'VOICE.QUEUE\' | translate }}</th>\n                <th md-column md-order-by="membername">{{ \'VOICE.AGENT\' | translate }}</th>\n                <th md-column md-order-by="rating">{{ \'VOICE.RATING\' | translate }}</th>\n                <th md-column>{{ \'VOICE.AUDIO\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'VOICE.DATE\' | translate }}</th>\n                <th md-column md-order-by="userDisposition">{{ \'VOICE.DISPOSITION\' | translate }}</th>\n                <th md-column md-order-by="userSecondDisposition">{{ \'VOICE.SECOND_LEVEL_DISPOSITION\' | translate }}</th>\n                <th md-column md-order-by="userThirdDisposition">{{ \'VOICE.THIRD_LEVEL_DISPOSITION\' | translate }}</th>\n                <th md-column md-order-by="transcribeStatus" ng-if="vm.license.ai">{{ \'VOICE.TRANSCRIBE\' | translate }}</th>\n                <th md-column md-order-by="sentiment" ng-if="vm.license.ai">{{ \'VOICE.SENTIMENTANALYSIS\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voiceRecordings.rows.length">\n                <td md-cell colspan="16">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voiceRecording" md-select-id="id" ng-repeat="voiceRecording in vm.voiceRecordings.rows">\n                <td md-cell ng-if="voiceRecording.userpic"><img class="avatar" alt="{{voiceRecording.name}}" ng-src="api/users/{{voiceRecording.id}}/avatar" /></td>\n                <td md-cell ng-if="!voiceRecording.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voiceRecording.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="type ">{{voiceRecording.type}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="uniqueid ">{{voiceRecording.uniqueid}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="calleridnum " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.calleridnum}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="exten " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.exten}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="connectedlinenum " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.connectedlinenum}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="queue ">{{voiceRecording.queue}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="membername " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.membername}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="rating ">\n                  <md-icon md-font-icon="icon-star" style="color:red" ng-show="voiceRecording.rating" ng-repeat="rating in [1,2,3,4,5] | limitTo:voiceRecording.rating"></md-icon><span ng-hide="voiceRecording.rating" translate="VOICE.NO_RATING">No rating</span>\n                </td>\n                <td md-cell class="audio " ng-switch="voiceRecording.format">\n                  \x3c!-- audio recording directive --\x3e\n                  <ms-recording ng-switch-when=".wav" id="voiceRecording.id" model="\'voiceRecording\'"></ms-recording>\n                  \x3c!-- / audio recording directive --\x3e\n                  <span ng-switch-when=".gsm|.WAV" ng-switch-when-separator="|">\n                    <em>{{ \'VOICE.CANT_PLAY_GSM_AUDIO_FILES\' | translate }}</em>\n                  </span>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="createdAt ">{{voiceRecording.createdAt | date:\'medium\' }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="userDisposition ">{{voiceRecording.userDisposition}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="userSecondDisposition ">{{voiceRecording.userSecondDisposition}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="userThirdDisposition ">{{voiceRecording.userThirdDisposition}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="transcribeStatus " ng-if="vm.license.ai">{{ \'VOICE.TRANSCRIBESTATUS_\' + voiceRecording.transcribeStatus | translate}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="sentiment " ng-if="vm.license.ai">{{voiceRecording.sentiment}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(voiceRecording, $event    )" translate="VOICE.EDIT_VOICERECORDING">\n                          Edit VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'NEW\' && vm.license.ai">\n\n                        <md-button ng-click="vm.runtranscriberuntranscribesentiment(voiceRecording, $event    )" translate="VOICE.RUNTRANSCRIBE_VOICERECORDING">\n                          RunTranscribe VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'NEW\' && vm.license.ai">\n\n                        <md-button ng-click="vm.runtranscribesentimentruntranscribesentiment(voiceRecording, $event    )" translate="VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING">\n                          RunTranscribeSentiment VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'COMPLETED\' && voiceRecording.sentiment == null && vm.license.ai">\n\n                        <md-button ng-click="vm.runsentimentruntranscribesentiment(voiceRecording, $event    )" translate="VOICE.RUNSENTIMENT_VOICERECORDING">\n                          RunSentiment VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'COMPLETED\' && vm.license.ai">\n\n                        <md-button ng-click="vm.downloadtranscribefile2(voiceRecording, $event    )" translate="VOICE.DOWNLOADTRANSCRIBE_VOICERECORDING">\n                          DownloadTranscribe VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadVoiceRecordings">\n\n                        <md-button ng-click="vm.downloadfile2(voiceRecording, $event  , \'voice/recordings\'   )" translate="VOICE.DOWNLOAD_VOICERECORDING">\n                          Download VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voiceRecording, $event    )" translate="VOICE.DELETE_VOICERECORDING">\n                          Delete VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceRecordings.count}}" md-on-paginate="vm.getVoiceRecordings" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICERECORDING TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/whatsapp/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="WHATSAPP.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'WHATSAPP.NAME\' | translate }}</th>\n        <th md-column>{{ \'WHATSAPP.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'WHATSAPP.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'WHATSAPP.WAITING\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="WHATSAPP.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedIn }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="WHATSAPP.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="WHATSAPP.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/whatsapp/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/create/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.whatsappAccount.name" ng-required="true" autofocus ng-disabled="!vm.newWhatsappAccount">\n\n        <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n        <div ng-messages="whatsappAccountForm[\'name\'].$error" ng-show="whatsappAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.whatsappAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="whatsappAccountForm[\'key\'].$error" ng-show="whatsappAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.whatsappAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="WHATSAPP.HELP.LIST"></span></div>\n        <div ng-messages="whatsappAccountForm[\'ListId\'].$error" ng-show="whatsappAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.MOTIONPROXY">MotionProxy</label>\n        <input type="url" name="remote" ng-model="vm.whatsappAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="WHATSAPP.HELP.MOTIONPROXY"></span></div>\n        <div ng-messages="whatsappAccountForm[\'remote\'].$error" ng-show="whatsappAccountForm[\'remote\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.whatsappAccount.type">\n          <md-option ng-value="\'twilio\'">Twilio</md-option>\n          <md-option ng-value="\'sinch\'">Sinch</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountForm[\'type\'].$error" ng-show="whatsappAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\' || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n        <label translate="WHATSAPP.ACCOUNTSID">AccountSID</label>\n        <input type="text" name="accountSid" ng-model="vm.whatsappAccount.accountSid" ng-required="true">\n\n        <div ng-messages="whatsappAccountForm[\'accountSid\'].$error" ng-show="whatsappAccountForm[\'accountSid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\' || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n        <label translate="WHATSAPP.AUTHTOKEN">AuthToken</label>\n        <input type="text" name="authToken" ng-model="vm.whatsappAccount.authToken" ng-required="true">\n\n        <div ng-messages="whatsappAccountForm[\'authToken\'].$error" ng-show="whatsappAccountForm[\'authToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.whatsappAccount.type == \'sinch\'" class="md-block">\n        <label translate="WHATSAPP.BASEURL">Base URL</label>\n\n        \x3c!--    <input type="text" name="baseUrl" ng-model="vm.whatsappAccount.baseUrl" ng-required="true"> --\x3e\n\n        <md-select name="baseUrl" ng-model="vm.whatsappAccount.baseUrl" required>\n          <md-option ng-value="\'https://us1.whatsapp.api.sinch.com\'">US Production</md-option>\n          <md-option ng-value="\'https://eu1.whatsapp.api.sinch.com\'">EU Production</md-option>\n        </md-select>\n\n        <div ng-messages="whatsappAccountForm[\'authToken\'].$error" ng-show="whatsappAccountForm[\'authToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PHONE">phone</label>\n        <input type="text" name="phone" ng-model="vm.whatsappAccount.phone" ng-required="true">\n        <div ng-messages="whatsappAccountForm[\'phone\'].$error" ng-show="whatsappAccountForm[\'phone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PHONE_REQUIRED">phone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.whatsappAccount.description">\n\n        <div ng-messages="whatsappAccountForm[\'description\'].$error" ng-show="whatsappAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newWhatsappAccount" ng-click="vm.saveWhatsappAccount()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountForm.$invalid || whatsappAccountForm.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newWhatsappAccount" ng-click="vm.addNewWhatsappAccount()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountForm.$invalid" aria-label="ADD" translate="WHATSAPP.ADD_WHATSAPPACCOUNT" translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPACCOUNT">\n          ADD WHATSAPPACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newWhatsappAccount" ng-click="vm.deleteWhatsappAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="WHATSAPP.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="WHATSAPP.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/agentadd/agentadd.html",'<md-dialog class="whatsappAccount-dialog" aria-label="whatsappAccount" ng-init="vm.onInit()">\n  <form name="whatsappAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="WHATSAPP.AGENTADD_WHATSAPPACCOUNT">Add Agent to whatsappAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/agent/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'agent\'].$error" ng-show="whatsappAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'timeout\'].$error" ng-show="whatsappAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/amazonlex/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'accesskeyid\'].$error" ng-show="whatsappAccountFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'secretaccesskey\'].$error" ng-show="whatsappAccountFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'lexregion\'].$error" ng-show="whatsappAccountFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'botname\'].$error" ng-show="whatsappAccountFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="WHATSAPP.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="whatsappAccountFormApp[\'welcomemessage\'].$error" ng-show="whatsappAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'times\'].$error" ng-show="whatsappAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="whatsappAccountFormApp[\'text\'].$error" ng-show="whatsappAccountFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/close/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'disposition\'].$error" ng-show="whatsappAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/dialogflow/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'key\'].$error" ng-show="whatsappAccountFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'language\'].$error" ng-show="whatsappAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="WHATSAPP.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="whatsappAccountFormApp[\'welcomemessage\'].$error" ng-show="whatsappAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'projectId\'].$error" ng-show="whatsappAccountFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'clientEmail\'].$error" ng-show="whatsappAccountFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="whatsappAccountFormApp[\'privateKey\'].$error" ng-show="whatsappAccountFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'language\'].$error" ng-show="whatsappAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="WHATSAPP.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="whatsappAccountFormApp[\'welcomemessage\'].$error" ng-show="whatsappAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'condition\'].$error" ng-show="whatsappAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'truepriority\'].$error" ng-show="whatsappAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'falsepriority\'].$error" ng-show="whatsappAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'priority\'].$error" ng-show="whatsappAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/noop/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'value\'].$error" ng-show="whatsappAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/queue/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'queue\'].$error" ng-show="whatsappAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'timeout\'].$error" ng-show="whatsappAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/system/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'command\'].$error" ng-show="whatsappAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'variable\'].$error" ng-show="whatsappAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/tag/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'tag\'].$error" ng-show="whatsappAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/view.html",'<div id="whatsapp-whatsappAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-whatsappAccounts-button md-icon-button" aria-label="Go to whatsappAccounts" ng-click="vm.gotoWhatsappAccounts()" translate translate-attr-aria-label="WHATSAPP.GO_TO_WHATSAPPACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="whatsappAccount-image" hide-xs>\n          <img ng-src="assets/images/business/whatsappAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.whatsappAccount.id}}\n            <span ng-if="vm.whatsappAccount.name">{{vm.whatsappAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="WHATSAPP.CREATED_AT"></span> <span>{{vm.whatsappAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.whatsappAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="WHATSAPP.AGENTADD_WHATSAPPACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveWhatsappAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (proxyForm.$invalid) || (dispositionForm.$invalid) || (whatsappDispositionsForm.$invalid) || (whatsappCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.whatsappAccount.name" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.whatsappAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="WHATSAPP.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.whatsappAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="WHATSAPP.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\'  || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n                <label translate="WHATSAPP.ACCOUNTSID">AccountSID</label>\n                <input type="text" name="accountSid" ng-model="vm.whatsappAccount.accountSid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'accountSid\'].$error" ng-show="generalForm[\'accountSid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\'  || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n                <label translate="WHATSAPP.AUTHTOKEN">AuthToken</label>\n                <input type="text" name="authToken" ng-model="vm.whatsappAccount.authToken" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'authToken\'].$error" ng-show="generalForm[\'authToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n\n              <md-input-container ng-if="vm.whatsappAccount.type == \'sinch\'" class="md-block">\n                <label translate="WHATSAPP.BASEURL">BaseURL</label>\n\n                <md-select name="baseUrl" ng-model="vm.whatsappAccount.baseUrl" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryBaseUrl.url" ng-repeat="mandatoryBaseUrl in vm.baseUrl" ng-disabled="mandatoryBaseUrl.canSelect === false">{{ mandatoryBaseUrl.name }}</md-option>\n                </md-select>\n\n                <div ng-messages="generalForm[\'baseUrl\'].$error" ng-show="generalForm[\'baseUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.BASEURL_REQUIRED">Base URL field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.PHONE">phone</label>\n                <input type="text" name="phone" ng-model="vm.whatsappAccount.phone" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'phone\'].$error" ng-show="generalForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.PHONE_REQUIRED">phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.RECEIVEURL">receiveUrl</label>\n\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-receiveUrl" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-receiveUrl" name="receiveUrl" ng-value="vm.whatsappAccount.remote + \'/api/whatsapp/accounts/\' + vm.whatsappAccount.id + \'/notify?token=\' + vm.whatsappAccount.token" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="WHATSAPP.HELP.RECEIVEURL"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.whatsappAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.whatsappAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="whatsappAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="WHATSAPP.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.whatsappAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="whatsappAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.queueTransfer == true" class="md-block">\n                <label translate="WHATSAPP.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.whatsappAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.agentTransfer == true" class="md-block">\n                <label translate="WHATSAPP.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.whatsappAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container proxy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.PROXY">PROXY</div>\n            </div>\n            <form name="proxyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.MOTIONPROXY">MotionProxy</label>\n                <input type="url" name="remote" ng-model="vm.whatsappAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="WHATSAPP.HELP.MOTIONPROXY"></span></div>\n                <div ng-messages="proxyForm[\'remote\'].$error" ng-show="proxyForm[\'remote\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.TOKEN">token</label>\n                <input type="text" name="token" ng-model="vm.whatsappAccount.token" disabled>\n\n                <div ng-messages="proxyForm[\'token\'].$error" ng-show="proxyForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.TOKEN_REQUIRED">token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="whatsappAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.mandatoryDisposition" class="md-block">\n                <label translate="WHATSAPP.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.whatsappAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="WHATSAPP.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="WhatsappAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.whatsappAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="whatsappAccount-detail-form-container whatsappdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedWhatsappAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="WHATSAPP.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add whatsapp dispositions" translate translate-attr-label="WHATSAPP.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="whatsappAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'WHATSAPP.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'WHATSAPP.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'WHATSAPP.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="WHATSAPP.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container whatsappcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="WhatsappAccountWhatsappCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.whatsappAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="WHATSAPP.WHATSAPPCANNEDANSWERS">WhatsappCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getWhatsappAccountWhatsappCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event)" aria-label="add whatsappCannedAnswer" translate translate-attr-label="WHATSAPP.ADD_WHATSAPPCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length}} {{vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedWhatsappAccountWhatsappCannedAnswers" csv-label="true" filename="whatsappAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedWhatsappAccountWhatsappCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedWhatsappAccountWhatsappCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getWhatsappAccountWhatsappCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'WHATSAPP.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'WHATSAPP.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'WHATSAPP.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'WHATSAPP.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'WHATSAPP.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="whatsappCannedAnswer" md-select-id="id" ng-repeat="whatsappCannedAnswer in vm_dc.whatsappAccountWhatsappCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{ whatsappCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" translate="WHATSAPP.EDIT_WHATSAPPCANNEDANSWER">\n                                Edit WhatsappCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(whatsappCannedAnswer, $event)" translate="WHATSAPP.DELETE_WHATSAPPCANNEDANSWER">\n                                Delete WhatsappCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.whatsappAccountWhatsappCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="WHATSAPP.NO_WHATSAPPCANNEDANSWER_AVAILABLE">No whatsappcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.whatsappAccountWhatsappCannedAnswers.count}}" md-on-paginate="vm_dc.getWhatsappAccountWhatsappCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="WhatsappAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.whatsappAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="WHATSAPP.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedWhatsappAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedWhatsappAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedWhatsappAccountApps.length}} {{vm_ac.selectedWhatsappAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedWhatsappAccountApps($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedWhatsappAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.whatsappAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editWhatsappAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editWhatsappAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editWhatsappAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editWhatsappAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.whatsappAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="WhatsappAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.whatsappAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedWhatsappAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="WHATSAPP.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getWhatsappAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getWhatsappAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getWhatsappAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="WHATSAPP.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedWhatsappAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedWhatsappAccountInteractions.length}} {{vm_dc.selectedWhatsappAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedWhatsappAccountInteractions" csv-label="true" filename="whatsappAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedWhatsappAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedWhatsappAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getWhatsappAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'WHATSAPP.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'WHATSAPP.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'WHATSAPP.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'WHATSAPP.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'WHATSAPP.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'WHATSAPP.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'WHATSAPP.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.whatsappAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'WHATSAPP.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'WHATSAPP.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spywhatsappInteraction($event, interaction)" translate="WHATSAPP.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.whatsappInteractionDownload(interaction, $event)" translate="WHATSAPP.DOWNLOAD_INTERACTION">\n                                Download\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="WHATSAPP.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.whatsappAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="WHATSAPP.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.whatsappAccountInteractions.count}}" md-on-paginate="vm_dc.getWhatsappAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/whatsappCannedAnswers/dialog.html",'<md-dialog class="whatsappCannedAnswer-dialog" aria-label="New WhatsappCannedAnswer">\n  <form name="whatsappCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.whatsappCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="whatsappCannedAnswerForm[\'key\'].$error" ng-show="whatsappCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.whatsappCannedAnswer.value" required></textarea>\n\n        <div ng-messages="whatsappCannedAnswerForm[\'value\'].$error" ng-show="whatsappCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.whatsappCannedAnswer.description">\n\n        <div ng-messages="whatsappCannedAnswerForm[\'description\'].$error" ng-show="whatsappCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newWhatsappCannedAnswer" ng-click="vm.saveWhatsappCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="whatsappCannedAnswerForm.$invalid || whatsappCannedAnswerForm.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newWhatsappCannedAnswer" ng-click="vm.addNewWhatsappCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="whatsappCannedAnswerForm.$invalid" aria-label="ADD" translate="WHATSAPP.ADD_WHATSAPPCANNEDANSWER" translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPCANNEDANSWER">\n          ADD WHATSAPPCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newWhatsappCannedAnswer" ng-click="vm.deleteWhatsappCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="WHATSAPP.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="WHATSAPP.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/whatsappAccounts.html",'<div id="whatsappAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-whatsapp" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="WHATSAPP.WHATSAPPACCOUNTS">WhatsappAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="WHATSAPP.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedWhatsappAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedWhatsappAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="WHATSAPP.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-whatsappAccounts-count">\n          <span>{{vm.selectedWhatsappAccounts.length}}</span>\n          <span translate="WHATSAPP.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="WHATSAPP.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllWhatsappAccounts()" translate="WHATSAPP.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectWhatsappAccounts()" translate="WHATSAPP.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedWhatsappAccounts" csv-label="true" filename="whatsappAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedWhatsappAccounts($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- WHATSAPPACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedWhatsappAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getWhatsappAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'WHATSAPP.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'WHATSAPP.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'WHATSAPP.KEY\' | translate }}</th>\n                <th md-column md-order-by="ListId">{{ \'WHATSAPP.LIST\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'WHATSAPP.TYPE\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'WHATSAPP.PHONE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'WHATSAPP.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.whatsappAccounts.rows.length">\n                <td md-cell colspan="8">\n                  <div layout="row" layout-align="center center">\n                    <span translate="WHATSAPP.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="whatsappAccount" md-select-id="id" ng-repeat="whatsappAccount in vm.whatsappAccounts.rows">\n                <td md-cell ng-if="whatsappAccount.userpic"><img class="avatar" alt="{{whatsappAccount.name}}" ng-src="api/users/{{whatsappAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!whatsappAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{whatsappAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="id ">{{whatsappAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="name ">{{whatsappAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="key ">{{whatsappAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="ListId ">{{ (vm.lists | filter : {\'id\':whatsappAccount.ListId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="type ">{{ vm.arraytype[whatsappAccount.type].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="phone ">{{whatsappAccount.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="description ">{{whatsappAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(whatsappAccount, $event    )" translate="WHATSAPP.EDIT_WHATSAPPACCOUNT">\n                          Edit WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(whatsappAccount, $event    )" translate="WHATSAPP.INTERACTIONS_WHATSAPPACCOUNT">\n                          Interactions WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(whatsappAccount, $event    )" translate="WHATSAPP.AGENTADD_WHATSAPPACCOUNT">\n                          AgentAdd WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(whatsappAccount, $event    )" translate="WHATSAPP.DELETE_WHATSAPPACCOUNT">\n                          Delete WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.whatsappAccounts.count}}" md-on-paginate="vm.getWhatsappAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / WHATSAPPACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD WHATSAPPACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-whatsappAccount-button" ng-click="vm.createOrEditWhatsappAccount($event)" aria-label="add whatsappAccount" translate translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD WHATSAPPACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/create/dialog.html",'<md-dialog class="whatsappQueue-dialog" aria-label="New WhatsappQueue">\n  <form name="whatsappQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.whatsappQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newWhatsappQueue">\n\n        <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n        <div ng-messages="whatsappQueueForm[\'name\'].$error" ng-show="whatsappQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="WHATSAPP.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.whatsappQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="whatsappQueueForm[\'strategy\'].$error" ng-show="whatsappQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.whatsappQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="whatsappQueueForm[\'timeout\'].$error" ng-show="whatsappQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.whatsappQueue.description">\n\n        <div ng-messages="whatsappQueueForm[\'description\'].$error" ng-show="whatsappQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newWhatsappQueue" ng-click="vm.saveWhatsappQueue()" class="send-button md-accent md-raised" ng-disabled="whatsappQueueForm.$invalid || whatsappQueueForm.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newWhatsappQueue" ng-click="vm.addNewWhatsappQueue()" class="send-button md-accent md-raised" ng-disabled="whatsappQueueForm.$invalid" aria-label="ADD" translate="WHATSAPP.ADD_WHATSAPPQUEUE" translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPQUEUE">\n          ADD WHATSAPPQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newWhatsappQueue" ng-click="vm.deleteWhatsappQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="WHATSAPP.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="WHATSAPP.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/edit/agentadd/agentadd.html",'<md-dialog class="whatsappQueue-dialog" aria-label="whatsappQueue" ng-init="vm.onInit()">\n  <form name="whatsappQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="WHATSAPP.AGENTADD_WHATSAPPQUEUE">Add Agent to whatsappQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/edit/teamadd/teamadd.html",'<md-dialog class="whatsappQueue-dialog" aria-label="whatsappQueue" ng-init="vm.onInit()">\n  <form name="whatsappQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="WHATSAPP.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/edit/view.html",'<div id="whatsapp-whatsappQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-whatsappQueues-button md-icon-button" aria-label="Go to whatsappQueues" ng-click="vm.gotoWhatsappQueues()" translate translate-attr-aria-label="WHATSAPP.GO_TO_WHATSAPPQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="whatsappQueue-image" hide-xs>\n          <img ng-src="assets/images/business/whatsappQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.whatsappQueue.id}}\n            <span ng-if="vm.whatsappQueue.name">{{vm.whatsappQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="WHATSAPP.CREATED_AT"></span> <span>{{vm.whatsappQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.whatsappQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="WHATSAPP.TEAMADD_WHATSAPPQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.whatsappQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="WHATSAPP.AGENTADD_WHATSAPPQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveWhatsappQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.whatsappQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="WHATSAPP.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.whatsappQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.whatsappQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.whatsappQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/whatsappQueues.html",'<div id="whatsappQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-whatsapp" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="WHATSAPP.WHATSAPPQUEUES">WhatsappQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="WHATSAPP.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedWhatsappQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedWhatsappQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="WHATSAPP.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-whatsappQueues-count">\n          <span>{{vm.selectedWhatsappQueues.length}}</span>\n          <span translate="WHATSAPP.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="WHATSAPP.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllWhatsappQueues()" translate="WHATSAPP.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectWhatsappQueues()" translate="WHATSAPP.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedWhatsappQueues" csv-label="true" filename="whatsappQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedWhatsappQueues($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- WHATSAPPQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedWhatsappQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getWhatsappQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'WHATSAPP.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'WHATSAPP.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'WHATSAPP.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.whatsappQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="WHATSAPP.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="whatsappQueue" md-select-id="id" ng-repeat="whatsappQueue in vm.whatsappQueues.rows">\n                <td md-cell ng-if="whatsappQueue.userpic"><img class="avatar" alt="{{whatsappQueue.name}}" ng-src="api/users/{{whatsappQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!whatsappQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{whatsappQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappQueue, ev) : vm.createOrEditWhatsappQueue($event, whatsappQueue)" md-cell class="id ">{{whatsappQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappQueue, ev) : vm.createOrEditWhatsappQueue($event, whatsappQueue)" md-cell class="name ">{{whatsappQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappQueue, ev) : vm.createOrEditWhatsappQueue($event, whatsappQueue)" md-cell class="strategy ">{{ vm.arraystrategy[whatsappQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(whatsappQueue, $event    )" translate="WHATSAPP.EDIT_WHATSAPPQUEUE">\n                          Edit WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(whatsappQueue, $event    )" translate="WHATSAPP.TEAMADD_WHATSAPPQUEUE">\n                          teamadd WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(whatsappQueue, $event    )" translate="WHATSAPP.AGENTADD_WHATSAPPQUEUE">\n                          agentadd WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(whatsappQueue, $event    )" translate="WHATSAPP.DELETE_WHATSAPPQUEUE">\n                          Delete WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(whatsappQueue, $event    )" translate="WHATSAPP.GOTOREALTIME_WHATSAPPQUEUE">\n                          goToRealtime WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.whatsappQueues.count}}" md-on-paginate="vm.getWhatsappQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / WHATSAPPQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD WHATSAPPQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-whatsappQueue-button" ng-click="vm.createOrEditWhatsappQueue($event)" aria-label="add whatsappQueue" translate translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD WHATSAPPQUEUE BUTTON --\x3e\n</div>'),e.put("app/navigation/layouts/horizontal-navigation/navigation.html",'<div layout="row" layout-align="start center">\n  <ms-navigation-horizontal></ms-navigation-horizontal>\n</div>'),e.put("app/navigation/layouts/vertical-navigation-fullwidth-toolbar-2/navigation.html",'<ms-navigation class="scrollable" folded="vm.folded"></ms-navigation>'),e.put("app/navigation/layouts/vertical-navigation/navigation.html",'<md-toolbar class="navigation-header md-whiteframe-1dp" layout="row" layout-align="space-between center">\n  <div class="logo" layout="row" layout-align="start center">\n    <span class="logo-image"><img src="/api/settings/1/logo" alt="logo" /></span>\n    \x3c!-- <span class="logo-image"><img src="assets/images/logos/whisker_32x32.png" alt="motion_whisker_32x32" /></span> --\x3e\n    <span class="logo-text text-truncate">{{vm.getLogo() | uppercase}}</span>\n  </div>\n  <md-icon class="fold-toggle s18" md-font-icon="icon-backburger" hide show-gt-sm ng-click="vm.toggleMsNavigationFolded()"></md-icon>\n</md-toolbar>\n\n<ms-navigation class="scrollable" folded="vm.folded"></ms-navigation>'),e.put("app/quick-panel/quick-panel.html",'<md-content>\n  <md-tabs md-no-pagination md-swipe-content md-stretch-tabs="always">\n    <md-tab>\n      <md-tab-label>\n        <span translate="QUICKPANEL.TODAY">TODAY</span>\n      </md-tab-label>\n      <md-tab-body>\n        <md-content class="today-tab scrollable" ng-include="\'app/quick-panel/tabs/today/today-tab.html\'"></md-content>\n      </md-tab-body>\n    </md-tab>\n    <md-tab ng-if="vm.currentUser.allowmessenger || vm.currentUser.role !== \'agent\'" ng-include="\'app/quick-panel/tabs/chat/chat-tab.html\'" ng-controller="ChatInternalController as vm_ct" ng-init="vm_ct.init(vm.license)" md-on-deselect="vm_ct.user = undefined">\n      <md-tab-label>\n        <div ng-if="vm.unreadTotalMessages" class="md-accent-bg unread-message-count-chat">{{vm.unreadTotalMessages}}</div>\n        <span>MESSENGER</span>\n      </md-tab-label>\n      <md-tab-body>\n        <md-content class="chat-tab scrollable" ng-include="\'app/quick-panel/tabs/chat/chat-tab.html\'"></md-content>\n      </md-tab-body>\n    </md-tab>\n    <md-tab ng-if="vm.currentUser.allowmessenger || vm.currentUser.role !== \'agent\'" ng-include="\'app/quick-panel/tabs/groups/group-tab.html\'" ng-controller="ChatGroupController as vm_cg" ng-init="vm_cg.init(vm.license)" md-on-deselect="vm_cg.group = undefined">\n      <md-tab-label>\n        <div ng-if="vm.unreadTotalGroupMessages" class="md-accent-bg unread-message-count-chat">{{vm.unreadTotalGroupMessages}}</div>\n        <span translate="QUICKPANEL.GROUPS">GROUPS</span>\n      </md-tab-label>\n      <md-tab-body>\n        <md-content class="group-tab scrollable" ng-include="\'app/quick-panel/tabs/groups/group-tab.html\'"></md-content>\n      </md-tab-body>\n    </md-tab>\n  </md-tabs>\n</md-content>'),e.put("app/quick-panel/tabs/activity/activity-tab.html",'<md-list class="friends">\n  <md-subheader class="md-no-sticky">\n    <span translate="QUICKPANEL.FRIENDS">Friends</span>\n  </md-subheader>\n\n  <md-list-item class="friend md-3-line" ng-repeat="friend in vm.activities.friends">\n    <img ng-src="{{friend.avatar}}" class="md-avatar" alt="{{friend.name}}" />\n\n    <div class="status {{friend.status}}"></div>\n\n    <div ng-if="contact.unread" class="md-accent-bg unread-message-count">{{contact.unread}}</div>\n\n    <div class="md-list-item-text">\n      <h3 class="message">{{friend.message}}</h3>\n      <p class="time">{{friend.time}}</p>\n    </div>\n  </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list class="servers">\n  <md-subheader class="md-no-sticky">\n    <span translate="QUICKPANEL.APP_SERVERS">Application Servers</span>\n  </md-subheader>\n\n  <md-list-item class="server md-3-line" ng-repeat="server in vm.activities.servers">\n    <md-icon md-font-icon="icon-checkbox-blank-circle" class="s16 status" ng-class="server.status"></md-icon>\n\n    <div class="md-list-item-text">\n      <h3>{{server.location}}</h3>\n      <p>{{server.detail}}</p>\n    </div>\n  </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list class="stats">\n  <md-subheader class="md-no-sticky">\n    <span translate="QUICKPANEL.USER_STATS">User Stats</span>\n  </md-subheader>\n\n  <md-list-item class="stat md-2-line" ng-repeat="stat in vm.activities.stats">\n    <div class="md-list-item-text">\n      <span>{{stat.title}} ({{stat.current}} / {{stat.total}})</span>\n      <md-progress-linear ng-class="stat.status" md-mode="determinate" value="{{stat.percent}}"></md-progress-linear>\n    </div>\n  </md-list-item>\n</md-list>'),e.put("app/quick-panel/tabs/chat/chat-tab.html",'<div class="main" ng-hide="vm_ct.user">\n  <md-subheader class="md-no-sticky">\n    <div class="search" layout="row" layout-align="space-between center">\n      <md-icon md-font-icon="icon-magnify" class="icon search-icon"></md-icon>\n      <input class="search-input" ng-model="vm_ct.search.$" type="text" placeholder="Search by fullname.." translate translate-attr-placeholder="QUICKPANEL.SEARCH" flex>\n      <md-select ng-model="vm_ct.search.online" class="height-50 no-padding no-margin" aria-label="Chat Tab Search">\n        <md-option ng-value="undefined">All</md-option>\n        <md-option ng-value="true">\n          <md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 green-fg"></md-icon>Online\n        </md-option>\n        <md-option ng-value="false">\n          <md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 red-fg"></md-icon>Offline\n        </md-option>\n      </md-select>\n    </div>\n  </md-subheader>\n  \x3c!-- <select ng-model="vm_ct.filterOnline" class="height-50 no-padding no-margin">\n            <option ng-value="undefined">All</option>\n            <option ng-value="true"><md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 green-fg"></md-icon>Online</option>\n            <option ng-value="false"><md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 red-fg"></md-icon>Offline</option>\n        </select> --\x3e\n  <md-divider></md-divider>\n  <md-list class="recent">\n    <md-list-item class="contact md-3-line" ng-if="user.id != vm_ct.currentUser.id" ng-repeat="user in vm_ct.users.rows | orderBy: \'-lastMessageAt\' | filter:vm_ct.search" ng-click="vm_ct.toggleChat(user)">\n      <md-divider></md-divider>\n      <img ng-src="{{user.userpic ? \'api/users/\' + user.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}" class="md-avatar" alt="{{user.fullname}}" />\n      <div class="status" ng-class="{true: \'online\', false: \'offline\'}[user.online]"></div>\n      <div ng-if="vm_ct.unreadMessage[user.id]" class="md-accent-bg unread-message-count">\n        {{vm_ct.unreadMessage[user.id]}}</div>\n      <div class="md-list-item-text">\n        <div layout="row">\n          <h3>{{user.fullname}}</h3>\n          <md-icon ng-if="!user.allowmessenger && user.role === \'agent\'" class="s16 margin-left-5" ng-style="{\'color\': \'red\' }" md-font-icon="icon-block-helper"></md-icon>\n        </div>\n        <p>{{user.name}} &#60;{{user.internal}}&#62;</p>\n        <div layout="row" layout-align="start center">\n          <md-icon ng-if="!user.lastMessage.read && user.lastMessage.FromId === vm_ct.currentUser.id" class="s16 no-margin" md-font-icon="icon-check"></md-icon>\n          <md-icon ng-if="user.lastMessage.read && user.lastMessage.FromId === vm_ct.currentUser.id" class="s16 no-margin" md-font-icon="icon-check-all md-accent"></md-icon>\n          <p>{{user.lastMessage.body | limitTo:20 }}{{user.lastMessage.body.length > 20 ? \'...\' : \'\' }}</p>\n          <span flex></span>\n          <p class="last-message" ng-if="user.lastMessageAt != vm_ct.standardDate">\n            {{user.lastMessageAt | formatdate}}</p>\n        </div>\n      </div>\n    </md-list-item>\n  </md-list>\n</div>\n\n<div class="chat" ng-show="vm_ct.user" layout="column">\n  <md-toolbar class="md-accent">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n\n      <div layout="row" layout-align="start center">\n        <md-button class="md-icon-button" ng-click="vm_ct.toggleChat()" aria-label="Back" translate translate-attr-aria-label="QUICKPANEL.BACK">\n          <md-icon md-font-icon="icon-keyboard-backspace"></md-icon>\n        </md-button>\n        <h4>\n          <span>{{vm_ct.user.fullname}}</span>\n        </h4>\n      </div>\n\n      <div layout="row" layout-align="end center">\n        <md-button ng-if="vm_ct.license.webrtc && vm_ct.currentUser.role === \'agent\' && vm_ct.currentUser.showWebBar === 2 && vm_ct.user.role === \'agent\'" class="md-icon-button" aria-label="Call" translate translate-attr-aria-label="QUICKPANEL.CALL" ng-click="vm_ct.webcall(vm_ct.user.name)">\n          <md-icon md-font-icon="icon-phone"></md-icon>\n        </md-button>\n        <md-menu ng-if="vm_ct.currentUser.phoneBarRemoteControl && vm_ct.currentUser.role === \'agent\' && vm_ct.currentUser.showWebBar === 0 && vm_ct.user.role === \'agent\'">\n          <md-button class="md-icon-button" aria-label="Call" translate translate-attr-aria-label="QUICKPANEL.CALL" ng-click="$mdOpenMenu($event)">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n\n          <md-menu-content width="3">\n            <md-menu-item ng-disabled="!vm_ct.currentUser.phoneBarRemoteControl">\n              <md-button ng-click="vm_ct.call(vm_ct.user.name)">\n                {{\'DASHBOARDS.CALL_NUMBER\' | translate}} ({{vm_ct.user.name}})\n              </md-button>\n            </md-menu-item>\n            <md-menu-item ng-disabled="!vm_ct.currentUser.phoneBarRemoteControl">\n              <md-button ng-click="vm_ct.transfer(vm_ct.user.name)">\n                {{\'DASHBOARDS.TRANSFER_NUMBER\' | translate}} ({{vm_ct.user.name}})\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n    </div>\n\n  </md-toolbar>\n  <md-content flex layout-paddings id="chat-dialog">\n    <div layout="row" ng-repeat="message in vm_ct.user.messages.rows" class="md-padding message-row" ng-class="message.FromId === vm_ct.currentUser.id ? \'user\' : \'contact\'">\n      <img ng-if="message.FromId === vm_ct.user.id" ng-src="{{vm_ct.user.userpic ? \'api/users/\' + vm_ct.user.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}" class="avatar" alt="{{vm_ct.user.fullname}}" />\n      <img ng-if="message.FromId === vm_ct.currentUser.id" class="avatar" ng-src="{{vm_ct.currentUser.userpic ? \'api/users/\' + vm_ct.currentUser.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}">\n      <div class="bubble" flex>\n        <span class="message" ng-bind-html="message.body | embed:{linkTarget:\'_blank\',emoji:false,fontSmiley:false}"></span>\n        <div layout="row" layout-align="end center">\n          <span class="time secondary-text">{{message.createdAt | formatdate }}</span>\n          <md-icon ng-if="!message.read && message.FromId === vm_ct.currentUser.id" class="s16 margin-5" md-font-icon="icon-check"></md-icon>\n          <md-icon ng-if="message.read && message.FromId === vm_ct.currentUser.id" class="s16 margin-5" md-font-icon="icon-check-all md-accent"></md-icon>\n        </div>\n      </div>\n    </div>\n  </md-content>\n\n  <form ng-submit="vm_ct.reply()" layout="row" class="reply" layout-align="start center">\n    <textarea ng-keyup="$event.keyCode == 13 && !vm_ct.disabled? vm_ct.reply() : null" flex ng-model="vm_ct.replyMessage" placeholder="Type and hit enter to send message" translate translate-attr-placeholder="QUICKPANEL.REPLY_PLACEHOLDER" autofocus></textarea>\n\n    <md-button ng-disable="vm_ct.disabled" class="md-fab md-mini" type="submit" aria-label="Send message" translate translate-attr-aria-label="QUICKPANEL.SEND_MESSAGE">\n      <md-icon md-font-icon="icon-send"></md-icon>\n    </md-button>\n  </form>\n</div>'),e.put("app/quick-panel/tabs/groups/create/dialog.html",'<md-dialog class="group-dialog" aria-label="New ChatGroup">\n  <form name="groupForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog(null)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      \x3c!--START Error--\x3e\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      \x3c!--END Error--\x3e\n\n      \x3c!--START NAME--\x3e\n      <md-input-container class="md-block">\n        <label translate="QUICKPANEL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.group.name" required autofocus>\n        <div ng-messages="groupForm[\'name\'].$error" ng-show="groupForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="QUICKPANEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="QUICKPANEL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      \x3c!--END NAME--\x3e\n\n      \x3c!--START Members--\x3e\n      <md-input-container class="md-block">\n        <label translate="QUICKPANEL.MEMBERS">Members</label>\n        <md-contact-chips ng-model="vm.group.members" md-contacts="vm.querySearch($query)" md-contact-name="name" md-contact-image="image" md-require-match="true" md-highlight-flags="i" placeholder="{{\'QUICKPANEL.MEMBERS\' | translate}}">\n        </md-contact-chips>\n        <div ng-messages="groupForm[\'strategy\'].$error" ng-show="groupForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="QUICKPANEL.ERRORS.MEMBERS_REQUIRED">Members field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      \x3c!--END Members--\x3e\n\n      \x3c!--START Writing--\x3e\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.group.write" aria-label="Write">\n          {{\'QUICKPANEL.ENABLE_WRITING\' | translate}}\n        </md-switch>\n      </md-input-container>\n      \x3c!--END Writing--\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.newChatGroup" ng-click="vm.saveChatGroup()" class="send-button md-accent md-raised" ng-disabled="groupForm.$invalid || groupForm.$pristine || (vm.group.members.length < 1)" aria-label="SAVE" translate="QUICKPANEL.SAVE" translate-attr-aria-label="QUICKPANEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/quick-panel/tabs/groups/group-tab.html",'<div class="main" ng-if="!vm_cg.group">\n  <md-subheader>\n    <div layout="row">\n      \x3c!-- START Search --\x3e\n      <div class="search" layout="row" layout-align="start center" flex>\n        <md-icon md-font-icon="icon-magnify" class="icon search-icon"></md-icon>\n        <input ng-model="vm_cg.search" type="text" translate translate-attr-placeholder="QUICKPANEL.SEARCH" flex>\n      </div>\n      \x3c!-- END Search --\x3e\n\n      \x3c!-- START New Group --\x3e\n      <md-button ng-if="vm_cg.currentUser.role !== \'agent\'" class="md-icon-button" aria-label="New" ng-click="vm_cg.addGroup(null, $event)">\n        <md-icon md-font-icon="icon-account-multiple-plus" class="icon"></md-icon>\n      </md-button>\n      \x3c!-- END New Group --\x3e\n    </div>\n  </md-subheader>\n\n  <md-divider></md-divider>\n\n  \x3c!-- START Groups --\x3e\n  <md-list class="recent no-padding">\n    \x3c!-- START Group --\x3e\n    <md-list-item class="contact" ng-repeat="group in vm_cg.groupsToArray() | filter:vm_cg.search" ng-click="vm_cg.toggleChat(group)">\n      <img src="assets/images/avatars/group.png" class="md-avatar" alt="{{group.name}}" />\n      <div ng-if="group.unreadGroupMessages" class="md-accent-bg unread-message-count">{{group.unreadGroupMessages}}</div>\n      <div class="md-list-item-text">\n        <div layout="row">\n          <h3>{{group.name}}</h3>\n        </div>\n      </div>\n\n      <md-button ng-if="vm_cg.currentUser.role !== \'agent\'" class="md-secondary md-icon-button" aria-label="Remove" ng-click="vm_cg.deleteGroup(group, $event)">\n        <md-icon md-font-icon="icon-delete" class="icon s18"></md-icon>\n      </md-button>\n\n      <md-divider ng-if="!$last"></md-divider>\n    </md-list-item>\n    <md-list-item>\n      <div ng-if="!vm_cg.groupsToArray().length" layout="row" layout-align="center center" flex>\n        <span>{{\'QUICKPANEL.NO_AVAILABLE_GROUPS\' | translate}}</span>\n      </div>\n    </md-list-item>\n    \x3c!-- END Group --\x3e\n  </md-list>\n  \x3c!-- END Groups --\x3e\n</div>\n\n<div class="chat" ng-if="vm_cg.group" layout="column">\n  <md-toolbar class="md-accent">\n    <div class="md-toolbar-tools " layout="row" layout-align="space-between center">\n      <md-button class="md-icon-button" ng-click="vm_cg.back()" aria-label="Back" translate translate-attr-aria-label="QUICKPANEL.BACK" flex="15">\n        <md-icon md-font-icon="icon-keyboard-backspace"></md-icon>\n      </md-button>\n      <h4 flex layout-align="start center" style="max-height: 100%; overflow-y:auto;">\n        <span translate="QUICKPANEL.YOU" translate-values=\'{participants: vm_cg.participants}\'></span>\n      </h4>\n\n      <div layout="row" layout-align="end center">\n        <md-button ng-if="vm_cg.license.webrtc && vm_cg.currentUser.role === \'agent\' && vm_cg.currentUser.showWebBar === 2 && vm_cg.user.role === \'agent\' && vm_cg.user.showWebBar === 2" class="md-icon-button" aria-label="Call" translate translate-attr-aria-label="QUICKPANEL.CALL" ng-click="vm_cg.webcall(vm_cg.user.name)">\n          <md-icon md-font-icon="icon-phone"></md-icon>\n        </md-button>\n      </div>\n    </div>\n\n  </md-toolbar>\n  <md-content flex layout-paddings id="chat-group-dialog">\n    <div layout="row" ng-repeat="message in vm_cg.group.messages" class="message-row" ng-class="message.FromId === vm_cg.currentUser.id ? \'user\' : \'contact\'">\n      <img ng-if="message.FromId !== vm_cg.currentUser.id" ng-src="{{\'api/users/\' + message.FromId + \'/avatar\'}}" class="avatar" alt="{{vm_cg.user.fullname}}" />\n      <img ng-if="message.FromId === vm_cg.currentUser.id" class="avatar" ng-src="{{vm_cg.currentUser.userpic ? \'api/users/\' + vm_cg.currentUser.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}">\n      <div class="bubble" flex>\n        <div ng-if="message.FromId !== vm_cg.currentUser.id">\n          <span style="font-size: 12px;">{{vm_cg.group.membersByKeys[message.FromId].fullname}}</span>\n        </div>\n        <span class="message" ng-bind-html="message.body | embed:{linkTarget:\'_blank\',emoji:false,fontSmiley:false}"></span>\n        <div layout="row" layout-align="end center">\n          <span class="time secondary-text" style="margin-top: 0px;">{{message.createdAt | formatdate }}</span>\n          <md-icon ng-if="message.FromId === vm_cg.currentUser.id" class="s16 margin-5" style="cursor: pointer;" md-font-icon="icon-information-outline" ng-click="vm_cg.showMessageInfo($event, message)"></md-icon>\n        </div>\n      </div>\n    </div>\n  </md-content>\n\n  <form ng-if="(vm_cg.currentUser.role !== \'agent\') || vm_cg.group.write" ng-submit="vm_cg.reply()" layout="row" class="reply" layout-align="start center">\n    <textarea ng-keyup="$event.keyCode == 13 ? vm_cg.reply() : null" flex ng-model="vm_cg.replyMessage" placeholder="Type and hit enter to send message" translate translate-attr-placeholder="QUICKPANEL.REPLY_PLACEHOLDER" autofocus></textarea>\n\n    <md-button class="md-fab md-mini" type="submit" aria-label="Send message" translate translate-attr-aria-label="QUICKPANEL.SEND_MESSAGE">\n      <md-icon md-font-icon="icon-send"></md-icon>\n    </md-button>\n  </form>\n</div>'),e.put("app/quick-panel/tabs/groups/info/dialog.html",'<md-dialog class="group-dialog" aria-label="New ChatGroup">\n  <form name="groupForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog(null)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div ng-if="vm.data.messages[$index].FromId !== vm.data.messages[$index].ToId" ng-repeat="user in vm.data.users" layout-margin>\n        <div layout="row">\n          <div layout="row" layout-align="start center">\n            <img ng-src="{{user.userpic ? \'api/users/\' + user.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}" class="avatar" alt="{{user.fullname}}" />\n            <span>{{user.fullname}}</span>\n          </div>\n          <div layout="row" layout-align="end center" flex>\n            <md-icon class="s16 margin-5" md-font-icon="{{vm.data.messages[$index].read ? \'icon-check-all md-accent\' : \'icon-check\'}}"></md-icon>\n            <span class="time secondary-text">{{vm.data.messages[$index].updatedAt | formatdate }}</span>\n          </div>\n        </div>\n        <div>\n          <md-divider ng-if="!$last"></md-divider>\n        </div>\n      </div>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/quick-panel/tabs/today/today-tab.html",'<md-list class="date">\n  <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.TODAY">Today</span></md-subheader>\n  <md-list-item class="md-display-1 md-2-line">\n    <div class="secondary-text">\n      <div translate="QUICKPANEL.{{ (vm.date | date:\'EEEE\').toUpperCase() }}"></div>\n      <div layout="row" layout-align="start start">\n        <span> {{vm.date | date:\'d\'}}</span>\n        <span class="md-subhead">th</span>\n        <span translate="QUICKPANEL.{{ (vm.date | date:\'MMMM\').toUpperCase() }}"></span>\n      </div>\n    </div>\n  </md-list-item>\n</md-list>\n\n\x3c!-- <md-divider></md-divider>\n\n<md-list>\n    <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.EVENTS">Events</span></md-subheader>\n\n    <md-list-item class="md-2-line" ng-repeat="event in vm.events" ng-click="dummyFunction()">\n        <div class="md-list-item-text">\n            <h3>{{event.title}}</h3>\n\n            <p>{{event.detail}}</p>\n        </div>\n    </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list>\n    <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.NOTES">Notes</span></md-subheader>\n    <md-list-item class="md-2-line" ng-repeat="note in vm.notes" ng-click="dummyFunction()">\n        <div class="md-list-item-text">\n            <h3>{{note.title}}</h3>\n\n            <p>{{note.detail}}</p>\n        </div>\n    </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list>\n    <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.QUICK_SETTINGS">Quick Settings</span></md-subheader>\n\n    <md-list-item>\n        <h3 translate="QUICKPANEL.NOTIFICATIONS">Notifications</h3>\n        <md-switch class="md-secondary" ng-model="vm.settings.notify" aria-label="Notifications" translate\n                   translate-attr-aria-label="QUICKPANEL.NOTIFICATIONS"></md-switch>\n    </md-list-item>\n\n    <md-list-item>\n        <h3 translate="QUICKPANEL.CLOUD_SYNC">Cloud Sync</h3>\n        <md-switch class="md-secondary" ng-model="vm.settings.cloud" aria-label="Cloud Sync" translate\n                   translate-attr-aria-label="QUICKPANEL.CLOUD_SYNC"></md-switch>\n    </md-list-item>\n\n    <md-list-item>\n        <h3 translate="QUICKPANEL.RETRO_THRUSTERS">Retro Thrusters</h3>\n        <md-switch class="md-secondary md-warn" ng-model="vm.settings.retro" aria-label="Retro Thrusters" translate\n                   translate-attr-aria-label="QUICKPANEL.RETRO_THRUSTERS"></md-switch>\n    </md-list-item>\n</md-list> --\x3e'),e.put("app/reset/reset.html",'<div id="reset-password" class="flex-scrollable" layout="column" ng-init="vm.onInit()">\n  <div id="reset-password-form-wrapper" layout="column" layout-align="center center">\n    <div id="reset-password-form" class="md-whiteframe-8dp">\n\n      <img src="/api/settings/1/logo_login" alt="logo_login" class="logo_login" />\n\n      <div class="title" translate="RESETPASSWORD.TITLE">Reset your password</div>\n\n      <form name="resetPasswordForm" novalidate>\n\n        <md-input-container class="md-block" md-no-float>\n          <input type="password" name="password" ng-model="vm.form.password" ng-pattern="vm.passwordPattern" placeholder="Password" translate translate-attr-placeholder="RESETPASSWORD.PASSWORD" required>\n          <div ng-messages="resetPasswordForm.password.$error" role="alert">\n            <div ng-message="required">\n              <span translate="RESETPASSWORD.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="RESETPASSWORD.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block" md-no-float>\n          <input type="password" name="passwordConfirm" ng-model="vm.form.passwordConfirm" placeholder="Password (Confirm)" match-password="password" translate translate-attr-placeholder="RESETPASSWORD.PASSWORD_CONFIRM">\n          <div ng-messages="resetPasswordForm.passwordConfirm.$error" role="alert">\n            <div ng-message="passwordMatch">\n              <span translate="TOOLBAR.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-button type="button" ng-click="vm.resetPassword()" class="md-raised md-accent submit-button" aria-label="UPDATE MY PASSWORD" ng-disabled="resetPasswordForm.$invalid || resetPasswordForm.$pristine" translate="RESETPASSWORD.UPDATE_PASSWORD" translate-attr-aria-label="RESETPASSWORD.UPDATE_PASSWORD">\n          RESET MY PASSWORD\n        </md-button>\n      </form>\n    </div>\n  </div>\n</div>'),e.put("app/toolbar/autoanswers/dialog.html",'<md-dialog class="autoanswers-dialog" aria-label="autoanswers">\n  <form name="autoanswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ (\'TOOLBAR.AUTOANSWER_NOTIFICATIONS\' | translate)  }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content layout-padding>\n      <md-table-container>\n        <table md-table multiple>\n          <thead md-head>\n            <tr md-row>\n              <th></th>\n              <th md-column>{{ \'TOOLBAR.CHANNEL\' | translate }}</th>\n              <th md-column>{{ \'TOOLBAR.NOTIFICATIONS\' | translate }}</th>\n              <th md-column>{{ \'TOOLBAR.DELAY\' | translate }}</th>\n            </tr>\n          </thead>\n          <tbody md-body>\n            <tr md-row ng-repeat="item in vm.items" ng-if="item.permission">\n              <td>\n                <md-icon md-font-icon="{{item.font_icon}}" class="icon {{item.class}} {{item.font_icon}}" aria-label="{{item.label}}"></md-icon>\n              </td>\n              <td md-cell>\n                <div layout="row">\n                  <span translate="{{item.title}}"></span>\n                </div>\n              </td>\n              <td md-cell align="center">\n                <div layout="row" layout-align="center">\n                  <md-icon ng-if="item.enabled" md-font-icon="icon-check-circle" class="icon green-700-fg"></md-icon>\n                  <span ng-if="!item.enabled" style="color:red">X</span>\n                </div>\n              </td>\n              <td md-cell align="right">\n                <div layout="row" layout-align="end">\n                  <span ng-if="item.enabled">{{item.delay}}</span>\n                </div>\n              </td>\n            </tr>\n          </tbody>\n        </table>\n      </md-table-container>\n    </md-dialog-content>\n\n    <md-dialog-actions class="md-dialog-action-center padding-rigth-15">\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/toolbar/changepassword/changepassword.html",'<md-dialog class="user-dialog" aria-label="{{vm.name}}">\n  <form name="changePasswordForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span ng-if="vm.reset" class="title" translate="TOOLBAR.RESETPASSWORD">Reset Password</span>\n        <span ng-if="!vm.reset" class="title" translate="TOOLBAR.CHANGEPASSWORD">Change Password</span>\n        <md-button ng-if="!vm.reset" class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLBAR.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="TOOLBAR.OLD_PASSWORD" required>\n        <div ng-messages="changePasswordForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLBAR.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLBAR.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="TOOLBAR.NEW_PASSWORD" required>\n        <div ng-messages="changePasswordForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLBAR.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLBAR.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="TOOLBAR.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLBAR.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="changePasswordForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="TOOLBAR.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="TOOLBAR.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="changePasswordForm.$invalid || changePasswordForm.$pristine" aria-label="SAVE" translate="TOOLBAR.SAVE" translate-attr-aria-label="TOOLBAR.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/toolbar/layouts/vertical-navigation/toolbar.html",'<div layout="row" layout-align="start center">\n  <div layout="row" layout-align="start center" flex>\n    <md-button id="navigation-toggle" class="md-icon-button" ng-click="vm.toggleSidenav(\'navigation\')" hide-gt-sm aria-label="Toggle navigation" translate translate-attr-aria-label="TOOLBAR.TOGGLE_NAVIGATION">\n      <md-icon md-font-icon="icon-menu" class="icon"></md-icon>\n    </md-button>\n\n    <ms-shortcuts ng-if="!vm.isAgent()"></ms-shortcuts>\n\n    <div class="toolbar-separator"></div>\n\n    <div ng-if="vm.license.demo" class="blink md-padding">\n      <span class="md-warn-fg" translate="TOOLBAR.TRIAL_VERSION">Trial Version</span>\n    </div>\n\n    <div ng-if="vm.isAgent()" class="logo" layout-padding-left-8 layout="row" layout-align="start center">\n      <span class="logo-image"><img src="/api/settings/1/logo" alt="logo" /></span>\n      <span ng-show="vm.isAgent() && (vm.user.showWebBar != 2)" class="logo-text text-truncate">{{ vm.getLogo() |\n        uppercase }}</span>\n    </div>\n\n    \x3c!-- phonebar directive WebRtc type--\x3e\n    <ms-phonebar class="ms-phonebar" ng-if="vm.isAgent() && (vm.user.showWebBar == 2)" conf="vm.conf" sessions="vm.webRTCSessions" flex></ms-phonebar>\n    \x3c!-- phonebar directive --\x3e\n  </div>\n\n  <div layout="row" layout-align="start center">\n\n    <md-progress-circular id="toolbar-progress" ng-if="$root.loadingProgress" class="md-accent" md-diameter="32">\n    </md-progress-circular>\n\n    \x3c!-- Pause Management --\x3e\n    <div ng-if="vm.isAgent() && (vm.user.showWebBar != 0)" layout="row" layout-align="end center">\n      <div class="toolbar-separator"></div>\n\n      <div class="border brad-5" layout="row" layout-align="center center" layout-margin>\n        <md-button ng-if="vm.user.voicePause" class="md-icon-button no-margin" ng-click="vm.unpause()">\n          <md-icon md-font-icon="icon-play-circle-outline" class="icon s24"></md-icon>\n          <md-tooltip md-direction="bottom">{{\'TOOLBAR.RESUME\' | translate}}</md-tooltip>\n        </md-button>\n\n        <md-button ng-disabled="vm.user.voicePause && \'DEFAULT PAUSE\' === vm.user.pauseType" class="md-icon-button no-margin" ng-click="vm.pause()">\n          <md-icon md-font-icon="icon-pause-circle-outline" class="icon s24"></md-icon>\n          <md-tooltip md-direction="bottom">{{\'TOOLBAR.PAUSE\' | translate}}</md-tooltip>\n        </md-button>\n\n        <md-menu>\n          <md-button aria-label="Pauses" class="md-icon-button no-margin" ng-click="$mdOpenMenu($event)">\n            <md-icon md-menu-origin md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-menu-content width="4">\n            <md-menu-item ng-if="!vm.pauses.length">\n              <md-button disabled="disabled">\n                <md-icon md-font-icon="icon-pause-octagon" md-menu-align-target></md-icon>\n                {{\'TOOLBAR.NO_PAUSES_AVAILABLE\' | translate}}\n              </md-button>\n            </md-menu-item>\n            <md-menu-item ng-repeat="pause in vm.pauses">\n              <md-button ng-disabled="vm.user.voicePause && pause.name === vm.user.pauseType" ng-click="vm.pause(pause.name)">\n                <md-icon md-font-icon="icon-pause-circle" md-menu-align-target></md-icon>\n                {{pause.name}}\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n    </div>\n    \x3c!-- Pause Management --\x3e\n\n    <div class="h5 padding-10" ng-if="vm.isAgent() && (vm.user.showWebBar != 0)">\n      <div layout="row" layout-align="space-between center">\n        <timer ng-if="vm.user.lastLoginAt" start-time="vm.user.lastLoginAt"></timer>\n        <md-tooltip>{{\'TOOLBAR.LOGIN_TIME\' | translate}}</md-tooltip>\n        <md-icon md-font-icon="icon-timelapse" class="icon s16"></md-icon>\n      </div>\n      <div layout="row" layout-align="center center" ng-if="vm.user.voicePause">\n        <timer start-time="vm.user.lastPauseAt"></timer>\n        <md-tooltip>{{\'TOOLBAR.PAUSE_TIME\' | translate}}</md-tooltip>\n        <md-icon md-font-icon="icon-coffee" class="icon s16"></md-icon>\n      </div>\n      <div ng-if="vm.user.voicePause">\n        <span class="blink red-fg">{{vm.user.pauseType || \'default\' | uppercase}}</span>\n      </div>\n    </div>\n\n    <div class="toolbar-separator" ng-if="vm.isAgent() && (vm.user.showWebBar != 0)"></div>\n\n    <md-menu-bar id="user-menu">\n      <md-menu md-position-mode="left bottom">\n        <md-button class="user-button" ng-click="$mdOpenMenu()" aria-label="User settings" translate translate-attr-aria-label="TOOLBAR.USER_SETTINGS">\n          <div layout="row" layout-align="space-between center">\n            <div class="avatar-wrapper">\n              <img md-menu-align-target class="avatar" src="assets/images/avatars/profile.png" ng-if="!vm.user.userpic">\n              <img md-menu-align-target class="avatar" ng-src="api/users/{{vm.user.id}}/avatar" ng-if="vm.user.userpic">\n              <md-icon md-font-icon ng-class="vm.userStatus.icon" ng-style="{\'color\': vm.userStatus.color }" class="icon status s16"></md-icon>\n            </div>\n            <div layout="column" layout-align="center center" class="padding-horizontal-5">\n              <span class="font-size-14 md-subhead">{{vm.user.fullname}}</span>\n              <span class="font-size-12 md-subhead">{{vm.user.name}} &#60;{{vm.user.internal}}&#62;</span>\n            </div>\n\n            <md-icon md-font-icon="icon-chevron-down" class="icon s16" hide-xs></md-icon>\n          </div>\n        </md-button>\n\n        <md-menu-content width="3">\n          <md-menu-item ng-if="vm.user.showWebBar == 2 && vm.user.phoneBarEnableSettings" class="md-indent">\n            <md-icon md-font-icon="icon-cog" class="icon"></md-icon>\n            <md-button ng-click="vm.openSettings($event)" ng-disabled="!vm.license.webrtc"><span translate="TOOLBAR.SETTINGS">SETTINGS</span></md-button>\n          </md-menu-item>\n\n          <md-menu-item class="md-indent">\n            <md-icon md-font-icon="icon-key-variant" class="icon"></md-icon>\n            <md-button ng-click="vm.changePassword($event)"><span translate="TOOLBAR.CHANGEPASSWORD">Change\n                Password</span></md-button>\n          </md-menu-item>\n\n          <md-menu-divider></md-menu-divider>\n\n          <md-menu-item class="md-indent">\n            <md-icon md-font-icon="icon-logout" class="icon"></md-icon>\n            <md-button ng-click="vm.logout()">Logout</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </md-menu-bar>\n\n    <div class="toolbar-separator"></div>\n\n    <md-button ng-if="vm.user.role === \'agent\' && (vm.license.chat || vm.license.mail || vm.license.messaging || vm.license.openchannel || vm.license.fax || vm.license.whatsapp)" class="preview-button no-margin" ng-disabled="vm.disable" ng-click="vm.autoAnswerNotificationsDialog($event)" aria-label="Language" md-menu-origin md-menu-align-target>\n      <md-icon md-font-icon="icon-reply" class="icon {{ vm.autoanswerIconColor }}"></md-icon>\n      <md-tooltip><span translate="TOOLBAR.AUTOANSWER_NOTIFICATIONS">Notifications</span></md-tooltip>\n    </md-button>\n\n    <md-button ng-if="vm.user.role === \'agent\' && vm.license.dialer" class="preview-button no-margin" ng-disabled="vm.disable" ng-click="vm.preview($event)" aria-label="Language" md-menu-origin md-menu-align-target>\n      <div ng-if="vm.contacts" class="md-accent-bg open-contact-count">{{vm.contacts > 99 ? \'99+\' : vm.contacts}}</div>\n      <md-icon md-font-icon="icon-fire" class="icon red-900-fg"></md-icon>\n      <md-tooltip><span translate="TOOLBAR.PREVIEW">Preview</span></md-tooltip>\n    </md-button>\n\n    <ms-search-bar ng-if="vm.user.role !== \'agent\'" on-search="vm.search(query)" on-result-click="vm.searchResultClick(item)" debounce="300" collapse-on-blur="true"></ms-search-bar>\n\n    <md-menu id="language-menu" md-offset="0 72" md-position-mode="target-right target" layout="column" layout-align="center center">\n      <md-button class="md-icon-button no-margin" ng-click="$mdOpenMenu()" aria-label="Language" md-menu-origin md-menu-align-target>\n        <div layout="row" layout-align="center center">\n          <img class="flag" ng-src="assets/images/flags/{{vm.selectedLanguage.flag}}.png">\n        </div>\n      </md-button>\n\n      <md-menu-content width="3" id="language-menu-content">\n        <md-menu-item ng-repeat="(iso, lang) in vm.languages">\n          <md-button ng-click="vm.changeLanguage(lang)" aria-label="{{lang.title}}" translate translate-attr-aria-label="{{lang.title}}">\n            <span layout="row" layout-align="start center">\n              <img class="flag flag-24" ng-src="assets/images/flags/{{lang.flag}}.png">\n              <span>{{ lang.translation | translate | startcase }}</span>\n            </span>\n          </md-button>\n        </md-menu-item>\n      </md-menu-content>\n    </md-menu>\n\n    <div class="toolbar-separator"></div>\n\n    <md-button ng-if="vm.license.gray && vm.user.role !== \'agent\'" class="md-icon-button" ui-sref="app.settings.license" aria-label="Toggle quick panel">\n      <md-icon md-font-icon="icon-alert" class="icon md-warn blink"></md-icon>\n    </md-button>\n    <md-button ng-if="vm.license.gray && vm.user.role === \'agent\'" class="md-icon-button" aria-label="Toggle quick panel">\n      <md-icon md-font-icon="icon-alert" class="icon md-warn blink"></md-icon>\n    </md-button>\n\n    <div ng-if="vm.license.gray" class="toolbar-separator"></div>\n\n    <md-button id="quick-panel-toggle" class="md-icon-button" ng-click="vm.toggleSidenav(\'quick-panel\')" aria-label="Toggle quick panel" translate translate-attr-aria-label="TOOLBAR.TOGGLE_QUICK_PANEL">\n      <div ng-if="(vm.unreadTotalMessages + vm.unreadTotalGroupMessages)" class="md-accent-bg unread-message-count">\n        {{vm.unreadTotalMessages + vm.unreadTotalGroupMessages}}</div>\n      <md-icon md-font-icon="icon-format-list-bulleted" class="icon"></md-icon>\n    </md-button>\n  </div>\n</div>'),e.put("app/toolbar/preview/dialog.html",'<md-dialog class="preview-dialog" aria-label="preview">\n  <form name="previewForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ (\'TOOLBAR.PREVIEW\' | translate) + (vm.preview.recallme ? \' - \' +\n          (\'CONTACTMANAGER.RECALLME\' | translate | uppercase) : \'\') }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div ng-if="vm.preview">\n        <div ng-if="vm.preview.recallme" layout="row" class="recall-me-info">\n          <md-icon md-font-icon="icon-information-outline" aria-label="Recall Me"></md-icon>\n          <p class="ml-5" translate="TOOLBAR.HELP.PREVIEW_RECALLME" translate-values="{ date: (vm.preview.scheduledat | date:\'short\') }" flex></p>\n        </div>\n        <div layout="row">\n          <div class="md-padding md-margin" layout="column" flex="30">\n            <md-input-container ng-if="vm.preview.Contact.id" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.ID">ID</label>\n              <input type="text" ng-model="vm.preview.Contact.id" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.Queue.name" class="md-block no-margin">\n              <label translate="VOICE.QUEUE">Queue</label>\n              <input type="text" ng-model="vm.preview.Queue.name" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.List.name" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.LIST">List</label>\n              <input type="text" ng-model="vm.preview.List.name" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.Contact.tags && vm.preview.Contact.tags.length" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.TAGS">Tags</label>\n              <input type="text" ng-model="vm.preview.Contact.tags" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.Contact.Company && vm.preview.Contact.Company.name" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.COMPANY">Company</label>\n              <input type="text" ng-model="vm.preview.Contact.Company.name" disabled="true">\n            </md-input-container>\n          </div>\n          <md-divider></md-divider>\n          <div class="md-padding md-margin" layout="column" flex="35">\n            <md-input-container ng-repeat="(key, value) in vm.preview.Contact" ng-if="!vm.isNil(value) && !vm.isCustomField(key) && !vm.isHiddenField(key)" class="md-block no-margin">\n              <label>{{ \'CONTACTMANAGER.\' + key.toUpperCase() | translate}}</label>\n              <input type="text" ng-model="value" disabled="true">\n            </md-input-container>\n\n            <md-input-container ng-if="vm.additionalItems.length>0" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.ADDITIONAL_PHONES">Additional phones</label>\n              <md-chips ng-model="vm.additionalItems" placeholder="Phone numbers" readonly="true">\n                <md-chip-template custom-chip alt="{{$chip.type}} {{$chip.description}}" title="{{$chip.type}} {{$chip.description}}">\n                  {{ $chip.phone }}\n                </md-chip-template>\n              </md-chips>\n            </md-input-container>\n\n          </div>\n          <div class="md-padding md-margin" layout="column" flex="35">\n            <md-input-container ng-repeat="(key, value) in vm.preview.Contact" ng-if="!vm.isNil(value) && vm.isCustomField(key) && !vm.isHiddenField(key)" class="md-block no-margin">\n              <label>{{ vm.customFieldsMap[key] || key }}</label>\n              <input type="text" ng-model="value" disabled="true">\n            </md-input-container>\n          </div>\n        </div>\n      </div>\n      <div layout="row" ng-if="!vm.preview">\n        <span>no contacts available</span>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions class="md-dialog-action-center padding-rigth-15">\n      <md-button class="md-icon-button md-primary" ng-if="!vm.isRecallNotification" ng-hide="vm.hopperIds.length <= 1" ng-disabled="vm.disableGetContact" ng-click="vm.previousContact()" aria-label="PREVIOUSCONTACT" translate-attr-aria-label="TOOLS.PREVIOUSCONTACT">\n        <md-icon md-font-icon="icon-chevron-left"></md-icon>\n      </md-button>\n      <md-button class="md-fab green-bg" aria-label="CALL" translate-attr-aria-label="TOOLS.CALL" ng-disabled="vm.disable" ng-click="vm.originatePreview($event)">\n        <md-icon md-font-icon="icon-phone"></md-icon>\n      </md-button>\n      <md-button class="md-icon-button md-primary" ng-if="!vm.isRecallNotification" ng-disabled="vm.disableGetContact" ng-click="vm.nextContact()" aria-label="NEXTCONTACT" translate-attr-aria-label="TOOLS.NEXTCONTACT">\n        <md-icon md-font-icon="icon-chevron-right"></md-icon>\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>')}]);
\ No newline at end of file
+!function(){"use strict";angular.module("app.auth",[])}(),function(){"use strict";angular.module("app.client-side-logging",[])}(),function(){"use strict";angular.module("app.core",["ngAnimate","ngAria","ngCookies","ngMessages","ngResource","ngSanitize","ngMaterial","pascalprecht.translate","ui.router","ui.router.state.events","gridster","ds.clock","angucomplete-alt"])}(),function(){"use strict";function e(e,n){e.state("app.errors_error-404",{url:"/errors/error-404",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.errors_error-404":{templateUrl:"app/errors/404/error-404.html",controller:"Error404Controller as vm"}},params:{status:404,statusText:"",data:{},config:{}},bodyClass:"error-404"}),n.addPart("app/errors/404")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.errors.error-404",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.errors_error-500",{url:"/errors/error-500",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.errors_error-500":{templateUrl:"app/errors/500/error-500.html",controller:"Error500Controller as vm"}},params:{status:500,statusText:"",data:{},config:{}},bodyClass:"error-500"}),n.addPart("app/errors/500")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.errors.error-500",[]).config(e)}(),function(){"use strict";angular.module("app.errors",["app.errors.error-404","app.errors.error-500"])}(),function(){"use strict";function e(e){e.addPart("app/footer")}e.$inject=["$translatePartialLoaderProvider"],angular.module("app.footer",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.forgot",{url:"/forgot",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.forgot":{templateUrl:"app/forgot/forgot.html",controller:"ForgotPasswordController as vm"}},bodyClass:"forgot"}),n.addPart("app/forgot")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.forgot",[]).config(e)}(),function(){"use strict";function e(e){e.addPart("app/header")}e.$inject=["$translatePartialLoaderProvider"],angular.module("app.header",[]).config(e)}(),function(){"use strict";angular.module("motion",["angular-toasty","app.core","app.auth","app.navigation","app.toolbar","app.quick-panel","app.header","app.footer","app.realtime","app.dashboards","app.staff","app.contactmanager","app.voice","app.chat","app.mail","app.sms","app.openchannel","app.fax","app.tools","app.callysquare","app.analytics","app.integrations","app.settings","app.motiondialer","app.help","app.jscripty","app.marketplace","app.plugins","app.video","app.whatsapp","app.login","app.forgot","app.reset","app.errors","app.user-setting","app.client-side-logging"])}(),function(){"use strict";function e(e,n){e.state("app.login",{url:"/login?token&userId",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.login":{templateUrl:"app/login/login.html",controller:"LoginController as vm"}},bodyClass:"login"}),n.addPart("app/login")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.login",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.analytics",{abstract:!0,url:"/analytics"}).state("app.analytics.metrics",{url:"/metrics",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/metrics/metrics.html",controller:"MetricsController as vm"}},resolve:{metrics:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("analyticMetric@get",{fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Metrics",fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1201})}]},authenticate:!0,permissionId:1201,bodyClass:"analytics"}).state("app.analytics.extractedReports",{url:"/extractedReports",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/extractedReports/extractedReports.html",controller:"ExtractedReportsController as vm"}},resolve:{extractedReports:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("analyticExtractedReport@get",{fields:"createdAt,updatedAt,id,name,basename,savename,type,startDate,endDate,status,output,reportId,reportType",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ExtractedReports",fields:"createdAt,updatedAt,id,name,basename,savename,type,startDate,endDate,status,output,reportId,reportType",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1202})}]},authenticate:!0,permissionId:1202,bodyClass:"analytics"}),n.addPart("app/main/apps/analytics")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.analytics",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.analytics.reports"]).config(e)}(),function(){"use strict";function e(e){e.state("app.analytics.reports",{url:"/reports",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/reports/reports.html",controller:"ReportsController as vm"}},resolve:{treeReports:["apiResolver",function(e){return e.resolve("analyticTreeReport@get",{fields:"id,tree",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1203})}]},authenticate:!0,permissionId:1203,bodyClass:"analytics"}).state("app.analytics.reports.edit",{url:"/:id?tab",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/reports/edit/view.html",controller:"ReportController as vm"}},resolve:{report:["apiResolver","$stateParams","$q","describeTable",function(e,n,a,i){var s;return e.resolve("analyticCustomReport@get",{fields:"createdAt,updatedAt,id,name,description,table,conditions,joins",id:n.id}).then(function(e){var n=[];if((s=e).joins)try{s.joins=JSON.parse(s.joins);for(var t=0;t<s.joins.length;t+=1)n.push(i.getColumns(s.joins[t].foreignTable))}catch(e){console.log(e)}return a.all(n)}).then(function(e){for(var n=0;n<e.length;n+=1)s.joins[n].foreignTableFields=_.difference(_.keys(e[n]),["$promise","$resolved"]);return s})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1203})}]},authenticate:!0,permissionId:1203,bodyClass:"analytics"})}e.$inject=["$stateProvider"],angular.module("app.analytics.reports",["ngJsTree"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.callysquare",{abstract:!0,url:"/callysquare"}).state("app.callysquare.odbcs",{url:"/odbcs",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/odbcs/odbcs.html",controller:"OdbcsController as vm"}},resolve:{odbcs:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareOdbc@get",{fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ODBC",fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1101})}]},authenticate:!0,permissionId:1101,bodyClass:"callysquare"}).state("app.callysquare.squareRecordings",{url:"/squareRecordings",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/squareRecordings/squareRecordings.html",controller:"SquareRecordingsController as vm"}},resolve:{squareRecordings:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareRecording@get",{fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio,savePath,format",sort:"-createdAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SquareRecordings",fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio,savePath,format",sort:"-createdAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadCallySquareRecordings",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1102})}]},authenticate:!0,permissionId:1102,bodyClass:"callysquare"}),n.addPart("app/main/apps/callysquare")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.callysquare",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.callysquare.projects"]).config(e)}(),function(){"use strict";function e(e){e.state("app.callysquare.projects",{url:"/projects",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/projects/projects.html",controller:"ProjectsController as vm"}},resolve:{projects:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareProject@get",{fields:"id,name,description,notes",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SquareProjects",fields:"id,name,description,notes",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1103})}]},authenticate:!0,permissionId:1103,bodyClass:"callysquare"}).state("app.callysquare.projects.edit",{url:"/:id",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/projects/edit/view.html",controller:"ProjectController as vm"}},params:{crudPermissions:void 0},resolve:{project:["apiResolver","$stateParams",function(e,n){return e.resolve("squareProject@get",{id:n.id})}],users:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,fullname,role",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Users",mergeResources:!0,fields:"id,fullname,role",sort:"name",nolimit:!0})}],trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",sort:"name",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",type:"inbound",fields:"id,name",sort:"name",nolimit:!0})}],sounds:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("sound@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Sounds",fields:"id,name",sort:"name",nolimit:!0})}],variables:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("variable@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Variables",fields:"id,name",sort:"name",nolimit:!0})}],databases:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareOdbc@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ODBC",fields:"id,name",sort:"name",nolimit:!0})}],projects:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareProject@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SquareProjects",fields:"id,name",sort:"name",nolimit:!0})}],contexts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceContext@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Contexts",fields:"id,name",sort:"name",nolimit:!0})}],intervals:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("interval@get",{fields:"id,name,IntervalId",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Intervals",fields:"id,name,IntervalId",sort:"name",nolimit:!0})}],mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",fields:"id,name",sort:"name",nolimit:!0})}],templates:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("template@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Templates",fields:"id,name",sort:"name",nolimit:!0})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"name",nolimit:!0})}],smsAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsAccount@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"id,name",sort:"name",nolimit:!0})}],pauses:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("pause@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Pauses",fields:"id,name",sort:"name",nolimit:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1103})}]},authenticate:!0,permissionId:1103,bodyClass:"callysquare"})}e.$inject=["$stateProvider"],angular.module("app.callysquare.projects",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.chat",{abstract:!0,url:"/chat"}).state("app.chat.chatQueues",{url:"/chatQueues",views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatQueues/chatQueues.html",controller:"ChatQueuesController as vm"}},resolve:{chatQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("chatQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"chat",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChatQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"chat",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:501})}]},authenticate:!0,permissionId:501,bodyClass:"chat"}).state("app.chat.chatQueues.edit",{url:"/:id?tab",params:{chatQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatQueues/edit/view.html",controller:"ChatQueueController as vm"}},resolve:{chatQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("chatQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:501})}]},authenticate:!0,permissionId:501,bodyClass:"chat"}).state("app.chat.chatWebsites",{url:"/chatWebsites",views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatWebsites/chatWebsites.html",controller:"ChatWebsitesController as vm"}},resolve:{chatWebsites:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("chatWebsite@get",{fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChatWebsites",fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:502})}]},authenticate:!0,permissionId:502,bodyClass:"chat"}).state("app.chat.chatWebsites.edit",{url:"/:id?tab",params:{chatWebsite:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatWebsites/edit/view.html",controller:"ChatWebsiteController as vm"}},resolve:{chatWebsite:["apiResolver","$stateParams",function(e,n){return e.resolve("chatWebsite@get",{fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadAttachments,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:502})}]},authenticate:!0,permissionId:502,bodyClass:"chat"}),n.addPart("app/main/apps/chat")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.chat",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.chat.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.chat.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/chat/views/realtime/realtime.html",controller:"ChatRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:510})}]},authenticate:!0,permissionId:510}).state("app.chat.realtime.agents",{url:"/agents",params:{channel:"chat"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:510}).state("app.chat.realtime.queues",{url:"/queues",controller:"QueuesChatRealtimeController as vm",templateUrl:"app/main/apps/chat/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"ChatQueues":void 0,channel:"chat",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:501})}]},authenticate:!0,permissionId:510})}e.$inject=["$stateProvider"],angular.module("app.chat.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.contactmanager",{abstract:!0,url:"/contactmanager"}).state("app.contactmanager.lists",{url:"/lists",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/lists/lists.html",controller:"ListsController as vm"}},resolve:{lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadContactManagerLists",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:301})}]},authenticate:!0,permissionId:301,bodyClass:"contactmanager"}).state("app.contactmanager.lists.edit",{url:"/:id?tab",params:{list:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/lists/edit/view.html",controller:"ListController as vm"}},resolve:{list:["apiResolver","$stateParams",function(e,n){return e.resolve("cmList@get",{fields:"createdAt,updatedAt,id,name,description,dialPrefix",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:301})}]},authenticate:!0,permissionId:301,bodyClass:"contactmanager"}).state("app.contactmanager.companies",{url:"/companies",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/companies/companies.html",controller:"CompaniesController as vm"}},resolve:{companies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmCompany@get",{fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Companies",fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:302})}]},authenticate:!0,permissionId:302,bodyClass:"contactmanager"}).state("app.contactmanager.companies.edit",{url:"/:id?tab",params:{company:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/companies/edit/view.html",controller:"CompanyController as vm"}},resolve:{company:["apiResolver","$stateParams",function(e,n){return e.resolve("cmCompany@get",{fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:302})}]},authenticate:!0,permissionId:302,bodyClass:"contactmanager"}).state("app.contactmanager.globalCustomFields",{url:"/globalCustomFields",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/globalCustomFields/globalCustomFields.html",controller:"GlobalCustomFieldsController as vm"}},resolve:{globalCustomFields:["apiResolver","Auth",function(e,n){return e.resolve("cmCustomField@get",{fields:"createdAt,updatedAt,id,alias,type,values,required,clickToAction,actionType",sort:"-updatedAt",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:304})}]},authenticate:!0,permissionId:304,bodyClass:"contactmanager"}),n.addPart("app/main/apps/contactmanager")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.contactmanager",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.contactmanager.contacts"]).config(e)}(),function(){"use strict";function e(e){e.state("app.contactmanager.contacts",{url:"/contacts?ListId&CompanyId",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/contacts/contacts.html",controller:"ContactsController as vm"}},resolve:{contacts:["apiResolver","Auth","$stateParams",function(e,n,t){return n.hasRole("admin")?e.resolve("cmContact@get",_.merge({includeAll:!0,sort:"-updatedAt",limit:10,offset:0},t)):e.resolve("userProfile@getResources",_.merge({id:n.getCurrentUser().userProfileId,section:"Contacts",includeAll:!0,sort:"-updatedAt",limit:10,offset:0},t))}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"-updatedAt",nolimit:!0})}],listsMap:["lists",function(e){for(var n={},t=0;t<e.rows.length;t++)n[e.rows[t].id]=e.rows[t].name;return n}],companies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmCompany@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Companies",fields:"id,name",sort:"name",nolimit:!0})}],companiesMap:["companies",function(e){for(var n={},t=0;t<e.rows.length;t++)n[e.rows[t].id]=e.rows[t].name;return n}],tags:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("tag@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Tags",fields:"id,name",sort:"name",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:303})}]},authenticate:!0,permissionId:303,bodyClass:"contactmanager"}).state("app.contactmanager.contacts.edit",{url:"/:id?tab",params:{crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/contacts/edit/view.html",controller:"ContactController as vm"}},resolve:{contact:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@get",{id:n.id}).then(function(e){return e.dateOfBirth&&(e.dateOfBirth=new Date(e.dateOfBirth)),e}).catch(function(e){console.error(e)})}],hoppers:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getHoppers",{id:n.id,fields:"id,phone,scheduledat,priority,recallme,VoiceQueueId,CampaignId,UserId",sort:"-updatedAt",limit:10,offset:0})}],finals:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getHopperFinals",{id:n.id,fields:"id,uniqueid,calleridnum,statedesc,starttime,disposition",sort:"-updatedAt",limit:10,offset:0})}],histories:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getHopperHistories",{id:n.id,fields:"id,uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-updatedAt",limit:10,offset:0})}],jscriptySessions:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getJscriptySessions",{id:n.id,fields:"id,starttime,endtime,membername,projectname",sort:"-starttime",limit:10,offset:0})}],companies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmCompany@get"):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Companies"})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"-updatedAt",nolimit:!0})}],customFields:["apiResolver","contact",function(e,n){return n.ListId?e.resolve("cmList@getCustomFields",{id:n.ListId}):null}],tags:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("tag@get",{sort:"name"}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Tags"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:303})}]},authenticate:!0,permissionId:303,bodyClass:"contactmanager"})}e.$inject=["$stateProvider"],angular.module("app.contactmanager.contacts",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.dashboards",{abstract:!0,url:"/dashboards"}),n.addPart("app/main/apps/dashboards")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.dashboards",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.dashboards.general","app.dashboards.custom"]).config(e)}(),function(){"use strict";function e(e){e.state("app.dashboards.custom",{url:"/custom/:id",views:{"content@app":{templateUrl:"app/main/apps/dashboards/views/custom/custom.html",controller:"DashboardCustomController as vm"}},resolve:{voiceQueues:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("voiceQueue@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"VoiceQueues",mergeResources:!0,fields:"id,name",channel:"voice",nolimit:!0})).then(function(e){return t=e,n.resolve("rpc@getVoiceQueues",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)t&&t.id===e.rows[n].id?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged,a.abandoned+=e.rows[n].abandoned):(a=_.find(t.rows,{id:e.rows[n].id}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged","abandoned"]));return t})}],faxAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("faxAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"FaxAccounts",mergeResources:!0,fields:"id,name",channel:"fax",nolimit:!0})).then(function(e){return t=e,n.resolve("faxInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].FaxAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].FaxAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],chatWebsites:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("chatWebsite@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"ChatWebsites",mergeResources:!0,fields:"id,name",channel:"chat",nolimit:!0})).then(function(e){return t=e,n.resolve("chatInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].ChatWebsiteId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.abandoned+=e.rows[n].abandoned,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].ChatWebsiteId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","abandoned","unmanaged"]));return t})}],smsAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("smsAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"SmsAccounts",mergeResources:!0,fields:"id,name",channel:"sms",nolimit:!0})).then(function(e){return t=e,n.resolve("smsInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].SmsAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].SmsAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],openchannelAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("openchannelAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"OpenchannelAccounts",mergeResources:!0,fields:"id,name",channel:"openchannel",nolimit:!0})).then(function(e){return t=e,n.resolve("openchannelInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].OpenchannelAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].OpenchannelAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],mailAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("mailAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"MailAccounts",mergeResources:!0,fields:"id,name",channel:"mail",nolimit:!0})).then(function(e){return t=e,n.resolve("mailInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].MailAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].MailAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],whatsappAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("whatsappAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"WhatsappAccounts",mergeResources:!0,fields:"id,name",channel:"whatsapp",nolimit:!0})).then(function(e){return t=e,n.resolve("whatsappInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].WhatsappAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].WhatsappAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:100})}]},authenticate:!0,bodyClass:"dashboards"})}e.$inject=["$stateProvider"],angular.module("app.dashboards.custom",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.dashboards.general",{url:"/general",views:{"content@app":{templateProvider:["$stateParams","$templateFactory","Auth","$window",function(e,n,t,a){var i=t.getCurrentUser();return null===a.localStorage.getItem("motion2.user:"+i.id)&&a.localStorage.setItem("motion2.user:"+i.id,JSON.stringify({authenticationType:"google"})),t.isAgent()?n.fromUrl("app/main/apps/dashboards/views/general/agent/agent.general.html",e):n.fromUrl("app/main/apps/dashboards/views/general/user/user.general.html",e)}],controllerProvider:["Auth",function(e){return e.isAgent()?"AgentDashboardGeneralController as vm":"UserDashboardGeneralController as vm"}]}},resolve:{globalUserLists:["apiResolver","Auth",function(e,n){return e.resolve("user@getLists",{id:n.getCurrentUser().id,sort:"name",nolimit:!0})}],globalLists:["apiResolver",function(e){return e.resolve("cmList@get",{sort:"name",nolimit:!0})}],globalTags:["apiResolver",function(e){return e.resolve("tag@get",{sort:"name",nolimit:!0})}],globalCompanies:["apiResolver",function(e){return e.resolve("cmCompany@get",{sort:"name",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"})}e.$inject=["$stateProvider"],angular.module("app.dashboards.general",["ngMaterialDateRangePicker","app.dashboards.general.user"]).config(e)}(),function(){"use strict";function e(e){e.state("app.dashboards.general.voice",{url:"/voice",data:{selectedTab:0},views:{voice:{templateUrl:"app/main/apps/dashboards/views/general/user/voice/user.general.voice.html",controller:"UserVoiceDashboardGeneralController as vm"}},resolve:{rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}],inboundQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"inbound",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",fields:"id,name",type:"inbound",channel:"voice",nolimit:!0})}],outbound:["apiResolver",function(e){return e.resolve("rpc@getOutbound")}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.dialer",{url:"/dialer",data:{selectedTab:1},views:{dialer:{templateUrl:"app/main/apps/dashboards/views/general/user/dialer/user.general.dialer.html",controller:"UserVoiceDashboardDialerController as vm"}},resolve:{rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}],outboundQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"outbound",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",fields:"id,name",type:"outbound",channel:"voice",nolimit:!0})}],rpcCampaigns:["apiResolver",function(e){return e.resolve("rpc@getCampaigns")}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.chat",{url:"/chat",data:{selectedTab:2},views:{chat:{templateUrl:"app/main/apps/dashboards/views/general/user/chat/user.general.chat.html",controller:"UserChatDashboardGeneralController as vm"}},resolve:{chatInteractions:["apiResolver",function(e){return e.resolve("chatInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],chatWebsites:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("chatWebsite@get",{fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,header_offline,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardTranscript,forwardOffline,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,description,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChatWebsites",fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,header_offline,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardTranscript,forwardOffline,forwardOfflineAddress,IntervalId,timezone,waitForTheAssignedAgent,description,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.mail",{url:"/mail",data:{selectedTab:3},views:{mail:{templateUrl:"app/main/apps/dashboards/views/general/user/mail/user.general.mail.html",controller:"UserMailDashboardGeneralController as vm"}},resolve:{mailInteractions:["apiResolver",function(e){return e.resolve("mailInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,name,provider,key,email,ListId,active,service,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",fields:"createdAt,updatedAt,id,name,provider,key,email,ListId,active,service,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.sms",{url:"/sms",data:{selectedTab:4},views:{sms:{templateUrl:"app/main/apps/dashboards/views/general/user/sms/user.general.sms.html",controller:"UserSmsDashboardGeneralController as vm"}},resolve:{smsInteractions:["apiResolver",function(e){return e.resolve("smsInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],smsAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,phone,type,accountSid,authId,authToken,smsMethod,applicationId,accountId,username,password,senderString,deliveryReport,waitForTheAssignedAgent,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,phone,type,accountSid,authId,authToken,smsMethod,applicationId,accountId,username,password,senderString,deliveryReport,waitForTheAssignedAgent,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.openchannel",{url:"/openchannel",data:{selectedTab:5},views:{openchannel:{templateUrl:"app/main/apps/dashboards/views/general/user/openchannel/user.general.openchannel.html",controller:"UserOpenchannelDashboardGeneralController as vm"}},resolve:{openchannelInteractions:["apiResolver",function(e){return e.resolve("openchannelInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],openchannelAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,description,receiveUri,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OpenchannelAccounts",fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,description,receiveUri,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.fax",{url:"/fax",data:{selectedTab:6},views:{fax:{templateUrl:"app/main/apps/dashboards/views/general/user/fax/user.general.fax.html",controller:"UserFaxDashboardGeneralController as vm"}},resolve:{faxInteractions:["apiResolver",function(e){return e.resolve("faxInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],faxAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxAccounts",fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,acceptMethod,acceptUrl,rejectMethod,rejectUrl,closeMethod,closeUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.whatsapp",{url:"/whatsapp",data:{selectedTab:7},views:{whatsapp:{templateUrl:"app/main/apps/dashboards/views/general/user/whatsapp/user.general.whatsapp.html",controller:"UserWhatsappDashboardGeneralController as vm"}},resolve:{whatsappInteractions:["apiResolver",function(e){return e.resolve("whatsappInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],whatsappAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("whatsappAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,phone,type,accountSid,authId,authToken,whatsappMethod,username,password,senderString,deliveryReport,waitForTheAssignedAgent,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"WhatsappAccounts",fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,phone,type,accountSid,authId,authToken,whatsappMethod,username,password,senderString,deliveryReport,waitForTheAssignedAgent,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,bodyClass:"dashboards"})}e.$inject=["$stateProvider"],angular.module("app.dashboards.general.user",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.fax",{abstract:!0,url:"/fax"}).state("app.fax.faxQueues",{url:"/faxQueues",views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxQueues/faxQueues.html",controller:"FaxQueuesController as vm"}},resolve:{faxQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"fax",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"fax",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:901})}]},authenticate:!0,permissionId:901,bodyClass:"fax"}).state("app.fax.faxQueues.edit",{url:"/:id?tab",params:{faxQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxQueues/edit/view.html",controller:"FaxQueueController as vm"}},resolve:{faxQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("faxQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:901})}]},authenticate:!0,permissionId:901,bodyClass:"fax"}).state("app.fax.faxAccounts",{url:"/faxAccounts",views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxAccounts/faxAccounts.html",controller:"FaxAccountsController as vm"}},resolve:{faxAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxAccounts",fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:902})}]},authenticate:!0,permissionId:902,bodyClass:"fax"}).state("app.fax.faxAccounts.edit",{url:"/:id?tab",params:{faxAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxAccounts/edit/view.html",controller:"FaxAccountController as vm"}},resolve:{faxAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:902})}]},authenticate:!0,permissionId:902,bodyClass:"fax"}),n.addPart("app/main/apps/fax")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.fax",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.fax.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.fax.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/fax/views/realtime/realtime.html",controller:"FaxRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:910})}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.agents",{url:"/agents",params:{channel:"fax"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.trunks",{url:"/trunks",controller:"TrunksFaxRealtimeController as vm",templateUrl:"app/main/apps/fax/views/realtime/trunks/view.html",resolve:{trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}],rpcTrunks:["apiResolver",function(e){return e.resolve("rpc@getTrunks")}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.queues",{url:"/queues",controller:"QueuesFaxRealtimeController as vm",templateUrl:"app/main/apps/fax/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"FaxQueues":void 0,channel:"fax",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:901})}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.accounts",{url:"/accounts",controller:"FaxAccountsRealtimeController as vm",templateUrl:"app/main/apps/fax/views/realtime/accounts/view.html",resolve:{faxAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxAccount@get",{sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxAccounts",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:902})}],rpcFaxAccounts:["apiResolver",function(e){return e.resolve("rpc@getFaxAccounts")}]},authenticate:!0,permissionId:910})}e.$inject=["$stateProvider"],angular.module("app.fax.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.help",{abstract:!0,url:"/help"}),n.addPart("app/main/apps/help")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.help",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.help.about"]).config(e)}(),function(){"use strict";function e(e){e.state("app.help.about",{url:"/about",views:{"content@app":{templateUrl:"app/main/apps/help/views/about/about.html",controller:"AboutController as vm"}},resolve:{info:["apiResolver",function(e){return e.resolve("version@get")}]},authenticate:!0,permissionId:1600,bodyClass:"help"})}e.$inject=["$stateProvider"],angular.module("app.help.about",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.integrations",{abstract:!0,url:"/integrations"}).state("app.integrations.zendeskAccounts",{url:"/zendeskAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zendeskAccounts/zendeskAccounts.html",controller:"ZendeskAccountsController as vm"}},resolve:{zendeskAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intZendeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ZendeskAccounts",fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1301})}]},authenticate:!0,permissionId:1301,bodyClass:"integrations"}).state("app.integrations.zendeskAccounts.edit",{url:"/:id?tab",params:{zendeskAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/view.html",controller:"ZendeskAccountController as vm"}},resolve:{zendeskAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intZendeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1301})}]},authenticate:!0,permissionId:1301,bodyClass:"integrations"}).state("app.integrations.salesforceAccounts",{url:"/salesforceAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/salesforceAccounts/salesforceAccounts.html",controller:"SalesforceAccountsController as vm"}},resolve:{salesforceAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intSalesforceAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SalesforceAccounts",fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1302})}]},authenticate:!0,permissionId:1302,bodyClass:"integrations"}).state("app.integrations.salesforceAccounts.edit",{url:"/:id?tab",params:{salesforceAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/view.html",controller:"SalesforceAccountController as vm"}},resolve:{salesforceAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intSalesforceAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1302})}]},authenticate:!0,permissionId:1302,bodyClass:"integrations"}).state("app.integrations.freshdeskAccounts",{url:"/freshdeskAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/freshdeskAccounts.html",controller:"FreshdeskAccountsController as vm"}},resolve:{freshdeskAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intFreshdeskAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FreshdeskAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1303})}]},authenticate:!0,permissionId:1303,bodyClass:"integrations"}).state("app.integrations.freshdeskAccounts.edit",{url:"/:id?tab",params:{freshdeskAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/view.html",controller:"FreshdeskAccountController as vm"}},resolve:{freshdeskAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intFreshdeskAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1303})}]},authenticate:!0,permissionId:1303,bodyClass:"integrations"}).state("app.integrations.sugarcrmAccounts",{url:"/sugarcrmAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/sugarcrmAccounts.html",controller:"SugarcrmAccountsController as vm"}},resolve:{sugarcrmAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intSugarcrmAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SugarcrmAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1305})}]},authenticate:!0,permissionId:1305,bodyClass:"integrations"}).state("app.integrations.sugarcrmAccounts.edit",{url:"/:id?tab",params:{sugarcrmAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/view.html",controller:"SugarcrmAccountController as vm"}},resolve:{sugarcrmAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intSugarcrmAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1305})}]},authenticate:!0,permissionId:1305,bodyClass:"integrations"}).state("app.integrations.deskAccounts",{url:"/deskAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/deskAccounts/deskAccounts.html",controller:"DeskAccountsController as vm"}},resolve:{deskAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intDeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"DeskAccounts",fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1306})}]},authenticate:!0,permissionId:1306,bodyClass:"integrations"}).state("app.integrations.deskAccounts.edit",{url:"/:id?tab",params:{deskAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/view.html",controller:"DeskAccountController as vm"}},resolve:{deskAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intDeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1306})}]},authenticate:!0,permissionId:1306,bodyClass:"integrations"}).state("app.integrations.zohoAccounts",{url:"/zohoAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zohoAccounts/zohoAccounts.html",controller:"ZohoAccountsController as vm"}},resolve:{zohoAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intZohoAccount@get",{fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ZohoAccounts",fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1307})}]},authenticate:!0,permissionId:1307,bodyClass:"integrations"}).state("app.integrations.zohoAccounts.edit",{url:"/:id?tab",params:{zohoAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/view.html",controller:"ZohoAccountController as vm"}},resolve:{zohoAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intZohoAccount@get",{fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1307})}]},authenticate:!0,permissionId:1307,bodyClass:"integrations"}).state("app.integrations.vtigerAccounts",{url:"/vtigerAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/vtigerAccounts/vtigerAccounts.html",controller:"VtigerAccountsController as vm"}},resolve:{vtigerAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intVtigerAccount@get",{fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VtigerAccounts",fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1308})}]},authenticate:!0,permissionId:1308,bodyClass:"integrations"}).state("app.integrations.vtigerAccounts.edit",{url:"/:id?tab",params:{vtigerAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/view.html",controller:"VtigerAccountController as vm"}},resolve:{vtigerAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intVtigerAccount@get",{fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1308})}]},authenticate:!0,permissionId:1308,bodyClass:"integrations"}).state("app.integrations.dynamics365Accounts",{url:"/dynamics365Accounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/dynamics365Accounts.html",controller:"Dynamics365AccountsController as vm"}},resolve:{dynamics365Accounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intDynamics365Account@get",{fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description,modernAuthentication,CloudProviderId",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dynamics365Accounts",fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data7",sort:"-updatedAt",type:"Dynamics365",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1309})}]},authenticate:!0,permissionId:1309,bodyClass:"integrations"}).state("app.integrations.dynamics365Accounts.edit",{url:"/:id?tab",params:{dynamics365Account:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/view.html",controller:"Dynamics365AccountController as vm"}},resolve:{dynamics365Account:["apiResolver","$stateParams",function(e,n){return e.resolve("intDynamics365Account@get",{fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description,modernAuthentication,CloudProviderId",id:n.id})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data7",sort:"-updatedAt",type:"Dynamics365",limit:10,offset:0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1309})}]},authenticate:!0,permissionId:1309,bodyClass:"integrations"}).state("app.integrations.servicenowAccounts",{url:"/servicenowAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/servicenowAccounts/servicenowAccounts.html",controller:"ServicenowAccountsController as vm"}},resolve:{servicenowAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intServicenowAccount@get",{fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ServicenowAccounts",fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1310})}]},authenticate:!0,permissionId:1310,bodyClass:"integrations"}).state("app.integrations.servicenowAccounts.edit",{url:"/:id?tab",params:{servicenowAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/view.html",controller:"ServicenowAccountController as vm"}},resolve:{servicenowAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intServicenowAccount@get",{fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1310})}]},authenticate:!0,permissionId:1310,bodyClass:"integrations"}).state("app.integrations.freshsalesAccounts",{url:"/freshsalesAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/freshsalesAccounts.html",controller:"FreshsalesAccountsController as vm"}},resolve:{freshsalesAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intFreshsalesAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FreshsalesAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1304})}]},authenticate:!0,permissionId:1304,bodyClass:"integrations"}).state("app.integrations.freshsalesAccounts.edit",{url:"/:id?tab",params:{freshsalesAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/view.html",controller:"FreshsalesAccountController as vm"}},resolve:{freshsalesAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intFreshsalesAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1304})}]},authenticate:!0,permissionId:1304,bodyClass:"integrations"}),n.addPart("app/main/apps/integrations")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.integrations",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.jscripty",{abstract:!0,url:"/jscripty"}).state("app.jscripty.projects",{url:"/projects",views:{"content@app":{templateUrl:"app/main/apps/jscripty/views/projects/projects.html",controller:"JscriptyProjectsController as vm"}},resolve:{projects:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("jscriptyProject@get",{fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Projects",fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadJscriptySessions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1701})}]},authenticate:!0,permissionId:1701,bodyClass:"jscripty"}).state("app.jscripty.projects.edit",{url:"/:id?tab",params:{project:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/jscripty/views/projects/edit/view.html",controller:"JscriptyProjectController as vm"}},resolve:{project:["apiResolver","$stateParams",function(e,n){return e.resolve("jscriptyProject@get",{fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadJscriptySessions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1701})}]},authenticate:!0,permissionId:1701,bodyClass:"jscripty"}),n.addPart("app/main/apps/jscripty")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.jscripty",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.mail",{abstract:!0,url:"/mail"}).state("app.mail.mailQueues",{url:"/mailQueues",views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailQueues/mailQueues.html",controller:"MailQueuesController as vm"}},resolve:{mailQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"mail",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"mail",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:601})}]},authenticate:!0,permissionId:601,bodyClass:"mail"}).state("app.mail.mailQueues.edit",{url:"/:id?tab",params:{mailQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailQueues/edit/view.html",controller:"MailQueueController as vm"}},resolve:{mailQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("mailQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:601})}]},authenticate:!0,permissionId:601,bodyClass:"mail"}).state("app.mail.mailAccounts",{url:"/mailAccounts",views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailAccounts/mailAccounts.html",controller:"MailAccountsController as vm"}},resolve:{mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,name,provider,key,email,ListId,active,service,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",fields:"createdAt,updatedAt,id,name,provider,key,email,ListId,active,service,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:602})}]},authenticate:!0,permissionId:602,bodyClass:"mail"}).state("app.mail.mailAccounts.edit",{url:"/:id?tab",params:{mailAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailAccounts/edit/view.html",controller:"MailAccountController as vm"}},resolve:{mailAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,name,provider,key,email,ListId,active,service,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,name",sort:"name",type:"outlook365"})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadAttachments,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:602})}]},authenticate:!0,permissionId:602,bodyClass:"mail"}).state("app.mail.mailSubtatuses",{url:"/mailSubtatuses",views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailSubtatuses/mailSubtatuses.html",controller:"MailSubstatusesController as vm"}},resolve:{mailSubtatuses:["apiResolver",function(e){return e.resolve("mailSubstatus@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:603})}]},authenticate:!0,permissionId:603,bodyClass:"mail"}),n.addPart("app/main/apps/mail")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.mail",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.mail.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.mail.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/mail/views/realtime/realtime.html",controller:"MailRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:610})}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.agents",{url:"/agents",params:{channel:"mail"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.queues",{url:"/queues",controller:"QueuesMailRealtimeController as vm",templateUrl:"app/main/apps/mail/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"MailQueues":void 0,channel:"mail",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:601})}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.accounts",{url:"/accounts",controller:"MailAccountsRealtimeController as vm",templateUrl:"app/main/apps/mail/views/realtime/accounts/view.html",resolve:{mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:602})}],rpcMailAccounts:["apiResolver",function(e){return e.resolve("rpc@getMailAccounts")}]},authenticate:!0,permissionId:610})}e.$inject=["$stateProvider"],angular.module("app.mail.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.marketplace",{abstract:!0,url:"/marketplace"}).state("app.marketplace.plugins",{url:"/plugins",views:{"content@app":{templateUrl:"app/main/apps/marketplace/views/plugins/plugins.html",controller:"MarketplacePluginsController as vm"}},resolve:{plugins:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("plugin@get",{fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Plugins",fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1801})}]},authenticate:!0,permissionId:1801,bodyClass:"marketplace"}).state("app.marketplace.plugins.edit",{url:"/:id?tab",params:{plugin:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/marketplace/views/plugins/edit/view.html",controller:"MarketplacePluginController as vm"}},resolve:{plugin:["apiResolver","$stateParams",function(e,n){return e.resolve("plugin@get",{fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1801})}]},authenticate:!0,permissionId:1801,bodyClass:"marketplace"}),n.addPart("app/main/apps/marketplace")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.marketplace",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.motiondialer",{abstract:!0,url:"/motiondialer"}).state("app.motiondialer.queueCampaigns",{url:"/queueCampaigns",views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/queueCampaigns.html",controller:"QueueCampaignsController as vm"}},resolve:{queueCampaigns:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,callAdditionalPhoneAfterMin,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe,dialPreviewRecallmeReminder",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,callAdditionalPhoneAfterMin,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1501,bodyClass:"motiondialer"}).state("app.motiondialer.queueCampaigns.edit",{url:"/:id?tab",params:{queueCampaign:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/view.html",controller:"QueueCampaignController as vm"}},resolve:{queueCampaign:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe,dialPreviewRecallmeReminder,callAdditionalPhoneAfterMin",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1501,bodyClass:"motiondialer"}).state("app.motiondialer.ivrCampaigns",{url:"/ivrCampaigns",views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/ivrCampaigns.html",controller:"IvrCampaignsController as vm"}},resolve:{ivrCampaigns:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("campaign@get",{fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",type:"ivr",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"IvrCampaigns",fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",type:"ivr",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1502})}]},authenticate:!0,permissionId:1502,bodyClass:"motiondialer"}).state("app.motiondialer.ivrCampaigns.edit",{url:"/:id?tab",params:{ivrCampaign:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/view.html",controller:"IvrCampaignController as vm"}},resolve:{ivrCampaign:["apiResolver","$stateParams",function(e,n){return e.resolve("campaign@get",{fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1502})}]},authenticate:!0,permissionId:1502,bodyClass:"motiondialer"}),n.addPart("app/main/apps/motiondialer")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.motiondialer",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.motiondialer.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.motiondialer.hopperdate",{url:"/hopperdate",views:{"hopperdate@app":{templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",controller:"HopperdateController as vm"}},resolve:{info:["apiResolver",function(e){return e.resolve("version@get")}]},authenticate:!0,permissionId:1500,bodyClass:"motiondialer"})}e.$inject=["$stateProvider"],angular.module("app.motiondialer.hopperdate",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.motiondialer.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/realtime/realtime.html",controller:"MotionDialerRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1510})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.agents",{url:"/agents",params:{channel:"voice",direction:"outbound"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queues",{url:"/queues",controller:"QueuesMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"QueueCampaigns":void 0,channel:"voice",type:"outbound",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queue_calls",{url:"/queue_calls",controller:"QueueCallsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/queue_calls/view.html",resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}],rpcVoiceQueuesChannels:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueuesChannels")}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.abandonedcalls",{url:"/abandonedcalls",controller:"AbandonedCallsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/abandonedcalls/view.html",resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0})}],dispositions:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("disposition@get",{fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dispositions",fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queue_params",{url:"/queue_params",controller:"QueueParamsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/queue_params/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",fields:"id,name",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.ivr_campaigns",{url:"/ivr_campaigns",controller:"IvrCampaignsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/ivr_campaigns/view.html",resolve:{campaigns:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("campaign@get",{sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"IvrCampaigns",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1502})}],rpcCampaigns:["apiResolver",function(e){return e.resolve("rpc@getCampaigns")}]},authenticate:!0,permissionId:1510})}e.$inject=["$stateProvider"],angular.module("app.motiondialer.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.openchannel",{abstract:!0,url:"/openchannel"}).state("app.openchannel.openchannelQueues",{url:"/openchannelQueues",views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelQueues/openchannelQueues.html",controller:"OpenchannelQueuesController as vm"}},resolve:{openchannelQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("openchannelQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"openchannel",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OpenchannelQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"openchannel",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:801})}]},authenticate:!0,permissionId:801,bodyClass:"openchannel"}).state("app.openchannel.openchannelQueues.edit",{url:"/:id?tab",params:{openchannelQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/view.html",controller:"OpenchannelQueueController as vm"}},resolve:{openchannelQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("openchannelQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:801})}]},authenticate:!0,permissionId:801,bodyClass:"openchannel"}).state("app.openchannel.openchannelAccounts",{url:"/openchannelAccounts",views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/openchannelAccounts.html",controller:"OpenchannelAccountsController as vm"}},resolve:{openchannelAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OpenchannelAccounts",fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:802})}]},authenticate:!0,permissionId:802,bodyClass:"openchannel"}).state("app.openchannel.openchannelAccounts.edit",{url:"/:id?tab",params:{openchannelAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/view.html",controller:"OpenchannelAccountController as vm"}},resolve:{openchannelAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadAttachments,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:802})}]},authenticate:!0,permissionId:802,bodyClass:"openchannel"}),n.addPart("app/main/apps/openchannel")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.openchannel",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.openchannel.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.openchannel.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/realtime/realtime.html",controller:"OpenchannelRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:810})}]},authenticate:!0,permissionId:810}).state("app.openchannel.realtime.agents",{url:"/agents",params:{channel:"openchannel"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:810}).state("app.openchannel.realtime.queues",{url:"/queues",controller:"QueuesOpenchannelRealtimeController as vm",templateUrl:"app/main/apps/openchannel/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"OpenchannelQueues":void 0,channel:"openchannel",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:801})}]},authenticate:!0,permissionId:810})}e.$inject=["$stateProvider"],angular.module("app.openchannel.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.plugins",{abstract:!0,url:"/plugins"}),n.addPart("app/main/apps/plugins")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.plugins",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.plugins.plugin"]).config(e)}(),function(){"use strict";function e(e){e.state("app.plugins.plugin",{url:"/plugin/:id",views:{"content@app":{templateUrl:"app/main/apps/plugins/views/plugin/plugin.html",controller:"PluginController as vm"}},resolve:{},authenticate:!0,bodyClass:"plugins"})}e.$inject=["$stateProvider"],angular.module("app.plugins.plugin",[]).config(e)}(),function(){"use strict";angular.module("app.realtime",[])}(),function(){"use strict";function e(e,n){e.state("app.settings",{abstract:!0,url:"/settings"}).state("app.settings.generals",{url:"/generals",views:{"content@app":{templateUrl:"app/main/apps/settings/views/generals/generals.html",controller:"GeneralsController as vm"}},resolve:{generals:["apiResolver",function(e){return e.resolve("setting@get",{fields:"createdAt,updatedAt,id,min_internal,securePassword,callRecordingEncryption,chatTimeout,phoneBarAutoUpdater,defaultScreenRecordingPath,phoneBarAutoUpdaterUrl,enableEmailPreview,split,splitSizeCsv,splitSizePdf,splitSizeXlsx,searchOnEnterKey,messagesAlignment,phoneBarRememberMeEnabled,rtlSupport,allowedLoginAttempts,blockDuration,loginMailFrequency,language,bucket,transcribe,transcribeRegion,transcribeAccountId,sentiment,sentimentRegion,sentimentAccountId,googleSsoEnabled,enforcePasswordHistory,passwordHistoryLimit,enablePrivacyPolicyEmail,privacyPolicyEmail,enablePrivacyPolicyName,privacyPolicyName,enablePrivacyPolicyNumber,privacyPolicyNumber,chatInteractionsReloadTimeout,mailInteractionsReloadTimeout,openchannelInteractionsReloadTimeout,smsInteractionsReloadTimeout,whatsappInteractionsReloadTimeout,stopRecordingOnTransfer,adSsoEnabled,disabledCookie,previewRecallmeReminderInterval,limitTabs",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.smtps",{url:"/smtps",views:{"content@app":{templateUrl:"app/main/apps/settings/views/smtps/smtps.html",controller:"SmtpController as vm"}},resolve:{mailAccounts:["apiResolver",function(e){return e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,service,provider,name,email,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,description",service:"1",limit:10,offset:0})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,name",sort:"name",type:"outlook365"})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.networks",{url:"/networks",views:{"content@app":{templateUrl:"app/main/apps/settings/views/networks/networks.html",controller:"NetworksController as vm"}},resolve:{networks:["apiResolver",function(e){return e.resolve("network@get",{fields:"createdAt,updatedAt,id,type,value,username,password",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.customizations",{url:"/customizations",views:{"content@app":{templateUrl:"app/main/apps/settings/views/customizations/customizations.html",controller:"CustomizationsController as vm"}},resolve:{customizations:["apiResolver",function(e){return e.resolve("setting@get",{fields:"createdAt,updatedAt,id,defaultLogo,defaultLoginLogo,defaultFavicon,defaultHeaderWhiteLabel,headerWhiteLabel,defaultPageTitle,pageTitle,defaultPreferred",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.cloudProviders",{url:"/cloudProviders",views:{"content@app":{templateUrl:"app/main/apps/settings/views/cloudProviders/cloudProviders.html",controller:"CloudProvidersController as vm"}},resolve:{cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data7",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}),n.addPart("app/main/apps/settings")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.settings",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.settings.updates","app.settings.license","app.settings.system"]).config(e)}(),function(){"use strict";function e(e){e.state("app.settings.license",{url:"/license",views:{"content@app":{templateUrl:"app/main/apps/settings/views/license/license.html",controller:"LicenseController as vm"}},authenticate:!0,permissionId:1400,bodyClass:"settings"})}e.$inject=["$stateProvider"],angular.module("app.settings.license",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.settings.system",{url:"/system?tab",views:{"content@app":{templateUrl:"app/main/apps/settings/views/system/system.html",controller:"SystemController as vm"}},resolve:{system:["apiResolver",function(e){return e.resolve("system@get")}],processes:["apiResolver",function(e){return e.resolve("pm2@get")}]},authenticate:!0,permissionId:1400,bodyClass:"settings"})}e.$inject=["$stateProvider"],angular.module("app.settings.system",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.settings.updates",{url:"/updates",views:{"content@app":{templateUrl:"app/main/apps/settings/views/updates/updates.html",controller:"UpdatesController as vm"}},resolve:{version:["apiResolver",function(e){return e.resolve("version@get",{latest:!0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1400})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"})}e.$inject=["$stateProvider"],angular.module("app.settings.updates",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.sms",{abstract:!0,url:"/sms"}).state("app.sms.smsQueues",{url:"/smsQueues",views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsQueues/smsQueues.html",controller:"SmsQueuesController as vm"}},resolve:{smsQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"sms",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"sms",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:701})}]},authenticate:!0,permissionId:701,bodyClass:"sms"}).state("app.sms.smsQueues.edit",{url:"/:id?tab",params:{smsQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsQueues/edit/view.html",controller:"SmsQueueController as vm"}},resolve:{smsQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("smsQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:701})}]},authenticate:!0,permissionId:701,bodyClass:"sms"}).state("app.sms.smsAccounts",{url:"/smsAccounts",views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsAccounts/smsAccounts.html",controller:"SmsAccountsController as vm"}},resolve:{smsAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:702})}]},authenticate:!0,permissionId:702,bodyClass:"sms"}).state("app.sms.smsAccounts.edit",{url:"/:id?tab",params:{smsAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsAccounts/edit/view.html",controller:"SmsAccountController as vm"}},resolve:{smsAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("smsAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:702})}]},authenticate:!0,permissionId:702,bodyClass:"sms"}),n.addPart("app/main/apps/sms")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.sms",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.sms.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.sms.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/sms/views/realtime/realtime.html",controller:"SmsRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:710})}]},authenticate:!0,permissionId:710}).state("app.sms.realtime.agents",{url:"/agents",params:{channel:"sms"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:710}).state("app.sms.realtime.queues",{url:"/queues",controller:"QueuesSmsRealtimeController as vm",templateUrl:"app/main/apps/sms/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"SmsQueues":void 0,channel:"sms",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:701})}]},authenticate:!0,permissionId:710})}e.$inject=["$stateProvider"],angular.module("app.sms.realtime",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.staff",{abstract:!0,url:"/staff"}).state("app.staff.users",{url:"/users",views:{"content@app":{templateUrl:"app/main/apps/staff/views/users/users.html",controller:"UsersController as vm"}},resolve:{users:["apiResolver",function(e){return e.resolve("user@get",{fields:"createdAt,updatedAt,role,userProfileId,id,fullname,name,email,phone,mobile,userpic,password,description,autointernal,internal,transport,nat,allow,context,callgroup,pickupgroup,passwordResetAt,apiKey,videosupport,disabled,blocked,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay",role:"admin,user",sort:"-updatedAt",userSetting:!0,limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:201})}]},authenticate:!0,permissionId:201,bodyClass:"staff"}).state("app.staff.users.edit",{url:"/:id?tab",params:{user:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/users/edit/view.html",controller:"UserController as vm"}},resolve:{user:["apiResolver","$stateParams",function(e,n){return e.resolve("user@get",{fields:"createdAt,updatedAt,role,userProfileId,id,fullname,name,email,phone,mobile,userpic,password,description,autointernal,internal,transport,nat,allow,context,callgroup,pickupgroup,passwordResetAt,apiKey,videosupport,disabled,blocked,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay",id:n.id,userSetting:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:201})}]},authenticate:!0,permissionId:201,bodyClass:"staff"}).state("app.staff.agents",{url:"/agents",views:{"content@app":{templateUrl:"app/main/apps/staff/views/agents/agents.html",controller:"AgentsController as vm"}},resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay",role:"agent",sort:"-updatedAt",userSetting:!0,limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay",role:"agent",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:202,bodyClass:"staff"}).state("app.staff.agents.edit",{url:"/:id?tab",params:{agent:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/agents/edit/view.html",controller:"AgentController as vm"}},resolve:{agent:["apiResolver","$stateParams",function(e,n){return e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay",id:n.id,userSetting:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:202,bodyClass:"staff"}).state("app.staff.telephones",{url:"/telephones",views:{"content@app":{templateUrl:"app/main/apps/staff/views/telephones/telephones.html",controller:"TelephonesController as vm"}},resolve:{telephones:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",role:"telephone",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Telephones",fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",role:"telephone",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:203})}]},authenticate:!0,permissionId:203,bodyClass:"staff"}).state("app.staff.telephones.edit",{url:"/:id?tab",params:{telephone:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/telephones/edit/view.html",controller:"TelephoneController as vm"}},resolve:{telephone:["apiResolver","$stateParams",function(e,n){return e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:203})}]},authenticate:!0,permissionId:203,bodyClass:"staff"}).state("app.staff.teams",{url:"/teams",views:{"content@app":{templateUrl:"app/main/apps/staff/views/teams/teams.html",controller:"TeamsController as vm"}},resolve:{teams:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("team@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Teams",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:204})}]},authenticate:!0,permissionId:204,bodyClass:"staff"}).state("app.staff.userProfiles",{url:"/userProfiles",views:{"content@app":{templateUrl:"app/main/apps/staff/views/userProfiles/userProfiles.html",controller:"UserProfilesController as vm"}},resolve:{userProfiles:["apiResolver",function(e){return e.resolve("userProfile@get",{fields:"createdAt,updatedAt,id,name,description,crudPermissions,privacyEnabled,downloadAttachments,downloadCallySquareRecordings,downloadContactManagerLists,downloadJscriptySessions,downloadOmnichannelInteractions,downloadScreenRecordings,downloadVoiceRecordings",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:205})}]},authenticate:!0,permissionId:205,bodyClass:"staff"}).state("app.staff.userProfiles.edit",{url:"/:id?tab",params:{userProfile:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/userProfiles/edit/view.html",controller:"UserProfileController as vm"}},resolve:{userProfile:["apiResolver","$stateParams",function(e,n){return e.resolve("userProfile@get",{fields:"createdAt,updatedAt,id,name,description,crudPermissions,privacyEnabled,downloadAttachments,downloadCallySquareRecordings,downloadContactManagerLists,downloadJscriptySessions,downloadOmnichannelInteractions,downloadScreenRecordings,downloadVoiceRecordings",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:205})}]},authenticate:!0,permissionId:205,bodyClass:"staff"}),n.addPart("app/main/apps/staff")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.staff",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.tools",{abstract:!0,url:"/tools"}).state("app.tools.cannedAnswers",{url:"/cannedAnswers",views:{"content@app":{templateUrl:"app/main/apps/tools/views/cannedAnswers/cannedAnswers.html",controller:"CannedAnswersController as vm"}},resolve:{cannedAnswers:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cannedAnswer@get",{fields:"createdAt,updatedAt,id,key,value,description",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"CannedAnswers",fields:"createdAt,updatedAt,id,key,value,description",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1001})}]},authenticate:!0,permissionId:1001,bodyClass:"tools"}).state("app.tools.customDashboards",{url:"/customDashboards",views:{"content@app":{templateUrl:"app/main/apps/tools/views/customDashboards/customDashboards.html",controller:"CustomDashboardsController as vm"}},resolve:{customDashboards:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("dashboard@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"CustomDashboards",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1003})}]},authenticate:!0,permissionId:1003,bodyClass:"tools"}).state("app.tools.customDashboards.edit",{url:"/:id?tab",params:{customDashboard:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/customDashboards/edit/view.html",controller:"CustomDashboardController as vm"}},resolve:{customDashboard:["apiResolver","$stateParams",function(e,n){return e.resolve("dashboard@get",{fields:"createdAt,updatedAt,id,name,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1003})}]},authenticate:!0,permissionId:1003,bodyClass:"tools"}).state("app.tools.intervals",{url:"/intervals",views:{"content@app":{templateUrl:"app/main/apps/tools/views/intervals/intervals.html",controller:"IntervalsController as vm"}},resolve:{intervals:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("interval@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Intervals",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1004})}]},authenticate:!0,permissionId:1004,bodyClass:"tools"}).state("app.tools.intervals.edit",{url:"/:id?tab",params:{interval:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/intervals/edit/view.html",controller:"IntervalController as vm"}},resolve:{interval:["apiResolver","$stateParams",function(e,n){return e.resolve("interval@get",{fields:"createdAt,updatedAt,id,name,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1004})}]},authenticate:!0,permissionId:1004,bodyClass:"tools"}).state("app.tools.pauses",{url:"/pauses",views:{"content@app":{templateUrl:"app/main/apps/tools/views/pauses/pauses.html",controller:"PausesController as vm"}},resolve:{pauses:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("pause@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Pauses",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1005})}]},authenticate:!0,permissionId:1005,bodyClass:"tools"}).state("app.tools.schedules",{url:"/schedules",views:{"content@app":{templateUrl:"app/main/apps/tools/views/schedules/schedules.html",controller:"SchedulesController as vm"}},resolve:{schedules:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("schedule@get",{fields:"createdAt,updatedAt,id,name,CustomReportId,DefaultReportId,output,active,startAt,endAt,cron,subtractNumber,subtractUnit,sendMail,MailAccountId,email,cc,bcc,sendIfEmpty,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Scheduler",fields:"createdAt,updatedAt,id,name,CustomReportId,DefaultReportId,output,active,startAt,endAt,cron,subtractNumber,subtractUnit,sendMail,MailAccountId,email,cc,bcc,sendIfEmpty,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1006})}]},authenticate:!0,permissionId:1006,bodyClass:"tools"}).state("app.tools.sounds",{url:"/sounds",views:{"content@app":{templateUrl:"app/main/apps/tools/views/sounds/sounds.html",controller:"SoundsController as vm"}},resolve:{sounds:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("sound@get",{fields:"createdAt,updatedAt,id,save_name,converted_format,name,audio,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Sounds",fields:"createdAt,updatedAt,id,save_name,converted_format,name,audio,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1007})}]},authenticate:!0,permissionId:1007,bodyClass:"tools"}).state("app.tools.tags",{url:"/tags",views:{"content@app":{templateUrl:"app/main/apps/tools/views/tags/tags.html",controller:"TagsController as vm"}},resolve:{tags:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("tag@get",{fields:"createdAt,updatedAt,id,name,description,color",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Tags",fields:"createdAt,updatedAt,id,name,description,color",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1008})}]},authenticate:!0,permissionId:1008,bodyClass:"tools"}).state("app.tools.templates",{url:"/templates",views:{"content@app":{templateUrl:"app/main/apps/tools/views/templates/templates.html",controller:"TemplatesController as vm"}},resolve:{templates:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("template@get",{fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Templates",fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1009})}]},authenticate:!0,permissionId:1009,bodyClass:"tools"}).state("app.tools.trunks",{url:"/trunks",views:{"content@app":{templateUrl:"app/main/apps/tools/views/trunks/trunks.html",controller:"TrunksController as vm"}},resolve:{trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}]},authenticate:!0,permissionId:1011,bodyClass:"tools"}).state("app.tools.trunks.edit",{url:"/:id?tab",params:{trunk:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/trunks/edit/view.html",controller:"TrunkController as vm"}},resolve:{trunk:["apiResolver","$stateParams",function(e,n){return e.resolve("trunk@get",{fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}]},authenticate:!0,permissionId:1011,bodyClass:"tools"}).state("app.tools.variables",{url:"/variables",views:{"content@app":{templateUrl:"app/main/apps/tools/views/variables/variables.html",controller:"VariablesController as vm"}},resolve:{variables:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("variable@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Variables",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1012})}]},authenticate:!0,permissionId:1012,bodyClass:"tools"}).state("app.tools.contact_item_types",{url:"/contact_item_types",views:{"content@app":{templateUrl:"app/main/apps/tools/views/contact_item_types/contact_item_types.html",controller:"ContactItemTypesController as vm"}},resolve:{contact_item_types:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("contactItemType@get",{fields:"createdAt,updatedAt,id,name,OrderBy,rgbBackgroundColor",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ContactItemType",fields:"createdAt,updatedAt,id,name,OrderBy,rgbBackgroundColor",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1013})}]},authenticate:!0,permissionId:1013,bodyClass:"tools"}),n.addPart("app/main/apps/tools")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.tools",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.tools.dispositions","app.tools.triggers"]).config(e)}(),function(){"use strict";function e(e){e.state("app.tools.dispositions",{url:"/dispositions",views:{"content@app":{templateUrl:"app/main/apps/tools/views/dispositions/dispositions.html",controller:"DispositionsController as vm"}},resolve:{dispositions:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("disposition@get",{fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",WhatsappAccountId:"null",ListId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dispositions",fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",WhatsappAccountId:"null",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1002})}]},authenticate:!0,permissionId:1002,bodyClass:"tools"})}e.$inject=["$stateProvider"],angular.module("app.tools.dispositions",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.tools.triggers",{url:"/triggers",views:{"content@app":{templateUrl:"app/main/apps/tools/views/triggers/triggers.html",controller:"TriggersController as vm"}},resolve:{triggers:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trigger@get",{fields:"createdAt,updatedAt,id,name,channel,status,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Triggers",fields:"createdAt,updatedAt,id,name,channel,status,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1010})}]},authenticate:!0,permissionId:1010,bodyClass:"tools"}).state("app.tools.triggers.edit",{url:"/:id?tab",params:{trigger:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/triggers/edit/view.html",controller:"TriggerController as vm"}},resolve:{trigger:["apiResolver","$stateParams",function(e,n){return e.resolve("trigger@get",{fields:"createdAt,updatedAt,id,name,channel,status,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1010})}]},authenticate:!0,permissionId:1010,bodyClass:"tools"})}e.$inject=["$stateProvider"],angular.module("app.tools.triggers",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.video",{abstract:!0,url:"/video"}).state("app.video.screenRecordings",{url:"/screenRecordings",views:{"content@app":{templateUrl:"app/main/apps/video/views/screenRecordings/screenRecordings.html",controller:"ScreenRecordingsController as vm"}},resolve:{screenRecordings:["apiResolver","Auth","msUtils",function(e,n,t){return n.hasRole("admin")?e.resolve("screenRecording@get",{fields:"createdAt,updatedAt,id,interactionid,channel,format,value,rating,UserId,duration,startedAt,closedAt",createdAt:t.firstLastDayMonth(),includeAll:"true",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ScreenRecordings",fields:"createdAt,updatedAt,id,interactionid,channel,format,value,rating,UserId,duration,startedAt,closedAt",createdAt:t.firstLastDayMonth(),includeAll:"true",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadScreenRecordings",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2001})}]},authenticate:!0,permissionId:2001,bodyClass:"video"}),n.addPart("app/main/apps/video")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.video",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.inboundRoutes",{url:"/inboundRoutes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/inboundRoutes/inboundRoutes.html",controller:"InboundRoutesController as vm"}},resolve:{inboundRoutes:["apiResolver","Auth",function(e,n){return n.isAdmin()?e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"InboundRoutes",fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:402})}]},authenticate:!0,permissionId:402,bodyClass:"voice"}).state("app.voice.inboundRoutes.edit",{url:"/:id?tab",params:{inboundRoute:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/inboundRoutes/edit/view.html",controller:"InboundRouteController as vm"}},resolve:{inboundRoute:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",id:n.id})}],contexts:["apiResolver",function(e){return e.resolve("voiceContext@get",{fields:"id,name",sort:"name"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:402})}]},authenticate:!0,permissionId:402,bodyClass:"voice"})}e.$inject=["$stateProvider"],angular.module("app.voice.inboundRoutes",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.internalRoutes",{url:"/internalRoutes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/internalRoutes/internalRoutes.html",controller:"InternalRoutesController as vm"}},resolve:{internalRoutes:["apiResolver","Auth",function(e,n){return n.isAdmin()?e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"InternalRoutes",fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:404})}]},authenticate:!0,permissionId:404,bodyClass:"voice"}).state("app.voice.internalRoutes.edit",{url:"/:id?tab",params:{internalRoute:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/internalRoutes/edit/view.html",controller:"InternalRouteController as vm"}},resolve:{internalRoute:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",id:n.id})}],contexts:["apiResolver",function(e){return e.resolve("voiceContext@get",{fields:"id,name",sort:"name"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:404})}]},authenticate:!0,permissionId:404,bodyClass:"voice"})}e.$inject=["$stateProvider"],angular.module("app.voice.internalRoutes",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.outboundRoutes",{url:"/outboundRoutes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/outboundRoutes/outboundRoutes.html",controller:"OutboundRoutesController as vm"}},resolve:{outboundRoutes:["apiResolver","Auth",function(e,n){return n.isAdmin()?e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,recordingFormat,cutdigits,description,alias,createdAt,updatedAt",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OutboundRoutes",fields:"id,appdata,type,exten,context,recordingFormat,cutdigits,description,alias,createdAt,updatedAt",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:403})}]},authenticate:!0,permissionId:403,bodyClass:"voice"}).state("app.voice.outboundRoutes.edit",{url:"/:id?tab",params:{outboundRoute:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/outboundRoutes/edit/view.html",controller:"OutboundRouteController as vm"}},resolve:{outboundRoute:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,recordingFormat,cutdigits,description,alias,createdAt,updatedAt",id:n.id})}],contexts:["apiResolver",function(e){return e.resolve("voiceContext@get",{fields:"id,name",sort:"name"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:403})}]},authenticate:!0,permissionId:403,bodyClass:"voice"})}e.$inject=["$stateProvider"],angular.module("app.voice.outboundRoutes",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/voice/views/realtime/realtime.html",controller:"VoiceRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:411})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.agents",{url:"/agents",params:{channel:"voice",direction:"inbound"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.telephones",{url:"/telephones",controller:"TelephonesVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/telephones/view.html",resolve:{telephones:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,fullname,userpic,internal",role:"telephone",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Telephones",fields:"id,fullname,userpic,internal",role:"telephone",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:203})}],rpcTelephones:["apiResolver",function(e){return e.resolve("rpc@getTelephones")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.trunks",{url:"/trunks",controller:"TrunksVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/trunks/view.html",resolve:{trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",active:!0,sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}],rpcTrunks:["apiResolver",function(e){return e.resolve("rpc@getTrunks")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queues",{url:"/queues",controller:"QueuesVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"VoiceQueues":void 0,channel:"voice",type:"inbound",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queue_calls",{url:"/queue_calls",controller:"QueueCallsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/queue_calls/view.html",resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}],rpcVoiceQueuesChannels:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueuesChannels")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.abandonedcalls",{url:"/abandonedcalls",controller:"AbandonedCallsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/abandonedcalls/view.html",resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context",role:"agent",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context",role:"agent",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0})}],dispositions:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("disposition@get",{fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dispositions",fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queue_params",{url:"/queue_params",controller:"QueueParamsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/queue_params/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",fields:"id,name",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.outbound_calls",{url:"/outbound_calls",controller:"OutboundCallsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/outbound_calls/view.html",resolve:{rpcCalls:["apiResolver",function(e){return e.resolve("rpc@getOutboundChannels")}]},authenticate:!0,permissionId:411})}e.$inject=["$stateProvider"],angular.module("app.voice.realtime",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.voice",{abstract:!0,url:"/voice"}).state("app.voice.voiceQueues",{url:"/voiceQueues",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceQueues/voiceQueues.html",controller:"VoiceQueuesController as vm"}},resolve:{voiceQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:401,bodyClass:"voice"}).state("app.voice.voiceQueues.edit",{url:"/:id?tab",params:{voiceQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceQueues/edit/view.html",controller:"VoiceQueueController as vm"}},resolve:{voiceQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:401,bodyClass:"voice"}).state("app.voice.contexts",{url:"/contexts",views:{"content@app":{templateUrl:"app/main/apps/voice/views/contexts/contexts.html",controller:"ContextsController as vm"}},resolve:{contexts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceContext@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Contexts",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:405})}]},authenticate:!0,permissionId:405,bodyClass:"voice"}).state("app.voice.voicemails",{url:"/voicemails",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voicemails/voicemails.html",controller:"VoicemailsController as vm"}},resolve:{voicemails:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceMail@get",{fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Voicemails",fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:406})}]},authenticate:!0,permissionId:406,bodyClass:"voice"}).state("app.voice.voicemails.edit",{url:"/:id?tab",params:{voicemail:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/voicemails/edit/view.html",controller:"VoicemailController as vm"}},resolve:{voicemail:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceMail@get",{fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:406})}]},authenticate:!0,permissionId:406,bodyClass:"voice"}).state("app.voice.musiconholds",{url:"/musiconholds",views:{"content@app":{templateUrl:"app/main/apps/voice/views/musiconholds/musiconholds.html",controller:"MusicOnHoldsController as vm"}},resolve:{musiconholds:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceMusicOnHold@get",{fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",defaultEntry:"false",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MusicOnHolds",fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",defaultEntry:"false",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:407})}]},authenticate:!0,permissionId:407,bodyClass:"voice"}).state("app.voice.musiconholds.edit",{url:"/:id?tab",params:{musiconhold:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/musiconholds/edit/view.html",controller:"MusicOnHoldController as vm"}},resolve:{musiconhold:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceMusicOnHold@get",{fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:407})}]},authenticate:!0,permissionId:407,bodyClass:"voice"}).state("app.voice.voiceRecordings",{url:"/voiceRecordings",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceRecordings/voiceRecordings.html",controller:"VoiceRecordingsController as vm"}},resolve:{voiceRecordings:["apiResolver","Auth","msUtils",function(e,n,t){return n.hasRole("admin")?e.resolve("voiceRecording@get",{fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",sort:"-createdAt",createdAt:t.firstLastDayMonth(),limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceRecordings",fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",sort:"-createdAt",createdAt:t.firstLastDayMonth(),limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadVoiceRecordings,privacyEnabled",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:408})}]},authenticate:!0,permissionId:408,bodyClass:"voice"}).state("app.voice.voiceRecordings.edit",{url:"/:id?tab",params:{voiceRecording:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceRecordings/edit/view.html",controller:"VoiceRecordingController as vm"}},resolve:{voiceRecording:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceRecording@get",{fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadVoiceRecordings,privacyEnabled",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:408})}]},authenticate:!0,permissionId:408,bodyClass:"voice"}).state("app.voice.chanSpies",{url:"/chanSpies",views:{"content@app":{templateUrl:"app/main/apps/voice/views/chanSpies/chanSpies.html",controller:"ChanSpiesController as vm"}},resolve:{chanSpies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceChanSpy@get",{fields:"createdAt,updatedAt,id,name,prefix,options,auth,password,record,recordingFormat,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChanSpies",fields:"createdAt,updatedAt,id,name,prefix,options,auth,password,record,recordingFormat,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:409})}]},authenticate:!0,permissionId:409,bodyClass:"voice"}).state("app.voice.voicePrefixes",{url:"/voicePrefixes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voicePrefixes/voicePrefixes.html",controller:"VoicePrefixesController as vm"}},resolve:{voicePrefixes:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voicePrefix@get",{fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoicePrefixes",fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:410})}]},authenticate:!0,permissionId:410,bodyClass:"voice"}),n.addPart("app/main/apps/voice")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.voice",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.voice.inboundRoutes","app.voice.outboundRoutes","app.voice.internalRoutes","app.voice.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.whatsapp.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/realtime/realtime.html",controller:"WhatsappRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2110})}]},authenticate:!0,permissionId:2110}).state("app.whatsapp.realtime.agents",{url:"/agents",params:{channel:"whatsapp"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{nolimit:!0})}],agents:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getAgents",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,fields:"id,name,fullname,role,userpic,internal,online,voicePause,openchannelPause,faxPause,chatPause,smsPause,whatsappPause,mailPause,pauseType,lastPauseAt,lastLoginAt,lastPauseAt,chatCapacity,mailCapacity,openchannelCapacity,faxCapacity,smsCapacity,whatsappCapacity,screenrecording,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording",sort:"fullname",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:2110}).state("app.whatsapp.realtime.queues",{url:"/queues",controller:"QueuesWhatsappRealtimeController as vm",templateUrl:"app/main/apps/whatsapp/views/realtime/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"WhatsappQueues":void 0,channel:"whatsapp",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2101})}]},authenticate:!0,permissionId:2110})}e.$inject=["$stateProvider"],angular.module("app.whatsapp.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.whatsapp",{abstract:!0,url:"/whatsapp"}).state("app.whatsapp.whatsappQueues",{url:"/whatsappQueues",views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/whatsappQueues.html",controller:"WhatsappQueuesController as vm"}},resolve:{whatsappQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("whatsappQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"whatsapp",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"WhatsappQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"whatsapp",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2101})}]},authenticate:!0,permissionId:2101,bodyClass:"whatsapp"}).state("app.whatsapp.whatsappQueues.edit",{url:"/:id?tab",params:{whatsappQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/view.html",controller:"WhatsappQueueController as vm"}},resolve:{whatsappQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("whatsappQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2101})}]},authenticate:!0,permissionId:2101,bodyClass:"whatsapp"}).state("app.whatsapp.whatsappAccounts",{url:"/whatsappAccounts",views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/whatsappAccounts.html",controller:"WhatsappAccountsController as vm"}},resolve:{whatsappAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("whatsappAccount@get",{fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description,baseUrl",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"WhatsappAccounts",fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2102})}]},authenticate:!0,permissionId:2102,bodyClass:"whatsapp"}).state("app.whatsapp.whatsappAccounts.edit",{url:"/:id?tab",params:{whatsappAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/view.html",controller:"WhatsappAccountController as vm"}},resolve:{whatsappAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("whatsappAccount@get",{fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description,baseUrl",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2102})}]},authenticate:!0,permissionId:2102,bodyClass:"whatsapp"}),n.addPart("app/main/apps/whatsapp")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.whatsapp",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.whatsapp.realtime"]).config(e)}(),function(){"use strict";angular.module("app.navigation",[]).config(function(){})}(),function(){"use strict";function e(e,n){e.addPart("app/quick-panel")}e.$inject=["$translatePartialLoaderProvider","msApiProvider"],angular.module("app.quick-panel",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.reset",{url:"/reset/:token",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.reset":{templateUrl:"app/reset/reset.html",controller:"ResetPasswordController as vm"}},bodyClass:"reset"}),n.addPart("app/reset")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.reset",[]).config(e)}(),function(){"use strict";function e(e){e.addPart("app/toolbar")}e.$inject=["$translatePartialLoaderProvider"],angular.module("app.toolbar",[]).config(e)}(),function(){"use strict";angular.module("app.user-setting",[])}(),function(){"use strict";function e(e){e.interceptors.push("authInterceptor")}e.$inject=["$httpProvider"],angular.module("app.auth").config(e)}(),function(){"use strict";function e(e){e.onBefore({to:function(e){return!0===e.authenticate}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService;return n.isLoggedIn()?n.retrieveUser().catch(function(){return t.target("app.login",void 0,{reload:!0})}):t.target("app.login",void 0,{reload:!0})}),e.onStart({to:function(e){return"app.login"!==e.name}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService,a=e.$to();if(n.hasRole("agent")&&"app.dashboards.general"!=a.name)return t.target("app.dashboards.general",{redirect:!1},{reload:!0})}),e.onFinish({to:function(e){return"app.help"===e.parent.name}},function(e){var n=e.router.stateService;if("app.help"===e.$to().parent.name){var t=e.injector().get("settingsManager"),a=t?t.get():null;if(!a||!a.viewHelpSection)return n.target("app.dashboards.general",{redirect:!1},{reload:!0})}}),e.onFinish({to:function(e){return e.permissionId}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService,a=e.$to();if(n.hasRole("user")){if(!n.hasPermission(a.permissionId))return t.target("app.dashboards.general",{redirect:!1},{reload:!0});var i=e.params().id?Number(e.params().id):void 0;if(i)return n.hasResourcePermission(a.permissionId,i).catch(function(){return t.target(a.parent.name,{redirect:!1},{reload:!0})})}}),e.onFinish({to:function(e){return"app.dashboards.general"===e.parent.name}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService;e.$to();if(n.hasRole("user")&&!n.hasPermission(100))return t.target("app.dashboards.general",{redirect:!1},{reload:!0})})}e.$inject=["$transitions"],angular.module("app.auth").run(e)}(),function(){"use strict";function e(a,e,o,i,s,r,l,d,c){var m;return{getToken:n,getCurrentUser:u,getPermissions:A,hasChildrenPermissions:function(e){return!!e&&_.some(e,function(e){return t(e)})},hasModulePermissions:function(i){return o(function(a,n){f()?a(!0):r.userProfileSection.get({userProfileId:m.userProfileId}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(_.isEmpty(n))a(!1);else{var t=_.filter(n,function(e){return e.enabled});a(_.some(t,["category",i]))}}).catch(function(e){n(e)})})},hasModulesPermissions:function(s){return o(function(a,n){var i={};f()?(s.forEach(function(e){i[e]=!0}),a(i)):r.userProfileSection.get({userProfileId:m.userProfileId}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(_.isEmpty(n))a({});else{var t=_(n).filter(function(e){return e.enabled&&_.includes(s,e.category)}).uniqBy(function(e){return e.category}).map(function(e){return e.category}).value();t.forEach(function(e){i[e]=!0}),a(i)}}).catch(function(e){n(e)})})},hasRole:function(e){return!!m&&m.role===e},hasPermission:t,hasResourcePermission:function(e,s){return o(function(a,i){return r.userProfileSection.get({userProfileId:m.userProfileId,sectionId:e}).$promise.then(function(e){var n=e.rows[0];if(n.autoAssociation)return a();var t=l.getActiveItem().node;return t.permissions&&!1===t.permissions.association?a():r.userProfileResource.get({sectionId:n.id,nolimit:!0}).$promise.then(function(e){var n=e.rows;_.some(n,["resourceId",s])?a():i()})}).catch(function(e){i("Error retrieving user profile permissions",e)})})},hasSectionPermissions:function(a){return o(function(e,n){var t={};return E().then(function(){_.includes(m.permissions,a)&&(t[a]=!0),e(t)}).catch(function(e){n(e)})})},hasSectionsPermissions:function(a){return o(function(e,n){var t={};if(!f())return E().then(function(){a.forEach(function(e){_.includes(m.permissions,e)&&(t[e]=!0)}),e(t)}).catch(function(e){n(e)});a.forEach(function(e){t[e]=!0}),e(t)})},isAgent:h,isAdmin:f,isLoggedIn:function(){return!!n()},isTelephone:function(){return"telephone"===m.role},isUser:b,login:function(e){return o(function(n,t){r.auth.local(e).$promise.then(function(e){return d.get().secureCookieEnabled?c.set("motion.token",e.token,{secure:!0,sameSite:"none"}):c.set("motion.token",e.token),r.user.get({id:e.id}).$promise}).then(function(e){(m=e).lastLoginAt=moment().format("YYYY-MM-DD HH:mm:ss"),y("LOCAL_LOGIN")}).then(function(){if(h()&&1===m.showWebBar&&m.hotdesk)return a.show({controller:"HotDeskDialogController",controllerAs:"vm",templateUrl:"app/auth/services/hotdesk/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,resolve:{telephones:["apiResolver",function(e){return e.resolve("user@get",{fields:"id,fullname,name,internal",role:"telephone",nolimit:!0})}]}})}).then(function(e){return h()&&0!==m.showWebBar?p(e):f()||b()?g(!0):void 0}).then(function(e){m=_.assign(m,e),n()}).catch(function(e){t(e)})})},logout:function(t){return o(function(e,n){t?(v(),e()):o.resolve().then(function(){return h()&&0!==m.showWebBar?o(function(e,n){r.user.logout({id:m.id,device:"web"}).$promise.then(function(){e()}).catch(function(e){n(e)})}):f()||b()?g(!1):void 0}).then(function(){v(),e()}).catch(function(e){n(e)})})},parseCrudPermissions:function(e){return f()?{readOnly:!1,canEdit:!0,canDelete:!0}:e?{readOnly:!(!_.includes(e,"r")||1!==e.length),canEdit:!!_.includes(e,"e"),canDelete:!!_.includes(e,"d")}:{readOnly:!0,canEdit:!1,canDelete:!1}},queueLogin:p,reloadPermissions:E,removeCookies:v,retrieveUser:function(){return o(function(n,t){r.user.whoami({userSetting:!0}).$promise.then(function(n){return"user"===n.role?A(n.userProfileId).then(function(e){return n.permissions=e,n}):n}).then(function(e){n(m=e)}).catch(function(e){t(e)})})},setCurrentUser:function(e){m=_.merge(m,e)},getAuthenticationType:function(){var e=u(),n=i.localStorage.getItem("motion2.user:"+e.id);if(n)return JSON.parse(n).authenticationType;return"NONE"},loginSSO:function(e){"google"!==e&&y("SSO_LOGIN");return"/api/auth/"+e},loginAD:function(e){return o(function(n,t){r.auth.activedirectory(e).$promise.then(function(e){return d.get().secureCookieEnabled?c.set("motion.token",e.token,{secure:!0,sameSite:"none"}):c.set("motion.token",e.token),r.user.get({id:e.id}).$promise}).then(function(e){(m=e).lastLoginAt=moment().format("YYYY-MM-DD HH:mm:ss"),y("SSO_LOGIN")}).then(function(){if(h()&&1===m.showWebBar&&m.hotdesk)return a.show({controller:"HotDeskDialogController",controllerAs:"vm",templateUrl:"app/auth/services/hotdesk/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,resolve:{telephones:["apiResolver",function(e){return e.resolve("user@get",{fields:"id,fullname,name,internal",role:"telephone",nolimit:!0})}]}})}).then(function(e){return h()&&0!==m.showWebBar?p(e):f()||b()?g(!0):void 0}).then(function(e){m=_.assign(m,e),n()}).catch(function(e){t(e)})})}};function n(){return e.get("motion.token")}function u(){return m}function p(e){return o(function(n,t){r.user.login({id:m.id,device:"web",intrf:e}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}function g(a){return o(function(n,t){var e={online:a,lastLoginAt:a?moment().format("YYYY-MM-DD HH:mm:ss"):void 0};r.user.update({id:m.id},e).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}function v(){e.remove("motion.token"),m&&(i.localStorage.removeItem("motion.user:"+m.id),m=null)}function h(){return"agent"===m.role}function f(){return"admin"===m.role}function b(){return"user"===m.role}function t(e){return!!m&&_.includes(m.permissions,e)}function A(e){var a=[];return o(function(n,t){return e||n(a),r.userProfile.getSections({id:e}).$promise.then(function(e){for(var n=0;n<e.length;n++){var t=e[n];a.push(t.sectionId),t.subsections&&(a=_.concat(a,t.subsections))}return a}).then(function(e){n(e)}).catch(function(e){t("Error retrieving user profile permissions",e)})})}function E(){return o(function(n,t){A(m.userProfileId).then(function(e){m.permissions=e,n()}).catch(function(e){t(e)})})}function y(e){var n=u(),t={authenticationType:e};i.localStorage.setItem("motion2.user:"+n.id,JSON.stringify(t))}}e.$inject=["$mdDialog","$cookies","$q","$window","$document","api","msNavigationService","settingsManager","jscookie"],angular.module("app.auth").factory("Auth",e)}(),function(){"use strict";function e(n,e){this.telephones=e,this.closeDialog=function(e){n.hide(e)},e.count&&(this.name=e.rows[0].name)}e.$inject=["$mdDialog","telephones"],angular.module("app.auth").controller("HotDeskDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s;return{request:function(e){var n=t.get("motion.token");return e.headers=e.headers||{},i.isSameOrigin(e.url)&&n&&(e.headers.Authorization="Bearer "+n),e},responseError:function(e){switch(e.status){case 401:t.remove("motion.token"),(s||(s=a.get("$state"))).go("app.login")}return n.reject(e)}}}e.$inject=["$rootScope","$q","$cookies","$injector","Util"],angular.module("app.auth").factory("authInterceptor",e)}(),function(){"use strict";function e(n){var t={safeCb:function(e){return angular.isFunction(e)?e:angular.noop},urlParse:function(e){var n=document.createElement("a");return n.href=e,""===n.host&&(n.href=n.href),n},isSameOrigin:function(i,e){return i=t.urlParse(i),(e=(e=e&&[].concat(e)||[]).map(t.urlParse)).push(n.location),1<=(e=e.filter(function(e){var n=i.hostname===e.hostname,t=i.protocol===e.protocol,a=i.port===e.port||""===e.port&&("80"===i.port||"443"===i.port);return n&&t&&a})).length}};return t}e.$inject=["$window"],angular.module("app.auth").factory("Util",e)}(),function(){"use strict";function e(e,n,t){var a={initLogger:function(){return i.init({uri:t.baseUrl+"logs/client-logs",initial_state_name:"client-logs",flushInterval:6e4,debounceInterval:10,sizeLimit:300,silent:!1,autoLog:["error"],heartbeat:!1,logUnload:!1,logPerformance:!1}),i.addHeaderBuilder(function(){return(e=n.get("motion.token"))?{Authorization:"Bearer "+e}:{};var e}),i}},i=e.$logger;if(!i)throw new Error("Beaver Logger not found");return a}function n(d,e,t){var n={getLogger:function(l){var e=function(r){return function(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];var a=n[0],i=n.slice(1),s="string"!=typeof a||"string"==typeof a&&0===i.length?l:a,o=1<n.length&&"string"==typeof a?i:n;(function(e,n,t){if(!d.isLoggedIn())return;var a=d.getCurrentUser();if(!a||!a.userSetting.clientSideLoggingEnabled)return;if(i=e,!(c.indexOf(i)>=c.indexOf(m)))return;var i;var s=n,o=t;"string"==typeof n&&void 0===t&&(s=e,o=n);u[e].call(u,s,{data:p(o)})}).call(this,r,s,o)}};return{error:e("error"),warn:e("warn"),info:e("info"),debug:e("debug")}},getLoggingColors:function(){return{disabled:{color:"#616161"},debug:{color:"#283593"},info:{color:"#000000"},warning:{color:"#FBC02D"},error:{color:"#FF5252"}}},flush:a},c=["debug","info","warn","error"],m="debug",u=e.initLogger();function p(t){return Array.isArray(t)?t.map(p):null===t||"object"!=typeof t?t:_.isPlainObject(t)?t:t&&"function"==typeof t.toJSON?t.toJSON():t instanceof Error?Object.getOwnPropertyNames(t).reduce(function(e,n){return e[n]=p(t[n]),e},{}):JSON.parse(JSON.stringifyOnce(t))}function a(){return u.flush()}return t.$on("local:user-setting-updated",function(e,n){n.clientSideLoggingEnabled?t.$broadcast("client-side-logging:enabled"):(a(),t.$broadcast("client-side-logging:disabled")),m=n.clientSideLoggingLevel}),t.$on("local:user-logout",function(){m="debug"}),JSON.stringifyOnce=function(i,s,e){var o=[],r=[];return e||(e=2),JSON.stringify(i,function(e,t){if(2e3<o.length)return"object too long";var a=!1;if(o.forEach(function(e,n){e===t&&(a=n)}),""==e)return o.push(i),r.push("root"),t;if(a+""!="false"&&"object"==typeof t)return"root"==r[a]?"(pointer to root)":"(see "+(t&&t.constructor?t.constructor.name.toLowerCase():typeof t)+" with key "+r[a]+")";var n=e||"(empty key)";return o.push(t),r.push(n),s?s(e,t):t},e)},n}e.$inject=["$window","$cookies","api"],n.$inject=["Auth","clientSideLogger","$rootScope"],angular.module("app.client-side-logging").factory("clientSideLogger",e).service("ClientSideLoggingService",n)}(),function(){"use strict";angular.module("app.core").provider("motionConfig",function(){var t={disableCustomScrollbars:!1,disableMdInkRippleOnMobile:!0,disableCustomScrollbarsOnMobile:!0};this.config=function(e){t=angular.extend({},t,e)},this.$get=function(){var e={getConfig:function(e){if(angular.isUndefined(t[e]))return!1;return t[e]},setConfig:function(e,n){t[e]=n}};return e}})}(),function(){"use strict";function e(e,n,t){n.debugEnabled(!0),e.config({tabindex:!1}),t.config({disableCustomScrollbars:!1,disableCustomScrollbarsOnMobile:!0,disableMdInkRippleOnMobile:!0})}e.$inject=["$ariaProvider","$logProvider","motionConfigProvider"],angular.module("app.core").config(e)}(),function(){"use strict";function e(e,n,t){(n.generate(),t.getConfig("disableMdInkRippleOnMobile")&&e.isMobile())&&angular.element("body").attr("md-no-ink",!0);e.isMobile()&&angular.element("html").addClass("is-mobile");var a=e.detectBrowser();if(a){var i=a.browser+" "+a.version+" "+a.os;angular.element("html").addClass(i)}}e.$inject=["msUtils","motionGenerator","motionConfig"],angular.module("app.core").run(e)}(),function(){"use strict";function e(n,e,t,a,i,s){var l=this;function o(){var e=_.filter(l.searchOptions.conditions,["disabled",!1]),o=[],r="";if(_(e).groupBy("name").forEach(function(e){var n=e[0],t=1<e.length,a=n.query.column;if(t){var i=_(e).groupBy(function(e){return e.query.operator}).mapValues(function(e){return _.chain(e).map(function(e){return e.query.value}).flattenDeep().value()}).value(),s=[];_.keys(i).forEach(function(e){var n=i[e],t=e;_.includes(["$between","$in","$notIn"],e)?t+="["+n+"]":n.forEach(function(e){t+="["+e+"]"}),s.push(t)}),r+=a+":="+s.join(":=")}else r=a+":="+n.query.operator+"["+n.query.value+"]";o.push(r)}),0!==o.length){var n="["+l.searchOptions.matchType+"]";return n+=o.join("||")}}function r(){var e=n.localStorage.getItem("motion2."+s+":"+l.currentUser.id);return e?JSON.parse(e):{}}function d(e){n.localStorage.setItem("motion2."+s+":"+l.currentUser.id,JSON.stringify(e))}function c(){if(s){var e=r();e.advancedSearch=_.omit(l.searchOptions,"fields"),d(e)}}function m(){return!!r().advancedSearch}l.currentUser=t.getCurrentUser(),l.searchOptions={matchType:"$and",conditions:[],fields:i},l.toolbarColor=a,l.onInit=function(){if(s){var e=r();e.hasOwnProperty("advancedSearch")&&(l.searchOptions=_.merge(l.searchOptions,e.advancedSearch))}},l.applyFilter=function(){c(),e.hide({apply:!0,value:o()})},l.clearConditions=function(){l.searchOptions.conditions=[],function(){if(s){var e=r();delete e.advancedSearch,e.query&&delete e.query.search,d(e)}}()},l.minimize=function(){c(),e.hide({apply:!m(),value:o()||m()?!_.isEmpty(l.searchOptions.conditions):void 0})},l.close=function(){e.hide({apply:!m(),value:o()||m()?!_.isEmpty(l.searchOptions.conditions):void 0})}}e.$inject=["$window","$mdDialog","Auth","color","fields","storagePath"],angular.module("app.core").controller("AdvancedSearchController",e)}(),function(){"use strict";function e(a){return{restrict:"A",link:function(e,n,t){e.$watch(t.focusOn,function(e){a(function(){e?n[0].focus():n[0].blur()})})}}}e.$inject=["$timeout"],angular.module("app.core").directive("focusOn",e)}(),function(){"use strict";function e(o,l,d){return{restrict:"E",compile:function(e,n){var s;return n.code||(s=e.html(),e.empty()),function(t,a,r){r.code&&(s=t.$eval(r.code));var i=t.$eval(r.shouldInterpolate);l.when(s).then(function(e){if(e){i&&(e=d(e)(t));var n=angular.element('<pre><code class="highlight" ng-non-bindable></code></pre>');a.append(n),o(function(){!function(e,n){var t=n.find("code"),a=e.split("\n"),i=(a=a.filter(function(e){return e.trim().length}))[0].match(/^\s*/)[0],s=new RegExp("^"+i);a=a.map(function(e){return e.replace(s,"").replace(/\s+$/,"")});var o=hljs.highlight(r.language||r.lang,a.join("\n"),!0);o.value=o.value.replace(/=<span class="hljs-value">""<\/span>/gi,"").replace("<head>","").replace("<head/>",""),t.append(o.value).addClass("highlight")}(e,n)},34,!1)}})}}}}e.$inject=["$timeout","$q","$interpolate"],angular.module("app.core").directive("hljs",e)}(),function(){"use strict";function e(s,o,e,t){var r=this;function n(){var a=r.selectedField.options&&!_.isEmpty(r.selectedField.options.extraOperators),i=r.selectedField.options&&!_.isEmpty(r.selectedField.options.excludedOperators);r.availableOperators=_.filter(r.operators,function(n){var e=!n.applyTo||_.includes(n.applyTo,r.selectedField.type);n.isExtra=a&&_.some(r.selectedField.options.extraOperators,function(e){return e===n.type});var t=_.includes(n.excludeFrom,r.selectedField.type)||i&&_.includes(r.selectedField.options.excludedOperators,n.type);if((e||n.isExtra)&&!t)return n})}function l(n){return e[n.model][n.action](n.params).$promise.then(function(e){if("autocomplete"!==r.selectedField.type)return e.rows;var n=r.searchText?_.filter(e.rows,function(e){e.displayValue="";for(var n=0;n<r.selectedField.options.searchFields.length;n++){var t=e[r.selectedField.options.searchFields[n]]||"";e.displayValue+=t+" "}return _.trimEnd(e.displayValue),_.includes(e.displayValue.toLowerCase(),r.searchText.toLowerCase())}):[];return o.when(n)}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:n.model.toUpperCase()+"."+n.action.toUpperCase(),msg:e.data?JSON.stringify(e.data.message):e.toString()})})}function a(){!r.value||_.isArray(r.value)&&_.isEmpty(r.value)?r.isValidCondition=!1:r.selectedOperator?r.selectedOperator&&"$between"===r.selectedOperator.type?r.isValidCondition=!(!r.endRangeValue||!r.isValidRange):r.isValidCondition=!0:r.isValidCondition=!1}function i(){"number"===r.selectedField.type?_.isNumber(r.endRangeValue)?r.isValidRange=Number(r.endRangeValue)>Number(r.value):r.isValidRange=!0:"date"===r.selectedField.type&&(r.maxDateRange=moment(r.endRangeValue).subtract(1,"day"),r.isValidRange=!0),a()}function d(){var e=m();r.options.conditions.push(e),p()}function c(){var e=m(),n=_.findIndex(r.options.conditions,"style");r.options.conditions.splice(n,1,e),p(),r.pendingCondition.style=null,r.pendingCondition=void 0}function m(){return{name:r.selectedField.name,operator:s.instant("DASHBOARDS."+r.selectedOperator.translate),value:r.value,endValue:r.endRangeValue,displayValue:u(r.value),displayEndValue:u(r.endRangeValue),query:{column:r.selectedField.column,operator:r.selectedOperator.type,value:function(){var e,n=r.value,t=r.endRangeValue;switch(r.selectedField.type){case"date":var a=moment(n).utcOffset(0,!0).format("YYYY-MM-DD");if("$between"===r.selectedOperator.type){var i=moment(t).utcOffset(0,!0).format("YYYY-MM-DD");e=[a,i]}else e=a;break;case"number":e="$between"===r.selectedOperator.type?[n,t]:n;break;case"multiselect":var s=r.selectedField.options.field||"name";e=_.map(n,s);break;case"select":e=n.id;break;case"autocomplete":e=r.selectedOperator.isExtra?n:n.id;break;default:e=n}return e}()},disabled:!1}}function u(e){var n;if(e){switch(r.selectedField.type){case"date":n=moment(e).format("YYYY-MM-DD");break;case"multiselect":var t=_.map(e,function(e){return e.name});n="$eq"===r.selectedOperator.type?t.join(" or "):t.join(" and ");break;case"select":n=e.name;break;case"autocomplete":n=r.selectedOperator.isExtra?e:e.displayValue;break;default:n=e}return n}}function p(){r.value=null,r.endRangeValue=null,r.minDateRange=null,r.maxDateRange=null,r.isValidCondition=!1}r.operators=r.availableOperators=[{type:"$eq",symbol:"=",translate:"EQUALS",excludeFrom:["multiselect"]},{type:"$ne",symbol:"≠",translate:"IS_NOT_EQUAL",excludeFrom:["multiselect"]},{type:"$in",symbol:"∈",translate:"IS_AMONG",applyTo:["multiselect"]},{type:"$notIn",symbol:"∉",translate:"IS_NOT_AMONG",applyTo:["multiselect"]},{type:"$substring",symbol:"⊃",translate:"CONTAINS",applyTo:["text"]},{type:"$startsWith",symbol:"a..",translate:"STARTS_WITH",applyTo:["text"]},{type:"$endsWith",symbol:"..a",translate:"ENDS_WITH",applyTo:["text"]},{type:"$lt",symbol:"<",translate:"IS_LESS_THAN",applyTo:["date","number"]},{type:"$gt",symbol:">",translate:"IS_GREATER_THAN",applyTo:["date","number"]},{type:"$lte",symbol:"≤",translate:"IS_LESS_THAN_OR_EQUAL_TO",applyTo:["date","number"]},{type:"$gte",symbol:"≥",translate:"IS_GREATER_THAN_OR_EQUAL_TO",applyTo:["date","number"]},{type:"$between",symbol:"≬",translate:"IS_BETWEEN",applyTo:["date","number"]}],r.addCondition=d,r.editCondition=function(e){r.pendingCondition=e,r.pendingCondition.style="md-amber-200-bg",r.selectedField=_.find(r.options.fields,["name",r.pendingCondition.name]),n(),r.selectedOperator=_.find(r.availableOperators,["type",r.pendingCondition.query.operator]),"date"===r.selectedField.type&&"string"==typeof r.pendingCondition.value?(r.value=new Date(r.pendingCondition.value),r.minDateRange=moment(r.value).add(1,"day"),r.endRangeValue=r.pendingCondition.endValue?new Date(r.pendingCondition.endValue):void 0):(r.value=r.pendingCondition.value,r.endRangeValue=r.pendingCondition.endValue);r.isValidRange=!0,r.isValidCondition=!0},r.updateCondition=c,r.cancelUpdateCondition=function(){r.pendingCondition.style=null,r.pendingCondition=void 0},r.setConditionStatus=function(e){e.style=e.disabled?void 0:"chip-disabled",e.disabled=!e.disabled},r.removeCondition=function(){_.isEmpty(r.options.conditions)&&r.clearFilter()},r.getValues=function(){{if(r.selectedField.options.routes&&Array.isArray(r.selectedField.options.routes)){var e=angular.copy(r.selectedField.options.routes),n=_.map(e,function(e){return l(e)});return o.all(n).then(function(e){r.selectedField.values=_.flatten(e)})}var t=angular.copy(r.selectedField.options.route);if("autocomplete"===r.selectedField.type)for(var a=0;a<Object.keys(t.params).length;a++){var i=Object.keys(t.params)[a];"@autocomplete"===t.params[i]&&(t.params[i]=r.searchText)}if(!r.selectedField.values)return l(t).then(function(e){r.selectedField.values=_.flatten(e)});r.selectedField.values.forEach(function(e){e.translate&&(e.name=s.instant(e.translate))})}},r.onFieldChange=function(){r.value=void 0,r.endRangeValue=void 0,r.searchText=void 0,r.isValidCondition=!1,n(),r.autoSelectOperator=1===r.availableOperators.length,r.autoSelectOperator||(r.selectedOperator=void 0)},r.onOperatorChange=function(e){r.isValidRange=!0,r.selectedOperator&&(e?e.applyTo?0<_.difference(r.selectedOperator.applyTo,e.applyTo).length&&(r.value=null):r.selectedOperator.applyTo&&(r.value=null):r.value||(r.value=null),"between"!=r.selectedOperator.type&&(r.endRangeValue=null),r.selectedField.options&&!_.isEmpty(r.selectedField.options.extraOperators)&&(r.selectedOperator.isExtra=_.some(r.selectedField.options.extraOperators,function(e){return e===r.selectedOperator.type})));a()},r.onValueChange=function(){r.selectedOperator&&"$between"===r.selectedOperator.type?"number"===r.selectedField.type?i():"date"===r.selectedField.type&&(r.minDateRange=moment(r.value).add(1,"day"),a()):a()},r.checkRange=i,r.handleKeyboardAction=function(){r.pendingCondition?c():d()}}e.$inject=["$translate","$q","api","toasty"],angular.module("app.core").directive("msAdvancedSearch",function(){return{restrict:"E",scope:{options:"=",clearFilter:"&"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-advanced-search/ms-advanced-search.html"}})}(),function(){"use strict";angular.module("app.core").directive("msCard",function(){return{restrict:"E",scope:{templatePath:"=template",card:"=ngModel",vm:"=viewModel"},template:'<div class="ms-card-content-wrapper" ng-include="templatePath" onload="cardTemplateLoaded()"></div>',compile:function(e){return e.addClass("ms-card"),function(e,n){e.cardTemplateLoaded=function(){e.$emit("msCard::cardTemplateLoaded",n)}}}}})}(),function(){"use strict";angular.module("app.core").directive("msChipColor",function(){return{restrict:"A",link:function(e,i,n){n.$observe("msChipColor",function(e){var n=i.parent().parent();if(n.hasClass("md-background-bg md-hue-3")||n.addClass("md-background-bg md-hue-3"),_.isEmpty(e)){var t=n[0].className.split(" "),a=t.indexOf("md-hue-3");t.length=a+1,n[0].className=t.join(" ")}else n.addClass(e)})}}})}(),function(){"use strict";angular.module("app.core").directive("msClickToCall",function(){return{restrict:"E",scope:{type:"=",disabled:"=",target:"=",prefix:"=",license:"="},controller:["$scope","$rootScope","$http","$translate","$document","$mdDialog","Auth","toasty","api",function(t,n,a,i,s,o,e,r,l){function d(e){switch(t.currentUser.showWebBar){case 0:return m("http://127.0.0.1:"+(t.currentUser.phoneBarRemoteControlPort||"9888")+"/api/originate/"+c(e));case 2:return n.$broadcast("webrtc::call",{target:c(e)})}}function c(e){return _.isNil(e)?"":e.replace(/[^\w.+#*\-]+/g,"")}function m(e){return a.get(e).success(function(){r.success({title:"Successful call",msg:"Call properly handled!"})}).error(function(e){r.error({title:"PhoneBar API Error",msg:i.instant("CONTACTMANAGER.ERRORS.PHONEBAR_API")})})}t.currentUser=e.getCurrentUser(),t.privacy=t.currentUser.privacyEnabled,t.showMenu=function(){return t.target&&t.target.indexOf("@")<0&&t.target!=t.currentUser.internal&&t.target!=t.currentUser.name&&(0==t.currentUser.showWebBar&&t.currentUser.phoneBarRemoteControl||2==t.currentUser.showWebBar&&t.license.webrtc)&&!t.disabled},t.call=function(e){return 2!==t.currentUser.showWebBar?(n=e,l.user.getVoicePrefixes({id:t.currentUser.id}).$promise.then(function(e){if(e.count)return o.show({controller:"PrefixDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/prefix/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!0,locals:{prefixes:e,required:t.currentUser.phoneBarPrefixRequired}})}).then(function(e){t.currentUser.phoneBarPrefixRequired?e&&-1!==e&&d(e+n):e&&-1!==e?d(e+n):e||d(n)})):d(e);var n},t.transfer=function(e){switch(t.currentUser.showWebBar){case 0:return m("http://127.0.0.1:"+(t.currentUser.phoneBarRemoteControlPort||"9888")+"/api/transfer?number="+c(e));case 2:n.$broadcast("webrtc::transfer",{target:c(e)})}}}],templateUrl:"app/core/directives/ms-click-to-call/ms-click-to-call.html"}})}(),function(){"use strict";n.$inject=["ClientSideLoggingService","$rootScope","$translate"];var e={bindings:{user:"<"},controller:n,controllerAs:"vm",templateUrl:"app/core/directives/ms-client-side-logging/ms-client-side-logging-icon.html"};function n(e,n,t){var a=this,i=e.getLoggingColors();function s(){a.tooltipHTML=a.user.userSetting.clientSideLoggingEnabled?[t.instant("STAFF.CLIENT_LOGS_ENABLED"),t.instant("STAFF.CLIENT_LOGS_LOGLEVEL",{logLevel:a.user.userSetting.clientSideLoggingLevel}),t.instant("STAFF.CLIENT_LOGS_ENABLED_SINCE",{enabledSince:moment(a.user.userSetting.clientSideLoggingEnabledSince).format("LLLL")})].join("<br>"):t.instant("STAFF.CLIENT_LOGS_DISABLED")}a.tooltipHTML=t.instant("STAFF.CLIENT_LOGS_DISABLED"),a.styleColor=i.disabled,a.styleIcon=a.user.userSetting&&a.user.userSetting.clientSideLoggingEnabled?"icon-checkbox-marked-circle":"icon-close",a.$onInit=function(){if(!a.user.userSetting)return;var e=a.user.userSetting.clientSideLoggingEnabled?a.user.userSetting.clientSideLoggingLevel:"disabled";a.styleColor=i[e],"info"===e&&(a.styleIcon="icon-checkbox-marked-circle-outline");return s()},a.$onDestroy=function(){o()};var o=n.$on("$translateChangeSuccess",s)}angular.module("app.core").component("msClientSideLoggingIcon",e)}(),function(){"use strict";n.$inject=["ClientSideLoggingService","UserSettingService","$q","$translate","$rootScope","$interval"];var e={bindings:{user:"<",onUserUpdate:"&"},controller:n,controllerAs:"vm",templateUrl:"app/core/directives/ms-client-side-logging/ms-client-side-logging.html"};function n(e,t,n,a,i,s){var o=this,r=e.getLoggingColors(),l=null;function d(){l&&s.cancel(l)}o.styleProperties=r.disabled,o.clientSideLoggingEnabledSince="",o.$onInit=function(){m().then(function(){d(),l=s(u,6e4)})},o.$onChanges=function(e){e&&n.resolve().then(m)},o.$onDestroy=function(){d(),c()},o.onEnabledSwitchChange=function(){var e=o.user.userSetting.clientSideLoggingEnabled,n=o.user.userSetting.clientSideLoggingLevel;return p(e,n)},o.onLogLevelSelectionChange=function(){var e=o.user.userSetting.clientSideLoggingEnabled,n=o.user.userSetting.clientSideLoggingLevel;p(e,n)},o.computeStyleForLoggingLevel=function(e){return r[e]};var c=i.$on("$translateChangeSuccess",u);function m(){o.availableClientSideLoggingLevels=Object.keys(r).filter(function(e){return"disabled"!==e});var e=o.user.userSetting&&o.user.userSetting.clientSideLoggingEnabled?o.user.userSetting.clientSideLoggingLevel:"disabled";return o.styleProperties=r[e],u()}function u(){if(o.user.userSetting)return o.user.userSetting.clientSideLoggingEnabled?void(o.clientSideLoggingEnabledSince=a.instant("STAFF.CLIENT_LOGS_ENABLED_SINCE",{enabledSince:moment(moment(o.user.userSetting.clientSideLoggingEnabledSince).format()).fromNow()})):o.clientSideLoggingEnabledSince=""}function p(e,n){return t.updateUserSettingById(o.user.userSetting.id,{clientSideLoggingEnabled:e,clientSideLoggingLevel:n}).then(function(){"function"==typeof o.onUserUpdate&&o.onUserUpdate()})}}angular.module("app.core").component("msClientSideLogging",e)}(),function(){"use strict";function e(i){return{require:"ngModel",priority:1,link:function(e,n,t,a){a.$formatters.push(i.formatter),a.$parsers.push(i.parser)}}}e.$inject=["msDatepickerFixConfig"],angular.module("app.core").provider("msDatepickerFixConfig",function(){var n={formatter:function(e){return e?""===e?e:new Date(e):""},parser:function(e){return e?moment(e).add(moment(e).utcOffset(),"m").toDate():""}};this.config=function(e){n=angular.extend({},n,e)},this.$get=function(){return n}}).directive("msDatepickerFix",e)}(),function(){"use strict";function e(s){return{restrict:"E",scope:{id:"=",model:"=",element:"=",title:"=",path:"="},replace:!0,link:function(n,e){var t=!1,a={};a.id=n.id,_.isNil(n.path)||(a.path=n.path);var i=document.createElement(n.element);i.setAttribute("preload","none"),i.setAttribute("controls","true"),"audio"===n.element&&i.setAttribute("style","width: 265px;"),"video"===n.element&&i.setAttribute("style","max-width: 500px;"),i.setAttribute("title",n.title),i.setAttribute("src"," "),i.onplay=function(e){t||(t=!0,e.preventDefault(),s[n.model].download(a).$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type});i.setAttribute("type",e.type),i.setAttribute("src",URL.createObjectURL(t)),i.play()}).catch(function(e){console.error(e)}))},e.append(i)}}}e.$inject=["api"],angular.module("app.core").directive("msDialogRecording",e)}(),function(){"use strict";function e(i){return{restrict:"A",link:function(t,a){a.bind("click",function(e){var n=i('<div layout="row" class="spinner-overlay" layout-sm="column" layout-align="center center" aria-label="wait"><md-progress-circular md-mode="indeterminate"></md-progress-circular></div>')(t);a.closest("md-dialog").prepend(n)})}}}e.$inject=["$compile"],angular.module("app.core").directive("msDialogSpinner",e)}(),function(){"use strict";function e(){var o=this;function a(e,n,t,a){var i=[];if(0<=t)i.push(e[t]),n.push(e[t]),e.splice(t,1);else{for(var s=0;s<e.length;s++)void 0!==e[s].isValid&&e[s].isValid&&n.push(e[s]);for(s=e.length-1;0<=s;s--)e[s].isValid&&e.splice(s,1);i=n}o.options.transferCallback&&o.options.transferCallback(i,a)}o.canTransfer=function(e,n,t){if(void 0!==e.isValid&&e.isValid)return t?a(n.selectedItems,n.items,n.selectedItems.indexOf(e),t):a(n.items,n.selectedItems,n.items.indexOf(e),t)},o.transfer=a,o.getLine=function(e,n){var t="";if(_.isNil(n))return t;{if(_.isArray(n)){for(var a=0;a<n.length;a++)t+=" "+(e[n[a]]?e[n[a]]:"");return t}return e[n]?e[n]:""}}}angular.module("app.core").directive("msDualMultiselect",function(){return{restrict:"E",scope:{options:"=",readOnly:"=",addDisabled:"<"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-dual-multiselect/ms-dual-multiselect.html"}})}(),function(){"use strict";function e(a){return{restrict:"E",replace:!0,scope:{onReply:"&",ngModel:"=",ctrlMethods:"=",pickerPosition:"=",search:"=",recentEmojis:"=",placeholder:"="},template:'<textarea class="emojionearea"></textarea>',link:function(t,e){var n=e.emojioneArea({pickerPosition:t.pickerPosition,search:t.search,recentEmojis:t.recentEmojis,placeholder:a.instant(t.placeholder||"Type a message"),attributes:{spellcheck:!0},events:{keyup:function(e,n){t.ngModel=this.getText(),t.onReply({event:n,body:this.getText()})},emojibtn_click:function(){t.ngModel=this.getText()}}});t.ngModel&&n[0].emojioneArea.setText(t.ngModel),t.internalControl=t.ctrlMethods||{},t.internalControl.setText=function(e){n[0].emojioneArea.setText(e)},t.internalControl.getText=function(){return n[0].emojioneArea.getText()},t.$watch("ngModel",function(e){e||n[0].emojioneArea.setText("")})}}}e.$inject=["$translate"],angular.module("app.core").directive("msEmojiArea",e)}(),function(){"use strict";angular.module("app.core").directive("msFontFamily",function(){return{restrict:"E",scope:{ngModel:"="},controller:["$scope",function(e){e.fonts=[{option:"Arial",value:"Arial,Helvetica,sans-serif"},{option:"Century Gothic",value:"Century Gothic,Futura,Didact Gothic,san-serif"},{option:"Calibri",value:"Calibri, Verdana, Geneva, sans-serif"},{option:"Comic Sans MS",value:"Comic Sans MS,cursive"},{option:"Courier New",value:"Courier New,Courier,monospace"},{option:"Georgia",value:"Georgia,serif"},{option:"Lucida Sans Unicode",value:"Lucida Sans Unicode,Lucida Grande,sans-serif"},{option:"Tahoma",value:"Tahoma,Geneva,sans-serif"},{option:"Times New Roman",value:"Times New Roman,Times,serif"},{option:"Trebuchet MS",value:"Trebuchet MS,Helvetica,sans-serif"},{option:"Verdana",value:"Verdana,Geneva,sans-serif"}]}],templateUrl:"app/core/directives/ms-font-family/ms-font-family.html"}})}(),function(){"use strict";angular.module("app.core").controller("MsFormWizardController",function(){var n=this;function e(){return n.forms.length}function t(){return 0===n.selectedIndex}function a(){return n.selectedIndex===e()-1}n.forms=[],n.selectedIndex=0,n.registerForm=function(e){n.forms.push(e)},n.previousStep=function(){if(t())return;n.selectedIndex--},n.nextStep=function(){if(a())return;n.selectedIndex++},n.firstStep=function(){n.selectedIndex=0},n.lastStep=function(){n.selectedIndex=e()-1},n.totalSteps=e,n.isFirstStep=t,n.isLastStep=a,n.currentStepInvalid=function(){return angular.isDefined(n.forms[n.selectedIndex])&&n.forms[n.selectedIndex].$invalid},n.previousStepInvalid=function(){return 0<n.selectedIndex&&angular.isDefined(n.forms[n.selectedIndex-1])&&n.forms[n.selectedIndex-1].$invalid},n.formsIncomplete=function(){for(var e=0;e<n.forms.length;e++)if(n.forms[e].$invalid)return!0;return!1},n.resetForm=function(){for(var e=n.selectedIndex=0;e<n.forms.length;e++)n.forms[e].$setPristine(),n.forms[e].$setUntouched()}}).directive("msFormWizard",function(){return{restrict:"E",scope:!0,controller:"MsFormWizardController as msWizard",compile:function(e){return e.addClass("ms-form-wizard"),function(){}}}}).directive("msFormWizardForm",function(){return{restrict:"A",require:["form","^msFormWizard"],compile:function(e){return e.addClass("ms-form-wizard-form"),function(e,n,t,a){var i=a[0],s=a[1];s.registerForm(i)}}}})}(),function(){"use strict";function e(i){return{restrict:"E",scope:{onClose:"&"},transclude:!0,templateUrl:"app/core/directives/ms-info-bar/ms-info-bar.html",link:function(e,n){var t=i.find("ms-info-bar-active"),a="ms-info-bar-active";t.addClass(a),e.removeInfoBar=function(){t.removeClass(a),n.remove(),e.onClose&&e.onClose(),e.$destroy()}}}}e.$inject=["$document"],angular.module("app.core").directive("msInfoBar",e)}(),function(){"use strict";function e(r,a,l,e){var d=this,n={columnCount:5,respectItemOrder:!1,reLayoutDebounce:400,responsive:{md:3,sm:2,xs:1}},t=!0;function i(){t&&e.cancel(t),t=e(function(){!function(){d.containerPos=d.container[0].getBoundingClientRect(),function(){d.columnCount=d.options.columnCount,l("gt-md")?d.columnCount=d.options.columnCount:l("md")?d.columnCount=d.columnCount>d.options.responsive.md?d.options.responsive.md:d.columnCount:l("sm")?d.columnCount=d.columnCount>d.options.responsive.sm?d.options.responsive.sm:d.columnCount:d.columnCount=d.options.responsive.xs;d.columnWidth=d.containerPos.width/d.columnCount}(),r.$broadcast("msMasonry:relayoutStarted"),d.items=d.container.find("ms-masonry-item");for(var e=Array.apply(null,new Array(d.columnCount)).map(function(){return 0}),n=0;n<d.items.length;n++){var t,a,i,s,o=d.items[n];(o=angular.element(o)).scope()&&o.scope().$broadcast("msMasonryItem:startReLayout"),o.css({width:d.columnWidth}),d.options.respectItemOrder?(i=n%d.columnCount,s=e[i]):(s=Math.min.apply(Math,e),i=e.indexOf(s)),e[i]=s+o[0].getBoundingClientRect().height,t=Math.round(i*d.columnWidth),a=s,o.css({transform:"translate3d("+t+"px,"+a+"px,0px)"}),o.addClass("placed"),o.scope()&&o.scope().$broadcast("msMasonryItem:finishReLayout")}}(),r.$broadcast("msMasonry:relayoutFinished")},d.options.reLayoutDebounce)}d.options=null,d.container=[],d.containerPos="",d.columnWidth="",d.items=[],d.reLayout=i,d.initialize=function(){d.options=d.options?angular.extend(n,d.options):n,r.$watch(function(){return d.container.width()},function(e,n){e!==n&&i()})},d.waitImagesLoaded=function(e,n){if("undefined"!=typeof imagesLoaded){var t=a.imagesLoaded(e);t.on("done",function(){n()})}else n()},r.$on("msMasonry:relayout",function(){i()})}function n(o){return{restrict:"AEC",controller:"msMasonryController",compile:function(i,s){return{pre:function(e,n,t,a){a.options=angular.fromJson(s.options||"{}"),a.container=i},post:function(e,n,t,a){o(function(){a.initialize()})}}}}}e.$inject=["$scope","$window","$mdMedia","$timeout"],n.$inject=["$timeout"],angular.module("app.core").controller("msMasonryController",e).directive("msMasonry",n).directive("msMasonryItem",function(){return{restrict:"AEC",require:"^msMasonry",priority:1,link:function(e,n,t,a){a.waitImagesLoaded(n,function(){a.reLayout()}),e.$on("msMasonryItem:finishReLayout",function(){e.$watch(function(){return n.height()},function(e,n){e!==n&&a.reLayout()})}),n.on("$destroy",function(){a.reLayout()})}}})}(),function(){"use strict";function e(t,e,a,i){var s=this;function o(e,n){s.selectedPalette=e,s.selectedHues=n}function r(){o(!(s.selectedColor={palette:"",hue:"",class:""}),!1),d()}function l(e,n){s.selectedColor={palette:e,hue:n,class:"md-"+e+"-"+n+"-bg",bgColorValue:i.rgba(s.palettes[e][n].value),fgColorValue:i.rgba(s.palettes[e][n].contrast)},"obj"!==s.msModelType||angular.equals(s.selectedColor,s.modelCtrl.$viewValue)||d(),o(e,s.palettes[e]),t.$selectedColor=s.selectedColor}function d(){"class"===s.msModelType?s.modelCtrl.$setViewValue(s.selectedColor.class):"obj"===s.msModelType&&s.modelCtrl.$setViewValue(s.selectedColor)}s.palettes=e,s.selectedPalette=!1,s.selectedHues=!1,t.$selectedColor={},s.activateHueSelection=o,s.selectColor=function(e,n){l(e,n),d(),a.hide()},s.removeColor=r,t.$watch("ngModel",function(){if(!s.modelCtrl.$viewValue||""===s.modelCtrl.$viewValue)return void r();var e,n;if("class"===s.msModelType){var t=s.modelCtrl.$viewValue.split("-");n=5<=t.length?(e=t[1]+"-"+t[2],t[3]):(e=t[1],t[2])}else"obj"===s.msModelType&&(e=s.modelCtrl.$viewValue.palette,n=s.modelCtrl.$viewValue.hue||500);l(e,n)})}e.$inject=["$scope","$mdColorPalette","$mdMenu","motionGenerator"],angular.module("app.core").controller("msMaterialColorPickerController",e).directive("msMaterialColorPicker",function(){return{require:["msMaterialColorPicker","ngModel"],restrict:"E",scope:{ngModel:"=",msModelType:"@?"},controller:"msMaterialColorPickerController as vm",transclude:!0,templateUrl:"app/core/directives/ms-material-color-picker/ms-material-color-picker.html",link:function(e,n,t,a,i){var s=a[0];s.modelCtrl=a[1],s.msModelType=e.msModelType||"class",i(e,function(e){(e=e.filter(function(e,n){return 1===n.nodeType})).length&&n.find("ms-color-picker-button").replaceWith(e)})}}})}(),function(){"use strict";function e(p,g,v){return{restrict:"A",link:function(e,n,t){var a="true"===t.msNavIsFolded,i=!1,s=angular.element(p[0].body),o=angular.element('<div id="ms-nav-fold-open-overlay"></div>'),r=angular.element('<div id="ms-nav-fold-close-overlay"></div>'),l=n.parent();function d(){s.addClass("ms-nav-folded"),g.$broadcast("msNav::forceCollapse"),n.scrollTop(0),l.append(o),o.on("mouseenter touchstart",function(e){c(e),i=!0})}function c(e){angular.isDefined(e)&&e.preventDefault(),s.addClass("ms-nav-folded-open"),g.$broadcast("msNav::expandMatchingToggles"),l.find(o).remove(),l.parent().append(r),r.on("mouseenter touchstart",function(e){m(e),i=!1})}function m(e){angular.isDefined(e)&&e.preventDefault(),g.$broadcast("msNav::forceCollapse"),n.scrollTop(0),s.removeClass("ms-nav-folded-open"),l.parent().find(r).remove(),l.append(o),o.on("mouseenter touchstart",function(e){c(e),i=!0})}function u(){s.removeClass("ms-nav-folded ms-nav-folded-open"),g.$broadcast("msNav::expandMatchingToggles"),n.off("mouseenter mouseleave")}v.setFoldable(e,n,a),a?d():u(),e.toggleFold=function(){(a=!a)?d():u()},e.openFolded=c,e.closeFolded=m,e.isNavFoldedOpen=function(){return i},e.$on("$destroy",function(){o.off("mouseenter touchstart"),r.off("mouseenter touchstart"),n.off("mouseenter mouseleave")})}}}function n(t,a,i){return{restrict:"E",scope:{},controller:"MsNavController",compile:function(e){return e.addClass("ms-nav"),function(e){t.$broadcast("msNav::expandMatchingToggles");var n=t.$on("$stateChangeSuccess",function(){t.$broadcast("msNav::expandMatchingToggles"),a.when("navigation").then(function(e){e.close(),i.isNavFoldedOpen()&&i.closeFolded()})});e.$on("$destroy",function(){n()})}}}}function t(m,u,p,g){return{restrict:"A",require:"^msNav",scope:!0,compile:function(e,n){return e.addClass("ms-nav-toggle"),angular.isUndefined(n.collapsed)&&(n.collapsed=!0),e.attr("collapsed",n.collapsed),function(a,i,e,t){var s={expanded:"expanded",expandAnimation:"expand-animation",collapseAnimation:"collapse-animation"},n=i.find("a"),o=[],r=/\(.*\)/g;function l(){return"true"===i.attr("collapsed")}function d(){var e=u.defer();if(!l())return e.reject({error:!0}),e.promise;i.attr("collapsed",!1);var n=angular.element(i.find("ms-nav-toggle-items")[0]);n.css({position:"absolute",visibility:"hidden",display:"block",height:"auto"});var t=n[0].offsetHeight;return n.css({position:"",visibility:"",display:"",height:""}),a.$evalAsync(function(){p.animate(n,{display:"block",height:"0px"},{height:t+"px"},s.expandAnimation).then(function(){n.addClass(s.expanded),n.css({height:""}),e.resolve({success:!0})})}),e.promise}function c(){var e=u.defer();if(l())return e.reject({error:!0}),e.promise;i.attr("collapsed",!0);var n=angular.element(i.find("ms-nav-toggle-items")[0]),t=n[0].offsetHeight;return a.$evalAsync(function(){p.animate(n,{height:t+"px"},{height:"0px"},s.collapseAnimation).then(function(){n.removeClass(s.expanded),n.css({display:"",height:""}),e.resolve({success:!0})})}),e.promise}angular.forEach(n,function(e){var n=angular.element(e).attr("ui-sref");angular.isUndefined(n)||(n=n.replace(r,""),o.push(n))}),t.setToggleItem(i,a),i.children(".ms-nav-button").on("click",function(){if(t.isDisabled())return;t.disable(),l()?(t.clearLockedItems(),a.$emit("msNav::pushToLockedList"),m.$broadcast("msNav::collapse"),d().then(function(){t.enable()})):a.$broadcast("msNav::forceCollapse")}),a.$on("$destroy",function(){i.children(".ms-nav-button").off("click")}),a.$on("msNav::collapse",function(){var e=t.getLockedItems(),n=!1;angular.forEach(e,function(e){angular.equals(e.scope,a)&&(n=!0)}),n||c().then(function(){t.enable()})}),a.$on("msNav::forceCollapse",function(){c().then(function(){t.enable()})}),a.$on("msNav::expandMatchingToggles",function(){var n=g.current.name,t=!1;angular.forEach(o,function(e){n===e&&(t=!0)}),t?d():c()}),a.$on("msNav::pushToLockedList",function(){t.setLockedItem(i,a)})}}}}e.$inject=["$document","$rootScope","msNavFoldService"],n.$inject=["$rootScope","$mdComponentRegistry","msNavFoldService"],t.$inject=["$rootScope","$q","$animate","$state"],angular.module("app.core").factory("msNavFoldService",function(){var t={};return{setFoldable:function(e,n){t={scope:e,element:n}},isNavFoldedOpen:function(){return t.scope.isNavFoldedOpen()},toggleFold:function(){t.scope.toggleFold()},openFolded:function(){t.scope.openFolded()},closeFolded:function(){t.scope.closeFolded()}}}).directive("msNavIsFolded",e).controller("MsNavController",function(){var e=this,n=!1,t=[],a=[];e.isDisabled=function(){return n},e.enable=function(){n=!1},e.disable=function(){n=!0},e.setToggleItem=function(e,n){t.push({element:e,scope:n})},e.getLockedItems=function(){return a},e.setLockedItem=function(e,n){a.push({element:e,scope:n})},e.clearLockedItems=function(){a=[]}}).directive("msNav",n).directive("msNavTitle",function(){return{restrict:"A",compile:function(e){return e.addClass("ms-nav-title"),function(){}}}}).directive("msNavButton",function(){return{restrict:"AE",compile:function(e){return e.addClass("ms-nav-button"),function(){}}}}).directive("msNavToggle",t)}(),function(){"use strict";function e(e,n){e.root?this.navigation=n.getNavigation(e.root):this.navigation=n.getNavigation(),this.toggleHorizontalMobileMenu=function(){angular.element("body").toggleClass("ms-navigation-horizontal-mobile-menu-active")},n.sort()}function n(c,m,u,p){return{restrict:"E",scope:{folded:"=",root:"@"},controller:"MsNavigationController as vm",templateUrl:"app/core/directives/ms-navigation/templates/vertical.html",transclude:!0,compile:function(e){return e.addClass("ms-navigation"),function(e,n){var t=angular.element("body"),a=angular.element('<div id="ms-navigation-fold-expander"></div>'),i=angular.element('<div id="ms-navigation-fold-collapser"></div>'),s=u("navigation");function o(e){if(p.setFolded(e),e)c.$broadcast("msNavigation::collapse"),t.addClass("ms-navigation-folded"),r();else{var n=p.getActiveItem();n&&n.scope.$emit("msNavigation::stateMatched"),t.removeClass("ms-navigation-folded ms-navigation-folded-open"),i.remove()}}function r(){n.parent().append(a),m(function(){a.on("mouseenter touchstart",l)})}function l(e){e&&e.preventDefault(),p.setFoldedOpen(!0);var n=p.getActiveItem();n&&n.scope.$emit("msNavigation::stateMatched"),t.addClass("ms-navigation-folded-open"),a.remove(),t.find("#main").append(i),i.on("mouseenter touchstart",d)}function d(e){e&&e.preventDefault(),p.setFoldedOpen(!1),c.$broadcast("msNavigation::collapse"),t.removeClass("ms-navigation-folded-open"),i.remove(),r()}p.setNavigationScope(e),function(){null===p.getFolded()&&p.setFolded(e.folded);p.getFolded()&&(m(function(){c.$broadcast("msNavigation::collapse")}),t.addClass("ms-navigation-folded"),r())}(),e.$watch(function(){return s.isLockedOpen()},function(e,n){if(!angular.isUndefined(e)&&!angular.equals(e,n)&&p.getFolded())if(e)c.$broadcast("msNavigation::collapse");else{var t=p.getActiveItem();t&&t.scope.$emit("msNavigation::stateMatched")}}),e.$watch("folded",function(e,n){angular.isUndefined(e)||angular.equals(e,n)||o(e)}),e.toggleFolded=function(){o(!p.getFolded())},e.$on("$stateChangeStart",function(){s.close()}),e.$on("$destroy",function(){i.off("mouseenter touchstart"),a.off("mouseenter touchstart")})}}}}function t(t,e,a,i,n,s){var o=this;o.element=e,o.node=t.node,o.hasChildren=void 0,o.collapsed=void 0,o.collapsable=void 0,o.group=void 0,o.animateHeightClass="animate-height",o.toggleCollapsed=function(){o.collapsed?o.expand():o.collapse()},o.collapse=function(){var e=o.element.children("ul"),n=e[0].offsetHeight;t.$evalAsync(function(){o.collapsed=!0,o.element.addClass("collapsing"),i.animate(e,{display:"block",height:n+"px"},{height:"0px"},o.animateHeightClass).then(function(){e.css({display:"",height:""}),o.element.removeClass("collapsing")}),t.$broadcast("msNavigation::collapse")})},o.expand=function(){var e=o.element.children("ul");e.css({position:"absolute",visibility:"hidden",display:"block",height:"auto"});var n=e[0].offsetHeight;e.css({position:"",visibility:"",display:"",height:""}),t.$evalAsync(function(){o.collapsed=!1,o.element.addClass("expanding"),i.animate(e,{display:"block",height:"0px"},{height:n+"px"},o.animateHeightClass).then(function(){e.css({height:""}),o.element.removeClass("expanding")}),a.$broadcast("msNavigation::collapse",o.node._path)})},o.getClass=function(){return o.node.class},o.isHidden=function(){if(angular.isDefined(o.node.hidden)&&angular.isFunction(o.node.hidden))return o.node.hidden();return!1},function(){o.hasChildren=0<o.node.children.length,o.group=!(!angular.isDefined(o.node.group)||!0!==o.node.group),!o.hasChildren||o.group?o.collapsable=!1:o.collapsable=!(!angular.isUndefined(o.node.collapsable)&&"boolean"==typeof o.node.collapsable&&!0!==o.node.collapsable);o.collapsable?o.collapsed=!(!angular.isUndefined(o.node.collapsed)&&"boolean"==typeof o.node.collapsed&&!0!==o.node.collapsed):o.collapsed=!1;if(o.node.state===n.current.name||n.includes(o.node.state)){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(n.params)&&!angular.equals(o.node.stateParams,n.params))return;t.$emit("msNavigation::stateMatched"),s.setActiveItem(o.node,t)}t.$on("msNavigation::stateMatched",function(){o.collapsable&&o.collapsed&&t.$evalAsync(function(){o.collapsed=!1})}),t.$on("msNavigation::collapse",function(e,n){if(!o.collapsed&&o.collapsable)if(angular.isUndefined(n))o.collapse();else{var t=n.split("."),a=[],i=s.getActiveItem();if(i&&(a=i.node._path.split(".")),-1<t.indexOf(o.node._id))return;if(-1<a.indexOf(o.node._id))return;o.collapse()}}),t.$on("$stateChangeSuccess",function(){if(o.node.state===n.current.name){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(n.params)&&!angular.equals(o.node.stateParams,n.params))return;s.setActiveItem(o.node,t),a.$broadcast("msNavigation::collapse",o.node._path)}if(n.includes(o.node.state)){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(n.params)&&!angular.equals(o.node.stateParams,n.params))return;t.$emit("msNavigation::stateMatched")}})}()}function a(n){return{restrict:"E",scope:{root:"@"},controller:"MsNavigationController as vm",templateUrl:"app/core/directives/ms-navigation/templates/horizontal.html",transclude:!0,compile:function(e){return e.addClass("ms-navigation-horizontal"),function(e){n.setNavigationScope(e)}}}}function i(t,e,n,a,i){var s=this;s.element=e,s.node=t.node,s.hasChildren=void 0,s.group=void 0,s.getClass=function(){return s.node.class},function(){if(s.isActive=!1,s.hasChildren=0<s.node.children.length,s.group=!(!angular.isDefined(s.node.group)||!0!==s.node.group),s.node.state===a.current.name||a.includes(s.node.state)){if(angular.isDefined(s.node.stateParams)&&angular.isDefined(a.params)&&!angular.equals(s.node.stateParams,a.params))return;t.$emit("msNavigation::stateMatched"),i.setActiveItem(s.node,t)}t.$on("msNavigation::stateMatched",function(){s.hasChildren&&t.$evalAsync(function(){s.isActive=!0})}),t.$on("msNavigation::clearActive",function(){if(s.hasChildren){var e=[],n=i.getActiveItem();n&&(e=n.node._path.split(".")),-1<e.indexOf(s.node._id)?t.$evalAsync(function(){s.isActive=!0}):t.$evalAsync(function(){s.isActive=!1})}}),t.$on("$stateChangeSuccess",function(){if(s.node.state===a.current.name||a.includes(s.node.state)){if(angular.isDefined(s.node.stateParams)&&angular.isDefined(a.params)&&!angular.equals(s.node.stateParams,a.params))return;i.setActiveItem(s.node,t),n.$broadcast("msNavigation::clearActive")}})}()}function s(i){return{restrict:"A",require:"^msNavigationHorizontalNode",compile:function(e){return e.addClass("ms-navigation-horizontal-item"),function(e,n,t,a){n.on("click",function(){if(!a.hasChildren||i("gt-md"))return;n.toggleClass("expanded")}),e.$on("$destroy",function(){n.off("click")})}}}}e.$inject=["$scope","msNavigationService"],n.$inject=["$rootScope","$timeout","$mdSidenav","msNavigationService"],t.$inject=["$scope","$element","$rootScope","$animate","$state","msNavigationService"],a.$inject=["msNavigationService"],i.$inject=["$scope","$element","$rootScope","$state","msNavigationService"],s.$inject=["$mdMedia"],angular.module("app.core").provider("msNavigationService",function(){var r=angular.injector(["ng"]).get("$log"),l=[];function d(e,n){if(angular.isString(e)){for(var t=e.split("."),a=t[t.length-1],i=function(e){var n=l;if(1===e.length)return n;e.pop();for(var t=0;t<e.length;t++){for(var a=e[t],i=!0,s=0;s<n.length;s++)if(n[s]._id===a){n=n[s].children,i=!1;break}if(i){var o={_id:a,_path:e.join("."),title:a,weight:1,children:[]};n.push(o),n=o.children}}return n}(t),s=!1,o=0;o<i.length;o++)if(i[o]._id===a){s=i[o];break}s?(angular.extend(s,n),s.uisref=u(s)):(n.children=[],!angular.isUndefined(n.weight)&&angular.isNumber(n.weight)||(n.weight=1),n._id=a,n._path=e,n.uisref=u(n),i.push(n))}else r.error("path must be a string (eg. `dashboard.project`)")}function c(e){if(angular.isString(e)){for(var n=l,t=e.split("."),a=0;a<t.length;a++)for(var i=t[a],s=0;s<n.length;s++)if(n[s]._id===i){if(n[s]._path===e)return n.splice(s,1),!0;n=n[s].children;break}return!1}r.error("path must be a string (eg. `dashboard.project`)")}function m(e){e||(e=l).sort(a);for(var n=0;n<e.length;n++){var t=e[n].children;1<t.length&&t.sort(a),0<t.length&&m(t)}}function a(e,n){return parseInt(e.weight)-parseInt(n.weight)}function u(e){var n="";return angular.isDefined(e.state)&&(n=e.state,angular.isDefined(e.stateParams)&&angular.isObject(e.stateParams)&&(n=n+"("+angular.toJson(e.stateParams)+")")),n}this.saveItem=d,this.deleteItem=c,this.sortByWeight=m,this.$get=function(){var t=null,n=null,a=null,i=null,e={saveItem:d,deleteItem:c,sort:m,clearNavigation:function(){l=[],n&&(n.vm.navigation=l)},setActiveItem:function(e,n){t={node:e,scope:n}},getActiveItem:function(){return t},getNavigation:s,getFlatNavigation:o,setNavigationScope:function(e){n=e},setFolded:function(e){a=e},getFolded:function(){return a},setFoldedOpen:function(e){i=e},getFoldedOpen:function(){return i},toggleFolded:function(){n.toggleFolded()},getSectionId:function(n,t){var e=o(),a=_.find(e,function(e){return t?e.route===n&&e.title.toLowerCase()===t.toLowerCase():e.route===n});return a?a.id:0}};return e;function s(e){if(e){for(var n=0;n<l.length;n++)if(l[n]._id===e)return[l[n]];return null}return l}function o(e){var n=s(e);return function e(n){var t=[];for(var a=0;a<n.length;a++){var i=angular.copy(n[a]);i.children=[],t.push(i),0<n[a].children.length&&(t=t.concat(e(n[a].children)))}return t}(n)}}}).controller("MsNavigationController",e).directive("msNavigation",n).controller("MsNavigationNodeController",t).directive("msNavigationNode",function(){return{restrict:"A",bindToController:{node:"=msNavigationNode"},controller:"MsNavigationNodeController as vm",compile:function(e){return e.addClass("ms-navigation-node"),function(e,n,t,a){n.addClass(a.getClass()),a.group&&n.addClass("group")}}}}).directive("msNavigationItem",function(){return{restrict:"A",require:"^msNavigationNode",compile:function(e){return e.addClass("ms-navigation-item"),function(e,n,t,a){a.collapsable&&n.on("click",a.toggleCollapsed),e.$on("$destroy",function(){n.off("click")})}}}}).directive("msNavigationHorizontal",a).controller("MsNavigationHorizontalNodeController",i).directive("msNavigationHorizontalNode",function(){return{restrict:"A",bindToController:{node:"=msNavigationHorizontalNode"},controller:"MsNavigationHorizontalNodeController as vm",compile:function(e){return e.addClass("ms-navigation-horizontal-node"),function(e,n,t,a){n.addClass(a.getClass()),a.group&&n.addClass("group")}}}}).directive("msNavigationHorizontalItem",s)}(),function(){"use strict";function e(p,t,g,e,a,i,n,u,s,o,v,h,f,b,r,A,l){var E=this,d=["ringingId","speakerId","microphoneId","ringingVolume","speakerVolume","microphoneVolume","ringingMute","speakerMute","microphoneMute"],c=JSON.parse(n.localStorage.getItem("motion2.user:"+E.conf.id))||{webrtc:{ringingVolume:.5,speakerVolume:.5,microphoneVolume:1,ringingMute:!1,speakerMute:!1,microphoneMute:!1}};e(function(){},999);var y=l.getLogger("jssip","ms-phonebar");function m(l){var d,c,m;return E.initDeviceInProgress=!0,navigator.mediaDevices.getUserMedia({audio:!0}).then(function(e){return E.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/silence.ogg"),E.soundPlayer.play().catch(function(e){y.error(e.message)}),e.getTracks().forEach(function(e){e.stop()}),navigator.mediaDevices.enumerateDevices()}).then(function(e){var n=_.filter(e,function(e){return"audioinput"===e.kind&&"default"!==e.deviceId&&"communications"!==e.deviceId});if(0<n.length){var t=_.find(e,function(e){return"default"===e.deviceId&&"audioinput"===e.kind});if(m=_.find(n,function(e){return e.groupId===t.groupId}),E.conf.microphoneId&&!l){var a=_.find(n,function(e){return e.deviceId===E.conf.microphoneId});a&&(m=a)}E.conf.microphoneId=m.deviceId}else v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_MICROPHONE_NOT_AVAILABLE"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"});E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0,x("microphone",!1);var i=_.filter(e,function(e){return"audiooutput"===e.kind&&"default"!==e.deviceId&&"communications"!==e.deviceId});if(0<i.length){var s=_.find(e,function(e){return"default"===e.deviceId&&"audiooutput"===e.kind});if(c=d=_.find(i,function(e){return e.groupId===s.groupId}),E.conf.speakerId&&!l){var o=_.find(i,function(e){return e.deviceId===E.conf.speakerId});o&&(c=o)}if(E.conf.speakerId=c.deviceId,E.conf.ringingId&&!l){var r=_.find(i,function(e){return e.deviceId===E.conf.ringingId});r&&(d=r)}E.conf.ringingId=d.deviceId}else v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_SPEAKER_NOT_AVAILABLE"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"});return x("speaker",!1)}).then(function(){return x("ringing",!1)}).then(function(){if(jabra)return jabra.init().then(function(){return E.isJabraInitialized=!0,jabra.getInstallInfo()}).then(function(){return jabra.getUserDeviceMediaExt()}).then(function(e){m&&c&&d&&e&&_.includes([m.groupId,c.groupId,d.groupId],e.deviceInfo.browserGroupId)&&(y.info("Jabra library correctly initialized and device correctly installed"),E.isJabraEnabled=!0,jabra.onHook(),jabra.addEventListener("acceptcall",function(e){var n=_.last(E.sessions);n?"incoming"===n.direction&&n.isInProgress()?E.answer(n):y.error("Unable to find a valid call to answer",e):y.error("Unable to answer the call",e)}.bind(this)),jabra.addEventListener("mute",function(){x("microphone",E.conf.microphoneMute=!0)}.bind(this)),jabra.addEventListener("unmute",function(){E.conf.microphoneMute=!1,x("microphone",!0)}.bind(this)),jabra.addEventListener("flash",function(){E.jabraSession.localHold?E.unhold(E.jabraSession):E.hold(E.jabraSession)}.bind(this)),jabra.addEventListener("endcall",function(){o(function(e){for(var n=null,t=0;t<E.sessions.length;t++)_.has(E.sessions[t],"localHold")&&E.sessions[t].localHold||(n=E.sessions[t]);e(n)}).then(function(e){null!==e&&E.terminate(e)})}.bind(this)))}).catch(function(e){y.warn("Error initializing Jabra integration",e)})}).catch(function(e){y.error("Unable to init media devices",e),"NotFoundError"===e.name&&v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_AUDIO_DEVICES_NOT_AVAILABLE"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"})}).finally(function(){E.initDeviceInProgress=!1,S(),DetectRTC.load(function(){E.conf.hasMicrophone=DetectRTC.hasMicrophone,E.conf.hasSpeakers="Chrome"!==DetectRTC.browser.name&&"Edge"!==DetectRTC.browser.name&&"Opera"!==DetectRTC.browser.name||DetectRTC.hasSpeakers,E.conf.isWebRTCSupported=DetectRTC.isWebRTCSupported,E.conf.osName=DetectRTC.osName,E.conf.osVersion=DetectRTC.osVersion,E.conf.browserName=DetectRTC.browser.name,E.conf.browserVersion=DetectRTC.browser.version,E.conf.license&&E.conf.isWebRTCSupported&&E.conf.hasMicrophone&&E.conf.hasSpeakers&&"https"===E.conf.protocol&&("chrome"===E.conf.browserName.toLowerCase()||"opera"===E.conf.browserName.toLowerCase()||"safari"===E.conf.browserName.toLowerCase())?E.register||E.ua.start():E.conf.license||v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_LICENSE_NOT_ENABELD"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"})}.bind(this))})}function S(){c.webrtc=_.pick(E.conf,d),n.localStorage.setItem("motion2.user:"+E.conf.id,JSON.stringify(c))}function T(e,n,t){y.debug("addCall -> target, inbound, fullname",e,n,t),E.calls.unshift({target:e,fullname:t||e,inbound:n,time:moment().format("HH:mm")}),50<E.calls.length&&E.calls.pop()}function I(e){y.debug("answer -> session",e._request),e.notification&&(e.notification.close(),e.notification=null),E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0,e.answer(E.sessionConf),E.isJabraEnabled&&(jabra.offHook(),E.jabraSession=e)}function O(e,n){y.debug("terminate -> session",e._request),e.notification&&(e.notification.close(),e.notification=null);var t={};if(n?t.status_code=n:e.isEstablished()||(t.status_code=603),e.terminate(t),E.isJabraEnabled)if(0===E.sessions.length)e.localHold&&jabra.resume(),jabra.onHook(),E.jabraSession=null;else{var a=_.last(E.sessions);a.localHold?(jabra.onHook(),jabra.hold(),E.jabraSession=a):jabra.offHook()}}function C(t){return y.debug("getVoiceChannels -> session",t._request),h.rpc.getVoiceChannels().$promise.then(function(e){var n=_.find(e.rows,function(e){return e.sipcalllinkedid===t.call_id?e:e.sipcalluniqueid===t.call_id?e:null});n&&(t.monitor=n.monitor,t.uniqueid=n.uniqueid,t.monitors=n.monitors)})}function w(e){y.debug("onAddstream -> data",e),this.remotePlayer.srcObject=e.stream,this.remotePlayer.play()}function R(){E.canGoInConference=!1,E.isInConference=!1,E.currentconferenceSessions=[]}function x(e,n){switch(e){case"ringing":E.soundPlayer.muted=E.conf.ringingMute,E.conf.ringingId&&E.soundPlayer.setSinkId(E.conf.ringingId).then(function(){E.soundPlayer.volume=E.conf.ringingVolume}).then(function(){n&&S()}).catch(function(e){y.info(e.message,E.conf.ringingId)});break;case"speaker":E.remotePlayer.muted=E.conf.speakerMute,E.conf.speakerId&&E.remotePlayer.setSinkId(E.conf.speakerId).then(function(){E.remotePlayer.volume=E.conf.speakerVolume}).then(function(){n&&S()}).catch(function(e){y.info(e.message,E.conf.speakerId)});break;case"microphone":for(var t=0;t<E.sessions.length;t+=1)E.conf.microphoneMute?E.sessions[t].mute():E.sessions[t].unmute();jabra&&E.isJabraEnabled&&(E.conf.microphoneMute?jabra.mute():jabra.unmute()),n&&S();break;default:y.info("unknown device")}}function N(){E.target="",document.getElementById("ms-target").blur(),document.getElementById("ms-target").value="",p.$broadcast("angucomplete-alt:clearInput","ms-target-wrap")}function D(n){return h.user.getVoicePrefixes({id:E.conf.id}).$promise.then(function(e){if(e.count)return a.show({controller:"PrefixDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/prefix/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{prefixes:e,required:E.conf.phoneBarPrefixRequired}})}).then(function(e){if(E.conf.phoneBarPrefixRequired){if(e&&-1!==e)return e+n}else{if(e&&-1!==e)return e+n;if(!e)return n}})}function P(){if(E.isInConference){var e=E.sessions[0].connection.getReceivers()[0],n=E.sessions[1].connection.getReceivers()[0],t=new MediaStream;t.addTrack(e.track),t.addTrack(n.track);var a=document.getElementById("remote-audio");a.srcObject=t;var i=a.play();void 0!==i&&i.then(function(){}).catch(function(e){y.error(e)})}}function L(e,n,t,a){return y.debug("onReferCallback -> session, textContent, position, delay",e._request,n,t,a),function(){i.show(i.simple().textContent(n).position(t).hideDelay(a)),O(e)}}function k(n){return y.debug("findSessionBySessionId -> sessionId, vm_pb.sessions",n,E.sessions),_.find(E.sessions,function(e){return e.call_id==n})}function M(e,n){return y.debug("callCallback -> url, params",e,n),s({url:e,method:"GET",params:n})}E.currentUser=b.getCurrentUser(),E.direction="right",E.selectedMode="md-scale",E.target="",E.showDialpad=!1,E.soundPlayer=document.getElementById(E.conf.soundPlayerId),E.remotePlayer=document.getElementById(E.conf.remotePlayerId),E.soundPlayer.volume=1,E.sessionConf={mediaConstraints:{audio:!0,video:!1},pcConfig:{iceServers:[]}},E.sessions=[],E.calls=[],E.callbackQueue=[],E.canGoInConference=!1,E.isInConference=!1,E.currentConferenceSessions=[],E.ua=new JsSIP.UA({sockets:[new JsSIP.WebSocketInterface("wss://"+E.conf.host+":"+E.conf.wssPort+"/ws")],uri:new JsSIP.URI("sip",E.conf.name,E.conf.host,5060,null,null).toString(),authorization_user:E.conf.name,ha1:E.conf.ha1,realm:E.conf.realm,user_agent:E.conf.ua,session_timers_refresh_method:"invite",register_expires:E.conf.phoneBarExpires||60,register:!0}),E.conf=_.merge(c.webrtc,E.conf),E.initDeviceInProgress=!1,E.isJabraEnabled=!1,E.isJabraInitialized=!1,E.jabraSession=null,E.jabraClicked=!1,E.buttonClicked=!1,E.originateInProgress=!1,t.bind("keyup",function(e){switch(e.keyCode){case 27:g(function(){E.showDialpad=!1})}}),E.$onInit=function(){m(!1),navigator.mediaDevices.ondevicechange=function(){E.initDeviceInProgress||(E.initDeviceInProgress=!0,jabra&&E.isJabraInitialized?jabra.shutdown().then(function(){E.isJabraInitialized=!1,m(!(E.isJabraEnabled=!1))}).catch(function(e){y.error("Unable to shutdown Jabra library",e)}):m(!0))};var e=[h.network.get({type:"turn",nolimit:!0}).$promise,h.network.get({type:"stun",nolimit:!0}).$promise];o.all(e).then(function(e){var n=e[0].rows,t=e[1].rows,a=[],i=[];t.forEach(function(e){i.push("stun:"+e.value)}),a.push({urls:i}),n.forEach(function(e){var n={urls:"turn:"+e.value};e.username&&(n.username=e.username),e.password&&(n.credential=e.password),a.push(n)}),E.sessionConf.pcConfig={iceServers:a}}),this.ua.on("registered",function(){this.registered=!0}.bind(this)),this.ua.on("unregistered",function(){this.registered=!1}.bind(this)),this.ua.on("newRTCSession",function(e){y.debug("onNewRTCSession -> data",e);var n,t,a,i,s,o=e.session,r=!0,l="",d=0;switch(e.originator){case"local":o.outgoing=!0,o.name=e.request.ruri.user,o.user=e.request.ruri.user,T(o.user,!1),t=e.request.extraHeaders,a="X-callback-url",s=_.find(t,function(e){return _.startsWith(e,a)}),n=!!s&&_.trim(s.replace(a,"").replace(i||":","")),E.isJabraEnabled&&(E.jabraSession&&jabra.resume(),E.jabraSession=o,jabra.offHook());break;case"remote":var c=b.getCurrentUser();c.voicePause&&c.phoneBarDnd&&(r=!1);var m=e.request.getHeader("Call-Type")||"";if(c.ignorePauseForPreviewCalls&&"PREVIEW"===m&&(r=!0),E.originateInProgress&&(r=!1),r&&(o.incoming=!0,o.name=e.request.from.display_name,o.user=e.request.from.uri.user,l=e.request.getHeader("X-Answer-Mode")||"",d=e.request.getHeader("X-Answer-After")||0,function(n){y.debug("getNotification -> session",n._request);var e=n.name?n.name+" <"+n.user+">":n.user;E.currentUser.privacyEnabled&&(e=A.mask(e)),f.create("Incoming call from: ",e,null,function(){I(n)},function(){O(n)},E.conf.autoAnswer).then(function(e){n.notification=e}).catch(function(e){y.error("Error creating notification for incoming call",e)})}(e.session),T(e.session.user,!0),E.isJabraEnabled&&jabra.ring(),E.conf.autoAnswer&&g(function(){o.isInProgress()&&(o.autoAnswer=!0,I(o))},E.conf.autoAnswerDelay?1e3*E.conf.autoAnswerDelay:0),y.debug("xAnswerMode",l),y.debug("xAnswerAfterSec",d),"auto"==l.toLowerCase())){var u=0==d?500:1e3*d;y.debug("auto answer enabled after:"+u+" ms"),g(function(){o.isInProgress()&&(o.autoAnswer=!0,I(o))},u)}}r?(o.call_id=e.request.call_id,n&&M(E.callbackQueue[o.call_id]=n,{call_id:o.call_id}).then(function(){y.info('callbackurl:"'+n+'" called successfully')}).catch(function(e){y.error('fail callbackurl:"'+n+'" err:',e)}),o.connection&&(o.connection.onaddstream=w.bind(this)),o.iceCandidateTimeout=null,o.on("progress",function(e,n){y.debug("onProgress -> session, data",e._request,n),y.error("onProgress -> session, data",e._request,n);var t=!1;switch(n.originator){case"local":this.conf.ringingMute||(this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/incoming-call.ogg"),t=!0);break;case"remote":this.putOtherCallsOnHold(e),this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/outgoing-call.ogg"),t=!0}E.originateInProgress&&(E.originateInProgress=!1),t&&(this.soundPlayer.loop="loop",this.soundPlayer.play().catch(function(e){y.error(e.message)})),C(e).then(function(){var n=E.callbackQueue[e.call_id];n&&M(n,{uniqueid:e.uniqueid,call_id:e.call_id,number_called:e.user}).then(function(){y.info('callbackurl:"'+n+'" called successfully')}).catch(function(e){y.error('fail callbackurl:"'+n+'" err:',e)}).finally(function(){delete E.callbackQueue[e.call_id]})}).catch(function(e){y.error("Unable to retrieve voice channels",e)})}.bind(this,o)),o.on("confirmed",function(e,n){y.debug("onConfirmed -> session, data",e._request,n);var t=document.getElementById("div_session_"+e.id.substr(0,32));t&&$(t).scope().$broadcast("timer-start"),e.confirmed=!0,"remote"===n.originator&&e.connection&&(e.connection.onaddstream=w.bind(this),_.head(e.connection.getRemoteStreams())&&(this.remotePlayer.srcObject=_.head(e.connection.getRemoteStreams()),this.remotePlayer.play())),this.soundPlayer.pause(),this.soundPlayer.loop=null,this.putOtherCallsOnHold(e),e.autoAnswer&&(this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/beep.ogg"),this.soundPlayer.play().catch(function(e){y.error("Unable to play autoAnswer notification",e)})),E.canGoInConference=2==E.sessions.length,C(e).catch(function(e){y.error("Unable to retrieve voice channels",e)})}.bind(this,o)),o.on("hold",function(e,n){y.debug("onHold -> session, data",e._request,n),"local"===n.originator&&(e.localHold=!0)}.bind(this,o)),o.on("unhold",function(e,n){y.debug("onUnhold -> session, data",e._request,n),"local"===n.originator&&(e.localHold=!1)}.bind(this,o)),o.on("ended",function(e,n){if(y.debug("onEnded -> session, data",e._request,n),E.isInConference&&_.includes(E.currentConferenceSessions,e.id)&&(R(),E.buttonClicked=!0),_.remove(this.sessions,{id:e.id}),2!==E.sessions.length&&(E.canGoInConference=!1),E.isJabraEnabled)if(0===E.sessions.length)e.localHold&&jabra.resume(),jabra.onHook(),E.jabraSession=null;else{var t=_.last(E.sessions);t.localHold?(jabra.onHook(),jabra.hold(),E.jabraSession=t):jabra.offHook()}0===E.sessions.length&&E.currentUser.voicePause&&h.user.pause({id:E.currentUser.id,type:_.startsWith(E.currentUser.pauseType,"#")?E.currentUser.pauseType.substring(1):E.currentUser.pauseType}).$promise.catch(function(e){v.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:PAUSEUSER",msg:e.status?JSON.stringify(e.data):e.toString()})}),E.conf.microphoneMute=!1,E.initDevice("microphone",!0)}.bind(this,o)),o.on("failed",function(e,n){if(y.debug("onFailed -> session, data",e._request,n),this.soundPlayer.pause(),this.soundPlayer.loop=null,e.notification&&e.notification.close(),E.isInConference&&_.includes(E.currentConferenceSessions,e.id)&&R(),E.originateInProgress&&(E.originateInProgress=!1),_.remove(this.sessions,{id:e.id}),2!==E.sessions.length&&(E.canGoInConference=!1),E.isJabraEnabled)if(0===E.sessions.length)e.localHold&&jabra.resume(),jabra.onHook(),E.jabraSession=null;else{var t=_.last(E.sessions);t.localHold?(jabra.onHook(),jabra.hold(),E.jabraSession=t):jabra.offHook()}}.bind(this,o)),o.on("icecandidate",function(e,n){y.debug("onIcecandidate -> session, data",e._request,n),null!==e.iceCandidateTimeout&&clearTimeout(e.iceCandidateTimeout),e.iceCandidateTimeout=setTimeout(n.ready,1e3)}.bind(this,o)),E.sessions.push(o),g(function(){p.$apply(),y.debug("onNewRTCSession -> vm_pb.sessions",E.sessions)})):O(o,486)}.bind(this)),r.on("webbar:originate",function(e){y.debug("originateHook -> payload",e);var n=e.callNumber,t=e.callerId,a=e.callbackUrl;E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0;var i=n.replace(/ /g,"");if(i=(i=i.replace(/\(/g,"")).replace(/\)/g,"")){var s=angular.copy(E.sessionConf);s.extraHeaders=[],t&&s.extraHeaders.push("X-CID: "+t),a&&s.extraHeaders.push("X-callback-url: "+a),E.originateInProgress=!0,E.ua.call(i,s)}}.bind(this)),r.on("webbar:hangup",function(e){y.debug("hangupHook -> payload",e);var n=E.sessions;if(e.sessionId&&((n=[]).push(k(e.sessionId)),0==n.length))y.warn("call with session Id "+e.sessionId+" not found");else for(var t=0;t<n.length;t++){var a=n[t];y.info("hangupHook -> sessionToHangup",a),E.terminate(a)}}.bind(this)),r.on("webbar:answer",function(e){var n;y.debug("answerHook -> payload",e),n=e.sessionId?k(e.sessionId):_.find(E.sessions,function(e){return e.incoming&&!e.confirmed}),e.sessionId&&!n&&y.warn("call with session Id "+e.sessionId+" not found"),n&&E.answer(n)}.bind(this)),r.on("webbar:hold",function(e){y.debug("holdHook -> payload",e);var n=E.sessions;if(e.sessionId&&((n=[]).push(k(e.sessionId)),0==n.length))y.warn("call with session Id "+e.sessionId+" not found");else for(var t=0;t<n.length;t++){var a=n[t];E.hold(a)}}.bind(this)),r.on("webbar:unhold",function(e){y.debug("unholdHook -> payload",e);var n=E.sessions;if(e.sessionId&&((n=[]).push(k(e.sessionId)),0==n.length))y.warn("call with session Id "+e.sessionId+" not found");else for(var t=0;t<n.length;t++){var a=n[t];E.unhold(a)}}.bind(this)),r.on("webbar:transfer",function(e){if(y.debug("transferHook -> payload",e),e.sessionId)if(e.transferNumber){var n=k(e.sessionId);n?n.refer(e.transferNumber,{eventHandlers:{requestSucceeded:L(n,"requestSucceeded","top right",3e3),requestFailed:L(n,"requestFailed","top right",3e3)}}):y.warn("call with session Id "+e.sessionId+" not found")}else y.error("transferNumber required");else y.error("sessionId required")}.bind(this)),r.on("webbar:stopmonitors",function(e){if(e.agentId===E.currentUser.id){var n=_.find(E.sessions,["uniqueid",e.uniqueid]);if(!n)return;n.monitors.forEach(function(e){e.status="pause"}),n.monitor=!1}}.bind(this))}.bind(this),E.type=function(e,n){var t=e;switch(E.target||(E.target=""),n&&(E.target+=e,p.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",E.target)),e){case"*":t="asterisk";break;case"#":t="pound"}E.conf.enableDtmfTone&&(E.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/dialpad/"+t+".ogg"),E.soundPlayer.play().catch(function(e){y.error(e.message)}));for(var a=0;a<E.sessions.length;a+=1)E.sessions[a].isEstablished()&&!E.sessions[a].isOnHold().local&&E.sessions[a].sendDTMF(e)},E.call=function(){if(E.target&&E.target!==E.conf.name&&E.target!==E.conf.internal){E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0;var e=E.target.replace(/ /g,"");return D(e=(e=e.replace(/\(/g,"")).replace(/\)/g,"")).then(function(e){e&&E.ua.call(e,E.sessionConf)}).then(function(){N()})}},E.hold=function(e){y.debug("hold -> session",e._request),e.hold({useUpdate:!1}),E.isJabraEnabled&&(jabra.hold(),jabra.onHook())},E.refer=function(n){y.debug("refer -> session",n._request);var e=a.prompt().title("Transfer").textContent("Type the target").placeholder("Target").ariaLabel("Target").ok("Transfer").cancel("Cancel");a.show(e).then(function(e){return D(e.replace(/ /g,"").replace(/\(/g,"").replace(/\)/g,""))}).then(function(e){n.refer(e,{eventHandlers:{requestSucceeded:L(n,"requestSucceeded","top right",3e3),requestFailed:L(n,"requestFailed","top right",3e3)}})})},E.record=function(e){y.debug("record -> session",e._request),a.show({controller:"RecordDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/record/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{session:e,sessions:E.sessions}})},E.unhold=function(e){y.debug("unhold -> session",e._request),e.unhold({useUpdate:!1}),E.putOtherCallsOnHold(e),E.isJabraEnabled&&(jabra.offHook(),jabra.resume())},E.answer=I,E.terminate=O,E.selectSession=function(e){y.debug("selectSession -> session",e._request),E.unhold(e)},E.typeWrapper=function(e){switch(e.key.toLowerCase()){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"*":case"#":E.type(e.key);break;case"enter":E.call()}},E.toggleDialpad=function(){E.showDialpad=!E.showDialpad},E.referAttended=function(e){y.debug("referAttended -> session",e._request),a.show({controller:"ReferAttendedDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/referAttended/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{session:e,sessions:_.reject(E.sessions,{id:e.id}),isJabraEnabled:E.isJabraEnabled}})},E.closeDialpad=function(){E.showDialpad=!1},E.initDevice=x,E.putOtherCallsOnHold=function(e){if(y.debug("putOtherCallsOnHold -> session",e._request),1<E.sessions.length)for(var n=0;n<E.sessions.length;n+=1)E.sessions[n].id===e.id||E.sessions[n].isOnHold().remote||E.sessions[n].hold({useUpdate:!1})},E.targetChanged=function(e){e?/^(\w|\.|\+|#|\*|\(|\)|\s|-)*$/.test(e)?(E.target=e,p.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",E.target)):E.target?p.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",E.target):N():N()},E.targetSelected=function(e){e&&(E.target=e.originalObject.target,E.call(),N())},E.start3WayConf=function(){E.isInConference=!0,E.canGoInConference=!1,E.currentConferenceSessions.push(E.sessions[0].id),E.currentConferenceSessions.push(E.sessions[1].id);var e=new AudioContext,n=E.sessions[0].connection.getSenders()[0],t=E.sessions[0].connection.getReceivers()[0];t.track.addEventListener("unmute",function(){setTimeout(function(){P()},1e3)},!1);var a=E.sessions[1].connection.getSenders()[0],i=E.sessions[1].connection.getReceivers()[0];i.track.addEventListener("unmute",function(){setTimeout(function(){P()},1e3)},!1),E.sessions[0].unhold({useUpdate:!1}),E.sessions[1].unhold({useUpdate:!1}),t.track.enabled=!0,i.track.enabled=!0;var s=new MediaStream,o=e.createMediaStreamDestination();o=(e=new AudioContext).createMediaStreamDestination();var r=e.createMediaStreamSource(new MediaStream([i.track]));r.connect(o),(r=e.createMediaStreamSource(new MediaStream([n.track]))).connect(o),n.replaceTrack(o.stream.getTracks()[0]).then(function(){}),o=e.createMediaStreamDestination(),(r=e.createMediaStreamSource(new MediaStream([t.track]))).connect(o),(r=e.createMediaStreamSource(new MediaStream([a.track]))).connect(o),a.replaceTrack(o.stream.getTracks()[0]).then(function(){s.addTrack(t.track),s.addTrack(i.track);var e=document.getElementById("remote-audio");e.srcObject=s;var n=e.play();void 0!==n&&n.then(function(){}).catch(function(e){y.error(e)})})},E.patchConference=P,p.$on("webrtc::settings",function(e){a.show({controller:"SettingsController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/settings/settings.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{devices:function(){return navigator.mediaDevices.enumerateDevices()}},locals:{conf:E.conf,activeSessions:E.sessions}}).then(function(e){e&&(E.conf=e,E.initDeviceInProgress||(E.initDeviceInProgress=!0,jabra&&E.isJabraInitialized?jabra.shutdown().then(function(){E.isJabraInitialized=!1,m(E.isJabraEnabled=!1)}).catch(function(e){y.error("Unable to shutdown Jabra library",e)}):m(!1)))})}),p.$on("webrtc::logout",function(){E.ua.stop(),jabra&&E.isJabraInitialized&&jabra.shutdown(),navigator.mediaDevices.ondevicechange=function(){}}),p.$on("webrtc::call",function(e,n){y.debug("onRemoteCall -> evt, data",e,n),n.target&&(E.target=n.target,E.call())}),p.$on("webrtc::transfer",function(e,n){if(y.debug("onRemoteTransfer -> evt, data",e,n),n.target)for(var t=0;t<E.sessions.length;t+=1)if(E.sessions[t].isEstablished()&&!E.sessions[t].isOnHold().local)return D(n.target).then(function(e){e&&E.sessions[t].refer(e,{eventHandlers:{requestSucceeded:L(E.sessions[t],"requestSucceeded","top right",3e3),requestFailed:L(E.sessions[t],"requestFailed","top right",3e3)}})})}),p.$on("$destroy",function(){y.debug("$destroy event fired"),r.removeAllListeners("webbar:originate"),r.removeAllListeners("webbar:hangup"),r.removeAllListeners("webbar:answer"),r.removeAllListeners("webbar:hold"),r.removeAllListeners("webbar:unhold"),r.removeAllListeners("webbar:transfer"),r.removeAllListeners("webbar:stopmonitors")})}e.$inject=["$scope","$document","$timeout","$interval","$mdDialog","$mdToast","$window","$translate","$http","$q","toasty","api","motNotification","Auth","socket","privacyManager","ClientSideLoggingService"],angular.module("app.core").controller("MsPhonebarController",e).directive("msPhonebar",function(){return{restrict:"E",scope:{conf:"=",sessions:"="},require:"msPhonebar",controller:"MsPhonebarController",controllerAs:"vm_pb",bindToController:!0,templateUrl:"assets/ms-phonebar/ms-phonebar.html"}})}(),function(){"use strict";function e(n,e,t){var a=this;a.prefixes=e,a.required=t,a.closeDialog=function(e){n.hide(e)},a.keyPress=function(e){13===e.keyCode&&this.call()},a.call=function(){n.hide(a.prefix)}}e.$inject=["$mdDialog","prefixes","required"],angular.module("app.core").controller("PrefixDialogController",e)}(),function(){"use strict";function e(i){return{restrict:"C",controller:["$scope","$element",function(e,n){function t(){n.css("display","inline"),i(a,1e3)}function a(){n.css("display","none"),i(t,1e3)}t()}],replace:!0}}function n(n,i,s,e,t){var o=this;function a(n,e){console.log("startMonitor");var t=i.defer(),a=(e||n.filename.replace(/^.*[\\\/]/,"")).split(".")[0];return s.rpc.startMonitor({uniqueid:o.session.uniqueid,filename:a,format:"wav"}).$promise.then(function(e){n.filename=a+".wav",n.mixmonitorid=e.mixmonitorid,n.status="rec",o.session.monitor=!0,t.resolve(n)}).catch(function(e){t.reject(e)}),t.promise}o.title="Record",o.sessions=e,o.session=t,o.closeDialog=function(){n.hide()},o.addRecording=function(){var e=n.prompt({skipHide:!0}).title("Start new recording").textContent("Type the file name.").placeholder("File name").ariaLabel("File name").initialValue(function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}()).ok("Start").cancel("Cancel");n.show(e).then(function(e){return a({},e)}).then(function(e){o.session.monitors.push(e)})},o.stop=function(n){return console.log("stopMonitor"),s.rpc.stopMonitor({uniqueid:o.session.uniqueid,mixmonitorid:n.mixmonitorid}).$promise.then(function(e){n.status="pause",o.session.monitor=_.includes(o.session.monitors,{status:"rec"})}).catch(function(e){console.error(e)})},o.start=a}e.$inject=["$timeout"],n.$inject=["$mdDialog","$q","api","sessions","session"],angular.module("app.core").directive("msBlink",e).controller("RecordDialogController",n)}(),function(){"use strict";function e(n,s,a,i,e){var o=this;function r(e,n,t,a,i){return console.debug("onTransferCallback -> session, textContent, position, delay",e,n,t,a),function(){s.show(s.simple().textContent(n).position(t).hideDelay(a)),e.terminate(),jabra&&i&&jabra.onHook(),l()}}function l(e){n.hide(e)}o.title="Refer Attended",o.sessions=a,o.session=i,o.isJabraEnabled=e,o.sessionTarget=null,a.length&&(o.target=a[0].user),o.closeDialog=l,o.transfer=function(){var e,n,t=_.find(a,function(e){if(e.user===o.target)return e});n=t.outgoing?(e=t,o.session):(e=o.session,t);n.refer(e.user,{replaces:e,eventHandlers:{requestSucceeded:r(i,"requestSucceeded","top right",3e3,o.isJabraEnabled),requestFailed:r(i,"requestFailed","top right",3e3,o.isJabraEnabled)}})}}e.$inject=["$mdDialog","$mdToast","sessions","session","isJabraEnabled"],angular.module("app.core").controller("ReferAttendedDialogController",e)}(),function(){"use strict";function e(e,s,n,t){var a=this;function i(e,n,t){var a;if(s[t]){if(a=_.find(e,function(e){return e.deviceId===s[t]}))return a.deviceId;var i=_.findIndex(e,function(e){return e.kind===n});if(0<=i)return e[i].deviceId}else(a=_.find(e,function(e){return e.kind===n}))&&(s[t]=a.deviceId);return s[t]||null}_.remove(n,function(e){return"audioinput"===e.kind&&("default"===e.deviceId||"communications"===e.deviceId)||"audiooutput"===e.kind&&("default"===e.deviceId||"communications"===e.deviceId)}),s.ringingId=i(n,"audiooutput","ringingId"),s.speakerId=i(n,"audiooutput","speakerId"),s.microphoneId=i(n,"audioinput","microphoneId"),s.ringingVolume=s.ringingVolume||.5,s.speakerVolume=s.speakerVolume||.5,s.microphoneVolume=s.microphoneVolume||1,s.ringingMute=s.ringingMute||!1,s.speakerMute=s.speakerMute||!1,s.microphoneMute=s.microphoneMute||!1,a.conf=angular.copy(s),a.devices=n,a.activeSessions=t,a.saveSettings=function(){e.hide(a.conf)},a.closeDialog=function(){e.hide()},a.isCompatibleBrowser=function(){return"chrome"===a.conf.browserName.toLowerCase()||"opera"===a.conf.browserName.toLowerCase()||"safari"===a.conf.browserName.toLowerCase()}}e.$inject=["$mdDialog","conf","devices","activeSessions"],angular.module("app.toolbar").controller("SettingsController",e)}(),function(){"use strict";function e(e,t,a){var i=this;function s(e,n,t){r(e).then(function(){n&&!1!==t&&i.search()})}function o(e){var n=e.key;i.pickerModels[n].dateStart?!0===e.useFromToKeys?i.query[n]={from:moment(i.pickerModels[n].dateStart).utcOffset(0,!0).format(),to:moment(i.pickerModels[n].dateEnd).utcOffset(0,!0).add(23,"hours").add(59,"minutes").add(59,"seconds").format()}:i.query[n]={$gte:moment(i.pickerModels[n].dateStart).utcOffset(0,!0).format(),$lte:moment(i.pickerModels[n].dateEnd).utcOffset(0,!0).add(23,"hours").add(59,"minutes").add(59,"seconds").format()}:i.query[n]=void 0,i.search()}function r(e){var n=e.key,t={param:i.query[n],resources:e.options,placeholder:e.placeholder,ngValue:e.ngValue};return a.setPlaceholder(t).then(function(e){i.placeholders[n]=e})}i.pickerModels={},i.placeholders={},i.localizationMap=t.localizationMap,i.onMultiselectInit=function(e){r(e)},i.onDateRangeInit=function(e){var n=e.key;i.query[n]?i.pickerModels[n]=t.setSelectedDate(i.query[n]):i.pickerModels[n]={dateStart:null}},i.onMultiselectSelection=s,i.onDateRangeSelection=o,i.clearDate=function(e){var n=e.key;i.pickerModels[n]={dateStart:null},delete i.query[n],i.search()},i.clearSelection=function(e){var n=e.key,t=e.ngValue||"id";i.query[n]=!1===e.clearAll?[_.head(e.options)[t]]:[],r(e).then(function(){i.search()})},i.selectAll=function(e){var n=e.key,t=e.ngValue||"id";i.query[n]=_.map(e.options,t),r(e).then(function(){i.search()})},e.$on("ms-quick-filter:update",function(e,t){t.filters.forEach(function(e){var n=_.find(i.filters,["name",e]);if(n)switch(n.type){case"date":o(n);break;case"multiselect":s(n,!0,t.update);break;case"select":i.search()}})})}e.$inject=["$scope","dateRangeManager","quickFilterManager"],angular.module("app.core").directive("msQuickFilter",function(){return{restrict:"E",scope:{query:"=",filters:"=",search:"&"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-quick-filter/ms-quick-filter.html"}})}(),function(){"use strict";angular.module("app.core").directive("msRandomClass",function(){return{restrict:"A",scope:{msRandomClass:"="},link:function(e,n){var t=e.msRandomClass[Math.floor(Math.random()*e.msRandomClass.length)];n.addClass(t)}}})}(),function(){"use strict";function e(i){return{restrict:"E",scope:{id:"=",model:"=",download:"="},replace:!0,link:function(n,e){var t=!1,a=document.createElement("audio");n.download||a.setAttribute("controlsList","nodownload"),a.setAttribute("preload","none"),a.setAttribute("controls",""),a.setAttribute("style","width: 265px;"),a.setAttribute("src"," "),a.onplay=function(e){t||(t=!0,e.preventDefault(),i[n.model||"voiceRecording"].download({id:n.id}).$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type});a.setAttribute("type",e.type),a.setAttribute("src",URL.createObjectURL(t)),a.play()}).catch(function(e){console.error(e)}))},e.append(a)}}}e.$inject=["api"],angular.module("app.core").directive("msRecording",e)}(),function(){"use strict";angular.module("app.core").directive("msResponsiveTable",function(){return{restrict:"A",link:function(e,n){var t=angular.element('<div class="ms-responsive-table-wrapper"></div>');n.after(t),t.append(n)}}})}(),function(){"use strict";function e(n,i,s,e){var o=this;function t(){angular.isArray(o.onSearch)?a(o.onSearch):o.onResultClick?(o.resultsLoading=!0,n.$parent.$eval("vm.search(query)",{query:o.query.filter}).then(function(e){a(e)}).catch(function(){a([])}).finally(function(){o.resultsLoading=!1})):o.onSearch()}function a(e){o.expanded&&(void 0===e||angular.isArray(e)||null===e)&&(o.selectedResultIndex=0,o.results=e)}function r(){o.expanded=!0,o.displayOn=!0,n.expand()}function l(e){!1!==e&&(o.query.filter=void 0,o.onResultClick?a(null):t()),o.expanded=!1,n.collapse()}function d(e){o.onResultClick&&o.onResultClick({item:e}),l()}function c(){var e=i.find(".ms-search-bar-results"),n=angular.element(e.find(".result")[o.selectedResultIndex]);if(e&&n){var t=n.position().top-8,a=n.position().top+n.outerHeight()+8;o.ignoreMouseEvents=!0,s.cancel(o.mouseEventIgnoreTimeout),o.mouseEventIgnoreTimeout=s(function(){o.ignoreMouseEvents=!1},250),e.scrollTop()>t&&e.scrollTop(t),a>e.height()+e.scrollTop()&&e.scrollTop(a-e.height())}}o.queryOptions={debounce:o.debounce||0},o.searchOnEnterKey=e.get().searchOnEnterKey||!1,o.resultsLoading=!1,o.results=null,o.selectedResultIndex=0,o.ignoreMouseEvents=!1,o.expandBar=r,o.collapseBar=l,o.blurCollapse=function(){if(!o.collapseOnBlur)return;l()},o.onKeyDown=function(e){var n=e.keyCode;-1<[27,38,40].indexOf(n)&&e.preventDefault();switch(n){case 13:if(!o.onResultClick)return t();if(!o.results)return;d(o.results[o.selectedResultIndex]);break;case 27:l();break;case 38:0<=o.selectedResultIndex-1&&(o.selectedResultIndex--,c());break;case 40:if(!o.results)return;o.selectedResultIndex+1<o.results.length&&(o.selectedResultIndex++,c())}},o.absorbEvent=function(e){e.preventDefault()},o.handleMouseenter=function(e){if(o.ignoreMouseEvents)return;o.selectedResultIndex=e},o.handleResultClick=d,n.$watch("vm.displayOn",function(e){angular.isUndefined(e)||(!0!==e||o.expanded?e||!1===o.expanded||l(!1):r())}),n.$watch("vm.query.filter",function(e,n){if(!angular.isUndefined(e)&&0!==e.length&&!angular.equals(e,n)&&!1!==o.displayOn){if(o.expanded){if(!0===o.searchOnEnterKey&&!o.onResultClick)return;if(o.minChars&&o.minChars>e.length)return}else r();t()}})}function n(a){return{restrict:"E",scope:{query:"=?",debounce:"=?",direction:"@",iconColor:"@",onSearch:"&",onResultClick:"&?",onExpand:"&?",onCollapse:"&?",collapseOnBlur:"<?",minChars:"<?",displayOn:"=?"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-search-bar/ms-search-bar.html",compile:function(e){return e.addClass("ms-search-bar"),{post:function(n,t){n.collapse=function(){if(t.removeClass("expanded"),"down"===n.vm.direction){t.removeClass("down");var e=t.closest("md-toolbar");e&&e.removeClass("h-128")}a.find("body").removeClass("ms-search-bar-expanded")},n.expand=function(){if(t.addClass("expanded"),"down"===n.vm.direction){t.addClass("down");var e=t.closest("md-toolbar");e&&e.addClass("h-128")}a.find("body").addClass("ms-search-bar-expanded")}}}}}}e.$inject=["$scope","$element","$timeout","settingsManager"],n.$inject=["$document"],angular.module("app.core").controller("MsSearchBarController",e).directive("msSearchBar",n)}(),function(){"use strict";function e(e,t,i,o,r,l){var d=this;d.query="",d.queryOptions={debounce:300},d.resultsLoading=!1,d.selectedResultIndex=0,d.ignoreMouseEvents=!1,d.mobileBarActive=!1,d.results=null,d.shortcuts=[],d.sortableOptions={ghostClass:"ghost",forceFallback:!0,fallbackClass:"dragging",onSort:function(){d.saveShortcuts()}},d.populateResults=function(){for(var e=[],n=l.getFlatNavigation(),t=r.defer(),a=0;a<n.length;a++)n[a].uisref&&e.push(n[a]);if(d.query){e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(d.query)))return!0});for(var i=0;i<e.length;i++){e[i].hasShortcut=!1;for(var s=0;s<d.shortcuts.length;s++)if(d.shortcuts[s]._id===e[i]._id){e[i].hasShortcut=!0;break}}}else 0<d.shortcuts.length&&(e=d.shortcuts);return d.selectedResultIndex=0,o(function(){t.resolve(e)},250),t.promise},d.loadShortcuts=function(){var e=r.defer(),n=angular.fromJson(t.get("motion.shortcuts"));angular.isUndefined(n)&&(n=[{title:"Agents",icon:"icon-account-multiple",state:"app.staff.agents",weight:5,children:[],uisref:"app.staff.agents",hasShortcut:!0},{title:"License",icon:"icon-cog",state:"app.settings.license",weight:10,children:[],uisref:"app.settings.license",hasShortcut:!0}],t.put("motion.shortcuts",angular.toJson(n)));return e.resolve(n),e.promise},d.saveShortcuts=function(){var e=r.defer();return t.put("motion.shortcuts",angular.toJson(d.shortcuts)),o(function(){e.resolve({success:!0})},250),e.promise},d.addShortcut=function(e){e.hasShortcut=!0,d.shortcuts.push(e),d.saveShortcuts()},d.removeShortcut=function(e){e.hasShortcut=!1;for(var n=0;n<d.shortcuts.length;n++)d.shortcuts[n]._id===e._id&&(d.shortcuts.splice(n,1),d.query||(0===d.shortcuts.length?d.results=null:n>=d.shortcuts.length&&(d.selectedResultIndex=d.shortcuts.length-1)));d.saveShortcuts()},d.handleResultClick=function(e){e.hasShortcut?d.removeShortcut(e):d.addShortcut(e)},d.absorbEvent=function(e){e.preventDefault()},d.handleKeydown=function(e){var n=e.keyCode;-1<[38,40].indexOf(n)&&e.preventDefault();switch(n){case 13:d.handleResultClick(d.results[d.selectedResultIndex]);break;case 38:0<=d.selectedResultIndex-1&&(d.selectedResultIndex--,d.ensureSelectedResultIsVisible());break;case 40:d.selectedResultIndex+1<d.results.length&&(d.selectedResultIndex++,d.ensureSelectedResultIsVisible())}},d.handleMouseenter=function(e){if(d.ignoreMouseEvents)return;d.selectedResultIndex=e},d.temporarilyIgnoreMouseEvents=function(){d.ignoreMouseEvents=!0,o.cancel(d.mouseEventIgnoreTimeout),d.mouseEventIgnoreTimeout=o(function(){d.ignoreMouseEvents=!1},250)},d.ensureSelectedResultIsVisible=function(){var e=i.find("#ms-shortcut-add-menu").find(".results"),n=angular.element(e.find(".result")[d.selectedResultIndex]);if(e&&n){var t=n.position().top-8,a=n.position().top+n.outerHeight()+8;d.temporarilyIgnoreMouseEvents(),e.scrollTop()>t&&e.scrollTop(t),a>e.height()+e.scrollTop()&&e.scrollTop(a-e.height())}},d.toggleMobileBar=function(){d.mobileBarActive=!d.mobileBarActive},d.loadShortcuts().then(function(e){d.shortcuts=e,0<d.shortcuts.length&&(d.results=e)}),e.$watch("MsShortcuts.query",function(e,n){angular.isUndefined(e)||angular.equals(e,n)||(d.resultsLoading=!0,d.populateResults().then(function(e){d.results=e},function(){d.results=[]}).finally(function(){d.resultsLoading=!1}))})}e.$inject=["$scope","$cookies","$document","$timeout","$q","msNavigationService"],angular.module("app.core").controller("MsShortcutsController",e).directive("msShortcuts",function(){return{restrict:"E",scope:{},require:"msShortcuts",controller:"MsShortcutsController as MsShortcuts",bindToController:{},templateUrl:"app/core/directives/ms-shortcuts/ms-shortcuts.html",compile:function(e){return e.addClass("ms-shortcuts"),function(e,n){}}}})}(),function(){"use strict";angular.module("app.core").directive("msSidenavHelper",function(){return{restrict:"A",require:"^mdSidenav",link:function(e,n,t,a){e.$watch(function(){return a.isOpen()&&!a.isLockedOpen()},function(e){angular.isUndefined(e)||(n.parent().toggleClass("full-height",e),angular.element("html").toggleClass("sidenav-open",e))})}}})}(),function(){"use strict";function e(a){return{restrict:"E",link:function(e,n){var t=e.$on("msSplashScreen::remove",function(){a.leave(n).then(function(){t(),e=n=null})})}}}e.$inject=["$animate"],angular.module("app.core").directive("msSplashScreen",e)}(),function(){"use strict";function e(e){var i=this;function n(){i.setCurrentStep(1)}function t(e){return o(e)?i.steps[e-1].scope.optionalStep:null}function a(e){return o(e)?!!i.steps[e-1].scope.hideStep:null}function s(e){return o(e)?!!t(e)||i.steps[e-1].form.$valid:null}function o(e){return!(angular.isUndefined(e)||e<1||e>i.steps.length)}i.mainForm=void 0,i.orientation="horizontal",i.steps=[],i.currentStep=void 0,i.currentStepNumber=1,i.setOrientation=function(e){i.orientation=e||"horizontal"},i.registerMainForm=function(e){i.mainForm=e},i.registerStep=function(e,n,t){var a={element:e,scope:n,form:t,stepNumber:n.step||i.steps.length+1,stepTitle:n.stepTitle,stepTitleTranslate:n.stepTitleTranslate};return i.steps.push(a),i.steps.sort(function(e,n){return e.stepNumber-n.stepNumber}),a},i.setupSteps=function(){i.setCurrentStep(i.currentStepNumber)},i.resetForm=function(){e(function(){for(var e=0;e<i.steps.length;e++)i.steps[e].form.$setPristine(),i.steps[e].form.$setUntouched();i.mainForm.$setPristine(),i.mainForm.$setUntouched(),n()})},i.setCurrentStep=function(e){if(!o(e))return;if(i.currentStepNumber=e,"horizontal"===i.orientation){for(var n=0;n<i.steps.length;n++)i.steps[n].element.hide();i.steps[i.currentStepNumber-1].element.show()}else if("vertical"===i.orientation){for(var t=0;t<i.steps.length;t++)i.steps[t].element.find(".ms-stepper-step-content").hide();i.steps[i.currentStepNumber-1].element.find(".ms-stepper-step-content").show()}},i.gotoStep=function(e){if(a(e))return;i.setCurrentStep(e)},i.gotoPreviousStep=function(){for(var e=i.currentStepNumber-1,n=e;1<=n;n--)if(!a(n)){e=n;break}i.setCurrentStep(e)},i.gotoNextStep=function(){for(var e=i.currentStepNumber+1,n=e;n<=i.steps.length;n++)if(!a(n)){e=n;break}i.setCurrentStep(e)},i.gotoFirstStep=n,i.gotoLastStep=function(){i.setCurrentStep(i.steps.length)},i.isFirstStep=function(){return 1===i.currentStepNumber},i.isLastStep=function(){return i.currentStepNumber===i.steps.length},i.isStepCurrent=function(e){return o(e)?i.currentStepNumber===e:null},i.isStepDisabled=function(e){if(!o(e))return null;for(var n=!1,t=1;t<e;t++)if(!s(t)){n=!0;break}return n},i.isStepOptional=t,i.isStepHidden=a,i.filterHiddenStep=function(e){return!a(e.stepNumber)},i.isStepValid=s,i.isStepNumberValid=o,i.isFormValid=function(){return i.mainForm.$valid}}function n(o){return{restrict:"A",scope:{},require:["form","msVerticalStepper"],priority:1001,controller:"MsStepperController as MsStepper",bindToController:{model:"=ngModel"},transclude:!0,templateUrl:"app/core/directives/ms-stepper/templates/vertical/vertical.html",compile:function(e){return e.addClass("ms-stepper"),function(e,n,t,a){var i=a[0],s=a[1];o(function(){s.setOrientation("vertical"),s.registerMainForm(i),s.setupSteps()})}}}}e.$inject=["$timeout"],n.$inject=["$timeout"],angular.module("app.core").controller("MsStepperController",e).directive("msHorizontalStepper",function(){return{restrict:"A",scope:{},require:["form","msHorizontalStepper"],priority:1001,controller:"MsStepperController as MsStepper",bindToController:{model:"=ngModel"},transclude:!0,templateUrl:"app/core/directives/ms-stepper/templates/horizontal/horizontal.html",compile:function(e){return e.addClass("ms-stepper"),function(e,n,t,a){var i=a[0],s=a[1];s.setOrientation("horizontal"),s.registerMainForm(i),s.setupSteps()}}}}).directive("msHorizontalStepperStep",function(){return{restrict:"E",require:["form","^msHorizontalStepper"],priority:1e3,scope:{step:"=?",stepTitle:"=?",stepTitleTranslate:"=?",optionalStep:"=?",hideStep:"=?"},compile:function(e){return e.addClass("ms-stepper-step"),function(e,n,t,a){var i=a[0],s=a[1];e.optionalStep=angular.isDefined(t.optionalStep),s.registerStep(n,e,i),n.hide()}}}}).directive("msVerticalStepper",n).directive("msVerticalStepperStep",function(){return{restrict:"E",require:["form","^msVerticalStepper"],priority:1e3,scope:{step:"=?",stepTitle:"=?",stepTitleTranslate:"=?",optionalStep:"=?",hideStep:"=?"},transclude:!0,templateUrl:"app/core/directives/ms-stepper/templates/vertical/step/vertical-step.html",compile:function(e){return e.addClass("ms-stepper-step"),function(e,n,t,a){var i=a[0],s=a[1];e.optionalStep=angular.isDefined(t.optionalStep),e.stepInfo=s.registerStep(n,e,i),e.MsStepper=s,n.find(".ms-stepper-step-content").hide()}}}})}(),function(){"use strict";function e(e){return{restrict:"E",scope:{},transclude:!0,controller:"MsTabScrollController",controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-tab-scroll/ms-tab-scroll.html",compile:function(e){return e.addClass("ms-tab-scroll"),function(e,n){}}}}e.$inject=["$document"],angular.module("app.core").controller("MsTabScrollController",function(){function n(){var e=document.getElementById("bar-container"),n=document.getElementById("tab-container");return n.scrollWidth>e.scrollWidth&&0==e.scrollLeft&&0==n.scrollLeft?"right":n.scrollWidth>e.scrollWidth&&n.scrollLeft>e.scrollLeft&&e.scrollWidth+n.scrollLeft>=n.scrollWidth?"left":n.scrollWidth>e.scrollWidth&&n.scrollLeft>e.scrollLeft&&e.scrollWidth+n.scrollLeft<n.scrollWidth?"both":"none"}this.onTabScroll=function(e){"left"==e?$("#tab-container").stop().animate({scrollLeft:"-=400"},1e3):$("#tab-container").stop().animate({scrollLeft:"+=400"},1e3)},this.canScroll=function(e){switch(n()){case"both":return!0;case"left":return"left"==e;case"right":return"right"==e;case"none":default:return!1}}}).directive("msTabScroll",e)}(),function(){"use strict";function e(m,u){return{scope:!0,require:"^msTimeline",compile:function(e){return e.addClass("ms-timeline-item").addClass("hidden"),function(e,t,n,a){var i=72,s=!1,o=!1,r=a.getScrollEl();!function(){t.find("ms-card")?e.$on("msCard::cardTemplateLoaded",function(e,n){var t=angular.element(n[0]);d(t).then(function(){m(function(){s=!0})})}):d(t).then(function(){m(function(){s=!0})});r.on("scroll",c),c()}();var l=e.$watch(function(){return s&&o},function(e,n){angular.equals(e,n)||e&&(t.removeClass("hidden").addClass("animate"),l())},!0);function d(e){var n=u.defer(),t=e.find("img");return 0<t.length?t.on("load",function(){n.resolve("Image is loaded")}):n.resolve("No images"),n.promise}function c(){r.scrollTop()+r.height()>t.position().top+i&&(m(function(){o=!0}),r.off("scroll",c))}}}}}e.$inject=["$timeout","$q"],angular.module("app.core").controller("MsTimelineController",function(){var n=this;n.scrollEl=void 0,n.setScrollEl=function(e){n.scrollEl=e},n.getScrollEl=function(){return n.scrollEl}}).directive("msTimeline",function(){return{scope:{msTimeline:"=?",loadMore:"&?msTimelineLoadMore"},controller:"MsTimelineController",compile:function(e){return e.addClass("ms-timeline"),function(e,n,t,a){var i=angular.element('<div class="ms-timeline-loader md-accent-bg md-whiteframe-4dp"><span class="spinner"></span></div>');n.append(i);var s={scrollEl:"#content"};s=angular.extend(s,e.msTimeline,{});var o=angular.element(s.scrollEl);a.setScrollEl(o);var r=144;function l(){o.scrollTop()+o.height()+r>i.position().top&&(i.addClass("show"),c(),e.loadMore&&e.loadMore().then(function(){i.removeClass("show"),d()},function(){i.remove()}))}function d(){o.on("scroll",l)}function c(){o.off("scroll",l)}d(),e.$on("$destroy",function(){c()})}}}}).directive("msTimelineItem",e)}(),function(){"use strict";function e(a,e,n,i,t){var r=this;function s(){!function(){r.millis=l().diff(moment(r.startingTime));var e=moment.duration(r.millis),n=e.seconds(),t=e.minutes(),a=e.hours(),i=e.days(),s=e.months(),o=e.years();r.seconds=n<10?"0"+n:n,r.minutes=t<10?"0"+t:t,r.hours=a<10?"0"+a:a,r.days=i<10?"0"+i:i,r.months=s<10?"0"+s:s,r.years=o<10?"0"+o:o,r.timer=0<r.days?r.days+"d ":r.hours+":"+r.minutes+":"+r.seconds}(),r.timeoutId=setTimeout(function(){s(),a.$digest()},r.interval)}function l(e){var n=(e||moment()).utcOffset(a.serverDateOffset).format("YYYY-MM-DD HH:mm:ss");return moment(n)}function o(){n(function(n,t){try{if(a.serverDateOffset)return void n(l());i.setting.getDate().$promise.then(function(e){a.serverDateOffset=e.offset,n(moment(e.now))})}catch(e){t(e)}}).then(function(e){var n=r.startTime?moment(r.startTime):void 0;r.startTime?n.isAfter(e,"hour")||n.isBefore(e,"hour")?r.startingTime=l(n):r.startingTime=n:r.startingTime=e,s()}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.getDate",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}o(),a.$watch("vm.startTime",function(e,n){angular.isUndefined(e)||0!==e.length&&(angular.equals(e,n)||o())}),a.$on("timer-start",function(){r.startTime=void 0,o()}),e.bind("$destroy",function(){r.timeoutId&&clearTimeout(r.timeoutId)})}e.$inject=["$scope","$element","$q","api","toasty"],angular.module("app.core").directive("timer",function(){return{restrict:"EA",replace:!1,scope:{startTime:"=?",interval:"=?"},template:"<span ng-cloak>{{ vm.timer }}</span>",compile:function(){return{pre:function(e,n,t){e.interval=t.interval||1e3}}},controller:e,controllerAs:"vm",bindToController:!0}})}(),function(){"use strict";angular.module("app.core").directive("msTimezone",function(){return{restrict:"E",scope:{ngModel:"=",ngChange:"&"},controller:["$scope",function(e){e.timezone=[{name:"Europe/Andorra",utcOffset:60,offsetStr:"+01:00",countries:["AD"]},{name:"Asia/Dubai",utcOffset:240,offsetStr:"+04:00",countries:["AE","OM"]},{name:"Asia/Kabul",utcOffset:270,offsetStr:"+04:30",countries:["AF"]},{name:"Europe/Tirane",utcOffset:60,offsetStr:"+01:00",countries:["AL"]},{name:"Asia/Yerevan",utcOffset:240,offsetStr:"+04:00",countries:["AM"]},{name:"Antarctica/Rothera",utcOffset:-180,offsetStr:"-03:00",countries:["AQ"]},{name:"Antarctica/Palmer",utcOffset:-180,offsetStr:"-03:00",countries:["AQ"]},{name:"Antarctica/Mawson",utcOffset:300,offsetStr:"+05:00",countries:["AQ"]},{name:"Antarctica/Davis",utcOffset:420,offsetStr:"+07:00",countries:["AQ"]},{name:"Antarctica/Casey",utcOffset:480,offsetStr:"+08:00",countries:["AQ"]},{name:"Antarctica/Vostok",utcOffset:360,offsetStr:"+06:00",countries:["AQ"]},{name:"Antarctica/DumontDUrville",utcOffset:600,offsetStr:"+10:00",countries:["AQ"]},{name:"Antarctica/Syowa",utcOffset:180,offsetStr:"+03:00",countries:["AQ"]},{name:"Antarctica/Troll",utcOffset:0,offsetStr:"+00:00",countries:["AQ"]},{name:"America/Argentina/Buenos_Aires",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Cordoba",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Salta",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Jujuy",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Tucuman",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Catamarca",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/La_Rioja",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/San_Juan",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Mendoza",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/San_Luis",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Rio_Gallegos",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Ushuaia",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"Pacific/Pago_Pago",utcOffset:-660,offsetStr:"-11:00",countries:["AS","UM"]},{name:"Europe/Vienna",utcOffset:60,offsetStr:"+01:00",countries:["AT"]},{name:"Australia/Lord_Howe",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Antarctica/Macquarie",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Hobart",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Currie",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Melbourne",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Sydney",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Broken_Hill",utcOffset:630,offsetStr:"+10:30",countries:["AU"]},{name:"Australia/Brisbane",utcOffset:600,offsetStr:"+10:00",countries:["AU"]},{name:"Australia/Lindeman",utcOffset:600,offsetStr:"+10:00",countries:["AU"]},{name:"Australia/Adelaide",utcOffset:630,offsetStr:"+10:30",countries:["AU"]},{name:"Australia/Darwin",utcOffset:570,offsetStr:"+09:30",countries:["AU"]},{name:"Australia/Perth",utcOffset:480,offsetStr:"+08:00",countries:["AU"]},{name:"Australia/Eucla",utcOffset:525,offsetStr:"+08:45",countries:["AU"]},{name:"Asia/Baku",utcOffset:240,offsetStr:"+04:00",countries:["AZ"]},{name:"America/Barbados",utcOffset:-240,offsetStr:"-04:00",countries:["BB"]},{name:"Asia/Dhaka",utcOffset:360,offsetStr:"+06:00",countries:["BD"]},{name:"Europe/Brussels",utcOffset:60,offsetStr:"+01:00",countries:["BE"]},{name:"Europe/Sofia",utcOffset:120,offsetStr:"+02:00",countries:["BG"]},{name:"Atlantic/Bermuda",utcOffset:-240,offsetStr:"-04:00",countries:["BM"]},{name:"Asia/Brunei",utcOffset:480,offsetStr:"+08:00",countries:["BN"]},{name:"America/La_Paz",utcOffset:-240,offsetStr:"-04:00",countries:["BO"]},{name:"America/Noronha",utcOffset:-120,offsetStr:"-02:00",countries:["BR"]},{name:"America/Belem",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Fortaleza",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Recife",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Araguaina",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Maceio",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Bahia",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Sao_Paulo",utcOffset:-120,offsetStr:"-02:00",countries:["BR"]},{name:"America/Campo_Grande",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Cuiaba",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Santarem",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Porto_Velho",utcOffset:-240,offsetStr:"-04:00",countries:["BR"]},{name:"America/Boa_Vista",utcOffset:-240,offsetStr:"-04:00",countries:["BR"]},{name:"America/Manaus",utcOffset:-240,offsetStr:"-04:00",countries:["BR"]},{name:"America/Eirunepe",utcOffset:-300,offsetStr:"-05:00",countries:["BR"]},{name:"America/Rio_Branco",utcOffset:-300,offsetStr:"-05:00",countries:["BR"]},{name:"America/Nassau",utcOffset:-300,offsetStr:"-05:00",countries:["BS"]},{name:"Asia/Thimphu",utcOffset:360,offsetStr:"+06:00",countries:["BT"]},{name:"Europe/Minsk",utcOffset:180,offsetStr:"+03:00",countries:["BY"]},{name:"America/Belize",utcOffset:-360,offsetStr:"-06:00",countries:["BZ"]},{name:"America/St_Johns",utcOffset:-210,offsetStr:"-03:30",countries:["CA"]},{name:"America/Halifax",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Glace_Bay",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Moncton",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Goose_Bay",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Blanc-Sablon",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Toronto",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Nipigon",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Thunder_Bay",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Iqaluit",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Pangnirtung",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Resolute",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Atikokan",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Rankin_Inlet",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Winnipeg",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Rainy_River",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Regina",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Swift_Current",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Edmonton",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Cambridge_Bay",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Yellowknife",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Inuvik",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Creston",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Dawson_Creek",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Fort_Nelson",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Vancouver",utcOffset:-480,offsetStr:"-08:00",countries:["CA"]},{name:"America/Whitehorse",utcOffset:-480,offsetStr:"-08:00",countries:["CA"]},{name:"America/Dawson",utcOffset:-480,offsetStr:"-08:00",countries:["CA"]},{name:"Indian/Cocos",utcOffset:390,offsetStr:"+06:30",countries:["CC"]},{name:"Europe/Zurich",utcOffset:60,offsetStr:"+01:00",countries:["CH","DE","LI"]},{name:"Africa/Abidjan",utcOffset:0,offsetStr:"+00:00",countries:["CI","BF","GM","GN","ML","MR","SH","SL","SN","ST","TG"]},{name:"Pacific/Rarotonga",utcOffset:-600,offsetStr:"-10:00",countries:["CK"]},{name:"America/Santiago",utcOffset:-180,offsetStr:"-03:00",countries:["CL"]},{name:"Pacific/Easter",utcOffset:-300,offsetStr:"-05:00",countries:["CL"]},{name:"Asia/Shanghai",utcOffset:480,offsetStr:"+08:00",countries:["CN"]},{name:"Asia/Urumqi",utcOffset:360,offsetStr:"+06:00",countries:["CN"]},{name:"America/Bogota",utcOffset:-300,offsetStr:"-05:00",countries:["CO"]},{name:"America/Costa_Rica",utcOffset:-360,offsetStr:"-06:00",countries:["CR"]},{name:"America/Havana",utcOffset:-300,offsetStr:"-05:00",countries:["CU"]},{name:"Atlantic/Cape_Verde",utcOffset:-60,offsetStr:"-01:00",countries:["CV"]},{name:"America/Curacao",utcOffset:-240,offsetStr:"-04:00",countries:["CW","AW","BQ","SX"]},{name:"Indian/Christmas",utcOffset:420,offsetStr:"+07:00",countries:["CX"]},{name:"Asia/Nicosia",utcOffset:120,offsetStr:"+02:00",countries:["CY"]},{name:"Europe/Prague",utcOffset:60,offsetStr:"+01:00",countries:["CZ","SK"]},{name:"Europe/Berlin",utcOffset:60,offsetStr:"+01:00",countries:["DE"]},{name:"Europe/Copenhagen",utcOffset:60,offsetStr:"+01:00",countries:["DK"]},{name:"America/Santo_Domingo",utcOffset:-240,offsetStr:"-04:00",countries:["DO"]},{name:"Africa/Algiers",utcOffset:60,offsetStr:"+01:00",countries:["DZ"]},{name:"America/Guayaquil",utcOffset:-300,offsetStr:"-05:00",countries:["EC"]},{name:"Pacific/Galapagos",utcOffset:-360,offsetStr:"-06:00",countries:["EC"]},{name:"Europe/Tallinn",utcOffset:120,offsetStr:"+02:00",countries:["EE"]},{name:"Africa/Cairo",utcOffset:120,offsetStr:"+02:00",countries:["EG"]},{name:"Africa/El_Aaiun",utcOffset:0,offsetStr:"+00:00",countries:["EH"]},{name:"Europe/Madrid",utcOffset:60,offsetStr:"+01:00",countries:["ES"]},{name:"Africa/Ceuta",utcOffset:60,offsetStr:"+01:00",countries:["ES"]},{name:"Atlantic/Canary",utcOffset:0,offsetStr:"+00:00",countries:["ES"]},{name:"Europe/Helsinki",utcOffset:120,offsetStr:"+02:00",countries:["FI","AX"]},{name:"Pacific/Fiji",utcOffset:720,offsetStr:"+12:00",countries:["FJ"]},{name:"Atlantic/Stanley",utcOffset:-180,offsetStr:"-03:00",countries:["FK"]},{name:"Pacific/Chuuk",utcOffset:600,offsetStr:"+10:00",countries:["FM"]},{name:"Pacific/Pohnpei",utcOffset:660,offsetStr:"+11:00",countries:["FM"]},{name:"Pacific/Kosrae",utcOffset:660,offsetStr:"+11:00",countries:["FM"]},{name:"Atlantic/Faroe",utcOffset:0,offsetStr:"+00:00",countries:["FO"]},{name:"Europe/Paris",utcOffset:60,offsetStr:"+01:00",countries:["FR"]},{name:"Europe/London",utcOffset:0,offsetStr:"+00:00",countries:["GB","GG","IM","JE"]},{name:"Asia/Tbilisi",utcOffset:240,offsetStr:"+04:00",countries:["GE"]},{name:"America/Cayenne",utcOffset:-180,offsetStr:"-03:00",countries:["GF"]},{name:"Africa/Accra",utcOffset:0,offsetStr:"+00:00",countries:["GH"]},{name:"Europe/Gibraltar",utcOffset:60,offsetStr:"+01:00",countries:["GI"]},{name:"America/Godthab",utcOffset:-180,offsetStr:"-03:00",countries:["GL"]},{name:"America/Danmarkshavn",utcOffset:0,offsetStr:"+00:00",countries:["GL"]},{name:"America/Scoresbysund",utcOffset:-60,offsetStr:"-01:00",countries:["GL"]},{name:"America/Thule",utcOffset:-240,offsetStr:"-04:00",countries:["GL"]},{name:"Europe/Athens",utcOffset:120,offsetStr:"+02:00",countries:["GR"]},{name:"Atlantic/South_Georgia",utcOffset:-120,offsetStr:"-02:00",countries:["GS"]},{name:"America/Guatemala",utcOffset:-360,offsetStr:"-06:00",countries:["GT"]},{name:"Pacific/Guam",utcOffset:600,offsetStr:"+10:00",countries:["GU","MP"]},{name:"Africa/Bissau",utcOffset:0,offsetStr:"+00:00",countries:["GW"]},{name:"America/Guyana",utcOffset:-240,offsetStr:"-04:00",countries:["GY"]},{name:"Asia/Hong_Kong",utcOffset:480,offsetStr:"+08:00",countries:["HK"]},{name:"America/Tegucigalpa",utcOffset:-360,offsetStr:"-06:00",countries:["HN"]},{name:"America/Port-au-Prince",utcOffset:-300,offsetStr:"-05:00",countries:["HT"]},{name:"Europe/Budapest",utcOffset:60,offsetStr:"+01:00",countries:["HU"]},{name:"Asia/Jakarta",utcOffset:420,offsetStr:"+07:00",countries:["ID"]},{name:"Asia/Pontianak",utcOffset:420,offsetStr:"+07:00",countries:["ID"]},{name:"Asia/Makassar",utcOffset:480,offsetStr:"+08:00",countries:["ID"]},{name:"Asia/Jayapura",utcOffset:540,offsetStr:"+09:00",countries:["ID"]},{name:"Europe/Dublin",utcOffset:0,offsetStr:"+00:00",countries:["IE"]},{name:"Asia/Jerusalem",utcOffset:120,offsetStr:"+02:00",countries:["IL"]},{name:"Asia/Kolkata",utcOffset:330,offsetStr:"+05:30",countries:["IN"]},{name:"Indian/Chagos",utcOffset:360,offsetStr:"+06:00",countries:["IO"]},{name:"Asia/Baghdad",utcOffset:180,offsetStr:"+03:00",countries:["IQ"]},{name:"Asia/Tehran",utcOffset:210,offsetStr:"+03:30",countries:["IR"]},{name:"Atlantic/Reykjavik",utcOffset:0,offsetStr:"+00:00",countries:["IS"]},{name:"Europe/Rome",utcOffset:60,offsetStr:"+01:00",countries:["IT","SM","VA"]},{name:"America/Jamaica",utcOffset:-300,offsetStr:"-05:00",countries:["JM"]},{name:"Asia/Amman",utcOffset:120,offsetStr:"+02:00",countries:["JO"]},{name:"Asia/Tokyo",utcOffset:540,offsetStr:"+09:00",countries:["JP"]},{name:"Africa/Nairobi",utcOffset:180,offsetStr:"+03:00",countries:["KE","DJ","ER","ET","KM","MG","SO","TZ","UG","YT"]},{name:"Asia/Bishkek",utcOffset:360,offsetStr:"+06:00",countries:["KG"]},{name:"Pacific/Tarawa",utcOffset:720,offsetStr:"+12:00",countries:["KI"]},{name:"Pacific/Enderbury",utcOffset:780,offsetStr:"+13:00",countries:["KI"]},{name:"Pacific/Kiritimati",utcOffset:840,offsetStr:"+14:00",countries:["KI"]},{name:"Asia/Pyongyang",utcOffset:510,offsetStr:"+08:30",countries:["KP"]},{name:"Asia/Seoul",utcOffset:540,offsetStr:"+09:00",countries:["KR"]},{name:"America/Cayman",utcOffset:-300,offsetStr:"-05:00",countries:["KY"]},{name:"Asia/Almaty",utcOffset:360,offsetStr:"+06:00",countries:["KZ"]},{name:"Asia/Qyzylorda",utcOffset:360,offsetStr:"+06:00",countries:["KZ"]},{name:"Asia/Aqtobe",utcOffset:300,offsetStr:"+05:00",countries:["KZ"]},{name:"Asia/Aqtau",utcOffset:300,offsetStr:"+05:00",countries:["KZ"]},{name:"Asia/Oral",utcOffset:300,offsetStr:"+05:00",countries:["KZ"]},{name:"Asia/Beirut",utcOffset:120,offsetStr:"+02:00",countries:["LB"]},{name:"Asia/Colombo",utcOffset:330,offsetStr:"+05:30",countries:["LK"]},{name:"Africa/Monrovia",utcOffset:0,offsetStr:"+00:00",countries:["LR"]},{name:"Europe/Vilnius",utcOffset:120,offsetStr:"+02:00",countries:["LT"]},{name:"Europe/Luxembourg",utcOffset:60,offsetStr:"+01:00",countries:["LU"]},{name:"Europe/Riga",utcOffset:120,offsetStr:"+02:00",countries:["LV"]},{name:"Africa/Tripoli",utcOffset:120,offsetStr:"+02:00",countries:["LY"]},{name:"Africa/Casablanca",utcOffset:0,offsetStr:"+00:00",countries:["MA"]},{name:"Europe/Monaco",utcOffset:60,offsetStr:"+01:00",countries:["MC"]},{name:"Europe/Chisinau",utcOffset:120,offsetStr:"+02:00",countries:["MD"]},{name:"Pacific/Majuro",utcOffset:720,offsetStr:"+12:00",countries:["MH"]},{name:"Pacific/Kwajalein",utcOffset:720,offsetStr:"+12:00",countries:["MH"]},{name:"Asia/Rangoon",utcOffset:390,offsetStr:"+06:30",countries:["MM"]},{name:"Asia/Ulaanbaatar",utcOffset:480,offsetStr:"+08:00",countries:["MN"]},{name:"Asia/Hovd",utcOffset:420,offsetStr:"+07:00",countries:["MN"]},{name:"Asia/Choibalsan",utcOffset:480,offsetStr:"+08:00",countries:["MN"]},{name:"Asia/Macau",utcOffset:480,offsetStr:"+08:00",countries:["MO"]},{name:"America/Martinique",utcOffset:-240,offsetStr:"-04:00",countries:["MQ"]},{name:"Europe/Malta",utcOffset:60,offsetStr:"+01:00",countries:["MT"]},{name:"Indian/Mauritius",utcOffset:240,offsetStr:"+04:00",countries:["MU"]},{name:"Indian/Maldives",utcOffset:300,offsetStr:"+05:00",countries:["MV"]},{name:"America/Mexico_City",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Cancun",utcOffset:-300,offsetStr:"-05:00",countries:["MX"]},{name:"America/Merida",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Monterrey",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Matamoros",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Mazatlan",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Chihuahua",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Ojinaga",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Hermosillo",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Tijuana",utcOffset:-480,offsetStr:"-08:00",countries:["MX"]},{name:"America/Santa_Isabel",utcOffset:-480,offsetStr:"-08:00",countries:["MX"]},{name:"America/Bahia_Banderas",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"Asia/Kuala_Lumpur",utcOffset:480,offsetStr:"+08:00",countries:["MY"]},{name:"Asia/Kuching",utcOffset:480,offsetStr:"+08:00",countries:["MY"]},{name:"Africa/Maputo",utcOffset:120,offsetStr:"+02:00",countries:["MZ","BI","BW","CD","MW","RW","ZM","ZW"]},{name:"Africa/Windhoek",utcOffset:120,offsetStr:"+02:00",countries:["NA"]},{name:"Pacific/Noumea",utcOffset:660,offsetStr:"+11:00",countries:["NC"]},{name:"Pacific/Norfolk",utcOffset:660,offsetStr:"+11:00",countries:["NF"]},{name:"Africa/Lagos",utcOffset:60,offsetStr:"+01:00",countries:["NG","AO","BJ","CD","CF","CG","CM","GA","GQ","NE"]},{name:"America/Managua",utcOffset:-360,offsetStr:"-06:00",countries:["NI"]},{name:"Europe/Amsterdam",utcOffset:60,offsetStr:"+01:00",countries:["NL"]},{name:"Europe/Oslo",utcOffset:60,offsetStr:"+01:00",countries:["NO","SJ"]},{name:"Asia/Kathmandu",utcOffset:345,offsetStr:"+05:45",countries:["NP"]},{name:"Pacific/Nauru",utcOffset:720,offsetStr:"+12:00",countries:["NR"]},{name:"Pacific/Niue",utcOffset:-660,offsetStr:"-11:00",countries:["NU"]},{name:"Pacific/Auckland",utcOffset:780,offsetStr:"+13:00",countries:["NZ","AQ"]},{name:"Pacific/Chatham",utcOffset:825,offsetStr:"+13:45",countries:["NZ"]},{name:"America/Panama",utcOffset:-300,offsetStr:"-05:00",countries:["PA"]},{name:"America/Lima",utcOffset:-300,offsetStr:"-05:00",countries:["PE"]},{name:"Pacific/Tahiti",utcOffset:-600,offsetStr:"-10:00",countries:["PF"]},{name:"Pacific/Marquesas",utcOffset:-570,offsetStr:"-09:30",countries:["PF"]},{name:"Pacific/Gambier",utcOffset:-540,offsetStr:"-09:00",countries:["PF"]},{name:"Pacific/Port_Moresby",utcOffset:600,offsetStr:"+10:00",countries:["PG"]},{name:"Pacific/Bougainville",utcOffset:660,offsetStr:"+11:00",countries:["PG"]},{name:"Asia/Manila",utcOffset:480,offsetStr:"+08:00",countries:["PH"]},{name:"Asia/Karachi",utcOffset:300,offsetStr:"+05:00",countries:["PK"]},{name:"Europe/Warsaw",utcOffset:60,offsetStr:"+01:00",countries:["PL"]},{name:"America/Miquelon",utcOffset:-180,offsetStr:"-03:00",countries:["PM"]},{name:"Pacific/Pitcairn",utcOffset:-480,offsetStr:"-08:00",countries:["PN"]},{name:"America/Puerto_Rico",utcOffset:-240,offsetStr:"-04:00",countries:["PR"]},{name:"Asia/Gaza",utcOffset:120,offsetStr:"+02:00",countries:["PS"]},{name:"Asia/Hebron",utcOffset:120,offsetStr:"+02:00",countries:["PS"]},{name:"Europe/Lisbon",utcOffset:0,offsetStr:"+00:00",countries:["PT"]},{name:"Atlantic/Madeira",utcOffset:0,offsetStr:"+00:00",countries:["PT"]},{name:"Atlantic/Azores",utcOffset:-60,offsetStr:"-01:00",countries:["PT"]},{name:"Pacific/Palau",utcOffset:540,offsetStr:"+09:00",countries:["PW"]},{name:"America/Asuncion",utcOffset:-180,offsetStr:"-03:00",countries:["PY"]},{name:"Asia/Qatar",utcOffset:180,offsetStr:"+03:00",countries:["QA","BH"]},{name:"Indian/Reunion",utcOffset:240,offsetStr:"+04:00",countries:["RE","TF"]},{name:"Europe/Bucharest",utcOffset:120,offsetStr:"+02:00",countries:["RO"]},{name:"Europe/Belgrade",utcOffset:60,offsetStr:"+01:00",countries:["RS","BA","HR","ME","MK","SI"]},{name:"Europe/Kaliningrad",utcOffset:120,offsetStr:"+02:00",countries:["RU"]},{name:"Europe/Moscow",utcOffset:180,offsetStr:"+03:00",countries:["RU"]},{name:"Europe/Simferopol",utcOffset:180,offsetStr:"+03:00",countries:["RU"]},{name:"Europe/Volgograd",utcOffset:180,offsetStr:"+03:00",countries:["RU"]},{name:"Europe/Samara",utcOffset:240,offsetStr:"+04:00",countries:["RU"]},{name:"Asia/Yekaterinburg",utcOffset:300,offsetStr:"+05:00",countries:["RU"]},{name:"Asia/Omsk",utcOffset:360,offsetStr:"+06:00",countries:["RU"]},{name:"Asia/Novosibirsk",utcOffset:360,offsetStr:"+06:00",countries:["RU"]},{name:"Asia/Novokuznetsk",utcOffset:420,offsetStr:"+07:00",countries:["RU"]},{name:"Asia/Krasnoyarsk",utcOffset:420,offsetStr:"+07:00",countries:["RU"]},{name:"Asia/Irkutsk",utcOffset:480,offsetStr:"+08:00",countries:["RU"]},{name:"Asia/Chita",utcOffset:480,offsetStr:"+08:00",countries:["RU"]},{name:"Asia/Yakutsk",utcOffset:540,offsetStr:"+09:00",countries:["RU"]},{name:"Asia/Khandyga",utcOffset:540,offsetStr:"+09:00",countries:["RU"]},{name:"Asia/Vladivostok",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Sakhalin",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Ust-Nera",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Magadan",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Srednekolymsk",utcOffset:660,offsetStr:"+11:00",countries:["RU"]},{name:"Asia/Kamchatka",utcOffset:720,offsetStr:"+12:00",countries:["RU"]},{name:"Asia/Anadyr",utcOffset:720,offsetStr:"+12:00",countries:["RU"]},{name:"Asia/Riyadh",utcOffset:180,offsetStr:"+03:00",countries:["SA","KW","YE"]},{name:"Pacific/Guadalcanal",utcOffset:660,offsetStr:"+11:00",countries:["SB"]},{name:"Indian/Mahe",utcOffset:240,offsetStr:"+04:00",countries:["SC"]},{name:"Africa/Khartoum",utcOffset:180,offsetStr:"+03:00",countries:["SD","SS"]},{name:"Europe/Stockholm",utcOffset:60,offsetStr:"+01:00",countries:["SE"]},{name:"Asia/Singapore",utcOffset:480,offsetStr:"+08:00",countries:["SG"]},{name:"America/Paramaribo",utcOffset:-180,offsetStr:"-03:00",countries:["SR"]},{name:"America/El_Salvador",utcOffset:-360,offsetStr:"-06:00",countries:["SV"]},{name:"Asia/Damascus",utcOffset:120,offsetStr:"+02:00",countries:["SY"]},{name:"America/Grand_Turk",utcOffset:-240,offsetStr:"-04:00",countries:["TC"]},{name:"Africa/Ndjamena",utcOffset:60,offsetStr:"+01:00",countries:["TD"]},{name:"Indian/Kerguelen",utcOffset:300,offsetStr:"+05:00",countries:["TF"]},{name:"Asia/Bangkok",utcOffset:420,offsetStr:"+07:00",countries:["TH","KH","LA","VN"]},{name:"Asia/Dushanbe",utcOffset:300,offsetStr:"+05:00",countries:["TJ"]},{name:"Pacific/Fakaofo",utcOffset:780,offsetStr:"+13:00",countries:["TK"]},{name:"Asia/Dili",utcOffset:540,offsetStr:"+09:00",countries:["TL"]},{name:"Asia/Ashgabat",utcOffset:300,offsetStr:"+05:00",countries:["TM"]},{name:"Africa/Tunis",utcOffset:60,offsetStr:"+01:00",countries:["TN"]},{name:"Pacific/Tongatapu",utcOffset:780,offsetStr:"+13:00",countries:["TO"]},{name:"Europe/Istanbul",utcOffset:120,offsetStr:"+02:00",countries:["TR"]},{name:"America/Port_of_Spain",utcOffset:-240,offsetStr:"-04:00",countries:["TT","AG","AI","BL","DM","GD","GP","KN","LC","MF","MS","VC","VG","VI"]},{name:"Pacific/Funafuti",utcOffset:720,offsetStr:"+12:00",countries:["TV"]},{name:"Asia/Taipei",utcOffset:480,offsetStr:"+08:00",countries:["TW"]},{name:"Europe/Kiev",utcOffset:120,offsetStr:"+02:00",countries:["UA"]},{name:"Europe/Uzhgorod",utcOffset:120,offsetStr:"+02:00",countries:["UA"]},{name:"Europe/Zaporozhye",utcOffset:120,offsetStr:"+02:00",countries:["UA"]},{name:"Pacific/Wake",utcOffset:720,offsetStr:"+12:00",countries:["UM"]},{name:"America/New_York",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Detroit",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Kentucky/Louisville",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Kentucky/Monticello",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Indianapolis",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Vincennes",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Winamac",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Marengo",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Petersburg",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Vevay",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Chicago",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Indiana/Tell_City",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Indiana/Knox",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Menominee",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/North_Dakota/Center",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/North_Dakota/New_Salem",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/North_Dakota/Beulah",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Denver",utcOffset:-420,offsetStr:"-07:00",countries:["US"]},{name:"America/Boise",utcOffset:-420,offsetStr:"-07:00",countries:["US"]},{name:"America/Phoenix",utcOffset:-420,offsetStr:"-07:00",countries:["US"]},{name:"America/Los_Angeles",utcOffset:-480,offsetStr:"-08:00",countries:["US"]},{name:"America/Metlakatla",utcOffset:-480,offsetStr:"-08:00",countries:["US"]},{name:"America/Anchorage",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Juneau",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Sitka",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Yakutat",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Nome",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Adak",utcOffset:-600,offsetStr:"-10:00",countries:["US"]},{name:"Pacific/Honolulu",utcOffset:-600,offsetStr:"-10:00",countries:["US","UM"]},{name:"America/Montevideo",utcOffset:-180,offsetStr:"-03:00",countries:["UY"]},{name:"Asia/Samarkand",utcOffset:300,offsetStr:"+05:00",countries:["UZ"]},{name:"Asia/Tashkent",utcOffset:300,offsetStr:"+05:00",countries:["UZ"]},{name:"America/Caracas",utcOffset:-270,offsetStr:"-04:30",countries:["VE"]},{name:"Asia/Ho_Chi_Minh",utcOffset:420,offsetStr:"+07:00",countries:["VN"]},{name:"Pacific/Efate",utcOffset:660,offsetStr:"+11:00",countries:["VU"]},{name:"Pacific/Wallis",utcOffset:720,offsetStr:"+12:00",countries:["WF"]},{name:"Pacific/Apia",utcOffset:840,offsetStr:"+14:00",countries:["WS"]},{name:"Africa/Johannesburg",utcOffset:120,offsetStr:"+02:00",countries:["ZA","LS","SZ"]}]}],link:function(e,n,t,a){e.updateModel=function(e){a.$setViewValue(e)}},templateUrl:"app/core/directives/ms-timezone/ms-timezone.html"}})}(),function(){"use strict";angular.module("app.core").controller("MsWidgetEngineCounterController",function(){var s=this;s.filter=[],s.filtered=!1,s.fontSize=20,s.label="",s.getCount=function(a){var i=0;if(a){s.fontSize=a.attrs[2]&&a.attrs[2].value?parseInt(a.attrs[2].value)-parseInt(a.attrs[2].value)%2:20;var e=a.attrs.find(function(e){return"attrChannel"===e.name});e||a.attrs.push({name:"attrChannel",value:"voice"}),a.attrs.forEach(function(e,n){if("voice"!==a.attrs[3].value?"talking"===a.attrs[0].value?s.label="Opened":"answered"===a.attrs[0].value?s.label="Managed":s.label=a.attrs[0].value:s.label=a.attrs[0].value,!_.isEmpty(e.value))if(e.name.toLowerCase().includes("voice")){a.attrs[n].value&&a.attrs[n].value.length?(s.filtered=!0,s.filter=_.intersection(a.voiceQueuesSelected,a.attrs[n].value)):(s.filtered=!1,s.filter=a.voiceQueuesSelected);for(var t=0;t<a.voiceQueues.rows.length;t+=1)_.includes(s.filter,a.voiceQueues.rows[t].id)&&(i+=a.voiceQueues.rows[t][a.attrs[0].value]?parseInt(a.voiceQueues.rows[t][a.attrs[0].value]):0)}else if(e.name.toLowerCase().includes("chat")){a.attrs[n].value&&a.attrs[n].value.length?(s.filtered=!0,s.filter=_.intersection(a.chatWebsitesSelected,a.attrs[n].value)):(s.filtered=!1,s.filter=a.chatWebsitesSelected);for(var t=0;t<a.chatWebsites.rows.length;t+=1)_.includes(s.filter,a.chatWebsites.rows[t].id)&&(i+=a.chatWebsites.rows[t][a.attrs[0].value]?parseInt(a.chatWebsites.rows[t][a.attrs[0].value]):0)}else if(e.name.toLowerCase().includes("fax")){a.attrs[n].value&&a.attrs[n].value.length?(s.filtered=!0,s.filter=_.intersection(a.faxAccountsSelected,a.attrs[n].value)):(s.filtered=!1,s.filter=a.faxAccountsSelected);for(var t=0;t<a.faxAccounts.rows.length;t+=1)_.includes(s.filter,a.faxAccounts.rows[t].id)&&(i+=a.faxAccounts.rows[t][a.attrs[0].value]?parseInt(a.faxAccounts.rows[t][a.attrs[0].value]):0)}else if(e.name.toLowerCase().includes("mail")){a.attrs[n].value&&a.attrs[n].value.length?(s.filtered=!0,s.filter=_.intersection(a.mailAccountsSelected,a.attrs[n].value)):(s.filtered=!1,s.filter=a.mailAccountsSelected);for(var t=0;t<a.mailAccounts.rows.length;t+=1)_.includes(s.filter,a.mailAccounts.rows[t].id)&&(i+=a.mailAccounts.rows[t][a.attrs[0].value]?parseInt(a.mailAccounts.rows[t][a.attrs[0].value]):0)}else if(e.name.toLowerCase().includes("openchannel")){a.attrs[n].value&&a.attrs[n].value.length?(s.filtered=!0,s.filter=_.intersection(a.openchannelAccountsSelected,a.attrs[n].value)):(s.filtered=!1,s.filter=a.openchannelAccountsSelected);for(var t=0;t<a.openchannelAccounts.rows.length;t+=1)_.includes(s.filter,a.openchannelAccounts.rows[t].id)&&(i+=a.openchannelAccounts.rows[t][a.attrs[0].value]?parseInt(a.openchannelAccounts.rows[t][a.attrs[0].value]):0)}else if(e.name.toLowerCase().includes("whatsapp")){a.attrs[n].value&&a.attrs[n].value.length?(s.filtered=!0,s.filter=_.intersection(a.whatsappAccountsSelected,a.attrs[n].value)):(s.filtered=!1,s.filter=a.whatsappAccountsSelected);for(var t=0;t<a.whatsappAccounts.rows.length;t+=1)_.includes(s.filter,a.whatsappAccounts.rows[t].id)&&(i+=a.whatsappAccounts.rows[t][a.attrs[0].value]?parseInt(a.whatsappAccounts.rows[t][a.attrs[0].value]):0)}else if(e.name.toLowerCase().includes("sms")){a.attrs[n].value&&a.attrs[n].value.length?(s.filtered=!0,s.filter=_.intersection(a.smsAccountsSelected,a.attrs[n].value)):(s.filtered=!1,s.filter=a.smsAccountsSelected);for(var t=0;t<a.smsAccounts.rows.length;t+=1)_.includes(s.filter,a.smsAccounts.rows[t].id)&&(i+=a.smsAccounts.rows[t][a.attrs[0].value]?parseInt(a.smsAccounts.rows[t][a.attrs[0].value]):0)}})}return i}})}(),function(){"use strict";function e(r,e){var l=this;l.filter=[],l.filtered=!1,l.properties=[],l.multiBarChart={labels:["QUEUE_NAME"],series:["TOTAL"],data:[[50]],options:{responsive:!0,legend:{display:!0,fontColor:"#2196f3"},scales:{xAxes:[{gridLines:{display:!0},ticks:{fontColor:"#2196f3",stepSize:1,beginAtZero:!0}}],yAxes:[{gridLines:{display:!1},ticks:{fontColor:"#2196f3"}}]}}},l.getMultiBarChart=function(e){e&&(e.attrs&&function(e){switch(l.properties=_.map(_.filter(e.attrs,function(e){return e.name&&0<=e.name.indexOf("attrSerie")&&e.value&&"null"!==e.value}),"value"),e.attrs[4].value){case"voice":e.attrs[3].value&&e.attrs[3].value.length?(l.filtered=!0,l.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(l.filtered=!1,l.filter=e.voiceQueuesSelected);break;case"sms":e.attrs[7].value&&e.attrs[7].value.length?(l.filtered=!0,l.filter=_.intersection(e.smsAccountsSelected,e.attrs[7].value)):(l.filtered=!1,l.filter=e.smsAccountsSelected);break;case"mail":e.attrs[5].value&&e.attrs[5].value.length?(l.filtered=!0,l.filter=_.intersection(e.mailAccountsSelected,e.attrs[5].value)):(l.filtered=!1,l.filter=e.mailAccountsSelected);break;case"chat":e.attrs[10].value&&e.attrs[10].value.length?(l.filtered=!0,l.filter=_.intersection(e.chatWebsitesSelected,e.attrs[10].value)):(l.filtered=!1,l.filter=e.chatWebsitesSelected);break;case"fax":e.attrs[6].value&&e.attrs[6].value.length?(l.filtered=!0,l.filter=_.intersection(e.faxAccountsSelected,e.attrs[6].value)):(l.filtered=!1,l.filter=e.faxAccountsSelected);break;case"openchannel":e.attrs[8].value&&e.attrs[8].value.length?(l.filtered=!0,l.filter=_.intersection(e.openchannelAccountsSelected,e.attrs[8].value)):(l.filtered=!1,l.filter=e.openchannelAccountsSelected);break;case"whatsapp":e.attrs[9].value&&e.attrs[9].value.length?(l.filtered=!0,l.filter=_.intersection(e.whatsappAccountsSelected,e.attrs[9].value)):(l.filtered=!1,l.filter=e.whatsappAccountsSelected);break;default:e.attrs[3].value&&e.attrs[3].value.length?(l.filtered=!0,l.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(l.filtered=!1,l.filter=e.voiceQueuesSelected)}if(l.multiBarChart.series.length>l.properties.length){var n=l.multiBarChart.series.length-l.properties.length;l.multiBarChart.series.splice(0,n),l.multiBarChart.data.splice(0,n)}for(var t=0;t<l.properties.length;t+=1){var a="";if(a="voice"!==e.attrs[4].value?"talking"===l.properties[t]?"Opened":"answered"===l.properties[t]?"Managed":l.properties[t]:l.properties[t],l.multiBarChart.series[t]=r.instant("TOOLS."+a.toUpperCase()),_.isNil(l.multiBarChart.data[t])&&(l.multiBarChart.data[t]=[]),l.multiBarChart.labels.length>l.filter.length){var i=l.multiBarChart.labels.length-l.filter.length;l.multiBarChart.labels.splice(0,i),l.multiBarChart.data[t].splice(0,i)}switch(e.attrs[4].value){case"voice":for(var s=0,o=0;s<e.voiceQueues.rows.length;s+=1)_.includes(l.filter,e.voiceQueues.rows[s].id)&&(l.multiBarChart.labels[o]=e.voiceQueues.rows[s].name,l.multiBarChart.data[t][o]=e.voiceQueues.rows[s][l.properties[t]]?parseInt(e.voiceQueues.rows[s][l.properties[t]]):0,o+=1);break;case"sms":for(var s=0,o=0;s<e.smsAccounts.rows.length;s+=1)_.includes(l.filter,e.smsAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.smsAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.smsAccounts.rows[s][l.properties[t]]?parseInt(e.smsAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"chat":for(var s=0,o=0;s<e.chatWebsites.rows.length;s+=1)_.includes(l.filter,e.chatWebsites.rows[s].id)&&(l.multiBarChart.labels[o]=e.chatWebsites.rows[s].name,l.multiBarChart.data[t][o]=e.chatWebsites.rows[s][l.properties[t]]?parseInt(e.chatWebsites.rows[s][l.properties[t]]):0,o+=1);break;case"fax":for(var s=0,o=0;s<e.faxAccounts.rows.length;s+=1)_.includes(l.filter,e.faxAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.faxAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.faxAccounts.rows[s][l.properties[t]]?parseInt(e.faxAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"mail":for(var s=0,o=0;s<e.mailAccounts.rows.length;s+=1)_.includes(l.filter,e.mailAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.mailAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.mailAccounts.rows[s][l.properties[t]]?parseInt(e.mailAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"openchannel":for(var s=0,o=0;s<e.openchannelAccounts.rows.length;s+=1)_.includes(l.filter,e.openchannelAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.openchannelAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.openchannelAccounts.rows[s][l.properties[t]]?parseInt(e.openchannelAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"whatsapp":for(var s=0,o=0;s<e.whatsappAccounts.rows.length;s+=1)_.includes(l.filter,e.whatsappAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.whatsappAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.whatsappAccounts.rows[s][l.properties[t]]?parseInt(e.whatsappAccounts.rows[s][l.properties[t]]):0,o+=1);break;default:for(var s=0,o=0;s<e.voiceQueues.rows.length;s+=1)_.includes(l.filter,e.voiceQueues.rows[s].id)&&(l.multiBarChart.labels[o]=e.voiceQueues.rows[s].name,l.multiBarChart.data[t][o]=e.voiceQueues.rows[s][l.properties[t]]?parseInt(e.voiceQueues.rows[s][l.properties[t]]):0,o+=1)}}}(e),e.foreground&&function(e){l.multiBarChart.options.legend.fontColor=e.foreground;for(var n=0;n<l.multiBarChart.options.scales.xAxes.length;n+=1)l.multiBarChart.options.scales.xAxes[n].ticks.fontColor=e.foreground;for(var t=0;t<l.multiBarChart.options.scales.yAxes.length;t+=1)l.multiBarChart.options.scales.yAxes[t].ticks.fontColor=e.foreground}(e))}}e.$inject=["$translate","socket"],angular.module("app.core").controller("MsWidgetEngineMultibarChartController",e)}(),function(){"use strict";function e(s){var o=this;o.filter=[],o.filtered=!1,o.properties=[],o.pieChart={labels:["ANSWERED"],data:[30],options:{responsive:!0,legend:{display:!0}}},o.getPieChart=function(e){e&&(e.attrs&&function(e){switch(o.properties=_.map(_.filter(e.attrs,function(e){return e.name&&0<=e.name.indexOf("attrSerie")&&e.value&&"null"!==e.value}),"value"),e.attrs[4].value){case"voice":e.attrs[3].value&&e.attrs[3].value.length?(o.filtered=!0,o.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(o.filtered=!1,o.filter=e.voiceQueuesSelected);break;case"sms":e.attrs[7].value&&e.attrs[7].value.length?(o.filtered=!0,o.filter=_.intersection(e.smsAccountsSelected,e.attrs[7].value)):(o.filtered=!1,o.filter=e.smsAccountsSelected);break;case"mail":e.attrs[5].value&&e.attrs[5].value.length?(o.filtered=!0,o.filter=_.intersection(e.mailAccountsSelected,e.attrs[5].value)):(o.filtered=!1,o.filter=e.mailAccountsSelected);break;case"chat":e.attrs[10].value&&e.attrs[10].value.length?(o.filtered=!0,o.filter=_.intersection(e.chatWebsitesSelected,e.attrs[10].value)):(o.filtered=!1,o.filter=e.chatWebsitesSelected);break;case"fax":e.attrs[6].value&&e.attrs[6].value.length?(o.filtered=!0,o.filter=_.intersection(e.faxAccountsSelected,e.attrs[6].value)):(o.filtered=!1,o.filter=e.faxAccountsSelected);break;case"openchannel":e.attrs[8].value&&e.attrs[8].value.length?(o.filtered=!0,o.filter=_.intersection(e.openchannelAccountsSelected,e.attrs[8].value)):(o.filtered=!1,o.filter=e.openchannelAccountsSelected);break;case"whatsapp":e.attrs[9].value&&e.attrs[9].value.length?(o.filtered=!0,o.filter=_.intersection(e.whatsappAccountsSelected,e.attrs[9].value)):(o.filtered=!1,o.filter=e.whatsappAccountsSelected);break;default:e.attrs[3].value&&e.attrs[3].value.length?(o.filtered=!0,o.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(o.filtered=!1,o.filter=e.voiceQueuesSelected)}if(o.pieChart.labels.length>o.properties.length){var n=o.pieChart.labels.length-o.properties.length;o.pieChart.labels.splice(0,n),o.pieChart.data.splice(0,n)}for(var t=0,a=0;t<o.properties.length;t+=1){switch("voice"!==e.attrs[4].value?"talking"===o.properties[t]?o.pieChart.labels[t]=s.instant("TOOLS.OPENED"):"answered"===o.properties[t]?o.pieChart.labels[t]=s.instant("TOOLS.MANAGED"):o.pieChart.labels[t]=s.instant("TOOLS."+o.properties[t].toUpperCase()):o.pieChart.labels[t]=s.instant("TOOLS."+o.properties[t].toUpperCase()),e.attrs[4].value){case"voice":for(var i=0;i<e.voiceQueues.rows.length;i+=1)_.includes(o.filter,e.voiceQueues.rows[i].id)&&(a+=e.voiceQueues.rows[i][o.properties[t]]?parseInt(e.voiceQueues.rows[i][o.properties[t]]):0);break;case"sms":for(var i=0;i<e.smsAccounts.rows.length;i+=1)_.includes(o.filter,e.smsAccounts.rows[i].id)&&(a+=e.smsAccounts.rows[i][o.properties[t]]?parseInt(e.smsAccounts.rows[i][o.properties[t]]):0);break;case"chat":for(var i=0;i<e.chatWebsites.rows.length;i+=1)_.includes(o.filter,e.chatWebsites.rows[i].id)&&(a+=e.chatWebsites.rows[i][o.properties[t]]?parseInt(e.chatWebsites.rows[i][o.properties[t]]):0);break;case"fax":for(var i=0;i<e.faxAccounts.rows.length;i+=1)_.includes(o.filter,e.faxAccounts.rows[i].id)&&(a+=e.faxAccounts.rows[i][o.properties[t]]?parseInt(e.faxAccounts.rows[i][o.properties[t]]):0);break;case"mail":for(var i=0;i<e.mailAccounts.rows.length;i+=1)_.includes(o.filter,e.mailAccounts.rows[i].id)&&(a+=e.mailAccounts.rows[i][o.properties[t]]?parseInt(e.mailAccounts.rows[i][o.properties[t]]):0);break;case"openchannel":for(var i=0;i<e.openchannelAccounts.rows.length;i+=1)_.includes(o.filter,e.openchannelAccounts.rows[i].id)&&(a+=e.openchannelAccounts.rows[i][o.properties[t]]?parseInt(e.openchannelAccounts.rows[i][o.properties[t]]):0);break;case"whatsapp":for(var i=0;i<e.whatsappAccounts.rows.length;i+=1)_.includes(o.filter,e.whatsappAccounts.rows[i].id)&&(a+=e.whatsappAccounts.rows[i][o.properties[t]]?parseInt(e.whatsappAccounts.rows[i][o.properties[t]]):0);break;default:for(var i=0;i<e.voiceQueues.rows.length;i+=1)_.includes(o.filter,e.voiceQueues.rows[i].id)&&(a+=e.voiceQueues.rows[i][o.properties[t]]?parseInt(e.voiceQueues.rows[i][o.properties[t]]):0)}o.pieChart.data[t]=a,a=0}}(e),e.foreground&&(n=e,o.pieChart.options.legend.fontColor=n.foreground));var n}}e.$inject=["$translate"],angular.module("app.core").controller("MsWidgetEnginePieChartController",e)}(),function(){"use strict";function e(e,t,a,i){var s=this;function n(e){s.results=e||{count:0,rows:[]}}function o(){s.query.offset=(s.query.page-1)*s.query.limit,s.promise=i[s.reportRoute].run(s.query,n).$promise}s.countDown=0,s.refresh=0,s.title="",s.columns=[],s.results={rows:[],count:0},s.query={limit:10,page:1,startDate:moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),endDate:moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),output:"web"},s.onInit=function e(n){n&&n.attrs&&(n.attrs[0]&&n.attrs[0].value&&(s.query.id=n.attrs[0].value,i.analyticFieldReport.get({fields:"field,alias",nolimit:!0,DefaultReportId:"default"===n.attrs[0].type?n.attrs[0].value:void 0,CustomReportId:"custom"===n.attrs[0].type?n.attrs[0].value:void 0}).$promise.then(function(e){switch(e&&e.rows&&(s.columns=e.rows),n.attrs[0].type){case"default":s.reportRoute="analyticDefaultReport";break;case"custom":s.reportRoute="analyticCustomReport"}return i[s.reportRoute].get({id:n.attrs[0].value,fields:"id,name"}).$promise}).then(function(e){e&&e.name&&(s.title=e.name),o()}).catch(function(e){console.log(e)})),n.attrs[1]&&n.attrs[1].value&&(s.refresh=parseInt(n.attrs[1].value),!_.isNaN(s.refresh)&&0<s.refresh?(s.countDown=parseInt(n.attrs[1].value),s.interval=a(function(){s.countDown-=1},1e3,0),s.timeout=t(function(){s.interval&&a.cancel(s.interval),e(n)},1e3*s.refresh)):(s.interval&&a.cancel(s.interval),s.timeout&&t.cancel(s.timeout))))},s.getResults=o,s.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n},e.$on("$destroy",function(){s.interval&&a.cancel(s.interval),s.timeout&&t.cancel(s.timeout)})}e.$inject=["$scope","$timeout","$interval","api"],angular.module("app.core").controller("MsWidgetEngineWebReportController",e)}(),function(){"use strict";function e(e,n){this.getTrustedURL=function(e){return n.trustAsResourceUrl(e)}}function n(e){return{restrict:"E",scope:{config:"=?",onEdit:"&?",onDelete:"&?"},require:"msWidgetEngine",controller:"MsWidgetEngineController",controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-widget-engine/ms-widget-engine.html"}}e.$inject=["$mdDialog","$sce"],n.$inject=["$document"],angular.module("app.core").controller("MsWidgetEngineController",e).directive("msWidgetEngine",n)}(),function(){"use strict";function e(e,n){var t=this;t.flipped=!1,t.flip=function(){if(!angular.isDefined(e.flippable)||!0!==e.flippable)return;t.flipped=!t.flipped,n.toggleClass("flipped",t.flipped)}}e.$inject=["$scope","$element"],angular.module("app.core").controller("MsWidgetController",e).directive("msWidget",function(){return{restrict:"E",scope:{flippable:"=?"},controller:"MsWidgetController",transclude:!0,compile:function(e){return e.addClass("ms-widget"),function(e,n,t,a,i){i(function(e){n.empty(),n.append(e)})}}}}).directive("msWidgetFront",function(){return{restrict:"E",require:"^msWidget",transclude:!0,compile:function(e){return e.addClass("ms-widget-front"),function(e,n,t,a,i){i(function(e){n.empty(),n.append(e)}),e.flipWidget=a.flip}}}}).directive("msWidgetBack",function(){return{restrict:"E",require:"^msWidget",transclude:!0,compile:function(e){return e.addClass("ms-widget-back"),function(e,n,t,a,i){i(function(e){n.empty(),n.append(e)}),e.flipWidget=a.flip}}}})}(),function(){"use strict";function e(s,n,o,r){return{restrict:"A",require:"?ngModel",link:function(t,a,e,i){o.isAdmin()||o.isTelephone()||(""!==e.privacy||o.getCurrentUser().privacyEnabled)&&!1!==t.$eval(e.privacy)&&(i?(i.$formatters.push(function(e){if(!e)return e;var n=r.mask(e);return i.$setViewValue(n),i.$render(),i.$viewValue}),i.$parsers.push(function(){return i.$modelValue}),a[0].disabled=!0):n(function(){s(a.contents())(t);var e=a.text();if(e){var n=r.mask(e);a.text(n)}}))}}}e.$inject=["$compile","$timeout","Auth","privacyManager"],angular.module("app.core").directive("privacy",e)}(),function(){"use strict";function e(d,c,t,v){function h(e,n){return"motion2.home."+e+":"+n}function f(e){return _.capitalize(e)+("chat"===e?"Website":"Account")+"Id"}function m(e){return"chat"===e?"Website":"Account"}function b(e,n,t){var a=h(n,t);v.set(a,e)}return{addAccount:function(r,e){var l=e.accounts,d=e.accountId,c=e.filters,m=e.query,u=e.userId,n="get"+_.capitalize(r)+("chat"===r?"Websites":"Accounts"),p=f(r),g=l.rows.length===m[p].length;return t.user[n]({id:u,nolimit:!0}).$promise.then(function(e){var n,t,a,i,s;if(l.rows=e.rows,l.count=e.count,_.find(c,["name","Account"]).options=l.rows,g){var o=(t=d,a=h(n=r,u),i=f(n),(s=v.get(a)).query&&s.query[i]&&s.query[i].push(t),s);o&&b(o,r,u),m[p].push(d)}return g})},removeAccount:function(t,e){var n=e.accounts,a=e.accountId,i=e.filters,s=e.query,o=e.userId,r=f(t),l=s[r].includes(a);return c.resolve().then(function(){var e=function(e,n,t){var a=h(e,n),i=f(e),s=v.get(a);if(s.query&&s.query[i]){var o=s.query[i].indexOf(t);-1<o&&s.query[i].splice(o,1)}return s}(t,o,a);e||(e=s),s[r]=e.query[r],_.remove(n.rows,function(e){return e.id===a}),n.count=n.rows.length,_.find(i,function(e){var n=m(t);return e.name===n}).options=n.rows,1===n.count&&(e.query[r]=[n.rows[0].id],s[r]=[n.rows[0].id]),b(e,t,o)}).then(function(){var e=m(t);d.$broadcast("ms-quick-filter:update",{filters:[e],update:l})})}}}e.$inject=["$rootScope","$q","api","localStorageManager"],angular.module("app.core").factory("agentAccountAssociationManager",e)}(),function(){"use strict";function e(o,r,i,l,d){var e={get:function(s,a){return o(function(n,t){0===a.offset&&(s=void 0);var e=_.merge({},a);i.cmContact.getJourney(e).$promise.then(function(e){var a,n=_(e.rows).uniqBy(function(e){return e.channel}).map("channel").value();return(a=n,o(function(e,n){var t=a.map(function(n){if("voice"!==n){var e="get"+_.startCase(n)+("chat"===n?"Websites":"Accounts");return i.user[e]({id:l.getCurrentUser().id,attributes:["id","name"],nolimit:!0}).$promise.then(function(e){c[n]=e.rows})}});return o.all(t).then(function(){e()}).catch(function(e){n(e)})})).then(function(){return e.rows.forEach(function(e){var n;e.canOpen=function(e){switch(e.channel){case"chat":return!!c.chat&&_.some(c.chat,["id",e.ChatWebsiteId]);case"fax":return!!c.fax&&_.some(c.fax,["id",e.FaxAccountId]);case"mail":return!!c.mail&&_.some(c.mail,["id",e.MailAccountId]);case"openchannel":return!!c.openchannel&&_.some(c.openchannel,["id",e.OpenchannelAccountId]);case"sms":return!!c.sms&&_.some(c.sms,["id",e.SmsAccountId]);case"voice":return!0;case"whatsapp":return!!c.whatsapp&&_.some(c.whatsapp,["id",e.WhatsappAccountId]);default:return!1}}(e),e.dispositionsValues=(n=e).disposition?"("+_.compact([n.disposition,n.secondDisposition,n.thirdDisposition]).join(" - ")+")":"("+r.instant("DASHBOARDS.NO_DISPOSITION_SET")+")",e.style=function(e){switch(e.channel){case"chat":return{color:"green-A700",icon:"icon-hangouts"};case"fax":return{color:"blue-grey-A200",icon:"icon-deskphone"};case"mail":return{color:"teal",icon:"icon-email"};case"openchannel":return{color:"amber-A200",icon:"icon-google-earth"};case"sms":return{color:"orange",icon:"icon-message-text"};case"voice":return{color:"blue-A700",icon:"icon-phone"};case"whatsapp":return{color:"lime-A700",icon:"icon-whatsapp"}}}(e)}),a=s,i=e,o(function(e,n){try{var t={journey:a?_.union(a,i.rows):i.rows};t.loadMore=0<i.count-t.journey.length,e(t)}catch(e){n(e)}});var a,i})}).then(function(e){n(e)}).catch(function(e){d.error({title:r.instant("CONTACTMANAGER.CUSTOMER_JOURNEY"),msg:r.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")}),t(e)})})},getQuery:function(){return{range:{from:moment().subtract(3,"M").startOf("month").format("YYYY-MM-DD HH:mm:ss"),to:moment().endOf("month").format("YYYY-MM-DD HH:mm:ss")},limit:10,offset:0}},getQuickFilters:function(){return[{name:"Channel",key:"channel",type:"select",label:"INTEGRATIONS.CHANNEL",customOptions:[{value:void 0,translate:"DASHBOARDS.ALL"},{value:"voice",translate:"DASHBOARDS.VOICE"},{value:"chat",translate:"DASHBOARDS.CHAT"},{value:"mail",translate:"DASHBOARDS.MAIL"},{value:"sms",translate:"DASHBOARDS.SMS"},{value:"fax",translate:"DASHBOARDS.FAX"},{value:"openchannel",translate:"DASHBOARDS.OPENCHANNEL"},{value:"whatsapp",translate:"DASHBOARDS.WHATSAPP"}]},{name:"Start Date",key:"range",type:"date",label:"DASHBOARDS.SELECT_DATE",useFromToKeys:!0}]}},c={};return e}e.$inject=["$q","$translate","api","Auth","toasty"],angular.module("app.core").factory("customerJourneyManager",e)}(),function(){"use strict";function e(p,e){var g={localizationMap:e,setSelectedDate:function(e){var n=e.$gte?new Date(moment.utc(e.$gte).format("YYYY-MM-DD")):new Date(moment.utc(e.from).format("YYYY-MM-DD")),t=e.$lte?new Date(moment.utc(e.$lte).format("YYYY-MM-DD")):new Date(moment.utc(e.to).format("YYYY-MM-DD")),a={dateStart:new Date(n.getFullYear(),n.getMonth(),n.getDate()),dateEnd:new Date(t.getFullYear(),t.getMonth(),t.getDate())};return a.selectedTemplateName=(i=a,moment(i.dateStart).isSame(i.dateEnd)?(u=i,moment().startOf("day").isSame(u.dateStart)?g.localizationMap.Today:(m=i,moment().subtract(1,"days").startOf("day").isSame(m.dateStart)?g.localizationMap.Yesterday:p("date")(i.dateStart,"dd MMM yyyy"))):(c=i,moment().startOf("isoWeek").isSame(c.dateStart,"day")&&moment().endOf("isoWeek").isSame(c.dateEnd,"day")?g.localizationMap["This Week"]:(d=i,moment().subtract(1,"weeks").startOf("isoWeek").isSame(d.dateStart,"day")&&moment().subtract(1,"weeks").endOf("isoWeek").isSame(d.dateEnd,"day")?g.localizationMap["Last Week"]:(l=i,moment().startOf("month").isSame(l.dateStart,"day")&&moment().endOf("month").isSame(l.dateEnd,"day")?g.localizationMap["This Month"]:(r=i,moment().subtract(1,"months").startOf("month").isSame(r.dateStart,"day")&&moment().subtract(1,"months").endOf("month").isSame(r.dateEnd,"day")?g.localizationMap["Last Month"]:(o=i,moment().startOf("year").isSame(o.dateStart,"day")&&moment().endOf("year").isSame(o.dateEnd,"day")?g.localizationMap["This Year"]:(s=i,moment().subtract(1,"years").startOf("year").isSame(s.dateStart,"day")&&moment().subtract(1,"years").endOf("year").isSame(s.dateEnd,"day")?g.localizationMap["Last Year"]:p("date")(i.dateStart,"dd"+(i.dateStart.getMonth()!==i.dateEnd.getMonth()||i.dateStart.getFullYear()!==i.dateEnd.getFullYear()?" MMM":"")+(i.dateStart.getFullYear()!==i.dateEnd.getFullYear()?" yyyy":""))+" - "+p("date")(i.dateEnd,"dd MMM yyyy")))))))),a;var i,s,o,r,l,d,c,m,u}};return g}e.$inject=["$filter","dateFilterLocalizationFactory"],angular.module("app.core").factory("dateRangeManager",e)}(),function(){"use strict";function e(t,a,n,i,s){var o={},r={},l={},d={};function c(){r=i.getCurrentUser();var e=n.localStorage.getItem("motion2.home:"+r.id);if(l=e?JSON.parse(e).currentSidebarTab:"dashboard",d=n.localStorage.getItem("motion2.home."+l+":"+r.id)){var a=JSON.parse(d);a.drafts?r.privacyEnabled&&Object.keys(a.drafts).forEach(function(e){var n=a.drafts[e].title,t=n.split(/-(.+)/)[1].trim();a.drafts[e].title=n.replace(t,s.mask(t))}):a.drafts={},d=a}else d={drafts:{}};return d.drafts}function m(){_.isEmpty(o.drafts)?delete d.drafts:d.drafts=o.drafts,n.localStorage.setItem("motion2.home."+l+":"+r.id,JSON.stringify(d))}return o.init=function(){o.drafts=c()},o.getByInteraction=function(n){return o.drafts=c(),_.find(_.values(o.drafts),function(e){return e.interaction&&e.interaction.id===n})},o.removeByInteraction=function(n){o.drafts=c();var e=_.find(_.values(o.drafts),function(e){return e.interaction&&e.interaction.id===n});e&&(delete o.drafts[e.id],m())},o.add=function(e){o.drafts=c();var n=a.instant("DASHBOARDS.UNTITLED");e.contact?n=e.contact.firstName||e.contact.email:_.isEmpty(e.message.subject)||(n=e.message.subject);var t={type:"draft",title:e.account.key+" - "+n,channel:e.channel,content:e.message,account:e.account,interaction:e.interaction,id:_.random(1e10),openedAt:new Date,saved:!1};o.drafts[t.id]=t,m()},o.update=function(e){o.drafts=c();var n=o.drafts[e.id];n&&(n.content=e.message,o.drafts[e.id]=n,m())},o.open=function(e){o.drafts=c();var n=o.drafts[e];n&&t.$broadcast("open"+_.startCase(l)+"Draft",n)},o.remove=function(e){o.drafts=c(),o.drafts[e]&&(delete o.drafts[e],m())},o}e.$inject=["$rootScope","$translate","$window","Auth","privacyManager"],angular.module("app.core").factory("draftManager",e)}(),function(){"use strict";function e(s){var o=[];return function(n,e){e||(e="global-exception");var t,a=s.get("ClientSideLoggingService").getLogger("global-exception"),i=o.findIndex(function(e){return e===n});-1<i?(t=i,o.splice(t,1)):(!function(e){if(100<=o.length){var n=o.length-100+1;o.splice(0,n)}o.push(e)}(n),a.error(e,n))}}e.$inject=["$injector"],angular.module("app.core").factory("$exceptionHandler",e)}(),function(){"use strict";function e(o,i){function r(e,n){var t=i.localStorage.getItem(e),a=t?JSON.parse(t):{};return n?a[n]:a}function s(e,n){return i.localStorage.setItem(e,JSON.stringify(n))}return{get:r,parseInteractionsKey:function(e,n,t,a){var i="motion2.home."+e+":"+t,s=_.capitalize(e)+("chat"===e?"Website":"Account")+"Id";return o.resolve().then(function(){var e=r(i,"query");return e&&((n=_.merge(n,e)).sort&&0<=n.sort.indexOf("lastMessage")&&(n=_.omit(n,"sort")),n.includeAll=!0),1===a.length?n[s]=[a[0].id]:0===a.length&&(n[s]=[]),n}).catch(function(e){throw e})},set:s,update:function(e,n,t){var a=r(e);t?a[t]=n:a=n;return s(e,a)}}}e.$inject=["$q","$window"],angular.module("app.core").factory("localStorageManager",e)}(),function(){"use strict";function e(i){function s(e,n){var t=i.get(),a=0;if(t)switch(n){case"email":a=t.privacyPolicyEmail;break;case"number":a=t.privacyPolicyNumber;break;default:a=t.privacyPolicyName}return _.isNil(a)?e:0===a||a>e.length?e.replace(/./g,"*"):e.substring(0,e.length-a).padEnd(e.length,"*")}function o(e){return _.startsWith(e,"<")&&_.endsWith(e,">")&&(e=e.substring(1,e.length-1)),/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function r(e){if(_.startsWith(e,"<")&&_.endsWith(e,">")){var n=!0;e=e.substring(1,e.length-1)}var t=e.split("@")[0],a=e.split("@")[1],i="";return n&&(i+="<"),i+=s(t,"email"),i+="@",i+=s(a,"email"),n&&(i+=">"),i}return{mask:function n(e){t=e,e=t.replace(/\s\s+/g," ").trim();var t;{if(o(e))return r(e);if(/^[+]?[0-9|.|\-|\s]*$/.test(e))return s(e,"number");var a=[],i=e.split(" ");return 1===i.length?s(e):(i.forEach(function(e){a.push(n(e))}),a.join(" "))}}}}e.$inject=["settingsManager"],angular.module("app.core").factory("privacyManager",e)}(),function(){"use strict";function e(n,i){return{setPlaceholder:function(a){var e;return n(function(n){try{if(_.isEmpty(a.resources))e=i.instant("DASHBOARDS.NONE");else if(_.isEmpty(a.param))e=a.placeholder?i.instant(a.placeholder):i.instant("DASHBOARDS.CHOOSE");else if(a.param.length===a.resources.length)e=i.instant("DASHBOARDS.ALL");else{var t=a.ngValue||"id";e=_(a.resources).filter(function(e){return _.includes(a.param,e[t])}).map("name").value().join(", ")}n(e)}catch(e){n(null)}})}}}e.$inject=["$q","$translate"],angular.module("app.core").factory("quickFilterManager",e)}(),function(){"use strict";function e(t){var e={getAgentStatus:function(e){var n="unknown";n=o(e)?"pause":o(e,!0)?"*pause":function(e){if("idle"!==e.voiceStatus&&e.voicePause)return!(e.voiceStatus="pause");return _.every([e.chatStatus,e.faxStatus,e.mailStatus,e.openchannelStatus,e.smsStatus,e.voiceStatus,e.whatsappStatus],r)}(e)?"idle":"busy";return n},setAgentStatusDisplayValue:function(e){var n=e.globalStatus;"pause"===e.globalStatus?n=e.pauseType||t.instant("VOICE.DEFAULT_PAUSE"):"*pause"===e.globalStatus&&(n="*"+(e.pauseType||t.instant("VOICE.DEFAULT_PAUSE")));e.globalStatusDisplayValue=n},updateBusyCounter:s,updateQueue:function(e,n,t,a){var i=t.paused;!1===e.online?(t.online=!1,n.loggedInDb-=1,t.paused?(t.paused=!1,n.paused-=1):n.available-=1):t.online?!e[a+"Pause"]||t.paused||o(e,!0)?!e[a+"Pause"]&&t.paused?(t.paused=!1,t.talking||t.busy||(n.paused-=1,n.available+=1)):e[a+"Pause"]&&t.paused&&(t.talking||t.busy||(n.busy-=1,i||(n.paused+=1))):(t.paused=!0,t.talking||t.busy||(i||(n.paused+=1),0<n.available&&(n.available-=1))):(t.online=!0,n.loggedInDb+=1,n.available+=1);s(n)},updateVoiceQueue:function(e,n){e.loggedIn===e.available&&0<e.waiting&&(e.available-=e.waiting);var t=e.loggedIn-e.available-e.talking-e.waiting-n.paused;t<0?(n.paused-=Math.abs(t),n.waitingOrTalking=!0):0<t&&n.waitingOrTalking&&(n.paused+=1,delete n.waitingOrTalking);_.merge(n,_.pick(e,"inbound"===n.type?a:i)),"outbound"===n.type&&_.isNil(e.startPredictive)&&(n.startPredictive=void 0);s(n)}},a=["loggedIn","available","waiting","talking","paused"],i=["loggedIn","available","waiting","talking","pTalking","originated","message","dialActive","dialMethod","Trunk","paused","startPredictive","startProgressive","erlangCalls","erlangCallToSecond","erlangAbandonmentRate","erlangBusyFactor","dialPredictiveInterval","dialPredictiveIntervalMaxThreshold","dialPredictiveIntervalMinThreshold","predictiveIntervalAvailable","predictiveIntervalTotalCalls","predictiveIntervalAnsweredCalls","predictiveIntervalDroppedCallsTimeout","predictiveIntervalDroppedCallsCallersExit","predictiveIntervalAvgHoldtime","predictiveIntervalAvgTalktime"];function s(e){var n=_.filter(e.agents,["busy",!0]).length,t=e.loggedInDb-e.available-e.paused-e.talking-e.waiting;t<0&&(t=0),e.busy=t<n?n:t}function o(e,n){var t=[e.chatPause,e.faxPause,e.mailPause,e.openchannelPause,e.smsPause,e.voicePause,e.whatsappPause];if(!n)return _.every(t);var a=_.filter(t);return 0<a.length&&a.length<t.length}function r(e){if(_.isNil(e))return!0;return _.includes(["idle","unknown","unavailable","ringing"],e)}return e}e.$inject=["$translate"],angular.module("app.core").factory("realtimeManager",e)}(),function(){"use strict";angular.module("app.core").factory("settingsManager",function(){var n={};return{get:function(){return n},set:function(e){e&&(n=e.toJSON())}}})}(),function(){"use strict";function e(c,m){function u(e,n,t){if(_.isEmpty(n))return t;for(var a=0;a<n.length;a++){var i=n[a].key,s=_.find(e,function(e){return e[i]===n[a].value});s&&(_.some(t,["id",s.id])||(s.canSelect=!1,t.push(s)))}return t}return{getResources:function(a,i,s,o,r,l,d){return c(function(t,n){o||(o={}),d||(d="get"),a[s][d](o).$promise.then(function(e){var t=e.rows;if("admin"===i.role)return t;var n=m.getSectionId(s,l);return a.userProfileSection.get({userProfileId:i.userProfileId,sectionId:n}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?t:a.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(t,{id:e.resourceId})});return u(t,r,n)}):c.resolve().then(function(){return e=s,_.includes(["voiceContext"],e)?(o.defaultEntry=1,a[s][d](o).$promise.then(function(e){return e.rows})):[];var e}).then(function(e){return u(t,r,e)})})}).then(function(e){var n={rows:_.orderBy(e,[o.sort]),count:e.length};t(n)}).catch(function(e){n(e)})})}}}e.$inject=["$q","msNavigationService"],angular.module("app.core").factory("userProfileManager",e)}(),function(){"use strict";angular.module("app.core").filter("altDate",function(){return function(e){var n=Date.now()-new Date(e);return n<36e5?moment(e).fromNow():n<864e5?moment(e).format("HH:mm"):n<6048e5?moment(e).format("dddd"):moment(e).calendar()}})}(),function(){"use strict";function e(n){return function(e){return n.trustAsHtml(e)}}e.$inject=["$sce"],angular.module("app.core").filter("toTrusted",e).filter("htmlToPlaintext",function(){return function(e){return String(e).replace(/<[^>]+>/gm,"")}}).filter("nospace",function(){return function(e){return e?e.replace(/ /g,""):""}}).filter("humanizeDoc",function(){return function(e){if(e)return"directive"===e.type?e.name.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()}):e.label||e.name}})}(),function(){"use strict";angular.module("app.core").filter("capitalize",function(){return function(e){return e?_.capitalize(e):""}})}(),function(){"use strict";angular.module("app.core").filter("filterByIds",function(){return function(e,n){if(0===e.length||!n)return e;if(0===n.length)return[];for(var t=[],a=0;a<e.length;a++){for(var i=e[a],s=!1,o=0;o<n.length;o++){var r=n[o];if(i.id===r){s=!0;break}}s&&t.push(i)}return t}})}(),function(){"use strict";angular.module("app.core").filter("filterByPropIds",function(){return function(e,n,t){if(0===e.length||!t||0===t.length)return e;for(var a=[],i=0;i<e.length;i++){for(var s=e[i],o=!1,r=0;r<t.length;r++){var l=t[r];if(-1<s[n].indexOf(l)){o=!0;break}}o&&a.push(s)}return a}})}(),function(){"use strict";angular.module("app.core").filter("getOptionByValue",function(){return function(n,e,t){if(void 0===n)return"";if(!e)return"";t||(t="option");var a=_.find(e,function(e){return e.value==n});return a?a[t]:""}})}(),function(){"use strict";angular.module("app.core").filter("orderByDate",function(){return function(e){var n=[];return angular.forEach(e,function(e){n.push(e)}),n.sort(function(e,n){return e.hasOwnProperty("openedAt")&&n.hasOwnProperty("openedAt")?e.openedAt>n.openedAt?1:-1:1}),n}})}(),function(){"use strict";angular.module("app.core").filter("secToTime",function(){return function(e){e&&(e=e.toString().replace(",",""));var n=Math.floor(e/86400),t=e%86400,a=new Date(1e3*t).toISOString().substring(11,19);return a.replace(/^(\d+)/,function(e){return(""+(Number(e)+24*n)).padStart(2,"0")})}})}(),function(){"use strict";angular.module("app.core").filter("snakecase",function(){return function(e){return e?_.snakeCase(e):""}})}(),function(){"use strict";angular.module("app.core").filter("startcase",function(){return function(e){return e?_.startCase(e):""}})}(),function(){"use strict";angular.module("app.core").filter("filterByTags",function(){return function(e,t){if(0===e.length||0===t.length)return e;var a=[];return e.forEach(function(e){var n=t.every(function(n){var t=!1;return e.tags.forEach(function(e){e.name!==n.name||(t=!0)}),t});n&&a.push(e)}),a}}).filter("filterSingleByTags",function(){return function(e,n){if(0!==e.length&&0!==n.length){if(e.length<n.length)return[];var t=[],a=n.every(function(n){var t=!1;return e.forEach(function(e){e.name!==n.name||(t=!0)}),t});return a&&t.push(e),t}}})}(),function(){"use strict";angular.module("app.core").filter("toInteger",function(){return function(e){if(e&&"string"==typeof e)return parseInt(e)}})}(),function(){"use strict";function m(e,n,t,a){this.id=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),this.title=e,this.body=n,this.accept=t,this.reject=a,this.close=i}function u(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}function i(){var t=this;navigator.serviceWorker.ready.then(function(e){e.getNotifications().then(function(e){var n=_.find(e,function(e){return e.data.id===t.id});n&&n.close()})})}angular.module("app.dashboards").provider("motNotification",function(){return{$get:[function(){var d,t,c=[];"serviceWorker"in navigator&&u()?navigator.serviceWorker.register("notification.js").then(function(e){(d=e).update(),d.installing?t=d.installing:d.waiting?t=d.waiting:d.active&&(t=d.active)}).catch(function(e){console.error("Service worker registration failed",e)}):console.error("Service Worker is not supported");return navigator.serviceWorker.addEventListener("message",function(e){if(e.source===t){var n=_.find(c,{id:e.data.id});if(n)switch(e.data.action){case"accept":n.accept&&n.accept();break;case"reject":n.reject&&n.reject()}}}),{create:function(e,i,s,o,r,l){return new Promise(function(t,n){var a;u()&&(window.document.hidden||window.document.mozHidden||window.document.webkitHidden)?(a=new m(e||"MyTitle",i||"MyBody",o,r),c.push(a),a?window.Notification.requestPermission().then(function(e){if("granted"===e)return d.showNotification(a.title,{body:a.body,requireInteraction:!0,icon:s||"assets/images/business/queueCampaigns.jpg",data:{id:a.id},actions:[{action:"accept",title:"Accept"},{action:"reject",title:"Reject"}]})}).then(function(e){if(l){for(var n=0;n<c.length;n++)c[n].close();t()}else t(a)}).catch(function(e){n(e)}):n(new Error("Notification creating error"))):t()})}}}]}})}(),function(){"use strict";function e(l,d,c){return{resolve:function(e,n){var t=e.split("@"),a=t[0],i=t[1],s=n||{};if(!a||!i)return d.error("apiResolver.resolve requires correct action parameter (ResourceName@methodName)"),!1;var o=l.defer(),r=function(e){for(var n=e.split("."),t=c,a=0;a<n.length;a++){if(angular.isUndefined(t[n[a]])){d.error('Resource part "'+n[a]+'" is not defined!'),t=!1;break}t=t[n[a]]}return t||!1}(a);r?r[i](s,function(e){o.resolve(e)},function(e){o.reject(e)}):(d.error('Resource "'+a+'" is not defined in the api service!'),o.reject('Resource "'+a+'" is not defined in the api service!'));return o.promise}}}e.$inject=["$q","$log","api"],angular.module("app.core").factory("apiResolver",e)}(),function(){"use strict";function e(e){return{showLoadingIndicator:function(){e.loadingProgress=!0},hideLoadingIndicator:function(){e.loadingProgress=!1}}}e.$inject=["$rootScope"],angular.module("app.core").factory("LoadingIndicatorService",e)}(),function(){"use strict";angular.module("app.core").provider("msApi",function(){var t=angular.injector(["ng"]).get("$log"),a="",v=[];function n(e){a=e}function i(){return a}function s(e,n){angular.isString(e)?angular.isArray(n)?v[e]={url:a+(n[0]||""),paramDefaults:n[1]||[],actions:n[2]||[],options:n[3]||{}}:t.error('"resource" must be an array and it must follow $resource definition'):t.error('"path" must be a string (eg. `dashboard.project`)')}this.setBaseUrl=n,this.getBaseUrl=i,this.getApiObject=function(){return v},this.register=s,this.$get=["$log","$q","$resource","$rootScope",function(m,u,p,g){var e={setBaseUrl:n,getBaseUrl:i,register:s,resolve:function(e,n){g.$broadcast("msApi::resolveStart");var t=e.split("@"),a=t[0],i=t[1],s=n||{};if(!a||!i)return m.error("msApi.resolve requires correct action parameter (resourceName@methodName)"),!1;var o=u.defer(),r=v[a];if(r){var l=p(r.url,r.paramDefaults,r.actions,r.options);l[i](s,function(e){o.resolve(e),g.$broadcast("msApi::resolveSuccess")},function(e){o.reject(e),g.$broadcast("msApi::resolveError")})}else m.error('Resource "'+a+'" is not defined in the api service!'),o.reject('Resource "'+a+'" is not defined in the api service!');return o.promise},request:function(e,n,t,a){g.$broadcast("msApi::requestStart");var i=e.split("@"),s=i[0],o=i[1],r=n||{};if(!s||!o)return m.error("msApi.resolve requires correct action parameter (resourceName@methodName)"),!1;var l=u.defer(),d=v[s];if(d){var c=p(d.url,d.paramDefaults,d.actions,d.options);c[o](r,function(e){g.$broadcast("msApi::requestSuccess"),l.resolve(e),angular.isDefined(t)&&angular.isFunction(t)&&t(e)},function(e){g.$broadcast("msApi::requestError"),l.reject(e),angular.isDefined(a)&&angular.isFunction(a)&&a(e)})}else m.error('Resource "'+s+'" is not defined in the api service!'),l.reject('Resource "'+s+'" is not defined in the api service!');return l.promise}};return e}]})}(),function(){"use strict";function e(l){var e=new MobileDetect(l.navigator.userAgent),d=null;return{exists:function(e,n){return-1<n.indexOf(e)},detectBrowser:function(){if(d)return d;var e=[{string:l.navigator.userAgent,subString:"Edge",versionSearch:"Edge",identity:"Edge"},{string:l.navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:l.navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:l.navigator.vendor,subString:"Apple",versionSearch:"Version",identity:"Safari"},{prop:l.opera,identity:"Opera"},{string:l.navigator.vendor,subString:"iCab",identity:"iCab"},{string:l.navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:l.navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:l.navigator.vendor,subString:"Camino",identity:"Camino"},{string:l.navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:l.navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:l.navigator.userAgent,subString:"Trident/7",identity:"Explorer",versionSearch:"rv"},{string:l.navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:l.navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],n=[{string:l.navigator.platform,subString:"Win",identity:"Windows"},{string:l.navigator.platform,subString:"Mac",identity:"Mac"},{string:l.navigator.platform,subString:"Linux",identity:"Linux"},{string:l.navigator.platform,subString:"iPhone",identity:"iPhone"},{string:l.navigator.platform,subString:"iPod",identity:"iPod"},{string:l.navigator.platform,subString:"iPad",identity:"iPad"},{string:l.navigator.platform,subString:"Android",identity:"Android"}],i="";function t(e){for(var n=0;n<e.length;n++){var t=e[n].string,a=e[n].prop;if(i=e[n].versionSearch||e[n].identity,t){if(-1!==t.indexOf(e[n].subString))return e[n].identity}else if(a)return e[n].identity}}function a(e){var n=e.indexOf(i);if(-1!==n)return parseInt(e.substring(n+i.length+1))}var s=t(e)||"unknown-browser",o=a(l.navigator.userAgent)||a(l.navigator.appVersion)||"unknown-version",r=t(n)||"unknown-os";return s=s.toLowerCase(),o=s+"-"+o,r=r.toLowerCase(),d={browser:s,version:o,os:r}},guidGenerator:function(){var e=function(){return(65536*(1+Math.random())||0).toString(16).substring(1)};return e()+e()+e()+e()+e()+e()},isMobile:function(){return e.mobile()},toggleInArray:function(e,n){-1===n.indexOf(e)?n.push(e):n.splice(n.indexOf(e),1)},firstLastDayMonth:function(){return{$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()}},getEmailProviders:function(){return[{name:"Custom",value:"custom"},{name:"Gmail",value:"gmail"},{name:"Hotmail",value:"hotmail"},{name:"Yahoo",value:"yahoo"},{name:"Outlook365",value:"outlook365"}]}}}e.$inject=["$window"],angular.module("app.core").factory("msUtils",e)}(),function(){"use strict";function e(e,n){var t=this;t.themes=n.themes,t.layoutModes=[{label:"Boxed",value:"boxed"},{label:"Wide",value:"wide"}],t.layoutStyles=[{label:"Vertical Navigation",value:"verticalNavigation",figure:"/assets/images/theme-options/vertical-nav.jpg"},{label:"Vertical Navigation with Fullwidth Toolbar",value:"verticalNavigationFullwidthToolbar",figure:"/assets/images/theme-options/vertical-nav-with-full-toolbar.jpg"},{label:"Vertical Navigation with Fullwidth Toolbar 2",value:"verticalNavigationFullwidthToolbar2",figure:"/assets/images/theme-options/vertical-nav-with-full-toolbar-2.jpg"},{label:"Horizontal Navigation",value:"horizontalNavigation",figure:"/assets/images/theme-options/horizontal-nav.jpg"},{label:"Content with Toolbar",value:"contentWithToolbar",figure:"/assets/images/theme-options/content-with-toolbar.jpg"},{label:"Content Only",value:"contentOnly",figure:"/assets/images/theme-options/content-only.jpg"}],t.layoutMode="wide",t.layoutStyle=e.get("motion.layoutStyle")||"verticalNavigation",t.setActiveTheme=function(e){n.setActiveTheme(e)},t.getActiveTheme=function(){return n.themes.active},t.updateLayoutMode=function(){angular.element("body").toggleClass("boxed","boxed"===t.layoutMode)},t.updateLayoutStyle=function(){e.put("motion.layoutStyle",t.layoutStyle),location.reload()}}function n(n){return{restrict:"E",scope:{},controller:"MsThemeOptionsController as vm",templateUrl:"app/core/theme-options/theme-options.html",compile:function(e){return e.addClass("ms-theme-options"),function(e){e.toggleOptionsSidenav=function(){n("motion-theme-options").toggle()}}}}}e.$inject=["$cookies","motionTheming"],n.$inject=["$mdSidenav"],angular.module("app.core").controller("MsThemeOptionsController",e).directive("msThemeOptions",n)}(),function(){"use strict";function e(i,a,s){var o={};return{generate:function(){var e=angular.copy(s.getRegisteredThemes()),a=angular.copy(s.getRegisteredPalettes());angular.forEach(e,function(t){o[t.name]={},angular.forEach(t.colors,function(e,n){o[t.name][n]={name:e.name,levels:{default:{color:l(a[e.name][e.hues.default].value),contrast1:l(a[e.name][e.hues.default].contrast,1),contrast2:l(a[e.name][e.hues.default].contrast,2),contrast3:l(a[e.name][e.hues.default].contrast,3),contrast4:l(a[e.name][e.hues.default].contrast,4)},hue1:{color:l(a[e.name][e.hues["hue-1"]].value),contrast1:l(a[e.name][e.hues["hue-1"]].contrast,1),contrast2:l(a[e.name][e.hues["hue-1"]].contrast,2),contrast3:l(a[e.name][e.hues["hue-1"]].contrast,3),contrast4:l(a[e.name][e.hues["hue-1"]].contrast,4)},hue2:{color:l(a[e.name][e.hues["hue-2"]].value),contrast1:l(a[e.name][e.hues["hue-2"]].contrast,1),contrast2:l(a[e.name][e.hues["hue-2"]].contrast,2),contrast3:l(a[e.name][e.hues["hue-2"]].contrast,3),contrast4:l(a[e.name][e.hues["hue-2"]].contrast,4)},hue3:{color:l(a[e.name][e.hues["hue-3"]].value),contrast1:l(a[e.name][e.hues["hue-3"]].contrast,1),contrast2:l(a[e.name][e.hues["hue-3"]].contrast,2),contrast3:l(a[e.name][e.hues["hue-3"]].contrast,3),contrast4:l(a[e.name][e.hues["hue-3"]].contrast,4)}}}})}),function(e){var n=angular.copy(e);angular.forEach(n,function(t){angular.forEach(t,function(e,n){t[n]=e.levels,t[n].color=e.levels.default.color,t[n].contrast1=e.levels.default.contrast1,t[n].contrast2=e.levels.default.contrast2,t[n].contrast3=e.levels.default.contrast3,t[n].contrast4=e.levels.default.contrast4,delete t[n].default})}),s.setThemesList(n);var t=i.get("motion.selectedTheme");t?s.setActiveTheme(t):s.setActiveTheme("default")}(o);var r={};angular.forEach(o,function(e,n){var t,a,i,s,o;(r={})["@themeName"]=n,angular.forEach(e,function(e,a){angular.forEach(e.levels,function(e,t){angular.forEach(e,function(e,n){r["@"+a+d(t)+d(n)]=e})})}),t=r,a=new RegExp(Object.keys(t).join("|"),"gi"),i='/* Content hack because they wont fix */\n/* https://github.com/angular/material/pull/8067 */\n[md-theme="@themeName"] md-content.md-hue-1,\nmd-content.md-@themeName-theme.md-hue-1 {\n    color: @backgroundHue1Contrast1;\n    background-color: @backgroundHue1Color;\n}\n\n[md-theme="@themeName"] md-content.md-hue-2,\nmd-content.md-@themeName-theme.md-hue-2 {\n    color: @backgroundHue2Contrast1;\n    background-color: @backgroundHue2Color;\n}\n\n[md-theme="@themeName"] md-content.md-hue-3,\n md-content.md-@themeName-theme.md-hue-3 {\n    color: @backgroundHue3Contrast1;\n    background-color: @backgroundHue3Color;\n}\n\n/* Text Colors */\n[md-theme="@themeName"] a {\n    color: @accentDefaultColor;\n}\n\n[md-theme="@themeName"] .secondary-text,\n[md-theme="@themeName"] .icon {\n    color: @backgroundDefaultContrast2;\n}\n\n[md-theme="@themeName"] .hint-text,\n[md-theme="@themeName"] .disabled-text {\n    color: @backgroundDefaultContrast3;\n}\n\n[md-theme="@themeName"] .fade-text,\n[md-theme="@themeName"] .divider {\n    color: @backgroundDefaultContrast4;\n}\n\n/* Primary */\n[md-theme="@themeName"] .md-primary-bg {\n    background-color: @primaryDefaultColor;\n    color: @primaryDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg .secondary-text,\n[md-theme="@themeName"] .md-primary-bg .icon {\n    color: @primaryDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-primary-bg .hint-text,\n[md-theme="@themeName"] .md-primary-bg .disabled-text {\n    color: @primaryDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg .fade-text,\n[md-theme="@themeName"] .md-primary-bg .divider {\n    color: @primaryDefaultContrast4;\n}\n\n/* Primary, Hue-1 */\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 {\n    background-color: @primaryHue1Color;\n    color: @primaryHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .icon {\n    color: @primaryHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .disabled-text {\n    color: @primaryHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .divider {\n    color: @primaryHue1Contrast4;\n}\n\n/* Primary, Hue-2 */\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 {\n    background-color: @primaryHue2Color;\n    color: @primaryHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .icon {\n    color: @primaryHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .disabled-text {\n    color: @primaryHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .divider {\n    color: @primaryHue2Contrast4;\n}\n\n/* Primary, Hue-3 */\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 {\n    background-color: @primaryHue3Color;\n    color: @primaryHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .icon {\n    color: @primaryHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .disabled-text {\n    color: @primaryHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .divider {\n    color: @primaryHue3Contrast4;\n}\n\n/* Primary foreground */\n[md-theme="@themeName"] .md-primary-fg {\n    color: @primaryDefaultColor !important;\n}\n\n/* Primary foreground, Hue-1 */\n[md-theme="@themeName"] .md-primary-fg.md-hue-1 {\n    color: @primaryHue1Color !important;\n}\n\n/* Primary foreground, Hue-2 */\n[md-theme="@themeName"] .md-primary-fg.md-hue-2 {\n    color: @primaryHue2Color !important;\n}\n\n/* Primary foreground, Hue-3 */\n[md-theme="@themeName"] .md-primary-fg.md-hue-3 {\n    color: @primaryHue3Color !important;\n}\n\n/* Accent */\n[md-theme="@themeName"] .md-accent-bg {\n    background-color: @accentDefaultColor;\n    color: @accentDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg .secondary-text,\n[md-theme="@themeName"] .md-accent-bg .icon {\n    color: @accentDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-accent-bg .hint-text,\n[md-theme="@themeName"] .md-accent-bg .disabled-text {\n    color: @accentDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg .fade-text,\n[md-theme="@themeName"] .md-accent-bg .divider {\n    color: @accentDefaultContrast4;\n}\n\n/* Accent, Hue-1 */\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 {\n    background-color: @accentHue1Color;\n    color: @accentHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .icon {\n    color: @accentHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .disabled-text {\n    color: @accentHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .divider {\n    color: @accentHue1Contrast4;\n}\n\n/* Accent, Hue-2 */\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 {\n    background-color: @accentHue2Color;\n    color: @accentHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .icon {\n    color: @accentHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .disabled-text {\n    color: @accentHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .divider {\n    color: @accentHue2Contrast4;\n}\n\n/* Accent, Hue-3 */\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 {\n    background-color: @accentHue3Color;\n    color: @accentHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .icon {\n    color: @accentHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .disabled-text {\n    color: @accentHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .divider {\n    color: @accentHue3Contrast4;\n}\n\n/* Accent foreground */\n[md-theme="@themeName"] .md-accent-fg {\n    color: @accentDefaultColor !important;\n}\n\n/* Accent foreground, Hue-1 */\n[md-theme="@themeName"] .md-accent-fg.md-hue-1 {\n    color: @accentHue1Color !important;\n}\n\n/* Accent foreground, Hue-2 */\n[md-theme="@themeName"] .md-accent-fg.md-hue-2 {\n    color: @accentHue2Color !important;\n}\n\n/* Accent foreground, Hue-3 */\n[md-theme="@themeName"] .md-accent-fg.md-hue-3 {\n    color: @accentHue3Color !important;\n}\n\n/* Warn */\n[md-theme="@themeName"] .md-warn-bg {\n    background-color: @warnDefaultColor;\n    color: @warnDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg .secondary-text,\n[md-theme="@themeName"] .md-warn-bg .icon {\n    color: @warnDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-warn-bg .hint-text,\n[md-theme="@themeName"] .md-warn-bg .disabled-text {\n    color: @warnDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg .fade-text,\n[md-theme="@themeName"] .md-warn-bg .divider {\n    color: @warnDefaultContrast4;\n}\n\n/* Warn, Hue-1 */\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 {\n    background-color: @warnHue1Color;\n    color: @warnHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .icon {\n    color: @warnHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .disabled-text {\n    color: @warnHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .divider {\n    color: @warnHue1Contrast4;\n}\n\n/* Warn, Hue-2 */\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 {\n    background-color: @warnHue2Color;\n    color: @warnHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .icon {\n    color: @warnHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .disabled-text {\n    color: @warnHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .divider {\n    color: @warnHue2Contrast4;\n}\n\n/* Warn, Hue-3 */\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 {\n    background-color: @warnHue3Color;\n    color: @warnHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .icon {\n    color: @warnHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .disabled-text {\n    color: @warnHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .divider {\n    color: @warnHue3Contrast4;\n}\n\n/* Warn foreground */\n[md-theme="@themeName"] .md-warn-fg {\n    color: @warnDefaultColor !important;\n}\n\n/* Warn foreground, Hue-1 */\n[md-theme="@themeName"] .md-warn-fg.md-hue-1 {\n    color: @warnHue1Color !important;\n}\n\n/* Warn foreground, Hue-2 */\n[md-theme="@themeName"] .md-warn-fg.md-hue-2 {\n    color: @warnHue2Color !important;\n}\n\n/* Warn foreground, Hue-3 */\n[md-theme="@themeName"] .md-warn-fg.md-hue-3 {\n    color: @warnHue3Color !important;\n}\n\n/* Background */\n[md-theme="@themeName"] .md-background-bg {\n    background-color: @backgroundDefaultColor;\n    color: @backgroundDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg .secondary-text,\n[md-theme="@themeName"] .md-background-bg .icon {\n    color: @backgroundDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-background-bg .hint-text,\n[md-theme="@themeName"] .md-background-bg .disabled-text {\n    color: @backgroundDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg .fade-text,\n[md-theme="@themeName"] .md-background-bg .divider {\n    color: @backgroundDefaultContrast4;\n}\n\n/* Background, Hue-1 */\n[md-theme="@themeName"] .md-background-bg.md-hue-1 {\n    background-color: @backgroundHue1Color;\n    color: @backgroundHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .icon {\n    color: @backgroundHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .disabled-text {\n    color: @backgroundHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .divider {\n    color: @backgroundHue1Contrast4;\n}\n\n/* Background, Hue-2 */\n[md-theme="@themeName"] .md-background-bg.md-hue-2 {\n    background-color: @backgroundHue2Color;\n    color: @backgroundHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .icon {\n    color: @backgroundHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .disabled-text {\n    color: @backgroundHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .divider {\n    color: @backgroundHue2Contrast4;\n}\n\n/* Background, Hue-3 */\n[md-theme="@themeName"] .md-background-bg.md-hue-3 {\n    background-color: @backgroundHue3Color;\n    color: @backgroundHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .icon {\n    color: @backgroundHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .disabled-text {\n    color: @backgroundHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .divider {\n    color: @backgroundHue3Contrast4;\n}\n\n/* Background foreground */\n[md-theme="@themeName"] .md-background-fg {\n    color: @backgroundDefaultColor !important;\n}\n\n/* Background foreground, Hue-1 */\n[md-theme="@themeName"] .md-background-fg.md-hue-1 {\n    color: @backgroundHue1Color !important;\n}\n\n/* Background foreground, Hue-2 */\n[md-theme="@themeName"] .md-background-fg.md-hue-2 {\n    color: @backgroundHue2Color !important;\n}\n\n/* Background foreground, Hue-3 */\n[md-theme="@themeName"] .md-background-fg.md-hue-3 {\n    color: @backgroundHue3Color !important;\n}'.replace(a,function(e){return t[e]}),s=angular.element("head"),(o=angular.element('<style type="text/css"></style>')).html(i),s.append(o)})},rgba:l};function l(e,n){var t=n||!1;return 4===e.length&&255===e[0]&&255===e[1]&&255===e[2]&&e.splice(3,4),t&&(e=function(e,n){var t={white:{1:"1",2:"0.7",3:"0.3",4:"0.12"},black:{1:"0.87",2:"0.54",3:"0.26",4:"0.12"}};255===e[0]&&255===e[1]&&255===e[2]?e[3]=t.white[n]:0===e[0]&&0===e[1]&&0===e[2]&&(e[3]=t.black[n]);return e}(e,t)),3===e.length?"rgb("+e.join(",")+")":4===e.length?"rgba("+e.join(",")+")":void a.error("Invalid number of arguments supplied in the color array: "+e.length+"\nThe array must have 3 or 4 colors.")}function d(e){return e.charAt(0).toUpperCase()+e.slice(1)}}e.$inject=["$cookies","$log","motionTheming"],angular.module("app.core").factory("motionGenerator",e)}(),function(){"use strict";angular.module("app.core").constant("motionPalettes",[{name:"motion-blue",options:{50:"#ebf1fa",100:"#c2d4ef",200:"#9ab8e5",300:"#78a0dc",400:"#5688d3",500:"#3470ca",600:"#2e62b1",700:"#275498",800:"#21467e",900:"#1a3865",A100:"#c2d4ef",A200:"#9ab8e5",A400:"#5688d3",A700:"#275498",contrastDefaultColor:"light",contrastDarkColors:"50 100 200 A100",contrastStrongLightColors:"300 400"}},{name:"motion-paleblue",options:{50:"#ececee",100:"#c5c6cb",200:"#9ea1a9",300:"#7d818c",400:"#5c616f",500:"#3c4252",600:"#353a48",700:"#2d323e",800:"#262933",900:"#1e2129",A100:"#c5c6cb",A200:"#9ea1a9",A400:"#5c616f",A700:"#2d323e",contrastDefaultColor:"light",contrastDarkColors:"50 100 200 A100",contrastStrongLightColors:"300 400"}}])}(),function(){"use strict";angular.module("app.core").constant("motionThemes",{default:{primary:{name:"motion-paleblue",hues:{default:"700","hue-1":"500","hue-2":"600","hue-3":"400"}},accent:{name:"light-blue",hues:{default:"600","hue-1":"400","hue-2":"700","hue-3":"A100"}},warn:{name:"red"},background:{name:"grey",hues:{default:"A100","hue-1":"A100","hue-2":"100","hue-3":"300"}}},pinkTheme:{primary:{name:"blue-grey",hues:{default:"800","hue-1":"600","hue-2":"400","hue-3":"A100"}},accent:{name:"pink",hues:{default:"400","hue-1":"300","hue-2":"600","hue-3":"A100"}},warn:{name:"blue"},background:{name:"grey",hues:{default:"A100","hue-1":"A100","hue-2":"100","hue-3":"300"}}},tealTheme:{primary:{name:"motion-blue",hues:{default:"900","hue-1":"600","hue-2":"500","hue-3":"A100"}},accent:{name:"teal",hues:{default:"500","hue-1":"400","hue-2":"600","hue-3":"A100"}},warn:{name:"deep-orange"},background:{name:"grey",hues:{default:"A100","hue-1":"A100","hue-2":"100","hue-3":"300"}}}})}(),function(){"use strict";function e(t,e,n){var a;angular.injector(["ngCookies"]).invoke(["$cookies",function(e){a=e}]);var i=a.getObject("motion.customTheme");i&&(n.custom=i),t.alwaysWatchTheme(!0),angular.forEach(e,function(e){t.definePalette(e.name,e.options)}),angular.forEach(n,function(e,n){t.theme(n).primaryPalette(e.primary.name,e.primary.hues).accentPalette(e.accent.name,e.accent.hues).warnPalette(e.warn.name,e.warn.hues).backgroundPalette(e.background.name,e.background.hues)})}e.$inject=["$mdThemingProvider","motionPalettes","motionThemes"],angular.module("app.core").config(e)}(),function(){"use strict";function e(n,t,e){var a={getRegisteredPalettes:function(){return e.PALETTES},getRegisteredThemes:function(){return e.THEMES},setActiveTheme:function(e){if(angular.isUndefined(a.themes.list[e]))return angular.isUndefined(a.themes.list.default)?void t.error('You must have at least one theme named "default"'):(t.warn('The theme "'+e+'" does not exist! Falling back to the "default" theme.'),a.themes.active.name="default",a.themes.active.theme=a.themes.list.default,void n.put("motion.selectedTheme",a.themes.active.name));a.themes.active.name=e,a.themes.active.theme=a.themes.list[e],n.put("motion.selectedTheme",e)},setThemesList:function(e){a.themes.list=e},themes:{list:{},active:{name:"",theme:{}}}};return a}e.$inject=["$cookies","$log","$mdTheming"],angular.module("app.core").service("motionTheming",e)}(),function(){"use strict";function e(n,s,o,r){this.search=function(n){for(var e=[],t=r.getFlatNavigation(),a=o.defer(),i=0;i<t.length;i+=1)t[i].uisref&&e.push(t[i]);n&&(e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(n)))return!0}));return s(function(){a.resolve(e)},1e3),a.promise},this.searchResultClick=function(e){e.uisref&&(e.stateParams?n.go(e.state,e.stateParams):n.go(e.state))}}e.$inject=["$state","$timeout","$q","msNavigationService"],angular.module("app.errors.error-404").controller("Error404Controller",e)}(),function(){"use strict";function e(e,n){var t=this;t.code="",t.send=!1,t.error=e.params,t.sendReport=function(){n.post("/api/jira",t.error).then(function(e){t.send=!0,e.data&&(t.code=e.data.id)},function(e){t.send=!1})}}e.$inject=["$state","$http"],angular.module("app.errors.error-500").controller("Error500Controller",e)}(),function(){"use strict";function e(e,n,t){var a=this;a.currentUser=e.getCurrentUser(),a.cookieAlertHide=n.get("motion.cookieAlertHide:"+a.currentUser.id)||!1,a.cookieAlertOnClose=function(){n.put("motion.cookieAlertHide:"+a.currentUser.id,!0)},a.onInit=function(){t.setting.get({id:1}).$promise.then(function(e){e&&(a.cookieAlertHide=!e.disabledCookie)})},a.onInit()}e.$inject=["Auth","$cookies","api"],angular.module("app.footer").controller("FooterController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.form={},s.forgotPassword=function(){return i.auth.forgot(s.form).$promise.then(function(){n.success({title:t.instant("FORGOTPASSWORD.LINK_SENT"),msg:t.instant("FORGOTPASSWORD.LINNK_SENT_MESSAGE")})}).catch(function(e){e&&n.error({title:t.instant("FORGOTPASSWORD.PASSWORD_RESET_ERROR"),msg:e.data?e.data.message||e.message||e:e.message||e})})},s.onInit=function(){e.isLoggedIn()&&a.go("app.dashboards.general")}}e.$inject=["Auth","toasty","$translate","$state","api"],angular.module("app.forgot").controller("ForgotPasswordController",e)}(),function(){"use strict";function e(e,n){var t=this;t.currentUser=e.getCurrentUser(),t.newsAlertHide=n.get("motion.newsAlertHide:"+t.currentUser.id)||!1,t.newsAlertOnClose=function(){n.put("motion.newsAlertHide:"+t.currentUser.id,!0)}}e.$inject=["Auth","$cookies"],angular.module("app.header").controller("HeaderController",e)}(),function(){"use strict";function e(e,o){var r={getResourcesByRole:function(e,n,t,a,i,s){return o.getResources(r,e,n,t,a,i,s)}};return r.baseUrl="api/",r.auth=e(r.baseUrl+"auth/local",{},{local:{method:"post",url:r.baseUrl+"auth/local"},forgot:{method:"post",url:r.baseUrl+"auth/local/forgot"},reset:{method:"post",url:r.baseUrl+"auth/local/reset/:token",params:{token:"@token"}},user:{method:"get",url:r.baseUrl+"auth/local/user/:token",params:{token:"@token"}},google:{method:"post",url:r.baseUrl+"auth/google"},activedirectory:{method:"post",url:r.baseUrl+"auth/activedirectory"}}),r.jira=e(r.baseUrl+"jira"),r.rpc=e(r.baseUrl+"rpc",{},{startMonitor:{method:"get",url:r.baseUrl+"rpc/voice/channels/:uniqueid/mixmonitor",params:{uniqueid:"@uniqueid"}},stopMonitor:{method:"get",url:r.baseUrl+"rpc/voice/channels/:uniqueid/stopmixmonitor",params:{uniqueid:"@uniqueid"}},getVoiceChannels:{method:"get",url:r.baseUrl+"rpc/voice/channels"},getVoiceQueues:{method:"get",url:r.baseUrl+"rpc/voice/queues"},getChatQueues:{method:"get",url:r.baseUrl+"rpc/chat/queues"},getMailQueues:{method:"get",url:r.baseUrl+"rpc/mail/queues"},getSmsQueues:{method:"get",url:r.baseUrl+"rpc/sms/queues"},getWhatsappQueues:{method:"get",url:r.baseUrl+"rpc/whatsapp/queues"},getOpenchannelQueues:{method:"get",url:r.baseUrl+"rpc/openchannel/queues"},getFaxQueues:{method:"get",url:r.baseUrl+"rpc/fax/queues"},getVoiceQueuesPreview:{method:"get",url:r.baseUrl+"rpc/voice/queues/preview/:id"},getVoiceQueuesChannels:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels"},getVoiceQueuesChannel:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels/:uniqueid"},getVoiceQueuesChannelHangup:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels/:uniqueid/hangup"},getVoiceQueuesChannelRedirect:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels/:uniqueid/redirect/:exten"},getOutbound:{method:"get",url:r.baseUrl+"rpc/outbound"},getOutboundChannels:{method:"get",url:r.baseUrl+"rpc/outbound/channels"},getAgents:{method:"get",url:r.baseUrl+"rpc/agents"},setAgentCapacity:{method:"put",url:r.baseUrl+"rpc/agents/:id/capacity",params:{id:"@id"}},getTelephones:{method:"get",url:r.baseUrl+"rpc/telephones"},getTrunks:{method:"get",url:r.baseUrl+"rpc/trunks"},getCampaigns:{method:"get",url:r.baseUrl+"rpc/campaigns"},getMailAccounts:{method:"get",url:r.baseUrl+"rpc/mail/accounts"},getFaxAccounts:{method:"get",url:r.baseUrl+"rpc/fax/accounts"},getChatQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/chat/queues/waitinginteractions"},getMailQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/mail/queues/waitinginteractions"},getOpenchannelQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/openchannel/queues/waitinginteractions"},getOpenchannelQueuesIdWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/openchannel/queues/:id/waitinginteractions"},getSmsQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/sms/queues/waitinginteractions"},getFaxQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/fax/queues/waitinginteractions"},getWhatsappQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/whatsapp/queues/waitinginteractions"},mailQueueNotify:{method:"post",url:r.baseUrl+"rpc/mail/queues/:id/notify",params:{id:"@id"}},chatQueueNotify:{method:"post",url:r.baseUrl+"rpc/chat/queues/:id/notify",params:{id:"@id"}},faxQueueNotify:{method:"post",url:r.baseUrl+"rpc/fax/queues/:id/notify",params:{id:"@id"}},smsQueueNotify:{method:"post",url:r.baseUrl+"rpc/sms/queues/:id/notify",params:{id:"@id"}},openchannelQueueNotify:{method:"post",url:r.baseUrl+"rpc/openchannel/queues/:id/notify",params:{id:"@id"}},agentNotify:{method:"post",url:r.baseUrl+"rpc/agents/:id/notify",params:{id:"@id"}}}),r.version=e(r.baseUrl+"version",{},{fetch:{method:"get",url:r.baseUrl+"version/fetch"},reset:{method:"get",url:r.baseUrl+"version/reset"},pull:{method:"get",url:r.baseUrl+"version/pull"},restart:{method:"get",url:r.baseUrl+"version/restart"},migrations:{method:"get",url:r.baseUrl+"version/migrations"}}),r.system=e(r.baseUrl+"system",{},{killProcess:{method:"get",url:r.baseUrl+"system/process/:pid/kill",params:{pid:"@pid"}}}),r.pm2=e(r.baseUrl+"pm2/:id",{id:"@id"},{update:{method:"put",isArray:!0}}),r.user=e(r.baseUrl+"users/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"users/describe"},clone:{method:"post",url:r.baseUrl+"users/:id/clone",params:{includeAll:"@includeAll"}},addContacts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/contacts"},bulkCreate:{isArray:!1,method:"post",url:r.baseUrl+"users/create_many"},changePassword:{isArray:!1,method:"put",url:r.baseUrl+"users/:id/password"},addQueues:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/queues"},removeQueues:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/queues"},addAvatar:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/avatar"},getAvatar:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/avatar"},getOpenTabs:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/open_tabs"},getContacts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/contacts"},getQueues:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/queues"},getVoiceQueuesRt:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/queues_rt"},getGroups:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/groups"},getRecordings:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/recordings"},getScreenRecordings:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/screen_recordings"},getChatInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/chat/interactions"},getOpenchannelInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/openchannel/interactions"},getMailInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/mail/interactions"},getSmsInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/sms/interactions"},getFaxInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/fax/interactions"},getWhatsappInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/whatsapp/interactions"},login:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/login"},logout:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/logout"},pause:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/pause"},unpause:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/unpause"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/teams"},getLists:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/lists"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/agents"},addChatInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/chat_interactions"},removeChatInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/chat_interactions"},addMailInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/mail_interactions"},removeMailInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/mail_interactions"},addFaxInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/fax_interactions"},removeFaxInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/fax_interactions"},addSmsInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/sms_interactions"},removeSmsInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/sms_interactions"},addOpenchannelInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/openchannel_interactions"},removeOpenchannelInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/openchannel_interactions"},addWhatsappInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/whatsapp_interactions"},removeWhatsappInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/whatsapp_interactions"},getVoicePrefixes:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/prefixes"},getFaxAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/fax_accounts"},addFaxAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/fax_accounts"},removeFaxAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/fax_accounts"},getMailAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/mail_accounts"},addMailAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/mail_accounts"},removeMailAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/mail_accounts"},getOpenchannelAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/openchannel_accounts"},addOpenchannelAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/openchannel_accounts"},removeOpenchannelAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/openchannel_accounts"},getSmsAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/sms_accounts"},addSmsAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/sms_accounts"},removeSmsAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/sms_accounts"},getChatWebsites:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/chat_websites"},addChatWebsites:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/chat_websites"},removeChatWebsites:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/chat_websites"},getWhatsappAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/whatsapp_accounts"},addWhatsappAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/whatsapp_accounts"},removeWhatsappAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/whatsapp_accounts"},getSquareProjects:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/square_projects"},addSquareProjects:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/square_projects"},removeSquareProjects:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/square_projects"},getScheduledCalls:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/scheduled_calls"},getApiKey:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/api_key"},createApiKey:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/api_key"},removeApiKey:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/api_key"},whoami:{isArray:!1,method:"get",url:r.baseUrl+"users/whoami"},getPresence:{isArray:!1,method:"get",url:r.baseUrl+"users/presence"}}),r.voiceChanSpy=e(r.baseUrl+"voice/chanspy/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/chanspy/describe"},clone:{method:"post",url:r.baseUrl+"voice/chanspy/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceContext=e(r.baseUrl+"voice/contexts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/contexts/describe"},clone:{method:"post",url:r.baseUrl+"voice/contexts/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceExtension=e(r.baseUrl+"voice/extensions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/extensions/describe"},clone:{method:"post",url:r.baseUrl+"voice/extensions/:id/clone",params:{includeAll:"@includeAll"}},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"voice/extensions/:id/applications"}}),r.voiceMusicOnHold=e(r.baseUrl+"voice/mohs/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/mohs/describe"},clone:{method:"post",url:r.baseUrl+"voice/mohs/:id/clone",params:{includeAll:"@includeAll"}},addSound:{isArray:!1,method:"post",url:r.baseUrl+"voice/mohs/:id/sounds"},removeSound:{isArray:!1,method:"delete",url:r.baseUrl+"voice/mohs/:id/sounds/:id2"},getSounds:{isArray:!1,method:"get",url:r.baseUrl+"voice/mohs/:id/sounds"}}),r.voiceQueue=e(r.baseUrl+"voice/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/queues/describe"},clone:{method:"post",url:r.baseUrl+"voice/queues/:id/clone",params:{includeAll:"@includeAll"}},getHoppers:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hopper_finals"},getHopperBlacks:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hopper_black"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"voice/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"voice/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/users"},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/members"},getLists:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/lists"},addLists:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/lists"},removeLists:{isArray:!0,method:"delete",url:r.baseUrl+"voice/queues/:id/lists"},getBlackLists:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/blacklists"},addBlackLists:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/blacklists"},removeBlackLists:{isArray:!0,method:"delete",url:r.baseUrl+"voice/queues/:id/blacklists"}}),r.voiceRecording=e(r.baseUrl+"voice/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/recordings/describe"},clone:{method:"post",url:r.baseUrl+"voice/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"voice/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},downloads:{isArray:!1,method:"get",url:r.baseUrl+"voice/recordings/:id/downloads"},runTranscribe:{isArray:!1,method:"post",url:r.baseUrl+"voice/recordings/:id/transcribe"},downloadTranscribe:{isArray:!1,method:"get",url:r.baseUrl+"voice/recordings/:id/transcribe",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.screenRecording=e(r.baseUrl+"screen/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"screen/recordings/describe"},clone:{method:"post",url:r.baseUrl+"screen/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"screen/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.voiceMail=e(r.baseUrl+"voice/mails/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/mails/describe"},clone:{method:"post",url:r.baseUrl+"voice/mails/:id/clone",params:{includeAll:"@includeAll"}},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"voice/mails/:id/messages"}}),r.voiceMailMessage=e(r.baseUrl+"voice/mails/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/mails/messages/describe"},clone:{method:"post",url:r.baseUrl+"voice/mails/messages/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"voice/mails/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.voiceCallReport=e(r.baseUrl+"voice/calls/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/calls/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/calls/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceDialReport=e(r.baseUrl+"voice/dials/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/dials/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/dials/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceAgentReport=e(r.baseUrl+"voice/agents/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/agents/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/agents/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceQueueReport=e(r.baseUrl+"voice/queues/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/queues/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/queues/reports/:id/clone",params:{includeAll:"@includeAll"}},getVoiceQueuesReport:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/reports/index"}}),r.memberReport=e(r.baseUrl+"members/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"members/reports/describe"},clone:{method:"post",url:r.baseUrl+"members/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.trunk=e(r.baseUrl+"trunks/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"trunks/describe"},clone:{method:"post",url:r.baseUrl+"trunks/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceTransferReport=e(r.baseUrl+"voice/transfers/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/transfers/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/transfers/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailServerOut=e(r.baseUrl+"mail/out_servers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/out_servers/describe"},clone:{method:"post",url:r.baseUrl+"mail/out_servers/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailAccount=e(r.baseUrl+"mail/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/accounts/describe"},clone:{method:"post",url:r.baseUrl+"mail/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/canned_answers"},getImap:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/in_servers"},addImap:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/in_servers"},removeImap:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/in_servers"},getSmtp:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/out_servers"},addSmtp:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/out_servers"},removeSmtp:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/out_servers"},addInteraction:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/applications"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/messages"},send:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/send"},verifySmtp:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/verify"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"mail/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/users"}}),r.mailQueue=e(r.baseUrl+"mail/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/queues/describe"},clone:{method:"post",url:r.baseUrl+"mail/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"mail/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"mail/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"mail/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"mail/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"mail/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"mail/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"mail/queues/:id/users"}}),r.mailSubstatus=e(r.baseUrl+"mail/substatuses/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/substatuses/describe"},clone:{method:"post",url:r.baseUrl+"mail/substatuses/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailInteraction=e(r.baseUrl+"mail/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/interactions/describe"},clone:{method:"post",url:r.baseUrl+"mail/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"mail/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"mail/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"mail/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"mail/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"mail/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.mailMessage=e(r.baseUrl+"mail/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/messages/describe"},clone:{method:"post",url:r.baseUrl+"mail/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"mail/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"mail/messages/:id/reject"},download:{isArray:!1,method:"get",url:r.baseUrl+"mail/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.mailApplication=e(r.baseUrl+"mail/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/applications/describe"},clone:{method:"post",url:r.baseUrl+"mail/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailQueueReport=e(r.baseUrl+"mail/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"mail/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.dashboard=e(r.baseUrl+"dashboards/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"dashboards/describe"},clone:{method:"post",url:r.baseUrl+"dashboards/:id/clone",params:{includeAll:"@includeAll"}},addItem:{isArray:!1,method:"post",url:r.baseUrl+"dashboards/:id/items"},getItems:{isArray:!1,method:"get",url:r.baseUrl+"dashboards/:id/items"}}),r.dashboardItem=e(r.baseUrl+"dashboards/items/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"dashboards/items/describe"},clone:{method:"post",url:r.baseUrl+"dashboards/items/:id/clone",params:{includeAll:"@includeAll"}}}),r.faxAccount=e(r.baseUrl+"fax/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/accounts/describe"},clone:{method:"post",url:r.baseUrl+"fax/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"fax/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"fax/accounts/:id/canned_answers"},addInteraction:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/applications"},addAccountApplications:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/addaccountapplications"},updateAccountApplications:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/updateaccountapplications"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/messages"},send:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/send"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"fax/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"fax/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/users"}}),r.faxApplication=e(r.baseUrl+"fax/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/applications/describe"},clone:{method:"post",url:r.baseUrl+"fax/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.faxInteraction=e(r.baseUrl+"fax/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/interactions/describe"},clone:{method:"post",url:r.baseUrl+"fax/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"fax/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"fax/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"fax/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"fax/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"fax/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.faxMessage=e(r.baseUrl+"fax/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/messages/describe"},clone:{method:"post",url:r.baseUrl+"fax/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"fax/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"fax/messages/:id/reject"},download:{isArray:!1,method:"get",url:r.baseUrl+"fax/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.faxQueue=e(r.baseUrl+"fax/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/queues/describe"},clone:{method:"post",url:r.baseUrl+"fax/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"fax/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"fax/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"fax/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"fax/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"fax/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"fax/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"fax/queues/:id/users"}}),r.faxQueueReport=e(r.baseUrl+"fax/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"fax/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.smsAccount=e(r.baseUrl+"sms/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/accounts/describe"},clone:{method:"post",url:r.baseUrl+"sms/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"sms/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"sms/accounts/:id/canned_answers"},notify:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/notify"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/applications"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/interactions"},send:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/send"},status:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/status"},statusGet:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/status"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"sms/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"sms/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/users"}}),r.smsApplication=e(r.baseUrl+"sms/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/applications/describe"},clone:{method:"post",url:r.baseUrl+"sms/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.smsInteraction=e(r.baseUrl+"sms/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/interactions/describe"},clone:{method:"post",url:r.baseUrl+"sms/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"sms/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"sms/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"sms/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"sms/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"sms/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.smsMessage=e(r.baseUrl+"sms/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/messages/describe"},clone:{method:"post",url:r.baseUrl+"sms/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"sms/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"sms/messages/:id/reject"},status:{isArray:!1,method:"post",url:r.baseUrl+"sms/messages/:id/status"}}),r.smsQueue=e(r.baseUrl+"sms/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/queues/describe"},clone:{method:"post",url:r.baseUrl+"sms/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"sms/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"sms/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"sms/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"sms/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"sms/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"sms/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"sms/queues/:id/users"}}),r.openchannelAccount=e(r.baseUrl+"openchannel/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/accounts/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/accounts/:id/canned_answers"},notify:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/notify"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/applications"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/interactions"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"openchannel/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/users"},send:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/send"}}),r.openchannelApplication=e(r.baseUrl+"openchannel/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/applications/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.openchannelInteraction=e(r.baseUrl+"openchannel/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/interactions/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.openchannelMessage=e(r.baseUrl+"openchannel/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/messages/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"openchannel/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"openchannel/messages/:id/reject"}}),r.openchannelQueue=e(r.baseUrl+"openchannel/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/queues/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"openchannel/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"openchannel/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/queues/:id/users"}}),r.chatWebsite=e(r.baseUrl+"chat/websites/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/websites/describe"},clone:{method:"post",url:r.baseUrl+"chat/websites/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"chat/websites/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"chat/websites/:id/canned_answers"},addLogo:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/logo"},addAvatar:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/avatar"},addCustomerAvatar:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/customer_avatar"},addSystemAvatar:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/system_avatar"},getLogo:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/logo"},getAvatar:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/avatar"},getCustomerAvatar:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/customer_avatar"},getSystemAvatar:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/system_avatar"},notify:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/notify"},offline:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/offline"},addInteraction:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/interactions"},getSnippet:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/snippet"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/applications"},addProactiveActions:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/proactive_actions"},getProactiveActions:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/proactive_actions"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/fields"},getOfflineMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/offline_messages"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"chat/websites/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"chat/websites/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/users"}}),r.openchannelQueueReport=e(r.baseUrl+"openchannel/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatApplication=e(r.baseUrl+"chat/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/applications/describe"},clone:{method:"post",url:r.baseUrl+"chat/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatInteraction=e(r.baseUrl+"chat/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/interactions/describe"},clone:{method:"post",url:r.baseUrl+"chat/interactions/:id/clone",params:{includeAll:"@includeAll"}},createVidaooSession:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/vidaoo"},customUpdate:{isArray:!1,method:"put",url:r.baseUrl+"chat/interactions/:id/custom_update"},abandon:{isArray:!1,method:"put",url:r.baseUrl+"chat/interactions/:id/abandon"},attachmentUpload:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/attachment_upload"},attachmentDownload:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/attachment_download"},close:{isArray:!1,method:"put",url:r.baseUrl+"chat/interactions/:id/close"},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/messages"},getMyMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/my_messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"chat/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.chatMessage=e(r.baseUrl+"chat/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/messages/describe"},clone:{method:"post",url:r.baseUrl+"chat/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"chat/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"chat/messages/:id/reject"}}),r.chatOfflineMessage=e(r.baseUrl+"chat/offline_messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/offline_messages/describe"},clone:{method:"post",url:r.baseUrl+"chat/offline_messages/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatQueue=e(r.baseUrl+"chat/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/queues/describe"},clone:{method:"post",url:r.baseUrl+"chat/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"chat/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"chat/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"chat/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"chat/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"chat/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"chat/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"chat/queues/:id/users"}}),r.chatGroup=e(r.baseUrl+"chat/groups/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/groups/describe"},clone:{method:"post",url:r.baseUrl+"chat/groups/:id/clone",params:{includeAll:"@includeAll"}},getUnread:{isArray:!1,method:"get",url:r.baseUrl+"chat/groups/:id/unread"},addMembers:{isArray:!0,method:"post",url:r.baseUrl+"chat/groups/:id/members"},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"chat/groups/:id/members"},removeMembers:{isArray:!1,method:"delete",url:r.baseUrl+"chat/groups/:id/members"},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"chat/groups/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/groups/:id/messages"}}),r.chatProactiveAction=e(r.baseUrl+"chat/proactive_actions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/proactive_actions/describe"},clone:{method:"post",url:r.baseUrl+"chat/proactive_actions/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmCompany=e(r.baseUrl+"cm/companies/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/companies/describe"},clone:{method:"post",url:r.baseUrl+"cm/companies/:id/clone",params:{includeAll:"@includeAll"}},addContacts:{isArray:!1,method:"post",url:r.baseUrl+"cm/companies/:id/contacts"},getContacts:{isArray:!1,method:"get",url:r.baseUrl+"cm/companies/:id/contacts"}}),r.cmContact=e(r.baseUrl+"cm/contacts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/contacts/describe"},clone:{method:"post",url:r.baseUrl+"cm/contacts/:id/clone",params:{includeAll:"@includeAll"}},merge:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/merge"},bulkCreate:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/create_many"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/tags"},setAdditionalPhones:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/phones"},getAdditionalPhones:{isArray:!0,method:"get",url:r.baseUrl+"cm/contacts/:id/phones"},duplicateAdditionalPhones:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/duplicateAdditionalPhones"},rescheduleAdditionalPhones:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/rescheduleAdditionalPhones"},getHoppers:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/hopper_finals"},getJscriptySessions:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/jscripty_sessions"},uploadCsv:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/csv"},upload:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/upload"},import:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/upload/:id"},importUpdates:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/uploadUpdates/:id"},getJourney:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/journey"}}),r.cmHopper=e(r.baseUrl+"cm/hopper/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper/:id/clone",params:{includeAll:"@includeAll"}},getPreview:{isArray:!1,method:"post",url:r.baseUrl+"cm/hopper/preview"},getPreviewRecall:{isArray:!1,method:"get",url:r.baseUrl+"cm/hopper/:id/previewrecall"},getOpenContacts:{isArray:!1,method:"get",url:r.baseUrl+"cm/hopper/opencontacts"},getTimezones:{isArray:!1,method:"get",url:r.baseUrl+"cm/hopper/timezones"},getTimezone:{isArray:!1,method:"post",url:r.baseUrl+"cm/hopper/timezone"}}),r.cmHopperBlack=e(r.baseUrl+"cm/hopper_black/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper_black/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper_black/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmHopperFinal=e(r.baseUrl+"cm/hopper_final/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper_final/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper_final/:id/clone",params:{includeAll:"@includeAll"}},countContactsQueueCampaignHopperFinal:{isArray:!0,method:"get",url:r.baseUrl+"cm/hopper_final/voice/queue/countAttributes/:id"},countContactsIvrCampaignHopperFinal:{isArray:!0,method:"get",url:r.baseUrl+"cm/hopper_final/campaign/countAttributes/:id"},moveContactsQueueCampaignHopperFinal:{isArray:!0,method:"post",url:r.baseUrl+"cm/hopper_final/voice/queue/moveContacts/:id"},moveContactsIvrCampaignHopperFinal:{isArray:!0,method:"post",url:r.baseUrl+"cm/hopper_final/voice/campaign/moveContacts/:id"},checkContactHopper:{isArray:!1,method:"post",url:r.baseUrl+"cm/hopper_final/checkContactHopper"}}),r.cmHopperHistory=e(r.baseUrl+"cm/hopper_history/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper_history/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper_history/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmCustomField=e(r.baseUrl+"cm/custom_fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/custom_fields/describe"},clone:{method:"post",url:r.baseUrl+"cm/custom_fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.action=e(r.baseUrl+"actions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"actions/describe"},clone:{method:"post",url:r.baseUrl+"actions/:id/clone",params:{includeAll:"@includeAll"}}}),r.automation=e(r.baseUrl+"automations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"automations/describe"},clone:{method:"post",url:r.baseUrl+"automations/:id/clone",params:{includeAll:"@includeAll"}},addConditions:{isArray:!1,method:"post",url:r.baseUrl+"automations/:id/conditions"},getConditions:{isArray:!1,method:"get",url:r.baseUrl+"automations/:id/conditions"},addActions:{isArray:!1,method:"post",url:r.baseUrl+"automations/:id/actions"},getActions:{isArray:!1,method:"get",url:r.baseUrl+"automations/:id/actions"}}),r.cannedAnswer=e(r.baseUrl+"canned_answers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"canned_answers/describe"},clone:{method:"post",url:r.baseUrl+"canned_answers/:id/clone",params:{includeAll:"@includeAll"}}}),r.disposition=e(r.baseUrl+"dispositions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"dispositions/describe"},clone:{method:"post",url:r.baseUrl+"dispositions/:id/clone",params:{includeAll:"@includeAll"}}}),r.condition=e(r.baseUrl+"conditions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"conditions/describe"},clone:{method:"post",url:r.baseUrl+"conditions/:id/clone",params:{includeAll:"@includeAll"}}}),r.interval=e(r.baseUrl+"intervals/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"intervals/describe"},clone:{method:"post",url:r.baseUrl+"intervals/:id/clone",params:{includeAll:"@includeAll"}},addInterval:{isArray:!1,method:"post",url:r.baseUrl+"intervals/:id/sub_intervals"},getIntervals:{isArray:!1,method:"get",url:r.baseUrl+"intervals/:id/sub_intervals"},addIntervals:{isArray:!0,method:"post",url:r.baseUrl+"intervals/:id/sub_intervals/create_many"}}),r.pause=e(r.baseUrl+"pauses/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"pauses/describe"},clone:{method:"post",url:r.baseUrl+"pauses/:id/clone",params:{includeAll:"@includeAll"}}}),r.cdr=e(r.baseUrl+"cdr/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cdr/describe"},clone:{method:"post",url:r.baseUrl+"cdr/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceQueuesLog=e(r.baseUrl+"voiceQueuesLog/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voiceQueuesLog/describe"},clone:{method:"post",url:r.baseUrl+"voiceQueuesLog/:id/clone",params:{includeAll:"@includeAll"}}}),r.schedule=e(r.baseUrl+"schedules/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"schedules/describe"},clone:{method:"post",url:r.baseUrl+"schedules/:id/clone",params:{includeAll:"@includeAll"}},run:{isArray:!1,method:"get",url:r.baseUrl+"schedules/:id/run"}}),r.sound=e(r.baseUrl+"sounds/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sounds/describe"},clone:{method:"post",url:r.baseUrl+"sounds/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"sounds/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},delete:{isArray:!1,method:"delete",url:r.baseUrl+"sounds/:id"}}),r.tag=e(r.baseUrl+"tags/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"tags/describe"},clone:{method:"post",url:r.baseUrl+"tags/:id/clone",params:{includeAll:"@includeAll"}}}),r.contactItemType=e(r.baseUrl+"contact_item_types/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"contact_item_types/describe"},clone:{method:"post",url:r.baseUrl+"contact_item_types/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmContactHasItem=e(r.baseUrl+"cm_contact_has_items/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm_contact_has_items/describe"},clone:{method:"post",url:r.baseUrl+"cm_contact_has_items/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmHopperAdditionalPhone=e(r.baseUrl+"cm_hopper_additional_phones/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm_hopper_additional_phones/describe"},clone:{method:"post",url:r.baseUrl+"cm_hopper_additional_phones/:id/clone",params:{includeAll:"@includeAll"}}}),r.template=e(r.baseUrl+"templates/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"templates/describe"},clone:{method:"post",url:r.baseUrl+"templates/:id/clone",params:{includeAll:"@includeAll"}}}),r.trigger=e(r.baseUrl+"triggers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"triggers/describe"},clone:{method:"post",url:r.baseUrl+"triggers/:id/clone",params:{includeAll:"@includeAll"}},addAllCondition:{isArray:!1,method:"post",url:r.baseUrl+"triggers/:id/all_conditions"},addAnyCondition:{isArray:!1,method:"post",url:r.baseUrl+"triggers/:id/any_conditions"},getAllConditions:{isArray:!1,method:"get",url:r.baseUrl+"triggers/:id/all_conditions"},getAnyConditions:{isArray:!1,method:"get",url:r.baseUrl+"triggers/:id/any_conditions"},addAction:{isArray:!1,method:"post",url:r.baseUrl+"triggers/:id/actions"},getActions:{isArray:!1,method:"get",url:r.baseUrl+"triggers/:id/actions"}}),r.variable=e(r.baseUrl+"variables/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"variables/describe"},clone:{method:"post",url:r.baseUrl+"variables/:id/clone",params:{includeAll:"@includeAll"}}}),r.integration=e(r.baseUrl+"integrations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/:id/clone",params:{includeAll:"@includeAll"}}}),r.integrationReport=e(r.baseUrl+"integrations/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/reports/describe"},clone:{method:"post",url:r.baseUrl+"integrations/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.analyticCustomReport=e(r.baseUrl+"analytics/custom_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/custom_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/custom_reports/:id/clone",params:{includeAll:"@includeAll"}},preview:{isArray:!0,method:"get",url:r.baseUrl+"analytics/custom_reports/:id/preview"},run:{isArray:!1,method:"get",url:r.baseUrl+"analytics/custom_reports/:id/run"},query:{isArray:!1,method:"get",url:r.baseUrl+"analytics/custom_reports/:id/query"}}),r.analyticDefaultReport=e(r.baseUrl+"analytics/default_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/default_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/default_reports/:id/clone",params:{includeAll:"@includeAll"}},preview:{isArray:!0,method:"get",url:r.baseUrl+"analytics/default_reports/:id/preview"},run:{isArray:!1,method:"get",url:r.baseUrl+"analytics/default_reports/:id/run"},query:{isArray:!1,method:"get",url:r.baseUrl+"analytics/default_reports/:id/query"}}),r.analyticExtractedReport=e(r.baseUrl+"analytics/extracted_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/extracted_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/extracted_reports/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"analytics/extracted_reports/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.analyticMetric=e(r.baseUrl+"analytics/metrics/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/metrics/describe"},clone:{method:"post",url:r.baseUrl+"analytics/metrics/:id/clone",params:{includeAll:"@includeAll"}}}),r.analyticFieldReport=e(r.baseUrl+"analytics/field_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/field_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/field_reports/:id/clone",params:{includeAll:"@includeAll"}},bulkCreate:{method:"post",url:r.baseUrl+"analytics/field_reports/create_many",isArray:!0},bulkDestroy:{method:"delete",url:r.baseUrl+"analytics/field_reports/destroy_many",isArray:!0},addFields:{isArray:!0,method:"post",url:r.baseUrl+"analytics/field_reports/:id/create_many"}}),r.analyticTreeReport=e(r.baseUrl+"analytics/tree_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/tree_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/tree_reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.intSalesforceAccount=e(r.baseUrl+"integrations/salesforce/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/salesforce/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/salesforce/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/salesforce/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/accounts/:id/fields"}}),r.intSalesforceConfiguration=e(r.baseUrl+"integrations/salesforce/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/salesforce/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/salesforce/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/configurations/:id/descriptions"}}),r.intSalesforceField=e(r.baseUrl+"integrations/salesforce/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/salesforce/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/salesforce/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intSugarcrmAccount=e(r.baseUrl+"integrations/sugarcrm/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/sugarcrm/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/fields"}}),r.intSugarcrmConfiguration=e(r.baseUrl+"integrations/sugarcrm/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/descriptions"}}),r.intSugarcrmField=e(r.baseUrl+"integrations/sugarcrm/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/sugarcrm/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/sugarcrm/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intDeskAccount=e(r.baseUrl+"integrations/desk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/desk/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/desk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/desk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/accounts/:id/fields"}}),r.intDeskConfiguration=e(r.baseUrl+"integrations/desk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/desk/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/desk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"integrations/desk/configurations/:id/tags"}}),r.intDeskField=e(r.baseUrl+"integrations/desk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/desk/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/desk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intZohoAccount=e(r.baseUrl+"integrations/zoho/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zoho/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zoho/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/zoho/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/accounts/:id/fields"}}),r.intZohoConfiguration=e(r.baseUrl+"integrations/zoho/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zoho/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zoho/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/configurations/:id/descriptions"}}),r.intZohoField=e(r.baseUrl+"integrations/zoho/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zoho/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zoho/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intZendeskAccount=e(r.baseUrl+"integrations/zendesk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zendesk/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zendesk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/zendesk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/accounts/:id/fields"}}),r.intZendeskConfiguration=e(r.baseUrl+"integrations/zendesk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zendesk/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zendesk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"integrations/zendesk/configurations/:id/tags"}}),r.intZendeskField=e(r.baseUrl+"integrations/zendesk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zendesk/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zendesk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intFreshdeskAccount=e(r.baseUrl+"integrations/freshdesk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshdesk/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshdesk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/freshdesk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/accounts/:id/fields"}}),r.intFreshdeskConfiguration=e(r.baseUrl+"integrations/freshdesk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshdesk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"integrations/freshdesk/configurations/:id/tags"}}),r.intFreshdeskField=e(r.baseUrl+"integrations/freshdesk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshdesk/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshdesk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intVtigerAccount=e(r.baseUrl+"integrations/vtiger/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/vtiger/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/vtiger/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/vtiger/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/accounts/:id/fields"}}),r.intVtigerConfiguration=e(r.baseUrl+"integrations/vtiger/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/vtiger/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/vtiger/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/configurations/:id/descriptions"}}),r.intVtigerField=e(r.baseUrl+"integrations/vtiger/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/vtiger/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/vtiger/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intServicenowAccount=e(r.baseUrl+"integrations/servicenow/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/servicenow/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/servicenow/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/servicenow/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/accounts/:id/fields"}}),r.intServicenowConfiguration=e(r.baseUrl+"integrations/servicenow/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/servicenow/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/servicenow/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/configurations/:id/descriptions"}}),r.intServicenowField=e(r.baseUrl+"integrations/servicenow/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/servicenow/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/servicenow/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intDynamics365Account=e(r.baseUrl+"integrations/dynamics365/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/dynamics365/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/dynamics365/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/dynamics365/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/accounts/:id/fields"}}),r.intDynamics365Configuration=e(r.baseUrl+"integrations/dynamics365/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/dynamics365/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/:id/descriptions"}}),r.intDynamics365Field=e(r.baseUrl+"integrations/dynamics365/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/dynamics365/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/dynamics365/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intFreshsalesAccount=e(r.baseUrl+"integrations/freshsales/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshsales/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshsales/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/freshsales/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/accounts/:id/fields"}}),r.intFreshsalesConfiguration=e(r.baseUrl+"integrations/freshsales/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshsales/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshsales/configurations/:id/clone",params:{includeAll:"@includeAll"}},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/configurations/:id/descriptions"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/configurations/:id/fields"}}),r.intFreshsalesField=e(r.baseUrl+"integrations/freshsales/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshsales/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshsales/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.network=e(r.baseUrl+"networks/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"networks/describe"},clone:{method:"post",url:r.baseUrl+"networks/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatQueueReport=e(r.baseUrl+"chat/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"chat/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatInternalMessage=e(r.baseUrl+"chat/internal/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/internal/messages/describe"},clone:{method:"post",url:r.baseUrl+"chat/internal/messages/:id/clone",params:{includeAll:"@includeAll"}},getUsers:{isArray:!1,method:"get",url:r.baseUrl+"chat/internal/messages/users"}}),r.jscriptyAnswerReport=e(r.baseUrl+"jscripty/answers/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/answers/reports/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/answers/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.jscriptyQuestionReport=e(r.baseUrl+"jscripty/questions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/questions/reports/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/questions/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.jscriptySessionReport=e(r.baseUrl+"jscripty/sessions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/sessions/reports/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/sessions/reports/:id/clone",params:{includeAll:"@includeAll"}},getQuestions:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/sessions/reports/:id/questions"}}),r.smsQueueReport=e(r.baseUrl+"sms/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"sms/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.squareReport=e(r.baseUrl+"square/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/reports/describe"},clone:{method:"post",url:r.baseUrl+"square/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.squareReportDetail=e(r.baseUrl+"square/details/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/details/reports/describe"},clone:{method:"post",url:r.baseUrl+"square/details/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.jscriptyProject=e(r.baseUrl+"jscripty/projects/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/projects/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/projects/:id/clone",params:{includeAll:"@includeAll"}},getSessions:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/projects/:id/sessions"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/projects/:id/answers"},getSummary:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/projects/:id/summary",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.setting=e(r.baseUrl+"settings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"settings/describe"},clone:{method:"post",url:r.baseUrl+"settings/:id/clone",params:{includeAll:"@includeAll"}},addLogo:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/logo"},addLogoLogin:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/logo_login"},getLogo:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/logo"},getLogoLogin:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/logo_login"},gdpr:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/gdpr"},addPreferred:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/preferred"},getPreferred:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/preferred"},addFavicon:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/favicon"},getFavicon:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/favicon"},getDate:{isArray:!1,method:"get",url:r.baseUrl+"settings/now"}}),r.squareOdbc=e(r.baseUrl+"square/odbc/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/odbc/describe"},clone:{method:"post",url:r.baseUrl+"square/odbc/:id/clone",params:{includeAll:"@includeAll"}},test:{isArray:!1,method:"get",url:r.baseUrl+"square/odbc/:id/test"}}),r.squareProject=e(r.baseUrl+"square/projects/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/projects/describe"},clone:{method:"post",url:r.baseUrl+"square/projects/:id/clone",params:{includeAll:"@includeAll"}},addUsers:{isArray:!0,method:"post",url:r.baseUrl+"square/projects/:id/users"},removeUsers:{isArray:!1,method:"delete",url:r.baseUrl+"square/projects/:id/users"},getUsers:{isArray:!1,method:"get",url:r.baseUrl+"square/projects/:id/users"}}),r.squareRecording=e(r.baseUrl+"square/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/recordings/describe"},clone:{method:"post",url:r.baseUrl+"square/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"square/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.squareMessage=e(r.baseUrl+"square/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/messages/describe"},clone:{method:"post",url:r.baseUrl+"square/messages/:id/clone",params:{includeAll:"@includeAll"}}}),r.team=e(r.baseUrl+"teams/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"teams/describe"},clone:{method:"post",url:r.baseUrl+"teams/:id/clone",params:{includeAll:"@includeAll"}},getQueues:{isArray:!0,method:"get",url:r.baseUrl+"teams/:id/queues"},addQueues:{isArray:!0,method:"post",url:r.baseUrl+"teams/:id/queues"},removeQueues:{isArray:!1,method:"delete",url:r.baseUrl+"teams/:id/queues"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"teams/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"teams/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"teams/:id/users"}}),r.license=e(r.baseUrl+"license/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"license/describe"},clone:{method:"post",url:r.baseUrl+"license/:id/clone",params:{includeAll:"@includeAll"}},downloadLogFile:{isArray:!1,method:"get",url:r.baseUrl+"license/download_log_file",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.campaign=e(r.baseUrl+"campaigns/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"campaigns/describe"},clone:{method:"post",url:r.baseUrl+"campaigns/:id/clone",params:{includeAll:"@includeAll"}},getHoppers:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hopper_finals"},getHopperBlacks:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hopper_black"},getLists:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/lists"},addLists:{isArray:!0,method:"post",url:r.baseUrl+"campaigns/:id/lists"},removeLists:{isArray:!0,method:"delete",url:r.baseUrl+"campaigns/:id/lists"},getBlackLists:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/blacklists"},addBlackLists:{isArray:!0,method:"post",url:r.baseUrl+"campaigns/:id/blacklists"},removeBlackLists:{isArray:!0,method:"delete",url:r.baseUrl+"campaigns/:id/blacklists"}}),r.migration=e(r.baseUrl+"migrations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"migrations/describe"},clone:{method:"post",url:r.baseUrl+"migrations/:id/clone",params:{includeAll:"@includeAll"}}}),r.attachment=e(r.baseUrl+"attachments/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"attachments/describe"},clone:{method:"post",url:r.baseUrl+"attachments/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"attachments/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.plugin=e(r.baseUrl+"plugins/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"plugins/describe"},clone:{method:"post",url:r.baseUrl+"plugins/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"plugins/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},upload:{isArray:!1,method:"post",url:r.baseUrl+"plugins/"},delete:{isArray:!1,method:"delete",url:r.baseUrl+"plugins/:id"},webhookGet:{isArray:!1,method:"get",url:r.baseUrl+"plugins/webhook"},webhookPost:{isArray:!1,method:"post",url:r.baseUrl+"plugins/webhook"}}),r.mailTransferReport=e(r.baseUrl+"mail/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"mail/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatTransferReport=e(r.baseUrl+"chat/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"chat/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.faxTransferReport=e(r.baseUrl+"fax/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"fax/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.openchannelTransferReport=e(r.baseUrl+"openchannel/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.smsTransferReport=e(r.baseUrl+"sms/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"sms/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmList=e(r.baseUrl+"cm/lists/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/lists/describe"},clone:{method:"post",url:r.baseUrl+"cm/lists/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"cm/lists/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"cm/lists/:id/dispositions"},addContacts:{isArray:!1,method:"post",url:r.baseUrl+"cm/lists/:id/contacts"},getContacts:{isArray:!0,method:"get",url:r.baseUrl+"cm/lists/:id/contacts"},getContactsCsv:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/contacts/csv",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},addCustomField:{isArray:!1,method:"post",url:r.baseUrl+"cm/lists/:id/fields"},getCustomFields:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/fields"},getGlobalCustomFields:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/global_fields"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"cm/lists/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"cm/lists/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/users"}}),r.voicePrefix=e(r.baseUrl+"voice/prefixes/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/prefixes/describe"},clone:{method:"post",url:r.baseUrl+"voice/prefixes/:id/clone",params:{includeAll:"@includeAll"}},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"voice/prefixes/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"voice/prefixes/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"voice/prefixes/:id/users"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"voice/prefixes/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"voice/prefixes/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"voice/prefixes/:id/teams"}}),r.userProfile=e(r.baseUrl+"userProfiles/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userProfiles/describe"},clone:{method:"post",url:r.baseUrl+"userProfiles/:id/clone",params:{includeAll:"@includeAll"}},addSections:{isArray:!0,method:"post",url:r.baseUrl+"userProfiles/:id/sections"},removeSections:{isArray:!1,method:"delete",url:r.baseUrl+"userProfiles/:id/sections"},getSections:{isArray:!0,method:"get",url:r.baseUrl+"userProfiles/:id/sections"},addResources:{isArray:!0,method:"post",url:r.baseUrl+"userProfiles/:id/resources"},removeResources:{isArray:!1,method:"delete",url:r.baseUrl+"userProfiles/:id/resources"},getResources:{isArray:!1,method:"get",url:r.baseUrl+"userProfiles/:id/resources"}}),r.userProfileSection=e(r.baseUrl+"userProfile/sections/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userProfile/sections/describe"},clone:{method:"post",url:r.baseUrl+"userProfile/sections/:id/clone",params:{includeAll:"@includeAll"}}}),r.userProfileResource=e(r.baseUrl+"userProfile/resources/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userProfile/resources/describe"},clone:{method:"post",url:r.baseUrl+"userProfile/resources/:id/clone",params:{includeAll:"@includeAll"}}}),r.userNotification=e(r.baseUrl+"userNotifications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userNotifications/describe"},clone:{method:"post",url:r.baseUrl+"userNotifications/:id/clone",params:{includeAll:"@includeAll"}},sendUserNotification:{isArray:!1,method:"post",url:r.baseUrl+"userNotifications/"}}),r.whatsappAccount=e(r.baseUrl+"whatsapp/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/accounts/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/accounts/:id/canned_answers"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/users"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/applications"},notify:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/notify"},send:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/send"}}),r.whatsappApplication=e(r.baseUrl+"whatsapp/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/applications/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.whatsappInteraction=e(r.baseUrl+"whatsapp/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/interactions/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.whatsappMessage=e(r.baseUrl+"whatsapp/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/messages/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"whatsapp/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"whatsapp/messages/:id/reject"},status:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/messages/:id/status"}}),r.whatsappQueueReport=e(r.baseUrl+"whatsapp/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.whatsappTransferReport=e(r.baseUrl+"whatsapp/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.whatsappQueue=e(r.baseUrl+"whatsapp/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/queues/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"whatsapp/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"whatsapp/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/queues/:id/users"}}),r.cloudProvider=e(r.baseUrl+"cloudProviders/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cloudProviders/describe"},clone:{method:"post",url:r.baseUrl+"cloudProviders/:id/clone",params:{includeAll:"@includeAll"}},oauth2MicrosoftAuthorize:{method:"get",url:r.baseUrl+"cloudProviders/:id/oauth2/microsoft/authorize"}}),r.realtime=e(r.baseUrl+"realtime",{},{getAgents:{isArray:!1,method:"get",url:r.baseUrl+"realtime/agents"},getQueues:{isArray:!1,method:"get",url:r.baseUrl+"realtime/queues"}}),r.userSetting=e(r.baseUrl+"user-settings/:id",{id:"@id"},{update:{method:"put",isArray:!1}}),r}e.$inject=["$resource","userProfileManager"],angular.module("motion").factory("api",e)}(),function(){"use strict";function e(e,n){n.setConfig({position:"top-right",sound:!1,html:!0,theme:"material"}),e.useLoader("$translatePartialLoader",{urlTemplate:"{part}/i18n/{lang}.json"}),e.preferredLanguage("en"),e.fallbackLanguage("en"),e.useSanitizeValueStrategy(null)}e.$inject=["$translateProvider","toastyConfigProvider"],angular.module("motion").config(e)}(),function(){"use strict";angular.module("motion")}(),function(){"use strict";function e(e,n,t,a){var i=this;i.themes=e.themes,i.direction="ltr";var s=t.get("motion.language");s&&(n.use(s),0<=["ar","fa","he"].indexOf(s)&&a.setting.get({id:1}).$promise.then(function(e){e&&e.rtlSupport&&(i.direction="rtl")}).catch(function(e){e&&toasty.error({title:"Error",msg:e.data?e.data.message||e.message||e:e.message||e})}))}e.$inject=["motionTheming","$translate","$cookies","api"],angular.module("motion").controller("IndexController",e)}(),function(){"use strict";function e(a,i){return function(e){var n=new Date,t=new Date(e);return t.getDate()===n.getDate()&&t.getMonth()===n.getMonth()&&t.getFullYear()===n.getFullYear()?a("date")(t.getTime(),"shortTime"):t.getDate()===n.getDate()-1&&t.getMonth()===n.getMonth()&&t.getFullYear()===n.getFullYear()?i.instant("DASHBOARDS.YESTERDAY")+" "+a("date")(t.getTime(),"shortTime"):a("date")(t.getTime(),"MMM d, y h:mm a")}}function n(e){return{Today:e.instant("DASHBOARDS.TODAY"),Yesterday:e.instant("DASHBOARDS.YESTERDAY"),"This Week":e.instant("DASHBOARDS.THIS_WEEK"),"Last Week":e.instant("DASHBOARDS.LAST_WEEK"),"This Month":e.instant("DASHBOARDS.THIS_MONTH"),"Last Month":e.instant("DASHBOARDS.LAST_MONTH"),"This Year":e.instant("DASHBOARDS.THIS_YEAR"),"Last Year":e.instant("DASHBOARDS.LAST_YEAR"),January:e.instant("DASHBOARDS.JANUARY"),February:e.instant("DASHBOARDS.FEBRUARY"),March:e.instant("DASHBOARDS.MARCH"),April:e.instant("DASHBOARDS.APRIL"),May:e.instant("DASHBOARDS.MAY"),June:e.instant("DASHBOARDS.JUNE"),July:e.instant("DASHBOARDS.JULY"),August:e.instant("DASHBOARDS.AUGUST"),September:e.instant("DASHBOARDS.SEPTEMBER"),October:e.instant("DASHBOARDS.OCTOBER"),November:e.instant("DASHBOARDS.NOVEMBER"),December:e.instant("DASHBOARDS.DECEMBER"),Mon:e.instant("DASHBOARDS.MON"),Tue:e.instant("DASHBOARDS.TUE"),Wed:e.instant("DASHBOARDS.WED"),Thu:e.instant("DASHBOARDS.THU"),Fri:e.instant("DASHBOARDS.FRI"),Sat:e.instant("DASHBOARDS.SAT"),Sun:e.instant("DASHBOARDS.SUN")}}e.$inject=["$filter","$translate"],n.$inject=["$translate"],angular.module("motion").filter("limitObjectFromTo",function(){return function(e,n,t){var a,i={},s=0;for(a in e)if(t<=s&&(i[a]=e[a]),++s===t+n)break;return i}}).filter("formatdate",e).factory("IndexFactory",function(){var e=[{value:"jan"},{value:"feb"},{value:"mar"},{value:"apr"},{value:"may"},{value:"jun"},{value:"jul"},{value:"aug"},{value:"sep"},{value:"oct"},{value:"nov"},{value:"dec"}],n=[{value:"1"},{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"10"},{value:"11"},{value:"12"}],t=[{value:"mon"},{value:"tue"},{value:"wed"},{value:"thu"},{value:"fri"},{value:"sat"},{value:"sun"}],a=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];return{getMonthName:function(){return e},getMonthNumber:function(){return n},getDaysOfWeek:function(){return t},getDaysOfMonth:function(){return a}}}).factory("dateFilterLocalizationFactory",n).factory("jscookie",function(){return Cookies}).factory("Sequence",function(){return{enqueue:function(e){this.tail=this.tail?this.tail.finally(e):e()}}})}(),function(){"use strict";function e(e,n,t){var a;t.html5Mode(!0),n.otherwise("/dashboards/general"),angular.injector(["ngCookies"]).invoke(["$cookies",function(e){a=e}]);var i=a.get("motion.layoutStyle")||"verticalNavigation",s={verticalNavigation:{main:"app/core/layouts/vertical-navigation.html",toolbar:"app/toolbar/layouts/vertical-navigation/toolbar.html",navigation:"app/navigation/layouts/vertical-navigation/navigation.html",header:"app/header/layouts/vertical-navigation/header.html",footer:"app/footer/layouts/vertical-navigation/footer.html"},verticalNavigationFullwidthToolbar:{main:"app/core/layouts/vertical-navigation-fullwidth-toolbar.html",toolbar:"app/toolbar/layouts/vertical-navigation-fullwidth-toolbar/toolbar.html",navigation:"app/navigation/layouts/vertical-navigation/navigation.html"},verticalNavigationFullwidthToolbar2:{main:"app/core/layouts/vertical-navigation-fullwidth-toolbar-2.html",toolbar:"app/toolbar/layouts/vertical-navigation-fullwidth-toolbar-2/toolbar.html",navigation:"app/navigation/layouts/vertical-navigation-fullwidth-toolbar-2/navigation.html"},horizontalNavigation:{main:"app/core/layouts/horizontal-navigation.html",toolbar:"app/toolbar/layouts/horizontal-navigation/toolbar.html",navigation:"app/navigation/layouts/horizontal-navigation/navigation.html"},contentOnly:{main:"app/core/layouts/content-only.html",toolbar:"",navigation:""},contentWithToolbar:{main:"app/core/layouts/content-with-toolbar.html",toolbar:"app/toolbar/layouts/content-with-toolbar/toolbar.html",navigation:""}};e.state("app",{abstract:!0,views:{"main@":{templateUrl:s[i].main,controller:"MainController as vm"},"toolbar@app":{templateUrl:s[i].toolbar,controller:"ToolbarController as vm"},"navigation@app":{templateUrl:s[i].navigation,controller:"NavigationController as vm"},"quickPanel@app":{templateUrl:"app/quick-panel/quick-panel.html",controller:"QuickPanelController as vm"},"header@app":{templateUrl:s[i].header,controller:"HeaderController as vm"},"footer@app":{templateUrl:s[i].footer,controller:"FooterController as vm"}},resolve:{license:["apiResolver",function(e){return e.resolve("license@get")}],setting:["apiResolver","settingsManager",function(e,n){return e.resolve("setting@get",{id:1}).then(function(e){return n.set(e),e})}]}})}e.$inject=["$stateProvider","$urlRouterProvider","$locationProvider"],angular.module("motion").config(e)}(),function(){"use strict";function e(e,n){e.onStart({},n.showLoadingIndicator),e.onFinish({},n.hideLoadingIndicator)}e.$inject=["$transitions","LoadingIndicatorService"],angular.module("motion").run(e)}(),function(){"use strict";function e(a,e){var i,o={};function s(){a.$broadcast("socket:connect"),i&&i.connected||(i=io({query:e.getCurrentUser()?"id="+e.getCurrentUser().id:void 0,transports:["websocket","polling"]})).once("disconnect",n)}function n(e){i.once("connect",s),"logout"===e?i.removeAllListeners():a.$broadcast("socket:disconnect"),i&&i.connected&&i.disconnect()}function r(e,n,t){o[e]||(o[e]=[]),o[e].push({wrapper:n,fn:t})}return{connect:s,disconnect:n,getListeners:function(e){return e?o[e]:o},on:function(e,n){n=n||angular.noop,i||s();var t=function(){var e=arguments;a.$applyAsync(function(){n.apply(i,e)})};r(e,t,n),i.on(e,t)},onWithoutApply:function(e,n){n=n||angular.noop,i||s();var t=function(){n.apply(i,arguments)};r(e,t,n),i.on(e,t)},emit:function(e,n,t){t=t||angular.noop,i||s(),i.emit(e,n,function(){var e=arguments;a.$applyAsync(function(){t.apply(i,e)})})},removeAllListeners:function(e){var n;i||s(),i.removeAllListeners(e),n=e,_.isEmpty(o[n])||delete o[n]},removeListener:function(e,n){i||s();var t=function(e,n){var t=o[e];if(!_.isEmpty(t))for(var a=0;a<t.length;a++){var i=t[a];if(i.fn===n){var s=i.wrapper;return t.splice(a,1),s}}}(e,n);i.removeListener(e,t)}}}e.$inject=["$rootScope","Auth"],angular.module("motion").factory("socket",e)}(),function(){"use strict";function e(n,t,e,a,i,s,o,r){var l=this;l.progresslogin=!1,l.googleSsoEnabled=!1,l.adSsoEnabled=!1,l.login=function(){return l.progresslogin=!0,l.message="",s.login(l.form).then(function(){return n.go("app.dashboards.general")}).catch(function(e){l.message=e.data?e.data.message:e.message}).finally(function(){l.progresslogin=!1})},l.loginOauth=function(e){l.message="",t.location.href=s.loginSSO(e)},l.loginAD=function(){return l.progresslogin=!0,l.message="",s.loginAD(l.form).then(function(){return n.go("app.dashboards.general")}).catch(function(e){l.message=e.data?e.data.message:e.message}).finally(function(){l.progresslogin=!1})},l.onInit=function(){{if(n.params.token&&n.params.userId)return s.removeCookies(),l.progresslogin=!0,o.secureCookieEnabled?r.set("motion.token",n.params.token,{secure:!0,sameSite:"none"}):r.set("motion.token",n.params.token),i.user.get({id:n.params.userId}).$promise.then(function(e){e&&(s.setCurrentUser(e),n.go("app.dashboards.general"))}).finally(function(){l.progresslogin=!1});s.isLoggedIn()&&n.go("app.dashboards.general")}l.googleSsoEnabled=o.googleSsoEnabled,l.adSsoEnabled=o.adSsoEnabled},l.onInit()}e.$inject=["$state","$window","$cookies","$timeout","api","Auth","setting","jscookie"],angular.module("app.login").controller("LoginController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="ANALYTICS.EDIT_EXTRACTEDREPORT",g.extractedReport=angular.copy(l),g.extractedReports=r,g.newExtractedReport=!1,g.extractedReport||(g.extractedReport={},g.title="ANALYTICS.NEW_EXTRACTEDREPORT",g.newExtractedReport=!0),g.addNewExtractedReport=function(){g.errors=[],d.analyticExtractedReport.save(g.extractedReport).$promise.then(function(e){g.extractedReports.unshift(e.toJSON()),o.success({title:"ExtractedReport properly created",msg:g.extractedReport.name?g.extractedReport.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticExtractedReport.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveExtractedReport=function(){g.errors=[],d.analyticExtractedReport.update({id:g.extractedReport.id},g.extractedReport).$promise.then(function(e){var n=_.find(g.extractedReports,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ExtractedReport properly saved!",msg:g.extractedReport.name?g.extractedReport.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticExtractedReport.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteExtractedReport=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The extractedReport will be deleted.").ariaLabel("Delete ExtractedReport").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.analyticExtractedReport.delete({id:g.extractedReport.id}).$promise.then(function(){_.remove(g.extractedReports,{id:g.extractedReport.id}),o.success({title:"ExtractedReport properly deleted!",msg:(g.extractedReport.name||"extractedReport")+" has been deleted!"}),v(g.extractedReport)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticExtractedReport.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","extractedReports","extractedReport","api","Auth","license","setting","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditExtractedReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.extractedReports=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="extractedReports",f.listOrder="",f.listOrderAsc=null,f.selectedExtractedReports=[],f.query={fields:"createdAt,updatedAt,id,name,basename,savename,type,startDate,endDate,status,output,reportId,reportType",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditExtractedReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/extractedReports/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{extractedReport:e,extractedReports:f.extractedReports.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.downloadfile2=function(s,e){return m.analyticExtractedReport.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.savename;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("extractedReport")+"?").htmlContent("<b>"+(e.name||"extractedReport")+"</b> will be deleted.").ariaLabel("delete extractedReport").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getExtractedReports=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.analyticExtractedReport.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ExtractedReports",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditExtractedReport=function(e,n){i.show({controller:"CreateOrEditExtractedReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/extractedReports/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{extractedReport:n,extractedReports:f.extractedReports.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteExtractedReport=y,f.exportSelectedExtractedReports=function(){var e=angular.copy(f.selectedExtractedReports);return f.selectedExtractedReports=[],e},f.deleteSelectedExtractedReports=function(e){var n=i.confirm().title("Are you sure want to delete the selected extractedReports?").htmlContent("<b>"+f.selectedExtractedReports.length+" selected</b> will be deleted.").ariaLabel("delete ExtractedReports").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedExtractedReports.forEach(function(e){y(e)}),f.selectedExtractedReports=[]})},f.deselectExtractedReports=function(){f.selectedExtractedReports=[]},f.selectAllExtractedReports=function(){f.selectedExtractedReports=f.extractedReports.rows};var b=!0,A=1;function E(e){f.extractedReports=e||{count:0,rows:[]}}function y(e){m.analyticExtractedReport.delete({id:e.id}).$promise.then(function(){_.remove(f.extractedReports.rows,{id:e.id}),f.extractedReports.count-=1,f.extractedReports.rows.length||f.getExtractedReports(),p.success({title:_.startCase("ExtractedReport")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEanalyticExtractedReport"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEanalyticExtractedReport",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getExtractedReports())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","extractedReports","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.analytics").controller("ExtractedReportsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="ANALYTICS.EDIT_METRIC",g.metric=angular.copy(l),g.metrics=r,g.newMetric=!1,g.metric||(g.metric={table:"report_agent"},g.title="ANALYTICS.NEW_METRIC",g.newMetric=!0),g.addNewMetric=function(){g.errors=[],d.analyticMetric.save(g.metric).$promise.then(function(e){g.metrics.unshift(e.toJSON()),o.success({title:"Metric properly created",msg:g.metric.name?g.metric.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticMetric.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticMetric.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMetric=function(){g.errors=[],d.analyticMetric.update({id:g.metric.id},g.metric).$promise.then(function(e){var n=_.find(g.metrics,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Metric properly saved!",msg:g.metric.name?g.metric.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticMetric.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticMetric.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMetric=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The metric will be deleted.").ariaLabel("Delete Metric").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.analyticMetric.delete({id:g.metric.id}).$promise.then(function(){_.remove(g.metrics,{id:g.metric.id}),o.success({title:"Metric properly deleted!",msg:(g.metric.name||"metric")+" has been deleted!"}),v(g.metric)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticMetric.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticMetric.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","metrics","metric","api","Auth","license","setting","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditMetricDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.metrics=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="metrics",f.listOrder="",f.listOrderAsc=null,f.selectedMetrics=[],f.query={fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,page:1},f.arraytable=_.keyBy([{option:"Agent Report",value:"'report_agent'"},{option:"Call Report",value:"'report_call'"},{option:"CDR",value:"'cdr'"},{option:"Chat Website",value:"'chat_websites'"},{option:"Chat Interaction",value:"'chat_interactions'"},{option:"Chat Messages",value:"'chat_messages'"},{option:"Chat Offline Messages",value:"'chat_offline_messages'"},{option:"Chat Queues",value:"'chat_queues'"},{option:"Chat Report Queue",value:"'report_chat_queue'"},{option:"Chat Report Transfer",value:"'report_chat_transfer'"},{option:"Companies",value:"'cm_companies'"},{option:"Call transfer report",value:"'report_call_transfer'"},{option:"Contacts",value:"'cm_contacts'"},{option:"CSquare Report",value:"'report_square'"},{option:"CSquare Details Report",value:"'report_square_details'"},{option:"Dial Report",value:"'report_dial'"},{option:"Dialer Hopper Processing",value:"'cm_hopper'"},{option:"Dialer Hopper Logs",value:"'cm_hopper_history'"},{option:"Dialer Hopper Final",value:"'cm_hopper_final'"},{option:"Email Account",value:"'mail_accounts'"},{option:"Email Interaction",value:"'mail_interactions'"},{option:"Email Messages",value:"'mail_messages'"},{option:"Email Queues",value:"'mail_queues'"},{option:"Email Report Queue",value:"'report_mail_queue'"},{option:"Email Report Transfer",value:"'report_mail_transfer'"},{option:"Fax Account",value:"'fax_accounts'"},{option:"Fax Interaction",value:"'fax_interactions'"},{option:"Fax Messages",value:"'fax_messages'"},{option:"Fax Queues",value:"'fax_queues'"},{option:"Fax Report Queue",value:"'report_fax_queue'"},{option:"Fax Report Transfer",value:"'report_fax_transfer'"},{option:"Jscripty Sessions",value:"'report_jscripty_sessions'"},{option:"Jscripty Questions",value:"'report_jscripty_questions'"},{option:"Jscripty Answers",value:"'report_jscripty_answers'"},{option:"Lists",value:"'cm_lists'"},{option:"Member Report",value:"'report_member'"},{option:"Openchannel Account",value:"'openchannel_accounts'"},{option:"Openchannel Interaction",value:"'openchannel_interactions'"},{option:"Openchannel Messages",value:"'openchannel_messages'"},{option:"Openchannel Queues",value:"'openchannel_queues'"},{option:"Openchannel Report Queue",value:"'report_openchannel_queue'"},{option:"Openchannel Report Transfer",value:"'report_openchannel_transfer'"},{option:"Queue Report",value:"'report_queue'"},{option:"SMS Account",value:"'sms_accounts'"},{option:"SMS Interaction",value:"'sms_interactions'"},{option:"SMS Messages",value:"'sms_messages'"},{option:"SMS Queues",value:"'sms_queues'"},{option:"SMS Report Queue",value:"'report_sms_queue'"},{option:"SMS Report Transfer",value:"'report_sms_transfer'"},{option:"Users",value:"'users'"},{option:"Voice Recordings",value:"'voice_recordings'"},{option:"Whatsapp Account",value:"'whatsapp_accounts'"},{option:"Whatsapp Interaction",value:"'whatsapp_interactions'"},{option:"Whatsapp Messages",value:"'whatsapp_messages'"},{option:"Whatsapp Queues",value:"'whatsapp_queues'"},{option:"Whatsapp Report Queue",value:"'report_whatsapp_queue'"},{option:"Whatsapp Report Transfer",value:"'report_whatsapp_transfer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditMetricDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/metrics/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{metric:e,metrics:f.metrics.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("metric")+"?").htmlContent("<b>"+(e.name||"metric")+"</b> will be deleted.").ariaLabel("delete metric").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getMetrics=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.analyticMetric.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Metrics",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMetric=function(e,n){i.show({controller:"CreateOrEditMetricDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/metrics/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{metric:n,metrics:f.metrics.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteMetric=y,f.exportSelectedMetrics=function(){var e=angular.copy(f.selectedMetrics);return f.selectedMetrics=[],e},f.deleteSelectedMetrics=function(e){var n=i.confirm().title("Are you sure want to delete the selected metrics?").htmlContent("<b>"+f.selectedMetrics.length+" selected</b> will be deleted.").ariaLabel("delete Metrics").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMetrics.forEach(function(e){y(e)}),f.selectedMetrics=[]})},f.deselectMetrics=function(){f.selectedMetrics=[]},f.selectAllMetrics=function(){f.selectedMetrics=f.metrics.rows};var b=!0,A=1;function E(e){f.metrics=e||{count:0,rows:[]}}function y(e){m.analyticMetric.delete({id:e.id}).$promise.then(function(){_.remove(f.metrics.rows,{id:e.id}),f.metrics.count-=1,f.metrics.rows.length||f.getMetrics(),p.success({title:_.startCase("Metric")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEanalyticMetric"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEanalyticMetric",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMetrics())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","metrics","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.analytics").controller("MetricsController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o){var r=this;function l(){n.hide()}r.errors=[],r.report=angular.copy(t),r.report.name+="-copy",r.treeCustomData=o,r.treeCustomConfig={core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:["wholerow"]},r.treeCustomEvents={select_node:function(e,n){r.currentNode=n.node}},r.copyReport=function(){var t;r.errors=[],i.analyticCustomReport.save({name:r.report.name,description:r.report.description,table:r.report.table,conditions:r.report.conditions,joins:r.report.joins,parent:r.currentNode.id}).$promise.then(function(e){t=e,a.success({title:"Report properly copied!",msg:r.report.name?r.report.name+" has been copied!":""});var n={fields:"field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0};return n["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=r.report.id,i.analyticFieldReport.get(n).$promise}).then(function(e){var e=_.map(e.rows,function(e){return _.extend({},e,{CustomReportId:t.id})});return i.analyticFieldReport.bulkCreate(e).$promise}).then(function(){a.success({title:"Fields copied!",msg:"Fields has been copied!"}),l()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:COPYREPORT",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$location","$mdDialog","toasty","report","api","apiName","treeCustomData"],angular.module("app.analytics").controller("CopyReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;function m(){n.hide()}c.errors=[],c.joinTables=[],c.title="ANALYTICS.EDIT_REPORT",c.crudPermissions=d,c.report=angular.copy(i),c.reports=a,c.newReport=!1,c.tables=l.getMap(),c.joinTypes=[{key:"join",value:"Join"},{key:"left_join",value:"Left Join"},{key:"right_join",value:"Right Join"},{key:"cross_join",value:"Cross Join"}],c.report||(c.report={name:"",table:"report_agent",description:"",parent:r.id},c.title="ANALYTICS.NEW_REPORT",c.newReport=!0),c.addNewReport=function(){c.errors=[],c.report.joins=_.map(c.joinTables||[],function(e){return{parentKey:e.parentKey,foreignTable:e.name,foreignKey:e.foreignKey,type:e.type.toLowerCase()}}),c.report.joins=JSON.stringify(c.report.joins),s[o].save(c.report).$promise.then(function(e){c.reports.unshift(e),t.success({title:"Report properly created",msg:c.report.name?c.report.name+" has been created!":""}),m()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReport.save"}];for(var n=0;n<e.data.errors.length;n++)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticReport.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.saveReport=function(){c.errors=[],s[o].update({id:c.report.id},c.report).$promise.then(function(e){var n=_.find(c.reports,{id:e.id});n&&_.merge(n,e),t.success({title:"Report properly saved!",msg:c.report.name?c.report.name+" has been saved!":""}),m()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReport.update"}];for(var n=0;n<e.data.errors.length;n++)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticReport.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.deleteReport=function(){c.errors=[];var e=n.confirm().title("Are you sure?").content("The report will be deleted.").ariaLabel("Delete Report").ok("Delete").cancel("Cancel").targetEvent(event);n.show(e).then(function(){s[o].delete({id:c.report.id}).$promise.then(function(){_.remove(c.reports,{id:c.report.id}),t.success({title:"Report properly deleted!",msg:c.report.name?c.report.name+" has been deleted!":""}),m()}).catch(function(e){c.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReport.delete"}]})},function(){})},c.closeDialog=m,c.selectedTableChange=function(e){e&&(delete c.selectedItem,c.joinTables.push(e))},c.removeJoin=function(e){c.joinTables.splice(e,1)},c.getFields=function(n,t,e){var a=_.find(c.tables,{name:e});a&&a.api&&s[a.api].describe().$promise.then(function(e){n[t]=_.difference(_.keys(e),["$promise","$resolved"])}).catch(function(e){console.error(e)})}}e.$inject=["$location","$mdDialog","toasty","reports","report","api","apiName","currentNode","describeTable","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditReportDialogController",e)}(),function(){"use strict";function e(i,s,o,e){var r=this;r.report={},r.conditions=e.getConditions,r.init=function(e,n){r.report=e,r.report.condition=angular.fromJson(e.conditions)||{group:{operator:"AND",rules:[]}},r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1};for(var t=0;t<r.report.condition.group.rules.length;t++)if(r.report.condition.group.rules[t].field){var a=r.report.condition.group.rules[t].field.split(".");1===a.length&&(r.report.condition.group.rules[t].field=r.report.table+"."+r.report.condition.group.rules[t].field)}s.getColumns(r.report.table).then(function(e){r.columns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt"])}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE",msg:e.data?JSON.stringify(e.data):e.toString()})})},r.addCondition=function(e){e.unshift({condition:"=",field:"",value:""})},r.addGroup=function(e){e.push({group:{operator:"AND",rules:[]}})},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the item?").htmlContent("The item will be deleted.").ariaLabel("delete item").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){e.splice(n,1)},function(){console.log("CANCEL")})},r.isValueByCondition=function(e){return!_.includes(["IS NULL","IS NOT NULL","IS EMPTY","IS NOT EMPTY"],e)}}e.$inject=["$mdDialog","describeTable","toasty","sqlUtil"],angular.module("app.analytics").controller("ReportConditionsController",e)}(),function(){"use strict";function e(a){var i={report_call_transfer:"voiceTransferReport",cm_companies:"cmCompany",cm_contacts:"cmContact",cm_hopper:"cmHopper",cm_hopper_final:"cmHopperFinal",cm_hopper_history:"cmHopperHistory",cm_lists:"cmList",chat_websites:"chatWebsite",chat_queues:"chatQueue",chat_interactions:"chatInteraction",chat_messages:"chatMessage",chat_offline_messages:"chatOfflineMessage",report_chat_queue:"chatQueueReport",report_chat_transfer:"chatTransferReport",mail_accounts:"mailAccount",mail_queues:"mailQueue",mail_interactions:"mailInteraction",mail_messages:"mailMessage",report_mail_queue:"mailQueueReport",report_mail_transfer:"mailTransferReport",openchannel_accounts:"openchannelAccount",openchannel_queues:"openchannelQueue",openchannel_interactions:"openchannelInteraction",openchannel_messages:"openchannelMessage",report_openchannel_queue:"openchannelQueueReport",report_openchannel_transfer:"openchannelTransferReport",sms_accounts:"smsAccount",sms_queues:"smsQueue",sms_interactions:"smsInteraction",sms_messages:"smsMessage",report_sms_queue:"smsQueueReport",report_sms_transfer:"smsTransferReport",fax_accounts:"faxAccount",fax_queues:"faxQueue",fax_interactions:"faxInteraction",fax_messages:"faxMessage",report_fax_transfer:"faxTransferReport",report_fax_queue:"faxQueueReport",report_call:"voiceCallReport",report_agent:"voiceAgentReport",report_square:"squareReport",report_member:"memberReport",report_queue:"voiceQueueReport",report_square_details:"squareReportDetail",report_dial:"voiceDialReport",report_jscripty_sessions:"jscriptySessionReport",report_jscripty_questions:"jscriptyQuestionReport",report_jscripty_answers:"jscriptyAnswerReport",users:"user",voice_recordings:"voiceRecording",cdr:"cdr",whatsapp_accounts:"whatsappAccount",whatsapp_queues:"whatsappQueue",whatsapp_interactions:"whatsappInteraction",whatsapp_messages:"whatsappMessage",report_whatsapp_queue:"whatsappQueueReport",report_whatsapp_transfer:"whatsappTransferReport"};return{getMap:function(){var t=[];return _.forIn(i,function(e,n){t.push({name:n,api:e})}),t},getColumns:function(e){var n=i[e],t={};return"cm_contacts"===e&&(t.analytics=!0),a[n].describe(t).$promise}}}e.$inject=["api"],angular.module("app.analytics").factory("describeTable",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;(u.errors=[],u.title="Edit Report Field",u.report=i,u.reportField=angular.copy(o),u.reportFields=s,u.metrics=r,u.columns=l,u.sqlUtil=d,u.newReportField=!1,u.crudPermissions=m,u.reportField)?(u.reportField.type=u.reportField.custom?"custom":u.reportField.MetricId?"metric":"column",u.reportField.field&&!u.reportField.custom&&_.isNil(u.reportField.MetricId)&&1===u.reportField.field.split(".").length&&(u.reportField.field=u.report.table+"."+u.reportField.field)):(u.reportField={type:"column",function:null,format:null,groupBy:!1,orderBy:null},u.title="New Report Field",u.newReportField=!0);function p(){t.hide()}u.addNewReportField=function(){u.errors=[],u.reportField.custom="custom"===u.reportField.type,u.reportField.MetricId="metric"===u.reportField.type?u.reportField.MetricId:null,u.reportField.CustomReportId=u.report.id,c.analyticFieldReport.save(u.reportField).$promise.then(function(e){u.reportFields.push(e),a.success({title:"Report field properly created",msg:u.reportField.field?u.reportField.field+" has been created!":u.reportField.type+" has been created!"}),p()}).catch(function(e){u.errors=e.data.errors||[{message:e.toString(),type:"api.analyticFieldReport.save"}]})},u.saveReportField=function(){u.errors=[],u.reportField.custom="custom"===u.reportField.type,u.reportField.MetricId="metric"===u.reportField.type?u.reportField.MetricId:null,c.analyticFieldReport.update({id:u.reportField.id},u.reportField).$promise.then(function(e){var n=_.find(u.reportFields,{id:e.id});n&&_.merge(n,e),a.success({title:"Report Field properly saved!",msg:u.reportField.field?u.reportField.field+" has been saved!":""}),p()}).catch(function(e){u.errors=e.data.errors||[{message:e.toString(),type:"api.analyticFieldReport.update"}]})},u.deleteReportField=function(e){u.errors=[];var n=t.confirm().title("Are you sure?").content("The field will be deleted.").ariaLabel("Delete Report").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){c.analyticFieldReport.delete({id:u.reportField.id}).$promise.then(function(){_.remove(u.reportFields,{id:u.reportField.id}),a.success({title:"Report Field properly deleted!",msg:u.reportField.field?u.reportField.field+" has been deleted!":""}),p()}).catch(function(e){u.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReportField.delete"}]})},function(){})},u.closeDialog=p}e.$inject=["$scope","$location","$mdDialog","toasty","report","reportFields","reportField","metrics","columns","sqlUtil","api","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditReportFieldDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;c.report={},c.reportFields={count:0,rows:[]},c.functions=_.keyBy(l.getFunctions,"value"),c.formats=_.keyBy(l.getFormats,"value"),c.groupBy=_.keyBy(l.getGroupBy,"value"),c.orderBy=_.keyBy(l.getOrderBy,"value"),c.selectedReportFields=[],c.query={fields:"createdAt,updatedAt,id,field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0},c.sortableTable={animation:100,onSort:function(e){o.analyticFieldReport.addFields({id:c.report.id},e.models).$promise.then(function(e){c.reportFields.rows=e}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDFIELDS"})})}},c.init=function(e,n){c.report=e,c.query.CustomReportId=c.report.id,c.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},c.sortableTable.disabled=!c.crudPermissions.canEdit,r.getColumns(c.report.table).then(function(e){return c.columns=_.difference(_.keys(e),["$promise","$resolved"]),o.analyticMetric.get({fields:"id,name,metric,table",nolimit:!0}).$promise}).then(function(e){c.metrics=e.rows}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.getReportFields()},c.deleteConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>"+e.field+"</b> will be deleted.").ariaLabel("delete field").targetEvent(n).ok("OK").cancel("CANCEL");a.show(t).then(function(){p(e)},function(){console.log("CANCEL")})},c.success=u,c.getReportFields=function(){c.promise=o.analyticFieldReport.get(c.query,u).$promise},c.createOrEditReportField=function(e,n){a.show({controller:"CreateOrEditReportFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/edit/field/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{report:c.report,reportField:n,reportFields:c.reportFields.rows,metrics:c.metrics,columns:c.columns,setting:null,crudPermissions:c.crudPermissions}})},c.deleteReportField=p,c.deleteSelectedReportFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+c.selectedReportFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){c.selectedReportFields.forEach(function(e){p(e)}),c.selectedReportFields=[]})},c.getMetricName=function(e){var n=_.find(c.metrics,{id:e});return n?n.name:d.instant("ANALYTICS.NO_METRIC_FOUND")},c.getMetricValue=function(e){var n=_.find(c.metrics,{id:e});return n?n.metric:d.instant("ANALYTICS.NO_METRIC_FOUND")};var m=!0;function u(e){c.reportFields=e||{count:0,rows:[]}}function p(e){o.analyticFieldReport.delete({id:e.id}).$promise.then(function(){c.selectedReportFields=[],_.remove(c.reportFields.rows,{id:e.id}),c.reportFields.count-=1,c.reportFields.rows.length||c.getReportFields(),s.success({title:"Field deleted!",msg:e.field?e.field+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}n.$watch("vm_rf.query.filter",function(e,n){m?t(function(){m=!1}):c.getReportFields()})}e.$inject=["$cookies","$scope","$timeout","$mdDialog","$document","toasty","api","describeTable","sqlUtil","$translate"],angular.module("app.analytics").controller("ReportFieldsController",e)}(),function(){"use strict";angular.module("app.analytics").factory("sqlUtil",function(){return{getFunctions:[{value:"SUM",option:function(e){return"SUM ("+e+")"}},{value:"COUNT",option:function(e){return"COUNT ("+e+")"}},{value:"COUNT DISTINCT",option:function(e){return"COUNT (DISTINCT "+e+")"}},{value:"MAX",option:function(e){return"MAX ("+e+")"}},{value:"MIN",option:function(e){return"MIN ("+e+")"}},{value:"AVG",option:function(e){return"AVG ("+e+")"}},{value:"GROUP_CONCAT",option:function(e){return"GROUP_CONCAT ("+e+")"}},{value:"GROUP_CONCAT ASC",option:function(e){return"GROUP_CONCAT ("+e+" ORDER BY "+e+" ASC)"}},{value:"GROUP_CONCAT DESC",option:function(e){return"GROUP_CONCAT ("+e+" ORDER BY "+e+" DESC)"}}],getFormats:[{value:"SEC_TO_TIME",option:function(e){return"SEC_TO_TIME ("+e+")"}},{value:"DATE",option:function(e){return"DATE ("+e+")"}},{value:"HOUR",option:function(e){return"HOUR ("+e+")"}},{value:"ROUND",option:function(e){return"ROUND ("+e+")"}},{value:"UNIX_TIMESTAMP",option:function(e){return"UNIX_TIMESTAMP ("+e+")"}}],getGroupBy:[{value:!1,option:function(){return"No"}},{value:!0,option:function(e){return"GROUP BY "+e}}],getOrderBy:[{value:"ASC",option:function(e){return"ORDER BY "+e+" ASC"}},{value:"DESC",option:function(e){return"ORDER BY "+e+" DESC"}}],getConditions:["=","!=","<","<=",">",">=","LIKE","NOT LIKE","IS NULL","IS NOT NULL","IS EMPTY","IS NOT EMPTY"]}})}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;function r(e){return _.isArray(e)}o.report=a||{},o.userProfileSection=s&&1==s.count?s.rows[0]:null,o.crudPermissions=i.parseCrudPermissions(o.userProfileSection?o.userProfileSection.crudPermissions:null),o.selectedTab=e.params.tab||0,o.gotoReports=function(){e.go("app.analytics.reports",{},{reload:"app.analytics.reports"})},o.saveReport=function(){o.report.conditions=angular.toJson(o.report.condition),t.analyticCustomReport.update({id:o.report.id},_.omit(o.report,"joins")).$promise.then(function(){n.success({title:"Report updated!",msg:o.report.name?o.report.name+" has been updated!":""})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETreport",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.previewReport=function(){o.columns=[],o.rows=[],o.error=!1,t.analyticFieldReport.get({fields:"field,alias",nolimit:!0,CustomReportId:o.report.id}).$promise.then(function(e){return o.columns=e?e.rows:[],t.analyticCustomReport.preview({id:o.report.id}).$promise}).then(function(e){o.rows=e}).catch(function(e){console.log(e),o.error={title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:analyticFieldReport",msg:e.data?e.data.message:e.toString(),sql:e.data&&e.data.parent?e.data.parent.sql:"NO QUERY"},n.error(o.error)})},o.queryReport=function(){return o.queryResult="Loading...",t.analyticCustomReport.query({id:o.report.id}).$promise.then(function(e){o.queryResult=e.sql}).catch(function(e){o.queryResult="",console.log(e),o.error={title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:analyticFieldReport",msg:e.data?e.data.message:e.toString(),sql:e.data&&e.data.parent?e.data.parent.sql:"NO QUERY"},n.error(o.error)})},o.mapArray=function(e,n){if(r(e))return _.map(e,n).join(",");return""},o.isArray=r,o.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n}}e.$inject=["$state","toasty","api","report","Auth","userProfileSection"],angular.module("app.analytics").controller("ReportController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;o.errors=[],o.report=angular.copy(a),o.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n},o.closeDialog=function(){n.hide()},function(){o.columns=[],o.rows=[],o.error=!1;var e={fields:"field,alias",nolimit:!0};e["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=o.report.id,o.promise=i.analyticFieldReport.get(e).$promise.then(function(e){return o.columns=e?e.rows:[],i[s].preview({id:o.report.id}).$promise}).then(function(e){o.rows=e}).catch(function(e){console.log(e),o.error={title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:analyticFieldReport",msg:e.data?e.data.message:e.toString(),sql:e.data&&e.data.parent?e.data.parent.sql:"NO QUERY"},t.error(o.error)})}()}e.$inject=["$location","$mdDialog","toasty","report","api","apiName"],angular.module("app.analytics").controller("PreviewReportDialogController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,n,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.reports={count:0,rows:[]},p.userProfile=r,p.userProfileSection=l&&1==l.count?l.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.selectedReports=[],p.query={fields:"createdAt,updatedAt,id,name,description,table,parent,conditions,joins",limit:10,page:1,sort:"-updatedAt"},p.apiName=null,p.currentPath="",p.customTree=!0,p.editstate=function(e,n){s.go("app.analytics.reports.edit",{id:e.id,crudPermissions:p.crudPermissions})},p.copydialog=function(e,n){i.show({controller:"CopyReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/copy/dialog.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName,treeCustomData:p.treeCustomInstance.jstree(!0).get_json("#")}}).finally(function(){})},p.previewdialog=function(e,n){i.show({controller:"PreviewReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/preview/dialog.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName}})},p.rundialog=function(e,n){i.show({controller:"RunReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/run/dialog.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName,currentPath:p.currentPath}})},p.downloadfile=function(a,e){var i;d.analyticMetric.get({fields:"id,name,metric,table",nolimit:!0}).$promise.then(function(e){i=_.keyBy(e.rows,"id");var n={fields:"field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0};return n["analyticCustomReport"===p.apiName?"CustomReportId":"DefaultReportId"]=a.id,d.analyticFieldReport.get(n).$promise}).then(function(e){for(var n=0;n<e.rows.length;n+=1)e.rows[n].MetricId&&(e.rows[n].field=i[e.rows[n].MetricId].metric,e.rows[n].custom=!0),delete e.rows[n].MetricId;var t=o.document.createElement("a");t.href="data:text/json;charset=utf-8,"+o.encodeURIComponent(angular.toJson({name:a.name,description:a.description,table:a.table,conditions:a.conditions,joins:a.joins,fields:e.rows})),t.download=a.name+".json",t.target="_self",t.click(),m.success({title:"Report downloaded!",msg:a.name?a.name+" has been downloaded!":""})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DOWNLOADJSON",msg:e.data?JSON.stringify(e.data):e.toString()})})},p.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the report?").htmlContent("<b>"+e.name+"</b> will be deleted.").ariaLabel("delete report").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){b(e)},function(){console.log("CANCEL")})},p.success=h,p.getReports=f,p.createOrEditReport=function(e,n){i.show({controller:"CreateOrEditReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{report:n,reports:p.reports.rows,apiName:p.apiName,currentNode:p.currentNode,setting:null,crudPermissions:p.crudPermissions}})},p.importReport=function(e,n,t){if("application/json"===e.file.type){var a=new FileReader;a.onload=function(e){console.log(e.target.result);try{var t=atob(e.target.result.split(",")[1]);t=angular.fromJson(t),d.analyticCustomReport.save({name:t.name,description:t.description,table:t.table,conditions:t.conditions,joins:t.joins,parent:p.currentNode.id}).$promise.then(function(n){p.reports.rows.unshift(n),m.success({title:"Report saved!",msg:n.name?n.name+" has been saved!":""});var e=_.map(t.fields,function(e){return _.extend({},e,{CustomReportId:n.id})});return d.analyticFieldReport.bulkCreate(e).$promise}).then(function(e){m.success({title:"Fields saved!",msg:"Fields has been saved!"})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETanalyticReport",msg:e.data?JSON.stringify(e.data):e.toString()})})}catch(e){console.error(e),m.error({title:"Decode File Error",msg:e.toString()})}},a.readAsDataURL(e.file)}else m.error({title:"Format Error",msg:"Please use only json files"})},p.deleteReport=b,p.exportSelectedReports=function(){var e=angular.copy(p.selectedReports);return p.selectedReports=[],e},p.deleteSelectedReports=function(e){var n=i.confirm().title("Are you sure want to delete the selected reports?").htmlContent("<b>"+p.selectedReports.length+" selected</b> will be deleted.").ariaLabel("delete Reports").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){p.selectedReports.forEach(function(e){b(e)}),p.selectedReports=[]})},p.deselectReports=function(){p.selectedReports=[]},p.selectAllReports=function(){p.selectedReports=p.reports.rows},p.treeDefaultData=c.rows[0]?angular.fromJson(c.rows[0].tree):[],p.treeCustomData=c.rows[1]?angular.fromJson(c.rows[1].tree):[],p.treeDefaultConfig=S(!1),p.treeCustomConfig=S(!0),p.treeDefaultEvents=T(!1),p.treeCustomEvents=T(!0);var g=!0,v=1;function h(e){p.reports=e||{count:0,rows:[]}}function f(){if(p.query.offset=(p.query.page-1)*p.query.limit,p.apiName)if("admin"===p.currentUser.role||p.userProfileSection.autoAssociation)p.promise=d[p.apiName].get(p.query,h).$promise;else{var a=[];p.promise=d[p.apiName].get(p.query).$promise.then(function(e){return 0<(a=e&&e.rows?e.rows:[]).length?d.userProfileResource.get({sectionId:p.userProfileSection.id,type:"analyticDefaultReport"===p.apiName?"DefaultReports":"CustomReports"}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(0<n.length){var t=[];return a.forEach(function(e){_.find(n,["resourceId",e.id])&&t.push(e)}),h({count:t.length,rows:t})}return h(null)}):h(null)})}}function b(e){p.apiName&&d[p.apiName].delete({id:e.id}).$promise.then(function(){_.remove(p.reports.rows,{id:e.id}),p.reports.count-=1,p.reports.rows.length||p.getReports(),m.success({title:"Report deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.analyticreport.delete"}];for(var n=0;n<e.data.errors.length;n++)m.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticreport.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function A(e,n){p.treeDefaultInstance.jstree(!0).deselect_all(),p.treeDefaultInstance.jstree(!0).close_all(),p.currentNode=n.node,p.currentNode.custom=!0,p.currentPath=p.treeCustomInstance.jstree(!0).get_path(p.currentNode).join("/ "),p.apiName="analyticCustomReport",p.query.parent=n.node.id,f()}function E(e,n){p.treeCustomInstance.jstree(!0).deselect_all(),p.treeCustomInstance.jstree(!0).close_all(),p.currentNode=n.node,p.currentNode.custom=!1,p.currentPath=p.treeDefaultInstance.jstree(!0).get_path(p.currentNode).join("/ "),p.apiName="analyticDefaultReport",p.query.parent=n.node.id,f()}function y(e,n){var t,a,i;"rename_node"===e.type&&(a=(t=n).node.id,i="","custom"===t.node.parent?t.node.id.includes("custom_report_")||(i="custom_report_"+t.text):i=t.node.parent+"_"+t.text,p.treeCustomInstance.jstree(!0).set_id(t.node,"custom_report_"+i.toLowerCase()),t.node.a_attr.id=t.node.a_attr.id.replace(a,t.node.id),t.node.li_attr.id=t.node.id);var s=angular.toJson(p.treeCustomInstance.jstree(!0).get_json("#"));d.analyticTreeReport.update({id:2,tree:s}).$promise.then(function(){c.rows[1]&&(c.rows[1].tree=s),m.success({title:"Node Updated",msg:n.node.text?n.node.text+" has been updated!":"Node has been updated!"})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEanalyticTreeReport",msg:e.data?JSON.stringify(e.data):e.toString()})})}function S(e){return{core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:e?["contextmenu","dnd","search","state","wholerow"]:["search","state","wholerow"],contextmenu:{items:function(t){var e={};return p.crudPermissions.canEdit&&_.assign(e,{create:{label:n.instant("ANALYTICS.CREATE"),action:function(){t=p.treeCustomInstance.jstree(!0).create_node(t),p.treeCustomInstance.jstree(!0).edit(t)}},rename:{_disabled:"#"===t.parent,label:n.instant("ANALYTICS.RENAME"),action:function(){p.treeCustomInstance.jstree(!0).edit(t)}}}),p.crudPermissions.canDelete&&_.assign(e,{remove:{_disabled:"#"===t.parent,label:n.instant("ANALYTICS.REMOVE"),action:function(){var e=i.confirm().title("Are you sure want to delete the node?").htmlContent("<b>"+(t.text?t.text:"Node")+"</b> and its subnode will be deleted.").ariaLabel("delete node").ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,n=p.treeCustomInstance.jstree(!0).get_parent(t);n=p.treeCustomInstance.jstree(!0).get_node(n),p.treeCustomInstance.jstree(!0).delete_node(t),e=[t.id].concat(t.children_d||[]),d.analyticCustomReport.get({parent:e.join(","),fields:"id,name"}).$promise.then(function(e){e&&e.rows&&e.rows.forEach(function(e){b(e)})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEreportsByParents",msg:e.data?JSON.stringify(e.data):e.toString()})}),p.treeCustomInstance.jstree(!0).select_node(n)})}}}),e}}}}function T(e){return e?{create_node:y,rename_node:y,move_node:y,delete_node:y,select_node:A}:{select_node:E}}e.$watch("vm.query.filter",function(e,n){g?t(function(){g=!1}):(n||(v=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=v),p.getReports())}),e.$watch("vm.search",function(e,n){p.treeDefaultInstance&&p.treeDefaultInstance.jstree(!0).search(e),p.treeCustomInstance&&p.treeCustomInstance.jstree(!0).search(e)})}e.$inject=["$scope","$timeout","$document","$mdDialog","$state","$window","$translate","userProfile","userProfileSection","api","treeReports","toasty","Auth"],angular.module("app.analytics").controller("ReportsController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r){var l=this;function d(){l.export={id:l.report.id,name:l.report.name,startDate:new Date(moment().startOf("day")),endDate:new Date(moment().endOf("day")),output:"xlsx",fullPath:r?r+"/"+l.report.name:l.report.name}}function c(){t.hide()}l.errors=[],l.report=angular.copy(n),l.export={},l.runReport=function(n){l.errors=[],l.exportDate=_.assign({},l.export,{startDate:moment(l.export.startDate).format("YYYY-MM-DD HH:mm:ss"),endDate:moment(l.export.endDate).format("YYYY-MM-DD HH:mm:ss")}),i[s].run(l.exportDate).$promise.then(function(e){"web"===l.export.output?t.show({controller:"WebReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/run/web/dialog.html",parent:angular.element(o.body),targetEvent:n,skipHide:!0,locals:{apiName:s,exportDate:l.exportDate,results:e},resolve:{columns:["apiResolver",function(e){var n={fields:"field,alias",nolimit:!0};return n["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=l.report.id,e.resolve("analyticFieldReport@get",n)}]}}):(a.success({title:"Report properly run!",msg:l.report.name?l.report.name+" has been run!":""}),c())}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},l.closeDialog=c,(l.refreshDate=d)()}e.$inject=["$location","$mdDialog","toasty","report","api","apiName","$document","currentPath"],angular.module("app.analytics").controller("RunReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o){var r=this;function l(e){r.results=e||{count:0,rows:[]}}r.errors=[],r.columns=a?a.rows:[],r.results=i||{rows:[],count:0},r.query={limit:10,page:1},r.closeDialog=function(){e.hide()},r.getResults=function(){o.offset=(r.query.page-1)*r.query.limit,o.limit=r.query.limit,r.promise=t[s].run(o,l).$promise},r.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n}}e.$inject=["$mdDialog","toasty","api","columns","results","apiName","exportDate"],angular.module("app.analytics").controller("WebReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CALLYSQUARE.EDIT_ODBC",g.odbc=angular.copy(l),g.odbcs=r,g.newOdbc=!1,g.odbc||(g.odbc={},g.title="CALLYSQUARE.NEW_ODBC",g.newOdbc=!0),g.addNewOdbc=function(){g.errors=[],d.squareOdbc.save(g.odbc).$promise.then(function(e){g.odbcs.unshift(e.toJSON()),o.success({title:"Odbc properly created",msg:g.odbc.name?g.odbc.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareOdbc.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareOdbc.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOdbc=function(){g.errors=[],d.squareOdbc.update({id:g.odbc.id},g.odbc).$promise.then(function(e){var n=_.find(g.odbcs,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Odbc properly saved!",msg:g.odbc.name?g.odbc.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareOdbc.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareOdbc.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOdbc=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The odbc will be deleted.").ariaLabel("Delete Odbc").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.squareOdbc.delete({id:g.odbc.id}).$promise.then(function(){_.remove(g.odbcs,{id:g.odbc.id}),o.success({title:"Odbc properly deleted!",msg:(g.odbc.name||"odbc")+" has been deleted!"}),v(g.odbc)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareOdbc.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareOdbc.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","odbcs","odbc","api","Auth","license","setting","crudPermissions"],angular.module("app.callysquare").controller("CreateOrEditOdbcDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.odbcs=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="odbcs",f.listOrder="",f.listOrderAsc=null,f.selectedODBC=[],f.query={fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditOdbcDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/odbcs/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{odbc:e,odbcs:f.odbcs.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.testtestOdbc=function(e,n){return m.squareOdbc.test({id:e.id}).$promise.then(function(){p.success({title:"Square ODBC properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"Square ODBC properly tested",msg:e.data?JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("odbc")+"?").htmlContent("<b>"+(e.name||"odbc")+"</b> will be deleted.").ariaLabel("delete odbc").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getODBC=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.squareOdbc.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ODBC",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditOdbc=function(e,n){i.show({controller:"CreateOrEditOdbcDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/odbcs/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{odbc:n,odbcs:f.odbcs.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteOdbc=y,f.exportSelectedODBC=function(){var e=angular.copy(f.selectedODBC);return f.selectedODBC=[],e},f.deleteSelectedODBC=function(e){var n=i.confirm().title("Are you sure want to delete the selected odbcs?").htmlContent("<b>"+f.selectedODBC.length+" selected</b> will be deleted.").ariaLabel("delete Odbcs").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedODBC.forEach(function(e){y(e)}),f.selectedODBC=[]})},f.deselectODBC=function(){f.selectedODBC=[]},f.selectAllODBC=function(){f.selectedODBC=f.odbcs.rows};var b=!0,A=1;function E(e){f.odbcs=e||{count:0,rows:[]}}function y(e){m.squareOdbc.delete({id:e.id}).$promise.then(function(){_.remove(f.odbcs.rows,{id:e.id}),f.odbcs.count-=1,f.odbcs.rows.length||f.getODBC(),p.success({title:_.startCase("Odbc")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsquareOdbc"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsquareOdbc",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getODBC())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","odbcs","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.callysquare").controller("OdbcsController",e)}(),function(){"use strict";function e(n,t,a,i,s,e,o,r,l,d){var c=this;function m(e){n.hide(e)}c.errors=[],c.title="CALLYSQUARE.EDIT_PROJECT",c.crudPermissions=d,c.project=angular.copy(o),c.newWindow=!0,c.projects=e,c.newProject=!1,c.openFromEditor=l,c.project||(c.project={name:"",description:""},c.title="CALLYSQUARE.NEW_PROJECT",c.newProject=!0),c.addNewProject=function(){c.errors=[],r.squareProject.save(c.project).$promise.then(function(e){return r.user.addSquareProjects({id:i.getCurrentUser().id,ids:[e.id]}).$promise,e}).then(function(e){c.projects.unshift(e),s.success({title:"Project properly created",msg:c.project.name?c.project.name+" has been created!":""}),m(e),c.openFromEditor&&(c.newWindow?t.open("/callysquare/projects/"+e.id,"_blank"):a.go("app.callysquare.projects.edit",{id:e.id}))}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.save"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareProject.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.saveProject=function(){c.errors=[],r.squareProject.update({id:c.project.id},c.project).$promise.then(function(e){var n=_.find(c.projects,{id:e.id});n&&_.merge(n,e),s.success({title:"Project properly saved!",msg:c.project.name?c.project.name+" has been saved!":""}),m(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.update"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareProject.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.deleteProject=function(){c.errors=[];var e=n.confirm().title("Are you sure?").content("The project will be deleted.").ariaLabel("Delete Project").ok("Delete").cancel("Cancel").targetEvent(event);n.show(e).then(function(){r.squareProject.delete({id:c.project.id}).$promise.then(function(){return r.squareProject.getUsers({id:c.project.id}).$promise}).then(function(e){for(var n=[],t=e.rows,a=0;a<t.length;a++)n.push(r.user.removeSquareProjects({id:i.getCurrentUser().id,ids:[c.project.id]}).$promise);return $q.all(n)}).then(function(){_.remove(c.projects,{id:c.project.id}),s.success({title:"Project properly deleted!",msg:c.project.name?c.project.name+" has been deleted!":""}),m(c.project)}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.delete"}]})},function(){})},c.closeDialog=m}e.$inject=["$mdDialog","$window","$state","Auth","toasty","projects","project","api","openFromEditor","crudPermissions"],angular.module("app.callysquare").controller("CreateOrEditSquareProjectDialogController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o,r,l,d,c,m,u,p,g,v,h,f,b,A,E,y,S,T,I,O,C,w,R,x,N,D){var P=this,L={playback:["file_id"],answer:["timeout"],menu:["file_id","digit","response","retry"],getdigits:["file_id","variable_id","mindigit","maxdigit","retry"],getsecretdigits:["file_id","variable_id","mindigit","maxdigit","hiddendigitsnum","retry"],vswitch:["variable_id"],database:["odbc_id","query"],ext_dial:["trunk_name","phone","timeout"],set:["variable_id"],math:["variable_id"],gotoc:["context","extension","priority"],system:["command"],agi:["command"],gotoif:["condition"],saydigits:["digits"],saynumber:["number"],sayphonetic:["text"],record:["file","timeout"],goal:["goalname"],dial:["sip_id","timeout"],queue:["queue_id","timeout"],callback:["list_id","name","phone","delay"],gotoiftime:["interval_id"],voicemail:["mailbox"],subproject:["project_id"],sendSMS:["sms_account_id","to","sms_text"],sendMail:["account_id","to"],sendFax:["account_id","to","attachment_path"],google_cloud_tts:["apiKey","google_cloud_tts_text_type","text"],tts:["text"],ispeechtts:["text","key","speed"],ispeechasr:["key","timeout"],custom_app:["application"],googleasr:["key","timeout"],awspolly:["aws_access_key_id","aws_secret_access_key","text","aws_text_type"],lumenvoxtts:["text"],sestektts:["text"],lumenvoxasr:["grammar"],sestekasr:["grammar"],tildeasr:["appid","appsecret","uri"],login:["findBy"],pause:["findBy","pause_id"],unpause:["findBy"],logout:["findBy"],dialogflow:["key","text","dialogflow_language"],awslex:["aws_access_key_id","aws_secret_access_key","aws_lex_region","aws_bot_name","text"],sesteknda:["text","ndauth_url","username","password","ndassistant_url"],restapi:["url","method"],mrcpsynth:["text"],mrcprecog:["grammar"],dialogflowV2:["dialogflowV2_project_id","client_email","private_key","dialogflowV2_language","text"]},k={queue:["file_id"],database:["variable_id"],pause:["pause_id"]},M={sendMail:["to","cc","bcc"],voicemail:["mailbox"]};function U(e,n,t,a){return _.map(e,function(e){return{value:e[n],option:e[t],group:a?e[a]:void 0,canSelect:void 0===e.canSelect||e.canSelect}})}function F(){var e=Number(_.find(P.attributes,{name:"sip_id"}).value);if(!_.some(d,{id:e})&&0<e)return t.user.get({id:e,fields:"id,fullname,role"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,d.push(n),P.values.sip_id=U(d,"id","fullname","role")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_USER",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.sip_id=U(d,"id","fullname","role")}function $(){var e=Number(_.find(P.attributes,{name:"list_id"}).value);if(!_.some(E,{id:e})&&0<e)return t.cmList.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,E.push(n),P.values.list_id=U(E,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_LIST",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.list_id=U(E,"id","name")}function q(){var e=Number(_.find(P.attributes,{name:"trunk_id"}).value);if(!_.some(c,{id:e})&&0<e)return t.trunk.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,c.push(n),P.values.trunk_id=U(c,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TRUNK",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.trunk_id=U(c,"id","name")}function G(){var e=_.find(P.attributes,{name:"trunk_name"}).value;if(!_.some(c,{name:e})&&e)return t.trunk.get({name:e,fields:"id,name"}).$promise.then(function(e){if(0<e.count&&0<e.rows.length){var n=e.rows[0];n.canSelect=!1,c.push(n),P.values.trunk_name=U(c,"name","name")}}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TRUNK",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.trunk_name=U(c,"name","name")}function H(){var e=Number(_.find(P.attributes,{name:"queue_id"}).value);if(!_.some(m,{id:e})&&0<e)return t.voiceQueue.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,m.push(n),P.values.queue_id=U(m,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_QUEUE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.queue_id=U(m,"id","name")}function V(){var e=Number(_.find(P.attributes,{name:"file_id"}).value);if(!_.some(u,{id:e})&&0<e)return t.sound.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,u.push(n),P.values.file_id=U(u,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_SOUND",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.file_id=U(u,"id","name")}function B(){var e=Number(_.find(P.attributes,{name:"variable_id"}).value);if(!_.some(p,{id:e})&&0<e)return t.variable.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,p.push(n),P.values.variable_id=U(p,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_VARIABLE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.variable_id=U(p,"id","name")}function Q(){var e=Number(_.find(P.attributes,{name:"odbc_id"}).value);if(!_.some(g,{id:e})&&0<e)return t.squareOdbc.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,g.push(n),P.values.odbc_id=U(g,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_ODBC",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.odbc_id=U(g,"id","name")}function W(){var e=Number(_.find(P.attributes,{name:"project_id"}).value);if(!_.some(v,{id:e})&&0<e)return t.squareProject.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,v.push(n),P.values.project_id=U(v,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_PROJECT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.project_id=U(v,"id","name")}function j(){var e=Number(_.find(P.attributes,{name:"context"}).value);if(!_.some(h,{id:e})&&0<e)return t.voiceContext.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,h.push(n),P.values.context=U(h,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_CONTEXT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.context=U(h,"id","name")}function Y(){var e=Number(_.find(P.attributes,{name:"interval_id"}).value);if(!_.some(f,{id:e})&&0<e)return t.interval.get({id:e,fields:"id,name,IntervalId"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,f.push(n),P.values.interval_id=U(f,"id","name","IntervalId")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_INTERVAL",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.interval_id=U(f,"id","name","IntervalId")}function z(){var e=Number(_.find(P.attributes,{name:"account_id"}).value);if(!_.some(b,{id:e})&&0<e)return t.mailAccount.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,b.push(n),P.values.account_id=U(b,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_MAIL_ACCOUNT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.account_id=U(b,"id","name")}function J(){var e=Number(_.find(P.attributes,{name:"sms_account_id"}).value);if(!_.some(O,{id:e})&&0<e)return t.smsAccount.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,O.push(n),P.values.sms_account_id=U(O,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_SMS_ACCOUNT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.sms_account_id=U(O,"id","name")}function K(){var e=Number(_.find(P.attributes,{name:"template_id"}).value);if(!_.some(A,{id:e})&&0<e)return t.template.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,A.push(n),P.values.template_id=U(A,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TEMPLATE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.template_id=U(A,"id","name")}function X(){var e=Number(_.find(P.attributes,{name:"pause_id"}).value);if(!_.some(C,{id:e})&&0<e)return t.pause.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,C.push(n),P.values.pause_id=U(C,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_PAUSE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.pause_id=U(C,"id","name")}P.cellName=y.tagName,P.attributes=_.map(y.attributes,function(e){return{name:e.name,value:e.value,defaultValue:k[P.cellName]&&_.includes(k[P.cellName],e.name),required:L[P.cellName]&&_.includes(L[P.cellName],e.name),help:M[P.cellName]&&_.includes(M[P.cellName],e.name)}}),P.values={authMethod:[{value:"noauth",option:"NO AUTH"},{value:"hmac",option:"HMAC"}],answer:[{value:"yes",option:"Yes"},{value:"no",option:"No"}],ndagenerate_audio:[{value:1,option:"Yes"},{value:0,option:"No"}],ndaactivity_type:[{value:"message",option:"Message"},{value:"conversationUpdate",option:"Conversation Update"},{value:"contactRelationUpdate",option:"Contact Relation Update"},{value:"endOfConversation",option:"End of Conversation"}],hiddendigitspos:[{value:"first",option:"First"},{value:"last",option:"Last"}],recordingFormat:[{value:"wav",option:"Wav"},{value:"gsm",option:"Gsm"}],intkey:[{value:"#",option:"#"},{value:"*",option:"*"}],beep:[{value:"BEEP",option:"Yes"},{value:"NOBEEP",option:"No"}],model:e,ispeech_asr_language:i,ispeech_tts_language:o,languageCode:r,ssmlGender:[{value:"FEMALE",option:"Female"},{value:"MALE",option:"Male"}],google_tts_language:l,google_asr_language:s,google_cloud_tts_text_type:[{value:"text",option:"Text"},{value:"ssml",option:"SSML"}],aws_polly_region:I,aws_polly_voice:T,aws_text_type:[{value:"text",option:"Text"},{value:"ssml",option:"SSML"}],callback_priority:[{option:"Highest",value:4},{option:"High",value:3},{option:"Medium",value:2},{option:"Low",value:1},{option:"Lowest",value:0}],findBy:[{value:"internal",option:"Internal"},{value:"phone",option:"Phone"},{value:"mobile",option:"Mobile"}],dialogflow_language:w,dialogflowV2_language:R,aws_lex_region:x,method:[{value:"GET",option:"GET"},{value:"POST",option:"POST"},{value:"PUT",option:"PUT"},{value:"DELETE",option:"DELETE"}]},P.crudPermissions=D,P.onInit=function(){N.hasRole("admin")?(e={sip_id:U(d,"id","fullname","role"),trunk_name:U(c,"name","name"),trunk_id:U(c,"id","name"),queue_id:U(m,"id","name"),file_id:U(u,"id","name"),variable_id:U(p,"id","name"),odbc_id:U(g,"id","name"),project_id:U(v,"id","name"),context:U(h,"id","name"),interval_id:(t=f,a="id",i="name",s="IntervalId",o=_.filter(t,function(e){return null===e[s]}),r=[],_.forEach(o,function(n){r.push({value:n[a],option:n[i]});var e=_.filter(t,function(e){return e[s]===n.id});_.forEach(e,function(e){r.push({value:e[a],option:" - "+e[i]})})}),r),account_id:U(b,"id","name"),template_id:U(A,"id","name"),list_id:U(E,"id","name"),sms_account_id:U(O,"id","name"),pause_id:U(C,"id","name")},n=_.merge(P.values,e),P.values=n):function(){for(var e=["sip_id","trunk_name","trunk_id","queue_id","file_id","variable_id","odbc_id","project_id","context","interval_id","account_id","template_id","list_id","sms_account_id","pause_id"],n=0;n<P.attributes.length;n++)if(_.includes(e,P.attributes[n].name))switch(P.attributes[n].name){case"sip_id":F();break;case"trunk_name":G();break;case"trunk_id":q();break;case"queue_id":H();break;case"file_id":V();break;case"variable_id":B();break;case"odbc_id":Q();break;case"project_id":W();break;case"context":j();break;case"interval_id":Y();break;case"account_id":z();break;case"template_id":K();break;case"list_id":$();break;case"sms_account_id":J();break;case"pause_id":X()}}();var e,n,t,a,i,s,o,r},P.closeDialog=function(e){e&&S(P.attributes),n.hide()},P.getMap=U}e.$inject=["$mdDialog","api","toasty","ispeechAsrModel","ispeechAsrLanguage","googleAsrLanguage","ispeechTtsLanguage","googleCloudTtslanguageCode","googleTtsLanguage","users","trunks","queues","sounds","variables","databases","projects","contexts","intervals","mailAccounts","templates","lists","cell","saveCallback","awsPollyVoice","awsPollyRegion","smsAccounts","pauses","dialogFlowLanguage","dialogFlowV2Language","awsLexRegion","Auth","crudPermissions"],angular.module("app.callysquare").controller("MxGraphDialogController",e)}(),function(){"use strict";angular.module("app.callysquare").directive("stringToNumber",function(){return{require:"ngModel",link:function(e,n,t,a){a.$parsers.push(function(e){return""+e}),a.$formatters.push(function(e){return parseFloat(e)})}}})}(),function(){"use strict";angular.module("app.callysquare").factory("ispeechAsrModel",function(){return[{value:"0",option:"Default"},{value:"date",option:"Date"},{value:"usmoney",option:"US Money"},{value:"numbersto9",option:"Numbers to 9"},{value:"numbersto99",option:"Numbers to 99"},{value:"numbersto999",option:"Numbers to 999"},{value:"time",option:"Time"},{value:"phonenumber",option:"Phone number"},{value:"streets",option:"Streets"},{value:"citystate",option:"US City/States"}]}).factory("ispeechAsrLanguage",function(){return[{value:"en-US",option:"English (US)"},{value:"en-CA",option:"English (Canada)"},{value:"en-GB",option:"English (UK)"},{value:"en-AU",option:"English (Australia)"},{value:"es-ES",option:"Spanish (Spain)"},{value:"es-MX",option:"Spanish (Mexico)"},{value:"it-IT",option:"Italian (Italy) / Finnish (Finland)"},{value:"fr-FR",option:"German (Germany)"},{value:"fr-CA",option:"French (Canada)"},{value:"pl-PL",option:"Polish (Poland)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"ca-ES",option:"Catalan (Catalan)"},{value:"zh-TW",option:"Chinese (Taiwan)"},{value:"da-DK",option:"Danish (Denmark)"},{value:"ja-JP",option:"Japanese (Japan)"},{value:"ko-KR",option:"Korean (Korea)"},{value:"nl-NL",option:"Dutch (Netherlands)"},{value:"nb-NO",option:"Norwegian (Norway)"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"ru-RU",option:"Russian (Russia)"},{value:"sv-SE",option:"Swedish (Sweden)"},{value:"zh-CN",option:"Chinese (China)"},{value:"zh-HK",option:"Chinese (Hong Kong)"}]}).factory("ispeechTtsLanguage",function(){return[{value:"usenglishfemale",option:"US English Female"},{value:"usenglishmale",option:"US English Male"},{value:"ukenglishfemale",option:"UK English Female"},{value:"ukenglishmale",option:"UK English Male"},{value:"auenglishfemale",option:"Australian English"},{value:"usspanishfemale",option:"US Spanish Female"},{value:"usspanishmale",option:"US Spanish Male"},{value:"chchinesefemale",option:"Chinese Female"},{value:"chchinesemale",option:"Chinese Male"},{value:"hkchinesefemale",option:"Hong Kong Cantonese Female"},{value:"twchinesefemale",option:"Taiwan Chinese Female"},{value:"jpjapanesefemale",option:"Japanese Female"},{value:"jpjapanesemale",option:"Japanese Male"},{value:"krkoreanfemale",option:"Korean Female"},{value:"krkoreanmale",option:"Korean Male"},{value:"caenglishfemale",option:"Canadian English Female"},{value:"huhungarianfemale",option:"Hungarian Female"},{value:"brportuguesefemale",option:"Brazilian Portuguese Female"},{value:"eurportuguesefemale",option:"European Portuguese Female"},{value:"eurportuguesemale",option:"European Portuguese Male"},{value:"eurspanishfemale",option:"European Spanish Female"},{value:"eurspanishmale",option:"European Spanish Male"},{value:"eurcatalanfemale",option:"European Catalan Female"},{value:"eurczechfemale",option:"European Czech Female"},{value:"eurdanishfemale",option:"European Danish Female"},{value:"eurfinnishfemale",option:"European Finnish Female"},{value:"eurfrenchfemale",option:"European French Female"},{value:"eurfrenchmale",option:"European French Male"},{value:"eurnorwegianfemale",option:"European Norwegian Female"},{value:"eurdutchfemale",option:"European Dutch Female"},{value:"eurpolishfemale",option:"European Polish Female"},{value:"euritalianfemale",option:"European Italian Female"},{value:"euritalianmale",option:"European Italian Male"},{value:"eurturkishfemale",option:"European Turkish Female"},{value:"eurturkishmale",option:"European Turkish Male"},{value:"eurgermanfemale",option:"European German Female"},{value:"eurgermanmale",option:"European German Male"},{value:"rurussianfemale",option:"Russian Female"},{value:"rurussianmale",option:"Russian Male"},{value:"swswedishfemale",option:"Swedish Female"},{value:"cafrenchfemale",option:"Canadian French Female"},{value:"cafrenchmale",option:"Canadian French Male"}]}).factory("googleCloudTtslanguageCode",function(){return[{value:"af-ZA",option:"Afrikaans (South Africa)"},{value:"ar-XA",option:"Arabic"},{value:"bn-IN",option:"Bengali (India)"},{value:"bg-BG",option:"Bulgarian (Bulgaria)"},{value:"ca-ES",option:"Catalan (Spain)"},{value:"yue-HK",option:"Chinese (Hong Kong)"},{value:"cs-CZ",option:"Czech (Czech Republic)"},{value:"da-DK",option:"Danish (Denmark)"},{value:"nl-BE",option:"Dutch (Belgium)"},{value:"nl-NL",option:"Dutch (Netherlands)"},{value:"en-AU",option:"English (Australian)"},{value:"en-IN",option:"English (India)"},{value:"en-GB",option:"English (UK)"},{value:"en-US",option:"English (US)"},{value:"fi-FI",option:"Finnish (Finland)"},{value:"fil-PH",option:"Filipino (Philippines)"},{value:"fr-CA",option:"French (Canada)"},{value:"fr-FR",option:"French (France)"},{value:"de-DE",option:"German (Germany)"},{value:"el-GR",option:"Greek (Greece)"},{value:"gu-IN",option:"Gujarati (India)"},{value:"hi-IN",option:"Hindi (India)"},{value:"hu-HU",option:"Hungarian (Hungary)"},{value:"is-IS",option:"Icelandic (Iceland)"},{value:"id-ID",option:"Indonesian (Indonesia)"},{value:"it-IT",option:"Italian (Italy)"},{value:"ja-JP",option:"Japanese (Japan)"},{value:"kn-IN",option:"Kannada (India)"},{value:"ko-KR",option:"Korean (South Korea)"},{value:"lv-LV",option:"Latvian (Latvia)"},{value:"ms-MY",option:"Malay (Malaysia)"},{value:"ml-IN",option:"Malayalam (India)"},{value:"cmn-CN",option:"Mandarin Chinese"},{value:"nb-NO",option:"Norwegian (Norway)"},{value:"pl-PL",option:"Polish (Poland)"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"ro-RO",option:"Romanian (Romania)"},{value:"ru-RU",option:"Russian (Russia)"},{value:"sr-RS",option:"Serbian (Cyrillic)"},{value:"sk-SK",option:"Slovak (Slovakia)"},{value:"es-ES",option:"Spanish (Spain)"},{value:"es-US",option:"Spanish (US)"},{value:"sv-SE",option:"Swedish (Sweden)"},{value:"ta-IN",option:"Tamil (India)"},{value:"te-IN",option:"Telugu (India)\t"},{value:"th-TH",option:"Thai (Thailand)"},{value:"tr-TR",option:"Turkish (Turkey)"},{value:"uk-UA",option:"Ukrainian (Ukraine)"},{value:"vi-VN",option:"Vietnamese (Vietnam)"}]}).factory("googleTtsLanguage",function(){return[{value:"af",option:"Afrikaans"},{value:"sq",option:"Albanian"},{value:"am",option:"Amharic"},{value:"ar",option:"Arabic"},{value:"hy",option:"Armenian"},{value:"az",option:"Azerbaijani"},{value:"eu",option:"Basque"},{value:"be",option:"Belarusian"},{value:"bn",option:"Bengali"},{value:"bh",option:"Bihari"},{value:"bs",option:"Bosnian"},{value:"br",option:"Breton"},{value:"bg",option:"Bulgarian"},{value:"km",option:"Cambodian"},{value:"ca",option:"Catalan"},{value:"zh-CN",option:"Chinese (Simplified)"},{value:"zh-TW",option:"Chinese (Traditional)"},{value:"co",option:"Corsican"},{value:"hr",option:"Croatian"},{value:"cs",option:"Czech"},{value:"da",option:"Danish"},{value:"nl",option:"Dutch"},{value:"en",option:"English"},{value:"eo",option:"Esperanto"},{value:"et",option:"Estonian"},{value:"fo",option:"Faroese"},{value:"tl",option:"Filipino"},{value:"fi",option:"Finnish"},{value:"fr",option:"French"},{value:"fy",option:"Frisian"},{value:"gl",option:"Galician"},{value:"ka",option:"Georgian"},{value:"de",option:"German"},{value:"el",option:"Greek"},{value:"gn",option:"Guarani"},{value:"gu",option:"Gujarati"},{value:"xx-hacker",option:"Hacker"},{value:"ha",option:"Hausa"},{value:"iw",option:"Hebrew"},{value:"hi",option:"Hindi"},{value:"hu",option:"Hungarian"},{value:"is",option:"Icelandic"},{value:"id",option:"Indonesian"},{value:"ia",option:"Interlingua"},{value:"ga",option:"Irish"},{value:"it",option:"Italian"},{value:"jw",option:"Javanese"},{value:"ja",option:"Japanese"},{value:"kn",option:"Kannada"},{value:"kk",option:"Kazakh"},{value:"rw",option:"Kinyarwanda"},{value:"rn",option:"Kirundi"},{value:"xx-klingon",option:"Klingon"},{value:"ku",option:"Kurdish"},{value:"ko",option:"Korean"},{value:"ky",option:"Kyrgyz"},{value:"lo",option:"Laothian"},{value:"la",option:"Latin"},{value:"lv",option:"Latvian"},{value:"ln",option:"Lingala"},{value:"lt",option:"Lithuanian"},{value:"mk",option:"Macedonian"},{value:"mg",option:"Malagasy"},{value:"ml",option:"Malayalam"},{value:"mt",option:"Maltese"},{value:"mi",option:"Maori"},{value:"mr",option:"Marathi"},{value:"mo",option:"Moldavian"},{value:"mn",option:"Mongolian"},{value:"sr-ME",option:"Montenegrin"},{value:"ne",option:"Nepali"},{value:"no",option:"Norwegian"},{value:"nn",option:"Norwegian (Nynorsk)"},{value:"oc",option:"Occitan"},{value:"or",option:"Oriya"},{value:"om",option:"Oromo"},{value:"ps",option:"Pashto"},{value:"fa",option:"Persian"},{value:"xx-pirate",option:"Pirate"},{value:"pl",option:"Polish"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"pa",option:"Punjabi"},{value:"qu",option:"Quechua"},{value:"ro",option:"Romanian"},{value:"rm",option:"Romansh"},{value:"ru",option:"Russian"},{value:"gd",option:"Scots Gaelic"},{value:"sr",option:"Serbian"},{value:"sh",option:"Serbo-Croatian"},{value:"st",option:"Sesotho"},{value:"sn",option:"Shona"},{value:"sd",option:"Sindhi"},{value:"si",option:"Sinhalese"},{value:"sk",option:"Slovak"},{value:"sl",option:"Slovenian"},{value:"so",option:"Somali"},{value:"es",option:"Spanish"},{value:"su",option:"Sundanese"},{value:"sw",option:"Swahili"},{value:"sv",option:"Swedish"},{value:"tg",option:"Tajik"},{value:"ta",option:"Tamil"},{value:"tt",option:"Tatar"},{value:"te",option:"Telugu"},{value:"th",option:"Thai"},{value:"ti",option:"Tigrinya"},{value:"to",option:"Tonga"},{value:"tr",option:"Turkish"},{value:"tk",option:"Turkmen"},{value:"tw",option:"Twi"},{value:"ug",option:"Uighur"},{value:"uk",option:"Ukrainian"},{value:"ur",option:"Urdu"},{value:"uz",option:"Uzbek"},{value:"vi",option:"Vietnamese"},{value:"cy",option:"Welsh"},{value:"xh",option:"Xhosa"},{value:"yi",option:"Yiddish"},{value:"yo",option:"Yoruba"},{value:"zu",option:"Zulu"}]}).factory("googleAsrLanguage",function(){return[{option:"Afrikaans (South Africa)",value:"af-ZA"},{option:"Albanian (Albania)",value:"sq-AL"},{option:"Amharic (Ethiopia)",value:"am-ET"},{option:"Arabic (Algeria)",value:"ar-DZ"},{option:"Arabic (Bahrain)",value:"ar-BH"},{option:"Arabic (Egypt)",value:"ar-EG"},{option:"Arabic (Iraq)",value:"ar-IQ"},{option:"Arabic (Israel)",value:"ar-IL"},{option:"Arabic (Jordan)",value:"ar-JO"},{option:"Arabic (Kuwait)",value:"ar-KW"},{option:"Arabic (Lebanon)",value:"ar-LB"},{option:"Arabic (Morocco)",value:"ar-MA"},{option:"Arabic (Oman)",value:"ar-OM"},{option:"Arabic (Qatar)",value:"ar-QA"},{option:"Arabic (Saudi Arabia)",value:"ar-SA"},{option:"Arabic (State of Palestine)",value:"ar-PS"},{option:"Arabic (Tunisia)",value:"ar-TN"},{option:"Arabic (United Arab Emirates)",value:"ar-AE"},{option:"Arabic (Yemen)",value:"ar-YE"},{option:"Armenian (Armenia)",value:"hy-AM"},{option:"Azerbaijani (Azerbaijan)",value:"az-AZ"},{option:"Basque (Spain)",value:"eu-ES"},{option:"Bengali (Bangladesh)",value:"bn-BD"},{option:"Bengali (India)",value:"bn-IN"},{option:"Bosnian (Bosnia and Herzegovina)",value:"bs-BA"},{option:"Bulgarian (Bulgaria)",value:"bg-BG"},{option:"Burmese (Myanmar)",value:"my-MM"},{option:"Catalan (Spain)",value:"ca-ES"},{option:"Chinese, Cantonese (Traditional Hong Kong)",value:"yue-Hant-HK"},{option:"Chinese, Mandarin (Simplified, China)",value:"cmn-Hans-CN"},{option:"Croatian (Croatia)",value:"hr-HR"},{option:"Czech (Czech Republic)",value:"cs-CZ"},{option:"Danish (Denmark)",value:"da-DK"},{option:"Dutch (Belgium)",value:"nl-BE"},{option:"Dutch (Netherlands)",value:"nl-NL"},{option:"English (Australia)",value:"en-AU"},{option:"English (Canada)",value:"en-CA"},{option:"English (Ghana)",value:"en-GH"},{option:"English (Hong Kong)",value:"en-HK"},{option:"English (India)",value:"en-IN"},{option:"English (Ireland)",value:"en-IE"},{option:"English (Kenya)",value:"en-KE"},{option:"English (New Zealand)",value:"en-NZ"},{option:"English (Nigeria)",value:"en-NG"},{option:"English (Pakistan)",value:"en-PK"},{option:"English (Philippines)",value:"en-PH"},{option:"English (Singapore)",value:"en-SG"},{option:"English (South Africa)",value:"en-ZA"},{option:"English (Tanzania)",value:"en-TZ"},{option:"English (United Kingdom)",value:"en-GB"},{option:"English (United States)",value:"en-US"},{option:"Estonian (Estonia)",value:"et-EE"},{option:"Filipino (Philippines)",value:"fil-PH"},{option:"Finnish (Finland)",value:"fi-FI"},{option:"French (Belgium)",value:"fr-BE"},{option:"French (Canada)",value:"fr-CA"},{option:"French (France)",value:"fr-FR"},{option:"French (Switzerland)",value:"fr-CH"},{option:"Galician (Spain)",value:"gl-ES"},{option:"Georgian (Georgia)",value:"ka-GE"},{option:"German (Austria)",value:"de-AT"},{option:"German (Germany)",value:"de-DE"},{option:"German (Switzerland)",value:"de-CH"},{option:"Greek (Greece)",value:"el-GR"},{option:"Gujarati (India)",value:"gu-IN"},{option:"Hebrew (Israel)",value:"iw-IL"},{option:"Hindi (India)",value:"hi-IN"},{option:"Hungarian (Hungary)",value:"hu-HU"},{option:"Icelandic (Iceland)",value:"is-IS"},{option:"Indonesian (Indonesia)",value:"id-ID"},{option:"Italian (Italy)",value:"it-IT"},{option:"Italian (Switzerland)",value:"it-CH"},{option:"Japanese (Japan)",value:"ja-JP"},{option:"Javanese (Indonesia)",value:"jv-ID"},{option:"Kannada (India)",value:"kn-IN"},{option:"Kazakh (Kazakhstan)",value:"kk-KZ"},{option:"Khmer (Cambodia)",value:"km-KH"},{option:"Korean (South Korea)",value:"ko-KR"},{option:"Lao (Laos)",value:"lo-LA"},{option:"Latvian (Latvia)",value:"lv-LV"},{option:"Lithuanian (Lithuania)",value:"lt-LT"},{option:"Macedonian (North Macedonia)",value:"mk-MK"},{option:"Malay (Malaysia)",value:"ms-MY"},{option:"Malayalam (India)",value:"ml-IN"},{option:"Marathi (India)",value:"mr-IN"},{option:"Mongolian (Mongolia)",value:"mn-MN"},{option:"Nepali (Nepal)",value:"ne-NP"},{option:"Norwegian BokmÃ¥l (Norway)",value:"no-NO"},{option:"Persian (Iran)",value:"fa-IR"},{option:"Polish (Poland)",value:"pl-PL"},{option:"Portuguese (Brazil)",value:"pt-BR"},{option:"Portuguese (Portugal)",value:"pt-PT"},{option:"Punjabi (Gurmukhi India)",value:"pa-Guru-IN"},{option:"Romanian (Romania)",value:"ro-RO"},{option:"Russian (Russia)",value:"ru-RU"},{option:"Serbian (Serbia)",value:"sr-RS"},{option:"Sinhala (Sri Lanka)",value:"si-LK"},{option:"Slovak (Slovakia)",value:"sk-SK"},{option:"Slovenian (Slovenia)",value:"sl-SI"},{option:"Spanish (Argentina)",value:"es-AR"},{option:"Spanish (Bolivia)",value:"es-BO"},{option:"Spanish (Chile)",value:"es-CL"},{option:"Spanish (Colombia)",value:"es-CO"},{option:"Spanish (Costa Rica)",value:"es-CR"},{option:"Spanish (Dominican Republic)",value:"es-DO"},{option:"Spanish (Ecuador)",value:"es-EC"},{option:"Spanish (El Salvador)",value:"es-SV"},{option:"Spanish (Guatemala)",value:"es-GT"},{option:"Spanish (Honduras)",value:"es-HN"},{option:"Spanish (Mexico)",value:"es-MX"},{option:"Spanish (Nicaragua)",value:"es-NI"},{option:"Spanish (Panama)",value:"es-PA"},{option:"Spanish (Paraguay)",value:"es-PY"},{option:"Spanish (Peru)",value:"es-PE"},{option:"Spanish (Puerto Rico)",value:"es-PR"},{option:"Spanish (Spain)",value:"es-ES"},{option:"Spanish (United States)",value:"es-US"},{option:"Spanish (Uruguay)",value:"es-UY"},{option:"Spanish (Venezuela)",value:"es-VE"},{option:"Sundanese (Indonesia)",value:"su-ID"},{option:"Swahili (Kenya)",value:"sw-KE"},{option:"Swahili (Tanzania)",value:"sw-TZ"},{option:"Swedish (Sweden)",value:"sv-SE"},{option:"Tamil (India)",value:"ta-IN"},{option:"Tamil (Malaysia)",value:"ta-MY"},{option:"Tamil (Singapore)",value:"ta-SG"},{option:"Tamil (Sri Lanka)",value:"ta-LK"},{option:"Telugu (India)",value:"te-IN"},{option:"Thai (Thailand)",value:"th-TH"},{option:"Turkish (Turkey)",value:"tr-TR"},{option:"Ukrainian (Ukraine)",value:"uk-UA"},{option:"Urdu (India)",value:"ur-IN"},{option:"Urdu (Pakistan)",value:"ur-PK"},{option:"Uzbek (Uzbekistan)",value:"uz-UZ"},{option:"Vietnamese (Vietnam)",value:"vi-VN"},{option:"Zulu (South Africa)",value:"zu-ZA"}]}).factory("awsPollyVoice",function(){return[{value:"Zeina",option:"Zeina (Arabic, Female)"},{value:"Zhiyu",option:"Zhiyu (Chinese, Mandarin, Female)"},{value:"Naja",option:"Naja (Danish, Female)"},{value:"Mads",option:"Mads (Danish, Male)"},{value:"Lotte",option:"Lotte (Dutch, Female)"},{value:"Ruben",option:"Ruben (Dutch, Male)"},{value:"Nicole",option:"Nicole (English, Australian, Female)"},{value:"Olivia",option:"Olivia (English, Austrialian, Female)"},{value:"Russell",option:"Russell (English, Austrialian, Male)"},{value:"Amy",option:"Amy (English, British, Female)"},{value:"Emma",option:"Emma (English, British, Female)"},{value:"Brian",option:"Brian (English, British, Male)"},{value:"Aditi",option:"Aditi (English, Indian, Female)"},{value:"Raveena",option:"Raveena (English, Indian, Female)"},{value:"Aria",option:"Aria (English, New Zealand, Female)"},{value:"Ayanda",option:"Ayanda (English, South African, Female)"},{value:"Joanna",option:"Joanna (English, US, Female)"},{value:"Ivy",option:"Ivy (English, US, Female)"},{value:"Joey",option:"Joey (English, US, Male)"},{value:"Justin",option:"Justin (English, US, Male)"},{value:"Kendra",option:"Kendra (English, US, Female)"},{value:"Kimberly",option:"Kimberly (English, US, Female)"},{value:"Salli",option:"Salli (English, US, Female)"},{value:"Kevin",option:"Kevin (English, US, Male)"},{value:"Matthew",option:"Matthew (English, US, Male)"},{value:"Geraint",option:"Geraint (English, Welsh, Male)"},{value:"Celine",option:"Celine (French, Female)"},{value:"Mathieu",option:"Mathieu (French, Male)"},{value:"Léa",option:"Léa (French, Male)"},{value:"Chantal",option:"Chantal (French, Canadian, Female)"},{value:"Gabrielle",option:"Gabrielle (French, Canadian, Female)"},{value:"Vicki",option:"Vicki (German , Female)"},{value:"Hans",option:"Hans (German, Male)"},{value:"Marlene",option:"Marlene (German, Female)"},{value:"Aditi",option:"Aditi (Hindi , Female)"},{value:"Karl",option:"Karl (Icelandic, Male)"},{value:"Dora",option:"Dora (Icelandic, Female)"},{value:"Carla",option:"Carla (Italian, Female)"},{value:"Giorgio",option:"Giorgio (Italian, Male)"},{value:"Bianca",option:"Bianca (Italian, Male)"},{value:"Mizuki",option:"Mizuki (Japanese, Female)"},{value:"Takumi",option:"Takumi (Japanese, Male)"},{value:"Seoyeon",option:"Seoyeon (Korean, Female)"},{value:"Liv",option:"Liv (Norwegian, Female)"},{value:"Ewa",option:"Ewa (Polish, Female)"},{value:"Jacek",option:"Jacek (Polish, Male)"},{value:"Jan",option:"Jan (Polish, Male)"},{value:"Maja",option:"Maja (Polish, Female)"},{value:"Camila",option:"Camila (Portuguese, Brazilian, Female)"},{value:"Ricardo",option:"Ricardo (Portuguese, Brazilian, Male)"},{value:"Vitoria",option:"Vitoria (Portuguese, Brazilian, Female)"},{value:"Cristiano",option:"Cristiano (Portuguese, Male)"},{value:"Ines",option:"Ines (Portuguese, Female)"},{value:"Carmen",option:"Carmen (Romanian, Female)"},{value:"Maxim",option:"Maxim (Russian, Male)"},{value:"Tatyana",option:"Tatyana (Russian, Female)"},{value:"Conchita",option:"Conchita (Spanish, European, Female)"},{value:"Lucia",option:"Lucia (Spanish, European, Female)"},{value:"Enrique",option:"Enrique (Spanish, European, Male)"},{value:"Mia",option:"Mia (Spanish, Mexican, Female)"},{value:"Miguel",option:"Miguel (Spanish, US, Male)"},{value:"Penelope",option:"Penelope (Spanish, US, Female)"},{value:"Lupe",option:"Lupe (Spanish, US, Female)"},{value:"Astrid",option:"Astrid (Swedish, Female)"},{value:"Filiz",option:"Filiz (Turkish, Female)"},{value:"Gwyneth",option:"Gwyneth (Welsh , Female)"}]}).factory("awsPollyRegion",function(){return[{value:"us-east-1",option:"US East (N. Virginia)"},{value:"us-east-2",option:"US East (Ohio)"},{value:"us-west-1",option:"US West (N. California)"},{value:"us-west-2",option:"US West (Oregon)"},{value:"ca-central-1",option:"Canada (Central)"},{value:"eu-west-1",option:"EU (Ireland)"},{value:"eu-central-1",option:"EU (Frankfurt)"},{value:"eu-west-2",option:"EU (London)"},{value:"eu-west-3",option:"EU (Paris)"},{value:"ap-southeast-1",option:"Asia Pacific (Singapore)"},{value:"ap-southeast-2",option:"Asia Pacific (Sydney)"},{value:"ap-northeast-2",option:"Asia Pacific (Seoul)"},{value:"ap-northeast-1",option:"Asia Pacific (Tokyo)"},{value:"ap-south-1",option:"Asia Pacific (Mumbai)"},{value:"sa-east-1",option:"South America (São Paulo)"}]}).factory("awsLexRegion",function(){return[{value:"us-east-1",option:"US East (N. Virginia)"},{value:"us-west-2",option:"US West (Oregon)"},{value:"eu-west-1",option:"EU (Ireland)"},{value:"ap-southeast-2",option:"Asia Pacific (Sydney)"}]}).factory("dialogFlowLanguage",function(){return[{value:"da",option:"Danish"},{value:"en",option:"English"},{value:"de",option:"German"},{value:"it",option:"Italian"},{value:"es",option:"Spanish"},{value:"fr",option:"French"},{value:"id",option:"Indonesian"},{value:"ja",option:"Japanese"},{value:"ko",option:"Korean (South Korea)"},{value:"nl",option:"Dutch"},{value:"no",option:"Norwegian"},{value:"pt",option:"Portuguese (European)"},{value:"pt-br",option:"Portuguese (Nrazilian)"},{value:"ru",option:"Russian"},{value:"sv",option:"Swedish"},{value:"th",option:"Thai"},{value:"uk",option:"Ukrainian"},{value:"zh-CN",option:"Chinese (Simplified)"},{value:"zh-HK",option:"Chinese (Hong Kong)"},{value:"zh-TW",option:"Chinese (Traditional)"}]}).factory("dialogFlowV2Language",function(){return[{value:"zh-HK",option:"Chinese (Cantonese)"},{value:"zh-CN",option:"Chinese (Simplified)"},{value:"zh-TW",option:"Chinese (Traditional)"},{value:"da",option:"Danish"},{value:"nl",option:"Dutch"},{value:"en",option:"English"},{value:"en-AU",option:"English (Australia)"},{value:"en-CA",option:"English (Canada)"},{value:"en-GB",option:"English (Great Britain)"},{value:"en-IN",option:"English (India)"},{value:"en-US",option:"English (US)"},{value:"fr",option:"French"},{value:"fr-CA",option:"French (Canada)"},{value:"fr-FR",option:"France (France)"},{value:"de",option:"German"},{value:"hi",option:"Hindi"},{value:"id",option:"Indonesian"},{value:"it",option:"Italian"},{value:"ja",option:"Japanese"},{value:"ko",option:"Korean"},{value:"no",option:"Norwegian"},{value:"pl",option:"Polish"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"ru",option:"Russian"},{value:"es",option:"Spanish"},{value:"es-419",option:"Spanish (Latin America)"},{value:"es-ES",option:"Spanish (Spain)"},{value:"sw",option:"Swedish"},{value:"th",option:"Thai"},{value:"tr",option:"Turkish"},{value:"uk",option:"Ukrainian"}]})}(),function(){"use strict";function e(n,e,t,a){var i=this;i.project={preproduction:t},i.closeDialog=function(e){e?(a(i.project.preproduction),n.hide(i.project.preproduction)):n.hide()}}e.$inject=["$mdDialog","toasty","currentXML","saveCallback"],angular.module("app.callysquare").controller("MxGraphEditXMLController",e)}(),function(){"use strict";function e(n,t){var a=this;function i(e){e?(t(e),n.hide(e)):n.hide()}a.errors=[],a.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:5242880,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},a.ngFlow={flow:{}},a.dropping=!1,a.closeDialog=i,a.fileAdded=function(e){a.errors=[];_.includes(["xml"],e.getExtension())||a.errors.push({message:"The extension "+e.getExtension()+" is not supported!"});5242880<e.size&&a.errors.push({message:"The file is too big. The max allowed size is 5MB"});if(!a.errors.length){var n=new FileReader;n.onload=function(e){i(e.target.result)},n.readAsText(e.file)}}}e.$inject=["$mdDialog","saveCallback"],angular.module("app.callysquare").controller("MxGraphImportXMLController",e)}(),function(){"use strict";function e(n,t,e,a){var i=this;i.project=_.clone(e),i.closeDialog=function(){n.hide()},i.save=function(){i.errors=[],a.squareProject.update({id:i.project.id},{notes:i.project.notes,description:i.project.description}).$promise.then(function(e){t.success({title:"Project updated!",msg:i.project.name?i.project.name+" has been updated!":""}),n.hide(e)}).catch(function(e){console.error(e),i.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.update"}]})}}e.$inject=["$mdDialog","toasty","project","api"],angular.module("app.callysquare").controller("MxGraphUpdateInfoController",e)}(),function(){"use strict";function e(n,e,t,a,i){var s=this;s.projects=t,s.id="",s.newWindow=!0,s.closeDialog=function(e){s.errors=[],e?(n.hide(),s.newWindow?a.open("/callysquare/projects/"+s.id,"_blank"):i.go("app.callysquare.projects.edit",{id:s.id})):n.hide()}}e.$inject=["$mdDialog","toasty","projects","$window","$state"],angular.module("app.callysquare").controller("MxGraphOpenProjectController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o){var r=this;function l(){return a.squareProject.getUsers({id:r.project.id,fields:"id,name,fullname,internal",nolimit:!0,role:"user"}).$promise.then(function(e){return r.selectedItems=e.rows?_.map(e.rows,function(e){return e}):[],r.dualMultiselectOptions.selectedItems=r.selectedItems,a.user.get({fields:"id,fullname,name,internal",role:"user",nolimit:!0}).$promise}).then(function(e){r.items=e.rows?_.map(e.rows,function(e){return e}):[],r.dualMultiselectOptions.items=_.differenceBy(r.items,r.selectedItems,"id")}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETUSERS",msg:e.status?JSON.stringify(e.data):e.toString()})})}r.project=n,r.penalty=0,r.items=[],r.selectedItems=[],r.closeDialog=function(){e.hide()},r.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("CALLYSQUARE.ALL_USERS"),labelSelected:s.instant("CALLYSQUARE.SELECTED_USERS"),transferCallback:function(e,n){a.squareProject[n?"removeUsers":"addUsers"]({id:r.project.id,ids:_.map(e,"id"),penalty:r.penalty||0}).$promise.then(function(){t.success({title:"Project properly "+(n?"removed":"added"),msg:"Project has been "+(n?"removed":"added")+"!"}),n||l()}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:squareProjects.ADDUSERS",msg:e.status?JSON.stringify(e.data):e.toString()})})}},l()}e.$inject=["$mdDialog","toasty","api","project","projects","$translate","Auth"],angular.module("app.callysquare").controller("ProjectspermissionaddController",e)}(),function(){"use strict";function e(n,t,e,a,i,s,o){var r=this;r.project=angular.copy(e),r.project.name+="_new",r.project.preproduction=a,r.newWindow=!0,r.closeDialog=function(){n.hide()},r.save=function(){delete r.project.id,i.squareProject.save(r.project).$promise.then(function(e){t.success({title:"Project properly created",msg:r.project.name?r.project.name+" has been created!":""}),n.hide(e),r.newWindow?s.open("/callysquare/projects/"+e.id,"_blank"):o.go("app.callysquare.projects.edit",{id:e.id})}).catch(function(e){console.error(e),r.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.save"}]})}}e.$inject=["$mdDialog","toasty","project","currentXML","api","$window","$state"],angular.module("app.callysquare").controller("MxGraphSaveProjectAsController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,r,n,l,d,c,m,u,p,g,v,h,f,b,A,E,y,S,T){var I=this;I.currentUser=T.getCurrentUser(),I.project=n||{},I.userProfileSection=S&&1==S.count?S.rows[0]:null,I.crudPermissions=T.parseCrudPermissions(I.userProfileSection?I.userProfileSection.crudPermissions:null),I.onInit=function(){new EditorUi(I,new Editor,document.getElementById("geEditor")).openString(I.project.preproduction,I.project.name,I.project)},I.saveOrPublishProject=function(e,n){var t={preproduction:e};n&&(t.production=e);r.squareProject.update({id:I.project.id},t).$promise.then(function(e){o.success({title:"Project "+(n?"published":"saved")+"!",msg:I.project.name?I.project.name+" has been "+(n?"published":"saved")+"!":""}),I.project.preproduction=e.preproduction}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsquareProject",msg:e.data?JSON.stringify(e.data):e.toString()})})},I.openDialog=function(e,n){a.show({controller:"MxGraphDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/dialog/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{users:l.rows||[],trunks:d.rows||[],queues:c.rows||[],sounds:m.rows||[],variables:u.rows||[],databases:p.rows||[],contexts:g.rows||[],projects:v.rows||[],intervals:h.rows||[],mailAccounts:f.rows||[],smsAccounts:E.rows||[],pauses:y.rows||[],templates:b.rows||[],lists:A.rows||[],cell:e,saveCallback:n,crudPermissions:I.crudPermissions}})},I.newProject=function(e){a.show({controller:"CreateOrEditSquareProjectDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/create/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{project:e,projects:v.rows,openFromEditor:!0,license:null,setting:null,crudPermissions:I.crudPermissions}})},I.openProject=function(){a.show({controller:"MxGraphOpenProjectController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/open/open.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{projects:v.rows||[]}})},I.saveProjectAs=function(e){a.show({controller:"MxGraphSaveProjectAsController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/saveAs/saveAs.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{project:I.project,currentXML:e}}).then(function(e){e&&v.rows.push(e)})},I.newVariable=function(n){return i(function(a,n){return r.userProfileSection.get({userProfileId:I.currentUser.userProfileId,sectionId:1012}).$promise.then(function(e){var n=e.rows?e.rows[0]:null,t=T.parseCrudPermissions(n?n.crudPermissions:null);a(t)}).catch(function(e){n(e)})}).then(function(e){e.canEdit?a.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{variable:n,variables:u.rows,license:null,setting:null,crudPermissions:e}}):o.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_CREATION_MESSAGE")})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"API:NEW_VARIABLE",msg:e.data?JSON.stringify(e.data):e.toString()})})},I.updateInfo=function(e){a.show({controller:"MxGraphUpdateInfoController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/info/info.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:I.project}}).then(function(e){e&&_.merge(I.project,e)})},I.editXML=function(e,n){a.show({controller:"MxGraphEditXMLController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/edit/edit.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{currentXML:e,saveCallback:n}}).then(function(e){e&&(I.project.preproduction=e)})},I.importXML=function(e){a.show({controller:"MxGraphImportXMLController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/import/import.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{saveCallback:e}}).then(function(e){e&&(I.project.preproduction=e)})},I.gotoProjects=function(){e.go("app.callysquare.projects",{},{reload:"app.callysquare.projects"})}}e.$inject=["$state","$document","$mdDialog","$q","$translate","toasty","api","project","users","trunks","queues","sounds","variables","databases","contexts","projects","intervals","mailAccounts","templates","lists","smsAccounts","pauses","userProfileSection","Auth"],angular.module("app.callysquare").controller("ProjectController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.projects=a||{count:0,rows:[]},p.userProfile=i,p.userProfileSection=s&&1==s.count?s.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.listOrder="",p.listOrderAsc=null,p.selectedProjects=[],p.query={fields:"id,name,description,notes",sort:"-updatedAt",limit:10,page:1},p.editstate=function(e,n){t.go("app.callysquare.projects.edit",{id:e.id,crudPermissions:p.crudPermissions})},p.deleteconfirm=function(e,n){var t=l.confirm().title("Are you sure want to delete the project?").htmlContent("<b>"+e.name+"</b> will be deleted.").ariaLabel("delete project").targetEvent(n).ok("OK").cancel("CANCEL");l.show(t).then(function(){f(e)},function(){console.log("CANCEL")})},p.success=h,p.getProjects=function(){p.query.offset=(p.query.page-1)*p.query.limit,u.hasRole("admin")?p.promise=o.squareProject.get(p.query,h).$promise:(p.query.id=p.userProfile.id,p.query.section="SquareProjects",p.promise=o.userProfile.getResources(p.query,h).$promise)},p.createOrEditProject=function(e,n){l.show({controller:"CreateOrEditSquareProjectDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/create/dialog.html",parent:angular.element(d.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:n,projects:p.projects.rows,openFromEditor:null,setting:null,crudPermissions:p.crudPermissions}})},p.deleteProject=f,p.exportSelectedProjects=function(){var e=angular.copy(p.selectedProjects);return p.selectedProjects=[],e},p.deleteSelectedProjects=function(e){var n=l.confirm().title("Are you sure want to delete the selected projects?").htmlContent("<b>"+p.selectedProjects.length+" selected</b> will be deleted.").ariaLabel("delete Projects").targetEvent(e).ok("OK").cancel("CANCEL");l.show(n).then(function(){p.selectedProjects.forEach(function(e){f(e)}),p.selectedProjects=[]})},p.deselectProjects=function(){p.selectedProjects=[]},p.selectAllProjects=function(){p.selectedProjects=p.projects.rows};var g=!0,v=1;function h(e){p.projects=e||{count:0,rows:[]}}function f(e){o.squareProject.delete({id:e.id}).$promise.then(function(){_.remove(p.projects.rows,{id:e.id}),p.projects.count-=1,p.projects.rows.length||p.getProjects(),m.success({title:"Project deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.project.delete"}];for(var n=0;n<e.data.errors.length;n++)m.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.project.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){g?c(function(){g=!1}):(n||(v=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=v),p.getProjects())})}e.$inject=["$scope","$state","$mdSidenav","projects","userProfile","userProfileSection","api","msUtils","$mdDialog","$document","$timeout","toasty","Auth"],angular.module("app.callysquare").controller("ProjectsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CALLYSQUARE.EDIT_SQUARERECORDING",g.squareRecording=angular.copy(l),g.squareRecordings=r,g.newSquareRecording=!1,g.squareRecording||(g.squareRecording={},g.title="CALLYSQUARE.NEW_SQUARERECORDING",g.newSquareRecording=!0),g.addNewSquareRecording=function(){g.errors=[],d.squareRecording.save(g.squareRecording).$promise.then(function(e){g.squareRecordings.unshift(e.toJSON()),o.success({title:"SquareRecording properly created",msg:g.squareRecording.name?g.squareRecording.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareRecording.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSquareRecording=function(){g.errors=[],d.squareRecording.update({id:g.squareRecording.id},g.squareRecording).$promise.then(function(e){var n=_.find(g.squareRecordings,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SquareRecording properly saved!",msg:g.squareRecording.name?g.squareRecording.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareRecording.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSquareRecording=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The squareRecording will be deleted.").ariaLabel("Delete SquareRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.squareRecording.delete({id:g.squareRecording.id}).$promise.then(function(){_.remove(g.squareRecordings,{id:g.squareRecording.id}),o.success({title:"SquareRecording properly deleted!",msg:(g.squareRecording.name||"squareRecording")+" has been deleted!"}),v(g.squareRecording)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareRecording.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","squareRecordings","squareRecording","api","Auth","license","setting","crudPermissions"],angular.module("app.callysquare").controller("CreateOrEditSquareRecordingDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.squareRecordings=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="squareRecordings",f.listOrder="",f.listOrderAsc=null,f.selectedSquareRecordings=[],f.query={fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio,savePath,format",sort:"-createdAt",limit:10,page:1},f.downloadfile2=function(s,e){return m.squareRecording.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.uniqueid+s.format;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("squareRecording")+"?").htmlContent("<b>"+(e.name||"squareRecording")+"</b> will be deleted.").ariaLabel("delete squareRecording").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSquareRecordings=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.squareRecording.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SquareRecordings",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSquareRecording=function(e,n){i.show({controller:"CreateOrEditSquareRecordingDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/squareRecordings/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{squareRecording:n,squareRecordings:f.squareRecordings.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSquareRecording=y,f.exportSelectedSquareRecordings=function(){var e=angular.copy(f.selectedSquareRecordings);return f.selectedSquareRecordings=[],e},f.deleteSelectedSquareRecordings=function(e){var n=i.confirm().title("Are you sure want to delete the selected squareRecordings?").htmlContent("<b>"+f.selectedSquareRecordings.length+" selected</b> will be deleted.").ariaLabel("delete SquareRecordings").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSquareRecordings.forEach(function(e){y(e)}),f.selectedSquareRecordings=[]})},f.deselectSquareRecordings=function(){f.selectedSquareRecordings=[]},f.selectAllSquareRecordings=function(){f.selectedSquareRecordings=f.squareRecordings.rows};var b=!0,A=1;function E(e){f.squareRecordings=e||{count:0,rows:[]}}function y(e){m.squareRecording.delete({id:e.id}).$promise.then(function(){_.remove(f.squareRecordings.rows,{id:e.id}),f.squareRecordings.count-=1,f.squareRecordings.rows.length||f.getSquareRecordings(),p.success({title:_.startCase("SquareRecording")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsquareRecording"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsquareRecording",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSquareRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","squareRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.callysquare").controller("SquareRecordingsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.chatQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="chatQueues",f.listOrder="",f.listOrderAsc=null,f.selectedChatQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"chat",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.chat.chatQueues.edit",{id:e.id,chatQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"ChatQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:f.chatQueues?f.chatQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:f.chatQueues?f.chatQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("chatQueue")+"?").htmlContent("<b>"+(e.name||"chatQueue")+"</b> will be deleted.").ariaLabel("delete chatQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.chat.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.chat.realtime.queues",{})}},f.success=E,f.getChatQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.chatQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ChatQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditChatQueue=function(e,n){i.show({controller:"CreateOrEditChatQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatQueue:n,chatQueues:f.chatQueues.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteChatQueue=y,f.exportSelectedChatQueues=function(){var e=angular.copy(f.selectedChatQueues);return f.selectedChatQueues=[],e},f.deleteSelectedChatQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected chatQueues?").htmlContent("<b>"+f.selectedChatQueues.length+" selected</b> will be deleted.").ariaLabel("delete ChatQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedChatQueues.forEach(function(e){y(e)}),f.selectedChatQueues=[]})},f.deselectChatQueues=function(){f.selectedChatQueues=[]},f.selectAllChatQueues=function(){f.selectedChatQueues=f.chatQueues.rows};var b=!0,A=1;function E(e){f.chatQueues=e||{count:0,rows:[]}}function y(e){m.chatQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.chatQueues.rows,{id:e.id}),f.chatQueues.count-=1,f.chatQueues.rows.length||f.getChatQueues(),p.success({title:_.startCase("ChatQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEchatQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEchatQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getChatQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chatQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.chat").controller("ChatQueuesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CHAT.EDIT_CHATQUEUE",g.chatQueue=angular.copy(l),g.chatQueues=r,g.newChatQueue=!1,g.chatQueue||(g.chatQueue={strategy:"beepall",timeout:10},g.title="CHAT.NEW_CHATQUEUE",g.newChatQueue=!0),g.addNewChatQueue=function(){g.errors=[],d.chatQueue.save(g.chatQueue).$promise.then(function(e){g.chatQueues.unshift(e.toJSON()),o.success({title:"ChatQueue properly created",msg:g.chatQueue.name?g.chatQueue.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatQueue=function(){g.errors=[],d.chatQueue.update({id:g.chatQueue.id},g.chatQueue).$promise.then(function(e){var n=_.find(g.chatQueues,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ChatQueue properly saved!",msg:g.chatQueue.name?g.chatQueue.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatQueue=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chatQueue will be deleted.").ariaLabel("Delete ChatQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.chatQueue.delete({id:g.chatQueue.id}).$promise.then(function(){_.remove(g.chatQueues,{id:g.chatQueue.id}),o.success({title:"ChatQueue properly deleted!",msg:(g.chatQueue.name||"chatQueue")+" has been deleted!"}),v(g.chatQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chatQueues","chatQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.chatQueue.getAgents({id:c.chatQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserChatQueue?"penalty "+e.UserChatQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.chatQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.removeAgents({id:c.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.addAgents({id:c.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CHAT.ALL_AGENTS"),labelSelected:r.instant("CHAT.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","chatQueue","chatQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.chat").controller("ChatQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.chatQueue.getTeams({id:l.chatQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.chatQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("CHAT.ALL_TEAMS"),labelSelected:t.instant("CHAT.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.removeTeams({id:l.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.addTeams({id:l.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","chatQueue","$translate","Auth","crudPermissions"],angular.module("app.chat").controller("ChatQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.chatQueue=c||e.params.chatQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"ChatQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:u.chatQueues?u.chatQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:u.chatQueues?u.chatQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoChatQueues=function(){e.go("app.chat.chatQueues",{},{reload:"app.chat.chatQueues"})},u.saveChatQueue=function(){r.chatQueue.update({id:u.chatQueue.id},u.chatQueue).$promise.then(function(){l.success({title:"ChatQueue updated!",msg:u.chatQueue.name?u.chatQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","chatQueue","userProfileSection"],angular.module("app.chat").controller("ChatQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.chatWebsites=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="chatWebsites",f.listOrder="",f.listOrderAsc=null,f.selectedChatWebsites=[],f.query={fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",sort:"-updatedAt",limit:10,page:1},f.arrayagentIdentifier=_.keyBy([{option:"WebsiteAlias",value:"'website_alias'"},{option:"AgentAlias",value:"'agent_alias'"},{option:"AgentFullname",value:"'agent_fullname'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayheader_shape=_.keyBy([{option:"Rounded",value:"'rounded'"},{option:"Squared",value:"'squared'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayalignment=_.keyBy([{option:"bottom_right",value:"'bottom_right'"},{option:"right",value:"'right'"},{option:"left",value:"'left'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymessagesAlignment=_.keyBy([{option:"alternate",value:"'alternate'"},{option:"centered",value:"'centered'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayratingType=_.keyBy([{option:"Star",value:"'star'"},{option:"Thumb",value:"'thumb'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.chat.chatWebsites.edit",{id:e.id,chatWebsite:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.chat.chatWebsites.edit",{id:e.id,tab:10})},f.offlinemessagesgoto=function(e,n){t.go("app.chat.chatWebsites.edit",{id:e.id,tab:11})},f.agentadddialog=function(e,n){i.show({controller:"ChatWebsiteagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatWebsite:e,chatWebsites:f.chatWebsites?f.chatWebsites.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("chatWebsite")+"?").htmlContent("<b>"+(e.name||"chatWebsite")+"</b> will be deleted.").ariaLabel("delete chatWebsite").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getChatWebsites=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.chatWebsite.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ChatWebsites",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditChatWebsite=function(e,n){i.show({controller:"CreateOrEditChatWebsiteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:n,chatWebsites:f.chatWebsites.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteChatWebsite=y,f.exportSelectedChatWebsites=function(){var e=angular.copy(f.selectedChatWebsites);return f.selectedChatWebsites=[],e},f.deleteSelectedChatWebsites=function(e){var n=i.confirm().title("Are you sure want to delete the selected chatWebsites?").htmlContent("<b>"+f.selectedChatWebsites.length+" selected</b> will be deleted.").ariaLabel("delete ChatWebsites").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedChatWebsites.forEach(function(e){y(e)}),f.selectedChatWebsites=[]})},f.deselectChatWebsites=function(){f.selectedChatWebsites=[]},f.selectAllChatWebsites=function(){f.selectedChatWebsites=f.chatWebsites.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.chatWebsite&&(t=_.find(f.lists,{id:Number(f.chatWebsite.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.chatWebsite&&(a=_.find(f.lists,{id:Number(f.chatWebsite.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.interval,{id:e.resourceId})}),t=null;if(f.chatWebsite&&(t=_.find(f.interval,{id:Number(f.chatWebsite.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.interval,{id:t.id});a.canSelect=!1,n.push(a)}f.interval=n})}else{var t=[],a=null;f.chatWebsite&&(a=_.find(f.interval,{id:Number(f.chatWebsite.IntervalId)}));for(var i=0;i<f.interval.length;i++)a&&f.interval[i].id===a.id&&(f.interval[i].canSelect=!1,t.push(f.interval[i]));f.interval=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.chatWebsites=e||{count:0,rows:[]}}function y(e){m.chatWebsite.delete({id:e.id}).$promise.then(function(){_.remove(f.chatWebsites.rows,{id:e.id}),f.chatWebsites.count-=1,f.chatWebsites.rows.length||f.getChatWebsites(),p.success({title:_.startCase("ChatWebsite")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getChatWebsites())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chatWebsites","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.chat").controller("ChatWebsitesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CHAT.EDIT_CHATWEBSITE",g.chatWebsite=angular.copy(l),g.chatWebsites=r,g.newChatWebsite=!1,g.chatWebsite||(g.chatWebsite={remote:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),header_shape:"rounded",alignment:"bottom_right",verticalAlignment:30,labelText:"CHAT",messagesAlignment:"alternate",IntervalId:"null",timezone:"null",waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300,vidaooTopic:"Generated by XCALLY Motion",vidaooNote:"Meeting generated for interaction #{{interaction.id}} by {{agent.name}}"},g.title="CHAT.NEW_CHATWEBSITE",g.newChatWebsite=!0),n.params.id&&(g.chatWebsite.ChatWebsiteId=n.params.id),g.addNewChatWebsite=function(){g.errors=[],d.chatWebsite.save(g.chatWebsite).$promise.then(function(e){g.chatWebsites.unshift(e.toJSON()),o.success({title:"ChatWebsite properly created",msg:g.chatWebsite.name?g.chatWebsite.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatWebsite.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatWebsite=function(){g.errors=[],d.chatWebsite.update({id:g.chatWebsite.id},g.chatWebsite).$promise.then(function(e){var n=_.find(g.chatWebsites,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ChatWebsite properly saved!",msg:g.chatWebsite.name?g.chatWebsite.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatWebsite.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatWebsite=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chatWebsite will be deleted.").ariaLabel("Delete ChatWebsite").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.chatWebsite.delete({id:g.chatWebsite.id}).$promise.then(function(){_.remove(g.chatWebsites,{id:g.chatWebsite.id}),o.success({title:"ChatWebsite properly deleted!",msg:(g.chatWebsite.name||"chatWebsite")+" has been deleted!"}),v(g.chatWebsite)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatWebsite.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.chatWebsite&&(t=_.find(g.lists,{id:Number(g.chatWebsite.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.chatWebsite&&(a=_.find(g.lists,{id:Number(g.chatWebsite.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),t=null;if(g.chatWebsite&&(t=_.find(g.interval,{id:Number(g.chatWebsite.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.interval,{id:t.id});a.canSelect=!1,n.push(a)}g.interval=n})}else{var t=[],a=null;g.chatWebsite&&(a=_.find(g.interval,{id:Number(g.chatWebsite.IntervalId)}));for(var i=0;i<g.interval.length;i++)a&&g.interval[i].id===a.id&&(g.interval[i].canSelect=!1,t.push(g.interval[i]));g.interval=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chatWebsites","chatWebsite","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatWebsiteDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.chatWebsiteApps.rows.length){var t=r.chatWebsiteApps.rows[n]?r.chatWebsiteApps.rows[n]:r.chatWebsiteApps.rows[0];i.show({controller:"EditChatWebsiteApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsiteApp:t,chatWebsite:r.chatWebsite,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.chatWebsiteApps.rows[n]=e:r.chatWebsiteApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.chatWebsiteApps.rows.length;t++,0){var a=r.chatWebsiteApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.chatWebsite.context,a.exten=r.chatWebsite.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.chatWebsite.addApplications({id:r.chatWebsite.id},_.sortBy(n,"priority")).$promise.then(function(e){r.chatWebsiteApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.chatWebsiteApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.chatWebsite={},r.chatWebsiteApps={count:0,rows:[]},r.selectedChatWebsiteApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"ChatQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"chatQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:501}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",role:"agent",sort:"name",nolimit:!0},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]},{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"tvox",appType:"tvox",type:"tvox",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"serviceid",name:"serviceid",type:"text",param:0},{title:"channelid",name:"channelid",type:"text",param:1},{title:"tvoxurl",name:"tvoxurl",type:"text",param:2},{title:"tvoxloginurl",name:"tvoxloginurl",type:"text",param:3},{title:"tvoxsessionurl",name:"tvoxsessionurl",type:"text",param:4},{title:"tvoxusername",name:"tvoxusername",type:"text",param:5},{title:"tvoxpasswd",name:"tvoxpasswd",type:"password",param:6},{title:"motionurlonring",name:"motionurlonring",type:"text",param:7},{title:"motionurlonanswer",name:"motionurlonanswer",type:"text",param:8},{title:"motiontitle",name:"motiontitle",type:"text",param:9},{title:"motionurl",name:"motionurl",type:"text",param:10}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.chatWebsite=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getChatWebsiteApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.chatWebsiteApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getChatWebsiteApps=function(){r.promise=o.chatWebsite.getApplications(r.query,t).$promise},r.editChatWebsiteApp=n,r.editInterval=function(e,n){if(r.chatWebsiteApps.rows.length){var t=r.chatWebsiteApps.rows[n]?r.chatWebsiteApps.rows[n]:r.chatWebsiteApps.rows[0];i.show({controller:"EditChatWebsiteAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteChatWebsiteApp=function(e){_.remove(r.chatWebsiteApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedChatWebsiteApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedChatWebsiteApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedChatWebsiteApps.forEach(function(e){_.remove(r.chatWebsiteApps.rows,{id:e.id})}),r.selectedChatWebsiteApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.chat").controller("ChatWebsiteActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.chatWebsite.getAgents({id:c.chatWebsite.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserChatWebsite?"penalty "+e.UserChatWebsite.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.chatWebsite=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.chatWebsite.removeAgents({id:c.chatWebsite.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.chatWebsite.addAgents({id:c.chatWebsite.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CHAT.ALL_AGENTS"),labelSelected:r.instant("CHAT.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","chatWebsite","chatWebsites","realtime","$translate","Auth","crudPermissions"],angular.module("app.chat").controller("ChatWebsiteagentaddController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/avatar".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsiteagentAvatarController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditChatWebsiteAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("chat")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.chatQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.chatQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:501}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteApptagDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.tvox=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tvox.appdata)switch(l.tvox.appType?l.tvox.appType.toLowerCase():l.tvox.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tvox.appdata.split(",");l.tvox.key=d[0],l.tvox.language=d[1],l.tvox.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tvox.appdata.split(",");l.tvox.projectId=d[0],l.tvox.clientEmail=d[1],l.tvox.privateKey=d[2],l.tvox.language=d[3],l.tvox.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tvox.appdata.split(",");l.tvox.accesskeyid=d[0],l.tvox.secretaccesskey=d[1],l.tvox.lexregion=d[2],l.tvox.botname=d[3],l.tvox.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tvox.appdata.split(",");l.tvox.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tvox.text=d.slice(1,d.length).join(",");break;case"message":l.tvox.text=l.tvox.appdata;break;case"set":l.tvox.name=l.tvox.appdata.split("=")[0],l.tvox.value=l.tvox.appdata.split("=")[1];break;case"agi":l.tvox.project=l.tvox.appdata;break;default:var c=l.tvox.appdata.split(",");l.tvox.serviceid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.tvox.channelid=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.tvox.tvoxurl=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.tvox.tvoxloginurl=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.tvox.tvoxsessionurl=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10),l.tvox.tvoxusername=_.isEmpty(c[5])?c[5]:isNaN(c[5])?c[5]:parseInt(c[5],10),l.tvox.tvoxpasswd=_.isEmpty(c[6])?c[6]:isNaN(c[6])?c[6]:parseInt(c[6],10),l.tvox.motionurlonring=_.isEmpty(c[7])?c[7]:isNaN(c[7])?c[7]:parseInt(c[7],10),l.tvox.motionurlonanswer=_.isEmpty(c[8])?c[8]:isNaN(c[8])?c[8]:parseInt(c[8],10),l.tvox.motiontitle=_.isEmpty(c[9])?c[9]:isNaN(c[9])?c[9]:parseInt(c[9],10),l.tvox.motionurl=_.isEmpty(c[10])?c[10]:isNaN(c[10])?c[10]:parseInt(c[10],10)}function m(e){n.hide(e)}l.tvox.type&&"outbound"===l.tvox.type.toLowerCase()&&"outbounddial"===l.tvox.appType.toLowerCase()&&(l.tvox.prefix=l.tvox.phone?l.tvox.phone.split("$")[0]:void 0,l.tvox.callerId=l.tvox.callerID?"CALLERID(all)="+l.tvox.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.tvox.type&&"outbound"===l.tvox.type.toLowerCase()&&"outboundDial"===l.tvox.appType&&(l.tvox.phone=i.cutdigits?(l.tvox.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tvox.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tvox.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tvox.options+="U(xcally-mixmonitor-context)"):l.tvox.options=l.tvox.options.replace("U(xcally-mixmonitor-context)",""));if(l.tvox.appType&&"custom"===l.tvox.appType);else switch((l.tvox.app||l.tvox.appType).toLowerCase()){case"set":l.tvox.appdata=l.tvox.name+"="+l.tvox.value;break;case"custom":break;default:e[0]=l.tvox.serviceid,e[1]=l.tvox.channelid,e[2]=l.tvox.tvoxurl,e[3]=l.tvox.tvoxloginurl,e[4]=l.tvox.tvoxsessionurl,e[5]=l.tvox.tvoxusername,e[6]=l.tvox.tvoxpasswd,e[7]=l.tvox.motionurlonring,e[8]=l.tvox.motionurlonanswer,e[9]=l.tvox.motiontitle,e[10]=l.tvox.motionurl,l.tvox.appdata=e.join(",")}m(l.tvox)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteApptvoxDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.chatWebsiteChatCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatWebsite.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteChatCannedAnswers.rows,{id:e.id}),m.chatWebsiteChatCannedAnswers.count-=1,m.chatWebsiteChatCannedAnswers.rows.length||p(),l.success({title:"ChatCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteChatCannedAnswers={count:0,rows:[]},m.selectedChatWebsiteChatCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.ChatWebsiteId=m.chatWebsite.id,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the chatCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("chatCannedAnswer #")+e.id||"chatCannedAnswer")+"</b> will be deleted.").ariaLabel("delete chatCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getChatWebsiteChatCannedAnswers=p,m.createOrEditChatWebsiteChatCannedAnswer=function(e,n){o.show({controller:"CreateOrEditChatCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/chatCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,chatCannedAnswer:n,chatCannedAnswers:m.chatWebsiteChatCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedChatWebsiteChatCannedAnswers=function(){var e=angular.copy(m.selectedChatWebsiteChatCannedAnswers);return m.selectedChatWebsiteChatCannedAnswers=[],e},m.deleteChatWebsiteChatCannedAnswer=g,m.deleteSelectedChatWebsiteChatCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected chatCannedAnswers?").htmlContent("<b>"+m.selectedChatWebsiteChatCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete chatCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteChatCannedAnswers.forEach(function(e){g(e)}),m.selectedChatWebsiteChatCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteChatCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CHAT.EDIT_CHATCANNEDANSWER",g.chatCannedAnswer=angular.copy(l),g.chatCannedAnswers=r,g.newChatCannedAnswer=!1,g.chatCannedAnswer||(g.chatCannedAnswer={},g.title="CHAT.NEW_CHATCANNEDANSWER",g.newChatCannedAnswer=!0),n.params.id&&(g.chatCannedAnswer.ChatWebsiteId=n.params.id),g.addNewChatCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.chatCannedAnswer).$promise.then(function(e){g.chatCannedAnswers.unshift(e.toJSON()),o.success({title:"ChatCannedAnswer properly created",msg:g.chatCannedAnswer.name?g.chatCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.chatCannedAnswer.id},g.chatCannedAnswer).$promise.then(function(e){var n=_.find(g.chatCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ChatCannedAnswer properly saved!",msg:g.chatCannedAnswer.name?g.chatCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chatCannedAnswer will be deleted.").ariaLabel("Delete ChatCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.chatCannedAnswer.id}).$promise.then(function(){_.remove(g.chatCannedAnswers,{id:g.chatCannedAnswer.id}),o.success({title:"ChatCannedAnswer properly deleted!",msg:(g.chatCannedAnswer.name||"chatCannedAnswer")+" has been deleted!"}),v(g.chatCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chatCannedAnswers","chatCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.chatWebsite.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.chatWebsite=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.ChatWebsiteId=m.chatWebsite.id,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.chatWebsite.id,field:"ChatWebsiteId",route:"chatWebsite"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.chat").controller("ChatWebsiteDispositionsController",e)}(),function(){"use strict";function e(t,e,a){var i=this;i.chatWebsite={},i.offlineForm={},i.buttons=[{type:"label",name:"Label",icon:"icon-label"},{type:"chooseFromList",name:"Select",icon:"icon-playlist-plus"},{type:"input",name:"Input",icon:"icon-keyboard"},{type:"textarea",name:"Textarea",icon:"icon-format-text"},{type:"multipleChoices",name:"Radio Buttons",icon:"icon-radiobox-marked"},{type:"checkboxes",name:"Checkboxes",icon:"icon-checkbox-multiple-marked-outline"},{type:"agreement",name:"Agreement",icon:"icon-checkbox-marked-outline"},{type:"upload",name:"Upload",icon:"icon-upload"}],i.init=function(e){i.fields=[],i.customFields=[],i.uselessFields=["id","createdAt","updatedAt","ListId","CompanyId","$promise","$resolved"],i.chatWebsite=e,_.isEmpty(i.chatWebsite.offlineForm)&&(i.chatWebsite.offlineForm={items:[],fromKey:null});a.cmList.getCustomFields({id:i.chatWebsite.ListId}).$promise.then(function(e){for(var n=0;n<e.rows.length;n++)i.customFields.push({key:"cf_"+e.rows[n].id,value:e.rows[n].alias});return a.cmContact.describe().$promise}).then(function(e){for(var n=_.keys(e),t=0;t<n.length;t++)_.includes(i.uselessFields,n[t])||_.startsWith(n[t],"cf_")||i.fields.unshift({key:n[t],value:n[t]});return a.variable.get().$promise}).then(function(e){return i.variables=e.rows,a.mailAccount.get({fields:"id,name",raw:!0}).$promise.then(function(e){i.email_accounts=e.rows})}).catch(function(e){console.error(e)})},i.up=function(e,n){if(0!==n){var t=i.chatWebsite.offlineForm.items[n-1];i.chatWebsite.offlineForm.items[n]=t,i.chatWebsite.offlineForm.items[n-1]=angular.copy(e),i.chatWebsite.offlineForm.fromKey===n?i.chatWebsite.offlineForm.fromKey--:i.chatWebsite.offlineForm.fromKey===n-1&&i.chatWebsite.offlineForm.fromKey++}},i.down=function(e,n){if(n!==i.chatWebsite.offlineForm.items.length-1){var t=i.chatWebsite.offlineForm.items[n+1];i.chatWebsite.offlineForm.items[n]=t,i.chatWebsite.offlineForm.items[n+1]=angular.copy(e),i.chatWebsite.offlineForm.fromKey===n?i.chatWebsite.offlineForm.fromKey++:i.chatWebsite.offlineForm.fromKey===n+1&&i.chatWebsite.offlineForm.fromKey--}},i.add=function(e){i.chatWebsite.offlineForm.items.push({type:e,cmField:null,variable:null})},i.remove=function(e){var n=t.confirm().title("The component will be deleted.").textContent("Are you sure?").ariaLabel("Lucky day").ok("Ok").cancel("Cancel");t.show(n).then(function(){i.chatWebsite.offlineForm.items.splice(e,1)})},i.card_type="offline",i.email_accounts=[]}e.$inject=["$mdDialog","$document","api"],angular.module("app.chat").controller("ChatWebsiteofflineFormController",e)}(),function(){"use strict";function e(t,e,a){var i=this;i.chatWebsite={},i.onlineForm={},i.buttons=[{type:"label",name:"Label",icon:"icon-label"},{type:"chooseFromList",name:"Select",icon:"icon-playlist-plus"},{type:"input",name:"Input",icon:"icon-keyboard"},{type:"textarea",name:"Textarea",icon:"icon-format-text"},{type:"multipleChoices",name:"Radio Buttons",icon:"icon-radiobox-marked"},{type:"checkboxes",name:"Checkboxes",icon:"icon-checkbox-multiple-marked-outline"},{type:"agreement",name:"Agreement",icon:"icon-checkbox-marked-outline"}],i.init=function(e){i.fields=[],i.customFields=[],i.uselessFields=["id","createdAt","updatedAt","ListId","CompanyId","$promise","$resolved"],i.chatWebsite=e,_.isEmpty(i.chatWebsite.onlineForm)&&(i.chatWebsite.onlineForm={items:[],fromKey:null});a.cmList.getCustomFields({id:i.chatWebsite.ListId}).$promise.then(function(e){for(var n=0;n<e.rows.length;n++)i.customFields.push({key:"cf_"+e.rows[n].id,value:e.rows[n].alias});return a.cmContact.describe().$promise}).then(function(e){for(var n=_.keys(e),t=0;t<n.length;t++)_.includes(i.uselessFields,n[t])||_.startsWith(n[t],"cf_")||i.fields.unshift({key:n[t],value:n[t]});return a.variable.get().$promise}).then(function(e){return i.variables=e.rows,a.mailAccount.get({fields:"id,name",raw:!0}).$promise.then(function(e){i.email_accounts=e.rows})}).catch(function(e){console.error(e)})},i.up=function(e,n){if(0!==n){var t=i.chatWebsite.onlineForm.items[n-1];i.chatWebsite.onlineForm.items[n]=t,i.chatWebsite.onlineForm.items[n-1]=angular.copy(e),i.chatWebsite.onlineForm.fromKey===n?i.chatWebsite.onlineForm.fromKey--:i.chatWebsite.onlineForm.fromKey===n-1&&i.chatWebsite.onlineForm.fromKey++}},i.down=function(e,n){if(n!==i.chatWebsite.onlineForm.items.length-1){var t=i.chatWebsite.onlineForm.items[n+1];i.chatWebsite.onlineForm.items[n]=t,i.chatWebsite.onlineForm.items[n+1]=angular.copy(e),i.chatWebsite.onlineForm.fromKey===n?i.chatWebsite.onlineForm.fromKey++:i.chatWebsite.onlineForm.fromKey===n+1&&i.chatWebsite.onlineForm.fromKey--}},i.add=function(e){i.chatWebsite.onlineForm.items.push({type:e,cmField:null,variable:null})},i.remove=function(e){var n=t.confirm().title("The component will be deleted.").textContent("Are you sure?").ariaLabel("Lucky day").ok("Ok").cancel("Cancel");t.show(n).then(function(){i.chatWebsite.onlineForm.fromKey===e&&(i.chatWebsite.onlineForm.fromKey=null),i.chatWebsite.onlineForm.items.splice(e,1),i.chatWebsite.onlineForm.items.length||(i.chatWebsite.onlineForm.fromKey=null)})},i.card_type="online",i.email_accounts=[]}e.$inject=["$mdDialog","$document","api"],angular.module("app.chat").controller("ChatWebsiteonlineFormController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/customer_avatar".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsitecustomerAvatarController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"chatWebsite",action:"getDispositions",field:"name",params:{id:m.chatWebsite.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.chatWebsiteInteractions=e||{count:0,rows:[]};for(var n=0;n<m.chatWebsiteInteractions.rows.length;n+=1){var t=m.chatWebsiteInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatInteraction.get(m.query,p).$promise}function v(e){d.chatInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteInteractions.rows,{id:e.id}),m.chatWebsiteInteractions.count-=1,m.chatWebsiteInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteInteractions={count:0,rows:[]},m.selectedChatWebsiteInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.ChatWebsiteId=m.chatWebsite.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Customer Ip",column:"customerIp",type:"text",options:{excludedOperators:["$eq","$ne","$startsWith","$endsWith"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.chatInteractionDownload=function(s,e,n){return d.chatInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="chat-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getChatWebsiteInteractions=g,m.createOrEditChatWebsiteInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,interaction:n,interactions:m.chatWebsiteInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spychatInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"chat",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"chat.chatWebsites"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||ChatWebsiteId:=$eq["+m.chatWebsite.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedChatWebsiteInteractions=function(){var e=angular.copy(m.selectedChatWebsiteInteractions);return m.selectedChatWebsiteInteractions=[],e},m.deleteChatWebsiteInteraction=v,m.deleteSelectedChatWebsiteInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedChatWebsiteInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteInteractions.forEach(function(e){v(e)}),m.selectedChatWebsiteInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteInteractionsController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/logo".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsitelogoController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.chatWebsiteOfflineMessages=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatWebsite.getOfflineMessages(m.query,u).$promise}function g(e){d.chatOfflineMessage.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteOfflineMessages.rows,{id:e.id}),m.chatWebsiteOfflineMessages.count-=1,m.chatWebsiteOfflineMessages.rows.length||p(),l.success({title:"OfflineMessage deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteOfflineMessages={count:0,rows:[]},m.selectedChatWebsiteOfflineMessages=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,attachments,Contact.firstName,ContactId,ChatWebsiteId",sort:"-createdAt",limit:10,page:1},m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the offlineMessage?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("offlineMessage #")+e.id||"offlineMessage")+"</b> will be deleted.").ariaLabel("delete offlineMessage").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getChatWebsiteOfflineMessages=p,m.createOrEditChatWebsiteOfflineMessage=function(e,n){o.show({controller:"CreateOrEditOfflineMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,offlineMessage:n,offlineMessages:m.chatWebsiteOfflineMessages.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.showOfflineMessageChatWebsiteOfflineMessage=function(e,t){o.show({controller:"ShowOfflineMessageOfflineMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,resolve:{message:["apiResolver","$stateParams",function(e,n){return e.resolve("chatOfflineMessage@get",{fields:"id,body",id:t.id})}],attachments:["apiResolver","$stateParams",function(e,n){return e.resolve("attachment@get",{fields:"id,name",ChatOfflineMessageId:t.id})}]}})},m.exportSelectedChatWebsiteOfflineMessages=function(){var e=angular.copy(m.selectedChatWebsiteOfflineMessages);return m.selectedChatWebsiteOfflineMessages=[],e},m.deleteChatWebsiteOfflineMessage=g,m.deleteSelectedChatWebsiteOfflineMessages=function(e){var n=o.confirm().title("Are you sure want to delete the selected offlineMessages?").htmlContent("<b>"+m.selectedChatWebsiteOfflineMessages.length+" selected</b> will be deleted.").ariaLabel("delete offlineMessages").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteOfflineMessages.forEach(function(e){g(e)}),m.selectedChatWebsiteOfflineMessages=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteOfflineMessagesController",e)}(),function(){"use strict";function e(n,e,t,a,i){var s=this;s.title="CHAT.OFFLINE_MESSAGE",s.message=a,s.attachments=i.rows,s.closeDialog=function(e){n.hide(e)},s.download=function(i){return e.attachment.download({id:i.id}).$promise.then(function(e){if(e){var n=new Blob([e.buffer],{type:e.type}),t=document.createElement("a"),a=window.URL.createObjectURL(n);t.href=a,t.target="_self",t.download=i.name,document.body.appendChild(t),t.click(),setTimeout(function(){document.body.removeChild(t),window.URL.revokeObjectURL(a)},100)}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"ATTACHMENTS:GET",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.isHtml=_.isNil(s.message.body.match(/\s?<!doctype html>|(<html\b[^>]*>|<body\b[^>]*>|<x-[^>]+>)+/i))}e.$inject=["$mdDialog","api","toasty","message","attachments"],angular.module("app.chat").controller("ShowOfflineMessageOfflineMessageDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.chatWebsiteProactiveActions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatWebsite.getProactiveActions(m.query,u).$promise}function g(e){d.chatProactiveAction.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteProactiveActions.rows,{id:e.id}),m.chatWebsiteProactiveActions.count-=1,m.chatWebsiteProactiveActions.rows.length||p(),l.success({title:"ChatProactiveAction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteProactiveActions={count:0,rows:[]},m.selectedChatWebsiteProactiveActions=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,name,type,selector,timeout",limit:10,page:1},m.arraytype=_.keyBy([{option:"MouseOver",value:"'mouseOver'"},{option:"Timeout",value:"'timeout'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.ChatWebsiteId=m.chatWebsite.id,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the chatProactiveAction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("chatProactiveAction #")+e.id||"chatProactiveAction")+"</b> will be deleted.").ariaLabel("delete chatProactiveAction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getChatWebsiteProactiveActions=p,m.createOrEditChatWebsiteChatProactiveAction=function(e,n){o.show({controller:"CreateOrEditChatProactiveActionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/proactive/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,chatProactiveAction:n,proactive:m.chatWebsiteProactiveActions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedChatWebsiteProactiveActions=function(){var e=angular.copy(m.selectedChatWebsiteProactiveActions);return m.selectedChatWebsiteProactiveActions=[],e},m.deleteChatWebsiteChatProactiveAction=g,m.deleteSelectedChatWebsiteProactiveActions=function(e){var n=o.confirm().title("Are you sure want to delete the selected proactive?").htmlContent("<b>"+m.selectedChatWebsiteProactiveActions.length+" selected</b> will be deleted.").ariaLabel("delete proactive").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteProactiveActions.forEach(function(e){g(e)}),m.selectedChatWebsiteProactiveActions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteProactiveActionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CHAT.EDIT_CHATPROACTIVEACTION",g.chatProactiveAction=angular.copy(l),g.proactive=r,g.newChatProactiveAction=!1,g.chatProactiveAction||(g.chatProactiveAction={type:"mouseOver"},g.title="CHAT.NEW_CHATPROACTIVEACTION",g.newChatProactiveAction=!0),n.params.id&&(g.chatProactiveAction.ChatWebsiteId=n.params.id),g.addNewChatProactiveAction=function(){g.errors=[],d.chatProactiveAction.save(g.chatProactiveAction).$promise.then(function(e){g.proactive.unshift(e.toJSON()),o.success({title:"ChatProactiveAction properly created",msg:g.chatProactiveAction.name?g.chatProactiveAction.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatProactiveAction.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatProactiveAction.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatProactiveAction=function(){g.errors=[],d.chatProactiveAction.update({id:g.chatProactiveAction.id},g.chatProactiveAction).$promise.then(function(e){var n=_.find(g.proactive,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ChatProactiveAction properly saved!",msg:g.chatProactiveAction.name?g.chatProactiveAction.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatProactiveAction.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatProactiveAction.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatProactiveAction=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chatProactiveAction will be deleted.").ariaLabel("Delete ChatProactiveAction").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.chatProactiveAction.delete({id:g.chatProactiveAction.id}).$promise.then(function(){_.remove(g.proactive,{id:g.chatProactiveAction.id}),o.success({title:"ChatProactiveAction properly deleted!",msg:(g.chatProactiveAction.name||"chatProactiveAction")+" has been deleted!"}),v(g.chatProactiveAction)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatProactiveAction.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatProactiveAction.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","proactive","chatProactiveAction","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatProactiveActionDialogController",e)}(),function(){"use strict";function e(e){var n=this;n.chatWebsite={},n.init=function(e){n.chatWebsite=e,n.start="\n\x3c!-- START Motion Chat Script --\x3e",n.script='\n    <script src="'+n.chatWebsite.remote+"/api/chat/websites/"+n.chatWebsite.id+"/snippet?token="+n.chatWebsite.token+'"><\/script>',n.end="\n\x3c!-- START Motion Chat Script --\x3e"},n.info={},e.$watch("vm_ac.chatWebsite.remote",function(e){n.script='\n    <script src="'+n.chatWebsite.remote+"/api/chat/websites/"+n.chatWebsite.id+"/snippet?token="+n.chatWebsite.token+'"><\/script>'})}e.$inject=["$scope"],angular.module("app.chat").controller("ChatWebsiteScriptController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/system_avatar".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsitesystemAvatarController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.chatWebsite=c||e.params.chatWebsite||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.agentadddialog=function(e,n){t.show({controller:"ChatWebsiteagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatWebsite:e,chatWebsites:p.chatWebsites?p.chatWebsites.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoChatWebsites=function(){e.go("app.chat.chatWebsites",{},{reload:"app.chat.chatWebsites"})},p.saveChatWebsite=function(){r.chatWebsite.update({id:p.chatWebsite.id},p.chatWebsite).$promise.then(function(){l.success({title:"ChatWebsite updated!",msg:p.chatWebsite.name?p.chatWebsite.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.chatWebsite&&(t=_.find(p.lists,{id:Number(p.chatWebsite.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.chatWebsite&&(a=_.find(p.lists,{id:Number(p.chatWebsite.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){p.interval=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){p.interval=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.interval,{id:e.resourceId})}),t=null;if(p.chatWebsite&&(t=_.find(p.interval,{id:Number(p.chatWebsite.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.interval,{id:t.id});a.canSelect=!1,n.push(a)}p.interval=n})}else{var t=[],a=null;p.chatWebsite&&(a=_.find(p.interval,{id:Number(p.chatWebsite.IntervalId)}));for(var i=0;i<p.interval.length;i++)a&&p.interval[i].id===a.id&&(p.interval[i].canSelect=!1,t.push(p.interval[i]));p.interval=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","chatWebsite","userProfile","userProfileSection"],angular.module("app.chat").controller("ChatWebsiteController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=["loggedIn","available","waiting","paused"],g=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"ChatQueues":void 0,channel:"chat",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("CHAT.CHATQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditChatQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatQueue:n,chatQueues:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatQueue:n,chatQueues:u.queues.rows,realtime:!1,crudPermissions:u.crudPermissions}})},r.on("chat_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,p))}),r.on("userChatQueue:save",function(e){var n=_.find(u.queues.rows,["id",e.ChatQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("userChatQueue:remove",function(e){var n=_.find(u.queues.rows,["id",e.ChatQueueId]);n&&(0<n.loggedInDb&&n.loggedInDb--,_.remove(n.agents,["id",e.UserId]))}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"chat")})}),e.$on("$destroy",function(){r.removeAllListeners("chat_queue:save"),r.removeAllListeners("userChatQueue:remove"),r.removeAllListeners("userChatQueue:save"),r.removeAllListeners("user:update"),g&&n.cancel(g)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.chat").controller("QueuesChatRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.chat.realtime.agents":this.selectedTab=0;break;case"app.chat.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.chat.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.chat.realtime.agents");break;case 1:t.go("app.chat.realtime.queues");break;default:t.go("app.chat.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.chat").controller("ChatRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.companies=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="companies",f.listOrder="",f.listOrderAsc=null,f.selectedCompanies=[],f.query={fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){a.go("app.contactmanager.companies.edit",{id:e.id,company:e,crudPermissions:f.crudPermissions})},f.gotocontactsgoto=function(t,e){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{CompanyId:t.id}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{CompanyId:t.id})}},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("company")+"?").htmlContent("<b>"+(e.name||"company")+"</b> will be deleted.").ariaLabel("delete company").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getCompanies=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cmCompany.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Companies",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditCompany=function(e,n){i.show({controller:"CreateOrEditCompanyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/companies/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{company:n,companies:f.companies.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteCompany=y,f.exportSelectedCompanies=function(){var e=angular.copy(f.selectedCompanies);return f.selectedCompanies=[],e},f.deleteSelectedCompanies=function(e){var n=i.confirm().title("Are you sure want to delete the selected companies?").htmlContent("<b>"+f.selectedCompanies.length+" selected</b> will be deleted.").ariaLabel("delete Companys").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedCompanies.forEach(function(e){y(e)}),f.selectedCompanies=[]})},f.deselectCompanies=function(){f.selectedCompanies=[]},f.selectAllCompanies=function(){f.selectedCompanies=f.companies.rows};var b=!0,A=1;function E(e){f.companies=e||{count:0,rows:[]}}function y(e){m.cmCompany.delete({id:e.id}).$promise.then(function(){_.remove(f.companies.rows,{id:e.id}),f.companies.count-=1,f.companies.rows.length||f.getCompanies(),p.success({title:_.startCase("Company")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmCompany"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcmCompany",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getCompanies())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","companies","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.contactmanager").controller("CompaniesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_COMPANY",g.company=angular.copy(l),g.companies=r,g.newCompany=!1,g.company||(g.company={},g.title="CONTACTMANAGER.NEW_COMPANY",g.newCompany=!0),g.addNewCompany=function(){g.errors=[],d.cmCompany.save(g.company).$promise.then(function(e){g.companies.unshift(e.toJSON()),o.success({title:"Company properly created",msg:g.company.name?g.company.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCompany.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCompany.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCompany=function(){g.errors=[],d.cmCompany.update({id:g.company.id},g.company).$promise.then(function(e){var n=_.find(g.companies,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Company properly saved!",msg:g.company.name?g.company.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCompany.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCompany.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCompany=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The company will be deleted.").ariaLabel("Delete Company").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmCompany.delete({id:g.company.id}).$promise.then(function(){_.remove(g.companies,{id:g.company.id}),o.success({title:"Company properly deleted!",msg:(g.company.name||"company")+" has been deleted!"}),v(g.company)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCompany.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCompany.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","companies","company","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditCompanyDialogController",e)}(),function(){"use strict";function e(a,e,n,t,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.company=c||a.params.company||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=a.params.tab||0,u.gotogoto=function(t,e){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{CompanyId:t.id}):l.info({title:i.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:i.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{CompanyId:t.id})}},u.alert=l.info,u.gotoCompanies=function(){a.go("app.contactmanager.companies",{},{reload:"app.contactmanager.companies"})},u.saveCompany=function(){r.cmCompany.update({id:u.company.id},u.company).$promise.then(function(){l.success({title:"Company updated!",msg:u.company.name?u.company.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmCompany",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","company","userProfileSection"],angular.module("app.contactmanager").controller("CompanyController",e)}(),function(){"use strict";function e(n,i,t,a,e,s,o,r,l,d,c,m,u,p,g,v,h,f,b){var A=this;A.currentUser=f.getCurrentUser(),A.license=b,A.userProfile=r,A.userProfileSection=l&&1==l.count?l.rows[0]:null,A.crudPermissions=f.parseCrudPermissions(A.userProfileSection?A.userProfileSection.crudPermissions:null);var E=60,y=1024*E*1024;A.ngFlowOptions={target:"api/cm/contacts/upload",singleFile:!0,maxChunkRetries:1,chunkSize:y,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},A.contacts=c||{count:0,rows:[]},A.options={hidden:!1,hover:!1,isOpen:!1},A.table="cm_contacts",A.selectedContacts=[],A.lists=m||{rows:[],count:0},A.companies=p||{rows:[],count:0},A.tags=v||{rows:[],count:0},A.listsMap=u,A.companiesMap=g,A.selectedTags=[],A.selectedList=null,A.selectedCompany=null,A.query=_.merge({includeAll:!0,sort:"-updatedAt",limit:10,offset:0,page:1},e),A.editdialog=function(e,n){a.go("app.contactmanager.contacts.edit",{id:e.id,crudPermissions:A.crudPermissions})},A.deleteconfirm=function(e,n){var t=s.confirm().title("Are you sure want to delete the contact?").htmlContent("<b>"+(e.firstName||e.email||e.phone||"Contact")+"</b> will be deleted.").ariaLabel("delete contact").targetEvent(n).ok("OK").cancel("CANCEL");s.show(t).then(function(){O(e)})},A.success=I,A.getContacts=function(){A.query.offset=(A.query.page-1)*A.query.limit,f.hasRole("admin")?A.promise=d.cmContact.get(A.query,I).$promise:(A.query.id=A.userProfile.id,A.query.ListId=A.query.ListId?A.query.ListId:_.map(A.lists.rows,"id"),A.query.CompanyId=A.query.CompanyId?A.query.CompanyId:_(A.companies.rows).filter({canSelect:void 0}).map("id").value(),A.query.section="Contacts",A.promise=d.userProfile.getResources(A.query,I).$promise)},A.getAssignedCompanies=function(){if(!f.hasRole("admin")){var e=_(A.contacts.rows).map(function(e){return{id:e.CompanyId}}).uniqBy("id").filter(function(e){return e.id&&0<e.id}).pullAllBy(A.companies.rows,"id").value();if(!_.isEmpty(e)){var n=[];e.forEach(function(e){n.push(d.cmCompany.get({id:e.id,fields:"id,name"}).$promise)}),o.all(n).then(function(e){e.forEach(function(e){var n=e.toJSON();n.canSelect=!1,A.companies.rows.push(n);var t={};t[n.id]=n.name,A.companiesMap=_.assignIn(A.companiesMap,t)})}).catch(function(e){h.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_COMPANY",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}}},A.mergeContact=function(e,n){s.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",nolimit:!0})}]},locals:{contacts:A.contacts.rows}})},A.duplicateContact=function(e,n){s.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",nolimit:!0})}]},locals:{contacts:A.contacts.rows}})},A.createOrEditContact=function(e,n){n&&n.dateOfBirth&&(n.dateOfBirth=new Date(n.dateOfBirth));s.show({controller:"CreateOrEditContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{ListId:A.query.ListId||a.params.ListId,CompanyId:A.query.CompanyId||a.params.CompanyId,contact:n,contacts:A.contacts.rows,companies:A.companies,lists:A.lists,setting:null,crudPermissions:A.crudPermissions}})},A.deleteContact=O,A.exportSelectedContacts=function(){var e=angular.copy(A.selectedContacts);return A.selectedContacts=[],e},A.deleteSelectedContacts=function(e){var n=s.confirm().title("Are you sure want to delete the selected contacts?").htmlContent("<b>"+A.selectedContacts.length+" selected</b> will be deleted.").ariaLabel("delete Contacts").targetEvent(e).ok("OK").cancel("CANCEL");s.show(n).then(function(){A.selectedContacts.forEach(function(e){O(e)}),A.selectedContacts=[]})},A.deselectContacts=function(){A.selectedContacts=[]},A.selectAllContacts=function(){A.selectedContacts=A.contacts.rows},A.createTag=function(e){var n=s.prompt().title("What would you name your tag?").placeholder("Tag name").ariaLabel("Tag name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(function(e){if(e)return d.tag.save({name:e});h.error({title:"Error creating tag!",msg:"Invalid tag name."})}).then(function(e){e&&(A.tags.rows.push(e),h.success({title:"Tag properly created!",msg:e.tag?e.name+" has been created!":""}))})},A.createList=function(e){var n=s.prompt().title("What would you name your list?").placeholder("List name").ariaLabel("List name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(function(e){if(e)return d.cmList.save({name:e});h.error({title:"Error creating list!",msg:"Invalid list name."})}).then(function(e){e&&(A.lists.rows.push(e),h.success({title:"List properly created!",msg:e.name?e.name+" has been created!":""}))})},A.createCompany=function(e){var n=s.prompt().title("What would you name your company?").placeholder("Company name").ariaLabel("Company name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(function(e){if(e)return d.cmCompany.save({name:e});h.error({title:"Error creating company!",msg:"Invalid company name."})}).then(function(e){e&&(A.companies.rows.push(e),h.success({title:"Company properly created!",msg:e.name?e.name+" has been created!":""}))})},A.importContacts=function(e,n,t){var a=JSON.parse(n);s.show({controller:"ImportContactsDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/import/import.html",parent:angular.element(i.body),clickOutsideToClose:!1,locals:{lists:m,companies:p,file:a.file,fields:a.fields,license:A.license}}).then(function(){A.getContacts()}).catch(function(e){console.error()})},A.importContactsUpdates=function(e,n,t){var a=JSON.parse(n);s.show({controller:"ImportContactsUpdatesDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/import/importUpdates.html",parent:angular.element(i.body),clickOutsideToClose:!1,locals:{lists:m,companies:p,file:a.file,fields:a.fields,license:A.license}}).then(function(){A.getContacts()}).catch(function(e){console.error()})},A.hasPermission=function(){return f.hasPermission(303)||f.hasRole("admin")},A.fileAdded=function(e){var n=["csv"];if(!_.includes(n,e.getExtension()))return h.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(e.size>y)return h.error({title:"File too big",msg:"The max allowed size is "+E+"MB"}),!1;return!0},a.params.ListId&&(A.selectedList=a.params.ListId),a.params.CompanyId&&(A.selectedCompany=a.params.CompanyId),n.$watch("vm.options.isOpen",function(e){e?t(function(){n.tooltipVisible=A.options.isOpen},600):n.tooltipVisible=A.options.isOpen});var S=!0,T=1;function I(e){A.contacts=e||{count:0,rows:[]}}function O(e){d.cmContact.delete({id:e.id}).$promise.then(function(){_.remove(A.contacts.rows,{id:e.id}),A.contacts.count-=1,A.contacts.rows.length||A.getContacts(),h.success({title:"Contact deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){A.errors=e.data.errors||[{message:e.toString(),type:"api.contact.delete"}];for(var n=0;n<e.data.errors.length;n++)h.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else h.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}n.$watch("vm.query.filter",function(e,n){S?t(function(){S=!1}):(n||(T=A.query.page),e!==n&&(A.query.page=1),e||(A.query.page=T),A.getContacts())},!0),n.$watch("vm.selectedList",function(e,n){e!==n&&(A.query.ListId=A.selectedList||void 0,A.getContacts())}),n.$watch("vm.selectedCompany",function(e,n){e!==n&&(A.query.CompanyId=A.selectedCompany||void 0,A.getContacts())}),n.$watch("vm.selectedTags",function(e,n){(e.length||n.length)&&A.getContacts()})}e.$inject=["$scope","$document","$timeout","$state","$stateParams","$mdDialog","$q","userProfile","userProfileSection","api","contacts","lists","listsMap","companies","companiesMap","tags","toasty","Auth","license"],angular.module("app.contactmanager").controller("ContactsController",e)}(),function(){"use strict";function e(t,e,a,n,i,s,o,r,l,d,c){var m=this;if(m.errors=[],m.title="CONTACTMANAGER.EDIT_CONTACT",m.crudPermissions=c,m.contact=angular.copy(o),m.additionalItemTypes=[],m.additionalItems=[],m.contacts=n||{rows:[],count:0},m.lists=i||{rows:[],count:0},m.companies=s||{rows:[],count:0},m.customFields={rows:[],count:0},m.newContact=!1,m.newPhone=function(e){return{phone:e,color:"gray"}},m.contactItemTypes=[],m.contact)delete m.contact.List,f(m.contact.ListId),d.cmContact.getAdditionalPhones({id:o.id}).$promise.then(function(e){var n=_.map(e,"item"),t=_.map(e,"description");m.additionalItemTypes=_.map(e,"ItemTypeId");var a=_.map(e,"ItemType.rgbBackgroundColor"),i=_.map(e,"ItemType.name");m.additionalItems=[];for(var s=0;s<n.length;s++)m.additionalItems.push({phone:n[s],type:i[s],color:a[s],description:t[s]})}).catch(function(e){console.log(e)});else{m.contact={ListId:r?parseInt(r,10):void 0,CompanyId:l?parseInt(l,10):void 0};var u=_.map(m.contact.Phones,"item"),p=_.map(m.contact.Phones,"description");m.additionalItemTypes=_.map(m.contact.Phones,"ItemTypeId");var g=_.map(m.contact.Phones,"ItemType.rgbBackgroundColor"),v=_.map(m.contact.Phones,"ItemType.name");m.additionalItems=[];for(var h=0;h<u.length;h++)m.additionalItems.push({phone:u[h],type:v[h],color:g[h],description:p[h]});m.title="CONTACTMANAGER.NEW_CONTACT",m.newContact=!0,b()}function f(e){if(e)return d.cmList.getCustomFields({id:e}).$promise.then(function(e){if(e){m.customFields=e;var n=_.map(m.customFields.rows,function(e){return"cf_"+e.id});return d.cmContact.get({id:m.contact.id,attributes:n,raw:!0}).$promise.then(function(e){m.contact=_.merge(m.contact,e)})}}).then(function(){m.customFields.rows.forEach(function(e){"datetime"===e.type&&m.contact["cf_"+e.id]&&(m.contact["cf_"+e.id]=A(m.contact["cf_"+e.id]))}),Object.keys(m.contact).forEach(function(e){if(_.startsWith(e,"cf_")){var n=e.split("_")[1];_.some(m.customFields.rows,["id",Number(n)])||delete m.contact["cf_"+n]}})}).catch(function(e){console.error(e)});m.customFields={rows:[],count:0}}function b(){return d.cmList.getGlobalCustomFields().$promise.then(function(e){if(e){m.customFields=e;_.map(m.customFields.rows,function(e){return"cf_"+e.id})}else;}).catch(function(e){console.error(e)})}function A(e){return null===e?void 0:new Date(e)}function E(){t.hide()}d.contactItemType.get({fields:"id,name,rgbBackgroundColor"}).$promise.then(function(e){m.contactItemTypes=e.rows}),m.addNewContact=function(){m.errors=[],d.cmContact.save(m.contact).$promise.then(function(e){m.contacts.unshift(e),d.cmContact.setAdditionalPhones({id:e.id,items:m.additionalItems,item_types:m.additionalItemTypes}).$promise.then(function(){a.success({title:"Contact properly created",msg:m.contact.name?m.contact.name+" has been created!":""}),E()})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contacts.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveContact=function(){m.errors=[],d.cmContact.update({id:m.contact.id},m.contact).$promise.then(function(e){var n=_.find(m.contacts,{id:e.id});n&&_.merge(n,e)}).then(function(){return d.cmContact.setAdditionalPhones({id:o.id,items:m.additionalItems,item_types:m.additionalItemTypes}).$promise.then(function(){a.success({title:"Contact properly saved!",msg:m.contact.name?m.contact.name+" has been saved!":""}),E()})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.contact.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteContact=function(e){m.errors=[];var n=t.confirm().title("Are you sure?").content("The contact will be deleted.").ariaLabel("Delete Contact").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){d.cmContact.delete({id:m.contact.id}).$promise.then(function(){_.remove(m.contacts,{id:m.contact.id}),a.success({title:"Contact properly deleted!",msg:m.contact.name?m.contact.name+" has been deleted!":""}),E()}).catch(function(e){console.error(e),m.errors=e.data.errors||[{message:e.toString(),type:"api.contact.delete"}]})},function(){})},m.closeDialog=E,m.getCustomFields=f,m.getDateFromString=A,e.$watch("vm.contact.ListId",function(e,n){_.isNil(e)&&b()})}e.$inject=["$mdDialog","$scope","toasty","contacts","lists","companies","contact","ListId","CompanyId","api","crudPermissions"],angular.module("app.tools").controller("CreateOrEditContactDialogController",e).directive("customChip",function(){return{restrict:"A",scope:!1,link:function(e,n,t){n.parent().parent().css("background",e.$chip.color)}}})}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this;function r(){e.hide()}o.errors=[],o.title="CONTACTMANAGER.COPY_CONTACT",o.contact=angular.copy(n),o.lists=i||{rows:[],count:0},o.addNewContact=function(){o.errors=[];var n=o.contact.id;delete o.contact.id,o.contact.tags&&!o.contact.tags.length&&delete o.contact.tags;s.cmContact.save(o.contact).$promise.then(function(e){return a.unshift(e),s.cmContact.duplicateAdditionalPhones({id:n,fromContactId:n,toContactId:e.id}).$promise.then(function(){t.success({title:"Contact properly created",msg:o.contact.name?o.contact.name+" has been created!":""}),r()})}).catch(function(e){console.error(e),o.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}]})},o.closeDialog=r}e.$inject=["$mdDialog","toasty","contact","contacts","lists","api"],angular.module("app.tools").controller("DuplicateContactDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(e){a.hide(e)}d.errors=[],d.title="CONTACTMANAGER.EDIT_HOPPER",d.hopper=angular.copy(o),d.hoppers=s,d.newHopper=!1,d.crudPermissions=l,d.hopper||(d.hopper={},d.title="CONTACTMANAGER.NEW_HOPPER",d.newHopper=!0),d.saveHopper=function(){d.errors=[],r.cmHopper.update({id:d.hopper.id},d.hopper).$promise.then(function(e){var n=_.find(d.hoppers,{id:e.id});n&&_.merge(n,e),i.success({title:"Hopper properly saved!",msg:d.hopper.name?d.hopper.name+" has been saved!":""}),c(e)}).catch(function(e){console.error(e),d.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}]})},d.getDateFromString=function(e){return null===e?void 0:new Date(e)},d.closeDialog=c}e.$inject=["$scope","$state","$location","$mdDialog","toasty","hoppers","hopper","api","crudPermissions"],angular.module("app.contactmanager.contacts").controller("EditHopperDialogController",e)}(),function(){"use strict";function e(a,t,e,i,s,n,o,r,l,d,c,m,u,p,g,v,h,f,b,A,E,y){var S=this;function T(n){return function(e){S[n]=e||{count:0,rows:[]}}}function I(){S.queryHopper.offset=(S.queryHopper.page-1)*S.queryHopper.limit,S.queryHopper.id=S.contact.id,S.promise=r.cmContact.getHoppers(S.queryHopper,T("hoppers")).$promise}function O(){S.queryFinal.offset=(S.queryFinal.page-1)*S.queryFinal.limit,S.queryFinal.id=S.contact.id,S.promise=r.cmContact.getHopperFinals(S.queryFinal,T("finals")).$promise}function C(){S.queryHistory.offset=(S.queryHistory.page-1)*S.queryHistory.limit,S.queryHistory.id=S.contact.id,S.promise=r.cmContact.getHopperHistories(S.queryHistory,T("histories")).$promise}function w(e){S.journeyIsLoading=!0;var n=_.merge(S.journeyOptions,{id:S.contact.id,offset:e||0});return y.get(S.journey,n).then(function(e){S.journey=e.journey,S.canLoadMoreJourney=e.loadMore}).finally(function(){S.journeyIsLoading=!1})}S.currentUser=A.getCurrentUser(),S.license=b,S.journey=[],S.contact=l||{},S.hoppers=d||{rows:[],count:0},S.finals=c||{rows:[],count:0},S.histories=m||{rows:[],count:0},S.companies=p||{rows:[],count:0},S.lists=g||{rows:[],count:0},S.customFields=v||{rows:[],count:0},S.tags=h||{rows:[],count:0},S.jscriptySessions=f||{rows:[],count:0},S.journeyOptions=y.getQuery(),S.quickFilters=y.getQuickFilters(),S.journeyTimelineOptions={scrollEl:"#journey-content"},S.additionalItems=[],S.additionalItemTypes=[],S.contactItemTypes=[],S.firstDayMonth=new Date(moment().startOf("month").subtract(1,"seconds").utcOffset(0,!0).format()),S.lastDayMonth=new Date(moment().endOf("month").subtract(1,"day").utcOffset(0,!0).format()),S.userProfileSection=E&&1==E.count?E.rows[0]:null,S.crudPermissions=A.parseCrudPermissions(S.userProfileSection?S.userProfileSection.crudPermissions:null),S.arraypriority=_.keyBy([{option:"Highest",value:"'4'"},{option:"High",value:"'3'"},{option:"Medium",value:"'2'"},{option:"Low",value:"'1'"},{option:"Lowest",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),S.queryHopper={fields:"id,phone,scheduledat,priority,recallme,VoiceQueueId,CampaignId,UserId",sort:"-updatedAt",limit:10,page:1},S.queryFinal={fields:"id,uniqueid,calleridnum,statedesc,starttime,disposition",sort:"-id",limit:10,page:1},S.queryHistory={fields:"id,uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-id",limit:10,page:1},S.queryJscriptySession={fields:"id,starttime,endtime,membername,projectname",sort:"-starttime",limit:10,page:1},S.selectedTab=e.params.tab||0,S.onInit=function(){A.hasRole("admin")||(function(){if(!_.some(S.companies.rows,{id:S.contact.CompanyId}))r.cmCompany.get({id:S.contact.CompanyId,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,S.companies.rows.push(n)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_COMPANY",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}(),function(){var e=_.map(S.contact.Tags,function(e){return{id:e.id,name:e.name}});if(!_.isEmpty(e))for(var n=0;n<e.length;n++)_.some(S.tags.rows,{id:e.id})||(e[n].canSelect=!1,S.tags.rows.push(e[n]))}());return r.user.get({fields:"id,fullname",nolimit:!0}).$promise.then(function(e){S.users=e||{count:0,rows:[]},S.usersMap=_.mapValues(_.keyBy(S.users.rows,"id"),"fullname"),S.Tags=_.map(S.contact.Tags,"id");var n=_.map(S.contact.Phones,"item"),t=_.map(S.contact.Phones,"description");S.additionalItemTypes=_.map(S.contact.Phones,"ItemTypeId");var a=_.map(S.contact.Phones,"ItemType.rgbBackgroundColor"),i=_.map(S.contact.Phones,"ItemType.name"),s=_.map(S.contact.Phones,"ItemType.id");S.additionalItems=[];for(var o=0;o<n.length;o++)S.additionalItems.push({phone:n[o],type:i[o],ItemTypeId:s[o],color:a[o],description:t[o]})}).then(function(e){r.contactItemType.get({fields:"id,name,rgbBackgroundColor"}).$promise.then(function(e){S.contactItemTypes=e.rows})}).finally(function(){S.contact&&w()})},S.gotoContacts=function(){e.go("app.contactmanager.contacts",{},{reload:!0,notify:!0})},S.duplicateContact=function(e){s.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,resolve:{lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name"}):e.resolve("userProfile@getResources",{id:S.currentUser.userProfileId,section:"Lists",fields:"id,name"})}]},locals:{contacts:u.rows,contact:l}})},S.saveContact=function(){r.cmContact.update({id:S.contact.id},S.contact).$promise.then(function(){o.success({title:"Contact updated!",msg:S.contact.name?S.contact.name+" has been updated!":""})}).then(function(){return r.cmContact.setTags({id:S.contact.id,ids:S.Tags}).$promise}).then(function(){return r.cmContact.setAdditionalPhones({id:S.contact.id,items:S.additionalItems}).$promise}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEcontact",msg:e.data?JSON.stringify(e.data):e.toString()})})},S.editCompany=function(e,n){var t=_.find(S.companies.rows,{id:n});s.show({controller:"CreateOrEditCompanyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/companies/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{companies:[],license:null,setting:null,crudPermissions:!1===t.canSelect?{readOnly:!0,canEdit:!1,canDelete:!1}:r.userProfileSection.get({userProfileId:S.currentUser.userProfileId,sectionId:302}).$promise.then(function(e){var n=e.rows?e.rows[0]:null;return A.parseCrudPermissions(n?n.crudPermissions:null)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"API:GET_COMPANY_SECTION",msg:e.data?JSON.stringify(e.data):e.toString()})})},resolve:{company:["apiResolver",function(e){return e.resolve("cmCompany@get",{id:n})}]}})},S.onSelectList=function(e){if(S.contact.ListId){var n=s.confirm().title("You are selecting the list number: "+S.contact.ListId).textContent("Warning! You won't select a different list for the contact "+S.contact.firstName||S.contact.lastName||S.contact.id).targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(S.onSelectListSuccess).catch(function(){S.contact.ListId=null})}},S.onSelectListSuccess=function(){return r.cmList.getCustomFields({id:S.contact.ListId}).$promise.then(function(e){S.customFields=e||{rows:[],count:0}}).catch(function(e){console.error(e)})},S.getDateFromString=function(e){return null===e?void 0:new Date(e)},S.getHoppers=I,S.getFinals=O,S.getHistories=C,S.getJscriptySessions=function(){S.queryJscriptySession.offset=(S.queryJscriptySession.page-1)*S.queryJscriptySession.limit,S.queryJscriptySession.id=S.contact.id,S.promise=r.cmContact.getJscriptySessions(S.queryJscriptySession,T("jscriptySessions")).$promise},S.deleteconfirm=function(n,e){var t=s.confirm().title("Are you sure want to delete the agent?").htmlContent("<b>"+(n.phone||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){var e;e=n,r.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(S.hoppers.rows,{id:e.id}),S.hoppers.count--,S.hoppers.rows.length||S.getHoppers(),o.success({title:"Hopper deleted!",msg:e.phone?e.phone+" has been deleted!":""})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEhopper",msg:e.data?JSON.stringify(e.data):e.toString()})})},function(){console.log("CANCEL")})},S.editHopper=function(e,n){s.show({controller:"HopperdateController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopper:n,hoppers:S.hoppers.rows,license:null,setting:null,crudPermissions:S.crudPermissions}})},S.createOrEditIvrCampaignHopper=function(e,n){s.show({controller:"CreateOrEditHopperCampaignIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hoppers/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopper:n,hoppers:S.hoppers.rows,license:null,setting:null,crudPermissions:S.crudPermissions}})},S.newPhone=function(e){return{phone:e,color:"gray"}},S.getCustomerJourney=w,S.loadMoreJourney=function(){return n(function(e,n){var t=S.journey.length;return e(w(t))})},S.moveUp=function(e){N(e,e-1)},S.moveDown=function(e){N(e,e+1)};var R=!0,x=1;function N(e,n){var t=S.additionalItems[n];S.additionalItems[n]=S.additionalItems[e],S.additionalItems[e]=t,a.additionalPhonesForm.$setDirty()}a.$watch("vm.queryHopper.filter",function(e,n){R?t(function(){R=!1}):(n||(x=S.queryHopper.page),e!==n&&(S.queryHopper.page=1),e||(S.queryHopper.page=x),I())}),a.$watch("vm.queryFinal.filter",function(e,n){R?t(function(){R=!1}):(n||(x=S.queryFinal.page),e!==n&&(S.queryFinal.page=1),e||(S.queryFinal.page=x),O())}),a.$watch("vm.queryHistory.filter",function(e,n){R?t(function(){R=!1}):(n||(x=S.queryHistory.page),e!==n&&(S.queryHistory.page=1),e||(S.queryHistory.page=x),C())})}e.$inject=["$scope","$timeout","$state","$document","$mdDialog","$q","toasty","api","contact","hoppers","finals","histories","contacts","companies","lists","customFields","tags","jscriptySessions","license","Auth","userProfileSection","customerJourneyManager"],angular.module("app.contactmanager.contacts").controller("ContactController",e).directive("customChip",function(){return{restrict:"A",scope:!1,link:function(e,n,t){n.parent().parent().css("background",e.$chip.color)}}})}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;g.processing=!1,g.stopping=!0,g.license=p,g.pid=0,g.result={finish:!1,rows:0,affectedRows:0,failedRows:0,duplicatedRows:0,errors:[]},g.contactFields=[{key:"firstName",required:!0},{key:"lastName",required:!1},{key:"phone",required:!0},{key:"mobile",required:!1},{key:"email",required:!1},{key:"dateOfBirth",required:!1},{key:"country",required:!1},{key:"city",required:!1},{key:"street",required:!1},{key:"postalCode",required:!1},{key:"fax",required:!1}],g.motionBullFields=[{key:"UserId",required:!1},{key:"scheduledat",required:!1},{key:"priority",required:!1},{key:"dialTimezone",required:!1}],g.contactItemTypes=[],l.contactItemType.get({fields:"id,name,orderBy"}).$promise.then(function(e){var n=e.rows;console.log(n);for(var t=0;t<n.length;t++)g.contactItemTypes.push({key:n[t].name,required:!1})}),g.binding={},g.duplicate=[],g.lists=s||{rows:[],count:0},g.companies=o||{rows:[],count:0},g.customFields={rows:[],count:0},g.fields=u||[],g.closeDialog=function(){d.removeAllListeners("contact:import:"+v),n.hide()},g.onChangeList=function(){return l.cmList.getCustomFields({id:g.ListId}).$promise.then(function(e){g.customFields=e}).catch(function(e){console.error(e)})},g.uploadCsv=function(){g.processing=moment(),l.cmContact.import({id:m.filename,binding:g.binding,ListId:g.ListId,CompanyId:g.CompanyId,duplicates:g.duplicates,socket_timestamp:v}).$promise.then(function(e){g.stopping=!1,e&&e.pid&&(g.pid=e.pid)}).catch(function(e){g.processing=!1,r.error({title:"Import process failed!",msg:"Please retry with a new file"})})},g.getHeaderErrors=function(){var e=u;return e.push("contact_import_error"),e},g.getArrayErrors=function(){for(var e=[],n=0;n<g.result.errors.length;n+=1){var t=g.result.errors[n].row;t.contact_import_error=g.result.errors[n].message,e.push(t)}return e},g.stopUpload=function(){if(g.stopping=!0,g.pid)return l.system.killProcess({pid:g.pid}).$promise.then(function(e){r.success({title:"CSV import process stopped!",msg:"Import has been stopped!"})}).catch(function(e){r.error({title:"CSV stop import process failed!",msg:"pid is unknown"})})};var v=moment().unix();d.on("contact:import:"+v,function(t){i(function(){if(g.result.rows=t.rows,t.errors)for(var e=0;e<t.errors.length;e++)g.result.errors.push(t.errors[e]);if(t.finish){g.result.finish=!0,g.result.affectedRows=t.affectedRows,g.result.failedRows=g.result.errors.length;var n=g.result.rows-g.result.affectedRows-g.result.errors.length;n&&0<n&&(g.duplicates.length?g.result.duplicatedRows=n:g.result.failedRows+=n),g.result.elapsed=moment().diff(g.processing,"seconds")}})}),c.$on("$destroy",function(){d.removeAllListeners("contact:import:"+v)})}e.$inject=["$cookies","$mdDialog","$interval","$q","$timeout","lists","companies","toasty","api","socket","$scope","file","fields","license"],angular.module("app.tools").controller("ImportContactsDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;g.processing=!1,g.stopping=!0,g.license=p,g.pid=0,g.result={finish:!1,rows:0,affectedRows:0,failedRows:0,duplicatedRows:0,errors:[]},g.contactFields=[{key:"id",required:!0},{key:"firstName",required:!1},{key:"lastName",required:!1},{key:"phone",required:!0},{key:"mobile",required:!1},{key:"email",required:!1},{key:"dateOfBirth",required:!1},{key:"country",required:!1},{key:"city",required:!1},{key:"street",required:!1},{key:"postalCode",required:!1},{key:"fax",required:!1}],g.motionBullFields=[{key:"UserId",required:!1},{key:"scheduledat",required:!1},{key:"priority",required:!1}],g.contactItemTypes=[],l.contactItemType.get({fields:"id,name,orderBy"}).$promise.then(function(e){for(var n=e.rows,t=0;t<n.length;t++)g.contactItemTypes.push({key:n[t].name,required:!1})}),g.binding={},g.duplicate=[],g.lists=s||{rows:[],count:0},g.companies=o||{rows:[],count:0},g.customFields={rows:[],count:0},g.fields=u||[],g.closeDialog=function(){d.removeAllListeners("contact:import:"+v),n.hide()},g.onChangeList=function(){return l.cmList.getCustomFields({id:g.ListId}).$promise.then(function(e){g.customFields=e}).catch(function(e){console.error(e)})},g.uploadCsv=function(){g.processing=moment(),l.cmContact.importUpdates({id:m.filename,binding:g.binding,ListId:g.ListId,CompanyId:g.CompanyId,duplicates:g.duplicates,socket_timestamp:v}).$promise.then(function(e){g.stopping=!1,e&&e.pid&&(g.pid=e.pid)}).catch(function(e){g.processing=!1,r.error({title:"Import process failed!",msg:"Please retry with a new file"})})},g.getHeaderErrors=function(){var e=u;return e.push("contact_import_error"),e},g.getArrayErrors=function(){for(var e=[],n=0;n<g.result.errors.length;n+=1){var t=g.result.errors[n].row;t.contact_import_error=g.result.errors[n].message,e.push(t)}return e},g.stopUpload=function(){if(g.stopping=!0,g.pid)return l.system.killProcess({pid:g.pid}).$promise.then(function(e){r.success({title:"CSV import process stopped!",msg:"Import has been stopped!"})}).catch(function(e){r.error({title:"CSV stop import process failed!",msg:"pid is unknown"})})};var v=moment().unix();d.on("contact:import:"+v,function(t){i(function(){if(g.result.rows=t.rows,t.errors)for(var e=0;e<t.errors.length;e++)g.result.errors.push(t.errors[e]);if(t.finish){g.result.finish=!0,g.result.affectedRows=t.affectedRows,g.result.failedRows=g.result.errors.length;var n=g.result.rows-g.result.affectedRows-g.result.errors.length;n&&0<n&&(g.duplicates.length?g.result.duplicatedRows=n:g.result.failedRows+=n),g.result.elapsed=moment().diff(g.processing,"seconds")}})}),c.$on("$destroy",function(){d.removeAllListeners("contact:import:"+v)})}e.$inject=["$cookies","$mdDialog","$interval","$q","$timeout","lists","companies","toasty","api","socket","$scope","file","fields","license"],angular.module("app.tools").controller("ImportContactsUpdatesDialogController",e)}(),function(){"use strict";function e(i,e,s,n,o,t,r){var a=this;a.errors=[],a.title="CONTACTMANAGER.MERGE_CONTACT",a.contact=angular.copy(n),a.lists=t||[],a.change=function(){a.searchTerm?r.cmContact.get({fields:"id,firstName,lastName,phone,email",filter:a.searchTerm,ListId:n.ListId}).$promise.then(function(e){a.contacts=e.rows}).catch(function(e){console.error(e)}):a.contacts=[]},a.showConfirm=function(e,n,t){var a=i.confirm({skipHide:!0}).title("Would you like to merge your contacs?").textContent("All unfilled values of the contact #"+t.id+" will be overwritten by the fields of the contact #"+n.id+".").targetEvent(e).ok("Ok").cancel("Cancel");i.show(a).then(function(){return r.cmContact.merge({to:t.id,from:n.id}).$promise}).then(function(e){i.hide({new:e,to:t,from:n}),_.remove(o,{id:t.id}),_.remove(o,{id:n.id}),o.unshift(e)}).then(function(){s.success({title:"Contact properly merged!"})}).catch(function(e){e&&e.status&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:MERGE_CONTACT",msg:e.data?JSON.stringify(e.data):e.toString()})})},a.closeDialog=function(){i.hide()}}e.$inject=["$mdDialog","$scope","toasty","contact","contacts","lists","api"],angular.module("app.tools").controller("MergeContactDialogController",e)}(),function(){"use strict";function e(a,e,n,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){t.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_GLOBALCUSTOMFIELD",g.sortable={animation:800,sort:!0,onSort:function(e){a.globalCustomFieldForm.$pristine=!1}},g.globalCustomField=l,g.globalCustomFields=r,g.newGlobalCustomField=!1,g.globalCustomField||(g.globalCustomField={type:"text",actionType:"voice"},g.title="CONTACTMANAGER.NEW_GLOBALCUSTOMFIELD",g.newGlobalCustomField=!0),a.$watch("vm.globalCustomField.type",function(e,n){if(e!==n)switch(e){case"text":g.globalCustomField.values="";break;case"select":g.globalCustomField.values=[]}}),g.addNewGlobalCustomField=function(){g.errors=[],d.cmCustomField.save(g.globalCustomField).$promise.then(function(e){g.globalCustomFields.unshift(e.toJSON()),o.success({title:"GlobalCustomField properly created",msg:g.globalCustomField.name?g.globalCustomField.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveGlobalCustomField=function(){g.errors=[],d.cmCustomField.update({id:g.globalCustomField.id},g.globalCustomField).$promise.then(function(e){var n=_.find(g.globalCustomFields,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"GlobalCustomField properly saved!",msg:g.globalCustomField.name?g.globalCustomField.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteGlobalCustomField=function(e){g.errors=[];var n=t.confirm().title("Are you sure?").content("The globalCustomField will be deleted.").ariaLabel("Delete GlobalCustomField").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){d.cmCustomField.delete({id:g.globalCustomField.id}).$promise.then(function(){_.remove(g.globalCustomFields,{id:g.globalCustomField.id}),o.success({title:"GlobalCustomField properly deleted!",msg:(g.globalCustomField.name||"globalCustomField")+" has been deleted!"}),v(g.globalCustomField)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.addItem=function(e){e.push({value:"New Item"}),a.globalCustomFieldForm.$pristine=!1},g.removeItem=function(e,n){e.splice(n,1),a.globalCustomFieldForm.$pristine=!1},g.removeItems=function(e){for(var n=e.length,t=0;t<n;t++)e.splice(0,1);a.globalCustomFieldForm.$pristine=!1},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","globalCustomFields","globalCustomField","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditGlobalCustomFieldDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.globalCustomFields=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="globalCustomFields",f.listOrder="",f.listOrderAsc=null,f.selectedGlobalCustomFields=[],f.query={fields:"createdAt,updatedAt,id,alias,type,values,required,clickToAction,actionType",sort:"-updatedAt",ListId:"null",limit:10,page:1},f.arraytype=_.keyBy([{option:"Text",value:"'text'"},{option:"Select",value:"'select'"},{option:"Number",value:"'number'"},{option:"Switch",value:"'switch'"},{option:"Datetime",value:"'datetime'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayactionType=_.keyBy([{option:"Voice",value:"'voice'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditGlobalCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/globalCustomFields/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{globalCustomField:e,globalCustomFields:f.globalCustomFields.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("globalCustomField")+"?").htmlContent("<b>"+(e.name||"globalCustomField")+"</b> will be deleted.").ariaLabel("delete globalCustomField").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getGlobalCustomFields=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cmCustomField.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="GlobalCustomFields",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditGlobalCustomField=function(e,n){i.show({controller:"CreateOrEditGlobalCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/globalCustomFields/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{globalCustomField:n,globalCustomFields:f.globalCustomFields.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteGlobalCustomField=y,f.exportSelectedGlobalCustomFields=function(){var e=angular.copy(f.selectedGlobalCustomFields);return f.selectedGlobalCustomFields=[],e},f.deleteSelectedGlobalCustomFields=function(e){var n=i.confirm().title("Are you sure want to delete the selected globalCustomFields?").htmlContent("<b>"+f.selectedGlobalCustomFields.length+" selected</b> will be deleted.").ariaLabel("delete GlobalCustomFields").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedGlobalCustomFields.forEach(function(e){y(e)}),f.selectedGlobalCustomFields=[]})},f.deselectGlobalCustomFields=function(){f.selectedGlobalCustomFields=[]},f.selectAllGlobalCustomFields=function(){f.selectedGlobalCustomFields=f.globalCustomFields.rows};var b=!0,A=1;function E(e){f.globalCustomFields=e||{count:0,rows:[]}}function y(e){m.cmCustomField.delete({id:e.id}).$promise.then(function(){_.remove(f.globalCustomFields.rows,{id:e.id}),f.globalCustomFields.count-=1,f.globalCustomFields.rows.length||f.getGlobalCustomFields(),p.success({title:_.startCase("GlobalCustomField")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmCustomField"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcmCustomField",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getGlobalCustomFields())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","globalCustomFields","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.contactmanager").controller("GlobalCustomFieldsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_LIST",g.list=angular.copy(l),g.lists=r,g.newList=!1,g.list||(g.list={},g.title="CONTACTMANAGER.NEW_LIST",g.newList=!0),g.addNewList=function(){g.errors=[],d.cmList.save(g.list).$promise.then(function(e){g.lists.unshift(e.toJSON()),o.success({title:"List properly created",msg:g.list.name?g.list.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmList.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveList=function(){g.errors=[],d.cmList.update({id:g.list.id},g.list).$promise.then(function(e){var n=_.find(g.lists,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"List properly saved!",msg:g.list.name?g.list.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmList.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteList=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The list will be deleted.").ariaLabel("Delete List").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmList.delete({id:g.list.id}).$promise.then(function(){_.remove(g.lists,{id:g.list.id}),o.success({title:"List properly deleted!",msg:(g.list.name||"list")+" has been deleted!"}),v(g.list)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmList.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","lists","list","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditListDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.cmList.getAgents({id:c.list.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserList?"penalty "+e.UserList.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.list=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.cmList.removeAgents({id:c.list.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.cmList.addAgents({id:c.list.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CONTACTMANAGER.ALL_AGENTS"),labelSelected:r.instant("CONTACTMANAGER.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","list","lists","realtime","$translate","Auth","crudPermissions"],angular.module("app.contactmanager").controller("ListagentaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.listCustomFields=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.cmList.getCustomFields(m.query,u).$promise}function g(e){d.cmCustomField.delete({id:e.id}).$promise.then(function(){_.remove(m.listCustomFields.rows,{id:e.id}),m.listCustomFields.count-=1,m.listCustomFields.rows.length||p(),l.success({title:"CustomField deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcmList"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.list={},m.listCustomFields={count:0,rows:[]},m.selectedListCustomFields=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,alias,type,values,required,clickToAction,actionType",limit:10,page:1},m.arraytype=_.keyBy([{option:"Text",value:"'text'"},{option:"Select",value:"'select'"},{option:"Number",value:"'number'"},{option:"Switch",value:"'switch'"},{option:"Datetime",value:"'datetime'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.arrayactionType=_.keyBy([{option:"Voice",value:"'voice'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n){m.list=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.ListId=m.list.id,m.query.id=m.list.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the customField?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("customField #")+e.id||"customField")+"</b> will be deleted.").ariaLabel("delete customField").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getListCustomFields=p,m.createOrEditListCustomField=function(e,n){o.show({controller:"CreateOrEditCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/customFields/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{list:m.list,customField:n,customFields:m.listCustomFields.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedListCustomFields=function(){var e=angular.copy(m.selectedListCustomFields);return m.selectedListCustomFields=[],e},m.deleteListCustomField=g,m.deleteSelectedListCustomFields=function(e){var n=o.confirm().title("Are you sure want to delete the selected customFields?").htmlContent("<b>"+m.selectedListCustomFields.length+" selected</b> will be deleted.").ariaLabel("delete customFields").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedListCustomFields.forEach(function(e){g(e)}),m.selectedListCustomFields=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.contactmanager").controller("ListCustomFieldsController",e)}(),function(){"use strict";function e(a,e,n,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){t.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_CUSTOMFIELD",g.sortable={animation:800,sort:!0,onSort:function(e){a.customFieldForm.$pristine=!1}},g.customField=l,g.customFields=r,g.newCustomField=!1,g.customField||(g.customField={type:"text",actionType:"voice"},g.title="CONTACTMANAGER.NEW_CUSTOMFIELD",g.newCustomField=!0),e.params.id&&(g.customField.ListId=e.params.id),a.$watch("vm.customField.type",function(e,n){if(e!==n)switch(e){case"text":g.customField.values="";break;case"select":g.customField.values=[]}}),g.addNewCustomField=function(){g.errors=[],d.cmList.addCustomField({id:e.params.id},g.customField).$promise.then(function(e){g.customFields.unshift(e.toJSON()),o.success({title:"CustomField properly created",msg:g.customField.name?g.customField.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCustomField=function(){g.errors=[],d.cmCustomField.update({id:g.customField.id},g.customField).$promise.then(function(e){var n=_.find(g.customFields,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"CustomField properly saved!",msg:g.customField.name?g.customField.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCustomField=function(e){g.errors=[];var n=t.confirm().title("Are you sure?").content("The customField will be deleted.").ariaLabel("Delete CustomField").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){d.cmCustomField.delete({id:g.customField.id}).$promise.then(function(){_.remove(g.customFields,{id:g.customField.id}),o.success({title:"CustomField properly deleted!",msg:(g.customField.name||"customField")+" has been deleted!"}),v(g.customField)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.addItem=function(e){e.push({value:"New Item"}),a.customFieldForm.$pristine=!1},g.removeItem=function(e,n){e.splice(n,1),a.customFieldForm.$pristine=!1},g.removeItems=function(e){for(var n=e.length,t=0;t<n;t++)e.splice(0,1);a.customFieldForm.$pristine=!1},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","customFields","customField","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditCustomFieldDialogController",e)}(),function(){"use strict";function e(a,e,t,i,s,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.list=c||a.params.list||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=a.params.tab||0,u.gotogoto=function(t,e){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{ListId:t.id}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{ListId:t.id})}},u.agentadddialog=function(e,n){t.show({controller:"ListagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{list:e,lists:u.lists?u.lists.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoLists=function(){a.go("app.contactmanager.lists",{},{reload:"app.contactmanager.lists"})},u.saveList=function(){r.cmList.update({id:u.list.id},u.list).$promise.then(function(){l.success({title:"List updated!",msg:u.list.name?u.list.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","list","userProfileSection"],angular.module("app.contactmanager").controller("ListController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.cmList.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.list=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.ListId=m.list.id,m.query.id=m.list.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.list.id,field:"ListId",route:"cmList"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.contactmanager").controller("ListDispositionsController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.lists=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="lists",f.listOrder="",f.listOrderAsc=null,f.selectedLists=[],f.query={fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){a.go("app.contactmanager.lists.edit",{id:e.id,list:e,crudPermissions:f.crudPermissions})},f.gotocontactsgoto=function(t,e){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{ListId:t.id}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{ListId:t.id})}},f.exportcsvcontactsexport=function(i,e){return m.cmList.getContactsCsv({id:i.id,nolimit:!0}).$promise.then(function(e){if(void 0!==e.length){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download","exportContacts_"+i.id+".csv"),a.click()}else p.info({title:"EXPORT",msg:"The list is empty"})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data):e.toString()})})},f.agentadddialog=function(e,n){i.show({controller:"ListagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{list:e,lists:f.lists?f.lists.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("list")+"?").htmlContent("<b>"+(e.name||"list")+"</b> will be deleted.").ariaLabel("delete list").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getLists=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cmList.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Lists",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditList=function(e,n){i.show({controller:"CreateOrEditListDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{list:n,lists:f.lists.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteList=y,f.exportSelectedLists=function(){var e=angular.copy(f.selectedLists);return f.selectedLists=[],e},f.deleteSelectedLists=function(e){var n=i.confirm().title("Are you sure want to delete the selected lists?").htmlContent("<b>"+f.selectedLists.length+" selected</b> will be deleted.").ariaLabel("delete Lists").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedLists.forEach(function(e){y(e)}),f.selectedLists=[]})},f.deselectLists=function(){f.selectedLists=[]},f.selectAllLists=function(){f.selectedLists=f.lists.rows};var b=!0,A=1;function E(e){f.lists=e||{count:0,rows:[]}}function y(e){m.cmList.delete({id:e.id}).$promise.then(function(){_.remove(f.lists.rows,{id:e.id}),f.lists.count-=1,f.lists.rows.length||f.getLists(),p.success({title:_.startCase("List")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmList"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcmList",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getLists())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","lists","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.contactmanager").controller("ListsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;function b(){return a.smsAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.smsAccounts=e,a.smsInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].SmsAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.smsAccounts.rows,{id:e.rows[t].SmsAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.smsAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.smsAccounts=n})})}function A(){return a.faxAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.faxAccounts=e,a.faxInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].FaxAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.faxAccounts.rows,{id:e.rows[t].FaxAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.faxAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.faxAccounts=n})})}function E(){return a.openchannelAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.openchannelAccounts=e,a.openchannelInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].OpenchannelAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.openchannelAccounts.rows,{id:e.rows[t].OpenchannelAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.openchannelAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.openchannelAccounts=n})})}function y(){return a.whatsappAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.whatsappAccounts=e,a.whatsappInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].WhatsappAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.whatsappAccounts.rows,{id:e.rows[t].WhatsappAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.whatsappAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.whatsappAccounts=n})})}function S(){return a.chatWebsite.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.chatWebsites=e,a.chatInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].ChatWebsiteId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.abandoned+=e.rows[t].abandoned,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.chatWebsites.rows,{id:e.rows[t].ChatWebsiteId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","abandoned","unmanaged"]));return f.chatWebsites}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.chatWebsites=n})})}function T(){return a.mailAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.mailAccounts=e,a.mailInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].MailAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.mailAccounts.rows,{id:e.rows[t].MailAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.mailAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.mailAccounts=n})})}function I(){for(var e=0;e<f.customDashboard.widgets.length;e+=1)f.customDashboard.widgets[e].voiceQueuesSelected=f.voiceQueuesSelected,f.customDashboard.widgets[e].chatWebsitesSelected=f.chatWebsitesSelected,f.customDashboard.widgets[e].smsAccountsSelected=f.smsAccountsSelected,f.customDashboard.widgets[e].faxAccountsSelected=f.faxAccountsSelected,f.customDashboard.widgets[e].mailAccountsSelected=f.mailAccountsSelected,f.customDashboard.widgets[e].openchannelAccountsSelected=f.openchannelAccountsSelected,f.customDashboard.widgets[e].whatsappAccountsSelected=f.whatsappAccountsSelected}f.currentUser=s.getCurrentUser(),f.userProfile=v,f.userProfileSection=h&&1===h.count?h.rows[0]:null,f.crudPermissions=s.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.customDashboard={},f.voiceQueues=l&&l.count?l:{count:0,rows:[]},f.voiceQueuesSelected=l&&l.count?_.map(l.rows,"id"):[],f.faxAccounts=d&&d.count?d:{count:0,rows:[]},f.faxAccountsSelected=d&&d.count?_.map(d.rows,"id"):[],f.chatWebsites=c&&c.count?c:{count:0,rows:[]},f.chatWebsitesSelected=c&&c.count?_.map(c.rows,"id"):[],f.smsAccounts=m&&m.count?m:{count:0,rows:[]},f.smsAccountsSelected=m&&m.count?_.map(m.rows,"id"):[],f.mailAccounts=u&&u.count?u:{count:0,rows:[]},f.mailAccountsSelected=u&&u.count?_.map(u.rows,"id"):[],f.openchannelAccounts=p&&p.count?p:{count:0,rows:[]},f.openchannelAccountsSelected=p&&p.count?_.map(p.rows,"id"):[],f.whatsappAccounts=g&&g.count?g:{count:0,rows:[]},f.whatsappAccountsSelected=g&&g.count?_.map(g.rows,"id"):[],f.interval=n(function(){},1e3),f.goToEdit=function(){e.go("app.tools.customDashboards.edit",{customDashboard:f.customDashboard,id:f.customDashboard.id,tab:1})},f.setFilter=function(e){o.show({controller:"FilterDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/custom/filter/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{vm_parent:f}}).then(function(e){f=e,I()})},f.updateWidget=I,i.onWithoutApply("voice_queue:save",function(e){var n=_.find(f.voiceQueues.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.onWithoutApply("sms_account:save",function(e){var n=_.find(f.smsAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("smsInteraction:update",b),i.on("smsInteraction:save",b),i.onWithoutApply("fax_account:save",function(e){var n=_.find(f.faxAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("faxInteraction:update",A),i.on("faxInteraction:save",A),i.onWithoutApply("mail_account:save",function(e){var n=_.find(f.mailAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("mailInteraction:update",T),i.on("mailInteraction:save",T),i.onWithoutApply("openchannel_account:save",function(e){var n=_.find(f.openchannelAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("openchannelInteraction:update",E),i.on("openchannelInteraction:save",E),i.onWithoutApply("whatsapp_account:save",function(e){var n=_.find(f.whatsappAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("whatsappInteraction:update",y),i.on("whatsappInteraction:save",y),i.onWithoutApply("chat_website:save",function(e){var n=_.find(f.chatWebsites.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("chatInteraction:update",S),i.on("chatInteraction:save",S),a.dashboard.get({id:e.params.id}).$promise.then(function(e){if(e)return f.customDashboard=e,f.customDashboard.widgets=[],f.customDashboard.preview=!0,f.customDashboard.draggable={enabled:!1},f.customDashboard.resizable={enabled:!1},a.dashboard.getItems({id:f.customDashboard.id}).$promise}).then(function(e){if(e&&e.count&&e.rows)for(var n=0;n<e.rows.length;n+=1)e.rows[n].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+e.rows[n].type+"/ms-widget-engine."+e.rows[n].type+".html",e.rows[n].voiceQueues=f.voiceQueues,e.rows[n].voiceQueuesSelected=f.voiceQueuesSelected,e.rows[n].faxAccounts=f.faxAccounts,e.rows[n].faxAccountsSelected=f.faxAccountsSelected,e.rows[n].mailAccounts=f.mailAccounts,e.rows[n].mailAccountsSelected=f.mailAccountsSelected,e.rows[n].smsAccounts=f.smsAccounts,e.rows[n].smsAccountsSelected=f.smsAccountsSelected,e.rows[n].chatWebsites=f.chatWebsites,e.rows[n].chatWebsitesSelected=f.chatWebsitesSelected,e.rows[n].openchannelAccounts=f.openchannelAccounts,e.rows[n].openchannelAccountsSelected=f.openchannelAccountsSelected,e.rows[n].whatsappAccounts=f.whatsappAccounts,e.rows[n].whatsappAccountsSelected=f.whatsappAccountsSelected,f.customDashboard.widgets.push(e.rows[n])}).catch(function(){f.customDashboard=void 0}),t.$on("$destroy",function(){i.removeAllListeners("voice_queue:save"),i.removeAllListeners("sms_account:save"),i.removeAllListeners("fax_account:save"),i.removeAllListeners("mail_account:save"),i.removeAllListeners("openchannel_account:save"),i.removeAllListeners("whatsapp_account:save"),i.removeAllListeners("chat_website:save"),i.removeAllListeners("chatInteraction:save"),i.removeAllListeners("chatInteraction:update"),i.removeAllListeners("smsInteraction:save"),i.removeAllListeners("smsInteraction:update"),i.removeAllListeners("openchannelInteraction:save"),i.removeAllListeners("openchannelInteraction:update"),i.removeAllListeners("mailInteraction:save"),i.removeAllListeners("mailInteraction:update"),i.removeAllListeners("faxInteraction:save"),i.removeAllListeners("faxInteraction:update"),i.removeAllListeners("whatsappInteraction:save"),i.removeAllListeners("whatsappInteraction:update"),f.interval&&n.cancel(f.interval)})}e.$inject=["$state","$interval","$scope","api","socket","Auth","$mdDialog","$document","voiceQueues","faxAccounts","chatWebsites","smsAccounts","mailAccounts","openchannelAccounts","whatsappAccounts","userProfile","userProfileSection"],angular.module("app.dashboards.custom").controller("DashboardCustomController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;function m(){a.hide(c.parent)}c.title="DASHBOARDS.SETFILTERS",c.currentUser=l.getCurrentUser(),c.parent=d,c.onChangeFilter=function(e){for(var n=0;n<c.parent.customDashboard.widgets.length;n+=1)switch(e){case"voice":c.parent.customDashboard.widgets[n].voiceQueuesSelected=c.parent.voiceQueuesSelected;break;case"sms":c.parent.customDashboard.widgets[n].smsAccountsSelected=c.parent.smsAccountsSelected;break;case"chat":c.parent.customDashboard.widgets[n].chatAccountsSelected=c.parent.chatAccountsSelected;break;case"fax":c.parent.customDashboard.widgets[n].faxAccountsSelected=c.parent.faxAccountsSelected;break;case"mail":c.parent.customDashboard.widgets[n].mailAccountsSelected=c.parent.mailAccountsSelected;break;case"openchannel":c.parent.customDashboard.widgets[n].openchannelAccountsSelected=c.parent.openchannelAccountsSelected;break;case"whatsapp":c.parent.customDashboard.widgets[n].whatsappAccountsSelected=c.parent.whatsappAccountsSelected}},c.confirm=function(){m()},c.closeDialog=m}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","api","Auth","vm_parent"],angular.module("app.tools").controller("FilterDialogController",e)}(),function(){"use strict";function e(e,s,i,c,o,r,m,n,l,t,u,a,d,p,g,v,h,f,b,A,E){var y=this;y.license=v,y.setting=h,y.detectBrowser=b.detectBrowser(),y.user=n.getCurrentUser(),y.currentTab=0,y.notifications={},y.tabs={},y.agentCapacity={},y.autoClose=!1,y.acceptedNotifications=[],y.autoanswerTimeout,y.globalUserLists=a||{count:0,rows:[]},y.globalLists=d||{count:0,rows:[]},y.globalCompanies=p||{count:0,rows:[]},y.globalTags=g||{count:0,rows:[]};var S=E.getLogger("dashboard","agent.general.contact");function T(e){var n={};for(var t in y.tabs)y.tabs.hasOwnProperty(t)&&(n[t]=_.pick(y.tabs[t],["type","title","channel","icon","color","autoCreate","id","saved","badges","openedAt"]),_.isNil(y.tabs[t].contact)||(n[t].contact=_.pick(y.tabs[t].contact,["id","ListId"])),_.isNil(y.tabs[t].calls)||(n[t].calls=y.tabs[t].calls),y.tabs[t].interaction&&(n[t].interaction=_.pick(y.tabs[t].interaction,["id","OpenchannelAccountId","MailAccountId","ChatWebsiteId","FaxAccountId","SmsAccountId","WhatsappAccountId","closed","draft"])));var a=JSON.parse(i.localStorage.getItem("motion2.user:"+y.user.id));a?(a.tabs=n,a.currentTab=y.currentTab,a.autoClose=y.autoClose):a={tabs:n,currentTab:y.currentTab,autoClose:y.autoClose},i.localStorage.setItem("motion2.user:"+y.user.id,JSON.stringify(a)),e&&I(e)}function I(e){if(_.isNil(e)||e&&"interaction"===e.type){var n={id:y.user.id,online:!0,capacity:{mail:0,fax:0,sms:0,whatsapp:0,openchannel:0,chat:0},interaction:{mail:[],fax:[],sms:[],whatsapp:[],openchannel:[],chat:[]}};for(var t in y.tabs)y.tabs.hasOwnProperty(t)&&n.capacity.hasOwnProperty(y.tabs[t].channel)&&y.tabs[t].interaction&&!y.tabs[t].interaction.closed&&(n.capacity[y.tabs[t].channel]+=1,n.interaction[y.tabs[t].channel].push(y.tabs[t].interaction.id));if(!_.isEqual(y.agentCapacity,n.capacity))return y.agentCapacity=n.capacity,l.rpc.setAgentCapacity(n)}}function O(e){y.tabs[e.id]&&(!function(e){if(e.channel&&e.interaction)l.user["remove"+_.upperFirst(e.channel)+"Interactions"]({id:y.user.id,ids:[e.interaction.id]}).$promise.catch(function(e){S.error(e)})}(y.tabs[e.id]),delete y.tabs[e.id],y.currentTab=0,T(e))}function C(e){Object.keys(y.tabs).length!==y.setting.limitTabs?(e.id=_.random(1e10),e.openedAt=(new Date).toISOString(),e.saved=!1,e.badges=0,y.tabs[e.id]=e,y.currentTab=e.id,T(e)):u.warning({title:"",msg:c.instant("DASHBOARD.LIMIT_TABS_REACHED")})}function w(n){return _.find(y.tabs,function(e){return"interaction"===e.type&&e.interaction&&e.interaction.id==n.interactionId&&e.channel==n.channel})}function R(n,t){var e,a,i={type:"contact",title:n?(e=n,a="",e&&(e.firstName||e.lastName?(e.firstName&&(a+=e.firstName+" "),e.lastName&&(a+=e.lastName)):e.phone&&(a=e.phone)),a=y.user.privacyEnabled?A.mask(a):a):c.instant("DASHBOARDS.NEW_CONTACT"),icon:"icon-account-circle",color:"red",contact:n,calls:t?[t]:[],autoCreate:t?t.autoCreate:0};if(t&&(t.answertime||(t.answertime=t.agentconnectAt),(t.agentcompleteAt||t.endtime)&&U(t)),n){var s=_.find(y.tabs,function(e){return e.contact&&e.contact.id?"contact"===e.type&&e.contact&&e.contact.id==n.id:"contact"===e.type&&e.contact&&e.contact.phone==n.phone});if(s){if(t)return l.voiceCallReport.get({uniqueid:t.uniqueid}).$promise.then(function(e){(e&&0<e.rows.length&&(t.disposedAt=_.first(e.rows).endtime),s.calls)?_.find(s.calls,function(e){return e.uniqueid===t.uniqueid})||s.calls.push(t):s.calls=[t];y.currentTab=s.id})}else{if(n.ListId)return l.disposition.get({ListId:n.ListId,nolimit:!0}).$promise.then(function(e){return i.dispositions=e,l.cmList.getCustomFields({id:n.ListId,nolimit:!0}).$promise}).then(function(e){i.customFields=e}).catch(F()).finally(function(){C(i)});C(i)}}else C(i)}function x(n,t){var e=_.find(y.tabs,function(e){return"interaction"===e.type&&e.interaction&&e.interaction.id===t.id&&e.channel===n});e?(e.isDraft=t.isDraft||!1,y.currentTab=e.id):C(e={type:"interaction",title:n?n.toUpperCase():"openchannel",icon:function(e){switch(e){case"chat":return"icon-hangouts";case"mail":return"icon-email";case"sms":return"icon-message-text";case"openchannel":return"icon-google-earth";case"fax":return"icon-deskphone";case"whatsapp":return"icon-whatsapp";default:return"icon-hangouts"}}(n),color:function(e){switch(e){case"chat":return"green-A700";case"mail":return"teal";case"sms":return"orange";case"openchannel":return"amber-A200";case"fax":return"blue-grey-A200";case"whatsapp":return"lime-A700";default:return"grey"}}(n),channel:n,interaction:t,isDraft:t.isDraft||!1})}function N(e){var n=0;switch(e){case"chat":n=105;break;case"mail":n=106;break;case"sms":n=107;break;case"openchannel":n=108;break;case"fax":n=109;break;case"whatsapp":n=114}return 0<n&&_.includes(y.user.permissions,n)}function D(t){f.isSupported()?f.requestPermission().then(function(){var e,n;n={autoClose:!0,duration:10,showOnPageHidden:!0,icon:"../../../../../../../assets/images/avatars/customer.png",body:(e=t).queue?"Queue: "+e.queue:"",focusOnclick:!0,closeOnClick:!0},f.show(e.title,n)},function(e){S.error("Please enable browser notifications!",e)}):S.error("Browser notifications are not supported by the browser. Normal notifications will be used.")}function P(n){u.wait({title:n.title,msg:n.msg||"",showClose:!1,clickToClose:!1,timeout:!1,sound:n.sound,html:!0,shake:n.shake||!1,onAdd:function(){y.notifications[n.uniqueid]=this.id},onAccept:function(){if(L(n),l[n.channel+"Message"])return l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id,manual:!0}).$promise.then(function(e){y.acceptedNotifications.push(n.id),y.autoanswerTimeout=null,x(e.channel,e.interaction),u.success({title:"Message properly accepted!",msg:"Message has been accepted!"})}).catch(F())},onReject:function(){if(L(n),_.isNil(y.autoanswerTimeout)||(r.cancel(y.autoanswerTimeout),y.autoanswerTimeout=null),l[n.channel+"Message"])return l[n.channel+"Message"].reject({id:n.id,UserId:y.user.id}).$promise.then(function(){u.success({title:"Message properly rejected!",msg:"Message has been rejected!"})}).catch(F())}})}function L(e){e&&e.uniqueid&&y.notifications[e.uniqueid]&&(u.clear(y.notifications[e.uniqueid]),delete y.notifications[e.uniqueid])}function k(n){var t=n.uniqueid;for(var e in S.debug("onVoiceChannelRemove -> evt",n),y.tabs)if(y.tabs.hasOwnProperty(e)){var a=y.tabs[e];if(a.calls){S.debug("onVoiceChannelRemove ->  key, tab, tab.calls",e,a,a.calls);var i=_.findIndex(a.calls,function(e){return e.uniqueid===t});i<0&&0<=(i=_.findIndex(a.calls,function(e){return e.uniqueid===n.linkedid}))&&(t=n.linkedid),0<=i&&!a.calls[i].disposedAt?(S.debug("Allowing disposition for call %s",a.calls[i].uniqueid),U(a.calls[i])):S.debug("Call %s not found or already completed",a.calls[i].uniqueid),a.contact&&a.contact.id&&r(M(t,a.contact.id,a),1e3)}}T()}function M(n,e,t){return function(){if(_.find(t.calls,function(e){return e.uniqueid===n}))return l.voiceCallReport.update({id:n,ContactId:e}).$promise.catch(function(e){S.error(e)})}}function U(e){e.disposedAt=new Date}function F(){return function(e){if(404===e.status)u.warning({title:c.instant("DASHBOARDS.ATTENTION"),msg:c.instant("DASHBOARDS.ACCEPT_ELSEWHERE")});else if(e.data&&e.data.errors&&e.data.errors.length){y.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var n=0;n<e.data.errors.length;n+=1)u.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else u.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelMessage.accept",msg:e.data?JSON.stringify(e.data.message):e.toString()})}}function $(e){l.cmHopper.update({id:e,recallmeNotifiedDate:null}).$promise.then(function(e){S.debug(e)}).catch(function(e){S.error(e)}).finally(function(){q(e)})}function q(e){y.toasty.clear(y.notifications[e])}y.onClickTab=function(e){y.currentTab=e,T(y.tabs[e])},y.isActiveTab=function(e){return e===y.currentTab},y.alreadyExistsTab=w,y.addContactTab=R,y.addInteractionTab=x,y.addTab=C,y.removeTab=O,y.updateLocalStorage=T,y.closeTab=function(e){var n=!1,t=s.confirm().title("interaction"===e.type?"Do you want to close the interaction?":"Are you sure want to close the "+e.type+"?").textContent("interaction"===e.type?"":"The "+e.type+" has been modified. Closing will lose all changes!").ariaLabel("Close Contact").ok("interaction"===e.type?"YES":"OK").cancel("interaction"===e.type?"NO":"CANCEL");{if(!e.saved){var a=y.user.voicePause||y.user.chatPause||y.user.mailPause||y.user.openchannelPause||y.user.faxPause;return"interaction"===e.type&&(n=e.interaction.Account.mandatoryDisposition),s.show(t).then(function(){"interaction"===e.type&&s.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(o.body),onRemoving:function(){y.user&&n&&!a&&l.user.unpause({id:y.user.id}).$promise.catch(function(e){S.error(e)})},clickOutsideToClose:!n,escapeToClose:!n,locals:{user:y.user,channel:e.channel,interaction:e.interaction}}),O(e)}).catch(function(){"interaction"===e.type&&O(e)})}if(_.forEach(e.calls,function(e){e.mandatoryDisposition&&(n=!0)}),"contact"===e.type&&0<e.calls.length){if(!n)return t._options.textContent="There is a call that hasn't been disposed yet.",s.show(t).then(function(){O(e)});var i=s.alert().title("Warning").textContent("There is a call that hasn't been disposed yet.").ok("OK");s.show(i).finally(function(){i=void 0})}else O(e)}},y.dialPreviewRecallReminder=function(e){var n,t,a,i,s;if(e&&e.hopper){if(i=m("formatdate")(e.hopper.scheduledat),s=e.hopper,e.hopper.Contact&&(n=e.hopper.Contact),e.hopper.List&&(t=e.hopper.List),e.hopper.id&&(a=e.hopper.id),a&&n&&t&&n.firstName){var o=n.firstName;n.lastName&&(o=o+" "+n.lastName);var r=s.phone||n.phone;y.user.privacyEnabled&&(o=A.mask(o),r=A.mask(r));var l=c.instant("DASHBOARDS.RECALLME_CALL_REMINDER"),d="<div>          <span>"+c.instant("DASHBOARDS.UPCOMING_RECALLME_CALL")+"</span><br>          <span>"+c.instant("DASHBOARDS.CONTACT_NAME")+": "+o+"</span><br>          <span>"+c.instant("DASHBOARDS.CONTACT_PHONE")+": "+r+"</span><br>          <span>"+c.instant("DASHBOARDS.SCHEDULED_TIME")+": "+i+"</span><br>          <span>"+c.instant("DASHBOARDS.LIST_NAME")+": "+t.name+"</span><br>          </div>";S.debug(e),u.info({title:l,msg:d,showClose:!0,clickToClose:!0,timeout:6e4,html:!0,onAdd:function(){y.notifications[a]=this.id},onAccept:function(){delete y.notifications[a],y.openContactTab(a)},onReject:function(){delete y.notifications[a],$(a)},onRemove:function(){setTimeout(function(){y.notifications[a]&&(delete y.notifications[a],$(a))},1e3)}})}}else S.warn("Response does not contain hopper",e)},y.openContactTab=function(e){y.openPreviewDialog(e),q(e)},y.openPreviewDialog=function(e){l.cmHopper.getPreviewRecall({id:e}).$promise.then(function(e){var n=angular.element("#toolbar").scope();n&&n.vm.openPreviewDialog(e,!0)})},y.toasty=u,function(){var e=i.localStorage.getItem("motion2.user:"+y.user.id);if(e)try{e=JSON.parse(e),y.tabs=e.tabs?e.tabs:{},y.currentTab=e.currentTab?e.currentTab:0,y.autoClose=!!e.autoClose&&e.autoClose,I(y.tabs[y.currentTab]),S.debug("Tabs initiated correctly")}catch(e){S.error(e)}}(),e.$on("$destroy",function(){for(var e in y.notifications)y.notifications.hasOwnProperty(e)&&L({uniqueid:e});t.removeAllListeners("trigger:contactmanager"),t.removeAllListeners("trigger:jscripty"),t.removeAllListeners("trigger:browser:url"),t.removeAllListeners("trigger:browser:popup"),t.removeAllListeners("notification:save"),t.removeAllListeners("notification:remove"),t.removeAllListeners("voice_queue_channel:remove"),t.removeAllListeners("voice_outbound_channel:remove")}),t.on("trigger:contactmanager",function(n){_.isNil(n.contacts)||1!==n.contacts.length?s.show({controller:"ContactSelectionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/contact/selection/dialog.html",parent:angular.element(o.body),locals:{contacts:n.contacts,callNumber:n.evt.routeId?n.evt.destcalleridnum:n.evt.calleridnum}}).then(function(e){R(e,n.evt)}):R(n.contact,n.evt)}),t.on("trigger:jscripty",function(t){return l.jscriptyProject.get({id:t.ProjectId}).$promise.then(function(n){if(n){if(!_.isUndefined(t["xmd-contactid"]))return l.cmContact.get({id:t["xmd-contactid"]}).$promise.then(function(e){try{n.formData=Mustache.render(n.formData,_.merge(t,{user:y.user,contact:e}))}catch(e){S.error(e)}C({type:"jscripty",title:n.name,icon:"icon-script",color:"grey",project:n,call:t,contact:e})}).catch(F());try{n.formData=Mustache.render(n.formData,_.merge(t,{user:y.user}))}catch(e){S.error(e)}C({type:"jscripty",title:n.name,icon:"icon-script",color:"grey",project:n,call:t})}}).catch(F())}),t.on("trigger:bot",function(n){var t=n.calleridname&&"<unknown>"!==n.calleridname?n.calleridname:n.calleridnum,a=n.calleridnum;return l.squareMessage.get({fields:"id",limit:1,offset:0,uniqueid:n.uniqueid}).$promise.then(function(e){e.count&&C({type:"bot",title:t+" <"+a+">",icon:"fas fa-robot",color:"pink",data:{uniqueid:n.uniqueid}})})}),t.on("trigger:browser:url",function(e){if(e&&e.uri)if(e.uri=_.replace(e.uri,"&lt%3B",""),e.uri=_.replace(e.uri,"=&gt%3B=",""),e.uriLocation)switch(e.uriLocation){case"0":i.open(e.uri);break;case"1":i.open(e.uri,"_blank","width="+(e.windowWidth||"800")+",height="+e.windowHeight||"600");break;case"2":C({type:"iframe",title:e.uri,icon:"icon-google-earth",color:"blue",src:e.uri});break;default:i.open(e.uri)}else i.open(e.uri)}),t.on("trigger:browser:popup",function(e){e&&e.html&&C({type:"popup",title:e.calleridnum||"popup",icon:"icon-tablet",color:"grey",html:e.html})}),t.on("notification:save",function(n){if(N(n.channel)&&n&&n.uniqueid){D(n);var e=w(n);if(e){if(l[n.channel+"Message"])return y.currentTab!==e.id&&(e.badges+=1),y.acceptedNotifications.push(n.id),l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id}).$promise.catch(F())}else{var t="mail"==n.channel?"email":n.channel,a=y.user[t+"AutoanswerDelay"]?1e3*y.user[t+"AutoanswerDelay"]:0;if(y.user[t+"Autoanswer"]&&y.license[n.channel]&&N(n.channel)){if(0<a)P(n),y.autoanswerTimeout=r(function(){if(l[n.channel+"Message"]&&!_.includes(y.acceptedNotifications,n.id))return l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id,manual:!0}).$promise.then(function(e){y.acceptedNotifications.push(n.id),x(e.channel,e.interaction),L(n)}).catch(F())},y.user[t+"AutoanswerDelay"]?1e3*y.user[t+"AutoanswerDelay"]:0);else if(l[n.channel+"Message"])return l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id,manual:!0}).$promise.then(function(e){y.acceptedNotifications.push(n.id),x(e.channel,e.interaction)}).catch(F())}else P(n)}}}),t.on("notification:remove",L),t.on("voice_queue_channel:remove",k),t.on("voice_outbound_channel:remove",k),t.on("user:dialPreviewRecallReminder",y.dialPreviewRecallReminder)}e.$inject=["$scope","$mdDialog","$window","$translate","$document","$timeout","$filter","Auth","api","socket","toasty","globalUserLists","globalLists","globalCompanies","globalTags","license","setting","desktopNotification","msUtils","privacyManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentDashboardGeneralController",e)}(),function(){"use strict";angular.module("app.dashboards").provider("desktopNotification",function(){var f={autoClose:!0,duration:5,showOnPageHidden:!1};return{config:function(e){for(var n in e)f.hasOwnProperty(n)&&null!=e[n]&&(f[n]=e[n])},$get:["$q","$timeout","$window","PERMISSIONS",function(e,u,n,p){var g=n.Notification||n.mozNotification||n.webkitNotification;return{isSupported:v,currentPermission:h,requestPermission:function(){if(!v())return e.reject("Notification API not supported");var t=e.defer();Promise.resolve(g.requestPermission)==g.requestPermission?g.requestPermission().then(function(e){p.GRANTED===e?t.resolve(e):t.reject(e)}):g.requestPermission(function(e,n){p.GRANTED===e?t.resolve(e):t.reject(e)});return t.promise},show:function(e,n){if(n=n||{},!v()||(t=e,a=n,i=angular.isString(t),s=!a.onClick||angular.isFunction(a.onClick),!i||!s)||function(e){if(e||f.showOnPageHidden)return!(window.document.hidden||window.document.mozHidden||window.document.webkitHidden)}(n.showOnPageHidden)||h()!==p.GRANTED)return;var t,a,i,s;var o=new g(e,n),r=n.duration||f.duration,l=void 0===n.autoClose?f.autoClose:n.autoClose;o.onclick=function(){n.onClick&&n.onClick(),n.focusOnclick&&window.focus(),n.closeOnClick&&o.close()},l&&(d=o,c=r,m=1e3*c,u(d.close.bind(d),m,!1));var d,c,m;return o},permissions:{default:p.DEFAULT,granted:p.GRANTED,denied:p.DENIED}};function v(){return!(void 0===g)}function h(){return(g||{}).permission}}]}}).provider("msNavigationAgentService",function(){var r=angular.injector(["ng"]).get("$log"),l=[];function n(e,n){if(angular.isString(e)){for(var t=e.split("."),a=t[t.length-1],i=function(e){var n=l;if(1===e.length)return n;e.pop();for(var t=0;t<e.length;t++){for(var a=e[t],i=!0,s=0;s<n.length;s++)if(n[s]._id===a){n=n[s].children,i=!1;break}if(i){var o={_id:a,_path:e.join("."),title:a,weight:1,children:[]};n.push(o),n=o.children}}return n}(t),s=!1,o=0;o<i.length;o++)if(i[o]._id===a){s=i[o];break}s?(angular.extend(s,n),s.uisref=d(s)):(n.children=[],!angular.isUndefined(n.weight)&&angular.isNumber(n.weight)||(n.weight=1),n._id=a,n._path=e,n.uisref=d(n),i.push(n))}else r.error("path must be a string (eg. `dashboard.project`)")}function d(e){var n="";return angular.isDefined(e.state)&&(n=e.state,angular.isDefined(e.stateParams)&&angular.isObject(e.stateParams)&&(n=n+"("+angular.toJson(e.stateParams)+")")),n}this.saveItem=n,this.deleteItem=function(e){if(!angular.isString(e))return void r.error("path must be a string (eg. `dashboard.project`)");for(var n=l,t=e.split("."),a=0;a<t.length;a++)for(var i=t[a],s=0;s<n.length;s++)if(n[s]._id===i){if(n[s]._path===e)return n.splice(s,1),!0;n=n[s].children;break}return!1},this.$get=function(){var e={saveItem:n,getNavigation:function(e){if(e){for(var n=0;n<l.length;n++)if(l[n]._id===e)return[l[n]];return null}return l}};return e}}).constant("PERMISSIONS",{DEFAULT:"default",GRANTED:"granted",DENIED:"denied"})}(),function(){"use strict";function e(t){var a=this;a.setting={},a.messages={count:0,rows:[]},a.showInteraction=!1,a.init=function(e,n){{if(a.setting=n,a.tab=e,a.tab.saved=!0,a.tab&&a.tab.data&&a.tab.data.uniqueid)return t.squareMessage.get({uniqueid:a.tab.data.uniqueid}).$promise.then(function(e){a.messages=e}).finally(function(){a.showInteraction=!0});a.showInteraction=!0}},a.getMessagesAlignment=function(e){switch(a.setting.messagesAlignment){case"left":return"in"==e.direction?e.direction:"out-left-aligned";case"right":return"in"==e.direction?"in-right-aligned":e.direction;default:return e.direction}}}e.$inject=["api"],angular.module("app.dashboards").controller("AgentGeneralBotController",e)}(),function(){"use strict";function e(a,d,c,t,m,i,u,p,s,o,e,r,l,n){var g=this;g.user=s.getCurrentUser(),g.detectBrowser=e.detectBrowser(),g.additionalItemTypes=[],g.additionalItems=[],g.contactItemTypes=[],g.newPhone=function(e){return{phone:e,color:"gray"}},g.journey=[],g.queryHopper={fields:"id,phone,scheduledat",sort:"-updatedAt",limit:10,page:1},g.queryFinal={fields:"uniqueid,calleridnum,statedesc,starttime,disposition,secondDisposition,thirdDisposition",sort:"-updatedAt",limit:10,page:1},g.queryHistory={fields:"uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-updatedAt",limit:10,page:1},g.hoppers={rows:[],count:0},g.finals={rows:[],count:0},g.histories={rows:[],count:0},g.journeyOptions=r.getQuery(),g.quickFilters=r.getQuickFilters(),g.addNewContact=h,g.saveContact=function(){g.errors=[],u.cmContact.update({id:g.contact.id},g.contact).$promise.then(function(e){var n=e.firstName||e.phone;return g.tab.title=g.user.privacyEnabled?l.mask(n):n,g.tab.contact=g.contact,m.$parent.vm.updateLocalStorage(),u.user.addContacts({id:s.getCurrentUser().id,ids:[e.id]})}).then(function(){return u.cmContact.setTags({id:g.contact.id,ids:g.tab.Tags}).$promise}).then(function(){return u.cmContact.setAdditionalPhones({id:g.contact.id,items:g.additionalItems,item_types:g.additionalItemTypes}).$promise.then(function(){g.detailForm.$pristine=!0,g.customFieldsForm.$pristine=!0,p.success({title:"Contact properly updated!",msg:g.contact.name?g.contact.name+" has been updated!":""})})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.getCustomFields=function(e){return u.cmList.getCustomFields({id:e}).$promise.then(function(e){g.tab.customFields=e}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"LIST:GETCustomFields",msg:e.data?JSON.stringify(e.data):e.toString()})})},g.call=m.$parent.vm.call,g.disposeCall=function(e,i){if(g.newContact)return void p.error({title:"ATTENTION",msg:"Please save the contact before disposing!"});d.show({controller:"DisposeCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/contact/dispose/dialog.html",parent:angular.element(c.body),targetEvent:i,clickOutsideToClose:!i.mandatoryDisposition,escapeToClose:!i.mandatoryDisposition,resolve:{globalDispositions:["apiResolver",function(e){return e.resolve("disposition@get",{MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0})}]},onRemoving:function(){g.user&&i.mandatoryDisposition&&u.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{dispositions:g.tab.dispositions,contact:g.contact,call:i,availableCalls:g.tab.calls.length,autoClose:m.$parent.vm.autoClose}}).then(function(e){var n=e[0];for(var t in m.$parent.vm.autoClose=e[1],n&&("BLACKLIST"===n?p.success({title:o.instant("DASHBOARDS.INFO"),msg:o.instant("DASHBOARDS.CALL_DISPOSED")+" "+n}):"RECALLME"===n||"RESCHEDULE"===n||p.success({title:o.instant("DASHBOARDS.INFO"),msg:o.instant("DASHBOARDS.CALL_SAVED")})),m.$parent.$parent.$parent.vm.tabs)if(m.$parent.$parent.$parent.vm.tabs.hasOwnProperty(t)){var a=m.$parent.$parent.$parent.vm.tabs[t];_.remove(a.calls,function(e){return e.uniqueid===i.uniqueid})}0===g.tab.calls.length&&m.$parent.vm.autoClose&&m.$parent.vm.removeTab(g.tab),m.$parent.vm.updateLocalStorage()})},g.checkCallStatus=function(n){return g.checkingCallStatus=!0,u.voiceCallReport.get({uniqueid:n.uniqueid}).$promise.then(function(e){e&&0<e.rows.length&&(n.disposedAt=_.first(e.rows).endtime)}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"VOICE_CALL_REPORT:GET",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){g.checkingCallStatus=!1})},g.duplicateContact=function(e){d.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(c.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:g.contact.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:s.getCurrentUser().id,fields:"id,name"})}]},locals:{contacts:[]}})},g.mergeContact=function(e){d.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(c.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:g.contact.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:s.getCurrentUser().id,fields:"id,name"})}]},locals:{contacts:[]}}).then(function(e){if(e){for(var n in m.$parent.$parent.$parent.vm.tabs)if(m.$parent.$parent.$parent.vm.tabs.hasOwnProperty(n)){var t=m.$parent.$parent.$parent.vm.tabs[n];t&&t.contact&&(e.from&&e.from.id&&e.from.id===t.contact.id&&m.$parent.$parent.$parent.vm.removeTab(t),e.to&&e.to.id&&e.to.id===t.contact.id&&m.$parent.$parent.$parent.vm.removeTab(t))}e.new&&m.$parent.$parent.$parent.vm.addContactTab(e.new)}})},g.getDateFromString=y,g.addJscriptyTab=function(e){try{e.formData=Mustache.render(e.formData,{contact:g.contact,user:g.user})}catch(e){v.error(e)}try{m.$parent.$parent.$parent.vm.addTab({type:"jscripty",title:e.name,icon:"icon-script",color:"grey",project:e,contact:g.contact})}catch(e){p.error({title:"ERROR OPENING JSCRIPTY PROJECT",msg:"The project cannot be started"+JSON.stringify(e)})}},g.getHoppers=b,g.getFinals=A,g.getHistories=E,g.getJscriptyProjects=function(){if(g.jscriptyProjects)return;return g.loadingJscriptyProjects=!0,u.jscriptyProject.get({fields:"createdAt,updatedAt,id,name,description,createdAt,formData,enableUncompleteSave",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){g.jscriptyProjects=e||{count:0,rows:[]}}).catch(function(){p.error({title:o.instant("JSCRIPTY.JSCRIPTY"),msg:o.instant("CONTACTMANAGER.NOTIFICATIONS.JSCRIPTY_GET_ERROR")})}).finally(function(){g.loadingJscriptyProjects=!1})},g.getAccounts=function(n){if(g[n+"Accounts"])return;var e="get"+_.startCase(n)+"Accounts";return g.loadingAccounts=!0,u.user[e]({id:g.user.id,attributes:["id","name"],nolimit:!0}).$promise.then(function(e){g[n+"Accounts"]=e||{count:0,rows:[]}}).catch(function(){p.error({title:o.instant(n.toUpperCase()+"."+n.toUpperCase()+"ACCOUNTS"),msg:o.instant("CONTACTMANAGER.NOTIFICATIONS.ACCOUNTS_GET_ERROR",{channel:o.instant("DASHBOARDS."+n.toUpperCase())})})}).finally(function(){g.loadingAccounts=!1})},g.composeInteraction=function(e,o,r,n){var l=o.toLowerCase();d.show({controller:"Compose"+o+"InteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/"+o.toLowerCase()+"/dialog.html",parent:angular.element(c.body),clickOutsideToClose:!1,locals:{account:r,message:{to:"mail"==l?n:n.split(",")},type:"new",interaction:{Contact:g.contact}},fullscreen:!0}).then(function(s){if(!s||_.isNil(s.message)||!s.message.savedAsDraft)return u[l+"Account"].send({id:r.id},s).$promise.then(function(e){if("Mail"===o){var n=e;if(n&&n.Messages&&n.Messages.length){if(s.attachments&&s.attachments.length)for(var t=0;t<s.attachments.length;t+=1)u.attachment.update({id:s.attachments[t].id},{MailMessageId:_.head(n.Messages).id});if(p.success({title:"Message properly sent!",msg:"Message has been sent!"}),n.closed){n.disposition=null;var a=!r.mandatoryDisposition,i=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause;d.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(c.body),onRemoving:function(){g.user&&r.mandatoryDisposition&&!i&&u.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},clickOutsideToClose:a,escapeToClose:a,locals:{user:g.user,channel:"mail",interaction:n}})}else m.$parent.vm.addInteractionTab("mail",n)}}else p.success({title:"Message properly sent!",msg:"Message has been sent!"}),m.$parent.vm.addInteractionTab(l,e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"fax"===l?p.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:o.toUpperCase()+"ACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});var e={type:"draft",channel:"mail",account:r,contact:g.contact,id:g.tab.id,openedAt:new Date,saved:!1,title:r.key+" - Untitled",content:s.message},n=a.localStorage.getItem("motion2.home.mail:"+g.user.id);if(n){var t=JSON.parse(n);t.drafts||(t.drafts={}),n=t}else n={drafts:{}};n.drafts[g.tab.id]=e,a.localStorage.setItem("motion2.home.mail:"+g.user.id,JSON.stringify(n))})},g.init=function(n,e){return g.tab=n,m.$watchGroup(["vm.detailForm.$pristine","vm.customFieldsForm.$pristine"],function(e){g.tab.saved=e[0]&&e[1]}),g.license=e,g.contact=g.tab.contact,g.newContact=!1,g.currentTab=0,u.user.get({fields:"id,fullname",nolimit:!0}).$promise.then(function(e){g.users=e||{count:0,rows:[]},g.usersMap=_.mapValues(_.keyBy(g.users.rows,"id"),"fullname")}).then(function(){for(var e=[],n=0;n<g.tab.calls.length;n++){var t=g.tab.calls[n];e.push(u.voiceCallReport.get({uniqueid:t.uniqueid}).$promise.then(function(e){e&&0<e.rows.length&&(t.disposedAt=_.first(e.rows).endtime)}))}return i.all(e)}).then(function(){return u.user.getLists({id:g.user.id,nolimit:!0}).$promise}).then(function(e){if(g.lists=e||{count:0,rows:[]},g.contact&&g.contact.ListId){if(g.list=_.find(g.lists.rows,{id:g.contact.ListId}),g.list)return;return u.cmList.get({id:g.contact.ListId}).$promise.then(function(e){e&&(g.list=e,g.lists.rows=_.unionBy(g.lists.rows,[g.list]))})}}).then(function(){if(g.contact&&g.contact.id){var e={id:g.contact.id,ListId:g.contact.ListId,limit:1,offset:0,sort:"-updatedAt"};return u.cmContact.get(e).$promise.then(function(e){return g.contact=e,g.tab.contact=e,u.user.addContacts({id:g.user.id,ids:[g.contact.id]})}).then(function(){if(g.contact.ListId)return u.disposition.get({ListId:g.contact.ListId,nolimit:!0}).$promise.then(function(e){return g.tab.dispositions=e,u.cmList.getCustomFields({id:g.contact.ListId,nolimit:!0}).$promise}).then(function(e){g.tab.customFields=e})}).then(function(){try{g.tab.companies=m.$parent.$parent.$parent.vm.globalCompanies,g.tab.tags=m.$parent.$parent.$parent.vm.globalTags,g.tab.autoCreate=0}catch(e){}u.contactItemType.get({}).$promise.then(function(e){g.contactItemTypes=e.rows}).then(function(){u.cmContact.getAdditionalPhones({id:g.contact.id}).$promise.then(function(e){var n=_.map(e,"item"),t=_.map(e,"description");g.additionalItemTypes=_.map(e,"ItemTypeId");var a=_.map(e,"ItemType.rgbBackgroundColor"),i=_.map(e,"ItemType.name");g.additionalItems=[];for(var s=0;s<n.length;s++)g.additionalItems.push({phone:n[s],type:i[s],color:a[s],description:t[s]})}).catch(function(e){console.log(e)})}),b(),A(),E()}).then(function(){return u.cmContact.getTags({id:g.contact.id}).$promise.then(function(e){g.tab.Tags=_.map(e.rows,"id")})})}return g.newContact=!0,n.autoCreate?h():void 0}).finally(function(){g.contact&&g.contact.id&&(S(),g.contact.dateOfBirth=y(g.contact.dateOfBirth))})},g.hasPermission=function(e){return s.hasPermission(e)},g.openInteraction=function(e){try{return m.$parent.$parent.$parent.vm.addInteractionTab(e.channel,e)}catch(e){p.error({title:o.instant("CONTACTMANAGER.CUSTOMER_JOURNEY"),msg:o.instant("CONTACTMANAGER.NOTIFICATIONS.INTERACTION_OPEN_ERROR")})}},g.getCustomerJourney=S,g.loadMoreJourney=function(){return i(function(e){var n=g.journey.length;return e(S(n))})};var v=n.getLogger("agent.general.contact");function h(){g.errors=[],u.cmContact.save(g.contact).$promise.then(function(e){g.contact.id=e.id,g.newContact=!1;var n=e.firstName||e.phone;return g.tab.title=g.user.privacyEnabled?l.mask(n):n,g.tab.contact=g.contact,u.user.addContacts({id:s.getCurrentUser().id,ids:[e.id]})}).then(function(){g.detailForm.$pristine=!0,g.customFieldsForm.$pristine=!0,p.success({title:"Contact properly created",msg:g.contact.firstName?g.contact.firstName+" has been created!":""})}).then(function(){return u.cmContact.setTags({id:g.contact.id,ids:g.tab.Tags}).$promise}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}function f(n){return function(e){g[n]=e||{count:0,rows:[]}}}function b(){g.contact&&g.contact.id&&(g.queryHopper.ContactId=g.contact.id,g.queryHopper.offset=(g.queryHopper.page-1)*g.queryHopper.limit,g.promise=u.cmHopper.get(g.queryHopper,f("hoppers")).$promise)}function A(){g.contact&&g.contact.id&&(g.queryFinal.ContactId=g.contact.id,g.queryFinal.offset=(g.queryFinal.page-1)*g.queryFinal.limit,g.promise=u.cmHopperFinal.get(g.queryFinal,f("finals")).$promise)}function E(){g.contact&&g.contact.id&&(g.queryHistory.ContactId=g.contact.id,g.queryHistory.offset=(g.queryHistory.page-1)*g.queryHistory.limit,g.promise=u.cmHopperHistory.get(g.queryHistory,f("histories")).$promise)}function y(e){return null===e?void 0:new Date(e)}function S(e){g.journeyIsLoading=!0;var n=_.merge(g.journeyOptions,{id:g.contact.id,offset:e||0});return r.get(g.journey,n).then(function(e){g.journey=e.journey,g.canLoadMoreJourney=e.loadMore}).finally(function(){g.journeyIsLoading=!1})}m.$on("$destroy",function(){}),m.$watch("currentTab",function(){1===g.currentTab&&(b(),A(),E())});var T=!0,I=1;m.$watch("queryHopper.filter",function(e,n){T?t(function(){T=!1}):(n||(I=g.queryHopper.page),e!==n&&(g.queryHopper.page=1),e||(g.queryHopper.page=I),b())}),m.$watch("queryFinal.filter",function(e,n){T?t(function(){T=!1}):(n||(I=g.queryFinal.page),e!==n&&(g.queryFinal.page=1),e||(g.queryFinal.page=I),A())}),m.$watch("queryHistory.filter",function(e,n){T?t(function(){T=!1}):(n||(I=g.queryHistory.page),e!==n&&(g.queryHistory.page=1),e||(g.queryHistory.page=I),E())})}e.$inject=["$window","$mdDialog","$document","$timeout","$scope","$q","api","toasty","Auth","$translate","msUtils","customerJourneyManager","privacyManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentGeneralContactController",e)}(),function(){"use strict";function e(n,t,i,s,o,e,a,r,l,d,c,m,u,p,g){var v=this;v.user=d.getCurrentUser(),v.isReschedule=!1,v.recallme=!1,v.queueCampaign=void 0,v.queueCampaigns={count:0,rows:[]},v.dispositions=_.orderBy(_.concat([],e.rows,a.rows),["name"],["asc"]),v.contact=l,v.call=r,v.note=v.call.note||void 0,v.dialerCall=!1,v.hasBlackLists=!1,v.contactTZTime,v.availableCalls=m,v.autoClose=u,v.recalcTZTime=b,v.hopper={minDate:new Date,dateTime:new Date,scheduledAt:new Date},p.$watch("vm.contact.dialTimezone",function(){b()});var h=g.getLogger("dashboard","agent.general.contact.dispose");function f(){return i(function(n){o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name,dialActive,dialMethod",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){v.queueCampaigns=e||{count:0,rows:[]},n()}).catch(function(e){h.error(e),s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.getBlackLists",msg:e.data?JSON.stringify(e.data):e.toString()})})})}function b(){var e=v.dialerCall?Number(v.call["xmd-voicequeueid"]):v.queueCampaign?v.queueCampaign.id:v.call["xmd-campaignid"]?Number(v.call["xmd-campaignid"]):null;if(e)o.voiceQueue.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(v.hopper.dialTimezone=e.dialTimezone,_.isNil(v.contact.dialTimezone)&&(v.contact.dialTimezone=v.hopper.dialTimezone),n)o.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;o.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledAt=moment(v.hopper.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})});else{o.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledAt=moment(v.hopper.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}});else{o.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledAt=moment(v.hopper.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}}function A(){var e=v.selectedDisposition?v.selectedDisposition.name.toLowerCase():void 0;return{id:v.call.uniqueid,disposition:v.firstLevelDisposition?v.firstLevelDisposition.name:null,secondDisposition:v.secondLevelDisposition?v.secondLevelDisposition.name:null,thirdDisposition:v.thirdLevelDisposition?v.thirdLevelDisposition.name:null,dispositionat:moment(),amd:"amd"===e,fax:"fax"===e,blacklist:"blacklist"===e,recallme:"recallme"===e,UserId:"recallme"===e?d.getCurrentUser().id:null,OwnerId:d.getCurrentUser().id}}function E(e){t.hide([e,v.autoClose])}v.call&&v.call.variables&&v.call.variables["xmd-voicequeueid"]?(v.dialerCall=!0,o.voiceQueue.getBlackLists({id:v.call.variables["xmd-voicequeueid"]}).$promise.then(function(e){e&&e.rows&&0<e.rows.length&&(v.hasBlackLists=!0)}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.getBlackLists",msg:e.data?JSON.stringify(e.data):e.toString()})})):f(),v.onDispositionChange=function(e){switch(e){case"first":v.selectedDisposition=v.firstLevelDisposition,v.anySecondLevelDisposition=_.some(v.dispositions,["ParentId",v.firstLevelDisposition.id]),v.secondLevelDisposition=void 0,v.thirdLevelDisposition=void 0,v.anyThirdLevelDisposition=!1;break;case"second":v.selectedDisposition=v.secondLevelDisposition,v.anyThirdLevelDisposition=_.some(v.dispositions,["ParentId",v.secondLevelDisposition.id]);break;case"third":v.selectedDisposition=v.thirdLevelDisposition}},v.clearDispositionSelection=function(e){"second"===e?(v.secondLevelDisposition=void 0,v.thirdLevelDisposition=void 0,v.selectedDisposition=v.firstLevelDisposition):"third"===e&&(v.thirdLevelDisposition=void 0,v.selectedDisposition=v.secondLevelDisposition)},v.saveDisposition=function(e){v.selectedDisposition=_.isNil(e)?v.selectedDisposition:{name:e},e&&(v.firstLevelDisposition=v.selectedDisposition);v.call.note=v.note,o.voiceCallReport.update({id:v.call.uniqueid,userDisposition:v.firstLevelDisposition?v.firstLevelDisposition.name:null,userSecondDisposition:v.secondLevelDisposition?v.secondLevelDisposition.name:null,userThirdDisposition:v.thirdLevelDisposition?v.thirdLevelDisposition.name:null,note:v.note,UserId:d.getCurrentUser().id,ContactId:v.contact.id}).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEVOICECALLREPORT",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.voiceRecording.get({uniqueid:v.call.uniqueid}).$promise.then(function(e){if(e)for(var n=0;n<e.rows.length;n+=1)o.voiceRecording.update({id:e.rows[n].id,userDisposition:v.firstLevelDisposition?v.firstLevelDisposition.name:null,userSecondDisposition:v.secondLevelDisposition?v.secondLevelDisposition.name:null,userThirdDisposition:v.thirdLevelDisposition?v.thirdLevelDisposition.name:null}).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEVOICERECORDING",msg:e.data?JSON.stringify(e.data):e.toString()})})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEVOICERECORDING",msg:e.data?JSON.stringify(e.data):e.toString()})}),v.dialerCall&&(o.cmHopperFinal.update(A()).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECMHOPPERFINAL",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.cmHopperHistory.update(A()).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECMHOPPERHISTORY",msg:e.data?JSON.stringify(e.data):e.toString()})}));if(_.isNil(v.selectedDisposition))E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"");else switch(v.selectedDisposition.name.toLowerCase()){case"blacklist":v.call&&v.call.variables&&v.call.variables["xmd-voicequeueid"]&&function(e){if(e)o.voiceQueue.getBlackLists({id:e,type:"outbound",fields:"id"}).$promise.then(function(e){var n=[];if(e&&0<e.count){for(var t=0;t<e.rows.length;t+=1){var a=angular.copy(v.contact);delete a.id,a.ListId=e.rows[t].id,n.push(o.cmContact.save(a).$promise)}return i.all(n)}s.success({title:c.instant("DASHBOARDS.INFO"),msg:c.instant("DASHBOARDS.NOTAVAILABLE")+" "+v.selectedDisposition}),v.selectedDisposition=void 0}).then(function(e){e&&E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEBLACKLIST",msg:e.data?JSON.stringify(e.data):e.toString()}),E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")})}(v.call.variables["xmd-voicequeueid"]);break;case"reschedule":v.isReschedule=!0,v.recallme=!1;break;case"recallme":v.isReschedule=!0,v.recallme=!0,v.user.selectRecallMeCampaign&&f().then(function(){v.originalCampaign=_.find(v.queueCampaigns.rows,["id",v.call.variables["xmd-voicequeueid"]]);var e=JSON.parse(n.localStorage.getItem("motion2.user:"+v.user.id));v.queueCampaign=e.previewCampaignId?_.find(v.queueCampaigns.rows,["id",Number(e.previewCampaignId)]):v.originalCampaign});break;default:E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")}},v.closeDialog=function(){t.cancel()},v.saveReschedule=function(){v.disable=!0;var e=null;v.queueCampaign?e=v.queueCampaign.id:v.dialerCall&&(e=Number(v.call["xmd-voicequeueid"]));return o.cmHopper.save({phone:v.contact.phone,UserId:v.recallme?d.getCurrentUser().id:null,ContactId:v.contact.id,ListId:v.contact.ListId,VoiceQueueId:e,scheduledat:moment(v.hopper.scheduledAt).format("YYYY-MM-DD HH:mm:ss"),dialTimezone:v.contact.dialTimezone,priority:3,recallme:v.recallme,OwnerId:d.getCurrentUser().id}).$promise.then(function(e){o.cmContact.rescheduleAdditionalPhones({id:v.contact.id,hopperId:e.id}).$promise.catch(function(e){console.log(e)})}).then(function(){if(v.dialerCall&&(o.cmHopperFinal.update({id:v.call.uniqueid,rescheduled:!0,rescheduledat:moment(v.hopper.scheduledAt).format("YYYY-MM-DD HH:mm:ss"),recallme:v.recallme}).$promise.catch(function(e){h.error(e)}),v.user.selectRecallMeCampaign)){var e=JSON.parse(n.localStorage.getItem("motion2.user:"+v.user.id));e.previewCampaignId=v.queueCampaign.id,n.localStorage.setItem("motion2.user:"+v.user.id,JSON.stringify(e))}}).then(function(){return o.cmContact.update({id:v.contact.id,dialTimezone:v.contact.dialTimezone})}).then(function(){s.success({title:c.instant("DASHBOARDS.INFO"),msg:c.instant("DASHBOARDS.CALL_DISPOSED")+" "+(v.recallme?c.instant("DASHBOARDS.RECALLME"):c.instant("DASHBOARDS.RESCHEDULE"))})}).catch(function(e){h.error(e),E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")}).finally(function(){v.disable=!1,E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")})}}e.$inject=["$window","$mdDialog","$q","toasty","api","dispositions","globalDispositions","call","contact","Auth","$translate","availableCalls","autoClose","$scope","ClientSideLoggingService"],angular.module("app.staff").controller("DisposeCallDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.call=l,u.contact=r,u.hopper={minDate:new Date,dateTime:new Date},u.closeDialog=function(){a.cancel()},u.saveDialog=function(){return u.disable=!0,o.cmHopper.save({phone:u.contact.phone,UserId:c?d.getCurrentUser().id:null,ContactId:u.contact.id,ListId:u.contact.ListId,VoiceQueueId:Number(u.call["xmd-voicequeueid"]),scheduledat:moment(u.hopper.dateTime).format("YYYY-MM-DD HH:mm:ss"),priority:3,recallme:c,OwnerId:d.getCurrentUser().id}).$promise.then(function(){o.cmHopperFinal.update({id:u.call.uniqueid,rescheduled:!0,rescheduledat:moment(u.hopper.dateTime).format("YYYY-MM-DD HH:mm:ss"),recallme:c}).$promise}).then(function(){s.success({title:m.instant("DASHBOARDS.INFO"),msg:m.instant("DASHBOARDS.CALL_DISPOSED")+" "+(c?m.instant("DASHBOARDS.RECALLME"):m.instant("DASHBOARDS.RESCHEDULE"))}),a.hide()}).catch(function(e){a.cancel(e)}).finally(function(){u.disable=!1})}}e.$inject=["$scope","$state","$location","$mdDialog","$timeout","toasty","api","contact","call","Auth","recallme","$translate"],angular.module("app.staff").controller("RescheduleCallDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s){var o=this;o.callNumber=i,o.page=1,o.onInit=function(){n.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){o.lists=_.chain(e.rows).keyBy("id").mapValues("name").value(),n.cmCustomField.get({fields:"id,alias",nolimit:!0}).$promise.then(function(e){o.customFields=e.rows,o.contacts=_.map(t,function(t){return Object.keys(t).forEach(function(e){if(Number(t[e])===Number(o.callNumber))if(e.startsWith("cf_")){var n=_.find(o.customFields,["id",Number(_.trimStart(e,"cf_"))]);t.matchingField=n?n.alias:a.instant("DASHBOARDS.UNKNOWN")}else t.matchingField=e}),t})})}).then(function(){o.paginatedContacts=_.chunk(t,4)}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.get",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},o.selectContact=function(){e.hide(o.selectedContact)}}e.$inject=["$mdDialog","$translate","api","contacts","callNumber","toasty"],angular.module("app.dashboards").controller("ContactSelectionController",e)}(),function(){"use strict";function e(e,n){var t=n(function(){},999);e.$on("$destroy",function(){t&&(n.cancel(t),t=null)})}e.$inject=["$scope","$interval"],angular.module("app.dashboards").controller("AgentHomeAbandonedController",e)}(),function(){"use strict";function e(e,n,a,i,t,s,o,r,l,d){var c=this;function m(){return o.disposition.get({fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}).$promise.then(function(e){return c.dispositions=e?e.rows:[],o.user.getQueues({id:r.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise}).then(function(e){c.queues=e||{count:0,rows:[]},c.queuesMap=_.mapValues(_.keyBy(c.queues.rows,"name"),"name"),c.defaultQueues=c.queues.rows?_.map(c.queues.rows,"name").join(","):void 0}).then(function(){c.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:c.currentUser.name,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_CAMPAIGN",options:c.queues.rows,ngValue:"name",clearAll:!1}]}).catch(function(e){console.log(e)}).finally(function(){var e=t.localStorage.getItem("motion2.home.abandoned.bull.calls:"+c.currentUser.id);if(e)(e=JSON.parse(e)).query&&(c.query=_.merge(e.query,c.query));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};c.query.createdAt=n}c.isSearchBarVisible=!!c.query.filter,u()})}function u(){c.query.queue=c.query.queue||c.defaultQueues.split(","),c.query.offset=(c.query.page-1)*c.query.limit;var e={query:c.query};t.localStorage.setItem("motion2.home.abandoned.bull.calls:"+c.currentUser.id,JSON.stringify(e)),c.promise=o.voiceQueueReport.getVoiceQueuesReport(c.query,p).$promise}function p(e){c.abandonedCalls=e||{count:0,rows:[]},c.refresh=!0}c.showTooltip=!1,c.refresh=!0,c.disable=[],c.dispositions={count:0,rows:[]},c.currentUser=r.getCurrentUser(),c.queues={},c.abandonedCalls={count:0,rows:[]},c.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition",type:"outbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},c.getAbandonedCalls=u,c.refreshAbandonedCalls=function(){c.showTooltip=!1,u()},c.onInit=m,c.reserved=function(e){e&&(c.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:e.assigned?c.currentUser.name:null,assigned:e.assigned}).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[e.id]=!1,e.lastAssignedTo=e.assigned?c.currentUser.name:null}))},c.dispose=function(t){a.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(i.body),targetEvent:t,locals:{dispositions:c.dispositions,call:t}}).then(function(e){if(e){c.disable[t.id]=!0;var n={id:t.id,lastAssignedTo:t.assigned?c.currentUser.name:null,assigned:t.assigned,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null};o.voiceQueueReport.update(n).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[t.id]=!1,t.disposition=e.firstLevel,t.secondDisposition=e.secondLevel,t.thirdDisposition=e.thirdLevel})}})},c.call=e.$parent.$parent.$parent.$parent.vm.call,c.transfer=e.$parent.$parent.$parent.$parent.vm.transfer,c.webcall=e.$parent.$parent.$parent.$parent.vm.webcall,c.webtransfer=e.$parent.$parent.$parent.$parent.vm.webtransfer,l.onWithoutApply("voiceQueueReport:save",function(e){c.queuesMap&&"outbound"===e.type&&c.queuesMap[e.queue]&&(c.showTooltip=!0)}),l.onWithoutApply("voiceQueueReport:update",function(e){if(e){var n=_.findIndex(c.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(c.abandonedCalls.rows[n],e)}}),m(),e.$on("$destroy",function(){l.removeAllListeners("voiceQueueReport:save"),l.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeAbandonedBullController",e)}(),function(){"use strict";function e(n,e,t){var a=this;a.dispositions=e,a.call=t,a.note=a.call.note||void 0,a.onDispositionChange=function(e){switch(e){case"first":a.selectedDisposition=a.firstLevelDisposition,a.anySecondLevelDisposition=_.some(a.dispositions,["ParentId",a.firstLevelDisposition.id]),a.secondLevelDisposition=void 0,a.thirdLevelDisposition=void 0,a.anyThirdLevelDisposition=!1;break;case"second":a.selectedDisposition=a.secondLevelDisposition,a.anyThirdLevelDisposition=_.some(a.dispositions,["ParentId",a.secondLevelDisposition.id]);break;case"third":a.selectedDisposition=a.thirdLevelDisposition}},a.clearDispositionSelection=function(e){"second"===e?(a.secondLevelDisposition=void 0,a.thirdLevelDisposition=void 0,a.selectedDisposition=a.firstLevelDisposition):"third"===e&&(a.thirdLevelDisposition=void 0,a.selectedDisposition=a.secondLevelDisposition)},a.saveDisposition=function(){a.call.note=a.note;var e={firstLevel:a.firstLevelDisposition?a.firstLevelDisposition.name:void 0,secondLevel:a.secondLevelDisposition?a.secondLevelDisposition.name:void 0,thirdLevel:a.thirdLevelDisposition?a.thirdLevelDisposition.name:void 0};n.hide(e)},a.closeDialog=function(){n.cancel()}}e.$inject=["$mdDialog","dispositions","call"],angular.module("app.dashboards").controller("DisposeAbandonedCallDialogController",e)}(),function(){"use strict";function e(e,n,a,i,t,s,o,r,l,d){var c=this;function m(){return o.disposition.get({fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}).$promise.then(function(e){return c.dispositions=e?e.rows:[],o.user.getQueues({id:r.getCurrentUser().id,fields:"id,name",channel:"voice",type:"inbound",nolimit:!0}).$promise}).then(function(e){c.queues=e||{count:0,rows:[]},c.queuesMap=_.mapValues(_.keyBy(c.queues.rows,"name"),"name"),c.defaultQueues=c.queues.rows?_.map(c.queues.rows,"name").join(","):void 0}).then(function(){c.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:c.currentUser.name,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_QUEUE",options:c.queues.rows,ngValue:"name",clearAll:!1}]}).catch(function(e){console.log(e)}).finally(function(){var e=t.localStorage.getItem("motion2.home.abandoned.voice.calls:"+c.currentUser.id);if(e)(e=JSON.parse(e)).query&&(c.query=_.merge(e.query,c.query));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};c.query.createdAt=n}c.isSearchBarVisible=!!c.query.filter,u()})}function u(){c.query.queue=c.query.queue||c.defaultQueues.split(","),c.query.offset=(c.query.page-1)*c.query.limit;var e={query:c.query};t.localStorage.setItem("motion2.home.abandoned.voice.calls:"+c.currentUser.id,JSON.stringify(e)),c.promise=o.voiceQueueReport.getVoiceQueuesReport(c.query,p).$promise}function p(e){c.abandonedCalls=e||{count:0,rows:[]},c.refresh=!0}c.showTooltip=!1,c.refresh=!0,c.disable=[],c.dispositions={count:0,rows:[]},c.currentUser=r.getCurrentUser(),c.queues={},c.abandonedCalls={count:0,rows:[]},c.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition",type:"inbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},c.getAbandonedCalls=u,c.refreshAbandonedCalls=function(){c.showTooltip=!1,u()},c.onInit=m,c.reserved=function(e){e&&(c.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:e.assigned?c.currentUser.name:null,assigned:e.assigned}).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[e.id]=!1,e.lastAssignedTo=e.assigned?c.currentUser.name:null}))},c.dispose=function(t){a.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(i.body),targetEvent:t,locals:{dispositions:c.dispositions,call:t}}).then(function(e){if(e){c.disable[t.id]=!0;var n={id:t.id,lastAssignedTo:t.assigned?c.currentUser.name:null,assigned:t.assigned,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null};o.voiceQueueReport.update(n).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[t.id]=!1,t.disposition=e.firstLevel,t.secondDisposition=e.secondLevel,t.thirdDisposition=e.thirdLevel})}})},c.call=e.$parent.$parent.$parent.$parent.vm.call,c.transfer=e.$parent.$parent.$parent.$parent.vm.transfer,c.webcall=e.$parent.$parent.$parent.$parent.vm.webcall,c.webtransfer=e.$parent.$parent.$parent.$parent.vm.webtransfer,l.onWithoutApply("voiceQueueReport:save",function(e){c.queuesMap&&"inbound"===e.type&&c.queuesMap[e.queue]&&(c.showTooltip=!0)}),l.onWithoutApply("voiceQueueReport:update",function(e){if(e){var n=_.findIndex(c.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(c.abandonedCalls.rows[n],e)}}),m(),e.$on("$destroy",function(){l.removeAllListeners("voiceQueueReport:save"),l.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeAbandonedVoiceController",e)}(),function(){"use strict";function e(n,a,t,e,i){var s=this;function o(){var e=angular.element(".agent-general-home-navbar button.current")[0];e&&e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}s.user=t.getCurrentUser(),s.license={},s.plugin={},s.setting={},s.sidebar="dashboard",s.draftManager=i,s.navigation=e.getNavigation(),s.addContactTab=n.$parent.vm.addContactTab,s.addInteractionTab=n.$parent.vm.addInteractionTab,s.init=function(e,n){s.license=e,s.setting=n;var t=a.localStorage.getItem("motion2.home:"+s.user.id);if(t){try{t=JSON.parse(t),s.sidebar=t.currentSidebarTab?t.currentSidebarTab:"dashboard"}catch(e){console.error(e),s.sidebar="dashboard"}"mail"===s.sidebar&&s.draftManager.init()}},s.changeSidebarTab=function(e){s.sidebar=e.view,"plugin"===s.sidebar&&(s.plugin=e.stateParams,s.pluginId=e.id,n.$broadcast("pluginUpdated",{plugin:s.plugin}));a.localStorage.setItem("motion2.home:"+s.user.id,JSON.stringify({currentSidebarTab:e.view}))},s.hasPermission=function(e){return t.hasPermission(e)},angular.element(a).on("resize",o),n.$on("$destroy",function(){angular.element(a).off("resize",o)}),n.$watch("vm_home.sidebar",function(e,n){"mail"===e?s.draftManager.init():s.draftManager.drafts={}})}e.$inject=["$scope","$window","Auth","msNavigationAgentService","draftManager"],angular.module("app.dashboards").controller("AgentGeneralHomeController",e)}(),function(){"use strict";function e(t,n,i,s,a,o,e,r,l,d,c,m,u,p){var g=this;g.user=l.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.chatInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,ChatWebsiteId:[]},g.sectionColor="green-A700",g.onInit=function(e,n){return g.license=e,g.setting=n,r.user.getChatWebsites({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.chatAccounts=e||{count:0,rows:[]},r.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Website",key:"ChatWebsiteId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.chatAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Customer Ip",column:"customerIp",type:"text",options:{excludedOperators:["$eq","$ne","$startsWith","$endsWith"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Website",column:"ChatWebsiteId",type:"multiselect",options:{route:{model:"user",action:"getChatWebsites",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){m.parseInteractionsKey("chat",g.query,g.user.id,g.chatAccounts.rows).then(function(){g.isSearchBarVisible=!(g.query.search||!g.query.filter),y(g.query.page)}),d.on("chatInteraction:save",O),d.on("chatInteraction:update",O),d.on("chatInteractionTags:save",C),d.on("chatMessage:save",w),d.on("chatMessage:update",w),d.on("user_has_chat_interactions:save",T),d.on("user_has_chat_interactions:remove",I),d.on("userChatWebsite:save",f),d.on("userChatWebsite:remove",b),0<g.setting.chatInteractionsReloadTimeout&&R()})},g.success=E,g.getChatInteractions=y,g.showChatInteraction=function(e,n){t.$parent.vm.addInteractionTab("chat",n)},g.downloadChatInteraction=function(e,s,n){r.chatInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="chat-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadChatInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&r.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"chat",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getChatWebsiteLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.chat"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.chat");function h(e){return{accounts:g.chatAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.ChatWebsiteId);u.addAccount("chat",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.ChatWebsiteId);u.removeAccount("chat",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.chatAccounts.rows,function(e){return{model:"chatWebsite",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.chatInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.chatInteractions=e||{count:0,rows:[]};for(var n=0;n<g.chatInteractions.rows.length;n+=1)S(g.chatInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=a.localStorage.getItem("motion2.home.chat:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,a.localStorage.setItem("motion2.home.chat:"+g.user.id,JSON.stringify(n)),g.promise=r.chatInteraction.get(g.query,E).$promise}function S(e){"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.chatInteractions.rows,{id:e.ChatInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.chatInteractions.rows,{id:e.ChatInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.chatInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.chatInteractions.rows=_.orderBy(g.chatInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.chatInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.chatInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.chatInteractions.rows,{id:e.ChatInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.chatInteractionsReloadTimeout)}t.$on("$destroy",function(){d.removeAllListeners("chatMessage:save"),d.removeAllListeners("chatMessage:update"),d.removeAllListeners("chatInteraction:save"),d.removeAllListeners("chatInteractionTags:save"),d.removeAllListeners("chatInteraction:update"),d.removeAllListeners("user_has_chat_interactions:save"),d.removeAllListeners("user_has_chat_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeChatController",e)}(),function(){"use strict";function e(t,n,e,a,i,s,o,r){var l=this;function d(e){l.searchInProgress=!1,l.contacts=e||{count:0,rows:[]}}function c(e,n){l.searchInProgress=!0,o.cmContact.describe({id:l.query.ListId}).$promise.then(function(e){return _(e.toJSON()).omit("UserId").values().map(function(e){return function(e){var n={name:_.startCase(e.displayName),column:e.columnName,options:{}};if(e.custom)switch(e.custom.type){case"text":n.type="text";break;case"select":n.type="multiselect",n.values=_.map(JSON.parse(e.custom.values),function(e,n){return{id:n,name:e.value,value:e.value}}),n.options.field="name";break;case"switch":n.type="select",n.values=[{id:1,translate:"DASHBOARDS.ENABLED"},{id:0,translate:"DASHBOARDS.DISABLED"}],n.options.excludedOperators=["$ne"];break;case"number":n.type="number";break;case"datetime":n.type="date"}else switch(e.columnName){case"dateOfBirth":n.type="date";break;case"CompanyId":n.name="Company",n.type="autocomplete",n.options.route={model:"cmCompany",action:"get",params:{fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;case"ListId":n.name="List",n.type="autocomplete",n.options.route={model:"user",action:"getLists",params:{id:l.currentUser.id,fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;default:_.includes(e.type.toLowerCase(),"int")?n.type="number":_.includes(e.type.toLowerCase(),"date")?n.type="date":n.type="text"}return n}(e)}).value()}).then(function(e){l.advancedSearch.fields=e;var n=_.findIndex(e,function(e){return _.startsWith(e.column,"cf_")})||e.length-1;n<0&&(n=e.length),l.advancedSearch.fields.splice(n,0,{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"DESCRIBE_CM_CONTACTS",msg:e.data?JSON.stringify(e.data.message):e.toString()})}),e||(l.query.page=1),l.query.offset=(l.query.page-1)*l.query.limit;var t=i.localStorage.getItem("motion2.home.contacts:"+l.currentUser.id);(t=t?JSON.parse(t):{}).query=l.query,i.localStorage.setItem("motion2.home.contacts:"+l.currentUser.id,JSON.stringify(t)),l.promise=o.cmContact.get(l.query,d).$promise}l.currentUser=s.getCurrentUser(),l.lists={},l.contacts={count:0,rows:[]},l.tags={count:0,rows:[]},l.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1},l.advancedSearch={fields:[]},l.sectionColor="red",l.getContacts=c,l.refreshContacts=function(){c()},l.mergeContact=function(e,n){a.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.duplicateContact=function(e,n){a.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.openContact=function(e){return o.cmContact.get({id:e}).$promise.then(function(e){n.$parent.vm.addContactTab(e)})},l.call=n.$parent.vm.call,l.onInit=function(){o.user.getLists({id:l.currentUser.id,fields:"id,name,dialPrefix",sort:"name",nolimit:!0}).$promise.then(function(e){return l.lists=e||{count:0,rows:[]},l.listsMap=_.keyBy(l.lists.rows,"id"),o.tag.get({sort:"name"}).$promise}).then(function(e){l.tags=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"List",key:"ListId",type:"multiselect",label:"CONTACTMANAGER.SELECT_LIST",options:l.lists.rows,clearAll:!1},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:l.tags.rows,placeholder:"DASHBOARDS.TAGS"}]}).catch(function(e){console.error(e)}).finally(function(){var e=i.localStorage.getItem("motion2.home.contacts:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.merge(l.query,e.query),_.isEmpty(l.lists.rows)?l.query.ListId=[]:_.isEmpty(l.query.ListId)&&(l.query.ListId=_(l.lists.rows).map("id").take().value()))}catch(e){console.log(e)}else l.query.ListId=_.map(l.lists.rows,"id");l.isSearchBarVisible=!(l.query.search||!l.query.filter),c()})},l.openAdvancedSearch=function(){a.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{color:l.sectionColor,fields:l.advancedSearch.fields,storagePath:"home.contacts"},fullscreen:!0}).then(function(e){l.isSearchBarVisible=!(e.value||!l.query.filter),e.apply&&(l.query.search=e.value,c())}).catch(function(e){r.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}}e.$inject=["$document","$scope","$timeout","$mdDialog","$window","Auth","api","toasty"],angular.module("app.dashboards").controller("AgentHomeContactsController",e)}(),function(){"use strict";function e(e,n){var t=n(function(){},999);e.$on("$destroy",function(){t&&(n.cancel(t),t=null)})}e.$inject=["$scope","$interval"],angular.module("app.dashboards").controller("AgentHomeDashboardController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["type","waiting","dialMethod","dialActive"];function u(e){c.voiceQueuesTotal=e.count?e.count:0,c.voiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.voiceQueues,function(e,n){c.rpcVoiceQueues[n]&&(c.voiceQueues[n].waiting=c.rpcVoiceQueues[n].waiting||0)})}c.voiceQueues={},c.voiceQueuesTotal=0,c.rpcVoiceQueues={},c.getVoiceQueues={},c.rpcVoiceQueuesChannels={},c.addVoiceQueuesChannels={},c.deleteVoiceQueuesChannels=[],c.load=!0,c.query={id:r.getCurrentUser().id,fields:"id,name,type,dialMethod,dialActive",channel:"voice",type:"outbound",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=u,c.getVoiceQueues=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,u).$promise},c.getSize=function(e){return _.size(e)},c.onSaveQueue=function(e){c.voiceQueues[e.id]&&c.rpcVoiceQueues[e.id]&&(c.rpcVoiceQueues[e.id]=e,_.merge(c.voiceQueues[e.id],_.pick(e,m)))},c.onSaveChannel=function(e){"outbound"===e.type&&(e.queuecallerleaveAt?(delete c.rpcVoiceQueuesChannels[e.uniqueid],c.load&&c.deleteVoiceQueuesChannels.push(e.uniqueid)):(c.rpcVoiceQueuesChannels[e.uniqueid]=e,c.load&&(c.addVoiceQueuesChannels[e.uniqueid]=e)))},c.onUserVoiceQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getVoiceQueues()},c.onSaveVoiceQueue=function(e){_.isNil(e)||(c.rpcVoiceQueues[e.id]=_.pick(e,m))},c.onUpdateVoiceQueue=function(e){_.isNil(e)||(c.rpcVoiceQueues[e.id]&&_.merge(c.rpcVoiceQueues[e.id],_.pick(e,m)),c.voiceQueues[e.id]&&_.merge(c.voiceQueues[e.id],_.pick(e,m)))},c.onRemoveVoiceQueue=function(e){_.isNil(e)||(delete c.rpcVoiceQueues[e.id],delete c.voiceQueues[e.id])},l.onWithoutApply("voice_queue:save",c.onSaveQueue),l.onWithoutApply("voice_queue_channel:save",c.onSaveChannel),l.onWithoutApply("userVoiceQueue:save",c.onUserVoiceQueue),l.onWithoutApply("userVoiceQueue:remove",c.onUserVoiceQueue),l.onWithoutApply("voiceQueue:save",c.onSaveVoiceQueue),l.onWithoutApply("voiceQueue:remove",c.onRemoveVoiceQueue),l.onWithoutApply("voiceQueue:update",c.onUpdateVoiceQueue),o.rpc.getVoiceQueues().$promise.then(function(e){return c.rpcVoiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},o.rpc.getVoiceQueuesChannels().$promise}).then(function(e){c.rpcVoiceQueuesChannels=e?_.keyBy(e.rows?_.filter(e.rows,{type:"outbound",queuecallerleaveAt:null}):[],"uniqueid"):{}}).catch(function(e){console.error(e)}).finally(function(){_.merge(c.rpcVoiceQueuesChannels,c.addVoiceQueuesChannels);for(var e=0;e<c.deleteVoiceQueuesChannels.length;e+=1)delete c.rpcVoiceQueuesChannels[c.deleteVoiceQueuesChannels[e]];c.load=!1,c.addVoiceQueuesChannels={},c.deleteVoiceQueuesChannels=[],c.getVoiceQueues()});var p=!0,g=1;e.$watch("vm_dc.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=g),c.getVoiceQueues())}),e.$on("$destroy",function(){l.removeAllListeners("voice_queue:save"),l.removeAllListeners("voice_queue_channel:save"),l.removeAllListeners("userVoiceQueue:save"),l.removeAllListeners("userVoiceQueue:remove"),l.removeAllListeners("voiceQueue:save"),l.removeAllListeners("voiceQueue:update"),l.removeAllListeners("voiceQueue:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardBullController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcChatQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.chatQueuesTotal=e.count?e.count:0,c.chatQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.chatQueues,function(e,n){c.rpcChatQueues[n]&&(c.chatQueues[n].waiting=c.rpcChatQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.chatQueues={},c.chatQueuesTotal=0,c.rpcChatQueues={},c.paginatedInteractions=[],c.deleteChatQueuesWaitingInteractions=[],c.rpcChatQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"chat",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getChatQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.chatQueues[e.id]&&c.rpcChatQueues[e.id]&&(_.merge(c.rpcChatQueues[e.id],_.pick(e,m)),_.merge(c.chatQueues[e.id],_.pick(e,m)))},c.onSaveChatQueue=function(e){_.isNil(e)||(c.rpcChatQueues[e.id]=_.pick(e,m))},c.onUpdateChatQueue=function(e){_.isNil(e)||(c.rpcChatQueues[e.id]&&_.merge(c.rpcChatQueues[e.id],_.pick(e,m)),c.chatQueues[e.id]&&_.merge(c.chatQueues[e.id],_.pick(e,m)))},c.onRemoveChatQueue=function(e){_.isNil(e)||(delete c.rpcChatQueues[e.id],delete c.chatQueues[e.id])},c.onSaveUserChatQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getChatQueues()},c.onRemoveUserChatQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getChatQueues()},c.onSaveChatQueueChannel=function(e){c.chatQueues[e.queue_id]&&(c.rpcChatQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveChatQueueChannel=function(e){delete c.rpcChatQueuesWaitingInteractions[e.id],u&&c.deleteChatQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("chat_queue:save",c.onSaveQueue),l.onWithoutApply("chatQueue:save",c.onSaveChatQueue),l.onWithoutApply("chatQueue:update",c.onUpdateChatQueue),l.onWithoutApply("chatQueue:remove",c.onRemoveChatQueue),l.onWithoutApply("userChatQueue:save",c.onSaveUserChatQueue),l.onWithoutApply("userChatQueue:remove",c.onRemoveUserChatQueue),l.onWithoutApply("chat_queue_waiting_interaction:save",c.onSaveChatQueueChannel),l.onWithoutApply("chat_queue_waiting_interaction:remove",c.onRemoveChatQueueChannel),o.rpc.getChatQueues().$promise.then(function(e){c.rpcChatQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"chat"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getChatQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcChatQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteChatQueuesWaitingInteractions.length;e+=1)delete c.rpcChatQueuesWaitingInteractions[c.deleteChatQueuesWaitingInteractions[e]];u=!1,c.deleteChatQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getChatQueues())}),e.$on("$destroy",function(){l.removeAllListeners("chat_queue:save"),l.removeAllListeners("chatQueue:save"),l.removeAllListeners("chatQueue:update"),l.removeAllListeners("chatQueue:remove"),l.removeAllListeners("userChatQueue:save"),l.removeAllListeners("userChatQueue:remove"),l.removeAllListeners("chat_queue_waiting_interaction:save"),l.removeAllListeners("chat_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelChatController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcFaxQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.faxQueuesTotal=e.count?e.count:0,c.faxQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.faxQueues,function(e,n){c.rpcFaxQueues[n]&&(c.faxQueues[n].waiting=c.rpcFaxQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.faxQueues={},c.faxQueuesTotal=0,c.rpcFaxQueues={},c.paginatedInteractions=[],c.deleteFaxQueuesWaitingInteractions=[],c.rpcFaxQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"fax",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getFaxQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.faxQueues[e.id]&&c.rpcFaxQueues[e.id]&&(_.merge(c.rpcFaxQueues[e.id],_.pick(e,m)),_.merge(c.faxQueues[e.id],_.pick(e,m)))},c.onSaveFaxQueue=function(e){_.isNil(e)||(c.rpcFaxQueues[e.id]=_.pick(e,m))},c.onUpdateFaxQueue=function(e){_.isNil(e)||(c.rpcFaxQueues[e.id]&&_.merge(c.rpcFaxQueues[e.id],_.pick(e,m)),c.faxQueues[e.id]&&_.merge(c.faxQueues[e.id],_.pick(e,m)))},c.onRemoveFaxQueue=function(e){_.isNil(e)||(delete c.rpcFaxQueues[e.id],delete c.faxQueues[e.id])},c.onSaveUserFaxQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getFaxQueues()},c.onRemoveUserFaxQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getFaxQueues()},c.onSaveFaxQueueChannel=function(e){c.faxQueues[e.queue_id]&&(c.rpcFaxQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveFaxQueueChannel=function(e){delete c.rpcFaxQueuesWaitingInteractions[e.id],u&&c.deleteFaxQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("fax_queue:save",c.onSaveQueue),l.onWithoutApply("faxQueue:save",c.onSaveFaxQueue),l.onWithoutApply("faxQueue:update",c.onUpdateFaxQueue),l.onWithoutApply("faxQueue:remove",c.onRemoveFaxQueue),l.onWithoutApply("userFaxQueue:save",c.onSaveUserFaxQueue),l.onWithoutApply("userFaxQueue:remove",c.onRemoveUserFaxQueue),l.onWithoutApply("fax_queue_waiting_interaction:save",c.onSaveFaxQueueChannel),l.onWithoutApply("fax_queue_waiting_interaction:remove",c.onRemoveFaxQueueChannel),o.rpc.getFaxQueues().$promise.then(function(e){c.rpcFaxQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"fax"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getFaxQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcFaxQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteFaxQueuesWaitingInteractions.length;e+=1)delete c.rpcFaxQueuesWaitingInteractions[c.deleteFaxQueuesWaitingInteractions[e]];u=!1,c.deleteFaxQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getFaxQueues())}),e.$on("$destroy",function(){l.removeAllListeners("fax_queue:save"),l.removeAllListeners("faxQueue:save"),l.removeAllListeners("faxQueue:update"),l.removeAllListeners("faxQueue:remove"),l.removeAllListeners("userFaxQueue:save"),l.removeAllListeners("userFaxQueue:remove"),l.removeAllListeners("fax_queue_waiting_interaction:save"),l.removeAllListeners("fax_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelFaxController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcMailQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.mailQueuesTotal=e.count?e.count:0,c.mailQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.mailQueues,function(e,n){c.rpcMailQueues[n]&&(c.mailQueues[n].waiting=c.rpcMailQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.mailQueues={},c.mailQueuesTotal=0,c.rpcMailQueues={},c.paginatedInteractions=[],c.deleteMailQueuesWaitingInteractions=[],c.rpcMailQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"mail",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getMailQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.mailQueues[e.id]&&c.rpcMailQueues[e.id]&&(_.merge(c.rpcMailQueues[e.id],_.pick(e,m)),_.merge(c.mailQueues[e.id],_.pick(e,m)))},c.onSaveMailQueue=function(e){_.isNil(e)||(c.rpcMailQueues[e.id]=_.pick(e,m))},c.onUpdateMailQueue=function(e){_.isNil(e)||(c.rpcMailQueues[e.id]&&_.merge(c.rpcMailQueues[e.id],_.pick(e,m)),c.mailQueues[e.id]&&_.merge(c.mailQueues[e.id],_.pick(e,m)))},c.onRemoveMailQueue=function(e){_.isNil(e)||(delete c.rpcMailQueues[e.id],delete c.mailQueues[e.id])},c.onSaveUserMailQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getMailQueues()},c.onRemoveUserMailQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getMailQueues()},c.onSaveMailQueueChannel=function(e){c.mailQueues[e.queue_id]&&(c.rpcMailQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveMailQueueChannel=function(e){delete c.rpcMailQueuesWaitingInteractions[e.id],u&&c.deleteMailQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("mail_queue:save",c.onSaveQueue),l.onWithoutApply("mailQueue:save",c.onSaveMailQueue),l.onWithoutApply("mailQueue:update",c.onUpdateMailQueue),l.onWithoutApply("mailQueue:remove",c.onRemoveMailQueue),l.onWithoutApply("userMailQueue:save",c.onSaveUserMailQueue),l.onWithoutApply("userMailQueue:remove",c.onRemoveUserMailQueue),l.onWithoutApply("mail_queue_waiting_interaction:save",c.onSaveMailQueueChannel),l.onWithoutApply("mail_queue_waiting_interaction:remove",c.onRemoveMailQueueChannel),o.rpc.getMailQueues().$promise.then(function(e){c.rpcMailQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"mail"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getMailQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcMailQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteMailQueuesWaitingInteractions.length;e+=1)delete c.rpcMailQueuesWaitingInteractions[c.deleteMailQueuesWaitingInteractions[e]];u=!1,c.deleteMailQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getMailQueues())}),e.$on("$destroy",function(){l.removeAllListeners("mail_queue:save"),l.removeAllListeners("mailQueue:save"),l.removeAllListeners("mailQueue:update"),l.removeAllListeners("mailQueue:remove"),l.removeAllListeners("userMailQueue:save"),l.removeAllListeners("userMailQueue:remove"),l.removeAllListeners("mail_queue_waiting_interaction:save"),l.removeAllListeners("mail_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelMailController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcOpenchannelQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.openchannelQueuesTotal=e.count?e.count:0,c.openchannelQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.openchannelQueues,function(e,n){c.rpcOpenchannelQueues[n]&&(c.openchannelQueues[n].waiting=c.rpcOpenchannelQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.openchannelQueues={},c.openchannelQueuesTotal=0,c.rpcOpenchannelQueues={},c.paginatedInteractions=[],c.deleteOpenchannelQueuesWaitingInteractions=[],c.rpcOpenchannelQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"openchannel",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getOpenchannelQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.openchannelQueues[e.id]&&c.rpcOpenchannelQueues[e.id]&&(_.merge(c.rpcOpenchannelQueues[e.id],_.pick(e,m)),_.merge(c.openchannelQueues[e.id],_.pick(e,m)))},c.onSaveOpenchannelQueue=function(e){_.isNil(e)||(c.rpcOpenchannelQueues[e.id]=_.pick(e,m))},c.onUpdateOpenchannelQueue=function(e){_.isNil(e)||(c.rpcOpenchannelQueues[e.id]&&_.merge(c.rpcOpenchannelQueues[e.id],_.pick(e,m)),c.openchannelQueues[e.id]&&_.merge(c.openchannelQueues[e.id],_.pick(e,m)))},c.onRemoveOpenchannelQueue=function(e){_.isNil(e)||(delete c.rpcOpenchannelQueues[e.id],delete c.openchannelQueues[e.id])},c.onSaveUserOpenchannelQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getOpenchannelQueues()},c.onRemoveUserOpenchannelQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getOpenchannelQueues()},c.onSaveOpenchannelQueueChannel=function(e){c.openchannelQueues[e.queue_id]&&(c.rpcOpenchannelQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveOpenchannelQueueChannel=function(e){delete c.rpcOpenchannelQueuesWaitingInteractions[e.id],u&&c.deleteOpenchannelQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("openchannel_queue:save",c.onSaveQueue),l.onWithoutApply("openchannelQueue:save",c.onSaveOpenchannelQueue),l.onWithoutApply("openchannelQueue:update",c.onUpdateOpenchannelQueue),l.onWithoutApply("openchannelQueue:remove",c.onRemoveOpenchannelQueue),l.onWithoutApply("userOpenchannelQueue:save",c.onSaveUserOpenchannelQueue),l.onWithoutApply("userOpenchannelQueue:remove",c.onRemoveUserOpenchannelQueue),l.onWithoutApply("openchannel_queue_waiting_interaction:save",c.onSaveOpenchannelQueueChannel),l.onWithoutApply("openchannel_queue_waiting_interaction:remove",c.onRemoveOpenchannelQueueChannel),o.rpc.getOpenchannelQueues().$promise.then(function(e){c.rpcOpenchannelQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"openchannel"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getOpenchannelQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcOpenchannelQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteOpenchannelQueuesWaitingInteractions.length;e+=1)delete c.rpcOpenchannelQueuesWaitingInteractions[c.deleteOpenchannelQueuesWaitingInteractions[e]];u=!1,c.deleteOpenchannelQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getOpenchannelQueues())}),e.$on("$destroy",function(){l.removeAllListeners("openchannel_queue:save"),l.removeAllListeners("openchannelQueue:save"),l.removeAllListeners("openchannelQueue:update"),l.removeAllListeners("openchannelQueue:remove"),l.removeAllListeners("userOpenchannelQueue:save"),l.removeAllListeners("userOpenchannelQueue:remove"),l.removeAllListeners("openchannel_queue_waiting_interaction:save"),l.removeAllListeners("openchannel_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelOpenchannelController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcSmsQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.smsQueuesTotal=e.count?e.count:0,c.smsQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.smsQueues,function(e,n){c.rpcSmsQueues[n]&&(c.smsQueues[n].waiting=c.rpcSmsQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.smsQueues={},c.smsQueuesTotal=0,c.rpcSmsQueues={},c.paginatedInteractions=[],c.deleteSmsQueuesWaitingInteractions=[],c.rpcSmsQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"sms",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getSmsQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.smsQueues[e.id]&&c.rpcSmsQueues[e.id]&&(_.merge(c.rpcSmsQueues[e.id],_.pick(e,m)),_.merge(c.smsQueues[e.id],_.pick(e,m)))},c.onSaveSmsQueue=function(e){_.isNil(e)||(c.rpcSmsQueues[e.id]=_.pick(e,m))},c.onUpdateSmsQueue=function(e){_.isNil(e)||(c.rpcSmsQueues[e.id]&&_.merge(c.rpcSmsQueues[e.id],_.pick(e,m)),c.smsQueues[e.id]&&_.merge(c.smsQueues[e.id],_.pick(e,m)))},c.onRemoveSmsQueue=function(e){_.isNil(e)||(delete c.rpcSmsQueues[e.id],delete c.smsQueues[e.id])},c.onSaveUserSmsQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getSmsQueues()},c.onRemoveUserSmsQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getSmsQueues()},c.onSaveSmsQueueChannel=function(e){c.smsQueues[e.queue_id]&&(c.rpcSmsQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveSmsQueueChannel=function(e){delete c.rpcSmsQueuesWaitingInteractions[e.id],u&&c.deleteSmsQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("sms_queue:save",c.onSaveQueue),l.onWithoutApply("smsQueue:save",c.onSaveSmsQueue),l.onWithoutApply("smsQueue:update",c.onUpdateSmsQueue),l.onWithoutApply("smsQueue:remove",c.onRemoveSmsQueue),l.onWithoutApply("userSmsQueue:save",c.onSaveUserSmsQueue),l.onWithoutApply("userSmsQueue:remove",c.onRemoveUserSmsQueue),l.onWithoutApply("sms_queue_waiting_interaction:save",c.onSaveSmsQueueChannel),l.onWithoutApply("sms_queue_waiting_interaction:remove",c.onRemoveSmsQueueChannel),o.rpc.getSmsQueues().$promise.then(function(e){c.rpcSmsQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"sms"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getSmsQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcSmsQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteSmsQueuesWaitingInteractions.length;e+=1)delete c.rpcSmsQueuesWaitingInteractions[c.deleteSmsQueuesWaitingInteractions[e]];u=!1,c.deleteSmsQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getSmsQueues())}),e.$on("$destroy",function(){l.removeAllListeners("sms_queue:save"),l.removeAllListeners("smsQueue:save"),l.removeAllListeners("smsQueue:update"),l.removeAllListeners("smsQueue:remove"),l.removeAllListeners("userSmsQueue:save"),l.removeAllListeners("userSmsQueue:remove"),l.removeAllListeners("sms_queue_waiting_interaction:save"),l.removeAllListeners("sms_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelSmsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["type","waiting","dialMethod","dialActive"];function u(e){c.voiceQueuesTotal=e.count?e.count:0,c.voiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.voiceQueues,function(e,n){c.rpcVoiceQueues[n]&&(c.voiceQueues[n].waiting=c.rpcVoiceQueues[n].waiting||0)})}c.voiceQueues={},c.voiceQueuesTotal=0,c.rpcVoiceQueues={},c.getVoiceQueues={},c.rpcVoiceQueuesChannels={},c.addVoiceQueuesChannels={},c.deleteVoiceQueuesChannels=[],c.load=!0,c.query={id:r.getCurrentUser().id,fields:"id,name,type,dialMethod,dialActive",channel:"voice",type:"inbound",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=u,c.getVoiceQueues=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,u).$promise},c.getSize=function(e){return _.size(e)},c.onSaveQueue=function(e){c.voiceQueues[e.id]&&c.rpcVoiceQueues[e.id]&&(c.rpcVoiceQueues[e.id]=e,_.merge(c.voiceQueues[e.id],_.pick(e,m)))},c.onSaveChannel=function(e){"inbound"===e.type&&(e.queuecallerleaveAt?(delete c.rpcVoiceQueuesChannels[e.uniqueid],c.load&&c.deleteVoiceQueuesChannels.push(e.uniqueid)):(c.rpcVoiceQueuesChannels[e.uniqueid]=e,c.load&&(c.addVoiceQueuesChannels[e.uniqueid]=e)))},c.onUserVoiceQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getVoiceQueues()},c.onSaveVoiceQueue=function(e){_.isNil(e)||(c.rpcVoiceQueues[e.id]=_.pick(e,m))},c.onUpdateVoiceQueue=function(e){_.isNil(e)||(c.rpcVoiceQueues[e.id]&&_.merge(c.rpcVoiceQueues[e.id],_.pick(e,m)),c.voiceQueues[e.id]&&_.merge(c.voiceQueues[e.id],_.pick(e,m)))},c.onRemoveVoiceQueue=function(e){_.isNil(e)||(delete c.rpcVoiceQueues[e.id],delete c.voiceQueues[e.id])},l.onWithoutApply("voice_queue:save",c.onSaveQueue),l.onWithoutApply("voice_queue_channel:save",c.onSaveChannel),l.onWithoutApply("userVoiceQueue:save",c.onUserVoiceQueue),l.onWithoutApply("userVoiceQueue:remove",c.onUserVoiceQueue),l.onWithoutApply("voiceQueue:save",c.onSaveVoiceQueue),l.onWithoutApply("voiceQueue:remove",c.onRemoveVoiceQueue),l.onWithoutApply("voiceQueue:update",c.onUpdateVoiceQueue),o.user.getQueues(c.query).$promise.then(function(e){return c.myQueues=e,o.rpc.getVoiceQueues().$promise}).then(function(e){for(var n=e.rows,t=_.keyBy(n,"id"),a=0;a<c.myQueues.count;a++){var i=c.myQueues.rows[a];c.rpcVoiceQueues[i.id]=t[i.id]}return o.rpc.getVoiceQueuesChannels().$promise}).then(function(e){c.rpcVoiceQueuesChannels=e?_.keyBy(e.rows?_.filter(e.rows,function(e){return!("inbound"!==e.type||e.queuecallerleaveAt||!_.find(c.myQueues.rows,{name:e.queue}))}):[],"uniqueid"):{}}).catch(function(e){console.error(e)}).finally(function(){_.merge(c.rpcVoiceQueuesChannels,c.addVoiceQueuesChannels);for(var e=0;e<c.deleteVoiceQueuesChannels.length;e+=1)delete c.rpcVoiceQueuesChannels[c.deleteVoiceQueuesChannels[e]];c.load=!1,c.addVoiceQueuesChannels={},c.deleteVoiceQueuesChannels=[],c.getVoiceQueues()});var p=!0,g=1;e.$watch("vm_dc.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=g),c.getVoiceQueues())}),e.$on("$destroy",function(){l.removeAllListeners("voice_queue:save"),l.removeAllListeners("voice_queue_channel:save"),l.removeAllListeners("userVoiceQueue:save"),l.removeAllListeners("userVoiceQueue:remove"),l.removeAllListeners("voiceQueue:save"),l.removeAllListeners("voiceQueue:update"),l.removeAllListeners("voiceQueue:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardVoiceController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcWhatsappQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.whatsappQueuesTotal=e.count?e.count:0,c.whatsappQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.whatsappQueues,function(e,n){c.rpcWhatsappQueues[n]&&(c.whatsappQueues[n].waiting=c.rpcWhatsappQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.whatsappQueues={},c.whatsappQueuesTotal=0,c.rpcWhatsappQueues={},c.paginatedInteractions=[],c.deleteWhatsappQueuesWaitingInteractions=[],c.rpcWhatsappQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"whatsapp",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getWhatsappQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.whatsappQueues[e.id]&&c.rpcWhatsappQueues[e.id]&&(_.merge(c.rpcWhatsappQueues[e.id],_.pick(e,m)),_.merge(c.whatsappQueues[e.id],_.pick(e,m)))},c.onSaveWhatsappQueue=function(e){_.isNil(e)||(c.rpcWhatsappQueues[e.id]=_.pick(e,m))},c.onUpdateWhatsappQueue=function(e){_.isNil(e)||(c.rpcWhatsappQueues[e.id]&&_.merge(c.rpcWhatsappQueues[e.id],_.pick(e,m)),c.whatsappQueues[e.id]&&_.merge(c.whatsappQueues[e.id],_.pick(e,m)))},c.onRemoveWhatsappQueue=function(e){_.isNil(e)||(delete c.rpcWhatsappQueues[e.id],delete c.whatsappQueues[e.id])},c.onSaveUserWhatsappQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getWhatsappQueues()},c.onRemoveUserWhatsappQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getWhatsappQueues()},c.onSaveWhatsappQueueChannel=function(e){c.whatsappQueues[e.queue_id]&&(c.rpcWhatsappQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveWhatsappQueueChannel=function(e){delete c.rpcWhatsappQueuesWaitingInteractions[e.id],u&&c.deleteWhatsappQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("whatsapp_queue:save",c.onSaveQueue),l.onWithoutApply("whatsappQueue:save",c.onSaveWhatsappQueue),l.onWithoutApply("whatsappQueue:update",c.onUpdateWhatsappQueue),l.onWithoutApply("whatsappQueue:remove",c.onRemoveWhatsappQueue),l.onWithoutApply("userWhatsappQueue:save",c.onSaveUserWhatsappQueue),l.onWithoutApply("userWhatsappQueue:remove",c.onRemoveUserWhatsappQueue),l.onWithoutApply("whatsapp_queue_waiting_interaction:save",c.onSaveWhatsappQueueChannel),l.onWithoutApply("whatsapp_queue_waiting_interaction:remove",c.onRemoveWhatsappQueueChannel),o.rpc.getWhatsappQueues().$promise.then(function(e){c.rpcWhatsappQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"whatsapp"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getWhatsappQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcWhatsappQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteWhatsappQueuesWaitingInteractions.length;e+=1)delete c.rpcWhatsappQueuesWaitingInteractions[c.deleteWhatsappQueuesWaitingInteractions[e]];u=!1,c.deleteWhatsappQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getWhatsappQueues())}),e.$on("$destroy",function(){l.removeAllListeners("whatsapp_queue:save"),l.removeAllListeners("whatsappQueue:save"),l.removeAllListeners("whatsappQueue:update"),l.removeAllListeners("whatsappQueue:remove"),l.removeAllListeners("userWhatsappQueue:save"),l.removeAllListeners("userWhatsappQueue:remove"),l.removeAllListeners("whatsapp_queue_waiting_interaction:save"),l.removeAllListeners("whatsapp_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelWhatsappController",e)}(),function(){"use strict";function e(a,t,i,s,o,n,e,r,l,d,c,m,u,p){var g=this;g.user=l.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.faxInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,FaxAccountId:[]},g.sectionColor="blue-grey",g.onInit=function(e,n){return g.license=e,g.setting=n,r.user.getFaxAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.faxAccounts=e||{count:0,rows:[]},r.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"FaxAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.faxAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"FaxAccountId",type:"multiselect",options:{route:{model:"user",action:"getFaxAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){m.parseInteractionsKey("fax",g.query,g.user.id,g.faxAccounts.rows).then(function(){g.isSearchBarVisible=!(g.query.search||!g.query.filter),y(g.query.page)}),d.on("faxInteraction:save",O),d.on("faxInteraction:update",O),d.on("faxInteractionTags:save",C),d.on("faxMessage:save",w),d.on("faxMessage:update",w),d.on("user_has_fax_interactions:save",T),d.on("user_has_fax_interactions:remove",I),d.on("userFaxAccount:save",f),d.on("userFaxAccount:remove",b)})},g.success=E,g.getFaxInteractions=y,g.showFaxInteraction=function(e,n){a.$parent.vm.addInteractionTab("fax",n)},g.downloadFaxInteraction=function(e,s,n){r.faxInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="fax-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadFaxInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&r.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"fax",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?n.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return n.instant("DASHBOARDS.NOT_ASSIGNED")},g.getFaxAccountLabel=function(e){if(e.Account)return e.Account.key;return n.instant("DASHBOARDS.UNKNOWN")},g.composeFaxInteraction=function(e,t){i.show({controller:"ComposeFaxInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/fax/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return r.faxAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("fax",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.fax"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.fax");function h(e){return{accounts:g.faxAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.FaxAccountId);u.addAccount("fax",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.FaxAccountId);u.removeAccount("fax",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.faxAccounts.rows,function(e){return{model:"faxAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.faxInteractionsReloadTimeout&&function(e){e&&g.interactionsInterval&&t.cancel(g.interactionsInterval);g.interactionsInterval=t(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.faxInteractionsReloadTimeout)}(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.faxInteractions=e||{count:0,rows:[]};for(var n=0;n<g.faxInteractions.rows.length;n+=1)S(g.faxInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=o.localStorage.getItem("motion2.home.fax:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,o.localStorage.setItem("motion2.home.fax:"+g.user.id,JSON.stringify(n)),g.promise=r.faxInteraction.get(g.query,E).$promise}function S(e){e.contactInfo=e.Contact?e.Contact.fax:void 0,"Unknown"===e.contactName&&(e.contactName=n.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.faxInteractions.rows,{id:e.FaxInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.faxInteractions.rows,{id:e.FaxInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.faxInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.faxInteractions.rows=_.orderBy(g.faxInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else y(g.query.page)}}function C(e){if(e){var n=_.find(g.faxInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.faxInteractions.rows,{id:e.FaxInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}a.$on("$destroy",function(){d.removeAllListeners("faxMessage:save"),d.removeAllListeners("faxMessage:update"),d.removeAllListeners("faxInteraction:save"),d.removeAllListeners("faxInteractionTags:save"),d.removeAllListeners("faxInteraction:update"),d.removeAllListeners("user_has_fax_interactions:save"),d.removeAllListeners("user_has_fax_interactions:remove"),g.interactionsInterval&&t.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeFaxController",e)}(),function(){"use strict";function e(o,n,r,l,m,t,e,d,a,i,c,u,s,p,g){var v=this;v.user=a.getCurrentUser(),v.license={},v.setting={},v.tags={count:0,rows:[]},v.mailInteractions={count:0,rows:[]},v.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,MailAccountId:[]},v.sectionColor="teal",v.onInit=function(e,n){return v.license=e,v.setting=n,d.user.getMailAccounts({id:v.user.id,nolimit:!0}).$promise.then(function(e){return v.mailAccounts=e||{count:0,rows:[]},d.tag.get({sort:"name"}).$promise}).then(function(e){v.tags=e||{count:0,rows:[]}}).then(function(){return d.mailSubstatus.get({nolimit:!0}).$promise}).then(function(e){v.subStatuses=e||{count:0,rows:[]}}).then(function(){v.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Substatus",key:"substatus",type:"select",label:"DASHBOARDS.SELECT_SUBSTATUS",options:v.subStatuses.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NONE"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name",ngIf:"closed === 0"},{name:"Account",key:"MailAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:v.mailAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:v.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:v.tags.rows,placeholder:"DASHBOARDS.TAGS"}],v.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"plainBody",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Substatus",column:"substatus",type:"multiselect",options:{field:"name",route:{model:"mailSubstatus",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"MailAccountId",type:"multiselect",options:{route:{model:"user",action:"getMailAccounts",params:{id:v.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:E("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:E("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:E("third")}}]}}).catch(function(e){h.error(e)}).finally(function(){s.parseInteractionsKey("mail",v.query,v.user.id,v.mailAccounts.rows).then(function(){v.isSearchBarVisible=!(v.query.search||!v.query.filter),S(v.query.page)}),i.on("mailInteraction:save",w),i.on("mailInteraction:update",w),i.on("mailInteractionTags:save",R),i.on("mailMessage:save",x),i.on("mailMessage:update",x),i.on("user_has_mail_interactions:save",O),i.on("user_has_mail_interactions:remove",C),i.on("userMailAccount:save",b),i.on("userMailAccount:remove",A),0<v.setting.mailInteractionsReloadTimeout&&N()})},v.success=y,v.getMailInteractions=S,v.showMailInteraction=T,v.downloadMailInteraction=function(e,s,n){d.mailInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="mail-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadMailInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.disposeInteraction=function(e,n){var t=v.user.voicePause||v.user.chatPause||v.user.mailPause||v.user.openchannelPause||v.user.faxPause,a=!n.Account.mandatoryDisposition;r.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(l.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){v.user&&n.Account.mandatoryDisposition&&!t&&d.user.unpause({id:v.user.id}).$promise.catch(function(e){h.error(e)})},locals:{user:v.user,channel:"mail",interaction:n}})},v.getContactLabel=I,v.getAgentLabel=function(e){if(e.UserId)return e.UserId===v.user.id?t.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return t.instant("DASHBOARDS.NOT_ASSIGNED")},v.getMailAccountLabel=function(e){if(e.Account)return e.Account.key;return t.instant("DASHBOARDS.UNKNOWN")},v.composeMailInteraction=function(e,s){r.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",parent:angular.element(l.body),clickOutsideToClose:!1,locals:{account:s,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){if(!e.message||!e.message.savedAsDraft){var i=e;return d.mailAccount.send({id:s.id},i).$promise.then(function(e){if(e&&e.Messages&&e.Messages.length){if(i.attachments&&i.attachments.length)for(var n=0;n<i.attachments.length;n+=1)d.attachment.update({id:i.attachments[n].id},{MailMessageId:_.head(e.Messages).id});if(c.success({title:"Message properly sent!",msg:"Message has been sent!"}),e.closed){e.disposition=null;var t=!s.mandatoryDisposition,a=v.user.voicePause||v.user.chatPause||v.user.mailPause||v.user.openchannelPause||v.user.faxPause;r.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(l.body),onRemoving:function(){v.user&&s.mandatoryDisposition&&!a&&d.user.unpause({id:v.user.id}).$promise.catch(function(e){h.error(e)})},clickOutsideToClose:t,escapeToClose:t,locals:{user:v.user,channel:"mail",interaction:e}})}else o.$parent.vm.addInteractionTab("mail",e)}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"MAILACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}var n={channel:"mail",account:s,message:e.message,contact:e.contact};u.add(n)}})},v.openAdvancedSearch=function(){r.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(l.body),clickOutsideToClose:!1,locals:{color:v.sectionColor,fields:v.advancedSearch.fields,storagePath:"home.mail"},fullscreen:!0}).then(function(e){v.isSearchBarVisible=!(e.value||!v.query.filter),e.apply&&(v.query.search=e.value,S())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var h=g.getLogger("agent.general.mail");function f(e){return{accounts:v.mailAccounts,accountId:e,filters:v.quickFilters,query:v.query,userId:v.user.id}}function b(e){if(e.UserId===v.user.id){var n=f(e.MailAccountId);p.addAccount("mail",n).then(function(e){e&&S()}).catch(function(e){h.error(e)})}}function A(e){if(e.UserId===v.user.id){var n=f(e.MailAccountId);p.removeAccount("mail",n).catch(function(e){h.error(e)})}}function E(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(v.mailAccounts.rows,function(e){return{model:"mailAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function y(e){!v.reloadingInteractions&&0<v.setting.mailInteractionsReloadTimeout&&N(!0),v.searchInProgress=!1,v.reloadingInteractions=!1,v.mailInteractions=e||{count:0,rows:[]};for(var n=0;n<v.mailInteractions.rows.length;n+=1)I(v.mailInteractions.rows[n])}function S(e){v.searchInProgress=!0,e||(v.query.page=1),(void 0===v.query.closed||null===v.query.closed||v.query.closed)&&delete v.query.substatus,v.query.offset=(v.query.page-1)*v.query.limit;var n=m.localStorage.getItem("motion2.home.mail:"+v.user.id);(n=n?JSON.parse(n):{}).query=v.query,m.localStorage.setItem("motion2.home.mail:"+v.user.id,JSON.stringify(n)),v.promise=d.mailInteraction.get(v.query,y).$promise}function T(e,n){o.$parent.vm.addInteractionTab("mail",n)}function I(e){_.isEmpty(e.to)||!e.Account||_.includes(e.to,e.Account.email)?e.contactInfo=e.Contact?e.Contact.email:void 0:e.contactInfo=e.to.split("<").pop().split(">")[0],"Unknown"===e.contactName&&(e.contactName=t.instant("DASHBOARDS.UNKNOWN"))}function O(e){var n=_.find(v.mailInteractions.rows,{id:e.MailInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function C(e){var n=_.find(v.mailInteractions.rows,{id:e.MailInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function w(e){if(e){var n=_.find(v.mailInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),v.query.sort){var t=_.startsWith(v.query.sort,"-")?"desc":"asc";v.mailInteractions.rows=_.orderBy(v.mailInteractions.rows,_.trimStart(v.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===v.setting.mailInteractionsReloadTimeout&&S(v.query.page)}}function R(e){if(e){var n=_.find(v.mailInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function x(e){if(e&&!e.secret){var n=_.find(v.mailInteractions.rows,{id:e.MailInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function N(e){e&&v.interactionsInterval&&n.cancel(v.interactionsInterval),v.interactionsInterval=n(function(){v.reloadingInteractions=!0,v.searchInProgress||S()},1e3*v.setting.mailInteractionsReloadTimeout)}o.$on("openMailDraft",function(e,s){s.interaction?(s.interaction.isDraft=!0,T(null,s.interaction)):r.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",parent:angular.element(l.body),clickOutsideToClose:!1,locals:{account:s.account,message:s.content,type:"draft",interaction:{}},fullscreen:!0}).then(function(e){if(e){if(!e.message||!e.message.savedAsDraft){var i=e;return d.mailAccount.send({id:s.account.id},i).$promise.then(function(e){if(u.remove(s.id),e&&e.Messages&&e.Messages.length){if(i.attachments&&i.attachments.length)for(var n=0;n<i.attachments.length;n+=1)d.attachment.update({id:i.attachments[n].id},{MailMessageId:_.head(e.Messages).id});if(c.success({title:"Message properly sent!",msg:"Message has been sent!"}),e.closed){e.disposition=null;var t=!s.account.mandatoryDisposition,a=v.user.voicePause||v.user.chatPause||v.user.mailPause||v.user.openchannelPause||v.user.faxPause;r.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(l.body),onRemoving:function(){v.user&&s.account.mandatoryDisposition&&!a&&d.user.unpause({id:v.user.id}).$promise.catch(function(e){h.error(e)})},clickOutsideToClose:t,escapeToClose:t,locals:{user:v.user,channel:"mail",interaction:e}})}else o.$parent.vm.addInteractionTab("mail",e)}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"MAILACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}var n={id:s.id,channel:"mail",account:e.account,message:e.message};u.update(n)}})}),v.resetTooltipPosition=function(e){var n=angular.element(e.currentTarget).children()[1],t=angular.element(n);t.css("top",""),t.css("left",""),t.css("bottom","")},v.adjustTooltipPosition=function(e){var n=angular.element(e.currentTarget).children(),t=n[0],a=n[1],i=angular.element(t),s=angular.element(a),o=m.innerHeight,r=i.offset(),l=r.top,d=r.left,c=o<216+l;s.css("left",d),c?(s.css("top",""),s.css("bottom",o-l)):(s.css("bottom",""),s.css("top",l))},o.$on("$destroy",function(){i.removeAllListeners("mailMessage:save"),i.removeAllListeners("mailMessage:update"),i.removeAllListeners("mailInteraction:save"),i.removeAllListeners("mailInteractionTags:save"),i.removeAllListeners("mailInteraction:update"),i.removeAllListeners("user_has_mail_interactions:save"),i.removeAllListeners("user_has_mail_interactions:remove"),v.interactionsInterval&&n.cancel(v.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","draftManager","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeMailController",e)}(),function(){"use strict";function e(t,a,e,i,n,s,o,r){var l=this;function d(e){l.searchInProgress=!1,l.contacts=e||{count:0,rows:[]}}function c(e,n){l.searchInProgress=!0,s.cmContact.describe({id:l.query.ListId}).$promise.then(function(e){return _(e.toJSON()).omit("UserId").values().map(function(e){return function(e){var n={name:_.startCase(e.displayName),column:e.columnName,options:{}};if(e.custom)switch(e.custom.type){case"text":n.type="text";break;case"select":n.type="multiselect",n.values=_.map(JSON.parse(e.custom.values),function(e,n){return{id:n,name:e.value,value:e.value}}),n.options.field="name";break;case"switch":n.type="select",n.values=[{id:1,translate:"DASHBOARDS.ENABLED"},{id:0,translate:"DASHBOARDS.DISABLED"}],n.options.excludedOperators=["$ne"];break;case"number":n.type="number";break;case"datetime":n.type="date"}else switch(e.columnName){case"dateOfBirth":n.type="date";break;case"CompanyId":n.name="Company",n.type="autocomplete",n.options.route={model:"cmCompany",action:"get",params:{fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;case"ListId":n.name="List",n.type="autocomplete",n.options.route={model:"user",action:"getLists",params:{id:l.currentUser.id,fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;default:_.includes(e.type.toLowerCase(),"int")?n.type="number":_.includes(e.type.toLowerCase(),"date")?n.type="date":n.type="text"}return n}(e)}).value()}).then(function(e){l.advancedSearch.fields=e;var n=_.findIndex(e,function(e){return _.startsWith(e.column,"cf_")})||e.length-1;n<0&&(n=e.length),l.advancedSearch.fields.splice(n,0,{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"DESCRIBE_CM_CONTACTS",msg:e.data?JSON.stringify(e.data.message):e.toString()})}),e||(l.query.page=1),l.query.offset=(l.query.page-1)*l.query.limit;var t=o.localStorage.getItem("motion2.home.mycontacts:"+l.currentUser.id);(t=t?JSON.parse(t):{}).query=l.query,o.localStorage.setItem("motion2.home.mycontacts:"+l.currentUser.id,JSON.stringify(t)),l.query.search&&(l.advancedQuery=_.omit(l.query,"id")),l.promise=l.query.search?s.cmContact.get(l.advancedQuery,d).$promise:s.user.getContacts(l.query,d).$promise}l.currentUser=n.getCurrentUser(),l.lists={},l.contacts={count:0,rows:[]},l.tags={count:0,rows:[]},l.query={includeAll:!0,id:l.currentUser.id,sort:"-updatedAt",limit:10,page:1},l.advancedSearch={fields:[]},l.sectionColor="red",l.getContacts=c,l.refreshContacts=function(){c()},l.mergeContact=function(e,n){i.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.duplicateContact=function(e,n){i.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.openContact=function(e,n){a.$parent.vm.addContactTab(n)},l.call=a.$parent.vm.call,l.onInit=function(){s.cmList.get({fields:"id,name,dialPrefix",sort:"name",nolimit:!0}).$promise.then(function(e){return l.lists=e||{count:0,rows:[]},l.listsMap=_.keyBy(l.lists.rows,"id"),s.tag.get({sort:"name"}).$promise}).then(function(e){l.tags=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"List",key:"ListId",type:"multiselect",label:"CONTACTMANAGER.SELECT_LIST",options:l.lists.rows,clearAll:!1},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:l.tags.rows,placeholder:"DASHBOARDS.TAGS"}]}).catch(function(e){console.error(e)}).finally(function(){var e=o.localStorage.getItem("motion2.home.mycontacts:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.merge(l.query,e.query),_.isEmpty(l.lists.rows)?l.query.ListId=[]:_.isEmpty(l.query.ListId)&&(l.query.ListId=_(l.lists.rows).map("id").take().value()))}catch(e){console.error(e)}else l.query.ListId=_.map(l.lists.rows,"id");l.isSearchBarVisible=!(l.query.search||!l.query.filter),c()})},l.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{color:l.sectionColor,fields:l.advancedSearch.fields,storagePath:"home.mycontacts"},fullscreen:!0}).then(function(e){l.isSearchBarVisible=!(e.value||!l.query.filter),e.apply&&(l.query.search=e.value?e.value+="||User:=$eq["+l.currentUser.id+"]":e.value,c())}).catch(function(e){r.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}}e.$inject=["$document","$scope","$timeout","$mdDialog","Auth","api","$window","toasty"],angular.module("app.dashboards").controller("AgentHomeMyContactsController",e)}(),function(){"use strict";function e(a,n,i,s,t,o,e,r,l,d,c,m,u,p){var g=this;g.user=l.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.openchannelInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,OpenchannelAccountId:[]},g.sectionColor="amber",g.onInit=function(e,n){return g.license=e,g.setting=n,r.user.getOpenchannelAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.openchannelAccounts=e||{count:0,rows:[]},r.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"OpenchannelAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.openchannelAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"OpenchannelAccountId",type:"multiselect",options:{route:{model:"user",action:"getOpenchannelAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){m.parseInteractionsKey("openchannel",g.query,g.user.id,g.openchannelAccounts.rows).then(function(){g.isSearchBarVisible=!(g.query.search||!g.query.filter),y(g.query.page)}),d.on("openchannelInteraction:save",O),d.on("openchannelInteraction:update",O),d.on("openchannelInteractionTags:save",C),d.on("openchannelMessage:save",w),d.on("openchannelMessage:update",w),d.on("user_has_openchannel_interactions:save",T),d.on("user_has_openchannel_interactions:remove",I),d.on("userOpenchannelAccount:save",f),d.on("userOpenchannelAccount:remove",b),0<g.setting.openchannelInteractionsReloadTimeout&&R()})},g.success=E,g.getOpenchannelInteractions=y,g.showOpenchannelInteraction=function(e,n){a.$parent.vm.addInteractionTab("openchannel",n)},g.downloadOpenchannelInteraction=function(e,s,n){r.openchannelInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="openchannel-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadOpenchannelInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&r.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"openchannel",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getOpenchannelAccountLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.composeOpenchannelInteraction=function(e,t){i.show({controller:"ComposeOpenchannelInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/openchannel/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return r.openchannelAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("openchannel",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"OPENCHANNELACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.openchannel"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.openchannel");function h(e){return{accounts:g.openchannelAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.OpenchannelAccountId);u.addAccount("openchannel",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.OpenchannelAccountId);u.removeAccount("openchannel",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.openchannelAccounts.rows,function(e){return{model:"openchannelAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.openchannelInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.openchannelInteractions=e||{count:0,rows:[]};for(var n=0;n<g.openchannelInteractions.rows.length;n+=1)S(g.openchannelInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=t.localStorage.getItem("motion2.home.openchannel:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,t.localStorage.setItem("motion2.home.openchannel:"+g.user.id,JSON.stringify(n)),g.promise=r.openchannelInteraction.get(g.query,E).$promise}function S(e){"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.openchannelInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.openchannelInteractions.rows=_.orderBy(g.openchannelInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.openchannelInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.openchannelInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.openchannelInteractionsReloadTimeout)}a.$on("$destroy",function(){d.removeAllListeners("openchannelMessage:save"),d.removeAllListeners("openchannelMessage:update"),d.removeAllListeners("openchannelInteraction:save"),d.removeAllListeners("openchannelInteractionTags:save"),d.removeAllListeners("openchannelInteraction:update"),d.removeAllListeners("user_has_openchannel_interactions:save"),d.removeAllListeners("user_has_openchannel_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeOpenchannelController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(e,n,t){d.license=e,d.setting=n,d.plugin=t}d.currentUser=o.getCurrentUser(),d.plugin={},d.onInit=c,d.getTrustedURL=function(){return s.trustAsResourceUrl(d.plugin.agentUrl)},c(),n.$on("pluginUpdated",function(e,n){d.plugin=n.plugin})}e.$inject=["$document","$scope","$timeout","$mdDialog","$stateParams","$sce","Auth","api","$window"],angular.module("app.dashboards").controller("AgentHomePluginsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(){d.agentsQuery.offset=(d.agentsQuery.page-1)*d.agentsQuery.limit,l.update("motion2.home.presence.agents:"+d.currentUser.id,d.agentsQuery,"query"),i.user.getPresence(d.agentsQuery).$promise.then(function(e){d.agents={count:e.count,rows:_.filter(e.rows,function(e){return e.id!==d.currentUser.id})}}).catch(function(){r.error({title:t.instant("DASHBOARDS.AGENT_PRESENCE"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")})})}function m(){d.queuesQuery.offset=(d.queuesQuery.page-1)*d.queuesQuery.limit,l.update("motion2.home.presence.queues:"+d.currentUser.id,d.queuesQuery,"query"),i.voiceQueue.get(d.queuesQuery).$promise.then(function(e){return d.voiceQueues=e||{rows:[],count:0},i.rpc.getVoiceQueuesChannels().$promise.then(function(e){e.rows.forEach(function(e){var n=_.find(d.voiceQueues.rows,["name",e.name]);n&&(n.calls||(n.calls=[]),n.calls.push(e))})})}).catch(function(){r.error({title:t.instant("VOICE.VOICEQUEUES"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")})})}function u(e){return 0===d.selectedTab?e:"xcallyQueueExtension"+e}function p(e,n,t,a){var i=_.find(d.agents.rows,["id",e]);i&&(i.status=!1===n?"offline":a?"pause":"unavailable"===t?t:_.includes(["idle","unknown","ringing",null,void 0],t)?"online":"busy")}function g(e){e.id!==d.currentUser.id&&p(e.id,e.online,e.voiceStatus,e.voicePause)}d.currentUser=s.getCurrentUser(),d.agents={count:0,rows:[]},d.agentsQuery={fields:"id,name,internal,online",role:"agent",sort:"name",limit:10,page:1},d.queuesQuery={fields:"id,name",type:"inbound",sort:"name",limit:10,page:1},d.onAgentsTabSelection=function(){if(d.agentsQuery.filter||d.agentsQuery.teams||d.agentsQuery.queues)return;_.merge(d.agentsQuery,l.get("motion2.home.presence.agents:"+d.currentUser.id,"query")),d.isSearchBarVisible=!!d.agentsQuery.filter,a.all([a(function(n,e){i.team.get({fields:"id,name",sort:"name",nolimit:!0}).$promise.then(function(e){d.teams=e||{rows:[],count:0},n()}).catch(function(){r.error({title:t.instant("STAFF.TEAMS"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")}),e()})}),a(function(n,e){i.voiceQueue.get({fields:"id,name",type:"inbound",sort:"name",nolimit:!0}).$promise.then(function(e){d.queues=e||{rows:[],count:0},n()}).catch(function(){r.error({title:t.instant("VOICE.VOICEQUEUES"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")}),e()})})]).then(function(){d.quickFilters=[{name:"Team",key:"teams",type:"multiselect",label:"DASHBOARDS.SELECT_TEAM",options:d.teams.rows},{name:"Queue",key:"queues",type:"multiselect",label:"DASHBOARDS.SELECT_QUEUE",options:d.queues.rows}],c()}).catch(function(){r.error({title:t.instant("DASHBOARDS.AGENT_PRESENCE"),msg:t.instant("DASHBOARDS.ERRORS.FAILED_INITIALIZATION")})})},d.onQueuesTabSelection=function(){if(d.queuesQuery.filter)return;_.merge(d.queuesQuery,l.get("motion2.home.presence.queues:"+d.currentUser.id,"query")),d.isSearchBarVisible=!!d.queuesQuery.filter,m()},d.getAgents=c,d.getVoiceQueues=m,d.originateCall=function(e){n.$broadcast("webrtc::call",{target:u(e)})},d.transferCall=function(e){n.$broadcast("webrtc::transfer",{target:u(e)})},o.on("user:presence",function(e){if(e.id===d.currentUser.id)return;p(e.id,e.online,e.voiceStatus,e.voicePause)}),o.on("user:update",g),o.on("voice_queue_presence:save",function(e){if(!d.voiceQueues&&d.voiceQueues.rows)return;var n=_.find(d.voiceQueues.rows,["name",e.name]);if(!n)return;n.calls||(n.calls=[]);if(_.some(n.calls,["uniqueid",e.uniqueid]))return;n.calls.push(e)}),o.on("voice_queue_presence:remove",function(e){var n=_.find(d.voiceQueues.rows,["name",e.name]);if(!n)return;_.remove(n.calls,["uniqueid",e.uniqueid])}),e.$on("$destroy",function(){o.removeListener("user:update",g),o.removeAllListeners("user:presence"),o.removeAllListeners("voice_queue_presence:save"),o.removeAllListeners("voice_queue_presence:remove")})}e.$inject=["$scope","$rootScope","$translate","$q","api","Auth","socket","toasty","localStorageManager"],angular.module("app.dashboards").controller("AgentHomePresenceController",e)}(),function(){"use strict";function e(e,t,n,a,o,i){var s=this;function r(e){s.searchInProgress=!1,s.voiceRecordings=e||{count:0,rows:[]}}function l(){s.searchInProgress=!0,s.query.offset=(s.query.page-1)*s.query.limit;var e={query:s.query};t.localStorage.setItem("motion2.home.recordings:"+s.currentUser.id,JSON.stringify(e)),s.promise=a.voiceRecording.get(s.query,r).$promise}s.currentUser=i.getCurrentUser(),s.voiceRecordings={},s.table="voiceRecordings",s.query={UserId:s.currentUser.id,fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,rating,audio,transcribeStatus,UserId",sort:"-updatedAt",limit:10,page:1,type:null},s.downloadfile=function(i,e){return a.voiceRecording.download({id:i.id,exists:!0}).$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download",i.uniqueid+i.format),a.click()}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.downloadtranscribe=function(s,e){return a.voiceRecording.downloadTranscribe({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.uniqueid;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.success=r,s.getVoiceRecordings=l,s.onInit=function(){s.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Type",key:"type",type:"select",label:"VOICE.SELECT_TYPE",customOptions:[{value:"internal",translate:"VOICE.INTERNAL"},{value:"inbound",translate:"VOICE.INBOUND"},{value:"outbound",translate:"VOICE.OUTBOUND"},{value:"dialer",translate:"VOICE.DIALER"},{value:null,translate:"VOICE.ALL"}]}];var e=t.localStorage.getItem("motion2.home.recordings:"+s.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(s.query=_.merge(s.query,e.query))}catch(e){console.error(e)}else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};s.query.createdAt=n}s.isSearchBarVisible=!!s.query.filter,l()}}e.$inject=["$scope","$window","$timeout","api","toasty","Auth"],angular.module("app.dashboards").controller("AgentHomeRecordingsController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,r,n){var l=this;function d(e){l.searchInProgress=!1,l.scheduledCalls=e||{count:0,rows:[]}}l.currentUser=n.getCurrentUser(),l.priorities=["Lowest","Low","Medium","High","Highest"],l.crudPermissions={readOnly:!1,canEdit:!0,canDelete:!0},l.scheduledCalls={},l.query={id:l.currentUser.id,fields:"id,phone,scheduledat,recallme,priority,UserId,OwnerId,dialTimezone",sort:"scheduledat",limit:10,page:1},l.queueCampaigns={rows:[],count:0},l.success=d,l.getScheduledCalls=function(){l.searchInProgress=!0,l.query.id=l.currentUser.id,l.query.includeAll=!0,l.query.offset=(l.query.page-1)*l.query.limit,l.query.fields="id,phone,scheduledat,recallme,priority,UserId,OwnerId,dialTimezone";var e={query:l.query};t.localStorage.setItem("motion2.home.scheduled:"+l.currentUser.id,JSON.stringify(e)),l.promise=r.user.getScheduledCalls(l.query,d).$promise},l.onInit=function(){r.user.getQueues({id:n.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){l.queueCampaigns=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"Start Date",key:"scheduledat",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Campaigns",key:"VoiceQueueId",type:"multiselect",label:"MOTIONDIALER.SELECT_CAMPAIGN",options:l.queueCampaigns.rows}]}).catch(function(e){console.error(e)}).finally(function(){var e=t.localStorage.getItem("motion2.home.scheduled:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.omit(e.query,["filter"]))}catch(e){console.error(e)}else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};l.query.scheduledat=n}l.getScheduledCalls()})},l.isDateBeforeToday=function(e){return moment(e).isBefore(moment())},l.createOrEditQueueCampaignHopper=function(e,n){i.show({controller:"CreateOrEditHopperVoiceQueueIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hoppers/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:null,hopper:n,hoppers:l.scheduledCalls.rows,license:null,setting:null,crudPermissions:l.crudPermissions}})},l.deleteConfirm=function(n,e){var t=i.confirm().title("Are you sure want to delete the scheduled call?").htmlContent("<b>Scheduled call</b> will be deleted.").ariaLabel("delete scheduled call").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){var e;e=n,r.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(l.scheduledCalls.rows,{id:e.id}),l.scheduledCalls.count-=1,l.scheduledCalls.rows.length||l.getScheduledCalls(),o.success({title:"Scheduled call deleted!",msg:e.name?"Scheduled call has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETE_HOPPER"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETE_HOPPER",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){console.log("CANCEL")})};var c=!0,m=1;e.$watch("vm.query.filter",function(e,n){c?a(function(){c=!1}):(n||(m=l.query.page),e!==n&&(l.query.page=1),e||(l.query.page=m),l.getScheduledCalls())})}e.$inject=["$scope","$window","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.dashboards").controller("AgentHomeScheduledCallsController",e)}(),function(){"use strict";function e(a,n,i,s,t,o,e,r,l,d,c,m,u,p){var g=this;g.user=l.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.smsInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,SmsAccountId:[]},g.sectionColor="orange",g.onInit=function(e,n){return g.license=e,g.setting=n,r.user.getSmsAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.smsAccounts=e||{count:0,rows:[]},r.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"SmsAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.smsAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"SmsAccountId",type:"multiselect",options:{route:{model:"user",action:"getSmsAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){m.parseInteractionsKey("sms",g.query,g.user.id,g.smsAccounts.rows).then(function(){g.isSearchBarVisible=!(g.query.search||!g.query.filter),y(g.query.page)}),d.on("smsInteraction:save",O),d.on("smsInteraction:update",O),d.on("smsInteractionTags:save",C),d.on("smsMessage:save",w),d.on("smsMessage:update",w),d.on("user_has_sms_interactions:save",T),d.on("user_has_sms_interactions:remove",I),d.on("userSmsAccount:save",f),d.on("userSmsAccount:remove",b),0<g.setting.smsInteractionsReloadTimeout&&R()})},g.success=E,g.getSmsInteractions=y,g.showSmsInteraction=function(e,n){a.$parent.vm.addInteractionTab("sms",n)},g.downloadSmsInteraction=function(e,s,n){r.smsInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="sms-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadSmsInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&r.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"sms",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getSmsAccountLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.composeSmsInteraction=function(e,t){i.show({controller:"ComposeSmsInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/sms/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return r.smsAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("sms",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SMSACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.sms"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.sms");function h(e){return{accounts:g.smsAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.SmsAccountId);u.addAccount("sms",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.SmsAccountId);u.removeAccount("sms",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.smsAccounts.rows,function(e){return{model:"smsAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.smsInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.smsInteractions=e||{count:0,rows:[]};for(var n=0;n<g.smsInteractions.rows.length;n+=1)S(g.smsInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=t.localStorage.getItem("motion2.home.sms:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,t.localStorage.setItem("motion2.home.sms:"+g.user.id,JSON.stringify(n)),g.promise=r.smsInteraction.get(g.query,E).$promise}function S(e){e.contactInfo=e.Contact?e.Contact.mobile:void 0,"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.smsInteractions.rows,{id:e.SmsInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.smsInteractions.rows,{id:e.SmsInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.smsInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.smsInteractions.rows=_.orderBy(g.smsInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.smsInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.smsInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.smsInteractions.rows,{id:e.SmsInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.smsInteractionsReloadTimeout)}a.$on("$destroy",function(){d.removeAllListeners("smsMessage:save"),d.removeAllListeners("smsMessage:update"),d.removeAllListeners("smsInteraction:save"),d.removeAllListeners("smsInteractionTags:save"),d.removeAllListeners("smsInteraction:update"),d.removeAllListeners("user_has_sms_interactions:save"),d.removeAllListeners("user_has_sms_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeSmsController",e)}(),function(){"use strict";function e(n,t,a,i,e,s,o,r){var l=this;function d(e){l.searchInProgress=!1,l.voiceCalls=e||{count:0,rows:[]}}function c(){l.searchInProgress=!0,l.query.offset=(l.query.page-1)*l.query.limit;var e={query:l.query};s.localStorage.setItem("motion2.home.voice:"+l.currentUser.id,JSON.stringify(e)),l.promise=a.voiceCallReport.get(l.query,d).$promise}l.currentUser=e.getCurrentUser(),l.voiceCalls={},l.table="voiceCalls",l.query={UserId:l.currentUser.id,fields:"id,type,uniqueid,tag,starttime,endtime,source,destination,userDisposition,userSecondDisposition,userThirdDisposition,note,duration,billableseconds,answertime",sort:"-updatedAt",limit:10,page:1,type:null},l.success=d,l.getVoiceCalls=c,l.onInit=function(){return a.tag.get({sort:"name"}).$promise.then(function(e){l.tags=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Type",key:"type",type:"select",label:"VOICE.SELECT_TYPE",customOptions:[{value:"internal",translate:"VOICE.INTERNAL"},{value:"inbound",translate:"VOICE.INBOUND"},{value:"outbound",translate:"VOICE.OUTBOUND"},{value:"dialer",translate:"VOICE.DIALER"},{value:null,translate:"VOICE.ALL"}]}]}).catch(function(e){i.error({title:"Init error",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}),l.tags={count:0,rows:[]}}).finally(function(){var e=s.localStorage.getItem("motion2.home.voice:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.merge(l.query,e.query))}catch(e){console.error(e)}else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};l.query.createdAt=n}l.isSearchBarVisible=!!l.query.filter,c()})},l.showDetails=function(e){n.show({controller:"AgentHomeVoiceDetailsController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/voice/details/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{call:e}})}}e.$inject=["$mdDialog","$document","api","toasty","Auth","$window","$scope","$timeout"],angular.module("app.dashboards").controller("AgentHomeVoiceController",e)}(),function(){"use strict";function e(e,n){this.call=n,this.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","call"],angular.module("app.dashboards").controller("AgentHomeVoiceDetailsController",e)}(),function(){"use strict";function e(a,n,i,s,t,o,e,r,l,d,c,m,u,p){var g=this;g.user=l.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.whatsappInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,WhatsappAccountId:[]},g.sectionColor="lime-A700",g.onInit=function(e,n){return g.license=e,g.setting=n,r.user.getWhatsappAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.whatsappAccounts=e||{count:0,rows:[]},r.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"WhatsappAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.whatsappAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"WhatsappAccountId",type:"multiselect",options:{route:{model:"user",action:"getWhatsappAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){m.parseInteractionsKey("whatsapp",g.query,g.user.id,g.whatsappAccounts.rows).then(function(){g.isSearchBarVisible=!(g.query.search||!g.query.filter),y(g.query.page)}),d.on("whatsappInteraction:save",O),d.on("whatsappInteraction:update",O),d.on("whatsappInteractionTags:save",C),d.on("whatsappMessage:save",w),d.on("whatsappMessage:update",w),d.on("user_has_whatsapp_interactions:save",T),d.on("user_has_whatsapp_interactions:remove",I),d.on("userWhatsappAccount:save",f),d.on("userWhatsappAccount:remove",b),0<g.setting.whatsappInteractionsReloadTimeout&&R()})},g.success=E,g.getWhatsappInteractions=y,g.showWhatsappInteraction=function(e,n){a.$parent.vm.addInteractionTab("whatsapp",n)},g.downloadWhatsappInteraction=function(e,s,n){r.whatsappInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="whatsapp-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadWhatsappInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&r.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"whatsapp",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getWhatsappAccountLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.composeWhatsappInteraction=function(e,t){i.show({controller:"ComposeWhatsappInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/whatsapp/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return r.whatsappAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("whatsapp",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"WHATSAPPACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.whatsapp"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.whatsapp");function h(e){return{accounts:g.whatsappAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.WhatsappAccountId);u.addAccount("whatsapp",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.WhatsappAccountId);u.removeAccount("whatsapp",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.whatsappAccounts.rows,function(e){return{model:"whatsappAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.whatsappInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.whatsappInteractions=e||{count:0,rows:[]};for(var n=0;n<g.whatsappInteractions.rows.length;n+=1)S(g.whatsappInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=t.localStorage.getItem("motion2.home.whatsapp:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,t.localStorage.setItem("motion2.home.whatsapp:"+g.user.id,JSON.stringify(n)),g.promise=r.whatsappInteraction.get(g.query,E).$promise}function S(e){e.contactInfo=e.Contact?e.Contact.mobile:void 0,"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.whatsappInteractions.rows,{id:e.WhatsappInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.whatsappInteractions.rows,{id:e.WhatsappInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.whatsappInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.whatsappInteractions.rows=_.orderBy(g.whatsappInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.whatsappInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.whatsappInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.whatsappInteractions.rows,{id:e.WhatsappInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.whatsappInteractionsReloadTimeout)}a.$on("$destroy",function(){d.removeAllListeners("whatsappMessage:save"),d.removeAllListeners("whatsappMessage:update"),d.removeAllListeners("whatsappInteraction:save"),d.removeAllListeners("whatsappInteractionTags:save"),d.removeAllListeners("whatsappInteraction:update"),d.removeAllListeners("user_has_whatsapp_interactions:save"),d.removeAllListeners("user_has_whatsapp_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeWhatsappController",e)}(),function(){"use strict";function e(e,n){var t=this;t.setting={},t.messages={count:0,rows:[]},t.showInteraction=!1,t.init=function(e,n){t.setting=n,t.tab=e,t.tab.saved=!0},t.getTrustedURL=function(){return n.trustAsResourceUrl(t.tab.src)}}e.$inject=["$scope","$sce"],angular.module("app.dashboards").controller("AgentGeneralIframeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v){var h=this,f=25,b=1024*f*1024;function A(){var e=h.user.voicePause||h.user.chatPause||h.user.mailPause||h.user.openchannelPause||h.user.faxPause,n=!h.tab.interaction.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(t.body),clickOutsideToClose:n,escapeToClose:n,onRemoving:function(){h.user&&h.interaction.Account.mandatoryDisposition&&!e&&l.user.unpause({id:h.user.id}).$promise.catch(function(e){d.error(e.data?e.data.message:e.toString())})},locals:{user:h.user,channel:h.tab.channel,interaction:h.tab.interaction}}).then(function(e){h.tab.saved=Boolean(e),e&&a.$parent.$parent.$parent.vm.closeTab(h.tab)})}function E(e,n){h.tab.message=n,i.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:h.tab.message,type:e,interaction:h.interaction},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){if(e)if(e.message&&e.message.savedAsDraft)h.draft?p.update({id:h.draft.id,channel:"mail",account:h.account,message:e.message,contact:h.contact,interaction:h.interaction}):p.add({channel:"mail",account:h.account,message:e.message,contact:h.contact,interaction:h.interaction}),h.draft=p.getByInteraction(h.tab.interaction.id);else{var n=e;n&&S(n),n.Interaction&&h.interaction&&h.interaction.id&&(n.Interaction.id=h.interaction.id,l.mailInteraction.update(n.Interaction).$promise.then(function(e){e&&e.closed?(h.tab.saved=!0,h.interaction.closed=!0,A()):null!==n.Interaction.substatus&&(h.tab.saved=!0,h.tab.interaction.substatus=n.Interaction.substatus,a.$parent.$parent.$parent.vm.closeTab(h.tab))}).catch(function(e){d.error(e.data?e.data.message:e.toString())}))}}).finally(function(){h.tab.isDraft=!1})}function y(){"mail"!==h.tab.channel&&n(function(){var e=angular.element(t.find("md-content[name*='interaction-content-"+h.tab.id+"']"));e&&e[0]&&(e[0].scrollTop=e[0].scrollHeight)},0)}function S(i){if(i)return i["chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId"]=h.interaction["chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId"],i[_.capitalize(h.tab.channel)+"InteractionId"]=h.interaction.id,i.UserId=h.user.id,i.ContactId=h.interaction.ContactId,i.direction="out",i.secret=Boolean(h.tab.spy||i.secret),l[h.tab.channel+"Message"].save(i).$promise.then(function(e){if(e&&e.id&&!_.isEmpty(i.attachments)){for(var n=[],t=0;t<i.attachments.length;t++){var a=i.attachments[t];a.MailMessageId?n.push(l.attachment.clone({id:a.id},{name:a.name,basename:a.basename,type:a.type,MailMessageId:e.id}).$promise):n.push(l.attachment.update({id:a.id},{MailMessageId:e.id}).$promise)}return s.all(n)}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:SENDMESSAGE",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){"mail"===h.tab.channel&&i.isDraft&&(p.removeByInteraction(h.interaction.id),h.draft=null),h.tab.areaText="",y()})}function T(e){switch(h.tab.channel){case"mail":h.draft.content.originalMessage=e?_.find(h.interaction.Messages,["id",e]):h.interaction.Messages[h.interaction.Messages.length-1],E(h.draft.type,h.draft.content)}}function I(e){h.journeyIsLoading=!0;var n=_.merge(h.journeyOptions,{id:h.contact.id,offset:e||0});return g.get(h.journey,n).then(function(e){h.journey=e.journey,h.canLoadMoreJourney=e.loadMore}).finally(function(){h.journeyIsLoading=!1})}h.showFooter=!1,h.BTNLoadMore=0,h.showInteraction=!1,h.user=c.getCurrentUser(),h.detectBrowser=u.detectBrowser(),h.journey=[],h.acceptedMessages=[],h.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:b,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},h.ngFlow={flow:{}},h.selectedMailShowDetails={},h.selectedMailShowSystemMessage={},h.setting={},h.ctrlMethods={},h.embedOptions={fontSmiley:!0,sanitizeHtml:!0,emoji:!0,link:!0,linkTarget:"_blank"},h.journeyOptions=g.getQuery(),h.quickFilters=g.getQuickFilters(),h.init=function(e,n){h.tab=e,h.tab.saved=!0,h.tab.badges=0,h.setting=n||{},h.tab&&h.tab.channel&&h.tab.interaction&&(h.interaction=h.tab.interaction,l[h.tab.channel+"Interaction"].get({id:h.tab.interaction.id,includeAll:!0}).$promise.then(function(e){return e&&(h.interaction=e,h.tab.interaction=e),h.tab.saved=h.interaction.closed,h.queryMessage={id:h.interaction.id,includeAll:!0},"mail"===h.tab.channel?(h.queryMessage.sort="-id",h.queryMessage.offset=0,h.queryMessage.limit=3,h.queryMessage.inlineCss=!0):(h.queryMessage.sort="id",h.queryMessage.nolimit=!0),l[h.tab.channel+"Interaction"].getMessages(h.queryMessage).$promise}).then(function(e){return e&&(h.BTNLoadMore=e.count-h.queryMessage.limit),h.messages=e||{count:0,rows:[]},l["chat"===h.tab.channel?"chatWebsite":h.tab.channel+"Account"].get({id:h.interaction["chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId"]}).$promise}).then(function(e){if(h.account=e,h.tab.title=h.account.key||h.account.name,h.interaction.ContactId)return l.cmContact.get({id:h.interaction.ContactId}).$promise}).then(function(e){return e&&(h.contact=e),h.showInteraction=!0,h.contact?h.tab.title+=" - "+(h.user.privacyEnabled?v.mask(h.contact.firstName):h.contact.firstName):h.tab.title+=" - "+r.instant(h.tab.channel.toUpperCase()+".UNKNOWN"),l.user.get({fields:"id,fullname",nolimit:!0}).$promise}).then(function(e){h.users=e||{count:0,rows:[]},h.usersMap=_.mapValues(_.keyBy(h.users.rows,"id"),"fullname")}).then(function(){if(h.tab.channel&&h.interaction)return l.user["add"+_.upperFirst(h.tab.channel)+"Interactions"]({id:h.user.id,ids:[h.interaction.id]})}).then(function(){return l.mailSubstatus.get({sort:"name",nolimit:!0}).$promise}).then(function(e){h.subStatuses=e||{count:0,rows:[]}}).catch(function(){h.showInteraction=!0}).finally(function(){h.contact&&I(),function(){switch(h.user.role){case"admin":return h.downloadPermissions={attachments:!0,interactions:!0};case"agent":return h.downloadPermissions={attachments:h.user.downloadAttachments,interactions:h.user.downloadOmnichannelInteractions};case"user":l.userProfile.get({id:h.user.userProfileId,fields:"downloadAttachments,downloadOmnichannelInteractions"}).$promise.then(function(e){h.downloadPermissions={attachments:e.downloadAttachments,interactions:e.downloadOmnichannelInteractions}}).catch(function(){h.downloadPermissions={attachments:!1,interactions:!1}})}}(),function(){if(!h.tab.spy&&!h.interaction.closed){var t=[];if(h.messages.rows.forEach(function(e){if("in"===e.direction&&!e.read){var n=0===t.length;t.push(l[h.tab.channel+"Message"].accept({id:e.id,UserId:h.user.id,manual:n}).$promise),h.acceptedMessages.push(e.id)}}),"mail"===h.tab.channel){var e=_(h.interaction.Messages).filter({read:!1,direction:"in"}).differenceBy(h.messages.rows,"id").value();e.forEach(function(e){t.push(l.mailMessage.accept({id:e.id,UserId:h.user.id}).$promise),h.acceptedMessages.push(e.id)})}s.all(t)}}(),y(),m.on(h.tab.channel+"Message:save",h.onMessageSave),m.on(h.tab.channel+"Message:update",h.onMessageSave),m.on(h.tab.channel+"Interaction:save",h.onInteractionSave),m.on(h.tab.channel+"Interaction:update",h.onInteractionSave),m.on("user_has_"+h.tab.channel+"_interactions:save",h.onInteractionOpen),m.on("user_has_"+h.tab.channel+"_interactions:remove",h.onInteractionClose),h.tab.areaText=h.tab.areaText?h.tab.areaText:"",h.showFooter=!0,"mail"===h.tab.channel&&(h.draft=p.getByInteraction(h.tab.interaction.id),h.tab.isDraft&&(h.tab.interaction.closed?(p.removeByInteraction(h.tab.interaction.id),h.draft=null):T()))}))},h.getLabelByMessage=function(e){var n="loading...";if(e)return"in"===e.direction?e.Contact?e.Contact.firstName||"Anonymous":n:e.UserId?h.usersMap?h.usersMap[e.UserId]:n:"System"},h.openContact=function(e,n){try{h.tab&&!h.tab.spy&&a.$parent.$parent.$parent.vm.addContactTab(n||h.contact)}catch(e){d.error({title:"ERROR OPEN CONTACT",msg:"Unable to open the contact"})}},h.openInteraction=function(e){try{if(e.MailAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("mail",e);if(e.ChatWebsiteId)return a.$parent.$parent.$parent.vm.addInteractionTab("chat",e);if(e.SmsAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("sms",e);if(e.WhatsappAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("whatsapp",e);if(e.OpenchannelAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("openchannel",e);if(e.FaxAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("fax",e)}catch(e){d.error({title:"ERROR OPEN INTERACTION",msg:"Customer Journey can't open the interaction"})}},h.disposeInteraction=A,h.tagInteraction=function(){i.show({controller:"TagInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/tag/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,skipHide:Boolean(h.tab.spy),resolve:{tags:["apiResolver",function(e){return e.resolve("tag@get",{sort:"name",nolimit:!0,fields:"id,name,color"})}]},locals:{channel:h.tab.channel,interaction:h.tab.interaction}})},h.composeMailInteraction=function(n,e){if(e.inReplyTo){var t=_.find(h.messages.rows,{messageId:e.inReplyTo});if(!t)return l.mailMessage.get({messageId:e.inReplyTo}).$promise.then(function(e){E(n,e&&e.count?e.rows[0]:void 0)}).catch(function(e){d.error(e.data?e.data.message:e.toString()),E(n,void 0)});E(n,t)}else E(n,e)},h.composeFaxInteraction=function(e){var n={to:[]};n.to.push(h.contact.fax),i.show({controller:"ComposeFaxInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/fax/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0}).then(function(e){return l.faxAccount.send({id:h.account.id},e).$promise.then(function(e){d.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("fax",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else d.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()})})})},h.composeSmsInteraction=function(e,n){i.show({controller:"ComposeSmsInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/sms/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.composeWhatsappInteraction=function(e,n){i.show({controller:"ComposeWhatsappInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/whatsapp/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.composeChatInteraction=function(e,n){i.show({controller:"ComposeChatInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/chat/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.composeOpenchannelInteraction=function(e,n){i.show({controller:"ComposeOpenchannelInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/openchannel/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.transferLastMessage=function(){if(h.interaction){var e=_.findLast(h.messages.rows,function(e){return"in"===e.direction});e?i.show({controller:"TransferMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/transfer/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,interaction:h.interaction,message:e,channel:h.tab.channel},resolve:{agents:["apiResolver",function(e){var n={fields:"id,name",$id:{ne:h.user.id},role:"agent",online:!0,sort:"name",nolimit:!0};return n[h.tab.channel+"Pause"]=!1,e.resolve("user@get",n)}],queues:["apiResolver",function(e){return e.resolve(h.tab.channel+"Queue@get",{fields:"id,name",sort:"name",nolimit:!0})}]}}).then(function(e){h.tab.saved=Boolean(e),e&&a.$parent.$parent.$parent.vm.closeTab(h.tab)}):d.error({title:"Invalid transfer",msg:"Message not found!"})}},h.downloadMessage=function(s,e){h.tab.channel&&s.id&&l[h.tab.channel+"Message"].download({id:s.id,attachments:e}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=h.tab.channel+"-message"+s.id+".eml";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.downloadMessage.get",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.downloadInteraction=function(s,e){h.tab.channel&&s.id&&l[h.tab.channel+"Interaction"].download({id:s.id,attachments:e}).$promise.then(function(e){var n=[e.buffer],t=h.tab.channel+"-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.inteactionMessage.get",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.openDraft=T,h.createVidaooSession=function(e){var n={id:e.id,account:e.Account,contact:e.Contact};return l.chatInteraction.createVidaooSession(n).$promise.then(function(){d.success({title:"Start Video Call",msg:"Session properly created."})}).catch(function(){d.error({title:"Start Video Call",msg:"Unable to create session!"})})},h.reply=function(e,n){if(e&&13===e.keyCode&&e.shiftKey)return;if(e&&13!==e.keyCode)return;if(""===n.trim())return;S(function(e){var n={},t="chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId";n[t]=h.interaction[t].toString(),n[_.capitalize(h.tab.channel)+"InteractionId"]=h.interaction.id,("sms"===h.tab.channel||"whatsapp"===h.tab.channel)&&(n.phone=h.interaction.phone);e&&(n.UserId=h.user.id,n.ContactId=h.interaction.ContactId,n.body=e);return n}(n.trim()))},h.upload=function(){h.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},h.ngFlow.flow.upload()},h.fileAdded=function(e){if(e.size>b)return d.error({title:"File too big",msg:"The max allowed size is "+f+"MB"}),!1;return!0},h.fileSuccess=function(e,n){var t=JSON.parse(n),a=t.name;"chat"===h.tab.channel&&(a='<a href="'+(h.account.remote?h.account.remote:o.protocol()+"://"+o.host())+"/api/chat/interactions/"+h.interaction.id+"/attachment_download?attachId="+t.id+"&token="+h.account.token+'" target="_self">'+t.name+"</a>");S({body:a,AttachmentId:t.id})},h.onMessageSave=function(e){if(e&&h.interaction.id!=e[_.capitalize(h.tab.channel)+"InteractionId"])return;var n=!1;h.messages?n=_.find(h.messages.rows,{id:e.id}):h.messages={rows:[],count:0};n?_.merge(n,e):("mail"===h.tab.channel?h.messages.rows.unshift(e):h.messages.rows.push(e),y())},h.onInteractionSave=function(e){if(e&&h.interaction.id!==e.id)return;e.closed&&(h.tab.saved=!0);_.merge(h.interaction,e)},h.searchTextChange=function(n){var t=s.defer(),a=[],e={},i="chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId";return e.filter=n,e[i]=h.account.id,l.cannedAnswer.get(e).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},h.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:h.user,account:h.account,interaction:h.interaction,contact:h.interaction&&h.interaction.Contact?h.interaction.Contact:{}};""!==h.tab.areaText&&(h.tab.areaText+=" "),h.tab.areaText+=e(t),h.ctrlMethods.setText(h.tab.areaText)}catch(e){""!==h.tab.areaText&&(h.tab.areaText+=" "),h.tab.areaText+=n.value,h.ctrlMethods.setText(h.tab.areaText)}h.selectedItem=null,h.changeDisplayCannedAnswerInputValue()}},h.getMessagesAlignment=function(e){if(e.secret&&h.user.id!=e.UserId)return"in";switch(h.setting.messagesAlignment){case"left":return"in"==e.direction?e.direction:"out-left-aligned";case"right":return"in"==e.direction?"in-right-aligned":e.direction;default:return e.direction}},h.displayCannedAnswerInput=!1,h.changeDisplayCannedAnswerInputValue=function(){h.displayCannedAnswerInput=!h.displayCannedAnswerInput},h.setAs=function(e){h.tab.channel&&h.interaction&&h.interaction.id&&l[h.tab.channel+"Interaction"].update({id:h.interaction.id,substatus:e}).$promise.catch(function(e){d.error(e.data?e.data.message:e.toString())})},h.markAsUnread=function(){if(h.tab.channel&&h.interaction&&h.interaction.id)if(h.acceptedMessages.length)for(var e=0;e<h.acceptedMessages.length;e+=1)l[h.tab.channel+"Message"].update({id:h.acceptedMessages[e],read:!1,UserId:null});else for(var n=0;n<h.messages.rows.length;n+=1)if("in"===h.messages.rows[n].direction){h.messages.rows[n].UserId===h.user.id?l[h.tab.channel+"Message"].update({id:h.messages.rows[n].id,read:!1,UserId:null}):d.error({title:"You can't mark as unread",msg:"You are not the owner of the last message!"});break}h.tab.saved=!0,a.$parent.$parent.$parent.vm.closeTab(h.tab)},h.getAttachments=function(n){return l.attachment.get({MailMessageId:n.id}).$promise.then(function(e){e&&e.rows&&(n.attachments=e.rows)}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"ATTACHMENTS:GET",msg:e.data?JSON.stringify(e.data):e.toString()})})},h.getAttachment=function(i){return l.attachment.download({id:i.id}).$promise.then(function(e){if(e){var n=new Blob([e.buffer],{type:e.type}),t=document.createElement("a"),a=window.URL.createObjectURL(n);t.href=a,t.target="_self",t.download=i.name,document.body.appendChild(t),t.click(),setTimeout(function(){document.body.removeChild(t),window.URL.revokeObjectURL(a)},100)}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"ATTACHMENTS:GET",msg:e.data?JSON.stringify(e.data):e.toString()})})},h.htmlToPlaintext=function(e){return e?String(e).replace(/<[^>]+>/gm,""):""},h.onInteractionOpen=function(e){var n;h.interaction.id==e[_.upperFirst(h.tab.channel)+"InteractionId"]&&(h.interaction.Users&&(n=_.find(h.interaction.Users,{id:e.UserId})),n||h.interaction.Users.push({id:e.UserId}))},h.onInteractionClose=function(e){h.interaction.id==e[_.upperFirst(h.tab.channel)+"InteractionId"]&&h.interaction.Users&&_.remove(h.interaction.Users,{id:e.UserId})},h.getCustomerJourney=I,h.loadNextPage=function(){var t=s.defer();if(h.queryMessage)return h.queryMessage.offset=h.messages.rows.length,l[h.tab.channel+"Interaction"].getMessages(h.queryMessage).$promise.then(function(e){for(var n=0;n<e.rows.length;n+=1)h.messages.rows.push(e.rows[n]),h.interaction.closed||"in"!==e.rows[n].direction||e.rows[n].read||(l[h.tab.channel+"Message"].accept({id:e.rows[n].id,UserId:h.user.id}),h.acceptedMessages.push(e.rows[n].id));return 0<e.rows.length&&(h.BTNLoadMore=h.BTNLoadMore-e.rows.length),t.resolve(e)}).catch(function(e){return t.reject(e)});return t.reject()},h.interactionTimelineOptions={scrollEl:"#interaction-content"},h.loadMoreJourney=function(){return s(function(e){var n=h.journey.length;return e(I(n))})},h.journeyTimelineOptions={scrollEl:"#journey-content"},a.$on("$destroy",function(){m.removeAllListeners(h.tab.channel+"Message:save"),m.removeAllListeners(h.tab.channel+"Message:update"),m.removeAllListeners(h.tab.channel+"Interaction:save"),m.removeAllListeners(h.tab.channel+"Interaction:update"),m.removeAllListeners("user_has_"+h.tab.channel+"_interactions:save"),m.removeAllListeners("user_has_"+h.tab.channel+"_interactions:remove")})}function n(a){return{scope:{ngBindHtmlUnsafe:"="},template:"<div ng-bind-html='trustedHtml'></div>",link:function(t){t.updateView=function(){var e,n=_.replace(t.ngBindHtmlUnsafe,'<div id="xm-mail-content"','<a style="cursor:pointer" class="toggle-details md-accent-color" onclick="document.getElementById(\''+(e="xm-mail-content-"+Math.floor(9999*Math.random()+1))+"').style.display='block'; this.parentNode.removeChild(this)\">See More</a><div id=\""+e+'" style="display:none"');t.trustedHtml=a.trustAsHtml(n)},t.$watch("ngBindHtmlUnsafe",function(e){t.updateView(e)})}}}e.$inject=["$cookies","$timeout","$document","$scope","$mdDialog","$q","$location","$translate","api","toasty","Auth","socket","msUtils","draftManager","customerJourneyManager","privacyManager"],n.$inject=["$sce"],angular.module("app.dashboards").directive("ngBindHtmlUnsafe",n).controller("AgentGeneralInteractionController",e)}(),function(){"use strict";angular.module("app.dashboards").factory("Emojis",function(){return{watchEmbedData:!1,sanitizeHtml:!1,fontSmiley:!1,emoji:!0,link:!0,linkTarget:"_blank",pdf:{embed:!0},image:{embed:!0},audio:{embed:!0},basicVideo:!1,gdevAuth:"xxxxxxxx",video:{embed:!1,width:null,height:null,ytTheme:"dark",details:!1,thumbnailQuality:"medium",autoPlay:!0},twitchtvEmbed:!0,dailymotionEmbed:!0,tedEmbed:!0,dotsubEmbed:!0,liveleakEmbed:!0,ustreamEmbed:!0,soundCloudEmbed:!0,soundCloudOptions:{height:160,themeColor:"f50000",autoPlay:!1,hideRelated:!1,showComments:!0,showUser:!0,showReposts:!1,visual:!1,download:!1},spotifyEmbed:!0,tweetEmbed:!0,tweetOptions:{maxWidth:550,hideMedia:!1,hideThread:!1,align:"none",lang:"en"},code:{highlight:!0,lineNumbers:!1},codepenEmbed:!0,codepenHeight:300,jsfiddleEmbed:!0,jsfiddleHeight:300,jsbinEmbed:!0,jsbinHeight:300,plunkerEmbed:!0,githubgistEmbed:!0,ideoneEmbed:!0,ideoneHeight:300}})}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,ChatAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e.mobile&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.mobile&&(n+=e.lastName+" ");return n+="<"+e.mobile+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId)return l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,mobile"}).$promise.then(function(e){return e.rows});return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e.mobile;if(t=n,/^(\+|\d)[0-9]{7,16}$/.test(t))return n;var t;return d.error("Mobile "+n+" is not valid"),null},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeChatInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this,m=25,u=1024*m*1024;c.separatorKeys=[a.KEY_CODE.ENTER,a.KEY_CODE.COMMA,a.KEY_CODE.TAB],c.message={from:i.localstationid,to:_.isNil(s.to)||_.isEmpty(s.to)?[]:s.to,attachments:[]},c.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:u,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},c.ngFlow={flow:{}},c.send=function(e){1===c.message.attachments.length?c.message.to.length?(s.draft=void 0,t.hide({from:c.message.from,to:c.message.to,attach:c.message.attachments.length,attachments:c.message.attachments})):l.error("To is mandatory"):l.error("Attachment is mandatory")},c.upload=function(){c.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},c.ngFlow.flow.upload()},c.fileSuccess=function(e,n){try{(n=JSON.parse(n)).size=e.size,c.message.attachments.push(n)}catch(e){console.error(e)}},c.fileAdded=function(e){var n=["pdf","tif"];if(!_.includes(n,e.getExtension()))return l.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extensions: "+n.join()}),!1;if(e.size>u)return l.error({title:"File too big",msg:"The max allowed size is "+m+"MB"}),!1;return!0},c.getContact=function(e){var n="";e.firstName&&e.firstName!==e.fax&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.fax&&(n+=e.lastName+" ");return n+="<"+e.fax+">"},c.contactSearch=function(e){return i&&i.ListId?r.cmContact.get({ListId:i.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,fax"}).$promise.then(function(e){return e.rows}):[]},c.transformContact=function(e){var n=e;if(_.isObject(e))return e.fax;if(t=n,!/[&\/\\#,()$~%.'":;*?<>{}\s\\|a-zA-Z\pS!òàùè…_§°çéì-]/.test(t))return n;var t;return l.error("Fax "+n+" is not valid"),null},c.closeDialog=function(){s.draft=c.message,t.cancel()}}e.$inject=["$cookies","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q"],angular.module("app.dashboards").controller("ComposeFaxInteractionDialogController",e)}(),function(){"use strict";function e(n,e,i,t,a,s,o,r,l,d,c,m,u,p){var g=this,v=25,h=1024*v*1024;g.currentUser=m.getCurrentUser(),g.secret="note"===r,g.hiddenCC=!0,g.hiddenBCC=!0,g.verifySmtp=!0,g.errors=[],g.separatorKeys=[t.KEY_CODE.ENTER,t.KEY_CODE.COMMA,t.KEY_CODE.TAB],g.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,MailAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},g.selectedItemChange=function(n){if(n&&n.value&&g.ckEditorInstance)try{var e=_.template(n.value),t={user:g.currentUser,account:s,interaction:u,contact:u&&u.Contact?u.Contact:{}};g.ckEditorInstance.insertHtml(e(t))}catch(e){console.error(e),g.ckEditorInstance.insertHtml(n.value)}document.getElementById("html-area").focus(),g.selectedItem=null},g.onReadyEditor=function(e){try{g.ckEditorInstance=CKEDITOR.instances["html-area"]}catch(e){console.error("Unable to get Html Editor instance",e)}},_.templateSettings.interpolate=/{{([\s\S]+?)}}/g,g.fromTemplate=_.template("{{ name }} <{{ email }}>"),g.replyTemplate=_.template("On {{ date }}, at {{ time }}, {{ from }} wrote:"),g.forwardTemplate=_.template("Begin forwarded message:<br><br><strong>From:</strong> {{ from }}<br><strong>Subject:</strong> {{ subject }}<br><strong>Date:</strong> {{ date }}, at {{ time }}<br><strong>To:</strong> {{ to }}"),g.message={from:g.fromTemplate({name:s.name,email:s.email||s.Smtp.user}),to:[],cc:[],bcc:[],body:S(),type:r,attachments:[],showLastMessage:!0},g.draft=null,g.ckeditor={skin:"office2013",startupFocus:!0,language:"en",allowedContent:!0,extraPlugins:"font,colorbutton,autogrow,autoembed,autocorrect,googlethisterm,pastebase64",toolbarGroups:[{name:"styles",groups:["styles"]},{name:"clipboard",groups:["undo"]},{name:"colors",groups:["colors"]},{name:"basicstyles",groups:["basicstyles"]},{name:"paragraph",groups:["list","indent","align"]}],autoGrow_onStartup:!0,autoGrow_minHeight:g.secret?160:300,autoGrow_maxHeight:e.innerHeight-400,autocorrect_enabled:!0,disableNativeSpellChecker:!1,enterMode:CKEDITOR.ENTER_BR,font_defaultLabel:s.fontFamily?s.fontFamily.split(",")[0]:"Arial",fontSize_defaultLabel:s.fontSize||"12",removePlugins:"magicline"};for(var f=[],b=8;b<=72;b++)f.push(b+"/"+b+"pt");g.ckeditor.fontSize_sizes=f.join(";"),g.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:h,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},g.ngFlow={flow:{}},g.reply=function(e){angular.isDefined(o)&&(g.message.type="reply",g.message.to="in"===o.direction?o.from.split(","):o.to.split(","),g.message.subject=_.startsWith(o.subject,"Re:")?o.subject:"Re: "+o.subject,g.message.inReplyTo=o.messageId,g.message.body=S(),g.message.attachments=[],e&&o.cc&&(g.hiddenCC=!1,g.message.cc=o.cc.split(",")),g.message.showLastMessage=!1)},g.newMail=function(){angular.isDefined(o)&&(g.message.type="new",g.message.to=o.to?o.to.split(","):[])},g.forward=function(){if(angular.isDefined(o)){if(g.message.type="forward",g.message.subject=_.startsWith(o.subject,"Fwd:")?o.subject:"Fwd: "+o.subject,g.message.body=S(),o.Attachments&&o.Attachments.length)for(var e=0;e<o.Attachments.length;e++)g.message.attachments.push(o.Attachments[e]);g.message.showLastMessage=!1}},g.editDraft=function(){g.isDraft=!0,angular.isDefined(o)&&(o.savedAsDraft=!1,g.message=angular.copy(o),_.isEmpty(g.message.cc)||(g.hiddenCC=!1),_.isEmpty(g.message.bcc)||(g.hiddenBCC=!1))},g.send=function(e,n,t){if(!A&&g.message.to&&g.message.body)if(g.message.to.length)if(_.isEmpty(g.message.subject)){var a=i.confirm({skipHide:!0}).title("Warning").textContent("This message has no subject. Are you sure you want to send it?").ariaLabel("Warning").targetEvent(e).ok("Send Anyway").cancel("Cancel");i.show(a).then(function(){E(n,t)})}else E(n,t);else d.error("To is mandatory");A=!1},g.note=function(){g.type="note",g.secret=!0,g.message.body='<div style="font-family:'+s.fontFamily+";font-size:"+s.fontSize+'pt"><p></p></div>'},g.addNote=function(){g.message.body&&i.hide({secret:!0,body:g.message.body,attach:g.message.attachments.length,attachments:g.message.attachments})},g.upload=function(e){g.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+n.get("motion.token")},g.ngFlow.flow.upload()},g.fileSuccess=function(e,n){try{(n=JSON.parse(n)).size=e.size,g.message.attachments.push(n)}catch(e){console.error(e)}},g.removeAttachment=function(e){g.message.attachments=_.reject(g.message.attachments,{id:e.id}),e.MailMessageId||l.attachment.delete({id:e.id}).$promise.catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.attachment.delete",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.fileAdded=function(e){if(e.size>h)return d.error({title:"File too big",msg:"The max allowed size is "+v+"MB"}),!1;return!0},g.getContact=function(e){var n="";e.firstName&&e.firstName!==e.email&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.email&&(n+=e.lastName+" ");return n+="<"+e.email+">"},g.contactSearch=function(e){return s&&s.ListId?l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,email"}).$promise.then(function(e){return e.rows}):[]},g.transformContact=function(e,n){if(_.isObject(e))return(g.contact=e).email;if(_.isString(e)){if(y(e))return g.contact={email:e},e;for(var t=e.split(","),a=0;a<t.length;a+=1)y(t[a])?_.isArray(n)&&_.indexOf(n,t[a])<0&&n.push(t[a]):d.error("Email "+t[a]+" is not valid");return g.contact={email:e.split(",")[0]},null}return d.error("Email field is not valid"),null},g.saveDraft=function(){g.message.savedAsDraft=!0,g.draft=p.getByInteraction(u.id);var e={account:s,message:g.message,contact:g.contact,interaction:u};if(g.draft&&!g.isDraft){var n=i.confirm({skipHide:!0}).title(a.instant("DASHBOARDS.DRAFT_SAVE_WARNING_TITLE")).content(a.instant("DASHBOARDS.DRAFT_SAVE_WARNING_MESSAGE")).ariaLabel("Save draft").ok(a.instant("DASHBOARDS.OVERWRITE")).cancel(a.instant("DASHBOARDS.CANCEL"));i.show(n).then(function(){i.hide(e)})}else i.hide(e)},g.closeDialog=function(){i.cancel()},g.loadLastMessage=function(){g.message.body+=T(g.message.type)};var A=!(g.keyPress=function(e){13===e.keyCode&&(A=!0)});switch(r){case"reply":g.reply(!1);break;case"replyAll":g.reply(!0);break;case"forward":g.forward();break;case"draft":g.editDraft();break;case"new":g.newMail();break;case"note":g.note()}function E(e,n){var t={from:g.message.from,to:g.message.to.join(","),cc:g.message.cc.join(","),bcc:g.message.bcc.join(","),subject:g.message.subject,body:g.message.showLastMessage?g.message.body:g.message.body+T(g.message.type),inReplyTo:g.message.inReplyTo,attach:g.message.attachments.length,attachments:g.message.attachments,Interaction:{lastMsgDirection:"out",substatus:n},isDraft:g.isDraft};t.html='<div id="xm-mail-content">'+_.replace(t.body,'<div id="xm-mail-content"',"<div")+"</div>",e&&(t.Interaction.closed=!0),i.hide(t)}function y(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)}function S(){return'<div style="font-family:'+s.fontFamily+";font-size:"+s.fontSize+'pt">'+function(){if(_.isNil(s.template))return"";try{return _.template(s.template)({user:g.currentUser,account:s,interaction:u,contact:u&&u.Contact?u.Contact:{}})}catch(e){return console.error(e),""}}()+"</div>"}function T(e){var n='<div id="xm-mail-content"><blockquote type="cite">';switch(e){case"reply":case"replyAll":n+=g.replyTemplate({date:moment(o.createdAt).format("D MMM YYYY")||"",time:moment(o.createdAt).format("HH:mm")||"",from:_.escape(o.from)||""});break;case"forward":n+=g.forwardTemplate({date:moment(o.createdAt).format("D MMM YYYY")||"",time:moment(o.createdAt).format("HH:mm")||"",from:_.escape(o.from)||"",to:_.escape(o.to)||"",subject:_.escape(o.subject)||""})}var t,a,i=g.message.showLastMessage&&o.originalMessage||g.isDraft?o.originalMessage.body:o.body;return n+="<br><br>",n+=(t=i?_.replace(i,'<div id="xm-mail-content"',"<div"):"",(a=t.match(/\<body[^>]*\>([^]*)\<\/body/m))?a[1]:t),n+="</blockquote></div>",e?n:""}l.mailSubstatus.get({nolimit:!0}).$promise.then(function(e){g.subStatuses=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}),g.secret||l.mailAccount.verifySmtp({id:s.id}).$promise.catch(function(e){g.verifySmtp=!1,g.errors.push({message:e.data,type:e.status}),g.errors.push({message:"You can't reply or send an email. Please contact the administrator!",type:"500"})})}e.$inject=["$cookies","$window","$mdDialog","$mdConstant","$translate","account","message","type","api","toasty","$q","Auth","interaction","draftManager"],angular.module("app.dashboards").controller("ComposeMailInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,OpenchannelAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e[s.mapKey]&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e[s.mapKey]&&(n+=e.lastName+" ");return n+="<"+e[s.mapKey]+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId){var n="firstName,lastName,phone,mobile";return s.mapKey&&(n+=","+s.mapKey),l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:n}).$promise.then(function(e){return e.rows})}return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e[s.mapKey];return n},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeOpenchannelInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,SmsAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e.mobile&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.mobile&&(n+=e.lastName+" ");return n+="<"+e.mobile+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId)return l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,mobile"}).$promise.then(function(e){return e.rows});return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e.mobile;if(t=n,/^(\+|\d)[0-9]{7,16}$/.test(t))return n;var t;return d.error("Mobile "+n+" is not valid"),null},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeSmsInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,WhatsappAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e.mobile&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.mobile&&(n+=e.lastName+" ");return n+="<"+e.mobile+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId)return l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,mobile"}).$promise.then(function(e){return e.rows});return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e.mobile;if(t=n,/^(\+|\d)[0-9]{7,16}$/.test(t))return n;var t;return d.error("Mobile "+n+" is not valid"),null},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeWhatsappInteractionDialogController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.errors=[],r.dispositions=[],r.interaction=angular.copy(e),r.interaction.disposition||(r.interaction.disposition=null),r.channel=i,r.apiRoute=r.channel+"Interaction",r.apiAccountRoute=r.channel+("chat"===r.channel?"Website":"Account"),r.accountProperty=_.capitalize(r.channel)+("chat"===r.channel?"Website":"Account")+"Id",r.firstLevelDisposition=null,r.mandatoryDisposition=!1,r.mandatoryDispositionPause="",r.wasUserInPause=s.voicePause||s.chatPause||s.mailPause||s.openchannelPause||s.faxPause,r.onInit=function(){var n=[],t={fields:"id,name,level,ParentId",sort:"name",nolimit:!0};t[r.accountProperty]=e[r.accountProperty],a[r.apiAccountRoute].get({id:e[r.accountProperty]}).$promise.then(function(e){return r.mandatoryDisposition=e.mandatoryDisposition,r.mandatoryDisposition&&(r.mandatoryDispositionPause=e.mandatoryDispositionPause.name),a.disposition.get(t).$promise}).then(function(e){return e.rows.length&&(n=_.concat(n,e.rows)),a.disposition.get({MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}).$promise}).then(function(e){e.rows.length&&(n=_.concat(n,e.rows))}).catch(function(e){console.error(e)}).finally(function(){r.dispositions=_.orderBy(n,["name"],["asc"]),r.mandatoryDisposition&&!r.wasUserInPause&&a.user.pause({id:s.id,type:r.mandatoryDispositionPause||"DEFAULT PAUSE"}).$promise.then(function(e){}).catch(function(e){console.error(e)})})},r.onDispositionChange=function(e){"first"===e?(r.anySecondLevelDisposition=!!r.firstLevelDisposition&&_.some(r.dispositions,["ParentId",r.firstLevelDisposition.id]),r.firstLevelDisposition||(r.secondLevelDisposition=void 0)):"second"===e&&(r.anyThirdLevelDisposition=_.some(r.dispositions,["ParentId",r.secondLevelDisposition.id]))},r.clearDispositionSelection=function(e){"second"===e?(r.secondLevelDisposition=void 0,r.thirdLevelDisposition=void 0):"third"===e&&(r.thirdLevelDisposition=void 0)},r.saveDisposition=function(){r.errors=[],r.interaction.UserId=s.id,r.interaction.closed=!0,r.interaction.closeReason="agent",r.interaction.disposition=r.firstLevelDisposition?r.firstLevelDisposition.name:null,r.interaction.secondDisposition=r.secondLevelDisposition?r.secondLevelDisposition.name:void 0,r.interaction.thirdDisposition=r.thirdLevelDisposition?r.thirdLevelDisposition.name:void 0,a[r.apiRoute]?a[r.apiRoute].update(_.pick(r.interaction,["MailAccountId","FaxAccountId","SmsAccountId","WhatsappAccountId","ChatWebsiteId","OpenchannelAccountId","closed","closeReason","disposition","secondDisposition","thirdDisposition","id","note","UserId"])).$promise.then(function(e){r.interaction=e,"mail"===r.channel&&o.removeByInteraction(r.interaction.id),t.success({title:"Interaction properly closed!",msg:"Interaction has been closed!"})}).then(function(){l(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.variable.update"}];for(var n=0;n<e.data.errors.length;n++)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})}):l(!1)},r.closeDialog=l}e.$inject=["$mdDialog","toasty","api","interaction","channel","user","draftManager"],angular.module("app.dashboards").controller("DisposeInteractionDialogController",e)}(),function(){"use strict";function e(n,t,e,a,i,s){var o=this;function r(e){n.hide(e)}o.errors=[],o.tags=s,o.interaction=angular.copy(a),o.interaction.Tags=_.map(o.interaction.Tags,function(e){return{id:e.id,name:e.name,color:e.color}}),o.channel=i,o.autocompleteRequireMatch=!0,o.saveTag=function(){{if(o.errors=[],e[o.apiRoute])return e[o.apiRoute].addTags({id:o.interaction.id,ids:_.map(o.interaction.Tags,"id")}).$promise.then(function(){t.success({title:"Interaction properly tagged!",msg:"Interaction has been tagged!"}),a.Tags=o.interaction.Tags,r(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})});r(!1)}},o.closeDialog=r,o.apiRoute=o.channel+"Interaction"}e.$inject=["$mdDialog","toasty","api","interaction","channel","tags"],angular.module("app.dashboards").controller("TagInteractionDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r,l,d){var c=this;function m(e){n.hide(e)}c.channel=s.toLowerCase(),c.message=o,c.account=r,c.agents=l,c.queues=d,c.transfer={id:0,type:c.account.queueTransfer?"queue":"agent"},c.onTransfer=function(){m(!0),e(function(){var e="agent"===c.transfer.type?"agentNotify":c.channel+"QueueNotify";return a.rpc[e]({id:c.transfer.id,messageId:c.message.id,channel:c.channel}).$promise.then(function(){i.success({title:t.instant("DASHBOARDS.INFO"),msg:"queue"===c.transfer.type?t.instant("DASHBOARDS.NOTIFICATIONS.TRANSFER_QUEUE_EXECUTED"):t.instant("DASHBOARDS.NOTIFICATIONS.TRANSFER_AGENT_EXECUTED")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.rpc.notify"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.rpc.notify",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},5e3)},c.closeDialog=m}e.$inject=["$mdDialog","$timeout","$translate","api","toasty","channel","message","account","agents","queues"],angular.module("app.dashboards").controller("TransferMessageDialogController",e)}(),function(){"use strict";function e(i,m,s,e,u,o,r,t,n,a,l){var p=this;function d(){try{i.$parent.$parent.$parent.vm.updateLocalStorage()}catch(e){o.error({title:"ERROR UPDATE LOCAL TABS",msg:"Error updating locally stored tabs"})}}function c(t,e){var n,a,l=[],d=[],c=r.getCurrentUser();(n=c,a=m.defer(),p.project.sendUnpauseOnSubmit?u.user.unpause({id:n.id}).$promise.then(function(e){a.resolve()}).catch(function(e){console.log("err"),a.resolve()}):a.resolve(),a.promise).then(function(){return u.jscriptySessionReport.save({starttime:p.starttime,membername:p.call&&p.call.membername?p.call.membername:c.name,calleridname:p.call&&p.call.calleridname?p.call.calleridname:void 0,calleridnum:p.call&&p.call.calleridnum?p.call.calleridnum:void 0,queue:p.call&&p.call.queue?p.call.queue:void 0,uniqueid:p.call&&p.call.uniqueid?p.call.uniqueid:void 0,VoiceQueueId:p.call&&p.call["xmd-voicequeueid"]?p.call["xmd-voicequeueid"]:void 0,ProjectId:p.project&&p.project.id?p.project.id:void 0,projectname:p.project&&p.project.name?p.project.name:void 0,ContactId:p.contact&&p.contact.id?p.contact.id:void 0,completed:e}).$promise}).then(function(e){if(e)for(var n=p.getResponseSheetHeaders(),t=p.getResponseSheetRow(),a=p.getQuestionWithResponseList(),i=0;i<n.length;i+=1)if(!_.isEmpty(String(t[i]))){try{l.push(u.jscriptyQuestionReport.save({question:n[i],answer:"date"===a[i].type?moment(String(t[i])).format("YYYY-MM-DD"):"time"===a[i].type?moment(String(t[i])).format("HH:mm"):String(t[i]),questionId:a[i].id,membername:p.call&&p.call.membername?p.call.membername:c.name,calleridname:p.call&&p.call.calleridname?p.call.calleridname:void 0,calleridnum:p.call&&p.call.calleridnum?p.call.calleridnum:void 0,queue:p.call&&p.call.queue?p.call.queue:void 0,uniqueid:p.call&&p.call.uniqueid?p.call.uniqueid:void 0,SessionId:e.id,ProjectId:p.project.id,projectname:p.project.name}))}catch(e){console.error("Unable to convert question",e)}for(var s=String(t[i]).split(";"),o=0;o<s.length;o+=1){var r=s[o].trim();try{d.push(u.jscriptyAnswerReport.save({question:n[i],questionId:a[i].id,answer:"date"===a[i].type?moment(r).format("YYYY-MM-DD"):"time"===a[i].type?moment(r).format("HH:mm"):r,membername:p.call&&p.call.membername?p.call.membername:c.name,calleridname:p.call&&p.call.calleridname?p.call.calleridname:void 0,calleridnum:p.call&&p.call.calleridnum?p.call.calleridnum:void 0,queue:p.call&&p.call.queue?p.call.queue:void 0,uniqueid:p.call&&p.call.uniqueid?p.call.uniqueid:void 0,SessionId:e.id,ProjectId:p.project.id,projectname:p.project.name}))}catch(e){console.error("Unable to convert answer",e)}}}return m.all(l).then(function(){return m.all(d).then(function(){return e})})}).then(function(e){e?t.resolve(!0):t.reject()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()});t.reject()})}p.formViewer={},p.showResetButton=!0,p.showIncompleteSubmitButton=!1,p.detectBrowser=l.detectBrowser(),p.onSubmit=function(e,n){var t=m.defer();if(n){var a=s.confirm().title("Would you like to save your survey?").textContent("").ariaLabel("survey").targetEvent(e).ok("YES").cancel("NO");s.show(a).then(function(){c(t,!1)},function(){t.resolve()})}else c(t,!0);return t.promise.then(function(e){e&&(o.success({title:"Session saved",msg:"Your survey session has been properly saved!"}),function(e){try{i.$parent.$parent.$parent.vm.removeTab(e)}catch(e){o.error({title:"ERROR REMOVE TAB",msg:"Error while removing tab"})}}(p.tab))}).catch(function(e){o.error({title:"Session save error",msg:"There has been an error while trying to save your survey session!"})})},p.openContact=function(e,n){try{i.$parent.$parent.$parent.vm.addContactTab(n)}catch(e){o.error({title:"ERROR OPEN CONTACT",msg:"Jscripty can't open the contact"})}},p.isJsonString=function(e){if(_.isNil(e))return!1;try{JSON.parse(e)}catch(e){return!1}return!0},p.getResponseSheet=function(){return e.getResponseSheet(p.project.formData,p.project.responseData,!1)},p.getResponseSheetRow=function(){return e.getResponseSheetRow(p.project.formData,p.project.responseData)},p.getResponseSheetHeaders=function(){return e.getResponseSheetHeaders(p.project.formData,!1)},p.getQuestionWithResponseList=function(){return e.getQuestionWithResponseList(p.project.formData,p.project.responseData)},p.init=function(e){p.tab=e,p.tab&&(p.call=p.tab.call,p.starttime=p.tab.openedAt,p.contact=p.tab.contact,p.project=p.tab.project,p.project&&(_.isObjectLike(p.project.formData)?p.project.formData=p.project.formData:p.isJsonString(p.project.formData)?p.project.formData=JSON.parse(p.project.formData):p.project.formData=void 0,p.project.responseData=p.project.responseData||{},void 0!==p.project.currentPage&&a(function(){n.$broadcast("mwForm.pageEvents.changePage",{page:p.project.currentPage})}),i.$on("mwForm.pageEvents.pageCurrentChanged",function(e,n){if(n.currentPage&&(p.project.currentPage=n.currentPage.number-1,d(),p.project.enableUncompleteSave&&(1<=n.currentPage.number&&n.currentPage.number<p.project.formData.pages.length?p.showIncompleteSubmitButton=!0:p.showIncompleteSubmitButton=!1),p.project.formData&&p.project.formData.pages))for(var t=0,a=p.project.formData.pages.length;t<a;t++)if(n.currentPage.number<t+1&&p.project.formData.pages[t].elements)for(var i=0,s=p.project.formData.pages[t].elements.length;i<s;i++)"question"===p.project.formData.pages[t].elements[i].type&&p.project.formData.pages[t].elements[i].question&&delete p.project.responseData[p.project.formData.pages[t].elements[i].question.id]})))},p.resetViewer=function(e){if(p.formViewer.reset){var n=s.confirm().title(t.instant("JSCRIPTY.DO_YOU_WANT_TO_RESET_SESSION")).content(t.instant("JSCRIPTY.ALL_SURVEY_DATA_WILL_BE_LOST")).textContent("").ariaLabel("survey").targetEvent(e).ok(t.instant("JSCRIPTY.YES")).cancel(t.instant("JSCRIPTY.NO"));s.show(n).then(function(){p.showIncompleteSubmitButton=!1,p.project.currentPage=void 0,d(),p.formViewer.reset()})}}}e.$inject=["$scope","$q","$mdDialog","mwFormResponseUtils","api","toasty","Auth","$translate","$rootScope","$timeout","msUtils"],angular.module("app.dashboards").controller("AgentGeneralJscriptyController",e)}(),function(){"use strict";function e(t,a,e,n,i){var s=this;function o(){return function(e){if(404===e.status)a.info({title:t.instant("DASHBOARDS.ATTENTION"),msg:t.instant("DASHBOARDS.ACCEPT_ELSEWHERE")});else if(e.data&&e.data.errors&&e.data.errors.length){s.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelMessage.accept",msg:e.data?JSON.stringify(e.data.message):e.toString()})}}s.notification=e,s.user=i.getCurrentUser(),s.accept=function(e){{if(n[s.notification.channel+"Message"])return n[s.notification.channel+"Message"].accept({id:s.notification.id,UserId:s.user.id,manual:!0}).$promise.then(function(e){a.success({title:"Message properly accepted!",msg:"Message has been accepted!"})}).catch(o());a.error({title:"API:ERROR",msg:"API accept message not found: "+s.notification.channel+"Message"})}},s.reject=function(e){{if(n[s.notification.channel+"Message"])return n[s.notification.channel+"Message"].reject({id:s.notification.id,UserId:s.user.id}).$promise.then(function(e){a.success({title:"Message properly rejected!",msg:"Message has been rejected!"})}).catch(o());a.error({title:"API:ERROR",msg:"API reject message not found: "+s.notification.channel+"Message"})}}}e.$inject=["$translate","toasty","notification","api","Auth"],angular.module("app.dashboards").controller("NotificationController",e)}(),function(){"use strict";angular.module("app.dashboards").controller("AgentGeneralPopupController",function(){var n=this;n.init=function(e){n.tab=e,n.tab&&(n.tab.saved=!0,n.html=n.tab.html)}})}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&"abandoned"===e.disposition?(i.inbound.abandoned+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)):e.closed&&!e.UserId&&e.disposition?(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)):e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.chatWebsites,{id:_.toNumber(e.ChatWebsiteId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.chatWebsites=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveChatInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateChatInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("chatInteraction:save",i.onSaveChatInteraction),n.on("chatInteraction:update",i.onUpdateChatInteraction),function(){if(0<Object.keys(i.chatWebsites).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("chatInteraction:save"),n.removeAllListeners("chatInteraction:update")})}e.$inject=["$scope","socket","chatInteractions","chatWebsites"],angular.module("app.dashboards").controller("UserChatDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r){var l=this;function d(){s({queues:l.outboundQueues,rpcQueues:l.rpcQueues}).then(function(e){l.inbound=e})}function c(){o({rpcCampaigns:l.rpcCampaigns}).then(function(e){l.ivr=e})}l.outboundQueues=a?_.keyBy(a.rows?a.rows:[],"id"):{},l.rpcQueues=i?_.keyBy(i.rows?i.rows:[],"id"):{},l.rpcCampaigns=r?_.keyBy(r.rows?r.rows:[],"id"):{},l.ivr={originated:0,limitCalls:0},l.inbound={waiting:0,talking:0,pTalking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0,outboundDropCallsDayCallersExit:0,outboundDropCallsDayTimeout:0},l.onSaveQueue=function(e){l.outboundQueues[e.id]&&l.rpcQueues[e.id]&&(l.rpcQueues[e.id]=e)},l.onSaveCampaign=function(e){l.rpcCampaigns[e.id]&&(l.rpcCampaigns[e.id]=e)},t.onWithoutApply("voice_queue:save",l.onSaveQueue),l.interval=n(function(){d(),c()},999),t.onWithoutApply("campaign:save",l.onSaveCampaign),d(),c(),e.$on("$destroy",function(){t.removeListener("voice_queue:save",l.onSaveQueue),t.removeAllListeners("campaign:save"),l.interval&&n.cancel(l.interval)})}e.$inject=["$scope","$interval","socket","outboundQueues","rpcQueues","initializeRealtimeQueue","initializeRealtimeCampaign","rpcCampaigns"],angular.module("app.dashboards").controller("UserVoiceDashboardDialerController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.faxAccounts,{id:_.toNumber(e.FaxAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.faxAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveFaxInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateFaxInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("faxInteraction:save",i.onSaveFaxInteraction),n.on("faxInteraction:update",i.onUpdateFaxInteraction),function(){if(0<Object.keys(i.faxAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("faxInteraction:save"),n.removeAllListeners("faxInteraction:update")})}e.$inject=["$scope","socket","faxInteractions","faxAccounts"],angular.module("app.dashboards").controller("UserFaxDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.mailAccounts,{id:_.toNumber(e.MailAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.mailAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveMailInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateMailInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("mailInteraction:save",i.onSaveMailInteraction),n.on("mailInteraction:update",i.onUpdateMailInteraction),function(){if(0<Object.keys(i.mailAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("mailInteraction:save"),n.removeAllListeners("mailInteraction:update")})}e.$inject=["$scope","socket","mailInteractions","mailAccounts"],angular.module("app.dashboards").controller("UserMailDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.openchannelAccounts,{id:_.toNumber(e.OpenchannelAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.openchannelAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveOpenchannelInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateOpenchannelInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("openchannelInteraction:save",i.onSaveOpenchannelInteraction),n.on("openchannelInteraction:update",i.onUpdateOpenchannelInteraction),function(){if(0<Object.keys(i.openchannelAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("openchannelInteraction:save"),n.removeAllListeners("openchannelInteraction:update")})}e.$inject=["$scope","socket","openchannelInteractions","openchannelAccounts"],angular.module("app.dashboards").controller("UserOpenchannelDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.smsAccounts,{id:_.toNumber(e.SmsAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.smsAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveSmsInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateSmsInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("smsInteraction:save",i.onSaveSmsInteraction),n.on("smsInteraction:update",i.onUpdateSmsInteraction),function(){if(0<Object.keys(i.smsAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("smsInteraction:save"),n.removeAllListeners("smsInteraction:update")})}e.$inject=["$scope","socket","smsInteractions","smsAccounts"],angular.module("app.dashboards").controller("UserSmsDashboardGeneralController",e)}(),function(){"use strict";function e(t){var i=[],s=function(){var t=i[0],a={waiting:0,talking:0,pTalking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0,originated:0,outboundDropCallsDayCallersExit:0,outboundDropCallsDayTimeout:0};_.forIn(t.queues,function(e,n){t.rpcQueues[n]&&(a.waiting+=t.rpcQueues[n].waiting||0,a.talking+=(t.rpcQueues[n].talking||0)+(t.rpcQueues[n].pTalking||0),a.answered+=t.rpcQueues[n].answered||0,a.abandoned+=t.rpcQueues[n].abandoned||0,a.sumHoldTime+=t.rpcQueues[n].sumHoldTime||0,a.sumBillable+=t.rpcQueues[n].sumBillable||0,a.total+=t.rpcQueues[n].total||0,a.originated+=t.rpcQueues[n].originated||0,a.outboundDropCallsDayCallersExit+=t.rpcQueues[n].outboundDropCallsDayCallersExit||0,a.outboundDropCallsDayTimeout+=t.rpcQueues[n].outboundDropCallsDayTimeout||0)});var e=a.total-a.answered-a.abandoned;a.unmanaged=0<e?e:0,a.avgHoldTime=Math.round(0<a.total?a.sumHoldTime/a.total:0),a.avgHoldTime=new Date(1e3*a.avgHoldTime).toISOString().substr(11,8),a.avgTalkTime=Math.round(0<a.answered?a.sumBillable/a.answered:0),a.avgTalkTime=new Date(1e3*a.avgTalkTime).toISOString().substr(11,8),a.answerRate=Math.round((0<a.total?a.answered/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.abandonRate=Math.round((0<a.total?a.abandoned/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.outboundDropRate=Math.round((0<a.total?a.outboundDropCallsDayTimeout/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.outboundAbandonRate=Math.round((0<a.total?a.outboundDropCallsDayCallersExit/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.outboundanswerRate=0<100-a.outboundDropRate-a.outboundAbandonRate&&a.total?100-a.outboundDropRate-a.outboundAbandonRate:0,i.shift(),t.defer.resolve(a),0<i.length&&s()};return function(e){var n=t.defer();return i.push({queues:e.queues,rpcQueues:e.rpcQueues,defer:n}),1===i.length&&s(),n.promise}}function n(t){var i=[],s=function(){var t=i[0],a={originated:0,limitCalls:0};_.forIn(t.rpcCampaigns,function(e,n){t.rpcCampaigns[n]&&(a.originated+=t.rpcCampaigns[n].originated||0,a.limitCalls+=t.rpcCampaigns[n].limitCalls||0)}),i.shift(),t.defer.resolve(a),0<i.length&&s()};return function(e){var n=t.defer();return i.push({rpcCampaigns:e.rpcCampaigns,defer:n}),1===i.length&&s(),n.promise}}function t(t,a,e){var i=this;i.license=e,i.onInit=function(){if(i.hasDashboardPermissions=!a.hasRole("user")||a.hasPermission(101),i.hasDashboardPermissions){var e=t.current.name;switch(e){case"app.dashboards.general":n=[],i.license.voice&&n.push("app.dashboards.general.voice"),i.license.dialer&&n.push("app.dashboards.general.dialer"),i.license.chat&&n.push("app.dashboards.general.chat"),i.license.mail&&n.push("app.dashboards.general.mail"),i.license.messaging&&n.push("app.dashboards.general.sms"),i.license.openchannel&&n.push("app.dashboards.general.openchannel"),i.license.fax&&n.push("app.dashboards.general.fax"),i.license.whatsapp&&n.push("app.dashboards.general.whatsapp"),0<n.length&&t.go(_.first(n));break;case"app.dashboards.general.voice":i.selectedTab=0;break;case"app.dashboards.general.dialer":i.selectedTab=1;break;case"app.dashboards.general.chat":i.selectedTab=2;break;case"app.dashboards.general.mail":i.selectedTab=3;break;case"app.dashboards.general.sms":i.selectedTab=4;break;case"app.dashboards.general.openchannel":i.selectedTab=5;break;case"app.dashboards.general.fax":i.selectedTab=6;break;case"app.dashboards.general.whatsapp":i.selectedTab=7}}var n}}e.$inject=["$q"],n.$inject=["$q"],t.$inject=["$state","Auth","license"],angular.module("app.dashboards").factory("initializeRealtimeQueue",e).factory("initializeRealtimeCampaign",n).controller("UserDashboardGeneralController",t)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;function r(){s({queues:o.inboundQueues,rpcQueues:o.rpcQueues}).then(function(e){o.inbound=e})}o.inboundQueues=t?_.keyBy(t.rows?t.rows:[],"id"):{},o.rpcQueues=a?_.keyBy(a.rows?a.rows:[],"id"):{},o.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},o.outbound=i||{answered:0,sumBillable:0,sumDuration:0,sumHoldTime:0,total:0},o.onSaveQueue=function(e){o.inboundQueues[e.id]&&o.rpcQueues[e.id]&&(o.rpcQueues[e.id]=e,r())},o.onSaveOutbound=function(e){o.outbound=e},n.on("voice_queue:save",o.onSaveQueue),n.on("voice_outbound:save",o.onSaveOutbound),r(),e.$on("$destroy",function(){n.removeListener("voice_queue:save",o.onSaveQueue),n.removeAllListeners("voice_outbound:save")})}e.$inject=["$scope","socket","inboundQueues","rpcQueues","outbound","initializeRealtimeQueue"],angular.module("app.dashboards").controller("UserVoiceDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.whatsappAccounts,{id:_.toNumber(e.WhatsappAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.whatsappAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveWhatsappInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateWhatsappInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("whatsappInteraction:save",i.onSaveWhatsappInteraction),n.on("whatsappInteraction:update",i.onUpdateWhatsappInteraction),function(){if(0<Object.keys(i.whatsappAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("whatsappInteraction:save"),n.removeAllListeners("whatsappInteraction:update")})}e.$inject=["$scope","socket","whatsappInteractions","whatsappAccounts"],angular.module("app.dashboards").controller("UserWhatsappDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="FAX.EDIT_FAXACCOUNT",g.faxAccount=angular.copy(l),g.faxAccounts=r,g.newFaxAccount=!1,g.faxAccount||(g.faxAccount={waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="FAX.NEW_FAXACCOUNT",g.newFaxAccount=!0),n.params.id&&(g.faxAccount.FaxAccountId=n.params.id),g.addNewFaxAccount=function(){g.errors=[],d.faxAccount.addAccountApplications(g.faxAccount).$promise.then(function(e){g.faxAccounts.unshift(e.toJSON()),o.success({title:"FaxAccount properly created",msg:g.faxAccount.name?g.faxAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFaxAccount=function(){g.errors=[],d.faxAccount.updateAccountApplications(g.faxAccount).$promise.then(function(e){var n=_.find(g.faxAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FaxAccount properly saved!",msg:g.faxAccount.name?g.faxAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFaxAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The faxAccount will be deleted.").ariaLabel("Delete FaxAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.faxAccount.delete({id:g.faxAccount.id}).$promise.then(function(){_.remove(g.faxAccounts,{id:g.faxAccount.id}),o.success({title:"FaxAccount properly deleted!",msg:(g.faxAccount.name||"faxAccount")+" has been deleted!"}),v(g.faxAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})}),t=null;if(g.faxAccount&&(t=_.find(g.trunks,{id:Number(g.faxAccount.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.trunks,{id:t.id});a.canSelect=!1,n.push(a)}g.trunks=n})}else{var t=[],a=null;g.faxAccount&&(a=_.find(g.trunks,{id:Number(g.faxAccount.TrunkId)}));for(var i=0;i<g.trunks.length;i++)a&&g.trunks[i].id===a.id&&(g.trunks[i].canSelect=!1,t.push(g.trunks[i]));g.trunks=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.faxAccount&&(t=_.find(g.lists,{id:Number(g.faxAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.faxAccount&&(a=_.find(g.lists,{id:Number(g.faxAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","faxAccounts","faxAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.fax").controller("CreateOrEditFaxAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.faxAccountApps.rows.length){var t=r.faxAccountApps.rows[n]?r.faxAccountApps.rows[n]:r.faxAccountApps.rows[0];i.show({controller:"EditFaxAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccountApp:t,faxAccount:r.faxAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.faxAccountApps.rows[n]=e:r.faxAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.faxAccountApps.rows.length;t++,0){var a=r.faxAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.faxAccount.context,a.exten=r.faxAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.faxAccount.addApplications({id:r.faxAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.faxAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.faxAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.faxAccount={},r.faxAccountApps={count:0,rows:[]},r.selectedFaxAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"FaxQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"faxQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:901}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,defaultValue:300,required:!0,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",role:"agent",nolimit:!0},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.faxAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getFaxAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.faxAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getFaxAccountApps=function(){r.promise=o.faxAccount.getApplications(r.query,t).$promise},r.editFaxAccountApp=n,r.editInterval=function(e,n){if(r.faxAccountApps.rows.length){var t=r.faxAccountApps.rows[n]?r.faxAccountApps.rows[n]:r.faxAccountApps.rows[0];i.show({controller:"EditFaxAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteFaxAccountApp=function(e){_.remove(r.faxAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedFaxAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedFaxAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedFaxAccountApps.forEach(function(e){_.remove(r.faxAccountApps.rows,{id:e.id})}),r.selectedFaxAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.fax").controller("FaxAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.faxAccount.getAgents({id:c.faxAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserFaxAccount?"penalty "+e.UserFaxAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.faxAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.faxAccount.removeAgents({id:c.faxAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.faxAccount.addAgents({id:c.faxAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("FAX.ALL_AGENTS"),labelSelected:r.instant("FAX.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","faxAccount","faxAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.fax").controller("FaxAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditFaxAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("fax")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.faxQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.faxQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:901}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountApptagDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.faxAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.faxAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.FaxAccountId=m.faxAccount.id,m.query.id=m.faxAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.faxAccount.id,field:"FaxAccountId",route:"faxAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.fax").controller("FaxAccountDispositionsController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"faxAccount",action:"getDispositions",field:"name",params:{id:m.faxAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.faxAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.faxAccountInteractions.rows.length;n+=1){var t=m.faxAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.faxInteraction.get(m.query,p).$promise}function v(e){d.faxInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.faxAccountInteractions.rows,{id:e.id}),m.faxAccountInteractions.count-=1,m.faxAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETfaxAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?(e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""),e.contactInfo=e.Contact.fax):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.faxAccount={},m.faxAccountInteractions={count:0,rows:[]},m.selectedFaxAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.faxAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.FaxAccountId=m.faxAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.faxInteractionDownload=function(s,e,n){return d.faxInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="fax-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getFaxAccountInteractions=g,m.createOrEditFaxAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccount:m.faxAccount,interaction:n,interactions:m.faxAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spyfaxInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"fax",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"fax.faxAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||FaxAccountId:=$eq["+m.faxAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedFaxAccountInteractions=function(){var e=angular.copy(m.selectedFaxAccountInteractions);return m.selectedFaxAccountInteractions=[],e},m.deleteFaxAccountInteraction=v,m.deleteSelectedFaxAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedFaxAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedFaxAccountInteractions.forEach(function(e){v(e)}),m.selectedFaxAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.fax").controller("FaxAccountInteractionsController",e)}(),function(){"use strict";function e(t,e,a,i,s,n,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=n,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=e.protocol()+"://"+e.host(),p.faxAccount=c||t.params.faxAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=t.params.tab||0,p.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.fax.realtime.accounts",{}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.fax.realtime.accounts",{})}},p.agentadddialog=function(e,n){a.show({controller:"FaxAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxAccount:e,faxAccounts:p.faxAccounts?p.faxAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoFaxAccounts=function(){t.go("app.fax.faxAccounts",{},{reload:"app.fax.faxAccounts"})},p.saveFaxAccount=function(){r.faxAccount.updateAccountApplications(p.faxAccount).$promise.then(function(){l.success({title:"FaxAccount updated!",msg:p.faxAccount.name?p.faxAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.trunks=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.trunks=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.trunks,{id:e.resourceId})}),t=null;if(p.faxAccount&&(t=_.find(p.trunks,{id:Number(p.faxAccount.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.trunks,{id:t.id});a.canSelect=!1,n.push(a)}p.trunks=n})}else{var t=[],a=null;p.faxAccount&&(a=_.find(p.trunks,{id:Number(p.faxAccount.TrunkId)}));for(var i=0;i<p.trunks.length;i++)a&&p.trunks[i].id===a.id&&(p.trunks[i].canSelect=!1,t.push(p.trunks[i]));p.trunks=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.faxAccount&&(t=_.find(p.lists,{id:Number(p.faxAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.faxAccount&&(a=_.find(p.lists,{id:Number(p.faxAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","faxAccount","userProfile","userProfileSection"],angular.module("app.fax").controller("FaxAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.faxAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="faxAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedFaxAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},f.arrayecm=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayminrate=_.keyBy([{option:"2400",value:"'2400'"},{option:"4800",value:"'4800'"},{option:"7200",value:"'7200'"},{option:"9600",value:"'9600'"},{option:"12000",value:"'12000'"},{option:"14400",value:"'14400'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymaxrate=_.keyBy([{option:"2400",value:"'2400'"},{option:"4800",value:"'4800'"},{option:"7200",value:"'7200'"},{option:"9600",value:"'9600'"},{option:"12000",value:"'12000'"},{option:"14400",value:"'14400'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytech=_.keyBy([{option:"SIP",value:"'SIP'"},{option:"IAX",value:"'IAX'"},{option:"DADHI",value:"'DADHI'"},{option:"KHOMP",value:"'KHOMP'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.fax.faxAccounts.edit",{id:e.id,faxAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.fax.faxAccounts.edit",{id:e.id,tab:5})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.fax.realtime.accounts",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.fax.realtime.accounts",{})}},f.agentadddialog=function(e,n){i.show({controller:"FaxAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxAccount:e,faxAccounts:f.faxAccounts?f.faxAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("faxAccount")+"?").htmlContent("<b>"+(e.name||"faxAccount")+"</b> will be deleted.").ariaLabel("delete faxAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getFaxAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.faxAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FaxAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFaxAccount=function(e,n){i.show({controller:"CreateOrEditFaxAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccount:n,faxAccounts:f.faxAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteFaxAccount=y,f.exportSelectedFaxAccounts=function(){var e=angular.copy(f.selectedFaxAccounts);return f.selectedFaxAccounts=[],e},f.deleteSelectedFaxAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected faxAccounts?").htmlContent("<b>"+f.selectedFaxAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FaxAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFaxAccounts.forEach(function(e){y(e)}),f.selectedFaxAccounts=[]})},f.deselectFaxAccounts=function(){f.selectedFaxAccounts=[]},f.selectAllFaxAccounts=function(){f.selectedFaxAccounts=f.faxAccounts.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(f.trunks,{id:e.resourceId})}),a=null;a=[],f.faxAccounts.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(f.trunks,{id:e.id});n.canSelect=!1,t.push(n)}}),f.trunks=t})}else{var t=[],a=[];f.faxAccounts.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)});for(var i=0;i<f.trunks.length;i++){_.some(a,{id:f.trunks[i].id})&&(f.trunks[i].canSelect=!1,t.push(f.trunks[i]))}f.trunks=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.faxAccount&&(t=_.find(f.lists,{id:Number(f.faxAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.faxAccount&&(a=_.find(f.lists,{id:Number(f.faxAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.faxAccounts=e||{count:0,rows:[]}}function y(e){m.faxAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.faxAccounts.rows,{id:e.id}),f.faxAccounts.count-=1,f.faxAccounts.rows.length||f.getFaxAccounts(),p.success({title:_.startCase("FaxAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEfaxAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEfaxAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFaxAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","faxAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.fax").controller("FaxAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="FAX.EDIT_FAXQUEUE",g.faxQueue=angular.copy(l),g.faxQueues=r,g.newFaxQueue=!1,g.faxQueue||(g.faxQueue={strategy:"beepall",timeout:10},g.title="FAX.NEW_FAXQUEUE",g.newFaxQueue=!0),g.addNewFaxQueue=function(){g.errors=[],d.faxQueue.save(g.faxQueue).$promise.then(function(e){g.faxQueues.unshift(e.toJSON()),o.success({title:"FaxQueue properly created",msg:g.faxQueue.name?g.faxQueue.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFaxQueue=function(){g.errors=[],d.faxQueue.update({id:g.faxQueue.id},g.faxQueue).$promise.then(function(e){var n=_.find(g.faxQueues,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FaxQueue properly saved!",msg:g.faxQueue.name?g.faxQueue.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFaxQueue=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The faxQueue will be deleted.").ariaLabel("Delete FaxQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.faxQueue.delete({id:g.faxQueue.id}).$promise.then(function(){_.remove(g.faxQueues,{id:g.faxQueue.id}),o.success({title:"FaxQueue properly deleted!",msg:(g.faxQueue.name||"faxQueue")+" has been deleted!"}),v(g.faxQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","faxQueues","faxQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.fax").controller("CreateOrEditFaxQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.faxQueue.getAgents({id:c.faxQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserFaxQueue?"penalty "+e.UserFaxQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.faxQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.removeAgents({id:c.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.addAgents({id:c.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("FAX.ALL_AGENTS"),labelSelected:r.instant("FAX.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","faxQueue","faxQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.fax").controller("FaxQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.faxQueue.getTeams({id:l.faxQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.faxQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("FAX.ALL_TEAMS"),labelSelected:t.instant("FAX.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.removeTeams({id:l.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.addTeams({id:l.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","faxQueue","$translate","Auth","crudPermissions"],angular.module("app.fax").controller("FaxQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.faxQueue=c||e.params.faxQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"FaxQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:u.faxQueues?u.faxQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:u.faxQueues?u.faxQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoFaxQueues=function(){e.go("app.fax.faxQueues",{},{reload:"app.fax.faxQueues"})},u.saveFaxQueue=function(){r.faxQueue.update({id:u.faxQueue.id},u.faxQueue).$promise.then(function(){l.success({title:"FaxQueue updated!",msg:u.faxQueue.name?u.faxQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","faxQueue","userProfileSection"],angular.module("app.fax").controller("FaxQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.faxQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="faxQueues",f.listOrder="",f.listOrderAsc=null,f.selectedFaxQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"fax",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.fax.faxQueues.edit",{id:e.id,faxQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"FaxQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:f.faxQueues?f.faxQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:f.faxQueues?f.faxQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("faxQueue")+"?").htmlContent("<b>"+(e.name||"faxQueue")+"</b> will be deleted.").ariaLabel("delete faxQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.fax.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.fax.realtime.queues",{})}},f.success=E,f.getFaxQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.faxQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FaxQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFaxQueue=function(e,n){i.show({controller:"CreateOrEditFaxQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxQueue:n,faxQueues:f.faxQueues.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteFaxQueue=y,f.exportSelectedFaxQueues=function(){var e=angular.copy(f.selectedFaxQueues);return f.selectedFaxQueues=[],e},f.deleteSelectedFaxQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected faxQueues?").htmlContent("<b>"+f.selectedFaxQueues.length+" selected</b> will be deleted.").ariaLabel("delete FaxQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFaxQueues.forEach(function(e){y(e)}),f.selectedFaxQueues=[]})},f.deselectFaxQueues=function(){f.selectedFaxQueues=[]},f.selectAllFaxQueues=function(){f.selectedFaxQueues=f.faxQueues.rows};var b=!0,A=1;function E(e){f.faxQueues=e||{count:0,rows:[]}}function y(e){m.faxQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.faxQueues.rows,{id:e.id}),f.faxQueues.count-=1,f.faxQueues.rows.length||f.getFaxQueues(),p.success({title:_.startCase("FaxQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEfaxQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEfaxQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFaxQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","faxQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.fax").controller("FaxQueuesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){_.forIn(p.faxAccounts,function(e,n){p.rpcFaxAccounts[n]&&_.merge(e,p.rpcFaxAccounts[n])}),_.forIn(p.faxAccounts,function(n,e){var t={id:e,sort:"-id",direction:"in",limit:1,offset:0,$gte:"createdAt,"+moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),fields:"id,createdAt"};s.faxAccount.getMessages(t).$promise.then(function(e){return e&&(n.in=e.count||0,n.lastIn=e.rows&&e.rows.length?e.rows[0].createdAt:void 0),t.direction="out",s.faxAccount.getMessages(t).$promise}).then(function(e){e&&(n.out=e.count||0,n.lastOut=e.rows&&e.rows.length?e.rows[0].createdAt:void 0)}).catch(function(e){console.log(e)})})}p.currentUser=u.getCurrentUser(),p.count=l&&l.count?l.count:0,p.faxAccounts=l?_.keyBy(l.rows?l.rows:[],"id"):{},p.rpcFaxAccounts=d?_.keyBy(d.rows?d.rows:[],"id"):{},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.query={sort:"-name",limit:10,page:1},p.success=f,p.$onInit=g,p.getFaxAccounts=function(){p.query.offset=(p.query.page-1)*p.query.limit,u.hasRole("admin")?p.promise=s.faxAccount.get(p.query,f).$promise:(p.query.id=p.userProfile.id,p.query.section="FaxAccounts",p.promise=s.userProfile.getResources(p.query,f).$promise)},p.onSave=function(e){p.faxAccounts[e.id]&&_.merge(p.faxAccounts[e.id],e)},p.onFaxMessageSave=function(e){p.faxAccounts[e.FaxAccountId]&&("in"==e.direction?(p.faxAccounts[e.FaxAccountId].in+=1,p.faxAccounts[e.FaxAccountId].lastIn=e.createdAt):(p.faxAccounts[e.FaxAccountId].out+=1,p.faxAccounts[e.FaxAccountId].lastOut=e.createdAt))},p.goToFaxAccount=function(e,n){i.go("app.fax.faxAccounts.edit",{id:n.id,faxAccount:n})},p.order=[],_.forIn(p.faxAccounts,function(e,n){p.order.push(e.id)}),o.on("faxAccount:save",p.onSave),o.on("faxAccount:update",p.onSave),o.on("faxMessage:save",p.onFaxMessageSave);var v=!0,h=1;function f(e){if(p.faxAccounts=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){p.order=[];for(var n=0;n<e.rows.length;n++)p.order.push(e.rows[n].id)}g()}e.$watch("vm.query.filter",function(e,n){v?t(function(){v=!1}):(n||(h=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=h),p.getFaxAccounts())}),e.$on("$destroy",function(){o.removeAllListeners("faxAccount:save"),o.removeAllListeners("faxAccount:update"),o.removeAllListeners("faxMessage:save")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$state","api","socket","toasty","faxAccounts","rpcFaxAccounts","userProfile","userProfileSection","Auth"],angular.module("app.fax").controller("FaxAccountsRealtimeController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=["loggedIn","available","waiting","paused"],g=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"FaxQueues":void 0,channel:"fax",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("FAX.FAXQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditFaxQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxQueue:n,faxQueues:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxQueue:n,faxQueues:u.queues.rows,realtime:!1,crudPermissions:u.crudPermissions}})},r.on("fax_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,p))}),r.on("userFaxQueue:save",function(e){var n=_.find(u.queues.rows,["id",e.FaxQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("userFaxQueue:remove",function(e){var n=_.find(u.queues.rows,["id",e.FaxQueueId]);n&&(0<n.loggedInDb&&n.loggedInDb--,_.remove(n.agents,["id",e.UserId]))}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"fax")})}),e.$on("$destroy",function(){r.removeAllListeners("fax_queue:save"),r.removeAllListeners("userFaxQueue:remove"),r.removeAllListeners("userFaxQueue:save"),r.removeAllListeners("user:update"),g&&n.cancel(g)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.fax").controller("QueuesFaxRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.fax.realtime.agents":this.selectedTab=0;break;case"app.fax.realtime.trunks":this.selectedTab=1;break;case"app.fax.realtime.queues":this.selectedTab=2;break;case"app.fax.realtime.accounts":this.selectedTab=3;break;default:this.selectedTab=0,t.go("app.fax.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.fax.realtime.agents");break;case 1:t.go("app.fax.realtime.trunks");break;case 2:t.go("app.fax.realtime.queues");break;case 3:t.go("app.fax.realtime.accounts");break;default:t.go("app.fax.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.fax").controller("FaxRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m){var u=this,p=["status","stateRegistry","registry","host","port","internal","state","status"];function g(){for(var e,n=0;n<u.trunks.length;n+=1)0<=(e=_.findIndex(u.rpcTrunks,["id",u.trunks[n].id]))&&_.merge(u.trunks[n],_.pick(u.rpcTrunks[e],p))}function v(e,n,t){0<=n&&_.merge(e[n],_.pick(t,p))}u.currentUser=m.getCurrentUser(),u.count=a.count,u.trunks=a?a.rows:[],u.rpcTrunks=i&&i.rows?i.rows:[],u.query={fields:"id,name",active:!0,sort:"-updatedAt",limit:10,page:1},u.statusClass=r.status,u.stateClass=r.state,u.userProfile=d,u.userProfileSection=c&&1==c.count?c.rows[0]:null,u.crudPermissions=m.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.success=b,u.$onInit=g,u.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},u.getTrunks=function(){u.query.offset=(u.query.page-1)*u.query.limit,m.hasRole("admin")?u.promise=s.trunk.get(u.query,b).$promise:(u.query.id=u.userProfile.id,u.query.section="Trunks",u.promise=s.userProfile.getResources(u.query,b).$promise)},u.goToTrunk=function(e,n){l.go("app.tools.trunks.edit",{id:n.id})},u.onSave=function(e){var n=_.findIndex(u.trunks,["id",e.id]),t=_.findIndex(u.rpcTrunks,["id",e.id]);v(u.trunks,n,e),v(u.rpcTrunks,t,e)},o.on("trunk:save",u.onSave);var h=!0,f=1;function b(e){u.count=e.count,u.trunks=e&&e.rows?e.rows:[],g()}e.$watch("vm.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=u.query.page),e!==n&&(u.query.page=1),e||(u.query.page=f),u.getTrunks())}),e.$on("$destroy",function(){o.removeAllListeners("trunk:save")})}e.$inject=["$scope","$timeout","$mdDialog","trunks","rpcTrunks","api","socket","helperClasses","$state","userProfile","userProfileSection","Auth"],angular.module("app.fax").controller("TrunksFaxRealtimeController",e)}(),function(){"use strict";function e(e,n){this.info=e,this.license=n}e.$inject=["info","license"],angular.module("app.help.about").controller("AboutController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_DESKACCOUNT",g.deskAccount=angular.copy(l),g.deskAccounts=r,g.newDeskAccount=!1,g.deskAccount||(g.deskAccount={type:"integrationTab",authType:"basic",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_DESKACCOUNT",g.newDeskAccount=!0),g.addNewDeskAccount=function(){g.errors=[],d.intDeskAccount.save(g.deskAccount).$promise.then(function(e){g.deskAccounts.unshift(e.toJSON()),o.success({title:"DeskAccount properly created",msg:g.deskAccount.name?g.deskAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDeskAccount=function(){g.errors=[],d.intDeskAccount.update({id:g.deskAccount.id},g.deskAccount).$promise.then(function(e){var n=_.find(g.deskAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"DeskAccount properly saved!",msg:g.deskAccount.name?g.deskAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDeskAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The deskAccount will be deleted.").ariaLabel("Delete DeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intDeskAccount.delete({id:g.deskAccount.id}).$promise.then(function(){_.remove(g.deskAccounts,{id:g.deskAccount.id}),o.success({title:"DeskAccount properly deleted!",msg:(g.deskAccount.name||"deskAccount")+" has been deleted!"}),v(g.deskAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","deskAccounts","deskAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDeskAccountDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.deskAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="deskAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedDeskAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayauthType=_.keyBy([{option:"Basic",value:"'basic'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.deskAccounts.edit",{id:e.id,deskAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intDeskAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"DeskAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"DeskAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("deskAccount")+"?").htmlContent("<b>"+(e.name||"deskAccount")+"</b> will be deleted.").ariaLabel("delete deskAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getDeskAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intDeskAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="DeskAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditDeskAccount=function(e,n){i.show({controller:"CreateOrEditDeskAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{deskAccount:n,deskAccounts:f.deskAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteDeskAccount=y,f.exportSelectedDeskAccounts=function(){var e=angular.copy(f.selectedDeskAccounts);return f.selectedDeskAccounts=[],e},f.deleteSelectedDeskAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected deskAccounts?").htmlContent("<b>"+f.selectedDeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete DeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedDeskAccounts.forEach(function(e){y(e)}),f.selectedDeskAccounts=[]})},f.deselectDeskAccounts=function(){f.selectedDeskAccounts=[]},f.selectAllDeskAccounts=function(){f.selectedDeskAccounts=f.deskAccounts.rows};var b=!0,A=1;function E(e){f.deskAccounts=e||{count:0,rows:[]}}function y(e){m.intDeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.deskAccounts.rows,{id:e.id}),f.deskAccounts.count-=1,f.deskAccounts.rows.length||f.getDeskAccounts(),p.success({title:_.startCase("DeskAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintDeskAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintDeskAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getDeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","deskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("DeskAccountsController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intDeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intDeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intDeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.deskAccount={},o.deskConfiguration={},o.configurations=[],o.selectedDeskConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.deskAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intDeskAccount.getConfigurations({id:o.deskAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getDeskConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getDeskConfiguration=function(e){o.deskConfiguration=o.configurations[e],o.selectedDeskConfiguration=e,i.intDeskConfiguration.getSubjects({id:o.deskConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intDeskConfiguration.getDescriptions({id:o.deskConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intDeskConfiguration.getFields({id:o.deskConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),i.intDeskConfiguration.getTags({id:o.deskConfiguration.id}).$promise.then(function(e){o.selectedTags=e.rows?_.map(e.rows,"id"):[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditDeskConfiguration=function(e,n){a.show({controller:"CreateOrEditDeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{deskConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getDeskConfiguration(0)})},o.deleteDeskConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the deskConfiguration?").htmlContent("<b>"+(n.name||"deskConfiguration")+"</b> will be deleted.").ariaLabel("delete deskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intDeskConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"DeskConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getDeskConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedTags=[],o.selectTagsChanged=function(e){i.intDeskConfiguration.setTags({id:o.deskConfiguration.id,ids:o.selectedTags}).$promise.then(function(){s.success({title:"Tags set!",msg:"Tags has been set!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},i.tag.get({nolimit:!0,sort:"name"}).$promise.then(function(e){o.tags=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("DeskAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_DESKCONFIGURATION",g.deskConfiguration=angular.copy(l),g.configurations=r,g.newDeskConfiguration=!1,g.deskConfiguration||(g.deskConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_DESKCONFIGURATION",g.newDeskConfiguration=!0),g.addNewDeskConfiguration=function(){g.errors=[],d.intDeskAccount.addConfiguration({id:n.params.id},g.deskConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"DeskConfiguration properly created",msg:g.deskConfiguration.name?g.deskConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDeskConfiguration=function(){g.errors=[],d.intDeskConfiguration.update({id:g.deskConfiguration.id},g.deskConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"DeskConfiguration properly saved!",msg:g.deskConfiguration.name?g.deskConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDeskConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The deskConfiguration will be deleted.").ariaLabel("Delete DeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intDeskConfiguration.delete({id:g.deskConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.deskConfiguration.id}),o.success({title:"DeskConfiguration properly deleted!",msg:(g.deskConfiguration.name||"deskConfiguration")+" has been deleted!"}),v(g.deskConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","deskConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDeskConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDeskField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDeskField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intDeskField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDeskAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDeskAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.deskAccount=c||e.params.deskAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoDeskAccounts=function(){e.go("app.integrations.deskAccounts",{},{reload:"app.integrations.deskAccounts"})},u.saveDeskAccount=function(){r.intDeskAccount.update({id:u.deskAccount.id},u.deskAccount).$promise.then(function(){l.success({title:"DeskAccount updated!",msg:u.deskAccount.name?u.deskAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintDeskAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","deskAccount","userProfileSection"],angular.module("app.integrations").controller("DeskAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this;function h(e){a.hide(e)}v.currentUser=m.getCurrentUser(),v.errors=[],v.setting=p,v.license=u,v.crudPermissions=g,v.hasModulePermissions={},v.passwordPattern=v.setting&&v.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",v.title="INTEGRATIONS.EDIT_DYNAMICS365ACCOUNT",v.dynamics365Account=angular.copy(l),v.dynamics365Accounts=r,v.cloudProviders=d,v.newDynamics365Account=!1,v.dynamics365Account||(v.dynamics365Account={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),modernAuthentication:!1},v.title="INTEGRATIONS.NEW_DYNAMICS365ACCOUNT",v.newDynamics365Account=!0),v.addNewDynamics365Account=function(){v.errors=[],c.intDynamics365Account.save(v.dynamics365Account).$promise.then(function(e){v.dynamics365Accounts.unshift(e.toJSON()),o.success({title:"Dynamics365Account properly created",msg:v.dynamics365Account.name?v.dynamics365Account.name+" has been created!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Account.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Account.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.saveDynamics365Account=function(){v.errors=[],c.intDynamics365Account.update({id:v.dynamics365Account.id},v.dynamics365Account).$promise.then(function(e){var n=_.find(v.dynamics365Accounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Dynamics365Account properly saved!",msg:v.dynamics365Account.name?v.dynamics365Account.name+" has been saved!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Account.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Account.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.deleteDynamics365Account=function(e){v.errors=[];var n=a.confirm().title("Are you sure?").content("The dynamics365Account will be deleted.").ariaLabel("Delete Dynamics365Account").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intDynamics365Account.delete({id:v.dynamics365Account.id}).$promise.then(function(){_.remove(v.dynamics365Accounts,{id:v.dynamics365Account.id}),o.success({title:"Dynamics365Account properly deleted!",msg:(v.dynamics365Account.name||"dynamics365Account")+" has been deleted!"}),h(v.dynamics365Account)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Account.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Account.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},v.getDateFromString=function(e){return null===e?void 0:new Date(e)},v.closeDialog=h}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","dynamics365Accounts","dynamics365Account","cloudProviders","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDynamics365AccountDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=h,b.setting=f,b.currentUser=v.getCurrentUser(),b.dynamics365Accounts=l||{count:0,rows:[]},b.cloudProviders=d||{count:0,rows:[]},b.userProfile=c,b.userProfileSection=m&&1==m.count?m.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.table="dynamics365Accounts",b.listOrder="",b.listOrderAsc=null,b.selectedDynamics365Accounts=[],b.query={fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description,modernAuthentication",sort:"-updatedAt",limit:10,page:1},b.editstate=function(e,n){t.go("app.integrations.dynamics365Accounts.edit",{id:e.id,dynamics365Account:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,n){return u.intDynamics365Account.getFields({id:e.id,test:!0}).$promise.then(function(){g.success({title:"Dynamics365Account properly tested",msg:"Connection succeded!"})}).catch(function(e){g.error({title:"Dynamics365Account properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},b.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("dynamics365Account")+"?").htmlContent("<b>"+(e.name||"dynamics365Account")+"</b> will be deleted.").ariaLabel("delete dynamics365Account").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getDynamics365Accounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,v.hasRole("admin")?b.promise=u.intDynamics365Account.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Dynamics365Accounts",b.promise=u.userProfile.getResources(b.query,y).$promise)},b.createOrEditDynamics365Account=function(e,n){i.show({controller:"CreateOrEditDynamics365AccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{dynamics365Account:n,dynamics365Accounts:b.dynamics365Accounts.rows,cloudProviders:b.cloudProviders.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteDynamics365Account=S,b.exportSelectedDynamics365Accounts=function(){var e=angular.copy(b.selectedDynamics365Accounts);return b.selectedDynamics365Accounts=[],e},b.deleteSelectedDynamics365Accounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected dynamics365Accounts?").htmlContent("<b>"+b.selectedDynamics365Accounts.length+" selected</b> will be deleted.").ariaLabel("delete Dynamics365Accounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){b.selectedDynamics365Accounts.forEach(function(e){S(e)}),b.selectedDynamics365Accounts=[]})},b.deselectDynamics365Accounts=function(){b.selectedDynamics365Accounts=[]},b.selectAllDynamics365Accounts=function(){b.selectedDynamics365Accounts=b.dynamics365Accounts.rows};var A=!0,E=1;function y(e){b.dynamics365Accounts=e||{count:0,rows:[]}}function S(e){u.intDynamics365Account.delete({id:e.id}).$promise.then(function(){_.remove(b.dynamics365Accounts.rows,{id:e.id}),b.dynamics365Accounts.count-=1,b.dynamics365Accounts.rows.length||b.getDynamics365Accounts(),g.success({title:_.startCase("Dynamics365Account")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintDynamics365Account"}];for(var n=0;n<e.data.errors.length;n++)g.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else g.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintDynamics365Account",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){A?o(function(){A=!1}):(n||(E=b.query.page),e!==n&&(b.query.page=1),e||(b.query.page=E),b.getDynamics365Accounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","dynamics365Accounts","cloudProviders","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("Dynamics365AccountsController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intDynamics365Field.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intDynamics365Field.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intDynamics365Field.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.dynamics365Account={},o.dynamics365Configuration={},o.configurations=[],o.selectedDynamics365Configuration=-1,o.crudPermissions,o.init=function(e,n){o.dynamics365Account=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intDynamics365Account.getConfigurations({id:o.dynamics365Account.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getDynamics365Configuration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getDynamics365Configuration=function(e){o.advancedForm&&o.advancedForm.$setPristine();o.dynamics365Configuration=o.configurations[e],o.selectedDynamics365Configuration=e,i.intDynamics365Configuration.getSubjects({id:o.dynamics365Configuration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intDynamics365Configuration.getDescriptions({id:o.dynamics365Configuration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intDynamics365Configuration.getFields({id:o.dynamics365Configuration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditDynamics365Configuration=function(e,n){a.show({controller:"CreateOrEditDynamics365ConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{dynamics365Configuration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getDynamics365Configuration(0)})},o.deleteDynamics365Configuration=function(e,n){var t=a.confirm().title("Are you sure want to delete the dynamics365Configuration?").htmlContent("<b>"+(n.name||"dynamics365Configuration")+"</b> will be deleted.").ariaLabel("delete dynamics365Configuration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intDynamics365Configuration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"Dynamics365Configuration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getDynamics365Configuration(0)})},function(){console.log("CANCEL")})},o.saveDynamics365Configuration=function(){o.errors=[],i.intDynamics365Configuration.update({id:o.dynamics365Configuration.id},o.dynamics365Configuration).$promise.then(function(e){var n=_.find(o.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.advancedForm.$setPristine(),s.success({title:"Dynamics365Configuration properly saved!",msg:o.dynamics365Configuration.name?o.dynamics365Configuration.name+" has been saved!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){o.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.update"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("Dynamics365AccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_DYNAMICS365CONFIGURATION",g.dynamics365Configuration=angular.copy(l),g.configurations=r,g.newDynamics365Configuration=!1,g.dynamics365Configuration||(g.dynamics365Configuration={channel:"voice",type:"inbound",ticketType:"incident"},g.title="INTEGRATIONS.NEW_DYNAMICS365CONFIGURATION",g.newDynamics365Configuration=!0),g.addNewDynamics365Configuration=function(){g.errors=[],d.intDynamics365Account.addConfiguration({id:n.params.id},g.dynamics365Configuration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"Dynamics365Configuration properly created",msg:g.dynamics365Configuration.name?g.dynamics365Configuration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDynamics365Configuration=function(){g.errors=[],d.intDynamics365Configuration.update({id:g.dynamics365Configuration.id},g.dynamics365Configuration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Dynamics365Configuration properly saved!",msg:g.dynamics365Configuration.name?g.dynamics365Configuration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDynamics365Configuration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The dynamics365Configuration will be deleted.").ariaLabel("Delete Dynamics365Configuration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intDynamics365Configuration.delete({id:g.dynamics365Configuration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.dynamics365Configuration.id}),o.success({title:"Dynamics365Configuration properly deleted!",msg:(g.dynamics365Configuration.name||"dynamics365Configuration")+" has been deleted!"}),v(g.dynamics365Configuration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","dynamics365Configuration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDynamics365ConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDynamics365Field.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDynamics365Field.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intDynamics365Field.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDynamics365Account.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDynamics365AccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.dynamics365Account=c||e.params.dynamics365Account||{},p.cloudProviders=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.alert=l.info,p.gotoDynamics365Accounts=function(){e.go("app.integrations.dynamics365Accounts",{},{reload:"app.integrations.dynamics365Accounts"})},p.saveDynamics365Account=function(){r.intDynamics365Account.update({id:p.dynamics365Account.id},p.dynamics365Account).$promise.then(function(){l.success({title:"Dynamics365Account updated!",msg:p.dynamics365Account.name?p.dynamics365Account.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintDynamics365Account",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","dynamics365Account","cloudProviders","userProfileSection"],angular.module("app.integrations").controller("Dynamics365AccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHDESKACCOUNT",g.freshdeskAccount=angular.copy(l),g.freshdeskAccounts=r,g.newFreshdeskAccount=!1,g.freshdeskAccount||(g.freshdeskAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_FRESHDESKACCOUNT",g.newFreshdeskAccount=!0),g.addNewFreshdeskAccount=function(){g.errors=[],d.intFreshdeskAccount.save(g.freshdeskAccount).$promise.then(function(e){g.freshdeskAccounts.unshift(e.toJSON()),o.success({title:"FreshdeskAccount properly created",msg:g.freshdeskAccount.name?g.freshdeskAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshdeskAccount=function(){g.errors=[],d.intFreshdeskAccount.update({id:g.freshdeskAccount.id},g.freshdeskAccount).$promise.then(function(e){var n=_.find(g.freshdeskAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshdeskAccount properly saved!",msg:g.freshdeskAccount.name?g.freshdeskAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshdeskAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshdeskAccount will be deleted.").ariaLabel("Delete FreshdeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshdeskAccount.delete({id:g.freshdeskAccount.id}).$promise.then(function(){_.remove(g.freshdeskAccounts,{id:g.freshdeskAccount.id}),o.success({title:"FreshdeskAccount properly deleted!",msg:(g.freshdeskAccount.name||"freshdeskAccount")+" has been deleted!"}),v(g.freshdeskAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","freshdeskAccounts","freshdeskAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshdeskAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intFreshdeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intFreshdeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intFreshdeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.freshdeskAccount={},o.freshdeskConfiguration={},o.configurations=[],o.selectedFreshdeskConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.freshdeskAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intFreshdeskAccount.getConfigurations({id:o.freshdeskAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getFreshdeskConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getFreshdeskConfiguration=function(e){o.freshdeskConfiguration=o.configurations[e],o.selectedFreshdeskConfiguration=e,i.intFreshdeskConfiguration.getSubjects({id:o.freshdeskConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intFreshdeskConfiguration.getDescriptions({id:o.freshdeskConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intFreshdeskConfiguration.getFields({id:o.freshdeskConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),i.intFreshdeskConfiguration.getTags({id:o.freshdeskConfiguration.id}).$promise.then(function(e){o.selectedTags=e.rows?_.map(e.rows,"id"):[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditFreshdeskConfiguration=function(e,n){a.show({controller:"CreateOrEditFreshdeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshdeskConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getFreshdeskConfiguration(0)})},o.deleteFreshdeskConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the freshdeskConfiguration?").htmlContent("<b>"+(n.name||"freshdeskConfiguration")+"</b> will be deleted.").ariaLabel("delete freshdeskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intFreshdeskConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"FreshdeskConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getFreshdeskConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedTags=[],o.selectTagsChanged=function(e){i.intFreshdeskConfiguration.setTags({id:o.freshdeskConfiguration.id,ids:o.selectedTags}).$promise.then(function(){s.success({title:"Tags set!",msg:"Tags has been set!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},i.tag.get({nolimit:!0,sort:"name"}).$promise.then(function(e){o.tags=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("FreshdeskAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHDESKCONFIGURATION",g.freshdeskConfiguration=angular.copy(l),g.configurations=r,g.newFreshdeskConfiguration=!1,g.freshdeskConfiguration||(g.freshdeskConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_FRESHDESKCONFIGURATION",g.newFreshdeskConfiguration=!0),g.addNewFreshdeskConfiguration=function(){g.errors=[],d.intFreshdeskAccount.addConfiguration({id:n.params.id},g.freshdeskConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"FreshdeskConfiguration properly created",msg:g.freshdeskConfiguration.name?g.freshdeskConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshdeskConfiguration=function(){g.errors=[],d.intFreshdeskConfiguration.update({id:g.freshdeskConfiguration.id},g.freshdeskConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshdeskConfiguration properly saved!",msg:g.freshdeskConfiguration.name?g.freshdeskConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshdeskConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshdeskConfiguration will be deleted.").ariaLabel("Delete FreshdeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshdeskConfiguration.delete({id:g.freshdeskConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.freshdeskConfiguration.id}),o.success({title:"FreshdeskConfiguration properly deleted!",msg:(g.freshdeskConfiguration.name||"freshdeskConfiguration")+" has been deleted!"}),v(g.freshdeskConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","freshdeskConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshdeskConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshdeskField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshdeskField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intFreshdeskField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intFreshdeskAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshdeskAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.freshdeskAccount=c||e.params.freshdeskAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoFreshdeskAccounts=function(){e.go("app.integrations.freshdeskAccounts",{},{reload:"app.integrations.freshdeskAccounts"})},u.saveFreshdeskAccount=function(){r.intFreshdeskAccount.update({id:u.freshdeskAccount.id},u.freshdeskAccount).$promise.then(function(){l.success({title:"FreshdeskAccount updated!",msg:u.freshdeskAccount.name?u.freshdeskAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintFreshdeskAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","freshdeskAccount","userProfileSection"],angular.module("app.integrations").controller("FreshdeskAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.freshdeskAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="freshdeskAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedFreshdeskAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.freshdeskAccounts.edit",{id:e.id,freshdeskAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intFreshdeskAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"FreshdeskAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"FreshdeskAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("freshdeskAccount")+"?").htmlContent("<b>"+(e.name||"freshdeskAccount")+"</b> will be deleted.").ariaLabel("delete freshdeskAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getFreshdeskAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intFreshdeskAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FreshdeskAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFreshdeskAccount=function(e,n){i.show({controller:"CreateOrEditFreshdeskAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshdeskAccount:n,freshdeskAccounts:f.freshdeskAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteFreshdeskAccount=y,f.exportSelectedFreshdeskAccounts=function(){var e=angular.copy(f.selectedFreshdeskAccounts);return f.selectedFreshdeskAccounts=[],e},f.deleteSelectedFreshdeskAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected freshdeskAccounts?").htmlContent("<b>"+f.selectedFreshdeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FreshdeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFreshdeskAccounts.forEach(function(e){y(e)}),f.selectedFreshdeskAccounts=[]})},f.deselectFreshdeskAccounts=function(){f.selectedFreshdeskAccounts=[]},f.selectAllFreshdeskAccounts=function(){f.selectedFreshdeskAccounts=f.freshdeskAccounts.rows};var b=!0,A=1;function E(e){f.freshdeskAccounts=e||{count:0,rows:[]}}function y(e){m.intFreshdeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.freshdeskAccounts.rows,{id:e.id}),f.freshdeskAccounts.count-=1,f.freshdeskAccounts.rows.length||f.getFreshdeskAccounts(),p.success({title:_.startCase("FreshdeskAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintFreshdeskAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintFreshdeskAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFreshdeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","freshdeskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("FreshdeskAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHSALESACCOUNT",g.freshsalesAccount=angular.copy(l),g.freshsalesAccounts=r,g.newFreshsalesAccount=!1,g.freshsalesAccount||(g.freshsalesAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_FRESHSALESACCOUNT",g.newFreshsalesAccount=!0),g.addNewFreshsalesAccount=function(){g.errors=[],d.intFreshsalesAccount.save(g.freshsalesAccount).$promise.then(function(e){g.freshsalesAccounts.unshift(e.toJSON()),o.success({title:"FreshsalesAccount properly created",msg:g.freshsalesAccount.name?g.freshsalesAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshsalesAccount=function(){g.errors=[],d.intFreshsalesAccount.update({id:g.freshsalesAccount.id},g.freshsalesAccount).$promise.then(function(e){var n=_.find(g.freshsalesAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshsalesAccount properly saved!",msg:g.freshsalesAccount.name?g.freshsalesAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshsalesAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshsalesAccount will be deleted.").ariaLabel("Delete FreshsalesAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshsalesAccount.delete({id:g.freshsalesAccount.id}).$promise.then(function(){_.remove(g.freshsalesAccounts,{id:g.freshsalesAccount.id}),o.success({title:"FreshsalesAccount properly deleted!",msg:(g.freshsalesAccount.name||"freshsalesAccount")+" has been deleted!"}),v(g.freshsalesAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","freshsalesAccounts","freshsalesAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshsalesAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intFreshsalesField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intFreshsalesField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intFreshsalesField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.freshsalesAccount={},o.freshsalesConfiguration={},o.configurations=[],o.selectedFreshsalesConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.freshsalesAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intFreshsalesAccount.getConfigurations({id:o.freshsalesAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getFreshsalesConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getFreshsalesConfiguration=function(e){o.freshsalesConfiguration=o.configurations[e],o.selectedFreshsalesConfiguration=e,i.intFreshsalesConfiguration.getSubjects({id:o.freshsalesConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intFreshsalesConfiguration.getDescriptions({id:o.freshsalesConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intFreshsalesConfiguration.getFields({id:o.freshsalesConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditFreshsalesConfiguration=function(e,n){a.show({controller:"CreateOrEditFreshsalesConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshsalesConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getFreshsalesConfiguration(0)})},o.deleteFreshsalesConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the freshsalesConfiguration?").htmlContent("<b>"+(n.name||"freshsalesConfiguration")+"</b> will be deleted.").ariaLabel("delete freshsalesConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intFreshsalesConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"FreshsalesConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getFreshsalesConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditFreshsalesAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.freshsalesConfiguration,account:o.freshsalesAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditFreshsalesAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.freshsalesConfiguration,account:o.freshsalesAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditFreshsalesAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.freshsalesConfiguration,account:o.freshsalesAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("FreshsalesAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHSALESCONFIGURATION",g.freshsalesConfiguration=angular.copy(l),g.configurations=r,g.newFreshsalesConfiguration=!1,g.freshsalesConfiguration||(g.freshsalesConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_FRESHSALESCONFIGURATION",g.newFreshsalesConfiguration=!0),g.addNewFreshsalesConfiguration=function(){g.errors=[],d.intFreshsalesAccount.addConfiguration({id:n.params.id},g.freshsalesConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"FreshsalesConfiguration properly created",msg:g.freshsalesConfiguration.name?g.freshsalesConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshsalesConfiguration=function(){g.errors=[],d.intFreshsalesConfiguration.update({id:g.freshsalesConfiguration.id},g.freshsalesConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshsalesConfiguration properly saved!",msg:g.freshsalesConfiguration.name?g.freshsalesConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshsalesConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshsalesConfiguration will be deleted.").ariaLabel("Delete FreshsalesConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshsalesConfiguration.delete({id:g.freshsalesConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.freshsalesConfiguration.id}),o.success({title:"FreshsalesConfiguration properly deleted!",msg:(g.freshsalesConfiguration.name||"freshsalesConfiguration")+" has been deleted!"}),v(g.freshsalesConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","freshsalesConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshsalesConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshsalesField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshsalesField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intFreshsalesField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intFreshsalesAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshsalesAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.freshsalesAccount=c||e.params.freshsalesAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoFreshsalesAccounts=function(){e.go("app.integrations.freshsalesAccounts",{},{reload:"app.integrations.freshsalesAccounts"})},u.saveFreshsalesAccount=function(){r.intFreshsalesAccount.update({id:u.freshsalesAccount.id},u.freshsalesAccount).$promise.then(function(){l.success({title:"FreshsalesAccount updated!",msg:u.freshsalesAccount.name?u.freshsalesAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintFreshsalesAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","freshsalesAccount","userProfileSection"],angular.module("app.integrations").controller("FreshsalesAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.freshsalesAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="freshsalesAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedFreshsalesAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.freshsalesAccounts.edit",{id:e.id,freshsalesAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intFreshsalesAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"FreshsalesAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"FreshsalesAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("freshsalesAccount")+"?").htmlContent("<b>"+(e.name||"freshsalesAccount")+"</b> will be deleted.").ariaLabel("delete freshsalesAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getFreshsalesAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intFreshsalesAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FreshsalesAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFreshsalesAccount=function(e,n){i.show({controller:"CreateOrEditFreshsalesAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshsalesAccount:n,freshsalesAccounts:f.freshsalesAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteFreshsalesAccount=y,f.exportSelectedFreshsalesAccounts=function(){var e=angular.copy(f.selectedFreshsalesAccounts);return f.selectedFreshsalesAccounts=[],e},f.deleteSelectedFreshsalesAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected freshsalesAccounts?").htmlContent("<b>"+f.selectedFreshsalesAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FreshsalesAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFreshsalesAccounts.forEach(function(e){y(e)}),f.selectedFreshsalesAccounts=[]})},f.deselectFreshsalesAccounts=function(){f.selectedFreshsalesAccounts=[]},f.selectAllFreshsalesAccounts=function(){f.selectedFreshsalesAccounts=f.freshsalesAccounts.rows};var b=!0,A=1;function E(e){f.freshsalesAccounts=e||{count:0,rows:[]}}function y(e){m.intFreshsalesAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.freshsalesAccounts.rows,{id:e.id}),f.freshsalesAccounts.count-=1,f.freshsalesAccounts.rows.length||f.getFreshsalesAccounts(),p.success({title:_.startCase("FreshsalesAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintFreshsalesAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintFreshsalesAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFreshsalesAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","freshsalesAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("FreshsalesAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SALESFORCEACCOUNT",g.salesforceAccount=angular.copy(l),g.salesforceAccounts=r,g.newSalesforceAccount=!1,g.salesforceAccount||(g.salesforceAccount={type:"integrationTab",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_SALESFORCEACCOUNT",g.newSalesforceAccount=!0),g.addNewSalesforceAccount=function(){g.errors=[],d.intSalesforceAccount.save(g.salesforceAccount).$promise.then(function(e){g.salesforceAccounts.unshift(e.toJSON()),o.success({title:"SalesforceAccount properly created",msg:g.salesforceAccount.name?g.salesforceAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSalesforceAccount=function(){g.errors=[],d.intSalesforceAccount.update({id:g.salesforceAccount.id},g.salesforceAccount).$promise.then(function(e){var n=_.find(g.salesforceAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SalesforceAccount properly saved!",msg:g.salesforceAccount.name?g.salesforceAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSalesforceAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The salesforceAccount will be deleted.").ariaLabel("Delete SalesforceAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSalesforceAccount.delete({id:g.salesforceAccount.id}).$promise.then(function(){_.remove(g.salesforceAccounts,{id:g.salesforceAccount.id}),o.success({title:"SalesforceAccount properly deleted!",msg:(g.salesforceAccount.name||"salesforceAccount")+" has been deleted!"}),v(g.salesforceAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","salesforceAccounts","salesforceAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSalesforceAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function n(){return"Case"===o.salesforceConfiguration.ticketType&&("lead"===o.salesforceConfiguration.moduleCreate||_.includes(["lead","contact_lead","account_contact_lead"],o.salesforceConfiguration.moduleSearch))}function r(){return _.includes(["lead","contact_lead","account_contact_lead"],o.salesforceConfiguration.moduleSearch)}function l(){return _.includes(["contact","contact_lead","account_contact_lead"],o.salesforceConfiguration.moduleSearch)}function d(){return _.includes(["account","account_contact_lead"],o.salesforceConfiguration.moduleSearch)}function c(){return i.intSalesforceConfiguration.update({id:o.salesforceConfiguration.id},o.salesforceConfiguration).$promise.then(function(){s.success({title:"Module updated!",msg:"Module has been updated!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function m(e){i.intSalesforceField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function u(e){i.intSalesforceField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(e){i.intSalesforceField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.salesforceAccount={},o.salesforceConfiguration={},o.configurations=[],o.selectedSalesforceConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.salesforceAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intSalesforceAccount.getConfigurations({id:o.salesforceAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getSalesforceConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getSalesforceConfiguration=function(e){o.salesforceConfiguration=o.configurations[e],o.salesforceConfiguration.isLead=n(),o.salesforceConfiguration.isLeadSearch=r(),o.salesforceConfiguration.isContactSearch=l(),o.salesforceConfiguration.isAccountSearch=d(),o.selectedSalesforceConfiguration=e,i.intSalesforceConfiguration.getSubjects({id:o.salesforceConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intSalesforceConfiguration.getDescriptions({id:o.salesforceConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intSalesforceConfiguration.getFields({id:o.salesforceConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditSalesforceConfiguration=function(e,n){a.show({controller:"CreateOrEditSalesforceConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{salesforceConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getSalesforceConfiguration(0)})},o.deleteSalesforceConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the salesforceConfiguration?").htmlContent("<b>"+(n.name||"salesforceConfiguration")+"</b> will be deleted.").ariaLabel("delete salesforceConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intSalesforceConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"SalesforceConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getSalesforceConfiguration(0)})},function(){console.log("CANCEL")})},o.selectChangedAdvanced=function(){o.salesforceConfiguration.isLead=n(),o.salesforceConfiguration.isLeadSearch=r(),o.salesforceConfiguration.isContactSearch=l(),o.salesforceConfiguration.isAccountSearch=d(),c()},o.salesforceConfiguration.isLead=!1,o.salesforceConfiguration.isLeadSearch=!1,o.salesforceConfiguration.isContactSearch=!1,o.salesforceConfiguration.isAccountSearch=!1,o.checkIsLead=n,o.checkIsLeadSearch=r,o.checkIsContactSearch=l,o.checkIsAccountSearch=d,o.saveSalesforceConfiguration=c,o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){m(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){m(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){u(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){u(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){p(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){p(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("SalesforceAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SALESFORCECONFIGURATION",g.salesforceConfiguration=angular.copy(l),g.configurations=r,g.newSalesforceConfiguration=!1,g.salesforceConfiguration||(g.salesforceConfiguration={channel:"voice",type:"inbound",ticketType:"Task"},g.title="INTEGRATIONS.NEW_SALESFORCECONFIGURATION",g.newSalesforceConfiguration=!0),g.addNewSalesforceConfiguration=function(){g.errors=[],d.intSalesforceAccount.addConfiguration({id:n.params.id},g.salesforceConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"SalesforceConfiguration properly created",msg:g.salesforceConfiguration.name?g.salesforceConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSalesforceConfiguration=function(){g.errors=[],d.intSalesforceConfiguration.update({id:g.salesforceConfiguration.id},g.salesforceConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SalesforceConfiguration properly saved!",msg:g.salesforceConfiguration.name?g.salesforceConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSalesforceConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The salesforceConfiguration will be deleted.").ariaLabel("Delete SalesforceConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSalesforceConfiguration.delete({id:g.salesforceConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.salesforceConfiguration.id}),o.success({title:"SalesforceConfiguration properly deleted!",msg:(g.salesforceConfiguration.name||"salesforceConfiguration")+" has been deleted!"}),v(g.salesforceConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","salesforceConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSalesforceConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSalesforceField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSalesforceField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intSalesforceField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSalesforceAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSalesforceAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.salesforceAccount=c||e.params.salesforceAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoSalesforceAccounts=function(){e.go("app.integrations.salesforceAccounts",{},{reload:"app.integrations.salesforceAccounts"})},u.saveSalesforceAccount=function(){r.intSalesforceAccount.update({id:u.salesforceAccount.id},u.salesforceAccount).$promise.then(function(){l.success({title:"SalesforceAccount updated!",msg:u.salesforceAccount.name?u.salesforceAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintSalesforceAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","salesforceAccount","userProfileSection"],angular.module("app.integrations").controller("SalesforceAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.salesforceAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="salesforceAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedSalesforceAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.salesforceAccounts.edit",{id:e.id,salesforceAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intSalesforceAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"SalesforceAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"SalesforceAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("salesforceAccount")+"?").htmlContent("<b>"+(e.name||"salesforceAccount")+"</b> will be deleted.").ariaLabel("delete salesforceAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSalesforceAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intSalesforceAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SalesforceAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSalesforceAccount=function(e,n){i.show({controller:"CreateOrEditSalesforceAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{salesforceAccount:n,salesforceAccounts:f.salesforceAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSalesforceAccount=y,f.exportSelectedSalesforceAccounts=function(){var e=angular.copy(f.selectedSalesforceAccounts);return f.selectedSalesforceAccounts=[],e},f.deleteSelectedSalesforceAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected salesforceAccounts?").htmlContent("<b>"+f.selectedSalesforceAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SalesforceAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSalesforceAccounts.forEach(function(e){y(e)}),f.selectedSalesforceAccounts=[]})},f.deselectSalesforceAccounts=function(){f.selectedSalesforceAccounts=[]},f.selectAllSalesforceAccounts=function(){f.selectedSalesforceAccounts=f.salesforceAccounts.rows};var b=!0,A=1;function E(e){f.salesforceAccounts=e||{count:0,rows:[]}}function y(e){m.intSalesforceAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.salesforceAccounts.rows,{id:e.id}),f.salesforceAccounts.count-=1,f.salesforceAccounts.rows.length||f.getSalesforceAccounts(),p.success({title:_.startCase("SalesforceAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintSalesforceAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintSalesforceAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSalesforceAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","salesforceAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("SalesforceAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SERVICENOWACCOUNT",g.servicenowAccount=angular.copy(l),g.servicenowAccounts=r,g.newServicenowAccount=!1,g.servicenowAccount||(g.servicenowAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_SERVICENOWACCOUNT",g.newServicenowAccount=!0),g.addNewServicenowAccount=function(){g.errors=[],d.intServicenowAccount.save(g.servicenowAccount).$promise.then(function(e){g.servicenowAccounts.unshift(e.toJSON()),o.success({title:"ServicenowAccount properly created",msg:g.servicenowAccount.name?g.servicenowAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveServicenowAccount=function(){g.errors=[],d.intServicenowAccount.update({id:g.servicenowAccount.id},g.servicenowAccount).$promise.then(function(e){var n=_.find(g.servicenowAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ServicenowAccount properly saved!",msg:g.servicenowAccount.name?g.servicenowAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteServicenowAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The servicenowAccount will be deleted.").ariaLabel("Delete ServicenowAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intServicenowAccount.delete({id:g.servicenowAccount.id}).$promise.then(function(){_.remove(g.servicenowAccounts,{id:g.servicenowAccount.id}),o.success({title:"ServicenowAccount properly deleted!",msg:(g.servicenowAccount.name||"servicenowAccount")+" has been deleted!"}),v(g.servicenowAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","servicenowAccounts","servicenowAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditServicenowAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intServicenowField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intServicenowField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intServicenowField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.servicenowAccount={},o.servicenowConfiguration={},o.configurations=[],o.selectedServicenowConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.servicenowAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intServicenowAccount.getConfigurations({id:o.servicenowAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getServicenowConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getServicenowConfiguration=function(e){o.servicenowConfiguration=o.configurations[e],o.selectedServicenowConfiguration=e,i.intServicenowConfiguration.getSubjects({id:o.servicenowConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intServicenowConfiguration.getDescriptions({id:o.servicenowConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intServicenowConfiguration.getFields({id:o.servicenowConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditServicenowConfiguration=function(e,n){a.show({controller:"CreateOrEditServicenowConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{servicenowConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getServicenowConfiguration(0)})},o.deleteServicenowConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the servicenowConfiguration?").htmlContent("<b>"+(n.name||"servicenowConfiguration")+"</b> will be deleted.").ariaLabel("delete servicenowConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intServicenowConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"ServicenowConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getServicenowConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("ServicenowAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SERVICENOWCONFIGURATION",g.servicenowConfiguration=angular.copy(l),g.configurations=r,g.newServicenowConfiguration=!1,g.servicenowConfiguration||(g.servicenowConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_SERVICENOWCONFIGURATION",g.newServicenowConfiguration=!0),g.addNewServicenowConfiguration=function(){g.errors=[],d.intServicenowAccount.addConfiguration({id:n.params.id},g.servicenowConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"ServicenowConfiguration properly created",msg:g.servicenowConfiguration.name?g.servicenowConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveServicenowConfiguration=function(){g.errors=[],d.intServicenowConfiguration.update({id:g.servicenowConfiguration.id},g.servicenowConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ServicenowConfiguration properly saved!",msg:g.servicenowConfiguration.name?g.servicenowConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteServicenowConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The servicenowConfiguration will be deleted.").ariaLabel("Delete ServicenowConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intServicenowConfiguration.delete({id:g.servicenowConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.servicenowConfiguration.id}),o.success({title:"ServicenowConfiguration properly deleted!",msg:(g.servicenowConfiguration.name||"servicenowConfiguration")+" has been deleted!"}),v(g.servicenowConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","servicenowConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditServicenowConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intServicenowField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intServicenowField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intServicenowField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intServicenowAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditServicenowAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.servicenowAccount=c||e.params.servicenowAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoServicenowAccounts=function(){e.go("app.integrations.servicenowAccounts",{},{reload:"app.integrations.servicenowAccounts"})},u.saveServicenowAccount=function(){r.intServicenowAccount.update({id:u.servicenowAccount.id},u.servicenowAccount).$promise.then(function(){l.success({title:"ServicenowAccount updated!",msg:u.servicenowAccount.name?u.servicenowAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintServicenowAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","servicenowAccount","userProfileSection"],angular.module("app.integrations").controller("ServicenowAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.servicenowAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="servicenowAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedServicenowAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.servicenowAccounts.edit",{id:e.id,servicenowAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intServicenowAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"ServicenowAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"ServicenowAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("servicenowAccount")+"?").htmlContent("<b>"+(e.name||"servicenowAccount")+"</b> will be deleted.").ariaLabel("delete servicenowAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getServicenowAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intServicenowAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ServicenowAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditServicenowAccount=function(e,n){i.show({controller:"CreateOrEditServicenowAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{servicenowAccount:n,servicenowAccounts:f.servicenowAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteServicenowAccount=y,f.exportSelectedServicenowAccounts=function(){var e=angular.copy(f.selectedServicenowAccounts);return f.selectedServicenowAccounts=[],e},f.deleteSelectedServicenowAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected servicenowAccounts?").htmlContent("<b>"+f.selectedServicenowAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ServicenowAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedServicenowAccounts.forEach(function(e){y(e)}),f.selectedServicenowAccounts=[]})},f.deselectServicenowAccounts=function(){f.selectedServicenowAccounts=[]},f.selectAllServicenowAccounts=function(){f.selectedServicenowAccounts=f.servicenowAccounts.rows};var b=!0,A=1;function E(e){f.servicenowAccounts=e||{count:0,rows:[]}}function y(e){m.intServicenowAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.servicenowAccounts.rows,{id:e.id}),f.servicenowAccounts.count-=1,f.servicenowAccounts.rows.length||f.getServicenowAccounts(),p.success({title:_.startCase("ServicenowAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintServicenowAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintServicenowAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getServicenowAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","servicenowAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("ServicenowAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SUGARCRMACCOUNT",g.sugarcrmAccount=angular.copy(l),g.sugarcrmAccounts=r,g.newSugarcrmAccount=!1,g.sugarcrmAccount||(g.sugarcrmAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_SUGARCRMACCOUNT",g.newSugarcrmAccount=!0),g.addNewSugarcrmAccount=function(){g.errors=[],d.intSugarcrmAccount.save(g.sugarcrmAccount).$promise.then(function(e){g.sugarcrmAccounts.unshift(e.toJSON()),o.success({title:"SugarcrmAccount properly created",msg:g.sugarcrmAccount.name?g.sugarcrmAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSugarcrmAccount=function(){g.errors=[],d.intSugarcrmAccount.update({id:g.sugarcrmAccount.id},g.sugarcrmAccount).$promise.then(function(e){var n=_.find(g.sugarcrmAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SugarcrmAccount properly saved!",msg:g.sugarcrmAccount.name?g.sugarcrmAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSugarcrmAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The sugarcrmAccount will be deleted.").ariaLabel("Delete SugarcrmAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSugarcrmAccount.delete({id:g.sugarcrmAccount.id}).$promise.then(function(){_.remove(g.sugarcrmAccounts,{id:g.sugarcrmAccount.id}),o.success({title:"SugarcrmAccount properly deleted!",msg:(g.sugarcrmAccount.name||"sugarcrmAccount")+" has been deleted!"}),v(g.sugarcrmAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","sugarcrmAccounts","sugarcrmAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSugarcrmAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intSugarcrmField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intSugarcrmField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intSugarcrmField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.sugarcrmAccount={},o.sugarcrmConfiguration={},o.configurations=[],o.selectedSugarcrmConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.sugarcrmAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intSugarcrmAccount.getConfigurations({id:o.sugarcrmAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getSugarcrmConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getSugarcrmConfiguration=function(e){o.sugarcrmConfiguration=o.configurations[e],o.selectedSugarcrmConfiguration=e,i.intSugarcrmConfiguration.getSubjects({id:o.sugarcrmConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intSugarcrmConfiguration.getDescriptions({id:o.sugarcrmConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intSugarcrmConfiguration.getFields({id:o.sugarcrmConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditSugarcrmConfiguration=function(e,n){a.show({controller:"CreateOrEditSugarcrmConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{sugarcrmConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getSugarcrmConfiguration(0)})},o.deleteSugarcrmConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the sugarcrmConfiguration?").htmlContent("<b>"+(n.name||"sugarcrmConfiguration")+"</b> will be deleted.").ariaLabel("delete sugarcrmConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intSugarcrmConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"SugarcrmConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getSugarcrmConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("SugarcrmAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SUGARCRMCONFIGURATION",g.sugarcrmConfiguration=angular.copy(l),g.configurations=r,g.newSugarcrmConfiguration=!1,g.sugarcrmConfiguration||(g.sugarcrmConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_SUGARCRMCONFIGURATION",g.newSugarcrmConfiguration=!0),g.addNewSugarcrmConfiguration=function(){g.errors=[],d.intSugarcrmAccount.addConfiguration({id:n.params.id},g.sugarcrmConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"SugarcrmConfiguration properly created",msg:g.sugarcrmConfiguration.name?g.sugarcrmConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSugarcrmConfiguration=function(){g.errors=[],d.intSugarcrmConfiguration.update({id:g.sugarcrmConfiguration.id},g.sugarcrmConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SugarcrmConfiguration properly saved!",msg:g.sugarcrmConfiguration.name?g.sugarcrmConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSugarcrmConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The sugarcrmConfiguration will be deleted.").ariaLabel("Delete SugarcrmConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSugarcrmConfiguration.delete({id:g.sugarcrmConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.sugarcrmConfiguration.id}),o.success({title:"SugarcrmConfiguration properly deleted!",msg:(g.sugarcrmConfiguration.name||"sugarcrmConfiguration")+" has been deleted!"}),v(g.sugarcrmConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","sugarcrmConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSugarcrmConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSugarcrmField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSugarcrmField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intSugarcrmField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSugarcrmAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSugarcrmAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.sugarcrmAccount=c||e.params.sugarcrmAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoSugarcrmAccounts=function(){e.go("app.integrations.sugarcrmAccounts",{},{reload:"app.integrations.sugarcrmAccounts"})},u.saveSugarcrmAccount=function(){r.intSugarcrmAccount.update({id:u.sugarcrmAccount.id},u.sugarcrmAccount).$promise.then(function(){l.success({title:"SugarcrmAccount updated!",msg:u.sugarcrmAccount.name?u.sugarcrmAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintSugarcrmAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","sugarcrmAccount","userProfileSection"],angular.module("app.integrations").controller("SugarcrmAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.sugarcrmAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="sugarcrmAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedSugarcrmAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.sugarcrmAccounts.edit",{id:e.id,sugarcrmAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intSugarcrmAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"SugarcrmAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"SugarcrmAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("sugarcrmAccount")+"?").htmlContent("<b>"+(e.name||"sugarcrmAccount")+"</b> will be deleted.").ariaLabel("delete sugarcrmAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSugarcrmAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intSugarcrmAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SugarcrmAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSugarcrmAccount=function(e,n){i.show({controller:"CreateOrEditSugarcrmAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{sugarcrmAccount:n,sugarcrmAccounts:f.sugarcrmAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSugarcrmAccount=y,f.exportSelectedSugarcrmAccounts=function(){var e=angular.copy(f.selectedSugarcrmAccounts);return f.selectedSugarcrmAccounts=[],e},f.deleteSelectedSugarcrmAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected sugarcrmAccounts?").htmlContent("<b>"+f.selectedSugarcrmAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SugarcrmAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSugarcrmAccounts.forEach(function(e){y(e)}),f.selectedSugarcrmAccounts=[]})},f.deselectSugarcrmAccounts=function(){f.selectedSugarcrmAccounts=[]},f.selectAllSugarcrmAccounts=function(){f.selectedSugarcrmAccounts=f.sugarcrmAccounts.rows};var b=!0,A=1;function E(e){f.sugarcrmAccounts=e||{count:0,rows:[]}}function y(e){m.intSugarcrmAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.sugarcrmAccounts.rows,{id:e.id}),f.sugarcrmAccounts.count-=1,f.sugarcrmAccounts.rows.length||f.getSugarcrmAccounts(),p.success({title:_.startCase("SugarcrmAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintSugarcrmAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintSugarcrmAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSugarcrmAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","sugarcrmAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("SugarcrmAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_VTIGERACCOUNT",g.vtigerAccount=angular.copy(l),g.vtigerAccounts=r,g.newVtigerAccount=!1,g.vtigerAccount||(g.vtigerAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_VTIGERACCOUNT",g.newVtigerAccount=!0),g.addNewVtigerAccount=function(){g.errors=[],d.intVtigerAccount.save(g.vtigerAccount).$promise.then(function(e){g.vtigerAccounts.unshift(e.toJSON()),o.success({title:"VtigerAccount properly created",msg:g.vtigerAccount.name?g.vtigerAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVtigerAccount=function(){g.errors=[],d.intVtigerAccount.update({id:g.vtigerAccount.id},g.vtigerAccount).$promise.then(function(e){var n=_.find(g.vtigerAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"VtigerAccount properly saved!",msg:g.vtigerAccount.name?g.vtigerAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVtigerAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The vtigerAccount will be deleted.").ariaLabel("Delete VtigerAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intVtigerAccount.delete({id:g.vtigerAccount.id}).$promise.then(function(){_.remove(g.vtigerAccounts,{id:g.vtigerAccount.id}),o.success({title:"VtigerAccount properly deleted!",msg:(g.vtigerAccount.name||"vtigerAccount")+" has been deleted!"}),v(g.vtigerAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","vtigerAccounts","vtigerAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditVtigerAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intVtigerField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intVtigerField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intVtigerField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.vtigerAccount={},o.vtigerConfiguration={},o.configurations=[],o.selectedVtigerConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.vtigerAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intVtigerAccount.getConfigurations({id:o.vtigerAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getVtigerConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getVtigerConfiguration=function(e){o.vtigerConfiguration=o.configurations[e],o.selectedVtigerConfiguration=e,i.intVtigerConfiguration.getSubjects({id:o.vtigerConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intVtigerConfiguration.getDescriptions({id:o.vtigerConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intVtigerConfiguration.getFields({id:o.vtigerConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditVtigerConfiguration=function(e,n){a.show({controller:"CreateOrEditVtigerConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{vtigerConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getVtigerConfiguration(0)})},o.deleteVtigerConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the vtigerConfiguration?").htmlContent("<b>"+(n.name||"vtigerConfiguration")+"</b> will be deleted.").ariaLabel("delete vtigerConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intVtigerConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"VtigerConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getVtigerConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("VtigerAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_VTIGERCONFIGURATION",g.vtigerConfiguration=angular.copy(l),g.configurations=r,g.newVtigerConfiguration=!1,g.vtigerConfiguration||(g.vtigerConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_VTIGERCONFIGURATION",g.newVtigerConfiguration=!0),g.addNewVtigerConfiguration=function(){g.errors=[],d.intVtigerAccount.addConfiguration({id:n.params.id},g.vtigerConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"VtigerConfiguration properly created",msg:g.vtigerConfiguration.name?g.vtigerConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVtigerConfiguration=function(){g.errors=[],d.intVtigerConfiguration.update({id:g.vtigerConfiguration.id},g.vtigerConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"VtigerConfiguration properly saved!",msg:g.vtigerConfiguration.name?g.vtigerConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVtigerConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The vtigerConfiguration will be deleted.").ariaLabel("Delete VtigerConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intVtigerConfiguration.delete({id:g.vtigerConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.vtigerConfiguration.id}),o.success({title:"VtigerConfiguration properly deleted!",msg:(g.vtigerConfiguration.name||"vtigerConfiguration")+" has been deleted!"}),v(g.vtigerConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","vtigerConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditVtigerConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intVtigerField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intVtigerField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intVtigerField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intVtigerAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditVtigerAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.vtigerAccount=c||e.params.vtigerAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoVtigerAccounts=function(){e.go("app.integrations.vtigerAccounts",{},{reload:"app.integrations.vtigerAccounts"})},u.saveVtigerAccount=function(){r.intVtigerAccount.update({id:u.vtigerAccount.id},u.vtigerAccount).$promise.then(function(){l.success({title:"VtigerAccount updated!",msg:u.vtigerAccount.name?u.vtigerAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintVtigerAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","vtigerAccount","userProfileSection"],angular.module("app.integrations").controller("VtigerAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.vtigerAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="vtigerAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedVtigerAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.vtigerAccounts.edit",{id:e.id,vtigerAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intVtigerAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"VtigerAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"VtigerAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("vtigerAccount")+"?").htmlContent("<b>"+(e.name||"vtigerAccount")+"</b> will be deleted.").ariaLabel("delete vtigerAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVtigerAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intVtigerAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="VtigerAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVtigerAccount=function(e,n){i.show({controller:"CreateOrEditVtigerAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{vtigerAccount:n,vtigerAccounts:f.vtigerAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteVtigerAccount=y,f.exportSelectedVtigerAccounts=function(){var e=angular.copy(f.selectedVtigerAccounts);return f.selectedVtigerAccounts=[],e},f.deleteSelectedVtigerAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected vtigerAccounts?").htmlContent("<b>"+f.selectedVtigerAccounts.length+" selected</b> will be deleted.").ariaLabel("delete VtigerAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVtigerAccounts.forEach(function(e){y(e)}),f.selectedVtigerAccounts=[]})},f.deselectVtigerAccounts=function(){f.selectedVtigerAccounts=[]},f.selectAllVtigerAccounts=function(){f.selectedVtigerAccounts=f.vtigerAccounts.rows};var b=!0,A=1;function E(e){f.vtigerAccounts=e||{count:0,rows:[]}}function y(e){m.intVtigerAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.vtigerAccounts.rows,{id:e.id}),f.vtigerAccounts.count-=1,f.vtigerAccounts.rows.length||f.getVtigerAccounts(),p.success({title:_.startCase("VtigerAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintVtigerAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintVtigerAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVtigerAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","vtigerAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("VtigerAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZENDESKACCOUNT",g.zendeskAccount=angular.copy(l),g.zendeskAccounts=r,g.newZendeskAccount=!1,g.zendeskAccount||(g.zendeskAccount={type:"integrationTab",authType:"password",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_ZENDESKACCOUNT",g.newZendeskAccount=!0),g.addNewZendeskAccount=function(){g.errors=[],d.intZendeskAccount.save(g.zendeskAccount).$promise.then(function(e){g.zendeskAccounts.unshift(e.toJSON()),o.success({title:"ZendeskAccount properly created",msg:g.zendeskAccount.name?g.zendeskAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZendeskAccount=function(){g.errors=[],d.intZendeskAccount.update({id:g.zendeskAccount.id},g.zendeskAccount).$promise.then(function(e){var n=_.find(g.zendeskAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZendeskAccount properly saved!",msg:g.zendeskAccount.name?g.zendeskAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZendeskAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zendeskAccount will be deleted.").ariaLabel("Delete ZendeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZendeskAccount.delete({id:g.zendeskAccount.id}).$promise.then(function(){_.remove(g.zendeskAccounts,{id:g.zendeskAccount.id}),o.success({title:"ZendeskAccount properly deleted!",msg:(g.zendeskAccount.name||"zendeskAccount")+" has been deleted!"}),v(g.zendeskAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","zendeskAccounts","zendeskAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZendeskAccountDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZendeskField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZendeskField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intZendeskField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intZendeskAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZendeskAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.zendeskAccount=c||e.params.zendeskAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoZendeskAccounts=function(){e.go("app.integrations.zendeskAccounts",{},{reload:"app.integrations.zendeskAccounts"})},u.saveZendeskAccount=function(){r.intZendeskAccount.update({id:u.zendeskAccount.id},u.zendeskAccount).$promise.then(function(){l.success({title:"ZendeskAccount updated!",msg:u.zendeskAccount.name?u.zendeskAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintZendeskAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","zendeskAccount","userProfileSection"],angular.module("app.integrations").controller("ZendeskAccountController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intZendeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intZendeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intZendeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.zendeskAccount={},o.zendeskConfiguration={},o.zendeskConfigurations=[],o.selectedZendeskConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.zendeskAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intZendeskAccount.getConfigurations({id:o.zendeskAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.zendeskConfigurations=e.rows?e.rows:[],o.zendeskConfigurations.length&&o.getZendeskConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getZendeskConfiguration=function(e){o.zendeskConfiguration=o.zendeskConfigurations[e],o.selectedZendeskConfiguration=e,i.intZendeskConfiguration.getSubjects({id:o.zendeskConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intZendeskConfiguration.getDescriptions({id:o.zendeskConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intZendeskConfiguration.getFields({id:o.zendeskConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),i.intZendeskConfiguration.getTags({id:o.zendeskConfiguration.id}).$promise.then(function(e){o.selectedTags=e.rows?_.map(e.rows,"id"):[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditZendeskConfiguration=function(e,n){a.show({controller:"CreateOrEditZendeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/zendeskConfigurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{zendeskConfiguration:n,zendeskConfigurations:o.zendeskConfigurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getZendeskConfiguration(0)})},o.deleteZendeskConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the zendeskConfiguration?").htmlContent("<b>"+(n.name||"zendeskConfiguration")+"</b> will be deleted.").ariaLabel("delete zendeskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intZendeskConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.zendeskConfigurations,{id:n.id}),s.success({title:"ZendeskConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getZendeskConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedTags=[],o.selectTagsChanged=function(e){i.intZendeskConfiguration.setTags({id:o.zendeskConfiguration.id,ids:o.selectedTags}).$promise.then(function(){s.success({title:"Tags set!",msg:"Tags has been set!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},i.tag.get({nolimit:!0,sort:"name"}).$promise.then(function(e){o.tags=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("ZendeskAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZENDESKCONFIGURATION",g.zendeskConfiguration=angular.copy(l),g.zendeskConfigurations=r,g.newZendeskConfiguration=!1,g.zendeskConfiguration||(g.zendeskConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_ZENDESKCONFIGURATION",g.newZendeskConfiguration=!0),g.addNewZendeskConfiguration=function(){g.errors=[],d.intZendeskAccount.addConfiguration({id:n.params.id},g.zendeskConfiguration).$promise.then(function(e){g.zendeskConfigurations.unshift(e.toJSON()),o.success({title:"ZendeskConfiguration properly created",msg:g.zendeskConfiguration.name?g.zendeskConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZendeskConfiguration=function(){g.errors=[],d.intZendeskConfiguration.update({id:g.zendeskConfiguration.id},g.zendeskConfiguration).$promise.then(function(e){var n=_.find(g.zendeskConfigurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZendeskConfiguration properly saved!",msg:g.zendeskConfiguration.name?g.zendeskConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZendeskConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zendeskConfiguration will be deleted.").ariaLabel("Delete ZendeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZendeskConfiguration.delete({id:g.zendeskConfiguration.id}).$promise.then(function(){_.remove(g.zendeskConfigurations,{id:g.zendeskConfiguration.id}),o.success({title:"ZendeskConfiguration properly deleted!",msg:(g.zendeskConfiguration.name||"zendeskConfiguration")+" has been deleted!"}),v(g.zendeskConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","zendeskConfigurations","zendeskConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZendeskConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.zendeskAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="zendeskAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedZendeskAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayauthType=_.keyBy([{option:"Password",value:"'password'"},{option:"Token",value:"'token'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.zendeskAccounts.edit",{id:e.id,zendeskAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intZendeskAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"ZendeskAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"ZendeskAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("zendeskAccount")+"?").htmlContent("<b>"+(e.name||"zendeskAccount")+"</b> will be deleted.").ariaLabel("delete zendeskAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getZendeskAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intZendeskAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ZendeskAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditZendeskAccount=function(e,n){i.show({controller:"CreateOrEditZendeskAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{zendeskAccount:n,zendeskAccounts:f.zendeskAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteZendeskAccount=y,f.exportSelectedZendeskAccounts=function(){var e=angular.copy(f.selectedZendeskAccounts);return f.selectedZendeskAccounts=[],e},f.deleteSelectedZendeskAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected zendeskAccounts?").htmlContent("<b>"+f.selectedZendeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ZendeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedZendeskAccounts.forEach(function(e){y(e)}),f.selectedZendeskAccounts=[]})},f.deselectZendeskAccounts=function(){f.selectedZendeskAccounts=[]},f.selectAllZendeskAccounts=function(){f.selectedZendeskAccounts=f.zendeskAccounts.rows};var b=!0,A=1;function E(e){f.zendeskAccounts=e||{count:0,rows:[]}}function y(e){m.intZendeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.zendeskAccounts.rows,{id:e.id}),f.zendeskAccounts.count-=1,f.zendeskAccounts.rows.length||f.getZendeskAccounts(),p.success({title:_.startCase("ZendeskAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintZendeskAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintZendeskAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getZendeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","zendeskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("ZendeskAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZOHOACCOUNT",g.zohoAccount=angular.copy(l),g.zohoAccounts=r,g.newZohoAccount=!1,g.zohoAccount||(g.zohoAccount={host:"zoho.com",zone:"EU",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_ZOHOACCOUNT",g.newZohoAccount=!0),g.addNewZohoAccount=function(){g.errors=[],d.intZohoAccount.save(g.zohoAccount).$promise.then(function(e){g.zohoAccounts.unshift(e.toJSON()),o.success({title:"ZohoAccount properly created",msg:g.zohoAccount.name?g.zohoAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZohoAccount=function(){g.errors=[],d.intZohoAccount.update({id:g.zohoAccount.id},g.zohoAccount).$promise.then(function(e){var n=_.find(g.zohoAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZohoAccount properly saved!",msg:g.zohoAccount.name?g.zohoAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZohoAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zohoAccount will be deleted.").ariaLabel("Delete ZohoAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZohoAccount.delete({id:g.zohoAccount.id}).$promise.then(function(){_.remove(g.zohoAccounts,{id:g.zohoAccount.id}),o.success({title:"ZohoAccount properly deleted!",msg:(g.zohoAccount.name||"zohoAccount")+" has been deleted!"}),v(g.zohoAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","zohoAccounts","zohoAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZohoAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intZohoField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intZohoField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intZohoField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.zohoAccount={},o.zohoConfiguration={},o.configurations=[],o.selectedZohoConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.zohoAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intZohoAccount.getConfigurations({id:o.zohoAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getZohoConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getZohoConfiguration=function(e){o.zohoConfiguration=o.configurations[e],o.selectedZohoConfiguration=e,i.intZohoConfiguration.getSubjects({id:o.zohoConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intZohoConfiguration.getDescriptions({id:o.zohoConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intZohoConfiguration.getFields({id:o.zohoConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditZohoConfiguration=function(e,n){a.show({controller:"CreateOrEditZohoConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{zohoConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getZohoConfiguration(0)})},o.deleteZohoConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the zohoConfiguration?").htmlContent("<b>"+(n.name||"zohoConfiguration")+"</b> will be deleted.").ariaLabel("delete zohoConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intZohoConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"ZohoConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getZohoConfiguration(0)})},function(){console.log("CANCEL")})},o.selectChangedAdvanced=function(){i.intZohoConfiguration.update({id:o.zohoConfiguration.id},o.zohoConfiguration).$promise.then(function(){s.success({title:"Module updated!",msg:"Module has been updated!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("ZohoAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZOHOCONFIGURATION",g.zohoConfiguration=angular.copy(l),g.configurations=r,g.newZohoConfiguration=!1,g.zohoConfiguration||(g.zohoConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_ZOHOCONFIGURATION",g.newZohoConfiguration=!0),g.addNewZohoConfiguration=function(){g.errors=[],d.intZohoAccount.addConfiguration({id:n.params.id},g.zohoConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"ZohoConfiguration properly created",msg:g.zohoConfiguration.name?g.zohoConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZohoConfiguration=function(){g.errors=[],d.intZohoConfiguration.update({id:g.zohoConfiguration.id},g.zohoConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZohoConfiguration properly saved!",msg:g.zohoConfiguration.name?g.zohoConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZohoConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zohoConfiguration will be deleted.").ariaLabel("Delete ZohoConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZohoConfiguration.delete({id:g.zohoConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.zohoConfiguration.id}),o.success({title:"ZohoConfiguration properly deleted!",msg:(g.zohoConfiguration.name||"zohoConfiguration")+" has been deleted!"}),v(g.zohoConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","zohoConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZohoConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZohoField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZohoField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intZohoField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intZohoAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZohoAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.zohoAccount=c||e.params.zohoAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoZohoAccounts=function(){e.go("app.integrations.zohoAccounts",{},{reload:"app.integrations.zohoAccounts"})},u.saveZohoAccount=function(){r.intZohoAccount.update({id:u.zohoAccount.id},u.zohoAccount).$promise.then(function(){l.success({title:"ZohoAccount updated!",msg:u.zohoAccount.name?u.zohoAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintZohoAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","zohoAccount","userProfileSection"],angular.module("app.integrations").controller("ZohoAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.zohoAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="zohoAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedZohoAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arrayhost=_.keyBy([{option:"zoho.com",value:"'zoho.com'"},{option:"zoho.eu",value:"'zoho.eu'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayzone=_.keyBy([{option:"US",value:"'US'"},{option:"AU",value:"'AU'"},{option:"EU",value:"'EU'"},{option:"IN",value:"'IN'"},{option:"CN",value:"'CN'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.zohoAccounts.edit",{id:e.id,zohoAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intZohoAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"ZohoAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"ZohoAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("zohoAccount")+"?").htmlContent("<b>"+(e.name||"zohoAccount")+"</b> will be deleted.").ariaLabel("delete zohoAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getZohoAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intZohoAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ZohoAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditZohoAccount=function(e,n){i.show({controller:"CreateOrEditZohoAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{zohoAccount:n,zohoAccounts:f.zohoAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteZohoAccount=y,f.exportSelectedZohoAccounts=function(){var e=angular.copy(f.selectedZohoAccounts);return f.selectedZohoAccounts=[],e},f.deleteSelectedZohoAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected zohoAccounts?").htmlContent("<b>"+f.selectedZohoAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ZohoAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedZohoAccounts.forEach(function(e){y(e)}),f.selectedZohoAccounts=[]})},f.deselectZohoAccounts=function(){f.selectedZohoAccounts=[]},f.selectAllZohoAccounts=function(){f.selectedZohoAccounts=f.zohoAccounts.rows};var b=!0,A=1;function E(e){f.zohoAccounts=e||{count:0,rows:[]}}function y(e){m.intZohoAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.zohoAccounts.rows,{id:e.id}),f.zohoAccounts.count-=1,f.zohoAccounts.rows.length||f.getZohoAccounts(),p.success({title:_.startCase("ZohoAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintZohoAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintZohoAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getZohoAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","zohoAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("ZohoAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="JSCRIPTY.EDIT_PROJECT",g.project=angular.copy(l),g.projects=r,g.newProject=!1,g.project||(g.project={enableUncompleteSave:!0,sendUnpauseOnSubmit:!0},g.title="JSCRIPTY.NEW_PROJECT",g.newProject=!0),g.addNewProject=function(){g.errors=[],d.jscriptyProject.save(g.project).$promise.then(function(e){g.projects.unshift(e.toJSON()),o.success({title:"Project properly created",msg:g.project.name?g.project.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveProject=function(){g.errors=[],d.jscriptyProject.update({id:g.project.id},g.project).$promise.then(function(e){var n=_.find(g.projects,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Project properly saved!",msg:g.project.name?g.project.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteProject=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The project will be deleted.").ariaLabel("Delete Project").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.jscriptyProject.delete({id:g.project.id}).$promise.then(function(){_.remove(g.projects,{id:g.project.id}),o.success({title:"Project properly deleted!",msg:(g.project.name||"project")+" has been deleted!"}),v(g.project)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","projects","project","api","Auth","license","setting","crudPermissions"],angular.module("app.jscripty").controller("CreateOrEditProjectDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o){var r=this;r.currentUser=i.getCurrentUser(),r.project={},r.localizationMap=o;var l=new Date;r.pickerModel={dateStart:new Date(l.getFullYear(),l.getMonth(),1),dateEnd:new Date(l.getFullYear(),l.getMonth()+1,0),selectedTemplate:"TM"},r.init=function(e,n){r.project=e,r.userProfile=n,r.getAnswers()},r.getSummary=function(){return a.jscriptyProject.getSummary({id:r.project.id,startTime:{$gte:r.pickerModel.dateStart,$lte:moment(r.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format()},nolimit:!0}).$promise.then(function(e){if(void 0!==e.length){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download","jscriptyProjectSummary_"+r.project.id+".csv"),a.click()}else s.info({title:"EXPORT",msg:"No answers available"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.getSummary",msg:e.data?JSON.stringify(e.data):e.toString()})})},r.getAnswers=function(){return r.hasIdAnswers=!1,a.jscriptyProject.getAnswers({id:r.project.id,sort:"-createdAt,questionId",createdAt:{$gte:moment(r.pickerModel.dateStart).add(0,"hours").add(0,"minutes").add(0,"seconds").utcOffset(0,!0).format(),$lte:moment(r.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").utcOffset(0,!0).format()},nolimit:!0}).$promise.then(function(e){if(e&&e.rows&&e.hasOwnProperty("count")){r.answers={};for(var n=0,t=e.count;n<t;n++)e.rows[n].questionId&&(r.hasIdAnswers=!0,r.answers.hasOwnProperty(e.rows[n].questionId)||(r.answers[e.rows[n].questionId]={question:e.rows[n].question,answers:{},sum:0}),""===e.rows[n].answer&&(e.rows[n].answer="NO_ANSWER"),r.answers[e.rows[n].questionId].answers[e.rows[n].answer]?r.answers[e.rows[n].questionId].answers[e.rows[n].answer]+=1:r.answers[e.rows[n].questionId].answers[e.rows[n].answer]=1,r.answers[e.rows[n].questionId].sum+=1)}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETANSWERS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$mdDialog","$document","$window","api","Auth","toasty","dateFilterLocalizationFactory"],angular.module("app.jscripty").controller("ProjectAnswersController",e)}(),function(){"use strict";angular.module("app.jscripty").controller("ProjectBuilderController",function(){var n=this;n.project={},n.optionsBuilder={questionTypes:["text","textarea","radio","checkbox","select","number","date","time","email","range","url"],elementTypes:["question","paragraph"]},n.init=function(e){n.project=e,_.isObjectLike(e.formData)?n.project.formData=e.formData:n.isJsonString(e.formData)?n.project.formData=JSON.parse(e.formData):n.project.formData={}},n.isJsonString=function(e){if(_.isNil(e))return!1;try{JSON.parse(e)}catch(e){return!1}return!0}})}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newProject=!0,r.project=angular.copy(i),r.projects=s,r.title=o.instant("JSCRIPTY.CLONE_PROJECT"),i&&i.name&&(r.title+=": "+i.name),r.cloneProject=function(){return e.jscriptyProject.clone({id:i.id},r.project).$promise.then(function(e){r.projects.unshift(e.toJSON()),a.success({title:"Project properly cloned",msg:r.project.name?r.project.name+" has been cloned!":""}),t.go("app.jscripty.projects.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","project","projects","$translate"],angular.module("app.jscripty").controller("ProjectcloneController",e)}(),function(){"use strict";function e(a,i,n){var o=this;o.project={},o.responseData={},o.formViewer={},o.init=function(e){o.project=e,n.$on("mwForm.pageEvents.pageCurrentChanged",function(e,n){if(n.currentPage&&o.project.formData&&o.project.formData.pages)for(var t=0,a=o.project.formData.pages.length;t<a;t++)if(n.currentPage.number<t+1&&o.project.formData.pages[t].elements)for(var i=0,s=o.project.formData.pages[t].elements.length;i<s;i++)"question"===o.project.formData.pages[t].elements[i].type&&o.project.formData.pages[t].elements[i].question&&delete o.responseData[o.project.formData.pages[t].elements[i].question.id]})},o.onSubmit=function(e){var n=a.defer(),t=i.confirm().title("Would you like to save your survey?").textContent("").ariaLabel("survey").targetEvent(e).ok("SAVE").cancel("CANCEL");return i.show(t).then(function(){n.resolve(!0)},function(){n.reject()}),n.promise},o.resetViewer=function(){o.formViewer.reset&&o.formViewer.reset()}}e.$inject=["$q","$mdDialog","$scope"],angular.module("app.jscripty").controller("ProjectViewerController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.projectSessions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.jscriptyProject.getSessions(m.query,u).$promise}function g(e){d.jscriptySessionReport.delete({id:e.id}).$promise.then(function(){_.remove(m.projectSessions.rows,{id:e.id}),m.projectSessions.count-=1,m.projectSessions.rows.length||p(),l.success({title:"Session deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETjscriptyProject"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETjscriptyProject",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.project={},m.projectSessions={count:0,rows:[]},m.selectedProjectSessions=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,starttime,endtime,membername,calleridnum,completed",sort:"-starttime",limit:10,page:1},m.init=function(e,n,t){m.project=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.id=m.project.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the session?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("session #")+e.id||"session")+"</b> will be deleted.").ariaLabel("delete session").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getProjectSessions=p,m.createOrEditProjectSession=function(e,n){o.show({controller:"CreateOrEditSessionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:m.project,session:n,sessions:m.projectSessions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.showQuestionsProjectSession=function(e,t){o.show({controller:"ShowQuestionsSessionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,resolve:{questions:["apiResolver","$stateParams",function(e,n){return e.resolve("jscriptySessionReport@getQuestions",{fields:"question,answer",sort:"id",id:t.id})}]},locals:{project:m.project,session:t}})},m.exportSelectedProjectSessions=function(){var e=angular.copy(m.selectedProjectSessions);return m.selectedProjectSessions=[],e},m.deleteProjectSession=g,m.deleteSelectedProjectSessions=function(e){var n=o.confirm().title("Are you sure want to delete the selected sessions?").htmlContent("<b>"+m.selectedProjectSessions.length+" selected</b> will be deleted.").ariaLabel("delete sessions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedProjectSessions.forEach(function(e){g(e)}),m.selectedProjectSessions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.jscripty").controller("ProjectSessionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){this.title="JSCRIPTY.SESSION_RESULTS",this.session=s,this.questions=o,this.project=r,this.closeDialog=function(e){a.hide(e)}}e.$inject=["$scope","$state","$location","$mdDialog","toasty","session","questions","project","api"],angular.module("app.jscripty").controller("ShowQuestionsSessionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.project=c||e.params.project||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.clonedialog=function(e,n){t.show({controller:"ProjectcloneController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/clone/clone.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{project:e,projects:p.projects?p.projects.rows:[],crudPermissions:p.crudPermissions}})},p.alert=l.info,p.gotoProjects=function(){e.go("app.jscripty.projects",{},{reload:"app.jscripty.projects"})},p.saveProject=function(){r.jscriptyProject.update({id:p.project.id},p.project).$promise.then(function(){l.success({title:"Project updated!",msg:p.project.name?p.project.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETjscriptyProject",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","project","userProfile","userProfileSection"],angular.module("app.jscripty").controller("JscriptyProjectController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.projects=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="projects",f.listOrder="",f.listOrderAsc=null,f.selectedProjects=[],f.query={fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.jscripty.projects.edit",{id:e.id,project:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"ProjectcloneController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{project:e,projects:f.projects?f.projects.rows:[],crudPermissions:f.crudPermissions}})},f.sessionsgoto=function(e,n){t.go("app.jscripty.projects.edit",{id:e.id,tab:3})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("project")+"?").htmlContent("<b>"+(e.name||"project")+"</b> will be deleted.").ariaLabel("delete project").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getProjects=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.jscriptyProject.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Projects",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditProject=function(e,n){i.show({controller:"CreateOrEditProjectDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:n,projects:f.projects.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteProject=y,f.exportSelectedProjects=function(){var e=angular.copy(f.selectedProjects);return f.selectedProjects=[],e},f.deleteSelectedProjects=function(e){var n=i.confirm().title("Are you sure want to delete the selected projects?").htmlContent("<b>"+f.selectedProjects.length+" selected</b> will be deleted.").ariaLabel("delete Projects").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedProjects.forEach(function(e){y(e)}),f.selectedProjects=[]})},f.deselectProjects=function(){f.selectedProjects=[]},f.selectAllProjects=function(){f.selectedProjects=f.projects.rows};var b=!0,A=1;function E(e){f.projects=e||{count:0,rows:[]}}function y(e){m.jscriptyProject.delete({id:e.id}).$promise.then(function(){_.remove(f.projects.rows,{id:e.id}),f.projects.count-=1,f.projects.rows.length||f.getProjects(),p.success({title:_.startCase("Project")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEjscriptyProject"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEjscriptyProject",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getProjects())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","projects","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.jscripty").controller("JscriptyProjectsController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o,r,l,d,c,m,u){var p,g=this;function v(e){t.hide(e)}g.currentUser=l.getCurrentUser(),g.errors=[],g.setting=c,g.license=d,g.crudPermissions=m,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.mailAccount=angular.copy(s),g.mailAccounts=n,g.cloudProviders=o,g.providers=u.getEmailProviders(),g.newMailAccount=!1,g.mailAccount||(g.mailAccount={active:!0,service:"null",authentication:!0,fontSize:13,waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.newMailAccount=!0),e.params.id&&(g.mailAccount.MailAccountId=e.params.id),g.addNewMailAccount=function(){g.errors=[],r.mailAccount.save(g.mailAccount).$promise.then(function(e){g.mailAccounts.unshift(e.toJSON()),i.success({title:a.instant("MAIL.NOTIFICATIONS.ACCOUNT_CREATED_SUCCESS_TITLE")}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailAccount=function(){g.errors=[],r.mailAccount.update({id:g.mailAccount.id},g.mailAccount).$promise.then(function(e){var n=_.find(g.mailAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),i.success({title:a.instant("MAIL.NOTIFICATIONS.ACCOUNT_SAVED_SUCCESS_TITLE")}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailAccount.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailAccount=function(e){if(g.mailAccount.service)return i.error({title:"Mail Account not deleted!",msg:"You can't remove service account"});g.errors=[];var n=t.confirm().title(a.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_TITLE")).content(a.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_MESSAGE",{name:g.mailAccount.name})).ariaLabel("Delete Mail Account").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){r.mailAccount.delete({id:g.mailAccount.id}).$promise.then(function(){_.remove(g.mailAccounts,{id:g.mailAccount.id}),i.success({title:a.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETED_SUCCESS_TITLE")}),v(g.mailAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.onProviderChange=function(){"custom"!==g.mailAccount.provider&&(g.mailAccount.authentication=!0);"outlook365"!==g.mailAccount.provider&&(g.mailAccount.modernAuthentication=!1)},g.closeDialog=v,p=[{key:"id",value:Number(g.mailAccount.ListId)}],r.getResourcesByRole(g.currentUser,"cmList",{fields:"id,name",sort:"name",nolimit:"true"},p).then(function(e){g.lists=e.rows}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$mdDialog","$translate","toasty","mailAccounts","mailAccount","cloudProviders","api","Auth","license","setting","crudPermissions","msUtils"],angular.module("app.mail").controller("CreateOrEditMailAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.mailAccountApps.rows.length){var t=r.mailAccountApps.rows[n]?r.mailAccountApps.rows[n]:r.mailAccountApps.rows[0];i.show({controller:"EditMailAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccountApp:t,mailAccount:r.mailAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.mailAccountApps.rows[n]=e:r.mailAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.mailAccountApps.rows.length;t++,0){var a=r.mailAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.mailAccount.context,a.exten=r.mailAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.mailAccount.addApplications({id:r.mailAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.mailAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.mailAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.mailAccount={},r.mailAccountApps={count:0,rows:[]},r.selectedMailAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"MailQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"mailQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:601}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",nolimit:!0,role:"agent"},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Reply_Type",name:"replyType",type:"select",defaultValue:"1",values:[{option:"Reply",value:"0"},{option:"Reply All",value:"1"}],required:!0,param:1},{title:"Text",name:"text",type:"html",required:!0,param:2}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.mailAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getMailAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.mailAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getMailAccountApps=function(){r.promise=o.mailAccount.getApplications(r.query,t).$promise},r.editMailAccountApp=n,r.editInterval=function(e,n){if(r.mailAccountApps.rows.length){var t=r.mailAccountApps.rows[n]?r.mailAccountApps.rows[n]:r.mailAccountApps.rows[0];i.show({controller:"EditMailAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteMailAccountApp=function(e){_.remove(r.mailAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedMailAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedMailAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedMailAccountApps.forEach(function(e){_.remove(r.mailAccountApps.rows,{id:e.id})}),r.selectedMailAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.mail").controller("MailAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.mailAccount.getAgents({id:c.mailAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserMailAccount?"penalty "+e.UserMailAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.mailAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.mailAccount.removeAgents({id:c.mailAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.mailAccount.addAgents({id:c.mailAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("MAIL.ALL_AGENTS"),labelSelected:r.instant("MAIL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","mailAccount","mailAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.mail").controller("MailAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.agent.text=d.slice(2,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.autoreply.text=d.slice(2,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.replyType=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.autoreply.text=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.autoreply.times=1,l.autoreply.replyType=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.replyType,e[2]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.close.text=d.slice(2,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.gotoif.text=d.slice(2,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.gotop.text=d.slice(2,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditMailAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.noop.text=d.slice(2,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.queue.text=d.slice(2,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("mail")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.mailQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.mailQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:601}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.system.text=d.slice(2,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.tag.text=d.slice(2,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"mailAccount",action:"getDispositions",field:"name",params:{id:m.mailAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.mailAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.mailAccountInteractions.rows.length;n+=1){var t=m.mailAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,(void 0===m.query.closed||null===m.query.closed||m.query.closed)&&delete m.query.substatus,m.promise=d.mailInteraction.get(m.query,p).$promise}function v(e){d.mailInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.mailAccountInteractions.rows,{id:e.id}),m.mailAccountInteractions.count-=1,m.mailAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETmailAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){_.isEmpty(e.to)||_.includes(e.to,m.mailAccount.email)?e.contactInfo=e.Contact?e.Contact.email:void 0:(e.contactName=e.to.split(" <")[0],e.contactInfo=e.to.split("<").pop().split(">")[0]),"Unknown"===e.contactName&&(e.contactName=i.instant("MAIL.UNKNOWN"))}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.mailAccount={},m.mailAccountInteractions={count:0,rows:[]},m.selectedMailAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.mailAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.MailAccountId=m.mailAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"plainBody",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Substatus",column:"substatus",type:"multiselect",options:{field:"name",route:{model:"mailSubstatus",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){return d.mailSubstatus.get({nolimit:!0}).$promise.then(function(e){m.subStatuses=e||{count:0,rows:[]}})}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Substatus",key:"substatus",type:"select",label:"DASHBOARDS.SELECT_SUBSTATUS",options:m.subStatuses.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NONE"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name",ngIf:"closed === 0"},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.mailInteractionDownload=function(s,e,n){return d.mailInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="mail-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getMailAccountInteractions=g,m.createOrEditMailAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:m.mailAccount,interaction:n,interactions:m.mailAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spymailInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"mail",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"mail.mailAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||MailAccountId:=$eq["+m.mailAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedMailAccountInteractions=function(){var e=angular.copy(m.selectedMailAccountInteractions);return m.selectedMailAccountInteractions=[],e},m.deleteMailAccountInteraction=v,m.deleteSelectedMailAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedMailAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedMailAccountInteractions.forEach(function(e){v(e)}),m.selectedMailAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.mail").controller("MailAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.mailAccountMailCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.mailAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.mailAccountMailCannedAnswers.rows,{id:e.id}),m.mailAccountMailCannedAnswers.count-=1,m.mailAccountMailCannedAnswers.rows.length||p(),l.success({title:"MailCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETmailAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.mailAccount={},m.mailAccountMailCannedAnswers={count:0,rows:[]},m.selectedMailAccountMailCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.mailAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.MailAccountId=m.mailAccount.id,m.query.id=m.mailAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the mailCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("mailCannedAnswer #")+e.id||"mailCannedAnswer")+"</b> will be deleted.").ariaLabel("delete mailCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getMailAccountMailCannedAnswers=p,m.createOrEditMailAccountMailCannedAnswer=function(e,n){o.show({controller:"CreateOrEditMailCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/mailCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:m.mailAccount,mailCannedAnswer:n,mailCannedAnswers:m.mailAccountMailCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedMailAccountMailCannedAnswers=function(){var e=angular.copy(m.selectedMailAccountMailCannedAnswers);return m.selectedMailAccountMailCannedAnswers=[],e},m.deleteMailAccountMailCannedAnswer=g,m.deleteSelectedMailAccountMailCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected mailCannedAnswers?").htmlContent("<b>"+m.selectedMailAccountMailCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete mailCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedMailAccountMailCannedAnswers.forEach(function(e){g(e)}),m.selectedMailAccountMailCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.mail").controller("MailAccountMailCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MAIL.EDIT_MAILCANNEDANSWER",g.mailCannedAnswer=angular.copy(l),g.mailCannedAnswers=r,g.newMailCannedAnswer=!1,g.mailCannedAnswer||(g.mailCannedAnswer={},g.title="MAIL.NEW_MAILCANNEDANSWER",g.newMailCannedAnswer=!0),n.params.id&&(g.mailCannedAnswer.MailAccountId=n.params.id),g.addNewMailCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.mailCannedAnswer).$promise.then(function(e){g.mailCannedAnswers.unshift(e.toJSON()),o.success({title:"MailCannedAnswer properly created",msg:g.mailCannedAnswer.name?g.mailCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.mailCannedAnswer.id},g.mailCannedAnswer).$promise.then(function(e){var n=_.find(g.mailCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MailCannedAnswer properly saved!",msg:g.mailCannedAnswer.name?g.mailCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The mailCannedAnswer will be deleted.").ariaLabel("Delete MailCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.mailCannedAnswer.id}).$promise.then(function(){_.remove(g.mailCannedAnswers,{id:g.mailCannedAnswer.id}),o.success({title:"MailCannedAnswer properly deleted!",msg:(g.mailCannedAnswer.name||"mailCannedAnswer")+" has been deleted!"}),v(g.mailCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mailCannedAnswers","mailCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.mailAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.mailAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.MailAccountId=m.mailAccount.id,m.query.id=m.mailAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.mailAccount.id,field:"MailAccountId",route:"mailAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.mail").controller("MailAccountDispositionsController",e)}(),function(){"use strict";function e(t,a,i,s,e,n,o,r,l,d,c,m,u,p,g){var v,h,f=this;f.currentUser=d.getCurrentUser(),f.license=n,f.setting=o,f.passwordPattern=f.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",f.mailAccount=c||t.params.mailAccount||{},f.cloudProviders=m||{rows:[],count:0},f.userProfile=u,f.userProfileSection=p&&1==p.count?p.rows[0]:null,f.crudPermissions=d.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.hasModulePermissions={},f.selectedTab=t.params.tab||0,f.providers=g.getEmailProviders(),f.originalProvider=f.mailAccount.provider,f.goToRealtime=function(){return d.hasRole("admin")?t.go("app.mail.realtime.accounts",{}):r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n&&n.enabled)return t.go("app.mail.realtime.accounts",{});l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})})},f.addAgent=function(e,n){a.show({controller:"MailAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailAccount:e,mailAccounts:f.mailAccounts?f.mailAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.goToMailAccounts=function(){t.go("app.mail.mailAccounts",{},{reload:"app.mail.mailAccounts"})},f.saveMailAccount=function(){var e=angular.copy(f.mailAccount);"custom"===e.provider?e.provider=null:(f.originalProvider!==e.provider&&(e.Imap.modernAuthentication?e.Imap.password=null:e.Imap.CloudProviderId=null),e.Smtp.user=e.Imap.user,e.Smtp.pass=e.Imap.password,e.Imap.modernAuthentication||(e.Imap.CloudProviderId=null),e.Smtp.modernAuthentication=e.Imap.modernAuthentication,e.Smtp.CloudProviderId=e.Imap.CloudProviderId,e.Imap=_.omit(e.Imap,["host","port","service"]),e.Smtp=_.omit(e.Smtp,["host","port","secure","service"]));r.mailAccount.update({id:f.mailAccount.id},e).$promise.then(function(){f.originalProvider=e.provider,l.success({title:s.instant("MAIL.NOTIFICATIONS.ACCOUNT_SAVED_SUCCESS_TITLE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},f.onProviderChange=function(){"custom"!==f.mailAccount.provider&&(f.mailAccount.authentication=!0);"outlook365"!==f.mailAccount.provider&&(f.mailAccount.Imap.modernAuthentication=!1)},e.all((h=[{key:"id",value:Number(f.mailAccount.ListId)}],r.getResourcesByRole(f.currentUser,"cmList",{fields:"id,name",sort:"name",nolimit:"true"},h).then(function(e){f.lists=e.rows}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})})),(v=[{key:"id",value:Number(f.mailAccount.mandatoryDispositionPauseId)}],r.getResourcesByRole(f.currentUser,"pause",{fields:"id,name",sort:"name",nolimit:"true"},v).then(function(e){f.pauses=e.rows}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})})))}e.$inject=["$state","$mdDialog","$document","$translate","$q","license","setting","api","toasty","Auth","mailAccount","cloudProviders","userProfile","userProfileSection","msUtils"],angular.module("app.mail").controller("MailAccountController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,n,r,l,d,c,m,u,p){var g=this;function v(e){g.mailAccounts=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.hasRole("admin")?g.promise=d.mailAccount.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="MailAccounts",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){if(e.service)return c.error({msg:o.instant("MAIL.NOTIFICATIONS.ACCOUNT_SERVICE_DELETE")});d.mailAccount.delete({id:e.id}).$promise.then(function(){_.remove(g.mailAccounts.rows,{id:e.id}),g.mailAccounts.count-=1,g.mailAccounts.rows.length||h(),c.success({title:o.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailAccount"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.mailAccounts=n||{count:0,rows:[]},g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedMailAccounts=[],g.query={fields:"createdAt,updatedAt,id,name,provider,key,email,ListId,active,service,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},g.editstate=function(e){t.go("app.mail.mailAccounts.edit",{id:e.id,mailAccount:e,crudPermissions:g.crudPermissions})},g.verifySMTP=function(e){return e&&e.id?d.mailAccount.verifySmtp({id:e.id}).$promise.then(function(){c.success({title:o.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_SUCCESS_TITLE")})}).catch(function(e){c.error({title:o.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_FAIL_TITLE"),msg:e.data?JSON.stringify(e.data):e.toString()})}):c.error({title:o.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_FAIL_TITLE"),msg:o.instant("MAIL.NOTIFICATIONS.UNKNOWN_SMTP_SERVER")})},g.goToInteractions=function(e){t.go("app.mail.mailAccounts.edit",{id:e.id,tab:"custom"===e.provider?7:6})},g.goToRealtime=function(){return m.hasRole("admin")?t.go("app.mail.realtime.accounts",{}):d.userProfileSection.get({userProfileId:m.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n&&n.enabled)return t.go("app.mail.realtime.accounts",{});c.info({title:o.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:o.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})})},g.addAgent=function(e,n){a.show({controller:"MailAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailAccount:e,mailAccounts:g.mailAccounts?g.mailAccounts.rows:[],crudPermissions:g.crudPermissions,realtime:!1}})},g.deleteconfirm=function(e,n){var t=a.confirm().title(o.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_TITLE")).content(o.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_MESSAGE",{name:e.name})).ariaLabel("delete mail account").targetEvent(n).ok("OK").cancel(o.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.success=v,g.getMailAccounts=h,g.createOrEditMailAccount=function(e,n){a.show({controller:"CreateOrEditMailAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:n,mailAccounts:g.mailAccounts.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions},resolve:{cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,name",sort:"name",type:"outlook365"})}]}})},g.deleteMailAccount=f,g.exportSelectedMailAccounts=function(){var e=angular.copy(g.selectedMailAccounts);return g.selectedMailAccounts=[],e},g.deleteSelectedMailAccounts=function(e){var n=a.confirm().title(o.instant("MAIL.NOTIFICATIONS.ACCOUNTS_DELETE_TITLE")).content(o.instant("MAIL.NOTIFICATIONS.ACCOUNTS_DELETE_MESSAGE",{total:g.selectedMailAccounts.length})).ariaLabel("delete mail accounts").targetEvent(e).ok("OK").cancel(o.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedMailAccounts.forEach(function(e){f(e)}),g.selectedMailAccounts=[],c.success({title:o.instant("MAIL.NOTIFICATIONS.ACCOUNTS_DELETED_SUCCESS_TITLE")})})},g.deselectMailAccounts=function(){g.selectedMailAccounts=[]},g.selectAllMailAccounts=function(){g.selectedMailAccounts=g.mailAccounts.rows};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?s(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","mailAccounts","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.mail").controller("MailAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MAIL.EDIT_MAILQUEUE",g.mailQueue=angular.copy(l),g.mailQueues=r,g.newMailQueue=!1,g.mailQueue||(g.mailQueue={strategy:"beepall",timeout:10},g.title="MAIL.NEW_MAILQUEUE",g.newMailQueue=!0),g.addNewMailQueue=function(){g.errors=[],d.mailQueue.save(g.mailQueue).$promise.then(function(e){g.mailQueues.unshift(e.toJSON()),o.success({title:"MailQueue properly created",msg:g.mailQueue.name?g.mailQueue.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailQueue=function(){g.errors=[],d.mailQueue.update({id:g.mailQueue.id},g.mailQueue).$promise.then(function(e){var n=_.find(g.mailQueues,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MailQueue properly saved!",msg:g.mailQueue.name?g.mailQueue.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailQueue=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The mailQueue will be deleted.").ariaLabel("Delete MailQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.mailQueue.delete({id:g.mailQueue.id}).$promise.then(function(){_.remove(g.mailQueues,{id:g.mailQueue.id}),o.success({title:"MailQueue properly deleted!",msg:(g.mailQueue.name||"mailQueue")+" has been deleted!"}),v(g.mailQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mailQueues","mailQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.mailQueue.getAgents({id:c.mailQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserMailQueue?"penalty "+e.UserMailQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.mailQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.removeAgents({id:c.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.addAgents({id:c.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("MAIL.ALL_AGENTS"),labelSelected:r.instant("MAIL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","mailQueue","mailQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.mail").controller("MailQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.mailQueue.getTeams({id:l.mailQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.mailQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MAIL.ALL_TEAMS"),labelSelected:t.instant("MAIL.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.removeTeams({id:l.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.addTeams({id:l.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","mailQueue","$translate","Auth","crudPermissions"],angular.module("app.mail").controller("MailQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.mailQueue=c||e.params.mailQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"MailQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:u.mailQueues?u.mailQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:u.mailQueues?u.mailQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoMailQueues=function(){e.go("app.mail.mailQueues",{},{reload:"app.mail.mailQueues"})},u.saveMailQueue=function(){r.mailQueue.update({id:u.mailQueue.id},u.mailQueue).$promise.then(function(){l.success({title:"MailQueue updated!",msg:u.mailQueue.name?u.mailQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","mailQueue","userProfileSection"],angular.module("app.mail").controller("MailQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.mailQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="mailQueues",f.listOrder="",f.listOrderAsc=null,f.selectedMailQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"mail",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.mail.mailQueues.edit",{id:e.id,mailQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"MailQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:f.mailQueues?f.mailQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:f.mailQueues?f.mailQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("mailQueue")+"?").htmlContent("<b>"+(e.name||"mailQueue")+"</b> will be deleted.").ariaLabel("delete mailQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.mail.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.mail.realtime.queues",{})}},f.success=E,f.getMailQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.mailQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="MailQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMailQueue=function(e,n){i.show({controller:"CreateOrEditMailQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailQueue:n,mailQueues:f.mailQueues.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteMailQueue=y,f.exportSelectedMailQueues=function(){var e=angular.copy(f.selectedMailQueues);return f.selectedMailQueues=[],e},f.deleteSelectedMailQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected mailQueues?").htmlContent("<b>"+f.selectedMailQueues.length+" selected</b> will be deleted.").ariaLabel("delete MailQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMailQueues.forEach(function(e){y(e)}),f.selectedMailQueues=[]})},f.deselectMailQueues=function(){f.selectedMailQueues=[]},f.selectAllMailQueues=function(){f.selectedMailQueues=f.mailQueues.rows};var b=!0,A=1;function E(e){f.mailQueues=e||{count:0,rows:[]}}function y(e){m.mailQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.mailQueues.rows,{id:e.id}),f.mailQueues.count-=1,f.mailQueues.rows.length||f.getMailQueues(),p.success({title:_.startCase("MailQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEmailQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMailQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","mailQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.mail").controller("MailQueuesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MAIL.EDIT_MAILSUBSTATUS",g.mailSubstatus=angular.copy(l),g.mailSubtatuses=r,g.newMailSubstatus=!1,g.mailSubstatus||(g.mailSubstatus={},g.title="MAIL.NEW_MAILSUBSTATUS",g.newMailSubstatus=!0),g.addNewMailSubstatus=function(){g.errors=[],d.mailSubstatus.save(g.mailSubstatus).$promise.then(function(e){g.mailSubtatuses.unshift(e.toJSON()),o.success({title:"MailSubstatus properly created",msg:g.mailSubstatus.name?g.mailSubstatus.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailSubstatus.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailSubstatus.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailSubstatus=function(){g.errors=[],d.mailSubstatus.update({id:g.mailSubstatus.id},g.mailSubstatus).$promise.then(function(e){var n=_.find(g.mailSubtatuses,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MailSubstatus properly saved!",msg:g.mailSubstatus.name?g.mailSubstatus.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailSubstatus.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailSubstatus.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailSubstatus=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The mailSubstatus will be deleted.").ariaLabel("Delete MailSubstatus").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.mailSubstatus.delete({id:g.mailSubstatus.id}).$promise.then(function(){_.remove(g.mailSubtatuses,{id:g.mailSubstatus.id}),o.success({title:"MailSubstatus properly deleted!",msg:(g.mailSubstatus.name||"mailSubstatus")+" has been deleted!"}),v(g.mailSubstatus)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailSubstatus.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailSubstatus.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mailSubtatuses","mailSubstatus","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailSubstatusDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.mailSubtatuses=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="mailSubtatuses",f.listOrder="",f.listOrderAsc=null,f.selectedMailSubstatuses=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditMailSubstatusDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailSubtatuses/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailSubstatus:e,mailSubtatuses:f.mailSubtatuses.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("mailSubstatus")+"?").htmlContent("<b>"+(e.name||"mailSubstatus")+"</b> will be deleted.").ariaLabel("delete mailSubstatus").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getMailSubstatuses=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.mailSubstatus.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="MailSubstatuses",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMailSubstatus=function(e,n){i.show({controller:"CreateOrEditMailSubstatusDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailSubtatuses/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailSubstatus:n,mailSubtatuses:f.mailSubtatuses.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteMailSubstatus=y,f.exportSelectedMailSubstatuses=function(){var e=angular.copy(f.selectedMailSubstatuses);return f.selectedMailSubstatuses=[],e},f.deleteSelectedMailSubstatuses=function(e){var n=i.confirm().title("Are you sure want to delete the selected mailSubtatuses?").htmlContent("<b>"+f.selectedMailSubstatuses.length+" selected</b> will be deleted.").ariaLabel("delete MailSubstatuss").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMailSubstatuses.forEach(function(e){y(e)}),f.selectedMailSubstatuses=[]})},f.deselectMailSubstatuses=function(){f.selectedMailSubstatuses=[]},f.selectAllMailSubstatuses=function(){f.selectedMailSubstatuses=f.mailSubtatuses.rows};var b=!0,A=1;function E(e){f.mailSubtatuses=e||{count:0,rows:[]}}function y(e){m.mailSubstatus.delete({id:e.id}).$promise.then(function(){_.remove(f.mailSubtatuses.rows,{id:e.id}),f.mailSubtatuses.count-=1,f.mailSubtatuses.rows.length||f.getMailSubstatuses(),p.success({title:_.startCase("MailSubstatus")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailSubstatus"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEmailSubstatus",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMailSubstatuses())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","mailSubtatuses","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.mail").controller("MailSubstatusesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){_.forIn(p.mailAccounts,function(e,n){p.rpcMailAccounts[n]&&_.merge(e,p.rpcMailAccounts[n])}),_.forIn(p.mailAccounts,function(n,e){var t={id:e,sort:"-id",direction:"in",limit:1,offset:0,$gte:"createdAt,"+moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),fields:"id,createdAt"};s.mailAccount.getMessages(t).$promise.then(function(e){return e&&(n.in=e.count||0,n.lastIn=e.rows&&e.rows.length?e.rows[0].createdAt:void 0),t.direction="out",s.mailAccount.getMessages(t).$promise}).then(function(e){e&&(n.out=e.count||0,n.lastOut=e.rows&&e.rows.length?e.rows[0].createdAt:void 0)}).catch(function(e){console.log(e)})})}p.currentUser=u.getCurrentUser(),p.count=l&&l.count?l.count:0,p.mailAccounts=l?_.keyBy(l.rows?l.rows:[],"id"):{},p.rpcMailAccounts=d?_.keyBy(d.rows?d.rows:[],"id"):{},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.query={sort:"-name",limit:10,page:1},p.success=f,p.$onInit=g,p.getMailAccounts=function(){p.query.offset=(p.query.page-1)*p.query.limit,u.hasRole("admin")?p.promise=s.mailAccount.get(p.query,f).$promise:(p.query.id=p.userProfile.id,p.query.section="MailAccounts",p.promise=s.userProfile.getResources(p.query,f).$promise)},p.onSave=function(e){p.mailAccounts[e.id]&&_.merge(p.mailAccounts[e.id],e)},p.onMailMessageSave=function(e){p.mailAccounts[e.MailAccountId]&&("in"==e.direction?(p.mailAccounts[e.MailAccountId].in+=1,p.mailAccounts[e.MailAccountId].lastIn=e.createdAt):(p.mailAccounts[e.MailAccountId].out+=1,p.mailAccounts[e.MailAccountId].lastOut=e.createdAt))},p.goToMailAccount=function(e,n){i.go("app.mail.mailAccounts.edit",{id:n.id,mailAccount:n})},p.verifySmtp=function(e,n){{if(n&&n.id)return s.mailAccount.verifySmtp({id:n.id}).$promise.then(function(){r.success({title:"Smtp properly verified",msg:"Connection succeded!"})}).catch(function(e){r.error({title:"Smtp properly verified",msg:e.data?JSON.stringify(e.data):e.toString()})});r.error({title:"Smtp properly verified",msg:"Smpt id unknown"})}},p.order=[],_.forIn(p.mailAccounts,function(e,n){p.order.push(e.id)}),o.on("mailAccount:save",p.onSave),o.on("mailAccount:update",p.onSave),o.on("mailMessage:save",p.onMailMessageSave);var v=!0,h=1;function f(e){if(p.mailAccounts=e?_.keyBy(e.rows?e.rows:[],"id"):{},e.rows){p.order=[];for(var n=0;n<e.rows.length;n++)p.order.push(e.rows[n].id)}g()}e.$watch("vm.query.filter",function(e,n){v?t(function(){v=!1}):(n||(h=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=h),p.getMailAccounts())}),e.$on("$destroy",function(){o.removeAllListeners("mailAccount:save"),o.removeAllListeners("mailAccount:update"),o.removeAllListeners("mailMessage:save")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$state","api","socket","toasty","mailAccounts","rpcMailAccounts","userProfile","userProfileSection","Auth"],angular.module("app.mail").controller("MailAccountsRealtimeController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=["loggedIn","available","waiting","paused"],g=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"MailQueues":void 0,channel:"mail",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("MAIL.MAILQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditMailQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailQueue:n,mailQueues:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailQueue:n,mailQueues:u.queues.rows,realtime:!1,crudPermissions:u.crudPermissions}})},r.on("mail_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,p))}),r.on("userMailQueue:save",function(e){var n=_.find(u.queues.rows,["id",e.MailQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("userMailQueue:remove",function(e){var n=_.find(u.queues.rows,["id",e.MailQueueId]);n&&(0<n.loggedInDb&&n.loggedInDb--,_.remove(n.agents,["id",e.UserId]))}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"mail")})}),e.$on("$destroy",function(){r.removeAllListeners("mail_queue:save"),r.removeAllListeners("userMailQueue:remove"),r.removeAllListeners("userMailQueue:save"),r.removeAllListeners("user:update"),g&&n.cancel(g)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.mail").controller("QueuesMailRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.mail.realtime.agents":this.selectedTab=0;break;case"app.mail.realtime.queues":this.selectedTab=1;break;case"app.mail.realtime.accounts":this.selectedTab=2;break;default:this.selectedTab=0,t.go("app.mail.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.mail.realtime.agents");break;case 1:t.go("app.mail.realtime.queues");break;case 2:t.go("app.mail.realtime.accounts");break;default:t.go("app.mail.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.mail").controller("MailRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MARKETPLACE.EDIT_PLUGIN",g.plugin=angular.copy(l),g.plugins=r,g.newPlugin=!1,g.plugin||(g.plugin={},g.title="MARKETPLACE.NEW_PLUGIN",g.newPlugin=!0),g.addNewPlugin=function(){g.errors=[],d.plugin.save(g.plugin).$promise.then(function(e){g.plugins.unshift(e.toJSON()),o.success({title:"Plugin properly created",msg:g.plugin.name?g.plugin.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savePlugin=function(){g.errors=[],d.plugin.update({id:g.plugin.id},g.plugin).$promise.then(function(e){var n=_.find(g.plugins,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Plugin properly saved!",msg:g.plugin.name?g.plugin.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletePlugin=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The plugin will be deleted.").ariaLabel("Delete Plugin").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.plugin.delete({id:g.plugin.id}).$promise.then(function(){_.remove(g.plugins,{id:g.plugin.id}),o.success({title:"Plugin properly deleted!",msg:(g.plugin.name||"plugin")+" has been deleted!"}),v(g.plugin)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","plugins","plugin","api","Auth","license","setting","crudPermissions"],angular.module("app.marketplace").controller("CreateOrEditPluginDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.plugin=c||e.params.plugin||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoPlugins=function(){e.go("app.marketplace.plugins",{},{reload:"app.marketplace.plugins"})},u.savePlugin=function(){r.plugin.update({id:u.plugin.id},u.plugin).$promise.then(function(){l.success({title:"Plugin updated!",msg:u.plugin.name?u.plugin.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETplugin",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","plugin","userProfileSection"],angular.module("app.marketplace").controller("MarketplacePluginController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.plugins=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="plugins",f.listOrder="",f.listOrderAsc=null,f.selectedPlugins=[],f.query={fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"-updatedAt",limit:10,page:1},f.installing=!1,f.arraysidebar=_.keyBy([{option:"Always",value:"'always'"},{option:"Admin Only",value:"'adminOnly'"},{option:"Agent Only",value:"'agentOnly'"},{option:"Never",value:"'never'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.installplugin=function(e){{if("script"!==e.type)return e.active=!0,m.plugin.update({id:e.id},e).$promise.then(function(){p.success({title:"Plugin installed!",msg:e.name?e.name+" has been installed!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});f.installing=!0,m.pm2.save({name:e.scriptName,script:e.path+"/"+e.scriptPath}).$promise.then(function(){return e.active=!0,m.plugin.update({id:e.id},e).$promise}).then(function(){f.installing=!1,p.success({title:"Plugin installed!",msg:e.name?e.name+" has been installed!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.save"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.save",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}},f.editstate=function(e,n){t.go("app.marketplace.plugins.edit",{id:e.id,plugin:e,crudPermissions:f.crudPermissions})},f.stopplugin=function(e,n){var t=i.confirm().title("Are you sure want to stop the plugin attached process?").htmlContent("<b>"+(e.name||"plugin")+"</b> attached process will be stoppped.").ariaLabel("stop plugin process").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){var t;t=e,m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var n=_.find(e.rows,{name:t.scriptName});if(!n)throw new Error("No corresponding process found");m.pm2.update({id:n.pm_id,status:"stopped"}).$promise.then(function(){p.success({title:"Process stopped!",msg:"Attached pm2 process successfully stopped"})})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){console.log("CANCEL")})},f.restartplugin=function(e,n){var t=i.confirm().title("Are you sure want to restart the plugin attached process?").htmlContent("<b>"+(e.name||"plugin")+"</b> attached process will be restarted.").ariaLabel("restart plugin process").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){var t;t=e,m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var n=_.find(e.rows,{name:t.scriptName});if(!n)throw new Error("No corresponding process found");m.pm2.update({id:n.pm_id,status:"online"}).$promise.then(function(){p.success({title:"Process restarted!",msg:"Attached pm2 process successfully restarted"})})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){console.log("CANCEL")})},f.downloadfile2=function(s,e){return m.plugin.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.name.replace(" ","_").toLowerCase()+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.uninstallplugin=function(e,n){var t=i.confirm().title("Are you sure want to uninstall the plugin?").htmlContent("<b>"+(e.name||"plugin")+"</b> will be uninstalled.").ariaLabel("uninstall plugin").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){!function(t){"script"===t.type&&m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var n=_.find(e.rows,{name:t.scriptName});if(!n)throw new Error("No corresponding process found");m.pm2.delete({id:n.pm_id,name:t.scriptName}).$promise}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});t.active=!1,m.plugin.update({id:t.id},t).$promise.then(function(){p.success({title:"Plugin uninstalled!",msg:t.name?t.name+" has been uninstalled!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}(e)},function(){console.log("CANCEL")})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("plugin")+"?").htmlContent("<b>"+(e.name||"plugin")+"</b> will be deleted.").ariaLabel("delete plugin").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getPlugins=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.plugin.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Plugins",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditPlugin=function(e,n){i.show({controller:"CreateOrEditPluginDialogController",controllerAs:"vm",templateUrl:"app/main/apps/marketplace/views/plugins/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{plugin:n,plugins:f.plugins.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletePlugin=y,f.exportSelectedPlugins=function(){var e=angular.copy(f.selectedPlugins);return f.selectedPlugins=[],e},f.deleteSelectedPlugins=function(e){var n=i.confirm().title("Are you sure want to delete the selected plugins?").htmlContent("<b>"+f.selectedPlugins.length+" selected</b> will be deleted.").ariaLabel("delete Plugins").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedPlugins.forEach(function(e){y(e)}),f.selectedPlugins=[]})},f.deselectPlugins=function(){f.selectedPlugins=[]},f.selectAllPlugins=function(){f.selectedPlugins=f.plugins.rows},f.uploadPlugin=function(e){i.show({controller:"UploadPluginDialogController",controllerAs:"vm",templateUrl:"app/main/apps/marketplace/views/plugins/upload/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{plugins:f.plugins.rows}})};var b=!0,A=1;function E(e){f.plugins=e||{count:0,rows:[]}}function y(t){t.active&&"script"==t.type&&m.pm2.get().$promise.then(function(e){if(!e||!e.rows)return p.error({title:"Plugin not deleted!",msg:"Failed to retrieve pm2 processes"});var n=_.find(e.rows,{name:t.scriptName});n?m.pm2.delete({id:n.pm_id,name:t.scriptName}).$promise:console.log("No '%s' process found",t.scriptName)}).catch(function(e){return p.error({title:"PM2 process not found!",msg:"Failed to delete the attached pm2 process"})}),m.plugin.delete({id:t.id}).$promise.then(function(){_.remove(f.plugins.rows,{id:t.id}),f.plugins.count-=1,f.plugins.rows.length||f.getPlugins(),p.success({title:_.startCase("Plugin")+" deleted!",msg:t.name?t.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEplugin"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEplugin",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getPlugins())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","plugins","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.marketplace").controller("MarketplacePluginsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this,r=4,l=1024*r*1024;o.currentUser=s.getCurrentUser(),o.errors=[],o.title="MARKETPLACE.UPLOAD_PLUGIN",o.plugins=a,o.uploadPlugins=[],o.uploadState="none",o.plugin={},o.ngFlowOptions={maxChunkRetries:1,chunkSize:l,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0,target:"api/plugins"},o.ngFlow={flow:{}},o.dropping=!1,o.fileAdded=function(e){var n=["zip"];if(!_.includes(n,e.getExtension()))return t.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(e.size>l)return t.error({title:"File too big",msg:"The max allowed size is "+r+"MB"}),!1;return o.plugin={id:e.uniqueIdentifier,file:e},o.uploadPlugins.unshift(o.plugin),!0},o.upload=function(){o.uploadState="uploading",o.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},o.ngFlow.flow.opts.query={role:o.currentUser.role,userProfileId:o.currentUser.userProfileId},o.ngFlow.flow.upload()},o.fileSuccess=function(a,e){o.plugins.unshift(JSON.parse(e)),angular.forEach(o.uploadPlugins,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result}}})},o.uploadError=function(e,n){o.ngFlow.flow.cancel(),t.error({title:"Upload error",msg:"Cannot upload the plugin"}),o.uploadState="failed"},o.uploadComplete=function(){"failed"!==o.uploadState&&(o.uploadState="completed",t.success({title:"Upload completed",msg:o.plugin.file.name+" uploaded successfully"}))},o.closeDialog=function(){n.hide()}}e.$inject=["$cookies","$mdDialog","toasty","plugins","api","Auth"],angular.module("app.marketplace").controller("UploadPluginDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this;function h(e){a.hide(e)}v.currentUser=c.getCurrentUser(),v.errors=[],v.setting=u,v.license=m,v.crudPermissions=p,v.hasModulePermissions={},v.passwordPattern=v.setting&&v.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",v.title="MOTIONDIALER.EDIT_HOPPER",v.hopper=angular.copy(l),v.hoppers=r,v.newHopper=!1,v.contact,v.dateTime,v.hopper||(v.hopper={},v.title="MOTIONDIALER.NEW_HOPPER",v.newHopper=!0),n.params.id&&("IvrCampaign"===g?v.hopper.CampaignId=n.params.id:"QueueCampaign"==g?v.hopper.VoiceQueueId=n.params.id:v.hopper.ContactId=n.params.id),v.addNewHopper=function(){v.errors=[],d.cmHopper.save(v.hopper).$promise.then(function(e){v.hoppers.unshift(e.toJSON()),o.success({title:"Hopper properly created",msg:v.hopper.name?v.hopper.name+" has been created!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.saveHopper=function(){var t,a,i,s;v.errors=[],v.hopper.UserId=v.hopper.recallme?v.hopper.UserId:null,v.hopper.OwnerId=c.getCurrentUser().id,d.cmHopper.get({id:v.hopper.id,attributes:["scheduledat"]}).$promise.then(function(e){t=_.isNil(e)||_.isEmpty(e)?moment().format("YYYY-MM-DD HH:mm:ss"):e.scheduledat}).finally(function(){v.hopper.dialTimezone=v.contact.dialTimezone,d.cmHopper.update({id:v.hopper.id},_.omit(v.hopper,["VoiceQueueId","CampaignId","ContactId","ListId"])).$promise.then(function(e){a=e,d.cmContact.get({id:a.ContactId,attributes:["firstName","lastName"]}).$promise.then(function(e){_.isNil(e)||_.isNil(e.firstName)||(i=e.firstName,_.isNil(e.lastName)||(i+=" "+e.lastName))}).catch(function(){i=void 0}).finally(function(){d.voiceQueue.get({raw:!1,id:a.VoiceQueueId,attributes:["name"]}).$promise.then(function(e){s=e.name}).catch(function(e){s=void 0}).finally(function(){d.cmHopperHistory.save({state:24,statedesc:"Edited",scheduledat:t,calleridnum:a.phone,calleridname:i,campaigntype:a.VoiceQueueId?"queue":"ivr",campaign:s,editedat:moment().format("YYYY-MM-DD HH:mm:ss"),edited:!0,ListId:a.ListId,UserId:c.getCurrentUser().id,VoiceQueueId:a.VoiceQueueId,CampaignId:a.CampaignId,ContactId:a.ContactId,callback:a.callback,callbackuniqueid:a.callbackuniqueid,countbusyretry:a.countbusyretry,countcongestionretry:a.countcongestionretry,countglobal:a.countglobal,countnoanswerretry:a.countnoanswerretry,followuptime:a.followuptime,recallme:a.recallme}).$promise.then(function(){d.cmContact.update({id:a.ContactId,dialTimezone:v.contact.dialTimezone})})})});var n=_.find(v.hoppers,{id:e.id});n&&_.merge(n,_.pick(e.toJSON(),_.keys(n))),o.success({title:"Hopper properly saved!",msg:v.hopper.name?v.hopper.name+" has been saved!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})})},v.deleteHopper=function(e){v.errors=[];var n=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmHopper.delete({id:v.hopper.id}).$promise.then(function(){_.remove(v.hoppers,{id:v.hopper.id}),o.success({title:"Hopper properly deleted!",msg:(v.hopper.name||"hopper")+" has been deleted!"}),h(v.hopper)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},v.getDateFromString=function(e){return null===e?void 0:new Date(e)},v.closeDialog=h,v.recalcTZTime=function(){if(_.isNil(v.hopper.VoiceQueueId)){var e=v.hopper.CampaignId;d.campaign.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(v.hopper.dialTimezone=e.dialTimezone,n)d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.hopper.scheduledat=moment(v.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})});else{d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledat=moment(v.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}})}else{var e=v.hopper.VoiceQueueId;e&&d.voiceQueue.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(v.hopper.dialTimezone=e.dialTimezone,n)d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.hopper.scheduledat=moment(v.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})});else{d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledat=moment(v.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}})}},c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){v.agents=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){v.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(v.agents,{id:e.resourceId})}),t=null;if(v.hopper&&(t=_.find(v.agents,{id:Number(v.hopper.UserId)})),t&&!_.some(n,["id",t.id])){var a=_.find(v.agents,{id:t.id});a.canSelect=!1,n.push(a)}v.agents=n})}else{var t=[],a=null;v.hopper&&(a=_.find(v.agents,{id:Number(v.hopper.UserId)}));for(var i=0;i<v.agents.length;i++)a&&v.agents[i].id===a.id&&(v.agents[i].canSelect=!1,t.push(v.agents[i]));v.agents=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.cmContact.get({id:v.hopper.ContactId,fields:"dialTimezone"}).$promise.then(function(e){var n;v.contact=e,_.isNil(v.hopper.VoiceQueueId)?(n=v.hopper.CampaignId)&&d.campaign.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;v.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.dateTime=moment(v.hopper.scheduledat).add(n-t,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.dateTime=moment(v.hopper.scheduledat).add(n-0,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):(n=v.hopper.VoiceQueueId)&&d.voiceQueue.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;v.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.dateTime=moment(v.hopper.scheduledat).add(n-t,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.dateTime=moment(v.hopper.scheduledat).add(n-0,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","hoppers","hopper","api","Auth","license","setting","crudPermissions","from"],angular.module("app.motiondialer").controller("HopperdateController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_IVRCAMPAIGN",g.ivrCampaign=angular.copy(l),g.ivrCampaigns=r,g.newIvrCampaign=!1,g.ivrCampaign||(g.ivrCampaign={active:!0,type:"ivr",dialCheckDuplicateType:"always",dialCutDigit:0,limitCalls:30,dialRandomLastDigitCallerIdNumber:0,dialOriginateTimeout:30,dialGlobalMaxRetry:4,dialCongestionMaxRetry:3,dialCongestionRetryFrequency:150,dialBusyMaxRetry:3,dialBusyRetryFrequency:150,dialNoAnswerMaxRetry:3,dialNoAnswerRetryFrequency:150,dialNoSuchNumberMaxRetry:3,dialNoSuchNumberRetryFrequency:150,dialDropMaxRetry:3,dialDropRetryFrequency:150,dialAbandonedMaxRetry:3,dialAbandonedRetryFrequency:150,dialMachineMaxRetry:3,dialMachineRetryFrequency:150,dialAgentRejectMaxRetry:3,dialAgentRejectRetryFrequency:150,dialOrderByScheduledAt:"ASC",dialGlobalInterval:"07:00-22:00,*,*,*",dialAMDInitialSilence:2500,dialAMDGreeting:1500,dialAMDAfterGreetingSilence:800,dialAMDTotalAnalysisTime:5e3,dialAMDMinWordLength:100,dialAMDBetweenWordsSilence:50,dialAMDMaximumNumberOfWords:3,dialAMDSilenceThreshold:256,dialAMDMaximumWordLength:5e3},g.title="MOTIONDIALER.NEW_IVRCAMPAIGN",g.newIvrCampaign=!0),g.addNewIvrCampaign=function(){g.errors=[],d.campaign.save(g.ivrCampaign).$promise.then(function(e){g.ivrCampaigns.unshift(e.toJSON()),o.success({title:"IvrCampaign properly created",msg:g.ivrCampaign.name?g.ivrCampaign.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveIvrCampaign=function(){g.errors=[],d.campaign.update({id:g.ivrCampaign.id},g.ivrCampaign).$promise.then(function(e){var n=_.find(g.ivrCampaigns,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"IvrCampaign properly saved!",msg:g.ivrCampaign.name?g.ivrCampaign.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteIvrCampaign=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The ivrCampaign will be deleted.").ariaLabel("Delete IvrCampaign").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.campaign.delete({id:g.ivrCampaign.id}).$promise.then(function(){_.remove(g.ivrCampaigns,{id:g.ivrCampaign.id}),o.success({title:"IvrCampaign properly deleted!",msg:(g.ivrCampaign.name||"ivrCampaign")+" has been deleted!"}),v(g.ivrCampaign)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){g.trunks=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){g.trunks=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})});g.trunks.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),g.trunks=n})}else g.trunks=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.projects=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.projects=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.projects,{id:e.resourceId})}),t=null;if(g.ivrCampaign&&(t=_.find(g.projects,{id:Number(g.ivrCampaign.SquareProjectId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.projects,{id:t.id});a.canSelect=!1,n.push(a)}g.projects=n})}else{var t=[],a=null;g.ivrCampaign&&(a=_.find(g.projects,{id:Number(g.ivrCampaign.SquareProjectId)}));for(var i=0;i<g.projects.length;i++)a&&g.projects[i].id===a.id&&(g.projects[i].canSelect=!1,t.push(g.projects[i]));g.projects=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),t=null;if(g.ivrCampaign&&(t=_.find(g.interval,{id:Number(g.ivrCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.interval,{id:t.id});a.canSelect=!1,n.push(a)}g.interval=n})}else{var t=[],a=null;g.ivrCampaign&&(a=_.find(g.interval,{id:Number(g.ivrCampaign.IntervalId)}));for(var i=0;i<g.interval.length;i++)a&&g.interval[i].id===a.id&&(g.interval[i].canSelect=!1,t.push(g.interval[i]));g.interval=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","ivrCampaigns","ivrCampaign","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditIvrCampaignDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.ivrCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.ivrCampaign=n,d.crudPermissions=l,d.apiRoute="campaign",d.getApi="getBlackLists",d.addApi="addBlackLists",d.removeApi="removeBlackLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","ivrCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("IvrCampaignblacklistaddController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newIvrCampaign=!0,r.ivrCampaign=angular.copy(i),r.ivrCampaigns=s,r.title=o.instant("MOTIONDIALER.CLONE_IVRCAMPAIGN"),i&&i.name&&(r.title+=": "+i.name),r.cloneIvrCampaign=function(){return e.campaign.clone({id:i.id},r.ivrCampaign).$promise.then(function(e){r.ivrCampaigns.unshift(e.toJSON()),a.success({title:"IvrCampaign properly cloned",msg:r.ivrCampaign.name?r.ivrCampaign.name+" has been cloned!":""}),t.go("app.motiondialer.ivrCampaigns.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","ivrCampaign","ivrCampaigns","$translate"],angular.module("app.motiondialer").controller("IvrCampaigncloneController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHopperBlacks=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHopperBlacks(m.query,u).$promise}function g(e){d.hopperBlack.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHopperBlacks.rows,{id:e.id}),m.ivrCampaignHopperBlacks.count-=1,m.ivrCampaignHopperBlacks.rows.length||p(),l.success({title:"HopperBlack deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.ivrCampaign={},m.ivrCampaignHopperBlacks={count:0,rows:[]},m.selectedIvrCampaignHopperBlacks=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,ContactId,phone",sort:"-id",limit:10,page:1},m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperBlack?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperBlack #")+e.id||"hopperBlack")+"</b> will be deleted.").ariaLabel("delete hopperBlack").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHopperBlacks=p,m.createOrEditIvrCampaignHopperBlack=function(e,n){o.show({controller:"CreateOrEditHopperBlackDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperBlacks/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopperBlack:n,hopperBlacks:m.ivrCampaignHopperBlacks.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIvrCampaignHopperBlacks=function(){var e=angular.copy(m.selectedIvrCampaignHopperBlacks);return m.selectedIvrCampaignHopperBlacks=[],e},m.deleteIvrCampaignHopperBlack=g,m.deleteSelectedIvrCampaignHopperBlacks=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperBlacks?").htmlContent("<b>"+m.selectedIvrCampaignHopperBlacks.length+" selected</b> will be deleted.").ariaLabel("delete hopperBlacks").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperBlacks.forEach(function(e){g(e)}),m.selectedIvrCampaignHopperBlacks=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperBlacksController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHopperFinals=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHopperFinals(m.query,u).$promise}function g(e){d.hopperFinal.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHopperFinals.rows,{id:e.id}),m.ivrCampaignHopperFinals.count-=1,m.ivrCampaignHopperFinals.rows.length||p(),l.success({title:"HopperFinal deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function v(a){d.cmHopperFinal.checkContactHopper(a).$promise.then(function(e){l.info({title:"The contact is in the hopper",msg:"Contact ID "+e.ContactId})}).catch(function(e){var n,t;"Not Found"===e.data?d.cmHopper.save((n=a,t={},t.phone=n.calleridnum,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=0,t.countcongestionretry=0,t.countnoanswerretry=0,t.countglobal=0,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=n.deleted?null:n.UserId,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.priority=n.recallme?3:2,t.recallme=!!n.recallme,t)).$promise.then(function(e){var n,t;l.info({title:"Restored Contact",msg:"Contact ID "+e.ContactId}),e.ContactId&&d.cmHopperHistory.save(((t={}).calleridnum=(n=a).calleridnum,t.calleridname=n.calleridname,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=n.countbusyretry,t.countcongestionretry=n.countcongestionretry,t.countnoanswerretry=n.countnoanswerretry,t.countglobal=n.countglobal,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=c.getCurrentUser().id,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.editedat=moment().format("YYYY-MM-DD HH:mm:ss"),t.edited=!0,t.state=25,t.statedesc="Restored",t.campaign=n.campaign,t.campaigntype=n.VoiceQueueId?"queue":"ivr",t))}).catch(function(e){_.isNil(e.data)||"Validation error"!==e.data.message?l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}):l.info({title:"The contact is in the hopper",msg:"Contact ID "+a.ContactId})}):l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.contacts={},m.ivrCampaign={},m.ivrCampaignHopperFinals={count:0,rows:[]},m.selectedIvrCampaignHopperFinals=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,countglobal,scheduledat,starttime,responsetime,endtime,disposition,ListId,UserId,VoiceQueueId,CampaignId,recallme,deleted,campaign",sort:"-id",limit:10,page:1},m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperFinal?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperFinal #")+e.id||"hopperFinal")+"</b> will be deleted.").ariaLabel("delete hopperFinal").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHopperFinals=p,m.createOrEditIvrCampaignHopperFinal=function(e,n){o.show({controller:"CreateOrEditHopperFinalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperFinals/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopperFinal:n,hopperFinals:m.ivrCampaignHopperFinals.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIvrCampaignHopperFinals=function(){var e=angular.copy(m.selectedIvrCampaignHopperFinals);return m.selectedIvrCampaignHopperFinals=[],e},m.deleteIvrCampaignHopperFinal=g,m.deleteSelectedIvrCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperFinals?").htmlContent("<b>"+m.selectedIvrCampaignHopperFinals.length+" selected</b> will be deleted.").ariaLabel("delete hopperFinals").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperFinals.forEach(function(e){g(e)}),m.selectedIvrCampaignHopperFinals=[]})},m.moveIvrCampaignHopperFinal=v,m.moveContactsIvrCampaignHopperFinal=function(e){d.cmHopperFinal.moveContactsIvrCampaignHopperFinal({id:m.query.id,state:e}).$promise.then(function(e){_.isNil(e)&&_.isNil(e[0])?l.info({title:"Restored Contacts",msg:"0"}):l.info({title:"Restored Contacts",msg:JSON.stringify(e[0].affectedRows)})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.countContactsIvrCampaignHopperFinal=function(e){d.cmHopperFinal.countContactsIvrCampaignHopperFinal({id:e}).$promise.then(function(e){_.merge(m.contacts,e[0])}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.moveConfirm=function(e,n){var t=o.confirm().title("Are you sure want to restore the contact?").htmlContent("<b>Contact</b> will be restored.").ariaLabel("Restore Contact").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.moveSelectedIvrCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to restore the selected contacts?").htmlContent("<b> Contacts selected</b> will be restored.").ariaLabel("Restore Contacts").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperFinals.forEach(function(e){v(e)}),m.selectedIvrCampaignHopperFinals=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperFinalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHopperHistories=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHopperHistories(m.query,u).$promise}function g(e){d.hopperHistory.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHopperHistories.rows,{id:e.id}),m.ivrCampaignHopperHistories.count-=1,m.ivrCampaignHopperHistories.rows.length||p(),l.success({title:"HopperHistory deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.ivrCampaign={},m.ivrCampaignHopperHistories={count:0,rows:[]},m.selectedIvrCampaignHopperHistories=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,scheduledat,starttime,responsetime,endtime",sort:"-id",limit:10,page:1},m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperHistory?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperHistory #")+e.id||"hopperHistory")+"</b> will be deleted.").ariaLabel("delete hopperHistory").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHopperHistories=p,m.createOrEditIvrCampaignHopperHistory=function(e,n){o.show({controller:"CreateOrEditHopperHistoryDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperHistories/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopperHistory:n,hopperHistories:m.ivrCampaignHopperHistories.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIvrCampaignHopperHistories=function(){var e=angular.copy(m.selectedIvrCampaignHopperHistories);return m.selectedIvrCampaignHopperHistories=[],e},m.deleteIvrCampaignHopperHistory=g,m.deleteSelectedIvrCampaignHopperHistories=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperHistories?").htmlContent("<b>"+m.selectedIvrCampaignHopperHistories.length+" selected</b> will be deleted.").ariaLabel("delete hopperHistories").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperHistories.forEach(function(e){g(e)}),m.selectedIvrCampaignHopperHistories=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperHistoriesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHoppers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHoppers(m.query,u).$promise}function g(e){d.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHoppers.rows,{id:e.id}),m.ivrCampaignHoppers.count-=1,m.ivrCampaignHoppers.rows.length||p(),l.success({title:"Hopper deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.ivrCampaign={},m.ivrCampaignHoppers={count:0,rows:[]},m.selectedIvrCampaignHoppers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,ContactId,phone,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,scheduledat,priority",sort:"-updatedAt",limit:10,page:1},m.arraypriority=_.keyBy([{option:"Highest",value:"'4'"},{option:"High",value:"'3'"},{option:"Medium",value:"'2'"},{option:"Low",value:"'1'"},{option:"Lowest",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopper?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopper #")+e.id||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHoppers=p,m.createOrEditIvrCampaignHopper=function(e,n){o.show({controller:"HopperdateController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopper:n,hoppers:m.ivrCampaignHoppers.rows,license:null,setting:null,crudPermissions:m.crudPermissions,from:"IvrCampaign"}})},m.exportSelectedIvrCampaignHoppers=function(){var e=angular.copy(m.selectedIvrCampaignHoppers);return m.selectedIvrCampaignHoppers=[],e},m.deleteIvrCampaignHopper=g,m.deleteSelectedIvrCampaignHoppers=function(e){var n=o.confirm().title("Are you sure want to delete the selected hoppers?").htmlContent("<b>"+m.selectedIvrCampaignHoppers.length+" selected</b> will be deleted.").ariaLabel("delete hoppers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHoppers.forEach(function(e){g(e)}),m.selectedIvrCampaignHoppers=[]})},c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.agents,{id:e.resourceId})});m.agents.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),m.agents=n})}else m.agents=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHoppersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_HOPPER",g.hopper=angular.copy(l),g.hoppers=r,g.newHopper=!1,g.hopper||(g.hopper={},g.title="MOTIONDIALER.NEW_HOPPER",g.newHopper=!0),n.params.id&&(g.hopper.CampaignId=n.params.id),g.addNewHopper=function(){g.errors=[],d.cmHopper.save(g.hopper).$promise.then(function(e){g.hoppers.unshift(e.toJSON()),o.success({title:"Hopper properly created",msg:g.hopper.name?g.hopper.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveHopper=function(){var t,a,i,s;g.errors=[],g.hopper.UserId=g.hopper.recallme?g.hopper.UserId:null,g.hopper.OwnerId=c.getCurrentUser().id,d.cmHopper.get({id:g.hopper.id,attributes:["scheduledat"]}).$promise.then(function(e){t=_.isNil(e)||_.isEmpty(e)?moment().format("YYYY-MM-DD HH:mm:ss"):e.scheduledat}).finally(function(){d.cmHopper.update({id:g.hopper.id},_.omit(g.hopper,["VoiceQueueId","CampaignId","ContactId","ListId"])).$promise.then(function(e){a=e,d.cmContact.get({id:a.ContactId,attributes:["firstName","lastName"]}).$promise.then(function(e){_.isNil(e)||_.isNil(e.firstName)||(i=e.firstName,_.isNil(e.lastName)||(i+=" "+e.lastName))}).catch(function(){i=void 0}).finally(function(){d.campaign.get({raw:!1,id:a.CampaignId,attributes:["name"]}).$promise.then(function(e){s=e.name}).catch(function(e){s=void 0}).finally(function(){d.cmHopperHistory.save({state:24,statedesc:"Edited",scheduledat:t,calleridnum:a.phone,calleridname:i,campaigntype:a.VoiceQueueId?"queue":"ivr",campaign:s,editedat:moment().format("YYYY-MM-DD HH:mm:ss"),edited:!0,ListId:a.ListId,UserId:c.getCurrentUser().id,VoiceQueueId:a.VoiceQueueId,CampaignId:a.CampaignId,ContactId:a.ContactId,callback:a.callback,callbackuniqueid:a.callbackuniqueid,countbusyretry:a.countbusyretry,countcongestionretry:a.countcongestionretry,countglobal:a.countglobal,countnoanswerretry:a.countnoanswerretry,followuptime:a.followuptime,recallme:a.recallme})})});var n=_.find(g.hoppers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Hopper properly saved!",msg:g.hopper.name?g.hopper.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})})},g.deleteHopper=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmHopper.delete({id:g.hopper.id}).$promise.then(function(){_.remove(g.hoppers,{id:g.hopper.id}),o.success({title:"Hopper properly deleted!",msg:(g.hopper.name||"hopper")+" has been deleted!"}),v(g.hopper)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.agents,{id:e.resourceId})});g.agents.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),g.agents=n})}else g.agents=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","hoppers","hopper","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditHopperCampaignIdDialogController",e)}(),function(){"use strict";function e(t,a){var i=this;i.ivrCampaign={},i.init=function(n){i.ivrCampaign=n,t.cmHopper.get({limit:0,CampaignId:n.id}).$promise.then(function(e){return i.total=e.count||0,t.cmHopper.get({limit:0,CampaignId:n.id,active:!1,countbusyretry:0,countcongestionretry:0,countnoanswerretry:0,countnosuchnumberretry:0,countdropretry:0,countabandonedretry:0,countmachineretry:0,countagentrejectretry:0}).$promise}).then(function(e){return i.fresh=e.count||0,t.cmHopperFinal.get({limit:0,CampaignId:n.id}).$promise}).then(function(e){i.closed=e.count||0}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["api","toasty"],angular.module("app.motiondialer").controller("IvrCampaignHopperStatisticsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.ivrCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.ivrCampaign=n,d.crudPermissions=l,d.apiRoute="campaign",d.getApi="getLists",d.addApi="addLists",d.removeApi="removeLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","ivrCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("IvrCampaignlistaddController",e)}(),function(){"use strict";function e(e,n,a,i,s,t,o,r){var l=this;function d(){n.hide()}function c(e,n){var t=n.id;o.enqueue(function(){return i.campaign.removeLists({id:e,ids:t}).$promise.then(function(){return i.campaign.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){a.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:queueCampaign.RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}l.selected=[],l.items=t||[],l.loading=!1,l.closeDialog=d,l.exists=function(e,n){return-1<n.indexOf(e)},l.toggle=function(e,n){var t=n.indexOf(e);-1<t?n.splice(t,1):n.push(e)},l.isIndeterminate=function(){return 0!==l.selected.length&&l.selected.length!==l.items.length},l.isChecked=function(){return l.selected.length===l.items.length},l.toggleAll=function(){l.selected.length===l.items.length?l.selected=[]:(0===l.selected.length||0<l.selected.length)&&(l.selected=l.items.slice(0))},l.listSelected=function(){l.loading=!0,r(function(e,n){for(var t=0;t<l.selected.length;t+=1)c(s.id,l.selected[t]);var a;a=e,o.enqueue(function(){return a()})}).finally(function(){l.loading=!1,d()})}}e.$inject=["$scope","$mdDialog","toasty","api","ivrCampaign","listsCampaign","Sequence","$q"],angular.module("app.motiondialer").controller("IvrCampaignresetlistController",e)}(),function(){"use strict";function e(t,e,i,s,a,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.ivrCampaign=c||t.params.ivrCampaign||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.clonedialog=function(e,n){i.show({controller:"IvrCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.listadddialog=function(e,n){i.show({controller:"IvrCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.blacklistadddialog=function(e,n){i.show({controller:"IvrCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.resetlistdialog=function(n,t){r.campaign.getLists({id:n.id,fields:"id,name",nolimit:!0}).$promise.then(function(a){if(_.isNil(a.rows)||_.isEmpty(a.rows))l.info({title:"Campaign Without Lists"});else if(1===a.rows.length){var e=i.confirm().title("Are you sure want to reset the list "+a.rows[0].name+" ?").htmlContent("<b>"+a.rows[0].name+"</b> will be reset.").ariaLabel("Reset List").targetEvent(t).ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,n,t;e=u.ivrCampaign.id,n=a.rows[0],t=n.id,r.campaign.removeLists({id:e,ids:t}).$promise.then(function(){return r.campaign.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){l.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ivrCampaign.REMOVELIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}else i.show({controller:"IvrCampaignresetlistController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/resetlist/resetlist.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!1,locals:{ivrCampaign:n,listsCampaign:a?a.rows:[]}})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})},u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.ivr_campaigns",{}):l.info({title:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.ivr_campaigns",{})}},u.alert=l.info,u.gotoIvrCampaigns=function(){t.go("app.motiondialer.ivrCampaigns",{},{reload:"app.motiondialer.ivrCampaigns"})},u.saveIvrCampaign=function(){r.campaign.update({id:u.ivrCampaign.id},u.ivrCampaign).$promise.then(function(){l.success({title:"IvrCampaign updated!",msg:u.ivrCampaign.name?u.ivrCampaign.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.trunks,{id:e.resourceId})});u.trunks.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.trunks=n})}else u.trunks=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),t=null;if(u.ivrCampaign&&(t=_.find(u.projects,{id:Number(u.ivrCampaign.SquareProjectId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.projects,{id:t.id});a.canSelect=!1,n.push(a)}u.projects=n})}else{var t=[],a=null;u.ivrCampaign&&(a=_.find(u.projects,{id:Number(u.ivrCampaign.SquareProjectId)}));for(var i=0;i<u.projects.length;i++)a&&u.projects[i].id===a.id&&(u.projects[i].canSelect=!1,t.push(u.projects[i]));u.projects=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.interval,{id:e.resourceId})}),t=null;if(u.ivrCampaign&&(t=_.find(u.interval,{id:Number(u.ivrCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.interval,{id:t.id});a.canSelect=!1,n.push(a)}u.interval=n})}else{var t=[],a=null;u.ivrCampaign&&(a=_.find(u.interval,{id:Number(u.ivrCampaign.IntervalId)}));for(var i=0;i<u.interval.length;i++)a&&u.interval[i].id===a.id&&(u.interval[i].canSelect=!1,t.push(u.interval[i]));u.interval=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","ivrCampaign","userProfileSection"],angular.module("app.motiondialer").controller("IvrCampaignController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.ivrCampaigns=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="ivrCampaigns",f.listOrder="",f.listOrderAsc=null,f.selectedIvrCampaigns=[],f.query={fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",type:"ivr",sort:"-updatedAt",limit:10,page:1},f.arraydialCheckDuplicateType=_.keyBy([{option:"ALWAYS",value:"'always'"},{option:"NEVER",value:"'never'"},{option:"ONLY_IF_OPEN",value:"'onlyIfOpen'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialOrderByScheduledAt=_.keyBy([{option:"DESC",value:"'DESC'"},{option:"ASC",value:"'ASC'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.motiondialer.ivrCampaigns.edit",{id:e.id,ivrCampaign:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"IvrCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:f.ivrCampaigns?f.ivrCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.listadddialog=function(e,n){i.show({controller:"IvrCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:f.ivrCampaigns?f.ivrCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.blacklistadddialog=function(e,n){i.show({controller:"IvrCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:f.ivrCampaigns?f.ivrCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("ivrCampaign")+"?").htmlContent("<b>"+(e.name||"ivrCampaign")+"</b> will be deleted.").ariaLabel("delete ivrCampaign").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.ivr_campaigns",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.ivr_campaigns",{})}},f.success=E,f.getIvrCampaigns=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.campaign.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="IvrCampaigns",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditIvrCampaign=function(e,n){i.show({controller:"CreateOrEditIvrCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:n,ivrCampaigns:f.ivrCampaigns.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteIvrCampaign=y,f.exportSelectedIvrCampaigns=function(){var e=angular.copy(f.selectedIvrCampaigns);return f.selectedIvrCampaigns=[],e},f.deleteSelectedIvrCampaigns=function(e){var n=i.confirm().title("Are you sure want to delete the selected ivrCampaigns?").htmlContent("<b>"+f.selectedIvrCampaigns.length+" selected</b> will be deleted.").ariaLabel("delete IvrCampaigns").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedIvrCampaigns.forEach(function(e){y(e)}),f.selectedIvrCampaigns=[]})},f.deselectIvrCampaigns=function(){f.selectedIvrCampaigns=[]},f.selectAllIvrCampaigns=function(){f.selectedIvrCampaigns=f.ivrCampaigns.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){f.trunks=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){f.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.trunks,{id:e.resourceId})});f.trunks.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),f.trunks=n})}else f.trunks=[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.projects=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.projects=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(f.projects,{id:e.resourceId})}),a=null;a=[],f.ivrCampaigns.rows.forEach(function(e){var n=_.find(f.projects,{id:Number(e.SquareProjectId)});a.push(n)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(f.projects,{id:e.id});n.canSelect=!1,t.push(n)}}),f.projects=t})}else{var t=[],a=[];f.ivrCampaigns.rows.forEach(function(e){var n=_.find(f.projects,{id:Number(e.SquareProjectId)});a.push(n)});for(var i=0;i<f.projects.length;i++){_.some(a,{id:f.projects[i].id})&&(f.projects[i].canSelect=!1,t.push(f.projects[i]))}f.projects=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.interval,{id:e.resourceId})}),t=null;if(f.ivrCampaign&&(t=_.find(f.interval,{id:Number(f.ivrCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.interval,{id:t.id});a.canSelect=!1,n.push(a)}f.interval=n})}else{var t=[],a=null;f.ivrCampaign&&(a=_.find(f.interval,{id:Number(f.ivrCampaign.IntervalId)}));for(var i=0;i<f.interval.length;i++)a&&f.interval[i].id===a.id&&(f.interval[i].canSelect=!1,t.push(f.interval[i]));f.interval=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.ivrCampaigns=e||{count:0,rows:[]}}function y(e){m.campaign.delete({id:e.id}).$promise.then(function(){_.remove(f.ivrCampaigns.rows,{id:e.id}),f.ivrCampaigns.count-=1,f.ivrCampaigns.rows.length||f.getIvrCampaigns(),p.success({title:_.startCase("IvrCampaign")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcampaign"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getIvrCampaigns())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","ivrCampaigns","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.motiondialer").controller("IvrCampaignsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_QUEUECAMPAIGN",g.queueCampaign=angular.copy(l),g.queueCampaigns=r,g.newQueueCampaign=!1,g.queueCampaign||(g.queueCampaign={dialActive:!0,type:"outbound",dialCheckDuplicateType:"always",dialCutDigit:0,autopause:"no",ringinuse:"no",timeoutrestart:"no",setinterfacevar:"no",setqueuevar:"no",setqueueentryvar:"no",dialOrderByScheduledAt:"ASC",dialGlobalInterval:"07:00-22:00,*,*,*",dialAMDInitialSilence:2500,dialAMDGreeting:1500,dialAMDAfterGreetingSilence:800,dialAMDTotalAnalysisTime:5e3,dialAMDMinWordLength:100,dialAMDBetweenWordsSilence:50,dialAMDMaximumNumberOfWords:3,dialAMDSilenceThreshold:256,dialAMDMaximumWordLength:5e3,dialMethod:"progressive",dialPowerLevel:1,dialPredictiveOptimization:"dropRate",dialPredictiveOptimizationPercentage:3,dialPredictiveInterval:10,dialLimitQueue:0,dialRandomLastDigitCallerIdNumber:0,dialOriginateTimeout:30,dialQueueOptions:"tTxX",dialQueueTimeout:3,strategy:"rrmemory",timeout:3,retry:3,weight:1,dialGlobalMaxRetry:4,dialCongestionMaxRetry:3,dialCongestionRetryFrequency:150,dialBusyMaxRetry:3,dialBusyRetryFrequency:150,dialNoAnswerMaxRetry:3,dialNoAnswerRetryFrequency:150,dialNoSuchNumberMaxRetry:3,dialNoSuchNumberRetryFrequency:150,dialDropMaxRetry:3,dialDropRetryFrequency:150,dialAbandonedMaxRetry:3,dialAbandonedRetryFrequency:150,dialMachineMaxRetry:3,dialMachineRetryFrequency:150,dialAgentRejectMaxRetry:3,dialAgentRejectRetryFrequency:150,callAdditionalPhoneAfterMin:3,dialPredictiveIntervalMaxThreshold:20,dialPredictiveIntervalMinThreshold:10},g.title="MOTIONDIALER.NEW_QUEUECAMPAIGN",g.newQueueCampaign=!0),g.addNewQueueCampaign=function(){g.errors=[],d.voiceQueue.save(g.queueCampaign).$promise.then(function(e){g.queueCampaigns.unshift(e.toJSON()),o.success({title:"QueueCampaign properly created",msg:g.queueCampaign.name?g.queueCampaign.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveQueueCampaign=function(){g.errors=[],d.voiceQueue.update({id:g.queueCampaign.id},g.queueCampaign).$promise.then(function(e){var n=_.find(g.queueCampaigns,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"QueueCampaign properly saved!",msg:g.queueCampaign.name?g.queueCampaign.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteQueueCampaign=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The queueCampaign will be deleted.").ariaLabel("Delete QueueCampaign").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceQueue.delete({id:g.queueCampaign.id}).$promise.then(function(){_.remove(g.queueCampaigns,{id:g.queueCampaign.id}),o.success({title:"QueueCampaign properly deleted!",msg:(g.queueCampaign.name||"queueCampaign")+" has been deleted!"}),v(g.queueCampaign)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})}),t=null;if(g.queueCampaign&&(t=_.find(g.trunks,{id:Number(g.queueCampaign.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.trunks,{id:t.id});a.canSelect=!1,n.push(a)}g.trunks=n})}else{var t=[],a=null;g.queueCampaign&&(a=_.find(g.trunks,{id:Number(g.queueCampaign.TrunkId)}));for(var i=0;i<g.trunks.length;i++)a&&g.trunks[i].id===a.id&&(g.trunks[i].canSelect=!1,t.push(g.trunks[i]));g.trunks=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),t=null;if(g.queueCampaign&&(t=_.find(g.interval,{id:Number(g.queueCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.interval,{id:t.id});a.canSelect=!1,n.push(a)}g.interval=n})}else{var t=[],a=null;g.queueCampaign&&(a=_.find(g.interval,{id:Number(g.queueCampaign.IntervalId)}));for(var i=0;i<g.interval.length;i++)a&&g.interval[i].id===a.id&&(g.interval[i].canSelect=!1,t.push(g.interval[i]));g.interval=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","queueCampaigns","queueCampaign","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditQueueCampaignDialogController",e)}(),function(){"use strict";function e(e,l,a,d,n,t,i,s,o,r){var c=this;function m(){return l(function(t,n){return l(function(n,t){return d.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(n,t){return d.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:o.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),l(function(n,t){return d.voiceQueue.getAgents({id:c.queueCampaign.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=o.getCurrentUser(),c.queueCampaign=n,c.crudPermissions=r,c.penalty=0,c.realtime=i,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return o.hasRole("admin")?m().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):l(function(t,n){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,l(function(e,n){_.isEmpty(t)?e():d.voiceQueue.removeAgents({id:c.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return r=n,l(function(e,n){if(_.isEmpty(r))e();else{for(var t=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);t.push(d.voiceQueue.addAgents({id:c.queueCampaign.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty "),realtime:c.realtime||!1}).$promise)}l.all(t).then(function(){e()}).catch(function(e){n(e)})}});var r}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),a.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("MOTIONDIALER.ALL_AGENTS"),labelSelected:s.instant("MOTIONDIALER.SELECTED_AGENTS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var t=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","queueCampaigns","realtime","$translate","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.queueCampaign=n,d.crudPermissions=l,d.apiRoute="voiceQueue",d.getApi="getBlackLists",d.addApi="addBlackLists",d.removeApi="removeBlackLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignblacklistaddController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newQueueCampaign=!0,r.queueCampaign=angular.copy(i),r.queueCampaigns=s,r.title=o.instant("MOTIONDIALER.CLONE_QUEUECAMPAIGN"),i&&i.name&&(r.title+=": "+i.name),r.cloneQueueCampaign=function(){return e.voiceQueue.clone({id:i.id},r.queueCampaign).$promise.then(function(e){r.queueCampaigns.unshift(e.toJSON()),a.success({title:"QueueCampaign properly cloned",msg:r.queueCampaign.name?r.queueCampaign.name+" has been cloned!":""}),t.go("app.motiondialer.queueCampaigns.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","queueCampaign","queueCampaigns","$translate"],angular.module("app.motiondialer").controller("QueueCampaigncloneController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHopperBlacks=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHopperBlacks(m.query,u).$promise}function g(e){d.hopperBlack.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHopperBlacks.rows,{id:e.id}),m.queueCampaignHopperBlacks.count-=1,m.queueCampaignHopperBlacks.rows.length||p(),l.success({title:"HopperBlack deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.queueCampaign={},m.queueCampaignHopperBlacks={count:0,rows:[]},m.selectedQueueCampaignHopperBlacks=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,ContactId,phone",sort:"-id",limit:10,page:1},m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperBlack?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperBlack #")+e.id||"hopperBlack")+"</b> will be deleted.").ariaLabel("delete hopperBlack").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHopperBlacks=p,m.createOrEditQueueCampaignHopperBlack=function(e,n){o.show({controller:"CreateOrEditHopperBlackDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperBlacks/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopperBlack:n,hopperBlacks:m.queueCampaignHopperBlacks.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedQueueCampaignHopperBlacks=function(){var e=angular.copy(m.selectedQueueCampaignHopperBlacks);return m.selectedQueueCampaignHopperBlacks=[],e},m.deleteQueueCampaignHopperBlack=g,m.deleteSelectedQueueCampaignHopperBlacks=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperBlacks?").htmlContent("<b>"+m.selectedQueueCampaignHopperBlacks.length+" selected</b> will be deleted.").ariaLabel("delete hopperBlacks").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperBlacks.forEach(function(e){g(e)}),m.selectedQueueCampaignHopperBlacks=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperBlacksController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHopperFinals=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHopperFinals(m.query,u).$promise}function g(e){d.hopperFinal.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHopperFinals.rows,{id:e.id}),m.queueCampaignHopperFinals.count-=1,m.queueCampaignHopperFinals.rows.length||p(),l.success({title:"HopperFinal deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function v(a){d.cmHopperFinal.checkContactHopper(a).$promise.then(function(e){l.info({title:"The contact is in the hopper",msg:"Contact ID "+e.ContactId})}).catch(function(e){var n,t;"Not Found"===e.data?d.cmHopper.save((n=a,t={},t.phone=n.calleridnum,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=0,t.countcongestionretry=0,t.countnoanswerretry=0,t.countglobal=0,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=n.deleted?null:n.UserId,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.priority=n.recallme?3:2,t.recallme=!!n.recallme,t)).$promise.then(function(e){var n,t;l.info({title:"Restored Contact",msg:"Contact ID "+e.ContactId}),e.ContactId&&d.cmHopperHistory.save(((t={}).calleridnum=(n=a).calleridnum,t.calleridname=n.calleridname,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=n.countbusyretry,t.countcongestionretry=n.countcongestionretry,t.countnoanswerretry=n.countnoanswerretry,t.countglobal=n.countglobal,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=c.getCurrentUser().id,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.editedat=moment().format("YYYY-MM-DD HH:mm:ss"),t.edited=!0,t.state=25,t.statedesc="Restored",t.campaign=n.campaign,t.campaigntype=n.VoiceQueueId?"queue":"ivr",t))}).catch(function(e){_.isNil(e.data)||"Validation error"!==e.data.message?l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}):l.info({title:"The contact is in the hopper",msg:"Contact ID "+a.ContactId})}):l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.contacts={},m.queueCampaign={},m.queueCampaignHopperFinals={count:0,rows:[]},m.selectedQueueCampaignHopperFinals=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,countglobal,scheduledat,starttime,responsetime,endtime,disposition,secondDisposition,thirdDisposition,ListId,UserId,VoiceQueueId,CampaignId,recallme,deleted,campaign",sort:"-id",limit:10,page:1},m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperFinal?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperFinal #")+e.id||"hopperFinal")+"</b> will be deleted.").ariaLabel("delete hopperFinal").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHopperFinals=p,m.createOrEditQueueCampaignHopperFinal=function(e,n){o.show({controller:"CreateOrEditHopperFinalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperFinals/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopperFinal:n,hopperFinals:m.queueCampaignHopperFinals.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedQueueCampaignHopperFinals=function(){var e=angular.copy(m.selectedQueueCampaignHopperFinals);return m.selectedQueueCampaignHopperFinals=[],e},m.deleteQueueCampaignHopperFinal=g,m.deleteSelectedQueueCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperFinals?").htmlContent("<b>"+m.selectedQueueCampaignHopperFinals.length+" selected</b> will be deleted.").ariaLabel("delete hopperFinals").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperFinals.forEach(function(e){g(e)}),m.selectedQueueCampaignHopperFinals=[]})},m.moveQueueCampaignHopperFinal=v,m.moveContactsQueueCampaignHopperFinal=function(e){d.cmHopperFinal.moveContactsQueueCampaignHopperFinal({id:m.query.id,state:e}).$promise.then(function(e){_.isNil(e)&&_.isNil(e[0])?l.info({title:"Restored Contacts",msg:"0"}):l.info({title:"Restored Contacts",msg:JSON.stringify(e[0].affectedRows)})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.countContactsQueueCampaignHopperFinal=function(e){d.cmHopperFinal.countContactsQueueCampaignHopperFinal({id:e}).$promise.then(function(e){_.merge(m.contacts,e[0])}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.moveConfirm=function(e,n){var t=o.confirm().title("Are you sure want to restore the contact?").htmlContent("<b>Contact</b> will be restored.").ariaLabel("Restore Contact").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.moveSelectedQueueCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to restore the selected contacts?").htmlContent("<b> Contacts selected</b> will be restored.").ariaLabel("Restore Contacts").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperFinals.forEach(function(e){v(e)}),m.selectedQueueCampaignHopperFinals=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperFinalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHopperHistories=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHopperHistories(m.query,u).$promise}function g(e){d.hopperHistory.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHopperHistories.rows,{id:e.id}),m.queueCampaignHopperHistories.count-=1,m.queueCampaignHopperHistories.rows.length||p(),l.success({title:"HopperHistory deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.queueCampaign={},m.queueCampaignHopperHistories={count:0,rows:[]},m.selectedQueueCampaignHopperHistories=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,scheduledat,starttime,responsetime,endtime",sort:"-id",limit:10,page:1},m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperHistory?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperHistory #")+e.id||"hopperHistory")+"</b> will be deleted.").ariaLabel("delete hopperHistory").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHopperHistories=p,m.createOrEditQueueCampaignHopperHistory=function(e,n){o.show({controller:"CreateOrEditHopperHistoryDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperHistories/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopperHistory:n,hopperHistories:m.queueCampaignHopperHistories.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedQueueCampaignHopperHistories=function(){var e=angular.copy(m.selectedQueueCampaignHopperHistories);return m.selectedQueueCampaignHopperHistories=[],e},m.deleteQueueCampaignHopperHistory=g,m.deleteSelectedQueueCampaignHopperHistories=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperHistories?").htmlContent("<b>"+m.selectedQueueCampaignHopperHistories.length+" selected</b> will be deleted.").ariaLabel("delete hopperHistories").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperHistories.forEach(function(e){g(e)}),m.selectedQueueCampaignHopperHistories=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperHistoriesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHoppers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHoppers(m.query,u).$promise}function g(e){d.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHoppers.rows,{id:e.id}),m.queueCampaignHoppers.count-=1,m.queueCampaignHoppers.rows.length||p(),l.success({title:"Hopper deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.queueCampaign={},m.queueCampaignHoppers={count:0,rows:[]},m.selectedQueueCampaignHoppers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,ContactId,phone,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,scheduledat,priority,recallme,UserId",sort:"-updatedAt",limit:10,page:1},m.arraypriority=_.keyBy([{option:"Highest",value:"'4'"},{option:"High",value:"'3'"},{option:"Medium",value:"'2'"},{option:"Low",value:"'1'"},{option:"Lowest",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopper?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopper #")+e.id||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHoppers=p,m.createOrEditQueueCampaignHopper=function(e,n){o.show({controller:"HopperdateController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopper:n,hoppers:m.queueCampaignHoppers.rows,license:null,setting:null,crudPermissions:m.crudPermissions,from:"QueueCampaign"}})},m.exportSelectedQueueCampaignHoppers=function(){var e=angular.copy(m.selectedQueueCampaignHoppers);return m.selectedQueueCampaignHoppers=[],e},m.deleteQueueCampaignHopper=g,m.deleteSelectedQueueCampaignHoppers=function(e){var n=o.confirm().title("Are you sure want to delete the selected hoppers?").htmlContent("<b>"+m.selectedQueueCampaignHoppers.length+" selected</b> will be deleted.").ariaLabel("delete hoppers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHoppers.forEach(function(e){g(e)}),m.selectedQueueCampaignHoppers=[]})},c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.agents,{id:e.resourceId})}),t=null;if(m.queueCampaign&&(t=_.find(m.agents,{id:Number(m.queueCampaign.UserId)})),t&&!_.some(n,["id",t.id])){var a=_.find(m.agents,{id:t.id});a.canSelect=!1,n.push(a)}m.agents=n})}else{var t=[],a=null;m.queueCampaign&&(a=_.find(m.agents,{id:Number(m.queueCampaign.UserId)}));for(var i=0;i<m.agents.length;i++)a&&m.agents[i].id===a.id&&(m.agents[i].canSelect=!1,t.push(m.agents[i]));m.agents=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHoppersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}function h(){console.log("recalcTZTime hopper",g.hopper);var e=g.hopper.Queue.id;if(e)d.voiceQueue.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(g.hopper.dialTimezone=e.dialTimezone,n)d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),_.isNil(g.dateTime)||(g.hopper.scheduledat=moment(g.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss"))})});else{d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),_.isNil(g.dateTime)||(g.hopper.scheduledat=moment(g.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss"))})}});else{d.cmHopper.getTimezone({id:g.hopper.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),g.hopper.scheduledat=moment(g.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_HOPPER",g.hopper=angular.copy(l),g.hoppers=r,g.newHopper=!1,g.recalcTZTime=h,e.$watch("vm.contact.dialTimezone",function(){h()}),g.hopper||(g.hopper={},g.title="MOTIONDIALER.NEW_HOPPER",g.newHopper=!0),n.params.id&&(g.hopper.VoiceQueueId=n.params.id),g.addNewHopper=function(){g.errors=[],d.cmHopper.save(g.hopper).$promise.then(function(e){g.hoppers.unshift(e.toJSON()),o.success({title:"Hopper properly created",msg:g.hopper.name?g.hopper.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveHopper=function(){var t,a,i,s;g.errors=[],g.hopper.UserId=g.hopper.recallme?g.hopper.UserId:null,g.hopper.OwnerId=c.getCurrentUser().id,g.hopper.dialTimezone=g.contact.dialTimezone,d.cmHopper.get({id:g.hopper.id,attributes:["scheduledat"]}).$promise.then(function(e){t=_.isNil(e)||_.isEmpty(e)?moment().format("YYYY-MM-DD HH:mm:ss"):e.scheduledat}).finally(function(){d.cmHopper.update({id:g.hopper.id},_.omit(g.hopper,["VoiceQueueId","CampaignId","ContactId","ListId"])).$promise.then(function(e){a=e,d.cmContact.get({id:a.ContactId,attributes:["firstName","lastName"]}).$promise.then(function(e){_.isNil(e)||_.isNil(e.firstName)||(i=e.firstName,_.isNil(e.lastName)||(i+=" "+e.lastName))}).catch(function(){i=void 0}).finally(function(){d.voiceQueue.get({raw:!1,id:a.VoiceQueueId,attributes:["name"]}).$promise.then(function(e){s=e.name}).catch(function(e){s=void 0}).finally(function(){d.cmHopperHistory.save({state:24,statedesc:"Edited",scheduledat:t,calleridnum:a.phone,calleridname:i,campaigntype:a.VoiceQueueId?"queue":"ivr",campaign:s,editedat:moment().format("YYYY-MM-DD HH:mm:ss"),edited:!0,ListId:a.ListId,UserId:c.getCurrentUser().id,VoiceQueueId:a.VoiceQueueId,CampaignId:a.CampaignId,ContactId:a.ContactId,callback:a.callback,callbackuniqueid:a.callbackuniqueid,countbusyretry:a.countbusyretry,countcongestionretry:a.countcongestionretry,countglobal:a.countglobal,countnoanswerretry:a.countnoanswerretry,followuptime:a.followuptime,recallme:a.recallme}).$promise.then(function(){d.cmContact.update({id:a.ContactId,dialTimezone:g.contact.dialTimezone})})})});var n=_.find(g.hoppers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Hopper properly saved!",msg:g.hopper.name?g.hopper.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})})},g.deleteHopper=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmHopper.delete({id:g.hopper.id}).$promise.then(function(){_.remove(g.hoppers,{id:g.hopper.id}),o.success({title:"Hopper properly deleted!",msg:(g.hopper.name||"hopper")+" has been deleted!"}),v(g.hopper)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.dateTime,g.contact,d.cmContact.get({id:g.hopper.Contact.id,fields:"dialTimezone"}).$promise.then(function(e){var n;g.contact=e,console.log("initTZTime hopper",g.hopper),_.isNil(g.hopper.Queue.id)?(n=g.hopper.Campaign.id)&&d.campaign.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;g.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;g.dateTime=moment(g.hopper.scheduledat).add(n-t,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),g.dateTime=moment(g.hopper.scheduledat).add(n-0,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):(n=g.hopper.Queue.id)&&d.voiceQueue.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;g.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;g.dateTime=moment(g.hopper.scheduledat).add(n-t,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),g.dateTime=moment(g.hopper.scheduledat).add(n-0,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})})}),g.closeDialog=v,c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.agents,{id:e.resourceId})}),t=null;if(g.hopper&&(t=_.find(g.agents,{id:Number(g.hopper.UserId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.agents,{id:t.id});a.canSelect=!1,n.push(a)}g.agents=n})}else{var t=[],a=null;g.hopper&&(a=_.find(g.agents,{id:Number(g.hopper.UserId)}));for(var i=0;i<g.agents.length;i++)a&&g.agents[i].id===a.id&&(g.agents[i].canSelect=!1,t.push(g.agents[i]));g.agents=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","hoppers","hopper","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditHopperVoiceQueueIdDialogController",e)}(),function(){"use strict";function e(t,a){var i=this;i.queueCampaign={},i.init=function(n){i.queueCampaign=n,t.cmHopper.get({limit:0,VoiceQueueId:n.id}).$promise.then(function(e){return i.total=e.count||0,t.cmHopper.get({limit:0,VoiceQueueId:n.id,active:!1,countbusyretry:0,countcongestionretry:0,countnoanswerretry:0,countnosuchnumberretry:0,countdropretry:0,countabandonedretry:0,countmachineretry:0,countagentrejectretry:0}).$promise}).then(function(e){return i.fresh=e.count||0,t.cmHopperFinal.get({limit:0,VoiceQueueId:n.id}).$promise}).then(function(e){i.closed=e.count||0}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["api","toasty"],angular.module("app.motiondialer").controller("QueueCampaignHopperStatisticsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.queueCampaign=n,d.crudPermissions=l,d.apiRoute="voiceQueue",d.getApi="getLists",d.addApi="addLists",d.removeApi="removeLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignlistaddController",e)}(),function(){"use strict";function e(e,n,a,i,s,t,o,r){var l=this;function d(){n.hide()}function c(e,n){var t=n.id;o.enqueue(function(){return i.voiceQueue.removeLists({id:e,ids:t}).$promise.then(function(){return i.voiceQueue.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){a.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:queueCampaign.RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}l.selected=[],l.items=t||[],l.loading=!1,l.closeDialog=d,l.exists=function(e,n){return-1<n.indexOf(e)},l.toggle=function(e,n){var t=n.indexOf(e);-1<t?n.splice(t,1):n.push(e)},l.isIndeterminate=function(){return 0!==l.selected.length&&l.selected.length!==l.items.length},l.isChecked=function(){return l.selected.length===l.items.length},l.toggleAll=function(){l.selected.length===l.items.length?l.selected=[]:(0===l.selected.length||0<l.selected.length)&&(l.selected=l.items.slice(0))},l.listSelected=function(){l.loading=!0,r(function(e,n){for(var t=0;t<l.selected.length;t+=1)c(s.id,l.selected[t]);var a;a=e,o.enqueue(function(){return a()})}).finally(function(){l.loading=!1,d()})}}e.$inject=["$scope","$mdDialog","toasty","api","queueCampaign","listsCampaign","Sequence","$q"],angular.module("app.motiondialer").controller("QueueCampaignresetlistController",e)}(),function(){"use strict";function e(e,i,a,s,n,t,o,r){var l=this;function d(){return i(function(t,n){return i(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:i(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),i(function(n,t){return s.voiceQueue.getTeams({id:l.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.queueCampaign=n,l.crudPermissions=r,l.penalty=0,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"penalty",labelAll:t.instant("MOTIONDIALER.ALL_TEAMS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_TEAMS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+l.penalty});var t=_.xorWith(l.startingSelectedItems,l.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):i(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceWith(l.selectedItems,l.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,i(function(e,n){_.isEmpty(t)?e():s.voiceQueue.removeTeams({id:l.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return a=n,i(function(e,n){if(!_.isEmpty(a)){var t=_.map(a,function(e){return{id:e.id,penalty:_.trim(e.penalty,"penalty ")}});return s.voiceQueue.addTeams({id:l.queueCampaign.id,teams:t}).$promise.then(function(){e()}).catch(function(e){n(e)})}e()});var a}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),a.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","$translate","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignteamaddController",e)}(),function(){"use strict";function e(t,e,i,s,a,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.queueCampaign=c||t.params.queueCampaign||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.clonedialog=function(e,n){i.show({controller:"QueueCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.listadddialog=function(e,n){i.show({controller:"QueueCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.blacklistadddialog=function(e,n){i.show({controller:"QueueCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.teamadddialog=function(e,n){i.show({controller:"QueueCampaignteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){i.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.resetlistdialog=function(n,t){r.voiceQueue.getLists({id:n.id,fields:"id,name",nolimit:!0}).$promise.then(function(a){if(_.isNil(a.rows)||_.isEmpty(a.rows))l.info({title:"Campaign Without Lists"});else if(1===a.rows.length){var e=i.confirm().title("Are you sure want to reset the list "+a.rows[0].name+" ?").htmlContent("<b>"+a.rows[0].name+"</b> will be reset.").ariaLabel("Reset List").targetEvent(t).ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,n,t;e=u.queueCampaign.id,n=a.rows[0],t=n.id,r.voiceQueue.removeLists({id:e,ids:t}).$promise.then(function(){return r.voiceQueue.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){l.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:queueCampaign.REMOVELIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}else i.show({controller:"QueueCampaignresetlistController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/resetlist/resetlist.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!1,locals:{queueCampaign:n,listsCampaign:a?a.rows:[]}})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})},u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.queues",{}):l.info({title:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.queues",{})}},u.alert=l.info,u.gotoQueueCampaigns=function(){t.go("app.motiondialer.queueCampaigns",{},{reload:"app.motiondialer.queueCampaigns"})},u.saveQueueCampaign=function(){r.voiceQueue.update({id:u.queueCampaign.id},u.queueCampaign).$promise.then(function(){l.success({title:"QueueCampaign updated!",msg:u.queueCampaign.name?u.queueCampaign.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MUSICONHOLDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:407}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.musiconholds,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.musiconholds,{name:u.queueCampaign.musiconhold})),t&&!_.some(n,["id",t.id])){var a=_.find(u.musiconholds,{id:t.id});a.canSelect=!1,n.push(a)}u.musiconholds=n}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true",defaultEntry:1}).$promise.then(function(e){u.musiconholds=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmusiconholds",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.trunks,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.trunks,{id:Number(u.queueCampaign.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.trunks,{id:t.id});a.canSelect=!1,n.push(a)}u.trunks=n})}else{var t=[],a=null;u.queueCampaign&&(a=_.find(u.trunks,{id:Number(u.queueCampaign.TrunkId)}));for(var i=0;i<u.trunks.length;i++)a&&u.trunks[i].id===a.id&&(u.trunks[i].canSelect=!1,t.push(u.trunks[i]));u.trunks=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.projects,{name:u.queueCampaign.dialQueueProject})),t&&!_.some(n,["id",t.id])){var a=_.find(u.projects,{id:t.id});a.canSelect=!1,n.push(a)}u.projects=n})}else{var t=[],a=null;u.queueCampaign&&(a=_.find(u.projects,{name:u.queueCampaign.dialQueueProject}));for(var i=0;i<u.projects.length;i++)a&&u.projects[i].id===a.id&&(u.projects[i].canSelect=!1,t.push(u.projects[i]));u.projects=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.interval,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.interval,{id:Number(u.queueCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.interval,{id:t.id});a.canSelect=!1,n.push(a)}u.interval=n})}else{var t=[],a=null;u.queueCampaign&&(a=_.find(u.interval,{id:Number(u.queueCampaign.IntervalId)}));for(var i=0;i<u.interval.length;i++)a&&u.interval[i].id===a.id&&(u.interval[i].canSelect=!1,t.push(u.interval[i]));u.interval=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.pauses=n})}else u.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","queueCampaign","userProfileSection"],angular.module("app.motiondialer").controller("QueueCampaignController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.queueCampaigns=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="queueCampaigns",f.listOrder="",f.listOrderAsc=null,f.selectedQueueCampaigns=[],f.query={fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,callAdditionalPhoneAfterMin,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,page:1},f.arraydialCheckDuplicateType=_.keyBy([{option:"ALWAYS",value:"'always'"},{option:"NEVER",value:"'never'"},{option:"ONLY_IF_OPEN",value:"'onlyIfOpen'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayautopause=_.keyBy([{option:"Yes",value:"'all'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayringinuse=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytimeoutrestart=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymonitor_format=_.keyBy([{option:"Inactive",value:"''"},{option:"wav",value:"'wav'"},{option:"wav49",value:"'wav49'"},{option:"gsm",value:"'gsm'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetinterfacevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueuevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueueentryvar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialOrderByScheduledAt=_.keyBy([{option:"DESC",value:"'DESC'"},{option:"ASC",value:"'ASC'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialMethod=_.keyBy([{option:"Progressive",value:"'progressive'"},{option:"PowerDialing",value:"'power'"},{option:"Predictive",value:"'predictive'"},{option:"Preview",value:"'preview'"},{option:"BookedProgressive",value:"'booked'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialPredictiveOptimization=_.keyBy([{option:"AgentBusyFactor",value:"'agentBusyFactor'"},{option:"DropRate",value:"'dropRate'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraystrategy=_.keyBy([{option:"Round Robin Memory",value:"'rrmemory'"},{option:"Round Robin",value:"'roundrobin'",ngIf:"vm.queueCampaign.dialMethod === 'booked'"},{option:"Least Recent",value:"'leastrecent'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Fewest Calls",value:"'fewestcalls'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Random",value:"'random'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Linear",value:"'linear'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Weight Random",value:"'wrandom'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.motiondialer.queueCampaigns.edit",{id:e.id,queueCampaign:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"QueueCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.listadddialog=function(e,n){i.show({controller:"QueueCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.blacklistadddialog=function(e,n){i.show({controller:"QueueCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.teamadddialog=function(e,n){i.show({controller:"QueueCampaignteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("queueCampaign")+"?").htmlContent("<b>"+(e.name||"queueCampaign")+"</b> will be deleted.").ariaLabel("delete queueCampaign").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.queues",{})}},f.success=E,f.getQueueCampaigns=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="QueueCampaigns",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditQueueCampaign=function(e,n){i.show({controller:"CreateOrEditQueueCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:n,queueCampaigns:f.queueCampaigns.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteQueueCampaign=y,f.exportSelectedQueueCampaigns=function(){var e=angular.copy(f.selectedQueueCampaigns);return f.selectedQueueCampaigns=[],e},f.deleteSelectedQueueCampaigns=function(e){var n=i.confirm().title("Are you sure want to delete the selected queueCampaigns?").htmlContent("<b>"+f.selectedQueueCampaigns.length+" selected</b> will be deleted.").ariaLabel("delete QueueCampaigns").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedQueueCampaigns.forEach(function(e){y(e)}),f.selectedQueueCampaigns=[]})},f.deselectQueueCampaigns=function(){f.selectedQueueCampaigns=[]},f.selectAllQueueCampaigns=function(){f.selectedQueueCampaigns=f.queueCampaigns.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(f.trunks,{id:e.resourceId})}),a=null;a=[],f.queueCampaigns.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(f.trunks,{id:e.id});n.canSelect=!1,t.push(n)}}),f.trunks=t})}else{var t=[],a=[];f.queueCampaigns.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)});for(var i=0;i<f.trunks.length;i++){_.some(a,{id:f.trunks[i].id})&&(f.trunks[i].canSelect=!1,t.push(f.trunks[i]))}f.trunks=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.interval,{id:e.resourceId})}),t=null;if(f.queueCampaign&&(t=_.find(f.interval,{id:Number(f.queueCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.interval,{id:t.id});a.canSelect=!1,n.push(a)}f.interval=n})}else{var t=[],a=null;f.queueCampaign&&(a=_.find(f.interval,{id:Number(f.queueCampaign.IntervalId)}));for(var i=0;i<f.interval.length;i++)a&&f.interval[i].id===a.id&&(f.interval[i].canSelect=!1,t.push(f.interval[i]));f.interval=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.queueCampaigns=e||{count:0,rows:[]}}function y(e){m.voiceQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.queueCampaigns.rows,{id:e.id}),f.queueCampaigns.count-=1,f.queueCampaigns.rows.length||f.getQueueCampaigns(),p.success({title:_.startCase("QueueCampaign")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getQueueCampaigns())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","queueCampaigns","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.motiondialer").controller("QueueCampaignsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(){return[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",options:g.agents.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_CAMPAIGN",options:g.queues.rows,ngValue:"name"}]}function h(){return g.refresh=!1,0===g.queues.count?f(null):(g.query.queue=1===g.queues.count?g.queues.rows[0].name:g.query.queue,void 0===g.query.queue&&(g.query.queue=_.map(g.queues.rows,"name")),_.isEmpty(g.query.queue)?f(null):(g.query.offset=(g.query.page-1)*g.query.limit,i.localStorage.setItem("motion2.realtime.abandoned.bull.abandonedCalls:"+g.currentUser.id,JSON.stringify({query:_.omit(g.query,"queue")})),void(g.promise=o.voiceQueueReport.getVoiceQueuesReport(g.query,f).$promise)))}function f(e){g.abandonedCalls=e||{count:0,rows:[]},!1,g.refresh=!0}g.currentUser=d.getCurrentUser(),g.agents=u||[],g.dispositions=p.rows,g.abandonedCalls={count:0,rows:[]},g.showTooltip=!1,g.refresh=!0,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=d.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition",type:"outbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},g.getAbandonedCalls=h,g.refreshAbandonedCalls=function(){g.showTooltip=!1,h()},g.assignTo=function(e,n){e&&o.voiceQueueReport.update({id:e.id,lastAssignedTo:n?n.name:null,assigned:!!n}).$promise.catch(function(e){console.log(e)})},g.dispose=function(t){n.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(a.body),targetEvent:t,locals:{dispositions:g.dispositions,call:t}}).then(function(e){if(e){var n={id:t.id,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null};o.voiceQueueReport.update(n).$promise.catch(function(e){console.log(e)})}})},g.onSaveVoiceQueueReport=function(e){e&&g.queuesMap&&"outbound"===queue.type&&g.queuesMap[e.queue]&&(g.showTooltip=!0)},g.onUpdateVoiceQueueReport=function(e){if(e){var n=_.findIndex(g.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(g.abandonedCalls.rows[n],e)}},c.onWithoutApply("voiceQueueReport:save",g.onSaveVoiceQueueReport),c.on("voiceQueueReport:update",g.onUpdateVoiceQueueReport),function(){var e=i.localStorage.getItem("motion2.realtime.abandoned.bull.abandonedCalls:"+g.currentUser.id);if(e)(e=JSON.parse(e))&&e.query&&(g.query=_.merge(e.query,_.omit(g.query,["sort","limit","page"])),g.query=_.omit(g.query,"filter"));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};g.query.createdAt=n}d.hasRole("admin")?o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){g.quickFilters=v(),h()}):o.userProfile.getResources({id:g.currentUser.userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){g.quickFilters=v(),h()})}();var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?t(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())}),e.$on("$destroy",function(){c.removeAllListeners("voiceQueueReport:save"),c.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","userProfile","userProfileSection","Auth","socket","toasty","agents","dispositions"],angular.module("app.motiondialer").controller("AbandonedCallsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o,r,l,d,c,m){var u=this,p=["name","active","limitCalls","message","originated","IntervalId","SquareProjectId","Trunk","TrunkId","ivrAnswerCallsDay","dialQueueProject","ivrTotalCallsDays","description"];function g(){_.forIn(u.campaigns,function(e,n){u.rpcCampaigns[n]&&_.merge(e,_.pick(u.rpcCampaigns[n],p))})}u.currentUser=m.getCurrentUser(),u.count=o.count,u.campaigns=o?_.keyBy(o.rows?o.rows:[],"id"):{},u.rpcCampaigns=s?_.keyBy(s.rows?s.rows:[],"id"):{},u.userProfile=d,u.userProfileSection=c&&1==c.count?c.rows[0]:null,u.crudPermissions=m.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={sort:"-updatedAt",limit:10,page:1},u.success=f,u.getCampaigns=function(){u.query.offset=(u.query.page-1)*u.query.limit,m.hasRole("admin")?u.promise=r.campaign.get(u.query,f).$promise:(u.query.id=u.userProfile.id,u.query.section="IvrCampaigns",u.promise=r.userProfile.getResources(u.query,f).$promise)},u.onSave=function(e){u.campaigns[e.id]&&(_.merge(u.campaigns[e.id],_.pick(e,p)),_.merge(u.rpcCampaigns[e.id],_.pick(e,p)))},u.$onInit=g,u.createOrEditIvrCampaign=function(e,n){a.show({controller:"CreateOrEditIvrCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:n,ivrCampaigns:_.values(u.campaigns),license:null,setting:null,crudPermissions:u.crudPermissions}})},l.onWithoutApply("campaign:save",u.onSave),u.interval=n(function(){},999);var v=!0,h=1;function f(e){u.count=e.count,u.campaigns=e?_.keyBy(e.rows?e.rows:[],"id"):{},g()}e.$watch("vm.query.filter",function(e,n){v?t(function(){v=!1}):(n||(h=u.query.page),e!==n&&(u.query.page=1),e||(u.query.page=h),u.getCampaigns())}),e.$on("$destroy",function(){l.removeAllListeners("campaign:save"),u.interval&&n.cancel(u.interval)})}e.$inject=["$scope","$timeout","$mdDialog","$document","$interval","rpcCampaigns","campaigns","api","socket","userProfile","userProfileSection","Auth"],angular.module("app.motiondialer").controller("IvrCampaignsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,n,a,o,t,i,s,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.queues=t?_.keyBy(t.rows?t.rows:[],"name"):{},p.rpcVoiceQueuesChannelsTmp=i?_.keyBy(i.rows?_.filter(i.rows,{type:"outbound"}):[],"uniqueid"):{},p.rpcVoiceQueuesChannels={},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.queryChannels={limit:10,page:1},p.getAvailableAgents=function(){p.availableAgents=null,s.rpc.getAgents().$promise.then(function(e){for(var n=[],t=e?e.rows:[],a=_.filter(t,{online:!0,voicePause:!1,voiceStatus:"idle"}),i=0;i<a.length;i++){var s=_.find(o.rows,["id",a[i].id]);s&&n.push(s)}p.availableAgents=n}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.getSize=function(e){return _.size(e)},p.$onInit=function(){_.forIn(p.rpcVoiceQueuesChannelsTmp,function(e,n){_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[n]=e)})},p.onSave=function(e){"outbound"===e.type&&_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[e.uniqueid]=e)},p.onRemove=function(e){p.rpcVoiceQueuesChannels[e.uniqueid]&&delete p.rpcVoiceQueuesChannels[e.uniqueid]},p.hangup=function(n){return s.rpc.getVoiceQueuesChannelHangup({uniqueid:n}).$promise.then(function(e){d.success({title:"Channel "+n+" properly hangup!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToAgent=function(n,e,t){return s.rpc.getVoiceQueuesChannelRedirect({uniqueid:n,exten:e,context:t}).$promise.then(function(e){d.success({title:"Channel "+n+" properly redirect!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToNumber=function(e,n){var t=a.prompt().title("Which number do you want transfer the call to?").placeholder("Number").targetEvent(e).ok("Ok").cancel("Cancel");return a.show(t).then(function(e){return s.rpc.getVoiceQueuesChannelRedirect({uniqueid:n,exten:e}).$promise}).then(function(e){d.success({title:"Channel "+n+" properly redirect!",msg:e.message||""})}).catch(function(e){e&&d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},r.on("voice_queue_channel:save",p.onSave),r.on("voice_queue_channel:remove",p.onRemove),e.$on("$destroy",function(){r.removeAllListeners("voice_queue_channel:save"),r.removeAllListeners("voice_queue_channel:remove")})}e.$inject=["$scope","$timeout","$mdDialog","agents","queues","rpcVoiceQueuesChannels","api","socket","helperClasses","toasty","userProfile","userProfileSection","Auth"],angular.module("app.motiondialer").controller("QueueCallsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["total","answered","sumHoldTime","sumDuration","sumBillable","outboundNoAnswerCallsDay","outboundBusyCallsDay","outboundCongestionCallsDay","outboundNoSuchCallsDay","outboundUnknownCallsDay","outboundDropCallsDayTimeout","outboundDropCallsDayCallersExit","outboundBlacklistCallsDay","outboundOriginateFailureCallsDay","outboundAnswerAgiCallsDay","outboundReCallsDay","outboundRejectCallsDay"];function u(){_.forIn(c.queues,function(e,n){c.rpcQueues[n]&&_.merge(e,_.pick(c.rpcQueues[n],m))})}c.count=a.count,c.queues=a?_.keyBy(a.rows?a.rows:[],"id"):{},c.rpcQueues=i?_.keyBy(i.rows?i.rows:[],"id"):{},c.userProfile=r,c.userProfileSection=l&&1==l.count?l.rows[0]:null,c.crudPermissions=d.parseCrudPermissions(c.userProfileSection?c.userProfileSection.crudPermissions:null),d.hasRole("admin")?c.query={type:"outbound",fields:"id,name",sort:"-updatedAt",limit:10,page:1}:c.query={id:d.getCurrentUser().id,channel:"voice",type:"outbound",fields:"id,name",sort:"-updatedAt",limit:10,page:1},c.success=v,c.getQueues=function(){c.query.offset=(c.query.page-1)*c.query.limit,d.hasRole("admin")?c.promise=s.voiceQueue.get(c.query,v).$promise:(c.query.id=c.userProfile.id,c.query.section="QueueCampaigns",c.promise=s.userProfile.getResources(c.query,v).$promise)},c.onSave=function(e){c.queues[e.id]&&_.merge(c.queues[e.id],_.pick(e,m))},c.$onInit=u,o.onWithoutApply("voice_queue:save",c.onSave),c.interval=n(function(){},999);var p=!0,g=1;function v(e){c.count=e.count,c.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},u()}e.$watch("vm.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=g),c.getQueues())}),e.$on("$destroy",function(){o.removeAllListeners("voice_queue:save"),c.interval&&n.cancel(c.interval)})}e.$inject=["$scope","$timeout","$interval","queues","rpcQueues","api","socket","userProfile","userProfileSection","Auth"],angular.module("app.motiondialer").controller("QueueParamsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"QueueCampaigns":void 0,channel:"voice",type:"outbound",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("VOICE.VOICEQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditQueueCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:n,queueCampaigns:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:n,queueCampaigns:u.queues.rows,realtime:!0,crudPermissions:u.crudPermissions}})},u.showPredictiveQueueCampaignInfo=function(e,n){t.show({controller:"PredictiveQueueCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/realtime/queues/predictive/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:n}})},r.onWithoutApply("voice_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&m.updateVoiceQueue(e,n)}),r.on("userVoiceQueueRt:save",function(e){var n=_.find(u.queues.rows,["id",e.MotionDialerQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("user:agentconnect",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);if(n){if(!t.agentconnected)return;t.queue?n.talking=!0:n.busy=!0,m.updateBusyCounter(e)}})}),r.on("user:agentcomplete",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&(n.talking?n.talking=!1:n.busy&&(n.busy=!1),m.updateBusyCounter(e))})}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"voice")})}),e.$on("$destroy",function(){r.removeAllListeners("voice_queue:save"),r.removeAllListeners("userVoiceQueueRt:save"),r.removeAllListeners("user:agentconnect"),r.removeAllListeners("user:agentcomplete"),r.removeAllListeners("user:update"),p&&n.cancel(p)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.motiondialer").controller("QueuesMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,n,t){this.queueCampaign=t,this.addMinutes=function(e,n){return moment(e).add("m",n).format("HH:mm:ss")},this.setFormatTime=function(e){return moment(e).format("HH:mm:ss")},this.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$interval","queueCampaign"],angular.module("app.motiondialer").controller("PredictiveQueueCampaignDialogController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.motiondialer.realtime.agents":this.selectedTab=0;break;case"app.motiondialer.realtime.queues":this.selectedTab=1;break;case"app.motiondialer.realtime.queue_calls":this.selectedTab=2;break;case"app.motiondialer.realtime.abandonedcalls":this.selectedTab=3;break;case"app.motiondialer.realtime.queue_params":this.selectedTab=4;break;case"app.motiondialer.realtime.ivr_campaigns":this.selectedTab=5;break;default:this.selectedTab=0,t.go("app.motiondialer.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.motiondialer.realtime.agents");break;case 1:t.go("app.motiondialer.realtime.queues");break;case 2:t.go("app.motiondialer.realtime.queue_calls");break;case 3:t.go("app.motiondialer.realtime.abandonedcalls");break;case 4:t.go("app.motiondialer.realtime.queue_params");break;case 5:t.go("app.motiondialer.realtime.ivr_campaigns");break;default:t.go("app.motiondialer.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.motiondialer").controller("MotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="OPENCHANNEL.EDIT_OPENCHANNELACCOUNT",g.openchannelAccount=angular.copy(l),g.openchannelAccounts=r,g.newOpenchannelAccount=!1,g.openchannelAccount||(g.openchannelAccount={waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="OPENCHANNEL.NEW_OPENCHANNELACCOUNT",g.newOpenchannelAccount=!0),n.params.id&&(g.openchannelAccount.OpenchannelAccountId=n.params.id),g.addNewOpenchannelAccount=function(){g.errors=[],d.openchannelAccount.save(g.openchannelAccount).$promise.then(function(e){g.openchannelAccounts.unshift(e.toJSON()),o.success({title:"OpenchannelAccount properly created",msg:g.openchannelAccount.name?g.openchannelAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOpenchannelAccount=function(){g.errors=[],d.openchannelAccount.update({id:g.openchannelAccount.id},g.openchannelAccount).$promise.then(function(e){var n=_.find(g.openchannelAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"OpenchannelAccount properly saved!",msg:g.openchannelAccount.name?g.openchannelAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOpenchannelAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The openchannelAccount will be deleted.").ariaLabel("Delete OpenchannelAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.openchannelAccount.delete({id:g.openchannelAccount.id}).$promise.then(function(){_.remove(g.openchannelAccounts,{id:g.openchannelAccount.id}),o.success({title:"OpenchannelAccount properly deleted!",msg:(g.openchannelAccount.name||"openchannelAccount")+" has been deleted!"}),v(g.openchannelAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.openchannelAccount&&(t=_.find(g.lists,{id:Number(g.openchannelAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.openchannelAccount&&(a=_.find(g.lists,{id:Number(g.openchannelAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","openchannelAccounts","openchannelAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.openchannelAccountApps.rows.length){var t=r.openchannelAccountApps.rows[n]?r.openchannelAccountApps.rows[n]:r.openchannelAccountApps.rows[0];i.show({controller:"EditOpenchannelAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccountApp:t,openchannelAccount:r.openchannelAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.openchannelAccountApps.rows[n]=e:r.openchannelAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.openchannelAccountApps.rows.length;t++,0){var a=r.openchannelAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.openchannelAccount.context,a.exten=r.openchannelAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.openchannelAccount.addApplications({id:r.openchannelAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.openchannelAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.openchannelAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.openchannelAccount={},r.openchannelAccountApps={count:0,rows:[]},r.selectedOpenchannelAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:4,help:!0}]},{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"OpenchannelQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"openchannelQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:801}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,defaultValue:300,required:!0,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",role:"agent",nolimit:!0},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.openchannelAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getOpenchannelAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.openchannelAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getOpenchannelAccountApps=function(){r.promise=o.openchannelAccount.getApplications(r.query,t).$promise},r.editOpenchannelAccountApp=n,r.editInterval=function(e,n){if(r.openchannelAccountApps.rows.length){var t=r.openchannelAccountApps.rows[n]?r.openchannelAccountApps.rows[n]:r.openchannelAccountApps.rows[0];i.show({controller:"EditOpenchannelAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteOpenchannelAccountApp=function(e){_.remove(r.openchannelAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedOpenchannelAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedOpenchannelAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedOpenchannelAccountApps.forEach(function(e){_.remove(r.openchannelAccountApps.rows,{id:e.id})}),r.selectedOpenchannelAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.openchannelAccount.getAgents({id:c.openchannelAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserOpenchannelAccount?"penalty "+e.UserOpenchannelAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.openchannelAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.openchannelAccount.removeAgents({id:c.openchannelAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.openchannelAccount.addAgents({id:c.openchannelAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("OPENCHANNEL.ALL_AGENTS"),labelSelected:r.instant("OPENCHANNEL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","openchannelAccount","openchannelAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.openchannel").controller("OpenchannelAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditOpenchannelAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("openChannel")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.openchannelQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.openchannelQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:801}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"openchannelAccount",action:"getDispositions",field:"name",params:{id:m.openchannelAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.openchannelAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.openchannelAccountInteractions.rows.length;n+=1){var t=m.openchannelAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.openchannelInteraction.get(m.query,p).$promise}function v(e){d.openchannelInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.openchannelAccountInteractions.rows,{id:e.id}),m.openchannelAccountInteractions.count-=1,m.openchannelAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETopenchannelAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.from?e.contactName=e.from:e.Contact?e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""):e.contactName=i.instant("OPENCHANNEL.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.openchannelAccount={},m.openchannelAccountInteractions={count:0,rows:[]},m.selectedOpenchannelAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.openchannelAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.OpenchannelAccountId=m.openchannelAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.openchannelInteractionDownload=function(s,e,n){return d.openchannelInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="openchannel-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getOpenchannelAccountInteractions=g,m.createOrEditOpenchannelAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:m.openchannelAccount,interaction:n,interactions:m.openchannelAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spyopenchannelInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"openchannel",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"openchannel.openchannelAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||OpenchannelAccountId:=$eq["+m.openchannelAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedOpenchannelAccountInteractions=function(){var e=angular.copy(m.selectedOpenchannelAccountInteractions);return m.selectedOpenchannelAccountInteractions=[],e},m.deleteOpenchannelAccountInteraction=v,m.deleteSelectedOpenchannelAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedOpenchannelAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedOpenchannelAccountInteractions.forEach(function(e){v(e)}),m.selectedOpenchannelAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.openchannelAccountOpenchannelCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.openchannelAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.openchannelAccountOpenchannelCannedAnswers.rows,{id:e.id}),m.openchannelAccountOpenchannelCannedAnswers.count-=1,m.openchannelAccountOpenchannelCannedAnswers.rows.length||p(),l.success({title:"OpenchannelCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETopenchannelAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.openchannelAccount={},m.openchannelAccountOpenchannelCannedAnswers={count:0,rows:[]},m.selectedOpenchannelAccountOpenchannelCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.openchannelAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.OpenchannelAccountId=m.openchannelAccount.id,m.query.id=m.openchannelAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the openchannelCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("openchannelCannedAnswer #")+e.id||"openchannelCannedAnswer")+"</b> will be deleted.").ariaLabel("delete openchannelCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getOpenchannelAccountOpenchannelCannedAnswers=p,m.createOrEditOpenchannelAccountOpenchannelCannedAnswer=function(e,n){o.show({controller:"CreateOrEditOpenchannelCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/openchannelCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:m.openchannelAccount,openchannelCannedAnswer:n,openchannelCannedAnswers:m.openchannelAccountOpenchannelCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedOpenchannelAccountOpenchannelCannedAnswers=function(){var e=angular.copy(m.selectedOpenchannelAccountOpenchannelCannedAnswers);return m.selectedOpenchannelAccountOpenchannelCannedAnswers=[],e},m.deleteOpenchannelAccountOpenchannelCannedAnswer=g,m.deleteSelectedOpenchannelAccountOpenchannelCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected openchannelCannedAnswers?").htmlContent("<b>"+m.selectedOpenchannelAccountOpenchannelCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete openchannelCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedOpenchannelAccountOpenchannelCannedAnswers.forEach(function(e){g(e)}),m.selectedOpenchannelAccountOpenchannelCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountOpenchannelCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="OPENCHANNEL.EDIT_OPENCHANNELCANNEDANSWER",g.openchannelCannedAnswer=angular.copy(l),g.openchannelCannedAnswers=r,g.newOpenchannelCannedAnswer=!1,g.openchannelCannedAnswer||(g.openchannelCannedAnswer={},g.title="OPENCHANNEL.NEW_OPENCHANNELCANNEDANSWER",g.newOpenchannelCannedAnswer=!0),n.params.id&&(g.openchannelCannedAnswer.OpenchannelAccountId=n.params.id),g.addNewOpenchannelCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.openchannelCannedAnswer).$promise.then(function(e){g.openchannelCannedAnswers.unshift(e.toJSON()),o.success({title:"OpenchannelCannedAnswer properly created",msg:g.openchannelCannedAnswer.name?g.openchannelCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOpenchannelCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.openchannelCannedAnswer.id},g.openchannelCannedAnswer).$promise.then(function(e){var n=_.find(g.openchannelCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"OpenchannelCannedAnswer properly saved!",msg:g.openchannelCannedAnswer.name?g.openchannelCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOpenchannelCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The openchannelCannedAnswer will be deleted.").ariaLabel("Delete OpenchannelCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.openchannelCannedAnswer.id}).$promise.then(function(){_.remove(g.openchannelCannedAnswers,{id:g.openchannelCannedAnswer.id}),o.success({title:"OpenchannelCannedAnswer properly deleted!",msg:(g.openchannelCannedAnswer.name||"openchannelCannedAnswer")+" has been deleted!"}),v(g.openchannelCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","openchannelCannedAnswers","openchannelCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.openchannelAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.openchannelAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.OpenchannelAccountId=m.openchannelAccount.id,m.query.id=m.openchannelAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.openchannelAccount.id,field:"OpenchannelAccountId",route:"openchannelAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountDispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.openchannelAccount=c||e.params.openchannelAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.agentadddialog=function(e,n){t.show({controller:"OpenchannelAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelAccount:e,openchannelAccounts:p.openchannelAccounts?p.openchannelAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoOpenchannelAccounts=function(){e.go("app.openchannel.openchannelAccounts",{},{reload:"app.openchannel.openchannelAccounts"})},p.saveOpenchannelAccount=function(){r.openchannelAccount.update({id:p.openchannelAccount.id},p.openchannelAccount).$promise.then(function(){l.success({title:"OpenchannelAccount updated!",msg:p.openchannelAccount.name?p.openchannelAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.openchannelAccount&&(t=_.find(p.lists,{id:Number(p.openchannelAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.openchannelAccount&&(a=_.find(p.lists,{id:Number(p.openchannelAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.cmContact.describe({id:p.openchannelAccount.ListId}).$promise.then(function(e){p.fields=[];e=_.values(e.toJSON());for(var n=["id","createdAt","updatedAt","deletedAt","scheduledat","ListId","CompanyId"],t=0;t<e.length;t++)_.includes(n,e[t].columnName)||p.fields.push(e[t])}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FIELDS",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","openchannelAccount","userProfile","userProfileSection"],angular.module("app.openchannel").controller("OpenchannelAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.openchannelAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="openchannelAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedOpenchannelAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.openchannel.openchannelAccounts.edit",{id:e.id,openchannelAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.openchannel.openchannelAccounts.edit",{id:e.id,tab:5})},f.agentadddialog=function(e,n){i.show({controller:"OpenchannelAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelAccount:e,openchannelAccounts:f.openchannelAccounts?f.openchannelAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("openchannelAccount")+"?").htmlContent("<b>"+(e.name||"openchannelAccount")+"</b> will be deleted.").ariaLabel("delete openchannelAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getOpenchannelAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.openchannelAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="OpenchannelAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditOpenchannelAccount=function(e,n){i.show({controller:"CreateOrEditOpenchannelAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:n,openchannelAccounts:f.openchannelAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteOpenchannelAccount=y,f.exportSelectedOpenchannelAccounts=function(){var e=angular.copy(f.selectedOpenchannelAccounts);return f.selectedOpenchannelAccounts=[],e},f.deleteSelectedOpenchannelAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected openchannelAccounts?").htmlContent("<b>"+f.selectedOpenchannelAccounts.length+" selected</b> will be deleted.").ariaLabel("delete OpenchannelAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedOpenchannelAccounts.forEach(function(e){y(e)}),f.selectedOpenchannelAccounts=[]})},f.deselectOpenchannelAccounts=function(){f.selectedOpenchannelAccounts=[]},f.selectAllOpenchannelAccounts=function(){f.selectedOpenchannelAccounts=f.openchannelAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.openchannelAccount&&(t=_.find(f.lists,{id:Number(f.openchannelAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.openchannelAccount&&(a=_.find(f.lists,{id:Number(f.openchannelAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.openchannelAccounts=e||{count:0,rows:[]}}function y(e){m.openchannelAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.openchannelAccounts.rows,{id:e.id}),f.openchannelAccounts.count-=1,f.openchannelAccounts.rows.length||f.getOpenchannelAccounts(),p.success({title:_.startCase("OpenchannelAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEopenchannelAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getOpenchannelAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","openchannelAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.openchannel").controller("OpenchannelAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="OPENCHANNEL.EDIT_OPENCHANNELQUEUE",g.openchannelQueue=angular.copy(l),g.openchannelQueues=r,g.newOpenchannelQueue=!1,g.openchannelQueue||(g.openchannelQueue={strategy:"beepall",timeout:10},g.title="OPENCHANNEL.NEW_OPENCHANNELQUEUE",g.newOpenchannelQueue=!0),g.addNewOpenchannelQueue=function(){g.errors=[],d.openchannelQueue.save(g.openchannelQueue).$promise.then(function(e){g.openchannelQueues.unshift(e.toJSON()),o.success({title:"OpenchannelQueue properly created",msg:g.openchannelQueue.name?g.openchannelQueue.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOpenchannelQueue=function(){g.errors=[],d.openchannelQueue.update({id:g.openchannelQueue.id},g.openchannelQueue).$promise.then(function(e){var n=_.find(g.openchannelQueues,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"OpenchannelQueue properly saved!",msg:g.openchannelQueue.name?g.openchannelQueue.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOpenchannelQueue=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The openchannelQueue will be deleted.").ariaLabel("Delete OpenchannelQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.openchannelQueue.delete({id:g.openchannelQueue.id}).$promise.then(function(){_.remove(g.openchannelQueues,{id:g.openchannelQueue.id}),o.success({title:"OpenchannelQueue properly deleted!",msg:(g.openchannelQueue.name||"openchannelQueue")+" has been deleted!"}),v(g.openchannelQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","openchannelQueues","openchannelQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.openchannelQueue.getAgents({id:c.openchannelQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserOpenchannelQueue?"penalty "+e.UserOpenchannelQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.openchannelQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.removeAgents({id:c.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.addAgents({id:c.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("OPENCHANNEL.ALL_AGENTS"),labelSelected:r.instant("OPENCHANNEL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","openchannelQueue","openchannelQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.openchannel").controller("OpenchannelQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.openchannelQueue.getTeams({id:l.openchannelQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.openchannelQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("OPENCHANNEL.ALL_TEAMS"),labelSelected:t.instant("OPENCHANNEL.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.removeTeams({id:l.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.addTeams({id:l.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","openchannelQueue","$translate","Auth","crudPermissions"],angular.module("app.openchannel").controller("OpenchannelQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.openchannelQueue=c||e.params.openchannelQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"OpenchannelQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:u.openchannelQueues?u.openchannelQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:u.openchannelQueues?u.openchannelQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoOpenchannelQueues=function(){e.go("app.openchannel.openchannelQueues",{},{reload:"app.openchannel.openchannelQueues"})},u.saveOpenchannelQueue=function(){r.openchannelQueue.update({id:u.openchannelQueue.id},u.openchannelQueue).$promise.then(function(){l.success({title:"OpenchannelQueue updated!",msg:u.openchannelQueue.name?u.openchannelQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","openchannelQueue","userProfileSection"],angular.module("app.openchannel").controller("OpenchannelQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.openchannelQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="openchannelQueues",f.listOrder="",f.listOrderAsc=null,f.selectedOpenchannelQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"openchannel",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.openchannel.openchannelQueues.edit",{id:e.id,openchannelQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"OpenchannelQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:f.openchannelQueues?f.openchannelQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:f.openchannelQueues?f.openchannelQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("openchannelQueue")+"?").htmlContent("<b>"+(e.name||"openchannelQueue")+"</b> will be deleted.").ariaLabel("delete openchannelQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:810}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.openchannel.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.openchannel.realtime.queues",{})}},f.success=E,f.getOpenchannelQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.openchannelQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="OpenchannelQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditOpenchannelQueue=function(e,n){i.show({controller:"CreateOrEditOpenchannelQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelQueue:n,openchannelQueues:f.openchannelQueues.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteOpenchannelQueue=y,f.exportSelectedOpenchannelQueues=function(){var e=angular.copy(f.selectedOpenchannelQueues);return f.selectedOpenchannelQueues=[],e},f.deleteSelectedOpenchannelQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected openchannelQueues?").htmlContent("<b>"+f.selectedOpenchannelQueues.length+" selected</b> will be deleted.").ariaLabel("delete OpenchannelQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedOpenchannelQueues.forEach(function(e){y(e)}),f.selectedOpenchannelQueues=[]})},f.deselectOpenchannelQueues=function(){f.selectedOpenchannelQueues=[]},f.selectAllOpenchannelQueues=function(){f.selectedOpenchannelQueues=f.openchannelQueues.rows};var b=!0,A=1;function E(e){f.openchannelQueues=e||{count:0,rows:[]}}function y(e){m.openchannelQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.openchannelQueues.rows,{id:e.id}),f.openchannelQueues.count-=1,f.openchannelQueues.rows.length||f.getOpenchannelQueues(),p.success({title:_.startCase("OpenchannelQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEopenchannelQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEopenchannelQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getOpenchannelQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","openchannelQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.openchannel").controller("OpenchannelQueuesController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=["loggedIn","available","waiting","paused"],g=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"OpenchannelQueues":void 0,channel:"openchannel",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("OPENCHANNEL.OPENCHANNELQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditOpenchannelQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelQueue:n,openchannelQueues:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelQueue:n,openchannelQueues:u.queues.rows,realtime:!1,crudPermissions:u.crudPermissions}})},r.on("openchannel_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,p))}),r.on("userOpenchannelQueue:save",function(e){var n=_.find(u.queues.rows,["id",e.OpenchannelQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("userOpenchannelQueue:remove",function(e){var n=_.find(u.queues.rows,["id",e.OpenchannelQueueId]);n&&(0<n.loggedInDb&&n.loggedInDb--,_.remove(n.agents,["id",e.UserId]))}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"openchannel")})}),e.$on("$destroy",function(){r.removeAllListeners("openchannel_queue:save"),r.removeAllListeners("userOpenchannelQueue:remove"),r.removeAllListeners("userOpenchannelQueue:save"),r.removeAllListeners("user:update"),g&&n.cancel(g)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.openchannel").controller("QueuesOpenchannelRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.openchannel.realtime.agents":this.selectedTab=0;break;case"app.openchannel.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.openchannel.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.openchannel.realtime.agents");break;case 1:t.go("app.openchannel.realtime.queues");break;default:t.go("app.openchannel.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.openchannel").controller("OpenchannelRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;o.currentUser=s.getCurrentUser(),o.plugin={},o.getTrustedURL=function(){return t.trustAsResourceUrl(o.plugin.adminUrl)},a.plugin.get({id:e.params.id}).$promise.then(function(e){if(e)return o.plugin=e,a.plugin.get({id:o.plugin.id}).$promise}).catch(function(e){o.plugin=void 0})}e.$inject=["$state","$scope","$sce","api","socket","Auth"],angular.module("app.plugins.plugin").controller("PluginController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this,h=t(function(){},999);function f(){v.agents.rows.forEach(function(e){g.setAgentStatusDisplayValue(e)})}function b(){v.query.offset=(v.query.page-1)*v.query.limit,v.promise=l.realtime.getAgents(v.query).$promise.then(function(e){v.agents=e,f()}).catch(function(e){c.error({title:s.instant("VOICE.AGENTS"),msg:e.status?JSON.stringify(e.data):e.toString()})})}function A(){b()}function E(e){_.remove(v.agents.rows,["id",e.UserId])}function y(e){_.remove(v.agents.rows,["id",e.id])}v.currentUser=u.getCurrentUser(),v.channel=n.params.channel,v.queueType=n.params.direction,v.agents=o,v.pauses=r||{count:0,rows:[]},v.license=p,v.userProfileSection=m&&1==m.count?m.rows[0]:null,v.crudPermissions=u.parseCrudPermissions(v.userProfileSection?v.userProfileSection.crudPermissions:null),v.query={limit:10,page:1,sort:"fullname",globalStatusFilter:"",pauseTypeFilter:"",globalQueueFilter:[],channel:v.channel},v.getAgents=b,v.logout=function(e){return l.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){y(e),c.success({title:"Agent logout",msg:e.fullname+"  properly logout"})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:s.instant("VOICE.LOGOUT"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.addQueue=function(e,n){a.show({controller:"AgentQueueAddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,channel:v.channel,direction:v.queueType,crudPermissions:v.crudPermissions}})},v.pause=function(e,n){return l.user.pause({id:e.id,type:n}).$promise.catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:s.instant("VOICE.PAUSE"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.unpause=function(e){return l.user.unpause({id:e.id}).$promise.catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:s.instant("VOICE.UNPAUSE"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.manageScreenRecording=function(e,n){return l.user.update({id:e.id},{screenrecording:n}).$promise.catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:s.instant("VOICE.SCREENRECORDING"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.clearSelection=function(){v.query.globalQueueFilter=[]},v.selectAll=function(){_.forEach(v.queues.rows,function(e){v.query.globalQueueFilter.push(e.name)})},v.getQueuesByChannel=function(){if(v.queues&&0<v.queues.count)return;var e={type:v.queueType||"inbound",fields:"id,name",sort:"name",nolimit:"true"},n=v.channel+"Queue";return l.getResourcesByRole(v.currentUser,n,e,null).then(function(e){v.queues=e}).catch(function(e){c.error({title:s.instant("VOICE.QUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},d.on("user:save",function(e){var n=_.find(v.agents.rows,["id",e.id]);n?(_.merge(n,e),n.globalStatus=g.getAgentStatus(n),g.setAgentStatusDisplayValue(n),(0<v.query.globalQueueFilter.length||!_.isEmpty(v.query.globalStatusFilter))&&b()):e.online&&b()}),d.on("user:update",function(e){var n=_.find(v.agents.rows,["id",e.id]);if(n){if(!1===e.online)return y(n);b()}else e.online&&b()}),d.on("user:agentconnect",function(e){var n=_.find(v.agents.rows,["id",e.id]);if(n){if(!e.agentconnected)return;_.merge(n,_.pick(e,["queue","destconnectedlinenum","routealias"]))}(0<v.query.globalQueueFilter.length||!_.isEmpty(v.query.globalStatusFilter))&&b()}),d.on("user:agentcomplete",function(e){if("ATTENDED"===e.transfer)return;var n=_.find(v.agents.rows,["id",e.id]);n&&(delete n.queue,delete n.destconnectedlinenum,delete n.routealias);(0<v.query.globalQueueFilter.length||!_.isEmpty(v.query.globalStatusFilter))&&b()}),d.on("userVoiceQueue:save",A),d.on("userVoiceQueue:remove",E),d.on("userChatQueue:save",A),d.on("userChatQueue:remove",E),d.on("userSmsQueue:save",A),d.on("userSmsQueue:remove",E),d.on("userMailQueue:save",A),d.on("userMailQueue:remove",E),d.on("userFaxQueue:save",A),d.on("userFaxQueue:remove",E),d.on("userOpenchannelQueue:save",A),d.on("userOpenchannelQueue:remove",E),d.on("userWhatsappQueue:save",A),d.on("userWhatsappQueue:remove",E),f(),e.$on("$destroy",function(){d.removeAllListeners("user:save"),d.removeAllListeners("user:update"),d.removeAllListeners("user:agentconnect"),d.removeAllListeners("user:agentcomplete"),d.removeAllListeners("userVoiceQueue:save"),d.removeAllListeners("userVoiceQueue:remove"),d.removeAllListeners("userChatQueue:save"),d.removeAllListeners("userChatQueue:remove"),d.removeAllListeners("userSmsQueue:save"),d.removeAllListeners("userSmsQueue:remove"),d.removeAllListeners("userMailQueue:save"),d.removeAllListeners("userMailQueue:remove"),d.removeAllListeners("userFaxQueue:save"),d.removeAllListeners("userFaxQueue:remove"),d.removeAllListeners("userOpenchannelQueue:save"),d.removeAllListeners("userOpenchannelQueue:remove"),d.removeAllListeners("userWhatsappQueue:save"),d.removeAllListeners("userWhatsappQueue:remove"),h&&t.cancel(h)})}e.$inject=["$scope","$state","$interval","$mdDialog","$document","$translate","agents","pauses","api","socket","toasty","userProfileSection","Auth","license","realtimeManager"],angular.module("app.realtime").controller("AgentsRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u){var p=this;function g(e){p.cloudProviders=e||{count:0,rows:[]}}function v(e){r.cloudProvider.delete({id:e.id}).$promise.then(function(){_.remove(p.cloudProviders.rows,{id:e.id}),p.cloudProviders.count-=1,p.cloudProviders.rows.length||p.getAiTools(),d.success({title:s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcloudProvider"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcloudProvider",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}p.license=m,p.setting=u,p.currentUser=c.getCurrentUser(),p.cloudProviders=o||{count:0,rows:[]},p.selectedAiTools=[],p.query={fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data5,data6",sort:"-updatedAt",limit:10,page:1},p.services={AmazonAWS:"AmazonAWS",MicrosoftAzure:"Microsoft Azure"},p.editdialog=function(e,n){a.show({controller:"CreateOrEditCloudProviderDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/cloudProviders/create/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{cloudProvider:e,cloudProviders:p.cloudProviders.rows,license:p.license,setting:null,crudPermissions:p.crudPermissions}})},p.deleteconfirm=function(e,n){var t=a.confirm().title(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_TITLE")).content(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_MESSAGE",{name:e.name})).ariaLabel("delete cloud provider").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){v(e)})},p.success=g,p.getAiTools=function(){p.query.offset=(p.query.page-1)*p.query.limit,c.hasRole("admin")?p.promise=r.cloudProvider.get(p.query,g).$promise:(p.query.id=p.userProfile.id,p.query.section="AiTools",p.promise=r.userProfile.getResources(p.query,g).$promise)},p.createOrEditCloudProvider=function(e,n){a.show({controller:"CreateOrEditCloudProviderDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/cloudProviders/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{cloudProvider:n,cloudProviders:p.cloudProviders.rows,license:p.license,setting:p.setting,crudPermissions:p.crudPermissions}})},p.deleteCloudProvider=v,p.exportSelectedAiTools=function(){var e=angular.copy(p.selectedAiTools);return p.selectedAiTools=[],e},p.deleteSelectedAiTools=function(e){var n=a.confirm().title(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDERS_DELETE_TITLE")).content(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDERS_DELETE_MESSAGE",{total:p.selectedAiTools.length})).ariaLabel("delete CloudProviders").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){p.selectedAiTools.forEach(function(e){v(e)}),p.selectedAiTools=[],d.success({title:s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDERS_DELETED_SUCCESS_TITLE")})})},p.deselectAiTools=function(){p.selectedAiTools=[]},p.selectAllAiTools=function(){p.selectedAiTools=p.cloudProviders.rows},p.authenticateToMicrosoftIdentityPlatform=function(e){return r.cloudProvider.oauth2MicrosoftAuthorize({id:e.id}).$promise.then(function(e){p.loginWindow=n.open(e.url,"_blank","width=800,height=600")})},p.updateClientSecret=function(n,e){return a.show({controller:"UpdateClientSecretController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/cloudProviders/updateSecret/updateSecret.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{cloudProvider:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,service,data3",id:n.id})}]}})},l.on("microsoftAuthorization:success",function(e){p.currentUser.id===e.id&&(p.loginWindow.close(),d.success({msg:s.instant("SETTINGS.NOTIFICATIONS.MICROSOFT_AUTHENTICATION_SUCCESS")}))}),l.on("microsoftAuthorization:error",function(e){p.currentUser.id===e.id&&(p.loginWindow.close(),d.error({msg:s.instant("SETTINGS.NOTIFICATIONS.MICROSOFT_AUTHENTICATION_FAIL")}))}),e.$on("$destroy",function(){l.removeAllListeners("microsoftAuthorization:success"),l.removeAllListeners("microsoftAuthorization:error")});var h=!0,f=1;e.$watch("vm.query.filter",function(e,n){h?i(function(){h=!1}):(n||(f=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=f),p.getAiTools())})}e.$inject=["$scope","$window","$mdDialog","$document","$timeout","$translate","cloudProviders","api","socket","toasty","Auth","license","setting"],angular.module("app.settings").controller("CloudProvidersController",e)}(),function(){"use strict";function e(t,a,i,e,n,s,o,r){var l=this;function d(e){t.hide(e)}l.currentUser=o.getCurrentUser(),l.license=r,l.cloudProvider=angular.copy(n),l.cloudProviders=e,l.newCloudProvider=!1,l.errors=[],l.cloudProvider||(l.cloudProvider={},l.newCloudProvider=!0),l.addNewCloudProvider=function(){l.errors=[],s.cloudProvider.save(l.cloudProvider).$promise.then(function(e){l.cloudProviders.unshift(e.toJSON()),i.success({title:a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_CREATED_SUCCESS_TITLE")}),d(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},l.saveCloudProvider=function(){l.errors=[],s.cloudProvider.update({id:l.cloudProvider.id},l.cloudProvider).$promise.then(function(e){var n=_.find(l.cloudProviders,{id:e.id});n&&_.merge(n,e.toJSON()),i.success({title:a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_SAVED_SUCCESS_TITLE")}),d(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},l.deleteCloudProvider=function(e){l.errors=[];var n=t.confirm().title(a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_TITLE")).content(a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_MESSAGE",{name:l.cloudProvider.name})).ariaLabel("Delete Cloud Provider").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){s.cloudProvider.delete({id:l.cloudProvider.id}).$promise.then(function(){_.remove(l.cloudProviders,{id:l.cloudProvider.id}),i.success({title:a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETED_SUCCESS_TITLE")}),d(l.cloudProvider)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},l.closeDialog=d}e.$inject=["$mdDialog","$translate","toasty","cloudProviders","cloudProvider","api","Auth","license"],angular.module("app.settings").controller("CreateOrEditCloudProviderDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;function o(){e.hide()}s.cloudProvider=i,s.errors=[],s.saveSecret=function(){return s.errors=[],a.cloudProvider.update({id:i.id},{data3:s.newSecret}).$promise.then(function(){t.success({title:n.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_SECRET_UPDATE_SUCCESS_TITLE")}),o()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){s.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.update"}];for(var n=0;n<e.data.errors.length;n+=1)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},s.closeDialog=o}e.$inject=["$mdDialog","$translate","toasty","api","cloudProvider"],angular.module("app.settings").controller("UpdateClientSecretController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SETTINGS.EDIT_CUSTOMIZATION",g.customization=angular.copy(l),g.customizations=r,g.newCustomization=!1,g.customization||(g.customization={},g.title="SETTINGS.NEW_CUSTOMIZATION",g.newCustomization=!0),g.addNewCustomization=function(){g.errors=[],d.setting.save(g.customization).$promise.then(function(e){g.customizations.unshift(e.toJSON()),o.success({title:"Customization properly created",msg:g.customization.name?g.customization.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCustomization=function(){g.errors=[],d.setting.update({id:g.customization.id},g.customization).$promise.then(function(e){var n=_.find(g.customizations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Customization properly saved!",msg:g.customization.name?g.customization.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCustomization=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The customization will be deleted.").ariaLabel("Delete Customization").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.setting.delete({id:g.customization.id}).$promise.then(function(){_.remove(g.customizations,{id:g.customization.id}),o.success({title:"Customization properly deleted!",msg:(g.customization.name||"customization")+" has been deleted!"}),v(g.customization)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","customizations","customization","api","Auth","license","setting","crudPermissions"],angular.module("app.settings").controller("CreateOrEditCustomizationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.currentUser=i.getCurrentUser(),s.license=a,s.customizations=e,s.customization={},s.customizations&&s.customizations.rows&&s.customizations.rows.length&&(s.customization=s.customizations.rows[0]),s.saveCustomization=function(){s.customization.id?n.setting.update({id:s.customization.id},s.customization).$promise.then(function(){t.success({title:"Customization updated!",msg:s.customization.name?s.customization.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})}):n.setting.save(s.customization).$promise.then(function(e){_.merge(s.customization,e),t.success({title:"Customization updated!",msg:s.customization.name?s.customization.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["customizations","api","toasty","license","Auth"],angular.module("app.settings").controller("CustomizationsController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg","ico"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/favicon".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationfaviconController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/logo".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationlogoController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/logo_login".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationlogologinController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/preferred".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationpreferredController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SETTINGS.EDIT_GENERAL",g.general=angular.copy(l),g.generals=r,g.newGeneral=!1,g.general||(g.general={min_internal:1e3,chatTimeout:30,phoneBarAutoUpdater:!0,phoneBarAutoUpdaterUrl:"https://www.xcally.com/bar/phonebar/autoupdater.xml",splitSizeCsv:5e3,splitSizePdf:1e3,splitSizeXlsx:5e3,messagesAlignment:"alternate",phoneBarRememberMeEnabled:!0,allowedLoginAttempts:5,blockDuration:10,loginMailFrequency:10,enforcePasswordHistory:!0,passwordHistoryLimit:3},g.title="SETTINGS.NEW_GENERAL",g.newGeneral=!0),g.addNewGeneral=function(){g.errors=[],d.setting.save(g.general).$promise.then(function(e){g.generals.unshift(e.toJSON()),o.success({title:"General properly created",msg:g.general.name?g.general.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveGeneral=function(){g.errors=[],d.setting.update({id:g.general.id},g.general).$promise.then(function(e){var n=_.find(g.generals,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"General properly saved!",msg:g.general.name?g.general.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteGeneral=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The general will be deleted.").ariaLabel("Delete General").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.setting.delete({id:g.general.id}).$promise.then(function(){_.remove(g.generals,{id:g.general.id}),o.success({title:"General properly deleted!",msg:(g.general.name||"general")+" has been deleted!"}),v(g.general)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,d.cloudProvider.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.cloudProviders=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CLOUDPROVIDERS",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","generals","general","api","Auth","license","setting","crudPermissions"],angular.module("app.settings").controller("CreateOrEditGeneralDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.currentUser=i.getCurrentUser(),s.license=a,s.generals=e,s.general={},s.generals&&s.generals.rows&&s.generals.rows.length&&(s.general=s.generals.rows[0]),_.isNil(s.general.privacyPolicyEmail)||(s.general.enablePrivacyPolicyEmail=!0),_.isNil(s.general.privacyPolicyName)||(s.general.enablePrivacyPolicyName=!0),_.isNil(s.general.privacyPolicyNumber)||(s.general.enablePrivacyPolicyNumber=!0),n.cloudProvider.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){s.cloudProviders=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CLOUDPROVIDERS",msg:e.data?JSON.stringify(e.data):e.toString()})}),s.saveGeneral=function(){s.general.enablePrivacyPolicyEmail||(s.general.privacyPolicyEmail=null),s.general.enablePrivacyPolicyNumber||(s.general.privacyPolicyNumber=null),s.general.enablePrivacyPolicyName||(s.general.privacyPolicyName=null),s.general.id?n.setting.update({id:s.general.id},s.general).$promise.then(function(){t.success({title:"General updated!",msg:s.general.name?s.general.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})}):n.setting.save(s.general).$promise.then(function(e){_.merge(s.general,e),t.success({title:"General updated!",msg:s.general.name?s.general.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.onPrivacyPolicyChange=function(e){switch(e){case"email":s.general.enablePrivacyPolicyEmail&&!s.general.privacyPolicyEmail&&(s.general.privacyPolicyEmail=0);break;case"name":s.general.enablePrivacyPolicyName&&!s.general.privacyPolicyName&&(s.general.privacyPolicyName=0);break;case"number":s.general.enablePrivacyPolicyNumber&&!s.general.privacyPolicyNumber&&(s.general.privacyPolicyNumber=0)}}}e.$inject=["generals","api","toasty","license","Auth"],angular.module("app.settings").controller("GeneralsController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r,l){var d=this;d.license=i||{},d.agents=0,d.users=0,d.telephones=0,d.channels=[{name:"voice",icon:"icon-phone"},{name:"chat",icon:"icon-hangouts"},{name:"mail",icon:"icon-email"},{name:"messaging",icon:"icon-message-text"},{name:"fax",icon:"icon-deskphone"},{name:"openchannel",icon:"icon-google-earth"},{name:"whatsapp",icon:"icon-whatsapp"}],d.modules=[{name:"cm",icon:"icon-account-circle"},{name:"dialer",icon:"icon-crosshairs"},{name:"jscripty",icon:"icon-console"}],d.addons=[{name:"webrtc",icon:"icon-server-plus"},{name:"jaws",icon:"icon-fish"},{name:"custom",icon:"icon-table-edit"},{name:"screenrecording",icon:"icon-video"},{name:"ai",icon:"icon-text-to-speech"}],d.sessions=[{name:"callysquare",icon:"icon-sitemap",restart:!0,label:"channels",enabled:"voice"},{name:"virtual",icon:"icon-dots-horizontal",restart:!1,label:"sessions",enabled:"chat"}],d.others=[{name:"update",icon:"icon-cloud-download"}],d.requestLicense=function(e){t.show({controller:"RequestLicenseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/license/request/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:i,channels:d.channels,modules:d.modules,addons:d.addons,sessions:d.sessions,others:d.others}})},d.updateLicense=function(e){t.show({controller:"UpdateLicenseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/license/update/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:i}})},d.gotoProcess=function(e){a.go("app.settings.system",{tab:1})},d.alert=s.info,d.downloadLogFile=function(){return o.license.downloadLogFile().$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download","license-info.log"),document.body.appendChild(a),a.click(),s.success({title:l.instant("SETTINGS.LICENSE_LOG_FILE"),msg:l.instant("SETTINGS.LICENSE_LOG_FILE_DOWNLOADED")})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DOWNLOADJSON",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.isAdmin=r.isAdmin(),o.user.get({fields:"id",role:"agent",online:!0}).$promise.then(function(e){return d.agents=e&&e.count?e.count:0,o.user.get({fields:"id",role:"user,admin"}).$promise}).then(function(e){return d.users=e&&e.count?e.count:0,o.user.get({fields:"id",role:"telephone"}).$promise}).then(function(e){d.telephones=e&&e.count?e.count:0}).catch(function(e){console.log(e)})}e.$inject=["$document","$window","$mdDialog","$state","license","toasty","api","Auth","$translate"],angular.module("app.settings.license").controller("LicenseController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(){e.hide()}m.errors=[],m.user=d.getCurrentUser(),m.license=angular.copy(t),m.channels=a,m.modules=i,m.addons=s,m.sessions=o,m.others=r,m.license.name=m.user.fullname,m.license.email=m.user.email,m.sendRequest=function(){for(var e in m.errors=[],m.table="||FIELD||OLD||NEW||\n",m.license)m.license.hasOwnProperty(e)&&!_.includes(["$promise","$resolved"],e)&&(t[e]===m.license[e]?m.table+="|"+e+"|"+(void 0!==t[e]?t[e]:"")+"|"+m.license[e]+"|\n":m.table+="|"+e+"|{color:red}"+(void 0!==t[e]?t[e]:"")+"{color}|*"+m.license[e]+"*|\n");l.jira.save({key:"MOTLICENSE",summary:"Motion License Request",description:m.table,issuetype:"License Request"}).$promise.then(function(e){n.success({title:"Request sent!",msg:c.instant("SETTINGS.LICENSE_REQUEST_SENT"),timeout:15e3}),u()}).catch(function(e){console.error(e),m.errors=[{message:c.instant("SETTINGS.JIRA_ERROR_MESSAGE"),type:"api.jira"}]})},m.closeDialog=u}e.$inject=["$mdDialog","toasty","license","channels","modules","addons","sessions","others","api","Auth","$translate"],angular.module("app.settings.license").controller("RequestLicenseDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.errors=[],s.license=angular.copy(t),s.licenseKey,s.updateLicense=function(){return a.license.update({id:1,key:s.licenseKey}).$promise.then(function(e){e&&(e.demo?n.error({title:"License update failed!",msg:"Invalid license key"}):n.success({title:"License properly updated!",msg:"The license has been updated!"}))}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATElicense",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","toasty","license","api","$translate"],angular.module("app.settings.license").controller("UpdateLicenseDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(e){a.hide(e)}p.currentUser=c.getCurrentUser(),p.errors=[],p.setting=u,p.license=m,p.hasModulePermissions={},p.passwordPattern=p.setting&&p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.title="SETTINGS.EDIT_NETWORK",p.network=angular.copy(l),p.networks=r,p.newNetwork=!1,p.network||(p.network={type:"localnet"},p.title="SETTINGS.NEW_NETWORK",p.newNetwork=!0),p.addNewNetwork=function(){p.errors=[],d.network.save(p.network).$promise.then(function(e){p.networks.unshift(e.toJSON()),o.success({title:"Network properly created",msg:p.network.name?p.network.name+" has been created!":""}),g(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.network.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.network.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.saveNetwork=function(){p.errors=[],d.network.update({id:p.network.id},p.network).$promise.then(function(e){var n=_.find(p.networks,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Network properly saved!",msg:p.network.name?p.network.name+" has been saved!":""}),g(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.network.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.network.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.deleteNetwork=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The network will be deleted.").ariaLabel("Delete Network").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.network.delete({id:p.network.id}).$promise.then(function(){_.remove(p.networks,{id:p.network.id}),o.success({title:"Network properly deleted!",msg:(p.network.name||"network")+" has been deleted!"}),g(p.network)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.network.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.network.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},p.getDateFromString=function(e){return null===e?void 0:new Date(e)},p.closeDialog=g}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","networks","network","api","Auth","license","setting"],angular.module("app.settings").controller("CreateOrEditNetworkDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this;v.license=p,v.setting=g,v.currentUser=u.getCurrentUser(),v.networks=l||{count:0,rows:[]},v.table="networks",v.listOrder="",v.listOrderAsc=null,v.selectedNetworks=[],v.query={fields:"createdAt,updatedAt,id,type,value,username,password",sort:"-updatedAt",limit:10,page:1},v.arraytype=_.keyBy([{option:"LocalNET",value:"'localnet'"},{option:"ExternIP",value:"'externip'"},{option:"Turn",value:"'turn'"},{option:"Stun",value:"'stun'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),v.editdialog=function(e,n){i.show({controller:"CreateOrEditNetworkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/networks/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{network:e,networks:v.networks.rows,license:v.license,setting:null,crudPermissions:v.crudPermissions}})},v.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("network")+"?").htmlContent("<b>"+(e.name||"network")+"</b> will be deleted.").ariaLabel("delete network").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){A(e)},function(){console.log("CANCEL")})},v.success=b,v.getNetworks=function(){v.query.offset=(v.query.page-1)*v.query.limit,u.hasRole("admin")?v.promise=d.network.get(v.query,b).$promise:(v.query.id=v.userProfile.id,v.query.section="Networks",v.promise=d.userProfile.getResources(v.query,b).$promise)},v.createOrEditNetwork=function(e,n){i.show({controller:"CreateOrEditNetworkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/networks/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{network:n,networks:v.networks.rows,license:v.license,setting:v.setting,crudPermissions:v.crudPermissions}})},v.deleteNetwork=A,v.exportSelectedNetworks=function(){var e=angular.copy(v.selectedNetworks);return v.selectedNetworks=[],e},v.deleteSelectedNetworks=function(e){var n=i.confirm().title("Are you sure want to delete the selected networks?").htmlContent("<b>"+v.selectedNetworks.length+" selected</b> will be deleted.").ariaLabel("delete Networks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){v.selectedNetworks.forEach(function(e){A(e)}),v.selectedNetworks=[]})},v.deselectNetworks=function(){v.selectedNetworks=[]},v.selectAllNetworks=function(){v.selectedNetworks=v.networks.rows};var h=!0,f=1;function b(e){v.networks=e||{count:0,rows:[]}}function A(e){d.network.delete({id:e.id}).$promise.then(function(){_.remove(v.networks.rows,{id:e.id}),v.networks.count-=1,v.networks.rows.length||v.getNetworks(),m.success({title:_.startCase("Network")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEnetwork"}];for(var n=0;n<e.data.errors.length;n++)m.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEnetwork",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){h?o(function(){h=!1}):(n||(f=v.query.page),e!==n&&(v.query.page=1),e||(v.query.page=f),v.getNetworks())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","networks","api","msUtils","toasty","Auth","license","setting"],angular.module("app.settings").controller("NetworksController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;l.currentUser=o.getCurrentUser(),l.license=s,l.providers=r.getEmailProviders(),l.mailAccounts=e||{rows:[],count:0},l.cloudProviders=t||{rows:[],count:0},l.mailAccount={service:!0,Smtp:{}},0<l.mailAccounts.count&&(l.mailAccount=l.mailAccounts.rows[0]),l.originalProvider=l.mailAccount.provider,l.saveSmtp=function(){var e=angular.copy(l.mailAccount);"custom"===e.provider?e.provider=null:(l.originalProvider!==e.provider&&(e.Smtp.modernAuthentication?e.Smtp.pass=null:e.Smtp.CloudProviderId=null),e.Smtp.modernAuthentication||(e.Smtp.CloudProviderId=null),e.Smtp=_.omit(e.Smtp,["host","port","secure","service"]));l.mailAccount.id?a.mailAccount.update({id:l.mailAccount.id},e).$promise.then(function(){l.originalProvider=e.provider,i.success({msg:n.instant("SETTINGS.NOTIFICATIONS.SMTP_SAVED_SUCCESS_TITLE")})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}):a.mailAccount.save(e).$promise.then(function(e){_.merge(l.mailAccount,e),i.success({msg:n.instant("SETTINGS.NOTIFICATIONS.SMTP_SAVED_SUCCESS_TITLE")})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},l.verifySmtp=function(){a.mailAccount.verifySmtp({id:l.mailAccount.id}).$promise.then(function(){i.success({msg:n.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_SUCCESS_TITLE")})}).catch(function(e){i.error({title:n.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_FAIL_TITLE"),msg:e.data?JSON.stringify(e.data):e.toString(),timeout:1e4})})},l.onProviderChange=function(){"custom"!==l.mailAccount.provider&&(l.mailAccount.authentication=!0);"outlook365"!==l.mailAccount.provider&&(l.mailAccount.Smtp.modernAuthentication=!1)}}e.$inject=["$translate","mailAccounts","cloudProviders","api","toasty","license","Auth","msUtils"],angular.module("app.settings").controller("SmtpController",e)}(),function(){"use strict";function e(e,i,s,n,t,a,o,r){var l,d=this;d.system=t||{},d.processes=a?a.rows:[],d.processLimit=7,d.selectedTab=n.params.tab||0,d.getInfo=function(){return r.system.get().$promise.then(function(e){_.merge(d.system,e)}).catch(d.cancelInterval)},d.getProcesses=function(){return r.pm2.get().$promise.then(function(e){_.merge(d.processes,e?e.rows:[])}).catch(d.cancelInterval)},d.cancelInterval=function(e){i.cancel(l)},d.updateProcess=function(e,n,t){var a=s.confirm().title("Would you like to change the status of the process #"+n+"?").textContent("The status will be changed to: "+t.toUpperCase()).ariaLabel("Lucky day").targetEvent(e).ok("Ok").cancel("Cancel");s.show(a).then(function(){return r.pm2.update({id:n,status:t})}).then(function(){i(d.getProcesses,1e3,1)}).then(function(){o.success({title:"Process updated!",msg:"Status properly changed to: "+t})})},l=i(d.getInfo,5e3),e.$on("$destroy",function(){d.cancelInterval()})}e.$inject=["$scope","$interval","$mdDialog","$state","system","processes","toasty","api"],angular.module("app.settings.system").controller("SystemController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.title="SETTINGS.UPDATE",s.progress=0,s.updating=!0,s.output="Waiting...",s.success=!0,s.interval=n(function(){s.progress<90&&(s.progress+=1)},1e3),s.closeDialog=function(){e.hide()},s.reload=function(){t.location.reload()},s.stopInterval=function(){angular.isDefined(s.interval)&&(n.cancel(s.interval),s.interval=void 0);s.progress=100,s.updating=!1},i.version.fetch().$promise.then(function(e){return s.output=e.output+"...",i.version.reset().$promise}).then(function(e){return s.output=e.output+"...",i.version.pull().$promise}).then(function(e){return s.output=e.output+"...",i.version.migrations().$promise}).then(function(e){return s.output=e.output+"...",i.version.restart().$promise}).then(function(e){s.output="Waiting to restart motion...",a(function(){s.stopInterval()},3e4)}).catch(function(e){s.success=!1,s.stopInterval(),s.output=JSON.stringify(e)})}e.$inject=["$mdDialog","$interval","$window","$timeout","api"],angular.module("app.settings").controller("UpdateDialogController",e)}(),function(){"use strict";function e(t,e,a,n,i){this.version=n||{},this.updateConfirm=function(e){var n=t.confirm().title("Would you like to update your system?").htmlContent('The system request time for the update should be below 1 minute.<br><br>Do you agree the terms of this <a href="http://www.xcally.com/support/eula-xcally-license-en.pdf" target="_blank">End User License Agreement<a>?').ariaLabel("").targetEvent(e).clickOutsideToClose(!0).parent(angular.element(a.body)).ok("I agree").cancel("Disagree");t.show(n).then(function(){t.show({controller:"UpdateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/updates/update/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!1})})}}e.$inject=["$mdDialog","$interval","$document","version","toasty"],angular.module("app.settings").controller("UpdatesController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=["loggedIn","available","waiting","paused"],g=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"SmsQueues":void 0,channel:"sms",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("SMS.SMSQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditSmsQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsQueue:n,smsQueues:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsQueue:n,smsQueues:u.queues.rows,realtime:!1,crudPermissions:u.crudPermissions}})},r.on("sms_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,p))}),r.on("userSmsQueue:save",function(e){var n=_.find(u.queues.rows,["id",e.SmsQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("userSmsQueue:remove",function(e){var n=_.find(u.queues.rows,["id",e.SmsQueueId]);n&&(0<n.loggedInDb&&n.loggedInDb--,_.remove(n.agents,["id",e.UserId]))}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"sms")})}),e.$on("$destroy",function(){r.removeAllListeners("sms_queue:save"),r.removeAllListeners("userSmsQueue:remove"),r.removeAllListeners("userSmsQueue:save"),r.removeAllListeners("user:update"),g&&n.cancel(g)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.sms").controller("QueuesSmsRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.sms.realtime.agents":this.selectedTab=0;break;case"app.sms.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.sms.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.sms.realtime.agents");break;case 1:t.go("app.sms.realtime.queues");break;default:t.go("app.sms.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.sms").controller("SmsRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SMS.EDIT_SMSACCOUNT",g.smsAccount=angular.copy(l),g.smsAccounts=r,g.newSmsAccount=!1,g.smsAccount||(g.smsAccount={remote:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),type:"twilio",waitForTheAssignedAgent:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="SMS.NEW_SMSACCOUNT",g.newSmsAccount=!0),n.params.id&&(g.smsAccount.SmsAccountId=n.params.id),g.addNewSmsAccount=function(){g.errors=[],d.smsAccount.save(g.smsAccount).$promise.then(function(e){g.smsAccounts.unshift(e.toJSON()),o.success({title:"SmsAccount properly created",msg:g.smsAccount.name?g.smsAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmsAccount=function(){g.errors=[],d.smsAccount.update({id:g.smsAccount.id},g.smsAccount).$promise.then(function(e){var n=_.find(g.smsAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SmsAccount properly saved!",msg:g.smsAccount.name?g.smsAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmsAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The smsAccount will be deleted.").ariaLabel("Delete SmsAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.smsAccount.delete({id:g.smsAccount.id}).$promise.then(function(){_.remove(g.smsAccounts,{id:g.smsAccount.id}),o.success({title:"SmsAccount properly deleted!",msg:(g.smsAccount.name||"smsAccount")+" has been deleted!"}),v(g.smsAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.smsAccount&&(t=_.find(g.lists,{id:Number(g.smsAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.smsAccount&&(a=_.find(g.lists,{id:Number(g.smsAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","smsAccounts","smsAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.smsAccountApps.rows.length){var t=r.smsAccountApps.rows[n]?r.smsAccountApps.rows[n]:r.smsAccountApps.rows[0];i.show({controller:"EditSmsAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccountApp:t,smsAccount:r.smsAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.smsAccountApps.rows[n]=e:r.smsAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.smsAccountApps.rows.length;t++,0){var a=r.smsAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.smsAccount.context,a.exten=r.smsAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.smsAccount.addApplications({id:r.smsAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.smsAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.smsAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.smsAccount={},r.smsAccountApps={count:0,rows:[]},r.selectedSmsAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"SmsQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"smsQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:701}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",nolimit:!0,role:"agent"},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]},{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:4,help:!0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.smsAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getSmsAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.smsAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getSmsAccountApps=function(){r.promise=o.smsAccount.getApplications(r.query,t).$promise},r.editSmsAccountApp=n,r.editInterval=function(e,n){if(r.smsAccountApps.rows.length){var t=r.smsAccountApps.rows[n]?r.smsAccountApps.rows[n]:r.smsAccountApps.rows[0];i.show({controller:"EditSmsAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteSmsAccountApp=function(e){_.remove(r.smsAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedSmsAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedSmsAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedSmsAccountApps.forEach(function(e){_.remove(r.smsAccountApps.rows,{id:e.id})}),r.selectedSmsAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.sms").controller("SmsAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.smsAccount.getAgents({id:c.smsAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserSmsAccount?"penalty "+e.UserSmsAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.smsAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.smsAccount.removeAgents({id:c.smsAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.smsAccount.addAgents({id:c.smsAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("SMS.ALL_AGENTS"),labelSelected:r.instant("SMS.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","smsAccount","smsAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.sms").controller("SmsAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditSmsAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("sms")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.smsQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.smsQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:701}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"smsAccount",action:"getDispositions",field:"name",params:{id:m.smsAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.smsAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.smsAccountInteractions.rows.length;n+=1){var t=m.smsAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.smsInteraction.get(m.query,p).$promise}function v(e){d.smsInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.smsAccountInteractions.rows,{id:e.id}),m.smsAccountInteractions.count-=1,m.smsAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETsmsAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?(e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""),e.contactInfo=e.Contact.mobile):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.smsAccount={},m.smsAccountInteractions={count:0,rows:[]},m.selectedSmsAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.smsAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.SmsAccountId=m.smsAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.smsInteractionDownload=function(s,e,n){return d.smsInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="sms-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getSmsAccountInteractions=g,m.createOrEditSmsAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:m.smsAccount,interaction:n,interactions:m.smsAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spysmsInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"sms",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"sms.smsAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||SmsAccountId:=$eq["+m.smsAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedSmsAccountInteractions=function(){var e=angular.copy(m.selectedSmsAccountInteractions);return m.selectedSmsAccountInteractions=[],e},m.deleteSmsAccountInteraction=v,m.deleteSelectedSmsAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedSmsAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedSmsAccountInteractions.forEach(function(e){v(e)}),m.selectedSmsAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.sms").controller("SmsAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.smsAccountSmsCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.smsAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.smsAccountSmsCannedAnswers.rows,{id:e.id}),m.smsAccountSmsCannedAnswers.count-=1,m.smsAccountSmsCannedAnswers.rows.length||p(),l.success({title:"SmsCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETsmsAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.smsAccount={},m.smsAccountSmsCannedAnswers={count:0,rows:[]},m.selectedSmsAccountSmsCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.smsAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.SmsAccountId=m.smsAccount.id,m.query.id=m.smsAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the smsCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("smsCannedAnswer #")+e.id||"smsCannedAnswer")+"</b> will be deleted.").ariaLabel("delete smsCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getSmsAccountSmsCannedAnswers=p,m.createOrEditSmsAccountSmsCannedAnswer=function(e,n){o.show({controller:"CreateOrEditSmsCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/smsCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:m.smsAccount,smsCannedAnswer:n,smsCannedAnswers:m.smsAccountSmsCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedSmsAccountSmsCannedAnswers=function(){var e=angular.copy(m.selectedSmsAccountSmsCannedAnswers);return m.selectedSmsAccountSmsCannedAnswers=[],e},m.deleteSmsAccountSmsCannedAnswer=g,m.deleteSelectedSmsAccountSmsCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected smsCannedAnswers?").htmlContent("<b>"+m.selectedSmsAccountSmsCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete smsCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedSmsAccountSmsCannedAnswers.forEach(function(e){g(e)}),m.selectedSmsAccountSmsCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.sms").controller("SmsAccountSmsCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SMS.EDIT_SMSCANNEDANSWER",g.smsCannedAnswer=angular.copy(l),g.smsCannedAnswers=r,g.newSmsCannedAnswer=!1,g.smsCannedAnswer||(g.smsCannedAnswer={},g.title="SMS.NEW_SMSCANNEDANSWER",g.newSmsCannedAnswer=!0),n.params.id&&(g.smsCannedAnswer.SmsAccountId=n.params.id),g.addNewSmsCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.smsCannedAnswer).$promise.then(function(e){g.smsCannedAnswers.unshift(e.toJSON()),o.success({title:"SmsCannedAnswer properly created",msg:g.smsCannedAnswer.name?g.smsCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmsCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.smsCannedAnswer.id},g.smsCannedAnswer).$promise.then(function(e){var n=_.find(g.smsCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SmsCannedAnswer properly saved!",msg:g.smsCannedAnswer.name?g.smsCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmsCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The smsCannedAnswer will be deleted.").ariaLabel("Delete SmsCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.smsCannedAnswer.id}).$promise.then(function(){_.remove(g.smsCannedAnswers,{id:g.smsCannedAnswer.id}),o.success({title:"SmsCannedAnswer properly deleted!",msg:(g.smsCannedAnswer.name||"smsCannedAnswer")+" has been deleted!"}),v(g.smsCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","smsCannedAnswers","smsCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.smsAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.smsAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.SmsAccountId=m.smsAccount.id,m.query.id=m.smsAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.smsAccount.id,field:"SmsAccountId",route:"smsAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.sms").controller("SmsAccountDispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.smsAccount=c||e.params.smsAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.agentadddialog=function(e,n){t.show({controller:"SmsAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsAccount:e,smsAccounts:p.smsAccounts?p.smsAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoSmsAccounts=function(){e.go("app.sms.smsAccounts",{},{reload:"app.sms.smsAccounts"})},p.saveSmsAccount=function(){r.smsAccount.update({id:p.smsAccount.id},p.smsAccount).$promise.then(function(){l.success({title:"SmsAccount updated!",msg:p.smsAccount.name?p.smsAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.smsAccount&&(t=_.find(p.lists,{id:Number(p.smsAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.smsAccount&&(a=_.find(p.lists,{id:Number(p.smsAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","smsAccount","userProfile","userProfileSection"],angular.module("app.sms").controller("SmsAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.smsAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="smsAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedSmsAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Twilio",value:"'twilio'"},{option:"Skebby",value:"'skebby'"},{option:"Connectel",value:"'connectel'"},{option:"ClickSend",value:"'clicksend'"},{option:"Plivo",value:"'plivo'"},{option:"Infobip",value:"'infobip'"},{option:"Clickatell",value:"'clickatell'"},{option:"Bandwidth",value:"'bandwidth'"},{option:"CSCTelecom",value:"'csc'"},{option:"Intelepeer",value:"'intelepeer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysmsMethod=_.keyBy([{option:"Basic",value:"'SI'"},{option:"Classic",value:"'TI'"},{option:"Classic+",value:"'GP'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.sms.smsAccounts.edit",{id:e.id,smsAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.sms.smsAccounts.edit",{id:e.id,tab:5})},f.agentadddialog=function(e,n){i.show({controller:"SmsAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsAccount:e,smsAccounts:f.smsAccounts?f.smsAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("smsAccount")+"?").htmlContent("<b>"+(e.name||"smsAccount")+"</b> will be deleted.").ariaLabel("delete smsAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSmsAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.smsAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SmsAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSmsAccount=function(e,n){i.show({controller:"CreateOrEditSmsAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:n,smsAccounts:f.smsAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSmsAccount=y,f.exportSelectedSmsAccounts=function(){var e=angular.copy(f.selectedSmsAccounts);return f.selectedSmsAccounts=[],e},f.deleteSelectedSmsAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected smsAccounts?").htmlContent("<b>"+f.selectedSmsAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SmsAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSmsAccounts.forEach(function(e){y(e)}),f.selectedSmsAccounts=[]})},f.deselectSmsAccounts=function(){f.selectedSmsAccounts=[]},f.selectAllSmsAccounts=function(){f.selectedSmsAccounts=f.smsAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.smsAccount&&(t=_.find(f.lists,{id:Number(f.smsAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.smsAccount&&(a=_.find(f.lists,{id:Number(f.smsAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.smsAccounts=e||{count:0,rows:[]}}function y(e){m.smsAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.smsAccounts.rows,{id:e.id}),f.smsAccounts.count-=1,f.smsAccounts.rows.length||f.getSmsAccounts(),p.success({title:_.startCase("SmsAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsmsAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSmsAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","smsAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.sms").controller("SmsAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SMS.EDIT_SMSQUEUE",g.smsQueue=angular.copy(l),g.smsQueues=r,g.newSmsQueue=!1,g.smsQueue||(g.smsQueue={strategy:"beepall",timeout:10},g.title="SMS.NEW_SMSQUEUE",g.newSmsQueue=!0),g.addNewSmsQueue=function(){g.errors=[],d.smsQueue.save(g.smsQueue).$promise.then(function(e){g.smsQueues.unshift(e.toJSON()),o.success({title:"SmsQueue properly created",msg:g.smsQueue.name?g.smsQueue.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmsQueue=function(){g.errors=[],d.smsQueue.update({id:g.smsQueue.id},g.smsQueue).$promise.then(function(e){var n=_.find(g.smsQueues,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SmsQueue properly saved!",msg:g.smsQueue.name?g.smsQueue.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmsQueue=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The smsQueue will be deleted.").ariaLabel("Delete SmsQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.smsQueue.delete({id:g.smsQueue.id}).$promise.then(function(){_.remove(g.smsQueues,{id:g.smsQueue.id}),o.success({title:"SmsQueue properly deleted!",msg:(g.smsQueue.name||"smsQueue")+" has been deleted!"}),v(g.smsQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","smsQueues","smsQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.smsQueue.getAgents({id:c.smsQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserSmsQueue?"penalty "+e.UserSmsQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.smsQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.removeAgents({id:c.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.addAgents({id:c.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("SMS.ALL_AGENTS"),labelSelected:r.instant("SMS.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","smsQueue","smsQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.sms").controller("SmsQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.smsQueue.getTeams({id:l.smsQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.smsQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("SMS.ALL_TEAMS"),labelSelected:t.instant("SMS.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.removeTeams({id:l.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.addTeams({id:l.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","smsQueue","$translate","Auth","crudPermissions"],angular.module("app.sms").controller("SmsQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.smsQueue=c||e.params.smsQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"SmsQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:u.smsQueues?u.smsQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:u.smsQueues?u.smsQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoSmsQueues=function(){e.go("app.sms.smsQueues",{},{reload:"app.sms.smsQueues"})},u.saveSmsQueue=function(){r.smsQueue.update({id:u.smsQueue.id},u.smsQueue).$promise.then(function(){l.success({title:"SmsQueue updated!",msg:u.smsQueue.name?u.smsQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","smsQueue","userProfileSection"],angular.module("app.sms").controller("SmsQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.smsQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="smsQueues",f.listOrder="",f.listOrderAsc=null,f.selectedSmsQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"sms",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.sms.smsQueues.edit",{id:e.id,smsQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"SmsQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:f.smsQueues?f.smsQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:f.smsQueues?f.smsQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("smsQueue")+"?").htmlContent("<b>"+(e.name||"smsQueue")+"</b> will be deleted.").ariaLabel("delete smsQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:710}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.sms.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.sms.realtime.queues",{})}},f.success=E,f.getSmsQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.smsQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SmsQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSmsQueue=function(e,n){i.show({controller:"CreateOrEditSmsQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsQueue:n,smsQueues:f.smsQueues.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSmsQueue=y,f.exportSelectedSmsQueues=function(){var e=angular.copy(f.selectedSmsQueues);return f.selectedSmsQueues=[],e},f.deleteSelectedSmsQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected smsQueues?").htmlContent("<b>"+f.selectedSmsQueues.length+" selected</b> will be deleted.").ariaLabel("delete SmsQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSmsQueues.forEach(function(e){y(e)}),f.selectedSmsQueues=[]})},f.deselectSmsQueues=function(){f.selectedSmsQueues=[]},f.selectAllSmsQueues=function(){f.selectedSmsQueues=f.smsQueues.rows};var b=!0,A=1;function E(e){f.smsQueues=e||{count:0,rows:[]}}function y(e){m.smsQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.smsQueues.rows,{id:e.id}),f.smsQueues.count-=1,f.smsQueues.rows.length||f.getSmsQueues(),p.success({title:_.startCase("SmsQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsmsQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsmsQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSmsQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","smsQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.sms").controller("SmsQueuesController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.agents=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,c.hasRole("admin")?g.promise=l.user.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="Agents",g.promise=l.userProfile.getResources(g.query,v).$promise)}function f(e){l.user.delete({id:e.id}).$promise.then(function(){_.remove(g.agents.rows,{id:e.id}),g.agents.count-=1,g.agents.rows.length||g.getAgents(),d.success({title:_.startCase("Agent")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuser",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=m,g.setting=u,g.currentUser=c.getCurrentUser(),g.agents=s||{count:0,rows:[]},g.userProfile=o,g.userProfileSection=r&&1==r.count?r.rows[0]:null,g.crudPermissions=c.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedAgents=[],g.query={fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay",role:"agent",userSetting:!0,sort:"-updatedAt",limit:10,page:1},g.showWebBarOptions=[{option:"Phonebar",value:0},{option:"External",value:1},{option:"WebRTC",value:2}],g.editstate=function(e){n.go("app.staff.agents.edit",{id:e.id,agent:e,crudPermissions:g.crudPermissions})},g.teamadddialog=function(e,n){a.show({controller:"AgentteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,agents:g.agents?g.agents.rows:[],crudPermissions:g.crudPermissions}})},g.deleteconfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the "+_.startCase("agent")+"?").htmlContent("<b>"+(e.name||"agent")+"</b> will be deleted.").ariaLabel("delete agent").targetEvent(n).ok("OK").cancel("CANCEL");a.show(t).then(function(){f(e)})},g.success=v,g.getAgents=h,g.createOrEditAgent=function(e,n){a.show({controller:"CreateOrEditAgentDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{agent:n,agents:g.agents.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions}})},g.deleteAgent=f,g.exportSelectedAgents=function(){var e=angular.copy(g.selectedAgents);return g.selectedAgents=[],e},g.deleteSelectedAgents=function(e){var n=a.confirm().title("Are you sure want to delete the selected agents?").htmlContent("<b>"+g.selectedAgents.length+" selected</b> will be deleted.").ariaLabel("delete Agents").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){g.selectedAgents.forEach(function(e){f(e)}),g.selectedAgents=[]})},g.deselectAgents=function(){g.selectedAgents=[]},g.selectAllAgents=function(){g.selectedAgents=g.agents.rows};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),g.getAgents())}),p.on("user-setting:update",h),e.$on("$destroy",function(){p.removeListener("user-setting:update",h)})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","agents","userProfile","userProfileSection","api","toasty","Auth","license","setting","socket"],angular.module("app.staff").controller("AgentsController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c){var m=this;function u(){return s.user.get({id:m.agent.id,userSetting:!0}).$promise.then(function(e){m.agent=e})}function p(e){t.hide(e)}m.currentUser=o.getCurrentUser(),m.errors=[],m.setting=l,m.license=r,m.crudPermissions=d,m.hasModulePermissions={},m.passwordPattern=m.setting&&m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.title="STAFF.EDIT_AGENT",m.agent=angular.copy(i),m.agents=n,m.newAgent=!1,m.agent||(m.agent={role:"agent",showWebBar:"0",autointernal:!0,wssPort:8089,type:"friend",context:"from-sip",phoneBarRemoteControl:!0,phoneBarRemoteControlPort:9888,allowmessenger:!0,downloadAttachments:!0,downloadOmnichannelInteractions:!0,downloadVoiceRecordings:!0},m.title="STAFF.NEW_AGENT",m.newAgent=!0),m.addNewAgent=function(){m.errors=[],s.user.save(m.agent).$promise.then(function(e){m.agents.unshift(e.toJSON()),a.success({title:"Agent properly created",msg:m.agent.name?m.agent.name+" has been created!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveAgent=function(){m.errors=[],s.user.update({id:m.agent.id},m.agent).$promise.then(function(e){var n=_.find(m.agents,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"Agent properly saved!",msg:m.agent.name?m.agent.name+" has been saved!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteAgent=function(e){m.errors=[];var n=t.confirm().title("Are you sure?").content("The agent will be deleted.").ariaLabel("Delete Agent").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){s.user.delete({id:m.agent.id}).$promise.then(function(){_.remove(m.agents,{id:m.agent.id}),a.success({title:"Agent properly deleted!",msg:(m.agent.name||"agent")+" has been deleted!"}),p(m.agent)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},m.getDateFromString=function(e){return null===e?void 0:new Date(e)},m.closeDialog=p;var g="user-setting:update:user-"+m.agent.id;c.on(g,u),e.$on("$destroy",function(){c.removeListener(g,u)})}e.$inject=["$scope","$mdDialog","toasty","agents","agent","api","Auth","license","setting","crudPermissions","socket"],angular.module("app.staff").controller("CreateOrEditAgentDialogController",e)}(),function(){"use strict";function e(e,a){var i=this;i.agent={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.agent.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.agent.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.agent=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="api/users/"+i.agent.id+"/avatar",i.agent.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.staff").controller("Agentchange_avatarController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.currentUser=o.getCurrentUser(),r.errors=[],r.setting=s,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.agent=i,r.password="",r.oldPassword="",r.savePassword=function(){r.errors=[];var e={id:r.agent.id,newPassword:r.password};r.currentUser.id==r.agent.id&&(e.oldPassword=r.oldPassword);a.user.changePassword(e).$promise.then(function(){n.success({title:"Agent password properly updated!"}),l()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.agent.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),r.errors=e.data.errors||[{message:e.toString(),type:"api.agent.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.agentForm.password.$setValidity("oldPasswordMatch",!1):t.agentForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","toasty","api","agent","setting","Auth"],angular.module("app.staff").controller("AgentchangepasswordController",e)}(),function(){"use strict";function e(e,n,i,t,s){var o=this;o.agent={},o.navigation=t.getNavigation(),o.crudPermissions,o.init=function(e,n){o.agent=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1}},o.onChange=function(n,t){if((t||n).enabled){if(t)t.enabled=!0,o.agent.permissions.push(t.id);else for(var e=0;e<n.children.length;e++)n.children[e].enabled=!0,o.agent.permissions.push(n.children[e].id);n.enabled=!0,o.agent.permissions.push(n.id)}else if(t)t.enabled=!1,_.remove(o.agent.permissions,function(e){return t.id===e}),_.filter(n.children,{enabled:!1}).length===n.children.length&&(n.enabled=!1,_.remove(o.agent.permissions,function(e){return n.id===e}));else{n.enabled=!1,_.remove(o.agent.permissions,function(e){return n.id===e});for(var a=0;a<n.children.length;a++)n.children[a].enabled=!1,_.remove(o.agent.permissions,function(e){return n.children[a].id===e})}return i.user.update({id:o.agent.id,permissions:_.uniq(o.agent.permissions)}).$promise.then(function(){s.success({title:"agent updated!",msg:o.agent.name?o.agent.name+" has been updated!":""})}).catch(function(e){console.error(e)})}}e.$inject=["$document","$mdDialog","api","msNavigationAgentService","toasty"],angular.module("app.staff").controller("AgentPermissionsController",e)}(),function(){"use strict";function e(e,l,a,d,n,t,i,s,o,r){var c=this;function m(){return l(function(t,n){return l(function(n,t){return d[c.apiName].get({fields:"id,name,strategy,type",channel:c.channel,type:"voice"===c.channel?c.direction:void 0,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(n,t){return d.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:o.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),l(function(n,t){return d.user.getQueues({id:c.agent.id,fields:"id,name,strategy,type,penalty",nolimit:!0,type:"voice"===c.channel?c.direction:void 0,channel:c.channel}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return"voice"===c.channel&&(n.penalty=void 0!==n&&void 0!==e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"penalty 0"),n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=o.getCurrentUser(),c.agent=n,c.crudPermissions=r,c.penalty=0,c.channel=t,c.direction=i,c.apiName=c.channel+"Queue",c.title=s.instant("STAFF.ADD_AGENT_TO_"+("outbound"===c.direction?"QUEUE_CAMPAIGNS":c.channel.toUpperCase()+"_QUEUES")),c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"type",line3:"voice"===c.channel?"penalty":"",labelAll:s.instant("STAFF.ALL_"+("outbound"===c.direction?"QUEUE_CAMPAIGNS":c.channel.toUpperCase()+"_QUEUES")),labelSelected:s.instant("STAFF.SELECTED_"+("outbound"===c.direction?"QUEUE_CAMPAIGNS":c.channel.toUpperCase()+"_QUEUES")),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var t=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});c.pendingChanges=!_.isEmpty(t)}},c.onInit=function(){return o.hasRole("admin")?m().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.status?JSON.stringify(e.data):e.toString()})}):l(function(t,n){var e;switch(c.channel){case"voice":switch(c.direction){case"inbound":e="VoiceQueues";break;case"outbound":e="QueueCampaigns"}break;case"chat":e="ChatQueues";break;case"mail":e="MailQueues";break;case"sms":e="SmsQueues";break;case"openchannel":e="OpenchannelQueues";break;case"fax":e="FaxQueues"}d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:e}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveQueues=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,l(function(e,n){_.isEmpty(t)?e():d.user.removeQueues({id:c.agent.id,ids:_.map(t,"id"),channel:c.channel}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return r=n,l(function(e,n){if(_.isEmpty(r))e();else if("voice"===c.channel){for(var t=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);t.push(d.user.addQueues({id:c.agent.id,ids:_.map(o,"id"),channel:c.channel,penalty:_.trim(s,"penalty ")}).$promise)}l.all(t).then(function(){e()}).catch(function(e){n(e)})}else d.user.addQueues({id:c.agent.id,ids:_.map(r,"id"),channel:c.channel}).$promise.then(function(){e()}).catch(function(e){n(e)})});var r}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),a.success({title:"SUCCESS",msg:"Queues association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:QUEUES_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","agent","channel","direction","$translate","Auth","crudPermissions"],angular.module("app.staff").controller("AgentQueueAddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.user.getTeams({id:l.agent.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.agent=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("STAFF.ALL_TEAMS"),labelSelected:t.instant("STAFF.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.user.removeTeams({id:l.agent.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.user.addTeams({id:l.agent.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","agent","$translate","Auth","crudPermissions"],angular.module("app.staff").controller("AgentteamaddController",e)}(),function(){"use strict";function e(e,n,i,s,t,a,o,r,l,d,c){var m=this;m.currentUser=l.getCurrentUser(),m.license=t,m.setting=a,m.passwordPattern=m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.location=n.protocol()+"://"+n.host(),m.agent=d||e.params.agent||{},m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=l.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.hasModulePermissions={},m.selectedTab=e.params.tab||0,m.queueaddchannel=function(e,n,t,a){i.show({controller:"AgentQueueAddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:m.agents?m.agents.rows:[],channel:n,direction:a||"inbound",crudPermissions:m.crudPermissions}})},m.teamadddialog=function(e,n){i.show({controller:"AgentteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,agents:m.agents?m.agents.rows:[],crudPermissions:m.crudPermissions}})},m.changepassworddialog=function(e,n){i.show({controller:"AgentchangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/changepassword/changepassword.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,setting:a,agents:m.agents?m.agents.rows:[],crudPermissions:m.crudPermissions}})},m.onEnableScreenRecordingByAgentSelection=function(){["phoneBarEnableAutomaticScreenRecording"].forEach(function(e){m.agent.phoneBarEnableScreenRecordingByAgent&&(m.agent[e]=!m.agent.phoneBarEnableScreenRecordingByAgent)})},m.onEnableAutomaticScreenRecordingSelection=function(){["phoneBarEnableScreenRecordingByAgent"].forEach(function(e){m.agent.phoneBarEnableAutomaticScreenRecording&&(m.agent[e]=!m.agent.phoneBarEnableAutomaticScreenRecording)})},m.alert=r.info,m.gotoAgents=function(){e.go("app.staff.agents",{},{reload:"app.staff.agents"})},m.saveAgent=function(){m.agent=_.omit(m.agent,"userpic"),o.user.update({id:m.agent.id},m.agent).$promise.then(function(){r.success({title:"Agent updated!",msg:m.agent.name?m.agent.name+" has been updated!":""})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuser",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.refreshAgent=function(){return o.user.get({id:m.agent.id,userSetting:!0}).$promise.then(function(e){m.agent=e})},l.hasRole("admin")?o.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.contexts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.contexts=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.contexts,{id:e.resourceId})}),t=null;if(m.agent&&(t=_.find(m.contexts,{name:m.agent.context})),t&&!_.some(n,["id",t.id])){var a=_.find(m.contexts,{id:t.id});a.canSelect=!1,n.push(a)}m.contexts=n}):o.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){m.contexts=e.rows||[]})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","license","setting","api","toasty","Auth","agent","userProfileSection"],angular.module("app.staff").controller("AgentController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="STAFF.EDIT_TEAM",g.team=angular.copy(l),g.teams=r,g.newTeam=!1,g.team||(g.team={},g.title="STAFF.NEW_TEAM",g.newTeam=!0),g.addNewTeam=function(){g.errors=[],d.team.save(g.team).$promise.then(function(e){g.teams.unshift(e.toJSON()),o.success({title:"Team properly created",msg:g.team.name?g.team.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.team.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.team.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTeam=function(){g.errors=[],d.team.update({id:g.team.id},g.team).$promise.then(function(e){var n=_.find(g.teams,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Team properly saved!",msg:g.team.name?g.team.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.team.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.team.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTeam=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The team will be deleted.").ariaLabel("Delete Team").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.team.delete({id:g.team.id}).$promise.then(function(){_.remove(g.teams,{id:g.team.id}),o.success({title:"Team properly deleted!",msg:(g.team.name||"team")+" has been deleted!"}),v(g.team)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.team.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.team.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","teams","team","api","Auth","license","setting","crudPermissions"],angular.module("app.staff").controller("CreateOrEditTeamDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.team.getAgents({id:c.team.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserTeam?"penalty "+e.UserTeam.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.team=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.team.removeAgents({id:c.team.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.team.addAgents({id:c.team.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("STAFF.ALL_AGENTS"),labelSelected:r.instant("STAFF.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","team","teams","realtime","$translate","Auth","crudPermissions"],angular.module("app.staff").controller("TeamagentaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.teams=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="teams",f.listOrder="",f.listOrderAsc=null,f.selectedTeams=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditTeamDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{team:e,teams:f.teams.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"TeamagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{team:e,teams:f.teams?f.teams.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("team")+"?").htmlContent("<b>"+(e.name||"team")+"</b> will be deleted.").ariaLabel("delete team").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTeams=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.team.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Teams",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTeam=function(e,n){i.show({controller:"CreateOrEditTeamDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{team:n,teams:f.teams.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTeam=y,f.exportSelectedTeams=function(){var e=angular.copy(f.selectedTeams);return f.selectedTeams=[],e},f.deleteSelectedTeams=function(e){var n=i.confirm().title("Are you sure want to delete the selected teams?").htmlContent("<b>"+f.selectedTeams.length+" selected</b> will be deleted.").ariaLabel("delete Teams").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTeams.forEach(function(e){y(e)}),f.selectedTeams=[]})},f.deselectTeams=function(){f.selectedTeams=[]},f.selectAllTeams=function(){f.selectedTeams=f.teams.rows};var b=!0,A=1;function E(e){f.teams=e||{count:0,rows:[]}}function y(e){m.team.delete({id:e.id}).$promise.then(function(){_.remove(f.teams.rows,{id:e.id}),f.teams.count-=1,f.teams.rows.length||f.getTeams(),p.success({title:_.startCase("Team")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEteam"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEteam",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTeams())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","teams","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.staff").controller("TeamsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="STAFF.EDIT_TELEPHONE",g.telephone=angular.copy(l),g.telephones=r,g.newTelephone=!1,g.telephone||(g.telephone={role:"telephone",autointernal:!0,context:"from-sip"},g.title="STAFF.NEW_TELEPHONE",g.newTelephone=!0),g.addNewTelephone=function(){g.errors=[],d.user.save(g.telephone).$promise.then(function(e){g.telephones.unshift(e.toJSON()),o.success({title:"Telephone properly created",msg:g.telephone.name?g.telephone.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTelephone=function(){g.errors=[],d.user.update({id:g.telephone.id},g.telephone).$promise.then(function(e){var n=_.find(g.telephones,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Telephone properly saved!",msg:g.telephone.name?g.telephone.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.user.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTelephone=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The telephone will be deleted.").ariaLabel("Delete Telephone").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.user.delete({id:g.telephone.id}).$promise.then(function(){_.remove(g.telephones,{id:g.telephone.id}),o.success({title:"Telephone properly deleted!",msg:(g.telephone.name||"telephone")+" has been deleted!"}),v(g.telephone)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.user.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","telephones","telephone","api","Auth","license","setting","crudPermissions"],angular.module("app.staff").controller("CreateOrEditTelephoneDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.currentUser=o.getCurrentUser(),r.errors=[],r.setting=s,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.telephone=i,r.password="",r.oldPassword="",r.savePassword=function(){r.errors=[];var e={id:r.telephone.id,newPassword:r.password};r.currentUser.id==r.telephone.id&&(e.oldPassword=r.oldPassword);a.user.changePassword(e).$promise.then(function(){n.success({title:"Telephone password properly updated!"}),l()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.telephone.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),r.errors=e.data.errors||[{message:e.toString(),type:"api.telephone.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.telephoneForm.password.$setValidity("oldPasswordMatch",!1):t.telephoneForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","toasty","api","telephone","setting","Auth"],angular.module("app.staff").controller("TelephonechangepasswordController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.telephone=c||e.params.telephone||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.changepassworddialog=function(e,n){t.show({controller:"TelephonechangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/telephones/edit/changepassword/changepassword.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{telephone:e,setting:o,telephones:u.telephones?u.telephones.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoTelephones=function(){e.go("app.staff.telephones",{},{reload:"app.staff.telephones"})},u.saveTelephone=function(){r.user.update({id:u.telephone.id},u.telephone).$promise.then(function(){l.success({title:"Telephone updated!",msg:u.telephone.name?u.telephone.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuser",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),t=null;if(u.telephone&&(t=_.find(u.contexts,{name:u.telephone.context})),t&&!_.some(n,["id",t.id])){var a=_.find(u.contexts,{id:t.id});a.canSelect=!1,n.push(a)}u.contexts=n}):r.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){u.contexts=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","telephone","userProfileSection"],angular.module("app.staff").controller("TelephoneController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.telephones=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="telephones",f.listOrder="",f.listOrderAsc=null,f.selectedTelephones=[],f.query={fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",role:"telephone",sort:"-updatedAt",limit:10,page:1},f.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"},{option:"tls",value:"'tls'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayallow=_.keyBy([{option:"ulaw",value:"'ulaw'"},{option:"alaw",value:"'alaw'"},{option:"gsm",value:"'gsm'"},{option:"g722",value:"'g722'"},{option:"g729",value:"'g729'"},{option:"opus",value:"'opus'"},{option:"h264",value:"'h264'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayencryption=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.staff.telephones.edit",{id:e.id,telephone:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("telephone")+"?").htmlContent("<b>"+(e.name||"telephone")+"</b> will be deleted.").ariaLabel("delete telephone").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTelephones=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.user.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Telephones",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTelephone=function(e,n){i.show({controller:"CreateOrEditTelephoneDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/telephones/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{telephone:n,telephones:f.telephones.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTelephone=y,f.exportSelectedTelephones=function(){var e=angular.copy(f.selectedTelephones);return f.selectedTelephones=[],e},f.deleteSelectedTelephones=function(e){var n=i.confirm().title("Are you sure want to delete the selected telephones?").htmlContent("<b>"+f.selectedTelephones.length+" selected</b> will be deleted.").ariaLabel("delete Telephones").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTelephones.forEach(function(e){y(e)}),f.selectedTelephones=[]})},f.deselectTelephones=function(){f.selectedTelephones=[]},f.selectAllTelephones=function(){f.selectedTelephones=f.telephones.rows};var b=!0,A=1;function E(e){f.telephones=e||{count:0,rows:[]}}function y(e){m.user.delete({id:e.id}).$promise.then(function(){_.remove(f.telephones.rows,{id:e.id}),f.telephones.count-=1,f.telephones.rows.length||f.getTelephones(),p.success({title:_.startCase("Telephone")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuser",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTelephones())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","telephones","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.staff").controller("TelephonesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="STAFF.EDIT_USERPROFILE",g.userProfile=angular.copy(l),g.userProfiles=r,g.newUserProfile=!1,g.userProfile||(g.userProfile={crudPermissions:["r"],downloadAttachments:!0,downloadCallySquareRecordings:!0,downloadContactManagerLists:!0,downloadJscriptySessions:!0,downloadOmnichannelInteractions:!0,downloadScreenRecordings:!0,downloadVoiceRecordings:!0},g.title="STAFF.NEW_USERPROFILE",g.newUserProfile=!0),g.addNewUserProfile=function(){g.errors=[],d.userProfile.save(g.userProfile).$promise.then(function(e){var n,t;t=[],(n=e).crudPermissions.forEach(function(e){var n;switch(e){case"r":n="READ_PERMISSION";break;case"e":n="EDIT_PERMISSION";break;case"d":n="DELETE_PERMISSION"}t.push(s.instant("STAFF."+n))}),n.selectedcrudPermissions=t.join(", "),g.userProfiles.unshift(e.toJSON()),o.success({title:"UserProfile properly created",msg:g.userProfile.name?g.userProfile.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveUserProfile=function(){g.errors=[],d.userProfile.update({id:g.userProfile.id},g.userProfile).$promise.then(function(e){var n=_.find(g.userProfiles,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"UserProfile properly saved!",msg:g.userProfile.name?g.userProfile.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteUserProfile=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The userProfile will be deleted.").ariaLabel("Delete UserProfile").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.userProfile.delete({id:g.userProfile.id}).$promise.then(function(){_.remove(g.userProfiles,{id:g.userProfile.id}),o.success({title:"UserProfile properly deleted!",msg:(g.userProfile.name||"userProfile")+" has been deleted!"}),v(g.userProfile)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","userProfiles","userProfile","api","Auth","license","setting","crudPermissions"],angular.module("app.staff").controller("CreateOrEditUserProfileDialogController",e)}(),function(){"use strict";function e(n,a,i,e,t,s,o){var r=this;function l(e){n.hide(e)}r.newUserProfile=!0,r.userProfile=angular.copy(t),r.userProfiles=s,r.title=o.instant("STAFF.CLONE_USERPROFILE"),t&&t.name&&(r.title+=": "+t.name),r.cloneUserProfile=function(){return e.userProfile.clone({id:t.id},r.userProfile).$promise.then(function(e){var n,t;t=[],(n=e).crudPermissions.forEach(function(e){var n;switch(e){case"r":n="READ_PERMISSION";break;case"e":n="EDIT_PERMISSION";break;case"d":n="DELETE_PERMISSION"}t.push(o.instant("STAFF."+n))}),n.selectedcrudPermissions=t.join(", "),r.userProfiles.unshift(e.toJSON()),i.success({title:"UserProfile properly cloned",msg:r.userProfile.name?r.userProfile.name+" has been cloned!":""}),a.go("app.staff.userProfiles.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.clone"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","userProfile","userProfiles","$translate"],angular.module("app.staff").controller("UserProfilecloneController",e)}(),function(){"use strict";function e(t,o,r,l,d,e,n,c){var m=this;function u(e,n){switch(e.allResourcesEnabled="full"===n,n){case"full":return _.find(m.statusList,["tag","full"]);case"partial":return _.find(m.statusList,["tag","partial"]);case"disabled":return _.find(m.statusList,["tag","disabled"]);case"unlicensed":return _.find(m.statusList,["tag","unlicensed"]);case"unknown":default:return _.find(m.statusList,["tag","unknown"])}}function p(e){return l(function(n,t){var o,a;void 0!==e.channel&&_.includes(e.route,"Queue")?(a=e,l(function(n,t){var e=void 0!==a.channel&&"bull"===a.channel?"outbound":"inbound";return d[a.route].get({fields:"id,name,strategy,type",channel:"bull"===a.channel?"voice":a.channel,type:e,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})).then(function(e){n(e)}).catch(function(e){t(e)}):(o=e,l(function(a,n){switch(o.route){case"voiceExtension":var e;switch(o.title){case"InboundRoutes":e="inbound";break;case"OutboundRoutes":e="outbound";break;case"InternalRoutes":e="internal"}break;case"interval":var t=!0;break;case"disposition":var i=!0;break;case"user":var s;switch(o.title){case"Agents":s="agent";break;case"Telephones":s="telephone";break;case"Users":s="user"}}if("Reports"===o.title){if(!o.reportType)return d.analyticDefaultReport.get({nolimit:!0}).$promise.then(function(t){d.analyticCustomReport.get({nolimit:!0}).$promise.then(function(e){var n=_.union(t.rows,e.rows);a({count:n.length,rows:n.rows})})}).catch(function(e){n(e)});switch(o.reportType){case"default":o.route="analyticDefaultReport";break;case"custom":o.route="analyticCustomReport"}}return d[o.route].get({role:s||void 0,type:e||void 0,VoiceExtensionId:e?"null":void 0,IntervalId:t?"null":void 0,MailAccountId:i?"null":void 0,FaxAccountId:i?"null":void 0,SmsAccountId:i?"null":void 0,OpenchannelAccountId:i?"null":void 0,ChatWebsiteId:i?"null":void 0,WhatsappAccountId:i?"null":void 0,ListId:i?"null":void 0,nolimit:!0}).$promise.then(function(e){a(e)}).catch(function(e){n(e)})})).then(function(e){n(e)}).catch(function(e){t(e)})})}function g(e,n,t){var a=e&&0<e.length?e[0]:null;if(!a)return t;var i,s,o=_.find(n,["sectionId",a.id]);return o?(n=_.remove(n,["sectionId",a.id]),(i=a,s=o.id,l(function(n,t){d.userProfileResource.get({sectionId:s}).$promise.then(function(n){return p(i).then(function(e){return _.differenceBy(n.rows,e.rows,"id")})}).then(function(e){_.isEmpty(e)?n():t()}).catch(function(e){t(e)})})).then(function(){return t="full",g(e.shift(),n,t)}).catch(function(e){return l.reject(e)})):void 0}function a(a){var t="Marketplace"===a.title?"AppZone":a.title;m.license?void 0===a.permissions||a.permissions.association?void 0===a.license||m.license[a.license]?d.userProfileSection.get({userProfileId:m.userProfile.id,category:t}).$promise.then(function(e){var n=e&&e.rows&&0<e.rows.length?e.rows:[];if("Dashboards"===a.title)return _.isEmpty(n)?"disabled":n[0].autoAssociation?"full":d.userProfileResource.get({sectionId:n[0].id,resourceId:101}).$promise.then(function(e){return(e&&e.rows?e.rows[0]:null)?"full":"partial"});var t=_.filter(a.children,function(e){return void 0!==e.permissions&&e.permissions.hidden?void 0:e});return n.length!==t.length?0===n.length?"disabled":"partial":_.every(n,["autoAssociation",!0])?"full":g(_.filter(t,function(e){return void 0===e.permissions||e.permissions.association?e:void 0}),n,"partial")}).then(function(e){a.status=u(a,e)}).catch(function(e){var n=e?"unknown":"partial";a.status=u(a,n),e&&c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GETRESOURCES("+t.toUpperCase()+")",msg:e.status?JSON.stringify(e.data):e.toString()})}):a.status=u(a,"unlicensed"):d.userProfileSection.get({userProfileId:m.userProfile.id,sectionId:a.id}).$promise.then(function(e){var n=(e&&1===e.rows.length?e.rows[0]:null)?"full":"disabled";a.status=u(a,n)}):a.status=u(a,"unknown")}m.userProfile={},m.license={},m.navigation=e.getNavigation(),m.modules=m.navigation[0].children,m.statusList=[{id:0,name:"Fully Enabled",color:"green-A700-bg",info:"All resources enabled",tag:"full"},{id:1,name:"Partially Enabled",color:"orange-A700-bg",info:"Some resources enabled",tag:"partial"},{id:2,name:"Disabled",color:"grey-A400-bg",info:"No resources enabled",tag:"disabled"},{id:3,name:"Unlicensed",color:"red-A700-bg",info:"Module not included in the license",tag:"unlicensed"},{id:4,name:"Unknown",color:"grey-A700-bg",info:"Unknown status",tag:"unknown"}],m.dashboardSections=[{title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",id:100}],m.init=function(e,n){m.userProfile=e,m.license=n},m.onChangeEnableAllResources=function(n){var e=void 0!==n.permissions&&!n.permissions.association,a="Marketplace"===n.title?"AppZone":n.title;if("Fully Enabled"!==n.status.name){var i=[];if(e)return i.push({category:a,sectionId:n.id,name:a,enabled:!0,crudPermissions:"red"}),d.userProfile.addSections({id:m.userProfile.id},i).$promise.then(function(){n.status=u(n,"full"),c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_MESSAGE_NO_RESOURCES",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name})})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.ADDSECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()})});var t=o.confirm({skipHide:!0}).title("Warning").textContent(r.instant("STAFF.PERMISSIONS_WARNING_ENABLE_ALL",{sectionName:r.instant(n.translate)})).ariaLabel("Warning").ok(r.instant("STAFF.CONFIRM")).cancel(r.instant("STAFF.CANCEL"));o.show(t).then(function(){switch(a){case"Dashboards":_.map(m.dashboardSections,function(e){i.push({category:a,sectionId:e.id,name:e.title,enabled:!0,autoAssociation:!0,crudPermissions:_.map(m.userProfile.crudPermissions).join("")})});break;default:_.map(n.children,function(e){var n=!(void 0===e.permissions||!e.permissions.hidden);if(!n){var t=e.title;switch(a){case"CallySquare":t="Projects"===t?"SquareProjects":t}i.push({category:a,sectionId:e.id,name:t,enabled:!0,autoAssociation:!0,crudPermissions:_.map(m.userProfile.crudPermissions).join("")})}})}return d.userProfile.addSections({id:m.userProfile.id},i).$promise.then(function(){n.status=u(n,"full"),c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_MESSAGE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name})})})}).catch(function(e){e?c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.ADDSECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()}):n.status=u(n,n.status.tag)})}else if("Fully Enabled"===n.status.name){n.status=u(n,"disabled");var s=[];switch(a){case"Settings":case"Help":s=[n.id];break;case"Dashboards":s=_.map(m.dashboardSections,function(e){return e.id});break;default:s=_.map(n.children,function(e){return e.id})}return d.userProfile.removeSections({id:m.userProfile.id,ids:s}).$promise.then(function(){c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_DISABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_DISABLED_ALL_SUCCESS_MESSAGE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name})})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.REMOVESECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()})})}},m.manageResources=function(e,n){o.show({controller:"UserProfilepermissionsmanageController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!1,locals:{userProfile:m.userProfile,userProfiles:[],section:e}}).then(function(){a(e)})},m.checkSectionResources=a}e.$inject=["$document","$mdDialog","$translate","$q","api","msNavigationService","Auth","toasty"],angular.module("app.staff").controller("UserProfilePermissionsController",e)}(),function(){"use strict";function e(n,t,i,o,r,e,a,l,s,d){var c=this;function m(){var a=void 0!==c.selectedSection.pending&&c.selectedSection.pending;return i(function(t,n){r.userProfileSection.get({userProfileId:c.userProfile.id,sectionId:c.selectedSection.id}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;a||(c.selectedSection.enabled=!!n&&!!n.enabled,c.selectedSection.autoAssociation=!!n&&!!n.autoAssociation,c.selectedSection.crudPermissions=v(n?n.crudPermissions:c.userProfile.crudPermissions)),t(n)}).catch(function(e){n(e)})})}function u(){return i(function(n,t){c.loadedSection?r.userProfileResource.get({sectionId:c.loadedSection.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)}):n(null)})}function p(){return i(function(n,t){void 0!==c.selectedSection.channel&&_.includes(c.selectedSection.route,"Queue")?i(function(n,t){var e=void 0!==c.selectedSection.channel&&"bull"===c.selectedSection.channel?"outbound":"inbound";return r[c.selectedSection.route].get({fields:"id,name,strategy,type",channel:"bull"===c.selectedSection.channel?"voice":c.selectedSection.channel,type:e,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){n(e)}).catch(function(e){t(e)}):i(function(n,t){var e,a;if("voiceExtension"===c.selectedSection.route)switch(c.selectedSection.title){case"InboundRoutes":e="inbound";break;case"OutboundRoutes":e="outbound";break;case"InternalRoutes":e="internal"}if("user"===c.selectedSection.route)switch(c.selectedSection.title){case"Agents":a="agent";break;case"Telephones":a="telephone";break;case"Users":a="user"}if("interval"===c.selectedSection.route)var i=!0;if("disposition"===c.selectedSection.route)var s=!0;if("Reports"===c.selectedSection.title&&(c.selectedSection.route="default"===c.selectedSection.reportType?"analyticDefaultReport":"analyticCustomReport"),"Dashboards"!==c.selectedSection.title)return r[c.selectedSection.route].get({role:a||void 0,type:e||void 0,VoiceExtensionId:e?"null":void 0,IntervalId:i?"null":void 0,MailAccountId:s?"null":void 0,FaxAccountId:s?"null":void 0,SmsAccountId:s?"null":void 0,OpenchannelAccountId:s?"null":void 0,ChatWebsiteId:s?"null":void 0,WhatsappAccountId:s?"null":void 0,ListId:s?"null":void 0,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)});n({count:1,rows:[{id:101,name:l.instant("DASHBOARDS.GENERAL")}]})}).then(function(e){n(e)}).catch(function(e){t(e)})})}function g(){var i=void 0!==c.selectedSection.pending&&c.selectedSection.pending,s=[];return u().then(function(e){var n;return s=e&&e.rows?e.rows:[],"Reports"===c.selectedSection.title&&(c.associatedReports=c.associatedReports?c.associatedReports:s,n=c.associatedReports,s=_.filter(n,{type:"default"===c.selectedSection.reportType?"DefaultReports":"CustomReports"})),void 0===c.selectedSection.permissions||c.selectedSection.permissions.association?p():{rows:[]}}).then(function(e){c.items=e.rows?_.map(e.rows,function(e){var n,t;return"Reports"===c.selectedSection.title&&(e.fullPath=(n=e.parent,t=c.treeStructure[0].text,t=function e(n,t,a){if(!a||_.isEmpty(a.children))return n;var a=_.find(a.children,function(e){return _.includes(t,e.id)?e:void 0});return n+=a?"/"+a.text:"",e(n,t,a)}(t,n,c.treeStructure[0])).replace(" ","_")),e.isValid=!0,e}):[],i||(c.selectedSection.selectedItems=_.map(s,function(e){return _.find(c.items,{id:e.resourceId})}));var n,t=_.differenceBy(c.selectedSection.selectedItems,c.items,"id");switch(_.isEmpty(t)||(c.selectedSection.selectedItems=_.pullAllBy(c.selectedSection.selectedItems,t,"id")),c.selectedSection.title){case"Contexts":c.selectedSection.selectedItems=_.filter(c.items,function(e){return e.defaultEntry?(e.isValid=!1,e):void 0!==_.find(s,{resourceId:e.id})?(e.isValid=!0,e):void 0});break;case"MusicOnHolds":c.selectedSection.selectedItems=_.filter(c.items,function(e){return e.defaultEntry?(e.isValid=!1,e):void 0!==_.find(s,{resourceId:e.id})?(e.isValid=!0,e):void 0});break;case"Reports":var a=(n=c.allReportsSelected,_.filter(n,function(e){return _.startsWith(e.parent,"default"===c.selectedSection.reportType?"motion":"custom")}));c.selectedSection.selectedItems=b(c.selectedSection.selectedItems),c.selectedSection.selectedItems=_.unionBy(c.selectedSection.selectedItems,a,"id")}c.dualMultiselectOptions.selectedItems=c.selectedSection.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.items,c.dualMultiselectOptions.selectedItems,"id")}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET"+c.selectedSection.title.toUpperCase(),msg:e.status?JSON.stringify(e.data):e.toString()})})}function v(e){return e&&(c.selectedSection.allowEdit=!!_.includes(e,"e"),c.selectedSection.allowDelete=!!_.includes(e,"d")),function(){var e=["r"];if(c.selectedSection.allowEdit)e.push("e");else{var n=_.indexOf(e,["e"]);0<n&&c.selectedSection.crudPermissions.replace("e","")}if(c.selectedSection.allowDelete)e.push("d");else{var n=_.indexOf(e,["d"]);0<n&&c.selectedSection.crudPermissions.replace("d","")}return e}()}function h(e){var n=_.findIndex(c.subsections,function(e){return e.id==c.selectedSection.id});c.subsections[n].pending=e,f()}function f(){return c.pendingChanges=_.some(c.subsections,["pending",!0])}function b(e){return _.remove(e,function(e){return _.startsWith(e.parent,"default"===c.selectedSection.reportType?"motion":"custom")})}function A(){_.isEmpty(c.selectedSection.selectedItems)?c.allReportsSelected=_.remove(c.allReportsSelected,function(e){return e.type===("default"===c.selectedSection.reportType?"CustomReports":"DefaultReports")}):c.selectedSection.selectedItems.forEach(function(e){_.some(c.allReportsSelected,{id:e.id,parent:e.parent})||c.allReportsSelected.push(e)})}c.userProfile=e,c.penalty=0,c.section=angular.copy(d),c.title=l.instant("STAFF.PERMISSIONS_SECTION_TITLE",{sectionName:l.instant(c.section.translate)}),c.items=[],c.selectedItems=[],c.subsections=_.filter(c.section.children,function(e){return void 0!==e.permissions&&e.permissions.hidden?void 0:e}),c.dashboardSections=[{title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",id:100}],c.dashboardItems=[],"Dashboards"===c.section.title&&(c.dashboardItems=c.subsections,c.subsections=c.dashboardSections),c.selectedSection=null,c.loadedSection=null,c.allReportsSelected=[],c.closeDialog=function(e){if(c.pendingChanges){var n=t.confirm({skipHide:!0}).title("Warning").textContent(l.instant("STAFF.PERMISSIONS_WARNING_CLOSE")).ariaLabel("Warning").targetEvent(e).ok(l.instant("STAFF.CLOSE")).cancel(l.instant("STAFF.CANCEL"));t.show(n).then(function(){t.hide()})}else t.hide()},c.onChangeSection=function(){return m().then(function(e){if(c.loadedSection=e,"Reports"===c.selectedSection.title)return i(function(n,t){r.analyticTreeReport.get({}).$promise.then(function(e){c.treeReports=e.rows||[],n(c.treeReports)}).catch(function(e){t(e)})}).then(function(){if(!c.selectedSection.reportType)return u().then(function(e){c.allReportsSelected=e?_.map(e.rows,function(e){return{id:e.resourceId,name:e.name,type:e.type}}):[]})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREE_REPORT_STRUCTURE",msg:e.data?JSON.stringify(e.data):e.toString()})});g()}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET"+c.selectedSection.title.toUpperCase(),msg:e.status?JSON.stringify(e.data):e.toString()})})},c.onChangeVisibility=function(){c.selectedSection.enabled=!c.selectedSection.enabled,h(!0)},c.onChangeAutoAssociation=function(){if(!c.selectedSection.autoAssociation){for(var e=[],n=0;n<c.dualMultiselectOptions.items.length;n++)e.push(c.dualMultiselectOptions.items[n]),c.dualMultiselectOptions.selectedItems.push(c.dualMultiselectOptions.items[n]);c.dualMultiselectOptions.items=[],c.dualMultiselectOptions.transferCallback(e,!1)}h(!0)},c.onChangeReportType=function(){c.treeStructure="default"===c.selectedSection.reportType?c.treeReports[0]?angular.fromJson(c.treeReports[0].tree):[]:c.treeReports[1]?angular.fromJson(c.treeReports[1].tree):[],c.selectedSection.selectedItems&&(c.allReportsSelected=b(c.allReportsSelected),A());g()},c.setPermission=function(e){"edit"===e?c.selectedSection.allowEdit=!c.selectedSection.allowEdit:"delete"===e&&(c.selectedSection.allowDelete=!c.selectedSection.allowDelete);c.selectedSection.crudPermissions=v(),h(!0)},c.saveSection=function(){var a="Marketplace"===c.section.title?"AppZone":c.section.title,e=_(c.subsections).filter({pending:!0}).map(function(e){var n="CallySquare"===a&&"Projects"===e.title?"SquareProjects":e.title,t="Reports"===n?c.allReportsSelected:e.selectedItems;return"Integrations"===a&&(e.autoAssociation=!0),{category:a,sectionId:e.id,name:n,enabled:e.enabled,autoAssociation:e.autoAssociation,crudPermissions:_.map(e.crudPermissions).join(""),Resources:_.map(t,function(e){return{name:e.name,resourceId:e.id,type:function(e,n){if("Reports"!==e)return e;{if(n.parent){var t=_.startsWith(n.parent,"motion")?"Default":"Custom";return t+e}return n.type}}(n,e)}})}}).value();return r.userProfile.addSections({id:c.userProfile.id},e).$promise.then(function(){c.subsections.forEach(function(e){e.pending=void 0}),c.associatedReports=null,f(),"Reports"!==c.selectedSection.title||c.selectedSection.reportType||n.userProfileForm.$setPristine(),o.success({title:l.instant("STAFF.NOTIFICATIONS.PERMISSIONS_SAVED_SUCCESS_TITLE",{sectionName:l.instant(a.translate)}),msg:l.instant("STAFF.NOTIFICATIONS.PERMISSIONS_SAVED_SUCCESS_MESSAGE")})}).then(function(){return m().then(function(e){c.loadedSection=e})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.ADDSECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",line4:"fullPath",labelAll:l.instant("STAFF.PERMISSIONS_ALL_RESOURCES"),labelSelected:l.instant("STAFF.PERMISSIONS_SELECTED_RESOURCES"),transferCallback:function(e,n){h(!0),n?(c.selectedSection.selectedItems=_.pullAllBy(c.selectedSection.selectedItems,e,"id"),c.selectedSection.autoAssociation=!1):c.selectedSection.selectedItems=_.unionBy(c.selectedSection.selectedItems,e,"id"),"Reports"===c.selectedSection.title&&A()}}}e.$inject=["$scope","$mdDialog","$q","toasty","api","userProfile","userProfiles","$translate","Auth","section"],angular.module("app.staff").controller("UserProfilepermissionsmanageController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.userProfile=c||e.params.userProfile||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.permissionsmanagedialog=function(e,n){t.show({controller:"UserProfilepermissionsmanageController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:u.userProfiles?u.userProfiles.rows:[],crudPermissions:u.crudPermissions}})},u.clonedialog=function(e,n){t.show({controller:"UserProfilecloneController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/clone/clone.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:u.userProfiles?u.userProfiles.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoUserProfiles=function(){e.go("app.staff.userProfiles",{},{reload:"app.staff.userProfiles"})},u.saveUserProfile=function(){r.userProfile.update({id:u.userProfile.id},u.userProfile).$promise.then(function(){l.success({title:"UserProfile updated!",msg:u.userProfile.name?u.userProfile.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuserProfile",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","userProfile","userProfileSection"],angular.module("app.staff").controller("UserProfileController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.userProfiles=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="userProfiles",f.listOrder="",f.listOrderAsc=null,f.selectedUserProfiles=[],f.query={fields:"createdAt,updatedAt,id,name,description,crudPermissions,privacyEnabled,downloadAttachments,downloadCallySquareRecordings,downloadContactManagerLists,downloadJscriptySessions,downloadOmnichannelInteractions,downloadScreenRecordings,downloadVoiceRecordings",sort:"-updatedAt",limit:10,page:1},f.arraycrudPermissions=_.keyBy([{option:"Read_permission",value:"'r'",disabled:!0},{option:"Edit_permission",value:"'e'"},{option:"Delete_permission",value:"'d'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.userProfiles&&0<f.userProfiles.count&&f.userProfiles.rows.forEach(function(e){var n=[];e.crudPermissions.forEach(function(e){n.push(f.arraycrudPermissions[e].option)});var t=[];n.forEach(function(e){t.push(r.instant("STAFF."+e.toUpperCase()))}),e.selectedcrudPermissions=t.join(", ")}),f.editstate=function(e,n){t.go("app.staff.userProfiles.edit",{id:e.id,userProfile:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"UserProfilecloneController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:f.userProfiles?f.userProfiles.rows:[],crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("userProfile")+"?").htmlContent("<b>"+(e.name||"userProfile")+"</b> will be deleted.").ariaLabel("delete userProfile").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getUserProfiles=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.userProfile.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="UserProfiles",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditUserProfile=function(e,n){i.show({controller:"CreateOrEditUserProfileDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{userProfile:n,userProfiles:f.userProfiles.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteUserProfile=y,f.exportSelectedUserProfiles=function(){var e=angular.copy(f.selectedUserProfiles);return f.selectedUserProfiles=[],e},f.deleteSelectedUserProfiles=function(e){var n=i.confirm().title("Are you sure want to delete the selected userProfiles?").htmlContent("<b>"+f.selectedUserProfiles.length+" selected</b> will be deleted.").ariaLabel("delete UserProfiles").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedUserProfiles.forEach(function(e){y(e)}),f.selectedUserProfiles=[]})},f.deselectUserProfiles=function(){f.selectedUserProfiles=[]},f.selectAllUserProfiles=function(){f.selectedUserProfiles=f.userProfiles.rows};var b=!0,A=1;function E(e){f.userProfiles=e||{count:0,rows:[]}}function y(e){m.userProfile.delete({id:e.id}).$promise.then(function(){_.remove(f.userProfiles.rows,{id:e.id}),f.userProfiles.count-=1,f.userProfiles.rows.length||f.getUserProfiles(),p.success({title:_.startCase("UserProfile")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuserProfile"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuserProfile",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getUserProfiles())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","userProfiles","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.staff").controller("UserProfilesController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c){var m=this;function u(){return s.user.get({id:m.agent.id,userSetting:!0}).$promise.then(function(e){m.user=e})}function p(e){t.hide(e)}m.currentUser=o.getCurrentUser(),m.errors=[],m.setting=l,m.license=r,m.crudPermissions=d,m.hasModulePermissions={},m.passwordPattern=m.setting&&m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.title="STAFF.EDIT_USER",m.user=angular.copy(i),m.users=n,m.newUser=!1,m.user||(m.user={role:"user",autointernal:!0,context:"from-sip"},m.title="STAFF.NEW_USER",m.newUser=!0),m.addNewUser=function(){m.errors=[],s.user.save(m.user).$promise.then(function(e){m.users.unshift(e.toJSON()),a.success({title:"User properly created",msg:m.user.name?m.user.name+" has been created!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveUser=function(){m.errors=[],s.user.update({id:m.user.id},m.user).$promise.then(function(e){var n=_.find(m.users,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"User properly saved!",msg:m.user.name?m.user.name+" has been saved!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteUser=function(e){if(o.getCurrentUser().id===m.user.id)return a.error({title:"User not deleted!",msg:"You can't remove yourself"});m.errors=[];var n=t.confirm().title("Are you sure?").content("The user will be deleted.").ariaLabel("Delete User").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){s.user.delete({id:m.user.id}).$promise.then(function(){_.remove(m.users,{id:m.user.id}),a.success({title:"User properly deleted!",msg:(m.user.name||"user")+" has been deleted!"}),p(m.user)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},m.getDateFromString=function(e){return null===e?void 0:new Date(e)},m.closeDialog=p,s.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.userProfiles=e.rows||[]}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})});var g="user-setting:update:user-"+m.user.id;c.on(g,u),e.$on("$destroy",function(){c.removeListener(g,u)})}e.$inject=["$scope","$mdDialog","toasty","users","user","api","Auth","license","setting","crudPermissions","socket"],angular.module("app.staff").controller("CreateOrEditUserDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;function o(){e.hide()}s.currentUser=i.getCurrentUser(),s.errors=[],s.user=a,s.generateApiKey=function(){s.errors=[],t.user.createApiKey({id:s.user.id}).$promise.then(function(e){s.user.apiKey=e.api_key||"N/A",n.success({title:"User API key updated!"}),o()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.createApiKey",msg:e.data?JSON.stringify(e.data.message):e.toString()}),s.errors=e.data.errors||[{message:e.toString(),type:"api.user.createApiKey"}]})},s.removeApiKey=function(){s.errors=[],t.user.removeApiKey({id:s.user.id}).$promise.then(function(){s.user.apiKey="N/A",n.success({title:"User API key removed!"}),o()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.removeApiKey",msg:e.data?JSON.stringify(e.data.message):e.toString()}),s.errors=e.data.errors||[{message:e.toString(),type:"api.user.removeApiKey"}]})},s.closeDialog=o}e.$inject=["$mdDialog","toasty","api","user","Auth"],angular.module("app.staff").controller("UserapikeymanagerController",e)}(),function(){"use strict";function e(e,a){var i=this;i.user={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.user.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.user.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.user=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="api/users/"+i.user.id+"/avatar",i.user.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.staff").controller("Userchange_avatarController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.currentUser=o.getCurrentUser(),r.errors=[],r.setting=s,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.user=i,r.password="",r.oldPassword="",r.savePassword=function(){r.errors=[];var e={id:r.user.id,newPassword:r.password};r.currentUser.id==r.user.id&&(e.oldPassword=r.oldPassword);a.user.changePassword(e).$promise.then(function(){n.success({title:"User password properly updated!"}),l()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),r.errors=e.data.errors||[{message:e.toString(),type:"api.user.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.userForm.password.$setValidity("oldPasswordMatch",!1):t.userForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","toasty","api","user","setting","Auth"],angular.module("app.staff").controller("UserchangepasswordController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;m.currentUser=l.getCurrentUser(),m.license=i,m.setting=s,m.passwordPattern=m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.location=n.protocol()+"://"+n.host(),m.user=d||e.params.user||{},m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=l.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.hasModulePermissions={},m.selectedTab=e.params.tab||0,m.apikeymanagerdialog=function(e,n){t.show({controller:"UserapikeymanagerController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/edit/apikeymanager/apikeymanager.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{user:e,users:m.users?m.users.rows:[],crudPermissions:m.crudPermissions}})},m.changepassworddialog=function(e,n){t.show({controller:"UserchangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/edit/changepassword/changepassword.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{user:e,setting:s,users:m.users?m.users.rows:[],crudPermissions:m.crudPermissions}})},m.alert=r.info,m.gotoUsers=function(){e.go("app.staff.users",{},{reload:"app.staff.users"})},m.saveUser=function(){m.user=_.omit(m.user,"userpic"),o.user.update({id:m.user.id},m.user).$promise.then(function(){r.success({title:"User updated!",msg:m.user.name?m.user.name+" has been updated!":""})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuser",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.refreshUser=function(){return o.user.get({id:m.user.id,userSetting:!0}).$promise.then(function(e){m.user=e})},o.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.contexts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.userProfiles=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.user.getApiKey({id:m.user.id}).$promise.then(function(e){m.user.apiKey=e.api_key?e.api_key:"N/A"}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_APIKEY",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","license","setting","api","toasty","Auth","user","userProfileSection"],angular.module("app.staff").controller("UserController",e)}(),function(){"use strict";function e(e,t,a,i,s,n,o,r,l,d,c,m,u,p){var g=this;g.license=m,g.setting=u,g.currentUser=c.getCurrentUser(),g.users=n||{count:0,rows:[]},g.userProfile=o,g.userProfileSection=r&&1==r.count?r.rows[0]:null,g.crudPermissions=c.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.table="users",g.listOrder="",g.listOrderAsc=null,g.selectedUsers=[],g.query={fields:"createdAt,updatedAt,role,userProfileId,id,fullname,name,email,phone,mobile,userpic,password,description,autointernal,internal,transport,nat,allow,context,callgroup,pickupgroup,passwordResetAt,apiKey,videosupport,disabled,blocked,adSsoEnabled",role:"admin,user",userSetting:!0,sort:"-updatedAt",limit:10,page:1},g.arrayrole=_.keyBy([{option:"Admin",value:"'admin'"},{option:"User",value:"'user'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"},{option:"tls",value:"'tls'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arrayallow=_.keyBy([{option:"ulaw",value:"'ulaw'"},{option:"alaw",value:"'alaw'"},{option:"gsm",value:"'gsm'"},{option:"g722",value:"'g722'"},{option:"g729",value:"'g729'"},{option:"opus",value:"'opus'"},{option:"h264",value:"'h264'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.editstate=function(e,n){t.go("app.staff.users.edit",{id:e.id,user:e,crudPermissions:g.crudPermissions})},g.deleteconfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the "+_.startCase("user")+"?").htmlContent("<b>"+(e.name||"user")+"</b> will be deleted.").ariaLabel("delete user").targetEvent(n).ok("OK").cancel("CANCEL");a.show(t).then(function(){A(e)},function(){console.log("CANCEL")})},g.success=f,g.getUsers=b,g.createOrEditUser=function(e,n){a.show({controller:"CreateOrEditUserDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{user:n,users:g.users.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions}})},g.deleteUser=A,g.exportSelectedUsers=function(){var e=angular.copy(g.selectedUsers);return g.selectedUsers=[],e},g.deleteSelectedUsers=function(e){var n=a.confirm().title("Are you sure want to delete the selected users?").htmlContent("<b>"+g.selectedUsers.length+" selected</b> will be deleted.").ariaLabel("delete Users").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){g.selectedUsers.forEach(function(e){A(e)}),g.selectedUsers=[]})},g.deselectUsers=function(){g.selectedUsers=[]},g.selectAllUsers=function(){g.selectedUsers=g.users.rows},l.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.userProfiles=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})});var v=!0,h=1;function f(e){g.users=e||{count:0,rows:[]}}function b(){g.query.offset=(g.query.page-1)*g.query.limit,c.hasRole("admin")?g.promise=l.user.get(g.query,f).$promise:(g.query.id=g.userProfile.id,g.query.section="Users",g.promise=l.userProfile.getResources(g.query,f).$promise)}function A(e){l.user.delete({id:e.id}).$promise.then(function(){_.remove(g.users.rows,{id:e.id}),g.users.count-=1,g.users.rows.length||g.getUsers(),d.success({title:_.startCase("User")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuser",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){v?s(function(){v=!1}):(n||(h=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=h),g.getUsers())}),p.on("user-setting:update",b),e.$on("$destroy",function(){p.removeListener("user-setting:update",b)})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","users","userProfile","userProfileSection","api","toasty","Auth","license","setting","socket"],angular.module("app.staff").controller("UsersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.cannedAnswers=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="cannedAnswers",f.listOrder="",f.listOrderAsc=null,f.selectedCannedAnswers=[],f.query={fields:"createdAt,updatedAt,id,key,value,description",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/cannedAnswers/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{cannedAnswer:e,cannedAnswers:f.cannedAnswers.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("cannedAnswer")+"?").htmlContent("<b>"+(e.name||"cannedAnswer")+"</b> will be deleted.").ariaLabel("delete cannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getCannedAnswers=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cannedAnswer.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="CannedAnswers",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditCannedAnswer=function(e,n){i.show({controller:"CreateOrEditCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/cannedAnswers/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{cannedAnswer:n,cannedAnswers:f.cannedAnswers.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteCannedAnswer=y,f.exportSelectedCannedAnswers=function(){var e=angular.copy(f.selectedCannedAnswers);return f.selectedCannedAnswers=[],e},f.deleteSelectedCannedAnswers=function(e){var n=i.confirm().title("Are you sure want to delete the selected cannedAnswers?").htmlContent("<b>"+f.selectedCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete CannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedCannedAnswers.forEach(function(e){y(e)}),f.selectedCannedAnswers=[]})},f.deselectCannedAnswers=function(){f.selectedCannedAnswers=[]},f.selectAllCannedAnswers=function(){f.selectedCannedAnswers=f.cannedAnswers.rows};var b=!0,A=1;function E(e){f.cannedAnswers=e||{count:0,rows:[]}}function y(e){m.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(f.cannedAnswers.rows,{id:e.id}),f.cannedAnswers.count-=1,f.cannedAnswers.rows.length||f.getCannedAnswers(),p.success({title:_.startCase("CannedAnswer")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcannedAnswer"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcannedAnswer",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getCannedAnswers())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","cannedAnswers","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("CannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_CANNEDANSWER",g.cannedAnswer=angular.copy(l),g.cannedAnswers=r,g.newCannedAnswer=!1,g.cannedAnswer||(g.cannedAnswer={},g.title="TOOLS.NEW_CANNEDANSWER",g.newCannedAnswer=!0),g.addNewCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.cannedAnswer).$promise.then(function(e){g.cannedAnswers.unshift(e.toJSON()),o.success({title:"CannedAnswer properly created",msg:g.cannedAnswer.name?g.cannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.cannedAnswer.id},g.cannedAnswer).$promise.then(function(e){var n=_.find(g.cannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"CannedAnswer properly saved!",msg:g.cannedAnswer.name?g.cannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The cannedAnswer will be deleted.").ariaLabel("Delete CannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.cannedAnswer.id}).$promise.then(function(){_.remove(g.cannedAnswers,{id:g.cannedAnswer.id}),o.success({title:"CannedAnswer properly deleted!",msg:(g.cannedAnswer.name||"cannedAnswer")+" has been deleted!"}),v(g.cannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","cannedAnswers","cannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.contact_item_types=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="contact_item_types",f.listOrder="",f.listOrderAsc=null,f.selectedContactItemType=[],f.query={fields:"createdAt,updatedAt,id,name,OrderBy,rgbBackgroundColor",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditContactItemTypeDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/contact_item_types/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{contactItemType:e,contact_item_types:f.contact_item_types.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("contactItemType")+"?").htmlContent("<b>"+(e.name||"contactItemType")+"</b> will be deleted.").ariaLabel("delete contactItemType").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getContactItemType=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.contactItemType.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ContactItemType",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditContactItemType=function(e,n){i.show({controller:"CreateOrEditContactItemTypeDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/contact_item_types/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{contactItemType:n,contact_item_types:f.contact_item_types.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteContactItemType=y,f.exportSelectedContactItemType=function(){var e=angular.copy(f.selectedContactItemType);return f.selectedContactItemType=[],e},f.deleteSelectedContactItemType=function(e){var n=i.confirm().title("Are you sure want to delete the selected contact_item_types?").htmlContent("<b>"+f.selectedContactItemType.length+" selected</b> will be deleted.").ariaLabel("delete ContactItemTypes").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedContactItemType.forEach(function(e){y(e)}),f.selectedContactItemType=[]})},f.deselectContactItemType=function(){f.selectedContactItemType=[]},f.selectAllContactItemType=function(){f.selectedContactItemType=f.contact_item_types.rows};var b=!0,A=1;function E(e){f.contact_item_types=e||{count:0,rows:[]}}function y(e){m.contactItemType.delete({id:e.id}).$promise.then(function(){_.remove(f.contact_item_types.rows,{id:e.id}),f.contact_item_types.count-=1,f.contact_item_types.rows.length||f.getContactItemType(),p.success({title:_.startCase("ContactItemType")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcontactItemType"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcontactItemType",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getContactItemType())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","contact_item_types","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("ContactItemTypesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_CONTACTITEMTYPE",g.contactItemType=angular.copy(l),g.contact_item_types=r,g.newContactItemType=!1,g.contactItemType||(g.contactItemType={rgbBackgroundColor:"#2196f3"},g.title="TOOLS.NEW_CONTACTITEMTYPE",g.newContactItemType=!0),g.addNewContactItemType=function(){g.errors=[],d.contactItemType.save(g.contactItemType).$promise.then(function(e){g.contact_item_types.unshift(e.toJSON()),o.success({title:"ContactItemType properly created",msg:g.contactItemType.name?g.contactItemType.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contactItemType.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contactItemType.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveContactItemType=function(){g.errors=[],isNaN(g.contactItemType.OrderBy)?alert(s.instant("TOOLS.ORDER_BY_NUMERIC")):d.contactItemType.update({id:g.contactItemType.id},g.contactItemType).$promise.then(function(e){var n=_.find(g.contact_item_types,{id:e.id});n&&_.merge(n,_.pick(e.toJSON(),_.keys(n))),o.success({title:"ContactItemType properly saved!",msg:g.contactItemType.name?g.contactItemType.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contactItemType.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contactItemType.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteContactItemType=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The contactItemType will be deleted.").ariaLabel("Delete ContactItemType").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.contactItemType.delete({id:g.contactItemType.id}).$promise.then(function(){_.remove(g.contact_item_types,{id:g.contactItemType.id}),o.success({title:"ContactItemType properly deleted!",msg:(g.contactItemType.name||"contactItemType")+" has been deleted!"}),v(g.contactItemType)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contactItemType.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contactItemType.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","contact_item_types","contactItemType","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditContactItemTypeDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_CUSTOMDASHBOARD",g.customDashboard=angular.copy(l),g.customDashboards=r,g.newCustomDashboard=!1,g.customDashboard||(g.customDashboard={},g.title="TOOLS.NEW_CUSTOMDASHBOARD",g.newCustomDashboard=!0),g.addNewCustomDashboard=function(){g.errors=[],d.dashboard.save(g.customDashboard).$promise.then(function(e){g.customDashboards.unshift(e.toJSON()),o.success({title:"CustomDashboard properly created",msg:g.customDashboard.name?g.customDashboard.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCustomDashboard=function(){g.errors=[],d.dashboard.update({id:g.customDashboard.id},g.customDashboard).$promise.then(function(e){var n=_.find(g.customDashboards,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"CustomDashboard properly saved!",msg:g.customDashboard.name?g.customDashboard.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCustomDashboard=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The customDashboard will be deleted.").ariaLabel("Delete CustomDashboard").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.dashboard.delete({id:g.customDashboard.id}).$promise.then(function(){_.remove(g.customDashboards,{id:g.customDashboard.id}),o.success({title:"CustomDashboard properly deleted!",msg:(g.customDashboard.name||"customDashboard")+" has been deleted!"}),v(g.customDashboard)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","customDashboards","customDashboard","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditCustomDashboardDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.customDashboards=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="customDashboards",f.listOrder="",f.listOrderAsc=null,f.selectedCustomDashboards=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.tools.customDashboards.edit",{id:e.id,customDashboard:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"CustomDashboardcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{customDashboard:e,customDashboards:f.customDashboards?f.customDashboards.rows:[],crudPermissions:f.crudPermissions}})},f.gotodashboardgoto=function(e,n){t.go("app.dashboards.custom",{id:e.id})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("customDashboard")+"?").htmlContent("<b>"+(e.name||"customDashboard")+"</b> will be deleted.").ariaLabel("delete customDashboard").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getCustomDashboards=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.dashboard.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="CustomDashboards",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditCustomDashboard=function(e,n){i.show({controller:"CreateOrEditCustomDashboardDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{customDashboard:n,customDashboards:f.customDashboards.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteCustomDashboard=y,f.exportSelectedCustomDashboards=function(){var e=angular.copy(f.selectedCustomDashboards);return f.selectedCustomDashboards=[],e},f.deleteSelectedCustomDashboards=function(e){var n=i.confirm().title("Are you sure want to delete the selected customDashboards?").htmlContent("<b>"+f.selectedCustomDashboards.length+" selected</b> will be deleted.").ariaLabel("delete CustomDashboards").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedCustomDashboards.forEach(function(e){y(e)}),f.selectedCustomDashboards=[]})},f.deselectCustomDashboards=function(){f.selectedCustomDashboards=[]},f.selectAllCustomDashboards=function(){f.selectedCustomDashboards=f.customDashboards.rows};var b=!0,A=1;function E(e){f.customDashboards=e||{count:0,rows:[]}}function y(e){m.dashboard.delete({id:e.id}).$promise.then(function(){_.remove(f.customDashboards.rows,{id:e.id}),f.customDashboards.count-=1,f.customDashboards.rows.length||f.getCustomDashboards(),p.success({title:_.startCase("CustomDashboard")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdashboard"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdashboard",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getCustomDashboards())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","customDashboards","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("CustomDashboardsController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newCustomDashboard=!0,r.customDashboard=angular.copy(i),r.customDashboards=s,r.title=o.instant("TOOLS.CLONE_CUSTOMDASHBOARD"),i&&i.name&&(r.title+=": "+i.name),r.cloneCustomDashboard=function(){return e.dashboard.clone({id:i.id,includeAll:!0},r.customDashboard).$promise.then(function(e){r.customDashboards.unshift(e.toJSON()),a.success({title:"CustomDashboard properly cloned",msg:r.customDashboard.name?r.customDashboard.name+" has been cloned!":""}),t.go("app.tools.customDashboards.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","customDashboard","customDashboards","$translate"],angular.module("app.tools").controller("CustomDashboardcloneController",e)}(),function(){"use strict";function e(t,a,i,s,o){var r=this;function l(e,n,t){return o.dashboardItem.update(t).$promise.catch(function(e){console.error(e)})}r.customDashboard={},r.init=function(e,n){r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.customDashboard=e,r.customDashboard.draggable={enabled:!0,handle:".draggable",stop:l},r.customDashboard.resizable={enabled:!0,handle:".resizable",stop:l},r.customDashboard.widgets=[];var t=_.map(["chat","fax","mail","openchannel","sms","voice","whatsapp"],function(e){return"voice"===e?o.rpc.getVoiceQueues({fields:"id,name"}).$promise.then(function(e){r.voiceQueues=e}):(a=(t="chat"===(n=e)?n+"Website":n+"Account")+"s",o[t].get({fields:"id,name"}).$promise.then(function(e){r[a]=e||{count:0,rows:[]}}));var n,t,a});return i.all(t).then(function(){return o.dashboard.getItems({id:e.id}).$promise.then(function(e){if(e&&e.count&&e.rows)for(var n=0;n<e.rows.length;n+=1)e.rows[n].voiceQueues=r.voiceQueues,e.rows[n].voiceQueuesSelected=_.map(r.voiceQueues.rows,"id"),e.rows[n].smsAccounts=r.smsAccounts,e.rows[n].smsAccountsSelected=_.map(r.smsAccounts.rows,"id"),e.rows[n].faxAccounts=r.faxAccounts,e.rows[n].faxAccountsSelected=_.map(r.faxAccounts.rows,"id"),e.rows[n].mailAccounts=r.mailAccounts,e.rows[n].mailAccountsSelected=_.map(r.mailAccounts.rows,"id"),e.rows[n].openchannelAccounts=r.openchannelAccounts,e.rows[n].openchannelAccountsSelected=_.map(r.openchannelAccounts.rows,"id"),e.rows[n].chatWebsites=r.chatWebsites,e.rows[n].chatWebsitesSelected=_.map(r.chatWebsites.rows,"id"),e.rows[n].whatsappAccounts=r.whatsappAccounts,e.rows[n].whatsappAccountsSelected=_.map(r.whatsappAccounts.rows,"id"),e.rows[n].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+e.rows[n].type+"/ms-widget-engine."+e.rows[n].type+".html",r.customDashboard.widgets.push(e.rows[n])}).catch(function(e){console.error(e)})})},r.createOrEditWidget=function(e){if(e&&e.attrs)for(var n=0;n<e.attrs.length;n+=1)"attrReport"===e.attrs[n].name&&(e.reportType=e.attrs[n].type),e[e.attrs[n].name]=e.attrs[n].value;t.show({controller:"CreateOrEditDashboardItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/dashboard/dialog.html",parent:angular.element(a.body),clickOutsideToClose:!0,locals:{dashboarditem:e,dashboard:r.customDashboard.widgets,license:null,setting:null,crudPermissions:r.crudPermissions}}).then(function(e){if(e)for(var n=0;n<r.customDashboard.widgets.length;n+=1)r.customDashboard.widgets[n].id===e.id&&(r.customDashboard.widgets[n].attrs=e.attrs,r.customDashboard.widgets[n].voiceQueues=r.voiceQueues,r.customDashboard.widgets[n].voiceQueuesSelected=_.map(r.voiceQueues.rows,"id"),r.customDashboard.widgets[n].smsAccounts=r.smsAccounts,r.customDashboard.widgets[n].smsAccountsSelected=_.map(r.smsAccounts.rows,"id"),r.customDashboard.widgets[n].faxAccounts=r.faxAccounts,r.customDashboard.widgets[n].faxAccountsSelected=_.map(r.faxAccounts.rows,"id"),r.customDashboard.widgets[n].mailAccounts=r.mailAccounts,r.customDashboard.widgets[n].mailAccountsSelected=_.map(r.mailAccounts.rows,"id"),r.customDashboard.widgets[n].openchannelAccounts=r.openchannelAccounts,r.customDashboard.widgets[n].openchannelAccountsSelected=_.map(r.openchannelAccounts.rows,"id"),r.customDashboard.widgets[n].chatWebsites=r.chatWebsites,r.customDashboard.widgets[n].chatWebsitesSelected=_.map(r.chatWebsites.rows,"id"),r.customDashboard.widgets[n].whatsappAccounts=r.whatsappAccounts,r.customDashboard.widgets[n].whatsappAccountsSelected=_.map(r.whatsappAccounts.rows,"id"),r.customDashboard.widgets[n].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+r.customDashboard.widgets[n].type+"/ms-widget-engine."+r.customDashboard.widgets[n].type+".html")})},r.deleteWidget=function(n){var e=t.confirm().title("Would you like to delete "+n.title+"?").textContent("").ariaLabel("Delete Widget").ok("YES").cancel("NO");t.show(e).then(function(){return o.dashboardItem.delete({id:n.id}).$promise.then(function(e){_.remove(r.customDashboard.widgets,{id:n.id}),s.success({title:"Widget deleted!",msg:n.name?n.name+" has been deleted!":"Widget has been deleted!"})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETE.customDashboard"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdashboard",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()});console.error(e)})})}}e.$inject=["$mdDialog","$document","$q","toasty","api"],angular.module("app.tools").controller("CustomDashboardItemsController",e)}(),function(){"use strict";function e(n,e,t,a,o,i,s,r,l,d,c,m,u,p){var g=this;g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_DASHBOARDITEM",g.dashboarditem=angular.copy(l),g.dashboard=r,g.newDashboardItem=!1,g.selectedReport=[],g.query={fields:"createdAt,updatedAt,id,name,description,table,parent,conditions,joins",limit:10,page:1,sort:"-updatedAt"},g.dashboarditem?"web-report"==g.dashboarditem.type&&(g.apiName="custom"===g.dashboarditem.reportType?"analyticCustomReport":"analyticDefaultReport",d[g.apiName].get({fields:"id,name,parent"}).$promise.then(function(e){g.currentReport=_.find(e.rows,{id:g.dashboarditem.attrReport}),g.dashboarditem.report=g.currentReport.name,g.query.parent=g.currentReport.parent})):(g.dashboarditem={type:"counter",attrChannel:"voice",titleFontSize:12,attrUrl:"https://",attrHourFormat:"HH:mm:ss",attrTimezone:"0.00",attrMetric:"total",attrSerie1:"total",attrSerie2:"null",attrSerie3:"null",attrRefresh:10,attrFontSize:20,foreground:"#2196f3",background:"#ffffff"},g.title="TOOLS.NEW_DASHBOARDITEM",g.newDashboardItem=!0),g.addNewDashboardItem=function(){g.errors=[],d.dashboard.addItem({id:e.params.id},g.dashboarditem).$promise.then(function(e){g.dashboard.unshift(e.toJSON()),s.success({title:"DashboardItem properly created",msg:g.dashboarditem.name?g.dashboarditem.name+" has been created!":""}),I(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboardItem.save"}];for(var n=0;n<e.data.errors.length;n+=1)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboardItem.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDashboardItem=function(){g.errors=[],d.dashboardItem.update({id:g.dashboarditem.id},g.dashboarditem).$promise.then(function(e){var n=_.find(g.dashboard,{id:e.id});n&&_.merge(n,e.toJSON()),s.success({title:"DashboardItem properly saved!",msg:g.dashboarditem.name?g.dashboarditem.name+" has been saved!":""}),I(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboardItem.update"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboardItem.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDashboardItem=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The dashboarditem will be deleted.").ariaLabel("Delete DashboardItem").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.dashboardItem.delete({id:g.dashboarditem.id}).$promise.then(function(){_.remove(g.dashboard,{id:g.dashboarditem.id}),s.success({title:"DashboardItem properly deleted!",msg:(g.dashboarditem.name||"dashboarditem")+" has been deleted!"}),I(g.dashboarditem)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboardItem.delete"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboardItem.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.getReports=S,g.selectReport=function(){if(g.dashboarditem.report=g.selectedReport[0].name,g.dashboarditem.attrReport=g.selectedReport[0].id,g.dashboarditem.reportType=g.currentNode.custom?"custom":"default",!g.newDashboardItem){var e={name:"attrReport",type:g.dashboarditem.reportType,value:g.selectedReport[0].id};g.dashboarditem.attrs.splice(_.findIndex(g.dashboarditem.attrs,1,e))}n.dashboarditemForm.report.$setDirty(),a.hide()},g.closeReportDialog=function(){a.hide()},g.onTypeChange=function(){["web-report","iframe","clock","custom"].includes(g.dashboarditem.type)&&(g.dashboarditem.attrEmailAccounts=null,g.dashboarditem.attrFaxAccounts=null,g.dashboarditem.attrSmsAccounts=null,g.dashboarditem.attrOpenchannelAccounts=null,g.dashboarditem.attrWhatsappAccounts=null,g.dashboarditem.attrChatWebsites=null)},g.searchReport=function(){g.treeDefaultData=g.treeReports[0]?angular.fromJson(g.treeReports[0].tree):[],g.treeCustomData=g.treeReports[1]?angular.fromJson(g.treeReports[1].tree):[],g.treeConfig=(n={core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:["wholerow"]},"admin"!==g.currentUser.role?d.userProfileSection.get({fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:g.currentUser.userProfileId,sectionId:1203}).$promise.then(function(e){return g.userProfileSection=e&&1==e.count?e.rows[0]:null,n}).catch(function(e){s.error({title:"ERROR",msg:e.message})}):n),g.treeDefaultEvents=f(!1),g.treeCustomEvents=f(!0),a.show({controller:function(){return g},controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/partialViews/reports/treeReports.html",autoWrap:!0,skipHide:!0});var n},g.closeDialog=I,d.analyticTreeReport.get({}).$promise.then(function(e){g.treeReports=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREEREPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})});var v=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],h=null;function f(e){return e?{loaded:E,select_node:b}:{loaded:y,select_node:A}}function b(e,n){g.treeDefaultInstance.jstree(!0).deselect_all(),g.treeDefaultInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!0,g.currentPath=g.treeCustomInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticCustomReport",g.query.parent=n.node.id,S()}function A(e,n){g.treeCustomInstance.jstree(!0).deselect_all(),g.treeCustomInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!1,g.currentPath=g.treeDefaultInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticDefaultReport",g.query.parent=n.node.id,S()}function E(){if(!g.newDashboardItem&&"analyticCustomReport"===g.apiName){var e=g.treeCustomInstance.jstree(!0).get_node(g.query.parent);b(0,{node:e,selected:e.id})}}function y(){if(!g.newDashboardItem&&"analyticDefaultReport"===g.apiName){var e=g.treeDefaultInstance.jstree(!0).get_node(g.query.parent);A(0,{node:e,selected:e.id})}}function S(){if(g.query.offset=(g.query.page-1)*g.query.limit,g.apiName)if("admin"===g.currentUser.role)g.promise=d[g.apiName].get(g.query,T).$promise;else{if(!g.userProfileSection)return T(null);if(g.userProfileSection.autoAssociation)g.promise=d[g.apiName].get(g.query,T).$promise;else{var a=[];g.promise=d[g.apiName].get(g.query).$promise.then(function(e){return 0<(a=e&&e.rows?e.rows:[]).length?d.userProfileResource.get({sectionId:g.userProfileSection.id,type:"analyticDefaultReport"===g.apiName?"DefaultReports":"CustomReports"}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(0<n.length){var t=[];return a.forEach(function(e){_.find(n,["resourceId",e.id])&&t.push(e)}),T({count:t.length,rows:t})}return T(null)}):T(null)}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_REPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}}function T(e){g.reports=e||{count:0,rows:[]},g.newDashboardItem||g.selectedReport.push(_.find(g.reports.rows,{id:g.currentReport.id}))}function I(e){a.hide(e)}c.hasRole("admin")?d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){g.voiceQueues=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){h=e.rows||[]}).then(function(){for(var e=[],n=0;n<v.length;n++)e.push(d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:v[n].id}).$promise);return o.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<v.length;a++){var i=_.find(n,["sectionId",v[a].id]);if(i)if(i.autoAssociation){var s=[];h.forEach(function(e){e.type===v[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(d.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(t)}).then(function(e){var n=[],t=null;g.dashboarditem&&(t=_.find(h,{id:Number(g.dashboarditem.attrVoiceQueues)}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){n.push(e)})}t&&!_.some(n,["resourceId",t.id])&&h.forEach(function(e){e.id===t.id&&(e.canSelect=!1,n.push(e))}),g.voiceQueues=n}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueues",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.mailAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.mailAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.mailAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.mailAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:MailAccounts}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.mailAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.mailAccount,{id:Number(g.dashboarditem.attrEmailAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.mailAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.mailAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.mailAccount,{id:Number(g.dashboarditem.attrEmailAccounts)}));for(var i=0;i<g.mailAccount.length;i++)a&&g.mailAccount[i].id===a.id&&(g.mailAccount[i].canSelect=!1,t.push(g.mailAccount[i]));g.mailAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.faxAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.faxAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FAXACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.faxAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.faxAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:FaxAccounts}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.faxAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.faxAccount,{id:Number(g.dashboarditem.attrFaxAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.faxAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.faxAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.faxAccount,{id:Number(g.dashboarditem.attrFaxAccounts)}));for(var i=0;i<g.faxAccount.length;i++)a&&g.faxAccount[i].id===a.id&&(g.faxAccount[i].canSelect=!1,t.push(g.faxAccount[i]));g.faxAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.smsAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.smsAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SMSACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.smsAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.smsAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:SmsAccounts}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.smsAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.smsAccount,{id:Number(g.dashboarditem.attrSmsAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.smsAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.smsAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.smsAccount,{id:Number(g.dashboarditem.attrSmsAccounts)}));for(var i=0;i<g.smsAccount.length;i++)a&&g.smsAccount[i].id===a.id&&(g.smsAccount[i].canSelect=!1,t.push(g.smsAccount[i]));g.smsAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.openchannelAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.openchannelAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OPENCHANNELACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.openchannelAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.openchannelAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:OpenchannelAccounts}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.openchannelAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.openchannelAccount,{id:Number(g.dashboarditem.attrOpenchannelAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.openchannelAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.openchannelAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.openchannelAccount,{id:Number(g.dashboarditem.attrOpenchannelAccounts)}));for(var i=0;i<g.openchannelAccount.length;i++)a&&g.openchannelAccount[i].id===a.id&&(g.openchannelAccount[i].canSelect=!1,t.push(g.openchannelAccount[i]));g.openchannelAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.whatsappAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.whatsappAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_WHATSAPPACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.whatsappAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.whatsappAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:WhatsappAccounts}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.whatsappAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.whatsappAccount,{id:Number(g.dashboarditem.attrWhatsappAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.whatsappAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.whatsappAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.whatsappAccount,{id:Number(g.dashboarditem.attrWhatsappAccounts)}));for(var i=0;i<g.whatsappAccount.length;i++)a&&g.whatsappAccount[i].id===a.id&&(g.whatsappAccount[i].canSelect=!1,t.push(g.whatsappAccount[i]));g.whatsappAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.chatWebsite.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.chatWebsite=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CHATWEBSITE",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.chatWebsite.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.chatWebsite=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:ChatWebsites}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.chatWebsite,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.chatWebsite,{id:Number(g.dashboarditem.attrChatWebsites)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.chatWebsite,{id:t.id});a.canSelect=!1,n.push(a)}g.chatWebsite=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.chatWebsite,{id:Number(g.dashboarditem.attrChatWebsites)}));for(var i=0;i<g.chatWebsite.length;i++)a&&g.chatWebsite[i].id===a.id&&(g.chatWebsite[i].canSelect=!1,t.push(g.chatWebsite[i]));g.chatWebsite=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","dashboard","dashboarditem","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditDashboardItemDialogController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.customDashboard=c||t.params.customDashboard||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.clonedialog=function(e,n){a.show({controller:"CustomDashboardcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/clone/clone.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{customDashboard:e,customDashboards:u.customDashboards?u.customDashboards.rows:[],crudPermissions:u.crudPermissions}})},u.gotogoto=function(e,n){t.go("app.dashboards.custom",{id:e.id})},u.alert=l.info,u.gotoCustomDashboards=function(){t.go("app.tools.customDashboards",{},{reload:"app.tools.customDashboards"})},u.saveCustomDashboard=function(){r.dashboard.update({id:u.customDashboard.id},u.customDashboard).$promise.then(function(){l.success({title:"CustomDashboard updated!",msg:u.customDashboard.name?u.customDashboard.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETdashboard",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","customDashboard","userProfileSection"],angular.module("app.tools").controller("CustomDashboardController",e)}(),function(){"use strict";function e(a,i,o,r,e,l,d,n,t,s,c){var m=this;if(m.currentUser=n.getCurrentUser(),m.disposition=angular.copy(e),m.setting=c,m.license=s,m.crudPermissions=t,m.newDisposition=!1,m.errors=[],m.disposition||(m.disposition={level:"first"},m.newDisposition=!0),l){var u=l.field;m.disposition[u]=l.id}function p(){return o(function(t,n){d.disposition.get({fields:"id,name,level,ParentId",sort:"id",nolimit:"true"}).$promise.then(function(e){var n=e.rows||[];return t(n)}).catch(function(e){n(e)})})}function g(e){"first"===e.level?m.firstLevelDisposition=e:(m.anySecondLevelDisposition=!0,m.secondLevelDisposition=e,m.firstLevelDisposition=_.find(m.dispositions,["id",m.secondLevelDisposition.ParentId]),m.firstLevelDisposition||p().then(function(){m.firstLevelDisposition=_.find(m.allDispositions,["id",m.secondLevelDisposition.ParentId]),m.firstLevelDisposition.canSelect=!1,m.dispositions.push(m.firstLevelDisposition)}))}function v(e){a.hide(e)}m.onInit=function(){var n="disposition";l?n=l.route:"user"===m.currentUser.role&&(n="userProfile");var t="get";l?t="getDispositions":"user"===m.currentUser.role&&(t="getResources");var e={fields:"id,name,level,ParentId",id:l?l.id:void 0,section:"user"===m.currentUser.role?"Dispositions":void 0,MailAccountId:l?void 0:"null",FaxAccountId:l?void 0:"null",SmsAccountId:l?void 0:"null",OpenchannelAccountId:l?void 0:"null",ChatWebsiteId:l?void 0:"null",WhatsappAccountId:l?void 0:"null",ListId:l?void 0:"null",sort:"id",nolimit:"true"};(a=n,i=t,s=e,o(function(t,n){d[a][i](s).$promise.then(function(e){var n=e.rows||[];return t(n)}).catch(function(e){n(e)})})).then(function(e){m.dispositions=angular.copy(e),m.newDisposition||function(){if("first"===m.disposition.level)return;if(m.parentDisposition=_.find(m.dispositions,["id",m.disposition.ParentId]),!m.parentDisposition)return p().then(function(e){m.allDispositions=e;for(var n=0;n<m.allDispositions.length;n++){var t=m.allDispositions[n];if(t.id===m.disposition.ParentId){g(t),t.canSelect=!1,m.dispositions.push(t);break}}});g(m.parentDisposition)}()}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:["api",n,t].join(":"),msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});var a,i,s},m.onFirstLevelSelection=function(){m.secondLevelDisposition=void 0,m.anySecondLevelDisposition=_.some(m.dispositions,function(e){return e.ParentId===m.firstLevelDisposition.id&&e.id!=m.disposition.id})},m.addNewDisposition=function(){m.errors=[],m.secondLevelDisposition?(m.disposition.ParentId=m.secondLevelDisposition.id,m.disposition.level="third"):m.firstLevelDisposition&&(m.disposition.ParentId=m.firstLevelDisposition.id,m.disposition.level="second");d.disposition.save(m.disposition).$promise.then(function(e){m.dispositions.unshift(e.toJSON()),r.success({title:i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_CREATED_SUCCESS_TITLE")}),v(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.save"}];for(var n=0;n<e.data.errors.length;n+=1)r.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveDisposition=function(){m.errors=[],m.secondLevelDisposition?(m.disposition.ParentId=m.secondLevelDisposition.id,m.disposition.level="third"):m.firstLevelDisposition&&(m.disposition.ParentId=m.firstLevelDisposition.id,m.disposition.level="second");d.disposition.update({id:m.disposition.id},m.disposition).$promise.then(function(e){var n=_.find(m.dispositions,{id:e.id});n&&_.merge(n,e.toJSON()),r.success({title:i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_SAVED_SUCCESS_TITLE")}),v(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.update"}];for(var n=0;n<e.data.errors.length;n++)r.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteDisposition=function(e){m.errors=[];var n=_.some(m.dispositions,["ParentId",m.disposition.id]),t=a.confirm({skipHide:!0}).title(i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(i.instant("TOOLS.NOTIFICATIONS."+(n?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:m.disposition.name})).ariaLabel("Delete disposition").ok(i.instant("TOOLS.DELETE")).cancel(i.instant("TOOLS.CANCEL")).targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:m.disposition.id}).$promise.then(function(){r.success({title:i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")}),v(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var n=0;n<e.data.errors.length;n++)r.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},m.clearSelection=function(e){"first"===e?(m.firstLevelDisposition=void 0,m.secondLevelDisposition=void 0,m.anySecondLevelDisposition=!1):m.secondLevelDisposition=void 0},m.closeDialog=v}e.$inject=["$mdDialog","$translate","$q","toasty","disposition","model","api","Auth","crudPermissions","license","setting"],angular.module("app.tools").controller("CreateOrEditDispositionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v){var h=this;function f(e){h.dispositions=e||{count:0,rows:[]}}function b(){h.query.offset=(h.query.page-1)*h.query.limit,p.isAdmin()?h.promise=m.disposition.get(h.query,f).$promise:(h.query.id=h.userProfile.id,h.query.section="Dispositions",h.promise=m.userProfile.getResources(h.query,f).$promise)}function A(e){m.disposition.delete({id:e.id}).$promise.then(function(){b(),u.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){h.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)u.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else u.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}h.license=g,h.setting=v,h.currentUser=p.getCurrentUser(),h.dispositions=l||{count:0,rows:[]},h.userProfile=d,h.userProfileSection=c&&1==c.count?c.rows[0]:null,h.crudPermissions=p.parseCrudPermissions(h.userProfileSection?h.userProfileSection.crudPermissions:null),h.selectedDispositions=[],h.levels={first:"1st",second:"2nd",third:"3rd"},h.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",WhatsappAccountId:"null",ListId:"null",limit:10,page:1},h.deleteconfirm=function(e,n){var t=_.some(h.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){A(e)})},h.success=f,h.getDispositions=b,h.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:null,license:h.license,setting:h.setting,crudPermissions:h.crudPermissions}}).then(function(e){!0===e&&b()})},h.deleteDisposition=A,h.exportSelectedDispositions=function(){var e=angular.copy(h.selectedDispositions);return h.selectedDispositions=[],e},h.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:h.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){h.selectedDispositions.forEach(function(e){A(e)}),h.selectedDispositions=[]})},h.deselectDispositions=function(){h.selectedDispositions=[]},h.selectAllDispositions=function(){h.selectedDispositions=h.dispositions.rows};var E=!0,y=1;e.$watch("vm.query.filter",function(e,n){E?o(function(){E=!1}):(n||(y=h.query.page),e!==n&&(h.query.page=1),e||(h.query.page=y),b())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","dispositions","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.tools").controller("DispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_INTERVAL",g.interval=angular.copy(l),g.intervals=r,g.newInterval=!1,g.interval||(g.interval={},g.title="TOOLS.NEW_INTERVAL",g.newInterval=!0),g.addNewInterval=function(){g.errors=[],d.interval.save(g.interval).$promise.then(function(e){g.intervals.unshift(e.toJSON()),o.success({title:"Interval properly created",msg:g.interval.name?g.interval.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveInterval=function(){g.errors=[],d.interval.update({id:g.interval.id},g.interval).$promise.then(function(e){var n=_.find(g.intervals,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Interval properly saved!",msg:g.interval.name?g.interval.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteInterval=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The interval will be deleted.").ariaLabel("Delete Interval").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.interval.delete({id:g.interval.id}).$promise.then(function(){_.remove(g.intervals,{id:g.interval.id}),o.success({title:"Interval properly deleted!",msg:(g.interval.name||"interval")+" has been deleted!"}),v(g.interval)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","intervals","interval","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditIntervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditAppintervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.intervalIntervals=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.interval.getIntervals(m.query,u).$promise}function g(e){d.interval.delete({id:e.id}).$promise.then(function(){_.remove(m.intervalIntervals.rows,{id:e.id}),m.intervalIntervals.count-=1,m.intervalIntervals.rows.length||p(),l.success({title:"Interval deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETinterval"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.interval={},m.intervalIntervals={count:0,rows:[]},m.selectedIntervalIntervals=[],m.crudPermissions,m.sortableTable={animation:100,onSort:function(e){d.interval.addIntervals({id:m.interval.id},e.models).$promise.then(function(e){m.intervalIntervals.rows=e}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:SORTABLETABLE",msg:e.data?JSON.stringify(e.data):e.toString()})})}},m.query={fields:"createdAt,updatedAt,id,name,interval",nolimit:"true",limit:10,page:1},m.init=function(e,n){m.interval=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.sortableTable.disabled=!m.crudPermissions.canEdit,m.query.id=m.interval.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interval?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interval #")+e.id||"interval")+"</b> will be deleted.").ariaLabel("delete interval").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIntervalIntervals=p,m.createOrEditIntervalInterval=function(e,n){o.show({controller:"EditAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/intervals/edit/apps/interval/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:m.interval,interval:n,intervals:m.intervalIntervals.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIntervalIntervals=function(){var e=angular.copy(m.selectedIntervalIntervals);return m.selectedIntervalIntervals=[],e},m.deleteIntervalInterval=g,m.deleteSelectedIntervalIntervals=function(e){var n=o.confirm().title("Are you sure want to delete the selected intervals?").htmlContent("<b>"+m.selectedIntervalIntervals.length+" selected</b> will be deleted.").ariaLabel("delete intervals").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIntervalIntervals.forEach(function(e){g(e)}),m.selectedIntervalIntervals=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("IntervalIntervalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_INTERVAL",g.interval=angular.copy(l),g.intervals=r,g.newInterval=!1,g.interval||(g.interval={},g.title="TOOLS.NEW_INTERVAL",g.newInterval=!0),g.addNewInterval=function(){g.errors=[],d.interval.save(g.interval).$promise.then(function(e){g.intervals.unshift(e.toJSON()),o.success({title:"Interval properly created",msg:g.interval.name?g.interval.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveInterval=function(){g.errors=[],d.interval.update({id:g.interval.id},g.interval).$promise.then(function(e){var n=_.find(g.intervals,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Interval properly saved!",msg:g.interval.name?g.interval.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteInterval=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The interval will be deleted.").ariaLabel("Delete Interval").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.interval.delete({id:g.interval.id}).$promise.then(function(){_.remove(g.intervals,{id:g.interval.id}),o.success({title:"Interval properly deleted!",msg:(g.interval.name||"interval")+" has been deleted!"}),v(g.interval)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","intervals","interval","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditIntervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.interval=c||e.params.interval||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoIntervals=function(){e.go("app.tools.intervals",{},{reload:"app.tools.intervals"})},u.saveInterval=function(){r.interval.update({id:u.interval.id},u.interval).$promise.then(function(){l.success({title:"Interval updated!",msg:u.interval.name?u.interval.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","interval","userProfileSection"],angular.module("app.tools").controller("IntervalController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.intervals=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="intervals",f.listOrder="",f.listOrderAsc=null,f.selectedIntervals=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,page:1},f.editstate=function(e,n){t.go("app.tools.intervals.edit",{id:e.id,interval:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("interval")+"?").htmlContent("<b>"+(e.name||"interval")+"</b> will be deleted.").ariaLabel("delete interval").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getIntervals=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.interval.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Intervals",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditInterval=function(e,n){i.show({controller:"CreateOrEditIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/intervals/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:n,intervals:f.intervals.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteInterval=y,f.exportSelectedIntervals=function(){var e=angular.copy(f.selectedIntervals);return f.selectedIntervals=[],e},f.deleteSelectedIntervals=function(e){var n=i.confirm().title("Are you sure want to delete the selected intervals?").htmlContent("<b>"+f.selectedIntervals.length+" selected</b> will be deleted.").ariaLabel("delete Intervals").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedIntervals.forEach(function(e){y(e)}),f.selectedIntervals=[]})},f.deselectIntervals=function(){f.selectedIntervals=[]},f.selectAllIntervals=function(){f.selectedIntervals=f.intervals.rows};var b=!0,A=1;function E(e){f.intervals=e||{count:0,rows:[]}}function y(e){m.interval.delete({id:e.id}).$promise.then(function(){_.remove(f.intervals.rows,{id:e.id}),f.intervals.count-=1,f.intervals.rows.length||f.getIntervals(),p.success({title:_.startCase("Interval")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEinterval"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEinterval",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getIntervals())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","intervals","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("IntervalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_PAUSE",g.pause=angular.copy(l),g.pauses=r,g.newPause=!1,g.pause||(g.pause={},g.title="TOOLS.NEW_PAUSE",g.newPause=!0),g.addNewPause=function(){g.errors=[],d.pause.save(g.pause).$promise.then(function(e){g.pauses.unshift(e.toJSON()),o.success({title:"Pause properly created",msg:g.pause.name?g.pause.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.pause.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pause.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savePause=function(){g.errors=[],d.pause.update({id:g.pause.id},g.pause).$promise.then(function(e){var n=_.find(g.pauses,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Pause properly saved!",msg:g.pause.name?g.pause.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.pause.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pause.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletePause=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The pause will be deleted.").ariaLabel("Delete Pause").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.pause.delete({id:g.pause.id}).$promise.then(function(){_.remove(g.pauses,{id:g.pause.id}),o.success({title:"Pause properly deleted!",msg:(g.pause.name||"pause")+" has been deleted!"}),v(g.pause)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.pause.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pause.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","pauses","pause","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditPauseDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.pauses=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="pauses",f.listOrder="",f.listOrderAsc=null,f.selectedPauses=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditPauseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/pauses/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{pause:e,pauses:f.pauses.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("pause")+"?").htmlContent("<b>"+(e.name||"pause")+"</b> will be deleted.").ariaLabel("delete pause").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getPauses=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.pause.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Pauses",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditPause=function(e,n){i.show({controller:"CreateOrEditPauseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/pauses/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{pause:n,pauses:f.pauses.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletePause=y,f.exportSelectedPauses=function(){var e=angular.copy(f.selectedPauses);return f.selectedPauses=[],e},f.deleteSelectedPauses=function(e){var n=i.confirm().title("Are you sure want to delete the selected pauses?").htmlContent("<b>"+f.selectedPauses.length+" selected</b> will be deleted.").ariaLabel("delete Pauses").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedPauses.forEach(function(e){y(e)}),f.selectedPauses=[]})},f.deselectPauses=function(){f.selectedPauses=[]},f.selectAllPauses=function(){f.selectedPauses=f.pauses.rows};var b=!0,A=1;function E(e){f.pauses=e||{count:0,rows:[]}}function y(e){m.pause.delete({id:e.id}).$promise.then(function(){_.remove(f.pauses.rows,{id:e.id}),f.pauses.count-=1,f.pauses.rows.length||f.getPauses(),p.success({title:_.startCase("Pause")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEpause"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEpause",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getPauses())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","pauses","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("PausesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;if(g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_SCHEDULE",g.schedule=angular.copy(l),g.schedules=r,g.newSchedule=!1,g.selectedReport=[],g.query={fields:"createdAt,updatedAt,id,name,description,table,parent,conditions,joins",limit:10,page:1,sort:"-updatedAt"},g.schedule){g.apiName=g.schedule.DefaultReportId?"analyticDefaultReport":"analyticCustomReport";var v=g.schedule.DefaultReportId?g.schedule.DefaultReportId:g.schedule.CustomReportId;d[g.apiName].get({fields:"id,name,parent"}).$promise.then(function(e){g.currentReport=_.find(e.rows,{id:v}),g.schedule.report=g.currentReport.name,g.query.parent=g.currentReport.parent})}else g.schedule={output:"xlsx",active:!0,startAt:new Date,endAt:new Date(Date.now()+2592e6),cron:"0 0 * * *",subtractNumber:1,subtractUnit:"days",sendMail:!1,sendIfEmpty:!0},g.title="TOOLS.NEW_SCHEDULE",g.newSchedule=!0;function h(e){return e?{loaded:A,select_node:f}:{loaded:E,select_node:b}}function f(e,n){g.treeDefaultInstance.jstree(!0).deselect_all(),g.treeDefaultInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!0,g.currentPath=g.treeCustomInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticCustomReport",g.query.parent=n.node.id,y()}function b(e,n){g.treeCustomInstance.jstree(!0).deselect_all(),g.treeCustomInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!1,g.currentPath=g.treeDefaultInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticDefaultReport",g.query.parent=n.node.id,y()}function A(){if(!g.newSchedule&&"analyticCustomReport"===g.apiName){var e=g.treeCustomInstance.jstree(!0).get_node(g.query.parent);f(0,{node:e,selected:e.id})}}function E(){if(!g.newSchedule&&"analyticDefaultReport"===g.apiName){var e=g.treeDefaultInstance.jstree(!0).get_node(g.query.parent);b(0,{node:e,selected:e.id})}}function y(){if(g.query.offset=(g.query.page-1)*g.query.limit,g.apiName)if("admin"===g.currentUser.role)g.promise=d[g.apiName].get(g.query,S).$promise;else{if(!g.userProfileSection)return S(null);if(g.userProfileSection.autoAssociation)g.promise=d[g.apiName].get(g.query,S).$promise;else{var a=[];g.promise=d[g.apiName].get(g.query).$promise.then(function(e){return 0<(a=e&&e.rows?e.rows:[]).length?d.userProfileResource.get({sectionId:g.userProfileSection.id,type:"analyticDefaultReport"===g.apiName?"DefaultReports":"CustomReports"}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(0<n.length){var t=[];return a.forEach(function(e){_.find(n,["resourceId",e.id])&&t.push(e)}),S({count:t.length,rows:t})}return S(null)}):S(null)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_REPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}}function S(e){g.reports=e||{count:0,rows:[]},g.newSchedule||g.selectedReport.push(_.find(g.reports.rows,{id:g.currentReport.id}))}function T(e){a.hide(e)}g.addNewSchedule=function(){g.errors=[],d.schedule.save(g.schedule).$promise.then(function(e){g.schedules.unshift(e.toJSON()),o.success({title:"Schedule properly created",msg:g.schedule.name?g.schedule.name+" has been created!":""}),T(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.schedule.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.schedule.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSchedule=function(){g.errors=[],d.schedule.update({id:g.schedule.id},g.schedule).$promise.then(function(e){var n=_.find(g.schedules,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Schedule properly saved!",msg:g.schedule.name?g.schedule.name+" has been saved!":""}),T(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.schedule.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.schedule.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSchedule=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The schedule will be deleted.").ariaLabel("Delete Schedule").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.schedule.delete({id:g.schedule.id}).$promise.then(function(){_.remove(g.schedules,{id:g.schedule.id}),o.success({title:"Schedule properly deleted!",msg:(g.schedule.name||"schedule")+" has been deleted!"}),T(g.schedule)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.schedule.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.schedule.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.getReports=y,g.selectReport=function(){g.schedule.report=g.selectedReport[0].name,g.currentNode.custom?(g.schedule.CustomReportId=g.selectedReport[0].id,delete g.schedule.DefaultReportId):(g.schedule.DefaultReportId=g.selectedReport[0].id,delete g.schedule.CustomReportId);e.scheduleForm.report.$setDirty(),a.hide()},g.closeReportDialog=function(){a.hide()},g.searchReport=function(){g.treeDefaultData=g.treeReports[0]?angular.fromJson(g.treeReports[0].tree):[],g.treeCustomData=g.treeReports[1]?angular.fromJson(g.treeReports[1].tree):[],g.treeConfig=(n={core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:["wholerow"]},"admin"!==g.currentUser.role?d.userProfileSection.get({fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:g.currentUser.userProfileId,sectionId:1203}).$promise.then(function(e){return g.userProfileSection=e&&1==e.count?e.rows[0]:null,n}).catch(function(e){o.error({title:"ERROR",msg:e.message})}):n),g.treeDefaultEvents=h(!1),g.treeCustomEvents=h(!0),a.show({controller:function(){return g},controllerAs:"vm",templateUrl:"app/main/apps/tools/views/schedules/partialViews/reports/treeReports.html",autoWrap:!0,skipHide:!0});var n},g.closeDialog=T,d.analyticTreeReport.get({}).$promise.then(function(e){g.treeReports=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREEREPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.mailAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.mailAccounts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.mailAccounts,{id:e.resourceId})}),t=null;if(g.schedule&&(t=_.find(g.mailAccounts,{id:Number(g.schedule.MailAccountId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.mailAccounts,{id:t.id});a.canSelect=!1,n.push(a)}g.mailAccounts=n})}else{var t=[],a=null;g.schedule&&(a=_.find(g.mailAccounts,{id:Number(g.schedule.MailAccountId)}));for(var i=0;i<g.mailAccounts.length;i++)a&&g.mailAccounts[i].id===a.id&&(g.mailAccounts[i].canSelect=!1,t.push(g.mailAccounts[i]));g.mailAccounts=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","schedules","schedule","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditScheduleDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.schedules=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="schedules",f.listOrder="",f.listOrderAsc=null,f.selectedScheduler=[],f.query={fields:"createdAt,updatedAt,id,name,CustomReportId,DefaultReportId,output,active,startAt,endAt,cron,subtractNumber,subtractUnit,sendMail,MailAccountId,email,cc,bcc,sendIfEmpty,description",sort:"-updatedAt",limit:10,page:1},f.arrayoutput=_.keyBy([{option:"CSV",value:"'csv'"},{option:"PDF",value:"'pdf'"},{option:"Excel",value:"'xlsx'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysubtractUnit=_.keyBy([{option:"Minutes",value:"'minutes'"},{option:"Hours",value:"'hours'"},{option:"Days",value:"'days'"},{option:"Weeks",value:"'weeks'"},{option:"Months",value:"'months'"},{option:"Quarters",value:"'quarters'"},{option:"Years",value:"'years'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditScheduleDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/schedules/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{schedule:e,schedules:f.schedules.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.runconfirm=function(e,n){var t=i.confirm().title("Are you sure want to run the schedule?").htmlContent("<b>"+(e.name||"schedule")+"</b> will be run.").ariaLabel("delete schedule").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){return m.schedule.run({id:e.id}).$promise},function(){console.log("CANCEL")})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("schedule")+"?").htmlContent("<b>"+(e.name||"schedule")+"</b> will be deleted.").ariaLabel("delete schedule").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getScheduler=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.schedule.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Scheduler",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSchedule=function(e,n){i.show({controller:"CreateOrEditScheduleDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/schedules/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{schedule:n,schedules:f.schedules.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSchedule=y,f.exportSelectedScheduler=function(){var e=angular.copy(f.selectedScheduler);return f.selectedScheduler=[],e},f.deleteSelectedScheduler=function(e){var n=i.confirm().title("Are you sure want to delete the selected schedules?").htmlContent("<b>"+f.selectedScheduler.length+" selected</b> will be deleted.").ariaLabel("delete Schedules").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedScheduler.forEach(function(e){y(e)}),f.selectedScheduler=[]})},f.deselectScheduler=function(){f.selectedScheduler=[]},f.selectAllScheduler=function(){f.selectedScheduler=f.schedules.rows},m.analyticTreeReport.get({}).$promise.then(function(e){f.treeReports=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREEREPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.mailAccounts=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.mailAccounts=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.mailAccounts,{id:e.resourceId})}),t=null;if(f.schedule&&(t=_.find(f.mailAccounts,{id:Number(f.schedule.MailAccountId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.mailAccounts,{id:t.id});a.canSelect=!1,n.push(a)}f.mailAccounts=n})}else{var t=[],a=null;f.schedule&&(a=_.find(f.mailAccounts,{id:Number(f.schedule.MailAccountId)}));for(var i=0;i<f.mailAccounts.length;i++)a&&f.mailAccounts[i].id===a.id&&(f.mailAccounts[i].canSelect=!1,t.push(f.mailAccounts[i]));f.mailAccounts=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.schedules=e||{count:0,rows:[]}}function y(e){m.schedule.delete({id:e.id}).$promise.then(function(){_.remove(f.schedules.rows,{id:e.id}),f.schedules.count-=1,f.schedules.rows.length||f.getScheduler(),p.success({title:_.startCase("Schedule")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEschedule"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEschedule",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getScheduler())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","schedules","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("SchedulesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_SOUND",g.sound=angular.copy(l),g.sounds=r,g.newSound=!1,g.sound||(g.sound={},g.title="TOOLS.NEW_SOUND",g.newSound=!0),g.addNewSound=function(){g.errors=[],d.sound.save(g.sound).$promise.then(function(e){g.sounds.unshift(e.toJSON()),o.success({title:"Sound properly created",msg:g.sound.name?g.sound.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.sound.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSound=function(){g.errors=[],d.sound.update({id:g.sound.id},g.sound).$promise.then(function(e){var n=_.find(g.sounds,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Sound properly saved!",msg:g.sound.name?g.sound.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.sound.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSound=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The sound will be deleted.").ariaLabel("Delete Sound").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.sound.delete({id:g.sound.id}).$promise.then(function(){_.remove(g.sounds,{id:g.sound.id}),o.success({title:"Sound properly deleted!",msg:(g.sound.name||"sound")+" has been deleted!"}),v(g.sound)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.sound.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","sounds","sound","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditSoundDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.sounds=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="sounds",f.listOrder="",f.listOrderAsc=null,f.selectedSounds=[],f.query={fields:"createdAt,updatedAt,id,save_name,converted_format,name,audio,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{sound:e,sounds:f.sounds.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.downloadfile2=function(s,e){return m.sound.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.converted_format?s.save_name+"."+s.converted_format:s.save_name;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("sound")+"?").htmlContent("<b>"+(e.name||"sound")+"</b> will be deleted.").ariaLabel("delete sound").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSounds=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.sound.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Sounds",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSound=function(e,n){i.show({controller:"CreateOrEditSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{sound:n,sounds:f.sounds.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSound=y,f.exportSelectedSounds=function(){var e=angular.copy(f.selectedSounds);return f.selectedSounds=[],e},f.deleteSelectedSounds=function(e){var n=i.confirm().title("Are you sure want to delete the selected sounds?").htmlContent("<b>"+f.selectedSounds.length+" selected</b> will be deleted.").ariaLabel("delete Sounds").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSounds.forEach(function(e){y(e)}),f.selectedSounds=[]})},f.deselectSounds=function(){f.selectedSounds=[]},f.selectAllSounds=function(){f.selectedSounds=f.sounds.rows},f.uploadSound=function(e){i.show({controller:"UploadSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/upload/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{sounds:f.sounds.rows}})};var b=!0,A=1;function E(e){f.sounds=e||{count:0,rows:[]}}function y(e){m.sound.delete({id:e.id}).$promise.then(function(){_.remove(f.sounds.rows,{id:e.id}),f.sounds.count-=1,f.sounds.rows.length||f.getSounds(),p.success({title:_.startCase("Sound")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsound"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsound",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSounds())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","sounds","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("SoundsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this,r=15,l=1024*r*1024;o.currentUser=s.getCurrentUser(),o.errors=[],o.title="TOOLS.UPLOAD_SOUND",o.sounds=a,o.uploadSounds=[],o.uploadState="none",o.sound={},o.ngFlowOptions={maxChunkRetries:1,chunkSize:l,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0,target:"api/sounds"},o.ngFlow={flow:{}},o.dropping=!1,o.fileAdded=function(e){var n=["wav","mp3","gsm"];if(!_.includes(n,e.getExtension()))return t.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(e.size>l)return t.error({title:"File too big",msg:"The max allowed size is "+r+"MB"}),!1;return o.sound={id:e.uniqueIdentifier,file:e},o.uploadSounds.unshift(o.sound),!0},o.upload=function(){o.uploadState="uploading",o.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},o.ngFlow.flow.opts.query={role:o.currentUser.role,userProfileId:o.currentUser.userProfileId},o.ngFlow.flow.upload()},o.fileSuccess=function(a,e){o.sounds.unshift(JSON.parse(e)),angular.forEach(o.uploadSounds,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result}}})},o.uploadError=function(e,n){o.ngFlow.flow.cancel(),t.error({title:"Upload error",msg:"Cannot upload the sound"}),o.uploadState="failed"},o.uploadComplete=function(){"failed"!==o.uploadState&&(o.uploadState="completed",t.success({title:"Upload completed",msg:o.sound.file.name+" uploaded successfully"}))},o.closeDialog=function(){n.hide()}}e.$inject=["$cookies","$mdDialog","toasty","sounds","api","Auth"],angular.module("app.tools").controller("UploadSoundDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_TAG",g.tag=angular.copy(l),g.tags=r,g.newTag=!1,g.tag||(g.tag={},g.title="TOOLS.NEW_TAG",g.newTag=!0),g.addNewTag=function(){g.errors=[],d.tag.save(g.tag).$promise.then(function(e){g.tags.unshift(e.toJSON()),o.success({title:"Tag properly created",msg:g.tag.name?g.tag.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.tag.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.tag.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTag=function(){g.errors=[],d.tag.update({id:g.tag.id},g.tag).$promise.then(function(e){var n=_.find(g.tags,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Tag properly saved!",msg:g.tag.name?g.tag.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.tag.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.tag.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTag=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The tag will be deleted.").ariaLabel("Delete Tag").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.tag.delete({id:g.tag.id}).$promise.then(function(){_.remove(g.tags,{id:g.tag.id}),o.success({title:"Tag properly deleted!",msg:(g.tag.name||"tag")+" has been deleted!"}),v(g.tag)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.tag.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.tag.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","tags","tag","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTagDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.tags=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="tags",f.listOrder="",f.listOrderAsc=null,f.selectedTags=[],f.query={fields:"createdAt,updatedAt,id,name,description,color",sort:"name,-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditTagDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/tags/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{tag:e,tags:f.tags.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("tag")+"?").htmlContent("<b>"+(e.name||"tag")+"</b> will be deleted.").ariaLabel("delete tag").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTags=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.tag.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Tags",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTag=function(e,n){i.show({controller:"CreateOrEditTagDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/tags/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{tag:n,tags:f.tags.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTag=y,f.exportSelectedTags=function(){var e=angular.copy(f.selectedTags);return f.selectedTags=[],e},f.deleteSelectedTags=function(e){var n=i.confirm().title("Are you sure want to delete the selected tags?").htmlContent("<b>"+f.selectedTags.length+" selected</b> will be deleted.").ariaLabel("delete Tags").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTags.forEach(function(e){y(e)}),f.selectedTags=[]})},f.deselectTags=function(){f.selectedTags=[]},f.selectAllTags=function(){f.selectedTags=f.tags.rows};var b=!0,A=1;function E(e){f.tags=e||{count:0,rows:[]}}function y(e){m.tag.delete({id:e.id}).$promise.then(function(){_.remove(f.tags.rows,{id:e.id}),f.tags.count-=1,f.tags.rows.length||f.getTags(),p.success({title:_.startCase("Tag")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtag"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtag",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTags())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","tags","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("TagsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_TEMPLATE",g.template=angular.copy(l),g.templates=r,g.newTemplate=!1,g.template||(g.template={},g.title="TOOLS.NEW_TEMPLATE",g.newTemplate=!0),g.addNewTemplate=function(){g.errors=[],d.template.save(g.template).$promise.then(function(e){g.templates.unshift(e.toJSON()),o.success({title:"Template properly created",msg:g.template.name?g.template.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.template.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.template.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTemplate=function(){g.errors=[],d.template.update({id:g.template.id},g.template).$promise.then(function(e){var n=_.find(g.templates,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Template properly saved!",msg:g.template.name?g.template.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.template.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.template.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTemplate=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The template will be deleted.").ariaLabel("Delete Template").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.template.delete({id:g.template.id}).$promise.then(function(){_.remove(g.templates,{id:g.template.id}),o.success({title:"Template properly deleted!",msg:(g.template.name||"template")+" has been deleted!"}),v(g.template)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.template.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.template.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","templates","template","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTemplateDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.templates=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="templates",f.listOrder="",f.listOrderAsc=null,f.selectedTemplates=[],f.query={fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditTemplateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/templates/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{template:e,templates:f.templates.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("template")+"?").htmlContent("<b>"+(e.name||"template")+"</b> will be deleted.").ariaLabel("delete template").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTemplates=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.template.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Templates",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTemplate=function(e,n){i.show({controller:"CreateOrEditTemplateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/templates/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{template:n,templates:f.templates.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTemplate=y,f.exportSelectedTemplates=function(){var e=angular.copy(f.selectedTemplates);return f.selectedTemplates=[],e},f.deleteSelectedTemplates=function(e){var n=i.confirm().title("Are you sure want to delete the selected templates?").htmlContent("<b>"+f.selectedTemplates.length+" selected</b> will be deleted.").ariaLabel("delete Templates").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTemplates.forEach(function(e){y(e)}),f.selectedTemplates=[]})},f.deselectTemplates=function(){f.selectedTemplates=[]},f.selectAllTemplates=function(){f.selectedTemplates=f.templates.rows};var b=!0,A=1;function E(e){f.templates=e||{count:0,rows:[]}}function y(e){m.template.delete({id:e.id}).$promise.then(function(){_.remove(f.templates.rows,{id:e.id}),f.templates.count-=1,f.templates.rows.length||f.getTemplates(),p.success({title:_.startCase("Template")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtemplate"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtemplate",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTemplates())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","templates","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("TemplatesController",e)}(),function(){"use strict";function e(t,a,i,e,n,s,o,r,l,d){var c=this;function m(e){t.hide(e)}c.currentUser=o.getCurrentUser(),c.trigger=angular.copy(n),c.triggers=angular.copy(e),c.setting=l,c.license=r,c.crudPermissions=d,c.newTrigger=!1,c.errors=[],c.trigger||(c.trigger={channel:"voice"},c.newTrigger=!0),c.addNewTrigger=function(){c.errors=[],s.trigger.save(c.trigger).$promise.then(function(e){c.triggers.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.TRIGGER_CREATED_SUCCESS_TITLE")}),m(c.triggers)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.trigger.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.saveTrigger=function(){c.errors=[],s.trigger.update({id:c.trigger.id},c.trigger).$promise.then(function(){c.triggers=_.map(c.triggers,function(e){return e.id===c.trigger.id?c.trigger:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.TRIGGER_SAVED_SUCCESS_TITLE")}),m(c.triggers)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.trigger.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.deleteTrigger=function(e){c.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_MESSAGE",{name:c.trigger.name})).ariaLabel("Delete trigger").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){s.trigger.delete({id:c.trigger.id}).$promise.then(function(){c.triggers=_.filter(c.triggers,function(e){return e.id!==c.trigger.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETED_SUCCESS_TITLE")}),m(c.triggers)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.trigger.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},c.closeDialog=m}e.$inject=["$mdDialog","$translate","toasty","triggers","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTriggerDialogController",e)}(),function(){"use strict";function e(e,a,n,i,t,s,o,r){var l=this;function d(){_.some(l.triggerActions.rows,["action","contactManager"])&&(l.lists||(r.isAdmin()?o.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.lists=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.lists=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.lists,{id:e.resourceId})}),a=null;a=[],l.triggerActions.rows.forEach(function(e){if("contactManager"===e.action){var n=_.find(l.lists,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(l.lists,{id:e.id});n.canSelect=!1,t.push(n)}}),l.lists=t})}else{var t=[],a=[];l.triggerActions.rows.forEach(function(e){if("contactManager"===e.action){var n=_.find(l.lists,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<l.lists.length;i++)_.some(a,{id:l.lists[i].id})&&(l.lists[i].canSelect=!1,t.push(l.lists[i]));l.lists=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(l.triggerActions.rows,["action","integration"])&&_(l.triggerActions.rows).map(function(e){return"integration"===e.action?e.data1:void 0}).compact().uniq().value().forEach(function(e){var n=e+"Accounts";if(!l[n]){var t="int"+_.startCase(e)+"Account";o[t.replace(/\s+/g,"")].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){l[n]=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+n.toUpperCase()+"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}),_.some(l.triggerActions.rows,function(e){return _.includes(["motionbar","browser"],e.action)})&&(l.templates||(r.isAdmin()?o.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){l.templates=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){l.templates=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1009}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.templates,{id:e.resourceId})}),a=null;a=[],l.triggerActions.rows.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(l.templates,{id:Number(e.data2)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(l.templates,{id:e.id});n.canSelect=!1,t.push(n)}}),l.templates=t})}else{var t=[],a=[];l.triggerActions.rows.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(l.templates,{id:Number(e.data2)});a.push(n)}});for(var i=0;i<l.templates.length;i++)_.some(a,{id:l.templates[i].id})&&(l.templates[i].canSelect=!1,t.push(l.templates[i]));l.templates=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(l.triggerActions.rows,["action","jscripty"])&&(l.projects||(r.isAdmin()?o.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.projects=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.projects=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1701}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.projects,{id:e.resourceId})}),a=null;a=[],l.triggerActions.rows.forEach(function(e){if("jscripty"===e.action){var n=_.find(l.projects,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(l.projects,{id:e.id});n.canSelect=!1,t.push(n)}}),l.projects=t})}else{var t=[],a=[];l.triggerActions.rows.forEach(function(e){if("jscripty"===e.action){var n=_.find(l.projects,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<l.projects.length;i++)_.some(a,{id:l.projects[i].id})&&(l.projects[i].canSelect=!1,t.push(l.projects[i]));l.projects=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})})))}function c(e){l.triggerActions=e||{count:0,rows:[]},d()}function m(){l.query.offset=(l.query.page-1)*l.query.limit,l.promise=o.trigger.getActions(l.query,c).$promise}function u(e,n){o.action.delete({id:e.id}).$promise.then(function(){m(),n&&s.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}l.currentUser=r.getCurrentUser(),l.trigger={},l.triggerActions={count:0,rows:[]},l.selectedTriggerActions=[],l.query={fields:"id,action,contact,data1,data2,data3,data4,data5,data6,data7,createdAt,updatedAt",limit:10,page:1},l.integrationTypes={zendesk:"Zendesk",salesforce:"Salesforce",sugarcrm:"SugarCRM",freshdesk:"Freshdesk",desk:"Desk",zoho:"Zoho",vtiger:"vTiger",dynamics365:"Dynamics365",servicenow:"ServiceNow",freshsales:"Freshsales"},l.motionBarOptions={0:"Popup",1:"CTI URL",2:"Windows App"},l.onInit=function(e,n){l.trigger=e,l.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},l.query.ActionId=l.trigger.id,l.query.id=l.trigger.id,m()},l.success=c,l.getTriggerActions=m,l.createOrEditTriggerAction=function(e,n){i.show({controller:"CreateOrEditActionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/actions/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:l.trigger,action:n,actions:l.triggerActions.rows,license:null,setting:null,crudPermissions:l.crudPermissions}}).then(function(e){e&&(l.triggerActions={count:e.length,rows:e},d())})},l.exportSelectedTriggerActions=function(){var e=angular.copy(l.selectedTriggerActions);return l.selectedTriggerActions=[],e},l.deleteConfirm=function(e,n){var t=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETE_TITLE")).ariaLabel("Delete action").targetEvent(n).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(t).then(function(){u(e,!0)})},l.deleteSelectedTriggerActions=function(e){var n=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.ACTIONS_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.ACTIONS_DELETE_MESSAGE",{total:l.selectedTriggerActions.length})).ariaLabel("Delete actions").targetEvent(e).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(n).then(function(){l.selectedTriggerActions.forEach(function(e){u(e)}),l.selectedTriggerActions=[],s.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTIONS_DELETED_SUCCESS_TITLE")})})}}e.$inject=["$scope","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerActionsController",e)}(),function(){"use strict";function e(n,t,a,i,e,s,o,r,l,d,c,m){var u=this;function p(){return new Promise(function(n,t){l.hasSectionsPermissions([1301,1302,1303,1304,1305,1306,1307,1308,1309,1310]).then(function(e){u.hasSectionPermissions=_.merge(u.hasSectionPermissions,e),n(u.hasSectionPermissions)}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SECTIONS_PERMISSIONS",msg:e.data?JSON.stringify(e.data):e.toString()}),t()})})}function g(){r.cmList.getCustomFields({id:u.action.data1,ListId:u.action.data1}).$promise.then(function(e){u.listFields=_.filter(e.rows,["type","text"]),u.listFields.forEach(function(e){e.columnName="cf_"+e.id})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LIST_CUSTOM_FIELDS",msg:e.data?JSON.stringify(e.data):e.toString()})})}function v(){l.isAdmin()?r.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u.templates=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u.templates=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1009}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.templates,{id:e.resourceId})}),a=null;a=[],u.actions.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(u.templates,{id:Number(e.data2)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.templates,{id:e.id});n.canSelect=!1,t.push(n)}}),u.templates=t})}else{var t=[],a=[];u.actions.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(u.templates,{id:Number(e.data2)});a.push(n)}});for(var i=0;i<u.templates.length;i++){_.some(a,{id:u.templates[i].id})&&(u.templates[i].canSelect=!1,t.push(u.templates[i]))}u.templates=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})})}function h(){switch(u.action.action){case"contactManager":u.lists||(l.isAdmin()?r.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.lists=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.lists,{id:e.resourceId})}),a=null;a=[],u.actions.forEach(function(e){if("contactManager"===e.action){var n=_.find(u.lists,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.lists,{id:e.id});n.canSelect=!1,t.push(n)}}),u.lists=t})}else{var t=[],a=[];u.actions.forEach(function(e){if("contactManager"===e.action){var n=_.find(u.lists,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<u.lists.length;i++)_.some(a,{id:u.lists[i].id})&&(u.lists[i].canSelect=!1,t.push(u.lists[i]));u.lists=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})),u.contactFields||r.cmContact.describe({}).$promise.then(function(e){u.contactFields=[],u.customFields=[];for(var n=_.values(e.toJSON()),t=0;t<n.length;t++)_.includes(u.allowedStandardFields,n[t].columnName)?u.contactFields.push(n[t]):_.startsWith(n[t].columnName,"cf_")&&"text"===n[t].custom.type&&u.customFields.push(n[t])}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE_CM_CONTACT",msg:e.data?JSON.stringify(e.data):e.toString()})}),u.action.data3=u.action.data3?u.action.data3.split(","):["phone"],"1"!==u.action.data2||u.action.data4||(u.action.data4="phone");break;case"jscripty":u.projects||(l.isAdmin()?r.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.projects=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.projects=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1701}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),a=null;a=[],u.actions.forEach(function(e){if("jscripty"===e.action){var n=_.find(u.projects,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.projects,{id:e.id});n.canSelect=!1,t.push(n)}}),u.projects=t})}else{var t=[],a=[];u.actions.forEach(function(e){if("jscripty"===e.action){var n=_.find(u.projects,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<u.projects.length;i++)_.some(a,{id:u.projects[i].id})&&(u.projects[i].canSelect=!1,t.push(u.projects[i]));u.projects=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"urlForward":u.action.data5||(u.action.data5=5)}}function f(){u.editAccount||(u.action.data2=void 0,u.action.data3=void 0),u.action.isIntegrationDisabled=!u.newAction&&!function(){switch(u.action.data1){case"zendesk":return u.hasSectionPermissions[1301];case"salesforce":return u.hasSectionPermissions[1302];case"sugarcrm":return u.hasSectionPermissions[1305];case"freshdesk":return u.hasSectionPermissions[1303];case"desk":return u.hasSectionPermissions[1306];case"zoho":return u.hasSectionPermissions[1307];case"vtiger":return u.hasSectionPermissions[1308];case"dynamics365":return u.hasSectionPermissions[1309];case"servicenow":return u.hasSectionPermissions[1310];case"freshsales":return u.hasSectionPermissions[1304]}}();var e="int"+_.capitalize(u.action.data1)+"Account";r[e].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u.accounts=e.rows||[],u.editAccount=!1}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.action.data1.toUpperCase()+"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){u.action.data3=u.action.data3?u.action.data3:void 0;var e="int"+_.capitalize(u.action.data1)+"Configuration";r[e].get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){u.configurations=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.action.data1.toUpperCase()+"CONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})})}function A(){var e=angular.copy(u.action);return _.isArray(e.data3)&&(e.data3=u.action.data3.join(",")),e}function E(e){t.hide(e)}u.currentUser=l.getCurrentUser(),void 0!==s&&"urlForward"===s.action&&s.data5&&(s.data5=parseInt(s.data5)),u.action=angular.copy(s),u.actions=angular.copy(e),u.setting=c,u.license=d,u.crudPermissions=m,u.newAction=!1,u.errors=[],u.trigger=angular.copy(o),u.action?function(){switch(u.editAccount=!0,u.action.action){case"integration":return new Promise(function(e){e(p())}).then(function(){return u.editAccount||(u.action.data2=void 0,u.action.data3=void 0,h()),f()}).then(function(){return b()});case"motionbar":case"browser":v()}u.editAccount=!1}():(u.action={},u.newAction=!0),u.action.ActionId=n.params.id||void 0,u.allowedStandardFields=["phone","mobile","fax"],u.addNewAction=function(){u.errors=[];var e=A();r.trigger.addAction({id:n.params.id},e).$promise.then(function(e){u.actions.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_CREATED_SUCCESS_TITLE")}),E(u.actions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"api.action.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},u.saveAction=function(){u.errors=[];var n=A();r.action.update({id:n.id},n).$promise.then(function(){u.actions=_.map(u.actions,function(e){return e.id===n.id?n:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_SAVED_SUCCESS_TITLE")}),E(u.actions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"api.action.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},u.deleteAction=function(e){u.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETE_TITLE")).ariaLabel("Delete action").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){r.action.delete({id:u.action.id}).$promise.then(function(){u.actions=_.filter(u.actions,function(e){return e.id!==u.action.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETED_SUCCESS_TITLE")}),E(u.actions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"api.action.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},u.onActionInit=function(){l.hasModulePermissions("Integrations").then(function(e){u.hasIntegrationsPermissions=e}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MODULE_PERMISSIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),u.action.action&&h()},u.onIntegrationInit=p,u.onSearchFieldsInit=function(){u.newAction||g()},u.onActionSelection=function(){u.newAction&&(u.action.data1=void 0,u.action.data2=void 0,u.action.data3=void 0,u.action.data4=void 0,u.action.data5="urlForward"===u.action.action?5:void 0,h())},u.onIntegrationSelection=f,u.onListSelection=function(){g()},u.onTypeSelection=function(){"0"!==u.action.data1||u.templates?(u.action.data2=void 0,u.action.data4="1"===u.action.data1?0:void 0):v()},u.onAutocreateSelection=function(){"0"===u.action.data2&&(u.action.data4=void 0);u.action.data4||"1"!==u.action.data2||(u.action.data4="phone")},u.onIntegrationAccountSelection=b,u.closeDialog=E,u.onActionLocationChange=function(){u.editAccount||(u.action.data5=void 0,u.action.data6=void 0)}}e.$inject=["$state","$mdDialog","$translate","toasty","actions","action","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditActionDialogController",e)}(),function(){"use strict";function e(e,l,a,n,i,t,d,c,m){var u=this;function s(){var o,r;"voice"===u.trigger.channel?(_.some(u.allConditions.rows,["field","queue"])&&(u.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,m.isAdmin()?c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){u.queues=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(c.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];u.allConditions.rows.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),u.queues=t}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.allConditions.rows,["field","routeId"])&&(u.outboundRoutes||(m.isAdmin()?c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.outboundRoutes,{id:e.resourceId})}),a=null;a=[],u.triggerAllConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),u.outboundRoutes=t})}else{var t=[],a=[];u.allConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<u.outboundRoutes.length;i++)_.some(a,{id:u.outboundRoutes[i].id})&&(u.outboundRoutes[i].canSelect=!1,t.push(u.outboundRoutes[i]));u.outboundRoutes=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.allConditions.rows,["field","agent"])&&(u.agents||(m.isAdmin()?c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.agents,{id:e.resourceId})}),a=null;a=[],u.triggerAllConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),u.agents=t})}else{var t=[],a=[];u.allConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}});for(var i=0;i<u.agents.length;i++)_.some(a,{id:u.agents[i].id})&&(u.agents[i].canSelect=!1,t.push(u.agents[i]));u.agents=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})})))):("mail"===u.trigger.channel&&c.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.mailSubstatuses=e.rows||[]}).catch(function(){d.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})}),function(){var e,s=u.trigger.channel+("chat"===u.trigger.channel?"Websites":"Accounts"),n=u.trigger.channel+("chat"===u.trigger.channel?"Website":"Account");switch(u.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}m.isAdmin()?c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u[s],{id:e.resourceId})}),a=null;a=[],u.allConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u[s],{id:e.id});n.canSelect=!1,t.push(n)}}),u[s]=t})}else{var t=[],a=[];u.allConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}});for(var i=0;i<u[s].length;i++)_.some(a,{id:u[s][i].id})&&(u[s][i].canSelect=!1,t.push(u[s][i]));u[s]=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}())}function o(e){u.allConditions=e||{count:0,rows:[]},s()}function r(){u.query.offset=(u.query.page-1)*u.query.limit,u.promise=c.trigger.getAllConditions(u.query,o).$promise}function p(e,n){c.condition.delete({id:e.id}).$promise.then(function(){r(),n&&d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}u.currentUser=m.getCurrentUser(),u.trigger={},u.allConditions={count:0,rows:[]},u.selectedAllConditions=[],u.query={fields:"id,field,operator,value,createdAt,updatedAt",limit:10,page:1},u.fields={queue:"Queue",lastevent:"Call_Status",routeId:"OutboundRoute",agent:"Agent",account:"Account",interaction:"Interaction",message:"Message",mailSubstatus:"Mail_Substatus",offlineMessage:"Offline_Message"},u.callStatuses={abandoned:"Abandon",timeout:"Timeout",complete:"Hangup",rejected:"Reject",called:"Ring",connect:"Answer",nosuchnumber:"NoSuchNumber",busy:"Busy",noanswer:"NoAnswer",congestion:"Congestion",agentreject:"AgentReject",amd:"AMD"},u.messageStatuses={in:"Incoming",out:"Outgoing",accept:"Accepted",reject:"Rejected"},u.onInit=function(e,n){u.trigger=e,u.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},u.query.TriggerAllId=u.trigger.id,u.query.id=u.trigger.id,r()},u.success=o,u.getAllConditions=r,u.createOrEditAllCondition=function(e,n){i.show({controller:"CreateOrEditAllConditionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/allconditions/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:u.trigger,allCondition:n,allConditions:u.allConditions.rows,license:null,setting:null,crudPermissions:u.crudPermissions}}).then(function(e){e&&(u.allConditions={count:e.length,rows:e},s())})},u.exportSelectedAllConditions=function(){var e=angular.copy(u.selectedAllConditions);return u.selectedAllConditions=[],e},u.deleteConfirm=function(e,n){var t=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").targetEvent(n).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(t).then(function(){p(e,!0)})},u.deleteSelectedAllConditions=function(e){var n=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_MESSAGE",{total:u.selectedAllConditions.length})).ariaLabel("Delete conditions").targetEvent(e).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(n).then(function(){u.selectedAllConditions.forEach(function(e){p(e)}),u.selectedAllConditions=[],d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETED_SUCCESS_TITLE")})})}}e.$inject=["$scope","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerAllConditionsController",e)}(),function(){"use strict";function e(e,t,l,a,i,n,s,o,d,c,r,m,u){var p=this;function g(){switch(p.allCondition.field){case"queue":p.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,c.isAdmin()?d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){p.queues=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(d.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];p.allConditions.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),p.queues=t}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"routeId":p.outboundRoutes||(c.isAdmin()?d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.outboundRoutes,{id:e.resourceId})}),a=null;a=[],p.allConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),p.outboundRoutes=t})}else{var t=[],a=[];p.allConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.outboundRoutes.length;i++)_.some(a,{id:p.outboundRoutes[i].id})&&(p.outboundRoutes[i].canSelect=!1,t.push(p.outboundRoutes[i]));p.outboundRoutes=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"agent":p.agents||(c.isAdmin()?d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.agents,{id:e.resourceId})}),a=null;a=[],p.allConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),p.agents=t})}else{var t=[],a=[];p.allConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}});for(var i=0;i<p.agents.length;i++)_.some(a,{id:p.agents[i].id})&&(p.agents[i].canSelect=!1,t.push(p.agents[i]));p.agents=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"account":!function(){var e,n=p.trigger.channel+("chat"===p.trigger.channel?"Website":"Account");switch(p.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}c.isAdmin()?d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.accounts,{id:e.resourceId})}),a=null;a=[],p.allConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.accounts,{id:e.id});n.canSelect=!1,t.push(n)}}),p.accounts=t})}else{var t=[],a=[];p.allConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.accounts.length;i++)_.some(a,{id:p.accounts[i].id})&&(p.accounts[i].canSelect=!1,t.push(p.accounts[i]));p.accounts=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}();break;case"mailSubstatus":d.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){p.mailSubstatuses=e.rows||[]}).catch(function(){i.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})})}var o,r}function v(e){t.hide(e)}p.currentUser=c.getCurrentUser(),p.allCondition=angular.copy(s),p.allConditions=angular.copy(n),p.setting=m,p.license=r,p.crudPermissions=u,p.hasModulePermissions={},p.newAllCondition=!1,p.errors=[],p.trigger=angular.copy(o),p.allCondition?g():(p.allCondition={operator:"equals"},p.newAllCondition=!0),p.allCondition.TriggerAllId=e.params.id||void 0,p.callStatuses=[{name:"Abandon",value:"abandoned"},{name:"Timeout",value:"timeout"},{name:"Hangup",value:"complete"},{name:"Reject",value:"rejected"},{name:"Ring",value:"called"},{name:"Answer",value:"connect"},{name:"NoSuchNumber",value:"nosuchnumber"},{name:"Busy",value:"busy"},{name:"NoAnswer",value:"noanswer"},{name:"Congestion",value:"congestion"},{name:"AgentReject",value:"agentreject"},{name:"AMD",value:"amd"}],p.onFieldSelection=function(){p.allCondition.value=void 0,g()},p.addNewAllCondition=function(){p.errors=[],d.trigger.addAllCondition({id:e.params.id},p.allCondition).$promise.then(function(e){p.allConditions.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_CREATED_SUCCESS_TITLE")}),v(p.allConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.saveAllCondition=function(){p.errors=[],d.condition.update({id:p.allCondition.id},p.allCondition).$promise.then(function(){p.allConditions=_.map(p.allConditions,function(e){return e.id===p.allCondition.id?p.allCondition:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_SAVED_SUCCESS_TITLE")}),v(p.allConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.deleteAllCondition=function(e){p.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){d.condition.delete({id:p.allCondition.id}).$promise.then(function(){p.allConditions=_.filter(p.allConditions,function(e){return e.id!==p.allCondition.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")}),v(p.allConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},p.closeDialog=v}e.$inject=["$state","$mdDialog","$q","$translate","toasty","allConditions","allCondition","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditAllConditionDialogController",e)}(),function(){"use strict";function e(e,l,a,n,i,t,d,c,m){var u=this;function s(){var o,r;"voice"===u.trigger.channel?(_.some(u.anyConditions.rows,["field","queue"])&&(u.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,m.isAdmin()?c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){u.queues=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(c.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),u.queues=t}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.anyConditions.rows,["field","routeId"])&&(u.outboundRoutes||(m.isAdmin()?c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.outboundRoutes,{id:e.resourceId})}),a=null;a=[],u.anyConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),u.outboundRoutes=t})}else{var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<u.outboundRoutes.length;i++)_.some(a,{id:u.outboundRoutes[i].id})&&(u.outboundRoutes[i].canSelect=!1,t.push(u.outboundRoutes[i]));u.outboundRoutes=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.anyConditions.rows,["field","agent"])&&(u.agents||(m.isAdmin()?c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.agents,{id:e.resourceId})}),a=null;a=[],u.anyConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),u.agents=t})}else{var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}});for(var i=0;i<u.agents.length;i++)_.some(a,{id:u.agents[i].id})&&(u.agents[i].canSelect=!1,t.push(u.agents[i]));u.agents=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})})))):("mail"===u.trigger.channel&&c.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.mailSubstatuses=e.rows||[]}).catch(function(){d.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})}),function(){var e,s=u.trigger.channel+("chat"===u.trigger.channel?"Websites":"Accounts"),n=u.trigger.channel+("chat"===u.trigger.channel?"Website":"Account");switch(u.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}m.isAdmin()?c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u[s],{id:e.resourceId})}),a=null;a=[],u.anyConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u[s],{id:e.id});n.canSelect=!1,t.push(n)}}),u[s]=t})}else{var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}});for(var i=0;i<u[s].length;i++)_.some(a,{id:u[s][i].id})&&(u[s][i].canSelect=!1,t.push(u[s][i]));u[s]=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}())}function o(e){u.anyConditions=e||{count:0,rows:[]},s()}function r(){u.query.offset=(u.query.page-1)*u.query.limit,u.promise=c.trigger.getAnyConditions(u.query,o).$promise}function p(e,n){c.condition.delete({id:e.id}).$promise.then(function(){r(),n&&d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}u.currentUser=m.getCurrentUser(),u.trigger={},u.anyConditions={count:0,rows:[]},u.selectedAnyConditions=[],u.query={fields:"id,field,operator,value,createdAt,updatedAt",limit:10,page:1},u.fields={queue:"Queue",lastevent:"Call_Status",routeId:"OutboundRoute",agent:"Agent",account:"Account",interaction:"Interaction",message:"Message",mailSubstatus:"Mail_Substatus",offlineMessage:"Offline_Message"},u.callStatuses={abandoned:"Abandon",timeout:"Timeout",complete:"Hangup",rejected:"Reject",called:"Ring",connect:"Answer",nosuchnumber:"NoSuchNumber",busy:"Busy",noanswer:"NoAnswer",congestion:"Congestion",agentreject:"AgentReject",amd:"AMD"},u.messageStatuses={in:"Incoming",out:"Outgoing",accept:"Accepted",reject:"Rejected"},u.onInit=function(e,n){u.trigger=e,u.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},u.query.TriggerAnyId=u.trigger.id,u.query.id=u.trigger.id,r()},u.success=o,u.getAnyConditions=r,u.createOrEditAnyCondition=function(e,n){i.show({controller:"CreateOrEditAnyConditionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/anyconditions/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:u.trigger,anyCondition:n,anyConditions:u.anyConditions.rows,license:null,setting:null,crudPermissions:u.crudPermissions}}).then(function(e){e&&(u.anyConditions={count:e.length,rows:e},s())})},u.exportSelectedAnyConditions=function(){var e=angular.copy(u.selectedAnyConditions);return u.selectedAnyConditions=[],e},u.deleteConfirm=function(e,n){var t=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").targetEvent(n).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(t).then(function(){p(e,!0)})},u.deleteAnyCondition=p,u.deleteSelectedAnyConditions=function(e){var n=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_MESSAGE",{total:u.selectedAnyConditions.length})).ariaLabel("Delete conditions").targetEvent(e).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(n).then(function(){u.selectedAnyConditions.forEach(function(e){p(e)}),u.selectedAnyConditions=[],d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETED_SUCCESS_TITLE")})})}}e.$inject=["$scope","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerAnyConditionsController",e)}(),function(){"use strict";function e(e,t,l,a,i,n,s,o,d,c,r,m,u){var p=this;function g(){switch(p.anyCondition.field){case"queue":p.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,c.isAdmin()?d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){p.queues=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(d.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];p.anyConditions.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),p.queues=t}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"routeId":p.outboundRoutes||(c.isAdmin()?d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.outboundRoutes,{id:e.resourceId})}),a=null;a=[],p.anyConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),p.outboundRoutes=t})}else{var t=[],a=[];p.anyConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.outboundRoutes.length;i++)_.some(a,{id:p.outboundRoutes[i].id})&&(p.outboundRoutes[i].canSelect=!1,t.push(p.outboundRoutes[i]));p.outboundRoutes=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"agent":p.agents||(c.isAdmin()?d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.agents,{id:e.resourceId})}),a=null;a=[],p.anyConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),p.agents=t})}else{var t=[],a=[];p.anyConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}});for(var i=0;i<p.agents.length;i++)_.some(a,{id:p.agents[i].id})&&(p.agents[i].canSelect=!1,t.push(p.agents[i]));p.agents=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"account":!function(){var e,n=p.trigger.channel+("chat"===p.trigger.channel?"Website":"Account");switch(p.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}c.isAdmin()?d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.accounts,{id:e.resourceId})}),a=null;a=[],p.anyConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.accounts,{id:e.id});n.canSelect=!1,t.push(n)}}),p.accounts=t})}else{var t=[],a=[];p.anyConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.accounts.length;i++)_.some(a,{id:p.accounts[i].id})&&(p.accounts[i].canSelect=!1,t.push(p.accounts[i]));p.accounts=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}();break;case"mailSubstatus":d.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){p.mailSubstatuses=e.rows||[]}).catch(function(){i.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})})}var o,r}function v(e){t.hide(e)}p.currentUser=c.getCurrentUser(),p.anyCondition=angular.copy(s),p.anyConditions=angular.copy(n),p.setting=m,p.license=r,p.crudPermissions=u,p.hasModulePermissions={},p.newAnyCondition=!1,p.errors=[],p.trigger=angular.copy(o),p.anyCondition?g():(p.anyCondition={operator:"equals"},p.newAnyCondition=!0),p.anyCondition.TriggerAnyId=e.params.id||void 0,p.callStatuses=[{name:"Abandon",value:"abandoned"},{name:"Timeout",value:"timeout"},{name:"Hangup",value:"complete"},{name:"Reject",value:"rejected"},{name:"Ring",value:"called"},{name:"Answer",value:"connect"},{name:"NoSuchNumber",value:"nosuchnumber"},{name:"Busy",value:"busy"},{name:"NoAnswer",value:"noanswer"},{name:"Congestion",value:"congestion"},{name:"AgentReject",value:"agentreject"},{name:"AMD",value:"amd"}],p.onFieldSelection=function(){p.anyCondition.value=void 0,g()},p.addNewAnyCondition=function(){p.errors=[],d.trigger.addAnyCondition({id:e.params.id},p.anyCondition).$promise.then(function(e){p.anyConditions.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_CREATED_SUCCESS_TITLE")}),v(p.anyConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.saveAnyCondition=function(){p.errors=[],d.condition.update({id:p.anyCondition.id},p.anyCondition).$promise.then(function(){p.anyConditions=_.map(p.anyConditions,function(e){return e.id===p.anyCondition.id?p.anyCondition:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_SAVED_SUCCESS_TITLE")}),v(p.anyConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.deleteAnyCondition=function(e){p.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){d.condition.delete({id:p.anyCondition.id}).$promise.then(function(){p.anyConditions=_.filter(p.anyConditions,function(e){return e.id!==p.allCondition.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")}),v(p.anyConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},p.closeDialog=v}e.$inject=["$state","$mdDialog","$q","$translate","toasty","anyConditions","anyCondition","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditAnyConditionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;d.currentUser=o.getCurrentUser(),d.license=t,d.setting=a,d.trigger=r||e.params.trigger||{},d.selectedTab=e.params.tab||0,e.params.crudPermissions?d.crudPermissions=e.params.crudPermissions:(d.userProfileSection=l&&1==l.count?l.rows[0]:null,d.crudPermissions=o.parseCrudPermissions(d.userProfileSection?d.userProfileSection.crudPermissions:null)),d.gotoTriggers=function(){e.go("app.tools.triggers",{},{reload:"app.tools.triggers"})},d.saveTrigger=function(){i.trigger.update({id:d.trigger.id},d.trigger).$promise.then(function(){s.success({title:n.instant("TOOLS.NOTIFICATIONS.TRIGGER_SAVED_SUCCESS_TITLE")})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$translate","license","setting","api","toasty","Auth","trigger","userProfileSection"],angular.module("app.tools").controller("TriggerController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){n.go("app.tools.triggers.edit",{id:e.id,trigger:e,crudPermissions:g.crudPermissions})}function h(e){g.triggers=e||{count:0,rows:[]}}function f(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.trigger.get(g.query,h).$promise:(g.query.id=g.userProfile.id,g.query.section="Triggers",g.promise=d.userProfile.getResources(g.query,h).$promise)}function b(e,n){d.trigger.delete({id:e.id}).$promise.then(function(){f(),n&&c.success({title:s.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtrigger"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.triggers=o||{count:0,rows:[]},g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedTriggers=[],g.query={fields:"id,name,channel,status,description,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},g.goToEditState=v,g.createOrEditTrigger=function(e,n){if(g.crudPermissions.readOnly||g.crudPermissions.canDelete&&!g.crudPermissions.canEdit)return void v(n);a.show({controller:"CreateOrEditTriggerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:n,triggers:g.triggers.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions}}).then(function(e){e&&(g.triggers={count:e.length,rows:e})})},g.success=h,g.getTriggers=f,g.deleteconfirm=function(e,n){var t=a.confirm().title(s.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_TITLE")).content(s.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_MESSAGE",{name:e.name})).ariaLabel("Delete trigger").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){b(e,!0)})},g.exportSelectedTriggers=function(){var e=angular.copy(g.selectedTriggers);return g.selectedTriggers=[],e},g.deleteSelectedTriggers=function(e){var n=a.confirm().title(s.instant("TOOLS.NOTIFICATIONS.TRIGGERS_DELETE_TITLE")).content(s.instant("TOOLS.NOTIFICATIONS.TRIGGERS_DELETE_MESSAGE",{total:g.selectedTriggers.length})).ariaLabel("Delete triggers").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedTriggers.forEach(function(e){b(e)}),g.selectedTriggers=[],c.success({title:s.instant("TOOLS.NOTIFICATIONS.TRIGGERS_DELETED_SUCCESS_TITLE")})})},g.deselectTriggers=function(){g.selectedTriggers=[]},g.selectAllTriggers=function(){g.selectedTriggers=g.triggers.rows};var A=!0,E=1;e.$watch("vm.query.filter",function(e,n){A?i(function(){A=!1}):(n||(E=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=E),f())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","triggers","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.tools").controller("TriggersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_TRUNK",g.trunk=angular.copy(l),g.trunks=r,g.newTrunk=!1,g.trunk||(g.trunk={active:!0,type:"friend",dtmfmode:"rfc2833",qualify:"yes",t38pt_udptl:"no"},g.title="TOOLS.NEW_TRUNK",g.newTrunk=!0),g.addNewTrunk=function(){g.errors=[],d.trunk.save(g.trunk).$promise.then(function(e){g.trunks.unshift(e.toJSON()),o.success({title:"Trunk properly created",msg:g.trunk.name?g.trunk.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTrunk=function(){g.errors=[],d.trunk.update({id:g.trunk.id},g.trunk).$promise.then(function(e){var n=_.find(g.trunks,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Trunk properly saved!",msg:g.trunk.name?g.trunk.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTrunk=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The trunk will be deleted.").ariaLabel("Delete Trunk").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.trunk.delete({id:g.trunk.id}).$promise.then(function(){_.remove(g.trunks,{id:g.trunk.id}),o.success({title:"Trunk properly deleted!",msg:(g.trunk.name||"trunk")+" has been deleted!"}),v(g.trunk)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","trunks","trunk","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTrunkDialogController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newTrunk=!0,r.trunk=angular.copy(i),r.trunks=s,r.title=o.instant("TOOLS.CLONE_TRUNK"),i&&i.name&&(r.title+=": "+i.name),r.cloneTrunk=function(){return e.trunk.clone({id:i.id},r.trunk).$promise.then(function(e){r.trunks.unshift(e.toJSON()),a.success({title:"Trunk properly cloned",msg:r.trunk.name?r.trunk.name+" has been cloned!":""}),t.go("app.tools.trunks.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","trunk","trunks","$translate"],angular.module("app.tools").controller("TrunkcloneController",e)}(),function(){"use strict";function e(t,e,a,i,s,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.trunk=c||t.params.trunk||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.trunks",{}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.trunks",{})}},u.clonedialog=function(e,n){a.show({controller:"TrunkcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/edit/clone/clone.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{trunk:e,trunks:u.trunks?u.trunks.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoTrunks=function(){t.go("app.tools.trunks",{},{reload:"app.tools.trunks"})},u.saveTrunk=function(){r.trunk.update({id:u.trunk.id},u.trunk).$promise.then(function(){l.success({title:"Trunk updated!",msg:u.trunk.name?u.trunk.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunk",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),t=null;if(u.trunk&&(t=_.find(u.contexts,{name:u.trunk.context})),t&&!_.some(n,["id",t.id])){var a=_.find(u.contexts,{id:t.id});a.canSelect=!1,n.push(a)}u.contexts=n}):r.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){u.contexts=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","trunk","userProfileSection"],angular.module("app.tools").controller("TrunkController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.trunks=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="trunks",f.listOrder="",f.listOrderAsc=null,f.selectedTrunks=[],f.query={fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Friend",value:"'friend'"},{option:"User",value:"'user'"},{option:"Peer",value:"'peer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydtmfmode=_.keyBy([{option:"rfc2833",value:"'rfc2833'"},{option:"info",value:"'info'"},{option:"shortinfo",value:"'shortinfo'"},{option:"inband",value:"'inband'"},{option:"auto",value:"'auto'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayqualify=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayallow=_.keyBy([{option:"ulaw",value:"'ulaw'"},{option:"alaw",value:"'alaw'"},{option:"gsm",value:"'gsm'"},{option:"g723",value:"'g723'"},{option:"g726",value:"'g726'"},{option:"g722",value:"'g722'"},{option:"g729",value:"'g729'"},{option:"ilbc",value:"'ilbc'"},{option:"opus",value:"'opus'"},{option:"h264",value:"'h264'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayinsecure=_.keyBy([{option:"port",value:"'port'"},{option:"invite",value:"'invite'"},{option:"very",value:"'very'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydirectmedia=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"nonat",value:"'nonat'"},{option:"update",value:"'update'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraycallcounter=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayusereqphone=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytrustrpid=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysendrpid=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"pai",value:"'pai'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayencryption=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"},{option:"tls",value:"'tls'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.tools.trunks.edit",{id:e.id,trunk:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"TrunkcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{trunk:e,trunks:f.trunks?f.trunks.rows:[],crudPermissions:f.crudPermissions}})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.trunks",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.trunks",{})}},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("trunk")+"?").htmlContent("<b>"+(e.name||"trunk")+"</b> will be deleted.").ariaLabel("delete trunk").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTrunks=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.trunk.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Trunks",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTrunk=function(e,n){i.show({controller:"CreateOrEditTrunkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{trunk:n,trunks:f.trunks.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTrunk=y,f.exportSelectedTrunks=function(){var e=angular.copy(f.selectedTrunks);return f.selectedTrunks=[],e},f.deleteSelectedTrunks=function(e){var n=i.confirm().title("Are you sure want to delete the selected trunks?").htmlContent("<b>"+f.selectedTrunks.length+" selected</b> will be deleted.").ariaLabel("delete Trunks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTrunks.forEach(function(e){y(e)}),f.selectedTrunks=[]})},f.deselectTrunks=function(){f.selectedTrunks=[]},f.selectAllTrunks=function(){f.selectedTrunks=f.trunks.rows};var b=!0,A=1;function E(e){f.trunks=e||{count:0,rows:[]}}function y(e){m.trunk.delete({id:e.id}).$promise.then(function(){_.remove(f.trunks.rows,{id:e.id}),f.trunks.count-=1,f.trunks.rows.length||f.getTrunks(),p.success({title:_.startCase("Trunk")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtrunk"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtrunk",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTrunks())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","trunks","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("TrunksController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_VARIABLE",g.variable=angular.copy(l),g.variables=r,g.newVariable=!1,g.variable||(g.variable={},g.title="TOOLS.NEW_VARIABLE",g.newVariable=!0),g.addNewVariable=function(){g.errors=[],d.variable.save(g.variable).$promise.then(function(e){g.variables.unshift(e.toJSON()),o.success({title:"Variable properly created",msg:g.variable.name?g.variable.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.variable.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVariable=function(){g.errors=[],d.variable.update({id:g.variable.id},g.variable).$promise.then(function(e){var n=_.find(g.variables,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Variable properly saved!",msg:g.variable.name?g.variable.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.variable.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVariable=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The variable will be deleted.").ariaLabel("Delete Variable").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.variable.delete({id:g.variable.id}).$promise.then(function(){_.remove(g.variables,{id:g.variable.id}),o.success({title:"Variable properly deleted!",msg:(g.variable.name||"variable")+" has been deleted!"}),v(g.variable)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.variable.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","variables","variable","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditVariableDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.variables=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="variables",f.listOrder="",f.listOrderAsc=null,f.selectedVariables=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{variable:e,variables:f.variables.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("variable")+"?").htmlContent("<b>"+(e.name||"variable")+"</b> will be deleted.").ariaLabel("delete variable").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVariables=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.variable.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Variables",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVariable=function(e,n){i.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{variable:n,variables:f.variables.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteVariable=y,f.exportSelectedVariables=function(){var e=angular.copy(f.selectedVariables);return f.selectedVariables=[],e},f.deleteSelectedVariables=function(e){var n=i.confirm().title("Are you sure want to delete the selected variables?").htmlContent("<b>"+f.selectedVariables.length+" selected</b> will be deleted.").ariaLabel("delete Variables").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVariables.forEach(function(e){y(e)}),f.selectedVariables=[]})},f.deselectVariables=function(){f.selectedVariables=[]},f.selectAllVariables=function(){f.selectedVariables=f.variables.rows};var b=!0,A=1;function E(e){f.variables=e||{count:0,rows:[]}}function y(e){m.variable.delete({id:e.id}).$promise.then(function(){_.remove(f.variables.rows,{id:e.id}),f.variables.count-=1,f.variables.rows.length||f.getVariables(),p.success({title:_.startCase("Variable")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvariable"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvariable",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVariables())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","variables","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("VariablesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VIDEO.EDIT_SCREENRECORDING",g.screenRecording=angular.copy(l),g.screenRecordings=r,g.newscreenRecording=!1,g.screenRecording||(g.screenRecording={},g.title="VIDEO.NEW_SCREENRECORDING",g.newscreenRecording=!0),g.addNewscreenRecording=function(){g.errors=[],d.screenRecording.save(g.screenRecording).$promise.then(function(e){g.screenRecordings.unshift(e.toJSON()),o.success({title:"screenRecording properly created",msg:g.screenRecording.name?g.screenRecording.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.screenRecording.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savescreenRecording=function(){g.errors=[],d.screenRecording.update({id:g.screenRecording.id},g.screenRecording).$promise.then(function(e){var n=_.find(g.screenRecordings,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"screenRecording properly saved!",msg:g.screenRecording.name?g.screenRecording.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.screenRecording.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletescreenRecording=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The screenRecording will be deleted.").ariaLabel("Delete screenRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.screenRecording.delete({id:g.screenRecording.id}).$promise.then(function(){_.remove(g.screenRecordings,{id:g.screenRecording.id}),o.success({title:"screenRecording properly deleted!",msg:(g.screenRecording.name||"screenRecording")+" has been deleted!"}),v(g.screenRecording)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.screenRecording.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,d.user.get({fields:"id,name,fullname",sort:"name",nolimit:"true"}).$promise.then(function(e){g.users=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","screenRecordings","screenRecording","api","Auth","license","setting","crudPermissions"],angular.module("app.video").controller("CreateOrEditscreenRecordingDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c,m=this;if(m.loading=!1,m.recording=Object.assign({},i),m.route="screenRecording",m.element=l,m.actionOptions=Object.assign({},s),m.path=r,m.label=o,m.app="video",m.model="screenRecording",console.log("TCL: vm.path",m.path),console.log("TCL: vm.recording[vm.path]",m.recording[m.path]),m.filename=-1<m.recording[m.path].indexOf("/")?m.recording[m.path].substring(m.recording[m.path].lastIndexOf("/")+1):-1<m.recording[m.path].indexOf("\\")?m.recording[m.path].substring(m.recording[m.path].lastIndexOf("\\")+1):m.recording[m.path],m.format=!1,_.isNil(m.recording.format)&&(m.recording.format=m.filename.slice(m.filename.lastIndexOf("."))),(".wav"===m.recording.format&&"audio"===m.element||".mp4"===m.recording.format&&"video"===m.element)&&(m.format=!0),m.found=!0,m.format&&(c=d.defer(),a.screenRecording.download({id:m.recording.id,path:String(m.path)}).$promise.then(function(e){m.format=!0,m.found=!0,c.resolve()}).catch(function(e){console.log("err"),m.format=!1,m.found=!1,c.resolve()}),c.promise),!_.isNil(s.properties)&&s.properties){if(m.properties=Object.assign({},i),Object.keys(i).forEach(function(e){String(e[0].toUpperCase())===String(e[0])&&delete m.properties[e]}),m.propertiesDefault={},!_.isNil(s.propertiesList)&&0<s.propertiesList.length){m.propertiesDefault=Object.assign({},i);var u=s.propertiesList,p=Object.keys(i),g=!0;p.forEach(function(n){g=!0,u.forEach(function(e){String(n)===String(e)&&(g=!1)}),g&&delete m.propertiesDefault[n]}),m.properties=m.propertiesDefault}if(!_.isNil(s.extraData)&&0<s.extraData.length){m.propertiesExtra={};for(var v=s.extraData,h=0;h<v.length;h++)for(var f=v[h].values,b=v[h].model,A=0;A<f.length;A++)m.propertiesExtra[f[A].text]=i[b][f[A].key];m.properties=Object.assign({},m.propertiesDefault,m.propertiesExtra)}}m.closeDialog=function(){n.hide()}}e.$inject=["$scope","$mdDialog","toasty","api","recording","actionOptions","label","varPath","elementTag","$q"],angular.module("app.video").controller("screenRecordingplayController",e)}(),function(){"use strict";function e(e,n,t,a,r,l,i,o,s,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.screenRecordings=s||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="screenRecordings",f.listOrder="",f.listOrderAsc=null,f.selectedScreenRecordings=[],f.query={fields:"createdAt,updatedAt,id,interactionid,channel,format,value,rating,UserId,duration,startedAt,closedAt",createdAt:"@msUtils.firstLastDayMonth()",includeAll:"true",sort:"-updatedAt",limit:10,page:1},f.query.createdAt=u.firstLastDayMonth(),f.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE_RANGE"}],f.playrecording=function(e,n,t,a,i){var s={route:"screenRecording",name:"screenRecordings",model:"screenRecording",singular:"screenRecording"},a=String(a),o=String(t);console.log("TCL:  path",String(t)),r.show({controller:"screenRecordingplayController",controllerAs:"vm",templateUrl:"app/main/apps/video/views/screenRecordings/partialViews/play.html",parent:angular.element(l.body),targetEvent:n,clickOutsideToClose:!0,locals:{recording:e,recordings:f.screenRecordings.rows,license:f.license,setting:null,item:s,actionOptions:{upperTitle:!1,lowerTitle:!0,properties:!0,propertiesIcon:"icon-video",propertiesList:["format","interactionid","duration","startedAt","closedAt","createdAt"],extraData:[{model:"User",values:[{key:"name",text:"agentname"}]}]},label:a,varPath:o,elementTag:String(i)}})},f.downloadfile2=function(e,n){var t=!1,a=_.isNil(e.format)?e.value.substring(e.value.lastIndexOf(".")):e.format;t=".mp4"===a;var s=-1<e.value.lastIndexOf("/")?e.value.substring(e.value.lastIndexOf("/")+1):-1<e.value.lastIndexOf("\\")?e.value.substring(e.value.lastIndexOf("\\")+1):e.value;return m.screenRecording.download({id:e.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"404"===String(e.status)&&!1===t?p.info({title:o.instant("VIDEO.CANT_DOWNLOAD_THIS_FILE"),msg:o.instant("VIDEO.WRONG_EXTENSION")}):"404"===String(e.status)?p.info({title:o.instant("VIDEO.CANT_DOWNLOAD_THIS_FILE"),msg:o.instant("VIDEO.FILE_NOT_FOUND")}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=r.confirm().title("Are you sure want to delete the "+_.startCase("screenRecording")+"?").htmlContent("<b>"+(e.name||"screenRecording")+"</b> will be deleted.").ariaLabel("delete screenRecording").targetEvent(n).ok("OK").cancel("CANCEL");r.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getScreenRecordings=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.screenRecording.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ScreenRecordings",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditscreenRecording=function(e,n){r.show({controller:"CreateOrEditscreenRecordingDialogController",controllerAs:"vm",templateUrl:"app/main/apps/video/views/screenRecordings/create/dialog.html",parent:angular.element(l.body),targetEvent:e,clickOutsideToClose:!0,locals:{screenRecording:n,screenRecordings:f.screenRecordings.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletescreenRecording=y,f.exportSelectedScreenRecordings=function(){var e=angular.copy(f.selectedScreenRecordings);return f.selectedScreenRecordings=[],e},f.deleteSelectedScreenRecordings=function(e){var n=r.confirm().title("Are you sure want to delete the selected screenRecordings?").htmlContent("<b>"+f.selectedScreenRecordings.length+" selected</b> will be deleted.").ariaLabel("delete screenRecordings").targetEvent(e).ok("OK").cancel("CANCEL");r.show(n).then(function(){f.selectedScreenRecordings.forEach(function(e){y(e)}),f.selectedScreenRecordings=[]})},f.deselectScreenRecordings=function(){f.selectedScreenRecordings=[]},f.selectAllScreenRecordings=function(){f.selectedScreenRecordings=f.screenRecordings.rows},f.convertDuration=function(e){var n=Math.floor(e/1e3%60),t=Math.floor(e/6e4%60),a=Math.floor(e/36e5%24),i=a<10?"0"+String(a):String(a),s=t<10?"0"+String(t):String(t),o=n<10?"0"+String(n):String(n);return i+":"+s+":"+o},m.user.get({fields:"id,name,fullname",sort:"name",nolimit:"true"}).$promise.then(function(e){f.users=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.screenRecordings=e||{count:0,rows:[]}}function y(e){m.screenRecording.delete({id:e.id}).$promise.then(function(){_.remove(f.screenRecordings.rows,{id:e.id}),f.screenRecordings.count-=1,f.screenRecordings.rows.length||f.getScreenRecordings(),p.success({title:_.startCase("screenRecording")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEscreenRecording"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEscreenRecording",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getScreenRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","screenRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.video").controller("ScreenRecordingsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(e){return _.isEmpty(e)||isNaN(e)?e:parseInt(e,10)}function m(e){switch(e){case"sound":if(!d.application.appdata)return;return[{key:"save_name",value:d.application.appdata.split("/").pop()}];case"squareProject":if(!d.application.project)return;return[{key:"name",value:d.application.project.split(",")[1]}];case"tag":if(!d.application.tag)return;return[{key:"name",value:d.application.tag}];case"trunk":if(!d.application.trunk)return;return[{key:"name",value:d.application.trunk}];case"user":if(!d.application.user&&!d.application.users)return;return d.application.user?[{key:"name",value:d.application.user.split("/")[1]}]:_.map(d.application.users,function(e){return{key:"name",value:e.split("/")[1]}});case"variable":if(!d.application.name)return;return[{key:"name",value:d.application.name}];case"voiceContext":if(!d.application.context)return;return[{key:"name",value:d.application.context}];case"voiceMail":if(!d.application.voiceMail)return;return[{key:"mailbox",value:d.application.voiceMail.split("@")[0]}];case"voiceQueue":if(!d.application.queue)return;return[{key:"name",value:d.application.queue}]}}function u(){o.getResourcesByRole(d.currentUser,"trunk",{fields:"id,name",sort:"name",nolimit:"true"},m("trunk")).then(function(e){d.trunks=e}).catch(function(){s.error({title:i.instant("TOOLS.TRUNKS"),msg:i.instant("VOICE.NOTIFICATIONS.TRUNKS_GET_ERROR")})})}function p(){o.getResourcesByRole(d.currentUser,"sound",{fields:"id,name,save_name",sort:"name",nolimit:"true"},m("sound")).then(function(e){d.sounds=e}).catch(function(){s.error({title:i.instant("TOOLS.SOUNDS"),msg:i.instant("VOICE.NOTIFICATIONS.SOUNDS_GET_ERROR")})})}function g(){var e={fields:"id,name,role",sort:"name",nolimit:"true"},n=m("user"),t=[o.getResourcesByRole(d.currentUser,"user",_.merge(e,{role:"agent"}),n,"Agents"),o.getResourcesByRole(d.currentUser,"user",_.merge(e,{role:"telephone"}),n,"Telephones")];a.all(t).then(function(e){var n=_(e).flatMap(function(e){return e.rows}).orderBy([function(e){return e.name.toLowerCase()}]).value();d.users={rows:n,count:n.length}}).catch(function(){s.error({title:i.instant("STAFF.USERS"),msg:i.instant("VOICE.NOTIFICATIONS.USERS_GET_ERROR")})})}function v(){(d.application.appdata||"custom"===d.application.appType)&&e.hide(d.application),e.hide()}d.currentUser=r.getCurrentUser(),d.application=angular.copy(n),d.crudPermissions=l,d.errors=[],d.init=function(){d.application.appdata&&function(){var e=[];switch(d.application.appType){case"agi":d.application.project=d.application.appdata;break;case"dial":e=d.application.appdata.split(","),d.application.tech=c(e[0]),d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"externalDial":e=d.application.appdata.split(","),d.application.trunk=e[0].split("/")[1],d.application.phone=e[0].split("/")[2],d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"goTo":e=d.application.appdata.split(","),d.application.context=c(e[0]),d.application.extension=c(e[1]),d.application.priority=c(e[2]);break;case"internalDial":e=d.application.appdata.split(","),d.application.user=c(e[0]),d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"outboundDial":e=d.application.appdata.split(","),d.application.trunk=e[0].split("/")[1],d.application.phone=e[0].split("/")[2],d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]),d.application.prefix=d.application.phone?d.application.phone.split("$")[0]:void 0,d.application.callerId=d.application.callerID?"CALLERID(all)="+d.application.callerID:void 0;break;case"playback":e=d.application.appdata.split(","),d.application.appdata=c(e[0]),d.application.options=c(e[1]);break;case"queue":e=d.application.appdata.split(","),d.application.queue=c(e[0]),d.application.options=c(e[1]),d.application.URL=c(e[2]),d.application.sound=c(e[3]),d.application.timeout=c(e[4]),d.application.agi=c(e[5]),d.application.macro=c(e[6]),d.application.gosub=c(e[7]),d.application.rule=c(e[8]),d.application.position=c(e[9]);break;case"ringGroup":e=d.application.appdata.split(","),d.application.users=e[0].split("&"),d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"set":e=d.application.appdata.split("="),d.application.name=e[0],d.application.value=e[1];break;case"voicemail":e=d.application.appdata.split(","),d.application.voiceMail=c(e[0]),d.application.options=c(e[1])}}();switch(d.application.appType){case"agi":o.getResourcesByRole(d.currentUser,"squareProject",{fields:"id,name",sort:"name",nolimit:"true"},m("squareProject")).then(function(e){d.projects=e}).catch(function(){s.error({title:i.instant("CALLYSQUARE.CALLYSQUARE")+" "+i.instant("CALLYSQUARE.PROJECTS"),msg:i.instant("VOICE.NOTIFICATIONS.CALLYSQUARE_PROJECTS_GET_ERROR")})});break;case"externalDial":u();break;case"goTo":o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:"true"},m("voiceContext")).then(function(e){d.contexts=e}).catch(function(){s.error({title:i.instant("VOICE.CONTEXTS"),msg:i.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});break;case"internalDial":g();break;case"outboundDial":o.getResourcesByRole(d.currentUser,"tag",{fields:"id,name",sort:"name",nolimit:"true"},m("tag")).then(function(e){d.tags=e}).catch(function(){s.error({title:i.instant("TOOLS.TAGS"),msg:i.instant("VOICE.NOTIFICATIONS.TAGS_GET_ERROR")})}),u();break;case"playback":p();break;case"queue":p(),o.getResourcesByRole(d.currentUser,"voiceQueue",{type:"inbound",fields:"id,name,type",sort:"name",nolimit:"true"},m("voiceQueue")).then(function(e){d.queues=e}).catch(function(){s.error({title:i.instant("VOICE.VOICEQUEUES"),msg:i.instant("VOICE.NOTIFICATIONS.QUEUES_GET_ERROR")})});break;case"ringGroup":g();break;case"set":o.getResourcesByRole(d.currentUser,"variable",{fields:"id,name",sort:"name",nolimit:"true"},m("variable")).then(function(e){d.variables=e}).catch(function(){s.error({title:i.instant("TOOLS.VARIABLES"),msg:i.instant("VOICE.NOTIFICATIONS.VARIABLES_GET_ERROR")})});break;case"voicemail":o.getResourcesByRole(d.currentUser,"voiceMail",{fields:"id,mailbox",sort:"mailbox",nolimit:"true"},m("voiceMail")).then(function(e){d.voiceMails=e}).catch(function(){s.error({title:i.instant("VOICE.VOICEMAILS"),msg:i.instant("VOICE.NOTIFICATIONS.VOICEMAILS_GET_ERROR")})})}},d.saveRoutingApp=function(){d.errors=[],function(){var e=[];switch(d.application.appType){case"agi":d.application.appdata=d.application.project;break;case"dial":e[0]=d.application.tech,e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"externalDial":e[0]=["SIP",d.application.trunk,d.application.phone].join("/"),e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"goTo":e[0]=d.application.context,e[1]=d.application.extension,e[2]=d.application.priority,d.application.appdata=e.join(",");break;case"internalDial":e[0]=d.application.user,e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"outboundDial":d.application.phone=t.cutdigits?(d.application.prefix||"")+"${EXTEN:"+t.cutdigits+"}":(d.application.prefix||"")+"${EXTEN}","none"===t.recordingFormat?d.application.options=d.application.options.replace("U(xcally-mixmonitor-context)",""):d.application.options.indexOf("U(xcally-mixmonitor-context)")<0&&(d.application.options+="U(xcally-mixmonitor-context)"),e[0]=["SIP",d.application.trunk,d.application.phone].join("/"),e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"playback":e[0]=d.application.appdata,e[1]=d.application.options,d.application.appdata=e.join(",");break;case"queue":e[0]=d.application.queue,e[1]=d.application.options,e[2]=d.application.URL,e[3]=d.application.sound,e[4]=d.application.timeout,e[5]=d.application.agi,e[6]=d.application.macro,e[7]=d.application.gosub,e[8]=d.application.rule,e[9]=d.application.position,d.application.appdata=e.join(",");break;case"ringGroup":e[0]=d.application.users.join("&"),e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"set":e[0]=d.application.name,e[1]=d.application.value,d.application.appdata=e.join("=");break;case"voicemail":e[0]=d.application.voiceMail,e[1]=d.application.options,d.application.appdata=e.join(",")}}(),v()},d.closeDialog=v}e.$inject=["$mdDialog","$q","$translate","toasty","application","route","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditRoutingAppDialogController",e)}(),function(){"use strict";function e(n,t,e,a,i,s,o,r,l){var d=this;function c(){var e=[{key:"name",value:d.interval.IntervalId}];s.getResourcesByRole(d.currentUser,"interval",{fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0},e).then(function(e){d.intervals=e}).catch(function(){i.error({title:t.instant("TOOLS.INTERVALS"),msg:t.instant("VOICE.NOTIFICATIONS.INTERVALS_GET_ERROR")})})}function m(e){n.hide(e)}d.currentUser=o.getCurrentUser(),d.interval=angular.copy(e),d.intervals=a||{rows:[],count:0},d.types=["always","custom","list"],d.crudPermissions=r,d.errors=[],d.daysOfWeek=l.getDaysOfWeek(),d.monthNumber=l.getMonthNumber(),d.monthName=l.getMonthName(),d.daysOfMonth=l.getDaysOfMonth(),d.initialize=function(){if("*,*,*,*"===d.interval.interval)return d.type=d.interval.IntervalId&&d.interval.application?"list":"always",void("list"===d.type&&c());d.type="custom";var e=d.interval.interval.split(","),n=e[0],t=e[1],a=e[2],i=e[3];if("*"!==n){var s,o=n.split("-")[0],r=n.split("-")[1];(s=new Date).setHours(Number(o.split(":")[0])),s.setMinutes(Number(o.split(":")[1])),d.timeRangeFrom=s,(s=new Date).setHours(Number(r.split(":")[0])),s.setMinutes(Number(r.split(":")[1])),d.timeRangeTo=s}"*"!==t&&(d.dayOfWeekFrom=t.split("-")[0],d.dayOfWeekTo=t.split("-")[1]);"*"!==a&&(d.monthDayFrom=a.split("-")[0],d.monthDayTo=a.split("-")[1]);"*"!==i&&(d.monthFrom=i.split("-")[0],d.monthTo=i.split("-")[1])},d.onTypeChange=function(){"list"===d.type&&0===d.intervals.count&&c()},d.saveInterval=function(){d.errors=[],d.interval.interval=function(){if(["always","list"].includes(d.type))return"*,*,*,*";var e=[];if("*"!==d.timeRangeFrom&&d.timeRangeFrom&&d.timeRangeTo){var n=(d.timeRangeFrom.getHours()<10?"0":"")+d.timeRangeFrom.getHours()+":"+(d.timeRangeFrom.getMinutes()<10?"0":"")+d.timeRangeFrom.getMinutes(),t=(d.timeRangeTo.getHours()<10?"0":"")+d.timeRangeTo.getHours()+":"+(d.timeRangeTo.getMinutes()<10?"0":"")+d.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return d.dayOfWeekFrom?d.dayOfWeekTo?e.push(d.dayOfWeekFrom+"-"+d.dayOfWeekTo):e.push(d.dayOfWeekFrom):e.push("*"),d.monthDayFrom?d.monthDayTo?e.push(d.monthDayFrom+"-"+d.monthDayTo):e.push(d.monthDayFrom):e.push("*"),d.monthFrom?d.monthTo?e.push(d.monthFrom+"-"+d.monthTo):e.push(d.monthFrom):e.push("*"),e.join()}(),"list"!==d.type&&(d.interval.IntervalId=null);m(d.interval)},d.closeDialog=m}e.$inject=["$mdDialog","$translate","interval","intervals","toasty","api","Auth","crudPermissions","IndexFactory"],angular.module("app.voice").controller("EditRoutingIntervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.chanSpies=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="chanSpies",f.listOrder="",f.listOrderAsc=null,f.selectedChanSpies=[],f.query={fields:"createdAt,updatedAt,id,name,prefix,options,auth,password,record,recordingFormat,description",sort:"-updatedAt",limit:10,page:1},f.arrayoptions=_.keyBy([{option:"b: Only spy on channels involved in a bridged call.",value:"'b'"},{option:"B: Instead of whispering on a single channel barge in on both channels involved in the call.",value:"'B'"},{option:"E: Exit when the spied-on channel hangs up.",value:"'E'"},{option:"o: Only listen to audio coming from this channel.",value:"'o'"},{option:"q: Don't play a beep when beginning to spy on a channel, or speak the selected channel name.",value:"'q'"},{option:"s: Skip the playback of the channel type (i.e. SIP, IAX, etc) when speaking the selected channel name.",value:"'s'"},{option:"S: Stop when no more channels are left to spy on.",value:"'S'"},{option:"w: Enable whisper mode, so the spying channel can talk to the spied-on channel.",value:"'w'"},{option:"W: Enable private whisper mode, so the spying channel can talk to the spied-on channel but cannot listen to that channel.",value:"'W'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayrecordingFormat=_.keyBy([{option:"wav",value:"'wav'"},{option:"gsm",value:"'gsm'"},{option:"wav49",value:"'WAV'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditchanSpyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/chanSpies/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chanSpy:e,chanSpies:f.chanSpies.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("chanSpy")+"?").htmlContent("<b>"+(e.name||"chanSpy")+"</b> will be deleted.").ariaLabel("delete chanSpy").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getChanSpies=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceChanSpy.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ChanSpies",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditchanSpy=function(e,n){i.show({controller:"CreateOrEditchanSpyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/chanSpies/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{chanSpy:n,chanSpies:f.chanSpies.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletechanSpy=y,f.exportSelectedChanSpies=function(){var e=angular.copy(f.selectedChanSpies);return f.selectedChanSpies=[],e},f.deleteSelectedChanSpies=function(e){var n=i.confirm().title("Are you sure want to delete the selected chanSpies?").htmlContent("<b>"+f.selectedChanSpies.length+" selected</b> will be deleted.").ariaLabel("delete chanSpys").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedChanSpies.forEach(function(e){y(e)}),f.selectedChanSpies=[]})},f.deselectChanSpies=function(){f.selectedChanSpies=[]},f.selectAllChanSpies=function(){f.selectedChanSpies=f.chanSpies.rows};var b=!0,A=1;function E(e){f.chanSpies=e||{count:0,rows:[]}}function y(e){m.voiceChanSpy.delete({id:e.id}).$promise.then(function(){_.remove(f.chanSpies.rows,{id:e.id}),f.chanSpies.count-=1,f.chanSpies.rows.length||f.getChanSpies(),p.success({title:_.startCase("chanSpy")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceChanSpy"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceChanSpy",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getChanSpies())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chanSpies","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("ChanSpiesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_CHANSPY",g.chanSpy=angular.copy(l),g.chanSpies=r,g.newchanSpy=!1,g.chanSpy||(g.chanSpy={recordingFormat:"wav"},g.title="VOICE.NEW_CHANSPY",g.newchanSpy=!0),g.addNewchanSpy=function(){g.errors=[],d.voiceChanSpy.save(g.chanSpy).$promise.then(function(e){g.chanSpies.unshift(e.toJSON()),o.success({title:"chanSpy properly created",msg:g.chanSpy.name?g.chanSpy.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceChanSpy.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceChanSpy.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savechanSpy=function(){g.errors=[],d.voiceChanSpy.update({id:g.chanSpy.id},g.chanSpy).$promise.then(function(e){var n=_.find(g.chanSpies,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"chanSpy properly saved!",msg:g.chanSpy.name?g.chanSpy.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceChanSpy.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceChanSpy.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletechanSpy=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chanSpy will be deleted.").ariaLabel("Delete chanSpy").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceChanSpy.delete({id:g.chanSpy.id}).$promise.then(function(){_.remove(g.chanSpies,{id:g.chanSpy.id}),o.success({title:"chanSpy properly deleted!",msg:(g.chanSpy.name||"chanSpy")+" has been deleted!"}),v(g.chanSpy)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceChanSpy.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceChanSpy.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chanSpies","chanSpy","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditchanSpyDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.contexts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="contexts",f.listOrder="",f.listOrderAsc=null,f.selectedContexts=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditContextDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/contexts/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{context:e,contexts:f.contexts.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("context")+"?").htmlContent("<b>"+(e.name||"context")+"</b> will be deleted.").ariaLabel("delete context").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getContexts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceContext.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Contexts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditContext=function(e,n){i.show({controller:"CreateOrEditContextDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/contexts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{context:n,contexts:f.contexts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteContext=y,f.exportSelectedContexts=function(){var e=angular.copy(f.selectedContexts);return f.selectedContexts=[],e},f.deleteSelectedContexts=function(e){var n=i.confirm().title("Are you sure want to delete the selected contexts?").htmlContent("<b>"+f.selectedContexts.length+" selected</b> will be deleted.").ariaLabel("delete Contexts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedContexts.forEach(function(e){y(e)}),f.selectedContexts=[]})},f.deselectContexts=function(){f.selectedContexts=[]},f.selectAllContexts=function(){f.selectedContexts=f.contexts.rows};var b=!0,A=1;function E(e){f.contexts=e||{count:0,rows:[]}}function y(e){m.voiceContext.delete({id:e.id}).$promise.then(function(){_.remove(f.contexts.rows,{id:e.id}),f.contexts.count-=1,f.contexts.rows.length||f.getContexts(),p.success({title:_.startCase("Context")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceContext"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceContext",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getContexts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","contexts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("ContextsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_CONTEXT",g.context=angular.copy(l),g.contexts=r,g.newContext=!1,g.context||(g.context={},g.title="VOICE.NEW_CONTEXT",g.newContext=!0),g.addNewContext=function(){g.errors=[],d.voiceContext.save(g.context).$promise.then(function(e){g.contexts.unshift(e.toJSON()),o.success({title:"Context properly created",msg:g.context.name?g.context.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceContext.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceContext.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveContext=function(){g.errors=[],d.voiceContext.update({id:g.context.id},g.context).$promise.then(function(e){var n=_.find(g.contexts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Context properly saved!",msg:g.context.name?g.context.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceContext.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceContext.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteContext=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The context will be deleted.").ariaLabel("Delete Context").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceContext.delete({id:g.context.id}).$promise.then(function(){_.remove(g.contexts,{id:g.context.id}),o.success({title:"Context properly deleted!",msg:(g.context.name||"context")+" has been deleted!"}),v(g.context)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceContext.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceContext.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","contexts","context","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditContextDialogController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l){var d=this;function c(t){return e(function(e,n){o.voiceExtension.addApplications({id:t},d.applications?d.applications.rows:[]).$promise.then(function(){e()}).catch(function(e){n(e)})})}function m(e){t.hide(e)}d.currentUser=r.getCurrentUser(),d.crudPermissions=l,d.inboundRoute=angular.copy(s),d.inboundRoutes=n,d.newInboundRoute=!1,d.hasModulePermissions={},d.errors=[],d.initialize=function(){d.inboundRoute||(d.inboundRoute={appdata:"Inbound Call",type:"inbound",context:"from-voip-provider"},d.newInboundRoute=!0);e=[{key:"name",value:d.inboundRoute.context}],o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){d.contexts=e}).catch(function(){i.error({title:a.instant("VOICE.CONTEXTS"),msg:a.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},d.getRouting=function(){if(d.newinboundRoute)return;var e={sort:"priority",VoiceExtensionId:d.inboundRoute.id,isApp:!0,nolimit:!0};o.voiceExtension.get(e).$promise.then(function(e){d.applications=e||{count:0,rows:[]}})},d.addNewInboundRoute=function(){d.errors=[],o.voiceExtension.save(d.inboundRoute).$promise.then(function(e){c(e.id).then(function(){d.inboundRoutes.unshift(e.toJSON()),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_CREATED_SUCCESS_TITLE")}),m(e)})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.saveInboundRoute=function(){d.errors=[],o.voiceExtension.update({id:d.inboundRoute.id},d.inboundRoute).$promise.then(function(e){var n=_.find(d.inboundRoutes,{id:e.id});if(n&&_.merge(n,e.toJSON()),d.applications)return c(d.inboundRoute.id)}).then(function(){i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")}),m(s)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.deleteInboundRoute=function(e){d.errors=[];var n=t.confirm().title(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:d.inboundRoute.exten})).ariaLabel("Delete inbound route").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){o.voiceExtension.delete({id:d.inboundRoute.id}).$promise.then(function(){_.remove(d.inboundRoutes,{id:d.inboundRoute.id}),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")}),m(d.inboundRoute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},d.closeDialog=m}e.$inject=["$mdDialog","$q","$translate","toasty","inboundRoutes","inboundRoute","api","Auth","crudPermissions"],angular.module("app.voice").controller("CreateOrEditInboundRouteDialogController",e)}(),function(){"use strict";function e(e,i,a,n,s,o,r,t,l,d,c){var m=this;function u(e,n){1===m.applications.rows.length&&1===n&&(n=0);var t=m.applications.rows[n];i.show({controller:"EditRoutingAppDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/dialog.html",parent:angular.element(a.body),targetEvent:e,locals:{application:t,route:m.inboundRoute,crudPermissions:m.crudPermissions}}).then(function(e){e?(m.applications.rows[n].appdata===e.appdata&&"custom"!==e.appType||p(),m.applications.rows[n]=e):t.id||m.applications.rows.splice(n,1)}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(){m.pendingChanges=!0}m.currentUser=t.getCurrentUser(),m.inboundRoute=l||e.params.inboundRoute||{},m.contexts=d,m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=t.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={sort:"priority",VoiceExtensionId:m.inboundRoute.id,isApp:!0,nolimit:!0},m.apps=[{app:"AGI",appAlias:"CallySquare",appType:"agi",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:"Dial",appType:"dial",context:"from-sip",type:"Inbound",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"internalDial",context:"from-sip",type:"Inbound",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"externalDial",context:"from-sip",type:"Inbound",interval:"*,*,*,*",options:"xX"},{app:"Dial",appType:"ringGroup",context:"from-sip",type:"Inbound",interval:"*,*,*,*",options:"xX"},{app:"Playback",appType:"playback",context:"from-sip",type:"Inbound",interval:"*,*,*,*",answer:!0},{app:"Queue",appType:"queue",context:"from-sip",type:"Inbound",options:"xX",appdata:",xX,,,300,,,,,",interval:"*,*,*,*",answer:!0},{app:"Set",appType:"set",context:"from-sip",type:"Inbound",separator:"=",interval:"*,*,*,*"},{app:"Voicemail",appType:"voicemail",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:"goto",appType:"goTo",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:"hangup",appType:"hangup",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:null,appType:"custom",type:"Inbound",interval:"*,*,*,*"}],m.sortableAppsOptions={group:{name:"apps",pull:"clone",put:!1},animation:100,sort:!1},m.sortableRoutingOptions={group:{name:"apps",put:!0},animation:100,disabled:!m.crudPermissions.canEdit,onAdd:function(e){u(e,e.newIndex)},onUpdate:function(){p()}},m.selectedApplications=[],m.onInit=function(){if(t.isAdmin())return;e=[{key:"name",value:m.inboundRoute.context}],o.getResourcesByRole(m.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){m.contexts=e}).catch(function(){r.error({title:s.instant("VOICE.CONTEXTS"),msg:s.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},m.onActionsTabSelection=function(){m.applications||o.voiceExtension.get(m.query).$promise.then(function(e){m.applications=e||{count:0,rows:[]}})},m.gotoInboundRoutes=function(){e.go("app.voice.inboundRoutes",{},{reload:"app.voice.inboundRoutes"})},m.saveInboundRoute=function(){o.voiceExtension.update({id:m.inboundRoute.id},m.inboundRoute).$promise.then(function(){n(function(n,t){if(!m.applications)return n();o.voiceExtension.addApplications({id:m.inboundRoute.id},m.applications.rows).$promise.then(function(e){m.applications.rows=e.rows,n()}).catch(function(e){t(e)})}).then(function(){m.pendingChanges=!1,r.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")})})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.editApplication=u,m.editInterval=function(e,n){var t=m.applications.rows[n];i.show({controller:"EditRoutingIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:void 0,crudPermissions:m.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,p())})},m.deleteApplication=function(e,n,t){var a=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_MESSAGE",{name:e.app})).ariaLabel("Delete application").targetEvent(t).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(a).then(function(){m.applications.rows.splice(n,1),p()})},m.deleteSelectedApplications=function(e){var n=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_MESSAGE",{total:m.selectedApplications.length})).ariaLabel("Delete applications").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedApplications.forEach(function(e){_.remove(m.applications.rows,{id:e.id})}),m.selectedApplications=[],p()})}}e.$inject=["$state","$mdDialog","$document","$q","$translate","api","toasty","Auth","inboundRoute","contexts","userProfileSection"],angular.module("app.voice").controller("InboundRouteController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.inboundRoutes=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.voiceExtension.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="InboundRoutes",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){d.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(g.inboundRoutes.rows,{id:e.id}),g.inboundRoutes.count-=1,g.inboundRoutes.rows.length||h(),c.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceExtension"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.inboundRoutes=o,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedInboundRoutes=[],g.query={fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},g.editRoute=function(e){n.go("app.voice.inboundRoutes.edit",{id:e.id,inboundRoute:e,crudPermissions:g.crudPermissions})},g.createOrEditInboundRoute=function(e,n){a.show({controller:"CreateOrEditInboundRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/inboundRoutes/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{inboundRoute:n,inboundRoutes:g.inboundRoutes.rows,crudPermissions:g.crudPermissions}})},g.success=v,g.getInboundRoutes=h,g.deleteConfirm=function(e,n){var t=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:e.exten})).ariaLabel("Delete extension").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.exportSelectedInboundRoutes=function(){var e=angular.copy(g.selectedInboundRoutes);return g.selectedInboundRoutes=[],e},g.deleteSelectedInboundRoutes=function(e){var n=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_MESSAGE",{total:g.selectedInboundRoutes.length})).ariaLabel("Delete extensions").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedInboundRoutes.forEach(function(e){f(e)}),g.selectedInboundRoutes=[]})};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","inboundRoutes","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.voice").controller("InboundRoutesController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l){var d=this;function c(t){return e(function(e,n){o.voiceExtension.addApplications({id:t},d.applications?d.applications.rows:[]).$promise.then(function(){e()}).catch(function(e){n(e)})})}function m(e){t.hide(e)}d.currentUser=r.getCurrentUser(),d.crudPermissions=l,d.internalRoute=angular.copy(s),d.internalRoutes=n,d.newInternalRoute=!1,d.hasModulePermissions={},d.errors=[],d.initialize=function(){d.internalRoute||(d.internalRoute={appdata:"Internal Call",type:"internal",context:"from-sip"},d.newInternalRoute=!0);e=[{key:"name",value:d.internalRoute.context}],o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){d.contexts=e}).catch(function(){i.error({title:a.instant("VOICE.CONTEXTS"),msg:a.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},d.getRouting=function(){if(d.newInternalRoute)return;var e={sort:"priority",VoiceExtensionId:d.internalRoute.id,isApp:!0,nolimit:!0};o.voiceExtension.get(e).$promise.then(function(e){d.applications=e||{count:0,rows:[]}})},d.addNewInternalRoute=function(){d.errors=[],o.voiceExtension.save(d.internalRoute).$promise.then(function(e){c(e.id).then(function(){d.internalRoutes.unshift(e.toJSON()),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_CREATED_SUCCESS_TITLE")}),m(e)})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.saveInternalRoute=function(){d.errors=[],o.voiceExtension.update({id:d.internalRoute.id},d.internalRoute).$promise.then(function(e){var n=_.find(d.internalRoutes,{id:e.id});if(n&&_.merge(n,e.toJSON()),d.applications)return c(d.internalRoute.id)}).then(function(){i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")}),m(s)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.deleteInternalRoute=function(e){d.errors=[];var n=t.confirm().title(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:d.internalRoute.exten})).ariaLabel("Delete internal route").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){o.voiceExtension.delete({id:d.internalRoute.id}).$promise.then(function(){_.remove(d.internalRoutes,{id:d.internalRoute.id}),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")}),m(d.internalRoute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},d.closeDialog=m}e.$inject=["$mdDialog","$q","$translate","toasty","internalRoutes","internalRoute","api","Auth","crudPermissions"],angular.module("app.voice").controller("CreateOrEditInternalRouteDialogController",e)}(),function(){"use strict";function e(e,i,a,n,s,o,r,t,l,d,c){var m=this;function u(e,n){1===m.applications.rows.length&&1===n&&(n=0);var t=m.applications.rows[n];i.show({controller:"EditRoutingAppDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/dialog.html",parent:angular.element(a.body),targetEvent:e,locals:{application:t,route:m.internalRoute,crudPermissions:m.crudPermissions}}).then(function(e){e?(m.applications.rows[n].appdata===e.appdata&&"custom"!==e.appType||p(),m.applications.rows[n]=e):t.id||m.applications.rows.splice(n,1)}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(){m.pendingChanges=!0}m.currentUser=t.getCurrentUser(),m.internalRoute=l||e.params.internalRoute||{},m.contexts=d,m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=t.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={sort:"priority",VoiceExtensionId:m.internalRoute.id,isApp:!0,nolimit:!0},m.apps=[{app:"AGI",appAlias:"CallySquare",appType:"agi",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:"Dial",appType:"dial",context:"from-sip",type:"Internal",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"internalDial",context:"from-sip",type:"Internal",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"externalDial",context:"from-sip",type:"Internal",interval:"*,*,*,*",options:"xX"},{app:"Dial",appType:"ringGroup",context:"from-sip",type:"Internal",interval:"*,*,*,*",options:"xX"},{app:"Playback",appType:"playback",context:"from-sip",type:"Internal",interval:"*,*,*,*",answer:!0},{app:"Queue",appType:"queue",context:"from-sip",type:"Internal",options:"xX",appdata:",xX,,,300,,,,,",interval:"*,*,*,*",answer:!0},{app:"Set",appType:"set",context:"from-sip",type:"Internal",separator:"=",interval:"*,*,*,*"},{app:"Voicemail",appType:"voicemail",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:"goto",appType:"goTo",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:"hangup",appType:"hangup",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:null,appType:"custom",type:"Internal",interval:"*,*,*,*"}],m.sortableAppsOptions={group:{name:"apps",pull:"clone",put:!1},animation:100,sort:!1},m.sortableRoutingOptions={group:{name:"apps",put:!0},animation:100,disabled:!m.crudPermissions.canEdit,onAdd:function(e){u(e,e.newIndex)},onUpdate:function(){p()}},m.selectedApplications=[],m.onInit=function(){if(t.isAdmin())return;e=[{key:"name",value:m.internalRoute.context}],o.getResourcesByRole(m.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){m.contexts=e}).catch(function(){r.error({title:s.instant("VOICE.CONTEXTS"),msg:s.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},m.onActionsTabSelection=function(){m.applications||o.voiceExtension.get(m.query).$promise.then(function(e){m.applications=e||{count:0,rows:[]}})},m.gotoInternalRoutes=function(){e.go("app.voice.internalRoutes",{},{reload:"app.voice.internalRoutes"})},m.saveInternalRoute=function(){o.voiceExtension.update({id:m.internalRoute.id},m.internalRoute).$promise.then(function(){n(function(n,t){if(!m.applications)return n();o.voiceExtension.addApplications({id:m.internalRoute.id},m.applications.rows).$promise.then(function(e){m.applications.rows=e.rows,n()}).catch(function(e){t(e)})}).then(function(){m.pendingChanges=!1,r.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")})})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.editApplication=u,m.editInterval=function(e,n){var t=m.applications.rows[n];i.show({controller:"EditRoutingIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:void 0,crudPermissions:m.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,p())})},m.deleteApplication=function(e,n,t){var a=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_MESSAGE",{name:e.app})).ariaLabel("Delete application").targetEvent(t).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(a).then(function(){m.applications.rows.splice(n,1),p()})},m.deleteSelectedApplications=function(e){var n=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_MESSAGE",{total:m.selectedApplications.length})).ariaLabel("Delete applications").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedApplications.forEach(function(e){_.remove(m.applications.rows,{id:e.id})}),m.selectedApplications=[],p()})}}e.$inject=["$state","$mdDialog","$document","$q","$translate","api","toasty","Auth","internalRoute","contexts","userProfileSection"],angular.module("app.voice").controller("InternalRouteController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.internalRoutes=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.voiceExtension.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="InternalRoutes",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){d.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(g.internalRoutes.rows,{id:e.id}),g.internalRoutes.count-=1,g.internalRoutes.rows.length||h(),c.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceExtension"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.internalRoutes=o,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedInternalRoutes=[],g.query={fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},g.editRoute=function(e){n.go("app.voice.internalRoutes.edit",{id:e.id,internalRoute:e,crudPermissions:g.crudPermissions})},g.createOrEditInternalRoute=function(e,n){a.show({controller:"CreateOrEditInternalRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/internalRoutes/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{internalRoute:n,internalRoutes:g.internalRoutes.rows,crudPermissions:g.crudPermissions}})},g.success=v,g.getInternalRoutes=h,g.deleteConfirm=function(e,n){var t=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:e.exten})).ariaLabel("Delete extension").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.exportSelectedInternalRoutes=function(){var e=angular.copy(g.selectedInternalRoutes);return g.selectedInternalRoutes=[],e},g.deleteSelectedInternalRoutes=function(e){var n=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_MESSAGE",{total:g.selectedInternalRoutes.length})).ariaLabel("Delete extensions").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedInternalRoutes.forEach(function(e){f(e)}),g.selectedInternalRoutes=[]})};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","internalRoutes","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.voice").controller("InternalRoutesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_MUSICONHOLD",g.musiconhold=angular.copy(l),g.musiconholds=r,g.newMusicOnHold=!1,g.musiconhold||(g.musiconhold={mode:"files"},g.title="VOICE.NEW_MUSICONHOLD",g.newMusicOnHold=!0),g.addNewMusicOnHold=function(){g.errors=[],d.voiceMusicOnHold.save(g.musiconhold).$promise.then(function(e){g.musiconholds.unshift(e.toJSON()),o.success({title:"MusicOnHold properly created",msg:g.musiconhold.name?g.musiconhold.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMusicOnHold=function(){g.errors=[],d.voiceMusicOnHold.update({id:g.musiconhold.id},g.musiconhold).$promise.then(function(e){var n=_.find(g.musiconholds,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MusicOnHold properly saved!",msg:g.musiconhold.name?g.musiconhold.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMusicOnHold=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The musiconhold will be deleted.").ariaLabel("Delete MusicOnHold").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceMusicOnHold.delete({id:g.musiconhold.id}).$promise.then(function(){_.remove(g.musiconholds,{id:g.musiconhold.id}),o.success({title:"MusicOnHold properly deleted!",msg:(g.musiconhold.name||"musiconhold")+" has been deleted!"}),v(g.musiconhold)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","musiconholds","musiconhold","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditMusicOnHoldDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.musiconholdMohSounds=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceMusicOnHold.getSounds(m.query,u).$promise}function g(e){d.voiceMusicOnHold.removeSound({id:t.params.id,id2:e.id}).$promise.then(function(){_.remove(m.musiconholdMohSounds.rows,{id:e.id}),m.musiconholdMohSounds.count-=1,m.musiconholdMohSounds.rows.length||p(),l.success({title:"MohSound deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceMusicOnHold"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.musiconhold={},m.musiconholdMohSounds={count:0,rows:[]},m.selectedMusicOnHoldMohSounds=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,save_name,converted_format,audio",limit:10,page:1},m.init=function(e,n){m.musiconhold=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceMusicOnHoldId=m.musiconhold.id,m.query.id=m.musiconhold.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the mohSound?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("mohSound #")+e.id||"mohSound")+"</b> will be deleted.").ariaLabel("delete mohSound").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.voiceMusicOnHoldDownload=function(s,e,n){return d.sound.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="mohSound"+s.id,a=new Blob(n,{type:e.type});t=s.converted_format?s.save_name+"."+s.converted_format:s.save_name;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=u,m.getMusicOnHoldMohSounds=p,m.createOrEditMusicOnHoldMohSound=function(e,n){o.show({controller:"CreateOrEditMohSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/musiconholds/edit/mohSounds/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{musiconhold:m.musiconhold,mohSound:n,mohSounds:m.musiconholdMohSounds.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedMusicOnHoldMohSounds=function(){var e=angular.copy(m.selectedMusicOnHoldMohSounds);return m.selectedMusicOnHoldMohSounds=[],e},m.deleteMusicOnHoldMohSound=g,m.deleteSelectedMusicOnHoldMohSounds=function(e){var n=o.confirm().title("Are you sure want to delete the selected mohSounds?").htmlContent("<b>"+m.selectedMusicOnHoldMohSounds.length+" selected</b> will be deleted.").ariaLabel("delete mohSounds").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedMusicOnHoldMohSounds.forEach(function(e){g(e)}),m.selectedMusicOnHoldMohSounds=[]})},c.hasRole("admin")?d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){m.sounds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){m.sounds=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.sounds,{id:e.resourceId})}),t=null;if(m.musiconhold&&(t=_.find(m.sounds,{id:Number(m.musiconhold.id)})),t&&!_.some(n,["id",t.id])){var a=_.find(m.sounds,{id:t.id});a.canSelect=!1,n.push(a)}m.sounds=n})}else{var t=[],a=null;m.musiconhold&&(a=_.find(m.sounds,{id:Number(m.musiconhold.id)}));for(var i=0;i<m.sounds.length;i++)a&&m.sounds[i].id===a.id&&(m.sounds[i].canSelect=!1,t.push(m.sounds[i]));m.sounds=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.voice").controller("MusicOnHoldMohSoundsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_MOHSOUND",g.mohSound=angular.copy(l),g.mohSounds=r,g.newMohSound=!1,g.mohSound||(g.mohSound={},g.title="VOICE.NEW_MOHSOUND",g.newMohSound=!0),n.params.id&&(g.mohSound.VoiceMusicOnHoldId=n.params.id),g.addNewMohSound=function(){g.errors=[],d.voiceMusicOnHold.addSound({id:n.params.id},g.mohSound).$promise.then(function(e){g.mohSounds.unshift(e.toJSON()),o.success({title:"MohSound properly created",msg:g.mohSound.name?g.mohSound.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMohSound=function(){g.errors=[],d.voiceMusicOnHold.update({id:g.mohSound.id},g.mohSound).$promise.then(function(e){var n=_.find(g.mohSounds,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MohSound properly saved!",msg:g.mohSound.name?g.mohSound.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMohSound=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The mohSound will be deleted.").ariaLabel("Delete MohSound").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceMusicOnHold.delete({id:g.mohSound.id}).$promise.then(function(){_.remove(g.mohSounds,{id:g.mohSound.id}),o.success({title:"MohSound properly deleted!",msg:(g.mohSound.name||"mohSound")+" has been deleted!"}),v(g.mohSound)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.sounds=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.sounds=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.sounds,{id:e.resourceId})}),t=null;if(g.mohSound&&(t=_.find(g.sounds,{id:Number(g.mohSound.id)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.sounds,{id:t.id});a.canSelect=!1,n.push(a)}g.sounds=n})}else{var t=[],a=null;g.mohSound&&(a=_.find(g.sounds,{id:Number(g.mohSound.id)}));for(var i=0;i<g.sounds.length;i++)a&&g.sounds[i].id===a.id&&(g.sounds[i].canSelect=!1,t.push(g.sounds[i]));g.sounds=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mohSounds","mohSound","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditMohSoundDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.musiconhold=c||e.params.musiconhold||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoMusicOnHolds=function(){e.go("app.voice.musiconholds",{},{reload:"app.voice.musiconholds"})},u.saveMusicOnHold=function(){r.voiceMusicOnHold.update({id:u.musiconhold.id},u.musiconhold).$promise.then(function(){l.success({title:"MusicOnHold updated!",msg:u.musiconhold.name?u.musiconhold.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","musiconhold","userProfileSection"],angular.module("app.voice").controller("MusicOnHoldController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.musiconholds=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="musiconholds",f.listOrder="",f.listOrderAsc=null,f.selectedMusicOnHolds=[],f.query={fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",defaultEntry:"false",limit:10,page:1},f.arraymode=_.keyBy([{option:"Files",value:"'files'"},{option:"Custom",value:"'custom'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysort=_.keyBy([{option:"Random",value:"'random'"},{option:"Alphabetical",value:"'alpha'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.voice.musiconholds.edit",{id:e.id,musiconhold:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("musiconhold")+"?").htmlContent("<b>"+(e.name||"musiconhold")+"</b> will be deleted.").ariaLabel("delete musiconhold").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getMusicOnHolds=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceMusicOnHold.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="MusicOnHolds",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMusicOnHold=function(e,n){i.show({controller:"CreateOrEditMusicOnHoldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/musiconholds/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{musiconhold:n,musiconholds:f.musiconholds.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteMusicOnHold=y,f.exportSelectedMusicOnHolds=function(){var e=angular.copy(f.selectedMusicOnHolds);return f.selectedMusicOnHolds=[],e},f.deleteSelectedMusicOnHolds=function(e){var n=i.confirm().title("Are you sure want to delete the selected musiconholds?").htmlContent("<b>"+f.selectedMusicOnHolds.length+" selected</b> will be deleted.").ariaLabel("delete MusicOnHolds").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMusicOnHolds.forEach(function(e){y(e)}),f.selectedMusicOnHolds=[]})},f.deselectMusicOnHolds=function(){f.selectedMusicOnHolds=[]},f.selectAllMusicOnHolds=function(){f.selectedMusicOnHolds=f.musiconholds.rows};var b=!0,A=1;function E(e){f.musiconholds=e||{count:0,rows:[]}}function y(e){m.voiceMusicOnHold.delete({id:e.id}).$promise.then(function(){_.remove(f.musiconholds.rows,{id:e.id}),f.musiconholds.count-=1,f.musiconholds.rows.length||f.getMusicOnHolds(),p.success({title:_.startCase("MusicOnHold")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceMusicOnHold"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMusicOnHolds())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","musiconholds","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("MusicOnHoldsController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l){var d=this;function c(t){return e(function(e,n){o.voiceExtension.addApplications({id:t},d.applications?d.applications.rows:[]).$promise.then(function(){e()}).catch(function(e){n(e)})})}function m(e){t.hide(e)}d.currentUser=r.getCurrentUser(),d.crudPermissions=l,d.outboundRoute=angular.copy(s),d.outboundRoutes=n,d.newOutboundRoute=!1,d.hasModulePermissions={},d.errors=[],d.initialize=function(){d.outboundRoute||(d.outboundRoute={appdata:"Outbound Call",type:"outbound",context:"from-sip",recordingFormat:"none"},d.newOutboundRoute=!0);e=[{key:"name",value:d.outboundRoute.context}],o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){d.contexts=e}).catch(function(){i.error({title:a.instant("VOICE.CONTEXTS"),msg:a.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},d.getRouting=function(){if(d.newOutboundRoute)return;var e={sort:"priority",VoiceExtensionId:d.outboundRoute.id,isApp:!0,nolimit:!0};o.voiceExtension.get(e).$promise.then(function(e){d.applications=e||{count:0,rows:[]}})},d.addNewOutboundRoute=function(){d.errors=[],o.voiceExtension.save(d.outboundRoute).$promise.then(function(e){c(e.id).then(function(){d.outboundRoutes.unshift(e.toJSON()),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_CREATED_SUCCESS_TITLE")}),m(e)})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.saveOutboundRoute=function(){d.errors=[],o.voiceExtension.update({id:d.outboundRoute.id},d.outboundRoute).$promise.then(function(e){var n=_.find(d.outboundRoutes,{id:e.id});if(n&&_.merge(n,e.toJSON()),d.applications)return c(d.outboundRoute.id)}).then(function(){i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")}),m(s)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.deleteOutboundRoute=function(e){d.errors=[];var n=t.confirm().title(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:d.outboundRoute.exten})).ariaLabel("Delete outbound route").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){o.voiceExtension.delete({id:d.outboundRoute.id}).$promise.then(function(){_.remove(d.outboundRoutes,{id:d.outboundRoute.id}),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")}),m(d.outboundRoute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},d.closeDialog=m}e.$inject=["$mdDialog","$q","$translate","toasty","outboundRoutes","outboundRoute","api","Auth","crudPermissions"],angular.module("app.voice").controller("CreateOrEditOutboundRouteDialogController",e)}(),function(){"use strict";function e(e,i,a,n,s,o,r,t,l,d,c){var m=this;function u(e,n){1===m.applications.rows.length&&1===n&&(n=0);var t=m.applications.rows[n];i.show({controller:"EditRoutingAppDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/dialog.html",parent:angular.element(a.body),targetEvent:e,locals:{application:t,route:m.outboundRoute,crudPermissions:m.crudPermissions}}).then(function(e){e?(m.applications.rows[n].appdata===e.appdata&&"custom"!==e.appType||p(),m.applications.rows[n]=e):t.id||m.applications.rows.splice(n,1)}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(){m.pendingChanges=!0}m.currentUser=t.getCurrentUser(),m.outboundRoute=l||e.params.outboundRoute||{},m.contexts=d,m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=t.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={sort:"priority",VoiceExtensionId:m.outboundRoute.id,isApp:!0,nolimit:!0},m.apps=[{app:"Dial",appType:"outboundDial",context:"from-sip",type:"Outbound",options:"xX",interval:"*,*,*,*"},{app:null,appType:"custom",type:"Outbound",interval:"*,*,*,*"}],m.sortableAppsOptions={group:{name:"apps",pull:"clone",put:!1},animation:100,sort:!1},m.sortableRoutingOptions={group:{name:"apps",put:!0},animation:100,disabled:!m.crudPermissions.canEdit,onAdd:function(e){u(e,e.newIndex)},onUpdate:function(){p()}},m.selectedApplications=[],m.onInit=function(){if(t.isAdmin())return;e=[{key:"name",value:m.outboundRoute.context}],o.getResourcesByRole(m.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){m.contexts=e}).catch(function(){r.error({title:s.instant("VOICE.CONTEXTS"),msg:s.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},m.onActionsTabSelection=function(){m.applications||o.voiceExtension.get(m.query).$promise.then(function(e){m.applications=e||{count:0,rows:[]}})},m.gotoOutboundRoutes=function(){e.go("app.voice.outboundRoutes",{},{reload:"app.voice.outboundRoutes"})},m.saveOutboundRoute=function(){o.voiceExtension.update({id:m.outboundRoute.id},m.outboundRoute).$promise.then(function(){n(function(n,t){if(!m.applications)return n();o.voiceExtension.addApplications({id:m.outboundRoute.id},m.applications.rows).$promise.then(function(e){m.applications.rows=e.rows,n()}).catch(function(e){t(e)})}).then(function(){m.pendingChanges=!1,r.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")})})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.editApplication=u,m.editInterval=function(e,n){var t=m.applications.rows[n];i.show({controller:"EditRoutingIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:void 0,crudPermissions:m.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,p())})},m.deleteApplication=function(e,n,t){var a=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_MESSAGE",{name:e.app})).ariaLabel("Delete application").targetEvent(t).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(a).then(function(){m.applications.rows.splice(n,1),p()})},m.deleteSelectedApplications=function(e){var n=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_MESSAGE",{total:m.selectedApplications.length})).ariaLabel("Delete applications").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedApplications.forEach(function(e){_.remove(m.applications.rows,{id:e.id})}),m.selectedApplications=[],p()})}}e.$inject=["$state","$mdDialog","$document","$q","$translate","api","toasty","Auth","outboundRoute","contexts","userProfileSection"],angular.module("app.voice").controller("OutboundRouteController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.outboundRoutes=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.voiceExtension.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="OutboundRoutes",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){d.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(g.outboundRoutes.rows,{id:e.id}),g.outboundRoutes.count-=1,g.outboundRoutes.rows.length||h(),c.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceExtension"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.outboundRoutes=o,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedOutboundRoutes=[],g.query={fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},g.editRoute=function(e){n.go("app.voice.outboundRoutes.edit",{id:e.id,outboundRoute:e,crudPermissions:g.crudPermissions})},g.createOrEditOutboundRoute=function(e,n){a.show({controller:"CreateOrEditOutboundRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/outboundRoutes/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{outboundRoute:n,outboundRoutes:g.outboundRoutes.rows,crudPermissions:g.crudPermissions}})},g.success=v,g.getOutboundRoutes=h,g.deleteConfirm=function(e,n){var t=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:e.exten})).ariaLabel("Delete extension").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.exportSelectedOutboundRoutes=function(){var e=angular.copy(g.selectedOutboundRoutes);return g.selectedOutboundRoutes=[],e},g.deleteSelectedOutboundRoutes=function(e){var n=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_MESSAGE",{total:g.selectedOutboundRoutes.length})).ariaLabel("Delete extensions").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedOutboundRoutes.forEach(function(e){f(e)}),g.selectedOutboundRoutes=[]})};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","outboundRoutes","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.voice").controller("OutboundRoutesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(){return[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",options:g.agents.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_CAMPAIGN",options:g.queues.rows,ngValue:"name"}]}function h(){return g.refresh=!1,0===g.queues.count?f(null):(g.query.queue=1===g.queues.count?g.queues.rows[0].name:g.query.queue,void 0===g.query.queue&&(g.query.queue=_.map(g.queues.rows,"name")),_.isEmpty(g.query.queue)?f(null):(g.query.offset=(g.query.page-1)*g.query.limit,i.localStorage.setItem("motion2.realtime.abandoned.voice.abandonedCalls:"+g.currentUser.id,JSON.stringify({query:_.omit(g.query,"queue")})),void(g.promise=o.voiceQueueReport.getVoiceQueuesReport(g.query,f).$promise)))}function f(e){g.abandonedCalls=e||{count:0,rows:[]},!1,g.refresh=!0}g.currentUser=d.getCurrentUser(),g.agents=u||[],g.dispositions=p.rows,g.abandonedCalls={count:0,rows:[]},g.showTooltip=!1,g.refresh=!0,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=d.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition",type:"inbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},g.getAbandonedCalls=h,g.refreshAbandonedCalls=function(){g.showTooltip=!1,h()},g.assignTo=function(e,n){e&&o.voiceQueueReport.update({id:e.id,lastAssignedTo:n?n.name:null,assigned:!!n}).$promise.catch(function(e){console.log(e)})},g.dispose=function(t){n.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(a.body),targetEvent:t,locals:{dispositions:g.dispositions,call:t}}).then(function(e){if(e){var n={id:t.id,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null};o.voiceQueueReport.update(n).$promise.catch(function(e){console.log(e)})}})},g.onSaveVoiceQueueReport=function(e){e&&g.queuesMap&&"inbound"===queue.type&&g.queuesMap[e.queue]&&(g.showTooltip=!0)},g.onUpdateVoiceQueueReport=function(e){if(e){var n=_.findIndex(g.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(g.abandonedCalls.rows[n],e)}},c.onWithoutApply("voiceQueueReport:save",g.onSaveVoiceQueueReport),c.on("voiceQueueReport:update",g.onUpdateVoiceQueueReport),function(){var e=i.localStorage.getItem("motion2.realtime.abandoned.voice.abandonedCalls:"+g.currentUser.id);if(e)(e=JSON.parse(e))&&e.query&&(g.query=_.merge(e.query,_.omit(g.query,["sort","limit","page"])),g.query=_.omit(g.query,"filter"));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};g.query.createdAt=n}d.hasRole("admin")?o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name",channel:"voice",type:"inbound",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){g.quickFilters=v(),h()}):o.userProfile.getResources({id:g.currentUser.userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){g.quickFilters=v(),h()})}();var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?t(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())}),e.$on("$destroy",function(){c.removeAllListeners("voiceQueueReport:save"),c.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","userProfile","userProfileSection","Auth","socket","toasty","agents","dispositions"],angular.module("app.voice").controller("AbandonedCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this;o.calls=i||{rows:[],count:0},o.query={limit:10,page:1},o.channelStatus=s.channelStatusOut,o.onSave=function(e){var n=_.find(o.calls.rows,{channel:e.channel});e.channelstatedesc=e.dialstatus?"up":"ring",n?_.merge(n,e):e.channel&&o.calls.rows.push(e)},o.onRemove=function(e){var n=_.findIndex(o.calls.rows,{channel:e.channel});0<=n&&(o.calls.rows[n].status="hangup");t(function(){o.calls.rows.splice(n,1)},5e3)},a.on("voice_outbound_channel:save",o.onSave),a.on("voice_outbound_channel:remove",o.onRemove),e.$on("$destroy",function(){a.removeAllListeners("voice_outbound_channel:save"),a.removeAllListeners("voice_outbound_channel:remove")})}e.$inject=["$scope","$timeout","api","socket","rpcCalls","helperClasses"],angular.module("app.voice").controller("OutboundCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,n,a,o,t,i,s,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.queues=t?_.keyBy(t.rows?t.rows:[],"name"):{},p.rpcVoiceQueuesChannelsTmp=i?_.keyBy(i.rows?_.filter(i.rows,{type:"inbound"}):[],"uniqueid"):{},p.rpcVoiceQueuesChannels={},p.userProfile=c,p.userProfileSection=m&&1==m.count?m.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.queryChannels={limit:10,page:1},p.getAvailableAgents=function(){p.availableAgents=null,s.rpc.getAgents().$promise.then(function(e){for(var n=[],t=e?e.rows:[],a=_.filter(t,{online:!0,voicePause:!1,voiceStatus:"idle"}),i=0;i<a.length;i++){var s=_.find(o.rows,["id",a[i].id]);s&&n.push(s)}p.availableAgents=n}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.getSize=function(e){return _.size(e)},p.$onInit=function(){_.forIn(p.rpcVoiceQueuesChannelsTmp,function(e,n){_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[n]=e)})},p.onSave=function(e){"inbound"===e.type&&_.find(p.queues,{name:e.name})&&(p.rpcVoiceQueuesChannels[e.uniqueid]=e)},p.onRemove=function(e){p.rpcVoiceQueuesChannels[e.uniqueid]&&delete p.rpcVoiceQueuesChannels[e.uniqueid]},p.hangup=function(n){return s.rpc.getVoiceQueuesChannelHangup({uniqueid:n}).$promise.then(function(e){d.success({title:"Channel "+n+" properly hangup!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToAgent=function(n,e,t){return s.rpc.getVoiceQueuesChannelRedirect({uniqueid:n,exten:e,context:t}).$promise.then(function(e){d.success({title:"Channel "+n+" properly redirect!",msg:e.message||""})}).catch(function(e){d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},p.redirectToNumber=function(e,n){var t=a.prompt().title("Which number do you want transfer the call to?").placeholder("Number").targetEvent(e).ok("Ok").cancel("Cancel");return a.show(t).then(function(e){return s.rpc.getVoiceQueuesChannelRedirect({uniqueid:n,exten:e}).$promise}).then(function(e){d.success({title:"Channel "+n+" properly redirect!",msg:e.message||""})}).catch(function(e){e&&d.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},r.on("voice_queue_channel:save",p.onSave),r.on("voice_queue_channel:remove",p.onRemove),e.$on("$destroy",function(){r.removeAllListeners("voice_queue_channel:save"),r.removeAllListeners("voice_queue_channel:remove")})}e.$inject=["$scope","$timeout","$mdDialog","agents","queues","rpcVoiceQueuesChannels","api","socket","helperClasses","toasty","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("QueueCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["total","answered","unmanaged","abandoned","sumHoldTime","sumDuration","sumBillable"];function u(){_.forIn(c.queues,function(e,n){c.rpcQueues[n]&&_.merge(e,_.pick(c.rpcQueues[n],m))})}c.count=a.count,c.queues=a?_.keyBy(a.rows?a.rows:[],"id"):{},c.rpcQueues=i?_.keyBy(i.rows?i.rows:[],"id"):{},c.userProfile=r,c.userProfileSection=l&&1==l.count?l.rows[0]:null,c.crudPermissions=d.parseCrudPermissions(c.userProfileSection?c.userProfileSection.crudPermissions:null),d.hasRole("admin")?c.query={type:"inbound",fields:"id,name",sort:"-updatedAt",limit:10,page:1}:c.query={id:d.getCurrentUser().id,channel:"voice",type:"inbound",fields:"id,name",sort:"-updatedAt",limit:10,page:1},c.success=v,c.getQueues=function(){c.query.offset=(c.query.page-1)*c.query.limit,d.hasRole("admin")?c.promise=s.voiceQueue.get(c.query,v).$promise:(c.query.id=c.userProfile.id,c.query.section="VoiceQueues",c.promise=s.userProfile.getResources(c.query,v).$promise)},c.onSave=function(e){c.queues[e.id]&&_.merge(c.queues[e.id],_.pick(e,m))},c.$onInit=u,o.onWithoutApply("voice_queue:save",c.onSave),c.interval=n(function(){},999);var p=!0,g=1;function v(e){c.count=e.count,c.queues=e?_.keyBy(e.rows?e.rows:[],"id"):{},u()}e.$watch("vm.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=g),c.getQueues())}),e.$on("$destroy",function(){o.removeAllListeners("voice_queue:save"),c.interval&&n.cancel(c.interval)})}e.$inject=["$scope","$timeout","$interval","queues","rpcQueues","api","socket","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("QueueParamsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"VoiceQueues":void 0,channel:"voice",type:"inbound",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("VOICE.VOICEQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditVoiceQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceQueue:n,voiceQueues:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceQueue:n,voiceQueues:u.queues.rows,realtime:!0,crudPermissions:u.crudPermissions}})},r.onWithoutApply("voice_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&m.updateVoiceQueue(e,n)}),r.on("userVoiceQueue:save",function(e){var n=_.find(u.queues.rows,["id",e.VoiceQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("userVoiceQueue:remove",function(e){var n=_.find(u.queues.rows,["id",e.VoiceQueueId]);n&&(0<n.loggedInDb&&n.loggedInDb--,_.remove(n.agents,["id",e.UserId]))}),r.on("user:agentconnect",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);if(n){if(!t.agentconnected)return;t.queue?n.talking=!0:n.busy=!0,m.updateBusyCounter(e)}})}),r.on("user:agentcomplete",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&(n.talking?n.talking=!1:n.busy&&(n.busy=!1),m.updateBusyCounter(e))})}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"voice")})}),e.$on("$destroy",function(){r.removeAllListeners("voice_queue:save"),r.removeAllListeners("userVoiceQueue:remove"),r.removeAllListeners("userVoiceQueue:save"),r.removeAllListeners("user:agentconnect"),r.removeAllListeners("user:agentcomplete"),r.removeAllListeners("user:update"),p&&n.cancel(p)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.voice").controller("QueuesVoiceRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){var a=this;switch(a.selectedTab=0,t.current.name){case"app.voice.realtime.agents":a.selectedTab=0;break;case"app.voice.realtime.telephones":a.selectedTab=1;break;case"app.voice.realtime.trunks":a.selectedTab=2;break;case"app.voice.realtime.queues":a.selectedTab=3;break;case"app.voice.realtime.queue_calls":a.selectedTab=4;break;case"app.voice.realtime.abandonedcalls":a.selectedTab=5;break;case"app.voice.realtime.queue_params":a.selectedTab=6;break;case"app.voice.realtime.outbound_calls":a.selectedTab=7;break;default:a.selectedTab=0,t.go("app.voice.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.voice.realtime.agents");break;case 1:t.go("app.voice.realtime.telephones");break;case 2:t.go("app.voice.realtime.trunks");break;case 3:t.go("app.voice.realtime.queues");break;case 4:t.go("app.voice.realtime.queue_calls");break;case 5:t.go("app.voice.realtime.abandonedcalls");break;case 6:t.go("app.voice.realtime.queue_params");break;case 7:t.go("app.voice.realtime.outbound_calls");break;default:t.go("app.voice.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.voice").controller("VoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c){var m=this,u=["fullname","internal","state","status"];function p(){_.forIn(m.telephones,function(e,n){m.rpcTelephones[n]&&_.merge(e,_.pick(m.rpcTelephones[n],u))})}m.count=a.count,m.attributes=["fullname","internal","state","status","address"],m.telephones=a?_.keyBy(a.rows?a.rows:[],"id"):{},m.rpcTelephones=i?_.keyBy(i.rows?i.rows:[],"id"):{},m.userProfile=l,m.userProfileSection=d&&1==d.count?d.rows[0]:null,m.crudPermissions=c.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={fields:"id,fullname,internal",role:"telephone",sort:"-updatedAt",limit:10,page:1},m.statusClass=r.status,m.stateClass=r.state,m.success=h,m.$onInit=p,m.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},m.getTelephones=function(){m.query.offset=(m.query.page-1)*m.query.limit,c.hasRole("admin")?m.promise=s.user.get(m.query,h).$promise:(m.query.id=m.userProfile.id,m.query.section="Telephones",m.promise=s.userProfile.getResources(m.query,h).$promise)},m.onSave=function(e){m.telephones[e.id]&&_.merge(m.telephones[e.id],_.pick(e,u))},o.on("telephone:save",m.onSave);var g=!0,v=1;function h(e){m.telephones=e?_.keyBy(e.rows?e.rows:[],"id"):{},p()}e.$watch("vm.query.filter",function(e,n){g?t(function(){g=!1}):(n||(v=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=v),m.getTelephones())}),e.$on("$destroy",function(){o.removeAllListeners("telephone:save")})}e.$inject=["$scope","$timeout","$mdDialog","telephones","rpcTelephones","api","socket","helperClasses","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("TelephonesVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m){var u=this,p=["status","stateRegistry","registry","host","port","internal","state","status"];function g(){for(var e,n=0;n<u.trunks.length;n+=1)0<=(e=_.findIndex(u.rpcTrunks,["id",u.trunks[n].id]))&&_.merge(u.trunks[n],_.pick(u.rpcTrunks[e],p))}function v(e,n,t){0<=n&&_.merge(e[n],_.pick(t,p))}u.currentUser=m.getCurrentUser(),u.count=a.count,u.trunks=a?a.rows:[],u.rpcTrunks=i&&i.rows?i.rows:[],u.query={fields:"id,name",active:!0,sort:"-updatedAt",limit:10,page:1},u.statusClass=r.status,u.stateClass=r.state,u.userProfile=d,u.userProfileSection=c&&1==c.count?c.rows[0]:null,u.crudPermissions=m.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.success=b,u.$onInit=g,u.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},u.getTrunks=function(){u.query.offset=(u.query.page-1)*u.query.limit,m.hasRole("admin")?u.promise=s.trunk.get(u.query,b).$promise:(u.query.id=u.userProfile.id,u.query.section="Trunks",u.promise=s.userProfile.getResources(u.query,b).$promise)},u.goToTrunk=function(e,n){l.go("app.tools.trunks.edit",{id:n.id})},u.onSave=function(e){var n=_.findIndex(u.trunks,["id",e.id]),t=_.findIndex(u.rpcTrunks,["id",e.id]);v(u.trunks,n,e),v(u.rpcTrunks,t,e)},o.on("trunk:save",u.onSave);var h=!0,f=1;function b(e){u.count=e.count,u.trunks=e&&e.rows?e.rows:[],g()}e.$watch("vm.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=u.query.page),e!==n&&(u.query.page=1),e||(u.query.page=f),u.getTrunks())}),e.$on("$destroy",function(){o.removeAllListeners("trunk:save")})}e.$inject=["$scope","$timeout","$mdDialog","trunks","rpcTrunks","api","socket","helperClasses","$state","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("TrunksVoiceRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_VOICEMAIL",g.voicemail=angular.copy(l),g.voicemails=r,g.newVoicemail=!1,g.voicemail||(g.voicemail={attach:"no"},g.title="VOICE.NEW_VOICEMAIL",g.newVoicemail=!0),g.addNewVoicemail=function(){g.errors=[],d.voiceMail.save(g.voicemail).$promise.then(function(e){g.voicemails.unshift(e.toJSON()),o.success({title:"Voicemail properly created",msg:g.voicemail.name?g.voicemail.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMail.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVoicemail=function(){g.errors=[],d.voiceMail.update({id:g.voicemail.id},g.voicemail).$promise.then(function(e){var n=_.find(g.voicemails,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Voicemail properly saved!",msg:g.voicemail.name?g.voicemail.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMail.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVoicemail=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The voicemail will be deleted.").ariaLabel("Delete Voicemail").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceMail.delete({id:g.voicemail.id}).$promise.then(function(){_.remove(g.voicemails,{id:g.voicemail.id}),o.success({title:"Voicemail properly deleted!",msg:(g.voicemail.name||"voicemail")+" has been deleted!"}),v(g.voicemail)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMail.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voicemails","voicemail","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditVoicemailDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.voicemailMessages=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceMail.getMessages(m.query,u).$promise}function g(e){d.voiceMailMessage.delete({id:e.id}).$promise.then(function(){_.remove(m.voicemailMessages.rows,{id:e.id}),m.voicemailMessages.count-=1,m.voicemailMessages.rows.length||p(),l.success({title:"Message deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceMail"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMail",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.voicemail={},m.voicemailMessages={count:0,rows:[]},m.selectedVoicemailMessages=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,callerid,duration,audio,stamp,msg_id",sort:"-stamp",limit:10,page:1},m.init=function(e,n){m.voicemail=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.id=m.voicemail.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the message?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("message #")+e.id||"message")+"</b> will be deleted.").ariaLabel("delete message").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.voiceMailMessageDownload=function(s,e,n){return d.voiceMailMessage.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="message"+s.id,a=new Blob(n,{type:e.type});t=s.msg_id+".wav";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=u,m.getVoicemailMessages=p,m.createOrEditVoicemailMessage=function(e,n){o.show({controller:"CreateOrEditMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicemails/edit/messages/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{voicemail:m.voicemail,message:n,messages:m.voicemailMessages.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedVoicemailMessages=function(){var e=angular.copy(m.selectedVoicemailMessages);return m.selectedVoicemailMessages=[],e},m.deleteVoicemailMessage=g,m.deleteSelectedVoicemailMessages=function(e){var n=o.confirm().title("Are you sure want to delete the selected messages?").htmlContent("<b>"+m.selectedVoicemailMessages.length+" selected</b> will be deleted.").ariaLabel("delete messages").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedVoicemailMessages.forEach(function(e){g(e)}),m.selectedVoicemailMessages=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.voice").controller("VoicemailMessagesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.voicemail=c||e.params.voicemail||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoVoicemails=function(){e.go("app.voice.voicemails",{},{reload:"app.voice.voicemails"})},u.saveVoicemail=function(){r.voiceMail.update({id:u.voicemail.id},u.voicemail).$promise.then(function(){l.success({title:"Voicemail updated!",msg:u.voicemail.name?u.voicemail.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMail",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),t=null;if(u.voicemail&&(t=_.find(u.contexts,{name:u.voicemail.context})),t&&!_.some(n,["id",t.id])){var a=_.find(u.contexts,{id:t.id});a.canSelect=!1,n.push(a)}u.contexts=n}):r.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){u.contexts=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","voicemail","userProfileSection"],angular.module("app.voice").controller("VoicemailController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.voicemails=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="voicemails",f.listOrder="",f.listOrderAsc=null,f.selectedVoicemails=[],f.query={fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",sort:"-updatedAt",limit:10,page:1},f.arrayattach=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayenvelope=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydelete=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.voice.voicemails.edit",{id:e.id,voicemail:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voicemail")+"?").htmlContent("<b>"+(e.name||"voicemail")+"</b> will be deleted.").ariaLabel("delete voicemail").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVoicemails=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceMail.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Voicemails",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVoicemail=function(e,n){i.show({controller:"CreateOrEditVoicemailDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicemails/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voicemail:n,voicemails:f.voicemails.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteVoicemail=y,f.exportSelectedVoicemails=function(){var e=angular.copy(f.selectedVoicemails);return f.selectedVoicemails=[],e},f.deleteSelectedVoicemails=function(e){var n=i.confirm().title("Are you sure want to delete the selected voicemails?").htmlContent("<b>"+f.selectedVoicemails.length+" selected</b> will be deleted.").ariaLabel("delete Voicemails").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVoicemails.forEach(function(e){y(e)}),f.selectedVoicemails=[]})},f.deselectVoicemails=function(){f.selectedVoicemails=[]},f.selectAllVoicemails=function(){f.selectedVoicemails=f.voicemails.rows};var b=!0,A=1;function E(e){f.voicemails=e||{count:0,rows:[]}}function y(e){m.voiceMail.delete({id:e.id}).$promise.then(function(){_.remove(f.voicemails.rows,{id:e.id}),f.voicemails.count-=1,f.voicemails.rows.length||f.getVoicemails(),p.success({title:_.startCase("Voicemail")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceMail"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceMail",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVoicemails())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voicemails","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("VoicemailsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_VOICEPREFIX",g.voicePrefix=angular.copy(l),g.voicePrefixes=r,g.newvoicePrefix=!1,g.voicePrefix||(g.voicePrefix={},g.title="VOICE.NEW_VOICEPREFIX",g.newvoicePrefix=!0),g.addNewvoicePrefix=function(){g.errors=[],d.voicePrefix.save(g.voicePrefix).$promise.then(function(e){g.voicePrefixes.unshift(e.toJSON()),o.success({title:"voicePrefix properly created",msg:g.voicePrefix.name?g.voicePrefix.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voicePrefix.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voicePrefix.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savevoicePrefix=function(){g.errors=[],d.voicePrefix.update({id:g.voicePrefix.id},g.voicePrefix).$promise.then(function(e){var n=_.find(g.voicePrefixes,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"voicePrefix properly saved!",msg:g.voicePrefix.name?g.voicePrefix.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voicePrefix.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voicePrefix.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletevoicePrefix=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The voicePrefix will be deleted.").ariaLabel("Delete voicePrefix").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voicePrefix.delete({id:g.voicePrefix.id}).$promise.then(function(){_.remove(g.voicePrefixes,{id:g.voicePrefix.id}),o.success({title:"voicePrefix properly deleted!",msg:(g.voicePrefix.name||"voicePrefix")+" has been deleted!"}),v(g.voicePrefix)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voicePrefix.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voicePrefix.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){g.outboundRoutes=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){g.outboundRoutes=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.outboundRoutes,{id:e.resourceId})}),t=null;if(g.voicePrefix&&(t=_.find(g.outboundRoutes,{id:Number(g.voicePrefix.VoiceExtensionId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.outboundRoutes,{id:t.id});a.canSelect=!1,n.push(a)}g.outboundRoutes=n})}else{var t=[],a=null;g.voicePrefix&&(a=_.find(g.outboundRoutes,{id:Number(g.voicePrefix.VoiceExtensionId)}));for(var i=0;i<g.outboundRoutes.length;i++)a&&g.outboundRoutes[i].id===a.id&&(g.outboundRoutes[i].canSelect=!1,t.push(g.outboundRoutes[i]));g.outboundRoutes=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GEToutboundRoutes",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voicePrefixes","voicePrefix","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditvoicePrefixDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.voicePrefix.getAgents({id:c.voicePrefix.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UservoicePrefix?"penalty "+e.UservoicePrefix.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.voicePrefix=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.removeAgents({id:c.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.addAgents({id:c.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("VOICE.ALL_AGENTS"),labelSelected:r.instant("VOICE.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","voicePrefix","voicePrefixes","realtime","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("voicePrefixagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.voicePrefix.getTeams({id:l.voicePrefix.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.voicePrefix=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("VOICE.ALL_TEAMS"),labelSelected:t.instant("VOICE.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.removeTeams({id:l.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.addTeams({id:l.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","voicePrefix","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("voicePrefixteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.voicePrefixes=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="voicePrefixes",f.listOrder="",f.listOrderAsc=null,f.selectedVoicePrefixes=[],f.query={fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditvoicePrefixDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:f.voicePrefixes.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"voicePrefixagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:f.voicePrefixes?f.voicePrefixes.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.teamadddialog=function(e,n){i.show({controller:"voicePrefixteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:f.voicePrefixes?f.voicePrefixes.rows:[],crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voicePrefix")+"?").htmlContent("<b>"+(e.name||"voicePrefix")+"</b> will be deleted.").ariaLabel("delete voicePrefix").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVoicePrefixes=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voicePrefix.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="VoicePrefixes",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditvoicePrefix=function(e,n){i.show({controller:"CreateOrEditvoicePrefixDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voicePrefix:n,voicePrefixes:f.voicePrefixes.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletevoicePrefix=y,f.exportSelectedVoicePrefixes=function(){var e=angular.copy(f.selectedVoicePrefixes);return f.selectedVoicePrefixes=[],e},f.deleteSelectedVoicePrefixes=function(e){var n=i.confirm().title("Are you sure want to delete the selected voicePrefixes?").htmlContent("<b>"+f.selectedVoicePrefixes.length+" selected</b> will be deleted.").ariaLabel("delete voicePrefixs").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVoicePrefixes.forEach(function(e){y(e)}),f.selectedVoicePrefixes=[]})},f.deselectVoicePrefixes=function(){f.selectedVoicePrefixes=[]},f.selectAllVoicePrefixes=function(){f.selectedVoicePrefixes=f.voicePrefixes.rows},g.hasRole("admin")?m.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){f.outboundRoutes=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){f.outboundRoutes=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.outboundRoutes,{id:e.resourceId})}),t=null;if(f.voicePrefix&&(t=_.find(f.outboundRoutes,{id:Number(f.voicePrefix.VoiceExtensionId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.outboundRoutes,{id:t.id});a.canSelect=!1,n.push(a)}f.outboundRoutes=n})}else{var t=[],a=null;f.voicePrefix&&(a=_.find(f.outboundRoutes,{id:Number(f.voicePrefix.VoiceExtensionId)}));for(var i=0;i<f.outboundRoutes.length;i++)a&&f.outboundRoutes[i].id===a.id&&(f.outboundRoutes[i].canSelect=!1,t.push(f.outboundRoutes[i]));f.outboundRoutes=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GEToutboundRoutes",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.voicePrefixes=e||{count:0,rows:[]}}function y(e){m.voicePrefix.delete({id:e.id}).$promise.then(function(){_.remove(f.voicePrefixes.rows,{id:e.id}),f.voicePrefixes.count-=1,f.voicePrefixes.rows.length||f.getVoicePrefixes(),p.success({title:_.startCase("voicePrefix")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoicePrefix"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoicePrefix",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVoicePrefixes())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voicePrefixes","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("VoicePrefixesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_VOICEQUEUE",g.voiceQueue=angular.copy(l),g.voiceQueues=r,g.newVoiceQueue=!1,g.voiceQueue||(g.voiceQueue={type:"inbound",strategy:"ringall",timeout:15,retry:2,random_periodic_announce:"no",announce_holdtime:"no",announce_position:"no",reportholdtime:"no",autopause:"no",ringinuse:"no",timeoutrestart:"no",setinterfacevar:"no",setqueuevar:"no",setqueueentryvar:"no"},g.title="VOICE.NEW_VOICEQUEUE",g.newVoiceQueue=!0),g.addNewVoiceQueue=function(){g.errors=[],d.voiceQueue.save(g.voiceQueue).$promise.then(function(e){g.voiceQueues.unshift(e.toJSON()),o.success({title:"VoiceQueue properly created",msg:g.voiceQueue.name?g.voiceQueue.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVoiceQueue=function(){g.errors=[],d.voiceQueue.update({id:g.voiceQueue.id},g.voiceQueue).$promise.then(function(e){var n=_.find(g.voiceQueues,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"VoiceQueue properly saved!",msg:g.voiceQueue.name?g.voiceQueue.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVoiceQueue=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The voiceQueue will be deleted.").ariaLabel("Delete VoiceQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceQueue.delete({id:g.voiceQueue.id}).$promise.then(function(){_.remove(g.voiceQueues,{id:g.voiceQueue.id}),o.success({title:"VoiceQueue properly deleted!",msg:(g.voiceQueue.name||"voiceQueue")+" has been deleted!"}),v(g.voiceQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voiceQueues","voiceQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditVoiceQueueDialogController",e)}(),function(){"use strict";function e(e,l,a,d,n,t,i,s,o,r){var c=this;function m(){return l(function(t,n){return l(function(n,t){return d.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(n,t){return d.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:o.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),l(function(n,t){return d.voiceQueue.getAgents({id:c.voiceQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=o.getCurrentUser(),c.voiceQueue=n,c.crudPermissions=r,c.penalty=0,c.realtime=i,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return o.hasRole("admin")?m().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):l(function(t,n){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,l(function(e,n){_.isEmpty(t)?e():d.voiceQueue.removeAgents({id:c.voiceQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return r=n,l(function(e,n){if(_.isEmpty(r))e();else{for(var t=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);t.push(d.voiceQueue.addAgents({id:c.voiceQueue.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty "),realtime:c.realtime||!1}).$promise)}l.all(t).then(function(){e()}).catch(function(e){n(e)})}});var r}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),a.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("VOICE.ALL_AGENTS"),labelSelected:s.instant("VOICE.SELECTED_AGENTS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var t=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","voiceQueue","voiceQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("VoiceQueueagentaddController",e)}(),function(){"use strict";function e(e,i,a,s,n,t,o,r){var l=this;function d(){return i(function(t,n){return i(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:i(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),i(function(n,t){return s.voiceQueue.getTeams({id:l.voiceQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.voiceQueue=n,l.crudPermissions=r,l.penalty=0,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"penalty",labelAll:t.instant("VOICE.ALL_TEAMS"),labelSelected:t.instant("VOICE.SELECTED_TEAMS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+l.penalty});var t=_.xorWith(l.startingSelectedItems,l.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):i(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceWith(l.selectedItems,l.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,i(function(e,n){_.isEmpty(t)?e():s.voiceQueue.removeTeams({id:l.voiceQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return a=n,i(function(e,n){if(!_.isEmpty(a)){var t=_.map(a,function(e){return{id:e.id,penalty:_.trim(e.penalty,"penalty ")}});return s.voiceQueue.addTeams({id:l.voiceQueue.id,teams:t}).$promise.then(function(){e()}).catch(function(e){n(e)})}e()});var a}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),a.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","voiceQueue","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("VoiceQueueteamaddController",e)}(),function(){"use strict";function e(t,e,a,i,s,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.voiceQueue=c||t.params.voiceQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.teamadddialog=function(e,n){a.show({controller:"VoiceQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:u.voiceQueues?u.voiceQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){a.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:u.voiceQueues?u.voiceQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.queues",{}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.queues",{})}},u.alert=l.info,u.gotoVoiceQueues=function(){t.go("app.voice.voiceQueues",{},{reload:"app.voice.voiceQueues"})},u.saveVoiceQueue=function(){r.voiceQueue.update({id:u.voiceQueue.id},u.voiceQueue).$promise.then(function(){l.success({title:"VoiceQueue updated!",msg:u.voiceQueue.name?u.voiceQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MUSICONHOLDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:407}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.musiconholds,{id:e.resourceId})}),t=null;if(u.voiceQueue&&(t=_.find(u.musiconholds,{name:u.voiceQueue.musiconhold})),t&&!_.some(n,["id",t.id])){var a=_.find(u.musiconholds,{id:t.id});a.canSelect=!1,n.push(a)}u.musiconholds=n}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true",defaultEntry:1}).$promise.then(function(e){u.musiconholds=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmusiconholds",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.sound.get({fields:"id,name,save_name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.sounds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.sound.get({fields:"id,name,save_name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.sounds=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.sounds,{id:e.resourceId})});u.sounds.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.sounds=n})}else u.sounds=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.pauses=n})}else u.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","voiceQueue","userProfileSection"],angular.module("app.voice").controller("VoiceQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.voiceQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="voiceQueues",f.listOrder="",f.listOrderAsc=null,f.selectedVoiceQueues=[],f.query={fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Ringall",value:"'ringall'"},{option:"Round Robin Memory",value:"'rrmemory'"},{option:"Least Recent",value:"'leastrecent'"},{option:"Fewest Calls",value:"'fewestcalls'"},{option:"Random",value:"'random'"},{option:"Linear",value:"'linear'"},{option:"Weight Random",value:"'wrandom'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayjoinempty=_.keyBy([{option:"no",value:"'no'",disabled:"vm.voiceQueue.joinempty.length === 1  && vm.voiceQueue.joinempty[0] === 'no'"},{option:"yes",value:"'yes'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'yes'"},{option:"strict",value:"'strict'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'strict'"},{option:"loose",value:"'loose'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'loose'"},{option:"paused",value:"'paused'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'paused'"},{option:"penalty",value:"'penalty'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'penalty'"},{option:"inuse",value:"'inuse'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'inuse'"},{option:"ringing",value:"'ringing'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'ringing'"},{option:"unavailable",value:"'unavailable'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'unavailable'"},{option:"invalid",value:"'invalid'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'invalid'"},{option:"unknown",value:"'unknown'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'unknown'"},{option:"wrapup",value:"'wrapup'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'wrapup'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayleavewhenempty=_.keyBy([{option:"no",value:"'no'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'no'"},{option:"yes",value:"'yes'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'yes'"},{option:"strict",value:"'strict'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'strict'"},{option:"loose",value:"'loose'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'loose'"},{option:"paused",value:"'paused'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'paused'"},{option:"penalty",value:"'penalty'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'penalty'"},{option:"inuse",value:"'inuse'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'inuse'"},{option:"ringing",value:"'ringing'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'ringing'"},{option:"unavailable",value:"'unavailable'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'unavailable'"},{option:"invalid",value:"'invalid'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'invalid'"},{option:"unknown",value:"'unknown'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'unknown'"},{option:"wrapup",value:"'wrapup'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'wrapup'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayrandom_periodic_announce=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayannounce_holdtime=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Once",value:"'once'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayannounce_position=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Limit",value:"'limit'"},{option:"More",value:"'more'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayreportholdtime=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayautopause=_.keyBy([{option:"Yes",value:"'all'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayringinuse=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytimeoutrestart=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymonitor_format=_.keyBy([{option:"Inactive",value:"''"},{option:"wav",value:"'wav'"},{option:"wav49",value:"'wav49'"},{option:"gsm",value:"'gsm'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetinterfacevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueuevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueueentryvar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.voice.voiceQueues.edit",{id:e.id,voiceQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"VoiceQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:f.voiceQueues?f.voiceQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:f.voiceQueues?f.voiceQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voiceQueue")+"?").htmlContent("<b>"+(e.name||"voiceQueue")+"</b> will be deleted.").ariaLabel("delete voiceQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.queues",{})}},f.success=E,f.getVoiceQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="VoiceQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVoiceQueue=function(e,n){i.show({controller:"CreateOrEditVoiceQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceQueue:n,voiceQueues:f.voiceQueues.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteVoiceQueue=y,f.exportSelectedVoiceQueues=function(){var e=angular.copy(f.selectedVoiceQueues);return f.selectedVoiceQueues=[],e},f.deleteSelectedVoiceQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected voiceQueues?").htmlContent("<b>"+f.selectedVoiceQueues.length+" selected</b> will be deleted.").ariaLabel("delete VoiceQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVoiceQueues.forEach(function(e){y(e)}),f.selectedVoiceQueues=[]})},f.deselectVoiceQueues=function(){f.selectedVoiceQueues=[]},f.selectAllVoiceQueues=function(){f.selectedVoiceQueues=f.voiceQueues.rows};var b=!0,A=1;function E(e){f.voiceQueues=e||{count:0,rows:[]}}function y(e){m.voiceQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.voiceQueues.rows,{id:e.id}),f.voiceQueues.count-=1,f.voiceQueues.rows.length||f.getVoiceQueues(),p.success({title:_.startCase("VoiceQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVoiceQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voiceQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("VoiceQueuesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_VOICERECORDING",g.voiceRecording=angular.copy(l),g.voiceRecordings=r,g.newVoiceRecording=!1,g.voiceRecording||(g.voiceRecording={},g.title="VOICE.NEW_VOICERECORDING",g.newVoiceRecording=!0),g.addNewVoiceRecording=function(){g.errors=[],d.voiceRecording.save(g.voiceRecording).$promise.then(function(e){g.voiceRecordings.unshift(e.toJSON()),o.success({title:"VoiceRecording properly created",msg:g.voiceRecording.name?g.voiceRecording.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceRecording.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVoiceRecording=function(){g.errors=[],d.voiceRecording.update({id:g.voiceRecording.id},g.voiceRecording).$promise.then(function(e){var n=_.find(g.voiceRecordings,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"VoiceRecording properly saved!",msg:g.voiceRecording.name?g.voiceRecording.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceRecording.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVoiceRecording=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The voiceRecording will be deleted.").ariaLabel("Delete VoiceRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceRecording.delete({id:g.voiceRecording.id}).$promise.then(function(){_.remove(g.voiceRecordings,{id:g.voiceRecording.id}),o.success({title:"VoiceRecording properly deleted!",msg:(g.voiceRecording.name||"voiceRecording")+" has been deleted!"}),v(g.voiceRecording)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceRecording.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voiceRecordings","voiceRecording","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditVoiceRecordingDialogController",e)}(),function(){"use strict";function e(e,n){var t=this;t.voiceRecording={},t.init=function(e){t.voiceRecording=e}}e.$inject=["api","toasty"],angular.module("app.voice").controller("VoiceRecordingSentimentStatisticsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.voiceRecording=c||e.params.voiceRecording||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.alert=l.info,p.gotoVoiceRecordings=function(){e.go("app.voice.voiceRecordings",{},{reload:"app.voice.voiceRecordings"})},p.saveVoiceRecording=function(){r.voiceRecording.update({id:p.voiceRecording.id},p.voiceRecording).$promise.then(function(){l.success({title:"VoiceRecording updated!",msg:p.voiceRecording.name?p.voiceRecording.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","voiceRecording","userProfile","userProfileSection"],angular.module("app.voice").controller("VoiceRecordingController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,l,r,d,c,m,u,p,g,v,h,f){var b=this;function A(n,e){return m.voiceRecording.runTranscribe({id:n.id,runSentiment:!1}).$promise.then(function(e){p.success({title:l.instant("VOICE.RUNTRANSCRIBE_VOICERECORDING"),msg:l.instant("VOICE.RUNTRANSCRIBE_VOICERECORDING")+" succeded!"}),n.transcribeStatus=e.transcribeStatus}).catch(function(e){p.error({title:l.instant("VOICE.RUNTRANSCRIBE_VOICERECORDING"),msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})}function E(n,e){return m.voiceRecording.runTranscribe({id:n.id,runSentiment:!0}).$promise.then(function(e){p.success({title:l.instant("VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING"),msg:l.instant("VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING")+" succeded!"}),n.transcribeStatus=e.transcribeStatus}).catch(function(e){p.error({title:l.instant("VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING"),msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})}function y(e,n){return m.voiceRecording.runTranscribe({id:e.id,runSentiment:!0}).$promise.then(function(e){p.success({title:l.instant("VOICE.RUNSENTIMENT_VOICERECORDING"),msg:l.instant("VOICE.RUNSENTIMENT_VOICERECORDING")+" succeded!"})}).catch(function(e){p.error({title:l.instant("VOICE.RUNSENTIMENT_VOICERECORDING"),msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})}b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.voiceRecordings=r||{count:0,rows:[]},b.userProfile=d,b.userProfileSection=c&&1==c.count?c.rows[0]:null,b.crudPermissions=g.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.table="voiceRecordings",b.listOrder="",b.listOrderAsc=null,b.selectedVoiceRecordings=[],b.query={fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",sort:"-createdAt",createdAt:"@msUtils.firstLastDayMonth()",limit:10,page:1},b.query.createdAt=u.firstLastDayMonth(),b.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE_RANGE"}],b.editstate=function(e,n){t.go("app.voice.voiceRecordings.edit",{id:e.id,voiceRecording:e,crudPermissions:b.crudPermissions})},b.runtranscriberuntranscribesentiment=A,b.runtranscribesentimentruntranscribesentiment=E,b.runsentimentruntranscribesentiment=y,b.downloadtranscribefile2=function(s,e){var t=!1,n=_.isNil(s.format)?s.value.substring(s.value.lastIndexOf(".")):s.format;t=".mp4"===n;-1<s.value.lastIndexOf("/")?s.value.substring(s.value.lastIndexOf("/")+1):-1<s.value.lastIndexOf("\\")?s.value.substring(s.value.lastIndexOf("\\")+1):s.value;return m.voiceRecording.downloadTranscribe({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.uniqueid+".txt";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"404"===String(e.status)&&!1===t?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.WRONG_EXTENSION")}):"404"===String(e.status)?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.FILE_NOT_FOUND")}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.downloadfile2=function(r,e){var t=!1,n=_.isNil(r.format)?r.value.substring(r.value.lastIndexOf(".")):r.format;t=".mp4"===n;-1<r.value.lastIndexOf("/")?r.value.substring(r.value.lastIndexOf("/")+1):-1<r.value.lastIndexOf("\\")?r.value.substring(r.value.lastIndexOf("\\")+1):r.value;return m.voiceRecording.download({id:r.id}).$promise.then(function(e){var n,t,a=[e.buffer],i="download",s=new Blob(a,{type:e.type});n=r.value,t=-1<n.lastIndexOf("/")?n.substring(n.lastIndexOf("/")+1):-1<n.lastIndexOf("\\")?n.substring(n.lastIndexOf("\\")+1):n,i=(t=t.substring(0,t.lastIndexOf(".")))+r.format;var o=window.document.createElement("a");o.setAttribute("href",URL.createObjectURL(s)),o.setAttribute("download",i),document.body.appendChild(o),o.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"404"===String(e.status)&&!1===t?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.WRONG_EXTENSION")}):"404"===String(e.status)?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.FILE_NOT_FOUND")}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voiceRecording")+"?").htmlContent("<b>"+(e.name||"voiceRecording")+"</b> will be deleted.").ariaLabel("delete voiceRecording").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){O(e)},function(){console.log("CANCEL")})},b.success=I,b.getVoiceRecordings=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceRecording.get(b.query,I).$promise:(b.query.id=b.userProfile.id,b.query.section="VoiceRecordings",b.promise=m.userProfile.getResources(b.query,I).$promise)},b.createOrEditVoiceRecording=function(e,n){i.show({controller:"CreateOrEditVoiceRecordingDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceRecordings/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceRecording:n,voiceRecordings:b.voiceRecordings.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteVoiceRecording=O,b.exportSelectedVoiceRecordings=function(){var e=angular.copy(b.selectedVoiceRecordings);b.selectedVoiceRecordings=[],b.userProfile.privacyEnabled&&_.forEach(e,function(e){e.calleridnum=f.mask(e.calleridnum),e.exten=f.mask(e.exten),e.connectedlinenum=f.mask(e.connectedlinenum),e.membername=f.mask(e.membername)});return e},b.deleteSelectedVoiceRecordings=function(e){var n=i.confirm().title("Are you sure want to delete the selected voiceRecordings?").htmlContent("<b>"+b.selectedVoiceRecordings.length+" selected</b> will be deleted.").ariaLabel("delete VoiceRecordings").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){b.selectedVoiceRecordings.forEach(function(e){O(e)}),b.selectedVoiceRecordings=[]})},b.deselectVoiceRecordings=function(){b.selectedVoiceRecordings=[]},b.selectAllVoiceRecordings=function(){b.selectedVoiceRecordings=b.voiceRecordings.rows},b.runtranscribeSelectedVoiceRecordings=function(n){b.selectedVoiceRecordings.forEach(function(e){A(e,n)}),b.selectedVoiceRecordings=[]},b.runtranscribesentimentSelectedVoiceRecordings=function(n){b.selectedVoiceRecordings.forEach(function(e){E(e,n)}),b.selectedVoiceRecordings=[]},b.runsentimentSelectedVoiceRecordings=function(n){b.selectedVoiceRecordings.forEach(function(e){y(e,n)}),b.selectedVoiceRecordings=[]};var S=!0,T=1;function I(e){b.voiceRecordings=e||{count:0,rows:[]}}function O(e){m.voiceRecording.delete({id:e.id}).$promise.then(function(){_.remove(b.voiceRecordings.rows,{id:e.id}),b.voiceRecordings.count-=1,b.voiceRecordings.rows.length||b.getVoiceRecordings(),p.success({title:_.startCase("VoiceRecording")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceRecording"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceRecording",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){S?o(function(){S=!1}):(n||(T=b.query.page),e!==n&&(b.query.page=1),e||(b.query.page=T),b.getVoiceRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voiceRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","privacyManager"],angular.module("app.voice").controller("VoiceRecordingsController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c,m){var u=this,p=["loggedIn","available","waiting","paused"],g=n(function(){},999);u.currentUser=c.getCurrentUser(),u.queues=s,u.userProfileSection=d&&1==d.count?d.rows[0]:null,u.crudPermissions=c.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={id:c.isUser()?u.currentUser.id:void 0,section:c.isUser()?"WhatsappQueues":void 0,channel:"whatsapp",sort:"name",limit:10,page:1},u.getQueues=function(){u.query.offset=(u.query.page-1)*u.query.limit,o.realtime.getQueues(u.query).$promise.then(function(e){u.queues=e}).catch(function(e){l.error({title:i.instant("WHATSAPP.WHATSAPPQUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},u.editQueue=function(e,n){t.show({controller:"CreateOrEditWhatsappQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappQueue:n,whatsappQueues:u.queues.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},u.addAgent=function(e,n){t.show({controller:"WhatsappQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappQueue:n,whatsappQueues:u.queues.rows,realtime:!1,crudPermissions:u.crudPermissions}})},r.on("whatsapp_queue:save",function(e){var n=_.find(u.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,p))}),r.on("userWhatsappQueue:save",function(e){var n=_.find(u.queues.rows,["id",e.WhatsappQueueId]);n&&(n.loggedInDb++,n.agents.push({id:e.UserId}))}),r.on("userWhatsappQueue:remove",function(e){var n=_.find(u.queues.rows,["id",e.WhatsappQueueId]);n&&(0<n.loggedInDb&&n.loggedInDb--,_.remove(n.agents,["id",e.UserId]))}),r.on("user:update",function(t){u.queues.rows.forEach(function(e){var n=_.find(e.agents,["id",t.id]);n&&m.updateQueue(t,e,n,"whatsapp")})}),e.$on("$destroy",function(){r.removeAllListeners("whatsapp_queue:save"),r.removeAllListeners("userWhatsappQueue:remove"),r.removeAllListeners("userWhatsappQueue:save"),r.removeAllListeners("user:update"),g&&n.cancel(g)})}e.$inject=["$scope","$mdDialog","$document","$interval","$translate","queues","api","socket","toasty","userProfileSection","Auth","realtimeManager"],angular.module("app.whatsapp").controller("QueuesWhatsappRealtimeController",e)}(),function(){"use strict";angular.module("app.auth").factory("helperClasses",function(){return{status:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},state:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},channelStatus:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},channelStatusOut:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"}}})}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.whatsapp.realtime.agents":this.selectedTab=0;break;case"app.whatsapp.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.whatsapp.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.whatsapp.realtime.agents");break;case 1:t.go("app.whatsapp.realtime.queues");break;default:t.go("app.whatsapp.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.whatsapp").controller("WhatsappRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(){"twilio"===g.whatsappAccount.type&&(g.whatsappAccount.baseUrl=null)}function h(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="WHATSAPP.EDIT_WHATSAPPACCOUNT",g.whatsappAccount=angular.copy(l),g.whatsappAccounts=r,g.newWhatsappAccount=!1,g.whatsappAccount||(g.whatsappAccount={remote:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),type:"twilio",notificationSound:!0,queueTransferTimeout:300,waitForTheAssignedAgent:10,agentTransferTimeout:300},g.title="WHATSAPP.NEW_WHATSAPPACCOUNT",g.newWhatsappAccount=!0),n.params.id&&(g.whatsappAccount.WhatsappAccountId=n.params.id),g.addNewWhatsappAccount=function(){g.errors=[],v(),d.whatsappAccount.save(g.whatsappAccount).$promise.then(function(e){g.whatsappAccounts.unshift(e.toJSON()),o.success({title:"WhatsappAccount properly created",msg:g.whatsappAccount.name?g.whatsappAccount.name+" has been created!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveWhatsappAccount=function(){g.errors=[],v(),d.whatsappAccount.update({id:g.whatsappAccount.id},g.whatsappAccount).$promise.then(function(e){var n=_.find(g.whatsappAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"WhatsappAccount properly saved!",msg:g.whatsappAccount.name?g.whatsappAccount.name+" has been saved!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteWhatsappAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The whatsappAccount will be deleted.").ariaLabel("Delete WhatsappAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.whatsappAccount.delete({id:g.whatsappAccount.id}).$promise.then(function(){_.remove(g.whatsappAccounts,{id:g.whatsappAccount.id}),o.success({title:"WhatsappAccount properly deleted!",msg:(g.whatsappAccount.name||"whatsappAccount")+" has been deleted!"}),h(g.whatsappAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=h,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.whatsappAccount&&(t=_.find(g.lists,{id:Number(g.whatsappAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.whatsappAccount&&(a=_.find(g.lists,{id:Number(g.whatsappAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){g.pauses=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){g.pauses=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.pauses,{id:e.resourceId})});g.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),g.pauses=n})}else g.pauses=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","whatsappAccounts","whatsappAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.whatsapp").controller("CreateOrEditWhatsappAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.whatsappAccountApps.rows.length){var t=r.whatsappAccountApps.rows[n]?r.whatsappAccountApps.rows[n]:r.whatsappAccountApps.rows[0];i.show({controller:"EditWhatsappAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccountApp:t,whatsappAccount:r.whatsappAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.whatsappAccountApps.rows[n]=e:r.whatsappAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.whatsappAccountApps.rows.length;t++,0){var a=r.whatsappAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.whatsappAccount.context,a.exten=r.whatsappAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.whatsappAccount.addApplications({id:r.whatsappAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.whatsappAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.whatsappAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.whatsappAccount={},r.whatsappAccountApps={count:0,rows:[]},r.selectedWhatsappAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"WhatsappQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"whatsappQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:2102}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",nolimit:!0,role:"agent"},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]},{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:4,help:!0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.whatsappAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getWhatsappAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.whatsappAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getWhatsappAccountApps=function(){r.promise=o.whatsappAccount.getApplications(r.query,t).$promise},r.editWhatsappAccountApp=n,r.editInterval=function(e,n){if(r.whatsappAccountApps.rows.length){var t=r.whatsappAccountApps.rows[n]?r.whatsappAccountApps.rows[n]:r.whatsappAccountApps.rows[0];i.show({controller:"EditWhatsappAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteWhatsappAccountApp=function(e){_.remove(r.whatsappAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedWhatsappAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedWhatsappAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedWhatsappAccountApps.forEach(function(e){_.remove(r.whatsappAccountApps.rows,{id:e.id})}),r.selectedWhatsappAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.whatsappAccount.getAgents({id:c.whatsappAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserWhatsappAccount?"penalty "+e.UserWhatsappAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.whatsappAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.whatsappAccount.removeAgents({id:c.whatsappAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.whatsappAccount.addAgents({id:c.whatsappAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("WHATSAPP.ALL_AGENTS"),labelSelected:r.instant("WHATSAPP.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","whatsappAccount","whatsappAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.whatsapp").controller("WhatsappAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditWhatsappAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("whatsapp")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.whatsappQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.whatsappQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:2102}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"whatsappAccount",action:"getDispositions",field:"name",params:{id:m.whatsappAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.whatsappAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.whatsappAccountInteractions.rows.length;n+=1){var t=m.whatsappAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.whatsappInteraction.get(m.query,p).$promise}function v(e){d.whatsappInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.whatsappAccountInteractions.rows,{id:e.id}),m.whatsappAccountInteractions.count-=1,m.whatsappAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETwhatsappAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.whatsappAccount={},m.whatsappAccountInteractions={count:0,rows:[]},m.selectedWhatsappAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.whatsappAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.WhatsappAccountId=m.whatsappAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.whatsappInteractionDownload=function(s,e,n){return d.whatsappInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="whatsapp-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getWhatsappAccountInteractions=g,m.createOrEditWhatsappAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccount:m.whatsappAccount,interaction:n,interactions:m.whatsappAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spywhatsappInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"whatsapp",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"whatsapp.whatsappAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||WhatsappAccountId:=$eq["+m.whatsappAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedWhatsappAccountInteractions=function(){var e=angular.copy(m.selectedWhatsappAccountInteractions);return m.selectedWhatsappAccountInteractions=[],e},m.deleteWhatsappAccountInteraction=v,m.deleteSelectedWhatsappAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedWhatsappAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedWhatsappAccountInteractions.forEach(function(e){v(e)}),m.selectedWhatsappAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.whatsappAccount=c||e.params.whatsappAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.baseUrl=[{name:"US Production",url:"https://us1.whatsapp.api.sinch.com"},{name:"EU Production",url:"https://eu1.whatsapp.api.sinch.com"}],p.agentadddialog=function(e,n){t.show({controller:"WhatsappAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappAccount:e,whatsappAccounts:p.whatsappAccounts?p.whatsappAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoWhatsappAccounts=function(){e.go("app.whatsapp.whatsappAccounts",{},{reload:"app.whatsapp.whatsappAccounts"})},p.saveWhatsappAccount=function(){"twilio"===p.whatsappAccount.type&&(p.whatsappAccount.baseUrl=null);r.whatsappAccount.update({id:p.whatsappAccount.id},p.whatsappAccount).$promise.then(function(){l.success({title:"WhatsappAccount updated!",msg:p.whatsappAccount.name?p.whatsappAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.whatsappAccount&&(t=_.find(p.lists,{id:Number(p.whatsappAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.whatsappAccount&&(a=_.find(p.lists,{id:Number(p.whatsappAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","whatsappAccount","userProfile","userProfileSection"],angular.module("app.whatsapp").controller("WhatsappAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.whatsappAccountWhatsappCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.whatsappAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.whatsappAccountWhatsappCannedAnswers.rows,{id:e.id}),m.whatsappAccountWhatsappCannedAnswers.count-=1,m.whatsappAccountWhatsappCannedAnswers.rows.length||p(),l.success({title:"WhatsappCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETwhatsappAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.whatsappAccount={},m.whatsappAccountWhatsappCannedAnswers={count:0,rows:[]},m.selectedWhatsappAccountWhatsappCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.whatsappAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.WhatsappAccountId=m.whatsappAccount.id,m.query.id=m.whatsappAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the whatsappCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("whatsappCannedAnswer #")+e.id||"whatsappCannedAnswer")+"</b> will be deleted.").ariaLabel("delete whatsappCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getWhatsappAccountWhatsappCannedAnswers=p,m.createOrEditWhatsappAccountWhatsappCannedAnswer=function(e,n){o.show({controller:"CreateOrEditWhatsappCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/whatsappCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccount:m.whatsappAccount,whatsappCannedAnswer:n,whatsappCannedAnswers:m.whatsappAccountWhatsappCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedWhatsappAccountWhatsappCannedAnswers=function(){var e=angular.copy(m.selectedWhatsappAccountWhatsappCannedAnswers);return m.selectedWhatsappAccountWhatsappCannedAnswers=[],e},m.deleteWhatsappAccountWhatsappCannedAnswer=g,m.deleteSelectedWhatsappAccountWhatsappCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected whatsappCannedAnswers?").htmlContent("<b>"+m.selectedWhatsappAccountWhatsappCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete whatsappCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedWhatsappAccountWhatsappCannedAnswers.forEach(function(e){g(e)}),m.selectedWhatsappAccountWhatsappCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountWhatsappCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="WHATSAPP.EDIT_WHATSAPPCANNEDANSWER",g.whatsappCannedAnswer=angular.copy(l),g.whatsappCannedAnswers=r,g.newWhatsappCannedAnswer=!1,g.whatsappCannedAnswer||(g.whatsappCannedAnswer={},g.title="WHATSAPP.NEW_WHATSAPPCANNEDANSWER",g.newWhatsappCannedAnswer=!0),n.params.id&&(g.whatsappCannedAnswer.WhatsappAccountId=n.params.id),g.addNewWhatsappCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.whatsappCannedAnswer).$promise.then(function(e){g.whatsappCannedAnswers.unshift(e.toJSON()),o.success({title:"WhatsappCannedAnswer properly created",msg:g.whatsappCannedAnswer.name?g.whatsappCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveWhatsappCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.whatsappCannedAnswer.id},g.whatsappCannedAnswer).$promise.then(function(e){var n=_.find(g.whatsappCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"WhatsappCannedAnswer properly saved!",msg:g.whatsappCannedAnswer.name?g.whatsappCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteWhatsappCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The whatsappCannedAnswer will be deleted.").ariaLabel("Delete WhatsappCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.whatsappCannedAnswer.id}).$promise.then(function(){_.remove(g.whatsappCannedAnswers,{id:g.whatsappCannedAnswer.id}),o.success({title:"WhatsappCannedAnswer properly deleted!",msg:(g.whatsappCannedAnswer.name||"whatsappCannedAnswer")+" has been deleted!"}),v(g.whatsappCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","whatsappCannedAnswers","whatsappCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.whatsapp").controller("CreateOrEditWhatsappCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.whatsappAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.whatsappAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.WhatsappAccountId=m.whatsappAccount.id,m.query.id=m.whatsappAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.whatsappAccount.id,field:"WhatsappAccountId",route:"whatsappAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountDispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.whatsappAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="whatsappAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedWhatsappAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description,baseUrl",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Twilio",value:"'twilio'"},{option:"Sinch",value:"'sinch'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.whatsapp.whatsappAccounts.edit",{id:e.id,whatsappAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.whatsapp.whatsappAccounts.edit",{id:e.id,tab:5})},f.agentadddialog=function(e,n){i.show({controller:"WhatsappAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappAccount:e,whatsappAccounts:f.whatsappAccounts?f.whatsappAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("whatsappAccount")+"?").htmlContent("<b>"+(e.name||"whatsappAccount")+"</b> will be deleted.").ariaLabel("delete whatsappAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getWhatsappAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.whatsappAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="WhatsappAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditWhatsappAccount=function(e,n){i.show({controller:"CreateOrEditWhatsappAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccount:n,whatsappAccounts:f.whatsappAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteWhatsappAccount=y,f.exportSelectedWhatsappAccounts=function(){var e=angular.copy(f.selectedWhatsappAccounts);return f.selectedWhatsappAccounts=[],e},f.deleteSelectedWhatsappAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected whatsappAccounts?").htmlContent("<b>"+f.selectedWhatsappAccounts.length+" selected</b> will be deleted.").ariaLabel("delete WhatsappAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedWhatsappAccounts.forEach(function(e){y(e)}),f.selectedWhatsappAccounts=[]})},f.deselectWhatsappAccounts=function(){f.selectedWhatsappAccounts=[]},f.selectAllWhatsappAccounts=function(){f.selectedWhatsappAccounts=f.whatsappAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.whatsappAccount&&(t=_.find(f.lists,{id:Number(f.whatsappAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.whatsappAccount&&(a=_.find(f.lists,{id:Number(f.whatsappAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){f.pauses=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){f.pauses=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.pauses,{id:e.resourceId})});f.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),f.pauses=n})}else f.pauses=[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.whatsappAccounts=e||{count:0,rows:[]}}function y(e){m.whatsappAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.whatsappAccounts.rows,{id:e.id}),f.whatsappAccounts.count-=1,f.whatsappAccounts.rows.length||f.getWhatsappAccounts(),p.success({title:_.startCase("WhatsappAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEwhatsappAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEwhatsappAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getWhatsappAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","whatsappAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.whatsapp").controller("WhatsappAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="WHATSAPP.EDIT_WHATSAPPQUEUE",g.whatsappQueue=angular.copy(l),g.whatsappQueues=r,g.newWhatsappQueue=!1,g.whatsappQueue||(g.whatsappQueue={strategy:"beepall",timeout:10},g.title="WHATSAPP.NEW_WHATSAPPQUEUE",g.newWhatsappQueue=!0),g.addNewWhatsappQueue=function(){g.errors=[],d.whatsappQueue.save(g.whatsappQueue).$promise.then(function(e){g.whatsappQueues.unshift(e.toJSON()),o.success({title:"WhatsappQueue properly created",msg:g.whatsappQueue.name?g.whatsappQueue.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveWhatsappQueue=function(){g.errors=[],d.whatsappQueue.update({id:g.whatsappQueue.id},g.whatsappQueue).$promise.then(function(e){var n=_.find(g.whatsappQueues,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"WhatsappQueue properly saved!",msg:g.whatsappQueue.name?g.whatsappQueue.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteWhatsappQueue=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The whatsappQueue will be deleted.").ariaLabel("Delete WhatsappQueue").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.whatsappQueue.delete({id:g.whatsappQueue.id}).$promise.then(function(){_.remove(g.whatsappQueues,{id:g.whatsappQueue.id}),o.success({title:"WhatsappQueue properly deleted!",msg:(g.whatsappQueue.name||"whatsappQueue")+" has been deleted!"}),v(g.whatsappQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","whatsappQueues","whatsappQueue","api","Auth","license","setting","crudPermissions"],angular.module("app.whatsapp").controller("CreateOrEditWhatsappQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.whatsappQueue.getAgents({id:c.whatsappQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserWhatsappQueue?"penalty "+e.UserWhatsappQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.whatsappQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.removeAgents({id:c.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.addAgents({id:c.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("WHATSAPP.ALL_AGENTS"),labelSelected:r.instant("WHATSAPP.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","whatsappQueue","whatsappQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.whatsapp").controller("WhatsappQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.whatsappQueue.getTeams({id:l.whatsappQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.whatsappQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("WHATSAPP.ALL_TEAMS"),labelSelected:t.instant("WHATSAPP.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.removeTeams({id:l.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.addTeams({id:l.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","whatsappQueue","$translate","Auth","crudPermissions"],angular.module("app.whatsapp").controller("WhatsappQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.whatsappQueue=c||e.params.whatsappQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"WhatsappQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:u.whatsappQueues?u.whatsappQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"WhatsappQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:u.whatsappQueues?u.whatsappQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoWhatsappQueues=function(){e.go("app.whatsapp.whatsappQueues",{},{reload:"app.whatsapp.whatsappQueues"})},u.saveWhatsappQueue=function(){r.whatsappQueue.update({id:u.whatsappQueue.id},u.whatsappQueue).$promise.then(function(){l.success({title:"WhatsappQueue updated!",msg:u.whatsappQueue.name?u.whatsappQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","whatsappQueue","userProfileSection"],angular.module("app.whatsapp").controller("WhatsappQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.whatsappQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="whatsappQueues",f.listOrder="",f.listOrderAsc=null,f.selectedWhatsappQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"whatsapp",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.whatsapp.whatsappQueues.edit",{id:e.id,whatsappQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"WhatsappQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:f.whatsappQueues?f.whatsappQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"WhatsappQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:f.whatsappQueues?f.whatsappQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("whatsappQueue")+"?").htmlContent("<b>"+(e.name||"whatsappQueue")+"</b> will be deleted.").ariaLabel("delete whatsappQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:2110}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.whatsapp.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.whatsapp.realtime.queues",{})}},f.success=E,f.getWhatsappQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.whatsappQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="WhatsappQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditWhatsappQueue=function(e,n){i.show({controller:"CreateOrEditWhatsappQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappQueue:n,whatsappQueues:f.whatsappQueues.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteWhatsappQueue=y,f.exportSelectedWhatsappQueues=function(){var e=angular.copy(f.selectedWhatsappQueues);return f.selectedWhatsappQueues=[],e},f.deleteSelectedWhatsappQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected whatsappQueues?").htmlContent("<b>"+f.selectedWhatsappQueues.length+" selected</b> will be deleted.").ariaLabel("delete WhatsappQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedWhatsappQueues.forEach(function(e){y(e)}),f.selectedWhatsappQueues=[]})},f.deselectWhatsappQueues=function(){f.selectedWhatsappQueues=[]},f.selectAllWhatsappQueues=function(){f.selectedWhatsappQueues=f.whatsappQueues.rows};var b=!0,A=1;function E(e){f.whatsappQueues=e||{count:0,rows:[]}}function y(e){m.whatsappQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.whatsappQueues.rows,{id:e.id}),f.whatsappQueues.count-=1,f.whatsappQueues.rows.length||f.getWhatsappQueues(),p.success({title:_.startCase("WhatsappQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEwhatsappQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEwhatsappQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getWhatsappQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","whatsappQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.whatsapp").controller("WhatsappQueuesController",e)}(),function(){"use strict";function e(n,t,e,a,o,i,s,r,l,d,c,m,u){var p=this;function g(e,n){return{id:e,title:n.name||"NONAME",state:"app.dashboards.custom",stateParams:n,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(e)&&!r.hasRole("admin")}}}function v(e,n){return{id:e,title:n.name||"NONAME",state:"app.plugins.plugin",stateParams:n,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(e)&&!r.hasRole("admin")}}}function h(e,n){var t={user:_.pick(r.getCurrentUser(),["id","name","fullname","email","role","internal","interface"])};n.agentUrl=Mustache.render(n.agentUrl,t),i.saveItem("apps.home.plugin_"+e,{id:e,title:n.name,translate:n.name,state:"plugin_"+n.id,stateParams:n,view:"plugin",icon:n.icon,weight:12,hidden:function(){return!r.hasPermission(e)}})}function f(e){return _.map(e.children,function(e){return e.id})}s.clear(),p.isAgent=function(){return r.getCurrentUser()&&r.hasRole("agent")},o.saveItem("apps",{title:"APPS",group:!0,weight:1,hidden:function(){return r.hasRole("agent")}}),d.version.get().$promise.then(function(e){p.version=e&&e.current?e.current:"UNKNOWN"}).catch(function(){p.version="UNKNOWN"}).finally(function(){o.saveItem("version",{title:"VERSION "+p.version,group:!0,weight:2,hidden:function(){return r.hasRole("agent")}})}),r.isLoggedIn()&&(null===m.userSettings&&m.getUserSettingForUser(),l.gray&&s.warning({msg:e.instant("DASHBOARDS.LICENSE_EXPIRE_REMAINING_DAYS"),showClose:!0,timeout:!1}),d.dashboard.get().$promise.then(function(e){for(var n=0,t=0;t<e.rows.length;t+=1)n=99999+e.rows[t].id,o.saveItem("apps.dashboards.custom_"+n,g(n,e.rows[t]))}),d.plugin.get({active:!0}).$promise.then(function(e){var n=0;if(e.count){var t=_.filter(e.rows,function(e){return"never"!=e.sidebar&&"agentOnly"!=e.sidebar});if(0<t.length){o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",permissions:{hidden:!0},weight:17,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}});for(var a=0;a<t.length;a+=1)n=88888+t[a].id,o.saveItem("apps.plugins.plugin_"+n,v(n,t[a]));o.sort()}var i=_.filter(e.rows,function(e){return"never"!=e.sidebar&&"adminOnly"!=e.sidebar});if(0<i.length)for(var s=0;s<i.length;s+=1)h(n=88888+i[s].id,i[s])}})),l.custom&&!c.defaultPageTitle&&c.pageTitle&&angular.element("#pageTitle").html(c.pageTitle),o.saveItem("apps.dashboards",{id:100,title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",icon:"icon-tile-four",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.dashboards.general",{id:101,title:"General",route:"",translate:"DASHBOARDS.GENERAL",state:"app.dashboards.general",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(101)&&!r.hasRole("admin")}}),o.saveItem("apps.staff",{id:200,title:"Staff",translate:"STAFF.STAFF",icon:"icon-account-multiple",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.staff.users",{id:201,title:"Users",route:"user",translate:"STAFF.USERS",state:"app.staff.users",permissions:{hidden:!0},weight:1,hidden:function(){return r.hasRole("agent")||r.hasRole("user")||!r.hasPermission(201)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.agents",{id:202,title:"Agents",route:"user",translate:"STAFF.AGENTS",state:"app.staff.agents",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(202)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.telephones",{id:203,title:"Telephones",route:"user",translate:"STAFF.TELEPHONES",state:"app.staff.telephones",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(203)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.teams",{id:204,title:"Teams",route:"team",translate:"STAFF.TEAMS",state:"app.staff.teams",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(204)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.userProfiles",{id:205,title:"UserProfiles",route:"userProfile",translate:"STAFF.USERPROFILES",state:"app.staff.userProfiles",permissions:{hidden:!0},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(205)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager",{id:300,title:"ContactManager",translate:"CONTACTMANAGER.CONTACTMANAGER",icon:"icon-account-circle",license:"cm",weight:4,hidden:function(){return!l.cm||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.lists",{id:301,title:"Lists",route:"cmList",translate:"CONTACTMANAGER.LISTS",state:"app.contactmanager.lists",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(301)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.companies",{id:302,title:"Companies",route:"cmCompany",translate:"CONTACTMANAGER.COMPANIES",state:"app.contactmanager.companies",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(302)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.globalCustomFields",{id:304,title:"GlobalCustomFields",route:"cmCustomField",translate:"CONTACTMANAGER.GLOBALCUSTOMFIELDS",state:"app.contactmanager.globalCustomFields",permissions:{association:!1},weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(304)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.contacts",{id:303,title:"Contacts",route:"",translate:"CONTACTMANAGER.CONTACTS",state:"app.contactmanager.contacts",permissions:{association:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(303)&&!r.hasRole("admin")}}),o.saveItem("apps.voice",{id:400,title:"Voice",translate:"VOICE.VOICE",icon:"icon-phone",license:"voice",weight:5,hidden:function(){return!l.voice||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voiceQueues",{id:401,title:"VoiceQueues",route:"voiceQueue",channel:"voice",translate:"VOICE.VOICEQUEUES",state:"app.voice.voiceQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(401)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.contexts",{id:405,title:"Contexts",route:"voiceContext",translate:"VOICE.CONTEXTS",state:"app.voice.contexts",weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(405)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voicemails",{id:406,title:"Voicemails",route:"voiceMail",translate:"VOICE.VOICEMAILS",state:"app.voice.voicemails",weight:6,hidden:function(){return r.hasRole("agent")||!r.hasPermission(406)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.musiconholds",{id:407,title:"MusicOnHolds",route:"voiceMusicOnHold",translate:"VOICE.MUSICONHOLDS",state:"app.voice.musiconholds",weight:7,hidden:function(){return r.hasRole("agent")||!r.hasPermission(407)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voiceRecordings",{id:408,title:"VoiceRecordings",route:"voiceRecording",translate:"VOICE.VOICERECORDINGS",state:"app.voice.voiceRecordings",permissions:{association:!1,loading:!0},weight:8,hidden:function(){return r.hasRole("agent")||!r.hasPermission(408)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.chanSpies",{id:409,title:"ChanSpies",route:"voiceChanSpy",translate:"VOICE.CHANSPIES",state:"app.voice.chanSpies",weight:9,hidden:function(){return r.hasRole("agent")||!r.hasPermission(409)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voicePrefixes",{id:410,title:"VoicePrefixes",route:"voicePrefix",translate:"VOICE.VOICEPREFIXES",state:"app.voice.voicePrefixes",weight:10,hidden:function(){return r.hasRole("agent")||!r.hasPermission(410)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.inboundRoutes",{id:402,title:"InboundRoutes",route:"voiceExtension",translate:"VOICE.INBOUNDROUTES",state:"app.voice.inboundRoutes",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(402)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.outboundRoutes",{id:403,title:"OutboundRoutes",route:"voiceExtension",translate:"VOICE.OUTBOUNDROUTES",state:"app.voice.outboundRoutes",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(403)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.internalRoutes",{id:404,title:"InternalRoutes",route:"voiceExtension",translate:"VOICE.INTERNALROUTES",state:"app.voice.internalRoutes",weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(404)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.realtime",{id:411,title:"Realtime",route:"",translate:"VOICE.REALTIME",state:"app.voice.realtime",permissions:{association:!1,crud:!1},weight:11,hidden:function(){return r.hasRole("agent")||!r.hasPermission(411)&&!r.hasRole("admin")}}),o.saveItem("apps.chat",{id:500,title:"Chat",translate:"CHAT.CHAT",icon:"icon-hangouts",license:"chat",weight:6,hidden:function(){return!l.chat||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.chat.chatQueues",{id:501,title:"ChatQueues",route:"chatQueue",channel:"chat",translate:"CHAT.CHATQUEUES",state:"app.chat.chatQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(501)&&!r.hasRole("admin")}}),o.saveItem("apps.chat.chatWebsites",{id:502,title:"ChatWebsites",route:"chatWebsite",channel:"chat",translate:"CHAT.CHATWEBSITES",state:"app.chat.chatWebsites",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(502)&&!r.hasRole("admin")}}),o.saveItem("apps.chat.realtime",{id:510,title:"Realtime",route:"",translate:"CHAT.REALTIME",state:"app.chat.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(510)&&!r.hasRole("admin")}}),o.saveItem("apps.mail",{id:600,title:"Mail",translate:"MAIL.MAIL",icon:"icon-email",license:"mail",weight:7,hidden:function(){return!l.mail||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.mail.mailQueues",{id:601,title:"MailQueues",route:"mailQueue",channel:"mail",translate:"MAIL.MAILQUEUES",state:"app.mail.mailQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(601)&&!r.hasRole("admin")}}),o.saveItem("apps.mail.mailAccounts",{id:602,title:"MailAccounts",route:"mailAccount",channel:"mail",translate:"MAIL.MAILACCOUNTS",state:"app.mail.mailAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(602)&&!r.hasRole("admin")}}),o.saveItem("apps.mail.mailSubtatuses",{id:603,title:"MailSubstatuses",route:"mailSubstatus",channel:"mail",translate:"MAIL.MAILSUBSTATUSES",state:"app.mail.mailSubtatuses",permissions:{association:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(603)&&!r.hasRole("admin")}}),o.saveItem("apps.mail.realtime",{id:610,title:"Realtime",route:"",translate:"MAIL.REALTIME",state:"app.mail.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(610)&&!r.hasRole("admin")}}),o.saveItem("apps.sms",{id:700,title:"Sms",translate:"SMS.SMS",icon:"icon-message-text",license:"messaging",weight:8,hidden:function(){return!l.messaging||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.sms.smsQueues",{id:701,title:"SmsQueues",route:"smsQueue",channel:"sms",translate:"SMS.SMSQUEUES",state:"app.sms.smsQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(701)&&!r.hasRole("admin")}}),o.saveItem("apps.sms.smsAccounts",{id:702,title:"SmsAccounts",route:"smsAccount",channel:"sms",translate:"SMS.SMSACCOUNTS",state:"app.sms.smsAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(702)&&!r.hasRole("admin")}}),o.saveItem("apps.sms.realtime",{id:710,title:"Realtime",route:"",translate:"SMS.REALTIME",state:"app.sms.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(710)&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel",{id:800,title:"Openchannel",translate:"OPENCHANNEL.OPENCHANNEL",icon:"icon-google-earth",license:"openchannel",weight:9,hidden:function(){return!l.openchannel||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel.openchannelQueues",{id:801,title:"OpenchannelQueues",route:"openchannelQueue",channel:"openChannel",translate:"OPENCHANNEL.OPENCHANNELQUEUES",state:"app.openchannel.openchannelQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(801)&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel.openchannelAccounts",{id:802,title:"OpenchannelAccounts",route:"openchannelAccount",channel:"openChannel",translate:"OPENCHANNEL.OPENCHANNELACCOUNTS",state:"app.openchannel.openchannelAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(802)&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel.realtime",{id:810,title:"Realtime",route:"",translate:"OPENCHANNEL.REALTIME",state:"app.openchannel.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(810)&&!r.hasRole("admin")}}),o.saveItem("apps.fax",{id:900,title:"Fax",translate:"FAX.FAX",icon:"icon-deskphone",license:"fax",weight:10,hidden:function(){return!l.fax||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.fax.faxQueues",{id:901,title:"FaxQueues",route:"faxQueue",channel:"fax",translate:"FAX.FAXQUEUES",state:"app.fax.faxQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(901)&&!r.hasRole("admin")}}),o.saveItem("apps.fax.faxAccounts",{id:902,title:"FaxAccounts",route:"faxAccount",channel:"fax",translate:"FAX.FAXACCOUNTS",state:"app.fax.faxAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(902)&&!r.hasRole("admin")}}),o.saveItem("apps.fax.realtime",{id:910,title:"Realtime",route:"",translate:"FAX.REALTIME",state:"app.fax.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(910)&&!r.hasRole("admin")}}),o.saveItem("apps.tools",{id:1e3,title:"Tools",translate:"TOOLS.TOOLS",icon:"icon-auto-fix",weight:15,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.tools.cannedAnswers",{id:1001,title:"CannedAnswers",route:"cannedAnswer",translate:"TOOLS.CANNEDANSWERS",state:"app.tools.cannedAnswers",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1001)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.customDashboards",{id:1003,title:"CustomDashboards",route:"dashboard",translate:"TOOLS.CUSTOMDASHBOARDS",state:"app.tools.customDashboards",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1003)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.intervals",{id:1004,title:"Intervals",route:"interval",translate:"TOOLS.INTERVALS",state:"app.tools.intervals",weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1004)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.pauses",{id:1005,title:"Pauses",route:"pause",translate:"TOOLS.PAUSES",state:"app.tools.pauses",weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1005)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.schedules",{id:1006,title:"Scheduler",route:"schedule",translate:"TOOLS.SCHEDULER",state:"app.tools.schedules",weight:6,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1006)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.sounds",{id:1007,title:"Sounds",route:"sound",translate:"TOOLS.SOUNDS",state:"app.tools.sounds",weight:7,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1007)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.tags",{id:1008,title:"Tags",route:"tag",translate:"TOOLS.TAGS",state:"app.tools.tags",weight:8,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1008)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.templates",{id:1009,title:"Templates",route:"template",translate:"TOOLS.TEMPLATES",state:"app.tools.templates",weight:9,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1009)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.trunks",{id:1011,title:"Trunks",route:"trunk",translate:"TOOLS.TRUNKS",state:"app.tools.trunks",weight:11,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1011)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.variables",{id:1012,title:"Variables",route:"variable",translate:"TOOLS.VARIABLES",state:"app.tools.variables",weight:12,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1012)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.contact_item_types",{id:1013,title:"ContactItemType",route:"contactItemType",translate:"TOOLS.CONTACTITEMTYPE",state:"app.tools.contact_item_types",weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1013)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.dispositions",{id:1002,title:"Dispositions",route:"disposition",translate:"TOOLS.DISPOSITIONS",state:"app.tools.dispositions",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1002)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.triggers",{id:1010,title:"Triggers",route:"trigger",translate:"TOOLS.TRIGGERS",state:"app.tools.triggers",weight:10,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1010)&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare",{id:1100,title:"CallySquare",translate:"CALLYSQUARE.CALLYSQUARE",icon:"icon-sitemap",license:"voice",weight:13,hidden:function(){return!l.voice||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare.odbcs",{id:1101,title:"ODBC",route:"squareOdbc",translate:"CALLYSQUARE.ODBC",state:"app.callysquare.odbcs",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1101)&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare.squareRecordings",{id:1102,title:"SquareRecordings",route:"squareRecording",translate:"CALLYSQUARE.SQUARERECORDINGS",state:"app.callysquare.squareRecordings",permissions:{association:!1,loading:!0},weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1102)&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare.projects",{id:1103,title:"Projects",route:"squareProject",translate:"CALLYSQUARE.PROJECTS",state:"app.callysquare.projects",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1103)&&!r.hasRole("admin")}}),o.saveItem("apps.analytics",{id:1200,title:"Analytics",translate:"ANALYTICS.ANALYTICS",icon:"icon-chart-line",weight:16,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.analytics.metrics",{id:1201,title:"Metrics",route:"analyticMetric",translate:"ANALYTICS.METRICS",state:"app.analytics.metrics",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1201)&&!r.hasRole("admin")}}),o.saveItem("apps.analytics.extractedReports",{id:1202,title:"ExtractedReports",route:"analyticExtractedReport",translate:"ANALYTICS.EXTRACTEDREPORTS",state:"app.analytics.extractedReports",permissions:{association:!1,loading:!0},weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1202)&&!r.hasRole("admin")}}),o.saveItem("apps.analytics.reports",{id:1203,title:"Reports",route:"",translate:"ANALYTICS.REPORTS",state:"app.analytics.reports",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1203)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations",{id:1300,title:"Integrations",translate:"INTEGRATIONS.INTEGRATIONS",icon:"icon-heart",weight:17,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.zendeskAccounts",{id:1301,title:"ZendeskAccounts",route:"intZendeskAccount",translate:"INTEGRATIONS.ZENDESKACCOUNTS",state:"app.integrations.zendeskAccounts",permissions:{association:!1,loading:!0},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1301)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.salesforceAccounts",{id:1302,title:"SalesforceAccounts",route:"intSalesforceAccount",translate:"INTEGRATIONS.SALESFORCEACCOUNTS",state:"app.integrations.salesforceAccounts",permissions:{association:!1,loading:!0},weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1302)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.freshdeskAccounts",{id:1303,title:"FreshdeskAccounts",route:"intFreshdeskAccount",translate:"INTEGRATIONS.FRESHDESKACCOUNTS",state:"app.integrations.freshdeskAccounts",permissions:{association:!1,loading:!0},weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1303)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.sugarcrmAccounts",{id:1305,title:"SugarcrmAccounts",route:"intSugarcrmAccount",translate:"INTEGRATIONS.SUGARCRMACCOUNTS",state:"app.integrations.sugarcrmAccounts",permissions:{association:!1,loading:!0},weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1305)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.deskAccounts",{id:1306,title:"DeskAccounts",route:"intDeskAccount",translate:"INTEGRATIONS.DESKACCOUNTS",state:"app.integrations.deskAccounts",permissions:{association:!1,loading:!0},weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1306)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.zohoAccounts",{id:1307,title:"ZohoAccounts",route:"intZohoAccount",translate:"INTEGRATIONS.ZOHOACCOUNTS",state:"app.integrations.zohoAccounts",permissions:{association:!1,loading:!0},weight:6,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1307)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.vtigerAccounts",{id:1308,title:"VtigerAccounts",route:"intVtigerAccount",translate:"INTEGRATIONS.VTIGERACCOUNTS",state:"app.integrations.vtigerAccounts",permissions:{association:!1,loading:!0},weight:7,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1308)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.dynamics365Accounts",{id:1309,title:"Dynamics365Accounts",route:"intDynamics365Account",translate:"INTEGRATIONS.DYNAMICS365ACCOUNTS",state:"app.integrations.dynamics365Accounts",permissions:{association:!1,loading:!0},weight:8,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1309)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.servicenowAccounts",{id:1310,title:"ServicenowAccounts",route:"intServicenowAccount",translate:"INTEGRATIONS.SERVICENOWACCOUNTS",state:"app.integrations.servicenowAccounts",permissions:{association:!1,loading:!0},weight:9,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1310)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.freshsalesAccounts",{id:1304,title:"FreshsalesAccounts",route:"intFreshsalesAccount",translate:"INTEGRATIONS.FRESHSALESACCOUNTS",state:"app.integrations.freshsalesAccounts",permissions:{association:!1,loading:!0},weight:10,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1304)&&!r.hasRole("admin")}}),o.saveItem("apps.settings",{id:1400,title:"Settings",translate:"SETTINGS.SETTINGS",icon:"icon-cog",permissions:{hidden:!0},weight:20,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")||r.hasRole("admin")&&!r.getCurrentUser().settingsEnabled}}),o.saveItem("apps.settings.generals",{id:1401,title:"General",route:"setting",translate:"SETTINGS.GENERAL",state:"app.settings.generals",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.smtps",{id:1402,title:"Smtp",route:"mailAccount",translate:"SETTINGS.SMTP",state:"app.settings.smtps",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.networks",{id:1403,title:"Networks",route:"network",translate:"SETTINGS.NETWORKS",state:"app.settings.networks",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.customizations",{id:1407,title:"Customizations",route:"setting",translate:"SETTINGS.CUSTOMIZATIONS",state:"app.settings.customizations",weight:1,hidden:function(){return!l.custom||r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.cloudProviders",{id:1408,title:"AiTools",route:"cloudProvider",translate:"SETTINGS.CLOUD_PROVIDERS",state:"app.settings.cloudProviders",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.updates",{id:1404,title:"Updates",route:"",translate:"SETTINGS.UPDATES",state:"app.settings.updates",weight:1,hidden:function(){return!l.update||r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.license",{id:1405,title:"License",route:"",translate:"SETTINGS.LICENSE",state:"app.settings.license",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.system",{id:1406,title:"System",route:"",translate:"SETTINGS.SYSTEM",state:"app.settings.system",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer",{id:1500,title:"MotionDialer",translate:"MOTIONDIALER.MOTIONDIALER",icon:"icon-fire",license:"dialer",weight:5,hidden:function(){return!l.dialer||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer.queueCampaigns",{id:1501,title:"QueueCampaigns",route:"voiceQueue",channel:"bull",translate:"MOTIONDIALER.QUEUECAMPAIGNS",state:"app.motiondialer.queueCampaigns",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1501)&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer.ivrCampaigns",{id:1502,title:"IvrCampaigns",route:"campaign",translate:"MOTIONDIALER.IVRCAMPAIGNS",state:"app.motiondialer.ivrCampaigns",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1502)&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer.realtime",{id:1510,title:"Realtime",route:"",translate:"MOTIONDIALER.REALTIME",state:"app.motiondialer.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1510)&&!r.hasRole("admin")}}),o.saveItem("apps.help",{id:1600,title:"Help",translate:"HELP.HELP",icon:"icon-help",permissions:{association:!1},weight:21,hidden:function(){return!c.viewHelpSection||r.hasRole("agent")||!r.hasPermission(1600)&&!r.hasRole("admin")}}),o.saveItem("apps.help.about",{id:1601,title:"About",route:"",translate:"HELP.ABOUT",state:"app.help.about",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1600)&&!r.hasRole("admin")}}),o.saveItem("apps.jscripty",{id:1700,title:"jscripty",translate:"JSCRIPTY.JSCRIPTY",icon:"icon-script",license:"jscripty",weight:14,hidden:function(){return!l.jscripty||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.jscripty.projects",{id:1701,title:"Projects",route:"jscriptyProject",translate:"JSCRIPTY.PROJECTS",state:"app.jscripty.projects",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1701)&&!r.hasRole("admin")}}),o.saveItem("apps.marketplace",{id:1800,title:"Marketplace",translate:"MARKETPLACE.MARKETPLACE",icon:"icon-cart",weight:18,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.marketplace.plugins",{id:1801,title:"Plugins",route:"plugin",translate:"MARKETPLACE.PLUGINS",state:"app.marketplace.plugins",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1801)&&!r.hasRole("admin")}}),o.saveItem("apps.video",{id:2e3,title:"Video",translate:"VIDEO.VIDEO",icon:"icon-video",license:"screenrecording",weight:12,hidden:function(){return!l.screenrecording||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.video.screenRecordings",{id:2001,title:"ScreenRecordings",route:"screenRecording",translate:"VIDEO.SCREENRECORDINGS",state:"app.video.screenRecordings",permissions:{association:!1,loading:!0},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2001)&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp",{id:2100,title:"Whatsapp",translate:"WHATSAPP.WHATSAPP",icon:"icon-whatsapp",license:"whatsapp",weight:11,hidden:function(){return!l.whatsapp||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp.whatsappQueues",{id:2101,title:"WhatsappQueues",route:"whatsappQueue",channel:"whatsapp",translate:"WHATSAPP.WHATSAPPQUEUES",state:"app.whatsapp.whatsappQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2101)&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp.whatsappAccounts",{id:2102,title:"WhatsappAccounts",route:"whatsappAccount",channel:"whatsapp",translate:"WHATSAPP.WHATSAPPACCOUNTS",state:"app.whatsapp.whatsappAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2102)&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp.realtime",{id:2110,title:"Realtime",route:"",translate:"WHATSAPP.REALTIME",state:"app.whatsapp.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2110)&&!r.hasRole("admin")}}),o.sort(),i.saveItem("apps",{title:"APPS",group:!0,weight:1}),i.saveItem("apps.home",{id:100,title:"Home",translate:"DASHBOARDS.HOME",icon:"icon-home",weight:1}),i.saveItem("apps.home.dashboard",{id:101,title:"Dashboard",translate:"DASHBOARDS.DASHBOARD",state:"dashboard",view:"dashboard",icon:"icon-tile-four",iconClass:"cyan-500-fg",weight:1,hidden:function(){return!r.hasPermission(101)}}),i.saveItem("apps.home.agentPresence",{id:115,title:"AgentPresence",translate:"DASHBOARDS.AGENT_PRESENCE",state:"agentPresence",view:"agentPresence",icon:"icon-webcam",iconClass:"xenialab-violet-light-fg",weight:2,hidden:function(){return!r.hasPermission(115)}}),i.saveItem("apps.home.contacts",{id:102,title:"Contacts",translate:"DASHBOARDS.CONTACTS",state:"contacts",view:"contacts",icon:"icon-account-circle",iconClass:"red-fg",weight:3,hidden:function(){return!l.cm||!r.hasPermission(102)}}),i.saveItem("apps.home.mycontacts",{id:103,title:"Contacts",translate:"DASHBOARDS.MYCONTACTS",state:"mycontacts",view:"mycontacts",icon:"icon-account-multiple",iconClass:"red-fg",weight:4,hidden:function(){return!l.cm||!r.hasPermission(103)}}),i.saveItem("apps.home.scheduled",{id:113,title:"Scheduled Calls",translate:"DASHBOARDS.SCHEDULED_CALLS",state:"scheduled",view:"scheduled",icon:"icon-calendar-clock",iconClass:"blue-grey-fg",weight:5,hidden:function(){return!l.dialer||!r.hasPermission(113)}}),i.saveItem("apps.home.voice",{id:110,title:"Voice",translate:"DASHBOARDS.VOICE",state:"voice",view:"voice",icon:"icon-phone",iconClass:"blue-A700-fg",weight:6,hidden:function(){return!l.voice||!r.hasPermission(110)}}),i.saveItem("apps.home.abandoned",{id:111,title:"Abandoned",translate:"DASHBOARDS.ABANDONED",state:"abandoned",view:"abandoned",icon:"icon-phone-missed",iconClass:"blue-fg",weight:7,hidden:function(){return!l.voice||!r.hasPermission(111)}}),i.saveItem("apps.home.recordings",{id:104,title:"Recordings",translate:"DASHBOARDS.RECORDINGS",state:"recordings",view:"recordings",icon:"icon-audiobook",iconClass:"indigo-A100-fg",weight:8,hidden:function(){return!l.voice||!r.hasPermission(104)}}),i.saveItem("apps.home.chat",{id:105,title:"Chat",translate:"DASHBOARDS.CHAT",state:"chat",view:"chat",icon:"icon-hangouts",iconClass:"green-A700-fg",weight:9,hidden:function(){return!l.chat||!r.hasPermission(105)}}),i.saveItem("apps.home.mail",{id:106,title:"Mail",translate:"DASHBOARDS.MAIL",state:"mail",view:"mail",icon:"icon-email",iconClass:"teal-fg",weight:10,hidden:function(){return!l.mail||!r.hasPermission(106)}}),i.saveItem("apps.home.sms",{id:107,title:"Sms",translate:"DASHBOARDS.SMS",state:"sms",view:"sms",icon:"icon-message-text",iconClass:"orange-fg",weight:11,hidden:function(){return!l.messaging||!r.hasPermission(107)}}),i.saveItem("apps.home.openchannel",{id:108,title:"Openchannel",translate:"DASHBOARDS.OPENCHANNEL",state:"openchannel",view:"openchannel",icon:"icon-google-earth",iconClass:"amber-fg",weight:12,hidden:function(){return!l.openchannel||!r.hasPermission(108)}}),i.saveItem("apps.home.fax",{id:109,title:"Fax",translate:"DASHBOARDS.FAX",state:"fax",view:"fax",icon:"icon-deskphone",iconClass:"blue-grey-A200-fg",weight:13,hidden:function(){return!l.fax||!r.hasPermission(109)}}),i.saveItem("apps.home.whatsapp",{id:114,title:"Whatsapp",translate:"DASHBOARDS.WHATSAPP",state:"whatsapp",view:"whatsapp",icon:"icon-whatsapp",iconClass:"lime-A700-fg",weight:14,hidden:function(){return!l.whatsapp||!r.hasPermission(114)}}),n.$on("$viewContentAnimationEnded",function(e){e.targetScope.$id===n.$id&&t.$broadcast("msSplashScreen::remove")}),n.$on("socket:connect",function(){t.toastySocketLost&&(s.clear(t.toastySocketLost),t.toastySocketLost=void 0)}),n.$on("socket:disconnect",function(){t.toastySocketLost||s.warning({title:e.instant("TOOLBAR.WARNING"),msg:e.instant("DASHBOARDS.LOST_CONNECTION"),timeout:!1,onAdd:function(){t.toastySocketLost=this.id}})}),n.$on("client-side-logging:enabled",function(){"admin"!==r.getCurrentUser().role&&s.info({title:e.instant("STAFF.CLIENT_LOGS"),msg:e.instant("STAFF.CLIENT_LOGS_ENABLED_MSG")})}),n.$on("client-side-logging:disabled",function(){"admin"!==r.getCurrentUser().role&&s.info({title:e.instant("STAFF.CLIENT_LOGS"),msg:e.instant("STAFF.CLIENT_LOGS_DISABLED_MSG")})}),a.onbeforeunload=function(){r.isTelephone()||u.flush()}}e.$inject=["$scope","$rootScope","$translate","$window","msNavigationService","msNavigationAgentService","toasty","Auth","license","api","setting","UserSettingService","ClientSideLoggingService"],angular.module("motion").controller("MainController",e)}(),function(){"use strict";function e(e,n,t,a,o,r){var i=this;function s(e){if(e&&e.id){var n=99999+e.id;o.saveItem("apps.dashboards.custom_"+n,{id:n,title:e.name||"NONAME",state:"app.dashboards.custom",stateParams:e,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(n)&&!r.hasRole("admin")}})}}function l(e){if(e&&e.id&&"never"!=e.sidebar)if(e.active){if("always"==e.sidebar||"adminOnly"==e.sidebar){o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",weight:17,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1900)&&!r.hasRole("admin")}});var n=88888+e.id;o.saveItem("apps.plugins.plugin_"+n,{id:n,title:e.name||"NONAME",state:"app.plugins.plugin",stateParams:e,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(n)&&!r.hasRole("admin")}}),o.sort()}}else{n=88888+e.id;t=1900,a=n,i=o.getNavigation(),(s=_.find(i[0].children,{id:t}))&&_.some(s.children,{id:a})&&("always"==e.sidebar||"adminOnly"==e.sidebar)&&(o.deleteItem("apps.plugins.plugin_"+n),d(1900)||o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",weight:17,hidden:function(){return!0}}))}var t,a,i,s}function d(e){var n=o.getNavigation(),t=_.find(n[0].children,{id:e});return!!(t&&0<t.children.length)}i.bodyEl=angular.element("body"),i.setting=t,i.$onInit=function(){i.folded="true"===n.get("motion.folded")||!1},i.toggleMsNavigationFolded=function(){i.folded=!i.folded,n.put("motion.folded",i.folded)},i.getLogo=function(){return i.setting.defaultHeaderWhiteLabel?"xCALLY Motion":i.setting.headerWhiteLabel},a.on("dashboard:save",s),a.on("dashboard:update",s),a.on("dashboard:remove",function(e){if(e&&e.id){var n=99999+e.id;o.deleteItem("apps.dashboards.custom_"+n)}}),a.on("plugin:save",l),a.on("plugin:update",l),a.on("plugin:remove",function(e){if(e&&e.id&&"never"!=e.sidebar){var n=88888+e.id;"always"!=e.sidebar&&"adminOnly"!=e.sidebar||(o.deleteItem("apps.plugins.plugin_"+n),d(1900)||o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",weight:17,hidden:function(){return!0}}))}}),e.$on("$stateChangeSuccess",function(){i.bodyEl.removeClass("ms-navigation-horizontal-mobile-menu-active")})}e.$inject=["$scope","$cookies","setting","socket","msNavigationService","Auth"],angular.module("app.navigation").controller("NavigationController",e)}(),function(){"use strict";function e(e,a,i,n,t,s,o,r){var l=this;function d(t){o.isSupported()?o.requestPermission().then(function(){var e,n;n={autoClose:!0,duration:10,showOnPageHidden:!0,icon:"api/users/"+(e=t).FromId+"/avatar",body:e.body||"",focusOnclick:!0,closeOnClick:!0},o.show(a.instant("QUICKPANEL.NEW_INTERNAL_MESSAGE"),n)},function(e){console.error("Please enable browser notifications!",e)}):console.error("Browser notifications are not supported by the browser. Normal notifications will be used.")}l.date=moment().format(),l.currentUser=n.getCurrentUser(),l.license=r,l.unreadTotalMessages=0,l.unreadTotalGroupMessages=0,l.userIsNotPhonebar=function(){return"admin"===l.currentUser.role||"user"===l.currentUser.role||"agent"===l.currentUser.role&&0!==l.currentUser.showWebBar},l.onMessageSave=function(e){e.ToId===l.currentUser.id&&e.FromId!==l.currentUser.id&&!e.read&&e.ChatGroupId&&(l.unreadTotalGroupMessages++,d(e));e.ToId!==l.currentUser.id||e.ChatGroupId||(l.unreadTotalMessages+=1,d(e))},l.onMessageUpdate=function(e){e.ToId===l.currentUser.id&&e.read&&0<l.unreadTotalMessages&&!e.ChatGroupId&&(l.unreadTotalMessages-=1);e.ToId==l.currentUser.id&&e.FromId!==l.currentUser.id&&e.ChatGroupId&&e.read&&0<l.unreadTotalGroupMessages&&l.unreadTotalGroupMessages--},t.on("chatInternalMessage:save",l.onMessageSave),t.on("chatInternalMessage:update",l.onMessageUpdate),s.chatInternalMessage.get({fields:"FromId",ToId:l.currentUser.id,read:!1,nolimit:!0,ChatGroupId:"null"}).$promise.then(function(e){return e&&e.count&&(l.unreadTotalMessages=e.count),s.user.getGroups({id:l.currentUser.id}).$promise}).then(function(e){for(var n=[],t=e.rows,a=0;a<t.length;a++)n.push(s.chatGroup.getUnread({id:t[a].id}).$promise);return i.all(n)}).then(function(e){for(var n=0;n<e.length;n++)l.unreadTotalGroupMessages+=e[n].count}).catch(function(e){console.error(e)}),e.$on("$destroy",function(){t.removeAllListeners("chatInternalMessage:save"),t.removeAllListeners("chatInternalMessage:update")})}e.$inject=["$scope","$translate","$q","Auth","socket","api","desktopNotification","license"],angular.module("app.quick-panel").controller("QuickPanelController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;function p(e){var n=angular.element("#chat-dialog");a(function(){n.animate({scrollTop:n[0].scrollHeight},e)},0)}function g(e){return _.isNil(e)?"":e.replace(/[^\w.+#*\-]+/g,"")}function v(e){return m.get(e).success(function(){n.success({title:"Successful call",msg:"Call properly handled!"})}).error(function(e){n.error({title:"PhoneBar API Error",msg:d.instant("CONTACTMANAGER.ERRORS.PHONEBAR_API")})})}u.currentUser=i.getCurrentUser(),u.user=void 0,u.users={count:0,rows:[]},u.standardDate=moment(0).format("YYYY-MM-DD HH:mm:ss"),u.unreadMessage={},u.replyMessage="",u.disabled=!1,u.init=function(e){u.license=e},u.toggleChat=function(e){if(e){if(!e.allowmessenger&&"agent"===e.role)return n.warning({title:d.instant("QUICKPANEL.WARNING"),msg:d.instant("QUICKPANEL.MESSENGER_DISABLED")}),void(u.user=void 0);u.user=e,u.replyMessage="",t.chatInternalMessage.get({sort:"createdAt",FromId:u.currentUser.id+","+e.id,ToId:u.currentUser.id+","+e.id,ChatGroupId:"null"}).$promise.then(function(e){if(e&&e.rows){u.user.messages=e;for(var n=0;n<u.user.messages.rows.length;n+=1)!1===u.user.messages.rows[n].read&&u.user.messages.rows[n].ToId===u.currentUser.id&&t.chatInternalMessage.update({id:u.user.messages.rows[n].id,read:!0})}}).finally(function(){p(0)})}else u.user=void 0},u.reply=function(){u.disabled=!0;Date.now();if(""===u.replyMessage)return void(u.disabled=!1);var e={FromId:u.currentUser.id,ToId:u.user.id,body:u.replyMessage,read:!1};u.replyMessage="",t.chatInternalMessage.save(e).$promise.then(function(e){u.user.messages.rows.push(e),u.user.lastMessageAt=e.createdAt,u.user.lastMessage=e,p(400)}).catch(function(e){}).finally(function(){u.disabled=!1})},u.onMessageSave=function(e){if(e.ToId===u.currentUser.id&&!e.ChatGroupId){u.user&&u.user.id===e.FromId?(u.user.messages.rows.push(e),p(0),t.chatInternalMessage.update({id:e.id,read:!0})):u.unreadMessage[e.FromId]=u.unreadMessage[e.FromId]?u.unreadMessage[e.FromId]+1:1;var n=_.find(u.users.rows,{id:e.FromId});n&&(n.lastMessageAt=e.createdAt,n.lastMessage=e)}},u.onMessageUpdate=function(e){if((e.FromId===u.currentUser.id||e.ToId===u.currentUser.id)&&!e.ChatGroupId){if(u.user){var n=_.find(u.user.messages.rows,{id:e.id});n&&_.merge(n,e)}var t=_.find(u.users.rows,{id:u.currentUser.id===e.FromId?e.ToId:e.FromId});t&&t.lastMessage&&_.merge(t.lastMessage,e),e.ToId===u.currentUser.id&&e.read&&0<u.unreadMessage[e.FromId]&&(u.unreadMessage[e.FromId]-=1)}},u.onUserUpdate=function(e){var n=_.find(u.users.rows,{id:e.id});n&&(_.isNil(e.online)||n.online===e.online||(n.online=e.online),_.isNil(e.allowmessenger)||n.allowmessenger===e.allowmessenger||(n.allowmessenger=e.allowmessenger))},u.webcall=function(e){c.$broadcast("webrtc::call",{target:g(e)})},u.call=function(e){return v("http://127.0.0.1:"+(u.user.phoneBarRemoteControlPort||"9888")+"/api/originate/"+g(e))},u.transfer=function(e){return v("http://127.0.0.1:"+(u.user.phoneBarRemoteControlPort||"9888")+"/api/transfer?number="+g(e))},s.on("chatInternalMessage:save",u.onMessageSave),s.on("chatInternalMessage:update",u.onMessageUpdate),s.on("user:update",u.onUserUpdate),o("quick-panel").onClose(function(){u.user=void 0}),t.chatInternalMessage.get({fields:"FromId",ToId:u.currentUser.id,read:!1,nolimit:!0,ChatGroupId:"null"}).$promise.then(function(e){u.unreadMessage=_.countBy(e.rows,"FromId")}).catch(function(e){}),t.chatInternalMessage.getUsers().$promise.then(function(e){u.users=e}).catch(function(e){console.error(e)}),e.$on("$destroy",function(){s.removeAllListeners("chatInternalMessage:save"),s.removeAllListeners("chatInternalMessage:update"),s.removeAllListeners("user:update")})}e.$inject=["$scope","toasty","api","$timeout","Auth","socket","$mdSidenav","$q","$interval","$translate","$rootScope","$http"],angular.module("app.quick-panel").controller("ChatInternalController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(e){a.hide(e)}d.errors=[],d.title="QUICKPANEL.EDIT_CHATGROUP",d.group=angular.copy(r),d.currentUser=o.getCurrentUser(),d.members=l,d.newChatGroup=!0,d.group||(d.group={write:!0,members:[]},d.title="QUICKPANEL.NEW_CHATGROUP"),d.saveChatGroup=function(){var t;return d.errors=[],s.chatGroup.save({name:d.group.name,write:d.group.write}).$promise.then(function(e){var n=_.map(d.group.members,"id");return n.unshift(d.currentUser.id),t=e,s.chatGroup.addMembers({id:t.id,ids:n}).$promise}).then(function(){i.success({title:"Group properly saved!",msg:t.name+" has been saved!"}),c(t)}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.closeDialog=c,d.querySearch=function(e){return e?d.members.rows.filter((n=e,t=angular.lowercase(n),function(e){var n=e.name.toLowerCase();return-1!=n.indexOf(t)})):[];var n,t}}e.$inject=["$scope","$state","$location","$mdDialog","toasty","api","Auth","group","members"],angular.module("app.quick-panel").controller("CreateOrEditChatGroupDialogController",e)}(),function(){"use strict";function e(e,t,a,s,n,o,i,r,l,d){var c=this;function m(){delete c.group}function u(e){var n=angular.element("#chat-group-dialog");a(function(){n.animate({scrollTop:n[0].scrollHeight},e)},0)}c.currentUser=i.getCurrentUser(),c.unreadGroupMessages={},c.groups={},c.participants,c.group,c.init=function(e){return c.license=e,r.user.getGroups({id:c.currentUser.id}).$promise.then(function(e){for(var n=0,t=[];n<e.rows.length;n++)e.rows[n].unreadGroupMessages=0,c.groups[e.rows[n].id]=e.rows[n],t.push(r.chatGroup.getUnread({id:e.rows[n].id}).$promise);return o.all(t)}).then(function(e){for(var n=0;n<e.length;n++)c.groups[e[n].id].unreadGroupMessages+=e[n].count}).catch(function(e){console.error(e)})},c.back=m,c.addGroup=function(e,n){s.show({controller:"CreateOrEditChatGroupDialogController",controllerAs:"vm",templateUrl:"app/quick-panel/tabs/groups/create/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{group:e,me:c.currentUser,license:null,setting:null},resolve:{members:function(){return i.hasRole("admin")?r.user.get({role:"agent"}).$promise:r.userProfile.getResources({id:i.getCurrentUser().userProfileId,section:"Agents",role:"agent"}).$promise}}}).then(function(e){e&&(c.groups[e.id]=e)}).catch(function(e){e&&console.error(e.message)})},c.deleteGroup=function(e,n){var t=s.confirm().title("Are you sure want to delete the selected group?").htmlContent("Group <b>"+e.name+"</b> will be deleted.").ariaLabel("delete Group").targetEvent(n).ok("OK").cancel("CANCEL");s.show(t).then(function(){return r.chatGroup.delete({id:e.id}).$promise}).then(function(){delete c.groups[e.id],d.success({title:"Group properly deleted!",msg:e.name+" has been deleted!"})}).catch(function(e){e&&d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatGroup.delete",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.groupsToArray=function(){return _.values(c.groups)},c.showMessageInfo=function(e,i){s.show({controller:"ShowMessageInfoDialogController",controllerAs:"vm",templateUrl:"app/quick-panel/tabs/groups/info/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{message:i},resolve:{data:function(){var a={messages:[]};return r.chatInternalMessage.get({ChatInternalMessageId:i.id}).$promise.then(function(e){var n=[];a.messages=e.rows,a.messages.unshift(i);for(var t=0;t<a.messages.length;t++)n.push(r.user.get({id:a.messages[t].ToId,fields:"id,name,fullname,userpic"}).$promise);return o.all(n)}).then(function(e){return a.users=e,a}).catch(function(e){e&&console.error(e)})}}}).then(function(){}).catch(function(e){e&&console.error(e.message)})},c.toggleChat=function(n){c.group={id:n.id,write:n.write,messages:{}},r.chatGroup.getMembers({id:n.id,fields:"id,name,fullname"}).$promise.then(function(e){return c.group.membersByKeys=_.keyBy(e.rows,"id"),c.group.members=_.differenceBy(e.rows,[{id:c.currentUser.id}],"id"),c.participants=_.map(c.group.members,"fullname").join(", "),r.chatGroup.getMessages({id:n.id,nolimit:!0}).$promise}).then(function(e){for(var n,t=0,a=[];t<e.count;t++)e.rows[t].ToId===c.currentUser.id&&(n=e.rows[t],c.group.messages[n.id]=n,e.rows[t].ToId!=c.currentUser.id||e.rows[t].FromId===c.currentUser.id||n.read||a.push(r.chatInternalMessage.update({id:n.id,read:!0})));return o.all(a)}).then(function(){u(400)}).catch(function(e){console.error(e.message)})},c.reply=function(){if(!c.replyMessage)return;var t={id:c.group.id,FromId:c.currentUser.id,ToId:c.currentUser.id,body:c.replyMessage,read:!0},a=[];c.replyMessage="",r.chatGroup.addMessage(t).$promise.then(function(e){t.read=!1,t.ChatInternalMessageId=e.id;for(var n=0;n<c.group.members.length;n++)c.group.members[n].id!==c.currentUser.id&&(t.ToId=c.group.members[n].id,a.push(r.chatGroup.addMessage(angular.copy(t)).$promise));return o.all(a)}).catch(function(e){console.log(e)})},l.on("chatInternalMessage:save",function(n){if(!c.group&&n.ToId===c.currentUser.id&&n.FromId!==c.currentUser.id&&!n.read&&n.ChatGroupId){var e=c.groups[n.ChatGroupId];if(!e)return r.chatGroup.get({id:n.ChatGroupId}).$promise.then(function(e){e.unreadGroupMessages=1,c.groups[e.id]=e});e.unreadGroupMessages||(e.unreadGroupMessages=0),e.unreadGroupMessages++}c.group&&n.ChatGroupId===c.group.id&&n.ToId===c.currentUser.id&&r.chatInternalMessage.update({id:n.id,read:!0}).$promise.then(function(){var e;e=n,c.group.messages[e.id]=e,u(400)})}),l.on("chatInternalMessage:update",function(e){e.ToId==c.currentUser.id&&e.FromId!==c.currentUser.id&&e.ChatGroupId&&e.read&&(0<c.groups[e.ChatGroupId].unreadGroupMessages&&c.groups[e.ChatGroupId].unreadGroupMessages--,c.group.messages[e.id]&&(c.group.messages[e.id].read=!0))}),l.on("chatGroup:remove",function(e){c.groups[e.id]&&delete c.groups[e.id]}),n("quick-panel").onClose(m),e.$on("$destroy",function(){l.removeAllListeners("chatInternalMessage:save"),l.removeAllListeners("chatInternalMessage:update"),l.removeAllListeners("chatGroup:remove")})}e.$inject=["$scope","$document","$timeout","$mdDialog","$mdSidenav","$q","Auth","api","socket","toasty"],angular.module("app.quick-panel").controller("ChatGroupController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r){this.data=r,this.title="QUICKPANEL.INFO",this.closeDialog=function(){a.hide()}}e.$inject=["$scope","$state","$location","$mdDialog","toasty","api","Auth","data"],angular.module("app.quick-panel").controller("ShowMessageInfoDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;o.form={token:s.token},o.setting={},o.resetPassword=function(){return i.auth.reset(o.form).$promise.then(function(){n.success({title:t.instant("RESETPASSWORD.PASSWORD_RESET"),msg:t.instant("RESETPASSWORD.PASSWORD_RESET_MESSAGE")}),a.go("app.login")}).catch(function(e){e&&n.error({title:t.instant("RESETPASSWORD.PASSWORD_RESET_ERROR"),msg:e.data?e.data.message||e.message||e:e.message||e})})},o.onInit=function(){e.isLoggedIn()&&a.go("app.dashboards.general");return i.setting.gdpr({id:1}).$promise.then(function(e){o.setting=e,o.passwordPattern=o.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:""}).catch(function(e){e&&n.error({title:"Error",msg:e.data?e.data.message||e.message||e:e.message||e})})}}e.$inject=["Auth","toasty","$translate","$state","api","$stateParams"],angular.module("app.reset").controller("ResetPasswordController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;function m(){u()}function u(){s.user.get({id:c.user.id}).$promise.then(function(e){c.user.permissions=e.permissions,c.items=[{font_icon:"icon-hangouts",class:"green-700-fg",label:"chat",title:"TOOLBAR.CHAT",value:"chat",permission:r.chat&&(p(105)||e.chatAutoanswer),enabled:e.chatAutoanswer,delay:e.chatAutoanswerDelay},{font_icon:"icon-email",class:"teal-fg",label:"email",title:"TOOLBAR.EMAIL",value:"email",permission:r.mail&&(p(106)||e.emailAutoanswer),enabled:e.emailAutoanswer,delay:e.emailAutoanswerDelay},{font_icon:"icon-message-text",class:"orange-fg",label:"sms",title:"TOOLBAR.SMS",value:"sms",permission:r.messaging&&(p(107)||e.smsAutoanswer),enabled:e.smsAutoanswer,delay:e.smsAutoanswerDelay},{font_icon:"icon-google-earth",class:"amber-fg",label:"openchannel",title:"TOOLBAR.OPENCHANNEL",value:"openchannel",permission:r.openchannel&&(p(108)||e.openchannelAutoanswer),enabled:e.openchannelAutoanswer,delay:e.openchannelAutoanswerDelay},{font_icon:"icon-deskphone",class:"grey-A200-fg",label:"fax",title:"TOOLBAR.FAX",value:"fax",permission:r.fax&&(p(109)||e.faxAutoanswer),enabled:e.faxAutoanswer,delay:e.faxAutoanswerDelay},{font_icon:"icon-whatsapp",class:"lime-A700-fg",label:"whatsapp",title:"TOOLBAR.WHATSAPP",value:"whatsapp",permission:r.whatsapp&&(p(114)||e.whatsappAutoanswer),enabled:e.whatsappAutoanswer,delay:e.whatsappAutoanswerDelay}]})}function p(e){return _.includes(c.user.permissions,e)}c.items=[],c.closeDialog=function(){a.hide()},c.user=d.getCurrentUser(),u(),o.connect(),o.on("userNotification:recalc:"+c.user.id,m)}e.$inject=["$scope","$state","$location","$mdDialog","toasty","api","socket","license","user","Auth"],angular.module("app.toolbar").controller("AutoAnswerNotificationsDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.errors=[],r.user=i,r.setting=s,r.reset=o,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.savePassword=function(){r.errors=[],a.user.changePassword({id:r.user.id},{oldPassword:r.oldPassword,newPassword:r.password}).$promise.then(function(){n.show(n.simple().textContent("Your password properly updated").position("top right").hideDelay(5e3)),l()}).catch(function(e){console.error(e),r.errors=e.data.errors&&e.data.errors.length?e.data.errors:[{message:e.data.message||"Authorization error",type:"api.user.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.changePasswordForm.password.$setValidity("oldPasswordMatch",!1):t.changePasswordForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","$mdToast","api","user","setting","reset"],angular.module("app.toolbar").controller("ChangePasswordController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o){var r=this;function l(e,n){var t={id:e.id};n?t.recallmeNotifiedDate=null:r.isRecallNotification?t.recallmeNotifiedDate=null:e.recallme||(t.UserId=null),i.cmHopper.update(t)}function d(e){var n=!1;_.isNil(e)||(n=e),l(r.preview,n),t.hide()}function c(e){return i.cmContact.getAdditionalPhones({id:e}).$promise.then(function(e){var n=_.map(e,"item"),t=_.map(e,"description");r.additionalItemTypes=_.map(e,"ItemTypeId");var a=_.map(e,"ItemType.rgbBackgroundColor"),i=_.map(e,"ItemType.name");r.additionalItems=[];for(var s=0;s<n.length;s++)r.additionalItems.push({phone:n[s],type:i[s],color:a[s],description:t[s]})})}r.customFieldsMap=s&&s.rows?_.mapValues(_.keyBy(s.rows,function(e){return"cf_"+e.id}),"name"):{},r.errors=[],r.hopperIds=[],r.additionalItems=[],r.preview=n,r.isRecallNotification=o,r.originated=!1,r.disable=!1,r.disableGetContact=!1,r.hopperIds.push(r.preview.id),r.originatePreview=function(){r.originated=!0,r.disable=!0,_.isEmpty(r.preview)?(a.error({title:"Message",msg:"Contact not available"}),r.disable=!1,r.hopperIds=[],d(!0)):i.rpc.getVoiceQueuesPreview({id:r.preview.id}).$promise.then(function(){d(!0)}).catch(function(e){a.error({title:"Message",msg:e.data}),d(!0)}).finally(function(){r.disable=!1,r.hopperIds=[]})},r.closeDialog=d,r.nextContact=function(){return r.disableGetContact=!0,i.cmHopper.getPreview({hopperIds:r.hopperIds,direction:"next"}).$promise.then(function(e){r.disableGetContact=!1,_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(r.hopperIds=[],t.hide(),a.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(c(e.Contact.id),r.originated||i.cmHopper.update({id:r.preview.id,UserId:null}),r.preview=e,r.hopperIds.push(r.preview.id))}).catch(function(e){if(r.disableGetContact=!1,r.hopperIds=[],404===e.status)r.getFirstAvailableContact();else if(e.data&&e.data.errors&&e.data.errors.length){t.hide();for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.hide(),a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.previousContact=function(){if(r.disableGetContact=!0,1<r.hopperIds.length){var e=_.without(r.hopperIds,r.preview.id);return i.cmHopper.getPreview({hopperIds:e,direction:"prev"}).$promise.then(function(e){r.disableGetContact=!1,_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(r.hopperIds=[],t.hide(),a.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(c(e.Contact.id),_.remove(r.hopperIds,function(e){return e==r.preview.id}),r.originated||i.cmHopper.update({id:r.preview.id,UserId:null}),r.preview=e)}).catch(function(e){if(404===e.status)r.hopperIds=[r.preview.id],a.info({title:"PREVIEW",msg:"PREVIOUS CONTACTS NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length){r.hopperIds=[],t.hide();for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.hopperIds=[],t.hide(),a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}},r.getFirstAvailableContact=function(){return r.disableGetContact=!0,a.info({title:"PREVIEW",msg:"CONTACTS NOT AVAILABLE. REWINDING THE LIST"}),i.cmHopper.getPreview({hopperIds:[r.preview.id],direction:"next"}).$promise.then(function(e){_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(t.hide(),a.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(c(e.Contact.id),r.originated||i.cmHopper.update({id:r.preview.id,UserId:null}),r.preview=e,r.hopperIds.push(r.preview.id))}).catch(function(e){if(t.hide(),404===e.status)a.info({title:"PREVIEW",msg:"CONTACTS NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})}).finally(function(){r.disableGetContact=!1})},r.isCustomField=function(e){return _.startsWith(e,"cf_")},r.isHiddenField=function(e){return _.includes(["Company","CompanyId","ListId","UserId","createdAt","deletedAt","id","dialTimezone","utcOffset","AdditionalPhones","additionalPhones","priority","scheduledat","tags","updatedAt","facebook","twitter","skype","wechat","teams","viber","line","telegram"],e)},r.isNil=function(e){return _.isNil(e)},_.isNil(r.preview)||c(r.preview.Contact.id),e.$on("$destroy",function(){r.originated||l(r.preview,!1)})}e.$inject=["$scope","$mdDialog","toasty","api","preview","customFields","isRecallNotification"],angular.module("app.toolbar").controller("PreviewDialogController",e).directive("customChip",function(){return{restrict:"A",scope:!1,link:function(e,n,t){n.parent().parent().css("background",e.$chip.color)}}})}(),function(){"use strict";function e(n,t,s,a,o,e,i,r,l,d,c,m,u,p,g,v,h,f,b,A,E,y,S){var T,I=this;I.voiceQueues={},I.polling=!0,t.global={search:""},I.pauses=[],I.license=b,I.currentUser=v.getCurrentUser(),I.unreadTotalMessages=0,I.unreadTotalGroupMessages=0,I.contacts=0,"agent"===I.currentUser.role&&(T=E(function(){_.some(I.voiceQueues,{dialMethod:"preview",dialActive:!0})&&I.license.dialer&&I.polling?(I.polling=!1,f.cmHopper.getOpenContacts().$promise.then(function(e){e&&_.isNumber(e.contacts)&&(I.contacts=e.contacts)}).finally(function(){I.polling=!0})):I.contacts=0},14999)),I.setting=A,I.bodyEl=angular.element("body"),I.conf={realm:"asterisk",host:e.host(),protocol:e.protocol(),soundPlayerId:"local-audio",remotePlayerId:"remote-audio",ua:"Motion WebRTC Bar 0.2.0",license:I.license.webrtc,phoneBarExpires:I.currentUser.phoneBarExpires,phoneBarPrefixRequired:I.currentUser.phoneBarPrefixRequired,wssPort:I.currentUser.wssPort},I.webRTCSessions=[],I.autoanswerIconColor="green-700-fg",I.query={id:v.getCurrentUser().id,fields:"id,name,type,dialMethod,dialActive",channel:"voice",nolimit:!0},I.userStatusOptions=[{title:"Online",icon:"icon-checkbox-marked-circle",color:"#4CAF50"},{title:"Away",icon:"icon-clock",color:"#FFC107"},{title:"Do not Disturb",icon:"icon-minus-circle",color:"#F44336"},{title:"Invisible",icon:"icon-checkbox-blank-circle-outline",color:"#BDBDBD"},{title:"Offline",icon:"icon-checkbox-blank-circle-outline",color:"#616161"}],I.languages={ar:{title:"Arabic",translation:"TOOLBAR.ARABIC",code:"ar",flag:"ar"},cs:{title:"Czech",translation:"TOOLBAR.CZECH",code:"cs",flag:"cs"},da:{title:"Danish",translation:"TOOLBAR.DANISH",code:"da",flag:"da"},de:{title:"German",translation:"TOOLBAR.GERMAN",code:"de",flag:"de"},en:{title:"English",translation:"TOOLBAR.ENGLISH",code:"en",flag:"us"},es:{title:"Spanish",translation:"TOOLBAR.SPANISH",code:"es",flag:"es"},fa:{title:"Persian",translation:"TOOLBAR.PERSIAN",code:"fa",flag:"fa"},fi:{title:"Finnish",translation:"TOOLBAR.FINNISH",code:"fi",flag:"fi"},fr:{title:"French",translation:"TOOLBAR.FRENCH",code:"fr",flag:"fr"},he:{title:"Hebrew",translation:"TOOLBAR.HEBREW",code:"he",flag:"he"},hi:{title:"Hindi",translation:"TOOLBAR.HINDI",code:"hi",flag:"hi"},hu:{title:"Hungarian",translation:"TOOLBAR.HUNGARIAN",code:"hu",flag:"hu"},id:{title:"Indonesian",translation:"TOOLBAR.INDONESIAN",code:"id",flag:"id"},it:{title:"Italian",translation:"TOOLBAR.ITALIAN",code:"it",flag:"it"},ja:{title:"Japanese",translation:"TOOLBAR.JAPANESE",code:"ja",flag:"ja"},ko:{title:"Korean",translation:"TOOLBAR.KOREAN",code:"ko",flag:"ko"},lv:{title:"Latvian",translation:"TOOLBAR.LATVIAN",code:"lv",flag:"lv"},nl:{title:"Dutch",translation:"TOOLBAR.DUTCH",code:"nl",flag:"nl"},no:{title:"Norwegian",translation:"TOOLBAR.NORWEGIAN",code:"no",flag:"no"},pl:{title:"Polish",translation:"TOOLBAR.POLISH",code:"pl",flag:"pl"},"pt-BR":{title:"Brazilian",translation:"TOOLBAR.BRAZILIAN",code:"pt-BR",flag:"pt-BR"},"pt-PT":{title:"Portuguese",translation:"TOOLBAR.PORTUGUESE",code:"pt-PT",flag:"pt-PT"},ru:{title:"Russian",translation:"TOOLBAR.RUSSIAN",code:"ru",flag:"ru"},sv:{title:"Swedish",translation:"TOOLBAR.SWEDISH",code:"sv",flag:"sv"},tr:{title:"Turkish",translation:"TOOLBAR.TURKISH",code:"tr",flag:"tr"},"zh-CN":{title:"ChineseSimplified",translation:"TOOLBAR.CHINESESIMPLIFIED",code:"zh-CN",flag:"zh-CN"},"zh-TW":{title:"ChineseTraditional",translation:"TOOLBAR.CHINESETRADITIONAL",code:"zh-TW",flag:"zh-TW"}};var O=["ar","fa","he"],C=S.getLogger("toolbar");function w(){h.connect(),h.on("user:update",I.onUserUpdate),h.on("user:called",I.onUserCalled),h.on("chatInternalMessage:save",I.onInternalMessageSave),h.on("chatInternalMessage:update",I.onInternalMessageUpdate),h.on("userVoiceQueue:save",I.onUserVoiceQueue),h.on("voiceQueue:save",I.onVoiceQueue),h.on("userVoiceQueue:remove",I.onUserVoiceQueue),h.on("voiceQueue:remove",I.onVoiceQueue),h.on("voiceQueue:update",I.onVoiceQueue),h.on("user:forcelogout",M),h.on("userNotification:send",U),h.on("userNotification:recalc:"+I.user.id,F)}function R(){h.disconnect("logout")}function x(e){I.voiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}function N(){I.promise=f.user.getQueues(I.query,x).$promise}function D(e,n,t){n||(n=!1),t||(t={type:"click",target:"button.preview-button"}),c.show({controller:"PreviewDialogController",controllerAs:"vm",templateUrl:"app/toolbar/preview/dialog.html",parent:angular.element(m.body),targetEvent:t,clickOutsideToClose:!0,locals:{preview:e,currentUser:I.currentUser,isRecallNotification:n},resolve:{customFields:["apiResolver",function(e){return e.resolve("cmCustomField@get",{nolimit:!0})}]}})}function P(){return I.license.chat&&(I.hasPermission(105)||I.currentUser.chatAutoanswer)||I.license.mail&&I.hasPermission(106)||I.currentUser.emailAutoanswer||I.license.messaging&&I.hasPermission(107)||I.currentUser.smsAutoanswer||I.license.openchannel&&I.hasPermission(108)||I.currentUser.openchannelAutoanswer||I.license.fax&&I.hasPermission(109)||I.currentUser.faxAutoanswer||I.license.whatsapp&&(I.hasPermission(114)||I.currentUser.whatsappAutoanswer)}function L(e){return R(),s.resolve().then(function(){if(!v.isTelephone())return S.flush()}).then(function(){return v.logout(e)}).then(function(){return t.$broadcast("webrtc::logout"),a.go("app.login")}).catch(function(e){C.error(e)})}function k(e,n){c.show({controller:"ChangePasswordController",controllerAs:"vm",templateUrl:"app/toolbar/changepassword/changepassword.html",parent:angular.element(m.body),targetEvent:e,clickOutsideToClose:!n,escapeToClose:!n,locals:{user:I.user,setting:A,reset:n}})}function M(e){if(C.debug("onForceLogout -> data",e),e.user.id===I.user.id&&0!==I.user.showWebBar)return R(),s.resolve().then(function(){if(!v.isTelephone())return S.flush()}).then(function(){return v.logout(!0)}).then(function(){t.$broadcast("webrtc::logout"),c.show(c.alert().parent(angular.element(m.body)).clickOutsideToClose(!1).escapeToClose(!1).title(r.instant("TOOLBAR.WARNING")).textContent(r.instant("TOOLBAR.USER_FORCE_LOGOUT",{ip:e.ip})).ok("OK")).then(function(){return a.go("app.login")})}).catch(function(e){C.error(e)})}function U(e){var n=e;if(I.currentUser.id===n.recipient){var t=r.instant("TOOLBAR.NOTIFICATION_TITLE",{sender:n.sender}),a=n.description?r.instant("TOOLBAR.NOTIFICATION_TITLE_RECIPIENT",{recipient:n.description}):null;p.wait({title:a?t+" "+a:t,msg:n.content,clickToClose:!1,timeout:!1,sound:n.beep,html:!0})}}function F(e){f.user.get({id:I.currentUser.id}).$promise.then(function(e){I.currentUser.permissions=e.permissions,I.autoanswerIconColor=P()?"green-700-fg":"gray-700-fg"})}I.toggleSidenav=function(e){i(e).toggle()},I.logout=L,I.changeLanguage=function(e){if(!I.languages.hasOwnProperty(e.code)){return void l.show({template:'<md-toast id="language-message" layout="column" layout-align="center start"><div class="md-toast-content">Motion supports multiple translations through angular-translate module, but currently we do not support the selected language. If you want to help us, send us a message.</div></md-toast>',hideDelay:7e3,position:"top right",parent:"#content"})}I.selectedLanguage=e,u.put("motion.language",e.code),r.use(e.code),"app.callysquare.projects.edit"===a.current.name&&d.location.reload();0<=O.indexOf(e.code)?p.info({title:r.instant("TOOLBAR.CHANGE_LANGUAGE_TITLE"),msg:r.instant("TOOLBAR.CHANGE_LANGUAGE_MESSAGE")}):n.$parent.$parent.vm.direction="ltr"},I.setUserStatus=function(e){I.userStatus=e},I.toggleHorizontalMobileMenu=function(){I.bodyEl.toggleClass("ms-navigation-horizontal-mobile-menu-active")},I.toggleMsNavigationFolded=function(){g.toggleFolded()},I.search=function(n){for(var e=[],t=g.getFlatNavigation(),a=s.defer(),i=0;i<t.length;i++)t[i].uisref&&e.push(t[i]);n&&(e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(n)))return!0}));return o(function(){a.resolve(e)},1e3),a.promise},I.searchResultClick=function(e){e.uisref&&(e.stateParams?a.go(e.state,e.stateParams):a.go(e.state))},I.openSettings=function(){t.$broadcast("webrtc::settings")},I.changePassword=k,I.isAgent=function(){return v.getCurrentUser()&&v.hasRole("agent")},I.onUserUpdate=function(e){if(e.id===I.user.id)if("agent"===e.role&&_.isBoolean(e.online)&&!e.online)if(0!==I.user.showWebBar){var n;R();var t=c.confirm({title:r.instant("TOOLBAR.WARNING")+"!",htmlContent:"<span>"+r.instant("TOOLBAR.SOMEONE_LOGGED_YOU_OUT")+"</span><br><span>"+r.instant("TOOLBAR.SESSION_TIMEOUT")+"</span>",ariaLabel:r.instant("TOOLBAR.WARNING")+"!",ok:r.instant("TOOLBAR.STAY_LOGGED"),cancel:r.instant("TOOLBAR.LOGOUT"),onComplete:function(){n=setTimeout(function(){c.cancel()},6e4)}});c.show(t).then(function(){return clearTimeout(n),v.queueLogin().then(function(){w(),_.merge(I.user,e),v.setCurrentUser(I.user)})}).catch(function(){clearTimeout(n),L(!0)})}else L(!0);else _.merge(I.user,e),v.setCurrentUser(I.user)},I.onUserCalled=function(e){if(2===I.currentUser.showWebBar&&"agent"===I.currentUser.role){var n=I.currentUser.privacyEnabled?y.mask(e.calleridnum):e.calleridnum;p.info({title:"WebRTC Popup",msg:"<div>            <span>Call from: "+n+"</span><br>            <span>Queue: "+e.queue+"</span><br>            <span>Extra: "+(e.variables.extravar?e.variables.extravar:"Not defined")+"</span><br>            </div>",showClose:!0,timeout:1e4,html:!0})}},I.pause=function(e){var n=e||"DEFAULT PAUSE";_.some(I.webRTCSessions,["confirmed",!0])&&(n="#"+n);return f.user.pause({id:I.user.id,type:n}).$promise.catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:PAUSEUSER",msg:e.status?JSON.stringify(e.data):e.toString()})})},I.unpause=function(){return f.user.unpause({id:I.user.id}).$promise.catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UNPAUSEUSER",msg:e.status?JSON.stringify(e.data):e.toString()})})},I.preview=function(n){return I.disable=!0,f.cmHopper.getPreview().$promise.then(function(e){_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?p.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"}):D(e,!1,n)}).catch(function(e){if(404===e.status)p.info({title:"PREVIEW",msg:"CONTACT NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length){I.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelMessage.accept",msg:e.data?JSON.stringify(e.data.message):e.toString()})}).finally(function(){I.disable=!1})},I.autoAnswerNotificationsDialog=function(e){if(P()){I.autoanswerNotifications;c.show({controller:"AutoAnswerNotificationsDialogController",controllerAs:"vm",templateUrl:"app/toolbar/autoanswers/dialog.html",parent:angular.element(m.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:I.license,user:I.currentUser}})}else alert(r.instant("TOOLBAR.NO_AUTOANSWER_CONFIGURED"))},I.getLogo=function(){return I.setting.defaultHeaderWhiteLabel?"xCALLY Motion":I.setting.headerWhiteLabel},I.userIsNotPhonebar=function(){return"admin"===I.currentUser.role||"user"===I.currentUser.role||"agent"===I.currentUser.role&&0!==I.currentUser.showWebBar},I.onInternalMessageSave=function(e){e.ToId!==I.currentUser.id||e.ChatGroupId||(I.unreadTotalMessages+=1);e.ToId===I.currentUser.id&&e.FromId!==I.currentUser.id&&!e.read&&e.ChatGroupId&&I.unreadTotalGroupMessages++},I.onInternalMessageUpdate=function(e){e.ToId===I.currentUser.id&&e.read&&0<I.unreadTotalMessages&&!e.ChatGroupId&&(I.unreadTotalMessages-=1);e.ToId===I.currentUser.id&&e.read&&e.ChatGroupId&&0<I.unreadTotalGroupMessages&&I.unreadTotalGroupMessages--},I.onUserVoiceQueue=function(e){_.toInteger(e.UserId)===v.getCurrentUser().id&&N()},I.onVoiceQueue=function(){N()},I.hasPermission=function(e){return _.includes(I.currentUser.permissions,e)},function(){I.user=v.getCurrentUser(),I.conf.ha1=I.user.md5secret,I.conf.id=I.user.id,I.conf.name=I.user.name,I.conf.fullname=I.user.fullname,I.conf.internal=I.user.internal,I.conf.recording=I.user.phoneBarEnableRecording,I.conf.autoAnswer=I.user.phoneBarAutoAnswer,I.conf.enableSettings=I.user.phoneBarEnableSettings,I.conf.enableDtmfTone=I.user.phoneBarEnableDtmfTone,I.conf.autoAnswerDelay=I.user.phoneBarAutoAnswerDelay,I.userStatus=I.userStatusOptions[0];var e=u.get("motion.language");e&&I.languages.hasOwnProperty(e)?I.selectedLanguage=I.languages[e]:I.selectedLanguage=I.languages[r.preferredLanguage()];if(f.pause.get({fields:"name",nolimit:!0}).$promise.then(function(e){I.pauses=e.rows?e.rows:[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETPAUSES",msg:e.status?JSON.stringify(e.data):e.toString()})}),"LOCAL_LOGIN"==v.getAuthenticationType()&&I.setting.securePassword)if(I.user.passwordResetAt){var n=moment(I.user.passwordResetAt).add(I.setting.passwordExpiresDays||90,"day");moment().isAfter(n)?k(null,!0):moment().add(15,"day").isAfter(n)&&p.warning({title:r.instant("TOOLBAR.WARNING")+"!",msg:r.instant("TOOLBAR.PASSWORD_EXPIRE_REMAINING_DAYS")+": "+Math.ceil(n.diff(moment(),"days",!0)),timeout:2e4})}else k(null,!0);F()}(),N(),w(),I.openPreviewDialog=D,f.chatInternalMessage.get({fields:"FromId",ToId:I.currentUser.id,read:!1,nolimit:!0}).$promise.then(function(e){I.unreadTotalMessages=e.rows.length}),n.$on("$destroy",function(){h.removeAllListeners("user:called"),h.removeAllListeners("user:update"),h.removeAllListeners("chatInternalMessage:save"),h.removeAllListeners("chatInternalMessage:update"),h.removeAllListeners("userVoiceQueue:save"),h.removeAllListeners("voiceQueue:save"),h.removeAllListeners("userVoiceQueue:remove"),h.removeAllListeners("voiceQueue:remove"),h.removeAllListeners("voiceQueue:update"),h.removeAllListeners("user:forcelogout"),h.removeAllListeners("userNotification:send"),h.removeAllListeners("userAutoanswerNotification:send"),T&&(E.cancel(T),T=null)})}e.$inject=["$scope","$rootScope","$q","$state","$timeout","$location","$mdSidenav","$translate","$mdToast","$window","$mdDialog","$document","$cookies","toasty","msNavigationService","Auth","socket","api","license","setting","$interval","privacyManager","ClientSideLoggingService"],angular.module("app.toolbar").controller("ToolbarController",e)}(),function(){"use strict";function e(a,i,t,s,e){var n={updateUserSettingById:function(e,n){if("number"==typeof e)return i.userSetting.update({id:e},n).$promise;throw new Error("User setting id is missing")}},o=!1,r=a.getCurrentUser(),l=r?r.userSetting:null,d=function(e){var n="user-setting:update:user-"+e;t.$on("local:user-updated",c),s.on(n,c)};function c(){return o?e(function(e){e(l)}):(o=!0,function(e){var n=a.getCurrentUser(),t=null;t="admin"===n.role&&"number"==typeof e?i.user.get({id:e,userSetting:!0}).$promise:i.user.whoami({userSetting:!0}).$promise;return t.then(function(e){return a.setCurrentUser(e),e.userSetting})}().then(function(e){l=e,t.$emit("local:user-setting-updated",l)}).finally(function(){o=!1}))}return r&&d(r.id),t.$on("local:user-login",d),t.$on("local:user-logout",function(e){var n="user-setting:update:user-"+e;s.removeListener(n,c),l=null}),n}e.$inject=["Auth","api","$rootScope","socket","$q"],angular.module("app.user-setting").service("UserSettingService",e)}();var urlParams=function(e){var n=new Object,t=e.lastIndexOf("?");if(0<t)for(var a=e.substring(t+1).split("&"),i=0;i<a.length;i++)0<(t=a[i].indexOf("="))&&(n[a[i].substring(0,t)]=a[i].substring(t+1));return n}(window.location.href),t0=new Date,MAX_REQUEST_SIZE=10485760,MAX_WIDTH=12e3,MAX_HEIGHT=12e3,EXPORT_URL="http://exp.draw.io/ImageExport2/export",SHARE_HOST="http://localhost:3000",SAVE_URL="api/square/projects/",VARIABLE_URL="/api/variables",STENCIL_PATH="/assets/plugins/square/stencils",SHAPES_PATH="/assets/plugins/square/shapes",IMAGE_PATH="/assets/plugins/square/images",STYLE_PATH="/assets/plugins/square/styles",CSS_PATH="/assets/plugins/square/styles",OPEN_FORM="api/square/projects/open",TEMPLATE_PATH="/assets/plugins/square/templates",RESOURCES_PATH="/assets/plugins/square/resources",RESOURCE_BASE=RESOURCES_PATH+"/grapheditor",CRUD_PERMISSIONS={readOnly:!1,canEdit:!1,canDelete:!1},tapAndHoldStartsConnection=!0,showConnectorImg=!0,mxLoadResources=!1,mxLanguages=["it","fr","ko","es","sv","ru","de","ja","zh-CN","zh-TW","nl","fi","da","pt-BR","pt-PT","no","hi","tr","fa"],mxLanguage="en",match=document.cookie.match(new RegExp("(^| )motion.language=([^;]+)"));match&&mxLanguages.includes(match[2])&&(mxLanguage=match[2]);var mxBasePath="assets/plugins/mxgraph",mxClient={VERSION:"2.0.0.0",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&navigator.userAgent.indexOf("MSIE")<0,IS_OP:0<=navigator.userAgent.indexOf("Opera/"),IS_OT:navigator.userAgent.indexOf("Presto/2.4.")<0&&navigator.userAgent.indexOf("Presto/2.3.")<0&&navigator.userAgent.indexOf("Presto/2.2.")<0&&navigator.userAgent.indexOf("Presto/2.1.")<0&&navigator.userAgent.indexOf("Presto/2.0.")<0&&navigator.userAgent.indexOf("Presto/1.")<0,IS_SF:0<=navigator.userAgent.indexOf("AppleWebKit/")&&navigator.userAgent.indexOf("Chrome/")<0,IS_GC:0<=navigator.userAgent.indexOf("Chrome/"),IS_MT:0<=navigator.userAgent.indexOf("Firefox/")&&navigator.userAgent.indexOf("Firefox/1.")<0&&navigator.userAgent.indexOf("Firefox/2.")<0||0<=navigator.userAgent.indexOf("Iceweasel/")&&navigator.userAgent.indexOf("Iceweasel/1.")<0&&navigator.userAgent.indexOf("Iceweasel/2.")<0||0<=navigator.userAgent.indexOf("SeaMonkey/")&&navigator.userAgent.indexOf("SeaMonkey/1.")<0||0<=navigator.userAgent.indexOf("Iceape/")&&navigator.userAgent.indexOf("Iceape/1.")<0,IS_SVG:0<=navigator.userAgent.indexOf("Firefox/")||0<=navigator.userAgent.indexOf("Iceweasel/")||0<=navigator.userAgent.indexOf("Seamonkey/")||0<=navigator.userAgent.indexOf("Iceape/")||0<=navigator.userAgent.indexOf("Galeon/")||0<=navigator.userAgent.indexOf("Epiphany/")||0<=navigator.userAgent.indexOf("AppleWebKit/")||0<=navigator.userAgent.indexOf("Gecko/")||0<=navigator.userAgent.indexOf("Opera/"),NO_FO:0<=navigator.userAgent.indexOf("Firefox/1.")||0<=navigator.userAgent.indexOf("Iceweasel/1.")||0<=navigator.userAgent.indexOf("Firefox/2.")||0<=navigator.userAgent.indexOf("Iceweasel/2.")||0<=navigator.userAgent.indexOf("SeaMonkey/1.")||0<=navigator.userAgent.indexOf("Iceape/1.")||0<=navigator.userAgent.indexOf("Camino/1.")||0<=navigator.userAgent.indexOf("Epiphany/2.")||0<=navigator.userAgent.indexOf("Opera/")||0<=navigator.userAgent.indexOf("MSIE")||0<=navigator.userAgent.indexOf("Mozilla/2."),IS_VML:"MICROSOFT INTERNET EXPLORER"==navigator.appName.toUpperCase(),IS_MAC:0<navigator.userAgent.toUpperCase().indexOf("MACINTOSH"),IS_TOUCH:0<navigator.userAgent.toUpperCase().indexOf("IPAD")||0<navigator.userAgent.toUpperCase().indexOf("IPOD")||0<navigator.userAgent.toUpperCase().indexOf("IPHONE")||0<navigator.userAgent.toUpperCase().indexOf("ANDROID"),IS_LOCAL:document.location.href.indexOf("http://")<0&&document.location.href.indexOf("https://")<0,isBrowserSupported:function(){return mxClient.IS_VML||mxClient.IS_SVG},link:function(e,n,t){if(t=t||document,mxClient.IS_IE6)t.write('<link rel="'+e+'" href="'+n+'" charset="ISO-8859-1" type="text/css"/>');else{var a=t.createElement("link");a.setAttribute("rel",e),a.setAttribute("href",n),a.setAttribute("charset","ISO-8859-1"),a.setAttribute("type","text/css"),t.getElementsByTagName("head")[0].appendChild(a)}},include:function(e){document.write('<script src="'+e+'"><\/script>')},dispose:function(){for(var e=0;e<mxEvent.objects.length;e++)null!=mxEvent.objects[e].mxListenerList&&mxEvent.removeAllListeners(mxEvent.objects[e])}};if(mxClient.IS_OP&&mxClient.IS_OT?mxClient.CSS_PREFIX="O":mxClient.IS_SF||mxClient.IS_GC?mxClient.CSS_PREFIX="Webkit":mxClient.IS_MT?mxClient.CSS_PREFIX="Moz":mxClient.IS_IE&&9<=document.documentMode&&(mxClient.CSS_PREFIX="ms"),void 0===mxLoadResources&&(mxLoadResources=!0),"undefined"==typeof mxResourceExtension&&(mxResourceExtension=".txt"),"undefined"==typeof mxLoadStylesheets&&(mxLoadStylesheets=!0),void 0!==mxBasePath&&0<mxBasePath.length?("/"==mxBasePath.substring(mxBasePath.length-1)&&(mxBasePath=mxBasePath.substring(0,mxBasePath.length-1)),mxClient.basePath=mxBasePath):mxClient.basePath=".","undefined"!=typeof mxImageBasePath&&0<mxImageBasePath.length?("/"==mxImageBasePath.substring(mxImageBasePath.length-1)&&(mxImageBasePath=mxImageBasePath.substring(0,mxImageBasePath.length-1)),mxClient.imageBasePath=mxImageBasePath):mxClient.imageBasePath=mxClient.basePath+"/images",mxClient.language=void 0!==mxLanguage?mxLanguage:mxClient.IS_IE?navigator.userLanguage:navigator.language,mxClient.defaultLanguage="undefined"!=typeof mxDefaultLanguage?mxDefaultLanguage:"en",mxLoadStylesheets&&mxClient.link("stylesheet",mxClient.basePath+"/css/common.css"),void 0!==mxLanguages&&(mxClient.languages=mxLanguages),mxClient.IS_IE){if(9<=document.documentMode)mxClient.IS_VML=!1,mxClient.IS_SVG=!0;else{8==document.documentMode?(document.namespaces.add(mxClient.VML_PREFIX,"urn:schemas-microsoft-com:vml","#default#VML"),document.namespaces.add(mxClient.OFFICE_PREFIX,"urn:schemas-microsoft-com:office:office","#default#VML")):(document.namespaces.add(mxClient.VML_PREFIX,"urn:schemas-microsoft-com:vml"),document.namespaces.add(mxClient.OFFICE_PREFIX,"urn:schemas-microsoft-com:office:office"));var ss=document.createStyleSheet();ss.cssText="v\\:*{behavior:url(#default#VML)}o\\:*{behavior:url(#default#VML)}",mxLoadStylesheets&&mxClient.link("stylesheet",mxClient.basePath+"/css/explorer.css")}window.attachEvent("onunload",mxClient.dispose)}var mxLog={consoleName:"Console",TRACE:!1,DEBUG:!0,WARN:!0,buffer:"",init:function(){if(null==mxLog.window&&null!=document.body){var e=mxLog.consoleName+" - mxGraph "+mxClient.VERSION,n=document.createElement("table");n.setAttribute("width","100%"),n.setAttribute("height","100%");var t=document.createElement("tbody"),a=document.createElement("tr"),i=document.createElement("td");if(i.style.verticalAlign="top",mxLog.textarea=document.createElement("textarea"),mxLog.textarea.setAttribute("readOnly","true"),mxLog.textarea.style.height="100%",mxLog.textarea.style.resize="none",mxLog.textarea.value=mxLog.buffer,mxLog.textarea.style.width=mxClient.IS_NS&&"BackCompat"!=document.compatMode?"99%":"100%",i.appendChild(mxLog.textarea),a.appendChild(i),t.appendChild(a),a=document.createElement("tr"),mxLog.td=document.createElement("td"),mxLog.td.style.verticalAlign="top",mxLog.td.setAttribute("height","30px"),a.appendChild(mxLog.td),t.appendChild(a),n.appendChild(t),mxLog.addButton("Info",function(e){mxLog.info()}),mxLog.addButton("DOM",function(e){e=mxUtils.getInnerHtml(document.body),mxLog.debug(e)}),mxLog.addButton("Trace",function(e){mxLog.TRACE=!mxLog.TRACE,mxLog.TRACE?mxLog.debug("Tracing enabled"):mxLog.debug("Tracing disabled")}),mxLog.addButton("Copy",function(e){try{mxUtils.copy(mxLog.textarea.value)}catch(e){mxUtils.alert(e)}}),mxLog.addButton("Show",function(e){try{mxUtils.popup(mxLog.textarea.value)}catch(e){mxUtils.alert(e)}}),mxLog.addButton("Clear",function(e){mxLog.textarea.value=""}),a=t=0,a="number"==typeof window.innerWidth?(t=window.innerHeight,window.innerWidth):(t=document.documentElement.clientHeight||document.body.clientHeight,document.body.clientWidth),mxLog.window=new mxWindow(e,n,Math.max(0,a-320),Math.max(0,t-210),300,160),mxLog.window.setMaximizable(!0),mxLog.window.setScrollable(!1),mxLog.window.setResizable(!0),mxLog.window.setClosable(!0),mxLog.window.destroyOnClose=!1,(mxClient.IS_NS||mxClient.IS_IE)&&!mxClient.IS_GC&&!mxClient.IS_SF&&"BackCompat"!=document.compatMode){var s=mxLog.window.getElement();e=function(e,n){mxLog.textarea.style.height=Math.max(0,s.offsetHeight-70)+"px"};mxLog.window.addListener(mxEvent.RESIZE_END,e),mxLog.window.addListener(mxEvent.MAXIMIZE,e),mxLog.window.addListener(mxEvent.NORMALIZE,e),mxLog.textarea.style.height="92px"}}},info:function(){mxLog.writeln(mxUtils.toString(navigator))},addButton:function(e,n){var t=document.createElement("button");mxUtils.write(t,e),mxEvent.addListener(t,"click",n),mxLog.td.appendChild(t)},isVisible:function(){return null!=mxLog.window&&mxLog.window.isVisible()},show:function(){mxLog.setVisible(!0)},setVisible:function(e){null==mxLog.window&&mxLog.init(),null!=mxLog.window&&mxLog.window.setVisible(e)},enter:function(e){if(mxLog.TRACE)return mxLog.writeln("Entering "+e),(new Date).getTime()},leave:function(e,n){if(mxLog.TRACE){var t=0!=n?" ("+((new Date).getTime()-n)+" ms)":"";mxLog.writeln("Leaving "+e+t)}},debug:function(){mxLog.DEBUG&&mxLog.writeln.apply(this,arguments)},warn:function(){mxLog.WARN&&mxLog.writeln.apply(this,arguments)},write:function(){for(var e="",n=0;n<arguments.length;n++)e+=arguments[n],n<arguments.length-1&&(e+=" ");null!=mxLog.textarea?(mxLog.textarea.value+=e,0<=navigator.userAgent.indexOf("Presto/2.5")&&(mxLog.textarea.style.visibility="hidden",mxLog.textarea.style.visibility="visible"),mxLog.textarea.scrollTop=mxLog.textarea.scrollHeight):mxLog.buffer+=e},writeln:function(){for(var e="",n=0;n<arguments.length;n++)e+=arguments[n],n<arguments.length-1&&(e+=" ");mxLog.write(e+"\n")}},mxObjectIdentity={FIELD_NAME:"mxObjectId",counter:0,get:function(e){if("object"==typeof e&&null==e[mxObjectIdentity.FIELD_NAME]){var n=mxUtils.getFunctionName(e.constructor);e[mxObjectIdentity.FIELD_NAME]=n+"#"+mxObjectIdentity.counter++}return e[mxObjectIdentity.FIELD_NAME]},clear:function(e){"object"==typeof e&&delete e[mxObjectIdentity.FIELD_NAME]}};function mxDictionary(){this.clear()}mxDictionary.prototype.map=null,mxDictionary.prototype.clear=function(){this.map={}},mxDictionary.prototype.get=function(e){return e=mxObjectIdentity.get(e),this.map[e]},mxDictionary.prototype.put=function(e,n){var t=mxObjectIdentity.get(e),a=this.map[t];return this.map[t]=n,a},mxDictionary.prototype.remove=function(e){e=mxObjectIdentity.get(e);var n=this.map[e];return delete this.map[e],n},mxDictionary.prototype.getKeys=function(){var e,n=[];for(e in this.map)n.push(e);return n},mxDictionary.prototype.getValues=function(){var e,n=[];for(e in this.map)n.push(this.map[e]);return n},mxDictionary.prototype.visit=function(e){for(var n in this.map)e(n,this.map[n])};var mxResources={resources:[],extension:mxResourceExtension,resourcesEncoded:!1,loadDefaultBundle:!0,loadSpecialBundle:!0,isLanguageSupported:function(e){return null==mxClient.languages||0<=mxUtils.indexOf(mxClient.languages,e)},getDefaultBundle:function(e,n){return mxResources.loadDefaultBundle||!mxResources.isLanguageSupported(n)?e+mxResources.extension:null},getSpecialBundle:function(e,n){if(null==mxClient.languages||!this.isLanguageSupported(n)){var t=n.indexOf("-");0<t&&(n=n.substring(0,t))}return mxResources.loadSpecialBundle&&mxResources.isLanguageSupported(n)&&n!=mxClient.defaultLanguage?e+"_"+n+mxResources.extension:null},add:function(e,n){if((n=null!=n?n:mxClient.language)!=mxConstants.NONE){var t=mxResources.getDefaultBundle(e,n);if(null!=t)try{var a=mxUtils.load(t);a.isReady()&&mxResources.parse(a.getText())}catch(e){}if(null!=(t=mxResources.getSpecialBundle(e,n)))try{(a=mxUtils.load(t)).isReady()&&mxResources.parse(a.getText())}catch(e){}}},parse:function(e){if(null!=e){e=e.split("\n");for(var n=0;n<e.length;n++)if("#"!=e[n].charAt(0)){var t=e[n].indexOf("=");if(0<t){var a=e[n].substring(0,t),i=e[n].length;13==e[n].charCodeAt(i-1)&&i--,t=e[n].substring(t+1,i),this.resourcesEncoded?(t=t.replace(/\\(?=u[a-fA-F\d]{4})/g,"%"),mxResources.resources[a]=unescape(t)):mxResources.resources[a]=t}}}},get:function(e,n,t){if(null==(e=mxResources.resources[e])&&(e=t),null!=e&&null!=n){t=[];for(var a=null,i=0;i<e.length;i++){var s=e.charAt(i);"{"==s?a="":null!=a&&"}"==s?(0<=(a=parseInt(a)-1)&&a<n.length&&t.push(n[a]),a=null):null!=a?a+=s:t.push(s)}e=t.join("")}return e}};function mxPoint(e,n){this.x=null!=e?e:0,this.y=null!=n?n:0}function mxRectangle(e,n,t,a){mxPoint.call(this,e,n),this.width=null!=t?t:0,this.height=null!=a?a:0}mxPoint.prototype.x=null,mxPoint.prototype.y=null,mxPoint.prototype.equals=function(e){return e.x==this.x&&e.y==this.y},mxPoint.prototype.clone=function(){return mxUtils.clone(this)},mxRectangle.prototype=new mxPoint,mxRectangle.prototype.constructor=mxRectangle,mxRectangle.prototype.width=null,mxRectangle.prototype.height=null,mxRectangle.prototype.setRect=function(e,n,t,a){this.x=e,this.y=n,this.width=t,this.height=a},mxRectangle.prototype.getCenterX=function(){return this.x+this.width/2},mxRectangle.prototype.getCenterY=function(){return this.y+this.height/2},mxRectangle.prototype.add=function(e){if(null!=e){var n=Math.min(this.x,e.x),t=Math.min(this.y,e.y),a=Math.max(this.x+this.width,e.x+e.width);e=Math.max(this.y+this.height,e.y+e.height),this.x=n,this.y=t,this.width=a-n,this.height=e-t}},mxRectangle.prototype.grow=function(e){this.x-=e,this.y-=e,this.width+=2*e,this.height+=2*e},mxRectangle.prototype.getPoint=function(){return new mxPoint(this.x,this.y)},mxRectangle.prototype.equals=function(e){return e.x==this.x&&e.y==this.y&&e.width==this.width&&e.height==this.height};var mxEffects={animateChanges:function(l,d,c){var m=0,u=function(){for(var e=!1,n=0;n<d.length;n++){var t=d[n];if(t instanceof mxGeometryChange||t instanceof mxTerminalChange||t instanceof mxValueChange||t instanceof mxChildChange||t instanceof mxStyleChange){var a=l.getView().getState(t.cell||t.child,!1);if(null!=a)if(e=!0,t.constructor!=mxGeometryChange||l.model.isEdge(t.cell))mxUtils.setOpacity(a.shape.node,100*m/10);else{var i=l.getView().scale,s=(t.geometry.x-t.previous.x)*i,o=(t.geometry.y-t.previous.y)*i,r=(t.geometry.width-t.previous.width)*i;i=(t.geometry.height-t.previous.height)*i;0==m?(a.x-=s,a.y-=o,a.width-=r,a.height-=i):(a.x+=s/10,a.y+=o/10,a.width+=r/10,a.height+=i/10),l.cellRenderer.redraw(a),mxEffects.cascadeOpacity(l,t.cell,100*m/10)}}}m<10&&e?(m++,window.setTimeout(u,p)):null!=c&&c()},p=30;u()},cascadeOpacity:function(e,n,t){for(var a=e.model.getChildCount(n),i=0;i<a;i++){var s=e.model.getChildAt(n,i),o=e.getView().getState(s);null!=o&&(mxUtils.setOpacity(o.shape.node,t),mxEffects.cascadeOpacity(e,s,t))}if(null!=(n=e.model.getEdges(n)))for(i=0;i<n.length;i++)null!=(a=e.getView().getState(n[i]))&&mxUtils.setOpacity(a.shape.node,t)},fadeOut:function(e,n,t,a,i,s){a=a||40,i=i||30;var o=n||100;if(mxUtils.setOpacity(e,o),s||null==s){var r=function(){o=Math.max(o-a,0),mxUtils.setOpacity(e,o),0<o?window.setTimeout(r,i):(e.style.visibility="hidden",t&&e.parentNode&&e.parentNode.removeChild(e))};window.setTimeout(r,i)}else e.style.visibility="hidden",t&&e.parentNode&&e.parentNode.removeChild(e)}},mxUtils={errorResource:"none"!=mxClient.language?"error":"",closeResource:"none"!=mxClient.language?"close":"",errorImage:mxClient.imageBasePath+"/error.gif",removeCursors:function(e){if(null!=e.style&&(e.style.cursor=""),null!=(e=e.childNodes))for(var n=e.length,t=0;t<n;t+=1)mxUtils.removeCursors(e[t])},getCurrentStyle:mxClient.IS_IE?function(e){return null!=e?e.currentStyle:null}:function(e){return null!=e?window.getComputedStyle(e,""):null},hasScrollbars:function(e){return null!=(e=mxUtils.getCurrentStyle(e))&&("scroll"==e.overflow||"auto"==e.overflow)},bind:function(e,n){return function(){return n.apply(e,arguments)}},eval:function(a){var b=null;if(0<=a.indexOf("function"))try{eval("var _mxJavaScriptExpression="+a),b=_mxJavaScriptExpression,_mxJavaScriptExpression=null}catch(e){mxLog.warn(e.message+" while evaluating "+a)}else try{b=eval(a)}catch(e){mxLog.warn(e.message+" while evaluating "+a)}return b},findNode:function(e,n,t){var a=e.getAttribute(n);if(null!=a&&a==t)return e;for(e=e.firstChild;null!=e;){if(null!=(a=mxUtils.findNode(e,n,t)))return a;e=e.nextSibling}return null},findNodeByAttribute:9<=document.documentMode?function(e,n,t){var a=null;if(null!=e)if(e.nodeType==mxConstants.NODETYPE_ELEMENT&&e.getAttribute(n)==t)a=e;else for(e=e.firstChild;null!=e&&null==a;)a=mxUtils.findNodeByAttribute(e,n,t),e=e.nextSibling;return a}:mxClient.IS_IE?function(e,n,t){return null==e?null:e.ownerDocument.selectSingleNode("//*[@"+n+"='"+t+"']")}:function(e,n,t){return null==e?null:e.ownerDocument.evaluate("//*[@"+n+"='"+t+"']",e.ownerDocument,null,XPathResult.ANY_TYPE,null).iterateNext()},getFunctionName:function(e){var n=null;if(null!=e)if(null!=e.name)n=e.name;else{for(e=e.toString(),n=9;" "==e.charAt(n);)n++;var t=e.indexOf("(",n);n=e.substring(n,t)}return n},indexOf:function(e,n){if(null!=e&&null!=n)for(var t=0;t<e.length;t++)if(e[t]==n)return t;return-1},remove:function(e,n){var t=null;if("object"==typeof n)for(var a=mxUtils.indexOf(n,e);0<=a;)n.splice(a,1),t=e,a=mxUtils.indexOf(n,e);for(var i in n)n[i]==e&&(delete n[i],t=e);return t},isNode:function(e,n,t,a){return!(null==e||isNaN(e.nodeType)||null!=n&&e.nodeName.toLowerCase()!=n.toLowerCase())&&(null==t||e.getAttribute(t)==a)},getChildNodes:function(e,n){n=n||mxConstants.NODETYPE_ELEMENT;for(var t=[],a=e.firstChild;null!=a;)a.nodeType==n&&t.push(a),a=a.nextSibling;return t},createXmlDocument:function(){var e=null;return document.implementation&&document.implementation.createDocument?e=document.implementation.createDocument("","",null):window.ActiveXObject&&(e=new ActiveXObject("Microsoft.XMLDOM")),e},parseXml:mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?function(e){var n=mxUtils.createXmlDocument();return n.async="false",n.loadXML(e),n}:function(e){return(new DOMParser).parseFromString(e,"text/xml")},clearSelection:document.selection?function(){document.selection.empty()}:window.getSelection?function(){window.getSelection().removeAllRanges()}:void 0,getPrettyXml:function(e,n,t){var a=[];if(null!=e)if(n=n||"  ",t=t||"",e.nodeType==mxConstants.NODETYPE_TEXT)a.push(e.nodeValue);else{a.push(t+"<"+e.nodeName);var i=e.attributes;if(null!=i)for(var s=0;s<i.length;s++){var o=mxUtils.htmlEntities(i[s].nodeValue);a.push(" "+i[s].nodeName+'="'+o+'"')}if(null!=(i=e.firstChild)){for(a.push(">\n");null!=i;)a.push(mxUtils.getPrettyXml(i,n,t+n)),i=i.nextSibling;a.push(t+"</"+e.nodeName+">\n")}else a.push("/>\n")}return a.join("")},removeWhitespace:function(e,n){for(var t=n?e.previousSibling:e.nextSibling;null!=t&&t.nodeType==mxConstants.NODETYPE_TEXT;){var a=n?t.previousSibling:t.nextSibling,i=mxUtils.getTextContent(t);0==mxUtils.trim(i).length&&t.parentNode.removeChild(t),t=a}},htmlEntities:function(e,n){return e=(e=(e=(e=(e=(e||"").replace(/&/g,"&amp;")).replace(/"/g,"&quot;")).replace(/\'/g,"&#39;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;"),(null==n||n)&&(e=e.replace(/\n/g,"&#xa;")),e},isVml:function(e){return null!=e&&"urn:schemas-microsoft-com:vml"==e.tagUrn},getXml:function(e,n){var t="";return null!=e&&(t=null==(t=e.xml)?e.innerHTML?e.innerHTML:(new XMLSerializer).serializeToString(e):t.replace(/\r\n\t[\t]*/g,"").replace(/>\r\n/g,">").replace(/\r\n/g,"\n")),t.replace(/\n/g,n||"&#xa;")},getTextContent:function(e){var n="";return null!=e&&(null!=e.firstChild&&(e=e.firstChild),n=e.nodeValue||""),n},getInnerHtml:mxClient.IS_IE?function(e){return null!=e?e.innerHTML:""}:function(e){return null!=e?(new XMLSerializer).serializeToString(e):""},getOuterHtml:mxClient.IS_IE?function(e){if(null==e)return"";if(null!=e.outerHTML)return e.outerHTML;var n=[];n.push("<"+e.nodeName);var t=e.attributes;if(null!=t)for(var a=0;a<t.length;a++){var i=t[a].nodeValue;null!=i&&0<i.length&&(n.push(" "),n.push(t[a].nodeName),n.push('="'),n.push(i),n.push('"'))}return 0==e.innerHTML.length?n.push("/>"):(n.push(">"),n.push(e.innerHTML),n.push("</"+e.nodeName+">")),n.join("")}:function(e){return null!=e?(new XMLSerializer).serializeToString(e):""},write:function(e,n){var t=e.ownerDocument.createTextNode(n);return null!=e&&e.appendChild(t),t},writeln:function(e,n){var t=e.ownerDocument.createTextNode(n);return null!=e&&(e.appendChild(t),e.appendChild(document.createElement("br"))),t},br:function(e,n){n=n||1;for(var t=null,a=0;a<n;a++)null!=e&&(t=e.ownerDocument.createElement("br"),e.appendChild(t));return t},button:function(e,n,t){return t=(t=null!=t?t:document).createElement("button"),mxUtils.write(t,e),mxEvent.addListener(t,"click",function(e){n(e)}),t},para:function(e,n){var t=document.createElement("p");return mxUtils.write(t,n),null!=e&&e.appendChild(t),t},addTransparentBackgroundFilter:function(e){e.style.filter+="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mxClient.imageBasePath+"/transparent.gif', sizingMethod='scale')"},linkAction:function(e,n,t,a,i){return mxUtils.link(e,n,function(){t.execute(a)},i)},linkInvoke:function(e,n,t,a,i,s){return mxUtils.link(e,n,function(){t[a](i)},s)},link:function(e,n,t,a){var i=document.createElement("span");return i.style.color="blue",i.style.textDecoration="underline",i.style.cursor="pointer",null!=a&&(i.style.paddingLeft=a+"px"),mxEvent.addListener(i,"click",t),mxUtils.write(i,n),null!=e&&e.appendChild(i),i},fit:function(e){var n=parseInt(e.offsetLeft),t=parseInt(e.offsetWidth),a=document.body,i=document.documentElement,s=(a.scrollLeft||i.scrollLeft)+(a.clientWidth||i.clientWidth);s<n+t&&(e.style.left=Math.max(a.scrollLeft||i.scrollLeft,s-t)+"px"),n=parseInt(e.offsetTop),t=parseInt(e.offsetHeight),(s=(a.scrollTop||i.scrollTop)+Math.max(a.clientHeight||0,i.clientHeight))<n+t&&(e.style.top=Math.max(a.scrollTop||i.scrollTop,s-t)+"px")},open:function(e){if(mxClient.IS_NS){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(e){return mxUtils.alert("Permission to read file denied."),""}var n=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);return n.initWithPath(e),n.exists()?((e=Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream)).init(n,1,4,null),(n=Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream)).init(e),n.read(n.available())):(mxUtils.alert("File not found."),"")}return e=(n=new ActiveXObject("Scripting.FileSystemObject").OpenTextFile(e,1)).readAll(),n.close(),e},save:function(e,n){if(mxClient.IS_NS){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(e){return void mxUtils.alert("Permission to write file denied.")}var t=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);t.initWithPath(e),t.exists()||t.create(0,420);var a=Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);a.init(t,34,4,null),a.write(n,n.length),a.flush(),a.close()}else(t=new ActiveXObject("Scripting.FileSystemObject").CreateTextFile(e,!0)).Write(n),t.Close()},saveAs:function(e){var n=document.createElement("iframe");n.setAttribute("src",""),n.style.visibility="hidden",document.body.appendChild(n);try{if(mxClient.IS_NS){var t=n.contentDocument;t.open(),t.write(e),t.close();try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"),n.focus(),saveDocument(t)}catch(e){mxUtils.alert("Permission to save document denied.")}}else(t=n.contentWindow.document).write(e),t.execCommand("SaveAs",!1,document.location)}finally{document.body.removeChild(n)}},copy:function(e){if(window.clipboardData)window.clipboardData.setData("Text",e);else{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");var n=Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);if(n){var t=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);if(t){t.addDataFlavor("text/unicode");var a=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);a.data=e,t.setTransferData("text/unicode",a,2*e.length),n.setData(t,null,Components.interfaces.nsIClipboard.kGlobalClipboard)}}}},load:function(e){return(e=new mxXmlRequest(e,null,"GET",!1)).send(),e},get:function(e,n,t){return new mxXmlRequest(e,null,"GET").send(n,t)},post:function(e,n,t,a){return new mxXmlRequest(e,n).send(t,a)},submit:function(e,n,t,a){return new mxXmlRequest(e,n).simulate(t,a)},loadInto:function(e,n,t){mxClient.IS_IE?n.onreadystatechange=function(){4==n.readyState&&t()}:n.addEventListener("load",t,!1),n.load(e)},getValue:function(e,n,t){return null==(e=null!=e?e[n]:null)&&(e=t),e},getNumber:function(e,n,t){return null==(e=null!=e?e[n]:null)&&(e=t||0),Number(e)},getColor:function(e,n,t){return null==(e=null!=e?e[n]:null)?e=t:e==mxConstants.NONE&&(e=null),e},clone:function(e,n,t){t=null!=t&&t;var a=null;if(null!=e&&"function"==typeof e.constructor){var i;a=new e.constructor;for(i in e)i!=mxObjectIdentity.FIELD_NAME&&(null==n||mxUtils.indexOf(n,i)<0)&&(a[i]=t||"object"!=typeof e[i]?e[i]:mxUtils.clone(e[i]))}return a},equalPoints:function(e,n){if(null==e&&null!=n||null!=e&&null==n||null!=e&&null!=n&&e.length!=n.length)return!1;if(null!=e&&null!=n)for(var t=0;t<e.length;t++)if(e[t]==n[t]||null!=e[t]&&!e[t].equals(n[t]))return!1;return!0},equalEntries:function(e,n){if(null==e&&null!=n||null!=e&&null==n||null!=e&&null!=n&&e.length!=n.length)return!1;if(null!=e&&null!=n)for(var t in e)if(e[t]!=n[t])return!1;return!0},extend:function(e,n){var t=function(){};t.prototype=n.prototype,e.prototype=new t,e.prototype.constructor=e},toString:function(e){var n,t="";for(n in e)try{if(null==e[n])t+=n+" = [null]\n";else if("function"==typeof e[n])t+=n+" => [Function]\n";else if("object"==typeof e[n])t=t+(n+" => [")+mxUtils.getFunctionName(e[n].constructor)+"]\n";else t+=n+" = "+e[n]+"\n"}catch(e){t+=n+"="+e.message}return t},toRadians:function(e){return Math.PI*e/180},arcToCurves:function(e,n,t,a,i,s,o,r,l){if(r-=e,l-=n,0===t||0===a)return h;t=Math.abs(t),a=Math.abs(a);var d=-r/2,c=-l/2,m=Math.cos(i*Math.PI/180);i=m*d+(h=Math.sin(i*Math.PI/180))*c;d=-1*h*d+m*c;r=m*(c=(s=1<(v=(c=i*i)/(g=t*t)+(p=d*d)/(A=a*a))?(t*=Math.sqrt(v),a*=Math.sqrt(v),0):(v=1,s===o&&(v=-1),v*Math.sqrt((g*A-g*p-A*c)/(g*p+A*c))))*t*d/a)-h*(p=-1*s*a*i/t)+r/2,l=h*c+m*p+l/2,s=0<=(g=Math.atan2((d-p)/a,(i-c)/t)-Math.atan2(0,1))?g:2*Math.PI+g,i=0<=(g=Math.atan2((-d-p)/a,(-i-c)/t)-Math.atan2((d-p)/a,(i-c)/t))?g:2*Math.PI+g,0==o&&0<i?i-=2*Math.PI:0!=o&&i<0&&(i+=2*Math.PI),o=2*i/Math.PI,i/=o=Math.ceil(o<0?-1*o:o),d=8/3*Math.sin(i/4)*Math.sin(i/4)/Math.sin(i/2),c=m*t,m*=a,t*=h,a*=h;for(var u=Math.cos(s),p=-d*(c*(b=Math.sin(s))+a*u),g=-d*(t*b-m*u),v=A=0,h=[],f=0;f<o;++f){s+=i;var b,A=c*(u=Math.cos(s))-a*(b=Math.sin(s))+r,E=(v=t*u+m*b+l,-d*(c*b+a*u));u=-d*(t*b-m*u);h[b=6*f]=Number(p+e),h[b+1]=Number(g+n),h[b+2]=Number(A-E+e),h[b+3]=Number(v-u+n),h[b+4]=Number(A+e),h[b+5]=Number(v+n),p=A+E,g=v+u}return h},getBoundingBox:function(e,n){var t=null;if(null!=e&&null!=n&&0!=n){var a=mxUtils.toRadians(n),i=(t=Math.cos(a),Math.sin(a)),s=new mxPoint(e.x+e.width/2,e.y+e.height/2),o=new mxPoint(e.x,e.y),r=new mxPoint((a=new mxPoint(e.x+e.width,e.y)).x,e.y+e.height),l=new mxPoint(e.x,r.y);o=mxUtils.getRotatedPoint(o,t,i,s),a=mxUtils.getRotatedPoint(a,t,i,s),r=mxUtils.getRotatedPoint(r,t,i,s),l=mxUtils.getRotatedPoint(l,t,i,s);(t=new mxRectangle(o.x,o.y,0,0)).add(new mxRectangle(a.x,a.y,0,0)),t.add(new mxRectangle(r.x,r.y,0,0)),t.add(new mxRectangle(l.x,l.y,0,0))}return t},getRotatedPoint:function(e,n,t,a){a=null!=a?a:new mxPoint;var i=e.x-a.x;return new mxPoint(i*n-(e=e.y-a.y)*t+a.x,e*n+i*t+a.y)},getPortConstraints:function(e,n,t,a){return null==(e=mxUtils.getValue(e.style,mxConstants.STYLE_PORT_CONSTRAINT,null))?a:(a=e.toString(),e=mxConstants.DIRECTION_MASK_NONE,0<=a.indexOf(mxConstants.DIRECTION_NORTH)&&(e|=mxConstants.DIRECTION_MASK_NORTH),0<=a.indexOf(mxConstants.DIRECTION_WEST)&&(e|=mxConstants.DIRECTION_MASK_WEST),0<=a.indexOf(mxConstants.DIRECTION_SOUTH)&&(e|=mxConstants.DIRECTION_MASK_SOUTH),0<=a.indexOf(mxConstants.DIRECTION_EAST)&&(e|=mxConstants.DIRECTION_MASK_EAST),e)},reversePortConstraints:function(e){return(e&mxConstants.DIRECTION_MASK_WEST)<<3|(e&mxConstants.DIRECTION_MASK_NORTH)<<1|(e&mxConstants.DIRECTION_MASK_SOUTH)>>1|(e&mxConstants.DIRECTION_MASK_EAST)>>3},findNearestSegment:function(e,n,t){var a=-1;if(0<e.absolutePoints.length)for(var i=e.absolutePoints[0],s=null,o=1;o<e.absolutePoints.length;o++){var r=e.absolutePoints[o];i=mxUtils.ptSegDistSq(i.x,i.y,r.x,r.y,n,t);(null==s||i<s)&&(s=i,a=o-1),i=r}return a},rectangleIntersectsSegment:function(e,n,t){var a=e.y,i=e.x,s=a+e.height,o=i+e.width;e=n.x;var r=t.x;if(n.x>t.x&&(e=t.x,r=n.x),o<r&&(r=o),e<i&&(e=i),r<e)return!1;i=n.y,o=t.y;var l=t.x-n.x;return 1e-7<Math.abs(l)&&(i=(t=(t.y-n.y)/l)*e+(n=n.y-t*n.x),o=t*r+n),o<i&&(n=o,o=i,i=n),s<o&&(o=s),i<a&&(i=a),!(o<i)},contains:function(e,n,t){return e.x<=n&&e.x+e.width>=n&&e.y<=t&&e.y+e.height>=t},intersects:function(e,n){var t=e.width,a=e.height,i=n.width,s=n.height;if(i<=0||s<=0||t<=0||a<=0)return!1;var o=e.x,r=e.y,l=n.x,d=n.y;s+=d,t+=o,a+=r;return((i=i+l)<l||o<i)&&(s<d||r<s)&&(t<o||l<t)&&(a<r||d<a)},intersectsHotspot:function(e,n,t,a,i,s){if(i=null!=i?i:0,s=null!=s?s:0,0<(a=null!=a?a:1)){var o=e.getCenterX(),r=e.getCenterY(),l=e.width,d=e.height,c=mxUtils.getValue(e.style,mxConstants.STYLE_STARTSIZE)*e.view.scale;return 0<c&&(mxUtils.getValue(e.style,mxConstants.STYLE_HORIZONTAL,!0)?(r=e.y+c/2,d=c):(o=e.x+c/2,l=c)),l=Math.max(i,l*a),d=Math.max(i,d*a),0<s&&(l=Math.min(l,s),d=Math.min(d,s)),a=new mxRectangle(o-l/2,r-d/2,l,d),0!=(o=mxUtils.toRadians(mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION)||0))&&(i=Math.cos(-o),s=Math.sin(-o),o=new mxPoint(e.getCenterX(),e.getCenterY()),n=(e=mxUtils.getRotatedPoint(new mxPoint(n,t),i,s,o)).x,t=e.y),mxUtils.contains(a,n,t)}return!0},getOffset:function(e,n){var t=0,a=0;if(null!=n&&n){var i=document.body,s=document.documentElement;t=t+(i.scrollLeft||s.scrollLeft),a=a+(i.scrollTop||s.scrollTop)}for(;e.offsetParent;)t+=e.offsetLeft,a+=e.offsetTop,e=e.offsetParent;return new mxPoint(t,a)},getScrollOrigin:function(e){for(var n=document.body,t=document.documentElement,a=new mxPoint(n.scrollLeft||t.scrollLeft,n.scrollTop||t.scrollTop);null!=e&&e!=n&&e!=t;)!isNaN(e.scrollLeft)&&!isNaN(e.scrollTop)&&(a.x+=e.scrollLeft,a.y+=e.scrollTop),e=e.parentNode;return a},convertPoint:function(e,n,t){var a=mxUtils.getScrollOrigin(e);return(e=mxUtils.getOffset(e)).x-=a.x,e.y-=a.y,new mxPoint(n-e.x,t-e.y)},ltrim:function(e,n){return e.replace(RegExp("^["+(n||"\\s")+"]+","g"),"")},rtrim:function(e,n){return e.replace(RegExp("["+(n||"\\s")+"]+$","g"),"")},trim:function(e,n){return mxUtils.ltrim(mxUtils.rtrim(e,n),n)},isNumeric:function(e){return null!=e&&(null==e.length||0<e.length&&e.indexOf("0x")<0&&e.indexOf("0X")<0)&&!isNaN(e)},mod:function(e,n){return(e%n+n)%n},intersection:function(e,n,t,a,i,s,o,r){var l=(r-s)*(t-e)-(o-i)*(a-n);return o=((o-i)*(n-s)-(r-s)*(e-i))/l,i=((t-e)*(n-s)-(a-n)*(e-i))/l,0<=o&&o<=1&&0<=i&&i<=1?new mxPoint(e+o*(t-e),n+o*(a-n)):null},ptSegDistSq:function(e,n,t,a,i,s){return t=(i-=e)*(t-=e)+(s-=n)*(a-=n)<=0?0:(e=(i=t-i)*t+(s=a-s)*a)<=0?0:e*e/(t*t+a*a),(i=i*i+s*s-t)<0&&(i=0),i},relativeCcw:function(e,n,t,a,i,s){return 0==(e=(i-=e)*(a-=n)-(s-=n)*(t-=e))&&(0<(e=i*t+s*a)&&((e=(i-t)*t+(s-a)*a)<0&&(e=0))),e<0?-1:0<e?1:0},animateChanges:function(e,n){mxEffects.animateChanges.apply(this,arguments)},cascadeOpacity:function(e,n,t){mxEffects.cascadeOpacity.apply(this,arguments)},fadeOut:function(e,n,t,a,i,s){mxEffects.fadeOut.apply(this,arguments)},setOpacity:function(e,n){mxUtils.isVml(e)?e.style.filter=100<=n?null:"alpha(opacity="+n/5+")":mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?e.style.filter=100<=n?null:"alpha(opacity="+n+")":e.style.opacity=n/100},createImage:function(e){var n=null;return mxClient.IS_IE6&&"CSS1Compat"!=document.compatMode?((n=document.createElement(mxClient.VML_PREFIX+":image")).setAttribute("src",e),n.style.borderStyle="none"):((n=document.createElement("img")).setAttribute("src",e),n.setAttribute("border","0")),n},sortCells:function(e,i){i=null==i||i;var s=new mxDictionary;return e.sort(function(e,n){var t=s.get(e);null==t&&(t=mxCellPath.create(e).split(mxCellPath.PATH_SEPARATOR),s.put(e,t));var a=s.get(n);return null==a&&(a=mxCellPath.create(n).split(mxCellPath.PATH_SEPARATOR),s.put(n,a)),0==(t=mxCellPath.compare(t,a))?0:0<t==i?1:-1}),e},getStylename:function(e){return null!=e&&(e=e.split(";")[0]).indexOf("=")<0?e:""},getStylenames:function(e){var n=[];if(null!=e){e=e.split(";");for(var t=0;t<e.length;t++)e[t].indexOf("=")<0&&n.push(e[t])}return n},indexOfStylename:function(e,n){if(null!=e&&null!=n)for(var t=e.split(";"),a=0,i=0;i<t.length;i++){if(t[i]==n)return a;a+=t[i].length+1}return-1},addStylename:function(e,n){return mxUtils.indexOfStylename(e,n)<0&&(null==e?e="":0<e.length&&";"!=e.charAt(e.length-1)&&(e+=";"),e+=n),e},removeStylename:function(e,n){var t=[];if(null!=e)for(var a=e.split(";"),i=0;i<a.length;i++)a[i]!=n&&t.push(a[i]);return t.join(";")},removeAllStylenames:function(e){var n=[];if(null!=e){e=e.split(";");for(var t=0;t<e.length;t++)0<=e[t].indexOf("=")&&n.push(e[t])}return n.join(";")},setCellStyles:function(e,n,t,a){if(null!=n&&0<n.length){e.beginUpdate();try{for(var i=0;i<n.length;i++)if(null!=n[i]){var s=mxUtils.setStyle(e.getStyle(n[i]),t,a);e.setStyle(n[i],s)}}finally{e.endUpdate()}}},setStyle:function(e,n,t){var a=null!=t&&(void 0===t.length||0<t.length);if(null==e||0==e.length)a&&(e=n+"="+t);else{var i=e.indexOf(n+"=");i<0?a&&(a=";"==e.charAt(e.length-1)?"":";",e=e+a+n+"="+t):(n=a?n+"="+t:"",t=e.indexOf(";",i),a||t++,e=e.substring(0,i)+n+(i<t?e.substring(t):""))}return e},setCellStyleFlags:function(e,n,t,a,i){if(null!=n&&0<n.length){e.beginUpdate();try{for(var s=0;s<n.length;s++)if(null!=n[s]){var o=mxUtils.setStyleFlag(e.getStyle(n[s]),t,a,i);e.setStyle(n[s],o)}}finally{e.endUpdate()}}},setStyleFlag:function(e,n,t,a){if(null==e||0==e.length)e=a||null==a?n+"="+t:n+"=0";else{var i=e.indexOf(n+"=");if(i<0)i=";"==e.charAt(e.length-1)?"":";",e=a||null==a?e+i+n+"="+t:e+i+n+"=0";else{var s=e.indexOf(";",i),o="";o=s<0?e.substring(i+n.length+1):e.substring(i+n.length+1,s),o=null==a?parseInt(o)^t:a?parseInt(o)|t:parseInt(o)&~t;e=e.substring(0,i)+n+"="+o+(0<=s?e.substring(s):"")}}return e},getAlignmentAsPoint:function(e,n){var t=0,a=0;return e==mxConstants.ALIGN_CENTER?t=-.5:e==mxConstants.ALIGN_RIGHT&&(t=-1),n==mxConstants.ALIGN_MIDDLE?a=-.5:n==mxConstants.ALIGN_BOTTOM&&(a=-1),new mxPoint(t,a)},getSizeForString:function(e,n,t){n=null!=n?n:mxConstants.DEFAULT_FONTSIZE,t=null!=t?t:mxConstants.DEFAULT_FONTFAMILY;var a=document.createElement("div");return a.style.fontFamily=t,a.style.fontSize=Math.round(n)+"px",a.style.lineHeight=Math.round(n*mxConstants.LINE_HEIGHT)+"px",a.style.position="absolute",a.style.whiteSpace="nowrap",a.style.visibility="hidden",a.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",a.style.zoom="1",a.innerHTML=e,document.body.appendChild(a),e=new mxRectangle(0,0,a.offsetWidth,a.offsetHeight),document.body.removeChild(a),e},getViewXml:function(e,n,t,a,i){a=null!=a?a:0,i=null!=i?i:0,n=null!=n?n:1,null==t&&(t=[e.getModel().getRoot()]);var s=e.getView(),o=null,r=s.isEventsEnabled();s.setEventsEnabled(!1);var l=s.drawPane,d=s.overlayPane;e.dialect==mxConstants.DIALECT_SVG?(s.drawPane=document.createElementNS(mxConstants.NS_SVG,"g"),s.canvas.appendChild(s.drawPane),s.overlayPane=document.createElementNS(mxConstants.NS_SVG,"g")):(s.drawPane=s.drawPane.cloneNode(!1),s.canvas.appendChild(s.drawPane),s.overlayPane=s.overlayPane.cloneNode(!1)),s.canvas.appendChild(s.overlayPane);var c=s.getTranslate();s.translate=new mxPoint(a,i),n=new mxTemporaryCellStates(e.getView(),n,t);try{o=(new mxCodec).encode(e.getView())}finally{n.destroy(),s.translate=c,s.canvas.removeChild(s.drawPane),s.canvas.removeChild(s.overlayPane),s.drawPane=l,s.overlayPane=d,s.setEventsEnabled(r)}return o},getScaleForPageCount:function(e,n,t,a){if(e<1)return 1;a=null!=a?a:0;var i=(t=null!=t?t:mxConstants.PAGE_FORMAT_A4_PORTRAIT).width-2*a;t=t.height-2*a,a=n.getGraphBounds().clone(),n=n.getView().getScale(),a.width/=n,a.height/=n,t=(n=a.width)/a.height/(i/t),a=Math.sqrt(e);var s=Math.sqrt(t);if(t=a*s,a/=s,t<1&&e<a){var o=a/e;a=e,t/=o}for(a<1&&e<t&&(o=t/e,t=e,a/=o),o=Math.ceil(t)*Math.ceil(a),s=0;e<o;){o=Math.floor(t)/t;var r=Math.floor(a)/a;if(1==o&&(o=Math.floor(t-1)/t),1==r&&(r=Math.floor(a-1)/a),t*=o=r<o?o:r,a*=o,o=Math.ceil(t)*Math.ceil(a),10<++s)break}return i*t/n*.99999},show:function(e,n,t,a){if(t=null!=t?t:0,a=null!=a?a:0,null==n?n=window.open().document:n.open(),t=-(i=e.getGraphBounds()).x+t,a=-i.y+a,mxClient.IS_IE){for(var i="<html><head>",s=document.getElementsByTagName("base"),o=0;o<s.length;o++)i+=s[o].outerHTML;for(i+="<style>",o=0;o<document.styleSheets.length;o++)try{i+=document.styleSheets(o).cssText}catch(e){}i+="</style></head>",i+="<body>",i+=e.container.innerHTML,i+="</body>",i+="<html>",n.writeln(i),n.close(),null!=(e=n.body.getElementsByTagName("DIV")[0])&&(e.style.position="absolute",e.style.left=t+"px",e.style.top=a+"px")}else{for(n.writeln("<html"),n.writeln("<head>"),s=document.getElementsByTagName("base"),o=0;o<s.length;o++)n.writeln(mxUtils.getOuterHtml(s[o]));for(s=document.getElementsByTagName("link"),o=0;o<s.length;o++)n.writeln(mxUtils.getOuterHtml(s[o]));for(s=document.getElementsByTagName("style"),o=0;o<s.length;o++)n.writeln(mxUtils.getOuterHtml(s[o]));for(n.writeln("</head>"),n.writeln("</html>"),n.close(),null==n.body&&n.documentElement.appendChild(n.createElement("body")),n.body.style.overflow="auto",e=e.container.firstChild;null!=e;)o=e.cloneNode(!0),n.body.appendChild(o),e=e.nextSibling;null!=(e=n.getElementsByTagName("g")[0])&&(e.setAttribute("transform","translate("+t+","+a+")"),(t=e.ownerSVGElement).setAttribute("width",i.width+Math.max(i.x,0)+3),t.setAttribute("height",i.height+Math.max(i.y,0)+3))}return mxUtils.removeCursors(n.body),n},printScreen:function(e){var n=window.open();mxUtils.show(e,n.document),e=function(){n.focus(),n.print(),n.close()},mxClient.IS_GC?n.setTimeout(e,500):e()},popup:function(e,n){if(n){var t=document.createElement("div");t.style.overflow="scroll",t.style.width="636px",t.style.height="460px";var a=document.createElement("pre");a.innerHTML=mxUtils.htmlEntities(e,!1).replace(/\n/g,"<br>").replace(/ /g,"&nbsp;"),t.appendChild(a),(t=new mxWindow("Popup Window",t,document.body.clientWidth/2-320,(document.body.clientHeight||document.documentElement.clientHeight)/2-240,640,480,!1,!0)).setClosable(!0),t.setVisible(!0)}else mxClient.IS_NS?((t=window.open()).document.writeln("<pre>"+mxUtils.htmlEntities(e)+"</pre"),t.document.close()):((a=(t=window.open()).document.createElement("pre")).innerHTML=mxUtils.htmlEntities(e,!1).replace(/\n/g,"<br>").replace(/ /g,"&nbsp;"),t.document.body.appendChild(a))},alert:function(e){alert(e)},prompt:function(e,n){return prompt(e,n)},confirm:function(e){return confirm(e)},error:function(e,n,t,a){var i=document.createElement("div");i.style.padding="20px";var s=document.createElement("img");s.setAttribute("src",a||mxUtils.errorImage),s.setAttribute("valign","bottom"),s.style.verticalAlign="middle",i.appendChild(s),i.appendChild(document.createTextNode(" ")),i.appendChild(document.createTextNode(" ")),i.appendChild(document.createTextNode(" ")),mxUtils.write(i,e),e=document.body.clientWidth,a=document.body.clientHeight||document.documentElement.clientHeight;var o=new mxWindow(mxResources.get(mxUtils.errorResource)||mxUtils.errorResource,i,(e-n)/2,a/4,n,null,!1,!0);return t&&(mxUtils.br(i),n=document.createElement("p"),t=document.createElement("button"),mxClient.IS_IE?t.style.cssText="float:right":t.setAttribute("style","float:right"),mxEvent.addListener(t,"click",function(e){o.destroy()}),mxUtils.write(t,mxResources.get(mxUtils.closeResource)||mxUtils.closeResource),n.appendChild(t),i.appendChild(n),mxUtils.br(i),o.setClosable(!0)),o.setVisible(!0),o},makeDraggable:function(e,n,t,i,a,s,o,r,l,d){return(e=new mxDragSource(e,t)).dragOffset=new mxPoint(null!=a?a:0,null!=s?s:mxConstants.TOOLTIP_VERTICAL_OFFSET),e.autoscroll=o,e.setGuidesEnabled(!1),null!=l&&(e.highlightDropTargets=l),null!=d&&(e.getDropTarget=d),e.getGraphForEvent=function(e){return"function"==typeof n?n(e):n},null!=i&&(e.createDragElement=function(){return i.cloneNode(!0)},r&&(e.createPreviewElement=function(e){var n=i.cloneNode(!0),t=parseInt(n.style.width),a=parseInt(n.style.height);return n.style.width=Math.round(t*e.view.scale)+"px",n.style.height=Math.round(a*e.view.scale)+"px",n})),e}},mxConstants={DEFAULT_HOTSPOT:.3,MIN_HOTSPOT_SIZE:8,MAX_HOTSPOT_SIZE:0,RENDERING_HINT_EXACT:"exact",RENDERING_HINT_FASTER:"faster",RENDERING_HINT_FASTEST:"fastest",DIALECT_SVG:"svg",DIALECT_VML:"vml",DIALECT_MIXEDHTML:"mixedHtml",DIALECT_PREFERHTML:"preferHtml",DIALECT_STRICTHTML:"strictHtml",NS_SVG:"http://www.w3.org/2000/svg",NS_XHTML:"http://www.w3.org/1999/xhtml",NS_XLINK:"http://www.w3.org/1999/xlink",SHADOWCOLOR:"gray",SHADOW_OFFSET_X:2,SHADOW_OFFSET_Y:3,SHADOW_OPACITY:1,NODETYPE_ELEMENT:1,NODETYPE_ATTRIBUTE:2,NODETYPE_TEXT:3,NODETYPE_CDATA:4,NODETYPE_ENTITY_REFERENCE:5,NODETYPE_ENTITY:6,NODETYPE_PROCESSING_INSTRUCTION:7,NODETYPE_COMMENT:8,NODETYPE_DOCUMENT:9,NODETYPE_DOCUMENTTYPE:10,NODETYPE_DOCUMENT_FRAGMENT:11,NODETYPE_NOTATION:12,TOOLTIP_VERTICAL_OFFSET:16,DEFAULT_VALID_COLOR:"#00FF00",DEFAULT_INVALID_COLOR:"#FF0000",HIGHLIGHT_STROKEWIDTH:3,CURSOR_MOVABLE_VERTEX:"move",CURSOR_MOVABLE_EDGE:"move",CURSOR_LABEL_HANDLE:"default",CURSOR_BEND_HANDLE:"pointer",CURSOR_CONNECT:"pointer",HIGHLIGHT_COLOR:"#00FF00",CONNECT_TARGET_COLOR:"#0000FF",INVALID_CONNECT_TARGET_COLOR:"#FF0000",DROP_TARGET_COLOR:"#0000FF",VALID_COLOR:"#00FF00",INVALID_COLOR:"#FF0000",EDGE_SELECTION_COLOR:"#00FF00",VERTEX_SELECTION_COLOR:"#00FF00",VERTEX_SELECTION_STROKEWIDTH:1,EDGE_SELECTION_STROKEWIDTH:1,VERTEX_SELECTION_DASHED:!0,EDGE_SELECTION_DASHED:!0,GUIDE_COLOR:"#FF0000",GUIDE_STROKEWIDTH:1,OUTLINE_COLOR:"#0099FF",OUTLINE_STROKEWIDTH:mxClient.IS_IE?2:3,HANDLE_SIZE:7,LABEL_HANDLE_SIZE:4,HANDLE_FILLCOLOR:"#00FF00",HANDLE_STROKECOLOR:"black",LABEL_HANDLE_FILLCOLOR:"yellow",CONNECT_HANDLE_FILLCOLOR:"#0000FF",LOCKED_HANDLE_FILLCOLOR:"#FF0000",OUTLINE_HANDLE_FILLCOLOR:"#00FFFF",OUTLINE_HANDLE_STROKECOLOR:"#0033FF",DEFAULT_FONTFAMILY:"Arial,Helvetica",DEFAULT_FONTSIZE:11,LINE_HEIGHT:1.2,DEFAULT_FONTSTYLE:0,DEFAULT_STARTSIZE:40,DEFAULT_MARKERSIZE:6,DEFAULT_IMAGESIZE:24,ENTITY_SEGMENT:30,RECTANGLE_ROUNDING_FACTOR:.15,LINE_ARCSIZE:20,ARROW_SPACING:10,ARROW_WIDTH:30,ARROW_SIZE:30,PAGE_FORMAT_A4_PORTRAIT:new mxRectangle(0,0,826,1169),PAGE_FORMAT_A4_LANDSCAPE:new mxRectangle(0,0,1169,826),PAGE_FORMAT_LETTER_PORTRAIT:new mxRectangle(0,0,850,1100),PAGE_FORMAT_LETTER_LANDSCAPE:new mxRectangle(0,0,1100,850),NONE:"none",STYLE_PERIMETER:"perimeter",STYLE_SOURCE_PORT:"sourcePort",STYLE_TARGET_PORT:"targetPort",STYLE_PORT_CONSTRAINT:"portConstraint",STYLE_OPACITY:"opacity",STYLE_TEXT_OPACITY:"textOpacity",STYLE_OVERFLOW:"overflow",STYLE_ORTHOGONAL:"orthogonal",STYLE_EXIT_X:"exitX",STYLE_EXIT_Y:"exitY",STYLE_EXIT_PERIMETER:"exitPerimeter",STYLE_ENTRY_X:"entryX",STYLE_ENTRY_Y:"entryY",STYLE_ENTRY_PERIMETER:"entryPerimeter",STYLE_WHITE_SPACE:"whiteSpace",STYLE_ROTATION:"rotation",STYLE_FILLCOLOR:"fillColor",STYLE_SWIMLANE_FILLCOLOR:"swimlaneFillColor",STYLE_GRADIENTCOLOR:"gradientColor",STYLE_GRADIENT_DIRECTION:"gradientDirection",STYLE_STROKECOLOR:"strokeColor",STYLE_SEPARATORCOLOR:"separatorColor",STYLE_STROKEWIDTH:"strokeWidth",STYLE_ALIGN:"align",STYLE_VERTICAL_ALIGN:"verticalAlign",STYLE_LABEL_POSITION:"labelPosition",STYLE_VERTICAL_LABEL_POSITION:"verticalLabelPosition",STYLE_IMAGE_ASPECT:"imageAspect",STYLE_IMAGE_ALIGN:"imageAlign",STYLE_IMAGE_VERTICAL_ALIGN:"imageVerticalAlign",STYLE_GLASS:"glass",STYLE_IMAGE:"image",STYLE_IMAGE_WIDTH:"imageWidth",STYLE_IMAGE_HEIGHT:"imageHeight",STYLE_IMAGE_BACKGROUND:"imageBackground",STYLE_IMAGE_BORDER:"imageBorder",STYLE_FLIPH:"flipH",STYLE_FLIPV:"flipV",STYLE_NOLABEL:"noLabel",STYLE_NOEDGESTYLE:"noEdgeStyle",STYLE_LABEL_BACKGROUNDCOLOR:"labelBackgroundColor",STYLE_LABEL_BORDERCOLOR:"labelBorderColor",STYLE_LABEL_PADDING:"labelPadding",STYLE_INDICATOR_SHAPE:"indicatorShape",STYLE_INDICATOR_IMAGE:"indicatorImage",STYLE_INDICATOR_COLOR:"indicatorColor",STYLE_INDICATOR_STROKECOLOR:"indicatorStrokeColor",STYLE_INDICATOR_GRADIENTCOLOR:"indicatorGradientColor",STYLE_INDICATOR_SPACING:"indicatorSpacing",STYLE_INDICATOR_WIDTH:"indicatorWidth",STYLE_INDICATOR_HEIGHT:"indicatorHeight",STYLE_INDICATOR_DIRECTION:"indicatorDirection",STYLE_SHADOW:"shadow",STYLE_SEGMENT:"segment",STYLE_ENDARROW:"endArrow",STYLE_STARTARROW:"startArrow",STYLE_ENDSIZE:"endSize",STYLE_STARTSIZE:"startSize",STYLE_SWIMLANE_LINE:"swimlaneLine",STYLE_ENDFILL:"endFill",STYLE_STARTFILL:"startFill",STYLE_DASHED:"dashed",STYLE_DASH_PATTERN:"dashPattern",STYLE_ROUNDED:"rounded",STYLE_CURVED:"curved",STYLE_ARCSIZE:"arcSize",STYLE_SMOOTH:"smooth",STYLE_SOURCE_PERIMETER_SPACING:"sourcePerimeterSpacing",STYLE_TARGET_PERIMETER_SPACING:"targetPerimeterSpacing",STYLE_PERIMETER_SPACING:"perimeterSpacing",STYLE_SPACING:"spacing",STYLE_SPACING_TOP:"spacingTop",STYLE_SPACING_LEFT:"spacingLeft",STYLE_SPACING_BOTTOM:"spacingBottom",STYLE_SPACING_RIGHT:"spacingRight",STYLE_HORIZONTAL:"horizontal",STYLE_DIRECTION:"direction",STYLE_ELBOW:"elbow",STYLE_FONTCOLOR:"fontColor",STYLE_FONTFAMILY:"fontFamily",STYLE_FONTSIZE:"fontSize",STYLE_FONTSTYLE:"fontStyle",STYLE_AUTOSIZE:"autosize",STYLE_FOLDABLE:"foldable",STYLE_EDITABLE:"editable",STYLE_BENDABLE:"bendable",STYLE_MOVABLE:"movable",STYLE_RESIZABLE:"resizable",STYLE_CLONEABLE:"cloneable",STYLE_DELETABLE:"deletable",STYLE_SHAPE:"shape",STYLE_EDGE:"edgeStyle",STYLE_LOOP:"loopStyle",STYLE_ROUTING_CENTER_X:"routingCenterX",STYLE_ROUTING_CENTER_Y:"routingCenterY",FONT_BOLD:1,FONT_ITALIC:2,FONT_UNDERLINE:4,FONT_SHADOW:8,SHAPE_RECTANGLE:"rectangle",SHAPE_ELLIPSE:"ellipse",SHAPE_DOUBLE_ELLIPSE:"doubleEllipse",SHAPE_RHOMBUS:"rhombus",SHAPE_LINE:"line",SHAPE_IMAGE:"image",SHAPE_ARROW:"arrow",SHAPE_LABEL:"label",SHAPE_CYLINDER:"cylinder",SHAPE_SWIMLANE:"swimlane",SHAPE_CONNECTOR:"connector",SHAPE_ACTOR:"actor",SHAPE_CLOUD:"cloud",SHAPE_TRIANGLE:"triangle",SHAPE_HEXAGON:"hexagon",ARROW_CLASSIC:"classic",ARROW_BLOCK:"block",ARROW_OPEN:"open",ARROW_OVAL:"oval",ARROW_DIAMOND:"diamond",ARROW_DIAMOND_THIN:"diamondThin",ALIGN_LEFT:"left",ALIGN_CENTER:"center",ALIGN_RIGHT:"right",ALIGN_TOP:"top",ALIGN_MIDDLE:"middle",ALIGN_BOTTOM:"bottom",DIRECTION_NORTH:"north",DIRECTION_SOUTH:"south",DIRECTION_EAST:"east",DIRECTION_WEST:"west",DIRECTION_MASK_NONE:0,DIRECTION_MASK_WEST:1,DIRECTION_MASK_NORTH:2,DIRECTION_MASK_SOUTH:4,DIRECTION_MASK_EAST:8,DIRECTION_MASK_ALL:15,ELBOW_VERTICAL:"vertical",ELBOW_HORIZONTAL:"horizontal",EDGESTYLE_ELBOW:"elbowEdgeStyle",EDGESTYLE_ENTITY_RELATION:"entityRelationEdgeStyle",EDGESTYLE_LOOP:"loopEdgeStyle",EDGESTYLE_SIDETOSIDE:"sideToSideEdgeStyle",EDGESTYLE_TOPTOBOTTOM:"topToBottomEdgeStyle",EDGESTYLE_ORTHOGONAL:"orthogonalEdgeStyle",EDGESTYLE_SEGMENT:"segmentEdgeStyle",PERIMETER_ELLIPSE:"ellipsePerimeter",PERIMETER_RECTANGLE:"rectanglePerimeter",PERIMETER_RHOMBUS:"rhombusPerimeter",PERIMETER_TRIANGLE:"trianglePerimeter"};function mxEventObject(e){this.name=e,this.properties=[];for(var n=1;n<arguments.length;n+=2)null!=arguments[n+1]&&(this.properties[arguments[n]]=arguments[n+1])}function mxMouseEvent(e,n){this.evt=e,this.state=n}function mxEventSource(e){this.setEventSource(e)}mxEventObject.prototype.name=null,mxEventObject.prototype.properties=null,mxEventObject.prototype.consumed=!1,mxEventObject.prototype.getName=function(){return this.name},mxEventObject.prototype.getProperties=function(){return this.properties},mxEventObject.prototype.getProperty=function(e){return this.properties[e]},mxEventObject.prototype.isConsumed=function(){return this.consumed},mxEventObject.prototype.consume=function(){this.consumed=!0},mxMouseEvent.prototype.consumed=!1,mxMouseEvent.prototype.evt=null,mxMouseEvent.prototype.graphX=null,mxMouseEvent.prototype.graphY=null,mxMouseEvent.prototype.state=null,mxMouseEvent.prototype.getEvent=function(){return this.evt},mxMouseEvent.prototype.getSource=function(){return mxEvent.getSource(this.evt)},mxMouseEvent.prototype.isSource=function(e){if(null!=e)for(var n=this.getSource();null!=n;){if(n==e.node)return!0;n=n.parentNode}return!1},mxMouseEvent.prototype.getX=function(){return mxEvent.getClientX(this.getEvent())},mxMouseEvent.prototype.getY=function(){return mxEvent.getClientY(this.getEvent())},mxMouseEvent.prototype.getGraphX=function(){return this.graphX},mxMouseEvent.prototype.getGraphY=function(){return this.graphY},mxMouseEvent.prototype.getState=function(){return this.state},mxMouseEvent.prototype.getCell=function(){var e=this.getState();return null!=e?e.cell:null},mxMouseEvent.prototype.isPopupTrigger=function(){return mxEvent.isPopupTrigger(this.getEvent())},mxMouseEvent.prototype.isConsumed=function(){return this.consumed},mxMouseEvent.prototype.consume=function(e){(null==e||e)&&this.evt.preventDefault&&this.evt.preventDefault(),this.evt.returnValue=!1,this.consumed=!0},mxEventSource.prototype.eventListeners=null,mxEventSource.prototype.eventsEnabled=!0,mxEventSource.prototype.eventSource=null,mxEventSource.prototype.isEventsEnabled=function(){return this.eventsEnabled},mxEventSource.prototype.setEventsEnabled=function(e){this.eventsEnabled=e},mxEventSource.prototype.getEventSource=function(){return this.eventSource},mxEventSource.prototype.setEventSource=function(e){this.eventSource=e},mxEventSource.prototype.addListener=function(e,n){null==this.eventListeners&&(this.eventListeners=[]),this.eventListeners.push(e),this.eventListeners.push(n)},mxEventSource.prototype.removeListener=function(e){if(null!=this.eventListeners)for(var n=0;n<this.eventListeners.length;)this.eventListeners[n+1]==e?this.eventListeners.splice(n,2):n+=2},mxEventSource.prototype.fireEvent=function(e,n){if(null!=this.eventListeners&&this.isEventsEnabled()){null==e&&(e=new mxEventObject),null==n&&(n=this.getEventSource()),null==n&&(n=this);for(var t=[n,e],a=0;a<this.eventListeners.length;a+=2){var i=this.eventListeners[a];(null==i||i==e.getName())&&this.eventListeners[a+1].apply(this,t)}}};var mxEvent={objects:[],addListener:function(){var a=function(e,n,t){null==e.mxListenerList&&(e.mxListenerList=[],mxEvent.objects.push(e)),e.mxListenerList.push({name:n,f:t})};return window.addEventListener?function(e,n,t){e.addEventListener(n,t,!1),a(e,n,t)}:function(e,n,t){e.attachEvent("on"+n,t),a(e,n,t)}}(),removeListener:function(){var a=function(e,n,t){if(null!=e.mxListenerList){n=e.mxListenerList.length;for(var a=0;a<n;a++)if(e.mxListenerList[a].f==t){e.mxListenerList.splice(a,1);break}0==e.mxListenerList.length&&(e.mxListenerList=null)}};return window.removeEventListener?function(e,n,t){e.removeEventListener(n,t,!1),a(e,n,t)}:function(e,n,t){e.detachEvent("on"+n,t),a(e,n,t)}}(),removeAllListeners:function(e){var n=e.mxListenerList;if(null!=n)for(;0<n.length;){var t=n[0];mxEvent.removeListener(e,t.name,t.f)}},addGestureListeners:function(e,n,t,a){null!=n&&mxEvent.addListener(e,"mousedown",n),null!=t&&mxEvent.addListener(e,"mousemove",t),null!=a&&mxEvent.addListener(e,"mouseup",a),mxClient.IS_TOUCH&&(null!=n&&mxEvent.addListener(e,"touchstart",n),null!=t&&mxEvent.addListener(e,"touchmove",t),null!=a&&mxEvent.addListener(e,"touchend",a))},removeGestureListeners:function(e,n,t,a){null!=n&&mxEvent.removeListener(e,"mousedown",n),null!=t&&mxEvent.removeListener(e,"mousemove",t),null!=a&&mxEvent.removeListener(e,"mouseup",a),mxClient.IS_TOUCH&&(null!=n&&mxEvent.removeListener(e,"touchstart",n),null!=t&&mxEvent.removeListener(e,"touchmove",t),null!=a&&mxEvent.removeListener(e,"touchend",a))},redirectMouseEvents:function(e,t,n,a,i,s,o){var r=function(e){return"function"==typeof n?n(e):n};mxEvent.addGestureListeners(e,function(e){null!=a?a(e):mxEvent.isConsumed(e)||t.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,r(e)))},function(e){null!=i?i(e):mxEvent.isConsumed(e)||t.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,r(e)))},function(e){null!=s?s(e):mxEvent.isConsumed(e)||t.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,r(e)))}),mxEvent.addListener(e,"dblclick",function(e){if(null!=o)o(e);else if(!mxEvent.isConsumed(e)){var n=r(e);t.dblClick(e,null!=n?n.cell:null)}})},release:function(e){if(null!=e&&(mxEvent.removeAllListeners(e),null!=(e=e.childNodes)))for(var n=e.length,t=0;t<n;t+=1)mxEvent.release(e[t])},addMouseWheelListener:function(t){if(null!=t){var e=function(e){null==e&&(e=window.event);var n=0;0!=(n=!mxClient.IS_NS||mxClient.IS_SF||mxClient.IS_GC?e.wheelDelta/120:-e.detail/2)&&t(e,0<n)};mxClient.IS_NS?mxEvent.addListener(window,mxClient.IS_SF||mxClient.IS_GC?"mousewheel":"DOMMouseScroll",e):mxEvent.addListener(document,"mousewheel",e)}},disableContextMenu:mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?function(e){mxEvent.addListener(e,"contextmenu",function(){return!1})}:function(e){e.setAttribute("oncontextmenu","return false;")},getSource:function(e){return null!=e.srcElement?e.srcElement:e.target},isConsumed:function(e){return null!=e.isConsumed&&e.isConsumed},isLeftMouseButton:function(e){return e.button==(mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?1:0)},isRightMouseButton:function(e){return 2==e.button},isPopupTrigger:function(e){return mxEvent.isRightMouseButton(e)||mxEvent.isShiftDown(e)&&!mxEvent.isControlDown(e)},isShiftDown:function(e){return null!=e&&e.shiftKey},isAltDown:function(e){return null!=e&&e.altKey},isControlDown:function(e){return null!=e&&e.ctrlKey},isMetaDown:function(e){return null!=e&&e.metaKey},getMainEvent:function(e){return"touchstart"!=e.type&&"touchmove"!=e.type||null==e.touches||null==e.touches[0]?"touchend"==e.type&&null!=e.changedTouches&&null!=e.changedTouches[0]&&(e=e.changedTouches[0]):e=e.touches[0],e},getClientX:function(e){return mxEvent.getMainEvent(e).clientX},getClientY:function(e){return mxEvent.getMainEvent(e).clientY},consume:function(e,n,t){t=null==t||t,(null==n||n)&&(e.preventDefault?(t&&e.stopPropagation(),e.preventDefault()):t&&(e.cancelBubble=!0)),e.isConsumed=!0,e.returnValue=!1},LABEL_HANDLE:-1,ROTATION_HANDLE:-2,MOUSE_DOWN:"mouseDown",MOUSE_MOVE:"mouseMove",MOUSE_UP:"mouseUp",ACTIVATE:"activate",RESIZE_START:"resizeStart",RESIZE:"resize",RESIZE_END:"resizeEnd",MOVE_START:"moveStart",MOVE:"move",MOVE_END:"moveEnd",PAN_START:"panStart",PAN:"pan",PAN_END:"panEnd",MINIMIZE:"minimize",NORMALIZE:"normalize",MAXIMIZE:"maximize",HIDE:"hide",SHOW:"show",CLOSE:"close",DESTROY:"destroy",REFRESH:"refresh",SIZE:"size",SELECT:"select",FIRED:"fired",GET:"get",RECEIVE:"receive",CONNECT:"connect",DISCONNECT:"disconnect",SUSPEND:"suspend",RESUME:"resume",MARK:"mark",SESSION:"session",ROOT:"root",POST:"post",OPEN:"open",SAVE:"save",BEFORE_ADD_VERTEX:"beforeAddVertex",ADD_VERTEX:"addVertex",AFTER_ADD_VERTEX:"afterAddVertex",DONE:"done",EXECUTE:"execute",EXECUTED:"executed",BEGIN_UPDATE:"beginUpdate",START_EDIT:"startEdit",END_UPDATE:"endUpdate",END_EDIT:"endEdit",BEFORE_UNDO:"beforeUndo",UNDO:"undo",REDO:"redo",CHANGE:"change",NOTIFY:"notify",LAYOUT_CELLS:"layoutCells",CLICK:"click",SCALE:"scale",TRANSLATE:"translate",SCALE_AND_TRANSLATE:"scaleAndTranslate",UP:"up",DOWN:"down",ADD:"add",REMOVE:"remove",CLEAR:"clear",ADD_CELLS:"addCells",CELLS_ADDED:"cellsAdded",MOVE_CELLS:"moveCells",CELLS_MOVED:"cellsMoved",RESIZE_CELLS:"resizeCells",CELLS_RESIZED:"cellsResized",TOGGLE_CELLS:"toggleCells",CELLS_TOGGLED:"cellsToggled",ORDER_CELLS:"orderCells",CELLS_ORDERED:"cellsOrdered",REMOVE_CELLS:"removeCells",CELLS_REMOVED:"cellsRemoved",GROUP_CELLS:"groupCells",UNGROUP_CELLS:"ungroupCells",REMOVE_CELLS_FROM_PARENT:"removeCellsFromParent",FOLD_CELLS:"foldCells",CELLS_FOLDED:"cellsFolded",ALIGN_CELLS:"alignCells",LABEL_CHANGED:"labelChanged",CONNECT_CELL:"connectCell",CELL_CONNECTED:"cellConnected",SPLIT_EDGE:"splitEdge",FLIP_EDGE:"flipEdge",START_EDITING:"startEditing",ADD_OVERLAY:"addOverlay",REMOVE_OVERLAY:"removeOverlay",UPDATE_CELL_SIZE:"updateCellSize",ESCAPE:"escape",CLICK:"click",DOUBLE_CLICK:"doubleClick",START:"start",RESET:"reset"};function mxXmlRequest(e,n,t,a,i,s){this.url=e,this.params=n,this.method=t||"POST",this.async=null==a||a,this.username=i,this.password=s}mxXmlRequest.prototype.url=null,mxXmlRequest.prototype.params=null,mxXmlRequest.prototype.method=null,mxXmlRequest.prototype.async=null,mxXmlRequest.prototype.binary=!1,mxXmlRequest.prototype.username=null,mxXmlRequest.prototype.password=null,mxXmlRequest.prototype.request=null,mxXmlRequest.prototype.isBinary=function(){return this.binary},mxXmlRequest.prototype.setBinary=function(e){this.binary=e},mxXmlRequest.prototype.getText=function(){return this.request.responseText},mxXmlRequest.prototype.isReady=function(){return 4==this.request.readyState},mxXmlRequest.prototype.getDocumentElement=function(){var e=this.getXml();return null!=e?e.documentElement:null},mxXmlRequest.prototype.getXml=function(){var e=this.request.responseXML;return(9<=document.documentMode||null==e||null==e.documentElement)&&(e=mxUtils.parseXml(this.request.responseText)),e},mxXmlRequest.prototype.getText=function(){return this.request.responseText},mxXmlRequest.prototype.getStatus=function(){return this.request.status},mxXmlRequest.prototype.create=window.XMLHttpRequest?function(){var e=new XMLHttpRequest;return this.isBinary()&&e.overrideMimeType&&e.overrideMimeType("text/plain; charset=x-user-defined"),e}:"undefined"!=typeof ActiveXObject?function(){return new ActiveXObject("Microsoft.XMLHTTP")}:void 0,mxXmlRequest.prototype.send=function(e,n){this.request=this.create(),null!=this.request&&(null!=e&&(this.request.onreadystatechange=mxUtils.bind(this,function(){this.isReady()&&(e(this),this.onreadystatechaange=null)})),this.request.open(this.method,this.url,this.async,this.username,this.password),this.setRequestHeaders(this.request,this.params),this.request.send(this.params))},mxXmlRequest.prototype.setRequestHeaders=function(e,n){null!=n&&e.setRequestHeader("Content-Type","application/x-www-form-urlencoded")},mxXmlRequest.prototype.simulate=function(e,n){var t=null;(e=e||document)==document&&(t=window.onbeforeunload,window.onbeforeunload=null);var a=e.createElement("form");a.setAttribute("method",this.method),a.setAttribute("action",this.url),null!=n&&a.setAttribute("target",n),a.style.display="none",a.style.visibility="hidden";for(var i=0<this.params.indexOf("&")?this.params.split("&"):this.params.split(),s=0;s<i.length;s++){if(0<(o=i[s].indexOf("="))){var o,r=i[s].substring(0,o),l=i[s].substring(o+1);(o=e.createElement("textarea")).setAttribute("name",r),l=l.replace(/\n/g,"&#xa;"),r=e.createTextNode(l),o.appendChild(r),a.appendChild(o)}}e.body.appendChild(a),a.submit(),e.body.removeChild(a),null!=t&&(window.onbeforeunload=t)};var mxClipboard={STEPSIZE:10,insertCount:1,cells:null,isEmpty:function(){return null==mxClipboard.cells},cut:function(e,n){return n=mxClipboard.copy(e,n),mxClipboard.insertCount=0,mxClipboard.removeCells(e,n),n},removeCells:function(e,n){e.removeCells(n)},copy:function(e,n){n=n||e.getSelectionCells();var t=e.getExportableCells(n);return mxClipboard.insertCount=1,mxClipboard.cells=e.cloneCells(t),t},paste:function(e){if(null!=mxClipboard.cells){var n=e.getImportableCells(mxClipboard.cells),t=mxClipboard.insertCount*mxClipboard.STEPSIZE,a=e.getDefaultParent();n=e.importCells(n,t,t,a);mxClipboard.insertCount++,e.setSelectionCells(n)}}};function mxWindow(e,n,t,a,i,s,o,r,l,d){null!=n&&(o=null==o||o,this.content=n,this.init(t,a,i,s,d),this.installMaximizeHandler(),this.installMinimizeHandler(),this.installCloseHandler(),this.setMinimizable(o),this.setTitle(e),(null==r||r)&&this.installMoveHandler(),null!=l&&null!=l.parentNode?l.parentNode.replaceChild(this.div,l):document.body.appendChild(this.div))}function mxForm(e){this.table=document.createElement("table"),this.table.className=e,this.body=document.createElement("tbody"),this.table.appendChild(this.body)}function mxImage(e,n,t){this.src=e,this.width=n,this.height=t}function mxDivResizer(e,n){if("div"==e.nodeName.toLowerCase()){null==n&&(n=window),this.div=e;var t=mxUtils.getCurrentStyle(e);null!=t&&(this.resizeWidth="auto"==t.width,this.resizeHeight="auto"==t.height),mxEvent.addListener(n,"resize",mxUtils.bind(this,function(e){this.handlingResize||(this.handlingResize=!0,this.resize(),this.handlingResize=!1)})),this.resize()}}function mxDragSource(e,n){this.element=e,this.dropHandler=n,mxEvent.addGestureListeners(e,mxUtils.bind(this,this.mouseDown))}function mxToolbar(e){this.container=e}function mxSession(n,e,t,a){this.model=n,this.urlInit=e,this.urlPoll=t,this.urlNotify=a,null!=n&&(this.codec=new mxCodec,this.codec.lookup=function(e){return n.getCell(e)}),n.addListener(mxEvent.NOTIFY,mxUtils.bind(this,function(e,n){var t=n.getProperty("edit");(null!=t&&this.debug||this.connected&&!this.suspended)&&this.notify("<edit>"+this.encodeChanges(t.changes,t.undone)+"</edit>")}))}function mxUndoableEdit(e,n){this.source=e,this.changes=[],this.significant=null==n||n}function mxUndoManager(e){this.size=null!=e?e:100,this.clear()}mxWindow.prototype=new mxEventSource,mxWindow.prototype.constructor=mxWindow,mxWindow.prototype.closeImage=mxClient.imageBasePath+"/close.gif",mxWindow.prototype.minimizeImage=mxClient.imageBasePath+"/minimize.gif",mxWindow.prototype.normalizeImage=mxClient.imageBasePath+"/normalize.gif",mxWindow.prototype.maximizeImage=mxClient.imageBasePath+"/maximize.gif",mxWindow.prototype.resizeImage=mxClient.imageBasePath+"/resize.gif",mxWindow.prototype.visible=!1,mxWindow.prototype.content=!1,mxWindow.prototype.minimumSize=new mxRectangle(0,0,50,40),mxWindow.prototype.title=!1,mxWindow.prototype.content=!1,mxWindow.prototype.destroyOnClose=!0,mxWindow.prototype.init=function(e,n,t,a,i){i=null!=i?i:"mxWindow",this.div=document.createElement("div"),this.div.className=i,this.div.style.left=e+"px",this.div.style.top=n+"px",this.table=document.createElement("table"),this.table.className=i,null!=t&&(mxClient.IS_IE||(this.div.style.width=t+"px"),this.table.style.width=t+"px"),null!=a&&(mxClient.IS_IE||(this.div.style.height=a+"px"),this.table.style.height=a+"px"),e=document.createElement("tbody"),n=document.createElement("tr"),this.title=document.createElement("td"),this.title.className=i+"Title",n.appendChild(this.title),e.appendChild(n),n=document.createElement("tr"),this.td=document.createElement("td"),this.td.className=i+"Pane",this.contentWrapper=document.createElement("div"),this.contentWrapper.className=i+"Pane",this.contentWrapper.style.width="100%",this.contentWrapper.appendChild(this.content),(mxClient.IS_IE||"DIV"!=this.content.nodeName.toUpperCase())&&(this.contentWrapper.style.height="100%"),this.td.appendChild(this.contentWrapper),n.appendChild(this.td),e.appendChild(n),this.table.appendChild(e),this.div.appendChild(this.table),i=mxUtils.bind(this,function(e){this.activate()}),mxEvent.addListener(this.title,"mousedown",i),mxEvent.addListener(this.table,"mousedown",i),mxClient.IS_TOUCH&&(mxEvent.addListener(this.title,"touchstart",i),mxEvent.addListener(this.table,"touchstart",i)),this.hide()},mxWindow.prototype.setTitle=function(e){for(var n=this.title.firstChild;null!=n;){var t=n.nextSibling;n.nodeType==mxConstants.NODETYPE_TEXT&&n.parentNode.removeChild(n),n=t}mxUtils.write(this.title,e||"")},mxWindow.prototype.setScrollable=function(e){navigator.userAgent.indexOf("Presto/2.5")<0&&(this.contentWrapper.style.overflow=e?"auto":"hidden")},mxWindow.prototype.activate=function(){if(mxWindow.activeWindow!=this){var e=null!=(e=mxUtils.getCurrentStyle(this.getElement()))?e.zIndex:3;if(mxWindow.activeWindow){var n=mxWindow.activeWindow.getElement();null!=n&&null!=n.style&&(n.style.zIndex=e)}n=mxWindow.activeWindow,this.getElement().style.zIndex=parseInt(e)+1,(mxWindow.activeWindow=this).fireEvent(new mxEventObject(mxEvent.ACTIVATE,"previousWindow",n))}},mxWindow.prototype.getElement=function(){return this.div},mxWindow.prototype.fit=function(){mxUtils.fit(this.div)},mxWindow.prototype.isResizable=function(){return null!=this.resize&&"none"!=this.resize.style.display},mxWindow.prototype.setResizable=function(e){e?null==this.resize?(this.resize=document.createElement("img"),this.resize.style.position="absolute",this.resize.style.bottom="2px",this.resize.style.right="2px",this.resize.setAttribute("src",mxClient.imageBasePath+"/resize.gif"),this.resize.style.cursor="nw-resize",mxEvent.addGestureListeners(this.resize,mxUtils.bind(this,function(e){this.activate();var a=mxEvent.getClientX(e),i=mxEvent.getClientY(e),s=this.div.offsetWidth,o=this.div.offsetHeight,n=mxUtils.bind(this,function(e){var n=mxEvent.getClientX(e)-a,t=mxEvent.getClientY(e)-i;this.setSize(s+n,o+t),this.fireEvent(new mxEventObject(mxEvent.RESIZE,"event",e)),mxEvent.consume(e)}),t=mxUtils.bind(this,function(e){mxEvent.removeGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.RESIZE_END,"event",e)),mxEvent.consume(e)});mxEvent.addGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.RESIZE_START,"event",e)),mxEvent.consume(e)}),null,null),this.div.appendChild(this.resize)):this.resize.style.display="inline":null!=this.resize&&(this.resize.style.display="none")},mxWindow.prototype.setSize=function(e,n){e=Math.max(this.minimumSize.width,e),n=Math.max(this.minimumSize.height,n),mxClient.IS_IE||(this.div.style.width=e+"px",this.div.style.height=n+"px"),this.table.style.width=e+"px",this.table.style.height=n+"px",mxClient.IS_IE||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px")},mxWindow.prototype.setMinimizable=function(e){this.minimize.style.display=e?"":"none"},mxWindow.prototype.getMinimumSize=function(){return new mxRectangle(0,0,0,this.title.offsetHeight)},mxWindow.prototype.installMinimizeHandler=function(){this.minimize=document.createElement("img"),this.minimize.setAttribute("src",this.minimizeImage),this.minimize.setAttribute("align","right"),this.minimize.setAttribute("title","Minimize"),this.minimize.style.cursor="pointer",this.minimize.style.marginRight="1px",this.minimize.style.display="none",this.title.appendChild(this.minimize);var t=!1,a=null,i=null,e=mxUtils.bind(this,function(e){if(this.activate(),t)t=!1,this.minimize.setAttribute("src",this.minimizeImage),this.minimize.setAttribute("title","Minimize"),this.contentWrapper.style.display="",this.maximize.style.display=a,mxClient.IS_IE||(this.div.style.height=i),this.table.style.height=i,null!=this.resize&&(this.resize.style.visibility=""),this.fireEvent(new mxEventObject(mxEvent.NORMALIZE,"event",e));else{t=!0,this.minimize.setAttribute("src",this.normalizeImage),this.minimize.setAttribute("title","Normalize"),this.contentWrapper.style.display="none",a=this.maximize.style.display,this.maximize.style.display="none",i=this.table.style.height;var n=this.getMinimumSize();0<n.height&&(mxClient.IS_IE||(this.div.style.height=n.height+"px"),this.table.style.height=n.height+"px"),0<n.width&&(mxClient.IS_IE||(this.div.style.width=n.width+"px"),this.table.style.width=n.width+"px"),null!=this.resize&&(this.resize.style.visibility="hidden"),this.fireEvent(new mxEventObject(mxEvent.MINIMIZE,"event",e))}mxEvent.consume(e)});mxEvent.addListener(this.minimize,"mousedown",e),mxClient.IS_TOUCH&&mxEvent.addListener(this.minimize,"touchstart",e)},mxWindow.prototype.setMaximizable=function(e){this.maximize.style.display=e?"":"none"},mxWindow.prototype.installMaximizeHandler=function(){this.maximize=document.createElement("img"),this.maximize.setAttribute("src",this.maximizeImage),this.maximize.setAttribute("align","right"),this.maximize.setAttribute("title","Maximize"),this.maximize.style.cursor="default",this.maximize.style.marginLeft="1px",this.maximize.style.cursor="pointer",this.maximize.style.display="none",this.title.appendChild(this.maximize);var t=!1,a=null,i=null,s=null,o=null,e=mxUtils.bind(this,function(e){if(this.activate(),"none"!=this.maximize.style.display){if(t)t=!1,this.maximize.setAttribute("src",this.maximizeImage),this.maximize.setAttribute("title","Maximize"),this.contentWrapper.style.display="",this.minimize.style.visibility="",this.div.style.left=a+"px",this.div.style.top=i+"px",mxClient.IS_IE||(this.div.style.height=s,this.div.style.width=o,"auto"!=(n=mxUtils.getCurrentStyle(this.contentWrapper)).overflow&&null==this.resize)||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px"),this.table.style.height=s,this.table.style.width=o,null!=this.resize&&(this.resize.style.visibility=""),this.fireEvent(new mxEventObject(mxEvent.NORMALIZE,"event",e));else{if(t=!0,this.maximize.setAttribute("src",this.normalizeImage),this.maximize.setAttribute("title","Normalize"),this.contentWrapper.style.display="",this.minimize.style.visibility="hidden",a=parseInt(this.div.style.left),i=parseInt(this.div.style.top),s=this.table.style.height,o=this.table.style.width,this.div.style.left="0px",this.div.style.top="0px",mxClient.IS_IE||(this.div.style.height=document.body.clientHeight-2+"px",this.div.style.width=document.body.clientWidth-2+"px"),this.table.style.width=document.body.clientWidth-2+"px",this.table.style.height=document.body.clientHeight-2+"px",null!=this.resize&&(this.resize.style.visibility="hidden"),!mxClient.IS_IE){var n=mxUtils.getCurrentStyle(this.contentWrapper);"auto"!=n.overflow&&null==this.resize||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px")}this.fireEvent(new mxEventObject(mxEvent.MAXIMIZE,"event",e))}mxEvent.consume(e)}});mxEvent.addGestureListeners(this.maximize,e),mxEvent.addListener(this.title,"dblclick",e)},mxWindow.prototype.installMoveHandler=function(){this.title.style.cursor="move",mxEvent.addGestureListeners(this.title,mxUtils.bind(this,function(e){var a=mxEvent.getClientX(e),i=mxEvent.getClientY(e),s=this.getX(),o=this.getY(),n=mxUtils.bind(this,function(e){var n=mxEvent.getClientX(e)-a,t=mxEvent.getClientY(e)-i;this.setLocation(s+n,o+t),this.fireEvent(new mxEventObject(mxEvent.MOVE,"event",e)),mxEvent.consume(e)}),t=mxUtils.bind(this,function(e){mxEvent.removeGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.MOVE_END,"event",e)),mxEvent.consume(e)});mxEvent.addGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.MOVE_START,"event",e)),mxEvent.consume(e)}))},mxWindow.prototype.setLocation=function(e,n){this.div.style.left=e+"px",this.div.style.top=n+"px"},mxWindow.prototype.getX=function(){return parseInt(this.div.style.left)},mxWindow.prototype.getY=function(){return parseInt(this.div.style.top)},mxWindow.prototype.installCloseHandler=function(){this.closeImg=document.createElement("img"),this.closeImg.setAttribute("src",this.closeImage),this.closeImg.setAttribute("align","right"),this.closeImg.setAttribute("title","Close"),this.closeImg.style.marginLeft="2px",this.closeImg.style.cursor="pointer",this.closeImg.style.display="none",this.title.insertBefore(this.closeImg,this.title.firstChild),mxEvent.addGestureListeners(this.closeImg,mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.CLOSE,"event",e)),this.destroyOnClose?this.destroy():this.setVisible(!1),mxEvent.consume(e)}))},mxWindow.prototype.setImage=function(e){this.image=document.createElement("img"),this.image.setAttribute("src",e),this.image.setAttribute("align","left"),this.image.style.marginRight="4px",this.image.style.marginLeft="0px",this.image.style.marginTop="-2px",this.title.insertBefore(this.image,this.title.firstChild)},mxWindow.prototype.setClosable=function(e){this.closeImg.style.display=e?"":"none"},mxWindow.prototype.isVisible=function(){return null!=this.div&&"hidden"!=this.div.style.visibility},mxWindow.prototype.setVisible=function(e){null!=this.div&&this.isVisible()!=e&&(e?this.show():this.hide())},mxWindow.prototype.show=function(){this.div.style.visibility="",this.activate();var e=mxUtils.getCurrentStyle(this.contentWrapper);mxClient.IS_IE||"auto"!=e.overflow&&null==this.resize||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px"),this.fireEvent(new mxEventObject(mxEvent.SHOW))},mxWindow.prototype.hide=function(){this.div.style.visibility="hidden",this.fireEvent(new mxEventObject(mxEvent.HIDE))},mxWindow.prototype.destroy=function(){this.fireEvent(new mxEventObject(mxEvent.DESTROY)),null!=this.div&&(mxEvent.release(this.div),this.div.parentNode.removeChild(this.div),this.div=null),this.contentWrapper=this.content=this.title=null},mxForm.prototype.table=null,mxForm.prototype.body=!1,mxForm.prototype.getTable=function(){return this.table},mxForm.prototype.addButtons=function(e,n){var t=document.createElement("tr"),a=document.createElement("td");t.appendChild(a);a=document.createElement("td");var i=document.createElement("button");mxUtils.write(i,mxResources.get("ok")||"OK"),a.appendChild(i),mxEvent.addListener(i,"click",function(){e()}),i=document.createElement("button"),mxUtils.write(i,mxResources.get("cancel")||"Cancel"),a.appendChild(i),mxEvent.addListener(i,"click",function(){n()}),t.appendChild(a),this.body.appendChild(t)},mxForm.prototype.addText=function(e,n){var t=document.createElement("input");return t.setAttribute("type","text"),t.value=n,this.addField(e,t)},mxForm.prototype.addCheckbox=function(e,n){var t=document.createElement("input");return t.setAttribute("type","checkbox"),this.addField(e,t),n&&(t.checked=!0),t},mxForm.prototype.addTextarea=function(e,n,t){var a=document.createElement("textarea");return mxClient.IS_NS&&t--,a.setAttribute("rows",t||2),a.value=n,this.addField(e,a)},mxForm.prototype.addCombo=function(e,n,t){var a=document.createElement("select");return null!=t&&a.setAttribute("size",t),n&&a.setAttribute("multiple","true"),this.addField(e,a)},mxForm.prototype.addOption=function(e,n,t,a){var i=document.createElement("option");mxUtils.writeln(i,n),i.setAttribute("value",t),a&&i.setAttribute("selected",a),e.appendChild(i)},mxForm.prototype.addField=function(e,n){var t=document.createElement("tr"),a=document.createElement("td");return mxUtils.write(a,e),t.appendChild(a),(a=document.createElement("td")).appendChild(n),t.appendChild(a),this.body.appendChild(t),n},mxImage.prototype.src=null,mxImage.prototype.width=null,mxImage.prototype.height=null,mxDivResizer.prototype.resizeWidth=!0,mxDivResizer.prototype.resizeHeight=!0,mxDivResizer.prototype.handlingResize=!1,mxDivResizer.prototype.resize=function(){var e=this.getDocumentWidth(),n=this.getDocumentHeight(),t=parseInt(this.div.style.left),a=parseInt(this.div.style.right),i=parseInt(this.div.style.top),s=parseInt(this.div.style.bottom);this.resizeWidth&&!isNaN(t)&&!isNaN(a)&&0<=t&&0<=a&&0<e-a-t&&(this.div.style.width=e-a-t+"px"),this.resizeHeight&&!isNaN(i)&&!isNaN(s)&&0<=i&&0<=s&&0<n-i-s&&(this.div.style.height=n-i-s+"px")},mxDivResizer.prototype.getDocumentWidth=function(){return document.body.clientWidth},mxDivResizer.prototype.getDocumentHeight=function(){return document.body.clientHeight},mxDragSource.prototype.element=null,mxDragSource.prototype.dropHandler=null,mxDragSource.prototype.dragOffset=null,mxDragSource.prototype.dragElement=null,mxDragSource.prototype.previewElement=null,mxDragSource.prototype.enabled=!0,mxDragSource.prototype.currentGraph=null,mxDragSource.prototype.currentDropTarget=null,mxDragSource.prototype.currentPoint=null,mxDragSource.prototype.currentGuide=null,mxDragSource.prototype.currentHighlight=null,mxDragSource.prototype.autoscroll=!0,mxDragSource.prototype.guidesEnabled=!0,mxDragSource.prototype.gridEnabled=!0,mxDragSource.prototype.highlightDropTargets=!0,mxDragSource.prototype.dragElementZIndex=100,mxDragSource.prototype.dragElementOpacity=70,mxDragSource.prototype.isEnabled=function(){return this.enabled},mxDragSource.prototype.setEnabled=function(e){this.enabled=e},mxDragSource.prototype.isGuidesEnabled=function(){return this.guidesEnabled},mxDragSource.prototype.setGuidesEnabled=function(e){this.guidesEnabled=e},mxDragSource.prototype.isGridEnabled=function(){return this.gridEnabled},mxDragSource.prototype.setGridEnabled=function(e){this.gridEnabled=e},mxDragSource.prototype.getGraphForEvent=function(e){return null},mxDragSource.prototype.getDropTarget=function(e,n,t){return e.getCellAt(n,t)},mxDragSource.prototype.createDragElement=function(e){return this.element.cloneNode(!0)},mxDragSource.prototype.createPreviewElement=function(e){return null},mxDragSource.prototype.mouseDown=function(e){this.enabled&&!mxEvent.isConsumed(e)&&null==this.mouseMoveHandler&&(this.startDrag(e),this.mouseMoveHandler=mxUtils.bind(this,this.mouseMove),this.mouseUpHandler=mxUtils.bind(this,this.mouseUp),mxEvent.addGestureListeners(document,null,this.mouseMoveHandler,this.mouseUpHandler),mxEvent.consume(e,!0,!1))},mxDragSource.prototype.startDrag=function(e){this.dragElement=this.createDragElement(e),this.dragElement.style.position="absolute",this.dragElement.style.zIndex=this.dragElementZIndex,mxUtils.setOpacity(this.dragElement,this.dragElementOpacity)},mxDragSource.prototype.stopDrag=function(e){null!=this.dragElement&&(null!=this.dragElement.parentNode&&this.dragElement.parentNode.removeChild(this.dragElement),this.dragElement=null)},mxDragSource.prototype.graphContainsEvent=function(e,n){var t=mxEvent.getClientX(n),a=mxEvent.getClientY(n),i=mxUtils.getOffset(e.container),s=mxUtils.getScrollOrigin();return t>=i.x-s.x&&a>=i.y-s.y&&t<=i.x-s.x+e.container.offsetWidth&&a<=i.y-s.y+e.container.offsetHeight},mxDragSource.prototype.mouseMove=function(e){if(null!=(n=this.getGraphForEvent(e))&&!this.graphContainsEvent(n,e)&&(n=null),n!=this.currentGraph&&(null!=this.currentGraph&&this.dragExit(this.currentGraph),this.currentGraph=n,null!=this.currentGraph&&this.dragEnter(this.currentGraph)),null!=this.currentGraph&&this.dragOver(this.currentGraph,e),null==this.dragElement||null!=this.previewElement&&"visible"==this.previewElement.style.visibility)null!=this.dragElement&&(this.dragElement.style.visibility="hidden");else{var n=mxEvent.getClientX(e),t=mxEvent.getClientY(e);null==this.dragElement.parentNode&&document.body.appendChild(this.dragElement),this.dragElement.style.visibility="visible",null!=this.dragOffset&&(n+=this.dragOffset.x,t+=this.dragOffset.y),n+=document.body.scrollLeft||document.documentElement.scrollLeft,t+=document.body.scrollTop||document.documentElement.scrollTop,this.dragElement.style.left=n+"px",this.dragElement.style.top=t+"px"}mxEvent.consume(e)},mxDragSource.prototype.mouseUp=function(e){if(null!=this.currentGraph){if(null!=this.currentPoint&&(null==this.previewElement||"hidden"!=this.previewElement.style.visibility)){var n=this.currentGraph.view.scale,t=this.currentGraph.view.translate;this.drop(this.currentGraph,e,this.currentDropTarget,this.currentPoint.x/n-t.x,this.currentPoint.y/n-t.y)}this.dragExit(this.currentGraph)}this.stopDrag(e),mxEvent.removeGestureListeners(document,null,this.mouseMoveHandler,this.mouseUpHandler),this.currentGraph=this.mouseUpHandler=this.mouseMoveHandler=null,mxEvent.consume(e)},mxDragSource.prototype.dragEnter=function(e){e.isMouseDown=!0,this.previewElement=this.createPreviewElement(e),this.isGuidesEnabled()&&null!=this.previewElement&&(this.currentGuide=new mxGuide(e,e.graphHandler.getGuideStates())),this.highlightDropTargets&&(this.currentHighlight=new mxCellHighlight(e,mxConstants.DROP_TARGET_COLOR))},mxDragSource.prototype.dragExit=function(e){this.currentPoint=this.currentDropTarget=null,e.isMouseDown=!1,null!=this.previewElement&&(null!=this.previewElement.parentNode&&this.previewElement.parentNode.removeChild(this.previewElement),this.previewElement=null),null!=this.currentGuide&&(this.currentGuide.destroy(),this.currentGuide=null),null!=this.currentHighlight&&(this.currentHighlight.destroy(),this.currentHighlight=null)},mxDragSource.prototype.dragOver=function(e,n){var t=mxUtils.getOffset(e.container),a=mxUtils.getScrollOrigin(e.container),i=mxEvent.getClientX(n)-t.x+a.x;t=mxEvent.getClientY(n)-t.y+a.y;if(e.autoScroll&&(null==this.autoscroll||this.autoscroll)&&e.scrollPointToVisible(i,t,e.autoExtend),null!=this.currentHighlight&&e.isDropEnabled()&&(this.currentDropTarget=this.getDropTarget(e,i,t),a=e.getView().getState(this.currentDropTarget),this.currentHighlight.highlight(a)),null!=this.previewElement){null==this.previewElement.parentNode&&(e.container.appendChild(this.previewElement),this.previewElement.style.zIndex="3",this.previewElement.style.position="absolute");a=this.isGridEnabled()&&e.isGridEnabledEvent(n);var s=!0;if(null!=this.currentGuide&&this.currentGuide.isEnabledForEvent(n))s=new mxRectangle(0,0,s=parseInt(this.previewElement.style.width),o=parseInt(this.previewElement.style.height)),t=new mxPoint(i,t),t=this.currentGuide.move(s,t,a),s=!1,i=t.x,t=t.y;else if(a){a=e.view.scale;var o=e.view.translate,r=e.gridSize/2;i=(e.snap(i/a-o.x-r)+o.x)*a,t=(e.snap(t/a-o.y-r)+o.y)*a}null!=this.currentGuide&&s&&this.currentGuide.hide(),null!=this.previewOffset&&(i+=this.previewOffset.x,t+=this.previewOffset.y),this.previewElement.style.left=Math.round(i)+"px",this.previewElement.style.top=Math.round(t)+"px",this.previewElement.style.visibility="visible"}this.currentPoint=new mxPoint(i,t)},mxDragSource.prototype.drop=function(e,n,t,a,i){this.dropHandler(e,n,t,a,i),e.container.focus()},mxToolbar.prototype=new mxEventSource,mxToolbar.prototype.constructor=mxToolbar,mxToolbar.prototype.container=null,mxToolbar.prototype.enabled=!0,mxToolbar.prototype.noReset=!1,mxToolbar.prototype.updateDefaultMode=!0,mxToolbar.prototype.addItem=function(e,n,t,a,i,s){var o=document.createElement(null!=n?"img":"button"),r=i||(null!=s?"mxToolbarMode":"mxToolbarItem");return o.className=r,o.setAttribute("src",n),null!=e&&(null!=n?o.setAttribute("title",e):mxUtils.write(o,e)),this.container.appendChild(o),null!=t&&(mxEvent.addListener(o,"click",t),mxClient.IS_TOUCH&&mxEvent.addListener(o,"touchend",t)),e=mxUtils.bind(this,function(e){null!=a?o.setAttribute("src",n):o.style.backgroundColor=""}),mxEvent.addGestureListeners(o,mxUtils.bind(this,function(e){if(null!=a?o.setAttribute("src",a):o.style.backgroundColor="gray",null!=s){null==this.menu&&(this.menu=new mxPopupMenu,this.menu.init());var n=this.currentImg;this.menu.isMenuShowing()&&this.menu.hideMenu(),n!=o&&(this.currentImg=o,this.menu.factoryMethod=s,n=new mxPoint(o.offsetLeft,o.offsetTop+o.offsetHeight),this.menu.popup(n.x,n.y,null,e),this.menu.isMenuShowing()&&(o.className=r+"Selected",this.menu.hideMenu=function(){mxPopupMenu.prototype.hideMenu.apply(this),o.className=r,this.currentImg=null}))}}),null,e),mxEvent.addListener(o,"mouseout",e),o},mxToolbar.prototype.addCombo=function(e){var n=document.createElement("div");n.style.display="inline",n.className="mxToolbarComboContainer";var t=document.createElement("select");return t.className=e||"mxToolbarCombo",n.appendChild(t),this.container.appendChild(n),t},mxToolbar.prototype.addActionCombo=function(e,n){var t=document.createElement("select");return t.className=n||"mxToolbarCombo",this.addOption(t,e,null),mxEvent.addListener(t,"change",function(e){var n=t.options[t.selectedIndex];t.selectedIndex=0,null!=n.funct&&n.funct(e)}),this.container.appendChild(t),t},mxToolbar.prototype.addOption=function(e,n,t){var a=document.createElement("option");return mxUtils.writeln(a,n),"function"==typeof t?a.funct=t:a.setAttribute("value",t),e.appendChild(a),a},mxToolbar.prototype.addSwitchMode=function(e,n,t,a,i){var s=document.createElement("img");return s.initialClassName=i||"mxToolbarMode",s.className=s.initialClassName,s.setAttribute("src",n),s.altIcon=a,null!=e&&s.setAttribute("title",e),mxEvent.addListener(s,"click",mxUtils.bind(this,function(e){null!=(e=this.selectedMode.altIcon)?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",e)):this.selectedMode.className=this.selectedMode.initialClassName,this.updateDefaultMode&&(this.defaultMode=s),null!=(e=(this.selectedMode=s).altIcon)?(s.altIcon=s.getAttribute("src"),s.setAttribute("src",e)):s.className=s.initialClassName+"Selected",this.fireEvent(new mxEventObject(mxEvent.SELECT)),t()})),this.container.appendChild(s),null==this.defaultMode&&(this.defaultMode=s,this.selectMode(s),t()),s},mxToolbar.prototype.addMode=function(e,n,t,a,i,s){s=null==s||s;var o=document.createElement(null!=n?"img":"button");return o.initialClassName=i||"mxToolbarMode",o.className=o.initialClassName,o.setAttribute("src",n),o.altIcon=a,null!=e&&o.setAttribute("title",e),this.enabled&&s&&(mxEvent.addListener(o,"click",mxUtils.bind(this,function(e){this.selectMode(o,t),this.noReset=!1})),mxEvent.addListener(o,"dblclick",mxUtils.bind(this,function(e){this.selectMode(o,t),this.noReset=!0})),null==this.defaultMode&&(this.defaultMode=o,this.defaultFunction=t,this.selectMode(o,t))),this.container.appendChild(o),o},mxToolbar.prototype.selectMode=function(e,n){if(this.selectedMode!=e){if(null!=this.selectedMode){var t=this.selectedMode.altIcon;null!=t?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",t)):this.selectedMode.className=this.selectedMode.initialClassName}this.selectedMode=e,null!=(t=this.selectedMode.altIcon)?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",t)):this.selectedMode.className=this.selectedMode.initialClassName+"Selected",this.fireEvent(new mxEventObject(mxEvent.SELECT,"function",n))}},mxToolbar.prototype.resetMode=function(e){(e||!this.noReset)&&this.selectedMode!=this.defaultMode&&this.selectMode(this.defaultMode,this.defaultFunction)},mxToolbar.prototype.addSeparator=function(e){return this.addItem(null,e,null)},mxToolbar.prototype.addBreak=function(){mxUtils.br(this.container)},mxToolbar.prototype.addLine=function(){var e=document.createElement("hr");e.style.marginRight="6px",e.setAttribute("size","1"),this.container.appendChild(e)},mxToolbar.prototype.destroy=function(){mxEvent.release(this.container),this.selectedMode=this.defaultFunction=this.defaultMode=this.container=null,null!=this.menu&&this.menu.destroy()},mxSession.prototype=new mxEventSource,mxSession.prototype.constructor=mxSession,mxSession.prototype.model=null,mxSession.prototype.urlInit=null,mxSession.prototype.urlPoll=null,mxSession.prototype.urlNotify=null,mxSession.prototype.codec=null,mxSession.prototype.linefeed="&#xa;",mxSession.prototype.escapePostData=!0,mxSession.prototype.significantRemoteChanges=!0,mxSession.prototype.sent=0,mxSession.prototype.received=0,mxSession.prototype.debug=!1,mxSession.prototype.connected=!1,mxSession.prototype.suspended=!1,mxSession.prototype.polling=!1,mxSession.prototype.start=function(){this.debug?(this.connected=!0,this.fireEvent(new mxEventObject(mxEvent.CONNECT))):this.connected||this.get(this.urlInit,mxUtils.bind(this,function(e){this.connected=!0,this.fireEvent(new mxEventObject(mxEvent.CONNECT)),this.poll()}))},mxSession.prototype.suspend=function(){this.connected&&!this.suspended&&(this.suspended=!0,this.fireEvent(new mxEventObject(mxEvent.SUSPEND)))},mxSession.prototype.resume=function(e,n,t){this.connected&&this.suspended&&(this.suspended=!1,this.fireEvent(new mxEventObject(mxEvent.RESUME)),this.polling||this.poll())},mxSession.prototype.stop=function(e){this.connected&&(this.connected=!1),this.fireEvent(new mxEventObject(mxEvent.DISCONNECT,"reason",e))},mxSession.prototype.poll=function(){this.connected&&!this.suspended&&null!=this.urlPoll?(this.polling=!0,this.get(this.urlPoll,mxUtils.bind(this,function(){this.poll()}))):this.polling=!1},mxSession.prototype.notify=function(e,n,t){null!=e&&0<e.length&&(null!=this.urlNotify&&(this.debug?(mxLog.show(),mxLog.debug("mxSession.notify: "+this.urlNotify+" xml="+e)):(e="<message><delta>"+e+"</delta></message>",this.escapePostData&&(e=encodeURIComponent(e)),mxUtils.post(this.urlNotify,"xml="+e,n,t))),this.sent+=e.length,this.fireEvent(new mxEventObject(mxEvent.NOTIFY,"url",this.urlNotify,"xml",e)))},mxSession.prototype.get=function(t,a,n){if(void 0!==mxUtils){var i=mxUtils.bind(this,function(e){null!=n?n(e):this.stop(e)});mxUtils.get(t,mxUtils.bind(this,function(e){if(void 0!==mxUtils)if(e.isReady()&&404!=e.getStatus()){if(this.received+=e.getText().length,this.fireEvent(new mxEventObject(mxEvent.GET,"url",t,"request",e)),this.isValidResponse(e)){if(0<e.getText().length){var n=e.getDocumentElement();null==n?i("Invalid response: "+e.getText()):this.receive(n)}null!=a&&a(e)}}else i("Response not ready")}),function(e){i("Transmission error")})}},mxSession.prototype.isValidResponse=function(e){return e.getText().indexOf("<?php")<0},mxSession.prototype.encodeChanges=function(e,n){for(var t="",a=n?-1:1,i=n?e.length-1:0;0<=i&&i<e.length;i+=a){var s=this.codec.encode(e[i]);t=t+mxUtils.getXml(s,this.linefeed)}return t},mxSession.prototype.receive=function(e){if(null!=e&&e.nodeType==mxConstants.NODETYPE_ELEMENT){var n=e.getAttribute("namespace");for(null!=n&&(this.model.prefix=n+"-"),n=e.firstChild;null!=n;){var t=n.nodeName.toLowerCase();"state"==t?this.processState(n):"delta"==t&&this.processDelta(n),n=n.nextSibling}this.fireEvent(new mxEventObject(mxEvent.RECEIVE,"node",e))}},mxSession.prototype.processState=function(e){new mxCodec(e.ownerDocument).decode(e.firstChild,this.model)},mxSession.prototype.processDelta=function(e){for(e=e.firstChild;null!=e;)"edit"==e.nodeName&&this.processEdit(e),e=e.nextSibling},mxSession.prototype.processEdit=function(e){if(0<(e=this.decodeChanges(e)).length){var n=this.createUndoableEdit(e);this.model.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",n,"changes",e)),this.model.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",n)),this.fireEvent(new mxEventObject(mxEvent.FIRED,"edit",n))}},mxSession.prototype.createUndoableEdit=function(e){var n=new mxUndoableEdit(this.model,this.significantRemoteChanges);return n.changes=e,n.notify=function(){n.source.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",n,"changes",n.changes)),n.source.fireEvent(new mxEventObject(mxEvent.NOTIFY,"edit",n,"changes",n.changes))},n},mxSession.prototype.decodeChanges=function(e){this.codec.document=e.ownerDocument;var n=[];for(e=e.firstChild;null!=e;){var t=this.decodeChange(e);null!=t&&n.push(t),e=e.nextSibling}return n},mxSession.prototype.decodeChange=function(e){var n=null;return e.nodeType==mxConstants.NODETYPE_ELEMENT&&(null!=(n="mxRootChange"==e.nodeName?new mxCodec(e.ownerDocument).decode(e):this.codec.decode(e))&&(n.model=this.model,n.execute(),"mxChildChange"==e.nodeName&&null==n.parent&&this.cellRemoved(n.child))),n},mxSession.prototype.cellRemoved=function(e,n){this.codec.putObject(e.getId(),e);for(var t=this.model.getChildCount(e),a=0;a<t;a++)this.cellRemoved(this.model.getChildAt(e,a))},mxUndoableEdit.prototype.source=null,mxUndoableEdit.prototype.changes=null,mxUndoableEdit.prototype.significant=null,mxUndoableEdit.prototype.undone=!1,mxUndoableEdit.prototype.redone=!1,mxUndoableEdit.prototype.isEmpty=function(){return 0==this.changes.length},mxUndoableEdit.prototype.isSignificant=function(){return this.significant},mxUndoableEdit.prototype.add=function(e){this.changes.push(e)},mxUndoableEdit.prototype.notify=function(){},mxUndoableEdit.prototype.die=function(){},mxUndoableEdit.prototype.undo=function(){if(!this.undone){this.source.fireEvent(new mxEventObject(mxEvent.START_EDIT));for(var e=this.changes.length-1;0<=e;e--){var n=this.changes[e];null!=n.execute?n.execute():null!=n.undo&&n.undo(),this.source.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",n))}this.undone=!0,this.redone=!1,this.source.fireEvent(new mxEventObject(mxEvent.END_EDIT))}this.notify()},mxUndoableEdit.prototype.redo=function(){if(!this.redone){this.source.fireEvent(new mxEventObject(mxEvent.START_EDIT));for(var e=this.changes.length,n=0;n<e;n++){var t=this.changes[n];null!=t.execute?t.execute():null!=t.redo&&t.redo(),this.source.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",t))}this.undone=!1,this.redone=!0,this.source.fireEvent(new mxEventObject(mxEvent.END_EDIT))}this.notify()},mxUndoManager.prototype=new mxEventSource,mxUndoManager.prototype.constructor=mxUndoManager,mxUndoManager.prototype.size=null,mxUndoManager.prototype.history=null,mxUndoManager.prototype.indexOfNextAdd=0,mxUndoManager.prototype.isEmpty=function(){return 0==this.history.length},mxUndoManager.prototype.clear=function(){this.history=[],this.indexOfNextAdd=0,this.fireEvent(new mxEventObject(mxEvent.CLEAR))},mxUndoManager.prototype.canUndo=function(){return 0<this.indexOfNextAdd},mxUndoManager.prototype.undo=function(){for(;0<this.indexOfNextAdd;){var e=this.history[--this.indexOfNextAdd];if(e.undo(),e.isSignificant()){this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",e));break}}},mxUndoManager.prototype.canRedo=function(){return this.indexOfNextAdd<this.history.length},mxUndoManager.prototype.redo=function(){for(var e=this.history.length;this.indexOfNextAdd<e;){var n=this.history[this.indexOfNextAdd++];if(n.redo(),n.isSignificant()){this.fireEvent(new mxEventObject(mxEvent.REDO,"edit",n));break}}},mxUndoManager.prototype.undoableEditHappened=function(e){this.trim(),0<this.size&&this.size==this.history.length&&this.history.shift(),this.history.push(e),this.indexOfNextAdd=this.history.length,this.fireEvent(new mxEventObject(mxEvent.ADD,"edit",e))},mxUndoManager.prototype.trim=function(){if(this.history.length>this.indexOfNextAdd)for(var e=this.history.splice(this.indexOfNextAdd,this.history.length-this.indexOfNextAdd),n=0;n<e.length;n++)e[n].die()};var mxUrlConverter=function(e){var t=!0,a=null,i=null;return{isEnabled:function(){return t},setEnabled:function(e){t=e},getBaseUrl:function(){return a},setBaseUrl:function(e){a=e},getBaseDomain:function(){return a},setBaseDomain:function(e){a=e},isRelativeUrl:function(e){return"http://"!=e.substring(0,7)&&"https://"!=e.substring(0,8)&&"data:image"!=e.substring(0,10)},convert:function(e){if(t&&this.isRelativeUrl(e)){if(null==a){i=location.protocol+"//"+location.host;var n=(a=i+location.pathname).lastIndexOf("/");0<n&&(a=a.substring(0,n+1))}e="/"==e.charAt(0)?i+e:a+e}return e}}};function mxPanningManager(s){this.thread=null,this.active=!1,this.dy=this.dx=this.t0y=this.t0x=this.tdy=this.tdx=0,this.scrollbars=!1,this.scrollTop=this.scrollLeft=0,this.mouseListener={mouseDown:function(e,n){},mouseMove:function(e,n){},mouseUp:mxUtils.bind(this,function(e,n){this.active&&this.stop()})},s.addMouseListener(this.mouseListener),mxEvent.addListener(document,"mouseup",mxUtils.bind(this,function(){this.active&&this.stop()}));var o=mxUtils.bind(this,function(){return this.scrollbars=mxUtils.hasScrollbars(s.container),this.scrollLeft=s.container.scrollLeft,this.scrollTop=s.container.scrollTop,window.setInterval(mxUtils.bind(this,function(){if(this.tdx-=this.dx,this.tdy-=this.dy,this.scrollbars){var e=-s.container.scrollLeft-Math.ceil(this.dx),n=-s.container.scrollTop-Math.ceil(this.dy);s.panGraph(e,n),s.panDx=this.scrollLeft-s.container.scrollLeft,s.panDy=this.scrollTop-s.container.scrollTop,s.fireEvent(new mxEventObject(mxEvent.PAN))}else s.panGraph(this.getDx(),this.getDy())}),this.delay)});this.isActive=function(){return active},this.getDx=function(){return Math.round(this.tdx)},this.getDy=function(){return Math.round(this.tdy)},this.start=function(){this.t0x=s.view.translate.x,this.t0y=s.view.translate.y,this.active=!0},this.panTo=function(e,n,t,a){this.active||this.start(),this.scrollLeft=s.container.scrollLeft,this.scrollTop=s.container.scrollTop,a=null!=a?a:0;var i=s.container;this.dx=e+(null!=t?t:0)-i.scrollLeft-i.clientWidth,this.dx<0&&Math.abs(this.dx)<this.border?this.dx=this.border+this.dx:this.dx=this.handleMouseOut?Math.max(this.dx,0):0,0==this.dx&&(this.dx=e-i.scrollLeft,this.dx=0<this.dx&&this.dx<this.border?this.dx-this.border:this.handleMouseOut?Math.min(0,this.dx):0),this.dy=n+a-i.scrollTop-i.clientHeight,this.dy<0&&Math.abs(this.dy)<this.border?this.dy=this.border+this.dy:this.dy=this.handleMouseOut?Math.max(this.dy,0):0,0==this.dy&&(this.dy=n-i.scrollTop,this.dy=0<this.dy&&this.dy<this.border?this.dy-this.border:this.handleMouseOut?Math.min(0,this.dy):0),0!=this.dx||0!=this.dy?(this.dx*=this.damper,this.dy*=this.damper,null==this.thread&&(this.thread=o())):null!=this.thread&&(window.clearInterval(this.thread),this.thread=null)},this.stop=function(){if(this.active)if(this.active=!1,null!=this.thread&&(window.clearInterval(this.thread),this.thread=null),this.tdy=this.tdx=0,this.scrollbars)s.panDx=0,s.panDy=0,s.fireEvent(new mxEventObject(mxEvent.PAN));else{var e=s.panDx,n=s.panDy;0==e&&0==n||(s.panGraph(0,0),s.view.setTranslate(this.t0x+e/s.view.scale,this.t0y+n/s.view.scale))}},this.destroy=function(){s.removeMouseListener(this.mouseListener)}}function mxPopupMenu(e){null!=(this.factoryMethod=e)&&this.init()}function mxAutoSaveManager(e){this.changeHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.graphModelChanged(n.getProperty("edit").changes)}),this.setGraph(e)}function mxAnimation(e){this.delay=null!=e?e:20}function mxMorphing(e,n,t,a){mxAnimation.call(this,a),this.graph=e,this.steps=null!=n?n:6,this.ease=null!=t?t:1.5}function mxImageBundle(e){this.images=[],this.alt=null!=e&&e}function mxImageExport(){}function mxAbstractCanvas2D(){this.converter=this.createUrlConverter(),this.reset()}function mxXmlCanvas2D(e){mxAbstractCanvas2D.call(this),this.root=e,this.writeDefaults()}function mxSvgCanvas2D(e,n){mxAbstractCanvas2D.call(this),this.root=e,this.gradients=[],this.defs=null,this.styleEnabled=null!=n&&n;var t=null;if(e.ownerDocument!=document)for(t=e;null!=t&&"svg"!=t.nodeName;)t=t.parentNode;null!=t&&(0<t.getElementsByTagName("defs").length&&(this.defs=t.getElementsByTagName("defs")[0]),null==this.defs&&(this.defs=this.createElement("defs"),null!=t.firstChild?t.insertBefore(this.defs,t.firstChild):t.appendChild(this.defs)),this.styleEnabled&&this.defs.appendChild(this.createStyle()))}mxPanningManager.prototype.damper=1/6,mxPanningManager.prototype.delay=10,mxPanningManager.prototype.handleMouseOut=!0,mxPanningManager.prototype.border=0,mxPopupMenu.prototype=new mxEventSource,mxPopupMenu.prototype.constructor=mxPopupMenu,mxPopupMenu.prototype.submenuImage=mxClient.imageBasePath+"/submenu.gif",mxPopupMenu.prototype.zIndex=10006,mxPopupMenu.prototype.factoryMethod=null,mxPopupMenu.prototype.useLeftButtonForPopup=!1,mxPopupMenu.prototype.enabled=!0,mxPopupMenu.prototype.itemCount=0,mxPopupMenu.prototype.autoExpand=!1,mxPopupMenu.prototype.smartSeparators=!1,mxPopupMenu.prototype.labels=!0,mxPopupMenu.prototype.init=function(){this.table=document.createElement("table"),this.table.className="mxPopupMenu",this.tbody=document.createElement("tbody"),this.table.appendChild(this.tbody),this.div=document.createElement("div"),this.div.className="mxPopupMenu",this.div.style.display="inline",this.div.style.zIndex=this.zIndex,this.div.appendChild(this.table),mxEvent.disableContextMenu(this.div)},mxPopupMenu.prototype.isEnabled=function(){return this.enabled},mxPopupMenu.prototype.setEnabled=function(e){this.enabled=e},mxPopupMenu.prototype.isPopupTrigger=function(e){return e.isPopupTrigger()||this.useLeftButtonForPopup&&mxEvent.isLeftMouseButton(e.getEvent())},mxPopupMenu.prototype.addItem=function(e,n,t,a,i,s){a=a||this,this.itemCount++,a.willAddSeparator&&(a.containsItems&&this.addSeparator(a,!0),a.willAddSeparator=!1),a.containsItems=!0;var o=document.createElement("tr");o.className="mxPopupMenuItem";var r=document.createElement("td");return r.className="mxPopupMenuIcon",null!=n?((i=document.createElement("img")).src=n,r.appendChild(i)):null!=i&&((n=document.createElement("div")).className=i,r.appendChild(n)),o.appendChild(r),this.labels&&((r=document.createElement("td")).className="mxPopupMenuItem"+(null==s||s?"":" disabled"),mxUtils.write(r,e),r.align="left",o.appendChild(r),(e=document.createElement("td")).className="mxPopupMenuItem"+(null==s||s?"":" disabled"),e.style.paddingRight="6px",e.style.textAlign="right",o.appendChild(e),null==a.div&&this.createSubmenu(a)),a.tbody.appendChild(o),(null==s||s)&&(mxEvent.addGestureListeners(o,mxUtils.bind(this,function(e){this.eventReceiver=o,a.activeRow!=o&&a.activeRow!=a&&(null!=a.activeRow&&null!=a.activeRow.div.parentNode&&this.hideSubmenu(a),null!=o.div&&(this.showSubmenu(a,o),a.activeRow=o)),mxEvent.consume(e)}),mxUtils.bind(this,function(e){a.activeRow!=o&&a.activeRow!=a&&(null!=a.activeRow&&null!=a.activeRow.div.parentNode&&this.hideSubmenu(a),this.autoExpand&&null!=o.div&&(this.showSubmenu(a,o),a.activeRow=o)),o.className="mxPopupMenuItemHover"}),mxUtils.bind(this,function(e){this.eventReceiver==o&&(a.activeRow!=o&&this.hideMenu(),null!=t&&t(e)),this.eventReceiver=null,mxEvent.consume(e)})),mxEvent.addListener(o,"mouseout",mxUtils.bind(this,function(e){o.className="mxPopupMenuItem"}))),o},mxPopupMenu.prototype.createSubmenu=function(e){e.table=document.createElement("table"),e.table.className="mxPopupMenu",e.tbody=document.createElement("tbody"),e.table.appendChild(e.tbody),e.div=document.createElement("div"),e.div.className="mxPopupMenu",e.div.style.position="absolute",e.div.style.display="inline",e.div.style.zIndex=this.zIndex,e.div.appendChild(e.table);var n=document.createElement("img");n.setAttribute("src",this.submenuImage),td=e.firstChild.nextSibling.nextSibling,td.appendChild(n)},mxPopupMenu.prototype.showSubmenu=function(e,n){if(null!=n.div){n.div.style.left=e.div.offsetLeft+n.offsetLeft+n.offsetWidth-1+"px",n.div.style.top=e.div.offsetTop+n.offsetTop+"px",document.body.appendChild(n.div);var t=parseInt(n.div.offsetLeft),a=parseInt(n.div.offsetWidth),i=document.body,s=document.documentElement;t+a>(i.scrollLeft||s.scrollLeft)+(i.clientWidth||s.clientWidth)&&(n.div.style.left=e.div.offsetLeft-a+(mxClient.IS_IE?6:-6)+"px"),mxUtils.fit(n.div)}},mxPopupMenu.prototype.addSeparator=function(e,n){if(e=e||this,this.smartSeparators&&!n)e.willAddSeparator=!0;else if(null!=e.tbody){e.willAddSeparator=!1;var t=document.createElement("tr"),a=document.createElement("td");a.className="mxPopupMenuIcon",a.style.padding="0 0 0 0px",t.appendChild(a),(a=document.createElement("td")).style.padding="0 0 0 0px",a.setAttribute("colSpan","2");var i=document.createElement("hr");i.setAttribute("size","1"),a.appendChild(i),t.appendChild(a),e.tbody.appendChild(t)}},mxPopupMenu.prototype.popup=function(e,n,t,a){if(null!=this.div&&null!=this.tbody&&null!=this.factoryMethod){for(this.div.style.left=e+"px",this.div.style.top=n+"px";null!=this.tbody.firstChild;)mxEvent.release(this.tbody.firstChild),this.tbody.removeChild(this.tbody.firstChild);this.itemCount=0,this.factoryMethod(this,t,a),0<this.itemCount&&(this.showMenu(),this.fireEvent(new mxEventObject(mxEvent.SHOW)))}},mxPopupMenu.prototype.isMenuShowing=function(){return null!=this.div&&this.div.parentNode==document.body},mxPopupMenu.prototype.showMenu=function(){9<=document.documentMode&&(this.div.style.filter="none"),document.body.appendChild(this.div),mxUtils.fit(this.div)},mxPopupMenu.prototype.hideMenu=function(){null!=this.div&&(null!=this.div.parentNode&&this.div.parentNode.removeChild(this.div),this.hideSubmenu(this),this.containsItems=!1)},mxPopupMenu.prototype.hideSubmenu=function(e){null!=e.activeRow&&(this.hideSubmenu(e.activeRow),null!=e.activeRow.div.parentNode&&e.activeRow.div.parentNode.removeChild(e.activeRow.div),e.activeRow=null)},mxPopupMenu.prototype.destroy=function(){null!=this.div&&(mxEvent.release(this.div),null!=this.div.parentNode&&this.div.parentNode.removeChild(this.div),this.div=null)},mxAutoSaveManager.prototype=new mxEventSource,mxAutoSaveManager.prototype.constructor=mxAutoSaveManager,mxAutoSaveManager.prototype.graph=null,mxAutoSaveManager.prototype.autoSaveDelay=10,mxAutoSaveManager.prototype.autoSaveThrottle=2,mxAutoSaveManager.prototype.autoSaveThreshold=5,mxAutoSaveManager.prototype.ignoredChanges=0,mxAutoSaveManager.prototype.lastSnapshot=0,mxAutoSaveManager.prototype.enabled=!0,mxAutoSaveManager.prototype.changeHandler=null,mxAutoSaveManager.prototype.isEnabled=function(){return this.enabled},mxAutoSaveManager.prototype.setEnabled=function(e){this.enabled=e},mxAutoSaveManager.prototype.setGraph=function(e){null!=this.graph&&this.graph.getModel().removeListener(this.changeHandler),this.graph=e,null!=this.graph&&this.graph.getModel().addListener(mxEvent.CHANGE,this.changeHandler)},mxAutoSaveManager.prototype.save=function(){},mxAutoSaveManager.prototype.graphModelChanged=function(e){(e=((new Date).getTime()-this.lastSnapshot)/1e3)>this.autoSaveDelay||this.ignoredChanges>=this.autoSaveThreshold&&e>this.autoSaveThrottle?(this.save(),this.reset()):this.ignoredChanges++},mxAutoSaveManager.prototype.reset=function(){this.lastSnapshot=(new Date).getTime(),this.ignoredChanges=0},mxAutoSaveManager.prototype.destroy=function(){this.setGraph(null)},mxAnimation.prototype=new mxEventSource,mxAnimation.prototype.constructor=mxAnimation,mxAnimation.prototype.delay=null,mxAnimation.prototype.thread=null,mxAnimation.prototype.startAnimation=function(){null==this.thread&&(this.thread=window.setInterval(mxUtils.bind(this,this.updateAnimation),this.delay))},mxAnimation.prototype.updateAnimation=function(){this.fireEvent(new mxEventObject(mxEvent.EXECUTE))},mxAnimation.prototype.stopAnimation=function(){null!=this.thread&&(window.clearInterval(this.thread),this.thread=null,this.fireEvent(new mxEventObject(mxEvent.DONE)))},mxMorphing.prototype=new mxAnimation,mxMorphing.prototype.constructor=mxMorphing,mxMorphing.prototype.graph=null,mxMorphing.prototype.steps=null,mxMorphing.prototype.step=0,mxMorphing.prototype.ease=null,mxMorphing.prototype.cells=null,mxMorphing.prototype.updateAnimation=function(){var e=new mxCellStatePreview(this.graph);if(null!=this.cells)for(var n=0;n<this.cells.length;n++)this.animateCell(cells[n],e,!1);else this.animateCell(this.graph.getModel().getRoot(),e,!0);this.show(e),(e.isEmpty()||this.step++>=this.steps)&&this.stopAnimation()},mxMorphing.prototype.show=function(e){e.show()},mxMorphing.prototype.animateCell=function(e,n,t){var a=this.graph.getView().getState(e),i=null;if(null!=a&&(i=this.getDelta(a),this.graph.getModel().isVertex(e)&&(0!=i.x||0!=i.y))){var s=this.graph.view.getTranslate(),o=this.graph.view.getScale();i.x+=s.x*o,i.y+=s.y*o,n.moveState(a,-i.x/this.ease,-i.y/this.ease)}if(t&&!this.stopRecursion(a,i))for(a=this.graph.getModel().getChildCount(e),i=0;i<a;i++)this.animateCell(this.graph.getModel().getChildAt(e,i),n,t)},mxMorphing.prototype.stopRecursion=function(e,n){return null!=n&&(0!=n.x||0!=n.y)},mxMorphing.prototype.getDelta=function(e){var n=this.getOriginForCell(e.cell),t=this.graph.getView().getTranslate(),a=this.graph.getView().getScale();return e=new mxPoint(e.x/a-t.x,e.y/a-t.y),new mxPoint((n.x-e.x)*a,(n.y-e.y)*a)},mxMorphing.prototype.getOriginForCell=function(e){var n=null;return null!=e&&(n=this.getOriginForCell(this.graph.getModel().getParent(e)),null!=(e=this.graph.getCellGeometry(e))&&(n.x+=e.x,n.y+=e.y)),null==n&&(n=new mxPoint(-(n=this.graph.view.getTranslate()).x,-n.y)),n},mxImageBundle.prototype.images=null,mxImageBundle.prototype.images=null,mxImageBundle.prototype.putImage=function(e,n,t){this.images[e]={value:n,fallback:t}},mxImageBundle.prototype.getImage=function(e){var n=null;return null!=e&&(null!=(e=this.images[e])&&(n=this.alt?e.fallback:e.value)),n},mxImageExport.prototype.includeOverlays=!1,mxImageExport.prototype.drawState=function(e,n){null!=e&&(this.visitStatesRecursive(e,n,this.drawCellState),this.includeOverlays&&this.visitStatesRecursive(e,n,this.drawOverlays))},mxImageExport.prototype.visitStatesRecursive=function(e,n,t){if(null!=e){t(e,n);for(var a=e.view.graph,i=a.model.getChildCount(e.cell),s=0;s<i;s++){var o=a.view.getState(a.model.getChildAt(e.cell,s));this.visitStatesRecursive(o,n,t)}}},mxImageExport.prototype.drawCellState=function(e,n){e.shape instanceof mxShape&&(n.save(),e.shape.paint(n),n.restore()),null!=e.text&&(n.save(),e.text.paint(n),n.restore())},mxImageExport.prototype.drawOverlays=function(e,t){null!=e.overlays&&e.overlays.visit(function(e,n){n instanceof mxShape&&n.paint(t)})},mxAbstractCanvas2D.prototype.state=null,mxAbstractCanvas2D.prototype.states=null,mxAbstractCanvas2D.prototype.path=null,mxAbstractCanvas2D.prototype.rotateHtml=!0,mxAbstractCanvas2D.prototype.lastX=0,mxAbstractCanvas2D.prototype.lastY=0,mxAbstractCanvas2D.prototype.moveOp="M",mxAbstractCanvas2D.prototype.lineOp="L",mxAbstractCanvas2D.prototype.quadOp="Q",mxAbstractCanvas2D.prototype.curveOp="C",mxAbstractCanvas2D.prototype.closeOp="Z",mxAbstractCanvas2D.prototype.pointerEvents=!1,mxAbstractCanvas2D.prototype.createUrlConverter=function(){return new mxUrlConverter},mxAbstractCanvas2D.prototype.reset=function(){this.state=this.createState(),this.states=[]},mxAbstractCanvas2D.prototype.createState=function(){return{dx:0,dy:0,scale:1,alpha:1,fillColor:null,fillAlpha:1,gradientColor:null,gradientAlpha:1,gradientDirection:null,strokeColor:null,strokeWidth:1,dashed:!1,dashPattern:"3 3",lineCap:"flat",lineJoin:"miter",miterLimit:10,fontColor:"#000000",fontBackgroundColor:null,fontBorderColor:null,fontSize:mxConstants.DEFAULT_FONTSIZE,fontFamily:mxConstants.DEFAULT_FONTFAMILY,fontStyle:0,shadow:!1,shadowColor:mxConstants.SHADOWCOLOR,shadowAlpha:mxConstants.SHADOW_OPACITY,shadowDx:mxConstants.SHADOW_OFFSET_X,shadowDy:mxConstants.SHADOW_OFFSET_Y,rotation:0,rotationCx:0,rotationCy:0}},mxAbstractCanvas2D.prototype.format=function(e){return Math.round(parseFloat(e))},mxAbstractCanvas2D.prototype.addOp=function(){if(null!=this.path&&(this.path.push(arguments[0]),2<arguments.length))for(var e=this.state,n=2;n<arguments.length;n+=2)this.lastX=arguments[n-1],this.lastY=arguments[n],this.path.push(this.format((this.lastX+e.dx)*e.scale)),this.path.push(this.format((this.lastY+e.dy)*e.scale))},mxAbstractCanvas2D.prototype.rotatePoint=function(e,n,t,a,i){return t*=Math.PI/180,mxUtils.getRotatedPoint(new mxPoint(e,n),Math.cos(t),Math.sin(t),new mxPoint(a,i))},mxAbstractCanvas2D.prototype.save=function(){this.states.push(this.state),this.state=mxUtils.clone(this.state)},mxAbstractCanvas2D.prototype.restore=function(){this.state=this.states.pop()},mxAbstractCanvas2D.prototype.scale=function(e){this.state.scale*=e,this.state.strokeWidth*=e},mxAbstractCanvas2D.prototype.translate=function(e,n){this.state.dx+=e,this.state.dy+=n},mxAbstractCanvas2D.prototype.setAlpha=function(e){this.state.alpha=e},mxAbstractCanvas2D.prototype.setFillColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fillColor=e,this.state.gradientColor=null},mxAbstractCanvas2D.prototype.setGradient=function(e,n,t,a,i,s,o,r,l){(t=this.state).fillColor=e,t.fillAlpha=null!=r?r:1,t.gradientColor=n,t.gradientAlpha=null!=l?l:1,t.gradientDirection=o},mxAbstractCanvas2D.prototype.setStrokeColor=function(e){e==mxConstants.NONE&&(e=null),this.state.strokeColor=e},mxAbstractCanvas2D.prototype.setStrokeWidth=function(e){this.state.strokeWidth=e},mxAbstractCanvas2D.prototype.setDashed=function(e){this.state.dashed=e},mxAbstractCanvas2D.prototype.setDashPattern=function(e){this.state.dashPattern=e},mxAbstractCanvas2D.prototype.setLineCap=function(e){this.state.lineCap=e},mxAbstractCanvas2D.prototype.setLineJoin=function(e){this.state.lineJoin=e},mxAbstractCanvas2D.prototype.setMiterLimit=function(e){this.state.miterLimit=e},mxAbstractCanvas2D.prototype.setFontColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fontColor=e},mxAbstractCanvas2D.prototype.setFontBackgroundColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fontBackgroundColor=e},mxAbstractCanvas2D.prototype.setFontBorderColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fontBorderColor=e},mxAbstractCanvas2D.prototype.setFontSize=function(e){this.state.fontSize=e},mxAbstractCanvas2D.prototype.setFontFamily=function(e){this.state.fontFamily=e},mxAbstractCanvas2D.prototype.setFontStyle=function(e){null==e&&(e=0),this.state.fontStyle=e},mxAbstractCanvas2D.prototype.setShadow=function(e){this.state.shadow=e},mxAbstractCanvas2D.prototype.setShadowColor=function(e){e==mxConstants.NONE&&(e=null),this.state.shadowColor=e},mxAbstractCanvas2D.prototype.setShadowAlpha=function(e){this.state.shadowAlpha=e},mxAbstractCanvas2D.prototype.setShadowOffset=function(e,n){this.state.shadowDx=e,this.state.shadowDy=n},mxAbstractCanvas2D.prototype.begin=function(){this.lastY=this.lastX=0,this.path=[]},mxAbstractCanvas2D.prototype.moveTo=function(e,n){this.addOp(this.moveOp,e,n)},mxAbstractCanvas2D.prototype.lineTo=function(e,n){this.addOp(this.lineOp,e,n)},mxAbstractCanvas2D.prototype.quadTo=function(e,n,t,a){this.addOp(this.quadOp,e,n,t,a)},mxAbstractCanvas2D.prototype.curveTo=function(e,n,t,a,i,s){this.addOp(this.curveOp,e,n,t,a,i,s)},mxAbstractCanvas2D.prototype.arcTo=function(e,n,t,a,i,s,o){for(e=mxUtils.arcToCurves(this.lastX,this.lastY,e,n,t,a,i,s,o),n=0;n<e.length;n+=6)this.curveTo(e[n],e[n+1],e[n+2],e[n+3],e[n+4],e[n+5])},mxAbstractCanvas2D.prototype.close=function(e,n,t,a,i,s){this.addOp(this.closeOp)},mxAbstractCanvas2D.prototype.end=function(){},mxUtils.extend(mxXmlCanvas2D,mxAbstractCanvas2D),mxXmlCanvas2D.prototype.textEnabled=!0,mxXmlCanvas2D.prototype.compressed=!0,mxXmlCanvas2D.prototype.writeDefaults=function(){var e;(e=this.createElement("fontfamily")).setAttribute("family",mxConstants.DEFAULT_FONTFAMILY),this.root.appendChild(e),(e=this.createElement("fontsize")).setAttribute("size",mxConstants.DEFAULT_FONTSIZE),this.root.appendChild(e),(e=this.createElement("shadowcolor")).setAttribute("color",mxConstants.SHADOWCOLOR),this.root.appendChild(e),(e=this.createElement("shadowalpha")).setAttribute("alpha",mxConstants.SHADOW_OPACITY),this.root.appendChild(e),(e=this.createElement("shadowoffset")).setAttribute("dx",mxConstants.SHADOW_OFFSET_X),e.setAttribute("dy",mxConstants.SHADOW_OFFSET_Y),this.root.appendChild(e)},mxXmlCanvas2D.prototype.format=function(e){return parseFloat(parseFloat(e).toFixed(2))},mxXmlCanvas2D.prototype.createElement=function(e){return this.root.ownerDocument.createElement(e)},mxXmlCanvas2D.prototype.save=function(){this.compressed&&mxAbstractCanvas2D.prototype.save.apply(this,arguments),this.root.appendChild(this.createElement("save"))},mxXmlCanvas2D.prototype.restore=function(){this.compressed&&mxAbstractCanvas2D.prototype.restore.apply(this,arguments),this.root.appendChild(this.createElement("restore"))},mxXmlCanvas2D.prototype.scale=function(e){if(this.compressed){if(this.state.scale==e)return;mxAbstractCanvas2D.prototype.setAlpha.apply(this,arguments)}var n=this.createElement("scale");n.setAttribute("scale",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.translate=function(e,n){var t=this.createElement("translate");t.setAttribute("dx",this.format(e)),t.setAttribute("dy",this.format(n)),this.root.appendChild(t)},mxXmlCanvas2D.prototype.rotate=function(e,n,t,a,i){var s=this.createElement("rotate");(0!=e||n||t)&&(s.setAttribute("theta",this.format(e)),s.setAttribute("flipH",n?"1":"0"),s.setAttribute("flipV",t?"1":"0"),s.setAttribute("cx",this.format(a)),s.setAttribute("cy",this.format(i)),this.root.appendChild(s))},mxXmlCanvas2D.prototype.setAlpha=function(e){if(this.compressed){if(this.state.alpha==e)return;mxAbstractCanvas2D.prototype.setAlpha.apply(this,arguments)}var n=this.createElement("alpha");n.setAttribute("alpha",this.format(e)),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setFillColor=function(e){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fillColor==e)return;mxAbstractCanvas2D.prototype.setFillColor.apply(this,arguments)}var n=this.createElement("fillcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setGradient=function(e,n,t,a,i,s,o,r,l){if(null!=e&&null!=n){mxAbstractCanvas2D.prototype.setGradient.apply(this,arguments);var d=this.createElement("gradient");d.setAttribute("c1",e),d.setAttribute("c2",n),d.setAttribute("x",this.format(t)),d.setAttribute("y",this.format(a)),d.setAttribute("w",this.format(i)),d.setAttribute("h",this.format(s)),null!=o&&d.setAttribute("direction",o),null!=r&&d.setAttribute("alpha1",r),null!=l&&d.setAttribute("alpha2",l),this.root.appendChild(d)}},mxXmlCanvas2D.prototype.setStrokeColor=function(e){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.strokeColor==e)return;mxAbstractCanvas2D.prototype.setStrokeColor.apply(this,arguments)}var n=this.createElement("strokecolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setStrokeWidth=function(e){if(this.compressed){if(this.state.strokeWidth==e)return;mxAbstractCanvas2D.prototype.setStrokeWidth.apply(this,arguments)}var n=this.createElement("strokewidth");n.setAttribute("width",this.format(e)),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setDashed=function(e){if(this.compressed){if(this.state.dashed==e)return;mxAbstractCanvas2D.prototype.setDashed.apply(this,arguments)}var n=this.createElement("dashed");n.setAttribute("dashed",e?"1":"0"),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setDashPattern=function(e){if(this.compressed){if(this.state.dashPattern==e)return;mxAbstractCanvas2D.prototype.setDashPattern.apply(this,arguments)}var n=this.createElement("dashpattern");n.setAttribute("pattern",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setLineCap=function(e){if(this.compressed){if(this.state.lineCap==e)return;mxAbstractCanvas2D.prototype.setLineCap.apply(this,arguments)}var n=this.createElement("linecap");n.setAttribute("cap",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setLineJoin=function(e){if(this.compressed){if(this.state.lineJoin==e)return;mxAbstractCanvas2D.prototype.setLineJoin.apply(this,arguments)}var n=this.createElement("linejoin");n.setAttribute("join",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setMiterLimit=function(e){if(this.compressed){if(this.state.miterLimit==e)return;mxAbstractCanvas2D.prototype.setMiterLimit.apply(this,arguments)}var n=this.createElement("miterlimit");n.setAttribute("limit",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setFontColor=function(e){if(this.textEnabled){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fontColor==e)return;mxAbstractCanvas2D.prototype.setFontColor.apply(this,arguments)}var n=this.createElement("fontcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontBackgroundColor=function(e){if(this.textEnabled){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fontBackgroundColor==e)return;mxAbstractCanvas2D.prototype.setFontBackgroundColor.apply(this,arguments)}var n=this.createElement("fontbackgroundcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontBorderColor=function(e){if(this.textEnabled){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fontBorderColor==e)return;mxAbstractCanvas2D.prototype.setFontBorderColor.apply(this,arguments)}var n=this.createElement("fontbordercolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontSize=function(e){if(this.textEnabled){if(this.compressed){if(this.state.fontSize==e)return;mxAbstractCanvas2D.prototype.setFontSize.apply(this,arguments)}var n=this.createElement("fontsize");n.setAttribute("size",e),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontFamily=function(e){if(this.textEnabled){if(this.compressed){if(this.state.fontFamily==e)return;mxAbstractCanvas2D.prototype.setFontFamily.apply(this,arguments)}var n=this.createElement("fontfamily");n.setAttribute("family",e),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontStyle=function(e){if(this.textEnabled){if(null==e&&(e=0),this.compressed){if(this.state.fontStyle==e)return;mxAbstractCanvas2D.prototype.setFontStyle.apply(this,arguments)}var n=this.createElement("fontstyle");n.setAttribute("style",e),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setShadow=function(e){if(this.compressed){if(this.state.shadow==e)return;mxAbstractCanvas2D.prototype.setShadow.apply(this,arguments)}var n=this.createElement("shadow");n.setAttribute("enabled",e?"1":"0"),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setShadowColor=function(e){if(this.compressed){if(e==mxConstants.NONE&&(e=null),this.state.shadowColor==e)return;mxAbstractCanvas2D.prototype.setShadowColor.apply(this,arguments)}var n=this.createElement("shadowcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setShadowAlpha=function(e){if(this.compressed){if(this.state.shadowAlpha==e)return;mxAbstractCanvas2D.prototype.setShadowAlpha.apply(this,arguments)}var n=this.createElement("shadowalpha");n.setAttribute("alpha",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setShadowOffset=function(e,n){if(this.compressed){if(this.state.shadowDx==e&&this.state.shadowDy==n)return;mxAbstractCanvas2D.prototype.setShadowOffset.apply(this,arguments)}var t=this.createElement("shadowoffset");t.setAttribute("dx",e),t.setAttribute("dy",n),this.root.appendChild(t)},mxXmlCanvas2D.prototype.rect=function(e,n,t,a){var i=this.createElement("rect");i.setAttribute("x",this.format(e)),i.setAttribute("y",this.format(n)),i.setAttribute("w",this.format(t)),i.setAttribute("h",this.format(a)),this.root.appendChild(i)},mxXmlCanvas2D.prototype.roundrect=function(e,n,t,a,i,s){var o=this.createElement("roundrect");o.setAttribute("x",this.format(e)),o.setAttribute("y",this.format(n)),o.setAttribute("w",this.format(t)),o.setAttribute("h",this.format(a)),o.setAttribute("dx",this.format(i)),o.setAttribute("dy",this.format(s)),this.root.appendChild(o)},mxXmlCanvas2D.prototype.ellipse=function(e,n,t,a){var i=this.createElement("ellipse");i.setAttribute("x",this.format(e)),i.setAttribute("y",this.format(n)),i.setAttribute("w",this.format(t)),i.setAttribute("h",this.format(a)),this.root.appendChild(i)},mxXmlCanvas2D.prototype.image=function(e,n,t,a,i,s,o,r){i=this.converter.convert(i);var l=this.createElement("image");l.setAttribute("x",this.format(e)),l.setAttribute("y",this.format(n)),l.setAttribute("w",this.format(t)),l.setAttribute("h",this.format(a)),l.setAttribute("src",i),l.setAttribute("aspect",s?"1":"0"),l.setAttribute("flipH",o?"1":"0"),l.setAttribute("flipV",r?"1":"0"),this.root.appendChild(l)},mxXmlCanvas2D.prototype.begin=function(){this.root.appendChild(this.createElement("begin")),this.lastY=this.lastX=0},mxXmlCanvas2D.prototype.moveTo=function(e,n){var t=this.createElement("move");t.setAttribute("x",this.format(e)),t.setAttribute("y",this.format(n)),this.root.appendChild(t),this.lastX=e,this.lastY=n},mxXmlCanvas2D.prototype.lineTo=function(e,n){var t=this.createElement("line");t.setAttribute("x",this.format(e)),t.setAttribute("y",this.format(n)),this.root.appendChild(t),this.lastX=e,this.lastY=n},mxXmlCanvas2D.prototype.quadTo=function(e,n,t,a){var i=this.createElement("quad");i.setAttribute("x1",this.format(e)),i.setAttribute("y1",this.format(n)),i.setAttribute("x2",this.format(t)),i.setAttribute("y2",this.format(a)),this.root.appendChild(i),this.lastX=t,this.lastY=a},mxXmlCanvas2D.prototype.curveTo=function(e,n,t,a,i,s){var o=this.createElement("curve");o.setAttribute("x1",this.format(e)),o.setAttribute("y1",this.format(n)),o.setAttribute("x2",this.format(t)),o.setAttribute("y2",this.format(a)),o.setAttribute("x3",this.format(i)),o.setAttribute("y3",this.format(s)),this.root.appendChild(o),this.lastX=i,this.lastY=s},mxXmlCanvas2D.prototype.close=function(){this.root.appendChild(this.createElement("close"))},mxXmlCanvas2D.prototype.text=function(e,n,t,a,i,s,o,r,l,d,c,m){if(this.textEnabled&&null!=i){mxUtils.isNode(i)&&(i=mxUtils.getOuterHtml(i));var u=this.createElement("text");u.setAttribute("x",this.format(e)),u.setAttribute("y",this.format(n)),u.setAttribute("w",this.format(t)),u.setAttribute("h",this.format(a)),u.setAttribute("str",i),null!=s&&u.setAttribute("align",s),null!=o&&u.setAttribute("valign",o),u.setAttribute("wrap",r?"1":"0"),null==l&&(l=""),u.setAttribute("format",l),null!=d&&u.setAttribute("fill",d?"1":"0"),null!=c&&u.setAttribute("clip",c?"1":"0"),null!=m&&u.setAttribute("rotation",m),this.root.appendChild(u)}},mxXmlCanvas2D.prototype.stroke=function(){this.root.appendChild(this.createElement("stroke"))},mxXmlCanvas2D.prototype.fill=function(){this.root.appendChild(this.createElement("fill"))},mxXmlCanvas2D.prototype.fillAndStroke=function(){this.root.appendChild(this.createElement("fillstroke"))},mxUtils.extend(mxSvgCanvas2D,mxAbstractCanvas2D),mxSvgCanvas2D.prototype.node=null,mxSvgCanvas2D.prototype.matchHtmlAlignment=!0,mxSvgCanvas2D.prototype.textEnabled=!0,mxSvgCanvas2D.prototype.foEnabled=!0,mxSvgCanvas2D.prototype.strokeTolerance=0,mxSvgCanvas2D.prototype.refCount=0,mxSvgCanvas2D.prototype.blockImagePointerEvents=!1,mxSvgCanvas2D.prototype.reset=function(){mxAbstractCanvas2D.prototype.reset.apply(this,arguments),this.gradients=[]},mxSvgCanvas2D.prototype.createStyle=function(e){return(e=this.createElement("style")).setAttribute("type","text/css"),mxUtils.write(e,"svg{font-family:"+mxConstants.DEFAULT_FONTFAMILY+";font-size:"+mxConstants.DEFAULT_FONTSIZE+";fill:none;stroke-miterlimit:10}"),e},mxSvgCanvas2D.prototype.createElement=function(e,n){if(null!=this.root.ownerDocument.createElementNS)return this.root.ownerDocument.createElementNS(n||mxConstants.NS_SVG,e);var t=this.root.ownerDocument.createElement(e);return null!=n&&t.setAttribute("xmlns",n),t},mxSvgCanvas2D.prototype.createGradientId=function(e,n,t,a,i){return"#"==e.charAt(0)&&(e=e.substring(1)),"#"==n.charAt(0)&&(n=n.substring(1)),e=e.toLowerCase()+"-"+t,n=n.toLowerCase()+"-"+a,(t=null)==i||i==mxConstants.DIRECTION_SOUTH?t="s":i==mxConstants.DIRECTION_EAST?t="e":(a=e,e=n,n=a,i==mxConstants.DIRECTION_NORTH?t="s":i==mxConstants.DIRECTION_WEST&&(t="e")),"mx-gradient-"+e+"-"+n+"-"+t},mxSvgCanvas2D.prototype.getSvgGradient=function(e,n,t,a,i){var s=this.createGradientId(e,n,t,a,i),o=this.gradients[s];if(null==o){var r=this.root.ownerSVGElement,l=0,d=s+"-"+l;if(null!=r)for(o=r.ownerDocument.getElementById(d);null!=o&&o.ownerSVGElement!=r;)d=s+"-"+l++,o=r.ownerDocument.getElementById(d);else d="id"+ ++this.refCount;null==o&&((o=this.createSvgGradient(e,n,t,a,i)).setAttribute("id",d),null!=this.defs?this.defs.appendChild(o):r.appendChild(o)),this.gradients[s]=o}return o.getAttribute("id")},mxSvgCanvas2D.prototype.createSvgGradient=function(e,n,t,a,i){var s=this.createElement("linearGradient");return s.setAttribute("x1","0%"),s.setAttribute("y1","0%"),s.setAttribute("x2","0%"),s.setAttribute("y2","0%"),null==i||i==mxConstants.DIRECTION_SOUTH?s.setAttribute("y2","100%"):i==mxConstants.DIRECTION_EAST?s.setAttribute("x2","100%"):i==mxConstants.DIRECTION_NORTH?s.setAttribute("y1","100%"):i==mxConstants.DIRECTION_WEST&&s.setAttribute("x1","100%"),t=t<1?";stop-opacity:"+t:"",(i=this.createElement("stop")).setAttribute("offset","0%"),i.setAttribute("style","stop-color:"+e+t),s.appendChild(i),t=a<1?";stop-opacity:"+a:"",(i=this.createElement("stop")).setAttribute("offset","100%"),i.setAttribute("style","stop-color:"+n+t),s.appendChild(i),s},mxSvgCanvas2D.prototype.addNode=function(e,n){var t=this.node,a=this.state;if(null!=t){if("path"==t.nodeName){if(!(null!=this.path&&0<this.path.length))return;t.setAttribute("d",this.path.join(" "))}e&&null!=a.fillColor?this.updateFill():this.styleEnabled||("ellipse"!=t.nodeName||!mxClient.IS_NS||mxClient.IS_GC||mxClient.IS_SF?t.setAttribute("fill","none"):t.setAttribute("fill","transparent"),e=!1),n&&null!=a.strokeColor?this.updateStroke():this.styleEnabled||t.setAttribute("stroke","none"),null!=a.transform&&0<a.transform.length&&t.setAttribute("transform",a.transform),a.shadow&&this.root.appendChild(this.createShadow(t)),0<this.strokeTolerance&&!e&&this.root.appendChild(this.createTolerance(t)),this.pointerEvents&&("path"!=t.nodeName||this.path[this.path.length-1]==this.closeOp)&&t.setAttribute("pointer-events","all"),this.root.appendChild(t)}},mxSvgCanvas2D.prototype.updateFill=function(){var e=this.state;e.alpha<1&&this.node.setAttribute("fill-opacity",e.alpha),null!=e.fillColor&&(null!=e.gradientColor?(e=this.getSvgGradient(e.fillColor,e.gradientColor,e.fillAlpha,e.gradientAlpha,e.gradientDirection),this.node.setAttribute("fill","url(#"+e+")")):this.node.setAttribute("fill",e.fillColor.toLowerCase()))},mxSvgCanvas2D.prototype.updateStroke=function(){var e=this.state;this.node.setAttribute("stroke",e.strokeColor.toLowerCase()),e.alpha<1&&this.node.setAttribute("stroke-opacity",e.alpha);var n=Math.max(1,this.format(e.strokeWidth*e.scale));1!=n&&this.node.setAttribute("stroke-width",n),"path"==this.node.nodeName&&this.updateStrokeAttributes(),e.dashed&&this.node.setAttribute("stroke-dasharray",this.createDashPattern(n))},mxSvgCanvas2D.prototype.updateStrokeAttributes=function(){var e=this.state;if(null!=e.lineJoin&&"miter"!=e.lineJoin&&this.node.setAttribute("stroke-linejoin",e.lineJoin),null!=e.lineCap){var n=e.lineCap;"flat"==n&&(n="butt"),"butt"!=n&&this.node.setAttribute("stroke-linecap",n)}null!=e.miterLimit&&(!this.styleEnabled||10!=e.miterLimit)&&this.node.setAttribute("stroke-miterlimit",e.miterLimit)},mxSvgCanvas2D.prototype.createDashPattern=function(e){var n=this.state.dashPattern.split(" "),t=[];if(0<n.length)for(var a=0;a<n.length;a++)t[a]=Number(n[a])*e;return t.join(" ")},mxSvgCanvas2D.prototype.createTolerance=function(e){e=e.cloneNode(!0);var n=parseFloat(e.getAttribute("stroke-width")||1)+this.strokeTolerance;return e.setAttribute("pointer-events","stroke"),e.setAttribute("visibility","hidden"),e.removeAttribute("stroke-dasharray"),e.setAttribute("stroke-width",n),e.setAttribute("fill","none"),e.setAttribute("stroke",mxClient.IS_OP?"none":"white"),e},mxSvgCanvas2D.prototype.createShadow=function(e){e=e.cloneNode(!0);var n=this.state;return"none"!=e.getAttribute("fill")&&e.setAttribute("fill",n.shadowColor),"none"!=e.getAttribute("stroke")&&e.setAttribute("stroke",n.shadowColor),e.setAttribute("transform","translate("+this.format(n.shadowDx*n.scale)+","+this.format(n.shadowDy*n.scale)+")"+(n.transform||"")),e.setAttribute("opacity",n.shadowAlpha),e},mxSvgCanvas2D.prototype.rotate=function(e,n,t,a,i){if(0!=e||n||t){var s=this.state;if(a+=s.dx,i+=s.dy,a*=s.scale,i*=s.scale,s.transform=s.transform||"",n&&t)e+=180;else if(n^t){var o=n?a:0,r=n?-1:1,l=t?i:0,d=t?-1:1;s.transform+="translate("+this.format(o)+","+this.format(l)+")scale("+this.format(r)+","+this.format(d)+")translate("+this.format(-o)+","+this.format(-l)+")"}(n?!t:t)&&(e*=-1),0!=e&&(s.transform+="rotate("+this.format(e)+","+this.format(a)+","+this.format(i)+")"),s.rotation+=e,s.rotationCx=a,s.rotationCy=i}},mxSvgCanvas2D.prototype.begin=function(){mxAbstractCanvas2D.prototype.begin.apply(this,arguments),this.node=this.createElement("path")},mxSvgCanvas2D.prototype.rect=function(e,n,t,a){var i=this.state,s=this.createElement("rect");s.setAttribute("x",this.format((e+i.dx)*i.scale)),s.setAttribute("y",this.format((n+i.dy)*i.scale)),s.setAttribute("width",this.format(t*i.scale)),s.setAttribute("height",this.format(a*i.scale)),this.node=s},mxSvgCanvas2D.prototype.roundrect=function(e,n,t,a,i,s){this.rect(e,n,t,a),0<i&&this.node.setAttribute("rx",this.format(i*this.state.scale)),0<s&&this.node.setAttribute("ry",this.format(s*this.state.scale))},mxSvgCanvas2D.prototype.ellipse=function(e,n,t,a){var i=this.state,s=this.createElement("ellipse");s.setAttribute("cx",Math.round((e+t/2+i.dx)*i.scale)),s.setAttribute("cy",Math.round((n+a/2+i.dy)*i.scale)),s.setAttribute("rx",t/2*i.scale),s.setAttribute("ry",a/2*i.scale),this.node=s},mxSvgCanvas2D.prototype.image=function(e,n,t,a,i,s,o,r){i=this.converter.convert(i),s=null==s||s,o=null!=o&&o,r=null!=r&&r;var l=this.state;e+=l.dx,n+=l.dy;var d=this.createElement("image");if(d.setAttribute("x",this.format(e*l.scale)),d.setAttribute("y",this.format(n*l.scale)),d.setAttribute("width",this.format(t*l.scale)),d.setAttribute("height",this.format(a*l.scale)),null==d.setAttributeNS?d.setAttribute("xlink:href",i):d.setAttributeNS(mxConstants.NS_XLINK,"href",i),s||d.setAttribute("preserveAspectRatio","none"),l.alpha<1&&d.setAttribute("opacity",l.alpha),i=this.state.transform||"",o||r){var c=s=1,m=0,u=0;o&&(s=-1,m=-t-2*e),r&&(c=-1,u=-a-2*n),i+="scale("+s+","+c+")translate("+m+","+u+")"}0<i.length&&d.setAttribute("transform",i),this.root.appendChild(d),this.blockImagePointerEvents&&(d.setAttribute("style","pointer-events:none"),(d=this.createElement("rect")).setAttribute("visibility","hidden"),d.setAttribute("pointer-events","fill"),d.setAttribute("x",this.format(e*l.scale)),d.setAttribute("y",this.format(n*l.scale)),d.setAttribute("width",this.format(t*l.scale)),d.setAttribute("height",this.format(a*l.scale)),this.root.appendChild(d))},mxSvgCanvas2D.prototype.createDiv=function(e,n,t,a,i){return t=this.state,a="display:inline-block;font-size:"+Math.round(t.fontSize)+"px;font-family:"+t.fontFamily+";color:"+t.fontColor+";line-height:"+Math.round(t.fontSize*mxConstants.LINE_HEIGHT)+"px;"+a,(t.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(a+="font-weight:bold;"),(t.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(a+="font-style:italic;"),(t.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(a+="font-decoration:underline;"),n==mxConstants.ALIGN_CENTER?a+="text-align:center;":n==mxConstants.ALIGN_RIGHT&&(a+="text-align:right;"),n="",null!=t.fontBackgroundColor&&(n+="background-color:"+t.fontBackgroundColor+";"),null!=t.fontBorderColor&&(n+="border:1px solid "+t.fontBorderColor+";"),mxUtils.isNode(e)||((t=document.createElement("textarea")).innerHTML=e.replace(/&lt;/g,"&amp;lt;").replace(/&gt;/g,"&amp;gt;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e=t.value,i?a+=n:0<n.length&&(e='<div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;'+n+'">'+e+"</div>")),!mxClient.IS_IE&&document.createElementNS?((i=document.createElementNS("http://www.w3.org/1999/xhtml","div")).setAttribute("style",a),mxUtils.isNode(e)?this.root.ownerDocument!=document?i.appendChild(e.cloneNode(!0)):i.appendChild(e):i.innerHTML=e,i):(mxUtils.isNode(e)&&this.root.ownerDocument!=document&&(e=e.outerHTML),e=e.replace(/<br>/g,"<br />").replace(/<hr>/g,"<hr />"),mxUtils.parseXml('<div xmlns="http://www.w3.org/1999/xhtml" style="'+a+'">'+e+"</div>").documentElement)},mxSvgCanvas2D.prototype.text=function(e,n,t,a,i,s,o,r,l,d,c,m){if(this.textEnabled&&null!=i){m=null!=m?m:0;var u=this.state;if(e+=u.dx,n+=u.dy,this.foEnabled&&"html"==l){var p="vertical-align:top;";if(c?(p+="overflow:hidden;",0<a&&(p+="max-height:"+Math.round(a)+"px;"),0<t&&(p+="width:"+Math.round(t)+"px;")):d&&(p+="width:"+Math.round(t)+"px;",0<a&&(p+="max-height:"+Math.round(a)+"px;")),r?(!c&&0<t&&(p+="width:"+Math.round(t)+"px;"),p+="white-space:normal;"):p+="white-space:nowrap;",r=this.createElement("g"),u.alpha<1&&r.setAttribute("opacity",u.alpha),(l=this.createElement("foreignObject")).setAttribute("pointer-events","all"),null!=(p=this.createDiv(i,s,o,p,d))){r.appendChild(l),this.root.appendChild(r);var g=0;if(mxClient.IS_IE&&!mxClient.IS_SVG){var v=document.createElement("div");v.style.cssText=p.getAttribute("style"),v.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",v.style.visibility="hidden",v.innerHTML=mxUtils.isNode(i)?i.outerHTML:i,document.body.appendChild(v),g=v.offsetWidth,a=mxClient.IS_QUIRKS&&0<a&&c?Math.min(a,v.offsetHeight+2):v.offsetHeight,v.parentNode.removeChild(v),l.appendChild(p)}else this.root.ownerDocument!=document?(p.style.visibility="hidden",document.body.appendChild(p),g=p.offsetWidth,a=p.offsetHeight,l.appendChild(p),p.style.visibility=""):(l.appendChild(p),g=p.offsetWidth,a=p.offsetHeight);t=d?Math.max(t,g):g,u.alpha<1&&r.setAttribute("opacity",u.alpha),d=i=0,s==mxConstants.ALIGN_CENTER?i-=t/2:s==mxConstants.ALIGN_RIGHT&&(i-=t),e+=i,o==mxConstants.ALIGN_MIDDLE?d-=a/2:o==mxConstants.ALIGN_BOTTOM&&(d-=a),n+=d,s=1!=u.scale?"scale("+u.scale+")":"",0!=u.rotation&&this.rotateHtml?(s+="rotate("+u.rotation+","+t/2+","+a/2+")",e=(n=this.rotatePoint((e+t/2)*u.scale,(n+a/2)*u.scale,u.rotation,u.rotationCx,u.rotationCy)).x-t*u.scale/2,n=n.y-a*u.scale/2):(e*=u.scale,n*=u.scale),0!=m&&(s+="rotate("+m+","+-i+","+-d+")"),r.setAttribute("transform","translate("+Math.round(e)+","+Math.round(n)+")"+s),l.setAttribute("width",Math.round(Math.max(1,t))),l.setAttribute("height",Math.round(Math.max(1,a)))}}else this.plainText(e,n,t,a,i,s,o,r,d,c,m)}},mxSvgCanvas2D.prototype.createClip=function(e,n,t,a){for(var i="mx-clip-"+(e=Math.round(e))+"-"+(n=Math.round(n))+"-"+(t=Math.round(t))+"-"+(a=Math.round(a)),s=0,o=i+"-"+s;null!=document.getElementById(o);)o=i+"-"+ ++s;return clip=this.createElement("clipPath"),clip.setAttribute("id",o),(i=this.createElement("rect")).setAttribute("x",e),i.setAttribute("y",n),i.setAttribute("width",t),i.setAttribute("height",a),clip.appendChild(i),clip},mxSvgCanvas2D.prototype.plainText=function(e,n,t,a,i,s,o,r,l,d,c){c=null!=c?c:0,r=this.state;var m=Math.round(r.fontSize),u=this.createElement("g"),p=r.transform||"";if(0!=c&&(p+="rotate("+c+","+this.format(e*r.scale)+","+this.format(n*r.scale)+")"),d&&0<t&&0<a){var g=e;c=n,s==mxConstants.ALIGN_CENTER?g-=t/2:s==mxConstants.ALIGN_RIGHT&&(g-=t),o==mxConstants.ALIGN_MIDDLE?c-=a/2:o==mxConstants.ALIGN_BOTTOM&&(c-=a),c=this.createClip(g*r.scale-2,c*r.scale-2,t*r.scale+4,a*r.scale+4),null!=this.defs?this.defs.appendChild(c):this.root.appendChild(c),u.setAttribute("clip-path","url(#"+c.getAttribute("id")+")")}this.updateFont(u,s),"start"!=(c=s==mxConstants.ALIGN_RIGHT?"end":s==mxConstants.ALIGN_CENTER?"middle":"start")&&u.setAttribute("text-anchor",c),(!this.styleEnabled||m!=mxConstants.DEFAULT_FONTSIZE)&&u.setAttribute("font-size",Math.round(m*r.scale)+"px"),0<p.length&&u.setAttribute("transform",p),r.alpha<1&&u.setAttribute("opacity",r.alpha);p=i.split("\n"),g=Math.round(m*mxConstants.LINE_HEIGHT);var v=m+(p.length-1)*g;for(c=n+m-1,o==mxConstants.ALIGN_MIDDLE?c-=(a=(this.matchHtmlAlignment&&d&&0<a?Math.min(v,a):v)/2)+1:o==mxConstants.ALIGN_BOTTOM&&(c-=(a=this.matchHtmlAlignment&&d&&0<a?Math.min(v,a):v)+2),a=0;a<p.length;a++)0<p[a].length&&0<mxUtils.trim(p[a]).length&&((d=this.createElement("text")).setAttribute("x",this.format(e*r.scale)),d.setAttribute("y",this.format(c*r.scale)),mxUtils.write(d,p[a]),u.appendChild(d)),c+=g;this.root.appendChild(u),this.addTextBackground(u,i,e,n,t,v,s,o,l)},mxSvgCanvas2D.prototype.updateFont=function(e){var n=this.state;e.setAttribute("fill",n.fontColor),(!this.styleEnabled||n.fontFamily!=mxConstants.DEFAULT_FONTFAMILY)&&e.setAttribute("font-family",n.fontFamily),(n.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&e.setAttribute("font-weight","bold"),(n.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&e.setAttribute("font-style","italic"),(n.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&e.setAttribute("text-decoration","underline")},mxSvgCanvas2D.prototype.addTextBackground=function(e,n,t,a,i,s,o,r,l){var d=this.state;if(null!=d.fontBackgroundColor||null!=d.fontBorderColor){var c=null;null!=(c=l?(o==mxConstants.ALIGN_CENTER?t-=i/2:o==mxConstants.ALIGN_RIGHT&&(t-=i),r==mxConstants.ALIGN_MIDDLE?a-=s/2:r==mxConstants.ALIGN_BOTTOM&&(a-=s),new mxRectangle((t+1)*d.scale,a*d.scale,(i-2)*d.scale,(s+2)*d.scale)):null!=e.getBBox&&this.root.ownerDocument==document?(c=e.getBBox(),n=mxClient.IS_IE&&mxClient.IS_SVG,new mxRectangle(c.x,c.y+(n?0:1),c.width,c.height+(n?1:0))):((c=document.createElement("div")).style.lineHeight=Math.round(d.fontSize*mxConstants.LINE_HEIGHT)+"px",c.style.fontSize=Math.round(d.fontSize)+"px",c.style.fontFamily=d.fontFamily,c.style.whiteSpace="nowrap",c.style.position="absolute",c.style.visibility="hidden",c.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",c.style.zoom="1",(d.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(c.style.fontWeight="bold"),(d.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(c.style.fontStyle="italic"),n=mxUtils.htmlEntities(n,!1),c.innerHTML=n.replace(/\n/g,"<br/>"),document.body.appendChild(c),i=c.offsetWidth,s=c.offsetHeight,c.parentNode.removeChild(c),o==mxConstants.ALIGN_CENTER?t-=i/2:o==mxConstants.ALIGN_RIGHT&&(t-=i),r==mxConstants.ALIGN_MIDDLE?a-=s/2:r==mxConstants.ALIGN_BOTTOM&&(a-=s),new mxRectangle((t+1)*d.scale,(a+2)*d.scale,i*d.scale,(s+1)*d.scale)))&&((n=this.createElement("rect")).setAttribute("fill",d.fontBackgroundColor||"none"),n.setAttribute("stroke",d.fontBorderColor||"none"),n.setAttribute("x",Math.floor(c.x-1)),n.setAttribute("y",Math.floor(c.y-1)),n.setAttribute("width",Math.ceil(c.width+2)),n.setAttribute("height",Math.ceil(c.height)),d=null!=d.fontBorderColor?Math.max(1,this.format(d.scale)):0,n.setAttribute("stroke-width",d),this.root.ownerDocument==document&&1==mxUtils.mod(d,2)&&n.setAttribute("transform","translate(0.5, 0.5)"),e.insertBefore(n,e.firstChild))}},mxSvgCanvas2D.prototype.stroke=function(){this.addNode(!1,!0)},mxSvgCanvas2D.prototype.fill=function(){this.addNode(!0,!1)},mxSvgCanvas2D.prototype.fillAndStroke=function(){this.addNode(!0,!0)};var mxVmlCanvas2D=function(e){mxAbstractCanvas2D.call(this),this.root=e};function mxGuide(e,n){this.graph=e,this.setStates(n)}function mxStencil(e){this.desc=e,this.parseDescription(),this.parseConstraints()}function mxShape(e){this.stencil=e,this.strokewidth=1,this.rotation=0,this.opacity=100,this.flipV=this.flipH=!1}mxUtils.extend(mxVmlCanvas2D,mxAbstractCanvas2D),mxVmlCanvas2D.prototype.node=null,mxVmlCanvas2D.prototype.textEnabled=!0,mxVmlCanvas2D.prototype.moveOp="m",mxVmlCanvas2D.prototype.lineOp="l",mxVmlCanvas2D.prototype.curveOp="c",mxVmlCanvas2D.prototype.closeOp="x",mxVmlCanvas2D.prototype.rotatedHtmlBackground="",mxVmlCanvas2D.prototype.vmlScale=1,mxVmlCanvas2D.prototype.addNode=function(e,n){var t=this.node,a=this.state;if(null!=t){if("shape"==t.nodeName){if(!(null!=this.path&&0<this.path.length))return;t.path=this.path.join(" ")+" e",t.style.width=this.root.style.width,t.style.height=this.root.style.height,t.coordsize=parseInt(t.style.width)+" "+parseInt(t.style.height)}t.strokeweight=this.format(Math.max(1,a.strokeWidth*a.scale/this.vmlScale))+"px",a.shadow&&this.root.appendChild(this.createShadow(t,e&&null!=a.fillColor,n&&null!=a.strokeColor)),n&&null!=a.strokeColor?(t.stroked="true",t.strokecolor=a.strokeColor):t.stroked="false",t.appendChild(this.createStroke()),e&&null!=a.fillColor?t.appendChild(this.createFill()):!this.pointerEvents||"shape"==t.nodeName&&this.path[this.path.length-1]!=this.closeOp?t.filled="false":t.appendChild(this.createTransparentFill()),this.root.appendChild(t)}},mxVmlCanvas2D.prototype.createTransparentFill=function(){var e=document.createElement(mxClient.VML_PREFIX+":fill");return e.src=mxClient.imageBasePath+"/transparent.gif",e.type="tile",e},mxVmlCanvas2D.prototype.createFill=function(){var e=this.state,n=document.createElement(mxClient.VML_PREFIX+":fill");if(n.color=e.fillColor,null!=e.gradientColor){n.type="gradient",n.method="none",n.color2=e.gradientColor;var t=180-e.rotation;t=e.gradientDirection==mxConstants.DIRECTION_WEST?t-(90+("x"==this.root.style.flip?180:0)):e.gradientDirection==mxConstants.DIRECTION_EAST?t+(90+("x"==this.root.style.flip?180:0)):e.gradientDirection==mxConstants.DIRECTION_NORTH?t-(180+("y"==this.root.style.flip?-180:0)):t+("y"==this.root.style.flip?-180:0);"x"!=this.root.style.flip&&"y"!=this.root.style.flip||(t*=-1),n.angle=mxUtils.mod(t,360),n.opacity=100*e.alpha*e.fillAlpha+"%",n.setAttribute(mxClient.OFFICE_PREFIX+":opacity2",100*e.alpha*e.gradientAlpha+"%")}else e.alpha<1&&(n.opacity=100*e.alpha+"%");return n},mxVmlCanvas2D.prototype.createStroke=function(){var e=this.state,n=document.createElement(mxClient.VML_PREFIX+":stroke");return n.endcap=e.lineCap||"flat",n.joinstyle=e.lineJoin||"miter",n.miterlimit=e.miterLimit||"10",e.alpha<1&&(n.opacity=100*e.alpha+"%"),e.dashed&&(n.dashstyle=this.getVmlDashStyle()),n},mxVmlCanvas2D.prototype.getVmlDashStyle=function(){var e="dash";if(null!=this.state.dashPattern){var n=this.state.dashPattern.split(" ");0<n.length&&1==n[0]&&(e="0 2")}return e},mxVmlCanvas2D.prototype.createShadow=function(e,n,t){var a=this.state,i=-a.rotation*(Math.PI/180),s=Math.cos(i),o=(i=Math.sin(i),a.shadowDx*a.scale),r=a.shadowDy*a.scale;"x"==this.root.style.flip?o*=-1:"y"==this.root.style.flip&&(r*=-1);var l=e.cloneNode(!0);return l.style.marginLeft=Math.round(o*s-r*i)+"px",l.style.marginTop=Math.round(o*i+r*s)+"px",8==document.documentMode&&(l.strokeweight=e.strokeweight,"shape"==e.nodeName&&(l.path=this.path.join(" ")+" e",l.style.width=this.root.style.width,l.style.height=this.root.style.height,l.coordsize=parseInt(e.style.width)+" "+parseInt(e.style.height))),t?(l.strokecolor=a.shadowColor,l.appendChild(this.createShadowStroke())):l.stroked="false",n?l.appendChild(this.createShadowFill()):l.filled="false",l},mxVmlCanvas2D.prototype.createShadowFill=function(){var e=document.createElement(mxClient.VML_PREFIX+":fill");return e.color=this.state.shadowColor,e.opacity=100*this.state.alpha*this.state.shadowAlpha+"%",e},mxVmlCanvas2D.prototype.createShadowStroke=function(){var e=this.createStroke();return e.opacity=100*this.state.alpha*this.state.shadowAlpha+"%",e},mxVmlCanvas2D.prototype.rotate=function(e,n,t,a,i){n&&t?e+=180:n?this.root.style.flip="x":t&&(this.root.style.flip="y"),(n?!t:t)&&(e*=-1),this.root.style.rotation=e,this.state.rotation+=e,this.state.rotationCx=a,this.state.rotationCy=i},mxVmlCanvas2D.prototype.begin=function(){mxAbstractCanvas2D.prototype.begin.apply(this,arguments),this.node=document.createElement(mxClient.VML_PREFIX+":shape"),this.node.style.position="absolute"},mxVmlCanvas2D.prototype.quadTo=function(e,n,t,a){var i=this.state,s=(this.lastX+i.dx)*i.scale,o=(this.lastY+i.dy)*i.scale;e=(e+i.dx)*i.scale;o+=2/3*((n=(n+i.dy)*i.scale)-o);var r=(t=(t+i.dx)*i.scale)+2/3*(e-t);n=(a=(a+i.dy)*i.scale)+2/3*(n-a),this.path.push("c "+this.format(s+2/3*(e-s))+" "+this.format(o)+" "+this.format(r)+" "+this.format(n)+" "+this.format(t)+" "+this.format(a)),this.lastX=t/i.scale-i.dx,this.lastY=a/i.scale-i.dy},mxVmlCanvas2D.prototype.createRect=function(e,n,t,a,i){var s=this.state;return(e=document.createElement(e)).style.position="absolute",e.style.left=this.format((n+s.dx)*s.scale)+"px",e.style.top=this.format((t+s.dy)*s.scale)+"px",e.style.width=this.format(a*s.scale)+"px",e.style.height=this.format(i*s.scale)+"px",e},mxVmlCanvas2D.prototype.rect=function(e,n,t,a){this.node=this.createRect(mxClient.VML_PREFIX+":rect",e,n,t,a)},mxVmlCanvas2D.prototype.roundrect=function(e,n,t,a,i,s){this.node=this.createRect(mxClient.VML_PREFIX+":roundrect",e,n,t,a),this.node.setAttribute("arcsize",Math.max(100*i/t,100*s/a)+"%")},mxVmlCanvas2D.prototype.ellipse=function(e,n,t,a){this.node=this.createRect(mxClient.VML_PREFIX+":oval",e,n,t,a)},mxVmlCanvas2D.prototype.image=function(e,n,t,a,i,s,o,r){var l=null;s?((l=this.createRect(mxClient.VML_PREFIX+":rect",e,n,t,a)).stroked="false",(e=document.createElement(mxClient.VML_PREFIX+":fill")).aspect=s?"atmost":"ignore",e.rotate="true",e.type="frame",e.src=i,l.appendChild(e)):(l=this.createRect(mxClient.VML_PREFIX+":image",e,n,t,a)).src=i,o&&r?l.style.rotation="180":o?l.style.flip="x":r&&(l.style.flip="y"),this.state.alpha<1&&(l.style.filter+="alpha(opacity="+100*this.state.alpha+")"),this.root.appendChild(l)},mxVmlCanvas2D.prototype.createDiv=function(e,n,t,a){t=document.createElement("div");var i=this.state,s="";return null!=i.fontBackgroundColor&&(s+="background-color:"+i.fontBackgroundColor+";"),null!=i.fontBorderColor&&(s+="border:1px solid "+i.fontBorderColor+";"),mxUtils.isNode(e)?t.appendChild(e):0<s.length&&!a?((a=document.createElement("div")).style.cssText=s,a.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",a.style.zoom="1",a.innerHTML=e,t.appendChild(a)):(t.style.cssText=s,t.innerHTML=e),(e=t.style).fontSize=Math.round(i.fontSize/this.vmlScale)+"px",e.fontFamily=i.fontFamily,e.color=i.fontColor,e.verticalAlign="top",e.textAlign=n||"left",e.lineHeight=Math.round(i.fontSize*mxConstants.LINE_HEIGHT/this.vmlScale)+"px",(i.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(e.fontWeight="bold"),(i.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(e.fontStyle="italic"),(i.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(e.fontDecoration="underline"),t},mxVmlCanvas2D.prototype.text=function(e,n,t,a,i,s,o,r,l,d,c,m){if(this.textEnabled&&null!=i){var u=this.state;if("html"==l){null!=u.rotation&&(e=(n=this.rotatePoint(e,n,u.rotation,u.rotationCx,u.rotationCy)).x,n=n.y),8==document.documentMode?(e+=u.dx,n+=u.dy):(e*=u.scale,n*=u.scale),(l=8==document.documentMode?document.createElement(mxClient.VML_PREFIX+":group"):document.createElement("div")).style.position="absolute",l.style.display="inline",l.style.left=this.format(e)+"px",l.style.top=this.format(n)+"px",l.style.zoom=u.scale;var p=document.createElement("div");p.style.position="relative",p.style.display="inline";var g=(v=mxUtils.getAlignmentAsPoint(s,o)).x,v=v.y;if(i=this.createDiv(i,s,o,d),s=document.createElement("div"),r?(!c&&0<t&&(i.style.width=Math.round(t)+"px"),i.style.whiteSpace="normal"):i.style.whiteSpace="nowrap",r=u.rotation+(m||0),this.rotateHtml&&0!=r?(s.style.display="inline",s.style.zoom="1",s.appendChild(i),8==document.documentMode&&"DIV"!=this.root.nodeName?(p.appendChild(s),l.appendChild(p)):l.appendChild(s)):8==document.documentMode?(p.appendChild(i),l.appendChild(p)):(i.style.display="inline",l.appendChild(i)),"DIV"!=this.root.nodeName?((m=document.createElement(mxClient.VML_PREFIX+":rect")).stroked="false",m.filled="false",m.appendChild(l),this.root.appendChild(m)):this.root.appendChild(l),c?(i.style.overflow="hidden",0<t&&(i.style.width=Math.round(t)+"px"),0<a&&8==document.documentMode&&(i.style.maxHeight=Math.round(a)+"px")):d&&(i.style.width=t+"px",0<a&&(i.style.maxHeight=Math.round(a)+"px")),this.rotateHtml&&0!=r){t=r*(Math.PI/180),r=parseFloat(parseFloat(Math.cos(t)).toFixed(8)),m=parseFloat(parseFloat(Math.sin(-t)).toFixed(8)),(t%=2*Math.PI)<0&&(t+=2*Math.PI),(t%=Math.PI)>Math.PI/2&&(t=Math.PI-t),o=Math.cos(t);var h=Math.sin(t);8==document.documentMode&&(i.style.display="inline-block",s.style.display="inline-block",p.style.display="inline-block"),i.style.visibility="hidden",document.body.appendChild(i),t=i.offsetWidth,p=i.offsetHeight,mxClient.IS_QUIRKS&&(c||d)&&a<p&&(p=a,i.style.height=p+"px"),c=((a=p)-a*o+t*-h)/2-m*t*(g+.5)+r*a*(v+.5),d=(t-t*o+a*-h)/2+r*t*(g+.5)+m*a*(v+.5),"group"==l.nodeName&&"DIV"==this.root.nodeName?((g=document.createElement("div")).style.display="inline-block",g.style.position="absolute",g.style.left=this.format(e+(d-t/2)*u.scale)+"px",g.style.top=this.format(n+(c-a/2)*u.scale)+"px",l.parentNode.appendChild(g),g.appendChild(l)):(u=8==document.documentMode?1:u.scale,l.style.left=this.format(e+(d-t/2)*u)+"px",l.style.top=this.format(n+(c-a/2)*u)+"px"),s.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11="+r+", M12="+m+", M21="+-m+", M22="+r+", sizingMethod='auto expand')",s.style.backgroundColor=this.rotatedHtmlBackground,this.state.alpha<1&&(s.style.filter+="alpha(opacity="+100*this.state.alpha+")"),i.style.visibility="",s.appendChild(i)}else 8!=document.documentMode?(i.style.verticalAlign="top",this.state.alpha<1&&(l.style.filter="alpha(opacity="+100*this.state.alpha+")"),u=i.parentNode,i.style.visibility="hidden",document.body.appendChild(i),t=i.offsetWidth,p=i.offsetHeight,mxClient.IS_QUIRKS&&c&&a<p&&(p=a,i.style.height=p+"px"),a=p,i.style.visibility="",u.appendChild(i),l.style.left=this.format(e+t*g*this.state.scale)+"px",l.style.top=this.format(n+a*v*this.state.scale)+"px"):(this.state.alpha<1&&(i.style.filter="alpha(opacity="+100*this.state.alpha+")"),p.style.left=100*g+"%",p.style.top=100*v+"%")}else this.plainText(e,n,t,a,mxUtils.htmlEntities(i,!1),s,o,r,l,d,c,m)}},mxVmlCanvas2D.prototype.plainText=function(e,n,t,a,i,s,o,r,l,d,c,m){e=(e+(a=this.state).dx)*a.scale,n=(n+a.dy)*a.scale,(t=document.createElement(mxClient.VML_PREFIX+":shape")).style.width="1px",t.style.height="1px",t.stroked="false",(d=document.createElement(mxClient.VML_PREFIX+":fill")).color=a.fontColor,d.opacity=100*a.alpha+"%",t.appendChild(d),(d=document.createElement(mxClient.VML_PREFIX+":path")).textpathok="true",d.v="m "+this.format(0)+" "+this.format(0)+" l "+this.format(1)+" "+this.format(0),t.appendChild(d),(d=document.createElement(mxClient.VML_PREFIX+":textpath")).style.cssText="v-text-align:"+s,d.style.align=s,d.style.fontFamily=a.fontFamily,d.string=i,d.on="true",s=Math.round(a.fontSize*a.scale/this.vmlScale),d.style.fontSize=s+"px",(a.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(d.style.fontWeight="bold"),(a.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(d.style.fontStyle="italic"),(a.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(d.style.textDecoration="underline"),a=s+((i=i.split("\n")).length-1)*s*mxConstants.LINE_HEIGHT,s=i=0,o==mxConstants.ALIGN_BOTTOM?s=-a/2:o!=mxConstants.ALIGN_MIDDLE&&(s=a/2),null!=m&&(o=(t.style.rotation=m)*(Math.PI/180),i=Math.sin(o)*s,s*=Math.cos(o)),t.appendChild(d),t.style.left=this.format(e-i)+"px",t.style.top=this.format(n+s)+"px",this.root.appendChild(t)},mxVmlCanvas2D.prototype.stroke=function(){this.addNode(!1,!0)},mxVmlCanvas2D.prototype.fill=function(){this.addNode(!0,!1)},mxVmlCanvas2D.prototype.fillAndStroke=function(){this.addNode(!0,!0)},mxGuide.prototype.graph=null,mxGuide.prototype.states=null,mxGuide.prototype.horizontal=!0,mxGuide.prototype.vertical=!0,mxGuide.prototype.guideX=null,mxGuide.prototype.guideY=null,mxGuide.prototype.setStates=function(e){this.states=e},mxGuide.prototype.isEnabledForEvent=function(e){return!0},mxGuide.prototype.getGuideTolerance=function(){return this.graph.gridSize*this.graph.view.scale/2},mxGuide.prototype.createGuideShape=function(e){return(e=new mxPolyline([],mxConstants.GUIDE_COLOR,mxConstants.GUIDE_STROKEWIDTH)).isDashed=!0,e},mxGuide.prototype.move=function(a,e,n){if(null!=this.states&&(this.horizontal||this.vertical)&&null!=a&&null!=e){var t=this.graph.getView().translate,i=this.graph.getView().scale,s=e.x,o=e.y,r=!1,l=!1,d=f=this.getGuideTolerance(),c=f;(f=a.clone()).x+=e.x,f.y+=e.y;var m=f.x,u=f.x+f.width,p=f.getCenterX(),g=f.y,v=f.y+f.height,h=f.getCenterY();e=function(e){e+=this.graph.panDx;var n=!1;if(Math.abs(e-p)<d?(s=e-a.getCenterX(),d=Math.abs(e-p),n=!0):Math.abs(e-m)<d?(s=e-a.x,d=Math.abs(e-m),n=!0):Math.abs(e-u)<d&&(s=e-a.x-a.width,d=Math.abs(e-u),n=!0),n){null==this.guideX&&(this.guideX=this.createGuideShape(!0),this.guideX.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.guideX.pointerEvents=!1,this.guideX.init(this.graph.getView().getOverlayPane()));var t=this.graph.container;e-=this.graph.panDx,this.guideX.points=[new mxPoint(e,-this.graph.panDy),new mxPoint(e,t.scrollHeight-3-this.graph.panDy)]}r=r||n};for(var f=function(e){e+=this.graph.panDy;var n=!1;if(Math.abs(e-h)<c?(o=e-a.getCenterY(),c=Math.abs(e-h),n=!0):Math.abs(e-g)<c?(o=e-a.y,c=Math.abs(e-g),n=!0):Math.abs(e-v)<c&&(o=e-a.y-a.height,c=Math.abs(e-v),n=!0),n){null==this.guideY&&(this.guideY=this.createGuideShape(!1),this.guideY.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.guideY.pointerEvents=!1,this.guideY.init(this.graph.getView().getOverlayPane()));var t=this.graph.container;e-=this.graph.panDy,this.guideY.points=[new mxPoint(-this.graph.panDx,e),new mxPoint(t.scrollWidth-3-this.graph.panDx,e)]}l=l||n},b=0;b<this.states.length;b++){var A=this.states[b];null!=A&&(this.horizontal&&(e.call(this,A.getCenterX()),e.call(this,A.x),e.call(this,A.x+A.width)),this.vertical&&(f.call(this,A.getCenterY()),f.call(this,A.y),f.call(this,A.y+A.height)))}r||null==this.guideX?null!=this.guideX&&(this.guideX.node.style.visibility="visible",this.guideX.redraw()):this.guideX.node.style.visibility="hidden",l||null==this.guideY?null!=this.guideY&&(this.guideY.node.style.visibility="visible",this.guideY.redraw()):this.guideY.node.style.visibility="hidden",n&&(r||(n=a.x-(this.graph.snap(a.x/i-t.x)+t.x)*i,s=this.graph.snap(s/i)*i-n),l||(t=a.y-(this.graph.snap(a.y/i-t.y)+t.y)*i,o=this.graph.snap(o/i)*i-t)),e=new mxPoint(s,o)}return e},mxGuide.prototype.hide=function(){null!=this.guideX&&(this.guideX.node.style.visibility="hidden"),null!=this.guideY&&(this.guideY.node.style.visibility="hidden")},mxGuide.prototype.destroy=function(){null!=this.guideX&&(this.guideX.destroy(),this.guideX=null),null!=this.guideY&&(this.guideY.destroy(),this.guideY=null)},mxStencil.defaultLocalized=!1,mxStencil.prototype.desc=null,mxStencil.prototype.constraints=null,mxStencil.prototype.aspect=null,mxStencil.prototype.w0=null,mxStencil.prototype.h0=null,mxStencil.prototype.bgNode=null,mxStencil.prototype.fgNode=null,mxStencil.prototype.strokewidth=null,mxStencil.prototype.parseDescription=function(){this.fgNode=this.desc.getElementsByTagName("foreground")[0],this.bgNode=this.desc.getElementsByTagName("background")[0],this.w0=Number(this.desc.getAttribute("w")||100),this.h0=Number(this.desc.getAttribute("h")||100);var e=this.desc.getAttribute("aspect");this.aspect=null!=e?e:"variable",e=this.desc.getAttribute("strokewidth"),this.strokewidth=null!=e?e:"1"},mxStencil.prototype.parseConstraints=function(){var e=this.desc.getElementsByTagName("connections")[0];if(null!=e&&(null!=(e=mxUtils.getChildNodes(e))&&0<e.length)){this.constraints=[];for(var n=0;n<e.length;n++)this.constraints.push(this.parseConstraint(e[n]))}},mxStencil.prototype.parseConstraint=function(e){var n=Number(e.getAttribute("x")),t=Number(e.getAttribute("y"));return e="1"==e.getAttribute("perimeter"),new mxConnectionConstraint(new mxPoint(n,t),e)},mxStencil.prototype.evaluateTextAttribute=function(e,n,t){return n=this.evaluateAttribute(e,n,t),e=e.getAttribute("localized"),(mxStencil.defaultLocalized&&null==e||"1"==e)&&(n=mxResources.get(n)),n},mxStencil.prototype.evaluateAttribute=function(e,n,t){return null==(n=e.getAttribute(n))&&(null!=(e=mxUtils.getTextContent(e))&&("function"==typeof(e=mxUtils.eval(e))&&(n=e(t)))),n},mxStencil.prototype.drawShape=function(e,n,t,a,i,s){this.drawChildren(e,n,t,a,i,s,this.bgNode,!1),this.drawChildren(e,n,t,a,i,s,this.fgNode,!0)},mxStencil.prototype.drawChildren=function(e,n,t,a,i,s,o,r){if(null!=o){var l=mxUtils.getValue(n.style,mxConstants.STYLE_DIRECTION,null);for(t=this.computeAspect(n.style,t,a,i,s,l),a=Math.min(t.width,t.height),a="inherit"==this.strokewidth?Number(mxUtils.getNumber(n.style,mxConstants.STYLE_STROKEWIDTH,1)):Number(this.strokewidth)*a,e.setStrokeWidth(a),o=o.firstChild;null!=o;)o.nodeType==mxConstants.NODETYPE_ELEMENT&&this.drawNode(e,n,o,t,r),o=o.nextSibling}},mxStencil.prototype.computeAspect=function(e,n,t,a,i,s){e=n,n=a/this.w0;var o=i/this.h0;if(s="north"==s||"south"==s){o=a/this.h0,n=i/this.w0;var r=(a-i)/2;e+=r,t-=r}return"fixed"==this.aspect&&(n=o=Math.min(n,o),s?(e+=(i-this.w0*n)/2,t+=(a-this.h0*o)/2):(e+=(a-this.w0*n)/2,t+=(i-this.h0*o)/2)),new mxRectangle(e,t,n,o)},mxStencil.prototype.drawNode=function(e,n,t,a,i){var s=t.nodeName,o=a.x,r=a.y,l=a.width,d=a.height,c=Math.min(l,d);if("save"==s)e.save();else if("restore"==s)e.restore();else if("path"==s)for(e.begin(),t=t.firstChild;null!=t;)t.nodeType==mxConstants.NODETYPE_ELEMENT&&this.drawNode(e,n,t,a,i),t=t.nextSibling;else if("close"==s)e.close();else if("move"==s)e.moveTo(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d);else if("line"==s)e.lineTo(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d);else if("quad"==s)e.quadTo(o+Number(t.getAttribute("x1"))*l,r+Number(t.getAttribute("y1"))*d,o+Number(t.getAttribute("x2"))*l,r+Number(t.getAttribute("y2"))*d);else if("curve"==s)e.curveTo(o+Number(t.getAttribute("x1"))*l,r+Number(t.getAttribute("y1"))*d,o+Number(t.getAttribute("x2"))*l,r+Number(t.getAttribute("y2"))*d,o+Number(t.getAttribute("x3"))*l,r+Number(t.getAttribute("y3"))*d);else if("arc"==s)e.arcTo(Number(t.getAttribute("rx"))*l,Number(t.getAttribute("ry"))*d,Number(t.getAttribute("x-axis-rotation")),Number(t.getAttribute("large-arc-flag")),Number(t.getAttribute("sweep-flag")),o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d);else if("rect"==s)e.rect(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,Number(t.getAttribute("w"))*l,Number(t.getAttribute("h"))*d);else if("roundrect"==s)0==(n=t.getAttribute("arcsize"))&&(n=100*mxConstants.RECTANGLE_ROUNDING_FACTOR),c=Number(t.getAttribute("w"))*l,a=Number(t.getAttribute("h"))*d,n=Number(n)/100,n=Math.min(c*n,a*n),e.roundrect(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,c,a,n,n);else if("ellipse"==s)e.ellipse(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,Number(t.getAttribute("w"))*l,Number(t.getAttribute("h"))*d);else if("image"==s)n=this.evaluateAttribute(t,"src",n),e.image(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,Number(t.getAttribute("w"))*l,Number(t.getAttribute("h"))*d,n,!1,"1"==t.getAttribute("flipH"),"1"==t.getAttribute("flipV"));else if("text"==s){if(c=this.evaluateTextAttribute(t,"str",n),a="1"==t.getAttribute("vertical")?-90:0,"0"==t.getAttribute("align-shape")){var m=n.rotation,u=1==mxUtils.getValue(n.style,mxConstants.STYLE_FLIPH,0);n=1==mxUtils.getValue(n.style,mxConstants.STYLE_FLIPV,0),a=u&&n?a-m:u||n?a+m:a-m}a-=t.getAttribute("rotation"),e.text(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,0,0,c,t.getAttribute("align")||"left",t.getAttribute("valign")||"top",!1,"",!1,!1,a)}else if("include-shape"==s)null!=(m=mxStencilRegistry.getStencil(t.getAttribute("name")))&&(o+=Number(t.getAttribute("x"))*l,r+=Number(t.getAttribute("y"))*d,c=Number(t.getAttribute("w"))*l,a=Number(t.getAttribute("h"))*d,m.drawShape(e,n,o,r,c,a));else if("fillstroke"==s)e.fillAndStroke();else if("fill"==s)e.fill();else if("stroke"==s)e.stroke();else if("strokewidth"==s)e.setStrokeWidth(Number(t.getAttribute("width"))*c);else if("dashed"==s)e.setDashed("1"==t.getAttribute("dashed"));else if("dashpattern"==s){if(null!=(t=t.getAttribute("pattern"))){for(t=t.split(" "),l=[],d=0;d<t.length;d++)0<t[d].length&&l.push(Number(t[d])*c);t=l.join(" "),e.setDashPattern(t)}}else"strokecolor"==s?e.setStrokeColor(t.getAttribute("color")):"linecap"==s?e.setLineCap(t.getAttribute("cap")):"linejoin"==s?e.setLineJoin(t.getAttribute("join")):"miterlimit"==s?e.setMiterLimit(Number(t.getAttribute("limit"))):"fillcolor"==s?e.setFillColor(t.getAttribute("color")):"alpha"==s?e.setAlpha(t.getAttribute("alpha")):"fontcolor"==s?e.setFontColor(t.getAttribute("color")):"fontstyle"==s?e.setFontStyle(t.getAttribute("style")):"fontfamily"==s?e.setFontFamily(t.getAttribute("family")):"fontsize"==s&&e.setFontSize(Number(t.getAttribute("size"))*c);i&&("fillstroke"==s||"fill"==s||"stroke"==s)&&e.setShadow(!1)},mxShape.prototype.dialect=null,mxShape.prototype.scale=1,mxShape.prototype.bounds=null,mxShape.prototype.points=null,mxShape.prototype.node=null,mxShape.prototype.style=null,mxShape.prototype.style=null,mxShape.prototype.boundingBox=null,mxShape.prototype.stencil=null,mxShape.prototype.svgStrokeTolerance=6,mxShape.prototype.pointerEvents=!0,mxShape.prototype.stencilPointerEvents=!1,mxShape.prototype.vmlScale=1,mxShape.prototype.init=function(e){null==this.node&&(this.node=this.create(e),null!=e&&e.appendChild(this.node))},mxShape.prototype.isParseVml=function(){return!0},mxShape.prototype.isHtmlAllowed=function(){return!1},mxShape.prototype.getSvgScreenOffset=function(){return 1==mxUtils.mod(Math.max(1,Math.round(this.strokewidth*this.scale)),2)?.5:0},mxShape.prototype.create=function(e){return null!=e.ownerSVGElement?this.createSvg(e):8==document.documentMode||this.dialect==mxConstants.DIALECT_SVG||this.dialect!=mxConstants.DIALECT_VML&&this.isHtmlAllowed()?this.createHtml(e):this.createVml(e)},mxShape.prototype.createSvg=function(){return document.createElementNS(mxConstants.NS_SVG,"g")},mxShape.prototype.createVml=function(){var e=document.createElement(mxClient.VML_PREFIX+":group");return e.style.position="absolute",e},mxShape.prototype.createHtml=function(){var e=document.createElement("div");return e.style.position="absolute",e},mxShape.prototype.reconfigure=function(){this.redraw()},mxShape.prototype.redraw=function(){this.updateBoundsFromPoints(),this.checkBounds()?(this.node.style.visibility="","DIV"==this.node.nodeName&&this.isHtmlAllowed()?this.redrawHtmlShape():this.redrawShape(),this.updateBoundingBox()):(this.node.style.visibility="hidden",this.boundingBox=null)},mxShape.prototype.updateBoundsFromPoints=function(){var e=this.points;if(null!=e&&0<e.length&&null!=e[0]){this.bounds=new mxRectangle(Number(e[0].x),Number(e[0].y),1,1);for(var n=1;n<this.points.length;n++)null!=e[n]&&this.bounds.add(new mxRectangle(Number(e[n].x),Number(e[n].y),1,1))}},mxShape.prototype.checkBounds=function(){return null!=this.bounds&&!isNaN(this.bounds.x)&&!isNaN(this.bounds.y)&&!isNaN(this.bounds.width)&&!isNaN(this.bounds.height)&&0<this.bounds.width&&0<this.bounds.height},mxShape.prototype.createVmlGroup=function(){var e=document.createElement(mxClient.VML_PREFIX+":group");return e.style.position="absolute",e.style.width=this.node.style.width,e.style.height=this.node.style.height,e},mxShape.prototype.redrawShape=function(){var e=this.createCanvas();for(e.pointerEvents=this.pointerEvents;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);this.paint(e),this.node!=e.root&&this.node.insertAdjacentHTML("beforeend",e.root.outerHTML),"DIV"==this.node.nodeName&&8==document.documentMode&&(this.node.style.filter="",(null==this.stencil||!this.stencilPointerEvents)&&mxUtils.addTransparentBackgroundFilter(this.node)),this.destroyCanvas(e)},mxShape.prototype.createCanvas=function(){var e=null,n=null;if(null!=this.node.ownerSVGElement)(e=new mxSvgCanvas2D(this.node,!1)).strokeTolerance=this.svgStrokeTolerance,e.blockImagePointerEvents=mxClient.IS_NS&&!mxClient.IS_SF&&!mxClient.IS_GC,0!=(n=this.getSvgScreenOffset())?this.node.setAttribute("transform","translate("+n+","+n+")"):this.node.removeAttribute("transform");else{this.updateVmlContainer();var t=Math.max(1,Math.round(this.bounds.width)),a=Math.max(1,Math.round(this.bounds.height));n=8==document.documentMode&&this.isParseVml()?this.createVmlGroup():this.node,e=new mxVmlCanvas2D(n,!1);""!=n.tagUrn&&(n.coordsize=t*this.vmlScale+","+a*this.vmlScale,e.scale(this.vmlScale),e.vmlScale=this.vmlScale),n=this.scale,e.translate(-Math.round(this.bounds.x/n),-Math.round(this.bounds.y/n))}return e},mxShape.prototype.updateVmlContainer=function(){this.node.style.left=Math.round(this.bounds.x)+"px",this.node.style.top=Math.round(this.bounds.y)+"px";var e=Math.max(1,Math.round(this.bounds.width)),n=Math.max(1,Math.round(this.bounds.height));this.node.style.width=e+"px",this.node.style.height=n+"px",this.node.style.overflow="visible"},mxShape.prototype.destroyCanvas=function(e){if(e instanceof mxSvgCanvas2D){for(var n in e.gradients){var t=e.gradients[n];t.mxRefCount=(t.mxRefCount||0)+1}this.releaseSvgGradients(this.oldGradients),this.oldGradients=e.gradients}},mxShape.prototype.paint=function(e){var n=this.scale,t=this.bounds.x/n,a=this.bounds.y/n,i=this.bounds.width/n,s=this.bounds.height/n;if(this.isPaintBoundsInverted()){t=t+(o=(i-s)/2),a=a-o;var o=i;i=s,s=o}if(this.updateTransform(e,t,a,i,s),this.configureCanvas(e,t,a,i,s),null!=this.stencil)this.paintStencilShape(e,t,a,i,s);else if(e.setStrokeWidth(this.strokewidth),null!=this.points){for(t=[],a=0;a<this.points.length;a++)t.push(new mxPoint(this.points[a].x/n,this.points[a].y/n));this.paintEdgeShape(e,t)}else this.paintVertexShape(e,t,a,i,s)},mxShape.prototype.configureCanvas=function(e,n,t,a,i){var s=null;null!=this.style&&(s=this.style.dashPattern),e.setAlpha(this.opacity/100),null!=this.isShadow&&e.setShadow(this.isShadow),null!=this.isDashed&&e.setDashed(this.isDashed),null!=s&&e.setDashPattern(s),null!=this.gradient?(n=this.getGradientBounds(e,n,t,a,i),e.setGradient(this.fill,this.gradient,n.x,n.y,n.width,n.height,this.gradientDirection)):e.setFillColor(this.fill),e.setStrokeColor(this.stroke)},mxShape.prototype.getGradientBounds=function(e,n,t,a,i){return new mxRectangle(n,t,a,i)},mxShape.prototype.updateTransform=function(e,n,t,a,i){e.scale(this.scale),e.rotate(this.getShapeRotation(),this.flipH,this.flipV,n+a/2,t+i/2)},mxShape.prototype.paintStencilShape=function(e,n,t,a,i){this.stencilPointerEvents&&(this.dialect==mxConstants.DIALECT_SVG?this.addTransparentBackgroundRectangle(this.node,n,t,a,i):8!=document.documentMode&&this.setTransparentBackgroundImage(this.node)),this.stencil.drawShape(e,this,n,t,a,i)},mxShape.prototype.paintVertexShape=function(e,n,t,a,i){this.paintBackground(e,n,t,a,i),e.setShadow(!1),this.paintForeground(e,n,t,a,i)},mxShape.prototype.paintBackground=function(e,n,t,a,i){},mxShape.prototype.paintForeground=function(e,n,t,a,i){},mxShape.prototype.paintEdgeShape=function(e,n){},mxShape.prototype.getArcSize=function(e,n){var t=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100;return Math.min(e*t,n*t)},mxShape.prototype.paintGlassEffect=function(e,n,t,a,i,s){var o=Math.ceil(this.strokewidth/2);e.setGradient("#ffffff","#ffffff",n,t,a,.6*i,"south",.9,.1),e.begin(),s+=2*o,this.isRounded?(e.moveTo(n-o+s,t-o),e.quadTo(n-o,t-o,n-o,t-o+s),e.lineTo(n-o,t+.4*i),e.quadTo(n+.5*a,t+.7*i,n+a+o,t+.4*i),e.lineTo(n+a+o,t-o+s),e.quadTo(n+a+o,t-o,n+a+o-s,t-o)):(e.moveTo(n-o,t-o),e.lineTo(n-o,t+.4*i),e.quadTo(n+.5*a,t+.7*i,n+a+o,t+.4*i),e.lineTo(n+a+o,t-o)),e.close(),e.fill()},mxShape.prototype.apply=function(e){this.state=e,this.style=e.style,null!=this.style&&(this.fill=mxUtils.getValue(this.style,mxConstants.STYLE_FILLCOLOR,this.fill),this.gradient=mxUtils.getValue(this.style,mxConstants.STYLE_GRADIENTCOLOR,this.gradient),this.gradientDirection=mxUtils.getValue(this.style,mxConstants.STYLE_GRADIENT_DIRECTION,this.gradientDirection),this.opacity=mxUtils.getValue(this.style,mxConstants.STYLE_OPACITY,this.opacity),this.stroke=mxUtils.getValue(this.style,mxConstants.STYLE_STROKECOLOR,this.stroke),this.strokewidth=mxUtils.getNumber(this.style,mxConstants.STYLE_STROKEWIDTH,this.strokewidth),this.spacing=mxUtils.getValue(this.style,mxConstants.STYLE_SPACING,this.spacing),this.startSize=mxUtils.getNumber(this.style,mxConstants.STYLE_STARTSIZE,this.startSize),this.endSize=mxUtils.getNumber(this.style,mxConstants.STYLE_ENDSIZE,this.endSize),this.startArrow=mxUtils.getValue(this.style,mxConstants.STYLE_STARTARROW,this.startArrow),this.endArrow=mxUtils.getValue(this.style,mxConstants.STYLE_ENDARROW,this.endArrow),this.rotation=mxUtils.getValue(this.style,mxConstants.STYLE_ROTATION,this.rotation),this.direction=mxUtils.getValue(this.style,mxConstants.STYLE_DIRECTION,this.direction),this.flipH=1==mxUtils.getValue(this.style,mxConstants.STYLE_FLIPH,0),this.flipV=1==mxUtils.getValue(this.style,mxConstants.STYLE_FLIPV,0),null!=this.stencil&&(this.flipH=1==mxUtils.getValue(this.style,"stencilFlipH",0)||this.flipH,this.flipV=1==mxUtils.getValue(this.style,"stencilFlipV",0)||this.flipV),"north"!=this.direction&&"south"!=this.direction||(e=this.flipH,this.flipH=this.flipV,this.flipV=e),this.isShadow=1==mxUtils.getValue(this.style,mxConstants.STYLE_SHADOW,this.isShadow),this.isDashed=1==mxUtils.getValue(this.style,mxConstants.STYLE_DASHED,this.isDashed),this.isRounded=1==mxUtils.getValue(this.style,mxConstants.STYLE_ROUNDED,this.isRounded),this.glass=1==mxUtils.getValue(this.style,mxConstants.STYLE_GLASS,this.glass),"none"==this.fill&&(this.fill=null),"none"==this.gradient&&(this.gradient=null),"none"==this.stroke&&(this.stroke=null))},mxShape.prototype.setCursor=function(e){null==e&&(e=""),this.cursor=e,null!=this.node&&(this.node.style.cursor=e)},mxShape.prototype.getCursor=function(){return this.cursor},mxShape.prototype.updateBoundingBox=function(){if(null!=this.bounds){var e=this.createBoundingBox();if(null!=e){this.augmentBoundingBox(e);var n=this.getShapeRotation();0!=n&&(e=mxUtils.getBoundingBox(e,n)),e.x=Math.floor(e.x),e.y=Math.floor(e.y),e.width=Math.ceil(e.width),e.height=Math.ceil(e.height)}this.boundingBox=e}},mxShape.prototype.createBoundingBox=function(){var e=this.bounds.clone();if(this.isPaintBoundsInverted()){var n=(e.width-e.height)/2;e.x+=n,e.y-=n,n=e.width,e.width=e.height,e.height=n}return e},mxShape.prototype.augmentBoundingBox=function(e){this.isShadow&&(e.width+=Math.ceil(mxConstants.SHADOW_OFFSET_X*this.scale),e.height+=Math.ceil(mxConstants.SHADOW_OFFSET_Y*this.scale));var n=Math.ceil(this.strokewidth*this.scale);e.grow(Math.ceil(n/2))},mxShape.prototype.isPaintBoundsInverted=function(){return null==this.stencil&&("north"==this.direction||"south"==this.direction)},mxShape.prototype.getRotation=function(){return null!=this.rotation?this.rotation:0},mxShape.prototype.getTextRotation=function(){var e=this.getRotation();return 1!=mxUtils.getValue(this.style,mxConstants.STYLE_HORIZONTAL,1)&&(e+=mxText.prototype.verticalTextRotation),e},mxShape.prototype.getShapeRotation=function(){var e=this.getRotation();return null!=this.direction&&("north"==this.direction?e+=270:"west"==this.direction?e+=180:"south"==this.direction&&(e+=90)),e},mxShape.prototype.addTransparentBackgroundRectangle=function(e,n,t,a,i){(e=document.createElementNS(mxConstants.NS_SVG,"rect")).setAttribute("x",n),e.setAttribute("y",t),e.setAttribute("width",a),e.setAttribute("height",i),e.setAttribute("fill","none"),e.setAttribute("stroke","none"),e.setAttribute("pointer-events","all"),this.node.appendChild(e)},mxShape.prototype.setTransparentBackgroundImage=function(e){e.style.backgroundImage="url('"+mxClient.imageBasePath+"/transparent.gif')"},mxShape.prototype.releaseSvgGradients=function(e){if(null!=e)for(var n in e){var t=e[n];t.mxRefCount=(t.mxRefCount||0)-1,0==t.mxRefCount&&null!=t.parentNode&&t.parentNode.removeChild(t)}},mxShape.prototype.destroy=function(){null!=this.node&&(mxEvent.release(this.node),null!=this.node.parentNode&&this.node.parentNode.removeChild(this.node),this.node=null),this.releaseSvgGradients(this.oldGradients),this.oldGradients=null};var mxStencilRegistry={stencils:[],addStencil:function(e,n){mxStencilRegistry.stencils[e]=n},getStencil:function(e){return mxStencilRegistry.stencils[e]}},mxMarker={markers:[],addMarker:function(e,n){mxMarker.markers[e]=n},createMarker:function(e,n,t,a,i,s,o,r,l,d){var c=mxMarker.markers[t];return null!=c?c(e,n,t,a,i,s,o,r,l,d):null}};function mxActor(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxCloud(e,n,t,a){mxActor.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxRectangleShape(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxEllipse(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxDoubleEllipse(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxRhombus(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxPolyline(e,n,t){mxShape.call(this),this.points=e,this.stroke=n,this.strokewidth=null!=t?t:1}function mxArrow(e,n,t,a,i,s,o){mxShape.call(this),this.points=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1,this.arrowWidth=null!=i?i:mxConstants.ARROW_WIDTH,this.spacing=null!=s?s:mxConstants.ARROW_SPACING,this.endSize=null!=o?o:mxConstants.ARROW_SIZE}function mxText(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f,b,A){mxShape.call(this),this.value=e,this.bounds=n,this.color=null!=i?i:"black",this.align=null!=t?t:"",this.valign=null!=a?a:"",this.family=null!=s?s:mxConstants.DEFAULT_FONTFAMILY,this.size=null!=o?o:mxConstants.DEFAULT_FONTSIZE,this.fontStyle=null!=r?r:mxConstants.DEFAULT_FONTSTYLE,this.spacing=parseInt(l||2),this.spacingTop=this.spacing+parseInt(d||0),this.spacingRight=this.spacing+parseInt(c||0),this.spacingBottom=this.spacing+parseInt(m||0),this.spacingLeft=this.spacing+parseInt(u||0),this.horizontal=null==p||p,this.background=g,this.border=v,this.wrap=null!=h&&h,this.clipped=null!=f&&f,this.overflow=null!=b?b:"visible",this.labelPadding=null!=A?A:0,this.rotation=0}function mxTriangle(){mxActor.call(this)}function mxHexagon(){mxActor.call(this)}function mxLine(e,n,t){mxShape.call(this),this.bounds=e,this.stroke=n,this.strokewidth=null!=t?t:1}function mxImageShape(e,n,t,a,i){mxShape.call(this),this.bounds=e,this.image=n,this.fill=t,this.stroke=a,this.strokewidth=null!=i?i:1,this.shadow=!1}function mxLabel(e,n,t,a){mxRectangleShape.call(this,e,n,t,a)}function mxCylinder(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxConnector(e,n,t){mxPolyline.call(this,e,n,t)}function mxSwimlane(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxGraphLayout(e){this.graph=e}function mxStackLayout(e,n,t,a,i,s){mxGraphLayout.call(this,e),this.horizontal=null==n||n,this.spacing=null!=t?t:0,this.x0=null!=a?a:0,this.y0=null!=i?i:0,this.border=null!=s?s:0}function mxPartitionLayout(e,n,t,a){mxGraphLayout.call(this,e),this.horizontal=null==n||n,this.spacing=t||0,this.border=a||0}function mxCompactTreeLayout(e,n,t){mxGraphLayout.call(this,e),this.horizontal=null==n||n,this.invert=null!=t&&t}function WeightedCellSorter(e,n){this.cell=e,this.weightedValue=n}function mxFastOrganicLayout(e){mxGraphLayout.call(this,e)}function mxCircleLayout(e,n){mxGraphLayout.call(this,e),this.radius=null!=n?n:100}function mxParallelEdgeLayout(e){mxGraphLayout.call(this,e)}function mxCompositeLayout(e,n,t){mxGraphLayout.call(this,e),this.layouts=n,this.master=t}function mxEdgeLabelLayout(e,n){mxGraphLayout.call(this,e)}function mxGraphAbstractHierarchyCell(){this.x=[],this.y=[],this.temp=[]}function mxGraphHierarchyNode(e){mxGraphAbstractHierarchyCell.apply(this,arguments),this.cell=e}function mxGraphHierarchyEdge(e){mxGraphAbstractHierarchyCell.apply(this,arguments),this.edges=e}function mxGraphHierarchyModel(e,n,t,a,i){for(e.getGraph(),this.tightenToSource=i,this.roots=t,this.parent=a,this.vertexMapper={},this.edgeMapper={},this.maxRank=0,t=[],null==n&&(n=this.graph.getChildVertices(a)),this.maxRank=this.SOURCESCANSTARTRANK,this.createInternalCells(e,n,t),a=0;a<n.length;a++){i=t[a].connectsAsSource;for(var s=0;s<i.length;s++){var o=i[s];if(null!=(r=o.edges)&&0<r.length){var r=r[0],l=e.getVisibleTerminal(r,!1);l=mxCellPath.create(l),l=this.vertexMapper[l];t[a]==l&&(l=e.getVisibleTerminal(r,!0),l=mxCellPath.create(l),l=this.vertexMapper[l]),null!=l&&t[a]!=l&&(0==(o.target=l).connectsAsTarget.length&&(l.connectsAsTarget=[]),mxUtils.indexOf(l.connectsAsTarget,o)<0&&l.connectsAsTarget.push(o))}}t[a].temp[0]=1}}function mxHierarchicalLayoutStage(){}function mxMedianHybridCrossingReduction(e){this.layout=e}function MedianCellSorter(){}function mxMinimumCycleRemover(e){this.layout=e}function mxCoordinateAssignment(e,n,t,a,i,s){this.layout=e,this.intraCellSpacing=n,this.interRankCellSpacing=t,this.orientation=a,this.initialX=i,this.parallelEdgeSpacing=s}!function(){function e(e,n,t,a,i,s,o,r,l,d){n=1.118*i*l,r=1.118*s*l,i*=o+l,s*=o+l;var c=a.clone();return c.x-=n,c.y-=r,o=t!=mxConstants.ARROW_CLASSIC?1:.75,a.x+=-i*o-n,a.y+=-s*o-r,function(){e.begin(),e.moveTo(c.x,c.y),e.lineTo(c.x-i-s/2,c.y-s+i/2),t==mxConstants.ARROW_CLASSIC&&e.lineTo(c.x-3*i/4,c.y-3*s/4),e.lineTo(c.x+s/2-i,c.y-s-i/2),e.close(),d?e.fillAndStroke():e.stroke()}}function n(e,n,t,a,i,s,o,r,l,d){r=t==mxConstants.ARROW_DIAMOND?.7071:.9862,n=i*l*r,r*=s*l,i*=o+l,s*=o+l;var c=a.clone();c.x-=n,c.y-=r,a.x+=-i-n,a.y+=-s-r;var m=t==mxConstants.ARROW_DIAMOND?2:3.4;return function(){e.begin(),e.moveTo(c.x,c.y),e.lineTo(c.x-i/2-s/m,c.y+i/m-s/2),e.lineTo(c.x-i,c.y-s),e.lineTo(c.x-i/2+s/m,c.y-s/2-i/m),e.close(),d?e.fillAndStroke():e.stroke()}}mxMarker.addMarker("classic",e),mxMarker.addMarker("block",e),mxMarker.addMarker("open",function(e,n,t,a,i,s,o,r,l,d){n=1.118*i*l,t=1.118*s*l,i*=o+l,s*=o+l;var c=a.clone();return c.x-=n,c.y-=t,a.x+=2*-n,a.y+=2*-t,function(){e.begin(),e.moveTo(c.x-i-s/2,c.y-s+i/2),e.lineTo(c.x,c.y),e.lineTo(c.x+s/2-i,c.y-s-i/2),e.stroke()}}),mxMarker.addMarker("oval",function(e,n,t,a,i,s,o,r,l,d){var c=o/2,m=a.clone();return a.x-=i*c,a.y-=s*c,function(){e.ellipse(m.x-c,m.y-c,o,o),d?e.fillAndStroke():e.stroke()}}),mxMarker.addMarker("diamond",n),mxMarker.addMarker("diamondThin",n)}(),mxUtils.extend(mxActor,mxShape),mxActor.prototype.paintVertexShape=function(e,n,t,a,i){e.translate(n,t),e.begin(),this.redrawPath(e,n,t,a,i),e.fillAndStroke()},mxActor.prototype.redrawPath=function(e,n,t,a,i){n=a/3,e.moveTo(0,i),e.curveTo(0,3*i/5,0,2*i/5,a/2,2*i/5),e.curveTo(a/2-n,2*i/5,a/2-n,0,a/2,0),e.curveTo(a/2+n,0,a/2+n,2*i/5,a/2,2*i/5),e.curveTo(a,2*i/5,a,3*i/5,a,i),e.close()},mxUtils.extend(mxCloud,mxActor),mxCloud.prototype.redrawPath=function(e,n,t,a,i){e.moveTo(.25*a,.25*i),e.curveTo(.05*a,.25*i,0,.5*i,.16*a,.55*i),e.curveTo(0,.66*i,.18*a,.9*i,.31*a,.8*i),e.curveTo(.4*a,i,.7*a,i,.8*a,.8*i),e.curveTo(a,.8*i,a,.6*i,.875*a,.5*i),e.curveTo(a,.3*i,.8*a,.1*i,.625*a,.2*i),e.curveTo(.5*a,.05*i,.3*a,.05*i,.25*a,.25*i),e.close()},mxUtils.extend(mxRectangleShape,mxShape),mxRectangleShape.prototype.isHtmlAllowed=function(){return!this.isRounded&&!this.glass&&0==this.rotation},mxRectangleShape.prototype.paintBackground=function(e,n,t,a,i){if(this.isRounded){var s=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100;s=Math.min(a*s,i*s);e.roundrect(n,t,a,i,s,s)}else e.rect(n,t,a,i);e.fillAndStroke()},mxRectangleShape.prototype.paintForeground=function(e,n,t,a,i){this.glass&&this.paintGlassEffect(e,n,t,a,i,this.getArcSize(a+this.strokewidth,i+this.strokewidth))},mxRectangleShape.prototype.redrawHtmlShape=function(){this.updateHtmlBounds(this.node),this.updateHtmlFilters(this.node),this.updateHtmlColors(this.node)},mxRectangleShape.prototype.updateHtmlBounds=function(e){var n=9<=document.documentMode?0:Math.ceil(this.strokewidth*this.scale);e.style.borderWidth=Math.max(1,n)+"px",e.style.overflow="hidden",e.style.left=Math.round(this.bounds.x-n/2)+"px",e.style.top=Math.round(this.bounds.y-n/2)+"px","CSS1Compat"==document.compatMode&&(n=-n),e.style.width=Math.round(Math.max(0,this.bounds.width+n))+"px",e.style.height=Math.round(Math.max(0,this.bounds.height+n))+"px"},mxRectangleShape.prototype.updateHtmlColors=function(e){var n=this.stroke;null!=n&&n!=mxConstants.NONE?(e.style.borderColor=n,this.isDashed?e.style.borderStyle="dashed":0<this.strokewidth&&(e.style.borderStyle="solid"),e.style.borderWidth=Math.max(1,Math.ceil(this.strokewidth*this.scale))+"px"):e.style.borderWidth="0px",null!=(n=this.fill)&&n!=mxConstants.NONE?(e.style.backgroundColor=n,e.style.backgroundImage="none"):this.pointerEvents?e.style.backgroundColor="transparent":8==document.documentMode?mxUtils.addTransparentBackgroundFilter(e):this.setTransparentBackgroundImage(e)},mxRectangleShape.prototype.updateHtmlFilters=function(e){var n="";if(this.opacity<100&&(n+="alpha(opacity="+this.opacity+")"),this.isShadow&&(n+="progid:DXImageTransform.Microsoft.dropShadow (OffX='"+Math.round(mxConstants.SHADOW_OFFSET_X*this.scale)+"', OffY='"+Math.round(mxConstants.SHADOW_OFFSET_Y*this.scale)+"', Color='"+mxConstants.SHADOWCOLOR+"')"),this.gradient){var t=this.fill,a=this.gradient,i="0",s={east:0,south:1,west:2,north:3},o=null!=this.direction?s[this.direction]:0;null!=this.gradientDirection&&(o=mxUtils.mod(o+s[this.gradientDirection]-1,4)),1==o?(i="1",s=t,t=a,a=s):2==o?(s=t,t=a,a=s):3==o&&(i="1"),n+="progid:DXImageTransform.Microsoft.gradient(startColorStr='"+t+"', endColorStr='"+a+"', gradientType='"+i+"')"}e.style.filter=n},mxUtils.extend(mxEllipse,mxShape),mxEllipse.prototype.paintVertexShape=function(e,n,t,a,i){e.ellipse(n,t,a,i),e.fillAndStroke()},mxUtils.extend(mxDoubleEllipse,mxShape),mxDoubleEllipse.prototype.vmlScale=10,mxDoubleEllipse.prototype.paintBackground=function(e,n,t,a,i){e.ellipse(n,t,a,i),e.fillAndStroke()},mxDoubleEllipse.prototype.paintForeground=function(e,n,t,a,i){var s=Math.min(4,Math.min(a/5,i/5));i-=2*s,0<(a-=2*s)&&0<i&&e.ellipse(n+s,t+s,a,i),e.stroke()},mxUtils.extend(mxRhombus,mxShape),mxRhombus.prototype.paintVertexShape=function(e,n,t,a,i){var s=a/2,o=i/2;e.begin(),e.moveTo(n+s,t),e.lineTo(n+a,t+o),e.lineTo(n+s,t+i),e.lineTo(n,t+o),e.close(),e.fillAndStroke()},mxUtils.extend(mxPolyline,mxShape),mxPolyline.prototype.getRotation=function(){return 0},mxPolyline.prototype.paintEdgeShape=function(e,n){this.paintLine(e,n,this.isRounded)},mxPolyline.prototype.paintLine=function(e,n,t){var a=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2,i=n[0],s=n[n.length-1];e.begin(),e.moveTo(i.x,i.y);for(var o=1;o<n.length-1;o++){var r=n[o],l=i.x-r.x;i=i.y-r.y;if(t&&o<n.length-1&&(0!=l||0!=i)){var d=Math.sqrt(l*l+i*i);l=l*Math.min(a,d/2)/d,i=i*Math.min(a,d/2)/d;e.lineTo(r.x+l,r.y+i),l=(i=n[o+1]).x-r.x,i=i.y-r.y,d=Math.max(1,Math.sqrt(l*l+i*i)),l=l*Math.min(a,d/2)/d,i=i*Math.min(a,d/2)/d,l=r.x+l,i=r.y+i,e.quadTo(r.x,r.y,l,i),r=new mxPoint(l,i)}else e.lineTo(r.x,r.y);i=r}e.lineTo(s.x,s.y),e.stroke()},mxUtils.extend(mxArrow,mxShape),mxArrow.prototype.paintEdgeShape=function(e,n){var t=mxConstants.ARROW_SPACING,a=mxConstants.ARROW_WIDTH,i=mxConstants.ARROW_SIZE,s=n[0],o=n[n.length-1],r=o.x-s.x,l=o.y-s.y,d=(c=Math.sqrt(r*r+l*l))-2*t-i,c=(r=r/c,a*(l=l/c)/3),m=(a=-a*r/3,(i=s.x-c/2+t*r)+c),u=(s=s.y-a/2+t*l)+a,p=m+d*r,g=p+c,v=(d=u+d*l)+a,h=g-3*c,f=v-3*a;e.begin(),e.moveTo(i,s),e.lineTo(m,u),e.lineTo(p,d),e.lineTo(g,v),e.lineTo(o.x-t*r,o.y-t*l),e.lineTo(h,f),e.lineTo(h+c,f+a),e.close(),e.fillAndStroke()},mxUtils.extend(mxText,mxShape),mxText.prototype.baseSpacingTop=0,mxText.prototype.baseSpacingBottom=0,mxText.prototype.baseSpacingLeft=0,mxText.prototype.baseSpacingRight=0,mxText.prototype.replaceLinefeeds=!0,mxText.prototype.verticalTextRotation=-90,mxText.prototype.ignoreClippedStringSize=!0,mxText.prototype.ignoreStringSize=!1,mxText.prototype.isParseVml=function(){return!1},mxText.prototype.isHtmlAllowed=function(){return 8!=document.documentMode},mxText.prototype.getSvgScreenOffset=function(){return 0},mxText.prototype.checkBounds=function(){return!(null==this.bounds||isNaN(this.bounds.x)||isNaN(this.bounds.y)||isNaN(this.bounds.width)||isNaN(this.bounds.height))},mxText.prototype.updateBoundingBox=function(){var e=this.node;8==document.documentMode&&null!=e.firstChild&&(null!=(e=e.firstChild).firstChild&&(e=e.firstChild)),this.boundingBox=this.bounds.clone();var n=this.getTextRotation();if(this.ignoreStringSize||null==e||"fill"==this.overflow||this.clipped&&this.ignoreClippedStringSize)this.boundingBox.x+=this.margin.x*this.boundingBox.width,this.boundingBox.y+=this.margin.y*this.boundingBox.height;else{var t=null,a=null;if(null!=e.ownerSVGElement)if(null!=e.firstChild&&null!=e.firstChild.firstChild&&"foreignObject"==e.firstChild.firstChild.nodeName)e=e.firstChild.firstChild,t=this.wrap?this.bounds.width:parseInt(e.getAttribute("width"))*this.scale,a=parseInt(e.getAttribute("height"))*this.scale;else{if(0==(n=e.getBBox()).width&&0==n.height)return;this.boundingBox=new mxRectangle(n.x,n.y,n.width,n.height),n=0}else a=this.state.view.textDiv,a=null!=this.offsetWidth&&null!=this.offsetHeight?(t=this.wrap?this.bounds.width:this.offsetWidth*this.scale,this.offsetHeight*this.scale):null!=a?(this.updateFont(a),this.updateSize(a),mxUtils.isNode(this.value)?a.innerHTML=this.value.outerHTML:(t=this.replaceLinefeeds?this.value.replace(/\n/g,"<br/>"):this.value,a.innerHTML=t),t=this.wrap?this.bounds.width:a.offsetWidth*this.scale,a.offsetHeight*this.scale):(t=this.wrap?this.bounds.width:e.offsetWidth*this.scale,e.offsetHeight*this.scale);null!=t&&null!=a&&(this.boundingBox=new mxRectangle(this.bounds.x+this.margin.x*t,this.bounds.y+this.margin.y*a,t,a))}null!=this.boundingBox&&(0!=n&&(n=mxUtils.getBoundingBox(this.boundingBox,n),this.boundingBox.x=n.x,this.boundingBox.y=n.y,mxClient.IS_QUIRKS||(this.boundingBox.width=n.width,this.boundingBox.height=n.height)),this.boundingBox.x=Math.floor(this.boundingBox.x),this.boundingBox.y=Math.floor(this.boundingBox.y),this.boundingBox.width=Math.ceil(this.boundingBox.width),this.boundingBox.height=Math.ceil(this.boundingBox.height))},mxText.prototype.getShapeRotation=function(){return 0},mxText.prototype.getTextRotation=function(){return null!=this.state&&null!=this.state.shape?this.state.shape.getTextRotation():0},mxText.prototype.isPaintBoundsInverted=function(){return!this.horizontal&&null!=this.state&&this.state.view.graph.model.isVertex(this.state.cell)},mxText.prototype.configureCanvas=function(e,n,t,a,i){mxShape.prototype.configureCanvas.apply(this,arguments),e.setFontColor(this.color),e.setFontBackgroundColor(this.background),e.setFontBorderColor(this.border),e.setFontFamily(this.family),e.setFontSize(this.size),e.setFontStyle(this.fontStyle)},mxText.prototype.updateVmlContainer=function(){this.node.style.left=Math.round(this.bounds.x)+"px",this.node.style.top=Math.round(this.bounds.y)+"px",this.node.style.width="1px",this.node.style.height="1px",this.node.style.overflow="visible"},mxText.prototype.paint=function(e){var n=this.scale,t=this.bounds.x/n,a=this.bounds.y/n,i=this.bounds.width/n;n=this.bounds.height/n;this.updateTransform(e,t,a,i,n),this.configureCanvas(e,t,a,i,n);var s=mxUtils.isNode(this.value)||this.dialect==mxConstants.DIALECT_STRICTHTML,o=s||e instanceof mxVmlCanvas2D?"html":"",r=this.value;!s&&"html"==o&&(r=mxUtils.htmlEntities(r,!1)),r=!mxUtils.isNode(this.value)&&this.replaceLinefeeds&&"html"==o?r.replace(/\n/g,"<br/>"):r,e.text(t,a,i,n,r,this.align,this.valign,this.wrap,o,"fill"==this.overflow,this.clipped,this.getTextRotation())},mxText.prototype.redrawHtmlShape=function(){var e=this.node.style;e.opacity=this.opacity<1?this.opacity:"",e.overflow="",e.width="",e.height="",this.updateFont(this.node),this.updateSize(this.node),this.updateValue(),this.offsetHeight=this.offsetWidth=null,null!=mxClient.CSS_PREFIX?this.updateHtmlTransform():this.updateHtmlFilter()},mxText.prototype.updateHtmlTransform=function(){var e=this.getTextRotation(),n=this.node.style,t=this.margin.x,a=this.margin.y;0!=e?(n[mxClient.CSS_PREFIX+"TransformOrigin"]=100*-t+"% "+100*-a+"%",n[mxClient.CSS_PREFIX+"Transform"]="translate("+100*t+"%,"+100*a+"%)scale("+this.scale+") rotate("+e+"deg)"):(n[mxClient.CSS_PREFIX+"TransformOrigin"]="0% 0%",n[mxClient.CSS_PREFIX+"Transform"]="scale("+this.scale+")translate("+100*t+"%,"+100*a+"%)"),n.left=Math.round(this.bounds.x)+"px",n.top=Math.round(this.bounds.y)+"px"},mxText.prototype.updateHtmlFilter=function(){var e=this.node.style,n=this.margin.x,t=this.margin.y,a=this.scale;e.filter="";var i=0,s=0;if(null!=(r=null!=this.state?this.state.view.textDiv:null)){if(r.style.overflow="",r.style.height="",r.style.width="",this.updateFont(r),this.updateSize(r),mxUtils.isNode(this.value))r.innerHTML=this.value.outerHTML;else{var o=this.value;this.dialect!=mxConstants.DIALECT_STRICTHTML&&(o=mxUtils.htmlEntities(o,!1)),o=this.replaceLinefeeds?o.replace(/\n/g,"<br/>"):o,r.innerHTML=o}i=r.offsetWidth+2,s=r.offsetHeight+2}else i=this.node.offsetWidth,s=this.node.offsetHeight+1;this.offsetWidth=i,this.offsetHeight=s,r=this.bounds.width/a,o=this.bounds.height/a,mxClient.IS_QUIRKS&&(this.clipped||"fill"==this.overflow)&&0<o?(o=Math.min(o,s),e.height=Math.round(o+1)+"px"):o=s,"fill"!=this.overflow&&(mxClient.IS_QUIRKS&&(this.clipped||this.wrap)&&0<r?(r=Math.min(r,i),e.width=Math.round(r)+"px"):r=i);o*=a;var r=r*a,l=(i=this.getTextRotation()*(Math.PI/180),s=parseFloat(parseFloat(Math.cos(i)).toFixed(8)),parseFloat(parseFloat(Math.sin(-i)).toFixed(8)));(i=i%(2*Math.PI))<0&&(i+=2*Math.PI),(i%=Math.PI)>Math.PI/2&&(i=Math.PI-i);var d=Math.cos(i),c=Math.sin(-i),m=(o-o*d+r*c)/2+l*(n=r*-(n+.5))-s*(t=o*-(t+.5));0!=i&&(e.filter="progid:DXImageTransform.Microsoft.Matrix(M11="+s+", M12="+l+", M21="+-l+", M22="+s+", sizingMethod='auto expand')"),e.zoom=a,e.left=Math.round(this.bounds.x+((r-r*d+o*c)/2-s*n-l*t)-r/2)+"px",e.top=Math.round(this.bounds.y+m-o/2)+"px"},mxText.prototype.updateValue=function(){if(mxUtils.isNode(this.value))this.node.innerHTML="",this.node.appendChild(this.value);else{var e=this.value;this.dialect!=mxConstants.DIALECT_STRICTHTML&&(e=mxUtils.htmlEntities(e,!1));e=this.replaceLinefeeds?e.replace(/\n/g,"<br/>"):e;var n=null!=this.background&&this.background!=mxConstants.NONE?this.background:null,t=null!=this.border&&this.border!=mxConstants.NONE?this.border:null;if(null!=n||null!=t)if("fill"==this.overflow)null!=n&&(this.node.style.backgroundColor=n),null!=t&&(this.node.style.border="1px solid "+t);else{var a="";null!=n&&(a+="background-color:"+n+";"),null!=t&&(a+="border:1px solid "+t+";"),e='<div style="zoom:1;'+a+"display:inline-block;_display:inline;padding-bottom:1px;padding-right:1px;line-height:"+this.node.style.lineHeight+'">'+e+"</div>",this.node.style.lineHeight=""}this.node.innerHTML=e}},mxText.prototype.updateFont=function(e){(e=e.style).lineHeight=Math.round(this.size*mxConstants.LINE_HEIGHT)+"px",e.fontSize=Math.round(this.size)+"px",e.fontFamily=this.family,e.verticalAlign="top",e.color=this.color,e.fontWeight=(this.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD?"bold":"",e.fontStyle=(this.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC?"italic":"",e.fontDecoration=(this.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE?"underline":"",e.textAlign=this.align==mxConstants.ALIGN_CENTER?"center":this.align==mxConstants.ALIGN_RIGHT?"right":"left"},mxText.prototype.updateSize=function(e){var n=Math.round(this.bounds.width/this.scale),t=Math.round(this.bounds.height/this.scale);e=e.style,this.clipped?(e.overflow="hidden",0<t&&(e.maxHeight=t+"px"),0<n&&(e.width=n+"px")):"fill"==this.overflow&&(e.width=n+"px",0<t&&(e.maxHeight=t+"px")),this.wrap?(!this.clipped&&0<n&&(e.width=n+"px"),e.whiteSpace="normal"):e.whiteSpace="nowrap"},mxText.prototype.updateMargin=function(){this.margin=mxUtils.getAlignmentAsPoint(this.align,this.valign)},mxText.prototype.getSpacing=function(){return new mxPoint(this.align==mxConstants.ALIGN_CENTER?(this.spacingLeft-this.spacingRight)/2:this.align==mxConstants.ALIGN_RIGHT?-this.spacingRight-this.baseSpacingRight:this.spacingLeft+this.baseSpacingLeft,this.valign==mxConstants.ALIGN_MIDDLE?(this.spacingTop-this.spacingBottom)/2:this.valign==mxConstants.ALIGN_BOTTOM?-this.spacingBottom-this.baseSpacingBottom:this.spacingTop+this.baseSpacingTop)},mxUtils.extend(mxTriangle,mxActor),mxTriangle.prototype.redrawPath=function(e,n,t,a,i){e.moveTo(0,0),e.lineTo(a,.5*i),e.lineTo(0,i),e.close()},mxUtils.extend(mxHexagon,mxActor),mxHexagon.prototype.redrawPath=function(e,n,t,a,i){e.moveTo(.25*a,0),e.lineTo(.75*a,0),e.lineTo(a,.5*i),e.lineTo(.75*a,i),e.lineTo(.25*a,i),e.lineTo(0,.5*i),e.close()},mxUtils.extend(mxLine,mxShape),mxLine.prototype.paintVertexShape=function(e,n,t,a,i){t+=i/2,e.begin(),e.moveTo(n,t),e.lineTo(n+a,t),e.stroke()},mxUtils.extend(mxImageShape,mxRectangleShape),mxImageShape.prototype.preserveImageAspect=!0,mxImageShape.prototype.getSvgScreenOffset=function(){return mxClient.IS_IE?0:.5},mxImageShape.prototype.apply=function(e){mxShape.prototype.apply.apply(this,arguments),this.gradient=this.stroke=this.fill=null,null!=this.style&&(this.fill=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BACKGROUND),this.stroke=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BORDER),this.preserveImageAspect=1==mxUtils.getNumber(this.style,mxConstants.STYLE_IMAGE_ASPECT,1),this.flipH=this.flipH||1==mxUtils.getValue(this.style,"imageFlipH",0),this.flipV=this.flipV||1==mxUtils.getValue(this.style,"imageFlipV",0))},mxImageShape.prototype.isHtmlAllowed=function(){return!this.preserveImageAspect},mxImageShape.prototype.createHtml=function(){var e=document.createElement("div");return e.style.position="absolute",e},mxImageShape.prototype.paintVertexShape=function(e,n,t,a,i){if(null!=this.image){var s=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BACKGROUND,null),o=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BORDER,null);null==s&&null==o||(e.setFillColor(s),e.setStrokeColor(o),e.rect(n,t,a,i),e.fillAndStroke()),e.image(n,t,a,i,this.image,this.preserveImageAspect,!1,!1)}else mxRectangleShape.prototype.paintBackground.apply(this,arguments)},mxImageShape.prototype.redrawHtmlShape=function(){if(this.node.style.left=Math.round(this.bounds.x)+"px",this.node.style.top=Math.round(this.bounds.y)+"px",this.node.style.width=Math.max(0,Math.round(this.bounds.width))+"px",this.node.style.height=Math.max(0,Math.round(this.bounds.height))+"px",this.node.style.backgroundColor=this.fill||"",this.node.style.borderColor=this.stroke||"",this.node.innerHTML="",null!=this.image){var e=document.createElement(mxClient.IS_IE6||null==mxClient.CSS_PREFIX&&0!=this.rotation?mxClient.VML_PREFIX+":image":"img");e.style.position="absolute",e.src=this.image;var n=this.opacity<100?"alpha(opacity="+this.opacity+")":"";this.node.style.filter=n,this.flipH&&this.flipV?n+="progid:DXImageTransform.Microsoft.BasicImage(rotation=2)":this.flipH?n+="progid:DXImageTransform.Microsoft.BasicImage(mirror=1)":this.flipV&&(n+="progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"),e.style.filter!=n&&(e.style.filter=n),"image"==e.nodeName?e.style.rotation=this.rotation:e.style[mxClient.CSS_PREFIX+"Transform"]="rotate("+this.rotation+"deg)",e.style.width=this.node.style.width,e.style.height=this.node.style.height,this.node.style.backgroundImage="",this.node.appendChild(e)}else this.setTransparentBackgroundImage(this.node)},mxUtils.extend(mxLabel,mxRectangleShape),mxLabel.prototype.imageSize=mxConstants.DEFAULT_IMAGESIZE,mxLabel.prototype.spacing=2,mxLabel.prototype.indicatorSize=10,mxLabel.prototype.indicatorSpacing=2,mxLabel.prototype.init=function(e){mxShape.prototype.init.apply(this,arguments),null!=this.indicatorColor&&null!=this.indicatorShape&&(this.indicator=new this.indicatorShape,this.indicator.dialect=this.dialect,this.indicator.bounds=this.bounds,this.indicator.fill=this.indicatorColor,this.indicator.stroke=this.indicatorColor,this.indicator.gradient=this.indicatorGradientColor,this.indicator.direction=this.indicatorDirection,this.indicator.init(this.node))},mxLabel.prototype.redraw=function(){null!=this.indicator&&(this.indicator.fill=this.indicatorColor,this.indicator.stroke=this.indicatorColor,this.indicator.gradient=this.indicatorGradientColor,this.indicator.direction=this.indicatorDirection),mxShape.prototype.redraw.apply(this,arguments)},mxLabel.prototype.isHtmlAllowed=function(){return mxRectangleShape.prototype.isHtmlAllowed.apply(this,arguments)&&null==this.indicatorColor&&null==this.indicatorShape},mxLabel.prototype.paintForeground=function(e,n,t,a,i){this.paintImage(e,n,t,a,i),this.paintIndicator(e,n,t,a,i),mxRectangleShape.prototype.paintForeground.apply(this,arguments)},mxLabel.prototype.paintImage=function(e,n,t,a,i){null!=this.image&&(n=this.getImageBounds(n,t,a,i),e.image(n.x,n.y,n.width,n.height,this.image,!1,!1,!1))},mxLabel.prototype.getImageBounds=function(e,n,t,a){var i=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_ALIGN,mxConstants.ALIGN_LEFT),s=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE),o=mxUtils.getNumber(this.style,mxConstants.STYLE_IMAGE_WIDTH,mxConstants.DEFAULT_IMAGESIZE),r=mxUtils.getNumber(this.style,mxConstants.STYLE_IMAGE_HEIGHT,mxConstants.DEFAULT_IMAGESIZE),l=mxUtils.getNumber(this.style,mxConstants.STYLE_SPACING,this.spacing)+5;return new mxRectangle(e=i==mxConstants.ALIGN_CENTER?e+(t-o)/2:i==mxConstants.ALIGN_RIGHT?e+(t-o-l):e+l,n=s==mxConstants.ALIGN_TOP?n+l:s==mxConstants.ALIGN_BOTTOM?n+(a-r-l):n+(a-r)/2,o,r)},mxLabel.prototype.paintIndicator=function(e,n,t,a,i){null!=this.indicator?(this.indicator.bounds=this.getIndicatorBounds(n,t,a,i),this.indicator.paint(e)):null!=this.indicatorImage&&(n=this.getIndicatorBounds(n,t,a,i),e.image(n.x,n.y,n.width,n.height,this.indicatorImage,!1,!1,!1))},mxLabel.prototype.getIndicatorBounds=function(e,n,t,a){var i=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_ALIGN,mxConstants.ALIGN_LEFT),s=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE),o=mxUtils.getNumber(this.style,mxConstants.STYLE_INDICATOR_WIDTH,this.indicatorSize),r=mxUtils.getNumber(this.style,mxConstants.STYLE_INDICATOR_HEIGHT,this.indicatorSize),l=this.spacing+5;return new mxRectangle(e=i==mxConstants.ALIGN_RIGHT?e+(t-o-l):i==mxConstants.ALIGN_CENTER?e+(t-o)/2:e+l,n=s==mxConstants.ALIGN_BOTTOM?n+(a-r-l):s==mxConstants.ALIGN_TOP?n+l:n+(a-r)/2,o,r)},mxLabel.prototype.redrawHtmlShape=function(){for(mxRectangleShape.prototype.redrawHtmlShape.apply(this,arguments);this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);if(null!=this.image){var e=document.createElement("img");e.style.position="relative",e.setAttribute("border","0");var n=this.getImageBounds(this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height);n.x-=this.bounds.x,n.y-=this.bounds.y,e.style.left=Math.round(n.x)+"px",e.style.top=Math.round(n.y)+"px",e.style.width=Math.round(n.width)+"px",e.style.height=Math.round(n.height)+"px",e.src=this.image,this.node.appendChild(e)}},mxUtils.extend(mxCylinder,mxShape),mxCylinder.prototype.maxHeight=40,mxCylinder.prototype.svgStrokeTolerance=0,mxCylinder.prototype.paintVertexShape=function(e,n,t,a,i){e.translate(n,t),e.begin(),this.redrawPath(e,n,t,a,i,!1),e.fillAndStroke(),e.setShadow(!1),e.begin(),this.redrawPath(e,n,t,a,i,!0),e.stroke()},mxCylinder.prototype.redrawPath=function(e,n,t,a,i,s){n=Math.min(this.maxHeight,Math.round(i/5)),(s&&null!=this.fill||!s&&null==this.fill)&&(e.moveTo(0,n),e.curveTo(0,2*n,a,2*n,a,n),s||(e.stroke(),e.begin())),s||(e.moveTo(0,n),e.curveTo(0,-n/3,a,-n/3,a,n),e.lineTo(a,i-n),e.curveTo(a,i+n/3,0,i+n/3,0,i-n),e.close())},mxUtils.extend(mxConnector,mxPolyline),mxConnector.prototype.paintEdgeShape=function(e,n){var t=this.createMarker(e,n,!0),a=this.createMarker(e,n,!1);null==this.style||1!=this.style[mxConstants.STYLE_CURVED]?this.paintLine(e,n,this.isRounded):this.paintCurvedLine(e,n),e.setFillColor(this.stroke),e.setShadow(!1),e.setDashed(!1),null!=t&&t(),null!=a&&a()},mxConnector.prototype.paintCurvedLine=function(e,n){e.begin();var t=n[0],a=n.length;for(e.moveTo(t.x,t.y),t=1;t<a-2;t++){var i=n[t],s=n[t+1];e.quadTo(i.x,i.y,(i.x+s.x)/2,(i.y+s.y)/2)}i=n[a-2],s=n[a-1],e.quadTo(i.x,i.y,s.x,s.y),e.stroke()},mxConnector.prototype.createMarker=function(e,n,t){var a=n.length,i=t?n[1]:n[a-2],s=(a=(n=t?n[0]:n[a-1]).x-i.x,n.y-i.y),o=(i=a/(o=Math.max(1,Math.sqrt(a*a+s*s))),a=s/o,s=mxUtils.getNumber(this.style,t?mxConstants.STYLE_STARTSIZE:mxConstants.STYLE_ENDSIZE,mxConstants.DEFAULT_MARKERSIZE),mxUtils.getValue(this.style,t?mxConstants.STYLE_STARTARROW:mxConstants.STYLE_ENDARROW));return mxMarker.createMarker(e,this,o,n,i,a,s,t,this.strokewidth,0!=this.style[t?mxConstants.STYLE_STARTFILL:mxConstants.STYLE_ENDFILL])},mxConnector.prototype.augmentBoundingBox=function(e){mxShape.prototype.augmentBoundingBox.apply(this,arguments);var n=0;mxUtils.getValue(this.style,mxConstants.STYLE_STARTARROW,mxConstants.NONE)!=mxConstants.NONE&&(n=mxUtils.getNumber(this.style,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_MARKERSIZE)+1),mxUtils.getValue(this.style,mxConstants.STYLE_ENDARROW,mxConstants.NONE)!=mxConstants.NONE&&(n=Math.max(n,mxUtils.getNumber(this.style,mxConstants.STYLE_ENDSIZE,mxConstants.DEFAULT_MARKERSIZE))+1),e.grow(Math.ceil(n*this.scale))},mxUtils.extend(mxSwimlane,mxShape),mxSwimlane.prototype.imageSize=16,mxSwimlane.prototype.getGradientBounds=function(e,n,t,a,i){return new mxRectangle(n,t,a,Math.min(i,mxUtils.getValue(this.style,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)))},mxSwimlane.prototype.getRotation=function(){var e=mxShape.prototype.getRotation.apply(this,arguments);return 1!=mxUtils.getValue(this.style,mxConstants.STYLE_HORIZONTAL,1)&&(e+=mxText.prototype.verticalTextRotation),e},mxSwimlane.prototype.getTextRotation=function(){return this.getRotation()},mxSwimlane.prototype.isPaintBoundsInverted=function(){return mxShape.prototype.isPaintBoundsInverted.apply(this,arguments)||1!=mxUtils.getValue(this.style,mxConstants.STYLE_HORIZONTAL,1)},mxSwimlane.prototype.getArcSize=function(e,n,t){return 3*t*(mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100)},mxSwimlane.prototype.paintVertexShape=function(e,n,t,a,i){var s=Math.min(i,mxUtils.getValue(this.style,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)),o=mxUtils.getValue(this.style,mxConstants.STYLE_SWIMLANE_FILLCOLOR,mxConstants.NONE),r=1==mxUtils.getValue(this.style,mxConstants.STYLE_SWIMLANE_LINE,1),l=0;e.translate(n,t),this.isRounded?(l=this.getArcSize(a,i,s),this.paintRoundedSwimlane(e,n,t,a,i,s,l,o,r)):this.paintSwimlane(e,n,t,a,i,s,o,r),o=mxUtils.getValue(this.style,mxConstants.STYLE_SEPARATORCOLOR,mxConstants.NONE),this.paintSeparator(e,a,s,i,o),null!=this.image&&(i=this.getImageBounds(n,s,a,i),e.image(i.x-n,i.y-t,i.width,i.height,this.image,!1,!1,!1)),this.glass&&(e.setShadow(!1),this.paintGlassEffect(e,0,0,a,s,l))},mxSwimlane.prototype.paintSwimlane=function(e,n,t,a,i,s,o,r){o!=mxConstants.NONE&&(e.save(),e.setFillColor(o),e.rect(0,0,a,i),e.fillAndStroke(),e.restore(),e.setShadow(!1)),e.begin(),e.moveTo(0,s),e.lineTo(0,0),e.lineTo(a,0),e.lineTo(a,s),r&&e.close(),e.fillAndStroke(),s<i&&o==mxConstants.NONE&&(e.pointerEvents=!1,e.begin(),e.moveTo(0,s),e.lineTo(0,i),e.lineTo(a,i),e.lineTo(a,s),e.stroke())},mxSwimlane.prototype.paintRoundedSwimlane=function(e,n,t,a,i,s,o,r,l){r!=mxConstants.NONE&&(e.save(),e.setFillColor(r),e.roundrect(0,0,a,i,o,o),e.fillAndStroke(),e.restore(),e.setShadow(!1)),e.begin(),e.moveTo(a,s),e.lineTo(a,o),e.quadTo(a,0,a-Math.min(a/2,o),0),e.lineTo(Math.min(a/2,o),0),e.quadTo(0,0,0,o),e.lineTo(0,s),l&&e.close(),e.fillAndStroke(),s<i&&r==mxConstants.NONE&&(e.pointerEvents=!1,e.begin(),e.moveTo(0,s),e.lineTo(0,i-o),e.quadTo(0,i,Math.min(a/2,o),i),e.lineTo(a-Math.min(a/2,o),i),e.quadTo(a,i,a,i-o),e.lineTo(a,s),e.stroke())},mxSwimlane.prototype.paintSeparator=function(e,n,t,a,i){i!=mxConstants.NONE&&(e.setStrokeColor(i),e.setDashed(!0),e.begin(),e.moveTo(n,t),e.lineTo(n,a),e.stroke(),e.setDashed(!1))},mxSwimlane.prototype.getImageBounds=function(e,n,t,a){return new mxRectangle(e+t-this.imageSize,n,this.imageSize,this.imageSize)},mxGraphLayout.prototype.graph=null,mxGraphLayout.prototype.useBoundingBox=!0,mxGraphLayout.prototype.parent=null,mxGraphLayout.prototype.moveCell=function(e,n,t){},mxGraphLayout.prototype.execute=function(e){},mxGraphLayout.prototype.getGraph=function(){return this.graph},mxGraphLayout.prototype.getConstraint=function(e,n,t,a){return null!=(n=null!=(t=this.graph.view.getState(n))?t.style:this.graph.getCellStyle(n))?n[e]:null},mxGraphLayout.traverse=function(e,n,t,a,i){if(null!=t&&null!=e){n=null==n||n,i=i||[];var s=mxCellPath.create(e);if(null==i[s]&&(null==(a=t(i[s]=e,a))||a)&&0<(a=this.graph.model.getEdgeCount(e)))for(s=0;s<a;s++){var o=this.graph.model.getEdgeAt(e,s),r=this.graph.model.getTerminal(o,!0)==e;n&&!r||(r=this.graph.view.getVisibleTerminal(o,!r),this.traverse(r,n,t,o,i))}}},mxGraphLayout.prototype.isVertexMovable=function(e){return this.graph.isCellMovable(e)},mxGraphLayout.prototype.isVertexIgnored=function(e){return!this.graph.getModel().isVertex(e)||!this.graph.isCellVisible(e)},mxGraphLayout.prototype.isEdgeIgnored=function(e){var n=this.graph.getModel();return!n.isEdge(e)||!this.graph.isCellVisible(e)||null==n.getTerminal(e,!0)||null==n.getTerminal(e,!1)},mxGraphLayout.prototype.setEdgeStyleEnabled=function(e,n){this.graph.setCellStyles(mxConstants.STYLE_NOEDGESTYLE,n?"0":"1",[e])},mxGraphLayout.prototype.setOrthogonalEdge=function(e,n){this.graph.setCellStyles(mxConstants.STYLE_ORTHOGONAL,n?"1":"0",[e])},mxGraphLayout.prototype.getParentOffset=function(e){var n=new mxPoint;if(null!=e&&e!=this.parent){var t=this.graph.getModel();if(t.isAncestor(this.parent,e))for(var a=t.getGeometry(e);e!=this.parent;)n.x+=a.x,n.y+=a.y,e=t.getParent(e),a=t.getGeometry(e)}return n},mxGraphLayout.prototype.setEdgePoints=function(e,n){if(null!=e){var t=this.graph.model,a=t.getGeometry(e);if(null==a?(a=new mxGeometry).setRelative(!0):a=a.clone(),null!=this.parent&&null!=n)for(var i=t.getParent(e),s=(i=this.getParentOffset(i),0);s<n.length;s++)n[s].x-=i.x,n[s].y-=i.y;a.points=n,t.setGeometry(e,a)}},mxGraphLayout.prototype.setVertexLocation=function(e,n,t){var a=this.graph.getModel(),i=a.getGeometry(e),s=null;if(null!=i){if(s=new mxRectangle(n,t,i.width,i.height),this.useBoundingBox){var o=this.graph.getView().getState(e);if(null!=o&&null!=o.text&&null!=o.text.boundingBox){var r=this.graph.getView().scale,l=o.text.boundingBox;o.text.boundingBox.x<o.x&&(n+=(o.x-l.x)/r,s.width=l.width),o.text.boundingBox.y<o.y&&(t+=(o.y-l.y)/r,s.height=l.height)}}null!=this.parent&&(null!=(o=a.getParent(e))&&o!=this.parent&&(n-=(o=this.getParentOffset(o)).x,t-=o.y)),i.x==n&&i.y==t||((i=i.clone()).x=n,i.y=t,a.setGeometry(e,i))}return s},mxGraphLayout.prototype.getVertexBounds=function(e){var n=this.graph.getModel().getGeometry(e);if(this.useBoundingBox&&(null!=(r=this.graph.getView().getState(e))&&null!=r.text&&null!=r.text.boundingBox)){var t=this.graph.getView().scale,a=r.text.boundingBox,i=Math.max(r.x-a.x,0)/t,s=Math.max(r.y-a.y,0)/t,o=Math.max(a.x+a.width-(r.x+r.width),0)/t,r=Math.max(a.y+a.height-(r.y+r.height),0)/t;n=new mxRectangle(n.x-i,n.y-s,n.width+i+o,n.height+s+r)}return null!=this.parent&&(e=this.graph.getModel().getParent(e),n=n.clone(),null!=e&&e!=this.parent&&(e=this.getParentOffset(e),n.x+=e.x,n.y+=e.y)),new mxRectangle(n.x,n.y,n.width,n.height)},mxGraphLayout.prototype.arrangeGroups=function(e,n){this.graph.getModel().beginUpdate();try{for(var t=e.length-1;0<=t;t--){var a=e[t],i=this.graph.getChildVertices(a),s=this.graph.getBoundingBoxFromGeometry(i),o=this.graph.getCellGeometry(a),r=0,l=0;if(this.graph.isSwimlane(a)){var d=this.graph.getStartSize(a);r=d.width,l=d.height}null!=s&&null!=o&&((o=o.clone()).x=o.x+s.x-n-r,o.y=o.y+s.y-n-l,o.width=s.width+2*n+r,o.height=s.height+2*n+l,this.graph.getModel().setGeometry(a,o),this.graph.moveCells(i,n+r-s.x,n+l-s.y))}}finally{this.graph.getModel().endUpdate()}},mxStackLayout.prototype=new mxGraphLayout,mxStackLayout.prototype.constructor=mxStackLayout,mxStackLayout.prototype.horizontal=null,mxStackLayout.prototype.spacing=null,mxStackLayout.prototype.x0=null,mxStackLayout.prototype.y0=null,mxStackLayout.prototype.border=0,mxStackLayout.prototype.keepFirstLocation=!1,mxStackLayout.prototype.fill=!1,mxStackLayout.prototype.resizeParent=!1,mxStackLayout.prototype.resizeLast=!1,mxStackLayout.prototype.wrap=null,mxStackLayout.prototype.isHorizontal=function(){return this.horizontal},mxStackLayout.prototype.moveCell=function(e,n,t){var a=this.graph.getModel(),i=a.getParent(e),s=this.isHorizontal();if(null!=e&&null!=i){var o=0,r=0,l=a.getChildCount(i);for(n=s?n:t,null!=(o=this.graph.getView().getState(i))&&(n-=s?o.x:o.y),o=0;o<l;o++)if((t=a.getChildAt(i,o))!=e&&null!=(t=a.getGeometry(t))){if(t=s?t.x+t.width/2:t.y+t.height/2,r<n&&n<t)break;r=t}s=i.getIndex(e),s=Math.max(0,o-(s<o?1:0)),a.add(i,e,s)}},mxStackLayout.prototype.getParentSize=function(e){var n=this.graph.getModel(),t=n.getGeometry(e);return null!=this.graph.container&&(null==t&&n.isLayer(e)||e==this.graph.getView().currentRoot)&&(t=new mxRectangle(0,0,this.graph.container.offsetWidth-1,this.graph.container.offsetHeight-1)),t},mxStackLayout.prototype.execute=function(e){if(null!=e){var n=this.isHorizontal(),t=this.graph.getModel(),a=this.getParentSize(e),i=0;null!=a&&(i=n?a.height:a.width);i=i-(2*this.spacing+2*this.border);var s=this.x0+this.border,o=this.y0+this.border;if(this.graph.isSwimlane(e)){var r=this.graph.getCellStyle(e),l=mxUtils.getValue(r,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE);n==(r=mxUtils.getValue(r,mxConstants.STYLE_HORIZONTAL,!0))&&(i-=l),n?o+=l:s+=l}t.beginUpdate();try{l=0,r=null;for(var d=t.getChildCount(e),c=0;c<d;c++){var m=t.getChildAt(e,c);if(!this.isVertexIgnored(m)&&this.isVertexMovable(m)){var u=t.getGeometry(m);null!=u&&(u=u.clone(),null!=this.wrap&&null!=r&&(n&&r.x+r.width+u.width+2*this.spacing>this.wrap||!n&&r.y+r.height+u.height+2*this.spacing>this.wrap)&&(r=null,n?o+=l+this.spacing:s+=l+this.spacing,l=0),l=Math.max(l,n?u.height:u.width),null!=r?n?u.x=r.x+r.width+this.spacing:u.y=r.y+r.height+this.spacing:this.keepFirstLocation||(n?u.x=s:u.y=o),n?u.y=o:u.x=s,this.fill&&0<i&&(n?u.height=i:u.width=i),t.setGeometry(m,u),r=u)}}this.resizeParent&&null!=a&&null!=r&&!this.graph.isCellCollapsed(e)?(a=a.clone(),n?a.width=r.x+r.width+this.spacing:a.height=r.y+r.height+this.spacing,t.setGeometry(e,a)):this.resizeLast&&null!=a&&null!=r&&(n?r.width=a.width-r.x-this.spacing:r.height=a.height-r.y-this.spacing)}finally{t.endUpdate()}}},mxPartitionLayout.prototype=new mxGraphLayout,mxPartitionLayout.prototype.constructor=mxPartitionLayout,mxPartitionLayout.prototype.horizontal=null,mxPartitionLayout.prototype.spacing=null,mxPartitionLayout.prototype.border=null,mxPartitionLayout.prototype.resizeVertices=!0,mxPartitionLayout.prototype.isHorizontal=function(){return this.horizontal},mxPartitionLayout.prototype.moveCell=function(e,n,t){var a=(t=this.graph.getModel()).getParent(e);if(null!=e&&null!=a){var i=0,s=0,o=t.getChildCount(a);for(i=0;i<o;i++){var r=t.getChildAt(a,i);if(null!=(r=this.getVertexBounds(r))){if(r=r.x+r.width/2,s<n&&n<r)break;s=r}}n=a.getIndex(e),n=Math.max(0,i-(n<i?1:0)),t.add(a,e,n)}},mxPartitionLayout.prototype.execute=function(e){var n=this.isHorizontal(),t=this.graph.getModel(),a=t.getGeometry(e);if(null!=this.graph.container&&(null==a&&t.isLayer(e)||e==this.graph.getView().currentRoot)&&(a=new mxRectangle(0,0,this.graph.container.offsetWidth-1,this.graph.container.offsetHeight-1)),null!=a){for(var i=[],s=t.getChildCount(e),o=0;o<s;o++){var r=t.getChildAt(e,o);!this.isVertexIgnored(r)&&this.isVertexMovable(r)&&i.push(r)}if(0<(s=i.length)){var l=this.border,d=this.border,c=(c=n?a.height:a.width)-2*this.border;if(e=this.graph.isSwimlane(e)?this.graph.getStartSize(e):new mxRectangle,c-=n?e.height:e.width,l+=e.width,d+=e.height,e=this.border+(s-1)*this.spacing,0<(a=n?(a.width-l-e)/s:(a.height-d-e)/s)){t.beginUpdate();try{for(o=0;o<s;o++){r=i[o];var m=t.getGeometry(r);null!=m&&((m=m.clone()).x=l,m.y=d,n?(this.resizeVertices&&(m.width=a,m.height=c),l+=a+this.spacing):(this.resizeVertices&&(m.height=a,m.width=c),d+=a+this.spacing),t.setGeometry(r,m))}}finally{t.endUpdate()}}}}},mxCompactTreeLayout.prototype=new mxGraphLayout,mxCompactTreeLayout.prototype.constructor=mxCompactTreeLayout,mxCompactTreeLayout.prototype.horizontal=null,mxCompactTreeLayout.prototype.invert=null,mxCompactTreeLayout.prototype.resizeParent=!0,mxCompactTreeLayout.prototype.groupPadding=10,mxCompactTreeLayout.prototype.parentsChanged=null,mxCompactTreeLayout.prototype.moveTree=!1,mxCompactTreeLayout.prototype.levelDistance=10,mxCompactTreeLayout.prototype.nodeDistance=20,mxCompactTreeLayout.prototype.resetEdges=!0,mxCompactTreeLayout.prototype.prefHozEdgeSep=5,mxCompactTreeLayout.prototype.prefVertEdgeOff=4,mxCompactTreeLayout.prototype.minEdgeJetty=8,mxCompactTreeLayout.prototype.channelBuffer=4,mxCompactTreeLayout.prototype.edgeRouting=!0,mxCompactTreeLayout.prototype.isVertexIgnored=function(e){return mxGraphLayout.prototype.isVertexIgnored.apply(this,arguments)||0==this.graph.getConnections(e).length},mxCompactTreeLayout.prototype.isHorizontal=function(){return this.horizontal},mxCompactTreeLayout.prototype.execute=function(e,n){this.parent=e;var t=this.graph.getModel();if(null==n)if(0<this.graph.getEdges(e,t.getParent(e),this.invert,!this.invert,!1).length)n=e;else{if(0<(o=this.graph.findTreeRoots(e,!0,this.invert)).length)for(var a=0;a<o.length;a++)if(!this.isVertexIgnored(o[a])&&0<this.graph.getEdges(o[a],null,this.invert,!this.invert,!1).length){n=o[a];break}}if(null!=n){this.parentsChanged=this.resizeParent?{}:null,t.beginUpdate();try{var i=this.dfs(n,e);if(null!=i){this.layout(i);var s=this.graph.gridSize,o=s;if(!this.moveTree){var r=this.getVertexBounds(n);null!=r&&(s=r.x,o=r.y)}if((r=null)!=(r=this.isHorizontal()?this.horizontalLayout(i,s,o):this.verticalLayout(i,null,s,o))){var l=a=0;r.x<0&&(a=Math.abs(s-r.x)),r.y<0&&(l=Math.abs(o-r.y)),(0!=a||0!=l)&&this.moveNode(i,a,l),this.resizeParent&&this.adjustParents(),this.edgeRouting&&this.localEdgeProcessing(i)}}}finally{t.endUpdate()}}},mxCompactTreeLayout.prototype.moveNode=function(e,n,t){for(e.x+=n,e.y+=t,this.apply(e),e=e.child;null!=e;)this.moveNode(e,n,t),e=e.next},mxCompactTreeLayout.prototype.dfs=function(e,n,t){t=null!=t?t:[];var a=mxCellPath.create(e),i=null;if(null!=e&&null==t[a]&&!this.isVertexIgnored(e)){t[a]=e;i=this.createNode(e),a=this.graph.getModel();var s=null;e=this.graph.getEdges(e,n,this.invert,!this.invert,!1,!0);for(var o=this.graph.getView(),r=0;r<e.length;r++){var l=e[r];if(!this.isEdgeIgnored(l)){this.resetEdges&&this.setEdgePoints(l,null),this.edgeRouting&&(this.setEdgeStyleEnabled(l,!1),this.setEdgePoints(l,null));var d;l=null!=(d=o.getState(l))?d.getVisibleTerminal(this.invert):o.getVisibleTerminal(l,this.invert);null!=(d=this.dfs(l,n,t))&&null!=a.getGeometry(l)&&(null==s?i.child=d:s.next=d,s=d)}}}return i},mxCompactTreeLayout.prototype.layout=function(e){if(null!=e){for(var n=e.child;null!=n;)this.layout(n),n=n.next;null!=e.child?this.attachParent(e,this.join(e)):this.layoutLeaf(e)}},mxCompactTreeLayout.prototype.horizontalLayout=function(e,n,t,a){if(e.x+=n+e.offsetX,e.y+=t+e.offsetY,a=this.apply(e,a),null!=(n=e.child)){a=this.horizontalLayout(n,e.x,e.y,a),t=e.y+n.offsetY;for(var i=n.next;null!=i;)a=this.horizontalLayout(i,e.x+n.offsetX,t,a),t+=i.offsetY,i=i.next}return a},mxCompactTreeLayout.prototype.verticalLayout=function(e,n,t,a,i){if(e.x+=t+e.offsetY,e.y+=a+e.offsetX,i=this.apply(e,i),null!=(n=e.child))for(i=this.verticalLayout(n,e,e.x,e.y,i),t=e.x+n.offsetY,a=n.next;null!=a;)i=this.verticalLayout(a,e,t,e.y+n.offsetX,i),t+=a.offsetY,a=a.next;return i},mxCompactTreeLayout.prototype.attachParent=function(e,n){var t=this.nodeDistance+this.levelDistance,a=(n-e.width)/2-this.nodeDistance,i=a+e.width+2*this.nodeDistance-n;e.child.offsetX=t+e.height,e.child.offsetY=i,e.contour.upperHead=this.createLine(e.height,0,this.createLine(t,i,e.contour.upperHead)),e.contour.lowerHead=this.createLine(e.height,0,this.createLine(t,a,e.contour.lowerHead))},mxCompactTreeLayout.prototype.layoutLeaf=function(e){var n=2*this.nodeDistance;e.contour.upperTail=this.createLine(e.height+n,0),e.contour.upperHead=e.contour.upperTail,e.contour.lowerTail=this.createLine(0,-e.width-n),e.contour.lowerHead=this.createLine(e.height+n,0,e.contour.lowerTail)},mxCompactTreeLayout.prototype.join=function(e){var n=2*this.nodeDistance,t=e.child;e.contour=t.contour;var a=t.width+n,i=a;for(t=t.next;null!=t;){var s=this.merge(e.contour,t.contour);t.offsetY=s+a,t.offsetX=0,i+=s+(a=t.width+n),t=t.next}return i},mxCompactTreeLayout.prototype.merge=function(e,n){for(var t=0,a=0,i=0,s=e.lowerHead,o=n.upperHead;null!=o&&null!=s;){var r=this.offset(t,a,o.dx,o.dy,s.dx,s.dy);a=a+r,i=i+r;t+o.dx<=s.dx?(t+=o.dx,a+=o.dy,o=o.next):(t-=s.dx,a-=s.dy,s=s.next)}return null!=o?(t=this.bridge(e.upperTail,0,0,o,t,a),e.upperTail=null!=t.next?n.upperTail:t,e.lowerTail=n.lowerTail):null==(t=this.bridge(n.lowerTail,t,a,s,0,0)).next&&(e.lowerTail=t),e.lowerHead=n.lowerHead,i},mxCompactTreeLayout.prototype.offset=function(e,n,t,a,i,s){var o;return i<=e||e+t<=0?0:0<(o=0<i*a-t*s?e<0?e*a/t-n:0<e?e*s/i-n:-n:i<e+t?s-(n+(i-e)*a/t):e+t<i?(t+e)*s/i-(n+a):s-(n+a))?o:0},mxCompactTreeLayout.prototype.bridge=function(e,n,t,a,i,s){return n=i+a.dx-n,i=i=0,0==a.dx?i=a.dy:(i=n*a.dy,i/=a.dx),n=this.createLine(n,i,a.next),e.next=this.createLine(0,s+a.dy-i-t,n),n},mxCompactTreeLayout.prototype.createNode=function(e){var n={};return n.cell=e,n.x=0,n.y=0,n.width=0,n.height=0,null!=(e=this.getVertexBounds(e))&&(this.isHorizontal()?(n.width=e.height,n.height=e.width):(n.width=e.width,n.height=e.height)),n.offsetX=0,n.offsetY=0,n.contour={},n},mxCompactTreeLayout.prototype.apply=function(e,n){var t=this.graph.getModel(),a=e.cell,i=t.getGeometry(a);return null!=a&&null!=i&&(this.isVertexMovable(a)&&(i=this.setVertexLocation(a,e.x,e.y),this.resizeParent&&(t=t.getParent(a),a=mxCellPath.create(t),null==this.parentsChanged[a]&&(this.parentsChanged[a]=t))),n=null==n?new mxRectangle(i.x,i.y,i.width,i.height):new mxRectangle(Math.min(n.x,i.x),Math.min(n.y,i.y),Math.max(n.x+n.width,i.x+i.width),Math.max(n.y+n.height,i.y+i.height))),n},mxCompactTreeLayout.prototype.createLine=function(e,n,t){var a={};return a.dx=e,a.dy=n,a.next=t,a},mxCompactTreeLayout.prototype.adjustParents=function(){var e,n=[];for(e in this.parentsChanged)n.push(this.parentsChanged[e]);this.arrangeGroups(mxUtils.sortCells(n,!0),this.groupPadding)},mxCompactTreeLayout.prototype.localEdgeProcessing=function(e){for(this.processNodeOutgoing(e),e=e.child;null!=e;)this.localEdgeProcessing(e),e=e.next},mxCompactTreeLayout.prototype.processNodeOutgoing=function(e){for(var n=e.child,t=e.cell,a=0,i=[];null!=n;){a++;var s=n.x;this.horizontal&&(s=n.y),i.push(new WeightedCellSorter(n,s)),n=n.next}i.sort(WeightedCellSorter.prototype.compare),(s=e.width)>(o=(a+1)*this.prefHozEdgeSep)+2*this.prefHozEdgeSep&&(s-=2*this.prefHozEdgeSep),n=(e=s/a)/2,s>o+2*this.prefHozEdgeSep&&(n+=this.prefHozEdgeSep);s=this.minEdgeJetty-this.prefVertEdgeOff;for(var o=0,r=this.getVertexBounds(t),l=0;l<i.length;l++){for(var d=i[l].cell.cell,c=this.getVertexBounds(d),m=(d=this.graph.getEdgesBetween(t,d,!1),[]),u=0,p=0,g=0;g<d.length;g++)this.horizontal?(u=r.x+r.width,p=r.y+n,m.push(new mxPoint(u,p)),u=r.x+r.width+s,m.push(new mxPoint(u,p)),p=c.y+c.height/2):(u=r.x+n,p=r.y+r.height,m.push(new mxPoint(u,p)),p=r.y+r.height+s,m.push(new mxPoint(u,p)),u=c.x+c.width/2),m.push(new mxPoint(u,p)),this.setEdgePoints(d[g],m);l<a/2?s+=this.prefVertEdgeOff:a/2<l&&(s-=this.prefVertEdgeOff),n+=e,o=Math.max(o,s)}},WeightedCellSorter.prototype.weightedValue=0,WeightedCellSorter.prototype.nudge=!1,WeightedCellSorter.prototype.visited=!1,WeightedCellSorter.prototype.rankIndex=null,WeightedCellSorter.prototype.cell=null,WeightedCellSorter.prototype.compare=function(e,n){return null!=e&&null!=n?n.weightedValue>e.weightedValue?1:n.weightedValue<e.weightedValue?-1:n.nudge?1:-1:0},mxFastOrganicLayout.prototype=new mxGraphLayout,mxFastOrganicLayout.prototype.constructor=mxFastOrganicLayout,mxFastOrganicLayout.prototype.useInputOrigin=!0,mxFastOrganicLayout.prototype.resetEdges=!0,mxFastOrganicLayout.prototype.disableEdgeStyle=!0,mxFastOrganicLayout.prototype.forceConstant=50,mxFastOrganicLayout.prototype.forceConstantSquared=0,mxFastOrganicLayout.prototype.minDistanceLimit=2,mxFastOrganicLayout.prototype.maxDistanceLimit=500,mxFastOrganicLayout.prototype.minDistanceLimitSquared=4,mxFastOrganicLayout.prototype.initialTemp=200,mxFastOrganicLayout.prototype.temperature=0,mxFastOrganicLayout.prototype.maxIterations=0,mxFastOrganicLayout.prototype.iteration=0,mxFastOrganicLayout.prototype.allowedToRun=!0,mxFastOrganicLayout.prototype.isVertexIgnored=function(e){return mxGraphLayout.prototype.isVertexIgnored.apply(this,arguments)||0==this.graph.getConnections(e).length},mxFastOrganicLayout.prototype.execute=function(e){var n=this.graph.getModel();this.vertexArray=[];for(var t=this.graph.getChildVertices(e),a=0;a<t.length;a++)this.isVertexIgnored(t[a])||this.vertexArray.push(t[a]);var i=this.useInputOrigin?this.graph.view.getBounds(this.vertexArray):null,s=this.vertexArray.length;for(this.indices=[],this.dispX=[],this.dispY=[],this.cellLocation=[],this.isMoveable=[],this.neighbours=[],this.radius=[],this.radiusSquared=[],this.forceConstant<.001&&(this.forceConstant=.001),this.forceConstantSquared=this.forceConstant*this.forceConstant,a=0;a<this.vertexArray.length;a++){var o=this.vertexArray[a];this.cellLocation[a]=[];var r=mxCellPath.create(o);this.indices[r]=a;var l=this.getVertexBounds(o),d=l.width,c=l.height,m=l.x,u=l.y;this.cellLocation[a][0]=m+d/2,this.cellLocation[a][1]=u+c/2,this.radius[a]=Math.min(d,c),this.radiusSquared[a]=this.radius[a]*this.radius[a]}n.beginUpdate();try{for(a=0;a<s;a++){this.dispX[a]=0,this.dispY[a]=0,this.isMoveable[a]=this.isVertexMovable(this.vertexArray[a]);var p=this.graph.getConnections(this.vertexArray[a],e);t=this.graph.getOpposites(p,this.vertexArray[a]);for(this.neighbours[a]=[],d=0;d<t.length;d++){this.resetEdges&&this.graph.resetEdge(p[d]),this.disableEdgeStyle&&this.setEdgeStyleEnabled(p[d],!1);r=mxCellPath.create(t[d]);var g=this.indices[r];this.neighbours[a][d]=null!=g?g:a}}for(this.temperature=this.initialTemp,0==this.maxIterations&&(this.maxIterations=20*Math.sqrt(s)),this.iteration=0;this.iteration<this.maxIterations;this.iteration++){if(!this.allowedToRun)return;this.calcRepulsion(),this.calcAttraction(),this.calcPositions(),this.reduceTemperature()}for(e=t=null,a=0;a<this.vertexArray.length;a++)o=this.vertexArray[a],this.isVertexMovable(o)&&(null!=(l=this.getVertexBounds(o))&&(this.cellLocation[a][0]-=l.width/2,this.cellLocation[a][1]-=l.height/2,m=this.graph.snap(this.cellLocation[a][0]),u=this.graph.snap(this.cellLocation[a][1]),this.setVertexLocation(o,m,u),t=null==t?m:Math.min(t,m),e=null==e?u:Math.min(e,u)));a=1-(t||0),o=1-(e||0),null!=i&&(a+=i.x,o+=i.y),this.graph.moveCells(this.vertexArray,a,o)}finally{n.endUpdate()}},mxFastOrganicLayout.prototype.calcPositions=function(){for(var e=0;e<this.vertexArray.length;e++)if(this.isMoveable[e]){(t=Math.sqrt(this.dispX[e]*this.dispX[e]+this.dispY[e]*this.dispY[e]))<.001&&(t=.001);var n=this.dispX[e]/t*Math.min(t,this.temperature),t=this.dispY[e]/t*Math.min(t,this.temperature);this.dispX[e]=0,this.dispY[e]=0,this.cellLocation[e][0]+=n,this.cellLocation[e][1]+=t}},mxFastOrganicLayout.prototype.calcAttraction=function(){for(var e=0;e<this.vertexArray.length;e++)for(var n=0;n<this.neighbours[e].length;n++){var t=this.neighbours[e][n];if(e!=t&&this.isMoveable[e]&&this.isMoveable[t]){(a=(s=this.cellLocation[e][0]-this.cellLocation[t][0])*s+(o=this.cellLocation[e][1]-this.cellLocation[t][1])*o-this.radiusSquared[e]-this.radiusSquared[t])<this.minDistanceLimitSquared&&(a=this.minDistanceLimitSquared);var a,i=Math.sqrt(a),s=s/i*(a=a/this.forceConstant),o=o/i*a;this.dispX[e]-=s,this.dispY[e]-=o,this.dispX[t]+=s,this.dispY[t]+=o}}},mxFastOrganicLayout.prototype.calcRepulsion=function(){for(var e=this.vertexArray.length,n=0;n<e;n++)for(var t=n;t<e;t++){if(!this.allowedToRun)return;if(t!=n&&this.isMoveable[n]&&this.isMoveable[t]){var a=this.cellLocation[n][0]-this.cellLocation[t][0],i=this.cellLocation[n][1]-this.cellLocation[t][1];0==a&&(a=.01+Math.random()),0==i&&(i=.01+Math.random());var s=Math.sqrt(a*a+i*i),o=s-this.radius[n]-this.radius[t];o>this.maxDistanceLimit||(o<this.minDistanceLimit&&(o=this.minDistanceLimit),a=a/s*(o=this.forceConstantSquared/o),i=i/s*o,this.dispX[n]+=a,this.dispY[n]+=i,this.dispX[t]-=a,this.dispY[t]-=i)}}},mxFastOrganicLayout.prototype.reduceTemperature=function(){this.temperature=this.initialTemp*(1-this.iteration/this.maxIterations)},mxCircleLayout.prototype=new mxGraphLayout,mxCircleLayout.prototype.constructor=mxCircleLayout,mxCircleLayout.prototype.radius=null,mxCircleLayout.prototype.moveCircle=!1,mxCircleLayout.prototype.x0=0,mxCircleLayout.prototype.y0=0,mxCircleLayout.prototype.resetEdges=!0,mxCircleLayout.prototype.disableEdgeStyle=!0,mxCircleLayout.prototype.execute=function(e){var n=this.graph.getModel();n.beginUpdate();try{for(var t=0,a=null,i=null,s=[],o=n.getChildCount(e),r=0;r<o;r++){var l=n.getChildAt(e,r);if(this.isVertexIgnored(l))this.isEdgeIgnored(l)||(this.resetEdges&&this.graph.resetEdge(l),this.disableEdgeStyle&&this.setEdgeStyleEnabled(l,!1));else{s.push(l);var d=this.getVertexBounds(l);a=null==a?d.y:Math.min(a,d.y),i=null==i?d.x:Math.min(i,d.x),t=Math.max(t,Math.max(d.width,d.height))}}var c=this.getRadius(s.length,t);this.moveCircle&&(i=this.x0,a=this.y0),this.circle(s,c,i,a)}finally{n.endUpdate()}},mxCircleLayout.prototype.getRadius=function(e,n){return Math.max(e*n/Math.PI,this.radius)},mxCircleLayout.prototype.circle=function(e,n,t,a){for(var i=e.length,s=2*Math.PI/i,o=0;o<i;o++)this.isVertexMovable(e[o])&&this.setVertexLocation(e[o],t+n+n*Math.sin(o*s),a+n+n*Math.cos(o*s))},mxParallelEdgeLayout.prototype=new mxGraphLayout,mxParallelEdgeLayout.prototype.constructor=mxParallelEdgeLayout,mxParallelEdgeLayout.prototype.spacing=20,mxParallelEdgeLayout.prototype.execute=function(e){e=this.findParallels(e),this.graph.model.beginUpdate();try{for(var n in e){var t=e[n];1<t.length&&this.layout(t)}}finally{this.graph.model.endUpdate()}},mxParallelEdgeLayout.prototype.findParallels=function(e){for(var n=this.graph.getModel(),t=[],a=n.getChildCount(e),i=0;i<a;i++){var s=n.getChildAt(e,i);if(!this.isEdgeIgnored(s)){var o=this.getEdgeId(s);null!=o&&(null==t[o]&&(t[o]=[]),t[o].push(s))}}return t},mxParallelEdgeLayout.prototype.getEdgeId=function(e){var n=this.graph.getView(),t=n.getState(e),a=null!=t?t.getVisibleTerminal(!0):n.getVisibleTerminal(e,!0);return e=null!=t?t.getVisibleTerminal(!1):n.getVisibleTerminal(e,!1),null!=a&&null!=e?(a=mxCellPath.create(a),(e=mxCellPath.create(e))<a?e+"-"+a:a+"-"+e):null},mxParallelEdgeLayout.prototype.layout=function(e){var n=e[0];if((o=(t=this.graph.getModel()).getGeometry(t.getTerminal(n,!0)))==(s=t.getGeometry(t.getTerminal(n,!1)))){n=o.x+o.width+this.spacing;for(var t=o.y+o.height/2,a=0;a<e.length;a++)this.route(e[a],n,t),n+=this.spacing}else if(null!=o&&null!=s){n=o.x+o.width/2,t=o.y+o.height/2,a=s.x+s.width/2-n;var i=s.y+s.height/2-t,s=Math.sqrt(a*a+i*i),o=i*this.spacing/s;for(s=a*this.spacing/s,n=n+a/2+o*(e.length-1)/2,t=t+i/2-s*(e.length-1)/2,a=0;a<e.length;a++)this.route(e[a],n,t),n-=o,t+=s}},mxParallelEdgeLayout.prototype.route=function(e,n,t){this.graph.isCellMovable(e)&&this.setEdgePoints(e,[new mxPoint(n,t)])},mxCompositeLayout.prototype=new mxGraphLayout,mxCompositeLayout.prototype.constructor=mxCompositeLayout,mxCompositeLayout.prototype.layouts=null,mxCompositeLayout.prototype.master=null,mxCompositeLayout.prototype.moveCell=function(e,n,t){null!=this.master?this.master.move.apply(this.master,arguments):this.layouts[0].move.apply(this.layouts[0],arguments)},mxCompositeLayout.prototype.execute=function(e){var n=this.graph.getModel();n.beginUpdate();try{for(var t=0;t<this.layouts.length;t++)this.layouts[t].execute.apply(this.layouts[t],arguments)}finally{n.endUpdate()}},mxEdgeLabelLayout.prototype=new mxGraphLayout,mxEdgeLabelLayout.prototype.constructor=mxEdgeLabelLayout,mxEdgeLabelLayout.prototype.execute=function(e){for(var n=this.graph.view,t=this.graph.getModel(),a=[],i=[],s=t.getChildCount(e),o=0;o<s;o++){var r=t.getChildAt(e,o),l=n.getState(r);null!=l&&(this.isVertexIgnored(r)?this.isEdgeIgnored(r)||a.push(l):i.push(l))}this.placeLabels(i,a)},mxEdgeLabelLayout.prototype.placeLabels=function(e,n){var t=this.graph.getModel();t.beginUpdate();try{for(var a=0;a<n.length;a++){var i=n[a];if(null!=i&&null!=i.text&&null!=i.text.boundingBox)for(var s=0;s<e.length;s++){var o=e[s];null!=o&&this.avoid(i,o)}}}finally{t.endUpdate()}},mxEdgeLabelLayout.prototype.avoid=function(e,n){var t=this.graph.getModel(),a=e.text.boundingBox;if(mxUtils.intersects(a,n)){var i=-a.y-a.height+n.y,s=-a.y+n.y+n.height;i=Math.abs(i)<Math.abs(s)?i:s,s=-a.x-a.width+n.x,a=-a.x+n.x+n.width,a=Math.abs(s)<Math.abs(a)?s:a;Math.abs(a)<Math.abs(i)?i=0:a=0,null!=(s=t.getGeometry(e.cell))&&(null!=(s=s.clone()).offset?(s.offset.x+=a,s.offset.y+=i):s.offset=new mxPoint(a,i),t.setGeometry(e.cell,s))}},mxGraphAbstractHierarchyCell.prototype.maxRank=-1,mxGraphAbstractHierarchyCell.prototype.minRank=-1,mxGraphAbstractHierarchyCell.prototype.x=null,mxGraphAbstractHierarchyCell.prototype.y=null,mxGraphAbstractHierarchyCell.prototype.width=0,mxGraphAbstractHierarchyCell.prototype.height=0,mxGraphAbstractHierarchyCell.prototype.nextLayerConnectedCells=null,mxGraphAbstractHierarchyCell.prototype.previousLayerConnectedCells=null,mxGraphAbstractHierarchyCell.prototype.temp=null,mxGraphAbstractHierarchyCell.prototype.getNextLayerConnectedCells=function(e){return null},mxGraphAbstractHierarchyCell.prototype.getPreviousLayerConnectedCells=function(e){return null},mxGraphAbstractHierarchyCell.prototype.isEdge=function(){return!1},mxGraphAbstractHierarchyCell.prototype.isVertex=function(){return!1},mxGraphAbstractHierarchyCell.prototype.getGeneralPurposeVariable=function(e){return null},mxGraphAbstractHierarchyCell.prototype.setGeneralPurposeVariable=function(e,n){return null},mxGraphAbstractHierarchyCell.prototype.setX=function(e,n){this.isVertex()?this.x[0]=n:this.isEdge()&&(this.x[e-this.minRank-1]=n)},mxGraphAbstractHierarchyCell.prototype.getX=function(e){return this.isVertex()?this.x[0]:this.isEdge()?this.x[e-this.minRank-1]:0},mxGraphAbstractHierarchyCell.prototype.setY=function(e,n){this.isVertex()?this.y[0]=n:this.isEdge()&&(this.y[e-this.minRank-1]=n)},mxGraphHierarchyNode.prototype=new mxGraphAbstractHierarchyCell,mxGraphHierarchyNode.prototype.constructor=mxGraphHierarchyNode,mxGraphHierarchyNode.prototype.cell=null,mxGraphHierarchyNode.prototype.connectsAsTarget=[],mxGraphHierarchyNode.prototype.connectsAsSource=[],mxGraphHierarchyNode.prototype.hashCode=!1,mxGraphHierarchyNode.prototype.getRankValue=function(e){return this.maxRank},mxGraphHierarchyNode.prototype.getNextLayerConnectedCells=function(e){if(null==this.nextLayerConnectedCells){this.nextLayerConnectedCells=[],this.nextLayerConnectedCells[0]=[];for(var n=0;n<this.connectsAsTarget.length;n++){var t=this.connectsAsTarget[n];-1==t.maxRank||t.maxRank==e+1?this.nextLayerConnectedCells[0].push(t.source):this.nextLayerConnectedCells[0].push(t)}}return this.nextLayerConnectedCells[0]},mxGraphHierarchyNode.prototype.getPreviousLayerConnectedCells=function(e){if(null==this.previousLayerConnectedCells){this.previousLayerConnectedCells=[],this.previousLayerConnectedCells[0]=[];for(var n=0;n<this.connectsAsSource.length;n++){var t=this.connectsAsSource[n];-1==t.minRank||t.minRank==e-1?this.previousLayerConnectedCells[0].push(t.target):this.previousLayerConnectedCells[0].push(t)}}return this.previousLayerConnectedCells[0]},mxGraphHierarchyNode.prototype.isVertex=function(){return!0},mxGraphHierarchyNode.prototype.getGeneralPurposeVariable=function(e){return this.temp[0]},mxGraphHierarchyNode.prototype.setGeneralPurposeVariable=function(e,n){this.temp[0]=n},mxGraphHierarchyNode.prototype.isAncestor=function(e){if(null!=e&&null!=this.hashCode&&null!=e.hashCode&&this.hashCode.length<e.hashCode.length){if(this.hashCode==e.hashCode)return!0;if(null==this.hashCode||null==this.hashCode)return!1;for(var n=0;n<this.hashCode.length;n++)if(this.hashCode[n]!=e.hashCode[n])return!1;return!0}return!1},mxGraphHierarchyNode.prototype.getCoreCell=function(){return this.cell},mxGraphHierarchyEdge.prototype=new mxGraphAbstractHierarchyCell,mxGraphHierarchyEdge.prototype.constructor=mxGraphHierarchyEdge,mxGraphHierarchyEdge.prototype.edges=null,mxGraphHierarchyEdge.prototype.source=null,mxGraphHierarchyEdge.prototype.target=null,mxGraphHierarchyEdge.prototype.isReversed=!1,mxGraphHierarchyEdge.prototype.invert=function(e){e=this.source,this.source=this.target,this.target=e,this.isReversed=!this.isReversed},mxGraphHierarchyEdge.prototype.getNextLayerConnectedCells=function(e){if(null==this.nextLayerConnectedCells){this.nextLayerConnectedCells=[];for(var n=0;n<this.temp.length;n++)this.nextLayerConnectedCells[n]=[],n==this.temp.length-1?this.nextLayerConnectedCells[n].push(this.source):this.nextLayerConnectedCells[n].push(this)}return this.nextLayerConnectedCells[e-this.minRank-1]},mxGraphHierarchyEdge.prototype.getPreviousLayerConnectedCells=function(e){if(null==this.previousLayerConnectedCells){this.previousLayerConnectedCells=[];for(var n=0;n<this.temp.length;n++)this.previousLayerConnectedCells[n]=[],0==n?this.previousLayerConnectedCells[n].push(this.target):this.previousLayerConnectedCells[n].push(this)}return this.previousLayerConnectedCells[e-this.minRank-1]},mxGraphHierarchyEdge.prototype.isEdge=function(){return!0},mxGraphHierarchyEdge.prototype.getGeneralPurposeVariable=function(e){return this.temp[e-this.minRank-1]},mxGraphHierarchyEdge.prototype.setGeneralPurposeVariable=function(e,n){this.temp[e-this.minRank-1]=n},mxGraphHierarchyEdge.prototype.getCoreCell=function(){return null!=this.edges&&0<this.edges.length?this.edges[0]:null},mxGraphHierarchyModel.prototype.maxRank=null,mxGraphHierarchyModel.prototype.vertexMapper=null,mxGraphHierarchyModel.prototype.edgeMapper=null,mxGraphHierarchyModel.prototype.ranks=null,mxGraphHierarchyModel.prototype.roots=null,mxGraphHierarchyModel.prototype.parent=null,mxGraphHierarchyModel.prototype.dfsCount=0,mxGraphHierarchyModel.prototype.SOURCESCANSTARTRANK=1e8,mxGraphHierarchyModel.prototype.tightenToSource=!1,mxGraphHierarchyModel.prototype.createInternalCells=function(e,n,t){for(var a=e.getGraph(),i=0;i<n.length;i++){t[i]=new mxGraphHierarchyNode(n[i]);var s=mxCellPath.create(n[i]);this.vertexMapper[s]=t[i],s=e.getEdges(n[i]),t[i].connectsAsSource=[];for(var o=0;o<s.length;o++){if((d=e.getVisibleTerminal(s[o],!1))!=n[i]&&d!=n[i]&&e.graph.model.isVertex(d)&&!e.isVertexIgnored(d)){var r=e.getEdgesBetween(n[i],d,!1),l=e.getEdgesBetween(n[i],d,!0),d=mxCellPath.create(r[0]);if(null!=r&&0<r.length&&null==this.edgeMapper[d]&&2*l.length>=r.length){l=new mxGraphHierarchyEdge(r);for(var c=0;c<r.length;c++){var m=r[c];d=mxCellPath.create(m);this.edgeMapper[d]=l,a.resetEdge(m),e.disableEdgeStyle&&(e.setEdgeStyleEnabled(m,!1),e.setOrthogonalEdge(m,!0))}l.source=t[i],mxUtils.indexOf(t[i].connectsAsSource,l)<0&&t[i].connectsAsSource.push(l)}}}t[i].temp[0]=0}},mxGraphHierarchyModel.prototype.initialRank=function(){var e=[];if(null!=this.roots)for(var n=0;n<this.roots.length;n++){var t=mxCellPath.create(this.roots[n]);null!=(t=this.vertexMapper[t])&&e.push(t)}for(var a in this.vertexMapper)(t=this.vertexMapper[a]).temp[0]=-1;for(var i=e.slice();0<e.length;){var s,o;s=(t=e[0]).connectsAsTarget,o=t.connectsAsSource;var r=!0,l=this.SOURCESCANSTARTRANK;for(n=0;n<s.length;n++){var d=s[n];if(5270620!=d.temp[0]){r=!1;break}d=d.source,l=Math.min(l,d.temp[0]-1)}if(r){if(t.temp[0]=l,this.maxRank=Math.min(this.maxRank,l),null!=o)for(n=0;n<o.length;n++)(d=o[n]).temp[0]=5270620,-1==(d=d.target).temp[0]&&(e.push(d),d.temp[0]=-2);e.shift()}else if(n=e.shift(),e.push(t),n==t&&1==e.length)break}for(a in this.vertexMapper)(t=this.vertexMapper[a]).temp[0]-=this.maxRank;for(n=0;n<i.length;n++)for(e=0,s=(t=i[n]).connectsAsSource,a=0;a<s.length;a++)d=(d=s[a]).target,t.temp[0]=Math.max(e,d.temp[0]+1),e=t.temp[0];this.maxRank=this.SOURCESCANSTARTRANK-this.maxRank},mxGraphHierarchyModel.prototype.fixRanks=function(){var s=[];this.ranks=[];for(var e=0;e<this.maxRank+1;e++)s[e]=[],this.ranks[e]=s[e];var n=null;if(null!=this.roots){var t=this.roots;for(n=[],e=0;e<t.length;e++){var a=mxCellPath.create(t[e]);n[e]=this.vertexMapper[a]}}this.visit(function(e,n,t,a,i){if(0==i&&n.maxRank<0&&n.minRank<0&&(s[n.temp[0]].push(n),n.maxRank=n.temp[0],n.minRank=n.temp[0],n.temp[0]=s[n.maxRank].length-1),null!=e&&null!=t&&1<e.maxRank-n.maxRank)for(t.maxRank=e.maxRank,t.minRank=n.maxRank,t.temp=[],t.x=[],t.y=[],e=t.minRank+1;e<t.maxRank;e++)s[e].push(t),t.setGeneralPurposeVariable(e,s[e].length-1)},n,!1,null)},mxGraphHierarchyModel.prototype.visit=function(e,n,t,a){if(null!=n){for(var i=0;i<n.length;i++){var s=n[i];null!=s&&(null==a&&(a={}),t?(s.hashCode=[],s.hashCode[0]=this.dfsCount,s.hashCode[1]=i,this.extendedDfs(null,s,null,e,a,s.hashCode,i,0)):this.dfs(null,s,null,e,a,0))}this.dfsCount++}},mxGraphHierarchyModel.prototype.dfs=function(e,n,t,a,i,s){if(null!=n){var o=mxCellPath.create(n.cell);if(null==i[o])for(a(e,i[o]=n,t,s,0),e=n.connectsAsSource.slice(),t=0;t<e.length;t++)o=e[t],this.dfs(n,o.target,o,a,i,s+1);else a(e,n,t,s,1)}},mxGraphHierarchyModel.prototype.extendedDfs=function(e,n,t,a,i,s,o,r){if(null!=n)if(null==e||null!=n.hashCode&&n.hashCode[0]==e.hashCode[0]||(s=e.hashCode.length+1,n.hashCode=e.hashCode.slice(),n.hashCode[s-1]=o),null==i[o=mxCellPath.create(n.cell)])for(a(e,i[o]=n,t,r,0),e=n.connectsAsSource.slice(),t=0;t<e.length;t++)o=e[t],this.extendedDfs(n,o.target,o,a,i,n.hashCode,t,r+1);else a(e,n,t,r,1)},mxHierarchicalLayoutStage.prototype.execute=function(e){},mxMedianHybridCrossingReduction.prototype=new mxHierarchicalLayoutStage,mxMedianHybridCrossingReduction.prototype.constructor=mxMedianHybridCrossingReduction,mxMedianHybridCrossingReduction.prototype.layout=null,mxMedianHybridCrossingReduction.prototype.maxIterations=24,mxMedianHybridCrossingReduction.prototype.nestedBestRanks=null,mxMedianHybridCrossingReduction.prototype.currentBestCrossings=0,mxMedianHybridCrossingReduction.prototype.iterationsWithoutImprovement=0,mxMedianHybridCrossingReduction.prototype.maxNoImprovementIterations=2,mxMedianHybridCrossingReduction.prototype.execute=function(e){e=this.layout.getModel(),this.nestedBestRanks=[];for(var n=0;n<e.ranks.length;n++)this.nestedBestRanks[n]=e.ranks[n].slice();var t=0,a=this.calculateCrossings(e);for(n=0;n<this.maxIterations&&t<this.maxNoImprovementIterations;n++){this.weightedMedian(n,e),this.transpose(n,e);var i=this.calculateCrossings(e);if(i<a)for(a=i,i=t=0;i<this.nestedBestRanks.length;i++)for(var s=e.ranks[i],o=0;o<s.length;o++){var r=s[o];this.nestedBestRanks[i][r.getGeneralPurposeVariable(i)]=r}else for(t++,i=0;i<this.nestedBestRanks.length;i++)for(s=e.ranks[i],o=0;o<s.length;o++)(r=s[o]).setGeneralPurposeVariable(i,o);if(0==a)break}for(t=[],a=[],n=0;n<e.maxRank+1;n++)a[n]=[],t[n]=a[n];for(n=0;n<this.nestedBestRanks.length;n++)for(i=0;i<this.nestedBestRanks[n].length;i++)a[n].push(this.nestedBestRanks[n][i]);e.ranks=t},mxMedianHybridCrossingReduction.prototype.calculateCrossings=function(e){for(var n=e.ranks.length,t=0,a=1;a<n;a++)t+=this.calculateRankCrossing(a,e);return t},mxMedianHybridCrossingReduction.prototype.calculateRankCrossing=function(e,n){for(var t=0,a=n.ranks[e],i=a.length,s=n.ranks[e-1].length,o=[],r=0;r<i;r++)o[r]=[];for(r=0;r<a.length;r++)for(var l=(c=a[r]).getGeneralPurposeVariable(e),d=c.getPreviousLayerConnectedCells(e),c=0;c<d.length;c++){var m=d[c].getGeneralPurposeVariable(e-1);o[l][m]=201207}for(r=0;r<i;r++)for(c=0;c<s;c++)if(201207==o[r][c]){for(a=r+1;a<i;a++)for(l=0;l<c;l++)201207==o[a][l]&&t++;for(a=0;a<r;a++)for(l=c+1;l<s;l++)201207==o[a][l]&&t++}return t/2},mxMedianHybridCrossingReduction.prototype.transpose=function(e,n){for(var t=!0,a=0;t&&a++<10;)for(var i=1==e%2&&1==a%2,s=(t=!1,0);s<n.ranks.length;s++){for(var o=n.ranks[s],r=[],l=0;l<o.length;l++){(b=(f=o[l]).getGeneralPurposeVariable(s))<0&&(b=l),r[b]=f}var d=b=f=null,c=null,m=null,u=null,p=null,g=null,v=null,h=null;for(l=0;l<o.length-1;l++){if(0==l){for(var f=(v=r[l]).getNextLayerConnectedCells(s),b=v.getPreviousLayerConnectedCells(s),A=(m=[],u=[],0);A<f.length;A++)m[A]=f[A].getGeneralPurposeVariable(s+1);for(A=0;A<b.length;A++)u[A]=b[A].getGeneralPurposeVariable(s-1)}else f=d,b=c,m=p,u=g,v=h;for(d=(h=r[l+1]).getNextLayerConnectedCells(s),c=h.getPreviousLayerConnectedCells(s),p=[],g=[],A=0;A<d.length;A++)p[A]=d[A].getGeneralPurposeVariable(s+1);for(A=0;A<c.length;A++)g[A]=c[A].getGeneralPurposeVariable(s-1);var E=0,y=0;for(A=0;A<m.length;A++)for(var S=0;S<p.length;S++)m[A]>p[S]&&E++,m[A]<p[S]&&y++;for(A=0;A<u.length;A++)for(S=0;S<g.length;S++)u[A]>g[S]&&E++,u[A]<g[S]&&y++;(y<E||y==E&&i)&&(d=v.getGeneralPurposeVariable(s),v.setGeneralPurposeVariable(s,h.getGeneralPurposeVariable(s)),h.setGeneralPurposeVariable(s,d),d=f,c=b,p=m,g=u,h=v,i||(t=!0))}}},mxMedianHybridCrossingReduction.prototype.weightedMedian=function(e,n){var t=0==e%2;if(t)for(var a=n.maxRank-1;0<=a;a--)this.medianRank(a,t);else for(a=1;a<n.maxRank;a++)this.medianRank(a,t)},mxMedianHybridCrossingReduction.prototype.medianRank=function(e,n){for(var t=this.nestedBestRanks[e].length,a=[],i=[],s=0;s<t;s++){var o,r,l=this.nestedBestRanks[e][s],d=new MedianCellSorter;d.cell=l,r=n?e+1:e-1,null!=(o=n?l.getNextLayerConnectedCells(e):l.getPreviousLayerConnectedCells(e))&&0!=o.length?(d.medianValue=this.medianValue(o,r),a.push(d)):i[l.getGeneralPurposeVariable(e)]=!0}for(a.sort(MedianCellSorter.prototype.compare),s=0;s<t;s++)null==i[s]&&(l=a.shift().cell).setGeneralPurposeVariable(e,s)},mxMedianHybridCrossingReduction.prototype.medianValue=function(e,n){for(var t=[],a=0,i=0;i<e.length;i++){var s=e[i];t[a++]=s.getGeneralPurposeVariable(n)}return t.sort(function(e,n){return e-n}),1==a%2?t[Math.floor(a/2)]:2==a?(t[0]+t[1])/2:(s=t[(i=a/2)-1]-t[0],a=t[a-1]-t[i],(t[i-1]*a+t[i]*s)/(s+a))},MedianCellSorter.prototype.medianValue=0,MedianCellSorter.prototype.cell=!1,MedianCellSorter.prototype.compare=function(e,n){return null!=e&&null!=n?n.medianValue>e.medianValue?-1:n.medianValue<e.medianValue?1:0:0},mxMinimumCycleRemover.prototype=new mxHierarchicalLayoutStage,mxMinimumCycleRemover.prototype.constructor=mxMinimumCycleRemover,mxMinimumCycleRemover.prototype.layout=null,mxMinimumCycleRemover.prototype.execute=function(e){var n=this.layout.getModel(),s={},o=mxUtils.clone(n.vertexMapper,null,!0),t=null;if(null!=n.roots){var a=n.roots;t=[];for(e=0;e<a.length;e++){var i=mxCellPath.create(a[e]);t[e]=n.vertexMapper[i]}}if(n.visit(function(e,n,t,a,i){n.isAncestor(e)&&(t.invert(),mxUtils.remove(t,e.connectsAsSource),e.connectsAsTarget.push(t),mxUtils.remove(t,n.connectsAsTarget),n.connectsAsSource.push(t)),e=mxCellPath.create(n.cell),s[e]=n,delete o[e]},t,!0,null),t=null,0<o.lenth&&(t=mxUtils.clone(o,null,!0)),e=mxUtils.clone(s,null,!0),n.visit(function(e,n,t,a,i){n.isAncestor(e)&&(t.invert(),mxUtils.remove(t,e.connectsAsSource),n.connectsAsSource.push(t),e.connectsAsTarget.push(t),mxUtils.remove(t,n.connectsAsTarget)),e=mxCellPath.create(n.cell),s[e]=n,delete o[e]},o,!0,e),a=this.layout.getGraph(),null!=t&&0<t.length)for(n=n.roots,e=0;e<t.length;e++)i=t[e].cell,0==a.getIncomingEdges(i).length&&n.push(i)};var mxHierarchicalEdgeStyle={ORTHOGONAL:1,POLYLINE:2,STRAIGHT:3,CURVE:4};function WeightedCellSorter(e,n){this.cell=e,this.weightedValue=n}function mxHierarchicalLayout(e,n,t){mxGraphLayout.call(this,e),this.orientation=null!=n?n:mxConstants.DIRECTION_NORTH,this.deterministic=null==t||t}function mxGraphModel(e){this.currentEdit=this.createUndoableEdit(),null!=e?this.setRoot(e):this.clear()}function mxRootChange(e,n){this.model=e,this.previous=this.root=n}function mxChildChange(e,n,t,a){this.model=e,this.previous=this.parent=n,this.child=t,this.previousIndex=this.index=a}function mxTerminalChange(e,n,t,a){this.model=e,this.cell=n,this.previous=this.terminal=t,this.source=a}function mxValueChange(e,n,t){this.model=e,this.cell=n,this.previous=this.value=t}function mxStyleChange(e,n,t){this.model=e,this.cell=n,this.previous=this.style=t}function mxGeometryChange(e,n,t){this.model=e,this.cell=n,this.previous=this.geometry=t}function mxCollapseChange(e,n,t){this.model=e,this.cell=n,this.previous=this.collapsed=t}function mxVisibleChange(e,n,t){this.model=e,this.cell=n,this.previous=this.visible=t}function mxCellAttributeChange(e,n,t){this.cell=e,this.attribute=n,this.previous=this.value=t}function mxCell(e,n,t){this.value=e,this.setGeometry(n),this.setStyle(t),null!=this.onInit&&this.onInit()}function mxGeometry(e,n,t,a){mxRectangle.call(this,e,n,t,a)}mxCoordinateAssignment.prototype=new mxHierarchicalLayoutStage,mxCoordinateAssignment.prototype.constructor=mxCoordinateAssignment,mxCoordinateAssignment.prototype.layout=null,mxCoordinateAssignment.prototype.intraCellSpacing=30,mxCoordinateAssignment.prototype.interRankCellSpacing=100,mxCoordinateAssignment.prototype.parallelEdgeSpacing=10,mxCoordinateAssignment.prototype.maxIterations=8,mxCoordinateAssignment.prototype.prefHozEdgeSep=5,mxCoordinateAssignment.prototype.prefVertEdgeOff=2,mxCoordinateAssignment.prototype.minEdgeJetty=12,mxCoordinateAssignment.prototype.channelBuffer=4,mxCoordinateAssignment.prototype.jettyPositions=null,mxCoordinateAssignment.prototype.orientation=mxConstants.DIRECTION_NORTH,mxCoordinateAssignment.prototype.initialX=null,mxCoordinateAssignment.prototype.limitX=null,mxCoordinateAssignment.prototype.currentXDelta=null,mxCoordinateAssignment.prototype.widestRank=null,mxCoordinateAssignment.prototype.rankTopY=null,mxCoordinateAssignment.prototype.rankBottomY=null,mxCoordinateAssignment.prototype.widestRankValue=null,mxCoordinateAssignment.prototype.rankWidths=null,mxCoordinateAssignment.prototype.rankY=null,mxCoordinateAssignment.prototype.fineTuning=!0,mxCoordinateAssignment.prototype.edgeStyle=mxHierarchicalEdgeStyle.POLYLINE,mxCoordinateAssignment.prototype.nextLayerConnectedCache=null,mxCoordinateAssignment.prototype.previousLayerConnectedCache=null,mxCoordinateAssignment.prototype.groupPadding=10,mxCoordinateAssignment.prototype.printStatus=function(){var e=this.layout.getModel();mxLog.show(),mxLog.writeln("======Coord assignment debug=======");for(var n=0;n<e.ranks.length;n++){mxLog.write("Rank ",n," : ");for(var t=e.ranks[n],a=0;a<t.length;a++)mxLog.write(t[a].getGeneralPurposeVariable(n),"  ");mxLog.writeln()}mxLog.writeln("====================================")},mxCoordinateAssignment.prototype.execute=function(e){this.jettyPositions=[],e=this.layout.getModel(),this.currentXDelta=0,this.initialCoords(this.layout.getGraph(),e),this.fineTuning&&this.minNode(e);var n=1e8;if(this.fineTuning)for(var t=0;t<this.maxIterations;t++){if(0!=t&&(this.medianPos(t,e),this.minNode(e)),this.currentXDelta<n){for(var a=0;a<e.ranks.length;a++)for(var i=e.ranks[a],s=0;s<i.length;s++){var o=i[s];o.setX(a,o.getGeneralPurposeVariable(a))}n=this.currentXDelta}else for(a=0;a<e.ranks.length;a++)for(i=e.ranks[a],s=0;s<i.length;s++)(o=i[s]).setGeneralPurposeVariable(a,o.getX(a));this.minPath(this.layout.getGraph(),e),this.currentXDelta=0}this.setCellLocations(this.layout.getGraph(),e)},mxCoordinateAssignment.prototype.minNode=function(e){for(var n=[],t=[],a=[],i=0;i<=e.maxRank;i++){a[i]=e.ranks[i];for(var s=0;s<a[i].length;s++){var o=a[i][s];(r=new WeightedCellSorter(o,i)).rankIndex=s,r.visited=!0,n.push(r),t[o=mxCellPath.create(o.getCoreCell())]=r}}for(e=10*n.length,s=0;0<n.length&&s<=e;){i=(r=n.shift()).cell;var r,l=r.weightedValue,d=parseInt(r.rankIndex),c=(o=i.getNextLayerConnectedCells(l),i.getPreviousLayerConnectedCells(l)),m=o.length,u=c.length,p=this.medianXValue(o,l+1),g=this.medianXValue(c,l-1),v=m+u,h=i.getGeneralPurposeVariable(l),f=h;if(0<v&&(f=(p*m+g*u)/v),m=!1,f<h-1?0==d?(i.setGeneralPurposeVariable(l,f),m=!0):(h=(h=(d=a[l][d-1]).getGeneralPurposeVariable(l))+d.width/2+this.intraCellSpacing+i.width/2)<f?(i.setGeneralPurposeVariable(l,f),m=!0):h<i.getGeneralPurposeVariable(l)-1&&(i.setGeneralPurposeVariable(l,h),m=!0):h+1<f&&(d==a[l].length-1?(i.setGeneralPurposeVariable(l,f),m=!0):f<(h=(h=(d=a[l][d+1]).getGeneralPurposeVariable(l))-d.width/2-this.intraCellSpacing-i.width/2)?(i.setGeneralPurposeVariable(l,f),m=!0):h>i.getGeneralPurposeVariable(l)+1&&(i.setGeneralPurposeVariable(l,h),m=!0)),m){for(i=0;i<o.length;i++)l=o[i],null!=(l=t[l=mxCellPath.create(l.getCoreCell())])&&0==l.visited&&(l.visited=!0,n.push(l));for(i=0;i<c.length;i++)l=c[i],null!=(l=t[l=mxCellPath.create(l.getCoreCell())])&&0==l.visited&&(l.visited=!0,n.push(l))}r.visited=!1,s++}},mxCoordinateAssignment.prototype.medianPos=function(e,n){if(0==e%2)for(var t=n.maxRank;0<t;t--)this.rankMedianPosition(t-1,n,t);else for(t=0;t<n.maxRank-1;t++)this.rankMedianPosition(t+1,n,t)},mxCoordinateAssignment.prototype.rankMedianPosition=function(e,n,t){n=n.ranks[e];for(var a=[],i=[],s=0;s<n.length;s++){var o=n[s];a[s]=new WeightedCellSorter,a[s].cell=o,a[s].rankIndex=s;var r=mxCellPath.create(o.getCoreCell());i[r]=a[s];var l=null;l=t<e?o.getPreviousLayerConnectedCells(e):o.getNextLayerConnectedCells(e);a[s].weightedValue=this.calculatedWeightedValue(o,l)}for(a.sort(WeightedCellSorter.prototype.compare),s=0;s<a.length;s++){r=0,o=a[s].cell,r=0,null!=(l=t<e?o.getPreviousLayerConnectedCells(e).slice():o.getNextLayerConnectedCells(e).slice())&&(r=0<(r=l.length)?this.medianXValue(l,t):o.getGeneralPurposeVariable(e));for(var d=0,c=(l=-1e8,a[s].rankIndex-1);0<=c;){var m;if(null!=(m=i[m=mxCellPath.create(n[c].getCoreCell())])){var u=m.cell;m.visited?(l=u.getGeneralPurposeVariable(e)+u.width/2+this.intraCellSpacing+d+o.width/2,c=-1):(d+=u.width+this.intraCellSpacing,c--)}}for(d=0,u=1e8,c=a[s].rankIndex+1;c<a.length;)if(null!=(m=i[m=mxCellPath.create(n[c].getCoreCell())])){var p=m.cell;m.visited?(u=p.getGeneralPurposeVariable(e)-p.width/2-this.intraCellSpacing-d-o.width/2,c=a.length):(d+=p.width+this.intraCellSpacing,c++)}l<=r&&r<=u?o.setGeneralPurposeVariable(e,r):r<l?(o.setGeneralPurposeVariable(e,l),this.currentXDelta+=l-r):u<r&&(o.setGeneralPurposeVariable(e,u),this.currentXDelta+=r-u),a[s].visited=!0}},mxCoordinateAssignment.prototype.calculatedWeightedValue=function(e,n){for(var t=0,a=0;a<n.length;a++){var i=n[a];e.isVertex()&&i.isVertex()?t++:t=e.isEdge()&&i.isEdge()?t+8:t+2}return t},mxCoordinateAssignment.prototype.medianXValue=function(e,n){if(0==e.length)return 0;for(var t=[],a=0;a<e.length;a++)t[a]=e[a].getGeneralPurposeVariable(n);return t.sort(function(e,n){return e-n}),1==e.length%2?t[Math.floor(e.length/2)]:(t[(a=e.length/2)-1]+t[a])/2},mxCoordinateAssignment.prototype.initialCoords=function(e,n){this.calculateWidestRank(e,n);for(var t=this.widestRank;0<=t;t--)t<n.maxRank&&this.rankCoordinates(t,e,n);for(t=this.widestRank+1;t<=n.maxRank;t++)0<t&&this.rankCoordinates(t,e,n)},mxCoordinateAssignment.prototype.rankCoordinates=function(e,n,t){n=t.ranks[e],t=0;for(var a=this.initialX+(this.widestRankValue-this.rankWidths[e])/2,i=!1,s=0;s<n.length;s++){var o=n[s];if(o.isVertex()){var r=this.layout.getVertexBounds(o.cell);null!=r?this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(o.width=r.width,o.height=r.height):(o.width=r.height,o.height=r.width):i=!0,t=Math.max(t,o.height)}else o.isEdge()&&(r=1,null!=o.edges?r=o.edges.length:mxLog.warn("edge.edges is null"),o.width=(r-1)*this.parallelEdgeSpacing);a+=o.width/2,o.setX(e,a),o.setGeneralPurposeVariable(e,a),a+=o.width/2,a+=this.intraCellSpacing}1==i&&mxLog.warn("At least one cell has no bounds")},mxCoordinateAssignment.prototype.calculateWidestRank=function(e,n){var t=-this.interRankCellSpacing,a=0;this.rankWidths=[],this.rankY=[];for(var i=n.maxRank;0<=i;i--){for(var s=0,o=n.ranks[i],r=this.initialX,l=!1,d=0;d<o.length;d++){var c=o[d];if(c.isVertex()){var m=this.layout.getVertexBounds(c.cell);null!=m?this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(c.width=m.width,c.height=m.height):(c.width=m.height,c.height=m.width):l=!0,s=Math.max(s,c.height)}else c.isEdge()&&(m=1,null!=c.edges?m=c.edges.length:mxLog.warn("edge.edges is null"),c.width=(m-1)*this.parallelEdgeSpacing);r+=c.width/2,c.setX(i,r),c.setGeneralPurposeVariable(i,r),r+=c.width/2,(r+=this.intraCellSpacing)>this.widestRankValue&&(this.widestRankValue=r,this.widestRank=i),this.rankWidths[i]=r}for(1==l&&mxLog.warn("At least one cell has no bounds"),this.rankY[i]=t,r=s/2+a/2+this.interRankCellSpacing,a=s,t=this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_WEST?t+r:t-r,d=0;d<o.length;d++)o[d].setY(i,t)}},mxCoordinateAssignment.prototype.minPath=function(e,n){var t,a=n.edgeMapper;for(t in a){var i=a[t];if(!(i.maxRank-i.minRank-1<1)){for(var s=i.getGeneralPurposeVariable(i.minRank+1),o=!0,r=0,l=i.minRank+2;l<i.maxRank;l++){s!=(d=i.getGeneralPurposeVariable(l))?(o=!1,s=d):r++}if(!o){o=s=0;var d=[],c=[],m=i.getGeneralPurposeVariable(i.minRank+1);for(l=i.minRank+1;l<i.maxRank-1;l++){var u=i.getX(l+1);m==u?(d[l-i.minRank-1]=m,s++):this.repositionValid(n,i,l+1,m)?(d[l-i.minRank-1]=m,s++):m=d[l-i.minRank-1]=u}for(m=i.getX(l),l=i.maxRank-1;l>i.minRank+1;l--)m==(u=i.getX(l-1))?(c[l-i.minRank-2]=m,o++):this.repositionValid(n,i,l-1,m)?(c[l-i.minRank-2]=m,o++):(c[l-i.minRank-2]=i.getX(l-1),m=u);if(r<o||r<s)if(s<=o)for(l=i.maxRank-2;l>i.minRank;l--)i.setX(l,c[l-i.minRank-1]);else if(o<s)for(l=i.minRank+2;l<i.maxRank;l++)i.setX(l,d[l-i.minRank-2])}}}},mxCoordinateAssignment.prototype.repositionValid=function(e,n,t,a){e=e.ranks[t];for(var i=-1,s=0;s<e.length;s++)if(n==e[s]){i=s;break}if(i<0)return!1;if(a<(s=n.getGeneralPurposeVariable(t))){if(0==i)return!0;if(!((t=(t=(e=e[i-1]).getGeneralPurposeVariable(t))+e.width/2+this.intraCellSpacing+n.width/2)<=a))return!1}else if(s<a){if(i==e.length-1)return!0;if(!(a<=(t=(t=(e=e[i+1]).getGeneralPurposeVariable(t))-e.width/2-this.intraCellSpacing-n.width/2)))return!1}return!0},mxCoordinateAssignment.prototype.setCellLocations=function(e,n){this.rankTopY=[],this.rankBottomY=[];for(var t=0;t<n.ranks.length;t++)this.rankTopY[t]=Number.MAX_VALUE,this.rankBottomY[t]=0;t=null,this.layout.resizeParent&&(t={});var a,i=n.edgeMapper,s=n.vertexMapper;for(a in s){var o=s[a];if(this.setVertexLocation(o),this.layout.resizeParent){o=e.model.getParent(o.cell);var r=mxCellPath.create(o);null==t[r]&&(t[r]=o)}}for(a in this.layout.resizeParent&&null!=t&&this.adjustParents(t),(this.edgeStyle==mxHierarchicalEdgeStyle.ORTHOGONAL||this.edgeStyle==mxHierarchicalEdgeStyle.POLYLINE||this.edgeStyle==mxHierarchicalEdgeStyle.CURVE)&&this.localEdgeProcessing(n),i)this.setEdgePosition(i[a])},mxCoordinateAssignment.prototype.adjustParents=function(e){var n,t=[];for(n in e)t.push(e[n]);this.layout.arrangeGroups(mxUtils.sortCells(t,!0),this.groupPadding)},mxCoordinateAssignment.prototype.localEdgeProcessing=function(e){for(var n=0;n<e.ranks.length;n++)for(var t=e.ranks[n],a=0;a<t.length;a++){var i=t[a];if(i.isVertex())for(var s=i.getPreviousLayerConnectedCells(n),o=n-1,r=0;r<2;r++){if(-1<o&&o<e.ranks.length&&null!=s&&0<s.length){for(var l=[],d=0;d<s.length;d++){var c=new WeightedCellSorter(s[d],s[d].getX(o));l.push(c)}l.sort(WeightedCellSorter.prototype.compare);var m=(c=i.x[0]-i.width/2)+i.width,u=s=0;for(o=[],d=0;d<l.length;d++){var p,g=l[d].cell;if(g.isVertex()){p=0==r?i.connectsAsSource:i.connectsAsTarget;for(var v=0;v<p.length;v++)p[v].source!=g&&p[v].target!=g||(s+=p[v].edges.length,u++,o.push(p[v]))}else s+=g.edges.length,u++,o.push(g)}for(i.width>(s+1)*this.prefHozEdgeSep+2*this.prefHozEdgeSep&&(c+=this.prefHozEdgeSep,m-=this.prefHozEdgeSep),c+=(l=(m-c)/s)/2,m=this.minEdgeJetty-this.prefVertEdgeOff,d=u=0;d<o.length;d++){for(g=o[d].edges.length,v=mxCellPath.create(o[d].edges[0]),null==(p=this.jettyPositions[v])&&(p=[],this.jettyPositions[v]=p),d<s/2?m+=this.prefVertEdgeOff:s/2<d&&(m-=this.prefVertEdgeOff),v=0;v<g;v++)p[4*v+2*r]=c,c+=l,p[4*v+2*r+1]=m;u=Math.max(u,m)}}s=i.getNextLayerConnectedCells(n),o=n+1}}},mxCoordinateAssignment.prototype.setEdgePosition=function(e){var n=0;if(101207!=e.temp[0]){var t=e.maxRank,a=e.minRank;t==a&&(t=e.source.maxRank,a=e.target.minRank);for(var i=0,s=mxCellPath.create(e.edges[0]),o=(s=this.jettyPositions[s],e.isReversed?e.target.cell:e.source.cell),r=this.layout.graph,l=0;l<e.edges.length;l++){var d=e.edges[l],c=this.layout.getVisibleTerminal(d,!0),m=r.model.getTerminal(d,!0),u=[],p=e.isReversed;if(c!=o&&(p=!p),null!=s){var g=p?2:0,v=p?this.rankTopY[a]:this.rankBottomY[t],h=s[4*i+1+g];p&&(h=-h),v+=h,g=s[4*i+g],m=r.model.getTerminal(d,!0),this.layout.isPort(m)&&r.model.getParent(m)==c&&(g=null!=(g=r.view.getState(m))?g.x:c.geometry.x+e.source.width*m.geometry.x),this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(u.push(new mxPoint(g,v)),this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(g,v+h))):(u.push(new mxPoint(v,g)),this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(v+h,g)))}for(g=e.x.length-1,v=h=-1,c=e.maxRank-1,p&&(g=0,h=e.x.length,v=1,c=e.minRank+1);e.maxRank!=e.minRank&&g!=h;g+=v){m=e.x[g]+n;var f=(this.rankTopY[c]+this.rankBottomY[c+1])/2,b=(this.rankTopY[c-1]+this.rankBottomY[c])/2;if(p){var A=f;f=b,b=A}this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(u.push(new mxPoint(m,f)),u.push(new mxPoint(m,b))):(u.push(new mxPoint(f,m)),u.push(new mxPoint(b,m))),this.limitX=Math.max(this.limitX,m),c+=v}null!=s&&(g=p?2:0,v=p?this.rankBottomY[t]:this.rankTopY[a],h=s[4*i+3-g],p&&(h=-h),v-=h,g=s[4*i+2-g],p=r.model.getTerminal(d,!1),c=this.layout.getVisibleTerminal(d,!1),this.layout.isPort(p)&&r.model.getParent(p)==c&&(g=null!=(g=r.view.getState(p))?g.x:c.geometry.x+e.target.width*p.geometry.x),this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(g,v-h)),u.push(new mxPoint(g,v))):(this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(v-h,g)),u.push(new mxPoint(v,g)))),e.isReversed&&this.processReversedEdge(e,d),this.layout.setEdgePoints(d,u),n=0==n?this.parallelEdgeSpacing:0<n?-n:-n+this.parallelEdgeSpacing,i++}e.temp[0]=101207}},mxCoordinateAssignment.prototype.setVertexLocation=function(e){var n=e.cell,t=e.x[0]-e.width/2,a=e.y[0]-e.height/2;this.rankTopY[e.minRank]=Math.min(this.rankTopY[e.minRank],a),this.rankBottomY[e.minRank]=Math.max(this.rankBottomY[e.minRank],a+e.height),this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?this.layout.setVertexLocation(n,t,a):this.layout.setVertexLocation(n,a,t),this.limitX=Math.max(this.limitX,t+e.width)},mxCoordinateAssignment.prototype.processReversedEdge=function(e,n){},WeightedCellSorter.prototype.weightedValue=0,WeightedCellSorter.prototype.nudge=!1,WeightedCellSorter.prototype.visited=!1,WeightedCellSorter.prototype.rankIndex=null,WeightedCellSorter.prototype.cell=null,WeightedCellSorter.prototype.compare=function(e,n){return null!=e&&null!=n?n.weightedValue>e.weightedValue?-1:n.weightedValue<e.weightedValue?1:n.nudge?-1:1:0},mxHierarchicalLayout.prototype=new mxGraphLayout,mxHierarchicalLayout.prototype.constructor=mxHierarchicalLayout,mxHierarchicalLayout.prototype.roots=null,mxHierarchicalLayout.prototype.resizeParent=!1,mxHierarchicalLayout.prototype.moveParent=!1,mxHierarchicalLayout.prototype.parentBorder=0,mxHierarchicalLayout.prototype.intraCellSpacing=30,mxHierarchicalLayout.prototype.interRankCellSpacing=100,mxHierarchicalLayout.prototype.interHierarchySpacing=60,mxHierarchicalLayout.prototype.parallelEdgeSpacing=10,mxHierarchicalLayout.prototype.orientation=mxConstants.DIRECTION_NORTH,mxHierarchicalLayout.prototype.fineTuning=!0,mxHierarchicalLayout.prototype.tightenToSource=!0,mxHierarchicalLayout.prototype.disableEdgeStyle=!0,mxHierarchicalLayout.prototype.traverseAncestors=!0,mxHierarchicalLayout.prototype.model=null,mxHierarchicalLayout.prototype.edgesCache=null,mxHierarchicalLayout.prototype.getModel=function(){return this.model},mxHierarchicalLayout.prototype.execute=function(e,n){this.parent=e;var t=this.graph.model;if(this.edgesCache={},null!=n||null!=e){if(null!=n&&null!=e){for(var a=[],i=0;i<n.length;i++)t.isAncestor(e,n[i])&&a.push(n[i]);this.roots=a}else this.roots=n;t.beginUpdate();try{this.run(e),this.resizeParent&&!this.graph.isCellCollapsed(e)&&this.graph.updateGroupBounds([e],this.parentBorder,this.moveParent)}finally{t.endUpdate()}}},mxHierarchicalLayout.prototype.findRoots=function(e,n){var t=[];if(null!=e&&null!=n){var a,i=this.graph.model,s=null,o=-1e5;for(a in n){var r=n[a];if(i.isVertex(r)&&this.graph.isCellVisible(r)){for(var l=this.getEdges(r),d=0,c=0,m=0;m<l.length;m++)this.getVisibleTerminal(l[m],!0)==r?d++:c++;0==c&&0<d&&t.push(r),o<(l=d-c)&&(o=l,s=r)}}0==t.length&&null!=s&&t.push(s)}return t},mxHierarchicalLayout.prototype.getEdges=function(e){var n=mxCellPath.create(e);if(null!=this.edgesCache[n])return this.edgesCache[n];for(var t=this.graph.model,a=[],i=this.graph.isCellCollapsed(e),s=t.getChildCount(e),o=0;o<s;o++){var r=t.getChildAt(e,o);this.isPort(r)?a=a.concat(t.getEdges(r,!0,!0)):!i&&this.graph.isCellVisible(r)||(a=a.concat(t.getEdges(r,!0,!0)))}for(a=a.concat(t.getEdges(e,!0,!0)),t=[],o=0;o<a.length;o++)((i=this.getVisibleTerminal(a[o],!0))==(s=this.getVisibleTerminal(a[o],!1))||i!=s&&(s==e&&(null==this.parent||this.graph.isValidAncestor(i,this.parent,this.traverseAncestors))||i==e&&(null==this.parent||this.graph.isValidAncestor(s,this.parent,this.traverseAncestors))))&&t.push(a[o]);return this.edgesCache[n]=t},mxHierarchicalLayout.prototype.getVisibleTerminal=function(e,n){var t=null!=(t=this.graph.view.getState(e))?t.getVisibleTerminal(n):this.graph.view.getVisibleTerminal(e,n);return this.isPort(t)&&(t=this.graph.model.getParent(t)),t},mxHierarchicalLayout.prototype.run=function(e){var n=[],t=[];if(null==this.roots&&null!=e){var a={};this.filterDescendants(e,a),this.roots=[];var i,s=!0;for(i in a)if(null!=a[i]){s=!1;break}for(;!s;){var o=this.findRoots(e,a);for(s=0;s<o.length;s++){var r=[];n.push(r),this.traverse(o[s],!0,null,t,r,n,a)}for(s=0;s<o.length;s++)this.roots.push(o[s]);for(i in s=!0,a)if(null!=a[i]){s=!1;break}}}else for(s=0;s<roots.length;s++)r=[],n.push(r),traverse(roots.get(s),!0,null,t,r,n,null);for(s=t=0;s<n.length;s++){for(i in a=[],r=n[s])a.push(r[i]);this.model=new mxGraphHierarchyModel(this,a,this.roots,e,this.tightenToSource),this.cycleStage(e),this.layeringStage(),this.crossingStage(e),t=this.placementStage(t,e)}},mxHierarchicalLayout.prototype.filterDescendants=function(e,n){var t=this.graph.model;if(t.isVertex(e)&&e!=this.parent&&this.graph.isCellVisible(e)&&(n[mxCellPath.create(e)]=e),this.traverseAncestors||e==this.parent&&this.graph.isCellVisible(e))for(var a=t.getChildCount(e),i=0;i<a;i++){var s=t.getChildAt(e,i);this.isPort(s)||this.filterDescendants(s,n)}},mxHierarchicalLayout.prototype.isPort=function(e){return!!e.geometry.relative},mxHierarchicalLayout.prototype.getEdgesBetween=function(e,n,t){t=null!=t&&t;for(var a=this.getEdges(e),i=[],s=0;s<a.length;s++){var o=this.getVisibleTerminal(a[s],!0),r=this.getVisibleTerminal(a[s],!1);(o==e&&r==n||!t&&o==n&&r==e)&&i.push(a[s])}return i},mxHierarchicalLayout.prototype.traverse=function(e,n,t,a,i,s,o){if(null!=e&&null!=a){var r=mxCellPath.create(e);if(null!=a[r]||null!=o&&null==o[r]){if(null==i[r])for(t=0;t<s.length;t++)if(null!=(e=s[t])[r]){for(l in i)e[l]=i[l];return s.pop(),e}}else{null==i[r]&&(i[r]=e),null==a[r]&&(a[r]=e),delete o[r];var l=this.getEdges(e);for(t=0;t<l.length;t++)r=this.getVisibleTerminal(l[t],!0)==e,(!n||r)&&(r=this.getVisibleTerminal(l[t],!r),i=this.traverse(r,n,l[t],a,i,s,o))}}return i},mxHierarchicalLayout.prototype.cycleStage=function(e){new mxMinimumCycleRemover(this).execute(e)},mxHierarchicalLayout.prototype.layeringStage=function(){this.model.initialRank(),this.model.fixRanks()},mxHierarchicalLayout.prototype.crossingStage=function(e){new mxMedianHybridCrossingReduction(this).execute(e)},mxHierarchicalLayout.prototype.placementStage=function(e,n){var t=new mxCoordinateAssignment(this,this.intraCellSpacing,this.interRankCellSpacing,this.orientation,e,this.parallelEdgeSpacing);return t.fineTuning=this.fineTuning,t.execute(n),t.limitX+this.interHierarchySpacing},mxGraphModel.prototype=new mxEventSource,mxGraphModel.prototype.constructor=mxGraphModel,mxGraphModel.prototype.root=null,mxGraphModel.prototype.cells=null,mxGraphModel.prototype.maintainEdgeParent=!0,mxGraphModel.prototype.createIds=!0,mxGraphModel.prototype.prefix="",mxGraphModel.prototype.postfix="",mxGraphModel.prototype.nextId=0,mxGraphModel.prototype.currentEdit=null,mxGraphModel.prototype.updateLevel=0,mxGraphModel.prototype.endingUpdate=!1,mxGraphModel.prototype.clear=function(){this.setRoot(this.createRoot())},mxGraphModel.prototype.isCreateIds=function(){return this.createIds},mxGraphModel.prototype.setCreateIds=function(e){this.createIds=e},mxGraphModel.prototype.createRoot=function(){var e=new mxCell;return e.insert(new mxCell),e},mxGraphModel.prototype.getCell=function(e){return null!=this.cells?this.cells[e]:null},mxGraphModel.prototype.filterCells=function(e,n){var t=null;if(null!=e){t=[];for(var a=0;a<e.length;a++)n(e[a])&&t.push(e[a])}return t},mxGraphModel.prototype.getDescendants=function(e){return this.filterDescendants(null,e)},mxGraphModel.prototype.filterDescendants=function(e,n){var t=[];n=n||this.getRoot(),(null==e||e(n))&&t.push(n);for(var a=this.getChildCount(n),i=0;i<a;i++){var s=this.getChildAt(n,i);t=t.concat(this.filterDescendants(e,s))}return t},mxGraphModel.prototype.getRoot=function(e){var n=e||this.root;if(null!=e)for(;null!=e;)n=e,e=this.getParent(e);return n},mxGraphModel.prototype.setRoot=function(e){return this.execute(new mxRootChange(this,e)),e},mxGraphModel.prototype.rootChanged=function(e){var n=this.root;return this.root=e,this.nextId=0,this.cells=null,this.cellAdded(e),n},mxGraphModel.prototype.isRoot=function(e){return null!=e&&this.root==e},mxGraphModel.prototype.isLayer=function(e){return this.isRoot(this.getParent(e))},mxGraphModel.prototype.isAncestor=function(e,n){for(;null!=n&&n!=e;)n=this.getParent(n);return n==e},mxGraphModel.prototype.contains=function(e){return this.isAncestor(this.root,e)},mxGraphModel.prototype.getParent=function(e){return null!=e?e.getParent():null},mxGraphModel.prototype.add=function(e,n,t){if(n!=e&&null!=e&&null!=n){null==t&&(t=this.getChildCount(e));var a=e!=this.getParent(n);this.execute(new mxChildChange(this,e,n,t)),this.maintainEdgeParent&&a&&this.updateEdgeParents(n)}return n},mxGraphModel.prototype.cellAdded=function(e){if(null!=e){if(null==e.getId()&&this.createIds&&e.setId(this.createId(e)),null!=e.getId())if((n=this.getCell(e.getId()))!=e){for(;null!=n;)e.setId(this.createId(e)),n=this.getCell(e.getId());null==this.cells&&(this.cells={}),this.cells[e.getId()]=e}mxUtils.isNumeric(e.getId())&&(this.nextId=Math.max(this.nextId,e.getId()));for(var n=this.getChildCount(e),t=0;t<n;t++)this.cellAdded(this.getChildAt(e,t))}},mxGraphModel.prototype.createId=function(e){return e=this.nextId,this.nextId++,this.prefix+e+this.postfix},mxGraphModel.prototype.updateEdgeParents=function(e,n){n=n||this.getRoot(e);for(var t=this.getChildCount(e),a=0;a<t;a++){var i=this.getChildAt(e,a);this.updateEdgeParents(i,n)}for(i=this.getEdgeCount(e),t=[],a=0;a<i;a++)t.push(this.getEdgeAt(e,a));for(a=0;a<t.length;a++)i=t[a],this.isAncestor(n,i)&&this.updateEdgeParent(i,n)},mxGraphModel.prototype.updateEdgeParent=function(e,n){for(var t=this.getTerminal(e,!0),a=this.getTerminal(e,!1),i=null;null!=t&&!this.isEdge(t)&&null!=t.geometry&&t.geometry.relative;)t=this.getParent(t);for(;null!=a&&!this.isEdge(a)&&null!=a.geometry&&a.geometry.relative;)a=this.getParent(a);if(this.isAncestor(n,t)&&this.isAncestor(n,a)&&(null!=(i=t==a?this.getParent(t):this.getNearestCommonAncestor(t,a))&&(this.getParent(i)!=this.root||this.isAncestor(i,e))&&this.getParent(e)!=i)){if(null!=(t=this.getGeometry(e))){var s=this.getOrigin(this.getParent(e)),o=this.getOrigin(i);a=o.x-s.x,s=o.y-s.y;(t=t.clone()).translate(-a,-s),this.setGeometry(e,t)}this.add(i,e,this.getChildCount(i))}},mxGraphModel.prototype.getOrigin=function(e){var n=null;return null!=e?(n=this.getOrigin(this.getParent(e)),this.isEdge(e)||null!=(e=this.getGeometry(e))&&(n.x+=e.x,n.y+=e.y)):n=new mxPoint,n},mxGraphModel.prototype.getNearestCommonAncestor=function(e,n){if(null!=e&&null!=n&&(null!=(s=mxCellPath.create(n))&&0<s.length)){var t=e,a=mxCellPath.create(t);if(s.length<a.length){t=n;var i=a,s=(a=s,i)}for(;null!=t;){if(i=this.getParent(t),0==s.indexOf(a+mxCellPath.PATH_SEPARATOR)&&null!=i)return t;a=mxCellPath.getParentPath(a),t=i}}return null},mxGraphModel.prototype.remove=function(e){return e==this.root?this.setRoot(null):null!=this.getParent(e)&&this.execute(new mxChildChange(this,null,e)),e},mxGraphModel.prototype.cellRemoved=function(e){if(null!=e&&null!=this.cells){for(var n=this.getChildCount(e)-1;0<=n;n--)this.cellRemoved(this.getChildAt(e,n));null!=this.cells&&null!=e.getId()&&delete this.cells[e.getId()]}},mxGraphModel.prototype.parentForCellChanged=function(e,n,t){var a=this.getParent(e);return null!=n?(n!=a||a.getIndex(e)!=t)&&n.insert(e,t):null!=a&&(t=a.getIndex(e),a.remove(t)),this.contains(a)||null==n?null==n&&this.cellRemoved(e):this.cellAdded(e),a},mxGraphModel.prototype.getChildCount=function(e){return null!=e?e.getChildCount():0},mxGraphModel.prototype.getChildAt=function(e,n){return null!=e?e.getChildAt(n):null},mxGraphModel.prototype.getChildren=function(e){return null!=e?e.children:null},mxGraphModel.prototype.getChildVertices=function(e){return this.getChildCells(e,!0,!1)},mxGraphModel.prototype.getChildEdges=function(e){return this.getChildCells(e,!1,!0)},mxGraphModel.prototype.getChildCells=function(e,n,t){n=null!=n&&n,t=null!=t&&t;for(var a=this.getChildCount(e),i=[],s=0;s<a;s++){var o=this.getChildAt(e,s);(!t&&!n||t&&this.isEdge(o)||n&&this.isVertex(o))&&i.push(o)}return i},mxGraphModel.prototype.getTerminal=function(e,n){return null!=e?e.getTerminal(n):null},mxGraphModel.prototype.setTerminal=function(e,n,t){var a=n!=this.getTerminal(e,t);return this.execute(new mxTerminalChange(this,e,n,t)),this.maintainEdgeParent&&a&&this.updateEdgeParent(e,this.getRoot()),n},mxGraphModel.prototype.setTerminals=function(e,n,t){this.beginUpdate();try{this.setTerminal(e,n,!0),this.setTerminal(e,t,!1)}finally{this.endUpdate()}},mxGraphModel.prototype.terminalForCellChanged=function(e,n,t){var a=this.getTerminal(e,t);return null!=n?n.insertEdge(e,t):null!=a&&a.removeEdge(e,t),a},mxGraphModel.prototype.getEdgeCount=function(e){return null!=e?e.getEdgeCount():0},mxGraphModel.prototype.getEdgeAt=function(e,n){return null!=e?e.getEdgeAt(n):null},mxGraphModel.prototype.getDirectedEdgeCount=function(e,n,t){for(var a=0,i=this.getEdgeCount(e),s=0;s<i;s++){var o=this.getEdgeAt(e,s);o!=t&&this.getTerminal(o,n)==e&&a++}return a},mxGraphModel.prototype.getConnections=function(e){return this.getEdges(e,!0,!0,!1)},mxGraphModel.prototype.getIncomingEdges=function(e){return this.getEdges(e,!0,!1,!1)},mxGraphModel.prototype.getOutgoingEdges=function(e){return this.getEdges(e,!1,!0,!1)},mxGraphModel.prototype.getEdges=function(e,n,t,a){n=null==n||n,t=null==t||t,a=null==a||a;for(var i=this.getEdgeCount(e),s=[],o=0;o<i;o++){var r=this.getEdgeAt(e,o),l=this.getTerminal(r,!0),d=this.getTerminal(r,!1);(a&&l==d||l!=d&&(n&&d==e||t&&l==e))&&s.push(r)}return s},mxGraphModel.prototype.getEdgesBetween=function(e,n,t){t=null!=t&&t;var a=this.getEdgeCount(e),i=this.getEdgeCount(n),s=e,o=a;for(i<a&&(o=i,s=n),a=[],i=0;i<o;i++){var r=this.getEdgeAt(s,i),l=this.getTerminal(r,!0),d=this.getTerminal(r,!1);(l==e&&d==n||!t&&(d==e&&l==n))&&a.push(r)}return a},mxGraphModel.prototype.getOpposites=function(e,n,t,a){t=null==t||t,a=null==a||a;var i=[];if(null!=e)for(var s=0;s<e.length;s++){var o=this.getTerminal(e[s],!0),r=this.getTerminal(e[s],!1);o==n&&null!=r&&r!=n&&a?i.push(r):r==n&&null!=o&&o!=n&&t&&i.push(o)}return i},mxGraphModel.prototype.getTopmostCells=function(e){for(var n=[],t=0;t<e.length;t++){for(var a=e[t],i=!0,s=this.getParent(a);null!=s;){if(0<=mxUtils.indexOf(e,s)){i=!1;break}s=this.getParent(s)}i&&n.push(a)}return n},mxGraphModel.prototype.isVertex=function(e){return null!=e&&e.isVertex()},mxGraphModel.prototype.isEdge=function(e){return null!=e&&e.isEdge()},mxGraphModel.prototype.isConnectable=function(e){return null!=e&&e.isConnectable()},mxGraphModel.prototype.getValue=function(e){return null!=e?e.getValue():null},mxGraphModel.prototype.setValue=function(e,n){return this.execute(new mxValueChange(this,e,n)),n},mxGraphModel.prototype.valueForCellChanged=function(e,n){return e.valueChanged(n)},mxGraphModel.prototype.getGeometry=function(e,n){return null!=e?e.getGeometry():null},mxGraphModel.prototype.setGeometry=function(e,n){return n!=this.getGeometry(e)&&this.execute(new mxGeometryChange(this,e,n)),n},mxGraphModel.prototype.geometryForCellChanged=function(e,n){var t=this.getGeometry(e);return e.setGeometry(n),t},mxGraphModel.prototype.getStyle=function(e){return null!=e?e.getStyle():null},mxGraphModel.prototype.setStyle=function(e,n){return n!=this.getStyle(e)&&this.execute(new mxStyleChange(this,e,n)),n},mxGraphModel.prototype.styleForCellChanged=function(e,n){var t=this.getStyle(e);return e.setStyle(n),t},mxGraphModel.prototype.isCollapsed=function(e){return null!=e&&e.isCollapsed()},mxGraphModel.prototype.setCollapsed=function(e,n){return n!=this.isCollapsed(e)&&this.execute(new mxCollapseChange(this,e,n)),n},mxGraphModel.prototype.collapsedStateForCellChanged=function(e,n){var t=this.isCollapsed(e);return e.setCollapsed(n),t},mxGraphModel.prototype.isVisible=function(e){return null!=e&&e.isVisible()},mxGraphModel.prototype.setVisible=function(e,n){return n!=this.isVisible(e)&&this.execute(new mxVisibleChange(this,e,n)),n},mxGraphModel.prototype.visibleStateForCellChanged=function(e,n){var t=this.isVisible(e);return e.setVisible(n),t},mxGraphModel.prototype.execute=function(e){e.execute(),this.beginUpdate(),this.currentEdit.add(e),this.fireEvent(new mxEventObject(mxEvent.EXECUTE,"change",e)),this.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",e)),this.endUpdate()},mxGraphModel.prototype.beginUpdate=function(){this.updateLevel++,this.fireEvent(new mxEventObject(mxEvent.BEGIN_UPDATE)),1==this.updateLevel&&this.fireEvent(new mxEventObject(mxEvent.START_EDIT))},mxGraphModel.prototype.endUpdate=function(){if(this.updateLevel--,0==this.updateLevel&&this.fireEvent(new mxEventObject(mxEvent.END_EDIT)),!this.endingUpdate){this.endingUpdate=0==this.updateLevel,this.fireEvent(new mxEventObject(mxEvent.END_UPDATE,"edit",this.currentEdit));try{if(this.endingUpdate&&!this.currentEdit.isEmpty()){this.fireEvent(new mxEventObject(mxEvent.BEFORE_UNDO,"edit",this.currentEdit));var e=this.currentEdit;this.currentEdit=this.createUndoableEdit(),e.notify(),this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",e))}}finally{this.endingUpdate=!1}}},mxGraphModel.prototype.createUndoableEdit=function(){var e=new mxUndoableEdit(this,!0);return e.notify=function(){e.source.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",e,"changes",e.changes)),e.source.fireEvent(new mxEventObject(mxEvent.NOTIFY,"edit",e,"changes",e.changes))},e},mxGraphModel.prototype.mergeChildren=function(e,n,t){t=null==t||t,this.beginUpdate();try{var a={};for(var i in this.mergeChildrenImpl(e,n,t,a),a){var s=a[i],o=this.getTerminal(s,!0);null!=o&&(o=a[mxCellPath.create(o)],this.setTerminal(s,o,!0)),null!=(o=this.getTerminal(s,!1))&&(o=a[mxCellPath.create(o)],this.setTerminal(s,o,!1))}}finally{this.endUpdate()}},mxGraphModel.prototype.mergeChildrenImpl=function(e,n,t,a){this.beginUpdate();try{for(var i=e.getChildCount(),s=0;s<i;s++){var o=e.getChildAt(s);if("function"==typeof o.getId){var r=o.getId(),l=null==r||this.isEdge(o)&&t?null:this.getCell(r);if(null==l){var d=o.clone();d.setId(r),d.setTerminal(o.getTerminal(!0),!0),d.setTerminal(o.getTerminal(!1),!1),l=n.insert(d),this.cellAdded(l)}a[mxCellPath.create(o)]=l,this.mergeChildrenImpl(o,l,t,a)}}}finally{this.endUpdate()}},mxGraphModel.prototype.getParents=function(e){var n=[];if(null!=e)for(var t={},a=0;a<e.length;a++){var i=this.getParent(e[a]);if(null!=i){var s=mxCellPath.create(i);null==t[s]&&(t[s]=i,n.push(i))}}return n},mxGraphModel.prototype.cloneCell=function(e){return null!=e?this.cloneCells([e],!0)[0]:null},mxGraphModel.prototype.cloneCells=function(e,n){for(var t={},a=[],i=0;i<e.length;i++)null!=e[i]?a.push(this.cloneCellImpl(e[i],t,n)):a.push(null);for(i=0;i<a.length;i++)null!=a[i]&&this.restoreClone(a[i],e[i],t);return a},mxGraphModel.prototype.cloneCellImpl=function(e,n,t){var a=this.cellCloned(e);if(n[mxObjectIdentity.get(e)]=a,t){t=this.getChildCount(e);for(var i=0;i<t;i++){var s=this.cloneCellImpl(this.getChildAt(e,i),n,!0);a.insert(s)}}return a},mxGraphModel.prototype.cellCloned=function(e){return e.clone()},mxGraphModel.prototype.restoreClone=function(e,n,t){null!=(a=this.getTerminal(n,!0))&&(null!=(a=t[mxObjectIdentity.get(a)])&&a.insertEdge(e,!0)),null!=(a=this.getTerminal(n,!1))&&(null!=(a=t[mxObjectIdentity.get(a)])&&a.insertEdge(e,!1));for(var a=this.getChildCount(e),i=0;i<a;i++)this.restoreClone(this.getChildAt(e,i),this.getChildAt(n,i),t)},mxRootChange.prototype.execute=function(){this.root=this.previous,this.previous=this.model.rootChanged(this.previous)},mxChildChange.prototype.execute=function(){var e=this.model.getParent(this.child),n=null!=e?e.getIndex(this.child):0;null==this.previous&&this.connect(this.child,!1),e=this.model.parentForCellChanged(this.child,this.previous,this.previousIndex),null!=this.previous&&this.connect(this.child,!0),this.parent=this.previous,this.previous=e,this.index=this.previousIndex,this.previousIndex=n},mxChildChange.prototype.connect=function(e,n){n=null==n||n;var t=e.getTerminal(!0),a=e.getTerminal(!1);for(null!=t&&(n?this.model.terminalForCellChanged(e,t,!0):this.model.terminalForCellChanged(e,null,!0)),null!=a&&(n?this.model.terminalForCellChanged(e,a,!1):this.model.terminalForCellChanged(e,null,!1)),e.setTerminal(t,!0),e.setTerminal(a,!1),t=this.model.getChildCount(e),a=0;a<t;a++)this.connect(this.model.getChildAt(e,a),n)},mxTerminalChange.prototype.execute=function(){this.terminal=this.previous,this.previous=this.model.terminalForCellChanged(this.cell,this.previous,this.source)},mxValueChange.prototype.execute=function(){this.value=this.previous,this.previous=this.model.valueForCellChanged(this.cell,this.previous)},mxStyleChange.prototype.execute=function(){this.style=this.previous,this.previous=this.model.styleForCellChanged(this.cell,this.previous)},mxGeometryChange.prototype.execute=function(){this.geometry=this.previous,this.previous=this.model.geometryForCellChanged(this.cell,this.previous)},mxCollapseChange.prototype.execute=function(){this.collapsed=this.previous,this.previous=this.model.collapsedStateForCellChanged(this.cell,this.previous)},mxVisibleChange.prototype.execute=function(){this.visible=this.previous,this.previous=this.model.visibleStateForCellChanged(this.cell,this.previous)},mxCellAttributeChange.prototype.execute=function(){var e=this.cell.getAttribute(this.attribute);null==this.previous?this.cell.value.removeAttribute(this.attribute):this.cell.setAttribute(this.attribute,this.previous),this.previous=e},mxCell.prototype.id=null,mxCell.prototype.value=null,mxCell.prototype.geometry=null,mxCell.prototype.style=null,mxCell.prototype.vertex=!1,mxCell.prototype.edge=!1,mxCell.prototype.connectable=!0,mxCell.prototype.visible=!0,mxCell.prototype.collapsed=!1,mxCell.prototype.parent=null,mxCell.prototype.source=null,mxCell.prototype.target=null,mxCell.prototype.children=null,mxCell.prototype.edges=null,mxCell.prototype.mxTransient="id value parent source target children edges".split(" "),mxCell.prototype.getId=function(){return this.id},mxCell.prototype.setId=function(e){this.id=e},mxCell.prototype.getValue=function(){return this.value},mxCell.prototype.setValue=function(e){this.value=e},mxCell.prototype.valueChanged=function(e){var n=this.getValue();return this.setValue(e),n},mxCell.prototype.getGeometry=function(){return this.geometry},mxCell.prototype.setGeometry=function(e){this.geometry=e},mxCell.prototype.getStyle=function(){return this.style},mxCell.prototype.setStyle=function(e){this.style=e},mxCell.prototype.isVertex=function(){return this.vertex},mxCell.prototype.setVertex=function(e){this.vertex=e},mxCell.prototype.isEdge=function(){return this.edge},mxCell.prototype.setEdge=function(e){this.edge=e},mxCell.prototype.isConnectable=function(){return this.connectable},mxCell.prototype.setConnectable=function(e){this.connectable=e},mxCell.prototype.isVisible=function(){return this.visible},mxCell.prototype.setVisible=function(e){this.visible=e},mxCell.prototype.isCollapsed=function(){return this.collapsed},mxCell.prototype.setCollapsed=function(e){this.collapsed=e},mxCell.prototype.getParent=function(){return this.parent},mxCell.prototype.setParent=function(e){this.parent=e},mxCell.prototype.getTerminal=function(e){return e?this.source:this.target},mxCell.prototype.setTerminal=function(e,n){return n?this.source=e:this.target=e,e},mxCell.prototype.getChildCount=function(){return null==this.children?0:this.children.length},mxCell.prototype.getIndex=function(e){return mxUtils.indexOf(this.children,e)},mxCell.prototype.getChildAt=function(e){return null==this.children?null:this.children[e]},mxCell.prototype.insert=function(e,n){return null!=e&&(null==n&&(n=this.getChildCount(),e.getParent()==this&&n--),e.removeFromParent(),e.setParent(this),null==this.children?(this.children=[],this.children.push(e)):this.children.splice(n,0,e)),e},mxCell.prototype.remove=function(e){var n=null;return null!=this.children&&0<=e&&(null!=(n=this.getChildAt(e))&&(this.children.splice(e,1),n.setParent(null))),n},mxCell.prototype.removeFromParent=function(){if(null!=this.parent){var e=this.parent.getIndex(this);this.parent.remove(e)}},mxCell.prototype.getEdgeCount=function(){return null==this.edges?0:this.edges.length},mxCell.prototype.getEdgeIndex=function(e){return mxUtils.indexOf(this.edges,e)},mxCell.prototype.getEdgeAt=function(e){return null==this.edges?null:this.edges[e]},mxCell.prototype.insertEdge=function(e,n){return null!=e&&(e.removeFromTerminal(n),e.setTerminal(this,n),null==this.edges||e.getTerminal(!n)!=this||mxUtils.indexOf(this.edges,e)<0)&&(null==this.edges&&(this.edges=[]),this.edges.push(e)),e},mxCell.prototype.removeEdge=function(e,n){if(null!=e){if(e.getTerminal(!n)!=this&&null!=this.edges){var t=this.getEdgeIndex(e);0<=t&&this.edges.splice(t,1)}e.setTerminal(null,n)}return e},mxCell.prototype.removeFromTerminal=function(e){var n=this.getTerminal(e);null!=n&&n.removeEdge(this,e)},mxCell.prototype.getAttribute=function(e,n){var t=this.getValue();return(null!=t&&t.nodeType==mxConstants.NODETYPE_ELEMENT?t.getAttribute(e):null)||n},mxCell.prototype.setAttribute=function(e,n){var t=this.getValue();null!=t&&t.nodeType==mxConstants.NODETYPE_ELEMENT&&t.setAttribute(e,n)},mxCell.prototype.clone=function(){var e=mxUtils.clone(this,this.mxTransient);return e.setValue(this.cloneValue()),e},mxCell.prototype.cloneValue=function(){var e=this.getValue();return null!=e&&("function"==typeof e.clone?e=e.clone():isNaN(e.nodeType)||(e=e.cloneNode(!0))),e},mxGeometry.prototype=new mxRectangle,mxGeometry.prototype.constructor=mxGeometry,mxGeometry.prototype.TRANSLATE_CONTROL_POINTS=!0,mxGeometry.prototype.alternateBounds=null,mxGeometry.prototype.sourcePoint=null,mxGeometry.prototype.targetPoint=null,mxGeometry.prototype.points=null,mxGeometry.prototype.offset=null,mxGeometry.prototype.relative=!1,mxGeometry.prototype.swap=function(){if(null!=this.alternateBounds){var e=new mxRectangle(this.x,this.y,this.width,this.height);this.x=this.alternateBounds.x,this.y=this.alternateBounds.y,this.width=this.alternateBounds.width,this.height=this.alternateBounds.height,this.alternateBounds=e}},mxGeometry.prototype.getTerminalPoint=function(e){return e?this.sourcePoint:this.targetPoint},mxGeometry.prototype.setTerminalPoint=function(e,n){return n?this.sourcePoint=e:this.targetPoint=e,e},mxGeometry.prototype.translate=function(e,n){if(this.clone(),this.relative||(this.x+=e,this.y+=n),null!=this.sourcePoint&&(this.sourcePoint.x+=e,this.sourcePoint.y+=n),null!=this.targetPoint&&(this.targetPoint.x+=e,this.targetPoint.y+=n),this.TRANSLATE_CONTROL_POINTS&&null!=this.points)for(var t=this.points.length,a=0;a<t;a++){var i=this.points[a];null!=i&&(i.x+=e,i.y+=n)}};var mxCellPath={PATH_SEPARATOR:".",create:function(e){var n="";if(null!=e)for(var t=e.getParent();null!=t;)n=t.getIndex(e)+mxCellPath.PATH_SEPARATOR+n,t=(e=t).getParent();return 1<(e=n.length)&&(n=n.substring(0,e-1)),n},getParentPath:function(e){if(null!=e){var n=e.lastIndexOf(mxCellPath.PATH_SEPARATOR);if(0<=n)return e.substring(0,n);if(0<e.length)return""}return null},resolve:function(e,n){var t=e;if(null!=n)for(var a=n.split(mxCellPath.PATH_SEPARATOR),i=0;i<a.length;i++)t=t.getChildAt(parseInt(a[i]));return t},compare:function(e,n){for(var t=Math.min(e.length,n.length),a=0,i=0;i<t;i++)if(e[i]!=n[i]){a=0==e[i].length||0==n[i].length?e[i]==n[i]?0:e[i]>n[i]?1:-1:(t=parseInt(e[i]))==(i=parseInt(n[i]))?0:i<t?1:-1;break}return 0==a&&((t=e.length)!=(i=n.length)&&(a=i<t?1:-1)),a}},mxPerimeter={RectanglePerimeter:function(e,n,t,a){n=e.getCenterX();var i=e.getCenterY(),s=Math.atan2(t.y-i,t.x-n),o=new mxPoint(0,0),r=Math.PI,l=Math.PI/2-s,d=Math.atan2(e.height,e.width);return s<-r+d||r-d<s?(o.x=e.x,o.y=i-e.width*Math.tan(s)/2):s<-d?(o.y=e.y,o.x=n-e.height*Math.tan(l)/2):s<d?(o.x=e.x+e.width,o.y=i+e.width*Math.tan(s)/2):(o.y=e.y+e.height,o.x=n+e.height*Math.tan(l)/2),a&&(t.x>=e.x&&t.x<=e.x+e.width?o.x=t.x:t.y>=e.y&&t.y<=e.y+e.height&&(o.y=t.y),t.x<e.x?o.x=e.x:t.x>e.x+e.width&&(o.x=e.x+e.width),t.y<e.y?o.y=e.y:t.y>e.y+e.height&&(o.y=e.y+e.height)),o},EllipsePerimeter:function(e,n,t,a){var i=e.x,s=e.y,o=e.width/2,r=e.height/2,l=i+o,d=s+r;n=t.x,t=t.y;var c=parseInt(n-l),m=parseInt(t-d);if(0==c&&0!=m)return new mxPoint(l,d+r*m/Math.abs(m));if(0==c&&0==m)return new mxPoint(n,t);if(a){if(s<=t&&t<=s+e.height)return e=t-d,e=Math.sqrt(o*o*(1-e*e/(r*r)))||0,n<=i&&(e=-e),new mxPoint(l+e,t);if(i<=n&&n<=i+e.width)return e=n-l,e=Math.sqrt(r*r*(1-e*e/(o*o)))||0,t<=s&&(e=-e),new mxPoint(n,d+e)}return d-=(i=m/c)*l,l=i*(o=(-(e=-2*l*(s=o*o*i*i+r*r))+(r=Math.sqrt(e*e-4*s*(o*o*i*i*l*l+r*r*l*l-o*o*r*r))))/(2*s))+d,d=i*(r=(-e-r)/(2*s))+d,i=Math.sqrt(Math.pow(o-n,2)+Math.pow(l-t,2)),n=Math.sqrt(Math.pow(r-n,2)+Math.pow(d-t,2)),s=t=0,s=i<n?(t=o,l):(t=r,d),new mxPoint(t,s)},RhombusPerimeter:function(e,n,t,a){n=e.x;var i=e.y,s=e.width,o=n+s/2,r=i+(e=e.height)/2,l=t.x;if(t=t.y,o==l)return new mxPoint(o,t<r?i:i+e);if(r==t)return new mxPoint(l<o?n:n+s,r);var d=o,c=r;return a&&(n<=l&&l<=n+s?d=l:i<=t&&t<=i+e&&(c=t)),l<o?t<r?mxUtils.intersection(l,t,d,c,o,i,n,r):mxUtils.intersection(l,t,d,c,o,i+e,n,r):t<r?mxUtils.intersection(l,t,d,c,o,i,n+s,r):mxUtils.intersection(l,t,d,c,o,i+e,n+s,r)},TrianglePerimeter:function(e,n,t,a){var i=(n=null!=n?n.style[mxConstants.STYLE_DIRECTION]:null)==mxConstants.DIRECTION_NORTH||n==mxConstants.DIRECTION_SOUTH,s=e.x,o=e.y,r=e.width,l=s+r/2,d=o+(e=e.height)/2,c=new mxPoint(s,o),m=new mxPoint(s+r,d),u=new mxPoint(s,o+e);n==mxConstants.DIRECTION_NORTH?(c=u,m=new mxPoint(l,o),u=new mxPoint(s+r,o+e)):n==mxConstants.DIRECTION_SOUTH?(m=new mxPoint(l,o+e),u=new mxPoint(s+r,o)):n==mxConstants.DIRECTION_WEST&&(c=new mxPoint(s+r,o),m=new mxPoint(s,d),u=new mxPoint(s+r,o+e));var p=t.x-l,g=t.y-d,v=(p=i?Math.atan2(p,g):Math.atan2(g,p),i?Math.atan2(r,e):Math.atan2(e,r));g=!1,g=n==mxConstants.DIRECTION_NORTH||n==mxConstants.DIRECTION_WEST?-v<p&&p<v:p<-Math.PI+v||p>Math.PI-v,v=null;return null==(v=g?a&&(i&&t.x>=c.x&&t.x<=u.x||!i&&t.y>=c.y&&t.y<=u.y)?i?new mxPoint(t.x,c.y):new mxPoint(c.x,t.y):n==mxConstants.DIRECTION_NORTH?new mxPoint(s+r/2+e*Math.tan(p)/2,o+e):n==mxConstants.DIRECTION_SOUTH?new mxPoint(s+r/2-e*Math.tan(p)/2,o):n==mxConstants.DIRECTION_WEST?new mxPoint(s+r,o+e/2+r*Math.tan(p)/2):new mxPoint(s,o+e/2-r*Math.tan(p)/2):(a&&(a=new mxPoint(l,d),t.y>=o&&t.y<=o+e?(a.x=i?l:n==mxConstants.DIRECTION_WEST?s+r:s,a.y=t.y):t.x>=s&&t.x<=s+r&&(a.x=t.x,a.y=i?n==mxConstants.DIRECTION_NORTH?o+e:o:d),l=a.x,d=a.y),i&&t.x<=s+r/2||!i&&t.y<=o+e/2?mxUtils.intersection(t.x,t.y,l,d,c.x,c.y,m.x,m.y):mxUtils.intersection(t.x,t.y,l,d,m.x,m.y,u.x,u.y)))&&(v=new mxPoint(l,d)),v}};function mxPrintPreview(e,n,t,a,i,s,o,r,l){this.graph=e,this.scale=null!=n?n:1/e.pageScale,this.border=null!=a?a:0,this.pageFormat=null!=t?t:e.pageFormat,this.title=null!=r?r:"Printer-friendly version",this.x0=null!=i?i:0,this.y0=null!=s?s:0,this.borderColor=o,this.pageSelector=null==l||l}function mxStylesheet(){this.styles={},this.putDefaultVertexStyle(this.createDefaultVertexStyle()),this.putDefaultEdgeStyle(this.createDefaultEdgeStyle())}function mxCellState(e,n,t){this.view=e,this.cell=n,this.style=t,this.origin=new mxPoint,this.absoluteOffset=new mxPoint}function mxGraphSelectionModel(e){this.graph=e,this.cells=[]}function mxSelectionChange(e,n,t){this.selectionModel=e,this.added=null!=n?n.slice():null,this.removed=null!=t?t.slice():null}function mxCellEditor(e){this.graph=e}function mxCellRenderer(){}mxPrintPreview.prototype.graph=null,mxPrintPreview.prototype.pageFormat=null,mxPrintPreview.prototype.scale=null,mxPrintPreview.prototype.border=0,mxPrintPreview.prototype.x0=0,mxPrintPreview.prototype.y0=0,mxPrintPreview.prototype.autoOrigin=!0,mxPrintPreview.prototype.printOverlays=!1,mxPrintPreview.prototype.borderColor=null,mxPrintPreview.prototype.title=null,mxPrintPreview.prototype.pageSelector=null,mxPrintPreview.prototype.wnd=null,mxPrintPreview.prototype.pageCount=0,mxPrintPreview.prototype.getWindow=function(){return this.wnd},mxPrintPreview.prototype.getDoctype=function(){var e="";return 8==document.documentMode&&(e='<meta http-equiv="X-UA-Compatible" content="IE=8">'),e},mxPrintPreview.prototype.open=function(e){var n=this.graph.cellRenderer.initializeOverlay,t=null;try{if(this.printOverlays&&(this.graph.cellRenderer.initializeOverlay=function(e,n){n.init(e.view.getDrawPane())}),null==this.wnd){this.wnd=window.open();var a=this.wnd.document,i=this.getDoctype();null!=i&&0<i.length&&a.writeln(i),a.writeln("<html>"),a.writeln("<head>"),this.writeHead(a,e),a.writeln("</head>"),a.writeln('<body class="mxPage">'),mxClient.link("stylesheet",mxClient.basePath+"/css/common.css",a),mxClient.IS_VML&&(a.namespaces.add("v","urn:schemas-microsoft-com:vml"),a.namespaces.add("o","urn:schemas-microsoft-com:office:office"),a.createStyleSheet().cssText="v\\:*{behavior:url(#default#VML)}o\\:*{behavior:url(#default#VML)}",mxClient.link("stylesheet",mxClient.basePath+"/css/explorer.css",a));var s=this.graph.getGraphBounds().clone(),o=this.graph.getView().getScale(),r=o/this.scale,l=this.graph.getView().getTranslate();this.autoOrigin||(this.x0=-l.x*this.scale,this.y0=-l.y*this.scale,s.width+=s.x,s.height+=s.y,s.x=0,this.border=s.y=0),s.width/=r,s.height/=r;var d=this.pageFormat.width-2*this.border,c=this.pageFormat.height-2*this.border,m=Math.max(1,Math.ceil((s.width+this.x0)/d)),u=Math.max(1,Math.ceil((s.height+this.y0)/c));this.pageCount=m*u;var p=mxUtils.bind(this,function(){if(this.pageSelector&&(1<u||1<m)){var e=this.createPageSelector(u,m);if(a.body.appendChild(e),mxClient.IS_IE){e.style.position="absolute";var n=function(){e.style.top=a.body.scrollTop+10+"px"};mxEvent.addListener(this.wnd,"scroll",function(e){n()}),mxEvent.addListener(this.wnd,"resize",function(e){n()})}}});if(e=function(e,n){if(null!=this.borderColor&&(e.style.borderColor=this.borderColor,e.style.borderStyle="solid",e.style.borderWidth="1px"),e.style.background="white",n&&(e.style.pageBreakAfter="always"),mxClient.IS_IE?(a.writeln(e.outerHTML),e.parentNode.removeChild(e)):(e.parentNode.removeChild(e),a.body.appendChild(e)),n){var t=a.createElement("hr");t.className="mxPageBreak",a.body.appendChild(t)}},null!=(f=this.getCoverPages(this.pageFormat.width,this.pageFormat.height)))for(var g=0;g<f.length;g++)e(f[g],!0);var v=this.getAppendices(this.pageFormat.width,this.pageFormat.height);for(g=0;g<u;g++)for(var h=g*c/this.scale-this.y0/this.scale+(s.y-l.y*o)/o,f=0;f<m;f++){if(null==this.wnd)return null;var b=f*d/this.scale-this.x0/this.scale+(s.x-l.x*o)/o,A=g*m+f+1;(t=this.renderPage(this.pageFormat.width,this.pageFormat.height,mxUtils.bind(this,function(e){this.addGraphFragment(-b,-h,this.scale,A,e)}))).setAttribute("id","mxPage-"+A),e(t,null!=v||g<u-1||f<m-1)}if(null!=v)for(g=0;g<v.length;g++)e(v[g],g<v.length);a.writeln("</body>"),a.writeln("</html>"),a.close(),p(),mxEvent.release(a.body)}this.wnd.focus()}catch(e){null!=t&&null!=t.parentNode&&t.parentNode.removeChild(t)}finally{this.graph.cellRenderer.initializeOverlay=n}return this.wnd},mxPrintPreview.prototype.writeHead=function(e,n){null!=this.title&&e.writeln("<title>"+this.title+"</title>"),e.writeln('<style type="text/css">'),e.writeln("@media print {"),e.writeln("  table.mxPageSelector { display: none; }"),e.writeln("  hr.mxPageBreak { display: none; }"),e.writeln("}"),e.writeln("@media screen {"),e.writeln("  table.mxPageSelector { position: fixed; right: 10px; top: 10px;font-family: Arial; font-size:10pt; border: solid 1px darkgray;background: white; border-collapse:collapse; }"),e.writeln("  table.mxPageSelector td { border: solid 1px gray; padding:4px; }"),e.writeln("  body.mxPage { background: gray; }"),e.writeln("}"),null!=n&&e.writeln(n),e.writeln("</style>")},mxPrintPreview.prototype.createPageSelector=function(e,n){var t=this.wnd.document,a=t.createElement("table");a.className="mxPageSelector",a.setAttribute("border","0");for(var i=t.createElement("tbody"),s=0;s<e;s++){for(var o=t.createElement("tr"),r=0;r<n;r++){var l=s*n+r+1,d=t.createElement("td");if(!mxClient.IS_NS||mxClient.IS_SF||mxClient.IS_GC){var c=t.createElement("a");c.setAttribute("href","#mxPage-"+l),mxUtils.write(c,l,t),d.appendChild(c)}else mxUtils.write(d,l,t);o.appendChild(d)}i.appendChild(o)}return a.appendChild(i),a},mxPrintPreview.prototype.renderPage=function(e,n,t){var a=document.createElement("div");try{a.style.width=e+"px",a.style.height=n+"px",a.style.overflow="hidden",a.style.pageBreakInside="avoid",a.style.position="relative";var i=document.createElement("div");i.style.top=this.border+"px",i.style.left=this.border+"px",i.style.width=e-2*this.border+"px",i.style.height=n-2*this.border+"px",i.style.overflow="hidden",this.graph.dialect==mxConstants.DIALECT_VML&&(i.style.position="absolute"),a.appendChild(i),document.body.appendChild(a),t(i)}catch(e){throw a.parentNode.removeChild(a),e}return a},mxPrintPreview.prototype.addGraphFragment=function(e,n,t,a,i){a=this.graph.getView();var s=this.graph.container;this.graph.container=i;var o=a.getCanvas(),r=a.getBackgroundPane(),l=a.getDrawPane(),d=a.getOverlayPane();this.graph.dialect==mxConstants.DIALECT_SVG?a.createSvg():this.graph.dialect==mxConstants.DIALECT_VML?a.createVml():a.createHtml();var c=a.isEventsEnabled();a.setEventsEnabled(!1);var m=this.graph.isEnabled();this.graph.setEnabled(!1);var u=a.getTranslate();a.translate=new mxPoint(e,n),e=null;try{var p=[this.graph.getModel().getRoot()];e=new mxTemporaryCellStates(a,t,p)}finally{if(mxClient.IS_IE)a.overlayPane.innerHTML="";else for(t=i.firstChild;null!=t;)p=t.nextSibling,"svg"==(n=t.nodeName.toLowerCase())?(t.setAttribute("width",parseInt(i.style.width)),t.setAttribute("height",parseInt(i.style.height))):"default"!=t.style.cursor&&"table"!=n&&t.parentNode.removeChild(t),t=p;a.overlayPane.parentNode.removeChild(a.overlayPane),this.graph.setEnabled(m),this.graph.container=s,a.canvas=o,a.backgroundPane=r,a.drawPane=l,a.overlayPane=d,a.translate=u,e.destroy(),a.setEventsEnabled(c)}},mxPrintPreview.prototype.getCoverPages=function(){return null},mxPrintPreview.prototype.getAppendices=function(){return null},mxPrintPreview.prototype.print=function(){var e=this.open();null!=e&&e.print()},mxPrintPreview.prototype.close=function(){null!=this.wnd&&(this.wnd.close(),this.wnd=null)},mxStylesheet.prototype.createDefaultVertexStyle=function(){var e={};return e[mxConstants.STYLE_SHAPE]=mxConstants.SHAPE_RECTANGLE,e[mxConstants.STYLE_PERIMETER]=mxPerimeter.RectanglePerimeter,e[mxConstants.STYLE_VERTICAL_ALIGN]=mxConstants.ALIGN_MIDDLE,e[mxConstants.STYLE_ALIGN]=mxConstants.ALIGN_CENTER,e[mxConstants.STYLE_FILLCOLOR]="#C3D9FF",e[mxConstants.STYLE_STROKECOLOR]="#6482B9",e[mxConstants.STYLE_FONTCOLOR]="#774400",e},mxStylesheet.prototype.createDefaultEdgeStyle=function(){var e={};return e[mxConstants.STYLE_SHAPE]=mxConstants.SHAPE_CONNECTOR,e[mxConstants.STYLE_ENDARROW]=mxConstants.ARROW_CLASSIC,e[mxConstants.STYLE_VERTICAL_ALIGN]=mxConstants.ALIGN_MIDDLE,e[mxConstants.STYLE_ALIGN]=mxConstants.ALIGN_CENTER,e[mxConstants.STYLE_STROKECOLOR]="#6482B9",e[mxConstants.STYLE_FONTCOLOR]="#446299",e},mxStylesheet.prototype.putDefaultVertexStyle=function(e){this.putCellStyle("defaultVertex",e)},mxStylesheet.prototype.putDefaultEdgeStyle=function(e){this.putCellStyle("defaultEdge",e)},mxStylesheet.prototype.getDefaultVertexStyle=function(){return this.styles.defaultVertex},mxStylesheet.prototype.getDefaultEdgeStyle=function(){return this.styles.defaultEdge},mxStylesheet.prototype.putCellStyle=function(e,n){this.styles[e]=n},mxStylesheet.prototype.getCellStyle=function(e,n){var t=n;if(null!=e&&0<e.length)for(var a=e.split(";"),i=(t=null!=t&&";"!=e.charAt(0)?mxUtils.clone(t):{},0);i<a.length;i++){var s=(o=a[i]).indexOf("=");if(0<=s){var o,r=o.substring(0,s);(o=o.substring(s+1))==mxConstants.NONE?delete t[r]:mxUtils.isNumeric(o)?t[r]=parseFloat(o):t[r]=o}else if(null!=(o=this.styles[o]))for(r in o)t[r]=o[r]}return t},mxCellState.prototype=new mxRectangle,mxCellState.prototype.constructor=mxCellState,mxCellState.prototype.view=null,mxCellState.prototype.cell=null,mxCellState.prototype.style=null,mxCellState.prototype.invalid=!0,mxCellState.prototype.invalidOrder=!1,mxCellState.prototype.orderChanged=!1,mxCellState.prototype.origin=null,mxCellState.prototype.absolutePoints=null,mxCellState.prototype.absoluteOffset=null,mxCellState.prototype.visibleSourceState=null,mxCellState.prototype.visibleTargetState=null,mxCellState.prototype.terminalDistance=0,mxCellState.prototype.length=0,mxCellState.prototype.segments=null,mxCellState.prototype.shape=null,mxCellState.prototype.text=null,mxCellState.prototype.getPerimeterBounds=function(e,n){if(e=e||0,n=null!=n?n:new mxRectangle(this.x,this.y,this.width,this.height),null!=this.shape&&null!=this.shape.stencil){var t=this.shape.stencil.computeAspect(this.style,n.x,n.y,n.width,n.height);n.x=t.x,n.y=t.y,n.width=this.shape.stencil.w0*t.width,n.height=this.shape.stencil.h0*t.height}return 0!=e&&n.grow(e),n},mxCellState.prototype.setAbsoluteTerminalPoint=function(e,n){n?(null==this.absolutePoints&&(this.absolutePoints=[]),0==this.absolutePoints.length?this.absolutePoints.push(e):this.absolutePoints[0]=e):null==this.absolutePoints?(this.absolutePoints=[],this.absolutePoints.push(null),this.absolutePoints.push(e)):1==this.absolutePoints.length?this.absolutePoints.push(e):this.absolutePoints[this.absolutePoints.length-1]=e},mxCellState.prototype.setCursor=function(e){null!=this.shape&&this.shape.setCursor(e),null!=this.text&&this.text.setCursor(e)},mxCellState.prototype.getVisibleTerminal=function(e){return null!=(e=this.getVisibleTerminalState(e))?e.cell:null},mxCellState.prototype.getVisibleTerminalState=function(e){return e?this.visibleSourceState:this.visibleTargetState},mxCellState.prototype.setVisibleTerminalState=function(e,n){n?this.visibleSourceState=e:this.visibleTargetState=e},mxCellState.prototype.destroy=function(){this.view.graph.cellRenderer.destroy(this)},mxCellState.prototype.clone=function(){var e=new mxCellState(this.view,this.cell,this.style);if(null!=this.absolutePoints){e.absolutePoints=[];for(var n=0;n<this.absolutePoints.length;n++)e.absolutePoints[n]=this.absolutePoints[n].clone()}return null!=this.origin&&(e.origin=this.origin.clone()),null!=this.absoluteOffset&&(e.absoluteOffset=this.absoluteOffset.clone()),null!=this.boundingBox&&(e.boundingBox=this.boundingBox.clone()),e.terminalDistance=this.terminalDistance,e.segments=this.segments,e.length=this.length,e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e},mxGraphSelectionModel.prototype=new mxEventSource,mxGraphSelectionModel.prototype.constructor=mxGraphSelectionModel,mxGraphSelectionModel.prototype.doneResource="none"!=mxClient.language?"done":"",mxGraphSelectionModel.prototype.updatingSelectionResource="none"!=mxClient.language?"updatingSelection":"",mxGraphSelectionModel.prototype.graph=null,mxGraphSelectionModel.prototype.singleSelection=!1,mxGraphSelectionModel.prototype.isSingleSelection=function(){return this.singleSelection},mxGraphSelectionModel.prototype.setSingleSelection=function(e){this.singleSelection=e},mxGraphSelectionModel.prototype.isSelected=function(e){return null!=e&&0<=mxUtils.indexOf(this.cells,e)},mxGraphSelectionModel.prototype.isEmpty=function(){return 0==this.cells.length},mxGraphSelectionModel.prototype.clear=function(){this.changeSelection(null,this.cells)},mxGraphSelectionModel.prototype.setCell=function(e){null!=e&&this.setCells([e])},mxGraphSelectionModel.prototype.setCells=function(e){if(null!=e){this.singleSelection&&(e=[this.getFirstSelectableCell(e)]);for(var n=[],t=0;t<e.length;t++)this.graph.isCellSelectable(e[t])&&n.push(e[t]);this.changeSelection(n,this.cells)}},mxGraphSelectionModel.prototype.getFirstSelectableCell=function(e){if(null!=e)for(var n=0;n<e.length;n++)if(this.graph.isCellSelectable(e[n]))return e[n];return null},mxGraphSelectionModel.prototype.addCell=function(e){null!=e&&this.addCells([e])},mxGraphSelectionModel.prototype.addCells=function(e){if(null!=e){var n=null;this.singleSelection&&(n=this.cells,e=[this.getFirstSelectableCell(e)]);for(var t=[],a=0;a<e.length;a++)!this.isSelected(e[a])&&this.graph.isCellSelectable(e[a])&&t.push(e[a]);this.changeSelection(t,n)}},mxGraphSelectionModel.prototype.removeCell=function(e){null!=e&&this.removeCells([e])},mxGraphSelectionModel.prototype.removeCells=function(e){if(null!=e){for(var n=[],t=0;t<e.length;t++)this.isSelected(e[t])&&n.push(e[t]);this.changeSelection(null,n)}},mxGraphSelectionModel.prototype.changeSelection=function(e,n){if(null!=e&&0<e.length&&null!=e[0]||null!=n&&0<n.length&&null!=n[0]){var t=new mxSelectionChange(this,e,n);t.execute();var a=new mxUndoableEdit(this,!1);a.add(t),this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",a))}},mxGraphSelectionModel.prototype.cellAdded=function(e){null!=e&&!this.isSelected(e)&&this.cells.push(e)},mxGraphSelectionModel.prototype.cellRemoved=function(e){null!=e&&(0<=(e=mxUtils.indexOf(this.cells,e))&&this.cells.splice(e,1))},mxSelectionChange.prototype.execute=function(){var e=mxLog.enter("mxSelectionChange.execute");if(window.status=mxResources.get(this.selectionModel.updatingSelectionResource)||this.selectionModel.updatingSelectionResource,null!=this.removed)for(var n=0;n<this.removed.length;n++)this.selectionModel.cellRemoved(this.removed[n]);if(null!=this.added)for(n=0;n<this.added.length;n++)this.selectionModel.cellAdded(this.added[n]);n=this.added,this.added=this.removed,this.removed=n,window.status=mxResources.get(this.selectionModel.doneResource)||this.selectionModel.doneResource,mxLog.leave("mxSelectionChange.execute",e),this.selectionModel.fireEvent(new mxEventObject(mxEvent.CHANGE,"added",this.added,"removed",this.removed))},mxCellEditor.prototype.graph=null,mxCellEditor.prototype.textarea=null,mxCellEditor.prototype.editingCell=null,mxCellEditor.prototype.trigger=null,mxCellEditor.prototype.modified=!1,mxCellEditor.prototype.autoSize=!0,mxCellEditor.prototype.emptyLabelText="",mxCellEditor.prototype.textNode="",mxCellEditor.prototype.init=function(){this.textarea=document.createElement("textarea"),this.textarea.className="mxCellEditor",this.textarea.style.position="absolute",this.textarea.style.overflow="visible",this.textarea.setAttribute("cols","20"),this.textarea.setAttribute("rows","4"),mxClient.IS_NS&&(this.textarea.style.resize="none"),mxEvent.addListener(this.textarea,"blur",mxUtils.bind(this,function(e){this.focusLost()})),mxEvent.addListener(this.textarea,"keydown",mxUtils.bind(this,function(e){mxEvent.isConsumed(e)||(113==e.keyCode||this.graph.isEnterStopsCellEditing()&&13==e.keyCode&&!mxEvent.isControlDown(e)&&!mxEvent.isShiftDown(e)?(this.graph.stopEditing(!1),mxEvent.consume(e)):27==e.keyCode?(this.graph.stopEditing(!0),mxEvent.consume(e)):(this.clearOnChange&&(this.clearOnChange=!1,this.textarea.value=""),this.setModified(!0)))})),mxEvent.addListener(this.textarea,"keypress",mxUtils.bind(this,function(e){this.autoSize&&!mxEvent.isConsumed(e)&&setTimeout(mxUtils.bind(this,function(){this.resize()}),0)}))},mxCellEditor.prototype.resize=function(){if(null!=this.textDiv){var e=this.graph.getView().getState(this.editingCell),n=this.graph.isLabelClipped(e.cell),t=this.graph.isWrapping(e.cell);if(this.graph.getModel().isEdge(e.cell))this.bounds.x=e.absoluteOffset.x,this.bounds.y=e.absoluteOffset.y,this.bounds.width=0,this.bounds.height=0;else if(null!=this.bounds){this.bounds.x=e.x,this.bounds.y=e.y,this.bounds.width=e.width,this.bounds.height=e.height,(a=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER))==mxConstants.ALIGN_LEFT?this.bounds.x-=e.width:a==mxConstants.ALIGN_RIGHT&&(this.bounds.x+=e.width),(a=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?this.bounds.y-=e.height:a==mxConstants.ALIGN_BOTTOM&&(this.bounds.y+=e.height)}"\n"!=(a=this.textarea.value).charAt(a.length-1)&&""!=a||(a+="&nbsp;"),a=mxUtils.htmlEntities(a,!1),t?(this.textDiv.style.whiteSpace="normal",this.textDiv.style.width=this.bounds.width+"px"):a=a.replace(/ /g,"&nbsp;"),a=a.replace(/\n/g,"<br/>"),this.textDiv.innerHTML=a;var a=this.textDiv.offsetWidth+30,i=this.textDiv.offsetHeight+16;a=Math.max(a,40),i=Math.max(i,20);n&&(a=Math.min(this.bounds.width-4,a),i=Math.min(this.bounds.height,i));var s=null!=e.text?e.text.margin:null;null==s&&(s=mxUtils.getValue(e.style,mxConstants.STYLE_ALIGN,mxConstants.ALIGN_CENTER),e=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE),s=mxUtils.getAlignmentAsPoint(s,e)),null!=s&&(!n&&t||(this.textarea.style.left=Math.max(0,Math.round(this.bounds.x-s.x*this.bounds.width+s.x*a)-3)+"px"),this.textarea.style.top=Math.max(0,Math.round(this.bounds.y-s.y*this.bounds.height+s.y*i)+4)+"px"),!n&&t||(this.textarea.style.width=a+"px"),this.textarea.style.height=i+"px"}},mxCellEditor.prototype.isModified=function(){return this.modified},mxCellEditor.prototype.setModified=function(e){this.modified=e},mxCellEditor.prototype.focusLost=function(){this.stopEditing(!this.graph.isInvokesStopCellEditing())},mxCellEditor.prototype.startEditing=function(e,n){null==this.textarea&&this.init(),this.stopEditing(!0);var t=this.graph.getView().getState(e);if(null!=t){this.editingCell=e,this.trigger=n,(this.textNode=null)!=t.text&&this.isHideLabel(t)&&(this.textNode=t.text.node,this.textNode.style.visibility="hidden");var a=this.graph.getView().scale,i=(a=mxUtils.getValue(t.style,mxConstants.STYLE_FONTSIZE,mxConstants.DEFAULT_FONTSIZE)*a,mxUtils.getValue(t.style,mxConstants.STYLE_FONTFAMILY,mxConstants.DEFAULT_FONTFAMILY)),s=mxUtils.getValue(t.style,mxConstants.STYLE_FONTCOLOR,"black"),o=mxUtils.getValue(t.style,mxConstants.STYLE_ALIGN,mxConstants.ALIGN_LEFT),r=(mxUtils.getValue(t.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD,l=(mxUtils.getValue(t.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC,d=(mxUtils.getValue(t.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE;this.textarea.style.fontSize=Math.round(a)+"px",this.textarea.style.lineHeight=Math.round(a*mxConstants.LINE_HEIGHT)+"px",this.textarea.style.fontFamily=i,this.textarea.style.textAlign=o,this.textarea.style.color=s,this.textarea.style.fontWeight=r?"bold":"normal",this.textarea.style.fontStyle=l?"italic":"",this.textarea.style.textDecoration=d?"underline":"",this.textarea.style.overflow="auto",this.textarea.style.outline="none",this.bounds=a=this.getEditorBounds(t),this.textarea.style.left=a.x+"px",this.textarea.style.top=a.y+"px",this.textarea.style.width=a.width+"px",this.textarea.style.height=a.height+"px",this.textarea.style.zIndex=5,null==(t=this.getInitialValue(t,n))||0==t.length?(t=this.getEmptyLabelText(),this.clearOnChange=!0):this.clearOnChange=!1,this.setModified(!1),this.textarea.value=t,this.graph.container.appendChild(this.textarea),"none"!=this.textarea.style.display&&(this.autoSize&&(this.textDiv=this.createTextDiv(),document.body.appendChild(this.textDiv),this.resize()),this.textarea.focus(),this.textarea.select())}},mxCellEditor.prototype.createTextDiv=function(){var e=document.createElement("div"),n=e.style;return n.position="absolute",n.whiteSpace="nowrap",n.visibility="hidden",n.display=mxClient.IS_QUIRKS?"inline":"inline-block",n.zoom="1",n.verticalAlign="top",n.lineHeight=this.textarea.style.lineHeight,n.fontSize=this.textarea.style.fontSize,n.fontFamily=this.textarea.style.fontFamily,n.fontWeight=this.textarea.style.fontWeight,n.textAlign=this.textarea.style.textAlign,n.fontStyle=this.textarea.style.fontStyle,n.textDecoration=this.textarea.style.textDecoration,e},mxCellEditor.prototype.stopEditing=function(e){null!=this.editingCell&&(null!=this.textNode&&(this.textNode.style.visibility="visible",this.textNode=null),!e&&this.isModified()&&this.graph.labelChanged(this.editingCell,this.getCurrentValue(),this.trigger),null!=this.textDiv&&(document.body.removeChild(this.textDiv),this.textDiv=null),this.bounds=this.trigger=this.editingCell=null,this.textarea.blur(),this.textarea.parentNode.removeChild(this.textarea))},mxCellEditor.prototype.getInitialValue=function(e,n){return this.graph.getEditingValue(e.cell,n)},mxCellEditor.prototype.getCurrentValue=function(){return this.textarea.value.replace(/\r/g,"")},mxCellEditor.prototype.isHideLabel=function(e){return!0},mxCellEditor.prototype.getMinimumSize=function(e){var n=this.graph.getView().scale;return new mxRectangle(0,0,null==e.text?30:e.text.size*n+20,"left"==this.textarea.style.textAlign?120:40)},mxCellEditor.prototype.getEditorBounds=function(e){var n=this.graph.getModel().isEdge(e.cell),t=this.graph.getView().scale,a=(i=this.getMinimumSize(e)).width,i=i.height,s=parseInt(e.style[mxConstants.STYLE_SPACING]||2)*t,o=parseInt(e.style[mxConstants.STYLE_SPACING_TOP]||0)*t+s,r=parseInt(e.style[mxConstants.STYLE_SPACING_RIGHT]||0)*t+s,l=parseInt(e.style[mxConstants.STYLE_SPACING_BOTTOM]||0)*t+s;t=parseInt(e.style[mxConstants.STYLE_SPACING_LEFT]||0)*t+s,r=new mxRectangle(e.x,e.y,Math.max(a,e.width-t-r),Math.max(i,e.height-o-l));return n?(r.x=e.absoluteOffset.x,r.y=e.absoluteOffset.y,null!=e.text&&null!=e.text.boundingBox&&(0<e.text.boundingBox.x&&(r.x=e.text.boundingBox.x),0<e.text.boundingBox.y&&(r.y=e.text.boundingBox.y))):null!=e.text&&null!=e.text.boundingBox&&(r.x=Math.min(r.x,e.text.boundingBox.x),r.y=Math.min(r.y,e.text.boundingBox.y)),r.x+=t,r.y+=o,null!=e.text&&null!=e.text.boundingBox&&(n?(r.width=Math.max(a,e.text.boundingBox.width),r.height=Math.max(i,e.text.boundingBox.height)):(r.width=Math.max(r.width,e.text.boundingBox.width),r.height=Math.max(r.height,e.text.boundingBox.height))),this.graph.getModel().isVertex(e.cell)&&((n=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER))==mxConstants.ALIGN_LEFT?r.x-=e.width:n==mxConstants.ALIGN_RIGHT&&(r.x+=e.width),(n=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?r.y-=e.height:n==mxConstants.ALIGN_BOTTOM&&(r.y+=e.height)),r},mxCellEditor.prototype.getEmptyLabelText=function(e){return this.emptyLabelText},mxCellEditor.prototype.getEditingCell=function(){return this.editingCell},mxCellEditor.prototype.destroy=function(){null!=this.textarea&&(mxEvent.release(this.textarea),null!=this.textarea.parentNode&&this.textarea.parentNode.removeChild(this.textarea),this.textarea=null)},mxCellRenderer.prototype.defaultEdgeShape=mxConnector,mxCellRenderer.prototype.defaultVertexShape=mxRectangleShape,mxCellRenderer.prototype.defaultTextShape=mxText,mxCellRenderer.prototype.legacyControlPosition=!0,mxCellRenderer.prototype.defaultShapes={},mxCellRenderer.registerShape=function(e,n){mxCellRenderer.prototype.defaultShapes[e]=n},mxCellRenderer.registerShape(mxConstants.SHAPE_RECTANGLE,mxRectangleShape),mxCellRenderer.registerShape(mxConstants.SHAPE_ELLIPSE,mxEllipse),mxCellRenderer.registerShape(mxConstants.SHAPE_RHOMBUS,mxRhombus),mxCellRenderer.registerShape(mxConstants.SHAPE_CYLINDER,mxCylinder),mxCellRenderer.registerShape(mxConstants.SHAPE_CONNECTOR,mxConnector),mxCellRenderer.registerShape(mxConstants.SHAPE_ACTOR,mxActor),mxCellRenderer.registerShape(mxConstants.SHAPE_TRIANGLE,mxTriangle),mxCellRenderer.registerShape(mxConstants.SHAPE_HEXAGON,mxHexagon),mxCellRenderer.registerShape(mxConstants.SHAPE_CLOUD,mxCloud),mxCellRenderer.registerShape(mxConstants.SHAPE_LINE,mxLine),mxCellRenderer.registerShape(mxConstants.SHAPE_ARROW,mxArrow),mxCellRenderer.registerShape(mxConstants.SHAPE_DOUBLE_ELLIPSE,mxDoubleEllipse),mxCellRenderer.registerShape(mxConstants.SHAPE_SWIMLANE,mxSwimlane),mxCellRenderer.registerShape(mxConstants.SHAPE_IMAGE,mxImageShape),mxCellRenderer.registerShape(mxConstants.SHAPE_LABEL,mxLabel),mxCellRenderer.prototype.initialize=function(e,n){var t=e.view.graph.getModel();null!=e.view.graph.container&&null==e.shape&&e.cell!=e.view.currentRoot&&(t.isVertex(e.cell)||t.isEdge(e.cell))&&(this.createShape(e),null==e.shape||null!=n&&!n||(this.initializeShape(e),e.view.graph.ordered||t.isEdge(e.cell)?e.invalidOrder=!0:e.view.graph.keepEdgesInForeground&&null!=this.firstEdge&&(this.firstEdge.parentNode==e.shape.node.parentNode?this.insertState(e,this.firstEdge):this.firstEdge=null),e.shape.scale=e.view.scale,this.createCellOverlays(e),this.installListeners(e)))},mxCellRenderer.prototype.initializeShape=function(e){e.shape.init(e.view.getDrawPane())},mxCellRenderer.prototype.getPreviousStateInContainer=function(e,n){for(var t=null,a=e.view.graph,i=a.getModel(),s=e.cell,o=i.getParent(s);null!=o&&null==t;)t=this.findPreviousStateInContainer(a,o,s,n),s=o,o=i.getParent(s);return t},mxCellRenderer.prototype.findPreviousStateInContainer=function(e,n,t,a){var i=null,s=e.getModel();for(t=null!=t?n.getIndex(t)-1:s.getChildCount(n)-1;0<=t&&null==i;t--)i=this.findPreviousStateInContainer(e,s.getChildAt(n,t),null,a);return null!=i||(null==(i=e.view.getState(n))||null!=i.shape&&null!=i.shape.node&&i.shape.node.parentNode==a)||(i=null),i},mxCellRenderer.prototype.order=function(e){var n=e.shape.node.parentNode,t=this.getPreviousStateInContainer(e,n),a=n.firstChild;null!=t&&(a=t.shape.node,null!=t.text&&null!=t.text.node&&t.text.node.parentNode==n&&(a=t.text.node),a=a.nextSibling),this.insertState(e,a)},mxCellRenderer.prototype.orderEdge=function(e){var n=(t=e.view).graph.getModel();if(t.graph.keepEdgesInForeground)null!=this.firstEdge&&null!=this.firstEdge.parentNode&&this.firstEdge.parentNode==e.shape.node.parentNode||(this.firstEdge=e.shape.node);else if(t.graph.keepEdgesInBackground){var t,a=e.shape.node,i=a.parentNode;n=n.getParent(e.cell);null!=(i=null!=(t=t.getState(n))&&null!=t.shape&&null!=t.shape.node?t.shape.node.nextSibling:i.firstChild)&&i!=a&&this.insertState(e,i)}},mxCellRenderer.prototype.insertState=function(e,n){e.shape.node.parentNode.insertBefore(e.shape.node,n),null!=e.text&&null!=e.text.node&&e.text.node.parentNode==e.shape.node.parentNode&&e.shape.node.parentNode.insertBefore(e.text.node,e.shape.node.nextSibling)},mxCellRenderer.prototype.createShape=function(e){if(null!=e.style){var n=mxStencilRegistry.getStencil(e.style[mxConstants.STYLE_SHAPE]);null!=n?e.shape=new mxShape(n):(n=this.getShapeConstructor(e),e.shape=new n),e.shape.points=e.absolutePoints,e.shape.bounds=new mxRectangle(e.x,e.y,e.width,e.height),e.shape.dialect=e.view.graph.dialect,this.configureShape(e)}},mxCellRenderer.prototype.getShape=function(e){return null!=e?mxCellRenderer.prototype.defaultShapes[e]:null},mxCellRenderer.prototype.getShapeConstructor=function(e){var n=this.getShape(e.style[mxConstants.STYLE_SHAPE]);return null==n&&(n=e.view.graph.getModel().isEdge(e.cell)?this.defaultEdgeShape:this.defaultVertexShape),n},mxCellRenderer.prototype.configureShape=function(e){e.shape.apply(e),e.shape.image=e.view.graph.getImage(e),e.shape.indicatorShape=this.getShape(e.view.graph.getIndicatorShape(e)),e.shape.indicatorColor=e.view.graph.getIndicatorColor(e),e.shape.indicatorGradientColor=e.view.graph.getIndicatorGradientColor(e),e.shape.indicatorDirection=e.style[mxConstants.STYLE_INDICATOR_DIRECTION],e.shape.indicatorImage=e.view.graph.getIndicatorImage(e),this.postConfigureShape(e)},mxCellRenderer.prototype.postConfigureShape=function(e){null!=e.shape&&(this.resolveColor(e,"indicatorColor",mxConstants.STYLE_FILLCOLOR),this.resolveColor(e,"indicatorGradientColor",mxConstants.STYLE_GRADIENTCOLOR),this.resolveColor(e,"fill",mxConstants.STYLE_FILLCOLOR),this.resolveColor(e,"stroke",mxConstants.STYLE_STROKECOLOR),this.resolveColor(e,"gradient",mxConstants.STYLE_GRADIENTCOLOR))},mxCellRenderer.prototype.resolveColor=function(e,n,t){var a=e.shape[n],i=e.view.graph,s=null;"inherit"==a?s=i.model.getParent(e.cell):"swimlane"==a?(s=null!=i.model.getTerminal(e.cell,!1)?i.model.getTerminal(e.cell,!1):e.cell,s=i.getSwimlane(s),t=i.swimlaneIndicatorColorAttribute):"indicated"==a&&(e.shape[n]=e.shape.indicatorColor),null!=s&&(a=i.getView().getState(s),(e.shape[n]=null)!=a&&(e.shape[n]=null!=a.shape&&"indicatorColor"!=n?a.shape[n]:a.style[t]))},mxCellRenderer.prototype.getLabelValue=function(e){return e.view.graph.getLabel(e.cell)},mxCellRenderer.prototype.createLabel=function(t,e){var a=t.view.graph;if(a.getModel().isEdge(t.cell),0<t.style[mxConstants.STYLE_FONTSIZE]||null==t.style[mxConstants.STYLE_FONTSIZE]){var n=a.isHtmlLabel(t.cell)||null!=e&&mxUtils.isNode(e);t.text=new this.defaultTextShape(e,new mxRectangle,t.style[mxConstants.STYLE_ALIGN]||mxConstants.ALIGN_CENTER,a.getVerticalAlign(t),t.style[mxConstants.STYLE_FONTCOLOR],t.style[mxConstants.STYLE_FONTFAMILY],t.style[mxConstants.STYLE_FONTSIZE],t.style[mxConstants.STYLE_FONTSTYLE],t.style[mxConstants.STYLE_SPACING],t.style[mxConstants.STYLE_SPACING_TOP],t.style[mxConstants.STYLE_SPACING_RIGHT],t.style[mxConstants.STYLE_SPACING_BOTTOM],t.style[mxConstants.STYLE_SPACING_LEFT],t.style[mxConstants.STYLE_HORIZONTAL],t.style[mxConstants.STYLE_LABEL_BACKGROUNDCOLOR],t.style[mxConstants.STYLE_LABEL_BORDERCOLOR],a.isWrapping(t.cell)&&a.isHtmlLabel(t.cell),a.isLabelClipped(t.cell),t.style[mxConstants.STYLE_OVERFLOW],t.style[mxConstants.STYLE_LABEL_PADDING]),t.text.opacity=mxUtils.getValue(t.style,mxConstants.STYLE_TEXT_OPACITY,100),t.text.dialect=n?mxConstants.DIALECT_STRICTHTML:t.view.graph.dialect,t.text.state=t,this.initializeLabel(t);var i=!1,s=function(e){var n=t;return(mxClient.IS_TOUCH||i)&&(n=mxEvent.getClientX(e),e=mxEvent.getClientY(e),e=mxUtils.convertPoint(a.container,n,e),n=a.view.getState(a.getCellAt(e.x,e.y))),n};mxEvent.addGestureListeners(t.text.node,mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&(a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,t)),i=a.dialect!=mxConstants.DIALECT_SVG&&"IMG"==mxEvent.getSource(e).nodeName)}),mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,s(e)))}),mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&(a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,s(e))),i=!1)})),mxEvent.addListener(t.text.node,"dblclick",mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&(a.dblClick(e,t.cell),mxEvent.consume(e))}))}},mxCellRenderer.prototype.initializeLabel=function(e){var n=e.view.graph;e.text.dialect!=mxConstants.DIALECT_SVG&&(mxClient.IS_SVG&&mxClient.NO_FO?e.text.init(n.container):mxUtils.isVml(e.view.getDrawPane())&&(null!=e.shape.label?e.text.init(e.shape.label):e.text.init(e.shape.node))),null==e.text.node&&(e.text.init(e.view.getDrawPane()),null!=e.shape&&null!=e.text&&e.shape.node.parentNode.insertBefore(e.text.node,e.shape.node.nextSibling))},mxCellRenderer.prototype.createCellOverlays=function(e){var n=e.view.graph.getCellOverlays(e.cell),t=null;if(null!=n){t=new mxDictionary;for(var a=0;a<n.length;a++){var i=null!=e.overlays?e.overlays.remove(n[a]):null;null==i&&((i=new mxImageShape(new mxRectangle,n[a].image.src)).dialect=e.view.graph.dialect,i.preserveImageAspect=!1,i.overlay=n[a],this.initializeOverlay(e,i),this.installCellOverlayListeners(e,n[a],i),null!=n[a].cursor&&(i.node.style.cursor=n[a].cursor)),t.put(n[a],i)}}null!=e.overlays&&e.overlays.visit(function(e,n){n.destroy()}),e.overlays=t},mxCellRenderer.prototype.initializeOverlay=function(e,n){n.init(e.view.getOverlayPane())},mxCellRenderer.prototype.installCellOverlayListeners=function(n,t,e){var a=n.view.graph;mxEvent.addListener(e.node,"click",function(e){a.isEditing()&&a.stopEditing(!a.isInvokesStopCellEditing()),t.fireEvent(new mxEventObject(mxEvent.CLICK,"event",e,"cell",n.cell))}),mxEvent.addGestureListeners(e.node,function(e){mxEvent.consume(e)},function(e){a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,n))}),mxClient.IS_TOUCH&&mxEvent.addListener(e.node,"touchend",function(e){t.fireEvent(new mxEventObject(mxEvent.CLICK,"event",e,"cell",n.cell))})},mxCellRenderer.prototype.createControl=function(t){var a=t.view.graph,e=a.getFoldingImage(t);if(a.foldingEnabled&&null!=e){if(null==t.control){var n=new mxRectangle(0,0,e.width,e.height);t.control=new mxImageShape(n,e.src),t.control.preserveImageAspect=!1,t.control.dialect=a.dialect,this.initControl(t,t.control,!0,function(e){if(a.isEnabled()){var n=!a.isCellCollapsed(t.cell);a.foldCells(n,!1,[t.cell]),mxEvent.consume(e)}})}}else null!=t.control&&(t.control.destroy(),t.control=null)},mxCellRenderer.prototype.initControl=function(n,e,t,a){var i=n.view.graph;return i.isHtmlLabel(n.cell)&&mxClient.NO_FO&&i.dialect==mxConstants.DIALECT_SVG?(e.dialect=mxConstants.DIALECT_PREFERHTML,e.init(i.container),e.node.style.zIndex=1):e.init(n.view.getOverlayPane()),e=e.innerNode||e.node,a&&(i.isEnabled()&&(e.style.cursor="pointer"),mxEvent.addListener(e,"click",a)),t&&mxEvent.addGestureListeners(e,function(e){i.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,n)),mxEvent.consume(e)},function(e){i.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,n))}),e},mxCellRenderer.prototype.isShapeEvent=function(e,n){return!0},mxCellRenderer.prototype.isLabelEvent=function(e,n){return!0},mxCellRenderer.prototype.installListeners=function(t){var a=t.view.graph,n=function(e){var n=t;return(a.dialect!=mxConstants.DIALECT_SVG&&"IMG"==mxEvent.getSource(e).nodeName||mxClient.IS_TOUCH)&&(n=mxEvent.getClientX(e),e=mxEvent.getClientY(e),e=mxUtils.convertPoint(a.container,n,e),n=a.view.getState(a.getCellAt(e.x,e.y))),n},i=!1;mxEvent.addListener(t.shape.node,"gesturestart",mxUtils.bind(this,function(e){a.lastTouchTime=0,i=!0,mxEvent.consume(e)})),mxEvent.addGestureListeners(t.shape.node,mxUtils.bind(this,function(e){this.isShapeEvent(t,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:t)):i&&mxEvent.consume(e)}),mxUtils.bind(this,function(e){this.isShapeEvent(t,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:n(e))):i&&mxEvent.consume(e)}),mxUtils.bind(this,function(e){this.isShapeEvent(t,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:n(e))):i&&mxEvent.consume(e)}));var s=mxClient.IS_TOUCH?"gestureend":"dblclick";mxEvent.addListener(t.shape.node,s,mxUtils.bind(this,function(e){i=!1,"gestureend"==s?(a.lastTouchTime=0,a.gestureEnabled&&(a.handleGesture(t,e),mxEvent.consume(e))):this.isShapeEvent(t,e)&&(a.dblClick(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:t.cell),mxEvent.consume(e))}))},mxCellRenderer.prototype.redrawLabel=function(e,n){var t=this.getLabelValue(e);if(null==e.text&&null!=t&&(mxUtils.isNode(t)||0<t.length)?this.createLabel(e,t):null==e.text||null!=t&&0!=t.length||(e.text.destroy(),e.text=null),null!=e.text){var a=(i=e.view.graph).isWrapping(e.cell),i=i.isLabelClipped(e.cell),s=this.getLabelBounds(e);!n&&e.text.value==t&&e.text.isWrapping==a&&e.text.isClipping==i&&e.text.scale==e.view.scale&&e.text.bounds.equals(s)||(e.text.value=t,e.text.bounds=s,e.text.scale=this.getTextScale(e),e.text.isWrapping=a,e.text.isClipping=i,e.text.redraw())}},mxCellRenderer.prototype.getTextScale=function(e){return e.view.scale},mxCellRenderer.prototype.getLabelBounds=function(e){var n=e.view.graph,t=e.view.scale,a=n.getModel().isEdge(e.cell),i=new mxRectangle(e.absoluteOffset.x,e.absoluteOffset.y);return e.text.updateMargin(),a?(a=e.text.getSpacing(),i.x+=a.x*t,i.y+=a.y*t,null!=(n=n.getCellGeometry(e.cell))&&(i.width=Math.max(0,e.text.margin.x*n.width*t-e.text.spacingLeft*t-e.text.spacingRight*t),i.height=Math.max(0,e.text.margin.y*n.height*t-e.text.spacingTop*t-e.text.spacingBottom*t))):(e.text.isPaintBoundsInverted()&&(a=i.x,i.x=i.y,i.y=a),i.x+=e.x,i.y+=e.y,i.width=Math.max(1,e.width),i.height=Math.max(1,e.height),n.isSwimlane(e.cell)&&(0<(n=n.getStartSize(e.cell)).width?(a=Math.min(i.width,n.width*t),e.shape.flipH&&(i.x+=i.width-a),i.width=a):0<n.height&&(a=Math.min(i.height,n.height*t),e.shape.flipV&&(i.y+=i.height-a),i.height=a)),this.rotateLabelBounds(e,i)),i},mxCellRenderer.prototype.rotateLabelBounds=function(e,n){if(e.text.isPaintBoundsInverted()){var t=(e.width-e.height)/2;n.x+=t,n.y-=t,t=n.width,n.width=n.height,n.height=t}if(n.x-=e.text.margin.x*n.width,n.y-=e.text.margin.y*n.height,"fill"!=e.style[mxConstants.STYLE_OVERFLOW]){t=e.view.scale;var a=e.text.getSpacing();n.x+=a.x*t,n.y+=a.y*t,n.width=Math.max(0,n.width-e.text.spacingLeft*t-e.text.spacingRight*t),n.height=Math.max(0,n.height-e.text.spacingTop*t-e.text.spacingBottom*t)}var i=e.text.getTextRotation();0!=i&&null!=e&&e.view.graph.model.isVertex(e.cell)&&(t=e.getCenterX(),a=e.getCenterY(),n.x!=t||n.y!=a)&&(i*=Math.PI/180,pt=mxUtils.getRotatedPoint(new mxPoint(n.x,n.y),Math.cos(i),Math.sin(i),new mxPoint(t,a)),n.x=pt.x,n.y=pt.y)},mxCellRenderer.prototype.redrawCellOverlays=function(s,o){if(this.createCellOverlays(s),null!=s.overlays){var r=mxUtils.mod(mxUtils.getValue(s.style,mxConstants.STYLE_ROTATION,0),90),e=mxUtils.toRadians(r),l=Math.cos(e),d=Math.sin(e);s.overlays.visit(function(e,n){var t=n.overlay.getBounds(s);if(!s.view.graph.getModel().isEdge(s.cell)&&null!=s.shape&&0!=r){var a=t.getCenterX(),i=t.getCenterY();a=(i=mxUtils.getRotatedPoint(new mxPoint(a,i),l,d,new mxPoint(s.getCenterX(),s.getCenterY()))).x,i=i.y;t.x=Math.round(a-t.width/2),t.y=Math.round(i-t.height/2)}!o&&null!=n.bounds&&n.scale==s.view.scale&&n.bounds.equals(t)||(n.bounds=t,n.scale=s.view.scale,n.redraw())})}},mxCellRenderer.prototype.redrawControl=function(e,n){if(null!=e.control){var t=this.getControlBounds(e),a=this.legacyControlPosition?mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION,0):e.shape.getTextRotation(),i=e.view.scale;!n&&e.control.scale==i&&e.control.bounds.equals(t)&&e.control.rotation==a||(e.control.rotation=a,e.control.bounds=t,e.control.scale=i,e.control.redraw())}},mxCellRenderer.prototype.getControlBounds=function(e){if(null==e.control)return null;var n=e.control.scale,t=e.control.bounds.width/n,a=(n=e.control.bounds.height/n,e.view.scale),i=e.getCenterX(),s=e.getCenterY();if(!e.view.graph.getModel().isEdge(e.cell)&&(i=e.x+t*a,s=e.y+n*a,null!=e.shape)){var o=e.shape.getShapeRotation();if(this.legacyControlPosition)o=mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION,0);else if(e.shape.isPaintBoundsInverted()){var r=(e.width-e.height)/2;i=i+r,s=s-r}0!=o&&(r=mxUtils.toRadians(o),o=Math.cos(r),r=Math.sin(r),i=(s=mxUtils.getRotatedPoint(new mxPoint(i,s),o,r,new mxPoint(e.getCenterX(),e.getCenterY()))).x,s=s.y)}return e.view.graph.getModel().isEdge(e.cell),new mxRectangle(Math.round(i-t/2*a),Math.round(s-n/2*a),Math.round(t*a),Math.round(n*a))},mxCellRenderer.prototype.redraw=function(e,n,t){if(null!=e.shape){var a=!1;e.view.graph.getModel().isEdge(e.cell),reconfigure=null!=n&&n,this.createControl(e),(e.orderChanged||e.invalidOrder)&&(e.view.graph.ordered?this.order(e):this.orderEdge(e)),!e.orderChanged&&mxUtils.equalEntries(e.shape.style,e.style)||(this.configureShape(e),n=!0),delete e.invalidOrder,delete e.orderChanged,!n&&null!=e.shape.bounds&&e.shape.scale==e.view.scale&&e.shape.bounds.equals(e)&&mxUtils.equalPoints(e.shape.points,e.absolutePoints)||(a=!0,e.shape.points=null!=e.absolutePoints?e.absolutePoints.slice():null,e.shape.bounds=new mxRectangle(e.x,e.y,e.width,e.height),e.shape.scale=e.view.scale,null==t||t?e.shape.redraw():e.shape.updateBoundingBox()),(null==t||t)&&(this.redrawLabel(e,a),this.redrawCellOverlays(e,a),this.redrawControl(e,a))}},mxCellRenderer.prototype.destroy=function(e){null!=e.shape&&(null!=e.text&&(e.text.destroy(),e.text=null),null!=e.overlays&&(e.overlays.visit(function(e,n){n.destroy()}),e.overlays=null),null!=e.control&&(e.control.destroy(),e.control=null),e.shape.destroy(),e.shape=null)};var mxEdgeStyle={EntityRelation:function(e,n,t,a,i){var s=e.view,o=s.graph;a=mxUtils.getValue(e.style,mxConstants.STYLE_SEGMENT,mxConstants.ENTITY_SEGMENT)*s.scale;var r=(d=e.absolutePoints)[0],l=d[d.length-1],d=!1;if(null!=r)(n=new mxCellState).x=r.x,n.y=r.y;else{if(null==n)return;var c=mxUtils.getPortConstraints(n,e,!0,mxConstants.DIRECTION_MASK_NONE);c!=mxConstants.DIRECTION_MASK_NONE?d=c==mxConstants.DIRECTION_MASK_WEST:(r=o.getCellGeometry(n.cell)).relative?d=r.x<=.5:null!=t&&(d=t.x+t.width<n.x)}r=!0,null!=l?((t=new mxCellState).x=l.x,t.y=l.y):null!=t&&((c=mxUtils.getPortConstraints(t,e,!1,mxConstants.DIRECTION_MASK_NONE))!=mxConstants.DIRECTION_MASK_NONE?r=c==mxConstants.DIRECTION_MASK_WEST:(e=o.getCellGeometry(t.cell)).relative?r=e.x<=.5:null!=n&&(r=n.x+n.width<t.x)),null!=n&&null!=t&&(e=d?n.x:n.x+n.width,n=s.getRoutingCenterY(n),o=r?t.x:t.x+t.width,t=s.getRoutingCenterY(t),s=new mxPoint(e+(d?-a:a),n),l=new mxPoint(o+(r?-a:a),t),d==r?(a=d?Math.min(e,o)-a:Math.max(e,o)+a,i.push(new mxPoint(a,n)),i.push(new mxPoint(a,t))):(s.x<l.x==d?(a=n+(t-n)/2,i.push(s),i.push(new mxPoint(s.x,a)),i.push(new mxPoint(l.x,a))):i.push(s),i.push(l)))},Loop:function(e,n,t,a,i){if(null!=n){var s=(t=e.view).graph;null!=(a=null!=a&&0<a.length?a[0]:null)&&(a=t.transformControlPoint(e,a),mxUtils.contains(n,a.x,a.y)&&(a=null));var o=0,r=0,l=0,d=0;s=mxUtils.getValue(e.style,mxConstants.STYLE_SEGMENT,s.gridSize)*t.scale;(e=mxUtils.getValue(e.style,mxConstants.STYLE_DIRECTION,mxConstants.DIRECTION_WEST))==mxConstants.DIRECTION_NORTH||e==mxConstants.DIRECTION_SOUTH?(o=t.getRoutingCenterX(n),r=s):(l=t.getRoutingCenterY(n),d=s),null==a||a.x<n.x||a.x>n.x+n.width?null!=a?(o=a.x,d=Math.max(Math.abs(l-a.y),d)):e==mxConstants.DIRECTION_NORTH?l=n.y-2*r:e==mxConstants.DIRECTION_SOUTH?l=n.y+n.height+2*r:o=e==mxConstants.DIRECTION_EAST?n.x-2*d:n.x+n.width+2*d:null!=a&&(o=t.getRoutingCenterX(n),r=Math.max(Math.abs(o-a.x),d),l=a.y,d=0),i.push(new mxPoint(o-r,l-d)),i.push(new mxPoint(o+r,l+d))}},ElbowConnector:function(e,n,t,a,i){var s=null!=a&&0<a.length?a[0]:null,o=!1,r=!1;if(null!=n&&null!=t)if(null!=s){var l=Math.min(n.x,t.x),d=Math.max(n.x+n.width,t.x+t.width),c=(r=Math.min(n.y,t.y),Math.max(n.y+n.height,t.y+t.height));o=(s=e.view.transformControlPoint(e,s)).y<r||s.y>c,r=s.x<l||s.x>d}else(o=(l=Math.max(n.x,t.x))==(d=Math.min(n.x+n.width,t.x+t.width)))||(r=(r=Math.max(n.y,t.y))==(c=Math.min(n.y+n.height,t.y+t.height)));r||!o&&e.style[mxConstants.STYLE_ELBOW]!=mxConstants.ELBOW_VERTICAL?mxEdgeStyle.SideToSide(e,n,t,a,i):mxEdgeStyle.TopToBottom(e,n,t,a,i)},SideToSide:function(e,n,t,a,i){var s=e.view;a=null!=a&&0<a.length?a[0]:null;var o=(r=e.absolutePoints)[0],r=r[r.length-1];null!=a&&(a=s.transformControlPoint(e,a)),null!=o&&((n=new mxCellState).x=o.x,n.y=o.y),null!=r&&((t=new mxCellState).x=r.x,t.y=r.y),null!=n&&null!=t&&(e=Math.max(n.x,t.x),o=Math.min(n.x+n.width,t.x+t.width),e=null!=a?a.x:o+(e-o)/2,o=s.getRoutingCenterY(n),s=s.getRoutingCenterY(t),null!=a&&(a.y>=n.y&&a.y<=n.y+n.height&&(o=a.y),a.y>=t.y&&a.y<=t.y+t.height&&(s=a.y)),!mxUtils.contains(t,e,o)&&!mxUtils.contains(n,e,o)&&i.push(new mxPoint(e,o)),!mxUtils.contains(t,e,s)&&!mxUtils.contains(n,e,s)&&i.push(new mxPoint(e,s)),1==i.length&&(null!=a?!mxUtils.contains(t,e,a.y)&&!mxUtils.contains(n,e,a.y)&&i.push(new mxPoint(e,a.y)):(s=Math.max(n.y,t.y),n=Math.min(n.y+n.height,t.y+t.height),i.push(new mxPoint(e,s+(n-s)/2)))))},TopToBottom:function(e,n,t,a,i){var s=e.view;a=null!=a&&0<a.length?a[0]:null;var o=(r=e.absolutePoints)[0],r=r[r.length-1];null!=a&&(a=s.transformControlPoint(e,a)),null!=o&&((n=new mxCellState).x=o.x,n.y=o.y),null!=r&&((t=new mxCellState).x=r.x,t.y=r.y),null!=n&&null!=t&&(o=Math.max(n.y,t.y),r=Math.min(n.y+n.height,t.y+t.height),e=s.getRoutingCenterX(n),null!=a&&a.x>=n.x&&a.x<=n.x+n.width&&(e=a.x),o=null!=a?a.y:r+(o-r)/2,!mxUtils.contains(t,e,o)&&!mxUtils.contains(n,e,o)&&i.push(new mxPoint(e,o)),e=null!=a&&a.x>=t.x&&a.x<=t.x+t.width?a.x:s.getRoutingCenterX(t),!mxUtils.contains(t,e,o)&&!mxUtils.contains(n,e,o)&&i.push(new mxPoint(e,o)),1==i.length&&(null!=a&&1==i.length?!mxUtils.contains(t,a.x,o)&&!mxUtils.contains(n,a.x,o)&&i.push(new mxPoint(a.x,o)):(s=Math.max(n.x,t.x),n=Math.min(n.x+n.width,t.x+t.width),i.push(new mxPoint(s+(n-s)/2,o)))))},SegmentConnector:function(e,n,t,a,i){var s=e.absolutePoints,o=!0,r=null,l=s[0];null==l&&null!=n?l=new mxPoint(e.view.getRoutingCenterX(n),e.view.getRoutingCenterY(n)):null!=l&&(l=l.clone());var d=s.length-1;if(null!=a&&0<a.length){r=e.view.transformControlPoint(e,a[0]);for(var c=n,m=s[0],u=!1,p=!1,g=(u=r,a.length),v=0;v<2;v++){var h=null!=m&&m.x==u.x,f=null!=m&&m.y==u.y,b=null!=c&&u.y>=c.y&&u.y<=c.y+c.height;c=null!=c&&u.x>=c.x&&u.x<=c.x+c.width,u=f||null==m&&b,p=h||null==m&&c;if(null!=m&&!f&&!h&&(b||c)){o=!b;break}if(p||u){o=u,1==v&&(o=0==a.length%2?u:p);break}c=t,m=s[d],u=e.view.transformControlPoint(e,a[g-1])}for(o&&(null!=s[0]&&s[0].y!=r.y||null==s[0]&&null!=n&&(r.y<n.y||r.y>n.y+n.height))?i.push(new mxPoint(l.x,r.y)):!o&&(null!=s[0]&&s[0].x!=r.x||null==s[0]&&null!=n&&(r.x<n.x||r.x>n.x+n.width))&&i.push(new mxPoint(r.x,l.y)),o?l.y=r.y:l.x=r.x,v=0;v<a.length;v++)o=!o,r=e.view.transformControlPoint(e,a[v]),o?l.y=r.y:l.x=r.x,i.push(l.clone())}else r=l,o=!0;if(null==(l=s[d])&&null!=t&&(l=new mxPoint(e.view.getRoutingCenterX(t),e.view.getRoutingCenterY(t))),o&&(null!=s[d]&&s[d].y!=r.y||null==s[d]&&null!=t&&(r.y<t.y||r.y>t.y+t.height))?i.push(new mxPoint(l.x,r.y)):!o&&(null!=s[d]&&s[d].x!=r.x||null==s[d]&&null!=t&&(r.x<t.x||r.x>t.x+t.width))&&i.push(new mxPoint(r.x,l.y)),null==s[0]&&null!=n)for(;1<i.length&&mxUtils.contains(n,i[1].x,i[1].y);)i=i.splice(1,1);if(null==s[d]&&null!=t)for(;1<i.length&&mxUtils.contains(t,i[i.length-1].x,i[i.length-1].y);)i=i.splice(i.length-1,1)},orthBuffer:10,dirVectors:[[-1,0],[0,-1],[1,0],[0,1],[-1,0],[0,-1],[1,0]],wayPoints1:[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],routePatterns:[[[513,2308,2081,2562],[513,1090,514,2184,2114,2561],[513,1090,514,2564,2184,2562],[513,2308,2561,1090,514,2568,2308]],[[514,1057,513,2308,2081,2562],[514,2184,2114,2561],[514,2184,2562,1057,513,2564,2184],[514,1057,513,2568,2308,2561]],[[1090,514,1057,513,2308,2081,2562],[2114,2561],[1090,2562,1057,513,2564,2184],[1090,514,1057,513,2308,2561,2568]],[[2081,2562],[1057,513,1090,514,2184,2114,2561],[1057,513,1090,514,2184,2562,2564],[1057,2561,1090,514,2568,2308]]],inlineRoutePatterns:[[null,[2114,2568],null,null],[null,[514,2081,2114,2568],null,null],[null,[2114,2561],null,null],[[2081,2562],[1057,2114,2568],[2184,2562],null]],vertexSeperations:[],limits:[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]],LEFT_MASK:32,TOP_MASK:64,RIGHT_MASK:128,BOTTOM_MASK:256,LEFT:1,TOP:2,RIGHT:4,BOTTOM:8,SIDE_MASK:480,CENTER_MASK:512,SOURCE_MASK:1024,TARGET_MASK:2048,VERTEX_MASK:3072,OrthConnector:function(e,n,t,a,i){var s=e.view.graph,o=null!=n&&s.getModel().isEdge(n.cell);s=null!=t&&s.getModel().isEdge(t.cell);if(null!=a&&0<a.length||o||s)mxEdgeStyle.SegmentConnector(e,n,t,a,i);else{var r=(a=e.absolutePoints)[0],l=a[a.length-1];a=null!=n?n.x:r.x;o=null!=n?n.y:r.y;var d=null!=n?n.width:1,c=null!=n?n.height:1,m=null!=t?t.x:l.x,u=null!=t?t.y:l.y,p=null!=t?t.width:1,g=null!=t?t.height:1,v=(s=e.view.scale*mxEdgeStyle.orthBuffer,[mxConstants.DIRECTION_MASK_ALL,mxConstants.DIRECTION_MASK_ALL]);for(null!=n&&(v[0]=mxUtils.getPortConstraints(n,e,!0,mxConstants.DIRECTION_MASK_ALL)),null!=t&&(v[1]=mxUtils.getPortConstraints(t,e,!1,mxConstants.DIRECTION_MASK_ALL)),e=[0,0],a=[[a,o,d,c],[m,u,p,g]],d=0;d<2;d++)mxEdgeStyle.limits[d][1]=a[d][0]-s,mxEdgeStyle.limits[d][2]=a[d][1]-s,mxEdgeStyle.limits[d][4]=a[d][0]+a[d][2]+s,mxEdgeStyle.limits[d][8]=a[d][1]+a[d][3]+s;for(d=a[0][0]+a[0][2]/2-(a[1][0]+a[1][2]/2),c=a[0][1]+a[0][3]/2-(a[1][1]+a[1][3]/2),d<(o=0)?o=c<0?2:1:c<=0&&(o=3,0==d&&(o=2)),(c=null)!=n&&(c=r),n=[[.5,.5],[.5,.5]],d=0;d<2;d++)null!=c&&(n[d][0]=(c.x-a[d][0])/a[d][2],n[d][0]<.01?e[d]=mxConstants.DIRECTION_MASK_WEST:.99<n[d][0]&&(e[d]=mxConstants.DIRECTION_MASK_EAST),n[d][1]=(c.y-a[d][1])/a[d][3],n[d][1]<.01?e[d]=mxConstants.DIRECTION_MASK_NORTH:.99<n[d][1]&&(e[d]=mxConstants.DIRECTION_MASK_SOUTH)),(c=null)!=t&&(c=l);for(d=a[0][1]-(a[1][1]+a[1][3]),c=a[0][0]-(a[1][0]+a[1][2]),m=a[1][1]-(a[0][1]+a[0][3]),u=a[1][0]-(a[0][0]+a[0][2]),mxEdgeStyle.vertexSeperations[1]=Math.max(c-2*s,0),mxEdgeStyle.vertexSeperations[2]=Math.max(d-2*s,0),mxEdgeStyle.vertexSeperations[4]=Math.max(m-2*s,0),mxEdgeStyle.vertexSeperations[3]=Math.max(u-2*s,0),t=[],l=[],(r=[])[0]=u<=c?mxConstants.DIRECTION_MASK_WEST:mxConstants.DIRECTION_MASK_EAST,l[0]=m<=d?mxConstants.DIRECTION_MASK_NORTH:mxConstants.DIRECTION_MASK_SOUTH,r[1]=mxUtils.reversePortConstraints(r[0]),l[1]=mxUtils.reversePortConstraints(l[0]),c=u<=c?c:u,m=m<=d?d:m,p=!(u=[[0,0],[0,0]]),d=0;d<2;d++)0==e[d]&&(0==(r[d]&v[d])&&(r[d]=mxUtils.reversePortConstraints(r[d])),0==(l[d]&v[d])&&(l[d]=mxUtils.reversePortConstraints(l[d])),u[d][0]=l[d],u[d][1]=r[d]);for(2*s<m&&2*s<c&&(0<(r[0]&v[0])&&0<(l[1]&v[1])?(u[0][0]=r[0],u[0][1]=l[0],u[1][0]=l[1],u[1][1]=r[1],p=!0):0<(l[0]&v[0])&&0<(r[1]&v[1])&&(u[0][0]=l[0],u[0][1]=r[0],u[1][0]=r[1],u[1][1]=l[1],p=!0)),2*s<m&&!p&&(u[0][0]=l[0],u[0][1]=r[0],u[1][0]=l[1],u[1][1]=r[1],p=!0),2*s<c&&!p&&(u[0][0]=r[0],u[0][1]=l[0],u[1][0]=r[1],u[1][1]=l[1]),d=0;d<2;d++)0==e[d]&&(0==(u[d][0]&v[d])&&(u[d][0]=u[d][1]),t[d]=u[d][0]&v[d],t[d]|=(u[d][1]&v[d])<<8,t[d]|=(u[1-d][d]&v[d])<<16,t[d]|=(u[1-d][1-d]&v[d])<<24,0==(15&t[d])&&(t[d]<<=8),0==(3840&t[d])&&(t[d]=15&t[d]|t[d]>>8),0==(983040&t[d])&&(t[d]=65535&t[d]|(251658240&t[d])>>8),e[d]=15&t[d],v[d]==mxConstants.DIRECTION_MASK_WEST||v[d]==mxConstants.DIRECTION_MASK_NORTH||v[d]==mxConstants.DIRECTION_MASK_EAST||v[d]==mxConstants.DIRECTION_MASK_SOUTH)&&(e[d]=v[d]);switch(d=e[0]==mxConstants.DIRECTION_MASK_EAST?3:e[0],v=e[1]==mxConstants.DIRECTION_MASK_EAST?3:e[1],(d-=o)<1&&(d+=4),(v-=o)<1&&(v+=4),v=mxEdgeStyle.routePatterns[d-1][v-1],mxEdgeStyle.wayPoints1[0][0]=a[0][0],mxEdgeStyle.wayPoints1[0][1]=a[0][1],e[0]){case mxConstants.DIRECTION_MASK_WEST:mxEdgeStyle.wayPoints1[0][0]-=s,mxEdgeStyle.wayPoints1[0][1]+=n[0][1]*a[0][3];break;case mxConstants.DIRECTION_MASK_SOUTH:mxEdgeStyle.wayPoints1[0][0]+=n[0][0]*a[0][2],mxEdgeStyle.wayPoints1[0][1]+=a[0][3]+s;break;case mxConstants.DIRECTION_MASK_EAST:mxEdgeStyle.wayPoints1[0][0]+=a[0][2]+s,mxEdgeStyle.wayPoints1[0][1]+=n[0][1]*a[0][3];break;case mxConstants.DIRECTION_MASK_NORTH:mxEdgeStyle.wayPoints1[0][0]+=n[0][0]*a[0][2],mxEdgeStyle.wayPoints1[0][1]-=s}for(r=t=(s=0)<(e[0]&(mxConstants.DIRECTION_MASK_EAST|mxConstants.DIRECTION_MASK_WEST))?0:1,d=l=0;d<v.length;d++){g=(l=15&v[d])==mxConstants.DIRECTION_MASK_EAST?3:l,4<(g+=o)&&(g-=4),c=mxEdgeStyle.dirVectors[g-1],(l=0<g%2?0:1)!=t&&(s++,mxEdgeStyle.wayPoints1[s][0]=mxEdgeStyle.wayPoints1[s-1][0],mxEdgeStyle.wayPoints1[s][1]=mxEdgeStyle.wayPoints1[s-1][1]);var h=0<(v[d]&mxEdgeStyle.TARGET_MASK);p=0<(v[d]&mxEdgeStyle.SOURCE_MASK);15<(m=(m=(v[d]&mxEdgeStyle.SIDE_MASK)>>5)<<o)&&(m>>=4),u=0<(v[d]&mxEdgeStyle.CENTER_MASK),(p||h)&&m<9?(g=0,p=p?0:1,g=u&&0==l?a[p][0]+n[p][0]*a[p][2]:u?a[p][1]+n[p][1]*a[p][3]:mxEdgeStyle.limits[p][m],0==l?0<(m=(g-mxEdgeStyle.wayPoints1[s][0])*c[0])&&(mxEdgeStyle.wayPoints1[s][0]+=c[0]*m):0<(m=(g-mxEdgeStyle.wayPoints1[s][1])*c[1])&&(mxEdgeStyle.wayPoints1[s][1]+=c[1]*m)):u&&(mxEdgeStyle.wayPoints1[s][0]+=c[0]*Math.abs(mxEdgeStyle.vertexSeperations[g]/2),mxEdgeStyle.wayPoints1[s][1]+=c[1]*Math.abs(mxEdgeStyle.vertexSeperations[g]/2)),0<s&&mxEdgeStyle.wayPoints1[s][l]==mxEdgeStyle.wayPoints1[s-1][l]?s--:t=l}for(d=0;d<=s&&(d!=s||((0<(e[1]&(mxConstants.DIRECTION_MASK_EAST|mxConstants.DIRECTION_MASK_WEST))?0:1)==r?0:1)==(s+1)%2);d++)i.push(new mxPoint(mxEdgeStyle.wayPoints1[d][0],mxEdgeStyle.wayPoints1[d][1]))}},getRoutePattern:function(e,n,t,a){var i=e[0]==mxConstants.DIRECTION_MASK_EAST?3:e[0];return e=e[1]==mxConstants.DIRECTION_MASK_EAST?3:e[1],(i-=n)<1&&(i+=4),(e-=n)<1&&(e+=4),n=routePatterns[i-1][e-1],0!=t&&0!=a||null!=inlineRoutePatterns[i-1][e-1]&&(n=inlineRoutePatterns[i-1][e-1]),n}},mxStyleRegistry={values:[],putValue:function(e,n){mxStyleRegistry.values[e]=n},getValue:function(e){return mxStyleRegistry.values[e]},getName:function(e){for(var n in mxStyleRegistry.values)if(mxStyleRegistry.values[n]==e)return n;return null}};function mxGraphView(e){this.graph=e,this.translate=new mxPoint,this.graphBounds=new mxRectangle,this.states=new mxDictionary}function mxCurrentRootChange(e,n){if(this.view=e,this.previous=this.root=n,this.isUp=null==n,!this.isUp)for(var t=this.view.currentRoot,a=this.view.graph.getModel();null!=t;){if(t==n){this.isUp=!0;break}t=a.getParent(t)}}function mxGraph(e,n,t,a){this.mouseListeners=null,this.renderHint=t,this.dialect=mxClient.IS_SVG?mxConstants.DIALECT_SVG:t==mxConstants.RENDERING_HINT_EXACT&&mxClient.IS_VML?mxConstants.DIALECT_VML:t==mxConstants.RENDERING_HINT_FASTEST?mxConstants.DIALECT_STRICTHTML:t==mxConstants.RENDERING_HINT_FASTER?mxConstants.DIALECT_PREFERHTML:mxConstants.DIALECT_MIXEDHTML,this.model=null!=n?n:new mxGraphModel,this.multiplicities=[],this.imageBundles=[],this.cellRenderer=this.createCellRenderer(),this.setSelectionModel(this.createSelectionModel()),this.setStylesheet(null!=a?a:this.createStylesheet()),this.view=this.createGraphView(),this.graphModelChangeListener=mxUtils.bind(this,function(e,n){this.graphModelChanged(n.getProperty("edit").changes)}),this.model.addListener(mxEvent.CHANGE,this.graphModelChangeListener),this.createHandlers(),null!=e&&this.init(e),this.view.revalidate()}function mxCellOverlay(e,n,t,a,i,s){this.image=e,this.tooltip=n,this.align=null!=t?t:this.align,this.verticalAlign=null!=a?a:this.verticalAlign,this.offset=null!=i?i:new mxPoint,this.cursor=null!=s?s:"help"}function mxOutline(e,n){this.source=e,null!=n&&this.init(n)}function mxMultiplicity(e,n,t,a,i,s,o,r,l,d){this.source=e,this.type=n,this.attr=t,this.value=a,this.min=null!=i?i:0,this.max=null!=s?s:"n",this.validNeighbors=o,this.countError=mxResources.get(r)||r,this.typeError=mxResources.get(l)||l,this.validNeighborsAllowed=null==d||d}function mxLayoutManager(e){this.undoHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.beforeUndo(n.getProperty("edit"))}),this.moveHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.cellsMoved(n.getProperty("cells"),n.getProperty("event"))}),this.setGraph(e)}function mxSpaceManager(e,n,t,a){this.resizeHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.cellsResized(n.getProperty("cells"))}),this.foldHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.cellsResized(n.getProperty("cells"))}),this.shiftRightwards=null==n||n,this.shiftDownwards=null==t||t,this.extendParents=null==a||a,this.setGraph(e)}function mxSwimlaneManager(e,n,t,a){this.horizontal=null==n||n,this.addEnabled=null==t||t,this.resizeEnabled=null==a||a,this.addHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.isAddEnabled()&&this.cellsAdded(n.getProperty("cells"))}),this.resizeHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.isResizeEnabled()&&this.cellsResized(n.getProperty("cells"))}),this.setGraph(e)}function mxTemporaryCellStates(e,n,t){if(this.view=e,n=null!=n?n:1,this.oldBounds=e.getGraphBounds(),this.oldStates=e.getStates(),this.oldScale=e.getScale(),e.setStates(new mxDictionary),e.setScale(n),null!=t){n=e.createState(new mxCell);for(var a=0;a<t.length;a++)e.validateBounds(n,t[a]);var i=null;for(a=0;a<t.length;a++){var s=e.validatePoints(n,t[a]);null==i?i=s:i.add(s)}null==i&&(i=new mxRectangle),e.setGraphBounds(i)}}function mxCellStatePreview(e){this.graph=e,this.deltas={}}function mxConnectionConstraint(e,n){this.point=e,this.perimeter=null==n||n}function mxGraphHandler(e){this.graph=e,this.graph.addMouseListener(this),this.panHandler=mxUtils.bind(this,function(){this.updatePreviewShape()}),this.graph.addListener(mxEvent.PAN,this.panHandler)}function mxPanningHandler(e,n){null!=e&&(this.graph=e,this.factoryMethod=n,this.graph.addMouseListener(this),this.init())}function mxCellMarker(e,n,t,a){mxEventSource.call(this),null!=e&&(this.graph=e,this.validColor=null!=n?n:mxConstants.DEFAULT_VALID_COLOR,this.invalidColor=null!=n?t:mxConstants.DEFAULT_INVALID_COLOR,this.hotspot=null!=a?a:mxConstants.DEFAULT_HOTSPOT,this.highlight=new mxCellHighlight(e))}function mxSelectionCellsHandler(e){mxEventSource.call(this),this.graph=e,this.handlers=new mxDictionary,this.graph.addMouseListener(this),this.refreshHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.refresh()}),this.graph.getSelectionModel().addListener(mxEvent.CHANGE,this.refreshHandler),this.graph.getModel().addListener(mxEvent.CHANGE,this.refreshHandler),this.graph.getView().addListener(mxEvent.SCALE,this.refreshHandler),this.graph.getView().addListener(mxEvent.TRANSLATE,this.refreshHandler),this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE,this.refreshHandler),this.graph.getView().addListener(mxEvent.DOWN,this.refreshHandler),this.graph.getView().addListener(mxEvent.UP,this.refreshHandler)}function mxConnectionHandler(e,n){mxEventSource.call(this),null!=e&&(this.graph=e,this.factoryMethod=n,this.init())}function mxConstraintHandler(e){this.graph=e}function mxRubberband(e){null!=e&&(this.graph=e,this.graph.addMouseListener(this),this.panHandler=mxUtils.bind(this,function(){this.repaint()}),this.graph.addListener(mxEvent.PAN,this.panHandler),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})))}function mxVertexHandler(e){null!=e&&(this.state=e,this.init())}function mxEdgeHandler(e){null!=e&&(this.state=e,this.init())}function mxElbowEdgeHandler(e){mxEdgeHandler.call(this,e)}function mxEdgeSegmentHandler(e){mxEdgeHandler.call(this,e)}function mxKeyHandler(e,n){null!=e&&(this.graph=e,this.target=n||document.documentElement,this.normalKeys=[],this.shiftKeys=[],this.controlKeys=[],this.controlShiftKeys=[],mxEvent.addListener(this.target,"keydown",mxUtils.bind(this,function(e){this.keyDown(e)})),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})))}function mxTooltipHandler(e,n){null!=e&&(this.graph=e,this.delay=n||500,this.graph.addMouseListener(this))}function mxCellTracker(e,n,t){mxCellMarker.call(this,e,n),this.graph.addMouseListener(this),null!=t&&(this.getCell=t),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()}))}function mxCellHighlight(e,n,t,a){null!=e&&(this.graph=e,this.highlightColor=null!=n?n:mxConstants.DEFAULT_VALID_COLOR,this.strokeWidth=null!=t?t:mxConstants.HIGHLIGHT_STROKEWIDTH,this.dashed=null!=a&&a,this.repaintHandler=mxUtils.bind(this,function(){this.repaint()}),this.graph.getView().addListener(mxEvent.SCALE,this.repaintHandler),this.graph.getView().addListener(mxEvent.TRANSLATE,this.repaintHandler),this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE,this.repaintHandler),this.graph.getModel().addListener(mxEvent.CHANGE,this.repaintHandler),this.resetHandler=mxUtils.bind(this,function(){this.hide()}),this.graph.getView().addListener(mxEvent.DOWN,this.resetHandler),this.graph.getView().addListener(mxEvent.UP,this.resetHandler))}function mxDefaultKeyHandler(n){if(null!=n){this.editor=n,this.handler=new mxKeyHandler(n.graph);var t=this.handler.escape;this.handler.escape=function(e){t.apply(this,arguments),n.hideProperties(),n.fireEvent(new mxEventObject(mxEvent.ESCAPE,"event",e))}}}function mxDefaultPopupMenu(e){this.config=e}function mxDefaultToolbar(e,n){this.editor=n,null!=e&&null!=n&&this.init(e)}function mxEditor(e){this.actions=[],this.addActions(),null!=document.body&&(this.cycleAttributeValues=[],this.popupHandler=new mxDefaultPopupMenu,this.undoManager=new mxUndoManager,this.graph=this.createGraph(),this.toolbar=this.createToolbar(),this.keyHandler=new mxDefaultKeyHandler(this),this.configure(e),this.graph.swimlaneIndicatorColorAttribute=this.cycleAttributeName,!mxClient.IS_LOCAL&&null!=this.urlInit&&(this.session=this.createSession()),null!=this.onInit&&this.onInit(),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})))}mxStyleRegistry.putValue(mxConstants.EDGESTYLE_ELBOW,mxEdgeStyle.ElbowConnector),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_ENTITY_RELATION,mxEdgeStyle.EntityRelation),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_LOOP,mxEdgeStyle.Loop),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_SIDETOSIDE,mxEdgeStyle.SideToSide),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_TOPTOBOTTOM,mxEdgeStyle.TopToBottom),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_ORTHOGONAL,mxEdgeStyle.OrthConnector),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_SEGMENT,mxEdgeStyle.SegmentConnector),mxStyleRegistry.putValue(mxConstants.PERIMETER_ELLIPSE,mxPerimeter.EllipsePerimeter),mxStyleRegistry.putValue(mxConstants.PERIMETER_RECTANGLE,mxPerimeter.RectanglePerimeter),mxStyleRegistry.putValue(mxConstants.PERIMETER_RHOMBUS,mxPerimeter.RhombusPerimeter),mxStyleRegistry.putValue(mxConstants.PERIMETER_TRIANGLE,mxPerimeter.TrianglePerimeter),mxGraphView.prototype=new mxEventSource,mxGraphView.prototype.constructor=mxGraphView,mxGraphView.prototype.EMPTY_POINT=new mxPoint,mxGraphView.prototype.doneResource="none"!=mxClient.language?"done":"",mxGraphView.prototype.updatingDocumentResource="none"!=mxClient.language?"updatingDocument":"",mxGraphView.prototype.allowEval=!1,mxGraphView.prototype.captureDocumentGesture=!0,mxGraphView.prototype.optimizeVmlReflows=!0,mxGraphView.prototype.rendering=!0,mxGraphView.prototype.graph=null,mxGraphView.prototype.currentRoot=null,mxGraphView.prototype.graphBounds=null,mxGraphView.prototype.scale=1,mxGraphView.prototype.translate=null,mxGraphView.prototype.updateStyle=!1,mxGraphView.prototype.getGraphBounds=function(){return this.graphBounds},mxGraphView.prototype.setGraphBounds=function(e){this.graphBounds=e},mxGraphView.prototype.getBounds=function(e){var n=null;if(null!=e&&0<e.length)for(var t=this.graph.getModel(),a=0;a<e.length;a++)if(t.isVertex(e[a])||t.isEdge(e[a])){var i=this.getState(e[a]);null!=i&&(null==n?n=new mxRectangle(i.x,i.y,i.width,i.height):n.add(i))}return n},mxGraphView.prototype.setCurrentRoot=function(e){if(this.currentRoot!=e){var n=new mxCurrentRootChange(this,e);n.execute();var t=new mxUndoableEdit(this,!1);t.add(n),this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",t)),this.graph.sizeDidChange()}return e},mxGraphView.prototype.scaleAndTranslate=function(e,n,t){var a=this.scale,i=new mxPoint(this.translate.x,this.translate.y);this.scale==e&&this.translate.x==n&&this.translate.y==t||(this.scale=e,this.translate.x=n,this.translate.y=t,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.SCALE_AND_TRANSLATE,"scale",e,"previousScale",a,"translate",this.translate,"previousTranslate",i))},mxGraphView.prototype.getScale=function(){return this.scale},mxGraphView.prototype.setScale=function(e){var n=this.scale;this.scale!=e&&(this.scale=e,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.SCALE,"scale",e,"previousScale",n))},mxGraphView.prototype.getTranslate=function(){return this.translate},mxGraphView.prototype.setTranslate=function(e,n){var t=new mxPoint(this.translate.x,this.translate.y);this.translate.x==e&&this.translate.y==n||(this.translate.x=e,this.translate.y=n,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.TRANSLATE,"translate",this.translate,"previousTranslate",t))},mxGraphView.prototype.refresh=function(){null!=this.currentRoot&&this.clear(),this.revalidate()},mxGraphView.prototype.revalidate=function(){this.invalidate(),this.validate()},mxGraphView.prototype.clear=function(e,n,t){var a=this.graph.getModel();if(e=e||a.getRoot(),n=null!=n&&n,t=null==t||t,this.removeState(e),t&&(n||e!=this.currentRoot)){t=a.getChildCount(e);for(var i=0;i<t;i++)this.clear(a.getChildAt(e,i),n)}else this.invalidate(e)},mxGraphView.prototype.invalidate=function(e,n,t,a){var i=this.graph.getModel();if(e=e||i.getRoot(),n=null==n||n,t=null==t||t,a=null!=a&&a,null!=(o=this.getState(e))&&(o.invalid=!0,a&&(o.orderChanged=!0)),n)for(var s=i.getChildCount(e),o=0;o<s;o++){var r=i.getChildAt(e,o);this.invalidate(r,n,t,a)}if(t)for(a=i.getEdgeCount(e),o=0;o<a;o++)this.invalidate(i.getEdgeAt(e,o),n,t)},mxGraphView.prototype.validate=function(e){var n=mxLog.enter("mxGraphView.validate");window.status=mxResources.get(this.updatingDocumentResource)||this.updatingDocumentResource;var t=null;if(this.optimizeVmlReflows&&null!=this.canvas&&null==this.textDiv&&(8==document.documentMode||mxClient.IS_QUIRKS)){t=this.canvas.style.display,this.canvas.style.display="none";var a=document.createElement("div");a.style.position="absolute",a.style.whiteSpace="nowrap",a.style.visibility="hidden",a.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",a.style.zoom="1",document.body.appendChild(a),this.textDiv=a}e=e||(null!=this.currentRoot?this.currentRoot:this.graph.getModel().getRoot()),this.validateBounds(null,e),null==(e=this.validatePoints(null,e))&&(e=new mxRectangle),this.setGraphBounds(e),this.validateBackground(),null!=t&&(this.canvas.style.display=t,document.body.removeChild(this.textDiv),this.textDiv=null),window.status=mxResources.get(this.doneResource)||this.doneResource,mxLog.leave("mxGraphView.validate",n)},mxGraphView.prototype.createBackgroundPageShape=function(e){return new mxRectangleShape(e,"white","black")},mxGraphView.prototype.validateBackground=function(){var e=this.graph.getBackgroundImage();if(null!=e){if(null==this.backgroundImage||this.backgroundImage.image!=e.src){null!=this.backgroundImage&&this.backgroundImage.destroy();var n=new mxRectangle(0,0,1,1);this.backgroundImage=new mxImageShape(n,e.src),this.backgroundImage.dialect=this.graph.dialect,this.backgroundImage.init(this.backgroundPane),this.backgroundImage.redraw()}this.redrawBackgroundImage(this.backgroundImage,e)}else null!=this.backgroundImage&&(this.backgroundImage.destroy(),this.backgroundImage=null);this.graph.pageVisible?(n=this.getBackgroundPageBounds(),null==this.backgroundPageShape?(this.backgroundPageShape=this.createBackgroundPageShape(n),this.backgroundPageShape.scale=this.scale,this.backgroundPageShape.isShadow=!0,this.backgroundPageShape.dialect=this.graph.dialect,this.backgroundPageShape.init(this.backgroundPane),this.backgroundPageShape.redraw(),mxEvent.addListener(this.backgroundPageShape.node,"dblclick",mxUtils.bind(this,function(e){this.graph.dblClick(e)})),mxEvent.addGestureListeners(this.backgroundPageShape.node,mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){null!=this.graph.tooltipHandler&&this.graph.tooltipHandler.isHideOnHover()&&this.graph.tooltipHandler.hide(),this.graph.isMouseDown&&!mxEvent.isConsumed(e)&&this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))}))):(this.backgroundPageShape.scale=this.scale,this.backgroundPageShape.bounds=n,this.backgroundPageShape.redraw())):null!=this.backgroundPageShape&&(this.backgroundPageShape.destroy(),this.backgroundPageShape=null)},mxGraphView.prototype.getBackgroundPageBounds=function(){var e=this.graph.pageFormat,n=this.scale*this.graph.pageScale;return new mxRectangle(this.scale*this.translate.x,this.scale*this.translate.y,e.width*n,e.height*n)},mxGraphView.prototype.redrawBackgroundImage=function(e,n){e.scale=this.scale,e.bounds.x=this.scale*this.translate.x,e.bounds.y=this.scale*this.translate.y,e.bounds.width=this.scale*n.width,e.bounds.height=this.scale*n.height,e.redraw()},mxGraphView.prototype.validateBounds=function(e,n){var t=this.graph.getModel(),a=this.getState(n,!0);if(null!=a&&a.invalid){if(this.graph.isCellVisible(n)){if(n!=this.currentRoot&&null!=e)if(a.absoluteOffset.x=0,a.absoluteOffset.y=0,a.origin.x=e.origin.x,a.origin.y=e.origin.y,null!=(s=this.graph.getCellGeometry(n))){if(!t.isEdge(n)){var i=s.offset||this.EMPTY_POINT;s.relative?(a.origin.x+=s.x*e.width/this.scale+i.x,a.origin.y+=s.y*e.height/this.scale+i.y):(a.absoluteOffset.x=this.scale*i.x,a.absoluteOffset.y=this.scale*i.y,a.origin.x+=s.x,a.origin.y+=s.y)}if(a.x=this.scale*(this.translate.x+a.origin.x),a.y=this.scale*(this.translate.y+a.origin.y),a.width=this.scale*s.width,a.height=this.scale*s.height,t.isVertex(n)){if(s.relative&&0!=(i=mxUtils.toRadians(e.style[mxConstants.STYLE_ROTATION]||"0"))){var s=Math.cos(i),o=(i=Math.sin(i),new mxPoint(a.getCenterX(),a.getCenterY())),r=new mxPoint(e.getCenterX(),e.getCenterY());s=mxUtils.getRotatedPoint(o,s,i,r);a.x=s.x-a.width/2,a.y=s.y-a.height/2}this.updateVertexLabelOffset(a)}}}else this.removeState(n);null!=(i=this.graph.getChildOffsetForCell(n))&&(a.origin.x+=i.x,a.origin.y+=i.y)}if(null!=a&&(!this.graph.isCellCollapsed(n)||n==this.currentRoot))for(s=t.getChildCount(n),i=0;i<s;i++)o=t.getChildAt(n,i),this.validateBounds(a,o)},mxGraphView.prototype.updateVertexLabelOffset=function(e){var n=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER);n==mxConstants.ALIGN_LEFT?e.absoluteOffset.x-=e.width:n==mxConstants.ALIGN_RIGHT&&(e.absoluteOffset.x+=e.width),(n=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?e.absoluteOffset.y-=e.height:n==mxConstants.ALIGN_BOTTOM&&(e.absoluteOffset.y+=e.height)},mxGraphView.prototype.validatePoints=function(e,n){var t=this.graph.getModel(),a=this.getState(n),i=null;if(null!=a){if(a.invalid){var s=this.graph.getCellGeometry(n);if(null!=s&&t.isEdge(n)){var o=this.getState(this.getVisibleTerminal(n,!0));if(a.setVisibleTerminalState(o,!0),null!=o&&t.isEdge(o.cell)&&!t.isAncestor(o.cell,n)){var r=this.getState(t.getParent(o.cell));this.validatePoints(r,o.cell)}var l=this.getState(this.getVisibleTerminal(n,!1));a.setVisibleTerminalState(l,!1),null!=l&&t.isEdge(l.cell)&&!t.isAncestor(l.cell,n)&&(r=this.getState(t.getParent(l.cell)),this.validatePoints(r,l.cell)),this.updateFixedTerminalPoints(a,o,l),this.updatePoints(a,s.points,o,l),this.updateFloatingTerminalPoints(a,o,l),this.updateEdgeBounds(a),this.updateEdgeLabelOffset(a)}else null!=s&&s.relative&&null!=e&&t.isEdge(e.cell)&&(null!=(s=this.getPoint(e,s))&&(a.x=s.x,a.y=s.y,s.x=s.x/this.scale-this.translate.x,s.y=s.y/this.scale-this.translate.y,a.origin=s,this.childMoved(e,a)));a.invalid=!1,n!=this.currentRoot&&this.graph.cellRenderer.redraw(a,!1,this.isRendering())}(t.isEdge(n)||t.isVertex(n))&&(null!=a.shape&&null!=a.shape.boundingBox&&(i=a.shape.boundingBox.clone()),null!=a.text&&!this.graph.isLabelClipped(a.cell)&&null!=a.text.boundingBox&&(null!=i?i.add(a.text.boundingBox):i=a.text.boundingBox.clone()))}if(null!=a&&(!this.graph.isCellCollapsed(n)||n==this.currentRoot))for(s=t.getChildCount(n),o=0;o<s;o++)r=t.getChildAt(n,o),null!=(r=this.validatePoints(a,r))&&(null==i?i=r:i.add(r));return i},mxGraphView.prototype.childMoved=function(e,n){var t=n.cell;if(!this.graph.isCellCollapsed(t)||t==this.currentRoot)for(var a=this.graph.getModel(),i=a.getChildCount(t),s=0;s<i;s++)this.validateBounds(n,a.getChildAt(t,s))},mxGraphView.prototype.updateFixedTerminalPoints=function(e,n,t){this.updateFixedTerminalPoint(e,n,!0,this.graph.getConnectionConstraint(e,n,!0)),this.updateFixedTerminalPoint(e,t,!1,this.graph.getConnectionConstraint(e,t,!1))},mxGraphView.prototype.updateFixedTerminalPoint=function(e,n,t,a){var i=null;if(null!=a&&(i=this.graph.getConnectionPoint(n,a)),null==i&&null==n){n=this.scale,a=this.translate;var s=e.origin;null!=(i=this.graph.getCellGeometry(e.cell).getTerminalPoint(t))&&(i=new mxPoint(n*(a.x+i.x+s.x),n*(a.y+i.y+s.y)))}e.setAbsoluteTerminalPoint(i,t)},mxGraphView.prototype.updatePoints=function(e,n,t,a){if(null!=e){var i=[];i.push(e.absolutePoints[0]);var s=this.getEdgeStyle(e,n,t,a);if(null!=s)s(e,t=this.getTerminalPort(e,t,!0),a=this.getTerminalPort(e,a,!1),n,i);else if(null!=n)for(s=0;s<n.length;s++)null!=n[s]&&(a=mxUtils.clone(n[s]),i.push(this.transformControlPoint(e,a)));n=e.absolutePoints,i.push(n[n.length-1]),e.absolutePoints=i}},mxGraphView.prototype.transformControlPoint=function(e,n){var t=e.origin;return new mxPoint(this.scale*(n.x+this.translate.x+t.x),this.scale*(n.y+this.translate.y+t.y))},mxGraphView.prototype.getEdgeStyle=function(e,n,t,a){return"string"==typeof(e=null!=t&&t==a?mxUtils.getValue(e.style,mxConstants.STYLE_LOOP,this.graph.defaultLoopStyle):mxUtils.getValue(e.style,mxConstants.STYLE_NOEDGESTYLE,!1)?null:e.style[mxConstants.STYLE_EDGE])&&(null==(n=mxStyleRegistry.getValue(e))&&this.isAllowEval()&&(n=mxUtils.eval(e)),e=n),"function"==typeof e?e:null},mxGraphView.prototype.updateFloatingTerminalPoints=function(e,n,t){var a=e.absolutePoints,i=a[0];null==a[a.length-1]&&null!=t&&this.updateFloatingTerminalPoint(e,t,n,!1),null==i&&null!=n&&this.updateFloatingTerminalPoint(e,n,t,!0)},mxGraphView.prototype.updateFloatingTerminalPoint=function(e,n,t,a){n=this.getTerminalPort(e,n,a);var i=this.getNextPoint(e,t,a),s=this.graph.isOrthogonal(e);t=mxUtils.toRadians(Number(n.style[mxConstants.STYLE_ROTATION]||"0"));var o=new mxPoint(n.getCenterX(),n.getCenterY());if(0!=t){var r=Math.cos(-t),l=Math.sin(-t);i=mxUtils.getRotatedPoint(i,r,l,o)}r=parseFloat(e.style[mxConstants.STYLE_PERIMETER_SPACING]||0),r+=parseFloat(e.style[a?mxConstants.STYLE_SOURCE_PERIMETER_SPACING:mxConstants.STYLE_TARGET_PERIMETER_SPACING]||0),n=this.getPerimeterPoint(n,i,0==t&&s,r),0!=t&&(r=Math.cos(t),l=Math.sin(t),n=mxUtils.getRotatedPoint(n,r,l,o)),e.setAbsoluteTerminalPoint(n,a)},mxGraphView.prototype.getTerminalPort=function(e,n,t){return null!=(e=mxUtils.getValue(e.style,t?mxConstants.STYLE_SOURCE_PORT:mxConstants.STYLE_TARGET_PORT))&&(null!=(e=this.getState(this.graph.getModel().getCell(e)))&&(n=e)),n},mxGraphView.prototype.getPerimeterPoint=function(e,n,t,a){var i=null;if(null!=e){var s=this.getPerimeterFunction(e);null!=s&&null!=n&&(0<(a=this.getPerimeterBounds(e,a)).width||0<a.height)&&(i=s(a,e,n,t)),null==i&&(i=this.getPoint(e))}return i},mxGraphView.prototype.getRoutingCenterX=function(e){var n=null!=e.style&&parseFloat(e.style[mxConstants.STYLE_ROUTING_CENTER_X])||0;return e.getCenterX()+n*e.width},mxGraphView.prototype.getRoutingCenterY=function(e){var n=null!=e.style&&parseFloat(e.style[mxConstants.STYLE_ROUTING_CENTER_Y])||0;return e.getCenterY()+n*e.height},mxGraphView.prototype.getPerimeterBounds=function(e,n){return n=null!=n?n:0,null!=e&&(n+=parseFloat(e.style[mxConstants.STYLE_PERIMETER_SPACING]||0)),e.getPerimeterBounds(n*this.scale)},mxGraphView.prototype.getPerimeterFunction=function(e){if("string"==typeof(e=e.style[mxConstants.STYLE_PERIMETER])){var n=mxStyleRegistry.getValue(e);null==n&&this.isAllowEval()&&(n=mxUtils.eval(e)),e=n}return"function"==typeof e?e:null},mxGraphView.prototype.getNextPoint=function(e,n,t){var a=null;return null!=(e=e.absolutePoints)&&(t||2<e.length||null==n)&&(a=e.length,a=e[t?Math.min(1,a-1):Math.max(0,a-2)]),null==a&&null!=n&&(a=new mxPoint(n.getCenterX(),n.getCenterY())),a},mxGraphView.prototype.getVisibleTerminal=function(e,n){for(var t=this.graph.getModel(),a=t.getTerminal(e,n),i=a;null!=a&&a!=this.currentRoot;)this.graph.isCellVisible(i)&&!this.graph.isCellCollapsed(a)||(i=a),a=t.getParent(a);return t.getParent(i)==t.getRoot()&&(i=null),i},mxGraphView.prototype.updateEdgeBounds=function(e){var n=e.absolutePoints;if(e.length=0,null!=n&&0<n.length){var t=n[0],a=n[n.length-1];if(null==t||null==a)e.cell!=this.currentRoot&&this.clear(e.cell,!0);else{if(t.x!=a.x||t.y!=a.y){var i=a.x-t.x,s=a.y-t.y;e.terminalDistance=Math.sqrt(i*i+s*s)}else e.terminalDistance=0;a=0;var o=[];if(null!=(s=t)){t=s.x;for(var r=s.y,l=t,d=r,c=1;c<n.length;c++){var m=n[c];null!=m&&(i=s.x-m.x,s=s.y-m.y,i=Math.sqrt(i*i+s*s),o.push(i),a+=i,s=m,t=Math.min(s.x,t),r=Math.min(s.y,r),l=Math.max(s.x,l),d=Math.max(s.y,d))}e.length=a,e.segments=o,e.x=t,e.y=r,e.width=Math.max(1,l-t),e.height=Math.max(1,d-r)}}}},mxGraphView.prototype.getPoint=function(e,n){var t=e.getCenterX(),a=e.getCenterY();if(null==e.segments||null!=n&&!n.relative)null!=n&&(null!=(d=n.offset)&&(t+=d.x,a+=d.y));else{for(var i=e.absolutePoints.length,s=(.5+(null!=n?n.x/2:0))*e.length,o=e.segments[0],r=0,l=1;r+o<s&&l<i-1;)r+=o,o=e.segments[l++];if(i=0==o?0:(s-r)/o,s=e.absolutePoints[l-1],l=e.absolutePoints[l],null!=s&&null!=l){if(r=t=a=0,null!=n){a=n.y;var d=n.offset;null!=d&&(t=d.x,r=d.y)}d=l.x-s.x,l=l.y-s.y,t=s.x+d*i+((0==o?0:l/o)*a+t)*this.scale,a=s.y+l*i-((0==o?0:d/o)*a-r)*this.scale}}return new mxPoint(t,a)},mxGraphView.prototype.getRelativePoint=function(e,n,t){if(null!=(i=this.graph.getModel().getGeometry(e.cell))){var a=e.absolutePoints.length;if(i.relative&&1<a){for(var i=e.length,s=e.segments,o=e.absolutePoints[0],r=e.absolutePoints[1],l=mxUtils.ptSegDistSq(o.x,o.y,r.x,r.y,n,t),d=0,c=0,m=0,u=2;u<a;u++)c+=s[u-2],r=e.absolutePoints[u],(o=mxUtils.ptSegDistSq(o.x,o.y,r.x,r.y,n,t))<=l&&(l=o,d=u-1,m=c),o=r;return a=s[d],o=e.absolutePoints[d],l=(r=e.absolutePoints[d+1]).x,s=r.y,s=(l=(e=o.x-l)-(l=n-l))*e+(s=(d=o.y-s)-(s=t-s))*d,a<(e=Math.sqrt(s<=0?0:s*s/(e*e+d*d)))&&(e=a),a=Math.sqrt(mxUtils.ptSegDistSq(o.x,o.y,r.x,r.y,n,t)),-1==mxUtils.relativeCcw(o.x,o.y,r.x,r.y,n,t)&&(a=-a),new mxPoint((i/2-m-e)/i*-2,a/this.scale)}}return new mxPoint},mxGraphView.prototype.updateEdgeLabelOffset=function(e){var n=e.absolutePoints;if(e.absoluteOffset.x=e.getCenterX(),e.absoluteOffset.y=e.getCenterY(),null!=n&&0<n.length&&null!=e.segments)if((i=this.graph.getCellGeometry(e.cell)).relative){null!=(t=this.getPoint(e,i))&&(e.absoluteOffset=t)}else{var t=n[0],a=n[n.length-1];if(null!=t&&null!=a){n=a.x-t.x;var i,s=a.y-t.y,o=a=0;null!=(i=i.offset)&&(a=i.x,o=i.y),i=t.y+s/2+o*this.scale,e.absoluteOffset.x=t.x+n/2+a*this.scale,e.absoluteOffset.y=i}}},mxGraphView.prototype.getState=function(e,n){n=n||!1;var t=null;return null!=e&&(t=this.states.get(e),this.graph.isCellVisible(e)&&(null==t&&n&&this.graph.isCellVisible(e)?(t=this.createState(e),this.states.put(e,t)):n&&null!=t&&this.updateStyle&&(t.style=this.graph.getCellStyle(e)))),t},mxGraphView.prototype.isRendering=function(){return this.rendering},mxGraphView.prototype.setRendering=function(e){this.rendering=e},mxGraphView.prototype.isAllowEval=function(){return this.allowEval},mxGraphView.prototype.setAllowEval=function(e){this.allowEval=e},mxGraphView.prototype.getStates=function(){return this.states},mxGraphView.prototype.setStates=function(e){this.states=e},mxGraphView.prototype.getCellStates=function(e){if(null==e)return this.states;for(var n=[],t=0;t<e.length;t++){var a=this.getState(e[t]);null!=a&&n.push(a)}return n},mxGraphView.prototype.removeState=function(e){var n=null;return null!=e&&(null!=(n=this.states.remove(e))&&(this.graph.cellRenderer.destroy(n),n.destroy())),n},mxGraphView.prototype.createState=function(e){var n=this.graph.getCellStyle(e);return e=new mxCellState(this,e,n),this.graph.cellRenderer.initialize(e,this.isRendering()),e},mxGraphView.prototype.getCanvas=function(){return this.canvas},mxGraphView.prototype.getBackgroundPane=function(){return this.backgroundPane},mxGraphView.prototype.getDrawPane=function(){return this.drawPane},mxGraphView.prototype.getOverlayPane=function(){return this.overlayPane},mxGraphView.prototype.isContainerEvent=function(e){return(e=mxEvent.getSource(e))==this.graph.container||e.parentNode==this.backgroundPane||null!=e.parentNode&&e.parentNode.parentNode==this.backgroundPane||e==this.canvas.parentNode||e==this.canvas||e==this.backgroundPane||e==this.drawPane||e==this.overlayPane},mxGraphView.prototype.isScrollEvent=function(e){var n=mxUtils.getOffset(this.graph.container);e=new mxPoint(e.clientX-n.x,e.clientY-n.y);n=this.graph.container.offsetWidth;var t=this.graph.container.clientWidth;return t<n&&e.x>t+2&&e.x<=n||(n=this.graph.container.offsetHeight,(t=this.graph.container.clientHeight)<n&&e.y>t+2&&e.y<=n)},mxGraphView.prototype.init=function(){this.installListeners();var e=this.graph;e.dialect==mxConstants.DIALECT_SVG?this.createSvg():e.dialect==mxConstants.DIALECT_VML?this.createVml():this.createHtml()},mxGraphView.prototype.installListeners=function(){var a=this.graph,i=a.container;if(null!=i){mxEvent.addGestureListeners(i,mxUtils.bind(this,function(e){mxClient.IS_TOUCH&&a.isEditing()&&a.stopEditing(!a.isInvokesStopCellEditing()),this.isContainerEvent(e)&&(!mxClient.IS_IE&&!mxClient.IS_GC&&!mxClient.IS_OP&&!mxClient.IS_SF||!this.isScrollEvent(e))&&a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.isContainerEvent(e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.isContainerEvent(e)&&a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))})),mxEvent.addListener(i,"dblclick",mxUtils.bind(this,function(e){a.dblClick(e)}));a.addMouseListener({mouseDown:function(e,n){a.panningHandler.hideMenu()},mouseMove:function(){},mouseUp:function(){}}),this.moveHandler=mxUtils.bind(this,function(e){var n,t;null!=a.tooltipHandler&&a.tooltipHandler.isHideOnHover()&&a.tooltipHandler.hide(),this.captureDocumentGesture&&a.isMouseDown&&!mxEvent.isConsumed(e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,(n=e,t=null,mxClient.IS_TOUCH&&(t=mxEvent.getClientX(n),n=mxEvent.getClientY(n),n=mxUtils.convertPoint(i,t,n),t=a.view.getState(a.getCellAt(n.x,n.y))),t)))}),this.endHandler=mxUtils.bind(this,function(e){this.captureDocumentGesture&&a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))}),mxEvent.addGestureListeners(document,null,this.moveHandler,this.endHandler)}},mxGraphView.prototype.createHtml=function(){var e=this.graph.container;null!=e&&(this.canvas=this.createHtmlPane("100%","100%"),this.backgroundPane=this.createHtmlPane("1px","1px"),this.drawPane=this.createHtmlPane("1px","1px"),this.overlayPane=this.createHtmlPane("1px","1px"),this.canvas.appendChild(this.backgroundPane),this.canvas.appendChild(this.drawPane),this.canvas.appendChild(this.overlayPane),e.appendChild(this.canvas),mxClient.IS_QUIRKS&&(e=mxUtils.bind(this,function(e){e=this.getGraphBounds(),this.updateHtmlCanvasSize(e.x+e.width+this.graph.border,e.y+e.height+this.graph.border)}),mxEvent.addListener(window,"resize",e)))},mxGraphView.prototype.updateHtmlCanvasSize=function(e,n){if(null!=this.graph.container){var t=this.graph.container.offsetHeight;this.canvas.style.width=this.graph.container.offsetWidth<e?e+"px":"100%",this.canvas.style.height=t<n?n+"px":"100%"}},mxGraphView.prototype.createHtmlPane=function(e,n){var t=document.createElement("DIV");return null!=e&&null!=n?(t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.width=e,t.style.height=n):t.style.position="relative",t},mxGraphView.prototype.createVml=function(){var e=this.graph.container;if(null!=e){var n=e.offsetWidth,t=e.offsetHeight;this.canvas=this.createVmlPane(n,t),this.backgroundPane=this.createVmlPane(n,t),this.drawPane=this.createVmlPane(n,t),this.overlayPane=this.createVmlPane(n,t),this.canvas.appendChild(this.backgroundPane),this.canvas.appendChild(this.drawPane),this.canvas.appendChild(this.overlayPane),e.appendChild(this.canvas)}},mxGraphView.prototype.createVmlPane=function(e,n){var t=document.createElement(mxClient.VML_PREFIX+":group");return t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.width=e+"px",t.style.height=n+"px",t.setAttribute("coordsize",e+","+n),t.setAttribute("coordorigin","0,0"),t},mxGraphView.prototype.createSvg=function(){var e=this.graph.container;this.canvas=document.createElementNS(mxConstants.NS_SVG,"g"),this.backgroundPane=document.createElementNS(mxConstants.NS_SVG,"g"),this.canvas.appendChild(this.backgroundPane),this.drawPane=document.createElementNS(mxConstants.NS_SVG,"g"),this.canvas.appendChild(this.drawPane),this.overlayPane=document.createElementNS(mxConstants.NS_SVG,"g"),this.canvas.appendChild(this.overlayPane);var n=document.createElementNS(mxConstants.NS_SVG,"svg");n.style.width="100%",n.style.height="100%",n.style.display="block",n.appendChild(this.canvas),null!=e&&(e.appendChild(n),"static"==mxUtils.getCurrentStyle(e).position&&(e.style.position="relative"))},mxGraphView.prototype.destroy=function(){var e=null!=this.canvas?this.canvas.ownerSVGElement:null;null==e&&(e=this.canvas),null!=e&&null!=e.parentNode&&(this.clear(this.currentRoot,!0),mxEvent.removeGestureListeners(document,null,this.moveHandler,this.endHandler),mxEvent.release(this.graph.container),e.parentNode.removeChild(e),this.overlayPane=this.drawPane=this.backgroundPane=this.canvas=this.endHandler=this.moveHandler=null)},mxCurrentRootChange.prototype.execute=function(){var e=this.view.currentRoot;this.view.currentRoot=this.previous,this.previous=e,null!=(e=this.view.graph.getTranslateForRoot(this.view.currentRoot))&&(this.view.translate=new mxPoint(-e.x,-e.y)),this.view.fireEvent(new mxEventObject(this.isUp?mxEvent.UP:mxEvent.DOWN,"root",this.view.currentRoot,"previous",this.previous)),this.isUp?(this.view.clear(this.view.currentRoot,!0),this.view.validate()):this.view.refresh(),this.isUp=!this.isUp},mxLoadResources&&mxResources.add(mxClient.basePath+"/resources/graph"),mxGraph.prototype=new mxEventSource,mxGraph.prototype.constructor=mxGraph,mxGraph.prototype.EMPTY_ARRAY=[],mxGraph.prototype.mouseListeners=null,mxGraph.prototype.isMouseDown=!1,mxGraph.prototype.model=null,mxGraph.prototype.view=null,mxGraph.prototype.stylesheet=null,mxGraph.prototype.selectionModel=null,mxGraph.prototype.cellEditor=null,mxGraph.prototype.cellRenderer=null,mxGraph.prototype.multiplicities=null,mxGraph.prototype.renderHint=null,mxGraph.prototype.dialect=null,mxGraph.prototype.gridSize=10,mxGraph.prototype.gridEnabled=!0,mxGraph.prototype.portsEnabled=!0,mxGraph.prototype.doubleTapEnabled=!0,mxGraph.prototype.doubleTapTimeout=700,mxGraph.prototype.doubleTapTolerance=25,mxGraph.prototype.lastTouchY=0,mxGraph.prototype.lastTouchY=0,mxGraph.prototype.lastTouchTime=0,mxGraph.prototype.gestureEnabled=!0,mxGraph.prototype.tolerance=4,mxGraph.prototype.defaultOverlap=.5,mxGraph.prototype.defaultParent=null,mxGraph.prototype.alternateEdgeStyle=null,mxGraph.prototype.backgroundImage=null,mxGraph.prototype.pageVisible=!1,mxGraph.prototype.pageBreaksVisible=!1,mxGraph.prototype.pageBreakColor="gray",mxGraph.prototype.pageBreakDashed=!0,mxGraph.prototype.minPageBreakDist=20,mxGraph.prototype.preferPageSize=!1,mxGraph.prototype.pageFormat=mxConstants.PAGE_FORMAT_A4_PORTRAIT,mxGraph.prototype.pageScale=1.5,mxGraph.prototype.enabled=!0,mxGraph.prototype.escapeEnabled=!0,mxGraph.prototype.invokesStopCellEditing=!0,mxGraph.prototype.enterStopsCellEditing=!1,mxGraph.prototype.useScrollbarsForPanning=!0,mxGraph.prototype.exportEnabled=!0,mxGraph.prototype.importEnabled=!0,mxGraph.prototype.cellsLocked=!1,mxGraph.prototype.cellsCloneable=!0,mxGraph.prototype.foldingEnabled=!0,mxGraph.prototype.cellsEditable=!0,mxGraph.prototype.cellsDeletable=!0,mxGraph.prototype.cellsMovable=!0,mxGraph.prototype.edgeLabelsMovable=!0,mxGraph.prototype.vertexLabelsMovable=!1,mxGraph.prototype.dropEnabled=!1,mxGraph.prototype.splitEnabled=!0,mxGraph.prototype.cellsResizable=!0,mxGraph.prototype.cellsBendable=!0,mxGraph.prototype.cellsSelectable=!0,mxGraph.prototype.cellsDisconnectable=!0,mxGraph.prototype.autoSizeCells=!1,mxGraph.prototype.autoScroll=!0,mxGraph.prototype.timerAutoScroll=!1,mxGraph.prototype.allowAutoPanning=!1,mxGraph.prototype.ignoreScrollbars=!1,mxGraph.prototype.autoExtend=!0,mxGraph.prototype.maximumGraphBounds=null,mxGraph.prototype.minimumGraphSize=null,mxGraph.prototype.minimumContainerSize=null,mxGraph.prototype.maximumContainerSize=null,mxGraph.prototype.resizeContainer=!1,mxGraph.prototype.border=0,mxGraph.prototype.ordered=!0,mxGraph.prototype.keepEdgesInForeground=!1,mxGraph.prototype.keepEdgesInBackground=!0,mxGraph.prototype.allowNegativeCoordinates=!0,mxGraph.prototype.constrainChildren=!0,mxGraph.prototype.extendParents=!0,mxGraph.prototype.extendParentsOnAdd=!0,mxGraph.prototype.collapseToPreferredSize=!0,mxGraph.prototype.zoomFactor=1.2,mxGraph.prototype.keepSelectionVisibleOnZoom=!1,mxGraph.prototype.centerZoom=!0,mxGraph.prototype.resetViewOnRootChange=!0,mxGraph.prototype.resetEdgesOnResize=!1,mxGraph.prototype.resetEdgesOnMove=!1,mxGraph.prototype.resetEdgesOnConnect=!0,mxGraph.prototype.allowLoops=!1,mxGraph.prototype.defaultLoopStyle=mxEdgeStyle.Loop,mxGraph.prototype.multigraph=!0,mxGraph.prototype.connectableEdges=!1,mxGraph.prototype.allowDanglingEdges=!0,mxGraph.prototype.cloneInvalidEdges=!1,mxGraph.prototype.disconnectOnMove=!0,mxGraph.prototype.labelsVisible=!0,mxGraph.prototype.htmlLabels=!1,mxGraph.prototype.swimlaneSelectionEnabled=!0,mxGraph.prototype.swimlaneNesting=!0,mxGraph.prototype.swimlaneIndicatorColorAttribute=mxConstants.STYLE_FILLCOLOR,mxGraph.prototype.imageBundles=null,mxGraph.prototype.minFitScale=.1,mxGraph.prototype.maxFitScale=8,mxGraph.prototype.panDx=0,mxGraph.prototype.panDy=0,mxGraph.prototype.collapsedImage=new mxImage(mxClient.imageBasePath+"/collapsed.gif",9,9),mxGraph.prototype.expandedImage=new mxImage(mxClient.imageBasePath+"/expanded.gif",9,9),mxGraph.prototype.warningImage=new mxImage("/assets/plugins/mxgraph/images/warning.gif",16,16),mxGraph.prototype.alreadyConnectedResource="none"!=mxClient.language?"alreadyConnected":"",mxGraph.prototype.containsValidationErrorsResource="none"!=mxClient.language?"containsValidationErrors":"",mxGraph.prototype.collapseExpandResource="none"!=mxClient.language?"collapse-expand":"",mxGraph.prototype.init=function(e){this.container=e,this.cellEditor=this.createCellEditor(),this.view.init(),this.sizeDidChange(),mxClient.IS_IE&&(mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})),mxEvent.addListener(e,"selectstart",mxUtils.bind(this,function(){return this.isEditing()}))),8==document.documentMode&&e.insertAdjacentHTML("beforeend",'<v:group style="DISPLAY: none;"></v:group>')},mxGraph.prototype.createHandlers=function(e){this.tooltipHandler=new mxTooltipHandler(this),this.tooltipHandler.setEnabled(!1),this.panningHandler=new mxPanningHandler(this),this.panningHandler.panningEnabled=!1,this.selectionCellsHandler=new mxSelectionCellsHandler(this),this.connectionHandler=new mxConnectionHandler(this),this.connectionHandler.setEnabled(!1),this.graphHandler=new mxGraphHandler(this)},mxGraph.prototype.createSelectionModel=function(){return new mxGraphSelectionModel(this)},mxGraph.prototype.createStylesheet=function(){return new mxStylesheet},mxGraph.prototype.createGraphView=function(){return new mxGraphView(this)},mxGraph.prototype.createCellRenderer=function(){return new mxCellRenderer},mxGraph.prototype.createCellEditor=function(){return new mxCellEditor(this)},mxGraph.prototype.getModel=function(){return this.model},mxGraph.prototype.getView=function(){return this.view},mxGraph.prototype.getStylesheet=function(){return this.stylesheet},mxGraph.prototype.setStylesheet=function(e){this.stylesheet=e},mxGraph.prototype.getSelectionModel=function(){return this.selectionModel},mxGraph.prototype.setSelectionModel=function(e){this.selectionModel=e},mxGraph.prototype.getSelectionCellsForChanges=function(e){for(var n=[],t=0;t<e.length;t++){var a=e[t];if(a.constructor!=mxRootChange){var i=null;a instanceof mxChildChange&&null==a.previous?i=a.child:null!=a.cell&&a.cell instanceof mxCell&&(i=a.cell),null!=i&&mxUtils.indexOf(n,i)<0&&n.push(i)}}return this.getModel().getTopmostCells(n)},mxGraph.prototype.graphModelChanged=function(e){for(var n=0;n<e.length;n++)this.processChange(e[n]);this.removeSelectionCells(this.getRemovedCellsForChanges(e)),this.view.validate(),this.sizeDidChange()},mxGraph.prototype.getRemovedCellsForChanges=function(e){for(var n=[],t=0;t<e.length;t++){var a=e[t];if(a instanceof mxRootChange)break;a instanceof mxChildChange?null!=a.previous&&null==a.parent&&(n=n.concat(this.model.getDescendants(a.child))):a instanceof mxVisibleChange&&(n=n.concat(this.model.getDescendants(a.cell)))}return n},mxGraph.prototype.processChange=function(e){if(e instanceof mxRootChange)this.clearSelection(),this.removeStateForCell(e.previous),this.resetViewOnRootChange&&(this.view.scale=1,this.view.translate.x=0,this.view.translate.y=0),this.fireEvent(new mxEventObject(mxEvent.ROOT));else if(e instanceof mxChildChange){var n=this.model.getParent(e.child);null!=n?this.view.invalidate(e.child,!0,!1,null!=e.previous):(this.removeStateForCell(e.child),this.view.currentRoot==e.child&&this.home()),n!=e.previous&&(null!=n&&this.view.invalidate(n,!1,!1),null!=e.previous&&this.view.invalidate(e.previous,!1,!1))}else e instanceof mxTerminalChange||e instanceof mxGeometryChange?this.view.invalidate(e.cell):e instanceof mxValueChange?this.view.invalidate(e.cell,!1,!1):e instanceof mxStyleChange?(this.view.invalidate(e.cell,!0,!0,!1),this.view.removeState(e.cell)):null!=e.cell&&e.cell instanceof mxCell&&this.removeStateForCell(e.cell)},mxGraph.prototype.removeStateForCell=function(e){for(var n=this.model.getChildCount(e),t=0;t<n;t++)this.removeStateForCell(this.model.getChildAt(e,t));this.view.removeState(e)},mxGraph.prototype.addCellOverlay=function(e,n){null==e.overlays&&(e.overlays=[]),e.overlays.push(n);var t=this.view.getState(e);return null!=t&&this.cellRenderer.redraw(t),this.fireEvent(new mxEventObject(mxEvent.ADD_OVERLAY,"cell",e,"overlay",n)),n},mxGraph.prototype.getCellOverlays=function(e){return e.overlays},mxGraph.prototype.removeCellOverlay=function(e,n){if(null==n)this.removeCellOverlays(e);else{var t=mxUtils.indexOf(e.overlays,n);0<=t?(e.overlays.splice(t,1),0==e.overlays.length&&(e.overlays=null),null!=(t=this.view.getState(e))&&this.cellRenderer.redraw(t),this.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY,"cell",e,"overlay",n))):n=null}return n},mxGraph.prototype.removeCellOverlays=function(e){var n=e.overlays;if(null!=n){e.overlays=null;var t=this.view.getState(e);for(null!=t&&this.cellRenderer.redraw(t),t=0;t<n.length;t++)this.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY,"cell",e,"overlay",n[t]))}return n},mxGraph.prototype.clearCellOverlays=function(e){e=null!=e?e:this.model.getRoot(),this.removeCellOverlays(e);for(var n=this.model.getChildCount(e),t=0;t<n;t++){var a=this.model.getChildAt(e,t);this.clearCellOverlays(a)}},mxGraph.prototype.setCellWarning=function(t,e,n,a){return null!=e&&0<e.length?(e=new mxCellOverlay(n=null!=n?n:this.warningImage,"<font color=red>"+e+"</font>"),a&&e.addListener(mxEvent.CLICK,mxUtils.bind(this,function(e,n){this.isEnabled()&&this.setSelectionCell(t)})),this.addCellOverlay(t,e)):(this.removeCellOverlays(t),null)},mxGraph.prototype.startEditing=function(e){this.startEditingAtCell(null,e)},mxGraph.prototype.startEditingAtCell=function(e,n){null==e&&(null!=(e=this.getSelectionCell())&&!this.isCellEditable(e)&&(e=null)),null!=e&&(this.fireEvent(new mxEventObject(mxEvent.START_EDITING,"cell",e,"event",n)),this.cellEditor.startEditing(e,n))},mxGraph.prototype.getEditingValue=function(e,n){return this.convertValueToString(e)},mxGraph.prototype.stopEditing=function(e){this.cellEditor.stopEditing(e)},mxGraph.prototype.labelChanged=function(e,n,t){this.model.beginUpdate();try{this.cellLabelChanged(e,n,this.isAutoSizeCell(e)),this.fireEvent(new mxEventObject(mxEvent.LABEL_CHANGED,"cell",e,"value",n,"event",t))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellLabelChanged=function(e,n,t){this.model.beginUpdate();try{this.model.setValue(e,n),t&&this.cellSizeUpdated(e,!1)}finally{this.model.endUpdate()}},mxGraph.prototype.escape=function(e){this.stopEditing(!0),this.connectionHandler.reset(),this.graphHandler.reset(),e=this.getSelectionCells();for(var n=0;n<e.length;n++){var t=this.view.getState(e[n]);null!=t&&null!=t.handler&&t.handler.reset()}},mxGraph.prototype.click=function(e){var n=e.getEvent(),t=e.getCell(),a=new mxEventObject(mxEvent.CLICK,"event",n,"cell",t);e.isConsumed()&&a.consume(),this.fireEvent(a),this.isEnabled()&&!mxEvent.isConsumed(n)&&!a.isConsumed()&&(null!=t?this.selectCellForEvent(t,n):(t=null,this.isSwimlaneSelectionEnabled()&&(t=this.getSwimlaneAt(e.getGraphX(),e.getGraphY())),null!=t?this.selectCellForEvent(t,n):this.isToggleEvent(n)||this.clearSelection()))},mxGraph.prototype.dblClick=function(e,n){var t=new mxEventObject(mxEvent.DOUBLE_CLICK,"event",e,"cell",n);this.fireEvent(t),this.isEnabled()&&!mxEvent.isConsumed(e)&&!t.isConsumed()&&null!=n&&this.isCellEditable(n)&&this.startEditingAtCell(n,e)},mxGraph.prototype.scrollPointToVisible=function(e,n,t,a){if(this.timerAutoScroll||!this.ignoreScrollbars&&!mxUtils.hasScrollbars(this.container))this.allowAutoPanning&&!this.panningHandler.active&&(null==this.panningManager&&(this.panningManager=this.createPanningManager()),this.panningManager.panTo(e+this.panDx,n+this.panDy));else{var i=this.container;if(a=null!=a?a:20,e>=i.scrollLeft&&n>=i.scrollTop&&e<=i.scrollLeft+i.clientWidth&&n<=i.scrollTop+i.clientHeight){var s=i.scrollLeft+i.clientWidth-e;if(s<a){if(e=i.scrollLeft,i.scrollLeft+=a-s,t&&e==i.scrollLeft){if(this.dialect==mxConstants.DIALECT_SVG){e=this.view.getDrawPane().ownerSVGElement;var o=this.container.scrollWidth+a-s}else o=Math.max(i.clientWidth,i.scrollWidth)+a-s,e=this.view.getCanvas();e.style.width=o+"px",i.scrollLeft+=a-s}}else(s=e-i.scrollLeft)<a&&(i.scrollLeft-=a-s);(s=i.scrollTop+i.clientHeight-n)<a?(e=i.scrollTop,i.scrollTop+=a-s,e==i.scrollTop&&t&&(this.dialect==mxConstants.DIALECT_SVG?(e=this.view.getDrawPane().ownerSVGElement,n=this.container.scrollHeight+a-s):(n=Math.max(i.clientHeight,i.scrollHeight)+a-s,e=this.view.getCanvas()),e.style.height=n+"px",i.scrollTop+=a-s)):(s=n-i.scrollTop)<a&&(i.scrollTop-=a-s)}}},mxGraph.prototype.createPanningManager=function(){return new mxPanningManager(this)},mxGraph.prototype.getBorderSizes=function(){function e(e){var n=0;n="thin"==e?2:"medium"==e?4:"thick"==e?6:parseInt(e);return isNaN(n)&&(n=0),n}var n=mxUtils.getCurrentStyle(this.container),t=new mxRectangle;return t.x=e(n.borderLeftWidth)+parseInt(n.paddingLeft||0),t.y=e(n.borderTopWidth)+parseInt(n.paddingTop||0),t.width=e(n.borderRightWidth)+parseInt(n.paddingRight||0),t.height=e(n.borderBottomWidth)+parseInt(n.paddingBottom||0),t},mxGraph.prototype.getPreferredPageSize=function(e,n,t){e=this.view.scale;var a=this.view.translate,i=this.pageFormat,s=e*this.pageScale;i=new mxRectangle(0,0,i.width*s,i.height*s);return n=this.pageBreaksVisible?Math.ceil(n/i.width):1,t=this.pageBreaksVisible?Math.ceil(t/i.height):1,new mxRectangle(0,0,n*i.width+2+a.x/e,t*i.height+2+a.y/e)},mxGraph.prototype.sizeDidChange=function(){var e=this.getGraphBounds();if(null!=this.container){var n=this.getBorder(),t=Math.max(0,e.x+e.width+1+n);n=Math.max(0,e.y+e.height+1+n);if(null!=this.minimumContainerSize&&(t=Math.max(t,this.minimumContainerSize.width),n=Math.max(n,this.minimumContainerSize.height)),this.resizeContainer&&this.doResizeContainer(t,n),this.preferPageSize||!mxClient.IS_IE&&this.pageVisible){var a=this.getPreferredPageSize(e,t,n);null!=a&&(t=a.width,n=a.height)}null!=this.minimumGraphSize&&(t=Math.max(t,this.minimumGraphSize.width*this.view.scale),n=Math.max(n,this.minimumGraphSize.height*this.view.scale)),t=Math.ceil(t-1),n=Math.ceil(n-1),this.dialect==mxConstants.DIALECT_SVG?((a=this.view.getDrawPane().ownerSVGElement).style.minWidth=Math.max(1,t)+"px",a.style.minHeight=Math.max(1,n)+"px",a.style.width="100%",a.style.height="100%"):mxClient.IS_QUIRKS?this.view.updateHtmlCanvasSize(Math.max(1,t),Math.max(1,n)):(this.view.canvas.style.minWidth=Math.max(1,t)+"px",this.view.canvas.style.minHeight=Math.max(1,n)+"px"),this.updatePageBreaks(this.pageBreaksVisible,t-1,n-1)}this.fireEvent(new mxEventObject(mxEvent.SIZE,"bounds",e))},mxGraph.prototype.doResizeContainer=function(e,n){if(mxClient.IS_IE)if(mxClient.IS_QUIRKS){var t=this.getBorderSizes();e+=Math.max(2,t.x+t.width+1),n+=Math.max(2,t.y+t.height+1)}else 9<=document.documentMode?(e+=3,n+=5):(e+=1,n+=1);else n+=1;null!=this.maximumContainerSize&&(e=Math.min(this.maximumContainerSize.width,e),n=Math.min(this.maximumContainerSize.height,n)),this.container.style.width=Math.ceil(e)+"px",this.container.style.height=Math.ceil(n)+"px"},mxGraph.prototype.updatePageBreaks=function(e,n,t){var a=this.view.scale,i=this.view.translate,s=this.pageFormat,o=a*this.pageScale;i=new mxRectangle(a*i.x,a*i.y,s.width*o,s.height*o);if(e=e&&Math.min(i.width,i.height)>this.minPageBreakDist,i.x=mxUtils.mod(i.x,i.width),i.y=mxUtils.mod(i.y,i.height),s=e?Math.ceil((n-i.x)/i.width):0,e=e?Math.ceil((t-i.y)/i.height):0,null==this.horizontalPageBreaks&&0<s&&(this.horizontalPageBreaks=[]),null!=this.horizontalPageBreaks){for(o=0;o<=s;o++){var r=[new mxPoint(i.x+o*i.width,1),new mxPoint(i.x+o*i.width,t)];null!=this.horizontalPageBreaks[o]?(this.horizontalPageBreaks[o].scale=1,this.horizontalPageBreaks[o].points=r,this.horizontalPageBreaks[o].redraw()):((r=new mxPolyline(r,this.pageBreakColor,this.scale)).dialect=this.dialect,r.isDashed=this.pageBreakDashed,r.scale=a,r.init(this.view.backgroundPane),r.redraw(),this.horizontalPageBreaks[o]=r)}for(o=s;o<this.horizontalPageBreaks.length;o++)this.horizontalPageBreaks[o].destroy();this.horizontalPageBreaks.splice(s,this.horizontalPageBreaks.length-s)}if(null==this.verticalPageBreaks&&0<e&&(this.verticalPageBreaks=[]),null!=this.verticalPageBreaks){for(o=0;o<=e;o++)r=[new mxPoint(1,i.y+o*i.height),new mxPoint(n,i.y+o*i.height)],null!=this.verticalPageBreaks[o]?(this.verticalPageBreaks[o].scale=1,this.verticalPageBreaks[o].points=r,this.verticalPageBreaks[o].redraw()):((r=new mxPolyline(r,this.pageBreakColor,a)).dialect=this.dialect,r.isDashed=this.pageBreakDashed,r.scale=a,r.init(this.view.backgroundPane),r.redraw(),this.verticalPageBreaks[o]=r);for(o=e;o<this.verticalPageBreaks.length;o++)this.verticalPageBreaks[o].destroy();this.verticalPageBreaks.splice(e,this.verticalPageBreaks.length-e)}},mxGraph.prototype.getCellStyle=function(e){var n=this.model.getStyle(e),t=null;t=this.model.isEdge(e)?this.stylesheet.getDefaultEdgeStyle():this.stylesheet.getDefaultVertexStyle();return null!=n&&(t=this.postProcessCellStyle(this.stylesheet.getCellStyle(n,t))),null==t&&(t=mxGraph.prototype.EMPTY_ARRAY),t},mxGraph.prototype.postProcessCellStyle=function(e){if(null!=e){var n=e[mxConstants.STYLE_IMAGE],t=this.getImageFromBundles(n);null!=t?e[mxConstants.STYLE_IMAGE]=t:t=n,null!=t&&"data:image/"==t.substring(0,11)&&(0<(n=t.indexOf(","))&&(t=t.substring(0,n)+";base64,"+t.substring(n+1)),e[mxConstants.STYLE_IMAGE]=t)}return e},mxGraph.prototype.setCellStyle=function(e,n){if(null!=(n=n||this.getSelectionCells())){this.model.beginUpdate();try{for(var t=0;t<n.length;t++)this.model.setStyle(n[t],e)}finally{this.model.endUpdate()}}},mxGraph.prototype.toggleCellStyle=function(e,n,t){t=t||this.getSelectionCell(),this.toggleCellStyles(e,n,[t])},mxGraph.prototype.toggleCellStyles=function(e,n,t){var a;(n=null!=n&&n,null!=(t=t||this.getSelectionCells())&&0<t.length)&&(null!=(a=null!=(a=this.view.getState(t[0]))?a.style:this.getCellStyle(t[0]))&&(n=mxUtils.getValue(a,e,n)?0:1,this.setCellStyles(e,n,t)))},mxGraph.prototype.setCellStyles=function(e,n,t){t=t||this.getSelectionCells(),mxUtils.setCellStyles(this.model,t,e,n)},mxGraph.prototype.toggleCellStyleFlags=function(e,n,t){this.setCellStyleFlags(e,n,null,t)},mxGraph.prototype.setCellStyleFlags=function(e,n,t,a){if(null!=(a=a||this.getSelectionCells())&&0<a.length){var i;if(null==t)null!=(i=null!=(i=this.view.getState(a[0]))?i.style:this.getCellStyle(a[0]))&&(t=(parseInt(i[e]||0)&n)!=n);mxUtils.setCellStyleFlags(this.model,a,e,n,t)}},mxGraph.prototype.alignCells=function(e,n,t){if(null==n&&(n=this.getSelectionCells()),null!=n&&1<n.length){if(null==t)for(var a=0;a<n.length;a++){var i=this.getCellGeometry(n[a]);if(null!=i&&!this.model.isEdge(n[a]))if(null==t){if(e==mxConstants.ALIGN_CENTER){t=i.x+i.width/2;break}if(e==mxConstants.ALIGN_RIGHT)t=i.x+i.width;else if(e==mxConstants.ALIGN_TOP)t=i.y;else{if(e==mxConstants.ALIGN_MIDDLE){t=i.y+i.height/2;break}t=e==mxConstants.ALIGN_BOTTOM?i.y+i.height:i.x}}else t=e==mxConstants.ALIGN_RIGHT?Math.max(t,i.x+i.width):e==mxConstants.ALIGN_TOP?Math.min(t,i.y):e==mxConstants.ALIGN_BOTTOM?Math.max(t,i.y+i.height):Math.min(t,i.x)}if(null!=t){this.model.beginUpdate();try{for(a=0;a<n.length;a++)null!=(i=this.getCellGeometry(n[a]))&&!this.model.isEdge(n[a])&&(i=i.clone(),e==mxConstants.ALIGN_CENTER?i.x=t-i.width/2:e==mxConstants.ALIGN_RIGHT?i.x=t-i.width:e==mxConstants.ALIGN_TOP?i.y=t:e==mxConstants.ALIGN_MIDDLE?i.y=t-i.height/2:e==mxConstants.ALIGN_BOTTOM?i.y=t-i.height:i.x=t,this.model.setGeometry(n[a],i));this.fireEvent(new mxEventObject(mxEvent.ALIGN_CELLS,"align",e,"cells",n))}finally{this.model.endUpdate()}}}return n},mxGraph.prototype.flipEdge=function(e){if(null!=e&&null!=this.alternateEdgeStyle){this.model.beginUpdate();try{var n=this.model.getStyle(e);null==n||0==n.length?this.model.setStyle(e,this.alternateEdgeStyle):this.model.setStyle(e,null),this.resetEdge(e),this.fireEvent(new mxEventObject(mxEvent.FLIP_EDGE,"edge",e))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.addImageBundle=function(e){this.imageBundles.push(e)},mxGraph.prototype.removeImageBundle=function(e){for(var n=[],t=0;t<this.imageBundles.length;t++)this.imageBundles[t]!=e&&n.push(this.imageBundles[t]);this.imageBundles=n},mxGraph.prototype.getImageFromBundles=function(e){if(null!=e)for(var n=0;n<this.imageBundles.length;n++){var t=this.imageBundles[n].getImage(e);if(null!=t)return t}return null},mxGraph.prototype.orderCells=function(e,n){null==n&&(n=mxUtils.sortCells(this.getSelectionCells(),!0)),this.model.beginUpdate();try{this.cellsOrdered(n,e),this.fireEvent(new mxEventObject(mxEvent.ORDER_CELLS,"back",e,"cells",n))}finally{this.model.endUpdate()}return n},mxGraph.prototype.cellsOrdered=function(e,n){if(null!=e){this.model.beginUpdate();try{for(var t=0;t<e.length;t++){var a=this.model.getParent(e[t]);n?this.model.add(a,e[t],t):this.model.add(a,e[t],this.model.getChildCount(a)-1)}this.fireEvent(new mxEventObject(mxEvent.CELLS_ORDERED,"back",n,"cells",e))}finally{this.model.endUpdate()}}},mxGraph.prototype.groupCells=function(e,n,t){null==t&&(t=mxUtils.sortCells(this.getSelectionCells(),!0)),t=this.getCellsForGroup(t),null==e&&(e=this.createGroupCell(t));var a=this.getBoundsForGroup(e,t,n);if(0<t.length&&null!=a){var i=this.model.getParent(e);null==i&&(i=this.model.getParent(t[0])),this.model.beginUpdate();try{null==this.getCellGeometry(e)&&this.model.setGeometry(e,new mxGeometry);var s=this.model.getChildCount(i);this.cellsAdded([e],i,s,null,null,!1),s=this.model.getChildCount(e),this.cellsAdded(t,e,s,null,null,!1,!1),this.cellsMoved(t,-a.x,-a.y,!1,!0),this.cellsResized([e],[a]),this.fireEvent(new mxEventObject(mxEvent.GROUP_CELLS,"group",e,"border",n,"cells",t))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.getCellsForGroup=function(e){var n=[];if(null!=e&&0<e.length){var t=this.model.getParent(e[0]);n.push(e[0]);for(var a=1;a<e.length;a++)this.model.getParent(e[a])==t&&n.push(e[a])}return n},mxGraph.prototype.getBoundsForGroup=function(e,n,t){return null!=(n=this.getBoundingBoxFromGeometry(n))&&(this.isSwimlane(e)&&(e=this.getStartSize(e),n.x-=e.width,n.y-=e.height,n.width+=e.width,n.height+=e.height),n.x-=t,n.y-=t,n.width+=2*t,n.height+=2*t),n},mxGraph.prototype.createGroupCell=function(e){return(e=new mxCell("")).setVertex(!0),e.setConnectable(!1),e},mxGraph.prototype.ungroupCells=function(e){var n=[];if(null==e){e=this.getSelectionCells();for(var t=[],a=0;a<e.length;a++)0<this.model.getChildCount(e[a])&&t.push(e[a]);e=t}if(null!=e&&0<e.length){this.model.beginUpdate();try{for(a=0;a<e.length;a++){if(null!=(i=this.model.getChildren(e[a]))&&0<i.length){var i=i.slice(),s=this.model.getParent(e[a]),o=this.model.getChildCount(s);this.cellsAdded(i,s,o,null,null,!0),n=n.concat(i)}}this.cellsRemoved(this.addAllEdges(e)),this.fireEvent(new mxEventObject(mxEvent.UNGROUP_CELLS,"cells",e))}finally{this.model.endUpdate()}}return n},mxGraph.prototype.removeCellsFromParent=function(e){null==e&&(e=this.getSelectionCells()),this.model.beginUpdate();try{var n=this.getDefaultParent(),t=this.model.getChildCount(n);this.cellsAdded(e,n,t,null,null,!0),this.fireEvent(new mxEventObject(mxEvent.REMOVE_CELLS_FROM_PARENT,"cells",e))}finally{this.model.endUpdate()}return e},mxGraph.prototype.updateGroupBounds=function(e,n,t){null==e&&(e=this.getSelectionCells()),n=null!=n?n:0,t=null!=t&&t,this.model.beginUpdate();try{for(var a=0;a<e.length;a++){if(null!=(r=this.getCellGeometry(e[a]))){var i=this.getChildCells(e[a]);if(null!=i&&0<i.length){var s=this.getBoundingBoxFromGeometry(i);if(0<s.width&&0<s.height){var o=this.isSwimlane(e[a])?this.getStartSize(e[a]):new mxRectangle,r=r.clone();t&&(r.x+=s.x-o.width-n,r.y+=s.y-o.height-n),r.width=s.width+o.width+2*n,r.height=s.height+o.height+2*n,this.model.setGeometry(e[a],r),this.moveCells(i,-s.x+o.width+n,-s.y+o.height+n)}}}}}finally{this.model.endUpdate()}return e},mxGraph.prototype.cloneCells=function(e,n){n=null==n||n;var t=null;if(null!=e){for(var a={},i=(t=[],0);i<e.length;i++){a[s=mxCellPath.create(e[i])]=e[i],t.push(e[i])}if(0<t.length){var s=this.view.scale,o=this.view.translate;for(t=this.model.cloneCells(e,!0),i=0;i<e.length;i++)if(!n&&this.model.isEdge(t[i])&&null!=this.getEdgeValidationError(t[i],this.model.getTerminal(t[i],!0),this.model.getTerminal(t[i],!1)))t[i]=null;else{var r=this.model.getGeometry(t[i]);if(null!=r){var l=this.view.getState(e[i]),d=this.view.getState(this.model.getParent(e[i]));if(null!=l&&null!=d){var c=d.origin.x;d=d.origin.y;if(this.model.isEdge(t[i])){l=l.absolutePoints;for(var m=this.model.getTerminal(e[i],!0),u=mxCellPath.create(m);null!=m&&null==a[u];)m=this.model.getParent(m),u=mxCellPath.create(m);for(null==m&&r.setTerminalPoint(new mxPoint(l[0].x/s-o.x,l[0].y/s-o.y),!0),m=this.model.getTerminal(e[i],!1),u=mxCellPath.create(m);null!=m&&null==a[u];)m=this.model.getParent(m),u=mxCellPath.create(m);if(null==m&&(m=l.length-1,r.setTerminalPoint(new mxPoint(l[m].x/s-o.x,l[m].y/s-o.y),!1)),null!=(r=r.points))for(l=0;l<r.length;l++)r[l].x+=c,r[l].y+=d}else r.x+=c,r.y+=d}}}}else t=[]}return t},mxGraph.prototype.insertVertex=function(e,n,t,a,i,s,o,r,l){return n=this.createVertex(e,n,t,a,i,s,o,r,l),this.addCell(n,e)},mxGraph.prototype.createVertex=function(e,n,t,a,i,s,o,r,l){return(e=new mxGeometry(a,i,s,o)).relative=null!=l&&l,(t=new mxCell(t,e,r)).setId(n),t.setVertex(!0),t.setConnectable(!0),t},mxGraph.prototype.insertEdge=function(e,n,t,a,i,s){return n=this.createEdge(e,n,t,a,i,s),this.addEdge(n,e,a,i)},mxGraph.prototype.createEdge=function(e,n,t,a,i,s){return(e=new mxCell(t,new mxGeometry,s)).setId(n),e.setEdge(!0),e.geometry.relative=!0,e},mxGraph.prototype.addEdge=function(e,n,t,a,i){return this.addCell(e,n,i,t,a)},mxGraph.prototype.addCell=function(e,n,t,a,i){return this.addCells([e],n,t,a,i)[0]},mxGraph.prototype.addCells=function(e,n,t,a,i){null==n&&(n=this.getDefaultParent()),null==t&&(t=this.model.getChildCount(n)),this.model.beginUpdate();try{this.cellsAdded(e,n,t,a,i,!1,!0),this.fireEvent(new mxEventObject(mxEvent.ADD_CELLS,"cells",e,"parent",n,"index",t,"source",a,"target",i))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsAdded=function(e,n,t,a,i,s,o){if(null!=e&&null!=n&&null!=t){this.model.beginUpdate();try{for(var r=null!=(d=s?this.view.getState(n):null)?d.origin:null,l=new mxPoint(0,0),d=0;d<e.length;d++)if(null==e[d])t--;else{var c=this.model.getParent(e[d]);if(null!=r&&e[d]!=n&&n!=c){var m=this.view.getState(c),u=null!=m?m.origin:l;if(null!=(p=this.model.getGeometry(e[d]))){var p,g=u.x-r.x,v=u.y-r.y;(p=p.clone()).translate(g,v),!p.relative&&this.model.isVertex(e[d])&&!this.isAllowNegativeCoordinates()&&(p.x=Math.max(0,p.x),p.y=Math.max(0,p.y)),this.model.setGeometry(e[d],p)}}n==c&&t+d>this.model.getChildCount(n)&&t--,this.model.add(n,e[d],t+d),this.isExtendParentsOnAdd()&&this.isExtendParent(e[d])&&this.extendParent(e[d]),(null==o||o)&&this.constrainChild(e[d]),null!=a&&this.cellConnected(e[d],a,!0),null!=i&&this.cellConnected(e[d],i,!1)}this.fireEvent(new mxEventObject(mxEvent.CELLS_ADDED,"cells",e,"parent",n,"index",t,"source",a,"target",i,"absolute",s))}finally{this.model.endUpdate()}}},mxGraph.prototype.removeCells=function(e,n){n=null==n||n,null==e&&(e=this.getDeletableCells(this.getSelectionCells())),n&&(e=this.getDeletableCells(this.addAllEdges(e))),this.model.beginUpdate();try{this.cellsRemoved(e),this.fireEvent(new mxEventObject(mxEvent.REMOVE_CELLS,"cells",e,"includeEdges",n))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsRemoved=function(e){if(null!=e&&0<e.length){var n=this.view.scale,t=this.view.translate;this.model.beginUpdate();try{for(var a={},i=0;i<e.length;i++){var s=mxCellPath.create(e[i]);a[s]=e[i]}for(i=0;i<e.length;i++){for(var o=this.getConnections(e[i]),r=0;r<o.length;r++)if(null==a[s=mxCellPath.create(o[r])]){if(null!=(d=this.model.getGeometry(o[r]))){var l=this.view.getState(o[r]);if(null!=l){var d=d.clone(),c=l.getVisibleTerminal(!0)==e[i],m=l.absolutePoints,u=c?0:m.length-1;d.setTerminalPoint(new mxPoint(m[u].x/n-t.x,m[u].y/n-t.y),c),this.model.setTerminal(o[r],null,c),this.model.setGeometry(o[r],d)}}}this.model.remove(e[i])}this.fireEvent(new mxEventObject(mxEvent.CELLS_REMOVED,"cells",e))}finally{this.model.endUpdate()}}},mxGraph.prototype.splitEdge=function(e,n,t,a,i){a=a||0,i=i||0,null==t&&(t=this.cloneCells([e])[0]);var s=this.model.getParent(e),o=this.model.getTerminal(e,!0);this.model.beginUpdate();try{this.cellsMoved(n,a,i,!1,!1),this.cellsAdded(n,s,this.model.getChildCount(s),null,null,!0),this.cellsAdded([t],s,this.model.getChildCount(s),o,n[0],!1),this.cellConnected(e,n[0],!0),this.fireEvent(new mxEventObject(mxEvent.SPLIT_EDGE,"edge",e,"cells",n,"newEdge",t,"dx",a,"dy",i))}finally{this.model.endUpdate()}return t},mxGraph.prototype.toggleCells=function(e,n,t){null==n&&(n=this.getSelectionCells()),t&&(n=this.addAllEdges(n)),this.model.beginUpdate();try{this.cellsToggled(n,e),this.fireEvent(new mxEventObject(mxEvent.TOGGLE_CELLS,"show",e,"cells",n,"includeEdges",t))}finally{this.model.endUpdate()}return n},mxGraph.prototype.cellsToggled=function(e,n){if(null!=e&&0<e.length){this.model.beginUpdate();try{for(var t=0;t<e.length;t++)this.model.setVisible(e[t],n)}finally{this.model.endUpdate()}}},mxGraph.prototype.foldCells=function(e,n,t,a){n=null!=n&&n,null==t&&(t=this.getFoldableCells(this.getSelectionCells(),e)),this.stopEditing(!1),this.model.beginUpdate();try{this.cellsFolded(t,e,n,a),this.fireEvent(new mxEventObject(mxEvent.FOLD_CELLS,"collapse",e,"recurse",n,"cells",t))}finally{this.model.endUpdate()}return t},mxGraph.prototype.cellsFolded=function(e,n,t,a){if(null!=e&&0<e.length){this.model.beginUpdate();try{for(var i=0;i<e.length;i++)if((!a||this.isCellFoldable(e[i],n))&&n!=this.isCellCollapsed(e[i])&&(this.model.setCollapsed(e[i],n),this.swapBounds(e[i],n),this.isExtendParent(e[i])&&this.extendParent(e[i]),t)){var s=this.model.getChildren(e[i]);this.foldCells(s,n,t)}this.fireEvent(new mxEventObject(mxEvent.CELLS_FOLDED,"cells",e,"collapse",n,"recurse",t))}finally{this.model.endUpdate()}}},mxGraph.prototype.swapBounds=function(e,n){if(null!=e){var t=this.model.getGeometry(e);null!=t&&(t=t.clone(),this.updateAlternateBounds(e,t,n),t.swap(),this.model.setGeometry(e,t))}},mxGraph.prototype.updateAlternateBounds=function(e,n,t){if(null!=e&&null!=n){if(t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e),null==n.alternateBounds){var a=n;this.collapseToPreferredSize&&(null!=(e=this.getPreferredSizeForCell(e))&&(a=e,0<(e=mxUtils.getValue(t,mxConstants.STYLE_STARTSIZE))&&(a.height=Math.max(a.height,e)))),n.alternateBounds=new mxRectangle(0,0,a.width,a.height)}if(null!=n.alternateBounds){n.alternateBounds.x=n.x,n.alternateBounds.y=n.y;var i=mxUtils.toRadians(t[mxConstants.STYLE_ROTATION]||"0");0!=i&&(e=n.alternateBounds.getCenterX()-n.getCenterX(),t=n.alternateBounds.getCenterY()-n.getCenterY(),a=Math.cos(i),i=Math.sin(i),n.alternateBounds.x+=a*e-i*t-e,n.alternateBounds.y+=i*e+a*t-t)}}},mxGraph.prototype.addAllEdges=function(e){var n=e.slice();return n.concat(this.getAllEdges(e))},mxGraph.prototype.getAllEdges=function(e){var n=[];if(null!=e)for(var t=0;t<e.length;t++){for(var a=this.model.getEdgeCount(e[t]),i=0;i<a;i++)n.push(this.model.getEdgeAt(e[t],i));a=this.model.getChildren(e[t]),n=n.concat(this.getAllEdges(a))}return n},mxGraph.prototype.updateCellSize=function(e,n){n=null!=n&&n,this.model.beginUpdate();try{this.cellSizeUpdated(e,n),this.fireEvent(new mxEventObject(mxEvent.UPDATE_CELL_SIZE,"cell",e,"ignoreChildren",n))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellSizeUpdated=function(e,n){if(null!=e){this.model.beginUpdate();try{var t=this.getPreferredSizeForCell(e),a=this.model.getGeometry(e);if(null!=t&&null!=a){var i=this.isCellCollapsed(e);a=a.clone();if(this.isSwimlane(e)){var s=this.view.getState(e),o=null!=s?s.style:this.getCellStyle(e),r=this.model.getStyle(e);null==r&&(r=""),mxUtils.getValue(o,mxConstants.STYLE_HORIZONTAL,!0)?(r=mxUtils.setStyle(r,mxConstants.STYLE_STARTSIZE,t.height+8),i&&(a.height=t.height+8),a.width=t.width):(r=mxUtils.setStyle(r,mxConstants.STYLE_STARTSIZE,t.width+8),i&&(a.width=t.width+8),a.height=t.height),this.model.setStyle(e,r)}else a.width=t.width,a.height=t.height;if(!n&&!i){var l=this.view.getBounds(this.model.getChildren(e));if(null!=l){var d=this.view.translate,c=this.view.scale,m=(l.y+l.height)/c-a.y-d.y;a.width=Math.max(a.width,(l.x+l.width)/c-a.x-d.x),a.height=Math.max(a.height,m)}}this.cellsResized([e],[a])}}finally{this.model.endUpdate()}}},mxGraph.prototype.getPreferredSizeForCell=function(e){var n=null;if(null!=e){var t=this.view.getState(e),a=null!=t?t.style:this.getCellStyle(e);if(null!=a&&!this.model.isEdge(e)){var i=a[mxConstants.STYLE_FONTSIZE]||mxConstants.DEFAULT_FONTSIZE,s=0;n=0;null==this.getImage(t)&&null==a[mxConstants.STYLE_IMAGE]||a[mxConstants.STYLE_SHAPE]!=mxConstants.SHAPE_LABEL||(a[mxConstants.STYLE_VERTICAL_ALIGN]==mxConstants.ALIGN_MIDDLE&&(s+=parseFloat(a[mxConstants.STYLE_IMAGE_WIDTH])||mxLabel.prototype.imageSize),a[mxConstants.STYLE_ALIGN]!=mxConstants.ALIGN_CENTER&&(n+=parseFloat(a[mxConstants.STYLE_IMAGE_HEIGHT])||mxLabel.prototype.imageSize)),s+=2*(a[mxConstants.STYLE_SPACING]||0),s+=a[mxConstants.STYLE_SPACING_LEFT]||0,s+=a[mxConstants.STYLE_SPACING_RIGHT]||0,n+=2*(a[mxConstants.STYLE_SPACING]||0),n+=a[mxConstants.STYLE_SPACING_TOP]||0,n+=a[mxConstants.STYLE_SPACING_BOTTOM]||0,null!=(t=this.getFoldingImage(t))&&(s+=t.width+8),n=null!=(t=this.getLabel(e))&&0<t.length?(this.isHtmlLabel(e)||(t=t.replace(/\n/g,"<br>")),e=(i=mxUtils.getSizeForString(t,i,a[mxConstants.STYLE_FONTFAMILY])).width+s,n=i.height+n,mxUtils.getValue(a,mxConstants.STYLE_HORIZONTAL,!0)||(a=n,n=e,e=a),this.gridEnabled&&(e=this.snap(e+this.gridSize/2),n=this.snap(n+this.gridSize/2)),new mxRectangle(0,0,e,n)):new mxRectangle(0,0,a=4*this.gridSize,a)}}return n},mxGraph.prototype.handleGesture=function(e,n){if(.2<Math.abs(1-n.scale)){var t=this.view.scale,a=this.view.translate,i=e.width*n.scale,s=e.height*n.scale,o=e.y-(s-e.height)/2;t=new mxRectangle(this.snap((e.x-(i-e.width)/2)/t)-a.x,this.snap(o/t)-a.y,this.snap(i/t),this.snap(s/t));this.resizeCell(e.cell,t)}},mxGraph.prototype.resizeCell=function(e,n){return this.resizeCells([e],[n])[0]},mxGraph.prototype.resizeCells=function(e,n){this.model.beginUpdate();try{this.cellsResized(e,n),this.fireEvent(new mxEventObject(mxEvent.RESIZE_CELLS,"cells",e,"bounds",n))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsResized=function(e,n){if(null!=e&&null!=n&&e.length==n.length){this.model.beginUpdate();try{for(var t=0;t<e.length;t++){var a=n[t],i=this.model.getGeometry(e[t]);if(null!=i&&(i.x!=a.x||i.y!=a.y||i.width!=a.width||i.height!=a.height)){if((i=i.clone()).relative){var s=i.offset;null!=s&&(s.x+=a.x-i.x,s.y+=a.y-i.y)}else i.x=a.x,i.y=a.y;i.width=a.width,i.height=a.height,!i.relative&&this.model.isVertex(e[t])&&!this.isAllowNegativeCoordinates()&&(i.x=Math.max(0,i.x),i.y=Math.max(0,i.y)),this.model.setGeometry(e[t],i),this.isExtendParent(e[t])&&this.extendParent(e[t])}}this.resetEdgesOnResize&&this.resetEdges(e),this.fireEvent(new mxEventObject(mxEvent.CELLS_RESIZED,"cells",e,"bounds",n))}finally{this.model.endUpdate()}}},mxGraph.prototype.extendParent=function(e){if(null!=e){var n=this.model.getParent(e),t=this.model.getGeometry(n);null!=n&&null!=t&&!this.isCellCollapsed(n)&&(null!=(e=this.model.getGeometry(e))&&(t.width<e.x+e.width||t.height<e.y+e.height))&&((t=t.clone()).width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height),this.cellsResized([n],[t]))}},mxGraph.prototype.importCells=function(e,n,t,a,i){return this.moveCells(e,n,t,!0,a,i)},mxGraph.prototype.moveCells=function(e,n,t,a,i,s){if(n=null!=n?n:0,t=null!=t?t:0,a=null!=a&&a,null!=e&&(0!=n||0!=t||a||null!=i)){this.model.beginUpdate();try{a&&(e=this.cloneCells(e,this.isCloneInvalidEdges()),null==i&&(i=this.getDefaultParent()));var o=this.isAllowNegativeCoordinates();if(null!=i&&this.setAllowNegativeCoordinates(!0),this.cellsMoved(e,n,t,!a&&this.isDisconnectOnMove()&&this.isAllowDanglingEdges(),null==i),this.setAllowNegativeCoordinates(o),null!=i){var r=this.model.getChildCount(i);this.cellsAdded(e,i,r,null,null,!0)}this.fireEvent(new mxEventObject(mxEvent.MOVE_CELLS,"cells",e,"dx",n,"dy",t,"clone",a,"target",i,"event",s))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.cellsMoved=function(e,n,t,a,i){if(null!=e&&(0!=n||0!=t)){this.model.beginUpdate();try{a&&this.disconnectGraph(e);for(var s=0;s<e.length;s++)this.translateCell(e[s],n,t),i&&this.constrainChild(e[s]);this.resetEdgesOnMove&&this.resetEdges(e),this.fireEvent(new mxEventObject(mxEvent.CELLS_MOVED,"cells",e,"dx",t,"dy",t,"disconnect",a))}finally{this.model.endUpdate()}}},mxGraph.prototype.translateCell=function(e,n,t){var a=this.model.getGeometry(e);null!=a&&((a=a.clone()).translate(n,t),!a.relative&&this.model.isVertex(e)&&!this.isAllowNegativeCoordinates()&&(a.x=Math.max(0,a.x),a.y=Math.max(0,a.y)),a.relative&&!this.model.isEdge(e)&&(null==a.offset?a.offset=new mxPoint(n,t):(a.offset.x+=n,a.offset.y+=t)),this.model.setGeometry(e,a))},mxGraph.prototype.getCellContainmentArea=function(e){if(null!=e&&!this.model.isEdge(e)){var n=this.model.getParent(e);if(n==this.getDefaultParent()||n==this.getCurrentRoot())return this.getMaximumGraphBounds();if(null!=n&&n!=this.getDefaultParent())if(null!=(i=this.model.getGeometry(n))){var t=e=0,a=i.width,i=i.height;return this.isSwimlane(n)&&(e=(n=this.getStartSize(n)).width,a-=n.width,t=n.height,i-=n.height),new mxRectangle(e,t,a,i)}}return null},mxGraph.prototype.getMaximumGraphBounds=function(){return this.maximumGraphBounds},mxGraph.prototype.constrainChild=function(e){if(null!=e){var n=this.model.getGeometry(e),t=this.isConstrainChild(e)?this.getCellContainmentArea(e):this.getMaximumGraphBounds();null!=n&&null!=t&&!n.relative&&(n.x<t.x||n.y<t.y||t.width<n.x+n.width||t.height<n.y+n.height)&&(e=this.getOverlap(e),0<t.width&&(n.x=Math.min(n.x,t.x+t.width-(1-e)*n.width)),0<t.height&&(n.y=Math.min(n.y,t.y+t.height-(1-e)*n.height)),n.x=Math.max(n.x,t.x-n.width*e),n.y=Math.max(n.y,t.y-n.height*e))}},mxGraph.prototype.resetEdges=function(e){if(null!=e){for(var n={},t=0;t<e.length;t++){var a=mxCellPath.create(e[t]);n[a]=e[t]}this.model.beginUpdate();try{for(t=0;t<e.length;t++){var i=this.model.getEdges(e[t]);if(null!=i)for(a=0;a<i.length;a++){var s=this.view.getState(i[a]),o=null!=s?s.getVisibleTerminal(!0):this.view.getVisibleTerminal(i[a],!0),r=null!=s?s.getVisibleTerminal(!1):this.view.getVisibleTerminal(i[a],!1),l=mxCellPath.create(o),d=mxCellPath.create(r);(null==n[l]||null==n[d])&&this.resetEdge(i[a])}this.resetEdges(this.model.getChildren(e[t]))}}finally{this.model.endUpdate()}}},mxGraph.prototype.resetEdge=function(e){var n=this.model.getGeometry(e);return null!=n&&null!=n.points&&0<n.points.length&&((n=n.clone()).points=[],this.model.setGeometry(e,n)),e},mxGraph.prototype.getAllConnectionConstraints=function(e,n){return null!=e&&null!=e.shape&&null!=e.shape.stencil?e.shape.stencil.constraints:null},mxGraph.prototype.getConnectionConstraint=function(e,n,t){n=null;var a=e.style[t?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X];if(null!=a){var i=e.style[t?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y];null!=i&&(n=new mxPoint(parseFloat(a),parseFloat(i)))}return a=!1,null!=n&&(a=mxUtils.getValue(e.style,t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,!0)),new mxConnectionConstraint(n,a)},mxGraph.prototype.setConnectionConstraint=function(e,n,t,a){if(null!=a){this.model.beginUpdate();try{null==a||null==a.point?(this.setCellStyles(t?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X,null,[e]),this.setCellStyles(t?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y,null,[e]),this.setCellStyles(t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,null,[e])):null!=a.point&&(this.setCellStyles(t?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X,a.point.x,[e]),this.setCellStyles(t?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y,a.point.y,[e]),a.perimeter?this.setCellStyles(t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,null,[e]):this.setCellStyles(t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,"0",[e]))}finally{this.model.endUpdate()}}},mxGraph.prototype.getConnectionPoint=function(e,n){var t=null;if(null!=e){var a=this.view.getPerimeterBounds(e),i=new mxPoint(a.getCenterX(),a.getCenterY()),s=e.style[mxConstants.STYLE_DIRECTION],o=0;if(null!=s&&("north"==s?o+=270:"west"==s?o+=180:"south"==s&&(o+=90),"north"==s||"south"==s)){a.x+=a.width/2-a.height/2,a.y+=a.height/2-a.width/2;var r=a.width;a.width=a.height,a.height=r}if(null!=n.point){var l=t=1,d=0,c=0;if(this.getModel().isVertex(e.cell)){var m=e.style[mxConstants.STYLE_FLIPH],u=e.style[mxConstants.STYLE_FLIPV];null!=e.shape.stencil&&(m=1==mxUtils.getValue(e.style,"stencilFlipH",0)||m,u=1==mxUtils.getValue(e.style,"stencilFlipV",0)||u),"north"!=s&&"south"!=s||(r=m,m=u,u=r),m&&(t=-1,d=-a.width),u&&(l=-1,c=-a.height)}t=new mxPoint(a.x+n.point.x*a.width*t-d,a.y+n.point.y*a.height*l-c)}s=e.style[mxConstants.STYLE_ROTATION]||0,n.perimeter?(0!=o&&null!=t&&(r=a=0,90==o?r=1:180==o?a=-1:270==s&&(r=-1),t=mxUtils.getRotatedPoint(t,a,r,i)),null!=t&&n.perimeter&&(t=this.view.getPerimeterPoint(e,t,!1))):s+=o,0!=s&&null!=t&&(o=mxUtils.toRadians(s),a=Math.cos(o),r=Math.sin(o),t=mxUtils.getRotatedPoint(t,a,r,i))}return t},mxGraph.prototype.connectCell=function(e,n,t,a){this.model.beginUpdate();try{var i=this.model.getTerminal(e,t);this.cellConnected(e,n,t,a),this.fireEvent(new mxEventObject(mxEvent.CONNECT_CELL,"edge",e,"terminal",n,"source",t,"previous",i))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellConnected=function(e,n,t,a){if(null!=e){this.model.beginUpdate();try{var i=this.model.getTerminal(e,t);this.setConnectionConstraint(e,n,t,a),this.isPortsEnabled()&&(a=null,this.isPort(n)&&(a=n.getId(),n=this.getTerminalForPort(n,t)),this.setCellStyles(t?mxConstants.STYLE_SOURCE_PORT:mxConstants.STYLE_TARGET_PORT,a,[e])),this.model.setTerminal(e,n,t),this.resetEdgesOnConnect&&this.resetEdge(e),this.fireEvent(new mxEventObject(mxEvent.CELL_CONNECTED,"edge",e,"terminal",n,"source",t,"previous",i))}finally{this.model.endUpdate()}}},mxGraph.prototype.disconnectGraph=function(e){if(null!=e){this.model.beginUpdate();try{for(var n=this.view.scale,t=this.view.translate,a={},i=0;i<e.length;i++){a[mxCellPath.create(e[i])]=e[i]}for(i=0;i<e.length;i++)if(this.model.isEdge(e[i])){if(null!=(r=this.model.getGeometry(e[i]))){var s=this.view.getState(e[i]),o=this.view.getState(this.model.getParent(e[i]));if(null!=s&&null!=o){var r=r.clone(),l=-o.origin.x,d=-o.origin.y,c=s.absolutePoints,m=this.model.getTerminal(e[i],!0);if(null!=m&&this.isCellDisconnectable(e[i],m,!0)){for(var u=mxCellPath.create(m);null!=m&&null==a[u];)m=this.model.getParent(m),u=mxCellPath.create(m);null==m&&(r.setTerminalPoint(new mxPoint(c[0].x/n-t.x+l,c[0].y/n-t.y+d),!0),this.model.setTerminal(e[i],null,!0))}var p=this.model.getTerminal(e[i],!1);if(null!=p&&this.isCellDisconnectable(e[i],p,!1)){for(var g=mxCellPath.create(p);null!=p&&null==a[g];)p=this.model.getParent(p),g=mxCellPath.create(p);if(null==p){var v=c.length-1;r.setTerminalPoint(new mxPoint(c[v].x/n-t.x+l,c[v].y/n-t.y+d),!1),this.model.setTerminal(e[i],null,!1)}}this.model.setGeometry(e[i],r)}}}}finally{this.model.endUpdate()}}},mxGraph.prototype.getCurrentRoot=function(){return this.view.currentRoot},mxGraph.prototype.getTranslateForRoot=function(e){return null},mxGraph.prototype.isPort=function(e){return!1},mxGraph.prototype.getTerminalForPort=function(e,n){return this.model.getParent(e)},mxGraph.prototype.getChildOffsetForCell=function(e){return null},mxGraph.prototype.enterGroup=function(e){null!=(e=e||this.getSelectionCell())&&this.isValidRoot(e)&&(this.view.setCurrentRoot(e),this.clearSelection())},mxGraph.prototype.exitGroup=function(){var e=this.model.getRoot(),n=this.getCurrentRoot();if(null!=n){for(var t=this.model.getParent(n);t!=e&&!this.isValidRoot(t)&&this.model.getParent(t)!=e;)t=this.model.getParent(t);t==e||this.model.getParent(t)==e?this.view.setCurrentRoot(null):this.view.setCurrentRoot(t),null!=this.view.getState(n)&&this.setSelectionCell(n)}},mxGraph.prototype.home=function(){var e=this.getCurrentRoot();null!=e&&(this.view.setCurrentRoot(null),null!=this.view.getState(e)&&this.setSelectionCell(e))},mxGraph.prototype.isValidRoot=function(e){return null!=e},mxGraph.prototype.getGraphBounds=function(){return this.view.getGraphBounds()},mxGraph.prototype.getCellBounds=function(e,n,t){var a=[e];if(n&&(a=a.concat(this.model.getEdges(e))),a=this.view.getBounds(a),t){t=this.model.getChildCount(e);for(var i=0;i<t;i++){var s=this.getCellBounds(this.model.getChildAt(e,i),n,!0);null!=a?a.add(s):a=s}}return a},mxGraph.prototype.getBoundingBoxFromGeometry=function(e,n){n=null!=n&&n;var t=null;if(null!=e)for(var a=0;a<e.length;a++)if(n||this.model.isVertex(e[a])){var i=this.getCellGeometry(e[a]);if(null!=i){var s=i.points;if(null!=s&&0<s.length){for(var o=new mxRectangle(s[0].x,s[0].y,0,0),r=function(e){null!=e&&o.add(new mxRectangle(e.x,e.y,0,0))},l=1;l<s.length;l++)r(s[l]);r(i.getTerminalPoint(!0)),r(i.getTerminalPoint(!1))}null==t?t=new mxRectangle(i.x,i.y,i.width,i.height):t.add(i)}}return t},mxGraph.prototype.refresh=function(e){this.view.clear(e,null==e),this.view.validate(),this.sizeDidChange(),this.fireEvent(new mxEventObject(mxEvent.REFRESH))},mxGraph.prototype.snap=function(e){return this.gridEnabled&&(e=Math.round(e/this.gridSize)*this.gridSize),e},mxGraph.prototype.panGraph=function(e,n){if(this.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.container))this.container.scrollLeft=-e,this.container.scrollTop=-n;else{var t=this.view.getCanvas();if(this.dialect==mxConstants.DIALECT_SVG)if(0==e&&0==n){if(mxClient.IS_IE?t.setAttribute("transform","translate("+e+","+n+")"):t.removeAttribute("transform"),null!=this.shiftPreview1){for(var a=this.shiftPreview1.firstChild;null!=a;){var i=a.nextSibling;this.container.appendChild(a),a=i}for(this.shiftPreview1.parentNode.removeChild(this.shiftPreview1),this.shiftPreview1=null,this.container.appendChild(t.parentNode),a=this.shiftPreview2.firstChild;null!=a;)i=a.nextSibling,this.container.appendChild(a),a=i;this.shiftPreview2.parentNode.removeChild(this.shiftPreview2),this.shiftPreview2=null}}else{if(t.setAttribute("transform","translate("+e+","+n+")"),null==this.shiftPreview1){this.shiftPreview1=document.createElement("div"),this.shiftPreview1.style.position="absolute",this.shiftPreview1.style.overflow="visible",this.shiftPreview2=document.createElement("div"),this.shiftPreview2.style.position="absolute",this.shiftPreview2.style.overflow="visible";var s=this.shiftPreview1;for(a=this.container.firstChild;null!=a;)i=a.nextSibling,a!=t.parentNode?s.appendChild(a):s=this.shiftPreview2,a=i;this.container.insertBefore(this.shiftPreview1,t.parentNode),this.container.appendChild(this.shiftPreview2)}this.shiftPreview1.style.left=e+"px",this.shiftPreview1.style.top=n+"px",this.shiftPreview2.style.left=e+"px",this.shiftPreview2.style.top=n+"px"}else t.style.left=e+"px",t.style.top=n+"px";this.panDx=e,this.panDy=n,this.fireEvent(new mxEventObject(mxEvent.PAN))}},mxGraph.prototype.zoomIn=function(){this.zoom(this.zoomFactor)},mxGraph.prototype.zoomOut=function(){this.zoom(1/this.zoomFactor)},mxGraph.prototype.zoomActual=function(){1==this.view.scale?this.view.setTranslate(0,0):(this.view.translate.x=0,this.view.translate.y=0,this.view.setScale(1))},mxGraph.prototype.zoomTo=function(e,n){this.zoom(e/this.view.scale,n)},mxGraph.prototype.zoom=function(e,n){n=null!=n?n:this.centerZoom;var t=this.view.scale*e,a=this.view.getState(this.getSelectionCell());if(this.keepSelectionVisibleOnZoom&&null!=a)a=new mxRectangle(a.x*e,a.y*e,a.width*e,a.height*e),this.view.scale=t,this.scrollRectToVisible(a)||(this.view.revalidate(),this.view.setScale(t));else if(n&&!mxUtils.hasScrollbars(this.container)){a=this.container.offsetWidth;var i=this.container.offsetHeight;if(1<e){var s=(e-1)/(2*t);a=a*-s,i=i*-s}else a*=s=(1/e-1)/(2*this.view.scale),i*=s;this.view.scaleAndTranslate(t,this.view.translate.x+a,this.view.translate.y+i)}else this.view.setScale(t),mxUtils.hasScrollbars(this.container)&&(i=a=0,n&&(a=this.container.offsetWidth*(e-1)/2,i=this.container.offsetHeight*(e-1)/2),this.container.scrollLeft=Math.round(this.container.scrollLeft*e+a),this.container.scrollTop=Math.round(this.container.scrollTop*e+i))},mxGraph.prototype.zoomToRect=function(e){var n=this.container.clientWidth/e.width/(this.container.clientHeight/e.height);e.x=Math.max(0,e.x),e.y=Math.max(0,e.y);var t=Math.min(this.container.scrollWidth,e.x+e.width),a=Math.min(this.container.scrollHeight,e.y+e.height);e.width=t-e.x,e.height=a-e.y,n<1?(t=((n=e.height/n)-e.height)/2,e.height=n,n=Math.min(e.y,t),e.y-=n,a=Math.min(this.container.scrollHeight,e.y+e.height),e.height=a-e.y):(t=((n*=e.width)-e.width)/2,e.width=n,n=Math.min(e.x,t),e.x-=n,t=Math.min(this.container.scrollWidth,e.x+e.width),e.width=t-e.x),n=this.container.clientWidth/e.width,t=this.view.scale*n,mxUtils.hasScrollbars(this.container)?(this.view.setScale(t),this.container.scrollLeft=Math.round(e.x*n),this.container.scrollTop=Math.round(e.y*n)):this.view.scaleAndTranslate(t,this.view.translate.x-e.x/this.view.scale,this.view.translate.y-e.y/this.view.scale)},mxGraph.prototype.fit=function(e,n){if(null!=this.container){e=null!=e?e:0,n=null!=n&&n;var t=this.container.clientWidth,a=this.container.clientHeight,i=this.view.getGraphBounds();n&&null!=i.x&&null!=i.y&&(i.width+=i.x,i.height+=i.y,i.x=0,i.y=0);var s=this.view.scale,o=i.width/s,r=i.height/s;null!=this.backgroundImage&&(o=Math.max(o,this.backgroundImage.width-i.x/s),r=Math.max(r,this.backgroundImage.height-i.y/s));var l=n?e:2*e;t=Math.floor(100*Math.min(t/(o+l),a/(r+l)))/100;null!=this.minFitScale&&(t=Math.max(t,this.minFitScale)),null!=this.maxFitScale&&(t=Math.min(t,this.maxFitScale)),n?this.view.scale!=t&&this.view.setScale(t):mxUtils.hasScrollbars(this.container)?(this.view.setScale(t),null!=i.x&&(this.container.scrollLeft=Math.round(i.x/s)*t-e-Math.max(0,(this.container.clientWidth-o*t)/2)),null!=i.y&&(this.container.scrollTop=Math.round(i.y/s)*t-e-Math.max(0,(this.container.clientHeight-r*t)/2))):this.view.scaleAndTranslate(t,null!=i.x?Math.floor(this.view.translate.x-i.x/s+e+1):e,null!=i.y?Math.floor(this.view.translate.y-i.y/s+e+1):e)}return this.view.scale},mxGraph.prototype.scrollCellToVisible=function(e,n){var t=-this.view.translate.x,a=-this.view.translate.y,i=this.view.getState(e);null!=i&&(t=new mxRectangle(t+i.x,a+i.y,i.width,i.height),n&&null!=this.container&&(a=this.container.clientWidth,i=this.container.clientHeight,t.x=t.getCenterX()-a/2,t.width=a,t.y=t.getCenterY()-i/2,t.height=i),this.scrollRectToVisible(t)&&this.view.setTranslate(this.view.translate.x,this.view.translate.y))},mxGraph.prototype.scrollRectToVisible=function(e){var n=!1;if(null!=e){var t=this.container.offsetWidth,a=this.container.offsetHeight,i=Math.min(t,e.width),s=Math.min(a,e.height);if(mxUtils.hasScrollbars(this.container)){t=this.container,e.x+=this.view.translate.x,e.y+=this.view.translate.y;var o=t.scrollLeft-e.x;a=Math.max(o-t.scrollLeft,0);0<o?t.scrollLeft-=o+2:0<(o=e.x+i-t.scrollLeft-t.clientWidth)&&(t.scrollLeft+=o+2),i=t.scrollTop-e.y,o=Math.max(0,i-t.scrollTop),0<i?t.scrollTop-=i+2:0<(i=e.y+s-t.scrollTop-t.clientHeight)&&(t.scrollTop+=i+2),!this.useScrollbarsForPanning&&(0!=a||0!=o)&&this.view.setTranslate(a,o)}else{o=-this.view.translate.x;var r=-this.view.translate.y,l=this.view.scale;e.x+i>o+t&&(this.view.translate.x-=(e.x+i-t-o)/l,n=!0),e.y+s>r+a&&(this.view.translate.y-=(e.y+s-a-r)/l,n=!0),e.x<o&&(this.view.translate.x+=(o-e.x)/l,n=!0),e.y<r&&(this.view.translate.y+=(r-e.y)/l,n=!0),n&&(this.view.refresh(),null!=this.selectionCellsHandler&&this.selectionCellsHandler.refresh())}}return n},mxGraph.prototype.getCellGeometry=function(e){return this.model.getGeometry(e)},mxGraph.prototype.isCellVisible=function(e){return this.model.isVisible(e)},mxGraph.prototype.isCellCollapsed=function(e){return this.model.isCollapsed(e)},mxGraph.prototype.isCellConnectable=function(e){return this.model.isConnectable(e)},mxGraph.prototype.isOrthogonal=function(e){var n=e.style[mxConstants.STYLE_ORTHOGONAL];return null!=n?n:(e=this.view.getEdgeStyle(e))==mxEdgeStyle.SegmentConnector||e==mxEdgeStyle.ElbowConnector||e==mxEdgeStyle.SideToSide||e==mxEdgeStyle.TopToBottom||e==mxEdgeStyle.EntityRelation||e==mxEdgeStyle.OrthConnector},mxGraph.prototype.isLoop=function(e){var n=e.getVisibleTerminalState(!0);return e=e.getVisibleTerminalState(!1),null!=n&&n==e},mxGraph.prototype.isCloneEvent=function(e){return mxEvent.isControlDown(e)},mxGraph.prototype.isToggleEvent=function(e){return mxClient.IS_MAC?mxEvent.isMetaDown(e):mxEvent.isControlDown(e)},mxGraph.prototype.isGridEnabledEvent=function(e){return null!=e&&!mxEvent.isAltDown(e)},mxGraph.prototype.isConstrainedEvent=function(e){return mxEvent.isShiftDown(e)},mxGraph.prototype.isForceMarqueeEvent=function(e){return mxEvent.isAltDown(e)},mxGraph.prototype.validationAlert=function(e){mxUtils.alert(e)},mxGraph.prototype.isEdgeValid=function(e,n,t){return null==this.getEdgeValidationError(e,n,t)},mxGraph.prototype.getEdgeValidationError=function(e,n,t){if(null!=e&&!this.isAllowDanglingEdges()&&(null==n||null==t))return"";if(null!=e&&null==this.model.getTerminal(e,!0)&&null==this.model.getTerminal(e,!1))return null;if(!this.allowLoops&&n==t&&null!=n||!this.isValidConnection(n,t))return"";if(null==n||null==t)return this.allowDanglingEdges?null:"";var a="";this.multigraph||(1<(i=this.model.getEdgesBetween(n,t,!0)).length||1==i.length&&i[0]!=e)&&(a+=(mxResources.get(this.alreadyConnectedResource)||this.alreadyConnectedResource)+"\n");var i=this.model.getDirectedEdgeCount(n,!0,e),s=this.model.getDirectedEdgeCount(t,!1,e);if(null!=this.multiplicities)for(var o=0;o<this.multiplicities.length;o++){var r=this.multiplicities[o].check(this,e,n,t,i,s);null!=r&&(a+=r)}return null!=(r=this.validateEdge(e,n,t))&&(a+=r),0<a.length?a:null},mxGraph.prototype.validateEdge=function(e,n,t){return null},mxGraph.prototype.validateGraph=function(e,n){e=null!=e?e:this.model.getRoot(),n=null!=n?n:{};for(var t=!0,a=this.model.getChildCount(e),i=0;i<a;i++){var s=this.model.getChildAt(e,i),o=n;this.isValidRoot(s)&&(o={}),null!=(o=this.validateGraph(s,o))?this.setCellWarning(s,o.replace(/\n/g,"<br>")):this.setCellWarning(s,null),t=t&&null==o}return a="",this.isCellCollapsed(e)&&!t&&(a+=(mxResources.get(this.containsValidationErrorsResource)||this.containsValidationErrorsResource)+"\n"),a=this.model.isEdge(e)?a+(this.getEdgeValidationError(e,this.model.getTerminal(e,!0),this.model.getTerminal(e,!1))||""):a+(this.getCellValidationError(e)||""),null!=(i=this.validateCell(e,n))&&(a+=i),null==this.model.getParent(e)&&this.view.validate(),0<a.length||!t?a:null},mxGraph.prototype.getCellValidationError=function(e){var n=this.model.getDirectedEdgeCount(e,!0),t=this.model.getDirectedEdgeCount(e,!1);e=this.model.getValue(e);var a="";if(null!=this.multiplicities)for(var i=0;i<this.multiplicities.length;i++){var s=this.multiplicities[i];s.source&&mxUtils.isNode(e,s.type,s.attr,s.value)&&(0==s.max&&0<n||1==s.min&&0==n||1==s.max&&1<n)?a+=s.countError+"\n":!s.source&&mxUtils.isNode(e,s.type,s.attr,s.value)&&(0==s.max&&0<t||1==s.min&&0==t||1==s.max&&1<t)&&(a+=s.countError+"\n")}return 0<a.length?a:null},mxGraph.prototype.validateCell=function(e,n){return null},mxGraph.prototype.getBackgroundImage=function(){return this.backgroundImage},mxGraph.prototype.setBackgroundImage=function(e){this.backgroundImage=e},mxGraph.prototype.getFoldingImage=function(e){if(null!=e&&this.foldingEnabled&&!this.getModel().isEdge(e.cell)){var n=this.isCellCollapsed(e.cell);if(this.isCellFoldable(e.cell,!n))return n?this.collapsedImage:this.expandedImage}return null},mxGraph.prototype.convertValueToString=function(e){if(null!=(e=this.model.getValue(e))){if(mxUtils.isNode(e))return e.nodeName;if("function"==typeof e.toString)return e.toString()}return""},mxGraph.prototype.getLabel=function(e){var n="";if(this.labelsVisible&&null!=e){var t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);mxUtils.getValue(t,mxConstants.STYLE_NOLABEL,!1)||(n=this.convertValueToString(e))}return n},mxGraph.prototype.isHtmlLabel=function(e){return this.isHtmlLabels()},mxGraph.prototype.isHtmlLabels=function(){return this.htmlLabels},mxGraph.prototype.setHtmlLabels=function(e){this.htmlLabels=e},mxGraph.prototype.isWrapping=function(e){var n=this.view.getState(e);return null!=(e=null!=n?n.style:this.getCellStyle(e))&&"wrap"==e[mxConstants.STYLE_WHITE_SPACE]},mxGraph.prototype.isLabelClipped=function(e){var n=this.view.getState(e);return null!=(e=null!=n?n.style:this.getCellStyle(e))&&"hidden"==e[mxConstants.STYLE_OVERFLOW]},mxGraph.prototype.getTooltip=function(e,t,n,a){var i=null;return null!=e&&(null==e.control||t!=e.control.node&&t.parentNode!=e.control.node||(i=this.collapseExpandResource,i=mxResources.get(i)||i),null==i&&null!=e.overlays&&e.overlays.visit(function(e,n){null!=i||t!=n.node&&t.parentNode!=n.node||(i=n.overlay.toString())}),null==i&&(null!=(n=this.selectionCellsHandler.getHandler(e.cell))&&"function"==typeof n.getTooltipForNode&&(i=n.getTooltipForNode(t))),null==i&&(i=this.getTooltipForCell(e.cell))),i},mxGraph.prototype.getTooltipForCell=function(e){return null!=e&&null!=e.getTooltip?e.getTooltip():this.convertValueToString(e)},mxGraph.prototype.getCursorForCell=function(e){return null},mxGraph.prototype.getStartSize=function(e){var n=new mxRectangle,t=this.view.getState(e);return null!=(e=null!=t?t.style:this.getCellStyle(e))&&(t=parseInt(mxUtils.getValue(e,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)),mxUtils.getValue(e,mxConstants.STYLE_HORIZONTAL,!0)?n.height=t:n.width=t),n},mxGraph.prototype.getImage=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_IMAGE]:null},mxGraph.prototype.getVerticalAlign=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_VERTICAL_ALIGN]||mxConstants.ALIGN_MIDDLE:null},mxGraph.prototype.getIndicatorColor=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_COLOR]:null},mxGraph.prototype.getIndicatorGradientColor=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_GRADIENTCOLOR]:null},mxGraph.prototype.getIndicatorShape=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_SHAPE]:null},mxGraph.prototype.getIndicatorImage=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_IMAGE]:null},mxGraph.prototype.getBorder=function(){return this.border},mxGraph.prototype.setBorder=function(e){this.border=e},mxGraph.prototype.isSwimlane=function(e){var n;if(null!=e&&this.model.getParent(e)!=this.model.getRoot()&&(null!=(n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e))&&!this.model.isEdge(e)))return n[mxConstants.STYLE_SHAPE]==mxConstants.SHAPE_SWIMLANE;return!1},mxGraph.prototype.isResizeContainer=function(){return this.resizeContainer},mxGraph.prototype.setResizeContainer=function(e){this.resizeContainer=e},mxGraph.prototype.isEnabled=function(){return this.enabled},mxGraph.prototype.setEnabled=function(e){this.enabled=e},mxGraph.prototype.isEscapeEnabled=function(){return this.escapeEnabled},mxGraph.prototype.setEscapeEnabled=function(e){this.escapeEnabled=e},mxGraph.prototype.isInvokesStopCellEditing=function(){return this.invokesStopCellEditing},mxGraph.prototype.setInvokesStopCellEditing=function(e){this.invokesStopCellEditing=e},mxGraph.prototype.isEnterStopsCellEditing=function(){return this.enterStopsCellEditing},mxGraph.prototype.setEnterStopsCellEditing=function(e){this.enterStopsCellEditing=e},mxGraph.prototype.isCellLocked=function(e){var n=this.model.getGeometry(e);return this.isCellsLocked()||null!=n&&this.model.isVertex(e)&&n.relative},mxGraph.prototype.isCellsLocked=function(){return this.cellsLocked},mxGraph.prototype.setCellsLocked=function(e){this.cellsLocked=e},mxGraph.prototype.getCloneableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellCloneable(e)}))},mxGraph.prototype.isCellCloneable=function(e){var n=this.view.getState(e);return e=null!=n?n.style:this.getCellStyle(e),this.isCellsCloneable()&&0!=e[mxConstants.STYLE_CLONEABLE]},mxGraph.prototype.isCellsCloneable=function(){return this.cellsCloneable},mxGraph.prototype.setCellsCloneable=function(e){this.cellsCloneable=e},mxGraph.prototype.getExportableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.canExportCell(e)}))},mxGraph.prototype.canExportCell=function(e){return this.exportEnabled},mxGraph.prototype.getImportableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.canImportCell(e)}))},mxGraph.prototype.canImportCell=function(e){return this.importEnabled},mxGraph.prototype.isCellSelectable=function(e){return this.isCellsSelectable()},mxGraph.prototype.isCellsSelectable=function(){return this.cellsSelectable},mxGraph.prototype.setCellsSelectable=function(e){this.cellsSelectable=e},mxGraph.prototype.getDeletableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellDeletable(e)}))},mxGraph.prototype.isCellDeletable=function(e){var n=this.view.getState(e);return e=null!=n?n.style:this.getCellStyle(e),this.isCellsDeletable()&&0!=e[mxConstants.STYLE_DELETABLE]},mxGraph.prototype.isCellsDeletable=function(){return this.cellsDeletable},mxGraph.prototype.setCellsDeletable=function(e){this.cellsDeletable=e},mxGraph.prototype.isLabelMovable=function(e){return!this.isCellLocked(e)&&(this.model.isEdge(e)&&this.edgeLabelsMovable||this.model.isVertex(e)&&this.vertexLabelsMovable)},mxGraph.prototype.getMovableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellMovable(e)}))},mxGraph.prototype.isCellMovable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsMovable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_MOVABLE]},mxGraph.prototype.isCellsMovable=function(){return this.cellsMovable},mxGraph.prototype.setCellsMovable=function(e){this.cellsMovable=e},mxGraph.prototype.isGridEnabled=function(){return this.gridEnabled},mxGraph.prototype.setGridEnabled=function(e){this.gridEnabled=e},mxGraph.prototype.isPortsEnabled=function(){return this.portsEnabled},mxGraph.prototype.setPortsEnabled=function(e){this.portsEnabled=e},mxGraph.prototype.getGridSize=function(){return this.gridSize},mxGraph.prototype.setGridSize=function(e){this.gridSize=e},mxGraph.prototype.getTolerance=function(){return this.tolerance},mxGraph.prototype.setTolerance=function(e){this.tolerance=e},mxGraph.prototype.isVertexLabelsMovable=function(){return this.vertexLabelsMovable},mxGraph.prototype.setVertexLabelsMovable=function(e){this.vertexLabelsMovable=e},mxGraph.prototype.isEdgeLabelsMovable=function(){return this.edgeLabelsMovable},mxGraph.prototype.setEdgeLabelsMovable=function(e){this.edgeLabelsMovable=e},mxGraph.prototype.isSwimlaneNesting=function(){return this.swimlaneNesting},mxGraph.prototype.setSwimlaneNesting=function(e){this.swimlaneNesting=e},mxGraph.prototype.isSwimlaneSelectionEnabled=function(){return this.swimlaneSelectionEnabled},mxGraph.prototype.setSwimlaneSelectionEnabled=function(e){this.swimlaneSelectionEnabled=e},mxGraph.prototype.isMultigraph=function(){return this.multigraph},mxGraph.prototype.setMultigraph=function(e){this.multigraph=e},mxGraph.prototype.isAllowLoops=function(){return this.allowLoops},mxGraph.prototype.setAllowDanglingEdges=function(e){this.allowDanglingEdges=e},mxGraph.prototype.isAllowDanglingEdges=function(){return this.allowDanglingEdges},mxGraph.prototype.setConnectableEdges=function(e){this.connectableEdges=e},mxGraph.prototype.isConnectableEdges=function(){return this.connectableEdges},mxGraph.prototype.setCloneInvalidEdges=function(e){this.cloneInvalidEdges=e},mxGraph.prototype.isCloneInvalidEdges=function(){return this.cloneInvalidEdges},mxGraph.prototype.setAllowLoops=function(e){this.allowLoops=e},mxGraph.prototype.isDisconnectOnMove=function(){return this.disconnectOnMove},mxGraph.prototype.setDisconnectOnMove=function(e){this.disconnectOnMove=e},mxGraph.prototype.isDropEnabled=function(){return this.dropEnabled},mxGraph.prototype.setDropEnabled=function(e){this.dropEnabled=e},mxGraph.prototype.isSplitEnabled=function(){return this.splitEnabled},mxGraph.prototype.setSplitEnabled=function(e){this.splitEnabled=e},mxGraph.prototype.isCellResizable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsResizable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_RESIZABLE]},mxGraph.prototype.isCellsResizable=function(){return this.cellsResizable},mxGraph.prototype.setCellsResizable=function(e){this.cellsResizable=e},mxGraph.prototype.isTerminalPointMovable=function(e,n){return!0},mxGraph.prototype.isCellBendable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsBendable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_BENDABLE]},mxGraph.prototype.isCellsBendable=function(){return this.cellsBendable},mxGraph.prototype.setCellsBendable=function(e){this.cellsBendable=e},mxGraph.prototype.isCellEditable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsEditable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_EDITABLE]},mxGraph.prototype.isCellsEditable=function(){return this.cellsEditable},mxGraph.prototype.setCellsEditable=function(e){this.cellsEditable=e},mxGraph.prototype.isCellDisconnectable=function(e,n,t){return this.isCellsDisconnectable()&&!this.isCellLocked(e)},mxGraph.prototype.isCellsDisconnectable=function(){return this.cellsDisconnectable},mxGraph.prototype.setCellsDisconnectable=function(e){this.cellsDisconnectable=e},mxGraph.prototype.isValidSource=function(e){return null==e&&this.allowDanglingEdges||null!=e&&(!this.model.isEdge(e)||this.connectableEdges)&&this.isCellConnectable(e)},mxGraph.prototype.isValidTarget=function(e){return this.isValidSource(e)},mxGraph.prototype.isValidConnection=function(e,n){return this.isValidSource(e)&&this.isValidTarget(n)},mxGraph.prototype.setConnectable=function(e){this.connectionHandler.setEnabled(e)},mxGraph.prototype.isConnectable=function(e){return this.connectionHandler.isEnabled()},mxGraph.prototype.setTooltips=function(e){this.tooltipHandler.setEnabled(e)},mxGraph.prototype.setPanning=function(e){this.panningHandler.panningEnabled=e},mxGraph.prototype.isEditing=function(e){if(null==this.cellEditor)return!1;var n=this.cellEditor.getEditingCell();return null==e?null!=n:e==n},mxGraph.prototype.isAutoSizeCell=function(e){var n=this.view.getState(e);return e=null!=n?n.style:this.getCellStyle(e),this.isAutoSizeCells()||1==e[mxConstants.STYLE_AUTOSIZE]},mxGraph.prototype.isAutoSizeCells=function(){return this.autoSizeCells},mxGraph.prototype.setAutoSizeCells=function(e){this.autoSizeCells=e},mxGraph.prototype.isExtendParent=function(e){return!this.getModel().isEdge(e)&&this.isExtendParents()},mxGraph.prototype.isExtendParents=function(){return this.extendParents},mxGraph.prototype.setExtendParents=function(e){this.extendParents=e},mxGraph.prototype.isExtendParentsOnAdd=function(){return this.extendParentsOnAdd},mxGraph.prototype.setExtendParentsOnAdd=function(e){this.extendParentsOnAdd=e},mxGraph.prototype.isConstrainChild=function(e){return this.isConstrainChildren()&&!this.getModel().isEdge(this.getModel().getParent(e))},mxGraph.prototype.isConstrainChildren=function(){return this.constrainChildren},mxGraph.prototype.setConstrainChildren=function(e){this.constrainChildren=e},mxGraph.prototype.isAllowNegativeCoordinates=function(){return this.allowNegativeCoordinates},mxGraph.prototype.setAllowNegativeCoordinates=function(e){this.allowNegativeCoordinates=e},mxGraph.prototype.getOverlap=function(e){return this.isAllowOverlapParent(e)?this.defaultOverlap:0},mxGraph.prototype.isAllowOverlapParent=function(e){return!1},mxGraph.prototype.getFoldableCells=function(e,n){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellFoldable(e,n)}))},mxGraph.prototype.isCellFoldable=function(e,n){var t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);return 0<this.model.getChildCount(e)&&0!=t[mxConstants.STYLE_FOLDABLE]},mxGraph.prototype.isValidDropTarget=function(e,n,t){return null!=e&&(this.isSplitEnabled()&&this.isSplitTarget(e,n,t)||!this.model.isEdge(e)&&(this.isSwimlane(e)||0<this.model.getChildCount(e)&&!this.isCellCollapsed(e)))},mxGraph.prototype.isSplitTarget=function(e,n,t){return!(!this.model.isEdge(e)||null==n||1!=n.length||!this.isCellConnectable(n[0])||null!=this.getEdgeValidationError(e,this.model.getTerminal(e,!0),n[0]))&&(t=this.model.getTerminal(e,!0),e=this.model.getTerminal(e,!1),!this.model.isAncestor(n[0],t)&&!this.model.isAncestor(n[0],e))},mxGraph.prototype.getDropTarget=function(e,n,t){if(!this.isSwimlaneNesting())for(var a=0;a<e.length;a++)if(this.isSwimlane(e[a]))return null;if((a=mxUtils.convertPoint(this.container,mxEvent.getClientX(n),mxEvent.getClientY(n))).x-=this.panDx,a.y-=this.panDy,a=this.getSwimlaneAt(a.x,a.y),null==t)t=a;else if(null!=a){for(var i=this.model.getParent(a);null!=i&&this.isSwimlane(i)&&i!=t;)i=this.model.getParent(i);i==t&&(t=a)}for(;null!=t&&!this.isValidDropTarget(t,e,n)&&!this.model.isLayer(t);)t=this.model.getParent(t);return!this.model.isLayer(t)&&mxUtils.indexOf(e,t)<0?t:null},mxGraph.prototype.getDefaultParent=function(){var e=this.defaultParent;return null==e&&(null==(e=this.getCurrentRoot())&&(e=this.model.getRoot(),e=this.model.getChildAt(e,0))),e},mxGraph.prototype.setDefaultParent=function(e){this.defaultParent=e},mxGraph.prototype.getSwimlane=function(e){for(;null!=e&&!this.isSwimlane(e);)e=this.model.getParent(e);return e},mxGraph.prototype.getSwimlaneAt=function(e,n,t){if(null!=(t=t||this.getDefaultParent()))for(var a=this.model.getChildCount(t),i=0;i<a;i++){var s=this.model.getChildAt(t,i),o=this.getSwimlaneAt(e,n,s);if(null!=o)return o;if(this.isSwimlane(s)&&(o=this.view.getState(s),this.intersects(o,e,n)))return s}return null},mxGraph.prototype.getCellAt=function(e,n,t,a,i){if(a=null==a||a,i=null==i||i,null!=(t=null!=t?t:this.getDefaultParent()))for(var s=this.model.getChildCount(t)-1;0<=s;s--){var o=this.model.getChildAt(t,s),r=this.getCellAt(e,n,o,a,i);if(null!=r)return r;if(this.isCellVisible(o)&&(i&&this.model.isEdge(o)||a&&this.model.isVertex(o))&&(r=this.view.getState(o),this.intersects(r,e,n)))return o}return null},mxGraph.prototype.intersects=function(e,n,t){if(null!=e){var a=e.absolutePoints;if(null!=a){e=this.tolerance*this.tolerance;for(var i=a[0],s=1;s<a.length;s++){var o=a[s];if(mxUtils.ptSegDistSq(i.x,i.y,o.x,o.y,n,t)<=e)return!0;i=o}}else if(0!=(i=mxUtils.toRadians(mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION)||0))&&(a=Math.cos(-i),i=Math.sin(-i),s=new mxPoint(e.getCenterX(),e.getCenterY()),n=(i=mxUtils.getRotatedPoint(new mxPoint(n,t),a,i,s)).x,t=i.y),mxUtils.contains(e,n,t))return!0}return!1},mxGraph.prototype.hitsSwimlaneContent=function(e,n,t){var a=this.getView().getState(e);if(e=this.getStartSize(e),null!=a){var i=this.getView().getScale();if(n-=a.x,t-=a.y,0<e.width&&0<n&&n>e.width*i||0<e.height&&0<t&&t>e.height*i)return!0}return!1},mxGraph.prototype.getChildVertices=function(e){return this.getChildCells(e,!0,!1)},mxGraph.prototype.getChildEdges=function(e){return this.getChildCells(e,!1,!0)},mxGraph.prototype.getChildCells=function(e,n,t){for(e=null!=e?e:this.getDefaultParent(),e=this.model.getChildCells(e,null!=n&&n,null!=t&&t),n=[],t=0;t<e.length;t++)this.isCellVisible(e[t])&&n.push(e[t]);return n},mxGraph.prototype.getConnections=function(e,n){return this.getEdges(e,n,!0,!0,!1)},mxGraph.prototype.getIncomingEdges=function(e,n){return this.getEdges(e,n,!0,!1,!1)},mxGraph.prototype.getOutgoingEdges=function(e,n){return this.getEdges(e,n,!1,!0,!1)},mxGraph.prototype.getEdges=function(e,n,t,a,i,s){t=null==t||t,a=null==a||a,i=null==i||i,s=null!=s&&s;for(var o=[],r=this.isCellCollapsed(e),l=this.model.getChildCount(e),d=0;d<l;d++){var c=this.model.getChildAt(e,d);!r&&this.isCellVisible(c)||(o=o.concat(this.model.getEdges(c,t,a)))}for(o=o.concat(this.model.getEdges(e,t,a)),r=[],d=0;d<o.length;d++)l=null!=(c=this.view.getState(o[d]))?c.getVisibleTerminal(!0):this.view.getVisibleTerminal(o[d],!0),c=null!=c?c.getVisibleTerminal(!1):this.view.getVisibleTerminal(o[d],!1),(i&&l==c||l!=c&&(t&&c==e&&(null==n||this.isValidAncestor(l,n,s))||a&&l==e&&(null==n||this.isValidAncestor(c,n,s))))&&r.push(o[d]);return r},mxGraph.prototype.isValidAncestor=function(e,n,t){return t?this.model.isAncestor(n,e):this.model.getParent(e)==n},mxGraph.prototype.getOpposites=function(e,n,t,a){t=null==t||t,a=null==a||a;var i=[],s={};if(null!=e)for(var o=0;o<e.length;o++){var r=null!=(l=this.view.getState(e[o]))?l.getVisibleTerminal(!0):this.view.getVisibleTerminal(e[o],!0),l=null!=l?l.getVisibleTerminal(!1):this.view.getVisibleTerminal(e[o],!1);if(r==n&&null!=l&&l!=n&&a){var d=mxCellPath.create(l);null==s[d]&&(s[d]=l,i.push(l))}else l==n&&null!=r&&r!=n&&t&&(null==s[d=mxCellPath.create(r)]&&(s[d]=r,i.push(r)))}return i},mxGraph.prototype.getEdgesBetween=function(e,n,t){t=null!=t&&t;for(var a=this.getEdges(e),i=[],s=0;s<a.length;s++){var o=null!=(r=this.view.getState(a[s]))?r.getVisibleTerminal(!0):this.view.getVisibleTerminal(a[s],!0),r=null!=r?r.getVisibleTerminal(!1):this.view.getVisibleTerminal(a[s],!1);(o==e&&r==n||!t&&o==n&&r==e)&&i.push(a[s])}return i},mxGraph.prototype.getPointForEvent=function(e,n){var t=mxUtils.convertPoint(this.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),a=this.view.scale,i=this.view.translate,s=0!=n?this.gridSize/2:0;return t.x=this.snap(t.x/a-i.x-s),t.y=this.snap(t.y/a-i.y-s),t},mxGraph.prototype.getCells=function(e,n,t,a,i,s){if(s=null!=s?s:[],0<t||0<a){var o=e+t,r=n+a;if(null!=(i=i||this.getDefaultParent()))for(var l=this.model.getChildCount(i),d=0;d<l;d++){var c=this.model.getChildAt(i,d),m=this.view.getState(c);if(this.isCellVisible(c)&&null!=m){var u=m;0!=(m=mxUtils.getValue(m.style,mxConstants.STYLE_ROTATION)||0)&&(u=mxUtils.getBoundingBox(u,m)),u.x>=e&&u.y+u.height<=r&&u.y>=n&&u.x+u.width<=o?s.push(c):this.getCells(e,n,t,a,c,s)}}}return s},mxGraph.prototype.getCellsBeyond=function(e,n,t,a,i){var s=[];if((a||i)&&(null==t&&(t=this.getDefaultParent()),null!=t))for(var o=this.model.getChildCount(t),r=0;r<o;r++){var l=this.model.getChildAt(t,r),d=this.view.getState(l);this.isCellVisible(l)&&null!=d&&(!a||d.x>=e)&&(!i||d.y>=n)&&s.push(l)}return s},mxGraph.prototype.findTreeRoots=function(e,n,t){n=null!=n&&n,t=null!=t&&t;var a=[];if(null!=e){for(var i=this.getModel(),s=i.getChildCount(e),o=null,r=0,l=0;l<s;l++){var d=i.getChildAt(e,l);if(this.model.isVertex(d)&&this.isCellVisible(d)){for(var c=this.getConnections(d,n?e:null),m=0,u=0,p=0;p<c.length;p++)this.view.getVisibleTerminal(c[p],!0)==d?m++:u++;(t&&0==m&&0<u||!t&&0==u&&0<m)&&a.push(d),r<(c=t?u-m:m-u)&&(r=c,o=d)}}0==a.length&&null!=o&&a.push(o)}return a},mxGraph.prototype.traverse=function(e,n,t,a,i){if(null!=t&&null!=e){n=null==n||n,i=i||[];var s=mxCellPath.create(e);if(null==i[s]&&(null==(a=t(i[s]=e,a))||a)&&0<(a=this.model.getEdgeCount(e)))for(s=0;s<a;s++){var o=this.model.getEdgeAt(e,s),r=this.model.getTerminal(o,!0)==e;n&&!r||(r=this.model.getTerminal(o,!r),this.traverse(r,n,t,o,i))}}},mxGraph.prototype.isCellSelected=function(e){return this.getSelectionModel().isSelected(e)},mxGraph.prototype.isSelectionEmpty=function(){return this.getSelectionModel().isEmpty()},mxGraph.prototype.clearSelection=function(){return this.getSelectionModel().clear()},mxGraph.prototype.getSelectionCount=function(){return this.getSelectionModel().cells.length},mxGraph.prototype.getSelectionCell=function(){return this.getSelectionModel().cells[0]},mxGraph.prototype.getSelectionCells=function(){return this.getSelectionModel().cells.slice()},mxGraph.prototype.setSelectionCell=function(e){this.getSelectionModel().setCell(e)},mxGraph.prototype.setSelectionCells=function(e){this.getSelectionModel().setCells(e)},mxGraph.prototype.addSelectionCell=function(e){this.getSelectionModel().addCell(e)},mxGraph.prototype.addSelectionCells=function(e){this.getSelectionModel().addCells(e)},mxGraph.prototype.removeSelectionCell=function(e){this.getSelectionModel().removeCell(e)},mxGraph.prototype.removeSelectionCells=function(e){this.getSelectionModel().removeCells(e)},mxGraph.prototype.selectRegion=function(e,n){var t=this.getCells(e.x,e.y,e.width,e.height);return this.selectCellsForEvent(t,n),t},mxGraph.prototype.selectNextCell=function(){this.selectCell(!0)},mxGraph.prototype.selectPreviousCell=function(){this.selectCell()},mxGraph.prototype.selectParentCell=function(){this.selectCell(!1,!0)},mxGraph.prototype.selectChildCell=function(){this.selectCell(!1,!1,!0)},mxGraph.prototype.selectCell=function(e,n,t){var a=0<(i=this.selectionModel).cells.length?i.cells[0]:null;1<i.cells.length&&i.clear();var i=null!=a?this.model.getParent(a):this.getDefaultParent(),s=this.model.getChildCount(i);null==a&&0<s?(e=this.model.getChildAt(i,0),this.setSelectionCell(e)):null!=a&&!n||null==this.view.getState(i)||null==this.model.getGeometry(i)?null!=a&&t?0<this.model.getChildCount(a)&&(e=this.model.getChildAt(a,0),this.setSelectionCell(e)):0<s&&(n=i.getIndex(a),e=e?(n++,this.model.getChildAt(i,n%s)):(n--,this.model.getChildAt(i,n<0?s-1:n)),this.setSelectionCell(e)):this.getCurrentRoot()!=i&&this.setSelectionCell(i)},mxGraph.prototype.selectAll=function(e){e=e||this.getDefaultParent(),null!=(e=this.model.getChildren(e))&&this.setSelectionCells(e)},mxGraph.prototype.selectVertices=function(e){this.selectCells(!0,!1,e)},mxGraph.prototype.selectEdges=function(e){this.selectCells(!1,!0,e)},mxGraph.prototype.selectCells=function(n,t,e){e=e||this.getDefaultParent();var a=mxUtils.bind(this,function(e){return null!=this.view.getState(e)&&0==this.model.getChildCount(e)&&(this.model.isVertex(e)&&n||this.model.isEdge(e)&&t)});e=this.model.filterDescendants(a,e),this.setSelectionCells(e)},mxGraph.prototype.selectCellForEvent=function(e,n){var t=this.isCellSelected(e);this.isToggleEvent(n)?t?this.removeSelectionCell(e):this.addSelectionCell(e):(!t||1!=this.getSelectionCount())&&this.setSelectionCell(e)},mxGraph.prototype.selectCellsForEvent=function(e,n){this.isToggleEvent(n)?this.addSelectionCells(e):this.setSelectionCells(e)},mxGraph.prototype.createHandler=function(e){var n=null;return null!=e&&(n=this.model.isEdge(e.cell)?(n=this.view.getEdgeStyle(e),this.isLoop(e)||n==mxEdgeStyle.ElbowConnector||n==mxEdgeStyle.SideToSide||n==mxEdgeStyle.TopToBottom?new mxElbowEdgeHandler(e):n==mxEdgeStyle.SegmentConnector||n==mxEdgeStyle.OrthConnector?new mxEdgeSegmentHandler(e):new mxEdgeHandler(e)):new mxVertexHandler(e)),n},mxGraph.prototype.addMouseListener=function(e){null==this.mouseListeners&&(this.mouseListeners=[]),this.mouseListeners.push(e)},mxGraph.prototype.removeMouseListener=function(e){if(null!=this.mouseListeners)for(var n=0;n<this.mouseListeners.length;n++)if(this.mouseListeners[n]==e){this.mouseListeners.splice(n,1);break}},mxGraph.prototype.updateMouseEvent=function(e){if(null==e.graphX||null==e.graphY){var n=mxUtils.convertPoint(this.container,e.getX(),e.getY());e.graphX=n.x-this.panDx,e.graphY=n.y-this.panDy}},mxGraph.prototype.fireMouseEvent=function(e,n,t){if(null==t&&(t=this),this.updateMouseEvent(n),e==mxEvent.MOUSE_DOWN&&(this.isMouseDown=!0),mxClient.IS_TOUCH&&this.doubleTapEnabled&&e==mxEvent.MOUSE_DOWN){var a=(new Date).getTime();a-this.lastTouchTime<this.doubleTapTimeout&&Math.abs(this.lastTouchX-n.getX())<this.doubleTapTolerance&&Math.abs(this.lastTouchY-n.getY())<this.doubleTapTolerance?(this.lastTouchTime=0,this.dblClick(n.getEvent(),n.getCell()),n.getEvent().cancelBubble=!0):(this.lastTouchX=n.getX(),this.lastTouchY=n.getY(),this.lastTouchTime=a)}if(a=2!=n.getEvent().detail,mxClient.IS_IE&&"CSS1Compat"==document.compatMode&&((null!=this.lastMouseX&&Math.abs(this.lastMouseX-n.getX())>this.doubleTapTolerance||null!=this.lastMouseY&&Math.abs(this.lastMouseY-n.getY())>this.doubleTapTolerance)&&(a=!0),e==mxEvent.MOUSE_UP&&(this.lastMouseX=n.getX(),this.lastMouseY=n.getY())),(e!=mxEvent.MOUSE_UP||this.isMouseDown)&&a){if(e==mxEvent.MOUSE_UP&&(this.isMouseDown=!1),!this.isEditing()&&(mxClient.IS_OP||mxClient.IS_SF||mxClient.IS_GC||mxClient.IS_IE&&mxClient.IS_SVG||n.getEvent().target!=this.container)){if(e==mxEvent.MOUSE_MOVE&&this.isMouseDown&&this.autoScroll&&this.scrollPointToVisible(n.getGraphX(),n.getGraphY(),this.autoExtend),null!=this.mouseListeners)for(t=[t,n],n.getEvent().returnValue=!0,a=0;a<this.mouseListeners.length;a++){var i=this.mouseListeners[a];e==mxEvent.MOUSE_DOWN?i.mouseDown.apply(i,t):e==mxEvent.MOUSE_MOVE?i.mouseMove.apply(i,t):e==mxEvent.MOUSE_UP&&i.mouseUp.apply(i,t)}e==mxEvent.MOUSE_UP&&this.click(n)}}else e==mxEvent.MOUSE_UP&&(this.isMouseDown=!1)},mxGraph.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,null!=this.tooltipHandler&&this.tooltipHandler.destroy(),null!=this.selectionCellsHandler&&this.selectionCellsHandler.destroy(),null!=this.panningHandler&&this.panningHandler.destroy(),null!=this.connectionHandler&&this.connectionHandler.destroy(),null!=this.graphHandler&&this.graphHandler.destroy(),null!=this.cellEditor&&this.cellEditor.destroy(),null!=this.view&&this.view.destroy(),null!=this.model&&null!=this.graphModelChangeListener&&(this.model.removeListener(this.graphModelChangeListener),this.graphModelChangeListener=null),this.container=null)},mxCellOverlay.prototype=new mxEventSource,mxCellOverlay.prototype.constructor=mxCellOverlay,mxCellOverlay.prototype.image=null,mxCellOverlay.prototype.tooltip=null,mxCellOverlay.prototype.align=mxConstants.ALIGN_RIGHT,mxCellOverlay.prototype.verticalAlign=mxConstants.ALIGN_BOTTOM,mxCellOverlay.prototype.offset=null,mxCellOverlay.prototype.cursor=null,mxCellOverlay.prototype.defaultOverlap=.5,mxCellOverlay.prototype.getBounds=function(e){var n=e.view.graph.getModel().isEdge(e.cell),t=e.view.scale,a=null,i=this.image.width,s=this.image.height;return n?a=1==(n=e.absolutePoints).length%2?n[Math.floor(n.length/2)]:(e=n[(a=n.length/2)-1],n=n[a],new mxPoint(e.x+(n.x-e.x)/2,e.y+(n.y-e.y)/2)):((a=new mxPoint).x=this.align==mxConstants.ALIGN_LEFT?e.x:this.align==mxConstants.ALIGN_CENTER?e.x+e.width/2:e.x+e.width,a.y=this.verticalAlign==mxConstants.ALIGN_TOP?e.y:this.verticalAlign==mxConstants.ALIGN_MIDDLE?e.y+e.height/2:e.y+e.height),new mxRectangle(Math.round(a.x-(i*this.defaultOverlap-this.offset.x)*t),Math.round(a.y-(s*this.defaultOverlap-this.offset.y)*t),i*t,s*t)},mxCellOverlay.prototype.toString=function(){return this.tooltip},mxOutline.prototype.source=null,mxOutline.prototype.outline=null,mxOutline.prototype.graphRenderHint=mxConstants.RENDERING_HINT_FASTER,mxOutline.prototype.enabled=!0,mxOutline.prototype.showViewport=!0,mxOutline.prototype.border=10,mxOutline.prototype.sizerSize=8,mxOutline.prototype.updateOnPan=!1,mxOutline.prototype.sizerImage=null,mxOutline.prototype.suspended=!1,mxOutline.prototype.init=function(e){this.outline=new mxGraph(e,this.source.getModel(),this.graphRenderHint,this.source.getStylesheet()),this.outline.foldingEnabled=!1,this.outline.autoScroll=!1;var n=this.outline.graphModelChanged;this.outline.graphModelChanged=mxUtils.bind(this,function(e){!this.suspended&&null!=this.outline&&n.apply(this.outline,arguments)}),mxClient.IS_SVG&&((e=this.outline.getView().getCanvas().parentNode).setAttribute("shape-rendering","optimizeSpeed"),e.setAttribute("image-rendering","optimizeSpeed")),this.outline.labelsVisible=!1,this.outline.setEnabled(!1),this.updateHandler=mxUtils.bind(this,function(e,n){!this.suspended&&!this.active&&this.update()}),this.source.getModel().addListener(mxEvent.CHANGE,this.updateHandler),this.outline.addMouseListener(this),(e=this.source.getView()).addListener(mxEvent.SCALE,this.updateHandler),e.addListener(mxEvent.TRANSLATE,this.updateHandler),e.addListener(mxEvent.SCALE_AND_TRANSLATE,this.updateHandler),e.addListener(mxEvent.DOWN,this.updateHandler),e.addListener(mxEvent.UP,this.updateHandler),mxEvent.addListener(this.source.container,"scroll",this.updateHandler),this.panHandler=mxUtils.bind(this,function(e){this.updateOnPan&&this.updateHandler.apply(this,arguments)}),this.source.addListener(mxEvent.PAN,this.panHandler),this.refreshHandler=mxUtils.bind(this,function(e){this.outline.setStylesheet(this.source.getStylesheet()),this.outline.refresh()}),this.source.addListener(mxEvent.REFRESH,this.refreshHandler),this.bounds=new mxRectangle(0,0,0,0),this.selectionBorder=new mxRectangleShape(this.bounds,null,mxConstants.OUTLINE_COLOR,mxConstants.OUTLINE_STROKEWIDTH),this.selectionBorder.dialect=this.outline.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.selectionBorder.init(this.outline.getView().getOverlayPane()),mxEvent.redirectMouseEvents(this.selectionBorder.node,this.outline),this.selectionBorder.node.style.background="",this.sizer=this.createSizer(),this.sizer.init(this.outline.getView().getOverlayPane()),this.enabled&&(this.sizer.node.style.cursor="pointer"),mxEvent.addListener(this.sizer.node,mxClient.IS_TOUCH?"touchstart":"mousedown",mxUtils.bind(this,function(e){this.outline.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))})),this.selectionBorder.node.style.display=this.showViewport?"":"none",this.sizer.node.style.display=this.selectionBorder.node.style.display,this.selectionBorder.node.style.cursor="move",this.update(!1)},mxOutline.prototype.isEnabled=function(){return this.enabled},mxOutline.prototype.setEnabled=function(e){this.enabled=e},mxOutline.prototype.setZoomEnabled=function(e){this.sizer.node.style.visibility=e?"visible":"hidden"},mxOutline.prototype.refresh=function(){this.update(!0)},mxOutline.prototype.createSizer=function(){var e=null!=this.sizerImage?new mxImageShape(new mxRectangle(0,0,this.sizerImage.width,this.sizerImage.height),this.sizerImage.src):new mxRectangleShape(new mxRectangle(0,0,this.sizerSize,this.sizerSize),mxConstants.OUTLINE_HANDLE_FILLCOLOR,mxConstants.OUTLINE_HANDLE_STROKECOLOR);return e.dialect=this.outline.dialect,e},mxOutline.prototype.getSourceContainerSize=function(){return new mxRectangle(0,0,this.source.container.scrollWidth,this.source.container.scrollHeight)},mxOutline.prototype.getOutlineOffset=function(e){return null},mxOutline.prototype.update=function(e){if(null!=this.source){var n=this.source.view.scale,t=new mxRectangle((t=this.source.getGraphBounds()).x/n+this.source.panDx,t.y/n+this.source.panDy,t.width/n,t.height/n),a=new mxRectangle(0,0,this.source.container.clientWidth/n,this.source.container.clientHeight/n);(s=t.clone()).add(a);var i=this.getSourceContainerSize(),s=(a=Math.max(i.width/n,s.width),n=Math.max(i.height/n,s.height),Math.max(0,this.outline.container.clientWidth-this.border));i=Math.max(0,this.outline.container.clientHeight-this.border);if(0<(s=Math.min(s/a,i/n))){this.outline.getView().scale!=s&&(this.outline.getView().scale=s,e=!0),(a=this.outline.getView()).currentRoot!=this.source.getView().currentRoot&&a.setCurrentRoot(this.source.getView().currentRoot);i=(n=this.source.view.translate).x+this.source.panDx;var o=n.y+this.source.panDy;null!=(s=this.getOutlineOffset(s))&&(i+=s.x,o+=s.y),t.x<0&&(i-=t.x),t.y<0&&(o-=t.y),a.translate.x==i&&a.translate.y==o||(a.translate.x=i,a.translate.y=o,e=!0);t=a.translate,i=(s=this.source.getView().scale)/a.scale,o=1/a.scale;var r=this.source.container;this.bounds=new mxRectangle((t.x-n.x-this.source.panDx)/o,(t.y-n.y-this.source.panDy)/o,r.clientWidth/i,r.clientHeight/i),this.bounds.x+=this.source.container.scrollLeft*a.scale/s,this.bounds.y+=this.source.container.scrollTop*a.scale/s,(t=this.selectionBorder.bounds).x==this.bounds.x&&t.y==this.bounds.y&&t.width==this.bounds.width&&t.height==this.bounds.height||(this.selectionBorder.bounds=this.bounds,this.selectionBorder.redraw()),t=this.sizer.bounds,a=new mxRectangle(this.bounds.x+this.bounds.width-t.width/2,this.bounds.y+this.bounds.height-t.height/2,t.width,t.height),t.x==a.x&&t.y==a.y&&t.width==a.width&&t.height==a.height||(this.sizer.bounds=a,"hidden"!=this.sizer.node.style.visibility&&this.sizer.redraw()),e&&this.outline.view.revalidate()}}},mxOutline.prototype.mouseDown=function(e,n){this.enabled&&this.showViewport&&(this.zoom=n.isSource(this.sizer),this.startX=n.getX(),this.startY=n.getY(),this.active=!0,this.source.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.source.container)?(this.dx0=this.source.container.scrollLeft,this.dy0=this.source.container.scrollTop):this.dy0=this.dx0=0),n.consume()},mxOutline.prototype.mouseMove=function(e,n){if(this.active){this.selectionBorder.node.style.display=this.showViewport?"":"none",this.sizer.node.style.display=this.selectionBorder.node.style.display;var t=n.getX()-this.startX,a=n.getY()-this.startY,i=null;if(this.zoom)a=t/((i=this.source.container).clientWidth/i.clientHeight),i=new mxRectangle(this.bounds.x,this.bounds.y,Math.max(1,this.bounds.width+t),Math.max(1,this.bounds.height+a)),this.selectionBorder.bounds=i,this.selectionBorder.redraw();else{var s=this.outline.getView().scale;i=new mxRectangle(this.bounds.x+t,this.bounds.y+a,this.bounds.width,this.bounds.height);this.selectionBorder.bounds=i,this.selectionBorder.redraw(),t=t/s*this.source.getView().scale,a=a/s*this.source.getView().scale,this.source.panGraph(-t-this.dx0,-a-this.dy0)}t=this.sizer.bounds,this.sizer.bounds=new mxRectangle(i.x+i.width-t.width/2,i.y+i.height-t.height/2,t.width,t.height),"hidden"!=this.sizer.node.style.visibility&&this.sizer.redraw(),n.consume()}},mxOutline.prototype.mouseUp=function(e,n){if(this.active){var t=n.getX()-this.startX,a=n.getY()-this.startY;if(0<Math.abs(t)||0<Math.abs(a)){if(this.zoom){a=this.selectionBorder.bounds.width;var i=this.source.getView().scale;this.source.zoomTo(i-t*i/a,!1)}else this.source.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.source.container)||(this.source.panGraph(0,0),t/=this.outline.getView().scale,a/=this.outline.getView().scale,i=this.source.getView().translate,this.source.getView().setTranslate(i.x-t,i.y-a));this.update(),n.consume()}this.index=null,this.active=!1}},mxOutline.prototype.destroy=function(){null!=this.source&&(this.source.removeListener(this.panHandler),this.source.removeListener(this.refreshHandler),this.source.getModel().removeListener(this.updateHandler),this.source.getView().removeListener(this.updateHandler),mxEvent.addListener(this.source.container,"scroll",this.updateHandler),this.source=null),null!=this.outline&&(this.outline.removeMouseListener(this),this.outline.destroy(),this.outline=null),null!=this.selectionBorder&&(this.selectionBorder.destroy(),this.selectionBorder=null),null!=this.sizer&&(this.sizer.destroy(),this.sizer=null)},mxMultiplicity.prototype.type=null,mxMultiplicity.prototype.attr=null,mxMultiplicity.prototype.value=null,mxMultiplicity.prototype.source=null,mxMultiplicity.prototype.min=null,mxMultiplicity.prototype.max=null,mxMultiplicity.prototype.validNeighbors=null,mxMultiplicity.prototype.validNeighborsAllowed=!0,mxMultiplicity.prototype.countError=null,mxMultiplicity.prototype.typeError=null,mxMultiplicity.prototype.check=function(e,n,t,a,i,s){var o="";return(this.source&&this.checkTerminal(e,t,n)||!this.source&&this.checkTerminal(e,a,n))&&(null!=this.countError&&(this.source&&(0==this.max||i>=this.max)||!this.source&&(0==this.max||s>=this.max))&&(o+=this.countError+"\n"),null!=this.validNeighbors&&null!=this.typeError&&0<this.validNeighbors.length&&(this.checkNeighbors(e,n,t,a)||(o+=this.typeError+"\n"))),0<o.length?o:null},mxMultiplicity.prototype.checkNeighbors=function(e,n,t,a){n=e.model.getValue(t),a=e.model.getValue(a),t=!this.validNeighborsAllowed;for(var i=this.validNeighbors,s=0;s<i.length;s++){if(this.source&&this.checkType(e,a,i[s])){t=this.validNeighborsAllowed;break}if(!this.source&&this.checkType(e,n,i[s])){t=this.validNeighborsAllowed;break}}return t},mxMultiplicity.prototype.checkTerminal=function(e,n,t){return n=e.model.getValue(n),this.checkType(e,n,this.type,this.attr,this.value)},mxMultiplicity.prototype.checkType=function(e,n,t,a,i){return null!=n&&(isNaN(n.nodeType)?n==t:mxUtils.isNode(n,t,a,i))},mxLayoutManager.prototype=new mxEventSource,mxLayoutManager.prototype.constructor=mxLayoutManager,mxLayoutManager.prototype.graph=null,mxLayoutManager.prototype.bubbling=!0,mxLayoutManager.prototype.enabled=!0,mxLayoutManager.prototype.updateHandler=null,mxLayoutManager.prototype.moveHandler=null,mxLayoutManager.prototype.isEnabled=function(){return this.enabled},mxLayoutManager.prototype.setEnabled=function(e){this.enabled=e},mxLayoutManager.prototype.isBubbling=function(){return this.bubbling},mxLayoutManager.prototype.setBubbling=function(e){this.bubbling=e},mxLayoutManager.prototype.getGraph=function(){return this.graph},mxLayoutManager.prototype.setGraph=function(e){if(null!=this.graph){var n=this.graph.getModel();n.removeListener(this.undoHandler),this.graph.removeListener(this.moveHandler)}this.graph=e,null!=this.graph&&((n=this.graph.getModel()).addListener(mxEvent.BEFORE_UNDO,this.undoHandler),this.graph.addListener(mxEvent.MOVE_CELLS,this.moveHandler))},mxLayoutManager.prototype.getLayout=function(e){return null},mxLayoutManager.prototype.beforeUndo=function(e){e=this.getCellsForChanges(e.changes);var n=this.getGraph().getModel();if(this.isBubbling())for(var t=n.getParents(e);0<t.length;)e=e.concat(t),t=n.getParents(t);this.layoutCells(mxUtils.sortCells(e,!1))},mxLayoutManager.prototype.cellsMoved=function(e,n){if(null!=e&&null!=n)for(var t=mxUtils.convertPoint(this.getGraph().container,mxEvent.getClientX(n),mxEvent.getClientY(n)),a=this.getGraph().getModel(),i=0;i<e.length;i++){var s=this.getLayout(a.getParent(e[i]));null!=s&&s.moveCell(e[i],t.x,t.y)}},mxLayoutManager.prototype.getCellsForChanges=function(e){for(var n=[],t={},a=0;a<e.length;a++){if((i=e[a])instanceof mxRootChange)return[];for(var i=this.getCellsForChange(i),s=0;s<i.length;s++)if(null!=i[s]){var o=mxCellPath.create(i[s]);null==t[o]&&(t[o]=i[s],n.push(i[s]))}}return n},mxLayoutManager.prototype.getCellsForChange=function(e){var n=this.getGraph().getModel();return e instanceof mxChildChange?[e.child,e.previous,n.getParent(e.child)]:e instanceof mxTerminalChange||e instanceof mxGeometryChange?[e.cell,n.getParent(e.cell)]:[]},mxLayoutManager.prototype.layoutCells=function(e){if(0<e.length){var n=this.getGraph().getModel();n.beginUpdate();try{for(var t=null,a=0;a<e.length;a++)e[a]!=n.getRoot()&&e[a]!=t&&(t=e[a],this.executeLayout(this.getLayout(t),t));this.fireEvent(new mxEventObject(mxEvent.LAYOUT_CELLS,"cells",e))}finally{n.endUpdate()}}},mxLayoutManager.prototype.executeLayout=function(e,n){null!=e&&null!=n&&e.execute(n)},mxLayoutManager.prototype.destroy=function(){this.setGraph(null)},mxSpaceManager.prototype=new mxEventSource,mxSpaceManager.prototype.constructor=mxSpaceManager,mxSpaceManager.prototype.graph=null,mxSpaceManager.prototype.enabled=!0,mxSpaceManager.prototype.shiftRightwards=!0,mxSpaceManager.prototype.shiftDownwards=!0,mxSpaceManager.prototype.extendParents=!0,mxSpaceManager.prototype.resizeHandler=null,mxSpaceManager.prototype.foldHandler=null,mxSpaceManager.prototype.isCellIgnored=function(e){return!this.getGraph().getModel().isVertex(e)},mxSpaceManager.prototype.isCellShiftable=function(e){return this.getGraph().getModel().isVertex(e)&&this.getGraph().isCellMovable(e)},mxSpaceManager.prototype.isEnabled=function(){return this.enabled},mxSpaceManager.prototype.setEnabled=function(e){this.enabled=e},mxSpaceManager.prototype.isShiftRightwards=function(){return this.shiftRightwards},mxSpaceManager.prototype.setShiftRightwards=function(e){this.shiftRightwards=e},mxSpaceManager.prototype.isShiftDownwards=function(){return this.shiftDownwards},mxSpaceManager.prototype.setShiftDownwards=function(e){this.shiftDownwards=e},mxSpaceManager.prototype.isExtendParents=function(){return this.extendParents},mxSpaceManager.prototype.setExtendParents=function(e){this.extendParents=e},mxSpaceManager.prototype.getGraph=function(){return this.graph},mxSpaceManager.prototype.setGraph=function(e){null!=this.graph&&(this.graph.removeListener(this.resizeHandler),this.graph.removeListener(this.foldHandler)),this.graph=e,null!=this.graph&&(this.graph.addListener(mxEvent.RESIZE_CELLS,this.resizeHandler),this.graph.addListener(mxEvent.FOLD_CELLS,this.foldHandler))},mxSpaceManager.prototype.cellsResized=function(e){if(null!=e){var n=this.graph.getModel();n.beginUpdate();try{for(var t=0;t<e.length;t++)if(!this.isCellIgnored(e[t])){this.cellResized(e[t]);break}}finally{n.endUpdate()}}},mxSpaceManager.prototype.cellResized=function(e){var n=this.getGraph(),t=n.getView(),a=n.getModel(),i=t.getState(e),s=t.getState(a.getParent(e));if(null!=i&&null!=s){var o=this.getCellsToShift(i),r=a.getGeometry(e);if(null!=o&&null!=r){var l=t.translate,d=t.scale,c=(t=i.x-s.origin.x-l.x*d,s=i.y-s.origin.y-l.y*d,l=i.x+i.width,i.y+i.height),m=i.width-r.width*d+t-r.x*d,u=i.height-r.height*d+s-r.y*d,p=1-r.width*d/i.width;i=1-r.height*d/i.height;a.beginUpdate();try{for(r=0;r<o.length;r++)o[r]!=e&&this.isCellShiftable(o[r])&&this.shiftCell(o[r],m,u,t,s,l,c,p,i,this.isExtendParents()&&n.isExtendParent(o[r]))}finally{a.endUpdate()}}}},mxSpaceManager.prototype.shiftCell=function(e,n,t,a,i,s,o,r,l,d){var c=(a=this.getGraph()).getView().getState(e);if(null!=c){var m=a.getModel();if(null!=(p=m.getGeometry(e))){m.beginUpdate();try{if(this.isShiftRightwards())if(c.x>=s)(p=p.clone()).translate(-n,0);else{var u=Math.max(0,c.x-x0);(p=p.clone()).translate(-r*u,0)}if(this.isShiftDownwards())if(c.y>=o)(p=p.clone()).translate(0,-t);else{var p,g=Math.max(0,c.y-i);(p=p.clone()).translate(0,-l*g)}p!=m.getGeometry(e)&&(m.setGeometry(e,p),d&&a.extendParent(e))}finally{m.endUpdate()}}}},mxSpaceManager.prototype.getCellsToShift=function(e){var n=this.getGraph(),t=n.getModel().getParent(e.cell),a=this.isShiftDownwards(),i=this.isShiftRightwards();return n.getCellsBeyond(e.x+(a?0:e.width),e.y+(a&&i?0:e.height),t,i,a)},mxSpaceManager.prototype.destroy=function(){this.setGraph(null)},mxSwimlaneManager.prototype=new mxEventSource,mxSwimlaneManager.prototype.constructor=mxSwimlaneManager,mxSwimlaneManager.prototype.graph=null,mxSwimlaneManager.prototype.enabled=!0,mxSwimlaneManager.prototype.horizontal=!0,mxSwimlaneManager.prototype.addEnabled=!0,mxSwimlaneManager.prototype.resizeEnabled=!0,mxSwimlaneManager.prototype.addHandler=null,mxSwimlaneManager.prototype.resizeHandler=null,mxSwimlaneManager.prototype.isEnabled=function(){return this.enabled},mxSwimlaneManager.prototype.setEnabled=function(e){this.enabled=e},mxSwimlaneManager.prototype.isHorizontal=function(){return this.horizontal},mxSwimlaneManager.prototype.setHorizontal=function(e){this.horizontal=e},mxSwimlaneManager.prototype.isAddEnabled=function(){return this.addEnabled},mxSwimlaneManager.prototype.setAddEnabled=function(e){this.addEnabled=e},mxSwimlaneManager.prototype.isResizeEnabled=function(){return this.resizeEnabled},mxSwimlaneManager.prototype.setResizeEnabled=function(e){this.resizeEnabled=e},mxSwimlaneManager.prototype.getGraph=function(){return this.graph},mxSwimlaneManager.prototype.setGraph=function(e){null!=this.graph&&(this.graph.removeListener(this.addHandler),this.graph.removeListener(this.resizeHandler)),this.graph=e,null!=this.graph&&(this.graph.addListener(mxEvent.ADD_CELLS,this.addHandler),this.graph.addListener(mxEvent.CELLS_RESIZED,this.resizeHandler))},mxSwimlaneManager.prototype.isSwimlaneIgnored=function(e){return!this.getGraph().isSwimlane(e)},mxSwimlaneManager.prototype.isCellHorizontal=function(e){if(this.graph.isSwimlane(e)){var n=this.graph.view.getState(e);return e=null!=n?n.style:this.graph.getCellStyle(e),1==mxUtils.getValue(e,mxConstants.STYLE_HORIZONTAL,1)}return!this.isHorizontal()},mxSwimlaneManager.prototype.cellsAdded=function(e){if(null!=e){var n=this.getGraph().getModel();n.beginUpdate();try{for(var t=0;t<e.length;t++)this.isSwimlaneIgnored(e[t])||this.swimlaneAdded(e[t])}finally{n.endUpdate()}}},mxSwimlaneManager.prototype.swimlaneAdded=function(e){for(var n=this.getGraph().getModel(),t=n.getParent(e),a=n.getChildCount(t),i=null,s=0;s<a;s++){var o=n.getChildAt(t,s);if(o!=e&&!this.isSwimlaneIgnored(o)&&null!=(i=n.getGeometry(o)))break}null!=i&&this.resizeSwimlane(e,i.width,i.height)},mxSwimlaneManager.prototype.cellsResized=function(e){if(null!=e){var n=this.getGraph().getModel();n.beginUpdate();try{for(var t=0;t<e.length;t++)if(!this.isSwimlaneIgnored(e[t])){var a=n.getGeometry(e[t]);if(null!=a){for(var i=new mxRectangle(0,0,a.width,a.height),s=o=e[t];null!=s;){var o=s,r=(s=n.getParent(s),this.graph.isSwimlane(s)?this.graph.getStartSize(s):new mxRectangle);i.width+=r.width,i.height+=r.height}this.resizeSwimlane(o,i.width,i.height)}}}finally{n.endUpdate()}}},mxSwimlaneManager.prototype.resizeSwimlane=function(e,n,t){var a=this.getGraph().getModel();a.beginUpdate();try{if(!this.isSwimlaneIgnored(e))if(null!=(r=a.getGeometry(e))){var i=this.isCellHorizontal(e);(i&&r.height!=t||!i&&r.width!=n)&&(r=r.clone(),i?r.height=t:r.width=n,a.setGeometry(e,r))}var s=this.graph.isSwimlane(e)?this.graph.getStartSize(e):new mxRectangle;n-=s.width,t-=s.height;for(var o=a.getChildCount(e),r=0;r<o;r++){var l=a.getChildAt(e,r);this.resizeSwimlane(l,n,t)}}finally{a.endUpdate()}},mxSwimlaneManager.prototype.destroy=function(){this.setGraph(null)},mxTemporaryCellStates.prototype.view=null,mxTemporaryCellStates.prototype.oldStates=null,mxTemporaryCellStates.prototype.oldBounds=null,mxTemporaryCellStates.prototype.oldScale=null,mxTemporaryCellStates.prototype.destroy=function(){this.view.setScale(this.oldScale),this.view.setStates(this.oldStates),this.view.setGraphBounds(this.oldBounds)},mxCellStatePreview.prototype.graph=null,mxCellStatePreview.prototype.deltas=null,mxCellStatePreview.prototype.count=0,mxCellStatePreview.prototype.isEmpty=function(){return 0==this.count},mxCellStatePreview.prototype.moveState=function(e,n,t,a,i){a=null==a||a,i=null==i||i;var s=mxCellPath.create(e.cell),o=this.deltas[s];return null==o?(o=new mxPoint(n,t),this.deltas[s]=o,this.count++):a?(o.X+=n,o.Y+=t):(o.X=n,o.Y=t),i&&this.addEdges(e),o},mxCellStatePreview.prototype.show=function(e){var n,t=this.graph.getModel(),a=t.getRoot();for(n in this.deltas){var i=mxCellPath.resolve(a,n),s=this.graph.view.getState(i),o=this.deltas[n];i=this.graph.view.getState(t.getParent(i));this.translateState(i,s,o.x,o.y)}for(n in this.deltas)i=mxCellPath.resolve(a,n),s=this.graph.view.getState(i),o=this.deltas[n],i=this.graph.view.getState(t.getParent(i)),this.revalidateState(i,s,o.x,o.y,e)},mxCellStatePreview.prototype.translateState=function(e,n,t,a){if(null!=n){var i=this.graph.getModel();if(i.isVertex(n.cell)){n.invalid=!0,this.graph.view.validateBounds(e,n.cell),e=i.getGeometry(n.cell);var s=mxCellPath.create(n.cell);0==t&&0==a||null==e||e.relative&&null==this.deltas[s]||(n.x+=t,n.y+=a)}for(e=i.getChildCount(n.cell),s=0;s<e;s++)this.translateState(n,this.graph.view.getState(i.getChildAt(n.cell,s)),t,a)}},mxCellStatePreview.prototype.revalidateState=function(e,n,t,a,i){if(null!=n){n.invalid=!0,this.graph.view.validatePoints(e,n.cell);var s=mxCellPath.create(n.cell),o=this.graph.getModel(),r=this.graph.getCellGeometry(n.cell);for(0==t&&0==a||null==r||!r.relative||!o.isVertex(n.cell)||null!=e&&!o.isVertex(e.cell)&&null==this.deltas[s]||(n.x+=t,n.y+=a,this.graph.cellRenderer.redraw(n)),null!=i&&i(n),e=o.getChildCount(n.cell),s=0;s<e;s++)this.revalidateState(n,this.graph.view.getState(o.getChildAt(n.cell,s)),t,a,i)}},mxCellStatePreview.prototype.addEdges=function(e){for(var n=this.graph.getModel(),t=n.getEdgeCount(e.cell),a=0;a<t;a++){var i=this.graph.view.getState(n.getEdgeAt(e.cell,a));null!=i&&this.moveState(i,0,0)}},mxConnectionConstraint.prototype.point=null,mxConnectionConstraint.prototype.perimeter=null,mxGraphHandler.prototype.graph=null,mxGraphHandler.prototype.maxCells=mxClient.IS_IE?20:50,mxGraphHandler.prototype.enabled=!0,mxGraphHandler.prototype.highlightEnabled=!0,mxGraphHandler.prototype.cloneEnabled=!0,mxGraphHandler.prototype.moveEnabled=!0,mxGraphHandler.prototype.guidesEnabled=!1,mxGraphHandler.prototype.guide=null,mxGraphHandler.prototype.currentDx=null,mxGraphHandler.prototype.currentDy=null,mxGraphHandler.prototype.updateCursor=!0,mxGraphHandler.prototype.selectEnabled=!0,mxGraphHandler.prototype.removeCellsFromParent=!0,mxGraphHandler.prototype.connectOnDrop=!1,mxGraphHandler.prototype.scrollOnMove=!0,mxGraphHandler.prototype.minimumSize=6,mxGraphHandler.prototype.previewColor="black",mxGraphHandler.prototype.htmlPreview=!1,mxGraphHandler.prototype.shape=null,mxGraphHandler.prototype.scaleGrid=!1,mxGraphHandler.prototype.rotationEnabled=!0,mxGraphHandler.prototype.isEnabled=function(){return this.enabled},mxGraphHandler.prototype.setEnabled=function(e){this.enabled=e},mxGraphHandler.prototype.isCloneEnabled=function(){return this.cloneEnabled},mxGraphHandler.prototype.setCloneEnabled=function(e){this.cloneEnabled=e},mxGraphHandler.prototype.isMoveEnabled=function(){return this.moveEnabled},mxGraphHandler.prototype.setMoveEnabled=function(e){this.moveEnabled=e},mxGraphHandler.prototype.isSelectEnabled=function(){return this.selectEnabled},mxGraphHandler.prototype.setSelectEnabled=function(e){this.selectEnabled=e},mxGraphHandler.prototype.isRemoveCellsFromParent=function(){return this.removeCellsFromParent},mxGraphHandler.prototype.setRemoveCellsFromParent=function(e){this.removeCellsFromParent=e},mxGraphHandler.prototype.getInitialCellForEvent=function(e){return e.getCell()},mxGraphHandler.prototype.isDelayedSelection=function(e){return this.graph.isCellSelected(e)},mxGraphHandler.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.isEnabled()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(n.getEvent())&&null!=n.getState()){var t=this.getInitialCellForEvent(n);if(this.cell=null,this.delayedSelection=this.isDelayedSelection(t),this.isSelectEnabled()&&!this.delayedSelection&&this.graph.selectCellForEvent(t,n.getEvent()),this.isMoveEnabled()){var a=this.graph.model,i=a.getGeometry(t);this.graph.isCellMovable(t)&&(!a.isEdge(t)||1<this.graph.getSelectionCount()||null!=i.points&&0<i.points.length||null==a.getTerminal(t,!0)||null==a.getTerminal(t,!1)||this.graph.allowDanglingEdges||this.graph.isCloneEvent(n.getEvent())&&this.graph.isCellsCloneable())&&this.start(t,n.getX(),n.getY()),this.cellWasClicked=!0,!mxClient.IS_SF&&!mxClient.IS_GC||"SELECT"!=n.getSource().nodeName?n.consume():mxClient.IS_SF&&"SELECT"==n.getSource().nodeName&&(this.cellWasClicked=!1,this.first=null)}}},mxGraphHandler.prototype.getGuideStates=function(){var e=this.graph.getDefaultParent(),n=this.graph.getModel(),t=mxUtils.bind(this,function(e){return null!=this.graph.view.getState(e)&&n.isVertex(e)&&null!=n.getGeometry(e)&&!n.getGeometry(e).relative});return this.graph.view.getCellStates(n.filterDescendants(t,e))},mxGraphHandler.prototype.getCells=function(e){return!this.delayedSelection&&this.graph.isCellMovable(e)?[e]:this.graph.getMovableCells(this.graph.getSelectionCells())},mxGraphHandler.prototype.getPreviewBounds=function(e){return null!=(e=this.getBoundingBox(e))&&(e.grow(-1,-1),e.width<this.minimumSize&&(e.x-=(this.minimumSize-e.width)/2,e.width=this.minimumSize),e.height<this.minimumSize&&(e.y-=(this.minimumSize-e.height)/2,e.height=this.minimumSize)),e},mxGraphHandler.prototype.getBoundingBox=function(e){var n=null;if(null!=e&&0<e.length)for(var t=this.graph.getModel(),a=0;a<e.length;a++)if(t.isVertex(e[a])||t.isEdge(e[a])){var i=this.graph.view.getState(e[a]);if(null!=i){var s=i;t.isVertex(e[a])&&null!=i.shape&&null!=i.shape.boundingBox&&(s=i.shape.boundingBox),null==n?n=new mxRectangle(s.x,s.y,s.width,s.height):n.add(s)}}return n},mxGraphHandler.prototype.createPreviewShape=function(e){return(e=new mxRectangleShape(e,null,this.previewColor)).isDashed=!0,this.htmlPreview?(e.dialect=mxConstants.DIALECT_STRICTHTML,e.init(this.graph.container)):(e.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()),e.pointerEvents=!1),e},mxGraphHandler.prototype.start=function(e,n,t){this.cell=e,this.first=mxUtils.convertPoint(this.graph.container,n,t),this.cells=this.getCells(this.cell),this.bounds=this.graph.getView().getBounds(this.cells),this.pBounds=this.getPreviewBounds(this.cells),this.guidesEnabled&&(this.guide=new mxGuide(this.graph,this.getGuideStates()))},mxGraphHandler.prototype.useGuidesForEvent=function(e){return null==this.guide||this.guide.isEnabledForEvent(e.getEvent())},mxGraphHandler.prototype.snap=function(e){var n=this.scaleGrid?this.graph.view.scale:1;return e.x=this.graph.snap(e.x/n)*n,e.y=this.graph.snap(e.y/n)*n,e},mxGraphHandler.prototype.mouseMove=function(e,n){var t=this.graph;if(!n.isConsumed()&&t.isMouseDown&&null!=this.cell&&null!=this.first&&null!=this.bounds){var a=(s=mxUtils.convertPoint(t.container,n.getX(),n.getY())).x-this.first.x,i=s.y-this.first.y,s=t.tolerance;if(null!=this.shape||Math.abs(a)>s||Math.abs(i)>s){null==this.highlight&&(this.highlight=new mxCellHighlight(this.graph,mxConstants.DROP_TARGET_COLOR,3)),null==this.shape&&(this.shape=this.createPreviewShape(this.bounds));var o=t.isGridEnabledEvent(n.getEvent());s=!0;if(null!=this.guide&&this.useGuidesForEvent(n))s=!1,a=(i=this.guide.move(this.bounds,new mxPoint(a,i),o)).x,i=i.y;else if(o){var r=t.getView().translate,l=t.getView().scale;o=this.bounds.x-(t.snap(this.bounds.x/l-r.x)+r.x)*l,r=this.bounds.y-(t.snap(this.bounds.y/l-r.y)+r.y)*l,a=(i=this.snap(new mxPoint(a,i))).x-o,i=i.y-r}for(null!=this.guide&&s&&this.guide.hide(),t.isConstrainedEvent(n.getEvent())&&(Math.abs(a)>Math.abs(i)?i=0:a=0),this.currentDx=a,this.currentDy=i,this.updatePreviewShape(),s=null,i=n.getCell(),t.isDropEnabled()&&this.highlightEnabled&&(s=t.getDropTarget(this.cells,n.getEvent(),i)),o=s,r=t.getModel();null!=o&&o!=this.cells[0];)o=r.getParent(o);l=t.isCloneEvent(n.getEvent())&&t.isCellsCloneable()&&this.isCloneEnabled();var d=!1;null==(a=t.getView().getState(s))||null!=o||r.getParent(this.cell)==s&&!l?(this.target=null,this.connectOnDrop&&null!=i&&1==this.cells.length&&t.getModel().isVertex(i)&&t.isCellConnectable(i)&&(null!=(a=t.getView().getState(i))&&(t=null==t.getEdgeValidationError(null,this.cell,i)?mxConstants.VALID_COLOR:mxConstants.INVALID_CONNECT_TARGET_COLOR,this.setHighlightColor(t),d=!0))):(this.target!=s&&(this.target=s,this.setHighlightColor(mxConstants.DROP_TARGET_COLOR)),d=!0),null!=a&&d?this.highlight.highlight(a):this.highlight.hide()}n.consume(),mxEvent.consume(n.getEvent())}else!this.isMoveEnabled()&&!this.isCloneEnabled()||!this.updateCursor||n.isConsumed()||null==n.getState()||t.isMouseDown||(null==(a=t.getCursorForCell(n.getCell()))&&t.isEnabled()&&t.isCellMovable(n.getCell())&&(a=t.getModel().isEdge(n.getCell())?mxConstants.CURSOR_MOVABLE_EDGE:mxConstants.CURSOR_MOVABLE_VERTEX),n.getState().setCursor(a),n.consume())},mxGraphHandler.prototype.updatePreviewShape=function(){null!=this.shape&&(this.shape.bounds=new mxRectangle(Math.round(this.pBounds.x+this.currentDx-this.graph.panDx),Math.round(this.pBounds.y+this.currentDy-this.graph.panDy),this.pBounds.width,this.pBounds.height),this.shape.redraw())},mxGraphHandler.prototype.setHighlightColor=function(e){null!=this.highlight&&this.highlight.setHighlightColor(e)},mxGraphHandler.prototype.mouseUp=function(e,n){if(!n.isConsumed()){var t=this.graph;if(null!=this.cell&&null!=this.first&&null!=this.shape&&null!=this.currentDx&&null!=this.currentDy){var a=t.getView().scale,i=t.isCloneEvent(n.getEvent())&&t.isCellsCloneable()&&this.isCloneEnabled(),s=this.currentDx/a,o=(a=this.currentDy/a,n.getCell());this.connectOnDrop&&null==this.target&&null!=o&&t.getModel().isVertex(o)&&t.isCellConnectable(o)&&t.isEdgeValid(null,this.cell,o)?t.connectionHandler.connect(this.cell,o,n.getEvent()):(o=this.target,t.isSplitEnabled()&&t.isSplitTarget(o,this.cells,n.getEvent())?t.splitEdge(o,this.cells,null,s,a):this.moveCells(this.cells,s,a,i,this.target,n.getEvent()))}else this.isSelectEnabled()&&this.delayedSelection&&null!=this.cell&&this.selectDelayed(n)}this.cellWasClicked&&n.consume(),this.reset()},mxGraphHandler.prototype.selectDelayed=function(e){this.graph.selectCellForEvent(this.cell,e.getEvent())},mxGraphHandler.prototype.reset=function(){this.destroyShapes(),this.delayedSelection=this.cellWasClicked=!1,this.target=this.cell=this.first=this.guides=this.currentDy=this.currentDx=null},mxGraphHandler.prototype.shouldRemoveCellsFromParent=function(e,n,t){if(this.graph.getModel().isVertex(e)){if(e=this.graph.getView().getState(e),t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(t),mxEvent.getClientY(t)),0!=(a=mxUtils.toRadians(mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION)||0))){n=Math.cos(-a);var a=Math.sin(-a),i=new mxPoint(e.getCenterX(),e.getCenterY());t=mxUtils.getRotatedPoint(t,n,a,i)}return null!=e&&!mxUtils.contains(e,t.x,t.y)}return!1},mxGraphHandler.prototype.moveCells=function(e,n,t,a,i,s){a&&(e=this.graph.getCloneableCells(e)),null==i&&this.isRemoveCellsFromParent()&&this.shouldRemoveCellsFromParent(this.graph.getModel().getParent(this.cell),e,s)&&(i=this.graph.getDefaultParent()),e=this.graph.moveCells(e,n-this.graph.panDx/this.graph.view.scale,t-this.graph.panDy/this.graph.view.scale,a,i,s),this.isSelectEnabled()&&this.scrollOnMove&&this.graph.scrollCellToVisible(e[0]),a&&this.graph.setSelectionCells(e)},mxGraphHandler.prototype.destroyShapes=function(){null!=this.shape&&(this.shape.destroy(),this.shape=null),null!=this.guide&&(this.guide.destroy(),this.guide=null),null!=this.highlight&&(this.highlight.destroy(),this.highlight=null)},mxGraphHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),this.graph.removeListener(this.panHandler),this.destroyShapes()},mxPanningHandler.prototype=new mxPopupMenu,mxPanningHandler.prototype.constructor=mxPanningHandler,mxPanningHandler.prototype.graph=null,mxPanningHandler.prototype.triggerX=null,mxPanningHandler.prototype.triggerY=null,mxPanningHandler.prototype.usePopupTrigger=!0,mxPanningHandler.prototype.useLeftButtonForPanning=!1,mxPanningHandler.prototype.selectOnPopup=!0,mxPanningHandler.prototype.clearSelectionOnBackground=!0,mxPanningHandler.prototype.ignoreCell=!1,mxPanningHandler.prototype.previewEnabled=!0,mxPanningHandler.prototype.useGrid=!1,mxPanningHandler.prototype.panningEnabled=!0,mxPanningHandler.prototype.isPanningEnabled=function(){return this.panningEnabled},mxPanningHandler.prototype.setPanningEnabled=function(e){this.panningEnabled=e},mxPanningHandler.prototype.init=function(){mxPopupMenu.prototype.init.apply(this),mxEvent.addListener(this.div,mxClient.IS_TOUCH?"touchmove":"mousemove",mxUtils.bind(this,function(e){this.graph.tooltipHandler.hide()}))},mxPanningHandler.prototype.isPanningTrigger=function(e){var n=e.getEvent();return this.useLeftButtonForPanning&&(this.ignoreCell||null==e.getState())&&mxEvent.isLeftMouseButton(n)||mxEvent.isControlDown(n)&&mxEvent.isShiftDown(n)||this.usePopupTrigger&&mxEvent.isPopupTrigger(n)},mxPanningHandler.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.isEnabled()){this.hideMenu(),this.dx0=-this.graph.container.scrollLeft,this.dy0=-this.graph.container.scrollTop;var t=mxUtils.convertPoint(this.graph.container,n.getX(),n.getY());this.triggerX=t.x,this.triggerY=t.y,this.popupTrigger=this.isPopupTrigger(n),this.panningTrigger=this.isPanningEnabled()&&this.isPanningTrigger(n),this.startX=n.getX(),this.startY=n.getY(),this.panningTrigger&&this.consumePanningTrigger(n)}},mxPanningHandler.prototype.consumePanningTrigger=function(e){e.consume()},mxPanningHandler.prototype.mouseMove=function(e,n){var t=n.getX()-this.startX,a=n.getY()-this.startY;if(this.active)this.previewEnabled&&(this.useGrid&&(t=this.graph.snap(t),a=this.graph.snap(a)),this.graph.panGraph(t+this.dx0,a+this.dy0)),this.fireEvent(new mxEventObject(mxEvent.PAN,"event",n)),n.consume();else if(this.panningTrigger){var i=this.active;this.active=Math.abs(t)>this.graph.tolerance||Math.abs(a)>this.graph.tolerance,!i&&this.active&&this.fireEvent(new mxEventObject(mxEvent.PAN_START,"event",n))}},mxPanningHandler.prototype.mouseUp=function(e,n){var t=Math.abs(n.getX()-this.startX),a=Math.abs(n.getY()-this.startY);if(this.active){if(!this.graph.useScrollbarsForPanning||!mxUtils.hasScrollbars(this.graph.container)){t=n.getX()-this.startX,a=n.getY()-this.startY,this.useGrid&&(t=this.graph.snap(t),a=this.graph.snap(a));var i=this.graph.getView().scale,s=this.graph.getView().translate;this.graph.panGraph(0,0),this.panGraph(s.x+t/i,s.y+a/i)}this.active=!1,this.fireEvent(new mxEventObject(mxEvent.PAN_END,"event",n)),n.consume()}else this.popupTrigger&&t<this.graph.tolerance&&a<this.graph.tolerance&&(t=this.getCellForPopupEvent(n),this.graph.isEnabled()&&this.selectOnPopup&&null!=t&&!this.graph.isCellSelected(t)?this.graph.setSelectionCell(t):this.clearSelectionOnBackground&&null==t&&this.graph.clearSelection(),this.graph.tooltipHandler.hide(),a=mxUtils.getScrollOrigin(),a=new mxPoint(n.getX()+a.x,n.getY()+a.y),this.popup(a.x+1,a.y+1,t,n.getEvent()),n.consume());this.popupTrigger=this.panningTrigger=!1},mxPanningHandler.prototype.getCellForPopupEvent=function(e){return e.getCell()},mxPanningHandler.prototype.panGraph=function(e,n){this.graph.getView().setTranslate(e,n)},mxPanningHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),mxPopupMenu.prototype.destroy.apply(this)},mxUtils.extend(mxCellMarker,mxEventSource),mxCellMarker.prototype.graph=null,mxCellMarker.prototype.enabled=!0,mxCellMarker.prototype.hotspot=mxConstants.DEFAULT_HOTSPOT,mxCellMarker.prototype.hotspotEnabled=!1,mxCellMarker.prototype.validColor=null,mxCellMarker.prototype.invalidColor=null,mxCellMarker.prototype.currentColor=null,mxCellMarker.prototype.validState=null,mxCellMarker.prototype.markedState=null,mxCellMarker.prototype.setEnabled=function(e){this.enabled=e},mxCellMarker.prototype.isEnabled=function(){return this.enabled},mxCellMarker.prototype.setHotspot=function(e){this.hotspot=e},mxCellMarker.prototype.getHotspot=function(){return this.hotspot},mxCellMarker.prototype.setHotspotEnabled=function(e){this.hotspotEnabled=e},mxCellMarker.prototype.isHotspotEnabled=function(){return this.hotspotEnabled},mxCellMarker.prototype.hasValidState=function(){return null!=this.validState},mxCellMarker.prototype.getValidState=function(){return this.validState},mxCellMarker.prototype.getMarkedState=function(){return this.markedState},mxCellMarker.prototype.reset=function(){(this.validState=null)!=this.markedState&&(this.markedState=null,this.unmark())},mxCellMarker.prototype.process=function(e){var n=null;if(this.isEnabled()){var t=null!=(n=this.getState(e))&&this.isValidState(n);e=this.getMarkerColor(e.getEvent(),n,t),this.validState=t?n:null,n==this.markedState&&e==this.currentColor||(this.currentColor=e,null!=n&&null!=this.currentColor?(this.markedState=n,this.mark()):null!=this.markedState&&(this.markedState=null,this.unmark()))}return n},mxCellMarker.prototype.markCell=function(e,n){var t=this.graph.getView().getState(e);null!=t&&(this.currentColor=null!=n?n:this.validColor,this.markedState=t,this.mark())},mxCellMarker.prototype.mark=function(){this.highlight.setHighlightColor(this.currentColor),this.highlight.highlight(this.markedState),this.fireEvent(new mxEventObject(mxEvent.MARK,"state",this.markedState))},mxCellMarker.prototype.unmark=function(){this.mark()},mxCellMarker.prototype.isValidState=function(e){return!0},mxCellMarker.prototype.getMarkerColor=function(e,n,t){return t?this.validColor:this.invalidColor},mxCellMarker.prototype.getState=function(e){var n=this.graph.getView();return cell=this.getCell(e),null!=(n=this.getStateToMark(n.getState(cell)))&&this.intersects(n,e)?n:null},mxCellMarker.prototype.getCell=function(e){return e.getCell()},mxCellMarker.prototype.getStateToMark=function(e){return e},mxCellMarker.prototype.intersects=function(e,n){return!this.hotspotEnabled||mxUtils.intersectsHotspot(e,n.getGraphX(),n.getGraphY(),this.hotspot,mxConstants.MIN_HOTSPOT_SIZE,mxConstants.MAX_HOTSPOT_SIZE)},mxCellMarker.prototype.destroy=function(){this.graph.getView().removeListener(this.resetHandler),this.graph.getModel().removeListener(this.resetHandler),this.highlight.destroy()},mxUtils.extend(mxSelectionCellsHandler,mxEventSource),mxSelectionCellsHandler.prototype.graph=null,mxSelectionCellsHandler.prototype.enabled=!0,mxSelectionCellsHandler.prototype.refreshHandler=null,mxSelectionCellsHandler.prototype.maxHandlers=100,mxSelectionCellsHandler.prototype.handlers=null,mxSelectionCellsHandler.prototype.isEnabled=function(){return this.enabled},mxSelectionCellsHandler.prototype.setEnabled=function(e){this.enabled=e},mxSelectionCellsHandler.prototype.getHandler=function(e){return this.handlers.get(e)},mxSelectionCellsHandler.prototype.reset=function(){this.handlers.visit(function(e,n){n.reset.apply(n)})},mxSelectionCellsHandler.prototype.refresh=function(){var e=this.handlers;this.handlers=new mxDictionary;for(var n=this.graph.getSelectionCells(),t=0;t<n.length;t++){var a=this.graph.view.getState(n[t]);if(null!=a){var i=e.remove(n[t]);null!=i&&(i.state!=a?(i.destroy(),i=null):i.redraw()),null==i&&(i=this.graph.createHandler(a),this.fireEvent(new mxEventObject(mxEvent.ADD,"state",a))),null!=i&&this.handlers.put(n[t],i)}}e.visit(mxUtils.bind(this,function(e,n){this.fireEvent(new mxEventObject(mxEvent.REMOVE,"state",n.state)),n.destroy()}))},mxSelectionCellsHandler.prototype.mouseDown=function(e,n){if(this.graph.isEnabled()&&this.isEnabled()){var t=[e,n];this.handlers.visit(function(e,n){n.mouseDown.apply(n,t)})}},mxSelectionCellsHandler.prototype.mouseMove=function(e,n){if(this.graph.isEnabled()&&this.isEnabled()){var t=[e,n];this.handlers.visit(function(e,n){n.mouseMove.apply(n,t)})}},mxSelectionCellsHandler.prototype.mouseUp=function(e,n){if(this.graph.isEnabled()&&this.isEnabled()){var t=[e,n];this.handlers.visit(function(e,n){n.mouseUp.apply(n,t)})}},mxSelectionCellsHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),null!=this.refreshHandler&&(this.graph.getSelectionModel().removeListener(this.refreshHandler),this.graph.getModel().removeListener(this.refreshHandler),this.graph.getView().removeListener(this.refreshHandler),this.refreshHandler=null)},mxUtils.extend(mxConnectionHandler,mxEventSource),mxConnectionHandler.prototype.graph=null,mxConnectionHandler.prototype.factoryMethod=!0,mxConnectionHandler.prototype.moveIconFront=!1,mxConnectionHandler.prototype.moveIconBack=!1,mxConnectionHandler.prototype.connectImage=null,mxConnectionHandler.prototype.targetConnectImage=!1,mxConnectionHandler.prototype.enabled=!0,mxConnectionHandler.prototype.select=!0,mxConnectionHandler.prototype.createTarget=!1;mxConnectionHandler.prototype.marker=null,mxConnectionHandler.prototype.constraintHandler=null,mxConnectionHandler.prototype.error=null,mxConnectionHandler.prototype.waypointsEnabled=!1,mxConnectionHandler.prototype.tapAndHoldEnabled=!0,mxConnectionHandler.prototype.tapAndHoldDelay=500,mxConnectionHandler.prototype.tapAndHoldInProgress=!1,mxConnectionHandler.prototype.tapAndHoldValid=!1,mxConnectionHandler.prototype.tapAndHoldTolerance=4,mxConnectionHandler.prototype.initialTouchX=0,mxConnectionHandler.prototype.initialTouchY=0,mxConnectionHandler.prototype.ignoreMouseDown=!1,mxConnectionHandler.prototype.first=null,mxConnectionHandler.prototype.connectIconOffset=new mxPoint(0,mxConstants.TOOLTIP_VERTICAL_OFFSET),mxConnectionHandler.prototype.edgeState=null,mxConnectionHandler.prototype.changeHandler=null,mxConnectionHandler.prototype.drillHandler=null,mxConnectionHandler.prototype.mouseDownCounter=0,mxConnectionHandler.prototype.movePreviewAway=mxClient.IS_VML,mxConnectionHandler.prototype.isEnabled=function(){return this.enabled},mxConnectionHandler.prototype.setEnabled=function(e){this.enabled=e},mxConnectionHandler.prototype.isCreateTarget=function(){return this.createTarget},mxConnectionHandler.prototype.setCreateTarget=function(e){this.createTarget=e},mxConnectionHandler.prototype.createShape=function(){var e=new mxPolyline([],mxConstants.INVALID_COLOR);if(e.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()),e.svgStrokeTolerance=0,e.pointerEvents=!1,e.isDashed=!0,this.graph.dialect==mxConstants.DIALECT_SVG)e.node.setAttribute("pointer-events","none");else{var n=mxUtils.bind(this,function(e){return e=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),this.graph.view.getState(this.graph.getCellAt(e.x,e.y))});mxEvent.redirectMouseEvents(e.node,this.graph,n)}return e},mxConnectionHandler.prototype.init=function(){this.graph.addMouseListener(this),this.marker=this.createMarker(),this.constraintHandler=new mxConstraintHandler(this.graph),this.changeHandler=mxUtils.bind(this,function(e){null!=this.iconState&&(this.iconState=this.graph.getView().getState(this.iconState.cell)),null!=this.iconState?this.redrawIcons(this.icons,this.iconState):(this.destroyIcons(this.icons),this.previous=null),this.constraintHandler.reset()}),this.graph.getModel().addListener(mxEvent.CHANGE,this.changeHandler),this.graph.getView().addListener(mxEvent.SCALE,this.changeHandler),this.graph.getView().addListener(mxEvent.TRANSLATE,this.changeHandler),this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE,this.changeHandler),this.drillHandler=mxUtils.bind(this,function(e){this.destroyIcons(this.icons)}),this.graph.addListener(mxEvent.START_EDITING,this.drillHandler),this.graph.getView().addListener(mxEvent.DOWN,this.drillHandler),this.graph.getView().addListener(mxEvent.UP,this.drillHandler)},mxConnectionHandler.prototype.isConnectableCell=function(e){return!0},mxConnectionHandler.prototype.createMarker=function(){var a=new mxCellMarker(this.graph);return a.hotspotEnabled=!0,a.getCell=mxUtils.bind(this,function(e,n){return n=mxCellMarker.prototype.getCell.apply(a,arguments),this.error=null,this.isConnectableCell(n)?(null!=n?this.isConnecting()?null!=this.previous&&(this.error=this.validateConnection(this.previous.cell,n),null!=this.error&&0==this.error.length&&(n=null,this.isCreateTarget()&&(this.error=null))):this.isValidSource(n)||(n=null):this.isConnecting()&&!this.isCreateTarget()&&!this.graph.allowDanglingEdges&&(this.error=""),n):null}),a.isValidState=mxUtils.bind(this,function(e){return this.isConnecting()?null==this.error:mxCellMarker.prototype.isValidState.apply(a,arguments)}),a.getMarkerColor=mxUtils.bind(this,function(e,n,t){return null==this.connectImage||this.isConnecting()?mxCellMarker.prototype.getMarkerColor.apply(a,arguments):null}),a.intersects=mxUtils.bind(this,function(e,n){return!(null==this.connectImage&&!this.isConnecting())||mxCellMarker.prototype.intersects.apply(a,arguments)}),a},mxConnectionHandler.prototype.start=function(e,n,t,a){this.previous=e,this.first=new mxPoint(n,t),this.edgeState=null!=a?a:this.createEdgeState(null),this.marker.currentColor=this.marker.validColor,this.marker.markedState=e,this.marker.mark(),this.fireEvent(new mxEventObject(mxEvent.START,"state",this.previous))},mxConnectionHandler.prototype.isConnecting=function(){return null!=this.first&&null!=this.shape},mxConnectionHandler.prototype.isValidSource=function(e){return this.graph.isValidSource(e)},mxConnectionHandler.prototype.isValidTarget=function(e){return!0},mxConnectionHandler.prototype.validateConnection=function(e,n){return this.isValidTarget(n)?this.graph.getEdgeValidationError(null,e,n):""},mxConnectionHandler.prototype.getConnectImage=function(e){return this.connectImage},mxConnectionHandler.prototype.isMoveIconToFrontForState=function(e){return null!=e.text&&e.text.node.parentNode==this.graph.container||this.moveIconFront},mxConnectionHandler.prototype.createIcons=function(e){if(null==(i=this.getConnectImage(e))||null==e)return null;this.iconState=e;var n=[],t=new mxImageShape(new mxRectangle(0,0,i.width,i.height),i.src,null,null,0);t.preserveImageAspect=!1,this.isMoveIconToFrontForState(e)?(t.dialect=mxConstants.DIALECT_STRICTHTML,t.init(this.graph.container)):(t.dialect=this.graph.dialect==mxConstants.DIALECT_SVG?mxConstants.DIALECT_SVG:mxConstants.DIALECT_VML,t.init(this.graph.getView().getOverlayPane()),this.moveIconBack&&null!=t.node.previousSibling&&t.node.parentNode.insertBefore(t.node,t.node.parentNode.firstChild)),t.node.style.cursor=mxConstants.CURSOR_CONNECT;var a=mxUtils.bind(this,function(){return null!=this.currentState?this.currentState:e}),i=mxUtils.bind(this,function(e){mxEvent.isConsumed(e)||(this.icon=t,this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,a())))});return mxEvent.redirectMouseEvents(t.node,this.graph,a,i),n.push(t),this.redrawIcons(n,this.iconState),n},mxConnectionHandler.prototype.redrawIcons=function(e,n){if(null!=e&&null!=e[0]&&null!=n){var t=this.getIconPosition(e[0],n);e[0].bounds.x=t.x,e[0].bounds.y=t.y,e[0].redraw()}},mxConnectionHandler.prototype.getIconPosition=function(e,n){var t=this.graph.getView().scale,a=n.getCenterX(),i=n.getCenterY();if(this.graph.isSwimlane(n.cell)){a=0!=(s=this.graph.getStartSize(n.cell)).width?n.x+s.width*t/2:a,i=0!=s.height?n.y+s.height*t/2:i;if(0!=(s=mxUtils.toRadians(mxUtils.getValue(n.style,mxConstants.STYLE_ROTATION)||0))){t=Math.cos(s);var s=Math.sin(s),o=new mxPoint(n.getCenterX(),n.getCenterY());a=(i=mxUtils.getRotatedPoint(new mxPoint(a,i),t,s,o)).x,i=i.y}}return new mxPoint(a-e.bounds.width/2,i-e.bounds.height/2)},mxConnectionHandler.prototype.destroyIcons=function(e){if(null!=e){this.iconState=null;for(var n=0;n<e.length;n++)e[n].destroy()}},mxConnectionHandler.prototype.isStartEvent=function(e){return!this.graph.isForceMarqueeEvent(e.getEvent())&&(null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentConstraint||null!=this.previous&&null==this.error&&(null==this.icons||null!=this.icons&&null!=this.icon))},mxConnectionHandler.prototype.mouseDown=function(e,n){if(this.mouseDownCounter++,this.isEnabled()&&this.graph.isEnabled()&&!n.isConsumed()&&!this.isConnecting()&&this.isStartEvent(n)){if(null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentPoint?(this.sourceConstraint=this.constraintHandler.currentConstraint,this.previous=this.constraintHandler.currentFocus,this.first=this.constraintHandler.currentPoint.clone()):this.first=new mxPoint(n.getGraphX(),n.getGraphY()),this.edgeState=this.createEdgeState(n),this.mouseDownCounter=1,this.waypointsEnabled&&null==this.shape&&(this.waypoints=null,this.shape=this.createShape()),null==this.previous&&null!=this.edgeState){var t=this.graph.getPointForEvent(n.getEvent());this.edgeState.cell.geometry.setTerminalPoint(t,!0)}this.fireEvent(new mxEventObject(mxEvent.START,"state",this.previous)),n.consume()}else if(mxClient.IS_TOUCH&&this.tapAndHoldEnabled&&!this.tapAndHoldInProgress&&this.isEnabled()&&this.graph.isEnabled()&&!this.isConnecting()){this.tapAndHoldInProgress=!0,this.initialTouchX=n.getX(),this.initialTouchY=n.getY();var a=this.graph.view.getState(this.marker.getCell(n));this.tapAndHoldThread&&window.clearTimeout(this.tapAndHoldThread),this.tapAndHoldThread=window.setTimeout(mxUtils.bind(this,function(){this.tapAndHoldValid&&this.tapAndHold(n,a),this.tapAndHoldValid=this.tapAndHoldInProgress=!1}),this.tapAndHoldDelay),this.tapAndHoldValid=!0}this.selectedIcon=this.icon,this.icon=null},mxConnectionHandler.prototype.tapAndHold=function(e,n){null!=n&&(this.marker.currentColor=this.marker.validColor,this.marker.markedState=n,this.marker.mark(),this.first=new mxPoint(e.getGraphX(),e.getGraphY()),this.edgeState=this.createEdgeState(e),this.previous=n,this.fireEvent(new mxEventObject(mxEvent.START,"state",this.previous)))},mxConnectionHandler.prototype.isImmediateConnectSource=function(e){return!this.graph.isCellMovable(e.cell)},mxConnectionHandler.prototype.createEdgeState=function(e){return null},mxConnectionHandler.prototype.updateCurrentState=function(e){var n=this.marker.process(e);this.constraintHandler.update(e,null==this.first),this.currentState=n},mxConnectionHandler.prototype.convertWaypoint=function(e){var n=this.graph.getView().getScale(),t=this.graph.getView().getTranslate();e.x=e.x/n-t.x,e.y=e.y/n-t.y},mxConnectionHandler.prototype.mouseMove=function(e,n){if(this.tapAndHoldValid&&(this.tapAndHoldValid=Math.abs(this.initialTouchX-n.getX())<this.tapAndHoldTolerance&&Math.abs(this.initialTouchY-n.getY())<this.tapAndHoldTolerance),n.isConsumed()||!this.ignoreMouseDown&&null==this.first&&this.graph.isMouseDown)this.constraintHandler.reset();else{if(!this.isEnabled()&&null!=this.currentState&&(this.destroyIcons(this.icons),this.currentState=null),(null!=this.first||this.isEnabled()&&this.graph.isEnabled())&&this.updateCurrentState(n),null!=this.first){var t=this.graph.getView().scale,a=null,i=t=new mxPoint(this.graph.snap(n.getGraphX()/t)*t,this.graph.snap(n.getGraphY()/t)*t);null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentPoint&&(a=this.constraintHandler.currentConstraint,i=this.constraintHandler.currentPoint.clone());var s=this.first;if(null!=this.selectedIcon){var o=this.selectedIcon.bounds.width,r=this.selectedIcon.bounds.height;null!=this.currentState&&this.targetConnectImage?(o=this.getIconPosition(this.selectedIcon,this.currentState),this.selectedIcon.bounds.x=o.x,this.selectedIcon.bounds.y=o.y):(o=new mxRectangle(n.getGraphX()+this.connectIconOffset.x,n.getGraphY()+this.connectIconOffset.y,o,r),this.selectedIcon.bounds=o),this.selectedIcon.redraw()}if(null!=this.edgeState){if(this.edgeState.absolutePoints=[null,null!=this.currentState?null:i],this.graph.view.updateFixedTerminalPoint(this.edgeState,this.previous,!0,this.sourceConstraint),null!=this.currentState&&(null==a&&(a=this.graph.getConnectionConstraint(this.edgeState,this.previous,!1)),this.edgeState.setAbsoluteTerminalPoint(null,!1),this.graph.view.updateFixedTerminalPoint(this.edgeState,this.currentState,!1,a)),(s=null)!=this.waypoints)for(s=[],i=0;i<this.waypoints.length;i++)a=this.waypoints[i].clone(),this.convertWaypoint(a),s[i]=a;this.graph.view.updatePoints(this.edgeState,s,this.previous,this.currentState),this.graph.view.updateFloatingTerminalPoints(this.edgeState,this.previous,this.currentState),i=this.edgeState.absolutePoints[this.edgeState.absolutePoints.length-1],s=this.edgeState.absolutePoints[0]}else null!=this.currentState&&null==this.constraintHandler.currentConstraint&&(null!=(o=this.getTargetPerimeterPoint(this.currentState,n))&&(i=o)),null==this.sourceConstraint&&null!=this.previous&&(null!=(o=this.getSourcePerimeterPoint(this.previous,null!=this.waypoints&&0<this.waypoints.length?this.waypoints[0]:i,n))&&(s=o));if(null==this.currentState&&this.movePreviewAway){if(o=s,null!=this.edgeState&&2<this.edgeState.absolutePoints.length&&(null!=(a=this.edgeState.absolutePoints[this.edgeState.absolutePoints.length-2])&&(o=a)),a=i.x-o.x,o=i.y-o.y,0==(r=Math.sqrt(a*a+o*o)))return;i.x-=4*a/r,i.y-=4*o/r}null==this.shape&&(a=Math.abs(t.x-this.first.x),o=Math.abs(t.y-this.first.y),a>this.graph.tolerance||o>this.graph.tolerance)&&(this.shape=this.createShape(),this.updateCurrentState(n)),null!=this.shape&&(null!=this.edgeState?this.shape.points=this.edgeState.absolutePoints:(t=[s],null!=this.waypoints&&(t=t.concat(this.waypoints)),t.push(i),this.shape.points=t),this.drawPreview()),mxEvent.consume(n.getEvent()),n.consume()}else this.isEnabled()&&this.graph.isEnabled()?this.previous!=this.currentState&&null==this.edgeState?(this.destroyIcons(this.icons),(this.icons=null)!=this.currentState&&null==this.error&&(this.icons=this.createIcons(this.currentState),null==this.icons&&(this.currentState.setCursor(mxConstants.CURSOR_CONNECT),n.consume())),this.previous=this.currentState):this.previous==this.currentState&&null!=this.currentState&&null==this.icons&&!this.graph.isMouseDown&&n.consume():this.constraintHandler.reset();if(null!=this.constraintHandler.currentConstraint&&this.marker.reset(),!this.graph.isMouseDown&&null!=this.currentState&&null!=this.icons){for(t=!1,s=n.getSource(),i=0;i<this.icons.length&&!t;i++)t=s==this.icons[i].node||s.parentNode==this.icons[i].node;t||this.updateIcons(this.currentState,this.icons,n)}}},mxConnectionHandler.prototype.getTargetPerimeterPoint=function(e,n){var t=null,a=(i=e.view).getPerimeterFunction(e);if(null!=a){var i,s=null!=this.waypoints&&0<this.waypoints.length?this.waypoints[this.waypoints.length-1]:new mxPoint(this.previous.getCenterX(),this.previous.getCenterY());null!=(i=a(i.getPerimeterBounds(e),this.edgeState,s,!1))&&(t=i)}else t=new mxPoint(e.getCenterX(),e.getCenterY());return t},mxConnectionHandler.prototype.getSourcePerimeterPoint=function(e,n,t){t=null;var a=e.view,i=a.getPerimeterFunction(e),s=new mxPoint(e.getCenterX(),e.getCenterY());if(null!=i){var o=mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION,0),r=-o*(Math.PI/180);0!=o&&(n=mxUtils.getRotatedPoint(new mxPoint(n.x,n.y),Math.cos(r),Math.sin(r),s)),null!=(e=i(a.getPerimeterBounds(e),e,n,!1))&&(0!=o&&(e=mxUtils.getRotatedPoint(new mxPoint(e.x,e.y),Math.cos(-r),Math.sin(-r),s)),t=e)}else t=s;return t},mxConnectionHandler.prototype.updateIcons=function(e,n,t){},mxConnectionHandler.prototype.isStopEvent=function(e){return null!=e.getState()},mxConnectionHandler.prototype.addWaypointForEvent=function(e){var n=mxUtils.convertPoint(this.graph.container,e.getX(),e.getY()),t=Math.abs(n.x-this.first.x);n=Math.abs(n.y-this.first.y);(null!=this.waypoints||1<this.mouseDownCounter&&(t>this.graph.tolerance||n>this.graph.tolerance))&&(null==this.waypoints&&(this.waypoints=[]),t=this.graph.view.scale,n=new mxPoint(this.graph.snap(e.getGraphX()/t)*t,this.graph.snap(e.getGraphY()/t)*t),this.waypoints.push(n))},mxConnectionHandler.prototype.mouseUp=function(e,n){if(!n.isConsumed()&&this.isConnecting()){if(this.waypointsEnabled&&!this.isStopEvent(n))return this.addWaypointForEvent(n),void n.consume();if(null==this.error){var t=null!=this.previous?this.previous.cell:null,a=null;null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(a=this.constraintHandler.currentFocus.cell),null==a&&this.marker.hasValidState()&&(a=this.marker.validState.cell),this.connect(t,a,n.getEvent(),n.getCell())}else null!=this.previous&&null!=this.marker.validState&&this.previous.cell==this.marker.validState.cell&&this.graph.selectCellForEvent(this.marker.source,evt),0<this.error.length&&this.graph.validationAlert(this.error);this.destroyIcons(this.icons),n.consume()}null!=this.first&&this.reset(),this.tapAndHoldValid=this.tapAndHoldInProgress=!1},mxConnectionHandler.prototype.reset=function(){null!=this.shape&&(this.shape.destroy(),this.shape=null),this.destroyIcons(this.icons),this.icons=null,this.marker.reset(),this.constraintHandler.reset(),this.sourceConstraint=this.error=this.previous=this.edgeState=this.selectedIcon=null,this.mouseDownCounter=0,this.icon=this.first=null,this.fireEvent(new mxEventObject(mxEvent.RESET))},mxConnectionHandler.prototype.drawPreview=function(){var e=null==this.error;this.shape.strokewidth=this.getEdgeWidth(e),e=this.getEdgeColor(e),this.shape.stroke=e,this.shape.redraw()},mxConnectionHandler.prototype.getEdgeColor=function(e){return e?mxConstants.VALID_COLOR:mxConstants.INVALID_COLOR},mxConnectionHandler.prototype.getEdgeWidth=function(e){return e?3:1},mxConnectionHandler.prototype.connect=function(e,n,t,a){if(null!=n||this.isCreateTarget()||this.graph.allowDanglingEdges){var i=this.graph.getModel(),s=null;i.beginUpdate();try{if(null!=e&&null==n&&this.isCreateTarget()&&null!=(n=this.createTargetVertex(t,e))){if(null!=(a=this.graph.getDropTarget([n],t,a))&&this.graph.getModel().isEdge(a))a=this.graph.getDefaultParent();else{var o=this.graph.getView().getState(a);if(null!=o){var r=i.getGeometry(n);r.x-=o.origin.x,r.y-=o.origin.y}}this.graph.addCell(n,a)}var l=this.graph.getDefaultParent();if(null!=e&&null!=n&&i.getParent(e)==i.getParent(n)&&i.getParent(i.getParent(e))!=i.getRoot()&&(l=i.getParent(e),null!=e.geometry&&e.geometry.relative&&null!=n.geometry&&n.geometry.relative&&(l=i.getParent(l))),r=o=null,null!=this.edgeState&&(o=this.edgeState.cell.value,r=this.edgeState.cell.style),null!=(s=this.insertEdge(l,null,o,e,n,r))){this.graph.setConnectionConstraint(s,e,!0,this.sourceConstraint),this.graph.setConnectionConstraint(s,n,!1,this.constraintHandler.currentConstraint),null!=this.edgeState&&i.setGeometry(s,this.edgeState.cell.geometry);var d=i.getGeometry(s);if(null==d&&((d=new mxGeometry).relative=!0,i.setGeometry(s,d)),null!=this.waypoints&&0<this.waypoints.length){var c=this.graph.view.scale,m=this.graph.view.translate;for(d.points=[],e=0;e<this.waypoints.length;e++){var u=this.waypoints[e];d.points.push(new mxPoint(u.x/c-m.x,u.y/c-m.y))}}null==n&&((u=this.graph.getPointForEvent(t,!1)).x-=this.graph.panDx/this.graph.view.scale,u.y-=this.graph.panDy/this.graph.view.scale,d.setTerminalPoint(u,!1)),this.fireEvent(new mxEventObject(mxEvent.CONNECT,"cell",s,"event",t,"target",a))}}catch(e){mxLog.show(),mxLog.debug(e.message)}finally{i.endUpdate()}this.select&&this.selectCells(s,n)}},mxConnectionHandler.prototype.selectCells=function(e,n){this.graph.setSelectionCell(e)},mxConnectionHandler.prototype.insertEdge=function(e,n,t,a,i,s){return null==this.factoryMethod?this.graph.insertEdge(e,n,t,a,i,s):(n=this.createEdge(t,a,i,s),this.graph.addEdge(n,e,a,i))},mxConnectionHandler.prototype.createTargetVertex=function(e,n){for(var t=this.graph.getCellGeometry(n);null!=t&&t.relative;)n=this.graph.getModel().getParent(n),t=this.graph.getCellGeometry(n);var a=this.graph.cloneCells([n])[0];if(null!=(t=this.graph.getModel().getGeometry(a))){var i=this.graph.getPointForEvent(e);if(t.x=this.graph.snap(i.x-t.width/2)-this.graph.panDx/this.graph.view.scale,t.y=this.graph.snap(i.y-t.height/2)-this.graph.panDy/this.graph.view.scale,null!=this.first){var s=this.graph.view.getState(n);if(null!=s){var o=this.getAlignmentTolerance();Math.abs(this.graph.snap(this.first.x)-this.graph.snap(i.x))<=o?t.x=s.x:Math.abs(this.graph.snap(this.first.y)-this.graph.snap(i.y))<=o&&(t.y=s.y)}}}return a},mxConnectionHandler.prototype.getAlignmentTolerance=function(){return this.graph.isGridEnabled()?this.graph.gridSize:this.graph.tolerance},mxConnectionHandler.prototype.createEdge=function(e,n,t,a){var i=null;return null!=this.factoryMethod&&(i=this.factoryMethod(n,t,a)),null==i&&((i=new mxCell(e||"")).setEdge(!0),i.setStyle(a),(e=new mxGeometry).relative=!0,i.setGeometry(e)),i},mxConnectionHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),null!=this.shape&&(this.shape.destroy(),this.shape=null),null!=this.marker&&(this.marker.destroy(),this.marker=null),null!=this.constraintHandler&&(this.constraintHandler.destroy(),this.constraintHandler=null),null!=this.changeHandler&&(this.graph.getModel().removeListener(this.changeHandler),this.graph.getView().removeListener(this.changeHandler),this.changeHandler=null),null!=this.drillHandler&&(this.graph.removeListener(this.drillHandler),this.graph.getView().removeListener(this.drillHandler),this.drillHandler=null)},mxConstraintHandler.prototype.pointImage=new mxImage(mxClient.imageBasePath+"/point.gif",5,5),mxConstraintHandler.prototype.graph=null,mxConstraintHandler.prototype.enabled=!0,mxConstraintHandler.prototype.highlightColor=mxConstants.DEFAULT_VALID_COLOR,mxConstraintHandler.prototype.isEnabled=function(){return this.enabled},mxConstraintHandler.prototype.setEnabled=function(e){this.enabled=e},mxConstraintHandler.prototype.reset=function(){if(null!=this.focusIcons){for(var e=0;e<this.focusIcons.length;e++)this.focusIcons[e].destroy();this.focusIcons=null}null!=this.focusHighlight&&(this.focusHighlight.destroy(),this.focusHighlight=null),this.focusPoints=this.currentFocus=this.currentPoint=this.currentFocusArea=this.currentConstraint=null},mxConstraintHandler.prototype.getTolerance=function(){return this.graph.getTolerance()},mxConstraintHandler.prototype.getImageForConstraint=function(e,n,t){return this.pointImage},mxConstraintHandler.prototype.isEventIgnored=function(e,n){return!1},mxConstraintHandler.prototype.update=function(e,n){if(this.isEnabled()&&!this.isEventIgnored(e)){var t=this.getTolerance(),a=new mxRectangle(e.getGraphX()-t,e.getGraphY()-t,2*t,2*t),i=null!=e.getCell()&&this.graph.isCellConnectable(e.getCell());if((null==this.currentFocusArea||!mxUtils.intersects(this.currentFocusArea,a)||null!=e.getState()&&null!=this.currentFocus&&i)&&(this.currentFocusArea=null,e.getState()!=this.currentFocus))if(this.currentFocus=null,this.constraints=null!=e.getState()&&i?this.graph.getAllConnectionConstraints(e.getState(),n):null,null!=this.constraints){if(this.currentFocus=e.getState(),this.currentFocusArea=new mxRectangle(e.getState().x,e.getState().y,e.getState().width,e.getState().height),null!=this.focusIcons){for(i=0;i<this.focusIcons.length;i++)this.focusIcons[i].destroy();this.focusPoints=this.focusIcons=null}for(this.focusIcons=[],this.focusPoints=[],i=0;i<this.constraints.length;i++){var s,o=this.graph.getConnectionPoint(e.getState(),this.constraints[i]),r=(s=this.getImageForConstraint(e.getState(),this.constraints[i],o)).src;(s=new mxImageShape(s=new mxRectangle(o.x-s.width/2,o.y-s.height/2,s.width,s.height),r)).dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,s.preserveImageAspect=!1,s.init(this.graph.getView().getOverlayPane()),null!=s.node.previousSibling&&s.node.parentNode.insertBefore(s.node,s.node.parentNode.firstChild),r=mxUtils.bind(this,function(){return null!=this.currentFocus?this.currentFocus:e.getState()}),s.redraw(),mxEvent.redirectMouseEvents(s.node,this.graph,r),this.currentFocusArea.add(s.bounds),this.focusIcons.push(s),this.focusPoints.push(o)}this.currentFocusArea.grow(t)}else if(null!=this.focusIcons){for(null!=this.focusHighlight&&(this.focusHighlight.destroy(),this.focusHighlight=null),i=0;i<this.focusIcons.length;i++)this.focusIcons[i].destroy();this.focusPoints=this.focusIcons=null}if(this.currentPoint=this.currentConstraint=null,null!=this.focusIcons&&null!=this.constraints&&(null==e.getState()||this.currentFocus==e.getState()))for(i=0;i<this.focusIcons.length;i++)if(mxUtils.intersects(this.focusIcons[i].bounds,a)){this.currentConstraint=this.constraints[i],this.currentPoint=this.focusPoints[i],(t=this.focusIcons[i].bounds.clone()).grow(mxClient.IS_IE?3:2),mxClient.IS_IE&&(t.width-=1,t.height-=1),null==this.focusHighlight?((t=new mxRectangleShape(t,null,this.highlightColor,3)).dialect=this.graph.dialect==mxConstants.DIALECT_SVG?mxConstants.DIALECT_SVG:mxConstants.DIALECT_VML,t.init(this.graph.getView().getOverlayPane()),this.focusHighlight=t,r=mxUtils.bind(this,function(){return null!=this.currentFocus?this.currentFocus:e.getState()}),mxEvent.redirectMouseEvents(t.node,this.graph,r)):(this.focusHighlight.bounds=t,this.focusHighlight.redraw());break}null==this.currentConstraint&&null!=this.focusHighlight&&(this.focusHighlight.destroy(),this.focusHighlight=null)}},mxConstraintHandler.prototype.destroy=function(){this.reset()},mxRubberband.prototype.defaultOpacity=20,mxRubberband.prototype.enabled=!0,mxRubberband.prototype.div=null,mxRubberband.prototype.sharedDiv=null,mxRubberband.prototype.currentX=0,mxRubberband.prototype.currentY=0,mxRubberband.prototype.isEnabled=function(){return this.enabled},mxRubberband.prototype.setEnabled=function(e){this.enabled=e},mxRubberband.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.isEnabled()&&this.graph.isEnabled()&&(this.graph.isForceMarqueeEvent(n.getEvent())||null==n.getState())){var t=mxUtils.getOffset(this.graph.container),a=mxUtils.getScrollOrigin(this.graph.container);if(a.x-=t.x,a.y-=t.y,this.start(n.getX()+a.x,n.getY()+a.y),mxClient.IS_NS&&!mxClient.IS_SF&&!mxClient.IS_GC){var i=this.graph.container,s=function(e){e=new mxMouseEvent(e);var n=mxUtils.convertPoint(i,e.getX(),e.getY());return e.graphX=n.x,e.graphY=n.y,e};this.dragHandler=mxUtils.bind(this,function(e){this.mouseMove(this.graph,s(e))}),this.dropHandler=mxUtils.bind(this,function(e){this.mouseUp(this.graph,s(e))}),mxEvent.addListener(document,"mousemove",this.dragHandler),mxEvent.addListener(document,"mouseup",this.dropHandler)}n.consume(!1)}},mxRubberband.prototype.start=function(e,n){this.first=new mxPoint(e,n)},mxRubberband.prototype.mouseMove=function(e,n){if(!n.isConsumed()&&null!=this.first){var t=mxUtils.getScrollOrigin(this.graph.container),a=mxUtils.getOffset(this.graph.container);t.x-=a.x,t.y-=a.y;a=n.getX()+t.x,t=n.getY()+t.y;var i=this.first.x-a,s=this.first.y-t,o=this.graph.tolerance;(null!=this.div||Math.abs(i)>o||Math.abs(s)>o)&&(null==this.div&&(this.div=this.createShape()),mxUtils.clearSelection(),this.update(a,t),n.consume())}},mxRubberband.prototype.createShape=function(){return null==this.sharedDiv&&(this.sharedDiv=document.createElement("div"),this.sharedDiv.className="mxRubberband",mxUtils.setOpacity(this.sharedDiv,this.defaultOpacity)),this.graph.container.appendChild(this.sharedDiv),this.sharedDiv},mxRubberband.prototype.mouseUp=function(e,n){var t=null!=this.div;this.reset(),t&&(t=new mxRectangle(this.x,this.y,this.width,this.height),this.graph.selectRegion(t,n.getEvent()),n.consume())},mxRubberband.prototype.reset=function(){null!=this.div&&this.div.parentNode.removeChild(this.div),null!=this.dragHandler&&(mxEvent.removeListener(document,"mousemove",this.dragHandler),this.dragHandler=null),null!=this.dropHandler&&(mxEvent.removeListener(document,"mouseup",this.dropHandler),this.dropHandler=null),this.currentY=this.currentX=0,this.div=this.first=null},mxRubberband.prototype.update=function(e,n){this.currentX=e,this.currentY=n,this.repaint()},mxRubberband.prototype.repaint=function(){if(null!=this.div){var e=this.currentX-this.graph.panDx,n=this.currentY-this.graph.panDy;this.x=Math.min(this.first.x,e),this.y=Math.min(this.first.y,n),this.width=Math.max(this.first.x,e)-this.x,this.height=Math.max(this.first.y,n)-this.y,e=mxClient.IS_VML?this.graph.panDy:0,this.div.style.left=this.x+(mxClient.IS_VML?this.graph.panDx:0)+"px",this.div.style.top=this.y+e+"px",this.div.style.width=Math.max(1,this.width)+"px",this.div.style.height=Math.max(1,this.height)+"px"}},mxRubberband.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.graph.removeMouseListener(this),this.graph.removeListener(this.panHandler),this.reset(),null!=this.sharedDiv&&(this.sharedDiv=null))},mxVertexHandler.prototype.graph=null,mxVertexHandler.prototype.state=null,mxVertexHandler.prototype.singleSizer=!1,mxVertexHandler.prototype.index=null,mxVertexHandler.prototype.allowHandleBoundsCheck=!0,mxVertexHandler.prototype.handleImage=null,mxVertexHandler.prototype.tolerance=0,mxVertexHandler.prototype.rotationEnabled=!1,mxVertexHandler.prototype.rotationRaster=!0,mxVertexHandler.prototype.init=function(){if(this.graph=this.state.view.graph,this.selectionBounds=this.getSelectionBounds(this.state),this.bounds=new mxRectangle(this.selectionBounds.x,this.selectionBounds.y,this.selectionBounds.width,this.selectionBounds.height),this.selectionBorder=this.createSelectionShape(this.bounds),this.selectionBorder.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.selectionBorder.pointerEvents=!1,this.selectionBorder.init(this.graph.getView().getOverlayPane()),this.graph.isCellMovable(this.state.cell)&&(this.selectionBorder.node.style.cursor=mxConstants.CURSOR_MOVABLE_VERTEX),mxEvent.redirectMouseEvents(this.selectionBorder.node,this.graph,this.state),mxGraphHandler.prototype.maxCells<=0||this.graph.getSelectionCount()<mxGraphHandler.prototype.maxCells){var e=this.graph.isCellResizable(this.state.cell);if(this.sizers=[],e||this.graph.isLabelMovable(this.state.cell)&&2<=this.state.width&&2<=this.state.height){var n=0;e&&(this.singleSizer||(this.sizers.push(this.createSizer("nw-resize",n++)),this.sizers.push(this.createSizer("n-resize",n++)),this.sizers.push(this.createSizer("ne-resize",n++)),this.sizers.push(this.createSizer("w-resize",n++)),this.sizers.push(this.createSizer("e-resize",n++)),this.sizers.push(this.createSizer("sw-resize",n++)),this.sizers.push(this.createSizer("s-resize",n++))),this.sizers.push(this.createSizer("se-resize",n++))),null!=(e=this.graph.model.getGeometry(this.state.cell))&&!e.relative&&!this.graph.isSwimlane(this.state.cell)&&this.graph.isLabelMovable(this.state.cell)&&(this.labelShape=this.createSizer(mxConstants.CURSOR_LABEL_HANDLE,mxEvent.LABEL_HANDLE,mxConstants.LABEL_HANDLE_SIZE,mxConstants.LABEL_HANDLE_FILLCOLOR),this.sizers.push(this.labelShape))}else this.graph.isCellMovable(this.state.cell)&&!this.graph.isCellResizable(this.state.cell)&&this.state.width<2&&this.state.height<2&&(this.labelShape=this.createSizer(mxConstants.CURSOR_MOVABLE_VERTEX,null,null,mxConstants.LABEL_HANDLE_FILLCOLOR),this.sizers.push(this.labelShape))}this.rotationEnabled&&(mxGraphHandler.prototype.maxCells<=0||this.graph.getSelectionCount()<mxGraphHandler.prototype.maxCells)&&(this.rotationShape=this.createSizer("pointer",mxEvent.ROTATION_HANDLE,mxConstants.HANDLE_SIZE+3,mxConstants.HANDLE_FILLCOLOR),this.sizers.push(this.rotationShape)),this.redraw()},mxVertexHandler.prototype.getSelectionBounds=function(e){return new mxRectangle(Math.round(e.x),Math.round(e.y),Math.round(e.width),Math.round(e.height))},mxVertexHandler.prototype.createSelectionShape=function(e){return(e=new mxRectangleShape(e,null,this.getSelectionColor())).strokewidth=this.getSelectionStrokeWidth(),e.isDashed=this.isSelectionDashed(),e},mxVertexHandler.prototype.getSelectionColor=function(){return mxConstants.VERTEX_SELECTION_COLOR},mxVertexHandler.prototype.getSelectionStrokeWidth=function(){return mxConstants.VERTEX_SELECTION_STROKEWIDTH},mxVertexHandler.prototype.isSelectionDashed=function(){return mxConstants.VERTEX_SELECTION_DASHED},mxVertexHandler.prototype.createSizer=function(e,n,t,a){return t=new mxRectangle(0,0,t=t||mxConstants.HANDLE_SIZE,t),(a=this.createSizerShape(t,n,a)).isHtmlAllowed()&&null!=this.state.text&&this.state.text.node.parentNode==this.graph.container?(a.bounds.height-=1,a.bounds.width-=1,a.dialect=mxConstants.DIALECT_STRICTHTML,a.init(this.graph.container)):(a.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,a.init(this.graph.getView().getOverlayPane())),mxEvent.redirectMouseEvents(a.node,this.graph,this.state),this.graph.isEnabled()&&(a.node.style.cursor=e),this.isSizerVisible(n)||(a.node.style.visibility="hidden"),a},mxVertexHandler.prototype.isSizerVisible=function(e){return!0},mxVertexHandler.prototype.createSizerShape=function(e,n,t){return null!=this.handleImage?(e.width=this.handleImage.width,e.height=this.handleImage.height,new mxImageShape(e,this.handleImage.src)):n==mxEvent.ROTATION_HANDLE?new mxEllipse(e,t||mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR):new mxRectangleShape(e,t||mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR)},mxVertexHandler.prototype.moveSizerTo=function(e,n,t){null!=e&&(e.bounds.x=Math.round(n-e.bounds.width/2),e.bounds.y=Math.round(t-e.bounds.height/2),e.redraw())},mxVertexHandler.prototype.getHandleForEvent=function(e){if(e.isSource(this.rotationShape))return mxEvent.ROTATION_HANDLE;if(e.isSource(this.labelShape))return mxEvent.LABEL_HANDLE;if(null!=this.sizers)for(var n=this.tolerance,t=(n=this.allowHandleBoundsCheck&&(mxClient.IS_IE||0<n)?new mxRectangle(e.getGraphX()-n,e.getGraphY()-n,2*n,2*n):null,0);t<this.sizers.length;t++)if(e.isSource(this.sizers[t])||null!=n&&mxUtils.intersects(this.sizers[t].bounds,n))return t;return null},mxVertexHandler.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(n.getEvent())&&(0<this.tolerance||n.getState()==this.state)){var t=this.getHandleForEvent(n);null!=t&&(this.start(n.getX(),n.getY(),t),n.consume())}},mxVertexHandler.prototype.start=function(e,n,t){e=mxUtils.convertPoint(this.graph.container,e,n),this.startX=e.x,this.startY=e.y,this.index=t,this.selectionBorder.node.style.display=t==mxEvent.ROTATION_HANDLE?"inline":"none",this.preview=this.createSelectionShape(this.bounds),mxClient.IS_SVG&&0!=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0")||null==this.state.text||this.state.text.node.parentNode!=this.graph.container?(this.preview.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.preview.init(this.graph.view.getOverlayPane())):(this.preview.dialect=mxConstants.DIALECT_STRICTHTML,this.preview.init(this.graph.container))},mxVertexHandler.prototype.mouseMove=function(e,n){if(n.isConsumed()||null==this.index)null!=this.getHandleForEvent(n)&&n.consume(!1);else{var t=new mxPoint(n.getGraphX(),n.getGraphY()),a=this.graph.isGridEnabledEvent(n.getEvent()),i=this.graph.getView().scale;if(this.index==mxEvent.LABEL_HANDLE)a&&(t.x=this.graph.snap(t.x/i)*i,t.y=this.graph.snap(t.y/i)*i),this.moveSizerTo(this.sizers[this.sizers.length-1],t.x,t.y);else if(this.index==mxEvent.ROTATION_HANDLE){var s=this.state.x+this.state.width/2-t.x,o=this.state.y+this.state.height/2-t.y;this.currentAlpha=0!=s?180*Math.atan(o/s)/Math.PI+90:o<0?180:0,0<s&&(this.currentAlpha-=180),this.rotationRaster&&(s=t.x-this.state.getCenterX(),o=t.y-this.state.getCenterY(),s=Math.abs(Math.sqrt(s*s+o*o)-this.state.height/2-20),s=Math.max(1,5*Math.min(3,Math.max(0,Math.round(80/Math.abs(s))))),this.currentAlpha=Math.round(this.currentAlpha/s)*s),this.selectionBorder.rotation=this.currentAlpha,this.selectionBorder.redraw()}else{var r=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),l=Math.cos(-r),d=Math.sin(-r),c=new mxPoint(this.state.getCenterX(),this.state.getCenterY()),m=(s=t.x-this.startX,o=t.y-this.startY,t=this.graph.view.translate,d*s+l*o);s=l*s-d*o;this.bounds=this.union(this.selectionBounds,s,m,this.index,a,i,t),l=Math.cos(r),c=(d=Math.sin(r))*(s=(o=new mxPoint(this.bounds.getCenterX(),this.bounds.getCenterY())).x-c.x)+l*(o=o.y-c.y)-o,this.bounds.x+=l*s-d*o-s,this.bounds.y+=c,this.drawPreview()}n.consume()}},mxVertexHandler.prototype.mouseUp=function(e,n){if(!n.isConsumed()&&null!=this.index&&null!=this.state){var t=new mxPoint(n.getGraphX(),n.getGraphY());this.graph.getModel().beginUpdate();try{if(this.index==mxEvent.ROTATION_HANDLE)null!=this.currentAlpha&&this.rotateCell(this.state.cell,this.currentAlpha-(this.state.style[mxConstants.STYLE_ROTATION]||0));else{var a=this.graph.isGridEnabledEvent(n.getEvent()),i=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),s=Math.cos(-i),o=Math.sin(-i),r=(t=o*(r=t.x-this.startX)+s*(l=t.y-this.startY),s*r-o*l),l=t,d=this.graph.view.scale;this.resizeCell(this.state.cell,r/d,l/d,this.index,a)}}finally{this.graph.getModel().endUpdate()}this.reset(),n.consume()}},mxVertexHandler.prototype.rotateCell=function(e,n){var t=this.graph.getModel();if(t.isVertex(e)){if(null!=(s=e==this.state?this.state:this.graph.view.getState(e))&&this.graph.setCellStyles(mxConstants.STYLE_ROTATION,(s.style[mxConstants.STYLE_ROTATION]||0)+n,[e]),this.state.cell!=e&&(null!=(s=this.graph.getCellGeometry(e))&&!s.relative))if(0!=n){var a=this.graph.getModel().getParent(e),i=this.graph.getCellGeometry(a);if(!s.relative&&null!=i){var s,o=mxUtils.toRadians(n),r=(a=Math.cos(o),o=Math.sin(o),new mxPoint(s.getCenterX(),s.getCenterY()));i=new mxPoint(i.width/2,i.height/2),a=mxUtils.getRotatedPoint(r,a,o,i);(s=s.clone()).x=a.x-s.width/2,s.y=a.y-s.height/2,t.setGeometry(e,s)}}else(s=s.clone()).x+=dx,s.y+=dy,t.setGeometry(e,s);for(s=t.getChildCount(e),a=0;a<s;a++)this.rotateCell(t.getChildAt(e,a),n)}},mxVertexHandler.prototype.reset=function(){this.index=this.currentAlpha=null,null!=this.preview&&(this.preview.destroy(),this.preview=null),null!=this.selectionBorder&&(this.selectionBorder.node.style.display="inline",this.selectionBounds=this.getSelectionBounds(this.state),this.bounds=new mxRectangle(this.selectionBounds.x,this.selectionBounds.y,this.selectionBounds.width,this.selectionBounds.height),this.drawPreview())},mxVertexHandler.prototype.resizeCell=function(e,n,t,a,i){var s=this.graph.model.getGeometry(e);if(null!=s)if(a==mxEvent.LABEL_HANDLE)a=this.graph.view.scale,n=(this.labelShape.bounds.getCenterX()-this.startX)/a,t=(this.labelShape.bounds.getCenterY()-this.startY)/a,null==(s=s.clone()).offset?s.offset=new mxPoint(n,t):(s.offset.x+=n,s.offset.y+=t),this.graph.model.setGeometry(e,s);else{if(a=this.union(s,n,t,a,i,1,new mxPoint(0,0)),0!=(r=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"))){n=a.getCenterX()-s.getCenterX(),t=a.getCenterY()-s.getCenterY(),i=Math.cos(r);var o=Math.sin(r),r=i*n-o*t-n;n=o*n+i*t-t,t=a.x-s.x;var l=a.y-s.y,d=i*t-o*l;i=o*t+i*l,a.x+=r,a.y+=n,this.graph.isCellCollapsed(e)||0==r&&0==n||(t=s.x-a.x+d,l=s.y-a.y+i,this.moveChildren(e,t,l))}this.graph.resizeCell(e,a)}},mxVertexHandler.prototype.moveChildren=function(e,n,t){for(var a=this.graph.getModel(),i=a.getChildCount(e),s=0;s<i;s++){var o=a.getChildAt(e,s);if(a.isVertex(o)){var r=this.graph.getCellGeometry(o);null!=r&&!r.relative&&((r=r.clone()).x+=n,r.y+=t,a.setGeometry(o,r))}}},mxVertexHandler.prototype.union=function(e,n,t,a,i,s,o){if(this.singleSizer){o=e.x+e.width+n;var r=e.y+e.height+t;return i&&(o=this.graph.snap(o/s)*s,r=this.graph.snap(r/s)*s),(s=new mxRectangle(e.x,e.y,0,0)).add(new mxRectangle(o,r,0,0)),s}var l=(r=e.x-o.x*s)+e.width,d=e.y-o.y*s;return e=d+e.height,4<a?(e+=t,i&&(e=this.graph.snap(e/s)*s)):a<3&&(d+=t,i&&(d=this.graph.snap(d/s)*s)),0==a||3==a||5==a?(r+=n,i&&(r=this.graph.snap(r/s)*s)):2!=a&&4!=a&&7!=a||(l+=n,i&&(l=this.graph.snap(l/s)*s)),e-=d,(i=l-r)<0&&(r+=i,i=Math.abs(i)),e<0&&(d+=e,e=Math.abs(e)),new mxRectangle(r+o.x*s,d+o.y*s,i,e)},mxVertexHandler.prototype.redraw=function(){this.selectionBounds=this.getSelectionBounds(this.state),this.bounds=new mxRectangle(this.state.x,this.state.y,this.state.width,this.state.height);var e=this.state;if(null!=this.sizers){var n=e.x+e.width,t=e.y+e.height;if(this.singleSizer)this.moveSizerTo(this.sizers[0],n,t);else{var a=e.x+e.width/2,i=e.y+e.height/2;if(1<this.sizers.length){var s=mxUtils.toRadians(e.style[mxConstants.STYLE_ROTATION]||"0"),o=Math.cos(s),r=(s=Math.sin(s),new mxPoint(e.getCenterX(),e.getCenterY())),l=mxUtils.getRotatedPoint(new mxPoint(e.x,e.y),o,s,r);this.moveSizerTo(this.sizers[0],l.x,l.y),l.x=a,l.y=e.y,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[1],l.x,l.y),l.x=n,l.y=e.y,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[2],l.x,l.y),l.x=e.x,l.y=i,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[3],l.x,l.y),l.x=n,l.y=i,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[4],l.x,l.y),l.x=e.x,l.y=t,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[5],l.x,l.y),l.x=a,l.y=t,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[6],l.x,l.y),l.x=n,l.y=t,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[7],l.x,l.y),this.moveSizerTo(this.sizers[8],a+e.absoluteOffset.x,i+e.absoluteOffset.y)}else 2<=this.state.width&&2<=this.state.height?this.moveSizerTo(this.sizers[0],a+e.absoluteOffset.x,i+e.absoluteOffset.y):this.moveSizerTo(this.sizers[0],e.x,e.y)}}null!=this.rotationShape&&(s=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),o=Math.cos(s),s=Math.sin(s),r=new mxPoint(this.state.getCenterX(),this.state.getCenterY()),l=mxUtils.getRotatedPoint(new mxPoint(e.x+e.width/2,e.y-16),o,s,r),this.moveSizerTo(this.rotationShape,l.x,l.y)),this.selectionBorder.rotation=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0"),this.drawPreview()},mxVertexHandler.prototype.drawPreview=function(){null!=this.preview&&(this.preview.bounds=this.bounds,this.preview.node.parentNode==this.graph.container&&(this.preview.bounds.width=Math.max(0,this.preview.bounds.width-1),this.preview.bounds.height=Math.max(0,this.preview.bounds.height-1)),this.preview.rotation=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0"),this.preview.redraw()),this.selectionBorder.bounds=this.bounds,this.selectionBorder.redraw()},mxVertexHandler.prototype.destroy=function(){if(null!=this.preview&&(this.preview.destroy(),this.preview=null),this.selectionBorder.destroy(),this.labelShape=this.selectionBorder=null,null!=this.sizers)for(var e=0;e<this.sizers.length;e++)this.sizers[e].destroy(),this.sizers[e]=null},mxEdgeHandler.prototype.graph=null,mxEdgeHandler.prototype.state=null,mxEdgeHandler.prototype.marker=null,mxEdgeHandler.prototype.constraintHandler=null,mxEdgeHandler.prototype.error=null,mxEdgeHandler.prototype.shape=null,mxEdgeHandler.prototype.bends=null,mxEdgeHandler.prototype.labelShape=null,mxEdgeHandler.prototype.cloneEnabled=!0,mxEdgeHandler.prototype.addEnabled=!1,mxEdgeHandler.prototype.removeEnabled=!1,mxEdgeHandler.prototype.preferHtml=!1,mxEdgeHandler.prototype.allowHandleBoundsCheck=!0,mxEdgeHandler.prototype.snapToTerminals=!1,mxEdgeHandler.prototype.handleImage=null,mxEdgeHandler.prototype.tolerance=0,mxEdgeHandler.prototype.init=function(){if(this.graph=this.state.view.graph,this.marker=this.createMarker(),this.constraintHandler=new mxConstraintHandler(this.graph),this.points=[],this.abspoints=this.getSelectionPoints(this.state),this.shape=this.createSelectionShape(this.abspoints),this.shape.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,this.shape.init(this.graph.getView().getOverlayPane()),this.shape.svgStrokeTolerance=0,this.shape.node.style.cursor=mxConstants.CURSOR_MOVABLE_EDGE,mxEvent.addListener(this.shape.node,"dblclick",mxUtils.bind(this,function(e){this.graph.dblClick(e,this.state.cell)})),mxEvent.addGestureListeners(this.shape.node,mxUtils.bind(this,function(e){this.addEnabled&&this.isAddPointEvent(e)?this.addPoint(this.state,e):this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,this.state))}),mxUtils.bind(this,function(e){var n=this.state.cell;if(null!=this.index){var t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));n=this.graph.getCellAt(t.x,t.y);this.graph.isSwimlane(n)&&this.graph.hitsSwimlaneContent(n,t.x,t.y)&&(n=null)}this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,this.graph.getView().getState(n)))}),mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,this.state))})),this.preferHtml=null!=this.state.text&&this.state.text.node.parentNode==this.graph.container,!this.preferHtml){var e=this.state.getVisibleTerminalState(!0);null!=e&&(this.preferHtml=null!=e.text&&e.text.node.parentNode==this.graph.container),this.preferHtml||null!=(e=this.state.getVisibleTerminalState(!1))&&(this.preferHtml=null!=e.text&&e.text.node.parentNode==this.graph.container)}(this.graph.getSelectionCount()<mxGraphHandler.prototype.maxCells||mxGraphHandler.prototype.maxCells<=0)&&(this.bends=this.createBends()),this.label=new mxPoint(this.state.absoluteOffset.x,this.state.absoluteOffset.y),this.labelShape=new mxRectangleShape(new mxRectangle,mxConstants.LABEL_HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR),this.labelShape.pointerEvents=!1,this.initBend(this.labelShape),this.labelShape.node.style.cursor=mxConstants.CURSOR_LABEL_HANDLE,mxEvent.redirectMouseEvents(this.labelShape.node,this.graph,this.state),this.redraw()},mxEdgeHandler.prototype.isAddPointEvent=function(e){return mxEvent.isShiftDown(e)},mxEdgeHandler.prototype.isRemovePointEvent=function(e){return mxEvent.isShiftDown(e)},mxEdgeHandler.prototype.getSelectionPoints=function(e){return e.absolutePoints},mxEdgeHandler.prototype.createSelectionShape=function(e){return(e=new mxPolyline(e,this.getSelectionColor())).strokewidth=this.getSelectionStrokeWidth(),e.isDashed=this.isSelectionDashed(),e},mxEdgeHandler.prototype.getSelectionColor=function(){return mxConstants.EDGE_SELECTION_COLOR},mxEdgeHandler.prototype.getSelectionStrokeWidth=function(){return mxConstants.EDGE_SELECTION_STROKEWIDTH},mxEdgeHandler.prototype.isSelectionDashed=function(){return mxConstants.EDGE_SELECTION_DASHED},mxEdgeHandler.prototype.isConnectableCell=function(e){return!0},mxEdgeHandler.prototype.createMarker=function(){var e=new mxCellMarker(this.graph),a=this;return e.getCell=function(e){var n=mxCellMarker.prototype.getCell.apply(this,arguments);if(!a.isConnectableCell(n))return null;var t=a.graph.getModel();return(n==a.state.cell||null!=n&&!a.graph.connectableEdges&&t.isEdge(n))&&(n=null),n},e.isValidState=function(e){var n=a.graph.getModel();n=null!=(n=a.graph.view.getTerminalPort(e,a.graph.view.getState(n.getTerminal(a.state.cell,!a.isSource)),!a.isSource))?n.cell:null;return a.error=a.validateConnection(a.isSource?e.cell:n,a.isSource?n:e.cell),null==a.error},e},mxEdgeHandler.prototype.validateConnection=function(e,n){return this.graph.getEdgeValidationError(this.state.cell,e,n)},mxEdgeHandler.prototype.createBends=function(){for(var e=this.state.cell,n=[],t=0;t<this.abspoints.length;t++)if(this.isHandleVisible(t)){var a=t==this.abspoints.length-1;if((a=0==t||a)||this.graph.isCellBendable(e)){var i=this.createHandleShape(t);if(this.initBend(i),mxClient.IS_TOUCH&&i.node.setAttribute("pointer-events","none"),this.isHandleEnabled(t))if(mxClient.IS_TOUCH){var s=mxUtils.bind(this,function(e){return e=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),this.graph.view.getState(this.graph.getCellAt(e.x,e.y))});mxEvent.redirectMouseEvents(i.node,this.graph,s)}else i.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(i.node,this.graph,this.state);n.push(i),a||(this.points.push(new mxPoint(0,0)),i.node.style.visibility="hidden")}}return n},mxEdgeHandler.prototype.isHandleEnabled=function(e){return!0},mxEdgeHandler.prototype.isHandleVisible=function(e){return!0},mxEdgeHandler.prototype.createHandleShape=function(e){return null!=this.handleImage?new mxImageShape(new mxRectangle(0,0,this.handleImage.width,this.handleImage.height),this.handleImage.src):(e=mxConstants.HANDLE_SIZE,this.preferHtml&&(e-=1),new mxRectangleShape(new mxRectangle(0,0,e,e),mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR))},mxEdgeHandler.prototype.initBend=function(e){this.preferHtml?(e.dialect=mxConstants.DIALECT_STRICTHTML,e.init(this.graph.container)):(e.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()))},mxEdgeHandler.prototype.getHandleForEvent=function(e){if(null!=this.bends)for(var n=this.tolerance,t=(n=this.allowHandleBoundsCheck&&(mxClient.IS_IE||0<n)?new mxRectangle(e.getGraphX()-n,e.getGraphY()-n,2*n,2*n):null,0);t<this.bends.length;t++)if((e.isSource(this.bends[t])||null!=n&&mxUtils.intersects(this.bends[t].bounds,n))&&"hidden"!=this.bends[t].node.style.visibility)return t;return!(e.isSource(this.labelShape)&&"hidden"!=this.labelShape.node.style.visibility||e.isSource(this.state.text))||(mxClient.IS_SF||mxClient.IS_GC)&&"SELECT"==e.getSource().nodeName?null:mxEvent.LABEL_HANDLE},mxEdgeHandler.prototype.mouseDown=function(e,n){var t=null;null!=(t=this.getHandleForEvent(n))&&!n.isConsumed()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(n.getEvent())&&(this.removeEnabled&&this.isRemovePointEvent(n.getEvent())?this.removePoint(this.state,t):(t!=mxEvent.LABEL_HANDLE||this.graph.isLabelMovable(n.getCell()))&&this.start(n.getX(),n.getY(),t),n.consume())},mxEdgeHandler.prototype.start=function(e,n,t){this.startX=e,this.startY=n,this.isSource=null!=this.bends&&0==t,this.isTarget=null!=this.bends&&t==this.bends.length-1,this.isLabel=t==mxEvent.LABEL_HANDLE,this.isSource||this.isTarget?(e=this.state.cell,(null==(n=this.graph.model.getTerminal(e,this.isSource))&&this.graph.isTerminalPointMovable(e,this.isSource)||null!=n&&this.graph.isCellDisconnectable(e,n,this.isSource))&&(this.index=t)):this.index=t},mxEdgeHandler.prototype.clonePreviewState=function(e,n){return this.state.clone()},mxEdgeHandler.prototype.getSnapToTerminalTolerance=function(){return this.graph.gridSize*this.graph.view.scale/2},mxEdgeHandler.prototype.getPointForEvent=function(e){var t=new mxPoint(e.getGraphX(),e.getGraphY()),a=this.getSnapToTerminalTolerance(),n=this.graph.getView(),i=!1,s=!1;if(this.snapToTerminals&&0<a){var o=function(e){if(null!=e){var n=e.x;Math.abs(t.x-n)<a&&(t.x=n,i=!0),e=e.y,Math.abs(t.y-e)<a&&(t.y=e,s=!0)}},r=function(e){null!=e&&o.call(this,new mxPoint(n.getRoutingCenterX(e),n.getRoutingCenterY(e)))};if(r.call(this,this.state.getVisibleTerminalState(!0)),r.call(this,this.state.getVisibleTerminalState(!1)),null!=this.abspoints)for(r=0;r<this.abspoints;r++)r!=this.index&&o.call(this,this.abspoints[r])}return this.graph.isGridEnabledEvent(e.getEvent())&&(e=n.scale,r=n.translate,i||(t.x=(this.graph.snap(t.x/e-r.x)+r.x)*e),s||(t.y=(this.graph.snap(t.y/e-r.y)+r.y)*e)),t},mxEdgeHandler.prototype.getPreviewTerminalState=function(e){this.constraintHandler.update(e,this.isSource),this.marker.process(e),e=this.marker.getValidState();var n=null;return null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentConstraint&&this.marker.reset(),null!=e?n=e:null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(n=this.constraintHandler.currentFocus),n},mxEdgeHandler.prototype.getPreviewPoints=function(e){var n=null!=(n=this.graph.getCellGeometry(this.state.cell)).points?n.points.slice():null;return this.isSource||this.isTarget?this.graph.resetEdgesOnConnect&&(n=null):(this.convertPoint(e,!1),null==n?n=[e]:n[this.index-1]=e),n},mxEdgeHandler.prototype.updatePreviewState=function(e,n,t){var a=this.isSource?t:this.state.getVisibleTerminalState(!0),i=this.isTarget?t:this.state.getVisibleTerminalState(!1),s=this.graph.getConnectionConstraint(e,a,!0),o=this.graph.getConnectionConstraint(e,i,!1),r=this.constraintHandler.currentConstraint;null==r&&(r=new mxConnectionConstraint),this.isSource?s=r:this.isTarget&&(o=r),(!this.isSource||null!=a)&&e.view.updateFixedTerminalPoint(e,a,!0,s),(!this.isTarget||null!=i)&&e.view.updateFixedTerminalPoint(e,i,!1,o),(this.isSource||this.isTarget)&&null==t&&(e.setAbsoluteTerminalPoint(n,this.isSource),null==this.marker.getMarkedState()&&(this.error=this.graph.allowDanglingEdges?null:"")),e.view.updatePoints(e,this.points,a,i),e.view.updateFloatingTerminalPoints(e,a,i)},mxEdgeHandler.prototype.mouseMove=function(e,n){if(null!=this.index&&null!=this.marker){var t=this.getPointForEvent(n);if(this.isLabel)this.label.x=t.x,this.label.y=t.y;else{this.points=this.getPreviewPoints(t);var a=this.isSource||this.isTarget?this.getPreviewTerminalState(n):null,i=this.clonePreviewState(t,null!=a?a.cell:null);this.updatePreviewState(i,t,a),this.setPreviewColor(null==this.error?this.marker.validColor:this.marker.invalidColor),this.abspoints=i.absolutePoints,this.active=!0}this.drawPreview(),mxEvent.consume(n.getEvent()),n.consume()}else mxClient.IS_IE&&null!=this.getHandleForEvent(n)&&n.consume(!1)},mxEdgeHandler.prototype.mouseUp=function(e,n){if(null!=this.index&&null!=this.marker){var t=this.state.cell;if(n.getX()!=this.startX||n.getY()!=this.startY)if(null!=this.error)0<this.error.length&&this.graph.validationAlert(this.error);else if(this.isLabel)this.moveLabel(this.state,this.label.x,this.label.y);else if(this.isSource||this.isTarget){var a=null;if(null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(a=this.constraintHandler.currentFocus.cell),null==a&&this.marker.hasValidState()&&(a=this.marker.validState.cell),null!=a)t=this.connect(t,a,this.isSource,this.graph.isCloneEvent(n.getEvent())&&this.cloneEnabled&&this.graph.isCellsCloneable(),n);else if(this.graph.isAllowDanglingEdges()){(a=this.abspoints[this.isSource?0:this.abspoints.length-1]).x=a.x/this.graph.view.scale-this.graph.view.translate.x,a.y=a.y/this.graph.view.scale-this.graph.view.translate.y;var i=this.graph.getView().getState(this.graph.getModel().getParent(t));null!=i&&(a.x-=i.origin.x,a.y-=i.origin.y),a.x-=this.graph.panDx/this.graph.view.scale,a.y-=this.graph.panDy/this.graph.view.scale,this.changeTerminalPoint(t,a,this.isSource)}}else this.active?this.changePoints(t,this.points):(this.graph.getView().invalidate(this.state.cell),this.graph.getView().revalidate(this.state.cell));null!=this.marker&&(this.reset(),t!=this.state.cell&&this.graph.setSelectionCell(t)),n.consume()}},mxEdgeHandler.prototype.reset=function(){this.points=this.label=this.index=this.error=null,this.isTarget=this.isSource=this.isLabel=this.active=!1,this.marker.reset(),this.constraintHandler.reset(),this.setPreviewColor(mxConstants.EDGE_SELECTION_COLOR),this.redraw()},mxEdgeHandler.prototype.setPreviewColor=function(e){null!=this.shape&&(this.shape.stroke=e)},mxEdgeHandler.prototype.convertPoint=function(e,n){var t=this.graph.getView().getScale(),a=this.graph.getView().getTranslate();return n&&(e.x=this.graph.snap(e.x),e.y=this.graph.snap(e.y)),e.x=Math.round(e.x/t-a.x),e.y=Math.round(e.y/t-a.y),null!=(t=this.graph.getView().getState(this.graph.getModel().getParent(this.state.cell)))&&(e.x-=t.origin.x,e.y-=t.origin.y),e},mxEdgeHandler.prototype.moveLabel=function(e,n,t){var a=this.graph.getModel();if(null!=(i=a.getGeometry(e.cell))){var i=i.clone(),s=this.graph.getView().getRelativePoint(e,n,t);i.x=s.x,i.y=s.y;var o=this.graph.getView().scale;i.offset=new mxPoint(0,0),s=this.graph.view.getPoint(e,i),i.offset=new mxPoint((n-s.x)/o,(t-s.y)/o),a.setGeometry(e.cell,i)}},mxEdgeHandler.prototype.connect=function(e,n,t,a,i){var s=(i=this.graph.getModel()).getParent(e);i.beginUpdate();try{if(a){var o=e.clone();i.add(s,o,i.getChildCount(s));var r=i.getTerminal(e,!t);this.graph.connectCell(o,r,!t),e=o}var l=this.constraintHandler.currentConstraint;null==l&&(l=new mxConnectionConstraint),this.graph.connectCell(e,n,t,l)}finally{i.endUpdate()}return e},mxEdgeHandler.prototype.changeTerminalPoint=function(e,n,t){var a=this.graph.getModel(),i=a.getGeometry(e);if(null!=i){a.beginUpdate();try{(i=i.clone()).setTerminalPoint(n,t),a.setGeometry(e,i),this.graph.connectCell(e,null,t,new mxConnectionConstraint)}finally{a.endUpdate()}}},mxEdgeHandler.prototype.changePoints=function(e,n){var t=this.graph.getModel(),a=t.getGeometry(e);null!=a&&((a=a.clone()).points=n,t.setGeometry(e,a))},mxEdgeHandler.prototype.addPoint=function(e,n){var t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(n),mxEvent.getClientY(n)),a=this.graph.isGridEnabledEvent(n);this.convertPoint(t,a),this.addPointAt(e,t.x,t.y),mxEvent.consume(n)},mxEdgeHandler.prototype.addPointAt=function(e,n,t){var a=this.graph.getCellGeometry(e.cell);if(n=new mxPoint(n,t),null!=a){a=a.clone(),t=this.graph.view.translate;var i=this.graph.view.scale;t=mxUtils.findNearestSegment(e,(n.x+t.x)*i,(n.y+t.y)*i),null==a.points?a.points=[n]:a.points.splice(t,0,n),this.graph.getModel().setGeometry(e.cell,a),this.destroy(),this.init()}},mxEdgeHandler.prototype.removePoint=function(e,n){if(0<n&&n<this.abspoints.length-1){var t=this.graph.getCellGeometry(this.state.cell);null!=t&&null!=t.points&&((t=t.clone()).points.splice(n-1,1),this.graph.getModel().setGeometry(e.cell,t),this.destroy(),this.init())}},mxEdgeHandler.prototype.getHandleFillColor=function(e){e=0==e;var n=this.state.cell,t=this.graph.getModel().getTerminal(n,e),a=mxConstants.HANDLE_FILLCOLOR;return null!=t&&!this.graph.isCellDisconnectable(n,t,e)||null==t&&!this.graph.isTerminalPointMovable(n,e)?a=mxConstants.LOCKED_HANDLE_FILLCOLOR:null!=t&&this.graph.isCellDisconnectable(n,t,e)&&(a=mxConstants.CONNECT_HANDLE_FILLCOLOR),a},mxEdgeHandler.prototype.redraw=function(){this.abspoints=this.state.absolutePoints.slice();var e=this.state.cell,n=mxConstants.LABEL_HANDLE_SIZE;if(this.label=new mxPoint(this.state.absoluteOffset.x,this.state.absoluteOffset.y),this.labelShape.bounds=new mxRectangle(Math.round(this.label.x-n/2),Math.round(this.label.y-n/2),n,n),this.labelShape.redraw(),null!=(n=this.graph.getLabel(e))&&0<n.length&&this.graph.isLabelMovable(e)?this.labelShape.node.style.visibility="visible":this.labelShape.node.style.visibility="hidden",null!=this.bends&&0<this.bends.length){var t=this.abspoints.length-1,a=(e=this.abspoints[0],this.abspoints[0].y);n=this.bends[0].bounds;this.bends[0].bounds=new mxRectangle(Math.round(this.abspoints[0].x-n.width/2),Math.round(a-n.height/2),n.width,n.height),this.bends[0].fill=this.getHandleFillColor(0),this.bends[0].redraw();a=this.abspoints[t];var i=this.abspoints[t].x,s=(t=this.abspoints[t].y,this.bends.length-1);n=this.bends[s].bounds;this.bends[s].bounds=new mxRectangle(Math.round(i-n.width/2),Math.round(t-n.height/2),n.width,n.height),this.bends[s].fill=this.getHandleFillColor(s),this.bends[s].redraw(),this.redrawInnerBends(e,a)}this.drawPreview()},mxEdgeHandler.prototype.redrawInnerBends=function(e,n){var t=this.graph.getModel().getGeometry(this.state.cell).points;if(null!=t){null==this.points&&(this.points=[]);for(var a=1;a<this.bends.length-1;a++)if(null!=this.bends[a])if(null!=this.abspoints[a]){var i=this.abspoints[a].x,s=this.abspoints[a].y,o=this.bends[a].bounds;this.bends[a].node.style.visibility="visible",this.bends[a].bounds=new mxRectangle(Math.round(i-o.width/2),Math.round(s-o.height/2),o.width,o.height),this.bends[a].redraw(),this.points[a-1]=t[a-1]}else this.bends[a].destroy(),this.bends[a]=null}},mxEdgeHandler.prototype.drawPreview=function(){if(this.isLabel){var e=mxConstants.LABEL_HANDLE_SIZE;e=new mxRectangle(Math.round(this.label.x-e/2),Math.round(this.label.y-e/2),e,e);this.labelShape.bounds=e,this.labelShape.redraw()}else this.shape.points=this.abspoints,this.shape.redraw()},mxEdgeHandler.prototype.destroy=function(){if(null!=this.marker&&(this.marker.destroy(),this.marker=null),null!=this.shape&&(this.shape.destroy(),this.shape=null),null!=this.labelShape&&(this.labelShape.destroy(),this.labelShape=null),null!=this.constraintHandler&&(this.constraintHandler.destroy(),this.constraintHandler=null),null!=this.bends)for(var e=0;e<this.bends.length;e++)null!=this.bends[e]&&(this.bends[e].destroy(),this.bends[e]=null)},mxUtils.extend(mxElbowEdgeHandler,mxEdgeHandler),mxElbowEdgeHandler.prototype=new mxEdgeHandler,mxElbowEdgeHandler.prototype.constructor=mxElbowEdgeHandler,mxElbowEdgeHandler.prototype.flipEnabled=!0,mxElbowEdgeHandler.prototype.doubleClickOrientationResource="none"!=mxClient.language?"doubleClickOrientation":"",mxElbowEdgeHandler.prototype.createBends=function(){var e=[],n=this.createHandleShape(0);return this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none"),e.push(this.createVirtualBend()),this.points.push(new mxPoint(0,0)),n=this.createHandleShape(2),this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none"),e},mxElbowEdgeHandler.prototype.createVirtualBend=function(){var e=this.createHandleShape();this.initBend(e);var n=this.getCursorForBend();return e.node.style.cursor=n,n=mxUtils.bind(this,function(e){!mxEvent.isConsumed(e)&&this.flipEnabled&&(this.graph.flipEdge(this.state.cell,e),mxEvent.consume(e))}),mxEvent.redirectMouseEvents(e.node,this.graph,this.state,null,null,null,n),this.graph.isCellBendable(this.state.cell)||(e.node.style.display="none"),e},mxElbowEdgeHandler.prototype.getCursorForBend=function(){return this.state.style[mxConstants.STYLE_EDGE]==mxEdgeStyle.TopToBottom||this.state.style[mxConstants.STYLE_EDGE]==mxConstants.EDGESTYLE_TOPTOBOTTOM||(this.state.style[mxConstants.STYLE_EDGE]==mxEdgeStyle.ElbowConnector||this.state.style[mxConstants.STYLE_EDGE]==mxConstants.EDGESTYLE_ELBOW)&&this.state.style[mxConstants.STYLE_ELBOW]==mxConstants.ELBOW_VERTICAL?"row-resize":"col-resize"},mxElbowEdgeHandler.prototype.getTooltipForNode=function(e){var n=null;return null==this.bends||null==this.bends[1]||e!=this.bends[1].node&&e.parentNode!=this.bends[1].node||(n=this.doubleClickOrientationResource,n=mxResources.get(n)||n),n},mxElbowEdgeHandler.prototype.convertPoint=function(e,n){var t=this.graph.getView().getScale(),a=this.graph.getView().getTranslate(),i=this.state.origin;n&&(e.x=this.graph.snap(e.x),e.y=this.graph.snap(e.y)),e.x=Math.round(e.x/t-a.x-i.x),e.y=Math.round(e.y/t-a.y-i.y)},mxElbowEdgeHandler.prototype.redrawInnerBends=function(e,n){var t=null==(t=null!=(t=this.graph.getModel().getGeometry(this.state.cell).points)?t[0]:null)?new mxPoint(e.x+(n.x-e.x)/2,e.y+(n.y-e.y)/2):new mxPoint(this.graph.getView().scale*(t.x+this.graph.getView().translate.x+this.state.origin.x),this.graph.getView().scale*(t.y+this.graph.getView().translate.y+this.state.origin.y)),a=(i=this.bends[1].bounds).width,i=i.height;null==this.handleImage&&(i=a=mxConstants.HANDLE_SIZE);var s=new mxRectangle(Math.round(t.x-a/2),Math.round(t.y-i/2),a,i);null==this.handleImage&&"hidden"!=this.labelShape.node.style.visibility&&mxUtils.intersects(s,this.labelShape.bounds)&&(a+=3,i+=3,s=new mxRectangle(Math.round(t.x-a/2),Math.round(t.y-i/2),a,i)),this.bends[1].bounds=s,this.bends[1].redraw()},mxUtils.extend(mxEdgeSegmentHandler,mxEdgeHandler),mxEdgeSegmentHandler.prototype=new mxElbowEdgeHandler,mxEdgeSegmentHandler.prototype.constructor=mxEdgeSegmentHandler,mxEdgeSegmentHandler.prototype.getPreviewPoints=function(e){if(this.isSource||this.isTarget)return mxElbowEdgeHandler.prototype.getPreviewPoints.apply(this,arguments);this.convertPoint(e,!1);var n=this.state.absolutePoints,t=n[0].clone();this.convertPoint(t,!1);for(var a=[],i=1;i<n.length;i++){var s=n[i].clone();this.convertPoint(s,!1),i==this.index&&(t.x==s.x?(t.x=e.x,s.x=e.x):(t.y=e.y,s.y=e.y)),i<n.length-1&&a.push(s),t=s}if(1==a.length){if(t=this.state.view,i=this.state.getVisibleTerminalState(!0),null!=(s=this.state.getVisibleTerminalState(!1))&null!=i){var o=this.state.origin.x,r=this.state.origin.y;mxUtils.contains(s,a[0].x+o,a[0].y+r)?n[1].y==n[2].y?a[0].y=t.getRoutingCenterY(i)-r:a[0].x=t.getRoutingCenterX(i)-o:mxUtils.contains(i,a[0].x+o,a[0].y+r)&&(n[1].y==n[0].y?a[0].y=t.getRoutingCenterY(s)-r:a[0].x=t.getRoutingCenterX(s)-o)}}else 0==a.length&&(a=[e]);return a},mxEdgeSegmentHandler.prototype.createBends=function(){var e=[],n=this.createHandleShape(0);this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none");var t=this.state.absolutePoints;if(this.graph.isCellBendable(this.state.cell)){null==this.points&&(this.points=[]);for(var a=0;a<t.length-1;a++)n=this.createVirtualBend(),e.push(n),n.node.style.cursor=0==t[a].x-t[a+1].x?"col-resize":"row-resize",this.points.push(new mxPoint(0,0)),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none")}return n=this.createHandleShape(t.length),this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none"),e},mxEdgeSegmentHandler.prototype.redraw=function(){this.refresh(),mxEdgeHandler.prototype.redraw.apply(this,arguments)},mxEdgeSegmentHandler.prototype.refresh=function(){if(null!=this.bends){for(var e=0;e<this.bends.length;e++)null!=this.bends[e]&&(this.bends[e].destroy(),this.bends[e]=null);this.bends=this.createBends()}},mxEdgeSegmentHandler.prototype.redrawInnerBends=function(e,n){if(this.graph.isCellBendable(this.state.cell)){var t=mxConstants.HANDLE_SIZE,a=this.state.absolutePoints;if(null!=a&&1<a.length)for(var i=0;i<this.state.absolutePoints.length-1;i++)if(null!=this.bends[i+1]){e=a[i],n=a[i+1];var s=new mxPoint(e.x+(n.x-e.x)/2,e.y+(n.y-e.y)/2);this.bends[i+1].bounds=new mxRectangle(Math.round(s.x-t/2),Math.round(s.y-t/2),t,t),this.bends[i+1].redraw()}}},mxEdgeSegmentHandler.prototype.changePoints=function(e,n){n=[];var t=this.abspoints;if(1<t.length)for(var a=t[0],i=t[1],s=2;s<t.length;s++){var o=t[s];Math.round(a.x)==Math.round(i.x)&&Math.round(i.x)==Math.round(o.x)||Math.round(a.y)==Math.round(i.y)&&Math.round(i.y)==Math.round(o.y)||(i=(a=i).clone(),this.convertPoint(i,!1),n.push(i)),i=o}mxElbowEdgeHandler.prototype.changePoints.apply(this,arguments)},mxKeyHandler.prototype.graph=null,mxKeyHandler.prototype.target=null,mxKeyHandler.prototype.normalKeys=null,mxKeyHandler.prototype.shiftKeys=null,mxKeyHandler.prototype.controlKeys=null,mxKeyHandler.prototype.controlShiftKeys=null,mxKeyHandler.prototype.enabled=!0,mxKeyHandler.prototype.isEnabled=function(){return this.enabled},mxKeyHandler.prototype.setEnabled=function(e){this.enabled=e},mxKeyHandler.prototype.bindKey=function(e,n){this.normalKeys[e]=n},mxKeyHandler.prototype.bindShiftKey=function(e,n){this.shiftKeys[e]=n},mxKeyHandler.prototype.bindControlKey=function(e,n){this.controlKeys[e]=n},mxKeyHandler.prototype.bindControlShiftKey=function(e,n){this.controlShiftKeys[e]=n},mxKeyHandler.prototype.isControlDown=function(e){return mxEvent.isControlDown(e)},mxKeyHandler.prototype.getFunction=function(e){return null!=e?this.isControlDown(e)?mxEvent.isShiftDown(e)?this.controlShiftKeys[e.keyCode]:this.controlKeys[e.keyCode]:mxEvent.isShiftDown(e)?this.shiftKeys[e.keyCode]:this.normalKeys[e.keyCode]:null},mxKeyHandler.prototype.isGraphEvent=function(e){if((e=mxEvent.getSource(e))==this.target||e.parentNode==this.target||null!=this.graph.cellEditor&&e==this.graph.cellEditor.textarea)return!0;for(;null!=e;){if(e==this.graph.container)return!0;e=e.parentNode}return!1},mxKeyHandler.prototype.keyDown=function(e){if(this.graph.isEnabled()&&!mxEvent.isConsumed(e)&&this.isGraphEvent(e)&&this.isEnabled())if(27==e.keyCode)this.escape(e);else if(!this.graph.isEditing()){var n=this.getFunction(e);null!=n&&(n(e),mxEvent.consume(e))}},mxKeyHandler.prototype.escape=function(e){this.graph.isEscapeEnabled()&&this.graph.escape(e)},mxKeyHandler.prototype.destroy=function(){this.target=null},mxTooltipHandler.prototype.zIndex=10005,mxTooltipHandler.prototype.graph=null,mxTooltipHandler.prototype.delay=null,mxTooltipHandler.prototype.hideOnHover=!1,mxTooltipHandler.prototype.enabled=!0,mxTooltipHandler.prototype.isEnabled=function(){return this.enabled},mxTooltipHandler.prototype.setEnabled=function(e){this.enabled=e},mxTooltipHandler.prototype.isHideOnHover=function(){return this.hideOnHover},mxTooltipHandler.prototype.setHideOnHover=function(e){this.hideOnHover=e},mxTooltipHandler.prototype.init=function(){null!=document.body&&(this.div=document.createElement("div"),this.div.className="mxTooltip",this.div.style.visibility="hidden",this.div.style.zIndex=this.zIndex,document.body.appendChild(this.div),mxEvent.addListener(this.div,"mousedown",mxUtils.bind(this,function(e){this.hideTooltip()})))},mxTooltipHandler.prototype.mouseDown=function(e,n){this.reset(n,!1),this.hideTooltip()},mxTooltipHandler.prototype.mouseMove=function(e,n){n.getX()==this.lastX&&n.getY()==this.lastY||(this.reset(n,!0),(this.isHideOnHover()||n.getState()!=this.state||n.getSource()!=this.node&&(!this.stateSource||null!=n.getState()&&this.stateSource==(n.isSource(n.getState().shape)||!n.isSource(n.getState().text))))&&this.hideTooltip()),this.lastX=n.getX(),this.lastY=n.getY()},mxTooltipHandler.prototype.mouseUp=function(e,n){this.reset(n,!0),this.hideTooltip()},mxTooltipHandler.prototype.resetTimer=function(){null!=this.thread&&(window.clearTimeout(this.thread),this.thread=null)},mxTooltipHandler.prototype.reset=function(e,n){if(this.resetTimer(),n&&this.isEnabled()&&null!=e.getState()&&(null==this.div||"hidden"==this.div.style.visibility)){var t=e.getState(),a=e.getSource(),i=e.getX(),s=e.getY(),o=e.isSource(t.shape)||e.isSource(t.text);this.thread=window.setTimeout(mxUtils.bind(this,function(){if(!this.graph.isEditing()&&!this.graph.panningHandler.isMenuShowing()){var e=this.graph.getTooltip(t,a,i,s);this.show(e,i,s),this.state=t,this.node=a,this.stateSource=o}}),this.delay)}},mxTooltipHandler.prototype.hide=function(){this.resetTimer(),this.hideTooltip()},mxTooltipHandler.prototype.hideTooltip=function(){null!=this.div&&(this.div.style.visibility="hidden")},mxTooltipHandler.prototype.show=function(e,n,t){if(null!=e&&0<e.length){null==this.div&&this.init();var a=mxUtils.getScrollOrigin();this.div.style.left=n+a.x+"px",this.div.style.top=t+mxConstants.TOOLTIP_VERTICAL_OFFSET+a.y+"px",mxUtils.isNode(e)?(this.div.innerHTML="",this.div.appendChild(e)):this.div.innerHTML=e.replace(/\n/g,"<br>"),this.div.style.visibility="",mxUtils.fit(this.div)}},mxTooltipHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),mxEvent.release(this.div),null!=this.div&&null!=this.div.parentNode&&this.div.parentNode.removeChild(this.div),this.div=null},mxUtils.extend(mxCellTracker,mxCellMarker),mxCellTracker.prototype.mouseDown=function(e,n){},mxCellTracker.prototype.mouseMove=function(e,n){this.isEnabled()&&this.process(n)},mxCellTracker.prototype.mouseUp=function(e,n){this.reset()},mxCellTracker.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.graph.removeMouseListener(this),mxCellMarker.prototype.destroy.apply(this))},mxCellHighlight.prototype.keepOnTop=!1,mxCellHighlight.prototype.graph=!0,mxCellHighlight.prototype.state=null,mxCellHighlight.prototype.spacing=2,mxCellHighlight.prototype.resetHandler=null,mxCellHighlight.prototype.setHighlightColor=function(e){this.highlightColor=e,null!=this.shape&&(this.shape.stroke=e)},mxCellHighlight.prototype.drawHighlight=function(){this.shape=this.createShape(),this.repaint(),!this.keepOnTop&&this.shape.node.parentNode.firstChild!=this.shape.node&&this.shape.node.parentNode.insertBefore(this.shape.node,this.shape.node.parentNode.firstChild)},mxCellHighlight.prototype.createShape=function(){var e=null;return(e=this.graph.model.isEdge(this.state.cell)?new mxPolyline(this.state.absolutePoints,this.highlightColor,this.strokeWidth):new mxRectangleShape(new mxRectangle,null,this.highlightColor,this.strokeWidth)).dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()),mxEvent.redirectMouseEvents(e.node,this.graph,this.state),e.svgStrokeTolerance=0,e.pointerEvents=!1,e.isDashed=this.dashed,e},mxCellHighlight.prototype.repaint=function(){if(null!=this.state&&null!=this.shape){var e=0;this.graph.model.isEdge(this.state.cell)?this.shape.points=this.state.absolutePoints:(this.shape.bounds=new mxRectangle(this.state.x-this.spacing,this.state.y-this.spacing,this.state.width+2*this.spacing,this.state.height+2*this.spacing),e=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0")),null!=this.state.shape&&this.shape.setCursor(this.state.shape.getCursor()),0!=e&&(this.shape.rotation=e),this.shape.redraw()}},mxCellHighlight.prototype.hide=function(){this.highlight(null)},mxCellHighlight.prototype.highlight=function(e){this.state!=e&&(null!=this.shape&&(this.shape.destroy(),this.shape=null),this.state=e,null!=this.state&&this.drawHighlight())},mxCellHighlight.prototype.destroy=function(){this.graph.getView().removeListener(this.repaintHandler),this.graph.getModel().removeListener(this.repaintHandler),this.graph.getView().removeListener(this.resetHandler),this.graph.getModel().removeListener(this.resetHandler),null!=this.shape&&(this.shape.destroy(),this.shape=null)},mxDefaultKeyHandler.prototype.editor=null,mxDefaultKeyHandler.prototype.handler=null,mxDefaultKeyHandler.prototype.bindAction=function(e,n,t){var a=mxUtils.bind(this,function(){this.editor.execute(n)});t?this.handler.bindControlKey(e,a):this.handler.bindKey(e,a)},mxDefaultKeyHandler.prototype.destroy=function(){this.handler.destroy(),this.handler=null},mxDefaultPopupMenu.prototype.imageBasePath=null,mxDefaultPopupMenu.prototype.config=null,mxDefaultPopupMenu.prototype.createMenu=function(e,n,t,a){if(null!=this.config){var i=this.createConditions(e,t,a);this.addItems(e,n,t,a,i,this.config.firstChild,null)}},mxDefaultPopupMenu.prototype.addItems=function(e,n,t,a,i,s,o){for(var r=!1;null!=s;){if("add"==s.nodeName){if(null==(l=s.getAttribute("if"))||i[l]){var l=s.getAttribute("as"),d=(l=mxResources.get(l)||l,mxUtils.eval(mxUtils.getTextContent(s))),c=s.getAttribute("action"),m=s.getAttribute("icon"),u=s.getAttribute("iconCls");r&&(n.addSeparator(o),r=!1),null!=m&&this.imageBasePath&&(m=this.imageBasePath+m),l=this.addAction(n,e,l,m,d,c,t,o,u),this.addItems(e,n,t,a,i,s.firstChild,l)}}else"separator"==s.nodeName&&(r=!0);s=s.nextSibling}},mxDefaultPopupMenu.prototype.addAction=function(e,n,t,a,i,s,o,r,l){return e.addItem(t,a,function(e){"function"==typeof i&&i.call(n,n,o,e),null!=s&&n.execute(s,o,e)},r,l)},mxDefaultPopupMenu.prototype.createConditions=function(e,n,t){var a=e.graph.getModel(),i=a.getChildCount(n),s=[];for(s.nocell=null==n,s.ncells=1<e.graph.getSelectionCount(),s.notRoot=a.getRoot()!=a.getParent(e.graph.getDefaultParent()),s.cell=null!=n,a=null!=n&&1==e.graph.getSelectionCount(),s.nonEmpty=a&&0<i,s.expandable=a&&e.graph.isCellFoldable(n,!1),s.collapsable=a&&e.graph.isCellFoldable(n,!0),s.validRoot=a&&e.graph.isValidRoot(n),s.emptyValidRoot=s.validRoot&&0==i,s.swimlane=a&&e.graph.isSwimlane(n),i=this.config.getElementsByTagName("condition"),a=0;a<i.length;a++){var o=mxUtils.eval(mxUtils.getTextContent(i[a])),r=i[a].getAttribute("name");null!=r&&"function"==typeof o&&(s[r]=o(e,n,t))}return s},mxDefaultToolbar.prototype.editor=null,mxDefaultToolbar.prototype.toolbar=null,mxDefaultToolbar.prototype.resetHandler=null,mxDefaultToolbar.prototype.spacing=4,mxDefaultToolbar.prototype.connectOnDrop=!1,mxDefaultToolbar.prototype.init=function(e){null!=e&&(this.toolbar=new mxToolbar(e),this.toolbar.addListener(mxEvent.SELECT,mxUtils.bind(this,function(e,n){var t=n.getProperty("function");this.editor.insertFunction=null!=t?mxUtils.bind(this,function(){t.apply(this,arguments),this.toolbar.resetMode()}):null})),this.resetHandler=mxUtils.bind(this,function(){null!=this.toolbar&&this.toolbar.resetMode(!0)}),this.editor.graph.addListener(mxEvent.DOUBLE_CLICK,this.resetHandler),this.editor.addListener(mxEvent.ESCAPE,this.resetHandler))},mxDefaultToolbar.prototype.addItem=function(e,n,t,a){var i=mxUtils.bind(this,function(){null!=t&&0<t.length&&this.editor.execute(t)});return this.toolbar.addItem(e,n,i,a)},mxDefaultToolbar.prototype.addSeparator=function(e){e=e||mxClient.imageBasePath+"/separator.gif",this.toolbar.addSeparator(e)},mxDefaultToolbar.prototype.addCombo=function(){return this.toolbar.addCombo()},mxDefaultToolbar.prototype.addActionCombo=function(e){return this.toolbar.addActionCombo(e)},mxDefaultToolbar.prototype.addActionOption=function(e,n,t){var a=mxUtils.bind(this,function(){this.editor.execute(t)});this.addOption(e,n,a)},mxDefaultToolbar.prototype.addOption=function(e,n,t){return this.toolbar.addOption(e,n,t)},mxDefaultToolbar.prototype.addMode=function(e,n,t,a,i){var s=mxUtils.bind(this,function(){this.editor.setMode(t),null!=i&&i(this.editor)});return this.toolbar.addSwitchMode(e,n,s,a)},mxDefaultToolbar.prototype.addPrototype=function(e,n,t,a,i,s){var o=function(){return"function"==typeof t?t():null!=t?t.clone():null},r=mxUtils.bind(this,function(e,n){"function"==typeof i?i(this.editor,o(),e,n):this.drop(o(),e,n),this.toolbar.resetMode(),mxEvent.consume(e)});return e=this.toolbar.addMode(e,n,r,a,null,s),this.installDropHandler(e,function(e,n,t){r(n,t)}),e},mxDefaultToolbar.prototype.drop=function(e,n,t){var a=this.editor.graph,i=a.getModel();if(null!=t&&!i.isEdge(t)&&this.connectOnDrop&&a.isCellConnectable(t))this.connect(e,n,t);else{for(;null!=t&&!a.isValidDropTarget(t,[e],n);)t=i.getParent(t);this.insert(e,n,t)}},mxDefaultToolbar.prototype.insert=function(e,n,t){var a=this.editor.graph;if(a.canImportCell(e)){var i=mxEvent.getClientX(n),s=mxEvent.getClientY(n);i=mxUtils.convertPoint(a.container,i,s);return a.isSplitEnabled()&&a.isSplitTarget(t,[e],n)?a.splitEdge(t,[e],null,i.x,i.y):this.editor.addVertex(t,e,i.x,i.y)}return null},mxDefaultToolbar.prototype.connect=function(e,n,t){var a=(n=this.editor.graph).getModel();if(null!=t&&n.isCellConnectable(e)&&n.isEdgeValid(null,t,e)){var i=null;a.beginUpdate();try{var s=a.getGeometry(t),o=a.getGeometry(e).clone();o.x=s.x+(s.width-o.width)/2,o.y=s.y+(s.height-o.height)/2;var r=this.spacing*n.gridSize,l=20*a.getDirectedEdgeCount(t,!0);this.editor.horizontalFlow?o.x+=(o.width+s.width)/2+r+l:o.y+=(o.height+s.height)/2+r+l,e.setGeometry(o);var d=a.getParent(t);if(n.addCell(e,d),n.constrainChild(e),i=this.editor.createEdge(t,e),null==a.getGeometry(i)){var c=new mxGeometry;c.relative=!0,a.setGeometry(i,c)}n.addEdge(i,d,t,e)}finally{a.endUpdate()}n.setSelectionCells([e,i]),n.scrollCellToVisible(e)}},mxDefaultToolbar.prototype.installDropHandler=function(n,t){var a=document.createElement("img");a.setAttribute("src",n.getAttribute("src"));var i=mxUtils.bind(this,function(e){a.style.width=2*n.offsetWidth+"px",a.style.height=2*n.offsetHeight+"px",mxUtils.makeDraggable(n,this.editor.graph,t,a),mxEvent.removeListener(a,"load",i)});mxClient.IS_IE?i():mxEvent.addListener(a,"load",i)},mxDefaultToolbar.prototype.destroy=function(){null!=this.resetHandler&&(this.editor.graph.removeListener("dblclick",this.resetHandler),this.editor.removeListener("escape",this.resetHandler),this.resetHandler=null),null!=this.toolbar&&(this.toolbar.destroy(),this.toolbar=null)},mxLoadResources&&mxResources.add(mxClient.basePath+"/resources/editor"),mxEditor.prototype=new mxEventSource,mxEditor.prototype.constructor=mxEditor,mxEditor.prototype.askZoomResource="none"!=mxClient.language?"askZoom":"",mxEditor.prototype.lastSavedResource="none"!=mxClient.language?"lastSaved":"",mxEditor.prototype.currentFileResource="none"!=mxClient.language?"currentFile":"",mxEditor.prototype.propertiesResource="none"!=mxClient.language?"properties":"",mxEditor.prototype.tasksResource="none"!=mxClient.language?"tasks":"",mxEditor.prototype.helpResource="none"!=mxClient.language?"help":"",mxEditor.prototype.outlineResource="none"!=mxClient.language?"outline":"",mxEditor.prototype.outline=null,mxEditor.prototype.graph=null,mxEditor.prototype.graphRenderHint=null,mxEditor.prototype.toolbar=null,mxEditor.prototype.session=null,mxEditor.prototype.status=null,mxEditor.prototype.popupHandler=null,mxEditor.prototype.undoManager=null,mxEditor.prototype.keyHandler=null,mxEditor.prototype.actions=null,mxEditor.prototype.dblClickAction="edit",mxEditor.prototype.swimlaneRequired=!1,mxEditor.prototype.disableContextMenu=!0,mxEditor.prototype.insertFunction=null,mxEditor.prototype.forcedInserting=!1,mxEditor.prototype.templates=null,mxEditor.prototype.defaultEdge=null,mxEditor.prototype.defaultEdgeStyle=null,mxEditor.prototype.defaultGroup=null,mxEditor.prototype.groupBorderSize=null,mxEditor.prototype.filename=null,mxEditor.prototype.linefeed="&#xa;",mxEditor.prototype.postParameterName="xml",mxEditor.prototype.escapePostData=!0,mxEditor.prototype.urlPost=null,mxEditor.prototype.urlImage=null,mxEditor.prototype.urlInit=null,mxEditor.prototype.urlNotify=null,mxEditor.prototype.urlPoll=null,mxEditor.prototype.horizontalFlow=!1,mxEditor.prototype.layoutDiagram=!1,mxEditor.prototype.swimlaneSpacing=0,mxEditor.prototype.maintainSwimlanes=!1,mxEditor.prototype.layoutSwimlanes=!1,mxEditor.prototype.cycleAttributeValues=null,mxEditor.prototype.cycleAttributeIndex=0,mxEditor.prototype.cycleAttributeName="fillColor",mxEditor.prototype.tasks=null,mxEditor.prototype.tasksWindowImage=null,mxEditor.prototype.tasksTop=20,mxEditor.prototype.help=null,mxEditor.prototype.helpWindowImage=null,mxEditor.prototype.urlHelp=null,mxEditor.prototype.helpWidth=300,mxEditor.prototype.helpHeight=260,mxEditor.prototype.propertiesWidth=240,mxEditor.prototype.propertiesHeight=null,mxEditor.prototype.movePropertiesDialog=!1,mxEditor.prototype.validating=!1,mxEditor.prototype.modified=!1,mxEditor.prototype.isModified=function(){return this.modified},mxEditor.prototype.setModified=function(e){this.modified=e},mxEditor.prototype.addActions=function(){this.addAction("save",function(e){e.save()}),this.addAction("print",function(e){new mxPrintPreview(e.graph,1).open()}),this.addAction("show",function(e){mxUtils.show(e.graph,null,10,10)}),this.addAction("exportImage",function(e){var n=e.getUrlImage();if(null==n||mxClient.IS_LOCAL)e.execute("show");else{var t=mxUtils.getViewXml(e.graph,1);t=mxUtils.getXml(t,"\n");mxUtils.submit(n,e.postParameterName+"="+encodeURIComponent(t),document,"_blank")}}),this.addAction("refresh",function(e){e.graph.refresh()}),this.addAction("cut",function(e){e.graph.isEnabled()&&mxClipboard.cut(e.graph)}),this.addAction("copy",function(e){e.graph.isEnabled()&&mxClipboard.copy(e.graph)}),this.addAction("paste",function(e){e.graph.isEnabled()&&mxClipboard.paste(e.graph)}),this.addAction("delete",function(e){e.graph.isEnabled()&&e.graph.removeCells()}),this.addAction("group",function(e){e.graph.isEnabled()&&e.graph.setSelectionCell(e.groupCells())}),this.addAction("ungroup",function(e){e.graph.isEnabled()&&e.graph.setSelectionCells(e.graph.ungroupCells())}),this.addAction("removeFromParent",function(e){e.graph.isEnabled()&&e.graph.removeCellsFromParent()}),this.addAction("undo",function(e){e.graph.isEnabled()&&e.undo()}),this.addAction("redo",function(e){e.graph.isEnabled()&&e.redo()}),this.addAction("zoomIn",function(e){e.graph.zoomIn()}),this.addAction("zoomOut",function(e){e.graph.zoomOut()}),this.addAction("actualSize",function(e){e.graph.zoomActual()}),this.addAction("fit",function(e){e.graph.fit()}),this.addAction("showProperties",function(e,n){e.showProperties(n)}),this.addAction("selectAll",function(e){e.graph.isEnabled()&&e.graph.selectAll()}),this.addAction("selectNone",function(e){e.graph.isEnabled()&&e.graph.clearSelection()}),this.addAction("selectVertices",function(e){e.graph.isEnabled()&&e.graph.selectVertices()}),this.addAction("selectEdges",function(e){e.graph.isEnabled()&&e.graph.selectEdges()}),this.addAction("edit",function(e,n){e.graph.isEnabled()&&e.graph.isCellEditable(n)&&e.graph.startEditingAtCell(n)}),this.addAction("toBack",function(e,n){e.graph.isEnabled()&&e.graph.orderCells(!0)}),this.addAction("toFront",function(e,n){e.graph.isEnabled()&&e.graph.orderCells(!1)}),this.addAction("enterGroup",function(e,n){e.graph.enterGroup(n)}),this.addAction("exitGroup",function(e){e.graph.exitGroup()}),this.addAction("home",function(e){e.graph.home()}),this.addAction("selectPrevious",function(e){e.graph.isEnabled()&&e.graph.selectPreviousCell()}),this.addAction("selectNext",function(e){e.graph.isEnabled()&&e.graph.selectNextCell()}),this.addAction("selectParent",function(e){e.graph.isEnabled()&&e.graph.selectParentCell()}),this.addAction("selectChild",function(e){e.graph.isEnabled()&&e.graph.selectChildCell()}),this.addAction("collapse",function(e){e.graph.isEnabled()&&e.graph.foldCells(!0)}),this.addAction("collapseAll",function(e){if(e.graph.isEnabled()){var n=e.graph.getChildVertices();e.graph.foldCells(!0,!1,n)}}),this.addAction("expand",function(e){e.graph.isEnabled()&&e.graph.foldCells(!1)}),this.addAction("expandAll",function(e){if(e.graph.isEnabled()){var n=e.graph.getChildVertices();e.graph.foldCells(!1,!1,n)}}),this.addAction("bold",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_BOLD)}),this.addAction("italic",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_ITALIC)}),this.addAction("underline",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_UNDERLINE)}),this.addAction("shadow",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_SHADOW)}),this.addAction("alignCellsLeft",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_LEFT)}),this.addAction("alignCellsCenter",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_CENTER)}),this.addAction("alignCellsRight",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_RIGHT)}),this.addAction("alignCellsTop",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_TOP)}),this.addAction("alignCellsMiddle",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_MIDDLE)}),this.addAction("alignCellsBottom",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_BOTTOM)}),this.addAction("alignFontLeft",function(e){e.graph.setCellStyles(mxConstants.STYLE_ALIGN,mxConstants.ALIGN_LEFT)}),this.addAction("alignFontCenter",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_ALIGN,mxConstants.ALIGN_CENTER)}),this.addAction("alignFontRight",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_ALIGN,mxConstants.ALIGN_RIGHT)}),this.addAction("alignFontTop",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_TOP)}),this.addAction("alignFontMiddle",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE)}),this.addAction("alignFontBottom",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_BOTTOM)}),this.addAction("zoom",function(e){var n=100*e.graph.getView().scale;n=parseFloat(mxUtils.prompt(mxResources.get(e.askZoomResource)||e.askZoomResource,n))/100;isNaN(n)||e.graph.getView().setScale(n)}),this.addAction("toggleTasks",function(e){null!=e.tasks?e.tasks.setVisible(!e.tasks.isVisible()):e.showTasks()}),this.addAction("toggleHelp",function(e){null!=e.help?e.help.setVisible(!e.help.isVisible()):e.showHelp()}),this.addAction("toggleOutline",function(e){null==e.outline?e.showOutline():e.outline.setVisible(!e.outline.isVisible())}),this.addAction("toggleConsole",function(e){mxLog.setVisible(!mxLog.isVisible())})},mxEditor.prototype.createSession=function(){var e=mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.SESSION,"session",e))});return this.connect(this.urlInit,this.urlPoll,this.urlNotify,e)},mxEditor.prototype.configure=function(e){null!=e&&(new mxCodec(e.ownerDocument).decode(e,this),this.resetHistory())},mxEditor.prototype.resetFirstTime=function(){document.cookie="mxgraph=seen; expires=Fri, 27 Jul 2001 02:47:11 UTC; path=/"},mxEditor.prototype.resetHistory=function(){this.lastSnapshot=(new Date).getTime(),this.undoManager.clear(),this.ignoredChanges=0,this.setModified(!1)},mxEditor.prototype.addAction=function(e,n){this.actions[e]=n},mxEditor.prototype.execute=function(n,e,t){var a=this.actions[n];if(null!=a)try{var i=arguments;i[0]=this,a.apply(this,i)}catch(e){throw mxUtils.error("Cannot execute "+n+": "+e.message,280,!0),e}else mxUtils.error("Cannot find action "+n,280,!0)},mxEditor.prototype.addTemplate=function(e,n){this.templates[e]=n},mxEditor.prototype.getTemplate=function(e){return this.templates[e]},mxEditor.prototype.createGraph=function(){var e=new mxGraph(null,null,this.graphRenderHint);return e.setTooltips(!0),e.setPanning(!0),this.installDblClickHandler(e),this.installUndoHandler(e),this.installDrillHandler(e),this.installChangeHandler(e),this.installInsertHandler(e),e.panningHandler.factoryMethod=mxUtils.bind(this,function(e,n,t){return this.createPopupMenu(e,n,t)}),e.connectionHandler.factoryMethod=mxUtils.bind(this,function(e,n){return this.createEdge(e,n)}),this.createSwimlaneManager(e),this.createLayoutManager(e),e},mxEditor.prototype.createSwimlaneManager=function(e){return(e=new mxSwimlaneManager(e,!1)).isHorizontal=mxUtils.bind(this,function(){return this.horizontalFlow}),e.isEnabled=mxUtils.bind(this,function(){return this.maintainSwimlanes}),e},mxEditor.prototype.createLayoutManager=function(a){var e=new mxLayoutManager(a),i=this;return e.getLayout=function(e){var n=null,t=i.graph.getModel();return null!=t.getParent(e)&&(i.layoutSwimlanes&&a.isSwimlane(e)?(null==i.swimlaneLayout&&(i.swimlaneLayout=i.createSwimlaneLayout()),n=i.swimlaneLayout):i.layoutDiagram&&(a.isValidRoot(e)||null==t.getParent(t.getParent(e)))&&(null==i.diagramLayout&&(i.diagramLayout=i.createDiagramLayout()),n=i.diagramLayout)),n},e},mxEditor.prototype.setGraphContainer=function(e){null==this.graph.container&&(this.graph.init(e),this.rubberband=new mxRubberband(this.graph),this.disableContextMenu&&mxEvent.disableContextMenu(e),mxClient.IS_QUIRKS&&new mxDivResizer(e))},mxEditor.prototype.installDblClickHandler=function(a){a.addListener(mxEvent.DOUBLE_CLICK,mxUtils.bind(this,function(e,n){var t=n.getProperty("cell");null!=t&&a.isEnabled()&&null!=this.dblClickAction&&(this.execute(this.dblClickAction,t),n.consume())}))},mxEditor.prototype.installUndoHandler=function(a){var e=mxUtils.bind(this,function(e,n){var t=n.getProperty("edit");this.undoManager.undoableEditHappened(t)});a.getModel().addListener(mxEvent.UNDO,e),a.getView().addListener(mxEvent.UNDO,e),e=function(e,n){var t=n.getProperty("edit").changes;a.setSelectionCells(a.getSelectionCellsForChanges(t))},this.undoManager.addListener(mxEvent.UNDO,e),this.undoManager.addListener(mxEvent.REDO,e)},mxEditor.prototype.installDrillHandler=function(e){var n=mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.ROOT))});e.getView().addListener(mxEvent.DOWN,n),e.getView().addListener(mxEvent.UP,n)},mxEditor.prototype.installChangeHandler=function(s){var e=mxUtils.bind(this,function(e,n){this.setModified(!0),1==this.validating&&s.validateGraph();for(var t=n.getProperty("edit").changes,a=0;a<t.length;a++){var i=t[a];if(i instanceof mxRootChange||i instanceof mxValueChange&&i.cell==this.graph.model.root||i instanceof mxCellAttributeChange&&i.cell==this.graph.model.root){this.fireEvent(new mxEventObject(mxEvent.ROOT));break}}});s.getModel().addListener(mxEvent.CHANGE,e)},mxEditor.prototype.installInsertHandler=function(e){var t=this;e.addMouseListener({mouseDown:function(e,n){null==t.insertFunction||n.isPopupTrigger()||!t.forcedInserting&&null!=n.getState()||(t.graph.clearSelection(),t.insertFunction(n.getEvent(),n.getCell()),this.isActive=!0,n.consume())},mouseMove:function(e,n){this.isActive&&n.consume()},mouseUp:function(e,n){this.isActive&&(this.isActive=!1,n.consume())}})},mxEditor.prototype.createDiagramLayout=function(){var e=this.graph.gridSize,n=new mxStackLayout(this.graph,!this.horizontalFlow,this.swimlaneSpacing,2*e,2*e);return n.isVertexIgnored=function(e){return!n.graph.isSwimlane(e)},n},mxEditor.prototype.createSwimlaneLayout=function(){return new mxCompactTreeLayout(this.graph,this.horizontalFlow)},mxEditor.prototype.createToolbar=function(){return new mxDefaultToolbar(null,this)},mxEditor.prototype.setToolbarContainer=function(e){this.toolbar.init(e),mxClient.IS_QUIRKS&&new mxDivResizer(e)},mxEditor.prototype.setStatusContainer=function(e){null==this.status&&(this.status=e,this.addListener(mxEvent.SAVE,mxUtils.bind(this,function(){var e=(new Date).toLocaleString();this.setStatus((mxResources.get(this.lastSavedResource)||this.lastSavedResource)+": "+e)})),this.addListener(mxEvent.OPEN,mxUtils.bind(this,function(){this.setStatus((mxResources.get(this.currentFileResource)||this.currentFileResource)+": "+this.filename)})),mxClient.IS_QUIRKS&&new mxDivResizer(e))},mxEditor.prototype.setStatus=function(e){null!=this.status&&null!=e&&(this.status.innerHTML=e)},mxEditor.prototype.setTitleContainer=function(n){this.addListener(mxEvent.ROOT,mxUtils.bind(this,function(e){n.innerHTML=this.getTitle()})),mxClient.IS_QUIRKS&&new mxDivResizer(n)},mxEditor.prototype.treeLayout=function(e,n){null!=e&&new mxCompactTreeLayout(this.graph,n).execute(e)},mxEditor.prototype.getTitle=function(){for(var e="",n=this.graph,t=n.getCurrentRoot();null!=t&&null!=n.getModel().getParent(n.getModel().getParent(t));)n.isValidRoot(t)&&(e=" > "+n.convertValueToString(t)+e),t=n.getModel().getParent(t);return this.getRootTitle()+e},mxEditor.prototype.getRootTitle=function(){var e=this.graph.getModel().getRoot();return this.graph.convertValueToString(e)},mxEditor.prototype.undo=function(){this.undoManager.undo()},mxEditor.prototype.redo=function(){this.undoManager.redo()},mxEditor.prototype.groupCells=function(){var e=null!=this.groupBorderSize?this.groupBorderSize:this.graph.gridSize;return this.graph.groupCells(this.createGroup(),e)},mxEditor.prototype.createGroup=function(){return this.graph.getModel().cloneCell(this.defaultGroup)},mxEditor.prototype.open=function(e){if(null!=e){var n=mxUtils.load(e).getXml();this.readGraphModel(n.documentElement),this.filename=e,this.fireEvent(new mxEventObject(mxEvent.OPEN,"filename",e))}},mxEditor.prototype.readGraphModel=function(e){new mxCodec(e.ownerDocument).decode(e,this.graph.getModel()),this.resetHistory()},mxEditor.prototype.save=function(e,n){if(null!=(e=e||this.getUrlPost())&&0<e.length){var t=this.writeGraphModel(n);this.postDiagram(e,t),this.setModified(!1)}this.fireEvent(new mxEventObject(mxEvent.SAVE,"url",e))},mxEditor.prototype.postDiagram=function(n,t){this.escapePostData&&(t=encodeURIComponent(t)),mxUtils.post(n,this.postParameterName+"="+t,mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.POST,"request",e,"url",n,"data",t))}))},mxEditor.prototype.writeGraphModel=function(e){e=null!=e?e:this.linefeed;var n=(new mxCodec).encode(this.graph.getModel());return mxUtils.getXml(n,e)},mxEditor.prototype.getUrlPost=function(){return this.urlPost},mxEditor.prototype.getUrlImage=function(){return this.urlImage},mxEditor.prototype.connect=function(e,n,t,a){var i=null;return mxClient.IS_LOCAL||((i=new mxSession(this.graph.getModel(),e,n,t)).addListener(mxEvent.RECEIVE,mxUtils.bind(this,function(e,n){null!=n.getProperty("node").getAttribute("namespace")&&this.resetHistory()})),i.addListener(mxEvent.DISCONNECT,a),i.addListener(mxEvent.CONNECT,a),i.addListener(mxEvent.NOTIFY,a),i.addListener(mxEvent.GET,a),i.start()),i},mxEditor.prototype.swapStyles=function(e,n){var t=this.graph.getStylesheet().styles[n];this.graph.getView().getStylesheet().putCellStyle(n,this.graph.getStylesheet().styles[e]),this.graph.getStylesheet().putCellStyle(e,t),this.graph.refresh()},mxEditor.prototype.showProperties=function(e){if(null==(e=e||this.graph.getSelectionCell())&&(null==(e=this.graph.getCurrentRoot())&&(e=this.graph.getModel().getRoot())),null!=e){this.graph.stopEditing(!0);var n=(t=mxUtils.getOffset(this.graph.container)).x+10,t=t.y;if(null==this.properties||this.movePropertiesDialog){var a=this.graph.getCellBounds(e);null!=a&&(n+=a.x+Math.min(200,a.width),t+=a.y)}else n=this.properties.getX(),t=this.properties.getY();this.hideProperties(),null!=(e=this.createProperties(e))&&(this.properties=new mxWindow(mxResources.get(this.propertiesResource)||this.propertiesResource,e,n,t,this.propertiesWidth,this.propertiesHeight,!1),this.properties.setVisible(!0))}},mxEditor.prototype.isPropertiesVisible=function(){return null!=this.properties},mxEditor.prototype.createProperties=function(t){var a=this.graph.getModel(),e=a.getValue(t);if(mxUtils.isNode(e)){var n=new mxForm("properties");n.addText("ID",t.getId()).setAttribute("readonly","true");var i=null,s=null,o=null,r=null,l=null;a.isVertex(t)&&(null!=(i=a.getGeometry(t))&&(s=n.addText("top",i.y),o=n.addText("left",i.x),r=n.addText("width",i.width),l=n.addText("height",i.height)));var d=a.getStyle(t),c=n.addText("Style",d||""),m=e.attributes,u=[];for(e=0;e<m.length;e++)u[e]=n.addTextarea(m[e].nodeName,m[e].nodeValue,"label"==m[e].nodeName?4:2);return e=mxUtils.bind(this,function(){this.hideProperties(),a.beginUpdate();try{null!=i&&((i=i.clone()).x=parseFloat(o.value),i.y=parseFloat(s.value),i.width=parseFloat(r.value),i.height=parseFloat(l.value),a.setGeometry(t,i)),0<c.value.length?a.setStyle(t,c.value):a.setStyle(t,null);for(var e=0;e<m.length;e++){var n=new mxCellAttributeChange(t,m[e].nodeName,u[e].value);a.execute(n)}this.graph.isAutoSizeCell(t)&&this.graph.updateCellSize(t)}finally{a.endUpdate()}}),d=mxUtils.bind(this,function(){this.hideProperties()}),n.addButtons(e,d),n.table}return null},mxEditor.prototype.hideProperties=function(){null!=this.properties&&(this.properties.destroy(),this.properties=null)},mxEditor.prototype.showTasks=function(){if(null==this.tasks){var n=document.createElement("div");n.style.padding="4px",n.style.paddingLeft="20px";var e=document.body.clientWidth;(e=new mxWindow(mxResources.get(this.tasksResource)||this.tasksResource,n,e-220,this.tasksTop,200)).setClosable(!0),e.destroyOnClose=!1;var t=mxUtils.bind(this,function(e){mxEvent.release(n),n.innerHTML="",this.createTasks(n)});this.graph.getModel().addListener(mxEvent.CHANGE,t),this.graph.getSelectionModel().addListener(mxEvent.CHANGE,t),this.graph.addListener(mxEvent.ROOT,t),null!=this.tasksWindowImage&&e.setImage(this.tasksWindowImage),this.tasks=e,this.createTasks(n)}this.tasks.setVisible(!0)},mxEditor.prototype.refreshTasks=function(e){null!=this.tasks&&(e=this.tasks.content,mxEvent.release(e),e.innerHTML="",this.createTasks(e))},mxEditor.prototype.createTasks=function(e){},mxEditor.prototype.showHelp=function(e){if(null==this.help){var n=document.createElement("iframe");n.setAttribute("src",mxResources.get("urlHelp")||this.urlHelp),n.setAttribute("height","100%"),n.setAttribute("width","100%"),n.setAttribute("frameBorder","0"),n.style.backgroundColor="white",e=document.body.clientWidth;var t=document.body.clientHeight||document.documentElement.clientHeight,a=new mxWindow(mxResources.get(this.helpResource)||this.helpResource,n,(e-this.helpWidth)/2,(t-this.helpHeight)/3,this.helpWidth,this.helpHeight);a.setMaximizable(!0),a.setClosable(!0),a.destroyOnClose=!1,a.setResizable(!0),null!=this.helpWindowImage&&a.setImage(this.helpWindowImage),mxClient.IS_NS&&(e=function(e){n.setAttribute("height",a.div.offsetHeight-26+"px")},a.addListener(mxEvent.RESIZE_END,e),a.addListener(mxEvent.MAXIMIZE,e),a.addListener(mxEvent.NORMALIZE,e),a.addListener(mxEvent.SHOW,e)),this.help=a}this.help.setVisible(!0)},mxEditor.prototype.showOutline=function(){if(null==this.outline){var e=document.createElement("div");e.style.overflow="hidden",e.style.width="100%",e.style.height="100%",e.style.background="white",e.style.cursor="move";var n=new mxWindow(mxResources.get(this.outlineResource)||this.outlineResource,e,600,480,200,200,!1),t=new mxOutline(this.graph,e);n.setClosable(!0),n.setResizable(!0),n.destroyOnClose=!1,n.addListener(mxEvent.RESIZE_END,function(){t.update()}),this.outline=n,this.outline.outline=t}this.outline.setVisible(!0),this.outline.outline.update(!0)},mxEditor.prototype.setMode=function(e){"select"==e?(this.graph.panningHandler.useLeftButtonForPanning=!1,this.graph.setConnectable(!1)):"connect"==e?(this.graph.panningHandler.useLeftButtonForPanning=!1,this.graph.setConnectable(!0)):"pan"==e&&(this.graph.panningHandler.useLeftButtonForPanning=!0,this.graph.setConnectable(!1))},mxEditor.prototype.createPopupMenu=function(e,n,t){this.popupHandler.createMenu(this,e,n,t)},mxEditor.prototype.createEdge=function(e,n){var t=null;if(null!=this.defaultEdge)t=this.graph.getModel().cloneCell(this.defaultEdge);else{(t=new mxCell("")).setEdge(!0);var a=new mxGeometry;a.relative=!0,t.setGeometry(a)}return null!=(a=this.getEdgeStyle())&&t.setStyle(a),t},mxEditor.prototype.getEdgeStyle=function(){return this.defaultEdgeStyle},mxEditor.prototype.consumeCycleAttribute=function(e){return null!=this.cycleAttributeValues&&0<this.cycleAttributeValues.length&&this.graph.isSwimlane(e)?this.cycleAttributeValues[this.cycleAttributeIndex++%this.cycleAttributeValues.length]:null},mxEditor.prototype.cycleAttribute=function(e){if(null!=this.cycleAttributeName){var n=this.consumeCycleAttribute(e);null!=n&&e.setStyle(e.getStyle()+";"+this.cycleAttributeName+"="+n)}},mxEditor.prototype.addVertex=function(e,n,t,a){for(var i=this.graph.getModel();null!=e&&!this.graph.isValidDropTarget(e);)e=i.getParent(e);e=null!=e?e:this.graph.getSwimlaneAt(t,a);var s=this.graph.getView().scale,o=i.getGeometry(n),r=i.getGeometry(e);if(this.graph.isSwimlane(n)&&!this.graph.swimlaneNesting)e=null;else{if(null==e&&this.swimlaneRequired)return null;if(null!=e&&null!=r){var l=this.graph.getView().getState(e);if(null!=l){if(t-=l.origin.x*s,a-=l.origin.y*s,this.graph.isConstrainedMoving){r=o.width;var d=o.height,c=l.x+l.width;c<t+r&&(t-=t+r-c),(c=l.y+l.height)<a+d&&(a-=a+d-c)}}else null!=r&&(t-=r.x*s,a-=r.y*s)}}(o=o.clone()).x=this.graph.snap(t/s-this.graph.getView().translate.x-this.graph.gridSize/2),o.y=this.graph.snap(a/s-this.graph.getView().translate.y-this.graph.gridSize/2),n.setGeometry(o),null==e&&(e=this.graph.getDefaultParent()),this.cycleAttribute(n),this.fireEvent(new mxEventObject(mxEvent.BEFORE_ADD_VERTEX,"vertex",n,"parent",e)),i.beginUpdate();try{null!=(n=this.graph.addCell(n,e))&&(this.graph.constrainChild(n),this.fireEvent(new mxEventObject(mxEvent.ADD_VERTEX,"vertex",n)))}finally{i.endUpdate()}return null!=n&&(this.graph.setSelectionCell(n),this.graph.scrollCellToVisible(n),this.fireEvent(new mxEventObject(mxEvent.AFTER_ADD_VERTEX,"vertex",n))),n},mxEditor.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,null!=this.tasks&&this.tasks.destroy(),null!=this.outline&&this.outline.destroy(),null!=this.properties&&this.properties.destroy(),null!=this.keyHandler&&this.keyHandler.destroy(),null!=this.rubberband&&this.rubberband.destroy(),null!=this.toolbar&&this.toolbar.destroy(),null!=this.graph&&this.graph.destroy(),this.templates=this.status=null)};var mxCodecRegistry={codecs:[],aliases:[],register:function(e){if(null!=e){var n=e.getName();mxCodecRegistry.codecs[n]=e;var t=mxUtils.getFunctionName(e.template.constructor);t!=n&&mxCodecRegistry.addAlias(t,n)}return e},addAlias:function(e,n){mxCodecRegistry.aliases[e]=n},getCodec:function(e){var n=null;if(null!=e){n=mxUtils.getFunctionName(e);var t=mxCodecRegistry.aliases[n];if(null!=t&&(n=t),null==(n=mxCodecRegistry.codecs[n]))try{n=new mxObjectCodec(new e),mxCodecRegistry.register(n)}catch(e){}}return n}};function mxCodec(e){this.document=e||mxUtils.createXmlDocument(),this.objects=[]}function mxObjectCodec(e,n,t,a){for(var i in this.template=e,this.exclude=null!=n?n:[],this.idrefs=null!=t?t:[],this.mapping=null!=a?a:[],this.reverse={},this.mapping)this.reverse[this.mapping[i]]=i}mxCodec.prototype.document=null,mxCodec.prototype.objects=null,mxCodec.prototype.encodeDefaults=!1,mxCodec.prototype.putObject=function(e,n){return this.objects[e]=n},mxCodec.prototype.getObject=function(e){var n=null;return null!=e&&(null==(n=this.objects[e])&&(null==(n=this.lookup(e))&&(null!=(e=this.getElementById(e))&&(n=this.decode(e))))),n},mxCodec.prototype.lookup=function(e){return null},mxCodec.prototype.getElementById=function(e,n){return mxUtils.findNodeByAttribute(this.document.documentElement,null!=n?n:"id",e)},mxCodec.prototype.getId=function(e){var n=null;return null!=e&&(null==(n=this.reference(e))&&e instanceof mxCell&&(null==(n=e.getId())&&(0==(n=mxCellPath.create(e)).length&&(n="root")))),n},mxCodec.prototype.reference=function(e){return null},mxCodec.prototype.encode=function(e){var n=null;if(null!=e&&null!=e.constructor){var t=mxCodecRegistry.getCodec(e.constructor);null!=t?n=t.encode(this,e):mxUtils.isNode(e)?n=mxClient.IS_IE?e.cloneNode(!0):this.document.importNode(e,!0):mxLog.warn("mxCodec.encode: No codec for "+mxUtils.getFunctionName(e.constructor))}return n},mxCodec.prototype.decode=function(a,b){var c=null;if(null!=a&&a.nodeType==mxConstants.NODETYPE_ELEMENT){var d=null;try{d=eval(a.nodeName)}catch(e){}try{var f=mxCodecRegistry.getCodec(d);null!=f?c=f.decode(this,a,b):(c=a.cloneNode(!0),c.removeAttribute("as"))}catch(e){mxLog.debug("Cannot decode "+a.nodeName+": "+e.message)}}return c},mxCodec.prototype.encodeCell=function(e,n,t){if(n.appendChild(this.encode(e)),null==t||t){t=e.getChildCount();for(var a=0;a<t;a++)this.encodeCell(e.getChildAt(a),n)}},mxCodec.prototype.isCellCodec=function(e){return null!=e&&"function"==typeof e.isCellCodec&&e.isCellCodec()},mxCodec.prototype.decodeCell=function(e,n){n=null==n||n;var t=null;if(null!=e&&e.nodeType==mxConstants.NODETYPE_ELEMENT){if(t=mxCodecRegistry.getCodec(e.nodeName),!this.isCellCodec(t))for(var a=e.firstChild;null!=a&&!this.isCellCodec(t);)t=mxCodecRegistry.getCodec(a.nodeName),a=a.nextSibling;this.isCellCodec(t)||(t=mxCodecRegistry.getCodec(mxCell)),t=t.decode(this,e),n&&this.insertIntoGraph(t)}return t},mxCodec.prototype.insertIntoGraph=function(e){var n=e.parent,t=e.getTerminal(!0),a=e.getTerminal(!1);e.setTerminal(null,!1),e.setTerminal(null,!0),(e.parent=null)!=n&&n.insert(e),null!=t&&t.insertEdge(e,!0),null!=a&&a.insertEdge(e,!1)},mxCodec.prototype.setAttribute=function(e,n,t){null!=n&&null!=t&&e.setAttribute(n,t)},mxObjectCodec.prototype.template=null,mxObjectCodec.prototype.exclude=null,mxObjectCodec.prototype.idrefs=null,mxObjectCodec.prototype.mapping=null,mxObjectCodec.prototype.reverse=null,mxObjectCodec.prototype.getName=function(){return mxUtils.getFunctionName(this.template.constructor)},mxObjectCodec.prototype.cloneTemplate=function(){return new this.template.constructor},mxObjectCodec.prototype.getFieldName=function(e){if(null!=e){var n=this.reverse[e];null!=n&&(e=n)}return e},mxObjectCodec.prototype.getAttributeName=function(e){if(null!=e){var n=this.mapping[e];null!=n&&(e=n)}return e},mxObjectCodec.prototype.isExcluded=function(e,n,t,a){return n==mxObjectIdentity.FIELD_NAME||0<=mxUtils.indexOf(this.exclude,n)},mxObjectCodec.prototype.isReference=function(e,n,t,a){return 0<=mxUtils.indexOf(this.idrefs,n)},mxObjectCodec.prototype.encode=function(e,n){var t=e.document.createElement(this.getName());return n=this.beforeEncode(e,n,t),this.encodeObject(e,n,t),this.afterEncode(e,n,t)},mxObjectCodec.prototype.encodeObject=function(e,n,t){for(var a in e.setAttribute(t,"id",e.getId(n)),n){var i=a,s=n[i];null!=s&&!this.isExcluded(n,i,s,!0)&&(mxUtils.isNumeric(i)&&(i=null),this.encodeValue(e,n,i,s,t))}},mxObjectCodec.prototype.encodeValue=function(e,n,t,a,i){if(null!=a){if(this.isReference(n,t,a,!0)){var s=e.getId(a);if(null==s)return void mxLog.warn("mxObjectCodec.encode: No ID for "+this.getName()+"."+t+"="+a);a=s}s=this.template[t],(null==t||e.encodeDefaults||s!=a)&&(t=this.getAttributeName(t),this.writeAttribute(e,n,t,a,i))}},mxObjectCodec.prototype.writeAttribute=function(e,n,t,a,i){"object"!=typeof a?this.writePrimitiveAttribute(e,n,t,a,i):this.writeComplexAttribute(e,n,t,a,i)},mxObjectCodec.prototype.writePrimitiveAttribute=function(e,n,t,a,i){a=this.convertValueToXml(a),null==t?(n=e.document.createElement("add"),"function"==typeof a?n.appendChild(e.document.createTextNode(a)):e.setAttribute(n,"value",a),i.appendChild(n)):"function"!=typeof a&&e.setAttribute(i,t,a)},mxObjectCodec.prototype.writeComplexAttribute=function(e,n,t,a,i){null!=(e=e.encode(a))?(null!=t&&e.setAttribute("as",t),i.appendChild(e)):mxLog.warn("mxObjectCodec.encode: No node for "+this.getName()+"."+t+": "+a)},mxObjectCodec.prototype.convertValueToXml=function(e){return void 0!==e.length||1!=e&&0!=e||(e=1==e?"1":"0"),e},mxObjectCodec.prototype.convertValueFromXml=function(e){return mxUtils.isNumeric(e)&&(e=parseFloat(e)),e},mxObjectCodec.prototype.beforeEncode=function(e,n,t){return n},mxObjectCodec.prototype.afterEncode=function(e,n,t){return t},mxObjectCodec.prototype.decode=function(e,n,t){var a=n.getAttribute("id"),i=e.objects[a];return null==i&&(i=t||this.cloneTemplate(),null!=a&&e.putObject(a,i)),n=this.beforeDecode(e,n,i),this.decodeNode(e,n,i),this.afterDecode(e,n,i)},mxObjectCodec.prototype.decodeNode=function(e,n,t){null!=n&&(this.decodeAttributes(e,n,t),this.decodeChildren(e,n,t))},mxObjectCodec.prototype.decodeAttributes=function(e,n,t){if(null!=(n=n.attributes))for(var a=0;a<n.length;a++)this.decodeAttribute(e,n[a],t)},mxObjectCodec.prototype.decodeAttribute=function(e,n,t){var a=n.nodeName;if("as"!=a&&"id"!=a){n="value"==a?n.nodeValue:this.convertValueFromXml(n.nodeValue);var i=this.getFieldName(a);if(this.isReference(t,i,n,!1)){if(null==(e=e.getObject(n)))return void mxLog.warn("mxObjectCodec.decode: No object for "+this.getName()+"."+a+"="+n);n=e}this.isExcluded(t,a,n,!1)||(t[a]=n)}},mxObjectCodec.prototype.decodeChildren=function(e,n,t){for(n=n.firstChild;null!=n;){var a=n.nextSibling;n.nodeType==mxConstants.NODETYPE_ELEMENT&&!this.processInclude(e,n,t)&&this.decodeChild(e,n,t),n=a}},mxObjectCodec.prototype.decodeChild=function(e,n,t){var a=this.getFieldName(n.getAttribute("as"));if(null==a||!this.isExcluded(t,a,n,!1)){var i=this.getFieldTemplate(t,a,n),s=null;"add"==n.nodeName?null==(s=n.getAttribute("value"))&&(s=mxUtils.eval(mxUtils.getTextContent(n))):s=e.decode(n,i),this.addObjectValue(t,a,s,i)}},mxObjectCodec.prototype.getFieldTemplate=function(e,n,t){return(e=e[n])instanceof Array&&0<e.length&&(e=null),e},mxObjectCodec.prototype.addObjectValue=function(e,n,t,a){null!=t&&t!=a&&(null!=n&&0<n.length?e[n]=t:e.push(t))},mxObjectCodec.prototype.processInclude=function(e,n,t){if("include"!=n.nodeName)return!1;if(null!=(n=n.getAttribute("name")))try{var a=mxUtils.load(n).getDocumentElement();null!=a&&e.decode(a,t)}catch(e){}return!0},mxObjectCodec.prototype.beforeDecode=function(e,n,t){return n},mxObjectCodec.prototype.afterDecode=function(e,n,t){return t},mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxCell,["children","edges","overlays","mxTransient"],["parent","source","target"]);return e.isCellCodec=function(){return!0},e.isExcluded=function(e,n,t,a){return mxObjectCodec.prototype.isExcluded.apply(this,arguments)||a&&"value"==n&&t.nodeType==mxConstants.NODETYPE_ELEMENT},e.afterEncode=function(e,n,t){if(null!=n.value&&n.value.nodeType==mxConstants.NODETYPE_ELEMENT){var a=t;(t=mxClient.IS_IE?n.value.cloneNode(!0):e.document.importNode(n.value,!0)).appendChild(a),e=a.getAttribute("id"),t.setAttribute("id",e),a.removeAttribute("id")}return t},e.beforeDecode=function(e,n,t){var a=n,i=this.getName();if(n.nodeName!=i?(null!=(a=n.getElementsByTagName(i)[0])&&a.parentNode==n?(mxUtils.removeWhitespace(a,!0),mxUtils.removeWhitespace(a,!1),a.parentNode.removeChild(a)):a=null,t.value=n.cloneNode(!0),null!=(n=t.value.getAttribute("id"))&&(t.setId(n),t.value.removeAttribute("id"))):t.setId(n.getAttribute("id")),null!=a)for(n=0;n<this.idrefs.length;n++){i=this.idrefs[n];var s=a.getAttribute(i);if(null!=s){a.removeAttribute(i);var o=e.objects[s]||e.lookup(s);null==o&&(null!=(s=e.getElementById(s))&&(o=(mxCodecRegistry.codecs[s.nodeName]||this).decode(e,s))),t[i]=o}}return a},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxGraphModel);return e.encodeObject=function(e,n,t){var a=e.document.createElement("root");e.encodeCell(n.getRoot(),a),t.appendChild(a)},e.decodeChild=function(e,n,t){"root"==n.nodeName?this.decodeRoot(e,n,t):mxObjectCodec.prototype.decodeChild.apply(this,arguments)},e.decodeRoot=function(e,n,t){var a=null;for(n=n.firstChild;null!=n;){var i=e.decodeCell(n);null!=i&&null==i.getParent()&&(a=i),n=n.nextSibling}null!=a&&t.setRoot(a)},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxRootChange,["model","previous","root"]);return e.afterEncode=function(e,n,t){return e.encodeCell(n.root,t),t},e.beforeDecode=function(e,n,t){if(null!=n.firstChild&&n.firstChild.nodeType==mxConstants.NODETYPE_ELEMENT){var a=(n=n.cloneNode(!0)).firstChild;for(t.root=e.decodeCell(a,!1),t=a.nextSibling,a.parentNode.removeChild(a),a=t;null!=a;)t=a.nextSibling,e.decodeCell(a),a.parentNode.removeChild(a),a=t}return n},e.afterDecode=function(e,n,t){return t.previous=t.root,t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxChildChange,["model","child","previousIndex"],["parent","previous"]);return e.isReference=function(e,n,t,a){return!("child"!=n||null==e.previous&&a)||0<=mxUtils.indexOf(this.idrefs,n)},e.afterEncode=function(e,n,t){return this.isReference(n,"child",n.child,!0)?t.setAttribute("child",e.getId(n.child)):e.encodeCell(n.child,t),t},e.beforeDecode=function(e,n,t){if(null!=n.firstChild&&n.firstChild.nodeType==mxConstants.NODETYPE_ELEMENT){var a=(n=n.cloneNode(!0)).firstChild;for(t.child=e.decodeCell(a,!1),t=a.nextSibling,a.parentNode.removeChild(a),a=t;null!=a;){if(t=a.nextSibling,a.nodeType==mxConstants.NODETYPE_ELEMENT){var i=a.getAttribute("id");null==e.lookup(i)&&e.decodeCell(a)}a.parentNode.removeChild(a),a=t}}else a=n.getAttribute("child"),t.child=e.getObject(a);return n},e.afterDecode=function(e,n,t){return t.child.parent=t.previous,t.previous=t.parent,t.previousIndex=t.index,t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxTerminalChange,["model","previous"],["cell","terminal"]);return e.afterDecode=function(e,n,t){return t.previous=t.terminal,t},e}());var mxGenericChangeCodec=function(e,a){var n=new mxObjectCodec(e,["model","previous"],["cell"]);return n.afterDecode=function(e,n,t){return mxUtils.isNode(t.cell)&&(t.cell=e.decodeCell(t.cell,!1)),t.previous=t[a],t},n};mxCodecRegistry.register(mxGenericChangeCodec(new mxValueChange,"value")),mxCodecRegistry.register(mxGenericChangeCodec(new mxStyleChange,"style")),mxCodecRegistry.register(mxGenericChangeCodec(new mxGeometryChange,"geometry")),mxCodecRegistry.register(mxGenericChangeCodec(new mxCollapseChange,"collapsed")),mxCodecRegistry.register(mxGenericChangeCodec(new mxVisibleChange,"visible")),mxCodecRegistry.register(mxGenericChangeCodec(new mxCellAttributeChange,"value")),mxCodecRegistry.register(new mxObjectCodec(new mxGraph,"graphListeners eventListeners view container cellRenderer editor selection".split(" "))),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxGraphView);return e.encode=function(e,n){return this.encodeCell(e,n,n.graph.getModel().getRoot())},e.encodeCell=function(e,n,t){var a=n.graph.getModel(),i=n.getState(t),s=a.getParent(t);if(null==s||null!=i){var o=a.getChildCount(t),r=n.graph.getCellGeometry(t),l=null;if(s==a.getRoot()?l="layer":null==s?l="graph":a.isEdge(t)?l="edge":0<o&&null!=r?l="group":a.isVertex(t)&&(l="vertex"),null!=l){var d=e.document.createElement(l);if(null!=n.graph.getLabel(t)&&(d.setAttribute("label",n.graph.getLabel(t)),n.graph.isHtmlLabel(t)&&d.setAttribute("html",!0)),null==s){var c=n.getGraphBounds();null!=c&&(d.setAttribute("x",Math.round(c.x)),d.setAttribute("y",Math.round(c.y)),d.setAttribute("width",Math.round(c.width)),d.setAttribute("height",Math.round(c.height))),d.setAttribute("scale",n.scale)}else if(null!=i&&null!=r){for(c in i.style)"function"==typeof(s=i.style[c])&&"object"==typeof s&&(s=mxStyleRegistry.getName(s)),null!=s&&"function"!=typeof s&&"object"!=typeof s&&d.setAttribute(c,s);if(null!=(s=i.absolutePoints)&&0<s.length){for(r=Math.round(s[0].x)+","+Math.round(s[0].y),c=1;c<s.length;c++)r+=" "+Math.round(s[c].x)+","+Math.round(s[c].y);d.setAttribute("points",r)}else d.setAttribute("x",Math.round(i.x)),d.setAttribute("y",Math.round(i.y)),d.setAttribute("width",Math.round(i.width)),d.setAttribute("height",Math.round(i.height));null!=(c=i.absoluteOffset)&&(0!=c.x&&d.setAttribute("dx",Math.round(c.x)),0!=c.y&&d.setAttribute("dy",Math.round(c.y)))}for(c=0;c<o;c++)null!=(i=this.encodeCell(e,n,a.getChildAt(t,c)))&&d.appendChild(i)}}return d},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxStylesheet);return e.encode=function(e,n){var t,a=e.document.createElement(this.getName());for(t in n.styles){var i=n.styles[t],s=e.document.createElement("add");if(null!=t){for(var o in s.setAttribute("as",t),i){var r=this.getStringValue(o,i[o]);if(null!=r){var l=e.document.createElement("add");l.setAttribute("value",r),l.setAttribute("as",o),s.appendChild(l)}}0<s.childNodes.length&&a.appendChild(s)}}return a},e.getStringValue=function(e,n){var t=typeof n;return"function"==t?n=mxStyleRegistry.getName(style[j]):"object"==t&&(n=null),n},e.decode=function(e,n,t){t=t||new this.template.constructor;var a=n.getAttribute("id");for(null!=a&&(e.objects[a]=t),n=n.firstChild;null!=n;){if(!this.processInclude(e,n,t)&&"add"==n.nodeName&&null!=(a=n.getAttribute("as"))){var i=n.getAttribute("extend"),s=null!=i?mxUtils.clone(t.styles[i]):null;for(null==s&&(null!=i&&mxLog.warn("mxStylesheetCodec.decode: stylesheet "+i+" not found to extend"),s={}),i=n.firstChild;null!=i;){if(i.nodeType==mxConstants.NODETYPE_ELEMENT){var o=i.getAttribute("as");if("add"==i.nodeName){var r=mxUtils.getTextContent(i),l=null;null!=r&&0<r.length?l=mxUtils.eval(r):(l=i.getAttribute("value"),mxUtils.isNumeric(l)&&(l=parseFloat(l))),null!=l&&(s[o]=l)}else"remove"==i.nodeName&&delete s[o]}i=i.nextSibling}t.putCellStyle(a,s)}n=n.nextSibling}return t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultKeyHandler);return e.encode=function(e,n){return null},e.decode=function(e,n,t){if(null!=t)for(n=n.firstChild;null!=n;){if(!this.processInclude(e,n,t)&&"add"==n.nodeName){var a=n.getAttribute("as"),i=n.getAttribute("action"),s=n.getAttribute("control");t.bindAction(a,i,s)}n=n.nextSibling}return t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultToolbar);return e.encode=function(e,n){return null},e.decode=function(e,n,t){if(null!=t){var a=t.editor;for(n=n.firstChild;null!=n;){if(n.nodeType==mxConstants.NODETYPE_ELEMENT&&!this.processInclude(e,n,t))if("separator"==n.nodeName)t.addSeparator();else if("br"==n.nodeName)t.toolbar.addBreak();else if("hr"==n.nodeName)t.toolbar.addLine();else if("add"==n.nodeName){var i=n.getAttribute("as"),s=(i=mxResources.get(i)||i,n.getAttribute("icon")),o=n.getAttribute("pressedIcon"),r=n.getAttribute("action"),l=n.getAttribute("mode"),d=n.getAttribute("template"),c="0"!=n.getAttribute("toggle"),m=mxUtils.getTextContent(n),u=null;if(null!=r)u=t.addItem(i,s,r,o);else if(null!=l){var p=mxUtils.eval(m);u=t.addMode(i,s,l,o,p)}else if(null!=d||null!=m&&0<m.length)u=a.templates[d],d=n.getAttribute("style"),null!=u&&null!=d&&(u=u.clone()).setStyle(d),(d=null)!=m&&0<m.length&&(d=mxUtils.eval(m)),u=t.addPrototype(i,s,u,o,d,c);else if(0<(o=mxUtils.getChildNodes(n)).length)if(null==s)for(d=t.addActionCombo(i),i=0;i<o.length;i++)"separator"==(c=o[i]).nodeName?t.addOption(d,"---"):"add"==c.nodeName&&(s=c.getAttribute("as"),c=c.getAttribute("action"),t.addActionOption(d,s,c));else{var g=null,v=t.addPrototype(i,s,function(){if(null==(e=a.templates[g.value]))return mxLog.warn("Template "+e+" not found"),null;var e=e.clone(),n=g.options[g.selectedIndex].cellStyle;return null!=n&&e.setStyle(n),e},null,null,c);g=t.addCombo();for(mxEvent.addListener(g,"change",function(){t.toolbar.selectMode(v,function(e){return e=mxUtils.convertPoint(a.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),a.addVertex(null,p(),e.x,e.y)}),t.toolbar.noReset=!1}),i=0;i<o.length;i++)"separator"==(c=o[i]).nodeName?t.addOption(g,"---"):"add"==c.nodeName&&(s=c.getAttribute("as"),m=c.getAttribute("template"),t.addOption(g,s,m||d).cellStyle=c.getAttribute("style"))}null!=u&&(null!=(d=n.getAttribute("id"))&&0<d.length&&u.setAttribute("id",d))}n=n.nextSibling}}return t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultPopupMenu);return e.encode=function(e,n){return null},e.decode=function(e,n,t){var a=n.getElementsByTagName("include")[0];return null!=a?this.processInclude(e,a,t):null!=t&&(t.config=n),t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxEditor,"modified lastSnapshot ignoredChanges undoManager graphContainer toolbarContainer".split(" "));return e.afterDecode=function(e,n,t){return null!=(e=n.getAttribute("defaultEdge"))&&(n.removeAttribute("defaultEdge"),t.defaultEdge=t.templates[e]),null!=(e=n.getAttribute("defaultGroup"))&&(n.removeAttribute("defaultGroup"),t.defaultGroup=t.templates[e]),t},e.decodeChild=function(e,n,t){if("Array"==n.nodeName){if("templates"==n.getAttribute("as"))return void this.decodeTemplates(e,n,t)}else if("ui"==n.nodeName)return void this.decodeUi(e,n,t);mxObjectCodec.prototype.decodeChild.apply(this,arguments)},e.decodeUi=function(e,n,t){for(e=n.firstChild;null!=e;){if("add"==e.nodeName){n=e.getAttribute("as");var a=e.getAttribute("element"),i=e.getAttribute("style"),s=null;if(null!=a)null!=(s=document.getElementById(a))&&null!=i&&(s.style.cssText+=";"+i);else{a=parseInt(e.getAttribute("x"));var o=parseInt(e.getAttribute("y")),r=e.getAttribute("width"),l=e.getAttribute("height");(s=document.createElement("div")).style.cssText=i,new mxWindow(mxResources.get(n)||n,s,a,o,r,l,!1,!0).setVisible(!0)}"graph"==n?t.setGraphContainer(s):"toolbar"==n?t.setToolbarContainer(s):"title"==n?t.setTitleContainer(s):"status"==n?t.setStatusContainer(s):"map"==n&&t.setMapContainer(s)}else"resource"==e.nodeName?mxResources.add(e.getAttribute("basename")):"stylesheet"==e.nodeName&&mxClient.link("stylesheet",e.getAttribute("name"));e=e.nextSibling}},e.decodeTemplates=function(e,n,t){null==t.templates&&(t.templates=[]),n=mxUtils.getChildNodes(n);for(var a=0;a<n.length;a++){for(var i=n[a].getAttribute("as"),s=n[a].firstChild;null!=s&&1!=s.nodeType;)s=s.nextSibling;null!=s&&(t.templates[i]=e.decodeCell(s))}},e}()),EditorUi=function(e,n,t){this.projectDesignController=e,this.editor=n||new Editor,this.container=t||document.body;var a=n.graph,i=this;CRUD_PERMISSIONS=this.projectDesignController.crudPermissions;var s=mxUtils.bind(this,function(e){return null==e&&(e=window.event),!!this.isEditingEnabled()&&a.isEditing()});this.container.style.overflow="hidden",(new Image).src=mxPopupMenu.prototype.submenuImage,null!=mxConnectionHandler.prototype.connectImage&&((new Image).src=mxConnectionHandler.prototype.connectImage.src),this.actions=new Actions(this),this.menus=new Menus(this),this.createDivs(),this.refresh(),this.createUi(),this.container==document.body&&(this.menubarContainer.onselectstart=s,this.menubarContainer.onmousedown=s,this.toolbarContainer.onselectstart=s,this.toolbarContainer.onmousedown=s,this.diagramContainer.onselectstart=s,this.diagramContainer.onmousedown=s,this.sidebarContainer.onselectstart=s,this.sidebarContainer.onmousedown=s,this.footerContainer.onselectstart=s,this.footerContainer.onmousedown=s),mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?(mxEvent.addListener(this.diagramContainer,"contextmenu",s),mxEvent.addListener(this.sidebarContainer,"contextmenu",s)):(this.diagramContainer.oncontextmenu=s,this.sidebarContainer.oncontextmenu=s),a.init(this.diagramContainer),a.refresh(),a.setEnabled(this.isEditingEnabled()),a.container.setAttribute("tabindex","0"),a.container.style.cursor="default",a.container.style.backgroundImage="url("+n.gridImage+")",a.container.style.backgroundPosition="-1px -1px",a.container.focus();var o=a.fireMouseEvent;a.fireMouseEvent=function(e,n,t){e==mxEvent.MOUSE_DOWN&&this.container.focus(),o.apply(this,arguments)},this.createMultiplicities(a.multiplicities,["start","finally","end"],[[1,1],[1,1],[0,0]],[[0,0],[0,0],[1,"n"]]),this.createMultiplicities(a.multiplicities,["answer","hangup","dial","ext_dial","queue","voicemail","callback"],[[1,1],[0,0],[0,1],[0,1],[0,1],[1,1],[0,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["login","pause","unpause","logout"],[[1,2],[1,2],[1,2],[1,2]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["set","math"],[[1,1],[1,1]],[[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["background","playback","menu","saydigits","saynumber","sayphonetic","google_cloud_tts","tts","ispeechtts","awspolly","getdigits","getsecretdigits","lumenvoxtts","sestektts","mrcpsynth"],[[1,"n"],[1,1],[1,"n"],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,"n"],[1,"n"],[1,1],[1,1],[1,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["record"],[[1,1]],[[1,"n"]]),this.createMultiplicities(a.multiplicities,["database","ispeechasr","sendSMS","sendMail","sendFax","googleasr","lumenvoxasr","tildeasr","dialogflow","dialogflowV2","awslex","sesteknda","sestekasr","restapi","mrcprecog"],[[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["gotoc","gotoif","gotoiftime","vswitch"],[[0,0],[1,2],[1,2],[1,"n"]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["queuelog","goal"],[[1,1],[1,1]],[[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["noop","system","agi","subproject","custom_app"],[[1,1],[1,1],[0,1],[0,1],[0,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),a.dblClick=function(e,t){var n=new mxEventObject(mxEvent.DOUBLE_CLICK,"event",e,"cell",t);this.fireEvent(n),mxEvent.isConsumed(e)||n.isConsumed()||(this.getModel().isEdge(t)?0<=["background","gotoif","gotoiftime","menu","getdigits","getsecretdigits","vswitch","login","pause","unpause","logout"].indexOf(t.source.value.tagName)&&this.startEditingAtCell(t):this.getModel().isVertex(t)&&i.projectDesignController.openDialog(t.getValue(),function(e){for(var n=0;n<e.length;n+=1)t.setAttribute(e[n].name,e[n].value);a.refresh(t)}),n.consume())},a.panningHandler.autoExpand=!0,a.panningHandler.factoryMethod=mxUtils.bind(this,function(e,n,t){this.isEditingEnabled()&&this.menus.createPopupMenu(e,n,t)}),n.outline.init(this.outlineContainer),mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){a.panningHandler.hideMenu()})),mxClient.IS_TOUCH&&(mxEvent.addListener(a.container,"gesturechange",mxUtils.bind(this,function(e){a.view.getDrawPane().setAttribute("transform","scale("+e.scale+")"),a.view.getOverlayPane().style.visibility="hidden"})),mxEvent.addListener(a.container,"gestureend",mxUtils.bind(this,function(e){a.view.getDrawPane().removeAttribute("transform"),a.zoomToCenter=!0,a.zoom(e.scale),a.view.getOverlayPane().style.visibility="visible"})));var r=this.isEditingEnabled()?this.createKeyHandler(n):null;this.getKeyHandler=function(){return r},mxEvent.addListener(window,"resize",mxUtils.bind(this,function(){this.refresh(),a.sizeDidChange(),this.editor.outline.update(!1),this.editor.outline.outline.sizeDidChange()})),this.init(),this.open(),this.refresh()},EditorUi.prototype.splitSize=mxClient.IS_TOUCH?16:8,EditorUi.prototype.menubarHeight=33,EditorUi.prototype.toolbarHeight=36,EditorUi.prototype.footerHeight=0,EditorUi.prototype.hsplitPosition=204,EditorUi.prototype.vsplitPosition=190,EditorUi.prototype.init=function(){this.addUndoListener(),this.addSelectionListener();var e=this.actions.get("paste"),n=function(){e.setEnabled(!mxClipboard.isEmpty())},t=mxClipboard.cut;mxClipboard.cut=function(){t.apply(this,arguments),n()};var a=mxClipboard.copy;mxClipboard.copy=function(){a.apply(this,arguments),n()}},EditorUi.prototype.isEditingEnabled=function(){return!!CRUD_PERMISSIONS.canEdit},EditorUi.prototype.exportXML=function(e){var n=window.document.createElement("a");n.href="data:attachment/text;charset=utf-8,"+encodeURIComponent(e),n.download=this.editor.filename+".xml",n.target="_self",n.click()},EditorUi.prototype.open=function(){try{null!=window.opener&&null!=window.opener.openFile&&window.opener.openFile.setConsumer(mxUtils.bind(this,function(e,n){try{var t=mxUtils.parseXml(e);this.editor.setGraphXml(t.documentElement),this.editor.modified=!1,this.editor.undoManager.clear(),null!=n&&(this.editor.filename=n)}catch(e){mxUtils.alert(mxResources.get("invalidOrMissingFile")+": "+e.message)}}))}catch(e){}},EditorUi.prototype.openString=function(e,n,t){try{var a=mxUtils.parseXml(e);this.editor.setGraphXml(a.documentElement),this.editor.modified=!1,this.editor.undoManager.clear(),null!=n&&(this.editor.filename=n),null!=t&&(this.editor.data=t)}catch(e){mxUtils.alert(mxResources.get("invalidOrMissingFile")+": "+e.message)}},EditorUi.prototype.validate=function(e,n){for(var t=this.editor.graph,a=(e=null!=e?e:t.model.getRoot(),n=null!=n?n:{},!0),i=t.model.getChildCount(e),s=0;s<i;s++){var o=t.model.getChildAt(e,s),r=n;t.isValidRoot(o)&&(r={}),null!=(r=this.validate(o,r))?t.setCellWarning(o,r.replace(/\n/g,"<br>")):t.setCellWarning(o,null),a=a&&null==r}if(i="",t.model.isVertex(e))switch(e.value.nodeName){case"start":i=this.validateBlock("start")?"":"Only one Start block is allowed\n";break;case"finally":i=this.validateBlock("finally")?"":"Only one Finally block is allowed\n";break;case"playback":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n";break;case"answer":i=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"menu":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n",i+=0<e.value.getAttribute("digit")?"":mxResources.get("wrongMaxDigit")+"\n",i+=0<=e.value.getAttribute("response")?"":mxResources.get("invalidTimeout")+"\n",i+=0<=e.value.getAttribute("retry")?"":mxResources.get("invalidRetry")+"\n";break;case"getdigits":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n",i+=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n",i+=0<e.value.getAttribute("mindigit")?"":mxResources.get("wrongMinDigit")+"\n",i+=0<e.value.getAttribute("maxdigit")?"":mxResources.get("wrongMaxDigit")+"\n",i+=0<=e.value.getAttribute("retry")?"":mxResources.get("invalidRetry")+"\n";break;case"getsecretdigits":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n",i+=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n",i+=0<e.value.getAttribute("mindigit")?"":mxResources.get("wrongMinDigit")+"\n",i+=0<e.value.getAttribute("maxdigit")?"":mxResources.get("wrongMaxDigit")+"\n",i+=0<=e.value.getAttribute("hiddendigitsnum")?"":mxResources.get("wrongHiddenDigitsnum")+"\n",i+=0<=e.value.getAttribute("retry")?"":mxResources.get("invalidRetry")+"\n";break;case"vswitch":i=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n";break;case"database":i=0<e.value.getAttribute("odbc_id")?"":mxResources.get("noDatabaseSelected")+"\n",i+=""!==e.value.getAttribute("query")?"":mxResources.get("missingQuery")+"\n";break;case"set":case"math":i=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n";break;case"gotoc":i=""!==e.value.getAttribute("context")?"":mxResources.get("noContextSelected")+"\n",i+=""!==e.value.getAttribute("extension")?"":mxResources.get("noExtensionSelected")+"\n",i+=1<=e.value.getAttribute("priority")?"":mxResources.get("invalidPriority")+"\n";break;case"system":case"agi":i=""!==e.value.getAttribute("command")?"":mxResources.get("noCommandSelected")+"\n";break;case"gotoif":i=""!==e.value.getAttribute("condition")?"":mxResources.get("noConditionSelected")+"\n";break;case"saydigits":i=""!==e.value.getAttribute("digits")?"":mxResources.get("noDigitsSelected")+"\n";break;case"saynumber":i=""!==e.value.getAttribute("number")?"":mxResources.get("noNumberSelected")+"\n";break;case"sayphonetic":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"record":i=""!==e.value.getAttribute("file")?"":mxResources.get("noFileSelected")+"\n",i+=-1<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"goal":i=""!==e.value.getAttribute("goalname")?"":mxResources.get("noGoalSelected")+"\n";break;case"ext_dial":i="-1"!==e.value.getAttribute("trunk_name")?"":mxResources.get("noTrunkSelected")+"\n",i+=""!==e.value.getAttribute("phone")?"":mxResources.get("noIdentifierSelected")+"\n",i+=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"dial":i=0<e.value.getAttribute("sip_id")?"":mxResources.get("noIdentifierSelected")+"\n",i+=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"queue":i="-1"!==e.value.getAttribute("queue_id")?"":mxResources.get("noQueueSelected")+"\n",i+=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"callback":i="-1"!==e.value.getAttribute("list_id")?"":mxResources.get("noListSelected")+"\n",i+=""!==e.value.getAttribute("name")?"":mxResources.get("noFirstNameSelected")+"\n",i+=""!==e.value.getAttribute("phone")?"":mxResources.get("noPhoneSelected")+"\n",i+=""!==e.value.getAttribute("delay")?"":mxResources.get("invalidDelay")+"\n";break;case"gotoiftime":i=0<e.value.getAttribute("interval_id")?"":mxResources.get("noIntervalSelected")+"\n";break;case"voicemail":i=""!==e.value.getAttribute("mailbox")?"":mxResources.get("noBoxNumberSelected")+"\n";break;case"subproject":i=0<e.value.getAttribute("project_id")?"":mxResources.get("noProjectSelected")+"\n";break;case"sendSMS":i=0<e.value.getAttribute("sms_account_id")?"":mxResources.get("noAccountSelected")+"\n",i+=""!==e.value.getAttribute("to")?"":mxResources.get("noRecipientSelected")+"\n",i+=""!==e.value.getAttribute("sms_text")?"":mxResources.get("noTextSelected")+"\n";break;case"sendMail":i=0<e.value.getAttribute("account_id")?"":mxResources.get("noAccountSelected")+"\n",i+=""!==e.value.getAttribute("to")?"":mxResources.get("noRecipientSelected")+"\n";break;case"sendFax":i=0<e.value.getAttribute("account_id")?"":mxResources.get("noAccountSelected")+"\n",i+=""!==e.value.getAttribute("to")?"":mxResources.get("noRecipientSelected")+"\n",i+=""!==e.value.getAttribute("attachment_path")?"":mxResources.get("noAttachmentSelected")+"\n";break;case"google_cloud_tts":i=""!==e.value.getAttribute("apiKey")?"":mxResources.get("noApiKeySelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"tts":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"awspolly":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("aws_access_key_id")?"":mxResources.get("noAccessKeySelected")+"\n",i+=""!==e.value.getAttribute("aws_secret_access_key")?"":mxResources.get("noSecretAccessKeySelected")+"\n";break;case"awslex":i=""!==e.value.getAttribute("aws_bot_name")?"":mxResources.get("noNameSelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("aws_access_key_id")?"":mxResources.get("noAccessKeySelected")+"\n",i+=""!==e.value.getAttribute("aws_secret_access_key")?"":mxResources.get("noSecretAccessKeySelected")+"\n";break;case"ispeechtts":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("key")?"":mxResources.get("noKeySelected")+"\n",i+=-10<=e.value.getAttribute("speed")&&e.value.getAttribute("speed")<=10?"":mxResources.get("invalidSpeed")+"\n";break;case"lumenvoxtts":case"sestektts":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"lumenvoxasr":case"sestekasr":i=""!==e.value.getAttribute("grammar")?"":mxResources.get("noGrammarSelected")+"\n";break;case"ispeechasr":case"googleasr":i=""!==e.value.getAttribute("key")?"":mxResources.get("noKeySelected")+"\n",i+=-1<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"tildeasr":i=""!==e.value.getAttribute("appid")?"":mxResources.get("noAppIdInserted")+"\n",i+=""!==e.value.getAttribute("appsecret")?"":mxResources.get("noAppSecretInserted")+"\n",i+=""!==e.value.getAttribute("uri")?"":mxResources.get("noUrlInserted")+"\n";break;case"custom_app":i=""!==e.value.getAttribute("application")?"":mxResources.get("noApplicationSelected")+"\n";break;case"login":case"pause":case"unpause":case"logout":i=""!==e.value.getAttribute("findBy")?"":mxResources.get("noFindBySelected")+"\n";break;case"sesteknda":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("ndauth_url")?"":mxResources.get("noUrlInserted")+"\n",i+=""!==e.value.getAttribute("ndassistant_url")?"":mxResources.get("noUrlInserted")+"\n",i+=""!==e.value.getAttribute("username")?"":mxResources.get("noUsernameSelected")+"\n",i+=""!==e.value.getAttribute("password")?"":mxResources.get("noPasswordSelected")+"\n";break;case"restapi":i=""!==e.value.getAttribute("url")?"":mxResources.get("noUrlSelected")+"\n",i+=""!==e.value.getAttribute("method")?"":mxResources.get("noMethodSelected")+"\n";case"mrcpsynth":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"mrcprecog":i=""!==e.value.getAttribute("grammar")?"":mxResources.get("noGrammarSelected")+"\n";break;case"dialogflow":i=""!==e.value.getAttribute("key")?"":mxResources.get("noKeySelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("dialogflow_language")?"":mxResources.get("noDialogflowLanguageSelected")+"\n";break;case"dialogflowV2":i=""!==e.value.getAttribute("dialogflowV2_project_id")?"":mxResources.get("noDialogflowProjectSelected")+"\n",i+=""!==e.value.getAttribute("client_email")?"":mxResources.get("noClientEmailSelected")+"\n",i+=""!==e.value.getAttribute("private_key")?"":mxResources.get("noPrivateKeySelected")+"\n",i+=""!==e.value.getAttribute("dialogflowV2_language")?"":mxResources.get("noDialogflowLanguageSelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n"}if(t.model.isEdge(e))switch(t.model.getCell(e.source.getId()).value.nodeName){case"background":case"menu":if(void 0!==e.getValue()){var l=/^[0-9]+$|^[-]{1}$|^[i]{1}$|^[t]{1}$|^[*]{1}$|^[#]{1}$/;String(e.getValue()).split(",").forEach(function(e){i+=l.test(e)?"":mxResources.get("numberOrAll")+"\n"})}else i=i+mxResources.get("numberOrAll")+"\n";break;case"getsecretdigits":case"getdigits":if(void 0!==e.getValue())i+=(l=/^(x|i|-)$/).test(String(e.getValue()))?"":mxResources.get("numberOrInvalidOrDefault")+"\n";else i=i+mxResources.get("numberOrInvalidOrDefault")+"\n";break;case"gotoif":case"gotoiftime":if(void 0!==e.getValue())i+=(l=/^(true){1}$|^(false){1}$/).test(String(e.getValue()))?"":mxResources.get("trueOrFalse")+"\n";else i=i+mxResources.get("trueOrFalse")+"\n";break;case"login":case"pause":case"unpause":case"logout":if(void 0!==e.getValue())i+=(l=/^(success){1}$|^(failure){1}$/).test(String(e.getValue()))?"":mxResources.get("successOrFailure")+"\n";else i=i+mxResources.get("successOrFailure")+"\n"}return t.isCellCollapsed(e)&&!a&&(i+=(mxResources.get(t.containsValidationErrorsResource)||t.containsValidationErrorsResource)+"\n"),i=t.model.isEdge(e)?i+(t.getEdgeValidationError(e,t.model.getTerminal(e,!0),t.model.getTerminal(e,!1))||""):i+(t.getCellValidationError(e)||""),null!=(s=t.validateCell(e,n))&&(i+=s),null==t.model.getParent(e)&&t.view.validate(),0<i.length||!a?i:null},EditorUi.prototype.validateBlock=function(n){var t=this.editor.graph,e=t.getDefaultParent(),a=0;return e.children.forEach(function(e){t.model.isVertex(e)&&e.value.nodeName==n&&a++}),!(1<a)},EditorUi.prototype.getUrl=function(e){var n=null!=e?e:window.location.pathname,t=0<n.indexOf("?")?1:0;for(var a in urlParams)n+=0==t?"?":"&",n+=a+"="+urlParams[a],t++;return n},EditorUi.prototype.addUndoListener=function(){var e=this.actions.get("undo"),n=this.actions.get("redo"),t=this.editor.undoManager,a=function(){e.setEnabled(t.canUndo()),n.setEnabled(t.canRedo())};t.addListener(mxEvent.ADD,a),t.addListener(mxEvent.UNDO,a),t.addListener(mxEvent.REDO,a),t.addListener(mxEvent.CLEAR,a),a()},EditorUi.prototype.addSelectionListener=function(){var e=mxUtils.bind(this,function(){var e=this.editor.graph,n=!e.isSelectionEmpty(),t=!1,a=!1,i=e.getSelectionCells();if(null!=i)for(var s=0;s<i.length;s++){var o=i[s];if(e.getModel().isEdge(o)&&(a=!0),e.getModel().isVertex(o)&&(t=!0),a&&t)break}var r=["cut","copy","delete","duplicate","bold","italic","style","underline","toFront","toBack","dashed","rounded","shadow","tilt","autosize"];for(s=0;s<r.length;s++)this.actions.get(r[s]).setEnabled(n);this.actions.get("curved").setEnabled(a),this.actions.get("rotation").setEnabled(t),this.actions.get("wordWrap").setEnabled(t),this.actions.get("group").setEnabled(1<e.getSelectionCount()),this.actions.get("ungroup").setEnabled(1==e.getSelectionCount()&&0<e.getModel().getChildCount(e.getSelectionCell()));var l=t&&1==e.getSelectionCount();this.actions.get("removeFromGroup").setEnabled(l&&e.getModel().isVertex(e.getModel().getParent(e.getSelectionCell())));var d=["fontFamily","fontSize","alignment","position","text","format","arrange","linewidth","spacing"];for(s=0;s<d.length;s++)this.menus.get(d[s]).setEnabled(n);d=["line","lineend","linestart"];for(s=0;s<d.length;s++)this.menus.get(d[s]).setEnabled(a);this.actions.get("setAsDefaultEdge").setEnabled(a),this.menus.get("align").setEnabled(1<e.getSelectionCount()),this.menus.get("direction").setEnabled(t||a&&e.isLoop(e.view.getState(e.getSelectionCell()))),this.menus.get("navigation").setEnabled(e.foldingEnabled&&(null!=e.view.currentRoot||1==e.getSelectionCount()&&e.isValidRoot(e.getSelectionCell()))),this.actions.get("home").setEnabled(null!=e.view.currentRoot),this.actions.get("exitGroup").setEnabled(null!=e.view.currentRoot);var c=1==e.getSelectionCount()&&e.isValidRoot(e.getSelectionCell());this.actions.get("enterGroup").setEnabled(c),this.actions.get("expand").setEnabled(c),this.actions.get("collapse").setEnabled(c),this.actions.get("editLink").setEnabled(1==e.getSelectionCount()),this.actions.get("openLink").setEnabled(1==e.getSelectionCount()&&null!=e.getLinkForCell(e.getSelectionCell()))});this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,e),e()},EditorUi.prototype.refresh=function(){var e=mxClient.IS_IE&&(null==document.documentMode||5==document.documentMode),n=this.container.clientWidth+390,t=this.container.clientHeight+190;this.container==document.body&&(n=document.body.clientWidth||document.documentElement.clientWidth,t=e&&document.body.clientHeight||document.documentElement.clientHeight);var a=Math.max(0,Math.min(this.hsplitPosition,n-this.splitSize-20)),i=Math.max(0,Math.min(this.vsplitPosition,t-this.menubarHeight-this.toolbarHeight-this.splitSize-1));this.menubarContainer.style.height=this.menubarHeight+"px",this.toolbarContainer.style.top=this.menubarHeight+"px",this.toolbarContainer.style.height=this.toolbarHeight+"px";var s=this.menubarHeight+this.toolbarHeight;if(mxClient.IS_QUIRKS||(s+=1),this.sidebarContainer.style.top=s+"px",this.sidebarContainer.style.width=a+"px",this.outlineContainer.style.width=a+"px",this.outlineContainer.style.height=i+"px",this.diagramContainer.style.left=this.isEditingEnabled()?a+this.splitSize+"px":"0px",this.diagramContainer.style.top=this.sidebarContainer.style.top,this.hsplit.style.top=this.sidebarContainer.style.top,this.hsplit.style.bottom=this.outlineContainer.style.bottom,this.hsplit.style.left=a+"px",this.vsplit.style.width=this.sidebarContainer.style.width,this.vsplit.style.bottom=i+this.footerHeight+"px",e){this.menubarContainer.style.width=n+"px",this.toolbarContainer.style.width=this.menubarContainer.style.width;var o=t-i-this.splitSize-this.menubarHeight-this.toolbarHeight;this.sidebarContainer.style.height=o+"px",this.diagramContainer.style.width=n-a-this.splitSize+"px";var r=t-this.menubarHeight-this.toolbarHeight;this.diagramContainer.style.height=r+"px",this.hsplit.style.height=r+"px"}else this.sidebarContainer.style.bottom=i+this.splitSize+"px",this.diagramContainer.style.bottom=this.outlineContainer.style.bottom},EditorUi.prototype.createDivs=function(){this.menubarContainer=this.createDiv("geMenubarContainer"),this.toolbarContainer=this.createDiv("geToolbarContainer"),this.sidebarContainer=this.createDiv("geSidebarContainer"),this.outlineContainer=this.createDiv("geOutlineContainer"),this.diagramContainer=this.createDiv("geDiagramContainer"),this.footerContainer=this.createDiv("geFooterContainer"),this.hsplit=this.createDiv("geHsplit"),this.vsplit=this.createDiv("geVsplit"),this.menubarContainer.style.top="0px",this.menubarContainer.style.left="0px",this.menubarContainer.style.right="0px",this.toolbarContainer.style.left="0px",this.toolbarContainer.style.right="0px",this.sidebarContainer.style.left="0px",this.outlineContainer.style.bottom="0px",this.outlineContainer.style.left="0px",this.diagramContainer.style.overflow="scroll",this.diagramContainer.style.right="0px",this.footerContainer.style.left="0px",this.footerContainer.style.right="0px",this.footerContainer.style.bottom="0px",this.vsplit.style.left="0px",this.vsplit.style.height=this.splitSize+"px",this.hsplit.style.width=this.splitSize+"px"},EditorUi.prototype.createUi=function(){this.menubar=this.menus.createMenubar(this.createDiv("geMenubar")),this.menubarContainer.appendChild(this.menubar.container),this.toolbar=this.createToolbar(this.createDiv("geToolbar")),this.toolbarContainer.appendChild(this.toolbar.container),this.sidebar=this.createSidebar(this.sidebarContainer),this.footerContainer.appendChild(this.createFooter()),this.statusContainer=this.createStatusContainer(),this.editor.addListener("statusChanged",mxUtils.bind(this,function(){this.setStatusText(this.editor.getStatus())})),this.setStatusText(this.editor.getStatus()),this.menubar.container.appendChild(this.statusContainer),this.isEditingEnabled()&&(this.container.appendChild(this.sidebarContainer),this.container.appendChild(this.hsplit),this.container.appendChild(this.vsplit)),this.container.appendChild(this.diagramContainer),this.container.appendChild(this.menubarContainer),this.container.appendChild(this.toolbarContainer),this.container.appendChild(this.outlineContainer),this.container.appendChild(this.footerContainer),this.addSplitHandler(this.hsplit,!0,0,mxUtils.bind(this,function(e){this.hsplitPosition=e,this.refresh(),this.editor.graph.sizeDidChange(),this.editor.outline.update(!1),this.editor.outline.outline.sizeDidChange()})),this.addSplitHandler(this.vsplit,!1,this.footerHeight,mxUtils.bind(this,function(e){this.vsplitPosition=e,this.refresh(),this.editor.outline.update(!1),this.editor.outline.outline.sizeDidChange()}))},EditorUi.prototype.createStatusContainer=function(){var e=document.createElement("a");return e.className="geItem geStatus",e},EditorUi.prototype.createStatusContainer=function(){var e=document.createElement("a");return e.className="geItem geStatus",e},EditorUi.prototype.setStatusText=function(e){this.statusContainer.innerHTML=e},EditorUi.prototype.createToolbar=function(e){return new Toolbar(this,e)},EditorUi.prototype.createSidebar=function(e){return new Sidebar(this,e)},EditorUi.prototype.createFooter=function(){return this.createDiv("geFooter")},EditorUi.prototype.createDiv=function(e){var n=document.createElement("div");return n.className=e,n},EditorUi.prototype.createHeader=function(e){return document.createElement(e)},EditorUi.prototype.createForm=function(e){var n=document.createElement("form");return n.className=e,n},EditorUi.prototype.addSplitHandler=function(n,t,a,i){var s=null,o=null;function r(e){if(null!=s){var n=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e));i(Math.max(0,o+(t?n.x-s.x:s.y-n.y)-a)),mxEvent.consume(e)}}function e(e){r(e),o=s=null}mxEvent.addGestureListeners(n,function(e){s=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e)),o=parseInt(t?n.style.left:n.style.bottom),mxEvent.consume(e)}),mxEvent.addListener(document,"mousemove",r),mxEvent.addListener(document,"touchmove",r),mxEvent.addListener(document,"mouseup",e),mxEvent.addListener(document,"touchend",e)},EditorUi.prototype.executeLayout=function(e,n,t){var a=this.editor.graph,i=a.getSelectionCell();n=null!=this.animate?this.animate:n,a.getModel().beginUpdate();try{e.execute(a.getDefaultParent(),i)}catch(e){throw e}finally{if(n&&navigator.userAgent.indexOf("Camino")<0){var s=new mxMorphing(a);s.addListener(mxEvent.DONE,mxUtils.bind(this,function(){a.getModel().endUpdate()})),s.startAnimation()}else a.getModel().endUpdate()}},EditorUi.prototype.createKeyHandler=function(e){var a=this.editor.graph,o=new mxKeyHandler(a);function n(e){if(!a.isSelectionEmpty()){var n=0,t=0;37==e?n=-1:38==e?t=-1:39==e?n=1:40==e&&(t=1),a.moveCells(a.getSelectionCells(),n,t),a.scrollCellToVisible(a.getSelectionCell())}}o.isControlDown=function(e){return mxEvent.isControlDown(e)||mxClient.IS_MAC&&e.metaKey};var t=mxUtils.bind(this,function(e,n,t,a){var i=this.actions.get(t);if(null!=i){var s=function(){i.enabled&&i.funct()};n?a?o.bindControlShiftKey(e,s):o.bindControlKey(e,s):a?o.bindShiftKey(e,s):o.bindKey(e,s)}});return o.enter=function(){},o.bindKey(8,function(){a.foldCells(!0)}),o.bindKey(13,function(){a.foldCells(!1)}),o.bindKey(33,function(){a.exitGroup()}),o.bindKey(34,function(){a.enterGroup()}),o.bindKey(36,function(){a.home()}),o.bindKey(35,function(){a.refresh()}),o.bindKey(37,function(){n(37)}),o.bindKey(38,function(){n(38)}),o.bindKey(39,function(){n(39)}),o.bindKey(40,function(){n(40)}),o.bindKey(113,function(){a.startEditingAtCell()}),t(46,!1,"delete"),t(82,!0,"tilt"),t(83,!0,"save"),t(83,!0,"saveAs",!0),t(107,!1,"zoomIn"),t(109,!1,"zoomOut"),t(65,!0,"selectAll"),t(86,!0,"selectVertices",!0),t(69,!0,"selectEdges",!0),t(69,!0,"export"),t(66,!0,"toBack"),t(70,!0,"toFront"),t(68,!0,"duplicate"),t(90,!0,"undo"),t(89,!0,"redo"),t(88,!0,"cut"),t(67,!0,"copy"),t(81,!0,"connect"),t(86,!0,"paste"),t(71,!0,"group"),t(71,!0,"grid",!0),t(85,!0,"ungroup"),t(112,!1,"about"),t(80,!0,"publish",!0),o},EditorUi.prototype.createMultiplicities=function(e,n,t,a){for(var i=0;i<n.length;i++)e.push(new mxMultiplicity(!0,n[i],null,null,t[i][0],t[i][1],null,mxResources.get(n[i])+mxResources.get("musthave")+t[i][0]+mxResources.get("outgoingedge"),null)),e.push(new mxMultiplicity(!1,n[i],null,null,a[i][0],a[i][1],null,mxResources.get(n[i])+mxResources.get("musthave")+a[i][0]+mxResources.get("incomingedge"),null))};var useLocalStorage=(mxClient.IS_TOUCH||"local"==urlParams.storage)&&"undefined"!=typeof localStorage,fileSupport=null!=window.File&&null!=window.FileReader&&null!=window.FileList,touchStyle=mxClient.IS_TOUCH||"1"==urlParams.touch,counter=0;try{for(var op=window;null!=op.opener&&!isNaN(op.opener.counter);)op=op.opener;null!=op&&(op.counter++,counter=op.counter)}catch(e){}function Sidebar(e,n){this.editorUi=e,this.container=n,this.palettes=new Object,this.taglist=new Object,this.showTooltips=!0,this.graph=new Graph(document.createElement("div"),null,null,this.editorUi.editor.graph.getStylesheet()),this.graph.resetViewOnRootChange=!1,this.graph.foldingEnabled=!1,this.graph.setConnectable(!1),this.graph.autoScroll=!1,this.graph.setTooltips(!1),this.graph.setEnabled(!1),this.graph.container.style.visibility="hidden",this.graph.container.style.position="absolute",this.graph.container.style.overflow="hidden",this.graph.container.style.height="1px",this.graph.container.style.width="1px",mxClient.IS_IE||mxClient.IS_IE11||(this.graph.container.style.display="none"),document.body.appendChild(this.graph.container),this.pointerUpHandler=mxUtils.bind(this,function(){this.showTooltips=!0}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointerup":"mouseup",this.pointerUpHandler),this.pointerDownHandler=mxUtils.bind(this,function(){this.showTooltips=!1,this.hideTooltip()}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointerdown":"mousedown",this.pointerDownHandler),this.pointerMoveHandler=mxUtils.bind(this,function(e){for(var n=mxEvent.getSource(e);null!=n;){if(n==this.currentElt)return;n=n.parentNode}this.hideTooltip()}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointermove":"mousemove",this.pointerMoveHandler),this.pointerOutHandler=mxUtils.bind(this,function(e){null==e.toElement&&null==e.relatedTarget&&this.hideTooltip()}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointerout":"mouseout",this.pointerOutHandler),mxEvent.addListener(n,"scroll",mxUtils.bind(this,function(){this.showTooltips=!0})),this.init(),mxClient.IS_SVG||((new Image).src=IMAGE_PATH+"/tooltip.png")}function Actions(e){this.editorUi=e,this.actions=new Object,this.init()}function Action(e,n,t,a,i){mxEventSource.call(this),this.label=e,this.funct=n,this.enabled=null==t||t,this.iconCls=a,this.shortcut=i}function Menubar(e,n){this.editorUi=e,this.container=n,mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){this.hideMenu()}))}function Menu(e,n){mxEventSource.call(this),this.funct=e,this.enabled=null==n||n}function Toolbar(e,n){this.editorUi=e,this.container=n,this.init(),mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){this.hideMenu()}))}function createCheckbox(e){var n=document.createElement("input");return n.setAttribute("type","checkbox"),e&&n.setAttribute("checked",!0),n}function createDropdownFromApi(e,t,a,i,n,s,o,r){var l=new XMLHttpRequest;l.open("GET",e,!1),l.setRequestHeader("Authorization","Bearer "+n.editor.data.token),l.send(null);var d=[];200===l.status&&(d=JSON.parse(l.response));var c=document.createElement("select"),m=document.createElement("option");return m.text="-- None --",m.value="-1",c.appendChild(m),d.rows.forEach(function(n){r&&n[a]==r||((m=document.createElement("option")).text=n[a],s&&o?(m.value=o,s.forEach(function(e){m.value=m.value.replace("%"+e+"%",n[e])}),m.selected=m.value==t):(m.value=n[i],m.selected=n[i]==t),c.appendChild(m))}),c.className="form-control select2",c}function createDropdownWithOptgroupFromApi(e,n,t,a,i,s){var o=new XMLHttpRequest;o.open("GET",e,!1),o.setRequestHeader("Authorization","Bearer "+i.editor.data.token),o.send(null);var r=[];200===o.status&&(r=JSON.parse(o.response));var l=document.createElement("select"),d=document.createElement("option");d.text="-- None --",d.value="-1",l.appendChild(d);var c=_.groupBy(r.rows,s);for(var m in c)if(c.hasOwnProperty(m)){var u=document.createElement("optgroup");u.label=_.capitalize(m),c[m].forEach(function(e){(d=document.createElement("option")).text=e[t],d.value=e[a],d.selected=e[a]==n,u.appendChild(d)}),l.appendChild(u)}return l.className="form-control select2",l}function createGroupedDropdownFromApi(e,n,t,a,i,s){var o=new XMLHttpRequest;o.open("GET",e,!1),o.setRequestHeader("Authorization","Bearer "+i.editor.data.token),o.send(null);var r=[];200===o.status&&(r=JSON.parse(o.response));var l=document.createElement("select"),d=document.createElement("option");return d.text="-- None --",d.value="0",l.appendChild(d),r.rows.forEach(function(e){(d=document.createElement("option")).className="select-group-father",d.text=e[t].toUpperCase(),d.value=e[a],d.selected=e[a]==n,l.appendChild(d),e[s].forEach(function(e){(d=document.createElement("option")).className="select-group-son",d.text="-"+_.capitalize(e[t]),d.value=e[a],d.selected=e[a]==n,l.appendChild(d)})}),l.className="form-control select2",l}function createDropdownFromArray(e,n){var t=document.createElement("select");for(var a in e){var i=document.createElement("option");i.text=e[a],i.value=a,(0<n||""!=n)&&(i.selected=n===a),t.appendChild(i)}return t.className="form-control select2",t}function createDropdownFromTigerDialList(e){var n=document.createElement("select"),t=[],a=new XMLHttpRequest;try{if(a.open("POST","/api/rest/list/list",!1),a.send(JSON.stringify({page:1,size:6e5})),200===a.status){var i=JSON.parse(a.response);if(0<i.status){var s=i.response.RMI.rows;for(var o in s)t[s[o].id]=s[o].name}}}catch(e){console.log(e)}for(var r in t){var l=document.createElement("option");l.text=t[r],l.value=r,(0<e||""!=e)&&(l.selected=e===r),n.appendChild(l)}return n.className="form-control select2",n}function Dialog(e,n,t,a,i,s,o){var r=0;mxClient.IS_IE&&9!=document.documentMode&&(r=60),t+=r,a+=r;Math.max(0,Math.round((document.body.scrollWidth-t)/2)),Math.max(0,Math.round((Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)-a)/3));var l=e.createDiv("geDialog");l.className="modal fade in center",l.style.display="block",l.style.paddingRight="12px";var d=e.createDiv("geModalDialog");d.className="modal-dialog",d.appendChild(n),l.appendChild(d),null==this.bg&&(this.bg=e.createDiv("background"),this.bg.className="modal-backdrop fade in",mxClient.IS_QUIRKS&&new mxDivResizer(this.bg)),i&&document.body.appendChild(this.bg),document.body.appendChild(l),this.onDialogClose=o,this.container=l}function ImportDialog(t){var e=t.createDiv("modal-content"),n=t.createDiv("modal-header"),a=t.createDiv("modal-body"),i=t.createDiv("modal-footer"),s=t.createHeader("h4");mxUtils.write(s,mxResources.get("import")+" XML");var o=mxUtils.button("",function(){t.hideDialog()});o.className="close",n.appendChild(o),n.appendChild(s);var r=t.createDiv("row"),l=t.createDiv("col-md-12"),d=document.createElement("textarea");d.style.width="100%",d.style.height="374px";var c=document.createElement("input");c.type="file",c.setAttribute("accept","text/xml"),c.addEventListener("change",function(e){var n=e.target.files[0];if(console.log(n),n)if("text/xml"===n.type){var t=new FileReader;t.onload=function(e){var n=e.target.result;mxUtils.write(d,n)},t.readAsText(n)}else alert("Failed to load format file");else alert("Failed to load file")},!1),l.appendChild(c),l.appendChild(d),r.appendChild(l),a.appendChild(r);var m=mxUtils.button(mxResources.get("import"),mxUtils.bind(this,function(e){var n=mxUtils.parseXml(d.value);t.editor.setGraphXml(n.documentElement),t.hideDialog()}));m.className="btn blue";var u=mxUtils.button(mxResources.get("cancel"),function(){t.hideDialog()});u.className="btn default",i.appendChild(m),i.appendChild(u),e.appendChild(n),e.appendChild(a),e.appendChild(i),this.container=e}function AboutDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("about")+" Cally Square");var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=document.createElement("img");r.style.border="0px",r.setAttribute("width","176"),r.setAttribute("width","151"),r.setAttribute("src",IMAGE_PATH+"/logo.png"),a.appendChild(r),mxUtils.br(a),mxUtils.write(a,"Powered by Xenialab "+mxClient.VERSION),mxUtils.br(a);var l=document.createElement("a");l.setAttribute("href","http://www.callysquare.com/"),l.setAttribute("target","_blank"),mxUtils.write(l,"www.callysquare.com"),a.appendChild(l),mxUtils.br(a),mxUtils.br(a);var d=mxUtils.button(mxResources.get("close"),function(){e.hideDialog()});d.className="btn default",i.appendChild(d),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function SaveDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("saveAs"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.editor.getOrCreateFilename(),l=e.createDiv("row"),d=e.createDiv("col-md-4"),c=e.createDiv("col-md-8"),m=document.createElement("label");m.className="control-label pull-right",mxUtils.write(m,mxResources.get("name")),d.appendChild(m);var u=document.createElement("input");u.setAttribute("value",r+"_copy"),u.setAttribute("id","_name"),u.className="form-control",c.appendChild(u),l.appendChild(d),l.appendChild(c),a.appendChild(l);var p=mxUtils.button(mxResources.get("save"),function(){e.saveAs(u.value),e.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function NewDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("new"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.editor.getOrCreateFilename(),l=e.createDiv("row"),d=e.createDiv("col-md-4"),c=e.createDiv("col-md-8"),m=document.createElement("label");m.className="control-label pull-right",mxUtils.write(m,mxResources.get("name")),d.appendChild(m);var u=document.createElement("input");u.setAttribute("value",r+"_new"),u.setAttribute("id","_name"),u.className="form-control",c.appendChild(u),l.appendChild(d),l.appendChild(c),a.appendChild(l);var p=mxUtils.button(mxResources.get("new"),function(){e.new(u.value),e.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function DescriptionDialog(e){console.log(e.editor.data);var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("description"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.createDiv("form-horizontal form-row-seperated"),l="description",d=e.editor.data.description||"",c=e.createDiv("form-group"),m=document.createElement("label");m.className="col-sm-4 control-label",mxUtils.write(m,mxResources.get(l)),c.appendChild(m);var u=document.createElement("input");u.setAttribute("value",d),u.className="form-control",u.setAttribute("id","_description");var p=e.createDiv("col-sm-8");p.appendChild(u),c.appendChild(p),r.appendChild(c),a.appendChild(r);var g=mxUtils.button(mxResources.get("update"),function(){e.description(u.value),e.hideDialog()});g.className="btn blue";var v=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});v.className="btn default",i.appendChild(g),i.appendChild(v),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function VariableDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("variable"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.createDiv("form-horizontal form-row-seperated"),l="name",d="_"+l,c="variable name",m=e.createDiv("form-group"),u=document.createElement("label");u.className="col-sm-4 control-label",mxUtils.write(u,mxResources.get(l)),m.appendChild(u);var p=document.createElement("input");p.setAttribute("value",c),p.className="form-control",p.setAttribute("id",d);var g=e.createDiv("col-sm-8");g.appendChild(p),m.appendChild(g),r.appendChild(m),d="_"+(l="description"),c="variable description",m=e.createDiv("form-group last"),(u=document.createElement("label")).className="col-sm-4 control-label",mxUtils.write(u,mxResources.get(l)),m.appendChild(u);var v=document.createElement("input");v.setAttribute("value",c),v.className="form-control",v.setAttribute("id",d),(g=e.createDiv("col-sm-8")).appendChild(v),m.appendChild(g),r.appendChild(m),a.appendChild(r);var h=mxUtils.button(mxResources.get("new"),function(){e.variable(p.value,v.value),e.hideDialog()});h.className="btn blue";var f=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});f.className="btn default",i.appendChild(h),i.appendChild(f),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function OpenDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("open"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.createDiv("row"),l=e.createDiv("col-md-4"),d=e.createDiv("col-md-8"),c=document.createElement("label");c.className="control-label pull-right",mxUtils.write(c,mxResources.get("name")),l.appendChild(c);var m=new XMLHttpRequest;m.open("GET","/api/square/projects",!1),m.setRequestHeader("Authorization","Bearer "+e.editor.data.token),m.send(null);var u=[];200===m.status&&(u=JSON.parse(m.response));for(var p=document.createElement("select"),g=0;g<u.length;g++){var v=document.createElement("option");v.text=u[g].name,v.value=u[g].id,p.appendChild(v)}p.className="form-control",d.appendChild(p),r.appendChild(l),r.appendChild(d),a.appendChild(r);var h=mxUtils.button(mxResources.get("open"),function(){console.log(p),console.log(p.value),window.open("square/project/"+p.value,"_blank"),e.hideDialog()});h.className="btn blue";var f=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});f.className="btn default",i.appendChild(h),i.appendChild(f),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function RenameDialog(t){var e=t.createDiv("modal-content"),n=t.createDiv("modal-header"),a=t.createDiv("modal-body"),i=t.createDiv("modal-footer"),s=t.createHeader("h4");mxUtils.write(s,mxResources.get("rename"));var o=mxUtils.button("",function(){t.hideDialog()});o.className="close",n.appendChild(o),n.appendChild(s);var r=t.createDiv("row"),l=t.createDiv("col-md-4"),d=t.createDiv("col-md-8"),c=document.createElement("label");c.className="control-label pull-right",mxUtils.write(c,mxResources.get("name")),l.appendChild(c);var m=t.editor.filename,u=document.createElement("input");u.setAttribute("value",m),u.className="form-control",d.appendChild(u),r.appendChild(l),r.appendChild(d),a.appendChild(r);var p=mxUtils.button(mxResources.get("save"),function(){var n=new XMLHttpRequest;n.open("PUT",SAVE_URL+t.editor.data.id,!0),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.setRequestHeader("Authorization","Bearer "+t.editor.data.token),n.send("name="+u.value),n.onload=function(e){200===n.status?(t.editor.setStatus("Project successfully renamed"),t.editor.filename=u.value):(console.log(n.response),t.editor.setStatus(JSON.parse(n.response).errors[0].message))},n.onerror=function(e){mxUtils.alert(n.statusText)},t.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){t.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),e.appendChild(n),e.appendChild(a),e.appendChild(i),this.container=e}function EditFileDialog(n){var e=n.createDiv("modal-content"),t=n.createDiv("modal-header"),a=n.createDiv("modal-body"),i=n.createDiv("modal-footer"),s=n.createHeader("h4");mxUtils.write(s,mxResources.get("edit"));var o=mxUtils.button("",function(){n.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=n.createDiv("row"),l=n.createDiv("col-md-12"),d=document.createElement("textarea");if(d.style.width="100%",d.style.height="374px",d.value=mxUtils.getPrettyXml(n.editor.getGraphXml()),fileSupport){d.addEventListener("dragover",function(e){e.stopPropagation(),e.preventDefault()},!1),d.addEventListener("drop",function(e){if(e.stopPropagation(),e.preventDefault(),0<e.dataTransfer.files.length){var n=e.dataTransfer.files[0],t=new FileReader;t.onload=function(e){d.value=e.target.result},t.readAsText(n)}},!1)}l.appendChild(d),r.appendChild(l),a.appendChild(r);var c=mxUtils.button(mxResources.get("save"),function(){var e=mxUtils.parseXml(d.value);n.editor.setGraphXml(e.documentElement),n.hideDialog()});c.className="btn blue";var m=mxUtils.button(mxResources.get("cancel"),function(){n.hideDialog()});m.className="btn default",i.appendChild(c),i.appendChild(m),e.appendChild(t),e.appendChild(a),e.appendChild(i),this.container=e}function ExportDialog(n){var e=n.createDiv("modal-content"),t=n.createDiv("modal-header"),a=n.createDiv("modal-body form"),i=n.createDiv("modal-footer"),s=n.createHeader("h4");mxUtils.write(s,mxResources.get("export")+" XML");var o=mxUtils.button("",function(){n.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=n.createDiv("form-horizontal form-row-seperated"),l=n.createDiv("form-group last"),d=document.createElement("label");d.className="col-sm-4 control-label",mxUtils.write(d,mxResources.get("filename"));var c=document.createElement("input");c.setAttribute("value",n.editor.getOrCreateFilename()),c.className="form-control";var m=n.createDiv("col-sm-8");m.appendChild(c),l.appendChild(d),l.appendChild(m),r.appendChild(l),a.appendChild(r);var u=mxUtils.button(mxResources.get("export"),mxUtils.bind(this,function(e){n.save(!1);encodeURIComponent(mxUtils.getXml(n.editor.getGraphXml()));new mxXmlRequest(SAVE_URL+n.editor.data.id+"/download","filename="+c.value,"GET").simulate(document,"_blank"),n.hideDialog()}));u.className="btn blue";var p=mxUtils.button(mxResources.get("cancel"),function(){n.hideDialog()});p.className="btn default",i.appendChild(u),i.appendChild(p),e.appendChild(t),e.appendChild(a),e.appendChild(i),this.container=e}function GeneralDialog(i,s){console.log("general");var o=i.editor.graph,e=i.createDiv("md-dialog"),n=i.createDiv("md-toolbar"),t=i.createDiv("md-dialog-content"),a=i.createDiv("md-dialog-actions"),r=i.createHeader("h4");mxUtils.write(r,mxResources.get("edit")+" "+mxResources.get(s.value.nodeName));var l=mxUtils.button("",function(){i.hideDialog()});l.className="close",n.appendChild(l),n.appendChild(r);for(var d=s.value.attributes.length,c=i.createDiv("form-horizontal form-row-seperated"),m=0;m<d;m++){var u,p=s.value.attributes[m].name,g="_"+p,v=s.value.attributes[m].value,h=i.createDiv(m==d-1?"form-group last":"form-group"),f=document.createElement("label");switch(f.className="col-sm-4 control-label",mxUtils.write(f,mxResources.get(p)),h.appendChild(f),p){case"sip_id":u=createDropdownWithOptgroupFromApi("/api/users/all",v,"fullname","id",i,"role");break;case"queue_id":u=createDropdownFromApi("/api/voice/queues",v,"name","name",i);break;case"trunk_name":u=createDropdownFromApi("/api/trunks",v,"name","name",i);break;case"variable_id":u=createDropdownFromApi("/api/variables",v,"name","id",i);break;case"account_id":u="sendMail"==s.value.nodeName?createDropdownFromApi("/api/mail/servers/out",v,"username","id",i):createDropdownFromApi("/api/sms/accounts",v,"name","id",i);break;case"template_id":u=createDropdownFromApi("/api/templates",v,"name","id",i);break;case"context":u=createDropdownFromApi("/api/voice/contexts",v,"name","name",i);break;case"mailbox":u=createDropdownFromApi("/api/voice/voicemails",v,"mailbox","id",i,["mailbox","context"],"%mailbox%@%context%");break;case"model":u=createDropdownFromArray(ISPEECHASRMODEL,v);break;case"ispeech_asr_language":u=createDropdownFromArray(ISPEECHASRLANG,v);break;case"beep":u=createDropdownFromArray(ISPEECHBEEP,v);break;case"hiddendigitspos":u=createDropdownFromArray(SECRETDIGITSPOS,v);break;case"ispeech_tts_language":u=createDropdownFromArray(ISPEECHLANG,v);break;case"google_tts_language":u=createDropdownFromArray(GOOGLETTSLANG,v);break;case"intKey":u=createDropdownFromArray(ASRINTKEYS,v);break;case"recordingFormat":u=createDropdownFromArray(RECORDINGFORMAT,v);break;case"answer":u=createDropdownFromArray(BOOLSELECT,v);break;case"list_id":u=createDropdownFromTigerDialList(v);break;case"interval_id":u=createGroupedDropdownFromApi("/api/intervals",v,"name","id",i,"SubIntervals");break;case"project_id":u=createDropdownFromApi("/api/square/projects",v,"name","id",i,null,null,i.editor.getOrCreateFilename());break;case"odbc_id":u=createDropdownFromApi("/api/square/odbc",v,"name","id",i);break;case"file_id":u=createDropdownFromApi("/api/sounds",v,"display_name","id",i);break;case"timeout":case"digit":case"mindigit":case"maxdigit":case"response":case"retry":case"speed":(u=document.createElement("input")).setAttribute("type","number"),u.setAttribute("min",0),u.setAttribute("max",1e3),u.setAttribute("value",v),u.className="form-control";break;case"text":case"key":case"query":case"condition":case"command":case"body":(u=document.createElement("textarea")).innerHTML=v,u.className="form-control";break;case"sms_text":(u=document.createElement("textarea")).innerHTML=v,u.className="form-control",u.setAttribute("maxlength","160");break;default:(u=document.createElement("input")).setAttribute("value",v),u.className="form-control"}u.setAttribute("id",g);var b=i.createDiv("col-sm-8");if(b.appendChild(u),mxResources.get("help_"+p)){var A=i.createDiv("p");A.className="help-block",mxUtils.write(A,mxResources.get("help_"+p)),b.appendChild(A)}h.appendChild(b),c.appendChild(h)}t.appendChild(c);var E=mxUtils.button(mxResources.get("save"),mxUtils.bind(this,function(e){for(var n=0;n<s.value.attributes.length;n++){var t="_"+s.value.attributes[n].name,a=s.value.attributes[n].name;s.setAttribute(a,document.getElementById(t).value)}o.refresh(s),i.hideDialog()}));E.className="btn blue";var y=mxUtils.button(mxResources.get("cancel"),function(){i.hideDialog()});y.className="btn default",a.appendChild(E),a.appendChild(y),e.appendChild(n),e.appendChild(t),e.appendChild(a),this.container=e}Editor=function(){mxEventSource.call(this),this.init(),this.initStencilRegistry(),this.graph=new Graph,this.outline=new mxOutline(this.graph),this.outline.updateOnPan=!0,this.undoManager=this.createUndoManager(),this.status="",this.filename=null,this.getOrCreateFilename=function(){return this.filename||mxResources.get("drawing",[counter])+".xml"},this.getFilename=function(){return this.filename},this.setStatus=function(e){this.status=e,this.fireEvent(new mxEventObject("statusChanged"))},this.getStatus=function(){return this.status},this.modified=!1,this.graphChangeListener=function(){this.modified=!0},this.graph.getModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(){this.graphChangeListener.apply(this,arguments)})),window.onbeforeunload=mxUtils.bind(this,function(){if(this.modified)return mxResources.get("allChangesLost")}),this.graph.resetViewOnRootChange=!1,this.graph.scrollbars=!0,this.graph.background=null},mxUtils.extend(Editor,mxEventSource),Editor.prototype.gridImage=IMAGE_PATH+"/grid.gif",Editor.prototype.transparentImage=IMAGE_PATH+"/transparent.gif",Editor.prototype.setGraphXml=function(e){var n=new mxCodec(e.ownerDocument);if("mxGraphModel"==e.nodeName){this.graph.view.scale=Number(e.getAttribute("scale")||1),this.graph.gridEnabled="0"!=e.getAttribute("grid"),this.graph.graphHandler.guidesEnabled="0"!=e.getAttribute("guides"),this.graph.setTooltips("0"!=e.getAttribute("tooltips")),this.graph.setConnectable("0"!=e.getAttribute("connect")),this.graph.foldingEnabled="0"!=e.getAttribute("fold"),this.graph.scrollbars="0"!=e.getAttribute("scrollbars"),this.graph.scrollbars||(this.graph.container.scrollLeft=0,this.graph.container.scrollTop=0,this.graph.view.translate.x=Number(e.getAttribute("dx")||0),this.graph.view.translate.y=Number(e.getAttribute("dy")||0)),this.graph.pageVisible="1"==e.getAttribute("page"),this.graph.pageBreaksVisible=this.graph.pageVisible,this.graph.preferPageSize=this.graph.pageBreaksVisible;var t=e.getAttribute("pageScale");this.graph.pageScale=null!=t?t:1.5;var a=e.getAttribute("pageWidth"),i=e.getAttribute("pageHeight");null!=a&&null!=i&&(this.graph.pageFormat=new mxRectangle(0,0,parseFloat(a),parseFloat(i)),this.outline.outline.pageFormat=this.graph.pageFormat);var s=e.getAttribute("background");null!=s&&0<s.length&&(this.graph.background=s),n.decode(e,this.graph.getModel()),this.updateGraphComponents()}},Editor.prototype.getGraphXml=function(){var e=new mxCodec(mxUtils.createXmlDocument()).encode(this.graph.getModel());return 0==this.graph.view.translate.x&&0==this.graph.view.translate.y||(e.setAttribute("dx",Math.round(100*this.graph.view.translate.x)/100),e.setAttribute("dy",Math.round(100*this.graph.view.translate.y)/100)),1!=this.graph.view.scale&&e.setAttribute("scale",Math.round(1e3*this.graph.view.scale)/1e3),e.setAttribute("grid",this.graph.isGridEnabled()?"1":"0"),e.setAttribute("guides",this.graph.graphHandler.guidesEnabled?"1":"0"),e.setAttribute("guides",this.graph.graphHandler.guidesEnabled?"1":"0"),e.setAttribute("tooltips",this.graph.tooltipHandler.isEnabled()?"1":"0"),e.setAttribute("connect",this.graph.connectionHandler.isEnabled()?"1":"0"),e.setAttribute("fold",this.graph.foldingEnabled?"1":"0"),e.setAttribute("page",this.graph.pageVisible?"1":"0"),e.setAttribute("pageScale",this.graph.pageScale),e.setAttribute("pageWidth",this.graph.pageFormat.width),e.setAttribute("pageHeight",this.graph.pageFormat.height),this.graph.scrollbars||e.setAttribute("scrollbars","0"),null!=this.graph.background&&e.setAttribute("background",this.graph.background),e},Editor.prototype.updateGraphComponents=function(){var e=this.graph,n=this.outline;if(null!=e.container&&null!=n.outline.container){null!=e.background?"none"==e.background?e.container.style.backgroundColor="transparent":(null!=e.view.backgroundPageShape&&(e.view.backgroundPageShape.fill=e.background,e.view.backgroundPageShape.reconfigure()),e.container.style.backgroundColor=e.background):e.container.style.backgroundColor="",e.pageVisible?(e.container.style.backgroundColor="#ebebeb",e.container.style.borderStyle="solid",e.container.style.borderColor="#e5e5e5",e.container.style.borderTopWidth="1px",e.container.style.borderLeftWidth="1px",e.container.style.borderRightWidth="0px",e.container.style.borderBottomWidth="0px"):e.container.style.border="",n.outline.container.style.backgroundColor=e.container.style.backgroundColor,n.outline.pageVisible==e.pageVisible&&n.outline.pageScale==e.pageScale||(n.outline.pageScale=e.pageScale,n.outline.pageVisible=e.pageVisible,n.outline.view.validate()),e.scrollbars&&"hidden"==e.container.style.overflow&&!touchStyle?e.container.style.overflow="auto":e.scrollbars&&!touchStyle||(e.container.style.overflow="hidden");var t=mxClient.IS_IE&&9<=document.documentMode?"url("+this.transparentImage+")":"none";e.container.style.backgroundImage=!e.pageVisible&&e.isGridEnabled()?"url("+this.gridImage+")":t,null!=e.view.backgroundPageShape&&(e.view.backgroundPageShape.node.style.backgroundImage=this.graph.isGridEnabled()?"url("+this.gridImage+")":"none")}},Editor.prototype.init=function(){mxClient.IS_IE6&&mxClient.link("stylesheet",CSS_PATH+"/grapheditor-ie6.css"),mxResources.loadDefaultBundle=!1,mxResources.add(RESOURCE_BASE),mxConstants.DEFAULT_HOTSPOT=.3;var e=mxConnectionHandler.prototype.createMarker;mxConnectionHandler.prototype.createMarker=function(){var t=e.apply(this,arguments);return t.intersects=mxUtils.bind(this,function(e,n){return!!this.isConnecting()||mxCellMarker.prototype.intersects.apply(t,arguments)}),t},mxConstants.SHADOWCOLOR="#d0d0d0",mxConstants.HANDLE_FILLCOLOR="#99ccff",mxConstants.HANDLE_STROKECOLOR="#0088cf",mxConstants.VERTEX_SELECTION_COLOR="#00a8ff",mxConstants.OUTLINE_COLOR="#00a8ff",mxConstants.OUTLINE_HANDLE_FILLCOLOR="#99ccff",mxConstants.OUTLINE_HANDLE_STROKECOLOR="#00a8ff",mxConstants.CONNECT_HANDLE_FILLCOLOR="#cee7ff",mxConstants.EDGE_SELECTION_COLOR="#00a8ff",mxConstants.DEFAULT_VALID_COLOR="#00a8ff",mxConstants.LABEL_HANDLE_FILLCOLOR="#cee7ff",mxConstants.GUIDE_COLOR="#0088cf",mxGraph.prototype.pageBreakColor="#c0c0c0",mxGraph.prototype.pageScale=1,mxRubberband.prototype.defaultOpacity=30,mxGraphView.prototype.createBackgroundPageShape=function(e){return new mxRectangleShape(e,this.graph.background||"white","#cacaca")},mxGraphView.prototype.getBackgroundPageBounds=function(){var e=this.getGraphBounds(),n=0<e.width?e.x/this.scale-this.translate.x:0,t=0<e.height?e.y/this.scale-this.translate.y:0,a=e.width/this.scale,i=e.height/this.scale,s=this.graph.pageFormat,o=this.graph.pageScale,r=s.width*o,l=s.height*o,d=Math.floor(Math.min(0,n)/r),c=Math.floor(Math.min(0,t)/l),m=Math.ceil(Math.max(1,n+a)/r)-d,u=Math.ceil(Math.max(1,t+i)/l)-c;return new mxRectangle(this.scale*(this.translate.x+d*r),this.scale*(this.translate.y+c*l),this.scale*m*r,this.scale*u*l)};var t=mxGraph.prototype.panGraph;mxGraph.prototype.panGraph=function(e,n){t.apply(this,arguments),this.dialect==mxConstants.DIALECT_SVG||null==this.view.backgroundPageShape||this.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.container)||(this.view.backgroundPageShape.node.style.marginLeft=e+"px",this.view.backgroundPageShape.node.style.marginTop=n+"px")};var a=this;mxGraphView.prototype.validateBackground=function(){var e=this.graph.getBackgroundImage();if(null!=e){if(null==this.backgroundImage||this.backgroundImage.image!=e.src){null!=this.backgroundImage&&this.backgroundImage.destroy();var n=new mxRectangle(0,0,1,1);this.backgroundImage=new mxImageShape(n,e.src),this.backgroundImage.dialect=this.graph.dialect,this.backgroundImage.init(this.backgroundPane),this.backgroundImage.redraw()}this.redrawBackgroundImage(this.backgroundImage,e)}else null!=this.backgroundImage&&(this.backgroundImage.destroy(),this.backgroundImage=null);if(this.graph.pageVisible){n=this.getBackgroundPageBounds();null==this.backgroundPageShape?(this.backgroundPageShape=this.createBackgroundPageShape(n),this.backgroundPageShape.scale=1,this.backgroundPageShape.isShadow=!0,this.backgroundPageShape.dialect=mxConstants.DIALECT_STRICTHTML,this.backgroundPageShape.init(this.graph.container),this.graph.container.firstChild.style.position="absolute",this.graph.container.insertBefore(this.backgroundPageShape.node,this.graph.container.firstChild),this.backgroundPageShape.redraw(),this.backgroundPageShape.node.className="geBackgroundPage",this.backgroundPageShape.node.style.backgroundPosition="-1px -1px",mxEvent.addListener(this.backgroundPageShape.node,"dblclick",mxUtils.bind(this,function(e){this.graph.dblClick(e)})),mxEvent.addGestureListeners(this.backgroundPageShape.node,mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){null!=this.graph.tooltipHandler&&this.graph.tooltipHandler.isHideOnHover()&&this.graph.tooltipHandler.hide(),this.graph.isMouseDown&&!mxEvent.isConsumed(e)&&this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))}))):(this.backgroundPageShape.scale=1,this.backgroundPageShape.bounds=n,this.backgroundPageShape.redraw()),this.backgroundPageShape.node.style.backgroundImage=this.graph.isGridEnabled()?"url("+a.gridImage+")":"none"}else null!=this.backgroundPageShape&&(this.backgroundPageShape.destroy(),this.backgroundPageShape=null)},mxGraph.prototype.updatePageBreaks=function(e,n,t){var a=this.view.scale,i=this.view.translate,s=this.pageFormat,o=a*this.pageScale,r=this.view.getBackgroundPageBounds();n=r.width,t=r.height;var l=new mxRectangle(a*i.x,a*i.y,s.width*o,s.height*o),d=(e=e&&Math.min(l.width,l.height)>this.minPageBreakDist)?Math.ceil(n/l.width)-1:0,c=e?Math.ceil(t/l.height)-1:0,m=r.x+n,u=r.y+t;if(null==this.horizontalPageBreaks&&0<d&&(this.horizontalPageBreaks=[]),null!=this.horizontalPageBreaks){for(var p=0;p<=d;p++){var g=[new mxPoint(r.x+(p+1)*l.width,r.y),new mxPoint(r.x+(p+1)*l.width,u)];if(null!=this.horizontalPageBreaks[p])this.horizontalPageBreaks[p].scale=1,this.horizontalPageBreaks[p].points=g,this.horizontalPageBreaks[p].redraw();else(v=new mxPolyline(g,this.pageBreakColor,this.scale)).dialect=this.dialect,v.isDashed=this.pageBreakDashed,v.addPipe=!1,v.scale=a,v.init(this.view.backgroundPane),v.redraw(),this.horizontalPageBreaks[p]=v}for(p=d;p<this.horizontalPageBreaks.length;p++)this.horizontalPageBreaks[p].destroy();this.horizontalPageBreaks.splice(d,this.horizontalPageBreaks.length-d)}if(null==this.verticalPageBreaks&&0<c&&(this.verticalPageBreaks=[]),null!=this.verticalPageBreaks){for(p=0;p<=c;p++){var v;g=[new mxPoint(r.x,r.y+(p+1)*l.height),new mxPoint(m,r.y+(p+1)*l.height)];if(null!=this.verticalPageBreaks[p])this.verticalPageBreaks[p].scale=1,this.verticalPageBreaks[p].points=g,this.verticalPageBreaks[p].redraw();else(v=new mxPolyline(g,this.pageBreakColor,a)).dialect=this.dialect,v.isDashed=this.pageBreakDashed,v.addPipe=!1,v.scale=a,v.init(this.view.backgroundPane),v.redraw(),this.verticalPageBreaks[p]=v}for(p=c;p<this.verticalPageBreaks.length;p++)this.verticalPageBreaks[p].destroy();this.verticalPageBreaks.splice(c,this.verticalPageBreaks.length-c)}},mxEdgeHandler.prototype.snapToTerminals=!0,mxGraphHandler.prototype.guidesEnabled=!0;var s=mxGraphHandler.prototype.shouldRemoveCellsFromParent;mxGraphHandler.prototype.shouldRemoveCellsFromParent=function(e,n,t){for(var a=0;a<n.length;a++)if(this.graph.getModel().isVertex(n[a])){var i=this.graph.getCellGeometry(n[a]);if(null!=i&&i.relative)return!1}return s.apply(this,arguments)},mxGuide.prototype.isEnabledForEvent=function(e){return!mxEvent.isAltDown(e)};var r=mxPopupMenu.prototype.addItem;mxPopupMenu.prototype.addItem=function(e,n,t,a,i,s){var o=r.apply(this,arguments);return null==s||s||mxEvent.addListener(o,"mousedown",function(e){mxEvent.consume(e)}),o};var o=mxGraphHandler.prototype.getInitialCellForEvent;mxGraphHandler.prototype.getInitialCellForEvent=function(e){var n=this.graph.getModel(),t=n.getParent(this.graph.getSelectionCell()),a=o.apply(this,arguments),i=n.getParent(a);if(null==t||t!=a&&t!=i)for(;!this.graph.isCellSelected(a)&&!this.graph.isCellSelected(i)&&n.isVertex(i)&&!this.graph.isValidRoot(i);)a=i,i=this.graph.getModel().getParent(a);return a};var l=mxGraphHandler.prototype.isDelayedSelection;mxGraphHandler.prototype.isDelayedSelection=function(e){var n=l.apply(this,arguments),t=this.graph.getModel(),a=t.getParent(this.graph.getSelectionCell()),i=t.getParent(e);return(null==a||a!=e&&a!=i)&&(this.graph.isCellSelected(e)||!t.isVertex(i)||this.graph.isValidRoot(i)||(n=!0)),n},mxGraphHandler.prototype.selectDelayed=function(e){var n=e.getCell();null==n&&(n=this.cell);for(var t=this.graph.getModel(),a=t.getParent(n);this.graph.isCellSelected(n)&&t.isVertex(a)&&!this.graph.isValidRoot(a);)n=a,a=t.getParent(n);this.graph.selectCellForEvent(n,e.getEvent())},mxPanningHandler.prototype.getCellForPopupEvent=function(e){for(var n=e.getCell(),t=this.graph.getModel(),a=t.getParent(n);t.isVertex(a)&&!this.graph.isValidRoot(a);)this.graph.isCellSelected(a)&&(n=a),a=t.getParent(a);return n}},Editor.prototype.createUndoManager=function(){var s=this.graph,t=new mxUndoManager,e=function(e,n){t.undoableEditHappened(n.getProperty("edit"))};s.getModel().addListener(mxEvent.UNDO,e),s.getView().addListener(mxEvent.UNDO,e);var n=function(e,n){for(var t=s.getSelectionCellsForChanges(n.getProperty("edit").changes),a=[],i=1;i<t.length;i++)null!=s.view.getState(t[i])&&a.push(t[i]);s.setSelectionCells(a)};return t.addListener(mxEvent.UNDO,n),t.addListener(mxEvent.REDO,n),t},Editor.prototype.initStencilRegistry=function(){mxStencilRegistry.loadStencilSet(STENCIL_PATH+"/general.xml")},mxStencilRegistry.libraries={},mxStencilRegistry.packages=[],mxStencilRegistry.getStencil=function(e){var n=mxStencilRegistry.stencils[e];if(null==n){var t=mxStencilRegistry.getBasenameForStencil(e);if(null!=t){var a=mxStencilRegistry.libraries[t];if(null!=a){if(null==mxStencilRegistry.packages[t]){mxStencilRegistry.packages[t]=1;for(var i=0;i<a.length;i++){var s=a[i];if(".xml"==s.toLowerCase().substring(s.length-4,s.length))mxStencilRegistry.loadStencilSet(s,null);else if(".js"==s.toLowerCase().substring(s.length-3,s.length)){var o=mxUtils.load(s);null!=o&&eval.call(window,o.getText())}}}}else mxStencilRegistry.loadStencilSet(STENCIL_PATH+"/"+t+".xml",null);n=mxStencilRegistry.stencils[e]}}return n},mxStencilRegistry.getBasenameForStencil=function(e){var n=e.split("."),t=null;if(0<n.length&&"mxgraph"==n[0]){t=n[1];for(var a=2;a<n.length-1;a++)t+="/"+n[a]}return t},mxStencilRegistry.loadStencilSet=function(e,n,t){t=null!=t&&t;var a=mxStencilRegistry.packages[e];if(t||null==a){var i=!1;null==a&&(a=mxUtils.load(e).getXml(),mxStencilRegistry.packages[e]=a,i=!0),mxStencilRegistry.parseStencilSet(a,n,i)}},mxStencilRegistry.parseStencilSet=function(e,n,t){t=null==t||t;var a=e.documentElement,i=a.firstChild,s="",o=a.getAttribute("name");for(null!=o&&(s=o+".");null!=i;){if(i.nodeType==mxConstants.NODETYPE_ELEMENT&&null!=(o=i.getAttribute("name"))){s=s.toLowerCase();var r=o.replace(/ /g,"_");if(t&&mxStencilRegistry.addStencil(s+r.toLowerCase(),new mxStencil(i)),null!=n){var l=i.getAttribute("w"),d=i.getAttribute("h");n(s,r,o,l=null==l?80:parseInt(l,10),d=null==d?80:parseInt(d,10))}}i=i.nextSibling}},OpenFile=function(e){this.producer=null,this.consumer=null,this.done=e},OpenFile.prototype.setConsumer=function(e){this.consumer=e,this.execute()},OpenFile.prototype.setData=function(e,n){this.data=e,this.filename=n,this.execute()},OpenFile.prototype.error=function(e){this.cancel(),mxUtils.alert(e)},OpenFile.prototype.execute=function(){null!=this.consumer&&null!=this.data&&(this.consumer(this.data,this.filename),this.cancel())},OpenFile.prototype.cancel=function(){null!=this.done&&this.done()},Sidebar.prototype.init=function(){var e=STENCIL_PATH;this.addSearchPalette(!0),this.addImagePalette("entry",mxResources.get("entry"),e+"/entry/","_128x128.png",["start","finally","end"],[mxResources.get("start"),mxResources.get("finally"),mxResources.get("end")]),this.addImagePalette("call_management",mxResources.get("call_management"),e+"/call_management/","_128x128.png",["answer","hangup","dial","ext_dial","queue","voicemail","callback"],[mxResources.get("answer"),mxResources.get("hangup"),mxResources.get("dial"),mxResources.get("ext_dial"),mxResources.get("queue"),mxResources.get("voicemail"),mxResources.get("callback")]),this.addImagePalette("agent_management",mxResources.get("agent_management"),e+"/agent_management/","_128x128.png",["login","pause","unpause","logout"],[mxResources.get("login"),mxResources.get("pause"),mxResources.get("unpause"),mxResources.get("logout")]),this.addImagePalette("variable",mxResources.get("variable"),e+"/variable/","_128x128.png",["set","math"],[mxResources.get("set"),mxResources.get("math")]),this.addImagePalette("playback",mxResources.get("playback"),e+"/playback/","_128x128.png",["playback","menu","saydigits","saynumber","sayphonetic","getdigits","getsecretdigits"],[mxResources.get("playback"),mxResources.get("menu"),mxResources.get("saydigits"),mxResources.get("saynumber"),mxResources.get("sayphonetic"),mxResources.get("getdigits"),mxResources.get("getsecretdigits")]),this.addImagePalette("recording",mxResources.get("recording"),e+"/recording/","_128x128.png",["record"],[mxResources.get("record")]),this.addImagePalette("tts","TTS",e+"/tts/","_128x128.png",["google_cloud_tts","tts","ispeechtts","awspolly","lumenvoxtts","sestektts","mrcpsynth"],["Google Cloud TTS","GoogleTTS","ISpeechTTS","AWSPolly","LumenvoxTTS","SestekTTS","MRCPSynth"]),this.addImagePalette("asr","ASR",e+"/asr/","_128x128.png",["googleasr","ispeechasr","lumenvoxasr","tildeasr","sestekasr","mrcprecog"],["GoogleASR","ISpeechASR","LumenvoxASR","TildeASR","SestekASR","MRCPRecog"]),this.addImagePalette("integrationServer",mxResources.get("integrationServer"),e+"/integration_server/","_128x128.png",["database","sendMail","sendSMS","dialogflow","dialogflowV2","awslex","sesteknda","restapi"],[mxResources.get("database"),mxResources.get("sendMail"),mxResources.get("sendSMS"),"Dialogflow","DialogflowV2","AWSLex","SestekNDA","RestAPI"]),this.addImagePalette("callflow",mxResources.get("callflow"),e+"/callflow/","_128x128.png",["gotoc","gotoif","gotoiftime","vswitch"],[mxResources.get("gotoc"),mxResources.get("gotoif"),mxResources.get("gotoiftime"),mxResources.get("vswitch")]),this.addImagePalette("stats",mxResources.get("stats"),e+"/stats/","_128x128.png",["goal"],[mxResources.get("goal")]),this.addImagePalette("general",mxResources.get("general"),e+"/general/","_128x128.png",["noop","system","agi","subproject","custom_app"],[mxResources.get("noop"),mxResources.get("system"),mxResources.get("agi"),mxResources.get("subproject"),mxResources.get("custom_app")])},Sidebar.prototype.collapsedImage=mxClient.IS_SVG?"data:image/gif;base64,R0lGODlhDQANAIABAJmZmf///yH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0Nzc3LCAyMDEwLzAyLzEyLTE3OjMyOjAwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDozNUQyRTJFNjZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDozNUQyRTJFNzZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjFERjc3MEUxNkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjFERjc3MEUyNkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAQAAAQAsAAAAAA0ADQAAAhSMj6lrwAjcC1GyahV+dcZJgeIIFgA7":IMAGE_PATH+"/collapsed.gif",Sidebar.prototype.expandedImage=mxClient.IS_SVG?"data:image/gif;base64,R0lGODlhDQANAIABAJmZmf///yH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0Nzc3LCAyMDEwLzAyLzEyLTE3OjMyOjAwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoxREY3NzBERjZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoxREY3NzBFMDZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjFERjc3MERENkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjFERjc3MERFNkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAQAAAQAsAAAAAA0ADQAAAhGMj6nL3QAjVHIu6azbvPtWAAA7":IMAGE_PATH+"/expanded.gif",Sidebar.prototype.tooltipImage=mxClient.IS_SVG?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAbCAMAAAB7jU7LAAAACVBMVEX///+ZmZn///9Y2COLAAAAA3RSTlP//wDXyg1BAAAAOElEQVR42mXQMQ4AMAgDsWv//+iutcJmIQSk+9dJpVKpVCqVSqVSqZTdncWzF8/NeP7FkxWenPEDOnUBiL3jWx0AAAAASUVORK5CYII=":IMAGE_PATH+"/tooltip.png",Sidebar.prototype.searchImage=mxClient.IS_SVG?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAEaSURBVHjabNGxS5VxFIfxz71XaWuQUJCG/gCHhgTD9VpEETg4aMOlQRp0EoezObgcd220KQiXmpretTAHQRBdojlQEJyukPdt+b1ywfvAGc7wnHP4nlZd1yKijQW8xzNc4Su+ZOYfQ3T6/f4YNvEJYzjELXp4VVXVz263+7cR2niBxAFeZ2YPi3iHR/gYERPDwhpOsd6sz8x/mfkNG3iOlWFhFj8y89J9KvzGXER0GuEaD42mgwHqUtoljbcRsTBCeINpfM/MgZLKPpaxFxGbOCqDXmILN7hoJrTKH+axhxmcYRxP0MIDnOBDZv5q1XUNIuJxifJp+UNV7t7BFM6xeic0RMQ4Bpl5W/ol7GISx/eEUUTECrbx+f8A8xhiZht9zsgAAAAASUVORK5CYII=":IMAGE_PATH+"/search.png",Sidebar.prototype.enableTooltips=!0,Sidebar.prototype.tooltipBorder=16,Sidebar.prototype.tooltipDelay=300,Sidebar.prototype.dropTargetDelay=200,Sidebar.prototype.thumbWidth=36,Sidebar.prototype.thumbHeight=36,Sidebar.prototype.thumbPadding=5<=document.documentMode?0:1,Sidebar.prototype.thumbBorder=2,Sidebar.prototype.sidebarTitleSize=9,Sidebar.prototype.sidebarTitles=!1,Sidebar.prototype.tooltipTitles=!0,Sidebar.prototype.maxTooltipWidth=400,Sidebar.prototype.maxTooltipHeight=400,Sidebar.prototype.addStencilsToIndex=!0,Sidebar.prototype.defaultImageWidth=80,Sidebar.prototype.defaultImageHeight=80,Sidebar.prototype.getOffset=function(e){return{left:(e=e.getBoundingClientRect()).left+window.scrollX,top:e.top+window.scrollY}},Sidebar.prototype.showTooltip=function(c,m,u,p,g,v){if(this.enableTooltips&&this.showTooltips&&this.currentElt!=c){null!=this.thread&&(window.clearTimeout(this.thread),this.thread=null);var e=mxUtils.bind(this,function(){null==this.tooltip&&(this.tooltip=document.createElement("div"),this.tooltip.className="geSidebarTooltip",this.tooltip.style.zIndex=mxPopupMenu.prototype.zIndex-1,document.body.appendChild(this.tooltip),this.graph2=new Graph(this.tooltip,null,null,this.editorUi.editor.graph.getStylesheet()),this.graph2.resetViewOnRootChange=!1,this.graph2.foldingEnabled=!1,this.graph2.gridEnabled=!1,this.graph2.autoScroll=!1,this.graph2.setTooltips(!1),this.graph2.setConnectable(!1),this.graph2.setEnabled(!1),mxClient.IS_SVG||(this.graph2.view.canvas.style.position="relative"),this.tooltipImage=mxUtils.createImage(this.tooltipImage),this.tooltipImage.className="geSidebarTooltipImage",this.tooltipImage.style.zIndex=mxPopupMenu.prototype.zIndex-1,this.tooltipImage.style.position="absolute",this.tooltipImage.style.width="14px",this.tooltipImage.style.height="27px",document.body.appendChild(this.tooltipImage)),this.graph2.model.clear(),this.graph2.view.setTranslate(this.tooltipBorder,this.tooltipBorder),u>this.maxTooltipWidth||p>this.maxTooltipHeight?this.graph2.view.scale=Math.round(100*Math.min(this.maxTooltipWidth/u,this.maxTooltipHeight/p))/100:this.graph2.view.scale=1,this.tooltip.style.display="block",this.graph2.labelsVisible=null==v||v,this.graph2.addCells(m);var e=this.graph2.getGraphBounds(),n=e.width+2*this.tooltipBorder+4,t=e.height+2*this.tooltipBorder;if(mxClient.IS_QUIRKS?(t+=4,this.tooltip.style.overflow="hidden"):this.tooltip.style.overflow="visible",this.tooltipImage.style.visibility="visible",this.tooltip.style.width=n+"px",this.tooltipTitles&&null!=g&&0<g.length){null==this.tooltipTitle?(this.tooltipTitle=document.createElement("div"),this.tooltipTitle.style.borderTop="1px solid gray",this.tooltipTitle.style.textAlign="center",this.tooltipTitle.style.width="100%",this.tooltipTitle.style.overflow="hidden",mxClient.IS_SVG||(this.tooltipTitle.style.position="absolute"),this.tooltipTitle.style.paddingTop="6px",this.tooltip.appendChild(this.tooltipTitle)):this.tooltipTitle.innerHTML="",this.tooltipTitle.style.display="",mxUtils.write(this.tooltipTitle,g);var a=this.tooltipTitle.offsetHeight+10;t+=a,mxClient.IS_SVG?this.tooltipTitle.style.marginTop=2-a+"px":(t-=6,this.tooltipTitle.style.top=t-a+"px")}else null!=this.tooltipTitle&&null!=this.tooltipTitle.parentNode&&(this.tooltipTitle.style.display="none");this.tooltip.style.height=t+"px";var i=-Math.round(e.x-this.tooltipBorder),s=-Math.round(e.y-this.tooltipBorder),o=document.body,r=document.documentElement,l=(o.clientHeight||r.clientHeight,document.getElementById("vertical-navigation").offsetWidth+this.container.clientWidth),d=Math.max(0,this.getOffset(c).top-this.container.scrollTop-t/2+16);mxClient.IS_SVG?0!=i||0!=s?this.graph2.view.canvas.setAttribute("transform","translate("+i+","+s+")"):this.graph2.view.canvas.removeAttribute("transform"):(this.graph2.view.drawPane.style.left=i+"px",this.graph2.view.drawPane.style.top=s+"px"),this.tooltip.style.position="absolute",this.tooltip.style.left=l+"px",this.tooltip.style.top=d+"px",this.tooltipImage.style.left=l-13+"px",this.tooltipImage.style.top=d+t/2-13+"px"});null!=this.tooltip&&"none"!=this.tooltip.style.display?e():this.thread=window.setTimeout(e,this.tooltipDelay),this.currentElt=c}},Sidebar.prototype.hideTooltip=function(){null!=this.thread&&(window.clearTimeout(this.thread),this.thread=null),null!=this.tooltip&&(this.tooltip.style.display="none",this.tooltipImage.style.visibility="hidden",this.currentElt=null)},Sidebar.prototype.addEntry=function(e,n){if(null!=this.taglist&&null!=e&&0<e.length)for(var t=e.toLowerCase().replace(/[\/\,\(\)]/g," ").split(" "),a=0;a<t.length;a++)if(t[a]=t[a].replace(/\.*\d*$/,""),1<t[a].length){var i=this.taglist[t[a]];null==i&&(i={entries:[],dict:new mxDictionary},this.taglist[t[a]]=i),null==i.dict.get(n)&&(i.dict.put(n,n),i.entries.push(n))}return n},Sidebar.prototype.searchEntries=function(e,n,t,a,i){if(null!=this.taglist&&null!=e){for(var s=e.toLowerCase().split(" "),o=new mxDictionary,r=(t+1)*n,l=[],d=0,c=0;c<s.length;c++)if(0<s[c].length){var m=this.taglist[s[c]],u=new mxDictionary;if(null!=m){var p=m.entries;l=[];for(var g=0;g<p.length;g++){m=p[g];if(0==d==(null==o.get(m))&&(u.put(m,m),l.push(m),c==s.length-1&&l.length==r))return void a(l.slice(t*n,r),r,!0)}}else l=[];o=u,d++}var v=l.length;a(l.slice(t*n,(t+1)*n),v,!1)}else a([])},Sidebar.prototype.filterTags=function(e){if(null==e)return null;for(var n=e.split(" "),t=[],a={},i=0;i<n.length;i++)null==a[n[i]]&&(a[n[i]]="1",t.push(n[i]));return t.join(" ")},Sidebar.prototype.cloneCell=function(e,n){var t=e.clone();return null!=n&&(t.value=n),t},Sidebar.prototype.addSearchPalette=function(e){var n=document.createElement("div");n.style.visibility="hidden",this.container.appendChild(n);var r=document.createElement("div");r.className="geSidebar",r.style.boxSizing="border-box",r.style.overflow="hidden",r.style.width="100%",r.style.padding="8px",r.style.paddingTop="14px",r.style.paddingBottom="0px",e||(r.style.display="none");var t=document.createElement("div");t.style.whiteSpace="nowrap",t.style.textOverflow="clip",t.style.paddingBottom="8px",t.style.cursor="default";var a=document.createElement("input");a.setAttribute("placeholder",mxResources.get("searchShapes")),a.setAttribute("type","text"),a.style.fontSize="12px",a.style.overflow="hidden",a.style.boxSizing="border-box",a.style.border="solid 1px #d5d5d5",a.style.borderRadius="4px",a.style.width="100%",a.style.outline="none",a.style.padding="6px",t.appendChild(a);var i,s=document.createElement("img");s.setAttribute("src",Sidebar.prototype.searchImage),s.setAttribute("title",mxResources.get("search")),s.style.position="relative",s.style.left="-18px",mxClient.IS_QUIRKS?(a.style.height="28px",s.style.top="-4px"):s.style.top="2px",s.style.background="url('"+this.editorUi.editor.transparentImage+"')",t.appendChild(s),r.appendChild(t);var l=document.createElement("center"),d=mxUtils.button(mxResources.get("moreResults"),function(){i()});d.style.display="none",d.style.lineHeight="normal",d.style.marginTop="4px",d.style.marginBottom="8px",l.style.paddingTop="4px",l.style.paddingBottom="8px",l.appendChild(d),r.appendChild(l);var c="",m=!1,u=!1,p=0,g=new Object,v=12,h=mxUtils.bind(this,function(){m=!1,this.currentSearch=null;for(var e=r.firstChild;null!=e;){var n=e.nextSibling;e!=t&&e!=l&&e.parentNode.removeChild(e),e=n}});i=mxUtils.bind(this,function(){if(v=4*Math.max(1,Math.floor(this.container.clientWidth/(this.thumbWidth+10))),this.hideTooltip(),""!=a.value){if(null!=l.parentNode&&(c!=a.value&&(h(),c=a.value,g=new Object,u=!1,p=0),!m&&!u)){d.setAttribute("disabled","true"),d.style.display="",d.style.cursor="wait",d.innerHTML=mxResources.get("loading")+"...",m=!0;var o=new Object;this.currentSearch=o,this.searchEntries(c,v,p,mxUtils.bind(this,function(e,n,t){if(this.currentSearch==o){e=null!=e?e:[],m=!1,p++,l.parentNode.removeChild(l);for(var a=0;a<e.length;a++){var i=e[a]();null==g[i.innerHTML]&&(g[i.innerHTML]="1",r.appendChild(e[a]()))}if(t?(d.removeAttribute("disabled"),d.innerHTML=mxResources.get("moreResults")):(d.innerHTML=mxResources.get("reset"),d.style.display="none",u=!0),d.style.cursor="",0==e.length&&1==p){var s=document.createElement("div");s.className="geTitle",s.style.backgroundColor="transparent",s.style.borderColor="transparent",s.style.color="gray",s.style.padding="0px",s.style.margin="0px 8px 0px 8px",s.style.paddingTop="6px",s.style.textAlign="center",s.style.cursor="default",mxUtils.write(s,mxResources.get("noResultsFor",[c])),r.appendChild(s)}r.appendChild(l)}}),mxUtils.bind(this,function(){d.style.cursor=""}))}}else h(),a.value="",c="",g=new Object,d.style.display="none",u=!1,a.focus()}),mxEvent.addListener(a,"keydown",mxUtils.bind(this,function(e){13==e.keyCode&&i()})),mxEvent.addListener(a,"focus",function(){a.style.paddingRight="",s.style.display="none"}),mxEvent.addListener(a,"blur",function(){a.style.paddingRight="20px",s.style.display=""}),a.style.paddingRight="20px",mxEvent.addListener(a,"keyup",mxUtils.bind(this,function(e){""==a.value?(u=!0,d.style.display="none"):a.value!=c?(d.style.display="none",u=!1):m||(d.style.display=u?"none":"")})),mxEvent.addListener(a,"mousedown",function(e){e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0}),mxEvent.addListener(a,"selectstart",function(e){e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0});var o=document.createElement("div");o.appendChild(r),this.container.appendChild(o),this.palettes.search=[n,o]},Sidebar.prototype.createTitle=function(e){var n=document.createElement("a");return n.setAttribute("href","javascript:void(0);"),n.setAttribute("title",mxResources.get("sidebarTooltip")),n.className="geTitle",mxUtils.write(n,e),n},Sidebar.prototype.createThumb=function(e,n,t,a,i,s,o,r,l){this.graph.labelsVisible=null==s||s;var d=mxClient.NO_FO;mxClient.NO_FO=Editor.prototype.originalNoForeignObject,this.graph.view.scaleAndTranslate(1,0,0),this.graph.addCells(e);var c=this.graph.getGraphBounds(),m=Math.floor(100*Math.min((n-2*this.thumbBorder)/c.width,(t-2*this.thumbBorder)/c.height))/100;this.graph.view.scaleAndTranslate(m,Math.floor((n-c.width*m)/2/m-c.x),Math.floor((t-c.height*m)/2/m-c.y));var u=null;if(this.graph.dialect!=mxConstants.DIALECT_SVG||mxClient.NO_FO?(u=this.graph.container.cloneNode(!1)).innerHTML=this.graph.container.innerHTML:u=this.graph.view.getCanvas().ownerSVGElement.cloneNode(!0),this.graph.getModel().clear(),mxClient.NO_FO=d,mxClient.IS_IE6&&(a.style.backgroundImage="url("+this.editorUi.editor.transparentImage+")"),u.style.position="relative",u.style.overflow="hidden",u.style.cursor="move",u.style.left=this.thumbBorder+"px",u.style.top=this.thumbBorder+"px",u.style.width=n+"px",u.style.height=t+"px",u.style.visibility="",u.style.minWidth="",u.style.minHeight="",a.appendChild(u),this.sidebarTitles&&null!=i&&0!=o){var p=mxClient.IS_QUIRKS?2*this.thumbPadding+2:0;a.style.height=this.thumbHeight+p+this.sidebarTitleSize+8+"px";var g=document.createElement("div");g.style.fontSize=this.sidebarTitleSize+"px",g.style.color="#303030",g.style.textAlign="center",g.style.whiteSpace="nowrap",mxClient.IS_IE&&(g.style.height=this.sidebarTitleSize+12+"px"),g.style.paddingTop="4px",mxUtils.write(g,i),a.appendChild(g)}return c},Sidebar.prototype.createItem=function(n,t,a,e,i,s,o){var r=document.createElement("a");r.setAttribute("href","javascript:void(0);"),r.className="geItem",r.style.overflow="hidden";var l=mxClient.IS_QUIRKS?8+2*this.thumbPadding:2*this.thumbBorder;r.style.width=this.thumbWidth+l+"px",r.style.height=this.thumbHeight+l+"px",r.style.padding=this.thumbPadding+"px",mxEvent.addListener(r,"click",function(e){mxEvent.consume(e)}),this.createThumb(n,this.thumbWidth,this.thumbHeight,r,t,a,e,i,s);var d=new mxRectangle(0,0,i,s);if(1<n.length||n[0].vertex){var c=this.createDragSource(r,this.createDropHandler(n,!0,o,d),this.createDragPreview(i,s),n,d);this.addClickHandler(r,c,n),c.isGuidesEnabled=mxUtils.bind(this,function(){return this.editorUi.editor.graph.graphHandler.guidesEnabled})}else if(null!=n[0]&&n[0].edge){c=this.createDragSource(r,this.createDropHandler(n,!1,o,d),this.createDragPreview(i,s),n,d);this.addClickHandler(r,c,n)}return mxClient.IS_IOS||mxEvent.addGestureListeners(r,null,mxUtils.bind(this,function(e){this.showTooltip(r,n,d.width,d.height,t,a)})),r},Sidebar.prototype.createDropHandler=function(g,v,h,f){return h=null==h||h,mxUtils.bind(this,function(e,n,t,a,i){if(e.isEnabled()){if(0<(g=e.getImportableCells(g)).length){e.stopEditing();var s=null!=t&&e.isValidDropTarget(t,g,n),o=null;if(null==t||s||(t=null),!e.isCellLocked(t||e.getDefaultParent())){e.model.beginUpdate();try{if(a=Math.round(a),i=Math.round(i),v&&e.isSplitTarget(t,g,n)){var r=e.cloneCells(g);e.splitEdge(t,r,null,a-f.width/2,i-f.height/2),o=r}else 0<g.length&&(o=e.importCells(g,a,i,t));if(null!=e.layoutManager){var l=e.layoutManager.getLayout(t);if(null!=l)for(var d=e.view.scale,c=e.view.translate,m=(a+c.x)*d,u=(i+c.y)*d,p=0;p<o.length;p++)l.moveCell(o[p],m,u)}h&&e.fireEvent(new mxEventObject("cellsInserted","cells",o))}finally{e.model.endUpdate()}null!=o&&0<o.length&&(e.scrollCellToVisible(o[0]),e.setSelectionCells(o))}}mxEvent.consume(n)}})},Sidebar.prototype.createDragPreview=function(e,n){var t=document.createElement("div");return t.style.border="1px dashed black",t.style.width=e+"px",t.style.height=n+"px",t},Sidebar.prototype.createDragSource=function(e,n,t){var a=mxUtils.makeDraggable(e,this.editorUi.editor.graph,n,t,0,0,this.editorUi.editor.graph.autoscroll,!0,!0);return a.getDropTarget=function(e,n,t){var a=mxDragSource.prototype.getDropTarget.apply(this,arguments);return e.isValidRoot(a)||(a=null),a},a},Sidebar.prototype.addClickHandler=function(e,a){var i=this.editorUi.editor.graph,s=null;mxEvent.addGestureListeners(e,function(e){s=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e))});var o=a.mouseUp;a.mouseUp=function(e){if(!mxEvent.isPopupTrigger(e)&&null==this.currentGraph&&null!=s){var n=i.tolerance;if(Math.abs(s.x-mxEvent.getClientX(e))<=n&&Math.abs(s.y-mxEvent.getClientY(e))<=n){var t=i.getGridSize();a.drop(i,e,null,t,t)}}o.apply(this,arguments),s=null}},Sidebar.prototype.createVertexTemplateEntry=function(e,n,t,a,i,s,o,r){return r=null!=r&&0<r.length?r:i.toLowerCase(),this.addEntry(r,mxUtils.bind(this,function(){return this.createVertexTemplate(e,n,t,a,i,s,o)}))},Sidebar.prototype.createXmlDocument=function(e,n,t,a){var i=mxUtils.createXmlDocument().createElement(e);return i.setAttribute("label",n),t.forEach(function(e,n){i.setAttribute(e,a[n]?a[n]:"")}),i},Sidebar.prototype.createVertexTemplate=function(e,n,t,a,i,s,o,r){var l=[],d=[];switch(a){case"answer":l=["timeout"],d=["0"];break;case"start":l=["answer"],d=["yes"];break;case"googleasr":l=["key","google_asr_language","timeout","intKey","beep"],d=["","it-IT","10","#","BEEP"];break;case"tildeasr":l=["uri","appid","appsecret","timeout","intKey","beep"],d=["wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE","","","10","#","BEEP"];break;case"ispeechasr":l=["key","model","ispeech_asr_language","timeout","intKey","beep"],d=["","","it-IT","10","#","BEEP"];break;case"playback":l=["file_id","opts"],d=["0"];break;case"background":l=["file_id","response","digit"],d=["0","5","1"];break;case"menu":l=["file_id","response","digit","retry","variable_id"],d=["0","5","1","1","0"];break;case"getdigits":l=["file_id","response","mindigit","maxdigit","retry","variable_id"],d=["0","5","1","10","1","0"];break;case"getsecretdigits":l=["file_id","response","mindigit","maxdigit","retry","hiddendigitsnum","hiddendigitspos","variable_id"],d=["0","5","1","10","1","0","first","0"];break;case"custom_app":l=["application","options"],d=["",""];break;case"set":l=["variable_id","variable_value"],d=["0",""];break;case"database":l=["odbc_id","query","variable_id"],d=["0","",""];break;case"noop":l=["output"],d=[];break;case"gotoc":l=["context","extension","priority"],d=["","","1"];break;case"system":l=["variable_id","command"],d=[];break;case"agi":l=["command","args"],d=[];break;case"gotoif":l=["condition"],d=[];break;case"gotoiftime":l=["interval_id"],d=["0"];break;case"vswitch":l=["variable_id"],d=["0"];break;case"saydigits":l=["digits","escape_digits"],d=["","#"];break;case"saynumber":l=["number","escape_digits"],d=["","#"];break;case"sayphonetic":l=["text","escape_digits"],d=["","#"];break;case"record":l=["file","recordingFormat","timeout","escape_digits"],d=["","wav","-1","#"];break;case"dial":l=["sip_id","timeout","opts","url"],d=["0","60"];break;case"ext_dial":l=["phone","trunk_name","timeout","opts","url"],d=["","-1","60"];break;case"google_cloud_tts":l=["apiKey","google_cloud_tts_text_type","text","languageCode","ssmlGender"],d=["","text","","en-US","FEMALE"];break;case"tts":l=["text","google_tts_language"],d=["","it"];break;case"ispeechtts":l=["text","key","ispeech_tts_language","speed","intKey"],d=["","","euritalianfemale","0","#"];break;case"lumenvoxtts":case"sestektts":l=["text","options"],d=["",""];break;case"lumenvoxasr":l=["grammar","options"],d=["",""];break;case"sestekasr":l=["grammar","options"],d=["/usr/local/unimrcp/data/grammar.xml",""];break;case"awspolly":l=["aws_access_key_id","aws_secret_access_key","aws_polly_region","aws_polly_voice","text","aws_text_type"],d=["","","eu-west-1","Amy","","text"];break;case"awslex":l=["aws_access_key_id","aws_secret_access_key","aws_lex_region","aws_bot_name","text"],d=["","","eu-west-1","",""];break;case"queue":l=["queue_id","opts","url","file_id","timeout","agi","macro","gosub","position"],d=["-1","xX","","","300"];break;case"voicemail":l=["mailbox","options"],d=["",""];break;case"subproject":l=["project_id"],d=["0"];break;case"math":l=["operation","variable_id"],d=["","0"];break;case"queuelog":l=["queuename","agent","queue_event","data1","data2","data3","data4","data5"],d=[];break;case"goal":l=["goalname"],d=[];break;case"callback":l=["name","lastName","phone","dialTimezone","list_id","delay","callback_priority"],d=["{CALLERID(name)}","","{CALLERID(num)}","","-1","5","2"];break;case"sendSMS":l=["sms_account_id","to","sms_text"],d=["0"];break;case"sendMail":l=["account_id","to","cc","bcc","subject","text"],d=["0"];break;case"sendFax":l=["account_id","to","choose_attachment","attachment_name","attachment_type","attachment_path"],d=["0"];break;case"login":case"unpause":case"logout":l=["findBy"],d=["internal"];break;case"pause":l=["findBy","pause_id"],d=["internal",""];break;case"dialogflow":l=["key","text","dialogflow_language"],d=["","","it"];break;case"sesteknda":l=["ndauth_url","username","password","ndassistant_url","text","project","ndagenerate_audio","custom_action","custom_action_data","ndaactivity_type"],d=["","","","","","",1,"","","message"];break;case"restapi":l=["url","method","timeout","computedVariables","rawHeaders","rawBody","variable_id"],d=["","GET","5","","","",""];break;case"mrcpsynth":l=["text","options"],d=["",""];break;case"mrcprecog":l=["grammar","options"],d=["",""];break;case"dialogflowV2":l=["dialogflowV2_project_id","client_email","private_key","dialogflowV2_language","text"],d=["","","","en",""];break;default:l=[],d=[]}var c=[new mxCell(this.createXmlDocument(a,i,l,d),new mxGeometry(0,0,n,t),e)];return c[0].vertex=!0,this.createVertexTemplateFromCells(c,n,t,i,s,o,r)},Sidebar.prototype.createVertexTemplateFromCells=function(e,n,t,a,i,s,o){return this.createItem(e,a,i,s,n,t,o)},Sidebar.prototype.createEdgeTemplate=function(e,n,t,a,i,s,o){var r=new mxCell(null!=a?a:"",new mxGeometry(0,0,n,t),e);return r.geometry.setTerminalPoint(new mxPoint(0,t),!0),r.geometry.setTerminalPoint(new mxPoint(n,0),!1),r.geometry.relative=!0,r.edge=!0,this.createEdgeTemplateFromCells([r],n,t,i,s,o)},Sidebar.prototype.createEdgeTemplateFromCells=function(e,n,t,a,i,s){return this.createItem(e,a,i,!0,n,t,s)},Sidebar.prototype.addPaletteFunctions=function(e,n,t,a){this.addPalette(e,n,t,mxUtils.bind(this,function(e){for(var n=0;n<a.length;n++)e.appendChild(a[n](e))}))},Sidebar.prototype.addPalette=function(e,n,t,a){var i=this.createTitle(n);this.container.appendChild(i);var s=document.createElement("div");s.className="geSidebar",mxClient.IS_POINTER&&(s.style.touchAction="none"),mxEvent.addListener(s,"mousemove",mxUtils.bind(this,function(e){mxEvent.getSource(e)==s?s.setAttribute("title",mxResources.get("sidebarTooltip")):s.removeAttribute("title")})),t?(a(s),a=null):s.style.display="none",this.addFoldingHandler(i,s,a);var o=document.createElement("div");return o.appendChild(s),this.container.appendChild(o),null!=e&&(this.palettes[e]=[i,o]),s},Sidebar.prototype.addFoldingHandler=function(t,a,i){var s=!1;(!mxClient.IS_IE||8<=document.documentMode)&&(t.style.backgroundImage="none"==a.style.display?"url('"+this.collapsedImage+"')":"url('"+this.expandedImage+"')"),t.style.backgroundRepeat="no-repeat",t.style.backgroundPosition="0% 50%",mxEvent.addListener(t,"click",mxUtils.bind(this,function(e){if("none"==a.style.display){if(s)a.style.display="block";else if(s=!0,null!=i){t.style.cursor="wait";var n=t.innerHTML;t.innerHTML=mxResources.get("loading")+"...",window.setTimeout(function(){var e=mxClient.NO_FO;mxClient.NO_FO=Editor.prototype.originalNoForeignObject,i(a),mxClient.NO_FO=e,a.style.display="block",t.style.cursor="",t.innerHTML=n},0)}else a.style.display="block";t.style.backgroundImage="url('"+this.expandedImage+"')"}else t.style.backgroundImage="url('"+this.collapsedImage+"')",a.style.display="none";mxEvent.consume(e)}))},Sidebar.prototype.addImagePalette=function(e,n,s,o,r,t,a){for(var l=[],d=0;d<r.length;d++)mxUtils.bind(this,function(e,n,t){if(null==t){var a=e.lastIndexOf("/"),i=e.lastIndexOf(".");t=e.substring(0<=a?a+1:0,0<=i?i:e.length).replace(/[-_]/g," ")}l.push(this.createVertexTemplateEntry("image;html=1;image="+s+e+o,this.defaultImageWidth,this.defaultImageHeight,r[d],n,!1,!0,this.filterTags(t)))})(r[d],null!=t?t[d]:null,null!=a?a[r[d]]:null);this.addPaletteFunctions(e,n,!1,l)},"undefined"!=typeof html4&&(html4.ATTRIBS["a::target"]=0),mxConstants.SHADOW_OPACITY=.25,mxConstants.SHADOWCOLOR="#000000",mxConstants.VML_SHADOWCOLOR="#d0d0d0",mxGraph.prototype.pageBreakColor="#c0c0c0",mxGraph.prototype.pageScale=1,function(){try{if(null!=navigator&&null!=navigator.language){var e=navigator.language.toLowerCase();mxGraph.prototype.pageFormat="en-us"===e||"en-ca"===e||"es-mx"===e?mxConstants.PAGE_FORMAT_LETTER_PORTRAIT:mxConstants.PAGE_FORMAT_A4_PORTRAIT}}catch(e){}}(),mxText.prototype.baseSpacingTop=5,mxText.prototype.baseSpacingBottom=1,mxGraphModel.prototype.ignoreRelativeEdgeParent=!1,mxGraphView.prototype.gridImage=mxClient.IS_SVG?"data:image/gif;base64,R0lGODlhCgAKAJEAAAAAAP///8zMzP///yH5BAEAAAMALAAAAAAKAAoAAAIJ1I6py+0Po2wFADs=":IMAGE_PATH+"/grid.gif",mxGraphView.prototype.gridSteps=4,mxGraphView.prototype.minGridSize=4,mxGraphView.prototype.gridColor="#e0e0e0",mxSvgCanvas2D.prototype.foAltText="[Not supported by viewer]",Graph=function(e,n,t,a){mxGraph.call(this,e,n,t,a),this.setConnectable(!0),this.setDropEnabled(!1),this.setPanning(!0),this.setTooltips(!mxClient.IS_TOUCH),this.setAllowLoops(!1),this.setMultigraph(!1),this.allowAutoPanning=!0,this.resetEdgesOnConnect=!1,this.constrainChildren=!1,this.connectionHandler.targetConnectImage=!0,this.setAllowDanglingEdges(!1),this.connectionHandler.setCreateTarget(!1),this.connectionHandler.isValidSource=function(){return mxConnectionHandler.prototype.isValidSource.apply(this,arguments)&&"2"!=urlParams.connect},this.alternateEdgeStyle="vertical",null==a&&this.loadStylesheet();var i=new mxRubberband(this);this.getRubberband=function(){return i},this.panningHandler.addListener(mxEvent.PAN_START,mxUtils.bind(this,function(){this.container.style.cursor="pointer"})),this.panningHandler.addListener(mxEvent.PAN_END,mxUtils.bind(this,function(){this.container.style.cursor="default"})),this.isHtmlLabel=function(e){var n=this.view.getState(e),t=null!=n?n.style:this.getCellStyle(e);return"1"==t.html||"wrap"==t.whiteSpace},this.cellRenderer.getLabelValue=function(e){var n=mxCellRenderer.prototype.getLabelValue.apply(this,arguments);return"wrap"==e.style.whiteSpace&&1!=e.style.html&&(n=mxUtils.htmlEntities(n,!1)),n},this.isCellLocked=function(e){return!1},this.connectionHandler.tapAndHoldTolerance=16;var s=this.connectionHandler.tapAndHold;this.connectionHandler.tapAndHold=function(e,n){null==n?this.graph.panningHandler.active||(i.start(e.getGraphX(),e.getGraphY()),this.graph.panningHandler.panningTrigger=!1):tapAndHoldStartsConnection?s.apply(this,arguments):this.graph.isCellSelected(n.cell)&&1<this.graph.getSelectionCount()&&this.graph.removeSelectionCell(n.cell)},touchStyle&&this.initTouch()},mxUtils.extend(Graph,mxGraph),Graph.prototype.minFitScale=null,Graph.prototype.maxFitScale=null,Graph.prototype.loadStylesheet=function(){var e=mxUtils.load(STYLE_PATH+"/default.xml").getDocumentElement();new mxCodec(e.ownerDocument).decode(e,this.getStylesheet())},Graph.prototype.flipEdge=function(e){if(null!=e){var n=this.view.getState(e),t=null!=n?n.style:this.getCellStyle(e);if(null!=t){var a=mxUtils.getValue(t,mxConstants.STYLE_ELBOW,mxConstants.ELBOW_HORIZONTAL)==mxConstants.ELBOW_HORIZONTAL?mxConstants.ELBOW_VERTICAL:mxConstants.ELBOW_HORIZONTAL;this.setCellStyles(mxConstants.STYLE_ELBOW,a,[e])}}},Graph.prototype.setDefaultEdge=function(e){if(null!=e&&this.getModel().isEdge(e)){var n=this.getModel().cloneCells([e])[0];null!=n.geometry&&(n.geometry.points=null);var t=n.getStyle();t=mxUtils.setStyle(t,mxConstants.STYLE_ENTRY_X,null),t=mxUtils.setStyle(t,mxConstants.STYLE_ENTRY_Y,null),t=mxUtils.setStyle(t,mxConstants.STYLE_EXIT_X,null),t=mxUtils.setStyle(t,mxConstants.STYLE_EXIT_Y,null),n.setStyle(t),this.connectionHandler.createEdgeState=function(e){return this.graph.view.createState(n)},this.connectionHandler.factoryMethod=function(){return this.graph.cloneCells([n])[0]}}},Graph.prototype.isCellFoldable=function(e){return this.foldingEnabled&&this.isSwimlane(e)},Graph.prototype.isValidRoot=function(e){return this.isSwimlane(e)},Graph.prototype.createGroupCell=function(){var e=mxGraph.prototype.createGroupCell.apply(this,arguments);return e.setStyle("group"),e},Graph.prototype.getTooltipForCell=function(e){var n="";return this.getModel().isVertex(e)?n+=mxResources.get("description_"+e.value.nodeName)||"":this.getModel().isEdge(e)&&(n=mxGraph.prototype.getTooltipForCell.apply(this,arguments)),n},Graph.prototype.convertValueToString=function(e){return null!=e.value&&"object"==typeof e.value?e.value.getAttribute("label"):mxGraph.prototype.convertValueToString.apply(this,arguments)},Graph.prototype.cellLabelChanged=function(e,n,t){if(null!=e.value&&"object"==typeof e.value){var a=e.value.cloneNode(!0);a.setAttribute("label",n),n=a}mxGraph.prototype.cellLabelChanged.apply(this,arguments)},Graph.prototype.setLinkForCell=function(e,n){var t=null;null!=e.value&&"object"==typeof e.value?t=e.value.cloneNode(!0):(t=mxUtils.createXmlDocument().createElement("UserObject")).setAttribute("label",e.value);null!=n&&0<n.length?t.setAttribute("link",n):t.removeAttribute("link"),this.model.setValue(e,t)},Graph.prototype.getLinkForCell=function(e){return null!=e.value&&"object"==typeof e.value?e.value.getAttribute("link"):null},Graph.prototype.initTouch=function(){this.connectionHandler.marker.isEnabled=function(){return null!=this.graph.connectionHandler.first},this.addListener(mxEvent.START_EDITING,function(e,n){this.panningHandler.hideMenu()});var s=!1,o=null;this.updateMouseEvent=function(e){if(mxGraph.prototype.updateMouseEvent.apply(this,arguments),null==e.getState()){var n=this.getCellAt(e.graphX,e.graphY);this.getModel().isEdge(n)&&(e.state=this.view.getState(n),null!=e.state&&null!=e.state.shape&&(this.container.style.cursor=e.state.shape.node.style.cursor))}null==e.getState()&&(this.container.style.cursor="default")},this.fireMouseEvent=function(e,n,t){if(e==mxEvent.MOUSE_DOWN)this.panningHandler.isMenuShowing()?(s=!1,o=null):(o=n.getCell(),s=null!=o?this.isCellSelected(o):this.isSelectionEmpty());else if(e==mxEvent.MOUSE_UP){if(s&&!this.isEditing()){if(!this.panningHandler.isMenuShowing()){var a=mxEvent.getClientX(n.getEvent()),i=mxEvent.getClientY(n.getEvent());this.panningHandler.popup(a+16,i,o,n.getEvent())}return s=!1,o=null,void n.consume()}s=!1,o=null}mxGraph.prototype.fireMouseEvent.apply(this,arguments),e==mxEvent.MOUSE_MOVE&&n.isConsumed()&&(s=!1,o=null)}},function(){if(mxVertexHandler.prototype.rotationEnabled=!0,mxText.prototype.baseSpacingTop=5,mxText.prototype.baseSpacingBottom=1,touchStyle){mxConstants.HANDLE_SIZE=16,mxConstants.LABEL_HANDLE_SIZE=7,mxClient.IS_TOUCH&&(mxVertexHandler.prototype.tolerance=4,mxEdgeHandler.prototype.tolerance=6,Graph.prototype.tolerance=14,Graph.prototype.gridSize=20,mxPanningHandler.prototype.selectOnPopup=!1,mxPanningHandler.prototype.useLeftButtonForPanning=!0,mxPanningHandler.prototype.isPanningTrigger=function(e){var n=e.getEvent();return this.useLeftButtonForPanning&&(this.ignoreCell||null==e.getState())||mxEvent.isControlDown(n)&&mxEvent.isShiftDown(n)||this.usePopupTrigger&&mxEvent.isPopupTrigger(n)});var t=mxGraphHandler.prototype.mouseDown;mxGraphHandler.prototype.mouseDown=function(e,n){t.apply(this,arguments),this.graph.isCellSelected(n.getCell())&&1<this.graph.getSelectionCount()&&(this.delayedSelection=!1)},Graph.prototype.createHandlers=function(e){this.tooltipHandler=new mxTooltipHandler(this),this.tooltipHandler.setEnabled(!1),this.selectionCellsHandler=new mxSelectionCellsHandler(this),this.panningHandler=new mxPanningHandler(this),this.panningHandler.panningEnabled=!1,this.connectionHandler=new mxConnectionHandler(this),this.connectionHandler.setEnabled(!1),this.graphHandler=new mxGraphHandler(this)},mxConnectionHandler.prototype.selectCells=function(e,n){touchStyle&&null!=n?this.graph.setSelectionCell(n):this.graph.setSelectionCell(e)};var a=mxGraph.prototype.dblClick;Graph.prototype.dblClick=function(e,n){if(null==n){var t=mxUtils.convertPoint(this.container,mxEvent.getClientX(e),mxEvent.getClientY(e));n=this.getCellAt(t.x,t.y)}a.call(this,e,n)};var e=new mxImage(IMAGE_PATH+"/touch-handle.png",16,16);mxVertexHandler.prototype.handleImage=e,mxEdgeHandler.prototype.handleImage=e,mxOutline.prototype.sizerImage=e,(new Image).src=e.src;var n=IMAGE_PATH+"/touch-connector.png",i=mxVertexHandler.prototype.init;mxVertexHandler.prototype.init=function(){i.apply(this,arguments),showConnectorImg&&this.graph.connectionHandler.isEnabled()&&this.graph.isCellConnectable(this.state.cell)&&!this.graph.isValidRoot(this.state.cell)&&1==this.graph.getSelectionCount()&&(this.connectorImg=mxUtils.createImage(n),this.connectorImg.style.cursor="pointer",this.connectorImg.style.width="29px",this.connectorImg.style.height="29px",this.connectorImg.style.position="absolute",mxClient.IS_TOUCH||(this.connectorImg.setAttribute("title",mxResources.get("connect")),mxEvent.redirectMouseEvents(this.connectorImg,this.graph,this.state)),this.connectorImg.style.padding="2px",mxEvent.addGestureListeners(this.connectorImg,mxUtils.bind(this,function(e){this.graph.panningHandler.hideMenu();var n=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));this.graph.connectionHandler.start(this.state,n.x,n.y),this.graph.isMouseDown=!0,mxEvent.consume(e)})),this.graph.container.appendChild(this.connectorImg)),this.redrawTools()};var s=mxVertexHandler.prototype.redraw;mxVertexHandler.prototype.redraw=function(){s.apply(this),this.redrawTools()},mxVertexHandler.prototype.redrawTools=function(){null!=this.state&&null!=this.connectorImg&&(mxVertexHandler.prototype.singleSizer?(this.connectorImg.style.left=this.state.x+this.state.width-this.connectorImg.offsetWidth/2+"px",this.connectorImg.style.top=this.state.y-this.connectorImg.offsetHeight/2+"px"):(this.connectorImg.style.left=this.state.x+this.state.width+mxConstants.HANDLE_SIZE/2+4+"px",this.connectorImg.style.top=this.state.y+(this.state.height-this.connectorImg.offsetHeight)/2+"px"))};var o=mxVertexHandler.prototype.destroy;mxVertexHandler.prototype.destroy=function(e,n){o.apply(this,arguments),null!=this.connectorImg&&(this.connectorImg.parentNode.removeChild(this.connectorImg),this.connectorImg=null)},(new Image).src=n}else{var r=new mxImage(IMAGE_PATH+"/connector.png",15,15);if(mxConnectionHandler.prototype.connectImage=r,(new Image).src=r.src,"2"==urlParams.connect){r=new mxImage(IMAGE_PATH+"/connector.png",15,15),i=mxVertexHandler.prototype.init;mxVertexHandler.prototype.init=function(){i.apply(this,arguments),showConnectorImg&&this.graph.connectionHandler.isEnabled()&&this.graph.isCellConnectable(this.state.cell)&&!this.graph.isValidRoot(this.state.cell)&&1==this.graph.getSelectionCount()&&(mxClient.IS_IE&&!mxClient.IS_SVG?(this.connectorImg=document.createElement("div"),this.connectorImg.style.backgroundImage="url("+r.src+")",this.connectorImg.style.backgroundPosition="center",this.connectorImg.style.backgroundRepeat="no-repeat",this.connectorImg.style.width=r.width+4+"px",this.connectorImg.style.height=r.height+4+"px",this.connectorImg.style.display=mxClient.IS_QUIRKS?"inline":"inline-block"):(this.connectorImg=mxUtils.createImage(r.src),this.connectorImg.style.width=r.width+"px",this.connectorImg.style.height=r.height+"px"),this.connectorImg.style.cursor="pointer",this.connectorImg.style.position="absolute",this.connectorImg.setAttribute("title",mxResources.get("connect")),mxEvent.redirectMouseEvents(this.connectorImg,this.graph,this.state),this.connectorImg.style.padding="2px",mxEvent.addListener(this.connectorImg,"mousedown",mxUtils.bind(this,function(e){this.graph.panningHandler.hideMenu();var n=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));this.graph.connectionHandler.start(this.state,n.x,n.y),this.graph.isMouseDown=!0,mxEvent.consume(e)})),this.graph.container.appendChild(this.connectorImg)),this.redrawTools()};s=mxVertexHandler.prototype.redraw;mxVertexHandler.prototype.redraw=function(){s.apply(this),this.redrawTools()},mxVertexHandler.prototype.redrawTools=function(){null!=this.state&&null!=this.connectorImg&&(mxVertexHandler.prototype.singleSizer?(this.connectorImg.style.left=this.state.x+this.state.width-this.connectorImg.offsetWidth/2+"px",this.connectorImg.style.top=this.state.y-this.connectorImg.offsetHeight/2+"px"):(this.connectorImg.style.left=this.state.x+this.state.width+mxConstants.HANDLE_SIZE/2+2+"px",this.connectorImg.style.top=this.state.y+(this.state.height-this.connectorImg.offsetHeight)/2+"px"))};o=mxVertexHandler.prototype.destroy;mxVertexHandler.prototype.destroy=function(e,n){o.apply(this,arguments),null!=this.connectorImg&&(this.connectorImg.parentNode.removeChild(this.connectorImg),this.connectorImg=null)}}}}(),Actions.prototype.init=function(){var n=this.editorUi,l=n.editor,d=l.graph;this.addAction("new",function(){n.projectDesignController.newProject()},CRUD_PERMISSIONS.canEdit),this.addAction("open",function(){n.projectDesignController.openProject()},CRUD_PERMISSIONS.canEdit),this.addAction("save",function(){n.projectDesignController.saveOrPublishProject(mxUtils.getPrettyXml(l.getGraphXml())),n.editor.modified=!1},CRUD_PERMISSIONS.canEdit,null,"Ctrl+S"),this.addAction("saveAs",function(){n.projectDesignController.saveProjectAs(mxUtils.getPrettyXml(l.getGraphXml()))},CRUD_PERMISSIONS.canEdit,null,"Ctrl+Shift+S"),this.addAction("publish",function(){n.editor.setStatus(""),null===n.validate()?(n.projectDesignController.saveOrPublishProject(mxUtils.getPrettyXml(l.getGraphXml()),!0),n.editor.modified=!1):(n.editor.setStatus("...Error publishing! Please check the project and try again!"),setTimeout(function(){n.editor.setStatus("")},3e3))},CRUD_PERMISSIONS.canEdit,null,"Ctrl+Shift+P"),this.addAction("variable",function(){n.projectDesignController.newVariable()},CRUD_PERMISSIONS.canEdit),this.addAction("import",function(){n.projectDesignController.importXML(function(e){l.setGraphXml(mxUtils.parseXml(e).documentElement)})},CRUD_PERMISSIONS.canEdit),this.addAction("export",function(){n.exportXML(mxUtils.getPrettyXml(l.getGraphXml()))},null,null,"Ctrl+E"),this.addAction("editFile",function(){n.projectDesignController.editXML(mxUtils.getPrettyXml(l.getGraphXml()),function(e){l.setGraphXml(mxUtils.parseXml(e).documentElement)})},CRUD_PERMISSIONS.canEdit),this.addAction("print",function(){mxUtils.printScreen(d)},null,"sprite-print","Ctrl+P"),this.addAction("preview",function(){mxUtils.show(d,null,10,10)}),this.addAction("undo",function(){l.undoManager.undo()},null,"sprite-undo","Ctrl+Z"),this.addAction("redo",function(){l.undoManager.redo()},null,"sprite-redo","Ctrl+Y"),this.addAction("cut",function(){mxClipboard.cut(d)},null,"sprite-cut","Ctrl+X"),this.addAction("copy",function(){mxClipboard.copy(d)},null,"sprite-copy","Ctrl+C"),this.addAction("paste",function(){mxClipboard.paste(d)},!1,"sprite-paste","Ctrl+V"),this.addAction("delete",function(){d.removeCells()},null,null,"Delete"),this.addAction("duplicate",function(){var e=d.gridSize;d.setSelectionCells(d.moveCells(d.getSelectionCells(),e,e,!0))},null,null,"Ctrl+D"),this.addAction("selectVertices",function(){d.selectVertices()},null,null,"Ctrl+Shift+V"),this.addAction("selectEdges",function(){d.selectEdges()},null,null,"Ctrl+Shift+E"),this.addAction("selectAll",function(){d.selectAll()},null,null,"Ctrl+A"),this.addAction("home",function(){d.home()},null,null,"Home"),this.addAction("exitGroup",function(){d.exitGroup()},null,null,"Page Up"),this.addAction("enterGroup",function(){d.enterGroup()},null,null,"Page Down"),this.addAction("expand",function(){d.foldCells(!1)},null,null,"Enter"),this.addAction("collapse",function(){d.foldCells(!0)},null,null,"Backspace"),this.addAction("toFront",function(){d.orderCells(!1)},null,null,"Ctrl+F"),this.addAction("toBack",function(){d.orderCells(!0)},null,null,"Ctrl+B"),this.addAction("group",function(){d.setSelectionCell(d.groupCells(null,0))},null,null,"Ctrl+G"),this.addAction("ungroup",function(){d.setSelectionCells(d.ungroupCells())},null,null,"Ctrl+U"),this.addAction("removeFromGroup",function(){d.removeCellsFromParent()}),this.addAction("editLink",function(){var e=d.getSelectionCell(),n=d.getLinkForCell(e);null==n&&(n=""),null!=(n=mxUtils.prompt(mxResources.get("enterValue"),n))&&d.setLinkForCell(e,n)}),this.addAction("openLink",function(){var e=d.getSelectionCell(),n=d.getLinkForCell(e);null!=n&&window.open(n)}),this.addAction("autosize",function(){var e=d.getSelectionCells();if(null!=e){d.getModel().beginUpdate();try{for(var n=0;n<e.length;n++){var t=e[n];d.getModel().getChildCount(t)?d.updateGroupBounds([t],20):d.updateCellSize(t)}}finally{d.getModel().endUpdate()}}}),this.addAction("wordWrap",function(){var e=d.getView().getState(d.getSelectionCell()),n="wrap";null!=e&&"wrap"==e.style[mxConstants.STYLE_WHITE_SPACE]&&(n=null),d.setCellStyles(mxConstants.STYLE_WHITE_SPACE,n)}),this.addAction("rotation",function(){var e="0",n=d.getView().getState(d.getSelectionCell());null!=n&&(e=n.style[mxConstants.STYLE_ROTATION]||e),null!=(e=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("rotation")+" 0-360)",e))&&d.setCellStyles(mxConstants.STYLE_ROTATION,e)}),this.addAction("tilt",function(){var e=d.getSelectionCells();if(null!=e){d.getModel().beginUpdate();try{for(var n=0;n<e.length;n++){var t=e[n];if(d.getModel().isVertex(t)&&0==d.getModel().getChildCount(t)){var a=d.getCellGeometry(t);if(null!=a){(a=a.clone()).x+=a.width/2-a.height/2,a.y+=a.height/2-a.width/2;var i=a.width;a.width=a.height,a.height=i,d.getModel().setGeometry(t,a);var s=d.view.getState(t);if(null!=s){var o=s.style[mxConstants.STYLE_DIRECTION]||"east";"east"==o?o="south":"south"==o?o="west":"west"==o?o="north":"north"==o&&(o="east"),d.setCellStyles(mxConstants.STYLE_DIRECTION,o,[t])}}}}}finally{d.getModel().endUpdate()}}},null,null,"Ctrl+R"),this.addAction("actualSize",function(){d.zoomTo(1)}),this.addAction("zoomIn",function(){d.zoomIn()},null,null,"Add"),this.addAction("zoomOut",function(){d.zoomOut()},null,null,"Subtract"),this.addAction("fitWindow",function(){d.fit()}),this.addAction("fitPage",mxUtils.bind(this,function(){d.pageVisible||this.get("pageView").funct();var e=d.pageFormat,n=d.pageScale,t=d.container.clientWidth-20,a=d.container.clientHeight-20,i=Math.floor(100*Math.min(t/e.width/n,a/e.height/n))/100;d.zoomTo(i),d.container.scrollLeft=Math.round(d.view.translate.x*i-Math.max(10,(d.container.clientWidth-e.width*n*i)/2)),d.container.scrollTop=Math.round(d.view.translate.y*i-Math.max(10,(d.container.clientHeight-e.height*n*i)/2))})),this.addAction("fitPageWidth",mxUtils.bind(this,function(){d.pageVisible||this.get("pageView").funct();var e=d.pageFormat,n=d.pageScale,t=d.container.clientWidth-20,a=Math.floor(100*t/e.width/n)/100;d.zoomTo(a),d.container.scrollLeft=Math.round(d.view.translate.x*a-Math.max(10,(d.container.clientWidth-e.width*n*a)/2)),d.container.scrollTop=Math.round(d.view.translate.y*a-Math.max(10,(d.container.clientHeight-e.height*n*a)/2))})),this.put("customZoom",new Action(mxResources.get("custom"),function(){var e=mxUtils.prompt(mxResources.get("enterValue")+" (%)",parseInt(100*d.getView().getScale()));null!=e&&0<e.length&&!isNaN(parseInt(e))&&d.zoomTo(parseInt(e)/100)}));var e=null;(e=this.addAction("grid",function(){d.setGridEnabled(!d.isGridEnabled()),l.updateGraphComponents()},null,null,"Ctrl+Shift+G")).setToggleAction(!0),e.setSelectedCallback(function(){return d.isGridEnabled()}),(e=this.addAction("guides",function(){d.graphHandler.guidesEnabled=!d.graphHandler.guidesEnabled})).setToggleAction(!0),e.setSelectedCallback(function(){return d.graphHandler.guidesEnabled}),(e=this.addAction("tooltips",function(){d.tooltipHandler.setEnabled(!d.tooltipHandler.isEnabled())})).setToggleAction(!0),e.setSelectedCallback(function(){return d.tooltipHandler.isEnabled()}),(e=this.addAction("navigation",function(){d.foldingEnabled=!d.foldingEnabled,d.view.revalidate()})).setToggleAction(!0),e.setSelectedCallback(function(){return d.foldingEnabled}),(e=this.addAction("scrollbars",function(){if(d.scrollbars=!d.scrollbars,l.updateGraphComponents(),d.scrollbars){var e=d.view.translate.x,n=d.view.translate.y;d.view.translate.x=0,d.view.translate.y=0,d.sizeDidChange(),d.container.scrollLeft-=Math.round(e*d.view.scale),d.container.scrollTop-=Math.round(n*d.view.scale)}else{var t=d.view.translate;d.view.setTranslate(t.x-d.container.scrollLeft/d.view.scale,t.y-d.container.scrollTop/d.view.scale),d.container.scrollLeft=0,d.container.scrollTop=0,d.sizeDidChange()}},!mxClient.IS_TOUCH)).setToggleAction(!0),e.setSelectedCallback(function(){return"auto"==d.container.style.overflow}),(e=this.addAction("pageView",mxUtils.bind(this,function(){d.pageVisible=!d.pageVisible,d.pageBreaksVisible=d.pageVisible,d.preferPageSize=d.pageBreaksVisible,d.view.validate(),d.sizeDidChange(),l.updateGraphComponents(),l.outline.update(),mxUtils.hasScrollbars(d.container)&&(d.pageVisible?(d.container.scrollLeft-=20,d.container.scrollTop-=20):(d.container.scrollLeft+=20,d.container.scrollTop+=20))}))).setToggleAction(!0),e.setSelectedCallback(function(){return d.pageVisible}),(e=this.addAction("connect",function(){d.setConnectable(!d.connectionHandler.isEnabled())},null,null,"Ctrl+Q")).setToggleAction(!0),e.setSelectedCallback(function(){return d.connectionHandler.isEnabled()}),(e=this.addAction("copyConnect",function(){d.connectionHandler.setCreateTarget(!d.connectionHandler.isCreateTarget())})).setToggleAction(!0),e.setSelectedCallback(function(){return d.connectionHandler.isCreateTarget()}),this.addAction("help",function(){window.open("https://wiki.xcallymotion.com/display/XMV/Cally+Square")}),this.put("about",new Action(mxResources.get("about")+" Cally Square",function(){window.open("http://callysquare.com/")},null,null,null));var t=mxUtils.bind(this,function(e,n){this.addAction(e,function(){d.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,n)})});t("bold",mxConstants.FONT_BOLD),t("italic",mxConstants.FONT_ITALIC),t("underline",mxConstants.FONT_UNDERLINE),this.addAction("shadow",function(){d.toggleCellStyles(mxConstants.STYLE_SHADOW)}),this.addAction("dashed",function(){d.toggleCellStyles(mxConstants.STYLE_DASHED)}),this.addAction("rounded",function(){d.toggleCellStyles(mxConstants.STYLE_ROUNDED)}),this.addAction("curved",function(){d.toggleCellStyles(mxConstants.STYLE_CURVED)}),this.addAction("style",function(){var e=d.getSelectionCells();if(null!=e&&0<e.length){var n=d.getModel(),t=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("style")+")",n.getStyle(e[0])||"");null!=t&&d.setCellStyle(t,e)}}),this.addAction("setAsDefaultEdge",function(){d.setDefaultEdge(d.getSelectionCell())}),this.addAction("addWaypoint",function(){var e=d.getSelectionCell();if(null!=e&&d.getModel().isEdge(e)){var n=l.graph.selectionCellsHandler.getHandler(e);if(n instanceof mxEdgeHandler){var t=d.view.translate,a=d.view.scale,i=t.x,s=t.y,o=d.getModel().getParent(e),r=d.getCellGeometry(o);d.getModel().isVertex(o)&&null!=r&&(i+=r.x,s+=r.y),n.addPointAt(n.state,d.panningHandler.triggerX/a-i,d.panningHandler.triggerY/a-s)}}}),this.addAction("removeWaypoint",function(){var e=n.actions.get("removeWaypoint");null!=e.handler&&e.handler.removePoint(e.handler.state,e.index)}),this.addAction("image",function(){var e="",n=d.getView().getState(d.getSelectionCell());if(null!=n&&(e=n.style[mxConstants.STYLE_IMAGE]||e),null!=(e=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("url")+")",e))&&0<e.length){var t=new Image;t.onload=function(){!function(e,n,t){var a=null,i=d.getSelectionCells();d.getModel().beginUpdate();try{if(0==i.length){var s=d.getGridSize();a=i=[d.insertVertex(d.getDefaultParent(),null,"",s,s,n,t)]}if(d.setCellStyles(mxConstants.STYLE_IMAGE,e,i),d.setCellStyles(mxConstants.STYLE_SHAPE,"image",i),1==d.getSelectionCount()&&null!=n&&null!=t){var o=i[0],r=d.getModel().getGeometry(o);null!=r&&((r=r.clone()).width=n,r.height=t,d.getModel().setGeometry(o,r))}}finally{d.getModel().endUpdate()}null!=a&&(d.setSelectionCells(a),d.scrollCellToVisible(a[0]))}(e,t.width,t.height)},t.onerror=function(){mxUtils.alert(mxResources.get("fileNotFound"))},t.src=e}})},Actions.prototype.addAction=function(e,n,t,a,i){return this.put(e,new Action(mxResources.get(e),n,t,a,i))},Actions.prototype.put=function(e,n){return this.actions[e]=n},Actions.prototype.get=function(e){return this.actions[e]},mxUtils.extend(Action,mxEventSource),Action.prototype.setEnabled=function(e){this.enabled!=e&&(this.enabled=e,this.fireEvent(new mxEventObject("stateChanged")))},Action.prototype.setToggleAction=function(e){this.toggleAction=e},Action.prototype.setSelectedCallback=function(e){this.selectedCallback=e},Action.prototype.isSelected=function(){return this.selectedCallback()},Menus=function(e){this.editorUi=e,this.menus=new Object,this.init(),(new Image).src=IMAGE_PATH+"/checkmark.gif"},Menus.prototype.init=function(){var i=this.editorUi.editor.graph;this.put("fontFamily",new Menu(mxUtils.bind(this,function(e,n){for(var t=["Helvetica","Verdana","Times New Roman","Garamond","Comic Sans MS","Courier New","Georgia","Lucida Console","Tahoma"],a=0;a<t.length;a++){this.styleChange(e,t[a],[mxConstants.STYLE_FONTFAMILY],[t[a]],null,n).firstChild.nextSibling.style.fontFamily=t[a]}e.addSeparator(n),this.promptChange(e,mxResources.get("custom"),"",mxConstants.DEFAULT_FONTFAMILY,mxConstants.STYLE_FONTFAMILY,n)}))),this.put("fontSize",new Menu(mxUtils.bind(this,function(e,n){for(var t=[6,8,9,10,11,12,14,18,24,36,48,72],a=0;a<t.length;a++)this.styleChange(e,t[a],[mxConstants.STYLE_FONTSIZE],[t[a]],null,n);e.addSeparator(n),this.promptChange(e,mxResources.get("custom"),"(pt)","12",mxConstants.STYLE_FONTSIZE,n)}))),this.put("linewidth",new Menu(mxUtils.bind(this,function(e,n){for(var t=[1,2,3,4,8,12,16,24],a=0;a<t.length;a++)this.styleChange(e,t[a]+"px",[mxConstants.STYLE_STROKEWIDTH],[t[a]],null,n);e.addSeparator(n),this.promptChange(e,mxResources.get("custom"),"(px)","1",mxConstants.STYLE_STROKEWIDTH,n)}))),this.put("line",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("straight"),[mxConstants.STYLE_EDGE],[null],null,n),this.styleChange(e,mxResources.get("entityRelation"),[mxConstants.STYLE_EDGE],["entityRelationEdgeStyle"],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("horizontal"),[mxConstants.STYLE_EDGE,mxConstants.STYLE_ELBOW],["elbowEdgeStyle","horizontal"],null,n),this.styleChange(e,mxResources.get("vertical"),[mxConstants.STYLE_EDGE,mxConstants.STYLE_ELBOW],["elbowEdgeStyle","vertical"],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("manual"),[mxConstants.STYLE_EDGE],["segmentEdgeStyle"],null,n),this.styleChange(e,mxResources.get("automatic"),[mxConstants.STYLE_EDGE],["orthogonalEdgeStyle"],null,n)}))),this.put("lineend",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("classic"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_CLASSIC],null,n),this.styleChange(e,mxResources.get("openArrow"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_OPEN],null,n),this.styleChange(e,mxResources.get("block"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_BLOCK],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("oval"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_OVAL],null,n),this.styleChange(e,mxResources.get("diamond"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_DIAMOND],null,n),this.styleChange(e,mxResources.get("diamondThin"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_DIAMOND_THIN],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("none"),[mxConstants.STYLE_ENDARROW],[mxConstants.NONE],null,n),e.addSeparator(n),e.addItem(mxResources.get("transparent"),null,function(){i.toggleCellStyles("endFill",!0)},n,null,!0),e.addSeparator(n),this.promptChange(e,mxResources.get("size"),"(px)",mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_ENDSIZE,n)}))),this.put("linestart",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("classic"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_CLASSIC],null,n),this.styleChange(e,mxResources.get("openArrow"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_OPEN],null,n),this.styleChange(e,mxResources.get("block"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_BLOCK],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("oval"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_OVAL],null,n),this.styleChange(e,mxResources.get("diamond"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_DIAMOND],null,n),this.styleChange(e,mxResources.get("diamondThin"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_DIAMOND_THIN],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("none"),[mxConstants.STYLE_STARTARROW],[mxConstants.NONE],null,n),e.addSeparator(n),e.addItem(mxResources.get("transparent"),null,function(){i.toggleCellStyles("startFill",!0)},n,null,!0),e.addSeparator(n),this.promptChange(e,mxResources.get("size"),"(px)",mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_STARTSIZE,n)}))),this.put("spacing",new Menu(mxUtils.bind(this,function(e,n){var t=this.editorUi.actions.get("shadow").enabled,a=this.get("line").enabled;(t||e.showDisabled)&&(this.promptChange(e,mxResources.get("top"),"(px)","0",mxConstants.STYLE_SPACING_TOP,n,t),this.promptChange(e,mxResources.get("right"),"(px)","0",mxConstants.STYLE_SPACING_RIGHT,n,t),this.promptChange(e,mxResources.get("bottom"),"(px)","0",mxConstants.STYLE_SPACING_BOTTOM,n,t),this.promptChange(e,mxResources.get("left"),"(px)","0",mxConstants.STYLE_SPACING_LEFT,n,t),e.addSeparator(n),this.promptChange(e,mxResources.get("global"),"(px)","0",mxConstants.STYLE_SPACING,n,t),this.promptChange(e,mxResources.get("perimeter"),"(px)","0",mxConstants.STYLE_PERIMETER_SPACING,n,t)),(a||e.showDisabled)&&(e.addSeparator(n),this.promptChange(e,mxResources.get("sourceSpacing"),"(px)","0",mxConstants.STYLE_SOURCE_PERIMETER_SPACING,n,a),this.promptChange(e,mxResources.get("targetSpacing"),"(px)","0",mxConstants.STYLE_TARGET_PERIMETER_SPACING,n,a))}))),this.put("format",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItem(e,"style",n)}))),this.put("text",new Menu(mxUtils.bind(this,function(e,n){var t=this.get("text").enabled;e.addSeparator(n),this.addSubmenu("fontFamily",e,n),this.addSubmenu("fontSize",e,n),this.addMenuItems(e,["-","bold","italic","underline","-"],n),this.addSubmenu("alignment",e,n),this.addMenuItem(e,"wordWrap",n),e.addSeparator(n),this.promptChange(e,mxResources.get("textOpacity"),"(%)","100",mxConstants.STYLE_TEXT_OPACITY,n,t),e.addItem(mxResources.get("hide"),null,function(){i.toggleCellStyles(mxConstants.STYLE_NOLABEL,!1)},n,null,t)}))),this.put("alignment",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("leftAlign"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_LEFT],null,n),this.styleChange(e,mxResources.get("center"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_CENTER],null,n),this.styleChange(e,mxResources.get("rightAlign"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_RIGHT],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("topAlign"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_TOP],null,n),this.styleChange(e,mxResources.get("middle"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_MIDDLE],null,n),this.styleChange(e,mxResources.get("bottomAlign"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_BOTTOM],null,n),e.addSeparator(n),this.addSubmenu("position",e,n),this.addSubmenu("spacing",e,n),e.addSeparator(n);var t=this.get("text").enabled;e.addItem(mxResources.get("vertical"),null,function(){i.toggleCellStyles(mxConstants.STYLE_HORIZONTAL,!0)},n,null,t)}))),this.put("position",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("left"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_LEFT,mxConstants.ALIGN_RIGHT],null,n),this.styleChange(e,mxResources.get("center"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_CENTER,mxConstants.ALIGN_CENTER],null,n),this.styleChange(e,mxResources.get("right"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_RIGHT,mxConstants.ALIGN_LEFT],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("top"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_TOP,mxConstants.ALIGN_BOTTOM],null,n),this.styleChange(e,mxResources.get("middle"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_MIDDLE,mxConstants.ALIGN_MIDDLE],null,n),this.styleChange(e,mxResources.get("bottom"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_BOTTOM,mxConstants.ALIGN_TOP],null,n)}))),this.put("direction",new Menu(mxUtils.bind(this,function(e,n){e.addItem(mxResources.get("flipH"),null,function(){i.toggleCellStyles(mxConstants.STYLE_FLIPH,!1)},n),e.addItem(mxResources.get("flipV"),null,function(){i.toggleCellStyles(mxConstants.STYLE_FLIPV,!1)},n),this.addMenuItems(e,["-","tilt","rotation"],n)}))),this.put("align",new Menu(mxUtils.bind(this,function(e,n){e.addItem(mxResources.get("leftAlign"),null,function(){i.alignCells(mxConstants.ALIGN_LEFT)},n),e.addItem(mxResources.get("center"),null,function(){i.alignCells(mxConstants.ALIGN_CENTER)},n),e.addItem(mxResources.get("rightAlign"),null,function(){i.alignCells(mxConstants.ALIGN_RIGHT)},n),e.addSeparator(n),e.addItem(mxResources.get("topAlign"),null,function(){i.alignCells(mxConstants.ALIGN_TOP)},n),e.addItem(mxResources.get("middle"),null,function(){i.alignCells(mxConstants.ALIGN_MIDDLE)},n),e.addItem(mxResources.get("bottomAlign"),null,function(){i.alignCells(mxConstants.ALIGN_BOTTOM)},n)}))),this.put("layout",new Menu(mxUtils.bind(this,function(e,n){e.addItem(mxResources.get("horizontalFlow"),null,mxUtils.bind(this,function(){var e=new mxHierarchicalLayout(i,mxConstants.DIRECTION_WEST);this.editorUi.executeLayout(e,!0,!0)}),n),e.addItem(mxResources.get("verticalFlow"),null,mxUtils.bind(this,function(){var e=new mxHierarchicalLayout(i,mxConstants.DIRECTION_NORTH);this.editorUi.executeLayout(e,!0,!0)}),n)}))),this.put("navigation",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["home","-","exitGroup","enterGroup","-","expand","collapse"],n)}))),this.put("arrange",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["toFront","toBack","-"],n),this.addSubmenu("layout",e,n),e.addSeparator(n),this.addMenuItems(e,["-","group","ungroup","removeFromGroup"],n)}))),this.put("view",new Menu(mxUtils.bind(this,function(n,t){this.addMenuItems(n,["actualSize"],t),n.addSeparator();for(var e=[.25,.5,.75,1,2,4],a=0;a<e.length;a++)!function(e){n.addItem(100*e+"%",null,function(){i.zoomTo(e)},t)}(e[a]);this.addMenuItems(n,["-","zoomIn","zoomOut","-","fitWindow","customZoom","-","fitPage","fitPageWidth"],t)}))),this.put("file",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["new","open","-","save","saveAs","publish","-","variable","-","import","export","-","editFile","description","-","print"],n)}))),this.put("edit",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["undo","redo","-","cut","copy","paste","delete","-","duplicate","-","selectVertices","selectEdges","selectAll"])}))),this.put("help",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["help","-","about"])})))},Menus.prototype.put=function(e,n){this.menus[e]=n},Menus.prototype.get=function(e){return this.menus[e]},Menus.prototype.addSubmenu=function(e,n,t){var a=this.get(e).enabled;if(n.showDisabled||a){var i=n.addItem(mxResources.get(e),null,null,t,null,a);this.addMenu(e,n,i)}},Menus.prototype.addMenu=function(e,n,t){var a=this.get(e);null!=a&&(n.showDisabled||a.enabled)&&this.get(e).execute(n,t)},Menus.prototype.styleChange=function(e,n,t,a,i,s){return e.addItem(n,null,mxUtils.bind(this,function(){var e=this.editorUi.editor.graph;e.getModel().beginUpdate();try{for(var n=0;n<t.length;n++)e.setCellStyles(t[n],a[n])}finally{e.getModel().endUpdate()}}),s,i)},Menus.prototype.promptChange=function(e,n,a,i,s,t,o){return e.addItem(n,null,mxUtils.bind(this,function(){var e=this.editorUi.editor.graph,n=i,t=e.getView().getState(e.getSelectionCell());null!=t&&(n=t.style[s]||n),null!=(n=mxUtils.prompt(mxResources.get("enterValue")+(0<a.length?" "+a:""),n))&&0<n.length&&e.setCellStyles(s,n)}),t,null,o)},Menus.prototype.addMenuItem=function(e,n,t){var a=this.editorUi.actions.get(n);if(null==a||!e.showDisabled&&!a.enabled)return null;var i=e.addItem(a.label,null,a.funct,t,null,a.enabled);return a.toggleAction&&a.isSelected()&&this.addCheckmark(i),this.addShortcut(i,a),i},Menus.prototype.addShortcut=function(e,n){if(null!=n.shortcut){var t=e.firstChild.nextSibling.nextSibling,a=document.createElement("span");a.style.color="gray",mxUtils.write(a,n.shortcut),t.appendChild(a)}},Menus.prototype.addCheckmark=function(e){var n=e.firstChild.nextSibling;n.style.backgroundImage="url("+IMAGE_PATH+"/checkmark.gif)",n.style.backgroundRepeat="no-repeat",n.style.backgroundPosition="2px 50%"},Menus.prototype.addMenuItems=function(e,n,t){for(var a=0;a<n.length;a++)"-"==n[a]?e.addSeparator(t):this.addMenuItem(e,n[a],t)},Menus.prototype.createPopupMenu=function(e,n,t){var a=this.editorUi.editor.graph;if(e.smartSeparators=!0,a.isSelectionEmpty()?this.addMenuItems(e,["undo","redo","-","paste","-"]):(this.addMenuItems(e,["delete","-","cut","copy","-","duplicate"]),1==a.getSelectionCount()&&a.getModel().isEdge(a.getSelectionCell())&&this.addMenuItems(e,["setAsDefaultEdge"]),e.addSeparator()),0<a.getSelectionCount()){if(this.addMenuItems(e,["toFront","toBack","-"]),a.getModel().isEdge(a.getSelectionCell())){var i=!1;if(null!=(n=a.getSelectionCell())&&a.getModel().isEdge(n)){var s=a.selectionCellsHandler.getHandler(n);if(s instanceof mxEdgeHandler&&null!=s.bends&&2<s.bends.length){var o=s.getHandleForEvent(new mxMouseEvent(t)),r=this.editorUi.actions.get("removeWaypoint");r.handler=s,i=0<(r.index=o)&&o<s.bends.length}}this.addMenuItems(e,["-",i?"removeWaypoint":"addWaypoint"])}else 1<a.getSelectionCount()&&(e.addSeparator(),this.addMenuItems(e,["group"]));if(e.addSeparator(),1==a.getSelectionCount())null!=a.getLinkForCell(a.getSelectionCell())&&this.addMenuItems(e,["openLink"])}else this.addMenuItems(e,["-","selectVertices","selectEdges","-","selectAll"])},Menus.prototype.createMenubar=function(e){var n=new Menubar(this.editorUi,e),t=[];t=CRUD_PERMISSIONS.canEdit?["file","edit","view","format","text","arrange","help"]:["file","view","help"];for(var a=0;a<t.length;a++)n.addMenu(mxResources.get(t[a]),this.get(t[a]).funct);return n},Menubar.prototype.hideMenu=function(){null!=this.currentMenu&&this.currentMenu.hideMenu()},Menubar.prototype.addMenu=function(e,n){var t=document.createElement("a");return t.setAttribute("href","javascript:void(0);"),t.className="geItem",mxUtils.write(t,e),this.addMenuHandler(t,n),this.container.appendChild(t),t},Menubar.prototype.getOffset=function(e){return{left:(e=e.getBoundingClientRect()).left+window.scrollX,top:e.top+window.scrollY}},Menubar.prototype.addMenuHandler=function(i,s){if(null!=s){var o=!0,n=mxUtils.bind(this,function(e){if(o&&null==i.enabled||i.enabled){this.editorUi.editor.graph.panningHandler.hideMenu();var n=new mxPopupMenu(s);n.div.className+=" geMenubarMenu",n.smartSeparators=!0,n.showDisabled=!0,n.autoExpand=!0,n.hideMenu=mxUtils.bind(this,function(){mxPopupMenu.prototype.hideMenu.apply(n,arguments),n.destroy(),this.currentMenu=null,this.currentElt=null});var t=this.getOffset(i).left,a=this.getOffset(i).top+i.offsetHeight;n.popup(t,a,null,e),this.currentMenu=n,this.currentElt=i}o=!0,mxEvent.consume(e)});mxEvent.addListener(i,"mousemove",mxUtils.bind(this,function(e){null!=this.currentMenu&&this.currentElt!=i&&(this.hideMenu(),n(e))})),mxEvent.addListener(i,"mousedown",mxUtils.bind(this,function(){o=this.currentElt!=i})),mxEvent.addListener(i,"click",n)}},mxUtils.extend(Menu,mxEventSource),Menu.prototype.setEnabled=function(e){this.enabled!=e&&(this.enabled=e,this.fireEvent(new mxEventObject("stateChanged")))},Menu.prototype.execute=function(e,n){this.funct(e,n)},Toolbar.prototype.init=function(){CRUD_PERMISSIONS.canEdit?this.addItems(["save","publish","-","print","undo","redo","-","copy","cut","paste","delete","-","duplicate","-","actualSize","zoomIn","zoomOut","-"]):this.addItems(["print","actualSize","zoomIn","zoomOut","-"])},Toolbar.prototype.hideMenu=function(){null!=this.currentMenu&&(this.currentMenu.hideMenu(),this.currentMenu.destroy(),this.currentMenu=null)},Toolbar.prototype.addMenu=function(e,n,t,a){var i=this.editorUi.menus.get(a),s=this.addMenuFunction(e,n,t,i.funct);return i.addListener("stateChanged",function(){s.setEnabled(i.enabled)}),s},Toolbar.prototype.addMenuFunction=function(e,n,t,a){var i=t?this.createLabel(e):this.createButton(e);return this.initElement(i,n),this.addMenuHandler(i,t,a),this.container.appendChild(i),i},Toolbar.prototype.addSeparator=function(){var e=document.createElement("div");return e.className="geSeparator",this.container.appendChild(e),e},Toolbar.prototype.addItems=function(e){for(var n=0;n<e.length;n++){var t=e[n];"-"==t?this.addSeparator():this.addItem("geSprite-"+t.toLowerCase(),t)}},Toolbar.prototype.addItem=function(e,n){var t=this.editorUi.actions.get(n),a=null;return null!=t&&((a=this.addButton(e,t.label,t.funct)).setEnabled(t.enabled),t.addListener("stateChanged",function(){a.setEnabled(t.enabled)})),a},Toolbar.prototype.addButton=function(e,n,t){var a=this.createButton(e);return this.initElement(a,n),this.addClickHandler(a,t),this.container.appendChild(a),a},Toolbar.prototype.addSelectionHandler=function(t){var a=this.editorUi.editor.graph,e=function(){for(var e=!a.isSelectionEmpty(),n=0;n<t.length;n++)t[n].setEnabled(e)};a.getSelectionModel().addListener(mxEvent.CHANGE,e),e()},Toolbar.prototype.addEdgeSelectionHandler=function(a){var i=this.editorUi.editor.graph,e=function(){var e=!1;if(!i.isSelectionEmpty())for(var n=i.getSelectionCells(),t=0;t<n.length;t++)if(i.getModel().isEdge(n[t])){e=!0;break}for(t=0;t<a.length;t++)a[t].setEnabled(e)};i.getSelectionModel().addListener(mxEvent.CHANGE,e),e()},Toolbar.prototype.initElement=function(e,n){e.setAttribute("tabindex","0"),null!=n&&e.setAttribute("title",n),this.addEnabledState(e)},Toolbar.prototype.addEnabledState=function(n){var t=n.className;n.setEnabled=function(e){n.enabled=e,n.className=e?t:t+" geDisabled"},n.setEnabled(!0)},Toolbar.prototype.addClickHandler=function(n,t){null!=t&&mxEvent.addListener(n,"click",function(e){n.enabled&&t(e),mxEvent.consume(e)})},Toolbar.prototype.createButton=function(e){var n=document.createElement("a");n.setAttribute("href","javascript:void(0);"),n.className="geButton";var t=document.createElement("div");return t.className="geSprite "+e,n.appendChild(t),n},Toolbar.prototype.createLabel=function(e,n){var t=document.createElement("a");return t.setAttribute("href","javascript:void(0);"),t.className="geLabel",mxUtils.write(t,e),t},Toolbar.prototype.addMenuHandler=function(n,t,a,i){if(null!=a){var s=this.editorUi.editor.graph,o=null;mxEvent.addListener(n,"click",mxUtils.bind(this,function(e){(null==n.enabled||n.enabled)&&(s.panningHandler.hideMenu(),(o=new mxPopupMenu(a)).div.className+=" geToolbarMenu",o.showDisabled=i,o.labels=t,o.autoExpand=!0,o.popup(n.offsetLeft,n.offsetTop+n.offsetHeight+34,null,e),this.currentMenu=o),mxEvent.consume(e)}))}},Dialog.prototype.close=function(){null!=this.onDialogClose&&(this.onDialogClose(),this.onDialogClose=null),this.container.parentNode.removeChild(this.container),this.bg.parentNode.removeChild(this.bg)},angular.module("motion").run(["$templateCache",function(e){"use strict";e.put("app/auth/services/hotdesk/dialog.html",'<md-dialog aria-label="Telephone">\n  <form ng-cloak>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="LOGIN.TELEPHONES">Telephones</span>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <md-select ng-model="vm.name" placeholder="Select a telephone">\n        <md-option value="{{telephone.name}}" ng-repeat="telephone in vm.telephones.rows">{{telephone.fullname}}</md-option>\n      </md-select>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button ng-click="vm.closeDialog(vm.name)" class="send-button md-accent md-raised" aria-label="call" ng-disabled="!vm.name">\n        <span translate="LOGIN.SELECT">SELECT</span>\n      </md-button>\n      \x3c!-- <md-button ng-click="vm.closeDialog()" class="send-button md-accent md-raised" aria-label="cancel">\n                <span translate="LOGIN.CANCEL">Cancel</span>\n            </md-button> --\x3e\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/core/dialogs/advanced-search/dialog.html",'<md-dialog class="advanced-search-dialog" aria-label="Advanced search" flex="70" ng-init="vm.onInit()">\n  <form ng-cloak>\n    <md-toolbar class="advanced-search-dialog-header" ng-class="{{ \'vm.toolbarColor\' }} + \'-bg\'">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="DASHBOARDS.ADVANCED_SEARCH"></span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.minimize()">\n            <md-icon class="no-margin" md-font-icon="icon-window-minimize" aria-label="Minimize dialog"></md-icon>\n          </md-button>\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.close()">\n            <md-icon class="no-margin" md-font-icon="icon-window-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <ms-advanced-search options="vm.searchOptions" clear-filter="vm.clearConditions()"></ms-advanced-search>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button class="md-primary md-raised" aria-label="Clear" ng-disabled="vm.searchOptions.conditions.length === 0" translate="DASHBOARDS.CLEAR" translate-attr-aria-label="DASHBOARDS.CLEAR" ng-click="vm.clearConditions()"></md-button>\n      <md-button class="md-primary md-accent md-raised" aria-label="Apply" ng-disabled="vm.searchOptions.conditions.length === 0" translate="DASHBOARDS.APPLY" translate-attr-aria-label="DASHBOARDS.APPLY" ng-click="vm.applyFilter()"></md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/core/directives/ms-advanced-search/ms-advanced-search.html",'<div layout="column" class="advanced-search-container" flex>\n  <div layout-margin>\n    <md-radio-group ng-model="vm.options.matchType" class="md-primary" layout="row">\n      <md-radio-button value="$and" class="md-primary">{{ \'DASHBOARDS.MEET_ALL_CONDITIONS\' | translate }}\n      </md-radio-button>\n      <md-radio-button value="$or">{{ \'DASHBOARDS.MEET_ANY_CONDITIONS\' | translate }}</md-radio-button>\n    </md-radio-group>\n  </div>\n\n  \x3c!-- ACTIVE CONDITIONS --\x3e\n  <div layout="row" ng-if="vm.options.conditions.length > 0" class="advanced-search-conditions">\n    <md-list>\n      <md-list-item>\n        <md-chips ng-model="vm.options.conditions" class="advanced-search-chips" readonly="true" md-removable="true" md-on-remove="vm.removeCondition()">\n          <md-chip-template ms-chip-color="{{ $chip.style }}">\n            <md-menu md-offset="50 0" ng-class="{\'no-click\': vm.pendingCondition}">\n              <span>\n                <p class="filter-text">{{ $chip.name }}</p>\n                <em ng-show="$chip.operator" class="text-lowercase">{{ $chip.operator }}</em>\n                <strong>{{ $chip.displayValue }}</strong>\n                <em ng-show="$chip.displayEndValue" class="text-lowercase">{{ \'DASHBOARDS.AND\' | translate }}</em>\n                <strong>{{ $chip.displayEndValue }}</strong>\n              </span>\n              <md-menu-content width=2 class="md-dense">\n                <md-menu-item ng-hide="$chip.disabled">\n                  <md-button ng-click="vm.editCondition($chip)">Edit\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.setConditionStatus($chip)">\n                    {{ $chip.disabled ? \'Enable\' : \'Disable\' }}\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </md-chip-template>\n          <button type="button" md-chip-remove class="md-primary remove-filter">\n            <md-icon md-font-icon="icon-cancel" aria-label="Remove Filter"></md-icon>\n          </button>\n        </md-chips>\n      </md-list-item>\n    </md-list>\n  </div>\n\n  \x3c!-- FILTERS --\x3e\n  <div layout="row">\n    <div layout="row" class="advanced-search-bar" layout-margin flex>\n      \x3c!-- FIELD --\x3e\n      <md-input-container flex="35">\n        <md-icon md-font-icon="icon-filter-variant"></md-icon>\n        <md-select class="font-size-12" ng-model="vm.selectedField" ng-change="vm.onFieldChange()" placeholder="{{ \'DASHBOARDS.SELECT_FIELD\' | translate }}" aria-label="Field">\n          <md-option ng-value="field" ng-repeat="field in vm.options.fields">{{ field.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- OPERATOR --\x3e\n      <md-input-container flex="30">\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-select class="font-size-12" ng-model="vm.selectedOperator" ng-change="vm.onOperatorChange(oldValue)" ng-focus="oldValue=vm.selectedOperator" md-selected-text="vm.selectedOperator ? (\'DASHBOARDS.\' + vm.selectedOperator.translate | translate) : (\'DASHBOARDS.SELECT_OPERATOR\' | translate)" ng-disabled="!vm.selectedField" aria-label="Operator">\n          <md-option ng-value="operator" ng-repeat="operator in vm.availableOperators" ng-selected="vm.autoSelectOperator">\n            <div layout="row" class="operators-list">\n              <span class="operator-symbol">\n                {{ operator.symbol }}\n              </span>\n              <span>\n                {{ \'DASHBOARDS.\' + operator.translate | translate }}\n              </span>\n            </div>\n          </md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TEXT INPUT --\x3e\n      <md-input-container ng-if="!vm.selectedField.type || vm.selectedField.type === \'text\'" class="no-errors" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <input type="text" aria-label="Value" ng-model="vm.value" ng-change="vm.onValueChange()" ng-disabled="!vm.selectedField" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}">\n      </md-input-container>\n      \x3c!-- NUMERIC INPUT --\x3e\n      <div ng-if="vm.selectedField.type === \'number\'" flex layout="row" layout-margin class="no-margin">\n        <md-input-container class="no-errors" flex>\n          <md-icon md-font-icon="icon-numeric"></md-icon>\n          <input type="number" aria-label="Value" ng-model="vm.value" ng-change="vm.onValueChange()" ng-disabled="!vm.selectedField" min="0" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ vm.selectedOperator.type === \'$between\' ? \'DASHBOARDS.STARTING_VALUE\' : \'DASHBOARDS.VALUE\' | translate }}">\n        </md-input-container>\n        <md-input-container class="no-errors" ng-if="vm.selectedOperator.type === \'$between\'" ng-class="{\'md-input-invalid\': !vm.isValidRange}" flex>\n          <md-icon md-font-icon=" icon-numeric">\n          </md-icon>\n          <input class="md-input" type="number" aria-label="Value" ng-model="vm.endRangeValue" ng-change="vm.checkRange()" ng-disabled="!vm.value" min="vm.value" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.ENDING_VALUE\' | translate }}">\n          <div ng-if="!vm.isValidRange" class="md-input-message-animation md-input-messages-animation">\n            {{ (\'DASHBOARDS.VALUE_RANGE_CHECK\' | translate) + \' \' + vm.value }}\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- SELECT --\x3e\n      <md-input-container ng-if="vm.selectedField.type === \'select\'" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-select class="font-size-12" ng-model="vm.value" md-on-open="vm.getValues()" ng-change="vm.onValueChange()" ng-model-options="{trackBy: \'$value.id\'}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}" aria-label="Value">\n          <md-option ng-value="item" ng-repeat="item in vm.selectedField.values">{{item.name}}\n          </md-option>\n        </md-select>\n      </md-input-container>\n      \x3c!-- MULTISELECT --\x3e\n      <md-input-container ng-if="vm.selectedField.type === \'multiselect\'" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-select class="font-size-12" multiple ng-model="vm.value" md-on-open="vm.getValues()" ng-change="vm.onValueChange()" ng-model-options="{trackBy: \'$value.id\'}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}" aria-label="Value">\n          <md-option ng-value="item" ng-repeat="item in vm.selectedField.values">{{item.name}}\n          </md-option>\n        </md-select>\n      </md-input-container>\n      \x3c!-- DATE INPUT --\x3e\n      <div ng-if="vm.selectedField.type === \'date\'" flex layout="row">\n        <mdp-date-picker mdp-open-on-click ng-model="vm.value" ng-change="vm.onValueChange()" mdp-max-date="vm.maxDateRange" mdp-placeholder="{{ vm.selectedOperator.type === \'$between\' ? \'DASHBOARDS.STARTING_DATE\' : \'DASHBOARDS.VALUE\' | translate }}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" flex>\n        </mdp-date-picker>\n        <mdp-date-picker mdp-open-on-click ng-if="vm.selectedOperator.type === \'$between\'" ng-change="vm.checkRange()" ng-model="vm.endRangeValue" mdp-min-date="vm.minDateRange" mdp-disabled="!vm.value" mdp-placeholder="{{ \'DASHBOARDS.ENDING_DATE\' | translate }}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" flex>\n        </mdp-date-picker>\n      </div>\n      \x3c!-- AUTOCOMPLETE --\x3e\n      <div layout="row" layout-align="start start" ng-if="vm.selectedField.type === \'autocomplete\' && vm.selectedOperator.type != \'$substring\'" class=" autocomplete-input" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-autocomplete md-selected-item="vm.value" md-selected-item-change="vm.onValueChange()" md-items="item in vm.getValues()" md-search-text="vm.searchText" md-item-text="item.displayValue" md-min-length="4" md-no-cache="true" md-floating-label="{{ \'DASHBOARDS.VALUE\' | translate }}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" flex>\n          <md-item-template>\n            <span md-highlight-text="vm.searchText" md-highlight-flags="i">{{item.displayValue}}</span>\n          </md-item-template>\n        </md-autocomplete>\n      </div>\n      <md-input-container ng-if="vm.selectedField.type === \'autocomplete\' && vm.selectedOperator.type === \'$substring\'" class="no-errors" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <input type="text" aria-label="Value" ng-model="vm.value" ng-change="vm.onValueChange()" ng-disabled="!vm.selectedField" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}">\n      </md-input-container>\n    </div>\n    <md-button class="md-fab md-mini md-primary mt-20" ng-if="!vm.pendingCondition" ng-disabled="!vm.isValidCondition" aria-label="Add filter" ng-click="vm.addCondition()" translate-attr-aria-label="DASHBOARDS.ADD">\n      <md-icon md-font-icon="icon-plus"></md-icon>\n    </md-button>\n    <md-button class="md-fab md-mini mt-20" ng-if="vm.pendingCondition" ng-disabled="!vm.isValidCondition" aria-label="Update filter" ng-click="vm.updateCondition()" translate-attr-aria-label="DASHBOARDS.UPDATE">\n      <md-icon md-font-icon="icon-check"></md-icon>\n    </md-button>\n    <md-button class="md-fab md-mini md-primary mt-20" ng-if="vm.pendingCondition" aria-label="Cancel filter update" ng-click="vm.cancelUpdateCondition()" translate-attr-aria-label="DASHBOARDS.CANCEL">\n      <md-icon md-font-icon="icon-close"></md-icon>\n    </md-button>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-1/template-1.html",'<div class="template-1">\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="content pv-24 ph-16">\n    <div class="title h1" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="subtitle secondary-text" ng-if="card.subtitle">\n      {{card.subtitle}}\n    </div>\n\n    <div class="text pt-16" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-10/template-10.html",'<div class="template-10 p-16">\n  <div class="pb-16" layout="row" layout-align="space-between center">\n    <div class="info">\n      <div class="title secondary-text" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle h2" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n    </div>\n\n    <div class="media ml-16">\n      <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n    </div>\n  </div>\n\n  <div class="text">\n    {{card.text}}\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-2/template-2.html",'<div class="template-2">\n  <div class="header p-16" layout="row" layout-align="start center">\n    <div ng-if="card.avatar">\n      <img class="avatar mr-16" ng-src="{{card.avatar.src}}" alt="{{card.avatar.alt}}">\n    </div>\n\n    <div class="info">\n      <div class="title" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n    </div>\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="text p-16" ng-if="card.text">\n    {{card.text}}\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-3/template-3.html",'<div class="template-3 p-16 teal-bg white-fg" layout="row" layout-align="space-between">\n  <div layout="column" layout-align="space-between">\n    <div class="info">\n      <div class="title h1" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle h3 secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n    </div>\n\n    <div class="cta">\n      <md-button class="m-0">{{card.cta}}</md-button>\n    </div>\n  </div>\n\n  <div class="media pl-16">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-4/template-4.html",'<div class="template-4">\n  <div class="info white-fg ph-16 pv-24">\n    <div class="title h1" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="text" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-5/template-5.html",'<div class="template-5 p-16" layout="row" layout-align="space-between start">\n  <div class="info">\n    <div class="title secondary-text" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="event h2" ng-if="card.event">\n      {{card.event}}\n    </div>\n  </div>\n\n  <div class="media ml-16">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-6/template-6.html",'<div class="template-6">\n  <div class="content pv-24 ph-16">\n    <div class="subtitle secondary-text" ng-if="card.subtitle">\n      {{card.subtitle}}\n    </div>\n\n    <div class="title h2" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="text pt-8" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-7/template-7.html",'<div class="template-7" layout="row" layout-align="space-between">\n  <div class="info" layout="column" layout-align="space-between" layout-fill flex>\n    <div class="p-16">\n      <div class="title h1" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle h4 secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n\n      <div class="text h4 pt-8" ng-if="card.text">\n        {{card.text}}\n      </div>\n    </div>\n\n    <div>\n      <md-divider></md-divider>\n      <div class="p-8" layout="row">\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n      </div>\n    </div>\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-8/template-8.html",'<div class="template-8">\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="content pv-24 ph-16">\n    <div class="title h1" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="subtitle secondary-text" ng-if="card.subtitle">\n      {{card.subtitle}}\n    </div>\n\n    <div class="buttons pt-16">\n      <md-button class="m-0">{{card.button1}}</md-button>\n      <md-button class="m-0 md-accent">{{card.button2}}</md-button>\n    </div>\n\n    <div class="text pt-16" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-9/template-9.html",'<div class="template-9">\n  <div class="header p-16" layout="row" layout-align="start center">\n    <div ng-if="card.avatar">\n      <img class="avatar mr-16" ng-src="{{card.avatar.src}}" alt="{{card.avatar.alt}}">\n    </div>\n\n    <div class="info">\n      <div class="title" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n\n    </div>\n  </div>\n\n  <div class="text ph-16 pb-16" ng-if="card.text">\n    {{card.text}}\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="buttons m-8">\n    <md-button class="md-icon-button mr-16" aria-label="Favorite">\n      <md-icon md-font-icon="icon-heart-outline" class="s24"></md-icon>\n    </md-button>\n    <md-button class="md-icon-button" aria-label="Share">\n      <md-icon md-font-icon="icon-share" class="s24"></md-icon>\n    </md-button>\n  </div>\n\n</div>'),e.put("app/core/directives/ms-click-to-call/ms-click-to-call.html",'<section ng-if="type !== \'button\'">\n  <span ng-if="!showMenu()" privacy="{{ privacy }}" ng-cloak>{{target}}</span>\n  <md-menu ng-if="showMenu()">\n    <a aria-label="Target" ng-click="$mdOpenMenu($event)">\n      <span ng-if="prefix" privacy="{{ privacy }}" ng-cloak>{{prefix}}-</span>\n      <span privacy="{{ privacy }}" ng-cloak>{{target}}</span>\n    </a>\n    <md-menu-content width="2">\n      <md-menu-item>\n        <md-button ng-click="call(prefix ? prefix + target : target)">\n          {{\'DASHBOARDS.CALL_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n      <md-menu-item>\n        <md-button ng-click="transfer(prefix ? prefix + target : target)">\n          {{\'DASHBOARDS.TRANSFER_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n    </md-menu-content>\n  </md-menu>\n</section>\n<section ng-if="type === \'button\'">\n  <md-button ng-if="!showMenu()" ng-disabled="true" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW CALL" aria-label="NEW CALL">\n    <md-icon md-font-icon="icon-phone"></md-icon>\n  </md-button>\n  <md-menu ng-if="showMenu()">\n    <md-button class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW CALL" ng-click="$mdOpenMenu($event)" aria-label="NEW CALL">\n      <md-icon md-font-icon="icon-phone"></md-icon>\n    </md-button>\n    <md-menu-content width="2">\n      <md-menu-item>\n        <md-button ng-click="call(prefix ? prefix + target : target)">\n          {{\'DASHBOARDS.CALL_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n      <md-menu-item>\n        <md-button ng-click="transfer(target)">\n          {{\'DASHBOARDS.TRANSFER_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n    </md-menu-content>\n  </md-menu>\n</section>'),e.put("app/core/directives/ms-client-side-logging/ms-client-side-logging-icon.html",'<md-icon ng-style="vm.styleColor" md-font-icon="{{ vm.styleIcon }}">\n  <md-tooltip class="client-side-logging-tooltip">\n    <span ng-bind-html="vm.tooltipHTML"></span>\n  </md-tooltip>\n</md-icon>'),e.put("app/core/directives/ms-client-side-logging/ms-client-side-logging.html",'<md-content layout="column">\n  <form name="clientSideLoggingSettingsForm">\n    <div flex layout="column" layout-align="stretch center">\n      <div ng-if="vm.user.userSetting.clientSideLoggingEnabled" class="md-amber-500-bg p-10" layout="row" layout-align="start center">\n        <span class="no-margin font-size-14 line-height-30" translate="STAFF.CLIENT_LOGS_ALL_ENABLED_WARNING" flex></span>\n      </div>\n      <md-input-container>\n        <md-switch ng-model="vm.user.userSetting.clientSideLoggingEnabled" aria-label="Manage client side logging" ng-change="vm.onEnabledSwitchChange()">\n          {{ vm.user.userSetting.clientSideLoggingEnabled ? \'STAFF.CLIENT_LOGS_ENABLED\' : \'STAFF.CLIENT_LOGS_DISABLED\' | translate }}\n        </md-switch>\n      </md-input-container>\n      <h2 ng-if="vm.user.userSetting.clientSideLoggingEnabled" class="md-subhead mt-0">{{ vm.clientSideLoggingEnabledSince }}</h2>\n    </div>\n    <div layout="column" layout-align="stretch center">\n      <md-input-container ng-if="vm.user.userSetting.clientSideLoggingEnabled">\n        <label>{{ \'STAFF.CLIENT_LOGS_LOGLEVEL_SELECT\' | translate }}</label>\n        <md-select ng-if="vm.user.userSetting.clientSideLoggingEnabled" ng-model="vm.user.userSetting.clientSideLoggingLevel" placeholder="Debugging level" ng-change="vm.onLogLevelSelectionChange()" flex="30">\n          <md-option ng-value="loggingLevel" ng-repeat="loggingLevel in vm.availableClientSideLoggingLevels">\n            <md-icon ng-style="vm.computeStyleForLoggingLevel(loggingLevel)" md-font-icon="{{ loggingLevel === \'info\' ? \'icon-checkbox-blank-circle-outline\' : \'icon-checkbox-blank-circle\' }}"></md-icon>\n            {{ loggingLevel }}\n          </md-option>\n        </md-select>\n      </md-input-container>\n    </div>\n  </form>\n</md-content>'),e.put("app/core/directives/ms-dual-multiselect/ms-dual-multiselect.html",'<div ng-cloak layout-gt-sm="row" layout="column">\n  <div flex-gt-sm="50" flex="45">\n    <md-input-container class="md-icon-float md-block margin-0">\n      <md-icon md-font-icon="icon-magnify" aria-label="swap"></md-icon>\n      <input ng-model="query" type="text" placeholder="{{ \'STAFF.PERMISSIONS_PLACEHOLDER_SEARCH\' | translate }}">\n    </md-input-container>\n    <md-content class="border h-300">\n      <md-list class="md-dense no-padding" layout-fill layout-align="center center">\n        <md-list-item class="md-3-line" ng-class="{\'read-only-mode\': vm.readOnly || vm.addDisabled}" ng-disabled="vm.readOnly || vm.addDisabled" ng-repeat="item in availableItems = (vm.options.items | filter: query) | orderBy: vm.options.orderBy" ng-click="vm.canTransfer(item, vm.options, false)">\n          <div class="md-list-item-text" layout="column">\n            <h3 ng-if="vm.options.line1">{{vm.getLine(item, vm.options.line1)}}</h3>\n            <h4 ng-if="vm.options.line2">{{vm.getLine(item, vm.options.line2)}}</h4>\n            <p ng-if="vm.options.line3">{{vm.getLine(item, vm.options.line3)}}</p>\n            <p class="ms-dual-multiselect-line-xs" ng-if="vm.options.line4">{{vm.getLine(item, vm.options.line4)}}\n            </p>\n          </div>\n          <md-icon ng-hide="vm.readOnly && !vm.addDisabled" ng-class="{\'add-disabled\': vm.addDisabled}" md-font-icon="icon-arrow-right-bold" aria-label="swap">\n          </md-icon>\n          <md-divider></md-divider>\n        </md-list-item>\n      </md-list>\n    </md-content>\n    <div class="margin-10" layout="row">\n      <span class="h4" flex>{{vm.options.labelAll || \'All Items\'}} ({{availableItems.length}})</span>\n      <md-icon ng-hide="vm.options.showSelectAndDeselectAll === false || vm.readOnly" ng-class="{\'add-disabled\': vm.addDisabled}" ng-disabled="vm.addDisabled" md-font-icon="icon-chevron-double-right" aria-label="swap" ng-click="vm.transfer(vm.options.items, vm.options.selectedItems, -1, false)"></md-icon>\n    </div>\n  </div>\n\n  <div flex="10" layout="row" layout-align="center center">\n    <md-icon md-font-icon="icon-swap-horizontal" aria-label="swap"></md-icon>\n  </div>\n\n  <div flex-gt-sm="50" flex="45">\n    <md-input-container class="md-icon-float md-block margin-0">\n      <md-icon md-font-icon="icon-magnify" aria-label="swap"></md-icon>\n      <input ng-model="selectedQuery" type="text" placeholder="{{ \'STAFF.PERMISSIONS_PLACEHOLDER_SEARCH\' | translate }}">\n    </md-input-container>\n    <md-content class="border h-300">\n      <md-list class="md-dense no-padding" layout-fill layout-align="center center">\n        <md-list-item class="md-3-line" ng-class="{\'read-only-mode\': vm.readOnly || !item.isValid}" ng-disabled="vm.readOnly" ng-repeat="item in associatedItems = (vm.options.selectedItems | filter: selectedQuery) | orderBy: vm.options.orderBy" ng-click="vm.canTransfer(item, vm.options, true)">\n          <md-icon ng-class="{\'hidden\': vm.readOnly || !item.isValid}" md-font-icon="icon-arrow-left-bold" aria-label="swap"></md-icon>\n          <div class="md-list-item-text" layout="column">\n            <h3 ng-if="vm.options.line1">{{vm.getLine(item, vm.options.line1)}}</h3>\n            <h4 ng-if="vm.options.line2">{{vm.getLine(item, vm.options.line2)}}</h4>\n            <p ng-if="vm.options.line3">{{vm.getLine(item, vm.options.line3)}}</p>\n            <p class="ms-dual-multiselect-line-xs" ng-if="vm.options.line4">{{vm.getLine(item, vm.options.line4)}}\n            </p>\n          </div>\n          <md-divider></md-divider>\n        </md-list-item>\n      </md-list>\n    </md-content>\n    <div class="margin-10" layout="row">\n      <md-icon ng-hide="vm.options.showSelectAndDeselectAll === false || vm.readOnly" md-font-icon="icon-chevron-double-left" aria-label="swap" ng-click="vm.transfer(vm.options.selectedItems, vm.options.items, -1, true)"></md-icon>\n      <span class="h4 text-right" flex>{{vm.options.labelSelected || \'Selected Items\'}}\n        ({{associatedItems.length}})</span>\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-font-family/ms-font-family.html",'<md-select ng-model="ngModel" class="no-margin">\n  <md-option ng-repeat="font in fonts" ng-value="font.value"><span ng-style="{\'font-family\': font.value}">{{font.option}}</span>\n  </md-option>\n</md-select>'),e.put("app/core/directives/ms-info-bar/ms-info-bar.html",'<div id="ms-info-bar" layout="row" layout-align="start center" flex>\n  <div id="ms-info-bar-message" ng-transclude flex></div>\n  <md-button id="ms-info-bar-close" class="md-icon-button" aria-label="Close" ng-click="removeInfoBar()">\n    <md-icon md-font-icon="icon-close s20"></md-icon>\n  </md-button>\n</div>'),e.put("app/core/directives/ms-material-color-picker/ms-material-color-picker.html",'<md-menu md-position-mode="target-right target">\n\n  <div ng-click="$mdOpenMenu($event)">\n    <ms-color-picker-button>\n      <md-button aria-label="Row Color" md-menu-origin ng-click="$mdOpenMenu($event)" ng-class="vm.selectedColor.class">\n\n        <span ng-show="vm.selectedColor.palette">\n          {{vm.selectedColor.palette}} {{vm.selectedColor.hue}}\n        </span>\n        <span ng-show="!vm.selectedColor.palette">\n          Select Color\n        </span>\n      </md-button>\n    </ms-color-picker-button>\n  </div>\n\n  <md-menu-content class="ms-material-color-picker-menu-content" layout-column>\n\n    <header ng-class="vm.selectedColor.class || \'md-accent-bg\'" class="md-whiteframe-4dp" layout="row" layout-align="space-between center">\n      <md-button md-prevent-menu-close ng-click="vm.activateHueSelection(false,false)" class="md-icon-button" ng-class="{\'hidden\':!vm.selectedPalette}" aria-label="Palette">\n        <md-icon md-font-icon="icon-arrow-left" class="s20"></md-icon>\n      </md-button>\n\n      <span ng-if="vm.selectedColor.palette">\n        {{vm.selectedColor.palette}} {{vm.selectedColor.hue}}\n      </span>\n\n      <span ng-if="!vm.selectedColor.palette">\n        Select Color\n      </span>\n\n      <md-button class="remove-color-button md-icon-button" ng-click="vm.removeColor()" aria-label="Remove Color">\n        <md-icon md-font-icon="icon-delete" class="s20"></md-icon>\n      </md-button>\n    </header>\n\n    <div class="colors">\n      <div ng-show="!vm.selectedPalette" layout="row" layout-wrap>\n        <div class="color" ng-class="\'md-\'+palette+\'-500-bg\'" ng-repeat="(palette, hues) in vm.palettes" ng-click="vm.activateHueSelection(palette,hues)" layout="row" layout-align="start end" md-prevent-menu-close md-ink-ripple>\n          <span class="label">\n            {{palette}}\n          </span>\n        </div>\n      </div>\n\n      <div ng-show="vm.selectedPalette" layout="row" layout-wrap>\n        <div class="color" ng-class="\'md-\'+vm.selectedPalette+\'-\'+hue+\'-bg\'" ng-repeat="(hue, values) in vm.selectedHues" ng-click="vm.selectColor(vm.selectedPalette,hue)" layout="row" layout-align="start end" md-ink-ripple>\n          <span class="label">\n            {{hue}}\n          </span>\n          <i ng-if="vm.selectedPalette == vm.selectedColor.palette && hue == vm.selectedColor.hue" class="s16 icon-check">\n          </i>\n        </div>\n      </div>\n\n    </div>\n\n  </md-menu-content>\n</md-menu>'),e.put("app/core/directives/ms-navigation/templates/horizontal.html",'<div class="navigation-toggle" hide-gt-sm>\n  <md-button class="md-icon-button" ng-click="vm.toggleHorizontalMobileMenu()" aria-label="Toggle Mobile Navigation">\n    <md-icon md-font-icon="icon-menu"></md-icon>\n  </md-button>\n</div>\n\n<ul class="horizontal">\n  <li ng-repeat="node in vm.navigation" ms-navigation-horizontal-node="node" ng-class="{\'has-children\': vm.hasChildren}" ng-include="\'navigation-horizontal-nested.html\'"></li>\n</ul>\n\n\x3c!-- Nested horizontal navigation template --\x3e\n<script type="text/ng-template" id="navigation-horizontal-nested.html">\n\n  <div ms-navigation-horizontal-item layout="row" ng-if="!vm.isHidden()">\n\n        <div class="ms-navigation-horizontal-button" ng-if="!node.uisref && node.title"\n             ng-class="{\'active md-accent-bg md-accent-fg\': vm.isActive}">\n            <i class="icon s18 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg" style="background: {{node.badge.color}}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s18 arrow" ng-if="vm.hasChildren"></i>\n        </div>\n\n        <a class="ms-navigation-horizontal-button" ui-sref="{{node.uisref}}" ui-sref-active="active md-accent-bg"\n           ng-class="{\'active md-accent-bg md-accent-fg\': vm.isActive}"\n           ng-if="node.uisref && node.title">\n            <i class="icon s18 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg" style="background: {{node.badge.color}}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s18 arrow" ng-if="vm.hasChildren"></i>\n        </a>\n\n    </div>\n\n    <ul ng-if="vm.hasChildren && !vm.isHidden()">\n        <li ng-repeat="node in node.children" ms-navigation-horizontal-node="node"\n            ng-class="{\'has-children\': vm.hasChildren}"\n            ng-include="\'navigation-horizontal-nested.html\'"></li>\n    </ul>\n\n<\/script>\n\x3c!-- / Nested navigation template --\x3e'),e.put("app/core/directives/ms-navigation/templates/vertical.html",'<ul>\n  <li ng-repeat="node in vm.navigation" ms-navigation-node="node" ng-class="{\'collapsed\': vm.collapsed, \'has-children\': vm.hasChildren}" ng-include="\'navigation-nested.html\'"></li>\n</ul>\n\n\x3c!-- Nested navigation template --\x3e\n<script type="text/ng-template" id="navigation-nested.html">\n\n  <div id="{{ node.id }}" ms-navigation-item layout="row" ng-if="!vm.isHidden()">\n\n        <div class="ms-navigation-button" ng-if="!node.uisref && node.title">\n            <i class="icon s16 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg margin-right-20" ng-style="{\'background\': node.badge.color}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s16 arrow" ng-if="vm.collapsable && vm.hasChildren"></i>\n        </div>\n\n        <a class="ms-navigation-button" ui-sref="{{node.uisref}}" ui-sref-active="active md-accent-bg" ng-if="node.uisref && node.title">\n            <i class="icon s16 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg margin-right-20" ng-style="{\'background\': node.badge.color}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s16 arrow" ng-if="vm.collapsable && vm.hasChildren"></i>\n        </a>\n\n    </div>\n\n    <ul ng-if="vm.hasChildren && !vm.isHidden()">\n        <li ng-repeat="node in node.children" ms-navigation-node="node"\n            ng-class="{\'collapsed\': vm.collapsed, \'has-children\': vm.hasChildren}"\n            ng-include="\'navigation-nested.html\'"></li>\n    </ul>\n\n<\/script>\n\x3c!-- / Nested navigation template --\x3e'),e.put("assets/ms-phonebar/ms-phonebar-dialpad.html",'\x3c!-- Dialpad --\x3e\n<md-content ng-if="vm_pb.showDialpad" class="num-pad" layout="column">\n  <section layout="row" layout-align="start center">\n    <span><img class="num-pad-logo" layout-padding src="/api/settings/1/logo" alt="logo" /></span>\n    <span class="md-subhead">Dialpad</span>\n    <div layout="row" layout-align="end center" flex>\n      <md-button class="md-icon-button" ng-click="vm_pb.closeDialpad()">\n        <md-icon md-font-icon="icon-close"></md-icon>\n      </md-button>\n    </div>\n  </section>\n  <md-divider></md-divider>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: 1, l: []}, {n: 2, l: [\'a\', \'b\', \'c\']}, {n: 3, l: [\'d\', \'e\', \'f\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n  </section>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: 4, l: [\'g\', \'h\', \'i\']}, {n: 5, l: [\'j\', \'k\', \'l\']}, {n: 6, l: [\'m\', \'n\', \'o\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n  </section>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: 7, l: [\'p\', \'q\', \'r\', \'s\']}, {n: 8, l: [\'t\', \'u\', \'v\']}, {n: 9, l: [\'w\', \'x\', \'y\', \'z\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n  </section>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: \'*\', l: []}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num" layout="column" layout-align="center center">\n        <div class="txt" layout="column" layout-align="center center">\n          {{item.n}}\n        </div>\n      </div>\n    </div>\n    <div class="span4" ng-repeat="item in ::[{n: 0, l: [\'+\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n    <div class="span4" ng-repeat="item in ::[{n: \'#\', l: []}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num" layout="column" layout-align="center center">\n        <div class="txt" layout="column" layout-align="center center">\n          {{item.n}}\n        </div>\n      </div>\n    </div>\n  </section>\n</md-content>\n\x3c!-- Dialpad --\x3e\n\n\x3c!-- Input&Media Area --\x3e\n<div layout="row" layout-align="start center">\n  <div layout="row" layout-align="center center">\n    \x3c!-- START Ringing Tone--\x3e\n    <md-button class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Ringing" ng-click="vm_pb.conf.ringingMute = !vm_pb.conf.ringingMute; vm_pb.initDevice(\'ringing\', true)" ng-disabled="!vm_pb.registered">\n      <md-icon md-font-icon="{{vm_pb.conf.ringingMute ? \'icon-bell-off\' : \'icon-bell-ring\'}}" class="icon s14" ng-class="vm_pb.conf.ringingMute ? \'red-fg\' : \'grey-fg\'">\n        <md-tooltip><span translate="TOOLBAR.RINGING">Ringing</span></md-tooltip>\n      </md-icon>\n    </md-button>\n    \x3c!-- END Ringing Tone --\x3e\n\n    \x3c!-- START Speaker --\x3e\n    <md-button class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Speaker" ng-click="vm_pb.conf.speakerMute = !vm_pb.conf.speakerMute; vm_pb.initDevice(\'speaker\', true)" ng-disabled="!vm_pb.registered">\n      <md-icon md-font-icon="{{vm_pb.conf.speakerMute ? \'icon-volume-off\' : \'icon-volume\'}}" class="icon s14" ng-class="vm_pb.conf.speakerMute ? \'red-fg\' : \'grey-fg\'">\n        <md-tooltip><span translate="TOOLBAR.SPEAKER">Speaker</span></md-tooltip>\n      </md-icon>\n    </md-button>\n    \x3c!-- END Speaker --\x3e\n\n    \x3c!-- START Microphone --\x3e\n    <md-button ng-disabled="(!vm_pb.registered || vm_pb.sessions.length==0)?true:false" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Microphone" ng-click="vm_pb.conf.microphoneMute = !vm_pb.conf.microphoneMute; vm_pb.initDevice(\'microphone\', true)">\n      <md-icon md-font-icon="{{vm_pb.conf.microphoneMute ? \'icon-microphone-off\' : \'icon-microphone\'}}" class="icon s14" ng-class="vm_pb.conf.microphoneMute ? \'red-fg\' : \'grey-fg\'">\n        <md-tooltip><span translate="TOOLBAR.MICROPHONE">Microphone</span></md-tooltip>\n      </md-icon>\n    </md-button>\n    \x3c!-- END Microphone --\x3e\n\n    \x3c!-- START Registered --\x3e\n    <span>\n      <span class="quantity-indicator md-red-500-bg" ng-class="vm_pb.registered ? \'md-green-500-bg\' : \'md-red-500-bg\'"></span>\n      <md-tooltip><span>{{vm_pb.conf.license ? (vm_pb.registered ? \'TOOLBAR.REGISTERED\' : \'TOOLBAR.NOT_REGISTERED\') : \'TOOLBAR.WEBRTC_LICENSE_NOT_ENABELD\' | translate}}\n          <timer ng-if="vm_pb.registered"></timer>\n        </span>\n      </md-tooltip>\n    </span>\n    \x3c!-- END Registered --\x3e\n  </div>\n  <div layout="column" layout-align="center start">\n    <div layout="row" layout-align="start center">\n      \x3c!-- START Target --\x3e\n      <angucomplete-alt id="ms-target-wrap" pause="10" local-data="vm_pb.calls" search-fields="target" title-field="target" minlength="0" input-class="input-number" disable-input="!vm_pb.registered" match-class="highlight" template-url="assets/ms-phonebar/ms-phonebar-input.html" input-changed="vm_pb.targetChanged" selected-object="vm_pb.targetSelected" clear-selected="true" ng-keypress="vm_pb.typeWrapper($event)" focus-first="true" disable-autocomplete="vm_pb.currentUser.privacyEnabled"></angucomplete-alt>\n      \x3c!-- END Target --\x3e\n\n      \x3c!-- Auto Answer --\x3e\n      <div ng-if="vm_pb.conf.autoAnswer" class="red-fg" style="padding-left: 10px;">\n        <span class="font-size-20">A<span class="font-size-16">A</span></span>\n      </div>\n      \x3c!-- Auto Answer --\x3e\n\n      <md-button class="md-fab md-mini white-bg width-30 height-30" aria-label="Dialpad" ng-click="vm_pb.toggleDialpad()" ng-disabled="!vm_pb.registered">\n        <md-icon md-font-icon="icon-apps" class="icon grey-fg s16"></md-icon>\n      </md-button>\n      <md-button ng-if="vm_pb.target" class="md-fab md-mini white-bg width-25 height-25" aria-label="Call" style="margin-left: 0px;" ng-click="vm_pb.call()">\n        <md-icon md-font-icon="icon-phone" class="icon green-fg s12"></md-icon>\n      </md-button>\n    </div>\n  </div>\n</div>\n\x3c!-- Input&Media Area --\x3e\n\n\x3c!-- START 3WC --\x3e\n<md-button ng-if="vm_pb.canGoInConference" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="3Way" ng-click="vm_pb.start3WayConf();  $event.stopPropagation();">\n  <md-icon md-font-icon="icon-account-multiple-plus" class="icon orange-fg s14"></md-icon>\n  <md-tooltip><span translate="TOOLBAR.CONFERENCE">Conference</span></md-tooltip>\n</md-button>\n\x3c!-- END 3Way --\x3e\n\n\n<div class="toolbar-separator"></div>\n\n\x3c!-- Sessions Area --\x3e\n<div class="sessions" layout="row" layout-align="start center" flex>\n  <div layout="row" layout-align="center center" ng-if="!vm_pb.conf.license">\n    <md-icon md-font-icon="icon-account-alert" class="icon s36 red-fg"></md-icon>\n    <span layout-margin translate="TOOLBAR.WEBRTC_LICENSE_NOT_ENABELD"></span>\n  </div>\n\n  <div id="{{\'div_session_\'+session.id.substr(0,32)}}" ng-repeat="session in vm_pb.sessions" class="session" layout="row" ng-click="(vm_pb.sessions.length > 1) && vm_pb.selectSession(session)">\n    <md-button ng-if="vm_pb.conf.recording && session.confirmed" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Record" ng-click="vm_pb.record(session); $event.stopPropagation();">\n      <md-icon md-font-icon="icon-radiobox-marked" class="icon s14" ng-class="session.monitor ? \'red-fg\' : \'grey-fg\'"></md-icon>\n    </md-button>\n    <div layout="column" layout-align="center start">\n      <span class="session-info">\n        <span ng-if="session.user == session.name" privacy ng-cloak>{{session.user}}</span>\n        <span ng-if="session.user != session.name" privacy ng-cloak>{{session.name}}</span> <span ng-if="session.user != session.name" privacy ng-cloak>{{session.user}}</span>\n      </span>\n      <span class="session-info" layout="row" layout="start center">\n        <timer></timer>\n      </span>\n    </div>\n\n    \x3c!-- START Answer --\x3e\n    <md-button ng-if="session.incoming && !session.confirmed" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Anser" ng-click="vm_pb.answer(session); $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone" class="icon green-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Answer --\x3e\n\n    \x3c!-- START Hangup --\x3e\n    <md-button class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Terminate" ng-click="vm_pb.terminate(session); $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone-hangup" class="icon red-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Hangup --\x3e\n\n    \x3c!-- START Hold/Unhold --\x3e\n    <md-button ng-if="session.confirmed && !vm_pb.isInConference" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Hold" ng-click="(session.localHold ? vm_pb.unhold(session) : vm_pb.hold(session)); $event.stopPropagation();">\n      <md-icon md-font-icon="{{session.localHold ? \'icon-play\' : \'icon-pause\'}}" class="icon grey-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Hold/Unhold --\x3e\n\n    \x3c!-- START Transfer --\x3e\n    <md-button ng-if="session.confirmed && !session.localHold && vm_pb.sessions.length == 1 && !vm_pb.isInConference" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Refer" ng-click="vm_pb.refer(session);  $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END transfer --\x3e\n\n    \x3c!-- START Attended Transfer --\x3e\n    <md-button ng-if="session.confirmed && !session.localHold && vm_pb.sessions.length>1" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Refer Attended" ng-click="vm_pb.referAttended(session);  $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Attended Transfer --\x3e\n  </div>\n</div>\n\x3c!-- Sessions Area --\x3e'),e.put("assets/ms-phonebar/ms-phonebar-input.html",'<div class="angucomplete-holder" ng-class="{\'angucomplete-dropdown-visible\': showDropdown}">\n  <input id="ms-target" ng-model="searchStr" ng-disabled="disableInput" type="text" placeholder="{{placeholder}}" ng-focus="onFocusHandler()" class="{{inputClass}}" ng-focus="resetHideResults()" ng-blur="hideResults($event)" autocapitalize="off" autocorrect="off" autocomplete="off" ng-change="inputChangeHandler(searchStr)" />\n  <div class="angucomplete-dropdown" ng-show="showDropdown && !(!searching && (!results || results.length == 0))">\n    <div class="angucomplete-row" ng-repeat="result in results" ng-click="selectResult(result)" ng-mouseenter="hoverRow($index)" ng-class="{\'angucomplete-selected-row\': $index == currentIndex}">\n      <div layout="row" layout-align="start center">\n        <md-icon md-font-icon="{{result.originalObject.inbound ? \'icon-arrow-bottom-left\' : \'icon-arrow-top-right\'}}" class="icon no-margin s22"></md-icon>\n        <span style="margin-left: 8px;">({{result.originalObject.time}}) - <span class="angucomplete-title" ng-if="matchClass" ng-bind-html="result.title" privacy ng-cloak></span></span>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("assets/ms-phonebar/ms-phonebar.html",'<div layout="row" layout-align="start center" flex>\n  \x3c!-- Audio stream --\x3e\n  <audio id="local-audio" autoplay hidden=true></audio>\n  <audio id="remote-audio" autoplay hidden=true></audio>\n  \x3c!-- Audio stream --\x3e\n\n  \x3c!-- WebRtc PhoneBar --\x3e\n  <div class="phonebar-container" ng-include="\'assets/ms-phonebar/ms-phonebar-dialpad.html\'" layout="row" layout-align="start center" flex></div>\n  \x3c!-- WebRtc PhoneBar --\x3e\n</div>'),e.put("assets/ms-phonebar/prefix/dialog.html",'<md-dialog aria-label="Prefix">\n  <form ng-cloak ng-keypress="vm.keyPress($event)">\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="TOOLBAR.PREFIXES">Prefixes</span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.closeDialog(-1)">\n            <md-icon class="no-margin" md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <md-radio-group ng-model="vm.prefix">\n        <md-radio-button ng-repeat="prefix in vm.prefixes.rows" value="{{prefix.prefix}}" class="md-primary">{{prefix.name}}</md-radio-button>\n        <md-radio-button ng-if="!vm.required" ng-value="null" class="md-primary">no prefix</md-radio-button>\n      </md-radio-group>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button ng-click="vm.call()" class="send-button md-accent md-raised" aria-label="call" md-autofocus ng-disabled="!vm.prefix && vm.required">\n        <span translate="TOOLBAR.CALL">CALL</span>\n      </md-button>\n      <md-button ng-click="vm.closeDialog(-1)" class="send-button md-accent md-raised" aria-label="cancel">\n        <span translate="TOOLBAR.CANCEL">Cancel</span>\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("assets/ms-phonebar/record/dialog.html",'<md-dialog aria-label="Recording" ng-init="vm.onInit()">\n  <form ng-cloak>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="TOOLBAR.RECORDING">Recording</span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding">\n            <md-icon class="no-margin" md-font-icon="icon-plus" aria-label="Add" ng-click="vm.addRecording()"></md-icon>\n          </md-button>\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.closeDialog()">\n            <md-icon class="no-margin" md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-table-container>\n      <table md-table layout-padding>\n        <thead md-head>\n          <tr md-row>\n            <th md-column><span translate="TOOLBAR.FILENAME">File name</span></th>\n            <th md-column><span translate="TOOLBAR.STATUS">Status</span></th>\n            <th md-column><span translate="TOOLBAR.ACTIONS">Actions</span></th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm.session.monitors.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="TOOLBAR.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="monitor in vm.session.monitors">\n            <td md-cell>{{monitor.filename}}</td>\n            <td md-cell class="no-padding">\n              <md-icon md-font-icon="icon-radiobox-marked" class="icon s16" ng-class="(monitor.status == \'rec\') ? \'red-fg ms-blink\' : \'grey-fg\'"></md-icon>\n            </td>\n            <td md-cell class="no-padding">\n              <md-button class="md-fab md-mini white-bg width-35 height-35 margin-5" aria-label="Record" ng-click="(monitor.status == \'rec\') ? vm.stop(monitor) : vm.start(monitor)">\n'+"                <md-icon md-font-icon=\"{{monitor.status == 'rec' ? 'icon-stop' : 'icon-play'}}\" class=\"icon s16\" ng-class=\"monitor.status == 'rec' ? 'grey-fg' : 'red-fg'\"></md-icon>\n              </md-button>\n            </td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n  </form>\n</md-dialog>"),e.put("assets/ms-phonebar/referAttended/dialog.html",'<md-dialog aria-label="Transfer">\n  <form ng-cloak>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="TOOLBAR.ATTENDED_TRANSFER">Transfer</span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.closeDialog()">\n            <md-icon class="no-margin" md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <label translate="TOOLBAR.TARGET">Target</label>\n      <md-input-container class="md-block">\n        <md-select ng-model="vm.target">\n          <md-option ng-repeat="session in vm.sessions" ng-value="session.user">\n            {{ session.name }}\n          </md-option>\n        </md-select>\n      </md-input-container>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button ng-click="vm.transfer()" class="send-button md-accent md-raised" aria-label="transfer" ng-disabled="!vm.target && !vm.sessionId">\n        <span translate="TOOLBAR.TRANSFER">TRANSFER</span>\n      </md-button>\n      <md-button ng-click="vm.closeDialog()" class="send-button md-accent md-raised" aria-label="cancel">\n        <span translate="TOOLBAR.CANCEL">Cancel</span>\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("assets/ms-phonebar/settings/settings.html",'<md-dialog class="md-phonebar-dialog" aria-label="{{vm.name}}">\n  <form name="settingsForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="TOOLBAR.SETTINGS">Settings</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content class="no-padding">\n      <md-tabs md-no-pagination md-stretch-tabs="always">\n        <md-tab label="{{ \'TOOLBAR.PROFILE\' | translate}}">\n          <md-content layout-padding layout="column">\n            <span><span translate="TOOLBAR.FULLNAME">Fullname</span>: {{vm.conf.fullname}}</span>\n            <span><span translate="TOOLBAR.NAME">Name</span>: {{vm.conf.name}}</span>\n            <span><span translate="TOOLBAR.INTERNAL">Internal</span>: {{vm.conf.internal}}</span>\n            <span><span translate="TOOLBAR.BROWSER">Browser</span>: {{vm.conf.browserName}} {{vm.conf.browserVersion}}</span>\n            <span><span translate="TOOLBAR.OS">OS</span>: {{vm.conf.osName}} {{vm.conf.osVersion}}</span>\n          </md-content>\n        </md-tab>\n        <md-tab label="{{ \'TOOLBAR.SERVICES\' | translate}}">\n          <md-content layout-padding>\n            <md-input-container class="md-block">\n              <md-switch ng-model="vm.conf.autoAnswer" aria-label="Auto Answer">\n                <span translate="TOOLBAR.AUTOANSWER">Auto Answer</span>\n                <span>{{ vm.conf.autoAnswerDelay }} [s]</span>\n              </md-switch>\n            </md-input-container>\n          </md-content>\n        </md-tab>\n        <md-tab label="{{ \'TOOLBAR.AUDIO\' | translate}}">\n          <md-content layout-padding>\n            <div class="border brad-5" layout-margin>\n              <md-input-container class="md-block" ng-if="(vm.devices | filter: { kind: \'audiooutput\' }).length">\n                <label translate="TOOLBAR.RINGINGDEVICE">Ringing Device</label>\n                <md-select name="ringingDevice" ng-model="vm.conf.ringingId" required>\n                  <md-option ng-value="device.deviceId" ng-repeat="device in vm.devices | filter: { kind: \'audiooutput\' }">{{ device.label || (\'Speaker \' + ($index + 1)) }}</md-option>\n                </md-select>\n                <div ng-messages="settingsForm[\'ringingDevice\'].$error" ng-show="settingsForm[\'ringingDevice\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <div layout="row" layout-align="space-between center">\n                <md-switch ng-model="vm.conf.ringingMute" aria-label="Mute">\n                  Mute\n                </md-switch>\n\n                <md-slider-container flex="80">\n                  <md-slider flex step="0.1" min="0" max="1" ng-model="vm.conf.ringingVolume" aria-label="volume"></md-slider>\n                </md-slider-container>\n              </div>\n            </div>\n\n            <div class="border brad-5" layout-margin>\n              <md-input-container class="md-block" ng-if="(vm.devices | filter: { kind: \'audiooutput\' }).length">\n                <label translate="TOOLBAR.SPEAKERDEVICE">Speaker Device</label>\n                <md-select name="speakerDevice" ng-model="vm.conf.speakerId" required>\n                  <md-option ng-value="device.deviceId" ng-repeat="device in vm.devices | filter: { kind: \'audiooutput\' }">{{ device.label || (\'Speaker \' + ($index + 1)) }}</md-option>\n                </md-select>\n                <div ng-messages="settingsForm[\'speakerDevice\'].$error" ng-show="settingsForm[\'speakerDevice\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <div layout="row" layout-align="space-between cetner">\n                <md-switch ng-model="vm.conf.speakerMute" aria-label="Mute">\n                  Mute\n                </md-switch>\n\n                <md-slider-container flex="80">\n                  <md-slider flex step="0.1" min="0" max="1" ng-model="vm.conf.speakerVolume" aria-label="volume"></md-slider>\n                </md-slider-container>\n              </div>\n            </div>\n\n            <div class="border brad-5" layout-margin>\n              <md-input-container class="md-block" ng-if="(vm.devices | filter: { kind: \'audioinput\' }).length">\n                <label translate="TOOLBAR.MICROPHONEDEVICE">Microphone Device</label>\n                <md-select name="microphoneDevice" ng-model="vm.conf.microphoneId" required>\n                  <md-option ng-value="device.deviceId" ng-repeat="device in vm.devices | filter: { kind: \'audioinput\' }">{{ device.label || (\'Microphone \' + ($index + 1))}}</md-option>\n                </md-select>\n                <div ng-messages="settingsForm[\'microphoneDevice\'].$error" ng-show="settingsForm[\'microphoneDevice\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n              <div layout="row" layout-align="space-between center">\n                <md-switch ng-disabled="vm.activeSessions.length==0" ng-model="vm.conf.microphoneMute" aria-label="Mute">\n                  Mute\n                </md-switch>\n              </div>\n            </div>\n          </md-content>\n        </md-tab>\n        <md-tab label="{{ \'TOOLBAR.REQUIREMENTS\' | translate}}">\n          <md-content layout-padding>\n            <md-list>\n              <md-list-item>\n                <h3 translate="TOOLBAR.LICENSE">License</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.license ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.license ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.BROWSER_COMPATIBILITY">Browser Compatibility</h3>\n                <md-icon class="md-secondary" ng-class="vm.isCompatibleBrowser() ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.isCompatibleBrowser() ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.HTTPS">HTTPS</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.protocol === \'https\' ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.protocol === \'https\' ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.WEBRTCSUPPORT">WebRTC Support</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.isWebRTCSupported ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.isWebRTCSupported ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.MICROPHONE">Microphone</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.hasMicrophone ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.hasMicrophone ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.SPEAKER">Speaker</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.hasSpeakers ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.hasSpeakers ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n            </md-list>\n          </md-content>\n        </md-tab>\n      </md-tabs>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveSettings()" class="send-button md-accent md-raised" ng-disabled="settingsForm.$invalid || settingsForm.$pristine" aria-label="SAVE" translate="TOOLBAR.SAVE" translate-attr-aria-label="TOOLBAR.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/core/directives/ms-quick-filter/ms-quick-filter.html",'<div ng-cloak layout="row" class="quick-filter-container" flex>\n  <div ng-repeat="filter in vm.filters" ng-if="filter.ngIf ? $eval(\'vm.query.\' + filter.ngIf) : true" layout="column" class="padding-horizontal-16">\n    <span class="font-size-10" translate="{{ filter.label }}" />\n    <md-select ng-if="filter.type === \'select\'" class="font-size-12 no-margin" ng-model="vm.query[filter.key]" ng-change="vm.search()" aria-label="Filter {{ filter.name }}">\n      <md-option ng-repeat="option in filter.options" ng-value="filter.ngValue ? option[filter.ngValue] : option.id">\n        {{ option.name }}</md-option>\n      <md-option ng-repeat="option in filter.customOptions" ng-value="option.value" translate="{{ option.translate }}">\n      </md-option>\n    </md-select>\n\n    <md-select ng-if="filter.type === \'multiselect\'" multiple class="font-size-12 no-margin" ng-init="vm.onMultiselectInit(filter)" ng-model="vm.query[filter.key]" ng-disabled="filter.options.length === 0" ng-change="vm.onMultiselectSelection(filter, isOpen)" md-selected-text="vm.placeholders[filter.key]" aria-label="Filter {{ filter.name }}" md-on-open="isOpen = true" md-on-close="isOpen = false">\n      <md-option ng-repeat="option in filter.options" ng-value="filter.ngValue ? option[filter.ngValue] : option.id" ng-disabled="filter.clearAll === false && vm.query[filter.key].length === 1 && vm.query[filter.key][0] === (filter.ngValue ? option[filter.ngValue] : option.id)">\n        {{ option.name }}</md-option>\n      <md-button ng-if="vm.query[filter.key].length &lt; filter.options.length" ng-click="vm.selectAll(filter)" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.SELECT_ALL\' | translate}}</md-button>\n      <md-button ng-if="vm.query[filter.key].length === filter.options.length" ng-click="vm.clearSelection(filter)" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.CLEAR\' | translate}}</md-button>\n    </md-select>\n\n    <div ng-if="filter.type === \'date\'" layout="row" layout-align="center center">\n      <md-date-range ng-init="vm.onDateRangeInit(filter)" localization-map="vm.localizationMap" ng-model="vm.pickerModels[filter.key]" auto-confirm="true" show-template="true" md-on-select="vm.onDateRangeSelection(filter)" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}">\n      </md-date-range>\n      <md-button ng-if="vm.pickerModels[filter.key].dateStart" ng-click="vm.clearDate(filter)" class="md-icon-button no-margin no-padding width-20 height-20" aria-label="Clear date filter">\n        <md-icon md-font-icon="icon-close" class="quick-filter-date-clear-button s16"></md-icon>\n      </md-button>\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-search-bar/ms-search-bar.html",'<div flex layout="row" layout-align="start center">\n  <label>\n    <md-button class="ms-search-bar-expander md-icon-button" aria-label="Expand Search Bar" ng-click="vm.expandBar()" ng-if="!vm.resultsLoading || !vm.expanded" ng-class="{\'ms-search-button-expanded\': vm.expanded }">\n      <md-icon id="ms-search-bar-icon" md-font-icon="icon-magnify" class="s24" ng-class="{\'{{ vm.iconColor }}\': vm.iconColor && !vm.expanded }"></md-icon>\n    </md-button>\n    <div class="ms-search-bar-loader" layout="row" layout-align="center center" ng-if="vm.resultsLoading && vm.expanded">\n      <md-progress-circular class="md-accent" md-diameter="32" md-mode="indeterminate"></md-progress-circular>\n    </div>\n  </label>\n  <input ng-if="vm.expanded" focus-on="vm.expanded" type="text" placeholder="{{ \'TOOLBAR.SEARCH\' | translate }}" flex ng-model="vm.query.filter" ng-model-options="vm.queryOptions" ng-blur="vm.blurCollapse()" ng-keydown="vm.onKeyDown($event)" />\n  <md-button class="ms-search-bar-collapser md-icon-button" ng-click="vm.collapseBar()" aria-label="Collapse Search Bar">\n    <md-icon md-font-icon="icon-close" class="icon s24"></md-icon>\n  </md-button>\n  <div class="ms-search-bar-results" ng-if="vm.results">\n    <div class="no-results" ng-if="vm.results.length === 0">{{ \'DASHBOARDS.NO_RESULTS_AVAILABLE\' | translate }}</div>\n    <div class="result" ng-repeat="result in vm.results" ng-click="vm.handleResultClick(result)" ng-mouseenter="vm.handleMouseEnter($index)" ng-mousedown="vm.absorbEvent($event)" ng-class="{\'selected\': $index == vm.selectedResultIndex}" md-ink-ripple>\n      <div layout="row" layout-align="start center">\n        <div class="icon-container" layout="row" layout-align="center center">\n          <i ng-if="result.icon" class="icon {{ result.icon }}"></i>\n          <div ng-if="!result.icon" class="square md-accent-bg"></div>\n        </div>\n        <div>\n          <div class="title">{{ result.title }}</div>\n          <div class="description" ng-if="result.description">{{ result.description }}</div>\n        </div>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-shortcuts/ms-shortcuts.html",'<div class="shortcuts-container" layout="row" layout-align="space-between center" flex ng-class="{\'mobile-bar-active\': MsShortcuts.mobileBarActive}">\n\n  <div class="flex-noshrink" layout="row" layout-align="start center" flex>\n    <div class="shortcuts hide show-gt-xs" layout="row" layout-align="start center" ng-if="MsShortcuts.shortcuts.length > 0" ng-sortable="MsShortcuts.sortableOptions">\n      <div ng-repeat="shortcut in MsShortcuts.shortcuts" layout="row" layout-align="center center">\n        <md-button class="md-icon-button shortcut" aria-label="{{shortcut.title}}" ui-sref="{{shortcut.uisref}}">\n          <md-icon ng-if="shortcut.icon" md-font-icon="{{shortcut.icon}}" class="icon s24"></md-icon>\n          <div ng-if="!shortcut.icon" class="first-letter">{{shortcut.title.charAt(0)}}</div>\n          <md-tooltip md-direction="bottom">{{shortcut.title}}</md-tooltip>\n        </md-button>\n      </div>\n    </div>\n\n    \x3c!-- <md-menu md-offset="8 56" class="shortcut-menu hide show-gt-xs">\n            <md-button class="md-icon-button add-shortcut-button" aria-label="Add shortcut"\n                       ng-click="$mdOpenMenu($event)">\n                <md-icon md-menu-origin md-font-icon="icon-star" class="icon amber-600-fg s24"></md-icon>\n                <md-tooltip md-direction="bottom">Click to add/remove shortcut</md-tooltip>\n            </md-button>\n\n            <md-menu-content>\n                <div id="ms-shortcut-add-menu">\n                    <div class="shortcut-search" layout="row" layout-align="start center">\n                        <div class="search-icon" layout="row" layout-align="center center"\n                             ng-if="!MsShortcuts.resultsLoading">\n                            <md-icon md-menu-align-target md-font-icon="icon-magnify" class="icon s24"></md-icon>\n                        </div>\n                        <div class="shortcut-loader" layout="row" layout-align="center center"\n                             ng-if="MsShortcuts.resultsLoading">\n                            <md-progress-circular class="md-accent" md-diameter="20" md-mode="indeterminate">\n                            </md-progress-circular>\n                        </div>\n\n                        <input type="text" placeholder="Search" flex\n                               ng-model="MsShortcuts.query"\n                               ng-model-options="MsShortcuts.queryOptions"\n                               ng-keydown="MsShortcuts.handleKeydown($event)">\n                    </div>\n\n                    <div class="results" ng-if="MsShortcuts.results" >\n                        <div class="no-results" ng-if="MsShortcuts.results.length === 0">No Results!</div>\n\n                        <div class="result" ng-repeat="result in MsShortcuts.results"\n                             ng-click="MsShortcuts.handleResultClick(result)"\n                             ng-mouseenter="MsShortcuts.handleMouseenter($index)"\n                             ng-mousedown="MsShortcuts.absorbEvent($event)"\n                             ng-class="{\'selected\': $index == MsShortcuts.selectedResultIndex}"\n                             md-prevent-menu-close="md-prevent-menu-close"\n                             md-ink-ripple>\n                            <div layout="row" layout-align="start space-between">\n                                <div layout="row" layout-align="start center" flex>\n                                    <div class="icon icon-container" layout="row" layout-align="center center">\n                                        <i ng-if="result.icon" class="{{result.icon}}"></i>\n                                        <div ng-if="!result.icon" class="square md-accent-bg"></div>\n                                    </div>\n                                    <div>\n                                        <div class="title">{{result.title}}</div>\n                                    </div>\n                                </div>\n                                <md-icon md-font-icon="icon-pin" class="icon s18"\n                                         ng-class="{\'fade-text\': !result.hasShortcut}"></md-icon>\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </md-menu-content>\n        </md-menu> --\x3e\n  </div>\n\n  <md-button class="md-icon-button toggle-mobile-menu hide-gt-xs" aria-label="Add shortcut" ng-click="MsShortcuts.toggleMobileBar()">\n    <md-icon md-menu-origin md-font-icon="icon-star" class="icon amber-600-fg s24" ng-hide="MsShortcuts.mobileBarActive"></md-icon>\n    <md-icon md-menu-origin md-font-icon="icon-close" class="icon s24" ng-hide="!MsShortcuts.mobileBarActive"></md-icon>\n  </md-button>\n</div>'),e.put("app/core/directives/ms-stepper/templates/horizontal/horizontal.html",'<div class="ms-stepper-horizontal">\n  <div class="ms-stepper-navigation-wrapper">\n    <div class="ms-stepper-navigation" layout="row" layout-align="center center">\n      <md-button class="ms-stepper-navigation-item" ng-class="{\'current\': MsStepper.isStepCurrent(step.stepNumber), \'valid\': MsStepper.isStepValid(step.stepNumber), \'disabled\': MsStepper.isStepDisabled(step.stepNumber), \'optional\': MsStepper.isStepOptional(step.stepNumber)}" ng-click="MsStepper.gotoStep(step.stepNumber)" ng-disabled="MsStepper.isStepDisabled(step.stepNumber)" ng-repeat="step in MsStepper.steps | filter:MsStepper.filterHiddenStep" layout="row" layout-align="start center">\n\n        <div class="step md-accent-bg" layout="row" layout-align="center center">\n          <span ng-if="!MsStepper.isStepValid(step.stepNumber) || MsStepper.isStepOptional(step.stepNumber)">\n            {{$index + 1}}\n          </span>\n          <span ng-if="MsStepper.isStepValid(step.stepNumber) && !MsStepper.isStepOptional(step.stepNumber)">\n            <i class="icon icon-check s18"></i>\n          </span>\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="title" translate="{{step.stepTitleTranslate}}">{{step.stepTitle}}</div>\n          <div class="subtitle" ng-if="MsStepper.isStepOptional(step.stepNumber)">Optional</div>\n        </div>\n      </md-button>\n    </div>\n  </div>\n\n  <div class="ms-stepper-steps" ng-transclude></div>\n\n  <div class="ms-stepper-controls" layout="row" layout-align="center center">\n    <md-button class="md-accent md-raised" ng-disabled="MsStepper.isFirstStep()" ng-click="MsStepper.gotoPreviousStep()">\n      Back\n    </md-button>\n\n    <div class="ms-stepper-dots">\n      <span ng-repeat="step in MsStepper.steps" ng-hide="MsStepper.isStepHidden(step.stepNumber)" ng-class="{\'selected md-accent-bg\':MsStepper.currentStepNumber === $index + 1}">\n      </span>\n    </div>\n\n    <md-button class="md-accent md-raised" ng-if="!MsStepper.isLastStep()" ng-disabled="!MsStepper.isStepValid(MsStepper.currentStepNumber)" ng-click="MsStepper.gotoNextStep()">\n      Next\n    </md-button>\n\n    <md-button type="submit" class="md-accent md-raised" ng-click="MsStepper.resetForm()" ng-if="MsStepper.isLastStep()" ng-disabled="!MsStepper.isFormValid()">\n      Submit\n    </md-button>\n  </div>\n</div>'),e.put("app/core/directives/ms-stepper/templates/vertical/step/vertical-step.html",'<md-button class="ms-stepper-navigation-item" ng-class="{\'current\': MsStepper.isStepCurrent(stepInfo.stepNumber), \'valid\': MsStepper.isStepValid(stepInfo.stepNumber), \'disabled\': MsStepper.isStepDisabled(stepInfo.stepNumber), \'optional\': MsStepper.isStepOptional(stepInfo.stepNumber)}" ng-click="MsStepper.gotoStep(stepInfo.stepNumber)" ng-disabled="MsStepper.isStepDisabled(stepInfo.stepNumber)" ng-hide="MsStepper.isStepHidden(stepInfo.stepNumber)" aria-label="Stepper navigation button" layout="row" layout-align="start center">\n\n  <div class="step" layout="row" layout-align="center center">\n    <span ng-if="!MsStepper.isStepValid(stepInfo.stepNumber) || MsStepper.isStepOptional(stepInfo.stepNumber)">\n      <i class="icon icon-checkbox-blank-circle-outline s18 md-accent-fg"></i>\n    </span>\n    <span ng-if="MsStepper.isStepValid(stepInfo.stepNumber) && !MsStepper.isStepOptional(stepInfo.stepNumber)">\n      <i class="icon icon-check-circle s18 md-accent-fg"></i>\n    </span>\n  </div>\n\n  <div layout="column" layout-align="start start">\n    <div class="title" ng-if="stepInfo.stepTitleTranslate">{{stepInfo.stepTitleTranslate | translate }}</div>\n    <div class="title" ng-if="!stepInfo.stepTitleTranslate">{{stepInfo.stepTitle}}</div>\n    <div class="subtitle" ng-if="MsStepper.isStepOptional(stepInfo.stepNumber)">Optional</div>\n  </div>\n</md-button>\n\n<div class="ms-stepper-step-content" ng-transclude></div>\n\n<div class="ms-stepper-controls" layout="row" layout-align="start center" ng-show="MsStepper.isStepCurrent(stepInfo.stepNumber)">\n  <md-button class="md-accent md-raised" ng-disabled="MsStepper.isFirstStep()" ng-click="MsStepper.gotoPreviousStep()">\n    Back\n  </md-button>\n\n  <md-button class="md-accent md-raised" ng-if="!MsStepper.isLastStep()" ng-disabled="!MsStepper.isStepValid(MsStepper.currentStepNumber)" ng-click="MsStepper.gotoNextStep()">\n    Next\n  </md-button>\n\n  <md-button type="submit" class="md-accent md-raised" ng-click="MsStepper.resetForm()" ng-if="MsStepper.isLastStep()" ng-disabled="!MsStepper.isFormValid()">\n    Submit\n  </md-button>\n</div>'),e.put("app/core/directives/ms-stepper/templates/vertical/vertical.html",'<div class="ms-stepper-vertical">\n  <div class="ms-stepper-vertical-line"></div>\n  <div class="ms-stepper-steps" ng-transclude></div>\n</div>'),e.put("app/core/directives/ms-tab-scroll/ms-tab-scroll.html",'<div layout="row">\n  <md-button class="md-icon-button md-mini width-25 no-margin scroll-arrow" ng-click="vm.onTabScroll(\'left\')" ng-if="vm.canScroll(\'left\') == true">\n    <md-icon md-font-icon="icon-chevron-left" class="icon s26"></md-icon>\n  </md-button>\n  <div id="bar-container" layout="row" class="bar-container">\n    <div ng-transclude id="tab-container" layout="row" layout-align="start center" class="scroll-container">\n    </div>\n  </div>\n  <md-button class="md-icon-button md-mini width-25 no-margin scroll-arrow" ng-click="vm.onTabScroll(\'right\')" ng-if="vm.canScroll(\'right\') == true">\n    <md-icon md-font-icon="icon-chevron-right" class="icon s26"></md-icon>\n  </md-button>\n</div>'),e.put("app/core/directives/ms-timezone/ms-timezone.html",'<md-select ng-model="ngModel" class="no-margin" ng-change="ngChange()">\n  <md-option ng-value="null">NONE</md-option>\n  <md-option ng-repeat="t in timezone | orderBy:\'utcOffset\'" value="{{t.name}}">{{t.name}} ({{t.offsetStr}})</md-option>\n</md-select>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-counter/ms-widget-engine.counter.html",'<div class="pt-8 pb-32" layout="column" layout-align="center center" layout-fill ng-controller="MsWidgetEngineCounterController as vm">\n  <div ng-class="\'font-size-\' + (vm.fontSize * 3)" ng-style="{\'color\': widget.foreground}">\n    {{ vm.getCount(widget) }}\n  </div>\n  <div ng-class="\'font-size-\' + vm.fontSize" ng-style="{\'color\': widget.foreground}">{{ \'TOOLS.\' +  vm.label | uppercase | translate }}<span ng-if="vm.filtered">*</span></div>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-multibar-chart/ms-widget-engine.multibar-chart.html",'<div ng-controller="MsWidgetEngineMultibarChartController as vm" ng-init="vm.getMultiBarChart(widget)" layout="column" layout-fill>\n\n  <span ng-show="false">{{ vm.getMultiBarChart(widget)}}</span>\n\n  <canvas style="overflow:scroll" id="bar" class="chart-horizontal-bar" chart-data="vm.multiBarChart.data" chart-options="vm.multiBarChart.options" chart-series="vm.multiBarChart.series" chart-labels="vm.multiBarChart.labels">\n  </canvas>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-pie-chart/ms-widget-engine.pie-chart.html",'<div ng-controller="MsWidgetEnginePieChartController as vm" ng-init="vm.getPieChart(widget)" layout="column" layout-fill>\n\n  <span ng-show="false">{{ vm.getPieChart(widget)}}</span>\n\n  <canvas style="overflow:scroll" id="pie" class="chart-pie" chart-data="vm.pieChart.data" chart-labels="vm.pieChart.labels" chart-options="vm.pieChart.options">\n  </canvas>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-web-report/ms-widget-engine.web-report.html",'<div ng-controller="MsWidgetEngineWebReportController as vm" ng-init="vm.onInit(widget)">\n  <dl ng-if="vm.error">\n    <dt class="text-bold">Query Error</dt>\n    <dd>{{vm.error.sql}}</dd>\n    <dt>Message</dt>\n    <dd>{{vm.error.msg}}</dd>\n  </dl>\n  <md-toolbar class="md-table-toolbar md-default">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead">{{vm.title}}</span>\n      <div flex></div>\n      <md-button class="md-icon-button" ng-click="vm.onInit(widget)" aria-label="refresh">\n        <md-icon md-font-icon="icon-refresh"></md-icon>\n      </md-button>\n      <span ng-if="vm.refresh && vm.countDown" class="md-subhead blue-fg">{{vm.countDown}}</span>\n    </div>\n  </md-toolbar>\n  <md-table-container ng-if="!vm.error">\n    <table md-table md-progress="vm.promise">\n      <thead md-head>\n        <tr md-row>\n          <th md-column ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-repeat="row in vm.results.rows">\n          <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n        </tr>\n        <tr md-row ng-if="!vm.results.rows.length">\n          <td md-cell colspan="{{vm.columns.length}}">\n            <div layout="row" layout-align="center center">\n              <span>No Data</span>\n            </div>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.results.count}}" md-on-paginate="vm.getResults" md-page-select></md-table-pagination>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine.html",'<div gridster="vm.config">\n  <ul>\n    <li gridster-item="widget" ng-repeat="widget in vm.config.widgets">\n      <md-card layout-fill>\n        <md-toolbar class="height-40" ng-style="{\'background-color\': widget.background, \'color\': widget.foreground }">\n          <div class="md-toolbar-tools height-40 no-margin" layout="row" layout-align="start center">\n            <a ng-href="{{widget.link ? widget.link : \'javascript:void(0)\'}}" ng-style="{\'color\': widget.foreground, \'font-size\': (widget.titleFontSize || 12) }" class="text-truncate" flex>\n              {{ widget.title || \'No Title\' }}\n            </a>\n            <md-button ng-if="!vm.config.preview" class="draggable md-icon-button width-30 no-margin no-padding" aria-label="Move">\n              <md-tooltip><span translate="TOOLS.MOVE_WIDGET">Move</span></md-tooltip>\n              <md-icon md-font-icon="icon-cursor-move" class="s20" ng-style="{\'color\': widget.foreground}"></md-icon>\n            </md-button>\n            <md-menu ng-if="!vm.config.preview">\n              <md-button ng-click="$mdOpenMenu($event)" class="md-icon-button width-30 no-margin no-padding" aria-label="More">\n                <md-icon md-font-icon="icon-dots-vertical" class="s20" ng-style="{\'color\': widget.foreground}"></md-icon>\n              </md-button>\n              <md-menu-content>\n                <md-menu-item>\n                  <md-button ng-click="vm.onEdit({widget: widget})" translate="TOOLS.EDIT_WIDGET">Edit\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.onDelete({widget: widget})" translate="TOOLS.DELETE_WIDGET">\n                    Delete</md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n\n          </div>\n        </md-toolbar>\n        <md-card-content class="resizable" layout="column" layout-align="center center" flex ng-style="{\'background-color\': widget.background, \'color\': widget.foreground}">\n          <div ng-switch="widget.type" layout-fill>\n            <iframe ng-switch-when="iframe|custom" ng-switch-when-separator="|" ng-src="{{vm.getTrustedURL(widget.attrs[0].value)}}" frameborder=0 style="border:0px; width:100%; height:100%;"></iframe>\n            <ds-widget-clock ng-class="\'font-size-\' + (widget.attrs[2].value || 12)" ng-switch-when="clock" digital-format="widget.attrs[0].value" gmt-offset="widget.attrs[1].value" data-show-digital show-gmt-info></ds-widget-clock>\n            <div ng-switch-default layout-fill>\n              <div ng-include="widget.templateUrl" layout-fill></div>\n            </div>\n          </div>\n        </md-card-content>\n      </md-card>\n    </li>\n  </ul>\n</div>'),e.put("app/core/layouts/content-only.html",'<div id="layout-content-only" class="template-layout" layout="column" flex>\n  <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n</div>'),e.put("app/core/layouts/content-with-toolbar.html",'<div id="layout-content-with-toolbar" class="template-layout" layout="column" flex>\n  <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp" ui-view="toolbar"></md-toolbar>\n  <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n\n  <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n</div>'),e.put("app/core/layouts/horizontal-navigation.html",'<div id="layout-horizontal-navigation" class="template-layout" layout="column" flex>\n\n  <div id="toolbar-navigation-container" class="md-whiteframe-1dp" layout="column" layout-align="space-between start">\n    <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp" ui-view="toolbar"></md-toolbar>\n    <div id="horizontal-navigation" ui-view="navigation" layout="row" layout-align="start end" flex></div>\n  </div>\n\n  <div id="content-container" flex layout="column">\n    <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n  </div>\n\n  <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n\n</div>'),e.put("app/core/layouts/vertical-navigation-fullwidth-toolbar-2.html",'<div id="layout-vertical-navigation-fullwidth-toolbar-2" class="template-layout" layout="column" flex>\n\n  <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp md-accent" ui-view="toolbar"></md-toolbar>\n\n  <div id="main-container" layout="row" flex>\n    <md-sidenav id="vertical-navigation" class="md-primary-bg" md-is-locked-open="$mdMedia(\'gt-sm\')" md-component-id="navigation" ui-view="navigation"></md-sidenav>\n\n    <div id="content-container" flex layout="column">\n      <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n    </div>\n\n    <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n  </div>\n\n\n</div>'),e.put("app/core/layouts/vertical-navigation-fullwidth-toolbar.html",'<div id="layout-vertical-navigation-fullwidth-toolbar" class="template-layout" layout="column" flex>\n\n  <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp md-accent" ui-view="toolbar"></md-toolbar>\n\n  <div id="main-container" layout="row" flex>\n    <md-sidenav id="vertical-navigation" class="md-primary-bg" md-is-locked-open="$mdMedia(\'gt-sm\')" md-component-id="navigation" ui-view="navigation"></md-sidenav>\n\n    <div id="content-container" flex layout="column">\n      <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n    </div>\n\n    <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n  </div>\n\n\n</div>'),e.put("app/core/layouts/vertical-navigation.html",'<div id="header" ui-view="header"></div>\n\n<div id="layout-vertical-navigation" class="template-layout" layout="row" flex>\n\n  <md-sidenav id="vertical-navigation" class="md-primary-bg" md-is-locked-open="$mdMedia(\'gt-sm\')" md-component-id="navigation" ui-view="navigation" ng-if="!vm.isAgent()"></md-sidenav>\n\n  <div id="content-container" flex layout="column">\n    <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp" ui-view="toolbar"></md-toolbar>\n\n    <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n  </div>\n\n  <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n\n</div>\n\n<div id="footer" ui-view="footer"></div>'),e.put("app/core/theme-options/theme-options.html",'<div class="ms-theme-options-button md-primary-bg" ng-click="toggleOptionsSidenav()">\n  <md-icon md-font-icon="icon-cog" class="white-text"></md-icon>\n</div>\n\n<md-sidenav md-component-id="motion-theme-options" class="md-sidenav-right">\n\n  <div class="ms-theme-options-list" layout="column">\n    <div class="theme-option layout-options">\n      <div class="option-title">Layout Style:</div>\n      <md-radio-group layout="row" layout-align="start start" layout-wrap ng-model="vm.layoutStyle" ng-change="vm.updateLayoutStyle()">\n        <md-radio-button ng-repeat="layoutStyle in vm.layoutStyles" ng-value="layoutStyle.value">\n          <div layout="column" layout-align="center center">\n            <img ng-src="{{layoutStyle.figure}}">\n            <span class="text-center font-size-12 mt-8">{{layoutStyle.label}}</span>\n          </div>\n        </md-radio-button>\n      </md-radio-group>\n    </div>\n\n    <md-divider></md-divider>\n\n    <div class="theme-option">\n      <div class="option-title">Layout Mode:</div>\n      <md-radio-group layout="row" layout-align="start center" ng-model="vm.layoutMode" ng-change="vm.updateLayoutMode()">\n        <md-radio-button ng-repeat="layoutMode in vm.layoutModes" ng-value="layoutMode.value">\n          {{layoutMode.label}}\n        </md-radio-button>\n      </md-radio-group>\n    </div>\n\n    <md-divider></md-divider>\n\n    <div class="theme-option color-palettes">\n      <div class="option-title">Color Palette:</div>\n      <div layout="row" layout-align="start start" layout-wrap>\n        <md-button ng-repeat="(themeName, theme) in vm.themes.list" class="md-raised theme-button" layout="row" layout-align="center center" aria-label="{{themeName}}" ng-click="vm.setActiveTheme(themeName)" ng-style="{\'background-color\': theme.primary.color,\'border-color\': theme.accent.color,\'color\': theme.primary.contrast1}" ng-class="{active: vm.getActiveTheme().name === themeName}">\n          <md-icon ng-style="{\'color\': theme.primary.contrast1}" md-font-icon="icon-palette" class="icon s32"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n</md-sidenav>'),e.put("app/errors/404/error-404.html",'<div id="error-404" layout="column" layout-align="center center">\n  <div class="content" layout="column" layout-align="center center">\n    <div class="error-code" translate="ERROR404.CODE">404</div>\n\n    <div class="message" translate="ERROR404.MESSAGE">Sorry but we couldn’t find the page you are looking for</div>\n    <ms-search-bar on-search="vm.search(query)" on-result-click="vm.searchResultClick(item)" debounce="300">Search for anything</ms-search-bar>\n\n    \x3c!-- <div class="search md-whiteframe-1dp" layout="row" layout-align="start center">\n            <md-icon md-font-icon="icon-magnify" class="icon s24"></md-icon>\n            <input ng-model="vm.search" type="text" placeholder="Search for anything" translate translate-attr-placeholder="ERROR404.SEARCH" flex>\n        </div> --\x3e\n\n    <a class="md-button md-raised md-primary back-link" href="/" translate="ERROR404.GO_BACK">Go back to dashboard</a>\n  </div>\n</div>'),e.put("app/errors/500/error-500.html",'<div id="error-500" layout="column" layout-align="center center">\n  <div ng-if="!vm.send" class="content" layout="column" layout-align="center center">\n    <div class="error-code" translate="ERROR500.CODE">500</div>\n    <div class="message" translate="ERROR500.MESSAGE">Well, you broke the internet!</div>\n    <div class="sub-message" translate="ERROR500.SUBMESSAGE">Just kidding, looks like we have an internal issue, please try again in couple minutes\n    </div>\n    <a class="md-button md-raised md-primary back-link" href="/" translate="ERROR500.GO_BACK">Go back to dashboard</a>\n    <md-button class="md-raised md-warn" ng-click="vm.sendReport()" translate="ERROR500.REPORT">Report this problem</md-button>\n  </div>\n  <pre ng-if="!vm.send">\n  {{vm.error}}\n  </pre>\n  <div ng-if="vm.send" class="content" layout="column" layout-align="center center">\n    <div class="error-code">#{{vm.code}}</div>\n    <div class="message" translate="ERROR500.JIRA_MESSAGE">Your request has been received and will be processed shortly.</div>\n    <div class="sub-message" translate="ERROR500.JIRA_SUBMESSAGE">Sorry for the inconvenience. If you have any questions or concerns, please do not hesitate to contact us.</div>\n    <a class="md-button md-raised md-primary back-link" href="/" translate="ERROR500.GO_BACK">Go back to dashboard</a>\n  </div>\n</div>'),e.put("app/footer/layouts/vertical-navigation/footer.html",'<div layout="row" layout-align="start center">\n  <ms-info-bar ng-if="!vm.cookieAlertHide" on-close="vm.cookieAlertOnClose()" class="grey-100-bg">\n    <div layout="row" layout-align="start center">\n      <span translate="FOOTER.COOKIE_LAW" flex class="text-center grey-600-fg"></span>\n    </div>\n  </ms-info-bar>\n</div>'),e.put("app/forgot/forgot.html",'<div id="forgot-password" class="flex-scrollable" layout="column" ng-init="vm.onInit()">\n  <div id="forgot-password-form-wrapper" layout="column" layout-align="center center">\n    <div id="forgot-password-form" class="md-whiteframe-8dp">\n\n      <img src="/api/settings/1/logo_login" alt="logo_login" class="logo_login" />\n\n      <div class="title" translate="FORGOTPASSWORD.TITLE">Recover your password</div>\n\n      <form name="forgotPasswordForm" novalidate>\n        <md-input-container class="md-block" md-no-float>\n          <input type="email" name="email" ng-model="vm.form.email" placeholder="Email address" translate translate-attr-placeholder="FORGOTPASSWORD.EMAIL_ADRESS" ng-pattern="/^.+@.+\\..+$/" required>\n          <div ng-messages="forgotPasswordForm.email.$error" role="alert" multiple>\n            <div ng-message="required">\n              <span translate="FORGOTPASSWORD.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="FORGOTPASSWORD.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-button type="button" ng-click="vm.forgotPassword()" class="md-raised md-accent submit-button" aria-label="RESET MY PASSWORD" ng-disabled="forgotPasswordForm.$invalid || forgotPasswordForm.$pristine" translate="FORGOTPASSWORD.SEND_RESET_LINK" translate-attr-aria-label="FORGOTPASSWORD.SEND_RESET_LINK">\n          SEND RESET LINK\n        </md-button>\n      </form>\n\n      <div class="login" layout="row" layout-align="center center">\n        <a class="link" ui-sref="app.login" translate="FORGOTPASSWORD.GO_BACK">Go back to login</a>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/header/layouts/vertical-navigation/header.html",'\x3c!-- <div layout="row" layout-align="start center">\n    <ms-info-bar ng-if="vm.currentUser.role == \'admin\' && !vm.newsAlertHide" on-close="vm.newsAlertOnClose()" class="green-600-bg white-fg">\n        <div layout="row" layout-align="start center">\n            <md-icon md-font-icon="icon-message-text-outline" class="icon margin-right-10 s20"></md-icon>\n            <div flex hide-xs translate="HEADER.NEWS"></div>\n        </div>\n    </ms-info-bar>\n</div> --\x3e'),e.put("app/login/login.html",'<div id="login" class="flex-scrollable" layout="column">\n  <div id="login-form-wrapper" layout="column" layout-align="center center">\n    <div id="login-form" class="md-whiteframe-8dp">\n\n      <img src="/api/settings/1/logo_login" alt="logo_login" class="logo_login" />\n      \x3c!-- <img src="assets/images/logos/login.png" alt="motion_logo_login" /> --\x3e\n\n      <div class="md-subhead padding-top-45" translate="LOGIN.TITLE">Log in to your account</div>\n\n      <form name="loginForm" novalidate ng-if="!vm.progressLogin">\n        <md-input-container class="md-block" md-no-float>\n          <input type="input" name="name" ng-model="vm.form.name" autofocus aria-label="username" translate translate-attr-placeholder="LOGIN.USERNAME" required>\n          <div ng-messages="loginForm.name.$error" role="alert" multiple>\n            <div ng-message="required">\n              <span translate="LOGIN.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block" md-no-float>\n          <input type="password" name="password" ng-model="vm.form.password" aria-label="password" translate translate-attr-placeholder="LOGIN.PASSWORD" required>\n          <div ng-messages="loginForm.password.$error" role="alert" multiple>\n            <div ng-message="required">\n              <span translate="LOGIN.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <div class="remember-forgot-password" layout="row" layout-xs="column" layout-align="end center">\n          \x3c!-- <md-checkbox class="remember-me" ng-model="data.cb1" aria-label="Remember Me">\n                        <span translate="LOGIN.REMEMBER_ME">Remember Me</span>\n                    </md-checkbox> --\x3e\n          <a ui-sref="app.forgot" class="forgot-password md-accent-color" style="cursor:pointer;" translate="LOGIN.FORGOT_PASSWORD">Forgot Password?</a>\n        </div>\n\n        <b layout="row" layout-align="center center" class="md-padding" ng-if="vm.message">\n          <font color="red">{{vm.message}}</font>\n        </b>\n        <md-button type="submit" ng-click="vm.login()" class="md-raised md-accent submit-button" aria-label="LOGIN" translate="LOGIN.LOG_IN" translate-attr-aria-label="LOGIN.LOG_IN">\n          LOG IN\n        </md-button>\n      </form>\n\n      <md-progress-circular ng-if="vm.progressLogin" md-diameter="96"></md-progress-circular>\n\n      <div ng-if="vm.googleSsoEnabled || vm.adSsoEnabled" class="separator">\n        <span class="text" translate="LOGIN.OR">OR</span>\n      </div>\n\n      <md-button ng-if="vm.googleSsoEnabled" ng-click="vm.loginOauth(\'google\')" class="md-raised google">\n        <div layout="row" layout-align="center center">\n          <span>\n            <md-icon md-font-icon="fab fa-google" class="s16"></md-icon>\n            <span translate="LOGIN.WITH_GOOGLE">Log in with Google</span>\n          </span>\n        </div>\n      </md-button>\n\n      <md-button ng-if="vm.adSsoEnabled" ng-click="vm.loginAD()" class="md-raised ad">\n        <div layout="row" layout-align="center center">\n          <span>\n            <md-icon md-font-icon="fas fa-ad" class="s16"></md-icon>\n            <span style="text-transform: none" translate="LOGIN.WITH_AD">Log in with Active Directory</span>\n          </span>\n        </div>\n      </md-button>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/analytics/views/extractedReports/create/dialog.html",'<md-dialog class="extractedReport-dialog" aria-label="New ExtractedReport">\n  <form name="extractedReportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.REPORTNAME">ReportName</label>\n        <input type="" name="name" ng-model="vm.extractedReport.name" ng-required="true" autofocus>\n\n        <div ng-messages="extractedReportForm[\'name\'].$error" ng-show="extractedReportForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.REPORTNAME_REQUIRED">ReportName field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input type="" name="basename" ng-model="vm.extractedReport.basename" ng-required="true">\n\n        <div ng-messages="extractedReportForm[\'basename\'].$error" ng-show="extractedReportForm[\'basename\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newExtractedReport" ng-click="vm.saveExtractedReport()" class="send-button md-accent md-raised" ng-disabled="extractedReportForm.$invalid || extractedReportForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newExtractedReport" ng-click="vm.addNewExtractedReport()" class="send-button md-accent md-raised" ng-disabled="extractedReportForm.$invalid" aria-label="ADD" translate="ANALYTICS.ADD_EXTRACTEDREPORT" translate-attr-aria-label="ANALYTICS.ADD_EXTRACTEDREPORT">\n          ADD EXTRACTEDREPORT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newExtractedReport" ng-click="vm.deleteExtractedReport($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/extractedReports/extractedReports.html",'<div id="extractedReports" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-chart-line" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="ANALYTICS.EXTRACTEDREPORTS">ExtractedReports</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="ANALYTICS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedExtractedReports.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedExtractedReports =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="ANALYTICS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-extractedReports-count">\n          <span>{{vm.selectedExtractedReports.length}}</span>\n          <span translate="ANALYTICS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="ANALYTICS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllExtractedReports()" translate="ANALYTICS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectExtractedReports()" translate="ANALYTICS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedExtractedReports" csv-label="true" filename="extractedReports.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedExtractedReports($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- EXTRACTEDREPORT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedExtractedReports" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getExtractedReports">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'ANALYTICS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'ANALYTICS.REPORTNAME\' | translate }}</th>\n                <th md-column md-order-by="basename">{{ \'ANALYTICS.NAME\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'ANALYTICS.TYPE\' | translate }}</th>\n                <th md-column md-order-by="startDate">{{ \'ANALYTICS.DATE_RANGE_FROM\' | translate }}</th>\n                <th md-column md-order-by="endDate">{{ \'ANALYTICS.DATE_RANGE_TO\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'ANALYTICS.GENERATED_AT\' | translate }}</th>\n                <th md-column md-order-by="status">{{ \'ANALYTICS.STATUS\' | translate }}</th>\n                <th md-column md-order-by="output">{{ \'ANALYTICS.OUTPUT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.extractedReports.rows.length">\n                <td md-cell colspan="10">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="extractedReport" md-select-id="id" ng-repeat="extractedReport in vm.extractedReports.rows">\n                <td md-cell ng-if="extractedReport.userpic"><img class="avatar" alt="{{extractedReport.name}}" ng-src="api/users/{{extractedReport.id}}/avatar" /></td>\n                <td md-cell ng-if="!extractedReport.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{extractedReport.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="id ">{{extractedReport.id}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="name ">{{extractedReport.name}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="basename ">{{extractedReport.basename}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="type ">{{extractedReport.type}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="startDate ">{{extractedReport.startDate | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="endDate ">{{extractedReport.endDate | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="createdAt ">{{extractedReport.createdAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="status ">{{extractedReport.status}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="output ">{{extractedReport.output}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(extractedReport, $event    )" translate="ANALYTICS.EDIT_EXTRACTEDREPORT">\n                          Edit ExtractedReport\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="extractedReport.status == \'Completed\'">\n\n                        <md-button ng-click="vm.downloadfile2(extractedReport, $event  , \'analytics/extracted_reports\'   )" translate="ANALYTICS.DOWNLOAD_EXTRACTEDREPORT">\n                          Download ExtractedReport\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(extractedReport, $event    )" translate="ANALYTICS.DELETE_EXTRACTEDREPORT">\n                          Delete ExtractedReport\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.extractedReports.count}}" md-on-paginate="vm.getExtractedReports" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / EXTRACTEDREPORT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/analytics/views/metrics/create/dialog.html",'<md-dialog class="metric-dialog" aria-label="New Metric">\n  <form name="metricForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.metric.name" ng-required="true" autofocus>\n\n        <div ng-messages="metricForm[\'name\'].$error" ng-show="metricForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.TABLE">Table</label>\n        <md-select name="table" ng-model="vm.metric.table" required>\n          <md-option ng-value="\'report_agent\'">Agent Report</md-option>\n          <md-option ng-value="\'report_call\'">Call Report</md-option>\n          <md-option ng-value="\'cdr\'">CDR</md-option>\n          <md-option ng-value="\'chat_websites\'">Chat Website</md-option>\n          <md-option ng-value="\'chat_interactions\'">Chat Interaction</md-option>\n          <md-option ng-value="\'chat_messages\'">Chat Messages</md-option>\n          <md-option ng-value="\'chat_offline_messages\'">Chat Offline Messages</md-option>\n          <md-option ng-value="\'chat_queues\'">Chat Queues</md-option>\n          <md-option ng-value="\'report_chat_queue\'">Chat Report Queue</md-option>\n          <md-option ng-value="\'report_chat_transfer\'">Chat Report Transfer</md-option>\n          <md-option ng-value="\'cm_companies\'">Companies</md-option>\n          <md-option ng-value="\'report_call_transfer\'">Call transfer report</md-option>\n          <md-option ng-value="\'cm_contacts\'">Contacts</md-option>\n          <md-option ng-value="\'report_square\'">CSquare Report</md-option>\n          <md-option ng-value="\'report_square_details\'">CSquare Details Report</md-option>\n          <md-option ng-value="\'report_dial\'">Dial Report</md-option>\n          <md-option ng-value="\'cm_hopper\'">Dialer Hopper Processing</md-option>\n          <md-option ng-value="\'cm_hopper_history\'">Dialer Hopper Logs</md-option>\n          <md-option ng-value="\'cm_hopper_final\'">Dialer Hopper Final</md-option>\n          <md-option ng-value="\'mail_accounts\'">Email Account</md-option>\n          <md-option ng-value="\'mail_interactions\'">Email Interaction</md-option>\n          <md-option ng-value="\'mail_messages\'">Email Messages</md-option>\n          <md-option ng-value="\'mail_queues\'">Email Queues</md-option>\n          <md-option ng-value="\'report_mail_queue\'">Email Report Queue</md-option>\n          <md-option ng-value="\'report_mail_transfer\'">Email Report Transfer</md-option>\n          <md-option ng-value="\'fax_accounts\'">Fax Account</md-option>\n          <md-option ng-value="\'fax_interactions\'">Fax Interaction</md-option>\n          <md-option ng-value="\'fax_messages\'">Fax Messages</md-option>\n          <md-option ng-value="\'fax_queues\'">Fax Queues</md-option>\n          <md-option ng-value="\'report_fax_queue\'">Fax Report Queue</md-option>\n          <md-option ng-value="\'report_fax_transfer\'">Fax Report Transfer</md-option>\n          <md-option ng-value="\'report_jscripty_sessions\'">Jscripty Sessions</md-option>\n          <md-option ng-value="\'report_jscripty_questions\'">Jscripty Questions</md-option>\n          <md-option ng-value="\'report_jscripty_answers\'">Jscripty Answers</md-option>\n          <md-option ng-value="\'cm_lists\'">Lists</md-option>\n          <md-option ng-value="\'report_member\'">Member Report</md-option>\n          <md-option ng-value="\'openchannel_accounts\'">Openchannel Account</md-option>\n          <md-option ng-value="\'openchannel_interactions\'">Openchannel Interaction</md-option>\n          <md-option ng-value="\'openchannel_messages\'">Openchannel Messages</md-option>\n          <md-option ng-value="\'openchannel_queues\'">Openchannel Queues</md-option>\n          <md-option ng-value="\'report_openchannel_queue\'">Openchannel Report Queue</md-option>\n          <md-option ng-value="\'report_openchannel_transfer\'">Openchannel Report Transfer</md-option>\n          <md-option ng-value="\'report_queue\'">Queue Report</md-option>\n          <md-option ng-value="\'sms_accounts\'">SMS Account</md-option>\n          <md-option ng-value="\'sms_interactions\'">SMS Interaction</md-option>\n          <md-option ng-value="\'sms_messages\'">SMS Messages</md-option>\n          <md-option ng-value="\'sms_queues\'">SMS Queues</md-option>\n          <md-option ng-value="\'report_sms_queue\'">SMS Report Queue</md-option>\n          <md-option ng-value="\'report_sms_transfer\'">SMS Report Transfer</md-option>\n          <md-option ng-value="\'users\'">Users</md-option>\n          <md-option ng-value="\'voice_recordings\'">Voice Recordings</md-option>\n          <md-option ng-value="\'whatsapp_accounts\'">Whatsapp Account</md-option>\n          <md-option ng-value="\'whatsapp_interactions\'">Whatsapp Interaction</md-option>\n          <md-option ng-value="\'whatsapp_messages\'">Whatsapp Messages</md-option>\n          <md-option ng-value="\'whatsapp_queues\'">Whatsapp Queues</md-option>\n          <md-option ng-value="\'report_whatsapp_queue\'">Whatsapp Report Queue</md-option>\n          <md-option ng-value="\'report_whatsapp_transfer\'">Whatsapp Report Transfer</md-option>\n        </md-select>\n        <div ng-messages="metricForm[\'table\'].$error" ng-show="metricForm[\'table\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.TABLE_REQUIRED">Table field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.METRIC">Metric</label>\n        <input type="text" name="metric" ng-model="vm.metric.metric" ng-required="true">\n\n        <div ng-messages="metricForm[\'metric\'].$error" ng-show="metricForm[\'metric\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.METRIC_REQUIRED">Metric field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.metric.description">\n\n        <div ng-messages="metricForm[\'description\'].$error" ng-show="metricForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMetric" ng-click="vm.saveMetric()" class="send-button md-accent md-raised" ng-disabled="metricForm.$invalid || metricForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMetric" ng-click="vm.addNewMetric()" class="send-button md-accent md-raised" ng-disabled="metricForm.$invalid" aria-label="ADD" translate="ANALYTICS.ADD_METRIC" translate-attr-aria-label="ANALYTICS.ADD_METRIC">\n          ADD METRIC\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMetric" ng-click="vm.deleteMetric($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/metrics/metrics.html",'<div id="metrics" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-chart-line" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="ANALYTICS.METRICS">Metrics</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="ANALYTICS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMetrics.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMetrics =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="ANALYTICS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-metrics-count">\n          <span>{{vm.selectedMetrics.length}}</span>\n          <span translate="ANALYTICS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="ANALYTICS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMetrics()" translate="ANALYTICS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMetrics()" translate="ANALYTICS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMetrics" csv-label="true" filename="metrics.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMetrics($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- METRIC TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMetrics" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMetrics">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'ANALYTICS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'ANALYTICS.NAME\' | translate }}</th>\n                <th md-column md-order-by="table">{{ \'ANALYTICS.TABLE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'ANALYTICS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.metrics.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="metric" md-select-id="id" ng-repeat="metric in vm.metrics.rows">\n                <td md-cell ng-if="metric.userpic"><img class="avatar" alt="{{metric.name}}" ng-src="api/users/{{metric.id}}/avatar" /></td>\n                <td md-cell ng-if="!metric.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{metric.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="id ">{{metric.id}}</td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="name ">{{metric.name}}</td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="table ">{{ vm.arraytable[metric.table].option }}</td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="description ">{{metric.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(metric, $event    )" translate="ANALYTICS.EDIT_METRIC">\n                          Edit Metric\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(metric, $event    )" translate="ANALYTICS.DELETE_METRIC">\n                          Delete Metric\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.metrics.count}}" md-on-paginate="vm.getMetrics" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / METRIC TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD METRIC BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-metric-button" ng-click="vm.createOrEditMetric($event)" aria-label="add metric" translate translate-attr-aria-label="ANALYTICS.ADD_METRIC">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD METRIC BUTTON --\x3e\n</div>'),e.put("app/main/apps/analytics/views/reports/copy/dialog.html",'<md-dialog class="report-dialog" aria-label="Run Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.COPY_REPORT">Copy Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input name="name" ng-model="vm.report.name" required md-autofocus>\n        <div ng-messages="reportForm.name.$error" ng-show="reportForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label translate="ANALYTICS.SELECT_NODE">Select Node</label>\n        <div js-tree="vm.treeCustomConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.copyReport()" class="send-button md-accent md-raised" ng-disabled="!vm.currentNode" aria-label="COPY" translate="ANALYTICS.COPY_REPORT" translate-attr-aria-label="ANALYTICS.COPY_REPORT">\n          COPY REPORT\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/create/dialog.html",'<md-dialog class="report-dialog" aria-label="New Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.report.name" required md-autofocus>\n        <div ng-messages="reportForm.name.$error" ng-show="reportForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newReport">\n        <label translate="ANALYTICS.TABLE">Table</label>\n        <md-select ng-model="vm.report.table" required>\n          <md-option ng-repeat="table in vm.tables | orderBy:\'name\'" ng-value="table.name">{{table.name}}</md-option>\n        </md-select>\n        <div ng-messages="reportForm.table.$error" ng-show="reportForm.table.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.TABLE_REQUIRED">Table field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.report.description">\n        <div ng-messages="reportForm.description.$error" ng-show="reportForm.description.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-autocomplete ng-if="vm.newReport" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-items="table in vm.tables | filter:vm.searchText" md-item-text="table.name" md-min-length="0" md-selected-item-change="vm.selectedTableChange(table)" placeholder="Select the table to Join">\n        <md-item-template>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{table.name}}</span>\n        </md-item-template>\n        <md-not-found>\n          No states matching "{{vm.searchText}}" were found.\n        </md-not-found>\n      </md-autocomplete>\n\n      <md-card ng-if="vm.newReport" md-theme="default" md-theme-watch ng-repeat="table in vm.joinTables">\n        <md-card-title>\n          <md-card-title-text layout="row">\n            <div layout="row" flex="50">\n              <span class="md-subhead">{{table.name}}</span>\n            </div>\n            <div layout="row" layout-align="end center" flex>\n              <md-button class="md-icon-button" ng-click="vm.removeJoin($index)">\n                <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n              </md-button>\n            </div>\n          </md-card-title-text>\n        </md-card-title>\n        <md-card-content>\n          <md-select ng-model="table.parentKey" placeholder="Select the parent key" ng-init="table.parentFields = []; vm.getFields(table, \'parentFields\', vm.report.table)" required>\n            <md-option ng-repeat="field in table.parentFields" ng-value="field">{{field}}</md-option>\n          </md-select>\n          <md-select ng-model="table.foreignKey" placeholder="Select the foreign key" ng-init="table.foreignFields = []; vm.getFields(table, \'foreignFields\', table.name)" required>\n            <md-option ng-repeat="field in table.foreignFields" ng-value="field">{{field}}</md-option>\n          </md-select>\n          <md-select ng-model="table.type" placeholder="Select join type" required>\n            <md-option ng-repeat="join in vm.joinTypes" ng-value="join.key">{{join.value}}</md-option>\n          </md-select>\n        </md-card-content>\n      </md-card>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newReport" ng-click="vm.saveReport()" class="send-button md-accent md-raised" ng-disabled="reportForm.$invalid || reportForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newReport" ng-click="vm.addNewReport()" class="send-button md-accent md-raised" ng-disabled="reportForm.$invalid || reportForm.$pristine" aria-label="ADD" translate="ANALYTICS.ADD_REPORT" translate-attr-aria-label="ANALYTICS.ADD_REPORT">\n          ADD REPORT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newReport" ng-click="vm.deleteReport($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/edit/condition/group.html",'<md-card class="padding-horizontal-15 padding-top-15">\n  <div layout="row" ng-if="vm_rc.crudPermissions.canEdit">\n    <md-input-container class="md-block" flex>\n      <label translate="ANALYTICS.OPERATOR">Operator</label>\n      <md-select ng-model="group.operator" required>\n        <md-option value="AND">AND</md-option>\n        <md-option value="OR">OR</md-option>\n      </md-select>\n      <div ng-messages="conditionsForm.operator.$error" ng-show="conditionsForm.operator.$touched" role="alert">\n        <div ng-message="required">\n          <span translate="ANALYTICS.ERRORS.OPERATOR_REQUIRED">Operator field is required</span>\n        </div>\n      </div>\n    </md-input-container>\n    <md-input-container class="md-block">\n      <md-button class="md-raised md-accent" ng-click="vm_rc.addCondition(group.rules)">\n        <md-icon md-font-icon="icon-plus"></md-icon> {{\'ANALYTICS.CONDITION\' | translate}}\n      </md-button>\n    </md-input-container>\n    <md-input-container class="md-block">\n      <md-button class="md-raised md-accent" ng-click="vm_rc.addGroup(group.rules)">\n        <md-icon md-font-icon="icon-plus"></md-icon> {{\'ANALYTICS.GROUP\' | translate}}\n      </md-button>\n    </md-input-container>\n    <div flex></div>\n    <md-input-container class="md-block" ng-if="parent">\n      <md-button class="md-raised md-warn" ng-click="vm_rc.deleteConfirm(parent, index, $event)">\n        <md-icon md-font-icon="icon-delete"></md-icon> {{\'ANALYTICS.GROUP\' | translate}}\n      </md-button>\n    </md-input-container>\n  </div>\n  <div layout="column" ng-repeat="rule in group.rules track by $index">\n    <div layout="row" ng-if="!rule.group">\n      <md-input-container class="md-block" flex>\n        <label translate="ANALYTICS.COLUMN">COLUMN</label>\n        <md-select name="field" ng-model="rule.field" ng-disabled="!vm_rc.crudPermissions.canEdit" required>\n          <md-optgroup label="{{vm_rc.report.table}}">\n            <md-option ng-repeat="column in vm_rc.columns" value="{{vm_rc.report.table}}.{{column}}">{{column}}</md-option>\n          </md-optgroup>\n          <md-optgroup ng-if="vm_rc.report.joins" ng-repeat="join in vm_rc.report.joins" label="{{join.foreignTable}}">\n            <md-option ng-repeat="field in join.foreignTableFields" value="{{join.foreignTable}}.{{field}}">{{field}}</md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="conditionsForm.field.$error" ng-show="conditionsForm.field.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.COLUMN_REQUIRED">Column field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" flex>\n        <label translate="ANALYTICS.CONDITION">CONDITION</label>\n        <md-select name="condition" ng-model="rule.condition" ng-disabled="!vm_rc.crudPermissions.canEdit" required>\n          <md-option ng-repeat="condition in vm_rc.conditions" ng-value="condition">{{condition}}</md-option>\n        </md-select>\n        <div ng-messages="conditionsForm.condition.$error" ng-show="conditionsForm.condition.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm_rc.isValueByCondition(rule.condition)" class="md-block" flex>\n        <label translate="ANALYTICS.VALUE">VALUE</label>\n        <input type="text" name="value" ng-model="rule.value" ng-disabled="!vm_rc.crudPermissions.canEdit" required md-autofocus>\n        <div ng-messages="conditionsForm.value.$error" ng-show="conditionsForm.value.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm_rc.crudPermissions.canEdit" flex>\n        <md-button class="md-fab md-mini md-warn" aria-label="Delete row" ng-click="vm_rc.deleteConfirm(group.rules, $index, $event)">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </md-input-container>\n    </div>\n    <div ng-if="rule.group" ng-include="\'app/main/apps/analytics/views/reports/edit/condition/group.html\'" ng-init="parent=group.rules;index=$index;group=rule.group"></div>\n  </div>\n</md-card>'),e.put("app/main/apps/analytics/views/reports/edit/field/dialog.html",'<md-dialog class="reportField-dialog" aria-label="New Report Field">\n  <form name="reportFieldForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{vm.title}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <pre></pre>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.reportField.type" ng-change="vm.reportField.field = undefined" required>\n          <md-option value="column">Select a column</md-option>\n          <md-option value="metric">Select an existing metric</md-option>\n          <md-option value="custom">Write a custom metric</md-option>\n        </md-select>\n        <div ng-messages="reportForm.type.$error" ng-show="reportForm.type.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-switch on="vm.reportField.type">\n        <md-input-container class="md-block" ng-switch-when="column">\n          <label translate="ANALYTICS.COLUMN">Column Name</label>\n          <md-select name="column" ng-model="vm.reportField.field" required>\n            <md-optgroup label="{{vm.report.table}}">\n              <md-option ng-repeat="column in vm.columns" value="{{vm.report.table}}.{{column}}">{{column}}</md-option>\n              \x3c!-- <md-option ng-repeat="column in vm.columns" ng-value="">{{column}}</md-option> --\x3e\n            </md-optgroup>\n            <md-optgroup ng-if="vm.report.joins" ng-repeat="join in vm.report.joins" label="{{join.foreignTable}}">\n              <md-option ng-repeat="field in join.foreignTableFields" value="{{join.foreignTable}}.{{field}}">{{field}}</md-option>\n            </md-optgroup>\n          </md-select>\n          <div ng-messages="reportForm.column.$error" ng-show="reportForm.column.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="ANALYTICS.ERRORS.COLUMN_REQUIRED">Column field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" ng-switch-when="metric">\n          <label translate="ANALYTICS.METRIC_NAME">Metric Name</label>\n          <md-select name="metric" ng-model="vm.reportField.MetricId" required>\n            <md-option ng-repeat="metric in vm.metrics" ng-value="metric.id">{{metric.name}}</md-option>\n          </md-select>\n          <div ng-messages="reportForm.metric.$error" ng-show="reportForm.metric.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="ANALYTICS.ERRORS.METRIC_REQUIRED">Metric field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" ng-switch-when="custom">\n          <label translate="ANALYTICS.CUSTOM_METRIC">Custom Metric</label>\n          <input type="text" name="field" ng-model="vm.reportField.field" required md-autofocus>\n          <div ng-messages="reportFieldForm.field.$error" ng-show="reportFieldForm.field.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="ANALYTICS.ERRORS.CUSTOM_METRIC_REQUIRED">Custom Metric field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.reportField.alias" ng-required="vm.reportField.type === \'custom\' || vm.reportField.type === \'metric\'">\n        <div ng-messages="reportFieldForm.alias.$error" ng-show="reportFieldForm.alias.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.reportField.type !== \'metric\'">\n        <label translate="ANALYTICS.FUNCTION">Function</label>\n        <md-select name="function" ng-model="vm.reportField.function">\n          <md-option ng-value="null">No Function</md-option>\n          <md-option ng-repeat="function in vm.sqlUtil.getFunctions" ng-value="function.value">{{function.value}}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.reportField.type !== \'metric\'">\n        <label translate="ANALYTICS.FORMAT">Format</label>\n        <md-select name="format" ng-model="vm.reportField.format">\n          <md-option ng-value="null">No Format</md-option>\n          <md-option ng-repeat="format in vm.sqlUtil.getFormats" ng-value="format.value">{{format.value}}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.GROUP_BY">Group By</label>\n        <md-select name="groupBy" ng-model="vm.reportField.groupBy">\n          <md-option ng-repeat="gb in vm.sqlUtil.getGroupBy" ng-value="gb.value">{{gb.value ? \'Yes\' : \'No\'}}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.ORDER_BY">Order By</label>\n        <md-select name="orderBy" ng-model="vm.reportField.orderBy">\n          <md-option ng-value="null">No Order</md-option>\n          <md-option ng-repeat="ob in vm.sqlUtil.getOrderBy" ng-value="ob.value">{{ob.value}}</md-option>\n        </md-select>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newReportField" ng-click="vm.saveReportField()" class="send-button md-accent md-raised" ng-disabled="reportFieldForm.$invalid || reportFieldForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newReportField" ng-click="vm.addNewReportField()" class="send-button md-accent md-raised" ng-disabled="reportFieldForm.$invalid || reportFieldForm.$pristine" aria-label="ADD" translate="ANALYTICS.ADD_REPORTFIELD" translate-attr-aria-label="ANALYTICS.ADD_REPORTFIELD">\n          ADD REPORT FIELD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newReportField" ng-click="vm.deleteReportField($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/edit/view.html",'<div id="analytics-report" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-reports-button md-icon-button" aria-label="Go to reports" ng-click="vm.gotoReports()" translate translate-attr-aria-label="ANALYTICS.GO_TO_ANALYTICSQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="report-image" hide-xs>\n          <img ng-src="assets/images/business/reports.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.report.id}} {{vm.report.name}}\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="ANALYTICS.CREATED_AT"></span> <span>{{vm.report.createdAt | date:\'medium\'}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span>{{vm.report.description}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div>\n      <md-button type="submit" ng-click="vm.saveReport()" ng-disabled="generalForm.$pristine && conditionsForm.$pristine" class="send-button md-accent md-raised" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="ANALYTICS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="ANALYTICS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="ANALYTICS.NAME">Name</label>\n                <input type="text" name="name" ng-disabled="!vm.crudPermissions.canEdit" ng-model="vm.report.name" required md-autofocus>\n                <div ng-messages="generalForm.name.$error" ng-show="generalForm.name.$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="ANALYTICS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-disabled="!vm.crudPermissions.canEdit" ng-model="vm.report.description">\n                <div ng-messages="generalForm.description.$error" ng-show="generalForm.description.$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="ANALYTICS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="ANALYTICS.FIELDS">FIELDS</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container fields md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ReportFieldsController as vm_rf" ng-init="vm_rf.init(vm.report, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_rf.selectedReportFields.length">\n                <div class="md-toolbar-tools">\n                  <div layout="row" layout-align="start center">\n                    <div layout="column" layout-align="start start">\n                      <div class="md-subhead" translate="ANALYTICS.FIELDS">\n                        <span translate="ANALYTICS.FIELDS">FIELDS</span>\n                      </div>\n                      <div class="h4">\n                        <span translate="ANALYTICS.TABLE">TABLE</span> <span class="text-bold">{{vm.report.table}}</span>\n                      </div>\n                      <div class="h4" ng-if="vm.report.joins && vm.report.joins.length && vm.isArray(vm.report.joins)">\n                        <span>Join</span> <span class="text-bold">{{ vm.mapArray(vm.report.joins, \'foreignTable\') }}</span>\n                      </div>\n                    </div>\n                  </div>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm_rf.query.filter = query" on-collapse="vm_rf.query.filter = undefined" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-if="vm_rf.crudPermissions.canEdit" ng-click="vm_rf.createOrEditReportField($event)" aria-label="add field" translate translate-attr-label="ANALYTICS.ADD_FIELD">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_rf.selectedReportFields.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_rf.selectedReportFields.length}} {{vm_rf.selectedReportFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_rf.deleteSelectedReportFields($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container>\n                <table md-table md-row-select="vm_rf.crudPermissions.canDelete" multiple ng-model="vm_rf.selectedReportFields" md-progress="vm_rf.promise">\n                  <thead md-head md-order="vm_rf.query.sort" md-on-reorder="vm_rf.getReportFields">\n                    <tr md-row>\n                      <th md-column width="10px" ng-if="vm_rf.crudPermissions.canEdit">\n                        <md-icon md-font-icon="icon-drag-vertical"></md-icon>\n                      </th>\n                      <th md-column>Type</th>\n                      <th md-column>Column or Metric</th>\n                      <th md-column>Alias</th>\n                      <th md-column>Function</th>\n                      <th md-column>Format</th>\n                      <th md-column>Group By</th>\n                      <th md-column>Order By</th>\n                      <th md-column width="10px" ng-if="vm_rf.crudPermissions.canEdit"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body ng-sortable="vm_rf.sortableTable">\n                    <tr md-row md-select="reportField" md-select-id="id" ng-repeat="reportField in vm_rf.reportFields.rows">\n                      <td md-cell class="handle" ng-if="vm_rf.crudPermissions.canEdit">\n                        <md-icon md-font-icon="icon-drag-vertical" class="s16"></md-icon>\n                      </td>\n                      <td md-cell>\n                        <div ng-if="reportField.MetricId && !reportField.custom" ng-click="vm_rf.createOrEditReportField($event, reportField)" class="icon icon-shape-plus s16"></div>\n                        <div ng-if="!reportField.MetricId && reportField.custom" ng-click="vm_rf.createOrEditReportField($event, reportField)" class="icon icon-pencil-box-outline s16"></div>\n                        <div ng-if="!reportField.MetricId && !reportField.custom" ng-click="vm_rf.createOrEditReportField($event, reportField)" class="icon icon-view-column s16"></div>\n                      </td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)">{{reportField.MetricId ? vm_rf.getMetricName(reportField.MetricId) : reportField.field}}</td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)">{{reportField.alias}}</td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.function">{{reportField.function}}</span><span ng-if="!reportField.function">--</span></td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.format">{{reportField.format}}</span><span ng-if="!reportField.format">--</span></td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.groupBy">YES</span><span ng-if="!reportField.groupBy">--</span></td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.orderBy">{{reportField.orderBy}}</span><span ng-if="!reportField.orderBy">--</span></td>\n                      <td md-cell class="actions" ng-if="vm_rf.crudPermissions.canEdit">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_rf.createOrEditReportField($event, reportField)" translate="ANALYTICS.EDIT_REPORTFIELD">\n                                Edit Field\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                              <md-button ng-click="vm_rf.deleteConfirm(reportField, $event)" translate="ANALYTICS.DELETE_REPORTFIELD">\n                                Delete Field\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="ANALYTICS.CONDITIONS">CONDITIONS</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container conditions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ReportConditionsController as vm_rc" ng-init="vm_rc.init(vm.report, vm.crudPermissions)">\n              <div class="pb-16" layout="row" layout-align="start center">\n                <div class="h2 secondary-text" translate="ANALYTICS.CONDITION">CONDITION</div>\n              </div>\n              <form name="conditionsForm" novalidate>\n                <div ng-if="vm_rc.report.condition.group" ng-include="\'app/main/apps/analytics/views/reports/edit/condition/group.html\'" ng-init="group=vm_rc.report.condition.group"></div>\n              </form>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab md-on-select="vm.previewReport()">\n        <md-tab-label>\n          <span translate="ANALYTICS.PREVIEW">PREVIEW</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container result md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n              <div ng-if="!vm.error" class="h2 secondary-text" translate="ANALYTICS.LIMITED_RESULT">LIMITED RESULT</div>\n            </div>\n            <dl ng-if="vm.error">\n              <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n              <dd>{{vm.error.sql}}</dd>\n              <dt translate="ANALYTICS.MESSAGE">Message</dt>\n              <dd>{{vm.error.msg}}</dd>\n            </dl>\n            <md-table-container ng-if="!vm.error">\n              <table md-table>\n                <thead md-head>\n                  <tr md-row>\n                    <th ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n                  </tr>\n                </thead>\n                <tbody md-body>\n                  <tr md-row ng-repeat="row in vm.rows">\n                    <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n                  </tr>\n                  <tr md-row ng-if="!vm.rows.length">\n                    <td md-cell colspan="{{vm.columns.length}}"><span translate="ANALYTICS.NO_DATA">NO DATA</span></td>\n                  </tr>\n                </tbody>\n              </table>\n            </md-table-container>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab md-on-select="vm.queryReport()">\n        <md-tab-label>\n          <span>Query</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container result md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n              <div ng-if="!vm.error" class="h2 secondary-text">SQL</div>\n            </div>\n            <dl ng-if="vm.error">\n              <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n              <dd>{{vm.error.sql}}</dd>\n              <dt translate="ANALYTICS.MESSAGE">Message</dt>\n              <dd>{{vm.error.msg}}</dd>\n            </dl>\n            <div ng-if="!vm.error">\n              {{vm.queryResult}}\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/analytics/views/reports/preview/dialog.html",'<md-dialog aria-label="Run Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.PREVIEW_REPORT">Preview Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n          <div ng-if="!vm.error" class="h2 secondary-text" translate="ANALYTICS.LIMITED_RESULT">LIMITED RESULT</div>\n        </div>\n        <dl ng-if="vm.error">\n          <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n          <dd>{{vm.error.sql}}</dd>\n          <dt translate="ANALYTICS.MESSAGE">Message</dt>\n          <dd>{{vm.error.msg}}</dd>\n        </dl>\n        <md-table-container ng-if="!vm.error">\n          <table md-table md-progress="vm.promise">\n            <thead md-head>\n              <tr md-row>\n                <th md-column ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-repeat="row in vm.rows">\n                <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n              </tr>\n              <tr md-row ng-if="!vm.rows.length">\n                <td md-cell colspan="{{vm.columns.length}}"><span translate="ANALYTICS.NO_DATA">NO DATA</span></td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div flex></div>\n      <md-button type="submit" ng-click="vm.closeDialog()" class="md-raised" aria-label="CLOSE" translate="ANALYTICS.CLOSE" translate-attr-aria-label="ANALYTICS.CLOSE">\n        CLOSE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/reports.html",'<div id="reports" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-chart-line" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="ANALYTICS.REPORTS">Reports</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedReports.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedReports =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="ANALYTICS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-reports-count">\n          <span>{{vm.selectedReports.length}}</span>\n          <span translate="ANALYTICS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="ANALYTICS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllReports()" translate="ANALYTICS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectReports()" translate="ANALYTICS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedReports" csv-label="true" filename="reports.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button ng-if="vm.crudPermissions.canDelete && vm.currentNode.custom" class="md-icon-button" ng-click="vm.deleteSelectedReports($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div layout="column" flex="30">\n      <md-card class="padding-top-5 padding-horizontal-10 padding-bottom-0">\n        \x3c!-- SEARCH --\x3e\n        <div layout="row" layout-align="start center">\n          <label for="searchFolder" class="m-0">\n            <md-icon md-font-icon="icon-magnify"></md-icon>\n          </label>\n          <md-input-container md-no-float class="margin-horizontal-0 margin-bottom-0 margin-top-10" flex>\n            <input id="searchFolder" placeholder="Search folder" type="text" ng-model="vm.search" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="ANALYTICS.SEARCH_FOR_FOLDER">\n          </md-input-container>\n        </div>\n        \x3c!-- / SEARCH --\x3e\n      </md-card>\n      <md-card class="padding-10 scrollable">\n        <div js-tree="vm.treeDefaultConfig" tree-events-obj="vm.treeDefaultEvents" ng-model="vm.treeDefaultData" tree="vm.treeDefaultInstance"></div>\n      </md-card>\n      <md-card class="padding-10 scrollable">\n        <div js-tree="vm.treeCustomConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n      </md-card>\n    </div>\n    <md-card flex="70">\n      <md-toolbar class="md-table-toolbar md-default">\n        <div class="md-toolbar-tools">\n          <span class="h2 secondary-text">{{vm.currentNode.text}}</span>\n          <p ng-if="vm.currentPath">\n            <span class="text-boxed">{{vm.currentPath}}</span>\n          </p>\n          <div flex></div>\n          <ms-search-bar on-search="vm.getReports()" query="vm.query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n          <div flow-init flow-file-added="vm.importReport($file, $event, $flow)">\n            <md-button ng-if="vm.crudPermissions.canEdit && vm.currentNode.custom" class="md-icon-button" aria-label="import report" translate translate-attr-label="ANALYTICS.IMPORT_REPORT" flow-btn>\n              <md-icon md-font-icon="icon-upload"></md-icon>\n            </md-button>\n          </div>\n          <md-button ng-if="vm.crudPermissions.canEdit && vm.currentNode.custom" class="md-icon-button" ng-click="vm.createOrEditReport($event)" aria-label="add report" translate translate-attr-label="ANALYTICS.ADD_REPORT">\n            <md-icon md-font-icon="icon-plus"></md-icon>\n          </md-button>\n        </div>\n      </md-toolbar>\n      <md-table-container>\n        <table md-table md-row-select multiple ng-model="vm.selectedReports" md-progress="vm.promise">\n          <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getReports">\n            <tr md-row>\n              <th md-column md-order-by="id" width="10px">{{ \'ANALYTICS.ID\' | translate }}</th>\n              <th md-column md-order-by="name">{{ \'ANALYTICS.NAME\' | translate }}</th>\n              <th md-column md-order-by="description">{{ \'ANALYTICS.DESCRIPTION\' | translate }}</th>\n              <th md-column md-order-by="createdAt">{{ \'ANALYTICS.CREATED_AT\' | translate }}</th>\n              <th md-column width="10px"></th>\n            </tr>\n          </thead>\n          <tbody md-body>\n            <tr md-row ng-hide="vm.reports.rows.length">\n              <td md-cell colspan="5">\n                <div layout="row" layout-align="center center">\n                  <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                </div>\n              </td>\n            </tr>\n            <tr md-row md-select="report" md-select-id="id" ng-repeat="report in vm.reports.rows">\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="id">{{report.id}}</td>\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="name">{{report.name}}</td>\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="description">{{report.description}}</td>\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="createdAt">{{report.createdAt | date:\'medium\'}}</td>\n              <td md-cell class="actions">\n                <md-menu>\n                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                  </md-button>\n\n                  <md-menu-content width="3">\n                    <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                      <md-button ng-click="vm.copydialog(report, $event)" translate="ANALYTICS.COPY_REPORT">\n                        Copy Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item>\n                      <md-button ng-click="vm.previewdialog(report, $event)" translate="ANALYTICS.PREVIEW_REPORT">\n                        Preview Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item>\n                      <md-button ng-click="vm.rundialog(report, $event)" translate="ANALYTICS.RUN_REPORT">\n                        Run Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item>\n                      <md-button ng-click="vm.downloadfile(report, $event)" translate="ANALYTICS.DOWNLOAD_JSON_REPORT">\n                        Download Json Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-divider ng-if="vm.crudPermissions.canEdit && vm.crudPermissions.canDelete && vm.currentNode.custom">\n                    </md-menu-divider>\n                    <md-menu-item ng-if="vm.crudPermissions.canEdit && vm.currentNode.custom">\n                      <md-button ng-click="vm.editstate(report, $event)" translate="ANALYTICS.EDIT_REPORT">\n                        Edit Report\n                      </md-button>\n                    </md-menu-item>\n\n                    <md-menu-item ng-if="vm.crudPermissions.canDelete && vm.currentNode.custom">\n                      <md-button ng-click="vm.deleteconfirm(report, $event)" translate="ANALYTICS.DELETE_REPORT">\n                        Delete Report\n                      </md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </td>\n            </tr>\n          </tbody>\n        </table>\n      </md-table-container>\n\n      <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.reports.count}}" md-on-paginate="vm.getReports" md-page-select></md-table-pagination>\n    </md-card>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/analytics/views/reports/run/dialog.html",'<md-dialog class="report-dialog" aria-label="Run Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.RUN_REPORT">Run Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input name="name" ng-model="vm.export.name" required md-autofocus>\n        <div ng-messages="reportForm.name.$error" ng-show="reportForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.FORMAT">FORMAT</label>\n        <md-select name="format" ng-model="vm.export.output" required>\n          <md-option value="csv">CSV</md-option>\n          <md-option value="xlsx">Excel (XLSX)</md-option>\n          <md-option value="pdf">PDF</md-option>\n          <md-option value="web">Web</md-option>\n        </md-select>\n        <div ng-messages="reportForm.format.$error" ng-show="reportForm.format.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.FORMAT_REQUIRED">Format field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div layout="row">\n        <div class="md-block" flex>\n          <mdp-date-picker mdp-open-on-click required name="dateRangeFrom" mdp-placeholder="Date Range From" mdp-format="YYYY-MM-DD" mdp-max-date="vm.dateRangeTo" ng-model="vm.export.startDate">\n            <div ng-messages="reportForm.dateRangeFrom.$error" ng-show="reportForm.dateRangeFrom.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_REQUIRED">Date Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_INVALID">Date Range From field is invalid</span>\n              </div>\n              <div ng-message="maxDate">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_MAX_INVALID">Date Range From Max field is invalid</span>\n              </div>\n            </div>\n          </mdp-date-picker>\n        </div>\n        <div class="md-block" flex>\n          <mdp-date-picker mdp-open-on-click required name="dateRangeTo" mdp-placeholder="Date Range To" mdp-format="YYYY-MM-DD" mdp-min-date="vm.dateRangeFrom" ng-model="vm.export.endDate">\n            <div ng-messages="reportForm.dateRangeTo.$error" ng-show="reportForm.dateRangeTo.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_TO_REQUIRED">Date Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_TO_INVALID">Date Range From field is invalid</span>\n              </div>\n              <div ng-message="minDate">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_MIN_INVALID">Date Range From Min field is invalid</span>\n              </div>\n            </div>\n          </mdp-date-picker>\n        </div>\n      </div>\n      <div layout="row">\n        <div class="md-block" flex>\n          <mdp-time-picker required name="timeRangeFrom" mdp-placeholder="Time Range From" mdp-format="HH:mm:ss" mdp-auto-switch="true" mdp-max-date="vm.dateRangeTo" ng-model="vm.export.startDate">\n            <div ng-messages="reportForm.timeRangeFrom.$error" ng-show="reportForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_FROM_REQUIRED">Time Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex>\n          <mdp-time-picker required name="timeRangeTo" mdp-placeholder="Time Range To" mdp-format="HH:mm:ss" mdp-auto-switch="true" mdp-min-date="vm.dateRangeFrom" ng-model="vm.export.endDate">\n            <div ng-messages="reportForm.timeRangeTo.$error" ng-show="reportForm.timeRangeTo.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_TO_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.runReport($event)" class="send-button md-accent md-raised" ng-disabled="reportForm.$invalid" aria-label="RUN" translate="ANALYTICS.RUN_REPORT" translate-attr-aria-label="ANALYTICS.RUN_REPORT">\n          RUN REPORT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-click="vm.refreshDate()" aria-label="REFRESH" translate translate-attr-aria-label="ANALYTICS.REFRESH">\n          <md-icon md-font-icon="icon-refresh"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.REFRESH">REFRESH</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/run/web/dialog.html",'<md-dialog class="web-dialog" aria-label="Show Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.WEB_REPORT">Web Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n        </div>\n        <dl ng-if="vm.error">\n          <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n          <dd>{{vm.error.sql}}</dd>\n          <dt translate="ANALYTICS.MESSAGE">Message</dt>\n          <dd>{{vm.error.msg}}</dd>\n        </dl>\n        <md-table-container ng-if="!vm.error">\n          <table md-table md-progress="vm.promise">\n            <thead md-head>\n              <tr md-row>\n                <th md-column ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-repeat="row in vm.results.rows">\n                <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n              </tr>\n              <tr md-row ng-if="!vm.results.rows.length">\n                <td md-cell colspan="{{vm.columns.length}}">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_DATA">NO DATA</span>\n                  </div>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.results.count}}" md-on-paginate="vm.getResults" md-page-select></md-table-pagination>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div flex></div>\n      <md-button type="submit" ng-click="vm.closeDialog()" class="md-raised" aria-label="CLOSE" translate="ANALYTICS.CLOSE" translate-attr-aria-label="ANALYTICS.CLOSE">\n        CLOSE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/odbcs/create/dialog.html",'<md-dialog class="odbc-dialog" aria-label="New Odbc">\n  <form name="odbcForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.odbc.name" ng-required="true" autofocus>\n\n        <div ng-messages="odbcForm[\'name\'].$error" ng-show="odbcForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DSN">DSN</label>\n        <input type="text" name="dsn" ng-model="vm.odbc.dsn" ng-required="true">\n\n        <div class="hint"><span translate="CALLYSQUARE.HELP.DSN"></span></div>\n        <div ng-messages="odbcForm[\'dsn\'].$error" ng-show="odbcForm[\'dsn\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.DSN_REQUIRED">DSN field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.odbc.description">\n\n        <div ng-messages="odbcForm[\'description\'].$error" ng-show="odbcForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOdbc" ng-click="vm.saveOdbc()" class="send-button md-accent md-raised" ng-disabled="odbcForm.$invalid || odbcForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOdbc" ng-click="vm.addNewOdbc()" class="send-button md-accent md-raised" ng-disabled="odbcForm.$invalid" aria-label="ADD" translate="CALLYSQUARE.ADD_ODBC" translate-attr-aria-label="CALLYSQUARE.ADD_ODBC">\n          ADD ODBC\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOdbc" ng-click="vm.deleteOdbc($event)" aria-label="DELETE" translate translate-attr-aria-label="CALLYSQUARE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CALLYSQUARE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/odbcs/odbcs.html",'<div id="odbcs" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-sitemap" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CALLYSQUARE.ODBC">ODBC</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CALLYSQUARE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedODBC.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedODBC =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CALLYSQUARE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-odbcs-count">\n          <span>{{vm.selectedODBC.length}}</span>\n          <span translate="CALLYSQUARE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CALLYSQUARE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllODBC()" translate="CALLYSQUARE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectODBC()" translate="CALLYSQUARE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedODBC" csv-label="true" filename="odbcs.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedODBC($event)" aria-label="delete selected" translate translate-attr-label="CALLYSQUARE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- ODBC TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedODBC" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getODBC">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CALLYSQUARE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CALLYSQUARE.NAME\' | translate }}</th>\n                <th md-column md-order-by="dsn">{{ \'CALLYSQUARE.DSN\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CALLYSQUARE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.odbcs.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CALLYSQUARE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="odbc" md-select-id="id" ng-repeat="odbc in vm.odbcs.rows">\n                <td md-cell ng-if="odbc.userpic"><img class="avatar" alt="{{odbc.name}}" ng-src="api/users/{{odbc.id}}/avatar" /></td>\n                <td md-cell ng-if="!odbc.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{odbc.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="id ">{{odbc.id}}</td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="name ">{{odbc.name}}</td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="dsn ">{{odbc.dsn}}</td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="description ">{{odbc.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CALLYSQUARE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(odbc, $event    )" translate="CALLYSQUARE.EDIT_ODBC">\n                          Edit Odbc\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestOdbc(odbc, $event    )" translate="CALLYSQUARE.TEST_ODBC">\n                          Test Odbc\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(odbc, $event    )" translate="CALLYSQUARE.DELETE_ODBC">\n                          Delete Odbc\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CALLYSQUARE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CALLYSQUARE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CALLYSQUARE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.odbcs.count}}" md-on-paginate="vm.getODBC" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / ODBC TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD ODBC BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-odbc-button" ng-click="vm.createOrEditOdbc($event)" aria-label="add odbc" translate translate-attr-aria-label="CALLYSQUARE.ADD_ODBC">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD ODBC BUTTON --\x3e\n</div>'),e.put("app/main/apps/callysquare/views/projects/create/dialog.html",'<md-dialog class="project-dialog" aria-label="New Project">\n  <form name="projectForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{vm.title | translate}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NAME">Name</label>\n        <input name="name" ng-model="vm.project.name" required md-autofocus ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-disabled="!vm.newProject">\n        <div ng-messages="projectForm.name.$error" ng-show="projectForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DESCRIPTION">Description</label>\n        <input name="description" ng-model="vm.project.description">\n        <div ng-messages="projectForm.description.$error" ng-show="projectForm.description.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.openFromEditor" class="md-block">\n        \x3c!-- Added to check if I\'m opening the dialog directly from the square editor --\x3e\n        <md-switch ng-model="vm.newWindow" aria-label="{{\'CALLYSQUARE.OPEN_NEW_WINDOW\' | translate }}"><span translate="CALLYSQUARE.OPEN_NEW_WINDOW"></span></md-switch>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newProject" ng-click="vm.saveProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid || projectForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newProject" ng-click="vm.addNewProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid || projectForm.$pristine" aria-label="ADD" translate="CALLYSQUARE.ADD_PROJECT" translate-attr-aria-label="CALLYSQUARE.ADD_PROJECT">\n          ADD PROJECT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newProject" ng-click="vm.deleteProject($event)" aria-label="DELETE" translate translate-attr-aria-label="CALLYSQUARE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CALLYSQUARE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/dialog/dialog.html",'<md-dialog class="project-dialog" aria-label="New dialog" ng-init="vm.onInit()">\n  <form name="dialogForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.EDIT"></span> <span translate="CALLYSQUARE.{{vm.cellName | uppercase}}"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block" ng-repeat="attribute in vm.attributes" ng-switch="attribute.name">\n        <label translate="CALLYSQUARE.{{attribute.name | uppercase}}">{{attribute.name | ucfirst }}</label>\n\n        \x3c!--  START SELECT INPUT --\x3e\n        <md-select name="{{attribute.name}}" ng-model="attribute.value" ng-disabled="!vm.crudPermissions.canEdit" ng-switch-when-separator="|" ng-switch-when="answer|trunk_name|trunk_id|queue_id|file_id|variable_id|google_cloud_tts_text_type|google_tts_language|ispeech_tts_language|ispeech_asr_language|google_asr_language|hiddendigitspos|odbc_id|project_id|beep|account_id|interval_id|template_id|list_id|recordingFormat|callback_priority|aws_polly_voice|aws_polly_region|aws_lex_region|sms_account_id|findBy|pause_id|aws_text_type|dialogflow_language|ndagenerate_audio|ndaactivity_type|languageCode|ssmlGender|method|dialogflowV2_language" ng-required="attribute.required">\n          <md-option ng-if="attribute.defaultValue" ng-value="\'\'"> - None - </md-option>\n          <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-disabled="v.canSelect === false">{{v.option}}</md-option>\n          <md-option ng-if="!vm.values[attribute.name].length" value="-1">No {{attribute.name}} available!</md-option>\n        </md-select>\n        \x3c!--  END SELECT INPUT --\x3e\n\n        \x3c!--  START SELECT INPUT --\x3e\n        <md-select name="{{attribute.name}}" ng-model="attribute.value" ng-disabled="!vm.crudPermissions.canEdit" ng-switch-when-separator="|" ng-switch-when="sip_id" ng-required="attribute.required">\n          <md-optgroup label="{{\'CALLYSQUARE.AGENTS\' | translate}}">\n            <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-if="v.group === \'agent\'" ng-disabled="v.canSelect === false">{{v.option}}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{\'CALLYSQUARE.TELEPHONES\' | translate}}">\n            <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-if="v.group === \'telephone\'" ng-disabled="v.canSelect === false">{{v.option}}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{\'CALLYSQUARE.USERS\' | translate}}">\n            <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-if="v.group === \'admin\' || v.group === \'user\'">{{v.option}}</md-option>\n          </md-optgroup>\n          <md-option ng-if="!vm.values[attribute.name].length" value="-1">No {{attribute.name}} available!</md-option>\n        </md-select>\n        \x3c!--  END SELECT INPUT --\x3e\n\n        \x3c!--  START NUMBER INPUT --\x3e\n        <div ng-switch-when="timeout">\n          <div ng-switch="vm.cellName">\n            <input ng-switch-when-separator="|" ng-switch-when="answer|ext_dial|dial|queue" type="number" step="any" name="{{attribute.name}}" min="0" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n            <input ng-switch-when-separator="|" ng-switch-when="record|ispeechasr|googleasr" type="number" step="any" name="{{attribute.name}}" min="-1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n            <input ng-switch-when-separator="|" ng-switch-when="restapi" type="number" step="any" name="{{attribute.name}}" min="1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n            <input ng-switch-default type="number" step="any" name="{{attribute.name}}" min="0" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n          </div>\n        </div>\n        <input ng-switch-when-separator="|" ng-switch-when="speed" type="number" step="any" name="{{attribute.name}}" min="-10" max="-10" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n        <input ng-switch-when-separator="|" ng-switch-when="maxdigit|mindigit|digit" type="number" step="any" name="{{attribute.name}}" min="1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n        <input ng-switch-when-separator="|" ng-switch-when="retry|response|hiddendigitsnum|priority" type="number" step="any" name="{{attribute.name}}" min="1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n        \x3c!--  END NUMBER INPUT --\x3e\n\n        \x3c!--  START TEXTAREA INPUT --\x3e\n        <textarea name="{{attribute.name}}" ng-model="attribute.value" ng-switch-when-separator="|" ng-switch-when="query|sms_text|condition|text|custom_action_data|headers|body|rawHeaders|rawBody|private_key" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit"></textarea>\n        \x3c!--  END TEXTAREA INPUT --\x3e\n\n        \x3c!-- START URL INPUT --\x3e\n        <input ng-switch-when-separator="|" ng-switch-when="ndauth_url|ndassistant_url|url" type="url" name="{{attribute.name}}" ng-model="attribute.value" ng-required="attribute.required">\n        \x3c!-- END URL INPUT --\x3e\n\n        \x3c!--  START TEXT INPUT --\x3e\n        <input ng-switch-default name="{{attribute.name}}" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit">\n        <div class=\'hint\' ng-if="attribute.name === \'text\' && vm.cellName === \'tts\' ">\n          <span translate="CALLYSQUARE.HELP.MAX_TEXT_TTS" class="ng-scope">Max 250 chars are supported</span>\n        </div>\n        \x3c!--  END TEXT INPUT--\x3e\n\n        <div class="hint" ng-if="attribute.help">\n          <span translate="CALLYSQUARE.HELP.{{attribute.name | uppercase}}"></span>\n        </div>\n        <div ng-messages="dialogForm[attribute.name].$error" ng-show="dialogForm[attribute.name].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.FIELD_REQUIRED">The field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="vm.crudPermissions.canEdit">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog(true)" class="send-button md-accent md-raised" ng-disabled="dialogForm.$invalid || dialogForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/edit/edit.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="editForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.EDIT_XML"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label>XML</label>\n        <textarea name="preproduction" ng-model="vm.project.preproduction"></textarea>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog(true)" class="send-button md-accent md-raised" ng-disabled="editForm.$invalid" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/import/import.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="importForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.IMPORT_XML"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div id="xml-uploader" flow-init="vm.ngFlowOptions" flow-name="vm.ngFlow.flow" flow-file-added="vm.fileAdded($file)" flow-drop flow-drag-enter="vm.dropping=true" flow-drag-leave="vm.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n        <div class="drop-text hint-text" layout="row" layout-align="center center">\n          <span translate="CALLYSQUARE.DROP_TO_UPLOAD">Drop to upload</span>\n        </div>\n\n        <div class="upload-button" layout="column" layout-align="center center">\n          <md-button class="md-accent md-raised" flow-btn>\n            Upload\n          </md-button>\n          <span class="secondary-text mt-8" translate="CALLYSQUARE.DROP_TO_UPLOAD_MESSAGE">You can also drop files here to upload. Only XML - Max. 5MB</span>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog()" class="send-button md-accent md-raised" ng-disabled="importForm.$invalid" aria-label="CLOSE" translate="CALLYSQUARE.CLOSE" translate-attr-aria-label="CALLYSQUARE.CLOSE">\n          CLOSE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/info/info.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="descriptionFrom" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.UPDATE_INFO"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DESCRIPTION">Description</label>\n        <input name="description" ng-model="vm.project.description" md-autofocus>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NOTES">Description</label>\n        <textarea name="notes" ng-model="vm.project.notes"></textarea>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.save()" class="send-button md-accent md-raised" ng-disabled="descriptionFrom.$invalid" aria-label="SAVE" translate="CALLYSQUARE.UPDATE_INFO" translate-attr-aria-label="CALLYSQUARE.UPDATE">\n          UPDATE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/open/open.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="openForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.OPEN_PROJECT"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.PROJECT">Project</label>\n        <md-select name="id" ng-model="vm.id" required>\n          <md-option value="{{p.id}}" ng-repeat="p in vm.projects">{{p.name}}</md-option>\n        </md-select>\n        <div ng-messages="openForm.id.$error" ng-show="openForm.id.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.PROJECT_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.newWindow" aria-label="{{\'CALLYSQUARE.OPEN_NEW_WINDOW\' | translate }}"><span translate="CALLYSQUARE.OPEN_NEW_WINDOW"></span></md-switch>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog(true)" class="send-button md-accent md-raised" ng-disabled="openForm.$invalid" aria-label="SAVE" translate="CALLYSQUARE.OPEN_PROJECT" translate-attr-aria-label="CALLYSQUARE.OPEN">\n          OPEN\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/permissionadd/permissionadd.html",'<md-dialog class="projects-dialog" aria-label="projects">\n  <form name="projectsForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CALLYSQUARE.PERMISSIONADD_PROJECTS">Add User Permissions</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions"></ms-dual-multiselect>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/saveAs/saveAs.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="newForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.COPY_PROJECT"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NAME">Name</label>\n        <input name="name" ng-model="vm.project.name" required md-autofocus>\n        <div ng-messages="newForm.name.$error" ng-show="newForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.newWindow" aria-label="{{\'CALLYSQUARE.OPEN_NEW_WINDOW\' | translate }}"><span translate="CALLYSQUARE.OPEN_NEW_WINDOW"></span></md-switch>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.save()" class="send-button md-accent md-raised" ng-disabled="newForm.$invalid" aria-label="SAVE" translate="CALLYSQUARE.COPY_PROJECT" translate-attr-aria-label="CALLYSQUARE.COPY">\n          COPY\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/view.html",'<div id="callysquare-project" class="page-layout simple tabbed" layout="column" ng-init="vm.onInit()">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-projects-button md-icon-button" aria-label="Go to projects" ng-click="vm.gotoProjects()" translate translate-attr-aria-label="CALLYSQUARE.GO_TO_PROJECTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="project-image" hide-xs>\n          <img ng-src="assets/images/business/cprojects.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.project.id}} {{vm.project.name}}\n          </div>\n          <div class="subtitle secondary-text text-truncate">\n            <span ng-if="vm.project.description">{{vm.project.description}} - </span><span translate="CALLYSQUARE.CREATED_AT"></span> <span>{{vm.project.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-if="vm.crudPermissions.canEdit" ng-click="vm.updateInfo($event)" class="md-fab md-yellow-700-bg md-icon-button" aria-label="edit">\n        <md-icon md-font-icon="icon-tooltip-edit"></md-icon>\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <md-content class="callysquare-content">\n\n    <div id="geEditor" class="geEditor"></div>\n\n  </md-content>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/callysquare/views/projects/projects.html",'<div id="projects" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-vector-square" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CALLYSQUARE.PROJECTS">Projects</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    \x3c!-- SEARCH --\x3e\n    <div class="search-input-wrapper" layout="row" layout-align="start center">\n      <label for="search">\n        <md-icon md-font-icon="icon-magnify"></md-icon>\n      </label>\n      <md-input-container md-no-float class="m-0">\n        <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CALLYSQUARE.SEARCH_FOR_ANYONE">\n      </md-input-container>\n    </div>\n    \x3c!-- / SEARCH --\x3e\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedProjects.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedProjects =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CALLYSQUARE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-projects-count">\n          <span>{{vm.selectedProjects.length}}</span>\n          <span translate="CALLYSQUARE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CALLYSQUARE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllProjects()" translate="CALLYSQUARE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectProjects()" translate="CALLYSQUARE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedProjects" csv-label="true" filename="projects.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedProjects($event)" aria-label="delete selected" translate translate-attr-label="CALLYSQUARE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      \x3c!-- PROJECT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedProjects" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getProjects">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'CALLYSQUARE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CALLYSQUARE.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CALLYSQUARE.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="notes">{{ \'CALLYSQUARE.NOTES\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.projects.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CALLYSQUARE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="project" md-select-id="id" ng-repeat="project in vm.projects.rows">\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="id ">{{project.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="name ">{{project.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="description ">{{project.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="notes ">{{project.notes}}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CALLYSQUARE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(project, ev)" translate="CALLYSQUARE.EDIT_PROJECT">\n                          Edit Project\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(project, ev)" translate="CALLYSQUARE.DELETE_PROJECT">\n                          Delete Project\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CALLYSQUARE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CALLYSQUARE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CALLYSQUARE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.projects.count}}" md-on-paginate="vm.getProjects" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PROJECT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD PROJECT BUTTON --\x3e\n  <md-button class="md-fab md-accent md-icon-button" id="add-project-button" ng-if="vm.crudPermissions.canEdit" ng-click="vm.createOrEditProject($event)" aria-label="add project" translate translate-attr-aria-label="CALLYSQUARE.ADD_PROJECT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD PROJECT BUTTON --\x3e\n\n</div>'),e.put("app/main/apps/callysquare/views/squareRecordings/create/dialog.html",'<md-dialog class="squareRecording-dialog" aria-label="New SquareRecording">\n  <form name="squareRecordingForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.FILENAME">Filename</label>\n        <input type="" name="filename" ng-model="vm.squareRecording.filename" ng-required="true" autofocus>\n\n        <div ng-messages="squareRecordingForm[\'filename\'].$error" ng-show="squareRecordingForm[\'filename\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.FILENAME_REQUIRED">Filename field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSquareRecording" ng-click="vm.saveSquareRecording()" class="send-button md-accent md-raised" ng-disabled="squareRecordingForm.$invalid || squareRecordingForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSquareRecording" ng-click="vm.addNewSquareRecording()" class="send-button md-accent md-raised" ng-disabled="squareRecordingForm.$invalid" aria-label="ADD" translate="CALLYSQUARE.ADD_SQUARERECORDING" translate-attr-aria-label="CALLYSQUARE.ADD_SQUARERECORDING">\n          ADD SQUARERECORDING\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSquareRecording" ng-click="vm.deleteSquareRecording($event)" aria-label="DELETE" translate translate-attr-aria-label="CALLYSQUARE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CALLYSQUARE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/squareRecordings/squareRecordings.html",'<div id="squareRecordings" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-sitemap" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CALLYSQUARE.SQUARERECORDINGS">SquareRecordings</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CALLYSQUARE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSquareRecordings.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSquareRecordings =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CALLYSQUARE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-squareRecordings-count">\n          <span>{{vm.selectedSquareRecordings.length}}</span>\n          <span translate="CALLYSQUARE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CALLYSQUARE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSquareRecordings()" translate="CALLYSQUARE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSquareRecordings()" translate="CALLYSQUARE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSquareRecordings" csv-label="true" filename="squareRecordings.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSquareRecordings($event)" aria-label="delete selected" translate translate-attr-label="CALLYSQUARE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SQUARERECORDING TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSquareRecordings" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSquareRecordings">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="filename">{{ \'CALLYSQUARE.FILENAME\' | translate }}</th>\n                <th md-column md-order-by="projectName">{{ \'CALLYSQUARE.PROJECT\' | translate }}</th>\n                <th md-column md-order-by="uniqueid">{{ \'CALLYSQUARE.UNIQUEID\' | translate }}</th>\n                <th md-column md-order-by="callerid">{{ \'CALLYSQUARE.PHONE\' | translate }}</th>\n                <th md-column md-order-by="extension">{{ \'CALLYSQUARE.EXTEN\' | translate }}</th>\n                <th md-column>{{ \'CALLYSQUARE.AUDIO\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'CALLYSQUARE.CREATED_AT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.squareRecordings.rows.length">\n                <td md-cell colspan="8">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CALLYSQUARE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="squareRecording" md-select-id="id" ng-repeat="squareRecording in vm.squareRecordings.rows">\n                <td md-cell ng-if="squareRecording.userpic"><img class="avatar" alt="{{squareRecording.name}}" ng-src="api/users/{{squareRecording.id}}/avatar" /></td>\n                <td md-cell ng-if="!squareRecording.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{squareRecording.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="filename ">{{squareRecording.filename}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="projectName ">{{squareRecording.projectName}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="uniqueid ">{{squareRecording.uniqueid}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="callerid ">{{squareRecording.callerid}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="extension ">{{squareRecording.extension}}</td>\n                <td md-cell class="audio " ng-switch="squareRecording.format">\n                  \x3c!-- audio recording directive --\x3e\n                  <ms-recording ng-switch-when=".wav" id="squareRecording.id" model="\'squareRecording\'"></ms-recording>\n                  \x3c!-- / audio recording directive --\x3e\n                  <span ng-switch-when=".gsm|.WAV" ng-switch-when-separator="|">\n                    <em>{{ \'VOICE.CANT_PLAY_GSM_AUDIO_FILES\' | translate }}</em>\n                  </span>\n                </td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="createdAt ">{{squareRecording.createdAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CALLYSQUARE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadCallySquareRecordings">\n\n                        <md-button ng-click="vm.downloadfile2(squareRecording, $event  , \'square/recordings\'   )" translate="CALLYSQUARE.DOWNLOAD_SQUARERECORDING">\n                          Download SquareRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(squareRecording, $event    )" translate="CALLYSQUARE.DELETE_SQUARERECORDING">\n                          Delete SquareRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CALLYSQUARE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CALLYSQUARE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CALLYSQUARE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.squareRecordings.count}}" md-on-paginate="vm.getSquareRecordings" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SQUARERECORDING TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/chat/views/chatQueues/chatQueues.html",'<div id="chatQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-hangouts" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CHAT.CHATQUEUES">ChatQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CHAT.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedChatQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedChatQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CHAT.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-chatQueues-count">\n          <span>{{vm.selectedChatQueues.length}}</span>\n          <span translate="CHAT.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CHAT.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllChatQueues()" translate="CHAT.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectChatQueues()" translate="CHAT.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedChatQueues" csv-label="true" filename="chatQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedChatQueues($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CHATQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedChatQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChatQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CHAT.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'CHAT.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.chatQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="chatQueue" md-select-id="id" ng-repeat="chatQueue in vm.chatQueues.rows">\n                <td md-cell ng-if="chatQueue.userpic"><img class="avatar" alt="{{chatQueue.name}}" ng-src="api/users/{{chatQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!chatQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{chatQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatQueue, ev) : vm.createOrEditChatQueue($event, chatQueue)" md-cell class="id ">{{chatQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatQueue, ev) : vm.createOrEditChatQueue($event, chatQueue)" md-cell class="name ">{{chatQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatQueue, ev) : vm.createOrEditChatQueue($event, chatQueue)" md-cell class="strategy ">{{ vm.arraystrategy[chatQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(chatQueue, $event    )" translate="CHAT.EDIT_CHATQUEUE">\n                          Edit ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(chatQueue, $event    )" translate="CHAT.TEAMADD_CHATQUEUE">\n                          teamadd ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(chatQueue, $event    )" translate="CHAT.AGENTADD_CHATQUEUE">\n                          agentadd ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(chatQueue, $event    )" translate="CHAT.DELETE_CHATQUEUE">\n                          Delete ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(chatQueue, $event    )" translate="CHAT.GOTOREALTIME_CHATQUEUE">\n                          goToRealtime ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chatQueues.count}}" md-on-paginate="vm.getChatQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CHATQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CHATQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-chatQueue-button" ng-click="vm.createOrEditChatQueue($event)" aria-label="add chatQueue" translate translate-attr-aria-label="CHAT.ADD_CHATQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CHATQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/chat/views/chatQueues/create/dialog.html",'<md-dialog class="chatQueue-dialog" aria-label="New ChatQueue">\n  <form name="chatQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.chatQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newChatQueue">\n\n        <div class="hint"><span translate="CHAT.HELP.NAME"></span></div>\n        <div ng-messages="chatQueueForm[\'name\'].$error" ng-show="chatQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="CHAT.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.chatQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="chatQueueForm[\'strategy\'].$error" ng-show="chatQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.chatQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="chatQueueForm[\'timeout\'].$error" ng-show="chatQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chatQueue.description">\n\n        <div ng-messages="chatQueueForm[\'description\'].$error" ng-show="chatQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatQueue" ng-click="vm.saveChatQueue()" class="send-button md-accent md-raised" ng-disabled="chatQueueForm.$invalid || chatQueueForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatQueue" ng-click="vm.addNewChatQueue()" class="send-button md-accent md-raised" ng-disabled="chatQueueForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATQUEUE" translate-attr-aria-label="CHAT.ADD_CHATQUEUE">\n          ADD CHATQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatQueue" ng-click="vm.deleteChatQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",'<md-dialog class="chatQueue-dialog" aria-label="chatQueue" ng-init="vm.onInit()">\n  <form name="chatQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CHAT.AGENTADD_CHATQUEUE">Add Agent to chatQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",'<md-dialog class="chatQueue-dialog" aria-label="chatQueue" ng-init="vm.onInit()">\n  <form name="chatQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CHAT.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatQueues/edit/view.html",'<div id="chat-chatQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-chatQueues-button md-icon-button" aria-label="Go to chatQueues" ng-click="vm.gotoChatQueues()" translate translate-attr-aria-label="CHAT.GO_TO_CHATQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="chatQueue-image" hide-xs>\n          <img ng-src="assets/images/business/chatQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.chatQueue.id}}\n            <span ng-if="vm.chatQueue.name">{{vm.chatQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CHAT.CREATED_AT"></span> <span>{{vm.chatQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.chatQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="CHAT.TEAMADD_CHATQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.chatQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="CHAT.AGENTADD_CHATQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveChatQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.chatQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="CHAT.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="CHAT.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.chatQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.chatQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.chatQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/chat/views/chatWebsites/chatWebsites.html",'<div id="chatWebsites" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-hangouts" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CHAT.CHATWEBSITES">ChatWebsites</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CHAT.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedChatWebsites.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedChatWebsites =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CHAT.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-chatWebsites-count">\n          <span>{{vm.selectedChatWebsites.length}}</span>\n          <span translate="CHAT.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CHAT.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllChatWebsites()" translate="CHAT.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectChatWebsites()" translate="CHAT.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedChatWebsites" csv-label="true" filename="chatWebsites.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedChatWebsites($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CHATWEBSITE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedChatWebsites" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChatWebsites">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CHAT.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'CHAT.KEY\' | translate }}</th>\n                <th md-column md-order-by="address">{{ \'CHAT.MOTIONADDRESS\' | translate }}</th>\n                <th md-column md-order-by="remote">{{ \'CHAT.MOTIONPROXY\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CHAT.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.chatWebsites.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="chatWebsite" md-select-id="id" ng-repeat="chatWebsite in vm.chatWebsites.rows">\n                <td md-cell ng-if="chatWebsite.userpic"><img class="avatar" alt="{{chatWebsite.name}}" ng-src="api/users/{{chatWebsite.id}}/avatar" /></td>\n                <td md-cell ng-if="!chatWebsite.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{chatWebsite.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="id ">{{chatWebsite.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="name ">{{chatWebsite.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="key ">{{chatWebsite.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="address ">{{chatWebsite.address}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="remote ">{{chatWebsite.remote}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="description ">{{chatWebsite.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(chatWebsite, $event    )" translate="CHAT.EDIT_CHATWEBSITE">\n                          Edit ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(chatWebsite, $event    )" translate="CHAT.INTERACTIONS_CHATWEBSITE">\n                          Interactions ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.offlinemessagesgoto(chatWebsite, $event    )" translate="CHAT.OFFLINEMESSAGES_CHATWEBSITE">\n                          OfflineMessages ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(chatWebsite, $event    )" translate="CHAT.AGENTADD_CHATWEBSITE">\n                          AgentAdd ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(chatWebsite, $event    )" translate="CHAT.DELETE_CHATWEBSITE">\n                          Delete ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chatWebsites.count}}" md-on-paginate="vm.getChatWebsites" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CHATWEBSITE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CHATWEBSITE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-chatWebsite-button" ng-click="vm.createOrEditChatWebsite($event)" aria-label="add chatWebsite" translate translate-attr-aria-label="CHAT.ADD_CHATWEBSITE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CHATWEBSITE BUTTON --\x3e\n</div>'),e.put("app/main/apps/chat/views/chatWebsites/create/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.chatWebsite.name" ng-required="true" autofocus ng-disabled="!vm.newChatWebsite">\n\n        <div ng-messages="chatWebsiteForm[\'name\'].$error" ng-show="chatWebsiteForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.chatWebsite.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="chatWebsiteForm[\'key\'].$error" ng-show="chatWebsiteForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONADDRESS">MotionAddress</label>\n        <input type="url" name="address" ng-model="vm.chatWebsite.address" md-maxlength="255" ng-required="true">\n\n        <div ng-messages="chatWebsiteForm[\'address\'].$error" ng-show="chatWebsiteForm[\'address\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONADDRESS_REQUIRED">MotionAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="CHAT.ERRORS.MOTIONADDRESS_MUST_VALID_URL">MotionAddress must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.MOTIONADDRESS_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionAddress must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONPROXY">MotionProxy</label>\n        <input type="url" name="remote" ng-model="vm.chatWebsite.remote" md-maxlength="255" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="CHAT.HELP.MOTIONPROXY"></span></div>\n        <div ng-messages="chatWebsiteForm[\'remote\'].$error" ng-show="chatWebsiteForm[\'remote\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="CHAT.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.chatWebsite.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="CHAT.HELP.LIST"></span></div>\n        <div ng-messages="chatWebsiteForm[\'ListId\'].$error" ng-show="chatWebsiteForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.INTERVAL">Interval</label>\n        <md-select name="IntervalId" ng-model="vm.chatWebsite.IntervalId">\n          <md-option ng-value="null">Always</md-option>\n          <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteForm[\'IntervalId\'].$error" ng-show="chatWebsiteForm[\'IntervalId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chatWebsite.description">\n\n        <div ng-messages="chatWebsiteForm[\'description\'].$error" ng-show="chatWebsiteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatWebsite" ng-click="vm.saveChatWebsite()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteForm.$invalid || chatWebsiteForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatWebsite" ng-click="vm.addNewChatWebsite()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATWEBSITE" translate-attr-aria-label="CHAT.ADD_CHATWEBSITE">\n          ADD CHATWEBSITE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatWebsite" ng-click="vm.deleteChatWebsite($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",'<md-dialog class="chatWebsite-dialog" aria-label="chatWebsite" ng-init="vm.onInit()">\n  <form name="chatWebsiteForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CHAT.AGENTADD_CHATWEBSITE">Add Agent to chatWebsite</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/agent/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'agent\'].$error" ng-show="chatWebsiteFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'timeout\'].$error" ng-show="chatWebsiteFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/amazonlex/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'accesskeyid\'].$error" ng-show="chatWebsiteFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'secretaccesskey\'].$error" ng-show="chatWebsiteFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'lexregion\'].$error" ng-show="chatWebsiteFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'botname\'].$error" ng-show="chatWebsiteFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="CHAT.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="chatWebsiteFormApp[\'welcomemessage\'].$error" ng-show="chatWebsiteFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/autoreply/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'times\'].$error" ng-show="chatWebsiteFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="chatWebsiteFormApp[\'text\'].$error" ng-show="chatWebsiteFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/close/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'disposition\'].$error" ng-show="chatWebsiteFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/dialogflow/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'key\'].$error" ng-show="chatWebsiteFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'language\'].$error" ng-show="chatWebsiteFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="CHAT.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="chatWebsiteFormApp[\'welcomemessage\'].$error" ng-show="chatWebsiteFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'projectId\'].$error" ng-show="chatWebsiteFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'clientEmail\'].$error" ng-show="chatWebsiteFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="chatWebsiteFormApp[\'privateKey\'].$error" ng-show="chatWebsiteFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'language\'].$error" ng-show="chatWebsiteFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="CHAT.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="chatWebsiteFormApp[\'welcomemessage\'].$error" ng-show="chatWebsiteFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/gotoif/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'condition\'].$error" ng-show="chatWebsiteFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'truepriority\'].$error" ng-show="chatWebsiteFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'falsepriority\'].$error" ng-show="chatWebsiteFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/gotop/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'priority\'].$error" ng-show="chatWebsiteFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/noop/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'value\'].$error" ng-show="chatWebsiteFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/queue/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'queue\'].$error" ng-show="chatWebsiteFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'timeout\'].$error" ng-show="chatWebsiteFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/system/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'command\'].$error" ng-show="chatWebsiteFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'variable\'].$error" ng-show="chatWebsiteFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/tag/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'tag\'].$error" ng-show="chatWebsiteFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/tvox/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.SERVICEID">serviceid</label>\n        <input type="text" name="serviceid" ng-model="vm.tvox.serviceid" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'serviceid\'].$error" ng-show="chatWebsiteFormApp[\'serviceid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.SERVICEID_REQUIRED">serviceid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.CHANNELID">channelid</label>\n        <input type="text" name="channelid" ng-model="vm.tvox.channelid" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'channelid\'].$error" ng-show="chatWebsiteFormApp[\'channelid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.CHANNELID_REQUIRED">channelid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXURL">tvoxurl</label>\n        <input type="text" name="tvoxurl" ng-model="vm.tvox.tvoxurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxurl\'].$error" ng-show="chatWebsiteFormApp[\'tvoxurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXURL_REQUIRED">tvoxurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXLOGINURL">tvoxloginurl</label>\n        <input type="text" name="tvoxloginurl" ng-model="vm.tvox.tvoxloginurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxloginurl\'].$error" ng-show="chatWebsiteFormApp[\'tvoxloginurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXLOGINURL_REQUIRED">tvoxloginurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXSESSIONURL">tvoxsessionurl</label>\n        <input type="text" name="tvoxsessionurl" ng-model="vm.tvox.tvoxsessionurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxsessionurl\'].$error" ng-show="chatWebsiteFormApp[\'tvoxsessionurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXSESSIONURL_REQUIRED">tvoxsessionurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXUSERNAME">tvoxusername</label>\n        <input type="text" name="tvoxusername" ng-model="vm.tvox.tvoxusername" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxusername\'].$error" ng-show="chatWebsiteFormApp[\'tvoxusername\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXUSERNAME_REQUIRED">tvoxusername field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXPASSWD">tvoxpasswd</label>\n        <input type="password" name="tvoxpasswd" ng-model="vm.tvox.tvoxpasswd" placeholder="Password" translate translate-attr-placeholder="CHAT.PASSWORD">\n        <div ng-messages="chatWebsiteFormApp[\'tvoxpasswd\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="CHAT.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONURLONRING">motionurlonring</label>\n        <input type="text" name="motionurlonring" ng-model="vm.tvox.motionurlonring" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motionurlonring\'].$error" ng-show="chatWebsiteFormApp[\'motionurlonring\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONURLONRING_REQUIRED">motionurlonring field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONURLONANSWER">motionurlonanswer</label>\n        <input type="text" name="motionurlonanswer" ng-model="vm.tvox.motionurlonanswer" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motionurlonanswer\'].$error" ng-show="chatWebsiteFormApp[\'motionurlonanswer\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONURLONANSWER_REQUIRED">motionurlonanswer field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONTITLE">motiontitle</label>\n        <input type="text" name="motiontitle" ng-model="vm.tvox.motiontitle" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motiontitle\'].$error" ng-show="chatWebsiteFormApp[\'motiontitle\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONTITLE_REQUIRED">motiontitle field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONURL">motionurl</label>\n        <input type="text" name="motionurl" ng-model="vm.tvox.motionurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motionurl\'].$error" ng-show="chatWebsiteFormApp[\'motionurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONURL_REQUIRED">motionurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/chatCannedAnswers/dialog.html",'<md-dialog class="chatCannedAnswer-dialog" aria-label="New ChatCannedAnswer">\n  <form name="chatCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.chatCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="chatCannedAnswerForm[\'key\'].$error" ng-show="chatCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.chatCannedAnswer.value" required></textarea>\n\n        <div ng-messages="chatCannedAnswerForm[\'value\'].$error" ng-show="chatCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chatCannedAnswer.description">\n\n        <div ng-messages="chatCannedAnswerForm[\'description\'].$error" ng-show="chatCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatCannedAnswer" ng-click="vm.saveChatCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="chatCannedAnswerForm.$invalid || chatCannedAnswerForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatCannedAnswer" ng-click="vm.addNewChatCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="chatCannedAnswerForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATCANNEDANSWER" translate-attr-aria-label="CHAT.ADD_CHATCANNEDANSWER">\n          ADD CHATCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatCannedAnswer" ng-click="vm.deleteChatCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",'<md-dialog class="offlineMessage-dialog" aria-label="New OfflineMessage">\n  <md-toolbar class="md-accent md-hue-2">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span class="title">{{ vm.title | translate }}</span>\n      <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-content flex layout-padding>\n    <pre ng-if="vm.isHtml">{{vm.message.body}}</pre>\n    <div ng-if="!vm.isHtml" ng-bind-html-unsafe="vm.message.body"></div>\n\n    <span ng-repeat="attachment in vm.attachments">\n      <md-button class="md-icon-button no-margin no-padding" ng-click="vm.download(attachment)">\n        <md-icon class="no-margin material-icons" aria-label="Attachment">attach_file</md-icon>\n      </md-button>\n      <span>{{attachment.name}}</span><br />\n    </span>\n  </md-content>\n\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/proactive/dialog.html",'<md-dialog class="chatProactiveAction-dialog" aria-label="New ChatProactiveAction">\n  <form name="chatProactiveActionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.chatProactiveAction.name" ng-required="true" autofocus>\n\n        <div ng-messages="chatProactiveActionForm[\'name\'].$error" ng-show="chatProactiveActionForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.chatProactiveAction.type">\n\n          <md-option ng-value="\'mouseOver\'"> {{ \'CHAT.MOUSEOVER\' | translate }} </md-option>\n\n          <md-option ng-value="\'timeout\'"> {{ \'CHAT.TIMEOUT\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="chatProactiveActionForm[\'type\'].$error" ng-show="chatProactiveActionForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.chatProactiveAction.type === \'mouseOver\'" class="md-block">\n        <label translate="CHAT.SELECTOR">Selector</label>\n        <input type="" name="selector" ng-model="vm.chatProactiveAction.selector" ng-required="true">\n\n        <div ng-messages="chatProactiveActionForm[\'selector\'].$error" ng-show="chatProactiveActionForm[\'selector\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.SELECTOR_REQUIRED">Selector field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.chatProactiveAction.type === \'timeout\'" class="md-block">\n        <label translate="CHAT.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.chatProactiveAction.timeout" min="1" ng-required="true">\n\n        <div ng-messages="chatProactiveActionForm[\'timeout\'].$error" ng-show="chatProactiveActionForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatProactiveAction" ng-click="vm.saveChatProactiveAction()" class="send-button md-accent md-raised" ng-disabled="chatProactiveActionForm.$invalid || chatProactiveActionForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatProactiveAction" ng-click="vm.addNewChatProactiveAction()" class="send-button md-accent md-raised" ng-disabled="chatProactiveActionForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATPROACTIVEACTION" translate-attr-aria-label="CHAT.ADD_CHATPROACTIVEACTION">\n          ADD CHATPROACTIVEACTION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatProactiveAction" ng-click="vm.deleteChatProactiveAction($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/view.html",'<div id="chat-chatWebsite" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-chatWebsites-button md-icon-button" aria-label="Go to chatWebsites" ng-click="vm.gotoChatWebsites()" translate translate-attr-aria-label="CHAT.GO_TO_CHATWEBSITES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="chatWebsite-image" hide-xs>\n          <img ng-src="assets/images/business/chatWebsites.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.chatWebsite.id}}\n            <span ng-if="vm.chatWebsite.name">{{vm.chatWebsite.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CHAT.CREATED_AT"></span> <span>{{vm.chatWebsite.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.chatWebsite, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="CHAT.AGENTADD_CHATWEBSITE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveChatWebsite()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (scriptForm.$invalid) || (intervalForm.$invalid) || (dispositionForm.$invalid) || (appearanceForm.$invalid) || (onlinestatusForm.$invalid) || (offlinestatusForm.$invalid) || (closingformForm.$invalid) || (unmanagedstatusForm.$invalid) || (interactionForm.$invalid) || (whitelabelForm.$invalid) || (logoForm.$invalid) || (agentAvatarForm.$invalid) || (customerAvatarForm.$invalid) || (systemAvatarForm.$invalid) || (chatFormOnlineForm.$invalid) || (chatFormOfflineForm.$invalid) || (proactiveForm.$invalid) || (chatDispositionsForm.$invalid) || (chatCannedAnswersForm.$invalid) || (vidaooForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid) || (offlineMessagesForm.$invalid)" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.chatWebsite.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.chatWebsite.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.MOTIONADDRESS">MotionAddress</label>\n                <input type="url" name="address" ng-model="vm.chatWebsite.address" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'address\'].$error" ng-show="generalForm[\'address\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MOTIONADDRESS_REQUIRED">MotionAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="CHAT.ERRORS.MOTIONADDRESS_MUST_VALID_URL">MotionAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.MOTIONADDRESS_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionAddress must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.chatWebsite.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="CHAT.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.fidelity" class="md-block">\n                <label translate="CHAT.TIMEOUT">Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.chatWebsite.timeout" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.chatWebsite.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.chatWebsite.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="CHAT.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.chatWebsite.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.queueTransfer == true" class="md-block">\n                <label translate="CHAT.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.chatWebsite.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.agentTransfer == true" class="md-block">\n                <label translate="CHAT.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.chatWebsite.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container script md-background-bg md-whiteframe-1dp">\n            <form name="scriptForm" flex="100" novalidate>\n              <div ng-controller="ChatWebsiteScriptController as vm_ac" ng-init="vm_ac.init(vm.chatWebsite)" class="content" md-background-bg>\n                <div class="pb-16" layout="row" layout-align="start center">\n                  <div class="h2 secondary-text" translate="CHAT.SCRIPT">SCRIPT</div>\n                </div>\n\n\n                <md-input-container class="md-block">\n                  <label translate="CHAT.TOKEN">Token</label>\n                  <input type="text" name="token" ng-model="vm_ac.chatWebsite.token" autofocus ng-disabled="true">\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="CHAT.MOTIONPROXY">MotionProxy</label>\n                  <input type="url" name="remote" ng-model="vm_ac.chatWebsite.remote" required>\n                  <div class="hint"><span translate="CHAT.HELP.MOTIONPROXY"></span></div>\n                  <div ng-messages="scriptForm[\'remote\'].$error" ng-show="scriptForm[\'remote\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="CHAT.ERRORS.MOTIONPROXY_REQUIRED">Motion Proxy field is required</span>\n                    </div>\n                    <div ng-message="url">\n                      <span translate="CHAT.ERRORS.MOTIONPROXY_MUST_VALID_URL">Motion Proxy must be a valid url e.g.: http://www.xcally.com</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="CHAT.WEBSITESCRIPT">WebsiteScript</label>\n                  <div>\n                    <pre style="font-size: 13px;">\n                    {{vm_ac.start}} {{vm_ac.script}} {{vm_ac.end}}\n                    </pre>\n                  </div>\n                  <div class="hint"><span translate="CHAT.HELP.COPYSCRIPTTOCLIPBOARD"></span></div>\n                </md-input-container>\n\n              </div>\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container interval md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.INTERVAL">INTERVAL</div>\n            </div>\n            <form name="intervalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.INTERVAL">Interval</label>\n                <md-select name="IntervalId" ng-model="vm.chatWebsite.IntervalId" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Always</md-option>\n                  <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n                </md-select>\n                <div ng-messages="intervalForm[\'IntervalId\'].$error" ng-show="intervalForm[\'IntervalId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.TIMEZONE">Timezone</label>\n                <ms-timezone name="timezone" ng-model="vm.chatWebsite.timezone" ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                <div class="hint"><span translate="CHAT.HELP.TIMEZONE"></span></div>\n                <div ng-messages="intervalForm[\'timezone\'].$error" ng-show="intervalForm[timezone].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.mandatoryDisposition" class="md-block">\n                <label translate="CHAT.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.chatWebsite.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="CHAT.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.SNIPPET">SNIPPET</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container appearance md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.APPEARANCE">APPEARANCE</div>\n            </div>\n            <form name="appearanceForm" novalidate>\n              <div flex md-color-picker ng-model="vm.chatWebsite.color" label="{{\'CHAT.MAINCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.color_button" label="{{\'CHAT.BUTTONCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.textColor" label="{{\'CHAT.TEXTCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.textButtonColor" label="{{\'CHAT.TEXT_BUTTON_COLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.backgroundColor" label="{{\'CHAT.BACKGROUNDCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <md-input-container class="md-block">\n                <label translate="CHAT.FONTSIZE">fontSize</label>\n                <input type="number" name="fontSize" ng-model="vm.chatWebsite.fontSize" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="appearanceForm[\'fontSize\'].$error" ng-show="appearanceForm[\'fontSize\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FONTSIZE_REQUIRED">fontSize field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.FONTSIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">fontSize must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.HEADERSHAPE">headershape</label>\n                <md-select name="header_shape" ng-model="vm.chatWebsite.header_shape" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'rounded\'"> {{ \'CHAT.ROUNDED\' | translate }} </md-option>\n\n                  <md-option ng-value="\'squared\'"> {{ \'CHAT.SQUARED\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="appearanceForm[\'header_shape\'].$error" ng-show="appearanceForm[\'header_shape\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.HEADERSHAPE_REQUIRED">headershape field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.showAgentAvatar" aria-label="ShowAgentAvatar" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.SHOWAGENTAVATAR">ShowAgentAvatar</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.showCustomerAvatar" aria-label="showCustomerAvatar" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.SHOWCUSTOMERAVATAR">showCustomerAvatar</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SNIPPETSWIPEOUT">snippetSwipeOut</label>\n                <md-select name="alignment" ng-model="vm.chatWebsite.alignment" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'bottom_right\'"> {{ \'CHAT.BOTTOM_RIGHT\' | translate }} </md-option>\n\n                  <md-option ng-value="\'right\'"> {{ \'CHAT.RIGHT\' | translate }} </md-option>\n\n                  <md-option ng-value="\'left\'"> {{ \'CHAT.LEFT\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="appearanceForm[\'alignment\'].$error" ng-show="appearanceForm[\'alignment\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SNIPPETSWIPEOUT_REQUIRED">snippetSwipeOut field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.alignment !== \'bottom_right\'" class="md-block">\n                <label translate="CHAT.VERTICALPOSITION">verticalPosition</label>\n                <input type="number" name="verticalAlignment" ng-model="vm.chatWebsite.verticalAlignment" min="0" max="100" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="CHAT.HELP.VERTICALPOSITION"></span></div>\n                <div ng-messages="appearanceForm[\'verticalAlignment\'].$error" ng-show="appearanceForm[\'verticalAlignment\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VERTICALPOSITION_REQUIRED">verticalPosition field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.VERTICALPOSITION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">verticalPosition must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.VERTICALPOSITION_MUST_BE_LESS_THAN_OR_EQUAL_TO">verticalPosition must be a valid greater or equal than</span> <span>100</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.MESSAGESALIGNMENT">messagesAlignment</label>\n                <md-select name="messagesAlignment" ng-model="vm.chatWebsite.messagesAlignment" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'alternate\'"> {{ \'CHAT.ALTERNATE\' | translate }} </md-option>\n\n                  <md-option ng-value="\'centered\'"> {{ \'CHAT.CENTERED\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="appearanceForm[\'messagesAlignment\'].$error" ng-show="appearanceForm[\'messagesAlignment\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MESSAGESALIGNMENT_REQUIRED">messagesAlignment field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.DEFAULTTITLE">defaultTitle</label>\n                <input type="text" name="defaultTitle" ng-model="vm.chatWebsite.defaultTitle" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="appearanceForm[\'defaultTitle\'].$error" ng-show="appearanceForm[\'defaultTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.DEFAULTTITLE_REQUIRED">defaultTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.DEFAULTTITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>defaultTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.LABELTEXT">labelText</label>\n                <input type="text" name="labelText" ng-model="vm.chatWebsite.labelText" md-maxlength="6" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="appearanceForm[\'labelText\'].$error" ng-show="appearanceForm[\'labelText\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.LABELTEXT_REQUIRED">labelText field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.LABELTEXT_MAX_LENGTH" translate-values=\'{max: 6}\'>labelText\n                      must have a maximum length equal to 6</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container onlinestatus md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.ONLINESTATUS">ONLINESTATUS</div>\n            </div>\n            <form name="onlinestatusForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.HEADER_ONLINE">header_online</label>\n                <input type="text" name="header_online" ng-model="vm.chatWebsite.header_online" md-maxlength="255" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="onlinestatusForm[\'header_online\'].$error" ng-show="onlinestatusForm[\'header_online\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.HEADER_ONLINE_REQUIRED">header_online field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.HEADER_ONLINE_MAX_LENGTH" translate-values=\'{max: 255}\'>header_online must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.START_CHAT_BUTTON">start_chat_button</label>\n                <input type="text" name="start_chat_button" ng-model="vm.chatWebsite.start_chat_button" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="onlinestatusForm[\'start_chat_button\'].$error" ng-show="onlinestatusForm[\'start_chat_button\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.START_CHAT_BUTTON_REQUIRED">start_chat_button field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.START_CHAT_BUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>start_chat_button must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container offlinestatus md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.OFFLINESTATUS">OFFLINESTATUS</div>\n            </div>\n            <form name="offlinestatusForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.hideWhenOffline" aria-label="hideWhenOffline" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.HIDEWHENOFFLINE">hideWhenOffline</span></md-switch>\n                <div class="hint"><span translate="CHAT.HELP.HIDEWHENOFFLINE"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.HEADER_OFFLINE">header_offline</label>\n                <input type="text" name="header_offline" ng-model="vm.chatWebsite.header_offline" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'header_offline\'].$error" ng-show="offlinestatusForm[\'header_offline\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.HEADER_OFFLINE_REQUIRED">header_offline field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.HEADER_OFFLINE_MAX_LENGTH" translate-values=\'{max: 255}\'>header_offline must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.OFFLINE_CHAT_BUTTON">offline_chat_button</label>\n                <input type="text" name="offline_chat_button" ng-model="vm.chatWebsite.offline_chat_button" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'offline_chat_button\'].$error" ng-show="offlinestatusForm[\'offline_chat_button\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.OFFLINE_CHAT_BUTTON_REQUIRED">offline_chat_button field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.OFFLINE_CHAT_BUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>offline_chat_button must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.OFFLINEMESSAGESUBJECT">offlineMessageSubject</label>\n                <input type="text" name="offlineMessageSubject" ng-model="vm.chatWebsite.offlineMessageSubject" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'offlineMessageSubject\'].$error" ng-show="offlinestatusForm[\'offlineMessageSubject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGESUBJECT_REQUIRED">offlineMessageSubject field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGESUBJECT_MAX_LENGTH" translate-values=\'{max: 255}\'>offlineMessageSubject must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.OFFLINEMESSAGEBODY">offlineMessageBody</label>\n                <input type="text" name="offlineMessageBody" ng-model="vm.chatWebsite.offlineMessageBody" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'offlineMessageBody\'].$error" ng-show="offlinestatusForm[\'offlineMessageBody\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGEBODY_REQUIRED">offlineMessageBody field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGEBODY_MAX_LENGTH" translate-values=\'{max: 255}\'>offlineMessageBody must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container closingform md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.CLOSINGFORM">CLOSINGFORM</div>\n            </div>\n            <form name="closingformForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CLOSINGMESSAGE">closingMessage</label>\n                <textarea name="closingMessage" ng-model="vm.chatWebsite.closingMessage" md-maxlength="255" required autofocus></textarea>\n\n                <div ng-messages="closingformForm[\'closingMessage\'].$error" ng-show="closingformForm[\'closingMessage\'].$touched" role="alert">\n\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGE_REQUIRED">closingMessage field is required</span>\n                  </div>\n\n\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>closingMessage must have a maximum length equal to 255</span>\n                  </div>\n\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SKIPMESSAGEBUTTON">skipMessageButton</label>\n                <input type="text" name="skipMessageButton" ng-model="vm.chatWebsite.skipMessageButton" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'skipMessageButton\'].$error" ng-show="closingformForm[\'skipMessageButton\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SKIPMESSAGEBUTTON_REQUIRED">skipMessageButton field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SKIPMESSAGEBUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>skipMessageButton must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableRating" aria-label="enableRating" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLERATING">enableRating</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableRating" class="md-block">\n                <label translate="CHAT.RATINGTYPE">ratingType</label>\n                <md-select name="ratingType" ng-model="vm.chatWebsite.ratingType" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'star\'">Star</md-option>\n                  <md-option ng-value="\'thumb\'">Thumb</md-option>\n                </md-select>\n                <div ng-messages="closingformForm[\'ratingType\'].$error" ng-show="closingformForm[\'ratingType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.RATINGTYPE_REQUIRED">ratingType field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableRating && vm.chatWebsite.ratingType === \'star\'" class="md-block">\n                <label translate="CHAT.RATINGSTARSNUMBER">ratingStarsNumber</label>\n                <input type="number" name="ratingStarsNumber" ng-model="vm.chatWebsite.ratingStarsNumber" min="2" max="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'ratingStarsNumber\'].$error" ng-show="closingformForm[\'ratingStarsNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.RATINGSTARSNUMBER_REQUIRED">ratingStarsNumber field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.RATINGSTARSNUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ratingStarsNumber must be a valid greater or equal than</span> <span>2</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.RATINGSTARSNUMBER_MUST_BE_LESS_THAN_OR_EQUAL_TO">ratingStarsNumber must be a valid greater or equal than</span> <span>5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableFeedback" aria-label="enableFeedback" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLEFEEDBACK">enableFeedback</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableFeedback" class="md-block">\n                <label translate="CHAT.FEEDBACKTITLE">feedbackTitle</label>\n                <input type="text" name="feedbackTitle" ng-model="vm.chatWebsite.feedbackTitle" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'feedbackTitle\'].$error" ng-show="closingformForm[\'feedbackTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FEEDBACKTITLE_REQUIRED">feedbackTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FEEDBACKTITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>feedbackTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.forwardTranscript" aria-label="forwardTranscript" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.FORWARDTRANSCRIPT">forwardTranscript</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.forwardTranscript" class="md-block">\n                <label translate="CHAT.FORWARDTRANSCRIPTMESSAGE">forwardTranscriptMessage</label>\n                <input type="text" name="forwardTranscriptMessage" ng-model="vm.chatWebsite.forwardTranscriptMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'forwardTranscriptMessage\'].$error" ng-show="closingformForm[\'forwardTranscriptMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FORWARDTRANSCRIPTMESSAGE_REQUIRED">forwardTranscriptMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FORWARDTRANSCRIPTMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>forwardTranscriptMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CLOSINGMESSAGEBUTTON">closingMessageButton</label>\n                <input type="text" name="closingMessageButton" ng-model="vm.chatWebsite.closingMessageButton" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'closingMessageButton\'].$error" ng-show="closingformForm[\'closingMessageButton\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGEBUTTON_REQUIRED">closingMessageButton field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGEBUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>closingMessageButton must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container unmanagedstatus md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.UNMANAGEDSTATUS">UNMANAGEDSTATUS</div>\n            </div>\n            <form name="unmanagedstatusForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.autoclose" aria-label="autoclose" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.AUTOCLOSE">autoclose</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableUnmanagedNote" aria-label="enableUnmanagedNote" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLEUNMANAGEDNOTE">enableUnmanagedNote</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.UNMANAGEDMESSAGE">unmanagedMessage</label>\n                <input type="text" name="unmanagedMessage" ng-model="vm.chatWebsite.unmanagedMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'unmanagedMessage\'].$error" ng-show="unmanagedstatusForm[\'unmanagedMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.UNMANAGEDMESSAGE_REQUIRED">unmanagedMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.UNMANAGEDMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>unmanagedMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SKIPUNMANAGED">skipUnmanaged</label>\n                <input type="text" name="skipUnmanaged" ng-model="vm.chatWebsite.skipUnmanaged" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'skipUnmanaged\'].$error" ng-show="unmanagedstatusForm[\'skipUnmanaged\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SKIPUNMANAGED_REQUIRED">skipUnmanaged field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SKIPUNMANAGED_MAX_LENGTH" translate-values=\'{max: 255}\'>skipUnmanaged must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableUnmanagedNote" class="md-block">\n                <label translate="CHAT.SENDUNMANAGED">sendUnmanaged</label>\n                <input type="text" name="sendUnmanaged" ng-model="vm.chatWebsite.sendUnmanaged" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'sendUnmanaged\'].$error" ng-show="unmanagedstatusForm[\'sendUnmanaged\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SENDUNMANAGED_REQUIRED">sendUnmanaged field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SENDUNMANAGED_MAX_LENGTH" translate-values=\'{max: 255}\'>sendUnmanaged must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableUnmanagedNote" class="md-block">\n                <label translate="CHAT.NOTETITLE">noteTitle</label>\n                <input type="text" name="noteTitle" ng-model="vm.chatWebsite.noteTitle" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'noteTitle\'].$error" ng-show="unmanagedstatusForm[\'noteTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.NOTETITLE_REQUIRED">noteTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.NOTETITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>noteTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container interaction md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.INTERACTION">INTERACTION</div>\n            </div>\n            <form name="interactionForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.AGENTIDENTIFIER">agentIdentifier</label>\n                <md-select name="agentIdentifier" ng-model="vm.chatWebsite.agentIdentifier" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'website_alias\'"> {{ \'CHAT.WEBSITEALIAS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'agent_alias\'"> {{ \'CHAT.AGENTALIAS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'agent_fullname\'"> {{ \'CHAT.AGENTFULLNAME\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="CHAT.HELP.AGENTIDENTIFIER"></span></div>\n                <div ng-messages="interactionForm[\'agentIdentifier\'].$error" ng-show="interactionForm[\'agentIdentifier\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.AGENTIDENTIFIER_REQUIRED">agentIdentifier field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CUSTOMERALIAS">customerAlias</label>\n                <input type="text" name="customerAlias" ng-model="vm.chatWebsite.customerAlias" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'customerAlias\'].$error" ng-show="interactionForm[\'customerAlias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CUSTOMERALIAS_REQUIRED">customerAlias field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CUSTOMERALIAS_MAX_LENGTH" translate-values=\'{max: 255}\'>customerAlias must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.MESSAGEFONTSIZE">messageFontSize</label>\n                <input type="number" name="messageFontSize" ng-model="vm.chatWebsite.messageFontSize" min="0" max="20" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'messageFontSize\'].$error" ng-show="interactionForm[\'messageFontSize\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MESSAGEFONTSIZE_REQUIRED">messageFontSize field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.MESSAGEFONTSIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">messageFontSize must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.MESSAGEFONTSIZE_MUST_BE_LESS_THAN_OR_EQUAL_TO">messageFontSize must be a valid greater or equal than</span> <span>20</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.agentIdentifier === \'website_alias\'" class="md-block">\n                <label translate="CHAT.WEBSITEALIAS">WebsiteAlias</label>\n                <input type="text" name="agentAlias" ng-model="vm.chatWebsite.agentAlias" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="CHAT.HELP.WEBSITEALIAS"></span></div>\n                <div ng-messages="interactionForm[\'agentAlias\'].$error" ng-show="interactionForm[\'agentAlias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WEBSITEALIAS_REQUIRED">WebsiteAlias field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WEBSITEALIAS_MAX_LENGTH" translate-values=\'{max: 255}\'>WebsiteAlias must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CLOSINGQUESTION">closingQuestion</label>\n                <input type="text" name="closingQuestion" ng-model="vm.chatWebsite.closingQuestion" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'closingQuestion\'].$error" ng-show="interactionForm[\'closingQuestion\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CLOSINGQUESTION_REQUIRED">closingQuestion field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CLOSINGQUESTION_MAX_LENGTH" translate-values=\'{max: 255}\'>closingQuestion must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.FORMSUBMITSUCCESSMESSAGE">formSubmitSuccessMessage</label>\n                <input type="text" name="formSubmitSuccessMessage" ng-model="vm.chatWebsite.formSubmitSuccessMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'formSubmitSuccessMessage\'].$error" ng-show="interactionForm[\'formSubmitSuccessMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FORMSUBMITSUCCESSMESSAGE_REQUIRED">formSubmitSuccessMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FORMSUBMITSUCCESSMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>formSubmitSuccessMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.FORMSUBMITFAILUREMESSAGE">formSubmitFailureMessage</label>\n                <input type="text" name="formSubmitFailureMessage" ng-model="vm.chatWebsite.formSubmitFailureMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'formSubmitFailureMessage\'].$error" ng-show="interactionForm[\'formSubmitFailureMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FORMSUBMITFAILUREMESSAGE_REQUIRED">formSubmitFailureMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FORMSUBMITFAILUREMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>formSubmitFailureMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableCustomerWriting" aria-label="enableCustomerWriting" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLECUSTOMERWRITING">enableCustomerWriting</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="!vm.chatWebsite.enableCustomerWriting" class="md-block">\n                <label translate="CHAT.WAITINGTITLE">waitingTitle</label>\n                <input type="text" name="waitingTitle" ng-model="vm.chatWebsite.waitingTitle" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'waitingTitle\'].$error" ng-show="interactionForm[\'waitingTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WAITINGTITLE_REQUIRED">waitingTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WAITINGTITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>waitingTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="!vm.chatWebsite.enableCustomerWriting" class="md-block">\n                <label translate="CHAT.WAITINGMESSAGE">waitingMessage</label>\n                <textarea name="waitingMessage" ng-model="vm.chatWebsite.waitingMessage" md-maxlength="255" required></textarea>\n\n                <div ng-messages="interactionForm[\'waitingMessage\'].$error" ng-show="interactionForm[\'waitingMessage\'].$touched" role="alert">\n\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WAITINGMESSAGE_REQUIRED">waitingMessage field is required</span>\n                  </div>\n\n\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WAITINGMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>waitingMessage must have a maximum length equal to 255</span>\n                  </div>\n\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.PLACEHOLDERMESSAGE">placeholderMessage</label>\n                <input type="text" name="placeholderMessage" ng-model="vm.chatWebsite.placeholderMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'placeholderMessage\'].$error" ng-show="interactionForm[\'placeholderMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.PLACEHOLDERMESSAGE_REQUIRED">placeholderMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.PLACEHOLDERMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>placeholderMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.download_transcript" aria-label="downloadTranscript" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.DOWNLOADTRANSCRIPT">downloadTranscript</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableCustomerAttachment" aria-label="enableCustomerAttachment" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLECUSTOMERATTACHMENT">enableCustomerAttachment</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableSendButton" aria-label="enableSendButton" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLESENDBUTTON">enableSendButton</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableCustomerCheckmarks" aria-label="enableCustomerCheckmarks" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLECUSTOMERCHECKMARKS">enableCustomerCheckmarks</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SYSTEMALIAS">systemAlias</label>\n                <input type="text" name="systemAlias" ng-model="vm.chatWebsite.systemAlias" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'systemAlias\'].$error" ng-show="interactionForm[\'systemAlias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SYSTEMALIAS_REQUIRED">systemAlias field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SYSTEMALIAS_MAX_LENGTH" translate-values=\'{max: 255}\'>systemAlias must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.license.custom" class="chatWebsite-detail-form-container whitelabel md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.WHITELABEL">WHITELABEL</div>\n            </div>\n            <form name="whitelabelForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.defaultWhiteLabel" aria-label="default" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.DEFAULT">default</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="!vm.chatWebsite.defaultWhiteLabel" class="md-block">\n                <label translate="CHAT.WHITELABEL">whiteLabel</label>\n                <textarea name="whiteLabel" ng-model="vm.chatWebsite.whiteLabel" md-maxlength="255" required></textarea>\n\n                <div ng-messages="whitelabelForm[\'whiteLabel\'].$error" ng-show="whitelabelForm[\'whiteLabel\'].$touched" role="alert">\n\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WHITELABEL_REQUIRED">whiteLabel field is required</span>\n                  </div>\n\n\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WHITELABEL_MAX_LENGTH" translate-values=\'{max: 255}\'>whiteLabel must have a maximum length equal to 255</span>\n                  </div>\n\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.license.custom" class="chatWebsite-detail-form-container logo md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.LOGO">LOGO</div>\n            </div>\n            <div ng-controller="ChatWebsitelogoController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="logoimage in vm_ca.chatWebsite.images" ng-switch="logoimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{logoimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="logoimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{logoimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n          <div class="chatWebsite-detail-form-container agentavatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.AGENTAVATAR">AGENTAVATAR</div>\n            </div>\n            <div ng-controller="ChatWebsiteagentAvatarController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="agentAvatarimage in vm_ca.chatWebsite.images" ng-switch="agentAvatarimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{agentAvatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="agentAvatarimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{agentAvatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n          <div class="chatWebsite-detail-form-container customeravatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.CUSTOMERAVATAR">CUSTOMERAVATAR</div>\n            </div>\n            <div ng-controller="ChatWebsitecustomerAvatarController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="customerAvatarimage in vm_ca.chatWebsite.images" ng-switch="customerAvatarimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{customerAvatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="customerAvatarimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{customerAvatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n          <div class="chatWebsite-detail-form-container systemavatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.SYSTEMAVATAR">SYSTEMAVATAR</div>\n            </div>\n            <div ng-controller="ChatWebsitesystemAvatarController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="systemAvatarimage in vm_ca.chatWebsite.images" ng-switch="systemAvatarimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{systemAvatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="systemAvatarimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{systemAvatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.ONLINE">ONLINE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container chatformonline md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteonlineFormController as vm_fonc" ng-init="vm_fonc.init(vm.chatWebsite)" class="content" md-background-bg layout="column">\n              <div flex>\n                \x3c!-- START Buttons --\x3e\n                <md-button aria-label="comment" class="md-fab md-mini" ng-click="vm_fonc.add(button.type)" ng-repeat="button in vm_fonc.buttons">\n                  <md-tooltip md-direction="top">{{button.name}}</md-tooltip>\n                  <md-icon md-font-icon="{{button.icon}}"></md-icon>\n                </md-button>\n                \x3c!-- END Buttons --\x3e\n              </div>\n\n              <div layout="row" flex>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.BUILDER">BUILDER</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content>\n\n                      <form name="onlineForm" novalidate>\n\n                        \x3c!-- START MapKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.onlineForm.items.length">\n                          <label translate="CHAT.HELP.MAPKEY">MapKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.mapKey">\n                            <md-option ng-value="null">None</md-option>\n\n                            <md-optgroup label="standard">\n                              <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n\n                            <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                              <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END MapKey --\x3e\n\n                        \x3c!-- START FromKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.onlineForm.items.length">\n                          <label translate="CHAT.HELP.FROMKEY">FromKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.onlineForm.fromKey" md-selected-text="vm_fonc.chatWebsite.onlineForm.fromKey != null ? vm_fonc.chatWebsite.onlineForm.items[vm_fonc.chatWebsite.onlineForm.fromKey].props.title : \'None\'">\n                            <md-option ng-value="null">None</md-option>\n                            <md-option ng-repeat="item in vm_fonc.chatWebsite.onlineForm.items" ng-if="item.props.title" ng-value="$index">{{ item.props.title }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END FromKey --\x3e\n\n                        \x3c!-- START EXPANSION PANELS --\x3e\n                        <md-expansion-panel ng-repeat="item in vm_fonc.chatWebsite.onlineForm.items track by $index" md-component-id="{{\'onlinePanel\' + $index}}">\n                          <md-expansion-panel-collapsed md-no-sticky="true">\n                            <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                            </md-button>\n                            <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                            </md-button>\n\n                            <div class="md-title">{{item.props.title || item.type}}</div>\n\n                            <div flex></div>\n                            <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                              <md-icon md-font-icon="icon-chevron-down"></md-icon>\n                            </md-button>\n                          </md-expansion-panel-collapsed>\n\n                          <md-expansion-panel-expanded>\n                            <md-expansion-panel-header>\n                              <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                              </md-button>\n\n                              <div class="md-title">{{item.props.title || item.type}}</div>\n\n                              <div flex></div>\n\n                              <md-button class="md-icon-button md-warn" aria-label="Remove" ng-click="vm_fonc.remove($index)">\n                                <md-icon md-font-icon="icon-delete"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                                <md-icon md-font-icon="icon-chevron-up"></md-icon>\n                              </md-button>\n                            </md-expansion-panel-header>\n\n                            <md-expansion-panel-content>\n                              <form-item type="{{item.type}}" item="item" index="$index"></form-item>\n\n                              <md-input-container class="md-block">\n                                <label translate="CHAT.VARIABLE">Variable</label>\n                                <md-select ng-model="item.variable">\n                                  <md-option ng-value="null">None</md-option>\n                                  <md-option ng-repeat="variable in vm_fonc.variables" ng-value="variable.name">{{ variable.name }}</md-option>\n                                </md-select>\n                              </md-input-container>\n\n                              <md-input-container class="md-block">\n                                <label translate="CHAT.CM_FIELD">Contact Manager Field</label>\n                                <md-select ng-model="item.cmField">\n                                  <md-option ng-value="null">None</md-option>\n\n                                  <md-optgroup label="standard">\n                                    <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n\n                                  <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                                    <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n                                </md-select>\n                              </md-input-container>\n                            </md-expansion-panel-content>\n\n                          </md-expansion-panel-expanded>\n                        </md-expansion-panel>\n                        \x3c!-- END EXPANSION PANELS --\x3e\n                      </form>\n                    </md-card-content>\n                  </md-card>\n                </div>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.PREVIEW">PREVIEW</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content flex>\n                      <form-view form="vm_fonc.chatWebsite.onlineForm" flex="100"></form-view>\n                    </md-card-content>\n                  </md-card>\n                </div>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.OFFLINE">OFFLINE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container chatformoffline md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteofflineFormController as vm_fonc" ng-init="vm_fonc.init(vm.chatWebsite)" class="content" md-background-bg layout="column">\n              <div flex>\n                \x3c!-- START Buttons --\x3e\n                <md-button aria-label="comment" class="md-fab md-mini" ng-click="vm_fonc.add(button.type)" ng-repeat="button in vm_fonc.buttons">\n                  <md-tooltip md-direction="top">{{button.name}}</md-tooltip>\n                  <md-icon md-font-icon="{{button.icon}}"></md-icon>\n                </md-button>\n                \x3c!-- END Buttons --\x3e\n              </div>\n\n              <div layout="row" flex>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.BUILDER">BUILDER</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content>\n\n                      <form name="offlineForm" novalidate>\n                        <md-input-container class="md-block">\n                          <md-switch ng-model="vm_fonc.chatWebsite.forwardOffline" aria-label="forwardOffline"><span translate="CHAT.FORWARD_OFFLINE">forwardOffline</span></md-switch>\n                        </md-input-container>\n\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.forwardOffline">\n                          <label translate="CHAT.FORWARD_OFFLINE_ADDRESS">FORWARD OFFLINE ADDRESS</label>\n                          <input type="text" name="forwardOfflineAddress" ng-model="vm_fonc.chatWebsite.forwardOfflineAddress">\n                          <div class="hint"><span translate="CHAT.HELP.FORWARD_OFFLINE"></span></div>\n                          <div ng-messages="offlineForm[\'forwardOfflineAddress\'].$error" ng-show="offlineForm[\'forwardOfflineAddress\'].$touched" role="alert">\n                            <div ng-message="email">\n                              <span translate="CHAT.ERRORS.EMAIL_MUST_BE_VALID">forwardOffline must be a valid e-mail address</span>\n                            </div>\n                          </div>\n                        </md-input-container>\n\n                        <md-input-container class="md-block">\n                          <md-switch ng-model="vm_fonc.chatWebsite.openNewInteraction" aria-label="openNewInteraction">\n                            <span translate="CHAT.OPEN_NEW_INTERACTION">openNewInteraction</span>\n                          </md-switch>\n                        </md-input-container>\n\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.openNewInteraction">\n                          <label translate="CHAT.EMAIL_ACCOUNT">Email account</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.MailAccountId" required>\n                            <md-option ng-repeat="account in vm_fonc.email_accounts" ng-value="account.id">{{ account.name }}</md-option>\n                          </md-select>\n                          <div ng-messages="offlineForm[\'MailAccountId\'].$error" ng-show="offlineForm[\'MailAccountId\'].$touched" role="alert">\n                            <div ng-message="required">\n                              <span translate="CHAT.ERRORS.EMAIL_ACCOUNT_REQUIRED">Email account field is required</span>\n                            </div>\n                          </div>\n                        </md-input-container>\n\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.openNewInteraction && vm_fonc.chatWebsite.offlineForm.items.length">\n                          <label translate="CHAT.SUBJECT">Subject</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.subjectOffline" md-selected-text="vm_fonc.chatWebsite.subjectOffline != null ? vm_fonc.chatWebsite.subjectOffline : \'None\'">\n                            <md-option ng-value="null">None</md-option>\n                            <md-option ng-repeat="item in vm_fonc.chatWebsite.offlineForm.items" ng-if="item.props.title" ng-value="item.props.title">{{ item.props.title }}</md-option>\n                          </md-select>\n                        </md-input-container>\n\n                        \x3c!-- START MapKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.offlineForm.items.length">\n                          <label translate="CHAT.HELP.MAPKEY">MapKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.mapKeyOffline">\n                            <md-option ng-value="null">None</md-option>\n\n                            <md-optgroup label="standard">\n                              <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n\n                            <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                              <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END MapKey --\x3e\n\n                        \x3c!-- START FromKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.offlineForm.items.length">\n                          <label translate="CHAT.HELP.FROMKEY">FromKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.offlineForm.fromKey" md-selected-text="vm_fonc.chatWebsite.offlineForm.fromKey != null ? vm_fonc.chatWebsite.offlineForm.items[vm_fonc.chatWebsite.offlineForm.fromKey].props.title : \'None\'">\n                            <md-option ng-value="null">None</md-option>\n                            <md-option ng-repeat="item in vm_fonc.chatWebsite.offlineForm.items" ng-if="item.props.title" ng-value="$index">{{ item.props.title }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END FromKey --\x3e\n\n                        \x3c!-- START EXPANSION PANELS --\x3e\n                        <md-expansion-panel ng-repeat="item in vm_fonc.chatWebsite.offlineForm.items track by $index" md-component-id="{{\'offlinePanel\' + $index}}">\n                          <md-expansion-panel-collapsed md-no-sticky="true">\n                            <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                            </md-button>\n                            <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                            </md-button>\n\n                            <div class="md-title">{{item.props.title || item.type}}</div>\n\n                            <div flex></div>\n                            <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                              <md-icon md-font-icon="icon-chevron-down"></md-icon>\n                            </md-button>\n                          </md-expansion-panel-collapsed>\n\n                          <md-expansion-panel-expanded>\n                            <md-expansion-panel-header>\n                              <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                              </md-button>\n\n                              <div class="md-title">{{item.props.title || item.type}}</div>\n\n                              <div flex></div>\n\n                              <md-button class="md-icon-button md-warn" aria-label="Remove" ng-click="vm_fonc.remove($index)">\n                                <md-icon md-font-icon="icon-delete"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                                <md-icon md-font-icon="icon-chevron-up"></md-icon>\n                              </md-button>\n                            </md-expansion-panel-header>\n\n                            <md-expansion-panel-content>\n                              <form-item type="{{item.type}}" item="item" index="$index"></form-item>\n\n\n                              <md-input-container class="md-block" ng-if="item.type != \'upload\'">\n                                <label translate="CHAT.CM_FIELD">Contact Manager Field</label>\n                                <md-select ng-model="item.cmField">\n                                  <md-option ng-value="null">None</md-option>\n\n                                  <md-optgroup label="standard">\n                                    <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n\n                                  <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                                    <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n                                </md-select>\n                              </md-input-container>\n                            </md-expansion-panel-content>\n\n                          </md-expansion-panel-expanded>\n                        </md-expansion-panel>\n                        \x3c!-- END EXPANSION PANELS --\x3e\n                      </form>\n                    </md-card-content>\n                  </md-card>\n                </div>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.PREVIEW">PREVIEW</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content flex>\n                      <form-view form="vm_fonc.chatWebsite.offlineForm" flex="100"></form-view>\n                    </md-card-content>\n                  </md-card>\n                </div>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.PROACTIVEACTIONS">PROACTIVEACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container proactive md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteProactiveActionsController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteProactiveActions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.PROACTIVEACTIONS">ProactiveActions</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteProactiveActions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event)" aria-label="add chatProactiveAction" translate translate-attr-label="CHAT.ADD_CHATPROACTIVEACTION">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteProactiveActions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteProactiveActions.length}} {{vm_dc.selectedChatWebsiteProactiveActions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteProactiveActions" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteProactiveActions($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteProactiveActions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteProactiveActions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="name">\n                        {{ \'CHAT.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="type">\n                        {{ \'CHAT.TYPE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="selector">\n                        {{ \'CHAT.SELECTOR\' | translate }}\n                      </th>\n                      <th md-column md-order-by="timeout">\n                        {{ \'CHAT.TIMEOUT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="chatProactiveAction" md-select-id="id" ng-repeat="chatProactiveAction in vm_dc.chatWebsiteProactiveActions.rows">\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.name}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{ \'CHAT.\' + vm_dc.arraytype[chatProactiveAction.type].option | uppercase | translate }}\n                      </td>\n\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.selector}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.timeout}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{ chatProactiveAction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" translate="CHAT.EDIT_CHATPROACTIVEACTION">\n                                Edit ChatProactiveAction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(chatProactiveAction, $event)" translate="CHAT.DELETE_CHATPROACTIVEACTION">\n                                Delete ChatProactiveAction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteProactiveActions.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_CHATPROACTIVEACTION_AVAILABLE">No chatproactiveaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteProactiveActions.count}}" md-on-paginate="vm_dc.getChatWebsiteProactiveActions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="ChatWebsiteDispositionsController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="chatWebsite-detail-form-container chatdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="CHAT.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add chat dispositions" translate translate-attr-label="CHAT.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="chatWebsites.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'CHAT.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'CHAT.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container chatcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteChatCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteChatCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.CHATCANNEDANSWERS">ChatCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteChatCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event)" aria-label="add chatCannedAnswer" translate translate-attr-label="CHAT.ADD_CHATCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteChatCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteChatCannedAnswers.length}} {{vm_dc.selectedChatWebsiteChatCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteChatCannedAnswers" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteChatCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteChatCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteChatCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'CHAT.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'CHAT.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'CHAT.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="chatCannedAnswer" md-select-id="id" ng-repeat="chatCannedAnswer in vm_dc.chatWebsiteChatCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{ chatCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" translate="CHAT.EDIT_CHATCANNEDANSWER">\n                                Edit ChatCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(chatCannedAnswer, $event)" translate="CHAT.DELETE_CHATCANNEDANSWER">\n                                Delete ChatCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteChatCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_CHATCANNEDANSWER_AVAILABLE">No chatcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteChatCannedAnswers.count}}" md-on-paginate="vm_dc.getChatWebsiteChatCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.VIDEO">VIDEO</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container vidaoo md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.VIDAOO">VIDAOO</div>\n            </div>\n            <form name="vidaooForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.vidaooEscalation" aria-label="vidaooEscalation" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.VIDAOOESCALATION">vidaooEscalation</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOOAPIKEY">vidaooApiKey</label>\n                <input type="text" name="vidaooApiKey" ng-model="vm.chatWebsite.vidaooApiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="vidaooForm[\'vidaooApiKey\'].$error" ng-show="vidaooForm[\'vidaooApiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VIDAOOAPIKEY_REQUIRED">vidaooApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOOTOPIC">vidaooTopic</label>\n                <input type="text" name="vidaooTopic" ng-model="vm.chatWebsite.vidaooTopic" value="Generated by XCALLY Motion" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="vidaooForm[\'vidaooTopic\'].$error" ng-show="vidaooForm[\'vidaooTopic\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VIDAOOTOPIC_REQUIRED">vidaooTopic field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOONOTE">vidaooNote</label>\n                <input type="text" name="vidaooNote" ng-model="vm.chatWebsite.vidaooNote" value="Meeting generated for interaction #{{interaction.id}} by {{agent.name}}" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="vidaooForm[\'vidaooNote\'].$error" ng-show="vidaooForm[\'vidaooNote\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VIDAOONOTE_REQUIRED">vidaooNote field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOOMETADATA">vidaooMetadata</label>\n                <textarea name="vidaooMetadata" ng-model="vm.chatWebsite.vidaooMetadata"></textarea>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteActionsController as vm_ac" ng-init="vm_ac.init(vm.chatWebsite, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="CHAT.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedChatWebsiteApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedChatWebsiteApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedChatWebsiteApps.length}} {{vm_ac.selectedChatWebsiteApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedChatWebsiteApps($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedChatWebsiteApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.chatWebsiteApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editChatWebsiteApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editChatWebsiteApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editChatWebsiteApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editChatWebsiteApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.chatWebsiteApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteInteractionsController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getChatWebsiteInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getChatWebsiteInteractions()" aria-label="refresh Interactions" translate translate-attr-label="CHAT.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteInteractions.length}} {{vm_dc.selectedChatWebsiteInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteInteractions" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteInteractions($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'CHAT.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'CHAT.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'CHAT.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'CHAT.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'CHAT.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.chatWebsiteInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'CHAT.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'CHAT.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spychatInteraction($event, interaction)" translate="CHAT.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || (vm_dc.userProfile.downloadOmnichannelInteractions && vm_dc.userProfile.downloadAttachments)">\n                              <md-button class="md-primary" ng-click="vm_dc.chatInteractionDownload(interaction, $event, true)" translate="CHAT.DOWNLOAD_WITH_ATTACHMENTS">\n                                Download with attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.chatInteractionDownload(interaction, $event)" translate="CHAT.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                                Download without attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="CHAT.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteInteractions.count}}" md-on-paginate="vm_dc.getChatWebsiteInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.OFFLINEMESSAGES">OFFLINEMESSAGES</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container offlinemessages md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteOfflineMessagesController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteOfflineMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.OFFLINEMESSAGES">OfflineMessages</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteOfflineMessages()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteOfflineMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteOfflineMessages.length}} {{vm_dc.selectedChatWebsiteOfflineMessages.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteOfflineMessages" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteOfflineMessages($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteOfflineMessages" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteOfflineMessages">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column>\n                        {{ \'CHAT.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="offlineMessage" md-select-id="id" ng-repeat="offlineMessage in vm_dc.chatWebsiteOfflineMessages.rows">\n                      <td md-cell>\n                        {{offlineMessage.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="offlineMessage.Attachments.length > 0">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{offlineMessage.Contact.firstName}}\n                      </td>\n                      <td md-cell>\n                        {{ offlineMessage.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.showOfflineMessageChatWebsiteOfflineMessage($event, offlineMessage)" translate="CHAT.SHOW_OFFLINEMESSAGE">\n                                SHOW OfflineMessage\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(offlineMessage, $event)" translate="CHAT.DELETE_OFFLINEMESSAGE">\n                                Delete OfflineMessage\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteOfflineMessages.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_OFFLINEMESSAGE_AVAILABLE">No offlinemessage available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteOfflineMessages.count}}" md-on-paginate="vm_dc.getChatWebsiteOfflineMessages" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/chat/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="CHAT.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n        <th md-column>{{ \'CHAT.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'CHAT.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'CHAT.WAITING\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedIn }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="CHAT.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="CHAT.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/chat/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/companies/companies.html",'<div id="companies" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-circle" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.COMPANIES">Companies</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedCompanies.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedCompanies =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-companies-count">\n          <span>{{vm.selectedCompanies.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTMANAGER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllCompanies()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectCompanies()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedCompanies" csv-label="true" filename="companies.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedCompanies($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- COMPANY TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedCompanies" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCompanies">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CONTACTMANAGER.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CONTACTMANAGER.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.companies.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="company" md-select-id="id" ng-repeat="company in vm.companies.rows">\n                <td md-cell ng-if="company.userpic"><img class="avatar" alt="{{company.name}}" ng-src="api/users/{{company.id}}/avatar" /></td>\n                <td md-cell ng-if="!company.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{company.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(company, ev) : vm.createOrEditCompany($event, company)" md-cell class="id ">{{company.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(company, ev) : vm.createOrEditCompany($event, company)" md-cell class="name ">{{company.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(company, ev) : vm.createOrEditCompany($event, company)" md-cell class="description ">{{company.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(company, $event    )" translate="CONTACTMANAGER.EDIT_COMPANY">\n                          Edit Company\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotocontactsgoto(company, $event    )" translate="CONTACTMANAGER.GOTOCONTACTS_COMPANY">\n                          goToContacts Company\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(company, $event    )" translate="CONTACTMANAGER.DELETE_COMPANY">\n                          Delete Company\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.companies.count}}" md-on-paginate="vm.getCompanies" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / COMPANY TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD COMPANY BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-company-button" ng-click="vm.createOrEditCompany($event)" aria-label="add company" translate translate-attr-aria-label="CONTACTMANAGER.ADD_COMPANY">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD COMPANY BUTTON --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/companies/create/dialog.html",'<md-dialog class="company-dialog" aria-label="New Company">\n  <form name="companyForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.company.name" ng-required="true" autofocus>\n\n        <div ng-messages="companyForm[\'name\'].$error" ng-show="companyForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.PHONE">Phone</label>\n        <input type="text" name="phone" ng-model="vm.company.phone">\n\n        <div ng-messages="companyForm[\'phone\'].$error" ng-show="companyForm[\'phone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.VAT">Vat</label>\n        <input type="text" name="vat" ng-model="vm.company.vat">\n\n        <div ng-messages="companyForm[\'vat\'].$error" ng-show="companyForm[\'vat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.VAT_REQUIRED">Vat field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.FAX">Fax</label>\n        <input type="text" name="fax" ng-model="vm.company.fax">\n\n        <div ng-messages="companyForm[\'fax\'].$error" ng-show="companyForm[\'fax\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.FAX_REQUIRED">Fax field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.COMPANYID">CompanyId</label>\n        <input type="text" name="companyId" ng-model="vm.company.companyId">\n\n        <div ng-messages="companyForm[\'companyId\'].$error" ng-show="companyForm[\'companyId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.COMPANYID_REQUIRED">CompanyId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.TYPE">Type</label>\n        <input type="text" name="type" ng-model="vm.company.type">\n\n        <div ng-messages="companyForm[\'type\'].$error" ng-show="companyForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.WEBSITE">Website</label>\n        <input type="text" name="website" ng-model="vm.company.website" md-maxlength="255">\n\n        <div ng-messages="companyForm[\'website\'].$error" ng-show="companyForm[\'website\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.WEBSITE_REQUIRED">Website field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CONTACTMANAGER.ERRORS.WEBSITE_MAX_LENGTH" translate-values=\'{max: 255}\'>Website must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.EMAIL_DOMAIN">Email_Domain</label>\n        <input type="text" name="emailDomain" ng-model="vm.company.emailDomain">\n\n        <div ng-messages="companyForm[\'emailDomain\'].$error" ng-show="companyForm[\'emailDomain\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.EMAIL_DOMAIN_REQUIRED">Email_Domain field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.company.email">\n\n        <div ng-messages="companyForm[\'email\'].$error" ng-show="companyForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="CONTACTMANAGER.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.company.description">\n\n        <div ng-messages="companyForm[\'description\'].$error" ng-show="companyForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCompany" ng-click="vm.saveCompany()" class="send-button md-accent md-raised" ng-disabled="companyForm.$invalid || companyForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCompany" ng-click="vm.addNewCompany()" class="send-button md-accent md-raised" ng-disabled="companyForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_COMPANY" translate-attr-aria-label="CONTACTMANAGER.ADD_COMPANY">\n          ADD COMPANY\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCompany" ng-click="vm.deleteCompany($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/companies/edit/view.html",'<div id="contactmanager-company" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-companies-button md-icon-button" aria-label="Go to companies" ng-click="vm.gotoCompanies()" translate translate-attr-aria-label="CONTACTMANAGER.GO_TO_COMPANIES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="company-image" hide-xs>\n          <img ng-src="assets/images/business/companies.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.company.id}}\n            <span ng-if="vm.company.name">{{vm.company.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CONTACTMANAGER.CREATED_AT"></span> <span>{{vm.company.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.company, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="CONTACTMANAGER.GOTO_COMPANY"></span></md-tooltip>\n        <md-icon md-font-icon="icon-forward"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveCompany()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (addressForm.$invalid) || (shipmentAddressForm.$invalid)" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.GENERAL">GENERAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="company-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.company.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.company.phone" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'phone\'].$error" ng-show="generalForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.VAT">Vat</label>\n                <input type="text" name="vat" ng-model="vm.company.vat" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'vat\'].$error" ng-show="generalForm[\'vat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.VAT_REQUIRED">Vat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.FAX">Fax</label>\n                <input type="text" name="fax" ng-model="vm.company.fax" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'fax\'].$error" ng-show="generalForm[\'fax\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.FAX_REQUIRED">Fax field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.COMPANYID">CompanyId</label>\n                <input type="text" name="companyId" ng-model="vm.company.companyId" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'companyId\'].$error" ng-show="generalForm[\'companyId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.COMPANYID_REQUIRED">CompanyId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.TYPE">Type</label>\n                <input type="text" name="type" ng-model="vm.company.type" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.WEBSITE">Website</label>\n                <input type="text" name="website" ng-model="vm.company.website" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'website\'].$error" ng-show="generalForm[\'website\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.WEBSITE_REQUIRED">Website field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CONTACTMANAGER.ERRORS.WEBSITE_MAX_LENGTH" translate-values=\'{max: 255}\'>Website must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.EMAIL_DOMAIN">Email_Domain</label>\n                <input type="text" name="emailDomain" ng-model="vm.company.emailDomain" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'emailDomain\'].$error" ng-show="generalForm[\'emailDomain\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.EMAIL_DOMAIN_REQUIRED">Email_Domain field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.company.email" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="CONTACTMANAGER.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.company.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.ADDRESS">ADDRESS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="company-detail-form-container address md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.ADDRESS">ADDRESS</div>\n            </div>\n            <form name="addressForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.STREET">Street</label>\n                <input type="text" name="street" ng-model="vm.company.street" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'street\'].$error" ng-show="addressForm[\'street\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.STREET_REQUIRED">Street field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.POSTAL_CODE">Postal_Code</label>\n                <input type="text" name="postalCode" ng-model="vm.company.postalCode" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'postalCode\'].$error" ng-show="addressForm[\'postalCode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.POSTAL_CODE_REQUIRED">Postal_Code field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.CITY">City</label>\n                <input type="text" name="city" ng-model="vm.company.city" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'city\'].$error" ng-show="addressForm[\'city\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.CITY_REQUIRED">City field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n                <input type="text" name="country" ng-model="vm.company.country" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'country\'].$error" ng-show="addressForm[\'country\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.COUNTRY_REQUIRED">Country field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.SHIPMENTADDRESS">SHIPMENTADDRESS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="company-detail-form-container shipmentaddress md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.SHIPMENTADDRESS">SHIPMENTADDRESS</div>\n            </div>\n            <form name="shipmentAddressForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.STREET">Street</label>\n                <input type="text" name="sStreet" ng-model="vm.company.sStreet" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sStreet\'].$error" ng-show="shipmentAddressForm[\'sStreet\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.STREET_REQUIRED">Street field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.POSTAL_CODE">Postal_Code</label>\n                <input type="text" name="sPostalCode" ng-model="vm.company.sPostalCode" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sPostalCode\'].$error" ng-show="shipmentAddressForm[\'sPostalCode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.POSTAL_CODE_REQUIRED">Postal_Code field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.CITY">City</label>\n                <input type="text" name="sCity" ng-model="vm.company.sCity" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sCity\'].$error" ng-show="shipmentAddressForm[\'sCity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.CITY_REQUIRED">City field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n                <input type="text" name="sCountry" ng-model="vm.company.sCountry" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sCountry\'].$error" ng-show="shipmentAddressForm[\'sCountry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.COUNTRY_REQUIRED">Country field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/contactmanager/views/contacts/contacts.html",'<div id="contacts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.CONTACTS">Contacts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    \x3c!-- SEARCH --\x3e\n    <div class="search-input-wrapper" layout="row" layout-align="start center">\n      <label for="search">\n        <md-icon md-font-icon="icon-magnify"></md-icon>\n      </label>\n      <md-input-container md-no-float class="m-0">\n        <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n      </md-input-container>\n    </div>\n    \x3c!-- / SEARCH --\x3e\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedContacts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedContacts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-contacts-count">\n          <span>{{vm.selectedContacts.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllContacts()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectContacts()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedContacts" csv-label="true" filename="contacts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedContacts($event)" aria-label="delete selected" translate translate-attr-label="CONTACTS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      <div layout="row">\n        <div class="column" flex="20">\n          <md-card>\n            <md-card-content>\n              <button layout-align="center center" md-mini-fab ng-click="vm.selectedList = null; vm.selectedCompany = null; vm.selectedTags = []">\n                <md-icon md-font-icon="icon-refresh"></md-icon>{{ \'CONTACTMANAGER.ALL_CONTACTS\' | translate }}\n              </button>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="CONTACTMANAGER.SELECT_LIST">Select a list</label>\n                <md-select placeholder="Select a list" ng-model="vm.selectedList" ng-disabled="vm.lists.count === 0">\n                  <md-option ng-value="null"><em translate="CONTACTMANAGER.ALL">All</em></md-option>\n                  <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="CONTACTMANAGER.SELECT_COMPANY">Select a company</label>\n                <md-select placeholder="Select a company" flex="100" ng-model="vm.selectedCompany" ng-disabled="vm.companies.count === 0">\n                  <md-option ng-value="null"><em translate="CONTACTMANAGER.ALL">All</em></md-option>\n                  <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="CONTACTMANAGER.SELECT_TAGS">Select one or more tags</label>\n                <md-select multiple placeholder="Select one or more tags" flex="100" ng-model="vm.query.tag" ng-change="vm.getContacts()">\n                  <md-option ng-value="tag.id" ng-repeat="tag in vm.tags.rows">{{tag.name}}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n        </div>\n\n        \x3c!-- USER TABLE --\x3e\n        <md-card flex="80">\n          <md-table-container ng-init="vm.getAssignedCompanies()">\n            <table md-table md-row-select multiple ng-model="vm.selectedContacts" md-progress="vm.promise">\n              <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContacts">\n                <tr md-row>\n                  <th md-column md-order-by="id">ID</th>\n                  <th md-column md-order-by="firstName">{{\'CONTACTMANAGER.FULLNAME\' | translate}}</th>\n                  <th md-column md-order-by="phone">{{\'CONTACTMANAGER.PHONE\' | translate}}</th>\n                  <th md-column md-order-by="email">{{\'CONTACTMANAGER.EMAIL\' | translate}}</th>\n                  <th md-column md-order-by="createdAt">{{\'CONTACTMANAGER.CREATED_AT\' | translate}}</th>\n                  <th md-column md-order-by="ListId">{{\'CONTACTMANAGER.LIST\' | translate}}</th>\n                  <th md-column md-order-by="CompanyId">{{\'CONTACTMANAGER.COMPANY\' | translate}}</th>\n                  <th md-column md-order-by="tags">{{\'CONTACTMANAGER.TAGS\' | translate}}</th>\n                  <th md-column width="10px"></th>\n                </tr>\n              </thead>\n              <tbody md-body>\n                <tr md-row ng-hide="vm.contacts.rows.length">\n                  <td md-cell colspan="8">\n                    <div layout="row" layout-align="center center">\n                      <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                  </td>\n                </tr>\n                <tr md-row md-select="contact" md-select-id="id" ng-repeat="contact in vm.contacts.rows">\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="id">{{contact.id}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="firstName" privacy ng-cloak>{{contact.firstName}} {{contact.lastName}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="phone" privacy ng-cloak>{{contact.phone}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="email" privacy ng-cloak>{{contact.email}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="createdAt">{{contact.createdAt | date:\'medium\'}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="list">{{vm.listsMap[contact.ListId]}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="company">{{vm.companiesMap[contact.CompanyId]}}</td>\n                  <td md-cell class="tag">\n                    <div ng-if="contact.Tags.length">\n                      <div ng-if="contact.Tags.length == 1" layout="column" layout-align="center center">\n                        <md-icon md-font-icon="icon-tag" ng-style="{\'color\': contact.Tags[0].color }"></md-icon>\n                        <span class="text-truncate">{{contact.Tags[0].name}}</span>\n                      </div>\n                      <div ng-if="contact.Tags.length > 1" layout="column" layout-align="center center">\n                        <md-tooltip md-direction="left" layout="row">\n                          <span ng-repeat="tag in contact.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                        </md-tooltip>\n                        <md-icon md-font-icon="icon-tag"></md-icon>\n                      </div>\n                    </div>\n                  </td>\n                  <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.editdialog(contact, ev)" translate="CONTACTMANAGER.EDIT_CONTACT">\n                            Edit Contact\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.mergeContact(ev, contact)" translate="CONTACTMANAGER.MERGE_CONTACT">\n                            Merge Contact\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.duplicateContact(ev, contact)" translate="CONTACTMANAGER.DUPLICATE_CONTACT">\n                            Duplicate Contact\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-divider ng-if="vm.crudPermissions.canEdit && vm.crudPermissions.canDelete">\n                        </md-menu-divider>\n                        <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                          <md-button ng-click="vm.deleteconfirm(contact, ev)" translate="CONTACTMANAGER.DELETE_CONTACT">\n                            Delete Contact\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n\n          <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contacts.count}}" md-on-paginate="vm.getContacts" md-page-select></md-table-pagination>\n        </md-card>\n        \x3c!-- / USER TABLE --\x3e\n      </div>\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD USER BUTTON --\x3e\n  <md-fab-speed-dial id="add-contact-button" ng-if="vm.crudPermissions.canEdit" ng-hide="vm.options.hidden" md-direction="up" md-open="vm.options.isOpen" class="md-scale md-fab" ng-class="{ \'md-hover-full\': vm.options.hover }" ng-mouseenter="vm.options.isOpen=true" ng-mouseleave="vm.options.isOpen=false">\n    <md-fab-trigger>\n      <md-button aria-label="menu" class="md-fab md-accent">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n      </md-button>\n    </md-fab-trigger>\n    <md-fab-actions>\n      <md-button class="md-fab md-mini md-primary" flow-btn flow-init="vm.ngFlowOptions" flow-files-submitted="$flow.upload()" flow-file-success="vm.importContactsUpdates($file, $message, $flow)" flow-file-added="vm.fileAdded($file)" aria-label="Select File" translate translate-attr-aria-label="CONTACTMANAGER.UPDATES_EXISTING_CONTACTS">\n        <md-tooltip md-direction="left" md-visible="tooltipVisible" md-autohide="false">\n          {{\'CONTACTMANAGER.UPDATE_EXISTING_CONTACTS\' | translate}}\n        </md-tooltip>\n        <md-icon md-font-icon="icon-upload"></md-icon>\n      </md-button>\n      <md-button class="md-fab md-mini md-warn" flow-btn flow-init="vm.ngFlowOptions" flow-files-submitted="$flow.upload()" flow-file-success="vm.importContacts($file, $message, $flow)" flow-file-added="vm.fileAdded($file)" aria-label="Select File" translate translate-attr-aria-label="CONTACTMANAGER.IMPORT_CONTACTS">\n        <md-tooltip md-direction="left" md-visible="tooltipVisible" md-autohide="false">\n          {{\'CONTACTMANAGER.IMPORT_CONTACTS\' | translate}}\n        </md-tooltip>\n        <md-icon md-font-icon="icon-upload"></md-icon>\n      </md-button>\n      <md-button class="md-fab md-mini md-accent" ng-click="vm.createOrEditContact($event)" aria-label="add contact" translate translate-attr-aria-label="CONTACTMANAGER.ADD_CONTACT">\n        <md-tooltip md-direction="left" md-visible="tooltipVisible" md-autohide="false">\n          {{\'CONTACTMANAGER.ADD_CONTACT\' | translate}}\n        </md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </md-fab-actions>\n  </md-fab-speed-dial>\n  \x3c!-- / ADD USER BUTTON --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/contacts/create/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="New Contact">\n  <form name="contactForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.FIRSTNAME">First name</label>\n        <input name="firstName" ng-model="vm.contact.firstName" required md-autofocus privacy="!vm.crudPermissions.canEdit" ng-cloak>\n\n        <div ng-messages="contactForm.firstName.$error" ng-show="contactForm.firstName.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.FIRSTNAME_REQUIRED">First name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.LASTNAME">Last name</label>\n        <input name="lastName" ng-model="vm.contact.lastName" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.PHONE">Phone</label>\n        <input name="phone" ng-model="vm.contact.phone" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.EMAIL">Email</label>\n        <input name="email" type="email" ng-model="vm.contact.email" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.MOBILE">Mobile</label>\n        <input name="mobile" ng-model="vm.contact.mobile" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.FAX">Fax</label>\n        <input name="fax" ng-model="vm.contact.fax" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.LIST">List</label>\n        <md-select name="list" ng-model="vm.contact.ListId" ng-disabled="vm.contact.id && vm.contact.ListId" ng-change="vm.getCustomFields(vm.contact.ListId)" required>\n          <md-optgroup label="Lists">\n            <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n            <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="contactForm.list.$error" ng-show="contactForm.list.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block" flex-gt-sm="">\n        <md-chips ng-model="vm.additionalItems" md-transform-chip="vm.newPhone($chip)" placeholder="Phone numbers">\n          <md-chip-template custom-chip alt="{{$chip.type}}" title="{{$chip.type}}">\n            {{ $chip.phone }}\n          </md-chip-template>\n        </md-chips>\n      </md-input-container>\n      <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="100">\n        <div class="pb-16" layout="column" layout-align="start center">\n          <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n        </div>\n        <form flex name="additionalPhonesForm" novalidate>\n          <div ng-repeat="additionalPhone in vm.additionalItems">\n            <div layout="row" flex="1">\n              <md-input-container class="md-block" flex="50">\n                <label>{{$index}} - {{additionalPhone.phone}}</label>\n                <md-select ng-model="vm.additionalItemTypes[$index]" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-repeat="value in vm.contactItemTypes" ng-value="value.id">{{value.name}}</md-option>\n                  <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                </md-select>\n              </md-input-container>\n              <md-input-container class="md-block" flex="50">\n                <input ng-model="additionalPhone.description" ng-cloak>\n              </md-input-container>\n            </div>\n          </div>\n        </form>\n      </div>\n\n      <md-input-container>\n        <label translate="CONTACTMANAGER.TIMEZONE">Timezone</label>\n        <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone"></ms-timezone>\n      </md-input-container>\n\n      <div ng-repeat="customField in vm.customFields.rows" class="md-block" ng-switch="customField.type">\n        <div ng-switch-when="datetime">\n          <label>{{customField.alias}}</label>\n          <div>\n            \x3c!-- ng-model="customField.value" --\x3e\n            <mdp-date-picker mdp-open-on-click ng-required="customField.required" mdp-format="YYYY-MM-DD" ng-model="vm.contact[\'cf_\' + customField.id]"></mdp-date-picker>\n            <mdp-time-picker mdp-open-on-click mdp-placeholder="Time" ng-required="customField.required" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.contact[\'cf_\' + customField.id]">\n            </mdp-time-picker>\n          </div>\n        </div>\n\n        <div ng-switch-when="select">\n          <label>{{customField.alias}}</label>\n          <md-select ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n            <md-option ng-repeat="value in customField.values" ng-value="value.value">{{value.value}}</md-option>\n            <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n          </md-select>\n        </div>\n\n        <div ng-switch-when="switch">\n          <md-switch aria-label="{{customField.alias}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-true-value="1" ng-false-value="0">\n            {{customField.alias}}\n          </md-switch>\n        </div>\n\n        <md-input-container ng-switch-default>\n          <label>{{customField.alias}}</label>\n          <input type="{{customField.type}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n        </md-input-container>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.COMPANY">Company</label>\n        <md-select name="company" ng-model="vm.contact.CompanyId">\n          <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows" ng-hide="!vm.contact.CompanyId && company.canSelect === false" ng-disabled="company.canSelect === false">\n            {{company.name}}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <div ng-if="!vm.allFields" layout="row" layout-align="center center">\n        <md-button class="md-accent" ng-click="vm.allFields = true" translate="CONTACTMANAGER.SHOW_ALL_FIELDS">Show All\n          Fields</md-button>\n      </div>\n\n      <md-input-container class="md-block" ng-if="vm.allFields" flex-gt-sm="" ng-init="vm.contact.dateOfBirth = vm.getDateFromString(vm.contact.dateOfBirth)">\n        <label translate="CONTACTMANAGER.DATE_OF_BIRTH">Date of Birth</label>\n        <mdp-date-picker mdp-open-on-click mdp-format="YYYY-MM-DD" name="dateOfBirth" ng-model="vm.contact.dateOfBirth">\n        </mdp-date-picker>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n        <input type="text" name="country" ng-model="vm.contact.country">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.CITY">City</label>\n        <input type="text" name="city" ng-model="vm.contact.city">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.STREET">Street</label>\n        <input type="text" name="street" ng-model="vm.contact.street">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.POSTAL_CODE">Postal Code</label>\n        <input type="text" name="postalCode" ng-model="vm.contact.postalCode">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.NOTES">Notes</label>\n        <input type="text" name="description" ng-model="vm.contact.description">\n      </md-input-container>\n\n      <div ng-if="vm.allFields" layout="row" layout-align="center center">\n        <md-button class="md-accent" ng-click="vm.allFields = false" translate="CONTACTMANAGER.FEWER_FIELDS">Fewer\n          Fields</md-button>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newContact" ng-click="vm.saveContact()" class="send-button md-accent md-raised" ng-disabled="contactForm.$invalid || contactForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newContact" ng-click="vm.addNewContact()" class="send-button md-accent md-raised" ng-disabled="contactForm.$invalid || contactForm.$pristine" aria-label="ADD" translate="CONTACTMANAGER.ADD_CONTACT" translate-attr-aria-label="CONTACTMANAGER.ADD_CONTACT">\n          ADD CONTACT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newContact" ng-click="vm.deleteContact($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="{{ \'CONTACTMANAGER.DUPLICATE_CONTACT\' | translate }}">\n  <form name="contactForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.LIST">List</label>\n        <md-select name="list" ng-model="vm.contact.ListId">\n          <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n        </md-select>\n\n        <div ng-messages="contactForm.list.$error" ng-show="contactForm.list.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.addNewContact()" class="send-button md-accent md-raised" ng-disabled="contactForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_CONTACT" translate-attr-aria-label="CONTACTMANAGER.ADD_CONTACT">\n          ADD CONTACT\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/edit/hoppers/dialog.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div flex class="md-block">\n        <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n          <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="CONTACTMANAGER.ERRORS.DATE_REQUIRED">Date is required</span>\n            </div>\n            <div ng-message="format">\n              <span translate="CONTACTMANAGER.ERRORS.DATE_INVALID">Date is invalid</span>\n            </div>\n          </div>\n        </mdp-date-picker>\n      </div>\n\n      <div flex class="md-block">\n        <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n          <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="CONTACTMANAGER.ERRORS.TIME_REQUIRED">Time is required</span>\n            </div>\n            <div ng-message="format">\n              <span translate="CONTACTMANAGER.ERRORS.TIME_INVALID">Time is invalid</span>\n            </div>\n          </div>\n        </mdp-time-picker>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_HOPPER" translate-attr-aria-label="CONTACTMANAGER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="!vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/edit/view.html",'<div id="cm-contact" class="page-layout simple tabbed" layout="column" ng-init="vm.onInit()">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-contacts-button md-icon-button" aria-label="Go to contacts" ng-click="vm.gotoContacts()" translate translate-attr-aria-label="CONTACTMANAGER.GO_TO_CONTACTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="contact-image" hide-xs>\n          <img ng-src="assets/images/business/contacts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.contact.id}} {{vm.contact.firstName}} {{vm.contact.lastName}}\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CONTACTMANAGER.CREATED_AT"></span> <span>{{vm.contact.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-if="vm.contact.role && vm.contact.role !== \'admin\'" ng-controller="ContactQueueAddButtonController as vm_contact_qa" ng-cloak>\n      <md-fab-speed-dial ng-hide="vm_contact_qa.hidden" md-direction="left" md-open="vm_contact_qa.isOpen" class="md-scale md-fab" ng-class="{ \'md-hover-full\': vm_contact_qa.hover }" ng-mouseenter="vm_contact_qa.isOpen=true" ng-mouseleave="vm_contact_qa.isOpen=false">\n        <md-fab-trigger>\n          <md-button aria-label="menu" class="md-fab md-primary md-icon-button">\n            <md-tooltip md-direction="top" md-visible="tooltipVisible">Channels</md-tooltip>\n            <md-icon md-font-icon="icon-eye" aria-label="channels"></md-icon>\n          </md-button>\n        </md-fab-trigger>\n        <md-fab-actions>\n          <div ng-repeat="channel in vm_contact_qa.channels">\n            <md-button aria-label="{{channel.name}}" class="md-fab md-raised md-icon-button md-mini" ng-click="vm_contact_qa.openDialog($event, vm.contact, channel)">\n              <md-tooltip md-direction="{{channel.direction}}" md-visible="tooltipVisible" md-autohide="false">\n                {{channel.name}}\n              </md-tooltip>\n              <md-icon md-font-icon="{{channel.icon}}" aria-label="{{channel.name}}"></md-icon>\n            </md-button>\n          </div>\n        </md-fab-actions>\n      </md-fab-speed-dial>\n    </div>\n\n    <div ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.duplicateContact($event)" class="md-fab md-warn md-icon-button" aria-label="DUPLICATE">\n        <md-icon md-font-icon="icon-file-multiple"></md-icon>\n      </md-button>\n      <md-button type="submit" ng-click="vm.saveContact()" class="send-button md-accent md-raised" ng-disabled="detailForm.$pristine && customFieldsForm.$pristine && socialForm.$pristine && additionalPhonesForm.$pristine" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.DETAIL">DETAIL</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div layout="row">\n            <div layout="column" flex="70">\n              <md-card class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n                <div class="pb-16" layout="row" layout-align="start center">\n                  <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.PERSONAL_INFO">PERSONAL_INFO\n                  </div>\n                </div>\n                <form name="detailForm" novalidate>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    \x3c!-- fistName --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.FIRSTNAME">First Name</label>\n                      <md-icon md-font-icon="icon-account" class="firstname"></md-icon>\n                      <input type="text" name="firstName" ng-model="vm.contact.firstName" class="text-truncate" required ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                      <div ng-messages="detailForm.firstName.$error" ng-show="detailForm.firstName.$touched" role="alert">\n                        <div ng-message="required">\n                          <span translate="CONTACTMANAGER.ERRORS.FIRSTNAME_REQUIRED">First name field is required</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div flex="5"></div>\n                    \x3c!-- lastName --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.LASTNAME">Last Name</label>\n                      <input type="text" name="lastName" ng-model="vm.contact.lastName" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    \x3c!-- phone --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.PHONE">Phone</label>\n                      <md-icon md-font-icon="icon-phone"></md-icon>\n                      <input type="text" name="phone" ng-model="vm.contact.phone" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                    <div flex="5"></div>\n                    \x3c!-- mobile --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.MOBILE">Mobile</label>\n                      <md-icon md-font-icon="icon-cellphone-iphone"></md-icon>\n                      <input type="text" name="mobile" ng-model="vm.contact.mobile" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    \x3c!-- email --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.EMAIL">Email</label>\n                      <md-icon md-font-icon="icon-email" class="email"></md-icon>\n                      <input type="email" name="email" ng-model="vm.contact.email" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                      <div ng-messages="detailForm.firstName.$error" ng-show="detailForm.firstName.$touched" role="alert">\n                        <div ng-message="email">\n                          <span translate="CONTACTMANAGER.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail\n                            address</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div flex="5"></div>\n                    \x3c!-- fax --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.FAX">Fax</label>\n                      <md-icon md-font-icon="icon-deskphone"></md-icon>\n                      <input type="text" name="fax" ng-model="vm.contact.fax" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.TIMEZONE">Timezone</label>\n                      <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.ADDITIONAL_PHONES">Additional Phones</label>\n                      <md-chips ng-model="vm.additionalItems" md-transform-chip="vm.newPhone($chip)" placeholder="Phone numbers">\n                        <md-chip-template custom-chip alt="{{$chip.type}}" title="{{$chip.type}}">\n                          {{ $chip.phone }}\n                        </md-chip-template>\n                      </md-chips>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="" ng-init="vm.contact.dateOfBirth = vm.getDateFromString(vm.contact.dateOfBirth)">\n                      <label translate="CONTACTMANAGER.DATE_OF_BIRTH">Date of Birth</label>\n                      <mdp-date-picker mdp-open-on-click mdp-format="YYYY-MM-DD" name="dateOfBirth" ng-model="vm.contact.dateOfBirth" mdp-disabled="!vm.crudPermissions.canEdit"></mdp-date-picker>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container ng-if="vm.companies.rows.length" class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.COMPANY">Company</label>\n                      <md-icon md-font-icon="icon-domain"></md-icon>\n                      <md-select name="company" ng-model="vm.contact.CompanyId" ng-disabled="!vm.crudPermissions.canEdit">\n                        <md-optgroup label="Companies">\n                          <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows" ng-disabled="company.canSelect === false">{{company.name}}</md-option>\n                          <md-option ng-value=" null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                        </md-optgroup>\n                      </md-select>\n                      <md-icon class="pointer" ng-show="vm.contact.CompanyId" md-font-icon="icon-information-outline" ng-click="vm.editCompany($event, vm.contact.CompanyId)"></md-icon>\n                    </md-input-container>\n                    <section ng-if="!vm.companies.rows.length" flex-gt-sm="">\n                      <md-icon md-font-icon="icon-briefcase"></md-icon>\n                      <label translate="CONTACTMANAGER.NO_COMPANIES">No Companies</label>\n                    </section>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container ng-if="vm.tags.rows.length" class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.TAGS">Tags</label>\n                      <md-icon md-font-icon="icon-tag"></md-icon>\n                      <md-select ng-model="vm.Tags" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                        <md-optgroup label="Tags">\n                          <md-option ng-value="tag.id" ng-repeat="tag in vm.tags.rows" ng-disabled="tag.canSelect === false">{{tag.name}}</md-option>\n                        </md-optgroup>\n                      </md-select>\n                    </md-input-container>\n                    <section ng-if="!vm.tags.rows.length" flex-gt-sm="">\n                      <md-icon md-font-icon="icon-tag"></md-icon>\n                      <label translate="CONTACTMANAGER.NO_TAG">No Tags</label>\n                      <md-button class="md-accent" translate="CONTACTMANAGER.ADD_TAG">Add Tag</md-button>\n                    </section>\n                  </div>\n\n                  <div ng-if="!vm.allFields" layout="row" layout-align="center center">\n                    <md-button class="md-accent" ng-click="vm.allFields = true" translate="CONTACTMANAGER.SHOW_ALL_FIELDS">Show All Fields</md-button>\n                  </div>\n\n                  <div ng-if="vm.allFields">\n                    <div layout-gt-sm="row" class="layout-gt-sm-row">\n                      \x3c!-- country --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n                        <md-icon md-font-icon="icon-home" class="country"></md-icon>\n                        <input type="text" name="country" ng-model="vm.contact.country" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                      <div flex="5"></div>\n                      \x3c!-- city --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.CITY">City</label>\n                        <input type="text" name="city" ng-model="vm.contact.city" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                    </div>\n\n                    <div layout-gt-sm="row" class="layout-gt-sm-row">\n                      <div flex="5"></div>\n                      \x3c!-- street --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.STREET">Street</label>\n                        <input type="text" name="street" ng-model="vm.contact.street" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                      <div flex="5"></div>\n                      \x3c!-- postalCode --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.POSTALCODE">Postal Code</label>\n                        <input type="text" name="postalCode" ng-model="vm.contact.postalCode" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                    </div>\n\n                    <div layout-gt-sm="row" class="layout-gt-sm-row">\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate translate-attr-placeholder="CONTACTMANAGER.NOTES">Notes</label>\n                        <md-icon md-font-icon="icon-note"></md-icon>\n                        <textarea ng-model="vm.contact.description" type="text" max-rows="4" ng-disabled="!vm.crudPermissions.canEdit"></textarea>\n                      </md-input-container>\n                    </div>\n\n                    <div layout="row" layout-align="center center">\n                      <md-button class="md-accent" ng-click="vm.allFields = false" translate="CONTACTMANAGER.FEWER_FIELDS">Fewer Fields\n                      </md-button>\n                    </div>\n\n                  </div>\n                </form>\n              </md-card>\n              <md-card class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n                <div class="pb-16" layout="row" layout-align="start center">\n                  <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.SOCIAL">Social</div>\n                </div>\n                <form name="socialForm" novalidate>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Facebook</label>\n                      <md-icon md-font-icon="icon-facebook" class="facebook"></md-icon>\n                      <input type="text" name="facebook" ng-model="vm.contact.facebook" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit">\n                    </md-input-container>\n                    <div flex="5"></div>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Twitter</label>\n                      <md-icon md-font-icon="icon-twitter" class="twitter"></md-icon>\n                      <input type="text" name="twitter" ng-model="vm.contact.twitter" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit">\n                    </md-input-container>\n                  </div>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Line</label>\n                      <md-icon md-font-icon="fab fa-line"></md-icon>\n                      <input type="text" name="line" ng-model="vm.contact.line" class="text-truncate">\n                    </md-input-container>\n                    <div flex="5"></div>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Viber</label>\n                      <md-icon md-font-icon="fab fa-viber"></md-icon>\n                      <input type="text" name="viber" ng-model="vm.contact.viber" class="text-truncate">\n                    </md-input-container>\n                  </div>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>WeChat</label>\n                      <md-icon md-font-icon="fab fa-weixin"></md-icon>\n                      <input type="text" name="wechat" ng-model="vm.contact.wechat" class="text-truncate">\n                    </md-input-container>\n                    <div flex="5"></div>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Telegram</label>\n                      <md-icon md-font-icon="icon-telegram"></md-icon>\n                      <input type="text" name="telegram" ng-model="vm.contact.telegram" class="text-truncate">\n                    </md-input-container>\n                  </div>\n                </form>\n              </md-card>\n            </div>\n\n            <div flex></div>\n\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="25">\n              <div class="pb-16" layout="row" layout-align="start center">\n                <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.CUSTOM_FIELDS">CUSTOM FIELDS\n                </div>\n              </div>\n              <form name="customFieldsForm" novalidate>\n                <md-input-container class="md-block">\n                  <label translate translate-attr-placeholder="CONTACTMANAGER.LIST">List</label>\n                  <md-select name="list" ng-model="vm.contact.ListId" md-on-close="vm.onSelectList($event)" ng-disabled="vm.contact.ListId">\n                    <md-optgroup label="Lists">\n                      <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">#{{list.id}} - {{list.name}}\n                      </md-option>\n                      <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                    </md-optgroup>\n                  </md-select>\n                </md-input-container>\n                <div ng-repeat="customField in vm.customFields.rows" ng-switch="customField.type">\n                  <md-input-container class="md-block" ng-switch-when="datetime">\n                    <label>{{customField.alias}}</label>\n                    <div ng-init="vm.contact[\'cf_\' + customField.id] = vm.getDateFromString(vm.contact[\'cf_\' + customField.id])">\n                      <mdp-date-picker mdp-open-on-click ng-required="customField.required" mdp-format="YYYY-MM-DD" ng-model="vm.contact[\'cf_\' + customField.id]"></mdp-date-picker>\n                      <mdp-time-picker mdp-open-on-click mdp-placeholder="Time" ng-required="customField.required" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.contact[\'cf_\' + customField.id]">\n                      </mdp-time-picker>\n                    </div>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="select">\n                    <label>{{customField.alias}}</label>\n                    <md-select ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required" ng-disabled="!vm.crudPermissions.canEdit">\n                      <md-option ng-repeat="value in customField.values" ng-value="value.value">{{value.value}}\n                      </md-option>\n                      <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                    </md-select>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="switch">\n                    <md-switch aria-label="{{customField.alias}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-true-value="1" ng-false-value="0">\n                      {{customField.alias}}\n                    </md-switch>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-default>\n                    <label>{{customField.alias}}</label>\n                    <input type="{{customField.type}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required" ng-disabled="!vm.crudPermissions.canEdit">\n                  </md-input-container>\n                </div>\n              </form>\n            </div>\n\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="25">\n              <div class="pb-16" layout="row" layout-align="start center">\n                <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n              </div>\n              <form name="additionalPhonesForm" novalidate>\n                <div ng-repeat="additionalPhone in vm.additionalItems">\n                  <div layout="row">\n                    <md-button class="md-icon-button" ng-show="!$first" ng-click="vm.moveUp($index)">\n                      <md-tooltip>{{\'CONTACTMANAGER.MOVE_UP\' | translate}}</md-tooltip>\n                      <md-icon md-font-icon="icon-arrow-up"></md-icon>\n                    </md-button>\n                    <md-button class="md-icon-button md-primary" ng-show="!$last" ng-click="vm.moveDown($index)">\n                      <md-tooltip>{{\'CONTACTMANAGER.MOVE_DOWN\' | translate}}</md-tooltip>\n                      <md-icon md-font-icon="icon-arrow-down"></md-icon>\n                    </md-button>\n                  </div>\n                  <div layout="column" style="margin-bottom:5px;border-bottom: 1px solid gray;">\n                    <md-input-container class="md-block">\n                      <label>{{$index}} - {{additionalPhone.phone}}</label>\n                      <md-select ng-model="additionalPhone.ItemTypeId" ng-disabled="!vm.crudPermissions.canEdit">\n                        <md-option ng-repeat="value in vm.contactItemTypes" ng-value="value.id">{{value.name}}</md-option>\n                        <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                      </md-select>\n                    </md-input-container>\n                    <md-input-container class="md-block">\n                      <input ng-model="additionalPhone.description" ng-cloak>\n                    </md-input-container>\n                  </div>\n                </div>\n              </form>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab ng-if="vm.license.dialer">\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.MOTION_BULL">MOTION BULL</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.HOPPER">Hopper</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryHopper.filter = query;" on-collapse="vm.queryHopper.filter = undefined;" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-click="vm.getHoppers()" aria-label="reload" translate translate-attr-label="CONTACTMANAGER.RELOAD">\n                    <md-tooltip>{{\'CONTACTMANAGER.RELOAD\' | translate}}</md-tooltip>\n                    <md-icon md-font-icon="icon-reload"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- HOPPER TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryHopper.sort" md-on-reorder="vm.getHoppers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                      <th md-column md-order-by="phone">{{ \'CONTACTMANAGER.PHONE\' | translate }}</th>\n                      <th md-column md-order-by="scheduledat">{{ \'CONTACTMANAGER.SCHEDULEDAT\' | translate }}</th>\n                      <th md-column md-order-by="priority">{{ \'MOTIONDIALER.PRIORITY\' | translate }}</th>\n                      <th md-column md-order-by="recallme">{{ \'CONTACTMANAGER.RECALLME\' | translate }}</th>\n                      <th md-column md-order-by="VoiceQueueId">{{ \'CONTACTMANAGER.VOICEQUEUEID\' | translate }}</th>\n                      <th md-column md-order-by="CampaignId">{{ \'CONTACTMANAGER.CAMPAIGNID\' | translate }}</th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.hoppers.count">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, hopper) in vm.hoppers.rows">\n                      <td md-cell>{{hopper.id}}</td>\n                      <td md-cell privacy ng-cloak>{{hopper.phone}}</td>\n                      <td md-cell>{{hopper.scheduledat | date:\'medium\'}}</td>\n                      <td md-cell>{{ vm.arraypriority[hopper.priority].option }}</td>\n                      <td md-cell class="recallme ">\n                        <md-icon md-colors="{color: {{hopper.recallme ? \'\\\'green\\\'\' : \'\\\'red\\\'\'}}}" md-font-icon="{{hopper.recallme? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell>{{hopper.VoiceQueueId}}</td>\n                      <td md-cell>{{hopper.CampaignId}}</td>\n                      <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="2">\n                            <md-menu-item>\n                              <md-button ng-if="vm.crudPermissions.canEdit && hopper.VoiceQueueId" ng-click="vm.editHopper($event, hopper)" translate="CONTACTMANAGER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                              <md-button ng-if="vm.crudPermissions.canEdit && hopper.CampaignId" ng-click="vm.createOrEditIvrCampaignHopper($event, hopper)" translate="CONTACTMANAGER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                              <md-button ng-click="vm.crudPermissions.canDelete && vm.deleteconfirm(hopper, $event)" translate="CONTACTMANAGER.DELETE_HOPPER">\n                                Delete Hopper\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryHopper.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryHopper.page" md-total="{{vm.hoppers.count}}" md-on-paginate="vm.getHoppers" md-page-select></md-table-pagination>\n              \x3c!-- / HOPPER TABLE --\x3e\n            </div>\n          </div>\n\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.FINAL">Final</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryFinal.filter = query;" on-collapse="vm.queryFinal.filter = undefined;" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-click="vm.getFinals()" aria-label="reload" translate translate-attr-label="CONTACTMANAGER.RELOAD">\n                    <md-tooltip>{{\'CONTACTMANAGER.RELOAD\' | translate}}</md-tooltip>\n                    <md-icon md-font-icon="icon-reload"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- HOPPER TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryFinal.sort" md-on-reorder="vm.getFinals">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">{{ \'CONTACTMANAGER.UNIQUEID\' | translate }}</th>\n                      <th md-column md-order-by="calleridnum">{{ \'CONTACTMANAGER.PHONE\' | translate }}</th>\n                      <th md-column md-order-by="state">{{ \'CONTACTMANAGER.STATE\' | translate }}</th>\n                      <th md-column md-order-by="starttime">{{ \'CONTACTMANAGER.STARTTIME\' | translate }}</th>\n                      <th md-column md-order-by="disposition">{{ \'CONTACTMANAGER.DISPOSITION\' | translate }}</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.finals.count">\n                      <td md-cell colspan="5">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, final) in vm.finals.rows">\n                      <td md-cell>{{final.uniqueid}}</td>\n                      <td md-cell privacy ng-cloak>{{final.calleridnum}}</td>\n                      <td md-cell>{{final.statedesc}}</td>\n                      <td md-cell>{{final.starttime | date:\'medium\'}}</td>\n                      <td md-cell>{{final.disposition}}</td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryFinal.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryFinal.page" md-total="{{vm.finals.count}}" md-on-paginate="vm.getFinals" md-page-select></md-table-pagination>\n              \x3c!-- / HOPPER TABLE --\x3e\n            </div>\n          </div>\n\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.HISTORY">History</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryHistory.filter = query;" on-collapse="vm.queryHistory.filter = undefined;" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-click="vm.getHistories()" aria-label="reload" translate translate-attr-label="CONTACTMANAGER.RELOAD">\n                    <md-tooltip>{{\'CONTACTMANAGER.RELOAD\' | translate}}</md-tooltip>\n                    <md-icon md-font-icon="icon-reload"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- HOPPER TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryHistory.sort" md-on-reorder="vm.getHistories">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">{{ \'CONTACTMANAGER.UNIQUEID\' | translate }}</th>\n                      <th md-column md-order-by="calleridnum">{{ \'CONTACTMANAGER.PHONE\' | translate }}</th>\n                      <th md-column md-order-by="state">{{ \'CONTACTMANAGER.STATE\' | translate }}</th>\n                      <th md-column md-order-by="scheduledat">{{ \'CONTACTMANAGER.SCHEDULEDAT\' | translate }}</th>\n                      <th md-column md-order-by="starttime">{{ \'CONTACTMANAGER.STARTTIME\' | translate }}</th>\n                      <th md-column md-order-by="endtime">{{ \'CONTACTMANAGER.ENDTIME\' | translate }}</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.histories.count">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, history) in vm.histories.rows">\n                      <td md-cell>{{history.uniqueid}}</td>\n                      <td md-cell privacy ng-cloak>{{history.calleridnum}}</td>\n                      <td md-cell>{{history.statedesc}}</td>\n                      <td md-cell>{{history.scheduledat | date:\'medium\'}}</td>\n                      <td md-cell>{{history.starttime | date:\'medium\'}}</td>\n                      <td md-cell>{{history.endtime | date:\'medium\'}}</td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryHistory.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryHistory.page" md-total="{{vm.histories.count}}" md-on-paginate="vm.getHistories" md-page-select></md-table-pagination>\n              \x3c!-- / HOPPER TABLE --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab ng-if="vm.license.jscripty">\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.JSCRIPTY">JSCRIPTY</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.SESSIONS">Sessions</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryJscriptySession.filter = query;" on-collapse="vm.queryJscriptySession.filter = undefined;" debounce="300"></ms-search-bar>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- SESSION TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryJscriptySession.sort" md-on-reorder="vm.getJscriptySessions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                      <th md-column md-order-by="starttime">{{ \'CONTACTMANAGER.STARTTIME\' | translate }}</th>\n                      <th md-column md-order-by="endtime">{{ \'CONTACTMANAGER.ENDTIME\' | translate }}</th>\n                      <th md-column md-order-by="agent">{{ \'CONTACTMANAGER.AGENT\' | translate }}</th>\n                      <th md-column md-order-by="project">{{ \'CONTACTMANAGER.PROJECT\' | translate }}</th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.jscriptySessions.count">\n                      <td md-cell colspan="6">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, session) in vm.jscriptySessions.rows">\n                      <td md-cell>{{session.id}}</td>\n                      <td md-cell>{{session.starttime | date:\'medium\'}}</td>\n                      <td md-cell>{{session.endtime | date:\'medium\'}}</td>\n                      <td md-cell>{{session.membername}}</td>\n                      <td md-cell>{{session.projectname}}</td>\n                      <td md-cell class="actions"></td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryHopper.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryHopper.page" md-total="{{vm.hoppers.count}}" md-on-paginate="vm.getHoppers" md-page-select></md-table-pagination>\n              \x3c!-- / SESSION TABLE --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.CUSTOMER_JOURNEY">CUSTOMER JOURNEY</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <md-content class="md-padding" id="journey-content">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'">\n            </div>\n          </md-content>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/contactmanager/views/contacts/import/import.html",'<md-dialog class="import-dialog" aria-label="Import contact">\n  <form name="importForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="CONTACTMANAGER.IMPORT_CONTACTS">Import Contacts</span>\n        <md-button ng-if="vm.result.finish || !vm.processing" class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <div md-background-bg layout="row" layout-align="start start">\n      <md-progress-linear ng-disabled="!vm.processing || vm.result.finish" md-mode="indeterminate" class="md-warn"></md-progress-linear>\n    </div>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div>\n        <md-content ng-show="!vm.processing">\n          <div class="form-title" translate="CONTACTMANAGER.CONTACTMANAGER">CONTACT MANAGER</div>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="contactField in vm.contactFields">\n            <label>{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</label>\n            <md-select name="{{contactField.key}}" ng-model="vm.binding[contactField.key]" placeholder="{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}" ng-required="contactField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="contactField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.LIST">List</label>\n            <md-select name="list" ng-model="vm.ListId" placeholder="Select a list" ng-change="vm.onChangeList()" required>\n              <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="customField in vm.customFields.rows">\n            <label>{{customField.alias}}</label>\n            <md-select ng-model="vm.binding[\'cf_\' + customField.id]" placeholder="{{customField.alias}}" ng-required="customField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="customField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.COMPANY">Company</label>\n            <md-select name="company" ng-model="vm.CompanyId" placeholder="Select a company">\n              <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n              <md-option ng-value="null">\n                <em translate="CONTACTMANAGER.NONE">None</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <md-select ng-model="vm.duplicates" placeholder="{{ \'CONTACTMANAGER.CHECK_DUPLICATES\' | translate}}" multiple>\n              <md-option ng-value="contactField.key" ng-repeat="contactField in vm.contactFields">{{ \'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <div ng-if="vm.license.dialer">\n            <div class="form-title" translate="CONTACTMANAGER.MOTIONDIALER">MOTION BULL</div>\n\n            <md-input-container class="md-icon-float md-block" ng-repeat="motionBullField in vm.motionBullFields">\n              <label>{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}</label>\n              <md-select name="{{motionBullField.key}}" ng-model="vm.binding[motionBullField.key]" placeholder="{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}" ng-required="motionBullField.required">\n                <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                <md-option ng-value="null" ng-hide="contactField.required">\n                  <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n                </md-option>\n              </md-select>\n            </md-input-container>\n            <div class="form-title" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n            <div layout="row" ng-repeat="additionalPhone in vm.contactItemTypes" flex>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select name="{{additionalPhone.key}}" ng-model="vm.binding[additionalPhone.key]" placeholder="{{additionalPhone.key}}" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select name="{{additionalPhone.key+\'_description\'}}" ng-model="vm.binding[additionalPhone.key+\'_description\']" placeholder="{{additionalPhone.key}} description" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n            </div>\n          </div>\n\n        </md-content>\n\n        <div class="error-list" ng-if="vm.result.finish">\n          <div class="info" layout="row" layout-align="space-between center">\n            <div>\n              <div class="message">{{\'CONTACTMANAGER.UPLOAD_COMPLETED\' | translate | uppercase}} ({{vm.result.elapsed}}s)</div>\n            </div>\n            <md-button class="md-icon-button">\n              <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n            </md-button>\n          </div>\n        </div>\n\n        <div layout="row" ng-if="vm.processing">\n          \x3c!-- WIDGET PROCESSING --\x3e\n          <ms-widget ng-if="!vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.rows"></span>\n                </div>\n                <div ng-if="vm.processing" class="font-weight-500 secondary-text">Please wait, we are processing your contacts...</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET PROCESSING --\x3e\n          \x3c!-- WIDGET SUCCESS --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 green-fg">\n                  <span ng-bind="vm.result.affectedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.SUCCESS">Success</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET SUCCESS --\x3e\n\n          \x3c!-- WIDGET FAILURE --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 red-fg">\n                  <span ng-bind="vm.result.failedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.FAILURE">Failure</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET FAILURE --\x3e\n\n          \x3c!-- WIDGET DUPLICATES --\x3e\n          <ms-widget ng-if="vm.result.duplicatedRows && vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.duplicatedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.DUPLICATES">Duplicates</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET DUPLICATES --\x3e\n        </div>\n\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row">\n        <md-button ng-if="!vm.processing" ng-disabled="importForm.$invalid || importForm.$pristine" ng-click="vm.uploadCsv()" class="md-accent md-raised" aria-label="UPLOAD" translate="CONTACTMANAGER.UPLOAD" translate-attr-aria-label="CONTACTMANAGER.IMPORT">\n          IMPORT\n        </md-button>\n        <md-button ng-if="vm.processing && !vm.result.finish && !vm.stopping" ng-click="vm.stopUpload()" class="md-accent md-raised" aria-label="Stop Upload" translate="CONTACTMANAGER.STOP" translate-attr-aria-label="CONTACTMANAGER.STOP">\n          STOP\n        </md-button>\n        <md-button ng-if="vm.result.finish && vm.result.errors.length" ng-csv="vm.getArrayErrors()" csv-header="vm.getHeaderErrors()" class="md-accent md-raised" aria-label="Export Errors" filename="contacts_import_errors.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon> {{\'CONTACTMANAGER.EXPORT_ERRORS\' | translate}}\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/import/importUpdates.html",'<md-dialog class="import-dialog" aria-label="Import contact">\n  <form name="importForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="CONTACTMANAGER.UPDATE_EXISTING_CONTACTS">Update Existing Contacts</span>\n        <md-button ng-if="vm.result.finish || !vm.processing" class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <div md-background-bg layout="row" layout-align="start start">\n      <md-progress-linear ng-disabled="!vm.processing || vm.result.finish" md-mode="indeterminate" class="md-warn"></md-progress-linear>\n    </div>\n\n    <md-dialog-content ms-scroll>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div>\n        <md-content ng-show="!vm.processing">\n          <div class="form-title" translate="CONTACTMANAGER.CONTACTMANAGER">CONTACT MANAGER</div>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="contactField in vm.contactFields">\n            <label>{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</label>\n            <md-select name="{{contactField.key}}" ng-model="vm.binding[contactField.key]" placeholder="{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}" ng-required="contactField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="contactField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.LIST">List</label>\n            <md-select name="list" ng-model="vm.ListId" placeholder="Select a list" ng-change="vm.onChangeList()" required>\n              <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="customField in vm.customFields.rows">\n            <label>{{customField.alias}}</label>\n            <md-select ng-model="vm.binding[\'cf_\' + customField.id]" placeholder="{{customField.alias}}" ng-required="customField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="customField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.COMPANY">Company</label>\n            <md-select name="company" ng-model="vm.CompanyId" placeholder="Select a company">\n              <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n              <md-option ng-value="null">\n                <em translate="CONTACTMANAGER.NONE">None</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <md-select ng-model="vm.duplicates" placeholder="{{ \'CONTACTMANAGER.CHECK_DUPLICATES\' | translate}}" multiple>\n              <md-option ng-value="contactField.key" ng-repeat="contactField in vm.contactFields">{{ \'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <div ng-if="vm.license.dialer">\n            <div class="form-title" translate="CONTACTMANAGER.MOTIONDIALER">MOTION BULL</div>\n\n            <md-input-container class="md-icon-float md-block" ng-repeat="motionBullField in vm.motionBullFields">\n              <label>{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}</label>\n              <md-select name="{{motionBullField.key}}" ng-model="vm.binding[motionBullField.key]" placeholder="{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}" ng-required="motionBullField.required">\n                <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                <md-option ng-value="null" ng-hide="contactField.required">\n                  <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n                </md-option>\n              </md-select>\n            </md-input-container>\n            <div class="form-title" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n            <div layout="row" ng-repeat="additionalPhone in vm.contactItemTypes" flex>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select multiple="true" name="{{additionalPhone.key}}" ng-model="vm.binding[additionalPhone.key]" placeholder="{{additionalPhone.key}}" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select multiple="true" name="{{additionalPhone.key+\'_description\'}}" ng-model="vm.binding[additionalPhone.key+\'_description\']" placeholder="{{additionalPhone.key}} description" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n            </div>\n          </div>\n\n        </md-content>\n\n        <div class="error-list" ng-if="vm.result.finish">\n          <div class="info" layout="row" layout-align="space-between center">\n            <div>\n              <div class="message">{{\'CONTACTMANAGER.UPLOAD_COMPLETED\' | translate | uppercase}} ({{vm.result.elapsed}}s)</div>\n            </div>\n            <md-button class="md-icon-button">\n              <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n            </md-button>\n          </div>\n        </div>\n\n        <div layout="row" ng-if="vm.processing">\n          \x3c!-- WIDGET PROCESSING --\x3e\n          <ms-widget ng-if="!vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.rows"></span>\n                </div>\n                <div ng-if="vm.processing" class="font-weight-500 secondary-text">Please wait, we are processing your contacts...</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET PROCESSING --\x3e\n          \x3c!-- WIDGET SUCCESS --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 green-fg">\n                  <span ng-bind="vm.result.affectedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.SUCCESS">Success</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET SUCCESS --\x3e\n\n          \x3c!-- WIDGET FAILURE --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 red-fg">\n                  <span ng-bind="vm.result.failedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.FAILURE">Failure</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET FAILURE --\x3e\n\n          \x3c!-- WIDGET DUPLICATES --\x3e\n          <ms-widget ng-if="vm.result.duplicatedRows && vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.duplicatedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.DUPLICATES">Duplicates</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET DUPLICATES --\x3e\n        </div>\n\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row">\n        <md-button ng-if="!vm.processing" ng-disabled="importForm.$invalid || importForm.$pristine" ng-click="vm.uploadCsv()" class="md-accent md-raised" aria-label="UPLOAD" translate="CONTACTMANAGER.UPLOAD" translate-attr-aria-label="CONTACTMANAGER.IMPORT">\n          IMPORT\n        </md-button>\n        <md-button ng-if="vm.processing && !vm.result.finish && !vm.stopping" ng-click="vm.stopUpload()" class="md-accent md-raised" aria-label="Stop Upload" translate="CONTACTMANAGER.STOP" translate-attr-aria-label="CONTACTMANAGER.STOP">\n          STOP\n        </md-button>\n        <md-button ng-if="vm.result.finish && vm.result.errors.length" ng-csv="vm.getArrayErrors()" csv-header="vm.getHeaderErrors()" class="md-accent md-raised" aria-label="Export Errors" filename="contacts_import_errors.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon> {{\'CONTACTMANAGER.EXPORT_ERRORS\' | translate}}\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/merge/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="Merge Contact">\n  <form name="contactForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block" flex-gt-sm>\n        <label>Filter</label>\n        <input ng-model="vm.searchTerm" name="searchTerm" ng-model-options="{ debounce: 300 }" ng-change="vm.change()">\n      </md-input-container>\n\n      <md-list flex>\n        <md-subheader class="md-no-sticky" ng-hide="vm.contacts.length"><em>Filter doesn\'t match any contact</em></md-subheader>\n        <md-list-item class="md-3-line" ng-repeat="contact in vm.contacts | filter:{ id: \'!\' + vm.contact.id}" ng-click="vm.showConfirm($event, vm.contact, contact)">\n          <img ng-src="assets/images/avatars/profile.png" class="md-avatar" alt="{{contact.who}}" />\n          <div class="md-list-item-text" layout="column">\n            <h3>#{{ contact.id }} - {{ contact.firstName }} {{ contact.lastName }}</h3>\n            <h4>{{ contact.email }}</h4>\n            <p>{{ contact.phone }}</p>\n          </div>\n        </md-list-item>\n      </md-list>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/globalCustomFields/create/dialog.html",'<md-dialog class="globalCustomField-dialog" aria-label="New GlobalCustomField">\n  <form name="globalCustomFieldForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.ALIAS">Alias</label>\n        <input type="" name="alias" ng-model="vm.globalCustomField.alias" ng-required="true" autofocus>\n\n        <div ng-messages="globalCustomFieldForm[\'alias\'].$error" ng-show="globalCustomFieldForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.globalCustomField.type" required ng-disabled="!vm.newGlobalCustomField">\n          <md-option ng-value="\'text\'">Text</md-option>\n          <md-option ng-value="\'select\'">Select</md-option>\n          <md-option ng-value="\'number\'">Number</md-option>\n          <md-option ng-value="\'switch\'">Switch</md-option>\n          <md-option ng-value="\'datetime\'">Datetime</md-option>\n        </md-select>\n        <div ng-messages="globalCustomFieldForm[\'type\'].$error" ng-show="globalCustomFieldForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.globalCustomField.type == \'select\'" class="md-block">\n        <md-list>\n          <md-list-item layout-margin>\n            <md-button class="md-fab md-mini md-secondary" ng-click="vm.addItem(vm.globalCustomField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.ADD">ADD</span></md-tooltip>\n              <md-icon md-font-icon="icon-plus" aria-label="alert error"></md-icon>\n            </md-button>\n            <md-button ng-if="vm.globalCustomField.values.length" class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItems(vm.globalCustomField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE_ALL">Delete All</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list ng-sortable="vm.sortable">\n          <md-list-item ng-repeat="item in vm.globalCustomField.values" style="border: 1px solid #ccc!important; border-radius: 7px;" layout-margin>\n            <div>\n              <md-icon class="s24" style="cursor:move" md-font-icon="icon-drag" aria-label="drag"></md-icon>\n              <input type="text" ng-model="item.value" flex>\n            </div>\n            <md-button class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItem(vm.globalCustomField.values, $index);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list>\n          <md-list-item ng-if="!vm.globalCustomField.values.length" layout="row" layout-align="center center">\n            <em translate="CONTACTMANAGER.NO_AVAILABLE_ITEMS">No Available Items</em>\n          </md-list-item>\n        </md-list>\n      </div>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.globalCustomField.required" aria-label="Required"><span translate="CONTACTMANAGER.REQUIRED">Required</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.globalCustomField.type == \'text\'" class="md-block">\n        <md-switch ng-model="vm.globalCustomField.clickToAction" aria-label="ClickToAction"><span translate="CONTACTMANAGER.CLICKTOACTION">ClickToAction</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.globalCustomField.clickToAction" class="md-block">\n        <label translate="CONTACTMANAGER.ACTIONTYPE">ActionType</label>\n        <md-select name="actionType" ng-model="vm.globalCustomField.actionType">\n          <md-option ng-value="\'voice\'">Voice</md-option>\n        </md-select>\n        <div ng-messages="globalCustomFieldForm[\'actionType\'].$error" ng-show="globalCustomFieldForm[\'actionType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ACTIONTYPE_REQUIRED">ActionType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newGlobalCustomField" ng-click="vm.saveGlobalCustomField()" class="send-button md-accent md-raised" ng-disabled="globalCustomFieldForm.$invalid || globalCustomFieldForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newGlobalCustomField" ng-click="vm.addNewGlobalCustomField()" class="send-button md-accent md-raised" ng-disabled="globalCustomFieldForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_GLOBALCUSTOMFIELD" translate-attr-aria-label="CONTACTMANAGER.ADD_GLOBALCUSTOMFIELD">\n          ADD GLOBALCUSTOMFIELD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newGlobalCustomField" ng-click="vm.deleteGlobalCustomField($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/globalCustomFields/globalCustomFields.html",'<div id="globalCustomFields" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-circle" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.GLOBALCUSTOMFIELDS">GlobalCustomFields</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedGlobalCustomFields.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedGlobalCustomFields =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-globalCustomFields-count">\n          <span>{{vm.selectedGlobalCustomFields.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTMANAGER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllGlobalCustomFields()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectGlobalCustomFields()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedGlobalCustomFields" csv-label="true" filename="globalCustomFields.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedGlobalCustomFields($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- GLOBALCUSTOMFIELD TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedGlobalCustomFields" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getGlobalCustomFields">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                <th md-column md-order-by="alias">{{ \'CONTACTMANAGER.ALIAS\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'CONTACTMANAGER.TYPE\' | translate }}</th>\n                <th md-column md-order-by="required">{{ \'CONTACTMANAGER.REQUIRED\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.globalCustomFields.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="globalCustomField" md-select-id="id" ng-repeat="globalCustomField in vm.globalCustomFields.rows">\n                <td md-cell ng-if="globalCustomField.userpic"><img class="avatar" alt="{{globalCustomField.name}}" ng-src="api/users/{{globalCustomField.id}}/avatar" /></td>\n                <td md-cell ng-if="!globalCustomField.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{globalCustomField.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="id ">{{globalCustomField.id}}</td>\n                <td ng-click="vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="alias ">{{globalCustomField.alias}}</td>\n                <td ng-click="vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="type ">{{ vm.arraytype[globalCustomField.type].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(globalCustomField, ev) : vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="required ">\n                  <md-icon md-colors="{color: {{globalCustomField.required ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{globalCustomField.required ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(globalCustomField, $event    )" translate="CONTACTMANAGER.EDIT_GLOBALCUSTOMFIELD">\n                          Edit GlobalCustomField\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(globalCustomField, $event    )" translate="CONTACTMANAGER.DELETE_GLOBALCUSTOMFIELD">\n                          Delete GlobalCustomField\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.globalCustomFields.count}}" md-on-paginate="vm.getGlobalCustomFields" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / GLOBALCUSTOMFIELD TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD GLOBALCUSTOMFIELD BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-globalCustomField-button" ng-click="vm.createOrEditGlobalCustomField($event)" aria-label="add globalCustomField" translate translate-attr-aria-label="CONTACTMANAGER.ADD_GLOBALCUSTOMFIELD">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD GLOBALCUSTOMFIELD BUTTON --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/lists/create/dialog.html",'<md-dialog class="list-dialog" aria-label="New List">\n  <form name="listForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.list.name" ng-required="true" autofocus>\n\n        <div ng-messages="listForm[\'name\'].$error" ng-show="listForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.list.description">\n\n        <div ng-messages="listForm[\'description\'].$error" ng-show="listForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newList" ng-click="vm.saveList()" class="send-button md-accent md-raised" ng-disabled="listForm.$invalid || listForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newList" ng-click="vm.addNewList()" class="send-button md-accent md-raised" ng-disabled="listForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_LIST" translate-attr-aria-label="CONTACTMANAGER.ADD_LIST">\n          ADD LIST\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newList" ng-click="vm.deleteList($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",'<md-dialog class="list-dialog" aria-label="list" ng-init="vm.onInit()">\n  <form name="listForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CONTACTMANAGER.AGENTADD_LIST">Add Agent to list</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/lists/edit/customFields/dialog.html",'<md-dialog class="customField-dialog" aria-label="New CustomField">\n  <form name="customFieldForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.ALIAS">Alias</label>\n        <input type="" name="alias" ng-model="vm.customField.alias" ng-required="true" autofocus>\n\n        <div ng-messages="customFieldForm[\'alias\'].$error" ng-show="customFieldForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.customField.type" required ng-disabled="!vm.newCustomField">\n          <md-option ng-value="\'text\'">Text</md-option>\n          <md-option ng-value="\'select\'">Select</md-option>\n          <md-option ng-value="\'number\'">Number</md-option>\n          <md-option ng-value="\'switch\'">Switch</md-option>\n          <md-option ng-value="\'datetime\'">Datetime</md-option>\n        </md-select>\n        <div ng-messages="customFieldForm[\'type\'].$error" ng-show="customFieldForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.customField.type == \'select\'" class="md-block">\n        <md-list>\n          <md-list-item layout-margin>\n            <md-button class="md-fab md-mini md-secondary" ng-click="vm.addItem(vm.customField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.ADD">ADD</span></md-tooltip>\n              <md-icon md-font-icon="icon-plus" aria-label="alert error"></md-icon>\n            </md-button>\n            <md-button ng-if="vm.customField.values.length" class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItems(vm.customField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE_ALL">Delete All</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list ng-sortable="vm.sortable">\n          <md-list-item ng-repeat="item in vm.customField.values" style="border: 1px solid #ccc!important; border-radius: 7px;" layout-margin>\n            <div>\n              <md-icon class="s24" style="cursor:move" md-font-icon="icon-drag" aria-label="drag"></md-icon>\n              <input type="text" ng-model="item.value" flex>\n            </div>\n            <md-button class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItem(vm.customField.values, $index);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list>\n          <md-list-item ng-if="!vm.customField.values.length" layout="row" layout-align="center center">\n            <em translate="CONTACTMANAGER.NO_AVAILABLE_ITEMS">No Available Items</em>\n          </md-list-item>\n        </md-list>\n      </div>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customField.required" aria-label="Required"><span translate="CONTACTMANAGER.REQUIRED">Required</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.customField.type == \'text\'" class="md-block">\n        <md-switch ng-model="vm.customField.clickToAction" aria-label="clickToAction"><span translate="CONTACTMANAGER.CLICKTOACTION">clickToAction</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.customField.clickToAction" class="md-block">\n        <label translate="CONTACTMANAGER.ACTIONTYPE">actionType</label>\n        <md-select name="actionType" ng-model="vm.customField.actionType">\n          <md-option ng-value="\'voice\'">Voice</md-option>\n        </md-select>\n        <div ng-messages="customFieldForm[\'actionType\'].$error" ng-show="customFieldForm[\'actionType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ACTIONTYPE_REQUIRED">actionType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCustomField" ng-click="vm.saveCustomField()" class="send-button md-accent md-raised" ng-disabled="customFieldForm.$invalid || customFieldForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCustomField" ng-click="vm.addNewCustomField()" class="send-button md-accent md-raised" ng-disabled="customFieldForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_CUSTOMFIELD" translate-attr-aria-label="CONTACTMANAGER.ADD_CUSTOMFIELD">\n          ADD CUSTOMFIELD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCustomField" ng-click="vm.deleteCustomField($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/lists/edit/view.html",'<div id="contactmanager-list" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-lists-button md-icon-button" aria-label="Go to lists" ng-click="vm.gotoLists()" translate translate-attr-aria-label="CONTACTMANAGER.GO_TO_LISTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="list-image" hide-xs>\n          <img ng-src="assets/images/business/lists.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.list.id}}\n            <span ng-if="vm.list.name">{{vm.list.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CONTACTMANAGER.CREATED_AT"></span> <span>{{vm.list.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.list, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="CONTACTMANAGER.GOTO_LIST"></span></md-tooltip>\n        <md-icon md-font-icon="icon-forward"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.list, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="CONTACTMANAGER.AGENTADD_LIST"></span></md-tooltip>\n        <md-icon md-font-icon="icon-eye"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveList()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (customFieldsForm.$invalid) || (voiceDispositionsForm.$invalid)" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="list-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.list.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.list.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.PREFIX">Prefix</label>\n                <input type="text" name="dialPrefix" ng-model="vm.list.dialPrefix" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'dialPrefix\'].$error" ng-show="generalForm[\'dialPrefix\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.CUSTOMFIELDS">CUSTOMFIELDS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="list-detail-form-container customfields md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ListCustomFieldsController as vm_dc" ng-init="vm_dc.init(vm.list, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedListCustomFields.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.CUSTOMFIELDS">CustomFields</span>\n                  <ms-search-bar on-search="vm_dc.getListCustomFields()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditListCustomField($event)" aria-label="add customField" translate translate-attr-label="CONTACTMANAGER.ADD_CUSTOMFIELD">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedListCustomFields.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedListCustomFields.length}} {{vm_dc.selectedListCustomFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedListCustomFields" csv-label="true" filename="lists.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedListCustomFields($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedListCustomFields" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getListCustomFields">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CONTACTMANAGER.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="alias">\n                        {{ \'CONTACTMANAGER.ALIAS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="type">\n                        {{ \'CONTACTMANAGER.TYPE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="required">\n                        {{ \'CONTACTMANAGER.REQUIRED\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="customField" md-select-id="id" ng-repeat="customField in vm_dc.listCustomFields.rows">\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>\n                        {{customField.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>\n                        {{customField.alias}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>\n                        {{ vm_dc.arraytype[customField.type].option }} </td>\n\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell class="required ">\n                        <md-icon md-colors="{color: {{customField.required ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{customField.required? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditListCustomField($event, customField)" translate="CONTACTMANAGER.EDIT_CUSTOMFIELD">\n                                Edit CustomField\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(customField, $event)" translate="CONTACTMANAGER.DELETE_CUSTOMFIELD">\n                                Delete CustomField\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.listCustomFields.rows.length">\n                      <td md-cell colspan="9">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CONTACTMANAGER.NO_CUSTOMFIELD_AVAILABLE">No customfield available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.listCustomFields.count}}" md-on-paginate="vm_dc.getListCustomFields" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="ListDispositionsController as vm_dc" ng-init="vm_dc.init(vm.list, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="list-detail-form-container voicedispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedListDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="CONTACTMANAGER.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add contactmanager dispositions" translate translate-attr-label="CONTACTMANAGER.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="lists.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'CONTACTMANAGER.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'CONTACTMANAGER.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/contactmanager/views/lists/lists.html",'<div id="lists" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-circle" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.LISTS">Lists</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedLists.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedLists =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-lists-count">\n          <span>{{vm.selectedLists.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTMANAGER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllLists()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectLists()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedLists" csv-label="true" filename="lists.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedLists($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- LIST TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedLists" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getLists">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CONTACTMANAGER.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CONTACTMANAGER.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.lists.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="list" md-select-id="id" ng-repeat="list in vm.lists.rows">\n                <td md-cell ng-if="list.userpic"><img class="avatar" alt="{{list.name}}" ng-src="api/users/{{list.id}}/avatar" /></td>\n                <td md-cell ng-if="!list.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{list.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(list, ev) : vm.createOrEditList($event, list)" md-cell class="id ">{{list.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(list, ev) : vm.createOrEditList($event, list)" md-cell class="name ">{{list.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(list, ev) : vm.createOrEditList($event, list)" md-cell class="description ">{{list.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(list, $event    )" translate="CONTACTMANAGER.EDIT_LIST">\n                          Edit List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotocontactsgoto(list, $event    )" translate="CONTACTMANAGER.GOTOCONTACTS_LIST">\n                          goToContacts List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadContactManagerLists">\n\n                        <md-button ng-click="vm.exportcsvcontactsexport(list, $event    )" translate="CONTACTMANAGER.EXPORTCSVCONTACTS_LIST">\n                          exportCsvContacts List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(list, $event    )" translate="CONTACTMANAGER.AGENTADD_LIST">\n                          AgentAdd List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(list, $event    )" translate="CONTACTMANAGER.DELETE_LIST">\n                          Delete List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.lists.count}}" md-on-paginate="vm.getLists" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / LIST TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD LIST BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-list-button" ng-click="vm.createOrEditList($event)" aria-label="add list" translate translate-attr-aria-label="CONTACTMANAGER.ADD_LIST">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD LIST BUTTON --\x3e\n</div>'),e.put("app/main/apps/dashboards/views/custom/custom.html",'<div ng-if="!vm.customDashboard">\n  <p>Custom Dashboard not available...</p>\n</div>\n<div id="dashboard-custom" ng-if="vm.customDashboard" ng-cloak layout-fill>\n  <md-content>\n    <md-toolbar class="md-default md-accent filter-header">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead">{{vm.customDashboard.name}}</span>\n        <div flex></div>\n        <md-button ng-click="vm.setFilter($event)">\n          <md-tooltip md-direction="top"><span translate="DASHBOARDS.FILTERS"></span></md-tooltip>\n          <md-icon md-font-icon="icon-filter" ng-class=""></md-icon>\n        </md-button>\n        <md-button ng-if="vm.crudPermissions.canEdit" class="md-icon-button" ng-click="vm.goToEdit()" aria-label="goToEdit">\n          <md-tooltip md-direction="top"><span translate="DASHBOARDS.EDIT"></span></md-tooltip>\n          <md-icon md-font-icon="icon-table-edit"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <ms-widget-engine config="vm.customDashboard"></ms-widget-engine>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/custom/filter/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="Set Filter">\n  <form name="FilterForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content style="padding:30px;">\n      <div layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-phone"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_VOICE_QUEUES">Filter Voice Queues</span>\n          </div>\n          <md-select placeholder="Select one or more queues" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'voice\')" ng-model="vm.parent.voiceQueuesSelected" multiple aria-label="voiceQueues">\n            <md-option ng-value="voiceQueue.id" ng-repeat="voiceQueue in vm.parent.voiceQueues.rows">{{\n                            voiceQueue.name }}\n            </md-option>\n          </md-select>\n        </div>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-hangouts"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_CHAT_WEBSITES">Filter Chat\n              Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'chat\')" ng-model="vm.parent.chatWebsitesSelected" multiple aria-label="chatWebsite">\n            <md-option ng-value="chatWebsite.id" ng-repeat="chatWebsite in vm.parent.chatWebsites.rows">{{\n                            chatWebsite.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n      <div class="margin-top-30" layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-message-text"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_SMS_ACCOUNTS">Filter Sms Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'sms\')" ng-model="vm.parent.smsAccountsSelected" multiple aria-label="smsAccount">\n            <md-option ng-value="smsAccount.id" ng-repeat="smsAccount in vm.parent.smsAccounts.rows">{{\n                            smsAccount.name }}</md-option>\n          </md-select>\n        </div>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-deskphone"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_FAX_ACCOUNTS">Filter Fax Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'fax\')" ng-model="vm.parent.faxAccountsSelected" multiple aria-label="faxAccount">\n            <md-option ng-value="faxAccount.id" ng-repeat="faxAccount in vm.parent.faxAccounts.rows">{{\n                            faxAccount.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n      <div class="margin-top-30" layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-email"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_MAIL_ACCOUNTS">Filter Mail\n              Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'mail\')" ng-model="vm.parent.mailAccountsSelected" multiple aria-label="mailAccount">\n            <md-option ng-value="mailAccount.id" ng-repeat="mailAccount in vm.parent.mailAccounts.rows">{{\n                            mailAccount.name }}</md-option>\n          </md-select>\n        </div>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-google-earth"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_OPENCHANNEL_ACCOUNTS">Filter Openchannel\n              Websites</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'openchannel\')" ng-model="vm.parent.openchannelAccountsSelected" multiple aria-label="openchannelAccount">\n            <md-option ng-value="openchannelAccount.id" ng-repeat="openchannelAccount in vm.parent.openchannelAccounts.rows">{{\n                            openchannelAccount.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n      <div class="margin-top-30" layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-whatsapp"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_WHATSAPP_ACCOUNTS">Filter Whatsapp\n              Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'whatsapp\')" ng-model="vm.parent.whatsappAccountsSelected" multiple aria-label="whatsappAccount">\n            <md-option ng-value="whatsappAccount.id" ng-repeat="whatsappAccount in vm.parent.whatsappAccounts.rows">\n              {{whatsappAccount.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.confirm()" class="send-button md-accent md-raised" aria-label="CONFIRM" translate="DASHBOARDS.CONFIRM" translate-attr-aria-label="DASHBOARDS.CONFIRM">\n          CONFIRM\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/agent.general.html",'<div id="agent-general" layout="column">\n  <div layout="row" layout-align="start center" class="md-primary-bg">\n    <md-button class="md-raised no-margin width-50" style="border-radius: 0px" ng-class="{\'md-primary\': !vm.isActiveTab(0)}" ng-click="vm.onClickTab(0)" aria-label="home">\n      <md-tooltip md-direction="bottom" md-delay="500">Home</md-tooltip>\n      <md-icon md-font-icon="icon-home" class="icon"></md-icon>\n    </md-button>\n\n    <ms-tab-scroll style="overflow: hidden;">\n      <div layout="column" ng-repeat="(key, tab) in vm.tabs | orderByDate " ng-click="vm.onClickTab(tab.id)" ng-class="{\'grey-50-bg\': vm.isActiveTab(tab.id)}">\n        <div style="height: 34px" layout="row" layout-align="space-between center">\n          <md-icon md-font-icon="{{tab.icon}}" class="icon s16 margin-horizontal-5" ng-class="tab.color + \'-fg\'">\n          </md-icon>\n          <span class="text-truncate font-size-12" ng-class="vm.isActiveTab(tab.id) ? \'black-fg\' : \'grey-300-fg\'">\n            {{tab.title}}\n            <span ng-if="tab.badges" class="badge md-white-fg md-red-bg">{{tab.badges}}</span></span>\n          <md-button class="md-icon-button md-mini no-margin" ng-class="vm.isActiveTab(tab.id) ? \'md-primary\' : \'grey-300-fg\'" aria-label="close" ng-click="vm.closeTab(tab); $event.stopPropagation()">\n            <md-icon md-font-icon="icon-close-circle-outline" class="icon s16"></md-icon>\n          </md-button>\n        </div>\n        <div style="height: 2px" ng-class="vm.isActiveTab(tab.id) ? tab.color + \'-bg\' : \'\'"></div>\n      </div>\n    </ms-tab-scroll>\n  </div>\n  \x3c!-- home --\x3e\n  <div layout="row" class="agent-content overflow-hidden" ng-if="vm.isActiveTab(0)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.html\'" ng-controller="AgentGeneralHomeController as vm_home" ng-init="vm_home.init(vm.license, vm.setting)"></div>\n  \x3c!-- other tabs --\x3e\n  <div ng-if="tab.id !== 0 && vm.isActiveTab(tab.id)" ng-repeat="(key, tab) in vm.tabs | orderByDate " ng-switch="tab.type" flex layout="column">\n    <div ng-switch-when="contact" ng-class="{{tab.type}}" flex layout="column">\n      <div class="agent-content" flex layout="column" ng-if="vm.isActiveTab(tab.id)" ng-include="\'app/main/apps/dashboards/views/general/agent/contact/agent.general.contact.html\'" ng-controller="AgentGeneralContactController as vm" ng-init="vm.init(tab,$parent.vm.license)"></div>\n    </div>\n    <div ng-switch-when="popup" ng-class="{{tab.type}}" flex layout="column">\n      <div flex layout="column" ng-if="vm.isActiveTab(tab.id)" ng-include="\'app/main/apps/dashboards/views/general/agent/popup/agent.general.popup.html\'" ng-controller="AgentGeneralPopupController as vm" ng-init="vm.init(tab)"></div>\n    </div>\n    <div ng-switch-when="jscripty" ng-class="{{tab.type}}" flex layout="column">\n      <div class="agent-content" ng-if="vm.isActiveTab(tab.id)" ng-include="\'app/main/apps/dashboards/views/general/agent/jscripty/agent.general.jscripty.html\'" ng-controller="AgentGeneralJscriptyController as vm" ng-init="vm.init(tab)"></div>\n    </div>\n    <div ng-switch-when="bot" ng-class="{{tab.type}}" flex layout="column">\n      <div id="interaction-app" flex layout="column" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/bot/agent.general.bot.html\'" ng-controller="AgentGeneralBotController as vm" ng-init="vm.init(tab, $parent.vm.setting)"></div>\n    </div>\n    <div ng-switch-when="interaction" ng-class="{{tab.type}}" flex layout="column">\n      <div id="interaction-app" flex layout="column" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.html\'" ng-controller="AgentGeneralInteractionController as vm" ng-init="vm.init(tab, $parent.vm.setting)">\n      </div>\n    </div>\n    <div ng-switch-when="iframe" ng-class="{{tab.type}}" flex layout="column">\n      <div id="iframe" flex layout="column" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/iframe/agent.general.iframe.html\'" ng-controller="AgentGeneralIframeController as vm" ng-init="vm.init(tab, $parent.vm.setting)">\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/bot/agent.general.bot.html",'\x3c!-- CONTENT CARD --\x3e\n<md-content class="content-card" layout="row" layout-fill>\n\n  <div ng-if="!vm.showInteraction" class="start-point" flex layout="column" layout-align="center center">\n    <div class="big-circle md-whiteframe-4dp">\n      <md-icon class="s128 md-accent pink-fg" md-font-icon="fas fa-robot"></md-icon>\n    </div>\n    <span class="app-title" translate="DASHBOARDS.WAITING">Waiting</span>\n    <span class="hide show-gt-md secondary-text" translate="DASHBOARDS.LOADING_INTERACTION">We are loading the\n      interaction...</span>\n  </div>\n\n  <div ng-if="vm.showInteraction" flex layout="row">\n    <md-card flex="100" class="interaction">\n      \x3c!-- TOOLBAR --\x3e\n      <md-toolbar class="interaction-toolbar">\n        <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n          <md-icon md-font-icon="fas fa-robot" class="s20 pink-fg"></md-icon>\n          <div class="padding-left-10" layout="column" layout-align="center start" flex>\n            <div class="font-size-14" layout="row" layout-align="start center" layout-fill>\n              <span>#{{vm.tab.data.uniqueid}} - {{vm.tab.title}}</span>\n            </div>\n          </div>\n          <div layout="row" layout-align="end center">\n\n          </div>\n        </div>\n      </md-toolbar>\n      \x3c!-- / TOOLBAR --\x3e\n\n      \x3c!-- CONTENT --\x3e\n      <md-content id="interaction-content" name="{{\'interaction-content-\' + vm.tab.id}}" flex layout-wrap>\n        <div class="interaction-messages">\n          \x3c!-- MESSAGES --\x3e\n          <div layout="row" ng-repeat="message in vm.messages.rows" class="md-padding message-row" ng-class="vm.getMessagesAlignment(message)">\n            <img ng-if="message.direction ===\'in\'" src="assets/images/avatars/customer.png" class="avatar" />\n            <img ng-if="message.direction ===\'out\'" class="avatar" src="assets/images/avatars/robot.png">\n\n            <div class="bubble" ng-switch="message.direction">\n              <div>\n                <div ng-switch-when="in" class="time secondary-text">\n                  {{vm.tab.title}} - {{message.createdAt | date: \'medium\'}}\n                </div>\n                <div ng-switch-when="out" class="time secondary-text" layout="row" layout-align="end center">\n                  <div layout-padding>\n                    System - {{message.createdAt | date: \'medium\'}}\n                  </div>\n                  <div>\n                    <md-icon class="s18" md-font-icon="icon-check-all md-accent"></md-icon>\n                  </div>\n                </div>\n              </div>\n              <div ng-bind-html="message.body | embed:vm.emojiOptions" class="message" layout="row" layout-align="end center"></div>\n            </div>\n          </div>\n          \x3c!-- / MESSAGES --\x3e\n        </div>\n      </md-content>\n      \x3c!-- / CONTENT --\x3e\n    </md-card>\n  </div>\n</md-content>\n\x3c!-- / CONTENT CARD --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/contact/agent.general.contact.html",'<md-tabs md-selected="vm.currentTab" md-dynamic-height>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.DETAIL">Detail</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content>\n        <div layout="row" class="pr-10">\n          <div layout="row" flex="75" class="flex-scrollable only-x">\n            <md-card ng-repeat="call in vm.tab.calls track by call.uniqueid" class="call-info-card">\n              <md-progress-linear md-mode="indeterminate" ng-if="vm.checkingCallStatus"></md-progress-linear>\n              <md-card-header layout="row" layout-align="space-between">\n                <span ng-if="call.answertime" class="text-boxed indigo-100-bg ml-0">\n                  <timer start-time="call.answertime"></timer>\n                  <md-tooltip md-direction="bottom">\n                    {{ \'DASHBOARDS.ELAPSED_ANSWERED\' | translate }}\n                  </md-tooltip>\n                </span>\n                <span ng-if="call.disposedAt" class="text-boxed amber-200-bg">\n                  <timer start-time="call.disposedAt"></timer>\n                  <md-tooltip md-direction="bottom">\n                    {{ \'DASHBOARDS.ELAPSED_DISPOSED\' | translate }}\n                  </md-tooltip>\n                </span>\n                <md-button class="md-icon-button no-margin reload-button" ng-click="vm.checkCallStatus(call)" ng-disabled="vm.checkingCallStatus">\n                  <md-icon md-font-icon="icon-reload" class="s22"></md-icon>\n                  <md-tooltip md-direction="bottom">\n                    {{ \'DASHBOARDS.RELOAD\' | translate }}\n                  </md-tooltip>\n                </md-button>\n              </md-card-header>\n              <md-divider></md-divider>\n              <md-card-content>\n                <div layout="column" layout-align="space-between start" class="word-break-all mr-16">\n                  <div layout="row" layout-align="start center">\n                    <md-icon md-font-icon="{{ call.routeId ? \'icon-phone-outgoing\' : \'icon-phone-incoming\'}}" class="s20 mr-5">\n                    </md-icon>\n                    <span class="h2" privacy ng-cloak>{{ call.routeId ? call.destcalleridnum : call.calleridnum }}</span>\n                  </div>\n\n                  <div class="subtitle h4 secondary-text" ng-if="call.calleridname && call.calleridname != \'<unknown>\' && !call.routeId">\n                    <md-icon md-font-icon="icon-account" class="s20"></md-icon>\n                    Name: <span privacy ng-cloak>{{ call.calleridname }}</span>\n                    <div ng-if="(vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum}).length>0">\n                      <span ng-style="{\'color\':(vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum})[0].color} ">\n                        {{ (vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum})[0].description }} -\n                        {{ (vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum})[0].type }}\n                      </span>\n                    </div>\n                  </div>\n\n                  <div class="text h4 pt-8" ng-if="call.queue">\n                    <md-icon md-font-icon="icon-stackoverflow" class="s20"></md-icon>\n                    Queue: {{call.queue}}\n                  </div>\n                  <div class="text h4 pt-8" ng-if="call.variables.extravar">\n                    <md-icon md-font-icon="icon-minus" class="s20"></md-icon>\n                    Extra: {{call.variables.extravar}}\n                  </div>\n                </div>\n                <div layout="row" layout-align="center end" class="mt-8">\n                  <md-button ng-if="call.disposedAt" type="submit" ng-click="vm.disposeCall($event, call)" class="send-button md-accent md-raised mr-0 mv-0">\n                    {{ \'DASHBOARDS.DISPOSE\' | translate}}\n                  </md-button>\n                </div>\n              </md-card-content>\n            </md-card>\n          </div>\n          <div flex="25" layout="row" layout-md="column" layout-sm="column" layout-align="end center" layout-align-md="center center">\n            <md-button type="submit" ng-click="vm.mergeContact($event)" class="send-button md-raised md-accent ng-scope" ng-if="!vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="merge">\n              <md-tooltip md-direction="top"><span translate="DASHBOARDS.MERGE"></span></md-tooltip>\n              <md-icon md-font-icon="icon-source-fork"></md-icon>\n            </md-button>\n            <md-button type="submit" ng-click="vm.duplicateContact($event)" class="send-button md-raised md-accent ng-scope" ng-if="!vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="duplicate">\n              <md-tooltip md-direction="top"><span translate="DASHBOARDS.DUPLICATE"></span></md-tooltip>\n              <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n            </md-button>\n            <md-button type="submit" ng-click="vm.addNewContact($event)" class="send-button md-accent md-raised" ng-if="vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="add">\n              {{ \'DASHBOARDS.ADD\'| translate }}\n            </md-button>\n            <md-button type="submit" ng-click="vm.saveContact($event)" class="send-button md-accent md-raised" ng-if="!vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="save">\n              {{ \'DASHBOARDS.SAVE\' | translate }}\n            </md-button>\n          </div>\n        </div>\n        <div layout="row">\n          <div layout="column" flex="75">\n            <md-card layout-padding>\n              <div class="h2 secondary-text text-truncate" translate="DASHBOARDS.PERSONAL_INFO">\n                PERSONAL_INFO</div>\n              <div class="subtitle secondary-text">\n                <span translate="CONTACTMANAGER.CREATED_AT"></span>\n                <span>{{vm.contact.createdAt | date:\'medium\'}}</span>\n              </div>\n\n              <form name="vm.detailForm" novalidate>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.FIRSTNAME">First Name</label>\n                      <md-icon md-font-icon="icon-account" class="firstname"></md-icon>\n                      <input type="text" name="firstName" ng-model="vm.contact.firstName" class="text-truncate" required privacy ng-cloak>\n                      <div ng-messages="vm.detailForm.firstName.$error" ng-show="vm.detailForm.firstName.$touched" role="alert">\n                        <div ng-message="required">\n                          <span translate="DASHBOARDS.ERRORS.FIRSTNAME_REQUIRED">First name\n                            field is required</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.jscripty" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="JSCRIPTY PROJECTS" ng-click="$mdOpenMenu($event); vm.getJscriptyProjects();" aria-label="jscripty">\n                          <md-icon md-font-icon="icon-script"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingJscriptyProjects">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingJscriptyProjects && vm.jscriptyProjects.count > 0" ng-repeat="project in vm.jscriptyProjects.rows">\n                            <md-button ng-click="vm.addJscriptyTab(project, $event)">\n                              <md-icon md-font-icon="icon-script"></md-icon>\n                              {{project.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingJscriptyProjects && (!vm.jscriptyProjects || vm.jscriptyProjects.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_JSCRIPTY_PROJECTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-script"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.LASTNAME">Last Name</label>\n                    <input type="text" name="lastName" ng-model="vm.contact.lastName" class="text-truncate" privacy ng-cloak>\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.PHONE">Phone</label>\n                      <md-icon md-font-icon="icon-phone"></md-icon>\n                      <input type="text" name="phone" ng-model="vm.contact.phone" class="text-truncate" privacy ng-cloak>\n                      <div class="hint"><span ng-show="!vm.user.phoneBarRemoteControl || !vm.contact.phone" translate="CONTACTMANAGER.HELP.PHONEBAR_API"></span></div>\n                    </md-input-container>\n                    <div>\n                      \x3c!-- click to call directive --\x3e\n                      <ms-click-to-call target="vm.contact.phone" prefix="vm.list ? vm.list.dialPrefix : null" license="vm.license" type="\'button\'"></ms-click-to-call>\n                      \x3c!--  / click to call directive --\x3e\n                    </div>\n                  </div>\n                  <div flex="5"></div>\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.MOBILE">Mobile</label>\n                      <md-icon md-font-icon="icon-cellphone-iphone"></md-icon>\n                      <input type="text" name="mobile" ng-model="vm.contact.mobile" class="text-truncate" privacy ng-cloak>\n                      <div class="hint"><span ng-show="!vm.user.phoneBarRemoteControl || !vm.contact.mobile" translate="CONTACTMANAGER.HELP.PHONEBAR_API"></span></div>\n                    </md-input-container>\n                    <div>\n                      \x3c!-- click to call directive --\x3e\n                      <ms-click-to-call target="vm.contact.mobile" prefix="vm.list ? vm.list.dialPrefix : null" license="vm.license" type="\'button\'"></ms-click-to-call>\n                      \x3c!--  / click to call directive --\x3e\n                    </div>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.messaging || !vm.hasPermission(107) || !vm.contact.mobile" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW SMS" ng-click="$mdOpenMenu($event); vm.getAccounts(\'sms\')" aria-label="sms">\n                          <md-icon md-font-icon="icon-message-text"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.smsAccounts.count > 0" ng-repeat="account in vm.smsAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Sms\', account, vm.contact.mobile)">\n                              <md-icon md-font-icon="icon-message-text"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.smsAccounts || vm.smsAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_SMS_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-message-text"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.whatsapp || !vm.hasPermission(114) || !vm.contact.mobile" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW WHATSAPP" ng-click="$mdOpenMenu($event); vm.getAccounts(\'whatsapp\')" aria-label="whatsapp">\n                          <md-icon md-font-icon="icon-whatsapp"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.whatsappAccounts.count > 0" ng-repeat="account in vm.whatsappAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Whatsapp\', account, vm.contact.mobile)">\n                              <md-icon md-font-icon="icon-whatsapp"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.whatsappAccounts || vm.whatsappAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_WHATSAPP_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-whatsapp"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.EMAIL">Email</label>\n                      <md-icon md-font-icon="icon-email" class="email"></md-icon>\n                      <input type="email" name="email" ng-model="vm.contact.email" class="text-truncate" privacy ng-cloak>\n                      <div ng-messages="vm.detailForm.firstName.$error" ng-show="vm.detailForm.firstName.$touched" role="alert">\n                        <div ng-message="email">\n                          <span translate="DASHBOARDS.ERRORS.EMAIL_MUST_VALID">Email must be a\n                            valid e-mail address</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.mail || !vm.hasPermission(106) || !vm.contact.email" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW EMAIL" ng-click="$mdOpenMenu($event); vm.getAccounts(\'mail\')" aria-label="email">\n                          <md-icon md-font-icon="icon-email"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.mailAccounts.count > 0" ng-repeat="account in vm.mailAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Mail\', account, vm.contact.email)">\n                              <md-icon md-font-icon="icon-email"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.mailAccounts || vm.mailAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_MAIL_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-email"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                  <div flex="5"></div>\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.FAX">Fax</label>\n                      <md-icon md-font-icon="icon-deskphone"></md-icon>\n                      <input type="text" name="fax" ng-model="vm.contact.fax" privacy ng-cloak>\n                    </md-input-container>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.fax || !vm.hasPermission(109) || !vm.contact.fax" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW FAX" ng-click="$mdOpenMenu($event); vm.getAccounts(\'fax\')" aria-label="fax">\n                          <md-icon md-font-icon="icon-deskphone"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.faxAccounts.count > 0" ng-repeat="account in vm.faxAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Fax\', account, vm.contact.fax)">\n                              <md-icon md-font-icon="icon-deskphone"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.faxAccounts || vm.faxAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_FAX_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-deskphone"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                </div>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <md-chips ng-model="vm.additionalItems" md-transform-chip="vm.newPhone($chip)" placeholder="Phone numbers">\n                      <md-chip-template custom-chip alt="{{$chip.type}}" title="{{$chip.type}}">\n                        {{ $chip.phone }}\n                      </md-chip-template>\n                    </md-chips>\n                  </md-input-container>\n                  <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="25">\n                    <div class="pb-16" layout="row" layout-align="start center">\n                      <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n                    </div>\n                    <form name="additionalPhonesForm" novalidate>\n                      <div ng-repeat="additionalPhone in vm.additionalItems" layout="column">\n                        <md-input-container class="md-block">\n                          <label>{{$index}} - {{additionalPhone.phone}}</label>\n                          <md-select ng-model="vm.additionalItemTypes[$index]">\n                            <md-option ng-repeat="value in vm.contactItemTypes" ng-value="value.id">{{value.name}}</md-option>\n                            <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                          </md-select>\n                        </md-input-container>\n                        <md-input-container class="md-block">\n                          <input ng-model="additionalPhone.description" ng-cloak>\n                        </md-input-container>\n                      </div>\n                    </form>\n                  </div>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.DATE_OF_BIRTH">Date of Birth</label>\n                    <mdp-date-picker mdp-open-on-click mdp-format="YYYY-MM-DD" name="dateOfBirth" ng-model="vm.contact.dateOfBirth"></mdp-date-picker>\n                  </md-input-container>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n                    <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" autofocus>\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.COMPANY">Company</label>\n                    <md-icon md-font-icon="icon-domain" class="email"></md-icon>\n                    <md-select name="company" ng-model="vm.contact.CompanyId">\n                      <md-option ng-value="company.id" ng-repeat="company in vm.tab.companies.rows">{{company.name}}\n                      </md-option>\n                      <md-option ng-value="null"><em translate="DASHBOARDS.NONE">None</em>\n                      </md-option>\n                    </md-select>\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.TAG">TAG</label>\n                    <md-icon md-font-icon="icon-tag"></md-icon>\n                    <md-select ng-model="vm.tab.Tags" multiple>\n                      <md-option ng-value="tag.id" ng-repeat="tag in vm.tab.tags.rows">\n                        {{tag.name}}</md-option>\n                    </md-select>\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.COUNTRY">Country</label>\n                    <md-icon md-font-icon="icon-home" class="country"></md-icon>\n                    <input type="text" name="country" ng-model="vm.contact.country" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.CITY">City</label>\n                    <input type="text" name="city" ng-model="vm.contact.city">\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.STREET">Street</label>\n                    <input type="text" name="street" ng-model="vm.contact.street">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.POSTALCODE">Postal Code</label>\n                    <input type="text" name="postalCode" ng-model="vm.contact.postalCode">\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate translate-attr-placeholder="DASHBOARDS.NOTES">Notes</label>\n                    <md-icon md-font-icon="icon-note"></md-icon>\n                    <textarea ng-model="vm.contact.description" type="text" max-rows="4"></textarea>\n                  </md-input-container>\n                </div>\n              </form>\n            </md-card>\n            <md-card layout-padding>\n              <div class="h2 secondary-text text-truncate" translate="DASHBOARDS.SOCIAL">Social</div>\n              <form name="vm.socialForm" novalidate>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Facebook</label>\n                    <md-icon md-font-icon="icon-facebook" class="facebook"></md-icon>\n                    <input type="text" name="facebook" ng-model="vm.contact.facebook" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Twitter</label>\n                    <md-icon md-font-icon="icon-twitter" class="twitter"></md-icon>\n                    <input type="text" name="twitter" ng-model="vm.contact.twitter" class="text-truncate">\n                  </md-input-container>\n                </div>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Line</label>\n                    <md-icon md-font-icon="fab fa-line"></md-icon>\n                    <input type="text" name="line" ng-model="vm.contact.line" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Viber</label>\n                    <md-icon md-font-icon="fab fa-viber"></md-icon>\n                    <input type="text" name="viber" ng-model="vm.contact.viber" class="text-truncate">\n                  </md-input-container>\n                </div>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>WeChat</label>\n                    <md-icon md-font-icon="fab fa-weixin"></md-icon>\n                    <input type="text" name="wechat" ng-model="vm.contact.wechat" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Telegram</label>\n                    <md-icon md-font-icon="icon-telegram"></md-icon>\n                    <input type="text" name="telegram" ng-model="vm.contact.telegram" class="text-truncate">\n                  </md-input-container>\n                </div>\n              </form>\n            </md-card>\n          </div>\n          <div flex="25" layout="column" layout-padding>\n            <md-card flex="100" layout-padding>\n              <div class="h2 secondary-text text-truncate" translate="DASHBOARDS.CUSTOM_FIELDS">CUSTOM\n                FIELDS</div>\n              <form name="vm.customFieldsForm" novalidate>\n\n                \x3c!-- START INPUT LIST --\x3e\n                <md-input-container class="md-block">\n                  <label translate translate-attr-placeholder="DASHBOARDS.LIST">List</label>\n                  <md-select name="list" ng-disabled="!vm.newContact" ng-model="vm.contact.ListId" ng-change="vm.getCustomFields(vm.contact.ListId)" required>\n                    <md-optgroup label="Lists">\n                      <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">#{{list.id}} - {{list.name}}\n                      </md-option>\n                    </md-optgroup>\n                  </md-select>\n                </md-input-container>\n                \x3c!-- END INPUT LIST --\x3e\n\n                <div ng-repeat="customField in vm.tab.customFields.rows" ng-switch="customField.type">\n                  <md-input-container class="md-block" ng-switch-when="datetime">\n                    <label>{{customField.alias}}<span ng-if="customField.required">*</span></label>\n                    <div ng-init="vm.contact[\'cf_\' + customField.id] = vm.getDateFromString(vm.contact[\'cf_\' + customField.id])">\n                      <mdp-date-picker mdp-open-on-click ng-required="customField.required" mdp-format="YYYY-MM-DD" ng-model="vm.contact[\'cf_\' + customField.id]">\n                      </mdp-date-picker>\n                      <mdp-time-picker mdp-open-on-click mdp-placeholder="Time" ng-required="customField.required" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.contact[\'cf_\' + customField.id]">\n                      </mdp-time-picker>\n                    </div>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="select">\n                    <label>{{customField.alias}}<span ng-if="customField.required">*</span></label>\n                    <md-select ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n                      <md-option ng-repeat="value in customField.values" ng-value="value.value">\n                        {{value.value}}</md-option>\n                      <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em>\n                      </md-option>\n                    </md-select>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="switch">\n                    <md-switch aria-label="{{customField.alias}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-true-value="1" ng-false-value="0">\n                      {{customField.alias}}<span ng-if="customField.required">*</span>\n                    </md-switch>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-default>\n                    <div layout-gt-sm="row" class="layout-gt-sm-row"></div>\n                    <div layout="row" flex>\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label>{{customField.alias}}<span ng-if="customField.required">*</span></label>\n                        <input type="{{customField.type}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n                      </md-input-container>\n                      <ms-click-to-call ng-if="customField.clickToAction && customField.actionType === \'voice\'" target="vm.contact[\'cf_\' + customField.id]" prefix="vm.list ? vm.list.dialPrefix : null" license="vm.license" type="\'button\'"></ms-click-to-call>\n                    </div>\n                  </md-input-container>\n                </div>\n              </form>\n            </md-card>\n          </div>\n        </div>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.CUSTOMER_JOURNEY">Customer Journey</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content class="md-padding" id="journey-content">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'">\n        </div>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n</md-tabs>'),e.put("app/main/apps/dashboards/views/general/agent/contact/dispose/dialog.html",'<md-dialog class="agent-dialog" aria-label="agent dispose">\n  <form name="disposition" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.DISPOSE"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" ng-if="!vm.call.mandatoryDisposition">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div ng-if="!vm.isReschedule">\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.DISPOSITION">Disposition</label>\n          <md-select name="disposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onDispositionChange(\'first\')" required>\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' } : true">\n              {{ disposition.name }}</md-option>\n          </md-select>\n          <div ng-messages="dispositionForm.disposition.$error" ng-show="dispositionForm.disposition.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="DASHBOARDS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n            <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition" ng-change="vm.onDispositionChange(\'second\')">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearDispositionSelection(\'second\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear second level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <div ng-if="vm.secondLevelDisposition && vm.anyThirdLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</label>\n            <md-select name="thirdLevelDisposition" ng-model="vm.thirdLevelDisposition" ng-change="vm.onDispositionChange(\'third\')">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'third\', ParentId: vm.secondLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.thirdLevelDisposition" ng-click="vm.clearDispositionSelection(\'third\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear third level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.NOTE">Note</label>\n          <textarea ng-model="vm.note" md-maxlength="255" max-rows="5" autofocus></textarea>\n        </md-input-container>\n        <md-input-container class="md-block" ng-if="vm.availableCalls === 1">\n          <md-switch ng-model="vm.autoClose" aria-label="Auto Close">\n            <span translate="DASHBOARDS.AUTOCLOSE">Automatically close contact tab after disposal</span>\n          </md-switch>\n        </md-input-container>\n      </div>\n      <div ng-if="vm.isReschedule">\n        <div layout="row">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click required name="date" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-change="vm.recalcTZTime()" mdp-min-date="vm.hopper.minDate" ng-model="vm.hopper.dateTime">\n              <div ng-messages="disposition.date.$error" ng-show="disposition.date.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="DASHBOARDS.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="DASHBOARDS.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click required name="time" mdp-placeholder="Time" ng-change="vm.recalcTZTime()" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.dateTime">\n              <div ng-messages="disposition.time.$error" ng-show="disposition.time.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="DASHBOARDS.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="DASHBOARDS.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </div>\n        <div layout="row">\n          <div flex class="md-block">\n            <md-input-container class="md-block" flex-gt-sm="">\n              <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n              <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" autofocus>\n            </md-input-container>\n          </div>\n          <div flex class="md-block">\n            <md-input-container class="md-block">\n              <label translate="DASHBOARDS.SYSTEM_TIME">System time</label>\n              <input type="text" readonly value="{{vm.hopper.scheduledAt}}">\n            </md-input-container>\n          </div>\n        </div>\n        <div ng-if="(!vm.dialer || (vm.dialer && vm.recallme && vm.user.selectRecallMeCampaign)) && vm.queueCampaigns.rows.length > 0" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.CAMPAIGN">Campaign</label>\n            <md-select name="queueCampaign" ng-model="vm.queueCampaign" required>\n              <md-option ng-value="queueCampaign" ng-repeat="queueCampaign in vm.queueCampaigns.rows">\n                <md-icon md-font-icon="icon-checkbox-blank-circle" ng-class="{\'green-fg\': queueCampaign.dialActive}" aria-label="Status">\n                </md-icon>\n                {{ queueCampaign.name }}\n              </md-option>\n            </md-select>\n            <div ng-messages="disposition.queueCampaign.$error" ng-show="disposition.queueCampaign.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="DASHBOARDS.ERRORS.CAMPAIGN_REQUIRED">Campaign field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions ng-if="!vm.isReschedule" layout="row">\n      <md-button ng-disabled="disposition.$invalid || disposition.$pristine" class="send-button md-raised md-accent" ng-click="vm.saveDisposition()" ms-dialog-spinner>\n        {{(vm.selectedDisposition.name ? \'DASHBOARDS.DISPOSE\' : \'DASHBOARDS.SAVE\') | translate}}\n      </md-button>\n      <md-button class="send-button md-raised md-primary" translate="DASHBOARDS.RESCHEDULE" ng-click="vm.saveDisposition(\'reschedule\')">\n        Reschedule\n      </md-button>\n      <md-button class="send-button md-accent md-raised" translate="DASHBOARDS.RECALLME" ng-click="vm.saveDisposition(\'recallme\')">\n        Recall Me\n      </md-button>\n      <span flex></span>\n      <md-button ng-if="vm.hasBlackLists" class="md-raised md-warn" translate="DASHBOARDS.BLACKLIST" ng-click="vm.saveDisposition(\'blacklist\')">\n        Blacklist\n      </md-button>\n    </md-dialog-actions>\n    <md-dialog-actions ng-if="vm.isReschedule" layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveReschedule()" class="send-button md-accent md-raised" ng-disabled="disposition.$invalid || disposition.$pristine || vm.disable" aria-label="SAVE" translate="DASHBOARDS.SAVE" translate-attr-aria-label="DASHBOARDS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/contact/reschedule/dialog.html",'<md-dialog class="agent-dialog" aria-label="New Agent">\n  <form name="dateTime" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div layout="row">\n        <div flex class="md-block">\n          <mdp-date-picker mdp-open-on-click required name="date" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" mdp-min-date="vm.hopper.minDate" ng-model="vm.hopper.dateTime">\n            <div ng-messages="dateTime.date.$error" ng-show="dateTime.date.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="DASHBOARDS.ERRORS.DATE_REQUIRED">Date is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="DASHBOARDS.ERRORS.DATE_INVALID">Date is invalid</span>\n              </div>\n            </div>\n          </mdp-date-picker>\n        </div>\n\n        <div flex class="md-block">\n          <mdp-time-picker mdp-open-on-click required name="time" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.dateTime">\n            <div ng-messages="dateTime.time.$error" ng-show="dateTime.time.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="DASHBOARDS.ERRORS.TIME_REQUIRED">Time is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="DASHBOARDS.ERRORS.TIME_INVALID">Time is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-disabled="vm.disable" ng-click="vm.saveDialog()" class="send-button md-accent md-raised" ng-disabled="dateTime.$invalid || dateTime.$pristine" aria-label="SAVE" translate="DASHBOARDS.SAVE" translate-attr-aria-label="DASHBOARDS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/contact/selection/dialog.html",'<md-dialog ng-init="vm.onInit()" class="contact-trigger-dialog" aria-label="Select contact" ng-cloak>\n  <md-toolbar class="red-bg">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span class="title">{{ \'DASHBOARDS.SELECT_CONTACT\' | translate }}</span>\n    </div>\n  </md-toolbar>\n  <md-dialog-content class="h-400 pv-16">\n    <div layout="row" class="p-10">\n      <span class="font-size-16">{{ \'DASHBOARDS.MULTIPLE_CONTACTS_FOUND\' | translate }}<strong>&nbsp;{{ vm.callNumber }}</strong>.</span>\n      <span class="font-size-16">&nbsp;{{ \'DASHBOARDS.WHICH_ONE_TO_USE\' | translate }}</span>\n    </div>\n    <md-grid-list md-cols-xs="1" md-cols="2" md-row-height="fit" ng-class="vm.paginatedContacts[vm.page - 1].length > 2 ? \'two-rows-layout\' : \'one-row-layout\'" flex>\n      <md-grid-tile ng-repeat="contact in vm.paginatedContacts[vm.page - 1]" md-rowspan="1">\n        <md-card layout="column" class="contact-info" no-padding no-margin ng-click="vm.selectedContact = contact;" ng-class="{ \'light-blue-50-bg\' : vm.selectedContact && vm.selectedContact.id === contact.id }" flex>\n          <md-card-title class="pt-16">\n            <md-card-title-text layout-align="center start">\n              <span class="font-size-16 text-bold">#{{ contact.id }} -\n                <span privacy ng-cloak>{{ contact.firstName }} {{ contact.lastName }}</span>\n              </span>\n              <em class="font-size-12">{{ \'DASHBOARDS.LAST_UPDATED\' | translate }}: {{ contact.updatedAt }}</em>\n              <span class="font-size-12">{{ \'DASHBOARDS.LIST\' | translate }}: {{ vm.lists[contact.ListId] }}</span>\n            </md-card-title-text>\n            <md-button class="md-icon-button no-margin" aria-label="Selected">\n              <md-icon md-font-icon="{{ vm.selectedContact && vm.selectedContact.id === contact.id ? \'icon-checkbox-marked-circle\' : \'icon-checkbox-blank-circle-outline\' }}" ng-class="{ \'green-fg\': vm.selectedContact && vm.selectedContact.id === contact.id }"></md-icon>\n            </md-button>\n          </md-card-title>\n          <md-divider></md-divider>\n          <md-card-content layout="row" layout-align="center start" class="p-10">\n            <span class="font-size-16">{{ \'DASHBOARDS.MATCHING_FIELD\' | translate }}:\n              <strong privacy ng-cloak>{{ contact.matchingField }}</strong>\n            </span>\n          </md-card-content>\n        </md-card>\n      </md-grid-tile>\n    </md-grid-list>\n  </md-dialog-content>\n  <md-dialog-actions layout="row">\n    <div ng-if="vm.paginatedContacts.length > 1" layout="row" layout-align="center center" flex>\n      <md-button ng-click="vm.page = vm.page - 1;" class="md-icon-button no-margin" ng-class="{ \'hidden\': vm.page <= 1 }" aria-label="Previous page">\n        <md-icon md-font-icon="icon-chevron-double-left"></md-icon>\n      </md-button>\n      <span>{{ \'DASHBOARDS.PAGE\' | translate }} {{ vm.page }} {{ \'DASHBOARDS.OF\' | translate }}\n        {{ vm.paginatedContacts.length }}</span>\n      <md-button ng-click="vm.page = vm.page + 1;" class="md-icon-button no-margin" ng-class="{ \'hidden\': !vm.paginatedContacts[vm.page] }" aria-label="Next page">\n        <md-icon md-font-icon="icon-chevron-double-right"></md-icon>\n      </md-button>\n    </div>\n    <md-button ng-click="vm.selectContact()" class="select-button md-accent md-raised" ng-disabled="!vm.selectedContact" aria-label="Select" translate="DASHBOARDS.SELECT" translate-attr-aria-label="DASHBOARDS.SELECT">\n      SELECT\n    </md-button>\n  </md-dialog-actions>\n</md-dialog>vc'),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/agent.general.abandoned.html",'<div ng-cloak>\n  <md-content>\n    <md-tabs md-selected="vm.selectedTab" md-dynamic-height md-border-bottom>\n      <md-tab ng-if="vm_home.hasPermission(110)" label="{{\'DASHBOARDS.VOICE\' | translate}}">\n        <md-content ng-if="vm.selectedTab === 0" ng-include="\'app/main/apps/dashboards/views/general/agent/home/abandoned/voice/agent.general.abandoned.voice.html\'" ng-controller="AgentHomeAbandonedVoiceController as vm_voice">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(110) && vm_home.license.dialer" label="{{\'DASHBOARDS.MOTION_BULL\' | translate}}">\n        <md-content ng-if="vm.selectedTab === 1" ng-include="\'app/main/apps/dashboards/views/general/agent/home/abandoned/bull/agent.general.abandoned.bull.html\'" ng-controller="AgentHomeAbandonedBullController as vm_bull">\n        </md-content>\n      </md-tab>\n    </md-tabs>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/bull/agent.general.abandoned.bull.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header blue-bg" ng-class="{\'h-128\' : vm_bull.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n      <ms-search-bar on-search="vm_bull.getAbandonedCalls()" query="vm_bull.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm_bull.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm_bull.quickFilters" query="vm_bull.query" search="vm_bull.getAbandonedCalls()"></ms-quick-filter>\n      <md-button class="md-icon-button reload-list" ng-click="vm_bull.refresh && vm_bull.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip ng-if="vm_bull.showTooltip" md-visible="vm_bull.showTooltip">\n          {{\'DASHBOARDS.CLICKRELOAD\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm_bull.promise">\n      <thead md-head md-order="vm_bull.query.sort" md-on-reorder="vm_bull.getAbandonedCalls">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n          <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n          <th md-column md-order-by="queuecallerexitAt">{{\'DASHBOARDS.QUEUECALLEREXITAT\' | translate}}</th>\n          <th md-column md-order-by="queuecallerexitreason">{{\'DASHBOARDS.QUEUECALLEREXITREASON\' | translate}}\n          </th>\n          <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="secondDisposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="thirdDisposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.RESERVED\' | translate}}</th>\n          <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm_bull.abandonedCalls.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="abandonedCall in vm_bull.abandonedCalls.rows">\n          <td md-cell class="id">{{abandonedCall.id}}</td>\n          <td md-cell class="firstName" privacy ng-cloak>{{abandonedCall.calleridname}}</td>\n          <td md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="abandonedCall.calleridnum" license="vm_home.license" disabled="abandonedCall.lastAssignedTo !== vm_bull.currentUser.name">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="list">{{vm_bull.queuesMap[abandonedCall.queue]}}</td>\n          <td md-cell class="list">\n            {{abandonedCall.queuecallerabandonAt ? (abandonedCall.queuecallerabandonAt | formatdate) : (abandonedCall.queuecallerexitAt | formatdate) }}\n          </td>\n          <td md-cell class="list">\n            {{abandonedCall.queuecallerexitAt ? (abandonedCall.queuecallerexitAt | formatdate) : undefined }}\n          </td>\n          <td md-cell class="list">{{abandonedCall.queuecallerexitreason}}</td>\n          <td md-cell class="list">{{ abandonedCall.disposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.secondDisposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.thirdDisposition }}</td>\n          <td md-cell class="actions">\n            <md-switch no-margin ng-if="abandonedCall.lastAssignedTo === vm_bull.currentUser.name || !abandonedCall.lastAssignedTo" ng-disabled="vm_bull.disable[abandonedCall.id]" ng-model="abandonedCall.assigned" aria-label="reserved" ng-change="vm_bull.reserved(abandonedCall)">\n            </md-switch>\n          </td>\n          <td md-cell class="list">{{abandonedCall.lastAssignedTo}}</td>\n          <td md-cell class="actions">\n            <md-menu ng-if="abandonedCall.lastAssignedTo === vm_bull.currentUser.name">\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="1">\n                <md-menu-item>\n                  <md-button ng-click="vm_bull.dispose(abandonedCall)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm_bull.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_bull.query.page" md-total="{{vm_bull.abandonedCalls.count}}" md-on-paginate="vm_bull.getAbandonedCalls" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",'<md-dialog class="agent-dialog" aria-label="agent dispose">\n  <form name="disposition" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.DISPOSE"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div>\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.DISPOSITION">Disposition</label>\n          <md-select name="disposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onDispositionChange(\'first\')" required>\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' } : true">\n              {{ disposition.name }}</md-option>\n          </md-select>\n          <div ng-messages="dispositionForm.disposition.$error" ng-show="dispositionForm.disposition.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="DASHBOARDS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n            <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition" ng-change="vm.onDispositionChange(\'second\')">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearDispositionSelection(\'second\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear second level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <div ng-if="vm.secondLevelDisposition && vm.anyThirdLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</label>\n            <md-select name="thirdLevelDisposition" ng-model="vm.thirdLevelDisposition" ng-change="vm.onDispositionChange(\'third\')">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'third\', ParentId: vm.secondLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.thirdLevelDisposition" ng-click="vm.clearDispositionSelection(\'third\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear third level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.NOTE">Note</label>\n          <textarea ng-model="vm.note" md-maxlength="255" max-rows="5" autofocus></textarea>\n        </md-input-container>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button ng-disabled="disposition.$invalid || disposition.$pristine" class="send-button md-raised md-accent" ng-click="vm.saveDisposition()">\n'+"          {{(vm.selectedDisposition.name ? 'DASHBOARDS.DISPOSE' : 'DASHBOARDS.SAVE') | translate}}\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>"),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/voice/agent.general.abandoned.voice.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header blue-bg" ng-class="{\'h-128\' : vm_voice.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n      <ms-search-bar on-search="vm_voice.getAbandonedCalls()" query="vm_voice.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm_voice.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm_voice.quickFilters" query="vm_voice.query" search="vm_voice.getAbandonedCalls()"></ms-quick-filter>\n      <md-button class="md-icon-button reload-list" ng-click="vm_voice.refresh && vm_voice.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip ng-if="vm_voice.showTooltip" md-visible="vm_voice.showTooltip">\n          {{\'DASHBOARDS.CLICKRELOAD\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm_voice.promise">\n      <thead md-head md-order="vm_voice.query.sort" md-on-reorder="vm_voice.getAbandonedCalls">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n          <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n          <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="secondDisposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="thirdDisposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.RESERVED\' | translate}}</th>\n          <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm_voice.abandonedCalls.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="abandonedCall in vm_voice.abandonedCalls.rows">\n          <td md-cell class="id">{{abandonedCall.id}}</td>\n          <td md-cell class="firstName" privacy ng-cloak>{{abandonedCall.calleridname}}</td>\n          <td md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="abandonedCall.calleridnum" license="vm_home.license" disabled="abandonedCall.lastAssignedTo !== vm_voice.currentUser.name">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="list">{{vm_voice.queuesMap[abandonedCall.queue]}}</td>\n          <td md-cell class="list">\n            {{abandonedCall.queuecallerabandonAt ? (abandonedCall.queuecallerabandonAt | formatdate) : (abandonedCall.queuecallerexitAt | formatdate) }}\n          </td>\n          <td md-cell class="list">{{ abandonedCall.disposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.secondDisposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.thirdDisposition }}</td>\n          <td md-cell class="actions">\n            <md-switch no-margin ng-if="abandonedCall.lastAssignedTo === vm_voice.currentUser.name || !abandonedCall.lastAssignedTo" ng-disabled="vm_voice.disable[abandonedCall.id]" ng-model="abandonedCall.assigned" aria-label="reserved" ng-change="vm_voice.reserved(abandonedCall)">\n            </md-switch>\n          </td>\n          <td md-cell class="list">{{abandonedCall.lastAssignedTo}}</td>\n          <td md-cell class="actions">\n            <md-menu ng-if="abandonedCall.lastAssignedTo === vm_voice.currentUser.name">\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="1">\n                <md-menu-item>\n                  <md-button ng-click="vm_voice.dispose(abandonedCall)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm_voice.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_voice.query.page" md-total="{{vm_voice.abandonedCalls.count}}" md-on-paginate="vm_voice.getAbandonedCalls" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/agent.general.home.html",'<div layout="column" layout-align="start center" class="agent-general-home-navbar md-primary-bg width-50">\n  <div ng-repeat="node in vm_home.navigation">\n    <div ng-repeat="home in node.children">\n      <md-button ng-repeat="button in home.children  | orderBy:\'weight\'" ng-if="!button.hidden()" class="md-raised width-50 height-50 no-margin" style="border-radius: 0px" aria-label="{{button.state}}" ng-click="vm_home.changeSidebarTab(button)" ng-class="{\'md-primary\': vm_home.sidebar != button.state}">\n        <md-tooltip md-direction="right" md-delay="500"><span translate="{{button.translate}}"></span>\n        </md-tooltip>\n        <md-icon md-font-icon="{{button.icon}}" ng-class="button.iconClass"></md-icon>\n      </md-button>\n    </div>\n  </div>\n</div>\n<div class="agent-general-home-sections" layout="column" flex>\n  <div layout="column" flex>\n    <div ng-switch="vm_home.sidebar" style="overflow-y: auto; overflow-x: hidden" flex>\n      <div ng-switch-when="agentPresence" class="home-agent-presence">\n        <div ng-if="vm_home.hasPermission(115)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/presence/agent.general.presence.html\'" ng-controller="AgentHomePresenceController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(115)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="contacts" class="home-contacts">\n        <div ng-if="vm_home.hasPermission(102) && vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/contacts/agent.general.contacts.html\'" ng-controller="AgentHomeContactsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(102) || !vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="mycontacts" class="home-mycontacts">\n        <div ng-if="vm_home.hasPermission(103) && vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/mycontacts/agent.general.mycontacts.html\'" ng-controller="AgentHomeMyContactsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(103) || !vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="scheduled" class="home-scheduled">\n        <div ng-if="vm_home.hasPermission(113) && vm_home.license.dialer" ng-include="\'app/main/apps/dashboards/views/general/agent/home/scheduled/agent.general.scheduled.html\'" ng-controller="AgentHomeScheduledCallsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(113) || !vm_home.license.dialer" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="voice" class="home-voice">\n        <div ng-if="vm_home.hasPermission(110) && vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/voice/agent.general.voice.html\'" ng-controller="AgentHomeVoiceController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(110) || !vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="abandoned" class="home-abandoned">\n        <div ng-if="vm_home.hasPermission(111) && vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/abandoned/agent.general.abandoned.html\'" ng-controller="AgentHomeAbandonedController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(111) || !vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="recordings" class="home-recordings">\n        <div ng-if="vm_home.hasPermission(104) && vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/recordings/agent.general.recordings.html\'" ng-controller="AgentHomeRecordingsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(104) || !vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="chat" class="home-chat">\n        <div ng-if="vm_home.hasPermission(105) && vm_home.license.chat" ng-include="\'app/main/apps/dashboards/views/general/agent/home/chat/agent.general.chat.html\'" ng-controller="AgentHomeChatController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(105) || !vm_home.license.chat" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="mail" class="home-mail">\n        <div ng-if="vm_home.hasPermission(106) && vm_home.license.mail" ng-include="\'app/main/apps/dashboards/views/general/agent/home/mail/agent.general.mail.html\'" ng-controller="AgentHomeMailController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(106) || !vm_home.license.mail" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="sms" class="home-sms">\n        <div ng-if="vm_home.hasPermission(107) && vm_home.license.messaging" ng-include="\'app/main/apps/dashboards/views/general/agent/home/sms/agent.general.sms.html\'" ng-controller="AgentHomeSmsController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(107) || !vm_home.license.messaging" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="openchannel" class="home-openchannel">\n        <div ng-if="vm_home.hasPermission(108) && vm_home.license.openchannel" ng-include="\'app/main/apps/dashboards/views/general/agent/home/openchannel/agent.general.openchannel.html\'" ng-controller="AgentHomeOpenchannelController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(108) || !vm_home.license.openchannel" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="fax" class="home-fax">\n        <div ng-if="vm_home.hasPermission(109) && vm_home.license.fax" ng-include="\'app/main/apps/dashboards/views/general/agent/home/fax/agent.general.fax.html\'" ng-controller="AgentHomeFaxController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(109) || !vm_home.license.fax" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="whatsapp" class="home-whatsapp">\n        <div ng-if="vm_home.hasPermission(114) && vm_home.license.whatsapp" ng-include="\'app/main/apps/dashboards/views/general/agent/home/whatsapp/agent.general.whatsapp.html\'" ng-controller="AgentHomeWhatsappController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(114) || !vm_home.license.whatsapp" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="plugin" class="home-plugin" layout-fill>\n        <div ng-if="vm_home.hasPermission(vm_home.pluginId)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/plugins/agent.general.plugins.html\'" ng-controller="AgentHomePluginsController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting, vm_home.plugin)" layout-fill></div>\n        <div ng-if="!vm_home.hasPermission(vm_home.pluginId)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-default class="home-default">\n        <div ng-if="vm_home.hasPermission(101)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/agent.general.dashboard.html\'" ng-controller=" AgentHomeDashboardController  as vm"></div>\n        <div ng-if="!vm_home.hasPermission(101)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n    </div>\n  </div>\n  <div ng-if="(vm_home.draftManager.drafts | json) != \'{}\'" layout="column" class="draft-manager-bar">\n    <ms-tab-scroll>\n      <div layout="column" ng-repeat="(key, draft) in vm_home.draftManager.drafts" class="grey-50-bg" ng-click="vm_home.draftManager.open(draft.id)">\n        <div class="draft-manager-tab" layout="row" layout-align="space-between center">\n          <md-icon md-font-icon="icon-pencil" class="icon s16 margin-horizontal-5 black-fg"></md-icon>\n          <span class="text-truncate font-size-12 black-fg">{{draft.title}}</span>\n          <md-button class="md-icon-button md-mini no-margin md-primary" aria-label="close" ng-click="vm_home.draftManager.remove(draft.id)">\n            <md-icon md-font-icon="icon-close-circle-outline" class="icon s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </ms-tab-scroll>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html",'<md-content layout="row" layout-align="space-around center" flex layout-padding layout-wrap>\n  <div layout="column" layout-align="space-around center" flex="50">\n    <span class="font-size-40 text-center">{{ \'DASHBOARDS.WELCOME_TO_MOTION\' | translate }}!</span>\n    <span class="font-size-30 text-center" translate="DASHBOARDS.WELCOME_MESSAGE">Use the left sidebar to navigate through available sections.</span>\n  </div>\n\n  <div layout="column" flex="50">\n    <img src="assets/images/avatars/permissions.png" alt="permissions">\n  </div>\n</md-content>'),e.put("app/main/apps/dashboards/views/general/agent/home/chat/agent.general.chat.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.CHAT_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getChatInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getChatInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getChatInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChatInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.WEBSITE\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.chatInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.chatInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell class="chatAccount">\n            {{ vm.getChatWebsiteLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showChatInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Chat\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions && vm.user.downloadAttachments">\n                  <md-button ng-click="vm.downloadChatInteraction($event, interaction, true)" translate="CHAT.DOWNLOAD_WITH_ATTACHMENTS">\n                    Download with attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadChatInteraction($event, interaction)" translate="CHAT.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                    Download without attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chatInteractions.count}}" md-on-paginate="vm.getChatInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/contacts/agent.general.contacts.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.CONTACTS">Contacts</span>\n      <ms-search-bar on-search="vm.getContacts()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getContacts()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" ng-click="vm.refreshContacts($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button ng-if="vm.lists.rows && vm.lists.rows.length" class="md-icon-button create-new" ng-click="vm.openContact()" aria-label="Add contact" translate translate-attr-label="DASHBOARDS.ADD_CONTACT">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContacts">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="firstName">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="phone">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="mobile">{{\'DASHBOARDS.MOBILE\' | translate}}</th>\n          <th md-column md-order-by="fax">{{\'DASHBOARDS.FAX\' | translate}}</th>\n          <th md-column md-order-by="email">{{\'DASHBOARDS.EMAIL\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.CREATEDAT\' | translate}}</th>\n          <th md-column md-order-by="ListId">{{\'DASHBOARDS.LIST\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.contacts.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="contact in vm.contacts.rows">\n          <td ng-click="vm.openContact(contact.id)" md-cell class="id">{{contact.id}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="firstName" privacy ng-cloak>{{contact.firstName}}\n            {{contact.lastName}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.phone" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="mobile">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.mobile" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="fax" privacy ng-cloak>{{contact.fax}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="email" privacy ng-cloak>{{contact.email}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="createdAt">{{contact.createdAt | formatdate}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="list">{{vm.listsMap[contact.ListId].name}}\n          <td md-cell class="tag">\n            <div ng-if="contact.Tags.length">\n              <div ng-if="contact.Tags.length == 1" layout="column" layout-align="center center">\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': contact.Tags[0].color }"></md-icon>\n                <span class="text-truncate">{{contact.Tags[0].name}}</span>\n              </div>\n              <div ng-if="contact.Tags.length > 1" layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in contact.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag"></md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.openContact(contact.id)" translate="DASHBOARDS.EDIT">\n                    Edit Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.mergeContact($event, contact)" translate="DASHBOARDS.MERGE">\n                    Merge Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.duplicateContact($event, contact)" translate="DASHBOARDS.DUPLICATE">\n                    Duplicate Contact\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contacts.count}}" md-on-paginate="vm.getContacts" md-page-select></md-table-pagination>\n\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/agent.general.dashboard.html",'<div ng-cloak>\n  <md-content>\n    <md-tabs md-dynamic-height md-border-bottom>\n      <md-tab ng-if="vm_home.hasPermission(110) && vm_home.license.voice" label="{{\'DASHBOARDS.VOICE\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/voice/agent.general.dashboard.voice.html\'" ng-controller="AgentHomeDashboardVoiceController as vm_voice" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(110) && vm_home.license.dialer" label="{{\'DASHBOARDS.MOTION_BULL\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/bull/agent.general.dashboard.bull.html\'" ng-controller="AgentHomeDashboardBullController as vm_bull" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(105) && vm_home.license.chat" label="{{\'DASHBOARDS.CHAT\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/chat/agent.general.dashboard.chat.html\'" ng-controller="AgentHomeDashboardMultiChannelChatController as vm_chat" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(106) && vm_home.license.mail" label="{{\'DASHBOARDS.MAIL\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/mail/agent.general.dashboard.mail.html\'" ng-controller="AgentHomeDashboardMultiChannelMailController as vm_mail" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(107) && vm_home.license.messaging" label="{{\'DASHBOARDS.SMS\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/sms/agent.general.dashboard.sms.html\'" ng-controller="AgentHomeDashboardMultiChannelSmsController as vm_sms" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(108) && vm_home.license.openchannel" label="{{\'DASHBOARDS.OPENCHANNEL\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/openchannel/agent.general.dashboard.openchannel.html\'" ng-controller="AgentHomeDashboardMultiChannelOpenchannelController as vm_openchannel" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(109) && vm_home.license.fax" label="{{\'DASHBOARDS.FAX\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/fax/agent.general.dashboard.fax.html\'" ng-controller="AgentHomeDashboardMultiChannelFaxController as vm_fax" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(114) && vm_home.license.whatsapp" label="{{\'DASHBOARDS.WHATSAPP\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/whatsapp/agent.general.dashboard.whatsapp.html\'" ng-controller="AgentHomeDashboardMultiChannelWhatsappController as vm_whatsapp" class="md-padding">\n        </md-content>\n      </md-tab>\n    </md-tabs>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/bull/agent.general.dashboard.bull.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header red-900-bg">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="VOICE.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_bull.promise">\n        <thead md-head md-order="vm_bull.query.sort" md-on-reorder="vm_bull.getVoiceQueues">\n          <tr md-row>\n            <th md-column>{{ \'VOICE.NAME\' | translate }}</th>\n            <th md-column>{{ \'VOICE.TYPE\' | translate }}</th>\n            <th md-column>{{ \'VOICE.WAITING\' | translate }}</th>\n            <th ng-if="voiceQueue.type === \'outbound\'" md-column>{{ \'VOICE.ACTIVE\' | translate }}</th>\n            \x3c!-- <th md-column md-order-by="active">{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_bull.getSize(vm_bull.voiceQueues)">\n            <td md-cell colspan="4">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, voiceQueue) in vm_bull.voiceQueues">\n            <td md-cell class="name">{{voiceQueue.name}}</td>\n            <td ng-if="voiceQueue.type === \'outbound\'" md-cell class="waiting">{{voiceQueue.dialMethod}}</td>\n            <td md-cell class="waiting">{{voiceQueue.waiting || 0}}</td>\n            <td md-cell ng-if="voiceQueue.type === \'outbound\'" class="dialActive ">\n              <md-icon md-colors="{color: {{voiceQueue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{voiceQueue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n            </td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_bull.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_bull.query.page" md-total="{{vm_bull.voiceQueuesTotal}}" md-on-paginate="vm_bull.getVoiceQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header red-900-bg">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'VOICE.DID\' | translate }}</th>\n            <th md-column>{{ \'VOICE.QUEUE\' | translate }}</th>\n            <th md-column>{{ \'VOICE.CALLER\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_bull.getSize(vm_bull.rpcVoiceQueuesChannels)">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, channel) in vm_bull.rpcVoiceQueuesChannels | limitObjectFromTo: vm_bull.queryChannels.limit:(vm_bull.queryChannels.page - 1) * vm_bull.queryChannels.limit">\n            <td md-cell>{{channel.exten}}</td>\n            <td md-cell>{{channel.queue}}</td>\n            <td md-cell privacy ng-cloak>{{channel.calleridnum}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_bull.queryChannels.limit" md-page="vm_bull.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_bull.getSize(vm_bull.rpcVoiceQueuesChannels)}}" md-page-select>\n    </md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/chat/agent.general.dashboard.chat.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_chat.getColorByChannel(\'chat\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_chat.promise">\n        <thead md-head md-order="vm_chat.query.sort" md-on-reorder="vm_chat.getChatQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_chat.getSize(vm_chat.chatQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_chat.chatQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_chat.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_chat.query.page" md-total="{{vm_chat.chatQueuesTotal}}" md-on-paginate="vm_chat.getChatQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_chat.getColorByChannel(\'chat\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_chat.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_chat.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_chat.queryChannels.limit" md-page="vm_chat.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_chat.paginatedInteractions.length}}" md-on-paginate="vm_chat.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/fax/agent.general.dashboard.fax.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_fax.getColorByChannel(\'fax\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_fax.promise">\n        <thead md-head md-order="vm_fax.query.sort" md-on-reorder="vm_fax.getFaxQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_fax.getSize(vm_fax.faxQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_fax.faxQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_fax.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_fax.query.page" md-total="{{vm_fax.faxQueuesTotal}}" md-on-paginate="vm_fax.getFaxQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_fax.getColorByChannel(\'fax\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_fax.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_fax.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_fax.queryChannels.limit" md-page="vm_fax.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_fax.paginatedInteractions.length}}" md-on-paginate="vm_fax.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/mail/agent.general.dashboard.mail.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_mail.getColorByChannel(\'mail\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_mail.promise">\n        <thead md-head md-order="vm_mail.query.sort" md-on-reorder="vm_mail.getMailQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_mail.getSize(vm_mail.mailQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_mail.mailQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_mail.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_mail.query.page" md-total="{{vm_mail.mailQueuesTotal}}" md-on-paginate="vm_mail.getMailQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_mail.getColorByChannel(\'mail\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_mail.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_mail.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_mail.queryChannels.limit" md-page="vm_mail.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_mail.paginatedInteractions.length}}" md-on-paginate="vm_mail.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/openchannel/agent.general.dashboard.openchannel.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_openchannel.getColorByChannel(\'openchannel\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_openchannel.promise">\n        <thead md-head md-order="vm_openchannel.query.sort" md-on-reorder="vm_openchannel.getOpenchannelQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_openchannel.getSize(vm_openchannel.openchannelQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_openchannel.openchannelQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_openchannel.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_openchannel.query.page" md-total="{{vm_openchannel.openchannelQueuesTotal}}" md-on-paginate="vm_openchannel.getOpenchannelQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_openchannel.getColorByChannel(\'openchannel\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_openchannel.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_openchannel.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_openchannel.queryChannels.limit" md-page="vm_openchannel.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_openchannel.paginatedInteractions.length}}" md-on-paginate="vm_openchannel.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/sms/agent.general.dashboard.sms.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_sms.getColorByChannel(\'sms\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_sms.promise">\n        <thead md-head md-order="vm_sms.query.sort" md-on-reorder="vm_sms.getSmsQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_sms.getSize(vm_sms.smsQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_sms.smsQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_sms.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_sms.query.page" md-total="{{vm_sms.smsQueuesTotal}}" md-on-paginate="vm_sms.getSmsQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_sms.getColorByChannel(\'sms\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_sms.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_sms.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_sms.queryChannels.limit" md-page="vm_sms.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_sms.paginatedInteractions.length}}" md-on-paginate="vm_sms.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/voice/agent.general.dashboard.voice.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header blue-A700-bg ">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="VOICE.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_voice.promise">\n        <thead md-head md-order="vm_voice.query.sort" md-on-reorder="vm_voice.getVoiceQueues">\n          <tr md-row>\n            <th md-column>{{ \'VOICE.NAME\' | translate }}</th>\n            <th md-column>{{ \'VOICE.WAITING\' | translate }}</th>\n            <th ng-if="voiceQueue.type === \'outbound\'" md-column>{{ \'VOICE.ACTIVE\' | translate }}</th>\n            \x3c!-- <th md-column md-order-by="active">{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_voice.getSize(vm_voice.voiceQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, voiceQueue) in vm_voice.voiceQueues">\n            <td md-cell class="name">{{voiceQueue.name}}</td>\n            <td ng-if="voiceQueue.type === \'outbound\'" md-cell class="waiting">{{voiceQueue.dialMethod}}</td>\n            <td md-cell class="waiting">{{voiceQueue.waiting || 0}}</td>\n            <td md-cell ng-if="voiceQueue.type === \'outbound\'" class="dialActive ">\n              <md-icon md-colors="{color: {{voiceQueue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{voiceQueue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n            </td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_voice.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_voice.query.page" md-total="{{vm_voice.voiceQueuesTotal}}" md-on-paginate="vm_voice.getVoiceQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header blue-A700-bg ">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'VOICE.DID\' | translate }}</th>\n            <th md-column>{{ \'VOICE.QUEUE\' | translate }}</th>\n            <th md-column>{{ \'VOICE.CALLER\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_voice.getSize(vm_voice.rpcVoiceQueuesChannels)">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, channel) in vm_voice.rpcVoiceQueuesChannels | limitObjectFromTo: vm_voice.queryChannels.limit:(vm_voice.queryChannels.page - 1) * vm_voice.queryChannels.limit">\n            <td md-cell>{{channel.exten}}</td>\n            <td md-cell>{{channel.queue}}</td>\n            <td md-cell privacy ng-cloak>{{channel.calleridnum}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_voice.queryChannels.limit" md-page="vm_voice.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_voice.getSize(vm_voice.rpcVoiceQueuesChannels)}}" md-page-select>\n    </md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/whatsapp/agent.general.dashboard.whatsapp.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_whatsapp.getColorByChannel(\'whatsapp\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_whatsapp.promise">\n        <thead md-head md-order="vm_whatsapp.query.sort" md-on-reorder="vm_whatsapp.getWhatsappQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_whatsapp.getSize(vm_whatsapp.whatsappQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_whatsapp.whatsappQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_whatsapp.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_whatsapp.query.page" md-total="{{vm_whatsapp.whatsappQueuesTotal}}" md-on-paginate="vm_whatsapp.getWhatsappQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_whatsapp.getColorByChannel(\'whatsapp\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_whatsapp.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_whatsapp.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_whatsapp.queryChannels.limit" md-page="vm_whatsapp.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_whatsapp.paginatedInteractions.length}}" md-on-paginate="vm_whatsapp.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/fax/agent.general.fax.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.FAX_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getFaxInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getFaxInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getFaxInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.faxAccounts.rows && vm.faxAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="faxAccount in vm.faxAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeFaxInteraction($event, faxAccount)">\n              {{ faxAccount.name }} ({{ faxAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.faxInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.faxInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell class="faxAccount">\n            {{ vm.getFaxAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showFaxInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Fax\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadFaxInteraction($event, interaction)" translate="DASHBOARDS.DOWNLOAD">\n                    Download Fax\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.faxInteractions.count}}" md-on-paginate="vm.getFaxInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/mail/agent.general.mail.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.MAIL_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getMailInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getMailInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getMailInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.mailAccounts.rows && vm.mailAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="mailAccount in vm.mailAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeMailInteraction($event, mailAccount)">\n              {{ mailAccount.name }} ({{ mailAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="subject">{{\'DASHBOARDS.SUBJECT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.mailInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.mailInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <div ng-if="vm.setting.enableEmailPreview && interaction.lastMsgText" class="tooltip-preview" ng-mouseleave="vm.resetTooltipPosition($event)" ng-mouseenter="vm.adjustTooltipPosition($event)">\n              <span class="text-truncate font-size-12 subject-text">{{ interaction.subject }}</span>\n              <md-card class="tooltip-preview-text">\n                <md-card-content><span class="email-preview-message">{{ interaction.lastMsgText }}</span>\n                </md-card-content>\n              </md-card>\n            </div>\n            <span ng-if="!interaction.lastMsgText || !vm.setting.enableEmailPreview"><span class="text-truncate font-size-12 subject-text">{{ interaction.subject }}</span></span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell class="mailAccount">\n            {{ vm.getMailAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showMailInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Mail\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions && vm.user.downloadAttachments">\n                  <md-button ng-click="vm.downloadMailInteraction($event, interaction, true)" translate="MAIL.DOWNLOAD_WITH_ATTACHMENTS">\n                    Download with attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadMailInteraction($event, interaction)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                    Download without attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailInteractions.count}}" md-on-paginate="vm.getMailInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/mycontacts/agent.general.mycontacts.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.MYCONTACTS">My Contacts</span>\n      <ms-search-bar on-search="vm.getContacts()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getContacts()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" ng-click="vm.refreshContacts($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button ng-if="vm.lists.rows && vm.lists.rows.length" class="md-icon-button create-new" ng-click="vm.openContact($event)" aria-label="Add contact" translate translate-attr-label="DASHBOARDS.ADD_CONTACT">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContacts">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="firstName">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="phone">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="mobile">{{\'DASHBOARDS.MOBILE\' | translate}}</th>\n          <th md-column md-order-by="fax">{{\'DASHBOARDS.FAX\' | translate}}</th>\n          <th md-column md-order-by="email">{{\'DASHBOARDS.EMAIL\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.CREATEDAT\' | translate}}</th>\n          <th md-column md-order-by="ListId">{{\'DASHBOARDS.LIST\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.contacts.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="contact in vm.contacts.rows">\n          <td ng-click="vm.openContact($event, contact)" md-cell class="id">{{contact.id}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="firstName" privacy ng-cloak>\n            {{contact.firstName}} {{contact.lastName}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.phone" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="mobile">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.mobile" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="fax" privacy ng-cloak>\n            {{contact.fax}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="email" privacy ng-cloak>{{contact.email}}\n          </td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="createdAt">{{contact.createdAt |\n            formatdate}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="list">\n            {{vm.listsMap[contact.ListId].name}}</td>\n          <td md-cell class="tag">\n            <div ng-if="contact.Tags.length">\n              <div ng-if="contact.Tags.length == 1" layout="column" layout-align="center center">\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': contact.Tags[0].color }"></md-icon>\n                <span class="text-truncate">{{contact.Tags[0].name}}</span>\n              </div>\n              <div ng-if="contact.Tags.length > 1" layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in contact.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag"></md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.openContact($event, contact)" translate="DASHBOARDS.EDIT">\n                    Edit Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.mergeContact($event, contact)" translate="DASHBOARDS.MERGE">\n                    Merge Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.duplicateContact($event, contact)" translate="DASHBOARDS.DUPLICATE">\n                    Duplicate Contact\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contacts.count}}" md-on-paginate="vm.getContacts" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/openchannel/agent.general.openchannel.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.OPENCHANNEL_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getOpenchannelInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getOpenchannelInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getOpenchannelInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.openchannelAccounts.rows && vm.openchannelAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="openchannelAccount in vm.openchannelAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeOpenchannelInteraction($event, openchannelAccount)" ng-disabled="!openchannelAccount.replyUri">\n              {{ openchannelAccount.name }} ({{ openchannelAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOpenchannelInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.openchannelInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.openchannelInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell class="openchannelAccount">\n            {{ vm.getOpenchannelAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showOpenchannelInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Openchannel\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions && vm.user.downloadAttachments">\n                  <md-button ng-click="vm.downloadOpenchannelInteraction($event, interaction, true)" translate="OPENCHANNEL.DOWNLOAD_WITH_ATTACHMENTS">\n                    Download with attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadOpenchannelInteraction($event, interaction)" translate="OPENCHANNEL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                    Download without attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.openchannelInteractions.count}}" md-on-paginate="vm.getOpenchannelInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/plugins/agent.general.plugins.html",'<div id="plugin" ng-if="vm.plugin" ng-cloak layout-fill>\n  <iframe ng-src="{{vm.getTrustedURL()}}" frameborder=0 style="border:0px; width:100%; height:100%;"></iframe>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/presence/agent.general.presence.html",'<div ng-cloak>\n  <md-content>\n    <md-tabs md-selected="vm.selectedTab" md-dynamic-height md-border-bottom>\n      <md-tab label="{{\'DASHBOARDS.AGENTS\' | translate}}" md-on-select="vm.onAgentsTabSelection()">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.agents.html\'">\n        </md-content>\n      </md-tab>\n      <md-tab label="{{\'DASHBOARDS.QUEUES\' | translate}}" md-on-select="vm.onQueuesTabSelection()">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.queues.html\'">\n        </md-content>\n      </md-tab>\n    </md-tabs>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.agents.html",'<md-card ngCloak>\n  <md-toolbar class="md-table-toolbar md-default table-header xenialab-violet-light-bg" ng-class="{\'h-128\' : vm.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.AGENTS"></span>\n      <ms-search-bar on-search="vm.getAgents()" query="vm.agentsQuery" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.agentsQuery" search="vm.getAgents()"></ms-quick-filter>\n      <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getAgents()">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.agentsQuery.sort" md-on-reorder="vm.getAgents">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="name">{{\'DASHBOARDS.NAME\' | translate}}</th>\n          <th md-column md-order-by="internal">{{\'VOICE.INTERNAL\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column class="no-padding width-70"></th>\n          <th md-column class="width-70"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.agents.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="agent in vm.agents.rows">\n          <td md-cell>{{agent.id}}</td>\n          <td md-cell>{{agent.name}}</td>\n          <td md-cell>{{agent.internal}}</td>\n          <td md-cell>\n            <div layout="row">\n              <div layout="column" layout-align="center center">\n                <span class="text-boxed width-70 text-center md-background-bg bl bt padding-5" ng-class="{\'online\':\'lime-300-bg\',\'offline\':\'red-A200-bg\',\'pause\':\'amber-200-bg\',\'busy\':\'indigo-100-bg\'}[agent.status]">{{\n                  agent.status | uppercase }}</span>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="no-padding width-70">\n            <md-button ng-if="agent.status !== \'offline\'" ng-click="vm.originateCall(agent.name)" class="md-fab md-mini md-raised" aria-label="Dial">\n              <md-icon md-font-icon="icon-phone" class="icon green-fg s20">\n                <md-tooltip><span translate="VOICE.DIAL"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n          <td md-cell class="width-70">\n            <md-button ng-if="agent.status !== \'offline\'" ng-click="vm.transferCall(agent.name)" class="md-fab md-mini md-raised" aria-label="Transfer">\n              <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s20">\n                <md-tooltip><span translate="DASHBOARDS.TRANSFER"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.agentsQuery.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.agentsQuery.page" md-total="{{vm.agents.count}}" md-on-paginate="vm.getAgents" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.queues.html",'<md-card ngCloak>\n  <md-toolbar class="md-table-toolbar md-default table-header xenialab-violet-light-bg" ng-class="{\'h-128\' : vm.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.QUEUES"></span>\n      <ms-search-bar on-search="vm.getVoiceQueues()" query="vm.queuesQuery" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.queuesQuery.sort" md-on-reorder="vm.getVoiceQueues">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="name">{{\'DASHBOARDS.NAME\' | translate}}</th>\n          <th md-column md-order-by="name">{{\'VOICE.CALLS\' | translate}}</th>\n          <th md-column class="no-padding width-70"></th>\n          <th md-column class="width-70"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.voiceQueues.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="queue in vm.voiceQueues.rows">\n          <td md-cell>{{queue.id}}</td>\n          <td md-cell>{{queue.name}}</td>\n          <td md-cell>{{queue.calls.length || 0}}</td>\n          <td md-cell class="no-padding width-70">\n            <md-button ng-click="vm.originateCall(queue.name)" class="md-fab md-mini md-raised" aria-label="Dial">\n              <md-icon md-font-icon="icon-phone" class="icon green-fg s20">\n                <md-tooltip><span translate="VOICE.DIAL"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n          <td md-cell class="width-70">\n            <md-button ng-click="vm.transferCall(queue.name)" class="md-fab md-mini md-raised" aria-label="Transfer">\n              <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s20">\n                <md-tooltip><span translate="DASHBOARDS.TRANSFER"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.queuesQuery.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queuesQuery.page" md-total="{{vm.voiceQueues.count}}" md-on-paginate="vm.getVoiceQueues" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/recordings/agent.general.recordings.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header indigo-A100-bg" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="VOICE.RECORDINGS">Recordings</span>\n      <ms-search-bar on-search="vm.getVoiceRecordings()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getVoiceRecordings()">\n      </ms-quick-filter>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceRecordings">\n        <tr md-row>\n          <th md-column md-order-by="type">{{ \'VOICE.TYPE\' | translate }}</th>\n          <th md-column md-order-by="uniqueid">{{ \'VOICE.UNIQUEID\' | translate }}</th>\n          <th md-column md-order-by="calleridnum">{{ \'VOICE.CALLER\' | translate }}</th>\n          <th md-column md-order-by="exten">{{ \'VOICE.CALLED\' | translate }}</th>\n          <th md-column md-order-by="connectedlinenum">{{ \'VOICE.CONNECTED\' | translate }}</th>\n          <th md-column md-order-by="queue">{{ \'VOICE.QUEUE\' | translate }}</th>\n          <th md-column md-order-by="rating">{{ \'VOICE.RATING\' | translate }}</th>\n          <th md-column>{{ \'VOICE.AUDIO\' | translate }}</th>\n          <th md-column md-order-by="createdAt">{{ \'VOICE.DATE\' | translate }}</th>\n          <th md-column width="10px" ng-if="vm.currentUser.downloadVoiceRecordings"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.voiceRecordings.rows.length">\n          <td md-cell colspan="{{ vm.currentUser.downloadVoiceRecordings ? 10 : 9}}">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="voiceRecording in vm.voiceRecordings.rows">\n          <td md-cell class="type">{{voiceRecording.type}}</td>\n          <td md-cell class="uniqueid">{{voiceRecording.uniqueid}}</td>\n          <td md-cell class="calleridnum">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceRecording.calleridnum" license="vm_home.license">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="exten">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceRecording.exten" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="connectedlinenum">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceRecording.connectedlinenum" license="vm_home.license">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="queue">{{voiceRecording.queue}}</td>\n          <td md-cell class="rating">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-show="voiceRecording.rating" ng-repeat="rating in [1,2,3,4,5] | limitTo:voiceRecording.rating"></md-icon><span ng-hide="voiceRecording.rating" translate="VOICE.NO_RATING">No rating</span>\n          </td>\n          <td md-cell class="audio" ng-switch="voiceRecording.format">\n            \x3c!-- audio recording directive --\x3e\n            <ms-recording ng-switch-when=".wav" id="voiceRecording.id"></ms-recording>\n            \x3c!-- / audio recording directive --\x3e\n            <span ng-switch-when=".gsm">\n              <em>{{ \'VOICE.CANT_PLAY_GSM_AUDIO_FILES\' | translate }}</em>\n            </span>\n          </td>\n          <td md-cell class="createdAt ">{{voiceRecording.createdAt | date:\'medium\' }}</td>\n          <td md-cell class="actions" ng-if="vm.currentUser.downloadVoiceRecordings">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.downloadfile(voiceRecording, $event)" translate="VOICE.DOWNLOAD_VOICERECORDING">\n                    Download VoiceRecording\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="voiceRecording.transcribeStatus == \'COMPLETED\'">\n                  <md-button ng-click="vm.downloadtranscribe(voiceRecording, $event)" translate="VOICE.DOWNLOADTRANSCRIBE_VOICERECORDING">\n                    Download Transcribe\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceRecordings.count}}" md-on-paginate="vm.getVoiceRecordings" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/scheduled/agent.general.scheduled.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header blue-grey-bg" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="MOTIONDIALER.SCHEDULED_CALLS">Scheduled Calls</span>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getScheduledCalls()">\n      </ms-quick-filter>\n      <md-button class="md-icon-button reload-list" ng-click="vm.getScheduledCalls()" aria-label="Refresh scheduled calls" translate translate-attr-label="MOTIONDIALER.REFRESH_SCHEDULED_CALLS">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip>{{\'MOTIONDIALER.REFRESH_SCHEDULED_CALLS\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getScheduledCalls">\n        <tr md-row>\n          <th md-column>{{\'MOTIONDIALER.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="phone">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n          <th md-column md-order-by="scheduledat">{{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}</th>\n          <th md-column>{{ \'MOTIONDIALER.PRIORITY\' | translate }}</th>\n          <th md-column md-order-by="recallme">{{ \'MOTIONDIALER.RECALLME\' | translate }}</th>\n          <th md-column>{{ \'MOTIONDIALER.CAMPAIGN\' | translate }}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.scheduledCalls.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="scheduledCall in vm.scheduledCalls.rows">\n          <td md-cell privacy ng-cloak>{{scheduledCall.Contact.firstName}} {{scheduledCall.Contact.lastName}}</td>\n          <td md-cell>\n            <ms-click-to-call target="scheduledCall.phone" license="vm_home.license"></ms-click-to-call>\n          </td>\n          <td md-colors="{color: {{ vm.isDateBeforeToday(scheduledCall.scheduledat) ? \'\\\'red\\\'\' : \'\\\'green\\\'\' }}}" md-cell>{{ scheduledCall.scheduledat | date:\'medium\' }}</td>\n          <td md-cell>{{ vm.priorities[scheduledCall.priority] }}</td>\n          <td md-cell>\n            <md-icon md-colors="{color: {{ scheduledCall.recallme && scheduledCall.UserId == vm.currentUser.id ? \'\\\'green\\\'\' : \'\\\'grey\\\'\' }}}" md-font-icon="{{ scheduledCall.recallme  && scheduledCall.UserId == vm.currentUser.id ? \'icon-check\' : \'icon-close\' }}">\n            </md-icon>\n          </td>\n          <td md-cell>\n            <md-icon md-colors="{color: {{ scheduledCall.Queue.dialActive? \'\\\'green\\\'\' : \'\\\'red\\\'\' }}}" md-font-icon="icon-checkbox-blank-circle"></md-icon> {{scheduledCall.Queue.name}}\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.createOrEditQueueCampaignHopper($event, scheduledCall)" translate="MOTIONDIALER.EDIT_HOPPER">\n                    Edit Hopper\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.deleteConfirm(scheduledCall, $event)" translate="MOTIONDIALER.DELETE_HOPPER">\n                    Delete Hopper\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.scheduledCalls.count}}" md-on-paginate="vm.getScheduledCalls" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/sms/agent.general.sms.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.SMS_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getSmsInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getSmsInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getSmsInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.smsAccounts.rows && vm.smsAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="smsAccount in vm.smsAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeSmsInteraction($event, smsAccount)">\n              {{ smsAccount.name }} ({{ smsAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSmsInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.smsInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.smsInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell class="smsAccount">\n            {{ vm.getSmsAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showSmsInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Sms\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadSmsInteraction($event, interaction)" translate="DASHBOARDS.DOWNLOAD">\n                    Download Sms\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.smsInteractions.count}}" md-on-paginate="vm.getSmsInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/voice/agent.general.voice.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header blue-A700-bg" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="VOICE.CALLS">Calls</span>\n      <ms-search-bar on-search="vm.getVoiceCalls()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getVoiceCalls()">\n      </ms-quick-filter>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceCalls">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'VOICE.ID\' | translate}}</th>\n          <th md-column md-order-by="type">{{ \'VOICE.TYPE\' | translate }}</th>\n          <th md-column md-order-by="source">{{ \'VOICE.SOURCE\' | translate }}</th>\n          <th md-column md-order-by="destination">{{ \'VOICE.DESTINATION\' | translate }}</th>\n          <th md-column md-order-by="starttime">{{ \'VOICE.STARTEDAT\' | translate }}</th>\n          <th md-column md-order-by="endtime">{{ \'VOICE.ENDEDAT\' | translate }}</th>\n          <th md-column md-order-by="userDisposition">{{ \'VOICE.DISPOSITION\' | translate }}</th>\n          <th md-column md-order-by="userSecondDisposition">{{ \'VOICE.SECOND_LEVEL_DISPOSITION\' | translate }}</th>\n          <th md-column md-order-by="userThirdDisposition">{{ \'VOICE.THIRD_LEVEL_DISPOSITION\' | translate }}</th>\n          <th md-column>{{ \'VOICE.NOTE\' | translate }}</th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.voiceCalls.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="voiceCall in vm.voiceCalls.rows" ng-click="vm.showDetails(voiceCall, $event)">\n          <td md-cell class="type">{{voiceCall.id}}</td>\n          <td md-cell class="type">{{ \'VOICE.\' + voiceCall.type.toUpperCase() | translate}}</td>\n          <td md-cell class="source">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceCall.source" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="destination">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceCall.destination" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="starttime">{{voiceCall.starttime | date:\'medium\' }}</td>\n          <td md-cell class="endtime">{{voiceCall.endtime | date:\'medium\' }}</td>\n          <td md-cell class="disposition">{{ voiceCall.userDisposition}}</td>\n          <td md-cell class="disposition">{{ voiceCall.userSecondDisposition}}</td>\n          <td md-cell class="disposition">{{ voiceCall.userThirdDisposition}}</td>\n          <td md-cell class="note">\n            <md-icon ng-if="voiceCall.note" md-font-icon="icon-clipboard-outline"></md-icon>\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.showDetails(voiceCall, $event)" translate="VOICE.DETAILS">\n                    Show Details\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceCalls.count}}" md-on-paginate="vm.getVoiceCalls" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/voice/details/dialog.html",'<md-dialog class="details-dialog" aria-label="details">\n  <md-toolbar class="md-background-bg">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span ng-if="!vm.interaction.closed" class="title" translate="VOICE.DETAILS"></span>\n      <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-dialog-content>\n    <md-list flex>\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.UNIQUEID">Uniqueid</p>\n          <h4>{{vm.call.uniqueid}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.TYPE">Type</p>\n          <h4>{{vm.call.type ? vm.call.type : \'no type\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.SOURCE">Source</p>\n          <h4 privacy ng-cloak>{{vm.call.source ? vm.call.source : \'unknown\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.DESTINATION">Destination</p>\n          <h4 privacy ng-cloak>{{vm.call.destination ? vm.call.destination : \'unknown\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.STARTEDAT">Started At</p>\n          <h4>{{vm.call.starttime | date:\'medium\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.ANSWEREDAT">Answered At</p>\n          <h4>{{vm.call.answertime ? (vm.call.answertime | date:\'medium\') : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.ENDEDAT">Ended At</p>\n          <h4>{{vm.call.endtime ? (vm.call.endtime | date:\'medium\') : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.DURATION">Duration</p>\n          <h4>{{vm.call.duration ? vm.call.duration : \'--\'}}s</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.BILLABLESECONDS">Billable Seconds</p>\n          <h4>{{vm.call.billableseconds ? vm.call.billableseconds : \'--\'}}s</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.DISPOSITION">Disposition</p>\n          <h4>{{vm.call.userDisposition ? vm.call.userDisposition : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</p>\n          <h4>{{vm.call.userSecondDisposition ? vm.call.userSecondDisposition : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</p>\n          <h4>{{vm.call.userThirdDisposition ? vm.call.userThirdDisposition : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.NOTE">Note</p>\n          <h4>{{vm.call.note ? vm.call.note : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n    </md-list>\n  </md-dialog-content>\n\n  <md-dialog-actions layout="row" layout-align="space-between center">\n    <md-button type="button" ng-click="vm.closeDialog()" class="send-button md-accent md-raised" aria-label="DISPOSE" translate="VOICE.CLOSE" translate-attr-aria-label="VOICE.DISPOSE">\n      CLOSE\n    </md-button>\n  </md-dialog-actions>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/home/whatsapp/agent.general.whatsapp.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.WHATSAPP_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getWhatsappInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getWhatsappInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getWhatsappInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.whatsappAccounts.rows && vm.whatsappAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="whatsappAccount in vm.whatsappAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeWhatsappInteraction($event, whatsappAccount)">\n              {{ whatsappAccount.name }} ({{ whatsappAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getWhatsappInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.whatsappInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.whatsappInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell class="whatsappAccount">\n            {{ vm.getWhatsappAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showWhatsappInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Whatsapp\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadWhatsappInteraction($event, interaction)" translate="DASHBOARDS.DOWNLOAD">\n                    Download Whatsapp\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.whatsappInteractions.count}}" md-on-paginate="vm.getWhatsappInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/iframe/agent.general.iframe.html",'<md-content layout="row" layout-fill>\n\n  <div flex layout="row">\n\n    <iframe ng-src="{{vm.getTrustedURL()}}" frameborder=0 style="width: 100%; height: 100%; border:0px;"></iframe>\n\n  </div>\n\n</md-content>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",'<md-dialog id="agent-general-dialog" aria-label="Spy Dialog">\n  <div id="interaction-app" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.html\'"></div>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.html",'\x3c!-- CONTENT CARD --\x3e\n<md-content class="content-card" layout="row" layout-fill>\n\n  <div ng-if="!vm.showInteraction" class="start-point" flex layout="column" layout-align="center center" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.loading.html\'"></div>\n\n  <div ng-if="vm.showInteraction" flex layout="row">\n\n    <md-card flex="75" class="interaction">\n\n      <md-content class="interaction-agents" layout="row" layout-align="start center" ng-if="!vm.interaction.closed && vm.interaction.Users.length">\n        <strong layout-margin translate="DASHBOARDS.CURRENTLY_IN_USE_BY">Currently in use by </strong>\n\n        <div ng-repeat="u in vm.interaction.Users">\n          <img class="avatar-small" ng-src="api/users/{{u.id}}/avatar">\n          <md-tooltip> {{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : vm.usersMap[u.id] | translate }}\n          </md-tooltip>\n        </div>\n      </md-content>\n\n      \x3c!-- TOOLBAR --\x3e\n      <md-toolbar class="interaction-toolbar" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.html\'">\n      </md-toolbar>\n      \x3c!-- / TOOLBAR --\x3e\n\n      \x3c!-- CONTENT --\x3e\n      <md-content id="interaction-content" name="{{\'interaction-content-\' + vm.tab.id}}" flex layout-wrap>\n        <div class="interaction-messages" ng-switch="vm.tab.channel">\n          <div ng-switch-when="mail">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.mail.html\'">\n            </div>\n          </div>\n          <div ng-switch-default>\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.html\'">\n            </div>\n          </div>\n        </div>\n      </md-content>\n      \x3c!-- / CONTENT --\x3e\n\n      \x3c!-- FOOTER --\x3e\n      <div ng-if="\n            !vm.interaction.closed && ( vm.tab.channel == \'chat\' \n            || (vm.tab.channel == \'openchannel\' && vm.account.replyUri) \n            || (vm.tab.channel == \'sms\' && !vm.tab.spy) \n            || (vm.tab.channel == \'whatsapp\' && !vm.tab.spy) )\n             && (vm.user.role !== \'admin\' && vm.user.role !== \'user\')" class="interaction-footer flex-noshrink" layout="row" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.footer.html\'">\n      </div>\n      \x3c!-- / FOOTER--\x3e\n    </md-card>\n\n    <md-card layout="column" flex class="info" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.html\'">\n    </md-card>\n  </div>\n</md-content>\n\x3c!-- / CONTENT CARD --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/chat/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="CHAT.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="CHAT.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="CHAT.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="CHAT.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mobile" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'CHAT.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'CHAT.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.ChatAccountId" md-font-icon="icon-earth" aria-label="alert chat" class="s16"></md-icon>\n          <md-icon ng-if="item.ChatAccountId" md-font-icon="icon-message-text" aria-label="alert chat" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n\n        <md-not-found>\n          <span translate="CHAT.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/fax/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="FAX.SEND">SEND</span>\n          </md-button>\n          <md-button ng-disabled="vm.message.attachments.length === 1" class="md-fab md-mini md-white-bg" aria-label="attachment" translate-attr-aria-label="DASHBOARDS.ATTACHMENT" flow-btn flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-init="vm.ngFlowOptions" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)">\n            <md-icon md-font-icon="icon-paperclip" class="red-fg"></md-icon>\n          </md-button>\n        </div>\n        <span class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="FAX.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block to">\n        <label translate="FAX.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete ng-hide="vm.message.to.length === 1" md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.fax" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" ng-if="composeForm.$dirty">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n          <div ng-message="md-max-chips">You reached the maximum amount of chips</div>\n        </div>\n      </md-input-container>\n      <div class="attachment-list" ng-if="vm.message.attachments.length" layout="row" layout-wrap>\n        <div class="attachment" layout="row" layout-align="space-between center" ng-repeat="attachment in vm.message.attachments">\n          <div>\n            <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            <span class="filename">{{attachment.name}}</span>\n            <span class="size">({{attachment.size | byteFmt: 0}})</span>\n          </div>\n          <md-button class="md-icon-button" aria-label="Delete attachment" translate translate-attr-aria-label="FAX.DELETE_ATTACHMENT">\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message" ng-class="{\'mail-no-secret\': !vm.secret}" ng-cloak>\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar ng-class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <div ng-if="!vm.secret" class="md-button md-raised blue-bg no-padding">\n            <button class="white-fg margin-horizontal-10" aria-label="Send message" ng-disabled="!vm.verifySmtp" ng-click="vm.send($event, false, null)">\n              <span>{{ \'MAIL.SEND\' | translate | uppercase }}</span>\n            </button>\n            <span class="white-fg secondary-text vertical-divider"></span>\n            <md-menu>\n              <button ng-disabled="!vm.verifySmtp" class="white-fg margin-left-0" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-menu-down" class="icon s24"></md-icon>\n              </button>\n              <md-menu-content width="2">\n                <md-menu-item ng-if="vm.subStatuses.rows.length">\n                  <md-menu>\n                    <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="MAIL.SEND_AS">\n                      Send as\n                    </md-button>\n                    <md-menu-content>\n                      <md-menu-item ng-repeat="subStatus in vm.subStatuses.rows">\n                        <md-button ng-click="vm.send($event, false, subStatus.name)">\n                          {{subStatus.name}}\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.send($event, true, null)" translate="MAIL.SEND_AND_CLOSE">\n                    Send and Close\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </div>\n          <md-button ng-if="!vm.secret" class=" md-button md-raised blue-bg white-fg margin-horizontal-10" aria-label="Save draft" ng-click="vm.saveDraft()">\n            <span>{{ (vm.isDraft ? \'DASHBOARDS.UPDATE_DRAFT\' : \'DASHBOARDS.SAVE_AS_DRAFT\') | translate | uppercase }}</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="MAIL.ADD_NOTE">Add note</span>\n          </md-button>\n          <md-button ng-disabled="!vm.verifySmtp" class="md-fab md-mini md-white-bg" aria-label="attachment" translate-attr-aria-label="DASHBOARDS.ATTACHMENT" flow-btn flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload($files)" flow-init="vm.ngFlowOptions" flow-file-success="vm.fileSuccess($file, $message)" flow-file-added="vm.fileAdded($file)">\n            <md-icon md-font-icon="icon-paperclip" class="red-fg"></md-icon>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="MAIL.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to" ng-class="{\'hidden-cc\': vm.hiddenCC, \'hidden-bcc\': vm.hiddenBCC}">\n        <label translate="MAIL.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" ng-keypress="vm.keyPress($event)" md-transform-chip="vm.transformContact($chip, vm.message.to)" md-separator-keys="vm.separatorKeys" md-require-match="false" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.email" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n        <div class="cc-bcc" layout="row" layout-align="start center">\n          <div class="show-cc" ng-show="vm.hiddenCC" ng-click="vm.hiddenCC = false">CC</div>\n          <div class="show-bcc" ng-show="vm.hiddenBCC" ng-click="vm.hiddenBCC = false">BCC</div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="!vm.secret" class="md-block" ng-hide="vm.hiddenCC">\n        <label translate="MAIL.CC">Cc</label>\n        <md-chips name="cc" ng-model="vm.message.cc" ng-keypress="vm.keyPress($event)" md-transform-chip="vm.transformContact($chip, vm.message.cc)" md-separator-keys="vm.separatorKeys" md-require-match="false" required>\n          <md-autocomplete md-search-text="vm.searchCc" md-items="contact in vm.contactSearch(vm.searchCc)" md-item-text="contact.email" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n      </md-input-container>\n      <md-input-container ng-if="!vm.secret" class="md-block" ng-hide="vm.hiddenBCC">\n        <label translate="MAIL.BCC">Bcc</label>\n        <md-chips name="bcc" ng-model="vm.message.bcc" ng-keypress="vm.keyPress($event)" md-transform-chip="vm.transformContact($chip, vm.message.bcc)" md-separator-keys="vm.separatorKeys" md-require-match="false" required>\n          <md-autocomplete md-search-text="vm.searchBcc" md-items="contact in vm.contactSearch(vm.searchBcc)" md-item-text="contact.email" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n      </md-input-container>\n      <md-input-container ng-if="!vm.secret" class="md-block no-margin">\n        <label translate="MAIL.SUBJECT">Subject</label>\n        <input ng-model="vm.message.subject" type="text" ng-keypress="vm.keyPress($event)">\n      </md-input-container>\n      <div class="attachment-list" ng-if="vm.message.attachments.length" layout="row" layout-wrap>\n        <div class="attachment" layout="row" layout-align="space-between center" ng-repeat="attachment in vm.message.attachments">\n          <div>\n            <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            <span class="filename">{{attachment.name}}</span>\n            <span class="size" ng-if="attachment.size">({{attachment.size | byteFmt: 0}})</span>\n          </div>\n          <md-button ng-click="vm.removeAttachment(attachment)" class="md-icon-button" aria-label="Delete attachment" translate translate-attr-aria-label="MAIL.DELETE_ATTACHMENT">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="padding-top-5">\n        <textarea ckeditor="vm.ckeditor" id="html-area" ng-model="vm.message.body" md-select-on-focus="" ready="vm.onReadyEditor()"></textarea>\n      </div>\n      <md-switch ng-if="!vm.message.showLastMessage && !vm.secret" ng-model="vm.message.showLastMessage" ng-change="vm.loadLastMessage()" aria-label="load last message"><span translate="MAIL.SHOW_ORIGINAL_MESSAGE">Show original message</span></md-switch>\n      <md-autocomplete ng-if="!vm.secret" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'MAIL.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin" ng-keypress="vm.keyPress($event)">\n        <md-item-template>\n          <md-icon ng-if="!item.MailAccountId" md-font-icon="icon-earth" aria-label="alert email" class="s16">\n          </md-icon>\n          <md-icon ng-if="item.MailAccountId" md-font-icon="icon-email" aria-label="alert email" class="s16 teal-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{ item.key }} -\n            {{ item.value | htmlToPlaintext }}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="MAIL.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/openchannel/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="OPENCHANNEL.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="OPENCHANNEL.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="OPENCHANNEL.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="OPENCHANNEL.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mapkey" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'OPENCHANNEL.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'OPENCHANNEL.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.OpenchannelAccountId" md-font-icon="icon-earth" aria-label="alert openchannel" class="s16"></md-icon>\n          <md-icon ng-if="item.OpenchannelAccountId" md-font-icon="icon-message-text" aria-label="alert openchannel" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="OPENCHANNEL.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/sms/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="SMS.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="SMS.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="SMS.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="SMS.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mobile" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'SMS.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'SMS.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.SmsAccountId" md-font-icon="icon-earth" aria-label="alert sms" class="s16"></md-icon>\n          <md-icon ng-if="item.SmsAccountId" md-font-icon="icon-message-text" aria-label="alert sms" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="SMS.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/whatsapp/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="WHATSAPP.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="WHATSAPP.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="WHATSAPP.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="WHATSAPP.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mobile" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'WHATSAPP.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'WHATSAPP.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.WhatsappAccountId" md-font-icon="icon-earth" aria-label="alert whatsapp" class="s16">\n          </md-icon>\n          <md-icon ng-if="item.WhatsappAccountId" md-font-icon="icon-message-text" aria-label="alert whatsapp" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="WHATSAPP.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",'<md-dialog class="disposition-dialog" aria-label="disposition" ng-init="vm.onInit()">\n  <form name="dispositionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span ng-if="!vm.interaction.closed" class="title" translate="DASHBOARDS.DISPOSE"></span>\n        <span ng-if="vm.interaction.closed" class="title" translate="DASHBOARDS.INFO"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" ng-if="!vm.mandatoryDisposition">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="DASHBOARDS.DISPOSITION">Disposition</label>\n        <md-select name="disposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onDispositionChange(\'first\')" required>\n          <md-option ng-value="null" ng-if="!vm.mandatoryDisposition">NONE</md-option>\n          <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' } : true">\n            {{ disposition.name }}</md-option>\n        </md-select>\n        <div ng-messages="dispositionForm.disposition.$error" ng-show="dispositionForm.disposition.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="DASHBOARDS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n          <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition" ng-change="vm.onDispositionChange(\'second\')">\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id } : true">\n              {{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearDispositionSelection(\'second\')" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear second level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <div ng-if="vm.secondLevelDisposition && vm.anyThirdLevelDisposition" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</label>\n          <md-select name="thirdLevelDisposition" ng-model="vm.thirdLevelDisposition">\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'third\', ParentId: vm.secondLevelDisposition.id } : true" ng-disabled="disposition.canSelect === false">{{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.thirdLevelDisposition" ng-click="vm.clearDispositionSelection(\'third\')" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear third level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="DASHBOARDS.NOTE">Note</label>\n        <textarea ng-model="vm.interaction.note" md-maxlength="255" max-rows="5" autofocus></textarea>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveDisposition()" ms-dialog-spinner class="send-button md-accent md-raised" ng-if="!vm.interaction.closed && (vm.firstLevelDisposition || vm.secondLevelDisposition || vm.thirdLevelDisposition)" aria-label="CLOSE_AND_DISPOSE" translate="DASHBOARDS.CLOSE_AND_DISPOSE" translate-attr-aria-label="DASHBOARDS.CLOSE_AND_DISPOSE">\n          CLOSE AND DISPOSE\n        </md-button>\n        <md-button type="submit" ng-click="vm.saveDisposition(false)" ms-dialog-spinner class="send-button md-accent md-raised" ng-if="!vm.interaction.closed && !vm.firstLevelDisposition" ng-disabled="vm.mandatoryDisposition" aria-label="CLOSE_WITHOUT_DISPOSE" translate="DASHBOARDS.CLOSE_WITHOUT_DISPOSE" translate-attr-aria-label="DASHBOARDS.CLOSE_WITHOUT_DISPOSE">\n          CLOSE WITHOUT DISPOSE\n        </md-button>\n        <md-button type="submit" ng-click="vm.saveDisposition()" ms-dialog-spinner class="send-button md-accent md-raised" ng-if="vm.interaction.closed" ng-disabled="vm.mandatoryDisposition && !vm.firstLevelDisposition" aria-label="DISPOSE" translate="DASHBOARDS.DISPOSE" translate-attr-aria-label="DASHBOARDS.DISPOSE">\n          DISPOSE\n        </md-button>\n        <div ng-if="vm.mandatoryDisposition">\n          <md-icon md-font-icon="icon-information-outline" aria-label="Mandatory Disposition"></md-icon>\n          <span class="no-margin font-size-12 line-height-30" translate="DASHBOARDS.HELP.MANDATORY_DISPOSITION_ENABLED"></span>\n        </div>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/tag/dialog.html",'<md-dialog class="tag-dialog" aria-label="tag">\n  <form name="tagForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.TAGS"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <md-chips ng-model="vm.interaction.Tags" md-autocomplete-snap md-require-match="vm.autocompleteRequireMatch">\n          <md-autocomplete ng-blur="vm.searchText = \'\'" md-min-length="0" md-selected-item-change="vm.selectedItemChange" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-items="item in vm.tags.rows | filter:{ name: vm.searchText }" md-item-text="item.name" placeholder="Search for a tag">\n            <span md-highlight-text="vm.searchText">{{item.name}}</span>\n          </md-autocomplete>\n          <md-chip-template>\n            <span>\n              <strong>{{$chip.name}}</strong>\n            </span>\n          </md-chip-template>\n        </md-chips>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveTag(false)" ng-disabled="tagForm.$pristine" class="send-button md-accent md-raised" aria-label="TAG" translate="DASHBOARDS.SAVE" translate-attr-aria-label="DASHBOARDS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/transfer/dialog.html",'<md-dialog class="disposition-dialog" aria-label="disposition">\n  <form name="transferForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.TRANSFER"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog(false)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="DASHBOARDS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.transfer.type">\n          <md-option ng-value="\'queue\'" ng-if="vm.account.queueTransfer">Queue</md-option>\n          <md-option ng-value="\'agent\'" ng-if="vm.account.agentTransfer">Agent</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.transfer.type === \'queue\'">\n        <label translate="DASHBOARDS.QUEUES">Queues</label>\n        <md-select name="queue" ng-model="vm.transfer.id" required>\n          <md-option ng-value="queue.id" ng-repeat="queue in vm.queues.rows">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="transferForm.queue.$error" ng-show="transferForm.queue.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="DASHBOARDS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.transfer.type === \'agent\'">\n        <label translate="DASHBOARDS.AGENTS">Agents</label>\n        <md-select name="agent" ng-model="vm.transfer.id" required>\n          <md-option ng-value="agent.id" ng-repeat="agent in vm.agents.rows">{{\n            agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="transferForm.agent.$error" ng-show="transferForm.agent.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="DASHBOARDS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.onTransfer(true)" ng-disabled="transferForm.$pristine" class="send-button md-accent md-raised" aria-label="DASHBOARDS.TRANSFER" translate="DASHBOARDS.TRANSFER" translate-attr-aria-label="DASHBOARDS.TRANSFER">\n          TRANSFER\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.footer.html",'\x3c!-- REPLY FORM --\x3e\n<div ng-show="vm.showFooter" layout="column" layout-align="center center" flex>\n  <div layout="row" layout-align="center center" style="flex-grow: 1; align-self: stretch" flex>\n    \x3c!-- msEmojyArea directive --\x3e\n    <ms-emoji-area ng-if="vm.tab.channel != \'fax\'" on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.tab.areaText" placeholder="vm.tab.channel.toUpperCase() + \'.INSERT_MESSAGE_HERE\'"></ms-emoji-area>\n    \x3c!-- / msEmojyArea directive --\x3e\n\n    <div layout="row" layout-align="end center">\n      <md-button ng-if="vm.tab.channel != \'fax\'" style="margin:1px;" class="md-icon-button md-mini" ng-click="vm.changeDisplayCannedAnswerInputValue()" aria-label="Search canned answer" translate translate-attr-aria-label="DASHBOARDS.SEND_MESSAGE">\n        <md-icon md-font-icon="icon-auto-fix" class="green-fg"></md-icon>\n      </md-button>\n\n      <md-button ng-if="vm.tab.channel == \'openchannel\' || vm.tab.channel == \'chat\' || vm.tab.channel == \'fax\'" style="margin:1px;" class="md-icon-button md-warn md-mini" aria-label="attachment" translate-attr-aria-label="DASHBOARDS.ATTACHMENT" flow-btn flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-init="vm.ngFlowOptions" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)">\n        <md-icon md-font-icon="icon-paperclip"></md-icon>\n      </md-button>\n    </div>\n  </div>\n\n  <md-autocomplete ng-hide="!vm.displayCannedAnswerInput" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" placeholder="{{ \'DASHBOARDS.CANNED_ANSWER_SEARCH\' | translate}}" class="cannedarea input-show-hide">\n    <md-item-template>\n      <md-icon ng-if="!item[vm.tab.channel === \'chat\' ? \'ChatWebsiteId\' : _.capitalize(vm.tab.channel) + \'AccountId\']" md-font-icon="icon-earth" aria-label="alert channel" class="s16"></md-icon>\n      <md-icon ng-if="item[vm.tab.channel === \'chat\' ? \'ChatWebsiteId\' : _.capitalize(vm.tab.channel) + \'AccountId\']" md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" aria-label="alert channel" class="s16" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n      <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n    </md-item-template>\n\n    <md-not-found>\n      <span translate="DASHBOARDS.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n    </md-not-found>\n  </md-autocomplete>\n</div>\n\x3c!-- / REPLY FORM --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.chat.html",'<div ng-init="item = item || vm.interaction">\n  <md-list-item class="md-2-line" ng-if="item.browserName">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.BROWSER_NAME">Browser Name</p>\n      <h4>{{ item.browserName }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.osName">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.OS_NAME">OS Name</p>\n      <h4>{{ item.osName }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.deviceModel">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DEVICE_MODEL">Device Model</p>\n      <h4>{{ item.deviceModel }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.referer">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.REFERER">Referer</p>\n      <h4>{{ item.referer }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.customerIp">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CUSTOMER_IP">Originating IP Address</p>\n      <h4>{{ item.customerIp }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.customerPort">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CUSTOMER_PORT">Originating TCP Port</p>\n      <h4>{{ item.customerPort }}</h4>\n    </div>\n  </md-list-item>\n  <md-divider ng-if="item.closed && item.ratingValue != null || item.ratingMessage"></md-divider>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.ratingValue != null">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.RATING">Rating</p>\n      <md-icon md-font-icon="icon-star" style="color:red" ng-show="!item.ratingType || item.ratingType == \'star\'" ng-repeat="ratingValue in [1,2,3,4,5] | limitTo:item.ratingValue"></md-icon>\n      <md-icon md-font-icon="icon-thumb-up" style="color:green" ng-show="item.ratingType && item.ratingType == \'thumb\' && item.ratingValue == 1"></md-icon>\n      <md-icon md-font-icon="icon-thumb-down" style="color:red" ng-show="item.ratingType && item.ratingType == \'thumb\' && item.ratingValue == 0"></md-icon>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.ratingMessage">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.FEEDBACK">Feedback</p>\n      <h4 style="overflow-wrap: break-word; white-space: normal">{{ item.ratingMessage }}</h4>\n    </div>\n  </md-list-item>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.html",'<md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.CONTACT">Contact</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content class="md-padding">\n        <form name="contactForm" class="md-inline-form" novalidate>\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-account"></md-icon>\n            <label translate="DASHBOARDS.NAME">Name</label>\n            <input type="text" name="firstName" ng-model="vm.contact.firstName" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-email"></md-icon>\n            <label translate="DASHBOARDS.EMAIL">Email</label>\n            <input type="email" name="email" ng-model="vm.contact.email" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n            <label translate="DASHBOARDS.PHONE">Phone</label>\n            <input type="text" name="phone" ng-model="vm.contact.phone" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-cellphone-iphone"></md-icon>\n            <label translate="DASHBOARDS.MOBILE">Mobile</label>\n            <input type="text" name="mobile" ng-model="vm.contact.mobile" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-deskphone"></md-icon>\n            <label translate="DASHBOARDS.FAX">Fax</label>\n            <input type="text" name="fax" ng-model="vm.contact.fax" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <div ng-if="!vm.tab.spy" layout="row" layout-align="center center">\n            <md-button class="md-raised md-accent" ng-click="vm.openContact(ev)" translate="DASHBOARDS.MORE">\n              More\n            </md-button>\n          </div>\n        </form>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.INTERACTION">Interaction</span>\n    </md-tab-label>\n    <md-tab-body>\n      <div layout="column" layout-align="space-between center" class="md-padding">\n        <md-icon class="s42" md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n        <span ng-if="vm.interaction.closed" class="md-background-bg red-fg font-size-14">#{{vm.interaction.id}} - <span translate="DASHBOARDS.CLOSED"></span></span>\n        <span ng-if="!vm.interaction.closed" class="md-background-bg green-fg font-size-14">#{{vm.interaction.id}} -\n          <span translate="DASHBOARDS.OPENED"></span></span>\n        <span ng-if="!vm.interaction.closed && vm.interaction.substatus" class="md-background-bg green-fg font-size-14">{{vm.interaction.substatus}}</span>\n      </div>\n      <md-divider></md-divider>\n      <md-list flex>\n        <md-list-item class="md-2-line">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.WEBSITE" ng-if="vm.tab.channel == \'chat\'">Website</p>\n            <p translate="DASHBOARDS.ACCOUNT" ng-if="vm.tab.channel != \'chat\'">Account</p>\n            <h4>{{vm.account.name}}</h4>\n          </div>\n        </md-list-item>\n\n        <md-list-item class="md-2-line">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.AGENT">Agent</p>\n            <h4>{{vm.agent.fullname || vm.usersMap[vm.interaction.UserId]}}</h4>\n          </div>\n        </md-list-item>\n\n        <md-list-item class="md-2-line" ng-if="vm.interaction.externalUrl">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.EXTERNAL_URL">External URL</p>\n            <a href="{{vm.interaction.externalUrl}}" target="_blank">\n              <h4>{{vm.interaction.externalUrl}}</h4>\n            </a>\n          </div>\n        </md-list-item>\n\n        <md-list-item class="md-2-line">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.CREATED_AT">Created At</p>\n            <h4>{{vm.interaction.createdAt | date: \'medium\'}}</h4>\n          </div>\n        </md-list-item>\n\n        <div ng-switch="vm.tab.channel">\n          <div ng-switch-when="chat">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.chat.html\'">\n            </div>\n          </div>\n          <div ng-switch-when="mail">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.mail.html\'">\n            </div>\n          </div>\n          <div ng-switch-when="openchannel">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.openchannel.html\'">\n            </div>\n          </div>\n        </div>\n\n        <md-list-item class="md-2-line" ng-if="vm.interaction.Tags.length">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.TAGS">Tags</p>\n            <div class="tags padding-bottom-5" layout="row" layout-align="start center" layout-wrap>\n              <div class="tag margin-right-5 margin-top-5 margin-bottom-5" layout="row" layout-align="center center" ng-repeat="tag in vm.interaction.Tags">\n                <div class="tag-color" ng-style="{\'background\': tag.color}"></div>\n                <div class="tag-label">{{tag.name}}</div>\n              </div>\n            </div>\n          </div>\n        </md-list-item>\n\n        <md-divider ng-if="vm.interaction.closed"></md-divider>\n\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.CLOSED_AT">Closed At</p>\n            <h4>{{vm.interaction.closedAt | date: \'medium\'}}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed && vm.interaction.disposition">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.DISPOSITION">Disposition</p>\n            <h4>{{ vm.interaction.disposition }}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed && vm.interaction.secondDisposition">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</p>\n            <h4>{{ vm.interaction.secondDisposition }}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed && vm.interaction.thirdDisposition">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</p>\n            <h4>{{ vm.interaction.thirdDisposition }}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-3-line md-long-text" ng-if="vm.interaction.closed && vm.interaction.note">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.NOTE">NOTE</p>\n            <h4 style="overflow-wrap: break-word; white-space: normal">{{ vm.interaction.note }}</h4>\n          </div>\n        </md-list-item>\n      </md-list>\n    </md-tab-body>\n  </md-tab>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.CUSTOMER_JOURNEY">Journey</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content class="md-padding">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'">\n        </div>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n</md-tabs>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.all.html",'<md-divider></md-divider>\n<md-list flex>\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.AGENT">Agent</p>\n      <h4>{{ vm.agent.fullname || vm.usersMap[item.UserId] || \'DASHBOARDS.NOT_ASSIGNED\' | translate }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.externalUrl">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.EXTERNAL_URL">External URL</p>\n      <a href="{{ item.externalUrl }}" target="_blank">\n        <h4>{{ item.externalUrl }}</h4>\n      </a>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CREATED_AT">Created At</p>\n      <h4>{{ item.createdAt | date: \'medium\' }}</h4>\n    </div>\n  </md-list-item>\n  <div ng-if="item.channel === \'chat\'">\n    <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.chat.html\'">\n    </div>\n  </div>\n  <div ng-if="item.channel === \'mail\'">\n    <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.mail.html\'">\n    </div>\n  </div>\n  <md-divider ng-if="item.closed"></md-divider>\n  <md-list-item class="md-2-line" ng-if="item.closed">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CLOSED_AT">Closed At</p>\n      <h4>{{ item.closedAt | date: \'medium\' }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.disposition">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DISPOSITION">Disposition</p>\n      <h4>{{ item.disposition }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.secondDisposition">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</p>\n      <h4>{{ item.secondDisposition }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.thirdDisposition">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</p>\n      <h4>{{ item.thirdDisposition }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-3-line md-long-text" ng-if="item.closed && item.note">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.NOTE">NOTE</p>\n      <h4 style="overflow-wrap: break-word; white-space: normal">{{ item.note }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item ng-if="item.Tags.length">\n    <p class="padding-horizontal-15 grey-fg">Tags</p>\n    <div class="tags padding-bottom-5" layout="row" layout-align="start center" layout-wrap>\n      <div class="tag margin-right-5 margin-top-5 margin-bottom-5" layout="row" layout-align="center center" ng-repeat="tag in item.Tags">\n        <div class="tag-color" ng-style="{\'background\': tag.color}"></div>\n        <div class="tag-label">{{ tag.name }}</div>\n      </div>\n    </div>\n  </md-list-item>\n</md-list>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html",'<div layout-margin layout="row" layout-align="center center">\n  <ms-quick-filter filters="vm.quickFilters" query="vm.journeyOptions" search="vm.getCustomerJourney()">\n  </ms-quick-filter>\n</div>\n\n<md-content id="journey-content" flex layout-wrap>\n  <div ng-if="vm.journeyIsLoading" layout="row" layout-align="center center">\n    <md-progress-circular class="md-accent" md-diameter="48" md-mode="indeterminate"></md-progress-circular>\n  </div>\n  <div id="timeline" layout="column" ng-if="vm.journey && vm.journey.length && !vm.journeyIsLoading" ms-timeline="vm.journeyTimelineOptions" ms-timeline-load-more="vm.loadMoreJourney()">\n    \x3c!-- TIMELINE ITEM --\x3e\n    <div class="ms-timeline-item" layout-align="center center" ng-repeat="item in vm.journey">\n      <div class="timeline-card">\n        <md-card class="channel" ng-class="{\'md-grey-200-bg\': item.id == vm.interaction.id}">\n          <div layout="row" layout-align="space-between center">\n            <div class="header p-6" layout="row" layout-align="start center" ng-cloak>\n              <md-button class="md-fab md-mini no-click" aria-label="icon-channel" ng-class="{{ \'item.style.color\' }} + \'-bg\'">\n                <md-icon md-font-icon="{{ item.style.icon }}"></md-icon>\n              </md-button>\n              <div class="info" layout="column" ng-init="item.showMore = false">\n                <span class="font-size-12 text-truncate" ng-if="item.destination">\n                  #{{item.id}} - <span privacy ng-cloak>{{ item.destination }}</span>\n                </span>\n                <span class="font-size-12 text-truncate" ng-if="!item.destination">\n                  #{{item.id}} - {{ item.Account.key }}\n                </span>\n                <span class="font-size-10">{{item.createdAt | date: \'medium\'}}</span>\n                <span>\n                  <a class="toggle-details md-accent-color" ng-click="item.showMore = !item.showMore" translate="{{ item.showMore ? \'DASHBOARDS.HIDE_DETAILS\' : \'DASHBOARDS.SHOW_DETAILS\' }}">\n                  </a>\n                </span>\n              </div>\n            </div>\n            <span>\n              <img ng-if="item.UserId" class="avatar" ng-src="api/users/{{item.UserId}}/avatar">\n              <md-tooltip md-direction="left">{{item.Owner.fullname || item.User.fullname}}</md-tooltip>\n            </span>\n          </div>\n          <div ng-if="item.showMore">\n            <div ng-if="item.channel !== \'voice\'" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.all.html\'">\n            </div>\n            <div ng-if="item.channel === \'voice\'" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.voice.html\'">\n            </div>\n          </div>\n          <md-divider></md-divider>\n          <div ng-if="item.id != vm.interaction.id" layout="row" layout-align="space-around center">\n            <div ng-if="item.closed && item.channel !== \'voice\'" class="text-truncate text-boxed-light">\n              <span class="red-fg" title="{{ \'DASHBOARDS.STATUS\' | translate}} : {{ \'DASHBOARDS.CLOSED\' | translate }} {{ item.dispositionsValues }}">\n                {{ \'DASHBOARDS.STATUS\' | translate}} : {{ \'DASHBOARDS.CLOSED\' | translate}} {{ item.dispositionsValues\n                }}\n              </span>\n            </div>\n            <span class="text-boxed md-background-bg green-fg" ng-if="!item.closed && item.channel !== \'voice\'" title="{{ \'DASHBOARDS.STATUS\' | translate}}: {{ \'DASHBOARDS.OPENED\' | translate}}">\n              {{ \'DASHBOARDS.STATUS\' | translate}}:\n              {{ \'DASHBOARDS.OPENED\' | translate}}\n              <span ng-if="item.substatus"> - {{ item.substatus }}</span>\n            </span>\n            <span ng-if="item.channel === \'voice\'" class="text-boxed md-background-bg red-fg" title="{{ item.userDisposition ? (\'DASHBOARDS.DISPOSITION\' | translate) + \':\' : \'\'}} {{ item.userDisposition ?\n                item.userDisposition : (\'DASHBOARDS.NO_DISPOSITION_SET\' | translate) }}">\n              {{ item.userDisposition ? (\'DASHBOARDS.DISPOSITION\' | translate) + \':\' : \'\'}} {{ item.userDisposition ?\n              item.userDisposition : (\'DASHBOARDS.NO_DISPOSITION_SET\' | translate) }}\n            </span>\n            <span ng-if="item.channel === \'voice\' && item.userSecondDisposition" class="text-boxed md-background-bg red-fg" title="{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}: {{ item.userSecondDisposition }}">\n              {{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:\n              {{ item.userSecondDisposition }}\n            </span>\n            <span ng-if="item.channel === \'voice\' && item.userThirdDisposition" class="text-boxed md-background-bg red-fg" title="{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}: {{ item.userThirdDisposition }}">\n              {{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:\n              {{ item.userThirdDisposition }}\n            </span>\n            <div flex></div>\n            <md-button ng-if="!vm.tab.spy && vm.user.role === \'agent\' && item.canOpen && item.channel !== \'voice\'" class="md-icon-button" aria-label="go" ng-click="vm.openInteraction(item)">\n              <md-icon md-font-icon="icon-open-in-new" class="s20"></md-icon>\n            </md-button>\n          </div>\n        </md-card>\n      </div>\n    </div>\n\n    <div ng-if="vm.canLoadMoreJourney" layout="row" layout-align="center center" class="ng-scope layout-align-center-center layout-row keep-on-top">\n      <md-button class="md-raised md-accent md-button ng-scope md-default-theme md-ink-ripple" type="button" ng-click="vm.loadMoreJourney()" translate="DASHBOARDS.MORE">\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / TIMELINE ITEM --\x3e\n</md-content>\n\n<div ng-if="!vm.journey || vm.journey.length === 0" layout="row" layout-align="center center">\n  <em translate="DASHBOARDS.NO_DATA_AVAILABLE">No data available</em>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.voice.html",'<md-divider></md-divider>\n\n<md-list flex>\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.TYPE">Type</p>\n      <h4>{{ item.type ? item.type : \'no type\' }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.SOURCE">Source</p>\n      <h4 privacy ng-cloak>{{ item.source ? item.source : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DESTINATION">Destination</p>\n      <h4 privacy ng-cloak>{{ item.destination ? item.destination : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.UNIQUEID">Uniqueid</p>\n      <h4>{{ item.uniqueid ? item.uniqueid : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CALLERID">Caller Id</p>\n      <h4 privacy ng-cloak>{{ item.callerid ? item.callerid : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.STARTEDAT">Started At</p>\n      <h4>{{ item.starttime | date:\'medium\' }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.END_AT">End At</p>\n      <h4>{{ item.endtime | date:\'medium\' }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DURATION">Duration</p>\n      <h4>{{ item.duration ? item.duration : \'--\' }}s</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.NOTE">Note</p>\n      <h4>{{ item.note ? item.note : \'--\' }}</h4>\n    </div>\n  </md-list-item>\n</md-list>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.mail.html",'<div ng-init="item = item || vm.interaction">\n  <md-list-item class="md-2-line" ng-if="item.subject">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.SUBJECT">Subject</p>\n      <h4>{{ item.subject }}</h4>\n    </div>\n  </md-list-item>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.openchannel.html",'<div ng-init="item = item || vm.interaction">\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.VISIBILITY">Visibility</p>\n      <h4 translate="{{ item.threadId ? \'DASHBOARDS.PUBLIC\' : \'DASHBOARDS.PRIVATE\'}}"></h4>\n    </div>\n  </md-list-item>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.html",'\x3c!-- MESSAGES --\x3e\n<div layout="row" ng-repeat="message in vm.messages.rows" class="md-padding message-row" ng-class="vm.getMessagesAlignment(message)">\n  <img ng-if="message.direction ===\'in\'" src="assets/images/avatars/customer.png" class="avatar" />\n  <img ng-if="message.direction ===\'out\' && message.UserId && !message.secret" ng-src="api/users/{{message.UserId}}/avatar" class="avatar" />\n  <img ng-if="message.direction ===\'out\' && message.UserId && message.secret" ng-src="api/users/{{message.UserId}}/avatar" class="avatar" />\n  <img ng-if="message.direction ===\'out\' && !message.UserId" class="avatar" src="assets/images/avatars/robot.png">\n  <md-button ng-if="vm.tab.channel === \'fax\'" class="md-fab md-mini no-margin" aria-label="Download" ng-click="vm.downloadMessage(message)">\n    <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n  </md-button>\n\n  <div class="bubble" ng-class="{\'md-yellow-200-bg\': message.secret}" ng-switch="message.direction">\n    <div ng-if="message.secret">\n      <div class="time secondary-text" layout="row" layout-align="end center">\n        <div layout-padding>\n          <span privacy ng-cloak>{{ vm.getLabelByMessage(message) }}</span>\n          <span> - {{message.createdAt | date: \'medium\'}}</span>\n        </div>\n        <div ng-if="message.id">\n          <md-icon class="s18" md-font-icon="icon-lock"></md-icon>\n        </div>\n      </div>\n    </div>\n    <div ng-if="!message.secret">\n      <div ng-switch-when="in" class="time secondary-text" ng-click="message.Contact && vm.openContact(ev, message.Contact)">\n        <span privacy ng-cloak>{{ vm.getLabelByMessage(message) }}</span>\n        <span> - {{message.createdAt | date: \'medium\'}}</span>\n      </div>\n      <div ng-switch-when="out" class="time secondary-text" layout="row" layout-align="end center">\n        <div layout-padding>\n          <span privacy ng-cloak>{{ vm.getLabelByMessage(message) }}</span>\n          <span> - {{message.createdAt | date: \'medium\'}}</span>\n        </div>\n        <div ng-if="message.id && vm.tab.channel !== \'fax\'">\n          <md-icon ng-if="!message.read" class="s18" md-font-icon="icon-check"></md-icon>\n          <md-icon ng-if="message.read" class="s18" md-font-icon="icon-check-all md-accent"></md-icon>\n        </div>\n        <div ng-if="message.id && vm.tab.channel === \'fax\'">\n          <md-icon ng-if="!message.read && !(message.failMessage )" class="s18" md-font-icon="icon-check"></md-icon>\n          <md-icon ng-if="message.read" class="s18" md-font-icon="icon-check-all md-accent"></md-icon>\n          <span ng-if="!message.read && message.failMessage" class="s18 red-900-fg"> {{ message.failMessage }}</span>\n          <md-icon ng-if="!message.read && message.failMessage" class="s18 red-900-fg" md-font-icon="icon-close md-accent"></md-icon>\n        </div>\n      </div>\n    </div>\n    <div ng-if="message.AttachmentId" layout="row" layout-align="end center">\n      <md-button ng-if="vm.downloadPermissions.attachments" class="md-raised md-accent" ng-click="vm.getAttachment({id: message.AttachmentId, name: vm.htmlToPlaintext(message.body)})">\n        <span>{{vm.htmlToPlaintext(message.body)}}</span>\n        <md-icon md-font-icon="icon-download"></md-icon>\n      </md-button>\n      <div ng-if="!vm.downloadPermissions.attachments" class="disabled-button">\n        <span>{{vm.htmlToPlaintext(message.body)}}</span>\n        <md-icon md-font-icon="icon-download"></md-icon>\n      </div>\n    </div>\n    <div ng-if="!message.AttachmentId" class="message" layout="row" layout-align="end center">\n      <span ng-bind-html="message.body | embed: vm.embedOptions"></span>\n    </div>\n  </div>\n</div>\n\x3c!-- / MESSAGES --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.mail.html",'<div ms-timeline="vm.interactionTimelineOptions" ms-timeline-load-more="vm.loadNextPage()">\n  <div ng-repeat="message in vm.messages.rows track by message.id" ng-init="vm.selectedMailShowSystemMessage[message.id] = false">\n    <md-card ng-if="message.secret" class="md-padding md-yellow-100-bg" layout="column">\n      <div layout="row" layout-align="start center">\n        <img class="avatar" ng-src="api/users/{{message.UserId}}/avatar">\n        <div layout="column">\n          <span class="grey-fg">{{vm.agent.fullname || vm.usersMap[message.UserId]}}</span>\n          <span class="grey-fg">{{message.createdAt | date:\'medium\'}}</span>\n        </div>\n      </div>\n      <div layout="row" layout-align="center center" layout-fill ng-if="message.attach && vm.downloadPermissions.attachments">\n        <div flex>\n          <md-divider></md-divider>\n        </div>\n        <md-menu>\n          <md-button aria-label="attachments" class="md-icon-button" ng-click="vm.getAttachments(message); $mdOpenMenu($event);">\n            <md-tooltip md-direction="bottom"><span translate="MAIL.ATTACHMENTS">Attachments</span>\n            </md-tooltip>\n            <div layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="icon s24"></md-icon>\n              <span>{{message.attach}}</span>\n            </div>\n          </md-button>\n          <md-menu-content width="4">\n            <div layout="column" layout-align="center center" ng-if="!message.attachments">\n              <md-progress-circular md-mode="indeterminate"></md-progress-circular>\n              <span translate="MAIL.ATTACHMENTS">Attachments</span>\n            </div>\n            <md-menu-item ng-if="message.attachments" ng-repeat="attachment in message.attachments">\n              <md-button ng-click="vm.getAttachment(attachment)">\n                {{ attachment.name || (\'attachment-\' + $index) }}</md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n        <div flex>\n          <md-divider></md-divider>\n        </div>\n      </div>\n      <div class="padding-top-5" ng-bind-html-unsafe="message.body"></div>\n    </md-card>\n    <div ng-if="!message.secret">\n      <div layout="row" layout-align="center center" ng-if="message.direction == \'out\' && !message.UserId && !vm.selectedMailShowSystemMessage[message.id]">\n        <md-button class="md-raised blue-grey-300-bg white-fg" ng-click="vm.selectedMailShowSystemMessage[message.id] = !vm.selectedMailShowSystemMessage[message.id]">\n          [{{message.createdAt | date: \'medium\'}}] {{ \'MAIL.SHOW_AUTOREPLY\' | translate }}</md-button>\n      </div>\n      <md-card layout="column" class="md-padding message-row" ng-if="message.direction == \'in\' || (message.direction == \'out\' && (message.UserId || vm.selectedMailShowSystemMessage[message.id]))">\n        <md-content class="mail-content">\n          <div class="info" layout="row" layout-align="space-between start">\n            <div layout="column" layout-align="start start">\n              <div layout="row" layout-align="start start">\n                <div layout="column" layout-align="start start">\n                  <div class="name" ng-click="message.Contact && vm.openContact(ev, message.Contact)">\n                    <strong privacy ng-cloak>{{message.from}}</strong>\n                    <md-icon ng-if="message.attach" md-font-icon="icon-paperclip" class="s16">\n                    </md-icon>\n                  </div>\n                  <div class="name">\n                    <div>{{message.subject}}</div>\n                  </div>\n                  <div class="name" layout="row" layout-align="start center"><span translate="MAIL.TO">To</span>: <span class="padding-left-5 subject text-truncate" privacy ng-cloak>{{ message.originTo || message.to\n                      }}</span>\n                  </div>\n                  <div class="name padding-top-10" layout="row" layout-align="start center" ng-if="message.direction == \'in\' && message.originCc && message.originCc.indexOf(vm.account.email) >= 0">\n                    <em><span class="blue-grey" translate="MAIL.YOU_ARE_REGISTERED_AS_A">You are\n                        registered as a</span> <span class="blue-grey">CC</span></em>\n                  </div>\n                  <div class="name padding-top-10" layout="row" layout-align="start center" ng-if="message.direction == \'in\' && message.bcc && message.bcc.indexOf(vm.account.email) >= 0">\n                    <em><span class="red-fg" translate="MAIL.YOU_ARE_REGISTERED_AS_A">You are\n                        registered as a</span> <span class="red-fg">BCC</span></em>\n                  </div>\n                </div>\n              </div>\n\n              <a class="toggle-details md-accent-color" ng-hide="vm.selectedMailShowDetails[message.id]" ng-click="vm.selectedMailShowDetails[message.id] = !vm.selectedMailShowDetails[message.id]" translate="MAIL.SHOW_DETAILS">\n                Show Details\n              </a>\n              <a class="toggle-details md-accent-color" ng-show="vm.selectedMailShowDetails[message.id]" ng-click="vm.selectedMailShowDetails[message.id] = !vm.selectedMailShowDetails[message.id]" translate="MAIL.HIDE_DETAILS">\n                Hide Details\n              </a>\n              <div ng-show="vm.selectedMailShowDetails[message.id]" class="details" layout="row" layout-align="start start">\n                <div layout="column">\n                  <span class="title" translate="MAIL.DATE">Date:</span>\n                  <span class="title" translate="MAIL.FROM">From:</span>\n                  <span class="title" translate="MAIL.TO">To:</span>\n                  \x3c!-- NOTE: Start retrocompatibility with replyCc 2.0.66 --\x3e\n                  <span class="title" translate="MAIL.CC" ng-if="message.direction === \'in\' && message.originCc">Cc:</span>\n                  <span class="title" translate="MAIL.CC" ng-if="message.direction === \'in\' && !message.originCc && !message.originTo && message.cc">Cc:</span>\n                  <span class="title" translate="MAIL.CC" ng-if="message.direction === \'out\' && message.cc">Cc:</span>\n                  \x3c!-- End retrocompatibility --\x3e\n                  <span class="title" translate="MAIL.BCC" ng-if="message.bcc">Bcc:</span>\n                  <span class="title" translate="MAIL.ACCEPTED" ng-if="message.UserId && message.direction ===\'in\'">Accepted:</span>\n                </div>\n\n                <div layout="column">\n                  <span class="detail">{{message.createdAt | date:\'medium\'}}</span>\n                  <span class="detail" privacy ng-cloak>{{message.from}}</span>\n                  <span class="detail" privacy ng-cloak>{{message.originTo || message.to}}</span>\n                  \x3c!-- NOTE: Start retrocompatibility with replyCc 2.0.66 --\x3e\n                  <span class="detail" ng-if="message.direction === \'in\' && message.originCc" privacy ng-cloak>{{\n                    message.originCc }}</span>\n                  <span class="detail" ng-if="message.direction === \'in\' && !message.originCc && !message.originTo && message.cc" privacy ng-cloak>{{ message.cc }}</span>\n                  <span class="detail" ng-if="message.direction === \'out\' && message.cc" privacy ng-cloak>{{ message.cc\n                    }}</span>\n                  \x3c!-- End retrocompatibility --\x3e\n                  <span class="detail" ng-if="message.bcc" privacy ng-cloak>{{message.bcc}}</span>\n                  <span class="detail" ng-if="message.UserId && message.direction ===\'in\'">{{vm.usersMap[message.UserId]}}</span>\n                </div>\n              </div>\n            </div>\n\n            <div layout="row" layout-align="center center">\n              <div layout="column" layout-align="center end" class="md-padding">\n                <span class="grey-fg" ng-if="message.direction ===\'in\'" privacy>{{message.from.indexOf(vm.contact.email)\n                  >= 0 ? vm.contact.firstName + \' \' + vm.contact.lastName : \'*\' + message.from}}</span>\n                <span class="grey-fg" ng-if="message.direction ===\'out\' && message.UserId">{{vm.agent.fullname ||\n                  vm.usersMap[message.UserId]}}</span>\n                <span class="grey-fg" ng-if="message.direction ===\'out\' && !message.UserId">System</span>\n                <span class="grey-fg">{{message.createdAt | date:\'medium\'}}</span>\n              </div>\n              <img ng-if="message.direction ===\'in\'" ng-src="assets/images/avatars/customer.png" class="avatar" alt="customer" />\n              <img ng-if="message.direction ===\'out\' && message.UserId" class="avatar" ng-src="api/users/{{message.UserId}}/avatar">\n              <img ng-if="message.direction ===\'out\' && !message.UserId" class="avatar" src="assets/images/avatars/robot.png">\n            </div>\n          </div>\n\n          <div layout="row" layout-align="center center" layout-fill>\n            <div flex>\n              <md-divider></md-divider>\n            </div>\n            <div>\n              <div class="interaction-reply-button-container">\n                <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DRAFT">Draft</span>\n                </md-tooltip>\n                <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="draft" ng-disabled="!vm.draft" ng-click="vm.openDraft(message.id)">\n                  <md-icon md-font-icon="icon-pencil-box" class="icon s24"></md-icon>\n                </md-button>\n              </div>\n              <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="reply" ng-click="vm.composeMailInteraction(\'reply\', message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY">Reply</span></md-tooltip>\n                <md-icon md-font-icon="icon-reply" class="icon s24"></md-icon>\n              </md-button>\n              <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="replyAll" ng-click="vm.composeMailInteraction(\'replyAll\', message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY_ALL">Reply All</span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-reply-all" class="icon s24"></md-icon>\n              </md-button>\n              <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="forward" ng-click="vm.composeMailInteraction(\'forward\', message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.FORWARD">Forward</span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-forward" class="icon s24"></md-icon>\n              </md-button>\n              <md-button ng-if="!message.attach && vm.downloadPermissions.interactions" class="md-icon-button" aria-label="forward" ng-click="vm.downloadMessage(message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.DOWNLOAD">Download</span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n              </md-button>\n              <md-menu ng-if="message.attach && vm.downloadPermissions.interactions" class="no-margin" md-position-mode="target-right target">\n                <md-button class="md-icon-button" ng-click="$mdOpenMenu()" aria-label="download">\n                  <md-tooltip md-direction="bottom"><span translate="MAIL.DOWNLOAD">Download</span>\n                  </md-tooltip>\n                  <md-icon md-font-icon="icon-download"></md-icon>\n                </md-button>\n                <md-menu-content width="2">\n                  <md-menu-item ng-if="vm.downloadPermissions.attachments">\n                    <md-button ng-click="vm.downloadMessage(message, true)" translate="MAIL.DOWNLOAD_WITH_ATTACHMENTS">\n                      Download with attachments\n                    </md-button>\n                  </md-menu-item>\n                  <md-menu-item>\n                    <md-button ng-click="vm.downloadMessage(message)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                      Download without attachments\n                    </md-button>\n                  </md-menu-item>\n                </md-menu-content>\n              </md-menu>\n              <md-menu ng-if="message.attach && vm.downloadPermissions.attachments">\n                <md-button aria-label="attachments" class="md-icon-button" ng-click="vm.getAttachments(message); $mdOpenMenu($event);">\n                  <md-tooltip md-direction="bottom"><span translate="MAIL.ATTACHMENTS">Attachments</span></md-tooltip>\n                  <div layout="row" layout-align="start center">\n                    <md-icon md-font-icon="icon-paperclip" class="icon s24"></md-icon>\n                    <span>{{message.attach}}</span>\n                  </div>\n                </md-button>\n                <md-menu-content width="4">\n                  <div layout="column" layout-align="center center" ng-if="!message.attachments">\n                    <md-progress-circular md-mode="indeterminate"></md-progress-circular>\n                    <span translate="MAIL.ATTACHMENTS">Attachments</span>\n                  </div>\n                  <md-menu-item ng-if="message.attachments" ng-repeat="attachment in message.attachments">\n                    <md-button ng-click="vm.getAttachment(attachment)">\n                      {{ attachment.name || (\'attachment-\' + $index) }}</md-button>\n                  </md-menu-item>\n                </md-menu-content>\n              </md-menu>\n            </div>\n            <div flex>\n              <md-divider></md-divider>\n            </div>\n          </div>\n\n          <md-content ng-bind-html-unsafe="message.body"></md-content>\n        </md-content>\n      </md-card>\n    </div>\n    <div ng-hide="!(vm.BTNLoadMore > 0)" layout="row" layout-align="center center" class="ng-scope layout-align-center-center layout-row">\n      <md-button class="md-raised md-accent md-button ng-scope md-default-theme md-ink-ripple" type="button" ng-disabled="!(vm.BTNLoadMore > 0)" ng-click="vm.loadNextPage()" translate="DASHBOARDS.MORE">\n      </md-button>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.loading.html",'<div class="big-circle md-whiteframe-4dp">\n  <md-icon class="s128 md-accent" md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n</div>\n<span class="app-title" translate="DASHBOARDS.WAITING">Waiting</span>\n<span class="hide show-gt-md secondary-text" translate="DASHBOARDS.LOADING_INTERACTION">We are loading the\n  interaction...</span>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.chat.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeChatInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="CHAT.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.fax.html",'<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="reply" ng-click="vm.composeFaxInteraction(\'new\')">\n  <md-tooltip md-direction="bottom"><span translate="FAX.REPLY">Reply</span></md-tooltip>\n  <md-icon md-font-icon="icon-reply" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="Download" ng-click="vm.downloadInteraction(vm.interaction)" ng-if="vm.downloadPermissions.interactions">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n  <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.html",'<div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n  <md-icon md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" class="s20" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n  <div class="padding-left-10" layout="column" layout-align="center start" flex>\n    <div class="font-size-14" layout="row" layout-align="start center" layout-fill>\n      <span>#{{vm.interaction.id}} - {{vm.account.key}}</span>\n      <div layout="row" layout-align="center center" class="p-8">\n        <md-icon ng-if="vm.tab.channel === \'openchannel\' && vm.interaction.threadId" md-font-icon="fas fa-users" class="s16">\n          <md-tooltip><span translate="DASHBOARDS.PUBLIC_INTERACTION">The interaction is public</span></md-tooltip>\n        </md-icon>\n        <md-icon ng-if="vm.interaction.attach" md-font-icon="icon-paperclip" class="s16"></md-icon>\n      </div>\n      <span class="red-fg padding-left-25" ng-if="vm.interaction.closed" translate="DASHBOARDS.CLOSED">CLOSED</span>\n      <span class="green-fg padding-left-25" ng-if="!vm.interaction.closed"><span translate="DASHBOARDS.OPENED">OPENED</span><span ng-if="vm.interaction.substatus"> -\n          {{vm.interaction.substatus}}</span></span>\n      <div layout="row" layout-align="center center" class="blue-grey-300-fg padding-left-40" ng-if="!vm.interaction.closed">\n        <timer start-time="vm.interaction.createdAt"></timer>\n        <md-icon md-font-icon="icon-timelapse" class="s16 padding-left-5"></md-icon>\n      </div>\n    </div>\n    <div class="tags" layout="row" layout-align="start center" ng-if="vm.interaction.Tags.length" ng-class="{\'padding-top-5\': vm.interaction.Tags.length}">\n      <div class="tag margin-right-5" layout="row" layout-align="center center" ng-repeat="tag in vm.interaction.Tags">\n        <div class="tag-color" ng-style="{\'background\': tag.color}"></div>\n        <div class="tag-label">{{tag.name}}</div>\n      </div>\n    </div>\n  </div>\n  <div layout="row" layout-align="end center">\n    <div ng-switch="vm.tab.channel">\n      <div ng-switch-when="mail">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.mail.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="fax">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.fax.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="sms">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.sms.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="whatsapp">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.whatsapp.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="chat">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.chat.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="openchannel">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.openchannel.html\'">\n        </div>\n      </div>\n    </div>\n    <md-menu ng-if="[\'fax\', \'sms\', \'whatsapp\'].indexOf(vm.tab.channel) < 0 && vm.downloadPermissions.interactions" class="no-margin" md-position-mode="target-right target">\n      <md-button class="md-icon-button" ng-click="$mdOpenMenu()" aria-label="download">\n        <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n        <md-icon md-font-icon="icon-download"></md-icon>\n      </md-button>\n      <md-menu-content width="2">\n        <md-menu-item ng-if="vm.downloadPermissions.attachments">\n          <md-button ng-click="vm.downloadInteraction(vm.interaction, true)" translate="DASHBOARDS.DOWNLOAD_WITH_ATTACHMENTS">\n            Download with attachments\n          </md-button>\n        </md-menu-item>\n        <md-menu-item>\n          <md-button ng-click="vm.downloadInteraction(vm.interaction)" translate="DASHBOARDS.DOWNLOAD_WITHOUT_ATTACHMENTS">\n            Download without attachments\n          </md-button>\n        </md-menu-item>\n      </md-menu-content>\n    </md-menu>\n    <md-menu class="no-margin" ng-if="!vm.interaction.disposition" md-position-mode="target-right target">\n      <md-button class="md-icon-button" ng-click="$mdOpenMenu()" aria-label="more">\n        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n      </md-button>\n\n      <md-menu-content width="2">\n\n        <md-menu-item ng-if="vm.tab.channel === \'chat\' && !vm.interaction.closed && !vm.tab.spy && vm.account.vidaooEscalation && vm.account.vidaooApiKey">\n          <md-button ng-click="vm.createVidaooSession(vm.interaction)" translate="DASHBOARDS.VIDAOOSESSION">\n            Start Video Call\n          </md-button>\n        </md-menu-item>\n\n        <md-menu-item>\n          <md-button ng-click="vm.tagInteraction()" translate="DASHBOARDS.TAG">\n            Tag\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="vm.account.queueTransfer || vm.account.agentTransfer">\n          <md-button ng-click="vm.transferLastMessage()" translate="DASHBOARDS.TRANSFER">\n            Transfer\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.interaction.closed && vm.tab.channel == \'mail\' && (vm.subStatuses.rows.length || vm.interaction.substatus != null)">\n          <md-menu>\n            <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.SET_AS">\n              Set as\n            </md-button>\n            <md-menu-content>\n              <md-menu-item ng-if="vm.interaction.substatus != null">\n                <md-button ng-click="vm.setAs(null)" translate="DASHBOARDS.NONE">\n                  None\n                </md-button>\n              </md-menu-item>\n              <md-menu-item ng-repeat="subStatus in vm.subStatuses.rows">\n                <md-button ng-click="vm.setAs(subStatus.name)">\n                  {{subStatus.name}}\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.interaction.closed && vm.tab.channel == \'mail\' && vm.account.markAsUnread">\n          <md-button ng-click="vm.markAsUnread()" translate="DASHBOARDS.MARK_AS_UNREAD">\n            Unread\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.tab.spy && !vm.interaction.closed">\n          <md-button ng-click="vm.disposeInteraction()" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n            Close and Dispose\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.tab.spy && vm.interaction.closed && !vm.interaction.disposition">\n          <md-button ng-click="vm.disposeInteraction(ev)" translate="DASHBOARDS.DISPOSE">\n            Dispose\n          </md-button>\n        </md-menu-item>\n      </md-menu-content>\n    </md-menu>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.mail.html",'<div class="interaction-reply-button-container">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DRAFT">Draft</span></md-tooltip>\n  <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="draft" ng-disabled="!vm.draft" ng-click="vm.openDraft()">\n    <md-icon ng-cloak md-font-icon="icon-pencil-box" class="icon s24" ng-class="vm.draft ? \'red-500-fg\' : \'grey-fg\'"></md-icon>\n  </md-button>\n</div>\n<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="reply" ng-click="vm.composeMailInteraction(\'reply\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY">Reply</span></md-tooltip>\n  <md-icon md-font-icon="icon-reply" class="icon s24"></md-icon>\n</md-button>\n<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="replyAll" ng-click="vm.composeMailInteraction(\'replyAll\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY_ALL">Reply All</span></md-tooltip>\n  <md-icon md-font-icon="icon-reply-all" class="icon s24"></md-icon>\n</md-button>\n<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="forward" ng-click="vm.composeMailInteraction(\'forward\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.FORWARD">Forward</span></md-tooltip>\n  <md-icon md-font-icon="icon-forward" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeMailInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.openchannel.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeOpenchannelInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="OPENCHANNEL.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.sms.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeSmsInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="SMS.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="Download" ng-click="vm.downloadInteraction(vm.interaction)" ng-if="vm.downloadPermissions.interactions">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n  <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.whatsapp.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeWhatsappInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="WHATSAPP.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="Download" ng-click="vm.downloadInteraction(vm.interaction)" ng-if="vm.downloadPermissions.interactions">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n  <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/jscripty/agent.general.jscripty.html",'<md-content class="md-padding" layout="column" layout-align="center center">\n  <div layout="row" layout-align="center center">\n    <span ng-if="!vm.tab.saved" class="text-boxed md-green-bg">\n      <timer start-time="vm.starttime"></timer>\n    </span>\n    <span ng-if="vm.contact" class="text-boxed md-gray-bg font-weight-900">{{vm.contact.firstName}} {{vm.contact.lastName}} {{vm.contact.phone}}</span>\n    <md-button ng-if="vm.showResetButton" ng-click="vm.resetViewer()" md-no-ink class="md-raised md-accent orange-bg">\n      <md-icon md-font-icon="icon-rotate-left" class="icon s16"></md-icon> {{\'JSCRIPTY.RESET_SESSION\' | translate}}\n    </md-button>\n    <md-button ng-if="vm.contact" ng-click="vm.openContact($event, vm.contact)" md-no-ink class="md-raised md-accent" translate="JSCRIPTY.OPEN_CONTACT"></md-button>\n    <md-button ng-if="vm.showIncompleteSubmitButton" ng-click="vm.onSubmit($event, true)" md-no-ink class="md-raised md-accent green-bg" translate="JSCRIPTY.SUBMIT"></md-button>\n  </div>\n  <h1 ng-if="!vm.project.formData"><span translate="JSCRIPTY.PROJECT_NOT_AVAILABLE">Project is not available. Please contact the administrator</span></h1>\n  <mw-form-viewer ng-if="vm.project.formData" form-data="vm.project.formData" response-data="vm.project.responseData" on-submit="vm.onSubmit($event)" template-data="call" api="vm.formViewer"></mw-form-viewer>\n</md-content>'),e.put("app/main/apps/dashboards/views/general/agent/notification/dialog.html",'\x3c!-- <md-toast> --\x3e\n<div class="md-padding" layout="column" layout-align="center center">\n  <span class="md-title">#{{vm.notification.id}} {{vm.notification.title}}</span>\n  <span class="md-subhead" ng-if="vm.notification.queue">{{vm.notification.queue}}</span>\n  <div class="padding-top-5" layout="row">\n    <md-button class="md-raised md-accent" ng-click="vm.accept($event)" translate="DASHBOARDS.ACCEPT">\n      ACCEPT\n    </md-button>\n    <md-button class="md-raised md-warn" ng-click="vm.reject($event)" translate="DASHBOARDS.REJECT">\n      REJECT\n    </md-button>\n  </div>\n</div>\n\x3c!-- </md-toast> --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/popup/agent.general.popup.html",'<md-content class="md-padding" flex>\n  <div ng-if="vm.html" ng-bind-html="vm.html"></div>\n  <h1 ng-if="!vm.html">Template is empty. Please contact the administrator</h1>\n</md-content>'),e.put("app/main/apps/dashboards/views/general/user/chat/user.general.chat.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-hangouts" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-52 line-height-72">\n            {{vm.inbound.abandoned || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ABANDONED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.ABANDONED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDONED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgTalkTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_MANAGED_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_MANAGED_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_MANAGED_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ABANDONED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.ABANDONED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDONED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/dialer/user.general.dialer.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-outgoing" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_MOTION_BULL_STATS">Today Motion Bull STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-timelapse"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{(vm.inbound.talking || 0) + (vm.inbound.pTalking || 0)}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_TALKING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_TALKING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_TALKING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-missed"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-52 line-height-72">\n            {{vm.inbound.outboundDropCallsDayCallersExit || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDONED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDONED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDON_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-outgoing"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.outboundDropCallsDayTimeout || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.DROPPED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.DROPPED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.DROPPED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-dots"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.originated || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ORIGINATED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.ORIGINATED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ORIGINATED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgTalkTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_AVG_TALK_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.outboundanswerRate || 0 |number : 1}}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWER_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWER_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWER_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.outboundAbandonRate || 0}}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDON_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDON_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ABANDON_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.outboundDropRate }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.DROP_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.DROP_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.DROP_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET OUTBOUND --\x3e\n\n\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-outgoing" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_IVR_CAMPAIGNS_STATS">Today IVR campaigns stats</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-dots"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.ivr.originated || 0}}/{{vm.ivr.limitCalls || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ORIGINATED\' | translate | uppercase}}/{{\'DASHBOARDS.LIMITED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.LIMITED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ORIGINATEDLIMITED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET IVR --\x3e'),e.put("app/main/apps/dashboards/views/general/user/fax/user.general.fax.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-deskphone" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/mail/user.general.mail.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-email" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/openchannel/user.general.openchannel.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-google-earth" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/sms/user.general.sms.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-message-text" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/user.general.html",'<div id="dashboard-general" ng-init="vm.onInit()" class="page-layout simple right-sidenav" layout="row">\n  \x3c!-- CENTER --\x3e\n  <div class="center" flex>\n    \x3c!-- CONTENT --\x3e\n    <div class="content">\n      <md-tabs ng-if="vm.hasDashboardPermissions" md-selected="vm.selectedTab" md-dynamic-height>\n        <md-tab ng-if="vm.license.voice" label="{{\'DASHBOARDS.VOICE\' | translate}}" ui-sref="app.dashboards.general.voice">\n          <div ui-view="voice"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.dialer" label="{{\'DASHBOARDS.MOTIONDIALER\' | translate}}" ui-sref="app.dashboards.general.dialer">\n          <div ui-view="dialer"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.chat" label="{{\'DASHBOARDS.CHAT\' | translate}}" ui-sref="app.dashboards.general.chat">\n          <div ui-view="chat"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.mail" label="{{\'DASHBOARDS.MAIL\' | translate}}" ui-sref="app.dashboards.general.mail">\n          <div ui-view="mail"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.messaging" label="{{\'DASHBOARDS.SMS\' | translate}}" ui-sref="app.dashboards.general.sms">\n          <div ui-view="sms"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.openchannel" label="{{\'DASHBOARDS.OPENCHANNEL\' | translate}}" ui-sref="app.dashboards.general.openchannel">\n          <div ui-view="openchannel"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.fax" label="{{\'DASHBOARDS.FAX\' | translate}}" ui-sref="app.dashboards.general.fax">\n          <div ui-view="fax"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.whatsapp" label="{{\'DASHBOARDS.WHATSAPP\' | translate}}" ui-sref="app.dashboards.general.whatsapp">\n          <div ui-view="whatsapp"></div>\n        </md-tab>\n      </md-tabs>\n    </div>\n    \x3c!-- END CONTENT --\x3e\n\n    <md-content ng-if="!vm.hasDashboardPermissions" layout="row" layout-align="space-around center" flex layout-padding layout-wrap>\n      <div layout="column" layout-align="space-around center" flex="50">\n        <span class="font-size-40 text-center">{{ \'DASHBOARDS.WELCOME_TO_MOTION\' | translate }}!</span>\n        <span class="font-size-30 text-center" translate="DASHBOARDS.WELCOME_MESSAGE">Use the left sidebar to\n          navigate through available sections.</span>\n      </div>\n\n      <div layout="column" flex="50">\n        <img src="assets/images/avatars/permissions.png" alt="permissions">\n      </div>\n    </md-content>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/user/voice/user.general.voice.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-incoming" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INBOUND_STATS">Today Inbound STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-timelapse"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_TALKING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_TALKING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_TALKING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-missed"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-52 line-height-72">\n            {{vm.inbound.abandoned || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDONED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDONED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ABANDONED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-incoming"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-timer-sand"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgTalkTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_AVG_TALK_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWER_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWER_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWER_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDON_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDON_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDON_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-dots"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e\n\n\x3c!-- WIDGET OUTBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-outgoing" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_OUTBOUND_STATS">Today Outbound STATS</div>\n  </div>\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-outgoing"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.outbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.outbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OUTBOUND_ANSWERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.OUTBOUND_ANSWERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OUTBOUND_ANSWERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-clock"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{vm.outbound.sumDuration || 0 | secToTime | date:\'HH:mm:ss\'}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOT_DURATION\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.TOT_DURATION_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOT_DURATION\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-division"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{vm.outbound.total ? ((vm.outbound.sumDuration / vm.outbound.total) | number: 0) : 0 | secToTime | date:\'HH:mm:ss\'}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_DURATION\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_DURATION_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_DURATION\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-42 line-height-72">\n            {{vm.outbound.total ? (vm.outbound.answered / vm.outbound.total * 100) : 0 | number: 1}}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OUTBOUND_ANSWER_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.OUTBOUND_ANSWER_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OUTBOUND_ANSWER_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET OUTBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/whatsapp/user.general.whatsapp.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-whatsapp" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/fax/views/faxAccounts/create/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.faxAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="faxAccountForm[\'name\'].$error" ng-show="faxAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.faxAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="faxAccountForm[\'key\'].$error" ng-show="faxAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="FAX.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TRUNK">trunk</label>\n        <md-select name="TrunkId" ng-model="vm.faxAccount.TrunkId" required>\n          <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountForm[\'TrunkId\'].$error" ng-show="faxAccountForm[\'TrunkId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TRUNK_REQUIRED">trunk field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.LOCALSTATIONID">localstationid</label>\n        <input type="text" name="localstationid" ng-model="vm.faxAccount.localstationid" ng-required="true">\n\n        <div class="hint"><span translate="FAX.HELP.LOCALSTATIONID"></span></div>\n        <div ng-messages="faxAccountForm[\'localstationid\'].$error" ng-show="faxAccountForm[\'localstationid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.LOCALSTATIONID_REQUIRED">localstationid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.faxAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountForm[\'ListId\'].$error" ng-show="faxAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.faxAccount.description">\n\n        <div ng-messages="faxAccountForm[\'description\'].$error" ng-show="faxAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFaxAccount" ng-click="vm.saveFaxAccount()" class="send-button md-accent md-raised" ng-disabled="faxAccountForm.$invalid || faxAccountForm.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFaxAccount" ng-click="vm.addNewFaxAccount()" class="send-button md-accent md-raised" ng-disabled="faxAccountForm.$invalid" aria-label="ADD" translate="FAX.ADD_FAXACCOUNT" translate-attr-aria-label="FAX.ADD_FAXACCOUNT">\n          ADD FAXACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFaxAccount" ng-click="vm.deleteFaxAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="FAX.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="FAX.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",'<md-dialog class="faxAccount-dialog" aria-label="faxAccount" ng-init="vm.onInit()">\n  <form name="faxAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="FAX.AGENTADD_FAXACCOUNT">Add Agent to faxAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/agent/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'agent\'].$error" ng-show="faxAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'timeout\'].$error" ng-show="faxAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/close/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'disposition\'].$error" ng-show="faxAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'condition\'].$error" ng-show="faxAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'truepriority\'].$error" ng-show="faxAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'falsepriority\'].$error" ng-show="faxAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'priority\'].$error" ng-show="faxAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/noop/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'value\'].$error" ng-show="faxAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/queue/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'queue\'].$error" ng-show="faxAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'timeout\'].$error" ng-show="faxAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/system/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'command\'].$error" ng-show="faxAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'variable\'].$error" ng-show="faxAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/tag/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'tag\'].$error" ng-show="faxAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/view.html",'<div id="fax-faxAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-faxAccounts-button md-icon-button" aria-label="Go to faxAccounts" ng-click="vm.gotoFaxAccounts()" translate translate-attr-aria-label="FAX.GO_TO_FAXACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="faxAccount-image" hide-xs>\n          <img ng-src="assets/images/business/faxAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.faxAccount.id}}\n            <span ng-if="vm.faxAccount.name">{{vm.faxAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="FAX.CREATED_AT"></span> <span>{{vm.faxAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.faxAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="FAX.GOTO_FAXACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.faxAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="FAX.AGENTADD_FAXACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFaxAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (advancedForm.$invalid) || (dispositionForm.$invalid) || (faxDispositionsForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="FAX.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.faxAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.faxAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="FAX.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.HEADERINFO">headerinfo</label>\n                <input type="text" name="headerinfo" ng-model="vm.faxAccount.headerinfo" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.HEADERINFO"></span></div>\n                <div ng-messages="generalForm[\'headerinfo\'].$error" ng-show="generalForm[\'headerinfo\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.HEADERINFO_REQUIRED">headerinfo field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.TRUNK">trunk</label>\n                <md-select name="TrunkId" ng-model="vm.faxAccount.TrunkId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkId\'].$error" ng-show="generalForm[\'TrunkId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.TRUNK_REQUIRED">trunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.LOCALSTATIONID">localstationid</label>\n                <input type="text" name="localstationid" ng-model="vm.faxAccount.localstationid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.LOCALSTATIONID"></span></div>\n                <div ng-messages="generalForm[\'localstationid\'].$error" ng-show="generalForm[\'localstationid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.LOCALSTATIONID_REQUIRED">localstationid field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.faxAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.faxAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.faxAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="faxAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="FAX.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.faxAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="faxAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.faxAccount.queueTransfer == true" class="md-block">\n                <label translate="FAX.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.faxAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.faxAccount.agentTransfer == true" class="md-block">\n                <label translate="FAX.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.faxAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="FAX.ECM">ECM</label>\n                <md-select name="ecm" ng-model="vm.faxAccount.ecm" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.ECM"></span></div>\n                <div ng-messages="advancedForm[\'ecm\'].$error" ng-show="advancedForm[\'ecm\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.ECM_REQUIRED">ECM field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.MINRATE">minrate</label>\n                <md-select name="minrate" ng-model="vm.faxAccount.minrate" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'2400\'">2400</md-option>\n                  <md-option ng-value="\'4800\'">4800</md-option>\n                  <md-option ng-value="\'7200\'">7200</md-option>\n                  <md-option ng-value="\'9600\'">9600</md-option>\n                  <md-option ng-value="\'12000\'">12000</md-option>\n                  <md-option ng-value="\'14400\'">14400</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.MINRATE"></span></div>\n                <div ng-messages="advancedForm[\'minrate\'].$error" ng-show="advancedForm[\'minrate\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MINRATE_REQUIRED">minrate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.MAXRATE">maxrate</label>\n                <md-select name="maxrate" ng-model="vm.faxAccount.maxrate" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'2400\'">2400</md-option>\n                  <md-option ng-value="\'4800\'">4800</md-option>\n                  <md-option ng-value="\'7200\'">7200</md-option>\n                  <md-option ng-value="\'9600\'">9600</md-option>\n                  <md-option ng-value="\'12000\'">12000</md-option>\n                  <md-option ng-value="\'14400\'">14400</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.MAXRATE"></span></div>\n                <div ng-messages="advancedForm[\'maxrate\'].$error" ng-show="advancedForm[\'maxrate\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MAXRATE_REQUIRED">maxrate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.MODEM">modem</label>\n                <input type="text" name="modem" ng-model="vm.faxAccount.modem" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.MODEM"></span></div>\n                <div ng-messages="advancedForm[\'modem\'].$error" ng-show="advancedForm[\'modem\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MODEM_REQUIRED">modem field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.GATEWAY">gateway</label>\n                <input type="text" name="gateway" ng-model="vm.faxAccount.gateway" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.GATEWAY"></span></div>\n                <div ng-messages="advancedForm[\'gateway\'].$error" ng-show="advancedForm[\'gateway\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.GATEWAY_REQUIRED">gateway field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.FAXDETECT">faxdetect</label>\n                <input type="text" name="faxdetect" ng-model="vm.faxAccount.faxdetect" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.FAXDETECT"></span></div>\n                <div ng-messages="advancedForm[\'faxdetect\'].$error" ng-show="advancedForm[\'faxdetect\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.FAXDETECT_REQUIRED">faxdetect field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.T38TIMEOUT">t38timeout</label>\n                <input type="number" name="t38timeout" ng-model="vm.faxAccount.t38timeout" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.T38TIMEOUT"></span></div>\n                <div ng-messages="advancedForm[\'t38timeout\'].$error" ng-show="advancedForm[\'t38timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.T38TIMEOUT_REQUIRED">t38timeout field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.SIP">SIP</label>\n                <md-select name="tech" ng-model="vm.faxAccount.tech" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'SIP\'">SIP</md-option>\n                  <md-option ng-value="\'IAX\'">IAX</md-option>\n                  <md-option ng-value="\'DADHI\'">DADHI</md-option>\n                  <md-option ng-value="\'KHOMP\'">KHOMP</md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'tech\'].$error" ng-show="advancedForm[\'tech\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.SIP_REQUIRED">SIP field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="faxAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.faxAccount.mandatoryDisposition" class="md-block">\n                <label translate="FAX.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.faxAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="FaxAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.faxAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="faxAccount-detail-form-container faxdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedFaxAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="FAX.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add fax dispositions" translate translate-attr-label="FAX.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="faxAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'FAX.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'FAX.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="FaxAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.faxAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="FAX.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedFaxAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedFaxAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedFaxAccountApps.length}} {{vm_ac.selectedFaxAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedFaxAccountApps($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedFaxAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.faxAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editFaxAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editFaxAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editFaxAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editFaxAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.faxAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="FaxAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.faxAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedFaxAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="FAX.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getFaxAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getFaxAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getFaxAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="FAX.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedFaxAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedFaxAccountInteractions.length}} {{vm_dc.selectedFaxAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedFaxAccountInteractions" csv-label="true" filename="faxAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedFaxAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedFaxAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getFaxAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'FAX.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'FAX.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'FAX.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'FAX.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'FAX.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'FAX.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'FAX.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.faxAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'FAX.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'FAX.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spyfaxInteraction($event, interaction)" translate="FAX.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.faxInteractionDownload(interaction, $event)" translate="FAX.DOWNLOAD_INTERACTION">\n                                Download\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="FAX.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.faxAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="FAX.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.faxAccountInteractions.count}}" md-on-paginate="vm_dc.getFaxAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/fax/views/faxAccounts/faxAccounts.html",'<div id="faxAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-deskphone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="FAX.FAXACCOUNTS">FaxAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="FAX.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFaxAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFaxAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="FAX.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-faxAccounts-count">\n          <span>{{vm.selectedFaxAccounts.length}}</span>\n          <span translate="FAX.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="FAX.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFaxAccounts()" translate="FAX.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFaxAccounts()" translate="FAX.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFaxAccounts" csv-label="true" filename="faxAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFaxAccounts($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FAXACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFaxAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'FAX.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'FAX.KEY\' | translate }}</th>\n                <th md-column md-order-by="TrunkId">{{ \'FAX.TRUNK\' | translate }}</th>\n                <th md-column md-order-by="localstationid">{{ \'FAX.LOCALSTATIONID\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'FAX.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.faxAccounts.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="faxAccount" md-select-id="id" ng-repeat="faxAccount in vm.faxAccounts.rows">\n                <td md-cell ng-if="faxAccount.userpic"><img class="avatar" alt="{{faxAccount.name}}" ng-src="api/users/{{faxAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!faxAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{faxAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="id ">{{faxAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="name ">{{faxAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="key ">{{faxAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="TrunkId ">{{ (vm.trunks | filter : {\'id\':faxAccount.TrunkId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="localstationid ">{{faxAccount.localstationid}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="description ">{{faxAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(faxAccount, $event    )" translate="FAX.EDIT_FAXACCOUNT">\n                          Edit FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(faxAccount, $event    )" translate="FAX.INTERACTIONS_FAXACCOUNT">\n                          Interactions FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(faxAccount, $event    )" translate="FAX.GOTOREALTIME_FAXACCOUNT">\n                          goToRealtime FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(faxAccount, $event    )" translate="FAX.AGENTADD_FAXACCOUNT">\n                          AgentAdd FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(faxAccount, $event    )" translate="FAX.DELETE_FAXACCOUNT">\n                          Delete FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.faxAccounts.count}}" md-on-paginate="vm.getFaxAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FAXACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FAXACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-faxAccount-button" ng-click="vm.createOrEditFaxAccount($event)" aria-label="add faxAccount" translate translate-attr-aria-label="FAX.ADD_FAXACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FAXACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/fax/views/faxQueues/create/dialog.html",'<md-dialog class="faxQueue-dialog" aria-label="New FaxQueue">\n  <form name="faxQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.faxQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newFaxQueue">\n\n        <div class="hint"><span translate="FAX.HELP.NAME"></span></div>\n        <div ng-messages="faxQueueForm[\'name\'].$error" ng-show="faxQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="FAX.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.faxQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="faxQueueForm[\'strategy\'].$error" ng-show="faxQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.faxQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="faxQueueForm[\'timeout\'].$error" ng-show="faxQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.faxQueue.description">\n\n        <div ng-messages="faxQueueForm[\'description\'].$error" ng-show="faxQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFaxQueue" ng-click="vm.saveFaxQueue()" class="send-button md-accent md-raised" ng-disabled="faxQueueForm.$invalid || faxQueueForm.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFaxQueue" ng-click="vm.addNewFaxQueue()" class="send-button md-accent md-raised" ng-disabled="faxQueueForm.$invalid" aria-label="ADD" translate="FAX.ADD_FAXQUEUE" translate-attr-aria-label="FAX.ADD_FAXQUEUE">\n          ADD FAXQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFaxQueue" ng-click="vm.deleteFaxQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="FAX.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="FAX.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",'<md-dialog class="faxQueue-dialog" aria-label="faxQueue" ng-init="vm.onInit()">\n  <form name="faxQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="FAX.AGENTADD_FAXQUEUE">Add Agent to faxQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",'<md-dialog class="faxQueue-dialog" aria-label="faxQueue" ng-init="vm.onInit()">\n  <form name="faxQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="FAX.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxQueues/edit/view.html",'<div id="fax-faxQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-faxQueues-button md-icon-button" aria-label="Go to faxQueues" ng-click="vm.gotoFaxQueues()" translate translate-attr-aria-label="FAX.GO_TO_FAXQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="faxQueue-image" hide-xs>\n          <img ng-src="assets/images/business/faxQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.faxQueue.id}}\n            <span ng-if="vm.faxQueue.name">{{vm.faxQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="FAX.CREATED_AT"></span> <span>{{vm.faxQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.faxQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="FAX.TEAMADD_FAXQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.faxQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="FAX.AGENTADD_FAXQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFaxQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="FAX.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.faxQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="FAX.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="FAX.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.faxQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.faxQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.faxQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/fax/views/faxQueues/faxQueues.html",'<div id="faxQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-deskphone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="FAX.FAXQUEUES">FaxQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="FAX.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFaxQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFaxQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="FAX.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-faxQueues-count">\n          <span>{{vm.selectedFaxQueues.length}}</span>\n          <span translate="FAX.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="FAX.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFaxQueues()" translate="FAX.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFaxQueues()" translate="FAX.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFaxQueues" csv-label="true" filename="faxQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFaxQueues($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FAXQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFaxQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'FAX.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'FAX.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.faxQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="faxQueue" md-select-id="id" ng-repeat="faxQueue in vm.faxQueues.rows">\n                <td md-cell ng-if="faxQueue.userpic"><img class="avatar" alt="{{faxQueue.name}}" ng-src="api/users/{{faxQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!faxQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{faxQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxQueue, ev) : vm.createOrEditFaxQueue($event, faxQueue)" md-cell class="id ">{{faxQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxQueue, ev) : vm.createOrEditFaxQueue($event, faxQueue)" md-cell class="name ">{{faxQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxQueue, ev) : vm.createOrEditFaxQueue($event, faxQueue)" md-cell class="strategy ">{{ vm.arraystrategy[faxQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(faxQueue, $event    )" translate="FAX.EDIT_FAXQUEUE">\n                          Edit FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(faxQueue, $event    )" translate="FAX.TEAMADD_FAXQUEUE">\n                          teamadd FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(faxQueue, $event    )" translate="FAX.AGENTADD_FAXQUEUE">\n                          agentadd FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(faxQueue, $event    )" translate="FAX.DELETE_FAXQUEUE">\n                          Delete FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(faxQueue, $event    )" translate="FAX.GOTOREALTIME_FAXQUEUE">\n                          goToRealtime FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.faxQueues.count}}" md-on-paginate="vm.getFaxQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FAXQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FAXQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-faxQueue-button" ng-click="vm.createOrEditFaxQueue($event)" aria-label="add faxQueue" translate translate-attr-aria-label="FAX.ADD_FAXQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FAXQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/fax/views/realtime/accounts/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="FAX.ACCOUNTS">Accounts</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.vm.getFaxAccounts()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- AGENT TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxAccounts">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate}}</th>\n        <th md-column>{{\'FAX.KEY\' | translate}}</th>\n        <th md-column>{{\'FAX.TOTAL\' | translate}}</th>\n        <th md-column>{{\'FAX.IN\' | translate}}</th>\n        <th md-column>{{\'FAX.OUT\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.faxAccounts">\n        <td md-cell colspan="4">\n          <div layout="row" layout-align="center center">\n            <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="vm.faxAccounts[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n        <td md-cell>{{vm.faxAccounts[value].name}}</td>\n        <td md-cell>{{vm.faxAccounts[value].key}}</td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{(vm.faxAccounts[value].in || 0) + (vm.faxAccounts[value].out || 0)}}</span>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-down-bold blue-fg"></md-icon>\n            </span>\n            <span class="md-capture blue-fg">{{vm.faxAccounts[value].in || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.in">{{vm.faxAccounts[value].lastIn ?  (vm.faxAccounts[value].lastIn | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-up-bold green-fg"></md-icon>\n            </span>\n            <span class="md-capture green-fg">{{vm.faxAccounts[value].out || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.out">{{vm.faxAccounts[value].lastOut ?  (vm.faxAccounts[value].lastOut | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-button ng-click="vm.goToFaxAccount($event, vm.faxAccounts[value])" translate="FAX.EDIT_ACCOUNT">\n                  Edit Account\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getFaxAccounts" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/fax/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="FAX.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n        <th md-column>{{ \'FAX.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'FAX.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'FAX.WAITING\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedIn }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="FAX.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="FAX.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/fax/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.TRUNKS">Trunks</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.ACCOUNTS">Accounts</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/fax/views/realtime/trunks/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="FAX.TRUNKS">Telephones</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getTrunks()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- TRUNKS TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head>\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTrunks">\n        <tr md-row>\n          <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n          <th md-column>{{ \'FAX.TRUNK_STATUS\' | translate }}</th>\n          <th md-column>{{ \'FAX.REGISTRY\' | translate }}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.trunks">\n        <td md-cell colspan="3">\n          <div layout="row" layout-align="center center">\n            <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(id, trunk) in vm.trunks">\n        <td md-cell>{{trunk.name}}</td>\n        <td md-cell>\n          <i ng-class="vm.statusClass[trunk.status.toLowerCase()]">\n            <md-tooltip>{{\'FAX.\' + trunk.status | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.status === \'registered\'" class="text-boxed">{{trunk.address}}</span>\n        </td>\n        <td md-cell>\n          <i ng-if="trunk.registry" ng-class="(trunk.stateRegistry.toLowerCase() === \'registered\') ? \'green-300-fg icon-checkbox-marked-circle\' : \'red-300-fg icon-close-circle\'">\n            <md-tooltip>{{\'FAX.\' + trunk.stateRegistry | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.registry && trunk.host && trunk.port" class="text-boxed">{{trunk.host}}:{{trunk.port}}</span>\n          <span ng-if="!trunk.registry" translate="FAX.NO_REGISTRY">\n            No Registry\n          </span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item>\n                <md-button ng-click="vm.goToTrunk($event, trunk)" translate="FAX.EDIT_TRUNK">\n                  Edit Trunk\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getTrunks" md-page-select></md-table-pagination>\n\x3c!-- / TRUNKS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/help/views/about/about.html",'<div id="maintenance" class="flex-scrollable" layout="column">\n  <div id="maintenance-form-wrapper" layout="column" layout-align="center center">\n    <div id="maintenance-form" class="md-whiteframe-8dp">\n      <div>\n        <img src="/api/settings/1/logo_login" alt="logo_login" />\n      </div>\n\n      <br>\n\n      <div>\n        <div class="info-line">\n          <div class="title">Useful pages</div>\n        </div>\n        <section layout="row" flex layout-sm="column" layout-align="center center" layout-wrap>\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button grey-bg" href="https://wiki.xcallymotion.com/display/XMV" target="_blank">\n              <md-icon md-font-icon="icon-wikipedia"></md-icon>\n            </a>\n            <div class="info"><a href="https://wiki.xcallymotion.com/display/XMV" target="_blank">Wiki</a></div>\n          </div>\n\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button md-accent" href="/apidoc" target="_blank">\n              <md-icon md-font-icon="icon-apple-mobileme"></md-icon>\n            </a>\n            <div class="info"><a href="/apidoc" target="_blank">Motion API</a></div>\n          </div>\n\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button orange-bg" href="http://www.xcally.com/bar/phonebar/Setup.msi" target="_blank">\n              <md-icon md-font-icon="icon-headphones"></md-icon>\n            </a>\n            <div class="info"><a href="https://www.xcally.com/bar/phonebar/Setup.msi" target="_blank">Phonebar Download</a></div>\n          </div>\n\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button green-bg" href="/demo" target="_blank">\n              <md-icon md-font-icon="icon-console"></md-icon>\n            </a>\n            <div class="info"><a href="/demo" target="_blank">Playground</a></div>\n          </div>\n\n        </section>\n\n        <br>\n\n        <div class="info-line" ng-if="!vm.license.custom">\n          <div class="title">Follow us on</div>\n        </div>\n        <section ng-if="!vm.license.custom" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n          <a class="md-fab md-mini md-button blue-900-bg" href="https://www.facebook.com/xcallymotion" target="_blank">\n            <md-icon md-font-icon="icon-facebook"></md-icon>\n          </a>\n\n          <a class="md-fab md-mini md-button" href="https://twitter.com/xcallymotion" target="_blank">\n            <md-icon md-font-icon="icon-twitter"></md-icon>\n          </a>\n          <a class="md-fab md-mini md-button md-warn" href="https://plus.google.com/+Xcally" target="_blank">\n            <md-icon md-font-icon="icon-google-plus"></md-icon>\n          </a>\n          <a class="md-fab md-mini md-button light-blue-800-bg" href="https://www.linkedin.com/company/xcally" target="_blank">\n            <md-icon md-font-icon="icon-linkedin"></md-icon>\n          </a>\n        </section>\n\n        <br ng-if="!vm.license.custom">\n\n        <div class="info-line" ng-if="!vm.license.custom">\n          <div class="title" translate="HELP.CONTACT_US">Contact Us</div>\n        </div>\n        <div class="info-line" ng-if="!vm.license.custom">\n          <div class="info"><a href="mailto:support@xcally.com" target="_top">support@xcally.com</a></div>\n        </div>\n\n        <br ng-if="!vm.license.custom">\n\n        <div class="info">xCALLY Motion <u>{{vm.info.current}}</u> | <a href="https://wiki.xcallymotion.com/display/XMV/Motion+GUI#MotionGUI-Version{{vm.info.current}}" target="_blank">Changelog</a></div>\n\n        <br>\n\n        <div class="info" ng-if="!vm.license.custom">xCALLY© 2016 - 2018 | Powered by Xenialab | <a href="http://www.xcally.com/support/eula-xcally-license-en.pdf" target="_blank">EULA</a></div>\n\n        <br ng-if="!vm.license.custom">\n\n        <div class="info" ng-if="!vm.license.custom"><a href="https://www.xenialab.com/" target="_blank">www.xenialab.com</a> | <a href="https://www.xcallymotion.com/" target="_blank">www.xcallymotion.com</a></div>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/integrations/views/deskAccounts/create/dialog.html",'<md-dialog class="deskAccount-dialog" aria-label="New DeskAccount">\n  <form name="deskAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.deskAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="deskAccountForm[\'name\'].$error" ng-show="deskAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.deskAccount.type" required>\n\n          <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n          <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="deskAccountForm[\'type\'].$error" ng-show="deskAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.deskAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="deskAccountForm[\'remoteUri\'].$error" ng-show="deskAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n        <md-select name="authType" ng-model="vm.deskAccount.authType" required>\n          <md-option ng-value="\'basic\'">Basic</md-option>\n        </md-select>\n        <div ng-messages="deskAccountForm[\'authType\'].$error" ng-show="deskAccountForm[\'authType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.deskAccount.authType == \'basic\'" class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.deskAccount.username" ng-required="true">\n\n        <div ng-messages="deskAccountForm[\'username\'].$error" ng-show="deskAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.deskAccount.authType == \'basic\'">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.deskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="deskAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.deskAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="deskAccountForm[\'serverUrl\'].$error" ng-show="deskAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.deskAccount.description">\n\n        <div ng-messages="deskAccountForm[\'description\'].$error" ng-show="deskAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDeskAccount" ng-click="vm.saveDeskAccount()" class="send-button md-accent md-raised" ng-disabled="deskAccountForm.$invalid || deskAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDeskAccount" ng-click="vm.addNewDeskAccount()" class="send-button md-accent md-raised" ng-disabled="deskAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DESKACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_DESKACCOUNT">\n          ADD DESKACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDeskAccount" ng-click="vm.deleteDeskAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/deskAccounts/deskAccounts.html",'<div id="deskAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.DESKACCOUNTS">DeskAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedDeskAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedDeskAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-deskAccounts-count">\n          <span>{{vm.selectedDeskAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllDeskAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectDeskAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedDeskAccounts" csv-label="true" filename="deskAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedDeskAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- DESKACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedDeskAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getDeskAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.deskAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="deskAccount" md-select-id="id" ng-repeat="deskAccount in vm.deskAccounts.rows">\n                <td md-cell ng-if="deskAccount.userpic"><img class="avatar" alt="{{deskAccount.name}}" ng-src="api/users/{{deskAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!deskAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{deskAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="id ">{{deskAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="name ">{{deskAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="remoteUri ">{{deskAccount.remoteUri}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="username ">{{deskAccount.username}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(deskAccount, $event    )" translate="INTEGRATIONS.EDIT_DESKACCOUNT">\n                          Edit DeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(deskAccount, $event    )" translate="INTEGRATIONS.TEST_DESKACCOUNT">\n                          Test DeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(deskAccount, $event    )" translate="INTEGRATIONS.DELETE_DESKACCOUNT">\n                          Delete DeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.deskAccounts.count}}" md-on-paginate="vm.getDeskAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / DESKACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD DESKACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-deskAccount-button" ng-click="vm.createOrEditDeskAccount($event)" aria-label="add deskAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_DESKACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD DESKACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/deskAccounts/edit/configurations/dialog.html",'<md-dialog class="deskConfiguration-dialog" aria-label="New DeskConfiguration">\n  <form name="deskConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.deskConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="deskConfigurationForm[\'name\'].$error" ng-show="deskConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.deskConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="deskConfigurationForm[\'channel\'].$error" ng-show="deskConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.deskConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="deskConfigurationForm[\'type\'].$error" ng-show="deskConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDeskConfiguration" ng-click="vm.saveDeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="deskConfigurationForm.$invalid || deskConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDeskConfiguration" ng-click="vm.addNewDeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="deskConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DESKCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_DESKCONFIGURATION">\n          ADD DESKCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDeskConfiguration" ng-click="vm.deleteDeskConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",'<md-dialog class="deskAccount-item-dialog" aria-label="New Item">\n  <form name="deskAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="deskAccountItemForm.type.$error" ng-show="deskAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="deskAccountItemForm.content.$error" ng-show="deskAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="deskAccountItemForm.key.$error" ng-show="deskAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="deskAccountItemForm.keyType.$error" ng-show="deskAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="deskAccountItemForm.keyContent.$error" ng-show="deskAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="deskAccountItemForm.variableName.$error" ng-show="deskAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="deskAccountItemForm.customField.$error" ng-show="deskAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="deskAccountItemForm.$invalid || deskAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="deskAccountItemForm.$invalid || deskAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="deskAccountItemForm.type.$error" ng-show="deskAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="deskAccountItemForm.option.$error" ng-show="deskAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="deskAccountItemForm.content.$error" ng-show="deskAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="deskAccountItemForm.variableName.$error" ng-show="deskAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="deskAccountItemForm.type.$error" ng-show="deskAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="deskAccountItemForm.content.$error"\n          ng-show="deskAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="deskAccountItemForm.variableName.$error"\n          ng-show="deskAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/deskAccounts/edit/view.html",'<div id="integrations-deskAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-deskAccounts-button md-icon-button" aria-label="Go to deskAccounts" ng-click="vm.gotoDeskAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_DESKACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="deskAccount-image" hide-xs>\n          <img ng-src="assets/images/business/deskAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.deskAccount.id}}\n            <span ng-if="vm.deskAccount.name">{{vm.deskAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.deskAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveDeskAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="deskAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.deskAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.deskAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n                  <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.deskAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n                <md-select name="authType" ng-model="vm.deskAccount.authType" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'basic\'">Basic</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'authType\'].$error" ng-show="generalForm[\'authType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.deskAccount.authType == \'basic\'" class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.deskAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.deskAccount.authType == \'basic\'">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.deskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.deskAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.deskAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="deskAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="DeskAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.deskAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDeskConfiguration($event)" class="md-icon-button" aria-label="create deskConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="deskConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedDeskConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getDeskConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ deskConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteDeskConfiguration($event, deskConfiguration)" translate="INTEGRATIONS.DELETE_DESKCONFIGURATION">\n                            Delete DeskConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.TAGS">TAGS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-table-container class="md-whiteframe-1dp padding-20">\n                        <md-input-container class="md-block">\n                          <label translate="INTEGRATIONS.TAGS">Tags</label>\n                          <md-select ng-model="vm_cc.selectedTags" ng-change="vm_cc.selectTagsChanged($event)" multiple>\n                            <md-option ng-value="tag.id" ng-repeat="tag in vm_cc.tags">{{ tag.name }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDeskConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/create/dialog.html",'<md-dialog class="dynamics365Account-dialog" aria-label="New Dynamics365Account">\n  <form name="dynamics365AccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.dynamics365Account.name" ng-required="true" autofocus>\n\n        <div ng-messages="dynamics365AccountForm[\'name\'].$error" ng-show="dynamics365AccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.dynamics365Account.modernAuthentication">\n          <span translate="INTEGRATIONS.MODERN_AUTHENTICATION">Modern Authentication</span>\n        </md-switch>\n        \x3c!-- <div class="hint"><span translate="INTEGRATIONS.HELP.MODERN_AUTHENTICATION"></span></div> --\x3e\n      </md-input-container>\n\n      <div ng-if="vm.dynamics365Account.modernAuthentication == false">\n\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.USERNAME">Username</label>\n          <input type="text" name="username" ng-model="vm.dynamics365Account.username" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'username\'].$error" ng-show="dynamics365AccountForm[\'username\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.PASSWORD">Password</label>\n          <input type="password" name="password" ng-model="vm.dynamics365Account.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" ng-required="true">\n          <div ng-messages="dynamics365AccountForm[\'password\'].$error" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.URI">Uri</label>\n          <input type="url" name="remoteUri" ng-model="vm.dynamics365Account.remoteUri" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'remoteUri\'].$error" ng-show="dynamics365AccountForm[\'remoteUri\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n            </div>\n            <div ng-message="url">\n              <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.TENANTID">TenantId</label>\n          <input type="text" name="tenantId" ng-model="vm.dynamics365Account.tenantId" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'tenantId\'].$error" ng-show="dynamics365AccountForm[\'tenantId\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.TENANTID_REQUIRED">TenantId field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n          <input type="text" name="clientId" ng-model="vm.dynamics365Account.clientId" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'clientId\'].$error" ng-show="dynamics365AccountForm[\'clientId\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n          <input type="text" name="clientSecret" ng-model="vm.dynamics365Account.clientSecret" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'clientSecret\'].$error" ng-show="dynamics365AccountForm[\'clientSecret\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n          <input type="url" name="serverUrl" ng-model="vm.dynamics365Account.serverUrl" value="LOCALIP" ng-required="true">\n\n          <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n          <div ng-messages="dynamics365AccountForm[\'serverUrl\'].$error" ng-show="dynamics365AccountForm[\'serverUrl\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n            </div>\n            <div ng-message="url">\n              <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n            </div>\n          </div>\n        </md-input-container>\n\n      </div>\n\n      <div ng-if="vm.dynamics365Account.modernAuthentication == true">\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.CLOUD_PROVIDER">Cloud Provider</label>\n          <md-select ng-model="vm.dynamics365Account.CloudProviderId" placeholder="Cloud Provider connection" ng-required="true">\n            <md-option value="{{provider.id}}" ng-repeat="provider in vm.cloudProviders">{{provider.name}}</md-option>\n          </md-select>\n        </md-input-container>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.dynamics365Account.description">\n\n        <div ng-messages="dynamics365AccountForm[\'description\'].$error" ng-show="dynamics365AccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDynamics365Account" ng-click="vm.saveDynamics365Account()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountForm.$invalid || dynamics365AccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDynamics365Account" ng-click="vm.addNewDynamics365Account()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DYNAMICS365ACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_DYNAMICS365ACCOUNT">\n          ADD DYNAMICS365ACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDynamics365Account" ng-click="vm.deleteDynamics365Account($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/dynamics365Accounts.html",'<div id="dynamics365Accounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.DYNAMICS365ACCOUNTS">Dynamics365Accounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedDynamics365Accounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedDynamics365Accounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-dynamics365Accounts-count">\n          <span>{{vm.selectedDynamics365Accounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllDynamics365Accounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectDynamics365Accounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedDynamics365Accounts" csv-label="true" filename="dynamics365Accounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedDynamics365Accounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- DYNAMICS365ACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedDynamics365Accounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getDynamics365Accounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="modernAuthentication">{{ \'INTEGRATIONS.MODERN_AUTHENTICATION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.dynamics365Accounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="dynamics365Account" md-select-id="id" ng-repeat="dynamics365Account in vm.dynamics365Accounts.rows">\n                <td md-cell ng-if="dynamics365Account.userpic"><img class="avatar" alt="{{dynamics365Account.name}}" ng-src="api/users/{{dynamics365Account.id}}/avatar" /></td>\n                <td md-cell ng-if="!dynamics365Account.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{dynamics365Account.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(dynamics365Account, ev) : vm.createOrEditDynamics365Account($event, dynamics365Account)" md-cell class="id ">{{dynamics365Account.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(dynamics365Account, ev) : vm.createOrEditDynamics365Account($event, dynamics365Account)" md-cell class="name ">{{dynamics365Account.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(dynamics365Account, ev) : vm.createOrEditDynamics365Account($event, dynamics365Account)" md-cell class="modernAuthentication ">\n                  <md-icon md-colors="{color: {{dynamics365Account.modernAuthentication ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{dynamics365Account.modernAuthentication ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(dynamics365Account, $event    )" translate="INTEGRATIONS.EDIT_DYNAMICS365ACCOUNT">\n                          Edit Dynamics365Account\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(dynamics365Account, $event    )" translate="INTEGRATIONS.TEST_DYNAMICS365ACCOUNT">\n                          Test Dynamics365Account\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.crudPermissions === 0 || vm.currentUser.role === \'admin\'">\n\n                        <md-button ng-click="vm.deleteconfirm(dynamics365Account, $event    )" translate="INTEGRATIONS.DELETE_DYNAMICS365ACCOUNT">\n                          Delete Dynamics365Account\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.dynamics365Accounts.count}}" md-on-paginate="vm.getDynamics365Accounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / DYNAMICS365ACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD DYNAMICS365ACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-dynamics365Account-button" ng-click="vm.createOrEditDynamics365Account($event)" aria-label="add dynamics365Account" translate translate-attr-aria-label="INTEGRATIONS.ADD_DYNAMICS365ACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD DYNAMICS365ACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/edit/configurations/dialog.html",'<md-dialog class="dynamics365Configuration-dialog" aria-label="New Dynamics365Configuration">\n  <form name="dynamics365ConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.dynamics365Configuration.name" ng-required="true" autofocus>\n\n        <div ng-messages="dynamics365ConfigurationForm[\'name\'].$error" ng-show="dynamics365ConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.dynamics365Configuration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dynamics365ConfigurationForm[\'channel\'].$error" ng-show="dynamics365ConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.dynamics365Configuration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dynamics365ConfigurationForm[\'type\'].$error" ng-show="dynamics365ConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TICKETTYPE">TicketType</label>\n        <md-select name="ticketType" ng-model="vm.dynamics365Configuration.ticketType" required>\n\n          <md-option ng-value="\'incident\'"> {{ \'INTEGRATIONS.CASE\' | translate }} </md-option>\n\n          <md-option ng-value="\'phonecall\'"> {{ \'INTEGRATIONS.PHONECALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dynamics365ConfigurationForm[\'ticketType\'].$error" ng-show="dynamics365ConfigurationForm[\'ticketType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TICKETTYPE_REQUIRED">TicketType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDynamics365Configuration" ng-click="vm.saveDynamics365Configuration()" class="send-button md-accent md-raised" ng-disabled="dynamics365ConfigurationForm.$invalid || dynamics365ConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDynamics365Configuration" ng-click="vm.addNewDynamics365Configuration()" class="send-button md-accent md-raised" ng-disabled="dynamics365ConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DYNAMICS365CONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_DYNAMICS365CONFIGURATION">\n          ADD DYNAMICS365CONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDynamics365Configuration" ng-click="vm.deleteDynamics365Configuration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",'<md-dialog class="dynamics365Account-item-dialog" aria-label="New Item">\n  <form name="dynamics365AccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="dynamics365AccountItemForm.type.$error" ng-show="dynamics365AccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="dynamics365AccountItemForm.content.$error" ng-show="dynamics365AccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="dynamics365AccountItemForm.key.$error" ng-show="dynamics365AccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="dynamics365AccountItemForm.keyType.$error" ng-show="dynamics365AccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="dynamics365AccountItemForm.keyContent.$error" ng-show="dynamics365AccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="dynamics365AccountItemForm.variableName.$error" ng-show="dynamics365AccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="dynamics365AccountItemForm.customField.$error" ng-show="dynamics365AccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountItemForm.$invalid || dynamics365AccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountItemForm.$invalid || dynamics365AccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="dynamics365AccountItemForm.type.$error" ng-show="dynamics365AccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="dynamics365AccountItemForm.option.$error" ng-show="dynamics365AccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="dynamics365AccountItemForm.content.$error" ng-show="dynamics365AccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="dynamics365AccountItemForm.variableName.$error" ng-show="dynamics365AccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="dynamics365AccountItemForm.type.$error" ng-show="dynamics365AccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="dynamics365AccountItemForm.content.$error"\n          ng-show="dynamics365AccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="dynamics365AccountItemForm.variableName.$error"\n          ng-show="dynamics365AccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/edit/view.html",'<div id="integrations-dynamics365Account" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-dynamics365Accounts-button md-icon-button" aria-label="Go to dynamics365Accounts" ng-click="vm.gotoDynamics365Accounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_DYNAMICS365ACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="dynamics365Account-image" hide-xs>\n          <img ng-src="assets/images/business/dynamics365Accounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.dynamics365Account.id}}\n            <span ng-if="vm.dynamics365Account.name">{{vm.dynamics365Account.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.dynamics365Account.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveDynamics365Account()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="dynamics365Account-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.dynamics365Account.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.dynamics365Account.modernAuthentication">\n                  <span translate="INTEGRATIONS.MODERN_AUTHENTICATION">Modern Authentication</span>\n                </md-switch>\n                \x3c!-- <div class="hint"><span translate="INTEGRATIONS.HELP.MODERN_AUTHENTICATION"></span></div> --\x3e\n              </md-input-container>\n\n              <div ng-if="vm.dynamics365Account.modernAuthentication == true">\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.CLOUD_PROVIDER">Cloud Provider</label>\n                  <md-select ng-model="vm.dynamics365Account.CloudProviderId" placeholder="Cloud Provider connection" ng-required="true">\n                    <md-option value="{{provider.id}}" ng-repeat="provider in vm.cloudProviders.rows">{{provider.name}}</md-option>\n                  </md-select>\n                </md-input-container>\n              </div>\n\n              <div ng-if="vm.dynamics365Account.modernAuthentication == false">\n\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.USERNAME">Username</label>\n                  \x3c!-- <input type="text" name="username" ng-model="vm.dynamics365Account.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit"> --\x3e\n                  <input type="text" name="username" ng-model="vm.dynamics365Account.username" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n                  <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                    </div>\n                  </div>\n                </md-input-container>\n\n\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                  <input type="password" name="password" ng-model="vm.dynamics365Account.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" ng-required="vm.dynamics365Account.modernAuthentication == false">\n                  <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                    </div>\n                    <div ng-message="pattern">\n                      <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                    </div>\n                  </div>\n                </md-input-container>\n\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.URI">Uri</label>\n                  <input type="url" name="remoteUri" ng-model="vm.dynamics365Account.remoteUri" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                    </div>\n                    <div ng-message="url">\n                      <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.TENANTID">TenantId</label>\n                  <input type="text" name="tenantId" ng-model="vm.dynamics365Account.tenantId" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'tenantId\'].$error" ng-show="generalForm[\'tenantId\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.TENANTID_REQUIRED">TenantId field is required</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n                  <input type="text" name="clientId" ng-model="vm.dynamics365Account.clientId" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'clientId\'].$error" ng-show="generalForm[\'clientId\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n                  <input type="text" name="clientSecret" ng-model="vm.dynamics365Account.clientSecret" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'clientSecret\'].$error" ng-show="generalForm[\'clientSecret\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                  <input type="url" name="serverUrl" ng-model="vm.dynamics365Account.serverUrl" value="LOCALIP" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                  <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                    </div>\n                    <div ng-message="url">\n                      <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                    </div>\n                  </div>\n                </md-input-container>\n\n              </div>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.dynamics365Account.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="dynamics365Account-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="Dynamics365AccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.dynamics365Account, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDynamics365Configuration($event)" class="md-icon-button" aria-label="create dynamics365Configuration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="dynamics365Configuration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedDynamics365Configuration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getDynamics365Configuration($index)">\n                    <span class="text-truncate" flex="80">{{ dynamics365Configuration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteDynamics365Configuration($event, dynamics365Configuration)" translate="INTEGRATIONS.DELETE_DYNAMICS365CONFIGURATION">\n                            Delete Dynamics365Configuration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.ADVANCED">ADVANCED</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <div class="dynamics365Account-detail-form-container general md-background-bg">\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="INTEGRATIONS.ADVANCED">ADVANCED</div>\n                        </div>\n                        <form name="vm_cc.advancedForm" novalidate>\n                          <md-input-container class="md-block">\n                            <label translate="INTEGRATIONS.MODULECREATE">Module Create</label>\n                            <md-select name="type" ng-model="vm_cc.dynamics365Configuration.moduleCreate" required>\n                              <md-option ng-value="\'contact\'">{{\'INTEGRATIONS.DYNAMIC365CONTACT\' | translate}}</md-option>\n                              <md-option ng-value="\'nothing\'">{{\'INTEGRATIONS.DYNAMIC365NOTHING\' | translate}}</md-option>\n                            </md-select>\n                            <div ng-messages="vm_cc.advancedForm[\'moduleCreate\'].$error" ng-show="vm_cc.advancedForm[\'moduleCreate\'].$touched" role="alert">\n                              <div ng-message="required">\n                                <span translate="INTEGRATIONS.ERRORS.MODULECREATE_REQUIRED">Type field is required</span>\n                              </div>\n                            </div>\n                          </md-input-container>\n\n\n                          <md-input-container class="md-block">\n                            <md-switch ng-model="vm_cc.dynamics365Configuration.openNewTab">\n                              <span translate="INTEGRATIONS.OPENNEWTAB">Open new tab</span>\n                            </md-switch>\n                          </md-input-container>\n\n\n                          <md-input-container class="md-block">\n                            <label translate="INTEGRATIONS.ADDITIONALSEARCHCONTACT">Additional search contact</label>\n                            <input type="" name="additionalSearchContact" ng-model="vm_cc.dynamics365Configuration.additionalSearchContact" autofocus>\n                          </md-input-container>\n                          <div layout="row" layout-align="end center">\n                            <md-button type="submit" ng-click="vm_cc.saveDynamics365Configuration()" class="send-button md-accent md-raised" ng-disabled="vm_cc.advancedForm.$invalid || vm_cc.advancedForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n                              SAVE\n                            </md-button>\n                          </div>\n                        </form>\n                      </div>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDynamics365Configuration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n          </div>\n\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/create/dialog.html",'<md-dialog class="freshdeskAccount-dialog" aria-label="New FreshdeskAccount">\n  <form name="freshdeskAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.freshdeskAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshdeskAccountForm[\'name\'].$error" ng-show="freshdeskAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.freshdeskAccount.username" ng-required="true">\n\n        <div ng-messages="freshdeskAccountForm[\'username\'].$error" ng-show="freshdeskAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.freshdeskAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="freshdeskAccountForm[\'remoteUri\'].$error" ng-show="freshdeskAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n        <input type="text" name="apiKey" ng-model="vm.freshdeskAccount.apiKey" ng-required="true">\n\n        <div ng-messages="freshdeskAccountForm[\'apiKey\'].$error" ng-show="freshdeskAccountForm[\'apiKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.freshdeskAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="freshdeskAccountForm[\'serverUrl\'].$error" ng-show="freshdeskAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.freshdeskAccount.description">\n\n        <div ng-messages="freshdeskAccountForm[\'description\'].$error" ng-show="freshdeskAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshdeskAccount" ng-click="vm.saveFreshdeskAccount()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountForm.$invalid || freshdeskAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshdeskAccount" ng-click="vm.addNewFreshdeskAccount()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHDESKACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHDESKACCOUNT">\n          ADD FRESHDESKACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshdeskAccount" ng-click="vm.deleteFreshdeskAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/edit/configurations/dialog.html",'<md-dialog class="freshdeskConfiguration-dialog" aria-label="New FreshdeskConfiguration">\n  <form name="freshdeskConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.freshdeskConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshdeskConfigurationForm[\'name\'].$error" ng-show="freshdeskConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.freshdeskConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshdeskConfigurationForm[\'channel\'].$error" ng-show="freshdeskConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.freshdeskConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshdeskConfigurationForm[\'type\'].$error" ng-show="freshdeskConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshdeskConfiguration" ng-click="vm.saveFreshdeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshdeskConfigurationForm.$invalid || freshdeskConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshdeskConfiguration" ng-click="vm.addNewFreshdeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshdeskConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHDESKCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHDESKCONFIGURATION">\n          ADD FRESHDESKCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshdeskConfiguration" ng-click="vm.deleteFreshdeskConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",'<md-dialog class="freshdeskAccount-item-dialog" aria-label="New Item">\n  <form name="freshdeskAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="freshdeskAccountItemForm.type.$error" ng-show="freshdeskAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="freshdeskAccountItemForm.content.$error" ng-show="freshdeskAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="freshdeskAccountItemForm.key.$error" ng-show="freshdeskAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="freshdeskAccountItemForm.keyType.$error" ng-show="freshdeskAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="freshdeskAccountItemForm.keyContent.$error" ng-show="freshdeskAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="freshdeskAccountItemForm.variableName.$error" ng-show="freshdeskAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="freshdeskAccountItemForm.customField.$error" ng-show="freshdeskAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountItemForm.$invalid || freshdeskAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountItemForm.$invalid || freshdeskAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="freshdeskAccountItemForm.type.$error" ng-show="freshdeskAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="freshdeskAccountItemForm.option.$error" ng-show="freshdeskAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="freshdeskAccountItemForm.content.$error" ng-show="freshdeskAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="freshdeskAccountItemForm.variableName.$error" ng-show="freshdeskAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="freshdeskAccountItemForm.type.$error" ng-show="freshdeskAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="freshdeskAccountItemForm.content.$error"\n          ng-show="freshdeskAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="freshdeskAccountItemForm.variableName.$error"\n          ng-show="freshdeskAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/edit/view.html",'<div id="integrations-freshdeskAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-freshdeskAccounts-button md-icon-button" aria-label="Go to freshdeskAccounts" ng-click="vm.gotoFreshdeskAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_FRESHDESKACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="freshdeskAccount-image" hide-xs>\n          <img ng-src="assets/images/business/freshdeskAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.freshdeskAccount.id}}\n            <span ng-if="vm.freshdeskAccount.name">{{vm.freshdeskAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.freshdeskAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFreshdeskAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshdeskAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.freshdeskAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.freshdeskAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.freshdeskAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n                <input type="text" name="apiKey" ng-model="vm.freshdeskAccount.apiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'apiKey\'].$error" ng-show="generalForm[\'apiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.freshdeskAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.freshdeskAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshdeskAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="FreshdeskAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.freshdeskAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshdeskConfiguration($event)" class="md-icon-button" aria-label="create freshdeskConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="freshdeskConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedFreshdeskConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getFreshdeskConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ freshdeskConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteFreshdeskConfiguration($event, freshdeskConfiguration)" translate="INTEGRATIONS.DELETE_FRESHDESKCONFIGURATION">\n                            Delete FreshdeskConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.TAGS">TAGS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-table-container class="md-whiteframe-1dp padding-20">\n                        <md-input-container class="md-block">\n                          <label translate="INTEGRATIONS.TAGS">Tags</label>\n                          <md-select ng-model="vm_cc.selectedTags" ng-change="vm_cc.selectTagsChanged($event)" multiple>\n                            <md-option ng-value="tag.id" ng-repeat="tag in vm_cc.tags">{{ tag.name }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshdeskConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/freshdeskAccounts.html",'<div id="freshdeskAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.FRESHDESKACCOUNTS">FreshdeskAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFreshdeskAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFreshdeskAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-freshdeskAccounts-count">\n          <span>{{vm.selectedFreshdeskAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFreshdeskAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFreshdeskAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFreshdeskAccounts" csv-label="true" filename="freshdeskAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFreshdeskAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FRESHDESKACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFreshdeskAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFreshdeskAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.freshdeskAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="freshdeskAccount" md-select-id="id" ng-repeat="freshdeskAccount in vm.freshdeskAccounts.rows">\n                <td md-cell ng-if="freshdeskAccount.userpic"><img class="avatar" alt="{{freshdeskAccount.name}}" ng-src="api/users/{{freshdeskAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!freshdeskAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{freshdeskAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="id ">{{freshdeskAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="name ">{{freshdeskAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="username ">{{freshdeskAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="remoteUri ">{{freshdeskAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(freshdeskAccount, $event    )" translate="INTEGRATIONS.EDIT_FRESHDESKACCOUNT">\n                          Edit FreshdeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(freshdeskAccount, $event    )" translate="INTEGRATIONS.TEST_FRESHDESKACCOUNT">\n                          Test FreshdeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(freshdeskAccount, $event    )" translate="INTEGRATIONS.DELETE_FRESHDESKACCOUNT">\n                          Delete FreshdeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.freshdeskAccounts.count}}" md-on-paginate="vm.getFreshdeskAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FRESHDESKACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FRESHDESKACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-freshdeskAccount-button" ng-click="vm.createOrEditFreshdeskAccount($event)" aria-label="add freshdeskAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_FRESHDESKACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FRESHDESKACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/create/dialog.html",'<md-dialog class="freshsalesAccount-dialog" aria-label="New FreshsalesAccount">\n  <form name="freshsalesAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.freshsalesAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshsalesAccountForm[\'name\'].$error" ng-show="freshsalesAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.freshsalesAccount.username" ng-required="true">\n\n        <div ng-messages="freshsalesAccountForm[\'username\'].$error" ng-show="freshsalesAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.freshsalesAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="freshsalesAccountForm[\'remoteUri\'].$error" ng-show="freshsalesAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n        <input type="text" name="apiKey" ng-model="vm.freshsalesAccount.apiKey" ng-required="true">\n\n        <div ng-messages="freshsalesAccountForm[\'apiKey\'].$error" ng-show="freshsalesAccountForm[\'apiKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.freshsalesAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="freshsalesAccountForm[\'serverUrl\'].$error" ng-show="freshsalesAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.freshsalesAccount.description">\n\n        <div ng-messages="freshsalesAccountForm[\'description\'].$error" ng-show="freshsalesAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshsalesAccount" ng-click="vm.saveFreshsalesAccount()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountForm.$invalid || freshsalesAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshsalesAccount" ng-click="vm.addNewFreshsalesAccount()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHSALESACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHSALESACCOUNT">\n          ADD FRESHSALESACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshsalesAccount" ng-click="vm.deleteFreshsalesAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/edit/configurations/dialog.html",'<md-dialog class="freshsalesConfiguration-dialog" aria-label="New FreshsalesConfiguration">\n  <form name="freshsalesConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.freshsalesConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshsalesConfigurationForm[\'name\'].$error" ng-show="freshsalesConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.freshsalesConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshsalesConfigurationForm[\'channel\'].$error" ng-show="freshsalesConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.freshsalesConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshsalesConfigurationForm[\'type\'].$error" ng-show="freshsalesConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshsalesConfiguration" ng-click="vm.saveFreshsalesConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshsalesConfigurationForm.$invalid || freshsalesConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshsalesConfiguration" ng-click="vm.addNewFreshsalesConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshsalesConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHSALESCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHSALESCONFIGURATION">\n          ADD FRESHSALESCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshsalesConfiguration" ng-click="vm.deleteFreshsalesConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",'<md-dialog class="freshsalesAccount-item-dialog" aria-label="New Item">\n  <form name="freshsalesAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="freshsalesAccountItemForm.type.$error" ng-show="freshsalesAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="freshsalesAccountItemForm.content.$error" ng-show="freshsalesAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="freshsalesAccountItemForm.key.$error" ng-show="freshsalesAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="freshsalesAccountItemForm.keyType.$error" ng-show="freshsalesAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="freshsalesAccountItemForm.keyContent.$error" ng-show="freshsalesAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="freshsalesAccountItemForm.variableName.$error" ng-show="freshsalesAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="freshsalesAccountItemForm.customField.$error" ng-show="freshsalesAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountItemForm.$invalid || freshsalesAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountItemForm.$invalid || freshsalesAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="freshsalesAccountItemForm.type.$error" ng-show="freshsalesAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="freshsalesAccountItemForm.option.$error" ng-show="freshsalesAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="freshsalesAccountItemForm.content.$error" ng-show="freshsalesAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="freshsalesAccountItemForm.variableName.$error" ng-show="freshsalesAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="freshsalesAccountItemForm.type.$error" ng-show="freshsalesAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="freshsalesAccountItemForm.content.$error"\n          ng-show="freshsalesAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="freshsalesAccountItemForm.variableName.$error"\n          ng-show="freshsalesAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/edit/view.html",'<div id="integrations-freshsalesAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-freshsalesAccounts-button md-icon-button" aria-label="Go to freshsalesAccounts" ng-click="vm.gotoFreshsalesAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_FRESHSALESACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="freshsalesAccount-image" hide-xs>\n          <img ng-src="assets/images/business/freshsalesAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.freshsalesAccount.id}}\n            <span ng-if="vm.freshsalesAccount.name">{{vm.freshsalesAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.freshsalesAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFreshsalesAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshsalesAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.freshsalesAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.freshsalesAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.freshsalesAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n                <input type="text" name="apiKey" ng-model="vm.freshsalesAccount.apiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'apiKey\'].$error" ng-show="generalForm[\'apiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.freshsalesAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.freshsalesAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshsalesAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="FreshsalesAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.freshsalesAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshsalesConfiguration($event)" class="md-icon-button" aria-label="create freshsalesConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="freshsalesConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedFreshsalesConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getFreshsalesConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ freshsalesConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteFreshsalesConfiguration($event, freshsalesConfiguration)" translate="INTEGRATIONS.DELETE_FRESHSALESCONFIGURATION">\n                            Delete FreshsalesConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshsalesConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/freshsalesAccounts.html",'<div id="freshsalesAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.FRESHSALESACCOUNTS">FreshsalesAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFreshsalesAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFreshsalesAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-freshsalesAccounts-count">\n          <span>{{vm.selectedFreshsalesAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFreshsalesAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFreshsalesAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFreshsalesAccounts" csv-label="true" filename="freshsalesAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFreshsalesAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FRESHSALESACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFreshsalesAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFreshsalesAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.freshsalesAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="freshsalesAccount" md-select-id="id" ng-repeat="freshsalesAccount in vm.freshsalesAccounts.rows">\n                <td md-cell ng-if="freshsalesAccount.userpic"><img class="avatar" alt="{{freshsalesAccount.name}}" ng-src="api/users/{{freshsalesAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!freshsalesAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{freshsalesAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="id ">{{freshsalesAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="name ">{{freshsalesAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="username ">{{freshsalesAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="remoteUri ">{{freshsalesAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(freshsalesAccount, $event    )" translate="INTEGRATIONS.EDIT_FRESHSALESACCOUNT">\n                          Edit FreshsalesAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(freshsalesAccount, $event    )" translate="INTEGRATIONS.TEST_FRESHSALESACCOUNT">\n                          Test FreshsalesAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(freshsalesAccount, $event    )" translate="INTEGRATIONS.DELETE_FRESHSALESACCOUNT">\n                          Delete FreshsalesAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.freshsalesAccounts.count}}" md-on-paginate="vm.getFreshsalesAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FRESHSALESACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FRESHSALESACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-freshsalesAccount-button" ng-click="vm.createOrEditFreshsalesAccount($event)" aria-label="add freshsalesAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_FRESHSALESACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FRESHSALESACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/salesforceAccounts/create/dialog.html",'<md-dialog class="salesforceAccount-dialog" aria-label="New SalesforceAccount">\n  <form name="salesforceAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.salesforceAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="salesforceAccountForm[\'name\'].$error" ng-show="salesforceAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.salesforceAccount.type" required>\n\n          <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n          <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceAccountForm[\'type\'].$error" ng-show="salesforceAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.salesforceAccount.username" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'username\'].$error" ng-show="salesforceAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.salesforceAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'remoteUri\'].$error" ng-show="salesforceAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.salesforceAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="salesforceAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n        <input type="text" name="clientId" ng-model="vm.salesforceAccount.clientId" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'clientId\'].$error" ng-show="salesforceAccountForm[\'clientId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n        <input type="text" name="clientSecret" ng-model="vm.salesforceAccount.clientSecret" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'clientSecret\'].$error" ng-show="salesforceAccountForm[\'clientSecret\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.SECURITYTOKEN">SecurityToken</label>\n        <input type="text" name="securityToken" ng-model="vm.salesforceAccount.securityToken" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'securityToken\'].$error" ng-show="salesforceAccountForm[\'securityToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.SECURITYTOKEN_REQUIRED">SecurityToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.salesforceAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="salesforceAccountForm[\'serverUrl\'].$error" ng-show="salesforceAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.salesforceAccount.description">\n\n        <div ng-messages="salesforceAccountForm[\'description\'].$error" ng-show="salesforceAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSalesforceAccount" ng-click="vm.saveSalesforceAccount()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountForm.$invalid || salesforceAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSalesforceAccount" ng-click="vm.addNewSalesforceAccount()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SALESFORCEACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_SALESFORCEACCOUNT">\n          ADD SALESFORCEACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSalesforceAccount" ng-click="vm.deleteSalesforceAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/salesforceAccounts/edit/configurations/dialog.html",'<md-dialog class="salesforceConfiguration-dialog" aria-label="New SalesforceConfiguration">\n  <form name="salesforceConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.salesforceConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="salesforceConfigurationForm[\'name\'].$error" ng-show="salesforceConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.salesforceConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceConfigurationForm[\'channel\'].$error" ng-show="salesforceConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.salesforceConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceConfigurationForm[\'type\'].$error" ng-show="salesforceConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TICKETTYPE">TicketType</label>\n        <md-select name="ticketType" ng-model="vm.salesforceConfiguration.ticketType" required>\n\n          <md-option ng-value="\'Task\'"> {{ \'INTEGRATIONS.TASK\' | translate }} </md-option>\n\n          <md-option ng-value="\'Case\'"> {{ \'INTEGRATIONS.CASE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceConfigurationForm[\'ticketType\'].$error" ng-show="salesforceConfigurationForm[\'ticketType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TICKETTYPE_REQUIRED">TicketType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSalesforceConfiguration" ng-click="vm.saveSalesforceConfiguration()" class="send-button md-accent md-raised" ng-disabled="salesforceConfigurationForm.$invalid || salesforceConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSalesforceConfiguration" ng-click="vm.addNewSalesforceConfiguration()" class="send-button md-accent md-raised" ng-disabled="salesforceConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SALESFORCECONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_SALESFORCECONFIGURATION">\n          ADD SALESFORCECONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSalesforceConfiguration" ng-click="vm.deleteSalesforceConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",'<md-dialog class="salesforceAccount-item-dialog" aria-label="New Item">\n  <form name="salesforceAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="salesforceAccountItemForm.type.$error" ng-show="salesforceAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="salesforceAccountItemForm.content.$error" ng-show="salesforceAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="salesforceAccountItemForm.key.$error" ng-show="salesforceAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="salesforceAccountItemForm.keyType.$error" ng-show="salesforceAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="salesforceAccountItemForm.keyContent.$error" ng-show="salesforceAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="salesforceAccountItemForm.variableName.$error" ng-show="salesforceAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="salesforceAccountItemForm.customField.$error" ng-show="salesforceAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountItemForm.$invalid || salesforceAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountItemForm.$invalid || salesforceAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="salesforceAccountItemForm.type.$error" ng-show="salesforceAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="salesforceAccountItemForm.option.$error" ng-show="salesforceAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="salesforceAccountItemForm.content.$error" ng-show="salesforceAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="salesforceAccountItemForm.variableName.$error" ng-show="salesforceAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="salesforceAccountItemForm.type.$error" ng-show="salesforceAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="salesforceAccountItemForm.content.$error"\n          ng-show="salesforceAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="salesforceAccountItemForm.variableName.$error"\n          ng-show="salesforceAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/salesforceAccounts/edit/view.html",'<div id="integrations-salesforceAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-salesforceAccounts-button md-icon-button" aria-label="Go to salesforceAccounts" ng-click="vm.gotoSalesforceAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_SALESFORCEACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="salesforceAccount-image" hide-xs>\n          <img ng-src="assets/images/business/salesforceAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.salesforceAccount.id}}\n            <span ng-if="vm.salesforceAccount.name">{{vm.salesforceAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.salesforceAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSalesforceAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="salesforceAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.salesforceAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.salesforceAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n                  <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.salesforceAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.salesforceAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.salesforceAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n                <input type="text" name="clientId" ng-model="vm.salesforceAccount.clientId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'clientId\'].$error" ng-show="generalForm[\'clientId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n                <input type="text" name="clientSecret" ng-model="vm.salesforceAccount.clientSecret" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'clientSecret\'].$error" ng-show="generalForm[\'clientSecret\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.SECURITYTOKEN">SecurityToken</label>\n                <input type="text" name="securityToken" ng-model="vm.salesforceAccount.securityToken" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'securityToken\'].$error" ng-show="generalForm[\'securityToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.SECURITYTOKEN_REQUIRED">SecurityToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.salesforceAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.salesforceAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="salesforceAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="SalesforceAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.salesforceAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSalesforceConfiguration($event)" class="md-icon-button" aria-label="create salesforceConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="salesforceConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedSalesforceConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getSalesforceConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ salesforceConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteSalesforceConfiguration($event, salesforceConfiguration)" translate="INTEGRATIONS.DELETE_SALESFORCECONFIGURATION">\n                            Delete SalesforceConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.ADVANCED">\n                        ADVANCED\n                      </span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_SEARCH"></label>\n                        <md-select ng-model="vm_cc.salesforceConfiguration.moduleSearch" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'account_contact_lead\', value: \'Account & Contact & Lead\'}, {key: \'contact_lead\', value: \'Contact & Lead\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}, {key: \'account\', value: \'Account\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_CREATE"></label>\n                        <md-select ng-model="vm_cc.salesforceConfiguration.moduleCreate" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'nothing\', value: \'Nothing\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}, {key: \'account\', value: \'Account\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isLead">\n                        <label translate="INTEGRATIONS.LEADID"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.leadId" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.LEADID"></span></div>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isAccountSearch">\n                        <label translate="INTEGRATIONS.ADDITIONALSEARCHACCOUNT"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.additionalSearchAccount" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.ADDITIONALSEARCHACCOUNT"></span></div>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isContactSearch">\n                        <label translate="INTEGRATIONS.ADDITIONALSEARCHCONTACT"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.additionalSearchContact" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.ADDITIONALSEARCHCONTACT"></span></div>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isLeadSearch">\n                        <label translate="INTEGRATIONS.ADDITIONALSEARCHLEAD"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.additionalSearchLead" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.ADDITIONALSEARCHLEAD"></span></div>\n                      </div>\n\n                      <md-button type="submit" ng-click="vm_cc.saveSalesforceConfiguration()" ng-disabled="!vm_cc.crudPermissions.canEdit" class="send-button md-accent md-raised" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n                        SAVE\n                      </md-button>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSalesforceConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/salesforceAccounts/salesforceAccounts.html",'<div id="salesforceAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.SALESFORCEACCOUNTS">SalesforceAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSalesforceAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSalesforceAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-salesforceAccounts-count">\n          <span>{{vm.selectedSalesforceAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSalesforceAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSalesforceAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSalesforceAccounts" csv-label="true" filename="salesforceAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSalesforceAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SALESFORCEACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSalesforceAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSalesforceAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.salesforceAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="salesforceAccount" md-select-id="id" ng-repeat="salesforceAccount in vm.salesforceAccounts.rows">\n                <td md-cell ng-if="salesforceAccount.userpic"><img class="avatar" alt="{{salesforceAccount.name}}" ng-src="api/users/{{salesforceAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!salesforceAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{salesforceAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="id ">{{salesforceAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="name ">{{salesforceAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="username ">{{salesforceAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="remoteUri ">{{salesforceAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(salesforceAccount, $event    )" translate="INTEGRATIONS.EDIT_SALESFORCEACCOUNT">\n                          Edit SalesforceAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(salesforceAccount, $event    )" translate="INTEGRATIONS.TEST_SALESFORCEACCOUNT">\n                          Test SalesforceAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(salesforceAccount, $event    )" translate="INTEGRATIONS.DELETE_SALESFORCEACCOUNT">\n                          Delete SalesforceAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.salesforceAccounts.count}}" md-on-paginate="vm.getSalesforceAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SALESFORCEACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SALESFORCEACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-salesforceAccount-button" ng-click="vm.createOrEditSalesforceAccount($event)" aria-label="add salesforceAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_SALESFORCEACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SALESFORCEACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/servicenowAccounts/create/dialog.html",'<md-dialog class="servicenowAccount-dialog" aria-label="New ServicenowAccount">\n  <form name="servicenowAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.servicenowAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="servicenowAccountForm[\'name\'].$error" ng-show="servicenowAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.servicenowAccount.username" ng-required="true">\n\n        <div ng-messages="servicenowAccountForm[\'username\'].$error" ng-show="servicenowAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.servicenowAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="servicenowAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.servicenowAccount.email" ng-required="true">\n\n        <div ng-messages="servicenowAccountForm[\'email\'].$error" ng-show="servicenowAccountForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="INTEGRATIONS.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.HOST">Host</label>\n        <input type="url" name="remoteUri" ng-model="vm.servicenowAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="servicenowAccountForm[\'remoteUri\'].$error" ng-show="servicenowAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.servicenowAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="servicenowAccountForm[\'serverUrl\'].$error" ng-show="servicenowAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.servicenowAccount.description">\n\n        <div ng-messages="servicenowAccountForm[\'description\'].$error" ng-show="servicenowAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newServicenowAccount" ng-click="vm.saveServicenowAccount()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountForm.$invalid || servicenowAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newServicenowAccount" ng-click="vm.addNewServicenowAccount()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SERVICENOWACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_SERVICENOWACCOUNT">\n          ADD SERVICENOWACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newServicenowAccount" ng-click="vm.deleteServicenowAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/servicenowAccounts/edit/configurations/dialog.html",'<md-dialog class="servicenowConfiguration-dialog" aria-label="New ServicenowConfiguration">\n  <form name="servicenowConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.servicenowConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="servicenowConfigurationForm[\'name\'].$error" ng-show="servicenowConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.servicenowConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="servicenowConfigurationForm[\'channel\'].$error" ng-show="servicenowConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.servicenowConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="servicenowConfigurationForm[\'type\'].$error" ng-show="servicenowConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newServicenowConfiguration" ng-click="vm.saveServicenowConfiguration()" class="send-button md-accent md-raised" ng-disabled="servicenowConfigurationForm.$invalid || servicenowConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newServicenowConfiguration" ng-click="vm.addNewServicenowConfiguration()" class="send-button md-accent md-raised" ng-disabled="servicenowConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SERVICENOWCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_SERVICENOWCONFIGURATION">\n          ADD SERVICENOWCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newServicenowConfiguration" ng-click="vm.deleteServicenowConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",'<md-dialog class="servicenowAccount-item-dialog" aria-label="New Item">\n  <form name="servicenowAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="servicenowAccountItemForm.type.$error" ng-show="servicenowAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="servicenowAccountItemForm.content.$error" ng-show="servicenowAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="servicenowAccountItemForm.key.$error" ng-show="servicenowAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="servicenowAccountItemForm.keyType.$error" ng-show="servicenowAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="servicenowAccountItemForm.keyContent.$error" ng-show="servicenowAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="servicenowAccountItemForm.variableName.$error" ng-show="servicenowAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="servicenowAccountItemForm.customField.$error" ng-show="servicenowAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountItemForm.$invalid || servicenowAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountItemForm.$invalid || servicenowAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="servicenowAccountItemForm.type.$error" ng-show="servicenowAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="servicenowAccountItemForm.option.$error" ng-show="servicenowAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="servicenowAccountItemForm.content.$error" ng-show="servicenowAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="servicenowAccountItemForm.variableName.$error" ng-show="servicenowAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="servicenowAccountItemForm.type.$error" ng-show="servicenowAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="servicenowAccountItemForm.content.$error"\n          ng-show="servicenowAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="servicenowAccountItemForm.variableName.$error"\n          ng-show="servicenowAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/servicenowAccounts/edit/view.html",'<div id="integrations-servicenowAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-servicenowAccounts-button md-icon-button" aria-label="Go to servicenowAccounts" ng-click="vm.gotoServicenowAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_SERVICENOWACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="servicenowAccount-image" hide-xs>\n          <img ng-src="assets/images/business/servicenowAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.servicenowAccount.id}}\n            <span ng-if="vm.servicenowAccount.name">{{vm.servicenowAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.servicenowAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveServicenowAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="servicenowAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.servicenowAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.servicenowAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.servicenowAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.servicenowAccount.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="INTEGRATIONS.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.HOST">Host</label>\n                <input type="url" name="remoteUri" ng-model="vm.servicenowAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.servicenowAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.servicenowAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="servicenowAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="ServicenowAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.servicenowAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditServicenowConfiguration($event)" class="md-icon-button" aria-label="create servicenowConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="servicenowConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedServicenowConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getServicenowConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ servicenowConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteServicenowConfiguration($event, servicenowConfiguration)" translate="INTEGRATIONS.DELETE_SERVICENOWCONFIGURATION">\n                            Delete ServicenowConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditServicenowConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/servicenowAccounts/servicenowAccounts.html",'<div id="servicenowAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.SERVICENOWACCOUNTS">ServicenowAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedServicenowAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedServicenowAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-servicenowAccounts-count">\n          <span>{{vm.selectedServicenowAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllServicenowAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectServicenowAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedServicenowAccounts" csv-label="true" filename="servicenowAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedServicenowAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SERVICENOWACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedServicenowAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getServicenowAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'INTEGRATIONS.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.HOST\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.servicenowAccounts.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="servicenowAccount" md-select-id="id" ng-repeat="servicenowAccount in vm.servicenowAccounts.rows">\n                <td md-cell ng-if="servicenowAccount.userpic"><img class="avatar" alt="{{servicenowAccount.name}}" ng-src="api/users/{{servicenowAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!servicenowAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{servicenowAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="id ">{{servicenowAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="name ">{{servicenowAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="username ">{{servicenowAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="email ">{{servicenowAccount.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="remoteUri ">{{servicenowAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(servicenowAccount, $event    )" translate="INTEGRATIONS.EDIT_SERVICENOWACCOUNT">\n                          Edit ServicenowAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(servicenowAccount, $event    )" translate="INTEGRATIONS.TEST_SERVICENOWACCOUNT">\n                          Test ServicenowAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.crudPermissions === 0 || vm.currentUser.role === \'admin\'">\n\n                        <md-button ng-click="vm.deleteconfirm(servicenowAccount, $event    )" translate="INTEGRATIONS.DELETE_SERVICENOWACCOUNT">\n                          Delete ServicenowAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.servicenowAccounts.count}}" md-on-paginate="vm.getServicenowAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SERVICENOWACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SERVICENOWACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-servicenowAccount-button" ng-click="vm.createOrEditServicenowAccount($event)" aria-label="add servicenowAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_SERVICENOWACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SERVICENOWACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/create/dialog.html",'<md-dialog class="sugarcrmAccount-dialog" aria-label="New SugarcrmAccount">\n  <form name="sugarcrmAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.sugarcrmAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="sugarcrmAccountForm[\'name\'].$error" ng-show="sugarcrmAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.sugarcrmAccount.username" ng-required="true">\n\n        <div ng-messages="sugarcrmAccountForm[\'username\'].$error" ng-show="sugarcrmAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.sugarcrmAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="sugarcrmAccountForm[\'remoteUri\'].$error" ng-show="sugarcrmAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.sugarcrmAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="sugarcrmAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.sugarcrmAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="sugarcrmAccountForm[\'serverUrl\'].$error" ng-show="sugarcrmAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.sugarcrmAccount.description">\n\n        <div ng-messages="sugarcrmAccountForm[\'description\'].$error" ng-show="sugarcrmAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSugarcrmAccount" ng-click="vm.saveSugarcrmAccount()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountForm.$invalid || sugarcrmAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSugarcrmAccount" ng-click="vm.addNewSugarcrmAccount()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SUGARCRMACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_SUGARCRMACCOUNT">\n          ADD SUGARCRMACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSugarcrmAccount" ng-click="vm.deleteSugarcrmAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/edit/configurations/dialog.html",'<md-dialog class="sugarcrmConfiguration-dialog" aria-label="New SugarcrmConfiguration">\n  <form name="sugarcrmConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.sugarcrmConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="sugarcrmConfigurationForm[\'name\'].$error" ng-show="sugarcrmConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.sugarcrmConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="sugarcrmConfigurationForm[\'channel\'].$error" ng-show="sugarcrmConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.sugarcrmConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="sugarcrmConfigurationForm[\'type\'].$error" ng-show="sugarcrmConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSugarcrmConfiguration" ng-click="vm.saveSugarcrmConfiguration()" class="send-button md-accent md-raised" ng-disabled="sugarcrmConfigurationForm.$invalid || sugarcrmConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSugarcrmConfiguration" ng-click="vm.addNewSugarcrmConfiguration()" class="send-button md-accent md-raised" ng-disabled="sugarcrmConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SUGARCRMCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_SUGARCRMCONFIGURATION">\n          ADD SUGARCRMCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSugarcrmConfiguration" ng-click="vm.deleteSugarcrmConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",'<md-dialog class="sugarcrmAccount-item-dialog" aria-label="New Item">\n  <form name="sugarcrmAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="sugarcrmAccountItemForm.content.$error" ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="sugarcrmAccountItemForm.key.$error" ng-show="sugarcrmAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="sugarcrmAccountItemForm.keyType.$error" ng-show="sugarcrmAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="sugarcrmAccountItemForm.keyContent.$error" ng-show="sugarcrmAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="sugarcrmAccountItemForm.variableName.$error" ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="sugarcrmAccountItemForm.customField.$error" ng-show="sugarcrmAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountItemForm.$invalid || sugarcrmAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountItemForm.$invalid || sugarcrmAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="sugarcrmAccountItemForm.option.$error" ng-show="sugarcrmAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="sugarcrmAccountItemForm.content.$error" ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="sugarcrmAccountItemForm.variableName.$error" ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="sugarcrmAccountItemForm.content.$error"\n          ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="sugarcrmAccountItemForm.variableName.$error"\n          ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/edit/view.html",'<div id="integrations-sugarcrmAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-sugarcrmAccounts-button md-icon-button" aria-label="Go to sugarcrmAccounts" ng-click="vm.gotoSugarcrmAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_SUGARCRMACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="sugarcrmAccount-image" hide-xs>\n          <img ng-src="assets/images/business/sugarcrmAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.sugarcrmAccount.id}}\n            <span ng-if="vm.sugarcrmAccount.name">{{vm.sugarcrmAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.sugarcrmAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSugarcrmAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="sugarcrmAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.sugarcrmAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.sugarcrmAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.sugarcrmAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.sugarcrmAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.sugarcrmAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.sugarcrmAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="sugarcrmAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="SugarcrmAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.sugarcrmAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSugarcrmConfiguration($event)" class="md-icon-button" aria-label="create sugarcrmConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="sugarcrmConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedSugarcrmConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getSugarcrmConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ sugarcrmConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteSugarcrmConfiguration($event, sugarcrmConfiguration)" translate="INTEGRATIONS.DELETE_SUGARCRMCONFIGURATION">\n                            Delete SugarcrmConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSugarcrmConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/sugarcrmAccounts.html",'<div id="sugarcrmAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.SUGARCRMACCOUNTS">SugarcrmAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSugarcrmAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSugarcrmAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-sugarcrmAccounts-count">\n          <span>{{vm.selectedSugarcrmAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSugarcrmAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSugarcrmAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSugarcrmAccounts" csv-label="true" filename="sugarcrmAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSugarcrmAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SUGARCRMACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSugarcrmAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSugarcrmAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.sugarcrmAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="sugarcrmAccount" md-select-id="id" ng-repeat="sugarcrmAccount in vm.sugarcrmAccounts.rows">\n                <td md-cell ng-if="sugarcrmAccount.userpic"><img class="avatar" alt="{{sugarcrmAccount.name}}" ng-src="api/users/{{sugarcrmAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!sugarcrmAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{sugarcrmAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="id ">{{sugarcrmAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="name ">{{sugarcrmAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="username ">{{sugarcrmAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="remoteUri ">{{sugarcrmAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(sugarcrmAccount, $event    )" translate="INTEGRATIONS.EDIT_SUGARCRMACCOUNT">\n                          Edit SugarcrmAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(sugarcrmAccount, $event    )" translate="INTEGRATIONS.TEST_SUGARCRMACCOUNT">\n                          Test SugarcrmAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.deleteconfirm(sugarcrmAccount, $event    )" translate="INTEGRATIONS.DELETE_SUGARCRMACCOUNT">\n                          Delete SugarcrmAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.sugarcrmAccounts.count}}" md-on-paginate="vm.getSugarcrmAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SUGARCRMACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SUGARCRMACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-sugarcrmAccount-button" ng-click="vm.createOrEditSugarcrmAccount($event)" aria-label="add sugarcrmAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_SUGARCRMACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SUGARCRMACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/vtigerAccounts/create/dialog.html",'<md-dialog class="vtigerAccount-dialog" aria-label="New VtigerAccount">\n  <form name="vtigerAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.vtigerAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="vtigerAccountForm[\'name\'].$error" ng-show="vtigerAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.vtigerAccount.description">\n\n        <div ng-messages="vtigerAccountForm[\'description\'].$error" ng-show="vtigerAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.VTIGER_USER_NAME">vTiger_User_Name</label>\n        <input type="text" name="username" ng-model="vm.vtigerAccount.username" ng-required="true">\n\n        <div ng-messages="vtigerAccountForm[\'username\'].$error" ng-show="vtigerAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.VTIGER_USER_NAME_REQUIRED">vTiger_User_Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.ACCESS_KEY">Access_Key</label>\n        <input type="text" name="accessKey" ng-model="vm.vtigerAccount.accessKey" ng-required="true">\n\n        <div ng-messages="vtigerAccountForm[\'accessKey\'].$error" ng-show="vtigerAccountForm[\'accessKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.ACCESS_KEY_REQUIRED">Access_Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.HOST">Host</label>\n        <input type="url" name="remoteUri" ng-model="vm.vtigerAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="vtigerAccountForm[\'remoteUri\'].$error" ng-show="vtigerAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.vtigerAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="vtigerAccountForm[\'serverUrl\'].$error" ng-show="vtigerAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVtigerAccount" ng-click="vm.saveVtigerAccount()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountForm.$invalid || vtigerAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVtigerAccount" ng-click="vm.addNewVtigerAccount()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_VTIGERACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_VTIGERACCOUNT">\n          ADD VTIGERACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVtigerAccount" ng-click="vm.deleteVtigerAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/vtigerAccounts/edit/configurations/dialog.html",'<md-dialog class="vtigerConfiguration-dialog" aria-label="New VtigerConfiguration">\n  <form name="vtigerConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.vtigerConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="vtigerConfigurationForm[\'name\'].$error" ng-show="vtigerConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.vtigerConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="vtigerConfigurationForm[\'channel\'].$error" ng-show="vtigerConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.vtigerConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="vtigerConfigurationForm[\'type\'].$error" ng-show="vtigerConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVtigerConfiguration" ng-click="vm.saveVtigerConfiguration()" class="send-button md-accent md-raised" ng-disabled="vtigerConfigurationForm.$invalid || vtigerConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVtigerConfiguration" ng-click="vm.addNewVtigerConfiguration()" class="send-button md-accent md-raised" ng-disabled="vtigerConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_VTIGERCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_VTIGERCONFIGURATION">\n          ADD VTIGERCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVtigerConfiguration" ng-click="vm.deleteVtigerConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",'<md-dialog class="vtigerAccount-item-dialog" aria-label="New Item">\n  <form name="vtigerAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="vtigerAccountItemForm.content.$error" ng-show="vtigerAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="vtigerAccountItemForm.key.$error" ng-show="vtigerAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="vtigerAccountItemForm.keyType.$error" ng-show="vtigerAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="vtigerAccountItemForm.keyContent.$error" ng-show="vtigerAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="vtigerAccountItemForm.variableName.$error" ng-show="vtigerAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="vtigerAccountItemForm.customField.$error" ng-show="vtigerAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountItemForm.$invalid || vtigerAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountItemForm.$invalid || vtigerAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="vtigerAccountItemForm.option.$error" ng-show="vtigerAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="vtigerAccountItemForm.content.$error" ng-show="vtigerAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="vtigerAccountItemForm.variableName.$error" ng-show="vtigerAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="vtigerAccountItemForm.content.$error"\n          ng-show="vtigerAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="vtigerAccountItemForm.variableName.$error"\n          ng-show="vtigerAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/vtigerAccounts/edit/view.html",'<div id="integrations-vtigerAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-vtigerAccounts-button md-icon-button" aria-label="Go to vtigerAccounts" ng-click="vm.gotoVtigerAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_VTIGERACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="vtigerAccount-image" hide-xs>\n          <img ng-src="assets/images/business/vtigerAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.vtigerAccount.id}}\n            <span ng-if="vm.vtigerAccount.name">{{vm.vtigerAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.vtigerAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVtigerAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="vtigerAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.vtigerAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.vtigerAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.VTIGER_USER_NAME">vTiger_User_Name</label>\n                <input type="text" name="username" ng-model="vm.vtigerAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.VTIGER_USER_NAME_REQUIRED">vTiger_User_Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.ACCESS_KEY">Access_Key</label>\n                <input type="text" name="accessKey" ng-model="vm.vtigerAccount.accessKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'accessKey\'].$error" ng-show="generalForm[\'accessKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.ACCESS_KEY_REQUIRED">Access_Key field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.HOST">Host</label>\n                <input type="url" name="remoteUri" ng-model="vm.vtigerAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.vtigerAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="vtigerAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="VtigerAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.vtigerAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditVtigerConfiguration($event)" class="md-icon-button" aria-label="create vtigerConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="vtigerConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedVtigerConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getVtigerConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ vtigerConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteVtigerConfiguration($event, vtigerConfiguration)" translate="INTEGRATIONS.DELETE_VTIGERCONFIGURATION">\n                            Delete VtigerConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditVtigerConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/vtigerAccounts/vtigerAccounts.html",'<div id="vtigerAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.VTIGERACCOUNTS">VtigerAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVtigerAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVtigerAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-vtigerAccounts-count">\n          <span>{{vm.selectedVtigerAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVtigerAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVtigerAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVtigerAccounts" csv-label="true" filename="vtigerAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVtigerAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VTIGERACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVtigerAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVtigerAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.VTIGER_USER_NAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.HOST\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.vtigerAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="vtigerAccount" md-select-id="id" ng-repeat="vtigerAccount in vm.vtigerAccounts.rows">\n                <td md-cell ng-if="vtigerAccount.userpic"><img class="avatar" alt="{{vtigerAccount.name}}" ng-src="api/users/{{vtigerAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!vtigerAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{vtigerAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="id ">{{vtigerAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="name ">{{vtigerAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="username ">{{vtigerAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="remoteUri ">{{vtigerAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(vtigerAccount, $event    )" translate="INTEGRATIONS.EDIT_VTIGERACCOUNT">\n                          Edit VtigerAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(vtigerAccount, $event    )" translate="INTEGRATIONS.TEST_VTIGERACCOUNT">\n                          Test VtigerAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(vtigerAccount, $event    )" translate="INTEGRATIONS.DELETE_VTIGERACCOUNT">\n                          Delete VtigerAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.vtigerAccounts.count}}" md-on-paginate="vm.getVtigerAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VTIGERACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VTIGERACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-vtigerAccount-button" ng-click="vm.createOrEditVtigerAccount($event)" aria-label="add vtigerAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_VTIGERACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VTIGERACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/zendeskAccounts/create/dialog.html",'<md-dialog class="zendeskAccount-dialog" aria-label="New ZendeskAccount">\n  <form name="zendeskAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.zendeskAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="zendeskAccountForm[\'name\'].$error" ng-show="zendeskAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.zendeskAccount.type" required>\n\n          <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n          <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zendeskAccountForm[\'type\'].$error" ng-show="zendeskAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.zendeskAccount.username" ng-required="true">\n\n        <div ng-messages="zendeskAccountForm[\'username\'].$error" ng-show="zendeskAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.zendeskAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="zendeskAccountForm[\'remoteUri\'].$error" ng-show="zendeskAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n        <md-select name="authType" ng-model="vm.zendeskAccount.authType" required>\n          <md-option ng-value="\'password\'">Password</md-option>\n          <md-option ng-value="\'token\'">Token</md-option>\n        </md-select>\n        <div ng-messages="zendeskAccountForm[\'authType\'].$error" ng-show="zendeskAccountForm[\'authType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.zendeskAccount.authType == \'password\'">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.zendeskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="zendeskAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.zendeskAccount.authType == \'token\'" class="md-block">\n        <label translate="INTEGRATIONS.TOKEN">Token</label>\n        <input type="text" name="token" ng-model="vm.zendeskAccount.token" ng-required="true">\n\n        <div ng-messages="zendeskAccountForm[\'token\'].$error" ng-show="zendeskAccountForm[\'token\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TOKEN_REQUIRED">Token field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.zendeskAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="zendeskAccountForm[\'serverUrl\'].$error" ng-show="zendeskAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.zendeskAccount.description">\n\n        <div ng-messages="zendeskAccountForm[\'description\'].$error" ng-show="zendeskAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZendeskAccount" ng-click="vm.saveZendeskAccount()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountForm.$invalid || zendeskAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZendeskAccount" ng-click="vm.addNewZendeskAccount()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZENDESKACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_ZENDESKACCOUNT">\n          ADD ZENDESKACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZendeskAccount" ng-click="vm.deleteZendeskAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",'<md-dialog class="zendeskAccount-item-dialog" aria-label="New Item">\n  <form name="zendeskAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="zendeskAccountItemForm.type.$error" ng-show="zendeskAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="zendeskAccountItemForm.content.$error" ng-show="zendeskAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="zendeskAccountItemForm.key.$error" ng-show="zendeskAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="zendeskAccountItemForm.keyType.$error" ng-show="zendeskAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="zendeskAccountItemForm.keyContent.$error" ng-show="zendeskAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="zendeskAccountItemForm.variableName.$error" ng-show="zendeskAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="zendeskAccountItemForm.customField.$error" ng-show="zendeskAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountItemForm.$invalid || zendeskAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountItemForm.$invalid || zendeskAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="zendeskAccountItemForm.type.$error" ng-show="zendeskAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="zendeskAccountItemForm.option.$error" ng-show="zendeskAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="zendeskAccountItemForm.content.$error" ng-show="zendeskAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="zendeskAccountItemForm.variableName.$error" ng-show="zendeskAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="zendeskAccountItemForm.type.$error" ng-show="zendeskAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="zendeskAccountItemForm.content.$error"\n          ng-show="zendeskAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="zendeskAccountItemForm.variableName.$error"\n          ng-show="zendeskAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/zendeskAccounts/edit/view.html",'<div id="integrations-zendeskAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-zendeskAccounts-button md-icon-button" aria-label="Go to zendeskAccounts" ng-click="vm.gotoZendeskAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_ZENDESKACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="zendeskAccount-image" hide-xs>\n          <img ng-src="assets/images/business/zendeskAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.zendeskAccount.id}}\n            <span ng-if="vm.zendeskAccount.name">{{vm.zendeskAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.zendeskAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveZendeskAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (zendeskConfigurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zendeskAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.zendeskAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.zendeskAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n                  <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.zendeskAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.zendeskAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n                <md-select name="authType" ng-model="vm.zendeskAccount.authType" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'password\'">Password</md-option>\n                  <md-option ng-value="\'token\'">Token</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'authType\'].$error" ng-show="generalForm[\'authType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.zendeskAccount.authType == \'password\'">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.zendeskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container ng-if="vm.zendeskAccount.authType == \'token\'" class="md-block">\n                <label translate="INTEGRATIONS.TOKEN">Token</label>\n                <input type="text" name="token" ng-model="vm.zendeskAccount.token" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'token\'].$error" ng-show="generalForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TOKEN_REQUIRED">Token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.zendeskAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.zendeskAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zendeskAccount-detail-form-container zendeskconfigurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.ZENDESKCONFIGURATIONS">ZENDESKCONFIGURATIONS</div>\n            </div>\n            <div ng-controller="ZendeskAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.zendeskAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZendeskConfiguration($event)" class="md-icon-button" aria-label="create zendeskConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="zendeskConfiguration in vm_cc.zendeskConfigurations" class="border-top" md-colors="{background: (vm_cc.selectedZendeskConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getZendeskConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ zendeskConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteZendeskConfiguration($event, zendeskConfiguration)" translate="INTEGRATIONS.DELETE_ZENDESKCONFIGURATION">\n                            Delete ZendeskConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.zendeskConfigurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.TAGS">TAGS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-table-container class="md-whiteframe-1dp padding-20">\n                        <md-input-container class="md-block">\n                          <label translate="INTEGRATIONS.TAGS">Tags</label>\n                          <md-select ng-model="vm_cc.selectedTags" ng-change="vm_cc.selectTagsChanged($event)" multiple>\n                            <md-option ng-value="tag.id" ng-repeat="tag in vm_cc.tags">{{ tag.name }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.zendeskConfigurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZendeskConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/zendeskAccounts/edit/zendeskConfigurations/dialog.html",'<md-dialog class="zendeskConfiguration-dialog" aria-label="New ZendeskConfiguration">\n  <form name="zendeskConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.zendeskConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="zendeskConfigurationForm[\'name\'].$error" ng-show="zendeskConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.zendeskConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zendeskConfigurationForm[\'channel\'].$error" ng-show="zendeskConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.zendeskConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zendeskConfigurationForm[\'type\'].$error" ng-show="zendeskConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZendeskConfiguration" ng-click="vm.saveZendeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="zendeskConfigurationForm.$invalid || zendeskConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZendeskConfiguration" ng-click="vm.addNewZendeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="zendeskConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZENDESKCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_ZENDESKCONFIGURATION">\n          ADD ZENDESKCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZendeskConfiguration" ng-click="vm.deleteZendeskConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zendeskAccounts/zendeskAccounts.html",'<div id="zendeskAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.ZENDESKACCOUNTS">ZendeskAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedZendeskAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedZendeskAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-zendeskAccounts-count">\n          <span>{{vm.selectedZendeskAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllZendeskAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectZendeskAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedZendeskAccounts" csv-label="true" filename="zendeskAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedZendeskAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- ZENDESKACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedZendeskAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getZendeskAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.zendeskAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="zendeskAccount" md-select-id="id" ng-repeat="zendeskAccount in vm.zendeskAccounts.rows">\n                <td md-cell ng-if="zendeskAccount.userpic"><img class="avatar" alt="{{zendeskAccount.name}}" ng-src="api/users/{{zendeskAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!zendeskAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{zendeskAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="id ">{{zendeskAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="name ">{{zendeskAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="username ">{{zendeskAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="remoteUri ">{{zendeskAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(zendeskAccount, $event    )" translate="INTEGRATIONS.EDIT_ZENDESKACCOUNT">\n                          Edit ZendeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(zendeskAccount, $event    )" translate="INTEGRATIONS.TEST_ZENDESKACCOUNT">\n                          Test ZendeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(zendeskAccount, $event    )" translate="INTEGRATIONS.DELETE_ZENDESKACCOUNT">\n                          Delete ZendeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.zendeskAccounts.count}}" md-on-paginate="vm.getZendeskAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / ZENDESKACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD ZENDESKACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-zendeskAccount-button" ng-click="vm.createOrEditZendeskAccount($event)" aria-label="add zendeskAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_ZENDESKACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD ZENDESKACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/zohoAccounts/create/dialog.html",'<md-dialog class="zohoAccount-dialog" aria-label="New ZohoAccount">\n  <form name="zohoAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.zohoAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="zohoAccountForm[\'name\'].$error" ng-show="zohoAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.HOST">Host</label>\n        <md-select name="host" ng-model="vm.zohoAccount.host" required>\n          <md-option ng-value="\'zoho.com\'">zoho.com</md-option>\n          <md-option ng-value="\'zoho.eu\'">zoho.eu</md-option>\n        </md-select>\n        <div ng-messages="zohoAccountForm[\'host\'].$error" ng-show="zohoAccountForm[\'host\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.ZONE">Zone</label>\n        <md-select name="zone" ng-model="vm.zohoAccount.zone" required>\n          <md-option ng-value="\'US\'">US</md-option>\n          <md-option ng-value="\'AU\'">AU</md-option>\n          <md-option ng-value="\'EU\'">EU</md-option>\n          <md-option ng-value="\'IN\'">IN</md-option>\n          <md-option ng-value="\'CN\'">CN</md-option>\n        </md-select>\n        <div class="hint"><span translate="INTEGRATIONS.HELP.ZONE"></span></div>\n        <div ng-messages="zohoAccountForm[\'zone\'].$error" ng-show="zohoAccountForm[\'zone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.ZONE_REQUIRED">Zone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n        <input type="text" name="clientId" ng-model="vm.zohoAccount.clientId" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTID"></span></div>\n        <div ng-messages="zohoAccountForm[\'clientId\'].$error" ng-show="zohoAccountForm[\'clientId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n        <input type="text" name="clientSecret" ng-model="vm.zohoAccount.clientSecret" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTSECRET"></span></div>\n        <div ng-messages="zohoAccountForm[\'clientSecret\'].$error" ng-show="zohoAccountForm[\'clientSecret\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CODE">Code</label>\n        <input type="text" name="code" ng-model="vm.zohoAccount.code" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.CODE"></span></div>\n        <div ng-messages="zohoAccountForm[\'code\'].$error" ng-show="zohoAccountForm[\'code\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CODE_REQUIRED">Code field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.zohoAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="zohoAccountForm[\'serverUrl\'].$error" ng-show="zohoAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.zohoAccount.description">\n\n        <div ng-messages="zohoAccountForm[\'description\'].$error" ng-show="zohoAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZohoAccount" ng-click="vm.saveZohoAccount()" class="send-button md-accent md-raised" ng-disabled="zohoAccountForm.$invalid || zohoAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZohoAccount" ng-click="vm.addNewZohoAccount()" class="send-button md-accent md-raised" ng-disabled="zohoAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZOHOACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_ZOHOACCOUNT">\n          ADD ZOHOACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZohoAccount" ng-click="vm.deleteZohoAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zohoAccounts/edit/configurations/dialog.html",'<md-dialog class="zohoConfiguration-dialog" aria-label="New ZohoConfiguration">\n  <form name="zohoConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.zohoConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="zohoConfigurationForm[\'name\'].$error" ng-show="zohoConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.zohoConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zohoConfigurationForm[\'channel\'].$error" ng-show="zohoConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.zohoConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zohoConfigurationForm[\'type\'].$error" ng-show="zohoConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZohoConfiguration" ng-click="vm.saveZohoConfiguration()" class="send-button md-accent md-raised" ng-disabled="zohoConfigurationForm.$invalid || zohoConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZohoConfiguration" ng-click="vm.addNewZohoConfiguration()" class="send-button md-accent md-raised" ng-disabled="zohoConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZOHOCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_ZOHOCONFIGURATION">\n          ADD ZOHOCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZohoConfiguration" ng-click="vm.deleteZohoConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",'<md-dialog class="zohoAccount-item-dialog" aria-label="New Item">\n  <form name="zohoAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="zohoAccountItemForm.type.$error" ng-show="zohoAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="zohoAccountItemForm.content.$error" ng-show="zohoAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="zohoAccountItemForm.key.$error" ng-show="zohoAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="zohoAccountItemForm.keyType.$error" ng-show="zohoAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="zohoAccountItemForm.keyContent.$error" ng-show="zohoAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="zohoAccountItemForm.variableName.$error" ng-show="zohoAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="zohoAccountItemForm.customField.$error" ng-show="zohoAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="zohoAccountItemForm.$invalid || zohoAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="zohoAccountItemForm.$invalid || zohoAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="zohoAccountItemForm.type.$error" ng-show="zohoAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="zohoAccountItemForm.option.$error" ng-show="zohoAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="zohoAccountItemForm.content.$error" ng-show="zohoAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="zohoAccountItemForm.variableName.$error" ng-show="zohoAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="zohoAccountItemForm.type.$error" ng-show="zohoAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="zohoAccountItemForm.content.$error"\n          ng-show="zohoAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="zohoAccountItemForm.variableName.$error"\n          ng-show="zohoAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/zohoAccounts/edit/view.html",'<div id="integrations-zohoAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-zohoAccounts-button md-icon-button" aria-label="Go to zohoAccounts" ng-click="vm.gotoZohoAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_ZOHOACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="zohoAccount-image" hide-xs>\n          <img ng-src="assets/images/business/zohoAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.zohoAccount.id}}\n            <span ng-if="vm.zohoAccount.name">{{vm.zohoAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.zohoAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveZohoAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zohoAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.zohoAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.HOST">Host</label>\n                <md-select name="host" ng-model="vm.zohoAccount.host" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'zoho.com\'">zoho.com</md-option>\n                  <md-option ng-value="\'zoho.eu\'">zoho.eu</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.ZONE">Zone</label>\n                <md-select name="zone" ng-model="vm.zohoAccount.zone" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'US\'">US</md-option>\n                  <md-option ng-value="\'AU\'">AU</md-option>\n                  <md-option ng-value="\'EU\'">EU</md-option>\n                  <md-option ng-value="\'IN\'">IN</md-option>\n                  <md-option ng-value="\'CN\'">CN</md-option>\n                </md-select>\n                <div class="hint"><span translate="INTEGRATIONS.HELP.ZONE"></span></div>\n                <div ng-messages="generalForm[\'zone\'].$error" ng-show="generalForm[\'zone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.ZONE_REQUIRED">Zone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n                <input type="text" name="clientId" ng-model="vm.zohoAccount.clientId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTID"></span></div>\n                <div ng-messages="generalForm[\'clientId\'].$error" ng-show="generalForm[\'clientId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n                <input type="text" name="clientSecret" ng-model="vm.zohoAccount.clientSecret" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTSECRET"></span></div>\n                <div ng-messages="generalForm[\'clientSecret\'].$error" ng-show="generalForm[\'clientSecret\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CODE">Code</label>\n                <input type="text" name="code" ng-model="vm.zohoAccount.code" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.CODE"></span></div>\n                <div ng-messages="generalForm[\'code\'].$error" ng-show="generalForm[\'code\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CODE_REQUIRED">Code field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.REFRESHTOKEN">RefreshToken</label>\n                <input type="text" name="refreshToken" ng-model="vm.zohoAccount.refreshToken" disabled>\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.REFRESHTOKEN"></span></div>\n                <div ng-messages="generalForm[\'refreshToken\'].$error" ng-show="generalForm[\'refreshToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.REFRESHTOKEN_REQUIRED">RefreshToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.zohoAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.zohoAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zohoAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="ZohoAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.zohoAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZohoConfiguration($event)" class="md-icon-button" aria-label="create zohoConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="zohoConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedZohoConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getZohoConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ zohoConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteZohoConfiguration($event, zohoConfiguration)" translate="INTEGRATIONS.DELETE_ZOHOCONFIGURATION">\n                            Delete ZohoConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.ADVANCED">\n                        ADVANCED\n                      </span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_SEARCH"></label>\n                        <md-select ng-model="vm_cc.zohoConfiguration.moduleSearch" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'contact_lead\', value: \'Contact & Lead\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_CREATE"></label>\n                        <md-select ng-model="vm_cc.zohoConfiguration.moduleCreate" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'nothing\', value: \'Nothing\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZohoConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/zohoAccounts/zohoAccounts.html",'<div id="zohoAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.ZOHOACCOUNTS">ZohoAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedZohoAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedZohoAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-zohoAccounts-count">\n          <span>{{vm.selectedZohoAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllZohoAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectZohoAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedZohoAccounts" csv-label="true" filename="zohoAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedZohoAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- ZOHOACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedZohoAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getZohoAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="host">{{ \'INTEGRATIONS.HOST\' | translate }}</th>\n                <th md-column md-order-by="zone">{{ \'INTEGRATIONS.ZONE\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.zohoAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="zohoAccount" md-select-id="id" ng-repeat="zohoAccount in vm.zohoAccounts.rows">\n                <td md-cell ng-if="zohoAccount.userpic"><img class="avatar" alt="{{zohoAccount.name}}" ng-src="api/users/{{zohoAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!zohoAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{zohoAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="id ">{{zohoAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="name ">{{zohoAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="host ">{{ vm.arrayhost[zohoAccount.host].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="zone ">{{ vm.arrayzone[zohoAccount.zone].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(zohoAccount, $event    )" translate="INTEGRATIONS.EDIT_ZOHOACCOUNT">\n                          Edit ZohoAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(zohoAccount, $event    )" translate="INTEGRATIONS.TEST_ZOHOACCOUNT">\n                          Test ZohoAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(zohoAccount, $event    )" translate="INTEGRATIONS.DELETE_ZOHOACCOUNT">\n                          Delete ZohoAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.zohoAccounts.count}}" md-on-paginate="vm.getZohoAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / ZOHOACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD ZOHOACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-zohoAccount-button" ng-click="vm.createOrEditZohoAccount($event)" aria-label="add zohoAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_ZOHOACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD ZOHOACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/jscripty/views/projects/create/dialog.html",'<md-dialog class="project-dialog" aria-label="New Project">\n  <form name="projectForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="JSCRIPTY.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.project.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newProject">\n\n        <div class="hint"><span translate="JSCRIPTY.HELP.NAME"></span></div>\n        <div ng-messages="projectForm[\'name\'].$error" ng-show="projectForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="JSCRIPTY.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="JSCRIPTY.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="JSCRIPTY.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.project.description">\n\n        <div ng-messages="projectForm[\'description\'].$error" ng-show="projectForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="JSCRIPTY.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newProject" ng-click="vm.saveProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid || projectForm.$pristine" aria-label="SAVE" translate="JSCRIPTY.SAVE" translate-attr-aria-label="JSCRIPTY.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newProject" ng-click="vm.addNewProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid" aria-label="ADD" translate="JSCRIPTY.ADD_PROJECT" translate-attr-aria-label="JSCRIPTY.ADD_PROJECT">\n          ADD PROJECT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newProject" ng-click="vm.deleteProject($event)" aria-label="DELETE" translate translate-attr-aria-label="JSCRIPTY.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="JSCRIPTY.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/jscripty/views/projects/edit/clone/clone.html",'<md-dialog class="project-dialog" aria-label="Clone Project">\n  <form name="projectForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="JSCRIPTY.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.project.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newProject">\n\n        <div class="hint"><span translate="JSCRIPTY.HELP.NAME"></span></div>\n        <div ng-messages="projectForm[\'name\'].$error" ng-show="projectForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="JSCRIPTY.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="JSCRIPTY.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid" aria-label="CLONE" translate="JSCRIPTY.CLONE_PROJECT" translate-attr-aria-label="JSCRIPTY.CLONE_PROJECT">\n        CLONE PROJECT\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",'<md-dialog class="session-dialog" aria-label="New Session">\n  <form name="sessionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <md-list>\n        <md-subheader class="md-no-sticky">\n          <div class="margin-bottom-5"><span translate="JSCRIPTY.ANSWERS">Answers</span></div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.STARTTIME" class="ng-scope font-weight-700">Start Time</span>: <span class="ng-binding">{{vm.session.starttime | date:\'medium\'}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.MEMBERNAME" class="ng-scope font-weight-700">Member Name</span>: <span class="ng-binding">{{vm.session.membername}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.PROJECT" class="ng-scope font-weight-700">Project</span>: <span class="ng-binding">{{vm.project.name}}</span>\n          </div>\n        </md-subheader>\n        <md-list-item ng-if="vm.questions.rows.length" class="md-2-line contact-item" ng-repeat="question in vm.questions.rows">\n          <div class="md-list-item-text compact">\n            <h3>{{$index+1}}. {{question.question}}</h3>\n            <p>{{question.answer}}</p>\n          </div>\n          <md-divider ng-if="!$last"></md-divider>\n        </md-list-item>\n        <md-list-item ng-if="!vm.questions.rows.length" class="md-2-line contact-item">\n          <div class="md-list-item-text compact">\n            <h3><span class="text-boxed-light" translate="JSCRIPTY.NO_RESULTS_AVAILABLE">No results available</span></h3>\n          </div>\n        </md-list-item>\n      </md-list>\n\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/jscripty/views/projects/edit/view.html",'<div id="jscripty-project" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-projects-button md-icon-button" aria-label="Go to projects" ng-click="vm.gotoProjects()" translate translate-attr-aria-label="JSCRIPTY.GO_TO_PROJECTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="project-image" hide-xs>\n          <img ng-src="assets/images/business/projects.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.project.id}}\n            <span ng-if="vm.project.name">{{vm.project.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.CREATED_AT"></span> <span>{{vm.project.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.project, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="JSCRIPTY.CLONE_PROJECT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveProject()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (builderForm.$invalid) || (previewForm.$invalid) || (sessionsForm.$invalid) || (answersForm.$invalid)" translate="JSCRIPTY.SAVE" translate-attr-aria-label="JSCRIPTY.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="JSCRIPTY.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="JSCRIPTY.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.project.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="JSCRIPTY.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="JSCRIPTY.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="JSCRIPTY.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.project.enableUncompleteSave" aria-label="EnableUncompleteSave" ng-disabled="!vm.crudPermissions.canEdit"><span translate="JSCRIPTY.ENABLEUNCOMPLETESAVE">EnableUncompleteSave</span></md-switch>\n                <div class="hint"><span translate="JSCRIPTY.HELP.ENABLEUNCOMPLETESAVE"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.project.sendUnpauseOnSubmit" aria-label="SendUnpauseOnSubmit" ng-disabled="!vm.crudPermissions.canEdit"><span translate="JSCRIPTY.SENDUNPAUSEONSUBMIT">SendUnpauseOnSubmit</span></md-switch>\n                <div class="hint"><span translate="JSCRIPTY.HELP.SENDUNPAUSEONSUBMIT"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="JSCRIPTY.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.project.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="JSCRIPTY.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.BUILDER">BUILDER</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container builder md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ProjectBuilderController as vm_bc" ng-init="vm_bc.init(vm.project)">\n              <mw-form-builder ng-if="vm_bc.project.formData" form-data="vm_bc.project.formData" options="vm_bc.optionsBuilder" read-only="false"></mw-form-builder>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.PREVIEW">PREVIEW</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container preview md-background-bg md-whiteframe-1dp">\n            <div layout="column" layout-align="center" ng-controller="ProjectViewerController as vm_vc" ng-init="vm_vc.init(vm.project)">\n              <div layout="row" layout-align="center">\n                <md-button class="md-raised md-accent" aria-label="Reset" ng-click="vm_vc.resetViewer()">\n                  Reset\n                </md-button>\n              </div>\n              <mw-form-viewer ng-if="vm_vc.project.formData" form-data="vm_vc.project.formData" response-data="vm_vc.responseData" on-submit="vm_vc.onSubmit($event)" api="vm_vc.formViewer"></mw-form-viewer>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.SESSIONS">SESSIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container sessions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ProjectSessionsController as vm_dc" ng-init="vm_dc.init(vm.project, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedProjectSessions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="JSCRIPTY.SESSIONS">Sessions</span>\n                  <ms-search-bar on-search="vm_dc.getProjectSessions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedProjectSessions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedProjectSessions.length}} {{vm_dc.selectedProjectSessions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedProjectSessions" csv-label="true" filename="projects.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedProjectSessions($event)" aria-label="delete selected" translate translate-attr-label="JSCRIPTY.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedProjectSessions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getProjectSessions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'JSCRIPTY.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'JSCRIPTY.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'JSCRIPTY.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="membername">\n                        {{ \'JSCRIPTY.MEMBERNAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'JSCRIPTY.CALLERIDNUM\' | translate }}\n                      </th>\n                      <th md-column md-order-by="completed">\n                        {{ \'JSCRIPTY.COMPLETE\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="session" md-select-id="id" ng-repeat="session in vm_dc.projectSessions.rows">\n                      <td md-cell>\n                        {{session.id}}\n                      </td>\n                      <td md-cell>\n                        {{ session.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ session.endtime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{session.membername}}\n                      </td>\n                      <td md-cell>\n                        {{session.calleridnum}}\n                      </td>\n                      <td md-cell class="completed ">\n                        <md-icon md-colors="{color: {{session.completed ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{session.completed? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="JSCRIPTY.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.showQuestionsProjectSession($event, session)" translate="JSCRIPTY.SHOW_QUESTIONS_SESSION">\n                                Results Session\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(session, $event)" translate="JSCRIPTY.DELETE_SESSION">\n                                Delete Session\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.projectSessions.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="JSCRIPTY.NO_SESSION_AVAILABLE">No session available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'JSCRIPTY.PAGE\' | translate}}:\', rowsPerPage: \'{{\'JSCRIPTY.ROWSPERPAGE\' | translate}}:\', of: \'{{\'JSCRIPTY.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.projectSessions.count}}" md-on-paginate="vm_dc.getProjectSessions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.ANSWERS">ANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container answers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ProjectAnswersController as vm_an" ng-init="vm_an.init(vm.project, vm.userProfile)">\n              <div class="pb-16" layout="row">\n                <div class="h2 secondary-text" translate="JSCRIPTY.ANSWERS" flex>Answers</div>\n                <div layout="row" layout-align="space-between center" flex>\n                  <md-date-range localization-map="vm_an.localizationMap" ng-model="vm_an.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm_an.getAnswers()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                  <md-button type="button" ng-if="vm_an.currentUser.role === \'admin\' || vm_an.userProfile.downloadJscriptySessions" ng-disabled="!vm_an.answers" ng-click="vm_an.getSummary($event)" class="md-accent md-raised md-button ng-scope md-default-theme md-ink-ripple md-green-500-bg md-icon-button" title="{{\'JSCRIPTY.EXPORT_TO_CSV\' | translate}}">\n                    <md-icon md-font-icon="icon-file-excel" class="md-default-theme md-font material-icons icon-file-excel"></md-icon>\n                  </md-button>\n                </div>\n              </div>\n              <div layout="row">\n                <md-card class="md-whiteframe-1dp" ng-if="vm_an.answers && vm_an.hasIdAnswers" flex>\n                  <md-list>\n                    <md-list-item class="md-2-line contact-item" ng-repeat="(key, question) in vm_an.answers">\n                      <div class="md-list-item-text compact" layout-padding>\n                        <h3>{{question.question}}</h3>\n                        <md-table-container>\n                          <table md-table>\n                            <thead md-head>\n                              <tr md-row>\n                                <th md-column></th>\n                                <th md-column>#</th>\n                                <th md-column>%</th>\n                              </tr>\n                            </thead>\n                            <tbody md-body>\n                              <tr md-row ng-repeat="(key, value) in question.answers">\n                                <td md-cell>{{key}}</td>\n                                <td md-cell width="20px">{{value}}</td>\n                                <td md-cell width="20px">{{value*100/question.sum | number:1}}</td>\n                              </tr>\n                              <tr md-row>\n                                <td md-cell><b>{{\'JSCRIPTY.TOTAL\' | translate}}</b></td>\n                                <td md-cell width="20px"><b>{{question.sum}}</b></td>\n                                <td md-cell width="20px"><b>100</b></td>\n                              </tr>\n                            </tbody>\n                          </table>\n                        </md-table-container>\n                      </div>\n                      <md-divider ng-if="!$last"></md-divider>\n                    </md-list-item>\n                  </md-list>\n                </md-card>\n                <span ng-if="!vm_an.answers || !vm_an.hasIdAnswers" class="text-boxed-light" translate="JSCRIPTY.NO_ANSWERS_AVAILABLE">No answers available</span>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/jscripty/views/projects/projects.html",'<div id="projects" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-script" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="JSCRIPTY.PROJECTS">Projects</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="JSCRIPTY.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedProjects.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedProjects =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="JSCRIPTY.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-projects-count">\n          <span>{{vm.selectedProjects.length}}</span>\n          <span translate="JSCRIPTY.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="JSCRIPTY.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllProjects()" translate="JSCRIPTY.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectProjects()" translate="JSCRIPTY.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedProjects" csv-label="true" filename="projects.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedProjects($event)" aria-label="delete selected" translate translate-attr-label="JSCRIPTY.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- PROJECT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedProjects" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getProjects">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'JSCRIPTY.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'JSCRIPTY.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'JSCRIPTY.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'JSCRIPTY.CREATED_AT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.projects.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="JSCRIPTY.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="project" md-select-id="id" ng-repeat="project in vm.projects.rows">\n                <td md-cell ng-if="project.userpic"><img class="avatar" alt="{{project.name}}" ng-src="api/users/{{project.id}}/avatar" /></td>\n                <td md-cell ng-if="!project.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{project.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="id ">{{project.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="name ">{{project.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="description ">{{project.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="createdAt ">{{project.createdAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="JSCRIPTY.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(project, $event    )" translate="JSCRIPTY.EDIT_PROJECT">\n                          Edit Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(project, $event    )" translate="JSCRIPTY.CLONE_PROJECT">\n                          clone Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.sessionsgoto(project, $event    )" translate="JSCRIPTY.SESSIONS_PROJECT">\n                          Sessions Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.deleteconfirm(project, $event    )" translate="JSCRIPTY.DELETE_PROJECT">\n                          Delete Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'JSCRIPTY.PAGE\' | translate}}:\', rowsPerPage: \'{{\'JSCRIPTY.ROWSPERPAGE\' | translate}}:\', of: \'{{\'JSCRIPTY.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.projects.count}}" md-on-paginate="vm.getProjects" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PROJECT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD PROJECT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-project-button" ng-click="vm.createOrEditProject($event)" aria-label="add project" translate translate-attr-aria-label="JSCRIPTY.ADD_PROJECT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD PROJECT BUTTON --\x3e\n</div>'),e.put("app/main/apps/mail/views/mailAccounts/create/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newMailAccount ? \'MAIL.NEW_MAILACCOUNT\' : \'MAIL.EDIT_MAILACCOUNT\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.mailAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="mailAccountForm[\'name\'].$error" ng-show="mailAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.mailAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="mailAccountForm[\'key\'].$error" ng-show="mailAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="MAIL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.EMAIL_ADDRESS">Email Address</label>\n        <input type="email" name="email" ng-model="vm.mailAccount.email" ng-required="true">\n\n        <div ng-messages="mailAccountForm[\'email\'].$error" ng-show="mailAccountForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.EMAIL_ADDRESS_REQUIRED">Email Address field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="MAIL.ERRORS.EMAIL_ADDRESS_MUST_VALID">Email Address must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.mailAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountForm[\'ListId\'].$error" ng-show="mailAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.mailAccount.active" aria-label="Active"><span translate="MAIL.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.newMailAccount" class="md-block">\n        <label translate="MAIL.SERVICE">Service</label>\n        <md-select name="provider" ng-model="vm.mailAccount.provider" ng-change="vm.onProviderChange()" required>\n          <md-option ng-value="provider.value" ng-repeat="provider in vm.providers">{{ provider.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountForm[\'provider\'].$error" ng-show="mailAccountForm[\'provider\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.SERVICE_REQUIRED">Service field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.newMailAccount && vm.mailAccount.provider === \'custom\'">\n        <div layout="row">\n          <md-input-container class="md-block mr-20 mb-0" flex>\n            <label translate="MAIL.IMAP_HOST">IMAP_Host</label>\n            <input type="text" name="Imap.host" ng-model="vm.mailAccount.Imap.host" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Imap.host\'].$error" ng-show="mailAccountForm[\'Imap.host\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.IMAP_HOST_REQUIRED">IMAP_Host field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block mb-0">\n            <label translate="MAIL.IMAP_PORT">IMAP Port</label>\n            <input type="number" name="Imap.port" ng-model="vm.mailAccount.Imap.port" value="465" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Imap.port\'].$error" ng-show="mailAccountForm[\'Imap.port\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.IMAP_PORT_REQUIRED">IMAP Port field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n        </div>\n      </div>\n\n      <div ng-if="vm.newMailAccount && vm.mailAccount.provider === \'custom\'">\n        <div layout="row">\n          <md-input-container class="md-block mr-20 mb-0" flex>\n            <label translate="MAIL.SMTP_HOST">SMTP Host</label>\n            <input type="text" name="Smtp.host" ng-model="vm.mailAccount.Smtp.host" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Smtp.host\'].$error" ng-show="mailAccountForm[\'Smtp.host\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.SMTP_HOST_REQUIRED">SMTP Host field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block mb-0">\n            <label translate="MAIL.SMTP_PORT">SMTP Port</label>\n            <input type="number" name="Smtp.port" ng-model="vm.mailAccount.Smtp.port" value="465" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Smtp.port\'].$error" ng-show="mailAccountForm[\'Smtp.port\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.SMTP_PORT_REQUIRED">SMTP Port field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n        </div>\n      </div>\n\n      <md-input-container ng-if="vm.newMailAccount && vm.mailAccount.provider === \'custom\'" class="md-block pt-0">\n        <md-switch ng-model="vm.mailAccount.authentication" aria-label="Authentication"><span translate="MAIL.AUTHENTICATION">Authentication</span></md-switch>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.newMailAccount && vm.mailAccount.provider === \'outlook365\'" class="md-block">\n        <md-switch ng-model="vm.mailAccount.modernAuthentication" aria-label="Modern Authentication" class="no-margin-bottom"><span translate="MAIL.MODERN_AUTHENTICATION">Modern Authentication</span></md-switch>\n      </md-input-container>\n\n      <div ng-if="vm.newMailAccount && vm.mailAccount.authentication && vm.mailAccount.provider">\n        <md-input-container class="md-block">\n          <label translate="MAIL.USERNAME">Username</label>\n          <input type="text" name="username" ng-model="vm.mailAccount.username" ng-required="true">\n          <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n          <div ng-messages="mailAccountForm[\'username\'].$error" ng-show="mailAccountForm[\'username\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.mailAccount.modernAuthentication" class="md-block">\n          <label translate="MAIL.CLOUD_PROVIDER">Cloud Provider</label>\n          <md-select name="cloudProvider" ng-model="vm.mailAccount.CloudProviderId" required>\n            <md-option ng-value="cloudProvider.id" ng-repeat="cloudProvider in vm.cloudProviders.rows">{{ cloudProvider.name }}</md-option>\n          </md-select>\n          <div class="hint"><span translate="MAIL.HELP.CLOUD_PROVIDER"></span></div>\n          <div ng-messages="mailAccountForm[\'cloudProvider\'].$error" ng-show="mailAccountForm[\'cloudProvider\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="!vm.mailAccount.modernAuthentication" class="md-block">\n          <label translate="MAIL.PASSWORD">Password</label>\n          <input type="password" name="password" ng-model="vm.mailAccount.password" translate-attr-placeholder="MAIL.PASSWORD" required>\n          <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n          <div ng-messages="mailAccountForm[\'password\'].$error" role="alert">\n            <div ng-message="required">\n              <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailAccount.description">\n        <div ng-messages="mailAccountForm[\'description\'].$error" ng-show="mailAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailAccount" ng-click="vm.saveMailAccount()" class="send-button md-accent md-raised" ng-disabled="mailAccountForm.$invalid || mailAccountForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailAccount" ng-click="vm.addNewMailAccount()" class="send-button md-accent md-raised" ng-disabled="mailAccountForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILACCOUNT" translate-attr-aria-label="MAIL.ADD_MAILACCOUNT">\n          ADD MAIL ACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailAccount" ng-click="vm.deleteMailAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",'<md-dialog class="mailAccount-dialog" aria-label="mailAccount" ng-init="vm.onInit()">\n  <form name="mailAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MAIL.AGENTADD_MAILACCOUNT">Add Agent to mailAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/agent/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'agent\'].$error" ng-show="mailAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'timeout\'].$error" ng-show="mailAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'times\'].$error" ng-show="mailAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.REPLY_TYPE">Reply_Type</label>\n        <md-select name="replyType" ng-model="vm.autoreply.replyType" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="0">Reply</md-option>\n          <md-option ng-value="1">Reply All</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'replyType\'].$error" ng-show="mailAccountFormApp[\'replyType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.REPLY_TYPE_REQUIRED">Reply_Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label class="md-caption grey-fg" translate="MAIL.TEXT">Text</label>\n        <textarea aria-label="Text text" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.autoreply.text"></textarea>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/close/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'disposition\'].$error" ng-show="mailAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'condition\'].$error" ng-show="mailAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'truepriority\'].$error" ng-show="mailAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'falsepriority\'].$error" ng-show="mailAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'priority\'].$error" ng-show="mailAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/noop/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'value\'].$error" ng-show="mailAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/queue/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'queue\'].$error" ng-show="mailAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'timeout\'].$error" ng-show="mailAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/system/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'command\'].$error" ng-show="mailAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'variable\'].$error" ng-show="mailAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/tag/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'tag\'].$error" ng-show="mailAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/mailCannedAnswers/dialog.html",'<md-dialog class="mailCannedAnswer-dialog" aria-label="New MailCannedAnswer">\n  <form name="mailCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.mailCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="mailCannedAnswerForm[\'key\'].$error" ng-show="mailCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label class="md-caption grey-fg" translate="MAIL.VALUE">Value</label>\n        <textarea aria-label="Value value" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.mailCannedAnswer.value"></textarea>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailCannedAnswer.description">\n\n        <div ng-messages="mailCannedAnswerForm[\'description\'].$error" ng-show="mailCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailCannedAnswer" ng-click="vm.saveMailCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="mailCannedAnswerForm.$invalid || mailCannedAnswerForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailCannedAnswer" ng-click="vm.addNewMailCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="mailCannedAnswerForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILCANNEDANSWER" translate-attr-aria-label="MAIL.ADD_MAILCANNEDANSWER">\n          ADD MAILCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailCannedAnswer" ng-click="vm.deleteMailCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/view.html",'<div id="mail-mailAccount" class="page-layout simple tabbed" layout="column">\n\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-mailAccounts-button md-icon-button" aria-label="Go to mailAccounts" ng-click="vm.goToMailAccounts()" translate translate-attr-aria-label="MAIL.GO_TO_MAILACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="mailAccount-image" hide-xs>\n          <img ng-src="assets/images/business/mailAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.mailAccount.id}}\n            <span ng-if="vm.mailAccount.name">{{vm.mailAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MAIL.CREATED_AT"></span> <span>{{vm.mailAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.goToRealtime()" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="MAIL.GOTO_MAILACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.addAgent(vm.mailAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="MAIL.AGENTADD_MAILACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveMailAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (credentialsForm.$invalid) || (templateForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (imapForm.$invalid) || (smtpForm.$invalid) || (dispositionForm.$invalid) || (mailDispositionsForm.$invalid) || (mailCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.mailAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.mailAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="MAIL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.SERVICE">Service</label>\n                <md-select name="provider" ng-model="vm.mailAccount.provider" ng-change="vm.onProviderChange()" class="mb-20" required>\n                  <md-option ng-value="provider.value" ng-repeat="provider in vm.providers">{{ provider.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'provider\'].$error" ng-show="generalForm[\'provider\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.EMAIL_ADDRESS">Email_Address</label>\n                <input type="email" name="email" ng-model="vm.mailAccount.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.EMAIL_ADDRESS_REQUIRED">Email_Address field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="MAIL.ERRORS.EMAIL_ADDRESS_MUST_VALID">Email_Address must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.mailAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.active" aria-label="Active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.markAsUnread" aria-label="mark_as_unread" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.MARK_AS_UNREAD">mark_as_unread</span></md-switch>\n                <div class="hint"><span translate="MAIL.HELP.MARK_AS_UNREAD"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.mailAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.mailAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.mailAccount.provider !== \'custom\'">\n        <md-tab-label>\n          <span translate="MAIL.AUTHENTICATION">Authentication</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container authentication md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.CREDENTIALS">Credentials</div>\n            </div>\n            <form name="credentialsForm" novalidate>\n              <md-input-container ng-if="vm.mailAccount.provider === \'outlook365\'" class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.modernAuthentication" aria-label="Modern Authentication" class="no-margin-bottom"><span translate="MAIL.MODERN_AUTHENTICATION">Modern Authentication</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.mailAccount.Imap.user" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n                <div ng-messages="credentialsForm[\'username\'].$error" ng-show="credentialsForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.Imap.modernAuthentication" class="md-block">\n                <label translate="MAIL.CLOUD_PROVIDER">Cloud Provider</label>\n                <md-select name="cloudProvider" ng-model="vm.mailAccount.Imap.CloudProviderId" required>\n                  <md-option ng-value="cloudProvider.id" ng-repeat="cloudProvider in vm.cloudProviders.rows">{{ cloudProvider.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MAIL.HELP.CLOUD_PROVIDER"></span></div>\n                <div ng-messages="credentialsForm[\'cloudProvider\'].$error" ng-show="credentialsForm[\'cloudProvider\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="!vm.mailAccount.Imap.modernAuthentication" class="md-block">\n                <label translate="MAIL.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.mailAccount.Imap.password" placeholder="Password" translate translate-attr-placeholder="MAIL.PASSWORD" required>\n                <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n                <div ng-messages="credentialsForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container imap md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.IMAP">IMAP</div>\n            </div>\n            <form name="imapForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.tls" aria-label="ssl" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.SSL">ssl</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.MAILBOX">Mailbox</label>\n                <input type="text" name="Imap.mailbox" ng-model="vm.mailAccount.Imap.mailbox" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.mailbox\'].$error" ng-show="imapForm[\'Imap.mailbox\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.MAILBOX_REQUIRED">mailbox field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.CONNTIMEOUT">Connection Timeout</label>\n                <input type="number" name="Imap.connTimeout" ng-model="vm.mailAccount.Imap.connTimeout" min="1" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.connTimeout\'].$error" ng-show="imapForm[\'Imap.connTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_REQUIRED">Connection Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Connection Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.AUTHTIMEOUT">Authorization Timeout</label>\n                <input type="number" name="Imap.authTimeout" ng-model="vm.mailAccount.Imap.authTimeout" min="1" value="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.authTimeout\'].$error" ng-show="imapForm[\'Imap.authTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_REQUIRED">Authorizazion Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Authorizazion Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.mailAccount.provider === \'custom\'">\n        <md-tab-label>\n          <span translate="MAIL.IMAP">IMAP</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container imap md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.IMAP">IMAP</div>\n            </div>\n            <form name="imapForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.IMAP_HOST">IMAP_Host</label>\n                <input type="text" name="Imap.host" ng-model="vm.mailAccount.Imap.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.host\'].$error" ng-show="imapForm[\'Imap.host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.IMAP_HOST_REQUIRED">IMAP_Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.IMAP_PORT">IMAP_Port</label>\n                <input type="number" name="Imap.port" ng-model="vm.mailAccount.Imap.port" value="465" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.port\'].$error" ng-show="imapForm[\'Imap.port\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.IMAP_PORT_REQUIRED">IMAP_Port field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.tls" aria-label="ssl" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.SSL">ssl</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.authentication" aria-label="Authentication" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.AUTHENTICATION">Authentication</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.Imap.authentication" class="md-block">\n                <label translate="MAIL.USERNAME">Username</label>\n                <input type="text" name="Imap.user" ng-model="vm.mailAccount.Imap.user" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n                <div ng-messages="imapForm[\'Imap.user\'].$error" ng-show="imapForm[\'Imap.user\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.mailAccount.Imap.authentication">\n                <label translate="MAIL.PASSWORD">Password</label>\n                <input type="password" name="Imap.password" ng-model="vm.mailAccount.Imap.password" placeholder="Password" translate translate-attr-placeholder="MAIL.PASSWORD" required>\n                <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n                <div ng-messages="imapForm[\'Imap.password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.MAILBOX">Mailbox</label>\n                <input type="text" name="Imap.mailbox" ng-model="vm.mailAccount.Imap.mailbox" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.mailbox\'].$error" ng-show="imapForm[\'Imap.mailbox\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.MAILBOX_REQUIRED">mailbox field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.CONNTIMEOUT">Connection Timeout</label>\n                <input type="number" name="Imap.connTimeout" ng-model="vm.mailAccount.Imap.connTimeout" min="1" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.connTimeout\'].$error" ng-show="imapForm[\'Imap.connTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_REQUIRED">Connection Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Connection Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.AUTHTIMEOUT">Authorization Timeout</label>\n                <input type="number" name="Imap.authTimeout" ng-model="vm.mailAccount.Imap.authTimeout" min="1" value="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.authTimeout\'].$error" ng-show="imapForm[\'Imap.authTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_REQUIRED">Authorization Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Authorization Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.mailAccount.provider === \'custom\'">\n        <md-tab-label>\n          <span translate="MAIL.SMTP">SMTP</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container smtp md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.SMTP">SMTP</div>\n            </div>\n            <form name="smtpForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.SMTP_HOST">SMTP_Host</label>\n                <input type="text" name="Smtp.host" ng-model="vm.mailAccount.Smtp.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="smtpForm[\'Smtp.host\'].$error" ng-show="smtpForm[\'Smtp.host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.SMTP_HOST_REQUIRED">SMTP_Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.SMTP_PORT">SMTP_Port</label>\n                <input type="number" name="Smtp.port" ng-model="vm.mailAccount.Smtp.port" value="465" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="smtpForm[\'Smtp.port\'].$error" ng-show="smtpForm[\'Smtp.port\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.SMTP_PORT_REQUIRED">SMTP_Port field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Smtp.secure" aria-label="Secure" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.SECURE">Secure</span></md-switch>\n                <div class="hint"><span translate="MAIL.HELP.SECURE"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Smtp.authentication" aria-label="Authentication" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.AUTHENTICATION">Authentication</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.Smtp.authentication" class="md-block">\n                <label translate="MAIL.USERNAME">Username</label>\n                <input type="text" name="Smtp.user" ng-model="vm.mailAccount.Smtp.user" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n                <div ng-messages="smtpForm[\'Smtp.user\'].$error" ng-show="smtpForm[\'Smtp.user\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.mailAccount.Smtp.authentication">\n                <label translate="MAIL.PASSWORD">Password</label>\n                <input type="password" name="Smtp.pass" ng-model="vm.mailAccount.Smtp.pass" placeholder="Password" translate translate-attr-placeholder="MAIL.PASSWORD" required>\n                <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n                <div ng-messages="smtpForm[\'Smtp.pass\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container template md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.TEMPLATE">TEMPLATE</div>\n            </div>\n            <form name="templateForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.FONT_FAMILY">Font_Family</label>\n                <ms-font-family name="fontFamily" ng-model="vm.mailAccount.fontFamily" required></ms-font-family>\n                <div class="hint"><span translate="MAIL.HELP.FONT_FAMILY"></span></div>\n                <div ng-messages="templateForm[\'fontFamily\'].$error" ng-show="templateForm[fontFamily].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FONT_FAMILY_REQUIRED">Font_Family field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.FONT_SIZE">Font_Size</label>\n                <input type="number" name="fontSize" ng-model="vm.mailAccount.fontSize" min="8" max="72" value="13" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MAIL.HELP.FONT_SIZE"></span></div>\n                <div ng-messages="templateForm[\'fontSize\'].$error" ng-show="templateForm[\'fontSize\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FONT_SIZE_REQUIRED">Font_Size field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.FONT_SIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Font_Size must be a valid greater or equal than</span> <span>8</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.FONT_SIZE_MUST_BE_LESS_THAN_OR_EQUAL_TO">Font_Size must be a valid greater or equal than</span> <span>72</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="MAIL.TEMPLATE">Template</label>\n                <textarea aria-label="Template template" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.mailAccount.template"></textarea>\n              </div>\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="MAIL.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.mailAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.queueTransfer == true" class="md-block">\n                <label translate="MAIL.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.mailAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.agentTransfer == true" class="md-block">\n                <label translate="MAIL.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.mailAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.mandatoryDisposition" class="md-block">\n                <label translate="MAIL.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.mailAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MAIL.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="MailAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.mailAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="mailAccount-detail-form-container maildispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMailAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="MAIL.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add mail dispositions" translate translate-attr-label="MAIL.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="mailAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'MAIL.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container mailcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MailAccountMailCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.mailAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMailAccountMailCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MAIL.MAILCANNEDANSWERS">MailCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getMailAccountMailCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event)" aria-label="add mailCannedAnswer" translate translate-attr-label="MAIL.ADD_MAILCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedMailAccountMailCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedMailAccountMailCannedAnswers.length}} {{vm_dc.selectedMailAccountMailCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedMailAccountMailCannedAnswers" csv-label="true" filename="mailAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedMailAccountMailCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedMailAccountMailCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getMailAccountMailCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'MAIL.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'MAIL.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'MAIL.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'MAIL.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'MAIL.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="mailCannedAnswer" md-select-id="id" ng-repeat="mailCannedAnswer in vm_dc.mailAccountMailCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{mailCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{mailCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>{{mailCannedAnswer.value | htmlToPlaintext }}</td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{mailCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{ mailCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" translate="MAIL.EDIT_MAILCANNEDANSWER">\n                                Edit MailCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(mailCannedAnswer, $event)" translate="MAIL.DELETE_MAILCANNEDANSWER">\n                                Delete MailCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.mailAccountMailCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MAIL.NO_MAILCANNEDANSWER_AVAILABLE">No mailcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.mailAccountMailCannedAnswers.count}}" md-on-paginate="vm_dc.getMailAccountMailCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MailAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.mailAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="MAIL.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedMailAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedMailAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedMailAccountApps.length}} {{vm_ac.selectedMailAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedMailAccountApps($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedMailAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.mailAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editMailAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editMailAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editMailAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editMailAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.mailAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MailAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.mailAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMailAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MAIL.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getMailAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getMailAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getMailAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="MAIL.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedMailAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedMailAccountInteractions.length}} {{vm_dc.selectedMailAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedMailAccountInteractions" csv-label="true" filename="mailAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedMailAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedMailAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getMailAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'MAIL.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'MAIL.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="subject">\n                        {{ \'MAIL.SUBJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'MAIL.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'MAIL.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'MAIL.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'MAIL.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'MAIL.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.mailAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <div class="width-300">\n                          <span class="text-truncate font-size-12">\n                            {{interaction.subject}}\n                          </span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'MAIL.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'MAIL.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spymailInteraction($event, interaction)" translate="MAIL.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || (vm_dc.userProfile.downloadOmnichannelInteractions && vm_dc.userProfile.downloadAttachments)">\n                              <md-button class="md-primary" ng-click="vm_dc.mailInteractionDownload(interaction, $event, true)" translate="MAIL.DOWNLOAD_WITH_ATTACHMENTS">\n                                Download with attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.mailInteractionDownload(interaction, $event)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                                Download without attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="MAIL.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.mailAccountInteractions.rows.length">\n                      <td md-cell colspan="13">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MAIL.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.mailAccountInteractions.count}}" md-on-paginate="vm_dc.getMailAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n</div>'),e.put("app/main/apps/mail/views/mailAccounts/mailAccounts.html",'<div id="mailAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-email" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MAIL.MAILACCOUNTS">MailAccounts</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MAIL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n\n  <div ng-show="vm.selectedMailAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMailAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MAIL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-mailAccounts-count">\n          <span>{{vm.selectedMailAccounts.length}}</span>\n          <span translate="MAIL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MAIL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMailAccounts()" translate="MAIL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMailAccounts()" translate="MAIL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMailAccounts" csv-label="true" filename="mailAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMailAccounts($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMailAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailAccounts">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                <th md-column md-order-by="provider">{{ \'MAIL.SERVICE\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'MAIL.KEY\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'MAIL.EMAIL_ADDRESS\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'MAIL.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'MAIL.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.mailAccounts.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="mailAccount" md-select-id="id" ng-repeat="mailAccount in vm.mailAccounts.rows" ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)">\n                <td md-cell class="id">{{mailAccount.id}}</td>\n                <td md-cell class="name">{{mailAccount.name}}</td>\n                <td md-cell class="provider">{{ mailAccount.provider ? (mailAccount.provider | startcase) : (\'MAIL.CUSTOM\' | translate) }}</td>\n                <td md-cell class="key">{{mailAccount.key}}</td>\n                <td md-cell class="email">{{mailAccount.email}}</td>\n                <td md-cell class="active">\n                  <md-icon md-colors="{color: {{mailAccount.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{mailAccount.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td md-cell class="description ">{{mailAccount.description}}</td>\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(mailAccount, $event)" translate="MAIL.EDIT_MAILACCOUNT">\n                          Edit Email Account\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.verifySMTP(mailAccount, $event)" translate="MAIL.VERIFYSMTP_MAILACCOUNT">\n                          Verify SMTP\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.goToInteractions(mailAccount, $event)" translate="MAIL.INTERACTIONS_MAILACCOUNT">\n                          Go To Interactions\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.goToRealtime()" translate="MAIL.GOTOREALTIME_MAILACCOUNT">\n                          Go To Realtime\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.addAgent(mailAccount, $event)" translate="MAIL.AGENTADD_MAILACCOUNT">\n                          Add Agent To Email Account\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(mailAccount, $event)" translate="MAIL.DELETE_MAILACCOUNT">\n                          Delete Email Account\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailAccounts.count}}" md-on-paginate="vm.getMailAccounts" md-page-select></md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-mailAccount-button" ng-click="vm.createOrEditMailAccount($event)" aria-label="add mailAccount" translate translate-attr-aria-label="MAIL.ADD_MAILACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n\n</div>'),e.put("app/main/apps/mail/views/mailQueues/create/dialog.html",'<md-dialog class="mailQueue-dialog" aria-label="New MailQueue">\n  <form name="mailQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.mailQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newMailQueue">\n\n        <div class="hint"><span translate="MAIL.HELP.NAME"></span></div>\n        <div ng-messages="mailQueueForm[\'name\'].$error" ng-show="mailQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MAIL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.mailQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="mailQueueForm[\'strategy\'].$error" ng-show="mailQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.mailQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="mailQueueForm[\'timeout\'].$error" ng-show="mailQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailQueue.description">\n\n        <div ng-messages="mailQueueForm[\'description\'].$error" ng-show="mailQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailQueue" ng-click="vm.saveMailQueue()" class="send-button md-accent md-raised" ng-disabled="mailQueueForm.$invalid || mailQueueForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailQueue" ng-click="vm.addNewMailQueue()" class="send-button md-accent md-raised" ng-disabled="mailQueueForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILQUEUE" translate-attr-aria-label="MAIL.ADD_MAILQUEUE">\n          ADD MAILQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailQueue" ng-click="vm.deleteMailQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",'<md-dialog class="mailQueue-dialog" aria-label="mailQueue" ng-init="vm.onInit()">\n  <form name="mailQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MAIL.AGENTADD_MAILQUEUE">Add Agent to mailQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",'<md-dialog class="mailQueue-dialog" aria-label="mailQueue" ng-init="vm.onInit()">\n  <form name="mailQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MAIL.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailQueues/edit/view.html",'<div id="mail-mailQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-mailQueues-button md-icon-button" aria-label="Go to mailQueues" ng-click="vm.gotoMailQueues()" translate translate-attr-aria-label="MAIL.GO_TO_MAILQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="mailQueue-image" hide-xs>\n          <img ng-src="assets/images/business/mailQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.mailQueue.id}}\n            <span ng-if="vm.mailQueue.name">{{vm.mailQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MAIL.CREATED_AT"></span> <span>{{vm.mailQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.mailQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="MAIL.TEAMADD_MAILQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.mailQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="MAIL.AGENTADD_MAILQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveMailQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.mailQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="MAIL.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.mailQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.mailQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.mailQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/mail/views/mailQueues/mailQueues.html",'<div id="mailQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-email" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MAIL.MAILQUEUES">MailQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MAIL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMailQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMailQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MAIL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-mailQueues-count">\n          <span>{{vm.selectedMailQueues.length}}</span>\n          <span translate="MAIL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MAIL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMailQueues()" translate="MAIL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMailQueues()" translate="MAIL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMailQueues" csv-label="true" filename="mailQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMailQueues($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- MAILQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMailQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'MAIL.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.mailQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="mailQueue" md-select-id="id" ng-repeat="mailQueue in vm.mailQueues.rows">\n                <td md-cell ng-if="mailQueue.userpic"><img class="avatar" alt="{{mailQueue.name}}" ng-src="api/users/{{mailQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!mailQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{mailQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailQueue, ev) : vm.createOrEditMailQueue($event, mailQueue)" md-cell class="id ">{{mailQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailQueue, ev) : vm.createOrEditMailQueue($event, mailQueue)" md-cell class="name ">{{mailQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailQueue, ev) : vm.createOrEditMailQueue($event, mailQueue)" md-cell class="strategy ">{{ vm.arraystrategy[mailQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(mailQueue, $event    )" translate="MAIL.EDIT_MAILQUEUE">\n                          Edit MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(mailQueue, $event    )" translate="MAIL.TEAMADD_MAILQUEUE">\n                          teamadd MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(mailQueue, $event    )" translate="MAIL.AGENTADD_MAILQUEUE">\n                          agentadd MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(mailQueue, $event    )" translate="MAIL.DELETE_MAILQUEUE">\n                          Delete MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(mailQueue, $event    )" translate="MAIL.GOTOREALTIME_MAILQUEUE">\n                          goToRealtime MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailQueues.count}}" md-on-paginate="vm.getMailQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / MAILQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD MAILQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-mailQueue-button" ng-click="vm.createOrEditMailQueue($event)" aria-label="add mailQueue" translate translate-attr-aria-label="MAIL.ADD_MAILQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD MAILQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/mail/views/mailSubtatuses/create/dialog.html",'<md-dialog class="mailSubstatus-dialog" aria-label="New MailSubstatus">\n  <form name="mailSubstatusForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.mailSubstatus.name" ng-required="true" autofocus>\n\n        <div ng-messages="mailSubstatusForm[\'name\'].$error" ng-show="mailSubstatusForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailSubstatus.description">\n\n        <div ng-messages="mailSubstatusForm[\'description\'].$error" ng-show="mailSubstatusForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailSubstatus" ng-click="vm.saveMailSubstatus()" class="send-button md-accent md-raised" ng-disabled="mailSubstatusForm.$invalid || mailSubstatusForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailSubstatus" ng-click="vm.addNewMailSubstatus()" class="send-button md-accent md-raised" ng-disabled="mailSubstatusForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILSUBSTATUS" translate-attr-aria-label="MAIL.ADD_MAILSUBSTATUS">\n          ADD MAILSUBSTATUS\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailSubstatus" ng-click="vm.deleteMailSubstatus($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailSubtatuses/mailSubtatuses.html",'<div id="mailSubtatuses" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-email" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MAIL.MAILSUBSTATUSES">MailSubstatuses</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MAIL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMailSubstatuses.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMailSubstatuses =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MAIL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-mailSubtatuses-count">\n          <span>{{vm.selectedMailSubstatuses.length}}</span>\n          <span translate="MAIL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MAIL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMailSubstatuses()" translate="MAIL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMailSubstatuses()" translate="MAIL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMailSubstatuses" csv-label="true" filename="mailSubtatuses.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMailSubstatuses($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- MAILSUBSTATUS TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMailSubstatuses" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailSubstatuses">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'MAIL.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.mailSubtatuses.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="mailSubstatus" md-select-id="id" ng-repeat="mailSubstatus in vm.mailSubtatuses.rows">\n                <td md-cell ng-if="mailSubstatus.userpic"><img class="avatar" alt="{{mailSubstatus.name}}" ng-src="api/users/{{mailSubstatus.id}}/avatar" /></td>\n                <td md-cell ng-if="!mailSubstatus.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{mailSubstatus.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditMailSubstatus($event, mailSubstatus)" md-cell class="id ">{{mailSubstatus.id}}</td>\n                <td ng-click="vm.createOrEditMailSubstatus($event, mailSubstatus)" md-cell class="name ">{{mailSubstatus.name}}</td>\n                <td ng-click="vm.createOrEditMailSubstatus($event, mailSubstatus)" md-cell class="description ">{{mailSubstatus.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(mailSubstatus, $event    )" translate="MAIL.EDIT_MAILSUBSTATUS">\n                          Edit MailSubstatus\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(mailSubstatus, $event    )" translate="MAIL.DELETE_MAILSUBSTATUS">\n                          Delete MailSubstatus\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailSubtatuses.count}}" md-on-paginate="vm.getMailSubstatuses" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / MAILSUBSTATUS TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD MAILSUBSTATUS BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-mailSubstatus-button" ng-click="vm.createOrEditMailSubstatus($event)" aria-label="add mailSubstatus" translate translate-attr-aria-label="MAIL.ADD_MAILSUBSTATUS">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD MAILSUBSTATUS BUTTON --\x3e\n</div>'),e.put("app/main/apps/mail/views/realtime/accounts/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MAIL.ACCOUNTS">Accounts</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.vm.getMailAccounts()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- AGENT TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailAccounts">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate}}</th>\n        <th md-column>{{\'MAIL.KEY\' | translate}}</th>\n        <th md-column>{{\'MAIL.TOTAL\' | translate}}</th>\n        <th md-column>{{\'MAIL.IN\' | translate}}</th>\n        <th md-column>{{\'MAIL.OUT\' | translate}}</th>\n        <th md-column>{{\'MAIL.IMAP_STATUS\' | translate}}</th>\n        <th md-column>{{\'MAIL.SMTP_STATUS\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.mailAccounts">\n        <td md-cell colspan="4">\n          <div layout="row" layout-align="center center">\n            <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="vm.mailAccounts[value]" md-select-id="id" ng-repeat="(id, value) in vm.order">\n        <td md-cell>{{vm.mailAccounts[value].name}}</td>\n        <td md-cell>{{vm.mailAccounts[value].key}}</td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{(vm.mailAccounts[value].in || 0) + (vm.mailAccounts[value].out || 0)}}</span>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-down-bold blue-fg"></md-icon>\n            </span>\n            <span class="md-capture blue-fg">{{vm.mailAccounts[value].in || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.in">{{vm.mailAccounts[value].lastIn ?  (vm.mailAccounts[value].lastIn | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-up-bold green-fg"></md-icon>\n            </span>\n            <span class="md-capture green-fg">{{vm.mailAccounts[value].out || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.out">{{vm.mailAccounts[value].lastOut ?  (vm.mailAccounts[value].lastOut | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row" layout-align="start center">\n            <div layout="column" layout-align="center center">\n              <md-button class="md-icon-button" aria-label="Status">\n                <md-tooltip>{{vm.mailAccounts[value].Imap.messageStatus}}</md-tooltip>\n                <div ng-switch="vm.mailAccounts[value].Imap.status">\n                  <md-icon ng-switch-when="error" md-font-icon="icon-alert yellow-fg"></md-icon>\n                  <md-icon ng-switch-when="disabled" md-font-icon="icon-close grey-fg"></md-icon>\n                  <md-icon ng-switch-default md-font-icon="icon-checkbox-marked-circle-outline green-fg"></md-icon>\n                </div>\n              </md-button>\n              <span class="md-caption grey-fg">{{ (\'MAIL.\' + vm.mailAccounts[value].Imap.status.toUpperCase()) | translate}}</span>\n            </div>\n            <span class="text-boxed" ng-if="vm.mailAccounts[value].active && (vm.mailAccounts[value].Imap.lastSync && vm.mailAccounts[value].Imap.lastSync != \'\')">{{vm.mailAccounts[value].Imap.lastSync | date: \'shortTime\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row" layout-align="start center" ng-if="vm.mailAccounts[value].Smtp.status">\n            <div layout="column" layout-align="center center">\n              <md-button class="md-icon-button" aria-label="Status">\n                <md-tooltip>{{vm.mailAccounts[value].Smtp.messageStatus}}</md-tooltip>\n                <md-icon md-font-icon="{{ vm.mailAccounts[value].Smtp.status == \'error\' ? \'icon-alert yellow-fg\' : \'icon-checkbox-marked-circle-outline green-fg\'}}"></md-icon>\n              </md-button>\n              <span class="md-caption grey-fg">{{ (\'MAIL.\' + vm.mailAccounts[value].Smtp.status.toUpperCase()) | translate}}</span>\n            </div>\n            <span class="text-boxed">{{vm.mailAccounts[value].Smtp.lastSync | date: \'shortTime\'}}</span>\n          </div>\n          <span class="md-caption grey-fg" ng-if="!vm.mailAccounts[value].Smtp.status">{{ \'MAIL.NEVER_VERIFIED\' | translate }}</span>\n        </td>\n        <td md-cell class="actions">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-button ng-click="vm.goToMailAccount($event, vm.mailAccounts[value])" translate="MAIL.EDIT_ACCOUNT">\n                  Edit Account\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.verifySmtp($event, vm.mailAccounts[value])" translate="MAIL.VERIFY_SMTP">\n                  Verify Smtp\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getMailAccounts" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/mail/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MAIL.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n        <th md-column>{{ \'MAIL.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'MAIL.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'MAIL.WAITING\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedIn }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="MAIL.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="MAIL.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/mail/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.ACCOUNTS">Accounts</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/marketplace/views/plugins/create/dialog.html",'<md-dialog class="plugin-dialog" aria-label="New Plugin">\n  <form name="pluginForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.plugin.name" ng-required="true" autofocus>\n\n        <div ng-messages="pluginForm[\'name\'].$error" ng-show="pluginForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.TYPE">Type</label>\n        <input type="text" name="type" ng-model="vm.plugin.type" ng-disabled="!vm.newPlugin">\n\n        <div ng-messages="pluginForm[\'type\'].$error" ng-show="pluginForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.plugin.active" aria-label="Active" ng-disabled="!vm.newPlugin"><span translate="MARKETPLACE.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.plugin.description">\n\n        <div ng-messages="pluginForm[\'description\'].$error" ng-show="pluginForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.ICON">Icon</label>\n        <input type="text" name="icon" ng-model="vm.plugin.icon" ng-required="true">\n\n        <div ng-messages="pluginForm[\'icon\'].$error" ng-show="pluginForm[\'icon\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.ICON_REQUIRED">Icon field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.SIDEBAR">Sidebar</label>\n        <md-select name="sidebar" ng-model="vm.plugin.sidebar" required>\n          <md-option ng-value="\'always\'">Always</md-option>\n          <md-option ng-value="\'adminOnly\'">Admin Only</md-option>\n          <md-option ng-value="\'agentOnly\'">Agent Only</md-option>\n          <md-option ng-value="\'never\'">Never</md-option>\n        </md-select>\n        <div ng-messages="pluginForm[\'sidebar\'].$error" ng-show="pluginForm[\'sidebar\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.SIDEBAR_REQUIRED">Sidebar field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'adminOnly\'" class="md-block">\n        <label translate="MARKETPLACE.ADMINURL">AdminUrl</label>\n        <input type="text" name="adminUrl" ng-model="vm.plugin.adminUrl">\n\n        <div ng-messages="pluginForm[\'adminUrl\'].$error" ng-show="pluginForm[\'adminUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.ADMINURL_REQUIRED">AdminUrl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'agentOnly\'" class="md-block">\n        <label translate="MARKETPLACE.AGENTURL">AgentUrl</label>\n        <input type="text" name="agentUrl" ng-model="vm.plugin.agentUrl">\n\n        <div ng-messages="pluginForm[\'agentUrl\'].$error" ng-show="pluginForm[\'agentUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.AGENTURL_REQUIRED">AgentUrl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n        <label translate="MARKETPLACE.SCRIPTNAME">ScriptName</label>\n        <input type="text" name="scriptName" ng-model="vm.plugin.scriptName" ng-disabled="!vm.newPlugin">\n\n        <div ng-messages="pluginForm[\'scriptName\'].$error" ng-show="pluginForm[\'scriptName\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.SCRIPTNAME_REQUIRED">ScriptName field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n        <label translate="MARKETPLACE.SCRIPTPATH">ScriptPath</label>\n        <input type="text" name="scriptPath" ng-model="vm.plugin.scriptPath" ng-required="true">\n\n        <div ng-messages="pluginForm[\'scriptPath\'].$error" ng-show="pluginForm[\'scriptPath\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.SCRIPTPATH_REQUIRED">ScriptPath field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.VERSION">Version</label>\n        <input type="text" name="version" ng-model="vm.plugin.version" ng-disabled="!vm.newPlugin">\n\n        <div ng-messages="pluginForm[\'version\'].$error" ng-show="pluginForm[\'version\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.VERSION_REQUIRED">Version field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newPlugin" ng-click="vm.savePlugin()" class="send-button md-accent md-raised" ng-disabled="pluginForm.$invalid || pluginForm.$pristine" aria-label="SAVE" translate="MARKETPLACE.SAVE" translate-attr-aria-label="MARKETPLACE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newPlugin" ng-click="vm.addNewPlugin()" class="send-button md-accent md-raised" ng-disabled="pluginForm.$invalid" aria-label="ADD" translate="MARKETPLACE.ADD_PLUGIN" translate-attr-aria-label="MARKETPLACE.ADD_PLUGIN">\n          ADD PLUGIN\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newPlugin" ng-click="vm.deletePlugin($event)" aria-label="DELETE" translate translate-attr-aria-label="MARKETPLACE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MARKETPLACE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/marketplace/views/plugins/edit/view.html",'<div id="marketplace-plugin" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-plugins-button md-icon-button" aria-label="Go to plugins" ng-click="vm.gotoPlugins()" translate translate-attr-aria-label="MARKETPLACE.GO_TO_PLUGINS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="plugin-image" hide-xs>\n          <img ng-src="assets/images/business/plugins.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.plugin.id}}\n            <span ng-if="vm.plugin.name">{{vm.plugin.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MARKETPLACE.CREATED_AT"></span> <span>{{vm.plugin.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.savePlugin()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="MARKETPLACE.SAVE" translate-attr-aria-label="MARKETPLACE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MARKETPLACE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="plugin-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MARKETPLACE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.plugin.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.TYPE">Type</label>\n                <input type="text" name="type" ng-model="vm.plugin.type" disabled>\n\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.plugin.active" aria-label="Active" ng-disabled="true"><span translate="MARKETPLACE.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.plugin.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.ICON">Icon</label>\n                <input type="text" name="icon" ng-model="vm.plugin.icon" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'icon\'].$error" ng-show="generalForm[\'icon\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.ICON_REQUIRED">Icon field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.SIDEBAR">Sidebar</label>\n                <md-select name="sidebar" ng-model="vm.plugin.sidebar" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'always\'">Always</md-option>\n                  <md-option ng-value="\'adminOnly\'">Admin Only</md-option>\n                  <md-option ng-value="\'agentOnly\'">Agent Only</md-option>\n                  <md-option ng-value="\'never\'">Never</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'sidebar\'].$error" ng-show="generalForm[\'sidebar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.SIDEBAR_REQUIRED">Sidebar field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'adminOnly\'" class="md-block">\n                <label translate="MARKETPLACE.ADMINURL">AdminUrl</label>\n                <input type="text" name="adminUrl" ng-model="vm.plugin.adminUrl" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'adminUrl\'].$error" ng-show="generalForm[\'adminUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.ADMINURL_REQUIRED">AdminUrl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'agentOnly\'" class="md-block">\n                <label translate="MARKETPLACE.AGENTURL">AgentUrl</label>\n                <input type="text" name="agentUrl" ng-model="vm.plugin.agentUrl" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'agentUrl\'].$error" ng-show="generalForm[\'agentUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.AGENTURL_REQUIRED">AgentUrl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n                <label translate="MARKETPLACE.SCRIPTNAME">ScriptName</label>\n                <input type="text" name="scriptName" ng-model="vm.plugin.scriptName" disabled>\n\n                <div ng-messages="generalForm[\'scriptName\'].$error" ng-show="generalForm[\'scriptName\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.SCRIPTNAME_REQUIRED">ScriptName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n                <label translate="MARKETPLACE.SCRIPTPATH">ScriptPath</label>\n                <input type="text" name="scriptPath" ng-model="vm.plugin.scriptPath" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'scriptPath\'].$error" ng-show="generalForm[\'scriptPath\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.SCRIPTPATH_REQUIRED">ScriptPath field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.VERSION">Version</label>\n                <input type="text" name="version" ng-model="vm.plugin.version" disabled>\n\n                <div ng-messages="generalForm[\'version\'].$error" ng-show="generalForm[\'version\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.VERSION_REQUIRED">Version field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/marketplace/views/plugins/plugins.html",'<div id="plugins" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MARKETPLACE.PLUGINS">Plugins</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MARKETPLACE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedPlugins.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedPlugins =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MARKETPLACE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-plugins-count">\n          <span>{{vm.selectedPlugins.length}}</span>\n          <span translate="MARKETPLACE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MARKETPLACE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllPlugins()" translate="MARKETPLACE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectPlugins()" translate="MARKETPLACE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedPlugins" csv-label="true" filename="plugins.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedPlugins($event)" aria-label="delete selected" translate translate-attr-label="MARKETPLACE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      <div ng-if="vm.installing">\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="column" layout-align="center center">\n            <span class="md-title md-accent-fg padding-20 text-bold" translate="MARKETPLACE.INSTALLING">Installing</span>\n            <md-progress-linear md-mode="indeterminate" class="md-accent padding-20"></md-progress-linear>\n          </div>\n        </md-card>\n      </div>\n\n      \x3c!-- PLUGIN TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedPlugins" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getPlugins">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="name">{{ \'MARKETPLACE.NAME\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'MARKETPLACE.TYPE\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'MARKETPLACE.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'MARKETPLACE.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="version">{{ \'MARKETPLACE.VERSION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.plugins.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MARKETPLACE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="plugin" md-select-id="id" ng-repeat="plugin in vm.plugins.rows">\n                <td md-cell ng-if="plugin.userpic"><img class="avatar" alt="{{plugin.name}}" ng-src="api/users/{{plugin.id}}/avatar" /></td>\n                <td md-cell ng-if="!plugin.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{plugin.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="name ">{{plugin.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="type ">{{plugin.type}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{plugin.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{plugin.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="description ">{{plugin.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="version ">{{plugin.version}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MARKETPLACE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && !plugin.active">\n\n                        <md-button ng-click="vm.installplugin(plugin, $event    )" translate="MARKETPLACE.INSTALL_PLUGIN">\n                          Install Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(plugin, $event    )" translate="MARKETPLACE.EDIT_PLUGIN">\n                          Edit Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active && plugin.type == \'script\'">\n\n                        <md-button ng-click="vm.stopplugin(plugin, $event    )" translate="MARKETPLACE.STOP_PLUGIN">\n                          Stop Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active && plugin.type == \'script\'">\n\n                        <md-button ng-click="vm.restartplugin(plugin, $event    )" translate="MARKETPLACE.RESTART_PLUGIN">\n                          Restart Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.downloadfile2(plugin, $event  , \'plugins\'   )" translate="MARKETPLACE.DOWNLOAD_PLUGIN">\n                          Download Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active">\n\n                        <md-button ng-click="vm.uninstallplugin(plugin, $event    )" translate="MARKETPLACE.UNINSTALL_PLUGIN">\n                          Uninstall Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(plugin, $event    )" translate="MARKETPLACE.DELETE_PLUGIN">\n                          Delete Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MARKETPLACE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MARKETPLACE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MARKETPLACE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.plugins.count}}" md-on-paginate="vm.getPlugins" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PLUGIN TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- UPLOAD PLUGIN BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="upload-plugin-button" ng-click="vm.uploadPlugin($event)" aria-label="upload plugin" translate translate-attr-aria-label="MARKETPLACE.UPLOAD_PLUGIN">\n    <md-icon md-font-icon="icon-upload"></md-icon>\n  </md-button>\n  \x3c!-- / UPLOAD PLUGIN BUTTON --\x3e\n</div>'),e.put("app/main/apps/marketplace/views/plugins/upload/dialog.html",'<md-dialog class="upload-dialog" aria-label="Upload ">\n  <form name="uploadForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div id="plugin-uploader" ng-hide="vm.uploadState == \'uploading\'" flow-init="vm.ngFlowOptions" flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)" flow-error="vm.uploadError($file, $message)" flow-complete="vm.uploadComplete()" flow-drop flow-drag-enter="vm.dropping=true" flow-drag-leave="vm.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n        <div class="drop-text hint-text" layout="row" layout-align="center center">\n          <span translate="MARKETPLACE.DROP_TO_UPLOAD">Drop to upload</span>\n        </div>\n\n        <div class="upload-button" layout="column" layout-align="center center">\n          <md-button class="md-accent md-raised" flow-btn>\n            Upload\n          </md-button>\n          <span class="secondary-text mt-8" translate="MARKETPLACE.DROP_TO_UPLOAD_MESSAGE">You can also drop your file here to upload.</span>\n        </div>\n      </div>\n\n      <div layout="column" layout-align="space-between center" ng-show="vm.uploadState == \'uploading\'">\n        <div>\n          <span translate="MARKETPLACE.UPLOADING">Uploading</span>\n          <span>{{vm.plugin.file.name}}</span>\n        </div>\n        <md-progress-linear md-mode="indeterminate"></md-progress-linear>\n      </div>\n\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center"></div>\n      <div layout="row">\n        <md-button ng-click="vm.closeDialog()" ng-hide="vm.uploadState == \'uploading\'" class="md-accent md-raised" aria-label="FINISH" translate="MARKETPLACE.FINISH" translate-attr-aria-label="MARKETPLACE.FINISH">\n          FINISH\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/hopperdate/hopperdate.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content ms-scroll>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <label translate="MOTIONDIALER.SCHEDULEDAT">ScheduledAt</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" ng-change="vm.recalcTZTime()" mdp-format="YYYY-MM-DD" ng-model="vm.dateTime">\n              <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" ng-change="vm.recalcTZTime()" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.dateTime">\n              <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n\n        </md-content>\n      </div>\n      <md-input-container class="md-block">\n        <div layout="row">\n          <div flex class="md-block">\n            <md-input-container class="md-block" flex-gt-sm="">\n              <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n              <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" ng-change="vm.recalcTZTime()" autofocus>\n            </md-input-container>\n          </div>\n          <div flex class="md-block">\n            <md-input-container class="md-block">\n              <label translate="DASHBOARDS.SYSTEM_TIME">System time</label>\n              <input type="text" readonly value="{{vm.hopper.scheduledat}}">\n            </md-input-container>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.PRIORITY">Priority</label>\n        <md-select name="priority" ng-model="vm.hopper.priority">\n          <md-option ng-value="\'4\'">Highest</md-option>\n          <md-option ng-value="\'3\'">High</md-option>\n          <md-option ng-value="\'2\'">Medium</md-option>\n          <md-option ng-value="\'1\'">Low</md-option>\n          <md-option ng-value="\'0\'">Lowest</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PRIORITY"></span></div>\n        <div ng-messages="hopperForm[\'priority\'].$error" ng-show="hopperForm[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.hopper.recallme" aria-label="RecallAgent"><span translate="MOTIONDIALER.RECALLAGENT">RecallAgent</span></md-switch>\n\n      </md-input-container>\n      <md-input-container ng-if="vm.hopper.recallme" class="md-block">\n        <label translate="MOTIONDIALER.AGENT">Agent</label>\n        <md-select name="UserId" ng-model="vm.hopper.UserId" required>\n          <md-option ng-value="UserId.id" ng-repeat="UserId in vm.agents" ng-disabled="UserId.canSelect === false">{{ UserId.name }}</md-option>\n        </md-select>\n        <div ng-messages="hopperForm[\'UserId\'].$error" ng-show="hopperForm[\'UserId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_HOPPER" translate-attr-aria-label="MOTIONDIALER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/create/dialog.html",'<md-dialog class="ivrCampaign-dialog" aria-label="New IvrCampaign">\n  <form name="ivrCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.ivrCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newIvrCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="ivrCampaignForm[\'name\'].$error" ng-show="ivrCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.ivrCampaign.active" aria-label="Active"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n        <md-select name="TrunkId" ng-model="vm.ivrCampaign.TrunkId" required>\n          <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'TrunkId\'].$error" ng-show="ivrCampaignForm[\'TrunkId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n        <md-select name="IntervalId" ng-model="vm.ivrCampaign.IntervalId" required>\n          <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'IntervalId\'].$error" ng-show="ivrCampaignForm[\'IntervalId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n        <md-select name="dialCheckDuplicateType" ng-model="vm.ivrCampaign.dialCheckDuplicateType" required>\n\n          <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n          <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n          <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'dialCheckDuplicateType\'].$error" ng-show="ivrCampaignForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CALLYSQUAREPROJECT">CallySquareProject</label>\n        <md-select name="SquareProjectId" ng-model="vm.ivrCampaign.SquareProjectId" required>\n          <md-option ng-value="SquareProjectId.id" ng-repeat="SquareProjectId in vm.projects" ng-disabled="SquareProjectId.canSelect === false">{{ SquareProjectId.name }}</md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'SquareProjectId\'].$error" ng-show="ivrCampaignForm[\'SquareProjectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT_REQUIRED">CallySquareProject field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CONCURRENTCALLS">ConcurrentCalls</label>\n        <input type="number" name="limitCalls" ng-model="vm.ivrCampaign.limitCalls" min="1" max="200" value="30" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.CONCURRENTCALLS"></span></div>\n        <div ng-messages="ivrCampaignForm[\'limitCalls\'].$error" ng-show="ivrCampaignForm[\'limitCalls\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_REQUIRED">ConcurrentCalls field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>200</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.ivrCampaign.description">\n\n        <div ng-messages="ivrCampaignForm[\'description\'].$error" ng-show="ivrCampaignForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newIvrCampaign" ng-click="vm.saveIvrCampaign()" class="send-button md-accent md-raised" ng-disabled="ivrCampaignForm.$invalid || ivrCampaignForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newIvrCampaign" ng-click="vm.addNewIvrCampaign()" class="send-button md-accent md-raised" ng-disabled="ivrCampaignForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_IVRCAMPAIGN" translate-attr-aria-label="MOTIONDIALER.ADD_IVRCAMPAIGN">\n          ADD IVRCAMPAIGN\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newIvrCampaign" ng-click="vm.deleteIvrCampaign($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",'<md-dialog class="ivrCampaign-dialog" aria-label="ivrCampaign" ng-init="vm.onInit()">\n  <form name="ivrCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.BLACKLISTADD_IVRCAMPAIGN">Add List in IVRCAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",'<md-dialog class="ivrCampaign-dialog" aria-label="Clone IvrCampaign">\n  <form name="ivrCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.ivrCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newIvrCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="ivrCampaignForm[\'name\'].$error" ng-show="ivrCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneIvrCampaign()" class="send-button md-accent md-raised" ng-disabled="ivrCampaignForm.$invalid" aria-label="CLONE" translate="MOTIONDIALER.CLONE_IVRCAMPAIGN" translate-attr-aria-label="MOTIONDIALER.CLONE_IVRCAMPAIGN">\n        CLONE IVRCAMPAIGN\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/hoppers/dialog.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <label translate="MOTIONDIALER.SCHEDULEDAT">ScheduledAt</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n              <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n              <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.PRIORITY">Priority</label>\n        <md-select name="priority" ng-model="vm.hopper.priority">\n          <md-option ng-value="\'4\'">Highest</md-option>\n          <md-option ng-value="\'3\'">High</md-option>\n          <md-option ng-value="\'2\'">Medium</md-option>\n          <md-option ng-value="\'1\'">Low</md-option>\n          <md-option ng-value="\'0\'">Lowest</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PRIORITY"></span></div>\n        <div ng-messages="hopperForm[\'priority\'].$error" ng-show="hopperForm[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_HOPPER" translate-attr-aria-label="MOTIONDIALER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",'<md-dialog class="ivrCampaign-dialog" aria-label="ivrCampaign" ng-init="vm.onInit()">\n  <form name="ivrCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.LISTADD_IVRCAMPAIGN">Add List in IVRCAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/resetlist/resetlist.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.RESETLIST ">Reset List</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-disabled="vm.loading" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-hide="vm.loading">\n      <div layout="row" layout-wrap flex>\n        <div flex-xs flex="50">\n          <md-checkbox aria-label="Select All" ng-checked="vm.isChecked()" md-indeterminate="vm.isIndeterminate()" ng-click="vm.toggleAll()">\n            <span ng-if="vm.isChecked()" translate="MOTIONDIALER.UNSELECTALL"></span>\n            <span ng-if="!vm.isChecked()" translate="MOTIONDIALER.SELECTALL"></span>\n          </md-checkbox>\n        </div>\n        <div flex-xs flex="50">\n        </div>\n        <div flex="{{vm.items.length > 10 ? 50 : 100 }}" ng-repeat="item in vm.items">\n          <md-checkbox ng-checked="vm.exists(item, vm.selected)" ng-click="vm.toggle(item, vm.selected)">\n            {{ item.name | limitTo:40 }}\n          </md-checkbox>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions ng-hide="vm.loading" layout="row" layout-align="end center">\n      <div>\n      </div>\n      <md-button type="submit" ng-click="vm.listSelected()" class="send-button md-accent md-raised" ng-disabled="vm.loading" aria-label="RESET" translate="MOTIONDIALER.RESET" translate-attr-aria-label="MOTIONDIALER.RESET">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n    <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n      <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n    </div>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/view.html",'<div id="motiondialer-ivrCampaign" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-ivrCampaigns-button md-icon-button" aria-label="Go to ivrCampaigns" ng-click="vm.gotoIvrCampaigns()" translate translate-attr-aria-label="MOTIONDIALER.GO_TO_IVRCAMPAIGNS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="ivrCampaign-image" hide-xs>\n          <img ng-src="assets/images/business/ivrCampaigns.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.ivrCampaign.id}}\n            <span ng-if="vm.ivrCampaign.name">{{vm.ivrCampaign.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MOTIONDIALER.CREATED_AT"></span> <span>{{vm.ivrCampaign.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.ivrCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="MOTIONDIALER.CLONE_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.listadddialog(vm.ivrCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="listadd">\n        <md-tooltip><span translate="MOTIONDIALER.LISTADD_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-format-list-numbers"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.blacklistadddialog(vm.ivrCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="blacklistadd">\n        <md-tooltip><span translate="MOTIONDIALER.BLACKLISTADD_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-block-helper"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.resetlistdialog(vm.ivrCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="resetlist">\n        <md-tooltip><span translate="MOTIONDIALER.RESETLIST_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-restore"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.ivrCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="MOTIONDIALER.GOTO_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveIvrCampaign()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (campaignForm.$invalid) || (originateForm.$invalid) || (globalForm.$invalid) || (congestionForm.$invalid) || (busyForm.$invalid) || (noanswerForm.$invalid) || (nosuchnumberForm.$invalid) || (dropForm.$invalid) || (abandonedForm.$invalid) || (machineForm.$invalid) || (agentrejectForm.$invalid) || (advancedForm.$invalid) || (globalintervalForm.$invalid) || (timezoneForm.$invalid) || (amdForm.$invalid) || (hopperStatisticsForm.$invalid) || (hoppersForm.$invalid) || (hopperHistoriesForm.$invalid) || (hopperFinalsForm.$invalid) || (hopperBlacksForm.$invalid)" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.ivrCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.ivrCampaign.active" aria-label="Active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n                <md-select name="TrunkId" ng-model="vm.ivrCampaign.TrunkId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkId\'].$error" ng-show="generalForm[\'TrunkId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BACKUPTRUNK">BackupTrunk</label>\n                <md-select name="TrunkBackupId" ng-model="vm.ivrCampaign.TrunkBackupId" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="TrunkBackupId.id" ng-repeat="TrunkBackupId in vm.trunks" ng-disabled="TrunkBackupId.canSelect === false">{{ TrunkBackupId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkBackupId\'].$error" ng-show="generalForm[\'TrunkBackupId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BACKUPTRUNK_REQUIRED">BackupTrunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n                <md-select name="IntervalId" ng-model="vm.ivrCampaign.IntervalId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'IntervalId\'].$error" ng-show="generalForm[\'IntervalId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n                <md-select name="dialCheckDuplicateType" ng-model="vm.ivrCampaign.dialCheckDuplicateType" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n                  <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'dialCheckDuplicateType\'].$error" ng-show="generalForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CUTDIGIT">CutDigit</label>\n                <input type="number" name="dialCutDigit" ng-model="vm.ivrCampaign.dialCutDigit" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'dialCutDigit\'].$error" ng-show="generalForm[\'dialCutDigit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_REQUIRED">CutDigit field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_LESS_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.ivrCampaign.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container campaign md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</div>\n            </div>\n            <form name="campaignForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECT">CallySquareProject</label>\n                <md-select name="SquareProjectId" ng-model="vm.ivrCampaign.SquareProjectId" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="SquareProjectId.id" ng-repeat="SquareProjectId in vm.projects" ng-disabled="SquareProjectId.canSelect === false">{{ SquareProjectId.name }}</md-option>\n                </md-select>\n                <div ng-messages="campaignForm[\'SquareProjectId\'].$error" ng-show="campaignForm[\'SquareProjectId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT_REQUIRED">CallySquareProject field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONCURRENTCALLS">ConcurrentCalls</label>\n                <input type="number" name="limitCalls" ng-model="vm.ivrCampaign.limitCalls" min="1" max="200" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONCURRENTCALLS"></span></div>\n                <div ng-messages="campaignForm[\'limitCalls\'].$error" ng-show="campaignForm[\'limitCalls\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_REQUIRED">ConcurrentCalls field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>200</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container originate md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ORIGINATE">ORIGINATE</div>\n            </div>\n            <form name="originateForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNAME">OriginateCallerIdName</label>\n                <input type="text" name="dialOriginateCallerIdName" ng-model="vm.ivrCampaign.dialOriginateCallerIdName" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNAME"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdName\'].$error" ng-show="originateForm[\'dialOriginateCallerIdName\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNAME_REQUIRED">OriginateCallerIdName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNUMBER">OriginateCallerIdNumber</label>\n                <input type="text" name="dialOriginateCallerIdNumber" ng-model="vm.ivrCampaign.dialOriginateCallerIdNumber" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdNumber\'].$error" ng-show="originateForm[\'dialOriginateCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNUMBER_REQUIRED">OriginateCallerIdNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.RANDOMLASTDIGITCALLERIDNUMBER">RandomLastDigitCallerIdNumber</label>\n                <input type="number" name="dialRandomLastDigitCallerIdNumber" ng-model="vm.ivrCampaign.dialRandomLastDigitCallerIdNumber" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RANDOMLASTDIGITCALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$error" ng-show="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_REQUIRED">RandomLastDigitCallerIdNumber field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_LESS_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATETIMEOUT">OriginateTimeout</label>\n                <input type="number" name="dialOriginateTimeout" ng-model="vm.ivrCampaign.dialOriginateTimeout" min="1" max="999" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATETIMEOUT"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateTimeout\'].$error" ng-show="originateForm[\'dialOriginateTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_REQUIRED">OriginateTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.PREFIX">Prefix</label>\n                <input type="text" name="dialPrefix" ng-model="vm.ivrCampaign.dialPrefix" ng-pattern="/^\\d+$/" value="" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREFIX"></span></div>\n                <div ng-messages="originateForm[\'dialPrefix\'].$error" ng-show="originateForm[\'dialPrefix\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_MUST_VALID_PATTERN" translate-values="{ regex: \'/^\\d+$/\' }">Prefix must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.RETRYANDFREQUENCY">RETRYANDFREQUENCY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container global md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBAL">GLOBAL</div>\n            </div>\n            <form name="globalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALMAXRETRY">GlobalMaxRetry</label>\n                <input type="number" name="dialGlobalMaxRetry" ng-model="vm.ivrCampaign.dialGlobalMaxRetry" min="1" max="999" value="4" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALMAXRETRY"></span></div>\n                <div ng-messages="globalForm[\'dialGlobalMaxRetry\'].$error" ng-show="globalForm[\'dialGlobalMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_REQUIRED">GlobalMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container congestion md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CONGESTION">CONGESTION</div>\n            </div>\n            <form name="congestionForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONMAXRETRY">CongestionMaxRetry</label>\n                <input type="number" name="dialCongestionMaxRetry" ng-model="vm.ivrCampaign.dialCongestionMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONMAXRETRY"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionMaxRetry\'].$error" ng-show="congestionForm[\'dialCongestionMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_REQUIRED">CongestionMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONRETRYTIME">CongestionRetryTime</label>\n                <input type="number" name="dialCongestionRetryFrequency" ng-model="vm.ivrCampaign.dialCongestionRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONRETRYTIME"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionRetryFrequency\'].$error" ng-show="congestionForm[\'dialCongestionRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_REQUIRED">CongestionRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container busy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.BUSY">BUSY</div>\n            </div>\n            <form name="busyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYMAXRETRY">BusyMaxRetry</label>\n                <input type="number" name="dialBusyMaxRetry" ng-model="vm.ivrCampaign.dialBusyMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYMAXRETRY"></span></div>\n                <div ng-messages="busyForm[\'dialBusyMaxRetry\'].$error" ng-show="busyForm[\'dialBusyMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_REQUIRED">BusyMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYRETRYTIME">BusyRetryTime</label>\n                <input type="number" name="dialBusyRetryFrequency" ng-model="vm.ivrCampaign.dialBusyRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYRETRYTIME"></span></div>\n                <div ng-messages="busyForm[\'dialBusyRetryFrequency\'].$error" ng-show="busyForm[\'dialBusyRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_REQUIRED">BusyRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container noanswer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOANSWER">NOANSWER</div>\n            </div>\n            <form name="noanswerForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERMAXRETRY">NoAnswerMaxRetry</label>\n                <input type="number" name="dialNoAnswerMaxRetry" ng-model="vm.ivrCampaign.dialNoAnswerMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERMAXRETRY"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerMaxRetry\'].$error" ng-show="noanswerForm[\'dialNoAnswerMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_REQUIRED">NoAnswerMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERRETRYTIME">NoAnswerRetryTime</label>\n                <input type="number" name="dialNoAnswerRetryFrequency" ng-model="vm.ivrCampaign.dialNoAnswerRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERRETRYTIME"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerRetryFrequency\'].$error" ng-show="noanswerForm[\'dialNoAnswerRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_REQUIRED">NoAnswerRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container nosuchnumber md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOSUCHNUMBER">NOSUCHNUMBER</div>\n            </div>\n            <form name="nosuchnumberForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERMAXRETRY">NoSuchNumberMaxRetry</label>\n                <input type="number" name="dialNoSuchNumberMaxRetry" ng-model="vm.ivrCampaign.dialNoSuchNumberMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERMAXRETRY"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_REQUIRED">NoSuchNumberMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERRETRYTIME">NoSuchNumberRetryTime</label>\n                <input type="number" name="dialNoSuchNumberRetryFrequency" ng-model="vm.ivrCampaign.dialNoSuchNumberRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERRETRYTIME"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_REQUIRED">NoSuchNumberRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container drop md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.DROP">DROP</div>\n            </div>\n            <form name="dropForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPMAXRETRY">DropMaxRetry</label>\n                <input type="number" name="dialDropMaxRetry" ng-model="vm.ivrCampaign.dialDropMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPMAXRETRY"></span></div>\n                <div ng-messages="dropForm[\'dialDropMaxRetry\'].$error" ng-show="dropForm[\'dialDropMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_REQUIRED">DropMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPRETRYTIME">DropRetryTime</label>\n                <input type="number" name="dialDropRetryFrequency" ng-model="vm.ivrCampaign.dialDropRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPRETRYTIME"></span></div>\n                <div ng-messages="dropForm[\'dialDropRetryFrequency\'].$error" ng-show="dropForm[\'dialDropRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_REQUIRED">DropRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container abandoned md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ABANDONED">ABANDONED</div>\n            </div>\n            <form name="abandonedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDMAXRETRY">AbandonedMaxRetry</label>\n                <input type="number" name="dialAbandonedMaxRetry" ng-model="vm.ivrCampaign.dialAbandonedMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDMAXRETRY"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedMaxRetry\'].$error" ng-show="abandonedForm[\'dialAbandonedMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_REQUIRED">AbandonedMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDRETRYTIME">AbandonedRetryTime</label>\n                <input type="number" name="dialAbandonedRetryFrequency" ng-model="vm.ivrCampaign.dialAbandonedRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDRETRYTIME"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedRetryFrequency\'].$error" ng-show="abandonedForm[\'dialAbandonedRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_REQUIRED">AbandonedRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container machine md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.MACHINE">MACHINE</div>\n            </div>\n            <form name="machineForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINEMAXRETRY">MachineMaxRetry</label>\n                <input type="number" name="dialMachineMaxRetry" ng-model="vm.ivrCampaign.dialMachineMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINEMAXRETRY"></span></div>\n                <div ng-messages="machineForm[\'dialMachineMaxRetry\'].$error" ng-show="machineForm[\'dialMachineMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_REQUIRED">MachineMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINERETRYTIME">MachineRetryTime</label>\n                <input type="number" name="dialMachineRetryFrequency" ng-model="vm.ivrCampaign.dialMachineRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINERETRYTIME"></span></div>\n                <div ng-messages="machineForm[\'dialMachineRetryFrequency\'].$error" ng-show="machineForm[\'dialMachineRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_REQUIRED">MachineRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container agentreject md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AGENTREJECT">AGENTREJECT</div>\n            </div>\n            <form name="agentrejectForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTMAXRETRY">AgentRejectMaxRetry</label>\n                <input type="number" name="dialAgentRejectMaxRetry" ng-model="vm.ivrCampaign.dialAgentRejectMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTMAXRETRY"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectMaxRetry\'].$error" ng-show="agentrejectForm[\'dialAgentRejectMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_REQUIRED">AgentRejectMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTRETRYTIME">AgentRejectRetryTime</label>\n                <input type="number" name="dialAgentRejectRetryFrequency" ng-model="vm.ivrCampaign.dialAgentRejectRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTRETRYTIME"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$error" ng-show="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_REQUIRED">AgentRejectRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALORDERBYSCHEDULEDAT">DialOrderByScheduledAt</label>\n                <md-select name="dialOrderByScheduledAt" ng-model="vm.ivrCampaign.dialOrderByScheduledAt" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'DESC\'"> {{ \'MOTIONDIALER.DESC\' | translate }} </md-option>\n\n                  <md-option ng-value="\'ASC\'"> {{ \'MOTIONDIALER.ASC\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALORDERBYSCHEDULEDAT"></span></div>\n                <div ng-messages="advancedForm[\'dialOrderByScheduledAt\'].$error" ng-show="advancedForm[\'dialOrderByScheduledAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALORDERBYSCHEDULEDAT_REQUIRED">DialOrderByScheduledAt field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container globalinterval md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBALINTERVAL">GLOBALINTERVAL</div>\n            </div>\n            <form name="globalintervalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALINTERVAL">GlobalInterval</label>\n                <input type="text" name="dialGlobalInterval" ng-model="vm.ivrCampaign.dialGlobalInterval" value="07:00-22:00,*,*,*" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALINTERVAL"></span></div>\n                <div ng-messages="globalintervalForm[\'dialGlobalInterval\'].$error" ng-show="globalintervalForm[\'dialGlobalInterval\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALINTERVAL_REQUIRED">GlobalInterval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container timezone md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.TIMEZONE">TIMEZONE</div>\n            </div>\n            <form name="timezoneForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TIMEZONE">Timezone</label>\n                <ms-timezone name="dialTimezone" ng-model="vm.ivrCampaign.dialTimezone" autofocus ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEZONE"></span></div>\n                <div ng-messages="timezoneForm[\'dialTimezone\'].$error" ng-show="timezoneForm[dialTimezone].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container amd md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AMD">AMD</div>\n            </div>\n            <form name="amdForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.ivrCampaign.dialAMDActive" aria-label="AMDActive" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AMDACTIVE">AMDActive</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDACTIVE"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDINITIALSILENCE">AMDInitialSilence</label>\n                <input type="number" name="dialAMDInitialSilence" ng-model="vm.ivrCampaign.dialAMDInitialSilence" min="0" value="2500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDINITIALSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDInitialSilence\'].$error" ng-show="amdForm[\'dialAMDInitialSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_REQUIRED">AMDInitialSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDInitialSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDGREETING">AMDGreeting</label>\n                <input type="number" name="dialAMDGreeting" ng-model="vm.ivrCampaign.dialAMDGreeting" min="0" value="1500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDGREETING"></span></div>\n                <div ng-messages="amdForm[\'dialAMDGreeting\'].$error" ng-show="amdForm[\'dialAMDGreeting\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_REQUIRED">AMDGreeting field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDGreeting must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDAFTERGREETINGSILENCE">AMDAfterGreetingSilence</label>\n                <input type="number" name="dialAMDAfterGreetingSilence" ng-model="vm.ivrCampaign.dialAMDAfterGreetingSilence" min="0" value="800" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDAFTERGREETINGSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDAfterGreetingSilence\'].$error" ng-show="amdForm[\'dialAMDAfterGreetingSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_REQUIRED">AMDAfterGreetingSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDAfterGreetingSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDTOTALANALYSISTIME">AMDTotalAnalysisTime</label>\n                <input type="number" name="dialAMDTotalAnalysisTime" ng-model="vm.ivrCampaign.dialAMDTotalAnalysisTime" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDTOTALANALYSISTIME"></span></div>\n                <div ng-messages="amdForm[\'dialAMDTotalAnalysisTime\'].$error" ng-show="amdForm[\'dialAMDTotalAnalysisTime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_REQUIRED">AMDTotalAnalysisTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDTotalAnalysisTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMINWORDLENGTH">AMDMinWordLength</label>\n                <input type="number" name="dialAMDMinWordLength" ng-model="vm.ivrCampaign.dialAMDMinWordLength" min="0" value="100" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMINWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMinWordLength\'].$error" ng-show="amdForm[\'dialAMDMinWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_REQUIRED">AMDMinWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMinWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDBETWEENWORDSSILENCE">AMDBetweenWordsSilence</label>\n                <input type="number" name="dialAMDBetweenWordsSilence" ng-model="vm.ivrCampaign.dialAMDBetweenWordsSilence" min="0" value="50" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDBETWEENWORDSSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDBetweenWordsSilence\'].$error" ng-show="amdForm[\'dialAMDBetweenWordsSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_REQUIRED">AMDBetweenWordsSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDBetweenWordsSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMNUMBEROFWORDS">AMDMaximumNumberOfWords</label>\n                <input type="number" name="dialAMDMaximumNumberOfWords" ng-model="vm.ivrCampaign.dialAMDMaximumNumberOfWords" min="0" value="3" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMNUMBEROFWORDS"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumNumberOfWords\'].$error" ng-show="amdForm[\'dialAMDMaximumNumberOfWords\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_REQUIRED">AMDMaximumNumberOfWords field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumNumberOfWords must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDSILENCETHRESHOLD">AMDSilenceThreshold</label>\n                <input type="number" name="dialAMDSilenceThreshold" ng-model="vm.ivrCampaign.dialAMDSilenceThreshold" min="0" max="32767" value="256" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDSILENCETHRESHOLD"></span></div>\n                <div ng-messages="amdForm[\'dialAMDSilenceThreshold\'].$error" ng-show="amdForm[\'dialAMDSilenceThreshold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_REQUIRED">AMDSilenceThreshold field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_LESS_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>32767</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMWORDLENGTH">AMDMaximumWordLength</label>\n                <input type="number" name="dialAMDMaximumWordLength" ng-model="vm.ivrCampaign.dialAMDMaximumWordLength" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumWordLength\'].$error" ng-show="amdForm[\'dialAMDMaximumWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_REQUIRED">AMDMaximumWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HOPPERS">HOPPERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperstatistics md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperStatisticsController as vm_hs" ng-init="vm_hs.init(vm.ivrCampaign)">\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERWIDGET">Hoppers</span>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_hs.init(vm.ivrCampaign)" aria-label="refresh Hopper" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              \x3c!-- WIDGET GROUP --\x3e\n              <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n                \x3c!-- WIDGET 1 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{(vm_hs.total || 0) + (vm_hs.closed || 0)}}</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.TOTAL\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 1 --\x3e\n\n                \x3c!-- WIDGET 2 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.fresh || 0}} ({{vm_hs.total ? ((((vm_hs.fresh || 0) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.FRESH\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 2 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.total ? (vm_hs.total - (vm_hs.fresh || 0)) : 0}} ({{vm_hs.total ? ((((vm_hs.total - (vm_hs.fresh || 0)) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.OPEN\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.closed ? (vm_hs.closed || 0) : 0}} ({{vm_hs.closed ? ((((vm_hs.closed) * 100)/(vm_hs.closed + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.CLOSED\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n              </div>\n              \x3c!-- / WIDGET GROUP --\x3e\n            </div>\n\n          </div>\n          <div class="ivrCampaign-detail-form-container hoppers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHoppersController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERS">Hoppers</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHoppers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getIvrCampaignHoppers()" aria-label="refresh Hoppers" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHoppers.length}} {{vm_dc.selectedIvrCampaignHoppers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHoppers" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedIvrCampaignHoppers($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHoppers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHoppers">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="priority">\n                        {{ \'MOTIONDIALER.PRIORITY\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopper" md-select-id="id" ng-repeat="hopper in vm_dc.ivrCampaignHoppers.rows">\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.ContactId}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell privacy ng-cloak>\n                        {{hopper.phone}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countcongestionretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countbusyretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnoanswerretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnosuchnumberretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countdropretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countabandonedretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countmachineretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countagentrejectretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{ hopper.scheduledat | formatdate }}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{ vm_dc.arraypriority[hopper.priority].option }} </td>\n\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" translate="MOTIONDIALER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(hopper, $event)" translate="MOTIONDIALER.DELETE_HOPPER">\n                                Delete Hopper\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHoppers.rows.length">\n                      <td md-cell colspan="15">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPER_AVAILABLE">No hopper available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHoppers.count}}" md-on-paginate="vm_dc.getIvrCampaignHoppers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HISTORY">HISTORY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperhistories md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperHistoriesController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERHISTORIES">HopperHistories</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHopperHistories()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getIvrCampaignHopperHistories()" aria-label="refresh HopperHistories" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERHISTORIES">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHopperHistories.length}} {{vm_dc.selectedIvrCampaignHopperHistories.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHopperHistories" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHopperHistories" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHopperHistories">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperHistory" md-select-id="id" ng-repeat="hopperHistory in vm_dc.ivrCampaignHopperHistories.rows">\n                      <td md-cell>\n                        {{hopperHistory.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.scheduledat | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.endtime | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHopperHistories.rows.length">\n                      <td md-cell colspan="11">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERHISTORY_AVAILABLE">No hopperhistory available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHopperHistories.count}}" md-on-paginate="vm_dc.getIvrCampaignHopperHistories" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.FINAL">FINAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperfinals md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperFinalsController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERFINALS">HopperFinals</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHopperFinals()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getIvrCampaignHopperFinals()" aria-label="refresh HopperFinals" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERFINALS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                  <td md-cell class="actions">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="vm_dc.countContactsIvrCampaignHopperFinal(vm_dc.query.id); $mdOpenMenu($event);">\n                        <md-icon md-font-icon="icon-backup-restore"></md-icon>\n                        <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(3)">\n                            <span translate="MOTIONDIALER.NOANSWER ">NoAnswer</span>\n                            <span class="badge">({{vm_dc.contacts.noAnswerContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(5)">\n                            <span translate="MOTIONDIALER.BUSY ">Busy</span>\n                            <span class="badge">({{vm_dc.contacts.busyContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(8)">\n                            <span translate="MOTIONDIALER.CONGESTION ">Congestion</span>\n                            <span class="badge">({{vm_dc.contacts.congestionContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(10)">\n                            <span translate="MOTIONDIALER.DROPPED ">Drop</span>\n                            <span class="badge">({{vm_dc.contacts.dropContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(11)">\n                            <span translate="MOTIONDIALER.ABANDONED ">Abandoned</span>\n                            <span class="badge">({{vm_dc.contacts.abandonedContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(22)">\n                            <span translate="MOTIONDIALER.RECALLFAILEDTIMEOUT">Recall</span>\n                            <span class="badge">({{vm_dc.contacts.reCallContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(0)">\n                            <span translate="MOTIONDIALER.NO_SUCH_NUMBER">NoSuchNumber</span>\n                            <span class="badge">({{vm_dc.contacts.noSuchContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item>\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(19)">\n                            <span translate="MOTIONDIALER.ANSWERING_MACHINE">AnsweringMachine</span>\n                            <span class="badge">({{vm_dc.contacts.answeringMachine}})</span>\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHopperFinals.length}} {{vm_dc.selectedIvrCampaignHopperFinals.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHopperFinals" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.moveSelectedIvrCampaignHopperFinals($event)" aria-label="move selected" translate translate-attr-label="MOTIONDIALER.MOVE_SELECTED">\n                    <md-icon md-font-icon="icon-restore"></md-icon>\n                    <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHopperFinals" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHopperFinals">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="disposition">\n                        {{ \'MOTIONDIALER.DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperFinal" md-select-id="id" ng-repeat="hopperFinal in vm_dc.ivrCampaignHopperFinals.rows">\n                      <td md-cell>\n                        {{hopperFinal.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countcongestionretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countbusyretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnoanswerretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnosuchnumberretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countdropretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countabandonedretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countmachineretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countagentrejectretry}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.endtime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.disposition}}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.moveConfirm(hopperFinal, $event)" translate="MOTIONDIALER.MOVE_HOPPERFINAL">\n                                Move HopperFinal\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHopperFinals.rows.length">\n                      <td md-cell colspan="28">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERFINAL_AVAILABLE">No hopperfinal available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHopperFinals.count}}" md-on-paginate="vm_dc.getIvrCampaignHopperFinals" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.BLACKLIST">BLACKLIST</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperblacks md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperBlacksController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERBLACKS">HopperBlacks</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHopperBlacks()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHopperBlacks.length}} {{vm_dc.selectedIvrCampaignHopperBlacks.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHopperBlacks" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHopperBlacks" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHopperBlacks">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperBlack" md-select-id="id" ng-repeat="hopperBlack in vm_dc.ivrCampaignHopperBlacks.rows">\n                      <td md-cell>\n                        {{hopperBlack.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperBlack.phone}}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHopperBlacks.rows.length">\n                      <td md-cell colspan="4">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERBLACK_AVAILABLE">No hopperblack available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHopperBlacks.count}}" md-on-paginate="vm_dc.getIvrCampaignHopperBlacks" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/ivrCampaigns.html",'<div id="ivrCampaigns" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-fire" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MOTIONDIALER.IVRCAMPAIGNS">IvrCampaigns</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MOTIONDIALER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedIvrCampaigns.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedIvrCampaigns =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MOTIONDIALER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-ivrCampaigns-count">\n          <span>{{vm.selectedIvrCampaigns.length}}</span>\n          <span translate="MOTIONDIALER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MOTIONDIALER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllIvrCampaigns()" translate="MOTIONDIALER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectIvrCampaigns()" translate="MOTIONDIALER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedIvrCampaigns" csv-label="true" filename="ivrCampaigns.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedIvrCampaigns($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- IVRCAMPAIGN TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedIvrCampaigns" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getIvrCampaigns">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MOTIONDIALER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'MOTIONDIALER.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="TrunkId">{{ \'MOTIONDIALER.TRUNK\' | translate }}</th>\n                <th md-column md-order-by="SquareProjectId">{{ \'MOTIONDIALER.CALLYSQUAREPROJECT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.ivrCampaigns.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="ivrCampaign" md-select-id="id" ng-repeat="ivrCampaign in vm.ivrCampaigns.rows">\n                <td md-cell ng-if="ivrCampaign.userpic"><img class="avatar" alt="{{ivrCampaign.name}}" ng-src="api/users/{{ivrCampaign.id}}/avatar" /></td>\n                <td md-cell ng-if="!ivrCampaign.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{ivrCampaign.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="id ">{{ivrCampaign.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="name ">{{ivrCampaign.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{ivrCampaign.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{ivrCampaign.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="TrunkId ">{{ (vm.trunks | filter : {\'id\':ivrCampaign.TrunkId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="SquareProjectId ">{{ (vm.projects | filter : {\'id\':ivrCampaign.SquareProjectId} : true)[0].name }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(ivrCampaign, $event    )" translate="MOTIONDIALER.EDIT_IVRCAMPAIGN">\n                          Edit IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(ivrCampaign, $event    )" translate="MOTIONDIALER.CLONE_IVRCAMPAIGN">\n                          clone IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.listadddialog(ivrCampaign, $event    )" translate="MOTIONDIALER.LISTADD_IVRCAMPAIGN">\n                          listadd IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.blacklistadddialog(ivrCampaign, $event    )" translate="MOTIONDIALER.BLACKLISTADD_IVRCAMPAIGN">\n                          blacklistadd IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(ivrCampaign, $event    )" translate="MOTIONDIALER.DELETE_IVRCAMPAIGN">\n                          Delete IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(ivrCampaign, $event    )" translate="MOTIONDIALER.GOTOREALTIME_IVRCAMPAIGN">\n                          goToRealtime IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.ivrCampaigns.count}}" md-on-paginate="vm.getIvrCampaigns" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / IVRCAMPAIGN TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD IVRCAMPAIGN BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-ivrCampaign-button" ng-click="vm.createOrEditIvrCampaign($event)" aria-label="add ivrCampaign" translate translate-attr-aria-label="MOTIONDIALER.ADD_IVRCAMPAIGN">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD IVRCAMPAIGN BUTTON --\x3e\n</div>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/create/dialog.html",'<md-dialog class="queueCampaign-dialog" aria-label="New QueueCampaign">\n  <form name="queueCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.queueCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newQueueCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="queueCampaignForm[\'name\'].$error" ng-show="queueCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.queueCampaign.dialActive" aria-label="Active"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n        <md-select name="TrunkId" ng-model="vm.queueCampaign.TrunkId" required>\n          <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n        </md-select>\n        <div ng-messages="queueCampaignForm[\'TrunkId\'].$error" ng-show="queueCampaignForm[\'TrunkId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n        <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n        <md-select name="IntervalId" ng-model="vm.queueCampaign.IntervalId" required>\n          <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n        </md-select>\n        <div ng-messages="queueCampaignForm[\'IntervalId\'].$error" ng-show="queueCampaignForm[\'IntervalId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n        <md-select name="dialCheckDuplicateType" ng-model="vm.queueCampaign.dialCheckDuplicateType" required>\n\n          <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n          <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n          <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="queueCampaignForm[\'dialCheckDuplicateType\'].$error" ng-show="queueCampaignForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.METHOD">Method</label>\n        <md-select name="dialMethod" ng-model="vm.queueCampaign.dialMethod" required>\n          <md-option ng-value="\'progressive\'">Progressive</md-option>\n          <md-option ng-value="\'power\'">PowerDialing</md-option>\n          <md-option ng-value="\'predictive\'">Predictive</md-option>\n          <md-option ng-value="\'preview\'">Preview</md-option>\n          <md-option ng-value="\'booked\'">BookedProgressive</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.METHOD"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialMethod\'].$error" ng-show="queueCampaignForm[\'dialMethod\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.METHOD_REQUIRED">Method field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'power\'" class="md-block">\n        <span translate="MOTIONDIALER.POWERLEVEL">PowerLevel</span>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.POWERLEVEL"></span></div>\n        <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPowerLevel" min="1" max="10" step="0.1" class="md-accent"></md-slider>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n        <label translate="MOTIONDIALER.PREDICTIVEOPTIMIZATION">PredictiveOptimization</label>\n        <md-select name="dialPredictiveOptimization" ng-model="vm.queueCampaign.dialPredictiveOptimization">\n\n          <md-option ng-value="\'agentBusyFactor\'"> {{ \'MOTIONDIALER.AGENTBUSYFACTOR\' | translate }} </md-option>\n\n          <md-option ng-value="\'dropRate\'"> {{ \'MOTIONDIALER.DROPRATE\' | translate }} </md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATION"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialPredictiveOptimization\'].$error" ng-show="queueCampaignForm[\'dialPredictiveOptimization\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PREDICTIVEOPTIMIZATION_REQUIRED">PredictiveOptimization field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n        <span translate="MOTIONDIALER.PREDICTIVEOPTIMIZATIONPERCENTAGE">PredictiveOptimizationPercentage</span>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATIONPERCENTAGE"></span></div>\n        <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveOptimizationPercentage" min="1" max="95" step="0.1" class="md-accent"></md-slider>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n        <span translate="MOTIONDIALER.PREDICTIVEINTERVAL">PredictiveInterval</span>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEINTERVAL"></span></div>\n        <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveInterval" min="5" max="30" step="1" class="md-accent"></md-slider>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n        <label translate="MOTIONDIALER.MAXCONCURRENTCALLS">MaxConcurrentCalls</label>\n        <input type="number" name="dialLimitQueue" ng-model="vm.queueCampaign.dialLimitQueue" min="0" max="9999" value="0" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.MAXCONCURRENTCALLS"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialLimitQueue\'].$error" ng-show="queueCampaignForm[\'dialLimitQueue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_REQUIRED">MaxConcurrentCalls field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>9999</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n        <label translate="MOTIONDIALER.QUEUETIMEOUT">QueueTimeout</label>\n        <input type="number" name="dialQueueTimeout" ng-model="vm.queueCampaign.dialQueueTimeout" min="1" max="999" value="3" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.QUEUETIMEOUT"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialQueueTimeout\'].$error" ng-show="queueCampaignForm[\'dialQueueTimeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_REQUIRED">QueueTimeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>999</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.AGENTTIMEOUT">AgentTimeout</label>\n        <input type="number" name="timeout" ng-model="vm.queueCampaign.timeout" min="0" value="3" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTTIMEOUT"></span></div>\n        <div ng-messages="queueCampaignForm[\'timeout\'].$error" ng-show="queueCampaignForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_REQUIRED">AgentTimeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentTimeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.queueCampaign.description">\n\n        <div ng-messages="queueCampaignForm[\'description\'].$error" ng-show="queueCampaignForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newQueueCampaign" ng-click="vm.saveQueueCampaign()" class="send-button md-accent md-raised" ng-disabled="queueCampaignForm.$invalid || queueCampaignForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newQueueCampaign" ng-click="vm.addNewQueueCampaign()" class="send-button md-accent md-raised" ng-disabled="queueCampaignForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_QUEUECAMPAIGN" translate-attr-aria-label="MOTIONDIALER.ADD_QUEUECAMPAIGN">\n          ADD QUEUECAMPAIGN\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newQueueCampaign" ng-click="vm.deleteQueueCampaign($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.AGENTADD_QUEUECAMPAIGN">Add Agent to queueCampaign</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="MOTIONDIALER.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="queueCampaignForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.BLACKLISTADD_QUEUECAMPAIGN">Add List in QUEUECAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",'<md-dialog class="queueCampaign-dialog" aria-label="Clone QueueCampaign">\n  <form name="queueCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.queueCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newQueueCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="queueCampaignForm[\'name\'].$error" ng-show="queueCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.queueCampaign.dialActive" aria-label="Active"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneQueueCampaign()" class="send-button md-accent md-raised" ng-disabled="queueCampaignForm.$invalid" aria-label="CLONE" translate="MOTIONDIALER.CLONE_QUEUECAMPAIGN" translate-attr-aria-label="MOTIONDIALER.CLONE_QUEUECAMPAIGN">\n        CLONE QUEUECAMPAIGN\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/hoppers/dialog.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <label translate="MOTIONDIALER.SCHEDULEDAT">ScheduledAt</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.dateTime" ng-change="vm.recalcTZTime()">\n              <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.dateTime" ng-change="vm.recalcTZTime()">\n              <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <div layout="row">\n        <div flex class="md-block">\n          <md-input-container class="md-block" flex-gt-sm="">\n            <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n            <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" autofocus>\n          </md-input-container>\n        </div>\n        <div flex class="md-block">\n          <md-input-container class="md-block">\n            <label translate="DASHBOARDS.SYSTEM_TIME">System time</label>\n            <input type="text" readonly value="{{vm.hopper.scheduledat}}">\n          </md-input-container>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.PRIORITY">Priority</label>\n        <md-select name="priority" ng-model="vm.hopper.priority">\n          <md-option ng-value="\'4\'">Highest</md-option>\n          <md-option ng-value="\'3\'">High</md-option>\n          <md-option ng-value="\'2\'">Medium</md-option>\n          <md-option ng-value="\'1\'">Low</md-option>\n          <md-option ng-value="\'0\'">Lowest</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PRIORITY"></span></div>\n        <div ng-messages="hopperForm[\'priority\'].$error" ng-show="hopperForm[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.hopper.recallme" aria-label="RecallAgent"><span translate="MOTIONDIALER.RECALLAGENT">RecallAgent</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.hopper.recallme" class="md-block">\n        <label translate="MOTIONDIALER.AGENT">Agent</label>\n        <md-select name="UserId" ng-model="vm.hopper.UserId" required>\n          <md-option ng-value="UserId.id" ng-repeat="UserId in vm.agents" ng-disabled="UserId.canSelect === false">{{ UserId.name }}</md-option>\n        </md-select>\n        <div ng-messages="hopperForm[\'UserId\'].$error" ng-show="hopperForm[\'UserId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_HOPPER" translate-attr-aria-label="MOTIONDIALER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.LISTADD_QUEUECAMPAIGN">Add List in QUEUECAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/resetlist/resetlist.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.RESETLIST ">Reset List</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-disabled="vm.loading" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-hide="vm.loading">\n      <div layout="row" layout-wrap flex>\n        <div flex-xs flex="50">\n          <md-checkbox aria-label="Select All" ng-checked="vm.isChecked()" md-indeterminate="vm.isIndeterminate()" ng-click="vm.toggleAll()">\n            <span ng-if="vm.isChecked()" translate="MOTIONDIALER.UNSELECTALL"></span>\n            <span ng-if="!vm.isChecked()" translate="MOTIONDIALER.SELECTALL"></span>\n          </md-checkbox>\n        </div>\n        <div flex-xs flex="50">\n        </div>\n        <div flex="{{vm.items.length > 10 ? 50 : 100 }}" ng-repeat="item in vm.items">\n          <md-checkbox ng-checked="vm.exists(item, vm.selected)" ng-click="vm.toggle(item, vm.selected)">\n            {{ item.name | limitTo:40 }}\n          </md-checkbox>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions ng-hide="vm.loading" layout="row" layout-align="end center">\n      <div>\n      </div>\n      <md-button type="submit" ng-click="vm.listSelected()" class="send-button md-accent md-raised" ng-disabled="vm.loading" aria-label="RESET" translate="MOTIONDIALER.RESET" translate-attr-aria-label="MOTIONDIALER.RESET">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n    <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n      <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n    </div>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="MOTIONDIALER.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="queueCampaignForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/view.html",'<div id="motiondialer-queueCampaign" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-queueCampaigns-button md-icon-button" aria-label="Go to queueCampaigns" ng-click="vm.gotoQueueCampaigns()" translate translate-attr-aria-label="MOTIONDIALER.GO_TO_QUEUECAMPAIGNS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="queueCampaign-image" hide-xs>\n          <img ng-src="assets/images/business/queueCampaigns.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.queueCampaign.id}}\n            <span ng-if="vm.queueCampaign.name">{{vm.queueCampaign.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MOTIONDIALER.CREATED_AT"></span> <span>{{vm.queueCampaign.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.queueCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="MOTIONDIALER.CLONE_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.listadddialog(vm.queueCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="listadd">\n        <md-tooltip><span translate="MOTIONDIALER.LISTADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-format-list-numbers"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.blacklistadddialog(vm.queueCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="blacklistadd">\n        <md-tooltip><span translate="MOTIONDIALER.BLACKLISTADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-block-helper"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.queueCampaign, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="MOTIONDIALER.TEAMADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.queueCampaign, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="MOTIONDIALER.AGENTADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.resetlistdialog(vm.queueCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="resetlist">\n        <md-tooltip><span translate="MOTIONDIALER.RESETLIST_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-restore"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.queueCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="MOTIONDIALER.GOTO_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveQueueCampaign()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (campaignForm.$invalid) || (queueForm.$invalid) || (originateForm.$invalid) || (globalForm.$invalid) || (congestionForm.$invalid) || (busyForm.$invalid) || (noanswerForm.$invalid) || (nosuchnumberForm.$invalid) || (dropForm.$invalid) || (abandonedForm.$invalid) || (machineForm.$invalid) || (agentrejectForm.$invalid) || (additionalphonesForm.$invalid) || (advancedForm.$invalid) || (advancedpreviewForm.$invalid) || (thresholdsForm.$invalid) || (recallmeForm.$invalid) || (globalintervalForm.$invalid) || (timezoneForm.$invalid) || (amdForm.$invalid) || (hopperStatisticsForm.$invalid) || (hoppersForm.$invalid) || (hopperHistoriesForm.$invalid) || (hopperFinalsForm.$invalid) || (hopperBlacksForm.$invalid)" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.queueCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialActive" aria-label="Active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n                <md-select name="TrunkId" ng-model="vm.queueCampaign.TrunkId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkId\'].$error" ng-show="generalForm[\'TrunkId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BACKUPTRUNK">BackupTrunk</label>\n                <md-select name="TrunkBackupId" ng-model="vm.queueCampaign.TrunkBackupId" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="TrunkBackupId.id" ng-repeat="TrunkBackupId in vm.trunks" ng-disabled="TrunkBackupId.canSelect === false">{{ TrunkBackupId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkBackupId\'].$error" ng-show="generalForm[\'TrunkBackupId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BACKUPTRUNK_REQUIRED">BackupTrunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n                <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n                <md-select name="IntervalId" ng-model="vm.queueCampaign.IntervalId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'IntervalId\'].$error" ng-show="generalForm[\'IntervalId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n                <md-select name="dialCheckDuplicateType" ng-model="vm.queueCampaign.dialCheckDuplicateType" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n                  <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'dialCheckDuplicateType\'].$error" ng-show="generalForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CUTDIGIT">CutDigit</label>\n                <input type="number" name="dialCutDigit" ng-model="vm.queueCampaign.dialCutDigit" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'dialCutDigit\'].$error" ng-show="generalForm[\'dialCutDigit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_REQUIRED">CutDigit field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_LESS_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.queueCampaign.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container campaign md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</div>\n            </div>\n            <form name="campaignForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.METHOD">Method</label>\n                <md-select name="dialMethod" ng-model="vm.queueCampaign.dialMethod" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'progressive\'">Progressive</md-option>\n                  <md-option ng-value="\'power\'">PowerDialing</md-option>\n                  <md-option ng-value="\'predictive\'">Predictive</md-option>\n                  <md-option ng-value="\'preview\'">Preview</md-option>\n                  <md-option ng-value="\'booked\'">BookedProgressive</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.METHOD"></span></div>\n                <div ng-messages="campaignForm[\'dialMethod\'].$error" ng-show="campaignForm[\'dialMethod\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.METHOD_REQUIRED">Method field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'power\'" class="md-block">\n                <span translate="MOTIONDIALER.POWERLEVEL">PowerLevel</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.POWERLEVEL"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPowerLevel" min="1" max="10" step="0.1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <label translate="MOTIONDIALER.PREDICTIVEOPTIMIZATION">PredictiveOptimization</label>\n                <md-select name="dialPredictiveOptimization" ng-model="vm.queueCampaign.dialPredictiveOptimization" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'agentBusyFactor\'"> {{ \'MOTIONDIALER.AGENTBUSYFACTOR\' | translate }} </md-option>\n\n                  <md-option ng-value="\'dropRate\'"> {{ \'MOTIONDIALER.DROPRATE\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATION"></span></div>\n                <div ng-messages="campaignForm[\'dialPredictiveOptimization\'].$error" ng-show="campaignForm[\'dialPredictiveOptimization\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.PREDICTIVEOPTIMIZATION_REQUIRED">PredictiveOptimization field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEOPTIMIZATIONPERCENTAGE">PredictiveOptimizationPercentage</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATIONPERCENTAGE"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveOptimizationPercentage" min="1" max="95" step="0.1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEINTERVAL">PredictiveInterval</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEINTERVAL"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveInterval" min="5" max="30" step="1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n                <label translate="MOTIONDIALER.MAXCONCURRENTCALLS">MaxConcurrentCalls</label>\n                <input type="number" name="dialLimitQueue" ng-model="vm.queueCampaign.dialLimitQueue" min="0" max="9999" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MAXCONCURRENTCALLS"></span></div>\n                <div ng-messages="campaignForm[\'dialLimitQueue\'].$error" ng-show="campaignForm[\'dialLimitQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_REQUIRED">MaxConcurrentCalls field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>9999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTTIMEOUT">AgentTimeout</label>\n                <input type="number" name="timeout" ng-model="vm.queueCampaign.timeout" min="0" value="3" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTTIMEOUT"></span></div>\n                <div ng-messages="campaignForm[\'timeout\'].$error" ng-show="campaignForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_REQUIRED">AgentTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentTimeout must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container queue md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.QUEUE">QUEUE</div>\n            </div>\n            <form name="queueForm" novalidate>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.QUEUEOPTIONS">QueueOptions</label>\n                <input type="text" name="dialQueueOptions" ng-model="vm.queueCampaign.dialQueueOptions" value="tTxX" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="queueForm[\'dialQueueOptions\'].$error" ng-show="queueForm[\'dialQueueOptions\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUEOPTIONS_REQUIRED">QueueOptions field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.QUEUETIMEOUT">QueueTimeout</label>\n                <input type="number" name="dialQueueTimeout" ng-model="vm.queueCampaign.dialQueueTimeout" min="1" max="999" value="3" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.QUEUETIMEOUT"></span></div>\n                <div ng-messages="queueForm[\'dialQueueTimeout\'].$error" ng-show="queueForm[\'dialQueueTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_REQUIRED">QueueTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'booked\' || vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.queueCampaign.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'rrmemory\'">Round Robin Memory</md-option>\n                  <md-option ng-value="\'roundrobin\'" ng-if="vm.queueCampaign.dialMethod === \'booked\'">Round Robin</md-option>\n                  <md-option ng-value="\'leastrecent\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Least Recent</md-option>\n                  <md-option ng-value="\'fewestcalls\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Fewest Calls</md-option>\n                  <md-option ng-value="\'random\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Random</md-option>\n                  <md-option ng-value="\'linear\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Linear</md-option>\n                  <md-option ng-value="\'wrandom\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Weight Random</md-option>\n                </md-select>\n                <div ng-messages="queueForm[\'strategy\'].$error" ng-show="queueForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.RETRY">Retry</label>\n                <input type="number" name="retry" ng-model="vm.queueCampaign.retry" min="0" value="3" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RETRY"></span></div>\n                <div ng-messages="queueForm[\'retry\'].$error" ng-show="queueForm[\'retry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RETRY_REQUIRED">Retry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.RETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Retry must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.WRAPUPTIME">WrapupTime</label>\n                <input type="number" name="wrapuptime" ng-model="vm.queueCampaign.wrapuptime" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.WRAPUPTIME"></span></div>\n                <div ng-messages="queueForm[\'wrapuptime\'].$error" ng-show="queueForm[\'wrapuptime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.WRAPUPTIME_REQUIRED">WrapupTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.WRAPUPTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WrapupTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.WEIGHT">Weight</label>\n                <input type="number" name="weight" ng-model="vm.queueCampaign.weight" min="0" value="1" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.WEIGHT"></span></div>\n                <div ng-messages="queueForm[\'weight\'].$error" ng-show="queueForm[\'weight\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.WEIGHT_REQUIRED">Weight field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.WEIGHT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Weight must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.MUSICONHOLD">MusicOnHold</label>\n                <md-select name="musiconhold" ng-model="vm.queueCampaign.musiconhold" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="musiconhold.name" ng-repeat="musiconhold in vm.musiconholds" ng-disabled="musiconhold.canSelect === false">{{ musiconhold.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MUSICONHOLD"></span></div>\n                <div ng-messages="queueForm[\'musiconhold\'].$error" ng-show="queueForm[\'musiconhold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MUSICONHOLD_REQUIRED">MusicOnHold field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECT">CallySquareProject</label>\n                <md-select name="dialQueueProject" ng-model="vm.queueCampaign.dialQueueProject" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject.name" ng-repeat="dialQueueProject in vm.projects" ng-disabled="dialQueueProject.canSelect === false">{{ dialQueueProject.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECT"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject\'].$error" ng-show="queueForm[\'dialQueueProject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT_REQUIRED">CallySquareProject field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECT2">CallySquareProject2</label>\n                <md-select name="dialQueueProject2" ng-model="vm.queueCampaign.dialQueueProject2" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject2.name" ng-repeat="dialQueueProject2 in vm.projects" ng-disabled="dialQueueProject2.canSelect === false">{{ dialQueueProject2.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECT2"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject2\'].$error" ng-show="queueForm[\'dialQueueProject2\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT2_REQUIRED">CallySquareProject2 field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'preview\' || vm.queueCampaign.dialMethod === \'booked\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECTPREVIEW">CallySquareProjectPreview</label>\n                <md-select name="dialQueueProject" ng-model="vm.queueCampaign.dialQueueProject" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject.name" ng-repeat="dialQueueProject in vm.projects" ng-disabled="dialQueueProject.canSelect === false">{{ dialQueueProject.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECTPREVIEW"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject\'].$error" ng-show="queueForm[\'dialQueueProject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECTPREVIEW_REQUIRED">CallySquareProjectPreview field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'preview\' || vm.queueCampaign.dialMethod === \'booked\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECTPREVIEW2">CallySquareProjectPreview2</label>\n                <md-select name="dialQueueProject2" ng-model="vm.queueCampaign.dialQueueProject2" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject2.name" ng-repeat="dialQueueProject2 in vm.projects" ng-disabled="dialQueueProject2.canSelect === false">{{ dialQueueProject2.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECTPREVIEW2"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject2\'].$error" ng-show="queueForm[\'dialQueueProject2\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECTPREVIEW2_REQUIRED">CallySquareProjectPreview2 field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialQueueProject2 && (vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\')" class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialAgiAfterHangupAgent" aria-label="RunIfHangupAgent" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.RUNIFHANGUPAGENT">RunIfHangupAgent</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RUNIFHANGUPAGENT"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container originate md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ORIGINATE">ORIGINATE</div>\n            </div>\n            <form name="originateForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNAME">OriginateCallerIdName</label>\n                <input type="text" name="dialOriginateCallerIdName" ng-model="vm.queueCampaign.dialOriginateCallerIdName" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNAME"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdName\'].$error" ng-show="originateForm[\'dialOriginateCallerIdName\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNAME_REQUIRED">OriginateCallerIdName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNUMBER">OriginateCallerIdNumber</label>\n                <input type="text" name="dialOriginateCallerIdNumber" ng-model="vm.queueCampaign.dialOriginateCallerIdNumber" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdNumber\'].$error" ng-show="originateForm[\'dialOriginateCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNUMBER_REQUIRED">OriginateCallerIdNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.RANDOMLASTDIGITCALLERIDNUMBER">RandomLastDigitCallerIdNumber</label>\n                <input type="number" name="dialRandomLastDigitCallerIdNumber" ng-model="vm.queueCampaign.dialRandomLastDigitCallerIdNumber" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RANDOMLASTDIGITCALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$error" ng-show="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_REQUIRED">RandomLastDigitCallerIdNumber field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_LESS_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATETIMEOUT">OriginateTimeout</label>\n                <input type="number" name="dialOriginateTimeout" ng-model="vm.queueCampaign.dialOriginateTimeout" min="1" max="999" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATETIMEOUT"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateTimeout\'].$error" ng-show="originateForm[\'dialOriginateTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_REQUIRED">OriginateTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.PREFIX">Prefix</label>\n                <input type="text" name="dialPrefix" ng-model="vm.queueCampaign.dialPrefix" ng-pattern="/^\\d+$/" value="" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREFIX"></span></div>\n                <div ng-messages="originateForm[\'dialPrefix\'].$error" ng-show="originateForm[\'dialPrefix\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_MUST_VALID_PATTERN" translate-values="{ regex: \'/^\\d+$/\' }">Prefix must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.RETRYANDFREQUENCY">RETRYANDFREQUENCY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container global md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBAL">GLOBAL</div>\n            </div>\n            <form name="globalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALMAXRETRY">GlobalMaxRetry</label>\n                <input type="number" name="dialGlobalMaxRetry" ng-model="vm.queueCampaign.dialGlobalMaxRetry" min="1" max="999" value="4" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALMAXRETRY"></span></div>\n                <div ng-messages="globalForm[\'dialGlobalMaxRetry\'].$error" ng-show="globalForm[\'dialGlobalMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_REQUIRED">GlobalMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container congestion md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CONGESTION">CONGESTION</div>\n            </div>\n            <form name="congestionForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONMAXRETRY">CongestionMaxRetry</label>\n                <input type="number" name="dialCongestionMaxRetry" ng-model="vm.queueCampaign.dialCongestionMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONMAXRETRY"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionMaxRetry\'].$error" ng-show="congestionForm[\'dialCongestionMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_REQUIRED">CongestionMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONRETRYTIME">CongestionRetryTime</label>\n                <input type="number" name="dialCongestionRetryFrequency" ng-model="vm.queueCampaign.dialCongestionRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONRETRYTIME"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionRetryFrequency\'].$error" ng-show="congestionForm[\'dialCongestionRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_REQUIRED">CongestionRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container busy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.BUSY">BUSY</div>\n            </div>\n            <form name="busyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYMAXRETRY">BusyMaxRetry</label>\n                <input type="number" name="dialBusyMaxRetry" ng-model="vm.queueCampaign.dialBusyMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYMAXRETRY"></span></div>\n                <div ng-messages="busyForm[\'dialBusyMaxRetry\'].$error" ng-show="busyForm[\'dialBusyMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_REQUIRED">BusyMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYRETRYTIME">BusyRetryTime</label>\n                <input type="number" name="dialBusyRetryFrequency" ng-model="vm.queueCampaign.dialBusyRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYRETRYTIME"></span></div>\n                <div ng-messages="busyForm[\'dialBusyRetryFrequency\'].$error" ng-show="busyForm[\'dialBusyRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_REQUIRED">BusyRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container noanswer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOANSWER">NOANSWER</div>\n            </div>\n            <form name="noanswerForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERMAXRETRY">NoAnswerMaxRetry</label>\n                <input type="number" name="dialNoAnswerMaxRetry" ng-model="vm.queueCampaign.dialNoAnswerMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERMAXRETRY"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerMaxRetry\'].$error" ng-show="noanswerForm[\'dialNoAnswerMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_REQUIRED">NoAnswerMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERRETRYTIME">NoAnswerRetryTime</label>\n                <input type="number" name="dialNoAnswerRetryFrequency" ng-model="vm.queueCampaign.dialNoAnswerRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERRETRYTIME"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerRetryFrequency\'].$error" ng-show="noanswerForm[\'dialNoAnswerRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_REQUIRED">NoAnswerRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container nosuchnumber md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOSUCHNUMBER">NOSUCHNUMBER</div>\n            </div>\n            <form name="nosuchnumberForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERMAXRETRY">NoSuchNumberMaxRetry</label>\n                <input type="number" name="dialNoSuchNumberMaxRetry" ng-model="vm.queueCampaign.dialNoSuchNumberMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERMAXRETRY"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_REQUIRED">NoSuchNumberMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERRETRYTIME">NoSuchNumberRetryTime</label>\n                <input type="number" name="dialNoSuchNumberRetryFrequency" ng-model="vm.queueCampaign.dialNoSuchNumberRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERRETRYTIME"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_REQUIRED">NoSuchNumberRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container drop md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.DROP">DROP</div>\n            </div>\n            <form name="dropForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPMAXRETRY">DropMaxRetry</label>\n                <input type="number" name="dialDropMaxRetry" ng-model="vm.queueCampaign.dialDropMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPMAXRETRY"></span></div>\n                <div ng-messages="dropForm[\'dialDropMaxRetry\'].$error" ng-show="dropForm[\'dialDropMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_REQUIRED">DropMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPRETRYTIME">DropRetryTime</label>\n                <input type="number" name="dialDropRetryFrequency" ng-model="vm.queueCampaign.dialDropRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPRETRYTIME"></span></div>\n                <div ng-messages="dropForm[\'dialDropRetryFrequency\'].$error" ng-show="dropForm[\'dialDropRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_REQUIRED">DropRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container abandoned md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ABANDONED">ABANDONED</div>\n            </div>\n            <form name="abandonedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDMAXRETRY">AbandonedMaxRetry</label>\n                <input type="number" name="dialAbandonedMaxRetry" ng-model="vm.queueCampaign.dialAbandonedMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDMAXRETRY"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedMaxRetry\'].$error" ng-show="abandonedForm[\'dialAbandonedMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_REQUIRED">AbandonedMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDRETRYTIME">AbandonedRetryTime</label>\n                <input type="number" name="dialAbandonedRetryFrequency" ng-model="vm.queueCampaign.dialAbandonedRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDRETRYTIME"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedRetryFrequency\'].$error" ng-show="abandonedForm[\'dialAbandonedRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_REQUIRED">AbandonedRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container machine md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.MACHINE">MACHINE</div>\n            </div>\n            <form name="machineForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINEMAXRETRY">MachineMaxRetry</label>\n                <input type="number" name="dialMachineMaxRetry" ng-model="vm.queueCampaign.dialMachineMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINEMAXRETRY"></span></div>\n                <div ng-messages="machineForm[\'dialMachineMaxRetry\'].$error" ng-show="machineForm[\'dialMachineMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_REQUIRED">MachineMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINERETRYTIME">MachineRetryTime</label>\n                <input type="number" name="dialMachineRetryFrequency" ng-model="vm.queueCampaign.dialMachineRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINERETRYTIME"></span></div>\n                <div ng-messages="machineForm[\'dialMachineRetryFrequency\'].$error" ng-show="machineForm[\'dialMachineRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_REQUIRED">MachineRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container agentreject md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AGENTREJECT">AGENTREJECT</div>\n            </div>\n            <form name="agentrejectForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTMAXRETRY">AgentRejectMaxRetry</label>\n                <input type="number" name="dialAgentRejectMaxRetry" ng-model="vm.queueCampaign.dialAgentRejectMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTMAXRETRY"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectMaxRetry\'].$error" ng-show="agentrejectForm[\'dialAgentRejectMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_REQUIRED">AgentRejectMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTRETRYTIME">AgentRejectRetryTime</label>\n                <input type="number" name="dialAgentRejectRetryFrequency" ng-model="vm.queueCampaign.dialAgentRejectRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTRETRYTIME"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$error" ng-show="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_REQUIRED">AgentRejectRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container additionalphones md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADDITIONALPHONES">ADDITIONALPHONES</div>\n            </div>\n            <form name="additionalphonesForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CALLADDITIONALPHONEAFTERMIN">CallAdditionalPhoneAfterMin</label>\n                <input type="number" name="callAdditionalPhoneAfterMin" ng-model="vm.queueCampaign.callAdditionalPhoneAfterMin" min="1" max="99999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="additionalphonesForm[\'callAdditionalPhoneAfterMin\'].$error" ng-show="additionalphonesForm[\'callAdditionalPhoneAfterMin\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLADDITIONALPHONEAFTERMIN_REQUIRED">CallAdditionalPhoneAfterMin field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CALLADDITIONALPHONEAFTERMIN_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CallAdditionalPhoneAfterMin must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CALLADDITIONALPHONEAFTERMIN_MUST_BE_LESS_THAN_OR_EQUAL_TO">CallAdditionalPhoneAfterMin must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="queueCampaign-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.acw" aria-label="AfterCallWork" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AFTERCALLWORK">AfterCallWork</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORK"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.acw" class="md-block">\n                <label translate="MOTIONDIALER.AFTERCALLWORKDURATION">AfterCallWorkDuration</label>\n                <input type="number" name="acwTimeout" ng-model="vm.queueCampaign.acwTimeout" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORKDURATION"></span></div>\n                <div ng-messages="advancedForm[\'acwTimeout\'].$error" ng-show="advancedForm[\'acwTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_REQUIRED">AfterCallWorkDuration field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AfterCallWorkDuration must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AUTOPAUSE">AutoPause</label>\n                <md-select name="autopause" ng-model="vm.queueCampaign.autopause" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'all\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AUTOPAUSE"></span></div>\n                <div ng-messages="advancedForm[\'autopause\'].$error" ng-show="advancedForm[\'autopause\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AUTOPAUSE_REQUIRED">AutoPause field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.RINGINUSE">RingInUse</label>\n                <md-select name="ringinuse" ng-model="vm.queueCampaign.ringinuse" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RINGINUSE"></span></div>\n                <div ng-messages="advancedForm[\'ringinuse\'].$error" ng-show="advancedForm[\'ringinuse\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RINGINUSE_REQUIRED">RingInUse field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MEMBERDELAY">MemberDelay</label>\n                <input type="number" name="memberdelay" ng-model="vm.queueCampaign.memberdelay" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MEMBERDELAY"></span></div>\n                <div ng-messages="advancedForm[\'memberdelay\'].$error" ng-show="advancedForm[\'memberdelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MEMBERDELAY_REQUIRED">MemberDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MEMBERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MemberDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TIMEOUTRESTART">TimeoutRestart</label>\n                <md-select name="timeoutrestart" ng-model="vm.queueCampaign.timeoutrestart" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEOUTRESTART"></span></div>\n                <div ng-messages="advancedForm[\'timeoutrestart\'].$error" ng-show="advancedForm[\'timeoutrestart\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TIMEOUTRESTART_REQUIRED">TimeoutRestart field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MONITORFORMAT">MonitorFormat</label>\n                <md-select name="monitor_format" ng-model="vm.queueCampaign.monitor_format" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'wav49\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MONITORFORMAT"></span></div>\n                <div ng-messages="advancedForm[\'monitor_format\'].$error" ng-show="advancedForm[\'monitor_format\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MONITORFORMAT_REQUIRED">MonitorFormat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONTEXT">Context</label>\n                <input type="text" name="context" ng-model="vm.queueCampaign.context" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONTEXT"></span></div>\n                <div ng-messages="advancedForm[\'context\'].$error" ng-show="advancedForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.SETINTERFACEVARIABLES">SetInterfaceVariables</label>\n                <md-select name="setinterfacevar" ng-model="vm.queueCampaign.setinterfacevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.SETINTERFACEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setinterfacevar\'].$error" ng-show="advancedForm[\'setinterfacevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.SETINTERFACEVARIABLES_REQUIRED">SetInterfaceVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.SETQUEUEVARIABLES">SetQueueVariables</label>\n                <md-select name="setqueuevar" ng-model="vm.queueCampaign.setqueuevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.SETQUEUEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueuevar\'].$error" ng-show="advancedForm[\'setqueuevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.SETQUEUEVARIABLES_REQUIRED">SetQueueVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.SETQUEUEENTRYVARIABLES">SetQueueEntryVariables</label>\n                <md-select name="setqueueentryvar" ng-model="vm.queueCampaign.setqueueentryvar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.SETQUEUEENTRYVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueueentryvar\'].$error" ng-show="advancedForm[\'setqueueentryvar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.SETQUEUEENTRYVARIABLES_REQUIRED">SetQueueEntryVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALORDERBYSCHEDULEDAT">DialOrderByScheduledAt</label>\n                <md-select name="dialOrderByScheduledAt" ng-model="vm.queueCampaign.dialOrderByScheduledAt" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'DESC\'"> {{ \'MOTIONDIALER.DESC\' | translate }} </md-option>\n\n                  <md-option ng-value="\'ASC\'"> {{ \'MOTIONDIALER.ASC\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALORDERBYSCHEDULEDAT"></span></div>\n                <div ng-messages="advancedForm[\'dialOrderByScheduledAt\'].$error" ng-show="advancedForm[\'dialOrderByScheduledAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALORDERBYSCHEDULEDAT_REQUIRED">DialOrderByScheduledAt field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.mandatoryDisposition" class="md-block">\n                <label translate="MOTIONDIALER.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.queueCampaign.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="advancedForm[\'mandatoryDispositionPauseId\'].$error" ng-show="advancedForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod === \'preview\' || vm.queueCampaign.dialMethod === \'booked\'" class="queueCampaign-detail-form-container advancedpreview md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADVANCEDPREVIEW">ADVANCEDPREVIEW</div>\n            </div>\n            <form name="advancedpreviewForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.acw" aria-label="AfterCallWork" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AFTERCALLWORK">AfterCallWork</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORK"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.acw" class="md-block">\n                <label translate="MOTIONDIALER.AFTERCALLWORKDURATION">AfterCallWorkDuration</label>\n                <input type="number" name="acwTimeout" ng-model="vm.queueCampaign.acwTimeout" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORKDURATION"></span></div>\n                <div ng-messages="advancedpreviewForm[\'acwTimeout\'].$error" ng-show="advancedpreviewForm[\'acwTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_REQUIRED">AfterCallWorkDuration field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AfterCallWorkDuration must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MONITORFORMAT">MonitorFormat</label>\n                <md-select name="monitor_format" ng-model="vm.queueCampaign.monitor_format" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'wav49\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MONITORFORMAT"></span></div>\n                <div ng-messages="advancedpreviewForm[\'monitor_format\'].$error" ng-show="advancedpreviewForm[\'monitor_format\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MONITORFORMAT_REQUIRED">MonitorFormat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALORDERBYSCHEDULEDAT">DialOrderByScheduledAt</label>\n                <md-select name="dialOrderByScheduledAt" ng-model="vm.queueCampaign.dialOrderByScheduledAt" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'DESC\'"> {{ \'MOTIONDIALER.DESC\' | translate }} </md-option>\n\n                  <md-option ng-value="\'ASC\'"> {{ \'MOTIONDIALER.ASC\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALORDERBYSCHEDULEDAT"></span></div>\n                <div ng-messages="advancedpreviewForm[\'dialOrderByScheduledAt\'].$error" ng-show="advancedpreviewForm[\'dialOrderByScheduledAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALORDERBYSCHEDULEDAT_REQUIRED">DialOrderByScheduledAt field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.mandatoryDisposition" class="md-block">\n                <label translate="MOTIONDIALER.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.queueCampaign.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="advancedpreviewForm[\'mandatoryDispositionPauseId\'].$error" ng-show="advancedpreviewForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod === \'predictive\'" class="queueCampaign-detail-form-container thresholds md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.THRESHOLDS">THRESHOLDS</div>\n            </div>\n            <form name="thresholdsForm" novalidate>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEMAXTHRESHOLD">PredictiveMaxThreshold</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEMAXTHRESHOLD"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveIntervalMaxThreshold" min="1" max="100" step="1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEMINTHRESHOLD">PredictiveMinThreshold</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEMINTHRESHOLD"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveIntervalMinThreshold" min="1" max="100" step="1" class="md-accent"></md-slider>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container recallme md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.RECALLME">RECALLME</div>\n            </div>\n            <form name="recallmeForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALRECALLMETIMEOUT">DialRecallMeTimeout</label>\n                <input type="number" name="dialRecallMeTimeout" ng-model="vm.queueCampaign.dialRecallMeTimeout" min="1" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALRECALLMETIMEOUT"></span></div>\n                <div ng-messages="recallmeForm[\'dialRecallMeTimeout\'].$error" ng-show="recallmeForm[\'dialRecallMeTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALRECALLMETIMEOUT_REQUIRED">DialRecallMeTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DIALRECALLMETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DialRecallMeTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialRecallInQueue" aria-label="DialRecallInQueue" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.DIALRECALLINQUEUE">DialRecallInQueue</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALRECALLINQUEUE"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'preview\'" class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialPreviewAutoRecallMe" aria-label="Preview_Auto_Recall_Me" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.PREVIEW_AUTO_RECALL_ME">Preview_Auto_Recall_Me</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREVIEW_AUTO_RECALL_ME"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'preview\'" class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialPreviewRecallmeReminder" aria-label="Preview_Recall_Me_Reminder" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.PREVIEW_RECALL_ME_REMINDER">Preview_Recall_Me_Reminder</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREVIEW_RECALL_ME_REMINDER"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="queueCampaign-detail-form-container globalinterval md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBALINTERVAL">GLOBALINTERVAL</div>\n            </div>\n            <form name="globalintervalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALINTERVAL">GlobalInterval</label>\n                <input type="text" name="dialGlobalInterval" ng-model="vm.queueCampaign.dialGlobalInterval" value="07:00-22:00,*,*,*" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALINTERVAL"></span></div>\n                <div ng-messages="globalintervalForm[\'dialGlobalInterval\'].$error" ng-show="globalintervalForm[\'dialGlobalInterval\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALINTERVAL_REQUIRED">GlobalInterval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="queueCampaign-detail-form-container timezone md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.TIMEZONE">TIMEZONE</div>\n            </div>\n            <form name="timezoneForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TIMEZONE">Timezone</label>\n                <ms-timezone name="dialTimezone" ng-model="vm.queueCampaign.dialTimezone" autofocus ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEZONE"></span></div>\n                <div ng-messages="timezoneForm[\'dialTimezone\'].$error" ng-show="timezoneForm[dialTimezone].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="queueCampaign-detail-form-container amd md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AMD">AMD</div>\n            </div>\n            <form name="amdForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialAMDActive" aria-label="AMDActive" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AMDACTIVE">AMDActive</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDACTIVE"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDINITIALSILENCE">AMDInitialSilence</label>\n                <input type="number" name="dialAMDInitialSilence" ng-model="vm.queueCampaign.dialAMDInitialSilence" min="0" value="2500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDINITIALSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDInitialSilence\'].$error" ng-show="amdForm[\'dialAMDInitialSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_REQUIRED">AMDInitialSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDInitialSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDGREETING">AMDGreeting</label>\n                <input type="number" name="dialAMDGreeting" ng-model="vm.queueCampaign.dialAMDGreeting" min="0" value="1500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDGREETING"></span></div>\n                <div ng-messages="amdForm[\'dialAMDGreeting\'].$error" ng-show="amdForm[\'dialAMDGreeting\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_REQUIRED">AMDGreeting field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDGreeting must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDAFTERGREETINGSILENCE">AMDAfterGreetingSilence</label>\n                <input type="number" name="dialAMDAfterGreetingSilence" ng-model="vm.queueCampaign.dialAMDAfterGreetingSilence" min="0" value="800" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDAFTERGREETINGSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDAfterGreetingSilence\'].$error" ng-show="amdForm[\'dialAMDAfterGreetingSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_REQUIRED">AMDAfterGreetingSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDAfterGreetingSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDTOTALANALYSISTIME">AMDTotalAnalysisTime</label>\n                <input type="number" name="dialAMDTotalAnalysisTime" ng-model="vm.queueCampaign.dialAMDTotalAnalysisTime" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDTOTALANALYSISTIME"></span></div>\n                <div ng-messages="amdForm[\'dialAMDTotalAnalysisTime\'].$error" ng-show="amdForm[\'dialAMDTotalAnalysisTime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_REQUIRED">AMDTotalAnalysisTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDTotalAnalysisTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMINWORDLENGTH">AMDMinWordLength</label>\n                <input type="number" name="dialAMDMinWordLength" ng-model="vm.queueCampaign.dialAMDMinWordLength" min="0" value="100" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMINWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMinWordLength\'].$error" ng-show="amdForm[\'dialAMDMinWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_REQUIRED">AMDMinWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMinWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDBETWEENWORDSSILENCE">AMDBetweenWordsSilence</label>\n                <input type="number" name="dialAMDBetweenWordsSilence" ng-model="vm.queueCampaign.dialAMDBetweenWordsSilence" min="0" value="50" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDBETWEENWORDSSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDBetweenWordsSilence\'].$error" ng-show="amdForm[\'dialAMDBetweenWordsSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_REQUIRED">AMDBetweenWordsSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDBetweenWordsSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMNUMBEROFWORDS">AMDMaximumNumberOfWords</label>\n                <input type="number" name="dialAMDMaximumNumberOfWords" ng-model="vm.queueCampaign.dialAMDMaximumNumberOfWords" min="0" value="3" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMNUMBEROFWORDS"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumNumberOfWords\'].$error" ng-show="amdForm[\'dialAMDMaximumNumberOfWords\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_REQUIRED">AMDMaximumNumberOfWords field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumNumberOfWords must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDSILENCETHRESHOLD">AMDSilenceThreshold</label>\n                <input type="number" name="dialAMDSilenceThreshold" ng-model="vm.queueCampaign.dialAMDSilenceThreshold" min="0" max="32767" value="256" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDSILENCETHRESHOLD"></span></div>\n                <div ng-messages="amdForm[\'dialAMDSilenceThreshold\'].$error" ng-show="amdForm[\'dialAMDSilenceThreshold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_REQUIRED">AMDSilenceThreshold field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_LESS_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>32767</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMWORDLENGTH">AMDMaximumWordLength</label>\n                <input type="number" name="dialAMDMaximumWordLength" ng-model="vm.queueCampaign.dialAMDMaximumWordLength" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumWordLength\'].$error" ng-show="amdForm[\'dialAMDMaximumWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_REQUIRED">AMDMaximumWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HOPPERS">HOPPERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperstatistics md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperStatisticsController as vm_hs" ng-init="vm_hs.init(vm.queueCampaign)">\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERWIDGET">Hoppers</span>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_hs.init(vm.queueCampaign)" aria-label="refresh Hopper" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              \x3c!-- WIDGET GROUP --\x3e\n              <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n                \x3c!-- WIDGET 1 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{(vm_hs.total || 0) + (vm_hs.closed || 0)}}</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.TOTAL\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 1 --\x3e\n\n                \x3c!-- WIDGET 2 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.fresh || 0}} ({{vm_hs.total ? ((((vm_hs.fresh || 0) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.FRESH\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 2 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.total ? (vm_hs.total - (vm_hs.fresh || 0)) : 0}} ({{vm_hs.total ? ((((vm_hs.total - (vm_hs.fresh || 0)) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.OPEN\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.closed ? (vm_hs.closed || 0) : 0}} ({{vm_hs.closed ? ((((vm_hs.closed) * 100)/(vm_hs.closed + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.CLOSED\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n              </div>\n              \x3c!-- / WIDGET GROUP --\x3e\n            </div>\n\n          </div>\n          <div class="queueCampaign-detail-form-container hoppers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHoppersController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERS">Hoppers</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHoppers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getQueueCampaignHoppers()" aria-label="refresh Hoppers" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHoppers.length}} {{vm_dc.selectedQueueCampaignHoppers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHoppers" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedQueueCampaignHoppers($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHoppers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHoppers">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="priority">\n                        {{ \'MOTIONDIALER.PRIORITY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="recallme">\n                        {{ \'MOTIONDIALER.RECALLAGENT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopper" md-select-id="id" ng-repeat="hopper in vm_dc.queueCampaignHoppers.rows">\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.ContactId}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell privacy ng-cloak>\n                        {{hopper.phone}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countcongestionretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countbusyretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnoanswerretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnosuchnumberretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countdropretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countabandonedretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countmachineretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countagentrejectretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{ hopper.scheduledat | formatdate }}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{ vm_dc.arraypriority[hopper.priority].option }} </td>\n\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell class="recallme ">\n                        <md-icon md-colors="{color: {{hopper.recallme ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{hopper.recallme? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" translate="MOTIONDIALER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(hopper, $event)" translate="MOTIONDIALER.DELETE_HOPPER">\n                                Delete Hopper\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHoppers.rows.length">\n                      <td md-cell colspan="17">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPER_AVAILABLE">No hopper available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHoppers.count}}" md-on-paginate="vm_dc.getQueueCampaignHoppers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HISTORY">HISTORY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperhistories md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperHistoriesController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERHISTORIES">HopperHistories</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHopperHistories()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getQueueCampaignHopperHistories()" aria-label="refresh HopperHistories" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERHISTORIES">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHopperHistories.length}} {{vm_dc.selectedQueueCampaignHopperHistories.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHopperHistories" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHopperHistories" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHopperHistories">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperHistory" md-select-id="id" ng-repeat="hopperHistory in vm_dc.queueCampaignHopperHistories.rows">\n                      <td md-cell>\n                        {{hopperHistory.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.scheduledat | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.endtime | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHopperHistories.rows.length">\n                      <td md-cell colspan="11">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERHISTORY_AVAILABLE">No hopperhistory available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHopperHistories.count}}" md-on-paginate="vm_dc.getQueueCampaignHopperHistories" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.FINAL">FINAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperfinals md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperFinalsController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERFINALS">HopperFinals</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHopperFinals()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getQueueCampaignHopperFinals()" aria-label="refresh HopperFinals" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERFINALS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                  <td md-cell class="actions">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="vm_dc.countContactsQueueCampaignHopperFinal(vm_dc.query.id); $mdOpenMenu($event);">\n                        <md-icon md-font-icon="icon-backup-restore"></md-icon>\n                        <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(3)">\n                            <span translate="MOTIONDIALER.NOANSWER ">NoAnswer</span>\n                            <span class="badge">({{vm_dc.contacts.noAnswerContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(5)">\n                            <span translate="MOTIONDIALER.BUSY ">Busy</span>\n                            <span class="badge">({{vm_dc.contacts.busyContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(8)">\n                            <span translate="MOTIONDIALER.CONGESTION ">Congestion</span>\n                            <span class="badge">({{vm_dc.contacts.congestionContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(10)">\n                            <span translate="MOTIONDIALER.DROPPED ">Drop</span>\n                            <span class="badge">({{vm_dc.contacts.dropContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(11)">\n                            <span translate="MOTIONDIALER.ABANDONED ">Abandoned</span>\n                            <span class="badge">({{vm_dc.contacts.abandonedContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(22)">\n                            <span translate="MOTIONDIALER.RECALLFAILEDTIMEOUT">Recall</span>\n                            <span class="badge">({{vm_dc.contacts.reCallContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(0)">\n                            <span translate="MOTIONDIALER.NO_SUCH_NUMBER">NoSuchNumber</span>\n                            <span class="badge">({{vm_dc.contacts.noSuchContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item>\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(19)">\n                            <span translate="MOTIONDIALER.ANSWERING_MACHINE">AnsweringMachine</span>\n                            <span class="badge">({{vm_dc.contacts.answeringMachine}})</span>\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHopperFinals.length}} {{vm_dc.selectedQueueCampaignHopperFinals.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHopperFinals" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.moveSelectedQueueCampaignHopperFinals($event)" aria-label="move selected" translate translate-attr-label="MOTIONDIALER.MOVE_SELECTED">\n                    <md-icon md-font-icon="icon-restore"></md-icon>\n                    <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHopperFinals" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHopperFinals">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="disposition">\n                        {{ \'MOTIONDIALER.DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="secondDisposition">\n                        {{ \'MOTIONDIALER.SECOND_LEVEL_DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="thirdDisposition">\n                        {{ \'MOTIONDIALER.THIRD_LEVEL_DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperFinal" md-select-id="id" ng-repeat="hopperFinal in vm_dc.queueCampaignHopperFinals.rows">\n                      <td md-cell>\n                        {{hopperFinal.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countcongestionretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countbusyretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnoanswerretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnosuchnumberretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countdropretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countabandonedretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countmachineretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countagentrejectretry}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.endtime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.disposition}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.secondDisposition}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.thirdDisposition}}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.moveConfirm(hopperFinal, $event)" translate="MOTIONDIALER.MOVE_HOPPERFINAL">\n                                Move HopperFinal\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHopperFinals.rows.length">\n                      <td md-cell colspan="30">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERFINAL_AVAILABLE">No hopperfinal available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHopperFinals.count}}" md-on-paginate="vm_dc.getQueueCampaignHopperFinals" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.BLACKLIST">BLACKLIST</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperblacks md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperBlacksController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERBLACKS">HopperBlacks</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHopperBlacks()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHopperBlacks.length}} {{vm_dc.selectedQueueCampaignHopperBlacks.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHopperBlacks" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHopperBlacks" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHopperBlacks">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperBlack" md-select-id="id" ng-repeat="hopperBlack in vm_dc.queueCampaignHopperBlacks.rows">\n                      <td md-cell>\n                        {{hopperBlack.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperBlack.phone}}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHopperBlacks.rows.length">\n                      <td md-cell colspan="4">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERBLACK_AVAILABLE">No hopperblack available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHopperBlacks.count}}" md-on-paginate="vm_dc.getQueueCampaignHopperBlacks" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/queueCampaigns.html",'<div id="queueCampaigns" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-fire" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MOTIONDIALER.QUEUECAMPAIGNS">QueueCampaigns</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MOTIONDIALER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedQueueCampaigns.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedQueueCampaigns =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MOTIONDIALER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-queueCampaigns-count">\n          <span>{{vm.selectedQueueCampaigns.length}}</span>\n          <span translate="MOTIONDIALER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MOTIONDIALER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllQueueCampaigns()" translate="MOTIONDIALER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectQueueCampaigns()" translate="MOTIONDIALER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedQueueCampaigns" csv-label="true" filename="queueCampaigns.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedQueueCampaigns($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- QUEUECAMPAIGN TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedQueueCampaigns" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueueCampaigns">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MOTIONDIALER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                <th md-column md-order-by="dialActive">{{ \'MOTIONDIALER.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="TrunkId">{{ \'MOTIONDIALER.TRUNK\' | translate }}</th>\n                <th md-column md-order-by="dialMethod">{{ \'MOTIONDIALER.METHOD\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'MOTIONDIALER.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.queueCampaigns.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="queueCampaign" md-select-id="id" ng-repeat="queueCampaign in vm.queueCampaigns.rows">\n                <td md-cell ng-if="queueCampaign.userpic"><img class="avatar" alt="{{queueCampaign.name}}" ng-src="api/users/{{queueCampaign.id}}/avatar" /></td>\n                <td md-cell ng-if="!queueCampaign.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{queueCampaign.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="id ">{{queueCampaign.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="name ">{{queueCampaign.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="dialActive ">\n                  <md-icon md-colors="{color: {{queueCampaign.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{queueCampaign.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="TrunkId ">{{ (vm.trunks | filter : {\'id\':queueCampaign.TrunkId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="dialMethod ">{{ vm.arraydialMethod[queueCampaign.dialMethod].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="strategy ">{{ vm.arraystrategy[queueCampaign.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(queueCampaign, $event    )" translate="MOTIONDIALER.EDIT_QUEUECAMPAIGN">\n                          Edit QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(queueCampaign, $event    )" translate="MOTIONDIALER.CLONE_QUEUECAMPAIGN">\n                          clone QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.listadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.LISTADD_QUEUECAMPAIGN">\n                          listadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.blacklistadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.BLACKLISTADD_QUEUECAMPAIGN">\n                          blacklistadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.TEAMADD_QUEUECAMPAIGN">\n                          teamadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.AGENTADD_QUEUECAMPAIGN">\n                          agentadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(queueCampaign, $event    )" translate="MOTIONDIALER.DELETE_QUEUECAMPAIGN">\n                          Delete QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(queueCampaign, $event    )" translate="MOTIONDIALER.GOTOREALTIME_QUEUECAMPAIGN">\n                          goToRealtime QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queueCampaigns.count}}" md-on-paginate="vm.getQueueCampaigns" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / QUEUECAMPAIGN TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD QUEUECAMPAIGN BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-queueCampaign-button" ng-click="vm.createOrEditQueueCampaign($event)" aria-label="add queueCampaign" translate translate-attr-aria-label="MOTIONDIALER.ADD_QUEUECAMPAIGN">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD QUEUECAMPAIGN BUTTON --\x3e\n</div>'),e.put("app/main/apps/motiondialer/views/realtime/abandonedcalls/view.html",'<md-toolbar class="md-table-toolbar md-default table-header">\n  <div class="md-toolbar-tools" layout="row" layout-align="center center">\n    <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n    <ms-search-bar on-search="vm.getAbandonedCalls()" query="vm.query" on-collapse="vm.query.filter = undefined" debounce="300">\n    </ms-search-bar>\n    <div flex></div>\n\n    <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getAbandonedCalls()"></ms-quick-filter>\n\n    <md-button class="md-icon-button" ng-click="vm.refresh && vm.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n      <md-icon md-font-icon="icon-reload"></md-icon>\n      <md-tooltip ng-if="vm.showTooltip" md-visible="vm.showTooltip">{{\'DASHBOARDS.CLICKRELOAD\' | translate}}\n      </md-tooltip>\n    </md-button>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAbandonedCalls">\n      <tr md-row>\n        <th md-column md-order-by="id">ID</th>\n        <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n        <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n        <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n        <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n        <th md-column md-order-by="queuecallerexitAt">{{\'DASHBOARDS.QUEUECALLEREXITAT\' | translate}}</th>\n        <th md-column md-order-by="queuecallerexitreason">{{\'DASHBOARDS.QUEUECALLEREXITREASON\' | translate}}</th>\n        <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.abandonedCalls.rows.length">\n        <td md-cell colspan="12">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="call in vm.abandonedCalls.rows">\n        <td md-cell class="id">{{call.id}}</td>\n        <td md-cell class="firstName" privacy ng-cloak>{{call.calleridname}}</td>\n        <td md-cell class="list" privacy ng-cloak>{{call.calleridnum}}</td>\n        <td md-cell class="list">{{vm.queuesMap[call.queue]}}</td>\n        <td md-cell class="list">\n          {{call.queuecallerabandonAt ? (call.queuecallerabandonAt | formatdate) : (call.queuecallerexitAt | formatdate) }}\n        </td>\n        <td md-cell class="list">{{call.queuecallerexitAt ? (call.queuecallerexitAt | formatdate) : undefined }}\n        </td>\n        <td md-cell class="list">{{call.queuecallerexitreason}}</td>\n        <td md-cell class="list">{{call.lastAssignedTo}}</td>\n        <td md-cell class="list">{{ call.disposition }}</td>\n        <td md-cell class="list">{{ call.secondDisposition }}</td>\n        <td md-cell class="list">{{ call.thirdDisposition }}</td>\n        <td md-cell class="actions">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="2">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-menu>\n                  <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.ASSIGNTO">\n                    Assigned\n                    to</md-button>\n                  <md-menu-content>\n                    <md-menu-item ng-if="call.lastAssignedTo">\n                      <md-button ng-click="vm.assignTo(call)"><em translate="DASHBOARDS.NONE">Not Assigned</em>\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.agents.rows.length" ng-repeat="agent in vm.agents.rows">\n                      <md-button ng-click="vm.assignTo(call,agent)">{{agent.name}}</md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.dispose(call)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">\n                  Dispose\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.abandonedCalls.count}}" md-on-paginate="vm.getAbandonedCalls" md-page-select></md-table-pagination>'),e.put("app/main/apps/motiondialer/views/realtime/ivr_campaigns/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.IVR_CAMPAIGNS">Ivr Campaigns</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getCampaigns()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- QUEUE TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCampaigns">\n      <tr md-row>\n        <th md-column>{{\'MOTIONDIALER.NAME\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TOTAL\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TOTAL_MANAGED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.LIMITED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.ORIGINATED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.MESSAGE\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.CALLYSQUAREPROJECT\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TRUNK\' | translate }}</th>\n        <th md-column>{{\'MOTIONDIALER.ACTIVE\' | translate }}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.campaigns">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(id, campaign) in vm.campaigns">\n        <td md-cell>\n          <span>{{campaign.name}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.ivrTotalCallsDays || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.ivrAnswerCallsDay || 0}} ({{(campaign.ivrTotalCallsDays) ? (campaign.ivrAnswerCallsDay || 0) * 100/(campaign.ivrTotalCallsDays ) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.limitCalls || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.originated || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.message ? (\'MOTIONDIALER.\'+campaign.message | translate) : \'--\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.dialQueueProject || \'--\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{campaign.Trunk ? campaign.Trunk.name : \'--\'}}</span>\n        </td>\n        <td md-cell>\n          <md-icon md-colors="{color: {{campaign.active ? \'\\\'green\\\'\' : \'\\\'red\\\'\'}}}" md-font-icon="{{campaign.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.createOrEditIvrCampaign($event, campaign)" translate="MOTIONDIALER.EDIT_CAMPAIGN">\n                  Edit Campaign\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getCampaigns" md-page-select></md-table-pagination>\n\x3c!-- / QUEUE TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/motiondialer/views/realtime/queue_calls/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.QUEUE_CALLS">Queue Calls</span>\n  </div>\n</md-toolbar>\n\x3c!-- QUEUES TABLE --\x3e\n<md-table-container>\n  <table md-table>\n    <thead md-head>\n      <tr md-row>\n        <th md-column width="30px"></th>\n        <th md-column>{{ \'MOTIONDIALER.DID\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.QUEUE\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.CALLER\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.AGENT\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.DURATION\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.getSize(vm.rpcVoiceQueuesChannels)">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(key, channel) in vm.rpcVoiceQueuesChannels | limitObjectFromTo: vm.queryChannels.limit:(vm.queryChannels.page - 1) * vm.queryChannels.limit">\n        <td md-cell>\n          <md-icon ng-if="channel.queuecallerleaveAt" md-font-icon="icon-phone-in-talk green-fg"></md-icon>\n          <md-icon ng-if="!channel.queuecallerleaveAt" md-font-icon="icon-phone-incoming md-accent"></md-icon>\n        </td>\n        <td md-cell>{{channel.exten}}</td>\n        <td md-cell>{{channel.queue}}</td>\n        <td md-cell privacy ng-cloak>{{channel.calleridnum}}</td>\n        <td md-cell>\n          <span ng-if="channel.queuecallerleaveAt">\n            {{channel.connectedlinename}}, {{channel.connectedlinenum}}\n            <span class="text-boxed">\n              <timer start-time="channel.queuecallerleaveAt"></timer>\n            </span>\n          </span>\n          <span ng-if="!channel.queuecallerleaveAt" class="text-boxed">\n            {{ \'MOTIONDIALER.WAITING_FOR_AGENT\' | translate }}\n            <timer start-time="channel.queuecallerjoinAt"></timer>\n          </span>\n        </td>\n        <td md-cell>\n          <span class="text-boxed">\n            <timer start-time="channel.queuecallerjoinAt"></timer>\n          </span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="2">\n              <md-menu-item>\n                <md-button ng-click="vm.hangup(channel.uniqueid)" translate="MOTIONDIALER.HANGUP">\n                  Hangup\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.redirectToNumber($event, channel.uniqueid)" translate="MOTIONDIALER.REDIRECT_TO_NUMBER">\n                  Number\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-menu class="no-margin">\n                  <md-button ng-mouseenter="vm.getAvailableAgents()" translate="MOTIONDIALER.REDIRECT_TO_AGENT">\n                    Redirect to Agent</md-button>\n                  <md-menu-content>\n                    <md-menu-item ng-if="!vm.availableAgents">\n                      <md-progress-circular class="md-accent auto-margin" md-diameter="32" md-mode="indeterminate">\n                      </md-progress-circular>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.availableAgents.length > 0" ng-repeat="agent in vm.availableAgents">\n                      <md-button ng-click="vm.redirectToAgent(channel.uniqueid, agent.name, agent.context)">\n                        {{agent.name}}</md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.availableAgents.length === 0">\n                      <span>No agents available</span>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.queryChannels.limit" md-page="vm.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm.getSize(vm.rpcVoiceQueuesChannels)}}" md-page-select></md-table-pagination>\n\x3c!-- / QUEUES TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/motiondialer/views/realtime/queue_params/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.QUEUE_PARAMETERS">Params</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- QUEUE TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column>{{\'\n                                MOTIONDIALER.NAME\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.TOTAL\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.TOTAL_OFFERED\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.MANAGED\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.ABANDONED\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.DROPPED\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.AVG_HOLD_TIME\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.AVG_DURATION\' | translate}}</th>\n        <th md-column>{{\'\n                                MOTIONDIALER.AVG_BILLABLE\' | translate}}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(id, queue) in vm.queues">\n        <td md-cell>\n          <span>{{queue.name}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{(queue.answered + queue.outboundNoAnswerCallsDay + queue.outboundBusyCallsDay + queue.outboundCongestionCallsDay + queue.outboundNoSuchCallsDay + queue.outboundUnknownCallsDay + queue.outboundDropCallsDayTimeout + queue.outboundDropCallsDayCallersExit + queue.outboundBlacklistCallsDay + queue.outboundOriginateFailureCallsDay + queue.outboundAnswerAgiCallsDay + queue.outboundReCallsDay + queue.outboundRejectCallsDay )|| 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{queue.total || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered || 0}} ({{(queue.answered) ? (100 - (((queue.outboundDropCallsDayTimeout || 0) * 100/(queue.total)) | number:1 ) - (((queue.outboundDropCallsDayCallersExit || 0) * 100/(queue.total )) | number:1 )  ) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.outboundDropCallsDayCallersExit || 0}} ({{(queue.outboundDropCallsDayCallersExit) ? (queue.outboundDropCallsDayCallersExit || 0) * 100/(queue.total ) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.outboundDropCallsDayTimeout || 0}} ({{(queue.outboundDropCallsDayTimeout) ? (queue.outboundDropCallsDayTimeout || 0) * 100/(queue.total) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.total ? (queue.sumHoldTime / queue.total) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.total ? (queue.sumDuration / queue.total) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered ? ((queue.sumBillable || 0) / queue.answered) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>\n\x3c!-- / QUEUE TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/motiondialer/views/realtime/queues/predictive/dialog.html",'<md-dialog class="predictive-dialog" aria-label="New predictive">\n  <md-toolbar class="md-accent md-hue-2">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span class="title">{{ vm.queueCampaign.name }} Info</span>\n      <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-dialog-content class="text-center">\n    <ds-widget-clock data-show-digital></ds-widget-clock>\n    <div ng-if="!vm.queueCampaign.startProgressive && !vm.queueCampaign.startPredictive">\n      <div class="md-title"><span translate="MOTIONDIALER.PREDICTIVE_IS_NOT_RUNNING">Predictive is not running</span></div>\n    </div>\n\n    <div ng-if="vm.queueCampaign.startProgressive && !vm.queueCampaign.startPredictive" class="m-10">\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-headline"><span translate="MOTIONDIALER.DATA_COLLECTION_IN_PROGRESSIVE">Data collection in progressive</span></div>\n          <div class="md-subhead">({{vm.queueCampaign.dialPredictiveInterval}} minutes)</div>\n        </div>\n      </div>\n\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.STARTTIME">Start Time</span></div>\n          <div class="md-headline">{{ vm.setFormatTime(vm.queueCampaign.startProgressive) }}</div>\n        </div>\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.ENDTIME">End Time</span></div>\n          <div class="md-headline">\n            {{ vm.addMinutes(vm.queueCampaign.startProgressive, vm.queueCampaign.dialPredictiveInterval) }}\n          </div>\n        </div>\n      </div>\n      <div>\n        <span class="text-boxed blue-bg white-fg">\n          {{vm.queueCampaign.message ? (\'MOTIONDIALER.\' + vm.queueCampaign.message | translate) : \'--\'}}\n        </span>\n      </div>\n    </div>\n    <div ng-if="vm.queueCampaign.startPredictive" class="m-10">\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-headline"><span translate="MOTIONDIALER.PREDICTIVE_IS_RUNNING">Predictive is runnning</span></div>\n          <div class="md-subhead">({{vm.queueCampaign.dialPredictiveInterval}} minutes)</div>\n        </div>\n      </div>\n\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.STARTTIME">Start Time</span></div>\n          <div class="md-headline">{{ vm.setFormatTime(vm.queueCampaign.startPredictive) }}</div>\n        </div>\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.ENDTIME">End Time</span></div>\n          <div class="md-headline">\n            {{ vm.addMinutes(vm.queueCampaign.startPredictive, vm.queueCampaign.dialPredictiveInterval) }}\n          </div>\n        </div>\n      </div>\n      <div>\n        <span class="text-boxed blue-bg white-fg">\n          {{vm.queueCampaign.message ? (\'MOTIONDIALER.\' + vm.queueCampaign.message | translate) : \'--\'}}\n        </span>\n      </div>\n      <div class="row">\n        <md-card>\n          <md-toolbar class="md-table-toolbar md-default">\n            <div class="md-toolbar-tools">\n              <span class="md-subhead">Predictive - {{ \'MOTIONDIALER.PREVIOUS_INTERVAL\' | translate }}</span>\n            </div>\n          </md-toolbar>\n          <md-table-container>\n            <table md-table>\n              <tbody md-body>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.TOTAL_CALLS">Total Calls</span></td>\n                  <td md-cell>{{ vm.queueCampaign.predictiveIntervalTotalCalls }}</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.ANSWERED_CALLS">Total Calls</span></td>\n                  <td md-cell>{{ vm.queueCampaign.predictiveIntervalAnsweredCalls }}</td>\n                </tr>\n                \x3c!-- Temporaneamente non mostrate perchè contengono anche i dati dell\'intervallo corrente --\x3e\n                \x3c!-- <tr md-row>\n                                    <td md-cell>Dropped Calls Timeout</td>\n                                    <td md-cell>{{ vm.queueCampaign.predictiveIntervalDroppedCallsTimeout }}</td>\n                                </tr>\n                                <tr md-row>\n                                    <td md-cell>Dropped Calls Caller Exit</td>\n                                    <td md-cell>{{ vm.queueCampaign.predictiveIntervalDroppedCallsCallersExit }}\n                                    </td>\n                                </tr> --\x3e\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.AVG_HOLD_TIME">AVG Hold Time</span></td>\n                  <td md-cell>~ {{ vm.queueCampaign.predictiveIntervalAvgHoldtime | number:0 }}s</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.AVG_TALK_TIME">AVG Talk Time</span></td>\n                  <td md-cell>~ {{ vm.queueCampaign.predictiveIntervalAvgTalktime | number:0 }}s</td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n        </md-card>\n        <md-card>\n          <md-toolbar class="md-table-toolbar md-default">\n            <div class="md-toolbar-tools">\n              <span class="md-subhead">ErlangB - {{ \'MOTIONDIALER.CURRENT_INTERVAL\' | translate }}</span>\n            </div>\n          </md-toolbar>\n          <md-table-container>\n            <table md-table>\n              <tbody md-body>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.SCHEDULED_CALLS">Scheduled Calls</span></td>\n                  <td md-cell>{{ vm.queueCampaign.erlangCalls }}</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.ONE_CALL_EVERY">One call every</span></td>\n                  <td md-cell>~ {{ vm.queueCampaign.erlangCallToSecond | number:0 }}s</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.DROPRATE">Drop Rate</span></td>\n                  <td md-cell>{{ vm.queueCampaign.erlangAbandonmentRate * 100 | number:2 }}%</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.AGENTBUSYFACTOR">Agent Busy Factor</span></td>\n                  <td md-cell>{{ vm.queueCampaign.erlangBusyFactor * 100 | number:2 }}%</td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n        </md-card>\n      </div>\n    </div>\n\n\n  </md-dialog-content>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.TALKING\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.BUSY\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.WAITING\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.ORIGINATED_TEXT\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.MESSAGE\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.METHOD\' | translate }}</th>\n        <th md-column>{{ \'MOTIONDIALER.TRUNK\' | translate }}</th>\n        <th md-column md-order-by="dialActive">{{ \'MOTIONDIALER.ACTIVE\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="12">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedInDb }} ({{ queue.loggedIn }})</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.talking  + queue.pTalking}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedInDb - queue.available - queue.paused - queue.talking - queue.waiting\n               }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.originated }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{ queue.message ? (\'MOTIONDIALER.\'+queue.message | translate) : \'--\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.dialMethod || 0 }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{ queue.Trunk ? queue.Trunk.name : \'--\' }}</span>\n        </td>\n        <td md-cell>\n          <md-icon md-colors="{color: {{queue.dialActive ? \'\\\'green\\\'\' : \'\\\'red\\\'\'}}}" md-font-icon="{{queue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="MOTIONDIALER.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item ng-if="queue.dialMethod == \'predictive\'">\n                <md-button ng-click="vm.showPredictiveQueueCampaignInfo($event, queue)" translate="MOTIONDIALER.SHOW_PREDICTIVE_QUEUE_CAMPAIGN_INFO">\n                  Show Predictive Info\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="MOTIONDIALER.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/motiondialer/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.QUEUE_CALLS">Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.ABANDONEDCALLS">Abandoned Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.QUEUE_PARAMS">Queue Parameters</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.IVR_CAMPAIGNS">Ivr Campaigns</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/create/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.openchannelAccount.name" ng-required="true" autofocus ng-disabled="!vm.newOpenchannelAccount">\n\n        <div ng-messages="openchannelAccountForm[\'name\'].$error" ng-show="openchannelAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.openchannelAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="openchannelAccountForm[\'key\'].$error" ng-show="openchannelAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.REPLYURI">replyUri</label>\n        <input type="url" name="replyUri" ng-model="vm.openchannelAccount.replyUri">\n\n        <div class="hint"><span translate="OPENCHANNEL.HELP.REPLYURI"></span></div>\n        <div ng-messages="openchannelAccountForm[\'replyUri\'].$error" ng-show="openchannelAccountForm[\'replyUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.REPLYURI_REQUIRED">replyUri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="OPENCHANNEL.ERRORS.REPLYURI_MUST_VALID_URL">replyUri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.openchannelAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.LIST"></span></div>\n        <div ng-messages="openchannelAccountForm[\'ListId\'].$error" ng-show="openchannelAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.openchannelAccount.description">\n\n        <div ng-messages="openchannelAccountForm[\'description\'].$error" ng-show="openchannelAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOpenchannelAccount" ng-click="vm.saveOpenchannelAccount()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountForm.$invalid || openchannelAccountForm.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOpenchannelAccount" ng-click="vm.addNewOpenchannelAccount()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountForm.$invalid" aria-label="ADD" translate="OPENCHANNEL.ADD_OPENCHANNELACCOUNT" translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELACCOUNT">\n          ADD OPENCHANNELACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOpenchannelAccount" ng-click="vm.deleteOpenchannelAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="OPENCHANNEL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="OPENCHANNEL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",'<md-dialog class="openchannelAccount-dialog" aria-label="openchannelAccount" ng-init="vm.onInit()">\n  <form name="openchannelAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="OPENCHANNEL.AGENTADD_OPENCHANNELACCOUNT">Add Agent to openchannelAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/agent/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'agent\'].$error" ng-show="openchannelAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'timeout\'].$error" ng-show="openchannelAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/amazonlex/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'accesskeyid\'].$error" ng-show="openchannelAccountFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'secretaccesskey\'].$error" ng-show="openchannelAccountFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'lexregion\'].$error" ng-show="openchannelAccountFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'botname\'].$error" ng-show="openchannelAccountFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="openchannelAccountFormApp[\'welcomemessage\'].$error" ng-show="openchannelAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'times\'].$error" ng-show="openchannelAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="openchannelAccountFormApp[\'text\'].$error" ng-show="openchannelAccountFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/close/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'disposition\'].$error" ng-show="openchannelAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/dialogflow/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'key\'].$error" ng-show="openchannelAccountFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'language\'].$error" ng-show="openchannelAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="openchannelAccountFormApp[\'welcomemessage\'].$error" ng-show="openchannelAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'projectId\'].$error" ng-show="openchannelAccountFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'clientEmail\'].$error" ng-show="openchannelAccountFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="openchannelAccountFormApp[\'privateKey\'].$error" ng-show="openchannelAccountFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'language\'].$error" ng-show="openchannelAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="openchannelAccountFormApp[\'welcomemessage\'].$error" ng-show="openchannelAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'condition\'].$error" ng-show="openchannelAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'truepriority\'].$error" ng-show="openchannelAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'falsepriority\'].$error" ng-show="openchannelAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'priority\'].$error" ng-show="openchannelAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/noop/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'value\'].$error" ng-show="openchannelAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/queue/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'queue\'].$error" ng-show="openchannelAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'timeout\'].$error" ng-show="openchannelAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/system/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'command\'].$error" ng-show="openchannelAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'variable\'].$error" ng-show="openchannelAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/tag/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'tag\'].$error" ng-show="openchannelAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/openchannelCannedAnswers/dialog.html",'<md-dialog class="openchannelCannedAnswer-dialog" aria-label="New OpenchannelCannedAnswer">\n  <form name="openchannelCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.openchannelCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="openchannelCannedAnswerForm[\'key\'].$error" ng-show="openchannelCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.openchannelCannedAnswer.value" required></textarea>\n\n        <div ng-messages="openchannelCannedAnswerForm[\'value\'].$error" ng-show="openchannelCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.openchannelCannedAnswer.description">\n\n        <div ng-messages="openchannelCannedAnswerForm[\'description\'].$error" ng-show="openchannelCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOpenchannelCannedAnswer" ng-click="vm.saveOpenchannelCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="openchannelCannedAnswerForm.$invalid || openchannelCannedAnswerForm.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOpenchannelCannedAnswer" ng-click="vm.addNewOpenchannelCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="openchannelCannedAnswerForm.$invalid" aria-label="ADD" translate="OPENCHANNEL.ADD_OPENCHANNELCANNEDANSWER" translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELCANNEDANSWER">\n          ADD OPENCHANNELCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOpenchannelCannedAnswer" ng-click="vm.deleteOpenchannelCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="OPENCHANNEL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="OPENCHANNEL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/view.html",'<div id="openchannel-openchannelAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-openchannelAccounts-button md-icon-button" aria-label="Go to openchannelAccounts" ng-click="vm.gotoOpenchannelAccounts()" translate translate-attr-aria-label="OPENCHANNEL.GO_TO_OPENCHANNELACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="openchannelAccount-image" hide-xs>\n          <img ng-src="assets/images/business/openchannelAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.openchannelAccount.id}}\n            <span ng-if="vm.openchannelAccount.name">{{vm.openchannelAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="OPENCHANNEL.CREATED_AT"></span> <span>{{vm.openchannelAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.openchannelAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="OPENCHANNEL.AGENTADD_OPENCHANNELACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveOpenchannelAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (proxyForm.$invalid) || (dispositionForm.$invalid) || (openchannelDispositionsForm.$invalid) || (openchannelCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.openchannelAccount.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.openchannelAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="OPENCHANNEL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.REPLYURI">replyUri</label>\n                <input type="url" name="replyUri" ng-model="vm.openchannelAccount.replyUri" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="OPENCHANNEL.HELP.REPLYURI"></span></div>\n                <div ng-messages="generalForm[\'replyUri\'].$error" ng-show="generalForm[\'replyUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.REPLYURI_REQUIRED">replyUri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="OPENCHANNEL.ERRORS.REPLYURI_MUST_VALID_URL">replyUri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.openchannelAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="OPENCHANNEL.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.openchannelAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.MAPKEY">MapKey</label>\n                <md-select name="mapKey" ng-model="vm.openchannelAccount.mapKey" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">None</md-option>\n                  <md-optgroup label="standard">\n                    <md-option ng-value="mapKey.columnName" ng-repeat="mapKey in vm.fields" ng-if="!mapKey.columnName.toString().startsWith(\'cf_\')" ng-disabled="mapKey.canSelect === false">{{ mapKey.displayName }}</md-option>\n                  </md-optgroup>\n                  <md-optgroup label="custom">\n                    <md-option ng-value="mapKey.columnName" ng-repeat="mapKey in vm.fields" ng-if="mapKey.columnName.toString().startsWith(\'cf_\')" ng-disabled="mapKey.canSelect === false">{{ mapKey.displayName }}</md-option>\n                  </md-optgroup>\n                </md-select>\n                <div ng-messages="generalForm[\'mapKey\'].$error" ng-show="generalForm[\'mapKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.MAPKEY_REQUIRED">MapKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.openchannelAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.RECEIVEURI">receiveUri</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-receiveUri" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-receiveUri" name="receiveUri" ng-value="vm.location + \'/api/openchannel/accounts/\' + vm.openchannelAccount.id + \'/notify\'" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="OPENCHANNEL.HELP.RECEIVEURI"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="openchannelAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="OPENCHANNEL.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.openchannelAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="openchannelAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.openchannelAccount.queueTransfer == true" class="md-block">\n                <label translate="OPENCHANNEL.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.openchannelAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.openchannelAccount.agentTransfer == true" class="md-block">\n                <label translate="OPENCHANNEL.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.openchannelAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container proxy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.PROXY">PROXY</div>\n            </div>\n            <form name="proxyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.TOKEN">token</label>\n                <input type="text" name="token" ng-model="vm.openchannelAccount.token" autofocus disabled>\n\n                <div class="hint"><span translate="OPENCHANNEL.HELP.TOKEN"></span></div>\n                <div ng-messages="proxyForm[\'token\'].$error" ng-show="proxyForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.TOKEN_REQUIRED">token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="openchannelAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.openchannelAccount.mandatoryDisposition" class="md-block">\n                <label translate="OPENCHANNEL.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.openchannelAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="OPENCHANNEL.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="OpenchannelAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.openchannelAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="openchannelAccount-detail-form-container openchanneldispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedOpenchannelAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="OPENCHANNEL.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add openchannel dispositions" translate translate-attr-label="OPENCHANNEL.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="openchannelAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'OPENCHANNEL.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container openchannelcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="OpenchannelAccountOpenchannelCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.openchannelAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="OPENCHANNEL.OPENCHANNELCANNEDANSWERS">OpenchannelCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getOpenchannelAccountOpenchannelCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event)" aria-label="add openchannelCannedAnswer" translate translate-attr-label="OPENCHANNEL.ADD_OPENCHANNELCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length}} {{vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedOpenchannelAccountOpenchannelCannedAnswers" csv-label="true" filename="openchannelAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedOpenchannelAccountOpenchannelCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getOpenchannelAccountOpenchannelCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'OPENCHANNEL.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'OPENCHANNEL.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'OPENCHANNEL.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'OPENCHANNEL.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'OPENCHANNEL.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="openchannelCannedAnswer" md-select-id="id" ng-repeat="openchannelCannedAnswer in vm_dc.openchannelAccountOpenchannelCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{ openchannelCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" translate="OPENCHANNEL.EDIT_OPENCHANNELCANNEDANSWER">\n                                Edit OpenchannelCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(openchannelCannedAnswer, $event)" translate="OPENCHANNEL.DELETE_OPENCHANNELCANNEDANSWER">\n                                Delete OpenchannelCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.openchannelAccountOpenchannelCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="OPENCHANNEL.NO_OPENCHANNELCANNEDANSWER_AVAILABLE">No openchannelcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.openchannelAccountOpenchannelCannedAnswers.count}}" md-on-paginate="vm_dc.getOpenchannelAccountOpenchannelCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="OpenchannelAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.openchannelAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="OPENCHANNEL.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedOpenchannelAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedOpenchannelAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedOpenchannelAccountApps.length}} {{vm_ac.selectedOpenchannelAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedOpenchannelAccountApps($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedOpenchannelAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.openchannelAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editOpenchannelAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editOpenchannelAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editOpenchannelAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editOpenchannelAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.openchannelAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="OpenchannelAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.openchannelAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedOpenchannelAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="OPENCHANNEL.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getOpenchannelAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getOpenchannelAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getOpenchannelAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="OPENCHANNEL.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedOpenchannelAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedOpenchannelAccountInteractions.length}} {{vm_dc.selectedOpenchannelAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedOpenchannelAccountInteractions" csv-label="true" filename="openchannelAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedOpenchannelAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedOpenchannelAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getOpenchannelAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'OPENCHANNEL.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'OPENCHANNEL.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'OPENCHANNEL.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'OPENCHANNEL.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'OPENCHANNEL.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'OPENCHANNEL.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'OPENCHANNEL.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.openchannelAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'OPENCHANNEL.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'OPENCHANNEL.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spyopenchannelInteraction($event, interaction)" translate="OPENCHANNEL.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || (vm_dc.userProfile.downloadOmnichannelInteractions && vm_dc.userProfile.downloadAttachments)">\n                              <md-button class="md-primary" ng-click="vm_dc.openchannelInteractionDownload(interaction, $event, true)" translate="OPENCHANNEL.DOWNLOAD_WITH_ATTACHMENTS">\n                                Download with attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.openchannelInteractionDownload(interaction, $event)" translate="OPENCHANNEL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                                Download without attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="OPENCHANNEL.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.openchannelAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="OPENCHANNEL.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.openchannelAccountInteractions.count}}" md-on-paginate="vm_dc.getOpenchannelAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/openchannelAccounts.html",'<div id="openchannelAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-google-earth" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="OPENCHANNEL.OPENCHANNELACCOUNTS">OpenchannelAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="OPENCHANNEL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedOpenchannelAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedOpenchannelAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="OPENCHANNEL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-openchannelAccounts-count">\n          <span>{{vm.selectedOpenchannelAccounts.length}}</span>\n          <span translate="OPENCHANNEL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="OPENCHANNEL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllOpenchannelAccounts()" translate="OPENCHANNEL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectOpenchannelAccounts()" translate="OPENCHANNEL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedOpenchannelAccounts" csv-label="true" filename="openchannelAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedOpenchannelAccounts($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- OPENCHANNELACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedOpenchannelAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOpenchannelAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'OPENCHANNEL.KEY\' | translate }}</th>\n                <th md-column md-order-by="replyUri">{{ \'OPENCHANNEL.REPLYURI\' | translate }}</th>\n                <th md-column md-order-by="ListId">{{ \'OPENCHANNEL.LIST\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'OPENCHANNEL.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.openchannelAccounts.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="openchannelAccount" md-select-id="id" ng-repeat="openchannelAccount in vm.openchannelAccounts.rows">\n                <td md-cell ng-if="openchannelAccount.userpic"><img class="avatar" alt="{{openchannelAccount.name}}" ng-src="api/users/{{openchannelAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!openchannelAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{openchannelAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="id ">{{openchannelAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="name ">{{openchannelAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="key ">{{openchannelAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="replyUri ">{{openchannelAccount.replyUri}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="ListId ">{{ (vm.lists | filter : {\'id\':openchannelAccount.ListId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="description ">{{openchannelAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(openchannelAccount, $event    )" translate="OPENCHANNEL.EDIT_OPENCHANNELACCOUNT">\n                          Edit OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(openchannelAccount, $event    )" translate="OPENCHANNEL.INTERACTIONS_OPENCHANNELACCOUNT">\n                          Interactions OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(openchannelAccount, $event    )" translate="OPENCHANNEL.AGENTADD_OPENCHANNELACCOUNT">\n                          AgentAdd OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(openchannelAccount, $event    )" translate="OPENCHANNEL.DELETE_OPENCHANNELACCOUNT">\n                          Delete OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.openchannelAccounts.count}}" md-on-paginate="vm.getOpenchannelAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / OPENCHANNELACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD OPENCHANNELACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-openchannelAccount-button" ng-click="vm.createOrEditOpenchannelAccount($event)" aria-label="add openchannelAccount" translate translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD OPENCHANNELACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/openchannel/views/openchannelQueues/create/dialog.html",'<md-dialog class="openchannelQueue-dialog" aria-label="New OpenchannelQueue">\n  <form name="openchannelQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.openchannelQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newOpenchannelQueue">\n\n        <div class="hint"><span translate="OPENCHANNEL.HELP.NAME"></span></div>\n        <div ng-messages="openchannelQueueForm[\'name\'].$error" ng-show="openchannelQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="OPENCHANNEL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.openchannelQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="openchannelQueueForm[\'strategy\'].$error" ng-show="openchannelQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.openchannelQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="openchannelQueueForm[\'timeout\'].$error" ng-show="openchannelQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.openchannelQueue.description">\n\n        <div ng-messages="openchannelQueueForm[\'description\'].$error" ng-show="openchannelQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOpenchannelQueue" ng-click="vm.saveOpenchannelQueue()" class="send-button md-accent md-raised" ng-disabled="openchannelQueueForm.$invalid || openchannelQueueForm.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOpenchannelQueue" ng-click="vm.addNewOpenchannelQueue()" class="send-button md-accent md-raised" ng-disabled="openchannelQueueForm.$invalid" aria-label="ADD" translate="OPENCHANNEL.ADD_OPENCHANNELQUEUE" translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELQUEUE">\n          ADD OPENCHANNELQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOpenchannelQueue" ng-click="vm.deleteOpenchannelQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="OPENCHANNEL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="OPENCHANNEL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",'<md-dialog class="openchannelQueue-dialog" aria-label="openchannelQueue" ng-init="vm.onInit()">\n  <form name="openchannelQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="OPENCHANNEL.AGENTADD_OPENCHANNELQUEUE">Add Agent to openchannelQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",'<md-dialog class="openchannelQueue-dialog" aria-label="openchannelQueue" ng-init="vm.onInit()">\n  <form name="openchannelQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="OPENCHANNEL.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelQueues/edit/view.html",'<div id="openchannel-openchannelQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-openchannelQueues-button md-icon-button" aria-label="Go to openchannelQueues" ng-click="vm.gotoOpenchannelQueues()" translate translate-attr-aria-label="OPENCHANNEL.GO_TO_OPENCHANNELQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="openchannelQueue-image" hide-xs>\n          <img ng-src="assets/images/business/openchannelQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.openchannelQueue.id}}\n            <span ng-if="vm.openchannelQueue.name">{{vm.openchannelQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="OPENCHANNEL.CREATED_AT"></span> <span>{{vm.openchannelQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.openchannelQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="OPENCHANNEL.TEAMADD_OPENCHANNELQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.openchannelQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="OPENCHANNEL.AGENTADD_OPENCHANNELQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveOpenchannelQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.openchannelQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="OPENCHANNEL.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="OPENCHANNEL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.openchannelQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.openchannelQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.openchannelQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/openchannel/views/openchannelQueues/openchannelQueues.html",'<div id="openchannelQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-google-earth" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="OPENCHANNEL.OPENCHANNELQUEUES">OpenchannelQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="OPENCHANNEL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedOpenchannelQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedOpenchannelQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="OPENCHANNEL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-openchannelQueues-count">\n          <span>{{vm.selectedOpenchannelQueues.length}}</span>\n          <span translate="OPENCHANNEL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="OPENCHANNEL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllOpenchannelQueues()" translate="OPENCHANNEL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectOpenchannelQueues()" translate="OPENCHANNEL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedOpenchannelQueues" csv-label="true" filename="openchannelQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedOpenchannelQueues($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- OPENCHANNELQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedOpenchannelQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOpenchannelQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'OPENCHANNEL.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.openchannelQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="openchannelQueue" md-select-id="id" ng-repeat="openchannelQueue in vm.openchannelQueues.rows">\n                <td md-cell ng-if="openchannelQueue.userpic"><img class="avatar" alt="{{openchannelQueue.name}}" ng-src="api/users/{{openchannelQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!openchannelQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{openchannelQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelQueue, ev) : vm.createOrEditOpenchannelQueue($event, openchannelQueue)" md-cell class="id ">{{openchannelQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelQueue, ev) : vm.createOrEditOpenchannelQueue($event, openchannelQueue)" md-cell class="name ">{{openchannelQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelQueue, ev) : vm.createOrEditOpenchannelQueue($event, openchannelQueue)" md-cell class="strategy ">{{ vm.arraystrategy[openchannelQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(openchannelQueue, $event    )" translate="OPENCHANNEL.EDIT_OPENCHANNELQUEUE">\n                          Edit OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(openchannelQueue, $event    )" translate="OPENCHANNEL.TEAMADD_OPENCHANNELQUEUE">\n                          teamadd OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(openchannelQueue, $event    )" translate="OPENCHANNEL.AGENTADD_OPENCHANNELQUEUE">\n                          agentadd OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(openchannelQueue, $event    )" translate="OPENCHANNEL.DELETE_OPENCHANNELQUEUE">\n                          Delete OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(openchannelQueue, $event    )" translate="OPENCHANNEL.GOTOREALTIME_OPENCHANNELQUEUE">\n                          goToRealtime OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.openchannelQueues.count}}" md-on-paginate="vm.getOpenchannelQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / OPENCHANNELQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD OPENCHANNELQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-openchannelQueue-button" ng-click="vm.createOrEditOpenchannelQueue($event)" aria-label="add openchannelQueue" translate translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD OPENCHANNELQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/openchannel/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="OPENCHANNEL.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n        <th md-column>{{ \'OPENCHANNEL.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'OPENCHANNEL.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'OPENCHANNEL.WAITING\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedIn }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="OPENCHANNEL.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="OPENCHANNEL.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/openchannel/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/plugins/views/plugin/plugin.html",'<div ng-if="!vm.plugin">\n  <p>Plugin not available...</p>\n</div>\n<div id="plugin" ng-if="vm.plugin" ng-cloak layout-fill>\n  <iframe ng-src="{{vm.getTrustedURL()}}" frameborder=0 style="border:0px; width:100%; height:100%;"></iframe>\n</div>'),e.put("app/main/apps/realtime/views/agents/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools quick-filter-container">\n    <span class="md-subhead" translate="VOICE.AGENTS">Agents</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getAgents()" query="vm.query" debounce="300"></ms-search-bar>\n    <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = \'\'; vm.getAgents()">\n      <md-option ng-value="\'\'">{{ \'VOICE.ALL\' | translate }}</md-option>\n      <md-option value="pause">{{ \'VOICE.PAUSE\' | translate }}</md-option>\n      <md-option value="*pause">{{ \'VOICE.PARTIALPAUSE\' | translate }}</md-option>\n      <md-option value="busy">{{ \'VOICE.BUSY\' | translate }}</md-option>\n      <md-option value="idle">{{ \'VOICE.IDLE\' | translate }}</md-option>\n    </md-select>\n    <md-select ng-if="vm.query.globalStatusFilter === \'pause\' || vm.query.globalStatusFilter === \'*pause\'" ng-model="vm.query.pauseTypeFilter" class="md-caption ml-16" ng-change="vm.getAgents()">\n      <md-option ng-value="\'\'">All</md-option>\n      <md-option value="DEFAULT PAUSE">DEFAULT PAUSE</md-option>\n      <md-option value="ACW">ACW</md-option>\n      <md-option value="LOGININPAUSE">LOGININPAUSE</md-option>\n      <md-option value="Auto-Pause">AUTOPAUSE</md-option>\n      <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n    </md-select>\n    <md-select ng-model="vm.query.globalQueueFilter" multiple class="md-caption margin-left-10 mw-150" placeholder="{{ \'DASHBOARDS.SELECT_QUEUE\' | translate }}" md-on-open="vm.getQueuesByChannel()" md-on-close="vm.getAgents()">\n      <md-button ng-click="vm.selectAll()" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.SELECT_ALL\' | translate}}</md-button>\n      <md-option ng-value="queue.name" ng-repeat="queue in vm.queues.rows">{{\n        queue.name }}</md-option>\n      <md-button ng-click="vm.clearSelection()" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.CLEAR\' | translate}}</md-button>\n    </md-select>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAgents">\n      <tr md-row>\n        <th class="bv text-center" colspan="5">{{ \'VOICE.AGENT\' | translate }}</th>\n        <th class="bv bl text-center" colspan="2">{{ \'VOICE.VOICE\' | translate }}</th>\n        <th ng-if="vm.license.chat" class="bv bl text-center" colspan="2">{{ \'CHAT.CHAT\' | translate }}</th>\n        <th ng-if="vm.license.mail" class="bv bl text-center" colspan="2">{{ \'MAIL.MAIL\' | translate }}</th>\n        <th ng-if="vm.license.messaging" class="bv bl text-center" colspan="2">{{ \'SMS.SMS\' | translate }}</th>\n        <th ng-if="vm.license.openchannel" class="bv bl text-center" colspan="2">\n          {{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n        <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n        <th ng-if="vm.license.whatsapp" class="bv bl text-center" colspan="2">\n          {{ \'WHATSAPP.WHATSAPP\' | translate }}</th>\n        <th width="10px" class="bt bl" rowspan="2"></th>\n      </tr>\n      <tr md-row>\n        <th class="bl" colspan="2" md-column md-order-by="fullname">\n          {{ \'VOICE.NAME\' | translate }}</th>\n        <th class="bl custom-column" md-column md-order-by="globalStatus">\n          {{ \'VOICE.STATUS\' | translate }}</th>\n        <th class="bl custom-column" md-column md-order-by="lastLoginAt">\n          {{ \'VOICE.LOGIN_TIME\' | translate }}</th>\n        <th class="bl custom-column" md-column md-order-by="lastPauseAt">\n          {{ \'VOICE.PAUSE_TIME\' | translate }}</th>\n        <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n        <th class="bl custom-column">Info</th>\n        <th ng-if="vm.license.chat" class="bl text-center">{{ \'CHAT.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.chat" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'CHAT.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.mail" class="bl text-center">{{ \'MAIL.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.mail" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'MAIL.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.messaging" class="bl text-center">{{ \'SMS.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.messaging" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'SMS.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.openchannel" class="bl text-center">{{ \'OPENCHANNEL.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.openchannel" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'OPENCHANNEL.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.fax" class="bl text-center">{{ \'FAX.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.fax" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'FAX.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.whatsapp" class="bl text-center">{{ \'WHATSAPP.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.whatsapp" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'WHATSAPP.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.agents.count > 0">\n        <td md-cell colspan="19">\n          <div layout="row" layout-align="center center">\n            <span>{{ \'VOICE.NO_AGENT_ONLINE\' | translate }}</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-select="agent" md-select-id="id" ng-repeat="agent in vm.agents.rows">\n        <td class="bt padding-5">\n          <div layout="row" layout-align="start center">\n            <img class="avatar" ng-src="{{agent.userpic && \'api/users/\'+ agent.id +\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n            <div layout="column">\n              <span>{{agent.fullname}}</span>\n              <span>{{agent.internal}}</span>\n            </div>\n          </div>\n        </td>\n        <td class="bt padding-5">\n          <div layout="row" layout-align="start center" ng-if="vm.license.screenrecording && (agent.phoneBarEnableScreenRecordingByAgent || agent.phoneBarEnableAutomaticScreenRecording)">\n            <div class="column">\n              <span>\n                <md-icon md-font-icon="icon-camcorder-box" ng-class="agent.screenrecording ? \'green-fg\' : \'grey-fg\'" aria-hidden="true">\n                  <md-tooltip>\n                    {{ agent.screenrecording ? \'VOICE.TOOLTIP_SCREENRECORDING_ON\' : \'VOICE.TOOLTIP_SCREENRECORDING_OFF\'\n                    | translate }}\n                  </md-tooltip>\n                </md-icon>\n              </span>\n            </div>\n          </div>\n        </td>\n        <td class="bt text-center">\n'+"          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','busy':'indigo-100-bg','*pause':'amber-50-bg','pause':'amber-200-bg'}[agent.globalStatus]\">\n            <span ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\">{{ 'VOICE.PAUSE' | translate | uppercase }} (</span>{{\n              ['pause', '*pause'].includes(agent.globalStatus) ? \n                ((agent.globalStatusDisplayValue === 'DEFAULT PAUSE' ? ('VOICE.DEFAULT_PAUSE' | translate) : agent.globalStatusDisplayValue) | uppercase) : \n                ('VOICE.' + (agent.globalStatusDisplayValue | uppercase) | translate | uppercase) }}<span ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\">)</span>\n          </span>\n        </td>\n        <td class=\"bt custom-column\">\n          <timer start-time=\"agent.lastLoginAt\"></timer>\n        </td>\n        <td class=\"bt custom-column\">\n          <timer ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\" start-time=\"agent.lastPauseAt\"></timer>\n        </td>\n        <td class=\"bt bl text-center\">\n          <span ng-if=\"!agent.onhold\" class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','talking':'indigo-100-bg','ringing':'orange-400-bg','pause':'amber-200-bg'}[agent.voiceStatus]\">\n            {{ 'VOICE.' + (agent.voiceStatus | uppercase) | translate | uppercase }}</span>\n          <span ng-if=\"agent.onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">\n            {{ 'VOICE.ONHOLD' | translate | uppercase }}</span>\n        </td>\n        <td class=\"bt bl\">\n          <div layout=\"column\" ng-if=\"agent.voiceStatus === 'talking' || agent.voiceStatus === 'ringing'\">\n            <span ng-if=\"agent.queue\" class=\"padding-5\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\">{{\n              agent.queue }}</span>\n            <span ng-if=\"agent.destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\" privacy ng-cloak>{{\n              agent.destconnectedlinenum }}</span>\n            <span ng-if=\"agent.routealias\" class=\"padding-5\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\">{{\n              agent.routealias }}</span>\n            <span class=\"padding-5\" ng-if=\"agent.queue || agent.destconnectedlinenum\">\n              <timer start-time=\"agent.voiceStatusTime\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\">\n              </timer>\n            </span>\n          </div>\n        </td>\n        <td class=\"bt bl text-center\" ng-if=\"vm.license.chat\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.chatStatus]\">\n            {{ 'VOICE.' + (agent.chatStatus | uppercase) | translate | uppercase }}</span>\n        </td>\n        <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.chatStatus]\">\n          {{ agent.chatCurrentCapacity }}</td>\n        <td class=\"bl bt text-center\" ng-if=\"vm.license.mail\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.mailStatus]\">\n            {{ 'VOICE.' + (agent.mailStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.mailStatus]\">\n          {{ agent.mailCurrentCapacity }}</td>\n        <td class=\"bl bt text-center\" ng-if=\"vm.license.messaging\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.smsStatus]\">\n            {{ 'VOICE.' + (agent.smsStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.smsStatus]\">\n          {{ agent.smsCurrentCapacity }}</td>\n        <td class=\"bt bl text-center\" ng-if=\"vm.license.openchannel\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.openchannelStatus]\">\n            {{ 'VOICE.' + (agent.openchannelStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.openchannelStatus]\">\n          {{ agent.openchannelCurrentCapacity }}</td>\n        <td class=\"bt bl text-center\" ng-if=\"vm.license.fax\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.faxStatus]\">\n            {{ 'VOICE.' + (agent.faxStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.faxStatus]\">\n          {{ agent.faxCurrentCapacity }}</td>\n        <td class=\"bl bt text-center\" ng-if=\"vm.license.whatsapp\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.whatsappStatus]\">\n            {{ 'VOICE.' + (agent.whatsappStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.whatsapp\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.whatsappStatus]\">\n          {{ agent.whatsappCurrentCapacity }}</td>\n        <td class=\"bl bt padding-5 text-center\" ng-if=\"vm.crudPermissions.canEdit\">\n          <md-menu>\n            <md-button class=\"md-icon-button\" aria-label=\"More\" translate translate-attr-aria-label=\"STAFF.MORE\" ng-click=\"$mdOpenMenu($event)\">\n              <md-icon md-font-icon=\"icon-dots-vertical\"></md-icon>\n            </md-button>\n            <md-menu-content width=\"4\">\n              <md-menu-item>\n                <md-button ng-click=\"vm.logout(agent, $event)\" translate=\"VOICE.LOGOUT\">\n                  Logout\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click=\"vm.addQueue(agent, $event)\" translate=\"{{ vm.channel.toUpperCase() + '.AGENTADD_QUEUE' }}\">\n                  Add Agent In Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item ng-if=\"vm.license.screenrecording && agent.phoneBarEnableScreenRecordingByAgent\">\n                <md-menu>\n                  <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"VOICE.SCREENRECORDING\">Manage Screen Recording\n                  </md-button>\n                  <md-menu-content>\n                    <md-menu-item>\n                      <md-button ng-click=\"vm.manageScreenRecording(agent, !agent.screenrecording)\" translate=\"{{ agent.screenrecording ? 'VOICE.STOP_SCREENRECORDING' : 'VOICE.START_SCREENRECORDING' }}\">\n                      </md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item>\n                <md-menu>\n                  <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"VOICE.PAUSE\">Pause</md-button>\n                  <md-menu-content>\n                    <md-menu-item>\n                      <md-button ng-disabled=\"agent.voicePause && 'DEFAULT PAUSE' === agent.pauseType\" ng-click=\"vm.pause(agent)\">\n                        <em translate=\"VOICE.DEFAULT_PAUSE\">Default Pause</em>\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if=\"vm.pauses.rows.length\" ng-repeat=\"pause in vm.pauses.rows\">\n                      <md-button ng-disabled=\"agent.voicePause && pause.name === agent.pauseType\" ng-click=\"vm.pause(agent, pause.name)\">{{pause.name}}\n                      </md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\">\n                <md-button ng-click=\"vm.unpause(agent)\" translate=\"VOICE.UNPAUSE\">\n                  Unpause\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n<md-table-pagination md-label=\"{page: '{{'VOICE.PAGE' | translate}}:', rowsPerPage: '{{'VOICE.ROWSPERPAGE' | translate}}:', of: '{{'VOICE.OF' | translate}}'}\" md-limit=\"vm.query.limit\" md-limit-options=\"[10, 15, 20, 50, 100, 250]\" md-page=\"vm.query.page\" md-total=\"{{vm.agents.rows.length}}\" md-on-paginate=\"vm.getAgents\" md-page-select></md-table-pagination>"),e.put("app/main/apps/settings/views/cloudProviders/cloudProviders.html",'<div id="cloudProviders" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.CLOUD_PROVIDERS">Cloud Providers</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SETTINGS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedAiTools.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedAiTools =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SETTINGS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-cloudProviders-count">\n          <span>{{vm.selectedAiTools.length}}</span>\n          <span translate="SETTINGS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SETTINGS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllAiTools()" translate="SETTINGS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectAiTools()" translate="SETTINGS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedAiTools" csv-label="true" filename="cloudProviders.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-click="vm.deleteSelectedAiTools($event)" aria-label="delete selected" translate translate-attr-label="SETTINGS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CLOUDPROVIDER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedAiTools" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAiTools">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SETTINGS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'SETTINGS.NAME\' | translate }}</th>\n                <th md-column md-order-by="service">{{ \'SETTINGS.SERVICE\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.cloudProviders.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SETTINGS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="cloudProvider" md-select-id="id" ng-repeat="cloudProvider in vm.cloudProviders.rows">\n                <td ng-click="vm.createOrEditCloudProvider($event, cloudProvider)" md-cell class="id">{{cloudProvider.id}}</td>\n                <td ng-click="vm.createOrEditCloudProvider($event, cloudProvider)" md-cell class="name">{{cloudProvider.name}}</td>\n                <td ng-click="vm.createOrEditCloudProvider($event, cloudProvider)" md-cell class="service">{{ vm.services[cloudProvider.service] }}</td>\n\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SETTINGS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="cloudProvider.service === \'MicrosoftAzure\'">\n                        <md-button ng-click="vm.authenticateToMicrosoftIdentityPlatform(cloudProvider)" translate="SETTINGS.AUTHENTICATE">\n                          Authenticate\n                        </md-button>\n                      </md-menu-item>\n\n                      <md-menu-item ng-if="cloudProvider.service === \'MicrosoftAzure\'">\n                        <md-button ng-click="vm.updateClientSecret(cloudProvider, $event)" translate="SETTINGS.UPDATE_CLIENT_SECRET">\n                          Update Client Secret\n                        </md-button>\n                      </md-menu-item>\n\n                      <md-menu-item>\n                        <md-button ng-click="vm.editdialog(cloudProvider, $event)" translate="SETTINGS.EDIT_CLOUDPROVIDER">\n                          Edit CloudProvider\n                        </md-button>\n                      </md-menu-item>\n\n                      <md-menu-item>\n                        <md-button ng-click="vm.deleteconfirm(cloudProvider, $event)" translate="SETTINGS.DELETE_CLOUDPROVIDER">\n                          Delete CloudProvider\n                        </md-button>\n                      </md-menu-item>\n\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SETTINGS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SETTINGS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SETTINGS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.cloudProviders.count}}" md-on-paginate="vm.getAiTools" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CLOUDPROVIDER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CLOUDPROVIDER BUTTON --\x3e\n  <md-button class="md-fab md-accent" id="add-cloudProvider-button" ng-click="vm.createOrEditCloudProvider($event)" aria-label="add cloudProvider" translate translate-attr-aria-label="SETTINGS.ADD_CLOUDPROVIDER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CLOUDPROVIDER BUTTON --\x3e\n</div>'),e.put("app/main/apps/settings/views/cloudProviders/create/dialog.html",'<md-dialog class="cloudProvider-dialog" aria-label="New CloudProvider">\n  <form name="cloudProviderForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ (vm.newCloudProvider ? \'SETTINGS.NEW_CLOUDPROVIDER\' : \'SETTINGS.EDIT_CLOUDPROVIDER\') | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.cloudProvider.name" ng-required="true" autofocus>\n\n        <div ng-messages="cloudProviderForm[\'name\'].$error" ng-show="cloudProviderForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.SERVICE">Service</label>\n        <md-select name="service" ng-model="vm.cloudProvider.service" required ng-disabled="!vm.newCloudProvider">\n          <md-option ng-if="vm.license.ai" ng-value="\'AmazonAWS\'">AmazonAWS</md-option>\n          <md-option ng-value="\'MicrosoftAzure\'">Microsoft Azure</md-option>\n        </md-select>\n        <div ng-messages="cloudProviderForm[\'service\'].$error" ng-show="cloudProviderForm[\'service\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.SERVICE_REQUIRED">Service field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.cloudProvider.service == \'MicrosoftAzure\'" class="md-block">\n        <label translate="SETTINGS.TYPE">Type</label>\n        <md-select name="service" ng-model="vm.cloudProvider.type" required ng-disabled="!vm.newCloudProvider">\n          <md-option ng-value="\'Outlook365\'">Outlook365</md-option>\n          <md-option ng-value="\'Dynamics365\'">Dynamics365</md-option>\n        </md-select>\n        <div ng-messages="cloudProviderForm[\'type\'].$error" ng-show="cloudProviderForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.cloudProvider.service == \'AmazonAWS\'" class="md-block">\n        <label translate="SETTINGS.ACCESSKEY">AccessKey</label>\n        <input type="text" name="data2" ng-model="vm.cloudProvider.data2" ng-required="true">\n\n        <div ng-messages="cloudProviderForm[\'data2\'].$error" ng-show="cloudProviderForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.ACCESSKEY_REQUIRED">AccessKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.cloudProvider.service == \'AmazonAWS\'" class="md-block">\n        <label translate="SETTINGS.SECRETACCESSKEY">SecretAccesskey</label>\n        <input type="text" name="data1" ng-model="vm.cloudProvider.data1" ng-required="true">\n\n        <div ng-messages="cloudProviderForm[\'data1\'].$error" ng-show="cloudProviderForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.SECRETACCESSKEY_REQUIRED">SecretAccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div ng-if="vm.cloudProvider.service == \'MicrosoftAzure\'">\n        <md-input-container class="md-block">\n          <label translate="SETTINGS.APPLICATION_ID">Application Id</label>\n          <input type="text" name="data1" ng-model="vm.cloudProvider.data1" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data1\'].$error" ng-show="cloudProviderForm[\'data1\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block">\n          <label translate="SETTINGS.TENANT_ID">Tenant Id</label>\n          <input type="text" name="data2" ng-model="vm.cloudProvider.data2" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data2\'].$error" ng-show="cloudProviderForm[\'data2\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container ng-if="vm.newCloudProvider" class="md-block">\n          <label translate="SETTINGS.CLIENT_SECRET">Client Secret</label>\n          <input type="password" name="data3" ng-model="vm.cloudProvider.data3" ng-required="true">\n          <div class="hint"><span translate="SETTINGS.HELP.CLIENT_SECRET"></span></div>\n\n          <div ng-messages="cloudProviderForm[\'data3\'].$error" ng-show="cloudProviderForm[\'data3\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block">\n          <label translate="SETTINGS.REDIRECT_URI">Redirect Uri</label>\n          <input type="url" name="data4" ng-model="vm.cloudProvider.data4" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data4\'].$error" ng-show="cloudProviderForm[\'data4\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n            <div ng-message="url">\n              <span translate="SETTINGS.ERRORS.WRONG_FORMAT"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container ng-if="vm.cloudProvider.type == \'Dynamics365\'" class="md-block">\n          <label translate="SETTINGS.REMOTE_URI">Remote Uri</label>\n          <input type="url" name="data7" ng-model="vm.cloudProvider.data7" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data7\'].$error" ng-show="cloudProviderForm[\'data7\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n            <div ng-message="url">\n              <span translate="SETTINGS.ERRORS.WRONG_FORMAT"></span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newCloudProvider" ng-click="vm.saveCloudProvider()" class="send-button md-accent md-raised" ng-disabled="cloudProviderForm.$invalid || cloudProviderForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newCloudProvider" ng-click="vm.addNewCloudProvider()" class="send-button md-accent md-raised" ng-disabled="cloudProviderForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_CLOUDPROVIDER" translate-attr-aria-label="SETTINGS.ADD_CLOUDPROVIDER">\n          ADD CLOUDPROVIDER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-click="vm.deleteCloudProvider($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/cloudProviders/updateSecret/updateSecret.html",'<md-dialog class="cloudProvider-dialog" aria-label="update client secret">\n  <form name="updateSecretForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'SETTINGS.UPDATE_CLIENT_SECRET\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.user.id">\n        <label translate="SETTINGS.CLIENT_SECRET">Current Client Secret</label>\n        <input type="text" name="currentSecret" ng-model="vm.cloudProvider.data3" disabled>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.NEW_CLIENT_SECRET">New Client Secret</label>\n        <input type="password" name="secret" ng-model="vm.newSecret" required>\n        <div ng-messages="updateSecretForm.secret.$error" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">New Client Secret field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveSecret()" class="send-button md-accent md-raised" ng-disabled="updateSecretForm.$invalid || updateSecretForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/customizations/create/dialog.html",'<md-dialog class="customization-dialog" aria-label="New Customization">\n  <form name="customizationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultLogo" aria-label="Default_Logo"><span translate="SETTINGS.DEFAULT_LOGO">Default_Logo</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultLoginLogo" aria-label="Default_Login_Logo"><span translate="SETTINGS.DEFAULT_LOGIN_LOGO">Default_Login_Logo</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultFavicon" aria-label="Default_Favicon"><span translate="SETTINGS.DEFAULT_FAVICON">Default_Favicon</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultHeaderWhiteLabel" aria-label="Default_Header_WhiteLabel"><span translate="SETTINGS.DEFAULT_HEADER_WHITELABEL">Default_Header_WhiteLabel</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.customization.defaultHeaderWhiteLabel" class="md-block">\n        <label translate="SETTINGS.HEADER_WHITELABEL">Header_WhiteLabel</label>\n        <input type="text" name="headerWhiteLabel" ng-model="vm.customization.headerWhiteLabel" ng-required="true">\n\n        <div ng-messages="customizationForm[\'headerWhiteLabel\'].$error" ng-show="customizationForm[\'headerWhiteLabel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.HEADER_WHITELABEL_REQUIRED">Header_WhiteLabel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultPageTitle" aria-label="Default_Page_Title"><span translate="SETTINGS.DEFAULT_PAGE_TITLE">Default_Page_Title</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.customization.defaultPageTitle" class="md-block">\n        <label translate="SETTINGS.PAGE_TITLE">Page_Title</label>\n        <input type="text" name="pageTitle" ng-model="vm.customization.pageTitle" ng-required="true">\n\n        <div ng-messages="customizationForm[\'pageTitle\'].$error" ng-show="customizationForm[\'pageTitle\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.PAGE_TITLE_REQUIRED">Page_Title field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.license.preferred" class="md-block">\n        <md-switch ng-model="vm.customization.defaultPreferred" aria-label="Default_Preferred"><span translate="SETTINGS.DEFAULT_PREFERRED">Default_Preferred</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCustomization" ng-click="vm.saveCustomization()" class="send-button md-accent md-raised" ng-disabled="customizationForm.$invalid || customizationForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCustomization" ng-click="vm.addNewCustomization()" class="send-button md-accent md-raised" ng-disabled="customizationForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_CUSTOMIZATION" translate-attr-aria-label="SETTINGS.ADD_CUSTOMIZATION">\n          ADD CUSTOMIZATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCustomization" ng-click="vm.deleteCustomization($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/customizations/customizations.html",'<div id="customizations" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.CUSTOMIZATIONS">Customizations</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div>\n      <md-button type="submit" ng-click="vm.saveCustomization()" ng-disabled="(customizationsForm.$pristine && logoForm.$pristine && logologinForm.$pristine && preferredForm.$pristine && faviconForm.$pristine) || (customizationsForm.$invalid || logoForm.$invalid || logologinForm.$invalid || preferredForm.$invalid || faviconForm.$invalid)" class="send-button md-accent md-raised" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      <div class="customization-detail-form-container customizations md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.CUSTOMIZATIONS">CUSTOMIZATIONS</div>\n        </div>\n        <form name="customizationsForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultLogo" aria-label="Default_Logo"><span translate="SETTINGS.DEFAULT_LOGO">Default_Logo</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultLoginLogo" aria-label="Default_Login_Logo"><span translate="SETTINGS.DEFAULT_LOGIN_LOGO">Default_Login_Logo</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultFavicon" aria-label="Default_Favicon"><span translate="SETTINGS.DEFAULT_FAVICON">Default_Favicon</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultHeaderWhiteLabel" aria-label="Default_Header_WhiteLabel"><span translate="SETTINGS.DEFAULT_HEADER_WHITELABEL">Default_Header_WhiteLabel</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="!vm.customization.defaultHeaderWhiteLabel" class="md-block">\n            <label translate="SETTINGS.HEADER_WHITELABEL">Header_WhiteLabel</label>\n            <input type="text" name="headerWhiteLabel" ng-model="vm.customization.headerWhiteLabel" ng-required="true">\n\n            <div ng-messages="customizationsForm[\'headerWhiteLabel\'].$error" ng-show="customizationsForm[\'headerWhiteLabel\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.HEADER_WHITELABEL_REQUIRED">Header_WhiteLabel field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultPageTitle" aria-label="Default_Page_Title"><span translate="SETTINGS.DEFAULT_PAGE_TITLE">Default_Page_Title</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="!vm.customization.defaultPageTitle" class="md-block">\n            <label translate="SETTINGS.PAGE_TITLE">Page_Title</label>\n            <input type="text" name="pageTitle" ng-model="vm.customization.pageTitle" ng-required="true">\n\n            <div ng-messages="customizationsForm[\'pageTitle\'].$error" ng-show="customizationsForm[\'pageTitle\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PAGE_TITLE_REQUIRED">Page_Title field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.license.preferred" class="md-block">\n            <md-switch ng-model="vm.customization.defaultPreferred" aria-label="Default_Preferred"><span translate="SETTINGS.DEFAULT_PREFERRED">Default_Preferred</span></md-switch>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div ng-if="!vm.customization.defaultLogo" class="customization-detail-form-container logo md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.LOGO">LOGO</div>\n        </div>\n        <div ng-controller="CustomizationlogoController as vm_cl" ng-init="vm_cl.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cl.ngFlowOptions" flow-name="vm_cl.ngFlow.flow" flow-files-submitted="vm_cl.upload()" flow-file-added="vm_cl.fileAdded($file)" flow-file-success="vm_cl.fileSuccess($file, $message)" flow-complete="vm_cl.uploadComplete()" flow-drop flow-drag-enter="vm_cl.dropping=true" flow-drag-leave="vm_cl.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="logoimage in vm_cl.customization.images" ng-switch="logoimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{logoimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="logoimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{logoimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n      <div ng-if="!vm.customization.defaultLoginLogo" class="customization-detail-form-container logologin md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.LOGOLOGIN">LOGOLOGIN</div>\n        </div>\n        <div ng-controller="CustomizationlogologinController as vm_cll" ng-init="vm_cll.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cll.ngFlowOptions" flow-name="vm_cll.ngFlow.flow" flow-files-submitted="vm_cll.upload()" flow-file-added="vm_cll.fileAdded($file)" flow-file-success="vm_cll.fileSuccess($file, $message)" flow-complete="vm_cll.uploadComplete()" flow-drop flow-drag-enter="vm_cll.dropping=true" flow-drag-leave="vm_cll.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="logologinimage in vm_cll.customization.images" ng-switch="logologinimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{logologinimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="logologinimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{logologinimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n      <div ng-if="!vm.customization.defaultPreferred && vm.license.preferred" class="customization-detail-form-container preferred md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.PREFERRED">PREFERRED</div>\n        </div>\n        <div ng-controller="CustomizationpreferredController as vm_cp" ng-init="vm_cp.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cp.ngFlowOptions" flow-name="vm_cp.ngFlow.flow" flow-files-submitted="vm_cp.upload()" flow-file-added="vm_cp.fileAdded($file)" flow-file-success="vm_cp.fileSuccess($file, $message)" flow-complete="vm_cp.uploadComplete()" flow-drop flow-drag-enter="vm_cp.dropping=true" flow-drag-leave="vm_cp.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="preferredimage in vm_cp.customization.images" ng-switch="preferredimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{preferredimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="preferredimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{preferredimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n      <div ng-if="!vm.customization.defaultFavicon" class="customization-detail-form-container favicon md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.FAVICON">FAVICON</div>\n        </div>\n        <div ng-controller="CustomizationfaviconController as vm_cf" ng-init="vm_cf.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cf.ngFlowOptions" flow-name="vm_cf.ngFlow.flow" flow-files-submitted="vm_cf.upload()" flow-file-added="vm_cf.fileAdded($file)" flow-file-success="vm_cf.fileSuccess($file, $message)" flow-complete="vm_cf.uploadComplete()" flow-drop flow-drag-enter="vm_cf.dropping=true" flow-drag-leave="vm_cf.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG, ICO - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="faviconimage in vm_cf.customization.images" ng-switch="faviconimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{faviconimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="faviconimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{faviconimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/settings/views/generals/create/dialog.html",'<md-dialog class="general-dialog" aria-label="New General">\n  <form name="generalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newGeneral" ng-click="vm.saveGeneral()" class="send-button md-accent md-raised" ng-disabled="generalForm.$invalid || generalForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newGeneral" ng-click="vm.addNewGeneral()" class="send-button md-accent md-raised" ng-disabled="generalForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_GENERAL" translate-attr-aria-label="SETTINGS.ADD_GENERAL">\n          ADD GENERAL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newGeneral" ng-click="vm.deleteGeneral($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/generals/generals.html",'<div id="generals" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.GENERAL">General</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div>\n      <md-button type="submit" ng-click="vm.saveGeneral()" ng-disabled="(globalForm.$pristine && motionbarForm.$pristine && reportForm.$pristine && agentOmniDesktopInterfaceForm.$pristine && screenRecordingForm.$pristine && securityForm.$pristine && imapGeneralSettingsForm.$pristine && SSOForm.$pristine && aiToolsForm.$pristine) || (globalForm.$invalid || motionbarForm.$invalid || reportForm.$invalid || agentOmniDesktopInterfaceForm.$invalid || screenRecordingForm.$invalid || securityForm.$invalid || imapGeneralSettingsForm.$invalid || SSOForm.$invalid || aiToolsForm.$invalid)" class="send-button md-accent md-raised" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      <div class="general-detail-form-container global md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.GLOBAL">GLOBAL</div>\n        </div>\n        <form name="globalForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.MIN_INTERNAL">Min_Internal</label>\n            <input type="number" name="min_internal" ng-model="vm.general.min_internal" min="0" value="1000" ng-required="true" autofocus>\n\n            <div ng-messages="globalForm[\'min_internal\'].$error" ng-show="globalForm[\'min_internal\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MIN_INTERNAL_REQUIRED">Min_Internal field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.MIN_INTERNAL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Min_Internal must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.CHATTIMEOUT">chatTimeout</label>\n            <input type="number" name="chatTimeout" ng-model="vm.general.chatTimeout" min="0" value="30" ng-required="true">\n\n            <div ng-messages="globalForm[\'chatTimeout\'].$error" ng-show="globalForm[\'chatTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.CHATTIMEOUT_REQUIRED">chatTimeout field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.CHATTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">chatTimeout must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.rtlSupport" aria-label="RtlSupport"><span translate="SETTINGS.RTLSUPPORT">RtlSupport</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.RTLSUPPORT"></span></div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.stopRecordingOnTransfer" aria-label="Stop_Recording_On_Voice_Call_Transfer"><span translate="SETTINGS.STOP_RECORDING_ON_VOICE_CALL_TRANSFER">Stop_Recording_On_Voice_Call_Transfer</span></md-switch>\n          </md-input-container>\n        </form>\n      </div>\n\n      <div class="general-detail-form-container motionbar md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.MOTIONBAR">MOTIONBAR</div>\n        </div>\n        <form name="motionbarForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.phoneBarAutoUpdater" aria-label="MotionbarAutoUpdater"><span translate="SETTINGS.MOTIONBARAUTOUPDATER">MotionbarAutoUpdater</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.phoneBarAutoUpdater" class="md-block">\n            <label translate="SETTINGS.MOTIONBARAUTOUPDATERURL">MotionbarAutoUpdaterUrl</label>\n            <input type="url" name="phoneBarAutoUpdaterUrl" ng-model="vm.general.phoneBarAutoUpdaterUrl" value="https://www.xcally.com/bar/phonebar/autoupdater.xml" ng-required="vm.general.phoneBarAutoUpdater">\n\n            <div ng-messages="motionbarForm[\'phoneBarAutoUpdaterUrl\'].$error" ng-show="motionbarForm[\'phoneBarAutoUpdaterUrl\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MOTIONBARAUTOUPDATERURL_REQUIRED">MotionbarAutoUpdaterUrl field is required</span>\n              </div>\n              <div ng-message="url">\n                <span translate="SETTINGS.ERRORS.MOTIONBARAUTOUPDATERURL_MUST_VALID_URL">MotionbarAutoUpdaterUrl must be a valid url http://www.xcally.com</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.phoneBarRememberMeEnabled" aria-label="MotionbarRememberMe"><span translate="SETTINGS.MOTIONBARREMEMBERME">MotionbarRememberMe</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.MOTIONBARREMEMBERME"></span></div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container report md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.REPORT">REPORT</div>\n        </div>\n        <form name="reportForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.split" aria-label="Split"><span translate="SETTINGS.SPLIT">Split</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.split" class="md-block">\n            <label translate="SETTINGS.SPLITSIZECSV">SplitSizeCsv</label>\n            <input type="number" name="splitSizeCsv" ng-model="vm.general.splitSizeCsv" value="5000">\n\n            <div ng-messages="reportForm[\'splitSizeCsv\'].$error" ng-show="reportForm[\'splitSizeCsv\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SPLITSIZECSV_REQUIRED">SplitSizeCsv field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.split" class="md-block">\n            <label translate="SETTINGS.SPLITSIZEPDF">SplitSizePdf</label>\n            <input type="number" name="splitSizePdf" ng-model="vm.general.splitSizePdf" value="1000">\n\n            <div ng-messages="reportForm[\'splitSizePdf\'].$error" ng-show="reportForm[\'splitSizePdf\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SPLITSIZEPDF_REQUIRED">SplitSizePdf field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.split" class="md-block">\n            <label translate="SETTINGS.SPLITSIZEXLSX">SplitSizeXlsx</label>\n            <input type="number" name="splitSizeXlsx" ng-model="vm.general.splitSizeXlsx" value="5000">\n\n            <div ng-messages="reportForm[\'splitSizeXlsx\'].$error" ng-show="reportForm[\'splitSizeXlsx\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SPLITSIZEXLSX_REQUIRED">SplitSizeXlsx field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container agentomnidesktopinterface md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.AGENTOMNIDESKTOPINTERFACE">AGENTOMNIDESKTOPINTERFACE</div>\n        </div>\n        <form name="agentOmniDesktopInterfaceForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.enableEmailPreview" aria-label="EnableEmailPreview"><span translate="SETTINGS.ENABLEEMAILPREVIEW">EnableEmailPreview</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.searchOnEnterKey" aria-label="Search_On_Enter_Key"><span translate="SETTINGS.SEARCH_ON_ENTER_KEY">Search_On_Enter_Key</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.SEARCH_ON_ENTER_KEY"></span></div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.MESSAGESALIGNMENT">messagesAlignment</label>\n            <md-select name="messagesAlignment" ng-model="vm.general.messagesAlignment">\n              <md-option ng-value="\'alternate\'">Alternate</md-option>\n              <md-option ng-value="\'left\'">Left</md-option>\n              <md-option ng-value="\'right\'">Right</md-option>\n            </md-select>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'messagesAlignment\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'messagesAlignment\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MESSAGESALIGNMENT_REQUIRED">messagesAlignment field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.CHAT_INTERACTIONS_RELOAD_TIMEOUT">Chat_Interactions_Reload_Timeout</label>\n            <input type="number" name="chatInteractionsReloadTimeout" ng-model="vm.general.chatInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'chatInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'chatInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.CHAT_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Chat_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.MAIL_INTERACTIONS_RELOAD_TIMEOUT">Mail_Interactions_Reload_Timeout</label>\n            <input type="number" name="mailInteractionsReloadTimeout" ng-model="vm.general.mailInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'mailInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'mailInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MAIL_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Mail_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.OPENCHANNEL_INTERACTIONS_RELOAD_TIMEOUT">Openchannel_Interactions_Reload_Timeout</label>\n            <input type="number" name="openchannelInteractionsReloadTimeout" ng-model="vm.general.openchannelInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'openchannelInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'openchannelInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.OPENCHANNEL_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Openchannel_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.SMS_INTERACTIONS_RELOAD_TIMEOUT">Sms_Interactions_Reload_Timeout</label>\n            <input type="number" name="smsInteractionsReloadTimeout" ng-model="vm.general.smsInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'smsInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'smsInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SMS_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Sms_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.WHATSAPP_INTERACTIONS_RELOAD_TIMEOUT">Whatsapp_Interactions_Reload_Timeout</label>\n            <input type="number" name="whatsappInteractionsReloadTimeout" ng-model="vm.general.whatsappInteractionsReloadTimeout">\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'whatsappInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'whatsappInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.WHATSAPP_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Whatsapp_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.PREVIEW_RECALLME_REMINDER_INTERVAL">Preview_Recallme_Reminder_Interval</label>\n            <input type="number" name="previewRecallmeReminderInterval" ng-model="vm.general.previewRecallmeReminderInterval" min="1">\n            <div class="hint"><span translate="SETTINGS.HELP.PREVIEW_RECALLME_REMINDER_INTERVAL"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'previewRecallmeReminderInterval\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'previewRecallmeReminderInterval\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PREVIEW_RECALLME_REMINDER_INTERVAL_REQUIRED">Preview_Recallme_Reminder_Interval field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PREVIEW_RECALLME_REMINDER_INTERVAL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Preview_Recallme_Reminder_Interval must be a valid greater or equal than</span> <span>1</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.LIMIT_TABS">limitTabs</label>\n            <input type="number" name="limitTabs" ng-model="vm.general.limitTabs" min="0" value="20">\n            <div class="hint"><span translate="SETTINGS.HELP.LIMIT_TABS"></span></div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div ng-if="vm.license.screenrecording" class="general-detail-form-container screenrecording md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.SCREENRECORDING">SCREENRECORDING</div>\n        </div>\n        <form name="screenRecordingForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.DEFAULTSCREENRECORDINGPATH">defaultScreenRecordingPath</label>\n            <input type="text" name="defaultScreenRecordingPath" ng-model="vm.general.defaultScreenRecordingPath" autofocus>\n\n            <div class="hint"><span translate="SETTINGS.HELP.DEFAULTSCREENRECORDINGPATH"></span></div>\n            <div ng-messages="screenRecordingForm[\'defaultScreenRecordingPath\'].$error" ng-show="screenRecordingForm[\'defaultScreenRecordingPath\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.DEFAULTSCREENRECORDINGPATH_REQUIRED">defaultScreenRecordingPath field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container security md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.SECURITY">SECURITY</div>\n        </div>\n        <form name="securityForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.securePassword" aria-label="Security_Suite"><span translate="SETTINGS.SECURITY_SUITE">Security_Suite</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.SECURITY_SUITE"></span></div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.callRecordingEncryption" aria-label="Call_Recording_Encryption"><span translate="SETTINGS.CALL_RECORDING_ENCRYPTION">Call_Recording_Encryption</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.ALLOWEDLOGINATTEMPTS">allowedLoginAttempts</label>\n            <input type="number" name="allowedLoginAttempts" ng-model="vm.general.allowedLoginAttempts" value="5" ng-required="true">\n\n            <div ng-messages="securityForm[\'allowedLoginAttempts\'].$error" ng-show="securityForm[\'allowedLoginAttempts\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.ALLOWEDLOGINATTEMPTS_REQUIRED">allowedLoginAttempts field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.BLOCKDURATION">blockDuration</label>\n            <input type="number" name="blockDuration" ng-model="vm.general.blockDuration" value="10" ng-required="true">\n\n            <div ng-messages="securityForm[\'blockDuration\'].$error" ng-show="securityForm[\'blockDuration\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.BLOCKDURATION_REQUIRED">blockDuration field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.enforcePasswordHistory" aria-label="Enforce_Password_History"><span translate="SETTINGS.ENFORCE_PASSWORD_HISTORY">Enforce_Password_History</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.ENFORCE_PASSWORD_HISTORY"></span></div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enforcePasswordHistory" class="md-block">\n            <label translate="SETTINGS.PASSWORD_HISTORY_LIMIT">Password_History_Limit</label>\n            <input type="number" name="passwordHistoryLimit" ng-model="vm.general.passwordHistoryLimit" min="2" max="5" value="3">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PASSWORD_HISTORY_LIMIT"></span></div>\n            <div ng-messages="securityForm[\'passwordHistoryLimit\'].$error" ng-show="securityForm[\'passwordHistoryLimit\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PASSWORD_HISTORY_LIMIT_REQUIRED">Password_History_Limit field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PASSWORD_HISTORY_LIMIT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Password_History_Limit must be a valid greater or equal than</span> <span>2</span>\n              </div>\n              <div ng-message="max">\n                <span translate="SETTINGS.ERRORS.PASSWORD_HISTORY_LIMIT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Password_History_Limit must be a valid greater or equal than</span> <span>5</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block no-margin-bottom">\n            <md-switch ng-change="vm.onPrivacyPolicyChange(\'email\')" ng-model="vm.general.enablePrivacyPolicyEmail" aria-label="Privacy_Policy_Email"><span translate="SETTINGS.PRIVACY_POLICY_EMAIL">Privacy_Policy_Email</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enablePrivacyPolicyEmail" class="md-block no-margin-top">\n\n            <input type="number" name="privacyPolicyEmail" ng-model="vm.general.privacyPolicyEmail" min="0" value="0" ng-required="true">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PRIVACY_POLICY"></span></div>\n            <div ng-messages="securityForm[\'privacyPolicyEmail\'].$error" ng-show="securityForm[\'privacyPolicyEmail\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_EMAIL_REQUIRED">Privacy_Policy_Email field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_EMAIL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Privacy_Policy_Email must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block no-margin-bottom">\n            <md-switch ng-change="vm.onPrivacyPolicyChange(\'name\')" ng-model="vm.general.enablePrivacyPolicyName" aria-label="Privacy_Policy_Name"><span translate="SETTINGS.PRIVACY_POLICY_NAME">Privacy_Policy_Name</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enablePrivacyPolicyName" class="md-block no-margin-top">\n\n            <input type="number" name="privacyPolicyName" ng-model="vm.general.privacyPolicyName" min="0" value="0" ng-required="true">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PRIVACY_POLICY"></span></div>\n            <div ng-messages="securityForm[\'privacyPolicyName\'].$error" ng-show="securityForm[\'privacyPolicyName\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NAME_REQUIRED">Privacy_Policy_Name field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NAME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Privacy_Policy_Name must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block no-margin-bottom">\n            <md-switch ng-change="vm.onPrivacyPolicyChange(\'number\')" ng-model="vm.general.enablePrivacyPolicyNumber" aria-label="Privacy_Policy_Number"><span translate="SETTINGS.PRIVACY_POLICY_NUMBER">Privacy_Policy_Number</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enablePrivacyPolicyNumber" class="md-block no-margin-top">\n\n            <input type="number" name="privacyPolicyNumber" ng-model="vm.general.privacyPolicyNumber" min="0" value="0" ng-required="true">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PRIVACY_POLICY"></span></div>\n            <div ng-messages="securityForm[\'privacyPolicyNumber\'].$error" ng-show="securityForm[\'privacyPolicyNumber\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NUMBER_REQUIRED">Privacy_Policy_Number field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Privacy_Policy_Number must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.disabledCookie" aria-label="Disabled_Cookie"><span translate="SETTINGS.DISABLED_COOKIE">Disabled_Cookie</span></md-switch>\n          </md-input-container>\n        </form>\n      </div>\n\n      <div class="general-detail-form-container imapgeneralsettings md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.IMAPGENERALSETTINGS">IMAPGENERALSETTINGS</div>\n        </div>\n        <form name="imapGeneralSettingsForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.LOGINMAILFREQUENCY">loginMailFrequency</label>\n            <input type="number" name="loginMailFrequency" ng-model="vm.general.loginMailFrequency" min="10" value="10" ng-required="true" autofocus>\n\n            <div class="hint"><span translate="SETTINGS.HELP.LOGINMAILFREQUENCY"></span></div>\n            <div ng-messages="imapGeneralSettingsForm[\'loginMailFrequency\'].$error" ng-show="imapGeneralSettingsForm[\'loginMailFrequency\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.LOGINMAILFREQUENCY_REQUIRED">loginMailFrequency field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.LOGINMAILFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">loginMailFrequency must be a valid greater or equal than</span> <span>10</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container sso md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.SSO">SSO</div>\n        </div>\n        <form name="SSOForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.googleSsoEnabled" aria-label="Google_SSO_enabled"><span translate="SETTINGS.GOOGLE_SSO_ENABLED">Google_SSO_enabled</span></md-switch>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.adSsoEnabled" aria-label="AD_SSO_enabled"><span translate="SETTINGS.AD_SSO_ENABLED">AD_SSO_enabled</span></md-switch>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div ng-if="vm.license.ai" class="general-detail-form-container aitools md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.AITOOLS">AITOOLS</div>\n        </div>\n        <form name="aiToolsForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.LANGUAGE">Language</label>\n            <md-select name="language" ng-model="vm.general.language" autofocus required>\n              <md-option ng-value="\'en-US\'">US English</md-option>\n              <md-option ng-value="\'en-AU\'">Australian English</md-option>\n              <md-option ng-value="\'en-GB\'">British English</md-option>\n              <md-option ng-value="\'en-AB\'">Scottish English</md-option>\n              <md-option ng-value="\'en-WL\'">Welsh English</md-option>\n              <md-option ng-value="\'en-IE\'">English (Ireland)</md-option>\n              <md-option ng-value="\'en-IN\'">Indian English</md-option>\n              <md-option ng-value="\'hi-IN\'">Hindi (India)</md-option>\n              <md-option ng-value="\'fr-CA\'">Canadian French</md-option>\n              <md-option ng-value="\'fr-FR\'">French</md-option>\n              <md-option ng-value="\'de-DE\'">German</md-option>\n              <md-option ng-value="\'de-CH\'">German (Switzerland)</md-option>\n              <md-option ng-value="\'it-IT\'">Italian</md-option>\n              <md-option ng-value="\'es-ES\'">Spanish</md-option>\n              <md-option ng-value="\'es-Us\'">US Spanish</md-option>\n              <md-option ng-value="\'pt-BR\'">Brazilian Portuguese</md-option>\n              <md-option ng-value="\'pt-PT\'">Portuguese(Portugal)</md-option>\n              <md-option ng-value="\'ar-SA\'">Modern Standard Arabic</md-option>\n              <md-option ng-value="\'ar-AE\'">Arabic</md-option>\n              <md-option ng-value="\'zh-CN\'">Chinese Mandarin - Mainland</md-option>\n              <md-option ng-value="\'ja-JP\'">Japanese (Japan)</md-option>\n              <md-option ng-value="\'ko-KR\'">Korean (Korea)</md-option>\n              <md-option ng-value="\'he-IL\'">Hebrew (Israel) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'ms-MY\'">Malay (Malaysia) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'fa-IR\'">Farsi (Iran) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'ru-RU\'">Russian (Russia) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'te-IN\'">Telugu(India) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'ta-IN\'">Tamil - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'nl-NL\'">Dutch - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'tr-TR\'">Turkish (Turkey) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'id-ID\'">Indonesian(Indonesia) - This language is not available for the Sentiment Analysis</md-option>\n            </md-select>\n            <div ng-messages="aiToolsForm[\'language\'].$error" ng-show="aiToolsForm[\'language\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.LANGUAGE_REQUIRED">Language field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.BUCKET">Bucket</label>\n            <input type="text" name="bucket" ng-model="vm.general.bucket" ng-required="true">\n\n            <div ng-messages="aiToolsForm[\'bucket\'].$error" ng-show="aiToolsForm[\'bucket\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.BUCKET_REQUIRED">Bucket field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.transcribe" aria-label="Transcribe"><span translate="SETTINGS.TRANSCRIBE">Transcribe</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.transcribe == true" class="md-block">\n            <label translate="SETTINGS.TRANSCRIBEREGION">TranscribeRegion</label>\n            <md-select name="transcribeRegion" ng-model="vm.general.transcribeRegion" required>\n              <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n              <md-option ng-value="\'us-east-2\'">US East (Ohio)</md-option>\n              <md-option ng-value="\'us-east-2\'">US West (N. California)</md-option>\n              <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n              <md-option ng-value="\'ap-south-1\'">Asia Pacific (Mumbai)</md-option>\n              <md-option ng-value="\'ap-east-1\'">Asia Pacific (Hong Kong)</md-option>\n              <md-option ng-value="\'ap-northeast-2\'">Asia Pacific (Seoul)</md-option>\n              <md-option ng-value="\'ap-southeast-1\'">Asia Pacific (Singapore)</md-option>\n              <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n              <md-option ng-value="\'ap-northeast-1\'">Asia Pacific (Tokyo)</md-option>\n              <md-option ng-value="\'ca-central-1\'">Canada (Central)</md-option>\n              <md-option ng-value="\'eu-central-1\'">Europe (Frankfurt)</md-option>\n              <md-option ng-value="\'eu-west-1\'">Europe (Ireland)</md-option>\n              <md-option ng-value="\'eu-west-2\'">Europe (London)</md-option>\n              <md-option ng-value="\'eu-west-3\'">Europe (Paris)</md-option>\n              <md-option ng-value="\'me-south-1\'">Middle East (Bahrain)</md-option>\n              <md-option ng-value="\'sa-east-1\'">South America (São Paulo)</md-option>\n            </md-select>\n            <div ng-messages="aiToolsForm[\'transcribeRegion\'].$error" ng-show="aiToolsForm[\'transcribeRegion\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.TRANSCRIBEREGION_REQUIRED">TranscribeRegion field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.transcribe == true" class="md-block">\n            <label translate="SETTINGS.TRANSCRIBEACCOUNT">TranscribeAccount</label>\n            <md-select name="transcribeAccountId" ng-model="vm.general.transcribeAccountId" required>\n              <md-option ng-value="transcribeAccountId.id" ng-repeat="transcribeAccountId in vm.cloudProviders" ng-disabled="transcribeAccountId.canSelect === false">{{ transcribeAccountId.name }}</md-option>\n            </md-select>\n            <div ng-messages="aiToolsForm[\'transcribeAccountId\'].$error" ng-show="aiToolsForm[\'transcribeAccountId\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.TRANSCRIBEACCOUNT_REQUIRED">TranscribeAccount field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n'+"          <md-input-container ng-if=\"vm.general.transcribe == true && vm.general.language != 'he-IL' && vm.general.language != 'ms-MY' && vm.general.language != 'fa-IR' && vm.general.language != 'ru-RU' && vm.general.language != 'te-IN' && vm.general.language != 'ta-IN' && vm.general.language != 'nl-NL' && vm.general.language != 'tr-TR' && vm.general.language != 'id-ID'\" class=\"md-block\">\n            <md-switch ng-model=\"vm.general.sentiment\" aria-label=\"SentimentAnalysis\"><span translate=\"SETTINGS.SENTIMENTANALYSIS\">SentimentAnalysis</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if=\"vm.general.sentiment == true && vm.general.transcribe == true && vm.general.language != 'he-IL' && vm.general.language != 'ms-MY' && vm.general.language != 'fa-IR' && vm.general.language != 'ru-RU' && vm.general.language != 'te-IN' && vm.general.language != 'ta-IN' && vm.general.language != 'nl-NL' && vm.general.language != 'tr-TR' && vm.general.language != 'id-ID'\" class=\"md-block\">\n            <label translate=\"SETTINGS.SENTIMENTREGION\">SentimentRegion</label>\n            <md-select name=\"sentimentRegion\" ng-model=\"vm.general.sentimentRegion\" required>\n              <md-option ng-value=\"'us-east-1'\">US East (N. Virginia)</md-option>\n              <md-option ng-value=\"'us-east-2'\">US East (Ohio)</md-option>\n              <md-option ng-value=\"'us-west-2'\">US West (Oregon)</md-option>\n              <md-option ng-value=\"'ap-south-1'\">Asia Pacific (Mumbai)</md-option>\n              <md-option ng-value=\"'ap-northeast-2'\">Asia Pacific (Seoul)</md-option>\n              <md-option ng-value=\"'ap-southeast-1'\">Asia Pacific (Singapore)</md-option>\n              <md-option ng-value=\"'ap-southeast-2'\">Asia Pacific (Sydney)</md-option>\n              <md-option ng-value=\"'ap-northeast-1'\">Asia Pacific (Tokyo)</md-option>\n              <md-option ng-value=\"'ca-central-1'\">Canada (Central)</md-option>\n              <md-option ng-value=\"'eu-central-1'\">Europe (Frankfurt)</md-option>\n              <md-option ng-value=\"'eu-west-1'\">Europe (Ireland)</md-option>\n              <md-option ng-value=\"'eu-west-2'\">Europe (London)</md-option>\n            </md-select>\n            <div ng-messages=\"aiToolsForm['sentimentRegion'].$error\" ng-show=\"aiToolsForm['sentimentRegion'].$touched\" role=\"alert\">\n              <div ng-message=\"required\">\n                <span translate=\"SETTINGS.ERRORS.SENTIMENTREGION_REQUIRED\">SentimentRegion field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if=\"vm.general.sentiment == true && vm.general.transcribe == true && vm.general.language != 'he-IL' && vm.general.language != 'ms-MY' && vm.general.language != 'fa-IR' && vm.general.language != 'ru-RU' && vm.general.language != 'te-IN' && vm.general.language != 'ta-IN' && vm.general.language != 'nl-NL' && vm.general.language != 'tr-TR' && vm.general.language != 'id-ID'\" class=\"md-block\">\n            <label translate=\"SETTINGS.SENTIMENTACCOUNT\">SentimentAccount</label>\n            <md-select name=\"sentimentAccountId\" ng-model=\"vm.general.sentimentAccountId\" required>\n              <md-option ng-value=\"sentimentAccountId.id\" ng-repeat=\"sentimentAccountId in vm.cloudProviders\" ng-disabled=\"sentimentAccountId.canSelect === false\">{{ sentimentAccountId.name }}</md-option>\n            </md-select>\n            <div ng-messages=\"aiToolsForm['sentimentAccountId'].$error\" ng-show=\"aiToolsForm['sentimentAccountId'].$touched\" role=\"alert\">\n              <div ng-message=\"required\">\n                <span translate=\"SETTINGS.ERRORS.SENTIMENTACCOUNT_REQUIRED\">SentimentAccount field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>"),e.put("app/main/apps/settings/views/license/license.html",'<div id="license" class="page-layout simple fullwidth doc-page">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.LICENSE">LICENSE</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    \x3c!-- <div>\n                <md-button type="submit" ng-click="vm.requestLicense()" class="send-button md-raised" translate="SETTINGS.REQUEST_LICENSE" translate-attr-aria-label="SETTINGS.REQUEST_LICENSE">\n                    REQUEST LICENSE\n                </md-button>\n            </div> --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      \x3c!-- LICENSE CARD --\x3e\n      <div layout="row" flex>\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="row" layout-align="center">\n            <div flex layout="row" layout-align="start center">\n              <div ng-if="!vm.license.custom">\n                <a href="https://www.xcally.com/plans.html" target="_blank" class="md-button md-fab green-A700-bg" aria-label="Eat cake">\n                  <md-tooltip><span translate="SETTINGS.PRICES">Prices</span></md-tooltip>\n                  <md-icon md-font-icon="icon-coin"></md-icon>\n                </a>\n              </div>\n            </div>\n            <div flex>\n              <div ng-switch="vm.license.months" class="text-center">\n                <span ng-switch-when="1" class="md-title md-accent-fg text-bold">{{ \'SETTINGS.PLAN\' | translate }}: <span translate="SETTINGS.MONTH_TO_MONTH">MONTH TO MONTH</span></span>\n                <span ng-switch-when="12" class="md-title md-accent-fg text-bold">{{ \'SETTINGS.PLAN\' | translate }}: <span translate="SETTINGS.ANNUALLY">ANNUALLY</span></span>\n                <span ng-switch-when="36" class="md-title md-accent-fg text-bold">{{ \'SETTINGS.PLAN\' | translate }}: <span translate="SETTINGS.PERPETUAL">PERPETUAL</span></span>\n              </div>\n            </div>\n            <div flex layout="row" layout-align="end center">\n              <div>\n                <md-button type="submit" ng-click="vm.updateLicense()" class="md-button md-fab md-accent">\n                  <md-tooltip><span translate="SETTINGS.UPDATE_LICENSE">License</span></md-tooltip>\n                  <md-icon md-font-icon="icon-pencil"></md-icon>\n                </md-button>\n                <md-button type="submit" ng-if="vm.isAdmin" ng-click="vm.downloadLogFile()" class="md-button md-fab md-accent">\n                  <md-tooltip><span translate="SETTINGS.DOWNLOAD_LICENSE_LOG_FILE">Download license log file</span></md-tooltip>\n                  <md-icon md-font-icon="icon-download"></md-icon>\n                </md-button>\n              </div>\n            </div>\n          </div>\n\n          <span ng-if="!vm.license.demo && !vm.license.gray && vm.license.months != 36" class="md-subhead md-warn-fg text-center">{{ \'SETTINGS.EXPIRATION_DATE\' | translate }}: {{vm.license.expiration | date: \'longDate\'}}</span>\n          <span class="text-center padding-bottom-10"> {{ vm.license.machineUuid !== vm.license.uuid ? \'SETTINGS.OLD_TOKEN\' : \'SETTINGS.TOKEN\' | translate }}: <span ngclipboard data-clipboard-target="#licenseUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});" id="licenseUuid" class="hover-token text-italic text-bold">{{vm.license.uuid}}</span>\n            \x3c!--<md-button class="md-button md-fab md-accent" ngclipboard data-clipboard-target="#licenseUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n            <md-tooltip><span translate="SETTINGS.COPY_LICENSE">Copy</span></md-tooltip>\n            <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n          </md-button>--\x3e\n          </span>\n\n          <div layout="column">\n            <span ng-if="vm.license.grayReason == \'changed\'" class="blink md-subhead md-warn-fg text-center">{{ \'SETTINGS.NEW_TOKEN_DETECTED\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10"> {{\'SETTINGS.NEW_TOKEN\' | translate }}: <span id="licenseMachineUuid" ngclipboard data-clipboard-target="#licenseMachineUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});" class="hover-token text-italic text-bold">{{vm.license.machineUuid}}</span>\n              \x3c!--<md-button class="md-button md-fab md-accent" ngclipboard data-clipboard-target="#licenseMachineUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                <md-tooltip><span translate="SETTINGS.COPY_LICENSE">Copy</span></md-tooltip>                \n                <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n              </md-button>--\x3e\n            </span>\n            <span ng-if="vm.license.gray" class="blink md-subhead md-warn-fg text-center">{{ \'SETTINGS.EXPIRATION_GRAY_PERIOD\' | translate }}: {{vm.license.deadline | date: \'longDate\'}}</span>\n            <span ng-if="vm.license.gray" class="text-center padding-bottom-10 text-italic text-bold"> {{\'SETTINGS.EXPIRATION_REASON\' | translate }} </span>\n            <span ng-if="vm.license.grayReason == \'disabled\'" class="text-center padding-bottom-10"> {{\'SETTINGS.EXPIRATION_REASON_MESSAGE_DISABLED\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10"> {{\'SETTINGS.EXPIRATION_REASON_MESSAGE_CHANGED\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10"> {{\'SETTINGS.EXPIRATION_CHANGED_ADVISE\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10">{{ \'SETTINGS.SEND_EMAIL_TO\' | translate }}: <a href="mailto:license@xcally.com?subject=New%20token%20detected&body=Hi xCALLY, New Token: {{vm.license.machineUuid}}, Old token: {{vm.license.uuid}}">license@xcally.com</a>.</span>\n            <span ng-if="vm.license.grayReason == \'disabled\'" class="text-center padding-bottom-10">{{ \'SETTINGS.SEND_EMAIL_TO\' | translate }}: <a href="mailto:license@xcally.com?subject=License%20disabled&body=Hi xCALLY, My Token: {{vm.license.machineUuid}}">license@xcally.com</a>.</span>\n          </div>\n\n          <div ng-if="vm.license.demo" layout="column">\n            <span class="md-subhead md-warn-fg text-center">{{ \'SETTINGS.TRIAL_VERSION\' | translate }}</span>\n            <span class="md-subhead md-warn-fg text-center"><a href="https://www.xcally.com/en/index.html#pricing-table2-h" target="_blank">{{ \'SETTINGS.PRICES\' | translate}}</a></span>\n          </div>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.STAFF\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" flex="33">\n              <md-icon md-font-icon="icon-account" class="md-avatar-icon"></md-icon>\n              <div class="md-list-item-text">\n                <h3>{{ vm.license.users || 0 }} <span ng-class="{\'red-fg\': vm.license.users <= vm.users && vm.license.users > 0}">({{vm.license.users >= vm.users ? vm.users : vm.license.users}})</span></h3>\n                <p translate="SETTINGS.USERS">Users</p>\n              </div>\n            </md-list-item>\n            <md-list-item class="md-2-line" flex="33">\n              <md-icon md-font-icon="icon-headphones" class="md-avatar-icon"></md-icon>\n              <div class="md-list-item-text">\n                <h3>{{ vm.license.agents || 0 }} <span ng-class="{\'red-fg\': (vm.license.agents <= vm.agents && vm.license.agents > 0) }">({{vm.license.agents >= vm.agents ? vm.agents : vm.license.agents}})</span></h3>\n                <p translate="SETTINGS.AGENTS">Agents</p>\n              </div>\n            </md-list-item>\n            <md-list-item class="md-2-line" flex="33">\n              <md-icon md-font-icon="icon-phone" class="md-avatar-icon"></md-icon>\n              <div class="md-list-item-text">\n                <h3>{{ vm.license.telephones || 0 }} <span ng-class="{\'red-fg\': vm.license.telephones <= vm.telephones && vm.license.telephones > 0}">({{vm.license.telephones >= vm.telephones ? vm.telephones : vm.license.telephones}})</span></h3>\n                <p translate="SETTINGS.TELEPHONES">Telephones</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.CHANNELS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item flex="33" class="md-2-line" ng-repeat="channel in vm.channels | limitTo:3">\n              <md-icon md-font-icon="{{channel.icon}}" class="md-avatar-icon" ng-class="vm.license[channel.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{channel.name | uppercase}}"></h3>\n                <p ng-class="vm.license[channel.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[channel.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item flex="33" class="md-2-line" ng-repeat="channel in vm.channels | limitTo:3:3">\n              <md-icon md-font-icon="{{channel.icon}}" class="md-avatar-icon" ng-class="vm.license[channel.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{channel.name | uppercase}}"></h3>\n                <p ng-class="vm.license[channel.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[channel.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item flex="33" class="md-2-line" ng-repeat="channel in vm.channels | limitTo:3:6">\n              <md-icon md-font-icon="{{channel.icon}}" class="md-avatar-icon" ng-class="vm.license[channel.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{channel.name | uppercase}}"></h3>\n                <p ng-class="vm.license[channel.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[channel.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.MODULES\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="module in vm.modules" flex="33">\n              <md-icon md-font-icon="{{module.icon}}" class="md-avatar-icon" ng-class="vm.license[module.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{module.name | uppercase}}"></h3>\n                <p ng-class="vm.license[module.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[module.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.SESSIONS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <div ng-repeat="session in vm.sessions" flex="33">\n              <md-list-item class="md-2-line">\n                <md-icon md-font-icon="{{session.icon}}" class="md-avatar-icon" ng-class="vm.license[session.enabled] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n                <div class="md-list-item-text">\n                  <div layout="row" layout="start center">\n                    <h3 translate="SETTINGS.{{session.name | uppercase}}"></h3>\n                    <button ng-if="session.restart" ng-click="vm.gotoProcess($event)" class="md-mini" aria-label="restart">\n                      <md-tooltip>Restart</md-tooltip>\n                      <md-icon md-font-icon="icon-reload"></md-icon>\n                    </button>\n                  </div>\n                  <p ng-if="vm.license[session.name] && vm.license[session.enabled]" class="green-A700-fg">{{vm.license[session.name]}} {{ \'SETTINGS.\' + session.label | uppercase | translate }}</p>\n                  <p ng-if="!vm.license[session.name] && vm.license[session.enabled]" class="green-A700-fg">UNLIMITED {{ \'SETTINGS.\' + session.label | uppercase | translate }}</p>\n                  <p ng-if="!vm.license[session.enabled]" class="red-A700-fg">{{ \'SETTINGS.DISABLED\' | translate }}</p>\n                </div>\n              </md-list-item>\n\n            </div>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.ADDONS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="addon in vm.addons | limitTo:3" flex="33">\n              <md-icon md-font-icon="{{addon.icon}}" class="md-avatar-icon" ng-class="vm.license[addon.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{addon.name | uppercase}}"></h3>\n                <p ng-class="vm.license[addon.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[addon.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="addon in vm.addons | limitTo:3:3" flex="33">\n              <md-icon md-font-icon="{{addon.icon}}" class="md-avatar-icon" ng-class="vm.license[addon.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{addon.name | uppercase}}"></h3>\n                <p ng-class="vm.license[addon.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[addon.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.OTHERS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="other in vm.others | limitTo:3" flex="33">\n              <md-icon md-font-icon="{{other.icon}}" class="md-avatar-icon" ng-class="vm.license[other.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{other.name | uppercase}}"></h3>\n                <p ng-class="vm.license[other.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[other.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="other in vm.others | limitTo:3:3" flex="33">\n              <md-icon md-font-icon="{{other.icon}}" class="md-avatar-icon" ng-class="vm.license[other.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{other.name | uppercase}}"></h3>\n'+"                <p ng-class=\"vm.license[other.name] ? 'green-A700-fg' : 'red-A700-fg'\">{{ 'SETTINGS.' + (vm.license[other.name] ? 'ENABLED' : 'DISABLED') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n        </md-card>\n      </div>\n      \x3c!-- / LICENSE CARD --\x3e\n\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>"),e.put("app/main/apps/settings/views/license/request/dialog.html",'<md-dialog class="request-dialog" aria-label="Send Request">\n  <form name="requestForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="SETTINGS.REQUEST_LICENSE">Request License</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.license.name" required>\n        <div ng-messages="requestForm.name.$error" ng-show="requestForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.NAME_REQUIRED">Address field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.license.email" required>\n        <div ng-messages="requestForm.email.$error" ng-show="requestForm.email.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="SETTINGS.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.PLAN">Plan</label>\n        <md-select name="plan" ng-model="vm.license.months" required>\n          <md-option ng-value="1"><span translate="SETTINGS.MONTH_TO_MONTH">MONTH TO MONTH</span></md-option>\n          <md-option ng-value="12"><span translate="SETTINGS.ANNUALLY">ANNUALLY</span></md-option>\n          <md-option ng-value="36"><span translate="SETTINGS.PERPETUAL">PERPETUAL</span></md-option>\n        </md-select>\n        <div ng-messages="requestForm.plan.$error" ng-show="requestForm.plan.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.PLAN_REQUIRED">Plan field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.STAFF\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-input-container class="md-block" flex>\n          <label translate="SETTINGS.USERS">Users</label>\n          <input type="number" name="users" ng-model="vm.license.users" required>\n          <div ng-messages="requestForm.users.$error" ng-show="requestForm.users.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.USERS_REQUIRED">Users field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" flex>\n          <label translate="SETTINGS.AGENTS">Agents</label>\n          <input type="number" name="agents" ng-model="vm.license.agents" required>\n          <div ng-messages="requestForm.agents.$error" ng-show="requestForm.agents.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.AGENTS_REQUIRED">Agents field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" flex>\n          <label translate="SETTINGS.TELEPHONES">Telephones</label>\n          <input type="number" name="telephones" ng-model="vm.license.telephones" required>\n          <div ng-messages="requestForm.telephones.$error" ng-show="requestForm.telephones.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.TELEPHONES_REQUIRED">Telephones field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.CHANNELS\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[channel.name]" aria-label="{{channel.name}}" ng-repeat="channel in vm.channels | limitTo:3"><span translate="SETTINGS.{{channel.name | uppercase}}"></span></md-switch>\n        <md-switch ng-model="vm.license[channel.name]" aria-label="{{channel.name}}" ng-repeat="channel in vm.channels | limitTo:3:3"><span translate="SETTINGS.{{channel.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.MODULES\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[module.name]" aria-label="{{module.name}}" ng-repeat="module in vm.modules"><span translate="SETTINGS.{{module.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.SESSIONS\' | translate }}</md-subheader>\n      <div layout="row">\n        <md-input-container ng-repeat="session in vm.sessions" class="md-block" flex="50">\n          <label>{{ \'SETTINGS.\' + session.name | uppercase | translate }} ({{ \'SETTINGS.\' + session.label | uppercase | translate }})</label>\n          <input type="number" name="{{session.name}}" ng-model="vm.license[session.name]" required>\n          <div class="hint"><span>0={{ \'SETTINGS.UNLIMITED_CHANNELS\' | translate }}</span></div>\n          <div ng-messages="requestForm[session.name].$error" ng-show="requestForm[session.name].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.CHANNEL_REQUIRED">Mandatory field</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.ADDONS\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[addon.name]" aria-label="{{module.name}}" ng-repeat="addon in vm.addons"><span translate="SETTINGS.{{addon.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.OTHERS\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[other.name]" aria-label="{{other.name}}" ng-repeat="other in vm.others"><span translate="SETTINGS.{{other.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.DESCRIPTION">Description</label>\n        <textarea name="description" ng-model="vm.license.description"></textarea>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.sendRequest()" class="send-button md-accent md-raised" ng-disabled="requestForm.$invalid || requestForm.$pristine" aria-label="SEND" translate="SETTINGS.SEND" translate-attr-aria-label="SETTINGS.SEND">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/license/update/dialog.html",'<md-dialog class="update-dialog" aria-label="Update License">\n  <form name="updateForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="SETTINGS.UPDATE_LICENSE">Update License</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-content layout="row">\n        <span class="md-title" translate="SETTINGS.UPDATE_LICENSE_MANUALLY">Do you want to update your license manually?</span>\n      </md-content>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.ENTER_LICENSE">Enter your license</label>\n        <textarea name="key" ng-model="vm.licenseKey" required></textarea>\n        <div ng-messages="updateForm.name.$error" ng-show="updateForm.key.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.LICENSE_REQUIRED">License key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.updateLicense()" class="send-button md-accent md-raised" ng-disabled="updateForm.$invalid || updateForm.$pristine" aria-label="UPDATE" translate="SETTINGS.UPDATE" translate-attr-aria-label="SETTINGS.UPDATE">\n          UPDATE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/networks/create/dialog.html",'<md-dialog class="network-dialog" aria-label="New Network">\n  <form name="networkForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.network.type" autofocus required>\n          <md-option ng-value="\'localnet\'">LocalNET</md-option>\n          <md-option ng-value="\'externip\'">ExternIP</md-option>\n          <md-option ng-value="\'turn\'">Turn</md-option>\n          <md-option ng-value="\'stun\'">Stun</md-option>\n        </md-select>\n        <div ng-messages="networkForm[\'type\'].$error" ng-show="networkForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'localnet\'" class="md-block">\n        <label translate="SETTINGS.LOCALNETADDRESS">localNetAddress</label>\n        <input type="text" name="value" ng-model="vm.network.value" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/" ng-required="true">\n\n        <div class="hint"><span translate="SETTINGS.HELP.LOCALNETADDRESS"></span></div>\n        <div ng-messages="networkForm[\'value\'].$error" ng-show="networkForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.LOCALNETADDRESS_REQUIRED">localNetAddress field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SETTINGS.ERRORS.LOCALNETADDRESS_MUST_VALID_PATTERN" translate-values="{ regex: \'/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/\' }">localNetAddress must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'externip\'" class="md-block">\n        <label translate="SETTINGS.ADDRESS">Address</label>\n        <input type="text" name="value" ng-model="vm.network.value" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/" ng-required="true">\n\n        <div class="hint"><span translate="SETTINGS.HELP.ADDRESS"></span></div>\n        <div ng-messages="networkForm[\'value\'].$error" ng-show="networkForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.ADDRESS_REQUIRED">Address field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SETTINGS.ERRORS.ADDRESS_MUST_VALID_PATTERN" translate-values="{ regex: \'/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/\' }">Address must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'turn\' || vm.network.type == \'stun\'" class="md-block">\n        <label translate="SETTINGS.ADDRESS">Address</label>\n        <input type="text" name="value" ng-model="vm.network.value" ng-required="true">\n\n        <div ng-messages="networkForm[\'value\'].$error" ng-show="networkForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.ADDRESS_REQUIRED">Address field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'turn\'" class="md-block">\n        <label translate="SETTINGS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.network.username" ng-required="vm.network.type == \'turn\'">\n\n        <div class="hint"><span translate="SETTINGS.HELP.USERNAME"></span></div>\n        <div ng-messages="networkForm[\'username\'].$error" ng-show="networkForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'turn\'" class="md-block">\n        <label translate="SETTINGS.PASSWORD">Password</label>\n        <input type="text" name="password" ng-model="vm.network.password" ng-required="vm.network.type == \'turn\'">\n\n        <div class="hint"><span translate="SETTINGS.HELP.PASSWORD"></span></div>\n        <div ng-messages="networkForm[\'password\'].$error" ng-show="networkForm[\'password\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newNetwork" ng-click="vm.saveNetwork()" class="send-button md-accent md-raised" ng-disabled="networkForm.$invalid || networkForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newNetwork" ng-click="vm.addNewNetwork()" class="send-button md-accent md-raised" ng-disabled="networkForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_NETWORK" translate-attr-aria-label="SETTINGS.ADD_NETWORK">\n          ADD NETWORK\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-click="vm.deleteNetwork($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/networks/networks.html",'<div id="networks" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.NETWORKS">Networks</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SETTINGS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedNetworks.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedNetworks =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SETTINGS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-networks-count">\n          <span>{{vm.selectedNetworks.length}}</span>\n          <span translate="SETTINGS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SETTINGS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllNetworks()" translate="SETTINGS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectNetworks()" translate="SETTINGS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedNetworks" csv-label="true" filename="networks.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-click="vm.deleteSelectedNetworks($event)" aria-label="delete selected" translate translate-attr-label="SETTINGS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- NETWORK TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedNetworks" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getNetworks">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SETTINGS.ID\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'SETTINGS.TYPE\' | translate }}</th>\n                <th md-column md-order-by="value">{{ \'SETTINGS.ADDRESS\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'SETTINGS.CREATED_AT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.networks.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SETTINGS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="network" md-select-id="id" ng-repeat="network in vm.networks.rows">\n                <td md-cell ng-if="network.userpic"><img class="avatar" alt="{{network.name}}" ng-src="api/users/{{network.id}}/avatar" /></td>\n                <td md-cell ng-if="!network.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{network.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="id ">{{network.id}}</td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="type ">{{ vm.arraytype[network.type].option }}</td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="value ">{{network.value}}</td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="createdAt ">{{network.createdAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SETTINGS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.editdialog(network, $event    )" translate="SETTINGS.EDIT_NETWORK">\n                          Edit Network\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.deleteconfirm(network, $event    )" translate="SETTINGS.DELETE_NETWORK">\n                          Delete Network\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SETTINGS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SETTINGS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SETTINGS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.networks.count}}" md-on-paginate="vm.getNetworks" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / NETWORK TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD NETWORK BUTTON --\x3e\n  <md-button class="md-fab md-accent" id="add-network-button" ng-click="vm.createOrEditNetwork($event)" aria-label="add network" translate translate-attr-aria-label="SETTINGS.ADD_NETWORK">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD NETWORK BUTTON --\x3e\n</div>'),e.put("app/main/apps/settings/views/smtps/smtps.html",'<div id="smtps" class="page-layout simple left-sidenav inner-sidenav">\n\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.SMTP">Smtp</span>\n      </div>\n    </div>\n\n    <div>\n      <md-button type="submit" ng-click="vm.verifySmtp()" ng-disabled="!vm.mailAccount.id" class="send-button md-accent md-raised" translate="SETTINGS.VERIFY" translate-attr-aria-label="SETTINGS.VERIFY">\n        VERIFY\n      </md-button>\n      <md-button type="submit" ng-click="vm.saveSmtp()" ng-disabled="(generalForm.$pristine) || (generalForm.$invalid)" class="send-button md-accent md-raised" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    <div class="main scrollable">\n      <div class="smtp-detail-form-container general md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.GENERAL">GENERAL</div>\n        </div>\n        <form name="generalForm" novalidate>\n\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.ACCOUNTNAME">Name</label>\n            <input type="text" name="name" ng-model="vm.mailAccount.name" ng-required="true" autofocus>\n            <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Name field required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.DESCRIPTION">Description</label>\n            <input type="" name="description" ng-model="vm.mailAccount.description">\n          </md-input-container>\n\n          <md-input-container class="md-block mt-0">\n            <label translate="SETTINGS.EMAILADDRESS">Email Address</label>\n            <input type="email" name="email" ng-model="vm.mailAccount.email" ng-required="true">\n            <div class="hint"><span translate="SETTINGS.HELP.EMAILADDRESS"></span></div>\n            <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Email Address field required</span>\n              </div>\n              <div ng-message="email">\n                <span translate="SETTINGS.ERRORS.WRONG_FORMAT">Email Address must be a valid e-mail address</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <md-input-container class="md-block mt-30">\n            <label translate="SETTINGS.SMTP_SERVICE">Service</label>\n            <md-select name="provider" ng-model="vm.mailAccount.provider" ng-change="vm.onProviderChange()" required>\n              <md-option ng-value="provider.value" ng-repeat="provider in vm.providers">{{ provider.name }}</md-option>\n            </md-select>\n            <div ng-messages="generalForm[\'provider\'].$error" ng-show="generalForm[\'provider\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Service field required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <div ng-if="vm.mailAccount.provider === \'custom\'">\n            <md-input-container class="md-block mt-30">\n              <label translate="SETTINGS.SMTP_HOST">Host</label>\n              <input type="text" name="host" ng-model="vm.mailAccount.Smtp.host" ng-required="true">\n              <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Host field required</span>\n                </div>\n              </div>\n            </md-input-container>\n            <md-input-container class="md-block">\n              <label translate="SETTINGS.SMTP_PORT">Port</label>\n              <input type="number" name="port" ng-model="vm.mailAccount.Smtp.port" value="465" ng-required="true">\n              <div ng-messages="generalForm[\'port\'].$error" ng-show="generalForm[\'port\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Port field required</span>\n                </div>\n              </div>\n            </md-input-container>\n            <md-input-container class="md-block">\n              <md-switch ng-model="vm.mailAccount.Smtp.secure" aria-label="SMTP Secure"><span translate="SETTINGS.SMTP_SECURE">Secure</span></md-switch>\n              <div class="hint"><span translate="SETTINGS.HELP.SMTP_SECURE"></span></div>\n            </md-input-container>\n            <md-input-container class="md-block">\n              <md-switch ng-model="vm.mailAccount.Smtp.authentication" aria-label="SMTP Authentication"><span translate="SETTINGS.SMTP_AUTHENTICATION">Authentication</span></md-switch>\n            </md-input-container>\n          </div>\n\n          <div ng-if="vm.mailAccount.Smtp.authentication || (vm.mailAccount.provider && vm.mailAccount.provider !== \'custom\')">\n            <md-input-container ng-if="vm.mailAccount.provider === \'outlook365\'" class="md-block">\n              <md-switch ng-model="vm.mailAccount.Smtp.modernAuthentication" aria-label="Modern Authentication" class="no-margin-bottom"><span translate="MAIL.MODERN_AUTHENTICATION">Modern Authentication</span></md-switch>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="SETTINGS.SMTP_USERNAME">Username</label>\n              <input type="text" name="username" ng-model="vm.mailAccount.Smtp.user" ng-required="true">\n              <div class="hint"><span translate="SETTINGS.HELP.SMTP_USERNAME"></span></div>\n              <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Username field required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container ng-if="vm.mailAccount.Smtp.modernAuthentication" class="md-block">\n              <label translate="MAIL.CLOUD_PROVIDER">Cloud Provider</label>\n              <md-select name="cloudProvider" ng-model="vm.mailAccount.Smtp.CloudProviderId" required>\n                <md-option ng-value="cloudProvider.id" ng-repeat="cloudProvider in vm.cloudProviders.rows">{{ cloudProvider.name }}</md-option>\n              </md-select>\n              <div class="hint"><span translate="MAIL.HELP.CLOUD_PROVIDER"></span></div>\n              <div ng-messages="generalForm[\'cloudProvider\'].$error" ng-show="generalForm[\'cloudProvider\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container ng-if="!vm.mailAccount.Smtp.modernAuthentication" class="md-block">\n              <label translate="SETTINGS.SMTP_PASSWORD">Password</label>\n              <input type="password" name="password" ng-model="vm.mailAccount.Smtp.pass" placeholder="Password" translate translate-attr-placeholder="SETTINGS.PASSWORD" required>\n              <div class="hint"><span translate="SETTINGS.HELP.SMTP_PASSWORD"></span></div>\n              <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Password field required</span>\n                </div>\n              </div>\n            </md-input-container>\n          </div>\n        </form>\n      </div>\n    </div>\n\n  </div>\n</div>'),e.put("app/main/apps/settings/views/system/system.html",'<div id="system" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.SYSTEM">SYSTEM</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" md-border-bottom flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SETTINGS.GENERAL">GENERAL</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="system-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n            <md-card class="md-whiteframe-1dp padding-20" layout="row" layout-xs="column" layout-wrap>\n              <ms-widget flex="50" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg">\n                    <div class="h3">OS</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{vm.system.system.manufacturer}} {{vm.system.system.model}}</div>\n                        <div class="h4">{{vm.system.cpu.manufacturer}} {{vm.system.cpu.brand}} - {{vm.system.cpu.speed}} GHz - {{vm.system.cpu.cores}} Cores</div>\n                        <div class="h4">{{vm.system.os.distro}} - {{vm.system.os.release}} - Kernel: {{vm.system.os.kernel}}</div>\n                        <div class="h4">Node.js: {{vm.system.node}}</div>\n                        <div class="h4">Host: {{vm.system.os.hostname}} - Uptime: {{vm.system.time.uptime / 60 | number:0}} m</div>\n                        <div class="h4">TimeZone: {{vm.system.time.timezone}} ({{vm.system.time.timezoneName}})</div>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n              <ms-widget flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-1">\n                    <div class="h3">CPU</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="pb-8" layout="row" layout-align="space-between start">\n                          <span class="h3" translate="SETTINGS.AVG_LOAD">AVG Load</span>\n                          <span class="h3 secondary-text font-weight-500">{{vm.system.currentLoad.avgload * 100 | number:0}}%</span>\n                        </div>\n                        <md-progress-linear class="red" md-mode="determinate" value="{{vm.system.currentLoad.avgload * 100 | number:0}}"></md-progress-linear>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n              <ms-widget flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-3">\n                    <div class="h3">MEM</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{\'SETTINGS.TOTAL\' | translate}}: {{vm.system.mem.total / 1024 / 1024 / 1024 | number:0}} GB</div>\n                        <div class="h4">{{\'SETTINGS.FREE\' | translate}}: {{vm.system.mem.available / 1024 / 1024 / 1024 | number:0}} GB</div>\n                        <div class="h4">{{\'SETTINGS.USED\' | translate}}: {{vm.system.mem.active / 1024 / 1024 / 1024 | number:0}} GB</div>\n                      </div>\n                      <div class="p-16 pb-32">\n                        <div class="pb-8" layout="row" layout-align="space-between start">\n                          <span class="h3" translate="SETTINGS.USED">Used</span>\n                          <span class="h3 secondary-text font-weight-500">{{(vm.system.mem.active / vm.system.mem.total) * 100 | number : 0}}%</span>\n                        </div>\n                        <md-progress-linear class="md-warn" md-mode="determinate" value="{{(vm.system.mem.active / vm.system.mem.total) * 100 | number : 0 }}"></md-progress-linear>\n\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n            </md-card>\n\n            <md-card class="md-whiteframe-1dp padding-20" layout="row" layout-xs="column" layout-wrap>\n              <ms-widget ng-repeat="disk in vm.system.fsSize" flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-3">\n                    <div class="h3">DISK {{$index + 1}}</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{\'SETTINGS.FILE_SYSTEM\' | translate}}: {{disk.fs}}</div>\n                        <div class="h4">{{\'SETTINGS.MOUNT_POINT\' | translate}}: "{{disk.mount}}"</div>\n                        <div class="h4">{{\'SETTINGS.TOTAL\' | translate}}: {{disk.size / 1024 / 1024 / 1024 | number:0}} GB</div>\n                        <div class="h4">{{\'SETTINGS.USED\' | translate}}: {{disk.used / 1024 / 1024 / 1024 | number:0}} GB</div>\n                      </div>\n                      <div class="p-16 pb-32">\n                        <div class="pb-8" layout="row" layout-align="space-between start">\n                          <span class="h3" translate="SETTINGS.USED">Used</span>\n                          <span class="h4 secondary-text font-weight-500">{{disk.use | number:0}}%</span>\n                        </div>\n                        <md-progress-linear class="red" md-mode="determinate" value="{{disk.use | number:0}}"></md-progress-linear>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n            </md-card>\n\n            <md-card class="md-whiteframe-1dp padding-20" layout="row" layout-xs="column" layout-wrap>\n              <ms-widget ng-repeat="net in vm.system.net" flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-3">\n                    <div class="h3">NET {{$index + 1}}</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{\'SETTINGS.INTERFACE\' | translate}}: {{net.iface}}</div>\n                        <div class="h4">IPv4: {{net.ip4}}</div>\n                        <div class="h4">IPv6: {{net.ip6}}</div>\n                        <div class="h4">MAC: {{net.mac}}</div>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n            </md-card>\n\n            <md-card class="md-whiteframe-1dp padding-20" layout="row">\n              <div flex>\n                <md-toolbar class="md-table-toolbar md-default">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="SETTINGS.TOP_N_PROCESSES" translate-values="{value: vm.processLimit}"></span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm.searchTerm1 = query" on-collapse="vm.searchTerm1 = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table>\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column>pid</th>\n                        <th md-column>{{\'SETTINGS.NAME\' | translate}}</th>\n                        <th md-column>{{\'SETTINGS.STATE\' | translate}}</th>\n                        <th md-column>pmem</th>\n                        <th md-column>pcpu</th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-repeat="process in vm.system.processes.list | limitTo: vm.processLimit | filter: vm.searchTerm1 | orderBy:\'-pcpu\'">\n                        <td md-cell>{{process.pid}}</td>\n                        <td md-cell>{{process.command}}</td>\n                        <td md-cell>\n                          <span class="text-boxed white-fg" ng-class="{\n                          \'green-600-bg\': process.state == \'running\',\n                          \'yellow-600-bg\': process.state == \'sleeping\',\n                          \'red-600-bg\': process.state == \'blocked\'}">{{process.state | uppercase}}</span>\n                        </td>\n                        <td md-cell>{{process.pmem}}%</td>\n                        <td md-cell>{{process.pcpu}}%</td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n              </div>\n            </md-card>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SETTINGS.PROCESSES">PROCESSES</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="system-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <md-card class="md-whiteframe-1dp padding-20" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SETTINGS.MOTION_PROCESS_MANAGEMENT"></span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.searchTerm2 = query" on-collapse="vm.searchTerm2 = undefined" debounce="300"></ms-search-bar>\n                  <md-button ng-click="vm.getProcesses()" class="md-icon-button" aria-label="Reload">\n                    <md-icon md-font-icon="icon-reload" class="s24"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container>\n                <table md-table>\n                  <thead md-head>\n                    <tr md-row>\n                      <th md-column>id</th>\n                      <th md-column>pid</th>\n                      <th md-column>{{\'SETTINGS.NAME\' | translate}}</th>\n                      <th md-column>{{\'SETTINGS.STATE\' | translate}}</th>\n                      <th md-column>MEM</th>\n                      <th md-column>CPU</th>\n                      <th md-column width="20px">Actions</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-repeat="process in vm.processes | filter: vm.searchTerm2 | orderBy:\'-monit.cpu\'">\n                      <td md-cell>{{process.pm_id}}</td>\n                      <td md-cell>{{process.pid}}</td>\n                      <td md-cell>{{process.name == \'agi\' ? \'agi (Cally Square IVR)\' : process.name}}</td>\n                      <td md-cell>\n                        <span class="text-boxed white-fg" ng-class="{\'green-600-bg\': process.pm2_env.status == \'online\', \'red-600-bg\': process.pm2_env.status == \'stopped\'}">{{process.pm2_env.status | uppercase}}</span>\n                      </td>\n                      <td md-cell>{{process.monit.memory / 1024 / 1024 | number:0}} MB</td>\n                      <td md-cell>{{process.monit.cpu}}%</td>\n                      <td md-cell>\n                        <md-button ng-if="process.pm2_env.status !== \'online\'" ng-click="vm.updateProcess($event, process.pm_id, \'online\')" class="md-icon-button" aria-label="Play">\n                          <md-icon md-font-icon="icon-play" class="s24"></md-icon>\n                        </md-button>\n                        <md-button ng-if="process.pm2_env.status === \'online\'" ng-click="vm.updateProcess($event, process.pm_id, \'stopped\')" class="md-icon-button" aria-label="Stop">\n                          <md-icon md-font-icon="icon-stop" class="s24"></md-icon>\n                        </md-button>\n                      </td>\n                    </tr>\n                  </tbody>\n                  <tfoot md-foot>\n                    <tr md-row>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                      <td md-cell>{{ (vm.processes | map: \'monit.memory\' | sum) / 1024 / 1024 | number:0 }} MB</td>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                    </tr>\n                  </tfoot>\n                </table>\n              </md-table-container>\n            </md-card>\n            <md-card class="md-whiteframe-1dp padding-20" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SETTINGS.USEFUL_COMMANDS"></span>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-table-container>\n                <table md-table>\n                  <thead md-head>\n                    <tr md-row>\n                      <th md-column width="30%">{{\'SETTINGS.COMMAND\' | translate}}</th>\n                      <th md-column>{{\'SETTINGS.DESCRIPTION\' | translate}}</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr>\n                      <td md-cell class="no-border">pm2 list</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_LIST\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 start &lt;id | name&gt;</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_START\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 stop &lt;id | name | all&gt;</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_STOP\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 restart &lt;id | name&gt;</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_RESTART\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 logs [id | name]</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_LOGS\' | translate}}</td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n            </md-card>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/settings/views/updates/update/dialog.html",'<md-dialog aria-label="Update">\n  <form name="updateForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n      </div>\n    </md-toolbar>\n\n    <div md-background-bg layout="row" layout-align="start start">\n      <md-progress-linear md-mode="determinate" value="{{vm.progress}}" class="md-warn"></md-progress-linear>\n    </div>\n\n    <md-dialog-content>\n      <div layout="row" layout-align="center center">\n        <div ng-if="vm.updating" layout="column" layout-align="center center">\n          <span class="text-center md-title">Grab a quick coffee and</span>\n          <span class="text-center md-title">get back here as soon as completed!</span>\n          <span class="text-center md-title">{{vm.output}}</span>\n        </div>\n        <div ng-if="!vm.updating">\n          <div ng-if="vm.success" layout="column" layout-align="center center">\n            <span class="text-center md-title">Update Completed! Thank you for your time.</span>\n            <span class="text-center md-title">In order to complete the update,</span>\n            <span class="text-center md-title">please click on reload button</span>\n          </div>\n          <div ng-if="!vm.success" layout="column" layout-align="center center">\n            <span class="text-center md-title">Update Error!</span>\n            <span class="text-center md-title">Please contact your administrator!</span>\n            <span class="text-center md-title">{{vm.output}}</span>\n          </div>\n        </div>\n        <img src="assets/images/business/users.jpg" alt="" width="128" height="128" />\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions ng-if="!vm.updating" layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.reload()" class="send-button md-warm md-raised" aria-label="RELOAD" translate="SETTINGS.RELOAD" translate-attr-aria-label="SETTINGS.RELOAD">\n          RELOAD\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/updates/updates.html",'<div id="updates" class="page-layout simple fullwidth doc-page">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.UPDATES">UPDATES</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      \x3c!-- UPDATE CARD --\x3e\n      <div layout="row" ng-if="!vm.updating">\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="column" layout-align="center center">\n\n            <span class="md-title md-accent-fg padding-20 text-bold" translate="SETTINGS.CURRENT_VERSION">CURRENT VERSION</span>\n\n            <span class="md-display-3 padding-20">{{vm.version.current}}</span>\n\n            <md-button href="https://wiki.xcallymotion.com/display/XMV/Motion+GUI#MotionGUI-Version{{vm.version.current}}" target="_blank" class="md-accent" title="CHANGELOG" aria-label="CHANGELOG" translate="SETTINGS.CHANGELOG" translate-attr-aria-label="SETTINGS.CHANGELOG">\n              CHANGELOG\n            </md-button>\n          </div>\n        </md-card>\n        <md-card class="md-whiteframe-20dp padding-20" flex ng-if="vm.version.current != vm.version.latest">\n          <div layout="column" layout-align="center center">\n\n            <span class="md-title md-warn-fg padding-20 text-bold" translate="SETTINGS.NEW_VERSION">NEW VERSION</span>\n\n            <span class="md-display-3 padding-20">{{vm.version.latest}}</span>\n\n            <md-button href="https://wiki.xcallymotion.com/display/XMV/Motion+GUI#MotionGUI-Version{{vm.version.latest}}" target="_blank" class="md-accent" title="CHANGELOG" aria-label="CHANGELOG" translate="SETTINGS.CHANGELOG" translate-attr-aria-label="SETTINGS.CHANGELOG">\n              CHANGELOG\n            </md-button>\n            <md-button ng-click="vm.updateConfirm($event)" class="md-raised md-warn" aria-label="CHANGELOG" translate="SETTINGS.UPDATE" translate-attr-aria-label="SETTINGS.UPDATE">UPDATE</md-button>\n          </div>\n        </md-card>\n        <md-card class="md-whiteframe-1dp padding-20" flex ng-if="vm.version.current == vm.version.latest">\n          <div layout="column" layout-align="center center">\n\n            <span class="md-title md-warn-fg padding-20 text-bold" translate="SETTINGS.REMOTE_VERSION">REMOTE VERSION</span>\n\n            <span class="md-subhead padding-20" translate="SETTINGS.NO_NEW_VERSION_AVAILABLE">NO NEW VERSION AVAILABLE</span>\n          </div>\n        </md-card>\n      </div>\n      \x3c!-- / UPDATE CARD --\x3e\n\n      <div ng-if="vm.updating">\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="column" layout-align="center center">\n            <span class="md-title md-accent-fg padding-20 text-bold" translate="SETTINGS.UPDATING">...</span>\n            <md-progress-linear md-mode="determinate" class="md-accent padding-20" value="{{vm.progress}}"></md-progress-linear>\n            <span class="md-display-1 padding-5 text-center">Grab a quick coffee and</span>\n            <span class="md-display-1 padding-5 text-center">get back here as soon as completed</span>\n            <img src="assets/images/business/users.jpg" alt="" width="40%" height="40%" />\n          </div>\n        </md-card>\n      </div>\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/sms/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="SMS.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'SMS.NAME\' | translate }}</th>\n        <th md-column>{{ \'SMS.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'SMS.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'SMS.WAITING\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedIn }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="SMS.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="SMS.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/sms/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/sms/views/smsAccounts/create/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.smsAccount.name" ng-required="true" autofocus ng-disabled="!vm.newSmsAccount">\n\n        <div ng-messages="smsAccountForm[\'name\'].$error" ng-show="smsAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.smsAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'key\'].$error" ng-show="smsAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.MOTIONPROXY">MotionProxy</label>\n        <input type="url" name="remote" ng-model="vm.smsAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="SMS.HELP.MOTIONPROXY"></span></div>\n        <div ng-messages="smsAccountForm[\'remote\'].$error" ng-show="smsAccountForm[\'remote\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="SMS.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.smsAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="SMS.HELP.LIST"></span></div>\n        <div ng-messages="smsAccountForm[\'ListId\'].$error" ng-show="smsAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.smsAccount.type" required>\n          <md-option ng-value="\'twilio\'">Twilio</md-option>\n          <md-option ng-value="\'skebby\'">Skebby</md-option>\n          <md-option ng-value="\'connectel\'">Connectel</md-option>\n          <md-option ng-value="\'clicksend\'">ClickSend</md-option>\n          <md-option ng-value="\'plivo\'">Plivo</md-option>\n          <md-option ng-value="\'infobip\'">Infobip</md-option>\n          <md-option ng-value="\'clickatell\'">Clickatell</md-option>\n          <md-option ng-value="\'bandwidth\'">Bandwidth</md-option>\n          <md-option ng-value="\'csc\'">CSCTelecom</md-option>\n          <md-option ng-value="\'intelepeer\'">Intelepeer</md-option>\n        </md-select>\n        <div ng-messages="smsAccountForm[\'type\'].$error" ng-show="smsAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.PHONE">Phone</label>\n        <input type="text" name="phone" ng-model="vm.smsAccount.phone" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'phone\'].$error" ng-show="smsAccountForm[\'phone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'twilio\'" class="md-block">\n        <label translate="SMS.ACCOUNTSID">AccountSID</label>\n        <input type="text" name="accountSid" ng-model="vm.smsAccount.accountSid" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'accountSid\'].$error" ng-show="smsAccountForm[\'accountSid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'plivo\'" class="md-block">\n        <label translate="SMS.AUTHID">AuthID</label>\n        <input type="text" name="authId" ng-model="vm.smsAccount.authId" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'authId\'].$error" ng-show="smsAccountForm[\'authId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AUTHID_REQUIRED">AuthID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'twilio\' || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'plivo\'" class="md-block">\n        <label translate="SMS.AUTHTOKEN">AuthToken</label>\n        <input type="text" name="authToken" ng-model="vm.smsAccount.authToken" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'authToken\'].$error" ng-show="smsAccountForm[\'authToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'skebby\'" class="md-block">\n        <label translate="SMS.METHOD">Method</label>\n        <md-select name="smsMethod" ng-model="vm.smsAccount.smsMethod" required>\n          <md-option ng-value="\'SI\'">Basic</md-option>\n          <md-option ng-value="\'TI\'">Classic</md-option>\n          <md-option ng-value="\'GP\'">Classic+</md-option>\n        </md-select>\n        <div ng-messages="smsAccountForm[\'smsMethod\'].$error" ng-show="smsAccountForm[\'smsMethod\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.METHOD_REQUIRED">Method field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'" class="md-block">\n        <label translate="SMS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.smsAccount.username" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'username\'].$error" ng-show="smsAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'">\n        <label translate="SMS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.smsAccount.password" placeholder="Password" translate translate-attr-placeholder="SMS.PASSWORD" required>\n        <div ng-messages="smsAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SMS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'csc\'" class="md-block">\n        <label translate="SMS.BASEURL">BaseURL</label>\n        <input type="text" name="baseUrl" ng-model="vm.smsAccount.baseUrl" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'baseUrl\'].$error" ng-show="smsAccountForm[\'baseUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.BASEURL_REQUIRED">BaseURL field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\' || vm.smsAccount.type == \'intelepeer\'" class="md-block">\n        <label translate="SMS.APIKEY">ApiKey</label>\n        <input type="text" name="apiKey" ng-model="vm.smsAccount.apiKey" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'apiKey\'].$error" ng-show="smsAccountForm[\'apiKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n        <label translate="SMS.ACCOUNTID">AccountId</label>\n        <input type="text" name="accountId" ng-model="vm.smsAccount.accountId" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'accountId\'].$error" ng-show="smsAccountForm[\'accountId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.ACCOUNTID_REQUIRED">AccountId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n        <label translate="SMS.APPLICATIONID">ApplicationID</label>\n        <input type="text" name="applicationId" ng-model="vm.smsAccount.applicationId" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'applicationId\'].$error" ng-show="smsAccountForm[\'applicationId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.APPLICATIONID_REQUIRED">ApplicationID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.smsAccount.description">\n\n        <div ng-messages="smsAccountForm[\'description\'].$error" ng-show="smsAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSmsAccount" ng-click="vm.saveSmsAccount()" class="send-button md-accent md-raised" ng-disabled="smsAccountForm.$invalid || smsAccountForm.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSmsAccount" ng-click="vm.addNewSmsAccount()" class="send-button md-accent md-raised" ng-disabled="smsAccountForm.$invalid" aria-label="ADD" translate="SMS.ADD_SMSACCOUNT" translate-attr-aria-label="SMS.ADD_SMSACCOUNT">\n          ADD SMSACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmsAccount" ng-click="vm.deleteSmsAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="SMS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SMS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",'<md-dialog class="smsAccount-dialog" aria-label="smsAccount" ng-init="vm.onInit()">\n  <form name="smsAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="SMS.AGENTADD_SMSACCOUNT">Add Agent to smsAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/agent/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'agent\'].$error" ng-show="smsAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'timeout\'].$error" ng-show="smsAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/amazonlex/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'accesskeyid\'].$error" ng-show="smsAccountFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'secretaccesskey\'].$error" ng-show="smsAccountFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'lexregion\'].$error" ng-show="smsAccountFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'botname\'].$error" ng-show="smsAccountFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="SMS.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="smsAccountFormApp[\'welcomemessage\'].$error" ng-show="smsAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'times\'].$error" ng-show="smsAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="smsAccountFormApp[\'text\'].$error" ng-show="smsAccountFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/close/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'disposition\'].$error" ng-show="smsAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/dialogflow/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'key\'].$error" ng-show="smsAccountFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'language\'].$error" ng-show="smsAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="SMS.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="smsAccountFormApp[\'welcomemessage\'].$error" ng-show="smsAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'projectId\'].$error" ng-show="smsAccountFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'clientEmail\'].$error" ng-show="smsAccountFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="smsAccountFormApp[\'privateKey\'].$error" ng-show="smsAccountFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'language\'].$error" ng-show="smsAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="SMS.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="smsAccountFormApp[\'welcomemessage\'].$error" ng-show="smsAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'condition\'].$error" ng-show="smsAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'truepriority\'].$error" ng-show="smsAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'falsepriority\'].$error" ng-show="smsAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'priority\'].$error" ng-show="smsAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/noop/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'value\'].$error" ng-show="smsAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/queue/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'queue\'].$error" ng-show="smsAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'timeout\'].$error" ng-show="smsAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/system/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'command\'].$error" ng-show="smsAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'variable\'].$error" ng-show="smsAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/tag/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'tag\'].$error" ng-show="smsAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/smsCannedAnswers/dialog.html",'<md-dialog class="smsCannedAnswer-dialog" aria-label="New SmsCannedAnswer">\n  <form name="smsCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.smsCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="smsCannedAnswerForm[\'key\'].$error" ng-show="smsCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.smsCannedAnswer.value" required></textarea>\n\n        <div ng-messages="smsCannedAnswerForm[\'value\'].$error" ng-show="smsCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.smsCannedAnswer.description">\n\n        <div ng-messages="smsCannedAnswerForm[\'description\'].$error" ng-show="smsCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSmsCannedAnswer" ng-click="vm.saveSmsCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="smsCannedAnswerForm.$invalid || smsCannedAnswerForm.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSmsCannedAnswer" ng-click="vm.addNewSmsCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="smsCannedAnswerForm.$invalid" aria-label="ADD" translate="SMS.ADD_SMSCANNEDANSWER" translate-attr-aria-label="SMS.ADD_SMSCANNEDANSWER">\n          ADD SMSCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmsCannedAnswer" ng-click="vm.deleteSmsCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="SMS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SMS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/view.html",'<div id="sms-smsAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-smsAccounts-button md-icon-button" aria-label="Go to smsAccounts" ng-click="vm.gotoSmsAccounts()" translate translate-attr-aria-label="SMS.GO_TO_SMSACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="smsAccount-image" hide-xs>\n          <img ng-src="assets/images/business/smsAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.smsAccount.id}}\n            <span ng-if="vm.smsAccount.name">{{vm.smsAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="SMS.CREATED_AT"></span> <span>{{vm.smsAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.smsAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="SMS.AGENTADD_SMSACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSmsAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (proxyForm.$invalid) || (dispositionForm.$invalid) || (smsDispositionsForm.$invalid) || (smsCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="SMS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.smsAccount.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.smsAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="SMS.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.smsAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="SMS.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.smsAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'twilio\'">Twilio</md-option>\n                  <md-option ng-value="\'skebby\'">Skebby</md-option>\n                  <md-option ng-value="\'connectel\'">Connectel</md-option>\n                  <md-option ng-value="\'clicksend\'">ClickSend</md-option>\n                  <md-option ng-value="\'plivo\'">Plivo</md-option>\n                  <md-option ng-value="\'infobip\'">Infobip</md-option>\n                  <md-option ng-value="\'clickatell\'">Clickatell</md-option>\n                  <md-option ng-value="\'bandwidth\'">Bandwidth</md-option>\n                  <md-option ng-value="\'csc\'">CSCTelecom</md-option>\n                  <md-option ng-value="\'intelepeer\'">Intelepeer</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.smsAccount.phone" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'phone\'].$error" ng-show="generalForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'twilio\'" class="md-block">\n                <label translate="SMS.ACCOUNTSID">AccountSID</label>\n                <input type="text" name="accountSid" ng-model="vm.smsAccount.accountSid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'accountSid\'].$error" ng-show="generalForm[\'accountSid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'plivo\'" class="md-block">\n                <label translate="SMS.AUTHID">AuthID</label>\n                <input type="text" name="authId" ng-model="vm.smsAccount.authId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'authId\'].$error" ng-show="generalForm[\'authId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AUTHID_REQUIRED">AuthID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'twilio\' || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'plivo\'" class="md-block">\n                <label translate="SMS.AUTHTOKEN">AuthToken</label>\n                <input type="text" name="authToken" ng-model="vm.smsAccount.authToken" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'authToken\'].$error" ng-show="generalForm[\'authToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'skebby\'" class="md-block">\n                <label translate="SMS.METHOD">Method</label>\n                <md-select name="smsMethod" ng-model="vm.smsAccount.smsMethod" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'SI\'">Basic</md-option>\n                  <md-option ng-value="\'TI\'">Classic</md-option>\n                  <md-option ng-value="\'GP\'">Classic+</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'smsMethod\'].$error" ng-show="generalForm[\'smsMethod\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.METHOD_REQUIRED">Method field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.smsAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'">\n                <label translate="SMS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.smsAccount.password" placeholder="Password" translate translate-attr-placeholder="SMS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="SMS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container ng-if="vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'csc\'" class="md-block">\n                <label translate="SMS.BASEURL">BaseURL</label>\n                <input type="text" name="baseUrl" ng-model="vm.smsAccount.baseUrl" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'baseUrl\'].$error" ng-show="generalForm[\'baseUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.BASEURL_REQUIRED">BaseURL field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\' || vm.smsAccount.type == \'intelepeer\'" class="md-block">\n                <label translate="SMS.APIKEY">ApiKey</label>\n                <input type="text" name="apiKey" ng-model="vm.smsAccount.apiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'apiKey\'].$error" ng-show="generalForm[\'apiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.ACCOUNTID">AccountId</label>\n                <input type="text" name="accountId" ng-model="vm.smsAccount.accountId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'accountId\'].$error" ng-show="generalForm[\'accountId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.ACCOUNTID_REQUIRED">AccountId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.APPLICATIONID">ApplicationID</label>\n                <input type="text" name="applicationId" ng-model="vm.smsAccount.applicationId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'applicationId\'].$error" ng-show="generalForm[\'applicationId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.APPLICATIONID_REQUIRED">ApplicationID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'plivo\'|| vm.smsAccount.type == \'csc\'|| vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'intelepeer\'" class="md-block">\n                <label translate="SMS.SENDERSTRING">SenderString</label>\n                <input type="text" name="senderString" ng-model="vm.smsAccount.senderString" md-maxlength="11" ng-pattern="/^[A-Za-z0-9\\.\\s]*$/i" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'senderString\'].$error" ng-show="generalForm[\'senderString\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.SENDERSTRING_REQUIRED">SenderString field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="SMS.ERRORS.SENDERSTRING_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\s]*$/i\' }">SenderString must be valid pattern </span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="SMS.ERRORS.SENDERSTRING_MAX_LENGTH" translate-values=\'{max: 11}\'>SenderString must have a maximum length equal to 11</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="(vm.smsAccount.type == \'skebby\' && vm.smsAccount.smsMethod == \'GP\') || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\'" class="md-block">\n                <md-switch ng-model="vm.smsAccount.deliveryReport" aria-label="deliveryReport" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.DELIVERYREPORT">deliveryReport</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.smsAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.smsAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.RECEIVEURL">receiveUrl</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-receiveUrl" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-receiveUrl" name="receiveUrl" ng-value="vm.smsAccount.remote + \'/api/sms/accounts/\' + vm.smsAccount.id + \'/notify?token=\' + vm.smsAccount.token" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="SMS.HELP.RECEIVEURL"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="( ((vm.smsAccount.type == \'skebby\' && vm.smsAccount.smsMethod == \'GP\') || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\') && vm.smsAccount.deliveryReport) || vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.DELIVERYREPORTURL">deliveryReportUrl</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-deliveryReportUrl" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-deliveryReportUrl" name="deliveryReportUrl" ng-value="vm.smsAccount.remote + \'/api/sms/accounts/\' + vm.smsAccount.id + \'/status?token=\' + vm.smsAccount.token + (vm.smsAccount.type == \'csc\' ? \'&message-id={message-id}&state={state}\' : \'\')" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="SMS.HELP.DELIVERYREPORTURL"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="smsAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="SMS.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.smsAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="smsAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.queueTransfer == true" class="md-block">\n                <label translate="SMS.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.smsAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.agentTransfer == true" class="md-block">\n                <label translate="SMS.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.smsAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container proxy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.PROXY">PROXY</div>\n            </div>\n            <form name="proxyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="SMS.TOKEN">token</label>\n                <input type="text" name="token" ng-model="vm.smsAccount.token" autofocus disabled>\n\n                <div ng-messages="proxyForm[\'token\'].$error" ng-show="proxyForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.TOKEN_REQUIRED">token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.MOTIONPROXY">MotionProxy</label>\n                <input type="url" name="remote" ng-model="vm.smsAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="SMS.HELP.MOTIONPROXY"></span></div>\n                <div ng-messages="proxyForm[\'remote\'].$error" ng-show="proxyForm[\'remote\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="SMS.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="SMS.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="smsAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.mandatoryDisposition" class="md-block">\n                <label translate="SMS.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.smsAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="SMS.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="SmsAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.smsAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="smsAccount-detail-form-container smsdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedSmsAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="SMS.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add sms dispositions" translate translate-attr-label="SMS.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="smsAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'SMS.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'SMS.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'SMS.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container smscannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="SmsAccountSmsCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.smsAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedSmsAccountSmsCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SMS.SMSCANNEDANSWERS">SmsCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getSmsAccountSmsCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event)" aria-label="add smsCannedAnswer" translate translate-attr-label="SMS.ADD_SMSCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedSmsAccountSmsCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedSmsAccountSmsCannedAnswers.length}} {{vm_dc.selectedSmsAccountSmsCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedSmsAccountSmsCannedAnswers" csv-label="true" filename="smsAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedSmsAccountSmsCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedSmsAccountSmsCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getSmsAccountSmsCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'SMS.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'SMS.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'SMS.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'SMS.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'SMS.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="smsCannedAnswer" md-select-id="id" ng-repeat="smsCannedAnswer in vm_dc.smsAccountSmsCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{ smsCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" translate="SMS.EDIT_SMSCANNEDANSWER">\n                                Edit SmsCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(smsCannedAnswer, $event)" translate="SMS.DELETE_SMSCANNEDANSWER">\n                                Delete SmsCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.smsAccountSmsCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="SMS.NO_SMSCANNEDANSWER_AVAILABLE">No smscannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.smsAccountSmsCannedAnswers.count}}" md-on-paginate="vm_dc.getSmsAccountSmsCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="SmsAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.smsAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="SMS.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedSmsAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedSmsAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedSmsAccountApps.length}} {{vm_ac.selectedSmsAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedSmsAccountApps($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedSmsAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.smsAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editSmsAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editSmsAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editSmsAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editSmsAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.smsAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="SmsAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.smsAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedSmsAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SMS.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getSmsAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getSmsAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getSmsAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="SMS.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedSmsAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedSmsAccountInteractions.length}} {{vm_dc.selectedSmsAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedSmsAccountInteractions" csv-label="true" filename="smsAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedSmsAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedSmsAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getSmsAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'SMS.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'SMS.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'SMS.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'SMS.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'SMS.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'SMS.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'SMS.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.smsAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'SMS.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'SMS.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spysmsInteraction($event, interaction)" translate="SMS.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.smsInteractionDownload(interaction, $event)" translate="SMS.DOWNLOAD_INTERACTION">\n                                Download\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="SMS.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.smsAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="SMS.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.smsAccountInteractions.count}}" md-on-paginate="vm_dc.getSmsAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/sms/views/smsAccounts/smsAccounts.html",'<div id="smsAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-message-text" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SMS.SMSACCOUNTS">SmsAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SMS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSmsAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSmsAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SMS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-smsAccounts-count">\n          <span>{{vm.selectedSmsAccounts.length}}</span>\n          <span translate="SMS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SMS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSmsAccounts()" translate="SMS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSmsAccounts()" translate="SMS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSmsAccounts" csv-label="true" filename="smsAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSmsAccounts($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SMSACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSmsAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSmsAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SMS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'SMS.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'SMS.KEY\' | translate }}</th>\n                <th md-column md-order-by="ListId">{{ \'SMS.LIST\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'SMS.TYPE\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'SMS.PHONE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'SMS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.smsAccounts.rows.length">\n                <td md-cell colspan="8">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="smsAccount" md-select-id="id" ng-repeat="smsAccount in vm.smsAccounts.rows">\n                <td md-cell ng-if="smsAccount.userpic"><img class="avatar" alt="{{smsAccount.name}}" ng-src="api/users/{{smsAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!smsAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{smsAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="id ">{{smsAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="name ">{{smsAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="key ">{{smsAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="ListId ">{{ (vm.lists | filter : {\'id\':smsAccount.ListId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="type ">{{ vm.arraytype[smsAccount.type].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="phone ">{{smsAccount.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="description ">{{smsAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(smsAccount, $event    )" translate="SMS.EDIT_SMSACCOUNT">\n                          Edit SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(smsAccount, $event    )" translate="SMS.INTERACTIONS_SMSACCOUNT">\n                          Interactions SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(smsAccount, $event    )" translate="SMS.AGENTADD_SMSACCOUNT">\n                          AgentAdd SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(smsAccount, $event    )" translate="SMS.DELETE_SMSACCOUNT">\n                          Delete SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.smsAccounts.count}}" md-on-paginate="vm.getSmsAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SMSACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SMSACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-smsAccount-button" ng-click="vm.createOrEditSmsAccount($event)" aria-label="add smsAccount" translate translate-attr-aria-label="SMS.ADD_SMSACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SMSACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/sms/views/smsQueues/create/dialog.html",'<md-dialog class="smsQueue-dialog" aria-label="New SmsQueue">\n  <form name="smsQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.smsQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newSmsQueue">\n\n        <div class="hint"><span translate="SMS.HELP.NAME"></span></div>\n        <div ng-messages="smsQueueForm[\'name\'].$error" ng-show="smsQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SMS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.smsQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="smsQueueForm[\'strategy\'].$error" ng-show="smsQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.smsQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="smsQueueForm[\'timeout\'].$error" ng-show="smsQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.smsQueue.description">\n\n        <div ng-messages="smsQueueForm[\'description\'].$error" ng-show="smsQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSmsQueue" ng-click="vm.saveSmsQueue()" class="send-button md-accent md-raised" ng-disabled="smsQueueForm.$invalid || smsQueueForm.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSmsQueue" ng-click="vm.addNewSmsQueue()" class="send-button md-accent md-raised" ng-disabled="smsQueueForm.$invalid" aria-label="ADD" translate="SMS.ADD_SMSQUEUE" translate-attr-aria-label="SMS.ADD_SMSQUEUE">\n          ADD SMSQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmsQueue" ng-click="vm.deleteSmsQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="SMS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SMS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",'<md-dialog class="smsQueue-dialog" aria-label="smsQueue" ng-init="vm.onInit()">\n  <form name="smsQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="SMS.AGENTADD_SMSQUEUE">Add Agent to smsQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",'<md-dialog class="smsQueue-dialog" aria-label="smsQueue" ng-init="vm.onInit()">\n  <form name="smsQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="SMS.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsQueues/edit/view.html",'<div id="sms-smsQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-smsQueues-button md-icon-button" aria-label="Go to smsQueues" ng-click="vm.gotoSmsQueues()" translate translate-attr-aria-label="SMS.GO_TO_SMSQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="smsQueue-image" hide-xs>\n          <img ng-src="assets/images/business/smsQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.smsQueue.id}}\n            <span ng-if="vm.smsQueue.name">{{vm.smsQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="SMS.CREATED_AT"></span> <span>{{vm.smsQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.smsQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="SMS.TEAMADD_SMSQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.smsQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="SMS.AGENTADD_SMSQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSmsQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="SMS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.smsQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="SMS.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="SMS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.smsQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.smsQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.smsQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/sms/views/smsQueues/smsQueues.html",'<div id="smsQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-message-text" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SMS.SMSQUEUES">SmsQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SMS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSmsQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSmsQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SMS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-smsQueues-count">\n          <span>{{vm.selectedSmsQueues.length}}</span>\n          <span translate="SMS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SMS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSmsQueues()" translate="SMS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSmsQueues()" translate="SMS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSmsQueues" csv-label="true" filename="smsQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSmsQueues($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SMSQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSmsQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSmsQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SMS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'SMS.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'SMS.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.smsQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="smsQueue" md-select-id="id" ng-repeat="smsQueue in vm.smsQueues.rows">\n                <td md-cell ng-if="smsQueue.userpic"><img class="avatar" alt="{{smsQueue.name}}" ng-src="api/users/{{smsQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!smsQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{smsQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsQueue, ev) : vm.createOrEditSmsQueue($event, smsQueue)" md-cell class="id ">{{smsQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsQueue, ev) : vm.createOrEditSmsQueue($event, smsQueue)" md-cell class="name ">{{smsQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsQueue, ev) : vm.createOrEditSmsQueue($event, smsQueue)" md-cell class="strategy ">{{ vm.arraystrategy[smsQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(smsQueue, $event    )" translate="SMS.EDIT_SMSQUEUE">\n                          Edit SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(smsQueue, $event    )" translate="SMS.TEAMADD_SMSQUEUE">\n                          teamadd SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(smsQueue, $event    )" translate="SMS.AGENTADD_SMSQUEUE">\n                          agentadd SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(smsQueue, $event    )" translate="SMS.DELETE_SMSQUEUE">\n                          Delete SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(smsQueue, $event    )" translate="SMS.GOTOREALTIME_SMSQUEUE">\n                          goToRealtime SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.smsQueues.count}}" md-on-paginate="vm.getSmsQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SMSQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SMSQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-smsQueue-button" ng-click="vm.createOrEditSmsQueue($event)" aria-label="add smsQueue" translate translate-attr-aria-label="SMS.ADD_SMSQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SMSQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/agents/agents.html",'<div id="agents" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.AGENTS">Agents</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedAgents.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedAgents =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-agents-count">\n          <span>{{vm.selectedAgents.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllAgents()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectAgents()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedAgents" csv-label="true" filename="agents.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedAgents($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- AGENT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedAgents" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAgents">\n              <tr md-row>\n                <th md-column width="20px"></th>\n                <th md-column md-order-by="fullname">{{ \'STAFF.FULLNAME\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="showWebBar">{{ \'STAFF.SHOWWEBCONTROL\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'STAFF.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'STAFF.PHONE\' | translate }}</th>\n                <th md-column md-order-by="mobile">{{ \'STAFF.MOBILE\' | translate }}</th>\n                <th md-column md-order-by="internal">{{ \'STAFF.INTERNAL\' | translate }}</th>\n                <th md-column md-order-by="disabled">{{ \'STAFF.DISABLED\' | translate }}</th>\n                <th md-column md-order-by="blocked">{{ \'STAFF.BLOCKED\' | translate }}</th>\n                <th md-column>{{ \'STAFF.CLIENT_LOGS\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.agents.rows.length">\n                <td md-cell colspan="10">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="agent" md-select-id="id" ng-repeat="agent in vm.agents.rows">\n                <td md-cell ng-if="agent.userpic"><img class="avatar" alt="{{agent.name}}" ng-src="api/users/{{agent.id}}/avatar" /></td>\n                <td md-cell ng-if="!agent.userpic"><img class="avatar" alt="{{agent.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="fullname font-weight-600">{{agent.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="name">{{agent.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="showWebBar">{{ agent.showWebBar | getOptionByValue: vm.showWebBarOptions }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="email">{{agent.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="phone">{{agent.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="mobile">{{agent.mobile}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="internal">{{agent.internal}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="disabled">\n                  <md-icon md-colors="{color: {{agent.disabled ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{agent.disabled ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="blocked">\n                  <md-icon md-colors="{color: {{agent.blocked ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{agent.blocked ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="client-side-logging">\n                  <ms-client-side-logging-icon user="agent"></ms-client-side-logging-icon>\n                </td>\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(agent, $event    )" translate="STAFF.EDIT_AGENT">\n                          Edit Agent\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item>\n                        <md-button ng-click="vm.teamadddialog(agent, $event    )" translate="STAFF.TEAMADD_AGENT">\n                          teamadd Agent\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(agent, $event    )" translate="STAFF.DELETE_AGENT">\n                          Delete Agent\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.agents.count}}" md-on-paginate="vm.getAgents" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / AGENT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD AGENT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-agent-button" ng-click="vm.createOrEditAgent($event)" aria-label="add agent" translate translate-attr-aria-label="STAFF.ADD_AGENT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD AGENT BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/agents/create/dialog.html",'<md-dialog class="agent-dialog" aria-label="New Agent">\n  <form name="agentForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.FULLNAME">Fullname</label>\n        <input type="text" name="fullname" ng-model="vm.agent.fullname" ng-required="true" autofocus>\n\n        <div ng-messages="agentForm[\'fullname\'].$error" ng-show="agentForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.USERNAME">Username</label>\n        <input type="text" name="name" ng-model="vm.agent.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" ng-disabled="!vm.newAgent">\n\n        <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n        <div ng-messages="agentForm[\'name\'].$error" ng-show="agentForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.agent.alias">\n\n        <div ng-messages="agentForm[\'alias\'].$error" ng-show="agentForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.SHOWWEBCONTROL">ShowWebControl</label>\n        <md-select name="showWebBar" ng-model="vm.agent.showWebBar">\n          <md-option ng-value="0">Phonebar</md-option>\n          <md-option ng-value="1">External</md-option>\n          <md-option ng-value="2">WebRTC</md-option>\n        </md-select>\n        <div ng-messages="agentForm[\'showWebBar\'].$error" ng-show="agentForm[\'showWebBar\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.SHOWWEBCONTROL_REQUIRED">ShowWebControl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.agent.email" ng-required="true">\n\n        <div ng-messages="agentForm[\'email\'].$error" ng-show="agentForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newAgent">\n        <label translate="STAFF.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.agent.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="STAFF.PASSWORD" required>\n        <div ng-messages="agentForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newAgent  && (vm.newAgent)">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="agentForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newAgent" class="md-block">\n        <md-switch ng-model="vm.agent.autointernal" aria-label="AutoInternal"><span translate="STAFF.AUTOINTERNAL">AutoInternal</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.agent.autointernal" class="md-block">\n        <label translate="STAFF.INTERNAL">Internal</label>\n        <input type="text" name="internal" ng-model="vm.agent.internal" ng-required="true" ng-disabled="!vm.newAgent">\n\n        <div ng-messages="agentForm[\'internal\'].$error" ng-show="agentForm[\'internal\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.agent.description">\n\n        <div ng-messages="agentForm[\'description\'].$error" ng-show="agentForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newAgent" class="md-block">\n        <md-switch ng-model="vm.agent.voicemail" aria-label="Voicemail"><span translate="STAFF.VOICEMAIL">Voicemail</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.agent.userSetting">\n        <ms-client-side-logging user="vm.agent"></ms-client-side-logging>\n      </md-input-container>\n      <md-input-container ng-if="vm.agent.showWebBar == 0" class="md-block">\n        <md-switch ng-model="vm.agent.phoneBarRemoteControl" aria-label="RemoteControl"><span translate="STAFF.REMOTECONTROL">RemoteControl</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.agent.phoneBarRemoteControl && vm.agent.showWebBar == 0" class="md-block">\n        <label translate="STAFF.REMOTECONTROLPORT">RemoteControlPort</label>\n        <input type="number" name="phoneBarRemoteControlPort" ng-model="vm.agent.phoneBarRemoteControlPort" value="9888" ng-required="true">\n\n        <div ng-messages="agentForm[\'phoneBarRemoteControlPort\'].$error" ng-show="agentForm[\'phoneBarRemoteControlPort\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.REMOTECONTROLPORT_REQUIRED">RemoteControlPort field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newUser" class="md-block">\n        <md-switch ng-model="vm.agent.voicemail" aria-label="Voicemail"><span translate="STAFF.VOICEMAIL">Voicemail</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAgent" ng-click="vm.saveAgent()" class="send-button md-accent md-raised" ng-disabled="agentForm.$invalid || agentForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAgent" ng-click="vm.addNewAgent()" class="send-button md-accent md-raised" ng-disabled="agentForm.$invalid" aria-label="ADD" translate="STAFF.ADD_AGENT" translate-attr-aria-label="STAFF.ADD_AGENT">\n          ADD AGENT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAgent" ng-click="vm.deleteAgent($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/changepassword/changepassword.html",'<md-dialog class="agent-dialog" aria-label="{{vm.name}}">\n  <form name="agentForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.CHANGE_PASSWORD\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.agent.id">\n        <label translate="STAFF.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="STAFF.OLD_PASSWORD" required>\n        <div ng-messages="agentForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" translate ng-pattern="vm.passwordPattern" translate-attr-placeholder="STAFF.NEW_PASSWORD" required>\n        <div ng-messages="agentForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is\n              required</span>\n          </div>\n\n\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain\n              at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric\n              character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="STAFF.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n\n\n\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="agentForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is\n              required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did\n              not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="agentForm.$invalid || agentForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",'<md-dialog class="agent-dialog" aria-label="agent" ng-init="vm.onInit()">\n  <form name="agentForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2>{{vm.title}}</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin" ng-if="vm.agent.role === \'agent\' && vm.channel === \'voice\'">\n        <label translate="STAFF.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="agentForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" add-disabled="vm.channel === \'voice\' && vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveQueues()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",'<md-dialog class="agent-dialog" aria-label="agent" ng-init="vm.onInit()">\n  <form name="agentForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="STAFF.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/view.html",'<div id="staff-agent" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-agents-button md-icon-button" aria-label="Go to agents" ng-click="vm.gotoAgents()" translate translate-attr-aria-label="STAFF.GO_TO_AGENTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="agent-image" hide-xs>\n          <img ng-src="assets/images/business/agents.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.agent.id}}\n            <span ng-if="vm.agent.name">{{vm.agent.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.agent.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div ng-cloak>\n      <md-fab-speed-dial md-direction="left" class="md-scale md-fab">\n        <md-fab-trigger>\n          <md-button aria-label="menu" class="md-fab md-primary md-icon-button">\n            <md-tooltip md-direction="top" md-visible="false"><span translate="STAFF.CHANNELS">Channels</span></md-tooltip>\n            <md-icon md-font-icon="icon-stackoverflow" aria-label="queueadd"></md-icon>\n          </md-button>\n        </md-fab-trigger>\n        <md-fab-actions>\n          <md-button aria-label="voice" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'voice\', $event, \'inbound\')">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="VOICE.VOICE">Voice</span></md-tooltip>\n            <md-icon md-font-icon="icon-phone" aria-label="voice"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.dialer" aria-label="motion bull" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'voice\', $event, \'outbound\')">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="MOTIONDIALER.MOTIONDIALER">Motion Bull</span></md-tooltip>\n            <md-icon md-font-icon="icon-fire" aria-label="motion bull"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.chat" aria-label="chat" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'chat\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="CHAT.CHAT">Chat</span></md-tooltip>\n            <md-icon md-font-icon="icon-hangouts" aria-label="chat"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.mail" aria-label="mail" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'mail\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="MAIL.MAIL">Email</span></md-tooltip>\n            <md-icon md-font-icon="icon-email" aria-label="mail"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.messaging" aria-label="sms" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'sms\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="SMS.SMS">Sms</span></md-tooltip>\n            <md-icon md-font-icon="icon-message-text" aria-label="sms"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.openchannel" aria-label="openchannel" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'openchannel\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="OPENCHANNEL.OPENCHANNEL">Openchannel</span></md-tooltip>\n            <md-icon md-font-icon="icon-google-earth" aria-label="openchannel"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.fax" aria-label="fax" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'fax\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="FAX.FAX">Fax</span></md-tooltip>\n            <md-icon md-font-icon="icon-deskphone" aria-label="fax"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.whatsapp" aria-label="whatsapp" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'whatsapp\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="WHATSAPP.WHATSAPP">whatsapp</span></md-tooltip>\n            <md-icon md-font-icon="icon-whatsapp" aria-label="whatsapp"></md-icon>\n          </md-button>\n        </md-fab-actions>\n      </md-fab-speed-dial>\n    </div>\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.agent, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="STAFF.TEAMADD_AGENT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.changepassworddialog(vm.agent, $event)" class="md-fab md-warn md-icon-button" aria-label="changepassword">\n        <md-tooltip><span translate="STAFF.CHANGEPASSWORD_AGENT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-key-variant"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveAgent()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(personal_infoForm.$invalid) || (security_suiteForm.$invalid) || (change_avatarForm.$invalid) || (generalForm.$invalid) || (capacityForm.$invalid) || (settingsForm.$invalid) || (remote_controlForm.$invalid) || (sipForm.$invalid) || (callforwardingForm.$invalid) || (settings_webrtcForm.$invalid) || (sip_webrtcForm.$invalid) || (general_permissionsForm.$invalid) || (download_permissionsForm.$invalid) || (permissionsForm.$invalid) || (autoAnswerForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.PERSONAL_INFO">PERSONAL_INFO</div>\n            </div>\n            <form name="personal_infoForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.FULLNAME">Fullname</label>\n                <input type="text" name="fullname" ng-model="vm.agent.fullname" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'fullname\'].$error" ng-show="personal_infoForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.USERNAME">Username</label>\n                <input type="text" name="name" ng-model="vm.agent.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" disabled>\n                <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n                <div ng-messages="personal_infoForm[\'name\'].$error" ng-show="personal_infoForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.agent.alias" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'alias\'].$error" ng-show="personal_infoForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SHOWWEBCONTROL">ShowWebControl</label>\n                <md-select name="showWebBar" ng-model="vm.agent.showWebBar" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="0">Phonebar</md-option>\n                  <md-option ng-value="1">External</md-option>\n                  <md-option ng-value="2">WebRTC</md-option>\n                </md-select>\n                <div ng-messages="personal_infoForm[\'showWebBar\'].$error" ng-show="personal_infoForm[\'showWebBar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SHOWWEBCONTROL_REQUIRED">ShowWebControl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.agent.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'email\'].$error" ng-show="personal_infoForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.agent.phone" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'phone\'].$error" ng-show="personal_infoForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MOBILE">Mobile</label>\n                <input type="text" name="mobile" ng-model="vm.agent.mobile" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'mobile\'].$error" ng-show="personal_infoForm[\'mobile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MOBILE_REQUIRED">Mobile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 1" class="md-block">\n                <md-switch ng-model="vm.agent.hotdesk" aria-label="Hotdesk" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.HOTDESK">Hotdesk</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.loginInPause" aria-label="LoginInPause" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.LOGININPAUSE">LoginInPause</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.agent.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'description\'].$error" ng-show="personal_infoForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container security_suite md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SECURITY_SUITE">SECURITY_SUITE</div>\n            </div>\n            <form name="security_suiteForm" novalidate>\n              <md-input-container ng-if="vm.agent.passwordResetAt != null" class="md-block">\n                <label translate="STAFF.LAST_PASSWORD_RESET_AT">Last_Password_Reset_At</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.agent.passwordResetAt" autofocus disabled>\n                <div class="hint"><span translate="STAFF.HELP.LAST_PASSWORD_RESET_AT"></span></div>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.LAST_PASSWORD_RESET_AT_REQUIRED">Last_Password_Reset_At field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.passwordResetAt == null" class="md-block">\n                <label translate="STAFF.NO_PASSWORD_CHANGE">No_Password_Change</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.agent.passwordResetAt" disabled>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NO_PASSWORD_CHANGE_REQUIRED">No_Password_Change field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.disabled" aria-label="Disabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DISABLED">Disabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.DISABLED"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.disabled == 0" class="md-block">\n                <md-switch ng-model="vm.agent.blocked" aria-label="Blocked" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.BLOCKED">Blocked</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.BLOCKED"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.privacyEnabled" aria-label="Mask_Sensitive_Data" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container authentication md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.AUTHENTICATION">AUTHENTICATION</div>\n            </div>\n            <form name="authenticationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.adSsoEnabled" aria-label="AD_SSO_Enabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AD_SSO_ENABLED">AD_SSO_Enabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.AD_SSO_ENABLED"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container change_avatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CHANGE_AVATAR">CHANGE_AVATAR</div>\n            </div>\n            <div ng-controller="Agentchange_avatarController as vm_ca" ng-init="vm_ca.init(vm.agent, vm.crudPermissions)" class="agent-detail-form-container md-background-bg md-whiteframe-1dp">\n              <div id="agent-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="change_avatarimage in vm_ca.agent.images" ng-switch="change_avatarimage.type">\n                    <div class="agent-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{change_avatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="change_avatarimage.file">\n                    </div>\n                    <div class="agent-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{change_avatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.VOICE">VOICE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container ng-if="!vm.agent.autointernal" class="md-block">\n                <label translate="STAFF.INTERNAL">Internal</label>\n                <input type="text" name="internal" ng-model="vm.agent.internal" ng-required="true" autofocus disabled>\n                <div ng-messages="generalForm[\'internal\'].$error" ng-show="generalForm[\'internal\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar != 2" class="md-block">\n                <label translate="STAFF.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.agent.transport" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'" ng-if="vm.agent.showWebBar == 1">ws</md-option>\n                  <md-option ng-value="\'wss\'" ng-if="vm.agent.showWebBar == 1">wss</md-option>\n                  <md-option ng-value="\'tls\'" ng-if="vm.agent.showWebBar == 1">tls</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.TRANSPORT"></span></div>\n                <div ng-messages="generalForm[\'transport\'].$error" ng-show="generalForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.HOST">Host</label>\n                <input type="text" name="host" ng-model="vm.agent.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.HOST"></span></div>\n                <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAT">NAT</label>\n                <md-select name="nat" ng-model="vm.agent.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAT_REQUIRED">NAT field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.agent.type" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'friend\'">Friend</md-option>\n                  <md-option ng-value="\'user\'">User</md-option>\n                  <md-option ng-value="\'peer\'">Peer</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.TYPE"></span></div>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.agent.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLERID">CallerId</label>\n                <input type="text" name="callerid" ng-model="vm.agent.callerid" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'callerid\'].$error" ng-show="generalForm[\'callerid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLERID_REQUIRED">CallerId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.agent.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLGROUP">Callgroup</label>\n                <input type="text" name="callgroup" ng-model="vm.agent.callgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.CALLGROUP"></span></div>\n                <div ng-messages="generalForm[\'callgroup\'].$error" ng-show="generalForm[\'callgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLGROUP_REQUIRED">Callgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PICKUPGROUP">Pickupgroup</label>\n                <input type="text" name="pickupgroup" ng-model="vm.agent.pickupgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.PICKUPGROUP"></span></div>\n                <div ng-messages="generalForm[\'pickupgroup\'].$error" ng-show="generalForm[\'pickupgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PICKUPGROUP_REQUIRED">Pickupgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.chanspy" aria-label="chanSpy" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.CHANSPY">chanSpy</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.agent.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'videosupport\'].$error" ng-show="generalForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MONITOREXTENSION">MonitorExtension</label>\n                <md-select name="extensionMonitor" ng-model="vm.agent.extensionMonitor" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'WAV\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'extensionMonitor\'].$error" ng-show="generalForm[\'extensionMonitor\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MONITOREXTENSION_REQUIRED">MonitorExtension field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.OTHER_CHANNELS">OTHER_CHANNELS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container capacity md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CAPACITY">CAPACITY</div>\n            </div>\n            <form name="capacityForm" novalidate>\n              <md-input-container ng-if="vm.license.chat" class="md-block">\n                <label translate="STAFF.CHATCAPACITY">ChatCapacity</label>\n                <input type="number" name="chatCapacity" ng-model="vm.agent.chatCapacity" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.CHATCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'chatCapacity\'].$error" ng-show="capacityForm[\'chatCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CHATCAPACITY_REQUIRED">ChatCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.CHATCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ChatCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.mail" class="md-block">\n                <label translate="STAFF.MAILCAPACITY">MailCapacity</label>\n                <input type="number" name="mailCapacity" ng-model="vm.agent.mailCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.MAILCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'mailCapacity\'].$error" ng-show="capacityForm[\'mailCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MAILCAPACITY_REQUIRED">MailCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.MAILCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MailCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.messaging" class="md-block">\n                <label translate="STAFF.SMSCAPACITY">SMSCapacity</label>\n                <input type="number" name="smsCapacity" ng-model="vm.agent.smsCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SMSCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'smsCapacity\'].$error" ng-show="capacityForm[\'smsCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SMSCAPACITY_REQUIRED">SMSCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.SMSCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">SMSCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.openchannel" class="md-block">\n                <label translate="STAFF.OPENCHANNELCAPACITY">OpenchannelCapacity</label>\n                <input type="number" name="openchannelCapacity" ng-model="vm.agent.openchannelCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.OPENCHANNELCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'openchannelCapacity\'].$error" ng-show="capacityForm[\'openchannelCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.OPENCHANNELCAPACITY_REQUIRED">OpenchannelCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.OPENCHANNELCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">OpenchannelCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.fax" class="md-block">\n                <label translate="STAFF.FAXCAPACITY">FaxCapacity</label>\n                <input type="number" name="faxCapacity" ng-model="vm.agent.faxCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.FAXCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'faxCapacity\'].$error" ng-show="capacityForm[\'faxCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.FAXCAPACITY_REQUIRED">FaxCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.FAXCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">FaxCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.whatsapp" class="md-block">\n                <label translate="STAFF.WHATSAPPCAPACITY">WhatsappCapacity</label>\n                <input type="number" name="whatsappCapacity" ng-model="vm.agent.whatsappCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.WHATSAPPCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'whatsappCapacity\'].$error" ng-show="capacityForm[\'whatsappCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.WHATSAPPCAPACITY_REQUIRED">WhatsappCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.WHATSAPPCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WhatsappCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container auto_answer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.AUTO_ANSWER">AUTO_ANSWER</div>\n            </div>\n            <form name="autoAnswerForm" novalidate>\n              <md-input-container ng-if="vm.license.chat" class="md-block">\n                <md-switch ng-model="vm.agent.chatAutoanswer" aria-label="chatAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.CHAT_AUTOANSWER">ChatAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.chatAutoanswer" class="md-block">\n                  <label translate="STAFF.CHAT_AUTOANSWERDELAY">ChatAutoAnswerDelay</label>\n                  <input type="number" name="chatAutoAnswerDelay" ng-model="vm.agent.chatAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.mail" class="md-block">\n                <md-switch ng-model="vm.agent.emailAutoanswer" aria-label="emailAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.EMAIL_AUTOANSWER">EmailAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.emailAutoanswer" class="md-block">\n                  <label translate="STAFF.EMAIL_AUTOANSWERDELAY">EmailAutoAnswerDelay</label>\n                  <input type="number" name="emailAutoAnswerDelay" ng-model="vm.agent.emailAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.messaging" class="md-block">\n                <md-switch ng-model="vm.agent.smsAutoanswer" aria-label="smsAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.SMS_AUTOANSWER">SmsAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.smsAutoanswer" class="md-block">\n                  <label translate="STAFF.SMS_AUTOANSWERDELAY">SmsAutoAnswerDelay</label>\n                  <input type="number" name="smsAutoAnswerDelay" ng-model="vm.agent.smsAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.openchannel" class="md-block">\n                <md-switch ng-model="vm.agent.openchannelAutoanswer" aria-label="openchannelAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.OPENCHANNEL_AUTOANSWER">openchannelAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.openchannelAutoanswer" class="md-block">\n                  <label translate="STAFF.OPENCHANNEL_AUTOANSWERDELAY">openchannelAutoAnswerDelay</label>\n                  <input type="number" name="openchannelAutoAnswerDelay" ng-model="vm.agent.openchannelAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.fax" class="md-block">\n                <md-switch ng-model="vm.agent.faxAutoanswer" aria-label="faxAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.FAX_AUTOANSWER">faxAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.faxAutoanswer" class="md-block">\n                  <label translate="STAFF.FAX_AUTOANSWERDELAY">faxAutoAnswerDelay</label>\n                  <input type="number" name="faxAutoAnswerDelay" ng-model="vm.agent.faxAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.whatsapp" class="md-block">\n                <md-switch ng-model="vm.agent.whatsappAutoanswer" aria-label="whatsappAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.WHATSAPP_AUTOANSWER">whatsappAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.whatsappAutoanswer" class="md-block">\n                  <label translate="STAFF.WHATSAPP_AUTOANSWERDELAY">whatsappAutoAnswerDelay</label>\n                  <input type="number" name="whatsappAutoAnswerDelay" ng-model="vm.agent.whatsappAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.agent.showWebBar == 0">\n        <md-tab-label>\n          <span translate="STAFF.MOTIONBAR">MOTIONBAR</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container settings md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SETTINGS">SETTINGS</div>\n            </div>\n            <form name="settingsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableSettings" aria-label="EnableSettings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLESETTINGS">EnableSettings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarAutoAnswer" aria-label="AutoAnswer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AUTOANSWER">AutoAnswer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarAutoAnswer" class="md-block">\n                <label translate="STAFF.AUTOANSWERDELAY">AutoAnswerDelay</label>\n                <input type="number" name="phoneBarAutoAnswerDelay" ng-model="vm.agent.phoneBarAutoAnswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="settingsForm[\'phoneBarAutoAnswerDelay\'].$error" ng-show="settingsForm[\'phoneBarAutoAnswerDelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_REQUIRED">AutoAnswerDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AutoAnswerDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarRingInUse" aria-label="RingInUse" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.RINGINUSE">RingInUse</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableRecording" aria-label="EnableRecording" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLERECORDING">EnableRecording</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableDtmfTone" aria-label="EnableDtmfTone" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEDTMFTONE">EnableDtmfTone</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarDnd" aria-label="Dnd" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DND">Dnd</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarUnansweredCallBadge" aria-label="UnansweredCallBadge" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.UNANSWEREDCALLBADGE">UnansweredCallBadge</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 0" class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableJaws" aria-label="EnableJawsIntegration" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEJAWSINTEGRATION">EnableJawsIntegration</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 0 && vm.license.screenrecording" class="md-block">\n                <md-switch ng-change="vm.onEnableScreenRecordingByAgentSelection()" ng-model="vm.agent.phoneBarEnableScreenRecordingByAgent" aria-label="EnableScreenRecordingByAgent" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLESCREENRECORDINGBYAGENT">EnableScreenRecordingByAgent</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 0 && vm.license.screenrecording" class="md-block">\n                <md-switch ng-change="vm.onEnableAutomaticScreenRecordingSelection()" ng-model="vm.agent.phoneBarEnableAutomaticScreenRecording" aria-label="EnableAutomaticScreenRecording" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEAUTOMATICSCREENRECORDING">EnableAutomaticScreenRecording</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.ENABLEAUTOMATICSCREENRECORDING"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container remote_control md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.REMOTE_CONTROL">REMOTE_CONTROL</div>\n            </div>\n            <form name="remote_controlForm" novalidate>\n              <md-input-container ng-if="vm.agent.showWebBar == 0" class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarRemoteControl" aria-label="RemoteControl" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.REMOTECONTROL">RemoteControl</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarRemoteControl && vm.agent.showWebBar == 0" class="md-block">\n                <label translate="STAFF.REMOTECONTROLPORT">RemoteControlPort</label>\n                <input type="number" name="phoneBarRemoteControlPort" ng-model="vm.agent.phoneBarRemoteControlPort" value="9888" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="remote_controlForm[\'phoneBarRemoteControlPort\'].$error" ng-show="remote_controlForm[\'phoneBarRemoteControlPort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.REMOTECONTROLPORT_REQUIRED">RemoteControlPort field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container sip md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SIP">SIP</div>\n            </div>\n            <form name="sipForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SIPEXPIRES">SipExpires</label>\n                <input type="number" name="phoneBarExpires" ng-model="vm.agent.phoneBarExpires" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SIPEXPIRES"></span></div>\n                <div ng-messages="sipForm[\'phoneBarExpires\'].$error" ng-show="sipForm[\'phoneBarExpires\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SIPEXPIRES_REQUIRED">SipExpires field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SIPPORT">SipPort</label>\n                <input type="number" name="phoneBarListenPort" ng-model="vm.agent.phoneBarListenPort" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SIPPORT"></span></div>\n                <div ng-messages="sipForm[\'phoneBarListenPort\'].$error" ng-show="sipForm[\'phoneBarListenPort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SIPPORT_REQUIRED">SipPort field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container callforwarding md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CALLFORWARDING">CALLFORWARDING</div>\n            </div>\n            <form name="callforwardingForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarUnconditional" aria-label="Unconditional" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.UNCONDITIONAL">Unconditional</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarUnconditional" class="md-block">\n                <label translate="STAFF.UNCONDITIONALNUMBER">UnconditionalNumber</label>\n                <input type="text" name="phoneBarUnconditionalNumber" ng-model="vm.agent.phoneBarUnconditionalNumber" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="callforwardingForm[\'phoneBarUnconditionalNumber\'].$error" ng-show="callforwardingForm[\'phoneBarUnconditionalNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.UNCONDITIONALNUMBER_REQUIRED">UnconditionalNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.agent.showWebBar == 2">\n        <md-tab-label>\n          <span translate="STAFF.WEBRTC">WEBRTC</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container settings_webrtc md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SETTINGS_WEBRTC">SETTINGS_WEBRTC</div>\n            </div>\n            <form name="settings_webrtcForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DTLSCERTFILE">dtlscertfile</label>\n                <input type="text" name="dtlscertfile" ng-model="vm.agent.dtlscertfile" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.DTLSCERTFILE"></span></div>\n                <div ng-messages="settings_webrtcForm[\'dtlscertfile\'].$error" ng-show="settings_webrtcForm[\'dtlscertfile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DTLSCERTFILE_REQUIRED">dtlscertfile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DTLSPRIVATEKEY">dtlsprivatekey</label>\n                <input type="text" name="dtlsprivatekey" ng-model="vm.agent.dtlsprivatekey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.DTLSPRIVATEKEY"></span></div>\n                <div ng-messages="settings_webrtcForm[\'dtlsprivatekey\'].$error" ng-show="settings_webrtcForm[\'dtlsprivatekey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DTLSPRIVATEKEY_REQUIRED">dtlsprivatekey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.WSS_PORT">WSS_Port</label>\n                <input type="number" name="wssPort" ng-model="vm.agent.wssPort" min="0" value="8089" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.WSS_PORT"></span></div>\n                <div ng-messages="settings_webrtcForm[\'wssPort\'].$error" ng-show="settings_webrtcForm[\'wssPort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.WSS_PORT_REQUIRED">WSS_Port field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.WSS_PORT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WSS_Port must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableSettings" aria-label="EnableSettings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLESETTINGS">EnableSettings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarAutoAnswer" aria-label="AutoAnswer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AUTOANSWER">AutoAnswer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarAutoAnswer" class="md-block">\n                <label translate="STAFF.AUTOANSWERDELAY">AutoAnswerDelay</label>\n                <input type="number" name="phoneBarAutoAnswerDelay" ng-model="vm.agent.phoneBarAutoAnswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="settings_webrtcForm[\'phoneBarAutoAnswerDelay\'].$error" ng-show="settings_webrtcForm[\'phoneBarAutoAnswerDelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_REQUIRED">AutoAnswerDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AutoAnswerDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableRecording" aria-label="EnableRecording" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLERECORDING">EnableRecording</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableDtmfTone" aria-label="EnableDtmfTone" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEDTMFTONE">EnableDtmfTone</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarDnd" aria-label="Dnd" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DND">Dnd</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.ignorePauseForPreviewCalls" aria-label="Ignore agent break status for preview calls" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.IGNORE_AGENT_BREAK_STATUS_FOR_PREVIEW_CALLS">Ignore agent break status for preview calls</span></md-switch>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container sip_webrtc md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SIP_WEBRTC">SIP_WEBRTC</div>\n            </div>\n            <form name="sip_webrtcForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SIPEXPIRES">SipExpires</label>\n                <input type="number" name="phoneBarExpires" ng-model="vm.agent.phoneBarExpires" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SIPEXPIRES"></span></div>\n                <div ng-messages="sip_webrtcForm[\'phoneBarExpires\'].$error" ng-show="sip_webrtcForm[\'phoneBarExpires\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SIPEXPIRES_REQUIRED">SipExpires field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.PERMISSIONS">PERMISSIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container general_permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL_PERMISSIONS">GENERAL_PERMISSIONS</div>\n            </div>\n            <form name="general_permissionsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.allowmessenger" aria-label="EnableMessenger" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEMESSENGER">EnableMessenger</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarPrefixRequired" aria-label="PrefixRequired" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.PREFIXREQUIRED">PrefixRequired</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.selectRecallMeCampaign" aria-label="Select_RecallMe_Campaign" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.SELECT_RECALLME_CAMPAIGN">Select_RecallMe_Campaign</span></md-switch>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container download_permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.DOWNLOAD_PERMISSIONS">DOWNLOAD_PERMISSIONS</div>\n            </div>\n            <form name="download_permissionsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.downloadAttachments" aria-label="Attachments" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ATTACHMENTS">Attachments</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.downloadOmnichannelInteractions" aria-label="Omnichannel_Interactions" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.OMNICHANNEL_INTERACTIONS">Omnichannel_Interactions</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.downloadVoiceRecordings" aria-label="Voice_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.VOICE_RECORDINGS">Voice_Recordings</span></md-switch>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.PERMISSIONS">PERMISSIONS</div>\n            </div>\n            <div ng-controller="AgentPermissionsController as vm_pc" ng-init="vm_pc.init(vm.agent, vm.crudPermissions)" class="agent-detail-form-container">\n              <md-list ng-repeat="father in vm_pc.navigation[0].children" ng-include="\'permission-nested.html\'" ng-if="vm_pc.agent.role !== \'admin\' && !father.hidden()"></md-list>\n              \x3c!-- Nested navigation template --\x3e\n              <script type="text/ng-template" id="permission-nested.html">\n                <md-list-item>\n        <md-icon md-font-icon="{{father.icon}}"></md-icon>\n        <p translate="{{father.translate}}">{{ father.title }}</p>\n        <md-switch class="md-secondary" ng-model="father.enabled" ng-change="vm_pc.onChange(father)" ng-init="father.enabled = vm_pc.agent.permissions.includes(father.id)" \n                  ng-disabled="!vm_pc.crudPermissions.canEdit"></md-switch>\n      </md-list-item>\n      <md-divider></md-divider>\n      <md-list>\n        <md-list-item ng-repeat="child in father.children" ng-if="child.id !== 201">\n          <md-icon ng-if="child.icon" md-font-icon="{{child.icon}}"></md-icon>\n          <p translate="{{child.translate}}">{{ child.title }}</p>\n          <md-switch ng-model="child.enabled" ng-change="vm_pc.onChange(father, child)" ng-init="child.enabled = vm_pc.agent.permissions.includes(child.id)"\n                    ng-disabled="!vm_pc.crudPermissions.canEdit"></md-switch>\n          </md-list-item>\n      </md-list>\n  <\/script>\n              \x3c!-- / Nested navigation template --\x3e\n              <span ng-if="vm_pc.agent.role === \'admin\'" class="md-headline" translate="STAFF.ALL_MODULES_AVAILABLE">All modules are already available.</span>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.CLIENT_LOGS">CLIENT-SIDE LOGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container client_logs md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CLIENT_LOGS">\n                CLIENT-SIDE LOGS\n              </div>\n            </div>\n            <ms-client-side-logging user="vm.agent" on-user-update="vm.refreshAgent()"></ms-client-side-logging>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/staff/views/teams/create/dialog.html",'<md-dialog class="team-dialog" aria-label="New Team">\n  <form name="teamForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.team.name" ng-required="true" autofocus>\n\n        <div ng-messages="teamForm[\'name\'].$error" ng-show="teamForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.team.description">\n\n        <div ng-messages="teamForm[\'description\'].$error" ng-show="teamForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTeam" ng-click="vm.saveTeam()" class="send-button md-accent md-raised" ng-disabled="teamForm.$invalid || teamForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTeam" ng-click="vm.addNewTeam()" class="send-button md-accent md-raised" ng-disabled="teamForm.$invalid" aria-label="ADD" translate="STAFF.ADD_TEAM" translate-attr-aria-label="STAFF.ADD_TEAM">\n          ADD TEAM\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTeam" ng-click="vm.deleteTeam($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/teams/edit/agentadd/agentadd.html",'<md-dialog class="team-dialog" aria-label="team" ng-init="vm.onInit()">\n  <form name="teamForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="STAFF.AGENTADD_TEAM">Add Agent to team</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/teams/teams.html",'<div id="teams" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.TEAMS">Teams</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTeams.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTeams =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-teams-count">\n          <span>{{vm.selectedTeams.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTeams()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTeams()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTeams" csv-label="true" filename="teams.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTeams($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TEAM TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTeams" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTeams">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'STAFF.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'STAFF.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.teams.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="team" md-select-id="id" ng-repeat="team in vm.teams.rows">\n                <td md-cell ng-if="team.userpic"><img class="avatar" alt="{{team.name}}" ng-src="api/users/{{team.id}}/avatar" /></td>\n                <td md-cell ng-if="!team.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{team.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditTeam($event, team)" md-cell class="id ">{{team.id}}</td>\n                <td ng-click="vm.createOrEditTeam($event, team)" md-cell class="name ">{{team.name}}</td>\n                <td ng-click="vm.createOrEditTeam($event, team)" md-cell class="description ">{{team.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(team, $event    )" translate="STAFF.EDIT_TEAM">\n                          Edit Team\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(team, $event    )" translate="STAFF.AGENTADD_TEAM">\n                          AgentAdd Team\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(team, $event    )" translate="STAFF.DELETE_TEAM">\n                          Delete Team\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.teams.count}}" md-on-paginate="vm.getTeams" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TEAM TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TEAM BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-team-button" ng-click="vm.createOrEditTeam($event)" aria-label="add team" translate translate-attr-aria-label="STAFF.ADD_TEAM">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TEAM BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/telephones/create/dialog.html",'<md-dialog class="telephone-dialog" aria-label="New Telephone">\n  <form name="telephoneForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.ACCOUNTNAME">Accountname</label>\n        <input type="text" name="fullname" ng-model="vm.telephone.fullname" ng-required="true" autofocus>\n\n        <div ng-messages="telephoneForm[\'fullname\'].$error" ng-show="telephoneForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.ACCOUNTNAME_REQUIRED">Accountname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.USERNAME">Username</label>\n        <input type="text" name="name" ng-model="vm.telephone.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" ng-disabled="!vm.newTelephone">\n\n        <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n        <div ng-messages="telephoneForm[\'name\'].$error" ng-show="telephoneForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.telephone.email" ng-required="true">\n\n        <div ng-messages="telephoneForm[\'email\'].$error" ng-show="telephoneForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newTelephone">\n        <label translate="STAFF.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.telephone.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="STAFF.PASSWORD" required>\n        <div ng-messages="telephoneForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.newTelephone  && (vm.newTelephone)">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="telephoneForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.telephone.description">\n\n        <div ng-messages="telephoneForm[\'description\'].$error" ng-show="telephoneForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newTelephone" class="md-block">\n        <md-switch ng-model="vm.telephone.autointernal" aria-label="AutoInternal"><span translate="STAFF.AUTOINTERNAL">AutoInternal</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.telephone.autointernal" class="md-block">\n        <label translate="STAFF.INTERNAL">Internal</label>\n        <input type="text" name="internal" ng-model="vm.telephone.internal" ng-required="true" ng-disabled="!vm.newTelephone">\n\n        <div ng-messages="telephoneForm[\'internal\'].$error" ng-show="telephoneForm[\'internal\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newTelephone" class="md-block">\n        <md-switch ng-model="vm.telephone.voicemail" aria-label="Voicemail"><span translate="STAFF.VOICEMAIL">Voicemail</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTelephone" ng-click="vm.saveTelephone()" class="send-button md-accent md-raised" ng-disabled="telephoneForm.$invalid || telephoneForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTelephone" ng-click="vm.addNewTelephone()" class="send-button md-accent md-raised" ng-disabled="telephoneForm.$invalid" aria-label="ADD" translate="STAFF.ADD_TELEPHONE" translate-attr-aria-label="STAFF.ADD_TELEPHONE">\n          ADD TELEPHONE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTelephone" ng-click="vm.deleteTelephone($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/telephones/edit/changepassword/changepassword.html",'<md-dialog class="telephone-dialog" aria-label="{{vm.name}}">\n  <form name="telephoneForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.CHANGE_PASSWORD\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.telephone.id">\n        <label translate="STAFF.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="STAFF.OLD_PASSWORD" required>\n        <div ng-messages="telephoneForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" translate ng-pattern="vm.passwordPattern" translate-attr-placeholder="STAFF.NEW_PASSWORD" required>\n        <div ng-messages="telephoneForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is\n              required</span>\n          </div>\n\n\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain\n              at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric\n              character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="STAFF.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n\n\n\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="telephoneForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is\n              required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did\n              not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="telephoneForm.$invalid || telephoneForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/telephones/edit/view.html",'<div id="staff-telephone" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-telephones-button md-icon-button" aria-label="Go to telephones" ng-click="vm.gotoTelephones()" translate translate-attr-aria-label="STAFF.GO_TO_TELEPHONES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="telephone-image" hide-xs>\n          <img ng-src="assets/images/business/telephones.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.telephone.id}}\n            <span ng-if="vm.telephone.name">{{vm.telephone.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.telephone.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.changepassworddialog(vm.telephone, $event)" class="md-fab md-warn md-icon-button" aria-label="changepassword">\n        <md-tooltip><span translate="STAFF.CHANGEPASSWORD_TELEPHONE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-key-variant"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveTelephone()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(accountForm.$invalid) || (generalForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="telephone-detail-form-container account md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.ACCOUNT">ACCOUNT</div>\n            </div>\n            <form name="accountForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ACCOUNTNAME">Accountname</label>\n                <input type="text" name="fullname" ng-model="vm.telephone.fullname" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'fullname\'].$error" ng-show="accountForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ACCOUNTNAME_REQUIRED">Accountname field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.USERNAME">Username</label>\n                <input type="text" name="name" ng-model="vm.telephone.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" disabled>\n\n                <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n                <div ng-messages="accountForm[\'name\'].$error" ng-show="accountForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.telephone.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'email\'].$error" ng-show="accountForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.telephone.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'description\'].$error" ng-show="accountForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.telephone.phone" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'phone\'].$error" ng-show="accountForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MOBILE">Mobile</label>\n                <input type="text" name="mobile" ng-model="vm.telephone.mobile" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'mobile\'].$error" ng-show="accountForm[\'mobile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MOBILE_REQUIRED">Mobile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.VOICE">VOICE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="telephone-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container ng-if="!vm.telephone.autointernal" class="md-block">\n                <label translate="STAFF.INTERNAL">Internal</label>\n                <input type="text" name="internal" ng-model="vm.telephone.internal" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'internal\'].$error" ng-show="generalForm[\'internal\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.telephone.transport" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'">ws</md-option>\n                  <md-option ng-value="\'wss\'">wss</md-option>\n                  <md-option ng-value="\'tls\'">tls</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.TRANSPORT"></span></div>\n                <div ng-messages="generalForm[\'transport\'].$error" ng-show="generalForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAT">NAT</label>\n                <md-select name="nat" ng-model="vm.telephone.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAT_REQUIRED">NAT field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.telephone.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLERID">CallerId</label>\n                <input type="text" name="callerid" ng-model="vm.telephone.callerid" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'callerid\'].$error" ng-show="generalForm[\'callerid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLERID_REQUIRED">CallerId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.telephone.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLGROUP">Callgroup</label>\n                <input type="text" name="callgroup" ng-model="vm.telephone.callgroup" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="STAFF.HELP.CALLGROUP"></span></div>\n                <div ng-messages="generalForm[\'callgroup\'].$error" ng-show="generalForm[\'callgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLGROUP_REQUIRED">Callgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PICKUPGROUP">Pickupgroup</label>\n                <input type="text" name="pickupgroup" ng-model="vm.telephone.pickupgroup" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="STAFF.HELP.PICKUPGROUP"></span></div>\n                <div ng-messages="generalForm[\'pickupgroup\'].$error" ng-show="generalForm[\'pickupgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PICKUPGROUP_REQUIRED">Pickupgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.telephone.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'videosupport\'].$error" ng-show="generalForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ENCRYPTION">Encryption</label>\n                <md-select name="encryption" ng-model="vm.telephone.encryption" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ENCRYPTION"></span></div>\n                <div ng-messages="generalForm[\'encryption\'].$error" ng-show="generalForm[\'encryption\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ENCRYPTION_REQUIRED">Encryption field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/staff/views/telephones/telephones.html",'<div id="telephones" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.TELEPHONES">Telephones</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTelephones.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTelephones =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-telephones-count">\n          <span>{{vm.selectedTelephones.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTelephones()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTelephones()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTelephones" csv-label="true" filename="telephones.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTelephones($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TELEPHONE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTelephones" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTelephones">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="fullname">{{ \'STAFF.ACCOUNTNAME\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'STAFF.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="internal">{{ \'STAFF.INTERNAL\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.telephones.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="telephone" md-select-id="id" ng-repeat="telephone in vm.telephones.rows">\n                <td md-cell ng-if="telephone.userpic"><img class="avatar" alt="{{telephone.name}}" ng-src="api/users/{{telephone.id}}/avatar" /></td>\n                <td md-cell ng-if="!telephone.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{telephone.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="fullname font-weight-600">{{telephone.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="name ">{{telephone.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="email ">{{telephone.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="internal ">{{telephone.internal}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(telephone, $event    )" translate="STAFF.EDIT_TELEPHONE">\n                          Edit Telephone\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(telephone, $event    )" translate="STAFF.DELETE_TELEPHONE">\n                          Delete Telephone\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.telephones.count}}" md-on-paginate="vm.getTelephones" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TELEPHONE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TELEPHONE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-telephone-button" ng-click="vm.createOrEditTelephone($event)" aria-label="add telephone" translate translate-attr-aria-label="STAFF.ADD_TELEPHONE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TELEPHONE BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/userProfiles/create/dialog.html",'<md-dialog class="userProfile-dialog" aria-label="New UserProfile">\n  <form name="userProfileForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.userProfile.name" ng-required="true" autofocus ng-disabled="!vm.newUserProfile">\n\n        <div ng-messages="userProfileForm[\'name\'].$error" ng-show="userProfileForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.userProfile.description">\n\n        <div ng-messages="userProfileForm[\'description\'].$error" ng-show="userProfileForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CRUDPERMISSIONS">CrudPermissions</label>\n        <md-select name="crudPermissions" ng-model="vm.userProfile.crudPermissions" multiple required>\n\n          <md-option ng-value="\'r\'" disabled> {{ \'STAFF.READ_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'e\'"> {{ \'STAFF.EDIT_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'d\'"> {{ \'STAFF.DELETE_PERMISSION\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="userProfileForm[\'crudPermissions\'].$error" ng-show="userProfileForm[\'crudPermissions\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CRUDPERMISSIONS_REQUIRED">CrudPermissions field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.userProfile.privacyEnabled" aria-label="Mask_Sensitive_Data"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n        <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newUserProfile" ng-click="vm.saveUserProfile()" class="send-button md-accent md-raised" ng-disabled="userProfileForm.$invalid || userProfileForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newUserProfile" ng-click="vm.addNewUserProfile()" class="send-button md-accent md-raised" ng-disabled="userProfileForm.$invalid" aria-label="ADD" translate="STAFF.ADD_USERPROFILE" translate-attr-aria-label="STAFF.ADD_USERPROFILE">\n          ADD USERPROFILE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newUserProfile" ng-click="vm.deleteUserProfile($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/userProfiles/edit/clone/clone.html",'<md-dialog class="userProfile-dialog" aria-label="Clone UserProfile">\n  <form name="userProfileForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.userProfile.name" ng-required="true" autofocus ng-disabled="!vm.newUserProfile">\n\n        <div ng-messages="userProfileForm[\'name\'].$error" ng-show="userProfileForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.userProfile.description">\n\n        <div ng-messages="userProfileForm[\'description\'].$error" ng-show="userProfileForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CRUDPERMISSIONS">CrudPermissions</label>\n        <md-select name="crudPermissions" ng-model="vm.userProfile.crudPermissions" multiple required>\n\n          <md-option ng-value="\'r\'" disabled> {{ \'STAFF.READ_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'e\'"> {{ \'STAFF.EDIT_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'d\'"> {{ \'STAFF.DELETE_PERMISSION\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="userProfileForm[\'crudPermissions\'].$error" ng-show="userProfileForm[\'crudPermissions\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CRUDPERMISSIONS_REQUIRED">CrudPermissions field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.userProfile.privacyEnabled" aria-label="Mask_Sensitive_Data"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n        <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneUserProfile()" class="send-button md-accent md-raised" ng-disabled="userProfileForm.$invalid" aria-label="CLONE" translate="STAFF.CLONE_USERPROFILE" translate-attr-aria-label="STAFF.CLONE_USERPROFILE">\n        CLONE USERPROFILE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",'<md-dialog class="userProfile-dialog" aria-label="userProfile">\n  <form name="userProfileForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2>{{vm.title}}</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog($event)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div layout="column" class="padding-bottom-10">\n        <div layout="row" class="padding-bottom-10">\n          <md-input-container flex class="no-margin">\n            <label translate="STAFF.SECTIONS">Sections</label>\n            <md-select name="sections" ng-model="vm.selectedSection" placeholder="{{\'STAFF.PERMISSIONS_SELECT_SECTION\' | translate}}" ng-change="vm.onChangeSection()" required>\n              <md-option ng-value="subsection" ng-repeat="subsection in vm.subsections" ng-selected="{{vm.subsections.length === 1 ? \'true\' : \'false\'}}">{{subsection.translate | translate}}</md-option>\n            </md-select>\n          </md-input-container>\n          <div layout="row" ng-show="vm.selectedSection" class="margin-left-10">\n            <md-button ng-switch="vm.selectedSection.enabled" class="md-icon-button md-fab md-mini size-8 padding-10" ng-class="vm.selectedSection.enabled ? \'blue-500-bg\' : \'grey-A400-bg\'" ng-click="vm.onChangeVisibility()" aria-label="Visibility">\n              <md-icon ng-switch-when="true" md-font-icon="icon-eye" aria-label="Visible section">\n                <md-tooltip>{{\'STAFF.PERMISSIONS_SECTION_HIDE\' | translate}}</md-tooltip>\n              </md-icon>\n              <md-icon ng-switch-when="false" md-font-icon="icon-eye-off" aria-label="Hidden section">\n                <md-tooltip>{{\'STAFF.PERMISSIONS_SECTION_SHOW\' | translate}}</md-tooltip>\n              </md-icon>\n            </md-button>\n            <div>\n              <md-button class="md-icon-button md-fab md-mini size-8 green-A700-bg no-margin" ng-disabled="true">\n                <md-icon md-font-icon="icon-monitor" class="md-background-fg" aria-label="Read permission">\n                  <md-tooltip>{{\'STAFF.READ_PERMISSION\' | translate}}</md-tooltip>\n                </md-icon>\n              </md-button>\n              <md-button class="md-icon-button md-fab md-mini size-8 no-margin" ng-class="vm.selectedSection.allowEdit ? \'green-A700-bg\' : \'grey-A400-bg\'" ng-click="vm.setPermission(\'edit\')">\n                <md-icon md-font-icon="icon-pencil" aria-label="Edit permission">\n                  <md-tooltip>{{\'STAFF.EDIT_PERMISSION\' | translate}}</md-tooltip>\n                </md-icon>\n              </md-button>\n              <md-button class="md-icon-button md-fab md-mini size-8 no-margin" ng-class="vm.selectedSection.allowDelete ? \'green-A700-bg\' : \'grey-A400-bg\'" ng-click="vm.setPermission(\'delete\')">\n                <md-icon md-font-icon="icon-delete" aria-label="Delete permission">\n                  <md-tooltip>{{\'STAFF.DELETE_PERMISSION\' | translate}}</md-tooltip>\n                </md-icon>\n              </md-button>\n            </div>\n          </div>\n        </div>\n        <div layout="row" ng-show="vm.selectedSection" class="margin-left-10" ng-if="!vm.selectedSection.permissions || vm.selectedSection.permissions.association">\n          <md-switch ng-model="vm.selectedSection.autoAssociation" class="no-margin padding-right-10" aria-label="Auto association" ng-change="vm.onChangeAutoAssociation()">\n          </md-switch>\n          <p class="no-margin font-size-12 line-height-30">{{\'STAFF.PERMISSIONS_AUTO_ASSOCIATION_INFO\' | translate}}</p>\n        </div>\n        <div layout="row" ng-show="vm.selectedSection && vm.selectedSection.title === \'Reports\' && !vm.selectedSection.autoAssociation" class="margin-bottom-10 margin-top-30" ng-if="!vm.selectedSection.permissions || vm.selectedSection.permissions.association">\n          <md-input-container flex class="no-margin">\n            <label translate="STAFF.REPORT_TYPE">Report Type</label>\n            <md-select name="type" ng-model="vm.selectedSection.reportType" placeholder="{{\'STAFF.PERMISSIONS_SELECT_REPORT_TYPE\' | translate}}" ng-change="vm.onChangeReportType()" required>\n              <md-option ng-value="\'default\'">Default</md-option>\n              <md-option ng-value="\'custom\'">Custom</md-option>\n            </md-select>\n          </md-input-container>\n        </div>\n        <div ng-show="vm.selectedSection && vm.selectedSection.title === \'Dashboards\'" class="user-profile-section-help margin-bottom-10 margin-top-20">\n          <md-icon md-font-icon="icon-help" aria-label="Dashboards help"></md-icon>\n          <span class="no-margin font-size-12 line-height-30" translate="STAFF.HELP.CUSTOM_DASHBOARDS_PERMISSIONS"></span>\n        </div>\n      </div>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" ng-if="!vm.selectedSection.permissions || vm.selectedSection.permissions.association" ng-hide="vm.selectedSection.autoAssociation"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center">\n      <div>\n        <md-icon md-font-icon="icon-information-outline" aria-label="Delete permission"></md-icon>\n        <span class="no-margin font-size-12 line-height-30" translate="STAFF.HELP.SAVE_PERMISSIONS"></span>\n      </div>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveSection()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/userProfiles/edit/view.html",'<div id="staff-userProfile" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-userProfiles-button md-icon-button" aria-label="Go to userProfiles" ng-click="vm.gotoUserProfiles()" translate translate-attr-aria-label="STAFF.GO_TO_USERPROFILES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="userProfile-image" hide-xs>\n          <img ng-src="assets/images/business/userProfiles.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.userProfile.id}}\n            <span ng-if="vm.userProfile.name">{{vm.userProfile.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.userProfile.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.userProfile, $event)" class="md-fab md-amber-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="STAFF.CLONE_USERPROFILE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveUserProfile()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (modulesForm.$invalid) || (download_permissionsForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="userProfile-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.userProfile.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.userProfile.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CRUDPERMISSIONS">CrudPermissions</label>\n                <md-select name="crudPermissions" ng-model="vm.userProfile.crudPermissions" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'r\'" disabled> {{ \'STAFF.READ_PERMISSION\' | translate }} </md-option>\n\n                  <md-option ng-value="\'e\'"> {{ \'STAFF.EDIT_PERMISSION\' | translate }} </md-option>\n\n                  <md-option ng-value="\'d\'"> {{ \'STAFF.DELETE_PERMISSION\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'crudPermissions\'].$error" ng-show="generalForm[\'crudPermissions\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CRUDPERMISSIONS_REQUIRED">CrudPermissions field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.privacyEnabled" aria-label="Mask_Sensitive_Data" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.PERMISSIONS">PERMISSIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="userProfile-detail-form-container modules md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.MODULES">MODULES</div>\n            </div>\n            <div ng-controller="UserProfilePermissionsController as vm_pc" ng-init="vm_pc.init(vm.userProfile, vm.license)" class="userProfile-detail-form-container">\n              <md-grid-list flex md-cols-gt-xs="2" md-cols-gt-sm="2" md-cols-gt-md="4" md-cols-gt-lg="6" md-row-height-gt-xs="2:1" md-row-height-gt-sm="3:1" md-row-height-gt-md="3:1" gt-xs-gutter="4px" gt-sm-gutter="4px" gt-md-gutter="16px" gt-lg-gutter="16px">\n                <md-grid-tile ng-repeat="father in vm_pc.modules" ng-if="vm_pc.userProfile.role !== \'admin\' && !father.permissions.hidden" md-colspan="2">\n                  <md-card flex-xs flex-gt-xs="90" layout="column" no-padding no-margin>\n                    <md-card-header>\n                      <md-card-avatar>\n                        <md-icon class="md-avatar-icon auto-size" md-font-icon="{{father.icon}}" ng-class="{ true: father.status.color }[true]">\n                          <md-tooltip>{{ father.status.info }}</md-tooltip>\n                        </md-icon>\n                      </md-card-avatar>\n                      <md-card-header-text layout-align="center start">\n                        <span class="md-title" translate="{{father.translate}}">{{ father.title }}</span>\n                      </md-card-header-text>\n                      <md-card-actions class="no-margin" layout="row" ng-init="vm_pc.checkSectionResources(father)" ng-if="father.status.tag != \'unlicensed\'">\n                        <md-switch class="auto-height no-margin" ng-model="father.allResourcesEnabled" ng-change="vm_pc.onChangeEnableAllResources(father)" aria-label="Enable all"></md-switch>\n                        <md-button class="md-mini auto-width" aria-label="Manage" ng-click="vm_pc.manageResources(father)" ng-hide="father.permissions && !father.permissions.association">\n                          <md-tooltip>{{\'STAFF.PERMISSIONS_MANAGE\' | translate}}\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-cog"></md-icon>\n                        </md-button>\n                      </md-card-actions>\n                      <md-card-header-text ng-if="father.status.tag === \'unlicensed\'" layout-align="center end">\n                        <span class="md-subhead red-A700-fg">{{ father.status.name }}</span>\n                      </md-card-header-text>\n                    </md-card-header>\n                  </md-card>\n                </md-grid-tile>\n              </md-grid-list>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.DOWNLOADS">DOWNLOADS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="userProfile-detail-form-container download_permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.DOWNLOAD_PERMISSIONS">DOWNLOAD_PERMISSIONS</div>\n            </div>\n            <form name="download_permissionsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadAttachments" aria-label="Attachments" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ATTACHMENTS">Attachments</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadCallySquareRecordings" aria-label="CallySquare_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.CALLYSQUARE_RECORDINGS">CallySquare_Recordings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadContactManagerLists" aria-label="Contact_Manager_Lists" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.CONTACT_MANAGER_LISTS">Contact_Manager_Lists</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadJscriptySessions" aria-label="Jscripty_Sessions" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.JSCRIPTY_SESSIONS">Jscripty_Sessions</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadOmnichannelInteractions" aria-label="Omnichannel_Interactions" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.OMNICHANNEL_INTERACTIONS">Omnichannel_Interactions</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadScreenRecordings" aria-label="Screen_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.SCREEN_RECORDINGS">Screen_Recordings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadVoiceRecordings" aria-label="Voice_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.VOICE_RECORDINGS">Voice_Recordings</span></md-switch>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/staff/views/userProfiles/userProfiles.html",'<div id="userProfiles" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.USERPROFILES">UserProfiles</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedUserProfiles.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedUserProfiles =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-userProfiles-count">\n          <span>{{vm.selectedUserProfiles.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllUserProfiles()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectUserProfiles()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedUserProfiles" csv-label="true" filename="userProfiles.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedUserProfiles($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- USERPROFILE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedUserProfiles" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getUserProfiles">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'STAFF.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'STAFF.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="crudPermissions">{{ \'STAFF.CRUDPERMISSIONS\' | translate }}</th>\n                <th md-column md-order-by="privacyEnabled">{{ \'STAFF.MASK_SENSITIVE_DATA\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.userProfiles.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="userProfile" md-select-id="id" ng-repeat="userProfile in vm.userProfiles.rows">\n                <td md-cell ng-if="userProfile.userpic"><img class="avatar" alt="{{userProfile.name}}" ng-src="api/users/{{userProfile.id}}/avatar" /></td>\n                <td md-cell ng-if="!userProfile.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{userProfile.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="id ">{{userProfile.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="name ">{{userProfile.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="description ">{{userProfile.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="crudPermissions ">{{userProfile.selectedcrudPermissions}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="privacyEnabled ">\n                  <md-icon md-colors="{color: {{userProfile.privacyEnabled ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{userProfile.privacyEnabled ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(userProfile, $event    )" translate="STAFF.EDIT_USERPROFILE">\n                          Edit UserProfile\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(userProfile, $event    )" translate="STAFF.CLONE_USERPROFILE">\n                          clone UserProfile\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' && user.id !== vm.currentUser.id">\n\n                        <md-button ng-click="vm.deleteconfirm(userProfile, $event    )" translate="STAFF.DELETE_USERPROFILE">\n                          Delete UserProfile\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.userProfiles.count}}" md-on-paginate="vm.getUserProfiles" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / USERPROFILE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD USERPROFILE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-userProfile-button" ng-click="vm.createOrEditUserProfile($event)" aria-label="add userProfile" translate translate-attr-aria-label="STAFF.ADD_USERPROFILE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD USERPROFILE BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/users/create/dialog.html",'<md-dialog class="user-dialog" aria-label="New User">\n  <form name="userForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.ROLE">Role</label>\n        <md-select name="role" ng-model="vm.user.role" autofocus required ng-disabled="!vm.newUser">\n          <md-option ng-value="\'admin\'">Admin</md-option>\n          <md-option ng-value="\'user\'">User</md-option>\n        </md-select>\n        <div ng-messages="userForm[\'role\'].$error" ng-show="userForm[\'role\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.ROLE_REQUIRED">Role field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.user.role === \'user\'" class="md-block">\n        <label translate="STAFF.USERPROFILE">UserProfile</label>\n        <md-select name="userProfileId" ng-model="vm.user.userProfileId" required>\n          <md-option ng-value="userProfileId.id" ng-repeat="userProfileId in vm.userProfiles" ng-disabled="userProfileId.canSelect === false">{{ userProfileId.name }}</md-option>\n        </md-select>\n        <div ng-messages="userForm[\'userProfileId\'].$error" ng-show="userForm[\'userProfileId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERPROFILE_REQUIRED">UserProfile field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.FULLNAME">Fullname</label>\n        <input type="text" name="fullname" ng-model="vm.user.fullname" ng-required="true">\n\n        <div ng-messages="userForm[\'fullname\'].$error" ng-show="userForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.USERNAME">Username</label>\n        <input type="text" name="name" ng-model="vm.user.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" ng-disabled="!vm.newUser">\n\n        <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n        <div ng-messages="userForm[\'name\'].$error" ng-show="userForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.user.email" ng-required="true">\n\n        <div ng-messages="userForm[\'email\'].$error" ng-show="userForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newUser">\n        <label translate="STAFF.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.user.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="STAFF.PASSWORD" required>\n        <div ng-messages="userForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newUser  && (vm.newUser)">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="userForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.user.description">\n\n        <div ng-messages="userForm[\'description\'].$error" ng-show="userForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newUser" class="md-block">\n        <md-switch ng-model="vm.user.autointernal" aria-label="AutoInternal"><span translate="STAFF.AUTOINTERNAL">AutoInternal</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.user.autointernal" class="md-block">\n        <label translate="STAFF.INTERNAL">Internal</label>\n        <input type="text" name="internal" ng-model="vm.user.internal" ng-required="true" ng-disabled="!vm.newUser">\n\n        <div ng-messages="userForm[\'internal\'].$error" ng-show="userForm[\'internal\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.user.userSetting">\n        <ms-client-side-logging user="vm.user"></ms-client-side-logging>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newUser" ng-click="vm.saveUser()" class="send-button md-accent md-raised" ng-disabled="userForm.$invalid || userForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newUser" ng-click="vm.addNewUser()" class="send-button md-accent md-raised" ng-disabled="userForm.$invalid" aria-label="ADD" translate="STAFF.ADD_USER" translate-attr-aria-label="STAFF.ADD_USER">\n          ADD USER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newUser" ng-click="vm.deleteUser($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/users/edit/apikeymanager/apikeymanager.html",'<md-dialog class="user-dialog" aria-label="{{vm.name}}">\n  <form name="userForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.MANAGE_API_KEY\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-card layout-fill layout-padding>\n      <textarea class="api-key-area" ng-model="vm.user.apiKey" rows="6" disabled></textarea>\n    </md-card>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.generateApiKey()" class="send-button md-accent md-raised" aria-label="Generate" translate="{{ vm.user.apiKey === \'N/A\' ? \'STAFF.GENERATE\' : \'STAFF.REGENERATE\' }}" translate-attr-aria-label="STAFF.GENERATE">\n          Generate\n        </md-button>\n        <md-button type="submit" ng-click="vm.removeApiKey()" class="send-button md-accent md-raised" aria-label="Remove" translate="STAFF.REMOVE" translate-attr-aria-label="STAFF.DELETE">\n          Delete\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/users/edit/changepassword/changepassword.html",'<md-dialog class="user-dialog" aria-label="{{vm.name}}">\n  <form name="userForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.CHANGE_PASSWORD\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.user.id">\n        <label translate="STAFF.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="STAFF.OLD_PASSWORD" required>\n        <div ng-messages="userForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" translate ng-pattern="vm.passwordPattern" translate-attr-placeholder="STAFF.NEW_PASSWORD" required>\n        <div ng-messages="userForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is\n              required</span>\n          </div>\n\n\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain\n              at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric\n              character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="STAFF.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n\n\n\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="userForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is\n              required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did\n              not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="userForm.$invalid || userForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/users/edit/view.html",'<div id="staff-user" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-users-button md-icon-button" aria-label="Go to users" ng-click="vm.gotoUsers()" translate translate-attr-aria-label="STAFF.GO_TO_USERS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="user-image" hide-xs>\n          <img ng-src="assets/images/business/users.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.user.id}}\n            <span ng-if="vm.user.name">{{vm.user.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.user.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.apikeymanagerdialog(vm.user, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="apikeymanager">\n        <md-tooltip><span translate="STAFF.APIKEYMANAGER_USER"></span></md-tooltip>\n        <md-icon md-font-icon="fab fa-hubspot"></md-icon>\n      </md-button>\n    </div>\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.changepassworddialog(vm.user, $event)" class="md-fab md-warn md-icon-button" aria-label="changepassword">\n        <md-tooltip><span translate="STAFF.CHANGEPASSWORD_USER"></span></md-tooltip>\n        <md-icon md-font-icon="icon-key-variant"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveUser()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(personal_infoForm.$invalid) || (security_suiteForm.$invalid) || (change_avatarForm.$invalid) || (generalForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="user-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.PERSONAL_INFO">PERSONAL_INFO</div>\n            </div>\n            <form name="personal_infoForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ROLE">Role</label>\n                <md-select name="role" ng-model="vm.user.role" autofocus required disabled>\n                  <md-option ng-value="\'admin\'">Admin</md-option>\n                  <md-option ng-value="\'user\'">User</md-option>\n                </md-select>\n                <div ng-messages="personal_infoForm[\'role\'].$error" ng-show="personal_infoForm[\'role\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ROLE_REQUIRED">Role field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.role === \'user\'" class="md-block">\n                <label translate="STAFF.USERPROFILE">UserProfile</label>\n                <md-select name="userProfileId" ng-model="vm.user.userProfileId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="userProfileId.id" ng-repeat="userProfileId in vm.userProfiles" ng-disabled="userProfileId.canSelect === false">{{ userProfileId.name }}</md-option>\n                </md-select>\n                <div ng-messages="personal_infoForm[\'userProfileId\'].$error" ng-show="personal_infoForm[\'userProfileId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERPROFILE_REQUIRED">UserProfile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.FULLNAME">Fullname</label>\n                <input type="text" name="fullname" ng-model="vm.user.fullname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'fullname\'].$error" ng-show="personal_infoForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.USERNAME">Username</label>\n                <input type="text" name="name" ng-model="vm.user.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" disabled>\n                <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n                <div ng-messages="personal_infoForm[\'name\'].$error" ng-show="personal_infoForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.user.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'email\'].$error" ng-show="personal_infoForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.user.phone" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'phone\'].$error" ng-show="personal_infoForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MOBILE">Mobile</label>\n                <input type="text" name="mobile" ng-model="vm.user.mobile" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'mobile\'].$error" ng-show="personal_infoForm[\'mobile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MOBILE_REQUIRED">Mobile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.user.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'description\'].$error" ng-show="personal_infoForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="user-detail-form-container security_suite md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SECURITY_SUITE">SECURITY_SUITE</div>\n            </div>\n            <form name="security_suiteForm" novalidate>\n              <md-input-container ng-if="vm.user.passwordResetAt != null" class="md-block">\n                <label translate="STAFF.LAST_PASSWORD_RESET_AT">Last_Password_Reset_At</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.user.passwordResetAt" autofocus disabled>\n                <div class="hint"><span translate="STAFF.HELP.LAST_PASSWORD_RESET_AT"></span></div>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.LAST_PASSWORD_RESET_AT_REQUIRED">Last_Password_Reset_At field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.passwordResetAt == null" class="md-block">\n                <label translate="STAFF.NO_PASSWORD_CHANGE">No_Password_Change</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.user.passwordResetAt" disabled>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NO_PASSWORD_CHANGE_REQUIRED">No_Password_Change field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.APIKEY">ApiKey</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-apiKey" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: \'API Key copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-apiKey" name="apiKey" ng-model="vm.user.apiKey" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="STAFF.HELP.APIKEY"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.id != vm.currentUser.id && vm.currentUser.role == \'admin\'" class="md-block">\n                <md-switch ng-model="vm.user.disabled" aria-label="Disabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DISABLED">Disabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.DISABLED"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.id != vm.currentUser.id && vm.currentUser.role == \'admin\' && vm.user.disabled == 0" class="md-block">\n                <md-switch ng-model="vm.user.blocked" aria-label="Blocked" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.BLOCKED">Blocked</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.BLOCKED"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="user-detail-form-container authentication md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.AUTHENTICATION">AUTHENTICATION</div>\n            </div>\n            <form name="authenticationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.user.adSsoEnabled" aria-label="AD_SSO_Enabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AD_SSO_ENABLED">AD_SSO_Enabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.AD_SSO_ENABLED"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="user-detail-form-container change_avatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CHANGE_AVATAR">CHANGE_AVATAR</div>\n            </div>\n            <div ng-controller="Userchange_avatarController as vm_ca" ng-init="vm_ca.init(vm.user, vm.crudPermissions)" class="user-detail-form-container md-background-bg md-whiteframe-1dp">\n              <div id="user-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="change_avatarimage in vm_ca.user.images" ng-switch="change_avatarimage.type">\n                    <div class="user-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{change_avatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="change_avatarimage.file">\n                    </div>\n                    <div class="user-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{change_avatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.VOICE">VOICE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="user-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container ng-if="!vm.user.autointernal" class="md-block">\n                <label translate="STAFF.INTERNAL">Internal</label>\n                <input type="text" name="internal" ng-model="vm.user.internal" ng-required="true" autofocus disabled>\n                <div ng-messages="generalForm[\'internal\'].$error" ng-show="generalForm[\'internal\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.user.transport" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'">ws</md-option>\n                  <md-option ng-value="\'wss\'">wss</md-option>\n                  <md-option ng-value="\'tls\'">tls</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'transport\'].$error" ng-show="generalForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAT">NAT</label>\n                <md-select name="nat" ng-model="vm.user.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAT_REQUIRED">NAT field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.user.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.user.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLGROUP">Callgroup</label>\n                <input type="text" name="callgroup" ng-model="vm.user.callgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.CALLGROUP"></span></div>\n                <div ng-messages="generalForm[\'callgroup\'].$error" ng-show="generalForm[\'callgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLGROUP_REQUIRED">Callgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PICKUPGROUP">Pickupgroup</label>\n                <input type="text" name="pickupgroup" ng-model="vm.user.pickupgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.PICKUPGROUP"></span></div>\n                <div ng-messages="generalForm[\'pickupgroup\'].$error" ng-show="generalForm[\'pickupgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PICKUPGROUP_REQUIRED">Pickupgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.user.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'videosupport\'].$error" ng-show="generalForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.CLIENT_LOGS">CLIENT-SIDE LOGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="user-detail-form-container client_logs md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CLIENT_LOGS">\n                CLIENT-SIDE LOGS\n              </div>\n            </div>\n            <ms-client-side-logging user="vm.user" on-user-update="vm.refreshUser()"></ms-client-side-logging>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/staff/views/users/users.html",'<div id="users" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.USERS">Users</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedUsers.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedUsers =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-users-count">\n          <span>{{vm.selectedUsers.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllUsers()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectUsers()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedUsers" csv-label="true" filename="users.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- USER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedUsers" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getUsers">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="role">{{ \'STAFF.ROLE\' | translate }}</th>\n                <th md-column md-order-by="userProfileId">{{ \'STAFF.USERPROFILE\' | translate }}</th>\n                <th md-column md-order-by="fullname">{{ \'STAFF.FULLNAME\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'STAFF.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'STAFF.PHONE\' | translate }}</th>\n                <th md-column md-order-by="mobile">{{ \'STAFF.MOBILE\' | translate }}</th>\n                <th md-column md-order-by="internal">{{ \'STAFF.INTERNAL\' | translate }}</th>\n                <th md-column md-order-by="disabled">{{ \'STAFF.DISABLED\' | translate }}</th>\n                <th md-column md-order-by="blocked">{{ \'STAFF.BLOCKED\' | translate }}</th>\n                <th md-column>{{ \'STAFF.CLIENT_LOGS\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.users.rows.length">\n                <td md-cell colspan="11">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="user" md-select-id="id" ng-repeat="user in vm.users.rows">\n                <td md-cell ng-if="user.userpic"><img class="avatar" alt="{{user.name}}" ng-src="api/users/{{user.id}}/avatar" /></td>\n                <td md-cell ng-if="!user.userpic"><img class="avatar" alt="{{user.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="role ">{{ vm.arrayrole[user.role].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="userProfileId font-weight-600">{{ (vm.userProfiles | filter : {\'id\':user.userProfileId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="fullname font-weight-600">{{user.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="name ">{{user.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="email ">{{user.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="phone ">{{user.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="mobile ">{{user.mobile}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="internal ">{{user.internal}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="disabled ">\n                  <md-icon md-colors="{color: {{user.disabled ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{user.disabled ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="blocked ">\n                  <md-icon md-colors="{color: {{user.blocked ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{user.blocked ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditAgent($event, user)" md-cell class="client-side-logging">\n                  <ms-client-side-logging-icon user="user"></ms-client-side-logging-icon>\n                </td>\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(user, $event    )" translate="STAFF.EDIT_USER">\n                          Edit User\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' && user.id !== vm.currentUser.id">\n                        <md-button ng-click="vm.deleteconfirm(user, $event    )" translate="STAFF.DELETE_USER">\n                          Delete User\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.users.count}}" md-on-paginate="vm.getUsers" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / USER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD USER BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-user-button" ng-click="vm.createOrEditUser($event)" aria-label="add user" translate translate-attr-aria-label="STAFF.ADD_USER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD USER BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/cannedAnswers/cannedAnswers.html",'<div id="cannedAnswers" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.CANNEDANSWERS">CannedAnswers</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedCannedAnswers.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedCannedAnswers =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-cannedAnswers-count">\n          <span>{{vm.selectedCannedAnswers.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllCannedAnswers()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectCannedAnswers()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedCannedAnswers" csv-label="true" filename="cannedAnswers.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CANNEDANSWER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedCannedAnswers" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCannedAnswers">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'TOOLS.KEY\' | translate }}</th>\n                <th md-column md-order-by="value">{{ \'TOOLS.VALUE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.cannedAnswers.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="cannedAnswer" md-select-id="id" ng-repeat="cannedAnswer in vm.cannedAnswers.rows">\n                <td md-cell ng-if="cannedAnswer.userpic"><img class="avatar" alt="{{cannedAnswer.name}}" ng-src="api/users/{{cannedAnswer.id}}/avatar" /></td>\n                <td md-cell ng-if="!cannedAnswer.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{cannedAnswer.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="id ">{{cannedAnswer.id}}</td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="key ">{{cannedAnswer.key}}</td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="value ">{{cannedAnswer.value}}</td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="description ">{{cannedAnswer.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(cannedAnswer, $event    )" translate="TOOLS.EDIT_CANNEDANSWER">\n                          Edit CannedAnswer\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(cannedAnswer, $event    )" translate="TOOLS.DELETE_CANNEDANSWER">\n                          Delete CannedAnswer\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.cannedAnswers.count}}" md-on-paginate="vm.getCannedAnswers" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CANNEDANSWER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CANNEDANSWER BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-cannedAnswer-button" ng-click="vm.createOrEditCannedAnswer($event)" aria-label="add cannedAnswer" translate translate-attr-aria-label="TOOLS.ADD_CANNEDANSWER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CANNEDANSWER BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/cannedAnswers/create/dialog.html",'<md-dialog class="cannedAnswer-dialog" aria-label="New CannedAnswer">\n  <form name="cannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.cannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="cannedAnswerForm[\'key\'].$error" ng-show="cannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 255}\'>Key must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.cannedAnswer.value" required></textarea>\n\n        <div ng-messages="cannedAnswerForm[\'value\'].$error" ng-show="cannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.cannedAnswer.description">\n\n        <div ng-messages="cannedAnswerForm[\'description\'].$error" ng-show="cannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCannedAnswer" ng-click="vm.saveCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="cannedAnswerForm.$invalid || cannedAnswerForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCannedAnswer" ng-click="vm.addNewCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="cannedAnswerForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_CANNEDANSWER" translate-attr-aria-label="TOOLS.ADD_CANNEDANSWER">\n          ADD CANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCannedAnswer" ng-click="vm.deleteCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/contact_item_types/contact_item_types.html",'<div id="contact_item_types" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.CONTACTITEMTYPE">ContactItemType</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedContactItemType.length > 0" class="selected-bar header animate-slide-down md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedContactItemType =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-contact_item_types-count">\n          <span>{{vm.selectedContactItemType.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllContactItemType()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectContactItemType()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedContactItemType" csv-label="true" filename="contact_item_types.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedContactItemType($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable" ms-scroll>\n\n\n      \x3c!-- CONTACTITEMTYPE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedContactItemType" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContactItemType">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="OrderBy">{{ \'TOOLS.ORDER_BY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.contact_item_types.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="contactItemType" md-select-id="id" ng-repeat="contactItemType in vm.contact_item_types.rows">\n                <td md-cell ng-if="contactItemType.userpic"><img class="avatar" alt="{{contactItemType.name}}" ng-src="api/users/{{contactItemType.id}}/avatar" /></td>\n                <td md-cell ng-if="!contactItemType.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{contactItemType.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditContactItemType($event, contactItemType)" md-cell class="id ">{{contactItemType.id}}</td>\n                <td ng-click="vm.createOrEditContactItemType($event, contactItemType)" md-cell class="name ">{{contactItemType.name}}</td>\n                <td ng-click="vm.createOrEditContactItemType($event, contactItemType)" md-cell class="OrderBy ">{{contactItemType.OrderBy}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(contactItemType, $event    )" translate="TOOLS.EDIT_CONTACTITEMTYPE">\n                          Edit ContactItemType\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(contactItemType, $event    )" translate="TOOLS.DELETE_CONTACTITEMTYPE">\n                          Delete ContactItemType\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contact_item_types.count}}" md-on-paginate="vm.getContactItemType" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CONTACTITEMTYPE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CONTACTITEMTYPE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-contactItemType-button" ng-click="vm.createOrEditContactItemType($event)" aria-label="add contactItemType" translate translate-attr-aria-label="TOOLS.ADD_CONTACTITEMTYPE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CONTACTITEMTYPE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/contact_item_types/create/dialog.html",'<md-dialog class="contactItemType-dialog" aria-label="New ContactItemType">\n  <form name="contactItemTypeForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content ms-scroll>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.contactItemType.name" ng-required="true" autofocus>\n\n        <div ng-messages="contactItemTypeForm[\'name\'].$error" ng-show="contactItemTypeForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.ORDER_BY">Order_by</label>\n        <input type="integer" name="OrderBy" ng-model="vm.contactItemType.OrderBy" ng-required="true">\n\n        <div ng-messages="contactItemTypeForm[\'OrderBy\'].$error" ng-show="contactItemTypeForm[\'OrderBy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ORDER_BY_REQUIRED">Order_by field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div flex md-color-picker ng-model="vm.contactItemType.rgbBackgroundColor" label="{{\'TOOLS.RGBBACKGROUNDCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newContactItemType" ng-click="vm.saveContactItemType()" class="send-button md-accent md-raised" ng-disabled="contactItemTypeForm.$invalid || contactItemTypeForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newContactItemType" ng-click="vm.addNewContactItemType()" class="send-button md-accent md-raised" ng-disabled="contactItemTypeForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_CONTACTITEMTYPE" translate-attr-aria-label="TOOLS.ADD_CONTACTITEMTYPE">\n          ADD CONTACTITEMTYPE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newContactItemType" ng-click="vm.deleteContactItemType($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/create/dialog.html",'<md-dialog class="customDashboard-dialog" aria-label="New CustomDashboard">\n  <form name="customDashboardForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.customDashboard.name" ng-required="true" autofocus>\n\n        <div ng-messages="customDashboardForm[\'name\'].$error" ng-show="customDashboardForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.customDashboard.description">\n\n        <div ng-messages="customDashboardForm[\'description\'].$error" ng-show="customDashboardForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCustomDashboard" ng-click="vm.saveCustomDashboard()" class="send-button md-accent md-raised" ng-disabled="customDashboardForm.$invalid || customDashboardForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCustomDashboard" ng-click="vm.addNewCustomDashboard()" class="send-button md-accent md-raised" ng-disabled="customDashboardForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_CUSTOMDASHBOARD" translate-attr-aria-label="TOOLS.ADD_CUSTOMDASHBOARD">\n          ADD CUSTOMDASHBOARD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCustomDashboard" ng-click="vm.deleteCustomDashboard($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/customDashboards.html",'<div id="customDashboards" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.CUSTOMDASHBOARDS">CustomDashboards</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedCustomDashboards.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedCustomDashboards =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-customDashboards-count">\n          <span>{{vm.selectedCustomDashboards.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllCustomDashboards()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectCustomDashboards()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedCustomDashboards" csv-label="true" filename="customDashboards.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedCustomDashboards($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CUSTOMDASHBOARD TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedCustomDashboards" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCustomDashboards">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.customDashboards.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="customDashboard" md-select-id="id" ng-repeat="customDashboard in vm.customDashboards.rows">\n                <td md-cell ng-if="customDashboard.userpic"><img class="avatar" alt="{{customDashboard.name}}" ng-src="api/users/{{customDashboard.id}}/avatar" /></td>\n                <td md-cell ng-if="!customDashboard.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{customDashboard.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(customDashboard, ev) : vm.createOrEditCustomDashboard($event, customDashboard)" md-cell class="id ">{{customDashboard.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(customDashboard, ev) : vm.createOrEditCustomDashboard($event, customDashboard)" md-cell class="name ">{{customDashboard.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(customDashboard, ev) : vm.createOrEditCustomDashboard($event, customDashboard)" md-cell class="description ">{{customDashboard.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(customDashboard, $event    )" translate="TOOLS.EDIT_CUSTOMDASHBOARD">\n                          Edit CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(customDashboard, $event    )" translate="TOOLS.CLONE_CUSTOMDASHBOARD">\n                          clone CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotodashboardgoto(customDashboard, $event    )" translate="TOOLS.GOTODASHBOARD_CUSTOMDASHBOARD">\n                          goToDashboard CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(customDashboard, $event    )" translate="TOOLS.DELETE_CUSTOMDASHBOARD">\n                          Delete CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.customDashboards.count}}" md-on-paginate="vm.getCustomDashboards" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CUSTOMDASHBOARD TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CUSTOMDASHBOARD BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-customDashboard-button" ng-click="vm.createOrEditCustomDashboard($event)" aria-label="add customDashboard" translate translate-attr-aria-label="TOOLS.ADD_CUSTOMDASHBOARD">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CUSTOMDASHBOARD BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/customDashboards/edit/clone/clone.html",'<md-dialog class="customDashboard-dialog" aria-label="Clone CustomDashboard">\n  <form name="customDashboardForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.customDashboard.name" ng-required="true" autofocus>\n\n        <div ng-messages="customDashboardForm[\'name\'].$error" ng-show="customDashboardForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneCustomDashboard()" class="send-button md-accent md-raised" ng-disabled="customDashboardForm.$invalid" aria-label="CLONE" translate="TOOLS.CLONE_CUSTOMDASHBOARD" translate-attr-aria-label="TOOLS.CLONE_CUSTOMDASHBOARD">\n        CLONE CUSTOMDASHBOARD\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/edit/dashboard/dialog.html",'<md-dialog class="dashboarditem-dialog" aria-label="New DashboardItem">\n  <form name="dashboarditemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.dashboarditem.type" ng-change="vm.onTypeChange()" autofocus ng-disabled="!vm.newDashboardItem">\n\n          <md-option ng-value="\'counter\'"> {{ \'TOOLS.COUNTER\' | translate }} </md-option>\n\n          <md-option ng-value="\'multibar-chart\'"> {{ \'TOOLS.MULTIBARCHART\' | translate }} </md-option>\n\n          <md-option ng-value="\'pie-chart\'"> {{ \'TOOLS.PIECHART\' | translate }} </md-option>\n\n          <md-option ng-value="\'web-report\'"> {{ \'TOOLS.WEBREPORT\' | translate }} </md-option>\n\n          <md-option ng-value="\'iframe\'"> {{ \'TOOLS.IFRAME\' | translate }} </md-option>\n\n          <md-option ng-value="\'clock\'"> {{ \'TOOLS.CLOCK\' | translate }} </md-option>\n\n          <md-option ng-value="\'custom\'"> {{ \'TOOLS.CUSTOMTYPE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'type\'].$error" ng-show="dashboarditemForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\',\'counter\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.CHANNEL">Channel</label>\n        <md-select name="attrChannel" ng-model="vm.dashboarditem.attrChannel" required>\n\n          <md-option ng-value="\'chat\'"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n\n          <md-option ng-value="\'mail\'"> {{ \'TOOLS.EMAIL\' | translate }} </md-option>\n\n          <md-option ng-value="\'sms\'"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n\n          <md-option ng-value="\'openchannel\'"> {{ \'TOOLS.OPENCHANNEL\' | translate }} </md-option>\n\n          <md-option ng-value="\'fax\'"> {{ \'TOOLS.FAX\' | translate }} </md-option>\n\n          <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n\n          <md-option ng-value="\'whatsapp\'"> {{ \'TOOLS.WHATSAPP\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrChannel\'].$error" ng-show="dashboarditemForm[\'attrChannel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="![\'web-report\', \'iframe\',\'clock\', \'custom\'].includes(vm.dashboarditem.type)">\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'mail\'" class="md-block">\n          <label translate="TOOLS.FILTEREMAILACCOUNTS">FilterEmailAccounts</label>\n          <md-select name="attrEmailAccounts" ng-model="vm.dashboarditem.attrEmailAccounts" multiple>\n            <md-option ng-value="attrEmailAccounts.id" ng-repeat="attrEmailAccounts in vm.mailAccount" ng-disabled="attrEmailAccounts.canSelect === false">{{ attrEmailAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrEmailAccounts\'].$error" ng-show="dashboarditemForm[\'attrEmailAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTEREMAILACCOUNTS_REQUIRED">FilterEmailAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'fax\'" class="md-block">\n          <label translate="TOOLS.FILTERFAXACCOUNTS">FilterFaxAccounts</label>\n          <md-select name="attrFaxAccounts" ng-model="vm.dashboarditem.attrFaxAccounts" multiple>\n            <md-option ng-value="attrFaxAccounts.id" ng-repeat="attrFaxAccounts in vm.faxAccount" ng-disabled="attrFaxAccounts.canSelect === false">{{ attrFaxAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrFaxAccounts\'].$error" ng-show="dashboarditemForm[\'attrFaxAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERFAXACCOUNTS_REQUIRED">FilterFaxAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'sms\'" class="md-block">\n          <label translate="TOOLS.FILTERSMSACCOUNTS">FilterSmsAccounts</label>\n          <md-select name="attrSmsAccounts" ng-model="vm.dashboarditem.attrSmsAccounts" multiple>\n            <md-option ng-value="attrSmsAccounts.id" ng-repeat="attrSmsAccounts in vm.smsAccount" ng-disabled="attrSmsAccounts.canSelect === false">{{ attrSmsAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrSmsAccounts\'].$error" ng-show="dashboarditemForm[\'attrSmsAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERSMSACCOUNTS_REQUIRED">FilterSmsAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'openchannel\'" class="md-block">\n          <label translate="TOOLS.FILTEROPENCHANNELACCOUNTS">FilterOpenchannelAccounts</label>\n          <md-select name="attrOpenchannelAccounts" ng-model="vm.dashboarditem.attrOpenchannelAccounts" multiple>\n            <md-option ng-value="attrOpenchannelAccounts.id" ng-repeat="attrOpenchannelAccounts in vm.openchannelAccount" ng-disabled="attrOpenchannelAccounts.canSelect === false">{{ attrOpenchannelAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrOpenchannelAccounts\'].$error" ng-show="dashboarditemForm[\'attrOpenchannelAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTEROPENCHANNELACCOUNTS_REQUIRED">FilterOpenchannelAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'whatsapp\'" class="md-block">\n          <label translate="TOOLS.FILTERWHATSAPPACCOUNTS">FilterWhatsappAccounts</label>\n          <md-select name="attrWhatsappAccounts" ng-model="vm.dashboarditem.attrWhatsappAccounts" multiple>\n            <md-option ng-value="attrWhatsappAccounts.id" ng-repeat="attrWhatsappAccounts in vm.whatsappAccount" ng-disabled="attrWhatsappAccounts.canSelect === false">{{ attrWhatsappAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrWhatsappAccounts\'].$error" ng-show="dashboarditemForm[\'attrWhatsappAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERWHATSAPPACCOUNTS_REQUIRED">FilterWhatsappAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'chat\'" class="md-block">\n          <label translate="TOOLS.FILTERCHATWEBSITES">FilterChatWebsites</label>\n          <md-select name="attrChatWebsites" ng-model="vm.dashboarditem.attrChatWebsites" multiple>\n            <md-option ng-value="attrChatWebsites.id" ng-repeat="attrChatWebsites in vm.chatWebsite" ng-disabled="attrChatWebsites.canSelect === false">{{ attrChatWebsites.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrChatWebsites\'].$error" ng-show="dashboarditemForm[\'attrChatWebsites\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERCHATWEBSITES_REQUIRED">FilterChatWebsites field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\', \'counter\'].includes(vm.dashboarditem.type) && vm.dashboarditem.attrChannel === \'voice\'" class="md-block">\n        <label translate="TOOLS.FILTERVOICEQUEUES">FilterVoiceQueues</label>\n        <md-select name="attrVoiceQueues" ng-model="vm.dashboarditem.attrVoiceQueues" multiple>\n          <md-option ng-value="attrVoiceQueues.id" ng-repeat="attrVoiceQueues in vm.voiceQueues" ng-disabled="attrVoiceQueues.canSelect === false">{{ attrVoiceQueues.name }}</md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrVoiceQueues\'].$error" ng-show="dashboarditemForm[\'attrVoiceQueues\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FILTERVOICEQUEUES_REQUIRED">FilterVoiceQueues field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TITLE">Title</label>\n        <input type="text" name="title" ng-model="vm.dashboarditem.title" md-maxlength="255" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'title\'].$error" ng-show="dashboarditemForm[\'title\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TITLE_REQUIRED">Title field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.TITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>Title must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TITLEFONTSIZE">TitleFontSize</label>\n        <input type="number" name="titleFontSize" ng-model="vm.dashboarditem.titleFontSize" value="12">\n\n        <div ng-messages="dashboarditemForm[\'titleFontSize\'].$error" ng-show="dashboarditemForm[\'titleFontSize\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TITLEFONTSIZE_REQUIRED">TitleFontSize field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'iframe\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="attrUrl" ng-model="vm.dashboarditem.attrUrl" value="https://" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrUrl\'].$error" ng-show="dashboarditemForm[\'attrUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'custom\'" class="md-block">\n        <label translate="TOOLS.PATH">Path</label>\n        <input type="text" name="attrPath" ng-model="vm.dashboarditem.attrPath" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrPath\'].$error" ng-show="dashboarditemForm[\'attrPath\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.PATH_REQUIRED">Path field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'clock\'" class="md-block">\n        <label translate="TOOLS.FORMAT">Format</label>\n        <input type="text" name="attrHourFormat" ng-model="vm.dashboarditem.attrHourFormat" value="HH:mm:ss" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrHourFormat\'].$error" ng-show="dashboarditemForm[\'attrHourFormat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FORMAT_REQUIRED">Format field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'clock\'" class="md-block">\n        <label translate="TOOLS.TIMEZONE">Timezone</label>\n        <md-select name="attrTimezone" ng-model="vm.dashboarditem.attrTimezone" required>\n          <md-option ng-value="\'-12.00\'">GMT-12.00</md-option>\n          <md-option ng-value="\'-11.00\'">GMT-11.00</md-option>\n          <md-option ng-value="\'-10.00\'">GMT-10.00</md-option>\n          <md-option ng-value="\'-9.00\'">GMT-9.00</md-option>\n          <md-option ng-value="\'-8.00\'">GMT-8.00</md-option>\n          <md-option ng-value="\'-7.00\'">GMT-7.00</md-option>\n          <md-option ng-value="\'-6.00\'">GMT-6.00</md-option>\n          <md-option ng-value="\'-5.00\'">GMT-5.00</md-option>\n          <md-option ng-value="\'-4.00\'">GMT-4.00</md-option>\n          <md-option ng-value="\'-3.30\'">GMT-3.30</md-option>\n          <md-option ng-value="\'-3.00\'">GMT-3.00</md-option>\n          <md-option ng-value="\'-2.00\'">GMT-2.00</md-option>\n          <md-option ng-value="\'-1.00\'">GMT-1.00</md-option>\n          <md-option ng-value="\'0.00\'">GMT 0.00</md-option>\n          <md-option ng-value="\'1.00\'">GMT+1.00</md-option>\n          <md-option ng-value="\'2.00\'">GMT+2.00</md-option>\n          <md-option ng-value="\'3.00\'">GMT+3.00</md-option>\n          <md-option ng-value="\'3.30\'">GMT+3.30</md-option>\n          <md-option ng-value="\'4.00\'">GMT+4.00</md-option>\n          <md-option ng-value="\'4.30\'">GMT+4.30</md-option>\n          <md-option ng-value="\'5.00\'">GMT+5.00</md-option>\n          <md-option ng-value="\'5.30\'">GMT+5.30</md-option>\n          <md-option ng-value="\'5.45\'">GMT+5.45</md-option>\n          <md-option ng-value="\'6.00\'">GMT+6.00</md-option>\n          <md-option ng-value="\'6.30\'">GMT+6.30</md-option>\n          <md-option ng-value="\'7.00\'">GMT+7.00</md-option>\n          <md-option ng-value="\'8.00\'">GMT+8.00</md-option>\n          <md-option ng-value="\'9.00\'">GMT+9.00</md-option>\n          <md-option ng-value="\'9.30\'">GMT+9.30</md-option>\n          <md-option ng-value="\'10.00\'">GMT+10.00</md-option>\n          <md-option ng-value="\'11.00\'">GMT+11.00</md-option>\n          <md-option ng-value="\'12.00\'">GMT+12.00</md-option>\n          <md-option ng-value="\'13.00\'">GMT+13.00</md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrTimezone\'].$error" ng-show="dashboarditemForm[\'attrTimezone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type === \'counter\'" class="md-block">\n        <label translate="TOOLS.METRIC">Metric</label>\n        <md-select name="attrMetric" ng-model="vm.dashboarditem.attrMetric" required>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrMetric\'].$error" ng-show="dashboarditemForm[\'attrMetric\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.METRIC_REQUIRED">Metric field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.SERIE1">Serie1</label>\n        <md-select name="attrSerie1" ng-model="vm.dashboarditem.attrSerie1" required>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrSerie1\'].$error" ng-show="dashboarditemForm[\'attrSerie1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SERIE1_REQUIRED">Serie1 field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.SERIE2">Serie2</label>\n        <md-select name="attrSerie2" ng-model="vm.dashboarditem.attrSerie2">\n\n          <md-option ng-value="\'null\'"> {{ \'TOOLS.NONE\' | translate }} </md-option>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrSerie2\'].$error" ng-show="dashboarditemForm[\'attrSerie2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SERIE2_REQUIRED">Serie2 field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.SERIE3">Serie3</label>\n        <md-select name="attrSerie3" ng-model="vm.dashboarditem.attrSerie3">\n\n          <md-option ng-value="\'null\'"> {{ \'TOOLS.NONE\' | translate }} </md-option>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrSerie3\'].$error" ng-show="dashboarditemForm[\'attrSerie3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SERIE3_REQUIRED">Serie3 field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'web-report\'" class="md-block">\n        <label translate="TOOLS.REPORT">Report</label>\n        <input type="search" name="report" ng-model="vm.dashboarditem.report" ng-required="true" autocomplete="off" ng-click="vm.searchReport()">\n        <md-icon md-font-icon="icon-magnify" ng-click="vm.searchReport()" aria-label="Search Report"></md-icon>\n        <div ng-messages="dashboarditemForm[\'report\'].$error" ng-show="dashboarditemForm[\'report\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REPORT_REQUIRED">Report field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'web-report\'" class="md-block">\n        <label translate="TOOLS.REFRESH">Refresh</label>\n        <input type="number" name="attrRefresh" ng-model="vm.dashboarditem.attrRefresh" min="5" value="10" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrRefresh\'].$error" ng-show="dashboarditemForm[\'attrRefresh\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REFRESH_REQUIRED">Refresh field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="TOOLS.ERRORS.REFRESH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Refresh must be a valid greater or equal than</span> <span>5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'counter\', \'clock\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.FONTSIZE">FontSize</label>\n        <input type="number" name="attrFontSize" ng-model="vm.dashboarditem.attrFontSize" min="12" max="40" value="20" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrFontSize\'].$error" ng-show="dashboarditemForm[\'attrFontSize\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FONTSIZE_REQUIRED">FontSize field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="TOOLS.ERRORS.FONTSIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">FontSize must be a valid greater or equal than</span> <span>12</span>\n          </div>\n          <div ng-message="max">\n            <span translate="TOOLS.ERRORS.FONTSIZE_MUST_BE_LESS_THAN_OR_EQUAL_TO">FontSize must be a valid greater or equal than</span> <span>40</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div flex md-color-picker ng-model="vm.dashboarditem.foreground" label="{{\'TOOLS.FOREGROUND\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n      <div flex md-color-picker ng-model="vm.dashboarditem.background" label="{{\'TOOLS.BACKGROUND\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.LINK">link</label>\n        <input type="url" name="link" ng-model="vm.dashboarditem.link">\n\n        <div ng-messages="dashboarditemForm[\'link\'].$error" ng-show="dashboarditemForm[\'link\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LINK_REQUIRED">link field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.LINK_MUST_VALID_URL">link must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDashboardItem" ng-click="vm.saveDashboardItem()" class="send-button md-accent md-raised" ng-disabled="dashboarditemForm.$invalid || dashboarditemForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDashboardItem" ng-click="vm.addNewDashboardItem()" class="send-button md-accent md-raised" ng-disabled="dashboarditemForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_DASHBOARDITEM" translate-attr-aria-label="TOOLS.ADD_DASHBOARDITEM">\n          ADD DASHBOARDITEM\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDashboardItem" ng-click="vm.deleteDashboardItem($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/edit/view.html",'<div id="tools-customDashboard" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-customDashboards-button md-icon-button" aria-label="Go to customDashboards" ng-click="vm.gotoCustomDashboards()" translate translate-attr-aria-label="TOOLS.GO_TO_CUSTOMDASHBOARDS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="customDashboard-image" hide-xs>\n          <img ng-src="assets/images/business/customDashboards.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.customDashboard.id}}\n            <span ng-if="vm.customDashboard.name">{{vm.customDashboard.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{vm.customDashboard.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.customDashboard, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="TOOLS.CLONE_CUSTOMDASHBOARD"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.customDashboard, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="TOOLS.GOTO_CUSTOMDASHBOARD"></span></md-tooltip>\n        <md-icon md-font-icon="icon-forward"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveCustomDashboard()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (dashboardForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="customDashboard-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.customDashboard.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.customDashboard.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.DASHBOARD">DASHBOARD</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="customDashboard-detail-form-container dashboard md-background-bg md-whiteframe-1dp">\n            <div ng-controller="CustomDashboardItemsController as vm_cd" ng-init="vm_cd.init(vm.customDashboard, vm.crudPermissions)" class="customDashboard-detail-form-container no-padding no-margin" layout="column">\n              <div ng-if="vm_cd.customDashboard.widgets.length">\n                <md-button class="md-fab md-mini md-accent" ng-click="vm_cd.createOrEditWidget()" ng-if="vm_cd.crudPermissions.canEdit" aria-label="add item">\n                  <md-tooltip>{{ \'TOOLS.ADD_WIDGET\' | translate }}</md-tooltip>\n                  <md-icon md-font-icon="icon-plus"></md-icon>\n                </md-button>\n                <md-content flex>\n                  <ms-widget-engine config="vm_cd.customDashboard" on-edit="vm_cd.createOrEditWidget(widget)" on-delete="vm_cd.deleteWidget(widget)"></ms-widget-engine>\n                </md-content>\n              </div>\n              <div ng-if="!vm_cd.customDashboard.widgets.length" layout="row" layout-align="center center" flex>\n                <md-button class="width-130 height-130 md-accent md-raised" ng-click="vm_cd.createOrEditWidget()" aria-label="add item" layout="column">\n                  <md-icon md-font-icon="icon-plus-circle" class="s50"></md-icon>\n                  <span layout-wrap translate="TOOLS.ADD_WIDGET"></span>\n                </md-button>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/tools/views/customDashboards/partialViews/reports/treeReports.html",'<md-dialog class="report-selection-dialog" aria-label="Report Selection" flex="60">\n  <md-toolbar>\n    <div class="md-toolbar-tools">\n      <h2>Select Report</h2>\n      <span flex></span>\n      <md-button class="md-icon-button" ng-click="vm.closeReportDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-dialog-content>\n    <div class="content" md-background-bg layout="row" layout-align="start start">\n      <div layout="column" flex="30">\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeDefaultEvents" ng-model="vm.treeDefaultData" tree="vm.treeDefaultInstance"></div>\n        </md-card>\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n        </md-card>\n      </div>\n      <md-card flex="70">\n        <md-toolbar class="md-table-toolbar md-default">\n          <div class="md-toolbar-tools">\n            <span class="h2 secondary-text">{{vm.currentNode.text}}</span>\n            <p ng-if="vm.currentPath">\n              <span class="text-boxed">{{vm.currentPath}}</span>\n            </p>\n          </div>\n        </md-toolbar>\n        <md-table-container>\n          <table md-table md-row-select ng-model="vm.selectedReport" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getReports">\n              <tr md-row>\n                <th md-column md-order-by="id" width="10px">{{ "ANALYTICS.ID" | translate }}</th>\n                <th md-column md-order-by="name">{{ "ANALYTICS.NAME" | translate }}</th>\n                <th md-column md-order-by="description">{{ "ANALYTICS.DESCRIPTION" | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ "ANALYTICS.CREATED_AT" | translate }}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.reports.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="report" md-select-id="id" ng-repeat="report in vm.reports.rows">\n                <td md-cell class="id">{{ report.id }}</td>\n                <td md-cell class="name">{{ report.name }}</td>\n                <td md-cell class="description">{{ report.description }}</td>\n                <td md-cell class="createdAt">{{ report.createdAt | date: "medium" }}</td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{ \'ANALYTICS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'ANALYTICS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'ANALYTICS.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10]" md-page="vm.query.page" md-total="{{ vm.reports.count }}" md-on-paginate="vm.getReports" md-page-select></md-table-pagination>\n      </md-card>\n    </div>\n  </md-dialog-content>\n  <md-dialog-actions layout="row">\n    <span flex></span>\n    <md-button class="md-raised" ng-click="vm.closeReportDialog()">CANCEL</md-button>\n    <md-button class="md-accent md-raised" ng-click="vm.selectReport()">CONFIRM</md-button>\n  </md-dialog-actions>\n</md-dialog>'),e.put("app/main/apps/tools/views/dispositions/create/dialog.html",'<md-dialog ng-init="vm.onInit()" class="disposition-dialog" aria-label="New Disposition">\n  <form name="dispositionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newDisposition ? \'TOOLS.NEW_DISPOSITION\' : \'TOOLS.EDIT_DISPOSITION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.disposition.name" md-maxlength="255" required md-autofocus>\n        <div ng-messages="dispositionForm[\'name\'].$error" ng-show="dispositionForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.NAME_MAX_LENGTH" translate-values=\'{max: 255}\'>Name must have a maximum length\n              equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.disposition.description" md-maxlength="255">\n        <div ng-messages="dispositionForm[\'description\'].$error" ng-show="dispositionForm[\'description\'].$touched" role="alert">\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_MAX_LENGTH" translate-values=\'{max: 255}\'>Description must have a\n              maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.newDisposition && vm.dispositions.length > 0 || vm.disposition.ParentId" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="TOOLS.FIRST_LEVEL_DISPOSITION">First Level Disposition</label>\n          <md-select name="firstLevelDisposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onFirstLevelSelection()">\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' }" ng-disabled="disposition.canSelect === false">{{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.firstLevelDisposition" ng-click="vm.clearSelection(\'first\'); dispositionForm.$setDirty();" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear first level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="TOOLS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n          <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition">\n            <md-option ng-value="disposition" ng-if="disposition.id != vm.disposition.id" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id }" ng-disabled="disposition.canSelect === false">{{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearSelection(\'second\'); dispositionForm.$setDirty();" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear first level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDisposition" ng-click="vm.saveDisposition()" class="send-button md-accent md-raised" ng-disabled="dispositionForm.$invalid || dispositionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDisposition" ng-click="vm.addNewDisposition()" class="send-button md-accent md-raised" ng-disabled="dispositionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_DISPOSITION" translate-attr-aria-label="TOOLS.ADD_DISPOSITION">\n          ADD DISPOSITION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDisposition" ng-click="vm.deleteDisposition($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/dispositions/dispositions.html",'<div id="dispositions" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.DISPOSITIONS">Dispositions</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedDispositions.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedDispositions = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-dispositions-count">\n          <span>{{vm.selectedDispositions.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllDispositions()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectDispositions()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedDispositions" csv-label="true" filename="dispositions.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      <div layout="row">\n        <div class="column" flex="20">\n          <md-card>\n            <md-card-content>\n              <button layout-align="center center" md-mini-fab ng-click="vm.query.level = null; vm.getDispositions()">\n                <div layout="row" layout-align="start center">\n                  <md-icon md-font-icon="icon-refresh"></md-icon>\n                  <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                </div>\n              </button>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm.query.level" ng-change="vm.getDispositions()">\n                  <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                  <md-option ng-value="key" ng-repeat="(key, value) in vm.levels">{{ value }}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n        </div>\n        \x3c!-- DISPOSITION TABLE --\x3e\n        <md-card flex="80">\n          <md-table-container>\n            <table md-table md-row-select multiple ng-model="vm.selectedDispositions" md-progress="vm.promise">\n              <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getDispositions">\n                <tr md-row>\n                  <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                  <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                  <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                  <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                  <th md-column width="10px"></th>\n                </tr>\n              </thead>\n              <tbody md-body>\n                <tr md-row ng-hide="vm.dispositions.rows.length">\n                  <td md-cell colspan="5">\n                    <div layout="row" layout-align="center center">\n                      <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                  </td>\n                </tr>\n                <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm.dispositions.rows">\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                  </td>\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                    {{ vm.levels[disposition.level] }}</td>\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                    {{disposition.name}}</td>\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                    {{disposition.description}}</td>\n                  <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        \x3c!-- SUBACTIONS --\x3e\n                        \x3c!-- ACTIONS --\x3e\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                            Edit Disposition\n                          </md-button>\n                        </md-menu-item>\n                        \x3c!-- SUBACTIONS --\x3e\n                        \x3c!-- ACTIONS --\x3e\n                        <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                          <md-button ng-click="vm.deleteconfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                            Delete Disposition\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n          <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.dispositions.count}}" md-on-paginate="vm.getDispositions" md-page-select>\n          </md-table-pagination>\n        </md-card>\n        \x3c!-- / DISPOSITION TABLE --\x3e\n      </div>\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n  \x3c!-- ADD DISPOSITION BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-disposition-button" ng-click="vm.createOrEditDisposition($event)" aria-label="add disposition" translate translate-attr-aria-label="TOOLS.ADD_DISPOSITION">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD DISPOSITION BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/intervals/create/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.interval.name" ng-required="true" autofocus>\n\n        <div ng-messages="intervalForm[\'name\'].$error" ng-show="intervalForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.interval.description">\n\n        <div ng-messages="intervalForm[\'description\'].$error" ng-show="intervalForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInterval" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInterval" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInterval" ng-click="vm.deleteInterval($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/intervals/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input ng-model="vm.interval.name" type="text" name="name" placeholder="{{\'TOOLS.NAME\' | translate}}" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" md-autofocus required>\n        <div ng-messages="intervalForm.name.$error" ng-show="intervalForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/intervals/edit/intervals/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.interval.name" ng-required="true" autofocus>\n\n        <div ng-messages="intervalForm[\'name\'].$error" ng-show="intervalForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInterval" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInterval" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInterval" ng-click="vm.deleteInterval($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/intervals/edit/view.html",'<div id="tools-interval" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-intervals-button md-icon-button" aria-label="Go to intervals" ng-click="vm.gotoIntervals()" translate translate-attr-aria-label="TOOLS.GO_TO_INTERVALS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="interval-image" hide-xs>\n          <img ng-src="assets/images/business/intervals.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.interval.id}}\n            <span ng-if="vm.interval.name">{{vm.interval.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{vm.interval.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveInterval()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (intervalsForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="interval-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.interval.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.interval.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.INTERVALS">INTERVALS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="interval-detail-form-container intervals md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IntervalIntervalsController as vm_dc" ng-init="vm_dc.init(vm.interval, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIntervalIntervals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="TOOLS.INTERVALS">Intervals</span>\n                  <ms-search-bar on-search="vm_dc.getIntervalIntervals()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditIntervalInterval($event)" aria-label="add interval" translate translate-attr-label="TOOLS.ADD_INTERVAL">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIntervalIntervals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIntervalIntervals.length}} {{vm_dc.selectedIntervalIntervals.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIntervalIntervals" csv-label="true" filename="intervals.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedIntervalIntervals($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIntervalIntervals" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIntervalIntervals">\n                    <tr md-row>\n                      <th md-column width="10px"></th>\n                      <th md-column md-order-by="id">\n                        {{ \'TOOLS.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="name">\n                        {{ \'TOOLS.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="interval">\n                        {{ \'TOOLS.INTERVAL\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'TOOLS.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body ng-sortable="vm_dc.sortableTable">\n                    <tr md-row md-select="interval" md-select-id="id" ng-repeat="interval in vm_dc.intervalIntervals.rows">\n                      <td md-cell>\n                        <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{interval.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{interval.name}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{interval.interval}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{ interval.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" translate="TOOLS.EDIT_INTERVAL">\n                                Edit Interval\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interval, $event)" translate="TOOLS.DELETE_INTERVAL">\n                                Delete Interval\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.intervalIntervals.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="TOOLS.NO_INTERVALS_AVAILABLE">No intervals available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/tools/views/intervals/intervals.html",'<div id="intervals" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.INTERVALS">Intervals</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedIntervals.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedIntervals =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-intervals-count">\n          <span>{{vm.selectedIntervals.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllIntervals()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectIntervals()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedIntervals" csv-label="true" filename="intervals.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedIntervals($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- INTERVAL TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedIntervals" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getIntervals">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.intervals.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="interval" md-select-id="id" ng-repeat="interval in vm.intervals.rows">\n                <td md-cell ng-if="interval.userpic"><img class="avatar" alt="{{interval.name}}" ng-src="api/users/{{interval.id}}/avatar" /></td>\n                <td md-cell ng-if="!interval.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{interval.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(interval, ev) : vm.createOrEditInterval($event, interval)" md-cell class="id ">{{interval.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(interval, ev) : vm.createOrEditInterval($event, interval)" md-cell class="name ">{{interval.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(interval, ev) : vm.createOrEditInterval($event, interval)" md-cell class="description ">{{interval.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(interval, $event    )" translate="TOOLS.EDIT_INTERVAL">\n                          Edit Interval\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(interval, $event    )" translate="TOOLS.DELETE_INTERVAL">\n                          Delete Interval\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.intervals.count}}" md-on-paginate="vm.getIntervals" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / INTERVAL TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD INTERVAL BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-interval-button" ng-click="vm.createOrEditInterval($event)" aria-label="add interval" translate translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD INTERVAL BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/pauses/create/dialog.html",'<md-dialog class="pause-dialog" aria-label="New Pause">\n  <form name="pauseForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.pause.name" ng-required="true" autofocus>\n\n        <div ng-messages="pauseForm[\'name\'].$error" ng-show="pauseForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.pause.description">\n\n        <div ng-messages="pauseForm[\'description\'].$error" ng-show="pauseForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newPause" ng-click="vm.savePause()" class="send-button md-accent md-raised" ng-disabled="pauseForm.$invalid || pauseForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newPause" ng-click="vm.addNewPause()" class="send-button md-accent md-raised" ng-disabled="pauseForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_PAUSE" translate-attr-aria-label="TOOLS.ADD_PAUSE">\n          ADD PAUSE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newPause" ng-click="vm.deletePause($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/pauses/pauses.html",'<div id="pauses" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.PAUSES">Pauses</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedPauses.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedPauses =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-pauses-count">\n          <span>{{vm.selectedPauses.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllPauses()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectPauses()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedPauses" csv-label="true" filename="pauses.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedPauses($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- PAUSE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedPauses" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getPauses">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.pauses.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="pause" md-select-id="id" ng-repeat="pause in vm.pauses.rows">\n                <td md-cell ng-if="pause.userpic"><img class="avatar" alt="{{pause.name}}" ng-src="api/users/{{pause.id}}/avatar" /></td>\n                <td md-cell ng-if="!pause.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{pause.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditPause($event, pause)" md-cell class="id ">{{pause.id}}</td>\n                <td ng-click="vm.createOrEditPause($event, pause)" md-cell class="name ">{{pause.name}}</td>\n                <td ng-click="vm.createOrEditPause($event, pause)" md-cell class="description ">{{pause.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(pause, $event    )" translate="TOOLS.EDIT_PAUSE">\n                          Edit Pause\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(pause, $event    )" translate="TOOLS.DELETE_PAUSE">\n                          Delete Pause\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.pauses.count}}" md-on-paginate="vm.getPauses" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PAUSE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD PAUSE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-pause-button" ng-click="vm.createOrEditPause($event)" aria-label="add pause" translate translate-attr-aria-label="TOOLS.ADD_PAUSE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD PAUSE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/schedules/create/dialog.html",'<md-dialog class="schedule-dialog" aria-label="New Schedule">\n  <form name="scheduleForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.schedule.name" ng-required="true" autofocus>\n\n        <div ng-messages="scheduleForm[\'name\'].$error" ng-show="scheduleForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.REPORT">Report</label>\n        <input type="search" name="report" ng-model="vm.schedule.report" ng-required="true" autocomplete="off" ng-click="vm.searchReport()">\n        <md-icon md-font-icon="icon-magnify" ng-click="vm.searchReport()" aria-label="Search Report"></md-icon>\n        <div ng-messages="scheduleForm[\'report\'].$error" ng-show="scheduleForm[\'report\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REPORT_REQUIRED">Report field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.OUTPUT">Output</label>\n        <md-select name="output" ng-model="vm.schedule.output" required>\n          <md-option ng-value="\'csv\'">CSV</md-option>\n          <md-option ng-value="\'pdf\'">PDF</md-option>\n          <md-option ng-value="\'xlsx\'">Excel</md-option>\n        </md-select>\n        <div ng-messages="scheduleForm[\'output\'].$error" ng-show="scheduleForm[\'output\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OUTPUT_REQUIRED">Output field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.schedule.active" aria-label="Active"><span translate="TOOLS.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <div class="md-block">\n        <label translate="TOOLS.VALIDITYSTART">ValidityStart</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click required name="startAtDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.schedule.startAt" ng-init="vm.schedule.startAt = vm.getDateFromString(vm.schedule.startAt)">\n              <div ng-messages="scheduleForm.dateRangeFrom.$error" ng-show="scheduleForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click required name="startAtTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.schedule.startAt" ng-init="vm.schedule.startAt = vm.getDateFromString(vm.schedule.startAt)">\n              <div ng-messages="scheduleForm.timeRangeFrom.$error" ng-show="scheduleForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <div class="md-block">\n        <label translate="TOOLS.VALIDITYEND">ValidityEnd</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click required name="endAtDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.schedule.endAt" ng-init="vm.schedule.endAt = vm.getDateFromString(vm.schedule.endAt)">\n              <div ng-messages="scheduleForm.dateRangeFrom.$error" ng-show="scheduleForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click required name="endAtTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.schedule.endAt" ng-init="vm.schedule.endAt = vm.getDateFromString(vm.schedule.endAt)">\n              <div ng-messages="scheduleForm.timeRangeFrom.$error" ng-show="scheduleForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <div flex class="md-block">\n        <label> {{ \'TOOLS.CRON\' | translate }} ({{vm.schedule.cron}})</label>\n        <cron-selection name="cron" ng-model="vm.schedule.cron" template="assets/angular-cron-jobs/template.html" required></cron-selection>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.LAST">Last</label>\n        <input type="number" name="subtractNumber" ng-model="vm.schedule.subtractNumber" value="1" ng-required="true">\n\n        <div ng-messages="scheduleForm[\'subtractNumber\'].$error" ng-show="scheduleForm[\'subtractNumber\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LAST_REQUIRED">Last field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.LASTUNIT">LastUnit</label>\n        <md-select name="subtractUnit" ng-model="vm.schedule.subtractUnit" required>\n          <md-option ng-value="\'minutes\'">Minutes</md-option>\n          <md-option ng-value="\'hours\'">Hours</md-option>\n          <md-option ng-value="\'days\'">Days</md-option>\n          <md-option ng-value="\'weeks\'">Weeks</md-option>\n          <md-option ng-value="\'months\'">Months</md-option>\n          <md-option ng-value="\'quarters\'">Quarters</md-option>\n          <md-option ng-value="\'years\'">Years</md-option>\n        </md-select>\n        <div ng-messages="scheduleForm[\'subtractUnit\'].$error" ng-show="scheduleForm[\'subtractUnit\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LASTUNIT_REQUIRED">LastUnit field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.schedule.sendMail" aria-label="SendMail"><span translate="TOOLS.SENDMAIL">SendMail</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.MAILACCOUNT">MailAccount</label>\n        <md-select name="MailAccountId" ng-model="vm.schedule.MailAccountId" required>\n          <md-option ng-value="MailAccountId.id" ng-repeat="MailAccountId in vm.mailAccounts" ng-disabled="MailAccountId.canSelect === false">{{ MailAccountId.name }}</md-option>\n        </md-select>\n        <div ng-messages="scheduleForm[\'MailAccountId\'].$error" ng-show="scheduleForm[\'MailAccountId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.MAILACCOUNT_REQUIRED">MailAccount field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.EMAILADDRESS">EmailAddress</label>\n        <input type="text" name="email" ng-model="vm.schedule.email" ng-required="true">\n\n        <div class="hint"><span translate="TOOLS.HELP.EMAILADDRESS"></span></div>\n        <div ng-messages="scheduleForm[\'email\'].$error" ng-show="scheduleForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EMAILADDRESS_REQUIRED">EmailAddress field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.EMAILCCADDRESS">EmailCcAddress</label>\n        <input type="text" name="cc" ng-model="vm.schedule.cc">\n\n        <div class="hint"><span translate="TOOLS.HELP.EMAILCCADDRESS"></span></div>\n        <div ng-messages="scheduleForm[\'cc\'].$error" ng-show="scheduleForm[\'cc\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EMAILCCADDRESS_REQUIRED">EmailCcAddress field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.EMAILBCCADDRESS">EmailBccAddress</label>\n        <input type="text" name="bcc" ng-model="vm.schedule.bcc">\n\n        <div class="hint"><span translate="TOOLS.HELP.EMAILBCCADDRESS"></span></div>\n        <div ng-messages="scheduleForm[\'bcc\'].$error" ng-show="scheduleForm[\'bcc\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EMAILBCCADDRESS_REQUIRED">EmailBccAddress field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <md-switch ng-model="vm.schedule.sendIfEmpty" aria-label="SendIfEmpty"><span translate="TOOLS.SENDIFEMPTY">SendIfEmpty</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="" name="description" ng-model="vm.schedule.description">\n\n        <div ng-messages="scheduleForm[\'description\'].$error" ng-show="scheduleForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSchedule" ng-click="vm.saveSchedule()" class="send-button md-accent md-raised" ng-disabled="scheduleForm.$invalid || scheduleForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSchedule" ng-click="vm.addNewSchedule()" class="send-button md-accent md-raised" ng-disabled="scheduleForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_SCHEDULE" translate-attr-aria-label="TOOLS.ADD_SCHEDULE">\n          ADD SCHEDULE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSchedule" ng-click="vm.deleteSchedule($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/schedules/partialViews/reports/treeReports.html",'<md-dialog class="report-selection-dialog" aria-label="Report Selection" flex="60">\n  <md-toolbar>\n    <div class="md-toolbar-tools">\n      <h2>Select Report</h2>\n      <span flex></span>\n      <md-button class="md-icon-button" ng-click="vm.closeReportDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-dialog-content>\n    <div class="content" md-background-bg layout="row" layout-align="start start">\n      <div layout="column" flex="30">\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeDefaultEvents" ng-model="vm.treeDefaultData" tree="vm.treeDefaultInstance"></div>\n        </md-card>\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n        </md-card>\n      </div>\n      <md-card flex="70">\n        <md-toolbar class="md-table-toolbar md-default">\n          <div class="md-toolbar-tools">\n            <span class="h2 secondary-text">{{vm.currentNode.text}}</span>\n            <p ng-if="vm.currentPath">\n              <span class="text-boxed">{{vm.currentPath}}</span>\n            </p>\n          </div>\n        </md-toolbar>\n        <md-table-container>\n          <table md-table md-row-select ng-model="vm.selectedReport" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getReports">\n              <tr md-row>\n                <th md-column md-order-by="id" width="10px">{{ "ANALYTICS.ID" | translate }}</th>\n                <th md-column md-order-by="name">{{ "ANALYTICS.NAME" | translate }}</th>\n                <th md-column md-order-by="description">{{ "ANALYTICS.DESCRIPTION" | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ "ANALYTICS.CREATED_AT" | translate }}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.reports.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="report" md-select-id="id" ng-repeat="report in vm.reports.rows">\n                <td md-cell class="id">{{ report.id }}</td>\n                <td md-cell class="name">{{ report.name }}</td>\n                <td md-cell class="description">{{ report.description }}</td>\n                <td md-cell class="createdAt">{{ report.createdAt | date: "medium" }}</td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{ \'ANALYTICS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'ANALYTICS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'ANALYTICS.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10]" md-page="vm.query.page" md-total="{{ vm.reports.count }}" md-on-paginate="vm.getReports" md-page-select></md-table-pagination>\n      </md-card>\n    </div>\n  </md-dialog-content>\n  <md-dialog-actions layout="row">\n    <span flex></span>\n    <md-button class="md-raised" ng-click="vm.closeReportDialog()">CANCEL</md-button>\n    <md-button class="md-accent md-raised" ng-click="vm.selectReport()">CONFIRM</md-button>\n  </md-dialog-actions>\n</md-dialog>'),e.put("app/main/apps/tools/views/schedules/schedules.html",'<div id="schedules" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.SCHEDULER">Scheduler</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedScheduler.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedScheduler =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-schedules-count">\n          <span>{{vm.selectedScheduler.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllScheduler()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectScheduler()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedScheduler" csv-label="true" filename="schedules.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedScheduler($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SCHEDULE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedScheduler" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getScheduler">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'TOOLS.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="startAt">{{ \'TOOLS.VALIDITYSTART\' | translate }}</th>\n                <th md-column md-order-by="endAt">{{ \'TOOLS.VALIDITYEND\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.schedules.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="schedule" md-select-id="id" ng-repeat="schedule in vm.schedules.rows">\n                <td md-cell ng-if="schedule.userpic"><img class="avatar" alt="{{schedule.name}}" ng-src="api/users/{{schedule.id}}/avatar" /></td>\n                <td md-cell ng-if="!schedule.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{schedule.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="id ">{{schedule.id}}</td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="name ">{{schedule.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(schedule, ev) : vm.createOrEditSchedule($event, schedule)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{schedule.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{schedule.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="startAt ">{{schedule.startAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="endAt ">{{schedule.endAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="description ">{{schedule.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(schedule, $event    )" translate="TOOLS.EDIT_SCHEDULE">\n                          Edit Schedule\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.runconfirm(schedule, $event    )" translate="TOOLS.RUN_SCHEDULE">\n                          Run Schedule\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(schedule, $event    )" translate="TOOLS.DELETE_SCHEDULE">\n                          Delete Schedule\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.schedules.count}}" md-on-paginate="vm.getScheduler" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SCHEDULE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SCHEDULE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-schedule-button" ng-click="vm.createOrEditSchedule($event)" aria-label="add schedule" translate translate-attr-aria-label="TOOLS.ADD_SCHEDULE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SCHEDULE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/sounds/create/dialog.html",'<md-dialog class="sound-dialog" aria-label="New Sound">\n  <form name="soundForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.sound.name" ng-required="true" autofocus>\n\n        <div ng-messages="soundForm[\'name\'].$error" ng-show="soundForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.sound.description">\n\n        <div ng-messages="soundForm[\'description\'].$error" ng-show="soundForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSound" ng-click="vm.saveSound()" class="send-button md-accent md-raised" ng-disabled="soundForm.$invalid || soundForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSound" ng-click="vm.addNewSound()" class="send-button md-accent md-raised" ng-disabled="soundForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_SOUND" translate-attr-aria-label="TOOLS.ADD_SOUND">\n          ADD SOUND\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSound" ng-click="vm.deleteSound($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/sounds/sounds.html",'<div id="sounds" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.SOUNDS">Sounds</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSounds.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSounds =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-sounds-count">\n          <span>{{vm.selectedSounds.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSounds()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSounds()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSounds" csv-label="true" filename="sounds.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSounds($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SOUND TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSounds" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSounds">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="audio">{{ \'TOOLS.AUDIO\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.sounds.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="sound" md-select-id="id" ng-repeat="sound in vm.sounds.rows">\n                <td md-cell ng-if="sound.userpic"><img class="avatar" alt="{{sound.name}}" ng-src="api/users/{{sound.id}}/avatar" /></td>\n                <td md-cell ng-if="!sound.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{sound.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditSound($event, sound)" md-cell class="id ">{{sound.id}}</td>\n                <td ng-click="vm.createOrEditSound($event, sound)" md-cell class="name ">{{sound.name}}</td>\n                <td md-cell class="audio ">\n                  \x3c!-- audio recording directive --\x3e\n                  <ms-recording id="sound.id" model="\'sound\'"></ms-recording>\n                  \x3c!-- / audio recording directive --\x3e\n                </td>\n                <td ng-click="vm.createOrEditSound($event, sound)" md-cell class="description ">{{sound.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(sound, $event    )" translate="TOOLS.EDIT_SOUND">\n                          Edit Sound\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.downloadfile2(sound, $event  , \'sounds\'   )" translate="TOOLS.DOWNLOAD_SOUND">\n                          Download Sound\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(sound, $event    )" translate="TOOLS.DELETE_SOUND">\n                          Delete Sound\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.sounds.count}}" md-on-paginate="vm.getSounds" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SOUND TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- UPLOAD SOUND BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="upload-sound-button" ng-click="vm.uploadSound($event)" aria-label="upload sound" translate translate-attr-aria-label="TOOLS.UPLOAD_SOUND">\n    <md-icon md-font-icon="icon-upload"></md-icon>\n  </md-button>\n  \x3c!-- / UPLOAD SOUND BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/sounds/upload/dialog.html",'<md-dialog class="upload-dialog" aria-label="Upload ">\n  <form name="uploadForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div id="sound-uploader" ng-hide="vm.uploadState == \'uploading\'" flow-init="vm.ngFlowOptions" flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)" flow-error="vm.uploadError($file, $message)" flow-complete="vm.uploadComplete()" flow-drop flow-drag-enter="vm.dropping=true" flow-drag-leave="vm.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n        <div class="drop-text hint-text" layout="row" layout-align="center center">\n          <span translate="TOOLS.DROP_TO_UPLOAD">Drop to upload</span>\n        </div>\n\n        <div class="upload-button" layout="column" layout-align="center center">\n          <md-button class="md-accent md-raised" flow-btn>\n            Upload\n          </md-button>\n          <span class="secondary-text mt-8" translate="TOOLS.DROP_TO_UPLOAD_MESSAGE">You can also drop your file here to upload.</span>\n        </div>\n      </div>\n\n      <div layout="column" layout-align="space-between center" ng-show="vm.uploadState == \'uploading\'">\n        <div>\n          <span translate="TOOLS.UPLOADING">Uploading</span>\n          <span>{{vm.sound.file.name}}</span>\n        </div>\n        <md-progress-linear md-mode="indeterminate"></md-progress-linear>\n      </div>\n\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center"></div>\n      <div layout="row">\n        <md-button ng-click="vm.closeDialog()" ng-hide="vm.uploadState == \'uploading\'" class="md-accent md-raised" aria-label="FINISH" translate="TOOLS.FINISH" translate-attr-aria-label="TOOLS.FINISH">\n          FINISH\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/tags/create/dialog.html",'<md-dialog class="tag-dialog" aria-label="New Tag">\n  <form name="tagForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.tag.name" ng-required="true" autofocus>\n\n        <div ng-messages="tagForm[\'name\'].$error" ng-show="tagForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.tag.description">\n\n        <div ng-messages="tagForm[\'description\'].$error" ng-show="tagForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div flex md-color-picker ng-model="vm.tag.color" label="{{\'TOOLS.COLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTag" ng-click="vm.saveTag()" class="send-button md-accent md-raised" ng-disabled="tagForm.$invalid || tagForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTag" ng-click="vm.addNewTag()" class="send-button md-accent md-raised" ng-disabled="tagForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TAG" translate-attr-aria-label="TOOLS.ADD_TAG">\n          ADD TAG\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTag" ng-click="vm.deleteTag($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/tags/tags.html",'<div id="tags" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TAGS">Tags</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTags.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTags =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-tags-count">\n          <span>{{vm.selectedTags.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTags()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTags()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTags" csv-label="true" filename="tags.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTags($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TAG TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTags" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTags">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="color">{{ \'TOOLS.COLOR\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.tags.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="tag" md-select-id="id" ng-repeat="tag in vm.tags.rows">\n                <td md-cell ng-if="tag.userpic"><img class="avatar" alt="{{tag.name}}" ng-src="api/users/{{tag.id}}/avatar" /></td>\n                <td md-cell ng-if="!tag.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{tag.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="id ">{{tag.id}}</td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="name ">{{tag.name}}</td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="description ">{{tag.description}}</td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="color ">{{tag.color}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(tag, $event    )" translate="TOOLS.EDIT_TAG">\n                          Edit Tag\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(tag, $event    )" translate="TOOLS.DELETE_TAG">\n                          Delete Tag\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.tags.count}}" md-on-paginate="vm.getTags" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TAG TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TAG BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-tag-button" ng-click="vm.createOrEditTag($event)" aria-label="add tag" translate translate-attr-aria-label="TOOLS.ADD_TAG">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TAG BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/templates/create/dialog.html",'<md-dialog class="template-dialog" aria-label="New Template">\n  <form name="templateForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.template.name" ng-required="true" autofocus>\n\n        <div ng-messages="templateForm[\'name\'].$error" ng-show="templateForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label class="md-caption grey-fg" translate="TOOLS.CONTENT">Content</label>\n        <textarea aria-label="Content html" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.template.html"></textarea>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.template.description">\n\n        <div ng-messages="templateForm[\'description\'].$error" ng-show="templateForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTemplate" ng-click="vm.saveTemplate()" class="send-button md-accent md-raised" ng-disabled="templateForm.$invalid || templateForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTemplate" ng-click="vm.addNewTemplate()" class="send-button md-accent md-raised" ng-disabled="templateForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TEMPLATE" translate-attr-aria-label="TOOLS.ADD_TEMPLATE">\n          ADD TEMPLATE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTemplate" ng-click="vm.deleteTemplate($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/templates/templates.html",'<div id="templates" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TEMPLATES">Templates</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTemplates.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTemplates =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-templates-count">\n          <span>{{vm.selectedTemplates.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTemplates()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTemplates()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTemplates" csv-label="true" filename="templates.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTemplates($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TEMPLATE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTemplates" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTemplates">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.templates.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="template" md-select-id="id" ng-repeat="template in vm.templates.rows">\n                <td md-cell ng-if="template.userpic"><img class="avatar" alt="{{template.name}}" ng-src="api/users/{{template.id}}/avatar" /></td>\n                <td md-cell ng-if="!template.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{template.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditTemplate($event, template)" md-cell class="id ">{{template.id}}</td>\n                <td ng-click="vm.createOrEditTemplate($event, template)" md-cell class="name ">{{template.name}}</td>\n                <td ng-click="vm.createOrEditTemplate($event, template)" md-cell class="description ">{{template.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(template, $event    )" translate="TOOLS.EDIT_TEMPLATE">\n                          Edit Template\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(template, $event    )" translate="TOOLS.DELETE_TEMPLATE">\n                          Delete Template\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.templates.count}}" md-on-paginate="vm.getTemplates" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TEMPLATE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TEMPLATE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-template-button" ng-click="vm.createOrEditTemplate($event)" aria-label="add template" translate translate-attr-aria-label="TOOLS.ADD_TEMPLATE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TEMPLATE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/triggers/create/dialog.html",'<md-dialog class="trigger-dialog" aria-label="New Trigger">\n  <form name="triggerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newTrigger ? \'TOOLS.NEW_TRIGGER\' : \'TOOLS.EDIT_TRIGGER\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.trigger.name" required md-autofocus>\n        <div ng-messages="triggerForm[\'name\'].$error" ng-show="triggerForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.trigger.channel" required ng-disabled="!vm.newTrigger">\n          <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n          <md-option ng-value="\'openchannel\'" ng-if="vm.license.openchannel"> {{ \'TOOLS.OPENCHANNEL\' | translate }}\n          </md-option>\n          <md-option ng-value="\'chat\'" ng-if="vm.license.chat"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n          <md-option ng-value="\'mail\'" ng-if="vm.license.mail"> {{ \'TOOLS.MAIL\' | translate }} </md-option>\n          <md-option ng-value="\'sms\'" ng-if="vm.license.messaging"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n          <md-option ng-value="\'fax\'" ng-if="vm.license.fax"> {{ \'TOOLS.FAX\' | translate }} </md-option>\n          <md-option ng-value="\'whatsapp\'" ng-if="vm.license.whatsapp"> {{ \'TOOLS.WHATSAPP\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="triggerForm[\'channel\'].$error" ng-show="triggerForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.trigger.status" aria-label="Status"><span translate="TOOLS.STATUS">Status</span>\n        </md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.trigger.description">\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{ error.message }}</span>\n            <span class="type">({{ error.type }})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTrigger" ng-click="vm.saveTrigger()" class="send-button md-accent md-raised" ng-disabled="triggerForm.$invalid || triggerForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTrigger" ng-click="vm.addNewTrigger()" class="send-button md-accent md-raised" ng-disabled="triggerForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TRIGGER" translate-attr-aria-label="TOOLS.ADD_TRIGGER">\n          ADD TRIGGER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTrigger" ng-click="vm.deleteTrigger($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/actions/actions.html",'<div ng-controller="TriggerActionsController as vm_dc" ng-init="vm_dc.onInit(vm.trigger, vm.crudPermissions)">\r\n  <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedTriggerActions.length">\r\n    <div class="md-toolbar-tools">\r\n      <span class="md-subhead" translate="TOOLS.ACTIONS">Actions</span>\r\n      <ms-search-bar on-search="vm_dc.getTriggerActions()" query="vm_dc.query" debounce="300" direction="down">\r\n      </ms-search-bar>\r\n      <div flex></div>\r\n      <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditTriggerAction($event)" aria-label="add action" translate translate-attr-label="TOOLS.ADD_ACTION">\r\n        <md-icon md-font-icon="icon-plus"></md-icon>\r\n      </md-button>\r\n    </div>\r\n  </md-toolbar>\r\n  <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedTriggerActions.length">\r\n    <div class="md-toolbar-tools">\r\n      <span class="md-subhead">{{ vm_dc.selectedTriggerActions.length }}\r\n        {{ vm_dc.selectedTriggerActions.length > 1 ? \'items\' : \'item\' }} selected</span>\r\n      <div flex></div>\r\n      <button class="md-icon-button" ng-csv="vm_dc.exportSelectedTriggerActions" csv-label="true" filename="triggers.csv">\r\n        <md-icon md-font-icon="icon-file-excel"></md-icon>\r\n      </button>\r\n      <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedTriggerActions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\r\n        <md-icon md-font-icon="icon-delete"></md-icon>\r\n      </md-button>\r\n    </div>\r\n  </md-toolbar>\r\n  <md-table-container class="font-size-12">\r\n    <table md-table md-row-select multiple ng-model="vm_dc.selectedTriggerActions" md-progress="vm_dc.promise">\r\n      <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getTriggerActions">\r\n        <tr md-row>\r\n          <th md-column md-order-by="id">\r\n            {{ \'TOOLS.ID\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="action">\r\n            {{ \'TOOLS.ACTION\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="data1">\r\n            {{ \'TOOLS.TYPE\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="data2">\r\n            {{ \'TOOLS.INFO\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="createdAt">\r\n            {{ \'TOOLS.CREATED_AT\' | translate }}\r\n          </th>\r\n          <th md-column width="10px"></th>\r\n        </tr>\r\n      </thead>\r\n      <tbody md-body>\r\n        <tr md-row md-select="action" md-select-id="id" ng-repeat="action in vm_dc.triggerActions.rows">\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>\r\n            {{ action.id }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>\r\n            {{ \'TOOLS.\' + (action.action | snakecase | uppercase) | translate }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\'" md-cell>\r\n            {{ action.data1 === \'1\' ? \'CTI URL\' : \'Popup\' }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'contactManager\'" md-cell>\r\n            {{ (vm_dc.lists | filter : {\'id\':(action.data1 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'contactManager\'" md-cell>\r\n            {{ action.data2 === \'1\' ? \'TOOLS.YES\' : \'TOOLS.NO\' | uppercase | translate }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'urlForward\'" md-cell>\r\n            {{ action.data1 }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="!action.data1" md-cell>\r\n            {{ action.data1 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="!action.data2" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'urlForward\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'script\' && action.data2" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'script\' && action.data1" md-cell>\r\n            {{ action.data1 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'jscripty\'" md-cell>\r\n            {{ (vm_dc.projects | filter : {\'id\':(action.data1 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\'" md-cell>\r\n            {{ vm_dc.integrationTypes[action.data1] }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'zendesk\'" md-cell>\r\n            {{ (vm_dc.zendeskAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'desk\'" md-cell>\r\n            {{ (vm_dc.deskAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'zoho\'" md-cell>\r\n            {{ (vm_dc.zohoAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'salesforce\'" md-cell>\r\n            {{ (vm_dc.salesforceAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'sugarcrm\'" md-cell>\r\n            {{ (vm_dc.sugarcrmAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'freshdesk\'" md-cell>\r\n            {{ (vm_dc.freshdeskAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'vtiger\'" md-cell>\r\n            {{ (vm_dc.vtigerAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'dynamics365\'" md-cell>\r\n            {{ (vm_dc.dynamics365Accounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'servicenow\'" md-cell>\r\n            {{ (vm_dc.servicenowAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'freshsales\'" md-cell>\r\n            {{ (vm_dc.freshsalesAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\'" md-cell>\r\n            {{ vm_dc.motionBarOptions[action.data1] }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 === \'1\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 === \'2\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 === \'0\'" md-cell>\r\n            {{ (vm_dc.templates | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\' && action.data1 === \'0\'" md-cell>\r\n            {{ (vm_dc.templates | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\' && action.data1 === \'1\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>\r\n            {{ action.createdAt | formatdate }}\r\n          </td>\r\n          <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\r\n            <md-menu>\r\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\r\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\r\n              </md-button>\r\n              <md-menu-content width="3">\r\n                <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\r\n                  <md-button ng-click="vm_dc.createOrEditTriggerAction($event, action)" translate="TOOLS.EDIT_ACTION">\r\n                    Edit Action\r\n                  </md-button>\r\n                </md-menu-item>\r\n                <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\r\n                  <md-button ng-click="vm_dc.deleteConfirm(action, $event)" translate="TOOLS.DELETE_ACTION">\r\n                    Delete Action\r\n                  </md-button>\r\n                </md-menu-item>\r\n              </md-menu-content>\r\n            </md-menu>\r\n          </td>\r\n        </tr>\r\n        <tr md-row ng-if="!vm_dc.triggerActions.rows.length">\r\n          <td md-cell colspan="5">\r\n            <div layout="row" layout-align="center center">\r\n              <span class="text-boxed-light" translate="TOOLS.NO_ACTION_AVAILABLE">No action\r\n                available</span>\r\n            </div>\r\n          </td>\r\n        </tr>\r\n      </tbody>\r\n    </table>\r\n  </md-table-container>\r\n  <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{ vm_dc.triggerActions.count }}" md-on-paginate="vm_dc.getTriggerActions" md-page-select>\r\n  </md-table-pagination>\r\n</div>'),e.put("app/main/apps/tools/views/triggers/edit/actions/create/dialog.html",'<md-dialog class="action-dialog" aria-label="New Action">\n  <form name="actionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newAction ? \'TOOLS.NEW_ACTION\' : \'TOOLS.EDIT_ACTION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.ACTION">Action</label>\n        <md-select name="action" ng-model="vm.action.action" ng-init="vm.onActionInit()" ng-change="vm.onActionSelection()" md-autofocus required ng-disabled="!vm.newAction">\n          <md-option ng-value="\'contactManager\'" ng-if="vm.trigger.channel == \'voice\'">\n            {{ \'TOOLS.CONTACT_MANAGER\' | translate }} </md-option>\n          <md-option ng-value="\'integration\'" ng-if="vm.trigger.channel == \'voice\' && ((vm.newAction && vm.hasIntegrationsPermissions) || !vm.newAction)">\n            {{ \'TOOLS.INTEGRATIONS\' | translate }} </md-option>\n          <md-option ng-value="\'motionbar\'"> {{ \'TOOLS.MOTIONBAR\' | translate }} </md-option>\n          <md-option ng-value="\'jscripty\'"> {{ \'TOOLS.JSCRIPTY\' | translate }} </md-option>\n          <md-option ng-value="\'urlForward\'"> {{ \'TOOLS.URL_FORWARD\' | translate }} </md-option>\n          <md-option ng-value="\'browser\'"> {{ \'TOOLS.BROWSER\' | translate }} </md-option>\n          <md-option ng-value="\'bot\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.BOT\' | translate }} </md-option>\n          <md-option ng-value="\'script\'"> {{ \'TOOLS.SCRIPT\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'action\'].$error" ng-show="actionForm[\'action\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACTION_REQUIRED">Action field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'jscripty\'" class="md-block">\n        <label translate="TOOLS.PROJECT">Project</label>\n        <md-select name="data1" ng-model="vm.action.data1" required>\n          <md-option ng-value="\'\'+data1.id" ng-repeat="data1 in vm.projects" ng-disabled="data1.canSelect === false">\n            {{ data1.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.PROJECT_REQUIRED">Project field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\'" class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-change="vm.onTypeSelection()" required>\n          <md-option ng-value="\'0\'">Popup</md-option>\n          <md-option ng-value="\'1\'">CTI URL</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.LIST">List</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-change="vm.onListSelection()" required>\n          <md-option ng-value="\'\'+data1.id" ng-repeat="data1 in vm.lists" ng-disabled="data1.canSelect === false">\n            {{ data1.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.SEARCH_FIELDS">Search fields</label>\n        <md-select name="fields" ng-model="vm.action.data3" ng-init="vm.onSearchFieldsInit()" multiple required>\n          <md-optgroup label="{{ \'TOOLS.STANDARD\' | translate }}">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.contactFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.LIST\' | translate }}" ng-if="vm.listFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.listFields">\n              {{ field.name }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.GLOBALS\' | translate }}" ng-if="vm.customFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.customFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SEARCH_FIELDS_REQUIRED">Search fields field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.AUTOCREATECONTACT">Create contact automatically</label>\n        <md-select name="data2" ng-model="vm.action.data2" ng-change="vm.onAutocreateSelection()" required>\n          <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n          <md-option ng-value="\'0\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AUTOCREATECONTACT_REQUIRED">AutoCreateContact field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\' && vm.action.data2 === \'1\'" class="md-block">\n        <label translate="TOOLS.AUTOCREATE_FIELD">Autocreate field</label>\n        <md-select name="autocreateField" ng-model="vm.action.data4" ng-required="vm.action.data2 === \'1\'">\n          <md-optgroup label="{{ \'TOOLS.STANDARD\' | translate }}">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.contactFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.LIST\' | translate }}" ng-if="vm.listFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.listFields">\n              {{ field.name }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.GLOBALS\' | translate }}" ng-if="vm.customFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.customFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="actionForm[\'data4\'].$error" ng-show="actionForm[\'data4\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AUTOCREATE_FIELD_REQUIRED">Autocreate field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.IGNOREDIALERCONTACTID">Ignore dialer contact Id</label>\n        <md-select name="data5" ng-model="vm.action.data5" required>\n          <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n          <md-option ng-value="\'0\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data5\'].$error" ng-show="actionForm[\'data5\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.IGNOREDIALERCONTACTID_REQUIRED">Ignore dialer contact Id field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="data1" ng-model="vm.action.data1" required>\n          <md-option ng-value="\'GET\'">GET</md-option>\n          <md-option ng-value="\'POST\'">POST</md-option>\n          <md-option ng-value="\'PUT\'">PUT</md-option>\n          <md-option ng-value="\'DELETE\'">DELETE</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.TIMEOUT">Timeout</label>\n        <input type="number" name="data5" ng-model="vm.action.data5" min="1" max="10" ng-required="true">\n        <div class="hint"><span translate="TOOLS.HELP.TIMEOUT"></span></div>\n        <div ng-messages="actionForm[\'data5\'].$error" ng-show="actionForm[\'data5\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="TOOLS.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n              equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="TOOLS.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n              equal than</span> <span>10</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.HEADERS">Headers</label>\n        <textarea name="data6" ng-model="vm.action.data6"></textarea>\n        <div class="hint"><span translate="TOOLS.HELP.HEADERS"></span></div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\' && (vm.action.data1 == \'POST\' || vm.action.data1 == \'PUT\')" class="md-block">\n        <label translate="TOOLS.BODY">Body</label>\n        <textarea name="data7" ng-model="vm.action.data7"></textarea>\n        <div class="hint"><span translate="TOOLS.HELP.BODY"></span></div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'script\'" class="md-block">\n        <label translate="TOOLS.SCRIPT_TYPE">Script_Type</label>\n        <input type="input" name="data2" ng-model="vm.action.data2">\n        <div class="hint"><span translate="TOOLS.HELP.SCRIPT_TYPE"></span></div>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SCRIPT_TYPE_REQUIRED">Script_Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'script\'" class="md-block">\n        <label translate="TOOLS.SCRIPT_INFO">Script_Info</label>\n        <input type="input" name="data1" ng-model="vm.action.data1">\n        <div class="hint"><span translate="TOOLS.HELP.SCRIPT_INFO"></span></div>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SCRIPT_INFO_REQUIRED">Script_Info field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'script\'" class="md-block">\n        <label translate="TOOLS.SCRIPT">Script</label>\n        <textarea name="data3" ng-model="vm.action.data3" required></textarea>\n        <div class="hint"><span translate="TOOLS.HELP.SCRIPT"></span></div>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SCRIPT_REQUIRED">Script field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'integration\'" class="md-block">\n        <label translate="TOOLS.INTEGRATION">Integration</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-init="vm.onIntegrationInit()" ng-change="vm.onIntegrationSelection()" required>\n          <md-option ng-value="\'desk\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1306]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1306])">Desk</md-option>\n          <md-option ng-value="\'dynamics365\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1309]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1309])">Dynamics365</md-option>\n          <md-option ng-value="\'freshdesk\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1303]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1303])">Freshdesk</md-option>\n          <md-option ng-value="\'freshsales\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1304]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1304])">Freshsales</md-option>\n          <md-option ng-value="\'salesforce\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1302]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1302])">Salesforce</md-option>\n          <md-option ng-value="\'servicenow\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1310]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1310])">ServiceNow</md-option>\n          <md-option ng-value="\'sugarcrm\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1305]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1305])">SugarCRM</md-option>\n          <md-option ng-value="\'vtiger\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1308]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1308])">vTiger</md-option>\n          <md-option ng-value="\'zendesk\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1301]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1301])">Zendesk</md-option>\n          <md-option ng-value="\'zoho\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1307]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1307])">Zoho</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.INTEGRATION_REQUIRED">Integration field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'integration\' && vm.action.data1" class="md-block">\n        <label translate="TOOLS.ACCOUNT">Account</label>\n        <md-select name="data2" ng-model="vm.action.data2" ng-change="vm.onIntegrationAccountSelection()" ng-disabled="vm.action.isIntegrationDisabled" required>\n          <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.accounts">{{ data2.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED">Account field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'integration\'  && vm.action.data1 && vm.action.data2" class="md-block">\n        <label translate="TOOLS.CONFIGURATION">Configuration</label>\n        <md-select name="data3" ng-model="vm.action.data3" required ng-disabled="vm.action.isIntegrationDisabled">\n          <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.configurations | filter : { AccountId: (vm.action.data2 | toInteger) } : true">{{\n            data3.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.CONFIGURATION_REQUIRED">Configuration field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\'" class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-change="vm.onTypeSelection()" required>\n          <md-option ng-value="\'0\'">Popup</md-option>\n          <md-option ng-value="\'1\'">CTI URL</md-option>\n          <md-option ng-value="\'2\'">Windows App</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'2\'" class="md-block">\n        <label translate="TOOLS.APPLICATION">Application</label>\n        <input type="text" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.APPLICATION_REQUIRED">Application field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'2\'" class="md-block">\n        <label translate="TOOLS.ARGUMENTS">Arguments</label>\n        <input type="text" name="data3" ng-model="vm.action.data3">\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ARGUMENTS_REQUIRED">Arguments field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'0\'" class="md-block">\n        <label translate="TOOLS.TEMPLATE">Template</label>\n        <md-select name="data2" ng-model="vm.action.data2" required>\n          <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.templates" ng-disabled="data2.canSelect === false">\n            {{ data2.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TEMPLATE_REQUIRED">Template field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data1 == \'0\'" class="md-block">\n        <label translate="TOOLS.TEMPLATE">Template</label>\n        <md-select name="data2" ng-model="vm.action.data2" required>\n          <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.templates" ng-disabled="data2.canSelect === false">\n            {{ data2.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TEMPLATE_REQUIRED">Template field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="(vm.action.action == \'motionbar\' || vm.action.action == \'browser\') && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.EVENTVARIABLES">EventVariables</label>\n        <md-select name="data3" ng-model="vm.action.data3" required>\n          <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n          <md-option ng-value="\'0\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n        </md-select>\n        <div class="hint"><span translate="TOOLS.HELP.EVENTVARIABLES"></span></div>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EVENTVARIABLES_REQUIRED">EventVariables field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.LOCATION">Location</label>\n        <md-select name="data4" ng-model="vm.action.data4" required ng-change="vm.onActionLocationChange()">\n          <md-option ng-value="0"> {{ \'TOOLS.NEW_TAB\' | translate }} </md-option>\n          <md-option ng-value="1"> {{ \'TOOLS.NEW_WINDOW\' | translate }} </md-option>\n          <md-option ng-value="2"> {{ \'TOOLS.MOTION_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data4\'].$error" ng-show="actionForm[\'data4\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LOCATION_REQUIRED">Location field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data4 == \'1\'" class="md-block">\n        <label translate="TOOLS.WINDOWWIDTH">WindowWidth</label>\n        <input type="text" name="data5" ng-model="vm.action.data5">\n        <div ng-messages="actionForm[\'data5\'].$error" ng-show="actionForm[\'data5\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.WINDOWWIDTH_REQUIRED">WindowWidth field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data4 == \'1\'" class="md-block">\n        <label translate="TOOLS.WINDOWHEIGHT">WindowHeight</label>\n        <input type="text" name="data6" ng-model="vm.action.data6">\n        <div ng-messages="actionForm[\'data6\'].$error" ng-show="actionForm[\'data6\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.WINDOWHEIGHT_REQUIRED">WindowHeight field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAction" ng-click="vm.saveAction()" class="send-button md-accent md-raised" ng-disabled="actionForm.$invalid || actionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAction" ng-click="vm.addNewAction()" class="send-button md-accent md-raised" ng-disabled="actionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_ACTION" translate-attr-aria-label="TOOLS.ADD_ACTION">\n          ADD ACTION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAction" ng-click="vm.deleteAction($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/allconditions/allconditions.html",'<div ng-controller="TriggerAllConditionsController as vm_dc" ng-init="vm_dc.onInit(vm.trigger, vm.crudPermissions)">\n  <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedAllConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="TOOLS.ALLCONDITIONS">All Conditions</span>\n      <ms-search-bar on-search="vm_dc.getAllConditions()" query="vm_dc.query" debounce="300" direction="down">\n      </ms-search-bar>\n      <div flex></div>\n      <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditAllCondition($event)" aria-label="add allCondition" translate translate-attr-label="TOOLS.ADD_ALLCONDITION">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedAllConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead">{{ vm_dc.selectedAllConditions.length }}\n        {{ vm_dc.selectedAllConditions.length > 1 ? \'items\' : \'item\' }} selected</span>\n      <div flex></div>\n      <button class="md-icon-button" ng-csv="vm_dc.exportSelectedAllConditions" csv-label="true" filename="triggers.csv">\n        <md-icon md-font-icon="icon-file-excel"></md-icon>\n      </button>\n      <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedAllConditions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n        <md-icon md-font-icon="icon-delete"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container class="font-size-12">\n    <table md-table md-row-select multiple ng-model="vm_dc.selectedAllConditions" md-progress="vm_dc.promise">\n      <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getAllConditions">\n        <tr md-row>\n          <th md-column md-order-by="id">\n            {{ \'TOOLS.ID\' | translate }}\n          </th>\n          <th md-column md-order-by="field">\n            {{ \'TOOLS.FIELD\' | translate }}\n          </th>\n          <th md-column md-order-by="operator">\n            {{ \'TOOLS.OPERATOR\' | translate }}\n          </th>\n          <th md-column md-order-by="value">\n            {{ \'TOOLS.VALUE\' | translate }}\n          </th>\n          <th md-column md-order-by="createdAt">\n            {{ \'TOOLS.CREATED_AT\' | translate }}\n          </th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row md-select="allCondition" md-select-id="id" ng-repeat="allCondition in vm_dc.allConditions.rows">\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ allCondition.id }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ \'TOOLS.\' + vm_dc.fields[allCondition.field] | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ \'TOOLS.\' + allCondition.operator | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="!allCondition.value" md-cell>\n            {{ allCondition.value }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'chat\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.chatWebsites | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'mail\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.mailAccounts | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'sms\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.smsAccounts | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'whatsapp\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.whatsappAccounts | filter : {\'id\': (allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'fax\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.faxAccounts | filter : {\'id\': (allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'openchannel\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.openchannelAccounts | filter : {\'id\': (allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'queue\'" md-cell>\n            {{ (vm_dc.queues | filter : {\'name\':allCondition.value} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'routeId\'" md-cell>\n            {{ (vm_dc.outboundRoutes | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].exten }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'agent\'" md-cell>\n            {{ (vm_dc.agents | filter : {\'name\':allCondition.value} : true)[0].fullname }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'lastevent\'" md-cell>\n            {{ vm_dc.callStatuses[allCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel != \'voice\' && allCondition.field == \'interaction\'" md-cell>\n            {{ allCondition.value | capitalize }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel != \'voice\' && allCondition.field == \'message\'" md-cell>\n            {{ vm_dc.messageStatuses[allCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'mail\' && allCondition.field == \'mailSubstatus\'" md-cell>\n            {{ allCondition.value === \'null\' ? (\'TOOLS.NONE\' | translate) : (vm_dc.mailSubstatuses | filter : {\'name\': allCondition.value } : true)[0].name }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'chat\' && allCondition.field == \'offlineMessage\'" md-cell>\n            {{allCondition.value}} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ allCondition.createdAt | formatdate }}\n          </td>\n          <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="3">\n                <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                  <md-button ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" translate="TOOLS.EDIT_ALLCONDITION">\n                    Edit AllCondition\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                  <md-button ng-click="vm_dc.deleteConfirm(allCondition, $event)" translate="TOOLS.DELETE_ALLCONDITION">\n                    Delete AllCondition\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n        <tr md-row ng-if="!vm_dc.allConditions.rows.length">\n          <td md-cell colspan="5">\n            <div layout="row" layout-align="center center">\n              <span class="text-boxed-light" translate="TOOLS.NO_ALLCONDITION_AVAILABLE">No condition\n                available</span>\n            </div>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{ vm_dc.allConditions.count }}" md-on-paginate="vm_dc.getAllConditions" md-page-select>\n  </md-table-pagination>\n</div>'),e.put("app/main/apps/tools/views/triggers/edit/allconditions/create/dialog.html",'<md-dialog class="allCondition-dialog" aria-label="New AllCondition">\n  <form name="allConditionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newAllCondition ? \'TOOLS.NEW_ALLCONDITION\' : \'TOOLS.EDIT_ALLCONDITION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.FIELD">Field</label>\n        <md-select name="field" ng-model="vm.allCondition.field" ng-change="vm.onFieldSelection()" md-autofocus required>\n          <md-option ng-value="\'queue\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.QUEUE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'lastevent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.CALL_STATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'routeId\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.OUTBOUNDROUTE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'agent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.AGENT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'account\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.ACCOUNT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'interaction\'" ng-if="vm.trigger.channel != \'voice\'">\n            {{ \'TOOLS.INTERACTION\' | translate }} </md-option>\n          <md-option ng-value="\'message\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.MESSAGE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'mailSubstatus\'" ng-if="vm.trigger.channel == \'mail\'"> {{ \'TOOLS.MAIL_SUBSTATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'offlineMessage\'" ng-if="vm.trigger.channel == \'chat\'"> {{ \'TOOLS.OFFLINE_MESSAGE\' | translate }}\n          </md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'field\'].$error" ng-show="allConditionForm[\'field\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FIELD_REQUIRED">Field field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.OPERATOR">Operator</label>\n        <md-select name="operator" ng-model="vm.allCondition.operator" required>\n          <md-option ng-value="\'equals\'"> {{ \'TOOLS.EQUALS\' | translate }} </md-option>\n          <md-option ng-value="\'not_equals\'"> {{ \'TOOLS.NOT_EQUALS\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'operator\'].$error" ng-show="allConditionForm[\'operator\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OPERATOR_REQUIRED">Operator field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'account\'" class="md-block">\n        <label translate="TOOLS.ACCOUNT">Account</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.accounts" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED">Account field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'queue\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.QUEUE">Queue</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.queues" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'routeId\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.OUTBOUNDROUTE">OutboundRoute</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.outboundRoutes" ng-disabled="value.canSelect === false">\n            {{ value.exten }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OUTBOUNDROUTE_REQUIRED">OutboundRoute field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'agent\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.AGENT">Agent</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.agents" ng-disabled="value.canSelect === false">\n            {{ value.fullname }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'lastevent\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="status.value" ng-repeat="status in vm.callStatuses">\n            {{ status.name }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'mailSubstatus\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="mailSubstatus.name" ng-repeat="mailSubstatus in vm.mailSubstatuses">\n            {{ mailSubstatus.name }}</md-option>\n          <md-option ng-value="\'null\'">{{\'TOOLS.NONE\' | translate}}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'interaction\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="\'opened\'">Opened</md-option>\n          <md-option ng-value="\'closed\'">Closed</md-option>\n          <md-option ng-if="vm.trigger.channel==\'mail\'" ng-value="\'substatus\'">SubStatus</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'message\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="\'in\'">Incoming</md-option>\n          <md-option ng-value="\'out\'">Outgoing</md-option>\n          <md-option ng-value="\'accept\'">Accepted</md-option>\n          <md-option ng-value="\'reject\'">Rejected</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'offlineMessage\' && vm.trigger.channel == \'chat\'" class="md-block">\n        <label translate="TOOLS.CHAT">Chat</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="\'created\'">Created</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAllCondition" ng-click="vm.saveAllCondition()" class="send-button md-accent md-raised" ng-disabled="allConditionForm.$invalid || allConditionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAllCondition" ng-click="vm.addNewAllCondition()" class="send-button md-accent md-raised" ng-disabled="allConditionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_ALLCONDITION" translate-attr-aria-label="TOOLS.ADD_ALLCONDITION">\n          ADD ALLCONDITION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAllCondition" ng-click="vm.deleteAllCondition($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/anyconditions/anyconditions.html",'<div ng-controller="TriggerAnyConditionsController as vm_dc" ng-init="vm_dc.onInit(vm.trigger, vm.crudPermissions)">\n  <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedAnyConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="TOOLS.ANYCONDITIONS">AnyConditions</span>\n      <ms-search-bar on-search="vm_dc.getAnyConditions()" query="vm_dc.query" debounce="300" direction="down"></ms-search-bar>\n      <div flex></div>\n      <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditAnyCondition($event)" aria-label="add anyCondition" translate translate-attr-label="TOOLS.ADD_ANYCONDITION">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedAnyConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead">{{ vm_dc.selectedAnyConditions.length }}\n        {{ vm_dc.selectedAnyConditions.length > 1 ? \'items\' : \'item\' }} selected</span>\n      <div flex></div>\n      <button class="md-icon-button" ng-csv="vm_dc.exportSelectedAnyConditions" csv-label="true" filename="triggers.csv">\n        <md-icon md-font-icon="icon-file-excel"></md-icon>\n      </button>\n      <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedAnyConditions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n        <md-icon md-font-icon="icon-delete"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container class="font-size-12">\n    <table md-table md-row-select multiple ng-model="vm_dc.selectedAnyConditions" md-progress="vm_dc.promise">\n      <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getAnyConditions">\n        <tr md-row>\n          <th md-column md-order-by="id">\n            {{ \'TOOLS.ID\' | translate }}\n          </th>\n          <th md-column md-order-by="field">\n            {{ \'TOOLS.FIELD\' | translate }}\n          </th>\n          <th md-column md-order-by="operator">\n            {{ \'TOOLS.OPERATOR\' | translate }}\n          </th>\n          <th md-column md-order-by="value">\n            {{ \'TOOLS.VALUE\' | translate }}\n          </th>\n          <th md-column md-order-by="createdAt">\n            {{ \'TOOLS.CREATED_AT\' | translate }}\n          </th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row md-select="anyCondition" md-select-id="id" ng-repeat="anyCondition in vm_dc.anyConditions.rows">\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ anyCondition.id}}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ \'TOOLS.\' + vm_dc.fields[anyCondition.field] | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ \'TOOLS.\' + anyCondition.operator | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="!anyCondition.value" md-cell>\n            {{ anyCondition.value }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'chat\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.chatWebsites | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'mail\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.mailAccounts | filter : {\'id\':(anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'sms\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.smsAccounts | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, allCondition)" ng-if="vm.trigger.channel == \'whatsapp\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.whatsappAccounts | filter : {\'id\':(anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'fax\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.faxAccounts | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'openchannel\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.openchannelAccounts | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'queue\'" md-cell>\n            {{ (vm_dc.queues | filter : {\'name\':anyCondition.value} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'routeId\'" md-cell>\n            {{ (vm_dc.outboundRoutes | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].exten }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'agent\'" md-cell>\n            {{ (vm_dc.agents | filter : {\'name\':anyCondition.value} : true)[0].fullname }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'lastevent\'" md-cell>\n            {{ vm_dc.callStatuses[anyCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel != \'voice\' && anyCondition.field == \'interaction\'" md-cell>\n            {{ anyCondition.value | capitalize }} </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel != \'voice\' && anyCondition.field == \'message\'" md-cell>\n            {{ vm_dc.messageStatuses[anyCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'mail\' && anyCondition.field == \'mailSubstatus\'" md-cell>\n            {{ anyCondition.value === \'null\' ? (\'TOOLS.NONE\' | translate) : (vm_dc.mailSubstatuses | filter : {\'name\': anyCondition.value } : true)[0].name }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'chat\' && anyCondition.field == \'offlineMessage\'" md-cell>\n            {{anyCondition.value}} </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ anyCondition.createdAt | formatdate }}\n          </td>\n          <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="3">\n                <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                  <md-button ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" translate="TOOLS.EDIT_ANYCONDITION">\n                    Edit AnyCondition\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                  <md-button ng-click="vm_dc.deleteConfirm(anyCondition, $event)" translate="TOOLS.DELETE_ANYCONDITION">\n                    Delete AnyCondition\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n        <tr md-row ng-if="!vm_dc.anyConditions.rows.length">\n          <td md-cell colspan="5">\n            <div layout="row" layout-align="center center">\n              <span class="text-boxed-light" translate="TOOLS.NO_ANYCONDITION_AVAILABLE">No anycondition\n                available</span>\n            </div>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{ vm_dc.anyConditions.count }}" md-on-paginate="vm_dc.getAnyConditions" md-page-select>\n  </md-table-pagination>\n</div>'),e.put("app/main/apps/tools/views/triggers/edit/anyconditions/create/dialog.html",'<md-dialog class="anyCondition-dialog" aria-label="New AnyCondition">\n  <form name="anyConditionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newAnyCondition ? \'TOOLS.NEW_ANYCONDITION\' : \'TOOLS.EDIT_ANYCONDITION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.FIELD">Field</label>\n        <md-select name="field" ng-model="vm.anyCondition.field" ng-change="vm.onFieldSelection()" md-autofocus required>\n          <md-option ng-value="\'queue\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.QUEUE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'lastevent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.CALL_STATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'routeId\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.OUTBOUNDROUTE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'agent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.AGENT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'account\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.ACCOUNT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'interaction\'" ng-if="vm.trigger.channel != \'voice\'">\n            {{ \'TOOLS.INTERACTION\' | translate }} </md-option>\n          <md-option ng-value="\'message\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.MESSAGE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'mailSubstatus\'" ng-if="vm.trigger.channel == \'mail\'"> {{ \'TOOLS.MAIL_SUBSTATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'offlineMessage\'" ng-if="vm.trigger.channel == \'chat\'"> {{ \'TOOLS.OFFLINE_MESSAGE\' | translate }}\n          </md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'field\'].$error" ng-show="anyConditionForm[\'field\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FIELD_REQUIRED">Field field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.OPERATOR">Operator</label>\n        <md-select name="operator" ng-model="vm.anyCondition.operator" required>\n          <md-option ng-value="\'equals\'"> {{ \'TOOLS.EQUALS\' | translate }} </md-option>\n          <md-option ng-value="\'not_equals\'"> {{ \'TOOLS.NOT_EQUALS\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'operator\'].$error" ng-show="anyConditionForm[\'operator\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OPERATOR_REQUIRED">Operator field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'account\'" class="md-block">\n        <label translate="TOOLS.ACCOUNT">Account</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.accounts" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED">Account field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'queue\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.QUEUE">Queue</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.queues" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'routeId\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.OUTBOUNDROUTE">OutboundRoute</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.outboundRoutes" ng-disabled="value.canSelect === false">\n            {{ value.exten }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OUTBOUNDROUTE_REQUIRED">OutboundRoute field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'agent\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.AGENT">Agent</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.agents" ng-disabled="value.canSelect === false">\n            {{ value.fullname }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'lastevent\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="status.value" ng-repeat="status in vm.callStatuses">\n            {{ status.name }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'mailSubstatus\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="mailSubstatus.name" ng-repeat="mailSubstatus in vm.mailSubstatuses">\n            {{ mailSubstatus.name }}</md-option>\n          <md-option ng-value="\'null\'">{{\'TOOLS.NONE\' | translate}}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'interaction\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="\'opened\'">Opened</md-option>\n          <md-option ng-value="\'closed\'">Closed</md-option>\n          <md-option ng-if="vm.trigger.channel==\'mail\'" ng-value="\'substatus\'">SubStatus</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'message\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="\'in\'">Incoming</md-option>\n          <md-option ng-value="\'out\'">Outgoing</md-option>\n          <md-option ng-value="\'accept\'">Accepted</md-option>\n          <md-option ng-value="\'reject\'">Rejected</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'offlineMessage\' && vm.trigger.channel == \'chat\'" class="md-block">\n        <label translate="TOOLS.CHAT">Chat</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="\'created\'">Created</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAnyCondition" ng-click="vm.saveAnyCondition()" class="send-button md-accent md-raised" ng-disabled="anyConditionForm.$invalid || anyConditionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAnyCondition" ng-click="vm.addNewAnyCondition()" class="send-button md-accent md-raised" ng-disabled="anyConditionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_ANYCONDITION" translate-attr-aria-label="TOOLS.ADD_ANYCONDITION">\n          ADD ANYCONDITION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAnyCondition" ng-click="vm.deleteAnyCondition($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/view.html",'<div id="tools-trigger" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-triggers-button md-icon-button" aria-label="Go to triggers" ng-click="vm.gotoTriggers()" translate translate-attr-aria-label="TOOLS.GO_TO_TRIGGERS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="trigger-image" hide-xs>\n          <img ng-src="assets/images/business/triggers.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">#{{ vm.trigger.id }}\n            <span ng-if="vm.trigger.name">{{ vm.trigger.name }}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{ vm.trigger.createdAt | date:\'medium\' }}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveTrigger()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (allconditionsForm.$invalid) || (anyconditionsForm.$invalid) || (actionsForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trigger-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.trigger.name" required autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CHANNEL">Channel</label>\n                <md-select name="channel" ng-model="vm.trigger.channel" required disabled>\n                  <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n                  <md-option ng-value="\'openchannel\'" ng-if="vm.license.openchannel">\n                    {{ \'TOOLS.OPENCHANNEL\' | translate }} </md-option>\n                  <md-option ng-value="\'chat\'" ng-if="vm.license.chat"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n                  <md-option ng-value="\'mail\'" ng-if="vm.license.mail"> {{ \'TOOLS.MAIL\' | translate }} </md-option>\n                  <md-option ng-value="\'sms\'" ng-if="vm.license.messaging"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n                  <md-option ng-value="\'fax\'" ng-if="vm.license.fax"> {{ \'TOOLS.FAX\' | translate }} </md-option>\n                  <md-option ng-value="\'whatsapp\'" ng-if="vm.license.whatsapp"> {{ \'TOOLS.WHATSAPP\' | translate }}\n                  </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'channel\'].$error" ng-show="generalForm[\'channel\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.trigger.status" aria-label="Status" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="TOOLS.STATUS">Status</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.trigger.description" ng-disabled="!vm.crudPermissions.canEdit">\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.CONDITIONS&ACTIONS">CONDITIONS&ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trigger-detail-form-container allconditions md-background-bg md-whiteframe-1dp" ng-include="\'app/main/apps/tools/views/triggers/edit/allconditions/allconditions.html\'">\n          </div>\n          <div class="trigger-detail-form-container anyconditions md-background-bg md-whiteframe-1dp" ng-include="\'app/main/apps/tools/views/triggers/edit/anyconditions/anyconditions.html\'">\n          </div>\n          <div class="trigger-detail-form-container actions md-background-bg md-whiteframe-1dp" ng-include="\'app/main/apps/tools/views/triggers/edit/actions/actions.html\'">\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/tools/views/triggers/triggers.html",'<div id="triggers" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TRIGGERS">Triggers</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTriggers.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedTriggers =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-triggers-count">\n          <span>{{ vm.selectedTriggers.length }}</span>\n          <span translate="TOOLS.SELECTED">Selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTriggers()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTriggers()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTriggers" csv-label="true" filename="triggers.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTriggers($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      \x3c!-- TRIGGER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTriggers" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTriggers">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="channel">{{ \'TOOLS.CHANNEL\' | translate }}</th>\n                <th md-column md-order-by="status">{{ \'TOOLS.STATUS\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.triggers.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="trigger" md-select-id="id" ng-repeat="trigger in vm.triggers.rows">\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="id ">{{ trigger.id }}</td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="name ">{{ trigger.name }}</td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="channel ">\n                  {{ \'TOOLS.\' + trigger.channel | uppercase | translate }}</td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="status ">\n                  <md-icon md-colors="{color: {{ trigger.status ? \'\\\'green\\\'\' : \'\\\'grey\\\'\' }}}" md-font-icon="{{ trigger.status ? \'icon-check\' : \'icon-close\' }}"></md-icon>\n                </td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="description ">\n                  {{ trigger.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.goToEditState(trigger)" translate="TOOLS.EDIT_TRIGGER">\n                          Edit Trigger\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(trigger, $event)" translate="TOOLS.DELETE_TRIGGER">\n                          Delete Trigger\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.triggers.count }}" md-on-paginate="vm.getTriggers" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TRIGGER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n  \x3c!-- ADD TRIGGER BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-trigger-button" ng-click="vm.createOrEditTrigger($event)" aria-label="add trigger" translate translate-attr-aria-label="TOOLS.ADD_TRIGGER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TRIGGER BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/trunks/create/dialog.html",'<md-dialog class="trunk-dialog" aria-label="New Trunk">\n  <form name="trunkForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.trunk.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newTrunk">\n\n        <div class="hint"><span translate="TOOLS.HELP.NAME"></span></div>\n        <div ng-messages="trunkForm[\'name\'].$error" ng-show="trunkForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.trunk.active" aria-label="active"><span translate="TOOLS.ACTIVE">active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.HOST">host</label>\n        <input type="text" name="host" ng-model="vm.trunk.host" ng-required="true">\n\n        <div class="hint"><span translate="TOOLS.HELP.HOST"></span></div>\n        <div ng-messages="trunkForm[\'host\'].$error" ng-show="trunkForm[\'host\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.HOST_REQUIRED">host field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.SECRET">secret</label>\n        <input type="password" name="secret" ng-model="vm.trunk.secret" placeholder="Password" translate translate-attr-placeholder="TOOLS.PASSWORD">\n        <div class="hint"><span translate="TOOLS.HELP.SECRET"></span></div>\n        <div ng-messages="trunkForm[\'secret\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DEFAULTUSER">defaultuser</label>\n        <input type="text" name="defaultuser" ng-model="vm.trunk.defaultuser">\n\n        <div class="hint"><span translate="TOOLS.HELP.DEFAULTUSER"></span></div>\n        <div ng-messages="trunkForm[\'defaultuser\'].$error" ng-show="trunkForm[\'defaultuser\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DEFAULTUSER_REQUIRED">defaultuser field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.REGISTRY">registry</label>\n        <input type="text" name="registry" ng-model="vm.trunk.registry">\n\n        <div class="hint"><span translate="TOOLS.HELP.REGISTRY"></span></div>\n        <div ng-messages="trunkForm[\'registry\'].$error" ng-show="trunkForm[\'registry\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REGISTRY_REQUIRED">registry field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.trunk.description">\n\n        <div ng-messages="trunkForm[\'description\'].$error" ng-show="trunkForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTrunk" ng-click="vm.saveTrunk()" class="send-button md-accent md-raised" ng-disabled="trunkForm.$invalid || trunkForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTrunk" ng-click="vm.addNewTrunk()" class="send-button md-accent md-raised" ng-disabled="trunkForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TRUNK" translate-attr-aria-label="TOOLS.ADD_TRUNK">\n          ADD TRUNK\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTrunk" ng-click="vm.deleteTrunk($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/trunks/edit/clone/clone.html",'<md-dialog class="trunk-dialog" aria-label="Clone Trunk">\n  <form name="trunkForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.trunk.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newTrunk">\n\n        <div class="hint"><span translate="TOOLS.HELP.NAME"></span></div>\n        <div ng-messages="trunkForm[\'name\'].$error" ng-show="trunkForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.trunk.active" aria-label="active"><span translate="TOOLS.ACTIVE">active</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneTrunk()" class="send-button md-accent md-raised" ng-disabled="trunkForm.$invalid" aria-label="CLONE" translate="TOOLS.CLONE_TRUNK" translate-attr-aria-label="TOOLS.CLONE_TRUNK">\n        CLONE TRUNK\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/trunks/edit/view.html",'<div id="tools-trunk" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-trunks-button md-icon-button" aria-label="Go to trunks" ng-click="vm.gotoTrunks()" translate translate-attr-aria-label="TOOLS.GO_TO_TRUNKS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="trunk-image" hide-xs>\n          <img ng-src="assets/images/business/trunks.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.trunk.id}}\n            <span ng-if="vm.trunk.name">{{vm.trunk.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{vm.trunk.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.trunk, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="TOOLS.GOTO_TRUNK"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.trunk, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="TOOLS.CLONE_TRUNK"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveTrunk()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (advancedForm.$invalid) || (otherFieldsForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trunk-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.trunk.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="TOOLS.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="TOOLS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.trunk.active" aria-label="active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="TOOLS.ACTIVE">active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.HOST">host</label>\n                <input type="text" name="host" ng-model="vm.trunk.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.HOST"></span></div>\n                <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.HOST_REQUIRED">host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.SECRET">secret</label>\n                <input type="password" name="secret" ng-model="vm.trunk.secret" placeholder="Password" translate translate-attr-placeholder="TOOLS.PASSWORD">\n                <div class="hint"><span translate="TOOLS.HELP.SECRET"></span></div>\n                <div ng-messages="generalForm[\'secret\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="TOOLS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DEFAULTUSER">defaultuser</label>\n                <input type="text" name="defaultuser" ng-model="vm.trunk.defaultuser" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.DEFAULTUSER"></span></div>\n                <div ng-messages="generalForm[\'defaultuser\'].$error" ng-show="generalForm[\'defaultuser\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DEFAULTUSER_REQUIRED">defaultuser field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CONTEXT">context</label>\n                <md-select name="context" ng-model="vm.trunk.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.CONTEXT"></span></div>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CONTEXT_REQUIRED">context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CALLERID">callerid</label>\n                <input type="text" name="callerid" ng-model="vm.trunk.callerid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.CALLERID"></span></div>\n                <div ng-messages="generalForm[\'callerid\'].$error" ng-show="generalForm[\'callerid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CALLERID_REQUIRED">callerid field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.trunk.type" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'friend\'">Friend</md-option>\n                  <md-option ng-value="\'user\'">User</md-option>\n                  <md-option ng-value="\'peer\'">Peer</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.TYPE"></span></div>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DTMFMODE">dtmfmode</label>\n                <md-select name="dtmfmode" ng-model="vm.trunk.dtmfmode" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'rfc2833\'">rfc2833</md-option>\n                  <md-option ng-value="\'info\'">info</md-option>\n                  <md-option ng-value="\'shortinfo\'">shortinfo</md-option>\n                  <md-option ng-value="\'inband\'">inband</md-option>\n                  <md-option ng-value="\'auto\'">auto</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.DTMFMODE"></span></div>\n                <div ng-messages="generalForm[\'dtmfmode\'].$error" ng-show="generalForm[\'dtmfmode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DTMFMODE_REQUIRED">dtmfmode field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAT">nat</label>\n                <md-select name="nat" ng-model="vm.trunk.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAT_REQUIRED">nat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.QUALIFY">qualify</label>\n                <md-select name="qualify" ng-model="vm.trunk.qualify" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.QUALIFY"></span></div>\n                <div ng-messages="generalForm[\'qualify\'].$error" ng-show="generalForm[\'qualify\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.QUALIFY_REQUIRED">qualify field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.trunk.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g723\'">g723</md-option>\n                  <md-option ng-value="\'g726\'">g726</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'ilbc\'">ilbc</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.INSECURE">insecure</label>\n                <md-select name="insecure" ng-model="vm.trunk.insecure" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'port\'">port</md-option>\n                  <md-option ng-value="\'invite\'">invite</md-option>\n                  <md-option ng-value="\'very\'">very</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.INSECURE"></span></div>\n                <div ng-messages="generalForm[\'insecure\'].$error" ng-show="generalForm[\'insecure\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.INSECURE_REQUIRED">insecure field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CALL_LIMIT">call_limit</label>\n                <input type="number" name="call_limit" ng-model="vm.trunk.call_limit" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.CALL_LIMIT"></span></div>\n                <div ng-messages="generalForm[\'call_limit\'].$error" ng-show="generalForm[\'call_limit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CALL_LIMIT_REQUIRED">call_limit field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.trunk.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trunk-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.REGISTRY">registry</label>\n                <input type="text" name="registry" ng-model="vm.trunk.registry" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.REGISTRY"></span></div>\n                <div ng-messages="advancedForm[\'registry\'].$error" ng-show="advancedForm[\'registry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.REGISTRY_REQUIRED">registry field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DIRECTMEDIA">directmedia</label>\n                <md-select name="directmedia" ng-model="vm.trunk.directmedia" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'nonat\'">nonat</md-option>\n                  <md-option ng-value="\'update\'">update</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.DIRECTMEDIA"></span></div>\n                <div ng-messages="advancedForm[\'directmedia\'].$error" ng-show="advancedForm[\'directmedia\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DIRECTMEDIA_REQUIRED">directmedia field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CALLCOUNTER">callcounter</label>\n                <md-select name="callcounter" ng-model="vm.trunk.callcounter" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.CALLCOUNTER"></span></div>\n                <div ng-messages="advancedForm[\'callcounter\'].$error" ng-show="advancedForm[\'callcounter\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CALLCOUNTER_REQUIRED">callcounter field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.FROMDOMAIN">fromdomain</label>\n                <input type="text" name="fromdomain" ng-model="vm.trunk.fromdomain" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.FROMDOMAIN"></span></div>\n                <div ng-messages="advancedForm[\'fromdomain\'].$error" ng-show="advancedForm[\'fromdomain\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.FROMDOMAIN_REQUIRED">fromdomain field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.FROMUSER">fromuser</label>\n                <input type="text" name="fromuser" ng-model="vm.trunk.fromuser" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.FROMUSER"></span></div>\n                <div ng-messages="advancedForm[\'fromuser\'].$error" ng-show="advancedForm[\'fromuser\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.FROMUSER_REQUIRED">fromuser field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.OUTBOUNDPROXY">outboundproxy</label>\n                <input type="text" name="outboundproxy" ng-model="vm.trunk.outboundproxy" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.OUTBOUNDPROXY"></span></div>\n                <div ng-messages="advancedForm[\'outboundproxy\'].$error" ng-show="advancedForm[\'outboundproxy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.OUTBOUNDPROXY_REQUIRED">outboundproxy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.ADD_PHONE_TO_URI">Add_phone_to_URI</label>\n                <md-select name="usereqphone" ng-model="vm.trunk.usereqphone" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.ADD_PHONE_TO_URI"></span></div>\n                <div ng-messages="advancedForm[\'usereqphone\'].$error" ng-show="advancedForm[\'usereqphone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.ADD_PHONE_TO_URI_REQUIRED">Add_phone_to_URI field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.TRUST_REMOTE_PARTY_ID">Trust_Remote_Party_ID</label>\n                <md-select name="trustrpid" ng-model="vm.trunk.trustrpid" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.TRUST_REMOTE_PARTY_ID"></span></div>\n                <div ng-messages="advancedForm[\'trustrpid\'].$error" ng-show="advancedForm[\'trustrpid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.TRUST_REMOTE_PARTY_ID_REQUIRED">Trust_Remote_Party_ID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.SEND_REMOTE_PARTY_ID_HEADER">Send_Remote_Party_ID_header</label>\n                <md-select name="sendrpid" ng-model="vm.trunk.sendrpid" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n\n                  <md-option ng-value="\'pai\'"> {{ \'TOOLS.PAI\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.SEND_REMOTE_PARTY_ID_HEADER"></span></div>\n                <div ng-messages="advancedForm[\'sendrpid\'].$error" ng-show="advancedForm[\'sendrpid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.SEND_REMOTE_PARTY_ID_HEADER_REQUIRED">Send_Remote_Party_ID_header field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.ENCRYPTION">encryption</label>\n                <md-select name="encryption" ng-model="vm.trunk.encryption" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.ENCRYPTION"></span></div>\n                <div ng-messages="advancedForm[\'encryption\'].$error" ng-show="advancedForm[\'encryption\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.ENCRYPTION_REQUIRED">encryption field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.PORT">port</label>\n                <input type="number" name="port" ng-model="vm.trunk.port" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.PORT"></span></div>\n                <div ng-messages="advancedForm[\'port\'].$error" ng-show="advancedForm[\'port\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.PORT_REQUIRED">port field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.trunk.transport" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'">ws</md-option>\n                  <md-option ng-value="\'wss\'">wss</md-option>\n                  <md-option ng-value="\'tls\'">tls</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.TRANSPORT"></span></div>\n                <div ng-messages="advancedForm[\'transport\'].$error" ng-show="advancedForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.T38PT_UDPTL">t38pt_udptl</label>\n                <input type="string" name="t38pt_udptl" ng-model="vm.trunk.t38pt_udptl" value="no" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.T38PT_UDPTL"></span></div>\n                <div ng-messages="advancedForm[\'t38pt_udptl\'].$error" ng-show="advancedForm[\'t38pt_udptl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.T38PT_UDPTL_REQUIRED">t38pt_udptl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.trunk.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'videosupport\'].$error" ng-show="advancedForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.OTHERFIELDS">OTHERFIELDS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trunk-detail-form-container otherfields md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.OTHERFIELDS">OTHERFIELDS</div>\n            </div>\n            <form name="otherFieldsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.OTHERFIELDS">otherFields</label>\n                <textarea name="otherFields" ng-model="vm.trunk.otherFields" autofocus></textarea>\n                <div class="hint"><span translate="TOOLS.HELP.OTHERFIELDS"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/tools/views/trunks/trunks.html",'<div id="trunks" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TRUNKS">Trunks</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTrunks.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTrunks =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-trunks-count">\n          <span>{{vm.selectedTrunks.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTrunks()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTrunks()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTrunks" csv-label="true" filename="trunks.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTrunks($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TRUNK TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTrunks" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTrunks">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'TOOLS.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="host">{{ \'TOOLS.HOST\' | translate }}</th>\n                <th md-column md-order-by="registry">{{ \'TOOLS.REGISTRY\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.trunks.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="trunk" md-select-id="id" ng-repeat="trunk in vm.trunks.rows">\n                <td md-cell ng-if="trunk.userpic"><img class="avatar" alt="{{trunk.name}}" ng-src="api/users/{{trunk.id}}/avatar" /></td>\n                <td md-cell ng-if="!trunk.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{trunk.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="id ">{{trunk.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="name ">{{trunk.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{trunk.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{trunk.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="host ">{{trunk.host}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="registry ">{{trunk.registry}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="description ">{{trunk.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(trunk, $event    )" translate="TOOLS.EDIT_TRUNK">\n                          Edit Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(trunk, $event    )" translate="TOOLS.CLONE_TRUNK">\n                          clone Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(trunk, $event    )" translate="TOOLS.GOTOREALTIME_TRUNK">\n                          goToRealtime Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(trunk, $event    )" translate="TOOLS.DELETE_TRUNK">\n                          Delete Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.trunks.count}}" md-on-paginate="vm.getTrunks" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TRUNK TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TRUNK BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-trunk-button" ng-click="vm.createOrEditTrunk($event)" aria-label="add trunk" translate translate-attr-aria-label="TOOLS.ADD_TRUNK">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TRUNK BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/variables/create/dialog.html",'<md-dialog class="variable-dialog" aria-label="New Variable">\n  <form name="variableForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.variable.name" ng-required="true" autofocus>\n\n        <div ng-messages="variableForm[\'name\'].$error" ng-show="variableForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.variable.description">\n\n        <div ng-messages="variableForm[\'description\'].$error" ng-show="variableForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVariable" ng-click="vm.saveVariable()" class="send-button md-accent md-raised" ng-disabled="variableForm.$invalid || variableForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVariable" ng-click="vm.addNewVariable()" class="send-button md-accent md-raised" ng-disabled="variableForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_VARIABLE" translate-attr-aria-label="TOOLS.ADD_VARIABLE">\n          ADD VARIABLE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVariable" ng-click="vm.deleteVariable($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/variables/variables.html",'<div id="variables" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.VARIABLES">Variables</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVariables.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVariables =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-variables-count">\n          <span>{{vm.selectedVariables.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVariables()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVariables()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVariables" csv-label="true" filename="variables.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVariables($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VARIABLE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVariables" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVariables">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.variables.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="variable" md-select-id="id" ng-repeat="variable in vm.variables.rows">\n                <td md-cell ng-if="variable.userpic"><img class="avatar" alt="{{variable.name}}" ng-src="api/users/{{variable.id}}/avatar" /></td>\n                <td md-cell ng-if="!variable.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{variable.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditVariable($event, variable)" md-cell class="id ">{{variable.id}}</td>\n                <td ng-click="vm.createOrEditVariable($event, variable)" md-cell class="name ">{{variable.name}}</td>\n                <td ng-click="vm.createOrEditVariable($event, variable)" md-cell class="description ">{{variable.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(variable, $event    )" translate="TOOLS.EDIT_VARIABLE">\n                          Edit Variable\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(variable, $event    )" translate="TOOLS.DELETE_VARIABLE">\n                          Delete Variable\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.variables.count}}" md-on-paginate="vm.getVariables" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VARIABLE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VARIABLE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-variable-button" ng-click="vm.createOrEditVariable($event)" aria-label="add variable" translate translate-attr-aria-label="TOOLS.ADD_VARIABLE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VARIABLE BUTTON --\x3e\n</div>'),e.put("app/main/apps/video/views/screenRecordings/create/dialog.html",'<md-dialog class="screenRecording-dialog" aria-label="New screenRecording">\n  <form name="screenRecordingForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VIDEO.RATING">Rating</label>\n        <md-select name="rating" ng-model="vm.screenRecording.rating" autofocus ng-disabled="!vm.newscreenRecording && !vm.crudPermissions.canEdit">\n          <md-option ng-value="null">{{\'VIDEO.NO_RATING\' | translate}}</md-option>\n          <md-option value="1">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1]"></md-icon>\n          </md-option>\n          <md-option value="2">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2]"></md-icon>\n          </md-option>\n          <md-option value="3">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3]"></md-icon>\n          </md-option>\n          <md-option value="4">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4]"></md-icon>\n          </md-option>\n          <md-option value="5">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4,5]"></md-icon>\n          </md-option>\n        </md-select>\n        <div ng-messages="screenRecordingForm[\'rating\'].$error" ng-show="screenRecordingForm[rating].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VIDEO.ERRORS.RATING_REQUIRED">Rating field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newscreenRecording" ng-click="vm.savescreenRecording()" class="send-button md-accent md-raised" ng-disabled="screenRecordingForm.$invalid || screenRecordingForm.$pristine" aria-label="SAVE" translate="VIDEO.SAVE" translate-attr-aria-label="VIDEO.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newscreenRecording" ng-click="vm.addNewscreenRecording()" class="send-button md-accent md-raised" ng-disabled="screenRecordingForm.$invalid" aria-label="ADD" translate="VIDEO.ADD_SCREENRECORDING" translate-attr-aria-label="VIDEO.ADD_SCREENRECORDING">\n          ADD SCREENRECORDING\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newscreenRecording" ng-click="vm.deletescreenRecording($event)" aria-label="DELETE" translate translate-attr-aria-label="VIDEO.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VIDEO.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/video/views/screenRecordings/partialViews/play.html",'<md-dialog class="play-dialog" aria-label="play">\n  <form name="playForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="{{ vm.app.toUpperCase() }}.{{  vm.label.toUpperCase() }}">Play Recording</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-disabled="vm.loading" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-hide="vm.loading">\n      <div layout="row" layout-sm flex>\n        \x3c!-- VIRTUAL field --\x3e\n        <md-card>\n\n          <md-card-title ng-if="vm.actionOptions.upperTitle">\n            <md-card-title-text>\n              <span class="md-headline">{{ vm.filename }}</span>\n              <span class="md-subhead"><span translate="{{ vm.app.toUpperCase() }}.UPDATEDAT"></span>: {{ vm.recording.updatedAt}}</span>\n            </md-card-title-text>\n          </md-card-title>\n\n          \x3c!-- video recording directive --\x3e\n          <ms-dialog-recording ng-if="vm.format" id="vm.recording.id" title="vm.filename" element="vm.element" model="vm.route" path="vm.path" class="md-card-image"></ms-dialog-recording>\n          \x3c!-- / video recording directive --\x3e\n\n          <span ng-if="!vm.format">\n            <em ng-if="vm.found">{{ vm.app.toUpperCase() + \'.CANT_PLAY_THIS_FILE\' | translate }}</em>\n            <em ng-if="!vm.found">{{ vm.app.toUpperCase() + \'.FILE_NOT_FOUND\' | translate }}</em>\n          </span>\n\n          <md-card-title ng-if="vm.actionOptions.lowerTitle">\n            <md-card-title-text>\n              <span class="md-headline">{{ vm.filename }}</span>\n              <span class="md-subhead"><span translate="{{ vm.app.toUpperCase() }}.UPDATEDAT"></span>:{{ vm.recording.updatedAt}}</span>\n              <span ng-if="vm.actionOptions.properties" class="md-subhead"><span translate="{{ vm.app.toUpperCase() }}.PROPERTIES"></span>:</span>\n            </md-card-title-text>\n          </md-card-title>\n\n          <md-card-content ng-if="vm.actionOptions.properties">\n            <md-list>\n              <md-list-item class="md-2-line" ng-repeat="(key,value) in vm.properties" ng-click="null" ng-if="key != \'value\' && key != \'updatedAt\' && key != \'queue\'">\n\n                <md-icon ng-if="vm.icon" class="md-avatar-icon" md-font-icon="vm.actionOptions.propertiesIcon" class="s24"></md-icon>\n\n                <div class="md-list-item-text" layout="column">\n                  <p><b><span translate="{{ vm.app.toUpperCase() }}.{{ key.toUpperCase() }}"></span></b></p>\n                  <p>{{ value }}\n                    <p>\n                </div>\n              </md-list-item>\n            </md-list>\n          </md-card-content>\n\n\n        </md-card>\n      </div>\n    </md-dialog-content>\n    <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n      <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n    </div>\n  </form>\n</md-dialog>'),e.put("app/main/apps/video/views/screenRecordings/screenRecordings.html",'<div id="screenRecordings" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-video" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VIDEO.SCREENRECORDINGS">ScreenRecordings</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VIDEO.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getScreenRecordings()"></ms-quick-filter>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedScreenRecordings.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedScreenRecordings =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VIDEO.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-screenRecordings-count">\n          <span>{{vm.selectedScreenRecordings.length}}</span>\n          <span translate="VIDEO.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VIDEO.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllScreenRecordings()" translate="VIDEO.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectScreenRecordings()" translate="VIDEO.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedScreenRecordings" csv-label="true" filename="screenRecordings.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedScreenRecordings($event)" aria-label="delete selected" translate translate-attr-label="VIDEO.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SCREENRECORDING TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedScreenRecordings" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getScreenRecordings">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VIDEO.ID\' | translate }}</th>\n                <th md-column md-order-by="rating">{{ \'VIDEO.RATING\' | translate }}</th>\n                <th md-column md-order-by="UserId">{{ \'VIDEO.AGENT\' | translate }}</th>\n                <th md-column md-order-by="duration">{{ \'VIDEO.DURATION\' | translate }}</th>\n                <th md-column md-order-by="startedAt">{{ \'VIDEO.RECORDSTARTTIME\' | translate }}</th>\n                <th md-column md-order-by="closedAt">{{ \'VIDEO.RECORDENDTIME\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.screenRecordings.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VIDEO.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="screenRecording" md-select-id="id" ng-repeat="screenRecording in vm.screenRecordings.rows">\n                <td md-cell ng-if="screenRecording.userpic"><img class="avatar" alt="{{screenRecording.name}}" ng-src="api/users/{{screenRecording.id}}/avatar" /></td>\n                <td md-cell ng-if="!screenRecording.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{screenRecording.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="id ">{{screenRecording.id}}</td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="rating ">\n                  <md-icon md-font-icon="icon-star" style="color:red" ng-show="screenRecording.rating" ng-repeat="rating in [1,2,3,4,5] | limitTo:screenRecording.rating"></md-icon><span ng-hide="screenRecording.rating" translate="VIDEO.NO_RATING">No rating</span>\n                </td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="UserId ">{{ (vm.users | filter : {\'id\':screenRecording.UserId} : true)[0].fullname }}</td>\n                <td md-cell><span ng-bind="vm.convertDuration(screenRecording.duration)"></span></td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="startedAt ">{{screenRecording.startedAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="closedAt ">{{screenRecording.closedAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VIDEO.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.playrecording(screenRecording, $event  , \'value\'  , \'play_screenrecording\'  , \'video\' )" translate="VIDEO.PLAY_SCREENRECORDING">\n                          play screenRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadScreenRecordings">\n\n                        <md-button ng-click="vm.downloadfile2(screenRecording, $event  , \'screen/recordings\'   )" translate="VIDEO.DOWNLOAD_SCREENRECORDING">\n                          Download screenRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(screenRecording, $event    )" translate="VIDEO.DELETE_SCREENRECORDING">\n                          Delete screenRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VIDEO.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VIDEO.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VIDEO.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.screenRecordings.count}}" md-on-paginate="vm.getScreenRecordings" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SCREENRECORDING TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/routing/dialog.html",'<md-dialog ng-init="vm.init()" class="voice-routing-dialog" aria-label="New routing application">\n  <form name="routingAppForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'VOICE.EDIT_\' + vm.application.appType | uppercase | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-switch="vm.application.appType">\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div ng-switch-when="agi">\n        <div ng-include="\'app/main/apps/voice/routing/views/agi.html\'"></div>\n      </div>\n      <div ng-switch-when="custom">\n        <div ng-include="\'app/main/apps/voice/routing/views/custom.html\'"></div>\n      </div>\n      <div ng-switch-when="dial">\n        <div ng-include="\'app/main/apps/voice/routing/views/dial.html\'"></div>\n      </div>\n      <div ng-switch-when="externalDial">\n        <div ng-include="\'app/main/apps/voice/routing/views/externalDial.html\'"></div>\n      </div>\n      <div ng-switch-when="goTo">\n        <div ng-include="\'app/main/apps/voice/routing/views/goTo.html\'"></div>\n      </div>\n      <div ng-switch-when="hangup">\n        <div ng-include="\'app/main/apps/voice/routing/views/hangup.html\'"></div>\n      </div>\n      <div ng-switch-when="internalDial">\n        <div ng-include="\'app/main/apps/voice/routing/views/internalDial.html\'"></div>\n      </div>\n      <div ng-switch-when="outboundDial">\n        <div ng-include="\'app/main/apps/voice/routing/views/outboundDial.html\'"></div>\n      </div>\n      <div ng-switch-when="playback">\n        <div ng-include="\'app/main/apps/voice/routing/views/playback.html\'"></div>\n      </div>\n      <div ng-switch-when="queue">\n        <div ng-include="\'app/main/apps/voice/routing/views/queue.html\'"></div>\n      </div>\n      <div ng-switch-when="ringGroup">\n        <div ng-include="\'app/main/apps/voice/routing/views/ringGroup.html\'"></div>\n      </div>\n      <div ng-switch-when="set">\n        <div ng-include="\'app/main/apps/voice/routing/views/set.html\'"></div>\n      </div>\n      <div ng-switch-when="voicemail">\n        <div ng-include="\'app/main/apps/voice/routing/views/voicemail.html\'"></div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveRoutingApp()" class="send-button md-accent md-raised" ng-disabled="routingAppForm.$invalid || routingAppForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/routing/interval/dialog.html",'<md-dialog ng-init="vm.initialize()" class="interval-dialog" aria-label="Edit Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'TOOLS.EDIT_INTERVAL\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.crudPermissions.canEdit" ng-change="vm.onTypeChange()">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | startcase }}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.crudPermissions.canEdit" required>\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals.rows" ng-disabled="interval.canSelect === false">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | startcase }}</span></md-option>\n          </md-select>\n        </md-input-container>\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | startcase }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | startcase }}</span></md-option>\n          </md-select>\n        </md-input-container>\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | startcase }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="start center">\n      <md-button type="submit" ng-if="vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/routing/views/agi.html",'<md-input-container class="md-block">\n  <label translate="VOICE.PROJECT">Project</label>\n  <md-select name="project" ng-model="vm.application.project" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'agi://127.0.0.1/square,{{project.name}}\'" ng-repeat="project in vm.projects.rows" ng-disabled="project.canSelect === false">{{ project.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'project\'].$error" ng-show="routingAppForm[\'project\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PROJECT_REQUIRED">Project field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/custom.html",'<md-input-container class="md-block">\n  <label translate="VOICE.APPLICATION_NAME">Application_Name</label>\n  <input type="text" name="app" ng-model="vm.application.app" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'app\'].$error" ng-show="routingAppForm[\'app\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.APPLICATION_NAME_REQUIRED">Application_Name field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.ARGUMENTS">Arguments</label>\n  <input type="text" name="appdata" ng-model="vm.application.appdata" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'appdata\'].$error" ng-show="routingAppForm[\'appdata\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.ARGUMENTS_REQUIRED">Arguments field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/dial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.TECHNOLOGY/RESOURCE">Technology/Resource</label>\n  <input type="text" name="tech" ng-model="vm.application.tech" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'tech\'].$error" ng-show="routingAppForm[\'tech\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TECHNOLOGY/RESOURCE_REQUIRED">Technology/Resource field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/externalDial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.TRUNK">Trunk</label>\n  <md-select name="trunk" ng-model="vm.application.trunk" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="trunk.name" ng-repeat="trunk in vm.trunks.rows" ng-disabled="trunk.canSelect === false">{{\n      trunk.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'trunk\'].$error" ng-show="routingAppForm[\'trunk\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.PHONE">Phone</label>\n  <input type="text" name="phone" ng-model="vm.application.phone" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'phone\'].$error" ng-show="routingAppForm[\'phone\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/goTo.html",'<md-input-container class="md-block">\n  <label translate="VOICE.CONTEXT">Context</label>\n  <md-select name="context" ng-model="vm.application.context" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{\n      context.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'context\'].$error" ng-show="routingAppForm[\'context\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.EXTENSION">Extension</label>\n  <input type="text" name="extension" ng-model="vm.application.extension" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'extension\'].$error" ng-show="routingAppForm[\'extension\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.EXTENSION_REQUIRED">Extension field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.PRIORITY">Priority</label>\n  <input type="text" name="priority" ng-model="vm.application.priority" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'priority\'].$error" ng-show="routingAppForm[\'priority\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/hangup.html","<md-input-container class=\"md-block\">\n  <label translate=\"VOICE.HANGUP_CAUSE\">Hangup_Cause</label>\n  <md-select name=\"appdata\" ng-model=\"vm.application.appdata\" autofocus required ng-disabled=\"!vm.crudPermissions.canEdit\">\n    <md-option ng-value=\"'1'\"> {{ 'VOICE.HANGUPCAUSE_1' | translate }} </md-option>\n    <md-option ng-value=\"'16'\"> {{ 'VOICE.HANGUPCAUSE_16' | translate }} </md-option>\n    <md-option ng-value=\"'17'\"> {{ 'VOICE.HANGUPCAUSE_17' | translate }} </md-option>\n    <md-option ng-value=\"'18'\"> {{ 'VOICE.HANGUPCAUSE_18' | translate }} </md-option>\n    <md-option ng-value=\"'21'\"> {{ 'VOICE.HANGUPCAUSE_21' | translate }} </md-option>\n    <md-option ng-value=\"'22'\"> {{ 'VOICE.HANGUPCAUSE_22' | translate }} </md-option>\n    <md-option ng-value=\"'27'\"> {{ 'VOICE.HANGUPCAUSE_27' | translate }} </md-option>\n    <md-option ng-value=\"'38'\"> {{ 'VOICE.HANGUPCAUSE_38' | translate }} </md-option>\n    <md-option ng-value=\"'41'\"> {{ 'VOICE.HANGUPCAUSE_41' | translate }} </md-option>\n  </md-select>\n  <div ng-messages=\"routingAppForm['appdata'].$error\" ng-show=\"routingAppForm['appdata'].$touched\" role=\"alert\">\n    <div ng-message=\"required\">\n      <span translate=\"VOICE.ERRORS.HANGUP_CAUSE_REQUIRED\">Hangup_Cause field is required</span>\n    </div>\n  </div>\n</md-input-container>"),e.put("app/main/apps/voice/routing/views/internalDial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.USER">User</label>\n  <md-select name="user" ng-model="vm.application.user" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'SIP/{{user.name}}\'" ng-repeat="user in vm.users.rows" ng-disabled="user.canSelect === false">\n      {{ user.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'user\'].$error" ng-show="routingAppForm[\'user\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.USER_REQUIRED">User field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/outboundDial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.TRUNK">Trunk</label>\n  <md-select name="trunk" ng-model="vm.application.trunk" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="trunk.name" ng-repeat="trunk in vm.trunks.rows" ng-disabled="trunk.canSelect === false">{{\n      trunk.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'trunk\'].$error" ng-show="routingAppForm[\'trunk\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.CALLER_ID">Caller_ID</label>\n  <input type="text" name="callerID" ng-model="vm.application.callerID" ng-disabled="!vm.crudPermissions.canEdit">\n  <div class="hint"><span translate="VOICE.HELP.CALLER_ID"></span></div>\n  <div ng-messages="routingAppForm[\'callerID\'].$error" ng-show="routingAppForm[\'callerID\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.CALLER_ID_REQUIRED">Caller_ID field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.PREFIX">Prefix</label>\n  <input type="text" name="prefix" ng-model="vm.application.prefix" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'prefix\'].$error" ng-show="routingAppForm[\'prefix\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TAGS">Tags</label>\n  <md-select name="tag" ng-model="vm.application.tag" ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'--\'">None</md-option>\n    <md-option ng-value="tag.name" ng-repeat="tag in vm.tags.rows" ng-disabled="tag.canSelect === false">{{ tag.name }}\n    </md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'tag\'].$error" ng-show="routingAppForm[\'tag\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TAGS_REQUIRED">Tags field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/playback.html",'<md-input-container class="md-block">\n  <label translate="VOICE.AUDIO_FILES">Audio_Files</label>\n  <md-select name="sound" ng-model="vm.application.appdata" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/{{sound.save_name}}\'" ng-repeat="sound in vm.sounds.rows" ng-disabled="sound.canSelect === false">{{ sound.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'sound\'].$error" ng-show="routingAppForm[\'sound\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.AUDIO_FILES_REQUIRED">Audio_Files field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <md-switch ng-model="vm.application.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</span></md-switch>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/queue.html",'<md-input-container class="md-block">\n  <label translate="VOICE.QUEUE">Queue</label>\n  <md-select name="queue" ng-model="vm.application.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="queue.name" ng-repeat="queue in vm.queues.rows" ng-disabled="queue.canSelect === false">{{\n      queue.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'queue\'].$error" ng-show="routingAppForm[\'queue\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="URL" ng-model="vm.application.URL" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'URL\'].$error" ng-show="routingAppForm[\'URL\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.ANNOUNCE_OVERRIDES">Announce_Overrides</label>\n  <md-select name="sound" ng-model="vm.application.sound" ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'\'">None</md-option>\n    <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/{{sound.save_name}}\'" ng-repeat="sound in vm.sounds.rows" ng-disabled="sound.canSelect === false">{{ sound.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'sound\'].$error" ng-show="routingAppForm[\'sound\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.ANNOUNCE_OVERRIDES_REQUIRED">Announce_Overrides field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.AGI">Agi</label>\n  <input type="text" name="agi" ng-model="vm.application.agi" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'agi\'].$error" ng-show="routingAppForm[\'agi\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.AGI_REQUIRED">Agi field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.MACRO">Macro</label>\n  <input type="text" name="macro" ng-model="vm.application.macro" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'macro\'].$error" ng-show="routingAppForm[\'macro\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.MACRO_REQUIRED">Macro field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.GOSUB">GoSub</label>\n  <input type="text" name="gosub" ng-model="vm.application.gosub" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'gosub\'].$error" ng-show="routingAppForm[\'gosub\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.GOSUB_REQUIRED">GoSub field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.RULE">Rule</label>\n  <input type="text" name="rule" ng-model="vm.application.rule" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'rule\'].$error" ng-show="routingAppForm[\'rule\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.RULE_REQUIRED">Rule field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.POSITION">Position</label>\n  <input type="number" name="position" ng-model="vm.application.position" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'position\'].$error" ng-show="routingAppForm[\'position\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.POSITION_REQUIRED">Position field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.POSITION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Position must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <md-switch ng-model="vm.application.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</span></md-switch>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/ringGroup.html",'<md-input-container class="md-block">\n  <label translate="VOICE.USER">User</label>\n  <md-select name="user" ng-model="vm.application.users" autofocus multiple required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'SIP/{{user.name}}\'" ng-repeat="user in vm.users.rows" ng-disabled="user.canSelect === false">\n      {{ user.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'user\'].$error" ng-show="routingAppForm[\'user\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.USER_REQUIRED">User field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/set.html",'<md-input-container class="md-block">\n  <label translate="VOICE.VARIABLE">Variable</label>\n  <md-select name="variable" ng-model="vm.application.name" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="variable.name" ng-repeat="variable in vm.variables.rows" ng-disabled="variable.canSelect === false">{{\n      variable.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'variable\'].$error" ng-show="routingAppForm[\'variable\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.VALUE">Value</label>\n  <input type="text" name="value" ng-model="vm.application.value" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'value\'].$error" ng-show="routingAppForm[\'value\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.VALUE_REQUIRED">Value field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/voicemail.html",'<md-input-container class="md-block">\n  <label translate="VOICE.MAILBOX@CONTEXT">Mailbox@Context</label>\n  <md-select name="voiceMail" ng-model="vm.application.voiceMail" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'{{voiceMail.mailbox}}@from-voicemail\'" ng-repeat="voiceMail in vm.voiceMails.rows" ng-disabled="voiceMail.canSelect === false">{{ voiceMail.mailbox }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'voiceMail\'].$error" ng-show="routingAppForm[\'voiceMail\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.MAILBOX@CONTEXT_REQUIRED">Mailbox@Context field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/views/chanSpies/chanSpies.html",'<div id="chanSpies" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.CHANSPIES">ChanSpies</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedChanSpies.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedChanSpies =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-chanSpies-count">\n          <span>{{vm.selectedChanSpies.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllChanSpies()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectChanSpies()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedChanSpies" csv-label="true" filename="chanSpies.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedChanSpies($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CHANSPY TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedChanSpies" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChanSpies">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="prefix">{{ \'VOICE.PREFIX\' | translate }}</th>\n                <th md-column md-order-by="auth">{{ \'VOICE.AUTH\' | translate }}</th>\n                <th md-column md-order-by="record">{{ \'VOICE.RECORD\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.chanSpies.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="chanSpy" md-select-id="id" ng-repeat="chanSpy in vm.chanSpies.rows">\n                <td md-cell ng-if="chanSpy.userpic"><img class="avatar" alt="{{chanSpy.name}}" ng-src="api/users/{{chanSpy.id}}/avatar" /></td>\n                <td md-cell ng-if="!chanSpy.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{chanSpy.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="id ">{{chanSpy.id}}</td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="name ">{{chanSpy.name}}</td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="prefix ">{{chanSpy.prefix}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chanSpy, ev) : vm.createOrEditchanSpy($event, chanSpy)" md-cell class="auth ">\n                  <md-icon md-colors="{color: {{chanSpy.auth ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{chanSpy.auth ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chanSpy, ev) : vm.createOrEditchanSpy($event, chanSpy)" md-cell class="record ">\n                  <md-icon md-colors="{color: {{chanSpy.record ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{chanSpy.record ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="description ">{{chanSpy.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(chanSpy, $event    )" translate="VOICE.EDIT_CHANSPY">\n                          Edit chanSpy\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(chanSpy, $event    )" translate="VOICE.DELETE_CHANSPY">\n                          Delete chanSpy\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chanSpies.count}}" md-on-paginate="vm.getChanSpies" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CHANSPY TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CHANSPY BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-chanSpy-button" ng-click="vm.createOrEditchanSpy($event)" aria-label="add chanSpy" translate translate-attr-aria-label="VOICE.ADD_CHANSPY">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CHANSPY BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/chanSpies/create/dialog.html",'<md-dialog class="chanSpy-dialog" aria-label="New chanSpy">\n  <form name="chanSpyForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.chanSpy.name" ng-required="true" autofocus>\n\n        <div ng-messages="chanSpyForm[\'name\'].$error" ng-show="chanSpyForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PREFIX">Prefix</label>\n        <input type="text" name="prefix" ng-model="vm.chanSpy.prefix" ng-required="true">\n\n        <div ng-messages="chanSpyForm[\'prefix\'].$error" ng-show="chanSpyForm[\'prefix\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.OPTIONS">Options</label>\n        <md-select name="options" ng-model="vm.chanSpy.options" multiple required>\n          <md-option ng-value="\'b\'">b: Only spy on channels involved in a bridged call.</md-option>\n          <md-option ng-value="\'B\'">B: Instead of whispering on a single channel barge in on both channels involved in the call.</md-option>\n          <md-option ng-value="\'E\'">E: Exit when the spied-on channel hangs up.</md-option>\n          <md-option ng-value="\'o\'">o: Only listen to audio coming from this channel.</md-option>\n          <md-option ng-value="\'q\'">q: Don\'t play a beep when beginning to spy on a channel, or speak the selected channel name.</md-option>\n          <md-option ng-value="\'s\'">s: Skip the playback of the channel type (i.e. SIP, IAX, etc) when speaking the selected channel name.</md-option>\n          <md-option ng-value="\'S\'">S: Stop when no more channels are left to spy on.</md-option>\n          <md-option ng-value="\'w\'">w: Enable whisper mode, so the spying channel can talk to the spied-on channel.</md-option>\n          <md-option ng-value="\'W\'">W: Enable private whisper mode, so the spying channel can talk to the spied-on channel but cannot listen to that channel.</md-option>\n        </md-select>\n        <div ng-messages="chanSpyForm[\'options\'].$error" ng-show="chanSpyForm[\'options\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.chanSpy.auth" aria-label="Auth"><span translate="VOICE.AUTH">Auth</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.chanSpy.auth">\n        <label translate="VOICE.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.chanSpy.password" placeholder="Password" translate translate-attr-placeholder="VOICE.PASSWORD" required>\n        <div ng-messages="chanSpyForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.chanSpy.record" aria-label="Record"><span translate="VOICE.RECORD">Record</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.chanSpy.record" class="md-block">\n        <label translate="VOICE.RECORDINGFORMAT">recordingFormat</label>\n        <md-select name="recordingFormat" ng-model="vm.chanSpy.recordingFormat" required>\n          <md-option ng-value="\'wav\'">wav</md-option>\n          <md-option ng-value="\'gsm\'">gsm</md-option>\n          <md-option ng-value="\'WAV\'">wav49</md-option>\n        </md-select>\n        <div ng-messages="chanSpyForm[\'recordingFormat\'].$error" ng-show="chanSpyForm[\'recordingFormat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.RECORDINGFORMAT_REQUIRED">recordingFormat field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chanSpy.description">\n\n        <div ng-messages="chanSpyForm[\'description\'].$error" ng-show="chanSpyForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newchanSpy" ng-click="vm.savechanSpy()" class="send-button md-accent md-raised" ng-disabled="chanSpyForm.$invalid || chanSpyForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newchanSpy" ng-click="vm.addNewchanSpy()" class="send-button md-accent md-raised" ng-disabled="chanSpyForm.$invalid" aria-label="ADD" translate="VOICE.ADD_CHANSPY" translate-attr-aria-label="VOICE.ADD_CHANSPY">\n          ADD CHANSPY\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newchanSpy" ng-click="vm.deletechanSpy($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/contexts/contexts.html",'<div id="contexts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.CONTEXTS">Contexts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedContexts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedContexts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-contexts-count">\n          <span>{{vm.selectedContexts.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllContexts()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectContexts()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedContexts" csv-label="true" filename="contexts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedContexts($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CONTEXT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedContexts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContexts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.contexts.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="context" md-select-id="id" ng-repeat="context in vm.contexts.rows">\n                <td md-cell ng-if="context.userpic"><img class="avatar" alt="{{context.name}}" ng-src="api/users/{{context.id}}/avatar" /></td>\n                <td md-cell ng-if="!context.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{context.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditContext($event, context)" md-cell class="id ">{{context.id}}</td>\n                <td ng-click="vm.createOrEditContext($event, context)" md-cell class="name ">{{context.name}}</td>\n                <td ng-click="vm.createOrEditContext($event, context)" md-cell class="description ">{{context.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(context, $event    )" translate="VOICE.EDIT_CONTEXT">\n                          Edit Context\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(context, $event    )" translate="VOICE.DELETE_CONTEXT">\n                          Delete Context\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contexts.count}}" md-on-paginate="vm.getContexts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CONTEXT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CONTEXT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-context-button" ng-click="vm.createOrEditContext($event)" aria-label="add context" translate translate-attr-aria-label="VOICE.ADD_CONTEXT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CONTEXT BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/contexts/create/dialog.html",'<md-dialog class="context-dialog" aria-label="New Context">\n  <form name="contextForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.context.name" ng-required="true" autofocus>\n\n        <div ng-messages="contextForm[\'name\'].$error" ng-show="contextForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.context.description">\n\n        <div ng-messages="contextForm[\'description\'].$error" ng-show="contextForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newContext" ng-click="vm.saveContext()" class="send-button md-accent md-raised" ng-disabled="contextForm.$invalid || contextForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newContext" ng-click="vm.addNewContext()" class="send-button md-accent md-raised" ng-disabled="contextForm.$invalid" aria-label="ADD" translate="VOICE.ADD_CONTEXT" translate-attr-aria-label="VOICE.ADD_CONTEXT">\n          ADD CONTEXT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newContext" ng-click="vm.deleteContext($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/inboundRoutes/create/dialog.html",'<md-dialog ng-init="vm.initialize()" class="inbound-route-dialog" aria-label="New InboundRoute">\n  <form name="inboundrouteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newInboundRoute ? \'VOICE.NEW_INBOUNDROUTE\' : \'VOICE.EDIT_INBOUNDROUTE\' | translate\n          }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n        <input type="text" name="exten" ng-model="vm.inboundRoute.exten" ng-required="true" autofocus>\n        <div ng-messages="inboundrouteForm[\'exten\'].$error" ng-show="inboundrouteForm[\'exten\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CONTEXT">Context</label>\n        <md-select name="context" ng-model="vm.inboundRoute.context" required>\n          <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n        </md-select>\n        <div ng-messages="inboundrouteForm[\'context\'].$error" ng-show="inboundrouteForm[\'context\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.inboundRoute.alias" ng-change="vm.getRouting()">\n        <div ng-messages="inboundrouteForm[\'alias\'].$error" ng-show="inboundrouteForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.inboundRoute.description">\n        <div ng-messages="inboundrouteForm[\'description\'].$error" ng-show="inboundrouteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInboundRoute" ng-click="vm.saveInboundRoute()" class="send-button md-accent md-raised" ng-disabled="inboundrouteForm.$invalid || inboundrouteForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInboundRoute" ng-click="vm.addNewInboundRoute()" class="send-button md-accent md-raised" ng-disabled="inboundrouteForm.$invalid" aria-label="ADD" translate="VOICE.ADD_INBOUNDROUTE" translate-attr-aria-label="VOICE.ADD_INBOUNDROUTE">\n          ADD INBOUNDROUTE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInboundRoute" ng-click="vm.deleteInboundRoute($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/inboundRoutes/edit/view.html",'<div ng-init="vm.onInit()" id="voice-inbound-route" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-inbound-routes-button md-icon-button" aria-label="Go to inbound routes" ng-click="vm.gotoInboundRoutes()" translate translate-attr-aria-label="VOICE.GO_TO_INBOUNDROUTES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="inbound-route-image" hide-xs>\n          <img ng-src="assets/images/business/inboundroutes.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.inboundRoute.id}}\n            <span ng-if="vm.inboundRoute.exten">{{vm.inboundRoute.exten}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.inboundRoute.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveInboundRoute()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (actionsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- /HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      \x3c!-- SETTINGS TAB --\x3e\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="inbound-route-detail-form-container md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.inboundRoute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'exten\'].$error" ng-show="generalForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.inboundRoute.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.inboundRoute.alias" ng-change="vm.onActionsTabSelection()" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'alias\'].$error" ng-show="generalForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.inboundRoute.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /SETTINGS TAB --\x3e\n      \x3c!-- ACTIONS TAB --\x3e\n      <md-tab md-on-select="vm.onActionsTabSelection()">\n        <md-tab-label>\n          <span translate="VOICE.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="inbound-route-detail-form-container no-padding no-margin">\n            <div class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- APPLICATIONS LIST --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm.crudPermissions.canEdit">\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider class="no-margin"></md-divider>\n                <md-list ng-sortable="vm.sortableAppsOptions">\n                  <md-list-item class="handle" ng-repeat="a in vm.apps">\n                    <div layout="row">\n                      <md-icon md-font-icon="icon-apps" class="s16 mr-15"></md-icon>\n                      <p class="text-truncate" translate="VOICE.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias ||\n                        a.appType}}</p>\n                    </div>\n                  </md-list-item>\n                </md-list>\n              </div>\n              \x3c!-- /APPLICATIONS LIST --\x3e\n              <div flex></div>\n              \x3c!-- ROUTING --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm.crudPermissions.canEdit ? 75 : 100}}">\n                <div ng-if="vm.pendingChanges" class="p-10 md-amber-300-bg">\n                  <md-icon md-font-icon="icon-information-outline" aria-label="Save reminder"></md-icon>\n                  <span class="no-margin font-size-12 line-height-30" translate="VOICE.HELP.SAVE_ROUTES"></span>\n                </div>\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar query="vm.query" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm.selectedApplications.length}}\n                      {{vm.selectedApplications.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedApplications($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm.selectedApplications">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm.sortableRoutingOptions">\n                      <tr md-row md-select="a" md-select-id="id" ng-repeat="a in vm.applications.rows | filter:vm.query.filter as results">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)">{{a.app.toLowerCase() ===\n                          \'agi\' ? \'Cally-Square\' : a.app | ucfirst}}<span ng-if="a.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)"><span class="text-truncate actionAppData">{{a.appdata}}</span></td>\n                        <td md-cell ng-click="vm.editInterval($event, $index)">{{a.IntervalId ? \'From List\' :\n                          a.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{a.IntervalId ? \'From List\' : (a.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell ng-if="!vm.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editApplication($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                <md-button ng-click="vm.deleteApplication(a, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-class="{ \'ng-cloak\': results.length > 0 }">\n                        <td md-cell colspan="6">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No applications\n                            available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                    <tfoot md-foot>\n                      <tr md-row>\n                        <td md-cell colspan="7">\n                          <span><em translate="VOICE.LEGEND.CUSTOM_APPLICATION">(*) - Custom application.</em></span>\n                        </td>\n                      </tr>\n                    </tfoot>\n                  </table>\n                </md-table-container>\n              </div>\n              \x3c!-- /ROUTING --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /ACTIONS TAB --\x3e\n    </md-tabs>\n  </div>\n  \x3c!-- /CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/inboundRoutes/inboundRoutes.html",'<div id="inbound-routes" class="page-layout simple left-sidenav inner-sidenav">\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.INBOUNDROUTES">InboundRoutes</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n  <div ng-show="vm.selectedInboundRoutes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedInboundRoutes = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-inbound-routes-count">\n          <span>{{ vm.selectedInboundRoutes.length }}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInboundRoutes = vm.inboundRoutes.rows" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInboundRoutes = []" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedInboundRoutes" csv-label="true" filename="inbound_routes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedInboundRoutes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedInboundRoutes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getInboundRoutes">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.PHONENUMBER\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.inboundRoutes.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="route" md-select-id="id" ng-repeat="route in vm.inboundRoutes.rows">\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInboundRoute($event, route)" md-cell class="id ">{{ route.id }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInboundRoute($event, route)" md-cell class="exten ">{{ route.exten }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInboundRoute($event, route)" md-cell class="description ">{{ route.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editRoute(route)" translate="VOICE.EDIT_INBOUNDROUTE">\n                          Edit InboundRoute\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteConfirm(route, $event)" translate="VOICE.DELETE_INBOUNDROUTE">\n                          Delete InboundRoute\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'VOICE.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'VOICE.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'VOICE.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.inboundRoutes.count }}" md-on-paginate="vm.getInboundRoutes" md-page-select>\n        </md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-inbound-route-button" ng-click="vm.createOrEditInboundRoute($event)" aria-label="add inbound route" translate translate-attr-aria-label="VOICE.ADD_INBOUNDROUTE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n</div>'),e.put("app/main/apps/voice/views/internalRoutes/create/dialog.html",'<md-dialog ng-init="vm.initialize()" class="internal-route-dialog" aria-label="New InternalRoute">\n  <form name="internalrouteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newInternalRoute ? \'VOICE.NEW_INTERNALROUTE\' : \'VOICE.EDIT_INTERNALROUTE\' | translate\n          }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n        <input type="text" name="exten" ng-model="vm.internalRoute.exten" ng-required="true" autofocus>\n        <div ng-messages="internalrouteForm[\'exten\'].$error" ng-show="internalrouteForm[\'exten\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CONTEXT">Context</label>\n        <md-select name="context" ng-model="vm.internalRoute.context" required>\n          <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n        </md-select>\n        <div ng-messages="internalrouteForm[\'context\'].$error" ng-show="internalrouteForm[\'context\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.internalRoute.alias" ng-change="vm.getRouting()">\n        <div ng-messages="internalrouteForm[\'alias\'].$error" ng-show="internalrouteForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.internalRoute.description">\n        <div ng-messages="internalrouteForm[\'description\'].$error" ng-show="internalrouteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInternalRoute" ng-click="vm.saveInternalRoute()" class="send-button md-accent md-raised" ng-disabled="internalrouteForm.$invalid || internalrouteForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInternalRoute" ng-click="vm.addNewInternalRoute()" class="send-button md-accent md-raised" ng-disabled="internalrouteForm.$invalid" aria-label="ADD" translate="VOICE.ADD_INTERNALROUTE" translate-attr-aria-label="VOICE.ADD_INTERNALROUTE">\n          ADD INTERNALROUTE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInternalRoute" ng-click="vm.deleteInternalRoute($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/internalRoutes/edit/view.html",'<div ng-init="vm.onInit()" id="voice-internal-route" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-internal-routes-button md-icon-button" aria-label="Go to internal routes" ng-click="vm.gotoInternalRoutes()" translate translate-attr-aria-label="VOICE.GO_TO_INTERNALROUTES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="internal-route-image" hide-xs>\n          <img ng-src="assets/images/business/internalroutes.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.internalRoute.id}}\n            <span ng-if="vm.internalRoute.exten">{{vm.internalRoute.exten}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.internalRoute.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveInternalRoute()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (actionsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- /HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      \x3c!-- SETTINGS TAB --\x3e\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="internal-route-detail-form-container md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.internalRoute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'exten\'].$error" ng-show="generalForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.internalRoute.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.internalRoute.alias" ng-change="vm.onActionsTabSelection()" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'alias\'].$error" ng-show="generalForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.internalRoute.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /SETTINGS TAB --\x3e\n      \x3c!-- ACTIONS TAB --\x3e\n      <md-tab md-on-select="vm.onActionsTabSelection()">\n        <md-tab-label>\n          <span translate="VOICE.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="internal-route-detail-form-container no-padding no-margin">\n            <div class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- APPLICATIONS LIST --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm.crudPermissions.canEdit">\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider class="no-margin"></md-divider>\n                <md-list ng-sortable="vm.sortableAppsOptions">\n                  <md-list-item class="handle" ng-repeat="a in vm.apps">\n                    <div layout="row">\n                      <md-icon md-font-icon="icon-apps" class="s16 mr-15"></md-icon>\n                      <p class="text-truncate" translate="VOICE.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias ||\n                        a.appType}}</p>\n                    </div>\n                  </md-list-item>\n                </md-list>\n              </div>\n              \x3c!-- /APPLICATIONS LIST --\x3e\n              <div flex></div>\n              \x3c!-- ROUTING --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm.crudPermissions.canEdit ? 75 : 100}}">\n                <div ng-if="vm.pendingChanges" class="p-10 md-amber-300-bg">\n                  <md-icon md-font-icon="icon-information-outline" aria-label="Save reminder"></md-icon>\n                  <span class="no-margin font-size-12 line-height-30" translate="VOICE.HELP.SAVE_ROUTES"></span>\n                </div>\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar query="vm.query" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm.selectedApplications.length}}\n                      {{vm.selectedApplications.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedApplications($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm.selectedApplications">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm.sortableRoutingOptions">\n                      <tr md-row md-select="a" md-select-id="id" ng-repeat="a in vm.applications.rows | filter:vm.query.filter as results">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)">{{a.app.toLowerCase() ===\n                          \'agi\' ? \'Cally-Square\' : a.app | ucfirst}}<span ng-if="a.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)"><span class="text-truncate actionAppData">{{a.appdata}}</span></td>\n                        <td md-cell ng-click="vm.editInterval($event, $index)">{{a.IntervalId ? \'From List\' :\n                          a.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{a.IntervalId ? \'From List\' : (a.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell ng-if="!vm.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editApplication($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                <md-button ng-click="vm.deleteApplication(a, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-class="{ \'ng-cloak\': results.length > 0 }">\n                        <td md-cell colspan="6">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No applications\n                            available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                    <tfoot md-foot>\n                      <tr md-row>\n                        <td md-cell colspan="7">\n                          <span><em translate="VOICE.LEGEND.CUSTOM_APPLICATION">(*) - Custom application.</em></span>\n                        </td>\n                      </tr>\n                    </tfoot>\n                  </table>\n                </md-table-container>\n              </div>\n              \x3c!-- /ROUTING --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /ACTIONS TAB --\x3e\n    </md-tabs>\n  </div>\n  \x3c!-- /CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/internalRoutes/internalRoutes.html",'<div id="internal-routes" class="page-layout simple left-sidenav inner-sidenav">\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.INTERNALROUTES">InternalRoutes</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n  <div ng-show="vm.selectedInternalRoutes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedInternalRoutes = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-internal-routes-count">\n          <span>{{ vm.selectedInternalRoutes.length }}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInternalRoutes = vm.internalRoutes.rows" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInternalRoutes = []" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedInternalRoutes" csv-label="true" filename="internal_routes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedInternalRoutes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedInternalRoutes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getInternalRoutes">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.PHONENUMBER\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.internalRoutes.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="route" md-select-id="id" ng-repeat="route in vm.internalRoutes.rows">\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInternalRoute($event, route)" md-cell class="id ">{{ route.id }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInternalRoute($event, route)" md-cell class="exten ">{{ route.exten }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInternalRoute($event, route)" md-cell class="description ">{{ route.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editRoute(route)" translate="VOICE.EDIT_INTERNALROUTE">\n                          Edit InternalRoute\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteConfirm(route, $event)" translate="VOICE.DELETE_INTERNALROUTE">\n                          Delete InternalRoute\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'VOICE.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'VOICE.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'VOICE.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.internalRoutes.count }}" md-on-paginate="vm.getInternalRoutes" md-page-select>\n        </md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-internal-route-button" ng-click="vm.createOrEditInternalRoute($event)" aria-label="add internal route" translate translate-attr-aria-label="VOICE.ADD_INTERNALROUTE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n</div>'),e.put("app/main/apps/voice/views/musiconholds/create/dialog.html",'<md-dialog class="musiconhold-dialog" aria-label="New MusicOnHold">\n  <form name="musiconholdForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.musiconhold.name" ng-required="true" autofocus ng-disabled="!vm.newMusicOnHold">\n\n        <div ng-messages="musiconholdForm[\'name\'].$error" ng-show="musiconholdForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.MODE">Mode</label>\n        <md-select name="mode" ng-model="vm.musiconhold.mode" required ng-disabled="!vm.newMusicOnHold">\n\n          <md-option ng-value="\'files\'"> {{ \'VOICE.FILES\' | translate }} </md-option>\n\n          <md-option ng-value="\'custom\'"> {{ \'VOICE.CUSTOM\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="musiconholdForm[\'mode\'].$error" ng-show="musiconholdForm[\'mode\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.MODE_REQUIRED">Mode field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n        <label translate="VOICE.DIRECTORY">Directory</label>\n        <input type="" name="directory" ng-model="vm.musiconhold.directory">\n\n        <div ng-messages="musiconholdForm[\'directory\'].$error" ng-show="musiconholdForm[\'directory\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DIRECTORY_REQUIRED">Directory field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n        <label translate="VOICE.APPLICATION">Application</label>\n        <input type="text" name="application" ng-model="vm.musiconhold.application" ng-required="true">\n\n        <div ng-messages="musiconholdForm[\'application\'].$error" ng-show="musiconholdForm[\'application\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.APPLICATION_REQUIRED">Application field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.musiconhold.mode == \'files\'" class="md-block">\n        <label translate="VOICE.SORT">Sort</label>\n        <md-select name="sort" ng-model="vm.musiconhold.sort">\n\n          <md-option ng-value="\'random\'"> {{ \'VOICE.RANDOM\' | translate }} </md-option>\n\n          <md-option ng-value="\'alpha\'"> {{ \'VOICE.ALPHABETICAL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="musiconholdForm[\'sort\'].$error" ng-show="musiconholdForm[\'sort\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.SORT_REQUIRED">Sort field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMusicOnHold" ng-click="vm.saveMusicOnHold()" class="send-button md-accent md-raised" ng-disabled="musiconholdForm.$invalid || musiconholdForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMusicOnHold" ng-click="vm.addNewMusicOnHold()" class="send-button md-accent md-raised" ng-disabled="musiconholdForm.$invalid" aria-label="ADD" translate="VOICE.ADD_MUSICONHOLD" translate-attr-aria-label="VOICE.ADD_MUSICONHOLD">\n          ADD MUSICONHOLD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMusicOnHold" ng-click="vm.deleteMusicOnHold($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/musiconholds/edit/mohSounds/dialog.html",'<md-dialog class="mohSound-dialog" aria-label="New MohSound">\n  <form name="mohSoundForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.FILE">File</label>\n        <md-select name="id" ng-model="vm.mohSound.id" autofocus>\n          <md-option ng-value="id.id" ng-repeat="id in vm.sounds" ng-disabled="id.canSelect === false">{{ id.name }}</md-option>\n        </md-select>\n        <div ng-messages="mohSoundForm[\'id\'].$error" ng-show="mohSoundForm[\'id\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.FILE_REQUIRED">File field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMohSound" ng-click="vm.saveMohSound()" class="send-button md-accent md-raised" ng-disabled="mohSoundForm.$invalid || mohSoundForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMohSound" ng-click="vm.addNewMohSound()" class="send-button md-accent md-raised" ng-disabled="mohSoundForm.$invalid" aria-label="ADD" translate="VOICE.ADD_MOHSOUND" translate-attr-aria-label="VOICE.ADD_MOHSOUND">\n          ADD MOHSOUND\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMohSound" ng-click="vm.deleteMohSound($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/musiconholds/edit/view.html",'<div id="voice-musiconhold" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-musiconholds-button md-icon-button" aria-label="Go to musiconholds" ng-click="vm.gotoMusicOnHolds()" translate translate-attr-aria-label="VOICE.GO_TO_MUSICONHOLDS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="musiconhold-image" hide-xs>\n          <img ng-src="assets/images/business/musiconholds.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.musiconhold.id}}\n            <span ng-if="vm.musiconhold.name">{{vm.musiconhold.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.musiconhold.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveMusicOnHold()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (mohSoundsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="musiconhold-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.musiconhold.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MODE">Mode</label>\n                <md-select name="mode" ng-model="vm.musiconhold.mode" required disabled>\n\n                  <md-option ng-value="\'files\'"> {{ \'VOICE.FILES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'custom\'"> {{ \'VOICE.CUSTOM\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'mode\'].$error" ng-show="generalForm[\'mode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MODE_REQUIRED">Mode field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n                <label translate="VOICE.DIRECTORY">Directory</label>\n                <input type="" name="directory" ng-model="vm.musiconhold.directory" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'directory\'].$error" ng-show="generalForm[\'directory\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DIRECTORY_REQUIRED">Directory field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n                <label translate="VOICE.APPLICATION">Application</label>\n                <input type="text" name="application" ng-model="vm.musiconhold.application" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'application\'].$error" ng-show="generalForm[\'application\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.APPLICATION_REQUIRED">Application field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.musiconhold.mode == \'files\'" class="md-block">\n                <label translate="VOICE.SORT">Sort</label>\n                <md-select name="sort" ng-model="vm.musiconhold.sort" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'random\'"> {{ \'VOICE.RANDOM\' | translate }} </md-option>\n\n                  <md-option ng-value="\'alpha\'"> {{ \'VOICE.ALPHABETICAL\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'sort\'].$error" ng-show="generalForm[\'sort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SORT_REQUIRED">Sort field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.AUDIOFILES">AUDIOFILES</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="musiconhold-detail-form-container mohsounds md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MusicOnHoldMohSoundsController as vm_dc" ng-init="vm_dc.init(vm.musiconhold, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMusicOnHoldMohSounds.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="VOICE.MOHSOUNDS">MohSounds</span>\n                  <ms-search-bar on-search="vm_dc.getMusicOnHoldMohSounds()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditMusicOnHoldMohSound($event)" aria-label="add mohSound" translate translate-attr-label="VOICE.ADD_MOHSOUND">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedMusicOnHoldMohSounds.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedMusicOnHoldMohSounds.length}} {{vm_dc.selectedMusicOnHoldMohSounds.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedMusicOnHoldMohSounds" csv-label="true" filename="musiconholds.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedMusicOnHoldMohSounds($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedMusicOnHoldMohSounds" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getMusicOnHoldMohSounds">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'VOICE.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="audio">\n                        {{ \'VOICE.AUDIO\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'VOICE.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="mohSound" md-select-id="id" ng-repeat="mohSound in vm_dc.musiconholdMohSounds.rows">\n                      <td md-cell>\n                        {{mohSound.id}}\n                      </td>\n                      <td md-cell>\n                        \x3c!-- audio recording directive --\x3e\n                        <ms-recording id="mohSound.id" model="\'sound\'"></ms-recording>\n                        \x3c!-- / audio recording directive --\x3e\n                      </td>\n                      <td md-cell>\n                        {{ mohSound.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(mohSound, $event)" translate="VOICE.DELETE_MOHSOUND">\n                                Delete MohSound\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.musiconholdMohSounds.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="VOICE.NO_MOHSOUND_AVAILABLE">No mohsound available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.musiconholdMohSounds.count}}" md-on-paginate="vm_dc.getMusicOnHoldMohSounds" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/musiconholds/musiconholds.html",'<div id="musiconholds" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.MUSICONHOLDS">MusicOnHolds</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMusicOnHolds.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMusicOnHolds =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-musiconholds-count">\n          <span>{{vm.selectedMusicOnHolds.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMusicOnHolds()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMusicOnHolds()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMusicOnHolds" csv-label="true" filename="musiconholds.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMusicOnHolds($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- MUSICONHOLD TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMusicOnHolds" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMusicOnHolds">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="mode">{{ \'VOICE.MODE\' | translate }}</th>\n                <th md-column md-order-by="sort">{{ \'VOICE.SORT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.musiconholds.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="musiconhold" md-select-id="id" ng-repeat="musiconhold in vm.musiconholds.rows">\n                <td md-cell ng-if="musiconhold.userpic"><img class="avatar" alt="{{musiconhold.name}}" ng-src="api/users/{{musiconhold.id}}/avatar" /></td>\n                <td md-cell ng-if="!musiconhold.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{musiconhold.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="id ">{{musiconhold.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="name ">{{musiconhold.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="mode ">{{ \'VOICE.\' + vm.arraymode[musiconhold.mode].option | uppercase | translate }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="sort ">{{ \'VOICE.\' + vm.arraysort[musiconhold.sort].option | uppercase | translate }}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(musiconhold, $event    )" translate="VOICE.EDIT_MUSICONHOLD">\n                          Edit MusicOnHold\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(musiconhold, $event    )" translate="VOICE.DELETE_MUSICONHOLD">\n                          Delete MusicOnHold\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.musiconholds.count}}" md-on-paginate="vm.getMusicOnHolds" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / MUSICONHOLD TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD MUSICONHOLD BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-musiconhold-button" ng-click="vm.createOrEditMusicOnHold($event)" aria-label="add musiconhold" translate translate-attr-aria-label="VOICE.ADD_MUSICONHOLD">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD MUSICONHOLD BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/outboundRoutes/create/dialog.html",'<md-dialog ng-init="vm.initialize()" class="outbound-route-dialog" aria-label="New OutboundRoute">\n  <form name="outboundrouteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newOutboundRoute ? \'VOICE.NEW_OUTBOUNDROUTE\' : \'VOICE.EDIT_OUTBOUNDROUTE\' | translate\n          }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n        <input type="text" name="exten" ng-model="vm.outboundRoute.exten" ng-required="true" autofocus>\n        <div ng-messages="outboundrouteForm[\'exten\'].$error" ng-show="outboundrouteForm[\'exten\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CONTEXT">Context</label>\n        <md-select name="context" ng-model="vm.outboundRoute.context" required>\n          <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n        </md-select>\n        <div ng-messages="outboundrouteForm[\'context\'].$error" ng-show="outboundrouteForm[\'context\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.RECORDING">Recording</label>\n        <md-select name="recordingFormat" ng-model="vm.outboundRoute.recordingFormat" ng-change="vm.getRouting()" required>\n          <md-option ng-value="\'none\'">none</md-option>\n          <md-option ng-value="\'wav\'">wav</md-option>\n          <md-option ng-value="\'WAV\'">wav49</md-option>\n          <md-option ng-value="\'gsm\'">gsm</md-option>\n        </md-select>\n        <div class="hint"><span translate="VOICE.HELP.RECORDING"></span></div>\n        <div ng-messages="outboundrouteForm[\'recordingFormat\'].$error" ng-show="outboundrouteForm[\'recordingFormat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.RECORDING_REQUIRED">Recording field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CUTDIGITS">CutDigits</label>\n        <input type="number" name="cutdigits" ng-model="vm.outboundRoute.cutdigits" min="0">\n        <div ng-messages="outboundrouteForm[\'cutdigits\'].$error" ng-show="outboundrouteForm[\'cutdigits\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CUTDIGITS_REQUIRED">CutDigits field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="VOICE.ERRORS.CUTDIGITS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigits must be a valid greater\n              or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.outboundRoute.alias" ng-change="vm.getRouting()">\n        <div ng-messages="outboundrouteForm[\'alias\'].$error" ng-show="outboundrouteForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.outboundRoute.description">\n        <div ng-messages="outboundrouteForm[\'description\'].$error" ng-show="outboundrouteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOutboundRoute" ng-click="vm.saveOutboundRoute()" class="send-button md-accent md-raised" ng-disabled="outboundrouteForm.$invalid || outboundrouteForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOutboundRoute" ng-click="vm.addNewOutboundRoute()" class="send-button md-accent md-raised" ng-disabled="outboundrouteForm.$invalid" aria-label="ADD" translate="VOICE.ADD_OUTBOUNDROUTE" translate-attr-aria-label="VOICE.ADD_OUTBOUNDROUTE">\n          ADD OUTBOUNDROUTE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOutboundRoute" ng-click="vm.deleteOutboundRoute($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/outboundRoutes/edit/view.html",'<div ng-init="vm.onInit()" id="voice-outbound-route" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-outbound-routes-button md-icon-button" aria-label="Go to outbound routes" ng-click="vm.gotoOutboundRoutes()" translate translate-attr-aria-label="VOICE.GO_TO_OUTBOUNDROUTES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="outbound-route-image" hide-xs>\n          <img ng-src="assets/images/business/outboundroutes.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.outboundRoute.id}}\n            <span ng-if="vm.outboundRoute.exten">{{vm.outboundRoute.exten}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.outboundRoute.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveOutboundRoute()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (actionsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- /HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      \x3c!-- SETTINGS TAB --\x3e\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="outbound-route-detail-form-container md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.outboundRoute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'exten\'].$error" ng-show="generalForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.outboundRoute.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RECORDING">Recording</label>\n                <md-select name="recordingFormat" ng-model="vm.outboundRoute.recordingFormat" ng-change="vm.onActionsTabSelection()" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'none\'">none</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'WAV\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.RECORDING"></span></div>\n                <div ng-messages="generalForm[\'recordingFormat\'].$error" ng-show="generalForm[\'recordingFormat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RECORDING_REQUIRED">Recording field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CUTDIGITS">CutDigits</label>\n                <input type="number" name="cutdigits" ng-model="vm.outboundRoute.cutdigits" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'cutdigits\'].$error" ng-show="generalForm[\'cutdigits\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CUTDIGITS_REQUIRED">CutDigits field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.CUTDIGITS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigits must be a valid\n                      greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.outboundRoute.alias" ng-change="vm.onActionsTabSelection()" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'alias\'].$error" ng-show="generalForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.outboundRoute.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /SETTINGS TAB --\x3e\n      \x3c!-- ACTIONS TAB --\x3e\n      <md-tab md-on-select="vm.onActionsTabSelection()">\n        <md-tab-label>\n          <span translate="VOICE.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="outbound-route-detail-form-container no-padding no-margin">\n            <div class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- APPLICATIONS LIST --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm.crudPermissions.canEdit">\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider class="no-margin"></md-divider>\n                <md-list ng-sortable="vm.sortableAppsOptions">\n                  <md-list-item class="handle" ng-repeat="a in vm.apps">\n                    <div layout="row">\n                      <md-icon md-font-icon="icon-apps" class="s16 mr-15"></md-icon>\n                      <p class="text-truncate" translate="VOICE.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias ||\n                        a.appType}}</p>\n                    </div>\n                  </md-list-item>\n                </md-list>\n              </div>\n              \x3c!-- /APPLICATIONS LIST --\x3e\n              <div flex></div>\n              \x3c!-- ROUTING --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm.crudPermissions.canEdit ? 75 : 100}}">\n                <div ng-if="vm.pendingChanges" class="p-10 md-amber-300-bg">\n                  <md-icon md-font-icon="icon-information-outline" aria-label="Save reminder"></md-icon>\n                  <span class="no-margin font-size-12 line-height-30" translate="VOICE.HELP.SAVE_ROUTES"></span>\n                </div>\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar query="vm.query" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm.selectedApplications.length}}\n                      {{vm.selectedApplications.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedApplications($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm.selectedApplications">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm.sortableRoutingOptions">\n                      <tr md-row md-select="a" md-select-id="id" ng-repeat="a in vm.applications.rows | filter:vm.query.filter as results">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)">{{a.app.toLowerCase() ===\n                          \'agi\' ? \'Cally-Square\' : a.app | ucfirst}}<span ng-if="a.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)"><span class="text-truncate actionAppData">{{a.appdata}}</span></td>\n                        <td md-cell ng-click="vm.editInterval($event, $index)">{{a.IntervalId ? \'From List\' :\n                          a.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{a.IntervalId ? \'From List\' : (a.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell ng-if="!vm.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editApplication($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                <md-button ng-click="vm.deleteApplication(a, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-class="{ \'ng-cloak\': results.length > 0 }">\n                        <td md-cell colspan="6">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No applications\n                            available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                    <tfoot md-foot>\n                      <tr md-row>\n                        <td md-cell colspan="7">\n                          <span><em translate="VOICE.LEGEND.CUSTOM_APPLICATION">(*) - Custom application.</em></span>\n                        </td>\n                      </tr>\n                    </tfoot>\n                  </table>\n                </md-table-container>\n              </div>\n              \x3c!-- /ROUTING --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /ACTIONS TAB --\x3e\n    </md-tabs>\n  </div>\n  \x3c!-- /CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/outboundRoutes/outboundRoutes.html",'<div id="outbound-routes" class="page-layout simple left-sidenav inner-sidenav">\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.OUTBOUNDROUTES">OutboundRoutes</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n  <div ng-show="vm.selectedOutboundRoutes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedOutboundRoutes = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-outbound-routes-count">\n          <span>{{ vm.selectedOutboundRoutes.length }}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectedOutboundRoutes = vm.outboundRoutes.rows" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.selectedOutboundRoutes = []" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedOutboundRoutes" csv-label="true" filename="outbound_routes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedOutboundRoutes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedOutboundRoutes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOutboundRoutes">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.PHONENUMBER\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.outboundRoutes.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="route" md-select-id="id" ng-repeat="route in vm.outboundRoutes.rows">\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditOutboundRoute($event, route)" md-cell class="id ">{{ route.id }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditOutboundRoute($event, route)" md-cell class="exten ">{{ route.exten }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditOutboundRoute($event, route)" md-cell class="description ">{{ route.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editRoute(route)" translate="VOICE.EDIT_OUTBOUNDROUTE">\n                          Edit OutboundRoute\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteConfirm(route, $event)" translate="VOICE.DELETE_OUTBOUNDROUTE">\n                          Delete OutboundRoute\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'VOICE.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'VOICE.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'VOICE.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.outboundRoutes.count }}" md-on-paginate="vm.getOutboundRoutes" md-page-select>\n        </md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-outbound-route-button" ng-click="vm.createOrEditOutboundRoute($event)" aria-label="add outbound route" translate translate-attr-aria-label="VOICE.ADD_OUTBOUNDROUTE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n</div>'),e.put("app/main/apps/voice/views/realtime/abandonedcalls/view.html",'<md-toolbar class="md-table-toolbar md-default table-header">\n  <div class="md-toolbar-tools" layout="row" layout-align="center center">\n    <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n    <ms-search-bar on-search="vm.getAbandonedCalls()" query="vm.query" on-collapse="vm.query.filter = undefined" debounce="300">\n    </ms-search-bar>\n    <div flex></div>\n\n    <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getAbandonedCalls()"></ms-quick-filter>\n\n    <md-button class="md-icon-button" ng-click="vm.refresh && vm.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n      <md-icon md-font-icon="icon-reload"></md-icon>\n      <md-tooltip ng-if="vm.showTooltip" md-visible="vm.showTooltip">{{\'DASHBOARDS.CLICKRELOAD\' | translate}}\n      </md-tooltip>\n    </md-button>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAbandonedCalls">\n      <tr md-row>\n        <th md-column md-order-by="id">ID</th>\n        <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n        <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n        <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n        <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n        <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.abandonedCalls.rows.length">\n        <td md-cell colspan="12">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="call in vm.abandonedCalls.rows">\n        <td md-cell class="id">{{call.id}}</td>\n        <td md-cell class="firstName" privacy ng-cloak>{{call.calleridname}}</td>\n        <td md-cell class="list" privacy ng-cloak>{{call.calleridnum}}</td>\n        <td md-cell class="list">{{vm.queuesMap[call.queue]}}</td>\n        <td md-cell class="list">\n          {{call.queuecallerabandonAt ? (call.queuecallerabandonAt | formatdate) : (call.queuecallerexitAt | formatdate) }}\n        </td>\n        <td md-cell class="list">{{call.lastAssignedTo}}</td>\n        <td md-cell class="list">{{ call.disposition }}</td>\n        <td md-cell class="list">{{ call.secondDisposition }}</td>\n        <td md-cell class="list">{{ call.thirdDisposition }}</td>\n        <td md-cell class="actions">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="2">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-menu>\n                  <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.ASSIGNTO">\n                    Assigned\n                    to</md-button>\n                  <md-menu-content>\n                    <md-menu-item ng-if="call.lastAssignedTo">\n                      <md-button ng-click="vm.assignTo(call)"><em translate="DASHBOARDS.NONE">Not Assigned</em>\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.agents.rows.length" ng-repeat="agent in vm.agents.rows">\n                      <md-button ng-click="vm.assignTo(call,agent)">{{agent.name}}</md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.dispose(call)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">\n                  Dispose\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.abandonedCalls.count}}" md-on-paginate="vm.getAbandonedCalls" md-page-select></md-table-pagination>'),e.put("app/main/apps/voice/views/realtime/outbound_calls/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.OUTBOUND_CALLS">Ooutbound Calls</span>\n  </div>\n</md-toolbar>\n\n\x3c!-- OUTBOUNDS TABLE --\x3e\n<md-table-container>\n  <table md-table>\n    <thead md-head>\n      <tr md-row>\n        <th md-column width="30px"></th>\n        <th md-column>{{ \'VOICE.SOURCE\' | translate }}</th>\n        <th md-column>{{ \'VOICE.DESTINATION\' | translate }}</th>\n        <th md-column>{{ \'VOICE.ALIAS\' | translate }}</th>\n        <th md-column>{{ \'VOICE.DURATION\' | translate }}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.calls.rows.length">\n        <td md-cell colspan="5">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="call in vm.calls.rows | filter: vm.query.filter | limitTo: vm.query.limit: (vm.query.page - 1) * vm.query.limit">\n        <td md-cell>\n          <i ng-class="vm.channelStatus[call.channelstatedesc.toLowerCase()]"></i>\n        </td>\n        <td md-cell privacy ng-cloak>\n          {{call.calleridname}}, {{call.calleridnum}}\n          <span class="text-boxed" ng-if="call.answered">\n            <timer ng-if="call.answertime" start-time="call.answertime"></timer>\n          </span>\n        </td>\n        <td md-cell privacy ng-cloak>{{call.exten}}</td>\n        <td md-cell>{{call.routealias}}</td>\n        <td md-cell>\n          <span class="text-boxed" ng-if="call.channelstatedesc.toLowerCase() !== \'hangup\'">\n            <timer ng-if="call.starttime" start-time="call.starttime"></timer>\n          </span>\n          <span class="text-boxed" ng-if="call.channelstatedesc.toLowerCase() === \'hangup\'" translate="VOICE.CLOSING">Closing</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.calls.count}}"></md-table-pagination>\n\x3c!-- / OUTBOUNDS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/realtime/queue_calls/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.QUEUE_CALLS">Queue Calls</span>\n  </div>\n</md-toolbar>\n\x3c!-- QUEUES TABLE --\x3e\n<md-table-container>\n  <table md-table>\n    <thead md-head>\n      <tr md-row>\n        <th md-column width="30px"></th>\n        <th md-column>{{ \'VOICE.DID\' | translate }}</th>\n        <th md-column>{{ \'VOICE.ALIAS\' | translate }}</th>\n        <th md-column>{{ \'VOICE.QUEUE\' | translate }}</th>\n        <th md-column>{{ \'VOICE.CALLER\' | translate }}</th>\n        <th md-column>{{ \'VOICE.AGENT\' | translate }}</th>\n        <th md-column>{{ \'VOICE.DURATION\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.getSize(vm.rpcVoiceQueuesChannels)">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(key, channel) in vm.rpcVoiceQueuesChannels | limitObjectFromTo: vm.queryChannels.limit:(vm.queryChannels.page - 1) * vm.queryChannels.limit">\n        <td md-cell>\n          <md-icon ng-if="channel.queuecallerleaveAt" md-font-icon="icon-phone-in-talk green-fg"></md-icon>\n          <md-icon ng-if="!channel.queuecallerleaveAt" md-font-icon="icon-phone-incoming md-accent"></md-icon>\n        </td>\n        <td md-cell>{{channel.exten}}</td>\n        <td md-cell>{{channel.routealias}}</td>\n        <td md-cell>{{channel.queue}}</td>\n        <td md-cell privacy ng-cloak>\n          <span>{{channel.calleridname}}, {{channel.calleridnum}}</span>\n        </td>\n        <td md-cell>\n          <span ng-if="channel.queuecallerleaveAt">\n            {{channel.connectedlinename}}, {{channel.connectedlinenum}}\n            <span class="text-boxed">\n              <timer start-time="channel.queuecallerleaveAt"></timer>\n            </span>\n          </span>\n          <span ng-if="!channel.queuecallerleaveAt" class="text-boxed">\n            {{ \'VOICE.WAITING_FOR_AGENT\' | translate }}\n            <timer start-time="channel.queuecallerjoinAt"></timer>\n          </span>\n        </td>\n        <td md-cell>\n          <span class="text-boxed">\n            <timer start-time="channel.queuecallerjoinAt"></timer>\n          </span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="2">\n              <md-menu-item>\n                <md-button ng-click="vm.hangup(channel.uniqueid)" translate="VOICE.HANGUP">\n                  Hangup\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.redirectToNumber($event, channel.uniqueid)" translate="VOICE.REDIRECT_TO_NUMBER">\n                  Number\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-menu class="no-margin">\n                  <md-button ng-mouseenter="vm.getAvailableAgents()" translate="VOICE.REDIRECT_TO_AGENT">\n                    Redirect to Agent</md-button>\n                  <md-menu-content>\n                    <md-menu-item ng-if="!vm.availableAgents">\n                      <md-progress-circular class="md-accent auto-margin" md-diameter="32" md-mode="indeterminate">\n                      </md-progress-circular>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.availableAgents.length > 0" ng-repeat="agent in vm.availableAgents">\n                      <md-button ng-click="vm.redirectToAgent(channel.uniqueid, agent.name, agent.context)">\n                        {{agent.name}}</md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.availableAgents.length === 0">\n                      <span>No agents available</span>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.queryChannels.limit" md-page="vm.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm.getSize(vm.rpcVoiceQueuesChannels)}}" md-page-select></md-table-pagination>\n\x3c!-- / QUEUES TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/realtime/queue_params/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.QUEUE_PARAMETERS">Params</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- QUEUE TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column>{{\'\n                        VOICE.NAME\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.TOTAL_OFFERED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.ANSWERED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.ABANDONED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.UNMANAGED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.AVG_HOLD_TIME\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.AVG_DURATION\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.AVG_BILLABLE\' | translate}}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(id, queue) in vm.queues">\n        <td md-cell>\n          <span>{{queue.name}}</span>\n        </td>\n        <td md-cell>\n          \x3c!-- <span class="font-size-20 grey-fg">{{queue.total || 0}}</span> --\x3e\n          <span class="font-size-20 grey-fg">{{ (queue.answered || 0) + (queue.abandoned || 0) + (queue.unmanaged || 0) }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered || 0}} ({{(queue.total) ? (queue.answered || 0) * 100/queue.total : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.abandoned || 0}} ({{(queue.total) ? (queue.abandoned || 0) * 100/queue.total : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.unmanaged || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.total ? ((queue.sumHoldTime || 0) / queue.total) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{(queue.total ? ((queue.sumDuration || 0) / queue.total) : 0) | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered ? ((queue.sumBillable || 0) / queue.answered) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>\n\x3c!-- / QUEUE TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n        <th md-column>{{ \'VOICE.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'VOICE.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'VOICE.TALKING\' | translate }}</th>\n        <th md-column>{{ \'VOICE.BUSY\' | translate }}</th>\n        <th md-column>{{ \'VOICE.WAITING\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedInDb }} ({{ queue.loggedIn }})</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.talking }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.busy }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="VOICE.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="VOICE.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/voice/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.TELEPHONES">Telephones</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.TRUNKS">Trunks</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.QUEUE_CALLS">Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ABANDONEDCALLS">Abandoned Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.QUEUE_PARAMS">Queue Parameters</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.OUTBOUND_CALLS">Outbound Calls</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/realtime/telephones/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.TELEPHONES">Telephones</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getTelephones()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- AGENT TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTelephones">\n      <tr md-row>\n        <th md-column md-order-by="fullname">{{ \'VOICE.ACCOUNTNAME\' | translate }}</th>\n        <th md-column md-order-by="internal">{{ \'VOICE.INTERNAL\' | translate }}</th>\n        <th md-column>{{ \'VOICE.PHONE_STATE\' | translate }}</th>\n        <th md-column>{{ \'VOICE.PHONE_STATUS\' | translate }}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.telephones">\n        <td md-cell colspan="4">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="telephone" md-select-id="id" ng-repeat="(id, telephone) in vm.telephones">\n        <td md-cell>{{telephone.fullname}}</td>\n        <td md-cell>{{telephone.internal}}</td>\n        <td md-cell>\n          <i ng-class="vm.stateClass[telephone.state]">\n            <md-tooltip>{{\'VOICE.\' + telephone.state | uppercase | translate}}</md-tooltip>\n          </i>\n        </td>\n        <td md-cell>\n          <i ng-class="vm.statusClass[telephone.status]">\n            <md-tooltip>{{\'VOICE.\' + telephone.status | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="telephone.status === \'registered\'" class="text-boxed">{{telephone.address}}</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getTelephones" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/realtime/trunks/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.TRUNKS">Telephones</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getTrunks()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- TRUNKS TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head>\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTrunks">\n        <tr md-row>\n          <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n          <th md-column>{{ \'VOICE.TRUNK_STATUS\' | translate }}</th>\n          <th md-column>{{ \'VOICE.REGISTRY\' | translate }}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.trunks">\n        <td md-cell colspan="3">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(id, trunk) in vm.trunks">\n        <td md-cell>{{trunk.name}}</td>\n        <td md-cell>\n          <i ng-class="vm.statusClass[trunk.status.toLowerCase()]">\n            <md-tooltip>{{\'VOICE.\' + trunk.status | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.status === \'registered\'" class="text-boxed">{{trunk.address}}</span>\n        </td>\n        <td md-cell>\n          <i ng-if="trunk.registry" ng-class="(trunk.stateRegistry.toLowerCase() === \'registered\') ? \'green-300-fg icon-checkbox-marked-circle\' : \'red-300-fg icon-close-circle\'">\n            <md-tooltip>{{\'VOICE.\' + trunk.stateRegistry | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.registry && trunk.host && trunk.port" class="text-boxed">{{trunk.host}}:{{trunk.port}}</span>\n          <span ng-if="!trunk.registry" translate="VOICE.NO_REGISTRY">\n            No Registry\n          </span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item>\n                <md-button ng-click="vm.goToTrunk($event, trunk)" translate="VOICE.EDIT_TRUNK">\n                  Edit Trunk\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getTrunks" md-page-select></md-table-pagination>\n\x3c!-- / TRUNKS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/voicemails/create/dialog.html",'<md-dialog class="voicemail-dialog" aria-label="New Voicemail">\n  <form name="voicemailForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.FULLNAME">FullName</label>\n        <input type="text" name="fullname" ng-model="vm.voicemail.fullname" ng-required="true" autofocus>\n\n        <div ng-messages="voicemailForm[\'fullname\'].$error" ng-show="voicemailForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.FULLNAME_REQUIRED">FullName field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.voicemail.email" ng-required="vm.voicemail.attach === \'yes\'">\n\n        <div ng-messages="voicemailForm[\'email\'].$error" ng-show="voicemailForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="VOICE.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.voicemail.password" placeholder="Password" translate translate-attr-placeholder="VOICE.PASSWORD" required>\n        <div ng-messages="voicemailForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.newVoicemail ">\n        <label translate="VOICE.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="voicemailForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="VOICE.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="VOICE.MAILBOX">MailBox</label>\n        <input type="text" name="mailbox" ng-model="vm.voicemail.mailbox" ng-required="true" ng-disabled="!vm.newVoicemail">\n\n        <div ng-messages="voicemailForm[\'mailbox\'].$error" ng-show="voicemailForm[\'mailbox\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.MAILBOX_REQUIRED">MailBox field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ATTACH">Attach</label>\n        <md-select name="attach" ng-model="vm.voicemail.attach">\n\n          <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n          <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="voicemailForm[\'attach\'].$error" ng-show="voicemailForm[\'attach\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ATTACH_REQUIRED">Attach field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVoicemail" ng-click="vm.saveVoicemail()" class="send-button md-accent md-raised" ng-disabled="voicemailForm.$invalid || voicemailForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVoicemail" ng-click="vm.addNewVoicemail()" class="send-button md-accent md-raised" ng-disabled="voicemailForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICEMAIL" translate-attr-aria-label="VOICE.ADD_VOICEMAIL">\n          ADD VOICEMAIL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVoicemail" ng-click="vm.deleteVoicemail($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicemails/edit/view.html",'<div id="voice-voicemail" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-voicemails-button md-icon-button" aria-label="Go to voicemails" ng-click="vm.gotoVoicemails()" translate translate-attr-aria-label="VOICE.GO_TO_VOICEMAILS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="voicemail-image" hide-xs>\n          <img ng-src="assets/images/business/voicemails.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.voicemail.id}}\n            <span ng-if="vm.voicemail.name">{{vm.voicemail.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.voicemail.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVoicemail()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (advancedForm.$invalid) || (messagesForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voicemail-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.FULLNAME">FullName</label>\n                <input type="text" name="fullname" ng-model="vm.voicemail.fullname" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'fullname\'].$error" ng-show="generalForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.FULLNAME_REQUIRED">FullName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.voicemail.email" ng-required="vm.voicemail.attach === \'yes\'" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="VOICE.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.voicemail.password" placeholder="Password" translate translate-attr-placeholder="VOICE.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="VOICE.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block" ng-if="vm.newVoicemail ">\n                <label translate="VOICE.CONFIRM_PASSWORD">Confirm Password</label>\n                <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n                <div ng-messages="generalForm.confirmPassword.$error" role="alert" multiple>\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n                  </div>\n                  <div ng-message="passwordMatch">\n                    <span translate="VOICE.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAILBOX">MailBox</label>\n                <input type="text" name="mailbox" ng-model="vm.voicemail.mailbox" ng-required="true" disabled>\n\n                <div ng-messages="generalForm[\'mailbox\'].$error" ng-show="generalForm[\'mailbox\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAILBOX_REQUIRED">MailBox field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.VOICEMAIL_CONTEXT">Voicemail_Context</label>\n                <md-select name="context" ng-model="vm.voicemail.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.VOICEMAIL_CONTEXT"></span></div>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.VOICEMAIL_CONTEXT_REQUIRED">Voicemail_Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voicemail-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TIMEZONE">TimeZone</label>\n                <input type="text" name="tz" ng-model="vm.voicemail.tz" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'tz\'].$error" ng-show="advancedForm[\'tz\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TIMEZONE_REQUIRED">TimeZone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ATTACH">Attach</label>\n                <md-select name="attach" ng-model="vm.voicemail.attach" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'attach\'].$error" ng-show="advancedForm[\'attach\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ATTACH_REQUIRED">Attach field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ENVELOPE">Envelope</label>\n                <md-select name="envelope" ng-model="vm.voicemail.envelope" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'envelope\'].$error" ng-show="advancedForm[\'envelope\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ENVELOPE_REQUIRED">Envelope field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DELETE">Delete</label>\n                <md-select name="delete" ng-model="vm.voicemail.delete" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'delete\'].$error" ng-show="advancedForm[\'delete\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DELETE_REQUIRED">Delete field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.EMAILBODY">EmailBody</label>\n                <input type="text" name="emailbody" ng-model="vm.voicemail.emailbody" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'emailbody\'].$error" ng-show="advancedForm[\'emailbody\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.EMAILBODY_REQUIRED">EmailBody field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.EMAILSUBJECT">EmailSubject</label>\n                <input type="text" name="emailsubject" ng-model="vm.voicemail.emailsubject" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'emailsubject\'].$error" ng-show="advancedForm[\'emailsubject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.EMAILSUBJECT_REQUIRED">EmailSubject field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAXSECONDS">MaxSeconds</label>\n                <input type="number" name="maxsecs" ng-model="vm.voicemail.maxsecs" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'maxsecs\'].$error" ng-show="advancedForm[\'maxsecs\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAXSECONDS_REQUIRED">MaxSeconds field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MAXSECONDS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxSeconds must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAXMESSAGES">MaxMessages</label>\n                <input type="number" name="maxmsg" ng-model="vm.voicemail.maxmsg" min="0" max="9999" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'maxmsg\'].$error" ng-show="advancedForm[\'maxmsg\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAXMESSAGES_REQUIRED">MaxMessages field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MAXMESSAGES_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxMessages must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="VOICE.ERRORS.MAXMESSAGES_MUST_BE_LESS_THAN_OR_EQUAL_TO">MaxMessages must be a valid greater or equal than</span> <span>9999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.MESSAGES">MESSAGES</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voicemail-detail-form-container messages md-background-bg md-whiteframe-1dp">\n            <div ng-controller="VoicemailMessagesController as vm_dc" ng-init="vm_dc.init(vm.voicemail, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedVoicemailMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="VOICE.MESSAGES">Messages</span>\n                  <ms-search-bar on-search="vm_dc.getVoicemailMessages()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedVoicemailMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedVoicemailMessages.length}} {{vm_dc.selectedVoicemailMessages.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedVoicemailMessages" csv-label="true" filename="voicemails.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedVoicemailMessages($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedVoicemailMessages" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getVoicemailMessages">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'VOICE.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="callerid">\n                        {{ \'VOICE.CALLER_ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="duration">\n                        {{ \'VOICE.DURATION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="audio">\n                        {{ \'VOICE.AUDIO\' | translate }}\n                      </th>\n                      <th md-column md-order-by="stamp">\n                        {{ \'VOICE.RECEIVED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="message" md-select-id="id" ng-repeat="message in vm_dc.voicemailMessages.rows">\n                      <td md-cell>\n                        {{message.id}}\n                      </td>\n                      <td md-cell>\n                        {{message.callerid}}\n                      </td>\n                      <td md-cell>\n                        {{message.duration}}\n                      </td>\n                      <td md-cell>\n                        \x3c!-- audio recording directive --\x3e\n                        <ms-recording id="message.id" model="\'voiceMailMessage\'"></ms-recording>\n                        \x3c!-- / audio recording directive --\x3e\n                      </td>\n                      <td md-cell>\n                        {{ message.stamp | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(message, $event)" translate="VOICE.DELETE_MESSAGE">\n                                Delete Message\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.voicemailMessages.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="VOICE.NO_MESSAGE_AVAILABLE">No message available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.voicemailMessages.count}}" md-on-paginate="vm_dc.getVoicemailMessages" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/voicemails/voicemails.html",'<div id="voicemails" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICEMAILS">Voicemails</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoicemails.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoicemails =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voicemails-count">\n          <span>{{vm.selectedVoicemails.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoicemails()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoicemails()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoicemails" csv-label="true" filename="voicemails.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoicemails($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICEMAIL TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoicemails" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoicemails">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="fullname">{{ \'VOICE.FULLNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'VOICE.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="mailbox">{{ \'VOICE.MAILBOX\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voicemails.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voicemail" md-select-id="id" ng-repeat="voicemail in vm.voicemails.rows">\n                <td md-cell ng-if="voicemail.userpic"><img class="avatar" alt="{{voicemail.name}}" ng-src="api/users/{{voicemail.id}}/avatar" /></td>\n                <td md-cell ng-if="!voicemail.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voicemail.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="id ">{{voicemail.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="fullname ">{{voicemail.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="email ">{{voicemail.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="mailbox ">{{voicemail.mailbox}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(voicemail, $event    )" translate="VOICE.EDIT_VOICEMAIL">\n                          Edit Voicemail\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voicemail, $event    )" translate="VOICE.DELETE_VOICEMAIL">\n                          Delete Voicemail\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voicemails.count}}" md-on-paginate="vm.getVoicemails" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICEMAIL TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VOICEMAIL BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-voicemail-button" ng-click="vm.createOrEditVoicemail($event)" aria-label="add voicemail" translate translate-attr-aria-label="VOICE.ADD_VOICEMAIL">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VOICEMAIL BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/voicePrefixes/create/dialog.html",'<md-dialog class="voicePrefix-dialog" aria-label="New voicePrefix">\n  <form name="voicePrefixForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.voicePrefix.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus>\n\n        <div class="hint"><span translate="VOICE.HELP.NAME"></span></div>\n        <div ng-messages="voicePrefixForm[\'name\'].$error" ng-show="voicePrefixForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.OUTBOUNDROUTE">OutboundRoute</label>\n        <md-select name="VoiceExtensionId" ng-model="vm.voicePrefix.VoiceExtensionId" required>\n          <md-option ng-value="VoiceExtensionId.id" ng-repeat="VoiceExtensionId in vm.outboundRoutes" ng-disabled="VoiceExtensionId.canSelect === false">{{ VoiceExtensionId.exten }}</md-option>\n        </md-select>\n        <div ng-messages="voicePrefixForm[\'VoiceExtensionId\'].$error" ng-show="voicePrefixForm[\'VoiceExtensionId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.OUTBOUNDROUTE_REQUIRED">OutboundRoute field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CALLERIDALL">CallerIdAll</label>\n        <input type="text" name="callerIdAll" ng-model="vm.voicePrefix.callerIdAll" ng-pattern="/&quot;(.*)&quot;\\s&lt;(.*?)&gt;$/">\n\n        <div class="hint"><span translate="VOICE.HELP.CALLERIDALL"></span></div>\n        <div ng-messages="voicePrefixForm[\'callerIdAll\'].$error" ng-show="voicePrefixForm[\'callerIdAll\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CALLERIDALL_REQUIRED">CallerIdAll field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.CALLERIDALL_MUST_VALID_PATTERN" translate-values="{ regex: \'/&quot;(.*)&quot;\\s&lt;(.*?)&gt;$/\' }">CallerIdAll must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.voicePrefix.description">\n\n        <div ng-messages="voicePrefixForm[\'description\'].$error" ng-show="voicePrefixForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newvoicePrefix" ng-click="vm.savevoicePrefix()" class="send-button md-accent md-raised" ng-disabled="voicePrefixForm.$invalid || voicePrefixForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newvoicePrefix" ng-click="vm.addNewvoicePrefix()" class="send-button md-accent md-raised" ng-disabled="voicePrefixForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICEPREFIX" translate-attr-aria-label="VOICE.ADD_VOICEPREFIX">\n          ADD VOICEPREFIX\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newvoicePrefix" ng-click="vm.deletevoicePrefix($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicePrefixes/edit/agentadd/agentadd.html",'<md-dialog class="voicePrefix-dialog" aria-label="voicePrefix" ng-init="vm.onInit()">\n  <form name="voicePrefixForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.AGENTADD_VOICEPREFIX">Add Agent to voicePrefix</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicePrefixes/edit/teamadd/teamadd.html",'<md-dialog class="voicePrefix-dialog" aria-label="voicePrefix" ng-init="vm.onInit()">\n  <form name="voicePrefixForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicePrefixes/voicePrefixes.html",'<div id="voicePrefixes" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICEPREFIXES">VoicePrefixes</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoicePrefixes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoicePrefixes =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voicePrefixes-count">\n          <span>{{vm.selectedVoicePrefixes.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoicePrefixes()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoicePrefixes()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoicePrefixes" csv-label="true" filename="voicePrefixes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoicePrefixes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICEPREFIX TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoicePrefixes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoicePrefixes">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="VoiceExtensionId">{{ \'VOICE.OUTBOUNDROUTE\' | translate }}</th>\n                <th md-column md-order-by="callerIdAll">{{ \'VOICE.CALLERIDALL\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voicePrefixes.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voicePrefix" md-select-id="id" ng-repeat="voicePrefix in vm.voicePrefixes.rows">\n                <td md-cell ng-if="voicePrefix.userpic"><img class="avatar" alt="{{voicePrefix.name}}" ng-src="api/users/{{voicePrefix.id}}/avatar" /></td>\n                <td md-cell ng-if="!voicePrefix.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voicePrefix.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="id ">{{voicePrefix.id}}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="name ">{{voicePrefix.name}}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="VoiceExtensionId ">{{ (vm.outboundRoutes | filter : {\'id\':voicePrefix.VoiceExtensionId} : true)[0].exten }}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="callerIdAll ">{{voicePrefix.callerIdAll}}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="description ">{{voicePrefix.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(voicePrefix, $event    )" translate="VOICE.EDIT_VOICEPREFIX">\n                          Edit voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(voicePrefix, $event    )" translate="VOICE.AGENTADD_VOICEPREFIX">\n                          AgentAdd voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(voicePrefix, $event    )" translate="VOICE.TEAMADD_VOICEPREFIX">\n                          teamadd voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voicePrefix, $event    )" translate="VOICE.DELETE_VOICEPREFIX">\n                          Delete voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voicePrefixes.count}}" md-on-paginate="vm.getVoicePrefixes" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICEPREFIX TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VOICEPREFIX BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-voicePrefix-button" ng-click="vm.createOrEditvoicePrefix($event)" aria-label="add voicePrefix" translate translate-attr-aria-label="VOICE.ADD_VOICEPREFIX">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VOICEPREFIX BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/voiceQueues/create/dialog.html",'<md-dialog class="voiceQueue-dialog" aria-label="New VoiceQueue">\n  <form name="voiceQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.voiceQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newVoiceQueue">\n\n        <div class="hint"><span translate="VOICE.HELP.NAME"></span></div>\n        <div ng-messages="voiceQueueForm[\'name\'].$error" ng-show="voiceQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.voiceQueue.strategy" required>\n          <md-option ng-value="\'ringall\'">Ringall</md-option>\n          <md-option ng-value="\'rrmemory\'">Round Robin Memory</md-option>\n          <md-option ng-value="\'leastrecent\'">Least Recent</md-option>\n          <md-option ng-value="\'fewestcalls\'">Fewest Calls</md-option>\n          <md-option ng-value="\'random\'">Random</md-option>\n          <md-option ng-value="\'linear\'">Linear</md-option>\n          <md-option ng-value="\'wrandom\'">Weight Random</md-option>\n        </md-select>\n        <div ng-messages="voiceQueueForm[\'strategy\'].$error" ng-show="voiceQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.voiceQueue.description">\n\n        <div ng-messages="voiceQueueForm[\'description\'].$error" ng-show="voiceQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVoiceQueue" ng-click="vm.saveVoiceQueue()" class="send-button md-accent md-raised" ng-disabled="voiceQueueForm.$invalid || voiceQueueForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVoiceQueue" ng-click="vm.addNewVoiceQueue()" class="send-button md-accent md-raised" ng-disabled="voiceQueueForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICEQUEUE" translate-attr-aria-label="VOICE.ADD_VOICEQUEUE">\n          ADD VOICEQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVoiceQueue" ng-click="vm.deleteVoiceQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",'<md-dialog class="voiceQueue-dialog" aria-label="voiceQueue" ng-init="vm.onInit()">\n  <form name="voiceQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.AGENTADD_VOICEQUEUE">Add Agent to voiceQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="VOICE.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="voiceQueueForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",'<md-dialog class="voiceQueue-dialog" aria-label="voiceQueue" ng-init="vm.onInit()">\n  <form name="voiceQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="VOICE.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="voiceQueueForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceQueues/edit/view.html",'<div id="voice-voiceQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-voiceQueues-button md-icon-button" aria-label="Go to voiceQueues" ng-click="vm.gotoVoiceQueues()" translate translate-attr-aria-label="VOICE.GO_TO_VOICEQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="voiceQueue-image" hide-xs>\n          <img ng-src="assets/images/business/voiceQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.voiceQueue.id}}\n            <span ng-if="vm.voiceQueue.name">{{vm.voiceQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.voiceQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.voiceQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="VOICE.TEAMADD_VOICEQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.voiceQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="VOICE.AGENTADD_VOICEQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.voiceQueue, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="VOICE.GOTO_VOICEQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVoiceQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (settingsForm.$invalid) || (announcementsForm.$invalid) || (advancedForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.voiceQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="VOICE.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.voiceQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ringall\'">Ringall</md-option>\n                  <md-option ng-value="\'rrmemory\'">Round Robin Memory</md-option>\n                  <md-option ng-value="\'leastrecent\'">Least Recent</md-option>\n                  <md-option ng-value="\'fewestcalls\'">Fewest Calls</md-option>\n                  <md-option ng-value="\'random\'">Random</md-option>\n                  <md-option ng-value="\'linear\'">Linear</md-option>\n                  <md-option ng-value="\'wrandom\'">Weight Random</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TIMEOUT">Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.voiceQueue.timeout" min="0" value="15" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.TIMEOUT"></span></div>\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAXLENGTH">MaxLength</label>\n                <input type="number" name="maxlen" ng-model="vm.voiceQueue.maxlen" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.MAXLENGTH"></span></div>\n                <div ng-messages="generalForm[\'maxlen\'].$error" ng-show="generalForm[\'maxlen\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAXLENGTH_REQUIRED">MaxLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MAXLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RETRY">Retry</label>\n                <input type="number" name="retry" ng-model="vm.voiceQueue.retry" min="0" value="2" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.RETRY"></span></div>\n                <div ng-messages="generalForm[\'retry\'].$error" ng-show="generalForm[\'retry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RETRY_REQUIRED">Retry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.RETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Retry must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.WRAPUPTIME">WrapupTime</label>\n                <input type="number" name="wrapuptime" ng-model="vm.voiceQueue.wrapuptime" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.WRAPUPTIME"></span></div>\n                <div ng-messages="generalForm[\'wrapuptime\'].$error" ng-show="generalForm[\'wrapuptime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.WRAPUPTIME_REQUIRED">WrapupTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.WRAPUPTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WrapupTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.WEIGHT">Weight</label>\n                <input type="number" name="weight" ng-model="vm.voiceQueue.weight" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.WEIGHT"></span></div>\n                <div ng-messages="generalForm[\'weight\'].$error" ng-show="generalForm[\'weight\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.WEIGHT_REQUIRED">Weight field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.WEIGHT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Weight must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.JOINWHENEMPTY">JoinWhenEmpty</label>\n                <md-select name="joinempty" ng-model="vm.voiceQueue.joinempty" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'no\'" ng-disabled="vm.voiceQueue.joinempty.length === 1  && vm.voiceQueue.joinempty[0] === \'no\'">no</md-option>\n                  <md-option ng-value="\'yes\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'yes\'">yes</md-option>\n                  <md-option ng-value="\'strict\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'strict\'">strict</md-option>\n                  <md-option ng-value="\'loose\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'loose\'">loose</md-option>\n                  <md-option ng-value="\'paused\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'paused\'">paused</md-option>\n                  <md-option ng-value="\'penalty\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'penalty\'">penalty</md-option>\n                  <md-option ng-value="\'inuse\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'inuse\'">inuse</md-option>\n                  <md-option ng-value="\'ringing\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'ringing\'">ringing</md-option>\n                  <md-option ng-value="\'unavailable\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'unavailable\'">unavailable</md-option>\n                  <md-option ng-value="\'invalid\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'invalid\'">invalid</md-option>\n                  <md-option ng-value="\'unknown\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'unknown\'">unknown</md-option>\n                  <md-option ng-value="\'wrapup\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'wrapup\'">wrapup</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.JOINWHENEMPTY"></span></div>\n                <div ng-messages="generalForm[\'joinempty\'].$error" ng-show="generalForm[\'joinempty\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.JOINWHENEMPTY_REQUIRED">JoinWhenEmpty field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.LEAVEWHENEMPTY">LeaveWhenEmpty</label>\n                <md-select name="leavewhenempty" ng-model="vm.voiceQueue.leavewhenempty" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'no\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'no\'">no</md-option>\n                  <md-option ng-value="\'yes\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'yes\'">yes</md-option>\n                  <md-option ng-value="\'strict\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'strict\'">strict</md-option>\n                  <md-option ng-value="\'loose\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'loose\'">loose</md-option>\n                  <md-option ng-value="\'paused\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'paused\'">paused</md-option>\n                  <md-option ng-value="\'penalty\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'penalty\'">penalty</md-option>\n                  <md-option ng-value="\'inuse\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'inuse\'">inuse</md-option>\n                  <md-option ng-value="\'ringing\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'ringing\'">ringing</md-option>\n                  <md-option ng-value="\'unavailable\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'unavailable\'">unavailable</md-option>\n                  <md-option ng-value="\'invalid\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'invalid\'">invalid</md-option>\n                  <md-option ng-value="\'unknown\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'unknown\'">unknown</md-option>\n                  <md-option ng-value="\'wrapup\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'wrapup\'">wrapup</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.LEAVEWHENEMPTY"></span></div>\n                <div ng-messages="generalForm[\'leavewhenempty\'].$error" ng-show="generalForm[\'leavewhenempty\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.LEAVEWHENEMPTY_REQUIRED">LeaveWhenEmpty field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MUSICONHOLD">MusicOnHold</label>\n                <md-select name="musiconhold" ng-model="vm.voiceQueue.musiconhold" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="musiconhold.name" ng-repeat="musiconhold in vm.musiconholds" ng-disabled="musiconhold.canSelect === false">{{ musiconhold.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MUSICONHOLD"></span></div>\n                <div ng-messages="generalForm[\'musiconhold\'].$error" ng-show="generalForm[\'musiconhold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MUSICONHOLD_REQUIRED">MusicOnHold field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCETOAGENT">AnnounceToAgent</label>\n                <md-select name="announce" ng-model="vm.voiceQueue.announce" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'FALSE\'">None</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + announce.save_name" ng-repeat="announce in vm.sounds" ng-disabled="announce.canSelect === false">{{ announce.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCETOAGENT"></span></div>\n                <div ng-messages="generalForm[\'announce\'].$error" ng-show="generalForm[\'announce\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCETOAGENT_REQUIRED">AnnounceToAgent field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.voiceQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ANNOUNCEMENTS">ANNOUNCEMENTS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceQueue-detail-form-container settings md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.SETTINGS">SETTINGS</div>\n            </div>\n            <form name="settingsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCEFREQUENCY">AnnounceFrequency</label>\n                <input type="number" name="announce_frequency" ng-model="vm.voiceQueue.announce_frequency" min="0" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCEFREQUENCY"></span></div>\n                <div ng-messages="settingsForm[\'announce_frequency\'].$error" ng-show="settingsForm[\'announce_frequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCEFREQUENCY_REQUIRED">AnnounceFrequency field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.ANNOUNCEFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AnnounceFrequency must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MINANNOUNCEFREQUENCY">MinAnnounceFrequency</label>\n                <input type="number" name="min_announce_frequency" ng-model="vm.voiceQueue.min_announce_frequency" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.MINANNOUNCEFREQUENCY"></span></div>\n                <div ng-messages="settingsForm[\'min_announce_frequency\'].$error" ng-show="settingsForm[\'min_announce_frequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MINANNOUNCEFREQUENCY_REQUIRED">MinAnnounceFrequency field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MINANNOUNCEFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MinAnnounceFrequency must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PERIODICANNOUNCEFREQUENCY">PeriodicAnnounceFrequency</label>\n                <input type="number" name="periodic_announce_frequency" ng-model="vm.voiceQueue.periodic_announce_frequency" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.PERIODICANNOUNCEFREQUENCY"></span></div>\n                <div ng-messages="settingsForm[\'periodic_announce_frequency\'].$error" ng-show="settingsForm[\'periodic_announce_frequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PERIODICANNOUNCEFREQUENCY_REQUIRED">PeriodicAnnounceFrequency field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.PERIODICANNOUNCEFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">PeriodicAnnounceFrequency must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RANDOMPERIODICANNOUNCE">RandomPeriodicAnnounce</label>\n                <md-select name="random_periodic_announce" ng-model="vm.voiceQueue.random_periodic_announce" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.RANDOMPERIODICANNOUNCE"></span></div>\n                <div ng-messages="settingsForm[\'random_periodic_announce\'].$error" ng-show="settingsForm[\'random_periodic_announce\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RANDOMPERIODICANNOUNCE_REQUIRED">RandomPeriodicAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCEHOLDTIME">AnnounceHoldtime</label>\n                <md-select name="announce_holdtime" ng-model="vm.voiceQueue.announce_holdtime" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'once\'">Once</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCEHOLDTIME"></span></div>\n                <div ng-messages="settingsForm[\'announce_holdtime\'].$error" ng-show="settingsForm[\'announce_holdtime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCEHOLDTIME_REQUIRED">AnnounceHoldtime field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCECALLERPOSITION">AnnounceCallerPosition</label>\n                <md-select name="announce_position" ng-model="vm.voiceQueue.announce_position" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'limit\'">Limit</md-option>\n                  <md-option ng-value="\'more\'">More</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCECALLERPOSITION"></span></div>\n                <div ng-messages="settingsForm[\'announce_position\'].$error" ng-show="settingsForm[\'announce_position\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCECALLERPOSITION_REQUIRED">AnnounceCallerPosition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCEPOSITIONLIMIT">AnnouncePositionLimit</label>\n                <input type="number" name="announce_position_limit" ng-model="vm.voiceQueue.announce_position_limit" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCEPOSITIONLIMIT"></span></div>\n                <div ng-messages="settingsForm[\'announce_position_limit\'].$error" ng-show="settingsForm[\'announce_position_limit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCEPOSITIONLIMIT_REQUIRED">AnnouncePositionLimit field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.REPORTHOLDTIMEAGENT">ReportHoldtimeAgent</label>\n                <md-select name="reportholdtime" ng-model="vm.voiceQueue.reportholdtime" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.REPORTHOLDTIMEAGENT"></span></div>\n                <div ng-messages="settingsForm[\'reportholdtime\'].$error" ng-show="settingsForm[\'reportholdtime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.REPORTHOLDTIMEAGENT_REQUIRED">ReportHoldtimeAgent field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="voiceQueue-detail-form-container announcements md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.ANNOUNCEMENTS">ANNOUNCEMENTS</div>\n            </div>\n            <form name="announcementsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PERIODICANNOUNCE">PeriodicAnnounce</label>\n                <md-select name="periodic_announce" ng-model="vm.voiceQueue.periodic_announce" autofocus multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Default</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + periodic_announce.save_name" ng-repeat="periodic_announce in vm.sounds" ng-disabled="periodic_announce.canSelect === false">{{ periodic_announce.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.PERIODICANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'periodic_announce\'].$error" ng-show="announcementsForm[\'periodic_announce\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PERIODICANNOUNCE_REQUIRED">PeriodicAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.HOLDTIMEANNOUNCE">HoldTimeAnnounce</label>\n                <md-select name="queue_reporthold" ng-model="vm.voiceQueue.queue_reporthold" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_reporthold.save_name" ng-repeat="queue_reporthold in vm.sounds" ng-disabled="queue_reporthold.canSelect === false">{{ queue_reporthold.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.HOLDTIMEANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_reporthold\'].$error" ng-show="announcementsForm[\'queue_reporthold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.HOLDTIMEANNOUNCE_REQUIRED">HoldTimeAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.YOUARENEXTANNOUNCE">YouareNextAnnounce</label>\n                <md-select name="queue_youarenext" ng-model="vm.voiceQueue.queue_youarenext" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_youarenext.save_name" ng-repeat="queue_youarenext in vm.sounds" ng-disabled="queue_youarenext.canSelect === false">{{ queue_youarenext.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.YOUARENEXTANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_youarenext\'].$error" ng-show="announcementsForm[\'queue_youarenext\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.YOUARENEXTANNOUNCE_REQUIRED">YouareNextAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.THEREAREANNOUNCE">ThereareAnnounce</label>\n                <md-select name="queue_thereare" ng-model="vm.voiceQueue.queue_thereare" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_thereare.save_name" ng-repeat="queue_thereare in vm.sounds" ng-disabled="queue_thereare.canSelect === false">{{ queue_thereare.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.THEREAREANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_thereare\'].$error" ng-show="announcementsForm[\'queue_thereare\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.THEREAREANNOUNCE_REQUIRED">ThereareAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.WAITINGCALLSANNOUNCE">WaitingCallsAnnounce</label>\n                <md-select name="queue_callswaiting" ng-model="vm.voiceQueue.queue_callswaiting" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_callswaiting.save_name" ng-repeat="queue_callswaiting in vm.sounds" ng-disabled="queue_callswaiting.canSelect === false">{{ queue_callswaiting.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.WAITINGCALLSANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_callswaiting\'].$error" ng-show="announcementsForm[\'queue_callswaiting\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.WAITINGCALLSANNOUNCE_REQUIRED">WaitingCallsAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ESTIMATEDHOLDTIMEANNOUNCE">EstimatedHoldTimeAnnounce</label>\n                <md-select name="queue_holdtime" ng-model="vm.voiceQueue.queue_holdtime" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_holdtime.save_name" ng-repeat="queue_holdtime in vm.sounds" ng-disabled="queue_holdtime.canSelect === false">{{ queue_holdtime.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ESTIMATEDHOLDTIMEANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_holdtime\'].$error" ng-show="announcementsForm[\'queue_holdtime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ESTIMATEDHOLDTIMEANNOUNCE_REQUIRED">EstimatedHoldTimeAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MINUTESANNOUNCE">MinutesAnnounce</label>\n                <md-select name="queue_minutes" ng-model="vm.voiceQueue.queue_minutes" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_minutes.save_name" ng-repeat="queue_minutes in vm.sounds" ng-disabled="queue_minutes.canSelect === false">{{ queue_minutes.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MINUTESANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_minutes\'].$error" ng-show="announcementsForm[\'queue_minutes\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MINUTESANNOUNCE_REQUIRED">MinutesAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MINUTEANNOUNCE">MinuteAnnounce</label>\n                <md-select name="queue_minute" ng-model="vm.voiceQueue.queue_minute" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_minute.save_name" ng-repeat="queue_minute in vm.sounds" ng-disabled="queue_minute.canSelect === false">{{ queue_minute.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MINUTEANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_minute\'].$error" ng-show="announcementsForm[\'queue_minute\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MINUTEANNOUNCE_REQUIRED">MinuteAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SECONDSANNOUNCE">SecondsAnnounce</label>\n                <md-select name="queue_seconds" ng-model="vm.voiceQueue.queue_seconds" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_seconds.save_name" ng-repeat="queue_seconds in vm.sounds" ng-disabled="queue_seconds.canSelect === false">{{ queue_seconds.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SECONDSANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_seconds\'].$error" ng-show="announcementsForm[\'queue_seconds\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SECONDSANNOUNCE_REQUIRED">SecondsAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.THANKYOUANNOUNCE">ThankYouAnnounce</label>\n                <md-select name="queue_thankyou" ng-model="vm.voiceQueue.queue_thankyou" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_thankyou.save_name" ng-repeat="queue_thankyou in vm.sounds" ng-disabled="queue_thankyou.canSelect === false">{{ queue_thankyou.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.THANKYOUANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_thankyou\'].$error" ng-show="announcementsForm[\'queue_thankyou\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.THANKYOUANNOUNCE_REQUIRED">ThankYouAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceQueue-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.voiceQueue.acw" aria-label="AfterCallWork" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.AFTERCALLWORK">AfterCallWork</span></md-switch>\n                <div class="hint"><span translate="VOICE.HELP.AFTERCALLWORK"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.voiceQueue.acw" class="md-block">\n                <label translate="VOICE.AFTERCALLWORKDURATION">AfterCallWorkDuration</label>\n                <input type="number" name="acwTimeout" ng-model="vm.voiceQueue.acwTimeout" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.AFTERCALLWORKDURATION"></span></div>\n                <div ng-messages="advancedForm[\'acwTimeout\'].$error" ng-show="advancedForm[\'acwTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.AFTERCALLWORKDURATION_REQUIRED">AfterCallWorkDuration field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.AFTERCALLWORKDURATION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AfterCallWorkDuration must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.AUTOPAUSE">AutoPause</label>\n                <md-select name="autopause" ng-model="vm.voiceQueue.autopause" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'all\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.AUTOPAUSE"></span></div>\n                <div ng-messages="advancedForm[\'autopause\'].$error" ng-show="advancedForm[\'autopause\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.AUTOPAUSE_REQUIRED">AutoPause field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RINGINUSE">RingInUse</label>\n                <md-select name="ringinuse" ng-model="vm.voiceQueue.ringinuse" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.RINGINUSE"></span></div>\n                <div ng-messages="advancedForm[\'ringinuse\'].$error" ng-show="advancedForm[\'ringinuse\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RINGINUSE_REQUIRED">RingInUse field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MEMBERDELAY">MemberDelay</label>\n                <input type="number" name="memberdelay" ng-model="vm.voiceQueue.memberdelay" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.MEMBERDELAY"></span></div>\n                <div ng-messages="advancedForm[\'memberdelay\'].$error" ng-show="advancedForm[\'memberdelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MEMBERDELAY_REQUIRED">MemberDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MEMBERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MemberDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TIMEOUTRESTART">TimeoutRestart</label>\n                <md-select name="timeoutrestart" ng-model="vm.voiceQueue.timeoutrestart" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.TIMEOUTRESTART"></span></div>\n                <div ng-messages="advancedForm[\'timeoutrestart\'].$error" ng-show="advancedForm[\'timeoutrestart\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TIMEOUTRESTART_REQUIRED">TimeoutRestart field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MONITORFORMAT">MonitorFormat</label>\n                <md-select name="monitor_format" ng-model="vm.voiceQueue.monitor_format" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'wav49\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MONITORFORMAT"></span></div>\n                <div ng-messages="advancedForm[\'monitor_format\'].$error" ng-show="advancedForm[\'monitor_format\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MONITORFORMAT_REQUIRED">MonitorFormat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <input type="text" name="context" ng-model="vm.voiceQueue.context" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.CONTEXT"></span></div>\n                <div ng-messages="advancedForm[\'context\'].$error" ng-show="advancedForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SETINTERFACEVARIABLES">SetInterfaceVariables</label>\n                <md-select name="setinterfacevar" ng-model="vm.voiceQueue.setinterfacevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SETINTERFACEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setinterfacevar\'].$error" ng-show="advancedForm[\'setinterfacevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SETINTERFACEVARIABLES_REQUIRED">SetInterfaceVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SETQUEUEVARIABLES">SetQueueVariables</label>\n                <md-select name="setqueuevar" ng-model="vm.voiceQueue.setqueuevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SETQUEUEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueuevar\'].$error" ng-show="advancedForm[\'setqueuevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SETQUEUEVARIABLES_REQUIRED">SetQueueVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SETQUEUEENTRYVARIABLES">SetQueueEntryVariables</label>\n                <md-select name="setqueueentryvar" ng-model="vm.voiceQueue.setqueueentryvar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SETQUEUEENTRYVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueueentryvar\'].$error" ng-show="advancedForm[\'setqueueentryvar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SETQUEUEENTRYVARIABLES_REQUIRED">SetQueueEntryVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SERVICELEVEL">ServiceLevel</label>\n                <input type="number" name="servicelevel" ng-model="vm.voiceQueue.servicelevel" min="0" max="100" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.SERVICELEVEL"></span></div>\n                <div ng-messages="advancedForm[\'servicelevel\'].$error" ng-show="advancedForm[\'servicelevel\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SERVICELEVEL_REQUIRED">ServiceLevel field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.SERVICELEVEL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ServiceLevel must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="VOICE.ERRORS.SERVICELEVEL_MUST_BE_LESS_THAN_OR_EQUAL_TO">ServiceLevel must be a valid greater or equal than</span> <span>100</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.voiceQueue.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.voiceQueue.mandatoryDisposition" class="md-block">\n                <label translate="VOICE.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.voiceQueue.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="advancedForm[\'mandatoryDispositionPauseId\'].$error" ng-show="advancedForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/voiceQueues/voiceQueues.html",'<div id="voiceQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICEQUEUES">VoiceQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoiceQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoiceQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voiceQueues-count">\n          <span>{{vm.selectedVoiceQueues.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoiceQueues()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoiceQueues()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoiceQueues" csv-label="true" filename="voiceQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoiceQueues($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICEQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoiceQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'VOICE.STRATEGY\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voiceQueues.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voiceQueue" md-select-id="id" ng-repeat="voiceQueue in vm.voiceQueues.rows">\n                <td md-cell ng-if="voiceQueue.userpic"><img class="avatar" alt="{{voiceQueue.name}}" ng-src="api/users/{{voiceQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!voiceQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voiceQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="id ">{{voiceQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="name ">{{voiceQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="strategy ">{{ vm.arraystrategy[voiceQueue.strategy].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="description ">{{voiceQueue.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(voiceQueue, $event    )" translate="VOICE.EDIT_VOICEQUEUE">\n                          Edit VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(voiceQueue, $event    )" translate="VOICE.TEAMADD_VOICEQUEUE">\n                          teamadd VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(voiceQueue, $event    )" translate="VOICE.AGENTADD_VOICEQUEUE">\n                          agentadd VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voiceQueue, $event    )" translate="VOICE.DELETE_VOICEQUEUE">\n                          Delete VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(voiceQueue, $event    )" translate="VOICE.GOTOREALTIME_VOICEQUEUE">\n                          goToRealtime VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceQueues.count}}" md-on-paginate="vm.getVoiceQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICEQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VOICEQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-voiceQueue-button" ng-click="vm.createOrEditVoiceQueue($event)" aria-label="add voiceQueue" translate translate-attr-aria-label="VOICE.ADD_VOICEQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VOICEQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/voiceRecordings/create/dialog.html",'<md-dialog class="voiceRecording-dialog" aria-label="New VoiceRecording">\n  <form name="voiceRecordingForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.RATING">Rating</label>\n        <md-select name="rating" ng-model="vm.voiceRecording.rating" autofocus ng-disabled="!vm.newVoiceRecording && !vm.crudPermissions.canEdit">\n          <md-option ng-value="null">{{\'VOICE.NO_RATING\' | translate}}</md-option>\n          <md-option value="1">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1]"></md-icon>\n          </md-option>\n          <md-option value="2">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2]"></md-icon>\n          </md-option>\n          <md-option value="3">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3]"></md-icon>\n          </md-option>\n          <md-option value="4">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4]"></md-icon>\n          </md-option>\n          <md-option value="5">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4,5]"></md-icon>\n          </md-option>\n        </md-select>\n        <div ng-messages="voiceRecordingForm[\'rating\'].$error" ng-show="voiceRecordingForm[rating].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.RATING_REQUIRED">Rating field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVoiceRecording" ng-click="vm.saveVoiceRecording()" class="send-button md-accent md-raised" ng-disabled="voiceRecordingForm.$invalid || voiceRecordingForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVoiceRecording" ng-click="vm.addNewVoiceRecording()" class="send-button md-accent md-raised" ng-disabled="voiceRecordingForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICERECORDING" translate-attr-aria-label="VOICE.ADD_VOICERECORDING">\n          ADD VOICERECORDING\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVoiceRecording" ng-click="vm.deleteVoiceRecording($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceRecordings/edit/view.html",'<div id="voice-voiceRecording" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-voiceRecordings-button md-icon-button" aria-label="Go to voiceRecordings" ng-click="vm.gotoVoiceRecordings()" translate translate-attr-aria-label="VOICE.GO_TO_VOICERECORDINGS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="voiceRecording-image" hide-xs>\n          <img ng-src="assets/images/business/voiceRecordings.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.voiceRecording.id}}\n            <span ng-if="vm.voiceRecording.name">{{vm.voiceRecording.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.voiceRecording.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVoiceRecording()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(voiceRecordingsForm.$invalid) || (transcriptForm.$invalid) || (sentimentAnalysisForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.GENERAL">GENERAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceRecording-detail-form-container voicerecordings md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.VOICERECORDINGS">VOICERECORDINGS</div>\n            </div>\n            <form name="voiceRecordingsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TYPE">Type</label>\n                <input type="" name="type" ng-model="vm.voiceRecording.type" autofocus disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'type\'].$error" ng-show="voiceRecordingsForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.UNIQUEID">UniqueId</label>\n                <input type="" name="uniqueid" ng-model="vm.voiceRecording.uniqueid" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'uniqueid\'].$error" ng-show="voiceRecordingsForm[\'uniqueid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.UNIQUEID_REQUIRED">UniqueId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CALLER">Caller</label>\n                <input type="" name="calleridnum" ng-model="vm.voiceRecording.calleridnum" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'calleridnum\'].$error" ng-show="voiceRecordingsForm[\'calleridnum\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CALLER_REQUIRED">Caller field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CALLED">Called</label>\n                <input type="" name="exten" ng-model="vm.voiceRecording.exten" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'exten\'].$error" ng-show="voiceRecordingsForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CALLED_REQUIRED">Called field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONNECTED">Connected</label>\n                <input type="" name="connectedlinenum" ng-model="vm.voiceRecording.connectedlinenum" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'connectedlinenum\'].$error" ng-show="voiceRecordingsForm[\'connectedlinenum\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONNECTED_REQUIRED">Connected field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.QUEUE">Queue</label>\n                <input type="" name="queue" ng-model="vm.voiceRecording.queue" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'queue\'].$error" ng-show="voiceRecordingsForm[\'queue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.AGENT">Agent</label>\n                <input type="text" name="membername" ng-model="vm.voiceRecording.membername" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'membername\'].$error" ng-show="voiceRecordingsForm[\'membername\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RATING">Rating</label>\n                <md-select name="rating" ng-model="vm.voiceRecording.rating" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">{{\'VOICE.NO_RATING\' | translate}}</md-option>\n                  <md-option value="1">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1]"></md-icon>\n                  </md-option>\n                  <md-option value="2">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2]"></md-icon>\n                  </md-option>\n                  <md-option value="3">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3]"></md-icon>\n                  </md-option>\n                  <md-option value="4">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4]"></md-icon>\n                  </md-option>\n                  <md-option value="5">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4,5]"></md-icon>\n                  </md-option>\n                </md-select>\n                <div ng-messages="voiceRecordingsForm[\'rating\'].$error" ng-show="voiceRecordingsForm[rating].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RATING_REQUIRED">Rating field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DISPOSITION">Disposition</label>\n                <input type="text" name="userDisposition" ng-model="vm.voiceRecording.userDisposition" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'userDisposition\'].$error" ng-show="voiceRecordingsForm[\'userDisposition\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SECOND_LEVEL_DISPOSITION">Second_Level_Disposition</label>\n                <input type="text" name="userSecondDisposition" ng-model="vm.voiceRecording.userSecondDisposition" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'userSecondDisposition\'].$error" ng-show="voiceRecordingsForm[\'userSecondDisposition\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SECOND_LEVEL_DISPOSITION_REQUIRED">Second_Level_Disposition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.THIRD_LEVEL_DISPOSITION">Third_Level_Disposition</label>\n                <input type="text" name="userThirdDisposition" ng-model="vm.voiceRecording.userThirdDisposition" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'userThirdDisposition\'].$error" ng-show="voiceRecordingsForm[\'userThirdDisposition\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.THIRD_LEVEL_DISPOSITION_REQUIRED">Third_Level_Disposition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.license.ai">\n        <md-tab-label>\n          <span translate="VOICE.TRANSCRIPTANALYSIS">TRANSCRIPTANALYSIS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceRecording-detail-form-container transcript md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.TRANSCRIPT">TRANSCRIPT</div>\n            </div>\n            <form name="transcriptForm" novalidate>\n              <md-input-container ng-if="vm.voiceRecording.transcribeStatus == \'COMPLETED\'" class="md-block">\n                <label translate="VOICE.TEXT">Text</label>\n                <textarea name="fileText" ng-model="vm.voiceRecording.fileText" autofocus ng-disabled="true"></textarea>\n              </md-input-container>\n              <md-input-container ng-if="vm.voiceRecording.transcribeStatus == \'FAILED\'" class="md-block">\n                <label translate="VOICE.FAILUREREASON">FailureReason</label>\n                <textarea name="failureReason" ng-model="vm.voiceRecording.failureReason" ng-disabled="true"></textarea>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="voiceRecording-detail-form-container sentimentanalysis md-background-bg md-whiteframe-1dp">\n            <div ng-controller="VoiceRecordingSentimentStatisticsController as vm_ss" ng-init="vm_ss.init(vm.voiceRecording)">\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="VOICE.SENTIMENTANALYSIS" style="width: 50px;">Sentiment Analysis</span>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- WIDGET GROUP --\x3e\n              <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n                \x3c!-- WIDGET 1 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8 sentiment" ng-class="vm_ss.voiceRecording.sentiment">\n                        {{vm_ss.voiceRecording.sentiment}}\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 1 --\x3e\n\n                \x3c!-- WIDGET 2 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sPositive || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_POSITIVE\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 2 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sNegative || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_NEGATIVE\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n                \x3c!-- WIDGET 4 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sNeutral || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_NEUTRAL\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 4 --\x3e\n\n                \x3c!-- WIDGET 5 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sMixed || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_MIXED\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 5 --\x3e\n\n              </div>\n              \x3c!-- / WIDGET GROUP --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/voiceRecordings/voiceRecordings.html",'<div id="voiceRecordings" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICERECORDINGS">VoiceRecordings</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getVoiceRecordings()"></ms-quick-filter>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoiceRecordings.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoiceRecordings =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voiceRecordings-count">\n          <span>{{vm.selectedVoiceRecordings.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoiceRecordings()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoiceRecordings()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoiceRecordings" csv-label="true" filename="voiceRecordings.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.license.ai" ng-click="vm.runtranscribesentimentSelectedVoiceRecordings($event)" aria-label="transcribesentiment selected" translate translate-attr-label="VOICERECORDINGS.TRANSCRIBESENTIMENT_SELECTED">\n          <md-icon md-font-icon="icon-text-to-speech"></md-icon>\n          <md-tooltip>{{\'VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button" ng-if="vm.license.ai" ng-click="vm.runtranscribeSelectedVoiceRecordings($event)" aria-label="transcribe selected" translate translate-attr-label="VOICERECORDINGS.TRANSCRIBE_SELECTED">\n          <md-icon md-font-icon="icon-format-size"></md-icon>\n          <md-tooltip>{{\'VOICE.RUNTRANSCRIBE_VOICERECORDING\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button" ng-if="vm.license.ai" ng-click="vm.runsentimentSelectedVoiceRecordings($event)" aria-label="transcribe selected" translate translate-attr-label="VOICERECORDINGS.SENTIMENT_SELECTED">\n          <md-icon md-font-icon="icon-heart-outline"></md-icon>\n          <md-tooltip>{{\'VOICE.RUNSENTIMENT_VOICERECORDING\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoiceRecordings($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICERECORDING TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoiceRecordings" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceRecordings">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="type">{{ \'VOICE.TYPE\' | translate }}</th>\n                <th md-column md-order-by="uniqueid">{{ \'VOICE.UNIQUEID\' | translate }}</th>\n                <th md-column md-order-by="calleridnum">{{ \'VOICE.CALLER\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.CALLED\' | translate }}</th>\n                <th md-column md-order-by="connectedlinenum">{{ \'VOICE.CONNECTED\' | translate }}</th>\n                <th md-column md-order-by="queue">{{ \'VOICE.QUEUE\' | translate }}</th>\n                <th md-column md-order-by="membername">{{ \'VOICE.AGENT\' | translate }}</th>\n                <th md-column md-order-by="rating">{{ \'VOICE.RATING\' | translate }}</th>\n                <th md-column>{{ \'VOICE.AUDIO\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'VOICE.DATE\' | translate }}</th>\n                <th md-column md-order-by="userDisposition">{{ \'VOICE.DISPOSITION\' | translate }}</th>\n                <th md-column md-order-by="userSecondDisposition">{{ \'VOICE.SECOND_LEVEL_DISPOSITION\' | translate }}</th>\n                <th md-column md-order-by="userThirdDisposition">{{ \'VOICE.THIRD_LEVEL_DISPOSITION\' | translate }}</th>\n                <th md-column md-order-by="transcribeStatus" ng-if="vm.license.ai">{{ \'VOICE.TRANSCRIBE\' | translate }}</th>\n                <th md-column md-order-by="sentiment" ng-if="vm.license.ai">{{ \'VOICE.SENTIMENTANALYSIS\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voiceRecordings.rows.length">\n                <td md-cell colspan="16">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voiceRecording" md-select-id="id" ng-repeat="voiceRecording in vm.voiceRecordings.rows">\n                <td md-cell ng-if="voiceRecording.userpic"><img class="avatar" alt="{{voiceRecording.name}}" ng-src="api/users/{{voiceRecording.id}}/avatar" /></td>\n                <td md-cell ng-if="!voiceRecording.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voiceRecording.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="type ">{{voiceRecording.type}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="uniqueid ">{{voiceRecording.uniqueid}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="calleridnum " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.calleridnum}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="exten " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.exten}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="connectedlinenum " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.connectedlinenum}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="queue ">{{voiceRecording.queue}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="membername " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.membername}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="rating ">\n                  <md-icon md-font-icon="icon-star" style="color:red" ng-show="voiceRecording.rating" ng-repeat="rating in [1,2,3,4,5] | limitTo:voiceRecording.rating"></md-icon><span ng-hide="voiceRecording.rating" translate="VOICE.NO_RATING">No rating</span>\n                </td>\n                <td md-cell class="audio " ng-switch="voiceRecording.format">\n                  \x3c!-- audio recording directive --\x3e\n                  <ms-recording ng-switch-when=".wav" id="voiceRecording.id" model="\'voiceRecording\'"></ms-recording>\n                  \x3c!-- / audio recording directive --\x3e\n                  <span ng-switch-when=".gsm|.WAV" ng-switch-when-separator="|">\n                    <em>{{ \'VOICE.CANT_PLAY_GSM_AUDIO_FILES\' | translate }}</em>\n                  </span>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="createdAt ">{{voiceRecording.createdAt | date:\'medium\' }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="userDisposition ">{{voiceRecording.userDisposition}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="userSecondDisposition ">{{voiceRecording.userSecondDisposition}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="userThirdDisposition ">{{voiceRecording.userThirdDisposition}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="transcribeStatus " ng-if="vm.license.ai">{{ \'VOICE.TRANSCRIBESTATUS_\' + voiceRecording.transcribeStatus | translate}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="sentiment " ng-if="vm.license.ai">{{voiceRecording.sentiment}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(voiceRecording, $event    )" translate="VOICE.EDIT_VOICERECORDING">\n                          Edit VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'NEW\' && vm.license.ai">\n\n                        <md-button ng-click="vm.runtranscriberuntranscribesentiment(voiceRecording, $event    )" translate="VOICE.RUNTRANSCRIBE_VOICERECORDING">\n                          RunTranscribe VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'NEW\' && vm.license.ai">\n\n                        <md-button ng-click="vm.runtranscribesentimentruntranscribesentiment(voiceRecording, $event    )" translate="VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING">\n                          RunTranscribeSentiment VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'COMPLETED\' && voiceRecording.sentiment == null && vm.license.ai">\n\n                        <md-button ng-click="vm.runsentimentruntranscribesentiment(voiceRecording, $event    )" translate="VOICE.RUNSENTIMENT_VOICERECORDING">\n                          RunSentiment VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'COMPLETED\' && vm.license.ai">\n\n                        <md-button ng-click="vm.downloadtranscribefile2(voiceRecording, $event    )" translate="VOICE.DOWNLOADTRANSCRIBE_VOICERECORDING">\n                          DownloadTranscribe VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadVoiceRecordings">\n\n                        <md-button ng-click="vm.downloadfile2(voiceRecording, $event  , \'voice/recordings\'   )" translate="VOICE.DOWNLOAD_VOICERECORDING">\n                          Download VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voiceRecording, $event    )" translate="VOICE.DELETE_VOICERECORDING">\n                          Delete VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceRecordings.count}}" md-on-paginate="vm.getVoiceRecordings" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICERECORDING TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/whatsapp/views/realtime/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="WHATSAPP.QUEUES">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'WHATSAPP.NAME\' | translate }}</th>\n        <th md-column>{{ \'WHATSAPP.LOGGED_IN\' | translate }}</th>\n        <th md-column>{{ \'DASHBOARDS.AVAILABLE\' | translate }}</th>\n        <th md-column>{{ \'WHATSAPP.PAUSED\' | translate }}</th>\n        <th md-column>{{ \'WHATSAPP.WAITING\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.count > 0">\n        <td md-cell colspan="7">\n          <div layout="row" layout-align="center center">\n            <span translate="WHATSAPP.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n        <td md-cell>{{queue.name}}</td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.loggedIn }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.editQueue($event, queue)" translate="WHATSAPP.EDIT_QUEUE">\n                  Edit Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.addAgent($event, queue)" translate="WHATSAPP.AGENTSADD_QUEUE">\n                  Add Agents to queue\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/whatsapp/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/create/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.whatsappAccount.name" ng-required="true" autofocus ng-disabled="!vm.newWhatsappAccount">\n\n        <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n        <div ng-messages="whatsappAccountForm[\'name\'].$error" ng-show="whatsappAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.whatsappAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="whatsappAccountForm[\'key\'].$error" ng-show="whatsappAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.whatsappAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="WHATSAPP.HELP.LIST"></span></div>\n        <div ng-messages="whatsappAccountForm[\'ListId\'].$error" ng-show="whatsappAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.MOTIONPROXY">MotionProxy</label>\n        <input type="url" name="remote" ng-model="vm.whatsappAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="WHATSAPP.HELP.MOTIONPROXY"></span></div>\n        <div ng-messages="whatsappAccountForm[\'remote\'].$error" ng-show="whatsappAccountForm[\'remote\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.whatsappAccount.type">\n          <md-option ng-value="\'twilio\'">Twilio</md-option>\n          <md-option ng-value="\'sinch\'">Sinch</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountForm[\'type\'].$error" ng-show="whatsappAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\' || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n        <label translate="WHATSAPP.ACCOUNTSID">AccountSID</label>\n        <input type="text" name="accountSid" ng-model="vm.whatsappAccount.accountSid" ng-required="true">\n\n        <div ng-messages="whatsappAccountForm[\'accountSid\'].$error" ng-show="whatsappAccountForm[\'accountSid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\' || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n        <label translate="WHATSAPP.AUTHTOKEN">AuthToken</label>\n        <input type="text" name="authToken" ng-model="vm.whatsappAccount.authToken" ng-required="true">\n\n        <div ng-messages="whatsappAccountForm[\'authToken\'].$error" ng-show="whatsappAccountForm[\'authToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.whatsappAccount.type == \'sinch\'" class="md-block">\n        <label translate="WHATSAPP.BASEURL">Base URL</label>\n\n        \x3c!--    <input type="text" name="baseUrl" ng-model="vm.whatsappAccount.baseUrl" ng-required="true"> --\x3e\n\n        <md-select name="baseUrl" ng-model="vm.whatsappAccount.baseUrl" required>\n          <md-option ng-value="\'https://us1.whatsapp.api.sinch.com\'">US Production</md-option>\n          <md-option ng-value="\'https://eu1.whatsapp.api.sinch.com\'">EU Production</md-option>\n        </md-select>\n\n        <div ng-messages="whatsappAccountForm[\'authToken\'].$error" ng-show="whatsappAccountForm[\'authToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PHONE">phone</label>\n        <input type="text" name="phone" ng-model="vm.whatsappAccount.phone" ng-required="true">\n        <div ng-messages="whatsappAccountForm[\'phone\'].$error" ng-show="whatsappAccountForm[\'phone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PHONE_REQUIRED">phone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.whatsappAccount.description">\n\n        <div ng-messages="whatsappAccountForm[\'description\'].$error" ng-show="whatsappAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newWhatsappAccount" ng-click="vm.saveWhatsappAccount()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountForm.$invalid || whatsappAccountForm.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newWhatsappAccount" ng-click="vm.addNewWhatsappAccount()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountForm.$invalid" aria-label="ADD" translate="WHATSAPP.ADD_WHATSAPPACCOUNT" translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPACCOUNT">\n          ADD WHATSAPPACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newWhatsappAccount" ng-click="vm.deleteWhatsappAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="WHATSAPP.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="WHATSAPP.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/agentadd/agentadd.html",'<md-dialog class="whatsappAccount-dialog" aria-label="whatsappAccount" ng-init="vm.onInit()">\n  <form name="whatsappAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="WHATSAPP.AGENTADD_WHATSAPPACCOUNT">Add Agent to whatsappAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/agent/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'agent\'].$error" ng-show="whatsappAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'timeout\'].$error" ng-show="whatsappAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/amazonlex/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'accesskeyid\'].$error" ng-show="whatsappAccountFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'secretaccesskey\'].$error" ng-show="whatsappAccountFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'lexregion\'].$error" ng-show="whatsappAccountFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'botname\'].$error" ng-show="whatsappAccountFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="WHATSAPP.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="whatsappAccountFormApp[\'welcomemessage\'].$error" ng-show="whatsappAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'times\'].$error" ng-show="whatsappAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="whatsappAccountFormApp[\'text\'].$error" ng-show="whatsappAccountFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/close/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'disposition\'].$error" ng-show="whatsappAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/dialogflow/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'key\'].$error" ng-show="whatsappAccountFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'language\'].$error" ng-show="whatsappAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="WHATSAPP.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="whatsappAccountFormApp[\'welcomemessage\'].$error" ng-show="whatsappAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'projectId\'].$error" ng-show="whatsappAccountFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'clientEmail\'].$error" ng-show="whatsappAccountFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="whatsappAccountFormApp[\'privateKey\'].$error" ng-show="whatsappAccountFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'language\'].$error" ng-show="whatsappAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="WHATSAPP.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="whatsappAccountFormApp[\'welcomemessage\'].$error" ng-show="whatsappAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'condition\'].$error" ng-show="whatsappAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'truepriority\'].$error" ng-show="whatsappAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'falsepriority\'].$error" ng-show="whatsappAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'priority\'].$error" ng-show="whatsappAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/noop/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'value\'].$error" ng-show="whatsappAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/queue/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'queue\'].$error" ng-show="whatsappAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'timeout\'].$error" ng-show="whatsappAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/system/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'command\'].$error" ng-show="whatsappAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'variable\'].$error" ng-show="whatsappAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/tag/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'tag\'].$error" ng-show="whatsappAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/view.html",'<div id="whatsapp-whatsappAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-whatsappAccounts-button md-icon-button" aria-label="Go to whatsappAccounts" ng-click="vm.gotoWhatsappAccounts()" translate translate-attr-aria-label="WHATSAPP.GO_TO_WHATSAPPACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="whatsappAccount-image" hide-xs>\n          <img ng-src="assets/images/business/whatsappAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.whatsappAccount.id}}\n            <span ng-if="vm.whatsappAccount.name">{{vm.whatsappAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="WHATSAPP.CREATED_AT"></span> <span>{{vm.whatsappAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.whatsappAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="WHATSAPP.AGENTADD_WHATSAPPACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveWhatsappAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (proxyForm.$invalid) || (dispositionForm.$invalid) || (whatsappDispositionsForm.$invalid) || (whatsappCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.whatsappAccount.name" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.whatsappAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="WHATSAPP.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.whatsappAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="WHATSAPP.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\'  || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n                <label translate="WHATSAPP.ACCOUNTSID">AccountSID</label>\n                <input type="text" name="accountSid" ng-model="vm.whatsappAccount.accountSid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'accountSid\'].$error" ng-show="generalForm[\'accountSid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\'  || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n                <label translate="WHATSAPP.AUTHTOKEN">AuthToken</label>\n                <input type="text" name="authToken" ng-model="vm.whatsappAccount.authToken" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'authToken\'].$error" ng-show="generalForm[\'authToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n\n              <md-input-container ng-if="vm.whatsappAccount.type == \'sinch\'" class="md-block">\n                <label translate="WHATSAPP.BASEURL">BaseURL</label>\n\n                <md-select name="baseUrl" ng-model="vm.whatsappAccount.baseUrl" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryBaseUrl.url" ng-repeat="mandatoryBaseUrl in vm.baseUrl" ng-disabled="mandatoryBaseUrl.canSelect === false">{{ mandatoryBaseUrl.name }}</md-option>\n                </md-select>\n\n                <div ng-messages="generalForm[\'baseUrl\'].$error" ng-show="generalForm[\'baseUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.BASEURL_REQUIRED">Base URL field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.PHONE">phone</label>\n                <input type="text" name="phone" ng-model="vm.whatsappAccount.phone" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'phone\'].$error" ng-show="generalForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.PHONE_REQUIRED">phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.RECEIVEURL">receiveUrl</label>\n\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-receiveUrl" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-receiveUrl" name="receiveUrl" ng-value="vm.whatsappAccount.remote + \'/api/whatsapp/accounts/\' + vm.whatsappAccount.id + \'/notify?token=\' + vm.whatsappAccount.token" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="WHATSAPP.HELP.RECEIVEURL"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.whatsappAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.whatsappAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="whatsappAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="WHATSAPP.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.whatsappAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="whatsappAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.queueTransfer == true" class="md-block">\n                <label translate="WHATSAPP.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.whatsappAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.agentTransfer == true" class="md-block">\n                <label translate="WHATSAPP.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.whatsappAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container proxy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.PROXY">PROXY</div>\n            </div>\n            <form name="proxyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.MOTIONPROXY">MotionProxy</label>\n                <input type="url" name="remote" ng-model="vm.whatsappAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="WHATSAPP.HELP.MOTIONPROXY"></span></div>\n                <div ng-messages="proxyForm[\'remote\'].$error" ng-show="proxyForm[\'remote\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.TOKEN">token</label>\n                <input type="text" name="token" ng-model="vm.whatsappAccount.token" disabled>\n\n                <div ng-messages="proxyForm[\'token\'].$error" ng-show="proxyForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.TOKEN_REQUIRED">token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="whatsappAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.mandatoryDisposition" class="md-block">\n                <label translate="WHATSAPP.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.whatsappAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="WHATSAPP.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="WhatsappAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.whatsappAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="whatsappAccount-detail-form-container whatsappdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedWhatsappAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="WHATSAPP.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add whatsapp dispositions" translate translate-attr-label="WHATSAPP.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="whatsappAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'WHATSAPP.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'WHATSAPP.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'WHATSAPP.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="WHATSAPP.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container whatsappcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="WhatsappAccountWhatsappCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.whatsappAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="WHATSAPP.WHATSAPPCANNEDANSWERS">WhatsappCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getWhatsappAccountWhatsappCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event)" aria-label="add whatsappCannedAnswer" translate translate-attr-label="WHATSAPP.ADD_WHATSAPPCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length}} {{vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedWhatsappAccountWhatsappCannedAnswers" csv-label="true" filename="whatsappAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedWhatsappAccountWhatsappCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedWhatsappAccountWhatsappCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getWhatsappAccountWhatsappCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'WHATSAPP.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'WHATSAPP.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'WHATSAPP.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'WHATSAPP.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'WHATSAPP.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="whatsappCannedAnswer" md-select-id="id" ng-repeat="whatsappCannedAnswer in vm_dc.whatsappAccountWhatsappCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{ whatsappCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" translate="WHATSAPP.EDIT_WHATSAPPCANNEDANSWER">\n                                Edit WhatsappCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(whatsappCannedAnswer, $event)" translate="WHATSAPP.DELETE_WHATSAPPCANNEDANSWER">\n                                Delete WhatsappCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.whatsappAccountWhatsappCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="WHATSAPP.NO_WHATSAPPCANNEDANSWER_AVAILABLE">No whatsappcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.whatsappAccountWhatsappCannedAnswers.count}}" md-on-paginate="vm_dc.getWhatsappAccountWhatsappCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="WhatsappAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.whatsappAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="WHATSAPP.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedWhatsappAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedWhatsappAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedWhatsappAccountApps.length}} {{vm_ac.selectedWhatsappAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedWhatsappAccountApps($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedWhatsappAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.whatsappAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editWhatsappAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editWhatsappAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editWhatsappAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editWhatsappAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.whatsappAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="WhatsappAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.whatsappAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedWhatsappAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="WHATSAPP.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getWhatsappAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getWhatsappAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getWhatsappAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="WHATSAPP.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedWhatsappAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedWhatsappAccountInteractions.length}} {{vm_dc.selectedWhatsappAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedWhatsappAccountInteractions" csv-label="true" filename="whatsappAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedWhatsappAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedWhatsappAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getWhatsappAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'WHATSAPP.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'WHATSAPP.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'WHATSAPP.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'WHATSAPP.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'WHATSAPP.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'WHATSAPP.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'WHATSAPP.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.whatsappAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'WHATSAPP.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'WHATSAPP.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spywhatsappInteraction($event, interaction)" translate="WHATSAPP.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.whatsappInteractionDownload(interaction, $event)" translate="WHATSAPP.DOWNLOAD_INTERACTION">\n                                Download\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="WHATSAPP.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.whatsappAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="WHATSAPP.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.whatsappAccountInteractions.count}}" md-on-paginate="vm_dc.getWhatsappAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/whatsappCannedAnswers/dialog.html",'<md-dialog class="whatsappCannedAnswer-dialog" aria-label="New WhatsappCannedAnswer">\n  <form name="whatsappCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.whatsappCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="whatsappCannedAnswerForm[\'key\'].$error" ng-show="whatsappCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.whatsappCannedAnswer.value" required></textarea>\n\n        <div ng-messages="whatsappCannedAnswerForm[\'value\'].$error" ng-show="whatsappCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.whatsappCannedAnswer.description">\n\n        <div ng-messages="whatsappCannedAnswerForm[\'description\'].$error" ng-show="whatsappCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newWhatsappCannedAnswer" ng-click="vm.saveWhatsappCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="whatsappCannedAnswerForm.$invalid || whatsappCannedAnswerForm.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newWhatsappCannedAnswer" ng-click="vm.addNewWhatsappCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="whatsappCannedAnswerForm.$invalid" aria-label="ADD" translate="WHATSAPP.ADD_WHATSAPPCANNEDANSWER" translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPCANNEDANSWER">\n          ADD WHATSAPPCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newWhatsappCannedAnswer" ng-click="vm.deleteWhatsappCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="WHATSAPP.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="WHATSAPP.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/whatsappAccounts.html",'<div id="whatsappAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-whatsapp" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="WHATSAPP.WHATSAPPACCOUNTS">WhatsappAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="WHATSAPP.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedWhatsappAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedWhatsappAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="WHATSAPP.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-whatsappAccounts-count">\n          <span>{{vm.selectedWhatsappAccounts.length}}</span>\n          <span translate="WHATSAPP.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="WHATSAPP.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllWhatsappAccounts()" translate="WHATSAPP.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectWhatsappAccounts()" translate="WHATSAPP.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedWhatsappAccounts" csv-label="true" filename="whatsappAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedWhatsappAccounts($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- WHATSAPPACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedWhatsappAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getWhatsappAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'WHATSAPP.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'WHATSAPP.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'WHATSAPP.KEY\' | translate }}</th>\n                <th md-column md-order-by="ListId">{{ \'WHATSAPP.LIST\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'WHATSAPP.TYPE\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'WHATSAPP.PHONE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'WHATSAPP.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.whatsappAccounts.rows.length">\n                <td md-cell colspan="8">\n                  <div layout="row" layout-align="center center">\n                    <span translate="WHATSAPP.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="whatsappAccount" md-select-id="id" ng-repeat="whatsappAccount in vm.whatsappAccounts.rows">\n                <td md-cell ng-if="whatsappAccount.userpic"><img class="avatar" alt="{{whatsappAccount.name}}" ng-src="api/users/{{whatsappAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!whatsappAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{whatsappAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="id ">{{whatsappAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="name ">{{whatsappAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="key ">{{whatsappAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="ListId ">{{ (vm.lists | filter : {\'id\':whatsappAccount.ListId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="type ">{{ vm.arraytype[whatsappAccount.type].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="phone ">{{whatsappAccount.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="description ">{{whatsappAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(whatsappAccount, $event    )" translate="WHATSAPP.EDIT_WHATSAPPACCOUNT">\n                          Edit WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(whatsappAccount, $event    )" translate="WHATSAPP.INTERACTIONS_WHATSAPPACCOUNT">\n                          Interactions WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(whatsappAccount, $event    )" translate="WHATSAPP.AGENTADD_WHATSAPPACCOUNT">\n                          AgentAdd WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(whatsappAccount, $event    )" translate="WHATSAPP.DELETE_WHATSAPPACCOUNT">\n                          Delete WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.whatsappAccounts.count}}" md-on-paginate="vm.getWhatsappAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / WHATSAPPACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD WHATSAPPACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-whatsappAccount-button" ng-click="vm.createOrEditWhatsappAccount($event)" aria-label="add whatsappAccount" translate translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD WHATSAPPACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/create/dialog.html",'<md-dialog class="whatsappQueue-dialog" aria-label="New WhatsappQueue">\n  <form name="whatsappQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.whatsappQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newWhatsappQueue">\n\n        <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n        <div ng-messages="whatsappQueueForm[\'name\'].$error" ng-show="whatsappQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="WHATSAPP.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.whatsappQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="whatsappQueueForm[\'strategy\'].$error" ng-show="whatsappQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.whatsappQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="whatsappQueueForm[\'timeout\'].$error" ng-show="whatsappQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.whatsappQueue.description">\n\n        <div ng-messages="whatsappQueueForm[\'description\'].$error" ng-show="whatsappQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newWhatsappQueue" ng-click="vm.saveWhatsappQueue()" class="send-button md-accent md-raised" ng-disabled="whatsappQueueForm.$invalid || whatsappQueueForm.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newWhatsappQueue" ng-click="vm.addNewWhatsappQueue()" class="send-button md-accent md-raised" ng-disabled="whatsappQueueForm.$invalid" aria-label="ADD" translate="WHATSAPP.ADD_WHATSAPPQUEUE" translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPQUEUE">\n          ADD WHATSAPPQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newWhatsappQueue" ng-click="vm.deleteWhatsappQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="WHATSAPP.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="WHATSAPP.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/edit/agentadd/agentadd.html",'<md-dialog class="whatsappQueue-dialog" aria-label="whatsappQueue" ng-init="vm.onInit()">\n  <form name="whatsappQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="WHATSAPP.AGENTADD_WHATSAPPQUEUE">Add Agent to whatsappQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/edit/teamadd/teamadd.html",'<md-dialog class="whatsappQueue-dialog" aria-label="whatsappQueue" ng-init="vm.onInit()">\n  <form name="whatsappQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="WHATSAPP.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/edit/view.html",'<div id="whatsapp-whatsappQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-whatsappQueues-button md-icon-button" aria-label="Go to whatsappQueues" ng-click="vm.gotoWhatsappQueues()" translate translate-attr-aria-label="WHATSAPP.GO_TO_WHATSAPPQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="whatsappQueue-image" hide-xs>\n          <img ng-src="assets/images/business/whatsappQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.whatsappQueue.id}}\n            <span ng-if="vm.whatsappQueue.name">{{vm.whatsappQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="WHATSAPP.CREATED_AT"></span> <span>{{vm.whatsappQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.whatsappQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="WHATSAPP.TEAMADD_WHATSAPPQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.whatsappQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="WHATSAPP.AGENTADD_WHATSAPPQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveWhatsappQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.whatsappQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="WHATSAPP.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.whatsappQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.whatsappQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.whatsappQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/whatsappQueues.html",'<div id="whatsappQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-whatsapp" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="WHATSAPP.WHATSAPPQUEUES">WhatsappQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="WHATSAPP.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedWhatsappQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedWhatsappQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="WHATSAPP.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-whatsappQueues-count">\n          <span>{{vm.selectedWhatsappQueues.length}}</span>\n          <span translate="WHATSAPP.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="WHATSAPP.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllWhatsappQueues()" translate="WHATSAPP.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectWhatsappQueues()" translate="WHATSAPP.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedWhatsappQueues" csv-label="true" filename="whatsappQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedWhatsappQueues($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- WHATSAPPQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedWhatsappQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getWhatsappQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'WHATSAPP.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'WHATSAPP.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'WHATSAPP.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.whatsappQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="WHATSAPP.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="whatsappQueue" md-select-id="id" ng-repeat="whatsappQueue in vm.whatsappQueues.rows">\n                <td md-cell ng-if="whatsappQueue.userpic"><img class="avatar" alt="{{whatsappQueue.name}}" ng-src="api/users/{{whatsappQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!whatsappQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{whatsappQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappQueue, ev) : vm.createOrEditWhatsappQueue($event, whatsappQueue)" md-cell class="id ">{{whatsappQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappQueue, ev) : vm.createOrEditWhatsappQueue($event, whatsappQueue)" md-cell class="name ">{{whatsappQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappQueue, ev) : vm.createOrEditWhatsappQueue($event, whatsappQueue)" md-cell class="strategy ">{{ vm.arraystrategy[whatsappQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(whatsappQueue, $event    )" translate="WHATSAPP.EDIT_WHATSAPPQUEUE">\n                          Edit WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(whatsappQueue, $event    )" translate="WHATSAPP.TEAMADD_WHATSAPPQUEUE">\n                          teamadd WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(whatsappQueue, $event    )" translate="WHATSAPP.AGENTADD_WHATSAPPQUEUE">\n                          agentadd WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(whatsappQueue, $event    )" translate="WHATSAPP.DELETE_WHATSAPPQUEUE">\n                          Delete WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(whatsappQueue, $event    )" translate="WHATSAPP.GOTOREALTIME_WHATSAPPQUEUE">\n                          goToRealtime WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.whatsappQueues.count}}" md-on-paginate="vm.getWhatsappQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / WHATSAPPQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD WHATSAPPQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-whatsappQueue-button" ng-click="vm.createOrEditWhatsappQueue($event)" aria-label="add whatsappQueue" translate translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD WHATSAPPQUEUE BUTTON --\x3e\n</div>'),e.put("app/navigation/layouts/horizontal-navigation/navigation.html",'<div layout="row" layout-align="start center">\n  <ms-navigation-horizontal></ms-navigation-horizontal>\n</div>'),e.put("app/navigation/layouts/vertical-navigation-fullwidth-toolbar-2/navigation.html",'<ms-navigation class="scrollable" folded="vm.folded"></ms-navigation>'),e.put("app/navigation/layouts/vertical-navigation/navigation.html",'<md-toolbar class="navigation-header md-whiteframe-1dp" layout="row" layout-align="space-between center">\n  <div class="logo" layout="row" layout-align="start center">\n    <span class="logo-image"><img src="/api/settings/1/logo" alt="logo" /></span>\n    \x3c!-- <span class="logo-image"><img src="assets/images/logos/whisker_32x32.png" alt="motion_whisker_32x32" /></span> --\x3e\n    <span class="logo-text text-truncate">{{vm.getLogo() | uppercase}}</span>\n  </div>\n  <md-icon class="fold-toggle s18" md-font-icon="icon-backburger" hide show-gt-sm ng-click="vm.toggleMsNavigationFolded()"></md-icon>\n</md-toolbar>\n\n<ms-navigation class="scrollable" folded="vm.folded"></ms-navigation>'),e.put("app/quick-panel/quick-panel.html",'<md-content>\n  <md-tabs md-no-pagination md-swipe-content md-stretch-tabs="always">\n    <md-tab>\n      <md-tab-label>\n        <span translate="QUICKPANEL.TODAY">TODAY</span>\n      </md-tab-label>\n      <md-tab-body>\n        <md-content class="today-tab scrollable" ng-include="\'app/quick-panel/tabs/today/today-tab.html\'"></md-content>\n      </md-tab-body>\n    </md-tab>\n    <md-tab ng-if="vm.currentUser.allowmessenger || vm.currentUser.role !== \'agent\'" ng-include="\'app/quick-panel/tabs/chat/chat-tab.html\'" ng-controller="ChatInternalController as vm_ct" ng-init="vm_ct.init(vm.license)" md-on-deselect="vm_ct.user = undefined">\n      <md-tab-label>\n        <div ng-if="vm.unreadTotalMessages" class="md-accent-bg unread-message-count-chat">{{vm.unreadTotalMessages}}</div>\n        <span>MESSENGER</span>\n      </md-tab-label>\n      <md-tab-body>\n        <md-content class="chat-tab scrollable" ng-include="\'app/quick-panel/tabs/chat/chat-tab.html\'"></md-content>\n      </md-tab-body>\n    </md-tab>\n    <md-tab ng-if="vm.currentUser.allowmessenger || vm.currentUser.role !== \'agent\'" ng-include="\'app/quick-panel/tabs/groups/group-tab.html\'" ng-controller="ChatGroupController as vm_cg" ng-init="vm_cg.init(vm.license)" md-on-deselect="vm_cg.group = undefined">\n      <md-tab-label>\n        <div ng-if="vm.unreadTotalGroupMessages" class="md-accent-bg unread-message-count-chat">{{vm.unreadTotalGroupMessages}}</div>\n        <span translate="QUICKPANEL.GROUPS">GROUPS</span>\n      </md-tab-label>\n      <md-tab-body>\n        <md-content class="group-tab scrollable" ng-include="\'app/quick-panel/tabs/groups/group-tab.html\'"></md-content>\n      </md-tab-body>\n    </md-tab>\n  </md-tabs>\n</md-content>'),e.put("app/quick-panel/tabs/activity/activity-tab.html",'<md-list class="friends">\n  <md-subheader class="md-no-sticky">\n    <span translate="QUICKPANEL.FRIENDS">Friends</span>\n  </md-subheader>\n\n  <md-list-item class="friend md-3-line" ng-repeat="friend in vm.activities.friends">\n    <img ng-src="{{friend.avatar}}" class="md-avatar" alt="{{friend.name}}" />\n\n    <div class="status {{friend.status}}"></div>\n\n    <div ng-if="contact.unread" class="md-accent-bg unread-message-count">{{contact.unread}}</div>\n\n    <div class="md-list-item-text">\n      <h3 class="message">{{friend.message}}</h3>\n      <p class="time">{{friend.time}}</p>\n    </div>\n  </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list class="servers">\n  <md-subheader class="md-no-sticky">\n    <span translate="QUICKPANEL.APP_SERVERS">Application Servers</span>\n  </md-subheader>\n\n  <md-list-item class="server md-3-line" ng-repeat="server in vm.activities.servers">\n    <md-icon md-font-icon="icon-checkbox-blank-circle" class="s16 status" ng-class="server.status"></md-icon>\n\n    <div class="md-list-item-text">\n      <h3>{{server.location}}</h3>\n      <p>{{server.detail}}</p>\n    </div>\n  </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list class="stats">\n  <md-subheader class="md-no-sticky">\n    <span translate="QUICKPANEL.USER_STATS">User Stats</span>\n  </md-subheader>\n\n  <md-list-item class="stat md-2-line" ng-repeat="stat in vm.activities.stats">\n    <div class="md-list-item-text">\n      <span>{{stat.title}} ({{stat.current}} / {{stat.total}})</span>\n      <md-progress-linear ng-class="stat.status" md-mode="determinate" value="{{stat.percent}}"></md-progress-linear>\n    </div>\n  </md-list-item>\n</md-list>'),e.put("app/quick-panel/tabs/chat/chat-tab.html",'<div class="main" ng-hide="vm_ct.user">\n  <md-subheader class="md-no-sticky">\n    <div class="search" layout="row" layout-align="space-between center">\n      <md-icon md-font-icon="icon-magnify" class="icon search-icon"></md-icon>\n      <input class="search-input" ng-model="vm_ct.search.$" type="text" placeholder="Search by fullname.." translate translate-attr-placeholder="QUICKPANEL.SEARCH" flex>\n      <md-select ng-model="vm_ct.search.online" class="height-50 no-padding no-margin" aria-label="Chat Tab Search">\n        <md-option ng-value="undefined">All</md-option>\n        <md-option ng-value="true">\n          <md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 green-fg"></md-icon>Online\n        </md-option>\n        <md-option ng-value="false">\n          <md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 red-fg"></md-icon>Offline\n        </md-option>\n      </md-select>\n    </div>\n  </md-subheader>\n  \x3c!-- <select ng-model="vm_ct.filterOnline" class="height-50 no-padding no-margin">\n            <option ng-value="undefined">All</option>\n            <option ng-value="true"><md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 green-fg"></md-icon>Online</option>\n            <option ng-value="false"><md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 red-fg"></md-icon>Offline</option>\n        </select> --\x3e\n  <md-divider></md-divider>\n  <md-list class="recent">\n    <md-list-item class="contact md-3-line" ng-if="user.id != vm_ct.currentUser.id" ng-repeat="user in vm_ct.users.rows | orderBy: \'-lastMessageAt\' | filter:vm_ct.search" ng-click="vm_ct.toggleChat(user)">\n      <md-divider></md-divider>\n      <img ng-src="{{user.userpic ? \'api/users/\' + user.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}" class="md-avatar" alt="{{user.fullname}}" />\n      <div class="status" ng-class="{true: \'online\', false: \'offline\'}[user.online]"></div>\n      <div ng-if="vm_ct.unreadMessage[user.id]" class="md-accent-bg unread-message-count">\n        {{vm_ct.unreadMessage[user.id]}}</div>\n      <div class="md-list-item-text">\n        <div layout="row">\n          <h3>{{user.fullname}}</h3>\n          <md-icon ng-if="!user.allowmessenger && user.role === \'agent\'" class="s16 margin-left-5" ng-style="{\'color\': \'red\' }" md-font-icon="icon-block-helper"></md-icon>\n        </div>\n        <p>{{user.name}} &#60;{{user.internal}}&#62;</p>\n        <div layout="row" layout-align="start center">\n          <md-icon ng-if="!user.lastMessage.read && user.lastMessage.FromId === vm_ct.currentUser.id" class="s16 no-margin" md-font-icon="icon-check"></md-icon>\n          <md-icon ng-if="user.lastMessage.read && user.lastMessage.FromId === vm_ct.currentUser.id" class="s16 no-margin" md-font-icon="icon-check-all md-accent"></md-icon>\n          <p>{{user.lastMessage.body | limitTo:20 }}{{user.lastMessage.body.length > 20 ? \'...\' : \'\' }}</p>\n          <span flex></span>\n          <p class="last-message" ng-if="user.lastMessageAt != vm_ct.standardDate">\n            {{user.lastMessageAt | formatdate}}</p>\n        </div>\n      </div>\n    </md-list-item>\n  </md-list>\n</div>\n\n<div class="chat" ng-show="vm_ct.user" layout="column">\n  <md-toolbar class="md-accent">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n\n      <div layout="row" layout-align="start center">\n        <md-button class="md-icon-button" ng-click="vm_ct.toggleChat()" aria-label="Back" translate translate-attr-aria-label="QUICKPANEL.BACK">\n          <md-icon md-font-icon="icon-keyboard-backspace"></md-icon>\n        </md-button>\n        <h4>\n          <span>{{vm_ct.user.fullname}}</span>\n        </h4>\n      </div>\n\n      <div layout="row" layout-align="end center">\n        <md-button ng-if="vm_ct.license.webrtc && vm_ct.currentUser.role === \'agent\' && vm_ct.currentUser.showWebBar === 2 && vm_ct.user.role === \'agent\'" class="md-icon-button" aria-label="Call" translate translate-attr-aria-label="QUICKPANEL.CALL" ng-click="vm_ct.webcall(vm_ct.user.name)">\n          <md-icon md-font-icon="icon-phone"></md-icon>\n        </md-button>\n        <md-menu ng-if="vm_ct.currentUser.phoneBarRemoteControl && vm_ct.currentUser.role === \'agent\' && vm_ct.currentUser.showWebBar === 0 && vm_ct.user.role === \'agent\'">\n          <md-button class="md-icon-button" aria-label="Call" translate translate-attr-aria-label="QUICKPANEL.CALL" ng-click="$mdOpenMenu($event)">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n\n          <md-menu-content width="3">\n            <md-menu-item ng-disabled="!vm_ct.currentUser.phoneBarRemoteControl">\n              <md-button ng-click="vm_ct.call(vm_ct.user.name)">\n                {{\'DASHBOARDS.CALL_NUMBER\' | translate}} ({{vm_ct.user.name}})\n              </md-button>\n            </md-menu-item>\n            <md-menu-item ng-disabled="!vm_ct.currentUser.phoneBarRemoteControl">\n              <md-button ng-click="vm_ct.transfer(vm_ct.user.name)">\n                {{\'DASHBOARDS.TRANSFER_NUMBER\' | translate}} ({{vm_ct.user.name}})\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n    </div>\n\n  </md-toolbar>\n  <md-content flex layout-paddings id="chat-dialog">\n    <div layout="row" ng-repeat="message in vm_ct.user.messages.rows" class="md-padding message-row" ng-class="message.FromId === vm_ct.currentUser.id ? \'user\' : \'contact\'">\n      <img ng-if="message.FromId === vm_ct.user.id" ng-src="{{vm_ct.user.userpic ? \'api/users/\' + vm_ct.user.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}" class="avatar" alt="{{vm_ct.user.fullname}}" />\n      <img ng-if="message.FromId === vm_ct.currentUser.id" class="avatar" ng-src="{{vm_ct.currentUser.userpic ? \'api/users/\' + vm_ct.currentUser.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}">\n      <div class="bubble" flex>\n        <span class="message" ng-bind-html="message.body | embed:{linkTarget:\'_blank\',emoji:false,fontSmiley:false}"></span>\n        <div layout="row" layout-align="end center">\n          <span class="time secondary-text">{{message.createdAt | formatdate }}</span>\n          <md-icon ng-if="!message.read && message.FromId === vm_ct.currentUser.id" class="s16 margin-5" md-font-icon="icon-check"></md-icon>\n          <md-icon ng-if="message.read && message.FromId === vm_ct.currentUser.id" class="s16 margin-5" md-font-icon="icon-check-all md-accent"></md-icon>\n        </div>\n      </div>\n    </div>\n  </md-content>\n\n  <form ng-submit="vm_ct.reply()" layout="row" class="reply" layout-align="start center">\n    <textarea ng-keyup="$event.keyCode == 13 && !vm_ct.disabled? vm_ct.reply() : null" flex ng-model="vm_ct.replyMessage" placeholder="Type and hit enter to send message" translate translate-attr-placeholder="QUICKPANEL.REPLY_PLACEHOLDER" autofocus></textarea>\n\n    <md-button ng-disable="vm_ct.disabled" class="md-fab md-mini" type="submit" aria-label="Send message" translate translate-attr-aria-label="QUICKPANEL.SEND_MESSAGE">\n      <md-icon md-font-icon="icon-send"></md-icon>\n    </md-button>\n  </form>\n</div>'),e.put("app/quick-panel/tabs/groups/create/dialog.html",'<md-dialog class="group-dialog" aria-label="New ChatGroup">\n  <form name="groupForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog(null)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      \x3c!--START Error--\x3e\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      \x3c!--END Error--\x3e\n\n      \x3c!--START NAME--\x3e\n      <md-input-container class="md-block">\n        <label translate="QUICKPANEL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.group.name" required autofocus>\n        <div ng-messages="groupForm[\'name\'].$error" ng-show="groupForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="QUICKPANEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="QUICKPANEL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      \x3c!--END NAME--\x3e\n\n      \x3c!--START Members--\x3e\n      <md-input-container class="md-block">\n        <label translate="QUICKPANEL.MEMBERS">Members</label>\n        <md-contact-chips ng-model="vm.group.members" md-contacts="vm.querySearch($query)" md-contact-name="name" md-contact-image="image" md-require-match="true" md-highlight-flags="i" placeholder="{{\'QUICKPANEL.MEMBERS\' | translate}}">\n        </md-contact-chips>\n        <div ng-messages="groupForm[\'strategy\'].$error" ng-show="groupForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="QUICKPANEL.ERRORS.MEMBERS_REQUIRED">Members field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      \x3c!--END Members--\x3e\n\n      \x3c!--START Writing--\x3e\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.group.write" aria-label="Write">\n          {{\'QUICKPANEL.ENABLE_WRITING\' | translate}}\n        </md-switch>\n      </md-input-container>\n      \x3c!--END Writing--\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.newChatGroup" ng-click="vm.saveChatGroup()" class="send-button md-accent md-raised" ng-disabled="groupForm.$invalid || groupForm.$pristine || (vm.group.members.length < 1)" aria-label="SAVE" translate="QUICKPANEL.SAVE" translate-attr-aria-label="QUICKPANEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/quick-panel/tabs/groups/group-tab.html",'<div class="main" ng-if="!vm_cg.group">\n  <md-subheader>\n    <div layout="row">\n      \x3c!-- START Search --\x3e\n      <div class="search" layout="row" layout-align="start center" flex>\n        <md-icon md-font-icon="icon-magnify" class="icon search-icon"></md-icon>\n        <input ng-model="vm_cg.search" type="text" translate translate-attr-placeholder="QUICKPANEL.SEARCH" flex>\n      </div>\n      \x3c!-- END Search --\x3e\n\n      \x3c!-- START New Group --\x3e\n      <md-button ng-if="vm_cg.currentUser.role !== \'agent\'" class="md-icon-button" aria-label="New" ng-click="vm_cg.addGroup(null, $event)">\n        <md-icon md-font-icon="icon-account-multiple-plus" class="icon"></md-icon>\n      </md-button>\n      \x3c!-- END New Group --\x3e\n    </div>\n  </md-subheader>\n\n  <md-divider></md-divider>\n\n  \x3c!-- START Groups --\x3e\n  <md-list class="recent no-padding">\n    \x3c!-- START Group --\x3e\n    <md-list-item class="contact" ng-repeat="group in vm_cg.groupsToArray() | filter:vm_cg.search" ng-click="vm_cg.toggleChat(group)">\n      <img src="assets/images/avatars/group.png" class="md-avatar" alt="{{group.name}}" />\n      <div ng-if="group.unreadGroupMessages" class="md-accent-bg unread-message-count">{{group.unreadGroupMessages}}</div>\n      <div class="md-list-item-text">\n        <div layout="row">\n          <h3>{{group.name}}</h3>\n        </div>\n      </div>\n\n      <md-button ng-if="vm_cg.currentUser.role !== \'agent\'" class="md-secondary md-icon-button" aria-label="Remove" ng-click="vm_cg.deleteGroup(group, $event)">\n        <md-icon md-font-icon="icon-delete" class="icon s18"></md-icon>\n      </md-button>\n\n      <md-divider ng-if="!$last"></md-divider>\n    </md-list-item>\n    <md-list-item>\n      <div ng-if="!vm_cg.groupsToArray().length" layout="row" layout-align="center center" flex>\n        <span>{{\'QUICKPANEL.NO_AVAILABLE_GROUPS\' | translate}}</span>\n      </div>\n    </md-list-item>\n    \x3c!-- END Group --\x3e\n  </md-list>\n  \x3c!-- END Groups --\x3e\n</div>\n\n<div class="chat" ng-if="vm_cg.group" layout="column">\n  <md-toolbar class="md-accent">\n    <div class="md-toolbar-tools " layout="row" layout-align="space-between center">\n      <md-button class="md-icon-button" ng-click="vm_cg.back()" aria-label="Back" translate translate-attr-aria-label="QUICKPANEL.BACK" flex="15">\n        <md-icon md-font-icon="icon-keyboard-backspace"></md-icon>\n      </md-button>\n      <h4 flex layout-align="start center" style="max-height: 100%; overflow-y:auto;">\n        <span translate="QUICKPANEL.YOU" translate-values=\'{participants: vm_cg.participants}\'></span>\n      </h4>\n\n      <div layout="row" layout-align="end center">\n        <md-button ng-if="vm_cg.license.webrtc && vm_cg.currentUser.role === \'agent\' && vm_cg.currentUser.showWebBar === 2 && vm_cg.user.role === \'agent\' && vm_cg.user.showWebBar === 2" class="md-icon-button" aria-label="Call" translate translate-attr-aria-label="QUICKPANEL.CALL" ng-click="vm_cg.webcall(vm_cg.user.name)">\n          <md-icon md-font-icon="icon-phone"></md-icon>\n        </md-button>\n      </div>\n    </div>\n\n  </md-toolbar>\n  <md-content flex layout-paddings id="chat-group-dialog">\n    <div layout="row" ng-repeat="message in vm_cg.group.messages" class="message-row" ng-class="message.FromId === vm_cg.currentUser.id ? \'user\' : \'contact\'">\n      <img ng-if="message.FromId !== vm_cg.currentUser.id" ng-src="{{\'api/users/\' + message.FromId + \'/avatar\'}}" class="avatar" alt="{{vm_cg.user.fullname}}" />\n      <img ng-if="message.FromId === vm_cg.currentUser.id" class="avatar" ng-src="{{vm_cg.currentUser.userpic ? \'api/users/\' + vm_cg.currentUser.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}">\n      <div class="bubble" flex>\n        <div ng-if="message.FromId !== vm_cg.currentUser.id">\n          <span style="font-size: 12px;">{{vm_cg.group.membersByKeys[message.FromId].fullname}}</span>\n        </div>\n        <span class="message" ng-bind-html="message.body | embed:{linkTarget:\'_blank\',emoji:false,fontSmiley:false}"></span>\n        <div layout="row" layout-align="end center">\n          <span class="time secondary-text" style="margin-top: 0px;">{{message.createdAt | formatdate }}</span>\n          <md-icon ng-if="message.FromId === vm_cg.currentUser.id" class="s16 margin-5" style="cursor: pointer;" md-font-icon="icon-information-outline" ng-click="vm_cg.showMessageInfo($event, message)"></md-icon>\n        </div>\n      </div>\n    </div>\n  </md-content>\n\n  <form ng-if="(vm_cg.currentUser.role !== \'agent\') || vm_cg.group.write" ng-submit="vm_cg.reply()" layout="row" class="reply" layout-align="start center">\n    <textarea ng-keyup="$event.keyCode == 13 ? vm_cg.reply() : null" flex ng-model="vm_cg.replyMessage" placeholder="Type and hit enter to send message" translate translate-attr-placeholder="QUICKPANEL.REPLY_PLACEHOLDER" autofocus></textarea>\n\n    <md-button class="md-fab md-mini" type="submit" aria-label="Send message" translate translate-attr-aria-label="QUICKPANEL.SEND_MESSAGE">\n      <md-icon md-font-icon="icon-send"></md-icon>\n    </md-button>\n  </form>\n</div>'),e.put("app/quick-panel/tabs/groups/info/dialog.html",'<md-dialog class="group-dialog" aria-label="New ChatGroup">\n  <form name="groupForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog(null)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div ng-if="vm.data.messages[$index].FromId !== vm.data.messages[$index].ToId" ng-repeat="user in vm.data.users" layout-margin>\n        <div layout="row">\n          <div layout="row" layout-align="start center">\n            <img ng-src="{{user.userpic ? \'api/users/\' + user.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}" class="avatar" alt="{{user.fullname}}" />\n            <span>{{user.fullname}}</span>\n          </div>\n          <div layout="row" layout-align="end center" flex>\n            <md-icon class="s16 margin-5" md-font-icon="{{vm.data.messages[$index].read ? \'icon-check-all md-accent\' : \'icon-check\'}}"></md-icon>\n            <span class="time secondary-text">{{vm.data.messages[$index].updatedAt | formatdate }}</span>\n          </div>\n        </div>\n        <div>\n          <md-divider ng-if="!$last"></md-divider>\n        </div>\n      </div>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/quick-panel/tabs/today/today-tab.html",'<md-list class="date">\n  <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.TODAY">Today</span></md-subheader>\n  <md-list-item class="md-display-1 md-2-line">\n    <div class="secondary-text">\n      <div translate="QUICKPANEL.{{ (vm.date | date:\'EEEE\').toUpperCase() }}"></div>\n      <div layout="row" layout-align="start start">\n        <span> {{vm.date | date:\'d\'}}</span>\n        <span class="md-subhead">th</span>\n        <span translate="QUICKPANEL.{{ (vm.date | date:\'MMMM\').toUpperCase() }}"></span>\n      </div>\n    </div>\n  </md-list-item>\n</md-list>\n\n\x3c!-- <md-divider></md-divider>\n\n<md-list>\n    <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.EVENTS">Events</span></md-subheader>\n\n    <md-list-item class="md-2-line" ng-repeat="event in vm.events" ng-click="dummyFunction()">\n        <div class="md-list-item-text">\n            <h3>{{event.title}}</h3>\n\n            <p>{{event.detail}}</p>\n        </div>\n    </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list>\n    <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.NOTES">Notes</span></md-subheader>\n    <md-list-item class="md-2-line" ng-repeat="note in vm.notes" ng-click="dummyFunction()">\n        <div class="md-list-item-text">\n            <h3>{{note.title}}</h3>\n\n            <p>{{note.detail}}</p>\n        </div>\n    </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list>\n    <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.QUICK_SETTINGS">Quick Settings</span></md-subheader>\n\n    <md-list-item>\n        <h3 translate="QUICKPANEL.NOTIFICATIONS">Notifications</h3>\n        <md-switch class="md-secondary" ng-model="vm.settings.notify" aria-label="Notifications" translate\n                   translate-attr-aria-label="QUICKPANEL.NOTIFICATIONS"></md-switch>\n    </md-list-item>\n\n    <md-list-item>\n        <h3 translate="QUICKPANEL.CLOUD_SYNC">Cloud Sync</h3>\n        <md-switch class="md-secondary" ng-model="vm.settings.cloud" aria-label="Cloud Sync" translate\n                   translate-attr-aria-label="QUICKPANEL.CLOUD_SYNC"></md-switch>\n    </md-list-item>\n\n    <md-list-item>\n        <h3 translate="QUICKPANEL.RETRO_THRUSTERS">Retro Thrusters</h3>\n        <md-switch class="md-secondary md-warn" ng-model="vm.settings.retro" aria-label="Retro Thrusters" translate\n                   translate-attr-aria-label="QUICKPANEL.RETRO_THRUSTERS"></md-switch>\n    </md-list-item>\n</md-list> --\x3e'),e.put("app/reset/reset.html",'<div id="reset-password" class="flex-scrollable" layout="column" ng-init="vm.onInit()">\n  <div id="reset-password-form-wrapper" layout="column" layout-align="center center">\n    <div id="reset-password-form" class="md-whiteframe-8dp">\n\n      <img src="/api/settings/1/logo_login" alt="logo_login" class="logo_login" />\n\n      <div class="title" translate="RESETPASSWORD.TITLE">Reset your password</div>\n\n      <form name="resetPasswordForm" novalidate>\n\n        <md-input-container class="md-block" md-no-float>\n          <input type="password" name="password" ng-model="vm.form.password" ng-pattern="vm.passwordPattern" placeholder="Password" translate translate-attr-placeholder="RESETPASSWORD.PASSWORD" required>\n          <div ng-messages="resetPasswordForm.password.$error" role="alert">\n            <div ng-message="required">\n              <span translate="RESETPASSWORD.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="RESETPASSWORD.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block" md-no-float>\n          <input type="password" name="passwordConfirm" ng-model="vm.form.passwordConfirm" placeholder="Password (Confirm)" match-password="password" translate translate-attr-placeholder="RESETPASSWORD.PASSWORD_CONFIRM">\n          <div ng-messages="resetPasswordForm.passwordConfirm.$error" role="alert">\n            <div ng-message="passwordMatch">\n              <span translate="TOOLBAR.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-button type="button" ng-click="vm.resetPassword()" class="md-raised md-accent submit-button" aria-label="UPDATE MY PASSWORD" ng-disabled="resetPasswordForm.$invalid || resetPasswordForm.$pristine" translate="RESETPASSWORD.UPDATE_PASSWORD" translate-attr-aria-label="RESETPASSWORD.UPDATE_PASSWORD">\n          RESET MY PASSWORD\n        </md-button>\n      </form>\n    </div>\n  </div>\n</div>'),e.put("app/toolbar/autoanswers/dialog.html",'<md-dialog class="autoanswers-dialog" aria-label="autoanswers">\n  <form name="autoanswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ (\'TOOLBAR.AUTOANSWER_NOTIFICATIONS\' | translate)  }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content layout-padding>\n      <md-table-container>\n        <table md-table multiple>\n          <thead md-head>\n            <tr md-row>\n              <th></th>\n              <th md-column>{{ \'TOOLBAR.CHANNEL\' | translate }}</th>\n              <th md-column>{{ \'TOOLBAR.NOTIFICATIONS\' | translate }}</th>\n              <th md-column>{{ \'TOOLBAR.DELAY\' | translate }}</th>\n            </tr>\n          </thead>\n          <tbody md-body>\n            <tr md-row ng-repeat="item in vm.items" ng-if="item.permission">\n              <td>\n                <md-icon md-font-icon="{{item.font_icon}}" class="icon {{item.class}} {{item.font_icon}}" aria-label="{{item.label}}"></md-icon>\n              </td>\n              <td md-cell>\n                <div layout="row">\n                  <span translate="{{item.title}}"></span>\n                </div>\n              </td>\n              <td md-cell align="center">\n                <div layout="row" layout-align="center">\n                  <md-icon ng-if="item.enabled" md-font-icon="icon-check-circle" class="icon green-700-fg"></md-icon>\n                  <span ng-if="!item.enabled" style="color:red">X</span>\n                </div>\n              </td>\n              <td md-cell align="right">\n                <div layout="row" layout-align="end">\n                  <span ng-if="item.enabled">{{item.delay}}</span>\n                </div>\n              </td>\n            </tr>\n          </tbody>\n        </table>\n      </md-table-container>\n    </md-dialog-content>\n\n    <md-dialog-actions class="md-dialog-action-center padding-rigth-15">\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/toolbar/changepassword/changepassword.html",'<md-dialog class="user-dialog" aria-label="{{vm.name}}">\n  <form name="changePasswordForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span ng-if="vm.reset" class="title" translate="TOOLBAR.RESETPASSWORD">Reset Password</span>\n        <span ng-if="!vm.reset" class="title" translate="TOOLBAR.CHANGEPASSWORD">Change Password</span>\n        <md-button ng-if="!vm.reset" class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLBAR.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="TOOLBAR.OLD_PASSWORD" required>\n        <div ng-messages="changePasswordForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLBAR.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLBAR.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="TOOLBAR.NEW_PASSWORD" required>\n        <div ng-messages="changePasswordForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLBAR.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLBAR.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="TOOLBAR.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLBAR.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="changePasswordForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="TOOLBAR.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="TOOLBAR.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="changePasswordForm.$invalid || changePasswordForm.$pristine" aria-label="SAVE" translate="TOOLBAR.SAVE" translate-attr-aria-label="TOOLBAR.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/toolbar/layouts/vertical-navigation/toolbar.html",'<div layout="row" layout-align="start center">\n  <div layout="row" layout-align="start center" flex>\n    <md-button id="navigation-toggle" class="md-icon-button" ng-click="vm.toggleSidenav(\'navigation\')" hide-gt-sm aria-label="Toggle navigation" translate translate-attr-aria-label="TOOLBAR.TOGGLE_NAVIGATION">\n      <md-icon md-font-icon="icon-menu" class="icon"></md-icon>\n    </md-button>\n\n    <ms-shortcuts ng-if="!vm.isAgent()"></ms-shortcuts>\n\n    <div class="toolbar-separator"></div>\n\n    <div ng-if="vm.license.demo" class="blink md-padding">\n      <span class="md-warn-fg" translate="TOOLBAR.TRIAL_VERSION">Trial Version</span>\n    </div>\n\n    <div ng-if="vm.isAgent()" class="logo" layout-padding-left-8 layout="row" layout-align="start center">\n      <span class="logo-image"><img src="/api/settings/1/logo" alt="logo" /></span>\n      <span ng-show="vm.isAgent() && (vm.user.showWebBar != 2)" class="logo-text text-truncate">{{ vm.getLogo() |\n        uppercase }}</span>\n    </div>\n\n    \x3c!-- phonebar directive WebRtc type--\x3e\n    <ms-phonebar class="ms-phonebar" ng-if="vm.isAgent() && (vm.user.showWebBar == 2)" conf="vm.conf" sessions="vm.webRTCSessions" flex></ms-phonebar>\n    \x3c!-- phonebar directive --\x3e\n  </div>\n\n  <div layout="row" layout-align="start center">\n\n    <md-progress-circular id="toolbar-progress" ng-if="$root.loadingProgress" class="md-accent" md-diameter="32">\n    </md-progress-circular>\n\n    \x3c!-- Pause Management --\x3e\n    <div ng-if="vm.isAgent() && (vm.user.showWebBar != 0)" layout="row" layout-align="end center">\n      <div class="toolbar-separator"></div>\n\n      <div class="border brad-5" layout="row" layout-align="center center" layout-margin>\n        <md-button ng-if="vm.user.voicePause" class="md-icon-button no-margin" ng-click="vm.unpause()">\n          <md-icon md-font-icon="icon-play-circle-outline" class="icon s24"></md-icon>\n          <md-tooltip md-direction="bottom">{{\'TOOLBAR.RESUME\' | translate}}</md-tooltip>\n        </md-button>\n\n        <md-button ng-disabled="vm.user.voicePause && \'DEFAULT PAUSE\' === vm.user.pauseType" class="md-icon-button no-margin" ng-click="vm.pause()">\n          <md-icon md-font-icon="icon-pause-circle-outline" class="icon s24"></md-icon>\n          <md-tooltip md-direction="bottom">{{\'TOOLBAR.PAUSE\' | translate}}</md-tooltip>\n        </md-button>\n\n        <md-menu>\n          <md-button aria-label="Pauses" class="md-icon-button no-margin" ng-click="$mdOpenMenu($event)">\n            <md-icon md-menu-origin md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-menu-content width="4">\n            <md-menu-item ng-if="!vm.pauses.length">\n              <md-button disabled="disabled">\n                <md-icon md-font-icon="icon-pause-octagon" md-menu-align-target></md-icon>\n                {{\'TOOLBAR.NO_PAUSES_AVAILABLE\' | translate}}\n              </md-button>\n            </md-menu-item>\n            <md-menu-item ng-repeat="pause in vm.pauses">\n              <md-button ng-disabled="vm.user.voicePause && pause.name === vm.user.pauseType" ng-click="vm.pause(pause.name)">\n                <md-icon md-font-icon="icon-pause-circle" md-menu-align-target></md-icon>\n                {{pause.name}}\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n    </div>\n    \x3c!-- Pause Management --\x3e\n\n    <div class="h5 padding-10" ng-if="vm.isAgent() && (vm.user.showWebBar != 0)">\n      <div layout="row" layout-align="space-between center">\n        <timer ng-if="vm.user.lastLoginAt" start-time="vm.user.lastLoginAt"></timer>\n        <md-tooltip>{{\'TOOLBAR.LOGIN_TIME\' | translate}}</md-tooltip>\n        <md-icon md-font-icon="icon-timelapse" class="icon s16"></md-icon>\n      </div>\n      <div layout="row" layout-align="center center" ng-if="vm.user.voicePause">\n        <timer start-time="vm.user.lastPauseAt"></timer>\n        <md-tooltip>{{\'TOOLBAR.PAUSE_TIME\' | translate}}</md-tooltip>\n        <md-icon md-font-icon="icon-coffee" class="icon s16"></md-icon>\n      </div>\n      <div ng-if="vm.user.voicePause">\n        <span class="blink red-fg">{{vm.user.pauseType || \'default\' | uppercase}}</span>\n      </div>\n    </div>\n\n    <div class="toolbar-separator" ng-if="vm.isAgent() && (vm.user.showWebBar != 0)"></div>\n\n    <md-menu-bar id="user-menu">\n      <md-menu md-position-mode="left bottom">\n        <md-button class="user-button" ng-click="$mdOpenMenu()" aria-label="User settings" translate translate-attr-aria-label="TOOLBAR.USER_SETTINGS">\n          <div layout="row" layout-align="space-between center">\n            <div class="avatar-wrapper">\n              <img md-menu-align-target class="avatar" src="assets/images/avatars/profile.png" ng-if="!vm.user.userpic">\n              <img md-menu-align-target class="avatar" ng-src="api/users/{{vm.user.id}}/avatar" ng-if="vm.user.userpic">\n              <md-icon md-font-icon ng-class="vm.userStatus.icon" ng-style="{\'color\': vm.userStatus.color }" class="icon status s16"></md-icon>\n            </div>\n            <div layout="column" layout-align="center center" class="padding-horizontal-5">\n              <span class="font-size-14 md-subhead">{{vm.user.fullname}}</span>\n              <span class="font-size-12 md-subhead">{{vm.user.name}} &#60;{{vm.user.internal}}&#62;</span>\n            </div>\n\n            <md-icon md-font-icon="icon-chevron-down" class="icon s16" hide-xs></md-icon>\n          </div>\n        </md-button>\n\n        <md-menu-content width="3">\n          <md-menu-item ng-if="vm.user.showWebBar == 2 && vm.user.phoneBarEnableSettings" class="md-indent">\n            <md-icon md-font-icon="icon-cog" class="icon"></md-icon>\n            <md-button ng-click="vm.openSettings($event)" ng-disabled="!vm.license.webrtc"><span translate="TOOLBAR.SETTINGS">SETTINGS</span></md-button>\n          </md-menu-item>\n\n          <md-menu-item class="md-indent">\n            <md-icon md-font-icon="icon-key-variant" class="icon"></md-icon>\n            <md-button ng-click="vm.changePassword($event)"><span translate="TOOLBAR.CHANGEPASSWORD">Change\n                Password</span></md-button>\n          </md-menu-item>\n\n          <md-menu-divider></md-menu-divider>\n\n          <md-menu-item class="md-indent">\n            <md-icon md-font-icon="icon-logout" class="icon"></md-icon>\n            <md-button ng-click="vm.logout()">Logout</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </md-menu-bar>\n\n    <div class="toolbar-separator"></div>\n\n    <md-button ng-if="vm.user.role === \'agent\' && (vm.license.chat || vm.license.mail || vm.license.messaging || vm.license.openchannel || vm.license.fax || vm.license.whatsapp)" class="preview-button no-margin" ng-disabled="vm.disable" ng-click="vm.autoAnswerNotificationsDialog($event)" aria-label="Language" md-menu-origin md-menu-align-target>\n      <md-icon md-font-icon="icon-reply" class="icon {{ vm.autoanswerIconColor }}"></md-icon>\n      <md-tooltip><span translate="TOOLBAR.AUTOANSWER_NOTIFICATIONS">Notifications</span></md-tooltip>\n    </md-button>\n\n    <md-button ng-if="vm.user.role === \'agent\' && vm.license.dialer" class="preview-button no-margin" ng-disabled="vm.disable" ng-click="vm.preview($event)" aria-label="Language" md-menu-origin md-menu-align-target>\n      <div ng-if="vm.contacts" class="md-accent-bg open-contact-count">{{vm.contacts > 99 ? \'99+\' : vm.contacts}}</div>\n      <md-icon md-font-icon="icon-fire" class="icon red-900-fg"></md-icon>\n      <md-tooltip><span translate="TOOLBAR.PREVIEW">Preview</span></md-tooltip>\n    </md-button>\n\n    <ms-search-bar ng-if="vm.user.role !== \'agent\'" on-search="vm.search(query)" on-result-click="vm.searchResultClick(item)" debounce="300" collapse-on-blur="true"></ms-search-bar>\n\n    <md-menu id="language-menu" md-offset="0 72" md-position-mode="target-right target" layout="column" layout-align="center center">\n      <md-button class="md-icon-button no-margin" ng-click="$mdOpenMenu()" aria-label="Language" md-menu-origin md-menu-align-target>\n        <div layout="row" layout-align="center center">\n          <img class="flag" ng-src="assets/images/flags/{{vm.selectedLanguage.flag}}.png">\n        </div>\n      </md-button>\n\n      <md-menu-content width="3" id="language-menu-content">\n        <md-menu-item ng-repeat="(iso, lang) in vm.languages">\n          <md-button ng-click="vm.changeLanguage(lang)" aria-label="{{lang.title}}" translate translate-attr-aria-label="{{lang.title}}">\n            <span layout="row" layout-align="start center">\n              <img class="flag flag-24" ng-src="assets/images/flags/{{lang.flag}}.png">\n              <span>{{ lang.translation | translate | startcase }}</span>\n            </span>\n          </md-button>\n        </md-menu-item>\n      </md-menu-content>\n    </md-menu>\n\n    <div class="toolbar-separator"></div>\n\n    <md-button ng-if="vm.license.gray && vm.user.role !== \'agent\'" class="md-icon-button" ui-sref="app.settings.license" aria-label="Toggle quick panel">\n      <md-icon md-font-icon="icon-alert" class="icon md-warn blink"></md-icon>\n    </md-button>\n    <md-button ng-if="vm.license.gray && vm.user.role === \'agent\'" class="md-icon-button" aria-label="Toggle quick panel">\n      <md-icon md-font-icon="icon-alert" class="icon md-warn blink"></md-icon>\n    </md-button>\n\n    <div ng-if="vm.license.gray" class="toolbar-separator"></div>\n\n    <md-button id="quick-panel-toggle" class="md-icon-button" ng-click="vm.toggleSidenav(\'quick-panel\')" aria-label="Toggle quick panel" translate translate-attr-aria-label="TOOLBAR.TOGGLE_QUICK_PANEL">\n      <div ng-if="(vm.unreadTotalMessages + vm.unreadTotalGroupMessages)" class="md-accent-bg unread-message-count">\n        {{vm.unreadTotalMessages + vm.unreadTotalGroupMessages}}</div>\n      <md-icon md-font-icon="icon-format-list-bulleted" class="icon"></md-icon>\n    </md-button>\n  </div>\n</div>'),e.put("app/toolbar/preview/dialog.html",'<md-dialog class="preview-dialog" aria-label="preview">\n  <form name="previewForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ (\'TOOLBAR.PREVIEW\' | translate) + (vm.preview.recallme ? \' - \' +\n          (\'CONTACTMANAGER.RECALLME\' | translate | uppercase) : \'\') }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div ng-if="vm.preview">\n        <div ng-if="vm.preview.recallme" layout="row" class="recall-me-info">\n          <md-icon md-font-icon="icon-information-outline" aria-label="Recall Me"></md-icon>\n          <p class="ml-5" translate="TOOLBAR.HELP.PREVIEW_RECALLME" translate-values="{ date: (vm.preview.scheduledat | date:\'short\') }" flex></p>\n        </div>\n        <div layout="row">\n          <div class="md-padding md-margin" layout="column" flex="30">\n            <md-input-container ng-if="vm.preview.Contact.id" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.ID">ID</label>\n              <input type="text" ng-model="vm.preview.Contact.id" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.Queue.name" class="md-block no-margin">\n              <label translate="VOICE.QUEUE">Queue</label>\n              <input type="text" ng-model="vm.preview.Queue.name" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.List.name" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.LIST">List</label>\n              <input type="text" ng-model="vm.preview.List.name" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.Contact.tags && vm.preview.Contact.tags.length" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.TAGS">Tags</label>\n              <input type="text" ng-model="vm.preview.Contact.tags" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.Contact.Company && vm.preview.Contact.Company.name" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.COMPANY">Company</label>\n              <input type="text" ng-model="vm.preview.Contact.Company.name" disabled="true">\n            </md-input-container>\n          </div>\n          <md-divider></md-divider>\n          <div class="md-padding md-margin" layout="column" flex="35">\n            <md-input-container ng-repeat="(key, value) in vm.preview.Contact" ng-if="!vm.isNil(value) && !vm.isCustomField(key) && !vm.isHiddenField(key)" class="md-block no-margin">\n              <label>{{ \'CONTACTMANAGER.\' + key.toUpperCase() | translate}}</label>\n              <input type="text" ng-model="value" disabled="true">\n            </md-input-container>\n\n            <md-input-container ng-if="vm.additionalItems.length>0" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.ADDITIONAL_PHONES">Additional phones</label>\n              <md-chips ng-model="vm.additionalItems" placeholder="Phone numbers" readonly="true">\n                <md-chip-template custom-chip alt="{{$chip.type}} {{$chip.description}}" title="{{$chip.type}} {{$chip.description}}">\n                  {{ $chip.phone }}\n                </md-chip-template>\n              </md-chips>\n            </md-input-container>\n\n          </div>\n          <div class="md-padding md-margin" layout="column" flex="35">\n            <md-input-container ng-repeat="(key, value) in vm.preview.Contact" ng-if="!vm.isNil(value) && vm.isCustomField(key) && !vm.isHiddenField(key)" class="md-block no-margin">\n              <label>{{ vm.customFieldsMap[key] || key }}</label>\n              <input type="text" ng-model="value" disabled="true">\n            </md-input-container>\n          </div>\n        </div>\n      </div>\n      <div layout="row" ng-if="!vm.preview">\n        <span>no contacts available</span>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions class="md-dialog-action-center padding-rigth-15">\n      <md-button class="md-icon-button md-primary" ng-if="!vm.isRecallNotification" ng-hide="vm.hopperIds.length <= 1" ng-disabled="vm.disableGetContact" ng-click="vm.previousContact()" aria-label="PREVIOUSCONTACT" translate-attr-aria-label="TOOLS.PREVIOUSCONTACT">\n        <md-icon md-font-icon="icon-chevron-left"></md-icon>\n      </md-button>\n      <md-button class="md-fab green-bg" aria-label="CALL" translate-attr-aria-label="TOOLS.CALL" ng-disabled="vm.disable" ng-click="vm.originatePreview($event)">\n        <md-icon md-font-icon="icon-phone"></md-icon>\n      </md-button>\n      <md-button class="md-icon-button md-primary" ng-if="!vm.isRecallNotification" ng-disabled="vm.disableGetContact" ng-click="vm.nextContact()" aria-label="NEXTCONTACT" translate-attr-aria-label="TOOLS.NEXTCONTACT">\n        <md-icon md-font-icon="icon-chevron-right"></md-icon>\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>')}]);
\ No newline at end of file
index c828008..dfd1e18 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d4f=['TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','integration','motionbar','jscripty','urlForward','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]'];(function(_0x433dd7,_0x5f2ae8){var _0x218e80=function(_0x402804){while(--_0x402804){_0x433dd7['push'](_0x433dd7['shift']());}};_0x218e80(++_0x5f2ae8);}(_0x6d4f,0x121));var _0xf6d4=function(_0x375126,_0x514a8e){_0x375126=_0x375126-0x0;var _0x1f76bb=_0x6d4f[_0x375126];return _0x1f76bb;};'use strict';var Sequelize=require(_0xf6d4('0x0'));module[_0xf6d4('0x1')]={'name':{'type':Sequelize[_0xf6d4('0x2')],'get':function(_0x24d92d){return this[_0xf6d4('0x3')](_0xf6d4('0x4'));}},'action':{'type':Sequelize[_0xf6d4('0x5')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xf6d4('0x6'),_0xf6d4('0x7'),_0xf6d4('0x8'),_0xf6d4('0x9'),'browser','bot',_0xf6d4('0xa')]],'msg':_0xf6d4('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xf6d4('0x5')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xf6d4('0xc')},'data3':{'type':Sequelize[_0xf6d4('0x5')](0x1000),'comment':_0xf6d4('0xd')},'data4':{'type':Sequelize[_0xf6d4('0x5')](0x1000),'comments':_0xf6d4('0xe')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xf6d4('0xf')},'data6':{'type':Sequelize['STRING'],'comments':_0xf6d4('0x10')},'data7':{'type':Sequelize[_0xf6d4('0x11')],'comments':'urlForward[body]'}};
\ No newline at end of file
+var _0x2d0c=['contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x2d0c,0x70));var _0xc2d0=function(_0x12916b,_0x3ba82d){_0x12916b=_0x12916b-0x0;var _0x58d533=_0x2d0c[_0x12916b];return _0x58d533;};'use strict';var Sequelize=require(_0xc2d0('0x0'));module[_0xc2d0('0x1')]={'name':{'type':Sequelize[_0xc2d0('0x2')],'get':function(_0x5f18ed){return this[_0xc2d0('0x3')](_0xc2d0('0x4'));}},'action':{'type':Sequelize[_0xc2d0('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xc2d0('0x6'),_0xc2d0('0x7'),_0xc2d0('0x8'),_0xc2d0('0x9'),'urlForward',_0xc2d0('0xa'),'bot',_0xc2d0('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xc2d0('0xc')},'data1':{'type':Sequelize[_0xc2d0('0x5')](0x1000),'comment':_0xc2d0('0xd')},'data2':{'type':Sequelize[_0xc2d0('0x5')](0x1000),'comment':_0xc2d0('0xe')},'data3':{'type':Sequelize[_0xc2d0('0x5')](0x1000),'comment':_0xc2d0('0xf')},'data4':{'type':Sequelize[_0xc2d0('0x5')](0x1000),'comments':_0xc2d0('0x10')},'data5':{'type':Sequelize[_0xc2d0('0x5')](0x1000),'comments':_0xc2d0('0x11')},'data6':{'type':Sequelize['STRING'],'comments':_0xc2d0('0x12')},'data7':{'type':Sequelize[_0xc2d0('0x13')],'comments':_0xc2d0('0x14')}};
\ No newline at end of file
index 3630ddb..7100bff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6911=['catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','error','stack','name','send','body','Action','find','params','then','destroy'];(function(_0x195577,_0x5de53a){var _0x13c367=function(_0x583022){while(--_0x583022){_0x195577['push'](_0x195577['shift']());}};_0x13c367(++_0x5de53a);}(_0x6911,0x1d7));var _0x1691=function(_0x2f7f95,_0x3c5f08){_0x2f7f95=_0x2f7f95-0x0;var _0x8b04e3=_0x6911[_0x2f7f95];return _0x8b04e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1691('0x0'));var zipdir=require(_0x1691('0x1'));var jsonpatch=require(_0x1691('0x2'));var rp=require(_0x1691('0x3'));var moment=require(_0x1691('0x4'));var BPromise=require(_0x1691('0x5'));var Mustache=require('mustache');var util=require(_0x1691('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1691('0x7'));var ejs=require(_0x1691('0x8'));var fs=require('fs');var fs_extra=require(_0x1691('0x9'));var _=require(_0x1691('0xa'));var squel=require(_0x1691('0xb'));var crypto=require(_0x1691('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1691('0xd'));var Papa=require(_0x1691('0xe'));var Redis=require(_0x1691('0xf'));var authService=require(_0x1691('0x10'));var qs=require(_0x1691('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1691('0x12'));var logger=require(_0x1691('0x13'))(_0x1691('0x14'));var utils=require(_0x1691('0x15'));var config=require(_0x1691('0x16'));var licenseUtil=require(_0x1691('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3876fa,_0x593aa9){_0x593aa9=_0x593aa9||0xcc;return function(_0xc043aa){if(_0xc043aa){return _0x3876fa[_0x1691('0x18')](_0x593aa9);}return _0x3876fa[_0x1691('0x19')](_0x593aa9)[_0x1691('0x1a')]();};}function respondWithResult(_0x476ea8,_0x18295b){_0x18295b=_0x18295b||0xc8;return function(_0x59db43){if(_0x59db43){return _0x476ea8[_0x1691('0x19')](_0x18295b)[_0x1691('0x1b')](_0x59db43);}};}function respondWithFilteredResult(_0x3a5141,_0x121cf5){return function(_0x3977ed){if(_0x3977ed){var _0x3955b2=typeof _0x121cf5['offset']===_0x1691('0x1c')&&typeof _0x121cf5[_0x1691('0x1d')]===_0x1691('0x1c');var _0x1c4c3a=_0x3977ed[_0x1691('0x1e')];var _0x22f301=_0x3955b2?0x0:_0x121cf5['offset'];var _0x7c433e=_0x3955b2?_0x3977ed[_0x1691('0x1e')]:_0x121cf5[_0x1691('0x1f')]+_0x121cf5[_0x1691('0x1d')];var _0x59d189;if(_0x7c433e>=_0x1c4c3a){_0x7c433e=_0x1c4c3a;_0x59d189=0xc8;}else{_0x59d189=0xce;}_0x3a5141['status'](_0x59d189);return _0x3a5141[_0x1691('0x20')]('Content-Range',_0x22f301+'-'+_0x7c433e+'/'+_0x1c4c3a)[_0x1691('0x1b')](_0x3977ed);}return null;};}function patchUpdates(_0x3c1cb5){return function(_0x2ceca7){try{jsonpatch['apply'](_0x2ceca7,_0x3c1cb5,!![]);}catch(_0x29ab7f){return BPromise[_0x1691('0x21')](_0x29ab7f);}return _0x2ceca7[_0x1691('0x22')]();};}function saveUpdates(_0x165fb3,_0x17bdbb){return function(_0x456e10){if(_0x456e10){return _0x456e10[_0x1691('0x23')](_0x165fb3)['then'](function(_0x3999ca){return _0x3999ca;});}return null;};}function removeEntity(_0x2bbcdf,_0x33da35){return function(_0x189ea5){if(_0x189ea5){return _0x189ea5['destroy']()['then'](function(){_0x2bbcdf['status'](0xcc)[_0x1691('0x1a')]();});}};}function handleEntityNotFound(_0x284ab5,_0x9de9c3){return function(_0x352b2f){if(!_0x352b2f){_0x284ab5[_0x1691('0x18')](0x194);}return _0x352b2f;};}function handleError(_0xcc0db2,_0xf645e0){_0xf645e0=_0xf645e0||0x1f4;return function(_0x6df304){logger[_0x1691('0x24')](_0x6df304[_0x1691('0x25')]);if(_0x6df304['name']){delete _0x6df304[_0x1691('0x26')];}_0xcc0db2[_0x1691('0x19')](_0xf645e0)[_0x1691('0x27')](_0x6df304);};}exports[_0x1691('0x23')]=function(_0x2700c3,_0x3b825d){if(_0x2700c3[_0x1691('0x28')]['id']){delete _0x2700c3['body']['id'];}return db[_0x1691('0x29')][_0x1691('0x2a')]({'where':{'id':_0x2700c3[_0x1691('0x2b')]['id']}})[_0x1691('0x2c')](handleEntityNotFound(_0x3b825d,null))[_0x1691('0x2c')](saveUpdates(_0x2700c3[_0x1691('0x28')],null))['then'](respondWithResult(_0x3b825d,null))['catch'](handleError(_0x3b825d,null));};exports[_0x1691('0x2d')]=function(_0x3dd21b,_0x22f9d4){return db[_0x1691('0x29')][_0x1691('0x2a')]({'where':{'id':_0x3dd21b['params']['id']}})[_0x1691('0x2c')](handleEntityNotFound(_0x22f9d4,null))[_0x1691('0x2c')](removeEntity(_0x22f9d4,null))[_0x1691('0x2e')](handleError(_0x22f9d4,null));};
\ No newline at end of file
+var _0xe690=['zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','body','Action','find','params','catch'];(function(_0x2299e8,_0x3e4063){var _0x433c0e=function(_0x43f27e){while(--_0x43f27e){_0x2299e8['push'](_0x2299e8['shift']());}};_0x433c0e(++_0x3e4063);}(_0xe690,0x102));var _0x0e69=function(_0x3ae254,_0x4f4bf9){_0x3ae254=_0x3ae254-0x0;var _0x5811fa=_0xe690[_0x3ae254];return _0x5811fa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0e69('0x0'));var jsonpatch=require(_0x0e69('0x1'));var rp=require(_0x0e69('0x2'));var moment=require('moment');var BPromise=require(_0x0e69('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0e69('0x4'));var sox=require(_0x0e69('0x5'));var csv=require(_0x0e69('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e69('0x7'));var squel=require(_0x0e69('0x8'));var crypto=require(_0x0e69('0x9'));var jsforce=require(_0x0e69('0xa'));var deskjs=require(_0x0e69('0xb'));var toCsv=require(_0x0e69('0x6'));var querystring=require('querystring');var Papa=require(_0x0e69('0xc'));var Redis=require('ioredis');var authService=require(_0x0e69('0xd'));var qs=require(_0x0e69('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e69('0xf'))('api');var utils=require(_0x0e69('0x10'));var config=require(_0x0e69('0x11'));var licenseUtil=require(_0x0e69('0x12'));var db=require(_0x0e69('0x13'))['db'];function respondWithStatusCode(_0x1b179d,_0x382ccf){_0x382ccf=_0x382ccf||0xcc;return function(_0x4664c3){if(_0x4664c3){return _0x1b179d['sendStatus'](_0x382ccf);}return _0x1b179d['status'](_0x382ccf)[_0x0e69('0x14')]();};}function respondWithResult(_0x34b008,_0x150d74){_0x150d74=_0x150d74||0xc8;return function(_0x35d8f0){if(_0x35d8f0){return _0x34b008[_0x0e69('0x15')](_0x150d74)[_0x0e69('0x16')](_0x35d8f0);}};}function respondWithFilteredResult(_0x36f9c0,_0x1c0d06){return function(_0x32a056){if(_0x32a056){var _0x3026e8=typeof _0x1c0d06[_0x0e69('0x17')]===_0x0e69('0x18')&&typeof _0x1c0d06[_0x0e69('0x19')]===_0x0e69('0x18');var _0x324286=_0x32a056['count'];var _0x4dbb8b=_0x3026e8?0x0:_0x1c0d06[_0x0e69('0x17')];var _0x375b79=_0x3026e8?_0x32a056[_0x0e69('0x1a')]:_0x1c0d06['offset']+_0x1c0d06['limit'];var _0x5db52f;if(_0x375b79>=_0x324286){_0x375b79=_0x324286;_0x5db52f=0xc8;}else{_0x5db52f=0xce;}_0x36f9c0['status'](_0x5db52f);return _0x36f9c0[_0x0e69('0x1b')](_0x0e69('0x1c'),_0x4dbb8b+'-'+_0x375b79+'/'+_0x324286)[_0x0e69('0x16')](_0x32a056);}return null;};}function patchUpdates(_0x1618e8){return function(_0xfddb4b){try{jsonpatch['apply'](_0xfddb4b,_0x1618e8,!![]);}catch(_0x11a6ae){return BPromise[_0x0e69('0x1d')](_0x11a6ae);}return _0xfddb4b[_0x0e69('0x1e')]();};}function saveUpdates(_0x516099,_0xa750c1){return function(_0x33ff17){if(_0x33ff17){return _0x33ff17[_0x0e69('0x1f')](_0x516099)['then'](function(_0x5b4fba){return _0x5b4fba;});}return null;};}function removeEntity(_0x50a4f0,_0x4f38e2){return function(_0x385f01){if(_0x385f01){return _0x385f01['destroy']()[_0x0e69('0x20')](function(){_0x50a4f0['status'](0xcc)[_0x0e69('0x14')]();});}};}function handleEntityNotFound(_0x11aa38,_0x15e94f){return function(_0x221745){if(!_0x221745){_0x11aa38[_0x0e69('0x21')](0x194);}return _0x221745;};}function handleError(_0xace722,_0x3569a9){_0x3569a9=_0x3569a9||0x1f4;return function(_0x2934a8){logger[_0x0e69('0x22')](_0x2934a8[_0x0e69('0x23')]);if(_0x2934a8['name']){delete _0x2934a8[_0x0e69('0x24')];}_0xace722[_0x0e69('0x15')](_0x3569a9)[_0x0e69('0x25')](_0x2934a8);};}exports[_0x0e69('0x1f')]=function(_0x4df5c9,_0x20f2d3){if(_0x4df5c9['body']['id']){delete _0x4df5c9[_0x0e69('0x26')]['id'];}return db[_0x0e69('0x27')][_0x0e69('0x28')]({'where':{'id':_0x4df5c9[_0x0e69('0x29')]['id']}})[_0x0e69('0x20')](handleEntityNotFound(_0x20f2d3,null))[_0x0e69('0x20')](saveUpdates(_0x4df5c9[_0x0e69('0x26')],null))[_0x0e69('0x20')](respondWithResult(_0x20f2d3,null))[_0x0e69('0x2a')](handleError(_0x20f2d3,null));};exports['destroy']=function(_0x307202,_0x51f5ed){return db[_0x0e69('0x27')][_0x0e69('0x28')]({'where':{'id':_0x307202[_0x0e69('0x29')]['id']}})['then'](handleEntityNotFound(_0x51f5ed,null))[_0x0e69('0x20')](removeEntity(_0x51f5ed,null))[_0x0e69('0x2a')](handleError(_0x51f5ed,null));};
\ No newline at end of file
index 0894e1d..233dd89 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa164=['bluebird','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','util','../../config/logger','api','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa164,0x19e));var _0x4a16=function(_0x2386af,_0xdc8bbe){_0x2386af=_0x2386af-0x0;var _0x5431d0=_0xa164[_0x2386af];return _0x5431d0;};'use strict';var _=require('lodash');var util=require(_0x4a16('0x0'));var logger=require(_0x4a16('0x1'))(_0x4a16('0x2'));var moment=require(_0x4a16('0x3'));var BPromise=require(_0x4a16('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4a16('0x5'));var config=require(_0x4a16('0x6'));var attributes=require(_0x4a16('0x7'));module[_0x4a16('0x8')]=function(_0x207d5b,_0x1cc4f1){return _0x207d5b['define'](_0x4a16('0x9'),attributes,{'tableName':_0x4a16('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa3f2=['path','rimraf','../../config/environment','./action.attributes','exports','define','tools_actions','lodash','../../config/logger','api','moment','bluebird'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0xa3f2,0x73));var _0x2a3f=function(_0x2b204b,_0x597e0b){_0x2b204b=_0x2b204b-0x0;var _0xcb7375=_0xa3f2[_0x2b204b];return _0xcb7375;};'use strict';var _=require(_0x2a3f('0x0'));var util=require('util');var logger=require(_0x2a3f('0x1'))(_0x2a3f('0x2'));var moment=require(_0x2a3f('0x3'));var BPromise=require(_0x2a3f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a3f('0x5'));var rimraf=require(_0x2a3f('0x6'));var config=require(_0x2a3f('0x7'));var attributes=require(_0x2a3f('0x8'));module[_0x2a3f('0x9')]=function(_0x59a19e,_0x2cbaac){return _0x59a19e[_0x2a3f('0xa')]('Action',attributes,{'tableName':_0x2a3f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 0b74637..a7ebf1d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x31191e,_0x2036b8){var _0x124c05=function(_0x5f0f2c){while(--_0x5f0f2c){_0x31191e['push'](_0x31191e['shift']());}};_0x124c05(++_0x2036b8);}(_0xabce,0x103));var _0xeabc=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xabce[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}
\ No newline at end of file
+var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5f0501,_0x19196e){var _0x3c2c45=function(_0x107fe6){while(--_0x107fe6){_0x5f0501['push'](_0x5f0501['shift']());}};_0x3c2c45(++_0x19196e);}(_0xf494,0x1c6));var _0x4f49=function(_0x334a99,_0x1cb0f9){_0x334a99=_0x334a99-0x0;var _0x284636=_0xf494[_0x334a99];return _0x284636;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}
\ No newline at end of file
index c5470b1..c3aee40 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0580=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','destroy','exports','multer'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x0580,0xe0));var _0x0058=function(_0x2ef92b,_0x2cdbd8){_0x2ef92b=_0x2ef92b-0x0;var _0x2526f7=_0x0580[_0x2ef92b];return _0x2526f7;};'use strict';var multer=require(_0x0058('0x0'));var util=require(_0x0058('0x1'));var path=require(_0x0058('0x2'));var timeout=require('connect-timeout');var express=require(_0x0058('0x3'));var router=express[_0x0058('0x4')]();var fs_extra=require(_0x0058('0x5'));var auth=require(_0x0058('0x6'));var interaction=require(_0x0058('0x7'));var config=require(_0x0058('0x8'));var controller=require('./action.controller');router[_0x0058('0x9')](_0x0058('0xa'),auth[_0x0058('0xb')](),controller[_0x0058('0xc')]);router['delete'](_0x0058('0xa'),auth[_0x0058('0xb')](),controller[_0x0058('0xd')]);module[_0x0058('0xe')]=router;
\ No newline at end of file
+var _0xc89c=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','destroy','exports','multer'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0xc89c,0x195));var _0xcc89=function(_0x3a7981,_0x1b69e9){_0x3a7981=_0x3a7981-0x0;var _0x4b57e0=_0xc89c[_0x3a7981];return _0x4b57e0;};'use strict';var multer=require(_0xcc89('0x0'));var util=require(_0xcc89('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc89('0x2'));var router=express[_0xcc89('0x3')]();var fs_extra=require(_0xcc89('0x4'));var auth=require(_0xcc89('0x5'));var interaction=require(_0xcc89('0x6'));var config=require('../../config/environment');var controller=require(_0xcc89('0x7'));router[_0xcc89('0x8')](_0xcc89('0x9'),auth[_0xcc89('0xa')](),controller[_0xcc89('0xb')]);router['delete']('/:id',auth[_0xcc89('0xa')](),controller[_0xcc89('0xc')]);module[_0xcc89('0xd')]=router;
\ No newline at end of file
index 98f7d98..047f7b4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x425d=['sequelize','STRING','TEXT'];(function(_0x222c49,_0x1e8a56){var _0x540de7=function(_0x5c9ec9){while(--_0x5c9ec9){_0x222c49['push'](_0x222c49['shift']());}};_0x540de7(++_0x1e8a56);}(_0x425d,0x1e0));var _0xd425=function(_0x44dbc3,_0x145c5b){_0x44dbc3=_0x44dbc3-0x0;var _0x33ec1f=_0x425d[_0x44dbc3];return _0x33ec1f;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'name':{'type':Sequelize[_0xd425('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd425('0x1')]},'parent':{'type':Sequelize[_0xd425('0x1')]},'table':{'type':Sequelize[_0xd425('0x1')]},'conditions':{'type':Sequelize[_0xd425('0x2')]},'joins':{'type':Sequelize[_0xd425('0x2')]}};
\ No newline at end of file
+var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x46ed,0x168));var _0xd46e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x46ed[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}};
\ No newline at end of file
index e1c2f36..a4b4639 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x904e=['custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','savename','COUNT(*)','run','runReport','DESC','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','get','CustomReports','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','role','Reports','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','group','orderBy','order','alias','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','getFields','ValidationErrorItem','clone','output','web','fullPath','%s-%s.%s','randomstring','generate'];(function(_0x9ac4dd,_0x15bbd2){var _0x507835=function(_0x8425eb){while(--_0x8425eb){_0x9ac4dd['push'](_0x9ac4dd['shift']());}};_0x507835(++_0x15bbd2);}(_0x904e,0xb5));var _0xe904=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x904e[_0x4fde08];return _0x12e725;};'use strict';var emlformat=require(_0xe904('0x0'));var rimraf=require(_0xe904('0x1'));var zipdir=require(_0xe904('0x2'));var jsonpatch=require(_0xe904('0x3'));var rp=require(_0xe904('0x4'));var moment=require(_0xe904('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe904('0x6'));var path=require('path');var sox=require(_0xe904('0x7'));var csv=require(_0xe904('0x8'));var ejs=require(_0xe904('0x9'));var fs=require('fs');var fs_extra=require(_0xe904('0xa'));var _=require(_0xe904('0xb'));var squel=require(_0xe904('0xc'));var crypto=require('crypto');var jsforce=require(_0xe904('0xd'));var deskjs=require(_0xe904('0xe'));var toCsv=require(_0xe904('0x8'));var querystring=require(_0xe904('0xf'));var Papa=require('papaparse');var Redis=require(_0xe904('0x10'));var authService=require(_0xe904('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe904('0x12'));var logger=require(_0xe904('0x13'))(_0xe904('0x14'));var utils=require(_0xe904('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe904('0x16'));var db=require(_0xe904('0x17'))['db'];var dbH=require(_0xe904('0x17'))['dbH'];function respondWithStatusCode(_0x463d7f,_0x2bbc17){_0x2bbc17=_0x2bbc17||0xcc;return function(_0x1c789a){if(_0x1c789a){return _0x463d7f[_0xe904('0x18')](_0x2bbc17);}return _0x463d7f[_0xe904('0x19')](_0x2bbc17)[_0xe904('0x1a')]();};}function respondWithResult(_0x3b2bf9,_0x22a4d4){_0x22a4d4=_0x22a4d4||0xc8;return function(_0x299a66){if(_0x299a66){return _0x3b2bf9[_0xe904('0x19')](_0x22a4d4)[_0xe904('0x1b')](_0x299a66);}};}function respondWithFilteredResult(_0x5379fa,_0x1eccb0){return function(_0x38ee31){if(_0x38ee31){var _0x55e39d=typeof _0x1eccb0[_0xe904('0x1c')]===_0xe904('0x1d')&&typeof _0x1eccb0['limit']==='undefined';var _0x2b7fd9=_0x38ee31[_0xe904('0x1e')];var _0x31f2c2=_0x55e39d?0x0:_0x1eccb0['offset'];var _0x2385ea=_0x55e39d?_0x38ee31[_0xe904('0x1e')]:_0x1eccb0[_0xe904('0x1c')]+_0x1eccb0[_0xe904('0x1f')];var _0x280992;if(_0x2385ea>=_0x2b7fd9){_0x2385ea=_0x2b7fd9;_0x280992=0xc8;}else{_0x280992=0xce;}_0x5379fa['status'](_0x280992);return _0x5379fa['set'](_0xe904('0x20'),_0x31f2c2+'-'+_0x2385ea+'/'+_0x2b7fd9)[_0xe904('0x1b')](_0x38ee31);}return null;};}function patchUpdates(_0x1ca531){return function(_0x2f7acf){try{jsonpatch[_0xe904('0x21')](_0x2f7acf,_0x1ca531,!![]);}catch(_0x39df8a){return BPromise[_0xe904('0x22')](_0x39df8a);}return _0x2f7acf[_0xe904('0x23')]();};}function saveUpdates(_0x4d0116,_0x492857){return function(_0x286c0d){if(_0x286c0d){return _0x286c0d[_0xe904('0x24')](_0x4d0116)['then'](function(_0x3139bc){return _0x3139bc;});}return null;};}function removeEntity(_0x4abb73,_0x280746){return function(_0x284e4b){if(_0x284e4b){return _0x284e4b[_0xe904('0x25')]()[_0xe904('0x26')](function(){var _0x1488b6=_0x284e4b[_0xe904('0x27')]({'plain':!![]});var _0xfb117c=_0xe904('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0xfb117c,'resourceId':_0x1488b6['id']}})['then'](function(){return _0x284e4b;});})[_0xe904('0x26')](function(){_0x4abb73[_0xe904('0x19')](0xcc)[_0xe904('0x1a')]();});}};}function handleEntityNotFound(_0x4fb168,_0x8029a8){return function(_0x294318){if(!_0x294318){_0x4fb168[_0xe904('0x18')](0x194);}return _0x294318;};}function handleError(_0x2f3394,_0xa18476){_0xa18476=_0xa18476||0x1f4;return function(_0x1b7177){logger['error'](_0x1b7177[_0xe904('0x29')]);if(_0x1b7177[_0xe904('0x2a')]){delete _0x1b7177[_0xe904('0x2a')];}_0x2f3394[_0xe904('0x19')](_0xa18476)[_0xe904('0x2b')](_0x1b7177);};}exports[_0xe904('0x2c')]=function(_0x2918b1,_0xbefc48){var _0x21f321={},_0xa662c4={},_0x308d33={'count':0x0,'rows':[]};var _0x5ece79=_['map'](db[_0xe904('0x2d')][_0xe904('0x2e')],function(_0x25c693){return{'name':_0x25c693[_0xe904('0x2f')],'type':_0x25c693['type'][_0xe904('0x30')]};});_0xa662c4[_0xe904('0x31')]=_[_0xe904('0x32')](_0x5ece79,_0xe904('0x2a'));_0xa662c4[_0xe904('0x33')]=_['keys'](_0x2918b1[_0xe904('0x33')]);_0xa662c4['filters']=_[_0xe904('0x34')](_0xa662c4[_0xe904('0x31')],_0xa662c4[_0xe904('0x33')]);_0x21f321[_0xe904('0x35')]=_['intersection'](_0xa662c4[_0xe904('0x31')],qs[_0xe904('0x36')](_0x2918b1[_0xe904('0x33')][_0xe904('0x36')]));_0x21f321[_0xe904('0x35')]=_0x21f321[_0xe904('0x35')]['length']?_0x21f321[_0xe904('0x35')]:_0xa662c4['model'];if(!_0x2918b1[_0xe904('0x33')][_0xe904('0x37')](_0xe904('0x38'))){_0x21f321[_0xe904('0x1f')]=qs[_0xe904('0x1f')](_0x2918b1['query'][_0xe904('0x1f')]);_0x21f321['offset']=qs[_0xe904('0x1c')](_0x2918b1[_0xe904('0x33')][_0xe904('0x1c')]);}_0x21f321['order']=qs['sort'](_0x2918b1[_0xe904('0x33')][_0xe904('0x39')]);_0x21f321[_0xe904('0x3a')]=qs['filters'](_['pick'](_0x2918b1[_0xe904('0x33')],_0xa662c4[_0xe904('0x3b')]),_0x5ece79);if(_0x2918b1[_0xe904('0x33')][_0xe904('0x3c')]){_0x21f321[_0xe904('0x3a')]=_[_0xe904('0x3d')](_0x21f321[_0xe904('0x3a')],{'$or':_[_0xe904('0x32')](_0x5ece79,function(_0x44411a){if(_0x44411a['type']!==_0xe904('0x3e')){var _0x5d1840={};_0x5d1840[_0x44411a['name']]={'$like':'%'+_0x2918b1[_0xe904('0x33')][_0xe904('0x3c')]+'%'};return _0x5d1840;}})});}_0x21f321=_[_0xe904('0x3d')]({},_0x21f321,_0x2918b1[_0xe904('0x3f')]);var _0xf08ef6={'where':_0x21f321['where']};return db[_0xe904('0x2d')][_0xe904('0x1e')](_0xf08ef6)[_0xe904('0x26')](function(_0x2f0818){_0x308d33[_0xe904('0x1e')]=_0x2f0818;if(_0x2918b1[_0xe904('0x33')][_0xe904('0x40')]){_0x21f321[_0xe904('0x41')]=[{'all':!![]}];}return db[_0xe904('0x2d')]['findAll'](_0x21f321);})[_0xe904('0x26')](function(_0x575bbb){_0x308d33[_0xe904('0x42')]=_0x575bbb;return _0x308d33;})['then'](respondWithFilteredResult(_0xbefc48,_0x21f321))[_0xe904('0x43')](handleError(_0xbefc48,null));};exports[_0xe904('0x44')]=function(_0x18295e,_0x4c4815){var _0x442410={'raw':![],'where':{'id':_0x18295e[_0xe904('0x45')]['id']}},_0x8e4feb={};_0x8e4feb[_0xe904('0x31')]=_['keys'](db[_0xe904('0x2d')]['rawAttributes']);_0x8e4feb[_0xe904('0x33')]=_[_0xe904('0x46')](_0x18295e[_0xe904('0x33')]);_0x8e4feb[_0xe904('0x3b')]=_['intersection'](_0x8e4feb[_0xe904('0x31')],_0x8e4feb[_0xe904('0x33')]);_0x442410[_0xe904('0x35')]=_[_0xe904('0x34')](_0x8e4feb[_0xe904('0x31')],qs[_0xe904('0x36')](_0x18295e['query']['fields']));_0x442410[_0xe904('0x35')]=_0x442410[_0xe904('0x35')]['length']?_0x442410[_0xe904('0x35')]:_0x8e4feb[_0xe904('0x31')];if(_0x18295e['query'][_0xe904('0x40')]){_0x442410[_0xe904('0x41')]=[{'all':!![]}];}_0x442410=_[_0xe904('0x3d')]({},_0x442410,_0x18295e[_0xe904('0x3f')]);return db[_0xe904('0x2d')][_0xe904('0x47')](_0x442410)[_0xe904('0x26')](handleEntityNotFound(_0x4c4815,null))['then'](respondWithResult(_0x4c4815,null))[_0xe904('0x43')](handleError(_0x4c4815,null));};exports[_0xe904('0x48')]=function(_0x1e2808,_0x472488){return db[_0xe904('0x2d')]['create'](_0x1e2808[_0xe904('0x49')],{})['then'](function(_0x5d0826){var _0x587ae6=_0x1e2808[_0xe904('0x4a')][_0xe904('0x27')]({'plain':!![]});if(!_0x587ae6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x587ae6[_0xe904('0x4b')]===_0xe904('0x4a')){var _0xacd05f=_0x5d0826[_0xe904('0x27')]({'plain':!![]});var _0x3369c1=_0xe904('0x4c');return db['UserProfileSection'][_0xe904('0x47')]({'where':{'name':_0x3369c1,'userProfileId':_0x587ae6[_0xe904('0x4d')]},'raw':!![]})[_0xe904('0x26')](function(_0x16ad39){if(_0x16ad39&&_0x16ad39['autoAssociation']===0x0){return db[_0xe904('0x4e')][_0xe904('0x48')]({'name':_0xacd05f['name'],'resourceId':_0xacd05f['id'],'type':_0xe904('0x28'),'sectionId':_0x16ad39['id']},{})[_0xe904('0x26')](function(){return _0x5d0826;});}else{return _0x5d0826;}})[_0xe904('0x43')](function(_0x400f63){logger['error'](_0xe904('0x4f'),_0x400f63);throw _0x400f63;});}return _0x5d0826;})[_0xe904('0x26')](respondWithResult(_0x472488,0xc9))[_0xe904('0x43')](handleError(_0x472488,null));};exports[_0xe904('0x24')]=function(_0x327d83,_0x50d215){if(_0x327d83[_0xe904('0x49')]['id']){delete _0x327d83[_0xe904('0x49')]['id'];}return db[_0xe904('0x2d')][_0xe904('0x47')]({'where':{'id':_0x327d83[_0xe904('0x45')]['id']}})['then'](handleEntityNotFound(_0x50d215,null))[_0xe904('0x26')](saveUpdates(_0x327d83[_0xe904('0x49')],null))[_0xe904('0x26')](respondWithResult(_0x50d215,null))[_0xe904('0x43')](handleError(_0x50d215,null));};exports[_0xe904('0x25')]=function(_0x44ec5a,_0x297cf5){return db[_0xe904('0x2d')]['find']({'where':{'id':_0x44ec5a[_0xe904('0x45')]['id']}})[_0xe904('0x26')](handleEntityNotFound(_0x297cf5,null))[_0xe904('0x26')](removeEntity(_0x297cf5,null))[_0xe904('0x43')](handleError(_0x297cf5,null));};exports[_0xe904('0x50')]=function(_0x4ce40e,_0x26c344){var _0x5687d9=0xa;var _0x4737f1=[_0xe904('0x51'),_0xe904('0x52'),_0xe904('0x53'),_0xe904('0x54')];var _0x4ebd66={'SUM':_0xe904('0x55'),'COUNT':_0xe904('0x56'),'COUNT DISTINCT':_0xe904('0x57'),'MAX':_0xe904('0x58'),'MIN':_0xe904('0x59'),'AVG':_0xe904('0x5a'),'GROUP_CONCAT':_0xe904('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xe904('0x5c')};var _0x1c160e={'SEC_TO_TIME':_0xe904('0x5d'),'DATE':_0xe904('0x5e'),'HOUR':_0xe904('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3ab42b=function(_0x389320){return!_[_0xe904('0x60')]([_0xe904('0x61'),_0xe904('0x62'),_0xe904('0x63'),_0xe904('0x64')],_0x389320);};var _0x8fc4ee=function(_0x58d85f){if(!_0x58d85f||!_0x58d85f[_0xe904('0x65')]['length']){return'';}for(var _0x29f0d4='(',_0x37682f=0x0;_0x37682f<_0x58d85f[_0xe904('0x65')][_0xe904('0x66')];_0x37682f+=0x1){_0x37682f>0x0&&(_0x29f0d4+='\x20'+_0x58d85f[_0xe904('0x67')]+'\x20');_0x29f0d4+=_0x58d85f[_0xe904('0x65')][_0x37682f]['group']?_0x8fc4ee(_0x58d85f[_0xe904('0x65')][_0x37682f]['group']):_0x58d85f['rules'][_0x37682f][_0xe904('0x68')]+'\x20'+_0x58d85f['rules'][_0x37682f][_0xe904('0x69')]+(_0x3ab42b(_0x58d85f['rules'][_0x37682f]['condition'])?'\x20'+_0x58d85f[_0xe904('0x65')][_0x37682f][_0xe904('0x6a')]:'');}return _0x29f0d4+')';};var _0x4f0a9e={'where':{'id':_0x4ce40e['params']['id']}},_0x149a6a,_0x319290,_0x3956f5,_0x59f9f7,_0xb7b45d;_0x4f0a9e=_['merge']({},_0x4f0a9e,_0x4ce40e[_0xe904('0x3f')]);return db['AnalyticCustomReport'][_0xe904('0x47')](_0x4f0a9e)['then'](function(_0x99bcf1){if(_0x99bcf1){_0x149a6a=_0x99bcf1;return _0x99bcf1['getFields']();}return null;})[_0xe904('0x26')](function(_0x1d1d64){if(_0x1d1d64){if(!_0x1d1d64[_0xe904('0x66')]){throw new db[(_0xe904('0x6b'))]['ValidationErrorItem'](_0xe904('0x6c'),0x193);}_0x319290=_0x1d1d64;return db[_0xe904('0x6d')][_0xe904('0x6e')]({'raw':!![]});}return null;})['then'](function(_0x362245){if(_0x362245){_0x3956f5=_[_0xe904('0x6f')](_0x362245,'id');var _0x49fdab;var _0x1b0acd=squel[_0xe904('0x70')]();_0x1b0acd[_0xe904('0x71')](_0x149a6a[_0xe904('0x72')]);for(var _0x4a28fc=0x0;_0x4a28fc<_0x319290[_0xe904('0x66')];_0x4a28fc+=0x1){_0x49fdab=_0x319290[_0x4a28fc][_0xe904('0x73')]?_0x3956f5[_0x319290[_0x4a28fc][_0xe904('0x73')]][_0xe904('0x74')]:_0x319290[_0x4a28fc][_0xe904('0x68')];_0x49fdab=_0x319290[_0x4a28fc][_0xe904('0x75')]?_[_0xe904('0x76')](_0x4ebd66[_0x319290[_0x4a28fc][_0xe904('0x75')]],'%s',_0x49fdab):_0x49fdab;_0x49fdab=_0x319290[_0x4a28fc][_0xe904('0x77')]?_[_0xe904('0x76')](_0x1c160e[_0x319290[_0x4a28fc]['format']],'%s',_0x49fdab):_0x49fdab;if(_0x319290[_0x4a28fc][_0xe904('0x78')]){_0x1b0acd[_0xe904('0x79')](_0x49fdab);}_0x319290[_0x4a28fc][_0xe904('0x7a')]&&_0x1b0acd[_0xe904('0x7b')](_0x49fdab,_0x319290[_0x4a28fc][_0xe904('0x7a')]==='DESC'?![]:!![]);_0x1b0acd['field'](_0x49fdab,_0x319290[_0x4a28fc][_0xe904('0x7c')]||_0x49fdab);}if(_0x149a6a[_0xe904('0x7d')]){_0x149a6a['joins']=JSON[_0xe904('0x7e')](_0x149a6a[_0xe904('0x7d')]);for(var _0x5d3884=0x0;_0x5d3884<_0x149a6a[_0xe904('0x7d')][_0xe904('0x66')];_0x5d3884+=0x1){if(_0x149a6a['joins'][_0x5d3884][_0xe904('0x7f')]&&_[_0xe904('0x60')](_0x4737f1,_0x149a6a[_0xe904('0x7d')][_0x5d3884][_0xe904('0x7f')])&&_0x149a6a[_0xe904('0x7d')][_0x5d3884][_0xe904('0x80')]&&_0x149a6a['joins'][_0x5d3884][_0xe904('0x81')]&&_0x149a6a[_0xe904('0x7d')][_0x5d3884][_0xe904('0x82')]){_0x1b0acd[_0x149a6a[_0xe904('0x7d')][_0x5d3884]['type']](_0x149a6a[_0xe904('0x7d')][_0x5d3884][_0xe904('0x81')],null,util[_0xe904('0x77')](_0xe904('0x83'),_0x149a6a[_0xe904('0x72')],_0x149a6a[_0xe904('0x7d')][_0x5d3884][_0xe904('0x80')],_0x149a6a[_0xe904('0x7d')][_0x5d3884][_0xe904('0x81')],_0x149a6a[_0xe904('0x7d')][_0x5d3884][_0xe904('0x82')]));}}}if(_0x149a6a[_0xe904('0x84')]){_0x149a6a['conditions']=JSON['parse'](_0x149a6a[_0xe904('0x84')]);_0x1b0acd[_0xe904('0x3a')](_0x8fc4ee(_0x149a6a[_0xe904('0x84')][_0xe904('0x79')]));}_0xb7b45d=_0x1b0acd['clone']();_0x1b0acd[_0xe904('0x1f')](_0x5687d9);_0x1b0acd['offset'](0x0);logger[_0xe904('0x85')](_0xe904('0x86'),_0x1b0acd[_0xe904('0x87')]());return dbH[_0xe904('0x88')]['query'](_0x1b0acd['toString'](),{'type':dbH['sequelize'][_0xe904('0x89')][_0xe904('0x8a')]});}})['then'](respondWithResult(_0x26c344,null))[_0xe904('0x43')](handleError(_0x26c344,null));};function runReport(_0x4f6dd1,_0x30d1e5,_0x578654){var _0x1d0fbe=_0x30d1e5[_0xe904('0x2a')];var _0x1a5c53=0xa;var _0x33fe82=['join','left_join',_0xe904('0x53'),_0xe904('0x54')];var _0x3009eb={'SUM':_0xe904('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xe904('0x57'),'MAX':_0xe904('0x58'),'MIN':_0xe904('0x59'),'AVG':_0xe904('0x5a'),'GROUP_CONCAT':_0xe904('0x5b'),'GROUP_CONCAT ASC':_0xe904('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3fcfea={'SEC_TO_TIME':_0xe904('0x5d'),'DATE':_0xe904('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0xe904('0x8c'),'UNIX_TIMESTAMP':_0xe904('0x8d')};var _0x194cae=function(_0x371878){return!_[_0xe904('0x60')](['IS\x20NULL',_0xe904('0x62'),_0xe904('0x63'),'IS\x20NOT\x20EMPTY'],_0x371878);};var _0x47b04d=function(_0x1ea791){if(!_0x1ea791||!_0x1ea791[_0xe904('0x65')][_0xe904('0x66')]){return'';}for(var _0x3d642d='(',_0x4a33ef=0x0;_0x4a33ef<_0x1ea791['rules'][_0xe904('0x66')];_0x4a33ef+=0x1){_0x4a33ef>0x0&&(_0x3d642d+='\x20'+_0x1ea791['operator']+'\x20');_0x3d642d+=_0x1ea791[_0xe904('0x65')][_0x4a33ef][_0xe904('0x79')]?_0x47b04d(_0x1ea791[_0xe904('0x65')][_0x4a33ef][_0xe904('0x79')]):_0x1ea791['rules'][_0x4a33ef][_0xe904('0x68')]+'\x20'+_0x1ea791[_0xe904('0x65')][_0x4a33ef]['condition']+(_0x194cae(_0x1ea791[_0xe904('0x65')][_0x4a33ef][_0xe904('0x69')])?'\x20'+_0x1ea791['rules'][_0x4a33ef][_0xe904('0x6a')]:'');}return _0x3d642d+')';};var _0xac9f5c={'where':{'id':_0x4f6dd1['id']}},_0x3c3684,_0x4208e0,_0x5e80e6,_0x4a3cd7,_0xe3c09c;_0xac9f5c=_['merge']({},_0xac9f5c,_0x578654);return db['AnalyticCustomReport'][_0xe904('0x47')](_0xac9f5c)[_0xe904('0x26')](function(_0x267043){if(_0x267043){_0x3c3684=_0x267043;return _0x267043[_0xe904('0x8e')]();}return null;})[_0xe904('0x26')](function(_0x17f9b0){if(_0x17f9b0){if(!_0x17f9b0[_0xe904('0x66')]){throw new db[(_0xe904('0x6b'))][(_0xe904('0x8f'))](_0xe904('0x6c'),0x193);}_0x4208e0=_0x17f9b0;return db['AnalyticMetric'][_0xe904('0x6e')]({'raw':!![]});}return null;})[_0xe904('0x26')](function(_0x27c3b0){if(_0x27c3b0){_0x5e80e6=_['keyBy'](_0x27c3b0,'id');var _0x37d43d;var _0xf89ab6=squel['select']();_0xf89ab6[_0xe904('0x71')](_0x3c3684[_0xe904('0x72')]);for(var _0x5ea1dd=0x0;_0x5ea1dd<_0x4208e0[_0xe904('0x66')];_0x5ea1dd+=0x1){_0x37d43d=_0x4208e0[_0x5ea1dd][_0xe904('0x73')]?_0x5e80e6[_0x4208e0[_0x5ea1dd]['MetricId']][_0xe904('0x74')]:_0x4208e0[_0x5ea1dd][_0xe904('0x68')];_0x37d43d=_0x4208e0[_0x5ea1dd][_0xe904('0x75')]?_[_0xe904('0x76')](_0x3009eb[_0x4208e0[_0x5ea1dd][_0xe904('0x75')]],'%s',_0x37d43d):_0x37d43d;_0x37d43d=_0x4208e0[_0x5ea1dd]['format']?_['replace'](_0x3fcfea[_0x4208e0[_0x5ea1dd][_0xe904('0x77')]],'%s',_0x37d43d):_0x37d43d;if(_0x4208e0[_0x5ea1dd][_0xe904('0x78')]){_0xf89ab6['group'](_0x37d43d);}_0x4208e0[_0x5ea1dd][_0xe904('0x7a')]&&_0xf89ab6[_0xe904('0x7b')](_0x37d43d,_0x4208e0[_0x5ea1dd]['orderBy']==='DESC'?![]:!![]);_0xf89ab6[_0xe904('0x68')](_0x37d43d,_0x4208e0[_0x5ea1dd][_0xe904('0x7c')]||_0x37d43d);}if(_0x3c3684['joins']){_0x3c3684[_0xe904('0x7d')]=JSON[_0xe904('0x7e')](_0x3c3684['joins']);for(var _0x5f2ec8=0x0;_0x5f2ec8<_0x3c3684[_0xe904('0x7d')]['length'];_0x5f2ec8+=0x1){if(_0x3c3684[_0xe904('0x7d')][_0x5f2ec8][_0xe904('0x7f')]&&_[_0xe904('0x60')](_0x33fe82,_0x3c3684[_0xe904('0x7d')][_0x5f2ec8]['type'])&&_0x3c3684[_0xe904('0x7d')][_0x5f2ec8][_0xe904('0x80')]&&_0x3c3684[_0xe904('0x7d')][_0x5f2ec8][_0xe904('0x81')]&&_0x3c3684['joins'][_0x5f2ec8][_0xe904('0x82')]){_0xf89ab6[_0x3c3684[_0xe904('0x7d')][_0x5f2ec8][_0xe904('0x7f')]](_0x3c3684[_0xe904('0x7d')][_0x5f2ec8][_0xe904('0x81')],null,util[_0xe904('0x77')]('%s.%s\x20=\x20%s.%s',_0x3c3684['table'],_0x3c3684['joins'][_0x5f2ec8][_0xe904('0x80')],_0x3c3684[_0xe904('0x7d')][_0x5f2ec8]['foreignTable'],_0x3c3684[_0xe904('0x7d')][_0x5f2ec8][_0xe904('0x82')]));}}}if(_0x3c3684[_0xe904('0x84')]){_0x3c3684[_0xe904('0x84')]=JSON[_0xe904('0x7e')](_0x3c3684['conditions']);_0xf89ab6[_0xe904('0x3a')](_0x47b04d(_0x3c3684[_0xe904('0x84')][_0xe904('0x79')]));}_0xe3c09c=_0xf89ab6[_0xe904('0x90')]();_0xf89ab6[_0xe904('0x1f')](_0x1a5c53);_0xf89ab6['offset'](0x0);return;}})[_0xe904('0x26')](function(){if(_0x30d1e5[_0xe904('0x91')]===_0xe904('0x92')){return null;}var _0x3f5a07=_[_0xe904('0x3d')](_0x30d1e5,{'name':_0x30d1e5[_0xe904('0x93')]||_0x30d1e5[_0xe904('0x2a')]||_0x3c3684[_0xe904('0x2a')],'basename':_0x1d0fbe,'savename':util[_0xe904('0x77')](_0xe904('0x94'),_0x30d1e5[_0xe904('0x2a')]||_0x3c3684['name'],require(_0xe904('0x95'))[_0xe904('0x96')](0x4),_0x30d1e5['output']||'csv'),'reportId':_0x3c3684['id'],'reportType':_0xe904('0x97')});return db[_0xe904('0x98')]['create'](_0x3f5a07,{'raw':!![]});})['then'](function(_0x476a89){if(_0x3c3684[_0xe904('0x72')]==='cdr'){_0xe3c09c[_0xe904('0x3a')](_0x3c3684[_0xe904('0x72')]+_0xe904('0x99'),_0x30d1e5[_0xe904('0x9a')],_0x30d1e5[_0xe904('0x9b')]);}else{_0xe3c09c[_0xe904('0x3a')](_0x3c3684[_0xe904('0x72')]+_0xe904('0x9c'),_0x30d1e5[_0xe904('0x9a')],_0x30d1e5[_0xe904('0x9b')]);}if(_0x476a89){logger['info'](_0xe904('0x9d'),_0xe3c09c[_0xe904('0x87')]());require(_0xe904('0x9e'))[_0xe904('0x9f')](path['join'](__dirname,_0xe904('0xa0'),_0x476a89[_0xe904('0x91')]),[_0x476a89['id'],_0xe3c09c[_0xe904('0x87')](),path['join'](__dirname,'../../files/reports',_0x476a89[_0xe904('0xa1')]),_0x1d0fbe]);return _0x476a89;}else{var _0x1ba1ec=squel[_0xe904('0x70')]();_0x1ba1ec[_0xe904('0x71')]('('+_0xe3c09c[_0xe904('0x87')]()+')','countTable');_0x1ba1ec[_0xe904('0x68')](_0xe904('0xa2'),_0xe904('0x1e'));_0xe3c09c['limit'](_0x30d1e5[_0xe904('0x1f')]||_0x1a5c53);_0xe3c09c[_0xe904('0x1c')](_0x30d1e5[_0xe904('0x1c')]||0x0);return dbH[_0xe904('0x88')][_0xe904('0x33')](_0x1ba1ec[_0xe904('0x87')](),{'type':dbH[_0xe904('0x88')][_0xe904('0x89')]['SELECT']})[_0xe904('0x26')](function(_0x2e2fb6){if(!_0x2e2fb6[_0xe904('0x66')]){_0x4a3cd7=0x0;}else{_0x4a3cd7=_0x2e2fb6[0x0][_0xe904('0x1e')]||0x0;}return dbH['sequelize'][_0xe904('0x33')](_0xe3c09c[_0xe904('0x87')](),{'type':dbH[_0xe904('0x88')][_0xe904('0x89')][_0xe904('0x8a')]});})['then'](function(_0x582600){return{'rows':_0x582600||[],'count':_0x4a3cd7};});}});}exports[_0xe904('0xa3')]=function(_0x2a2339,_0x196c63){return runReport(_0x2a2339['params'],_0x2a2339[_0xe904('0x33')],_0x2a2339['options'])[_0xe904('0x26')](respondWithResult(_0x196c63,null))[_0xe904('0x43')](handleError(_0x196c63,null));};exports[_0xe904('0xa4')]=runReport;exports[_0xe904('0x33')]=function(_0x33ec1b,_0x310fdc){var _0x1842b1=0xa;var _0x53adc5=[_0xe904('0x51'),_0xe904('0x52'),_0xe904('0x53'),_0xe904('0x54')];var _0x38d8e5={'SUM':_0xe904('0x55'),'COUNT':_0xe904('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe904('0x58'),'MIN':_0xe904('0x59'),'AVG':_0xe904('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e7973={'SEC_TO_TIME':_0xe904('0x5d'),'DATE':_0xe904('0x5e'),'HOUR':_0xe904('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe904('0x8d')};var _0x596933=function(_0x1254cf){return!_[_0xe904('0x60')](['IS\x20NULL',_0xe904('0x62'),_0xe904('0x63'),'IS\x20NOT\x20EMPTY'],_0x1254cf);};var _0x2730ce=function(_0x3eebaa){if(!_0x3eebaa||!_0x3eebaa[_0xe904('0x65')][_0xe904('0x66')]){return'';}for(var _0x1c2603='(',_0x3df42f=0x0;_0x3df42f<_0x3eebaa['rules'][_0xe904('0x66')];_0x3df42f+=0x1){_0x3df42f>0x0&&(_0x1c2603+='\x20'+_0x3eebaa[_0xe904('0x67')]+'\x20');_0x1c2603+=_0x3eebaa[_0xe904('0x65')][_0x3df42f][_0xe904('0x79')]?_0x2730ce(_0x3eebaa[_0xe904('0x65')][_0x3df42f][_0xe904('0x79')]):_0x3eebaa[_0xe904('0x65')][_0x3df42f]['field']+'\x20'+_0x3eebaa[_0xe904('0x65')][_0x3df42f][_0xe904('0x69')]+(_0x596933(_0x3eebaa['rules'][_0x3df42f]['condition'])?'\x20'+_0x3eebaa[_0xe904('0x65')][_0x3df42f]['value']:'');}return _0x1c2603+')';};var _0x1f98c3={'where':{'id':_0x33ec1b[_0xe904('0x45')]['id']}},_0x59da9c,_0x334d4d,_0x476817,_0x158edb,_0x46c61a;_0x1f98c3=_['merge']({},_0x1f98c3,_0x33ec1b[_0xe904('0x3f')]);return db['AnalyticCustomReport'][_0xe904('0x47')](_0x1f98c3)['then'](function(_0x2cc21e){if(_0x2cc21e){_0x59da9c=_0x2cc21e;return _0x2cc21e['getFields']();}return null;})['then'](function(_0x2d2f53){if(_0x2d2f53){if(!_0x2d2f53[_0xe904('0x66')]){throw new db[(_0xe904('0x6b'))][(_0xe904('0x8f'))](_0xe904('0x6c'),0x193);}_0x334d4d=_0x2d2f53;return db[_0xe904('0x6d')][_0xe904('0x6e')]({'raw':!![]});}return null;})[_0xe904('0x26')](function(_0x2375f8){if(_0x2375f8){_0x476817=_[_0xe904('0x6f')](_0x2375f8,'id');var _0x3188d4;var _0x1ce1dc=squel[_0xe904('0x70')]();_0x1ce1dc[_0xe904('0x71')](_0x59da9c[_0xe904('0x72')]);for(var _0x3aa579=0x0;_0x3aa579<_0x334d4d['length'];_0x3aa579+=0x1){_0x3188d4=_0x334d4d[_0x3aa579]['MetricId']?_0x476817[_0x334d4d[_0x3aa579][_0xe904('0x73')]][_0xe904('0x74')]:_0x334d4d[_0x3aa579][_0xe904('0x68')];_0x3188d4=_0x334d4d[_0x3aa579][_0xe904('0x75')]?_['replace'](_0x38d8e5[_0x334d4d[_0x3aa579]['function']],'%s',_0x3188d4):_0x3188d4;_0x3188d4=_0x334d4d[_0x3aa579][_0xe904('0x77')]?_[_0xe904('0x76')](_0x2e7973[_0x334d4d[_0x3aa579][_0xe904('0x77')]],'%s',_0x3188d4):_0x3188d4;if(_0x334d4d[_0x3aa579][_0xe904('0x78')]){_0x1ce1dc[_0xe904('0x79')](_0x3188d4);}_0x334d4d[_0x3aa579][_0xe904('0x7a')]&&_0x1ce1dc[_0xe904('0x7b')](_0x3188d4,_0x334d4d[_0x3aa579]['orderBy']===_0xe904('0xa5')?![]:!![]);_0x1ce1dc[_0xe904('0x68')](_0x3188d4,_0x334d4d[_0x3aa579][_0xe904('0x7c')]||_0x3188d4);}if(_0x59da9c['joins']){_0x59da9c[_0xe904('0x7d')]=JSON[_0xe904('0x7e')](_0x59da9c['joins']);for(var _0x757e9b=0x0;_0x757e9b<_0x59da9c[_0xe904('0x7d')][_0xe904('0x66')];_0x757e9b+=0x1){if(_0x59da9c[_0xe904('0x7d')][_0x757e9b][_0xe904('0x7f')]&&_[_0xe904('0x60')](_0x53adc5,_0x59da9c[_0xe904('0x7d')][_0x757e9b]['type'])&&_0x59da9c[_0xe904('0x7d')][_0x757e9b][_0xe904('0x80')]&&_0x59da9c['joins'][_0x757e9b][_0xe904('0x81')]&&_0x59da9c['joins'][_0x757e9b][_0xe904('0x82')]){_0x1ce1dc[_0x59da9c[_0xe904('0x7d')][_0x757e9b][_0xe904('0x7f')]](_0x59da9c[_0xe904('0x7d')][_0x757e9b][_0xe904('0x81')],null,util[_0xe904('0x77')](_0xe904('0x83'),_0x59da9c[_0xe904('0x72')],_0x59da9c[_0xe904('0x7d')][_0x757e9b][_0xe904('0x80')],_0x59da9c[_0xe904('0x7d')][_0x757e9b]['foreignTable'],_0x59da9c[_0xe904('0x7d')][_0x757e9b][_0xe904('0x82')]));}}}if(_0x59da9c[_0xe904('0x84')]){_0x59da9c[_0xe904('0x84')]=JSON[_0xe904('0x7e')](_0x59da9c[_0xe904('0x84')]);_0x1ce1dc[_0xe904('0x3a')](_0x2730ce(_0x59da9c['conditions']['group']));}_0x46c61a=_0x1ce1dc[_0xe904('0x90')]();_0x1ce1dc[_0xe904('0x1f')](_0x1842b1);_0x1ce1dc[_0xe904('0x1c')](0x0);logger[_0xe904('0x85')]('Limited\x20Query:',_0x1ce1dc[_0xe904('0x87')]());return dbH[_0xe904('0x88')][_0xe904('0x33')](_0x1ce1dc[_0xe904('0x87')](),{'type':dbH[_0xe904('0x88')]['QueryTypes'][_0xe904('0x8a')]});}})[_0xe904('0x26')](function(){return{'sql':_0x46c61a['toString']()};})[_0xe904('0x26')](respondWithResult(_0x310fdc,null))[_0xe904('0x43')](handleError(_0x310fdc,null));};
\ No newline at end of file
+var _0xdee3=['then','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','AnalyticCustomReport','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','operator','getFields','alias','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','cdr','startDate','endDate','Run\x20Query:','child_process','../../files/reports','savename','select','countTable','COUNT(*)','SELECT','run','SUM(%s)','COUNT(%s)','IS\x20NOT\x20EMPTY','Limited\x20Query:','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy'];(function(_0x1eecea,_0x34d43d){var _0x7f1f7a=function(_0x24528c){while(--_0x24528c){_0x1eecea['push'](_0x1eecea['shift']());}};_0x7f1f7a(++_0x34d43d);}(_0xdee3,0x128));var _0x3dee=function(_0xd5789f,_0x17fac4){_0xd5789f=_0xd5789f-0x0;var _0x1af4cd=_0xdee3[_0xd5789f];return _0x1af4cd;};'use strict';var emlformat=require(_0x3dee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3dee('0x1'));var jsonpatch=require(_0x3dee('0x2'));var rp=require(_0x3dee('0x3'));var moment=require(_0x3dee('0x4'));var BPromise=require(_0x3dee('0x5'));var Mustache=require(_0x3dee('0x6'));var util=require(_0x3dee('0x7'));var path=require('path');var sox=require(_0x3dee('0x8'));var csv=require(_0x3dee('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3dee('0xa'));var squel=require(_0x3dee('0xb'));var crypto=require(_0x3dee('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3dee('0x9'));var querystring=require(_0x3dee('0xd'));var Papa=require(_0x3dee('0xe'));var Redis=require(_0x3dee('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3dee('0x10'));var as=require(_0x3dee('0x11'));var hardwareService=require(_0x3dee('0x12'));var logger=require(_0x3dee('0x13'))(_0x3dee('0x14'));var utils=require(_0x3dee('0x15'));var config=require(_0x3dee('0x16'));var licenseUtil=require(_0x3dee('0x17'));var db=require(_0x3dee('0x18'))['db'];var dbH=require(_0x3dee('0x18'))[_0x3dee('0x19')];function respondWithStatusCode(_0x528cd5,_0x16fc55){_0x16fc55=_0x16fc55||0xcc;return function(_0x1b0599){if(_0x1b0599){return _0x528cd5[_0x3dee('0x1a')](_0x16fc55);}return _0x528cd5[_0x3dee('0x1b')](_0x16fc55)[_0x3dee('0x1c')]();};}function respondWithResult(_0x379d3f,_0x163ebd){_0x163ebd=_0x163ebd||0xc8;return function(_0x1e07cc){if(_0x1e07cc){return _0x379d3f['status'](_0x163ebd)[_0x3dee('0x1d')](_0x1e07cc);}};}function respondWithFilteredResult(_0x4b28bf,_0xa0bf4e){return function(_0x1e44af){if(_0x1e44af){var _0x4232d9=typeof _0xa0bf4e[_0x3dee('0x1e')]==='undefined'&&typeof _0xa0bf4e[_0x3dee('0x1f')]===_0x3dee('0x20');var _0x58d9fb=_0x1e44af['count'];var _0x1cddab=_0x4232d9?0x0:_0xa0bf4e[_0x3dee('0x1e')];var _0x5953ea=_0x4232d9?_0x1e44af[_0x3dee('0x21')]:_0xa0bf4e[_0x3dee('0x1e')]+_0xa0bf4e['limit'];var _0x2454ec;if(_0x5953ea>=_0x58d9fb){_0x5953ea=_0x58d9fb;_0x2454ec=0xc8;}else{_0x2454ec=0xce;}_0x4b28bf['status'](_0x2454ec);return _0x4b28bf[_0x3dee('0x22')](_0x3dee('0x23'),_0x1cddab+'-'+_0x5953ea+'/'+_0x58d9fb)['json'](_0x1e44af);}return null;};}function patchUpdates(_0x125c8e){return function(_0x44b7fb){try{jsonpatch['apply'](_0x44b7fb,_0x125c8e,!![]);}catch(_0x239b9c){return BPromise[_0x3dee('0x24')](_0x239b9c);}return _0x44b7fb[_0x3dee('0x25')]();};}function saveUpdates(_0x28f368,_0x50732d){return function(_0xcf4080){if(_0xcf4080){return _0xcf4080[_0x3dee('0x26')](_0x28f368)['then'](function(_0x42a784){return _0x42a784;});}return null;};}function removeEntity(_0x6e791f,_0x226ee2){return function(_0x22be9d){if(_0x22be9d){return _0x22be9d[_0x3dee('0x27')]()[_0x3dee('0x28')](function(){var _0x4a1361=_0x22be9d[_0x3dee('0x29')]({'plain':!![]});var _0x3752d0='CustomReports';return db[_0x3dee('0x2a')][_0x3dee('0x27')]({'where':{'type':_0x3752d0,'resourceId':_0x4a1361['id']}})[_0x3dee('0x28')](function(){return _0x22be9d;});})[_0x3dee('0x28')](function(){_0x6e791f['status'](0xcc)[_0x3dee('0x1c')]();});}};}function handleEntityNotFound(_0x158df0,_0xaf68c8){return function(_0x3b608a){if(!_0x3b608a){_0x158df0[_0x3dee('0x1a')](0x194);}return _0x3b608a;};}function handleError(_0x47dcca,_0x3a348a){_0x3a348a=_0x3a348a||0x1f4;return function(_0x41f4af){logger[_0x3dee('0x2b')](_0x41f4af[_0x3dee('0x2c')]);if(_0x41f4af[_0x3dee('0x2d')]){delete _0x41f4af['name'];}_0x47dcca['status'](_0x3a348a)[_0x3dee('0x2e')](_0x41f4af);};}exports[_0x3dee('0x2f')]=function(_0x154e05,_0x43ddad){var _0x59da3e={},_0x2485da={},_0x118d87={'count':0x0,'rows':[]};var _0x109fbe=_[_0x3dee('0x30')](db['AnalyticCustomReport'][_0x3dee('0x31')],function(_0x37bb8d){return{'name':_0x37bb8d[_0x3dee('0x32')],'type':_0x37bb8d['type'][_0x3dee('0x33')]};});_0x2485da[_0x3dee('0x34')]=_['map'](_0x109fbe,_0x3dee('0x2d'));_0x2485da[_0x3dee('0x35')]=_[_0x3dee('0x36')](_0x154e05['query']);_0x2485da[_0x3dee('0x37')]=_[_0x3dee('0x38')](_0x2485da['model'],_0x2485da[_0x3dee('0x35')]);_0x59da3e[_0x3dee('0x39')]=_[_0x3dee('0x38')](_0x2485da[_0x3dee('0x34')],qs[_0x3dee('0x3a')](_0x154e05[_0x3dee('0x35')][_0x3dee('0x3a')]));_0x59da3e[_0x3dee('0x39')]=_0x59da3e[_0x3dee('0x39')]['length']?_0x59da3e[_0x3dee('0x39')]:_0x2485da[_0x3dee('0x34')];if(!_0x154e05[_0x3dee('0x35')][_0x3dee('0x3b')](_0x3dee('0x3c'))){_0x59da3e[_0x3dee('0x1f')]=qs[_0x3dee('0x1f')](_0x154e05[_0x3dee('0x35')][_0x3dee('0x1f')]);_0x59da3e[_0x3dee('0x1e')]=qs[_0x3dee('0x1e')](_0x154e05['query'][_0x3dee('0x1e')]);}_0x59da3e[_0x3dee('0x3d')]=qs['sort'](_0x154e05[_0x3dee('0x35')][_0x3dee('0x3e')]);_0x59da3e[_0x3dee('0x3f')]=qs[_0x3dee('0x37')](_[_0x3dee('0x40')](_0x154e05[_0x3dee('0x35')],_0x2485da[_0x3dee('0x37')]),_0x109fbe);if(_0x154e05[_0x3dee('0x35')][_0x3dee('0x41')]){_0x59da3e[_0x3dee('0x3f')]=_['merge'](_0x59da3e[_0x3dee('0x3f')],{'$or':_[_0x3dee('0x30')](_0x109fbe,function(_0x59b85a){if(_0x59b85a[_0x3dee('0x42')]!=='VIRTUAL'){var _0x4533ae={};_0x4533ae[_0x59b85a[_0x3dee('0x2d')]]={'$like':'%'+_0x154e05['query'][_0x3dee('0x41')]+'%'};return _0x4533ae;}})});}_0x59da3e=_[_0x3dee('0x43')]({},_0x59da3e,_0x154e05[_0x3dee('0x44')]);var _0x4764b6={'where':_0x59da3e[_0x3dee('0x3f')]};return db['AnalyticCustomReport'][_0x3dee('0x21')](_0x4764b6)['then'](function(_0xd91535){_0x118d87[_0x3dee('0x21')]=_0xd91535;if(_0x154e05[_0x3dee('0x35')][_0x3dee('0x45')]){_0x59da3e[_0x3dee('0x46')]=[{'all':!![]}];}return db[_0x3dee('0x47')][_0x3dee('0x48')](_0x59da3e);})[_0x3dee('0x28')](function(_0x8e7443){_0x118d87[_0x3dee('0x49')]=_0x8e7443;return _0x118d87;})[_0x3dee('0x28')](respondWithFilteredResult(_0x43ddad,_0x59da3e))[_0x3dee('0x4a')](handleError(_0x43ddad,null));};exports[_0x3dee('0x4b')]=function(_0xf5fe9c,_0x1dc47f){var _0x8f8caa={'raw':![],'where':{'id':_0xf5fe9c[_0x3dee('0x4c')]['id']}},_0x28ba95={};_0x28ba95['model']=_[_0x3dee('0x36')](db['AnalyticCustomReport']['rawAttributes']);_0x28ba95[_0x3dee('0x35')]=_[_0x3dee('0x36')](_0xf5fe9c['query']);_0x28ba95[_0x3dee('0x37')]=_['intersection'](_0x28ba95[_0x3dee('0x34')],_0x28ba95[_0x3dee('0x35')]);_0x8f8caa[_0x3dee('0x39')]=_[_0x3dee('0x38')](_0x28ba95[_0x3dee('0x34')],qs[_0x3dee('0x3a')](_0xf5fe9c[_0x3dee('0x35')]['fields']));_0x8f8caa[_0x3dee('0x39')]=_0x8f8caa[_0x3dee('0x39')][_0x3dee('0x4d')]?_0x8f8caa[_0x3dee('0x39')]:_0x28ba95['model'];if(_0xf5fe9c[_0x3dee('0x35')][_0x3dee('0x45')]){_0x8f8caa['include']=[{'all':!![]}];}_0x8f8caa=_[_0x3dee('0x43')]({},_0x8f8caa,_0xf5fe9c[_0x3dee('0x44')]);return db['AnalyticCustomReport'][_0x3dee('0x4e')](_0x8f8caa)[_0x3dee('0x28')](handleEntityNotFound(_0x1dc47f,null))[_0x3dee('0x28')](respondWithResult(_0x1dc47f,null))['catch'](handleError(_0x1dc47f,null));};exports[_0x3dee('0x4f')]=function(_0x761944,_0x2bb627){return db[_0x3dee('0x47')]['create'](_0x761944[_0x3dee('0x50')],{})['then'](function(_0x505b3b){var _0x53b5a2=_0x761944[_0x3dee('0x51')]['get']({'plain':!![]});if(!_0x53b5a2)throw new Error(_0x3dee('0x52'));if(_0x53b5a2['role']===_0x3dee('0x51')){var _0x45d557=_0x505b3b[_0x3dee('0x29')]({'plain':!![]});var _0x2a4b48='Reports';return db[_0x3dee('0x53')][_0x3dee('0x4e')]({'where':{'name':_0x2a4b48,'userProfileId':_0x53b5a2[_0x3dee('0x54')]},'raw':!![]})[_0x3dee('0x28')](function(_0x5d2fe4){if(_0x5d2fe4&&_0x5d2fe4[_0x3dee('0x55')]===0x0){return db['UserProfileResource'][_0x3dee('0x4f')]({'name':_0x45d557['name'],'resourceId':_0x45d557['id'],'type':_0x3dee('0x56'),'sectionId':_0x5d2fe4['id']},{})[_0x3dee('0x28')](function(){return _0x505b3b;});}else{return _0x505b3b;}})[_0x3dee('0x4a')](function(_0x423bbf){logger[_0x3dee('0x2b')](_0x3dee('0x57'),_0x423bbf);throw _0x423bbf;});}return _0x505b3b;})[_0x3dee('0x28')](respondWithResult(_0x2bb627,0xc9))['catch'](handleError(_0x2bb627,null));};exports[_0x3dee('0x26')]=function(_0x88ca5e,_0x7eb248){if(_0x88ca5e[_0x3dee('0x50')]['id']){delete _0x88ca5e[_0x3dee('0x50')]['id'];}return db[_0x3dee('0x47')][_0x3dee('0x4e')]({'where':{'id':_0x88ca5e[_0x3dee('0x4c')]['id']}})[_0x3dee('0x28')](handleEntityNotFound(_0x7eb248,null))[_0x3dee('0x28')](saveUpdates(_0x88ca5e['body'],null))[_0x3dee('0x28')](respondWithResult(_0x7eb248,null))[_0x3dee('0x4a')](handleError(_0x7eb248,null));};exports[_0x3dee('0x27')]=function(_0x204771,_0x26f15c){return db['AnalyticCustomReport']['find']({'where':{'id':_0x204771[_0x3dee('0x4c')]['id']}})[_0x3dee('0x28')](handleEntityNotFound(_0x26f15c,null))[_0x3dee('0x28')](removeEntity(_0x26f15c,null))[_0x3dee('0x4a')](handleError(_0x26f15c,null));};exports[_0x3dee('0x58')]=function(_0x4d9840,_0x123548){var _0xbbf4f8=0xa;var _0x12ff1e=[_0x3dee('0x59'),_0x3dee('0x5a'),_0x3dee('0x5b'),_0x3dee('0x5c')];var _0x1d1eec={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x3dee('0x5d'),'MAX':'MAX(%s)','MIN':_0x3dee('0x5e'),'AVG':_0x3dee('0x5f'),'GROUP_CONCAT':_0x3dee('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x3dee('0x61')};var _0x54aded={'SEC_TO_TIME':_0x3dee('0x62'),'DATE':_0x3dee('0x63'),'HOUR':_0x3dee('0x64'),'ROUND':_0x3dee('0x65'),'UNIX_TIMESTAMP':_0x3dee('0x66')};var _0x1e638e=function(_0x1686ca){return!_[_0x3dee('0x67')]([_0x3dee('0x68'),_0x3dee('0x69'),_0x3dee('0x6a'),'IS\x20NOT\x20EMPTY'],_0x1686ca);};var _0x3ceed2=function(_0xc1bcdc){if(!_0xc1bcdc||!_0xc1bcdc[_0x3dee('0x6b')]['length']){return'';}for(var _0x48677b='(',_0x49661e=0x0;_0x49661e<_0xc1bcdc[_0x3dee('0x6b')]['length'];_0x49661e+=0x1){_0x49661e>0x0&&(_0x48677b+='\x20'+_0xc1bcdc['operator']+'\x20');_0x48677b+=_0xc1bcdc['rules'][_0x49661e][_0x3dee('0x6c')]?_0x3ceed2(_0xc1bcdc['rules'][_0x49661e]['group']):_0xc1bcdc[_0x3dee('0x6b')][_0x49661e][_0x3dee('0x6d')]+'\x20'+_0xc1bcdc[_0x3dee('0x6b')][_0x49661e][_0x3dee('0x6e')]+(_0x1e638e(_0xc1bcdc[_0x3dee('0x6b')][_0x49661e][_0x3dee('0x6e')])?'\x20'+_0xc1bcdc[_0x3dee('0x6b')][_0x49661e][_0x3dee('0x6f')]:'');}return _0x48677b+')';};var _0x1a999e={'where':{'id':_0x4d9840[_0x3dee('0x4c')]['id']}},_0x1ae84e,_0x12edd2,_0x4a1955,_0x2eda6e,_0x1e961d;_0x1a999e=_[_0x3dee('0x43')]({},_0x1a999e,_0x4d9840[_0x3dee('0x44')]);return db[_0x3dee('0x47')][_0x3dee('0x4e')](_0x1a999e)[_0x3dee('0x28')](function(_0x2e4e1d){if(_0x2e4e1d){_0x1ae84e=_0x2e4e1d;return _0x2e4e1d['getFields']();}return null;})['then'](function(_0x52d973){if(_0x52d973){if(!_0x52d973[_0x3dee('0x4d')]){throw new db[(_0x3dee('0x70'))][(_0x3dee('0x71'))](_0x3dee('0x72'),0x193);}_0x12edd2=_0x52d973;return db[_0x3dee('0x73')][_0x3dee('0x48')]({'raw':!![]});}return null;})[_0x3dee('0x28')](function(_0x1eee19){if(_0x1eee19){_0x4a1955=_[_0x3dee('0x74')](_0x1eee19,'id');var _0xeae373;var _0x455cfd=squel['select']();_0x455cfd[_0x3dee('0x75')](_0x1ae84e[_0x3dee('0x76')]);for(var _0x217462=0x0;_0x217462<_0x12edd2[_0x3dee('0x4d')];_0x217462+=0x1){_0xeae373=_0x12edd2[_0x217462][_0x3dee('0x77')]?_0x4a1955[_0x12edd2[_0x217462][_0x3dee('0x77')]][_0x3dee('0x78')]:_0x12edd2[_0x217462]['field'];_0xeae373=_0x12edd2[_0x217462][_0x3dee('0x79')]?_[_0x3dee('0x7a')](_0x1d1eec[_0x12edd2[_0x217462][_0x3dee('0x79')]],'%s',_0xeae373):_0xeae373;_0xeae373=_0x12edd2[_0x217462]['format']?_['replace'](_0x54aded[_0x12edd2[_0x217462][_0x3dee('0x7b')]],'%s',_0xeae373):_0xeae373;if(_0x12edd2[_0x217462][_0x3dee('0x7c')]){_0x455cfd['group'](_0xeae373);}_0x12edd2[_0x217462]['orderBy']&&_0x455cfd['order'](_0xeae373,_0x12edd2[_0x217462][_0x3dee('0x7d')]===_0x3dee('0x7e')?![]:!![]);_0x455cfd[_0x3dee('0x6d')](_0xeae373,_0x12edd2[_0x217462]['alias']||_0xeae373);}if(_0x1ae84e[_0x3dee('0x7f')]){_0x1ae84e[_0x3dee('0x7f')]=JSON[_0x3dee('0x80')](_0x1ae84e[_0x3dee('0x7f')]);for(var _0x5cd526=0x0;_0x5cd526<_0x1ae84e[_0x3dee('0x7f')][_0x3dee('0x4d')];_0x5cd526+=0x1){if(_0x1ae84e['joins'][_0x5cd526][_0x3dee('0x42')]&&_[_0x3dee('0x67')](_0x12ff1e,_0x1ae84e[_0x3dee('0x7f')][_0x5cd526][_0x3dee('0x42')])&&_0x1ae84e[_0x3dee('0x7f')][_0x5cd526][_0x3dee('0x81')]&&_0x1ae84e[_0x3dee('0x7f')][_0x5cd526]['foreignTable']&&_0x1ae84e[_0x3dee('0x7f')][_0x5cd526][_0x3dee('0x82')]){_0x455cfd[_0x1ae84e['joins'][_0x5cd526][_0x3dee('0x42')]](_0x1ae84e[_0x3dee('0x7f')][_0x5cd526][_0x3dee('0x83')],null,util[_0x3dee('0x7b')](_0x3dee('0x84'),_0x1ae84e[_0x3dee('0x76')],_0x1ae84e[_0x3dee('0x7f')][_0x5cd526][_0x3dee('0x81')],_0x1ae84e[_0x3dee('0x7f')][_0x5cd526]['foreignTable'],_0x1ae84e[_0x3dee('0x7f')][_0x5cd526][_0x3dee('0x82')]));}}}if(_0x1ae84e[_0x3dee('0x85')]){_0x1ae84e[_0x3dee('0x85')]=JSON[_0x3dee('0x80')](_0x1ae84e[_0x3dee('0x85')]);_0x455cfd['where'](_0x3ceed2(_0x1ae84e[_0x3dee('0x85')][_0x3dee('0x6c')]));}_0x1e961d=_0x455cfd[_0x3dee('0x86')]();_0x455cfd[_0x3dee('0x1f')](_0xbbf4f8);_0x455cfd[_0x3dee('0x1e')](0x0);logger[_0x3dee('0x87')]('Limited\x20Query:',_0x455cfd[_0x3dee('0x88')]());return dbH['sequelize'][_0x3dee('0x35')](_0x455cfd[_0x3dee('0x88')](),{'type':dbH[_0x3dee('0x89')][_0x3dee('0x8a')]['SELECT']});}})[_0x3dee('0x28')](respondWithResult(_0x123548,null))[_0x3dee('0x4a')](handleError(_0x123548,null));};function runReport(_0x30e16a,_0x228655,_0x63def6){var _0x5c928c=_0x228655[_0x3dee('0x2d')];var _0x5181a3=0xa;var _0x231416=[_0x3dee('0x59'),'left_join',_0x3dee('0x5b'),_0x3dee('0x5c')];var _0x20ae25={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x3dee('0x5d'),'MAX':_0x3dee('0x8b'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x3dee('0x60'),'GROUP_CONCAT ASC':_0x3dee('0x8c'),'GROUP_CONCAT DESC':_0x3dee('0x61')};var _0x1cd2bf={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x3dee('0x63'),'HOUR':_0x3dee('0x64'),'ROUND':_0x3dee('0x65'),'UNIX_TIMESTAMP':_0x3dee('0x66')};var _0x136b33=function(_0x4c81ce){return!_[_0x3dee('0x67')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x3dee('0x6a'),'IS\x20NOT\x20EMPTY'],_0x4c81ce);};var _0x37e2c9=function(_0x4a6bb4){if(!_0x4a6bb4||!_0x4a6bb4['rules'][_0x3dee('0x4d')]){return'';}for(var _0x5f0d01='(',_0x417358=0x0;_0x417358<_0x4a6bb4['rules']['length'];_0x417358+=0x1){_0x417358>0x0&&(_0x5f0d01+='\x20'+_0x4a6bb4[_0x3dee('0x8d')]+'\x20');_0x5f0d01+=_0x4a6bb4[_0x3dee('0x6b')][_0x417358][_0x3dee('0x6c')]?_0x37e2c9(_0x4a6bb4[_0x3dee('0x6b')][_0x417358][_0x3dee('0x6c')]):_0x4a6bb4[_0x3dee('0x6b')][_0x417358]['field']+'\x20'+_0x4a6bb4[_0x3dee('0x6b')][_0x417358][_0x3dee('0x6e')]+(_0x136b33(_0x4a6bb4[_0x3dee('0x6b')][_0x417358][_0x3dee('0x6e')])?'\x20'+_0x4a6bb4[_0x3dee('0x6b')][_0x417358][_0x3dee('0x6f')]:'');}return _0x5f0d01+')';};var _0x393f62={'where':{'id':_0x30e16a['id']}},_0x3ebfa9,_0x391e55,_0x22efcf,_0x368153,_0x402b3e;_0x393f62=_[_0x3dee('0x43')]({},_0x393f62,_0x63def6);return db[_0x3dee('0x47')][_0x3dee('0x4e')](_0x393f62)['then'](function(_0x24a43c){if(_0x24a43c){_0x3ebfa9=_0x24a43c;return _0x24a43c[_0x3dee('0x8e')]();}return null;})[_0x3dee('0x28')](function(_0x134800){if(_0x134800){if(!_0x134800[_0x3dee('0x4d')]){throw new db['Sequelize'][(_0x3dee('0x71'))](_0x3dee('0x72'),0x193);}_0x391e55=_0x134800;return db[_0x3dee('0x73')][_0x3dee('0x48')]({'raw':!![]});}return null;})['then'](function(_0x4824d0){if(_0x4824d0){_0x22efcf=_[_0x3dee('0x74')](_0x4824d0,'id');var _0x2f01cd;var _0x388fff=squel['select']();_0x388fff[_0x3dee('0x75')](_0x3ebfa9['table']);for(var _0x1eccb3=0x0;_0x1eccb3<_0x391e55['length'];_0x1eccb3+=0x1){_0x2f01cd=_0x391e55[_0x1eccb3][_0x3dee('0x77')]?_0x22efcf[_0x391e55[_0x1eccb3][_0x3dee('0x77')]][_0x3dee('0x78')]:_0x391e55[_0x1eccb3]['field'];_0x2f01cd=_0x391e55[_0x1eccb3][_0x3dee('0x79')]?_[_0x3dee('0x7a')](_0x20ae25[_0x391e55[_0x1eccb3]['function']],'%s',_0x2f01cd):_0x2f01cd;_0x2f01cd=_0x391e55[_0x1eccb3][_0x3dee('0x7b')]?_[_0x3dee('0x7a')](_0x1cd2bf[_0x391e55[_0x1eccb3][_0x3dee('0x7b')]],'%s',_0x2f01cd):_0x2f01cd;if(_0x391e55[_0x1eccb3][_0x3dee('0x7c')]){_0x388fff[_0x3dee('0x6c')](_0x2f01cd);}_0x391e55[_0x1eccb3][_0x3dee('0x7d')]&&_0x388fff['order'](_0x2f01cd,_0x391e55[_0x1eccb3][_0x3dee('0x7d')]===_0x3dee('0x7e')?![]:!![]);_0x388fff[_0x3dee('0x6d')](_0x2f01cd,_0x391e55[_0x1eccb3][_0x3dee('0x8f')]||_0x2f01cd);}if(_0x3ebfa9['joins']){_0x3ebfa9[_0x3dee('0x7f')]=JSON[_0x3dee('0x80')](_0x3ebfa9[_0x3dee('0x7f')]);for(var _0x16dda5=0x0;_0x16dda5<_0x3ebfa9[_0x3dee('0x7f')]['length'];_0x16dda5+=0x1){if(_0x3ebfa9[_0x3dee('0x7f')][_0x16dda5][_0x3dee('0x42')]&&_['includes'](_0x231416,_0x3ebfa9[_0x3dee('0x7f')][_0x16dda5]['type'])&&_0x3ebfa9[_0x3dee('0x7f')][_0x16dda5][_0x3dee('0x81')]&&_0x3ebfa9[_0x3dee('0x7f')][_0x16dda5][_0x3dee('0x83')]&&_0x3ebfa9[_0x3dee('0x7f')][_0x16dda5][_0x3dee('0x82')]){_0x388fff[_0x3ebfa9[_0x3dee('0x7f')][_0x16dda5][_0x3dee('0x42')]](_0x3ebfa9[_0x3dee('0x7f')][_0x16dda5][_0x3dee('0x83')],null,util['format'](_0x3dee('0x84'),_0x3ebfa9[_0x3dee('0x76')],_0x3ebfa9[_0x3dee('0x7f')][_0x16dda5][_0x3dee('0x81')],_0x3ebfa9[_0x3dee('0x7f')][_0x16dda5][_0x3dee('0x83')],_0x3ebfa9[_0x3dee('0x7f')][_0x16dda5][_0x3dee('0x82')]));}}}if(_0x3ebfa9[_0x3dee('0x85')]){_0x3ebfa9[_0x3dee('0x85')]=JSON[_0x3dee('0x80')](_0x3ebfa9[_0x3dee('0x85')]);_0x388fff['where'](_0x37e2c9(_0x3ebfa9[_0x3dee('0x85')][_0x3dee('0x6c')]));}_0x402b3e=_0x388fff[_0x3dee('0x86')]();_0x388fff[_0x3dee('0x1f')](_0x5181a3);_0x388fff[_0x3dee('0x1e')](0x0);return;}})[_0x3dee('0x28')](function(){if(_0x228655[_0x3dee('0x90')]===_0x3dee('0x91')){return null;}var _0x550918=_[_0x3dee('0x43')](_0x228655,{'name':_0x228655[_0x3dee('0x92')]||_0x228655[_0x3dee('0x2d')]||_0x3ebfa9[_0x3dee('0x2d')],'basename':_0x5c928c,'savename':util[_0x3dee('0x7b')](_0x3dee('0x93'),_0x228655[_0x3dee('0x2d')]||_0x3ebfa9['name'],require(_0x3dee('0x94'))[_0x3dee('0x95')](0x4),_0x228655['output']||'csv'),'reportId':_0x3ebfa9['id'],'reportType':_0x3dee('0x96')});return db[_0x3dee('0x97')][_0x3dee('0x4f')](_0x550918,{'raw':!![]});})['then'](function(_0x38b1fe){if(_0x3ebfa9[_0x3dee('0x76')]===_0x3dee('0x98')){_0x402b3e[_0x3dee('0x3f')](_0x3ebfa9[_0x3dee('0x76')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x228655[_0x3dee('0x99')],_0x228655['endDate']);}else{_0x402b3e['where'](_0x3ebfa9[_0x3dee('0x76')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x228655[_0x3dee('0x99')],_0x228655[_0x3dee('0x9a')]);}if(_0x38b1fe){logger['info'](_0x3dee('0x9b'),_0x402b3e[_0x3dee('0x88')]());require(_0x3dee('0x9c'))['fork'](path[_0x3dee('0x59')](__dirname,'../../components/export/',_0x38b1fe['output']),[_0x38b1fe['id'],_0x402b3e[_0x3dee('0x88')](),path[_0x3dee('0x59')](__dirname,_0x3dee('0x9d'),_0x38b1fe[_0x3dee('0x9e')]),_0x5c928c]);return _0x38b1fe;}else{var _0x3d4bb4=squel[_0x3dee('0x9f')]();_0x3d4bb4[_0x3dee('0x75')]('('+_0x402b3e[_0x3dee('0x88')]()+')',_0x3dee('0xa0'));_0x3d4bb4[_0x3dee('0x6d')](_0x3dee('0xa1'),_0x3dee('0x21'));_0x402b3e[_0x3dee('0x1f')](_0x228655[_0x3dee('0x1f')]||_0x5181a3);_0x402b3e[_0x3dee('0x1e')](_0x228655[_0x3dee('0x1e')]||0x0);return dbH[_0x3dee('0x89')][_0x3dee('0x35')](_0x3d4bb4[_0x3dee('0x88')](),{'type':dbH[_0x3dee('0x89')][_0x3dee('0x8a')][_0x3dee('0xa2')]})[_0x3dee('0x28')](function(_0x164dee){if(!_0x164dee[_0x3dee('0x4d')]){_0x368153=0x0;}else{_0x368153=_0x164dee[0x0][_0x3dee('0x21')]||0x0;}return dbH[_0x3dee('0x89')][_0x3dee('0x35')](_0x402b3e[_0x3dee('0x88')](),{'type':dbH[_0x3dee('0x89')][_0x3dee('0x8a')][_0x3dee('0xa2')]});})['then'](function(_0x13fd7d){return{'rows':_0x13fd7d||[],'count':_0x368153};});}});}exports[_0x3dee('0xa3')]=function(_0x1de823,_0x48363c){return runReport(_0x1de823[_0x3dee('0x4c')],_0x1de823[_0x3dee('0x35')],_0x1de823['options'])[_0x3dee('0x28')](respondWithResult(_0x48363c,null))[_0x3dee('0x4a')](handleError(_0x48363c,null));};exports['runReport']=runReport;exports['query']=function(_0x2161d7,_0x513f7e){var _0x5e0bb0=0xa;var _0xb70d00=['join',_0x3dee('0x5a'),_0x3dee('0x5b'),_0x3dee('0x5c')];var _0x2d8304={'SUM':_0x3dee('0xa4'),'COUNT':_0x3dee('0xa5'),'COUNT DISTINCT':_0x3dee('0x5d'),'MAX':_0x3dee('0x8b'),'MIN':_0x3dee('0x5e'),'AVG':_0x3dee('0x5f'),'GROUP_CONCAT':_0x3dee('0x60'),'GROUP_CONCAT ASC':_0x3dee('0x8c'),'GROUP_CONCAT DESC':_0x3dee('0x61')};var _0x1bfd48={'SEC_TO_TIME':_0x3dee('0x62'),'DATE':_0x3dee('0x63'),'HOUR':_0x3dee('0x64'),'ROUND':_0x3dee('0x65'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x43e015=function(_0x573015){return!_[_0x3dee('0x67')]([_0x3dee('0x68'),_0x3dee('0x69'),_0x3dee('0x6a'),_0x3dee('0xa6')],_0x573015);};var _0x4b06b6=function(_0x1fc444){if(!_0x1fc444||!_0x1fc444[_0x3dee('0x6b')]['length']){return'';}for(var _0x38d455='(',_0x4716a0=0x0;_0x4716a0<_0x1fc444['rules'][_0x3dee('0x4d')];_0x4716a0+=0x1){_0x4716a0>0x0&&(_0x38d455+='\x20'+_0x1fc444[_0x3dee('0x8d')]+'\x20');_0x38d455+=_0x1fc444[_0x3dee('0x6b')][_0x4716a0][_0x3dee('0x6c')]?_0x4b06b6(_0x1fc444['rules'][_0x4716a0][_0x3dee('0x6c')]):_0x1fc444['rules'][_0x4716a0][_0x3dee('0x6d')]+'\x20'+_0x1fc444[_0x3dee('0x6b')][_0x4716a0][_0x3dee('0x6e')]+(_0x43e015(_0x1fc444[_0x3dee('0x6b')][_0x4716a0][_0x3dee('0x6e')])?'\x20'+_0x1fc444[_0x3dee('0x6b')][_0x4716a0]['value']:'');}return _0x38d455+')';};var _0x5b4a38={'where':{'id':_0x2161d7[_0x3dee('0x4c')]['id']}},_0x3b80be,_0xecf244,_0x349738,_0x3f9493,_0x3f68bd;_0x5b4a38=_[_0x3dee('0x43')]({},_0x5b4a38,_0x2161d7['options']);return db[_0x3dee('0x47')]['find'](_0x5b4a38)[_0x3dee('0x28')](function(_0x4668dd){if(_0x4668dd){_0x3b80be=_0x4668dd;return _0x4668dd['getFields']();}return null;})[_0x3dee('0x28')](function(_0x2245eb){if(_0x2245eb){if(!_0x2245eb[_0x3dee('0x4d')]){throw new db[(_0x3dee('0x70'))][(_0x3dee('0x71'))](_0x3dee('0x72'),0x193);}_0xecf244=_0x2245eb;return db[_0x3dee('0x73')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x3aa637){if(_0x3aa637){_0x349738=_['keyBy'](_0x3aa637,'id');var _0x4a4805;var _0x1a048f=squel[_0x3dee('0x9f')]();_0x1a048f[_0x3dee('0x75')](_0x3b80be['table']);for(var _0x2ea014=0x0;_0x2ea014<_0xecf244['length'];_0x2ea014+=0x1){_0x4a4805=_0xecf244[_0x2ea014][_0x3dee('0x77')]?_0x349738[_0xecf244[_0x2ea014][_0x3dee('0x77')]][_0x3dee('0x78')]:_0xecf244[_0x2ea014][_0x3dee('0x6d')];_0x4a4805=_0xecf244[_0x2ea014][_0x3dee('0x79')]?_[_0x3dee('0x7a')](_0x2d8304[_0xecf244[_0x2ea014][_0x3dee('0x79')]],'%s',_0x4a4805):_0x4a4805;_0x4a4805=_0xecf244[_0x2ea014][_0x3dee('0x7b')]?_[_0x3dee('0x7a')](_0x1bfd48[_0xecf244[_0x2ea014][_0x3dee('0x7b')]],'%s',_0x4a4805):_0x4a4805;if(_0xecf244[_0x2ea014][_0x3dee('0x7c')]){_0x1a048f['group'](_0x4a4805);}_0xecf244[_0x2ea014][_0x3dee('0x7d')]&&_0x1a048f['order'](_0x4a4805,_0xecf244[_0x2ea014][_0x3dee('0x7d')]===_0x3dee('0x7e')?![]:!![]);_0x1a048f['field'](_0x4a4805,_0xecf244[_0x2ea014][_0x3dee('0x8f')]||_0x4a4805);}if(_0x3b80be['joins']){_0x3b80be[_0x3dee('0x7f')]=JSON[_0x3dee('0x80')](_0x3b80be[_0x3dee('0x7f')]);for(var _0x57d242=0x0;_0x57d242<_0x3b80be[_0x3dee('0x7f')][_0x3dee('0x4d')];_0x57d242+=0x1){if(_0x3b80be[_0x3dee('0x7f')][_0x57d242][_0x3dee('0x42')]&&_[_0x3dee('0x67')](_0xb70d00,_0x3b80be[_0x3dee('0x7f')][_0x57d242][_0x3dee('0x42')])&&_0x3b80be[_0x3dee('0x7f')][_0x57d242][_0x3dee('0x81')]&&_0x3b80be[_0x3dee('0x7f')][_0x57d242][_0x3dee('0x83')]&&_0x3b80be[_0x3dee('0x7f')][_0x57d242][_0x3dee('0x82')]){_0x1a048f[_0x3b80be[_0x3dee('0x7f')][_0x57d242][_0x3dee('0x42')]](_0x3b80be[_0x3dee('0x7f')][_0x57d242]['foreignTable'],null,util[_0x3dee('0x7b')](_0x3dee('0x84'),_0x3b80be[_0x3dee('0x76')],_0x3b80be['joins'][_0x57d242]['parentKey'],_0x3b80be[_0x3dee('0x7f')][_0x57d242][_0x3dee('0x83')],_0x3b80be[_0x3dee('0x7f')][_0x57d242][_0x3dee('0x82')]));}}}if(_0x3b80be[_0x3dee('0x85')]){_0x3b80be[_0x3dee('0x85')]=JSON[_0x3dee('0x80')](_0x3b80be[_0x3dee('0x85')]);_0x1a048f[_0x3dee('0x3f')](_0x4b06b6(_0x3b80be[_0x3dee('0x85')][_0x3dee('0x6c')]));}_0x3f68bd=_0x1a048f['clone']();_0x1a048f[_0x3dee('0x1f')](_0x5e0bb0);_0x1a048f['offset'](0x0);logger[_0x3dee('0x87')](_0x3dee('0xa7'),_0x1a048f['toString']());return dbH[_0x3dee('0x89')][_0x3dee('0x35')](_0x1a048f[_0x3dee('0x88')](),{'type':dbH[_0x3dee('0x89')][_0x3dee('0x8a')][_0x3dee('0xa2')]});}})[_0x3dee('0x28')](function(){return{'sql':_0x3f68bd[_0x3dee('0x88')]()};})[_0x3dee('0x28')](respondWithResult(_0x513f7e,null))[_0x3dee('0x4a')](handleError(_0x513f7e,null));};
\ No newline at end of file
index 717754a..0b4fb6d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd094=['request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','util','../../config/logger'];(function(_0x347932,_0x2618cc){var _0x7a730c=function(_0x4e18e1){while(--_0x4e18e1){_0x347932['push'](_0x347932['shift']());}};_0x7a730c(++_0x2618cc);}(_0xd094,0x96));var _0x4d09=function(_0x572139,_0x12e565){_0x572139=_0x572139-0x0;var _0x3cdcfa=_0xd094[_0x572139];return _0x3cdcfa;};'use strict';var _=require('lodash');var util=require(_0x4d09('0x0'));var logger=require(_0x4d09('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4d09('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d09('0x3'));var config=require(_0x4d09('0x4'));var attributes=require(_0x4d09('0x5'));module['exports']=function(_0x347513,_0x433a70){return _0x347513[_0x4d09('0x6')](_0x4d09('0x7'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xe7ed=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x54a46f,_0x3f904f){var _0x240c12=function(_0x4bc885){while(--_0x4bc885){_0x54a46f['push'](_0x54a46f['shift']());}};_0x240c12(++_0x3f904f);}(_0xe7ed,0x124));var _0xde7e=function(_0x2c1a96,_0x46c443){_0x2c1a96=_0x2c1a96-0x0;var _0x536db1=_0xe7ed[_0x2c1a96];return _0x536db1;};'use strict';var _=require(_0xde7e('0x0'));var util=require(_0xde7e('0x1'));var logger=require(_0xde7e('0x2'))(_0xde7e('0x3'));var moment=require(_0xde7e('0x4'));var BPromise=require(_0xde7e('0x5'));var rp=require(_0xde7e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde7e('0x7'));var config=require(_0xde7e('0x8'));var attributes=require(_0xde7e('0x9'));module[_0xde7e('0xa')]=function(_0x5db3fd,_0x42ea07){return _0x5db3fd['define'](_0xde7e('0xb'),attributes,{'tableName':_0xde7e('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c70915e..8cdc365 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8797=['../../config/environment','jayson/promise','client','request','then','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x8797,0x123));var _0x7879=function(_0x18d431,_0x1412f5){_0x18d431=_0x18d431-0x0;var _0x265a6b=_0x8797[_0x18d431];return _0x265a6b;};'use strict';var _=require(_0x7879('0x0'));var util=require(_0x7879('0x1'));var moment=require(_0x7879('0x2'));var BPromise=require(_0x7879('0x3'));var rs=require(_0x7879('0x4'));var fs=require('fs');var Redis=require(_0x7879('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7879('0x6'))(_0x7879('0x7'));var config=require(_0x7879('0x8'));var jayson=require(_0x7879('0x9'));var client=jayson[_0x7879('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbf3f7a,_0x489971,_0x31734c){return new BPromise(function(_0x2fc974,_0xa58eaa){return client[_0x7879('0xb')](_0xbf3f7a,_0x31734c)[_0x7879('0xc')](function(_0x1cfe70){logger['info'](_0x7879('0xd'),_0x489971,'request\x20sent');logger[_0x7879('0xe')](_0x7879('0xf'),_0x489971,'request\x20sent',JSON[_0x7879('0x10')](_0x1cfe70));if(_0x1cfe70[_0x7879('0x11')]){if(_0x1cfe70[_0x7879('0x11')][_0x7879('0x12')]===0x1f4){logger[_0x7879('0x11')](_0x7879('0xd'),_0x489971,_0x1cfe70[_0x7879('0x11')][_0x7879('0x13')]);return _0xa58eaa(_0x1cfe70[_0x7879('0x11')][_0x7879('0x13')]);}logger[_0x7879('0x11')](_0x7879('0xd'),_0x489971,_0x1cfe70[_0x7879('0x11')]['message']);return _0x2fc974(_0x1cfe70[_0x7879('0x11')][_0x7879('0x13')]);}else{logger[_0x7879('0x14')](_0x7879('0xd'),_0x489971,'request\x20sent');_0x2fc974(_0x1cfe70[_0x7879('0x15')][_0x7879('0x13')]);}})[_0x7879('0x16')](function(_0x3d3bd7){logger[_0x7879('0x11')](_0x7879('0xd'),_0x489971,_0x3d3bd7);_0xa58eaa(_0x3d3bd7);});});}
\ No newline at end of file
+var _0xd0c9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xd0c9,0x190));var _0x9d0c=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xd0c9[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require(_0x9d0c('0x0'));var util=require(_0x9d0c('0x1'));var moment=require(_0x9d0c('0x2'));var BPromise=require(_0x9d0c('0x3'));var rs=require(_0x9d0c('0x4'));var fs=require('fs');var Redis=require(_0x9d0c('0x5'));var db=require(_0x9d0c('0x6'))['db'];var utils=require(_0x9d0c('0x7'));var logger=require(_0x9d0c('0x8'))(_0x9d0c('0x9'));var config=require(_0x9d0c('0xa'));var jayson=require(_0x9d0c('0xb'));var client=jayson[_0x9d0c('0xc')][_0x9d0c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x185979,_0x343ad6,_0x2de265){return new BPromise(function(_0x4af288,_0x3d633a){return client[_0x9d0c('0xe')](_0x185979,_0x2de265)[_0x9d0c('0xf')](function(_0x527d44){logger[_0x9d0c('0x10')](_0x9d0c('0x11'),_0x343ad6,'request\x20sent');logger['debug'](_0x9d0c('0x12'),_0x343ad6,'request\x20sent',JSON[_0x9d0c('0x13')](_0x527d44));if(_0x527d44[_0x9d0c('0x14')]){if(_0x527d44[_0x9d0c('0x14')][_0x9d0c('0x15')]===0x1f4){logger[_0x9d0c('0x14')](_0x9d0c('0x11'),_0x343ad6,_0x527d44[_0x9d0c('0x14')][_0x9d0c('0x16')]);return _0x3d633a(_0x527d44[_0x9d0c('0x14')][_0x9d0c('0x16')]);}logger[_0x9d0c('0x14')](_0x9d0c('0x11'),_0x343ad6,_0x527d44[_0x9d0c('0x14')][_0x9d0c('0x16')]);return _0x4af288(_0x527d44[_0x9d0c('0x14')][_0x9d0c('0x16')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x343ad6,'request\x20sent');_0x4af288(_0x527d44['result']['message']);}})[_0x9d0c('0x17')](function(_0x33f356){logger['error'](_0x9d0c('0x11'),_0x343ad6,_0x33f356);_0x3d633a(_0x33f356);});});}
\ No newline at end of file
index bfb73bf..6e62837 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x64db=['run','/:id/query','query','post','put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','/:id','isAuthenticated','/:id/run'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64db,0x103));var _0xb64d=function(_0x4afcc2,_0x2412e6){_0x4afcc2=_0x4afcc2-0x0;var _0x57708e=_0x64db[_0x4afcc2];return _0x57708e;};'use strict';var multer=require(_0xb64d('0x0'));var util=require(_0xb64d('0x1'));var path=require(_0xb64d('0x2'));var timeout=require(_0xb64d('0x3'));var express=require(_0xb64d('0x4'));var router=express['Router']();var fs_extra=require(_0xb64d('0x5'));var auth=require(_0xb64d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0xb64d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb64d('0x7')](_0xb64d('0x8'),auth[_0xb64d('0x9')](),controller['show']);router[_0xb64d('0x7')]('/:id/preview',auth['isAuthenticated'](),controller['preview']);router[_0xb64d('0x7')](_0xb64d('0xa'),auth[_0xb64d('0x9')](),controller[_0xb64d('0xb')]);router[_0xb64d('0x7')](_0xb64d('0xc'),auth[_0xb64d('0x9')](),controller[_0xb64d('0xd')]);router[_0xb64d('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb64d('0xf')](_0xb64d('0x8'),auth[_0xb64d('0x9')](),controller[_0xb64d('0x10')]);router['delete'](_0xb64d('0x8'),auth[_0xb64d('0x9')](),controller[_0xb64d('0x11')]);module['exports']=router;
\ No newline at end of file
+var _0x6952=['show','/:id/preview','preview','/:id/run','/:id/query','post','create','put','/:id','delete','destroy','multer','util','path','Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','get'];(function(_0x376a34,_0x434e46){var _0x35ba39=function(_0x23078f){while(--_0x23078f){_0x376a34['push'](_0x376a34['shift']());}};_0x35ba39(++_0x434e46);}(_0x6952,0x97));var _0x2695=function(_0x5a2927,_0x134341){_0x5a2927=_0x5a2927-0x0;var _0x1a7775=_0x6952[_0x5a2927];return _0x1a7775;};'use strict';var multer=require(_0x2695('0x0'));var util=require(_0x2695('0x1'));var path=require(_0x2695('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2695('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2695('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2695('0x5'));var controller=require(_0x2695('0x6'));router['get']('/',auth[_0x2695('0x7')](),controller['index']);router[_0x2695('0x8')]('/:id',auth[_0x2695('0x7')](),controller[_0x2695('0x9')]);router[_0x2695('0x8')](_0x2695('0xa'),auth[_0x2695('0x7')](),controller[_0x2695('0xb')]);router[_0x2695('0x8')](_0x2695('0xc'),auth['isAuthenticated'](),controller['run']);router[_0x2695('0x8')](_0x2695('0xd'),auth[_0x2695('0x7')](),controller['query']);router[_0x2695('0xe')]('/',auth[_0x2695('0x7')](),controller[_0x2695('0xf')]);router[_0x2695('0x10')](_0x2695('0x11'),auth[_0x2695('0x7')](),controller['update']);router[_0x2695('0x12')]('/:id',auth[_0x2695('0x7')](),controller[_0x2695('0x13')]);module['exports']=router;
\ No newline at end of file
index 6cd387d..ad471fc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0x23cd19,_0x4e8271){var _0x55c3ed=function(_0x2a9426){while(--_0x2a9426){_0x23cd19['push'](_0x23cd19['shift']());}};_0x55c3ed(++_0x4e8271);}(_0xeda8,0x104));var _0x8eda=function(_0x6cf5ec,_0xd45243){_0x6cf5ec=_0x6cf5ec-0x0;var _0x5364a5=_0xeda8[_0x6cf5ec];return _0x5364a5;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}};
\ No newline at end of file
+var _0x24ca=['sequelize','STRING','TEXT'];(function(_0x4819e1,_0x44d88e){var _0xca4f58=function(_0x494088){while(--_0x494088){_0x4819e1['push'](_0x4819e1['shift']());}};_0xca4f58(++_0x44d88e);}(_0x24ca,0x1bc));var _0xa24c=function(_0x307bf6,_0x55bdd5){_0x307bf6=_0x307bf6-0x0;var _0x2878fc=_0x24ca[_0x307bf6];return _0x2878fc;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa24c('0x1')]},'parent':{'type':Sequelize[_0xa24c('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xa24c('0x2')]},'joins':{'type':Sequelize[_0xa24c('0x2')]}};
\ No newline at end of file
index 0072409..13ce151 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1261=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','set','json','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','count','include','findAll','rows','show','length','includeAll','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','AVG(%s)','DATE(%s)','value','keyBy','select','order','%s.%s\x20=\x20%s.%s','clone','web','fullPath','randomstring','generate','output','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','../../components/export/','savename','COUNT(*)','run','runReport','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','Sequelize','debug'];(function(_0x25268a,_0xfb139f){var _0x2de4d3=function(_0x3c27a6){while(--_0x3c27a6){_0x25268a['push'](_0x25268a['shift']());}};_0x2de4d3(++_0xfb139f);}(_0x1261,0x144));var _0x1126=function(_0x43db86,_0x34184b){_0x43db86=_0x43db86-0x0;var _0x27bda2=_0x1261[_0x43db86];return _0x27bda2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];var dbH=require(_0x1126('0x17'))[_0x1126('0x18')];function respondWithStatusCode(_0xca0355,_0x3f10e9){_0x3f10e9=_0x3f10e9||0xcc;return function(_0xd8ca42){if(_0xd8ca42){return _0xca0355[_0x1126('0x19')](_0x3f10e9);}return _0xca0355[_0x1126('0x1a')](_0x3f10e9)['end']();};}function respondWithResult(_0x5de9a7,_0x1af673){_0x1af673=_0x1af673||0xc8;return function(_0x154e20){if(_0x154e20){return _0x5de9a7[_0x1126('0x1a')](_0x1af673)['json'](_0x154e20);}};}function respondWithFilteredResult(_0x45149c,_0x4794a7){return function(_0x35fe9f){if(_0x35fe9f){var _0x42f379=typeof _0x4794a7[_0x1126('0x1b')]==='undefined'&&typeof _0x4794a7[_0x1126('0x1c')]===_0x1126('0x1d');var _0x4a7b49=_0x35fe9f['count'];var _0x22ae0b=_0x42f379?0x0:_0x4794a7[_0x1126('0x1b')];var _0x58d11a=_0x42f379?_0x35fe9f['count']:_0x4794a7[_0x1126('0x1b')]+_0x4794a7['limit'];var _0x22ed37;if(_0x58d11a>=_0x4a7b49){_0x58d11a=_0x4a7b49;_0x22ed37=0xc8;}else{_0x22ed37=0xce;}_0x45149c[_0x1126('0x1a')](_0x22ed37);return _0x45149c[_0x1126('0x1e')]('Content-Range',_0x22ae0b+'-'+_0x58d11a+'/'+_0x4a7b49)[_0x1126('0x1f')](_0x35fe9f);}return null;};}function patchUpdates(_0x49d209){return function(_0x56efeb){try{jsonpatch[_0x1126('0x20')](_0x56efeb,_0x49d209,!![]);}catch(_0x3a9bed){return BPromise[_0x1126('0x21')](_0x3a9bed);}return _0x56efeb[_0x1126('0x22')]();};}function saveUpdates(_0x526ca1,_0x29ab60){return function(_0x477e6a){if(_0x477e6a){return _0x477e6a['update'](_0x526ca1)[_0x1126('0x23')](function(_0x59cd8e){return _0x59cd8e;});}return null;};}function removeEntity(_0x529dd9,_0x4b57ab){return function(_0x2199d9){if(_0x2199d9){return _0x2199d9[_0x1126('0x24')]()[_0x1126('0x23')](function(){var _0x34bcf1=_0x2199d9[_0x1126('0x25')]({'plain':!![]});var _0x1b07a7=_0x1126('0x26');return db[_0x1126('0x27')]['destroy']({'where':{'type':_0x1b07a7,'resourceId':_0x34bcf1['id']}})[_0x1126('0x23')](function(){return _0x2199d9;});})[_0x1126('0x23')](function(){_0x529dd9[_0x1126('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541bc9,_0xeb7d89){return function(_0x39bf0e){if(!_0x39bf0e){_0x541bc9['sendStatus'](0x194);}return _0x39bf0e;};}function handleError(_0x2fb797,_0x23d2bc){_0x23d2bc=_0x23d2bc||0x1f4;return function(_0x4a334a){logger[_0x1126('0x28')](_0x4a334a['stack']);if(_0x4a334a[_0x1126('0x29')]){delete _0x4a334a['name'];}_0x2fb797[_0x1126('0x1a')](_0x23d2bc)['send'](_0x4a334a);};}exports[_0x1126('0x2a')]=function(_0x5f2611,_0x5252e0){var _0x4a53ab={},_0x17646e={},_0xa8906d={'count':0x0,'rows':[]};var _0x1cef48=_['map'](db[_0x1126('0x2b')][_0x1126('0x2c')],function(_0x56f7f8){return{'name':_0x56f7f8[_0x1126('0x2d')],'type':_0x56f7f8[_0x1126('0x2e')][_0x1126('0x2f')]};});_0x17646e[_0x1126('0x30')]=_['map'](_0x1cef48,'name');_0x17646e[_0x1126('0x31')]=_[_0x1126('0x32')](_0x5f2611[_0x1126('0x31')]);_0x17646e[_0x1126('0x33')]=_['intersection'](_0x17646e[_0x1126('0x30')],_0x17646e[_0x1126('0x31')]);_0x4a53ab[_0x1126('0x34')]=_[_0x1126('0x35')](_0x17646e[_0x1126('0x30')],qs['fields'](_0x5f2611[_0x1126('0x31')][_0x1126('0x36')]));_0x4a53ab[_0x1126('0x34')]=_0x4a53ab[_0x1126('0x34')]['length']?_0x4a53ab['attributes']:_0x17646e[_0x1126('0x30')];if(!_0x5f2611[_0x1126('0x31')]['hasOwnProperty'](_0x1126('0x37'))){_0x4a53ab[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x5f2611['query']['limit']);_0x4a53ab[_0x1126('0x1b')]=qs[_0x1126('0x1b')](_0x5f2611[_0x1126('0x31')][_0x1126('0x1b')]);}_0x4a53ab['order']=qs[_0x1126('0x38')](_0x5f2611['query'][_0x1126('0x38')]);_0x4a53ab[_0x1126('0x39')]=qs[_0x1126('0x33')](_[_0x1126('0x3a')](_0x5f2611[_0x1126('0x31')],_0x17646e['filters']),_0x1cef48);if(_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]){_0x4a53ab[_0x1126('0x39')]=_[_0x1126('0x3c')](_0x4a53ab[_0x1126('0x39')],{'$or':_[_0x1126('0x3d')](_0x1cef48,function(_0x3052f9){if(_0x3052f9['type']!==_0x1126('0x3e')){var _0x154c28={};_0x154c28[_0x3052f9[_0x1126('0x29')]]={'$like':'%'+_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]+'%'};return _0x154c28;}})});}_0x4a53ab=_['merge']({},_0x4a53ab,_0x5f2611['options']);var _0x1c4f06={'where':_0x4a53ab[_0x1126('0x39')]};return db[_0x1126('0x2b')][_0x1126('0x3f')](_0x1c4f06)[_0x1126('0x23')](function(_0x276fd5){_0xa8906d['count']=_0x276fd5;if(_0x5f2611['query']['includeAll']){_0x4a53ab[_0x1126('0x40')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x1126('0x41')](_0x4a53ab);})[_0x1126('0x23')](function(_0x3584a3){_0xa8906d[_0x1126('0x42')]=_0x3584a3;return _0xa8906d;})['then'](respondWithFilteredResult(_0x5252e0,_0x4a53ab))['catch'](handleError(_0x5252e0,null));};exports[_0x1126('0x43')]=function(_0xa93167,_0x1d63b9){var _0x5f5d3a={'raw':!![],'where':{'id':_0xa93167['params']['id']}},_0x2f8551={};_0x2f8551[_0x1126('0x30')]=_['keys'](db[_0x1126('0x2b')][_0x1126('0x2c')]);_0x2f8551[_0x1126('0x31')]=_['keys'](_0xa93167[_0x1126('0x31')]);_0x2f8551[_0x1126('0x33')]=_[_0x1126('0x35')](_0x2f8551['model'],_0x2f8551['query']);_0x5f5d3a['attributes']=_[_0x1126('0x35')](_0x2f8551['model'],qs[_0x1126('0x36')](_0xa93167['query'][_0x1126('0x36')]));_0x5f5d3a[_0x1126('0x34')]=_0x5f5d3a[_0x1126('0x34')][_0x1126('0x44')]?_0x5f5d3a[_0x1126('0x34')]:_0x2f8551['model'];if(_0xa93167[_0x1126('0x31')][_0x1126('0x45')]){_0x5f5d3a['include']=[{'all':!![]}];}_0x5f5d3a=_[_0x1126('0x3c')]({},_0x5f5d3a,_0xa93167[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x5f5d3a)[_0x1126('0x23')](handleEntityNotFound(_0x1d63b9,null))['then'](respondWithResult(_0x1d63b9,null))[_0x1126('0x48')](handleError(_0x1d63b9,null));};exports[_0x1126('0x49')]=function(_0x213a76,_0x59656d){return db[_0x1126('0x2b')][_0x1126('0x49')](_0x213a76[_0x1126('0x4a')],{})[_0x1126('0x23')](function(_0x224456){var _0x2081f2=_0x213a76[_0x1126('0x4b')][_0x1126('0x25')]({'plain':!![]});if(!_0x2081f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2081f2[_0x1126('0x4c')]==='user'){var _0x40168e=_0x224456[_0x1126('0x25')]({'plain':!![]});var _0x4a1831='Reports';return db[_0x1126('0x4d')][_0x1126('0x47')]({'where':{'name':_0x4a1831,'userProfileId':_0x2081f2[_0x1126('0x4e')]},'raw':!![]})['then'](function(_0x3cb44c){if(_0x3cb44c&&_0x3cb44c[_0x1126('0x4f')]===0x0){return db[_0x1126('0x27')][_0x1126('0x49')]({'name':_0x40168e['name'],'resourceId':_0x40168e['id'],'type':_0x1126('0x26'),'sectionId':_0x3cb44c['id']},{})[_0x1126('0x23')](function(){return _0x224456;});}else{return _0x224456;}})['catch'](function(_0x4bcc08){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bcc08);throw _0x4bcc08;});}return _0x224456;})[_0x1126('0x23')](respondWithResult(_0x59656d,0xc9))[_0x1126('0x48')](handleError(_0x59656d,null));};exports['update']=function(_0x16552b,_0x1c7a2b){if(_0x16552b[_0x1126('0x4a')]['id']){delete _0x16552b[_0x1126('0x4a')]['id'];}return db[_0x1126('0x2b')]['find']({'where':{'id':_0x16552b[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x1c7a2b,null))['then'](saveUpdates(_0x16552b[_0x1126('0x4a')],null))[_0x1126('0x23')](respondWithResult(_0x1c7a2b,null))[_0x1126('0x48')](handleError(_0x1c7a2b,null));};exports[_0x1126('0x24')]=function(_0xc8a0f,_0x59c3d0){return db[_0x1126('0x2b')]['find']({'where':{'id':_0xc8a0f[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x59c3d0,null))[_0x1126('0x23')](removeEntity(_0x59c3d0,null))['catch'](handleError(_0x59c3d0,null));};exports[_0x1126('0x51')]=function(_0x2340f8,_0x5763b4){var _0x30812d=0xa;var _0x25038f=[_0x1126('0x52'),'left_join',_0x1126('0x53'),_0x1126('0x54')];var _0x22ab18={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x2a5422={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':'DATE(%s)','HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3767e4=function(_0x5246aa){return!_[_0x1126('0x60')]([_0x1126('0x61'),'IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0x5246aa);};var _0x375b76=function(_0x592960){if(!_0x592960||!_0x592960[_0x1126('0x64')]['length']){return'';}for(var _0x558b6e='(',_0xbdc58=0x0;_0xbdc58<_0x592960[_0x1126('0x64')][_0x1126('0x44')];_0xbdc58+=0x1){_0xbdc58>0x0&&(_0x558b6e+='\x20'+_0x592960[_0x1126('0x65')]+'\x20');_0x558b6e+=_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x66')]?_0x375b76(_0x592960[_0x1126('0x64')][_0xbdc58]['group']):_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x67')]+'\x20'+_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')]+(_0x3767e4(_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')])?'\x20'+_0x592960['rules'][_0xbdc58]['value']:'');}return _0x558b6e+')';};var _0x16a343={'where':{'id':_0x2340f8[_0x1126('0x50')]['id']}},_0x3921c2,_0x4bf2b3,_0x5ee130,_0x5e9260,_0x51a28d;_0x16a343=_[_0x1126('0x3c')]({},_0x16a343,_0x2340f8[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x16a343)[_0x1126('0x23')](function(_0x170bf0){if(_0x170bf0){_0x3921c2=_0x170bf0;return _0x170bf0[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x3f007b){if(_0x3f007b){if(!_0x3f007b[_0x1126('0x44')]){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4bf2b3=_0x3f007b;return db[_0x1126('0x6c')][_0x1126('0x41')]({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x56c003){if(_0x56c003){_0x5ee130=_['keyBy'](_0x56c003,'id');var _0x15cf3d;var _0x2643d7=squel['select']();_0x2643d7[_0x1126('0x6d')](_0x3921c2[_0x1126('0x6e')]);for(var _0x366675=0x0;_0x366675<_0x4bf2b3[_0x1126('0x44')];_0x366675+=0x1){_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x6f')]?_0x5ee130[_0x4bf2b3[_0x366675][_0x1126('0x6f')]][_0x1126('0x70')]:_0x4bf2b3[_0x366675][_0x1126('0x67')];_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x71')]?_[_0x1126('0x72')](_0x22ab18[_0x4bf2b3[_0x366675][_0x1126('0x71')]],'%s',_0x15cf3d):_0x15cf3d;_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x73')]?_[_0x1126('0x72')](_0x2a5422[_0x4bf2b3[_0x366675]['format']],'%s',_0x15cf3d):_0x15cf3d;if(_0x4bf2b3[_0x366675][_0x1126('0x74')]){_0x2643d7[_0x1126('0x66')](_0x15cf3d);}_0x4bf2b3[_0x366675][_0x1126('0x75')]&&_0x2643d7['order'](_0x15cf3d,_0x4bf2b3[_0x366675]['orderBy']===_0x1126('0x76')?![]:!![]);_0x2643d7[_0x1126('0x67')](_0x15cf3d,_0x4bf2b3[_0x366675][_0x1126('0x77')]||_0x15cf3d);}if(_0x3921c2[_0x1126('0x78')]){_0x3921c2['joins']=JSON['parse'](_0x3921c2['joins']);for(var _0x79afca=0x0;_0x79afca<_0x3921c2[_0x1126('0x78')][_0x1126('0x44')];_0x79afca+=0x1){if(_0x3921c2[_0x1126('0x78')][_0x79afca]['type']&&_[_0x1126('0x60')](_0x25038f,_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')])&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x79')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7b')]){_0x2643d7[_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')]](_0x3921c2['joins'][_0x79afca][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x3921c2[_0x1126('0x6e')],_0x3921c2[_0x1126('0x78')][_0x79afca]['parentKey'],_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')],_0x3921c2['joins'][_0x79afca]['foreignKey']));}}}if(_0x3921c2[_0x1126('0x7c')]){_0x3921c2[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x3921c2['conditions']);_0x2643d7['where'](_0x375b76(_0x3921c2['conditions'][_0x1126('0x66')]));}_0x51a28d=_0x2643d7['clone']();_0x2643d7['limit'](_0x30812d);_0x2643d7[_0x1126('0x1b')](0x0);logger['debug'](_0x1126('0x7e'),_0x2643d7[_0x1126('0x7f')]());return dbH['sequelize'][_0x1126('0x31')](_0x2643d7[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](respondWithResult(_0x5763b4,null))[_0x1126('0x48')](handleError(_0x5763b4,null));};function runReport(_0x426faa,_0x5679ec,_0xd182b1){var _0x2d6fcf=_0x5679ec[_0x1126('0x29')];var _0x2af2d0=0xa;var _0x2598a7=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x9a2af0={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':_0x1126('0x84'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x33cccf={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':'HOUR(%s)','ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5bdb30=function(_0xb1199b){return!_[_0x1126('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0xb1199b);};var _0x228552=function(_0x1ee970){if(!_0x1ee970||!_0x1ee970[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x2d7150='(',_0x35a9a4=0x0;_0x35a9a4<_0x1ee970[_0x1126('0x64')]['length'];_0x35a9a4+=0x1){_0x35a9a4>0x0&&(_0x2d7150+='\x20'+_0x1ee970[_0x1126('0x65')]+'\x20');_0x2d7150+=_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]?_0x228552(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]):_0x1ee970[_0x1126('0x64')][_0x35a9a4]['field']+'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')]+(_0x5bdb30(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')])?'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x86')]:'');}return _0x2d7150+')';};var _0x2418ca={'where':{'id':_0x426faa['id']}},_0x2d2dfc,_0x38eac6,_0xc3503b,_0x5d6edb,_0x50238d;_0x2418ca=_[_0x1126('0x3c')]({},_0x2418ca,_0xd182b1);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x2418ca)['then'](function(_0x4461ae){if(_0x4461ae){_0x2d2dfc=_0x4461ae;return _0x4461ae['getFields']();}return null;})[_0x1126('0x23')](function(_0x4fbd44){if(_0x4fbd44){if(!_0x4fbd44['length']){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x38eac6=_0x4fbd44;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0xe2f82d){if(_0xe2f82d){_0xc3503b=_[_0x1126('0x87')](_0xe2f82d,'id');var _0x5dfb8f;var _0x48f914=squel[_0x1126('0x88')]();_0x48f914['from'](_0x2d2dfc[_0x1126('0x6e')]);for(var _0x39d9a0=0x0;_0x39d9a0<_0x38eac6[_0x1126('0x44')];_0x39d9a0+=0x1){_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x6f')]?_0xc3503b[_0x38eac6[_0x39d9a0][_0x1126('0x6f')]]['metric']:_0x38eac6[_0x39d9a0]['field'];_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x71')]?_[_0x1126('0x72')](_0x9a2af0[_0x38eac6[_0x39d9a0][_0x1126('0x71')]],'%s',_0x5dfb8f):_0x5dfb8f;_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x73')]?_[_0x1126('0x72')](_0x33cccf[_0x38eac6[_0x39d9a0][_0x1126('0x73')]],'%s',_0x5dfb8f):_0x5dfb8f;if(_0x38eac6[_0x39d9a0][_0x1126('0x74')]){_0x48f914[_0x1126('0x66')](_0x5dfb8f);}_0x38eac6[_0x39d9a0][_0x1126('0x75')]&&_0x48f914[_0x1126('0x89')](_0x5dfb8f,_0x38eac6[_0x39d9a0][_0x1126('0x75')]==='DESC'?![]:!![]);_0x48f914[_0x1126('0x67')](_0x5dfb8f,_0x38eac6[_0x39d9a0]['alias']||_0x5dfb8f);}if(_0x2d2dfc[_0x1126('0x78')]){_0x2d2dfc['joins']=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x78')]);for(var _0x215d4d=0x0;_0x215d4d<_0x2d2dfc[_0x1126('0x78')]['length'];_0x215d4d+=0x1){if(_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x2e')]&&_['includes'](_0x2598a7,_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x2e')])&&_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x79')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7a')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7b')]){_0x48f914[_0x2d2dfc[_0x1126('0x78')][_0x215d4d]['type']](_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],null,util[_0x1126('0x73')](_0x1126('0x8a'),_0x2d2dfc[_0x1126('0x6e')],_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x79')],_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],_0x2d2dfc['joins'][_0x215d4d]['foreignKey']));}}}if(_0x2d2dfc['conditions']){_0x2d2dfc[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x7c')]);_0x48f914[_0x1126('0x39')](_0x228552(_0x2d2dfc['conditions'][_0x1126('0x66')]));}_0x50238d=_0x48f914[_0x1126('0x8b')]();_0x48f914[_0x1126('0x1c')](_0x2af2d0);_0x48f914[_0x1126('0x1b')](0x0);return;}})[_0x1126('0x23')](function(){if(_0x5679ec['output']===_0x1126('0x8c')){return null;}var _0x21c487=_['merge'](_0x5679ec,{'name':_0x5679ec[_0x1126('0x8d')]||_0x5679ec['name']||_0x2d2dfc['name'],'basename':_0x2d6fcf,'savename':util[_0x1126('0x73')]('%s-%s.%s',_0x5679ec[_0x1126('0x29')]||_0x2d2dfc[_0x1126('0x29')],require(_0x1126('0x8e'))[_0x1126('0x8f')](0x4),_0x5679ec[_0x1126('0x90')]||_0x1126('0x91')),'reportId':_0x2d2dfc['id'],'reportType':_0x1126('0x92')});return db[_0x1126('0x93')][_0x1126('0x49')](_0x21c487,{'raw':!![]});})['then'](function(_0x2577f5){if(_0x2d2dfc[_0x1126('0x6e')]===_0x1126('0x94')){_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+_0x1126('0x95'),_0x5679ec[_0x1126('0x96')],_0x5679ec[_0x1126('0x97')]);}else{_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5679ec['startDate'],_0x5679ec[_0x1126('0x97')]);}if(_0x2577f5){logger['info'](_0x1126('0x98'),_0x50238d[_0x1126('0x7f')]());require('child_process')['fork'](path[_0x1126('0x52')](__dirname,_0x1126('0x99'),_0x2577f5['output']),[_0x2577f5['id'],_0x50238d[_0x1126('0x7f')](),path[_0x1126('0x52')](__dirname,'../../files/reports',_0x2577f5[_0x1126('0x9a')]),_0x2d6fcf]);return _0x2577f5;}else{var _0x4a9941=squel[_0x1126('0x88')]();_0x4a9941[_0x1126('0x6d')]('('+_0x50238d[_0x1126('0x7f')]()+')','countTable');_0x4a9941[_0x1126('0x67')](_0x1126('0x9b'),_0x1126('0x3f'));_0x50238d[_0x1126('0x1c')](_0x5679ec[_0x1126('0x1c')]||_0x2af2d0);_0x50238d[_0x1126('0x1b')](_0x5679ec[_0x1126('0x1b')]||0x0);return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x4a9941[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]})[_0x1126('0x23')](function(_0x12ffa5){if(!_0x12ffa5[_0x1126('0x44')]){_0x5d6edb=0x0;}else{_0x5d6edb=_0x12ffa5[0x0][_0x1126('0x3f')]||0x0;}return dbH['sequelize'][_0x1126('0x31')](_0x50238d[_0x1126('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x1126('0x82')]});})[_0x1126('0x23')](function(_0x35065c){return{'rows':_0x35065c||[],'count':_0x5d6edb};});}});}exports[_0x1126('0x9c')]=function(_0x5c0215,_0x444f94){return runReport(_0x5c0215[_0x1126('0x50')],_0x5c0215['query'],_0x5c0215[_0x1126('0x46')])['then'](respondWithResult(_0x444f94,null))[_0x1126('0x48')](handleError(_0x444f94,null));};exports[_0x1126('0x9d')]=runReport;exports['query']=function(_0x4d43ad,_0xa02d9e){var _0x548f9e=0xa;var _0x5edb83=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x4f29ce={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':'MIN(%s)','AVG':_0x1126('0x84'),'GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x17b25d={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':_0x1126('0x9e')};var _0x3a4a91=function(_0x55145f){return!_[_0x1126('0x60')](['IS\x20NULL',_0x1126('0x9f'),_0x1126('0x62'),_0x1126('0x63')],_0x55145f);};var _0x4c7dc7=function(_0x33a27b){if(!_0x33a27b||!_0x33a27b[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x578c1b='(',_0x1562b2=0x0;_0x1562b2<_0x33a27b[_0x1126('0x64')][_0x1126('0x44')];_0x1562b2+=0x1){_0x1562b2>0x0&&(_0x578c1b+='\x20'+_0x33a27b[_0x1126('0x65')]+'\x20');_0x578c1b+=_0x33a27b[_0x1126('0x64')][_0x1562b2]['group']?_0x4c7dc7(_0x33a27b['rules'][_0x1562b2][_0x1126('0x66')]):_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x67')]+'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')]+(_0x3a4a91(_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')])?'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x86')]:'');}return _0x578c1b+')';};var _0x2fb228={'where':{'id':_0x4d43ad[_0x1126('0x50')]['id']}},_0x2c95b6,_0x4a4b43,_0x588f4f,_0x5ac4d6,_0x1168a5;_0x2fb228=_['merge']({},_0x2fb228,_0x4d43ad['options']);return db[_0x1126('0x2b')][_0x1126('0x47')](_0x2fb228)[_0x1126('0x23')](function(_0x48b088){if(_0x48b088){_0x2c95b6=_0x48b088;return _0x48b088[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x5a28f9){if(_0x5a28f9){if(!_0x5a28f9[_0x1126('0x44')]){throw new db[(_0x1126('0xa0'))][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4a4b43=_0x5a28f9;return db[_0x1126('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x1140ec){if(_0x1140ec){_0x588f4f=_['keyBy'](_0x1140ec,'id');var _0x578f5c;var _0x559dae=squel[_0x1126('0x88')]();_0x559dae[_0x1126('0x6d')](_0x2c95b6[_0x1126('0x6e')]);for(var _0x9d7819=0x0;_0x9d7819<_0x4a4b43[_0x1126('0x44')];_0x9d7819+=0x1){_0x578f5c=_0x4a4b43[_0x9d7819]['MetricId']?_0x588f4f[_0x4a4b43[_0x9d7819][_0x1126('0x6f')]]['metric']:_0x4a4b43[_0x9d7819][_0x1126('0x67')];_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x71')]?_['replace'](_0x4f29ce[_0x4a4b43[_0x9d7819]['function']],'%s',_0x578f5c):_0x578f5c;_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x73')]?_[_0x1126('0x72')](_0x17b25d[_0x4a4b43[_0x9d7819]['format']],'%s',_0x578f5c):_0x578f5c;if(_0x4a4b43[_0x9d7819]['groupBy']){_0x559dae[_0x1126('0x66')](_0x578f5c);}_0x4a4b43[_0x9d7819][_0x1126('0x75')]&&_0x559dae[_0x1126('0x89')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x75')]===_0x1126('0x76')?![]:!![]);_0x559dae[_0x1126('0x67')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x77')]||_0x578f5c);}if(_0x2c95b6[_0x1126('0x78')]){_0x2c95b6[_0x1126('0x78')]=JSON[_0x1126('0x7d')](_0x2c95b6['joins']);for(var _0x4d6528=0x0;_0x4d6528<_0x2c95b6[_0x1126('0x78')][_0x1126('0x44')];_0x4d6528+=0x1){if(_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x2e')]&&_[_0x1126('0x60')](_0x5edb83,_0x2c95b6[_0x1126('0x78')][_0x4d6528]['type'])&&_0x2c95b6['joins'][_0x4d6528][_0x1126('0x79')]&&_0x2c95b6['joins'][_0x4d6528]['foreignTable']&&_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]){_0x559dae[_0x2c95b6['joins'][_0x4d6528][_0x1126('0x2e')]](_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x2c95b6[_0x1126('0x6e')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x79')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]));}}}if(_0x2c95b6['conditions']){_0x2c95b6[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2c95b6[_0x1126('0x7c')]);_0x559dae[_0x1126('0x39')](_0x4c7dc7(_0x2c95b6['conditions'][_0x1126('0x66')]));}_0x1168a5=_0x559dae[_0x1126('0x8b')]();_0x559dae['limit'](_0x548f9e);_0x559dae[_0x1126('0x1b')](0x0);logger[_0x1126('0xa1')](_0x1126('0x7e'),_0x559dae['toString']());return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x559dae[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](function(){return{'sql':_0x1168a5[_0x1126('0x7f')]()};})[_0x1126('0x23')](respondWithResult(_0xa02d9e,null))['catch'](handleError(_0xa02d9e,null));};
\ No newline at end of file
+var _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x1a809b,_0x4c15e3){var _0x5d90e6=function(_0x5dd2e1){while(--_0x5dd2e1){_0x1a809b['push'](_0x1a809b['shift']());}};_0x5d90e6(++_0x4c15e3);}(_0xba34,0x119));var _0x4ba3=function(_0x16efae,_0x5a1028){_0x16efae=_0x16efae-0x0;var _0x4ec3f8=_0xba34[_0x16efae];return _0x4ec3f8;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));};
\ No newline at end of file
index 07159b7..543e281 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9024=['exports','define','AnalyticDefaultReport','analytics_default_reports','util','api','bluebird','request-promise','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x4f67b1,_0x3a0687){var _0x14f149=function(_0x197ef8){while(--_0x197ef8){_0x4f67b1['push'](_0x4f67b1['shift']());}};_0x14f149(++_0x3a0687);}(_0x9024,0x86));var _0x4902=function(_0x87639d,_0x55f69e){_0x87639d=_0x87639d-0x0;var _0x3b498f=_0x9024[_0x87639d];return _0x3b498f;};'use strict';var _=require('lodash');var util=require(_0x4902('0x0'));var logger=require('../../config/logger')(_0x4902('0x1'));var moment=require('moment');var BPromise=require(_0x4902('0x2'));var rp=require(_0x4902('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4902('0x4'));var attributes=require(_0x4902('0x5'));module[_0x4902('0x6')]=function(_0x501c9d,_0x471bc9){return _0x501c9d[_0x4902('0x7')](_0x4902('0x8'),attributes,{'tableName':_0x4902('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd34c=['api','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger'];(function(_0x316e37,_0x18d710){var _0x1f0fa0=function(_0x429122){while(--_0x429122){_0x316e37['push'](_0x316e37['shift']());}};_0x1f0fa0(++_0x18d710);}(_0xd34c,0xda));var _0xcd34=function(_0x30b024,_0x2c7c96){_0x30b024=_0x30b024-0x0;var _0xa3bc24=_0xd34c[_0x30b024];return _0xa3bc24;};'use strict';var _=require('lodash');var util=require(_0xcd34('0x0'));var logger=require(_0xcd34('0x1'))(_0xcd34('0x2'));var moment=require('moment');var BPromise=require(_0xcd34('0x3'));var rp=require(_0xcd34('0x4'));var fs=require('fs');var path=require(_0xcd34('0x5'));var rimraf=require(_0xcd34('0x6'));var config=require('../../config/environment');var attributes=require(_0xcd34('0x7'));module['exports']=function(_0xd032b4,_0x58a0fe){return _0xd032b4['define'](_0xcd34('0x8'),attributes,{'tableName':_0xcd34('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index a16ecd5..ed5c544 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xda0b=['info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','request\x20sent','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then'];(function(_0x3f6fbc,_0x1ba4b9){var _0x25f484=function(_0x5ba19a){while(--_0x5ba19a){_0x3f6fbc['push'](_0x3f6fbc['shift']());}};_0x25f484(++_0x1ba4b9);}(_0xda0b,0x72));var _0xbda0=function(_0xbb3f56,_0x209121){_0xbb3f56=_0xbb3f56-0x0;var _0x433459=_0xda0b[_0xbb3f56];return _0x433459;};'use strict';var _=require(_0xbda0('0x0'));var util=require(_0xbda0('0x1'));var moment=require('moment');var BPromise=require(_0xbda0('0x2'));var rs=require(_0xbda0('0x3'));var fs=require('fs');var Redis=require(_0xbda0('0x4'));var db=require(_0xbda0('0x5'))['db'];var utils=require(_0xbda0('0x6'));var logger=require(_0xbda0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbda0('0x8'));var client=jayson[_0xbda0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25ef81,_0x3cd531,_0x1d612b){return new BPromise(function(_0x52ce08,_0xaaa730){return client[_0xbda0('0xa')](_0x25ef81,_0x1d612b)[_0xbda0('0xb')](function(_0xeb4e51){logger[_0xbda0('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3cd531,'request\x20sent');logger[_0xbda0('0xd')](_0xbda0('0xe'),_0x3cd531,'request\x20sent',JSON[_0xbda0('0xf')](_0xeb4e51));if(_0xeb4e51[_0xbda0('0x10')]){if(_0xeb4e51[_0xbda0('0x10')][_0xbda0('0x11')]===0x1f4){logger[_0xbda0('0x10')](_0xbda0('0x12'),_0x3cd531,_0xeb4e51[_0xbda0('0x10')][_0xbda0('0x13')]);return _0xaaa730(_0xeb4e51[_0xbda0('0x10')][_0xbda0('0x13')]);}logger[_0xbda0('0x10')](_0xbda0('0x12'),_0x3cd531,_0xeb4e51[_0xbda0('0x10')]['message']);return _0x52ce08(_0xeb4e51[_0xbda0('0x10')][_0xbda0('0x13')]);}else{logger[_0xbda0('0xc')](_0xbda0('0x12'),_0x3cd531,_0xbda0('0x14'));_0x52ce08(_0xeb4e51['result'][_0xbda0('0x13')]);}})['catch'](function(_0x45801c){logger[_0xbda0('0x10')](_0xbda0('0x12'),_0x3cd531,_0x45801c);_0xaaa730(_0x45801c);});});}
\ No newline at end of file
+var _0x890f=['AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x48cf09,_0x3b5f6c){var _0x203b57=function(_0x359da1){while(--_0x359da1){_0x48cf09['push'](_0x48cf09['shift']());}};_0x203b57(++_0x3b5f6c);}(_0x890f,0x158));var _0xf890=function(_0x58f457,_0x990c9b){_0x58f457=_0x58f457-0x0;var _0x2e8229=_0x890f[_0x58f457];return _0x2e8229;};'use strict';var _=require(_0xf890('0x0'));var util=require(_0xf890('0x1'));var moment=require(_0xf890('0x2'));var BPromise=require(_0xf890('0x3'));var rs=require(_0xf890('0x4'));var fs=require('fs');var Redis=require(_0xf890('0x5'));var db=require(_0xf890('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf890('0x7'))(_0xf890('0x8'));var config=require(_0xf890('0x9'));var jayson=require(_0xf890('0xa'));var client=jayson[_0xf890('0xb')][_0xf890('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d6834,_0x51a2a1,_0x9f6bb3){return new BPromise(function(_0x1e63a0,_0xb59dde){return client[_0xf890('0xd')](_0x1d6834,_0x9f6bb3)[_0xf890('0xe')](function(_0x24a564){logger[_0xf890('0xf')](_0xf890('0x10'),_0x51a2a1,_0xf890('0x11'));logger[_0xf890('0x12')](_0xf890('0x13'),_0x51a2a1,_0xf890('0x11'),JSON[_0xf890('0x14')](_0x24a564));if(_0x24a564[_0xf890('0x15')]){if(_0x24a564[_0xf890('0x15')]['code']===0x1f4){logger[_0xf890('0x15')](_0xf890('0x10'),_0x51a2a1,_0x24a564[_0xf890('0x15')][_0xf890('0x16')]);return _0xb59dde(_0x24a564['error'][_0xf890('0x16')]);}logger[_0xf890('0x15')](_0xf890('0x10'),_0x51a2a1,_0x24a564[_0xf890('0x15')]['message']);return _0x1e63a0(_0x24a564[_0xf890('0x15')][_0xf890('0x16')]);}else{logger[_0xf890('0xf')](_0xf890('0x10'),_0x51a2a1,_0xf890('0x11'));_0x1e63a0(_0x24a564['result']['message']);}})[_0xf890('0x17')](function(_0x188b48){logger[_0xf890('0x15')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x51a2a1,_0x188b48);_0xb59dde(_0x188b48);});});}
\ No newline at end of file
index 936c0cd..43b7f44 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6bec=['put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','index','/:id','show','get','/:id/preview','isAuthenticated','preview','run','/:id/query','query','post','create'];(function(_0x54ad36,_0x2dc425){var _0x3f9bef=function(_0x531671){while(--_0x531671){_0x54ad36['push'](_0x54ad36['shift']());}};_0x3f9bef(++_0x2dc425);}(_0x6bec,0x86));var _0xc6be=function(_0x167b32,_0x14d744){_0x167b32=_0x167b32-0x0;var _0x12df9c=_0x6bec[_0x167b32];return _0x12df9c;};'use strict';var multer=require(_0xc6be('0x0'));var util=require(_0xc6be('0x1'));var path=require(_0xc6be('0x2'));var timeout=require(_0xc6be('0x3'));var express=require('express');var router=express[_0xc6be('0x4')]();var fs_extra=require(_0xc6be('0x5'));var auth=require(_0xc6be('0x6'));var interaction=require(_0xc6be('0x7'));var config=require(_0xc6be('0x8'));var controller=require(_0xc6be('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xc6be('0xa')]);router['get'](_0xc6be('0xb'),auth['isAuthenticated'](),controller[_0xc6be('0xc')]);router[_0xc6be('0xd')](_0xc6be('0xe'),auth[_0xc6be('0xf')](),controller[_0xc6be('0x10')]);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0xc6be('0x11')]);router['get'](_0xc6be('0x12'),auth['isAuthenticated'](),controller[_0xc6be('0x13')]);router[_0xc6be('0x14')]('/',auth[_0xc6be('0xf')](),controller[_0xc6be('0x15')]);router[_0xc6be('0x16')](_0xc6be('0xb'),auth[_0xc6be('0xf')](),controller[_0xc6be('0x17')]);router[_0xc6be('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xc6be('0x19')]);module['exports']=router;
\ No newline at end of file
+var _0x1509=['get','/:id','show','preview','run','/:id/query','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x1509,0x15c));var _0x9150=function(_0x4a9b39,_0x4d5287){_0x4a9b39=_0x4a9b39-0x0;var _0x5a38c7=_0x1509[_0x4a9b39];return _0x5a38c7;};'use strict';var multer=require(_0x9150('0x0'));var util=require(_0x9150('0x1'));var path=require(_0x9150('0x2'));var timeout=require(_0x9150('0x3'));var express=require('express');var router=express[_0x9150('0x4')]();var fs_extra=require(_0x9150('0x5'));var auth=require(_0x9150('0x6'));var interaction=require(_0x9150('0x7'));var config=require(_0x9150('0x8'));var controller=require(_0x9150('0x9'));router['get']('/',auth[_0x9150('0xa')](),controller[_0x9150('0xb')]);router[_0x9150('0xc')](_0x9150('0xd'),auth['isAuthenticated'](),controller[_0x9150('0xe')]);router[_0x9150('0xc')]('/:id/preview',auth['isAuthenticated'](),controller[_0x9150('0xf')]);router[_0x9150('0xc')]('/:id/run',auth[_0x9150('0xa')](),controller[_0x9150('0x10')]);router[_0x9150('0xc')](_0x9150('0x11'),auth[_0x9150('0xa')](),controller['query']);router[_0x9150('0x12')]('/',auth['isAuthenticated'](),controller[_0x9150('0x13')]);router[_0x9150('0x14')](_0x9150('0xd'),auth[_0x9150('0xa')](),controller['update']);router[_0x9150('0x15')](_0x9150('0xd'),auth['isAuthenticated'](),controller[_0x9150('0x16')]);module[_0x9150('0x17')]=router;
\ No newline at end of file
index e5c9cdf..68cc243 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbc6a=['DATE','manual','scheduled','INTEGER','moment','STRING','ENUM','pdf','xlsx'];(function(_0x320d52,_0x3b7849){var _0x5457fb=function(_0x2d0a7e){while(--_0x2d0a7e){_0x320d52['push'](_0x320d52['shift']());}};_0x5457fb(++_0x3b7849);}(_0xbc6a,0x16c));var _0xabc6=function(_0xdf913e,_0x480c14){_0xdf913e=_0xdf913e-0x0;var _0x582abc=_0xbc6a[_0xdf913e];return _0x582abc;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xabc6('0x0'));module['exports']={'name':{'type':Sequelize[_0xabc6('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xabc6('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0xabc6('0x2')]('csv',_0xabc6('0x3'),_0xabc6('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xabc6('0x1')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xabc6('0x5')]},'status':{'type':Sequelize[_0xabc6('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0xabc6('0x6'),_0xabc6('0x7')),'allowNull':![],'defaultValue':_0xabc6('0x6')},'reportId':{'type':Sequelize[_0xabc6('0x8')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xabc6('0x1')]}};
\ No newline at end of file
+var _0xcb7b=['exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','scheduled','manual','UNSIGNED','moment'];(function(_0x5e717f,_0x12aa04){var _0xd7684c=function(_0x101e25){while(--_0x101e25){_0x5e717f['push'](_0x5e717f['shift']());}};_0xd7684c(++_0x12aa04);}(_0xcb7b,0x1df));var _0xbcb7=function(_0x2af9bb,_0x5e454b){_0x2af9bb=_0x2af9bb-0x0;var _0x3ea54b=_0xcb7b[_0x2af9bb];return _0x3ea54b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xbcb7('0x0'));module[_0xbcb7('0x1')]={'name':{'type':Sequelize[_0xbcb7('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xbcb7('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xbcb7('0x3')](_0xbcb7('0x4'),_0xbcb7('0x5'),_0xbcb7('0x6')),'allowNull':![],'defaultValue':_0xbcb7('0x4')},'savename':{'type':Sequelize[_0xbcb7('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xbcb7('0x7')]},'endDate':{'type':Sequelize[_0xbcb7('0x7')]},'status':{'type':Sequelize[_0xbcb7('0x2')],'defaultValue':_0xbcb7('0x8')},'type':{'type':Sequelize['ENUM']('manual',_0xbcb7('0x9')),'allowNull':![],'defaultValue':_0xbcb7('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xbcb7('0xb')]},'reportType':{'type':Sequelize[_0xbcb7('0x2')]}};
\ No newline at end of file
index f79ed6c..c58c807 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x96ab=['rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','name','filter','options','AnalyticExtractedReport','includeAll','catch','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','savename','output','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','error','send','index','map'];(function(_0x3b80c5,_0x1aad75){var _0x59d044=function(_0x40fcfb){while(--_0x40fcfb){_0x3b80c5['push'](_0x3b80c5['shift']());}};_0x59d044(++_0x1aad75);}(_0x96ab,0x95));var _0xb96a=function(_0x1d0cd7,_0x215fc7){_0x1d0cd7=_0x1d0cd7-0x0;var _0x29e0ac=_0x96ab[_0x1d0cd7];return _0x29e0ac;};'use strict';var emlformat=require(_0xb96a('0x0'));var rimraf=require(_0xb96a('0x1'));var zipdir=require(_0xb96a('0x2'));var jsonpatch=require(_0xb96a('0x3'));var rp=require(_0xb96a('0x4'));var moment=require(_0xb96a('0x5'));var BPromise=require(_0xb96a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb96a('0x7'));var sox=require(_0xb96a('0x8'));var csv=require(_0xb96a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb96a('0xa'));var _=require(_0xb96a('0xb'));var squel=require('squel');var crypto=require(_0xb96a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb96a('0xd'));var toCsv=require(_0xb96a('0x9'));var querystring=require(_0xb96a('0xe'));var Papa=require(_0xb96a('0xf'));var Redis=require('ioredis');var authService=require(_0xb96a('0x10'));var qs=require(_0xb96a('0x11'));var as=require(_0xb96a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb96a('0x13'))(_0xb96a('0x14'));var utils=require(_0xb96a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb96a('0x16'));var db=require(_0xb96a('0x17'))['db'];function respondWithStatusCode(_0x4a90ea,_0xc1fe6b){_0xc1fe6b=_0xc1fe6b||0xcc;return function(_0x40c57e){if(_0x40c57e){return _0x4a90ea[_0xb96a('0x18')](_0xc1fe6b);}return _0x4a90ea[_0xb96a('0x19')](_0xc1fe6b)[_0xb96a('0x1a')]();};}function respondWithResult(_0x1aac9d,_0x1acda6){_0x1acda6=_0x1acda6||0xc8;return function(_0x4c95c5){if(_0x4c95c5){return _0x1aac9d[_0xb96a('0x19')](_0x1acda6)[_0xb96a('0x1b')](_0x4c95c5);}};}function respondWithFilteredResult(_0x4f0214,_0x5bca40){return function(_0x107151){if(_0x107151){var _0x1d8cab=typeof _0x5bca40[_0xb96a('0x1c')]===_0xb96a('0x1d')&&typeof _0x5bca40['limit']===_0xb96a('0x1d');var _0x1cedc0=_0x107151['count'];var _0xbe9da9=_0x1d8cab?0x0:_0x5bca40[_0xb96a('0x1c')];var _0x16ff7c=_0x1d8cab?_0x107151[_0xb96a('0x1e')]:_0x5bca40[_0xb96a('0x1c')]+_0x5bca40['limit'];var _0x22c536;if(_0x16ff7c>=_0x1cedc0){_0x16ff7c=_0x1cedc0;_0x22c536=0xc8;}else{_0x22c536=0xce;}_0x4f0214[_0xb96a('0x19')](_0x22c536);return _0x4f0214[_0xb96a('0x1f')](_0xb96a('0x20'),_0xbe9da9+'-'+_0x16ff7c+'/'+_0x1cedc0)['json'](_0x107151);}return null;};}function patchUpdates(_0xa54c3e){return function(_0x2210de){try{jsonpatch[_0xb96a('0x21')](_0x2210de,_0xa54c3e,!![]);}catch(_0x4858f8){return BPromise[_0xb96a('0x22')](_0x4858f8);}return _0x2210de[_0xb96a('0x23')]();};}function saveUpdates(_0x455de3,_0x3ae9c3){return function(_0x1081f8){if(_0x1081f8){return _0x1081f8[_0xb96a('0x24')](_0x455de3)[_0xb96a('0x25')](function(_0x1753b0){return _0x1753b0;});}return null;};}function removeEntity(_0x30100a,_0x4bef5d){return function(_0x3d02c4){if(_0x3d02c4){return _0x3d02c4[_0xb96a('0x26')]()[_0xb96a('0x25')](function(){var _0x4d1896=_0x3d02c4[_0xb96a('0x27')]({'plain':!![]});var _0x5978dd=_0xb96a('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x5978dd,'resourceId':_0x4d1896['id']}})['then'](function(){return _0x3d02c4;});})[_0xb96a('0x25')](function(){_0x30100a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd518ea,_0x33adbb){return function(_0x3be936){if(!_0x3be936){_0xd518ea[_0xb96a('0x18')](0x194);}return _0x3be936;};}function handleError(_0xc385ef,_0x9fb6d3){_0x9fb6d3=_0x9fb6d3||0x1f4;return function(_0x514112){logger[_0xb96a('0x29')](_0x514112['stack']);if(_0x514112['name']){delete _0x514112['name'];}_0xc385ef['status'](_0x9fb6d3)[_0xb96a('0x2a')](_0x514112);};}exports[_0xb96a('0x2b')]=function(_0x384c50,_0x3d16c8){var _0x48b7f9={},_0x3e6a24={},_0x4d8158={'count':0x0,'rows':[]};var _0x5d5e72=_[_0xb96a('0x2c')](db['AnalyticExtractedReport'][_0xb96a('0x2d')],function(_0xfa95fe){return{'name':_0xfa95fe['fieldName'],'type':_0xfa95fe[_0xb96a('0x2e')]['key']};});_0x3e6a24[_0xb96a('0x2f')]=_[_0xb96a('0x2c')](_0x5d5e72,'name');_0x3e6a24[_0xb96a('0x30')]=_[_0xb96a('0x31')](_0x384c50[_0xb96a('0x30')]);_0x3e6a24[_0xb96a('0x32')]=_[_0xb96a('0x33')](_0x3e6a24[_0xb96a('0x2f')],_0x3e6a24['query']);_0x48b7f9[_0xb96a('0x34')]=_[_0xb96a('0x33')](_0x3e6a24[_0xb96a('0x2f')],qs[_0xb96a('0x35')](_0x384c50['query'][_0xb96a('0x35')]));_0x48b7f9[_0xb96a('0x34')]=_0x48b7f9[_0xb96a('0x34')]['length']?_0x48b7f9[_0xb96a('0x34')]:_0x3e6a24[_0xb96a('0x2f')];if(!_0x384c50[_0xb96a('0x30')][_0xb96a('0x36')](_0xb96a('0x37'))){_0x48b7f9[_0xb96a('0x38')]=qs[_0xb96a('0x38')](_0x384c50[_0xb96a('0x30')][_0xb96a('0x38')]);_0x48b7f9[_0xb96a('0x1c')]=qs['offset'](_0x384c50[_0xb96a('0x30')][_0xb96a('0x1c')]);}_0x48b7f9[_0xb96a('0x39')]=qs[_0xb96a('0x3a')](_0x384c50[_0xb96a('0x30')][_0xb96a('0x3a')]);_0x48b7f9[_0xb96a('0x3b')]=qs[_0xb96a('0x32')](_[_0xb96a('0x3c')](_0x384c50[_0xb96a('0x30')],_0x3e6a24[_0xb96a('0x32')]),_0x5d5e72);if(_0x384c50['query']['filter']){_0x48b7f9['where']=_[_0xb96a('0x3d')](_0x48b7f9[_0xb96a('0x3b')],{'$or':_[_0xb96a('0x2c')](_0x5d5e72,function(_0x326b88){if(_0x326b88[_0xb96a('0x2e')]!==_0xb96a('0x3e')){var _0x20cce5={};_0x20cce5[_0x326b88[_0xb96a('0x3f')]]={'$like':'%'+_0x384c50[_0xb96a('0x30')][_0xb96a('0x40')]+'%'};return _0x20cce5;}})});}_0x48b7f9=_[_0xb96a('0x3d')]({},_0x48b7f9,_0x384c50[_0xb96a('0x41')]);var _0x2d4001={'where':_0x48b7f9['where']};return db[_0xb96a('0x42')][_0xb96a('0x1e')](_0x2d4001)[_0xb96a('0x25')](function(_0x347d47){_0x4d8158[_0xb96a('0x1e')]=_0x347d47;if(_0x384c50['query'][_0xb96a('0x43')]){_0x48b7f9['include']=[{'all':!![]}];}return db[_0xb96a('0x42')]['findAll'](_0x48b7f9);})[_0xb96a('0x25')](function(_0x2f6c4f){_0x4d8158['rows']=_0x2f6c4f;return _0x4d8158;})[_0xb96a('0x25')](respondWithFilteredResult(_0x3d16c8,_0x48b7f9))[_0xb96a('0x44')](handleError(_0x3d16c8,null));};exports[_0xb96a('0x45')]=function(_0x4f391c,_0x133ba9){var _0x20cc2d={'raw':!![],'where':{'id':_0x4f391c[_0xb96a('0x46')]['id']}},_0x578f0d={};_0x578f0d[_0xb96a('0x2f')]=_[_0xb96a('0x31')](db[_0xb96a('0x42')][_0xb96a('0x2d')]);_0x578f0d['query']=_[_0xb96a('0x31')](_0x4f391c['query']);_0x578f0d['filters']=_['intersection'](_0x578f0d['model'],_0x578f0d[_0xb96a('0x30')]);_0x20cc2d['attributes']=_[_0xb96a('0x33')](_0x578f0d[_0xb96a('0x2f')],qs[_0xb96a('0x35')](_0x4f391c[_0xb96a('0x30')]['fields']));_0x20cc2d[_0xb96a('0x34')]=_0x20cc2d[_0xb96a('0x34')][_0xb96a('0x47')]?_0x20cc2d[_0xb96a('0x34')]:_0x578f0d[_0xb96a('0x2f')];if(_0x4f391c[_0xb96a('0x30')][_0xb96a('0x43')]){_0x20cc2d[_0xb96a('0x48')]=[{'all':!![]}];}_0x20cc2d=_[_0xb96a('0x3d')]({},_0x20cc2d,_0x4f391c[_0xb96a('0x41')]);return db[_0xb96a('0x42')][_0xb96a('0x49')](_0x20cc2d)['then'](handleEntityNotFound(_0x133ba9,null))['then'](respondWithResult(_0x133ba9,null))['catch'](handleError(_0x133ba9,null));};exports[_0xb96a('0x4a')]=function(_0x48e618,_0x3fec93){return db[_0xb96a('0x42')][_0xb96a('0x4a')](_0x48e618[_0xb96a('0x4b')],{})[_0xb96a('0x25')](function(_0x322fc1){var _0x369adb=_0x48e618[_0xb96a('0x4c')][_0xb96a('0x27')]({'plain':!![]});if(!_0x369adb)throw new Error(_0xb96a('0x4d'));if(_0x369adb[_0xb96a('0x4e')]==='user'){var _0xfc78dc=_0x322fc1[_0xb96a('0x27')]({'plain':!![]});var _0x239210=_0xb96a('0x28');return db[_0xb96a('0x4f')]['find']({'where':{'name':_0x239210,'userProfileId':_0x369adb[_0xb96a('0x50')]},'raw':!![]})[_0xb96a('0x25')](function(_0x24b8ee){if(_0x24b8ee&&_0x24b8ee[_0xb96a('0x51')]===0x0){return db[_0xb96a('0x52')][_0xb96a('0x4a')]({'name':_0xfc78dc[_0xb96a('0x3f')],'resourceId':_0xfc78dc['id'],'type':_0x24b8ee[_0xb96a('0x3f')],'sectionId':_0x24b8ee['id']},{})[_0xb96a('0x25')](function(){return _0x322fc1;});}else{return _0x322fc1;}})[_0xb96a('0x44')](function(_0x53b1cf){logger[_0xb96a('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53b1cf);throw _0x53b1cf;});}return _0x322fc1;})[_0xb96a('0x25')](respondWithResult(_0x3fec93,0xc9))[_0xb96a('0x44')](handleError(_0x3fec93,null));};exports[_0xb96a('0x24')]=function(_0x5e9367,_0x269797){if(_0x5e9367[_0xb96a('0x4b')]['id']){delete _0x5e9367[_0xb96a('0x4b')]['id'];}return db[_0xb96a('0x42')]['find']({'where':{'id':_0x5e9367[_0xb96a('0x46')]['id']}})['then'](handleEntityNotFound(_0x269797,null))['then'](saveUpdates(_0x5e9367[_0xb96a('0x4b')],null))['then'](respondWithResult(_0x269797,null))[_0xb96a('0x44')](handleError(_0x269797,null));};exports[_0xb96a('0x26')]=function(_0x3cfb60,_0x405a16){return db[_0xb96a('0x42')][_0xb96a('0x49')]({'where':{'id':_0x3cfb60[_0xb96a('0x46')]['id']}})[_0xb96a('0x25')](handleEntityNotFound(_0x405a16,null))[_0xb96a('0x25')](removeEntity(_0x405a16,null))[_0xb96a('0x44')](handleError(_0x405a16,null));};exports['download']=function(_0x480dc8,_0xff3384,_0x23b74f){return db[_0xb96a('0x42')]['find']({'where':{'id':_0x480dc8[_0xb96a('0x46')]['id']},'attributes':['name','basename',_0xb96a('0x53'),_0xb96a('0x54')],'raw':!![]})[_0xb96a('0x25')](handleEntityNotFound(_0xff3384,null))[_0xb96a('0x25')](function(_0x5c7621){if(_0x5c7621){if(!fs['existsSync'](path[_0xb96a('0x55')](config[_0xb96a('0x56')],_0xb96a('0x57'),_0x5c7621[_0xb96a('0x53')]))){throw new db[(_0xb96a('0x58'))][(_0xb96a('0x59'))](_0xb96a('0x5a'));}if(_0x480dc8[_0xb96a('0x30')][_0xb96a('0x5b')]){return _0xff3384[_0xb96a('0x18')](0xc8);}return _0xff3384[_0xb96a('0x5c')](path[_0xb96a('0x55')](config[_0xb96a('0x56')],_0xb96a('0x57'),_0x5c7621[_0xb96a('0x53')]),util[_0xb96a('0x5d')](_0xb96a('0x5e'),_0x5c7621[_0xb96a('0x5f')]||_0x5c7621['name'],_0x5c7621['output'][_0xb96a('0x60')]()));}})[_0xb96a('0x44')](handleError(_0xff3384,null));};
\ No newline at end of file
+var _0x5a2c=['server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','ExtractedReports','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','download','basename','savename','output','existsSync','join','root'];(function(_0x3fa02e,_0x1186be){var _0x3d61d7=function(_0x3889fc){while(--_0x3889fc){_0x3fa02e['push'](_0x3fa02e['shift']());}};_0x3d61d7(++_0x1186be);}(_0x5a2c,0x6b));var _0xc5a2=function(_0x26f1cf,_0x3ed15f){_0x26f1cf=_0x26f1cf-0x0;var _0x6674e8=_0x5a2c[_0x26f1cf];return _0x6674e8;};'use strict';var emlformat=require(_0xc5a2('0x0'));var rimraf=require(_0xc5a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5a2('0x2'));var rp=require(_0xc5a2('0x3'));var moment=require(_0xc5a2('0x4'));var BPromise=require(_0xc5a2('0x5'));var Mustache=require(_0xc5a2('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc5a2('0x7'));var csv=require(_0xc5a2('0x8'));var ejs=require(_0xc5a2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc5a2('0xa'));var squel=require(_0xc5a2('0xb'));var crypto=require('crypto');var jsforce=require(_0xc5a2('0xc'));var deskjs=require(_0xc5a2('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc5a2('0xe'));var Papa=require(_0xc5a2('0xf'));var Redis=require(_0xc5a2('0x10'));var authService=require(_0xc5a2('0x11'));var qs=require(_0xc5a2('0x12'));var as=require(_0xc5a2('0x13'));var hardwareService=require(_0xc5a2('0x14'));var logger=require(_0xc5a2('0x15'))(_0xc5a2('0x16'));var utils=require(_0xc5a2('0x17'));var config=require(_0xc5a2('0x18'));var licenseUtil=require(_0xc5a2('0x19'));var db=require(_0xc5a2('0x1a'))['db'];function respondWithStatusCode(_0x350a9e,_0x431644){_0x431644=_0x431644||0xcc;return function(_0x1ab2d6){if(_0x1ab2d6){return _0x350a9e[_0xc5a2('0x1b')](_0x431644);}return _0x350a9e[_0xc5a2('0x1c')](_0x431644)[_0xc5a2('0x1d')]();};}function respondWithResult(_0x46769c,_0x3d5424){_0x3d5424=_0x3d5424||0xc8;return function(_0x2deb49){if(_0x2deb49){return _0x46769c[_0xc5a2('0x1c')](_0x3d5424)[_0xc5a2('0x1e')](_0x2deb49);}};}function respondWithFilteredResult(_0x4e9d5e,_0x275eb2){return function(_0x107a15){if(_0x107a15){var _0x5187b4=typeof _0x275eb2[_0xc5a2('0x1f')]===_0xc5a2('0x20')&&typeof _0x275eb2[_0xc5a2('0x21')]===_0xc5a2('0x20');var _0x2e4259=_0x107a15[_0xc5a2('0x22')];var _0x11b841=_0x5187b4?0x0:_0x275eb2[_0xc5a2('0x1f')];var _0x2dc491=_0x5187b4?_0x107a15['count']:_0x275eb2['offset']+_0x275eb2[_0xc5a2('0x21')];var _0x51acc8;if(_0x2dc491>=_0x2e4259){_0x2dc491=_0x2e4259;_0x51acc8=0xc8;}else{_0x51acc8=0xce;}_0x4e9d5e[_0xc5a2('0x1c')](_0x51acc8);return _0x4e9d5e['set'](_0xc5a2('0x23'),_0x11b841+'-'+_0x2dc491+'/'+_0x2e4259)[_0xc5a2('0x1e')](_0x107a15);}return null;};}function patchUpdates(_0x46cba5){return function(_0x4234eb){try{jsonpatch[_0xc5a2('0x24')](_0x4234eb,_0x46cba5,!![]);}catch(_0x3d6148){return BPromise['reject'](_0x3d6148);}return _0x4234eb[_0xc5a2('0x25')]();};}function saveUpdates(_0x27861b,_0x420e54){return function(_0x4ef349){if(_0x4ef349){return _0x4ef349[_0xc5a2('0x26')](_0x27861b)[_0xc5a2('0x27')](function(_0x2d3980){return _0x2d3980;});}return null;};}function removeEntity(_0x3360a8,_0x34cb6f){return function(_0x1f459b){if(_0x1f459b){return _0x1f459b[_0xc5a2('0x28')]()[_0xc5a2('0x27')](function(){var _0x31e196=_0x1f459b[_0xc5a2('0x29')]({'plain':!![]});var _0x4c7ff9=_0xc5a2('0x2a');return db['UserProfileResource'][_0xc5a2('0x28')]({'where':{'type':_0x4c7ff9,'resourceId':_0x31e196['id']}})['then'](function(){return _0x1f459b;});})[_0xc5a2('0x27')](function(){_0x3360a8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b8b09,_0x1eb136){return function(_0x24401e){if(!_0x24401e){_0x4b8b09[_0xc5a2('0x1b')](0x194);}return _0x24401e;};}function handleError(_0x52e4be,_0x1d6e9a){_0x1d6e9a=_0x1d6e9a||0x1f4;return function(_0x27e21b){logger['error'](_0x27e21b[_0xc5a2('0x2b')]);if(_0x27e21b['name']){delete _0x27e21b[_0xc5a2('0x2c')];}_0x52e4be[_0xc5a2('0x1c')](_0x1d6e9a)[_0xc5a2('0x2d')](_0x27e21b);};}exports[_0xc5a2('0x2e')]=function(_0x50cd7c,_0x473a5a){var _0x1289cf={},_0x22ee44={},_0x528b1b={'count':0x0,'rows':[]};var _0x210876=_[_0xc5a2('0x2f')](db[_0xc5a2('0x30')][_0xc5a2('0x31')],function(_0x4a8e97){return{'name':_0x4a8e97['fieldName'],'type':_0x4a8e97['type'][_0xc5a2('0x32')]};});_0x22ee44[_0xc5a2('0x33')]=_[_0xc5a2('0x2f')](_0x210876,_0xc5a2('0x2c'));_0x22ee44[_0xc5a2('0x34')]=_['keys'](_0x50cd7c[_0xc5a2('0x34')]);_0x22ee44[_0xc5a2('0x35')]=_[_0xc5a2('0x36')](_0x22ee44[_0xc5a2('0x33')],_0x22ee44[_0xc5a2('0x34')]);_0x1289cf['attributes']=_[_0xc5a2('0x36')](_0x22ee44[_0xc5a2('0x33')],qs[_0xc5a2('0x37')](_0x50cd7c[_0xc5a2('0x34')][_0xc5a2('0x37')]));_0x1289cf[_0xc5a2('0x38')]=_0x1289cf[_0xc5a2('0x38')][_0xc5a2('0x39')]?_0x1289cf[_0xc5a2('0x38')]:_0x22ee44[_0xc5a2('0x33')];if(!_0x50cd7c[_0xc5a2('0x34')][_0xc5a2('0x3a')]('nolimit')){_0x1289cf[_0xc5a2('0x21')]=qs[_0xc5a2('0x21')](_0x50cd7c[_0xc5a2('0x34')][_0xc5a2('0x21')]);_0x1289cf[_0xc5a2('0x1f')]=qs[_0xc5a2('0x1f')](_0x50cd7c['query'][_0xc5a2('0x1f')]);}_0x1289cf[_0xc5a2('0x3b')]=qs['sort'](_0x50cd7c[_0xc5a2('0x34')][_0xc5a2('0x3c')]);_0x1289cf['where']=qs[_0xc5a2('0x35')](_['pick'](_0x50cd7c['query'],_0x22ee44[_0xc5a2('0x35')]),_0x210876);if(_0x50cd7c[_0xc5a2('0x34')][_0xc5a2('0x3d')]){_0x1289cf[_0xc5a2('0x3e')]=_['merge'](_0x1289cf[_0xc5a2('0x3e')],{'$or':_['map'](_0x210876,function(_0x12dc32){if(_0x12dc32[_0xc5a2('0x3f')]!==_0xc5a2('0x40')){var _0x2277e3={};_0x2277e3[_0x12dc32[_0xc5a2('0x2c')]]={'$like':'%'+_0x50cd7c[_0xc5a2('0x34')][_0xc5a2('0x3d')]+'%'};return _0x2277e3;}})});}_0x1289cf=_[_0xc5a2('0x41')]({},_0x1289cf,_0x50cd7c[_0xc5a2('0x42')]);var _0x4c938b={'where':_0x1289cf[_0xc5a2('0x3e')]};return db[_0xc5a2('0x30')][_0xc5a2('0x22')](_0x4c938b)['then'](function(_0x14a6ae){_0x528b1b[_0xc5a2('0x22')]=_0x14a6ae;if(_0x50cd7c[_0xc5a2('0x34')][_0xc5a2('0x43')]){_0x1289cf[_0xc5a2('0x44')]=[{'all':!![]}];}return db[_0xc5a2('0x30')][_0xc5a2('0x45')](_0x1289cf);})[_0xc5a2('0x27')](function(_0x13f407){_0x528b1b['rows']=_0x13f407;return _0x528b1b;})['then'](respondWithFilteredResult(_0x473a5a,_0x1289cf))['catch'](handleError(_0x473a5a,null));};exports[_0xc5a2('0x46')]=function(_0x5afcf5,_0x56b565){var _0x2fa38c={'raw':!![],'where':{'id':_0x5afcf5[_0xc5a2('0x47')]['id']}},_0x6f398d={};_0x6f398d[_0xc5a2('0x33')]=_[_0xc5a2('0x48')](db[_0xc5a2('0x30')][_0xc5a2('0x31')]);_0x6f398d[_0xc5a2('0x34')]=_['keys'](_0x5afcf5[_0xc5a2('0x34')]);_0x6f398d[_0xc5a2('0x35')]=_['intersection'](_0x6f398d[_0xc5a2('0x33')],_0x6f398d[_0xc5a2('0x34')]);_0x2fa38c['attributes']=_[_0xc5a2('0x36')](_0x6f398d[_0xc5a2('0x33')],qs['fields'](_0x5afcf5['query'][_0xc5a2('0x37')]));_0x2fa38c['attributes']=_0x2fa38c['attributes'][_0xc5a2('0x39')]?_0x2fa38c[_0xc5a2('0x38')]:_0x6f398d[_0xc5a2('0x33')];if(_0x5afcf5[_0xc5a2('0x34')]['includeAll']){_0x2fa38c[_0xc5a2('0x44')]=[{'all':!![]}];}_0x2fa38c=_['merge']({},_0x2fa38c,_0x5afcf5[_0xc5a2('0x42')]);return db[_0xc5a2('0x30')][_0xc5a2('0x49')](_0x2fa38c)[_0xc5a2('0x27')](handleEntityNotFound(_0x56b565,null))[_0xc5a2('0x27')](respondWithResult(_0x56b565,null))[_0xc5a2('0x4a')](handleError(_0x56b565,null));};exports[_0xc5a2('0x4b')]=function(_0xd79531,_0x2e927d){return db[_0xc5a2('0x30')][_0xc5a2('0x4b')](_0xd79531[_0xc5a2('0x4c')],{})['then'](function(_0x5d1bf3){var _0x3ccdf9=_0xd79531[_0xc5a2('0x4d')][_0xc5a2('0x29')]({'plain':!![]});if(!_0x3ccdf9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ccdf9[_0xc5a2('0x4e')]==='user'){var _0x4f350e=_0x5d1bf3[_0xc5a2('0x29')]({'plain':!![]});var _0x35754d='ExtractedReports';return db[_0xc5a2('0x4f')]['find']({'where':{'name':_0x35754d,'userProfileId':_0x3ccdf9[_0xc5a2('0x50')]},'raw':!![]})[_0xc5a2('0x27')](function(_0x44262a){if(_0x44262a&&_0x44262a[_0xc5a2('0x51')]===0x0){return db[_0xc5a2('0x52')]['create']({'name':_0x4f350e[_0xc5a2('0x2c')],'resourceId':_0x4f350e['id'],'type':_0x44262a[_0xc5a2('0x2c')],'sectionId':_0x44262a['id']},{})[_0xc5a2('0x27')](function(){return _0x5d1bf3;});}else{return _0x5d1bf3;}})[_0xc5a2('0x4a')](function(_0x42d00e){logger[_0xc5a2('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42d00e);throw _0x42d00e;});}return _0x5d1bf3;})[_0xc5a2('0x27')](respondWithResult(_0x2e927d,0xc9))[_0xc5a2('0x4a')](handleError(_0x2e927d,null));};exports[_0xc5a2('0x26')]=function(_0x2fc904,_0x10bf41){if(_0x2fc904[_0xc5a2('0x4c')]['id']){delete _0x2fc904[_0xc5a2('0x4c')]['id'];}return db['AnalyticExtractedReport'][_0xc5a2('0x49')]({'where':{'id':_0x2fc904[_0xc5a2('0x47')]['id']}})[_0xc5a2('0x27')](handleEntityNotFound(_0x10bf41,null))[_0xc5a2('0x27')](saveUpdates(_0x2fc904[_0xc5a2('0x4c')],null))['then'](respondWithResult(_0x10bf41,null))[_0xc5a2('0x4a')](handleError(_0x10bf41,null));};exports[_0xc5a2('0x28')]=function(_0x275a26,_0x2ab261){return db[_0xc5a2('0x30')][_0xc5a2('0x49')]({'where':{'id':_0x275a26[_0xc5a2('0x47')]['id']}})[_0xc5a2('0x27')](handleEntityNotFound(_0x2ab261,null))[_0xc5a2('0x27')](removeEntity(_0x2ab261,null))[_0xc5a2('0x4a')](handleError(_0x2ab261,null));};exports[_0xc5a2('0x54')]=function(_0x1d4435,_0x3209da,_0x235b79){return db['AnalyticExtractedReport'][_0xc5a2('0x49')]({'where':{'id':_0x1d4435[_0xc5a2('0x47')]['id']},'attributes':['name',_0xc5a2('0x55'),_0xc5a2('0x56'),_0xc5a2('0x57')],'raw':!![]})[_0xc5a2('0x27')](handleEntityNotFound(_0x3209da,null))[_0xc5a2('0x27')](function(_0x2bf856){if(_0x2bf856){if(!fs[_0xc5a2('0x58')](path[_0xc5a2('0x59')](config[_0xc5a2('0x5a')],_0xc5a2('0x5b'),_0x2bf856[_0xc5a2('0x56')]))){throw new db[(_0xc5a2('0x5c'))][(_0xc5a2('0x5d'))](_0xc5a2('0x5e'));}if(_0x1d4435[_0xc5a2('0x34')][_0xc5a2('0x5f')]){return _0x3209da[_0xc5a2('0x1b')](0xc8);}return _0x3209da['download'](path[_0xc5a2('0x59')](config[_0xc5a2('0x5a')],_0xc5a2('0x5b'),_0x2bf856[_0xc5a2('0x56')]),util[_0xc5a2('0x60')](_0xc5a2('0x61'),_0x2bf856[_0xc5a2('0x55')]||_0x2bf856[_0xc5a2('0x2c')],_0x2bf856[_0xc5a2('0x57')][_0xc5a2('0x62')]()));}})[_0xc5a2('0x4a')](handleError(_0x3209da,null));};
\ No newline at end of file
index b3c6dad..11c7010 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfc71=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x37ef22,_0x348c92){var _0x49eeb3=function(_0x1ef837){while(--_0x1ef837){_0x37ef22['push'](_0x37ef22['shift']());}};_0x49eeb3(++_0x348c92);}(_0xfc71,0x1d4));var _0x1fc7=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0xfc71[_0x144b30];return _0x1bb7bc;};'use strict';var _=require(_0x1fc7('0x0'));var util=require(_0x1fc7('0x1'));var logger=require('../../config/logger')(_0x1fc7('0x2'));var moment=require(_0x1fc7('0x3'));var BPromise=require(_0x1fc7('0x4'));var rp=require(_0x1fc7('0x5'));var fs=require('fs');var path=require(_0x1fc7('0x6'));var rimraf=require(_0x1fc7('0x7'));var config=require(_0x1fc7('0x8'));var attributes=require(_0x1fc7('0x9'));module[_0x1fc7('0xa')]=function(_0x335d95,_0x14852a){return _0x335d95[_0x1fc7('0xb')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x2bd5=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','define','lodash'];(function(_0x4756a1,_0x3f8d1){var _0x177c4f=function(_0xddb5e2){while(--_0xddb5e2){_0x4756a1['push'](_0x4756a1['shift']());}};_0x177c4f(++_0x3f8d1);}(_0x2bd5,0x1ac));var _0x52bd=function(_0x26393b,_0x449a84){_0x26393b=_0x26393b-0x0;var _0x57230a=_0x2bd5[_0x26393b];return _0x57230a;};'use strict';var _=require(_0x52bd('0x0'));var util=require(_0x52bd('0x1'));var logger=require(_0x52bd('0x2'))(_0x52bd('0x3'));var moment=require(_0x52bd('0x4'));var BPromise=require(_0x52bd('0x5'));var rp=require(_0x52bd('0x6'));var fs=require('fs');var path=require(_0x52bd('0x7'));var rimraf=require('rimraf');var config=require(_0x52bd('0x8'));var attributes=require(_0x52bd('0x9'));module['exports']=function(_0x5d5868,_0x4f46f9){return _0x5d5868[_0x52bd('0xa')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9f6c9f7..fdf3c42 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8b30=['../../config/environment','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1f1511,_0x4ea911){var _0x1d9ab8=function(_0x53276a){while(--_0x53276a){_0x1f1511['push'](_0x1f1511['shift']());}};_0x1d9ab8(++_0x4ea911);}(_0x8b30,0x1f2));var _0x08b3=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x8b30[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require('lodash');var util=require(_0x08b3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x08b3('0x1'));var fs=require('fs');var Redis=require(_0x08b3('0x2'));var db=require(_0x08b3('0x3'))['db'];var utils=require(_0x08b3('0x4'));var logger=require('../../config/logger')(_0x08b3('0x5'));var config=require(_0x08b3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x08b3('0x7')][_0x08b3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dfe7e,_0x499c2e,_0x4c74fb){return new BPromise(function(_0x3e9117,_0x386c4d){return client['request'](_0x3dfe7e,_0x4c74fb)[_0x08b3('0x9')](function(_0x46a206){logger[_0x08b3('0xa')](_0x08b3('0xb'),_0x499c2e,_0x08b3('0xc'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x499c2e,_0x08b3('0xc'),JSON['stringify'](_0x46a206));if(_0x46a206[_0x08b3('0xd')]){if(_0x46a206[_0x08b3('0xd')][_0x08b3('0xe')]===0x1f4){logger['error'](_0x08b3('0xb'),_0x499c2e,_0x46a206[_0x08b3('0xd')][_0x08b3('0xf')]);return _0x386c4d(_0x46a206['error'][_0x08b3('0xf')]);}logger[_0x08b3('0xd')](_0x08b3('0xb'),_0x499c2e,_0x46a206[_0x08b3('0xd')][_0x08b3('0xf')]);return _0x3e9117(_0x46a206[_0x08b3('0xd')][_0x08b3('0xf')]);}else{logger[_0x08b3('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x499c2e,'request\x20sent');_0x3e9117(_0x46a206[_0x08b3('0x10')]['message']);}})[_0x08b3('0x11')](function(_0x56c687){logger[_0x08b3('0xd')](_0x08b3('0xb'),_0x499c2e,_0x56c687);_0x386c4d(_0x56c687);});});}
\ No newline at end of file
+var _0xc89b=['error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x548272,_0x115575){var _0x3e4f0e=function(_0x3762b6){while(--_0x3762b6){_0x548272['push'](_0x548272['shift']());}};_0x3e4f0e(++_0x115575);}(_0xc89b,0x1bf));var _0xbc89=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xc89b[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0xbc89('0x0'));var util=require('util');var moment=require(_0xbc89('0x1'));var BPromise=require(_0xbc89('0x2'));var rs=require(_0xbc89('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbc89('0x4'));var logger=require(_0xbc89('0x5'))(_0xbc89('0x6'));var config=require('../../config/environment');var jayson=require(_0xbc89('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb87fcf,_0x4edde2,_0x5523b1){return new BPromise(function(_0x250a62,_0x287796){return client['request'](_0xb87fcf,_0x5523b1)['then'](function(_0x3b0af2){logger[_0xbc89('0x8')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4edde2,_0xbc89('0x9'));logger[_0xbc89('0xa')](_0xbc89('0xb'),_0x4edde2,_0xbc89('0x9'),JSON['stringify'](_0x3b0af2));if(_0x3b0af2[_0xbc89('0xc')]){if(_0x3b0af2[_0xbc89('0xc')][_0xbc89('0xd')]===0x1f4){logger['error'](_0xbc89('0xe'),_0x4edde2,_0x3b0af2['error'][_0xbc89('0xf')]);return _0x287796(_0x3b0af2['error'][_0xbc89('0xf')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x4edde2,_0x3b0af2[_0xbc89('0xc')][_0xbc89('0xf')]);return _0x250a62(_0x3b0af2[_0xbc89('0xc')]['message']);}else{logger[_0xbc89('0x8')](_0xbc89('0xe'),_0x4edde2,_0xbc89('0x9'));_0x250a62(_0x3b0af2['result'][_0xbc89('0xf')]);}})[_0xbc89('0x10')](function(_0x4e0240){logger[_0xbc89('0xc')](_0xbc89('0xe'),_0x4edde2,_0x4e0240);_0x287796(_0x4e0240);});});}
\ No newline at end of file
index e47b5e9..f8f966c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfe34=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','index','get','show','/:id/download','post','isAuthenticated','create','put','/:id','delete','destroy','exports','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe34,0x106));var _0x4fe3=function(_0x302974,_0x2240fc){_0x302974=_0x302974-0x0;var _0x2e4331=_0xfe34[_0x302974];return _0x2e4331;};'use strict';var multer=require(_0x4fe3('0x0'));var util=require('util');var path=require(_0x4fe3('0x1'));var timeout=require(_0x4fe3('0x2'));var express=require(_0x4fe3('0x3'));var router=express[_0x4fe3('0x4')]();var fs_extra=require(_0x4fe3('0x5'));var auth=require(_0x4fe3('0x6'));var interaction=require(_0x4fe3('0x7'));var config=require(_0x4fe3('0x8'));var controller=require(_0x4fe3('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4fe3('0xa')]);router[_0x4fe3('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x4fe3('0xc')]);router[_0x4fe3('0xb')](_0x4fe3('0xd'),auth['isAuthenticated'](),controller['download']);router[_0x4fe3('0xe')]('/',auth[_0x4fe3('0xf')](),controller[_0x4fe3('0x10')]);router[_0x4fe3('0x11')](_0x4fe3('0x12'),auth[_0x4fe3('0xf')](),controller['update']);router[_0x4fe3('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4fe3('0x14')]);module[_0x4fe3('0x15')]=router;
\ No newline at end of file
+var _0xb309=['download','put','/:id','delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','show'];(function(_0x19cf4a,_0x2f9388){var _0x29a55a=function(_0x5beb0b){while(--_0x5beb0b){_0x19cf4a['push'](_0x19cf4a['shift']());}};_0x29a55a(++_0x2f9388);}(_0xb309,0x140));var _0x9b30=function(_0x1c0da2,_0x48bb44){_0x1c0da2=_0x1c0da2-0x0;var _0x4d76b7=_0xb309[_0x1c0da2];return _0x4d76b7;};'use strict';var multer=require(_0x9b30('0x0'));var util=require(_0x9b30('0x1'));var path=require(_0x9b30('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9b30('0x3'));var auth=require(_0x9b30('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9b30('0x5'));var controller=require(_0x9b30('0x6'));router[_0x9b30('0x7')]('/',auth[_0x9b30('0x8')](),controller['index']);router[_0x9b30('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9b30('0x9')]);router[_0x9b30('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x9b30('0xa')]);router['post']('/',auth[_0x9b30('0x8')](),controller['create']);router[_0x9b30('0xb')](_0x9b30('0xc'),auth[_0x9b30('0x8')](),controller['update']);router[_0x9b30('0xd')](_0x9b30('0xc'),auth[_0x9b30('0x8')](),controller[_0x9b30('0xe')]);module['exports']=router;
\ No newline at end of file
index 9b182c2..727b5a0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9545=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x576df3,_0x1e1d5f){var _0x180fdd=function(_0xb9a1c9){while(--_0xb9a1c9){_0x576df3['push'](_0x576df3['shift']());}};_0x180fdd(++_0x1e1d5f);}(_0x9545,0x196));var _0x5954=function(_0x23cf72,_0x22e108){_0x23cf72=_0x23cf72-0x0;var _0x3bc541=_0x9545[_0x23cf72];return _0x3bc541;};'use strict';var Sequelize=require(_0x5954('0x0'));module[_0x5954('0x1')]={'field':{'type':Sequelize[_0x5954('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x5954('0x3')]},'format':{'type':Sequelize[_0x5954('0x3')]},'groupBy':{'type':Sequelize[_0x5954('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x5954('0x3')]},'custom':{'type':Sequelize[_0x5954('0x4')],'defaultValue':![]}};
\ No newline at end of file
+var _0x16b7=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x367b4d,_0x45c9e0){var _0x20974f=function(_0x859f3b){while(--_0x859f3b){_0x367b4d['push'](_0x367b4d['shift']());}};_0x20974f(++_0x45c9e0);}(_0x16b7,0x113));var _0x716b=function(_0x39df0a,_0x53f77f){_0x39df0a=_0x39df0a-0x0;var _0x9b55aa=_0x16b7[_0x39df0a];return _0x9b55aa;};'use strict';var Sequelize=require(_0x716b('0x0'));module[_0x716b('0x1')]={'field':{'type':Sequelize[_0x716b('0x2')]},'alias':{'type':Sequelize[_0x716b('0x3')]},'function':{'type':Sequelize[_0x716b('0x3')]},'format':{'type':Sequelize[_0x716b('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x716b('0x3')]},'custom':{'type':Sequelize[_0x716b('0x4')],'defaultValue':![]}};
\ No newline at end of file
index f73794c..e037ddd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdd7c=['includeAll','include','findAll','rows','catch','params','find','create','body','bulkCreate','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','merge','options'];(function(_0x1ff2ec,_0x386e86){var _0x405683=function(_0x22f921){while(--_0x22f921){_0x1ff2ec['push'](_0x1ff2ec['shift']());}};_0x405683(++_0x386e86);}(_0xdd7c,0xbf));var _0xcdd7=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xdd7c[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require(_0xcdd7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcdd7('0x1'));var rp=require(_0xcdd7('0x2'));var moment=require(_0xcdd7('0x3'));var BPromise=require(_0xcdd7('0x4'));var Mustache=require(_0xcdd7('0x5'));var util=require(_0xcdd7('0x6'));var path=require(_0xcdd7('0x7'));var sox=require(_0xcdd7('0x8'));var csv=require(_0xcdd7('0x9'));var ejs=require(_0xcdd7('0xa'));var fs=require('fs');var fs_extra=require(_0xcdd7('0xb'));var _=require(_0xcdd7('0xc'));var squel=require(_0xcdd7('0xd'));var crypto=require(_0xcdd7('0xe'));var jsforce=require(_0xcdd7('0xf'));var deskjs=require(_0xcdd7('0x10'));var toCsv=require(_0xcdd7('0x9'));var querystring=require(_0xcdd7('0x11'));var Papa=require('papaparse');var Redis=require(_0xcdd7('0x12'));var authService=require(_0xcdd7('0x13'));var qs=require(_0xcdd7('0x14'));var as=require(_0xcdd7('0x15'));var hardwareService=require(_0xcdd7('0x16'));var logger=require(_0xcdd7('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xcdd7('0x18'));var licenseUtil=require(_0xcdd7('0x19'));var db=require(_0xcdd7('0x1a'))['db'];function respondWithStatusCode(_0x4d7275,_0x4cff24){_0x4cff24=_0x4cff24||0xcc;return function(_0x122037){if(_0x122037){return _0x4d7275[_0xcdd7('0x1b')](_0x4cff24);}return _0x4d7275[_0xcdd7('0x1c')](_0x4cff24)[_0xcdd7('0x1d')]();};}function respondWithResult(_0x545ba3,_0xf3186f){_0xf3186f=_0xf3186f||0xc8;return function(_0x228989){if(_0x228989){return _0x545ba3[_0xcdd7('0x1c')](_0xf3186f)[_0xcdd7('0x1e')](_0x228989);}};}function respondWithFilteredResult(_0x19c442,_0x179dfd){return function(_0x29a6e5){if(_0x29a6e5){var _0xda36fa=typeof _0x179dfd[_0xcdd7('0x1f')]==='undefined'&&typeof _0x179dfd['limit']===_0xcdd7('0x20');var _0x476910=_0x29a6e5[_0xcdd7('0x21')];var _0x5b6876=_0xda36fa?0x0:_0x179dfd[_0xcdd7('0x1f')];var _0x2b2463=_0xda36fa?_0x29a6e5[_0xcdd7('0x21')]:_0x179dfd[_0xcdd7('0x1f')]+_0x179dfd[_0xcdd7('0x22')];var _0x3e4ceb;if(_0x2b2463>=_0x476910){_0x2b2463=_0x476910;_0x3e4ceb=0xc8;}else{_0x3e4ceb=0xce;}_0x19c442[_0xcdd7('0x1c')](_0x3e4ceb);return _0x19c442[_0xcdd7('0x23')]('Content-Range',_0x5b6876+'-'+_0x2b2463+'/'+_0x476910)[_0xcdd7('0x1e')](_0x29a6e5);}return null;};}function patchUpdates(_0xe028d9){return function(_0x1589d9){try{jsonpatch[_0xcdd7('0x24')](_0x1589d9,_0xe028d9,!![]);}catch(_0x509d9d){return BPromise[_0xcdd7('0x25')](_0x509d9d);}return _0x1589d9[_0xcdd7('0x26')]();};}function saveUpdates(_0x2d0d42,_0x172f09){return function(_0x3aa814){if(_0x3aa814){return _0x3aa814[_0xcdd7('0x27')](_0x2d0d42)[_0xcdd7('0x28')](function(_0x353175){return _0x353175;});}return null;};}function removeEntity(_0x19ee9b,_0x3e2e97){return function(_0x3c7ff9){if(_0x3c7ff9){return _0x3c7ff9[_0xcdd7('0x29')]()[_0xcdd7('0x28')](function(){_0x19ee9b[_0xcdd7('0x1c')](0xcc)[_0xcdd7('0x1d')]();});}};}function handleEntityNotFound(_0x48502c,_0x70a80b){return function(_0x377c14){if(!_0x377c14){_0x48502c[_0xcdd7('0x1b')](0x194);}return _0x377c14;};}function handleError(_0x4ca979,_0x2a48cd){_0x2a48cd=_0x2a48cd||0x1f4;return function(_0x52d4de){logger[_0xcdd7('0x2a')](_0x52d4de[_0xcdd7('0x2b')]);if(_0x52d4de['name']){delete _0x52d4de['name'];}_0x4ca979['status'](_0x2a48cd)[_0xcdd7('0x2c')](_0x52d4de);};}exports[_0xcdd7('0x2d')]=function(_0x14f4f0,_0x24039a){var _0x21d872={},_0x5a5f34={},_0x2a048f={'count':0x0,'rows':[]};var _0x44fc36=_[_0xcdd7('0x2e')](db[_0xcdd7('0x2f')][_0xcdd7('0x30')],function(_0x5c993a){return{'name':_0x5c993a[_0xcdd7('0x31')],'type':_0x5c993a['type'][_0xcdd7('0x32')]};});_0x5a5f34[_0xcdd7('0x33')]=_['map'](_0x44fc36,_0xcdd7('0x34'));_0x5a5f34[_0xcdd7('0x35')]=_[_0xcdd7('0x36')](_0x14f4f0[_0xcdd7('0x35')]);_0x5a5f34[_0xcdd7('0x37')]=_['intersection'](_0x5a5f34[_0xcdd7('0x33')],_0x5a5f34[_0xcdd7('0x35')]);_0x21d872['attributes']=_[_0xcdd7('0x38')](_0x5a5f34[_0xcdd7('0x33')],qs[_0xcdd7('0x39')](_0x14f4f0[_0xcdd7('0x35')][_0xcdd7('0x39')]));_0x21d872['attributes']=_0x21d872['attributes'][_0xcdd7('0x3a')]?_0x21d872[_0xcdd7('0x3b')]:_0x5a5f34[_0xcdd7('0x33')];if(!_0x14f4f0[_0xcdd7('0x35')][_0xcdd7('0x3c')]('nolimit')){_0x21d872['limit']=qs[_0xcdd7('0x22')](_0x14f4f0[_0xcdd7('0x35')][_0xcdd7('0x22')]);_0x21d872[_0xcdd7('0x1f')]=qs[_0xcdd7('0x1f')](_0x14f4f0[_0xcdd7('0x35')][_0xcdd7('0x1f')]);}_0x21d872[_0xcdd7('0x3d')]=qs[_0xcdd7('0x3e')](_0x14f4f0[_0xcdd7('0x35')][_0xcdd7('0x3e')]);_0x21d872['where']=qs[_0xcdd7('0x37')](_[_0xcdd7('0x3f')](_0x14f4f0['query'],_0x5a5f34[_0xcdd7('0x37')]),_0x44fc36);if(_0x14f4f0['query'][_0xcdd7('0x40')]){_0x21d872[_0xcdd7('0x41')]=_['merge'](_0x21d872[_0xcdd7('0x41')],{'$or':_[_0xcdd7('0x2e')](_0x44fc36,function(_0x5b5bc6){if(_0x5b5bc6[_0xcdd7('0x42')]!==_0xcdd7('0x43')){var _0x488d30={};_0x488d30[_0x5b5bc6['name']]={'$like':'%'+_0x14f4f0[_0xcdd7('0x35')][_0xcdd7('0x40')]+'%'};return _0x488d30;}})});}_0x21d872=_[_0xcdd7('0x44')]({},_0x21d872,_0x14f4f0[_0xcdd7('0x45')]);var _0x235705={'where':_0x21d872[_0xcdd7('0x41')]};return db[_0xcdd7('0x2f')][_0xcdd7('0x21')](_0x235705)[_0xcdd7('0x28')](function(_0x5166e1){_0x2a048f[_0xcdd7('0x21')]=_0x5166e1;if(_0x14f4f0[_0xcdd7('0x35')][_0xcdd7('0x46')]){_0x21d872[_0xcdd7('0x47')]=[{'all':!![]}];}return db[_0xcdd7('0x2f')][_0xcdd7('0x48')](_0x21d872);})[_0xcdd7('0x28')](function(_0x201084){_0x2a048f[_0xcdd7('0x49')]=_0x201084;return _0x2a048f;})[_0xcdd7('0x28')](respondWithFilteredResult(_0x24039a,_0x21d872))[_0xcdd7('0x4a')](handleError(_0x24039a,null));};exports['show']=function(_0x180f4e,_0x4a8681){var _0x3d600f={'raw':![],'where':{'id':_0x180f4e[_0xcdd7('0x4b')]['id']}},_0x1978ab={};_0x1978ab[_0xcdd7('0x33')]=_[_0xcdd7('0x36')](db[_0xcdd7('0x2f')]['rawAttributes']);_0x1978ab[_0xcdd7('0x35')]=_[_0xcdd7('0x36')](_0x180f4e[_0xcdd7('0x35')]);_0x1978ab[_0xcdd7('0x37')]=_[_0xcdd7('0x38')](_0x1978ab[_0xcdd7('0x33')],_0x1978ab[_0xcdd7('0x35')]);_0x3d600f[_0xcdd7('0x3b')]=_[_0xcdd7('0x38')](_0x1978ab['model'],qs[_0xcdd7('0x39')](_0x180f4e[_0xcdd7('0x35')]['fields']));_0x3d600f['attributes']=_0x3d600f[_0xcdd7('0x3b')][_0xcdd7('0x3a')]?_0x3d600f[_0xcdd7('0x3b')]:_0x1978ab[_0xcdd7('0x33')];if(_0x180f4e[_0xcdd7('0x35')]['includeAll']){_0x3d600f[_0xcdd7('0x47')]=[{'all':!![]}];}_0x3d600f=_[_0xcdd7('0x44')]({},_0x3d600f,_0x180f4e[_0xcdd7('0x45')]);return db[_0xcdd7('0x2f')][_0xcdd7('0x4c')](_0x3d600f)[_0xcdd7('0x28')](handleEntityNotFound(_0x4a8681,null))['then'](respondWithResult(_0x4a8681,null))[_0xcdd7('0x4a')](handleError(_0x4a8681,null));};exports[_0xcdd7('0x4d')]=function(_0x3c446b,_0x1e421d){return db['AnalyticFieldReport'][_0xcdd7('0x4d')](_0x3c446b[_0xcdd7('0x4e')],{})['then'](respondWithResult(_0x1e421d,0xc9))[_0xcdd7('0x4a')](handleError(_0x1e421d,null));};exports[_0xcdd7('0x4f')]=function(_0x558df1,_0x1d9b6d){return db[_0xcdd7('0x2f')][_0xcdd7('0x4f')](_0x558df1[_0xcdd7('0x4e')],{'raw':![],'individualHooks':!![]})[_0xcdd7('0x28')](respondWithResult(_0x1d9b6d,0xc9))['catch'](handleError(_0x1d9b6d,null));};exports[_0xcdd7('0x27')]=function(_0x2f0656,_0x2c2351){if(_0x2f0656[_0xcdd7('0x4e')]['id']){delete _0x2f0656[_0xcdd7('0x4e')]['id'];}return db[_0xcdd7('0x2f')][_0xcdd7('0x4c')]({'where':{'id':_0x2f0656[_0xcdd7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2c2351,null))[_0xcdd7('0x28')](saveUpdates(_0x2f0656['body'],null))[_0xcdd7('0x28')](respondWithResult(_0x2c2351,null))[_0xcdd7('0x4a')](handleError(_0x2c2351,null));};exports['destroy']=function(_0x3b1dba,_0x438d1c){return db[_0xcdd7('0x2f')]['find']({'where':{'id':_0x3b1dba['params']['id']}})[_0xcdd7('0x28')](handleEntityNotFound(_0x438d1c,null))[_0xcdd7('0x28')](removeEntity(_0x438d1c,null))[_0xcdd7('0x4a')](handleError(_0x438d1c,null));};exports[_0xcdd7('0x50')]=function(_0x1d4fe2,_0x22ca37){return db[_0xcdd7('0x2f')][_0xcdd7('0x29')]({'where':{'id':_0x1d4fe2[_0xcdd7('0x35')][_0xcdd7('0x51')]||[]},'raw':![],'individualHooks':!![]})[_0xcdd7('0x28')](respondWithResult(_0x22ca37,0xcc))[_0xcdd7('0x4a')](handleError(_0x22ca37,null));};exports['addFields']=function(_0x49458b,_0x4102cf,_0x21c64d){return db[_0xcdd7('0x52')][_0xcdd7('0x53')]({'where':{'id':_0x49458b[_0xcdd7('0x4b')]['id']}})[_0xcdd7('0x28')](handleEntityNotFound(_0x4102cf,null))['then'](function(_0xe0983a){if(_0xe0983a){return db[_0xcdd7('0x54')][_0xcdd7('0x55')](function(_0x25034d){return db['AnalyticFieldReport'][_0xcdd7('0x29')]({'where':{'CustomReportId':_0x49458b['params']['id']},'transaction':_0x25034d})[_0xcdd7('0x28')](function(_0x409bcd){var _0x3d3f9e=_[_0xcdd7('0x2e')](_0x49458b['body'],function(_0x2ea7d7){delete _0x2ea7d7['id'];_0x2ea7d7[_0xcdd7('0x56')]=_0x49458b['params']['id'];return _0x2ea7d7;});return db[_0xcdd7('0x2f')][_0xcdd7('0x4f')](_0x3d3f9e,{'transaction':_0x25034d});});})[_0xcdd7('0x28')](function(){return db['AnalyticFieldReport'][_0xcdd7('0x48')]({'where':{'CustomReportId':_0x49458b[_0xcdd7('0x4b')]['id']}});});}})[_0xcdd7('0x28')](respondWithResult(_0x4102cf,null))[_0xcdd7('0x4a')](handleError(_0x4102cf,null));};
\ No newline at end of file
+var _0xba5b=['fields','attributes','length','nolimit','order','filters','filter','where','map','VIRTUAL','merge','options','includeAll','include','rows','show','params','find','catch','create','body','bulkCreate','update','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','then','error','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','keys','intersection'];(function(_0xc3083f,_0x5ac664){var _0x8e45bb=function(_0x466769){while(--_0x466769){_0xc3083f['push'](_0xc3083f['shift']());}};_0x8e45bb(++_0x5ac664);}(_0xba5b,0xc8));var _0xbba5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xba5b[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xbba5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbba5('0x1'));var jsonpatch=require(_0xbba5('0x2'));var rp=require('request-promise');var moment=require(_0xbba5('0x3'));var BPromise=require(_0xbba5('0x4'));var Mustache=require(_0xbba5('0x5'));var util=require(_0xbba5('0x6'));var path=require(_0xbba5('0x7'));var sox=require(_0xbba5('0x8'));var csv=require(_0xbba5('0x9'));var ejs=require(_0xbba5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbba5('0xb'));var crypto=require('crypto');var jsforce=require(_0xbba5('0xc'));var deskjs=require(_0xbba5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbba5('0xe'));var Papa=require(_0xbba5('0xf'));var Redis=require(_0xbba5('0x10'));var authService=require(_0xbba5('0x11'));var qs=require(_0xbba5('0x12'));var as=require(_0xbba5('0x13'));var hardwareService=require(_0xbba5('0x14'));var logger=require(_0xbba5('0x15'))(_0xbba5('0x16'));var utils=require(_0xbba5('0x17'));var config=require(_0xbba5('0x18'));var licenseUtil=require(_0xbba5('0x19'));var db=require(_0xbba5('0x1a'))['db'];function respondWithStatusCode(_0xcfb731,_0x4510d5){_0x4510d5=_0x4510d5||0xcc;return function(_0x379a65){if(_0x379a65){return _0xcfb731['sendStatus'](_0x4510d5);}return _0xcfb731[_0xbba5('0x1b')](_0x4510d5)[_0xbba5('0x1c')]();};}function respondWithResult(_0xd95148,_0x47f8fd){_0x47f8fd=_0x47f8fd||0xc8;return function(_0x3d02d2){if(_0x3d02d2){return _0xd95148[_0xbba5('0x1b')](_0x47f8fd)['json'](_0x3d02d2);}};}function respondWithFilteredResult(_0xc5c848,_0x449c72){return function(_0x3b41f6){if(_0x3b41f6){var _0x3f145b=typeof _0x449c72[_0xbba5('0x1d')]===_0xbba5('0x1e')&&typeof _0x449c72[_0xbba5('0x1f')]===_0xbba5('0x1e');var _0x1622f7=_0x3b41f6[_0xbba5('0x20')];var _0x1d64a7=_0x3f145b?0x0:_0x449c72[_0xbba5('0x1d')];var _0x289498=_0x3f145b?_0x3b41f6['count']:_0x449c72[_0xbba5('0x1d')]+_0x449c72[_0xbba5('0x1f')];var _0x40b2c2;if(_0x289498>=_0x1622f7){_0x289498=_0x1622f7;_0x40b2c2=0xc8;}else{_0x40b2c2=0xce;}_0xc5c848[_0xbba5('0x1b')](_0x40b2c2);return _0xc5c848[_0xbba5('0x21')](_0xbba5('0x22'),_0x1d64a7+'-'+_0x289498+'/'+_0x1622f7)[_0xbba5('0x23')](_0x3b41f6);}return null;};}function patchUpdates(_0x829a0f){return function(_0x1080a9){try{jsonpatch[_0xbba5('0x24')](_0x1080a9,_0x829a0f,!![]);}catch(_0x487f3a){return BPromise['reject'](_0x487f3a);}return _0x1080a9[_0xbba5('0x25')]();};}function saveUpdates(_0x1a12fc,_0x3d2d77){return function(_0x3ba421){if(_0x3ba421){return _0x3ba421['update'](_0x1a12fc)['then'](function(_0xb80ff8){return _0xb80ff8;});}return null;};}function removeEntity(_0x3a26f5,_0x37b04e){return function(_0x214471){if(_0x214471){return _0x214471[_0xbba5('0x26')]()[_0xbba5('0x27')](function(){_0x3a26f5[_0xbba5('0x1b')](0xcc)[_0xbba5('0x1c')]();});}};}function handleEntityNotFound(_0x1cd0bb,_0xe9dc32){return function(_0x51c9eb){if(!_0x51c9eb){_0x1cd0bb['sendStatus'](0x194);}return _0x51c9eb;};}function handleError(_0x235cfb,_0x2f6d8b){_0x2f6d8b=_0x2f6d8b||0x1f4;return function(_0x35d96e){logger[_0xbba5('0x28')](_0x35d96e['stack']);if(_0x35d96e[_0xbba5('0x29')]){delete _0x35d96e[_0xbba5('0x29')];}_0x235cfb[_0xbba5('0x1b')](_0x2f6d8b)[_0xbba5('0x2a')](_0x35d96e);};}exports[_0xbba5('0x2b')]=function(_0x1c77a5,_0x4d5aea){var _0x5bedaa={},_0x578ea2={},_0x151795={'count':0x0,'rows':[]};var _0x3c0c48=_['map'](db[_0xbba5('0x2c')][_0xbba5('0x2d')],function(_0xf2c6a5){return{'name':_0xf2c6a5[_0xbba5('0x2e')],'type':_0xf2c6a5[_0xbba5('0x2f')]['key']};});_0x578ea2[_0xbba5('0x30')]=_['map'](_0x3c0c48,_0xbba5('0x29'));_0x578ea2[_0xbba5('0x31')]=_[_0xbba5('0x32')](_0x1c77a5['query']);_0x578ea2['filters']=_[_0xbba5('0x33')](_0x578ea2[_0xbba5('0x30')],_0x578ea2[_0xbba5('0x31')]);_0x5bedaa['attributes']=_['intersection'](_0x578ea2[_0xbba5('0x30')],qs[_0xbba5('0x34')](_0x1c77a5[_0xbba5('0x31')][_0xbba5('0x34')]));_0x5bedaa[_0xbba5('0x35')]=_0x5bedaa[_0xbba5('0x35')][_0xbba5('0x36')]?_0x5bedaa['attributes']:_0x578ea2[_0xbba5('0x30')];if(!_0x1c77a5[_0xbba5('0x31')]['hasOwnProperty'](_0xbba5('0x37'))){_0x5bedaa['limit']=qs['limit'](_0x1c77a5[_0xbba5('0x31')][_0xbba5('0x1f')]);_0x5bedaa['offset']=qs[_0xbba5('0x1d')](_0x1c77a5['query']['offset']);}_0x5bedaa[_0xbba5('0x38')]=qs['sort'](_0x1c77a5['query']['sort']);_0x5bedaa['where']=qs[_0xbba5('0x39')](_['pick'](_0x1c77a5[_0xbba5('0x31')],_0x578ea2[_0xbba5('0x39')]),_0x3c0c48);if(_0x1c77a5[_0xbba5('0x31')][_0xbba5('0x3a')]){_0x5bedaa['where']=_['merge'](_0x5bedaa[_0xbba5('0x3b')],{'$or':_[_0xbba5('0x3c')](_0x3c0c48,function(_0x41b7e6){if(_0x41b7e6[_0xbba5('0x2f')]!==_0xbba5('0x3d')){var _0x192c8b={};_0x192c8b[_0x41b7e6[_0xbba5('0x29')]]={'$like':'%'+_0x1c77a5[_0xbba5('0x31')]['filter']+'%'};return _0x192c8b;}})});}_0x5bedaa=_[_0xbba5('0x3e')]({},_0x5bedaa,_0x1c77a5[_0xbba5('0x3f')]);var _0x533997={'where':_0x5bedaa[_0xbba5('0x3b')]};return db[_0xbba5('0x2c')][_0xbba5('0x20')](_0x533997)['then'](function(_0x1e3234){_0x151795[_0xbba5('0x20')]=_0x1e3234;if(_0x1c77a5[_0xbba5('0x31')][_0xbba5('0x40')]){_0x5bedaa[_0xbba5('0x41')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x5bedaa);})[_0xbba5('0x27')](function(_0x7d98f0){_0x151795[_0xbba5('0x42')]=_0x7d98f0;return _0x151795;})[_0xbba5('0x27')](respondWithFilteredResult(_0x4d5aea,_0x5bedaa))['catch'](handleError(_0x4d5aea,null));};exports[_0xbba5('0x43')]=function(_0x9cd659,_0x15bc39){var _0x1d39db={'raw':![],'where':{'id':_0x9cd659[_0xbba5('0x44')]['id']}},_0x55b84f={};_0x55b84f[_0xbba5('0x30')]=_[_0xbba5('0x32')](db[_0xbba5('0x2c')][_0xbba5('0x2d')]);_0x55b84f['query']=_[_0xbba5('0x32')](_0x9cd659[_0xbba5('0x31')]);_0x55b84f[_0xbba5('0x39')]=_[_0xbba5('0x33')](_0x55b84f['model'],_0x55b84f[_0xbba5('0x31')]);_0x1d39db[_0xbba5('0x35')]=_['intersection'](_0x55b84f[_0xbba5('0x30')],qs[_0xbba5('0x34')](_0x9cd659['query'][_0xbba5('0x34')]));_0x1d39db[_0xbba5('0x35')]=_0x1d39db[_0xbba5('0x35')][_0xbba5('0x36')]?_0x1d39db['attributes']:_0x55b84f[_0xbba5('0x30')];if(_0x9cd659[_0xbba5('0x31')][_0xbba5('0x40')]){_0x1d39db['include']=[{'all':!![]}];}_0x1d39db=_['merge']({},_0x1d39db,_0x9cd659[_0xbba5('0x3f')]);return db[_0xbba5('0x2c')][_0xbba5('0x45')](_0x1d39db)['then'](handleEntityNotFound(_0x15bc39,null))[_0xbba5('0x27')](respondWithResult(_0x15bc39,null))[_0xbba5('0x46')](handleError(_0x15bc39,null));};exports[_0xbba5('0x47')]=function(_0x9a128c,_0x379621){return db[_0xbba5('0x2c')]['create'](_0x9a128c[_0xbba5('0x48')],{})[_0xbba5('0x27')](respondWithResult(_0x379621,0xc9))[_0xbba5('0x46')](handleError(_0x379621,null));};exports[_0xbba5('0x49')]=function(_0x2824b4,_0x72097f){return db['AnalyticFieldReport']['bulkCreate'](_0x2824b4[_0xbba5('0x48')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x72097f,0xc9))['catch'](handleError(_0x72097f,null));};exports[_0xbba5('0x4a')]=function(_0x41fbaa,_0x48ab7a){if(_0x41fbaa[_0xbba5('0x48')]['id']){delete _0x41fbaa[_0xbba5('0x48')]['id'];}return db[_0xbba5('0x2c')][_0xbba5('0x45')]({'where':{'id':_0x41fbaa['params']['id']}})['then'](handleEntityNotFound(_0x48ab7a,null))[_0xbba5('0x27')](saveUpdates(_0x41fbaa[_0xbba5('0x48')],null))[_0xbba5('0x27')](respondWithResult(_0x48ab7a,null))['catch'](handleError(_0x48ab7a,null));};exports[_0xbba5('0x26')]=function(_0x248f02,_0x4483ee){return db['AnalyticFieldReport']['find']({'where':{'id':_0x248f02[_0xbba5('0x44')]['id']}})[_0xbba5('0x27')](handleEntityNotFound(_0x4483ee,null))[_0xbba5('0x27')](removeEntity(_0x4483ee,null))[_0xbba5('0x46')](handleError(_0x4483ee,null));};exports[_0xbba5('0x4b')]=function(_0x2d3cbd,_0x50da4f){return db['AnalyticFieldReport'][_0xbba5('0x26')]({'where':{'id':_0x2d3cbd[_0xbba5('0x31')][_0xbba5('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xbba5('0x27')](respondWithResult(_0x50da4f,0xcc))['catch'](handleError(_0x50da4f,null));};exports[_0xbba5('0x4d')]=function(_0x380980,_0x58cebd,_0x515e1a){return db[_0xbba5('0x4e')][_0xbba5('0x4f')]({'where':{'id':_0x380980['params']['id']}})[_0xbba5('0x27')](handleEntityNotFound(_0x58cebd,null))[_0xbba5('0x27')](function(_0x893960){if(_0x893960){return db[_0xbba5('0x50')][_0xbba5('0x51')](function(_0x59a85b){return db[_0xbba5('0x2c')][_0xbba5('0x26')]({'where':{'CustomReportId':_0x380980[_0xbba5('0x44')]['id']},'transaction':_0x59a85b})[_0xbba5('0x27')](function(_0x2d10e1){var _0x394043=_[_0xbba5('0x3c')](_0x380980['body'],function(_0x3fe953){delete _0x3fe953['id'];_0x3fe953[_0xbba5('0x52')]=_0x380980[_0xbba5('0x44')]['id'];return _0x3fe953;});return db[_0xbba5('0x2c')]['bulkCreate'](_0x394043,{'transaction':_0x59a85b});});})['then'](function(){return db[_0xbba5('0x2c')][_0xbba5('0x53')]({'where':{'CustomReportId':_0x380980[_0xbba5('0x44')]['id']}});});}})[_0xbba5('0x27')](respondWithResult(_0x58cebd,null))[_0xbba5('0x46')](handleError(_0x58cebd,null));};
\ No newline at end of file
index 9794e49..dd8045a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4a10=['api','bluebird','path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util'];(function(_0x582711,_0x30db0a){var _0xb6621b=function(_0x532ca4){while(--_0x532ca4){_0x582711['push'](_0x582711['shift']());}};_0xb6621b(++_0x30db0a);}(_0x4a10,0x132));var _0x04a1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4a10[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x04a1('0x0'));var util=require(_0x04a1('0x1'));var logger=require('../../config/logger')(_0x04a1('0x2'));var moment=require('moment');var BPromise=require(_0x04a1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04a1('0x4'));var rimraf=require('rimraf');var config=require(_0x04a1('0x5'));var attributes=require(_0x04a1('0x6'));module[_0x04a1('0x7')]=function(_0x25bda3,_0x5d503c){return _0x25bda3[_0x04a1('0x8')](_0x04a1('0x9'),attributes,{'tableName':_0x04a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xbc5d=['define','AnalyticFieldReport','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','exports'];(function(_0x3bc855,_0x5d145c){var _0x26614a=function(_0x44e6f9){while(--_0x44e6f9){_0x3bc855['push'](_0x3bc855['shift']());}};_0x26614a(++_0x5d145c);}(_0xbc5d,0x176));var _0xdbc5=function(_0x4e1258,_0x3fb658){_0x4e1258=_0x4e1258-0x0;var _0xd82437=_0xbc5d[_0x4e1258];return _0xd82437;};'use strict';var _=require(_0xdbc5('0x0'));var util=require(_0xdbc5('0x1'));var logger=require(_0xdbc5('0x2'))(_0xdbc5('0x3'));var moment=require('moment');var BPromise=require(_0xdbc5('0x4'));var rp=require(_0xdbc5('0x5'));var fs=require('fs');var path=require(_0xdbc5('0x6'));var rimraf=require(_0xdbc5('0x7'));var config=require('../../config/environment');var attributes=require(_0xdbc5('0x8'));module[_0xdbc5('0x9')]=function(_0x46eea7,_0x26a8c4){return _0x46eea7[_0xdbc5('0xa')](_0xdbc5('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2fce7ea..adcafb0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x96fd=['info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x55897e,_0x5e0b02){var _0x48e06=function(_0x15bae1){while(--_0x15bae1){_0x55897e['push'](_0x55897e['shift']());}};_0x48e06(++_0x5e0b02);}(_0x96fd,0x1df));var _0xd96f=function(_0x47b1e8,_0x3a06ae){_0x47b1e8=_0x47b1e8-0x0;var _0x31dde5=_0x96fd[_0x47b1e8];return _0x31dde5;};'use strict';var _=require(_0xd96f('0x0'));var util=require(_0xd96f('0x1'));var moment=require(_0xd96f('0x2'));var BPromise=require(_0xd96f('0x3'));var rs=require(_0xd96f('0x4'));var fs=require('fs');var Redis=require(_0xd96f('0x5'));var db=require(_0xd96f('0x6'))['db'];var utils=require(_0xd96f('0x7'));var logger=require(_0xd96f('0x8'))(_0xd96f('0x9'));var config=require(_0xd96f('0xa'));var jayson=require(_0xd96f('0xb'));var client=jayson[_0xd96f('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x511c18,_0x18a4f8,_0x8edc22){return new BPromise(function(_0x879a94,_0x5ee975){return client[_0xd96f('0xd')](_0x511c18,_0x8edc22)[_0xd96f('0xe')](function(_0x49436d){logger[_0xd96f('0xf')](_0xd96f('0x10'),_0x18a4f8,_0xd96f('0x11'));logger[_0xd96f('0x12')](_0xd96f('0x13'),_0x18a4f8,_0xd96f('0x11'),JSON[_0xd96f('0x14')](_0x49436d));if(_0x49436d[_0xd96f('0x15')]){if(_0x49436d['error'][_0xd96f('0x16')]===0x1f4){logger[_0xd96f('0x15')](_0xd96f('0x10'),_0x18a4f8,_0x49436d['error'][_0xd96f('0x17')]);return _0x5ee975(_0x49436d[_0xd96f('0x15')][_0xd96f('0x17')]);}logger['error'](_0xd96f('0x10'),_0x18a4f8,_0x49436d[_0xd96f('0x15')][_0xd96f('0x17')]);return _0x879a94(_0x49436d['error'][_0xd96f('0x17')]);}else{logger[_0xd96f('0xf')](_0xd96f('0x10'),_0x18a4f8,_0xd96f('0x11'));_0x879a94(_0x49436d[_0xd96f('0x18')][_0xd96f('0x17')]);}})[_0xd96f('0x19')](function(_0x23ddce){logger[_0xd96f('0x15')](_0xd96f('0x10'),_0x18a4f8,_0x23ddce);_0x5ee975(_0x23ddce);});});}
\ No newline at end of file
+var _0x504c=['http','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x504c,0x171));var _0xc504=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x504c[_0x1d50f2];return _0x3769b8;};'use strict';var _=require(_0xc504('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc504('0x1'));var rs=require(_0xc504('0x2'));var fs=require('fs');var Redis=require(_0xc504('0x3'));var db=require(_0xc504('0x4'))['db'];var utils=require(_0xc504('0x5'));var logger=require(_0xc504('0x6'))(_0xc504('0x7'));var config=require('../../config/environment');var jayson=require(_0xc504('0x8'));var client=jayson['client'][_0xc504('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ec9ce,_0x21dfa3,_0x16d437){return new BPromise(function(_0xd74994,_0x2fcd98){return client['request'](_0x3ec9ce,_0x16d437)[_0xc504('0xa')](function(_0x46e709){logger['info'](_0xc504('0xb'),_0x21dfa3,_0xc504('0xc'));logger[_0xc504('0xd')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x21dfa3,_0xc504('0xc'),JSON[_0xc504('0xe')](_0x46e709));if(_0x46e709[_0xc504('0xf')]){if(_0x46e709[_0xc504('0xf')][_0xc504('0x10')]===0x1f4){logger[_0xc504('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x21dfa3,_0x46e709[_0xc504('0xf')][_0xc504('0x11')]);return _0x2fcd98(_0x46e709[_0xc504('0xf')][_0xc504('0x11')]);}logger['error'](_0xc504('0xb'),_0x21dfa3,_0x46e709[_0xc504('0xf')][_0xc504('0x11')]);return _0xd74994(_0x46e709[_0xc504('0xf')][_0xc504('0x11')]);}else{logger[_0xc504('0x12')](_0xc504('0xb'),_0x21dfa3,_0xc504('0xc'));_0xd74994(_0x46e709[_0xc504('0x13')][_0xc504('0x11')]);}})[_0xc504('0x14')](function(_0x1ae906){logger[_0xc504('0xf')](_0xc504('0xb'),_0x21dfa3,_0x1ae906);_0x2fcd98(_0x1ae906);});});}
\ No newline at end of file
index e14ff00..bccfcad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x454150,_0x114040){var _0x5e800f=function(_0x476375){while(--_0x476375){_0x454150['push'](_0x454150['shift']());}};_0x5e800f(++_0x114040);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router;
\ No newline at end of file
+var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x295c7d,_0x4ab81d){var _0x5b09a0=function(_0x2d630d){while(--_0x2d630d){_0x295c7d['push'](_0x295c7d['shift']());}};_0x5b09a0(++_0x4ab81d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router;
\ No newline at end of file
index 6dc6c72..68ca334 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x86fd=['name','TEXT','sequelize','exports','STRING'];(function(_0x4def54,_0x36de1d){var _0x137bee=function(_0x1dd6f4){while(--_0x1dd6f4){_0x4def54['push'](_0x4def54['shift']());}};_0x137bee(++_0x36de1d);}(_0x86fd,0xa7));var _0xd86f=function(_0x282ccc,_0x5d66a1){_0x282ccc=_0x282ccc-0x0;var _0x27c2dd=_0x86fd[_0x282ccc];return _0x27c2dd;};'use strict';var Sequelize=require(_0xd86f('0x0'));module[_0xd86f('0x1')]={'name':{'type':Sequelize[_0xd86f('0x2')],'allowNull':![],'unique':_0xd86f('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xd86f('0x4')]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x37b4=['STRING','name','sequelize'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0x37b4,0xef));var _0x437b=function(_0xe4f7a3,_0x449042){_0xe4f7a3=_0xe4f7a3-0x0;var _0xb1da7c=_0x37b4[_0xe4f7a3];return _0xb1da7c;};'use strict';var Sequelize=require(_0x437b('0x0'));module['exports']={'name':{'type':Sequelize[_0x437b('0x1')],'allowNull':![],'unique':_0x437b('0x2')},'table':{'type':Sequelize[_0x437b('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x437b('0x1')]}};
\ No newline at end of file
index c2a6245..f0137f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x00bb=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','destroy','get','Metrics','then','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x5dc307,_0x199697){var _0x3edf3a=function(_0x15b60c){while(--_0x15b60c){_0x5dc307['push'](_0x5dc307['shift']());}};_0x3edf3a(++_0x199697);}(_0x00bb,0x1d8));var _0xb00b=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x00bb[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){var _0x44efe5=_0x3ab3cc[_0xb00b('0x1f')]({'plain':!![]});var _0x3c9500=_0xb00b('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c9500,'resourceId':_0x44efe5['id']}})[_0xb00b('0x21')](function(){return _0x3ab3cc;});})['then'](function(){_0x2896d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ac55,_0x73b6b0){return function(_0x2592cf){if(!_0x2592cf){_0x16ac55[_0xb00b('0x15')](0x194);}return _0x2592cf;};}function handleError(_0x1f14fa,_0x197379){_0x197379=_0x197379||0x1f4;return function(_0x15d3b9){logger['error'](_0x15d3b9[_0xb00b('0x22')]);if(_0x15d3b9['name']){delete _0x15d3b9[_0xb00b('0x23')];}_0x1f14fa[_0xb00b('0x16')](_0x197379)[_0xb00b('0x24')](_0x15d3b9);};}exports['index']=function(_0x2fc11a,_0x280ed3){var _0x16fbd5={},_0x183233={},_0x303625={'count':0x0,'rows':[]};var _0x2b9824=_[_0xb00b('0x25')](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x54e247){return{'name':_0x54e247[_0xb00b('0x28')],'type':_0x54e247[_0xb00b('0x29')]['key']};});_0x183233[_0xb00b('0x2a')]=_[_0xb00b('0x25')](_0x2b9824,'name');_0x183233[_0xb00b('0x2b')]=_['keys'](_0x2fc11a[_0xb00b('0x2b')]);_0x183233[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x183233[_0xb00b('0x2a')],_0x183233[_0xb00b('0x2b')]);_0x16fbd5[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x183233['model'],qs['fields'](_0x2fc11a['query'][_0xb00b('0x2f')]));_0x16fbd5[_0xb00b('0x2e')]=_0x16fbd5[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x16fbd5['attributes']:_0x183233[_0xb00b('0x2a')];if(!_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x16fbd5[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x16fbd5['offset']=qs['offset'](_0x2fc11a[_0xb00b('0x2b')]['offset']);}_0x16fbd5[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x34')]);_0x16fbd5[_0xb00b('0x35')]=qs[_0xb00b('0x2c')](_[_0xb00b('0x36')](_0x2fc11a['query'],_0x183233[_0xb00b('0x2c')]),_0x2b9824);if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x16fbd5[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x16fbd5[_0xb00b('0x35')],{'$or':_['map'](_0x2b9824,function(_0x36980a){if(_0x36980a[_0xb00b('0x29')]!=='VIRTUAL'){var _0x17ff34={};_0x17ff34[_0x36980a[_0xb00b('0x23')]]={'$like':'%'+_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]+'%'};return _0x17ff34;}})});}_0x16fbd5=_[_0xb00b('0x38')]({},_0x16fbd5,_0x2fc11a['options']);var _0x14ff6a={'where':_0x16fbd5[_0xb00b('0x35')]};return db[_0xb00b('0x26')][_0xb00b('0x39')](_0x14ff6a)['then'](function(_0x4867fe){_0x303625[_0xb00b('0x39')]=_0x4867fe;if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x16fbd5[_0xb00b('0x3b')]=[{'all':!![]}];}return db[_0xb00b('0x26')][_0xb00b('0x3c')](_0x16fbd5);})[_0xb00b('0x21')](function(_0x493841){_0x303625[_0xb00b('0x3d')]=_0x493841;return _0x303625;})[_0xb00b('0x21')](respondWithFilteredResult(_0x280ed3,_0x16fbd5))[_0xb00b('0x3e')](handleError(_0x280ed3,null));};exports[_0xb00b('0x3f')]=function(_0x302ded,_0x1dc4c5){var _0x2e3d83={'raw':!![],'where':{'id':_0x302ded[_0xb00b('0x40')]['id']}},_0x974a29={};_0x974a29[_0xb00b('0x2a')]=_[_0xb00b('0x41')](db[_0xb00b('0x26')]['rawAttributes']);_0x974a29[_0xb00b('0x2b')]=_[_0xb00b('0x41')](_0x302ded[_0xb00b('0x2b')]);_0x974a29[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],_0x974a29[_0xb00b('0x2b')]);_0x2e3d83[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],qs[_0xb00b('0x2f')](_0x302ded[_0xb00b('0x2b')]['fields']));_0x2e3d83['attributes']=_0x2e3d83['attributes'][_0xb00b('0x30')]?_0x2e3d83[_0xb00b('0x2e')]:_0x974a29['model'];if(_0x302ded[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x2e3d83[_0xb00b('0x3b')]=[{'all':!![]}];}_0x2e3d83=_[_0xb00b('0x38')]({},_0x2e3d83,_0x302ded['options']);return db['AnalyticMetric'][_0xb00b('0x42')](_0x2e3d83)[_0xb00b('0x21')](handleEntityNotFound(_0x1dc4c5,null))['then'](respondWithResult(_0x1dc4c5,null))['catch'](handleError(_0x1dc4c5,null));};exports[_0xb00b('0x43')]=function(_0x3a205d,_0x4e0be4){return db[_0xb00b('0x26')]['create'](_0x3a205d['body'],{})['then'](function(_0x465d90){var _0x481515=_0x3a205d[_0xb00b('0x44')][_0xb00b('0x1f')]({'plain':!![]});if(!_0x481515)throw new Error(_0xb00b('0x45'));if(_0x481515[_0xb00b('0x46')]===_0xb00b('0x44')){var _0xda60ca=_0x465d90['get']({'plain':!![]});var _0x5bd40c=_0xb00b('0x20');return db[_0xb00b('0x47')]['find']({'where':{'name':_0x5bd40c,'userProfileId':_0x481515[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x21')](function(_0x57f6ab){if(_0x57f6ab&&_0x57f6ab[_0xb00b('0x49')]===0x0){return db[_0xb00b('0x4a')][_0xb00b('0x43')]({'name':_0xda60ca['name'],'resourceId':_0xda60ca['id'],'type':_0x57f6ab['name'],'sectionId':_0x57f6ab['id']},{})[_0xb00b('0x21')](function(){return _0x465d90;});}else{return _0x465d90;}})[_0xb00b('0x3e')](function(_0x12737d){logger[_0xb00b('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12737d);throw _0x12737d;});}return _0x465d90;})[_0xb00b('0x21')](respondWithResult(_0x4e0be4,0xc9))[_0xb00b('0x3e')](handleError(_0x4e0be4,null));};exports['update']=function(_0x4cd9fd,_0x160965){if(_0x4cd9fd['body']['id']){delete _0x4cd9fd[_0xb00b('0x4c')]['id'];}return db[_0xb00b('0x26')][_0xb00b('0x42')]({'where':{'id':_0x4cd9fd[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x160965,null))[_0xb00b('0x21')](saveUpdates(_0x4cd9fd['body'],null))[_0xb00b('0x21')](respondWithResult(_0x160965,null))['catch'](handleError(_0x160965,null));};exports[_0xb00b('0x1e')]=function(_0x98caa9,_0x4129ba){return db['AnalyticMetric'][_0xb00b('0x42')]({'where':{'id':_0x98caa9[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x4129ba,null))['then'](removeEntity(_0x4129ba,null))[_0xb00b('0x3e')](handleError(_0x4129ba,null));};
\ No newline at end of file
+var _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5bd858,_0x5e3873){var _0x41765e=function(_0x28a589){while(--_0x28a589){_0x5bd858['push'](_0x5bd858['shift']());}};_0x41765e(++_0x5e3873);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x56b878,_0x4be9aa){_0x56b878=_0x56b878-0x0;var _0x32b9ec=_0x7fbe[_0x56b878];return _0x32b9ec;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));};
\ No newline at end of file
index bb71a92..0d805b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd046=['rimraf','./analyticMetric.attributes','define','util','../../config/logger','api','bluebird'];(function(_0x461e29,_0x5144f9){var _0x1469bd=function(_0x380858){while(--_0x380858){_0x461e29['push'](_0x461e29['shift']());}};_0x1469bd(++_0x5144f9);}(_0xd046,0x129));var _0x6d04=function(_0x5e43c1,_0x1101bc){_0x5e43c1=_0x5e43c1-0x0;var _0x15ebb5=_0xd046[_0x5e43c1];return _0x15ebb5;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var logger=require(_0x6d04('0x1'))(_0x6d04('0x2'));var moment=require('moment');var BPromise=require(_0x6d04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d04('0x4'));var config=require('../../config/environment');var attributes=require(_0x6d04('0x5'));module['exports']=function(_0x4bacb1,_0xf3b4e7){return _0x4bacb1[_0x6d04('0x6')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x15ef=['request-promise','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','util','../../config/logger','moment','bluebird'];(function(_0x161ec6,_0x580285){var _0x477176=function(_0x1afa52){while(--_0x1afa52){_0x161ec6['push'](_0x161ec6['shift']());}};_0x477176(++_0x580285);}(_0x15ef,0x80));var _0xf15e=function(_0x19d099,_0x5bf3df){_0x19d099=_0x19d099-0x0;var _0x553733=_0x15ef[_0x19d099];return _0x553733;};'use strict';var _=require('lodash');var util=require(_0xf15e('0x0'));var logger=require(_0xf15e('0x1'))('api');var moment=require(_0xf15e('0x2'));var BPromise=require(_0xf15e('0x3'));var rp=require(_0xf15e('0x4'));var fs=require('fs');var path=require(_0xf15e('0x5'));var rimraf=require(_0xf15e('0x6'));var config=require('../../config/environment');var attributes=require(_0xf15e('0x7'));module[_0xf15e('0x8')]=function(_0x5e96b4,_0x5ba863){return _0x5e96b4[_0xf15e('0x9')](_0xf15e('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2c8e869..5a5c76e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x419a=['request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x419a,0xb8));var _0xa419=function(_0x10425e,_0x1c2c1c){_0x10425e=_0x10425e-0x0;var _0x35338f=_0x419a[_0x10425e];return _0x35338f;};'use strict';var _=require(_0xa419('0x0'));var util=require(_0xa419('0x1'));var moment=require(_0xa419('0x2'));var BPromise=require(_0xa419('0x3'));var rs=require(_0xa419('0x4'));var fs=require('fs');var Redis=require(_0xa419('0x5'));var db=require(_0xa419('0x6'))['db'];var utils=require(_0xa419('0x7'));var logger=require('../../config/logger')(_0xa419('0x8'));var config=require(_0xa419('0x9'));var jayson=require(_0xa419('0xa'));var client=jayson['client'][_0xa419('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c1efb,_0x40675c,_0x59024b){return new BPromise(function(_0x8a4af3,_0x49d4c1){return client[_0xa419('0xc')](_0x1c1efb,_0x59024b)[_0xa419('0xd')](function(_0x336487){logger[_0xa419('0xe')](_0xa419('0xf'),_0x40675c,_0xa419('0x10'));logger[_0xa419('0x11')](_0xa419('0x12'),_0x40675c,_0xa419('0x10'),JSON[_0xa419('0x13')](_0x336487));if(_0x336487['error']){if(_0x336487[_0xa419('0x14')][_0xa419('0x15')]===0x1f4){logger[_0xa419('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x40675c,_0x336487[_0xa419('0x14')]['message']);return _0x49d4c1(_0x336487[_0xa419('0x14')][_0xa419('0x16')]);}logger[_0xa419('0x14')](_0xa419('0xf'),_0x40675c,_0x336487[_0xa419('0x14')][_0xa419('0x16')]);return _0x8a4af3(_0x336487[_0xa419('0x14')][_0xa419('0x16')]);}else{logger[_0xa419('0xe')](_0xa419('0xf'),_0x40675c,_0xa419('0x10'));_0x8a4af3(_0x336487[_0xa419('0x17')][_0xa419('0x16')]);}})[_0xa419('0x18')](function(_0x5a2705){logger[_0xa419('0x14')](_0xa419('0xf'),_0x40675c,_0x5a2705);_0x49d4c1(_0x5a2705);});});}
\ No newline at end of file
+var _0x11bb=['stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x13d843,_0x303817){var _0x3df322=function(_0x1b7c94){while(--_0x1b7c94){_0x13d843['push'](_0x13d843['shift']());}};_0x3df322(++_0x303817);}(_0x11bb,0x180));var _0xb11b=function(_0xd22c0,_0x2629ce){_0xd22c0=_0xd22c0-0x0;var _0x3de320=_0x11bb[_0xd22c0];return _0x3de320;};'use strict';var _=require(_0xb11b('0x0'));var util=require(_0xb11b('0x1'));var moment=require(_0xb11b('0x2'));var BPromise=require(_0xb11b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb11b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb11b('0x5'));var logger=require(_0xb11b('0x6'))(_0xb11b('0x7'));var config=require(_0xb11b('0x8'));var jayson=require(_0xb11b('0x9'));var client=jayson['client'][_0xb11b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bd474,_0x5b6624,_0xb659e4){return new BPromise(function(_0x40dd76,_0x11484b){return client[_0xb11b('0xb')](_0x3bd474,_0xb659e4)[_0xb11b('0xc')](function(_0x4f339a){logger[_0xb11b('0xd')](_0xb11b('0xe'),_0x5b6624,'request\x20sent');logger['debug'](_0xb11b('0xf'),_0x5b6624,'request\x20sent',JSON[_0xb11b('0x10')](_0x4f339a));if(_0x4f339a[_0xb11b('0x11')]){if(_0x4f339a[_0xb11b('0x11')][_0xb11b('0x12')]===0x1f4){logger['error'](_0xb11b('0xe'),_0x5b6624,_0x4f339a['error'][_0xb11b('0x13')]);return _0x11484b(_0x4f339a[_0xb11b('0x11')][_0xb11b('0x13')]);}logger[_0xb11b('0x11')](_0xb11b('0xe'),_0x5b6624,_0x4f339a[_0xb11b('0x11')]['message']);return _0x40dd76(_0x4f339a[_0xb11b('0x11')][_0xb11b('0x13')]);}else{logger['info'](_0xb11b('0xe'),_0x5b6624,'request\x20sent');_0x40dd76(_0x4f339a['result']['message']);}})['catch'](function(_0x3ca23f){logger[_0xb11b('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x5b6624,_0x3ca23f);_0x11484b(_0x3ca23f);});});}
\ No newline at end of file
index f1d67d8..afc3980 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9fd4=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','/:id'];(function(_0x50b5c4,_0x1dcc6a){var _0x170030=function(_0xeb729){while(--_0xeb729){_0x50b5c4['push'](_0x50b5c4['shift']());}};_0x170030(++_0x1dcc6a);}(_0x9fd4,0x16c));var _0x49fd=function(_0x423097,_0x8a09f4){_0x423097=_0x423097-0x0;var _0x3a73f1=_0x9fd4[_0x423097];return _0x3a73f1;};'use strict';var multer=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var path=require(_0x49fd('0x2'));var timeout=require(_0x49fd('0x3'));var express=require(_0x49fd('0x4'));var router=express[_0x49fd('0x5')]();var fs_extra=require(_0x49fd('0x6'));var auth=require(_0x49fd('0x7'));var interaction=require(_0x49fd('0x8'));var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0x49fd('0x9')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0xb')]);router[_0x49fd('0x9')]('/:id',auth[_0x49fd('0xa')](),controller[_0x49fd('0xc')]);router[_0x49fd('0xd')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0xe')]);router['put'](_0x49fd('0xf'),auth[_0x49fd('0xa')](),controller[_0x49fd('0x10')]);router[_0x49fd('0x11')](_0x49fd('0xf'),auth[_0x49fd('0xa')](),controller[_0x49fd('0x12')]);module['exports']=router;
\ No newline at end of file
+var _0xfd8f=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xfd8f,0xae));var _0xffd8=function(_0x53bd96,_0x5dc27b){_0x53bd96=_0x53bd96-0x0;var _0x2a42dd=_0xfd8f[_0x53bd96];return _0x2a42dd;};'use strict';var multer=require(_0xffd8('0x0'));var util=require(_0xffd8('0x1'));var path=require('path');var timeout=require(_0xffd8('0x2'));var express=require(_0xffd8('0x3'));var router=express[_0xffd8('0x4')]();var fs_extra=require(_0xffd8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xffd8('0x6'));var config=require(_0xffd8('0x7'));var controller=require('./analyticMetric.controller');router[_0xffd8('0x8')]('/',auth[_0xffd8('0x9')](),controller[_0xffd8('0xa')]);router[_0xffd8('0x8')](_0xffd8('0xb'),auth[_0xffd8('0x9')](),controller['show']);router[_0xffd8('0xc')]('/',auth[_0xffd8('0x9')](),controller[_0xffd8('0xd')]);router[_0xffd8('0xe')]('/:id',auth[_0xffd8('0x9')](),controller[_0xffd8('0xf')]);router[_0xffd8('0x10')](_0xffd8('0xb'),auth[_0xffd8('0x9')](),controller[_0xffd8('0x11')]);module[_0xffd8('0x12')]=router;
\ No newline at end of file
index ca255ab..3b91bff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6b19=['sequelize'];(function(_0x1cbe80,_0x229040){var _0x2cce24=function(_0x34d126){while(--_0x34d126){_0x1cbe80['push'](_0x1cbe80['shift']());}};_0x2cce24(++_0x229040);}(_0x6b19,0xdc));var _0x96b1=function(_0x1c524c,_0x4a74a2){_0x1c524c=_0x1c524c-0x0;var _0x22e72f=_0x6b19[_0x1c524c];return _0x22e72f;};'use strict';var Sequelize=require(_0x96b1('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}};
\ No newline at end of file
+var _0x72bb=['exports','TEXT'];(function(_0x4fde69,_0x2a3016){var _0x15d174=function(_0x50b8fe){while(--_0x50b8fe){_0x4fde69['push'](_0x4fde69['shift']());}};_0x15d174(++_0x2a3016);}(_0x72bb,0x1c4));var _0xb72b=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x72bb[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require('sequelize');module[_0xb72b('0x0')]={'tree':{'type':Sequelize[_0xb72b('0x1')],'allowNull':![]}};
\ No newline at end of file
index e7bf6ff..d5c652c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x65be=['limit','count','save','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','AnalyticTreeReport','catch','show','params','includeAll','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined'];(function(_0x4a1f01,_0x45e5c4){var _0x135de8=function(_0x39a489){while(--_0x39a489){_0x4a1f01['push'](_0x4a1f01['shift']());}};_0x135de8(++_0x45e5c4);}(_0x65be,0xfe));var _0xe65b=function(_0x591964,_0x3e0a1a){_0x591964=_0x591964-0x0;var _0x3cfd37=_0x65be[_0x591964];return _0x3cfd37;};'use strict';var emlformat=require(_0xe65b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe65b('0x1'));var jsonpatch=require(_0xe65b('0x2'));var rp=require(_0xe65b('0x3'));var moment=require(_0xe65b('0x4'));var BPromise=require(_0xe65b('0x5'));var Mustache=require(_0xe65b('0x6'));var util=require(_0xe65b('0x7'));var path=require(_0xe65b('0x8'));var sox=require(_0xe65b('0x9'));var csv=require(_0xe65b('0xa'));var ejs=require(_0xe65b('0xb'));var fs=require('fs');var fs_extra=require(_0xe65b('0xc'));var _=require(_0xe65b('0xd'));var squel=require('squel');var crypto=require(_0xe65b('0xe'));var jsforce=require(_0xe65b('0xf'));var deskjs=require(_0xe65b('0x10'));var toCsv=require(_0xe65b('0xa'));var querystring=require(_0xe65b('0x11'));var Papa=require(_0xe65b('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe65b('0x13'));var as=require(_0xe65b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe65b('0x15'));var utils=require(_0xe65b('0x16'));var config=require(_0xe65b('0x17'));var licenseUtil=require(_0xe65b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e4393,_0x575caa){_0x575caa=_0x575caa||0xcc;return function(_0x11dccd){if(_0x11dccd){return _0x2e4393['sendStatus'](_0x575caa);}return _0x2e4393['status'](_0x575caa)[_0xe65b('0x19')]();};}function respondWithResult(_0x1a0c90,_0x4b17c1){_0x4b17c1=_0x4b17c1||0xc8;return function(_0xda560f){if(_0xda560f){return _0x1a0c90[_0xe65b('0x1a')](_0x4b17c1)[_0xe65b('0x1b')](_0xda560f);}};}function respondWithFilteredResult(_0x5257e9,_0x15ccd6){return function(_0x7cf41f){if(_0x7cf41f){var _0xe15fde=typeof _0x15ccd6[_0xe65b('0x1c')]===_0xe65b('0x1d')&&typeof _0x15ccd6[_0xe65b('0x1e')]==='undefined';var _0x2f62cf=_0x7cf41f[_0xe65b('0x1f')];var _0x33c7b9=_0xe15fde?0x0:_0x15ccd6[_0xe65b('0x1c')];var _0x489e2a=_0xe15fde?_0x7cf41f[_0xe65b('0x1f')]:_0x15ccd6[_0xe65b('0x1c')]+_0x15ccd6[_0xe65b('0x1e')];var _0x3aa432;if(_0x489e2a>=_0x2f62cf){_0x489e2a=_0x2f62cf;_0x3aa432=0xc8;}else{_0x3aa432=0xce;}_0x5257e9[_0xe65b('0x1a')](_0x3aa432);return _0x5257e9['set']('Content-Range',_0x33c7b9+'-'+_0x489e2a+'/'+_0x2f62cf)[_0xe65b('0x1b')](_0x7cf41f);}return null;};}function patchUpdates(_0x5b4d60){return function(_0x5592e7){try{jsonpatch['apply'](_0x5592e7,_0x5b4d60,!![]);}catch(_0x25dd36){return BPromise['reject'](_0x25dd36);}return _0x5592e7[_0xe65b('0x20')]();};}function saveUpdates(_0x43485b,_0x5fa73){return function(_0x47d605){if(_0x47d605){return _0x47d605[_0xe65b('0x21')](_0x43485b)[_0xe65b('0x22')](function(_0x24e44d){return _0x24e44d;});}return null;};}function removeEntity(_0x6034e8,_0x2c6c1b){return function(_0x43d315){if(_0x43d315){return _0x43d315[_0xe65b('0x23')]()[_0xe65b('0x22')](function(){_0x6034e8['status'](0xcc)[_0xe65b('0x19')]();});}};}function handleEntityNotFound(_0x4ead3f,_0x53ce6f){return function(_0x2471a6){if(!_0x2471a6){_0x4ead3f[_0xe65b('0x24')](0x194);}return _0x2471a6;};}function handleError(_0x466feb,_0x3a977a){_0x3a977a=_0x3a977a||0x1f4;return function(_0x262458){logger[_0xe65b('0x25')](_0x262458[_0xe65b('0x26')]);if(_0x262458[_0xe65b('0x27')]){delete _0x262458['name'];}_0x466feb['status'](_0x3a977a)[_0xe65b('0x28')](_0x262458);};}exports['index']=function(_0x49f052,_0x1f5a94){var _0xa18a6f={},_0x3496e5={},_0x512e0c={'count':0x0,'rows':[]};var _0x38b0a6=_[_0xe65b('0x29')](db['AnalyticTreeReport'][_0xe65b('0x2a')],function(_0x3c1511){return{'name':_0x3c1511[_0xe65b('0x2b')],'type':_0x3c1511[_0xe65b('0x2c')][_0xe65b('0x2d')]};});_0x3496e5[_0xe65b('0x2e')]=_['map'](_0x38b0a6,_0xe65b('0x27'));_0x3496e5['query']=_[_0xe65b('0x2f')](_0x49f052[_0xe65b('0x30')]);_0x3496e5[_0xe65b('0x31')]=_[_0xe65b('0x32')](_0x3496e5[_0xe65b('0x2e')],_0x3496e5[_0xe65b('0x30')]);_0xa18a6f[_0xe65b('0x33')]=_[_0xe65b('0x32')](_0x3496e5[_0xe65b('0x2e')],qs['fields'](_0x49f052[_0xe65b('0x30')][_0xe65b('0x34')]));_0xa18a6f[_0xe65b('0x33')]=_0xa18a6f[_0xe65b('0x33')][_0xe65b('0x35')]?_0xa18a6f[_0xe65b('0x33')]:_0x3496e5['model'];if(!_0x49f052['query'][_0xe65b('0x36')](_0xe65b('0x37'))){_0xa18a6f[_0xe65b('0x1e')]=qs[_0xe65b('0x1e')](_0x49f052[_0xe65b('0x30')][_0xe65b('0x1e')]);_0xa18a6f['offset']=qs[_0xe65b('0x1c')](_0x49f052[_0xe65b('0x30')][_0xe65b('0x1c')]);}_0xa18a6f['order']=qs['sort'](_0x49f052['query'][_0xe65b('0x38')]);_0xa18a6f[_0xe65b('0x39')]=qs[_0xe65b('0x31')](_['pick'](_0x49f052[_0xe65b('0x30')],_0x3496e5[_0xe65b('0x31')]),_0x38b0a6);if(_0x49f052[_0xe65b('0x30')][_0xe65b('0x3a')]){_0xa18a6f[_0xe65b('0x39')]=_['merge'](_0xa18a6f[_0xe65b('0x39')],{'$or':_['map'](_0x38b0a6,function(_0xdb5fe0){if(_0xdb5fe0[_0xe65b('0x2c')]!==_0xe65b('0x3b')){var _0x29c3fe={};_0x29c3fe[_0xdb5fe0[_0xe65b('0x27')]]={'$like':'%'+_0x49f052['query']['filter']+'%'};return _0x29c3fe;}})});}_0xa18a6f=_[_0xe65b('0x3c')]({},_0xa18a6f,_0x49f052[_0xe65b('0x3d')]);var _0x2cab17={'where':_0xa18a6f[_0xe65b('0x39')]};return db[_0xe65b('0x3e')][_0xe65b('0x1f')](_0x2cab17)[_0xe65b('0x22')](function(_0x1a679a){_0x512e0c[_0xe65b('0x1f')]=_0x1a679a;if(_0x49f052[_0xe65b('0x30')]['includeAll']){_0xa18a6f['include']=[{'all':!![]}];}return db[_0xe65b('0x3e')]['findAll'](_0xa18a6f);})[_0xe65b('0x22')](function(_0x591c3b){_0x512e0c['rows']=_0x591c3b;return _0x512e0c;})['then'](respondWithFilteredResult(_0x1f5a94,_0xa18a6f))[_0xe65b('0x3f')](handleError(_0x1f5a94,null));};exports[_0xe65b('0x40')]=function(_0xcae53a,_0x399f18){var _0x1a2c31={'raw':!![],'where':{'id':_0xcae53a[_0xe65b('0x41')]['id']}},_0x5c48e1={};_0x5c48e1[_0xe65b('0x2e')]=_[_0xe65b('0x2f')](db[_0xe65b('0x3e')][_0xe65b('0x2a')]);_0x5c48e1['query']=_[_0xe65b('0x2f')](_0xcae53a[_0xe65b('0x30')]);_0x5c48e1[_0xe65b('0x31')]=_[_0xe65b('0x32')](_0x5c48e1['model'],_0x5c48e1[_0xe65b('0x30')]);_0x1a2c31[_0xe65b('0x33')]=_[_0xe65b('0x32')](_0x5c48e1[_0xe65b('0x2e')],qs[_0xe65b('0x34')](_0xcae53a[_0xe65b('0x30')][_0xe65b('0x34')]));_0x1a2c31[_0xe65b('0x33')]=_0x1a2c31['attributes'][_0xe65b('0x35')]?_0x1a2c31[_0xe65b('0x33')]:_0x5c48e1[_0xe65b('0x2e')];if(_0xcae53a[_0xe65b('0x30')][_0xe65b('0x42')]){_0x1a2c31[_0xe65b('0x43')]=[{'all':!![]}];}_0x1a2c31=_[_0xe65b('0x3c')]({},_0x1a2c31,_0xcae53a[_0xe65b('0x3d')]);return db[_0xe65b('0x3e')][_0xe65b('0x44')](_0x1a2c31)[_0xe65b('0x22')](handleEntityNotFound(_0x399f18,null))[_0xe65b('0x22')](respondWithResult(_0x399f18,null))[_0xe65b('0x3f')](handleError(_0x399f18,null));};exports[_0xe65b('0x45')]=function(_0x322c1b,_0x25d818){return db['AnalyticTreeReport'][_0xe65b('0x45')](_0x322c1b[_0xe65b('0x46')],{})[_0xe65b('0x22')](respondWithResult(_0x25d818,0xc9))['catch'](handleError(_0x25d818,null));};exports['update']=function(_0x2ebed5,_0x56cafc){if(_0x2ebed5[_0xe65b('0x46')]['id']){delete _0x2ebed5['body']['id'];}return db[_0xe65b('0x3e')][_0xe65b('0x44')]({'where':{'id':_0x2ebed5['params']['id']}})['then'](handleEntityNotFound(_0x56cafc,null))[_0xe65b('0x22')](saveUpdates(_0x2ebed5[_0xe65b('0x46')],null))[_0xe65b('0x22')](respondWithResult(_0x56cafc,null))[_0xe65b('0x3f')](handleError(_0x56cafc,null));};exports[_0xe65b('0x23')]=function(_0x791190,_0x267ffe){return db[_0xe65b('0x3e')][_0xe65b('0x44')]({'where':{'id':_0x791190[_0xe65b('0x41')]['id']}})[_0xe65b('0x22')](handleEntityNotFound(_0x267ffe,null))[_0xe65b('0x22')](removeEntity(_0x267ffe,null))[_0xe65b('0x3f')](handleError(_0x267ffe,null));};
\ No newline at end of file
+var _0xe4cc=['type','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','where','pick','filter','VIRTUAL','merge','options','AnalyticTreeReport','includeAll','findAll','rows','show','params','keys','include','catch','create','body','find','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes'];(function(_0x31377f,_0x5f0c6a){var _0x50adbb=function(_0x34e949){while(--_0x34e949){_0x31377f['push'](_0x31377f['shift']());}};_0x50adbb(++_0x5f0c6a);}(_0xe4cc,0x144));var _0xce4c=function(_0x56e39f,_0x33c704){_0x56e39f=_0x56e39f-0x0;var _0x18651a=_0xe4cc[_0x56e39f];return _0x18651a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce4c('0x0'));var zipdir=require(_0xce4c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xce4c('0x2'));var BPromise=require(_0xce4c('0x3'));var Mustache=require(_0xce4c('0x4'));var util=require(_0xce4c('0x5'));var path=require('path');var sox=require(_0xce4c('0x6'));var csv=require(_0xce4c('0x7'));var ejs=require(_0xce4c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce4c('0x9'));var squel=require(_0xce4c('0xa'));var crypto=require(_0xce4c('0xb'));var jsforce=require(_0xce4c('0xc'));var deskjs=require(_0xce4c('0xd'));var toCsv=require(_0xce4c('0x7'));var querystring=require(_0xce4c('0xe'));var Papa=require(_0xce4c('0xf'));var Redis=require(_0xce4c('0x10'));var authService=require(_0xce4c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce4c('0x12'));var logger=require(_0xce4c('0x13'))(_0xce4c('0x14'));var utils=require(_0xce4c('0x15'));var config=require(_0xce4c('0x16'));var licenseUtil=require(_0xce4c('0x17'));var db=require(_0xce4c('0x18'))['db'];function respondWithStatusCode(_0x41c202,_0x477075){_0x477075=_0x477075||0xcc;return function(_0x500d65){if(_0x500d65){return _0x41c202[_0xce4c('0x19')](_0x477075);}return _0x41c202[_0xce4c('0x1a')](_0x477075)[_0xce4c('0x1b')]();};}function respondWithResult(_0x470d02,_0x4eef51){_0x4eef51=_0x4eef51||0xc8;return function(_0x187a4d){if(_0x187a4d){return _0x470d02[_0xce4c('0x1a')](_0x4eef51)[_0xce4c('0x1c')](_0x187a4d);}};}function respondWithFilteredResult(_0x5a36f1,_0xaa3c89){return function(_0x5bb524){if(_0x5bb524){var _0x1b4038=typeof _0xaa3c89[_0xce4c('0x1d')]===_0xce4c('0x1e')&&typeof _0xaa3c89[_0xce4c('0x1f')]==='undefined';var _0x4bc122=_0x5bb524[_0xce4c('0x20')];var _0x1d95c1=_0x1b4038?0x0:_0xaa3c89[_0xce4c('0x1d')];var _0x688590=_0x1b4038?_0x5bb524[_0xce4c('0x20')]:_0xaa3c89[_0xce4c('0x1d')]+_0xaa3c89[_0xce4c('0x1f')];var _0x46ae57;if(_0x688590>=_0x4bc122){_0x688590=_0x4bc122;_0x46ae57=0xc8;}else{_0x46ae57=0xce;}_0x5a36f1['status'](_0x46ae57);return _0x5a36f1[_0xce4c('0x21')](_0xce4c('0x22'),_0x1d95c1+'-'+_0x688590+'/'+_0x4bc122)['json'](_0x5bb524);}return null;};}function patchUpdates(_0xff47d4){return function(_0x522f73){try{jsonpatch[_0xce4c('0x23')](_0x522f73,_0xff47d4,!![]);}catch(_0x2700ff){return BPromise[_0xce4c('0x24')](_0x2700ff);}return _0x522f73['save']();};}function saveUpdates(_0x189128,_0x1c61ed){return function(_0x228e5f){if(_0x228e5f){return _0x228e5f[_0xce4c('0x25')](_0x189128)[_0xce4c('0x26')](function(_0x4ca8e1){return _0x4ca8e1;});}return null;};}function removeEntity(_0x39506c,_0x42d4ee){return function(_0x530bbc){if(_0x530bbc){return _0x530bbc[_0xce4c('0x27')]()['then'](function(){_0x39506c[_0xce4c('0x1a')](0xcc)[_0xce4c('0x1b')]();});}};}function handleEntityNotFound(_0x231b8f,_0x11653d){return function(_0x598cff){if(!_0x598cff){_0x231b8f[_0xce4c('0x19')](0x194);}return _0x598cff;};}function handleError(_0x1303e8,_0x24d6ce){_0x24d6ce=_0x24d6ce||0x1f4;return function(_0x1b7362){logger['error'](_0x1b7362[_0xce4c('0x28')]);if(_0x1b7362[_0xce4c('0x29')]){delete _0x1b7362[_0xce4c('0x29')];}_0x1303e8['status'](_0x24d6ce)[_0xce4c('0x2a')](_0x1b7362);};}exports[_0xce4c('0x2b')]=function(_0x56414c,_0x35714e){var _0x48022e={},_0x4bce74={},_0x20eddf={'count':0x0,'rows':[]};var _0x5b28e8=_[_0xce4c('0x2c')](db['AnalyticTreeReport'][_0xce4c('0x2d')],function(_0x127ffa){return{'name':_0x127ffa['fieldName'],'type':_0x127ffa[_0xce4c('0x2e')]['key']};});_0x4bce74['model']=_['map'](_0x5b28e8,_0xce4c('0x29'));_0x4bce74[_0xce4c('0x2f')]=_['keys'](_0x56414c[_0xce4c('0x2f')]);_0x4bce74[_0xce4c('0x30')]=_['intersection'](_0x4bce74['model'],_0x4bce74[_0xce4c('0x2f')]);_0x48022e[_0xce4c('0x31')]=_[_0xce4c('0x32')](_0x4bce74[_0xce4c('0x33')],qs[_0xce4c('0x34')](_0x56414c['query'][_0xce4c('0x34')]));_0x48022e[_0xce4c('0x31')]=_0x48022e['attributes'][_0xce4c('0x35')]?_0x48022e[_0xce4c('0x31')]:_0x4bce74[_0xce4c('0x33')];if(!_0x56414c[_0xce4c('0x2f')][_0xce4c('0x36')]('nolimit')){_0x48022e[_0xce4c('0x1f')]=qs[_0xce4c('0x1f')](_0x56414c[_0xce4c('0x2f')][_0xce4c('0x1f')]);_0x48022e[_0xce4c('0x1d')]=qs[_0xce4c('0x1d')](_0x56414c['query'][_0xce4c('0x1d')]);}_0x48022e[_0xce4c('0x37')]=qs['sort'](_0x56414c[_0xce4c('0x2f')]['sort']);_0x48022e[_0xce4c('0x38')]=qs[_0xce4c('0x30')](_[_0xce4c('0x39')](_0x56414c[_0xce4c('0x2f')],_0x4bce74[_0xce4c('0x30')]),_0x5b28e8);if(_0x56414c[_0xce4c('0x2f')][_0xce4c('0x3a')]){_0x48022e[_0xce4c('0x38')]=_['merge'](_0x48022e['where'],{'$or':_['map'](_0x5b28e8,function(_0x4215c7){if(_0x4215c7['type']!==_0xce4c('0x3b')){var _0x5e68a3={};_0x5e68a3[_0x4215c7['name']]={'$like':'%'+_0x56414c[_0xce4c('0x2f')]['filter']+'%'};return _0x5e68a3;}})});}_0x48022e=_[_0xce4c('0x3c')]({},_0x48022e,_0x56414c[_0xce4c('0x3d')]);var _0x5ab469={'where':_0x48022e[_0xce4c('0x38')]};return db[_0xce4c('0x3e')][_0xce4c('0x20')](_0x5ab469)[_0xce4c('0x26')](function(_0x38d091){_0x20eddf['count']=_0x38d091;if(_0x56414c['query'][_0xce4c('0x3f')]){_0x48022e['include']=[{'all':!![]}];}return db[_0xce4c('0x3e')][_0xce4c('0x40')](_0x48022e);})[_0xce4c('0x26')](function(_0x1ac65a){_0x20eddf[_0xce4c('0x41')]=_0x1ac65a;return _0x20eddf;})['then'](respondWithFilteredResult(_0x35714e,_0x48022e))['catch'](handleError(_0x35714e,null));};exports[_0xce4c('0x42')]=function(_0x3b90a4,_0x5c4ff5){var _0x8faac9={'raw':!![],'where':{'id':_0x3b90a4[_0xce4c('0x43')]['id']}},_0x57ea94={};_0x57ea94[_0xce4c('0x33')]=_[_0xce4c('0x44')](db[_0xce4c('0x3e')]['rawAttributes']);_0x57ea94[_0xce4c('0x2f')]=_['keys'](_0x3b90a4[_0xce4c('0x2f')]);_0x57ea94[_0xce4c('0x30')]=_['intersection'](_0x57ea94[_0xce4c('0x33')],_0x57ea94[_0xce4c('0x2f')]);_0x8faac9['attributes']=_['intersection'](_0x57ea94[_0xce4c('0x33')],qs[_0xce4c('0x34')](_0x3b90a4[_0xce4c('0x2f')][_0xce4c('0x34')]));_0x8faac9[_0xce4c('0x31')]=_0x8faac9[_0xce4c('0x31')][_0xce4c('0x35')]?_0x8faac9[_0xce4c('0x31')]:_0x57ea94[_0xce4c('0x33')];if(_0x3b90a4[_0xce4c('0x2f')][_0xce4c('0x3f')]){_0x8faac9[_0xce4c('0x45')]=[{'all':!![]}];}_0x8faac9=_[_0xce4c('0x3c')]({},_0x8faac9,_0x3b90a4['options']);return db[_0xce4c('0x3e')]['find'](_0x8faac9)[_0xce4c('0x26')](handleEntityNotFound(_0x5c4ff5,null))[_0xce4c('0x26')](respondWithResult(_0x5c4ff5,null))[_0xce4c('0x46')](handleError(_0x5c4ff5,null));};exports[_0xce4c('0x47')]=function(_0x4c0f2d,_0x479a82){return db[_0xce4c('0x3e')][_0xce4c('0x47')](_0x4c0f2d['body'],{})[_0xce4c('0x26')](respondWithResult(_0x479a82,0xc9))[_0xce4c('0x46')](handleError(_0x479a82,null));};exports['update']=function(_0x4914f0,_0x12c82e){if(_0x4914f0[_0xce4c('0x48')]['id']){delete _0x4914f0['body']['id'];}return db[_0xce4c('0x3e')]['find']({'where':{'id':_0x4914f0[_0xce4c('0x43')]['id']}})['then'](handleEntityNotFound(_0x12c82e,null))[_0xce4c('0x26')](saveUpdates(_0x4914f0[_0xce4c('0x48')],null))[_0xce4c('0x26')](respondWithResult(_0x12c82e,null))[_0xce4c('0x46')](handleError(_0x12c82e,null));};exports[_0xce4c('0x27')]=function(_0x59dc05,_0x20a024){return db[_0xce4c('0x3e')][_0xce4c('0x49')]({'where':{'id':_0x59dc05[_0xce4c('0x43')]['id']}})[_0xce4c('0x26')](handleEntityNotFound(_0x20a024,null))[_0xce4c('0x26')](removeEntity(_0x20a024,null))[_0xce4c('0x46')](handleError(_0x20a024,null));};
\ No newline at end of file
index 90b53c3..b8106dd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3edc=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees'];(function(_0x28be72,_0x2b83af){var _0x46c5da=function(_0x312911){while(--_0x312911){_0x28be72['push'](_0x28be72['shift']());}};_0x46c5da(++_0x2b83af);}(_0x3edc,0x9c));var _0xc3ed=function(_0x2f3173,_0x532c04){_0x2f3173=_0x2f3173-0x0;var _0x426e08=_0x3edc[_0x2f3173];return _0x426e08;};'use strict';var _=require(_0xc3ed('0x0'));var util=require(_0xc3ed('0x1'));var logger=require(_0xc3ed('0x2'))(_0xc3ed('0x3'));var moment=require('moment');var BPromise=require(_0xc3ed('0x4'));var rp=require(_0xc3ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3ed('0x6'));var config=require(_0xc3ed('0x7'));var attributes=require(_0xc3ed('0x8'));module[_0xc3ed('0x9')]=function(_0x21ecae,_0x4d2b17){return _0x21ecae[_0xc3ed('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0xc3ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xf2bc=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees'];(function(_0x3adcc2,_0x312815){var _0x32c039=function(_0x4c9d8d){while(--_0x4c9d8d){_0x3adcc2['push'](_0x3adcc2['shift']());}};_0x32c039(++_0x312815);}(_0xf2bc,0x1c8));var _0xcf2b=function(_0x17c548,_0x16ea62){_0x17c548=_0x17c548-0x0;var _0x4e4126=_0xf2bc[_0x17c548];return _0x4e4126;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcf2b('0x0'))(_0xcf2b('0x1'));var moment=require(_0xcf2b('0x2'));var BPromise=require(_0xcf2b('0x3'));var rp=require(_0xcf2b('0x4'));var fs=require('fs');var path=require(_0xcf2b('0x5'));var rimraf=require(_0xcf2b('0x6'));var config=require(_0xcf2b('0x7'));var attributes=require(_0xcf2b('0x8'));module[_0xcf2b('0x9')]=function(_0x8c4084,_0x2d3c1f){return _0x8c4084[_0xcf2b('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0xcf2b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 240a6cc..f95653b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x518431,_0x5f331f){var _0xd9550b=function(_0x11c0e3){while(--_0x11c0e3){_0x518431['push'](_0x518431['shift']());}};_0xd9550b(++_0x5f331f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}
\ No newline at end of file
+var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x3381e5,_0x5f0110){var _0x5d61f9=function(_0x5e0d65){while(--_0x5e0d65){_0x3381e5['push'](_0x3381e5['shift']());}};_0x5d61f9(++_0x5f0110);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc4aa[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}
\ No newline at end of file
index 399e389..088e7e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfb99=['put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','/:id','show','post','create'];(function(_0x1b0df1,_0x36beeb){var _0x333b1d=function(_0x348094){while(--_0x348094){_0x1b0df1['push'](_0x1b0df1['shift']());}};_0x333b1d(++_0x36beeb);}(_0xfb99,0x145));var _0x9fb9=function(_0x2af261,_0x33d5ae){_0x2af261=_0x2af261-0x0;var _0x5e4774=_0xfb99[_0x2af261];return _0x5e4774;};'use strict';var multer=require(_0x9fb9('0x0'));var util=require(_0x9fb9('0x1'));var path=require('path');var timeout=require(_0x9fb9('0x2'));var express=require('express');var router=express[_0x9fb9('0x3')]();var fs_extra=require(_0x9fb9('0x4'));var auth=require(_0x9fb9('0x5'));var interaction=require(_0x9fb9('0x6'));var config=require(_0x9fb9('0x7'));var controller=require(_0x9fb9('0x8'));router['get']('/',auth[_0x9fb9('0x9')](),controller[_0x9fb9('0xa')]);router['get'](_0x9fb9('0xb'),auth[_0x9fb9('0x9')](),controller[_0x9fb9('0xc')]);router[_0x9fb9('0xd')]('/',auth[_0x9fb9('0x9')](),controller[_0x9fb9('0xe')]);router[_0x9fb9('0xf')](_0x9fb9('0xb'),auth['isAuthenticated'](),controller[_0x9fb9('0x10')]);router[_0x9fb9('0x11')]('/:id',auth[_0x9fb9('0x9')](),controller[_0x9fb9('0x12')]);module[_0x9fb9('0x13')]=router;
\ No newline at end of file
+var _0x3364=['./analyticTreeReport.controller','isAuthenticated','get','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2b5fc8,_0x380cb7){var _0x253c77=function(_0x19f5f1){while(--_0x19f5f1){_0x2b5fc8['push'](_0x2b5fc8['shift']());}};_0x253c77(++_0x380cb7);}(_0x3364,0x13b));var _0x4336=function(_0x165e23,_0x480c26){_0x165e23=_0x165e23-0x0;var _0x2b9e44=_0x3364[_0x165e23];return _0x2b9e44;};'use strict';var multer=require(_0x4336('0x0'));var util=require(_0x4336('0x1'));var path=require(_0x4336('0x2'));var timeout=require('connect-timeout');var express=require(_0x4336('0x3'));var router=express['Router']();var fs_extra=require(_0x4336('0x4'));var auth=require(_0x4336('0x5'));var interaction=require(_0x4336('0x6'));var config=require(_0x4336('0x7'));var controller=require(_0x4336('0x8'));router['get']('/',auth[_0x4336('0x9')](),controller['index']);router[_0x4336('0xa')](_0x4336('0xb'),auth[_0x4336('0x9')](),controller[_0x4336('0xc')]);router[_0x4336('0xd')]('/',auth[_0x4336('0x9')](),controller[_0x4336('0xe')]);router[_0x4336('0xf')](_0x4336('0xb'),auth[_0x4336('0x9')](),controller['update']);router[_0x4336('0x10')](_0x4336('0xb'),auth[_0x4336('0x9')](),controller[_0x4336('0x11')]);module[_0x4336('0x12')]=router;
\ No newline at end of file
index 813cdd0..c5d3a7d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xab5b=['sequelize','exports','STRING'];(function(_0x3e4a87,_0xfbca93){var _0x1d2f9d=function(_0x47a61d){while(--_0x47a61d){_0x3e4a87['push'](_0x3e4a87['shift']());}};_0x1d2f9d(++_0xfbca93);}(_0xab5b,0x11a));var _0xbab5=function(_0x265881,_0x5c1ec5){_0x265881=_0x265881-0x0;var _0x554868=_0xab5b[_0x265881];return _0x554868;};'use strict';var Sequelize=require(_0xbab5('0x0'));module[_0xbab5('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xbab5('0x2')]},'type':{'type':Sequelize[_0xbab5('0x2')]}};
\ No newline at end of file
+var _0x702d=['sequelize','exports','STRING'];(function(_0x2c8ade,_0x3f4d26){var _0x4084cc=function(_0x49ca56){while(--_0x49ca56){_0x2c8ade['push'](_0x2c8ade['shift']());}};_0x4084cc(++_0x3f4d26);}(_0x702d,0x147));var _0xd702=function(_0xc48069,_0x5c404b){_0xc48069=_0xc48069-0x0;var _0x39c083=_0x702d[_0xc48069];return _0x39c083;};'use strict';var Sequelize=require(_0xd702('0x0'));module[_0xd702('0x1')]={'name':{'type':Sequelize[_0xd702('0x2')]},'basename':{'type':Sequelize[_0xd702('0x2')]},'type':{'type':Sequelize[_0xd702('0x2')]}};
\ No newline at end of file
index 662fc3d..38c77f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3218=['root','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','end','sendStatus','error','stack','name','send','Attachment','fieldName','key','map','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','show','params','keys','rawAttributes','options','find','catch','clone','length','get','omit','updatedAt','body','createdAt','create','update','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join'];(function(_0x3c414c,_0x399dbb){var _0x4f3062=function(_0x1b71cc){while(--_0x1b71cc){_0x3c414c['push'](_0x3c414c['shift']());}};_0x4f3062(++_0x399dbb);}(_0x3218,0x176));var _0x8321=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x3218[_0x45f951];return _0x24756c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8321('0x0'));var zipdir=require(_0x8321('0x1'));var jsonpatch=require(_0x8321('0x2'));var rp=require(_0x8321('0x3'));var moment=require('moment');var BPromise=require(_0x8321('0x4'));var Mustache=require(_0x8321('0x5'));var util=require(_0x8321('0x6'));var path=require('path');var sox=require(_0x8321('0x7'));var csv=require(_0x8321('0x8'));var ejs=require(_0x8321('0x9'));var fs=require('fs');var fs_extra=require(_0x8321('0xa'));var _=require('lodash');var squel=require(_0x8321('0xb'));var crypto=require('crypto');var jsforce=require(_0x8321('0xc'));var deskjs=require(_0x8321('0xd'));var toCsv=require(_0x8321('0x8'));var querystring=require(_0x8321('0xe'));var Papa=require(_0x8321('0xf'));var Redis=require(_0x8321('0x10'));var authService=require(_0x8321('0x11'));var qs=require(_0x8321('0x12'));var as=require(_0x8321('0x13'));var hardwareService=require(_0x8321('0x14'));var logger=require('../../config/logger')(_0x8321('0x15'));var utils=require(_0x8321('0x16'));var config=require(_0x8321('0x17'));var licenseUtil=require(_0x8321('0x18'));var db=require(_0x8321('0x19'))['db'];function respondWithStatusCode(_0x78a5b8,_0xe0c4bf){_0xe0c4bf=_0xe0c4bf||0xcc;return function(_0x2997b8){if(_0x2997b8){return _0x78a5b8['sendStatus'](_0xe0c4bf);}return _0x78a5b8[_0x8321('0x1a')](_0xe0c4bf)['end']();};}function respondWithResult(_0x13ce91,_0x5e5959){_0x5e5959=_0x5e5959||0xc8;return function(_0x45481a){if(_0x45481a){return _0x13ce91['status'](_0x5e5959)[_0x8321('0x1b')](_0x45481a);}};}function respondWithFilteredResult(_0x1baa73,_0x26e6d4){return function(_0x52b914){if(_0x52b914){var _0x154afa=typeof _0x26e6d4[_0x8321('0x1c')]===_0x8321('0x1d')&&typeof _0x26e6d4[_0x8321('0x1e')]===_0x8321('0x1d');var _0x2eeb46=_0x52b914[_0x8321('0x1f')];var _0x2524a1=_0x154afa?0x0:_0x26e6d4[_0x8321('0x1c')];var _0x157357=_0x154afa?_0x52b914[_0x8321('0x1f')]:_0x26e6d4[_0x8321('0x1c')]+_0x26e6d4[_0x8321('0x1e')];var _0x4ebc97;if(_0x157357>=_0x2eeb46){_0x157357=_0x2eeb46;_0x4ebc97=0xc8;}else{_0x4ebc97=0xce;}_0x1baa73[_0x8321('0x1a')](_0x4ebc97);return _0x1baa73[_0x8321('0x20')]('Content-Range',_0x2524a1+'-'+_0x157357+'/'+_0x2eeb46)[_0x8321('0x1b')](_0x52b914);}return null;};}function patchUpdates(_0x2239f2){return function(_0x39a8bf){try{jsonpatch[_0x8321('0x21')](_0x39a8bf,_0x2239f2,!![]);}catch(_0x470877){return BPromise[_0x8321('0x22')](_0x470877);}return _0x39a8bf[_0x8321('0x23')]();};}function saveUpdates(_0x1781b7,_0x357363){return function(_0x25ed90){if(_0x25ed90){return _0x25ed90['update'](_0x1781b7)['then'](function(_0x1993c3){return _0x1993c3;});}return null;};}function removeEntity(_0x1e5553,_0x41a345){return function(_0x3fe345){if(_0x3fe345){return _0x3fe345[_0x8321('0x24')]()[_0x8321('0x25')](function(){_0x1e5553['status'](0xcc)[_0x8321('0x26')]();});}};}function handleEntityNotFound(_0x2ebb2c,_0x4f8198){return function(_0xb5e21e){if(!_0xb5e21e){_0x2ebb2c[_0x8321('0x27')](0x194);}return _0xb5e21e;};}function handleError(_0x13f8a2,_0x1682f9){_0x1682f9=_0x1682f9||0x1f4;return function(_0x59d5d7){logger[_0x8321('0x28')](_0x59d5d7[_0x8321('0x29')]);if(_0x59d5d7[_0x8321('0x2a')]){delete _0x59d5d7[_0x8321('0x2a')];}_0x13f8a2[_0x8321('0x1a')](_0x1682f9)[_0x8321('0x2b')](_0x59d5d7);};}exports['index']=function(_0x40daa6,_0x149566){var _0x4493a8={},_0x2fd47b={},_0x408934={'count':0x0,'rows':[]};var _0x2fd2db=_['map'](db[_0x8321('0x2c')]['rawAttributes'],function(_0x469b6d){return{'name':_0x469b6d[_0x8321('0x2d')],'type':_0x469b6d['type'][_0x8321('0x2e')]};});_0x2fd47b['model']=_[_0x8321('0x2f')](_0x2fd2db,_0x8321('0x2a'));_0x2fd47b[_0x8321('0x30')]=_['keys'](_0x40daa6[_0x8321('0x30')]);_0x2fd47b[_0x8321('0x31')]=_[_0x8321('0x32')](_0x2fd47b['model'],_0x2fd47b['query']);_0x4493a8[_0x8321('0x33')]=_['intersection'](_0x2fd47b[_0x8321('0x34')],qs[_0x8321('0x35')](_0x40daa6[_0x8321('0x30')][_0x8321('0x35')]));_0x4493a8[_0x8321('0x33')]=_0x4493a8['attributes']['length']?_0x4493a8['attributes']:_0x2fd47b[_0x8321('0x34')];if(!_0x40daa6['query'][_0x8321('0x36')](_0x8321('0x37'))){_0x4493a8[_0x8321('0x1e')]=qs[_0x8321('0x1e')](_0x40daa6[_0x8321('0x30')][_0x8321('0x1e')]);_0x4493a8[_0x8321('0x1c')]=qs[_0x8321('0x1c')](_0x40daa6[_0x8321('0x30')][_0x8321('0x1c')]);}_0x4493a8[_0x8321('0x38')]=qs[_0x8321('0x39')](_0x40daa6[_0x8321('0x30')][_0x8321('0x39')]);_0x4493a8['where']=qs[_0x8321('0x31')](_[_0x8321('0x3a')](_0x40daa6[_0x8321('0x30')],_0x2fd47b[_0x8321('0x31')]),_0x2fd2db);if(_0x40daa6[_0x8321('0x30')][_0x8321('0x3b')]){_0x4493a8[_0x8321('0x3c')]=_[_0x8321('0x3d')](_0x4493a8[_0x8321('0x3c')],{'$or':_[_0x8321('0x2f')](_0x2fd2db,function(_0x93ec83){if(_0x93ec83[_0x8321('0x3e')]!==_0x8321('0x3f')){var _0x30db29={};_0x30db29[_0x93ec83['name']]={'$like':'%'+_0x40daa6[_0x8321('0x30')][_0x8321('0x3b')]+'%'};return _0x30db29;}})});}_0x4493a8=_[_0x8321('0x3d')]({},_0x4493a8,_0x40daa6['options']);var _0x4d8dfc={'where':_0x4493a8['where']};return db[_0x8321('0x2c')][_0x8321('0x1f')](_0x4d8dfc)[_0x8321('0x25')](function(_0xfd7128){_0x408934['count']=_0xfd7128;if(_0x40daa6[_0x8321('0x30')][_0x8321('0x40')]){_0x4493a8[_0x8321('0x41')]=[{'all':!![]}];}return db[_0x8321('0x2c')]['findAll'](_0x4493a8);})['then'](function(_0x2c4d72){_0x408934['rows']=_0x2c4d72;return _0x408934;})[_0x8321('0x25')](respondWithFilteredResult(_0x149566,_0x4493a8))['catch'](handleError(_0x149566,null));};exports[_0x8321('0x42')]=function(_0x135fe6,_0x1d9d02){var _0xcc18ca={'raw':!![],'where':{'id':_0x135fe6[_0x8321('0x43')]['id']}},_0x38ee04={};_0x38ee04[_0x8321('0x34')]=_[_0x8321('0x44')](db[_0x8321('0x2c')][_0x8321('0x45')]);_0x38ee04[_0x8321('0x30')]=_[_0x8321('0x44')](_0x135fe6[_0x8321('0x30')]);_0x38ee04[_0x8321('0x31')]=_['intersection'](_0x38ee04[_0x8321('0x34')],_0x38ee04[_0x8321('0x30')]);_0xcc18ca[_0x8321('0x33')]=_[_0x8321('0x32')](_0x38ee04['model'],qs[_0x8321('0x35')](_0x135fe6[_0x8321('0x30')][_0x8321('0x35')]));_0xcc18ca[_0x8321('0x33')]=_0xcc18ca[_0x8321('0x33')]['length']?_0xcc18ca[_0x8321('0x33')]:_0x38ee04['model'];if(_0x135fe6[_0x8321('0x30')][_0x8321('0x40')]){_0xcc18ca[_0x8321('0x41')]=[{'all':!![]}];}_0xcc18ca=_[_0x8321('0x3d')]({},_0xcc18ca,_0x135fe6[_0x8321('0x46')]);return db['Attachment'][_0x8321('0x47')](_0xcc18ca)['then'](handleEntityNotFound(_0x1d9d02,null))['then'](respondWithResult(_0x1d9d02,null))[_0x8321('0x48')](handleError(_0x1d9d02,null));};exports[_0x8321('0x49')]=function(_0x14b431,_0x411979){var _0x5b259c={'where':{'id':_0x14b431[_0x8321('0x43')]['id']}},_0x445fe8={};_0x445fe8[_0x8321('0x34')]=_[_0x8321('0x44')](db[_0x8321('0x2c')][_0x8321('0x45')]);_0x5b259c[_0x8321('0x33')]=_[_0x8321('0x32')](_0x445fe8[_0x8321('0x34')],qs[_0x8321('0x35')](_0x14b431[_0x8321('0x30')]['fields']));_0x5b259c[_0x8321('0x33')]=_0x5b259c['attributes'][_0x8321('0x4a')]?_0x5b259c[_0x8321('0x33')]:_0x445fe8[_0x8321('0x34')];if(_0x14b431[_0x8321('0x30')][_0x8321('0x40')]){_0x5b259c['include']=[{'all':!![]}];}_0x5b259c=_['merge']({},_0x5b259c,_0x14b431[_0x8321('0x46')]);return db['Attachment'][_0x8321('0x47')](_0x5b259c)['then'](handleEntityNotFound(_0x411979,null))[_0x8321('0x25')](function(_0x229afe){if(_0x229afe){var _0x160aec=_0x229afe[_0x8321('0x4b')]({'plain':!![]});_0x160aec=qs[_0x8321('0x4c')](_0x160aec,['id','createdAt',_0x8321('0x4d')]);_0x14b431[_0x8321('0x4e')]=_[_0x8321('0x4c')](_0x14b431[_0x8321('0x4e')],['id',_0x8321('0x4f'),_0x8321('0x4d')]);return db[_0x8321('0x2c')][_0x8321('0x50')](_[_0x8321('0x3d')](_0x160aec,_0x14b431[_0x8321('0x4e')]),{'include':_0x14b431['query'][_0x8321('0x40')]?[{'all':!![]}]:undefined});}})[_0x8321('0x25')](respondWithResult(_0x411979,0xc9))['catch'](handleError(_0x411979,null));};exports[_0x8321('0x51')]=function(_0x603b52,_0xb936cc){if(_0x603b52[_0x8321('0x4e')]['id']){delete _0x603b52[_0x8321('0x4e')]['id'];}return db[_0x8321('0x2c')]['find']({'where':{'id':_0x603b52[_0x8321('0x43')]['id']}})[_0x8321('0x25')](handleEntityNotFound(_0xb936cc,null))['then'](saveUpdates(_0x603b52[_0x8321('0x4e')],null))[_0x8321('0x25')](respondWithResult(_0xb936cc,null))['catch'](handleError(_0xb936cc,null));};exports['destroy']=function(_0x3c907b,_0x4be741){return db[_0x8321('0x2c')][_0x8321('0x47')]({'where':{'id':_0x3c907b['params']['id']}})[_0x8321('0x25')](handleEntityNotFound(_0x4be741,null))[_0x8321('0x25')](removeEntity(_0x4be741,null))['catch'](handleError(_0x4be741,null));};exports[_0x8321('0x50')]=function(_0x4b0c0a,_0x2b0bc7,_0x433a1f){_0x4b0c0a['body'][_0x8321('0x2a')]=_0x4b0c0a[_0x8321('0x52')][_0x8321('0x53')];_0x4b0c0a[_0x8321('0x4e')][_0x8321('0x54')]=_0x4b0c0a['file'][_0x8321('0x55')];_0x4b0c0a['body'][_0x8321('0x3e')]=_0x4b0c0a[_0x8321('0x52')][_0x8321('0x56')];return db[_0x8321('0x2c')][_0x8321('0x50')](_0x4b0c0a[_0x8321('0x4e')])[_0x8321('0x25')](respondWithResult(_0x2b0bc7,0xc9))['catch'](handleError(_0x2b0bc7,null));};exports[_0x8321('0x57')]=function(_0x1dc19c,_0x568ed7,_0x1e5882){return db[_0x8321('0x2c')][_0x8321('0x58')]({'where':{'id':_0x1dc19c[_0x8321('0x43')]['id']},'raw':!![]})[_0x8321('0x25')](handleEntityNotFound(_0x568ed7,null))[_0x8321('0x25')](function(_0x3548e2){if(_0x3548e2){var _0x4e81c6=_0x3548e2[_0x8321('0x59')]!==null;var _0x4672c4=path[_0x8321('0x5a')](config[_0x8321('0x5b')],'server/files/attachments/');if(_0x4e81c6){_0x4672c4=path[_0x8321('0x5a')](_0x4672c4,_0x8321('0x5c'));}var _0x548664=path[_0x8321('0x5a')](_0x4672c4,_0x3548e2[_0x8321('0x54')]);return _0x568ed7[_0x8321('0x57')](_0x548664);}})[_0x8321('0x48')](handleError(_0x568ed7,null));};
\ No newline at end of file
+var _0xd202=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','Attachment','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','clone','get','omit','updatedAt','body','create','find','file','originalname','filename','download','findOne','root','server/files/attachments/','join','offline-chat/','basename','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd202,0xa3));var _0x2d20=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd202[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x2d20('0x0'));var rimraf=require(_0x2d20('0x1'));var zipdir=require(_0x2d20('0x2'));var jsonpatch=require(_0x2d20('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2d20('0x4'));var Mustache=require(_0x2d20('0x5'));var util=require(_0x2d20('0x6'));var path=require(_0x2d20('0x7'));var sox=require(_0x2d20('0x8'));var csv=require(_0x2d20('0x9'));var ejs=require(_0x2d20('0xa'));var fs=require('fs');var fs_extra=require(_0x2d20('0xb'));var _=require('lodash');var squel=require(_0x2d20('0xc'));var crypto=require(_0x2d20('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2d20('0xe'));var toCsv=require(_0x2d20('0x9'));var querystring=require(_0x2d20('0xf'));var Papa=require('papaparse');var Redis=require(_0x2d20('0x10'));var authService=require(_0x2d20('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2d20('0x12'));var hardwareService=require(_0x2d20('0x13'));var logger=require(_0x2d20('0x14'))('api');var utils=require(_0x2d20('0x15'));var config=require(_0x2d20('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d20('0x17'))['db'];function respondWithStatusCode(_0x470f99,_0x40790c){_0x40790c=_0x40790c||0xcc;return function(_0x1c6e7a){if(_0x1c6e7a){return _0x470f99[_0x2d20('0x18')](_0x40790c);}return _0x470f99[_0x2d20('0x19')](_0x40790c)['end']();};}function respondWithResult(_0xabac69,_0xa218c5){_0xa218c5=_0xa218c5||0xc8;return function(_0x1293ef){if(_0x1293ef){return _0xabac69[_0x2d20('0x19')](_0xa218c5)[_0x2d20('0x1a')](_0x1293ef);}};}function respondWithFilteredResult(_0x23dda9,_0x1c0542){return function(_0x1fd332){if(_0x1fd332){var _0x5a4ece=typeof _0x1c0542[_0x2d20('0x1b')]===_0x2d20('0x1c')&&typeof _0x1c0542['limit']==='undefined';var _0x452c8f=_0x1fd332[_0x2d20('0x1d')];var _0x154323=_0x5a4ece?0x0:_0x1c0542[_0x2d20('0x1b')];var _0x4745cc=_0x5a4ece?_0x1fd332[_0x2d20('0x1d')]:_0x1c0542[_0x2d20('0x1b')]+_0x1c0542[_0x2d20('0x1e')];var _0x55960c;if(_0x4745cc>=_0x452c8f){_0x4745cc=_0x452c8f;_0x55960c=0xc8;}else{_0x55960c=0xce;}_0x23dda9[_0x2d20('0x19')](_0x55960c);return _0x23dda9[_0x2d20('0x1f')](_0x2d20('0x20'),_0x154323+'-'+_0x4745cc+'/'+_0x452c8f)[_0x2d20('0x1a')](_0x1fd332);}return null;};}function patchUpdates(_0x5d107f){return function(_0x277535){try{jsonpatch[_0x2d20('0x21')](_0x277535,_0x5d107f,!![]);}catch(_0x5d9b1e){return BPromise[_0x2d20('0x22')](_0x5d9b1e);}return _0x277535[_0x2d20('0x23')]();};}function saveUpdates(_0x22fcb0,_0x33662f){return function(_0x11a804){if(_0x11a804){return _0x11a804[_0x2d20('0x24')](_0x22fcb0)[_0x2d20('0x25')](function(_0x2c61fb){return _0x2c61fb;});}return null;};}function removeEntity(_0x91c5f9,_0x36c158){return function(_0x5919df){if(_0x5919df){return _0x5919df[_0x2d20('0x26')]()[_0x2d20('0x25')](function(){_0x91c5f9[_0x2d20('0x19')](0xcc)[_0x2d20('0x27')]();});}};}function handleEntityNotFound(_0x57db32,_0x5cbcc6){return function(_0x38639f){if(!_0x38639f){_0x57db32[_0x2d20('0x18')](0x194);}return _0x38639f;};}function handleError(_0x1db1f8,_0x38fd52){_0x38fd52=_0x38fd52||0x1f4;return function(_0x16da4c){logger[_0x2d20('0x28')](_0x16da4c[_0x2d20('0x29')]);if(_0x16da4c['name']){delete _0x16da4c[_0x2d20('0x2a')];}_0x1db1f8['status'](_0x38fd52)[_0x2d20('0x2b')](_0x16da4c);};}exports['index']=function(_0x118bf9,_0x53a784){var _0x24db7b={},_0x1cff05={},_0x3c2a04={'count':0x0,'rows':[]};var _0xf084e5=_[_0x2d20('0x2c')](db['Attachment']['rawAttributes'],function(_0x485e18){return{'name':_0x485e18[_0x2d20('0x2d')],'type':_0x485e18[_0x2d20('0x2e')][_0x2d20('0x2f')]};});_0x1cff05['model']=_['map'](_0xf084e5,'name');_0x1cff05[_0x2d20('0x30')]=_['keys'](_0x118bf9[_0x2d20('0x30')]);_0x1cff05[_0x2d20('0x31')]=_[_0x2d20('0x32')](_0x1cff05[_0x2d20('0x33')],_0x1cff05[_0x2d20('0x30')]);_0x24db7b[_0x2d20('0x34')]=_[_0x2d20('0x32')](_0x1cff05['model'],qs['fields'](_0x118bf9[_0x2d20('0x30')][_0x2d20('0x35')]));_0x24db7b[_0x2d20('0x34')]=_0x24db7b[_0x2d20('0x34')]['length']?_0x24db7b[_0x2d20('0x34')]:_0x1cff05[_0x2d20('0x33')];if(!_0x118bf9['query'][_0x2d20('0x36')](_0x2d20('0x37'))){_0x24db7b['limit']=qs[_0x2d20('0x1e')](_0x118bf9['query'][_0x2d20('0x1e')]);_0x24db7b['offset']=qs[_0x2d20('0x1b')](_0x118bf9[_0x2d20('0x30')]['offset']);}_0x24db7b['order']=qs[_0x2d20('0x38')](_0x118bf9['query'][_0x2d20('0x38')]);_0x24db7b[_0x2d20('0x39')]=qs['filters'](_[_0x2d20('0x3a')](_0x118bf9[_0x2d20('0x30')],_0x1cff05[_0x2d20('0x31')]),_0xf084e5);if(_0x118bf9[_0x2d20('0x30')][_0x2d20('0x3b')]){_0x24db7b[_0x2d20('0x39')]=_['merge'](_0x24db7b[_0x2d20('0x39')],{'$or':_[_0x2d20('0x2c')](_0xf084e5,function(_0x4a7be3){if(_0x4a7be3[_0x2d20('0x2e')]!==_0x2d20('0x3c')){var _0x4adf1f={};_0x4adf1f[_0x4a7be3[_0x2d20('0x2a')]]={'$like':'%'+_0x118bf9[_0x2d20('0x30')][_0x2d20('0x3b')]+'%'};return _0x4adf1f;}})});}_0x24db7b=_[_0x2d20('0x3d')]({},_0x24db7b,_0x118bf9[_0x2d20('0x3e')]);var _0xd4e46f={'where':_0x24db7b['where']};return db[_0x2d20('0x3f')][_0x2d20('0x1d')](_0xd4e46f)[_0x2d20('0x25')](function(_0xa1f2ec){_0x3c2a04[_0x2d20('0x1d')]=_0xa1f2ec;if(_0x118bf9[_0x2d20('0x30')][_0x2d20('0x40')]){_0x24db7b[_0x2d20('0x41')]=[{'all':!![]}];}return db[_0x2d20('0x3f')][_0x2d20('0x42')](_0x24db7b);})[_0x2d20('0x25')](function(_0x16550b){_0x3c2a04[_0x2d20('0x43')]=_0x16550b;return _0x3c2a04;})[_0x2d20('0x25')](respondWithFilteredResult(_0x53a784,_0x24db7b))[_0x2d20('0x44')](handleError(_0x53a784,null));};exports[_0x2d20('0x45')]=function(_0x32a9e9,_0x37a8fb){var _0x1a1f4c={'raw':!![],'where':{'id':_0x32a9e9[_0x2d20('0x46')]['id']}},_0x4fae39={};_0x4fae39[_0x2d20('0x33')]=_[_0x2d20('0x47')](db[_0x2d20('0x3f')][_0x2d20('0x48')]);_0x4fae39[_0x2d20('0x30')]=_[_0x2d20('0x47')](_0x32a9e9[_0x2d20('0x30')]);_0x4fae39[_0x2d20('0x31')]=_[_0x2d20('0x32')](_0x4fae39['model'],_0x4fae39[_0x2d20('0x30')]);_0x1a1f4c[_0x2d20('0x34')]=_['intersection'](_0x4fae39[_0x2d20('0x33')],qs[_0x2d20('0x35')](_0x32a9e9[_0x2d20('0x30')][_0x2d20('0x35')]));_0x1a1f4c[_0x2d20('0x34')]=_0x1a1f4c[_0x2d20('0x34')][_0x2d20('0x49')]?_0x1a1f4c[_0x2d20('0x34')]:_0x4fae39[_0x2d20('0x33')];if(_0x32a9e9[_0x2d20('0x30')][_0x2d20('0x40')]){_0x1a1f4c[_0x2d20('0x41')]=[{'all':!![]}];}_0x1a1f4c=_[_0x2d20('0x3d')]({},_0x1a1f4c,_0x32a9e9['options']);return db[_0x2d20('0x3f')]['find'](_0x1a1f4c)['then'](handleEntityNotFound(_0x37a8fb,null))[_0x2d20('0x25')](respondWithResult(_0x37a8fb,null))[_0x2d20('0x44')](handleError(_0x37a8fb,null));};exports[_0x2d20('0x4a')]=function(_0x32020e,_0xf91c69){var _0x42a2e5={'where':{'id':_0x32020e[_0x2d20('0x46')]['id']}},_0x4fd146={};_0x4fd146[_0x2d20('0x33')]=_[_0x2d20('0x47')](db[_0x2d20('0x3f')][_0x2d20('0x48')]);_0x42a2e5[_0x2d20('0x34')]=_[_0x2d20('0x32')](_0x4fd146['model'],qs[_0x2d20('0x35')](_0x32020e[_0x2d20('0x30')][_0x2d20('0x35')]));_0x42a2e5[_0x2d20('0x34')]=_0x42a2e5['attributes'][_0x2d20('0x49')]?_0x42a2e5['attributes']:_0x4fd146[_0x2d20('0x33')];if(_0x32020e[_0x2d20('0x30')][_0x2d20('0x40')]){_0x42a2e5['include']=[{'all':!![]}];}_0x42a2e5=_[_0x2d20('0x3d')]({},_0x42a2e5,_0x32020e[_0x2d20('0x3e')]);return db['Attachment']['find'](_0x42a2e5)[_0x2d20('0x25')](handleEntityNotFound(_0xf91c69,null))[_0x2d20('0x25')](function(_0x2f6617){if(_0x2f6617){var _0x520584=_0x2f6617[_0x2d20('0x4b')]({'plain':!![]});_0x520584=qs[_0x2d20('0x4c')](_0x520584,['id','createdAt',_0x2d20('0x4d')]);_0x32020e['body']=_[_0x2d20('0x4c')](_0x32020e[_0x2d20('0x4e')],['id','createdAt',_0x2d20('0x4d')]);return db[_0x2d20('0x3f')][_0x2d20('0x4f')](_[_0x2d20('0x3d')](_0x520584,_0x32020e[_0x2d20('0x4e')]),{'include':_0x32020e['query'][_0x2d20('0x40')]?[{'all':!![]}]:undefined});}})[_0x2d20('0x25')](respondWithResult(_0xf91c69,0xc9))[_0x2d20('0x44')](handleError(_0xf91c69,null));};exports[_0x2d20('0x24')]=function(_0x46e750,_0xdc848){if(_0x46e750[_0x2d20('0x4e')]['id']){delete _0x46e750['body']['id'];}return db[_0x2d20('0x3f')][_0x2d20('0x50')]({'where':{'id':_0x46e750[_0x2d20('0x46')]['id']}})[_0x2d20('0x25')](handleEntityNotFound(_0xdc848,null))[_0x2d20('0x25')](saveUpdates(_0x46e750[_0x2d20('0x4e')],null))['then'](respondWithResult(_0xdc848,null))[_0x2d20('0x44')](handleError(_0xdc848,null));};exports[_0x2d20('0x26')]=function(_0x1a412e,_0x5877ca){return db['Attachment'][_0x2d20('0x50')]({'where':{'id':_0x1a412e['params']['id']}})[_0x2d20('0x25')](handleEntityNotFound(_0x5877ca,null))[_0x2d20('0x25')](removeEntity(_0x5877ca,null))[_0x2d20('0x44')](handleError(_0x5877ca,null));};exports[_0x2d20('0x4f')]=function(_0x150ae8,_0x129c3f,_0x1c94e9){_0x150ae8[_0x2d20('0x4e')][_0x2d20('0x2a')]=_0x150ae8[_0x2d20('0x51')][_0x2d20('0x52')];_0x150ae8['body']['basename']=_0x150ae8[_0x2d20('0x51')][_0x2d20('0x53')];_0x150ae8[_0x2d20('0x4e')]['type']=_0x150ae8[_0x2d20('0x51')]['mimetype'];return db[_0x2d20('0x3f')]['create'](_0x150ae8['body'])[_0x2d20('0x25')](respondWithResult(_0x129c3f,0xc9))['catch'](handleError(_0x129c3f,null));};exports[_0x2d20('0x54')]=function(_0x1d1da8,_0x14cec4,_0x87260a){return db[_0x2d20('0x3f')][_0x2d20('0x55')]({'where':{'id':_0x1d1da8[_0x2d20('0x46')]['id']},'raw':!![]})[_0x2d20('0x25')](handleEntityNotFound(_0x14cec4,null))[_0x2d20('0x25')](function(_0x132ae7){if(_0x132ae7){var _0x2b3113=_0x132ae7['ChatOfflineMessageId']!==null;var _0x4caf9a=path['join'](config[_0x2d20('0x56')],_0x2d20('0x57'));if(_0x2b3113){_0x4caf9a=path[_0x2d20('0x58')](_0x4caf9a,_0x2d20('0x59'));}var _0x1b9ee8=path[_0x2d20('0x58')](_0x4caf9a,_0x132ae7[_0x2d20('0x5a')]);return _0x14cec4['download'](_0x1b9ee8);}})[_0x2d20('0x44')](handleError(_0x14cec4,null));};
\ No newline at end of file
index 7374284..b72436c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x860a=['define','attachments','../../config/logger','bluebird','path','rimraf','../../config/environment','./attachment.attributes','exports'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x860a,0xa4));var _0xa860=function(_0x4eae03,_0x36ef4f){_0x4eae03=_0x4eae03-0x0;var _0x48bcb2=_0x860a[_0x4eae03];return _0x48bcb2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa860('0x0'))('api');var moment=require('moment');var BPromise=require(_0xa860('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa860('0x2'));var rimraf=require(_0xa860('0x3'));var config=require(_0xa860('0x4'));var attributes=require(_0xa860('0x5'));module[_0xa860('0x6')]=function(_0x51a3e7,_0x11146b){return _0x51a3e7[_0xa860('0x7')]('Attachment',attributes,{'tableName':_0xa860('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xe3ca=['api','path','rimraf','../../config/environment','define','Attachment','attachments','lodash','util'];(function(_0x4d7533,_0x22d4eb){var _0x3d1100=function(_0x1558d1){while(--_0x1558d1){_0x4d7533['push'](_0x4d7533['shift']());}};_0x3d1100(++_0x22d4eb);}(_0xe3ca,0x1c9));var _0xae3c=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xe3ca[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xae3c('0x0'));var util=require(_0xae3c('0x1'));var logger=require('../../config/logger')(_0xae3c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xae3c('0x3'));var rimraf=require(_0xae3c('0x4'));var config=require(_0xae3c('0x5'));var attributes=require('./attachment.attributes');module['exports']=function(_0x503341,_0x35b827){return _0x503341[_0xae3c('0x6')](_0xae3c('0x7'),attributes,{'tableName':_0xae3c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 57fa895..e21fa77 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x00bb=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','Attachment','body','options','then','CreateAttachment','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','Attachment,\x20%s,\x20%s'];(function(_0x19eba6,_0x4b28e2){var _0x5d4062=function(_0x5a5bb7){while(--_0x5a5bb7){_0x19eba6['push'](_0x19eba6['shift']());}};_0x5d4062(++_0x4b28e2);}(_0x00bb,0x1d8));var _0xb00b=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x00bb[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});}exports['CreateAttachment']=function(_0x2a7231){var _0x599347=this;return new Promise(function(_0x415f91,_0x5aa9a0){return db[_0xb00b('0x12')]['create'](_0x2a7231[_0xb00b('0x13')],{'raw':_0x2a7231[_0xb00b('0x14')]?_0x2a7231['options']['raw']===undefined?!![]:![]:!![]})[_0xb00b('0x15')](function(_0x4a334b){logger[_0xb00b('0x9')](_0xb00b('0x16'),_0x2a7231);logger[_0xb00b('0xc')](_0xb00b('0x16'),_0x2a7231,JSON['stringify'](_0x4a334b));_0x415f91(_0x4a334b);})[_0xb00b('0x11')](function(_0x4df284){logger[_0xb00b('0xf')](_0xb00b('0x16'),_0x4df284['message'],_0x2a7231);_0x5aa9a0(_0x599347[_0xb00b('0xf')](0x1f4,_0x4df284[_0xb00b('0x10')]));});});};
\ No newline at end of file
+var _0x2821=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','then','lodash','util','moment','bluebird','randomstring'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2821,0x87));var _0x1282=function(_0x16a3f6,_0x37ef8b){_0x16a3f6=_0x16a3f6-0x0;var _0x66eb98=_0x2821[_0x16a3f6];return _0x66eb98;};'use strict';var _=require(_0x1282('0x0'));var util=require(_0x1282('0x1'));var moment=require(_0x1282('0x2'));var BPromise=require(_0x1282('0x3'));var rs=require(_0x1282('0x4'));var fs=require('fs');var Redis=require(_0x1282('0x5'));var db=require(_0x1282('0x6'))['db'];var utils=require(_0x1282('0x7'));var logger=require(_0x1282('0x8'))(_0x1282('0x9'));var config=require(_0x1282('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1282('0xb')][_0x1282('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x293947,_0x13beb5,_0xa4eee9){return new BPromise(function(_0x1a8666,_0x18d69a){return client[_0x1282('0xd')](_0x293947,_0xa4eee9)['then'](function(_0x41c458){logger[_0x1282('0xe')](_0x1282('0xf'),_0x13beb5,_0x1282('0x10'));logger[_0x1282('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0x13beb5,_0x1282('0x10'),JSON[_0x1282('0x12')](_0x41c458));if(_0x41c458['error']){if(_0x41c458[_0x1282('0x13')][_0x1282('0x14')]===0x1f4){logger['error'](_0x1282('0xf'),_0x13beb5,_0x41c458['error']['message']);return _0x18d69a(_0x41c458[_0x1282('0x13')][_0x1282('0x15')]);}logger[_0x1282('0x13')](_0x1282('0xf'),_0x13beb5,_0x41c458['error']['message']);return _0x1a8666(_0x41c458['error'][_0x1282('0x15')]);}else{logger[_0x1282('0xe')](_0x1282('0xf'),_0x13beb5,_0x1282('0x10'));_0x1a8666(_0x41c458[_0x1282('0x16')][_0x1282('0x15')]);}})[_0x1282('0x17')](function(_0x116ef1){logger['error'](_0x1282('0xf'),_0x13beb5,_0x116ef1);_0x18d69a(_0x116ef1);});});}exports[_0x1282('0x18')]=function(_0x518733){var _0x48c857=this;return new Promise(function(_0xebc97e,_0x4e3ec7){return db[_0x1282('0x19')][_0x1282('0x1a')](_0x518733['body'],{'raw':_0x518733['options']?_0x518733['options']['raw']===undefined?!![]:![]:!![]})[_0x1282('0x1b')](function(_0x2f4e4a){logger[_0x1282('0xe')](_0x1282('0x18'),_0x518733);logger[_0x1282('0x11')](_0x1282('0x18'),_0x518733,JSON[_0x1282('0x12')](_0x2f4e4a));_0xebc97e(_0x2f4e4a);})[_0x1282('0x17')](function(_0x153159){logger[_0x1282('0x13')]('CreateAttachment',_0x153159[_0x1282('0x15')],_0x518733);_0x4e3ec7(_0x48c857['error'](0x1f4,_0x153159[_0x1282('0x15')]));});});};
\ No newline at end of file
index 44cc755..e316fc8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x5a6280,_0x51c314){var _0x27b853=function(_0x5e4cdd){while(--_0x5e4cdd){_0x5a6280['push'](_0x5a6280['shift']());}};_0x27b853(++_0x51c314);}(_0x5f2f,0x73));var _0xf5f2=function(_0x881492,_0x5ab3d3){_0x881492=_0x881492-0x0;var _0x4d7f93=_0x5f2f[_0x881492];return _0x4d7f93;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router;
\ No newline at end of file
+var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x371145,_0xcac3f6){var _0x53bcbb=function(_0x4c6ef3){while(--_0x4c6ef3){_0x371145['push'](_0x371145['shift']());}};_0x53bcbb(++_0xcac3f6);}(_0xb10b,0x12a));var _0xbb10=function(_0x1945a5,_0x50de54){_0x1945a5=_0x1945a5-0x0;var _0x5817a5=_0xb10b[_0x1945a5];return _0x5817a5;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router;
\ No newline at end of file
index 456b1e8..79d94b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf0c7=['role','disabled','blocked','online','admin','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status','send','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','passport','passport-local','Strategy','moment','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt'];(function(_0x126ecd,_0x1ec549){var _0x899544=function(_0x5ea5bb){while(--_0x5ea5bb){_0x126ecd['push'](_0x126ecd['shift']());}};_0x899544(++_0x1ec549);}(_0xf0c7,0x1c1));var _0x7f0c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf0c7[_0xa464c9];return _0x3d73c4;};'use strict';var passport=require(_0x7f0c('0x0'));var LocalStrategy=require(_0x7f0c('0x1'))[_0x7f0c('0x2')];var moment=require(_0x7f0c('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x7f0c('0x4'));var util=require(_0x7f0c('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x7f0c('0x6'));var utils=require(_0x7f0c('0x7'));var config=require(_0x7f0c('0x8'));var logger=require(_0x7f0c('0x9'))(_0x7f0c('0xa'));function isActiveDirectoryConfigured(_0x5d864a){var _0x517401=![];if(typeof _0x5d864a[_0x7f0c('0xb')]!==_0x7f0c('0xc')){_0x517401=_0x5d864a[_0x7f0c('0xb')][_0x7f0c('0xd')]&&_0x5d864a[_0x7f0c('0xb')][_0x7f0c('0xe')]&&_0x5d864a[_0x7f0c('0xb')][_0x7f0c('0xf')];}return _0x517401;}function adAuthenticate(_0x21f789,_0x3bcc3f,_0x42b8d7){return new BPromise(function(_0x78ee0c,_0x23ac8e){try{var _0x1a635a=new ActiveDirectory(_0x21f789);_0x1a635a[_0x7f0c('0x10')](_0x3bcc3f,_0x42b8d7,function(_0x54bd18,_0x4527d2){if(_0x54bd18){logger[_0x7f0c('0x11')](_0x7f0c('0x12'),_0x3bcc3f,util['inspect'](_0x54bd18,{'showHidden':![],'depth':null}));_0x23ac8e(_0x7f0c('0x13'));}else if(!_0x4527d2){logger[_0x7f0c('0x11')](_0x7f0c('0x14'),_0x3bcc3f);_0x23ac8e(_0x7f0c('0x13'));}else{_0x78ee0c(_0x4527d2);}});}catch(_0xff9d9d){_0x23ac8e(_0xff9d9d);}});}function ActiveDirectoryAuthenticate(_0x2fee5d,_0x52efd6,_0x2c27b5,_0x1ea954){var _0x4d0f5e,_0xc766ea;if(!isActiveDirectoryConfigured(config)){logger[_0x7f0c('0x11')](_0x7f0c('0x15'),_0x52efd6);return _0x1ea954(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x7f0c('0x16')][_0x7f0c('0x17')]({'where':{'id':0x1},'attributes':[_0x7f0c('0x18'),_0x7f0c('0x19')],'raw':!![]})[_0x7f0c('0x1a')](function(_0x2f9a7f){_0x4d0f5e=_0x2f9a7f;if(!_0x4d0f5e[_0x7f0c('0x18')]){logger[_0x7f0c('0x11')](_0x7f0c('0x1b'),_0x52efd6);throw new Error(_0x7f0c('0x13'));}return _0x2fee5d['findOne']({'attributes':['id',_0x7f0c('0x1c'),_0x7f0c('0x1d'),_0x7f0c('0x1e'),_0x7f0c('0x1f'),_0x7f0c('0x20'),_0x7f0c('0x21'),'blockedAt',_0x7f0c('0x22')],'where':{'name':_0x52efd6,'role':{'$or':[_0x7f0c('0x23'),'user','agent']},'adSsoEnabled':!![]}});})[_0x7f0c('0x1a')](function(_0x482fab){if(!_0x482fab||_0x482fab&&_0x482fab['name']!==_0x52efd6){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0xc766ea=_0x482fab;var _0xad180d=_0xc766ea['name']+'@'+config[_0x7f0c('0xb')][_0x7f0c('0xf')];return adAuthenticate(config[_0x7f0c('0xb')],_0xad180d,_0x2c27b5);})[_0x7f0c('0x1a')](function(_0x3b07c6){if(_0xc766ea['disabled']){throw new Error(_0x7f0c('0x13'));}if(_0x4d0f5e[_0x7f0c('0x19')]>0x0){if(_0xc766ea[_0x7f0c('0x21')]){if(moment(_0xc766ea[_0x7f0c('0x24')])[_0x7f0c('0x25')](_0x4d0f5e[_0x7f0c('0x19')],_0x7f0c('0x26'))>moment()){throw new Error(_0x7f0c('0x13'));}return utils[_0x7f0c('0x27')](_0xc766ea,0x0,![],null)[_0x7f0c('0x1a')](function(){return utils[_0x7f0c('0x28')](_0xc766ea);})[_0x7f0c('0x1a')](function(){return _0x1ea954(null,_0xc766ea);});}else{return utils[_0x7f0c('0x28')](_0xc766ea)[_0x7f0c('0x1a')](function(){return _0x1ea954(null,_0xc766ea);});}}else{return utils[_0x7f0c('0x28')](_0xc766ea)[_0x7f0c('0x1a')](function(){return _0x1ea954(null,_0xc766ea);});}})[_0x7f0c('0x29')](function(_0x64cdab){return _0x1ea954(null,![],_0x64cdab);});}function handleError(_0x25d426,_0x2f8f8d,_0xbc4eec){return _0x25d426[_0x7f0c('0x2a')](_0x2f8f8d||0x1f4)[_0x7f0c('0x2b')]({'message':_0xbc4eec?_0xbc4eec['message']||_0xbc4eec:''});}exports['login']=function(_0x46697c,_0x5abde6,_0x301d42){passport['authenticate'](_0x7f0c('0x2c'),function(_0x551f6f,_0x1a8f25,_0x443276){var _0x34e908=_0x551f6f||_0x443276;if(_0x34e908){return handleError(_0x5abde6,0x191,_0x34e908);}if(!_0x1a8f25){return handleError(_0x5abde6,0x194,{'message':_0x7f0c('0x2d')});}else{var _0x1d9362={'payload':{'id':_0x1a8f25['id'],'role':_0x1a8f25[_0x7f0c('0x1f')]},'options':{'expiresIn':0x15180}};return authService[_0x7f0c('0x2e')](_0x1d9362)['then'](function(_0x7eeb31){_0x5abde6[_0x7f0c('0x2f')]({'id':_0x1a8f25['id'],'token':_0x7eeb31,'statusCall':'','isAlreadyLogged':_0x1a8f25[_0x7f0c('0x22')]});});}})(_0x46697c,_0x5abde6,_0x301d42);};passport['use']('ad-login',new LocalStrategy({'usernameField':'name','passwordField':_0x7f0c('0x1d')},function(_0x1a83e3,_0x4f20dd,_0x42d81a){return ActiveDirectoryAuthenticate(db['User'],_0x1a83e3,_0x4f20dd,_0x42d81a);}));
\ No newline at end of file
+var _0xf82c=['activedirectory2','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','undefined','baseDN','url','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','online','admin','user','agent','then','blocked','blockedAt','add','minutes','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','User','passport-local','Strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf82c,0x19c));var _0xcf82=function(_0x21966c,_0x105df4){_0x21966c=_0x21966c-0x0;var _0x503c35=_0xf82c[_0x21966c];return _0x503c35;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xcf82('0x0'))[_0xcf82('0x1')];var moment=require('moment');var ActiveDirectory=require(_0xcf82('0x2'));var BPromise=require('bluebird');var util=require(_0xcf82('0x3'));var db=require('../../mysqldb')['db'];var authService=require(_0xcf82('0x4'));var utils=require(_0xcf82('0x5'));var config=require(_0xcf82('0x6'));var logger=require(_0xcf82('0x7'))('api');function isActiveDirectoryConfigured(_0x10a868){var _0x18dc47=![];if(typeof _0x10a868[_0xcf82('0x8')]!==_0xcf82('0x9')){_0x18dc47=_0x10a868[_0xcf82('0x8')][_0xcf82('0xa')]&&_0x10a868[_0xcf82('0x8')][_0xcf82('0xb')]&&_0x10a868[_0xcf82('0x8')]['domain'];}return _0x18dc47;}function adAuthenticate(_0x4fb437,_0x42b68f,_0x85b5e){return new BPromise(function(_0x3c129e,_0x17c22a){try{var _0xc48df=new ActiveDirectory(_0x4fb437);_0xc48df['authenticate'](_0x42b68f,_0x85b5e,function(_0x50930d,_0x2ed205){if(_0x50930d){logger[_0xcf82('0xc')]('Error\x20authenticate\x20%s:\x20%s',_0x42b68f,util[_0xcf82('0xd')](_0x50930d,{'showHidden':![],'depth':null}));_0x17c22a(_0xcf82('0xe'));}else if(!_0x2ed205){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x42b68f);_0x17c22a(_0xcf82('0xe'));}else{_0x3c129e(_0x2ed205);}});}catch(_0x315995){_0x17c22a(_0x315995);}});}function ActiveDirectoryAuthenticate(_0xa881a2,_0x562282,_0x4ed845,_0x23629d){var _0x32a88c,_0x3e3a57;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xcf82('0xf'),_0x562282);return _0x23629d(null,![],{'message':_0xcf82('0xe')});}return db[_0xcf82('0x10')][_0xcf82('0x11')]({'where':{'id':0x1},'attributes':[_0xcf82('0x12'),_0xcf82('0x13')],'raw':!![]})['then'](function(_0x2e7783){_0x32a88c=_0x2e7783;if(!_0x32a88c[_0xcf82('0x12')]){logger[_0xcf82('0xc')](_0xcf82('0x14'),_0x562282);throw new Error(_0xcf82('0xe'));}return _0xa881a2[_0xcf82('0x11')]({'attributes':['id',_0xcf82('0x15'),_0xcf82('0x16'),_0xcf82('0x17'),_0xcf82('0x18'),_0xcf82('0x19'),'blocked','blockedAt',_0xcf82('0x1a')],'where':{'name':_0x562282,'role':{'$or':[_0xcf82('0x1b'),_0xcf82('0x1c'),_0xcf82('0x1d')]},'adSsoEnabled':!![]}});})[_0xcf82('0x1e')](function(_0x10148e){if(!_0x10148e||_0x10148e&&_0x10148e[_0xcf82('0x15')]!==_0x562282){throw new Error(_0xcf82('0xe'));}_0x3e3a57=_0x10148e;var _0x5c57c8=_0x3e3a57['name']+'@'+config[_0xcf82('0x8')]['domain'];return adAuthenticate(config[_0xcf82('0x8')],_0x5c57c8,_0x4ed845);})['then'](function(_0x390396){if(_0x3e3a57[_0xcf82('0x19')]){throw new Error(_0xcf82('0xe'));}if(_0x32a88c[_0xcf82('0x13')]>0x0){if(_0x3e3a57[_0xcf82('0x1f')]){if(moment(_0x3e3a57[_0xcf82('0x20')])[_0xcf82('0x21')](_0x32a88c[_0xcf82('0x13')],_0xcf82('0x22'))>moment()){throw new Error(_0xcf82('0xe'));}return utils['clearBlockUser'](_0x3e3a57,0x0,![],null)[_0xcf82('0x1e')](function(){return utils[_0xcf82('0x23')](_0x3e3a57);})['then'](function(){return _0x23629d(null,_0x3e3a57);});}else{return utils[_0xcf82('0x23')](_0x3e3a57)[_0xcf82('0x1e')](function(){return _0x23629d(null,_0x3e3a57);});}}else{return utils[_0xcf82('0x23')](_0x3e3a57)[_0xcf82('0x1e')](function(){return _0x23629d(null,_0x3e3a57);});}})[_0xcf82('0x24')](function(_0x4653d5){return _0x23629d(null,![],_0x4653d5);});}function handleError(_0x30692a,_0x5a3142,_0x308a94){return _0x30692a[_0xcf82('0x25')](_0x5a3142||0x1f4)[_0xcf82('0x26')]({'message':_0x308a94?_0x308a94[_0xcf82('0x27')]||_0x308a94:''});}exports[_0xcf82('0x28')]=function(_0x38514d,_0x4b39b0,_0x2b66cf){passport['authenticate'](_0xcf82('0x29'),function(_0x576f95,_0x109f50,_0x1f0571){var _0x43f958=_0x576f95||_0x1f0571;if(_0x43f958){return handleError(_0x4b39b0,0x191,_0x43f958);}if(!_0x109f50){return handleError(_0x4b39b0,0x194,{'message':_0xcf82('0x2a')});}else{var _0x465c46={'payload':{'id':_0x109f50['id'],'role':_0x109f50[_0xcf82('0x18')]},'options':{'expiresIn':0x15180}};return authService[_0xcf82('0x2b')](_0x465c46)[_0xcf82('0x1e')](function(_0x5f3043){_0x4b39b0[_0xcf82('0x2c')]({'id':_0x109f50['id'],'token':_0x5f3043,'statusCall':'','isAlreadyLogged':_0x109f50[_0xcf82('0x1a')]});});}})(_0x38514d,_0x4b39b0,_0x2b66cf);};passport['use'](_0xcf82('0x29'),new LocalStrategy({'usernameField':_0xcf82('0x15'),'passwordField':_0xcf82('0x16')},function(_0x5cda69,_0x452c6d,_0x2e99d4){return ActiveDirectoryAuthenticate(db[_0xcf82('0x2d')],_0x5cda69,_0x452c6d,_0x2e99d4);}));
\ No newline at end of file
index fcac7b5..1dc8924 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5994=['express','Router','post'];(function(_0x464c79,_0xaac0a9){var _0x5f4fce=function(_0x291074){while(--_0x291074){_0x464c79['push'](_0x464c79['shift']());}};_0x5f4fce(++_0xaac0a9);}(_0x5994,0xf3));var _0x4599=function(_0x10119d,_0x232452){_0x10119d=_0x10119d-0x0;var _0x13b4ee=_0x5994[_0x10119d];return _0x13b4ee;};'use strict';var express=require(_0x4599('0x0'));var router=express[_0x4599('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x4599('0x2')]('/',controller['login']);module['exports']=router;
\ No newline at end of file
+var _0x4925=['exports','Router','post'];(function(_0xeec64b,_0x19cdc7){var _0x50b468=function(_0x8ff95d){while(--_0x8ff95d){_0xeec64b['push'](_0xeec64b['shift']());}};_0x50b468(++_0x19cdc7);}(_0x4925,0x100));var _0x5492=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0x4925[_0x4d79bc];return _0x4b4760;};'use strict';var express=require('express');var router=express[_0x5492('0x0')]();var controller=require('./authActiveDirectory.controller');router[_0x5492('0x1')]('/',controller['login']);module[_0x5492('0x2')]=router;
\ No newline at end of file
index 1808643..5bd3ac6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x230345,_0x4cef91){var _0x2da0fa=function(_0x3162dc){while(--_0x3162dc){_0x230345['push'](_0x230345['shift']());}};_0x2da0fa(++_0x4cef91);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});}));
\ No newline at end of file
+var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0xcfe9cb,_0x427934){var _0x163cd3=function(_0x4ee5cf){while(--_0x4ee5cf){_0xcfe9cb['push'](_0xcfe9cb['shift']());}};_0x163cd3(++_0x427934);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});}));
\ No newline at end of file
index f5640a3..8d7dc04 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x18ee=['/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../../components/auth/service','get','login'];(function(_0x1d0d95,_0x186cb4){var _0x26916a=function(_0x1fde9b){while(--_0x1fde9b){_0x1d0d95['push'](_0x1d0d95['shift']());}};_0x26916a(++_0x186cb4);}(_0x18ee,0x119));var _0xe18e=function(_0x14c759,_0x15b675){_0x14c759=_0x14c759-0x0;var _0x49b5df=_0x18ee[_0x14c759];return _0x49b5df;};'use strict';var express=require(_0xe18e('0x0'));var passport=require(_0xe18e('0x1'));var router=express[_0xe18e('0x2')]();var controller=require(_0xe18e('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0xe18e('0x4'));router[_0xe18e('0x5')]('/',controller[_0xe18e('0x6')]);router[_0xe18e('0x5')](_0xe18e('0x7'),controller[_0xe18e('0x8')],authService[_0xe18e('0x9')],userController[_0xe18e('0x6')],authService[_0xe18e('0xa')]);module[_0xe18e('0xb')]=router;
\ No newline at end of file
+var _0x4ee7=['exports','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback'];(function(_0x1d8b9c,_0xc2cdd3){var _0x459bf4=function(_0xe2f94b){while(--_0xe2f94b){_0x1d8b9c['push'](_0x1d8b9c['shift']());}};_0x459bf4(++_0xc2cdd3);}(_0x4ee7,0x169));var _0x74ee=function(_0x5b7f29,_0x34a2b4){_0x5b7f29=_0x5b7f29-0x0;var _0x1946b9=_0x4ee7[_0x5b7f29];return _0x1946b9;};'use strict';var express=require(_0x74ee('0x0'));var passport=require(_0x74ee('0x1'));var router=express['Router']();var controller=require(_0x74ee('0x2'));var userController=require(_0x74ee('0x3'));var authService=require(_0x74ee('0x4'));router[_0x74ee('0x5')]('/',controller[_0x74ee('0x6')]);router[_0x74ee('0x5')](_0x74ee('0x7'),controller['callback'],authService['isMiddleware'],userController[_0x74ee('0x6')],authService['setTokenCookie']);module[_0x74ee('0x8')]=router;
\ No newline at end of file
index ea932f2..85ead72 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x374a=['admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','blockedAt','add','clearBlockUser','blocked','getLicense','catch','MailAccount','email','MailServerOut','CloudProvider','merge','format','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','find','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','password','resetPasswordExpires','Password\x20reset!','util','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','disabled','loginAttempts'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x374a,0x12c));var _0xa374=function(_0x27958a,_0x5a55b){_0x27958a=_0x27958a-0x0;var _0x16a511=_0x374a[_0x27958a];return _0x16a511;};'use strict';var util=require(_0xa374('0x0'));var passport=require('passport');var LocalStrategy=require(_0xa374('0x1'))[_0xa374('0x2')];var jayson=require(_0xa374('0x3'));var _=require('lodash');var rs=require(_0xa374('0x4'));var moment=require(_0xa374('0x5'));var db=require(_0xa374('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xa374('0x7'));var client=jayson[_0xa374('0x8')][_0xa374('0x9')]({'port':0x232b});function localAuthenticate(_0x17a473,_0x2737c9,_0x9d17d,_0x526177){var _0x2e83cc,_0x35009b;return db[_0xa374('0xa')][_0xa374('0xb')]({'where':{'id':0x1},'attributes':[_0xa374('0xc'),'blockDuration'],'raw':!![]})[_0xa374('0xd')](function(_0x296073){_0x2e83cc=_0x296073;return _0x17a473['findOne']({'attributes':['id','name','password','salt','role',_0xa374('0xe'),'blocked','blockedAt',_0xa374('0xf')],'where':{'name':_0x2737c9,'role':{'$or':[_0xa374('0x10'),_0xa374('0x11'),_0xa374('0x12')]}}});})[_0xa374('0xd')](function(_0x53a51a){if(!_0x53a51a||_0x53a51a&&_0x53a51a[_0xa374('0x13')]!==_0x2737c9){throw new Error(_0xa374('0x14'));}else{_0x35009b=_0x53a51a;return _0x35009b;}})['then'](function(){_0x35009b[_0xa374('0x15')](_0x9d17d,function(_0x29ebf2,_0x324e5f){var _0x3cda19=_0x35009b['loginAttempts']+0x1;if(_0x29ebf2){return _0x526177(_0x29ebf2);}else if(!_0x324e5f){if(_0x35009b['disabled']){return _0x526177(null,![],{'message':_0xa374('0x14')});}else if(_0x2e83cc[_0xa374('0xc')]>0x0){if(_0x35009b['blocked']){if(_0x2e83cc[_0xa374('0x16')]>0x0){if(moment(_0x35009b[_0xa374('0x17')])[_0xa374('0x18')](_0x2e83cc[_0xa374('0x16')],'minutes')>moment()){return _0x526177(null,![],{'message':_0xa374('0x14')});}else{return utils[_0xa374('0x19')](_0x35009b,_0x3cda19,![],null)[_0xa374('0xd')](function(){return _0x526177(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x526177(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3cda19>=_0x2e83cc[_0xa374('0xc')]){return utils['clearBlockUser'](_0x35009b,0x0,!![],moment())['then'](function(){return _0x526177(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xa374('0x19')](_0x35009b,_0x3cda19,![],null)[_0xa374('0xd')](function(){return _0x526177(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x526177(null,![],{'message':_0xa374('0x14')});}}else{if(_0x35009b[_0xa374('0xe')]){return _0x526177(null,![],{'message':_0xa374('0x14')});}else if(_0x2e83cc[_0xa374('0xc')]>0x0){if(_0x35009b[_0xa374('0x1a')]){if(_0x2e83cc[_0xa374('0x16')]>0x0){if(moment(_0x35009b[_0xa374('0x17')])[_0xa374('0x18')](_0x2e83cc[_0xa374('0x16')],'minutes')>moment()){return _0x526177(null,![],{'message':_0xa374('0x14')});}else{return utils[_0xa374('0x19')](_0x35009b,0x0,![],null)[_0xa374('0xd')](function(){return utils[_0xa374('0x1b')](_0x35009b);})[_0xa374('0xd')](function(){return _0x526177(null,_0x35009b);});}}else{return _0x526177(null,![],{'message':_0xa374('0x14')});}}else{return utils['clearBlockUser'](_0x35009b,0x0,![],null)['then'](function(){return utils[_0xa374('0x1b')](_0x35009b);})['then'](function(){return _0x526177(null,_0x35009b);})[_0xa374('0x1c')](function(_0x5ca45c){return _0x526177(null,![],_0x5ca45c);});}}else{if(_0x35009b['blocked']){return _0x526177(null,![],{'message':_0xa374('0x14')});}else{return utils[_0xa374('0x1b')](_0x35009b)[_0xa374('0xd')](function(){return _0x526177(null,_0x35009b);});}}}});})['catch'](function(_0x56fff2){return _0x526177(null,![],_0x56fff2);});}function sendServiceMail(_0x4e461d){return db[_0xa374('0x1d')]['find']({'where':{'service':!![]},'attributes':['id',_0xa374('0x13'),_0xa374('0x1e')],'include':[{'model':db[_0xa374('0x1f')],'as':'Smtp','include':[{'model':db[_0xa374('0x20')],'as':_0xa374('0x20')}]}]})[_0xa374('0xd')](function(_0x49fc53){if(!_0x49fc53){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x59f88c=_0x49fc53['getSmtpOptions']();var _0xd3dc5f={'account':_0x59f88c,'message':_[_0xa374('0x21')]({'from':util[_0xa374('0x22')]('\x22%s\x22\x20<%s>',_0x49fc53[_0xa374('0x13')],_0x49fc53['email']||_0x49fc53[_0xa374('0x23')]['user'])},_0x4e461d)};return client[_0xa374('0x24')](_0xa374('0x25'),_0xd3dc5f);})[_0xa374('0xd')](function(_0x2e4c75){if(_0x2e4c75[_0xa374('0x26')]){throw new Error(util['format'](_0xa374('0x27'),_0x2e4c75[_0xa374('0x26')][_0xa374('0x28')]||JSON[_0xa374('0x29')](_0x2e4c75[_0xa374('0x26')])));}return!![];});}function handleError(_0x5d3cc7,_0x582991,_0x264e75){return _0x5d3cc7[_0xa374('0x2a')](_0x582991||0x1f4)[_0xa374('0x2b')]({'message':_0x264e75?_0x264e75['message']||_0x264e75:''});}exports['login']=function(_0x2563a1,_0x4aa5a3,_0x292b27){passport[_0xa374('0x15')](_0xa374('0x2c'),function(_0x23e2ec,_0x1cc42b,_0x12c7b2){var _0x2c4e1d=_0x23e2ec||_0x12c7b2;if(_0x2c4e1d){return handleError(_0x4aa5a3,0x191,_0x2c4e1d);}if(!_0x1cc42b){return handleError(_0x4aa5a3,0x194,{'message':_0xa374('0x2d')});}else{var _0x29a0e0={'payload':{'id':_0x1cc42b['id'],'role':_0x1cc42b[_0xa374('0x2e')]},'options':{'expiresIn':0x15180}};return authService[_0xa374('0x2f')](_0x29a0e0)[_0xa374('0xd')](function(_0x598ccb){_0x4aa5a3[_0xa374('0x30')]({'id':_0x1cc42b['id'],'token':_0x598ccb,'statusCall':'','isAlreadyLogged':_0x1cc42b[_0xa374('0x31')]});});}})(_0x2563a1,_0x4aa5a3,_0x292b27);};exports[_0xa374('0x32')]=function(_0x54eed3,_0x563e6d){if(!_0x54eed3[_0xa374('0x33')][_0xa374('0x1e')]){return handleError(_0x563e6d,0x1f4,{'message':_0xa374('0x34')});}var _0x86eb9a=rs[_0xa374('0x35')]();_0x54eed3[_0xa374('0x33')][_0xa374('0x1e')]=_0x54eed3['body'][_0xa374('0x1e')][_0xa374('0x36')]()['toLowerCase']();var _0x1bc87b;return db[_0xa374('0xa')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa374('0x16')],'raw':!![]})[_0xa374('0xd')](function(_0x50808e){_0x1bc87b=_0x50808e;return db['User'][_0xa374('0x37')]({'where':{'email':_0x54eed3[_0xa374('0x33')][_0xa374('0x1e')]}});})[_0xa374('0xd')](function(_0x2e48a1){if(!_0x2e48a1){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x2e48a1[_0xa374('0xe')]){throw new Error(_0xa374('0x38'));}if(_0x2e48a1[_0xa374('0x1a')]){if(moment(_0x2e48a1[_0xa374('0x17')])[_0xa374('0x18')](_0x1bc87b[_0xa374('0x16')],_0xa374('0x39'))>moment()){throw new Error(_0xa374('0x3a'));}else{_0x2e48a1['blocked']=![];_0x2e48a1[_0xa374('0x17')]=null;}}_0x2e48a1[_0xa374('0x3b')]=_0x86eb9a;_0x2e48a1['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x2e48a1[_0xa374('0x3c')]();})[_0xa374('0xd')](function(){return sendServiceMail({'to':_0x54eed3[_0xa374('0x33')][_0xa374('0x1e')],'subject':_0xa374('0x3d'),'text':_0xa374('0x3e')+_0xa374('0x3f')+'https://'+_0x54eed3[_0xa374('0x40')][_0xa374('0x41')]+_0xa374('0x42')+_0x86eb9a+'\x0a\x0a'+_0xa374('0x43')});})['then'](function(){_0x563e6d['status'](0xc8)[_0xa374('0x2b')]({'message':'Reset\x20Email\x20sent!'});})[_0xa374('0x1c')](function(_0x4715cb){return handleError(_0x563e6d,0x1f4,_0x4715cb);});};exports[_0xa374('0x44')]=function(_0x2c46a0,_0x5c0e5c){return db[_0xa374('0x45')]['find']({'where':{'resetPasswordToken':_0x2c46a0['params'][_0xa374('0x46')],'resetPasswordExpires':{'$gt':Date[_0xa374('0x47')]()}}})[_0xa374('0xd')](function(_0x26b48d){if(!_0x26b48d){throw new Error(_0xa374('0x48'));}return db[_0xa374('0xa')][_0xa374('0xb')]({'attributes':['id',_0xa374('0x49'),_0xa374('0x4a'),_0xa374('0x4b')]})[_0xa374('0xd')](function(_0x13e6eb){if(_0x13e6eb[_0xa374('0x49')])authService['validatePasswordPattern'](_0x2c46a0['body'][_0xa374('0x4c')]);if(!_0x13e6eb[_0xa374('0x4a')]||!_0x26b48d['previousPasswords'])return _0x26b48d;authService['validatePasswordHistory'](_0x2c46a0[_0xa374('0x33')]['password'],_0x26b48d['previousPasswords'],_0x13e6eb[_0xa374('0x4b')]);return _0x26b48d;})[_0xa374('0xd')](function(){_0x26b48d[_0xa374('0x4c')]=_0x2c46a0[_0xa374('0x33')][_0xa374('0x4c')];_0x26b48d['resetPasswordToken']=null;_0x26b48d[_0xa374('0x4d')]=null;return _0x26b48d[_0xa374('0x3c')]();});})['then'](function(){_0x5c0e5c[_0xa374('0x2a')](0xc8)[_0xa374('0x2b')]({'message':_0xa374('0x4e')});})[_0xa374('0x1c')](function(_0x280f62){return handleError(_0x5c0e5c,0x1f4,_0x280f62);});};passport['use']('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0xa374('0x4c')},function(_0x1a4c5f,_0x13ac15,_0x19f217){return localAuthenticate(db[_0xa374('0x45')],_0x1a4c5f,_0x13ac15,_0x19f217);}));
\ No newline at end of file
+var _0x8f56=['This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','use','util','passport','passport-local','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','client','http','findOne','allowedLoginAttempts','blockDuration','name','password','salt','role','blocked','loginAttempts','admin','user','agent','then','authenticate','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','disabled','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User'];(function(_0x3fdb0e,_0x1e1ee8){var _0x3a3a20=function(_0x2486b8){while(--_0x2486b8){_0x3fdb0e['push'](_0x3fdb0e['shift']());}};_0x3a3a20(++_0x1e1ee8);}(_0x8f56,0x6d));var _0x68f5=function(_0x42e743,_0x4946b6){_0x42e743=_0x42e743-0x0;var _0x512bc1=_0x8f56[_0x42e743];return _0x512bc1;};'use strict';var util=require(_0x68f5('0x0'));var passport=require(_0x68f5('0x1'));var LocalStrategy=require(_0x68f5('0x2'))['Strategy'];var jayson=require(_0x68f5('0x3'));var _=require(_0x68f5('0x4'));var rs=require(_0x68f5('0x5'));var moment=require('moment');var db=require(_0x68f5('0x6'))['db'];var authService=require(_0x68f5('0x7'));var utils=require('../../config/utils');var client=jayson[_0x68f5('0x8')][_0x68f5('0x9')]({'port':0x232b});function localAuthenticate(_0x55403c,_0x4a0335,_0x5263f3,_0x48778d){var _0x18ec9e,_0x33c472;return db['Setting'][_0x68f5('0xa')]({'where':{'id':0x1},'attributes':[_0x68f5('0xb'),_0x68f5('0xc')],'raw':!![]})['then'](function(_0x3cc6ff){_0x18ec9e=_0x3cc6ff;return _0x55403c[_0x68f5('0xa')]({'attributes':['id',_0x68f5('0xd'),_0x68f5('0xe'),_0x68f5('0xf'),_0x68f5('0x10'),'disabled',_0x68f5('0x11'),'blockedAt',_0x68f5('0x12')],'where':{'name':_0x4a0335,'role':{'$or':[_0x68f5('0x13'),_0x68f5('0x14'),_0x68f5('0x15')]}}});})['then'](function(_0x4fa4f5){if(!_0x4fa4f5||_0x4fa4f5&&_0x4fa4f5['name']!==_0x4a0335){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x33c472=_0x4fa4f5;return _0x33c472;}})[_0x68f5('0x16')](function(){_0x33c472[_0x68f5('0x17')](_0x5263f3,function(_0x315754,_0x1cb9a4){var _0x5c11d3=_0x33c472[_0x68f5('0x12')]+0x1;if(_0x315754){return _0x48778d(_0x315754);}else if(!_0x1cb9a4){if(_0x33c472['disabled']){return _0x48778d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x18ec9e['allowedLoginAttempts']>0x0){if(_0x33c472[_0x68f5('0x11')]){if(_0x18ec9e['blockDuration']>0x0){if(moment(_0x33c472[_0x68f5('0x18')])[_0x68f5('0x19')](_0x18ec9e[_0x68f5('0xc')],_0x68f5('0x1a'))>moment()){return _0x48778d(null,![],{'message':_0x68f5('0x1b')});}else{return utils['clearBlockUser'](_0x33c472,_0x5c11d3,![],null)[_0x68f5('0x16')](function(){return _0x48778d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x48778d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x5c11d3>=_0x18ec9e['allowedLoginAttempts']){return utils[_0x68f5('0x1c')](_0x33c472,0x0,!![],moment())[_0x68f5('0x16')](function(){return _0x48778d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x68f5('0x1c')](_0x33c472,_0x5c11d3,![],null)[_0x68f5('0x16')](function(){return _0x48778d(null,![],{'message':_0x68f5('0x1b')});});}}}else{return _0x48778d(null,![],{'message':_0x68f5('0x1b')});}}else{if(_0x33c472[_0x68f5('0x1d')]){return _0x48778d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x18ec9e['allowedLoginAttempts']>0x0){if(_0x33c472['blocked']){if(_0x18ec9e['blockDuration']>0x0){if(moment(_0x33c472['blockedAt'])[_0x68f5('0x19')](_0x18ec9e['blockDuration'],_0x68f5('0x1a'))>moment()){return _0x48778d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x68f5('0x1c')](_0x33c472,0x0,![],null)[_0x68f5('0x16')](function(){return utils[_0x68f5('0x1e')](_0x33c472);})[_0x68f5('0x16')](function(){return _0x48778d(null,_0x33c472);});}}else{return _0x48778d(null,![],{'message':_0x68f5('0x1b')});}}else{return utils[_0x68f5('0x1c')](_0x33c472,0x0,![],null)[_0x68f5('0x16')](function(){return utils[_0x68f5('0x1e')](_0x33c472);})[_0x68f5('0x16')](function(){return _0x48778d(null,_0x33c472);})[_0x68f5('0x1f')](function(_0x1497c4){return _0x48778d(null,![],_0x1497c4);});}}else{if(_0x33c472[_0x68f5('0x11')]){return _0x48778d(null,![],{'message':_0x68f5('0x1b')});}else{return utils['getLicense'](_0x33c472)[_0x68f5('0x16')](function(){return _0x48778d(null,_0x33c472);});}}}});})['catch'](function(_0x396158){return _0x48778d(null,![],_0x396158);});}function sendServiceMail(_0x166708){return db[_0x68f5('0x20')][_0x68f5('0x21')]({'where':{'service':!![]},'attributes':['id',_0x68f5('0xd'),_0x68f5('0x22')],'include':[{'model':db[_0x68f5('0x23')],'as':_0x68f5('0x24'),'include':[{'model':db[_0x68f5('0x25')],'as':_0x68f5('0x25')}]}]})[_0x68f5('0x16')](function(_0x1b29e6){if(!_0x1b29e6){throw new Error(_0x68f5('0x26'));}var _0x56aa3b=_0x1b29e6[_0x68f5('0x27')]();var _0x27a84d={'account':_0x56aa3b,'message':_['merge']({'from':util[_0x68f5('0x28')](_0x68f5('0x29'),_0x1b29e6[_0x68f5('0xd')],_0x1b29e6[_0x68f5('0x22')]||_0x1b29e6[_0x68f5('0x24')][_0x68f5('0x14')])},_0x166708)};return client['request'](_0x68f5('0x2a'),_0x27a84d);})['then'](function(_0x28a157){if(_0x28a157[_0x68f5('0x2b')]){throw new Error(util[_0x68f5('0x28')](_0x68f5('0x2c'),_0x28a157[_0x68f5('0x2b')][_0x68f5('0x2d')]||JSON['stringify'](_0x28a157[_0x68f5('0x2b')])));}return!![];});}function handleError(_0x19e382,_0x4577d2,_0x4bd34a){return _0x19e382[_0x68f5('0x2e')](_0x4577d2||0x1f4)[_0x68f5('0x2f')]({'message':_0x4bd34a?_0x4bd34a[_0x68f5('0x2d')]||_0x4bd34a:''});}exports['login']=function(_0x1504f1,_0x302ae8,_0x4c2aa6){passport[_0x68f5('0x17')](_0x68f5('0x30'),function(_0x25dafe,_0x13eb73,_0x555b66){var _0x48e040=_0x25dafe||_0x555b66;if(_0x48e040){return handleError(_0x302ae8,0x191,_0x48e040);}if(!_0x13eb73){return handleError(_0x302ae8,0x194,{'message':_0x68f5('0x31')});}else{var _0x546b1f={'payload':{'id':_0x13eb73['id'],'role':_0x13eb73[_0x68f5('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x68f5('0x32')](_0x546b1f)[_0x68f5('0x16')](function(_0x553cd7){_0x302ae8[_0x68f5('0x33')]({'id':_0x13eb73['id'],'token':_0x553cd7,'statusCall':'','isAlreadyLogged':_0x13eb73[_0x68f5('0x34')]});});}})(_0x1504f1,_0x302ae8,_0x4c2aa6);};exports[_0x68f5('0x35')]=function(_0x474b1e,_0x2d597d){if(!_0x474b1e[_0x68f5('0x36')][_0x68f5('0x22')]){return handleError(_0x2d597d,0x1f4,{'message':_0x68f5('0x37')});}var _0x47a774=rs[_0x68f5('0x38')]();_0x474b1e['body'][_0x68f5('0x22')]=_0x474b1e[_0x68f5('0x36')]['email'][_0x68f5('0x39')]()[_0x68f5('0x3a')]();var _0x40307b;return db[_0x68f5('0x3b')]['findOne']({'where':{'id':0x1},'attributes':[_0x68f5('0xb'),_0x68f5('0xc')],'raw':!![]})[_0x68f5('0x16')](function(_0x58215e){_0x40307b=_0x58215e;return db[_0x68f5('0x3c')][_0x68f5('0x21')]({'where':{'email':_0x474b1e[_0x68f5('0x36')][_0x68f5('0x22')]}});})[_0x68f5('0x16')](function(_0x36d064){if(!_0x36d064){throw new Error(_0x68f5('0x3d'));}if(_0x36d064[_0x68f5('0x1d')]){throw new Error(_0x68f5('0x3e'));}if(_0x36d064[_0x68f5('0x11')]){if(moment(_0x36d064[_0x68f5('0x18')])[_0x68f5('0x19')](_0x40307b[_0x68f5('0xc')],'minutes')>moment()){throw new Error(_0x68f5('0x3f'));}else{_0x36d064[_0x68f5('0x11')]=![];_0x36d064[_0x68f5('0x18')]=null;}}_0x36d064[_0x68f5('0x40')]=_0x47a774;_0x36d064[_0x68f5('0x41')]=Date[_0x68f5('0x42')]()+0x36ee80;return _0x36d064[_0x68f5('0x43')]();})[_0x68f5('0x16')](function(){return sendServiceMail({'to':_0x474b1e[_0x68f5('0x36')][_0x68f5('0x22')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x68f5('0x44')+_0x68f5('0x45')+_0x68f5('0x46')+_0x474b1e[_0x68f5('0x47')][_0x68f5('0x48')]+_0x68f5('0x49')+_0x47a774+'\x0a\x0a'+_0x68f5('0x4a')});})[_0x68f5('0x16')](function(){_0x2d597d[_0x68f5('0x2e')](0xc8)[_0x68f5('0x2f')]({'message':_0x68f5('0x4b')});})[_0x68f5('0x1f')](function(_0x3827bc){return handleError(_0x2d597d,0x1f4,_0x3827bc);});};exports['reset']=function(_0x171b66,_0x262ea9){return db[_0x68f5('0x3c')]['find']({'where':{'resetPasswordToken':_0x171b66[_0x68f5('0x4c')][_0x68f5('0x4d')],'resetPasswordExpires':{'$gt':Date[_0x68f5('0x42')]()}}})[_0x68f5('0x16')](function(_0x47d629){if(!_0x47d629){throw new Error(_0x68f5('0x4e'));}return db['Setting'][_0x68f5('0xa')]({'attributes':['id',_0x68f5('0x4f'),_0x68f5('0x50'),_0x68f5('0x51')]})[_0x68f5('0x16')](function(_0x3c2edf){if(_0x3c2edf[_0x68f5('0x4f')])authService['validatePasswordPattern'](_0x171b66[_0x68f5('0x36')][_0x68f5('0xe')]);if(!_0x3c2edf['enforcePasswordHistory']||!_0x47d629[_0x68f5('0x52')])return _0x47d629;authService[_0x68f5('0x53')](_0x171b66['body'][_0x68f5('0xe')],_0x47d629[_0x68f5('0x52')],_0x3c2edf[_0x68f5('0x51')]);return _0x47d629;})[_0x68f5('0x16')](function(){_0x47d629[_0x68f5('0xe')]=_0x171b66[_0x68f5('0x36')][_0x68f5('0xe')];_0x47d629[_0x68f5('0x40')]=null;_0x47d629[_0x68f5('0x41')]=null;return _0x47d629[_0x68f5('0x43')]();});})[_0x68f5('0x16')](function(){_0x262ea9['status'](0xc8)['send']({'message':'Password\x20reset!'});})[_0x68f5('0x1f')](function(_0x55b17b){return handleError(_0x262ea9,0x1f4,_0x55b17b);});};passport[_0x68f5('0x54')]('local-login',new LocalStrategy({'usernameField':_0x68f5('0xd'),'passwordField':'password'},function(_0x175e29,_0x5bbb14,_0x560e73){return localAuthenticate(db['User'],_0x175e29,_0x5bbb14,_0x560e73);}));
\ No newline at end of file
index 50afdbc..0329e97 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4734=['/reset/:token','exports','express','Router','./authLocal.controller','post'];(function(_0x3c88cc,_0x9effd){var _0x4b335f=function(_0x1fd228){while(--_0x1fd228){_0x3c88cc['push'](_0x3c88cc['shift']());}};_0x4b335f(++_0x9effd);}(_0x4734,0x98));var _0x4473=function(_0x41c7e5,_0x5dc9fc){_0x41c7e5=_0x41c7e5-0x0;var _0x49caab=_0x4734[_0x41c7e5];return _0x49caab;};'use strict';var express=require(_0x4473('0x0'));var router=express[_0x4473('0x1')]();var controller=require(_0x4473('0x2'));router[_0x4473('0x3')]('/',controller['login']);router[_0x4473('0x3')]('/forgot',controller['forgot']);router[_0x4473('0x3')](_0x4473('0x4'),controller['reset']);module[_0x4473('0x5')]=router;
\ No newline at end of file
+var _0x78c6=['reset','exports','express','./authLocal.controller','post','login','/forgot','/reset/:token'];(function(_0x352f98,_0x5a0b02){var _0x1af6aa=function(_0x28cf8c){while(--_0x28cf8c){_0x352f98['push'](_0x352f98['shift']());}};_0x1af6aa(++_0x5a0b02);}(_0x78c6,0x9a));var _0x678c=function(_0x10de82,_0x380e01){_0x10de82=_0x10de82-0x0;var _0x42fe6a=_0x78c6[_0x10de82];return _0x42fe6a;};'use strict';var express=require(_0x678c('0x0'));var router=express['Router']();var controller=require(_0x678c('0x1'));router[_0x678c('0x2')]('/',controller[_0x678c('0x3')]);router[_0x678c('0x2')](_0x678c('0x4'),controller['forgot']);router['post'](_0x678c('0x5'),controller[_0x678c('0x6')]);module[_0x678c('0x7')]=router;
\ No newline at end of file
index 1e55f80..3a327d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdfbf=['BOOLEAN','sequelize','exports','STRING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xdfbf,0x85));var _0xfdfb=function(_0x32ab06,_0x527c6b){_0x32ab06=_0x32ab06-0x0;var _0x2bb9b7=_0xdfbf[_0x32ab06];return _0x2bb9b7;};'use strict';var Sequelize=require(_0xfdfb('0x0'));module[_0xfdfb('0x1')]={'name':{'type':Sequelize[_0xfdfb('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfdfb('0x2')]},'status':{'type':Sequelize[_0xfdfb('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}};
\ No newline at end of file
+var _0x63d2=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x5d101d,_0x24a562){var _0x2d04e5=function(_0x48e999){while(--_0x48e999){_0x5d101d['push'](_0x5d101d['shift']());}};_0x2d04e5(++_0x24a562);}(_0x63d2,0x1b9));var _0x263d=function(_0x471f5e,_0xcb6c40){_0x471f5e=_0x471f5e-0x0;var _0x235f67=_0x63d2[_0x471f5e];return _0x235f67;};'use strict';var Sequelize=require(_0x263d('0x0'));module[_0x263d('0x1')]={'name':{'type':Sequelize[_0x263d('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x263d('0x2')]},'description':{'type':Sequelize[_0x263d('0x2')]},'status':{'type':Sequelize[_0x263d('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x263d('0x4')],'defaultValue':0xa}};
\ No newline at end of file
index 0d25b58..29e18f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x64e7=['VIRTUAL','name','options','includeAll','include','findAll','rows','catch','find','create','body','params','addConditions','ids','getConditions','findOne','Condition','addActions','Action','omit','getActions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','count','limit','set','Content-Range','save','update','then','destroy','sendStatus','stack','Automation','rawAttributes','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where'];(function(_0x59cf0b,_0x53707a){var _0x51b771=function(_0x139cbf){while(--_0x139cbf){_0x59cf0b['push'](_0x59cf0b['shift']());}};_0x51b771(++_0x53707a);}(_0x64e7,0xbb));var _0x764e=function(_0x424ddc,_0x2765cd){_0x424ddc=_0x424ddc-0x0;var _0x3a0ead=_0x64e7[_0x424ddc];return _0x3a0ead;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x764e('0x0'));var jsonpatch=require(_0x764e('0x1'));var rp=require(_0x764e('0x2'));var moment=require(_0x764e('0x3'));var BPromise=require(_0x764e('0x4'));var Mustache=require(_0x764e('0x5'));var util=require(_0x764e('0x6'));var path=require(_0x764e('0x7'));var sox=require(_0x764e('0x8'));var csv=require(_0x764e('0x9'));var ejs=require(_0x764e('0xa'));var fs=require('fs');var fs_extra=require(_0x764e('0xb'));var _=require(_0x764e('0xc'));var squel=require('squel');var crypto=require(_0x764e('0xd'));var jsforce=require(_0x764e('0xe'));var deskjs=require(_0x764e('0xf'));var toCsv=require(_0x764e('0x9'));var querystring=require(_0x764e('0x10'));var Papa=require(_0x764e('0x11'));var Redis=require('ioredis');var authService=require(_0x764e('0x12'));var qs=require(_0x764e('0x13'));var as=require(_0x764e('0x14'));var hardwareService=require(_0x764e('0x15'));var logger=require('../../config/logger')(_0x764e('0x16'));var utils=require(_0x764e('0x17'));var config=require(_0x764e('0x18'));var licenseUtil=require(_0x764e('0x19'));var db=require(_0x764e('0x1a'))['db'];function respondWithStatusCode(_0x55e92d,_0x5590fa){_0x5590fa=_0x5590fa||0xcc;return function(_0x2309ed){if(_0x2309ed){return _0x55e92d['sendStatus'](_0x5590fa);}return _0x55e92d[_0x764e('0x1b')](_0x5590fa)[_0x764e('0x1c')]();};}function respondWithResult(_0x2a35db,_0x76bf02){_0x76bf02=_0x76bf02||0xc8;return function(_0x29ed49){if(_0x29ed49){return _0x2a35db['status'](_0x76bf02)[_0x764e('0x1d')](_0x29ed49);}};}function respondWithFilteredResult(_0xf43b93,_0x2a9317){return function(_0x5d5c5d){if(_0x5d5c5d){var _0x51b761=typeof _0x2a9317['offset']===_0x764e('0x1e')&&typeof _0x2a9317['limit']===_0x764e('0x1e');var _0x127f24=_0x5d5c5d['count'];var _0x5cfbc9=_0x51b761?0x0:_0x2a9317[_0x764e('0x1f')];var _0x1cceed=_0x51b761?_0x5d5c5d[_0x764e('0x20')]:_0x2a9317[_0x764e('0x1f')]+_0x2a9317[_0x764e('0x21')];var _0x244509;if(_0x1cceed>=_0x127f24){_0x1cceed=_0x127f24;_0x244509=0xc8;}else{_0x244509=0xce;}_0xf43b93['status'](_0x244509);return _0xf43b93[_0x764e('0x22')](_0x764e('0x23'),_0x5cfbc9+'-'+_0x1cceed+'/'+_0x127f24)[_0x764e('0x1d')](_0x5d5c5d);}return null;};}function patchUpdates(_0x29d018){return function(_0x255faf){try{jsonpatch['apply'](_0x255faf,_0x29d018,!![]);}catch(_0x518cf0){return BPromise['reject'](_0x518cf0);}return _0x255faf[_0x764e('0x24')]();};}function saveUpdates(_0x1f780c,_0x256902){return function(_0x2f814f){if(_0x2f814f){return _0x2f814f[_0x764e('0x25')](_0x1f780c)[_0x764e('0x26')](function(_0x274ad2){return _0x274ad2;});}return null;};}function removeEntity(_0x3334d8,_0x4c5ef2){return function(_0x4da96a){if(_0x4da96a){return _0x4da96a[_0x764e('0x27')]()[_0x764e('0x26')](function(){_0x3334d8[_0x764e('0x1b')](0xcc)[_0x764e('0x1c')]();});}};}function handleEntityNotFound(_0x12d4a6,_0x3816f9){return function(_0x568e04){if(!_0x568e04){_0x12d4a6[_0x764e('0x28')](0x194);}return _0x568e04;};}function handleError(_0xd43342,_0x48743d){_0x48743d=_0x48743d||0x1f4;return function(_0x362887){logger['error'](_0x362887[_0x764e('0x29')]);if(_0x362887['name']){delete _0x362887['name'];}_0xd43342[_0x764e('0x1b')](_0x48743d)['send'](_0x362887);};}exports['index']=function(_0x266c0d,_0x6a859e){var _0x2f31de={},_0x2d9033={},_0x3d02ff={'count':0x0,'rows':[]};var _0x444beb=_['map'](db[_0x764e('0x2a')][_0x764e('0x2b')],function(_0x338568){return{'name':_0x338568['fieldName'],'type':_0x338568[_0x764e('0x2c')]['key']};});_0x2d9033['model']=_[_0x764e('0x2d')](_0x444beb,'name');_0x2d9033[_0x764e('0x2e')]=_[_0x764e('0x2f')](_0x266c0d['query']);_0x2d9033[_0x764e('0x30')]=_['intersection'](_0x2d9033[_0x764e('0x31')],_0x2d9033[_0x764e('0x2e')]);_0x2f31de[_0x764e('0x32')]=_[_0x764e('0x33')](_0x2d9033[_0x764e('0x31')],qs[_0x764e('0x34')](_0x266c0d[_0x764e('0x2e')][_0x764e('0x34')]));_0x2f31de[_0x764e('0x32')]=_0x2f31de[_0x764e('0x32')][_0x764e('0x35')]?_0x2f31de[_0x764e('0x32')]:_0x2d9033['model'];if(!_0x266c0d['query'][_0x764e('0x36')](_0x764e('0x37'))){_0x2f31de['limit']=qs['limit'](_0x266c0d[_0x764e('0x2e')][_0x764e('0x21')]);_0x2f31de[_0x764e('0x1f')]=qs[_0x764e('0x1f')](_0x266c0d[_0x764e('0x2e')][_0x764e('0x1f')]);}_0x2f31de[_0x764e('0x38')]=qs[_0x764e('0x39')](_0x266c0d[_0x764e('0x2e')]['sort']);_0x2f31de['where']=qs[_0x764e('0x30')](_[_0x764e('0x3a')](_0x266c0d[_0x764e('0x2e')],_0x2d9033[_0x764e('0x30')]),_0x444beb);if(_0x266c0d[_0x764e('0x2e')][_0x764e('0x3b')]){_0x2f31de['where']=_[_0x764e('0x3c')](_0x2f31de[_0x764e('0x3d')],{'$or':_[_0x764e('0x2d')](_0x444beb,function(_0x3fb357){if(_0x3fb357[_0x764e('0x2c')]!==_0x764e('0x3e')){var _0xf48f22={};_0xf48f22[_0x3fb357[_0x764e('0x3f')]]={'$like':'%'+_0x266c0d[_0x764e('0x2e')][_0x764e('0x3b')]+'%'};return _0xf48f22;}})});}_0x2f31de=_['merge']({},_0x2f31de,_0x266c0d[_0x764e('0x40')]);var _0x316387={'where':_0x2f31de[_0x764e('0x3d')]};return db['Automation'][_0x764e('0x20')](_0x316387)[_0x764e('0x26')](function(_0x277ed1){_0x3d02ff[_0x764e('0x20')]=_0x277ed1;if(_0x266c0d[_0x764e('0x2e')][_0x764e('0x41')]){_0x2f31de[_0x764e('0x42')]=[{'all':!![]}];}return db['Automation'][_0x764e('0x43')](_0x2f31de);})['then'](function(_0x71376){_0x3d02ff[_0x764e('0x44')]=_0x71376;return _0x3d02ff;})['then'](respondWithFilteredResult(_0x6a859e,_0x2f31de))[_0x764e('0x45')](handleError(_0x6a859e,null));};exports['show']=function(_0x4bc1c8,_0x26ce70){var _0x40f2b2={'raw':![],'where':{'id':_0x4bc1c8['params']['id']}},_0x1a72a8={};_0x1a72a8[_0x764e('0x31')]=_[_0x764e('0x2f')](db['Automation'][_0x764e('0x2b')]);_0x1a72a8[_0x764e('0x2e')]=_[_0x764e('0x2f')](_0x4bc1c8[_0x764e('0x2e')]);_0x1a72a8[_0x764e('0x30')]=_[_0x764e('0x33')](_0x1a72a8[_0x764e('0x31')],_0x1a72a8['query']);_0x40f2b2[_0x764e('0x32')]=_[_0x764e('0x33')](_0x1a72a8[_0x764e('0x31')],qs['fields'](_0x4bc1c8[_0x764e('0x2e')][_0x764e('0x34')]));_0x40f2b2[_0x764e('0x32')]=_0x40f2b2['attributes'][_0x764e('0x35')]?_0x40f2b2[_0x764e('0x32')]:_0x1a72a8['model'];if(_0x4bc1c8[_0x764e('0x2e')][_0x764e('0x41')]){_0x40f2b2[_0x764e('0x42')]=[{'all':!![]}];}_0x40f2b2=_[_0x764e('0x3c')]({},_0x40f2b2,_0x4bc1c8[_0x764e('0x40')]);return db[_0x764e('0x2a')][_0x764e('0x46')](_0x40f2b2)[_0x764e('0x26')](handleEntityNotFound(_0x26ce70,null))[_0x764e('0x26')](respondWithResult(_0x26ce70,null))[_0x764e('0x45')](handleError(_0x26ce70,null));};exports[_0x764e('0x47')]=function(_0x5bffc8,_0x2f1a4f){return db['Automation'][_0x764e('0x47')](_0x5bffc8[_0x764e('0x48')],{})[_0x764e('0x26')](respondWithResult(_0x2f1a4f,0xc9))[_0x764e('0x45')](handleError(_0x2f1a4f,null));};exports[_0x764e('0x25')]=function(_0x6b3c94,_0x34b337){if(_0x6b3c94[_0x764e('0x48')]['id']){delete _0x6b3c94[_0x764e('0x48')]['id'];}return db[_0x764e('0x2a')][_0x764e('0x46')]({'where':{'id':_0x6b3c94[_0x764e('0x49')]['id']}})[_0x764e('0x26')](handleEntityNotFound(_0x34b337,null))[_0x764e('0x26')](saveUpdates(_0x6b3c94['body'],null))[_0x764e('0x26')](respondWithResult(_0x34b337,null))[_0x764e('0x45')](handleError(_0x34b337,null));};exports[_0x764e('0x27')]=function(_0x4d49fa,_0x9c500b){return db[_0x764e('0x2a')]['find']({'where':{'id':_0x4d49fa[_0x764e('0x49')]['id']}})['then'](handleEntityNotFound(_0x9c500b,null))[_0x764e('0x26')](removeEntity(_0x9c500b,null))[_0x764e('0x45')](handleError(_0x9c500b,null));};exports['addConditions']=function(_0xccba6c,_0x76ff65,_0x4bf6e1){return db['Condition'][_0x764e('0x46')]({'where':{'id':_0xccba6c[_0x764e('0x49')]['id']}})[_0x764e('0x26')](handleEntityNotFound(_0x76ff65,null))['then'](function(_0x537212){if(_0x537212){return _0x537212[_0x764e('0x4a')](_0xccba6c[_0x764e('0x48')][_0x764e('0x4b')],_['omit'](_0xccba6c[_0x764e('0x48')],[_0x764e('0x4b'),'id'])||{});}})[_0x764e('0x26')](respondWithResult(_0x76ff65,null))[_0x764e('0x45')](handleError(_0x76ff65,null));};exports[_0x764e('0x4c')]=function(_0x285cb6,_0x5a39cc,_0x171cce){var _0x167737={};var _0x3176be={};var _0x2eca99;var _0x316ab5;return db[_0x764e('0x2a')][_0x764e('0x4d')]({'where':{'id':_0x285cb6[_0x764e('0x49')]['id']}})[_0x764e('0x26')](handleEntityNotFound(_0x5a39cc,null))[_0x764e('0x26')](function(_0x2221ff){if(_0x2221ff){_0x2eca99=_0x2221ff;_0x3176be['model']=_[_0x764e('0x2f')](db[_0x764e('0x4e')][_0x764e('0x2b')]);_0x3176be[_0x764e('0x2e')]=_[_0x764e('0x2f')](_0x285cb6['query']);_0x3176be[_0x764e('0x30')]=_[_0x764e('0x33')](_0x3176be[_0x764e('0x31')],_0x3176be[_0x764e('0x2e')]);_0x167737[_0x764e('0x32')]=_[_0x764e('0x33')](_0x3176be[_0x764e('0x31')],qs[_0x764e('0x34')](_0x285cb6['query'][_0x764e('0x34')]));_0x167737[_0x764e('0x32')]=_0x167737[_0x764e('0x32')][_0x764e('0x35')]?_0x167737[_0x764e('0x32')]:_0x3176be[_0x764e('0x31')];_0x167737[_0x764e('0x38')]=qs['sort'](_0x285cb6[_0x764e('0x2e')][_0x764e('0x39')]);_0x167737[_0x764e('0x3d')]=qs['filters'](_['pick'](_0x285cb6[_0x764e('0x2e')],_0x3176be[_0x764e('0x30')]));if(_0x285cb6['query'][_0x764e('0x3b')]){_0x167737[_0x764e('0x3d')]=_[_0x764e('0x3c')](_0x167737[_0x764e('0x3d')],{'$or':_[_0x764e('0x2d')](_0x167737['attributes'],function(_0x1d7063){var _0x16ba40={};_0x16ba40[_0x1d7063]={'$like':'%'+_0x285cb6[_0x764e('0x2e')][_0x764e('0x3b')]+'%'};return _0x16ba40;})});}_0x167737=_[_0x764e('0x3c')]({},_0x167737,_0x285cb6['options']);return _0x2eca99[_0x764e('0x4c')](_0x167737);}})[_0x764e('0x26')](function(_0x484a2c){if(_0x484a2c){_0x316ab5=_0x484a2c[_0x764e('0x35')];if(!_0x285cb6[_0x764e('0x2e')][_0x764e('0x36')](_0x764e('0x37'))){_0x167737[_0x764e('0x21')]=qs[_0x764e('0x21')](_0x285cb6[_0x764e('0x2e')][_0x764e('0x21')]);_0x167737[_0x764e('0x1f')]=qs['offset'](_0x285cb6[_0x764e('0x2e')]['offset']);}return _0x2eca99[_0x764e('0x4c')](_0x167737);}})[_0x764e('0x26')](function(_0x453556){if(_0x453556){return _0x453556?{'count':_0x316ab5,'rows':_0x453556}:null;}})[_0x764e('0x26')](respondWithResult(_0x5a39cc,null))[_0x764e('0x45')](handleError(_0x5a39cc,null));};exports[_0x764e('0x4f')]=function(_0x408cd1,_0x564de0,_0x2709b0){return db[_0x764e('0x50')][_0x764e('0x46')]({'where':{'id':_0x408cd1[_0x764e('0x49')]['id']}})[_0x764e('0x26')](handleEntityNotFound(_0x564de0,null))['then'](function(_0x42372e){if(_0x42372e){return _0x42372e[_0x764e('0x4f')](_0x408cd1[_0x764e('0x48')][_0x764e('0x4b')],_[_0x764e('0x51')](_0x408cd1[_0x764e('0x48')],[_0x764e('0x4b'),'id'])||{});}})[_0x764e('0x26')](respondWithResult(_0x564de0,null))['catch'](handleError(_0x564de0,null));};exports[_0x764e('0x52')]=function(_0x2d0c8b,_0x4e1c58,_0x1c7872){var _0x4a76d5={};var _0x40780c={};var _0x5ef60d;var _0x2d96b3;return db['Automation'][_0x764e('0x4d')]({'where':{'id':_0x2d0c8b[_0x764e('0x49')]['id']}})[_0x764e('0x26')](handleEntityNotFound(_0x4e1c58,null))['then'](function(_0x559a){if(_0x559a){_0x5ef60d=_0x559a;_0x40780c['model']=_[_0x764e('0x2f')](db['Action']['rawAttributes']);_0x40780c[_0x764e('0x2e')]=_['keys'](_0x2d0c8b['query']);_0x40780c[_0x764e('0x30')]=_['intersection'](_0x40780c[_0x764e('0x31')],_0x40780c[_0x764e('0x2e')]);_0x4a76d5['attributes']=_[_0x764e('0x33')](_0x40780c[_0x764e('0x31')],qs[_0x764e('0x34')](_0x2d0c8b[_0x764e('0x2e')][_0x764e('0x34')]));_0x4a76d5['attributes']=_0x4a76d5['attributes']['length']?_0x4a76d5[_0x764e('0x32')]:_0x40780c['model'];_0x4a76d5[_0x764e('0x38')]=qs[_0x764e('0x39')](_0x2d0c8b['query'][_0x764e('0x39')]);_0x4a76d5['where']=qs[_0x764e('0x30')](_[_0x764e('0x3a')](_0x2d0c8b[_0x764e('0x2e')],_0x40780c['filters']));if(_0x2d0c8b['query'][_0x764e('0x3b')]){_0x4a76d5['where']=_[_0x764e('0x3c')](_0x4a76d5[_0x764e('0x3d')],{'$or':_[_0x764e('0x2d')](_0x4a76d5[_0x764e('0x32')],function(_0x2397c1){var _0x396409={};_0x396409[_0x2397c1]={'$like':'%'+_0x2d0c8b[_0x764e('0x2e')][_0x764e('0x3b')]+'%'};return _0x396409;})});}_0x4a76d5=_[_0x764e('0x3c')]({},_0x4a76d5,_0x2d0c8b['options']);return _0x5ef60d[_0x764e('0x52')](_0x4a76d5);}})[_0x764e('0x26')](function(_0x22c363){if(_0x22c363){_0x2d96b3=_0x22c363[_0x764e('0x35')];if(!_0x2d0c8b['query'][_0x764e('0x36')]('nolimit')){_0x4a76d5['limit']=qs[_0x764e('0x21')](_0x2d0c8b[_0x764e('0x2e')]['limit']);_0x4a76d5['offset']=qs[_0x764e('0x1f')](_0x2d0c8b[_0x764e('0x2e')][_0x764e('0x1f')]);}return _0x5ef60d['getActions'](_0x4a76d5);}})[_0x764e('0x26')](function(_0x4549d1){if(_0x4549d1){return _0x4549d1?{'count':_0x2d96b3,'rows':_0x4549d1}:null;}})['then'](respondWithResult(_0x4e1c58,null))[_0x764e('0x45')](handleError(_0x4e1c58,null));};
\ No newline at end of file
+var _0xd1ed=['options','find','create','body','update','params','addConditions','Condition','ids','omit','getConditions','nolimit','addActions','Action','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','Automation','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','include','findAll','catch','show','includeAll'];(function(_0x1dca5d,_0x39a23d){var _0x4305c2=function(_0x51ac57){while(--_0x51ac57){_0x1dca5d['push'](_0x1dca5d['shift']());}};_0x4305c2(++_0x39a23d);}(_0xd1ed,0x1b8));var _0xdd1e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd1ed[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xdd1e('0x0'));var rimraf=require(_0xdd1e('0x1'));var zipdir=require(_0xdd1e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd1e('0x3'));var moment=require(_0xdd1e('0x4'));var BPromise=require(_0xdd1e('0x5'));var Mustache=require(_0xdd1e('0x6'));var util=require(_0xdd1e('0x7'));var path=require(_0xdd1e('0x8'));var sox=require(_0xdd1e('0x9'));var csv=require('to-csv');var ejs=require(_0xdd1e('0xa'));var fs=require('fs');var fs_extra=require(_0xdd1e('0xb'));var _=require(_0xdd1e('0xc'));var squel=require(_0xdd1e('0xd'));var crypto=require(_0xdd1e('0xe'));var jsforce=require(_0xdd1e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdd1e('0x10'));var querystring=require('querystring');var Papa=require(_0xdd1e('0x11'));var Redis=require(_0xdd1e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xdd1e('0x13'));var as=require(_0xdd1e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd1e('0x15'))(_0xdd1e('0x16'));var utils=require(_0xdd1e('0x17'));var config=require(_0xdd1e('0x18'));var licenseUtil=require(_0xdd1e('0x19'));var db=require(_0xdd1e('0x1a'))['db'];function respondWithStatusCode(_0x307932,_0x3b3012){_0x3b3012=_0x3b3012||0xcc;return function(_0x4dca55){if(_0x4dca55){return _0x307932[_0xdd1e('0x1b')](_0x3b3012);}return _0x307932[_0xdd1e('0x1c')](_0x3b3012)[_0xdd1e('0x1d')]();};}function respondWithResult(_0x48d5e1,_0x7a707d){_0x7a707d=_0x7a707d||0xc8;return function(_0x49d81a){if(_0x49d81a){return _0x48d5e1[_0xdd1e('0x1c')](_0x7a707d)[_0xdd1e('0x1e')](_0x49d81a);}};}function respondWithFilteredResult(_0x10c939,_0x16e7b7){return function(_0x247235){if(_0x247235){var _0x3362b7=typeof _0x16e7b7[_0xdd1e('0x1f')]===_0xdd1e('0x20')&&typeof _0x16e7b7[_0xdd1e('0x21')]==='undefined';var _0x32f9db=_0x247235[_0xdd1e('0x22')];var _0x6b2271=_0x3362b7?0x0:_0x16e7b7['offset'];var _0x4f612c=_0x3362b7?_0x247235[_0xdd1e('0x22')]:_0x16e7b7[_0xdd1e('0x1f')]+_0x16e7b7[_0xdd1e('0x21')];var _0x4eacba;if(_0x4f612c>=_0x32f9db){_0x4f612c=_0x32f9db;_0x4eacba=0xc8;}else{_0x4eacba=0xce;}_0x10c939[_0xdd1e('0x1c')](_0x4eacba);return _0x10c939[_0xdd1e('0x23')](_0xdd1e('0x24'),_0x6b2271+'-'+_0x4f612c+'/'+_0x32f9db)[_0xdd1e('0x1e')](_0x247235);}return null;};}function patchUpdates(_0xeca1a0){return function(_0x434d61){try{jsonpatch[_0xdd1e('0x25')](_0x434d61,_0xeca1a0,!![]);}catch(_0x23db2e){return BPromise[_0xdd1e('0x26')](_0x23db2e);}return _0x434d61[_0xdd1e('0x27')]();};}function saveUpdates(_0x43c499,_0x500df1){return function(_0x3b6292){if(_0x3b6292){return _0x3b6292['update'](_0x43c499)['then'](function(_0x34cae9){return _0x34cae9;});}return null;};}function removeEntity(_0xc1ea36,_0x5653f9){return function(_0x1b7bf2){if(_0x1b7bf2){return _0x1b7bf2['destroy']()[_0xdd1e('0x28')](function(){_0xc1ea36[_0xdd1e('0x1c')](0xcc)[_0xdd1e('0x1d')]();});}};}function handleEntityNotFound(_0x2a819b,_0xce9217){return function(_0x193fa4){if(!_0x193fa4){_0x2a819b['sendStatus'](0x194);}return _0x193fa4;};}function handleError(_0x47435e,_0x42ff6e){_0x42ff6e=_0x42ff6e||0x1f4;return function(_0x10c66a){logger[_0xdd1e('0x29')](_0x10c66a[_0xdd1e('0x2a')]);if(_0x10c66a[_0xdd1e('0x2b')]){delete _0x10c66a[_0xdd1e('0x2b')];}_0x47435e[_0xdd1e('0x1c')](_0x42ff6e)[_0xdd1e('0x2c')](_0x10c66a);};}exports['index']=function(_0x301e7b,_0x1aef48){var _0x26969d={},_0x553390={},_0x57aa01={'count':0x0,'rows':[]};var _0x1ef964=_[_0xdd1e('0x2d')](db[_0xdd1e('0x2e')][_0xdd1e('0x2f')],function(_0x47b7a5){return{'name':_0x47b7a5[_0xdd1e('0x30')],'type':_0x47b7a5[_0xdd1e('0x31')]['key']};});_0x553390[_0xdd1e('0x32')]=_[_0xdd1e('0x2d')](_0x1ef964,_0xdd1e('0x2b'));_0x553390[_0xdd1e('0x33')]=_[_0xdd1e('0x34')](_0x301e7b[_0xdd1e('0x33')]);_0x553390['filters']=_[_0xdd1e('0x35')](_0x553390[_0xdd1e('0x32')],_0x553390[_0xdd1e('0x33')]);_0x26969d['attributes']=_['intersection'](_0x553390[_0xdd1e('0x32')],qs[_0xdd1e('0x36')](_0x301e7b[_0xdd1e('0x33')][_0xdd1e('0x36')]));_0x26969d[_0xdd1e('0x37')]=_0x26969d[_0xdd1e('0x37')][_0xdd1e('0x38')]?_0x26969d[_0xdd1e('0x37')]:_0x553390[_0xdd1e('0x32')];if(!_0x301e7b[_0xdd1e('0x33')][_0xdd1e('0x39')]('nolimit')){_0x26969d[_0xdd1e('0x21')]=qs['limit'](_0x301e7b[_0xdd1e('0x33')][_0xdd1e('0x21')]);_0x26969d[_0xdd1e('0x1f')]=qs[_0xdd1e('0x1f')](_0x301e7b[_0xdd1e('0x33')][_0xdd1e('0x1f')]);}_0x26969d[_0xdd1e('0x3a')]=qs[_0xdd1e('0x3b')](_0x301e7b[_0xdd1e('0x33')][_0xdd1e('0x3b')]);_0x26969d[_0xdd1e('0x3c')]=qs[_0xdd1e('0x3d')](_[_0xdd1e('0x3e')](_0x301e7b[_0xdd1e('0x33')],_0x553390[_0xdd1e('0x3d')]),_0x1ef964);if(_0x301e7b[_0xdd1e('0x33')][_0xdd1e('0x3f')]){_0x26969d[_0xdd1e('0x3c')]=_[_0xdd1e('0x40')](_0x26969d[_0xdd1e('0x3c')],{'$or':_[_0xdd1e('0x2d')](_0x1ef964,function(_0x31ad48){if(_0x31ad48[_0xdd1e('0x31')]!=='VIRTUAL'){var _0x1ccdc4={};_0x1ccdc4[_0x31ad48[_0xdd1e('0x2b')]]={'$like':'%'+_0x301e7b[_0xdd1e('0x33')][_0xdd1e('0x3f')]+'%'};return _0x1ccdc4;}})});}_0x26969d=_[_0xdd1e('0x40')]({},_0x26969d,_0x301e7b['options']);var _0x1d72f2={'where':_0x26969d[_0xdd1e('0x3c')]};return db['Automation'][_0xdd1e('0x22')](_0x1d72f2)[_0xdd1e('0x28')](function(_0x5f1e4f){_0x57aa01[_0xdd1e('0x22')]=_0x5f1e4f;if(_0x301e7b[_0xdd1e('0x33')]['includeAll']){_0x26969d[_0xdd1e('0x41')]=[{'all':!![]}];}return db[_0xdd1e('0x2e')][_0xdd1e('0x42')](_0x26969d);})[_0xdd1e('0x28')](function(_0x1bee73){_0x57aa01['rows']=_0x1bee73;return _0x57aa01;})[_0xdd1e('0x28')](respondWithFilteredResult(_0x1aef48,_0x26969d))[_0xdd1e('0x43')](handleError(_0x1aef48,null));};exports[_0xdd1e('0x44')]=function(_0x5a78d6,_0x9084ba){var _0xdad412={'raw':![],'where':{'id':_0x5a78d6['params']['id']}},_0x294b96={};_0x294b96[_0xdd1e('0x32')]=_['keys'](db['Automation'][_0xdd1e('0x2f')]);_0x294b96[_0xdd1e('0x33')]=_[_0xdd1e('0x34')](_0x5a78d6[_0xdd1e('0x33')]);_0x294b96[_0xdd1e('0x3d')]=_[_0xdd1e('0x35')](_0x294b96[_0xdd1e('0x32')],_0x294b96['query']);_0xdad412[_0xdd1e('0x37')]=_[_0xdd1e('0x35')](_0x294b96[_0xdd1e('0x32')],qs[_0xdd1e('0x36')](_0x5a78d6['query'][_0xdd1e('0x36')]));_0xdad412[_0xdd1e('0x37')]=_0xdad412[_0xdd1e('0x37')][_0xdd1e('0x38')]?_0xdad412[_0xdd1e('0x37')]:_0x294b96[_0xdd1e('0x32')];if(_0x5a78d6[_0xdd1e('0x33')][_0xdd1e('0x45')]){_0xdad412['include']=[{'all':!![]}];}_0xdad412=_[_0xdd1e('0x40')]({},_0xdad412,_0x5a78d6[_0xdd1e('0x46')]);return db[_0xdd1e('0x2e')][_0xdd1e('0x47')](_0xdad412)[_0xdd1e('0x28')](handleEntityNotFound(_0x9084ba,null))['then'](respondWithResult(_0x9084ba,null))['catch'](handleError(_0x9084ba,null));};exports[_0xdd1e('0x48')]=function(_0x5caea7,_0x2dd5c3){return db[_0xdd1e('0x2e')][_0xdd1e('0x48')](_0x5caea7[_0xdd1e('0x49')],{})[_0xdd1e('0x28')](respondWithResult(_0x2dd5c3,0xc9))['catch'](handleError(_0x2dd5c3,null));};exports[_0xdd1e('0x4a')]=function(_0x15b69f,_0x39fac0){if(_0x15b69f[_0xdd1e('0x49')]['id']){delete _0x15b69f[_0xdd1e('0x49')]['id'];}return db[_0xdd1e('0x2e')][_0xdd1e('0x47')]({'where':{'id':_0x15b69f[_0xdd1e('0x4b')]['id']}})[_0xdd1e('0x28')](handleEntityNotFound(_0x39fac0,null))[_0xdd1e('0x28')](saveUpdates(_0x15b69f[_0xdd1e('0x49')],null))['then'](respondWithResult(_0x39fac0,null))['catch'](handleError(_0x39fac0,null));};exports['destroy']=function(_0x2a562f,_0x446dad){return db[_0xdd1e('0x2e')][_0xdd1e('0x47')]({'where':{'id':_0x2a562f[_0xdd1e('0x4b')]['id']}})[_0xdd1e('0x28')](handleEntityNotFound(_0x446dad,null))[_0xdd1e('0x28')](removeEntity(_0x446dad,null))[_0xdd1e('0x43')](handleError(_0x446dad,null));};exports[_0xdd1e('0x4c')]=function(_0x3e1d8a,_0x499b81,_0x295285){return db[_0xdd1e('0x4d')][_0xdd1e('0x47')]({'where':{'id':_0x3e1d8a[_0xdd1e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x499b81,null))[_0xdd1e('0x28')](function(_0x3d4291){if(_0x3d4291){return _0x3d4291['addConditions'](_0x3e1d8a[_0xdd1e('0x49')][_0xdd1e('0x4e')],_[_0xdd1e('0x4f')](_0x3e1d8a[_0xdd1e('0x49')],['ids','id'])||{});}})[_0xdd1e('0x28')](respondWithResult(_0x499b81,null))[_0xdd1e('0x43')](handleError(_0x499b81,null));};exports[_0xdd1e('0x50')]=function(_0x2a1d43,_0x4621e3,_0x26ab65){var _0x3c142c={};var _0x1f2713={};var _0x2ac5dd;var _0x1c1950;return db[_0xdd1e('0x2e')]['findOne']({'where':{'id':_0x2a1d43[_0xdd1e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4621e3,null))[_0xdd1e('0x28')](function(_0x1a21bc){if(_0x1a21bc){_0x2ac5dd=_0x1a21bc;_0x1f2713[_0xdd1e('0x32')]=_[_0xdd1e('0x34')](db['Condition'][_0xdd1e('0x2f')]);_0x1f2713[_0xdd1e('0x33')]=_[_0xdd1e('0x34')](_0x2a1d43[_0xdd1e('0x33')]);_0x1f2713['filters']=_['intersection'](_0x1f2713[_0xdd1e('0x32')],_0x1f2713[_0xdd1e('0x33')]);_0x3c142c[_0xdd1e('0x37')]=_[_0xdd1e('0x35')](_0x1f2713[_0xdd1e('0x32')],qs[_0xdd1e('0x36')](_0x2a1d43[_0xdd1e('0x33')][_0xdd1e('0x36')]));_0x3c142c[_0xdd1e('0x37')]=_0x3c142c[_0xdd1e('0x37')]['length']?_0x3c142c['attributes']:_0x1f2713['model'];_0x3c142c[_0xdd1e('0x3a')]=qs['sort'](_0x2a1d43[_0xdd1e('0x33')]['sort']);_0x3c142c['where']=qs['filters'](_[_0xdd1e('0x3e')](_0x2a1d43[_0xdd1e('0x33')],_0x1f2713[_0xdd1e('0x3d')]));if(_0x2a1d43['query']['filter']){_0x3c142c[_0xdd1e('0x3c')]=_[_0xdd1e('0x40')](_0x3c142c[_0xdd1e('0x3c')],{'$or':_[_0xdd1e('0x2d')](_0x3c142c['attributes'],function(_0x1313e0){var _0x13115d={};_0x13115d[_0x1313e0]={'$like':'%'+_0x2a1d43[_0xdd1e('0x33')][_0xdd1e('0x3f')]+'%'};return _0x13115d;})});}_0x3c142c=_[_0xdd1e('0x40')]({},_0x3c142c,_0x2a1d43[_0xdd1e('0x46')]);return _0x2ac5dd[_0xdd1e('0x50')](_0x3c142c);}})[_0xdd1e('0x28')](function(_0x5b4d14){if(_0x5b4d14){_0x1c1950=_0x5b4d14[_0xdd1e('0x38')];if(!_0x2a1d43[_0xdd1e('0x33')][_0xdd1e('0x39')](_0xdd1e('0x51'))){_0x3c142c[_0xdd1e('0x21')]=qs[_0xdd1e('0x21')](_0x2a1d43['query'][_0xdd1e('0x21')]);_0x3c142c[_0xdd1e('0x1f')]=qs[_0xdd1e('0x1f')](_0x2a1d43[_0xdd1e('0x33')][_0xdd1e('0x1f')]);}return _0x2ac5dd['getConditions'](_0x3c142c);}})[_0xdd1e('0x28')](function(_0x2f52ad){if(_0x2f52ad){return _0x2f52ad?{'count':_0x1c1950,'rows':_0x2f52ad}:null;}})[_0xdd1e('0x28')](respondWithResult(_0x4621e3,null))[_0xdd1e('0x43')](handleError(_0x4621e3,null));};exports[_0xdd1e('0x52')]=function(_0x579cf4,_0x2a8427,_0x3971ef){return db[_0xdd1e('0x53')][_0xdd1e('0x47')]({'where':{'id':_0x579cf4[_0xdd1e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2a8427,null))[_0xdd1e('0x28')](function(_0x32f806){if(_0x32f806){return _0x32f806[_0xdd1e('0x52')](_0x579cf4[_0xdd1e('0x49')][_0xdd1e('0x4e')],_[_0xdd1e('0x4f')](_0x579cf4['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x2a8427,null))[_0xdd1e('0x43')](handleError(_0x2a8427,null));};exports['getActions']=function(_0x38249f,_0x14c6a3,_0x299b2a){var _0x29714a={};var _0x5fdfcd={};var _0x1e96aa;var _0x2a3827;return db[_0xdd1e('0x2e')][_0xdd1e('0x54')]({'where':{'id':_0x38249f['params']['id']}})[_0xdd1e('0x28')](handleEntityNotFound(_0x14c6a3,null))[_0xdd1e('0x28')](function(_0x1c1793){if(_0x1c1793){_0x1e96aa=_0x1c1793;_0x5fdfcd['model']=_[_0xdd1e('0x34')](db[_0xdd1e('0x53')][_0xdd1e('0x2f')]);_0x5fdfcd[_0xdd1e('0x33')]=_[_0xdd1e('0x34')](_0x38249f['query']);_0x5fdfcd[_0xdd1e('0x3d')]=_[_0xdd1e('0x35')](_0x5fdfcd[_0xdd1e('0x32')],_0x5fdfcd['query']);_0x29714a[_0xdd1e('0x37')]=_['intersection'](_0x5fdfcd[_0xdd1e('0x32')],qs[_0xdd1e('0x36')](_0x38249f['query'][_0xdd1e('0x36')]));_0x29714a[_0xdd1e('0x37')]=_0x29714a[_0xdd1e('0x37')][_0xdd1e('0x38')]?_0x29714a[_0xdd1e('0x37')]:_0x5fdfcd['model'];_0x29714a[_0xdd1e('0x3a')]=qs['sort'](_0x38249f[_0xdd1e('0x33')][_0xdd1e('0x3b')]);_0x29714a['where']=qs['filters'](_['pick'](_0x38249f[_0xdd1e('0x33')],_0x5fdfcd['filters']));if(_0x38249f[_0xdd1e('0x33')][_0xdd1e('0x3f')]){_0x29714a[_0xdd1e('0x3c')]=_[_0xdd1e('0x40')](_0x29714a[_0xdd1e('0x3c')],{'$or':_[_0xdd1e('0x2d')](_0x29714a['attributes'],function(_0x2b72b0){var _0x3b4f1f={};_0x3b4f1f[_0x2b72b0]={'$like':'%'+_0x38249f[_0xdd1e('0x33')][_0xdd1e('0x3f')]+'%'};return _0x3b4f1f;})});}_0x29714a=_[_0xdd1e('0x40')]({},_0x29714a,_0x38249f[_0xdd1e('0x46')]);return _0x1e96aa['getActions'](_0x29714a);}})[_0xdd1e('0x28')](function(_0x7fa8da){if(_0x7fa8da){_0x2a3827=_0x7fa8da[_0xdd1e('0x38')];if(!_0x38249f['query']['hasOwnProperty'](_0xdd1e('0x51'))){_0x29714a['limit']=qs['limit'](_0x38249f[_0xdd1e('0x33')][_0xdd1e('0x21')]);_0x29714a[_0xdd1e('0x1f')]=qs[_0xdd1e('0x1f')](_0x38249f['query'][_0xdd1e('0x1f')]);}return _0x1e96aa['getActions'](_0x29714a);}})[_0xdd1e('0x28')](function(_0x1355e4){if(_0x1355e4){return _0x1355e4?{'count':_0x2a3827,'rows':_0x1355e4}:null;}})[_0xdd1e('0x28')](respondWithResult(_0x14c6a3,null))[_0xdd1e('0x43')](handleError(_0x14c6a3,null));};
\ No newline at end of file
index b05a03b..f386826 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d03=['bluebird','path','rimraf','./automation.attributes','exports','Automation','lodash','util','../../config/logger'];(function(_0x1e393b,_0x355f6b){var _0x3d0bfe=function(_0x320830){while(--_0x320830){_0x1e393b['push'](_0x1e393b['shift']());}};_0x3d0bfe(++_0x355f6b);}(_0x7d03,0x96));var _0x37d0=function(_0xeb2eb6,_0x32b165){_0xeb2eb6=_0xeb2eb6-0x0;var _0x2366e3=_0x7d03[_0xeb2eb6];return _0x2366e3;};'use strict';var _=require(_0x37d0('0x0'));var util=require(_0x37d0('0x1'));var logger=require(_0x37d0('0x2'))('api');var moment=require('moment');var BPromise=require(_0x37d0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37d0('0x4'));var rimraf=require(_0x37d0('0x5'));var config=require('../../config/environment');var attributes=require(_0x37d0('0x6'));module[_0x37d0('0x7')]=function(_0x26f4f2,_0x28c98e){return _0x26f4f2['define'](_0x37d0('0x8'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7cf9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','define','Automation','tools_automations','../../config/logger'];(function(_0x312add,_0x3c4d3c){var _0x22411a=function(_0x46cc4){while(--_0x46cc4){_0x312add['push'](_0x312add['shift']());}};_0x22411a(++_0x3c4d3c);}(_0x7cf9,0xcb));var _0x97cf=function(_0x37cb10,_0x10f517){_0x37cb10=_0x37cb10-0x0;var _0x4d1a30=_0x7cf9[_0x37cb10];return _0x4d1a30;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x97cf('0x0'))(_0x97cf('0x1'));var moment=require(_0x97cf('0x2'));var BPromise=require(_0x97cf('0x3'));var rp=require(_0x97cf('0x4'));var fs=require('fs');var path=require(_0x97cf('0x5'));var rimraf=require(_0x97cf('0x6'));var config=require(_0x97cf('0x7'));var attributes=require(_0x97cf('0x8'));module['exports']=function(_0x16feb2,_0x47dcfc){return _0x16feb2[_0x97cf('0x9')](_0x97cf('0xa'),attributes,{'tableName':_0x97cf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c4878de..304dd92 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa35e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x3f059e,_0x72002e){var _0x23a386=function(_0x3077fb){while(--_0x3077fb){_0x3f059e['push'](_0x3f059e['shift']());}};_0x23a386(++_0x72002e);}(_0xa35e,0x111));var _0xea35=function(_0x1e9dad,_0xeb9d55){_0x1e9dad=_0x1e9dad-0x0;var _0x5360ce=_0xa35e[_0x1e9dad];return _0x5360ce;};'use strict';var _=require(_0xea35('0x0'));var util=require('util');var moment=require(_0xea35('0x1'));var BPromise=require(_0xea35('0x2'));var rs=require(_0xea35('0x3'));var fs=require('fs');var Redis=require(_0xea35('0x4'));var db=require(_0xea35('0x5'))['db'];var utils=require(_0xea35('0x6'));var logger=require(_0xea35('0x7'))(_0xea35('0x8'));var config=require(_0xea35('0x9'));var jayson=require(_0xea35('0xa'));var client=jayson[_0xea35('0xb')][_0xea35('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x35d34b,_0x461e25,_0x47d904){return new BPromise(function(_0x1d1c89,_0x1fee2a){return client[_0xea35('0xd')](_0x35d34b,_0x47d904)['then'](function(_0x3a3fb8){logger[_0xea35('0xe')](_0xea35('0xf'),_0x461e25,'request\x20sent');logger[_0xea35('0x10')](_0xea35('0x11'),_0x461e25,_0xea35('0x12'),JSON[_0xea35('0x13')](_0x3a3fb8));if(_0x3a3fb8[_0xea35('0x14')]){if(_0x3a3fb8['error'][_0xea35('0x15')]===0x1f4){logger[_0xea35('0x14')](_0xea35('0xf'),_0x461e25,_0x3a3fb8['error']['message']);return _0x1fee2a(_0x3a3fb8[_0xea35('0x14')][_0xea35('0x16')]);}logger[_0xea35('0x14')](_0xea35('0xf'),_0x461e25,_0x3a3fb8['error'][_0xea35('0x16')]);return _0x1d1c89(_0x3a3fb8['error'][_0xea35('0x16')]);}else{logger[_0xea35('0xe')]('Automation,\x20%s,\x20%s',_0x461e25,_0xea35('0x12'));_0x1d1c89(_0x3a3fb8[_0xea35('0x17')][_0xea35('0x16')]);}})[_0xea35('0x18')](function(_0x23b2fc){logger[_0xea35('0x14')](_0xea35('0xf'),_0x461e25,_0x23b2fc);_0x1fee2a(_0x23b2fc);});});}
\ No newline at end of file
+var _0x19e1=['moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x188fa8,_0x33f9d2){var _0x2be7b0=function(_0x1a913d){while(--_0x1a913d){_0x188fa8['push'](_0x188fa8['shift']());}};_0x2be7b0(++_0x33f9d2);}(_0x19e1,0x163));var _0x119e=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0x19e1[_0x5ecadc];return _0x565037;};'use strict';var _=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var moment=require(_0x119e('0x2'));var BPromise=require(_0x119e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x119e('0x4'))['db'];var utils=require(_0x119e('0x5'));var logger=require('../../config/logger')(_0x119e('0x6'));var config=require(_0x119e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x119e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5306,_0x25e166,_0x16a2ee){return new BPromise(function(_0x1b3797,_0x53d5b7){return client[_0x119e('0x9')](_0x1b5306,_0x16a2ee)[_0x119e('0xa')](function(_0x1a6747){logger['info']('Automation,\x20%s,\x20%s',_0x25e166,_0x119e('0xb'));logger[_0x119e('0xc')](_0x119e('0xd'),_0x25e166,_0x119e('0xb'),JSON[_0x119e('0xe')](_0x1a6747));if(_0x1a6747[_0x119e('0xf')]){if(_0x1a6747[_0x119e('0xf')]['code']===0x1f4){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x53d5b7(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}logger['error'](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x1b3797(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}else{logger[_0x119e('0x12')](_0x119e('0x10'),_0x25e166,_0x119e('0xb'));_0x1b3797(_0x1a6747[_0x119e('0x13')][_0x119e('0x11')]);}})[_0x119e('0x14')](function(_0x54c326){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x54c326);_0x53d5b7(_0x54c326);});});}
\ No newline at end of file
index 219e465..6ab21f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4ddd=['isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','getActions','create','addConditions','post','addActions','update','delete','destroy','exports','multer','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x556a99,_0x3d0574){var _0x45a65a=function(_0x12f83b){while(--_0x12f83b){_0x556a99['push'](_0x556a99['shift']());}};_0x45a65a(++_0x3d0574);}(_0x4ddd,0x18b));var _0xd4dd=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x4ddd[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0xd4dd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd4dd('0x1'));var interaction=require(_0xd4dd('0x2'));var config=require(_0xd4dd('0x3'));var controller=require('./automation.controller');router[_0xd4dd('0x4')]('/',auth[_0xd4dd('0x5')](),controller[_0xd4dd('0x6')]);router[_0xd4dd('0x4')](_0xd4dd('0x7'),auth[_0xd4dd('0x5')](),controller[_0xd4dd('0x8')]);router['get'](_0xd4dd('0x9'),auth[_0xd4dd('0x5')](),controller['getConditions']);router[_0xd4dd('0x4')](_0xd4dd('0xa'),auth[_0xd4dd('0x5')](),controller[_0xd4dd('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd4dd('0xc')]);router['post'](_0xd4dd('0x9'),auth[_0xd4dd('0x5')](),controller[_0xd4dd('0xd')]);router[_0xd4dd('0xe')](_0xd4dd('0xa'),auth[_0xd4dd('0x5')](),controller[_0xd4dd('0xf')]);router['put'](_0xd4dd('0x7'),auth[_0xd4dd('0x5')](),controller[_0xd4dd('0x10')]);router[_0xd4dd('0x11')]('/:id',auth[_0xd4dd('0x5')](),controller[_0xd4dd('0x12')]);module[_0xd4dd('0x13')]=router;
\ No newline at end of file
+var _0xf442=['put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions'];(function(_0x1b640f,_0x215390){var _0x560770=function(_0x5335ba){while(--_0x5335ba){_0x1b640f['push'](_0x1b640f['shift']());}};_0x560770(++_0x215390);}(_0xf442,0xbc));var _0x2f44=function(_0x525fe4,_0x118713){_0x525fe4=_0x525fe4-0x0;var _0x14d459=_0xf442[_0x525fe4];return _0x14d459;};'use strict';var multer=require(_0x2f44('0x0'));var util=require(_0x2f44('0x1'));var path=require(_0x2f44('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f44('0x3'));var router=express[_0x2f44('0x4')]();var fs_extra=require(_0x2f44('0x5'));var auth=require(_0x2f44('0x6'));var interaction=require(_0x2f44('0x7'));var config=require(_0x2f44('0x8'));var controller=require(_0x2f44('0x9'));router[_0x2f44('0xa')]('/',auth[_0x2f44('0xb')](),controller['index']);router[_0x2f44('0xa')]('/:id',auth[_0x2f44('0xb')](),controller[_0x2f44('0xc')]);router[_0x2f44('0xa')](_0x2f44('0xd'),auth[_0x2f44('0xb')](),controller[_0x2f44('0xe')]);router[_0x2f44('0xa')](_0x2f44('0xf'),auth[_0x2f44('0xb')](),controller[_0x2f44('0x10')]);router['post']('/',auth[_0x2f44('0xb')](),controller['create']);router[_0x2f44('0x11')]('/:id/conditions',auth[_0x2f44('0xb')](),controller[_0x2f44('0x12')]);router[_0x2f44('0x11')]('/:id/actions',auth[_0x2f44('0xb')](),controller[_0x2f44('0x13')]);router[_0x2f44('0x14')](_0x2f44('0x15'),auth[_0x2f44('0xb')](),controller[_0x2f44('0x16')]);router[_0x2f44('0x17')](_0x2f44('0x15'),auth[_0x2f44('0xb')](),controller[_0x2f44('0x18')]);module[_0x2f44('0x19')]=router;
\ No newline at end of file
index 57b0052..6744077 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x94b8=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','STRING','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x94b8,0x111));var _0x894b=function(_0x851f99,_0x5ced4d){_0x851f99=_0x851f99-0x0;var _0x57f0ce=_0x94b8[_0x851f99];return _0x57f0ce;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x894b('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x894b('0x1')](_0x894b('0x2')),'allowNull':![],'defaultValue':_0x894b('0x2')},'description':{'type':Sequelize[_0x894b('0x0')]},'active':{'type':Sequelize[_0x894b('0x3')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x894b('0x4')](0x4)[_0x894b('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x894b('0x4')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x894b('0x6')},'dialCongestionMaxRetry':{'type':Sequelize[_0x894b('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x894b('0x7')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x894b('0x4')](0x5)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x894b('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0x894b('0x4')](0x3)[_0x894b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x894b('0x4')](0x5)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x894b('0x4')](0x3)[_0x894b('0x5')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x894b('0x4')](0x5)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x894b('0x9')},'dialTimezone':{'type':Sequelize[_0x894b('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x894b('0x0')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x894b('0xa'),_0x894b('0xb'),_0x894b('0xc')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x894b('0x3')],'defaultValue':0x0,'comment':_0x894b('0xd')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x894b('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x894b('0xe')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x894b('0x4')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x894b('0xf')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x894b('0x4')](0x9)[_0x894b('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x894b('0x10')},'dialAMDMinWordLength':{'type':Sequelize[_0x894b('0x4')](0x9)[_0x894b('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x894b('0x4')](0x9)[_0x894b('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x894b('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x894b('0x11')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x894b('0x4')](0x5)[_0x894b('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x894b('0x12')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x894b('0x4')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x894b('0x13')},'dialOrderByScheduledAt':{'type':Sequelize[_0x894b('0x1')](_0x894b('0x14'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x894b('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x894b('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x894b('0x15')},'dialCutDigit':{'type':Sequelize[_0x894b('0x4')](0x3)[_0x894b('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x894b('0x16')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x894b('0x4')](0x3)[_0x894b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x894b('0x17')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x894b('0x4')](0x5)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x894b('0x18')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x894b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x894b('0x19')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x894b('0x1a')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x894b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x894b('0x1b')},'dialMachineMaxRetry':{'type':Sequelize[_0x894b('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x894b('0x4')](0x5)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x894b('0x1c')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x894b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x894b('0x1d')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}};
\ No newline at end of file
+var _0x25e0=['Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC'];(function(_0x109fe8,_0x56f3fc){var _0x18d075=function(_0x3df5d1){while(--_0x3df5d1){_0x109fe8['push'](_0x109fe8['shift']());}};_0x18d075(++_0x56f3fc);}(_0x25e0,0x19f));var _0x025e=function(_0x4cd9c6,_0x766862){_0x4cd9c6=_0x4cd9c6-0x0;var _0x53a566=_0x25e0[_0x4cd9c6];return _0x53a566;};'use strict';var Sequelize=require('sequelize');module[_0x025e('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x025e('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x025e('0x2')](_0x025e('0x3')),'allowNull':![],'defaultValue':_0x025e('0x3')},'description':{'type':Sequelize[_0x025e('0x4')]},'active':{'type':Sequelize[_0x025e('0x5')],'defaultValue':0x0,'comment':_0x025e('0x6')},'limitCalls':{'type':Sequelize[_0x025e('0x7')](0x4)[_0x025e('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x025e('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x025e('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x025e('0x7')](0x3)[_0x025e('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x025e('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x025e('0x7')](0x3)[_0x025e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x025e('0x7')](0x5)[_0x025e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x025e('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x025e('0x7')](0x3)[_0x025e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x025e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x025e('0x7')](0x3)[_0x025e('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x025e('0x7')](0x5)[_0x025e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x025e('0xc')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x025e('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x025e('0x2')](_0x025e('0xd'),_0x025e('0xe'),_0x025e('0xf')),'defaultValue':_0x025e('0xd')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x025e('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0x025e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x025e('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x025e('0x7')](0x9)[_0x025e('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x025e('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x025e('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x025e('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x025e('0x7')](0x9)[_0x025e('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x025e('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x025e('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x025e('0x7')](0x9)[_0x025e('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x025e('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x025e('0x7')](0x9)[_0x025e('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x025e('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x025e('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x025e('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x025e('0x7')](0x9)[_0x025e('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x025e('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x025e('0x2')]('DESC',_0x025e('0x19')),'defaultValue':_0x025e('0x1a')},'dialPrefix':{'type':Sequelize[_0x025e('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x025e('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x025e('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x025e('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x025e('0x7')](0x3)[_0x025e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x025e('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x025e('0x7')](0x5)[_0x025e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x025e('0x7')](0x3)[_0x025e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x025e('0x7')](0x5)[_0x025e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x025e('0x7')](0x3)[_0x025e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x025e('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x025e('0x7')](0x5)[_0x025e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x025e('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x025e('0x7')](0x5)[_0x025e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x025e('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x025e('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x025e('0x7')](0x5)[_0x025e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x025e('0x21')}};
\ No newline at end of file
index abb2420..eb531d7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa7b5=['role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','omit','updatedAt','body','getHoppers','findOne','nolimit','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','cm_hopper','scheduledAt','ListId','createdAt','select','field','phone','NOW()','toString','from','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','fromQuery','ContactId','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','h.id','ci.item','ci.OrderBY','OrderBy','join','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','YYYY-MM-DD\x20HH:mm:ss','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','undefined','Content-Range','apply','save','update','destroy','then','get','UserProfileResource','end','error','stack','name','send','Campaign','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','merge','find','create','user'];(function(_0x197697,_0x128210){var _0x500efa=function(_0x5ae6f0){while(--_0x5ae6f0){_0x197697['push'](_0x197697['shift']());}};_0x500efa(++_0x128210);}(_0xa7b5,0x162));var _0x5a7b=function(_0x5bf9bf,_0x1a6947){_0x5bf9bf=_0x5bf9bf-0x0;var _0x1a0276=_0xa7b5[_0x5bf9bf];return _0x1a0276;};'use strict';var emlformat=require(_0x5a7b('0x0'));var rimraf=require(_0x5a7b('0x1'));var zipdir=require(_0x5a7b('0x2'));var jsonpatch=require(_0x5a7b('0x3'));var rp=require(_0x5a7b('0x4'));var moment=require('moment');var BPromise=require(_0x5a7b('0x5'));var Mustache=require(_0x5a7b('0x6'));var util=require(_0x5a7b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5a7b('0x8'));var ejs=require(_0x5a7b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a7b('0xa'));var squel=require(_0x5a7b('0xb'));var crypto=require(_0x5a7b('0xc'));var jsforce=require(_0x5a7b('0xd'));var deskjs=require(_0x5a7b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5a7b('0xf'));var Papa=require('papaparse');var Redis=require(_0x5a7b('0x10'));var authService=require(_0x5a7b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5a7b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a7b('0x13'))(_0x5a7b('0x14'));var utils=require(_0x5a7b('0x15'));var config=require(_0x5a7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25974f,_0x5afe9e){_0x5afe9e=_0x5afe9e||0xcc;return function(_0x5f263c){if(_0x5f263c){return _0x25974f[_0x5a7b('0x17')](_0x5afe9e);}return _0x25974f[_0x5a7b('0x18')](_0x5afe9e)['end']();};}function respondWithResult(_0xda652d,_0x3289d6){_0x3289d6=_0x3289d6||0xc8;return function(_0x359e6a){if(_0x359e6a){return _0xda652d['status'](_0x3289d6)[_0x5a7b('0x19')](_0x359e6a);}};}function respondWithFilteredResult(_0x420f5e,_0x55ed20){return function(_0x31fb21){if(_0x31fb21){var _0x4ce3d8=typeof _0x55ed20[_0x5a7b('0x1a')]==='undefined'&&typeof _0x55ed20[_0x5a7b('0x1b')]===_0x5a7b('0x1c');var _0x237b91=_0x31fb21['count'];var _0xe59f65=_0x4ce3d8?0x0:_0x55ed20[_0x5a7b('0x1a')];var _0x466758=_0x4ce3d8?_0x31fb21['count']:_0x55ed20['offset']+_0x55ed20[_0x5a7b('0x1b')];var _0x5c711c;if(_0x466758>=_0x237b91){_0x466758=_0x237b91;_0x5c711c=0xc8;}else{_0x5c711c=0xce;}_0x420f5e[_0x5a7b('0x18')](_0x5c711c);return _0x420f5e['set'](_0x5a7b('0x1d'),_0xe59f65+'-'+_0x466758+'/'+_0x237b91)[_0x5a7b('0x19')](_0x31fb21);}return null;};}function patchUpdates(_0x2ea965){return function(_0x4b5788){try{jsonpatch[_0x5a7b('0x1e')](_0x4b5788,_0x2ea965,!![]);}catch(_0x458511){return BPromise['reject'](_0x458511);}return _0x4b5788[_0x5a7b('0x1f')]();};}function saveUpdates(_0x1ae7f1,_0x57ebf9){return function(_0x3298ed){if(_0x3298ed){return _0x3298ed[_0x5a7b('0x20')](_0x1ae7f1)['then'](function(_0x59fa7f){return _0x59fa7f;});}return null;};}function removeEntity(_0xe27156,_0x32cc44){return function(_0x54d4f8){if(_0x54d4f8){return _0x54d4f8[_0x5a7b('0x21')]()[_0x5a7b('0x22')](function(){var _0x16b89=_0x54d4f8[_0x5a7b('0x23')]({'plain':!![]});var _0x4f204d='IvrCampaigns';return db[_0x5a7b('0x24')][_0x5a7b('0x21')]({'where':{'type':_0x4f204d,'resourceId':_0x16b89['id']}})[_0x5a7b('0x22')](function(){return _0x54d4f8;});})[_0x5a7b('0x22')](function(){_0xe27156[_0x5a7b('0x18')](0xcc)[_0x5a7b('0x25')]();});}};}function handleEntityNotFound(_0x4fce3f,_0x63d8eb){return function(_0x3531cf){if(!_0x3531cf){_0x4fce3f[_0x5a7b('0x17')](0x194);}return _0x3531cf;};}function handleError(_0x10f937,_0x4d9fd7){_0x4d9fd7=_0x4d9fd7||0x1f4;return function(_0xb0ce2b){logger[_0x5a7b('0x26')](_0xb0ce2b[_0x5a7b('0x27')]);if(_0xb0ce2b[_0x5a7b('0x28')]){delete _0xb0ce2b[_0x5a7b('0x28')];}_0x10f937['status'](_0x4d9fd7)[_0x5a7b('0x29')](_0xb0ce2b);};}exports['index']=function(_0x4bdf52,_0x517499){var _0x5adf16={},_0x1f1622={},_0x42f901={'count':0x0,'rows':[]};var _0x564afa=_['map'](db[_0x5a7b('0x2a')]['rawAttributes'],function(_0x32aac5){return{'name':_0x32aac5[_0x5a7b('0x2b')],'type':_0x32aac5[_0x5a7b('0x2c')][_0x5a7b('0x2d')]};});_0x1f1622[_0x5a7b('0x2e')]=_[_0x5a7b('0x2f')](_0x564afa,_0x5a7b('0x28'));_0x1f1622[_0x5a7b('0x30')]=_['keys'](_0x4bdf52[_0x5a7b('0x30')]);_0x1f1622['filters']=_[_0x5a7b('0x31')](_0x1f1622['model'],_0x1f1622[_0x5a7b('0x30')]);_0x5adf16['attributes']=_[_0x5a7b('0x31')](_0x1f1622[_0x5a7b('0x2e')],qs[_0x5a7b('0x32')](_0x4bdf52[_0x5a7b('0x30')][_0x5a7b('0x32')]));_0x5adf16[_0x5a7b('0x33')]=_0x5adf16['attributes'][_0x5a7b('0x34')]?_0x5adf16[_0x5a7b('0x33')]:_0x1f1622[_0x5a7b('0x2e')];if(!_0x4bdf52['query'][_0x5a7b('0x35')]('nolimit')){_0x5adf16[_0x5a7b('0x1b')]=qs[_0x5a7b('0x1b')](_0x4bdf52[_0x5a7b('0x30')][_0x5a7b('0x1b')]);_0x5adf16[_0x5a7b('0x1a')]=qs[_0x5a7b('0x1a')](_0x4bdf52[_0x5a7b('0x30')][_0x5a7b('0x1a')]);}_0x5adf16[_0x5a7b('0x36')]=qs[_0x5a7b('0x37')](_0x4bdf52['query'][_0x5a7b('0x37')]);_0x5adf16[_0x5a7b('0x38')]=qs[_0x5a7b('0x39')](_[_0x5a7b('0x3a')](_0x4bdf52['query'],_0x1f1622[_0x5a7b('0x39')]),_0x564afa);if(_0x4bdf52['query'][_0x5a7b('0x3b')]){_0x5adf16[_0x5a7b('0x38')]=_['merge'](_0x5adf16['where'],{'$or':_[_0x5a7b('0x2f')](_0x564afa,function(_0x550b84){if(_0x550b84[_0x5a7b('0x2c')]!==_0x5a7b('0x3c')){var _0x3ecf62={};_0x3ecf62[_0x550b84[_0x5a7b('0x28')]]={'$like':'%'+_0x4bdf52[_0x5a7b('0x30')]['filter']+'%'};return _0x3ecf62;}})});}_0x5adf16=_['merge']({},_0x5adf16,_0x4bdf52[_0x5a7b('0x3d')]);var _0x3ecff8={'where':_0x5adf16[_0x5a7b('0x38')]};return db[_0x5a7b('0x2a')][_0x5a7b('0x3e')](_0x3ecff8)['then'](function(_0x2e8596){_0x42f901['count']=_0x2e8596;if(_0x4bdf52['query'][_0x5a7b('0x3f')]){_0x5adf16[_0x5a7b('0x40')]=[{'all':!![]}];}return db[_0x5a7b('0x2a')][_0x5a7b('0x41')](_0x5adf16);})['then'](function(_0x41e3a5){_0x42f901[_0x5a7b('0x42')]=_0x41e3a5;return _0x42f901;})[_0x5a7b('0x22')](respondWithFilteredResult(_0x517499,_0x5adf16))[_0x5a7b('0x43')](handleError(_0x517499,null));};exports['show']=function(_0x5b46c3,_0x3eb069){var _0xbc6641={'raw':![],'where':{'id':_0x5b46c3[_0x5a7b('0x44')]['id']}},_0x5cee3b={};_0x5cee3b[_0x5a7b('0x2e')]=_['keys'](db[_0x5a7b('0x2a')][_0x5a7b('0x45')]);_0x5cee3b['query']=_[_0x5a7b('0x46')](_0x5b46c3['query']);_0x5cee3b[_0x5a7b('0x39')]=_[_0x5a7b('0x31')](_0x5cee3b[_0x5a7b('0x2e')],_0x5cee3b['query']);_0xbc6641['attributes']=_['intersection'](_0x5cee3b['model'],qs['fields'](_0x5b46c3['query'][_0x5a7b('0x32')]));_0xbc6641[_0x5a7b('0x33')]=_0xbc6641[_0x5a7b('0x33')][_0x5a7b('0x34')]?_0xbc6641[_0x5a7b('0x33')]:_0x5cee3b['model'];if(_0x5b46c3[_0x5a7b('0x30')][_0x5a7b('0x3f')]){_0xbc6641[_0x5a7b('0x40')]=[{'all':!![]}];}_0xbc6641=_[_0x5a7b('0x47')]({},_0xbc6641,_0x5b46c3[_0x5a7b('0x3d')]);return db[_0x5a7b('0x2a')][_0x5a7b('0x48')](_0xbc6641)['then'](handleEntityNotFound(_0x3eb069,null))[_0x5a7b('0x22')](respondWithResult(_0x3eb069,null))[_0x5a7b('0x43')](handleError(_0x3eb069,null));};exports[_0x5a7b('0x49')]=function(_0x53b017,_0x29b0b4){return db[_0x5a7b('0x2a')]['create'](_0x53b017['body'],{})['then'](function(_0x3bf79b){var _0x41231d=_0x53b017[_0x5a7b('0x4a')]['get']({'plain':!![]});if(!_0x41231d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41231d[_0x5a7b('0x4b')]==='user'){var _0x246982=_0x3bf79b[_0x5a7b('0x23')]({'plain':!![]});var _0x375155=_0x5a7b('0x4c');return db[_0x5a7b('0x4d')][_0x5a7b('0x48')]({'where':{'name':_0x375155,'userProfileId':_0x41231d[_0x5a7b('0x4e')]},'raw':!![]})[_0x5a7b('0x22')](function(_0x5534db){if(_0x5534db&&_0x5534db[_0x5a7b('0x4f')]===0x0){return db[_0x5a7b('0x24')]['create']({'name':_0x246982[_0x5a7b('0x28')],'resourceId':_0x246982['id'],'type':_0x5534db[_0x5a7b('0x28')],'sectionId':_0x5534db['id']},{})[_0x5a7b('0x22')](function(){return _0x3bf79b;});}else{return _0x3bf79b;}})['catch'](function(_0x11743a){logger[_0x5a7b('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11743a);throw _0x11743a;});}return _0x3bf79b;})[_0x5a7b('0x22')](respondWithResult(_0x29b0b4,0xc9))[_0x5a7b('0x43')](handleError(_0x29b0b4,null));};exports['clone']=function(_0x5c9180,_0x45cad1){var _0x3c3571={'where':{'id':_0x5c9180['params']['id']}},_0x2d4218={};_0x2d4218[_0x5a7b('0x2e')]=_['keys'](db['Campaign']['rawAttributes']);_0x3c3571['attributes']=_[_0x5a7b('0x31')](_0x2d4218[_0x5a7b('0x2e')],qs['fields'](_0x5c9180[_0x5a7b('0x30')][_0x5a7b('0x32')]));_0x3c3571[_0x5a7b('0x33')]=_0x3c3571['attributes']['length']?_0x3c3571['attributes']:_0x2d4218[_0x5a7b('0x2e')];if(_0x5c9180[_0x5a7b('0x30')]['includeAll']){_0x3c3571[_0x5a7b('0x40')]=[{'all':!![]}];}_0x3c3571=_['merge']({},_0x3c3571,_0x5c9180[_0x5a7b('0x3d')]);return db[_0x5a7b('0x2a')]['find'](_0x3c3571)['then'](handleEntityNotFound(_0x45cad1,null))[_0x5a7b('0x22')](function(_0x3bc912){if(_0x3bc912){var _0x1fbe4e=_0x3bc912[_0x5a7b('0x23')]({'plain':!![]});_0x1fbe4e=qs[_0x5a7b('0x50')](_0x1fbe4e,['id','createdAt',_0x5a7b('0x51')]);_0x5c9180[_0x5a7b('0x52')]=_[_0x5a7b('0x50')](_0x5c9180['body'],['id','createdAt',_0x5a7b('0x51')]);return db[_0x5a7b('0x2a')]['create'](_['merge'](_0x1fbe4e,_0x5c9180[_0x5a7b('0x52')]),{'include':_0x5c9180[_0x5a7b('0x30')][_0x5a7b('0x3f')]?[{'all':!![]}]:undefined})['then'](function(_0x55a11b){var _0xd6fb70=_0x5c9180[_0x5a7b('0x4a')]['get']({'plain':!![]});if(!_0xd6fb70)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd6fb70['role']===_0x5a7b('0x4a')){var _0x55033e=_0x55a11b['get']({'plain':!![]});var _0x38c23f=_0x5a7b('0x4c');return db[_0x5a7b('0x4d')]['find']({'where':{'name':_0x38c23f,'userProfileId':_0xd6fb70[_0x5a7b('0x4e')]},'raw':!![]})[_0x5a7b('0x22')](function(_0x5a9217){if(_0x5a9217&&_0x5a9217[_0x5a7b('0x4f')]===0x0){return db['UserProfileResource'][_0x5a7b('0x49')]({'name':_0x55033e['name'],'resourceId':_0x55033e['id'],'type':_0x5a9217[_0x5a7b('0x28')],'sectionId':_0x5a9217['id']},{})[_0x5a7b('0x22')](function(){return _0x55a11b;});}else{return _0x55a11b;}})[_0x5a7b('0x43')](function(_0x1afab7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1afab7);throw _0x1afab7;});}return _0x55a11b;});}})['then'](respondWithResult(_0x45cad1,0xc9))[_0x5a7b('0x43')](handleError(_0x45cad1,null));};exports[_0x5a7b('0x20')]=function(_0x204e28,_0x576df0){if(_0x204e28[_0x5a7b('0x52')]['id']){delete _0x204e28[_0x5a7b('0x52')]['id'];}return db[_0x5a7b('0x2a')]['find']({'where':{'id':_0x204e28[_0x5a7b('0x44')]['id']}})[_0x5a7b('0x22')](handleEntityNotFound(_0x576df0,null))['then'](saveUpdates(_0x204e28[_0x5a7b('0x52')],null))[_0x5a7b('0x22')](respondWithResult(_0x576df0,null))[_0x5a7b('0x43')](handleError(_0x576df0,null));};exports['destroy']=function(_0x33fd01,_0xabaef0){return db[_0x5a7b('0x2a')][_0x5a7b('0x48')]({'where':{'id':_0x33fd01[_0x5a7b('0x44')]['id']}})[_0x5a7b('0x22')](handleEntityNotFound(_0xabaef0,null))['then'](removeEntity(_0xabaef0,null))[_0x5a7b('0x43')](handleError(_0xabaef0,null));};exports[_0x5a7b('0x53')]=function(_0x43c0ba,_0x52f01e,_0x487b5c){var _0x248a0e={'raw':!![],'where':{}};var _0x430bec={};var _0x213e8f={'count':0x0,'rows':[]};return db[_0x5a7b('0x2a')][_0x5a7b('0x54')]({'where':{'id':_0x43c0ba[_0x5a7b('0x44')]['id']}})[_0x5a7b('0x22')](handleEntityNotFound(_0x52f01e,null))[_0x5a7b('0x22')](function(_0x24f8f4){if(_0x24f8f4){_0x430bec[_0x5a7b('0x2e')]=_['keys'](db['CmHopper'][_0x5a7b('0x45')]);_0x430bec['query']=_[_0x5a7b('0x46')](_0x43c0ba[_0x5a7b('0x30')]);_0x430bec[_0x5a7b('0x39')]=_[_0x5a7b('0x31')](_0x430bec[_0x5a7b('0x2e')],_0x430bec[_0x5a7b('0x30')]);_0x248a0e['attributes']=_[_0x5a7b('0x31')](_0x430bec[_0x5a7b('0x2e')],qs['fields'](_0x43c0ba[_0x5a7b('0x30')][_0x5a7b('0x32')]));_0x248a0e[_0x5a7b('0x33')]=_0x248a0e['attributes']['length']?_0x248a0e['attributes']:_0x430bec[_0x5a7b('0x2e')];if(!_0x43c0ba['query'][_0x5a7b('0x35')](_0x5a7b('0x55'))){_0x248a0e['limit']=qs['limit'](_0x43c0ba[_0x5a7b('0x30')][_0x5a7b('0x1b')]);_0x248a0e[_0x5a7b('0x1a')]=qs[_0x5a7b('0x1a')](_0x43c0ba[_0x5a7b('0x30')][_0x5a7b('0x1a')]);}_0x248a0e[_0x5a7b('0x36')]=qs[_0x5a7b('0x37')](_0x43c0ba[_0x5a7b('0x30')][_0x5a7b('0x37')]);_0x248a0e['where']=qs[_0x5a7b('0x39')](_[_0x5a7b('0x3a')](_0x43c0ba['query'],_0x430bec[_0x5a7b('0x39')]));_0x248a0e[_0x5a7b('0x38')][_0x5a7b('0x56')]=_0x24f8f4['id'];if(_0x43c0ba[_0x5a7b('0x30')][_0x5a7b('0x3b')]){_0x248a0e[_0x5a7b('0x38')]=_[_0x5a7b('0x47')](_0x248a0e['where'],{'$or':_[_0x5a7b('0x2f')](_0x248a0e[_0x5a7b('0x33')],function(_0x5ebc52){var _0x5c74f7={};_0x5c74f7[_0x5ebc52]={'$like':'%'+_0x43c0ba['query'][_0x5a7b('0x3b')]+'%'};return _0x5c74f7;})});}_0x248a0e=_['merge']({},_0x248a0e,_0x43c0ba[_0x5a7b('0x3d')]);return db[_0x5a7b('0x57')]['count']({'where':_0x248a0e[_0x5a7b('0x38')]})['then'](function(_0x707c86){_0x213e8f[_0x5a7b('0x3e')]=_0x707c86;if(_0x43c0ba[_0x5a7b('0x30')][_0x5a7b('0x3f')]){_0x248a0e[_0x5a7b('0x40')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x248a0e);})[_0x5a7b('0x22')](function(_0x1069ec){_0x213e8f[_0x5a7b('0x42')]=_0x1069ec;return _0x213e8f;});}})[_0x5a7b('0x22')](respondWithFilteredResult(_0x52f01e,_0x248a0e))[_0x5a7b('0x43')](handleError(_0x52f01e,null));};exports[_0x5a7b('0x58')]=function(_0x24a9df,_0x58784a,_0x1584cd){var _0x199776={'raw':!![],'where':{}};var _0xe21dc={};var _0x1e06ae={'count':0x0,'rows':[]};return db[_0x5a7b('0x2a')]['findOne']({'where':{'id':_0x24a9df[_0x5a7b('0x44')]['id']}})[_0x5a7b('0x22')](handleEntityNotFound(_0x58784a,null))[_0x5a7b('0x22')](function(_0x13e640){if(_0x13e640){_0xe21dc[_0x5a7b('0x2e')]=_[_0x5a7b('0x46')](db['CmHopperHistory'][_0x5a7b('0x45')]);_0xe21dc[_0x5a7b('0x30')]=_['keys'](_0x24a9df['query']);_0xe21dc['filters']=_[_0x5a7b('0x31')](_0xe21dc[_0x5a7b('0x2e')],_0xe21dc[_0x5a7b('0x30')]);_0x199776['attributes']=_[_0x5a7b('0x31')](_0xe21dc[_0x5a7b('0x2e')],qs['fields'](_0x24a9df[_0x5a7b('0x30')]['fields']));_0x199776[_0x5a7b('0x33')]=_0x199776['attributes'][_0x5a7b('0x34')]?_0x199776[_0x5a7b('0x33')]:_0xe21dc[_0x5a7b('0x2e')];if(!_0x24a9df[_0x5a7b('0x30')]['hasOwnProperty'](_0x5a7b('0x55'))){_0x199776['limit']=qs['limit'](_0x24a9df[_0x5a7b('0x30')][_0x5a7b('0x1b')]);_0x199776[_0x5a7b('0x1a')]=qs[_0x5a7b('0x1a')](_0x24a9df[_0x5a7b('0x30')][_0x5a7b('0x1a')]);}_0x199776[_0x5a7b('0x36')]=qs[_0x5a7b('0x37')](_0x24a9df[_0x5a7b('0x30')]['sort']);_0x199776[_0x5a7b('0x38')]=qs['filters'](_['pick'](_0x24a9df[_0x5a7b('0x30')],_0xe21dc[_0x5a7b('0x39')]));_0x199776[_0x5a7b('0x38')][_0x5a7b('0x56')]=_0x13e640['id'];if(_0x24a9df[_0x5a7b('0x30')][_0x5a7b('0x3b')]){_0x199776[_0x5a7b('0x38')]=_[_0x5a7b('0x47')](_0x199776[_0x5a7b('0x38')],{'$or':_[_0x5a7b('0x2f')](_0x199776[_0x5a7b('0x33')],function(_0x5a0da0){var _0x112ce0={};_0x112ce0[_0x5a0da0]={'$like':'%'+_0x24a9df[_0x5a7b('0x30')]['filter']+'%'};return _0x112ce0;})});}_0x199776=_[_0x5a7b('0x47')]({},_0x199776,_0x24a9df[_0x5a7b('0x3d')]);return db[_0x5a7b('0x59')][_0x5a7b('0x3e')]({'where':_0x199776['where']})[_0x5a7b('0x22')](function(_0xa23ae6){_0x1e06ae[_0x5a7b('0x3e')]=_0xa23ae6;if(_0x24a9df['query'][_0x5a7b('0x3f')]){_0x199776[_0x5a7b('0x40')]=[{'all':!![]}];}return db[_0x5a7b('0x59')][_0x5a7b('0x41')](_0x199776);})[_0x5a7b('0x22')](function(_0x20d5b4){_0x1e06ae[_0x5a7b('0x42')]=_0x20d5b4;return _0x1e06ae;});}})['then'](respondWithFilteredResult(_0x58784a,_0x199776))['catch'](handleError(_0x58784a,null));};exports[_0x5a7b('0x5a')]=function(_0xb320e0,_0x51f4a2,_0x5051c5){var _0x2d6d94={'raw':!![],'where':{}};var _0x59cb48={};var _0x7b887c={'count':0x0,'rows':[]};return db[_0x5a7b('0x2a')][_0x5a7b('0x54')]({'where':{'id':_0xb320e0['params']['id']}})[_0x5a7b('0x22')](handleEntityNotFound(_0x51f4a2,null))[_0x5a7b('0x22')](function(_0x3118d8){if(_0x3118d8){_0x59cb48[_0x5a7b('0x2e')]=_[_0x5a7b('0x46')](db[_0x5a7b('0x5b')]['rawAttributes']);_0x59cb48['query']=_[_0x5a7b('0x46')](_0xb320e0[_0x5a7b('0x30')]);_0x59cb48[_0x5a7b('0x39')]=_[_0x5a7b('0x31')](_0x59cb48[_0x5a7b('0x2e')],_0x59cb48[_0x5a7b('0x30')]);_0x2d6d94['attributes']=_['intersection'](_0x59cb48[_0x5a7b('0x2e')],qs[_0x5a7b('0x32')](_0xb320e0['query']['fields']));_0x2d6d94[_0x5a7b('0x33')]=_0x2d6d94[_0x5a7b('0x33')][_0x5a7b('0x34')]?_0x2d6d94['attributes']:_0x59cb48[_0x5a7b('0x2e')];if(!_0xb320e0['query'][_0x5a7b('0x35')](_0x5a7b('0x55'))){_0x2d6d94['limit']=qs['limit'](_0xb320e0[_0x5a7b('0x30')][_0x5a7b('0x1b')]);_0x2d6d94[_0x5a7b('0x1a')]=qs[_0x5a7b('0x1a')](_0xb320e0[_0x5a7b('0x30')][_0x5a7b('0x1a')]);}_0x2d6d94[_0x5a7b('0x36')]=qs[_0x5a7b('0x37')](_0xb320e0[_0x5a7b('0x30')][_0x5a7b('0x37')]);_0x2d6d94[_0x5a7b('0x38')]=qs[_0x5a7b('0x39')](_[_0x5a7b('0x3a')](_0xb320e0['query'],_0x59cb48[_0x5a7b('0x39')]));_0x2d6d94[_0x5a7b('0x38')][_0x5a7b('0x56')]=_0x3118d8['id'];if(_0xb320e0[_0x5a7b('0x30')][_0x5a7b('0x3b')]){_0x2d6d94[_0x5a7b('0x38')]=_[_0x5a7b('0x47')](_0x2d6d94[_0x5a7b('0x38')],{'$or':_['map'](_0x2d6d94['attributes'],function(_0x4596f8){var _0x23382d={};_0x23382d[_0x4596f8]={'$like':'%'+_0xb320e0[_0x5a7b('0x30')]['filter']+'%'};return _0x23382d;})});}_0x2d6d94=_[_0x5a7b('0x47')]({},_0x2d6d94,_0xb320e0[_0x5a7b('0x3d')]);return db[_0x5a7b('0x5b')][_0x5a7b('0x3e')]({'where':_0x2d6d94[_0x5a7b('0x38')]})[_0x5a7b('0x22')](function(_0x5d8c36){_0x7b887c[_0x5a7b('0x3e')]=_0x5d8c36;if(_0xb320e0[_0x5a7b('0x30')][_0x5a7b('0x3f')]){_0x2d6d94[_0x5a7b('0x40')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x5a7b('0x41')](_0x2d6d94);})[_0x5a7b('0x22')](function(_0x488c77){_0x7b887c[_0x5a7b('0x42')]=_0x488c77;return _0x7b887c;});}})[_0x5a7b('0x22')](respondWithFilteredResult(_0x51f4a2,_0x2d6d94))[_0x5a7b('0x43')](handleError(_0x51f4a2,null));};exports[_0x5a7b('0x5c')]=function(_0x964caf,_0x7a3bcd,_0x1df1fe){var _0x3aa01f={'raw':!![],'where':{}};var _0xf32d03={};var _0x571ee2={'count':0x0,'rows':[]};return db[_0x5a7b('0x2a')][_0x5a7b('0x54')]({'where':{'id':_0x964caf[_0x5a7b('0x44')]['id']}})[_0x5a7b('0x22')](handleEntityNotFound(_0x7a3bcd,null))[_0x5a7b('0x22')](function(_0x4596fd){if(_0x4596fd){_0xf32d03[_0x5a7b('0x2e')]=_['keys'](db['CmHopperBlack'][_0x5a7b('0x45')]);_0xf32d03[_0x5a7b('0x30')]=_[_0x5a7b('0x46')](_0x964caf[_0x5a7b('0x30')]);_0xf32d03['filters']=_[_0x5a7b('0x31')](_0xf32d03[_0x5a7b('0x2e')],_0xf32d03[_0x5a7b('0x30')]);_0x3aa01f['attributes']=_[_0x5a7b('0x31')](_0xf32d03[_0x5a7b('0x2e')],qs[_0x5a7b('0x32')](_0x964caf['query'][_0x5a7b('0x32')]));_0x3aa01f['attributes']=_0x3aa01f[_0x5a7b('0x33')][_0x5a7b('0x34')]?_0x3aa01f[_0x5a7b('0x33')]:_0xf32d03[_0x5a7b('0x2e')];if(!_0x964caf[_0x5a7b('0x30')]['hasOwnProperty'](_0x5a7b('0x55'))){_0x3aa01f[_0x5a7b('0x1b')]=qs['limit'](_0x964caf[_0x5a7b('0x30')][_0x5a7b('0x1b')]);_0x3aa01f[_0x5a7b('0x1a')]=qs[_0x5a7b('0x1a')](_0x964caf[_0x5a7b('0x30')][_0x5a7b('0x1a')]);}_0x3aa01f[_0x5a7b('0x36')]=qs[_0x5a7b('0x37')](_0x964caf[_0x5a7b('0x30')][_0x5a7b('0x37')]);_0x3aa01f[_0x5a7b('0x38')]=qs['filters'](_[_0x5a7b('0x3a')](_0x964caf[_0x5a7b('0x30')],_0xf32d03[_0x5a7b('0x39')]));_0x3aa01f[_0x5a7b('0x38')][_0x5a7b('0x56')]=_0x4596fd['id'];if(_0x964caf[_0x5a7b('0x30')][_0x5a7b('0x3b')]){_0x3aa01f['where']=_['merge'](_0x3aa01f[_0x5a7b('0x38')],{'$or':_['map'](_0x3aa01f[_0x5a7b('0x33')],function(_0x2c4332){var _0x3ef22d={};_0x3ef22d[_0x2c4332]={'$like':'%'+_0x964caf[_0x5a7b('0x30')][_0x5a7b('0x3b')]+'%'};return _0x3ef22d;})});}_0x3aa01f=_['merge']({},_0x3aa01f,_0x964caf[_0x5a7b('0x3d')]);return db[_0x5a7b('0x5d')][_0x5a7b('0x3e')]({'where':_0x3aa01f[_0x5a7b('0x38')]})['then'](function(_0x474984){_0x571ee2['count']=_0x474984;if(_0x964caf[_0x5a7b('0x30')][_0x5a7b('0x3f')]){_0x3aa01f[_0x5a7b('0x40')]=[{'all':!![]}];}return db[_0x5a7b('0x5d')]['findAll'](_0x3aa01f);})[_0x5a7b('0x22')](function(_0x3331be){_0x571ee2[_0x5a7b('0x42')]=_0x3331be;return _0x571ee2;});}})[_0x5a7b('0x22')](respondWithFilteredResult(_0x7a3bcd,_0x3aa01f))[_0x5a7b('0x43')](handleError(_0x7a3bcd,null));};exports[_0x5a7b('0x5e')]=function(_0x3d2204,_0x42f042,_0x30216d){var _0x37887c={};var _0x40dec7={};var _0x59d2cf;var _0x2cb322;return db[_0x5a7b('0x2a')]['findOne']({'where':{'id':_0x3d2204[_0x5a7b('0x44')]['id']}})[_0x5a7b('0x22')](handleEntityNotFound(_0x42f042,null))[_0x5a7b('0x22')](function(_0xd879e){if(_0xd879e){_0x59d2cf=_0xd879e;_0x40dec7[_0x5a7b('0x2e')]=_[_0x5a7b('0x46')](db[_0x5a7b('0x5f')][_0x5a7b('0x45')]);_0x40dec7['query']=_[_0x5a7b('0x46')](_0x3d2204['query']);_0x40dec7[_0x5a7b('0x39')]=_['intersection'](_0x40dec7[_0x5a7b('0x2e')],_0x40dec7[_0x5a7b('0x30')]);_0x37887c['attributes']=_[_0x5a7b('0x31')](_0x40dec7[_0x5a7b('0x2e')],qs[_0x5a7b('0x32')](_0x3d2204['query'][_0x5a7b('0x32')]));_0x37887c[_0x5a7b('0x33')]=_0x37887c[_0x5a7b('0x33')][_0x5a7b('0x34')]?_0x37887c[_0x5a7b('0x33')]:_0x40dec7[_0x5a7b('0x2e')];_0x37887c['order']=qs[_0x5a7b('0x37')](_0x3d2204[_0x5a7b('0x30')][_0x5a7b('0x37')]);_0x37887c[_0x5a7b('0x38')]=qs[_0x5a7b('0x39')](_[_0x5a7b('0x3a')](_0x3d2204[_0x5a7b('0x30')],_0x40dec7[_0x5a7b('0x39')]));if(_0x3d2204[_0x5a7b('0x30')]['filter']){_0x37887c[_0x5a7b('0x38')]=_[_0x5a7b('0x47')](_0x37887c[_0x5a7b('0x38')],{'$or':_['map'](_0x37887c[_0x5a7b('0x33')],function(_0x46a8b7){var _0x44c3ee={};_0x44c3ee[_0x46a8b7]={'$like':'%'+_0x3d2204[_0x5a7b('0x30')][_0x5a7b('0x3b')]+'%'};return _0x44c3ee;})});}_0x37887c=_[_0x5a7b('0x47')]({},_0x37887c,_0x3d2204['options']);return _0x59d2cf[_0x5a7b('0x5e')](_0x37887c);}})[_0x5a7b('0x22')](function(_0x1c37c6){if(_0x1c37c6){_0x2cb322=_0x1c37c6[_0x5a7b('0x34')];if(!_0x3d2204[_0x5a7b('0x30')]['hasOwnProperty'](_0x5a7b('0x55'))){_0x37887c[_0x5a7b('0x1b')]=qs['limit'](_0x3d2204['query'][_0x5a7b('0x1b')]);_0x37887c['offset']=qs[_0x5a7b('0x1a')](_0x3d2204[_0x5a7b('0x30')][_0x5a7b('0x1a')]);}return _0x59d2cf['getLists'](_0x37887c);}})[_0x5a7b('0x22')](function(_0x54d1ed){if(_0x54d1ed){return _0x54d1ed?{'count':_0x2cb322,'rows':_0x54d1ed}:null;}})[_0x5a7b('0x22')](respondWithResult(_0x42f042,null))[_0x5a7b('0x43')](handleError(_0x42f042,null));};exports[_0x5a7b('0x60')]=function(_0x882afa,_0xbe6d18,_0x24ac0e){var _0x3d241d,_0x3bc881;var _0x580d33=[];var _0x49df64=moment()[_0x5a7b('0x61')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x5a7b('0x2a')]['find']({'where':{'id':_0x882afa[_0x5a7b('0x44')]['id']}})[_0x5a7b('0x22')](handleEntityNotFound(_0xbe6d18,null))['then'](function(_0x4a0a52){if(_0x4a0a52){_0x3bc881=_0x4a0a52;return _0x4a0a52[_0x5a7b('0x60')](_0x882afa['body'][_0x5a7b('0x62')],_[_0x5a7b('0x50')](_0x882afa[_0x5a7b('0x52')],['ids','id'])||{});}return null;})[_0x5a7b('0x63')](function(_0x449a14){var _0x1cce2b;var _0x258cf8;_0x3d241d=_0x449a14||[];var _0x23ce8e=[];if(_0x449a14){for(var _0x30f742=0x0;_0x30f742<_0x449a14['length'];_0x30f742+=0x1){var _0x1f0ad7=_0x449a14[_0x30f742][_0x5a7b('0x23')]({'plain':!![]});_0x3bc881[_0x5a7b('0x64')]=_0x882afa['body'][_0x5a7b('0x64')]?_0x882afa[_0x5a7b('0x52')][_0x5a7b('0x64')]:_0x3bc881['dialCheckDuplicateType'];switch(_0x3bc881['dialCheckDuplicateType']){case'always':_0x1cce2b=squel['insert']()['into'](_0x5a7b('0x65'))['fromQuery'](['phone',_0x5a7b('0x66'),'ContactId',_0x5a7b('0x67'),'CampaignId',_0x5a7b('0x68'),_0x5a7b('0x51')],squel[_0x5a7b('0x69')]()[_0x5a7b('0x6a')](_0x5a7b('0x6b'),_0x5a7b('0x6b'))[_0x5a7b('0x6a')](_0x5a7b('0x6c'),_0x5a7b('0x66'))[_0x5a7b('0x6a')]('id','ContactId')[_0x5a7b('0x6a')](_0x1f0ad7['CmListId']['toString'](),'ListId')[_0x5a7b('0x6a')](_0x882afa[_0x5a7b('0x44')]['id'][_0x5a7b('0x6d')](),_0x5a7b('0x56'))[_0x5a7b('0x6a')]('\x27'+_0x49df64+'\x27','createdAt')[_0x5a7b('0x6a')]('\x27'+_0x49df64+'\x27',_0x5a7b('0x51'))[_0x5a7b('0x6e')](_0x5a7b('0x6f'))['where']('deletedAt\x20IS\x20NULL')[_0x5a7b('0x38')](_0x5a7b('0x70'),_0x1f0ad7[_0x5a7b('0x71')][_0x5a7b('0x6d')]())['where'](_0x5a7b('0x72'))[_0x5a7b('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5a7b('0x69')]()[_0x5a7b('0x6a')](_0x5a7b('0x73'))[_0x5a7b('0x6e')]('cm_hopper_final')[_0x5a7b('0x38')](_0x5a7b('0x74'),_0x882afa[_0x5a7b('0x44')]['id'][_0x5a7b('0x6d')]()))[_0x5a7b('0x38')](_0x5a7b('0x75'),squel[_0x5a7b('0x69')]()[_0x5a7b('0x6a')](_0x5a7b('0x76'))[_0x5a7b('0x6e')](_0x5a7b('0x65'))[_0x5a7b('0x38')](_0x5a7b('0x74'),_0x882afa[_0x5a7b('0x44')]['id']['toString']())))[_0x5a7b('0x6d')]();break;case _0x5a7b('0x77'):_0x1cce2b=squel[_0x5a7b('0x78')]()[_0x5a7b('0x79')](_0x5a7b('0x65'))[_0x5a7b('0x7a')]([_0x5a7b('0x6b'),'scheduledAt',_0x5a7b('0x7b'),_0x5a7b('0x67'),'CampaignId','createdAt',_0x5a7b('0x51')],squel['select']()['field'](_0x5a7b('0x6b'),_0x5a7b('0x6b'))[_0x5a7b('0x6a')]('NOW()','scheduledAt')[_0x5a7b('0x6a')]('id',_0x5a7b('0x7b'))['field'](_0x1f0ad7[_0x5a7b('0x71')][_0x5a7b('0x6d')](),_0x5a7b('0x67'))[_0x5a7b('0x6a')](_0x882afa[_0x5a7b('0x44')]['id'][_0x5a7b('0x6d')](),_0x5a7b('0x56'))[_0x5a7b('0x6a')]('\x27'+_0x49df64+'\x27','createdAt')[_0x5a7b('0x6a')]('\x27'+_0x49df64+'\x27',_0x5a7b('0x51'))[_0x5a7b('0x6e')](_0x5a7b('0x6f'))[_0x5a7b('0x38')](_0x5a7b('0x7c'))[_0x5a7b('0x38')](_0x5a7b('0x70'),_0x1f0ad7[_0x5a7b('0x71')][_0x5a7b('0x6d')]())[_0x5a7b('0x38')](_0x5a7b('0x72'))[_0x5a7b('0x38')](_0x5a7b('0x75'),squel[_0x5a7b('0x69')]()[_0x5a7b('0x6a')](_0x5a7b('0x76'))['from'](_0x5a7b('0x65'))[_0x5a7b('0x38')](_0x5a7b('0x74'),_0x882afa[_0x5a7b('0x44')]['id'][_0x5a7b('0x6d')]())))[_0x5a7b('0x6d')]();break;default:_0x1cce2b=squel[_0x5a7b('0x78')]()[_0x5a7b('0x79')](_0x5a7b('0x65'))[_0x5a7b('0x7a')]([_0x5a7b('0x6b'),_0x5a7b('0x66'),_0x5a7b('0x7b'),'ListId',_0x5a7b('0x56'),_0x5a7b('0x68'),_0x5a7b('0x51')],squel[_0x5a7b('0x69')]()[_0x5a7b('0x6a')](_0x5a7b('0x6b'),_0x5a7b('0x6b'))[_0x5a7b('0x6a')](_0x5a7b('0x6c'),_0x5a7b('0x66'))[_0x5a7b('0x6a')]('id',_0x5a7b('0x7b'))[_0x5a7b('0x6a')](_0x1f0ad7[_0x5a7b('0x71')][_0x5a7b('0x6d')](),_0x5a7b('0x67'))['field'](_0x882afa[_0x5a7b('0x44')]['id'][_0x5a7b('0x6d')](),_0x5a7b('0x56'))['field']('\x27'+_0x49df64+'\x27','createdAt')['field']('\x27'+_0x49df64+'\x27','updatedAt')['from'](_0x5a7b('0x6f'))[_0x5a7b('0x38')](_0x5a7b('0x7c'))['where']('ListId\x20=\x20?',_0x1f0ad7['CmListId']['toString']())['where'](_0x5a7b('0x72')))['toString']();}_0x258cf8=squel[_0x5a7b('0x78')]()[_0x5a7b('0x79')](_0x5a7b('0x7d'))[_0x5a7b('0x7a')]([_0x5a7b('0x7e'),_0x5a7b('0x66'),_0x5a7b('0x6b'),'OrderBy',_0x5a7b('0x68'),_0x5a7b('0x51')],squel['select']()[_0x5a7b('0x6a')](_0x5a7b('0x7f'),'id')[_0x5a7b('0x6a')](_0x5a7b('0x6c'),_0x5a7b('0x66'))[_0x5a7b('0x6a')](_0x5a7b('0x80'),_0x5a7b('0x6b'))[_0x5a7b('0x6a')](_0x5a7b('0x81'),_0x5a7b('0x82'))[_0x5a7b('0x6a')]('\x27'+_0x49df64+'\x27','createdAt')['field']('\x27'+_0x49df64+'\x27',_0x5a7b('0x51'))['from']('cm_contact_has_items','ci')[_0x5a7b('0x83')](_0x5a7b('0x65'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x5a7b('0x38')](_0x5a7b('0x84'),_0x1f0ad7['CmListId'][_0x5a7b('0x6d')]())['where']('h.CampaignId=?',_0x882afa['params']['id'][_0x5a7b('0x6d')]())[_0x5a7b('0x38')](_0x5a7b('0x85'),_0x49df64))['toString']();_0x23ce8e[_0x5a7b('0x86')](db[_0x5a7b('0x87')][_0x5a7b('0x30')](_0x1cce2b));_0x580d33[_0x5a7b('0x86')](db['sequelize'][_0x5a7b('0x30')](_0x258cf8));}return BPromise[_0x5a7b('0x88')](_0x23ce8e);}})[_0x5a7b('0x22')](function(){return BPromise['all'](_0x580d33);})[_0x5a7b('0x22')](function(){return _0x3d241d;})[_0x5a7b('0x22')](respondWithResult(_0xbe6d18,null))[_0x5a7b('0x43')](handleError(_0xbe6d18,null));};exports[_0x5a7b('0x89')]=function(_0x3684f1,_0x159571,_0x3d9c68){return db[_0x5a7b('0x2a')][_0x5a7b('0x48')]({'where':{'id':_0x3684f1[_0x5a7b('0x44')]['id']}})[_0x5a7b('0x22')](handleEntityNotFound(_0x159571,null))[_0x5a7b('0x22')](function(_0x3e82dc){if(_0x3e82dc){return _0x3e82dc[_0x5a7b('0x89')](_0x3684f1[_0x5a7b('0x30')]['ids']);}})['then'](function(_0x41ae68){if(_0x41ae68){return db['CmHopper'][_0x5a7b('0x21')]({'where':{'ListId':_0x3684f1[_0x5a7b('0x30')][_0x5a7b('0x62')],'CampaignId':_0x3684f1[_0x5a7b('0x44')]['id']}})['then'](function(){return _0x41ae68;});}})[_0x5a7b('0x22')](respondWithStatusCode(_0x159571,null))[_0x5a7b('0x43')](handleError(_0x159571,null));};exports[_0x5a7b('0x8a')]=function(_0x4c1217,_0x53915d,_0x433a4d){var _0x5dadd5={};var _0x3b853b={};var _0x4c82f9;var _0x56703c;return db[_0x5a7b('0x2a')]['findOne']({'where':{'id':_0x4c1217['params']['id']}})[_0x5a7b('0x22')](handleEntityNotFound(_0x53915d,null))[_0x5a7b('0x22')](function(_0x3aaf31){if(_0x3aaf31){_0x4c82f9=_0x3aaf31;_0x3b853b['model']=_[_0x5a7b('0x46')](db['CmList'][_0x5a7b('0x45')]);_0x3b853b[_0x5a7b('0x30')]=_[_0x5a7b('0x46')](_0x4c1217[_0x5a7b('0x30')]);_0x3b853b[_0x5a7b('0x39')]=_[_0x5a7b('0x31')](_0x3b853b['model'],_0x3b853b['query']);_0x5dadd5[_0x5a7b('0x33')]=_[_0x5a7b('0x31')](_0x3b853b[_0x5a7b('0x2e')],qs[_0x5a7b('0x32')](_0x4c1217['query'][_0x5a7b('0x32')]));_0x5dadd5[_0x5a7b('0x33')]=_0x5dadd5[_0x5a7b('0x33')][_0x5a7b('0x34')]?_0x5dadd5[_0x5a7b('0x33')]:_0x3b853b['model'];_0x5dadd5['order']=qs[_0x5a7b('0x37')](_0x4c1217[_0x5a7b('0x30')][_0x5a7b('0x37')]);_0x5dadd5[_0x5a7b('0x38')]=qs['filters'](_[_0x5a7b('0x3a')](_0x4c1217[_0x5a7b('0x30')],_0x3b853b['filters']));if(_0x4c1217[_0x5a7b('0x30')][_0x5a7b('0x3b')]){_0x5dadd5['where']=_['merge'](_0x5dadd5[_0x5a7b('0x38')],{'$or':_[_0x5a7b('0x2f')](_0x5dadd5[_0x5a7b('0x33')],function(_0x8939bd){var _0x314f06={};_0x314f06[_0x8939bd]={'$like':'%'+_0x4c1217['query'][_0x5a7b('0x3b')]+'%'};return _0x314f06;})});}_0x5dadd5=_['merge']({},_0x5dadd5,_0x4c1217[_0x5a7b('0x3d')]);return _0x4c82f9[_0x5a7b('0x8a')](_0x5dadd5);}})[_0x5a7b('0x22')](function(_0x4d8984){if(_0x4d8984){_0x56703c=_0x4d8984['length'];if(!_0x4c1217[_0x5a7b('0x30')][_0x5a7b('0x35')](_0x5a7b('0x55'))){_0x5dadd5['limit']=qs['limit'](_0x4c1217[_0x5a7b('0x30')][_0x5a7b('0x1b')]);_0x5dadd5[_0x5a7b('0x1a')]=qs[_0x5a7b('0x1a')](_0x4c1217[_0x5a7b('0x30')]['offset']);}return _0x4c82f9[_0x5a7b('0x8a')](_0x5dadd5);}})[_0x5a7b('0x22')](function(_0x10b713){if(_0x10b713){return _0x10b713?{'count':_0x56703c,'rows':_0x10b713}:null;}})[_0x5a7b('0x22')](respondWithResult(_0x53915d,null))['catch'](handleError(_0x53915d,null));};exports['addBlackLists']=function(_0x191a69,_0x5dd96c,_0x3e2d0d){var _0xbe07,_0x3ddca3;var _0x287457=[];var _0x22aef7=moment()['format'](_0x5a7b('0x8b'));return db[_0x5a7b('0x2a')][_0x5a7b('0x48')]({'where':{'id':_0x191a69[_0x5a7b('0x44')]['id']}})[_0x5a7b('0x22')](handleEntityNotFound(_0x5dd96c,null))[_0x5a7b('0x22')](function(_0x223ed6){if(_0x223ed6){_0x3ddca3=_0x223ed6;return _0x223ed6[_0x5a7b('0x8c')](_0x191a69['body'][_0x5a7b('0x62')],_[_0x5a7b('0x50')](_0x191a69[_0x5a7b('0x52')],[_0x5a7b('0x62'),'id'])||{});}return null;})[_0x5a7b('0x63')](function(_0x10c7dd){var _0x16a5a5;var _0xb94d3e;_0xbe07=_0x10c7dd||[];var _0x48303f=[];if(_0x10c7dd){for(var _0x5e7546=0x0;_0x5e7546<_0x10c7dd[_0x5a7b('0x34')];_0x5e7546+=0x1){var _0xe2acc5=_0x10c7dd[_0x5e7546][_0x5a7b('0x23')]({'plain':!![]});_0x16a5a5=squel[_0x5a7b('0x78')]()[_0x5a7b('0x79')](_0x5a7b('0x8d'))[_0x5a7b('0x7a')]([_0x5a7b('0x6b'),_0x5a7b('0x7b'),_0x5a7b('0x67'),'CampaignId','createdAt',_0x5a7b('0x51')],squel['select']()[_0x5a7b('0x6a')]('phone',_0x5a7b('0x6b'))[_0x5a7b('0x6a')]('id',_0x5a7b('0x7b'))[_0x5a7b('0x6a')](_0xe2acc5['CmListId'][_0x5a7b('0x6d')](),_0x5a7b('0x67'))[_0x5a7b('0x6a')](_0x191a69[_0x5a7b('0x44')]['id'][_0x5a7b('0x6d')](),_0x5a7b('0x56'))[_0x5a7b('0x6a')](_0x5a7b('0x6c'),_0x5a7b('0x68'))[_0x5a7b('0x6a')](_0x5a7b('0x6c'),_0x5a7b('0x51'))[_0x5a7b('0x6e')](_0x5a7b('0x6f'))[_0x5a7b('0x38')](_0x5a7b('0x7c'))[_0x5a7b('0x38')](_0x5a7b('0x70'),_0xe2acc5[_0x5a7b('0x71')]['toString']())[_0x5a7b('0x38')](_0x5a7b('0x72')))[_0x5a7b('0x6d')]();_0x48303f['push'](db[_0x5a7b('0x87')]['query'](_0x16a5a5));}return BPromise['all'](_0x48303f);}})[_0x5a7b('0x22')](function(){return _0xbe07;})[_0x5a7b('0x22')](respondWithResult(_0x5dd96c,null))['catch'](handleError(_0x5dd96c,null));};exports[_0x5a7b('0x8e')]=function(_0x52058c,_0x39b143,_0x3b7dd4){return db[_0x5a7b('0x2a')][_0x5a7b('0x48')]({'where':{'id':_0x52058c['params']['id']}})[_0x5a7b('0x22')](handleEntityNotFound(_0x39b143,null))['then'](function(_0x266966){if(_0x266966){return _0x266966[_0x5a7b('0x8e')](_0x52058c[_0x5a7b('0x30')][_0x5a7b('0x62')]);}})['then'](function(_0x117ce6){if(_0x117ce6){return db['CmHopperBlack'][_0x5a7b('0x21')]({'where':{'ListId':_0x52058c[_0x5a7b('0x30')]['ids'],'CampaignId':_0x52058c[_0x5a7b('0x44')]['id']}})[_0x5a7b('0x22')](function(){return _0x117ce6;});}})[_0x5a7b('0x22')](respondWithStatusCode(_0x39b143,null))[_0x5a7b('0x43')](handleError(_0x39b143,null));};
\ No newline at end of file
+var _0x1053=['omit','createdAt','body','updatedAt','update','getHoppers','findOne','CmHopper','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','ContactId','ListId','field','scheduledAt','toString','from','deletedAt\x20IS\x20NULL','CmListId','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','insert','NOW()','cm_contacts','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','h.id','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','CmList','getBlackLists','addBlackLists','format','YYYY-MM-DD\x20HH:mm:ss','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','map','Campaign','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','include','rows','show','params','rawAttributes','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll'];(function(_0x5401aa,_0x506ce9){var _0x6075a1=function(_0xf21e77){while(--_0xf21e77){_0x5401aa['push'](_0x5401aa['shift']());}};_0x6075a1(++_0x506ce9);}(_0x1053,0xd5));var _0x3105=function(_0x3c007e,_0x2e6adc){_0x3c007e=_0x3c007e-0x0;var _0x851f31=_0x1053[_0x3c007e];return _0x851f31;};'use strict';var emlformat=require(_0x3105('0x0'));var rimraf=require(_0x3105('0x1'));var zipdir=require(_0x3105('0x2'));var jsonpatch=require(_0x3105('0x3'));var rp=require(_0x3105('0x4'));var moment=require(_0x3105('0x5'));var BPromise=require(_0x3105('0x6'));var Mustache=require(_0x3105('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3105('0x8'));var csv=require(_0x3105('0x9'));var ejs=require(_0x3105('0xa'));var fs=require('fs');var fs_extra=require(_0x3105('0xb'));var _=require('lodash');var squel=require(_0x3105('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3105('0x9'));var querystring=require('querystring');var Papa=require(_0x3105('0xd'));var Redis=require(_0x3105('0xe'));var authService=require(_0x3105('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3105('0x10'))('api');var utils=require(_0x3105('0x11'));var config=require(_0x3105('0x12'));var licenseUtil=require(_0x3105('0x13'));var db=require(_0x3105('0x14'))['db'];function respondWithStatusCode(_0x2b0394,_0x338ec3){_0x338ec3=_0x338ec3||0xcc;return function(_0x53f901){if(_0x53f901){return _0x2b0394['sendStatus'](_0x338ec3);}return _0x2b0394[_0x3105('0x15')](_0x338ec3)[_0x3105('0x16')]();};}function respondWithResult(_0x117209,_0x53e174){_0x53e174=_0x53e174||0xc8;return function(_0x58e7a6){if(_0x58e7a6){return _0x117209[_0x3105('0x15')](_0x53e174)[_0x3105('0x17')](_0x58e7a6);}};}function respondWithFilteredResult(_0xb63460,_0x21aeae){return function(_0x12031a){if(_0x12031a){var _0x3f4dba=typeof _0x21aeae['offset']===_0x3105('0x18')&&typeof _0x21aeae[_0x3105('0x19')]===_0x3105('0x18');var _0x1a891b=_0x12031a['count'];var _0x439617=_0x3f4dba?0x0:_0x21aeae[_0x3105('0x1a')];var _0x2dc7ce=_0x3f4dba?_0x12031a[_0x3105('0x1b')]:_0x21aeae[_0x3105('0x1a')]+_0x21aeae[_0x3105('0x19')];var _0x4748fe;if(_0x2dc7ce>=_0x1a891b){_0x2dc7ce=_0x1a891b;_0x4748fe=0xc8;}else{_0x4748fe=0xce;}_0xb63460['status'](_0x4748fe);return _0xb63460['set'](_0x3105('0x1c'),_0x439617+'-'+_0x2dc7ce+'/'+_0x1a891b)[_0x3105('0x17')](_0x12031a);}return null;};}function patchUpdates(_0x47b22b){return function(_0x530005){try{jsonpatch[_0x3105('0x1d')](_0x530005,_0x47b22b,!![]);}catch(_0x49dc3e){return BPromise[_0x3105('0x1e')](_0x49dc3e);}return _0x530005[_0x3105('0x1f')]();};}function saveUpdates(_0x471631,_0x11780d){return function(_0x3e654a){if(_0x3e654a){return _0x3e654a['update'](_0x471631)[_0x3105('0x20')](function(_0x359958){return _0x359958;});}return null;};}function removeEntity(_0x1265ac,_0x4630b0){return function(_0x5e0f07){if(_0x5e0f07){return _0x5e0f07[_0x3105('0x21')]()[_0x3105('0x20')](function(){var _0x3b568b=_0x5e0f07[_0x3105('0x22')]({'plain':!![]});var _0x59f007=_0x3105('0x23');return db[_0x3105('0x24')][_0x3105('0x21')]({'where':{'type':_0x59f007,'resourceId':_0x3b568b['id']}})[_0x3105('0x20')](function(){return _0x5e0f07;});})[_0x3105('0x20')](function(){_0x1265ac[_0x3105('0x15')](0xcc)[_0x3105('0x16')]();});}};}function handleEntityNotFound(_0x245398,_0x46c6f8){return function(_0x4b7764){if(!_0x4b7764){_0x245398[_0x3105('0x25')](0x194);}return _0x4b7764;};}function handleError(_0x5aba88,_0x4ae747){_0x4ae747=_0x4ae747||0x1f4;return function(_0x3d9391){logger[_0x3105('0x26')](_0x3d9391[_0x3105('0x27')]);if(_0x3d9391[_0x3105('0x28')]){delete _0x3d9391[_0x3105('0x28')];}_0x5aba88[_0x3105('0x15')](_0x4ae747)['send'](_0x3d9391);};}exports['index']=function(_0x111430,_0x1856c2){var _0x35f718={},_0x47a4be={},_0xfd8465={'count':0x0,'rows':[]};var _0x36fb75=_[_0x3105('0x29')](db[_0x3105('0x2a')]['rawAttributes'],function(_0x1aa87e){return{'name':_0x1aa87e[_0x3105('0x2b')],'type':_0x1aa87e[_0x3105('0x2c')][_0x3105('0x2d')]};});_0x47a4be[_0x3105('0x2e')]=_[_0x3105('0x29')](_0x36fb75,_0x3105('0x28'));_0x47a4be['query']=_[_0x3105('0x2f')](_0x111430[_0x3105('0x30')]);_0x47a4be[_0x3105('0x31')]=_[_0x3105('0x32')](_0x47a4be[_0x3105('0x2e')],_0x47a4be['query']);_0x35f718[_0x3105('0x33')]=_[_0x3105('0x32')](_0x47a4be[_0x3105('0x2e')],qs[_0x3105('0x34')](_0x111430[_0x3105('0x30')][_0x3105('0x34')]));_0x35f718['attributes']=_0x35f718[_0x3105('0x33')][_0x3105('0x35')]?_0x35f718['attributes']:_0x47a4be[_0x3105('0x2e')];if(!_0x111430['query'][_0x3105('0x36')](_0x3105('0x37'))){_0x35f718[_0x3105('0x19')]=qs[_0x3105('0x19')](_0x111430[_0x3105('0x30')][_0x3105('0x19')]);_0x35f718[_0x3105('0x1a')]=qs['offset'](_0x111430[_0x3105('0x30')]['offset']);}_0x35f718[_0x3105('0x38')]=qs[_0x3105('0x39')](_0x111430[_0x3105('0x30')]['sort']);_0x35f718['where']=qs[_0x3105('0x31')](_[_0x3105('0x3a')](_0x111430[_0x3105('0x30')],_0x47a4be[_0x3105('0x31')]),_0x36fb75);if(_0x111430[_0x3105('0x30')]['filter']){_0x35f718['where']=_[_0x3105('0x3b')](_0x35f718[_0x3105('0x3c')],{'$or':_[_0x3105('0x29')](_0x36fb75,function(_0x4b6c2e){if(_0x4b6c2e[_0x3105('0x2c')]!==_0x3105('0x3d')){var _0x46e15f={};_0x46e15f[_0x4b6c2e[_0x3105('0x28')]]={'$like':'%'+_0x111430[_0x3105('0x30')][_0x3105('0x3e')]+'%'};return _0x46e15f;}})});}_0x35f718=_['merge']({},_0x35f718,_0x111430['options']);var _0x9f5ad5={'where':_0x35f718[_0x3105('0x3c')]};return db[_0x3105('0x2a')][_0x3105('0x1b')](_0x9f5ad5)[_0x3105('0x20')](function(_0x1dc4d1){_0xfd8465[_0x3105('0x1b')]=_0x1dc4d1;if(_0x111430[_0x3105('0x30')]['includeAll']){_0x35f718[_0x3105('0x3f')]=[{'all':!![]}];}return db[_0x3105('0x2a')]['findAll'](_0x35f718);})[_0x3105('0x20')](function(_0x2e3492){_0xfd8465[_0x3105('0x40')]=_0x2e3492;return _0xfd8465;})['then'](respondWithFilteredResult(_0x1856c2,_0x35f718))['catch'](handleError(_0x1856c2,null));};exports[_0x3105('0x41')]=function(_0x4eef1b,_0x53cb44){var _0x3b1276={'raw':![],'where':{'id':_0x4eef1b[_0x3105('0x42')]['id']}},_0x4e1b2e={};_0x4e1b2e['model']=_[_0x3105('0x2f')](db[_0x3105('0x2a')][_0x3105('0x43')]);_0x4e1b2e[_0x3105('0x30')]=_['keys'](_0x4eef1b[_0x3105('0x30')]);_0x4e1b2e[_0x3105('0x31')]=_['intersection'](_0x4e1b2e[_0x3105('0x2e')],_0x4e1b2e[_0x3105('0x30')]);_0x3b1276['attributes']=_[_0x3105('0x32')](_0x4e1b2e[_0x3105('0x2e')],qs['fields'](_0x4eef1b[_0x3105('0x30')][_0x3105('0x34')]));_0x3b1276['attributes']=_0x3b1276[_0x3105('0x33')][_0x3105('0x35')]?_0x3b1276[_0x3105('0x33')]:_0x4e1b2e[_0x3105('0x2e')];if(_0x4eef1b[_0x3105('0x30')]['includeAll']){_0x3b1276[_0x3105('0x3f')]=[{'all':!![]}];}_0x3b1276=_[_0x3105('0x3b')]({},_0x3b1276,_0x4eef1b[_0x3105('0x44')]);return db[_0x3105('0x2a')][_0x3105('0x45')](_0x3b1276)[_0x3105('0x20')](handleEntityNotFound(_0x53cb44,null))[_0x3105('0x20')](respondWithResult(_0x53cb44,null))['catch'](handleError(_0x53cb44,null));};exports[_0x3105('0x46')]=function(_0x71b7d1,_0x488211){return db[_0x3105('0x2a')][_0x3105('0x46')](_0x71b7d1['body'],{})['then'](function(_0x4753c8){var _0x5c47ce=_0x71b7d1[_0x3105('0x47')][_0x3105('0x22')]({'plain':!![]});if(!_0x5c47ce)throw new Error(_0x3105('0x48'));if(_0x5c47ce[_0x3105('0x49')]===_0x3105('0x47')){var _0x159e3a=_0x4753c8[_0x3105('0x22')]({'plain':!![]});var _0x615cf8=_0x3105('0x23');return db[_0x3105('0x4a')][_0x3105('0x45')]({'where':{'name':_0x615cf8,'userProfileId':_0x5c47ce[_0x3105('0x4b')]},'raw':!![]})[_0x3105('0x20')](function(_0x398e60){if(_0x398e60&&_0x398e60[_0x3105('0x4c')]===0x0){return db['UserProfileResource'][_0x3105('0x46')]({'name':_0x159e3a['name'],'resourceId':_0x159e3a['id'],'type':_0x398e60['name'],'sectionId':_0x398e60['id']},{})[_0x3105('0x20')](function(){return _0x4753c8;});}else{return _0x4753c8;}})[_0x3105('0x4d')](function(_0x2670ed){logger[_0x3105('0x26')](_0x3105('0x4e'),_0x2670ed);throw _0x2670ed;});}return _0x4753c8;})[_0x3105('0x20')](respondWithResult(_0x488211,0xc9))[_0x3105('0x4d')](handleError(_0x488211,null));};exports[_0x3105('0x4f')]=function(_0x5e6a71,_0x434eb5){var _0x3d947f={'where':{'id':_0x5e6a71[_0x3105('0x42')]['id']}},_0x372557={};_0x372557[_0x3105('0x2e')]=_[_0x3105('0x2f')](db[_0x3105('0x2a')]['rawAttributes']);_0x3d947f[_0x3105('0x33')]=_[_0x3105('0x32')](_0x372557[_0x3105('0x2e')],qs[_0x3105('0x34')](_0x5e6a71['query']['fields']));_0x3d947f[_0x3105('0x33')]=_0x3d947f['attributes'][_0x3105('0x35')]?_0x3d947f[_0x3105('0x33')]:_0x372557[_0x3105('0x2e')];if(_0x5e6a71[_0x3105('0x30')][_0x3105('0x50')]){_0x3d947f[_0x3105('0x3f')]=[{'all':!![]}];}_0x3d947f=_[_0x3105('0x3b')]({},_0x3d947f,_0x5e6a71[_0x3105('0x44')]);return db[_0x3105('0x2a')][_0x3105('0x45')](_0x3d947f)[_0x3105('0x20')](handleEntityNotFound(_0x434eb5,null))['then'](function(_0x415b07){if(_0x415b07){var _0x506022=_0x415b07[_0x3105('0x22')]({'plain':!![]});_0x506022=qs[_0x3105('0x51')](_0x506022,['id',_0x3105('0x52'),'updatedAt']);_0x5e6a71[_0x3105('0x53')]=_[_0x3105('0x51')](_0x5e6a71['body'],['id',_0x3105('0x52'),_0x3105('0x54')]);return db['Campaign'][_0x3105('0x46')](_[_0x3105('0x3b')](_0x506022,_0x5e6a71['body']),{'include':_0x5e6a71[_0x3105('0x30')][_0x3105('0x50')]?[{'all':!![]}]:undefined})[_0x3105('0x20')](function(_0x158d91){var _0x5724ce=_0x5e6a71['user'][_0x3105('0x22')]({'plain':!![]});if(!_0x5724ce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5724ce[_0x3105('0x49')]===_0x3105('0x47')){var _0x18272b=_0x158d91[_0x3105('0x22')]({'plain':!![]});var _0x972251=_0x3105('0x23');return db[_0x3105('0x4a')][_0x3105('0x45')]({'where':{'name':_0x972251,'userProfileId':_0x5724ce['userProfileId']},'raw':!![]})[_0x3105('0x20')](function(_0x59fd7b){if(_0x59fd7b&&_0x59fd7b[_0x3105('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x18272b[_0x3105('0x28')],'resourceId':_0x18272b['id'],'type':_0x59fd7b[_0x3105('0x28')],'sectionId':_0x59fd7b['id']},{})[_0x3105('0x20')](function(){return _0x158d91;});}else{return _0x158d91;}})['catch'](function(_0xcb4b0e){logger[_0x3105('0x26')](_0x3105('0x4e'),_0xcb4b0e);throw _0xcb4b0e;});}return _0x158d91;});}})['then'](respondWithResult(_0x434eb5,0xc9))[_0x3105('0x4d')](handleError(_0x434eb5,null));};exports[_0x3105('0x55')]=function(_0x254f89,_0x1b4ed){if(_0x254f89[_0x3105('0x53')]['id']){delete _0x254f89[_0x3105('0x53')]['id'];}return db['Campaign'][_0x3105('0x45')]({'where':{'id':_0x254f89['params']['id']}})[_0x3105('0x20')](handleEntityNotFound(_0x1b4ed,null))[_0x3105('0x20')](saveUpdates(_0x254f89[_0x3105('0x53')],null))[_0x3105('0x20')](respondWithResult(_0x1b4ed,null))['catch'](handleError(_0x1b4ed,null));};exports[_0x3105('0x21')]=function(_0x399ba0,_0x411689){return db[_0x3105('0x2a')][_0x3105('0x45')]({'where':{'id':_0x399ba0['params']['id']}})[_0x3105('0x20')](handleEntityNotFound(_0x411689,null))['then'](removeEntity(_0x411689,null))[_0x3105('0x4d')](handleError(_0x411689,null));};exports[_0x3105('0x56')]=function(_0xa035e,_0x3e5e92,_0x5890bc){var _0x5a8fd9={'raw':!![],'where':{}};var _0x4054f5={};var _0x10736d={'count':0x0,'rows':[]};return db[_0x3105('0x2a')][_0x3105('0x57')]({'where':{'id':_0xa035e['params']['id']}})[_0x3105('0x20')](handleEntityNotFound(_0x3e5e92,null))[_0x3105('0x20')](function(_0x6e535f){if(_0x6e535f){_0x4054f5[_0x3105('0x2e')]=_[_0x3105('0x2f')](db[_0x3105('0x58')][_0x3105('0x43')]);_0x4054f5[_0x3105('0x30')]=_[_0x3105('0x2f')](_0xa035e[_0x3105('0x30')]);_0x4054f5['filters']=_['intersection'](_0x4054f5['model'],_0x4054f5[_0x3105('0x30')]);_0x5a8fd9[_0x3105('0x33')]=_['intersection'](_0x4054f5[_0x3105('0x2e')],qs[_0x3105('0x34')](_0xa035e[_0x3105('0x30')]['fields']));_0x5a8fd9['attributes']=_0x5a8fd9['attributes']['length']?_0x5a8fd9['attributes']:_0x4054f5[_0x3105('0x2e')];if(!_0xa035e[_0x3105('0x30')][_0x3105('0x36')](_0x3105('0x37'))){_0x5a8fd9[_0x3105('0x19')]=qs['limit'](_0xa035e[_0x3105('0x30')]['limit']);_0x5a8fd9['offset']=qs[_0x3105('0x1a')](_0xa035e[_0x3105('0x30')][_0x3105('0x1a')]);}_0x5a8fd9[_0x3105('0x38')]=qs[_0x3105('0x39')](_0xa035e['query'][_0x3105('0x39')]);_0x5a8fd9[_0x3105('0x3c')]=qs[_0x3105('0x31')](_[_0x3105('0x3a')](_0xa035e[_0x3105('0x30')],_0x4054f5[_0x3105('0x31')]));_0x5a8fd9[_0x3105('0x3c')][_0x3105('0x59')]=_0x6e535f['id'];if(_0xa035e[_0x3105('0x30')]['filter']){_0x5a8fd9[_0x3105('0x3c')]=_['merge'](_0x5a8fd9[_0x3105('0x3c')],{'$or':_['map'](_0x5a8fd9[_0x3105('0x33')],function(_0x35d97d){var _0x396e57={};_0x396e57[_0x35d97d]={'$like':'%'+_0xa035e[_0x3105('0x30')][_0x3105('0x3e')]+'%'};return _0x396e57;})});}_0x5a8fd9=_[_0x3105('0x3b')]({},_0x5a8fd9,_0xa035e[_0x3105('0x44')]);return db[_0x3105('0x58')][_0x3105('0x1b')]({'where':_0x5a8fd9['where']})[_0x3105('0x20')](function(_0x5e811b){_0x10736d['count']=_0x5e811b;if(_0xa035e[_0x3105('0x30')][_0x3105('0x50')]){_0x5a8fd9[_0x3105('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x3105('0x5a')](_0x5a8fd9);})[_0x3105('0x20')](function(_0x42d4d3){_0x10736d['rows']=_0x42d4d3;return _0x10736d;});}})['then'](respondWithFilteredResult(_0x3e5e92,_0x5a8fd9))[_0x3105('0x4d')](handleError(_0x3e5e92,null));};exports[_0x3105('0x5b')]=function(_0x179f0b,_0x5f15cd,_0x52eee0){var _0x2daabc={'raw':!![],'where':{}};var _0x388421={};var _0x36fd91={'count':0x0,'rows':[]};return db[_0x3105('0x2a')][_0x3105('0x57')]({'where':{'id':_0x179f0b[_0x3105('0x42')]['id']}})['then'](handleEntityNotFound(_0x5f15cd,null))[_0x3105('0x20')](function(_0x5b1d19){if(_0x5b1d19){_0x388421[_0x3105('0x2e')]=_[_0x3105('0x2f')](db[_0x3105('0x5c')][_0x3105('0x43')]);_0x388421[_0x3105('0x30')]=_['keys'](_0x179f0b[_0x3105('0x30')]);_0x388421['filters']=_[_0x3105('0x32')](_0x388421[_0x3105('0x2e')],_0x388421[_0x3105('0x30')]);_0x2daabc[_0x3105('0x33')]=_[_0x3105('0x32')](_0x388421[_0x3105('0x2e')],qs[_0x3105('0x34')](_0x179f0b[_0x3105('0x30')][_0x3105('0x34')]));_0x2daabc[_0x3105('0x33')]=_0x2daabc[_0x3105('0x33')][_0x3105('0x35')]?_0x2daabc[_0x3105('0x33')]:_0x388421[_0x3105('0x2e')];if(!_0x179f0b[_0x3105('0x30')][_0x3105('0x36')]('nolimit')){_0x2daabc['limit']=qs[_0x3105('0x19')](_0x179f0b[_0x3105('0x30')][_0x3105('0x19')]);_0x2daabc[_0x3105('0x1a')]=qs[_0x3105('0x1a')](_0x179f0b[_0x3105('0x30')]['offset']);}_0x2daabc[_0x3105('0x38')]=qs['sort'](_0x179f0b[_0x3105('0x30')][_0x3105('0x39')]);_0x2daabc['where']=qs[_0x3105('0x31')](_[_0x3105('0x3a')](_0x179f0b['query'],_0x388421[_0x3105('0x31')]));_0x2daabc[_0x3105('0x3c')][_0x3105('0x59')]=_0x5b1d19['id'];if(_0x179f0b[_0x3105('0x30')]['filter']){_0x2daabc[_0x3105('0x3c')]=_['merge'](_0x2daabc[_0x3105('0x3c')],{'$or':_[_0x3105('0x29')](_0x2daabc[_0x3105('0x33')],function(_0x5efd01){var _0x4d07e6={};_0x4d07e6[_0x5efd01]={'$like':'%'+_0x179f0b[_0x3105('0x30')]['filter']+'%'};return _0x4d07e6;})});}_0x2daabc=_[_0x3105('0x3b')]({},_0x2daabc,_0x179f0b[_0x3105('0x44')]);return db[_0x3105('0x5c')][_0x3105('0x1b')]({'where':_0x2daabc[_0x3105('0x3c')]})[_0x3105('0x20')](function(_0x9ad551){_0x36fd91[_0x3105('0x1b')]=_0x9ad551;if(_0x179f0b['query'][_0x3105('0x50')]){_0x2daabc[_0x3105('0x3f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x3105('0x5a')](_0x2daabc);})['then'](function(_0xe55300){_0x36fd91[_0x3105('0x40')]=_0xe55300;return _0x36fd91;});}})[_0x3105('0x20')](respondWithFilteredResult(_0x5f15cd,_0x2daabc))[_0x3105('0x4d')](handleError(_0x5f15cd,null));};exports[_0x3105('0x5d')]=function(_0x5d940a,_0x34fd6c,_0xb7633){var _0x259481={'raw':!![],'where':{}};var _0x44c834={};var _0x2309af={'count':0x0,'rows':[]};return db['Campaign'][_0x3105('0x57')]({'where':{'id':_0x5d940a[_0x3105('0x42')]['id']}})['then'](handleEntityNotFound(_0x34fd6c,null))[_0x3105('0x20')](function(_0x439beb){if(_0x439beb){_0x44c834[_0x3105('0x2e')]=_[_0x3105('0x2f')](db[_0x3105('0x5e')]['rawAttributes']);_0x44c834[_0x3105('0x30')]=_['keys'](_0x5d940a[_0x3105('0x30')]);_0x44c834[_0x3105('0x31')]=_[_0x3105('0x32')](_0x44c834[_0x3105('0x2e')],_0x44c834[_0x3105('0x30')]);_0x259481[_0x3105('0x33')]=_[_0x3105('0x32')](_0x44c834[_0x3105('0x2e')],qs[_0x3105('0x34')](_0x5d940a[_0x3105('0x30')][_0x3105('0x34')]));_0x259481[_0x3105('0x33')]=_0x259481[_0x3105('0x33')][_0x3105('0x35')]?_0x259481[_0x3105('0x33')]:_0x44c834[_0x3105('0x2e')];if(!_0x5d940a[_0x3105('0x30')][_0x3105('0x36')]('nolimit')){_0x259481[_0x3105('0x19')]=qs['limit'](_0x5d940a[_0x3105('0x30')][_0x3105('0x19')]);_0x259481['offset']=qs[_0x3105('0x1a')](_0x5d940a['query'][_0x3105('0x1a')]);}_0x259481[_0x3105('0x38')]=qs[_0x3105('0x39')](_0x5d940a[_0x3105('0x30')]['sort']);_0x259481[_0x3105('0x3c')]=qs[_0x3105('0x31')](_[_0x3105('0x3a')](_0x5d940a['query'],_0x44c834['filters']));_0x259481[_0x3105('0x3c')][_0x3105('0x59')]=_0x439beb['id'];if(_0x5d940a[_0x3105('0x30')][_0x3105('0x3e')]){_0x259481['where']=_[_0x3105('0x3b')](_0x259481[_0x3105('0x3c')],{'$or':_[_0x3105('0x29')](_0x259481[_0x3105('0x33')],function(_0x54823f){var _0x5d7d19={};_0x5d7d19[_0x54823f]={'$like':'%'+_0x5d940a['query'][_0x3105('0x3e')]+'%'};return _0x5d7d19;})});}_0x259481=_[_0x3105('0x3b')]({},_0x259481,_0x5d940a['options']);return db[_0x3105('0x5e')][_0x3105('0x1b')]({'where':_0x259481[_0x3105('0x3c')]})[_0x3105('0x20')](function(_0x564339){_0x2309af[_0x3105('0x1b')]=_0x564339;if(_0x5d940a[_0x3105('0x30')]['includeAll']){_0x259481[_0x3105('0x3f')]=[{'all':!![]}];}return db[_0x3105('0x5e')][_0x3105('0x5a')](_0x259481);})[_0x3105('0x20')](function(_0x2d42ee){_0x2309af['rows']=_0x2d42ee;return _0x2309af;});}})[_0x3105('0x20')](respondWithFilteredResult(_0x34fd6c,_0x259481))[_0x3105('0x4d')](handleError(_0x34fd6c,null));};exports[_0x3105('0x5f')]=function(_0xbff426,_0xe6a582,_0x42f3f7){var _0x4bc589={'raw':!![],'where':{}};var _0x4a21d4={};var _0x5f3f6e={'count':0x0,'rows':[]};return db['Campaign'][_0x3105('0x57')]({'where':{'id':_0xbff426[_0x3105('0x42')]['id']}})['then'](handleEntityNotFound(_0xe6a582,null))[_0x3105('0x20')](function(_0x3eafea){if(_0x3eafea){_0x4a21d4[_0x3105('0x2e')]=_[_0x3105('0x2f')](db[_0x3105('0x60')]['rawAttributes']);_0x4a21d4[_0x3105('0x30')]=_[_0x3105('0x2f')](_0xbff426[_0x3105('0x30')]);_0x4a21d4[_0x3105('0x31')]=_[_0x3105('0x32')](_0x4a21d4[_0x3105('0x2e')],_0x4a21d4[_0x3105('0x30')]);_0x4bc589[_0x3105('0x33')]=_[_0x3105('0x32')](_0x4a21d4[_0x3105('0x2e')],qs[_0x3105('0x34')](_0xbff426[_0x3105('0x30')][_0x3105('0x34')]));_0x4bc589[_0x3105('0x33')]=_0x4bc589['attributes'][_0x3105('0x35')]?_0x4bc589[_0x3105('0x33')]:_0x4a21d4[_0x3105('0x2e')];if(!_0xbff426[_0x3105('0x30')][_0x3105('0x36')](_0x3105('0x37'))){_0x4bc589['limit']=qs[_0x3105('0x19')](_0xbff426[_0x3105('0x30')][_0x3105('0x19')]);_0x4bc589['offset']=qs[_0x3105('0x1a')](_0xbff426[_0x3105('0x30')][_0x3105('0x1a')]);}_0x4bc589[_0x3105('0x38')]=qs[_0x3105('0x39')](_0xbff426[_0x3105('0x30')]['sort']);_0x4bc589['where']=qs[_0x3105('0x31')](_[_0x3105('0x3a')](_0xbff426[_0x3105('0x30')],_0x4a21d4[_0x3105('0x31')]));_0x4bc589[_0x3105('0x3c')][_0x3105('0x59')]=_0x3eafea['id'];if(_0xbff426[_0x3105('0x30')][_0x3105('0x3e')]){_0x4bc589[_0x3105('0x3c')]=_[_0x3105('0x3b')](_0x4bc589[_0x3105('0x3c')],{'$or':_[_0x3105('0x29')](_0x4bc589['attributes'],function(_0x39a58b){var _0xd3adf8={};_0xd3adf8[_0x39a58b]={'$like':'%'+_0xbff426['query'][_0x3105('0x3e')]+'%'};return _0xd3adf8;})});}_0x4bc589=_[_0x3105('0x3b')]({},_0x4bc589,_0xbff426[_0x3105('0x44')]);return db[_0x3105('0x60')]['count']({'where':_0x4bc589[_0x3105('0x3c')]})[_0x3105('0x20')](function(_0x28d643){_0x5f3f6e[_0x3105('0x1b')]=_0x28d643;if(_0xbff426[_0x3105('0x30')]['includeAll']){_0x4bc589[_0x3105('0x3f')]=[{'all':!![]}];}return db[_0x3105('0x60')][_0x3105('0x5a')](_0x4bc589);})[_0x3105('0x20')](function(_0x11781b){_0x5f3f6e[_0x3105('0x40')]=_0x11781b;return _0x5f3f6e;});}})[_0x3105('0x20')](respondWithFilteredResult(_0xe6a582,_0x4bc589))['catch'](handleError(_0xe6a582,null));};exports[_0x3105('0x61')]=function(_0x4b6e2a,_0x9a5fb3,_0x27aacd){var _0x50487e={};var _0x154b1={};var _0x3837c0;var _0x9a997d;return db[_0x3105('0x2a')]['findOne']({'where':{'id':_0x4b6e2a[_0x3105('0x42')]['id']}})[_0x3105('0x20')](handleEntityNotFound(_0x9a5fb3,null))[_0x3105('0x20')](function(_0x450306){if(_0x450306){_0x3837c0=_0x450306;_0x154b1[_0x3105('0x2e')]=_[_0x3105('0x2f')](db['CmList']['rawAttributes']);_0x154b1[_0x3105('0x30')]=_[_0x3105('0x2f')](_0x4b6e2a[_0x3105('0x30')]);_0x154b1[_0x3105('0x31')]=_[_0x3105('0x32')](_0x154b1[_0x3105('0x2e')],_0x154b1[_0x3105('0x30')]);_0x50487e[_0x3105('0x33')]=_[_0x3105('0x32')](_0x154b1[_0x3105('0x2e')],qs[_0x3105('0x34')](_0x4b6e2a[_0x3105('0x30')]['fields']));_0x50487e[_0x3105('0x33')]=_0x50487e['attributes'][_0x3105('0x35')]?_0x50487e['attributes']:_0x154b1['model'];_0x50487e[_0x3105('0x38')]=qs['sort'](_0x4b6e2a[_0x3105('0x30')][_0x3105('0x39')]);_0x50487e[_0x3105('0x3c')]=qs[_0x3105('0x31')](_[_0x3105('0x3a')](_0x4b6e2a[_0x3105('0x30')],_0x154b1[_0x3105('0x31')]));if(_0x4b6e2a[_0x3105('0x30')][_0x3105('0x3e')]){_0x50487e[_0x3105('0x3c')]=_['merge'](_0x50487e['where'],{'$or':_[_0x3105('0x29')](_0x50487e[_0x3105('0x33')],function(_0x27639f){var _0x3274e6={};_0x3274e6[_0x27639f]={'$like':'%'+_0x4b6e2a[_0x3105('0x30')][_0x3105('0x3e')]+'%'};return _0x3274e6;})});}_0x50487e=_[_0x3105('0x3b')]({},_0x50487e,_0x4b6e2a['options']);return _0x3837c0['getLists'](_0x50487e);}})['then'](function(_0x2e793f){if(_0x2e793f){_0x9a997d=_0x2e793f[_0x3105('0x35')];if(!_0x4b6e2a['query'][_0x3105('0x36')](_0x3105('0x37'))){_0x50487e['limit']=qs[_0x3105('0x19')](_0x4b6e2a[_0x3105('0x30')][_0x3105('0x19')]);_0x50487e[_0x3105('0x1a')]=qs[_0x3105('0x1a')](_0x4b6e2a[_0x3105('0x30')]['offset']);}return _0x3837c0[_0x3105('0x61')](_0x50487e);}})[_0x3105('0x20')](function(_0x1ad99c){if(_0x1ad99c){return _0x1ad99c?{'count':_0x9a997d,'rows':_0x1ad99c}:null;}})[_0x3105('0x20')](respondWithResult(_0x9a5fb3,null))['catch'](handleError(_0x9a5fb3,null));};exports[_0x3105('0x62')]=function(_0x2a740f,_0x16f028,_0x190a48){var _0x30a7c2,_0x5d727e;var _0x15ea11=[];var _0x3b9e11=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign']['find']({'where':{'id':_0x2a740f[_0x3105('0x42')]['id']}})[_0x3105('0x20')](handleEntityNotFound(_0x16f028,null))[_0x3105('0x20')](function(_0x176a9f){if(_0x176a9f){_0x5d727e=_0x176a9f;return _0x176a9f[_0x3105('0x62')](_0x2a740f[_0x3105('0x53')][_0x3105('0x63')],_[_0x3105('0x51')](_0x2a740f['body'],['ids','id'])||{});}return null;})['spread'](function(_0xd129a5){var _0x1441e9;var _0x115ff2;_0x30a7c2=_0xd129a5||[];var _0x3d6584=[];if(_0xd129a5){for(var _0x34a322=0x0;_0x34a322<_0xd129a5['length'];_0x34a322+=0x1){var _0x4f1467=_0xd129a5[_0x34a322][_0x3105('0x22')]({'plain':!![]});_0x5d727e[_0x3105('0x64')]=_0x2a740f['body'][_0x3105('0x64')]?_0x2a740f['body'][_0x3105('0x64')]:_0x5d727e['dialCheckDuplicateType'];switch(_0x5d727e[_0x3105('0x64')]){case _0x3105('0x65'):_0x1441e9=squel['insert']()[_0x3105('0x66')](_0x3105('0x67'))[_0x3105('0x68')]([_0x3105('0x69'),'scheduledAt',_0x3105('0x6a'),_0x3105('0x6b'),'CampaignId',_0x3105('0x52'),_0x3105('0x54')],squel['select']()[_0x3105('0x6c')](_0x3105('0x69'),'phone')[_0x3105('0x6c')]('NOW()',_0x3105('0x6d'))[_0x3105('0x6c')]('id',_0x3105('0x6a'))[_0x3105('0x6c')](_0x4f1467['CmListId']['toString'](),_0x3105('0x6b'))[_0x3105('0x6c')](_0x2a740f[_0x3105('0x42')]['id'][_0x3105('0x6e')](),_0x3105('0x59'))[_0x3105('0x6c')]('\x27'+_0x3b9e11+'\x27',_0x3105('0x52'))[_0x3105('0x6c')]('\x27'+_0x3b9e11+'\x27',_0x3105('0x54'))[_0x3105('0x6f')]('cm_contacts')[_0x3105('0x3c')](_0x3105('0x70'))[_0x3105('0x3c')]('ListId\x20=\x20?',_0x4f1467[_0x3105('0x71')][_0x3105('0x6e')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x3105('0x72'),squel[_0x3105('0x73')]()['field'](_0x3105('0x74'))[_0x3105('0x6f')](_0x3105('0x75'))[_0x3105('0x3c')](_0x3105('0x76'),_0x2a740f[_0x3105('0x42')]['id'][_0x3105('0x6e')]()))[_0x3105('0x3c')](_0x3105('0x72'),squel['select']()[_0x3105('0x6c')]('COALESCE(phone,\x27\x27)')[_0x3105('0x6f')](_0x3105('0x67'))[_0x3105('0x3c')]('CampaignId\x20=\x20?',_0x2a740f[_0x3105('0x42')]['id'][_0x3105('0x6e')]())))[_0x3105('0x6e')]();break;case _0x3105('0x77'):_0x1441e9=squel[_0x3105('0x78')]()[_0x3105('0x66')](_0x3105('0x67'))[_0x3105('0x68')]([_0x3105('0x69'),_0x3105('0x6d'),_0x3105('0x6a'),_0x3105('0x6b'),'CampaignId','createdAt',_0x3105('0x54')],squel[_0x3105('0x73')]()[_0x3105('0x6c')](_0x3105('0x69'),_0x3105('0x69'))[_0x3105('0x6c')](_0x3105('0x79'),_0x3105('0x6d'))['field']('id',_0x3105('0x6a'))[_0x3105('0x6c')](_0x4f1467['CmListId']['toString'](),'ListId')['field'](_0x2a740f[_0x3105('0x42')]['id'][_0x3105('0x6e')](),_0x3105('0x59'))[_0x3105('0x6c')]('\x27'+_0x3b9e11+'\x27',_0x3105('0x52'))[_0x3105('0x6c')]('\x27'+_0x3b9e11+'\x27',_0x3105('0x54'))[_0x3105('0x6f')](_0x3105('0x7a'))['where']('deletedAt\x20IS\x20NULL')[_0x3105('0x3c')]('ListId\x20=\x20?',_0x4f1467[_0x3105('0x71')][_0x3105('0x6e')]())[_0x3105('0x3c')](_0x3105('0x7b'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3105('0x6c')](_0x3105('0x7c'))[_0x3105('0x6f')](_0x3105('0x67'))['where'](_0x3105('0x76'),_0x2a740f[_0x3105('0x42')]['id'][_0x3105('0x6e')]())))[_0x3105('0x6e')]();break;default:_0x1441e9=squel[_0x3105('0x78')]()[_0x3105('0x66')](_0x3105('0x67'))[_0x3105('0x68')]([_0x3105('0x69'),_0x3105('0x6d'),_0x3105('0x6a'),'ListId',_0x3105('0x59'),'createdAt',_0x3105('0x54')],squel[_0x3105('0x73')]()['field'](_0x3105('0x69'),_0x3105('0x69'))[_0x3105('0x6c')](_0x3105('0x79'),_0x3105('0x6d'))[_0x3105('0x6c')]('id',_0x3105('0x6a'))[_0x3105('0x6c')](_0x4f1467['CmListId'][_0x3105('0x6e')](),_0x3105('0x6b'))[_0x3105('0x6c')](_0x2a740f[_0x3105('0x42')]['id'][_0x3105('0x6e')](),_0x3105('0x59'))[_0x3105('0x6c')]('\x27'+_0x3b9e11+'\x27','createdAt')[_0x3105('0x6c')]('\x27'+_0x3b9e11+'\x27','updatedAt')['from'](_0x3105('0x7a'))[_0x3105('0x3c')]('deletedAt\x20IS\x20NULL')[_0x3105('0x3c')](_0x3105('0x7d'),_0x4f1467[_0x3105('0x71')]['toString']())[_0x3105('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x3105('0x6e')]();}_0x115ff2=squel['insert']()[_0x3105('0x66')](_0x3105('0x7e'))[_0x3105('0x68')]([_0x3105('0x7f'),_0x3105('0x6d'),_0x3105('0x69'),'OrderBy',_0x3105('0x52'),_0x3105('0x54')],squel['select']()['field'](_0x3105('0x80'),'id')[_0x3105('0x6c')](_0x3105('0x79'),'scheduledAt')['field']('ci.item',_0x3105('0x69'))[_0x3105('0x6c')]('ci.OrderBY',_0x3105('0x81'))[_0x3105('0x6c')]('\x27'+_0x3b9e11+'\x27',_0x3105('0x52'))[_0x3105('0x6c')]('\x27'+_0x3b9e11+'\x27',_0x3105('0x54'))[_0x3105('0x6f')](_0x3105('0x82'),'ci')[_0x3105('0x83')]('cm_hopper','h',_0x3105('0x84'))[_0x3105('0x3c')](_0x3105('0x85'),_0x4f1467[_0x3105('0x71')][_0x3105('0x6e')]())[_0x3105('0x3c')](_0x3105('0x86'),_0x2a740f['params']['id'][_0x3105('0x6e')]())['where']('h.createdAt\x20=\x20?',_0x3b9e11))['toString']();_0x3d6584[_0x3105('0x87')](db[_0x3105('0x88')][_0x3105('0x30')](_0x1441e9));_0x15ea11['push'](db[_0x3105('0x88')]['query'](_0x115ff2));}return BPromise['all'](_0x3d6584);}})['then'](function(){return BPromise[_0x3105('0x89')](_0x15ea11);})[_0x3105('0x20')](function(){return _0x30a7c2;})[_0x3105('0x20')](respondWithResult(_0x16f028,null))['catch'](handleError(_0x16f028,null));};exports[_0x3105('0x8a')]=function(_0x29a98a,_0x25f04d,_0x24f343){return db[_0x3105('0x2a')]['find']({'where':{'id':_0x29a98a['params']['id']}})[_0x3105('0x20')](handleEntityNotFound(_0x25f04d,null))[_0x3105('0x20')](function(_0xdfbd8e){if(_0xdfbd8e){return _0xdfbd8e[_0x3105('0x8a')](_0x29a98a['query']['ids']);}})[_0x3105('0x20')](function(_0x136208){if(_0x136208){return db[_0x3105('0x58')][_0x3105('0x21')]({'where':{'ListId':_0x29a98a[_0x3105('0x30')][_0x3105('0x63')],'CampaignId':_0x29a98a[_0x3105('0x42')]['id']}})[_0x3105('0x20')](function(){return _0x136208;});}})[_0x3105('0x20')](respondWithStatusCode(_0x25f04d,null))[_0x3105('0x4d')](handleError(_0x25f04d,null));};exports['getBlackLists']=function(_0x5b2f86,_0x584c0c,_0x300c0b){var _0x2b5fca={};var _0x5c31c8={};var _0x2d085a;var _0x519259;return db[_0x3105('0x2a')]['findOne']({'where':{'id':_0x5b2f86['params']['id']}})['then'](handleEntityNotFound(_0x584c0c,null))[_0x3105('0x20')](function(_0x371f42){if(_0x371f42){_0x2d085a=_0x371f42;_0x5c31c8['model']=_[_0x3105('0x2f')](db[_0x3105('0x8b')][_0x3105('0x43')]);_0x5c31c8['query']=_[_0x3105('0x2f')](_0x5b2f86[_0x3105('0x30')]);_0x5c31c8[_0x3105('0x31')]=_[_0x3105('0x32')](_0x5c31c8[_0x3105('0x2e')],_0x5c31c8[_0x3105('0x30')]);_0x2b5fca[_0x3105('0x33')]=_[_0x3105('0x32')](_0x5c31c8[_0x3105('0x2e')],qs['fields'](_0x5b2f86[_0x3105('0x30')][_0x3105('0x34')]));_0x2b5fca[_0x3105('0x33')]=_0x2b5fca[_0x3105('0x33')][_0x3105('0x35')]?_0x2b5fca[_0x3105('0x33')]:_0x5c31c8[_0x3105('0x2e')];_0x2b5fca[_0x3105('0x38')]=qs[_0x3105('0x39')](_0x5b2f86[_0x3105('0x30')]['sort']);_0x2b5fca[_0x3105('0x3c')]=qs[_0x3105('0x31')](_[_0x3105('0x3a')](_0x5b2f86['query'],_0x5c31c8['filters']));if(_0x5b2f86[_0x3105('0x30')][_0x3105('0x3e')]){_0x2b5fca[_0x3105('0x3c')]=_['merge'](_0x2b5fca['where'],{'$or':_[_0x3105('0x29')](_0x2b5fca['attributes'],function(_0x5cf532){var _0x1b5f27={};_0x1b5f27[_0x5cf532]={'$like':'%'+_0x5b2f86[_0x3105('0x30')][_0x3105('0x3e')]+'%'};return _0x1b5f27;})});}_0x2b5fca=_[_0x3105('0x3b')]({},_0x2b5fca,_0x5b2f86['options']);return _0x2d085a['getBlackLists'](_0x2b5fca);}})['then'](function(_0x50f0f2){if(_0x50f0f2){_0x519259=_0x50f0f2['length'];if(!_0x5b2f86[_0x3105('0x30')]['hasOwnProperty'](_0x3105('0x37'))){_0x2b5fca[_0x3105('0x19')]=qs[_0x3105('0x19')](_0x5b2f86[_0x3105('0x30')][_0x3105('0x19')]);_0x2b5fca[_0x3105('0x1a')]=qs['offset'](_0x5b2f86[_0x3105('0x30')]['offset']);}return _0x2d085a[_0x3105('0x8c')](_0x2b5fca);}})[_0x3105('0x20')](function(_0x32961e){if(_0x32961e){return _0x32961e?{'count':_0x519259,'rows':_0x32961e}:null;}})[_0x3105('0x20')](respondWithResult(_0x584c0c,null))[_0x3105('0x4d')](handleError(_0x584c0c,null));};exports[_0x3105('0x8d')]=function(_0x3eb3ee,_0x4fd07d,_0x339a2b){var _0x61d88f,_0x494341;var _0x2d94be=[];var _0x12bfd0=moment()[_0x3105('0x8e')](_0x3105('0x8f'));return db['Campaign'][_0x3105('0x45')]({'where':{'id':_0x3eb3ee['params']['id']}})['then'](handleEntityNotFound(_0x4fd07d,null))[_0x3105('0x20')](function(_0x11e977){if(_0x11e977){_0x494341=_0x11e977;return _0x11e977['addBlackLists'](_0x3eb3ee['body']['ids'],_['omit'](_0x3eb3ee[_0x3105('0x53')],['ids','id'])||{});}return null;})[_0x3105('0x90')](function(_0x44c4fc){var _0x5f2a98;var _0x56b92c;_0x61d88f=_0x44c4fc||[];var _0x4c83bb=[];if(_0x44c4fc){for(var _0x1b3900=0x0;_0x1b3900<_0x44c4fc[_0x3105('0x35')];_0x1b3900+=0x1){var _0x3394ba=_0x44c4fc[_0x1b3900]['get']({'plain':!![]});_0x5f2a98=squel['insert']()[_0x3105('0x66')](_0x3105('0x91'))['fromQuery'](['phone',_0x3105('0x6a'),_0x3105('0x6b'),_0x3105('0x59'),'createdAt',_0x3105('0x54')],squel['select']()[_0x3105('0x6c')](_0x3105('0x69'),_0x3105('0x69'))[_0x3105('0x6c')]('id',_0x3105('0x6a'))[_0x3105('0x6c')](_0x3394ba[_0x3105('0x71')][_0x3105('0x6e')](),_0x3105('0x6b'))['field'](_0x3eb3ee[_0x3105('0x42')]['id'][_0x3105('0x6e')](),_0x3105('0x59'))[_0x3105('0x6c')](_0x3105('0x79'),_0x3105('0x52'))[_0x3105('0x6c')](_0x3105('0x79'),_0x3105('0x54'))[_0x3105('0x6f')]('cm_contacts')[_0x3105('0x3c')](_0x3105('0x70'))[_0x3105('0x3c')](_0x3105('0x7d'),_0x3394ba[_0x3105('0x71')][_0x3105('0x6e')]())[_0x3105('0x3c')](_0x3105('0x7b')))[_0x3105('0x6e')]();_0x4c83bb[_0x3105('0x87')](db[_0x3105('0x88')][_0x3105('0x30')](_0x5f2a98));}return BPromise[_0x3105('0x89')](_0x4c83bb);}})[_0x3105('0x20')](function(){return _0x61d88f;})[_0x3105('0x20')](respondWithResult(_0x4fd07d,null))[_0x3105('0x4d')](handleError(_0x4fd07d,null));};exports[_0x3105('0x92')]=function(_0x15ced9,_0x3ecc2a,_0x11316e){return db[_0x3105('0x2a')]['find']({'where':{'id':_0x15ced9[_0x3105('0x42')]['id']}})[_0x3105('0x20')](handleEntityNotFound(_0x3ecc2a,null))[_0x3105('0x20')](function(_0x39db9b){if(_0x39db9b){return _0x39db9b[_0x3105('0x92')](_0x15ced9[_0x3105('0x30')][_0x3105('0x63')]);}})[_0x3105('0x20')](function(_0x452ec7){if(_0x452ec7){return db['CmHopperBlack'][_0x3105('0x21')]({'where':{'ListId':_0x15ced9[_0x3105('0x30')][_0x3105('0x63')],'CampaignId':_0x15ced9[_0x3105('0x42')]['id']}})['then'](function(){return _0x452ec7;});}})[_0x3105('0x20')](respondWithStatusCode(_0x3ecc2a,null))['catch'](handleError(_0x3ecc2a,null));};
\ No newline at end of file
index 3424ef8..e5622e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x31a11d,_0xec04ae){var _0x3e4228=function(_0x159406){while(--_0x159406){_0x31a11d['push'](_0x31a11d['shift']());}};_0x3e4228(++_0xec04ae);}(_0x7a54,0x106));var _0x47a5=function(_0x2da5a9,_0x17a37c){_0x2da5a9=_0x2da5a9-0x0;var _0x396476=_0x7a54[_0x2da5a9];return _0x396476;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x2aaf0c,_0x120301){var _0x2ccbed=function(_0x5360d9){while(--_0x5360d9){_0x2aaf0c['push'](_0x2aaf0c['shift']());}};_0x2ccbed(++_0x120301);}(_0x7a54,0x106));var _0x47a5=function(_0xd2f507,_0x3f95f6){_0xd2f507=_0xd2f507-0x0;var _0x47f30e=_0x7a54[_0xd2f507];return _0x47f30e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index b4f1522..52e6f71 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd0bb=['result','catch','GetCampaign','findAll','options','raw','attributes','include','map','model','info','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','Campaign,\x20%s,\x20%s','message'];(function(_0x247d77,_0x1abf18){var _0x65ede0=function(_0x595713){while(--_0x595713){_0x247d77['push'](_0x247d77['shift']());}};_0x65ede0(++_0x1abf18);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0xe6ba3b,_0x58e953){_0xe6ba3b=_0xe6ba3b-0x0;var _0x19adbe=_0xd0bb[_0xe6ba3b];return _0x19adbe;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c205,_0x809599,_0x5eb975){return new BPromise(function(_0x2a4075,_0x4533ff){return client[_0xbd0b('0xa')](_0x37c205,_0x5eb975)[_0xbd0b('0xb')](function(_0x16e185){logger['info']('Campaign,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'));logger[_0xbd0b('0xd')]('Campaign,\x20%s,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'),JSON[_0xbd0b('0xe')](_0x16e185));if(_0x16e185['error']){if(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x10')]===0x1f4){logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);return _0x4533ff(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);}logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')]['message']);return _0x2a4075(_0x16e185[_0xbd0b('0xf')]['message']);}else{logger['info'](_0xbd0b('0x11'),_0x809599,_0xbd0b('0xc'));_0x2a4075(_0x16e185[_0xbd0b('0x13')][_0xbd0b('0x12')]);}})[_0xbd0b('0x14')](function(_0x546db3){logger['error'](_0xbd0b('0x11'),_0x809599,_0x546db3);_0x4533ff(_0x546db3);});});}exports[_0xbd0b('0x15')]=function(_0x1f2a6e){var _0x2f58a3=this;return new Promise(function(_0x1c0a7c,_0x40b798){return db['Campaign'][_0xbd0b('0x16')]({'raw':_0x1f2a6e['options']?_0x1f2a6e[_0xbd0b('0x17')][_0xbd0b('0x18')]===undefined?!![]:![]:!![],'where':_0x1f2a6e[_0xbd0b('0x17')]?_0x1f2a6e[_0xbd0b('0x17')]['where']||null:null,'attributes':_0x1f2a6e[_0xbd0b('0x17')]?_0x1f2a6e[_0xbd0b('0x17')][_0xbd0b('0x19')]||null:null,'limit':_0x1f2a6e['options']?_0x1f2a6e[_0xbd0b('0x17')]['limit']||null:null,'include':_0x1f2a6e[_0xbd0b('0x17')]?_0x1f2a6e[_0xbd0b('0x17')][_0xbd0b('0x1a')]?_[_0xbd0b('0x1b')](_0x1f2a6e[_0xbd0b('0x17')]['include'],function(_0x75909f){return{'model':db[_0x75909f['model']],'as':_0x75909f['as'],'attributes':_0x75909f[_0xbd0b('0x19')],'include':_0x75909f[_0xbd0b('0x1a')]?_[_0xbd0b('0x1b')](_0x75909f[_0xbd0b('0x1a')],function(_0xfd9f82){return{'model':db[_0xfd9f82[_0xbd0b('0x1c')]],'as':_0xfd9f82['as'],'attributes':_0xfd9f82['attributes'],'include':_0xfd9f82[_0xbd0b('0x1a')]?_[_0xbd0b('0x1b')](_0xfd9f82[_0xbd0b('0x1a')],function(_0x1b5a00){return{'model':db[_0x1b5a00[_0xbd0b('0x1c')]],'as':_0x1b5a00['as'],'attributes':_0x1b5a00[_0xbd0b('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x149403){logger[_0xbd0b('0x1d')](_0xbd0b('0x15'),_0x1f2a6e);logger['debug']('GetCampaign',_0x1f2a6e,JSON[_0xbd0b('0xe')](_0x149403));_0x1c0a7c(_0x149403);})[_0xbd0b('0x14')](function(_0x14e5a3){logger[_0xbd0b('0xf')](_0xbd0b('0x15'),_0x14e5a3[_0xbd0b('0x12')],_0x1f2a6e);_0x40b798(_0x2f58a3[_0xbd0b('0xf')](0x1f4,_0x14e5a3['message']));});});};
\ No newline at end of file
+var _0x515d=['include','map','model','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','raw','limit'];(function(_0x2c7371,_0x132922){var _0x525dce=function(_0x491bb4){while(--_0x491bb4){_0x2c7371['push'](_0x2c7371['shift']());}};_0x525dce(++_0x132922);}(_0x515d,0x104));var _0xd515=function(_0x5e321a,_0x17c9b5){_0x5e321a=_0x5e321a-0x0;var _0x38fd9d=_0x515d[_0x5e321a];return _0x38fd9d;};'use strict';var _=require('lodash');var util=require(_0xd515('0x0'));var moment=require(_0xd515('0x1'));var BPromise=require(_0xd515('0x2'));var rs=require(_0xd515('0x3'));var fs=require('fs');var Redis=require(_0xd515('0x4'));var db=require(_0xd515('0x5'))['db'];var utils=require(_0xd515('0x6'));var logger=require(_0xd515('0x7'))('rpc');var config=require(_0xd515('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd515('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1130fc,_0x43d633,_0x26a25d){return new BPromise(function(_0x2ec6e2,_0x55a0da){return client[_0xd515('0xa')](_0x1130fc,_0x26a25d)[_0xd515('0xb')](function(_0x138086){logger[_0xd515('0xc')](_0xd515('0xd'),_0x43d633,_0xd515('0xe'));logger['debug'](_0xd515('0xf'),_0x43d633,_0xd515('0xe'),JSON[_0xd515('0x10')](_0x138086));if(_0x138086[_0xd515('0x11')]){if(_0x138086['error'][_0xd515('0x12')]===0x1f4){logger[_0xd515('0x11')](_0xd515('0xd'),_0x43d633,_0x138086[_0xd515('0x11')][_0xd515('0x13')]);return _0x55a0da(_0x138086[_0xd515('0x11')][_0xd515('0x13')]);}logger[_0xd515('0x11')](_0xd515('0xd'),_0x43d633,_0x138086[_0xd515('0x11')][_0xd515('0x13')]);return _0x2ec6e2(_0x138086[_0xd515('0x11')][_0xd515('0x13')]);}else{logger['info'](_0xd515('0xd'),_0x43d633,_0xd515('0xe'));_0x2ec6e2(_0x138086[_0xd515('0x14')][_0xd515('0x13')]);}})[_0xd515('0x15')](function(_0x33dbb6){logger[_0xd515('0x11')](_0xd515('0xd'),_0x43d633,_0x33dbb6);_0x55a0da(_0x33dbb6);});});}exports[_0xd515('0x16')]=function(_0x564c4e){var _0x4ae5b7=this;return new Promise(function(_0x43bb12,_0x2b0173){return db[_0xd515('0x17')][_0xd515('0x18')]({'raw':_0x564c4e[_0xd515('0x19')]?_0x564c4e[_0xd515('0x19')][_0xd515('0x1a')]===undefined?!![]:![]:!![],'where':_0x564c4e[_0xd515('0x19')]?_0x564c4e[_0xd515('0x19')]['where']||null:null,'attributes':_0x564c4e[_0xd515('0x19')]?_0x564c4e[_0xd515('0x19')]['attributes']||null:null,'limit':_0x564c4e[_0xd515('0x19')]?_0x564c4e[_0xd515('0x19')][_0xd515('0x1b')]||null:null,'include':_0x564c4e['options']?_0x564c4e[_0xd515('0x19')][_0xd515('0x1c')]?_[_0xd515('0x1d')](_0x564c4e[_0xd515('0x19')]['include'],function(_0x430153){return{'model':db[_0x430153[_0xd515('0x1e')]],'as':_0x430153['as'],'attributes':_0x430153[_0xd515('0x1f')],'include':_0x430153[_0xd515('0x1c')]?_[_0xd515('0x1d')](_0x430153[_0xd515('0x1c')],function(_0x130533){return{'model':db[_0x130533[_0xd515('0x1e')]],'as':_0x130533['as'],'attributes':_0x130533[_0xd515('0x1f')],'include':_0x130533['include']?_['map'](_0x130533[_0xd515('0x1c')],function(_0x2b803a){return{'model':db[_0x2b803a[_0xd515('0x1e')]],'as':_0x2b803a['as'],'attributes':_0x2b803a[_0xd515('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd515('0xb')](function(_0x2171bc){logger[_0xd515('0xc')](_0xd515('0x16'),_0x564c4e);logger['debug'](_0xd515('0x16'),_0x564c4e,JSON[_0xd515('0x10')](_0x2171bc));_0x43bb12(_0x2171bc);})[_0xd515('0x15')](function(_0x154c02){logger[_0xd515('0x11')](_0xd515('0x16'),_0x154c02[_0xd515('0x13')],_0x564c4e);_0x2b0173(_0x4ae5b7['error'](0x1f4,_0x154c02['message']));});});};
\ No newline at end of file
index 43ea0b7..b674eaa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x52b8=['removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addBlackLists','put','/:id','update','delete','destroy'];(function(_0x4dd479,_0x26d87a){var _0x1b6807=function(_0x2bec19){while(--_0x2bec19){_0x4dd479['push'](_0x4dd479['shift']());}};_0x1b6807(++_0x26d87a);}(_0x52b8,0xb2));var _0x852b=function(_0x212d05,_0x1f4f77){_0x212d05=_0x212d05-0x0;var _0x4b8cd3=_0x52b8[_0x212d05];return _0x4b8cd3;};'use strict';var multer=require(_0x852b('0x0'));var util=require('util');var path=require(_0x852b('0x1'));var timeout=require(_0x852b('0x2'));var express=require(_0x852b('0x3'));var router=express[_0x852b('0x4')]();var fs_extra=require(_0x852b('0x5'));var auth=require(_0x852b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x852b('0x7'));var controller=require(_0x852b('0x8'));router[_0x852b('0x9')]('/',auth[_0x852b('0xa')](),controller['index']);router[_0x852b('0x9')]('/:id',auth[_0x852b('0xa')](),controller[_0x852b('0xb')]);router[_0x852b('0x9')](_0x852b('0xc'),auth['isAuthenticated'](),controller[_0x852b('0xd')]);router[_0x852b('0x9')](_0x852b('0xe'),auth[_0x852b('0xa')](),controller['getHopperHistories']);router[_0x852b('0x9')](_0x852b('0xf'),auth[_0x852b('0xa')](),controller[_0x852b('0x10')]);router['get'](_0x852b('0x11'),auth[_0x852b('0xa')](),controller['getHopperBlacks']);router[_0x852b('0x9')](_0x852b('0x12'),auth[_0x852b('0xa')](),controller[_0x852b('0x13')]);router['get'](_0x852b('0x14'),auth[_0x852b('0xa')](),controller[_0x852b('0x15')]);router[_0x852b('0x16')]('/',auth['isAuthenticated'](),controller[_0x852b('0x17')]);router[_0x852b('0x16')](_0x852b('0x18'),auth[_0x852b('0xa')](),controller[_0x852b('0x19')]);router['post'](_0x852b('0x12'),auth[_0x852b('0xa')](),controller['addLists']);router['post'](_0x852b('0x14'),auth[_0x852b('0xa')](),controller[_0x852b('0x1a')]);router[_0x852b('0x1b')](_0x852b('0x1c'),auth[_0x852b('0xa')](),controller[_0x852b('0x1d')]);router[_0x852b('0x1e')](_0x852b('0x1c'),auth['isAuthenticated'](),controller[_0x852b('0x1f')]);router[_0x852b('0x1e')](_0x852b('0x12'),auth[_0x852b('0xa')](),controller[_0x852b('0x20')]);router[_0x852b('0x1e')]('/:id/blacklists',auth[_0x852b('0xa')](),controller[_0x852b('0x21')]);module[_0x852b('0x22')]=router;
\ No newline at end of file
+var _0x7326=['/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index'];(function(_0x20ec4f,_0x2c3f24){var _0x139e99=function(_0x150fc7){while(--_0x150fc7){_0x20ec4f['push'](_0x20ec4f['shift']());}};_0x139e99(++_0x2c3f24);}(_0x7326,0xc7));var _0x6732=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x7326[_0x2df507];return _0x1f7167;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6732('0x0'));var timeout=require('connect-timeout');var express=require(_0x6732('0x1'));var router=express[_0x6732('0x2')]();var fs_extra=require(_0x6732('0x3'));var auth=require(_0x6732('0x4'));var interaction=require(_0x6732('0x5'));var config=require(_0x6732('0x6'));var controller=require(_0x6732('0x7'));router[_0x6732('0x8')]('/',auth[_0x6732('0x9')](),controller[_0x6732('0xa')]);router['get'](_0x6732('0xb'),auth[_0x6732('0x9')](),controller['show']);router[_0x6732('0x8')](_0x6732('0xc'),auth['isAuthenticated'](),controller[_0x6732('0xd')]);router[_0x6732('0x8')](_0x6732('0xe'),auth[_0x6732('0x9')](),controller[_0x6732('0xf')]);router[_0x6732('0x8')](_0x6732('0x10'),auth['isAuthenticated'](),controller[_0x6732('0x11')]);router['get'](_0x6732('0x12'),auth[_0x6732('0x9')](),controller[_0x6732('0x13')]);router['get'](_0x6732('0x14'),auth[_0x6732('0x9')](),controller[_0x6732('0x15')]);router[_0x6732('0x8')](_0x6732('0x16'),auth[_0x6732('0x9')](),controller[_0x6732('0x17')]);router[_0x6732('0x18')]('/',auth[_0x6732('0x9')](),controller[_0x6732('0x19')]);router['post'](_0x6732('0x1a'),auth['isAuthenticated'](),controller[_0x6732('0x1b')]);router[_0x6732('0x18')](_0x6732('0x14'),auth['isAuthenticated'](),controller[_0x6732('0x1c')]);router[_0x6732('0x18')](_0x6732('0x16'),auth['isAuthenticated'](),controller[_0x6732('0x1d')]);router[_0x6732('0x1e')]('/:id',auth[_0x6732('0x9')](),controller[_0x6732('0x1f')]);router[_0x6732('0x20')](_0x6732('0xb'),auth[_0x6732('0x9')](),controller[_0x6732('0x21')]);router[_0x6732('0x20')](_0x6732('0x14'),auth[_0x6732('0x9')](),controller[_0x6732('0x22')]);router[_0x6732('0x20')](_0x6732('0x16'),auth[_0x6732('0x9')](),controller['removeBlackLists']);module['exports']=router;
\ No newline at end of file
index abb7e4c..74ff422 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2d0d=['getDataValue','key','sequelize','STRING','VIRTUAL'];(function(_0x54f4f1,_0x2e603b){var _0x14b71f=function(_0x410ca5){while(--_0x410ca5){_0x54f4f1['push'](_0x54f4f1['shift']());}};_0x14b71f(++_0x2e603b);}(_0x2d0d,0x129));var _0xd2d0=function(_0x13e724,_0x296739){_0x13e724=_0x13e724-0x0;var _0x334a44=_0x2d0d[_0x13e724];return _0x334a44;};'use strict';var Sequelize=require(_0xd2d0('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xd2d0('0x1')]},'name':{'type':Sequelize[_0xd2d0('0x2')],'get':function(){return this[_0xd2d0('0x3')](_0xd2d0('0x4'));}}};
\ No newline at end of file
+var _0xf0df=['exports','STRING','TEXT','getDataValue','key','sequelize'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0xf0df,0x11f));var _0xff0d=function(_0x7a2fc4,_0x419d95){_0x7a2fc4=_0x7a2fc4-0x0;var _0x1e9c3a=_0xf0df[_0x7a2fc4];return _0x1e9c3a;};'use strict';var Sequelize=require(_0xff0d('0x0'));module[_0xff0d('0x1')]={'key':{'type':Sequelize[_0xff0d('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xff0d('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xff0d('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xff0d('0x4')](_0xff0d('0x5'));}}};
\ No newline at end of file
index b43e510..b3660b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x587a=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x587a,0x14b));var _0xa587=function(_0x50a7d6,_0x109734){_0x50a7d6=_0x50a7d6-0x0;var _0x37feb7=_0x587a[_0x50a7d6];return _0x37feb7;};'use strict';var emlformat=require(_0xa587('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa587('0x1'));var moment=require(_0xa587('0x2'));var BPromise=require(_0xa587('0x3'));var Mustache=require(_0xa587('0x4'));var util=require(_0xa587('0x5'));var path=require(_0xa587('0x6'));var sox=require('sox');var csv=require(_0xa587('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa587('0x8'));var _=require('lodash');var squel=require(_0xa587('0x9'));var crypto=require(_0xa587('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa587('0xb'));var Papa=require(_0xa587('0xc'));var Redis=require('ioredis');var authService=require(_0xa587('0xd'));var qs=require(_0xa587('0xe'));var as=require(_0xa587('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa587('0x10'))(_0xa587('0x11'));var utils=require(_0xa587('0x12'));var config=require(_0xa587('0x13'));var licenseUtil=require(_0xa587('0x14'));var db=require(_0xa587('0x15'))['db'];function respondWithStatusCode(_0x36ff6a,_0x26f1f8){_0x26f1f8=_0x26f1f8||0xcc;return function(_0x1223da){if(_0x1223da){return _0x36ff6a[_0xa587('0x16')](_0x26f1f8);}return _0x36ff6a[_0xa587('0x17')](_0x26f1f8)['end']();};}function respondWithResult(_0x52a081,_0x34ba1b){_0x34ba1b=_0x34ba1b||0xc8;return function(_0x31f31c){if(_0x31f31c){return _0x52a081['status'](_0x34ba1b)[_0xa587('0x18')](_0x31f31c);}};}function respondWithFilteredResult(_0x3b87e3,_0x24603c){return function(_0x5a85bb){if(_0x5a85bb){var _0x25cf01=typeof _0x24603c[_0xa587('0x19')]==='undefined'&&typeof _0x24603c[_0xa587('0x1a')]===_0xa587('0x1b');var _0x4bfcb7=_0x5a85bb[_0xa587('0x1c')];var _0x32d3b2=_0x25cf01?0x0:_0x24603c[_0xa587('0x19')];var _0x25c40f=_0x25cf01?_0x5a85bb['count']:_0x24603c['offset']+_0x24603c[_0xa587('0x1a')];var _0x154181;if(_0x25c40f>=_0x4bfcb7){_0x25c40f=_0x4bfcb7;_0x154181=0xc8;}else{_0x154181=0xce;}_0x3b87e3[_0xa587('0x17')](_0x154181);return _0x3b87e3['set'](_0xa587('0x1d'),_0x32d3b2+'-'+_0x25c40f+'/'+_0x4bfcb7)[_0xa587('0x18')](_0x5a85bb);}return null;};}function patchUpdates(_0x2ec0fd){return function(_0x1bce5f){try{jsonpatch[_0xa587('0x1e')](_0x1bce5f,_0x2ec0fd,!![]);}catch(_0x2f3133){return BPromise['reject'](_0x2f3133);}return _0x1bce5f['save']();};}function saveUpdates(_0x163aa6,_0x5d9dbb){return function(_0x5e5226){if(_0x5e5226){return _0x5e5226[_0xa587('0x1f')](_0x163aa6)[_0xa587('0x20')](function(_0x10cf85){return _0x10cf85;});}return null;};}function removeEntity(_0x55361c,_0x3e5aa8){return function(_0x361c0c){if(_0x361c0c){return _0x361c0c[_0xa587('0x21')]()[_0xa587('0x20')](function(){var _0x161bf3=_0x361c0c[_0xa587('0x22')]({'plain':!![]});var _0x1c94ee=_0xa587('0x23');return db[_0xa587('0x24')]['destroy']({'where':{'type':_0x1c94ee,'resourceId':_0x161bf3['id']}})[_0xa587('0x20')](function(){return _0x361c0c;});})[_0xa587('0x20')](function(){_0x55361c['status'](0xcc)[_0xa587('0x25')]();});}};}function handleEntityNotFound(_0x5bff4d,_0x3b0bd4){return function(_0x271ab2){if(!_0x271ab2){_0x5bff4d[_0xa587('0x16')](0x194);}return _0x271ab2;};}function handleError(_0x59adf0,_0x2baf40){_0x2baf40=_0x2baf40||0x1f4;return function(_0x2439d5){logger[_0xa587('0x26')](_0x2439d5[_0xa587('0x27')]);if(_0x2439d5[_0xa587('0x28')]){delete _0x2439d5[_0xa587('0x28')];}_0x59adf0[_0xa587('0x17')](_0x2baf40)[_0xa587('0x29')](_0x2439d5);};}exports[_0xa587('0x2a')]=function(_0xc4565f,_0x2163db){var _0x230b21={},_0x42e95f={},_0x1712da={'count':0x0,'rows':[]};var _0x192d06=_[_0xa587('0x2b')](db[_0xa587('0x2c')][_0xa587('0x2d')],function(_0xa39a18){return{'name':_0xa39a18[_0xa587('0x2e')],'type':_0xa39a18[_0xa587('0x2f')][_0xa587('0x30')]};});_0x42e95f[_0xa587('0x31')]=_[_0xa587('0x2b')](_0x192d06,_0xa587('0x28'));_0x42e95f['query']=_[_0xa587('0x32')](_0xc4565f[_0xa587('0x33')]);_0x42e95f['filters']=_[_0xa587('0x34')](_0x42e95f[_0xa587('0x31')],_0x42e95f[_0xa587('0x33')]);_0x230b21[_0xa587('0x35')]=_[_0xa587('0x34')](_0x42e95f['model'],qs[_0xa587('0x36')](_0xc4565f['query'][_0xa587('0x36')]));_0x230b21['attributes']=_0x230b21[_0xa587('0x35')][_0xa587('0x37')]?_0x230b21[_0xa587('0x35')]:_0x42e95f['model'];if(!_0xc4565f[_0xa587('0x33')][_0xa587('0x38')](_0xa587('0x39'))){_0x230b21[_0xa587('0x1a')]=qs[_0xa587('0x1a')](_0xc4565f[_0xa587('0x33')]['limit']);_0x230b21[_0xa587('0x19')]=qs[_0xa587('0x19')](_0xc4565f[_0xa587('0x33')][_0xa587('0x19')]);}_0x230b21[_0xa587('0x3a')]=qs[_0xa587('0x3b')](_0xc4565f['query'][_0xa587('0x3b')]);_0x230b21[_0xa587('0x3c')]=qs[_0xa587('0x3d')](_[_0xa587('0x3e')](_0xc4565f[_0xa587('0x33')],_0x42e95f[_0xa587('0x3d')]),_0x192d06);if(_0xc4565f[_0xa587('0x33')][_0xa587('0x3f')]){_0x230b21['where']=_[_0xa587('0x40')](_0x230b21['where'],{'$or':[{'key':{'$like':'%'+_0xc4565f['query'][_0xa587('0x3f')]+'%'}},{'value':{'$like':'%'+_0xc4565f[_0xa587('0x33')]['filter']+'%'}}]});}_0x230b21=_[_0xa587('0x40')]({},_0x230b21,_0xc4565f[_0xa587('0x41')]);var _0x50e0e3={'where':_0x230b21[_0xa587('0x3c')]};return db[_0xa587('0x2c')]['count'](_0x50e0e3)[_0xa587('0x20')](function(_0x3e78ca){_0x1712da[_0xa587('0x1c')]=_0x3e78ca;if(_0xc4565f['query'][_0xa587('0x42')]){_0x230b21[_0xa587('0x43')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa587('0x44')](_0x230b21);})['then'](function(_0x18f797){_0x1712da[_0xa587('0x45')]=_0x18f797;return _0x1712da;})[_0xa587('0x20')](respondWithFilteredResult(_0x2163db,_0x230b21))[_0xa587('0x46')](handleError(_0x2163db,null));};exports[_0xa587('0x47')]=function(_0x75e07a,_0x3fbff5){var _0x17d0e7={'raw':!![],'where':{'id':_0x75e07a[_0xa587('0x48')]['id']}},_0x8f00a5={};_0x8f00a5['model']=_['keys'](db[_0xa587('0x2c')]['rawAttributes']);_0x8f00a5[_0xa587('0x33')]=_['keys'](_0x75e07a['query']);_0x8f00a5[_0xa587('0x3d')]=_[_0xa587('0x34')](_0x8f00a5['model'],_0x8f00a5[_0xa587('0x33')]);_0x17d0e7[_0xa587('0x35')]=_[_0xa587('0x34')](_0x8f00a5[_0xa587('0x31')],qs[_0xa587('0x36')](_0x75e07a[_0xa587('0x33')][_0xa587('0x36')]));_0x17d0e7[_0xa587('0x35')]=_0x17d0e7[_0xa587('0x35')][_0xa587('0x37')]?_0x17d0e7['attributes']:_0x8f00a5[_0xa587('0x31')];if(_0x75e07a[_0xa587('0x33')][_0xa587('0x42')]){_0x17d0e7['include']=[{'all':!![]}];}_0x17d0e7=_[_0xa587('0x40')]({},_0x17d0e7,_0x75e07a[_0xa587('0x41')]);return db[_0xa587('0x2c')][_0xa587('0x49')](_0x17d0e7)[_0xa587('0x20')](handleEntityNotFound(_0x3fbff5,null))[_0xa587('0x20')](respondWithResult(_0x3fbff5,null))[_0xa587('0x46')](handleError(_0x3fbff5,null));};exports[_0xa587('0x1f')]=function(_0x32877a,_0x5318f0){if(_0x32877a[_0xa587('0x4a')]['id']){delete _0x32877a[_0xa587('0x4a')]['id'];}return db[_0xa587('0x2c')][_0xa587('0x49')]({'where':{'id':_0x32877a[_0xa587('0x48')]['id']}})[_0xa587('0x20')](handleEntityNotFound(_0x5318f0,null))['then'](saveUpdates(_0x32877a[_0xa587('0x4a')],null))[_0xa587('0x20')](respondWithResult(_0x5318f0,null))['catch'](handleError(_0x5318f0,null));};exports[_0xa587('0x21')]=function(_0x3900d4,_0x10fd17){return db[_0xa587('0x2c')][_0xa587('0x49')]({'where':{'id':_0x3900d4[_0xa587('0x48')]['id']}})[_0xa587('0x20')](handleEntityNotFound(_0x10fd17,null))['then'](removeEntity(_0x10fd17,null))[_0xa587('0x46')](handleError(_0x10fd17,null));};exports[_0xa587('0x4b')]=function(_0x2152a5,_0x2b6010){var _0x2c62e3={'key':_0x2152a5[_0xa587('0x4a')][_0xa587('0x30')]};if(_0x2152a5[_0xa587('0x4a')]['MailAccountId']){_0x2c62e3[_0xa587('0x4c')]=_0x2152a5[_0xa587('0x4a')][_0xa587('0x4c')];}else if(_0x2152a5[_0xa587('0x4a')][_0xa587('0x4d')]){_0x2c62e3[_0xa587('0x4d')]=_0x2152a5['body'][_0xa587('0x4d')];}else if(_0x2152a5[_0xa587('0x4a')][_0xa587('0x4e')]){_0x2c62e3['OpenchannelAccountId']=_0x2152a5[_0xa587('0x4a')]['OpenchannelAccountId'];}else if(_0x2152a5[_0xa587('0x4a')][_0xa587('0x4f')]){_0x2c62e3[_0xa587('0x4f')]=_0x2152a5[_0xa587('0x4a')][_0xa587('0x4f')];}return db['CannedAnswer'][_0xa587('0x49')]({'where':_0x2c62e3})[_0xa587('0x20')](function(_0x4e080f){if(_0x4e080f){throw new db[(_0xa587('0x50'))][(_0xa587('0x51'))](_0xa587('0x52'));}return db[_0xa587('0x2c')][_0xa587('0x4b')](_0x2152a5[_0xa587('0x4a')]);})['then'](function(_0x27906a){var _0x199160=_0x2152a5[_0xa587('0x53')][_0xa587('0x22')]({'plain':!![]});if(!_0x199160)throw new Error(_0xa587('0x54'));if(_0x199160[_0xa587('0x55')]==='user'){var _0x3f28d3=_0x27906a['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xa587('0x23'),'userProfileId':_0x199160['userProfileId']},'raw':!![]})[_0xa587('0x20')](function(_0x13342b){if(_0x13342b&&_0x13342b[_0xa587('0x56')]===0x0){return db[_0xa587('0x24')][_0xa587('0x4b')]({'name':_0x3f28d3['name'],'resourceId':_0x3f28d3['id'],'type':_0x13342b[_0xa587('0x28')],'sectionId':_0x13342b['id']},{})[_0xa587('0x20')](function(){return _0x27906a;});}else{return _0x27906a;}})[_0xa587('0x46')](function(_0x1bba62){logger[_0xa587('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bba62);throw _0x1bba62;});}return _0x27906a;})[_0xa587('0x20')](respondWithResult(_0x2b6010,0xc9))[_0xa587('0x46')](handleError(_0x2b6010,null));};
\ No newline at end of file
+var _0x17f0=['user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','end','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','rows','catch','params','options','find','create','body','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0xda0e81,_0x4b01fe){var _0x4d8ae0=function(_0xb91f1c){while(--_0xb91f1c){_0xda0e81['push'](_0xda0e81['shift']());}};_0x4d8ae0(++_0x4b01fe);}(_0x17f0,0x10a));var _0x017f=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x17f0[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0x017f('0x0'));var rimraf=require(_0x017f('0x1'));var zipdir=require(_0x017f('0x2'));var jsonpatch=require(_0x017f('0x3'));var rp=require(_0x017f('0x4'));var moment=require(_0x017f('0x5'));var BPromise=require(_0x017f('0x6'));var Mustache=require('mustache');var util=require(_0x017f('0x7'));var path=require('path');var sox=require(_0x017f('0x8'));var csv=require(_0x017f('0x9'));var ejs=require(_0x017f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x017f('0xb'));var crypto=require('crypto');var jsforce=require(_0x017f('0xc'));var deskjs=require(_0x017f('0xd'));var toCsv=require(_0x017f('0x9'));var querystring=require(_0x017f('0xe'));var Papa=require('papaparse');var Redis=require(_0x017f('0xf'));var authService=require(_0x017f('0x10'));var qs=require(_0x017f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x017f('0x12'))(_0x017f('0x13'));var utils=require(_0x017f('0x14'));var config=require(_0x017f('0x15'));var licenseUtil=require(_0x017f('0x16'));var db=require(_0x017f('0x17'))['db'];function respondWithStatusCode(_0x5ac5b8,_0x2f2a40){_0x2f2a40=_0x2f2a40||0xcc;return function(_0x211e8e){if(_0x211e8e){return _0x5ac5b8[_0x017f('0x18')](_0x2f2a40);}return _0x5ac5b8[_0x017f('0x19')](_0x2f2a40)['end']();};}function respondWithResult(_0x287d7f,_0x410a66){_0x410a66=_0x410a66||0xc8;return function(_0x1d3c85){if(_0x1d3c85){return _0x287d7f[_0x017f('0x19')](_0x410a66)[_0x017f('0x1a')](_0x1d3c85);}};}function respondWithFilteredResult(_0x28eafd,_0x8e9a69){return function(_0x4adb1b){if(_0x4adb1b){var _0x55fac1=typeof _0x8e9a69[_0x017f('0x1b')]==='undefined'&&typeof _0x8e9a69[_0x017f('0x1c')]==='undefined';var _0x103424=_0x4adb1b[_0x017f('0x1d')];var _0x9b7596=_0x55fac1?0x0:_0x8e9a69[_0x017f('0x1b')];var _0x4b23a0=_0x55fac1?_0x4adb1b['count']:_0x8e9a69['offset']+_0x8e9a69['limit'];var _0x4dfb35;if(_0x4b23a0>=_0x103424){_0x4b23a0=_0x103424;_0x4dfb35=0xc8;}else{_0x4dfb35=0xce;}_0x28eafd['status'](_0x4dfb35);return _0x28eafd[_0x017f('0x1e')](_0x017f('0x1f'),_0x9b7596+'-'+_0x4b23a0+'/'+_0x103424)['json'](_0x4adb1b);}return null;};}function patchUpdates(_0x3bac28){return function(_0x16040b){try{jsonpatch['apply'](_0x16040b,_0x3bac28,!![]);}catch(_0x4ba9bb){return BPromise[_0x017f('0x20')](_0x4ba9bb);}return _0x16040b[_0x017f('0x21')]();};}function saveUpdates(_0x380051,_0x1e50c6){return function(_0x323a3b){if(_0x323a3b){return _0x323a3b[_0x017f('0x22')](_0x380051)[_0x017f('0x23')](function(_0x352643){return _0x352643;});}return null;};}function removeEntity(_0xc682ae,_0x4164e5){return function(_0x3dc0be){if(_0x3dc0be){return _0x3dc0be[_0x017f('0x24')]()['then'](function(){var _0x1c33ce=_0x3dc0be[_0x017f('0x25')]({'plain':!![]});var _0x446fed=_0x017f('0x26');return db[_0x017f('0x27')][_0x017f('0x24')]({'where':{'type':_0x446fed,'resourceId':_0x1c33ce['id']}})['then'](function(){return _0x3dc0be;});})[_0x017f('0x23')](function(){_0xc682ae[_0x017f('0x19')](0xcc)[_0x017f('0x28')]();});}};}function handleEntityNotFound(_0x259a3f,_0xa3ab81){return function(_0x1339f4){if(!_0x1339f4){_0x259a3f[_0x017f('0x18')](0x194);}return _0x1339f4;};}function handleError(_0x3bff71,_0x23ced7){_0x23ced7=_0x23ced7||0x1f4;return function(_0x290d21){logger['error'](_0x290d21['stack']);if(_0x290d21[_0x017f('0x29')]){delete _0x290d21[_0x017f('0x29')];}_0x3bff71['status'](_0x23ced7)[_0x017f('0x2a')](_0x290d21);};}exports[_0x017f('0x2b')]=function(_0x273bf5,_0x47a7b3){var _0x465659={},_0x1a8dcd={},_0x19d8bd={'count':0x0,'rows':[]};var _0x33dc26=_[_0x017f('0x2c')](db[_0x017f('0x2d')][_0x017f('0x2e')],function(_0x5d1dca){return{'name':_0x5d1dca[_0x017f('0x2f')],'type':_0x5d1dca[_0x017f('0x30')]['key']};});_0x1a8dcd[_0x017f('0x31')]=_[_0x017f('0x2c')](_0x33dc26,'name');_0x1a8dcd['query']=_[_0x017f('0x32')](_0x273bf5['query']);_0x1a8dcd[_0x017f('0x33')]=_[_0x017f('0x34')](_0x1a8dcd[_0x017f('0x31')],_0x1a8dcd['query']);_0x465659[_0x017f('0x35')]=_['intersection'](_0x1a8dcd[_0x017f('0x31')],qs[_0x017f('0x36')](_0x273bf5[_0x017f('0x37')][_0x017f('0x36')]));_0x465659['attributes']=_0x465659[_0x017f('0x35')][_0x017f('0x38')]?_0x465659[_0x017f('0x35')]:_0x1a8dcd[_0x017f('0x31')];if(!_0x273bf5[_0x017f('0x37')][_0x017f('0x39')]('nolimit')){_0x465659[_0x017f('0x1c')]=qs[_0x017f('0x1c')](_0x273bf5['query'][_0x017f('0x1c')]);_0x465659['offset']=qs[_0x017f('0x1b')](_0x273bf5[_0x017f('0x37')][_0x017f('0x1b')]);}_0x465659[_0x017f('0x3a')]=qs[_0x017f('0x3b')](_0x273bf5[_0x017f('0x37')]['sort']);_0x465659[_0x017f('0x3c')]=qs[_0x017f('0x33')](_[_0x017f('0x3d')](_0x273bf5['query'],_0x1a8dcd[_0x017f('0x33')]),_0x33dc26);if(_0x273bf5['query'][_0x017f('0x3e')]){_0x465659[_0x017f('0x3c')]=_[_0x017f('0x3f')](_0x465659[_0x017f('0x3c')],{'$or':[{'key':{'$like':'%'+_0x273bf5[_0x017f('0x37')][_0x017f('0x3e')]+'%'}},{'value':{'$like':'%'+_0x273bf5[_0x017f('0x37')][_0x017f('0x3e')]+'%'}}]});}_0x465659=_[_0x017f('0x3f')]({},_0x465659,_0x273bf5['options']);var _0x1e4aa0={'where':_0x465659[_0x017f('0x3c')]};return db['CannedAnswer'][_0x017f('0x1d')](_0x1e4aa0)[_0x017f('0x23')](function(_0x1495e4){_0x19d8bd[_0x017f('0x1d')]=_0x1495e4;if(_0x273bf5[_0x017f('0x37')][_0x017f('0x40')]){_0x465659['include']=[{'all':!![]}];}return db[_0x017f('0x2d')]['findAll'](_0x465659);})[_0x017f('0x23')](function(_0x4457d7){_0x19d8bd[_0x017f('0x41')]=_0x4457d7;return _0x19d8bd;})['then'](respondWithFilteredResult(_0x47a7b3,_0x465659))[_0x017f('0x42')](handleError(_0x47a7b3,null));};exports['show']=function(_0x266e2e,_0x16d3f8){var _0x2af0ea={'raw':!![],'where':{'id':_0x266e2e[_0x017f('0x43')]['id']}},_0x4714d0={};_0x4714d0[_0x017f('0x31')]=_[_0x017f('0x32')](db[_0x017f('0x2d')][_0x017f('0x2e')]);_0x4714d0[_0x017f('0x37')]=_[_0x017f('0x32')](_0x266e2e['query']);_0x4714d0[_0x017f('0x33')]=_[_0x017f('0x34')](_0x4714d0[_0x017f('0x31')],_0x4714d0[_0x017f('0x37')]);_0x2af0ea[_0x017f('0x35')]=_['intersection'](_0x4714d0['model'],qs[_0x017f('0x36')](_0x266e2e[_0x017f('0x37')][_0x017f('0x36')]));_0x2af0ea[_0x017f('0x35')]=_0x2af0ea[_0x017f('0x35')]['length']?_0x2af0ea['attributes']:_0x4714d0[_0x017f('0x31')];if(_0x266e2e[_0x017f('0x37')][_0x017f('0x40')]){_0x2af0ea['include']=[{'all':!![]}];}_0x2af0ea=_['merge']({},_0x2af0ea,_0x266e2e[_0x017f('0x44')]);return db[_0x017f('0x2d')]['find'](_0x2af0ea)['then'](handleEntityNotFound(_0x16d3f8,null))[_0x017f('0x23')](respondWithResult(_0x16d3f8,null))['catch'](handleError(_0x16d3f8,null));};exports[_0x017f('0x22')]=function(_0x2df569,_0x3abed0){if(_0x2df569['body']['id']){delete _0x2df569['body']['id'];}return db['CannedAnswer'][_0x017f('0x45')]({'where':{'id':_0x2df569[_0x017f('0x43')]['id']}})[_0x017f('0x23')](handleEntityNotFound(_0x3abed0,null))[_0x017f('0x23')](saveUpdates(_0x2df569['body'],null))[_0x017f('0x23')](respondWithResult(_0x3abed0,null))[_0x017f('0x42')](handleError(_0x3abed0,null));};exports[_0x017f('0x24')]=function(_0x55de0d,_0x4f8f41){return db[_0x017f('0x2d')][_0x017f('0x45')]({'where':{'id':_0x55de0d[_0x017f('0x43')]['id']}})[_0x017f('0x23')](handleEntityNotFound(_0x4f8f41,null))[_0x017f('0x23')](removeEntity(_0x4f8f41,null))['catch'](handleError(_0x4f8f41,null));};exports[_0x017f('0x46')]=function(_0xab8966,_0x419587){var _0x16aa36={'key':_0xab8966[_0x017f('0x47')][_0x017f('0x48')]};if(_0xab8966['body'][_0x017f('0x49')]){_0x16aa36['MailAccountId']=_0xab8966[_0x017f('0x47')][_0x017f('0x49')];}else if(_0xab8966[_0x017f('0x47')][_0x017f('0x4a')]){_0x16aa36[_0x017f('0x4a')]=_0xab8966[_0x017f('0x47')]['SmsAccountId'];}else if(_0xab8966[_0x017f('0x47')][_0x017f('0x4b')]){_0x16aa36[_0x017f('0x4b')]=_0xab8966[_0x017f('0x47')]['OpenchannelAccountId'];}else if(_0xab8966[_0x017f('0x47')][_0x017f('0x4c')]){_0x16aa36['ChatWebsiteId']=_0xab8966[_0x017f('0x47')]['ChatWebsiteId'];}return db[_0x017f('0x2d')][_0x017f('0x45')]({'where':_0x16aa36})[_0x017f('0x23')](function(_0x25a181){if(_0x25a181){throw new db[(_0x017f('0x4d'))][(_0x017f('0x4e'))](_0x017f('0x4f'));}return db[_0x017f('0x2d')][_0x017f('0x46')](_0xab8966[_0x017f('0x47')]);})[_0x017f('0x23')](function(_0x23e72c){var _0x321047=_0xab8966['user'][_0x017f('0x25')]({'plain':!![]});if(!_0x321047)throw new Error(_0x017f('0x50'));if(_0x321047[_0x017f('0x51')]===_0x017f('0x52')){var _0x3606ee=_0x23e72c[_0x017f('0x25')]({'plain':!![]});return db[_0x017f('0x53')][_0x017f('0x45')]({'where':{'name':_0x017f('0x26'),'userProfileId':_0x321047['userProfileId']},'raw':!![]})[_0x017f('0x23')](function(_0x2954e1){if(_0x2954e1&&_0x2954e1[_0x017f('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x3606ee['name'],'resourceId':_0x3606ee['id'],'type':_0x2954e1['name'],'sectionId':_0x2954e1['id']},{})[_0x017f('0x23')](function(){return _0x23e72c;});}else{return _0x23e72c;}})[_0x017f('0x42')](function(_0x448de3){logger[_0x017f('0x55')](_0x017f('0x56'),_0x448de3);throw _0x448de3;});}return _0x23e72c;})[_0x017f('0x23')](respondWithResult(_0x419587,0xc9))[_0x017f('0x42')](handleError(_0x419587,null));};
\ No newline at end of file
index de46df7..793d0ee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcffe=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcffe,0x1a1));var _0xecff=function(_0x1106f4,_0x36cfdb){_0x1106f4=_0x1106f4-0x0;var _0x383deb=_0xcffe[_0x1106f4];return _0x383deb;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var logger=require(_0xecff('0x2'))(_0xecff('0x3'));var moment=require(_0xecff('0x4'));var BPromise=require(_0xecff('0x5'));var rp=require(_0xecff('0x6'));var fs=require('fs');var path=require(_0xecff('0x7'));var rimraf=require(_0xecff('0x8'));var config=require(_0xecff('0x9'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x3020d9,_0x25572c){return _0x3020d9[_0xecff('0xa')](_0xecff('0xb'),attributes,{'tableName':_0xecff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xecff('0xd'),'collate':_0xecff('0xe')});};
\ No newline at end of file
+var _0xf966=['../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0xf966,0x13b));var _0x6f96=function(_0x145911,_0x28e50e){_0x145911=_0x145911-0x0;var _0x231948=_0xf966[_0x145911];return _0x231948;};'use strict';var _=require(_0x6f96('0x0'));var util=require(_0x6f96('0x1'));var logger=require(_0x6f96('0x2'))(_0x6f96('0x3'));var moment=require(_0x6f96('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f96('0x5'));var rimraf=require(_0x6f96('0x6'));var config=require(_0x6f96('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x6f96('0x8')]=function(_0x983699,_0x3c56d6){return _0x983699[_0x6f96('0x9')](_0x6f96('0xa'),attributes,{'tableName':_0x6f96('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6f96('0xc'),'collate':_0x6f96('0xd')});};
\ No newline at end of file
index d552914..c132c14 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x31966d,_0x32eb9e){var _0x25caab=function(_0x2ee30f){while(--_0x2ee30f){_0x31966d['push'](_0x31966d['shift']());}};_0x25caab(++_0x32eb9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}
\ No newline at end of file
+var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1a1cf8,_0x1f9779){var _0x28cf8b=function(_0x271c86){while(--_0x271c86){_0x1a1cf8['push'](_0x1a1cf8['shift']());}};_0x28cf8b(++_0x1f9779);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}
\ No newline at end of file
index 0a0fb81..b0dcaca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc0b6=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x1ceec9,_0x1ff6b3){var _0x4eff0d=function(_0x5a00c7){while(--_0x5a00c7){_0x1ceec9['push'](_0x1ceec9['shift']());}};_0x4eff0d(++_0x1ff6b3);}(_0xc0b6,0x1b3));var _0x6c0b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc0b6[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x6c0b('0x0'));var util=require(_0x6c0b('0x1'));var path=require(_0x6c0b('0x2'));var timeout=require(_0x6c0b('0x3'));var express=require(_0x6c0b('0x4'));var router=express[_0x6c0b('0x5')]();var fs_extra=require(_0x6c0b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6c0b('0x7'));var config=require(_0x6c0b('0x8'));var controller=require(_0x6c0b('0x9'));router['get']('/',auth[_0x6c0b('0xa')](),controller['index']);router[_0x6c0b('0xb')](_0x6c0b('0xc'),auth[_0x6c0b('0xa')](),controller[_0x6c0b('0xd')]);router[_0x6c0b('0xe')]('/',auth['isAuthenticated'](),controller[_0x6c0b('0xf')]);router[_0x6c0b('0x10')](_0x6c0b('0xc'),auth[_0x6c0b('0xa')](),controller[_0x6c0b('0x11')]);router[_0x6c0b('0x12')]('/:id',auth[_0x6c0b('0xa')](),controller['destroy']);module[_0x6c0b('0x13')]=router;
\ No newline at end of file
+var _0x8426=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x2b9d5c,_0x173518){var _0x37bb93=function(_0x5515cd){while(--_0x5515cd){_0x2b9d5c['push'](_0x2b9d5c['shift']());}};_0x37bb93(++_0x173518);}(_0x8426,0x1b7));var _0x6842=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x8426[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0x6842('0x0'));var util=require(_0x6842('0x1'));var path=require(_0x6842('0x2'));var timeout=require(_0x6842('0x3'));var express=require(_0x6842('0x4'));var router=express['Router']();var fs_extra=require(_0x6842('0x5'));var auth=require(_0x6842('0x6'));var interaction=require(_0x6842('0x7'));var config=require(_0x6842('0x8'));var controller=require(_0x6842('0x9'));router['get']('/',auth[_0x6842('0xa')](),controller[_0x6842('0xb')]);router[_0x6842('0xc')](_0x6842('0xd'),auth[_0x6842('0xa')](),controller[_0x6842('0xe')]);router[_0x6842('0xf')]('/',auth['isAuthenticated'](),controller[_0x6842('0x10')]);router['put']('/:id',auth[_0x6842('0xa')](),controller['update']);router['delete'](_0x6842('0xd'),auth[_0x6842('0xa')](),controller[_0x6842('0x11')]);module[_0x6842('0x12')]=router;
\ No newline at end of file
index 432fb8d..58f0380 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb5f8=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x2ae4ec,_0x25ade8){var _0x29bb18=function(_0x369e0c){while(--_0x369e0c){_0x2ae4ec['push'](_0x2ae4ec['shift']());}};_0x29bb18(++_0x25ade8);}(_0xb5f8,0x88));var _0x8b5f=function(_0x38e0d3,_0x235d33){_0x38e0d3=_0x38e0d3-0x0;var _0x50ef9b=_0xb5f8[_0x38e0d3];return _0x50ef9b;};'use strict';var Sequelize=require(_0x8b5f('0x0'));module[_0x8b5f('0x1')]={'calldate':{'type':Sequelize[_0x8b5f('0x2')],'allowNull':![],'defaultValue':_0x8b5f('0x3')},'clid':{'type':Sequelize[_0x8b5f('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x8b5f('0x4')]},'dcontext':{'type':Sequelize[_0x8b5f('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x8b5f('0x4')]},'lastapp':{'type':Sequelize[_0x8b5f('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x8b5f('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8b5f('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8b5f('0x4')]},'userfield':{'type':Sequelize[_0x8b5f('0x4')]},'uniqueid':{'type':Sequelize[_0x8b5f('0x4')]},'linkedid':{'type':Sequelize[_0x8b5f('0x4')]},'sequence':{'type':Sequelize[_0x8b5f('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8b5f('0x4')]},'tag':{'type':Sequelize[_0x8b5f('0x4')]}};
\ No newline at end of file
+var _0x0999=['1970-01-01\x2000:00:01','STRING','INTEGER','exports','DATE'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0x0999,0x85));var _0x9099=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0x0999[_0x170772];return _0x3ef69c;};'use strict';var Sequelize=require('sequelize');module[_0x9099('0x0')]={'calldate':{'type':Sequelize[_0x9099('0x1')],'allowNull':![],'defaultValue':_0x9099('0x2')},'clid':{'type':Sequelize[_0x9099('0x3')]},'src':{'type':Sequelize[_0x9099('0x3')]},'dst':{'type':Sequelize[_0x9099('0x3')]},'dcontext':{'type':Sequelize[_0x9099('0x3')]},'channel':{'type':Sequelize[_0x9099('0x3')]},'dstchannel':{'type':Sequelize[_0x9099('0x3')]},'lastapp':{'type':Sequelize[_0x9099('0x3')]},'lastdata':{'type':Sequelize[_0x9099('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9099('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9099('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9099('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x9099('0x3')]},'sequence':{'type':Sequelize[_0x9099('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9099('0x3')]},'tag':{'type':Sequelize[_0x9099('0x3')]}};
\ No newline at end of file
index 4be4dfc..97a4c0d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x25fa=['json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','Cdr','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25fa,0x109));var _0xa25f=function(_0x53df66,_0x36ac34){_0x53df66=_0x53df66-0x0;var _0x1421e8=_0x25fa[_0x53df66];return _0x1421e8;};'use strict';var emlformat=require(_0xa25f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa25f('0x1'));var jsonpatch=require(_0xa25f('0x2'));var rp=require('request-promise');var moment=require(_0xa25f('0x3'));var BPromise=require(_0xa25f('0x4'));var Mustache=require(_0xa25f('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa25f('0x6'));var csv=require('to-csv');var ejs=require(_0xa25f('0x7'));var fs=require('fs');var fs_extra=require(_0xa25f('0x8'));var _=require(_0xa25f('0x9'));var squel=require(_0xa25f('0xa'));var crypto=require(_0xa25f('0xb'));var jsforce=require(_0xa25f('0xc'));var deskjs=require(_0xa25f('0xd'));var toCsv=require(_0xa25f('0xe'));var querystring=require(_0xa25f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa25f('0x10'));var authService=require(_0xa25f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa25f('0x12'));var hardwareService=require(_0xa25f('0x13'));var logger=require(_0xa25f('0x14'))(_0xa25f('0x15'));var utils=require('../../config/utils');var config=require(_0xa25f('0x16'));var licenseUtil=require(_0xa25f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e970c,_0x465e41){_0x465e41=_0x465e41||0xcc;return function(_0x50bb78){if(_0x50bb78){return _0x3e970c[_0xa25f('0x18')](_0x465e41);}return _0x3e970c[_0xa25f('0x19')](_0x465e41)[_0xa25f('0x1a')]();};}function respondWithResult(_0x4b3792,_0x199e18){_0x199e18=_0x199e18||0xc8;return function(_0x2a627f){if(_0x2a627f){return _0x4b3792[_0xa25f('0x19')](_0x199e18)[_0xa25f('0x1b')](_0x2a627f);}};}function respondWithFilteredResult(_0x465809,_0x2d2417){return function(_0x1e5836){if(_0x1e5836){var _0x1859ba=typeof _0x2d2417['offset']===_0xa25f('0x1c')&&typeof _0x2d2417[_0xa25f('0x1d')]===_0xa25f('0x1c');var _0x451a6e=_0x1e5836[_0xa25f('0x1e')];var _0x427105=_0x1859ba?0x0:_0x2d2417['offset'];var _0x292171=_0x1859ba?_0x1e5836['count']:_0x2d2417[_0xa25f('0x1f')]+_0x2d2417['limit'];var _0x559c89;if(_0x292171>=_0x451a6e){_0x292171=_0x451a6e;_0x559c89=0xc8;}else{_0x559c89=0xce;}_0x465809[_0xa25f('0x19')](_0x559c89);return _0x465809['set'](_0xa25f('0x20'),_0x427105+'-'+_0x292171+'/'+_0x451a6e)[_0xa25f('0x1b')](_0x1e5836);}return null;};}function patchUpdates(_0x2aaf3a){return function(_0x3c2665){try{jsonpatch[_0xa25f('0x21')](_0x3c2665,_0x2aaf3a,!![]);}catch(_0x504135){return BPromise[_0xa25f('0x22')](_0x504135);}return _0x3c2665[_0xa25f('0x23')]();};}function saveUpdates(_0x371716,_0x14b7f6){return function(_0x5d2803){if(_0x5d2803){return _0x5d2803[_0xa25f('0x24')](_0x371716)[_0xa25f('0x25')](function(_0x248c0c){return _0x248c0c;});}return null;};}function removeEntity(_0x3675b5,_0x4c6f4d){return function(_0x2b710f){if(_0x2b710f){return _0x2b710f[_0xa25f('0x26')]()[_0xa25f('0x25')](function(){_0x3675b5[_0xa25f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2812d7,_0x898446){return function(_0x53f011){if(!_0x53f011){_0x2812d7[_0xa25f('0x18')](0x194);}return _0x53f011;};}function handleError(_0x51dbf8,_0x2df893){_0x2df893=_0x2df893||0x1f4;return function(_0x4eb7b7){logger[_0xa25f('0x27')](_0x4eb7b7[_0xa25f('0x28')]);if(_0x4eb7b7['name']){delete _0x4eb7b7[_0xa25f('0x29')];}_0x51dbf8[_0xa25f('0x19')](_0x2df893)['send'](_0x4eb7b7);};}exports[_0xa25f('0x2a')]=function(_0x5d39c7,_0x1030c4){var _0x41a847={},_0x472114={},_0x208518={'count':0x0,'rows':[]};var _0x334629=_['map'](db[_0xa25f('0x2b')][_0xa25f('0x2c')],function(_0x119ffc){return{'name':_0x119ffc[_0xa25f('0x2d')],'type':_0x119ffc[_0xa25f('0x2e')]['key']};});_0x472114[_0xa25f('0x2f')]=_[_0xa25f('0x30')](_0x334629,_0xa25f('0x29'));_0x472114[_0xa25f('0x31')]=_[_0xa25f('0x32')](_0x5d39c7[_0xa25f('0x31')]);_0x472114[_0xa25f('0x33')]=_[_0xa25f('0x34')](_0x472114[_0xa25f('0x2f')],_0x472114['query']);_0x41a847['attributes']=_['intersection'](_0x472114[_0xa25f('0x2f')],qs[_0xa25f('0x35')](_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x35')]));_0x41a847[_0xa25f('0x36')]=_0x41a847[_0xa25f('0x36')][_0xa25f('0x37')]?_0x41a847[_0xa25f('0x36')]:_0x472114[_0xa25f('0x2f')];if(!_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x38')]('nolimit')){_0x41a847['limit']=qs[_0xa25f('0x1d')](_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x1d')]);_0x41a847['offset']=qs['offset'](_0x5d39c7['query'][_0xa25f('0x1f')]);}_0x41a847[_0xa25f('0x39')]=qs[_0xa25f('0x3a')](_0x5d39c7['query']['sort']);_0x41a847[_0xa25f('0x3b')]=qs[_0xa25f('0x33')](_['pick'](_0x5d39c7['query'],_0x472114[_0xa25f('0x33')]),_0x334629);if(_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x3c')]){_0x41a847['where']=_[_0xa25f('0x3d')](_0x41a847[_0xa25f('0x3b')],{'$or':_[_0xa25f('0x30')](_0x334629,function(_0x49556e){if(_0x49556e['type']!==_0xa25f('0x3e')){var _0x44c9c8={};_0x44c9c8[_0x49556e[_0xa25f('0x29')]]={'$like':'%'+_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x3c')]+'%'};return _0x44c9c8;}})});}_0x41a847=_[_0xa25f('0x3d')]({},_0x41a847,_0x5d39c7[_0xa25f('0x3f')]);var _0x3382f4={'where':_0x41a847['where']};return db[_0xa25f('0x2b')][_0xa25f('0x1e')](_0x3382f4)[_0xa25f('0x25')](function(_0x2e886f){_0x208518[_0xa25f('0x1e')]=_0x2e886f;if(_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x40')]){_0x41a847[_0xa25f('0x41')]=[{'all':!![]}];}return db[_0xa25f('0x2b')][_0xa25f('0x42')](_0x41a847);})[_0xa25f('0x25')](function(_0x3267a0){_0x208518[_0xa25f('0x43')]=_0x3267a0;return _0x208518;})['then'](respondWithFilteredResult(_0x1030c4,_0x41a847))[_0xa25f('0x44')](handleError(_0x1030c4,null));};exports['show']=function(_0xace015,_0x320119){var _0x36afe4={'raw':!![],'where':{'id':_0xace015[_0xa25f('0x45')]['id']}},_0x559874={};_0x559874[_0xa25f('0x2f')]=_[_0xa25f('0x32')](db[_0xa25f('0x2b')]['rawAttributes']);_0x559874[_0xa25f('0x31')]=_[_0xa25f('0x32')](_0xace015[_0xa25f('0x31')]);_0x559874[_0xa25f('0x33')]=_[_0xa25f('0x34')](_0x559874[_0xa25f('0x2f')],_0x559874['query']);_0x36afe4[_0xa25f('0x36')]=_[_0xa25f('0x34')](_0x559874['model'],qs[_0xa25f('0x35')](_0xace015[_0xa25f('0x31')][_0xa25f('0x35')]));_0x36afe4[_0xa25f('0x36')]=_0x36afe4[_0xa25f('0x36')][_0xa25f('0x37')]?_0x36afe4[_0xa25f('0x36')]:_0x559874[_0xa25f('0x2f')];if(_0xace015[_0xa25f('0x31')][_0xa25f('0x40')]){_0x36afe4[_0xa25f('0x41')]=[{'all':!![]}];}_0x36afe4=_[_0xa25f('0x3d')]({},_0x36afe4,_0xace015[_0xa25f('0x3f')]);return db['Cdr'][_0xa25f('0x46')](_0x36afe4)[_0xa25f('0x25')](handleEntityNotFound(_0x320119,null))[_0xa25f('0x25')](respondWithResult(_0x320119,null))[_0xa25f('0x44')](handleError(_0x320119,null));};exports['create']=function(_0x34717c,_0x43888b){return db[_0xa25f('0x2b')]['create'](_0x34717c[_0xa25f('0x47')],{})[_0xa25f('0x25')](respondWithResult(_0x43888b,0xc9))[_0xa25f('0x44')](handleError(_0x43888b,null));};exports[_0xa25f('0x24')]=function(_0x18c9f2,_0x3b6d34){if(_0x18c9f2[_0xa25f('0x47')]['id']){delete _0x18c9f2[_0xa25f('0x47')]['id'];}return db['Cdr'][_0xa25f('0x46')]({'where':{'id':_0x18c9f2[_0xa25f('0x45')]['id']}})[_0xa25f('0x25')](handleEntityNotFound(_0x3b6d34,null))[_0xa25f('0x25')](saveUpdates(_0x18c9f2[_0xa25f('0x47')],null))[_0xa25f('0x25')](respondWithResult(_0x3b6d34,null))[_0xa25f('0x44')](handleError(_0x3b6d34,null));};exports[_0xa25f('0x26')]=function(_0x26a096,_0xe04d67){return db[_0xa25f('0x2b')][_0xa25f('0x46')]({'where':{'id':_0x26a096[_0xa25f('0x45')]['id']}})[_0xa25f('0x25')](handleEntityNotFound(_0xe04d67,null))[_0xa25f('0x25')](removeEntity(_0xe04d67,null))[_0xa25f('0x44')](handleError(_0xe04d67,null));};exports[_0xa25f('0x48')]=function(_0x2fedba,_0x32f719){return db[_0xa25f('0x2b')][_0xa25f('0x48')]()[_0xa25f('0x25')](respondWithResult(_0x32f719,null))['catch'](handleError(_0x32f719,null));};
\ No newline at end of file
+var _0xdd0c=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','then','includeAll','findAll','rows','catch','show','length','include','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1d77c8,_0x474bcf){var _0x3efd70=function(_0x116fa5){while(--_0x116fa5){_0x1d77c8['push'](_0x1d77c8['shift']());}};_0x3efd70(++_0x474bcf);}(_0xdd0c,0x165));var _0xcdd0=function(_0x454955,_0x2a3f20){_0x454955=_0x454955-0x0;var _0x2b4b58=_0xdd0c[_0x454955];return _0x2b4b58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdd0('0x0'));var zipdir=require(_0xcdd0('0x1'));var jsonpatch=require(_0xcdd0('0x2'));var rp=require('request-promise');var moment=require(_0xcdd0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcdd0('0x4'));var util=require(_0xcdd0('0x5'));var path=require(_0xcdd0('0x6'));var sox=require(_0xcdd0('0x7'));var csv=require(_0xcdd0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdd0('0x9'));var _=require(_0xcdd0('0xa'));var squel=require(_0xcdd0('0xb'));var crypto=require(_0xcdd0('0xc'));var jsforce=require(_0xcdd0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcdd0('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcdd0('0xe'));var authService=require(_0xcdd0('0xf'));var qs=require(_0xcdd0('0x10'));var as=require(_0xcdd0('0x11'));var hardwareService=require(_0xcdd0('0x12'));var logger=require(_0xcdd0('0x13'))(_0xcdd0('0x14'));var utils=require(_0xcdd0('0x15'));var config=require(_0xcdd0('0x16'));var licenseUtil=require(_0xcdd0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a1ff6,_0x356501){_0x356501=_0x356501||0xcc;return function(_0x14c775){if(_0x14c775){return _0x4a1ff6['sendStatus'](_0x356501);}return _0x4a1ff6[_0xcdd0('0x18')](_0x356501)[_0xcdd0('0x19')]();};}function respondWithResult(_0x4f4aa4,_0x1fc89a){_0x1fc89a=_0x1fc89a||0xc8;return function(_0x1d5bff){if(_0x1d5bff){return _0x4f4aa4[_0xcdd0('0x18')](_0x1fc89a)[_0xcdd0('0x1a')](_0x1d5bff);}};}function respondWithFilteredResult(_0xc1c3d5,_0x52aef5){return function(_0x5b5c06){if(_0x5b5c06){var _0x189f54=typeof _0x52aef5[_0xcdd0('0x1b')]===_0xcdd0('0x1c')&&typeof _0x52aef5[_0xcdd0('0x1d')]===_0xcdd0('0x1c');var _0x3b07a1=_0x5b5c06[_0xcdd0('0x1e')];var _0x2c199f=_0x189f54?0x0:_0x52aef5[_0xcdd0('0x1b')];var _0x14d55b=_0x189f54?_0x5b5c06['count']:_0x52aef5[_0xcdd0('0x1b')]+_0x52aef5[_0xcdd0('0x1d')];var _0x5060fa;if(_0x14d55b>=_0x3b07a1){_0x14d55b=_0x3b07a1;_0x5060fa=0xc8;}else{_0x5060fa=0xce;}_0xc1c3d5['status'](_0x5060fa);return _0xc1c3d5[_0xcdd0('0x1f')](_0xcdd0('0x20'),_0x2c199f+'-'+_0x14d55b+'/'+_0x3b07a1)['json'](_0x5b5c06);}return null;};}function patchUpdates(_0x12128e){return function(_0x4f7325){try{jsonpatch['apply'](_0x4f7325,_0x12128e,!![]);}catch(_0x4d038f){return BPromise[_0xcdd0('0x21')](_0x4d038f);}return _0x4f7325[_0xcdd0('0x22')]();};}function saveUpdates(_0x4afcfa,_0x2ab7e4){return function(_0x31a3e6){if(_0x31a3e6){return _0x31a3e6[_0xcdd0('0x23')](_0x4afcfa)['then'](function(_0x9d4727){return _0x9d4727;});}return null;};}function removeEntity(_0x7be0ac,_0x509e9c){return function(_0x3c81b1){if(_0x3c81b1){return _0x3c81b1[_0xcdd0('0x24')]()['then'](function(){_0x7be0ac[_0xcdd0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3797c2,_0x64b52){return function(_0x476018){if(!_0x476018){_0x3797c2['sendStatus'](0x194);}return _0x476018;};}function handleError(_0x22fd47,_0x10cba2){_0x10cba2=_0x10cba2||0x1f4;return function(_0x5e5cc){logger[_0xcdd0('0x25')](_0x5e5cc[_0xcdd0('0x26')]);if(_0x5e5cc[_0xcdd0('0x27')]){delete _0x5e5cc[_0xcdd0('0x27')];}_0x22fd47[_0xcdd0('0x18')](_0x10cba2)[_0xcdd0('0x28')](_0x5e5cc);};}exports[_0xcdd0('0x29')]=function(_0x4074e0,_0x49cfe0){var _0x28084c={},_0xd6d64f={},_0x1bbe37={'count':0x0,'rows':[]};var _0x5b8635=_[_0xcdd0('0x2a')](db[_0xcdd0('0x2b')][_0xcdd0('0x2c')],function(_0x477d1a){return{'name':_0x477d1a[_0xcdd0('0x2d')],'type':_0x477d1a['type'][_0xcdd0('0x2e')]};});_0xd6d64f[_0xcdd0('0x2f')]=_[_0xcdd0('0x2a')](_0x5b8635,'name');_0xd6d64f['query']=_[_0xcdd0('0x30')](_0x4074e0[_0xcdd0('0x31')]);_0xd6d64f[_0xcdd0('0x32')]=_['intersection'](_0xd6d64f[_0xcdd0('0x2f')],_0xd6d64f[_0xcdd0('0x31')]);_0x28084c['attributes']=_[_0xcdd0('0x33')](_0xd6d64f[_0xcdd0('0x2f')],qs[_0xcdd0('0x34')](_0x4074e0[_0xcdd0('0x31')]['fields']));_0x28084c[_0xcdd0('0x35')]=_0x28084c[_0xcdd0('0x35')]['length']?_0x28084c[_0xcdd0('0x35')]:_0xd6d64f[_0xcdd0('0x2f')];if(!_0x4074e0[_0xcdd0('0x31')][_0xcdd0('0x36')]('nolimit')){_0x28084c[_0xcdd0('0x1d')]=qs[_0xcdd0('0x1d')](_0x4074e0[_0xcdd0('0x31')][_0xcdd0('0x1d')]);_0x28084c[_0xcdd0('0x1b')]=qs['offset'](_0x4074e0[_0xcdd0('0x31')]['offset']);}_0x28084c['order']=qs['sort'](_0x4074e0[_0xcdd0('0x31')][_0xcdd0('0x37')]);_0x28084c[_0xcdd0('0x38')]=qs[_0xcdd0('0x32')](_[_0xcdd0('0x39')](_0x4074e0[_0xcdd0('0x31')],_0xd6d64f[_0xcdd0('0x32')]),_0x5b8635);if(_0x4074e0['query'][_0xcdd0('0x3a')]){_0x28084c[_0xcdd0('0x38')]=_[_0xcdd0('0x3b')](_0x28084c[_0xcdd0('0x38')],{'$or':_['map'](_0x5b8635,function(_0x4934a5){if(_0x4934a5[_0xcdd0('0x3c')]!==_0xcdd0('0x3d')){var _0x47a5f5={};_0x47a5f5[_0x4934a5[_0xcdd0('0x27')]]={'$like':'%'+_0x4074e0[_0xcdd0('0x31')]['filter']+'%'};return _0x47a5f5;}})});}_0x28084c=_[_0xcdd0('0x3b')]({},_0x28084c,_0x4074e0['options']);var _0x41ce22={'where':_0x28084c['where']};return db[_0xcdd0('0x2b')][_0xcdd0('0x1e')](_0x41ce22)[_0xcdd0('0x3e')](function(_0x271f47){_0x1bbe37['count']=_0x271f47;if(_0x4074e0[_0xcdd0('0x31')][_0xcdd0('0x3f')]){_0x28084c['include']=[{'all':!![]}];}return db[_0xcdd0('0x2b')][_0xcdd0('0x40')](_0x28084c);})[_0xcdd0('0x3e')](function(_0x27ce74){_0x1bbe37[_0xcdd0('0x41')]=_0x27ce74;return _0x1bbe37;})[_0xcdd0('0x3e')](respondWithFilteredResult(_0x49cfe0,_0x28084c))[_0xcdd0('0x42')](handleError(_0x49cfe0,null));};exports[_0xcdd0('0x43')]=function(_0x375e89,_0xce8a50){var _0x5f0c94={'raw':!![],'where':{'id':_0x375e89['params']['id']}},_0x2718b3={};_0x2718b3['model']=_[_0xcdd0('0x30')](db['Cdr'][_0xcdd0('0x2c')]);_0x2718b3[_0xcdd0('0x31')]=_[_0xcdd0('0x30')](_0x375e89[_0xcdd0('0x31')]);_0x2718b3[_0xcdd0('0x32')]=_['intersection'](_0x2718b3[_0xcdd0('0x2f')],_0x2718b3['query']);_0x5f0c94['attributes']=_[_0xcdd0('0x33')](_0x2718b3[_0xcdd0('0x2f')],qs['fields'](_0x375e89['query']['fields']));_0x5f0c94[_0xcdd0('0x35')]=_0x5f0c94[_0xcdd0('0x35')][_0xcdd0('0x44')]?_0x5f0c94['attributes']:_0x2718b3[_0xcdd0('0x2f')];if(_0x375e89[_0xcdd0('0x31')][_0xcdd0('0x3f')]){_0x5f0c94[_0xcdd0('0x45')]=[{'all':!![]}];}_0x5f0c94=_[_0xcdd0('0x3b')]({},_0x5f0c94,_0x375e89['options']);return db[_0xcdd0('0x2b')]['find'](_0x5f0c94)[_0xcdd0('0x3e')](handleEntityNotFound(_0xce8a50,null))[_0xcdd0('0x3e')](respondWithResult(_0xce8a50,null))[_0xcdd0('0x42')](handleError(_0xce8a50,null));};exports[_0xcdd0('0x46')]=function(_0x265cfb,_0x2fc567){return db[_0xcdd0('0x2b')][_0xcdd0('0x46')](_0x265cfb[_0xcdd0('0x47')],{})[_0xcdd0('0x3e')](respondWithResult(_0x2fc567,0xc9))[_0xcdd0('0x42')](handleError(_0x2fc567,null));};exports[_0xcdd0('0x23')]=function(_0x3afae8,_0x6c2cb8){if(_0x3afae8[_0xcdd0('0x47')]['id']){delete _0x3afae8['body']['id'];}return db[_0xcdd0('0x2b')][_0xcdd0('0x48')]({'where':{'id':_0x3afae8[_0xcdd0('0x49')]['id']}})[_0xcdd0('0x3e')](handleEntityNotFound(_0x6c2cb8,null))[_0xcdd0('0x3e')](saveUpdates(_0x3afae8[_0xcdd0('0x47')],null))[_0xcdd0('0x3e')](respondWithResult(_0x6c2cb8,null))[_0xcdd0('0x42')](handleError(_0x6c2cb8,null));};exports[_0xcdd0('0x24')]=function(_0x214cdd,_0x36156c){return db[_0xcdd0('0x2b')][_0xcdd0('0x48')]({'where':{'id':_0x214cdd[_0xcdd0('0x49')]['id']}})['then'](handleEntityNotFound(_0x36156c,null))[_0xcdd0('0x3e')](removeEntity(_0x36156c,null))[_0xcdd0('0x42')](handleError(_0x36156c,null));};exports[_0xcdd0('0x4a')]=function(_0xc7370e,_0x46c578){return db[_0xcdd0('0x2b')][_0xcdd0('0x4a')]()['then'](respondWithResult(_0x46c578,null))[_0xcdd0('0x42')](handleError(_0x46c578,null));};
\ No newline at end of file
index 5344651..d74af18 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x55c325,_0x3a37a0){var _0x219ebf=function(_0x16281b){while(--_0x16281b){_0x55c325['push'](_0x55c325['shift']());}};_0x219ebf(++_0x3a37a0);}(_0x7a54,0x106));var _0x47a5=function(_0x3b1b20,_0x592ec0){_0x3b1b20=_0x3b1b20-0x0;var _0x5cd3e1=_0x7a54[_0x3b1b20];return _0x5cd3e1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});};
\ No newline at end of file
+var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4f135f,_0x8be2b7){var _0x43ea2f=function(_0x42a037){while(--_0x42a037){_0x4f135f['push'](_0x4f135f['shift']());}};_0x43ea2f(++_0x8be2b7);}(_0x7a54,0x106));var _0x47a5=function(_0xd8bc66,_0x3821a3){_0xd8bc66=_0xd8bc66-0x0;var _0x5bc12c=_0x7a54[_0xd8bc66];return _0x5bc12c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});};
\ No newline at end of file
index 401e4fb..7ee6b5d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa226=['info','Cdr,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x32ff28,_0xcaa095){var _0x2b8b72=function(_0x4e8707){while(--_0x4e8707){_0x32ff28['push'](_0x32ff28['shift']());}};_0x2b8b72(++_0xcaa095);}(_0xa226,0x1e8));var _0x6a22=function(_0x1e2eaf,_0x25fb28){_0x1e2eaf=_0x1e2eaf-0x0;var _0x55f9bb=_0xa226[_0x1e2eaf];return _0x55f9bb;};'use strict';var _=require('lodash');var util=require(_0x6a22('0x0'));var moment=require(_0x6a22('0x1'));var BPromise=require(_0x6a22('0x2'));var rs=require(_0x6a22('0x3'));var fs=require('fs');var Redis=require(_0x6a22('0x4'));var db=require(_0x6a22('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6a22('0x6'));var config=require(_0x6a22('0x7'));var jayson=require(_0x6a22('0x8'));var client=jayson[_0x6a22('0x9')][_0x6a22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x122bd2,_0x328fff,_0x77f5e5){return new BPromise(function(_0x4c32b2,_0x6eac9d){return client['request'](_0x122bd2,_0x77f5e5)[_0x6a22('0xb')](function(_0x309a1f){logger[_0x6a22('0xc')](_0x6a22('0xd'),_0x328fff,_0x6a22('0xe'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x328fff,_0x6a22('0xe'),JSON[_0x6a22('0xf')](_0x309a1f));if(_0x309a1f[_0x6a22('0x10')]){if(_0x309a1f[_0x6a22('0x10')]['code']===0x1f4){logger['error'](_0x6a22('0xd'),_0x328fff,_0x309a1f[_0x6a22('0x10')]['message']);return _0x6eac9d(_0x309a1f[_0x6a22('0x10')][_0x6a22('0x11')]);}logger[_0x6a22('0x10')](_0x6a22('0xd'),_0x328fff,_0x309a1f[_0x6a22('0x10')][_0x6a22('0x11')]);return _0x4c32b2(_0x309a1f[_0x6a22('0x10')][_0x6a22('0x11')]);}else{logger[_0x6a22('0xc')](_0x6a22('0xd'),_0x328fff,_0x6a22('0xe'));_0x4c32b2(_0x309a1f[_0x6a22('0x12')][_0x6a22('0x11')]);}})[_0x6a22('0x13')](function(_0x2b4406){logger[_0x6a22('0x10')](_0x6a22('0xd'),_0x328fff,_0x2b4406);_0x6eac9d(_0x2b4406);});});}
\ No newline at end of file
+var _0x0240=['then','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x179775,_0x403b57){var _0x17ee82=function(_0xea75ea){while(--_0xea75ea){_0x179775['push'](_0x179775['shift']());}};_0x17ee82(++_0x403b57);}(_0x0240,0x1c2));var _0x0024=function(_0x2f520e,_0x308bfc){_0x2f520e=_0x2f520e-0x0;var _0x5d0c86=_0x0240[_0x2f520e];return _0x5d0c86;};'use strict';var _=require(_0x0024('0x0'));var util=require(_0x0024('0x1'));var moment=require(_0x0024('0x2'));var BPromise=require(_0x0024('0x3'));var rs=require(_0x0024('0x4'));var fs=require('fs');var Redis=require(_0x0024('0x5'));var db=require(_0x0024('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0024('0x7'))('rpc');var config=require(_0x0024('0x8'));var jayson=require(_0x0024('0x9'));var client=jayson['client'][_0x0024('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2218a8,_0x244371,_0x236dd8){return new BPromise(function(_0x50056e,_0x37333d){return client[_0x0024('0xb')](_0x2218a8,_0x236dd8)[_0x0024('0xc')](function(_0xf88798){logger[_0x0024('0xd')]('Cdr,\x20%s,\x20%s',_0x244371,_0x0024('0xe'));logger['debug'](_0x0024('0xf'),_0x244371,_0x0024('0xe'),JSON['stringify'](_0xf88798));if(_0xf88798[_0x0024('0x10')]){if(_0xf88798['error'][_0x0024('0x11')]===0x1f4){logger[_0x0024('0x10')](_0x0024('0x12'),_0x244371,_0xf88798[_0x0024('0x10')][_0x0024('0x13')]);return _0x37333d(_0xf88798[_0x0024('0x10')][_0x0024('0x13')]);}logger[_0x0024('0x10')](_0x0024('0x12'),_0x244371,_0xf88798[_0x0024('0x10')][_0x0024('0x13')]);return _0x50056e(_0xf88798[_0x0024('0x10')][_0x0024('0x13')]);}else{logger[_0x0024('0xd')](_0x0024('0x12'),_0x244371,_0x0024('0xe'));_0x50056e(_0xf88798[_0x0024('0x14')][_0x0024('0x13')]);}})[_0x0024('0x15')](function(_0x30176c){logger[_0x0024('0x10')]('Cdr,\x20%s,\x20%s',_0x244371,_0x30176c);_0x37333d(_0x30176c);});});}
\ No newline at end of file
index e82cd72..3b480ac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x57112d,_0x9ea573){var _0x3c32b9=function(_0x349dda){while(--_0x349dda){_0x57112d['push'](_0x57112d['shift']());}};_0x3c32b9(++_0x9ea573);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router;
\ No newline at end of file
+var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router;
\ No newline at end of file
index f73eda8..b991d56 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xab78=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x51e5bd,_0x3c2cf1){var _0x250aed=function(_0x17120c){while(--_0x17120c){_0x51e5bd['push'](_0x51e5bd['shift']());}};_0x250aed(++_0x3c2cf1);}(_0xab78,0x1c8));var _0x8ab7=function(_0x11ce82,_0x373b3a){_0x11ce82=_0x11ce82-0x0;var _0x403c5f=_0xab78[_0x11ce82];return _0x403c5f;};'use strict';var Sequelize=require(_0x8ab7('0x0'));module[_0x8ab7('0x1')]={'priority':{'type':Sequelize[_0x8ab7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8ab7('0x3')],'allowNull':![],'defaultValue':_0x8ab7('0x4')},'appdata':{'type':Sequelize[_0x8ab7('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8ab7('0x3')],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
+var _0x4eea=['TEXT','*,*,*,*','STRING'];(function(_0x3b69d5,_0x33342d){var _0x171a24=function(_0x260c87){while(--_0x260c87){_0x3b69d5['push'](_0x3b69d5['shift']());}};_0x171a24(++_0x33342d);}(_0x4eea,0x1e2));var _0xa4ee=function(_0x4e74aa,_0x41cc64){_0x4e74aa=_0x4e74aa-0x0;var _0x16171f=_0x4eea[_0x4e74aa];return _0x16171f;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa4ee('0x0')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa4ee('0x1')]()},'description':{'type':Sequelize[_0xa4ee('0x0')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa4ee('0x2')}};
\ No newline at end of file
index 224e824..58bb83e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd957=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','save','then','destroy','error','name','show','params','model','keys','ChatApplication','rawAttributes','filters','query','attributes','intersection','fields','length','includeAll','include','find','catch','update','body','eml-format','rimraf','fast-json-patch'];(function(_0x2ac138,_0x474f92){var _0x23ac21=function(_0x5c4aab){while(--_0x5c4aab){_0x2ac138['push'](_0x2ac138['shift']());}};_0x23ac21(++_0x474f92);}(_0xd957,0x153));var _0x7d95=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd957[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x7d95('0x0'));var rimraf=require(_0x7d95('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7d95('0x2'));var rp=require(_0x7d95('0x3'));var moment=require('moment');var BPromise=require(_0x7d95('0x4'));var Mustache=require(_0x7d95('0x5'));var util=require(_0x7d95('0x6'));var path=require(_0x7d95('0x7'));var sox=require(_0x7d95('0x8'));var csv=require(_0x7d95('0x9'));var ejs=require(_0x7d95('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d95('0xb'));var squel=require(_0x7d95('0xc'));var crypto=require('crypto');var jsforce=require(_0x7d95('0xd'));var deskjs=require(_0x7d95('0xe'));var toCsv=require(_0x7d95('0x9'));var querystring=require(_0x7d95('0xf'));var Papa=require(_0x7d95('0x10'));var Redis=require('ioredis');var authService=require(_0x7d95('0x11'));var qs=require(_0x7d95('0x12'));var as=require(_0x7d95('0x13'));var hardwareService=require(_0x7d95('0x14'));var logger=require(_0x7d95('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x7d95('0x16'));var licenseUtil=require(_0x7d95('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8aea6,_0x1d6b13){_0x1d6b13=_0x1d6b13||0xcc;return function(_0x310657){if(_0x310657){return _0x8aea6[_0x7d95('0x18')](_0x1d6b13);}return _0x8aea6[_0x7d95('0x19')](_0x1d6b13)[_0x7d95('0x1a')]();};}function respondWithResult(_0x4da709,_0x82ac5f){_0x82ac5f=_0x82ac5f||0xc8;return function(_0x56e18f){if(_0x56e18f){return _0x4da709[_0x7d95('0x19')](_0x82ac5f)['json'](_0x56e18f);}};}function respondWithFilteredResult(_0x9b5091,_0x4f333d){return function(_0x3b519a){if(_0x3b519a){var _0x30c2f8=typeof _0x4f333d[_0x7d95('0x1b')]===_0x7d95('0x1c')&&typeof _0x4f333d['limit']==='undefined';var _0x186198=_0x3b519a[_0x7d95('0x1d')];var _0x7aded7=_0x30c2f8?0x0:_0x4f333d[_0x7d95('0x1b')];var _0x57197c=_0x30c2f8?_0x3b519a[_0x7d95('0x1d')]:_0x4f333d[_0x7d95('0x1b')]+_0x4f333d['limit'];var _0x3c264b;if(_0x57197c>=_0x186198){_0x57197c=_0x186198;_0x3c264b=0xc8;}else{_0x3c264b=0xce;}_0x9b5091[_0x7d95('0x19')](_0x3c264b);return _0x9b5091[_0x7d95('0x1e')](_0x7d95('0x1f'),_0x7aded7+'-'+_0x57197c+'/'+_0x186198)[_0x7d95('0x20')](_0x3b519a);}return null;};}function patchUpdates(_0x1a058c){return function(_0x3ae23a){try{jsonpatch[_0x7d95('0x21')](_0x3ae23a,_0x1a058c,!![]);}catch(_0x46da03){return BPromise['reject'](_0x46da03);}return _0x3ae23a[_0x7d95('0x22')]();};}function saveUpdates(_0x5a0f78,_0x1e2b58){return function(_0x4c0133){if(_0x4c0133){return _0x4c0133['update'](_0x5a0f78)[_0x7d95('0x23')](function(_0x46cf3c){return _0x46cf3c;});}return null;};}function removeEntity(_0x2ebd02,_0x54c0a2){return function(_0x2f54c4){if(_0x2f54c4){return _0x2f54c4[_0x7d95('0x24')]()['then'](function(){_0x2ebd02[_0x7d95('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ec676,_0x548b5d){return function(_0x3d869f){if(!_0x3d869f){_0x4ec676[_0x7d95('0x18')](0x194);}return _0x3d869f;};}function handleError(_0x4c6b9f,_0x25f5f2){_0x25f5f2=_0x25f5f2||0x1f4;return function(_0x13f975){logger[_0x7d95('0x25')](_0x13f975['stack']);if(_0x13f975[_0x7d95('0x26')]){delete _0x13f975[_0x7d95('0x26')];}_0x4c6b9f[_0x7d95('0x19')](_0x25f5f2)['send'](_0x13f975);};}exports[_0x7d95('0x27')]=function(_0x57b751,_0x216fa6){var _0x3be6fa={'raw':!![],'where':{'id':_0x57b751[_0x7d95('0x28')]['id']}},_0x3d3bb8={};_0x3d3bb8[_0x7d95('0x29')]=_[_0x7d95('0x2a')](db[_0x7d95('0x2b')][_0x7d95('0x2c')]);_0x3d3bb8['query']=_[_0x7d95('0x2a')](_0x57b751['query']);_0x3d3bb8[_0x7d95('0x2d')]=_['intersection'](_0x3d3bb8[_0x7d95('0x29')],_0x3d3bb8[_0x7d95('0x2e')]);_0x3be6fa[_0x7d95('0x2f')]=_[_0x7d95('0x30')](_0x3d3bb8[_0x7d95('0x29')],qs[_0x7d95('0x31')](_0x57b751['query'][_0x7d95('0x31')]));_0x3be6fa[_0x7d95('0x2f')]=_0x3be6fa[_0x7d95('0x2f')][_0x7d95('0x32')]?_0x3be6fa[_0x7d95('0x2f')]:_0x3d3bb8[_0x7d95('0x29')];if(_0x57b751['query'][_0x7d95('0x33')]){_0x3be6fa[_0x7d95('0x34')]=[{'all':!![]}];}_0x3be6fa=_['merge']({},_0x3be6fa,_0x57b751['options']);return db[_0x7d95('0x2b')][_0x7d95('0x35')](_0x3be6fa)['then'](handleEntityNotFound(_0x216fa6,null))[_0x7d95('0x23')](respondWithResult(_0x216fa6,null))[_0x7d95('0x36')](handleError(_0x216fa6,null));};exports[_0x7d95('0x37')]=function(_0x1e834c,_0x42c4ee){if(_0x1e834c[_0x7d95('0x38')]['id']){delete _0x1e834c[_0x7d95('0x38')]['id'];}return db['ChatApplication'][_0x7d95('0x35')]({'where':{'id':_0x1e834c[_0x7d95('0x28')]['id']}})[_0x7d95('0x23')](handleEntityNotFound(_0x42c4ee,null))['then'](saveUpdates(_0x1e834c[_0x7d95('0x38')],null))[_0x7d95('0x23')](respondWithResult(_0x42c4ee,null))['catch'](handleError(_0x42c4ee,null));};exports[_0x7d95('0x24')]=function(_0x283e74,_0x3e4568){return db[_0x7d95('0x2b')]['find']({'where':{'id':_0x283e74['params']['id']}})['then'](handleEntityNotFound(_0x3e4568,null))['then'](removeEntity(_0x3e4568,null))['catch'](handleError(_0x3e4568,null));};
\ No newline at end of file
+var _0xd8cc=['end','json','undefined','limit','count','offset','Content-Range','reject','then','destroy','sendStatus','error','stack','name','send','model','keys','ChatApplication','rawAttributes','query','filters','attributes','fields','includeAll','include','options','find','catch','body','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8cc,0xc9));var _0xcd8c=function(_0x386b03,_0x5d0000){_0x386b03=_0x386b03-0x0;var _0xd3d524=_0xd8cc[_0x386b03];return _0xd3d524;};'use strict';var emlformat=require(_0xcd8c('0x0'));var rimraf=require(_0xcd8c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcd8c('0x2'));var moment=require(_0xcd8c('0x3'));var BPromise=require(_0xcd8c('0x4'));var Mustache=require(_0xcd8c('0x5'));var util=require('util');var path=require(_0xcd8c('0x6'));var sox=require(_0xcd8c('0x7'));var csv=require('to-csv');var ejs=require(_0xcd8c('0x8'));var fs=require('fs');var fs_extra=require(_0xcd8c('0x9'));var _=require('lodash');var squel=require(_0xcd8c('0xa'));var crypto=require(_0xcd8c('0xb'));var jsforce=require(_0xcd8c('0xc'));var deskjs=require(_0xcd8c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcd8c('0xe'));var Papa=require(_0xcd8c('0xf'));var Redis=require(_0xcd8c('0x10'));var authService=require(_0xcd8c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcd8c('0x12'));var hardwareService=require(_0xcd8c('0x13'));var logger=require(_0xcd8c('0x14'))(_0xcd8c('0x15'));var utils=require(_0xcd8c('0x16'));var config=require(_0xcd8c('0x17'));var licenseUtil=require(_0xcd8c('0x18'));var db=require(_0xcd8c('0x19'))['db'];function respondWithStatusCode(_0x338bd6,_0x5a55f4){_0x5a55f4=_0x5a55f4||0xcc;return function(_0x1d695b){if(_0x1d695b){return _0x338bd6['sendStatus'](_0x5a55f4);}return _0x338bd6[_0xcd8c('0x1a')](_0x5a55f4)[_0xcd8c('0x1b')]();};}function respondWithResult(_0x3b90be,_0x5a41e0){_0x5a41e0=_0x5a41e0||0xc8;return function(_0xf0cb62){if(_0xf0cb62){return _0x3b90be[_0xcd8c('0x1a')](_0x5a41e0)[_0xcd8c('0x1c')](_0xf0cb62);}};}function respondWithFilteredResult(_0xffcb8d,_0x8e98d6){return function(_0x2df9d1){if(_0x2df9d1){var _0x13058b=typeof _0x8e98d6['offset']===_0xcd8c('0x1d')&&typeof _0x8e98d6[_0xcd8c('0x1e')]===_0xcd8c('0x1d');var _0x2f1180=_0x2df9d1[_0xcd8c('0x1f')];var _0x4a6652=_0x13058b?0x0:_0x8e98d6[_0xcd8c('0x20')];var _0x120d0d=_0x13058b?_0x2df9d1[_0xcd8c('0x1f')]:_0x8e98d6[_0xcd8c('0x20')]+_0x8e98d6[_0xcd8c('0x1e')];var _0x387ff2;if(_0x120d0d>=_0x2f1180){_0x120d0d=_0x2f1180;_0x387ff2=0xc8;}else{_0x387ff2=0xce;}_0xffcb8d[_0xcd8c('0x1a')](_0x387ff2);return _0xffcb8d['set'](_0xcd8c('0x21'),_0x4a6652+'-'+_0x120d0d+'/'+_0x2f1180)[_0xcd8c('0x1c')](_0x2df9d1);}return null;};}function patchUpdates(_0x5008d3){return function(_0x5330ea){try{jsonpatch['apply'](_0x5330ea,_0x5008d3,!![]);}catch(_0x506d64){return BPromise[_0xcd8c('0x22')](_0x506d64);}return _0x5330ea['save']();};}function saveUpdates(_0x534257,_0x59297d){return function(_0x4f12b8){if(_0x4f12b8){return _0x4f12b8['update'](_0x534257)[_0xcd8c('0x23')](function(_0x3c60ff){return _0x3c60ff;});}return null;};}function removeEntity(_0x2d7718,_0x5368df){return function(_0x2e5711){if(_0x2e5711){return _0x2e5711[_0xcd8c('0x24')]()[_0xcd8c('0x23')](function(){_0x2d7718[_0xcd8c('0x1a')](0xcc)[_0xcd8c('0x1b')]();});}};}function handleEntityNotFound(_0x77ca04,_0x5caaa0){return function(_0x56a54c){if(!_0x56a54c){_0x77ca04[_0xcd8c('0x25')](0x194);}return _0x56a54c;};}function handleError(_0x1e1e00,_0xfc6ca5){_0xfc6ca5=_0xfc6ca5||0x1f4;return function(_0x4c67c1){logger[_0xcd8c('0x26')](_0x4c67c1[_0xcd8c('0x27')]);if(_0x4c67c1['name']){delete _0x4c67c1[_0xcd8c('0x28')];}_0x1e1e00[_0xcd8c('0x1a')](_0xfc6ca5)[_0xcd8c('0x29')](_0x4c67c1);};}exports['show']=function(_0x5193a1,_0x36c342){var _0x5308ec={'raw':!![],'where':{'id':_0x5193a1['params']['id']}},_0x4c772a={};_0x4c772a[_0xcd8c('0x2a')]=_[_0xcd8c('0x2b')](db[_0xcd8c('0x2c')][_0xcd8c('0x2d')]);_0x4c772a[_0xcd8c('0x2e')]=_[_0xcd8c('0x2b')](_0x5193a1[_0xcd8c('0x2e')]);_0x4c772a[_0xcd8c('0x2f')]=_['intersection'](_0x4c772a[_0xcd8c('0x2a')],_0x4c772a[_0xcd8c('0x2e')]);_0x5308ec[_0xcd8c('0x30')]=_['intersection'](_0x4c772a[_0xcd8c('0x2a')],qs[_0xcd8c('0x31')](_0x5193a1['query'][_0xcd8c('0x31')]));_0x5308ec['attributes']=_0x5308ec[_0xcd8c('0x30')]['length']?_0x5308ec['attributes']:_0x4c772a[_0xcd8c('0x2a')];if(_0x5193a1[_0xcd8c('0x2e')][_0xcd8c('0x32')]){_0x5308ec[_0xcd8c('0x33')]=[{'all':!![]}];}_0x5308ec=_['merge']({},_0x5308ec,_0x5193a1[_0xcd8c('0x34')]);return db['ChatApplication'][_0xcd8c('0x35')](_0x5308ec)[_0xcd8c('0x23')](handleEntityNotFound(_0x36c342,null))[_0xcd8c('0x23')](respondWithResult(_0x36c342,null))[_0xcd8c('0x36')](handleError(_0x36c342,null));};exports['update']=function(_0x3f57b0,_0x5bb651){if(_0x3f57b0[_0xcd8c('0x37')]['id']){delete _0x3f57b0['body']['id'];}return db['ChatApplication']['find']({'where':{'id':_0x3f57b0[_0xcd8c('0x38')]['id']}})['then'](handleEntityNotFound(_0x5bb651,null))['then'](saveUpdates(_0x3f57b0[_0xcd8c('0x37')],null))[_0xcd8c('0x23')](respondWithResult(_0x5bb651,null))[_0xcd8c('0x36')](handleError(_0x5bb651,null));};exports['destroy']=function(_0x1b92bb,_0x19df28){return db[_0xcd8c('0x2c')][_0xcd8c('0x35')]({'where':{'id':_0x1b92bb[_0xcd8c('0x38')]['id']}})[_0xcd8c('0x23')](handleEntityNotFound(_0x19df28,null))[_0xcd8c('0x23')](removeEntity(_0x19df28,null))[_0xcd8c('0x36')](handleError(_0x19df28,null));};
\ No newline at end of file
index 85882b0..072a3e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c81=['../../config/environment','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','rimraf'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x1c81,0x8b));var _0x11c8=function(_0x3c76bb,_0x2de95e){_0x3c76bb=_0x3c76bb-0x0;var _0x5794ca=_0x1c81[_0x3c76bb];return _0x5794ca;};'use strict';var _=require(_0x11c8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x11c8('0x1'));var moment=require(_0x11c8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x11c8('0x3'));var config=require(_0x11c8('0x4'));var attributes=require('./chatApplication.attributes');module[_0x11c8('0x5')]=function(_0x318930,_0xa530f3){return _0x318930[_0x11c8('0x6')](_0x11c8('0x7'),attributes,{'tableName':_0x11c8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x11c8('0x9'),'collate':_0x11c8('0xa')});};
\ No newline at end of file
+var _0xa794=['utf8mb4','api','moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications'];(function(_0x280b6f,_0x1aef4b){var _0x1c4438=function(_0x21b36e){while(--_0x21b36e){_0x280b6f['push'](_0x280b6f['shift']());}};_0x1c4438(++_0x1aef4b);}(_0xa794,0x79));var _0x4a79=function(_0x9e6ea4,_0x51f5ad){_0x9e6ea4=_0x9e6ea4-0x0;var _0x25504f=_0xa794[_0x9e6ea4];return _0x25504f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4a79('0x0'));var moment=require(_0x4a79('0x1'));var BPromise=require(_0x4a79('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a79('0x3'));var rimraf=require(_0x4a79('0x4'));var config=require(_0x4a79('0x5'));var attributes=require(_0x4a79('0x6'));module[_0x4a79('0x7')]=function(_0x4e5e46,_0x1aa26d){return _0x4e5e46[_0x4a79('0x8')](_0x4a79('0x9'),attributes,{'tableName':_0x4a79('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4a79('0xb'),'collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
index b23f9a1..028f70e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0d42=['debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ChatApplication,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d42,0x189));var _0x20d4=function(_0x9a8878,_0x2ef1b8){_0x9a8878=_0x9a8878-0x0;var _0x5f36a8=_0x0d42[_0x9a8878];return _0x5f36a8;};'use strict';var _=require(_0x20d4('0x0'));var util=require(_0x20d4('0x1'));var moment=require(_0x20d4('0x2'));var BPromise=require('bluebird');var rs=require(_0x20d4('0x3'));var fs=require('fs');var Redis=require(_0x20d4('0x4'));var db=require(_0x20d4('0x5'))['db'];var utils=require(_0x20d4('0x6'));var logger=require(_0x20d4('0x7'))(_0x20d4('0x8'));var config=require(_0x20d4('0x9'));var jayson=require(_0x20d4('0xa'));var client=jayson[_0x20d4('0xb')][_0x20d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c4e0f,_0x22eaf0,_0x388961){return new BPromise(function(_0x5d3571,_0x8e16d3){return client['request'](_0x2c4e0f,_0x388961)[_0x20d4('0xd')](function(_0x1ccebf){logger['info'](_0x20d4('0xe'),_0x22eaf0,'request\x20sent');logger[_0x20d4('0xf')](_0x20d4('0x10'),_0x22eaf0,_0x20d4('0x11'),JSON['stringify'](_0x1ccebf));if(_0x1ccebf[_0x20d4('0x12')]){if(_0x1ccebf[_0x20d4('0x12')][_0x20d4('0x13')]===0x1f4){logger['error'](_0x20d4('0xe'),_0x22eaf0,_0x1ccebf['error'][_0x20d4('0x14')]);return _0x8e16d3(_0x1ccebf['error']['message']);}logger[_0x20d4('0x12')](_0x20d4('0xe'),_0x22eaf0,_0x1ccebf['error'][_0x20d4('0x14')]);return _0x5d3571(_0x1ccebf[_0x20d4('0x12')]['message']);}else{logger[_0x20d4('0x15')](_0x20d4('0xe'),_0x22eaf0,'request\x20sent');_0x5d3571(_0x1ccebf[_0x20d4('0x16')][_0x20d4('0x14')]);}})[_0x20d4('0x17')](function(_0x5ad1a8){logger[_0x20d4('0x12')]('ChatApplication,\x20%s,\x20%s',_0x22eaf0,_0x5ad1a8);_0x8e16d3(_0x5ad1a8);});});}
\ No newline at end of file
+var _0x2a40=['message','ChatApplication,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4752a1,_0x26e7bd){var _0x4bcec9=function(_0x6646eb){while(--_0x6646eb){_0x4752a1['push'](_0x4752a1['shift']());}};_0x4bcec9(++_0x26e7bd);}(_0x2a40,0xab));var _0x02a4=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0x2a40[_0x136619];return _0x38c4a5;};'use strict';var _=require(_0x02a4('0x0'));var util=require(_0x02a4('0x1'));var moment=require(_0x02a4('0x2'));var BPromise=require(_0x02a4('0x3'));var rs=require(_0x02a4('0x4'));var fs=require('fs');var Redis=require(_0x02a4('0x5'));var db=require(_0x02a4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x02a4('0x7'))(_0x02a4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x02a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35b357,_0x2657b9,_0x948531){return new BPromise(function(_0x42217b,_0x5cdc78){return client[_0x02a4('0xa')](_0x35b357,_0x948531)[_0x02a4('0xb')](function(_0x2e6caa){logger[_0x02a4('0xc')]('ChatApplication,\x20%s,\x20%s',_0x2657b9,_0x02a4('0xd'));logger['debug'](_0x02a4('0xe'),_0x2657b9,_0x02a4('0xd'),JSON[_0x02a4('0xf')](_0x2e6caa));if(_0x2e6caa[_0x02a4('0x10')]){if(_0x2e6caa[_0x02a4('0x10')][_0x02a4('0x11')]===0x1f4){logger[_0x02a4('0x10')]('ChatApplication,\x20%s,\x20%s',_0x2657b9,_0x2e6caa[_0x02a4('0x10')][_0x02a4('0x12')]);return _0x5cdc78(_0x2e6caa[_0x02a4('0x10')][_0x02a4('0x12')]);}logger[_0x02a4('0x10')]('ChatApplication,\x20%s,\x20%s',_0x2657b9,_0x2e6caa['error'][_0x02a4('0x12')]);return _0x42217b(_0x2e6caa[_0x02a4('0x10')][_0x02a4('0x12')]);}else{logger[_0x02a4('0xc')](_0x02a4('0x13'),_0x2657b9,_0x02a4('0xd'));_0x42217b(_0x2e6caa[_0x02a4('0x14')][_0x02a4('0x12')]);}})['catch'](function(_0x90a4fd){logger[_0x02a4('0x10')]('ChatApplication,\x20%s,\x20%s',_0x2657b9,_0x90a4fd);_0x5cdc78(_0x90a4fd);});});}
\ No newline at end of file
index 44c0b4f..80be3a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9805=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9805,0xd8));var _0x5980=function(_0x187b5f,_0x5b3e6a){_0x187b5f=_0x187b5f-0x0;var _0x2ec20c=_0x9805[_0x187b5f];return _0x2ec20c;};'use strict';var multer=require(_0x5980('0x0'));var util=require(_0x5980('0x1'));var path=require('path');var timeout=require(_0x5980('0x2'));var express=require(_0x5980('0x3'));var router=express[_0x5980('0x4')]();var fs_extra=require(_0x5980('0x5'));var auth=require(_0x5980('0x6'));var interaction=require(_0x5980('0x7'));var config=require(_0x5980('0x8'));var controller=require(_0x5980('0x9'));router['get'](_0x5980('0xa'),auth[_0x5980('0xb')](),controller[_0x5980('0xc')]);router['put'](_0x5980('0xa'),auth[_0x5980('0xb')](),controller[_0x5980('0xd')]);router[_0x5980('0xe')](_0x5980('0xa'),auth['isAuthenticated'](),controller[_0x5980('0xf')]);module[_0x5980('0x10')]=router;
\ No newline at end of file
+var _0xfdc4=['../../config/environment','./chatApplication.controller','get','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x17dcfe,_0x576938){var _0x4f3acf=function(_0x1cacdb){while(--_0x1cacdb){_0x17dcfe['push'](_0x17dcfe['shift']());}};_0x4f3acf(++_0x576938);}(_0xfdc4,0x64));var _0x4fdc=function(_0x11ef9e,_0x2a281e){_0x11ef9e=_0x11ef9e-0x0;var _0x36c9ba=_0xfdc4[_0x11ef9e];return _0x36c9ba;};'use strict';var multer=require(_0x4fdc('0x0'));var util=require(_0x4fdc('0x1'));var path=require(_0x4fdc('0x2'));var timeout=require(_0x4fdc('0x3'));var express=require(_0x4fdc('0x4'));var router=express[_0x4fdc('0x5')]();var fs_extra=require(_0x4fdc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4fdc('0x7'));var config=require(_0x4fdc('0x8'));var controller=require(_0x4fdc('0x9'));router[_0x4fdc('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4fdc('0xb')]);router[_0x4fdc('0xc')](_0x4fdc('0xd'),auth['isAuthenticated'](),controller[_0x4fdc('0xe')]);router[_0x4fdc('0xf')](_0x4fdc('0xd'),auth['isAuthenticated'](),controller[_0x4fdc('0x10')]);module[_0x4fdc('0x11')]=router;
\ No newline at end of file
index c1b080c..5e3b635 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5a1b=['STRING','BOOLEAN','sequelize','exports'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x5a1b,0xe6));var _0xb5a1=function(_0x292b8e,_0x51ce8d){_0x292b8e=_0x292b8e-0x0;var _0x231773=_0x5a1b[_0x292b8e];return _0x231773;};'use strict';var Sequelize=require(_0xb5a1('0x0'));module[_0xb5a1('0x1')]={'name':{'type':Sequelize[_0xb5a1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb5a1('0x2')]},'write':{'type':Sequelize[_0xb5a1('0x3')],'defaultValue':!![]}};
\ No newline at end of file
+var _0x853e=['exports','STRING'];(function(_0x1a3938,_0x509ef3){var _0xd760e4=function(_0x503fb0){while(--_0x503fb0){_0x1a3938['push'](_0x1a3938['shift']());}};_0xd760e4(++_0x509ef3);}(_0x853e,0x1ea));var _0xe853=function(_0x2113b4,_0x21b0aa){_0x2113b4=_0x2113b4-0x0;var _0x2ba88a=_0x853e[_0x2113b4];return _0x2ba88a;};'use strict';var Sequelize=require('sequelize');module[_0xe853('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xe853('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}};
\ No newline at end of file
index 8c7650d..05f2873 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5490=['limit','count','set','Content-Range','apply','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','key','model','filters','intersection','attributes','fields','query','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','then','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','nolimit','removeMembers','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','hasOwnProperty','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','offset'];(function(_0x1bc1e0,_0xa224ba){var _0x365ae0=function(_0x428c81){while(--_0x428c81){_0x1bc1e0['push'](_0x1bc1e0['shift']());}};_0x365ae0(++_0xa224ba);}(_0x5490,0x1a5));var _0x0549=function(_0x41504a,_0x48bf24){_0x41504a=_0x41504a-0x0;var _0x3795c3=_0x5490[_0x41504a];return _0x3795c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0549('0x0'));var zipdir=require(_0x0549('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0549('0x2'));var moment=require(_0x0549('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0549('0x4'));var util=require(_0x0549('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0549('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0549('0x7'));var squel=require(_0x0549('0x8'));var crypto=require(_0x0549('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0549('0xa'));var toCsv=require(_0x0549('0x6'));var querystring=require(_0x0549('0xb'));var Papa=require(_0x0549('0xc'));var Redis=require('ioredis');var authService=require(_0x0549('0xd'));var qs=require(_0x0549('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0549('0xf'));var logger=require(_0x0549('0x10'))('api');var utils=require(_0x0549('0x11'));var config=require(_0x0549('0x12'));var licenseUtil=require(_0x0549('0x13'));var db=require(_0x0549('0x14'))['db'];config[_0x0549('0x15')]=_[_0x0549('0x16')](config[_0x0549('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x0549('0x17'))(new Redis(config[_0x0549('0x15')]));require(_0x0549('0x18'))[_0x0549('0x19')](socket);function respondWithStatusCode(_0x552a76,_0x57b1e9){_0x57b1e9=_0x57b1e9||0xcc;return function(_0x6a7a69){if(_0x6a7a69){return _0x552a76[_0x0549('0x1a')](_0x57b1e9);}return _0x552a76[_0x0549('0x1b')](_0x57b1e9)['end']();};}function respondWithResult(_0x3e7538,_0x2198fb){_0x2198fb=_0x2198fb||0xc8;return function(_0x51a4aa){if(_0x51a4aa){return _0x3e7538['status'](_0x2198fb)['json'](_0x51a4aa);}};}function respondWithFilteredResult(_0x12d477,_0x29bfb7){return function(_0x443947){if(_0x443947){var _0x491083=typeof _0x29bfb7[_0x0549('0x1c')]==='undefined'&&typeof _0x29bfb7[_0x0549('0x1d')]==='undefined';var _0x180db9=_0x443947[_0x0549('0x1e')];var _0x5384b2=_0x491083?0x0:_0x29bfb7[_0x0549('0x1c')];var _0x1df0fa=_0x491083?_0x443947[_0x0549('0x1e')]:_0x29bfb7['offset']+_0x29bfb7[_0x0549('0x1d')];var _0x22de81;if(_0x1df0fa>=_0x180db9){_0x1df0fa=_0x180db9;_0x22de81=0xc8;}else{_0x22de81=0xce;}_0x12d477[_0x0549('0x1b')](_0x22de81);return _0x12d477[_0x0549('0x1f')](_0x0549('0x20'),_0x5384b2+'-'+_0x1df0fa+'/'+_0x180db9)['json'](_0x443947);}return null;};}function patchUpdates(_0x329114){return function(_0x5ea679){try{jsonpatch[_0x0549('0x21')](_0x5ea679,_0x329114,!![]);}catch(_0x4dff2b){return BPromise['reject'](_0x4dff2b);}return _0x5ea679['save']();};}function saveUpdates(_0x21a58d,_0x7adbb6){return function(_0x56d6ed){if(_0x56d6ed){return _0x56d6ed['update'](_0x21a58d)['then'](function(_0x222a72){return _0x222a72;});}return null;};}function removeEntity(_0x2e4407,_0x3092d4){return function(_0x5a207a){if(_0x5a207a){return _0x5a207a[_0x0549('0x22')]()['then'](function(){_0x2e4407[_0x0549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3597b9,_0x55874e){return function(_0x30a8e9){if(!_0x30a8e9){_0x3597b9[_0x0549('0x1a')](0x194);}return _0x30a8e9;};}function handleError(_0x31ee56,_0x2b9369){_0x2b9369=_0x2b9369||0x1f4;return function(_0x191f51){logger[_0x0549('0x23')](_0x191f51[_0x0549('0x24')]);if(_0x191f51[_0x0549('0x25')]){delete _0x191f51[_0x0549('0x25')];}_0x31ee56['status'](_0x2b9369)[_0x0549('0x26')](_0x191f51);};}exports[_0x0549('0x27')]=function(_0x583ba8,_0x2ebc56){var _0x1fe3b8={},_0xa3e2bb={},_0x2d4e66={'count':0x0,'rows':[]};var _0x46845d=_[_0x0549('0x28')](db[_0x0549('0x29')][_0x0549('0x2a')],function(_0xa9b8a6){return{'name':_0xa9b8a6['fieldName'],'type':_0xa9b8a6['type'][_0x0549('0x2b')]};});_0xa3e2bb[_0x0549('0x2c')]=_[_0x0549('0x28')](_0x46845d,_0x0549('0x25'));_0xa3e2bb['query']=_['keys'](_0x583ba8['query']);_0xa3e2bb[_0x0549('0x2d')]=_[_0x0549('0x2e')](_0xa3e2bb[_0x0549('0x2c')],_0xa3e2bb['query']);_0x1fe3b8[_0x0549('0x2f')]=_['intersection'](_0xa3e2bb[_0x0549('0x2c')],qs[_0x0549('0x30')](_0x583ba8[_0x0549('0x31')][_0x0549('0x30')]));_0x1fe3b8['attributes']=_0x1fe3b8['attributes'][_0x0549('0x32')]?_0x1fe3b8[_0x0549('0x2f')]:_0xa3e2bb[_0x0549('0x2c')];if(!_0x583ba8[_0x0549('0x31')]['hasOwnProperty']('nolimit')){_0x1fe3b8['limit']=qs[_0x0549('0x1d')](_0x583ba8[_0x0549('0x31')]['limit']);_0x1fe3b8[_0x0549('0x1c')]=qs['offset'](_0x583ba8[_0x0549('0x31')][_0x0549('0x1c')]);}_0x1fe3b8[_0x0549('0x33')]=qs[_0x0549('0x34')](_0x583ba8[_0x0549('0x31')]['sort']);_0x1fe3b8[_0x0549('0x35')]=qs[_0x0549('0x2d')](_[_0x0549('0x36')](_0x583ba8[_0x0549('0x31')],_0xa3e2bb['filters']),_0x46845d);if(_0x583ba8[_0x0549('0x31')][_0x0549('0x37')]){_0x1fe3b8[_0x0549('0x35')]=_[_0x0549('0x38')](_0x1fe3b8[_0x0549('0x35')],{'$or':_[_0x0549('0x28')](_0x46845d,function(_0x19a28a){if(_0x19a28a[_0x0549('0x39')]!==_0x0549('0x3a')){var _0x59b8c3={};_0x59b8c3[_0x19a28a[_0x0549('0x25')]]={'$like':'%'+_0x583ba8[_0x0549('0x31')][_0x0549('0x37')]+'%'};return _0x59b8c3;}})});}_0x1fe3b8=_[_0x0549('0x38')]({},_0x1fe3b8,_0x583ba8[_0x0549('0x3b')]);var _0x1d40f2={'where':_0x1fe3b8[_0x0549('0x35')]};return db[_0x0549('0x29')][_0x0549('0x1e')](_0x1d40f2)['then'](function(_0x5bf2a4){_0x2d4e66[_0x0549('0x1e')]=_0x5bf2a4;if(_0x583ba8['query'][_0x0549('0x3c')]){_0x1fe3b8[_0x0549('0x3d')]=[{'all':!![]}];}return db[_0x0549('0x29')]['findAll'](_0x1fe3b8);})['then'](function(_0x26f6e9){_0x2d4e66[_0x0549('0x3e')]=_0x26f6e9;return _0x2d4e66;})['then'](respondWithFilteredResult(_0x2ebc56,_0x1fe3b8))[_0x0549('0x3f')](handleError(_0x2ebc56,null));};exports[_0x0549('0x40')]=function(_0x352756,_0x20f417){var _0x2bdff1={'raw':!![],'where':{'id':_0x352756['params']['id']}},_0x12c377={};_0x12c377[_0x0549('0x2c')]=_[_0x0549('0x41')](db[_0x0549('0x29')][_0x0549('0x2a')]);_0x12c377[_0x0549('0x31')]=_[_0x0549('0x41')](_0x352756[_0x0549('0x31')]);_0x12c377['filters']=_[_0x0549('0x2e')](_0x12c377['model'],_0x12c377[_0x0549('0x31')]);_0x2bdff1[_0x0549('0x2f')]=_[_0x0549('0x2e')](_0x12c377[_0x0549('0x2c')],qs[_0x0549('0x30')](_0x352756[_0x0549('0x31')][_0x0549('0x30')]));_0x2bdff1[_0x0549('0x2f')]=_0x2bdff1[_0x0549('0x2f')][_0x0549('0x32')]?_0x2bdff1[_0x0549('0x2f')]:_0x12c377[_0x0549('0x2c')];if(_0x352756[_0x0549('0x31')][_0x0549('0x3c')]){_0x2bdff1[_0x0549('0x3d')]=[{'all':!![]}];}_0x2bdff1=_['merge']({},_0x2bdff1,_0x352756[_0x0549('0x3b')]);return db[_0x0549('0x29')][_0x0549('0x42')](_0x2bdff1)[_0x0549('0x43')](handleEntityNotFound(_0x20f417,null))[_0x0549('0x43')](respondWithResult(_0x20f417,null))[_0x0549('0x3f')](handleError(_0x20f417,null));};exports['create']=function(_0x91431b,_0xd7c34e){return db[_0x0549('0x29')][_0x0549('0x44')](_0x91431b['body'],{})['then'](respondWithResult(_0xd7c34e,0xc9))[_0x0549('0x3f')](handleError(_0xd7c34e,null));};exports['update']=function(_0x3c2da8,_0x1b6c1a){if(_0x3c2da8[_0x0549('0x45')]['id']){delete _0x3c2da8[_0x0549('0x45')]['id'];}return db[_0x0549('0x29')][_0x0549('0x42')]({'where':{'id':_0x3c2da8['params']['id']}})[_0x0549('0x43')](handleEntityNotFound(_0x1b6c1a,null))['then'](saveUpdates(_0x3c2da8[_0x0549('0x45')],null))['then'](respondWithResult(_0x1b6c1a,null))[_0x0549('0x3f')](handleError(_0x1b6c1a,null));};exports['destroy']=function(_0x1f88a4,_0x238d8a){return db['ChatGroup'][_0x0549('0x42')]({'where':{'id':_0x1f88a4[_0x0549('0x46')]['id']}})[_0x0549('0x43')](handleEntityNotFound(_0x238d8a,null))[_0x0549('0x43')](removeEntity(_0x238d8a,null))[_0x0549('0x3f')](handleError(_0x238d8a,null));};exports[_0x0549('0x47')]=function(_0x17f406,_0x37f36f){return db[_0x0549('0x29')][_0x0549('0x47')]()[_0x0549('0x43')](respondWithResult(_0x37f36f,null))[_0x0549('0x3f')](handleError(_0x37f36f,null));};exports[_0x0549('0x48')]=function(_0x4f8dc9,_0x397775,_0x8444e0){return db[_0x0549('0x49')]['count']({'where':{'ChatGroupId':_0x4f8dc9[_0x0549('0x46')]['id'],'ToId':_0x4f8dc9[_0x0549('0x4a')]['id'],'read':![]}})[_0x0549('0x43')](function(_0x375dcb){return{'id':_[_0x0549('0x4b')](_0x4f8dc9[_0x0549('0x46')]['id']),'count':_0x375dcb};})[_0x0549('0x43')](respondWithResult(_0x397775,null))[_0x0549('0x3f')](handleError(_0x397775,null));};exports[_0x0549('0x4c')]=function(_0x2ca0ee,_0x426a58,_0x3f2e1e){return db[_0x0549('0x29')][_0x0549('0x42')]({'where':{'id':_0x2ca0ee[_0x0549('0x46')]['id']}})[_0x0549('0x43')](handleEntityNotFound(_0x426a58,null))[_0x0549('0x43')](function(_0x258278){if(_0x258278){return _0x258278[_0x0549('0x4c')](_0x2ca0ee[_0x0549('0x45')][_0x0549('0x4d')],_[_0x0549('0x4e')](_0x2ca0ee[_0x0549('0x45')],['ids','id'])||{});}})[_0x0549('0x43')](respondWithResult(_0x426a58,null))['catch'](handleError(_0x426a58,null));};exports[_0x0549('0x4f')]=function(_0x1ddfaf,_0xb8634c,_0x14212b){var _0x759e08={};var _0x2eab7d={};var _0x50a450;var _0x4a7fc2;return db['ChatGroup'][_0x0549('0x50')]({'where':{'id':_0x1ddfaf[_0x0549('0x46')]['id']}})[_0x0549('0x43')](handleEntityNotFound(_0xb8634c,null))[_0x0549('0x43')](function(_0x2842f6){if(_0x2842f6){_0x50a450=_0x2842f6;_0x2eab7d['model']=_['keys'](db[_0x0549('0x51')][_0x0549('0x2a')]);_0x2eab7d[_0x0549('0x31')]=_[_0x0549('0x41')](_0x1ddfaf[_0x0549('0x31')]);_0x2eab7d[_0x0549('0x2d')]=_[_0x0549('0x2e')](_0x2eab7d[_0x0549('0x2c')],_0x2eab7d[_0x0549('0x31')]);_0x759e08[_0x0549('0x2f')]=_[_0x0549('0x2e')](_0x2eab7d[_0x0549('0x2c')],qs[_0x0549('0x30')](_0x1ddfaf['query'][_0x0549('0x30')]));_0x759e08[_0x0549('0x2f')]=_0x759e08[_0x0549('0x2f')][_0x0549('0x32')]?_0x759e08[_0x0549('0x2f')]:_0x2eab7d[_0x0549('0x2c')];_0x759e08[_0x0549('0x33')]=qs['sort'](_0x1ddfaf['query'][_0x0549('0x34')]);_0x759e08['where']=qs['filters'](_[_0x0549('0x36')](_0x1ddfaf[_0x0549('0x31')],_0x2eab7d[_0x0549('0x2d')]));if(_0x1ddfaf[_0x0549('0x31')][_0x0549('0x37')]){_0x759e08['where']=_[_0x0549('0x38')](_0x759e08['where'],{'$or':_[_0x0549('0x28')](_0x759e08['attributes'],function(_0x473568){var _0x240426={};_0x240426[_0x473568]={'$like':'%'+_0x1ddfaf['query'][_0x0549('0x37')]+'%'};return _0x240426;})});}_0x759e08=_[_0x0549('0x38')]({},_0x759e08,_0x1ddfaf[_0x0549('0x3b')]);return _0x50a450['getMembers'](_0x759e08);}})[_0x0549('0x43')](function(_0x259b65){if(_0x259b65){_0x4a7fc2=_0x259b65[_0x0549('0x32')];if(!_0x1ddfaf[_0x0549('0x31')]['hasOwnProperty'](_0x0549('0x52'))){_0x759e08[_0x0549('0x1d')]=qs[_0x0549('0x1d')](_0x1ddfaf[_0x0549('0x31')][_0x0549('0x1d')]);_0x759e08[_0x0549('0x1c')]=qs[_0x0549('0x1c')](_0x1ddfaf[_0x0549('0x31')]['offset']);}return _0x50a450[_0x0549('0x4f')](_0x759e08);}})[_0x0549('0x43')](function(_0x1bdfe4){if(_0x1bdfe4){return _0x1bdfe4?{'count':_0x4a7fc2,'rows':_0x1bdfe4}:null;}})[_0x0549('0x43')](respondWithResult(_0xb8634c,null))[_0x0549('0x3f')](handleError(_0xb8634c,null));};exports[_0x0549('0x53')]=function(_0x15a62c,_0xd5209a,_0x561802){return db[_0x0549('0x29')][_0x0549('0x42')]({'where':{'id':_0x15a62c[_0x0549('0x46')]['id']}})[_0x0549('0x43')](handleEntityNotFound(_0xd5209a,null))[_0x0549('0x43')](function(_0x3d2b54){if(_0x3d2b54){return _0x3d2b54[_0x0549('0x53')](_0x15a62c[_0x0549('0x31')][_0x0549('0x4d')]);}})[_0x0549('0x43')](respondWithStatusCode(_0xd5209a,null))[_0x0549('0x3f')](handleError(_0xd5209a,null));};exports['addMessage']=function(_0x3be820,_0x1b7828,_0x256a16){if(_0x3be820[_0x0549('0x45')]['id']){delete _0x3be820[_0x0549('0x45')]['id'];}return db[_0x0549('0x29')][_0x0549('0x42')]({'where':{'id':_0x3be820[_0x0549('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b7828,null))[_0x0549('0x43')](function(_0x104913){if(_0x104913){_0x3be820['body']['ChatGroupId']=_0x104913['id'];return db[_0x0549('0x49')]['create'](_0x3be820['body']);}})[_0x0549('0x43')](respondWithResult(_0x1b7828,null))[_0x0549('0x3f')](handleError(_0x1b7828,null));};exports[_0x0549('0x54')]=function(_0x454cb6,_0x100489,_0x3e1176){var _0x1cd2f5={};var _0x3ebbd9={};var _0x3733dd;var _0x530323;return db[_0x0549('0x29')][_0x0549('0x50')]({'where':{'id':_0x454cb6[_0x0549('0x46')]['id']}})['then'](handleEntityNotFound(_0x100489,null))[_0x0549('0x43')](function(_0x5f23a8){if(_0x5f23a8){_0x3733dd=_0x5f23a8;_0x3ebbd9['model']=_['keys'](db[_0x0549('0x49')][_0x0549('0x2a')]);_0x3ebbd9[_0x0549('0x31')]=_['keys'](_0x454cb6[_0x0549('0x31')]);_0x3ebbd9[_0x0549('0x2d')]=_[_0x0549('0x2e')](_0x3ebbd9['model'],_0x3ebbd9[_0x0549('0x31')]);_0x1cd2f5['attributes']=_[_0x0549('0x2e')](_0x3ebbd9[_0x0549('0x2c')],qs[_0x0549('0x30')](_0x454cb6[_0x0549('0x31')][_0x0549('0x30')]));_0x1cd2f5[_0x0549('0x2f')]=_0x1cd2f5[_0x0549('0x2f')]['length']?_0x1cd2f5['attributes']:_0x3ebbd9['model'];_0x1cd2f5['order']=qs[_0x0549('0x34')](_0x454cb6['query'][_0x0549('0x34')]);_0x1cd2f5[_0x0549('0x35')]=qs[_0x0549('0x2d')](_[_0x0549('0x36')](_0x454cb6['query'],_0x3ebbd9[_0x0549('0x2d')]));if(_0x454cb6[_0x0549('0x31')][_0x0549('0x37')]){_0x1cd2f5[_0x0549('0x35')]=_[_0x0549('0x38')](_0x1cd2f5[_0x0549('0x35')],{'$or':_[_0x0549('0x28')](_0x1cd2f5[_0x0549('0x2f')],function(_0x568292){var _0x221166={};_0x221166[_0x568292]={'$like':'%'+_0x454cb6['query'][_0x0549('0x37')]+'%'};return _0x221166;})});}if(_0x454cb6[_0x0549('0x31')][_0x0549('0x55')]){var _0x284574=_0x454cb6[_0x0549('0x31')][_0x0549('0x55')][_0x0549('0x56')](',');var _0xc1e618={};_0xc1e618[_0x284574[0x0]]={'$gte':moment(_0x284574[0x1])[_0x0549('0x57')](_0x0549('0x58'))};_0x1cd2f5[_0x0549('0x35')]=_[_0x0549('0x38')](_0x1cd2f5['where'],_0xc1e618);}_0x1cd2f5=_[_0x0549('0x38')]({},_0x1cd2f5,_0x454cb6[_0x0549('0x3b')]);return _0x3733dd[_0x0549('0x54')](_0x1cd2f5);}})[_0x0549('0x43')](function(_0x57af45){if(_0x57af45){_0x530323=_0x57af45['length'];if(!_0x454cb6[_0x0549('0x31')][_0x0549('0x59')](_0x0549('0x52'))){_0x1cd2f5['limit']=qs[_0x0549('0x1d')](_0x454cb6[_0x0549('0x31')][_0x0549('0x1d')]);_0x1cd2f5[_0x0549('0x1c')]=qs[_0x0549('0x1c')](_0x454cb6[_0x0549('0x31')][_0x0549('0x1c')]);}return _0x3733dd['getMessages'](_0x1cd2f5);}})[_0x0549('0x43')](function(_0x565748){if(_0x565748){return _0x565748?{'count':_0x530323,'rows':_0x565748}:null;}})[_0x0549('0x43')](respondWithResult(_0x100489,null))[_0x0549('0x3f')](handleError(_0x100489,null));};
\ No newline at end of file
+var _0x6345=['fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./chatGroup.socket','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','removeMembers','addMessage','ChatGroupId','getMessages','$gte','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs'];(function(_0x141da1,_0x3905c7){var _0x5abdbd=function(_0xc78a12){while(--_0xc78a12){_0x141da1['push'](_0x141da1['shift']());}};_0x5abdbd(++_0x3905c7);}(_0x6345,0x10e));var _0x5634=function(_0x1fe008,_0xc6c844){_0x1fe008=_0x1fe008-0x0;var _0x2383ac=_0x6345[_0x1fe008];return _0x2383ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5634('0x0'));var zipdir=require(_0x5634('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5634('0x2'));var moment=require(_0x5634('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5634('0x4'));var util=require(_0x5634('0x5'));var path=require(_0x5634('0x6'));var sox=require('sox');var csv=require(_0x5634('0x7'));var ejs=require(_0x5634('0x8'));var fs=require('fs');var fs_extra=require(_0x5634('0x9'));var _=require('lodash');var squel=require(_0x5634('0xa'));var crypto=require(_0x5634('0xb'));var jsforce=require(_0x5634('0xc'));var deskjs=require(_0x5634('0xd'));var toCsv=require(_0x5634('0x7'));var querystring=require('querystring');var Papa=require(_0x5634('0xe'));var Redis=require(_0x5634('0xf'));var authService=require(_0x5634('0x10'));var qs=require(_0x5634('0x11'));var as=require(_0x5634('0x12'));var hardwareService=require(_0x5634('0x13'));var logger=require(_0x5634('0x14'))(_0x5634('0x15'));var utils=require('../../config/utils');var config=require(_0x5634('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5634('0x17'))['db'];config['redis']=_['defaults'](config[_0x5634('0x18')],{'host':_0x5634('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5634('0x18')]));require(_0x5634('0x1a'))['register'](socket);function respondWithStatusCode(_0x6f523,_0x3d5054){_0x3d5054=_0x3d5054||0xcc;return function(_0x42ac6e){if(_0x42ac6e){return _0x6f523[_0x5634('0x1b')](_0x3d5054);}return _0x6f523[_0x5634('0x1c')](_0x3d5054)[_0x5634('0x1d')]();};}function respondWithResult(_0x1a3603,_0x42ab0a){_0x42ab0a=_0x42ab0a||0xc8;return function(_0x322a94){if(_0x322a94){return _0x1a3603[_0x5634('0x1c')](_0x42ab0a)[_0x5634('0x1e')](_0x322a94);}};}function respondWithFilteredResult(_0x18e1fa,_0x28d17d){return function(_0x380d9e){if(_0x380d9e){var _0x44c2be=typeof _0x28d17d[_0x5634('0x1f')]==='undefined'&&typeof _0x28d17d[_0x5634('0x20')]===_0x5634('0x21');var _0x133e28=_0x380d9e[_0x5634('0x22')];var _0x1acfdc=_0x44c2be?0x0:_0x28d17d['offset'];var _0xc75d2c=_0x44c2be?_0x380d9e[_0x5634('0x22')]:_0x28d17d['offset']+_0x28d17d[_0x5634('0x20')];var _0x577efc;if(_0xc75d2c>=_0x133e28){_0xc75d2c=_0x133e28;_0x577efc=0xc8;}else{_0x577efc=0xce;}_0x18e1fa['status'](_0x577efc);return _0x18e1fa['set'](_0x5634('0x23'),_0x1acfdc+'-'+_0xc75d2c+'/'+_0x133e28)[_0x5634('0x1e')](_0x380d9e);}return null;};}function patchUpdates(_0x5e9f2e){return function(_0x1a6cb1){try{jsonpatch[_0x5634('0x24')](_0x1a6cb1,_0x5e9f2e,!![]);}catch(_0x1baeb5){return BPromise[_0x5634('0x25')](_0x1baeb5);}return _0x1a6cb1['save']();};}function saveUpdates(_0x39208f,_0x118abf){return function(_0xae6ad4){if(_0xae6ad4){return _0xae6ad4['update'](_0x39208f)['then'](function(_0x2b7f86){return _0x2b7f86;});}return null;};}function removeEntity(_0x5713cd,_0x5bd21b){return function(_0x428a7a){if(_0x428a7a){return _0x428a7a[_0x5634('0x26')]()['then'](function(){_0x5713cd[_0x5634('0x1c')](0xcc)[_0x5634('0x1d')]();});}};}function handleEntityNotFound(_0x5a650d,_0x19a42){return function(_0x18109c){if(!_0x18109c){_0x5a650d[_0x5634('0x1b')](0x194);}return _0x18109c;};}function handleError(_0x20d63b,_0x33e621){_0x33e621=_0x33e621||0x1f4;return function(_0x1563db){logger[_0x5634('0x27')](_0x1563db[_0x5634('0x28')]);if(_0x1563db[_0x5634('0x29')]){delete _0x1563db['name'];}_0x20d63b[_0x5634('0x1c')](_0x33e621)[_0x5634('0x2a')](_0x1563db);};}exports[_0x5634('0x2b')]=function(_0x517308,_0x4c6363){var _0x16a277={},_0x2499a6={},_0x5efc38={'count':0x0,'rows':[]};var _0x3fde2e=_[_0x5634('0x2c')](db[_0x5634('0x2d')][_0x5634('0x2e')],function(_0x2e26fc){return{'name':_0x2e26fc[_0x5634('0x2f')],'type':_0x2e26fc['type'][_0x5634('0x30')]};});_0x2499a6['model']=_['map'](_0x3fde2e,_0x5634('0x29'));_0x2499a6['query']=_[_0x5634('0x31')](_0x517308[_0x5634('0x32')]);_0x2499a6[_0x5634('0x33')]=_[_0x5634('0x34')](_0x2499a6['model'],_0x2499a6[_0x5634('0x32')]);_0x16a277['attributes']=_[_0x5634('0x34')](_0x2499a6[_0x5634('0x35')],qs[_0x5634('0x36')](_0x517308[_0x5634('0x32')][_0x5634('0x36')]));_0x16a277[_0x5634('0x37')]=_0x16a277[_0x5634('0x37')]['length']?_0x16a277[_0x5634('0x37')]:_0x2499a6[_0x5634('0x35')];if(!_0x517308[_0x5634('0x32')][_0x5634('0x38')](_0x5634('0x39'))){_0x16a277['limit']=qs[_0x5634('0x20')](_0x517308[_0x5634('0x32')]['limit']);_0x16a277[_0x5634('0x1f')]=qs['offset'](_0x517308['query'][_0x5634('0x1f')]);}_0x16a277[_0x5634('0x3a')]=qs[_0x5634('0x3b')](_0x517308[_0x5634('0x32')][_0x5634('0x3b')]);_0x16a277['where']=qs[_0x5634('0x33')](_[_0x5634('0x3c')](_0x517308[_0x5634('0x32')],_0x2499a6[_0x5634('0x33')]),_0x3fde2e);if(_0x517308[_0x5634('0x32')][_0x5634('0x3d')]){_0x16a277[_0x5634('0x3e')]=_[_0x5634('0x3f')](_0x16a277['where'],{'$or':_[_0x5634('0x2c')](_0x3fde2e,function(_0x5b6fbb){if(_0x5b6fbb['type']!==_0x5634('0x40')){var _0x45a229={};_0x45a229[_0x5b6fbb[_0x5634('0x29')]]={'$like':'%'+_0x517308[_0x5634('0x32')][_0x5634('0x3d')]+'%'};return _0x45a229;}})});}_0x16a277=_[_0x5634('0x3f')]({},_0x16a277,_0x517308[_0x5634('0x41')]);var _0xd83003={'where':_0x16a277[_0x5634('0x3e')]};return db['ChatGroup'][_0x5634('0x22')](_0xd83003)[_0x5634('0x42')](function(_0xea25d6){_0x5efc38[_0x5634('0x22')]=_0xea25d6;if(_0x517308[_0x5634('0x32')]['includeAll']){_0x16a277[_0x5634('0x43')]=[{'all':!![]}];}return db[_0x5634('0x2d')][_0x5634('0x44')](_0x16a277);})[_0x5634('0x42')](function(_0x44d47e){_0x5efc38[_0x5634('0x45')]=_0x44d47e;return _0x5efc38;})[_0x5634('0x42')](respondWithFilteredResult(_0x4c6363,_0x16a277))[_0x5634('0x46')](handleError(_0x4c6363,null));};exports[_0x5634('0x47')]=function(_0x2d14cc,_0x4bee04){var _0x341734={'raw':!![],'where':{'id':_0x2d14cc[_0x5634('0x48')]['id']}},_0xd70a7f={};_0xd70a7f['model']=_['keys'](db[_0x5634('0x2d')][_0x5634('0x2e')]);_0xd70a7f[_0x5634('0x32')]=_['keys'](_0x2d14cc[_0x5634('0x32')]);_0xd70a7f[_0x5634('0x33')]=_[_0x5634('0x34')](_0xd70a7f['model'],_0xd70a7f['query']);_0x341734[_0x5634('0x37')]=_[_0x5634('0x34')](_0xd70a7f[_0x5634('0x35')],qs[_0x5634('0x36')](_0x2d14cc['query'][_0x5634('0x36')]));_0x341734['attributes']=_0x341734['attributes'][_0x5634('0x49')]?_0x341734[_0x5634('0x37')]:_0xd70a7f[_0x5634('0x35')];if(_0x2d14cc[_0x5634('0x32')][_0x5634('0x4a')]){_0x341734[_0x5634('0x43')]=[{'all':!![]}];}_0x341734=_[_0x5634('0x3f')]({},_0x341734,_0x2d14cc['options']);return db['ChatGroup'][_0x5634('0x4b')](_0x341734)['then'](handleEntityNotFound(_0x4bee04,null))['then'](respondWithResult(_0x4bee04,null))['catch'](handleError(_0x4bee04,null));};exports[_0x5634('0x4c')]=function(_0x129d0a,_0x117392){return db[_0x5634('0x2d')][_0x5634('0x4c')](_0x129d0a[_0x5634('0x4d')],{})['then'](respondWithResult(_0x117392,0xc9))[_0x5634('0x46')](handleError(_0x117392,null));};exports['update']=function(_0x17d80b,_0x1821dc){if(_0x17d80b['body']['id']){delete _0x17d80b[_0x5634('0x4d')]['id'];}return db[_0x5634('0x2d')][_0x5634('0x4b')]({'where':{'id':_0x17d80b[_0x5634('0x48')]['id']}})[_0x5634('0x42')](handleEntityNotFound(_0x1821dc,null))['then'](saveUpdates(_0x17d80b[_0x5634('0x4d')],null))[_0x5634('0x42')](respondWithResult(_0x1821dc,null))[_0x5634('0x46')](handleError(_0x1821dc,null));};exports[_0x5634('0x26')]=function(_0x16e651,_0x548286){return db[_0x5634('0x2d')][_0x5634('0x4b')]({'where':{'id':_0x16e651['params']['id']}})[_0x5634('0x42')](handleEntityNotFound(_0x548286,null))[_0x5634('0x42')](removeEntity(_0x548286,null))[_0x5634('0x46')](handleError(_0x548286,null));};exports['describe']=function(_0x45e0e0,_0x4d1783){return db[_0x5634('0x2d')][_0x5634('0x4e')]()['then'](respondWithResult(_0x4d1783,null))[_0x5634('0x46')](handleError(_0x4d1783,null));};exports[_0x5634('0x4f')]=function(_0x5f49d8,_0x29c2d2,_0x174dfe){return db[_0x5634('0x50')][_0x5634('0x22')]({'where':{'ChatGroupId':_0x5f49d8[_0x5634('0x48')]['id'],'ToId':_0x5f49d8[_0x5634('0x51')]['id'],'read':![]}})[_0x5634('0x42')](function(_0x122cf6){return{'id':_[_0x5634('0x52')](_0x5f49d8[_0x5634('0x48')]['id']),'count':_0x122cf6};})[_0x5634('0x42')](respondWithResult(_0x29c2d2,null))[_0x5634('0x46')](handleError(_0x29c2d2,null));};exports[_0x5634('0x53')]=function(_0x2747e1,_0x17b46c,_0x32872a){return db[_0x5634('0x2d')][_0x5634('0x4b')]({'where':{'id':_0x2747e1[_0x5634('0x48')]['id']}})[_0x5634('0x42')](handleEntityNotFound(_0x17b46c,null))['then'](function(_0x4ed54e){if(_0x4ed54e){return _0x4ed54e[_0x5634('0x53')](_0x2747e1[_0x5634('0x4d')]['ids'],_[_0x5634('0x54')](_0x2747e1[_0x5634('0x4d')],[_0x5634('0x55'),'id'])||{});}})[_0x5634('0x42')](respondWithResult(_0x17b46c,null))['catch'](handleError(_0x17b46c,null));};exports[_0x5634('0x56')]=function(_0xc6a111,_0x22be22,_0x2169a7){var _0x130a48={};var _0x55a463={};var _0xa549c1;var _0x284357;return db[_0x5634('0x2d')][_0x5634('0x57')]({'where':{'id':_0xc6a111[_0x5634('0x48')]['id']}})[_0x5634('0x42')](handleEntityNotFound(_0x22be22,null))[_0x5634('0x42')](function(_0x4fc9f2){if(_0x4fc9f2){_0xa549c1=_0x4fc9f2;_0x55a463['model']=_[_0x5634('0x31')](db['User']['rawAttributes']);_0x55a463['query']=_[_0x5634('0x31')](_0xc6a111[_0x5634('0x32')]);_0x55a463[_0x5634('0x33')]=_[_0x5634('0x34')](_0x55a463[_0x5634('0x35')],_0x55a463[_0x5634('0x32')]);_0x130a48['attributes']=_[_0x5634('0x34')](_0x55a463[_0x5634('0x35')],qs[_0x5634('0x36')](_0xc6a111[_0x5634('0x32')][_0x5634('0x36')]));_0x130a48['attributes']=_0x130a48[_0x5634('0x37')][_0x5634('0x49')]?_0x130a48[_0x5634('0x37')]:_0x55a463[_0x5634('0x35')];_0x130a48[_0x5634('0x3a')]=qs[_0x5634('0x3b')](_0xc6a111[_0x5634('0x32')][_0x5634('0x3b')]);_0x130a48['where']=qs[_0x5634('0x33')](_['pick'](_0xc6a111['query'],_0x55a463[_0x5634('0x33')]));if(_0xc6a111[_0x5634('0x32')]['filter']){_0x130a48[_0x5634('0x3e')]=_[_0x5634('0x3f')](_0x130a48[_0x5634('0x3e')],{'$or':_[_0x5634('0x2c')](_0x130a48[_0x5634('0x37')],function(_0x22a5f4){var _0x333c18={};_0x333c18[_0x22a5f4]={'$like':'%'+_0xc6a111[_0x5634('0x32')][_0x5634('0x3d')]+'%'};return _0x333c18;})});}_0x130a48=_['merge']({},_0x130a48,_0xc6a111[_0x5634('0x41')]);return _0xa549c1[_0x5634('0x56')](_0x130a48);}})[_0x5634('0x42')](function(_0x1a191f){if(_0x1a191f){_0x284357=_0x1a191f[_0x5634('0x49')];if(!_0xc6a111['query'][_0x5634('0x38')](_0x5634('0x39'))){_0x130a48[_0x5634('0x20')]=qs['limit'](_0xc6a111[_0x5634('0x32')][_0x5634('0x20')]);_0x130a48['offset']=qs[_0x5634('0x1f')](_0xc6a111[_0x5634('0x32')][_0x5634('0x1f')]);}return _0xa549c1[_0x5634('0x56')](_0x130a48);}})['then'](function(_0x5a067b){if(_0x5a067b){return _0x5a067b?{'count':_0x284357,'rows':_0x5a067b}:null;}})[_0x5634('0x42')](respondWithResult(_0x22be22,null))[_0x5634('0x46')](handleError(_0x22be22,null));};exports['removeMembers']=function(_0x3b4d92,_0x51042c,_0x249613){return db[_0x5634('0x2d')][_0x5634('0x4b')]({'where':{'id':_0x3b4d92[_0x5634('0x48')]['id']}})[_0x5634('0x42')](handleEntityNotFound(_0x51042c,null))[_0x5634('0x42')](function(_0x854663){if(_0x854663){return _0x854663[_0x5634('0x58')](_0x3b4d92['query'][_0x5634('0x55')]);}})['then'](respondWithStatusCode(_0x51042c,null))[_0x5634('0x46')](handleError(_0x51042c,null));};exports[_0x5634('0x59')]=function(_0x154679,_0x1ee527,_0x570b52){if(_0x154679[_0x5634('0x4d')]['id']){delete _0x154679[_0x5634('0x4d')]['id'];}return db['ChatGroup'][_0x5634('0x4b')]({'where':{'id':_0x154679[_0x5634('0x48')]['id']}})['then'](handleEntityNotFound(_0x1ee527,null))[_0x5634('0x42')](function(_0x1aa334){if(_0x1aa334){_0x154679['body'][_0x5634('0x5a')]=_0x1aa334['id'];return db[_0x5634('0x50')][_0x5634('0x4c')](_0x154679[_0x5634('0x4d')]);}})['then'](respondWithResult(_0x1ee527,null))['catch'](handleError(_0x1ee527,null));};exports[_0x5634('0x5b')]=function(_0x41b945,_0x464917,_0x13fab3){var _0x29a44f={};var _0x47c5cb={};var _0x478605;var _0x4d05f6;return db[_0x5634('0x2d')][_0x5634('0x57')]({'where':{'id':_0x41b945[_0x5634('0x48')]['id']}})[_0x5634('0x42')](handleEntityNotFound(_0x464917,null))[_0x5634('0x42')](function(_0x562471){if(_0x562471){_0x478605=_0x562471;_0x47c5cb[_0x5634('0x35')]=_['keys'](db['ChatInternalMessage'][_0x5634('0x2e')]);_0x47c5cb[_0x5634('0x32')]=_[_0x5634('0x31')](_0x41b945[_0x5634('0x32')]);_0x47c5cb[_0x5634('0x33')]=_[_0x5634('0x34')](_0x47c5cb[_0x5634('0x35')],_0x47c5cb['query']);_0x29a44f[_0x5634('0x37')]=_[_0x5634('0x34')](_0x47c5cb[_0x5634('0x35')],qs['fields'](_0x41b945[_0x5634('0x32')][_0x5634('0x36')]));_0x29a44f[_0x5634('0x37')]=_0x29a44f[_0x5634('0x37')][_0x5634('0x49')]?_0x29a44f[_0x5634('0x37')]:_0x47c5cb[_0x5634('0x35')];_0x29a44f['order']=qs['sort'](_0x41b945['query'][_0x5634('0x3b')]);_0x29a44f[_0x5634('0x3e')]=qs['filters'](_[_0x5634('0x3c')](_0x41b945['query'],_0x47c5cb[_0x5634('0x33')]));if(_0x41b945[_0x5634('0x32')][_0x5634('0x3d')]){_0x29a44f['where']=_[_0x5634('0x3f')](_0x29a44f['where'],{'$or':_[_0x5634('0x2c')](_0x29a44f[_0x5634('0x37')],function(_0xe0ba95){var _0x25f564={};_0x25f564[_0xe0ba95]={'$like':'%'+_0x41b945[_0x5634('0x32')][_0x5634('0x3d')]+'%'};return _0x25f564;})});}if(_0x41b945[_0x5634('0x32')][_0x5634('0x5c')]){var _0x21e667=_0x41b945[_0x5634('0x32')][_0x5634('0x5c')]['split'](',');var _0x50cba7={};_0x50cba7[_0x21e667[0x0]]={'$gte':moment(_0x21e667[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x29a44f[_0x5634('0x3e')]=_['merge'](_0x29a44f[_0x5634('0x3e')],_0x50cba7);}_0x29a44f=_['merge']({},_0x29a44f,_0x41b945[_0x5634('0x41')]);return _0x478605[_0x5634('0x5b')](_0x29a44f);}})[_0x5634('0x42')](function(_0x585a46){if(_0x585a46){_0x4d05f6=_0x585a46[_0x5634('0x49')];if(!_0x41b945[_0x5634('0x32')][_0x5634('0x38')](_0x5634('0x39'))){_0x29a44f[_0x5634('0x20')]=qs['limit'](_0x41b945[_0x5634('0x32')][_0x5634('0x20')]);_0x29a44f[_0x5634('0x1f')]=qs[_0x5634('0x1f')](_0x41b945[_0x5634('0x32')]['offset']);}return _0x478605['getMessages'](_0x29a44f);}})[_0x5634('0x42')](function(_0x32e8db){if(_0x32e8db){return _0x32e8db?{'count':_0x4d05f6,'rows':_0x32e8db}:null;}})[_0x5634('0x42')](respondWithResult(_0x464917,null))[_0x5634('0x46')](handleError(_0x464917,null));};
\ No newline at end of file
index 937d8f5..2af0ccf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb76b=['ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x301eb9,_0x42fc71){var _0x151e86=function(_0x5b3af0){while(--_0x5b3af0){_0x301eb9['push'](_0x301eb9['shift']());}};_0x151e86(++_0x42fc71);}(_0xb76b,0x12f));var _0xbb76=function(_0x272158,_0x23ddc8){_0x272158=_0x272158-0x0;var _0x103961=_0xb76b[_0x272158];return _0x103961;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xbb76('0x0'))['db'][_0xbb76('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xbb76('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbb76('0x3'),'afterDestroy':_0xbb76('0x4')};function emitEvent(_0x44a9e0){return function(_0x82d22d,_0x24ebfc,_0x429f00){ChatGroupEvents[_0xbb76('0x5')](_0x44a9e0+':'+_0x82d22d['id'],_0x82d22d);ChatGroupEvents[_0xbb76('0x5')](_0x44a9e0,_0x82d22d);_0x429f00(null);};}for(var e in events){if(events[_0xbb76('0x6')](e)){var event=events[e];ChatGroup[_0xbb76('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents;
\ No newline at end of file
+var _0x5659=['emit','hook','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x4f032e,_0xd4d2dd){var _0x5bea23=function(_0x56a309){while(--_0x56a309){_0x4f032e['push'](_0x4f032e['shift']());}};_0x5bea23(++_0xd4d2dd);}(_0x5659,0x168));var _0x9565=function(_0x29ef06,_0x3e54b7){_0x29ef06=_0x29ef06-0x0;var _0x57bd49=_0x5659[_0x29ef06];return _0x57bd49;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x9565('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9565('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9565('0x2'),'afterDestroy':_0x9565('0x3')};function emitEvent(_0x502cd9){return function(_0xda6bac,_0x46e5c8,_0x30bd31){ChatGroupEvents['emit'](_0x502cd9+':'+_0xda6bac['id'],_0xda6bac);ChatGroupEvents[_0x9565('0x4')](_0x502cd9,_0xda6bac);_0x30bd31(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x9565('0x5')](e,emitEvent(event));}}module[_0x9565('0x6')]=ChatGroupEvents;
\ No newline at end of file
index 22e9890..f033dc2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xacea=['bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','api','moment'];(function(_0x42d4e8,_0xb7d096){var _0x33a502=function(_0x2561ec){while(--_0x2561ec){_0x42d4e8['push'](_0x42d4e8['shift']());}};_0x33a502(++_0xb7d096);}(_0xacea,0xd5));var _0xaace=function(_0x18bce5,_0x390f32){_0x18bce5=_0x18bce5-0x0;var _0x27d67e=_0xacea[_0x18bce5];return _0x27d67e;};'use strict';var _=require('lodash');var util=require(_0xaace('0x0'));var logger=require('../../config/logger')(_0xaace('0x1'));var moment=require(_0xaace('0x2'));var BPromise=require(_0xaace('0x3'));var rp=require(_0xaace('0x4'));var fs=require('fs');var path=require(_0xaace('0x5'));var rimraf=require(_0xaace('0x6'));var config=require('../../config/environment');var attributes=require(_0xaace('0x7'));module[_0xaace('0x8')]=function(_0x2fd94f,_0x18e989){return _0x2fd94f[_0xaace('0x9')](_0xaace('0xa'),attributes,{'tableName':_0xaace('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x946f=['moment','bluebird','request-promise','path','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x946f,0x122));var _0xf946=function(_0x379515,_0x384703){_0x379515=_0x379515-0x0;var _0x9ce711=_0x946f[_0x379515];return _0x9ce711;};'use strict';var _=require(_0xf946('0x0'));var util=require(_0xf946('0x1'));var logger=require(_0xf946('0x2'))(_0xf946('0x3'));var moment=require(_0xf946('0x4'));var BPromise=require(_0xf946('0x5'));var rp=require(_0xf946('0x6'));var fs=require('fs');var path=require(_0xf946('0x7'));var rimraf=require('rimraf');var config=require(_0xf946('0x8'));var attributes=require(_0xf946('0x9'));module[_0xf946('0xa')]=function(_0x303546,_0x5ac779){return _0x303546[_0xf946('0xb')](_0xf946('0xc'),attributes,{'tableName':_0xf946('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index deabcc7..903a212 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb620=['then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','request'];(function(_0x2a45fa,_0x1d223f){var _0x945a57=function(_0x38b64d){while(--_0x38b64d){_0x2a45fa['push'](_0x2a45fa['shift']());}};_0x945a57(++_0x1d223f);}(_0xb620,0x1a0));var _0x0b62=function(_0x58147b,_0x1213a7){_0x58147b=_0x58147b-0x0;var _0x3c9917=_0xb620[_0x58147b];return _0x3c9917;};'use strict';var _=require(_0x0b62('0x0'));var util=require('util');var moment=require(_0x0b62('0x1'));var BPromise=require(_0x0b62('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b62('0x3'));var db=require(_0x0b62('0x4'))['db'];var utils=require(_0x0b62('0x5'));var logger=require(_0x0b62('0x6'))(_0x0b62('0x7'));var config=require(_0x0b62('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0b62('0x9')][_0x0b62('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0b62('0xb')],{'host':_0x0b62('0xc'),'port':0x18eb});var socket=require(_0x0b62('0xd'))(new Redis(config[_0x0b62('0xb')]));require(_0x0b62('0xe'))['register'](socket);function respondWithRpcPromise(_0x241af5,_0x22c738,_0xa9962){return new BPromise(function(_0x26bfee,_0x58ec0c){return client[_0x0b62('0xf')](_0x241af5,_0xa9962)[_0x0b62('0x10')](function(_0x38e82d){logger[_0x0b62('0x11')](_0x0b62('0x12'),_0x22c738,_0x0b62('0x13'));logger[_0x0b62('0x14')](_0x0b62('0x15'),_0x22c738,_0x0b62('0x13'),JSON[_0x0b62('0x16')](_0x38e82d));if(_0x38e82d['error']){if(_0x38e82d[_0x0b62('0x17')][_0x0b62('0x18')]===0x1f4){logger['error'](_0x0b62('0x12'),_0x22c738,_0x38e82d[_0x0b62('0x17')]['message']);return _0x58ec0c(_0x38e82d['error'][_0x0b62('0x19')]);}logger[_0x0b62('0x17')](_0x0b62('0x12'),_0x22c738,_0x38e82d['error'][_0x0b62('0x19')]);return _0x26bfee(_0x38e82d[_0x0b62('0x17')]['message']);}else{logger[_0x0b62('0x11')](_0x0b62('0x12'),_0x22c738,'request\x20sent');_0x26bfee(_0x38e82d[_0x0b62('0x1a')][_0x0b62('0x19')]);}})['catch'](function(_0x47bd5c){logger[_0x0b62('0x17')](_0x0b62('0x12'),_0x22c738,_0x47bd5c);_0x58ec0c(_0x47bd5c);});});}
\ No newline at end of file
+var _0x9491=['../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x6ae7d0,_0x3c0b9b){var _0x3c5485=function(_0x44e3e9){while(--_0x44e3e9){_0x6ae7d0['push'](_0x6ae7d0['shift']());}};_0x3c5485(++_0x3c0b9b);}(_0x9491,0xb6));var _0x1949=function(_0x5ba0b1,_0x21231b){_0x5ba0b1=_0x5ba0b1-0x0;var _0x430e3e=_0x9491[_0x5ba0b1];return _0x430e3e;};'use strict';var _=require(_0x1949('0x0'));var util=require(_0x1949('0x1'));var moment=require(_0x1949('0x2'));var BPromise=require(_0x1949('0x3'));var rs=require(_0x1949('0x4'));var fs=require('fs');var Redis=require(_0x1949('0x5'));var db=require(_0x1949('0x6'))['db'];var utils=require(_0x1949('0x7'));var logger=require(_0x1949('0x8'))(_0x1949('0x9'));var config=require('../../config/environment');var jayson=require(_0x1949('0xa'));var client=jayson['client'][_0x1949('0xb')]({'port':0x232a});config[_0x1949('0xc')]=_['defaults'](config[_0x1949('0xc')],{'host':_0x1949('0xd'),'port':0x18eb});var socket=require(_0x1949('0xe'))(new Redis(config[_0x1949('0xc')]));require(_0x1949('0xf'))[_0x1949('0x10')](socket);function respondWithRpcPromise(_0x236585,_0x34140a,_0x3b7381){return new BPromise(function(_0x73e0fc,_0x2e0516){return client['request'](_0x236585,_0x3b7381)[_0x1949('0x11')](function(_0x3b3e9f){logger[_0x1949('0x12')](_0x1949('0x13'),_0x34140a,_0x1949('0x14'));logger[_0x1949('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x34140a,_0x1949('0x14'),JSON['stringify'](_0x3b3e9f));if(_0x3b3e9f['error']){if(_0x3b3e9f[_0x1949('0x16')][_0x1949('0x17')]===0x1f4){logger[_0x1949('0x16')]('ChatGroup,\x20%s,\x20%s',_0x34140a,_0x3b3e9f[_0x1949('0x16')][_0x1949('0x18')]);return _0x2e0516(_0x3b3e9f[_0x1949('0x16')]['message']);}logger['error'](_0x1949('0x13'),_0x34140a,_0x3b3e9f[_0x1949('0x16')][_0x1949('0x18')]);return _0x73e0fc(_0x3b3e9f['error'][_0x1949('0x18')]);}else{logger[_0x1949('0x12')]('ChatGroup,\x20%s,\x20%s',_0x34140a,_0x1949('0x14'));_0x73e0fc(_0x3b3e9f[_0x1949('0x19')][_0x1949('0x18')]);}})[_0x1949('0x1a')](function(_0x32b91f){logger[_0x1949('0x16')](_0x1949('0x13'),_0x34140a,_0x32b91f);_0x2e0516(_0x32b91f);});});}
\ No newline at end of file
index 19819bf..6f1de99 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7657=['save','remove','update','emit','register','length','chatGroup:','./chatGroup.events'];(function(_0x3b2b4f,_0xfd0775){var _0x187e5d=function(_0x25f6fc){while(--_0x25f6fc){_0x3b2b4f['push'](_0x3b2b4f['shift']());}};_0x187e5d(++_0xfd0775);}(_0x7657,0x18f));var _0x7765=function(_0x2db868,_0x1fc7fa){_0x2db868=_0x2db868-0x0;var _0x481704=_0x7657[_0x2db868];return _0x481704;};'use strict';var ChatGroupEvents=require(_0x7765('0x0'));var events=[_0x7765('0x1'),_0x7765('0x2'),_0x7765('0x3')];function createListener(_0x26a023,_0x185834){return function(_0x2818c2){_0x185834[_0x7765('0x4')](_0x26a023,_0x2818c2);};}function removeListener(_0x370e50,_0x5da34e){return function(){ChatGroupEvents['removeListener'](_0x370e50,_0x5da34e);};}exports[_0x7765('0x5')]=function(_0x1e248f){for(var _0x520d3c=0x0,_0x13a998=events[_0x7765('0x6')];_0x520d3c<_0x13a998;_0x520d3c++){var _0x31084b=events[_0x520d3c];var _0x3b63a9=createListener(_0x7765('0x7')+_0x31084b,_0x1e248f);ChatGroupEvents['on'](_0x31084b,_0x3b63a9);}};
\ No newline at end of file
+var _0xbcb5=['removeListener','register','chatGroup:','./chatGroup.events','remove','emit'];(function(_0x34d8b2,_0x55f16c){var _0x6c8fa3=function(_0xb8034b){while(--_0xb8034b){_0x34d8b2['push'](_0x34d8b2['shift']());}};_0x6c8fa3(++_0x55f16c);}(_0xbcb5,0x13b));var _0x5bcb=function(_0x7a310e,_0xdfd6){_0x7a310e=_0x7a310e-0x0;var _0x48b666=_0xbcb5[_0x7a310e];return _0x48b666;};'use strict';var ChatGroupEvents=require(_0x5bcb('0x0'));var events=['save',_0x5bcb('0x1'),'update'];function createListener(_0x576071,_0x4af254){return function(_0x186049){_0x4af254[_0x5bcb('0x2')](_0x576071,_0x186049);};}function removeListener(_0x1b7ff4,_0x523d68){return function(){ChatGroupEvents[_0x5bcb('0x3')](_0x1b7ff4,_0x523d68);};}exports[_0x5bcb('0x4')]=function(_0x464b3b){for(var _0x2bce05=0x0,_0x433420=events['length'];_0x2bce05<_0x433420;_0x2bce05++){var _0x516dd2=events[_0x2bce05];var _0x2e1130=createListener(_0x5bcb('0x5')+_0x516dd2,_0x464b3b);ChatGroupEvents['on'](_0x516dd2,_0x2e1130);}};
\ No newline at end of file
index e97cd72..5938fad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf83d=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','/describe','isAuthenticated','describe','getUnread','/:id/members','getMessages','post','create','addMembers','/:id/messages','put','/:id','update','delete','destroy','removeMembers'];(function(_0x4f8c09,_0x2e8f08){var _0x48ed3d=function(_0x27c509){while(--_0x27c509){_0x4f8c09['push'](_0x4f8c09['shift']());}};_0x48ed3d(++_0x2e8f08);}(_0xf83d,0xf4));var _0xdf83=function(_0x5ba638,_0x1f7389){_0x5ba638=_0x5ba638-0x0;var _0x3c5ded=_0xf83d[_0x5ba638];return _0x3c5ded;};'use strict';var multer=require(_0xdf83('0x0'));var util=require(_0xdf83('0x1'));var path=require(_0xdf83('0x2'));var timeout=require(_0xdf83('0x3'));var express=require(_0xdf83('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdf83('0x5'));var interaction=require(_0xdf83('0x6'));var config=require(_0xdf83('0x7'));var controller=require(_0xdf83('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xdf83('0x9')](_0xdf83('0xa'),auth[_0xdf83('0xb')](),controller[_0xdf83('0xc')]);router['get']('/:id',auth[_0xdf83('0xb')](),controller['show']);router['get']('/:id/unread',auth[_0xdf83('0xb')](),controller[_0xdf83('0xd')]);router[_0xdf83('0x9')](_0xdf83('0xe'),auth[_0xdf83('0xb')](),controller['getMembers']);router[_0xdf83('0x9')]('/:id/messages',auth[_0xdf83('0xb')](),controller[_0xdf83('0xf')]);router[_0xdf83('0x10')]('/',auth[_0xdf83('0xb')](),controller[_0xdf83('0x11')]);router[_0xdf83('0x10')](_0xdf83('0xe'),auth[_0xdf83('0xb')](),controller[_0xdf83('0x12')]);router[_0xdf83('0x10')](_0xdf83('0x13'),auth[_0xdf83('0xb')](),controller['addMessage']);router[_0xdf83('0x14')](_0xdf83('0x15'),auth[_0xdf83('0xb')](),controller[_0xdf83('0x16')]);router[_0xdf83('0x17')](_0xdf83('0x15'),auth[_0xdf83('0xb')](),controller[_0xdf83('0x18')]);router[_0xdf83('0x17')](_0xdf83('0xe'),auth[_0xdf83('0xb')](),controller[_0xdf83('0x19')]);module[_0xdf83('0x1a')]=router;
\ No newline at end of file
+var _0xc84d=['destroy','removeMembers','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','describe','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','/:id','update','delete'];(function(_0x393500,_0x1037af){var _0x120d3b=function(_0x17234e){while(--_0x17234e){_0x393500['push'](_0x393500['shift']());}};_0x120d3b(++_0x1037af);}(_0xc84d,0x7f));var _0xdc84=function(_0x43a29f,_0x2c3e6e){_0x43a29f=_0x43a29f-0x0;var _0x18a199=_0xc84d[_0x43a29f];return _0x18a199;};'use strict';var multer=require(_0xdc84('0x0'));var util=require(_0xdc84('0x1'));var path=require(_0xdc84('0x2'));var timeout=require(_0xdc84('0x3'));var express=require('express');var router=express[_0xdc84('0x4')]();var fs_extra=require(_0xdc84('0x5'));var auth=require(_0xdc84('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc84('0x7'));var controller=require(_0xdc84('0x8'));router[_0xdc84('0x9')]('/',auth[_0xdc84('0xa')](),controller['index']);router[_0xdc84('0x9')](_0xdc84('0xb'),auth[_0xdc84('0xa')](),controller[_0xdc84('0xc')]);router[_0xdc84('0x9')]('/:id',auth[_0xdc84('0xa')](),controller[_0xdc84('0xd')]);router['get'](_0xdc84('0xe'),auth[_0xdc84('0xa')](),controller[_0xdc84('0xf')]);router[_0xdc84('0x9')](_0xdc84('0x10'),auth[_0xdc84('0xa')](),controller[_0xdc84('0x11')]);router[_0xdc84('0x9')](_0xdc84('0x12'),auth[_0xdc84('0xa')](),controller[_0xdc84('0x13')]);router[_0xdc84('0x14')]('/',auth['isAuthenticated'](),controller[_0xdc84('0x15')]);router[_0xdc84('0x14')](_0xdc84('0x10'),auth[_0xdc84('0xa')](),controller[_0xdc84('0x16')]);router[_0xdc84('0x14')](_0xdc84('0x12'),auth[_0xdc84('0xa')](),controller[_0xdc84('0x17')]);router[_0xdc84('0x18')](_0xdc84('0x19'),auth[_0xdc84('0xa')](),controller[_0xdc84('0x1a')]);router[_0xdc84('0x1b')](_0xdc84('0x19'),auth['isAuthenticated'](),controller[_0xdc84('0x1c')]);router['delete'](_0xdc84('0x10'),auth[_0xdc84('0xa')](),controller[_0xdc84('0x1d')]);module[_0xdc84('0x1e')]=router;
\ No newline at end of file
index 28d1bdb..86d7a36 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa149=['sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long'];(function(_0x48ba24,_0xfd0aa6){var _0x470beb=function(_0x9ee961){while(--_0x9ee961){_0x48ba24['push'](_0x48ba24['shift']());}};_0x470beb(++_0xfd0aa6);}(_0xa149,0x18c));var _0x9a14=function(_0x14f587,_0x51822a){_0x14f587=_0x14f587-0x0;var _0x624dfb=_0xa149[_0x14f587];return _0x624dfb;};'use strict';var Sequelize=require(_0x9a14('0x0'));module[_0x9a14('0x1')]={'closed':{'type':Sequelize[_0x9a14('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x9a14('0x3')]},'ratingType':{'type':Sequelize[_0x9a14('0x4')](_0x9a14('0x5'),_0x9a14('0x6')),'defaultValue':_0x9a14('0x5')},'ratingMessage':{'type':Sequelize[_0x9a14('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x9a14('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x9a14('0x9')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9a14('0x8')]},'thirdDisposition':{'type':Sequelize[_0x9a14('0x8')]},'note':{'type':Sequelize[_0x9a14('0x8')]},'browserName':{'type':Sequelize[_0x9a14('0x8')]},'browserVersion':{'type':Sequelize[_0x9a14('0x8')]},'osName':{'type':Sequelize[_0x9a14('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x9a14('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x9a14('0x8')]},'referer':{'type':Sequelize[_0x9a14('0x7')]},'customerIp':{'type':Sequelize[_0x9a14('0x8')]},'formData':{'type':Sequelize[_0x9a14('0x7')](_0x9a14('0xa'))},'read1stAt':{'type':Sequelize[_0x9a14('0x9')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x9a14('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x9a14('0x7')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
+var _0x3870=['thumb','star','TEXT','STRING','DATE','long','sequelize','exports','BOOLEAN','ENUM'];(function(_0x2e8a4d,_0x3b2b1f){var _0x30a06e=function(_0x3ffa8e){while(--_0x3ffa8e){_0x2e8a4d['push'](_0x2e8a4d['shift']());}};_0x30a06e(++_0x3b2b1f);}(_0x3870,0x146));var _0x0387=function(_0x273b24,_0x2fdea7){_0x273b24=_0x273b24-0x0;var _0x17597d=_0x3870[_0x273b24];return _0x17597d;};'use strict';var Sequelize=require(_0x0387('0x0'));module[_0x0387('0x1')]={'closed':{'type':Sequelize[_0x0387('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x0387('0x3')]('star',_0x0387('0x4')),'defaultValue':_0x0387('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x0387('0x6')]},'mailTranscript':{'type':Sequelize[_0x0387('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x0387('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0387('0x7')]},'thirdDisposition':{'type':Sequelize[_0x0387('0x7')]},'note':{'type':Sequelize[_0x0387('0x7')]},'browserName':{'type':Sequelize[_0x0387('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x0387('0x7')]},'osVersion':{'type':Sequelize[_0x0387('0x7')]},'deviceModel':{'type':Sequelize[_0x0387('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x0387('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x0387('0x6')](_0x0387('0x9'))},'read1stAt':{'type':Sequelize[_0x0387('0x8')]},'lastMsgAt':{'type':Sequelize[_0x0387('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x0387('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x0387('0x7')]},'customerPort':{'type':Sequelize[_0x0387('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x0387('0x6')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
index 3c1d13d..3d25c34 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa8a8=['map','fullname','TagIds','Tags','push','talking','answered','unmanaged','abandoned','total','closed','waiting','disposition','UserId','ChatInteraction','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','conditions','find','unreadMessages','value','having','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','count','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','includeAll','options','create','params','destroy','describe','createVidaooSession','findOne','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','POST','follow','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','join','root','server/files/attachments/','download','server/files/chat/upload/','transcript-%s.txt','now','Messages','agentAlias','customer','format','%s%d','Visitor','agentIdentifier','website_alias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','ChatMessage','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','include','getMyMessages','findAll','setTags','chatInteractionTags:save','removeTags','server','attachments','transcript-%d-%s.zip','firstName','lastName','ChatWebsite','Account','Owner','mkdirSync','Chat','N.A.','closedAt','browserName','referer','customerPort','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','set','update','stack','render','merge','body','contact','agent','interaction','account','Users'];(function(_0x2457d6,_0x35391c){var _0x565322=function(_0x519364){while(--_0x519364){_0x2457d6['push'](_0x2457d6['shift']());}};_0x565322(++_0x35391c);}(_0xa8a8,0xec));var _0x8a8a=function(_0x108b2b,_0x1c5a7a){_0x108b2b=_0x108b2b-0x0;var _0x1fa69=_0xa8a8[_0x108b2b];return _0x1fa69;};'use strict';var rimraf=require(_0x8a8a('0x0'));var zipdir=require(_0x8a8a('0x1'));var rp=require(_0x8a8a('0x2'));var moment=require(_0x8a8a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8a8a('0x4'));var util=require(_0x8a8a('0x5'));var path=require(_0x8a8a('0x6'));var ejs=require(_0x8a8a('0x7'));var fs=require('fs');var _=require(_0x8a8a('0x8'));var squel=require(_0x8a8a('0x9'));var Redis=require(_0x8a8a('0xa'));var qs=require(_0x8a8a('0xb'));var as=require(_0x8a8a('0xc'));var pdf=require(_0x8a8a('0xd'));var logger=require(_0x8a8a('0xe'))(_0x8a8a('0xf'));var config=require(_0x8a8a('0x10'));var db=require(_0x8a8a('0x11'))['db'];config[_0x8a8a('0x12')]=_['defaults'](config['redis'],{'host':_0x8a8a('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8a8a('0x12')]));require(_0x8a8a('0x14'))['register'](socket);var jayson=require(_0x8a8a('0x15'));var client=jayson[_0x8a8a('0x16')][_0x8a8a('0x17')]({'port':0x232b});var client9004=jayson['client'][_0x8a8a('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x42fab7,_0x330796,_0x234481,_0x4a1b91){return new BPromise(function(_0x23febf,_0x4e5d74){var _0x25e1d5=_0x4a1b91||client;return _0x25e1d5[_0x8a8a('0x18')](_0x42fab7,_0x234481)[_0x8a8a('0x19')](function(_0x2f6e33){logger[_0x8a8a('0x1a')](_0x8a8a('0x1b'),_0x330796,_0x8a8a('0x1c'));logger['debug'](_0x8a8a('0x1d'),_0x330796,'request\x20sent',JSON[_0x8a8a('0x1e')](_0x2f6e33));if(_0x2f6e33[_0x8a8a('0x1f')]){if(_0x2f6e33[_0x8a8a('0x1f')][_0x8a8a('0x20')]===0x1f4){logger[_0x8a8a('0x1f')]('ChatInteraction,\x20%s,\x20%s',_0x330796,_0x2f6e33[_0x8a8a('0x1f')][_0x8a8a('0x21')]);return _0x4e5d74(_0x2f6e33[_0x8a8a('0x1f')][_0x8a8a('0x21')]);}logger[_0x8a8a('0x1f')](_0x8a8a('0x1b'),_0x330796,_0x2f6e33['error']['message']);return _0x23febf(_0x2f6e33['error']['message']);}else{logger['info'](_0x8a8a('0x1b'),_0x330796,_0x8a8a('0x1c'));_0x23febf(_0x2f6e33[_0x8a8a('0x22')][_0x8a8a('0x21')]);}})[_0x8a8a('0x23')](function(_0x2f6af2){logger[_0x8a8a('0x1f')](_0x8a8a('0x1b'),_0x330796,_0x2f6af2);_0x4e5d74(_0x2f6af2);});});}function respondWithStatusCode(_0x25d5d4,_0x2deecb){_0x2deecb=_0x2deecb||0xcc;return function(_0xb9db78){if(_0xb9db78){return _0x25d5d4[_0x8a8a('0x24')](_0x2deecb);}return _0x25d5d4[_0x8a8a('0x25')](_0x2deecb)[_0x8a8a('0x26')]();};}function respondWithResult(_0x442c00,_0x545a38){_0x545a38=_0x545a38||0xc8;return function(_0x3c096f){if(_0x3c096f){return _0x442c00[_0x8a8a('0x25')](_0x545a38)[_0x8a8a('0x27')](_0x3c096f);}};}function respondWithFilteredResult(_0x7662e,_0x36e6d4){return function(_0x251315){if(_0x251315){var _0x3aa46d=typeof _0x36e6d4['offset']===_0x8a8a('0x28')&&typeof _0x36e6d4[_0x8a8a('0x29')]===_0x8a8a('0x28');var _0x54ff7e=_0x251315['count'];var _0x2dafcd=_0x3aa46d?0x0:_0x36e6d4[_0x8a8a('0x2a')];var _0x5c70bd=_0x3aa46d?_0x251315['count']:_0x36e6d4['offset']+_0x36e6d4[_0x8a8a('0x29')];var _0x5c7e58;if(_0x5c70bd>=_0x54ff7e){_0x5c70bd=_0x54ff7e;_0x5c7e58=0xc8;}else{_0x5c7e58=0xce;}_0x7662e[_0x8a8a('0x25')](_0x5c7e58);return _0x7662e[_0x8a8a('0x2b')]('Content-Range',_0x2dafcd+'-'+_0x5c70bd+'/'+_0x54ff7e)[_0x8a8a('0x27')](_0x251315);}return null;};}function saveUpdates(_0x2c8f27){return function(_0x250852){if(_0x250852){return _0x250852[_0x8a8a('0x2c')](_0x2c8f27)[_0x8a8a('0x19')](function(_0x3d6594){return _0x3d6594;});}return null;};}function removeEntity(_0x3e73b1){return function(_0x2a2917){if(_0x2a2917){return _0x2a2917['destroy']()['then'](function(){_0x3e73b1['status'](0xcc)[_0x8a8a('0x26')]();});}};}function handleEntityNotFound(_0x3bf77d){return function(_0x5f301e){if(!_0x5f301e){_0x3bf77d[_0x8a8a('0x24')](0x194);}return _0x5f301e;};}function handleError(_0x304e83,_0x481e92){_0x481e92=_0x481e92||0x1f4;return function(_0x3abab2){logger[_0x8a8a('0x1f')](_0x3abab2[_0x8a8a('0x2d')]);if(_0x3abab2['name']){delete _0x3abab2['name'];}_0x304e83[_0x8a8a('0x25')](_0x481e92)['send'](_0x3abab2);};}function getMustacheRender(_0x2a3198,_0x3a4aa6){return Mustache[_0x8a8a('0x2e')](_0x2a3198,_[_0x8a8a('0x2f')](_0x3a4aa6[_0x8a8a('0x30')],{'contact':_0x3a4aa6[_0x8a8a('0x31')],'message':_0x3a4aa6[_0x8a8a('0x21')],'agent':_0x3a4aa6[_0x8a8a('0x32')],'interaction':_0x3a4aa6[_0x8a8a('0x33')],'account':_0x3a4aa6[_0x8a8a('0x34')]}))||'';}function getInteractionUsers(_0x27de26,_0x45ddb4){return new BPromise(function(_0x17a36c,_0x37e644){try{if(_0x45ddb4[_0x27de26['id']]){_0x27de26[_0x8a8a('0x35')]=_[_0x8a8a('0x36')](_0x45ddb4[_0x27de26['id']],function(_0x8e3017){return{'id':_0x8e3017['id'],'fullname':_0x8e3017[_0x8a8a('0x37')]};});}}catch(_0x4c8003){_0x37e644(_0x4c8003);}_0x17a36c(_0x27de26);});}function getInteractionTags(_0x4cc605,_0x53da01){return new BPromise(function(_0x34db33,_0x9e0128){try{if(_0x4cc605[_0x8a8a('0x38')]){_0x4cc605[_0x8a8a('0x39')]=[];_0x4cc605[_0x8a8a('0x38')]['split'](',')['forEach'](function(_0x8d8481){_0x4cc605['Tags'][_0x8a8a('0x3a')](_0x53da01[_0x8d8481]);});}delete _0x4cc605['TagIds'];}catch(_0x52811b){_0x9e0128(_0x52811b);}_0x34db33(_0x4cc605);});}function updateChatInteraction(_0x1b33eb,_0x1ac761,_0x285e2c){return new BPromise(function(_0x19d41d,_0x31307c){return getInteractionUsers(_0x1b33eb,_0x285e2c)[_0x8a8a('0x19')](function(_0x20584a){return getInteractionTags(_0x20584a,_0x1ac761);})['then'](function(_0x40d509){return getStateInteraction(_0x40d509);})[_0x8a8a('0x19')](function(_0x46edea){_0x19d41d(_0x46edea);})['catch'](function(_0x3a4662){_0x31307c(_0x3a4662);});});}function getStateInteraction(_0x323f89){return new BPromise(function(_0x3f845e){_0x323f89['waiting']=0x0;_0x323f89[_0x8a8a('0x3b')]=0x0;_0x323f89[_0x8a8a('0x3c')]=0x0;_0x323f89[_0x8a8a('0x3d')]=0x0;_0x323f89[_0x8a8a('0x3e')]=0x0;_0x323f89[_0x8a8a('0x3f')]=0x0;if(!_0x323f89[_0x8a8a('0x40')]&&!_0x323f89['UserId']){_0x323f89['waiting']+=0x1;}if(!_0x323f89[_0x8a8a('0x40')]&&_0x323f89['UserId']){_0x323f89[_0x8a8a('0x3b')]+=0x1;if(_0x323f89[_0x8a8a('0x41')]){_0x323f89['waiting']-=0x1;}}if(_0x323f89['closed']&&_0x323f89[_0x8a8a('0x42')]===_0x8a8a('0x3e')){_0x323f89[_0x8a8a('0x3e')]+=0x1;if(_0x323f89[_0x8a8a('0x41')]){_0x323f89['waiting']-=0x1;}}else if(_0x323f89[_0x8a8a('0x40')]&&!_0x323f89['UserId']&&_0x323f89[_0x8a8a('0x42')]){_0x323f89[_0x8a8a('0x3d')]+=0x1;if(_0x323f89['waiting']){_0x323f89[_0x8a8a('0x41')]-=0x1;}}else if(_0x323f89[_0x8a8a('0x40')]&&_0x323f89[_0x8a8a('0x43')]){_0x323f89['answered']+=0x1;if(_0x323f89[_0x8a8a('0x3b')]){_0x323f89[_0x8a8a('0x3b')]-=0x1;}}_0x323f89[_0x8a8a('0x3f')]+=0x1;_0x3f845e(_0x323f89);});}exports['index']=function(_0x5466d4,_0x44aed3){var _0x1eb8bf={},_0x1b842a={},_0x5c6c98={'count':0x0,'rows':[]};var _0x18449b=_[_0x8a8a('0x36')](db[_0x8a8a('0x44')][_0x8a8a('0x45')],function(_0x2d4c11){return{'name':_0x2d4c11[_0x8a8a('0x46')],'type':_0x2d4c11[_0x8a8a('0x47')][_0x8a8a('0x48')]};});_0x1b842a[_0x8a8a('0x49')]=_[_0x8a8a('0x36')](_0x18449b,_0x8a8a('0x4a'));_0x1b842a['query']=_[_0x8a8a('0x4b')](_0x5466d4[_0x8a8a('0x4c')]);_0x1b842a[_0x8a8a('0x4d')]=_[_0x8a8a('0x4e')](_0x1b842a[_0x8a8a('0x49')],_0x1b842a[_0x8a8a('0x4c')]);_0x1eb8bf['attributes']=_[_0x8a8a('0x4e')](_0x1b842a[_0x8a8a('0x49')],qs[_0x8a8a('0x4f')](_0x5466d4[_0x8a8a('0x4c')]['fields']));_0x1eb8bf[_0x8a8a('0x50')]=_0x1eb8bf[_0x8a8a('0x50')][_0x8a8a('0x51')]?_0x1eb8bf['attributes']:_0x1b842a['model'];if(!_0x5466d4[_0x8a8a('0x4c')][_0x8a8a('0x52')](_0x8a8a('0x53'))){_0x1eb8bf[_0x8a8a('0x29')]=qs[_0x8a8a('0x29')](_0x5466d4[_0x8a8a('0x4c')][_0x8a8a('0x29')]);_0x1eb8bf[_0x8a8a('0x2a')]=qs[_0x8a8a('0x2a')](_0x5466d4['query']['offset']);}_0x1eb8bf[_0x8a8a('0x54')]=qs[_0x8a8a('0x55')](_0x5466d4['query']['sort']);_0x1eb8bf[_0x8a8a('0x56')]=qs['filters'](_[_0x8a8a('0x57')](_0x5466d4['query'],_0x1b842a[_0x8a8a('0x4d')]),_0x18449b);var _0xa2b8a1=[];var _0x339be6=squel[_0x8a8a('0x58')]()[_0x8a8a('0x59')]('id')[_0x8a8a('0x59')](_0x8a8a('0x4a'))[_0x8a8a('0x59')](_0x8a8a('0x5a'))[_0x8a8a('0x5b')]('tools_tags');var _0x329bfb=squel[_0x8a8a('0x58')]()[_0x8a8a('0x59')](_0x8a8a('0x5c'))[_0x8a8a('0x59')]('u.fullname')[_0x8a8a('0x59')](_0x8a8a('0x5d'))['from']('user_has_chat_interactions','ui')[_0x8a8a('0x5e')](_0x8a8a('0x5f'),'u',_0x8a8a('0x60'));var _0x2ba3bf=squel[_0x8a8a('0x58')]()[_0x8a8a('0x5b')]('chat_interactions','i')['left_join']('cm_contacts','c',_0x8a8a('0x61'))['left_join'](_0x8a8a('0x5f'),'o',_0x8a8a('0x62'))['left_join'](_0x8a8a('0x63'),'a',_0x8a8a('0x64'))[_0x8a8a('0x5e')](_0x8a8a('0x65'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x8a8a('0x5e')]('chat_interaction_has_tags','it',_0x8a8a('0x66'))[_0x8a8a('0x5e')]('tools_tags','t',_0x8a8a('0x67'));var _0x101543=squel[_0x8a8a('0x68')]();var _0x183015=[];var _0x50b5c5=squel[_0x8a8a('0x68')]();var _0x37a9bb;if(_0x5466d4[_0x8a8a('0x4c')]['search']){_0x37a9bb=as['parseSearch'](_0x5466d4[_0x8a8a('0x4c')]['search']);var _0x5a34a6=_0x37a9bb['sqlOperator'];for(var _0x395564=0x0;_0x395564<_0x37a9bb[_0x8a8a('0x69')]['length'];_0x395564++){var _0x3f9377=_0x37a9bb['conditions'][_0x395564];var _0x4aa202='i';var _0x142ba6=_[_0x8a8a('0x6a')](_0x18449b,['name',_0x3f9377[_0x8a8a('0x59')]]);if(!_0x142ba6){switch(_0x3f9377[_0x8a8a('0x59')]){case _0x8a8a('0x6b'):if(_0x3f9377[_0x8a8a('0x6c')]==0x1){_0x2ba3bf[_0x8a8a('0x6d')]('`'+_0x3f9377[_0x8a8a('0x59')]+'`\x20=\x200');}else{_0x2ba3bf[_0x8a8a('0x6d')]('`'+_0x3f9377[_0x8a8a('0x59')]+'`\x20>\x200');}break;case _0x8a8a('0x6e'):if(_0x3f9377[_0x8a8a('0x6f')]===_0x8a8a('0x70')){if(_0x3f9377[_0x8a8a('0x6c')][_0x8a8a('0x71')]('\x20')[_0x8a8a('0x51')]>0x1){_0x101543[_0x5a34a6](_0x8a8a('0x72'),qs[_0x8a8a('0x73')](_0x3f9377[_0x8a8a('0x6c')]),null);}else{var _0x176ad3='%'+_0x3f9377['value']+'%';_0x101543[_0x5a34a6](_0x8a8a('0x74'),_0x176ad3,_0x176ad3,_0x176ad3);}}else{_0x142ba6=_[_0x8a8a('0x6a')](_0x18449b,['name',_0x8a8a('0x75')]);_0x3f9377[_0x8a8a('0x59')]=_0x8a8a('0x75');_0x33f5c8=as[_0x8a8a('0x76')](_0x4aa202,_0x142ba6[_0x8a8a('0x47')],_0x3f9377);_0x101543[_0x5a34a6](_0x33f5c8['text'],_0x33f5c8[_0x8a8a('0x6c')][_0x8a8a('0x77')],_0x33f5c8[_0x8a8a('0x6c')][_0x8a8a('0x26')]);}break;case _0x8a8a('0x78'):var _0x224ec2=_0x3f9377[_0x8a8a('0x6c')]['split'](',')[_0x8a8a('0x36')](function(_0x260a6b){return Number(_0x260a6b);});_0x224ec2[_0x8a8a('0x79')](function(_0x50a069){_0x50b5c5['or'](_0x8a8a('0x7a'),'%,'+_0x50a069+',%');});_0x183015=_['union'](_0x183015,_0x224ec2);break;case _0x8a8a('0x7b'):if(_0x3f9377[_0x8a8a('0x6f')]==='$substring'){_0x101543[_0x5a34a6](_0x8a8a('0x7c'),'%'+_0x3f9377[_0x8a8a('0x6c')]+'%',null);}else{_0x142ba6=_[_0x8a8a('0x6a')](_0x18449b,[_0x8a8a('0x4a'),_0x8a8a('0x43')]);_0x3f9377[_0x8a8a('0x59')]=_0x8a8a('0x43');_0x33f5c8=as[_0x8a8a('0x76')](_0x4aa202,_0x142ba6[_0x8a8a('0x47')],_0x3f9377);_0x101543[_0x5a34a6](_0x33f5c8[_0x8a8a('0x7d')],_0x33f5c8[_0x8a8a('0x6c')][_0x8a8a('0x77')],_0x33f5c8[_0x8a8a('0x6c')][_0x8a8a('0x26')]);}break;case _0x8a8a('0x30'):_0x33f5c8=as[_0x8a8a('0x76')]('me',null,_0x3f9377);_0x101543[_0x5a34a6](_0x33f5c8[_0x8a8a('0x7d')],_0x33f5c8[_0x8a8a('0x6c')]['start'],_0x33f5c8[_0x8a8a('0x6c')]['end']);break;}}else{var _0x33f5c8=as[_0x8a8a('0x76')](_0x4aa202,_0x142ba6[_0x8a8a('0x47')],_0x3f9377);_0x101543[_0x5a34a6](_0x33f5c8['text'],_0x33f5c8['value'][_0x8a8a('0x77')],_0x33f5c8[_0x8a8a('0x6c')][_0x8a8a('0x26')]);}}}else{var _0x4b3db2=_(_0x5466d4['query'])[_0x8a8a('0x4b')]()[_0x8a8a('0x36')](function(_0x46a556){return _[_0x8a8a('0x7e')](_0x18449b,[_0x8a8a('0x4a'),_0x46a556])?_0x46a556:undefined;})[_0x8a8a('0x7f')]()[_0x8a8a('0x6c')]();if(!_[_0x8a8a('0x80')](_0x4b3db2)){_0x4b3db2['forEach'](function(_0x38d6ab){if(_0x38d6ab===_0x8a8a('0x81')){_0x2ba3bf['where'](_0x8a8a('0x82'),[][_0x8a8a('0x83')](_0x5466d4[_0x8a8a('0x4c')][_0x38d6ab]));}else if(_0x38d6ab===_0x8a8a('0x84')){var _0x309725=JSON[_0x8a8a('0x85')](_0x5466d4['query'][_0x38d6ab])[_0x8a8a('0x86')];var _0x15ba84=JSON[_0x8a8a('0x85')](_0x5466d4[_0x8a8a('0x4c')][_0x38d6ab])[_0x8a8a('0x87')];_0x2ba3bf['where'](_0x8a8a('0x88'),_0x309725,_0x15ba84);}else{if(_0x5466d4[_0x8a8a('0x4c')][_0x38d6ab]===_0x8a8a('0x89')){_0x2ba3bf[_0x8a8a('0x56')]('i.'+_0x38d6ab+_0x8a8a('0x8a'));}else{_0x2ba3bf[_0x8a8a('0x56')]('i.'+_0x38d6ab+_0x8a8a('0x8b'),_0x5466d4[_0x8a8a('0x4c')][_0x38d6ab]);}}});}if(_0x5466d4[_0x8a8a('0x4c')][_0x8a8a('0x8c')]){if(_0x5466d4['query'][_0x8a8a('0x8c')]==0x1){_0x2ba3bf[_0x8a8a('0x6d')](_0x8a8a('0x8d'));}else{_0x2ba3bf[_0x8a8a('0x6d')](_0x8a8a('0x8e'));}}if(_0x5466d4['query']['tag']){_0x183015=_[_0x8a8a('0x8f')](_0x5466d4[_0x8a8a('0x4c')][_0x8a8a('0x90')])?_0x5466d4['query'][_0x8a8a('0x90')]:new Array(_0x5466d4[_0x8a8a('0x4c')][_0x8a8a('0x90')]);_0x183015[_0x8a8a('0x79')](function(_0x5675ec){_0x50b5c5['or'](_0x8a8a('0x7a'),'%,'+_0x5675ec+',%');});}if(_0x5466d4[_0x8a8a('0x4c')][_0x8a8a('0x91')]){var _0x5cee89=_0x5466d4['query']['filter'][_0x8a8a('0x92')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8a8a('0x93')](_0x5cee89)){_0x101543['or']('i.id\x20LIKE\x20?',_0x5cee89+'%');}else{_0x101543['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8a8a('0x73')](_0x5cee89))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5cee89+'%');}}}_0x2ba3bf['where'](_0x101543);_0x2ba3bf['group'](_0x8a8a('0x94'));var _0x49aa1b={'type':db['Sequelize'][_0x8a8a('0x95')]['SELECT'],'raw':!![]};var _0x376c22=_0x2ba3bf['clone']();_0x376c22[_0x8a8a('0x59')](_0x8a8a('0x94'));_0x376c22[_0x8a8a('0x59')](_0x8a8a('0x96'),'unreadMessages');if(_0x1eb8bf[_0x8a8a('0x54')]){_0x1eb8bf[_0x8a8a('0x54')]['forEach'](function(_0x395bdd){var _0xf3cf32=_0x395bdd[0x0]===_0x8a8a('0x97')?_0x395bdd[0x0]:'i.'+_0x395bdd[0x0];_0x2ba3bf[_0x8a8a('0x54')](_0xf3cf32,_0x395bdd[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x183015)){_0x2ba3bf[_0x8a8a('0x6d')](_0x50b5c5);_0x376c22[_0x8a8a('0x56')](_0x8a8a('0x98'),_0x183015);}BPromise['resolve']()[_0x8a8a('0x19')](function(){if(!_0x37a9bb){if(_0x5466d4[_0x8a8a('0x4c')][_0x8a8a('0x81')])return;_0x376c22['where'](_0x8a8a('0x99'));_0x2ba3bf[_0x8a8a('0x56')](_0x8a8a('0x99'));return;}if(_0x5466d4[_0x8a8a('0x9a')][_0x8a8a('0x9b')]!=='agent')return;return _0x5466d4[_0x8a8a('0x9a')][_0x8a8a('0x9c')]({'attributes':['id'],'raw':!![]})[_0x8a8a('0x19')](function(_0x161c44){if(_[_0x8a8a('0x80')](_0x161c44)){_0x376c22[_0x8a8a('0x56')](_0x8a8a('0x9d'));_0x2ba3bf['where']('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x376c22[_0x8a8a('0x56')](_0x8a8a('0x82'),_[_0x8a8a('0x36')](_0x161c44,'id'));_0x2ba3bf['where'](_0x8a8a('0x82'),_[_0x8a8a('0x36')](_0x161c44,'id'));}});})[_0x8a8a('0x19')](function(){if(_0x5466d4[_0x8a8a('0x9a')][_0x8a8a('0x9b')]===_0x8a8a('0x32')&&!_0x37a9bb&&!_0x5466d4[_0x8a8a('0x4c')][_0x8a8a('0x81')])return[];return db[_0x8a8a('0x9e')][_0x8a8a('0x4c')](_0x376c22['toString'](),_0x49aa1b);})[_0x8a8a('0x19')](function(_0x2b21c0){_0x5c6c98[_0x8a8a('0x9f')]=_0x2b21c0['length'];if(_0x5c6c98[_0x8a8a('0x9f')]===0x0)return[];return db[_0x8a8a('0x9e')][_0x8a8a('0x4c')](_0x339be6['toString'](),_0x49aa1b)['then'](function(_0x1f409b){_0xa2b8a1=_[_0x8a8a('0xa0')](_0x1f409b,'id');_0x49aa1b=_[_0x8a8a('0x2f')](_0x49aa1b,{'model':db[_0x8a8a('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5466d4['query'][_0x8a8a('0x4f')]){_0x1eb8bf[_0x8a8a('0x50')][_0x8a8a('0x79')](function(_0xa23098){_0x2ba3bf['field']('i.'+_0xa23098);});}else{_0x2ba3bf['field'](_0x8a8a('0x96'),_0x8a8a('0x6b'));_0x2ba3bf[_0x8a8a('0x59')]('a.key',_0x8a8a('0xa1'));_0x2ba3bf[_0x8a8a('0x59')](_0x8a8a('0xa2'),_0x8a8a('0xa3'));_0x2ba3bf[_0x8a8a('0x59')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x8a8a('0x97'));_0x2ba3bf['field'](_0x8a8a('0xa4'));_0x2ba3bf[_0x8a8a('0x59')](_0x8a8a('0xa5'),_0x8a8a('0xa6'));_0x2ba3bf[_0x8a8a('0x59')](_0x8a8a('0xa7'),'Contact.lastName');_0x2ba3bf[_0x8a8a('0x59')](_0x8a8a('0xa8'),'Contact.email');_0x2ba3bf['field'](_0x8a8a('0xa9'),_0x8a8a('0xaa'));_0x2ba3bf['field'](_0x8a8a('0xab'),'Contact.mobile');_0x2ba3bf['field'](_0x8a8a('0xac'),_0x8a8a('0xad'));_0x2ba3bf[_0x8a8a('0x59')]('o.fullname',_0x8a8a('0xae'));_0x2ba3bf[_0x8a8a('0x59')](_0x8a8a('0xaf'),_0x8a8a('0xb0'));_0x2ba3bf[_0x8a8a('0x59')](_0x8a8a('0xb1'),'TagIds');}if(_0x1eb8bf['limit'])_0x2ba3bf['limit'](_0x1eb8bf[_0x8a8a('0x29')]);if(_0x1eb8bf[_0x8a8a('0x2a')])_0x2ba3bf[_0x8a8a('0x2a')](_0x1eb8bf[_0x8a8a('0x2a')]);return db[_0x8a8a('0x9e')][_0x8a8a('0x4c')](_0x2ba3bf[_0x8a8a('0xb2')](),_0x49aa1b);})[_0x8a8a('0x19')](function(_0x3afd87){if(_0x3afd87['length']>0x0)_0x329bfb[_0x8a8a('0x56')](_0x8a8a('0xb3'),_[_0x8a8a('0x36')](_0x3afd87,'id'));return db[_0x8a8a('0x9e')][_0x8a8a('0x4c')](_0x329bfb[_0x8a8a('0xb2')](),_0x49aa1b)['then'](function(_0x563e90){var _0x5b3092=_[_0x8a8a('0xb4')](_0x563e90,'ChatInteractionId');var _0x2fab56=[];_0x3afd87['forEach'](function(_0x227dde){_0x2fab56['push'](updateChatInteraction(_0x227dde,_0xa2b8a1,_0x5b3092));});return BPromise[_0x8a8a('0xb5')](_0x2fab56);});});})[_0x8a8a('0x19')](function(_0x5e8094){_0x5c6c98[_0x8a8a('0xb6')]=_0x5e8094;return _0x5c6c98;})['then'](respondWithFilteredResult(_0x44aed3,_0x1eb8bf))['catch'](handleError(_0x44aed3,null));};exports[_0x8a8a('0xb7')]=function(_0x4a1658,_0x32fa90){var _0x4d6119={'raw':![],'where':{'id':_0x4a1658['params']['id']}},_0x17f681={};_0x17f681[_0x8a8a('0x49')]=_[_0x8a8a('0x4b')](db[_0x8a8a('0x44')][_0x8a8a('0x45')]);_0x17f681['query']=_[_0x8a8a('0x4b')](_0x4a1658[_0x8a8a('0x4c')]);_0x17f681[_0x8a8a('0x4d')]=_[_0x8a8a('0x4e')](_0x17f681['model'],_0x17f681[_0x8a8a('0x4c')]);_0x4d6119[_0x8a8a('0x50')]=_[_0x8a8a('0x4e')](_0x17f681['model'],qs[_0x8a8a('0x4f')](_0x4a1658[_0x8a8a('0x4c')][_0x8a8a('0x4f')]));_0x4d6119[_0x8a8a('0x50')]=_0x4d6119[_0x8a8a('0x50')]['length']?_0x4d6119['attributes']:_0x17f681[_0x8a8a('0x49')];if(_0x4a1658[_0x8a8a('0x4c')][_0x8a8a('0xb8')]){_0x4d6119['include']=[{'all':!![]}];}_0x4d6119=_[_0x8a8a('0x2f')]({},_0x4d6119,_0x4a1658[_0x8a8a('0xb9')]);return db['ChatInteraction']['find'](_0x4d6119)[_0x8a8a('0x19')](handleEntityNotFound(_0x32fa90,null))[_0x8a8a('0x19')](respondWithResult(_0x32fa90,null))[_0x8a8a('0x23')](handleError(_0x32fa90,null));};exports['create']=function(_0x32921f,_0x2f3aa6){return db['ChatInteraction'][_0x8a8a('0xba')](_0x32921f[_0x8a8a('0x30')],{})['then'](respondWithResult(_0x2f3aa6,0xc9))[_0x8a8a('0x23')](handleError(_0x2f3aa6,null));};exports['update']=function(_0x1e35ac,_0x16a4a8){if(_0x1e35ac['body']['id']){delete _0x1e35ac[_0x8a8a('0x30')]['id'];}return db[_0x8a8a('0x44')]['find']({'where':{'id':_0x1e35ac[_0x8a8a('0xbb')]['id']}})['then'](handleEntityNotFound(_0x16a4a8,null))[_0x8a8a('0x19')](saveUpdates(_0x1e35ac[_0x8a8a('0x30')],null))['then'](respondWithResult(_0x16a4a8,null))[_0x8a8a('0x23')](handleError(_0x16a4a8,null));};exports[_0x8a8a('0xbc')]=function(_0x33935b,_0x52ffa0){return db[_0x8a8a('0x44')]['find']({'where':{'id':_0x33935b[_0x8a8a('0xbb')]['id']}})[_0x8a8a('0x19')](handleEntityNotFound(_0x52ffa0,null))[_0x8a8a('0x19')](removeEntity(_0x52ffa0,null))[_0x8a8a('0x23')](handleError(_0x52ffa0,null));};exports[_0x8a8a('0xbd')]=function(_0x54ad37,_0x19d4f6){return db[_0x8a8a('0x44')]['describe']()[_0x8a8a('0x19')](respondWithResult(_0x19d4f6,null))[_0x8a8a('0x23')](handleError(_0x19d4f6,null));};exports[_0x8a8a('0xbe')]=function(_0x5b22b6,_0x586dbd){var _0x35d9e2=_0x5b22b6[_0x8a8a('0xbb')]['id'];var _0x279002;var _0x7504b2;var _0x461430;return db[_0x8a8a('0x44')][_0x8a8a('0xbf')]({'where':{'id':_0x35d9e2}})['then'](function(_0x496f08){_0x279002=_0x496f08;return db['ChatWebsite'][_0x8a8a('0xbf')]({'where':{'id':_0x496f08[_0x8a8a('0x81')]},'attributes':['id',_0x8a8a('0xc0'),'vidaooEscalation',_0x8a8a('0xc1'),_0x8a8a('0xc2'),_0x8a8a('0xc3')],'raw':!![]});})[_0x8a8a('0x19')](function(_0x3154ee){if(_0x3154ee&&_0x3154ee['vidaooApiKey']&&_0x3154ee[_0x8a8a('0xc4')]){_0x7504b2=_0x3154ee;var _0xde7f73={'interaction':{'id':_0x35d9e2},'agent':{'id':_0x5b22b6[_0x8a8a('0x9a')]['id'],'name':_0x5b22b6['user'][_0x8a8a('0x4a')],'fullname':_0x5b22b6[_0x8a8a('0x9a')][_0x8a8a('0x37')],'email':_0x5b22b6['user']['email']},'contact':_0x5b22b6[_0x8a8a('0x30')][_0x8a8a('0x31')],'account':_0x5b22b6[_0x8a8a('0x30')]['account']};var _0x2fed73={'rejectUnauthorized':![],'method':_0x8a8a('0xc5'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x3154ee[_0x8a8a('0xc0')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5b22b6[_0x8a8a('0x9a')]['email']],'buttons':null,'topic':_0x7504b2[_0x8a8a('0xc1')],'note':_['isNull'](_0x7504b2['vidaooNote'])?null:getMustacheRender(_0x7504b2[_0x8a8a('0xc2')],_0xde7f73),'metadata':null},'redirect':_0x8a8a('0xc6'),'json':!![]};try{if(!_['isNull'](_0x7504b2['vidaooMetadata'])){var _0x591ca2=getMustacheRender(_0x7504b2[_0x8a8a('0xc3')],_0xde7f73);var _0x55bec7=JSON['parse'](_0x591ca2);_0x2fed73[_0x8a8a('0x30')][_0x8a8a('0xc7')]=_0x55bec7;}}catch(_0x58ac24){throw new db[(_0x8a8a('0xc8'))][(_0x8a8a('0xc9'))](_0x8a8a('0xca'));}return rp(_0x2fed73);}else{throw new db[(_0x8a8a('0xc8'))][(_0x8a8a('0xc9'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x8a8a('0x19')](function(_0x4930ad){_0x461430=_0x4930ad;if(_0x461430['id']){var _0x3ae28a={'body':_0x461430[_0x8a8a('0xcb')],'ChatWebsiteId':_0x7504b2['id'],'ChatInteractionId':_0x279002['id'],'direction':_0x8a8a('0xcc'),'UserId':_0x5b22b6[_0x8a8a('0x9a')]['id']};return db['ChatMessage']['create'](_0x3ae28a,{});}else{throw new db[(_0x8a8a('0xc8'))][(_0x8a8a('0xc9'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x8a8a('0x19')](function(){return _0x279002[_0x8a8a('0xcd')]({'vidaooSessionId':_0x461430['id']});})['then'](respondWithResult(_0x586dbd,null))[_0x8a8a('0x23')](handleError(_0x586dbd,null));};exports[_0x8a8a('0xce')]=function(_0x14cd8d,_0x4be66d){if(_0x14cd8d['body']['id']){delete _0x14cd8d[_0x8a8a('0x30')]['id'];}return db['ChatInteraction'][_0x8a8a('0x6a')]({'where':{'id':_0x14cd8d['params']['id']},'include':[{'model':db[_0x8a8a('0xcf')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x4be66d,null))['then'](saveUpdates(_0x14cd8d['body'],null))[_0x8a8a('0x19')](respondWithResult(_0x4be66d,null))[_0x8a8a('0x23')](handleError(_0x4be66d,null));};exports[_0x8a8a('0xd0')]=function(_0x5d955f,_0x32eb6b){if(_0x5d955f[_0x8a8a('0x30')]['id']){delete _0x5d955f[_0x8a8a('0x30')]['id'];}return db[_0x8a8a('0x44')][_0x8a8a('0x6a')]({'where':{'id':_0x5d955f[_0x8a8a('0xbb')]['id']}})[_0x8a8a('0x19')](function(_0x586686){if(!_0x586686){logger['error'](_0x8a8a('0xd1'),_0x8a8a('0xd0'),0x194,_0x8a8a('0xd2'));_0x32eb6b['sendStatus'](0x194);}else{if(_0x586686[_0x8a8a('0x43')]){throw new db[(_0x8a8a('0xc8'))][(_0x8a8a('0xc9'))](_0x8a8a('0xd3'));}}return _0x586686;})['then'](function(_0x5023d7){if(_0x5023d7){return _0x5023d7[_0x8a8a('0x2c')]({'closed':_0x5d955f[_0x8a8a('0x30')][_0x8a8a('0x40')],'disposition':_0x5d955f[_0x8a8a('0x30')][_0x8a8a('0x42')]})[_0x8a8a('0x19')](function(_0x40a76d){return _0x40a76d;});}})[_0x8a8a('0x19')](function(){return respondWithRpcPromise(_0x8a8a('0xd4'),_0x8a8a('0xd0'),_0x5d955f[_0x8a8a('0x30')],client9004);})['then'](respondWithResult(_0x32eb6b,null))[_0x8a8a('0x23')](handleError(_0x32eb6b,null));};exports[_0x8a8a('0xd5')]=function(_0xe30557,_0x37815b){_0xe30557[_0x8a8a('0x30')][_0x8a8a('0x4a')]=_0xe30557[_0x8a8a('0xd6')][_0x8a8a('0xd7')];_0xe30557[_0x8a8a('0x30')][_0x8a8a('0xd8')]=_0xe30557[_0x8a8a('0xd6')]['filename'];_0xe30557[_0x8a8a('0x30')][_0x8a8a('0x47')]=_0xe30557[_0x8a8a('0xd6')][_0x8a8a('0xd9')];return db['Attachment'][_0x8a8a('0xba')](_0xe30557[_0x8a8a('0x30')])[_0x8a8a('0x19')](respondWithResult(_0x37815b,0xc9))[_0x8a8a('0x23')](handleError(_0x37815b,null));};exports[_0x8a8a('0xda')]=function(_0x419998,_0x59ed64){return db[_0x8a8a('0x44')][_0x8a8a('0xbf')]({'where':{'id':_0x419998[_0x8a8a('0xbb')]['id']},'raw':!![]})[_0x8a8a('0x19')](handleEntityNotFound(_0x59ed64,null))[_0x8a8a('0x19')](function(_0x17e607){if(_0x17e607){if(_0x17e607[_0x8a8a('0x40')]){return _0x59ed64[_0x8a8a('0x25')](0x193)['json']({'status':0x193,'message':_0x8a8a('0xdb')});}return db[_0x8a8a('0xdc')][_0x8a8a('0xbf')]({'where':{'id':_0x419998[_0x8a8a('0x4c')][_0x8a8a('0xdd')]},'raw':!![]})[_0x8a8a('0x19')](handleEntityNotFound(_0x59ed64,null));}})[_0x8a8a('0x19')](function(_0xc79caa){if(_0xc79caa){var _0x3a2fa1=_0xc79caa['ChatOfflineMessageId']!==null;var _0x6f8834=path[_0x8a8a('0xde')](config[_0x8a8a('0xdf')],_0x8a8a('0xe0'));if(_0x3a2fa1){_0x6f8834=path[_0x8a8a('0xde')](_0x6f8834,'offline-chat/');}var _0xa5a1bc=path[_0x8a8a('0xde')](_0x6f8834,_0xc79caa[_0x8a8a('0xd8')]);return _0x59ed64[_0x8a8a('0xe1')](_0xa5a1bc);}})[_0x8a8a('0x23')](handleError(_0x59ed64,null));};exports['close']=function(_0x4dbb00,_0x57c44c){var _0x2b8cf5=null;var _0x3074a2=null;var _0x24a0e0=null;if(_0x4dbb00[_0x8a8a('0x30')]['id']){delete _0x4dbb00[_0x8a8a('0x30')]['id'];}if(_0x4dbb00[_0x8a8a('0x30')]['mailTranscript']){_0x24a0e0=path[_0x8a8a('0xde')](config[_0x8a8a('0xdf')],_0x8a8a('0xe2'),util['format'](_0x8a8a('0xe3'),Date[_0x8a8a('0xe4')]()));_0x4dbb00[_0x8a8a('0x30')]['pathTranscript']=_0x24a0e0;}return db[_0x8a8a('0x44')][_0x8a8a('0x6a')]({'where':{'id':_0x4dbb00['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0x8a8a('0xe5'),'include':[{'model':db['User'],'as':'User'}]}]})['then'](handleEntityNotFound(_0x57c44c,null))[_0x8a8a('0x19')](saveUpdates(_0x4dbb00[_0x8a8a('0x30')],null))[_0x8a8a('0x19')](function(_0x20bc23){if(_0x20bc23){_0x2b8cf5=_0x20bc23;return db['ChatWebsite'][_0x8a8a('0x6a')]({'where':{'id':_0x2b8cf5['ChatWebsiteId']}});}})[_0x8a8a('0x19')](function(_0x419eef){if(_0x419eef){_0x3074a2=_0x419eef;return db['CmContact'][_0x8a8a('0x6a')]({'where':{'id':_0x2b8cf5[_0x8a8a('0x75')]}});}})['then'](function(_0x3b3c55){if(_0x3b3c55){if(_0x24a0e0){var _0x14cc59=null;for(var _0x5e9e59=0x1;_0x5e9e59<_0x2b8cf5[_0x8a8a('0xe5')][_0x8a8a('0x51')];++_0x5e9e59){_0x14cc59=_0x2b8cf5[_0x8a8a('0xe5')][_0x5e9e59];var _0x5ac2e2=_0x14cc59[_0x8a8a('0x43')]?util['format']('%s%d',_0x3074a2[_0x8a8a('0xe6')],_0x14cc59[_0x8a8a('0x43')]):'System';var _0x25a514=_0x4dbb00[_0x8a8a('0x30')][_0x8a8a('0xe7')]||util[_0x8a8a('0xe8')](_0x8a8a('0xe9'),_0x8a8a('0xea'),_0x14cc59[_0x8a8a('0x75')]);switch(_0x3074a2[_0x8a8a('0xeb')]){case _0x8a8a('0xec'):_0x5ac2e2=_0x14cc59[_0x8a8a('0x43')]?util[_0x8a8a('0xe8')](_0x8a8a('0xe9'),_0x3074a2[_0x8a8a('0xe6')],_0x14cc59['UserId']):_0x8a8a('0xed');break;case _0x8a8a('0xee'):_0x5ac2e2=_0x14cc59[_0x8a8a('0x43')]?_0x14cc59['User'][_0x8a8a('0xef')]||_0x14cc59[_0x8a8a('0x7b')][_0x8a8a('0x37')]:_0x8a8a('0xed');break;case _0x8a8a('0xf0'):_0x5ac2e2=_0x14cc59[_0x8a8a('0x43')]?_0x14cc59[_0x8a8a('0x7b')][_0x8a8a('0x37')]:_0x8a8a('0xed');break;default:_0x5ac2e2=_0x14cc59[_0x8a8a('0x43')]?util[_0x8a8a('0xe8')]('%s%d',_0x3074a2[_0x8a8a('0xe6')],_0x14cc59[_0x8a8a('0x43')]):_0x8a8a('0xed');}var _0x22d259=util[_0x8a8a('0xe8')](_0x8a8a('0xf1'),moment(_0x14cc59[_0x8a8a('0x84')])['format'](_0x8a8a('0xf2')),_0x14cc59[_0x8a8a('0xf3')]==='in'?_0x25a514:_0x5ac2e2,_0x14cc59['body']);if(!_0x14cc59[_0x8a8a('0xf4')]){fs['appendFileSync'](_0x24a0e0,_0x22d259);}}return db[_0x8a8a('0xf5')][_0x8a8a('0xbf')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x8a8a('0xf6'),'raw':!![],'include':[{'model':db[_0x8a8a('0xf7')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x8a8a('0x19')](function(_0x7e29e1){if(!_0x7e29e1||!_0x7e29e1['Smtp']||!_0x4dbb00[_0x8a8a('0x30')])return _0x2b8cf5;var _0x4b106f=_0x7e29e1[_0x8a8a('0xf8')]();return respondWithRpcPromise(_0x8a8a('0xf9'),_0x8a8a('0xfa'),{'account':_0x4b106f,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x7e29e1[_0x8a8a('0x4a')],_0x7e29e1['email']||_0x7e29e1[_0x8a8a('0xf6')]['user']),'to':_0x4dbb00['body'][_0x8a8a('0xfb')],'subject':'Mail\x20Transcript','text':util['format'](_0x8a8a('0xfc'),_0x4dbb00[_0x8a8a('0x30')][_0x8a8a('0xfb')]),'attachments':[{'path':_0x24a0e0}]}})[_0x8a8a('0x19')](function(){return _0x2b8cf5;})[_0x8a8a('0x23')](function(_0x4cb1da){logger[_0x8a8a('0x1f')](_0x4cb1da);});})[_0x8a8a('0x19')](respondWithStatusCode(_0x57c44c,0xc8))[_0x8a8a('0x23')](handleError(_0x57c44c,null));};exports['addMessage']=function(_0x3e63d4,_0x5de5ae){return db['ChatMessage']['find']({'where':{'id':_0x3e63d4[_0x8a8a('0xbb')]['id']}})['then'](handleEntityNotFound(_0x5de5ae,null))['then'](function(_0x484cc6){if(_0x484cc6){return _0x484cc6[_0x8a8a('0xfd')](_0x3e63d4[_0x8a8a('0x30')][_0x8a8a('0xfe')],_[_0x8a8a('0xff')](_0x3e63d4['body'],[_0x8a8a('0xfe'),'id'])||{});}})[_0x8a8a('0x19')](respondWithResult(_0x5de5ae,null))[_0x8a8a('0x23')](handleError(_0x5de5ae,null));};exports['getMessages']=function(_0x186c2c,_0x55148e){var _0x50315b={'raw':![],'where':{}};var _0x40c9cb={};var _0x2b4119={'count':0x0,'rows':[]};return db[_0x8a8a('0x44')][_0x8a8a('0xbf')]({'where':{'id':_0x186c2c[_0x8a8a('0xbb')]['id']}})['then'](handleEntityNotFound(_0x55148e,null))[_0x8a8a('0x19')](function(_0x33e008){if(_0x33e008){_0x40c9cb[_0x8a8a('0x49')]=_[_0x8a8a('0x4b')](db[_0x8a8a('0x100')][_0x8a8a('0x45')]);_0x40c9cb[_0x8a8a('0x4c')]=_[_0x8a8a('0x4b')](_0x186c2c[_0x8a8a('0x4c')]);_0x40c9cb['filters']=_[_0x8a8a('0x4e')](_0x40c9cb['model'],_0x40c9cb[_0x8a8a('0x4c')]);_0x50315b[_0x8a8a('0x50')]=_['intersection'](_0x40c9cb['model'],qs[_0x8a8a('0x4f')](_0x186c2c[_0x8a8a('0x4c')][_0x8a8a('0x4f')]));_0x50315b[_0x8a8a('0x50')]=_0x50315b[_0x8a8a('0x50')][_0x8a8a('0x51')]?_0x50315b[_0x8a8a('0x50')]:_0x40c9cb[_0x8a8a('0x49')];if(!_0x186c2c[_0x8a8a('0x4c')][_0x8a8a('0x52')](_0x8a8a('0x53'))){_0x50315b[_0x8a8a('0x29')]=qs[_0x8a8a('0x29')](_0x186c2c['query'][_0x8a8a('0x29')]);_0x50315b[_0x8a8a('0x2a')]=qs[_0x8a8a('0x2a')](_0x186c2c[_0x8a8a('0x4c')][_0x8a8a('0x2a')]);}_0x50315b[_0x8a8a('0x54')]=qs[_0x8a8a('0x55')](_0x186c2c[_0x8a8a('0x4c')][_0x8a8a('0x55')]);_0x50315b[_0x8a8a('0x56')]=qs[_0x8a8a('0x4d')](_[_0x8a8a('0x57')](_0x186c2c[_0x8a8a('0x4c')],_0x40c9cb[_0x8a8a('0x4d')]));_0x50315b[_0x8a8a('0x56')][_0x8a8a('0x101')]=_0x33e008['id'];if(_0x186c2c[_0x8a8a('0x4c')][_0x8a8a('0x91')]){_0x50315b[_0x8a8a('0x56')]=_[_0x8a8a('0x2f')](_0x50315b[_0x8a8a('0x56')],{'$or':_[_0x8a8a('0x36')](_0x50315b[_0x8a8a('0x50')],function(_0x433051){var _0x3f064c={};_0x3f064c[_0x433051]={'$like':'%'+_0x186c2c[_0x8a8a('0x4c')][_0x8a8a('0x91')]+'%'};return _0x3f064c;})});}if(_0x186c2c[_0x8a8a('0x4c')][_0x8a8a('0x86')]){var _0x36baf8=_0x186c2c[_0x8a8a('0x4c')]['$gte']['split'](',');var _0x1af0b6={};_0x1af0b6[_0x36baf8[0x0]]={'$gte':moment(_0x36baf8[0x1])['format'](_0x8a8a('0x102'))};_0x50315b[_0x8a8a('0x56')]=_[_0x8a8a('0x2f')](_0x50315b[_0x8a8a('0x56')],_0x1af0b6);}_0x50315b=_['merge']({},_0x50315b,_0x186c2c[_0x8a8a('0xb9')]);return db[_0x8a8a('0x100')][_0x8a8a('0x9f')]({'where':_0x50315b[_0x8a8a('0x56')]})[_0x8a8a('0x19')](function(_0x204dde){_0x2b4119[_0x8a8a('0x9f')]=_0x204dde;if(_0x186c2c[_0x8a8a('0x4c')][_0x8a8a('0xb8')]){_0x50315b[_0x8a8a('0x103')]=[{'all':!![]}];}return db[_0x8a8a('0x100')]['findAll'](_0x50315b);})[_0x8a8a('0x19')](function(_0x25b624){_0x2b4119[_0x8a8a('0xb6')]=_0x25b624;return _0x2b4119;});}})[_0x8a8a('0x19')](respondWithFilteredResult(_0x55148e,_0x50315b))[_0x8a8a('0x23')](handleError(_0x55148e,null));};exports[_0x8a8a('0x104')]=function(_0x413ab7,_0x32cc2a){var _0x1e8490={'where':{}},_0x159761={},_0xe16caf={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x8a8a('0xbf')]({'where':{'id':_0x413ab7[_0x8a8a('0xbb')]['id']}})[_0x8a8a('0x19')](handleEntityNotFound(_0x32cc2a,null))[_0x8a8a('0x19')](function(_0x2847bd){if(_0x2847bd){_0x159761['model']=_['keys'](db[_0x8a8a('0x100')][_0x8a8a('0x45')]);_0x159761[_0x8a8a('0x4c')]=_[_0x8a8a('0x4b')](_0x413ab7[_0x8a8a('0x4c')]);_0x159761['filters']=_[_0x8a8a('0x4e')](_0x159761[_0x8a8a('0x49')],_0x159761[_0x8a8a('0x4c')]);_0x1e8490[_0x8a8a('0x50')]=_[_0x8a8a('0x4e')](_0x159761[_0x8a8a('0x49')],qs[_0x8a8a('0x4f')](_0x413ab7['query'][_0x8a8a('0x4f')]));_0x1e8490[_0x8a8a('0x50')]=_0x1e8490[_0x8a8a('0x50')][_0x8a8a('0x51')]?_0x1e8490[_0x8a8a('0x50')]:_0x159761[_0x8a8a('0x49')];if(!_0x413ab7[_0x8a8a('0x4c')][_0x8a8a('0x52')](_0x8a8a('0x53'))){_0x1e8490[_0x8a8a('0x29')]=qs[_0x8a8a('0x29')](_0x413ab7['query'][_0x8a8a('0x29')]);_0x1e8490[_0x8a8a('0x2a')]=qs[_0x8a8a('0x2a')](_0x413ab7[_0x8a8a('0x4c')][_0x8a8a('0x2a')]);}_0x1e8490['order']=qs['sort'](_0x413ab7[_0x8a8a('0x4c')][_0x8a8a('0x55')]);_0x1e8490['where']=qs[_0x8a8a('0x4d')](_[_0x8a8a('0x57')](_0x413ab7['query'],_0x159761[_0x8a8a('0x4d')]));_0x1e8490[_0x8a8a('0x56')][_0x8a8a('0x101')]=_0x2847bd['id'];if(_0x413ab7[_0x8a8a('0x4c')]['filter']){_0x1e8490[_0x8a8a('0x56')]=_[_0x8a8a('0x2f')](_0x1e8490[_0x8a8a('0x56')],{'$or':_[_0x8a8a('0x36')](_0x1e8490['attributes'],function(_0x453a30){var _0x34ac37={};_0x34ac37[_0x453a30]={'$like':'%'+_0x413ab7['query'][_0x8a8a('0x91')]+'%'};return _0x34ac37;})});}_0x1e8490[_0x8a8a('0x56')][_0x8a8a('0xf4')]=![];if(_0x413ab7[_0x8a8a('0x4c')]['id']){_0x1e8490[_0x8a8a('0x56')]['id']={'$gt':_0x413ab7[_0x8a8a('0x4c')]['id']};}_0x1e8490=_[_0x8a8a('0x2f')]({},_0x1e8490,_0x413ab7[_0x8a8a('0xb9')]);return db[_0x8a8a('0x100')][_0x8a8a('0x9f')]({'where':_0x1e8490[_0x8a8a('0x56')]})[_0x8a8a('0x19')](function(_0x50536f){_0xe16caf[_0x8a8a('0x9f')]=_0x50536f;_0x1e8490['include']=[];if(_0x413ab7[_0x8a8a('0x4c')]['includeAgent']){_0x1e8490[_0x8a8a('0x103')][_0x8a8a('0x3a')]({'model':db[_0x8a8a('0x7b')],'as':_0x8a8a('0x7b'),'attributes':['id','fullname',_0x8a8a('0xef')]});}if(_0x413ab7['query'][_0x8a8a('0xb8')]){_0x1e8490[_0x8a8a('0x103')]=[{'all':!![]}];}return db[_0x8a8a('0x100')][_0x8a8a('0x105')](_0x1e8490);})[_0x8a8a('0x19')](function(_0x1a7bff){_0xe16caf[_0x8a8a('0xb6')]=_0x1a7bff;return _0xe16caf;});}})[_0x8a8a('0x19')](respondWithFilteredResult(_0x32cc2a,_0x1e8490))['catch'](handleError(_0x32cc2a,null));};exports['addTags']=function(_0x2deb61,_0x268a78){return db[_0x8a8a('0x44')][_0x8a8a('0x6a')]({'where':{'id':_0x2deb61[_0x8a8a('0xbb')]['id']}})[_0x8a8a('0x19')](handleEntityNotFound(_0x268a78,null))[_0x8a8a('0x19')](function(_0x6812b2){if(_0x6812b2){return _0x6812b2[_0x8a8a('0x106')](_0x2deb61[_0x8a8a('0x30')]['ids'],_['omit'](_0x2deb61[_0x8a8a('0x30')],[_0x8a8a('0xfe'),'id'])||{})['spread'](function(){return db[_0x8a8a('0x78')][_0x8a8a('0x105')]({'attributes':['id',_0x8a8a('0x4a'),'color'],'where':{'id':_0x2deb61[_0x8a8a('0x30')][_0x8a8a('0xfe')]}});})[_0x8a8a('0x19')](function(_0x5a88c4){socket['emit'](_0x8a8a('0x107'),{'id':Number(_0x2deb61[_0x8a8a('0xbb')]['id']),'tags':_0x5a88c4||[]});return{'id':Number(_0x2deb61[_0x8a8a('0xbb')]['id']),'tags':_0x5a88c4||[]};});}})[_0x8a8a('0x19')](respondWithResult(_0x268a78,null))[_0x8a8a('0x23')](handleError(_0x268a78,null));};exports[_0x8a8a('0x108')]=function(_0x17c85c,_0x49b219){return db['ChatInteraction'][_0x8a8a('0x6a')]({'where':{'id':_0x17c85c[_0x8a8a('0xbb')]['id']}})['then'](handleEntityNotFound(_0x49b219,null))[_0x8a8a('0x19')](function(_0x5a177b){if(_0x5a177b){return _0x5a177b['removeTags'](_0x17c85c['query'][_0x8a8a('0xfe')]);}})[_0x8a8a('0x19')](respondWithStatusCode(_0x49b219,null))[_0x8a8a('0x23')](handleError(_0x49b219,null));};exports[_0x8a8a('0xe1')]=function(_0xcfd82f,_0x3a49c0){var _0x52328d=moment()['unix']()['toString']();var _0x192040=path[_0x8a8a('0xde')](config[_0x8a8a('0xdf')],'server','files','tmp');var _0x3ce207=path['join'](config[_0x8a8a('0xdf')],_0x8a8a('0x109'),'files',_0x8a8a('0x10a'));var _0x52c858=path['join'](_0x192040,_0x52328d);var _0x19c612=util[_0x8a8a('0xe8')](_0x8a8a('0x10b'),_0xcfd82f['params']['id'],_0x52328d);var _0x29e6d0=path[_0x8a8a('0xde')](_0x192040,_0x19c612);var _0x517c95=[];_0x517c95[_0x8a8a('0x3a')]({'model':db[_0x8a8a('0x7b')],'as':_0x8a8a('0x7b'),'attributes':['id',_0x8a8a('0x37')],'raw':!![]});_0x517c95[_0x8a8a('0x3a')]({'model':db[_0x8a8a('0xcf')],'as':'Contact','attributes':['id',_0x8a8a('0x10c'),_0x8a8a('0x10d')],'raw':!![]});if(_0xcfd82f[_0x8a8a('0x4c')][_0x8a8a('0x10a')]){_0x517c95[_0x8a8a('0x3a')]({'model':db['Attachment'],'as':_0x8a8a('0xdc'),'raw':!![]});}var _0x55737e=[{'model':db[_0x8a8a('0x100')],'as':_0x8a8a('0xe5'),'attributes':['id',_0x8a8a('0x30'),_0x8a8a('0x84'),_0x8a8a('0xf3'),_0x8a8a('0xf4'),'read'],'include':_0x517c95}];_0x55737e['push']({'model':db[_0x8a8a('0x10e')],'as':_0x8a8a('0x10f'),'attributes':['id',_0x8a8a('0x4a')]});_0x55737e[_0x8a8a('0x3a')]({'model':db[_0x8a8a('0x7b')],'as':_0x8a8a('0x110'),'attributes':['id',_0x8a8a('0x37')]});return db[_0x8a8a('0x44')][_0x8a8a('0x6a')]({'where':{'id':_0xcfd82f[_0x8a8a('0xbb')]['id']},'include':_0x55737e})[_0x8a8a('0x19')](handleEntityNotFound(_0x3a49c0,null))[_0x8a8a('0x19')](function(_0x49525c){if(_0x49525c){var _0x2f5897=_0x49525c['get']({'plain':!![]});fs[_0x8a8a('0x111')](_0x52c858);var _0x1d7a76={'channel':_0x8a8a('0x112'),'account':_0x2f5897[_0x8a8a('0x10f')][_0x8a8a('0x4a')],'agent':_0x2f5897[_0x8a8a('0x110')]?_0x2f5897[_0x8a8a('0x110')]['fullname']:_0x8a8a('0x113'),'createdAt':moment(_0x2f5897['createdAt'])[_0x8a8a('0xe8')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8a8a('0xb2')](),'closedAt':_0x2f5897[_0x8a8a('0x40')]?moment(_0x2f5897[_0x8a8a('0x114')])[_0x8a8a('0xe8')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x2f5897[_0x8a8a('0x42')],'chatInfo':{'browser':_0x2f5897[_0x8a8a('0x115')],'os':_0x2f5897['osName'],'referer':_0x2f5897[_0x8a8a('0x116')],'customerIp':_0x2f5897['customerIp'],'customerPort':_0x2f5897['customerPort']?_0x2f5897[_0x8a8a('0x117')]:_0x8a8a('0x113')},'messages':_(_0x2f5897[_0x8a8a('0xe5')])['tail']()[_0x8a8a('0x91')]({'secret':![]})[_0x8a8a('0x36')](function(_0x2e34e6){if(_0x2e34e6['Attachment']){var _0x1be060=path[_0x8a8a('0xde')](_0x3ce207,_0x2e34e6['Attachment']['basename']);if(fs[_0x8a8a('0x118')](_0x1be060)){fs[_0x8a8a('0x119')](_0x1be060)[_0x8a8a('0x11a')](fs[_0x8a8a('0x11b')](path[_0x8a8a('0xde')](_0x52c858,_0x2e34e6['Attachment'][_0x8a8a('0xd8')])));}}return{'date':moment(_0x2e34e6['createdAt'])['format'](_0x8a8a('0x102'))[_0x8a8a('0xb2')](),'sender':_0x2e34e6[_0x8a8a('0xf3')]===_0x8a8a('0xcc')?_0x2e34e6[_0x8a8a('0x7b')]?_0x2e34e6[_0x8a8a('0x7b')]['fullname']:_0x8a8a('0xed'):_0x2e34e6[_0x8a8a('0x6e')][_0x8a8a('0x10c')]+(_0x2e34e6[_0x8a8a('0x6e')][_0x8a8a('0x10d')]?'\x20'+_0x2e34e6['Contact'][_0x8a8a('0x10d')]:''),'body':_0x2e34e6['Attachment']?_0x2e34e6[_0x8a8a('0xdc')]['basename']:_0x2e34e6['body'],'direction':_0x2e34e6[_0x8a8a('0xf3')]===_0x8a8a('0xcc')?'A':'C','secret':_0x2e34e6[_0x8a8a('0xf4')],'read':_0x2e34e6['read'],'attachment':_0x2e34e6[_0x8a8a('0xdc')]};})['value']()};return ejs[_0x8a8a('0x11c')](path[_0x8a8a('0xde')](config[_0x8a8a('0xdf')],_0x8a8a('0x109'),_0x8a8a('0x11d'),_0x8a8a('0x11e')),{'interaction':_0x1d7a76})[_0x8a8a('0x19')](function(_0x44dd5c){var _0x3d5bf0=path[_0x8a8a('0xde')](_0x52c858,_0x8a8a('0x11f')+_0x2f5897['id']+'-'+_0x52328d+'.pdf');var _0x5bfe3b={'path':_0x3d5bf0,'channel':_0x8a8a('0x112'),'interactionId':_0x2f5897['id']};return pdf[_0x8a8a('0x120')](_0x44dd5c,_0x5bfe3b);})[_0x8a8a('0x19')](function(){return new Promise(function(_0x50b445,_0x5738e4){zipdir(_0x52c858,{'saveTo':_0x29e6d0},function(_0x1b602b,_0xccfb49){if(_0x1b602b)return _0x5738e4(_0x1b602b);return _0x50b445(_0xccfb49);});})['then'](function(){return new BPromise(function(_0x4bb67b,_0x839b37){rimraf(_0x52c858,function(_0xb08e40){if(_0xb08e40)_0x839b37(_0xb08e40);return _0x4bb67b();});});})['then'](function(){return _0x3a49c0['download'](_0x29e6d0,_0x19c612,function(_0x19d186){if(_0x19d186){logger['error'](_0x8a8a('0x121'),_0x19d186);}else{fs['unlinkSync'](_0x29e6d0);}});});});}else{return _0x3a49c0[_0x8a8a('0x24')](0xc8);}})['catch'](handleError(_0x3a49c0,null));};
\ No newline at end of file
+var _0x91a7=['total','closed','UserId','waiting','disposition','unmanaged','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','field','color','from','select','u.id','u.fullname','ui.ChatInteractionId','users','chat_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','ChatInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','catch','show','params','rawAttributes','include','create','describe','findOne','ChatWebsite','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','email','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','attachmentUpload','file','basename','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','offline-chat/','close','mailTranscript','transcript-%s.txt','now','pathTranscript','Messages','agentAlias','System','format','%s%d','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','getMessages','sort','pick','YYYY-MM-DD\x20HH:mm:ss','options','findAll','getMyMessages','includeAgent','includeAll','addTags','setTags','emit','chatInteractionTags:save','removeTags','download','unix','server','tmp','files','attachments','firstName','lastName','direction','Account','Owner','get','osName','customerIp','customerPort','N.A.','tail','createReadStream','createWriteStream','out','read','renderFile','Chat','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','moment','mustache','path','squel','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','destroy','then','stack','name','send','render','merge','body','contact','agent','account','Users','map','fullname','Tags','TagIds','forEach','push','talking','answered','abandoned'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x91a7,0xe7));var _0x791a=function(_0x5c54c3,_0x38bc22){_0x5c54c3=_0x5c54c3-0x0;var _0x1b6a56=_0x91a7[_0x5c54c3];return _0x1b6a56;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x791a('0x0'));var rp=require(_0x791a('0x1'));var moment=require(_0x791a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x791a('0x3'));var util=require('util');var path=require(_0x791a('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x791a('0x5'));var Redis=require(_0x791a('0x6'));var qs=require('../../components/parsers/qs');var as=require(_0x791a('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x791a('0x8'))(_0x791a('0x9'));var config=require('../../config/environment');var db=require(_0x791a('0xa'))['db'];config[_0x791a('0xb')]=_[_0x791a('0xc')](config[_0x791a('0xb')],{'host':_0x791a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x791a('0xb')]));require(_0x791a('0xe'))['register'](socket);var jayson=require(_0x791a('0xf'));var client=jayson[_0x791a('0x10')][_0x791a('0x11')]({'port':0x232b});var client9004=jayson[_0x791a('0x10')][_0x791a('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x3fc10a,_0x53dc41,_0x5daecd,_0xc92016){return new BPromise(function(_0x2f2d8d,_0x4c56f0){var _0x346c44=_0xc92016||client;return _0x346c44[_0x791a('0x12')](_0x3fc10a,_0x5daecd)['then'](function(_0x2887f0){logger[_0x791a('0x13')](_0x791a('0x14'),_0x53dc41,_0x791a('0x15'));logger['debug'](_0x791a('0x16'),_0x53dc41,'request\x20sent',JSON[_0x791a('0x17')](_0x2887f0));if(_0x2887f0[_0x791a('0x18')]){if(_0x2887f0['error'][_0x791a('0x19')]===0x1f4){logger['error'](_0x791a('0x14'),_0x53dc41,_0x2887f0['error']['message']);return _0x4c56f0(_0x2887f0['error'][_0x791a('0x1a')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x53dc41,_0x2887f0[_0x791a('0x18')][_0x791a('0x1a')]);return _0x2f2d8d(_0x2887f0[_0x791a('0x18')][_0x791a('0x1a')]);}else{logger['info'](_0x791a('0x14'),_0x53dc41,_0x791a('0x15'));_0x2f2d8d(_0x2887f0[_0x791a('0x1b')][_0x791a('0x1a')]);}})['catch'](function(_0x448085){logger[_0x791a('0x18')](_0x791a('0x14'),_0x53dc41,_0x448085);_0x4c56f0(_0x448085);});});}function respondWithStatusCode(_0x9e17b5,_0x3200dd){_0x3200dd=_0x3200dd||0xcc;return function(_0x1091af){if(_0x1091af){return _0x9e17b5[_0x791a('0x1c')](_0x3200dd);}return _0x9e17b5[_0x791a('0x1d')](_0x3200dd)[_0x791a('0x1e')]();};}function respondWithResult(_0xe8e452,_0x137992){_0x137992=_0x137992||0xc8;return function(_0x5e03a3){if(_0x5e03a3){return _0xe8e452[_0x791a('0x1d')](_0x137992)[_0x791a('0x1f')](_0x5e03a3);}};}function respondWithFilteredResult(_0x380329,_0x2966b8){return function(_0x4d748a){if(_0x4d748a){var _0x456480=typeof _0x2966b8[_0x791a('0x20')]==='undefined'&&typeof _0x2966b8[_0x791a('0x21')]===_0x791a('0x22');var _0x16dbaf=_0x4d748a['count'];var _0x29194d=_0x456480?0x0:_0x2966b8[_0x791a('0x20')];var _0x2b0784=_0x456480?_0x4d748a[_0x791a('0x23')]:_0x2966b8[_0x791a('0x20')]+_0x2966b8[_0x791a('0x21')];var _0x628816;if(_0x2b0784>=_0x16dbaf){_0x2b0784=_0x16dbaf;_0x628816=0xc8;}else{_0x628816=0xce;}_0x380329[_0x791a('0x1d')](_0x628816);return _0x380329['set'](_0x791a('0x24'),_0x29194d+'-'+_0x2b0784+'/'+_0x16dbaf)[_0x791a('0x1f')](_0x4d748a);}return null;};}function saveUpdates(_0x1b10a7){return function(_0x59d2c0){if(_0x59d2c0){return _0x59d2c0[_0x791a('0x25')](_0x1b10a7)['then'](function(_0xc59f5e){return _0xc59f5e;});}return null;};}function removeEntity(_0x2e4ec8){return function(_0xcde862){if(_0xcde862){return _0xcde862[_0x791a('0x26')]()[_0x791a('0x27')](function(){_0x2e4ec8[_0x791a('0x1d')](0xcc)[_0x791a('0x1e')]();});}};}function handleEntityNotFound(_0x4f5506){return function(_0x3662c6){if(!_0x3662c6){_0x4f5506[_0x791a('0x1c')](0x194);}return _0x3662c6;};}function handleError(_0x3fa066,_0x27f758){_0x27f758=_0x27f758||0x1f4;return function(_0x7d5dd0){logger['error'](_0x7d5dd0[_0x791a('0x28')]);if(_0x7d5dd0[_0x791a('0x29')]){delete _0x7d5dd0[_0x791a('0x29')];}_0x3fa066[_0x791a('0x1d')](_0x27f758)[_0x791a('0x2a')](_0x7d5dd0);};}function getMustacheRender(_0x4ef825,_0x305836){return Mustache[_0x791a('0x2b')](_0x4ef825,_[_0x791a('0x2c')](_0x305836[_0x791a('0x2d')],{'contact':_0x305836[_0x791a('0x2e')],'message':_0x305836['message'],'agent':_0x305836[_0x791a('0x2f')],'interaction':_0x305836['interaction'],'account':_0x305836[_0x791a('0x30')]}))||'';}function getInteractionUsers(_0x4cd047,_0x5edb88){return new BPromise(function(_0x425675,_0x404530){try{if(_0x5edb88[_0x4cd047['id']]){_0x4cd047[_0x791a('0x31')]=_[_0x791a('0x32')](_0x5edb88[_0x4cd047['id']],function(_0x18e1f5){return{'id':_0x18e1f5['id'],'fullname':_0x18e1f5[_0x791a('0x33')]};});}}catch(_0x29762d){_0x404530(_0x29762d);}_0x425675(_0x4cd047);});}function getInteractionTags(_0x5ac4c7,_0x37a090){return new BPromise(function(_0x4dc246,_0x10c5ca){try{if(_0x5ac4c7['TagIds']){_0x5ac4c7[_0x791a('0x34')]=[];_0x5ac4c7[_0x791a('0x35')]['split'](',')[_0x791a('0x36')](function(_0x22fb89){_0x5ac4c7['Tags'][_0x791a('0x37')](_0x37a090[_0x22fb89]);});}delete _0x5ac4c7[_0x791a('0x35')];}catch(_0x2861d6){_0x10c5ca(_0x2861d6);}_0x4dc246(_0x5ac4c7);});}function updateChatInteraction(_0x23db7d,_0x29d267,_0x44c720){return new BPromise(function(_0x3a9184,_0xf223d8){return getInteractionUsers(_0x23db7d,_0x44c720)[_0x791a('0x27')](function(_0xeafbb5){return getInteractionTags(_0xeafbb5,_0x29d267);})['then'](function(_0x15f066){return getStateInteraction(_0x15f066);})[_0x791a('0x27')](function(_0x50a4a6){_0x3a9184(_0x50a4a6);})['catch'](function(_0xf4e2fa){_0xf223d8(_0xf4e2fa);});});}function getStateInteraction(_0x5678a3){return new BPromise(function(_0x5bad7d){_0x5678a3['waiting']=0x0;_0x5678a3[_0x791a('0x38')]=0x0;_0x5678a3[_0x791a('0x39')]=0x0;_0x5678a3['unmanaged']=0x0;_0x5678a3[_0x791a('0x3a')]=0x0;_0x5678a3[_0x791a('0x3b')]=0x0;if(!_0x5678a3[_0x791a('0x3c')]&&!_0x5678a3[_0x791a('0x3d')]){_0x5678a3['waiting']+=0x1;}if(!_0x5678a3['closed']&&_0x5678a3['UserId']){_0x5678a3[_0x791a('0x38')]+=0x1;if(_0x5678a3[_0x791a('0x3e')]){_0x5678a3['waiting']-=0x1;}}if(_0x5678a3[_0x791a('0x3c')]&&_0x5678a3[_0x791a('0x3f')]===_0x791a('0x3a')){_0x5678a3[_0x791a('0x3a')]+=0x1;if(_0x5678a3['waiting']){_0x5678a3[_0x791a('0x3e')]-=0x1;}}else if(_0x5678a3['closed']&&!_0x5678a3[_0x791a('0x3d')]&&_0x5678a3[_0x791a('0x3f')]){_0x5678a3[_0x791a('0x40')]+=0x1;if(_0x5678a3[_0x791a('0x3e')]){_0x5678a3[_0x791a('0x3e')]-=0x1;}}else if(_0x5678a3['closed']&&_0x5678a3[_0x791a('0x3d')]){_0x5678a3[_0x791a('0x39')]+=0x1;if(_0x5678a3[_0x791a('0x38')]){_0x5678a3[_0x791a('0x38')]-=0x1;}}_0x5678a3[_0x791a('0x3b')]+=0x1;_0x5bad7d(_0x5678a3);});}exports['index']=function(_0x21d942,_0x2d1f92){var _0x4e379e={},_0x5b039e={},_0x1eb5b1={'count':0x0,'rows':[]};var _0x338e70=_[_0x791a('0x32')](db['ChatInteraction']['rawAttributes'],function(_0x37ca2e){return{'name':_0x37ca2e[_0x791a('0x41')],'type':_0x37ca2e['type'][_0x791a('0x42')]};});_0x5b039e[_0x791a('0x43')]=_[_0x791a('0x32')](_0x338e70,'name');_0x5b039e['query']=_[_0x791a('0x44')](_0x21d942[_0x791a('0x45')]);_0x5b039e[_0x791a('0x46')]=_[_0x791a('0x47')](_0x5b039e['model'],_0x5b039e[_0x791a('0x45')]);_0x4e379e[_0x791a('0x48')]=_[_0x791a('0x47')](_0x5b039e[_0x791a('0x43')],qs['fields'](_0x21d942[_0x791a('0x45')][_0x791a('0x49')]));_0x4e379e[_0x791a('0x48')]=_0x4e379e[_0x791a('0x48')][_0x791a('0x4a')]?_0x4e379e[_0x791a('0x48')]:_0x5b039e[_0x791a('0x43')];if(!_0x21d942['query'][_0x791a('0x4b')](_0x791a('0x4c'))){_0x4e379e['limit']=qs[_0x791a('0x21')](_0x21d942[_0x791a('0x45')]['limit']);_0x4e379e[_0x791a('0x20')]=qs[_0x791a('0x20')](_0x21d942[_0x791a('0x45')][_0x791a('0x20')]);}_0x4e379e[_0x791a('0x4d')]=qs['sort'](_0x21d942['query']['sort']);_0x4e379e[_0x791a('0x4e')]=qs['filters'](_['pick'](_0x21d942[_0x791a('0x45')],_0x5b039e['filters']),_0x338e70);var _0x3e0b17=[];var _0x346467=squel['select']()['field']('id')[_0x791a('0x4f')]('name')[_0x791a('0x4f')](_0x791a('0x50'))[_0x791a('0x51')]('tools_tags');var _0xbcab79=squel[_0x791a('0x52')]()['field'](_0x791a('0x53'))[_0x791a('0x4f')](_0x791a('0x54'))[_0x791a('0x4f')](_0x791a('0x55'))[_0x791a('0x51')]('user_has_chat_interactions','ui')['left_join'](_0x791a('0x56'),'u','u.id\x20=\x20ui.UserId');var _0x45541b=squel[_0x791a('0x52')]()[_0x791a('0x51')](_0x791a('0x57'),'i')[_0x791a('0x58')](_0x791a('0x59'),'c',_0x791a('0x5a'))['left_join'](_0x791a('0x56'),'o',_0x791a('0x5b'))[_0x791a('0x58')](_0x791a('0x5c'),'a',_0x791a('0x5d'))[_0x791a('0x58')](_0x791a('0x5e'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x791a('0x58')]('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')[_0x791a('0x58')](_0x791a('0x5f'),'t',_0x791a('0x60'));var _0x2e3432=squel[_0x791a('0x61')]();var _0x129d60=[];var _0x2001ce=squel[_0x791a('0x61')]();var _0x2bfb66;if(_0x21d942[_0x791a('0x45')][_0x791a('0x62')]){_0x2bfb66=as[_0x791a('0x63')](_0x21d942[_0x791a('0x45')][_0x791a('0x62')]);var _0x38adc1=_0x2bfb66[_0x791a('0x64')];for(var _0xb05c3=0x0;_0xb05c3<_0x2bfb66[_0x791a('0x65')][_0x791a('0x4a')];_0xb05c3++){var _0x3cf4c7=_0x2bfb66['conditions'][_0xb05c3];var _0x215010='i';var _0x32d521=_[_0x791a('0x66')](_0x338e70,[_0x791a('0x29'),_0x3cf4c7[_0x791a('0x4f')]]);if(!_0x32d521){switch(_0x3cf4c7['field']){case _0x791a('0x67'):if(_0x3cf4c7[_0x791a('0x68')]==0x1){_0x45541b[_0x791a('0x69')]('`'+_0x3cf4c7[_0x791a('0x4f')]+'`\x20=\x200');}else{_0x45541b[_0x791a('0x69')]('`'+_0x3cf4c7['field']+'`\x20>\x200');}break;case'Contact':if(_0x3cf4c7['operator']===_0x791a('0x6a')){if(_0x3cf4c7[_0x791a('0x68')][_0x791a('0x6b')]('\x20')[_0x791a('0x4a')]>0x1){_0x2e3432[_0x38adc1](_0x791a('0x6c'),qs[_0x791a('0x6d')](_0x3cf4c7[_0x791a('0x68')]),null);}else{var _0x5dca78='%'+_0x3cf4c7['value']+'%';_0x2e3432[_0x38adc1](_0x791a('0x6e'),_0x5dca78,_0x5dca78,_0x5dca78);}}else{_0x32d521=_[_0x791a('0x66')](_0x338e70,['name','ContactId']);_0x3cf4c7[_0x791a('0x4f')]=_0x791a('0x6f');_0x356cd8=as['buildExpression'](_0x215010,_0x32d521[_0x791a('0x70')],_0x3cf4c7);_0x2e3432[_0x38adc1](_0x356cd8[_0x791a('0x71')],_0x356cd8[_0x791a('0x68')][_0x791a('0x72')],_0x356cd8['value']['end']);}break;case _0x791a('0x73'):var _0xffe403=_0x3cf4c7['value'][_0x791a('0x6b')](',')[_0x791a('0x32')](function(_0x10b51f){return Number(_0x10b51f);});_0xffe403[_0x791a('0x36')](function(_0x565c83){_0x2001ce['or'](_0x791a('0x74'),'%,'+_0x565c83+',%');});_0x129d60=_[_0x791a('0x75')](_0x129d60,_0xffe403);break;case _0x791a('0x76'):if(_0x3cf4c7[_0x791a('0x77')]===_0x791a('0x6a')){_0x2e3432[_0x38adc1](_0x791a('0x78'),'%'+_0x3cf4c7[_0x791a('0x68')]+'%',null);}else{_0x32d521=_[_0x791a('0x66')](_0x338e70,['name','UserId']);_0x3cf4c7['field']=_0x791a('0x3d');_0x356cd8=as[_0x791a('0x79')](_0x215010,_0x32d521[_0x791a('0x70')],_0x3cf4c7);_0x2e3432[_0x38adc1](_0x356cd8[_0x791a('0x71')],_0x356cd8[_0x791a('0x68')][_0x791a('0x72')],_0x356cd8[_0x791a('0x68')][_0x791a('0x1e')]);}break;case _0x791a('0x2d'):_0x356cd8=as[_0x791a('0x79')]('me',null,_0x3cf4c7);_0x2e3432[_0x38adc1](_0x356cd8['text'],_0x356cd8[_0x791a('0x68')][_0x791a('0x72')],_0x356cd8['value'][_0x791a('0x1e')]);break;}}else{var _0x356cd8=as['buildExpression'](_0x215010,_0x32d521['type'],_0x3cf4c7);_0x2e3432[_0x38adc1](_0x356cd8[_0x791a('0x71')],_0x356cd8[_0x791a('0x68')]['start'],_0x356cd8['value'][_0x791a('0x1e')]);}}}else{var _0x13d6bf=_(_0x21d942[_0x791a('0x45')])['keys']()[_0x791a('0x32')](function(_0x4b27a7){return _[_0x791a('0x7a')](_0x338e70,[_0x791a('0x29'),_0x4b27a7])?_0x4b27a7:undefined;})[_0x791a('0x7b')]()[_0x791a('0x68')]();if(!_[_0x791a('0x7c')](_0x13d6bf)){_0x13d6bf[_0x791a('0x36')](function(_0x4b7e47){if(_0x4b7e47===_0x791a('0x7d')){_0x45541b[_0x791a('0x4e')](_0x791a('0x7e'),[][_0x791a('0x7f')](_0x21d942[_0x791a('0x45')][_0x4b7e47]));}else if(_0x4b7e47===_0x791a('0x80')){var _0x265584=JSON[_0x791a('0x81')](_0x21d942[_0x791a('0x45')][_0x4b7e47])[_0x791a('0x82')];var _0x93def2=JSON[_0x791a('0x81')](_0x21d942[_0x791a('0x45')][_0x4b7e47])[_0x791a('0x83')];_0x45541b[_0x791a('0x4e')](_0x791a('0x84'),_0x265584,_0x93def2);}else{if(_0x21d942[_0x791a('0x45')][_0x4b7e47]===_0x791a('0x85')){_0x45541b['where']('i.'+_0x4b7e47+_0x791a('0x86'));}else{_0x45541b[_0x791a('0x4e')]('i.'+_0x4b7e47+_0x791a('0x87'),_0x21d942[_0x791a('0x45')][_0x4b7e47]);}}});}if(_0x21d942[_0x791a('0x45')]['read']){if(_0x21d942[_0x791a('0x45')]['read']==0x1){_0x45541b[_0x791a('0x69')]('`unreadMessages`\x20=\x200');}else{_0x45541b[_0x791a('0x69')](_0x791a('0x88'));}}if(_0x21d942['query'][_0x791a('0x89')]){_0x129d60=_[_0x791a('0x8a')](_0x21d942[_0x791a('0x45')]['tag'])?_0x21d942[_0x791a('0x45')]['tag']:new Array(_0x21d942[_0x791a('0x45')]['tag']);_0x129d60['forEach'](function(_0x4eda9d){_0x2001ce['or'](_0x791a('0x74'),'%,'+_0x4eda9d+',%');});}if(_0x21d942[_0x791a('0x45')][_0x791a('0x8b')]){var _0xbcb58a=_0x21d942['query'][_0x791a('0x8b')][_0x791a('0x8c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x791a('0x8d')](_0xbcb58a)){_0x2e3432['or'](_0x791a('0x8e'),_0xbcb58a+'%');}else{_0x2e3432['or'](_0x791a('0x8f'),qs['getFullTextValue'](_0xbcb58a))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xbcb58a+'%');}}}_0x45541b[_0x791a('0x4e')](_0x2e3432);_0x45541b[_0x791a('0x90')](_0x791a('0x91'));var _0x55f42d={'type':db[_0x791a('0x92')][_0x791a('0x93')][_0x791a('0x94')],'raw':!![]};var _0x4da737=_0x45541b['clone']();_0x4da737[_0x791a('0x4f')](_0x791a('0x91'));_0x4da737[_0x791a('0x4f')](_0x791a('0x95'),'unreadMessages');if(_0x4e379e['order']){_0x4e379e[_0x791a('0x4d')][_0x791a('0x36')](function(_0x350d64){var _0x100c74=_0x350d64[0x0]===_0x791a('0x96')?_0x350d64[0x0]:'i.'+_0x350d64[0x0];_0x45541b[_0x791a('0x4d')](_0x100c74,_0x350d64[0x1]===_0x791a('0x97')?![]:!![]);});}if(!_[_0x791a('0x7c')](_0x129d60)){_0x45541b[_0x791a('0x69')](_0x2001ce);_0x4da737[_0x791a('0x4e')](_0x791a('0x98'),_0x129d60);}BPromise[_0x791a('0x99')]()[_0x791a('0x27')](function(){if(!_0x2bfb66){if(_0x21d942['query'][_0x791a('0x7d')])return;_0x4da737[_0x791a('0x4e')](_0x791a('0x9a'));_0x45541b[_0x791a('0x4e')](_0x791a('0x9a'));return;}if(_0x21d942[_0x791a('0x9b')][_0x791a('0x9c')]!==_0x791a('0x2f'))return;return _0x21d942[_0x791a('0x9b')][_0x791a('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x19d6bd){if(_[_0x791a('0x7c')](_0x19d6bd)){_0x4da737['where'](_0x791a('0x9e'));_0x45541b[_0x791a('0x4e')](_0x791a('0x9e'));}else{_0x4da737[_0x791a('0x4e')](_0x791a('0x7e'),_['map'](_0x19d6bd,'id'));_0x45541b['where'](_0x791a('0x7e'),_[_0x791a('0x32')](_0x19d6bd,'id'));}});})['then'](function(){if(_0x21d942['user'][_0x791a('0x9c')]===_0x791a('0x2f')&&!_0x2bfb66&&!_0x21d942[_0x791a('0x45')][_0x791a('0x7d')])return[];return db[_0x791a('0x9f')][_0x791a('0x45')](_0x4da737[_0x791a('0xa0')](),_0x55f42d);})[_0x791a('0x27')](function(_0x5cbf23){_0x1eb5b1['count']=_0x5cbf23['length'];if(_0x1eb5b1[_0x791a('0x23')]===0x0)return[];return db[_0x791a('0x9f')][_0x791a('0x45')](_0x346467['toString'](),_0x55f42d)['then'](function(_0x37880d){_0x3e0b17=_[_0x791a('0xa1')](_0x37880d,'id');_0x55f42d=_[_0x791a('0x2c')](_0x55f42d,{'model':db[_0x791a('0xa2')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x21d942['query'][_0x791a('0x49')]){_0x4e379e[_0x791a('0x48')][_0x791a('0x36')](function(_0xae5e61){_0x45541b[_0x791a('0x4f')]('i.'+_0xae5e61);});}else{_0x45541b[_0x791a('0x4f')](_0x791a('0x95'),_0x791a('0x67'));_0x45541b[_0x791a('0x4f')](_0x791a('0xa3'),_0x791a('0xa4'));_0x45541b['field'](_0x791a('0xa5'),_0x791a('0xa6'));_0x45541b[_0x791a('0x4f')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x45541b['field'](_0x791a('0xa7'));_0x45541b[_0x791a('0x4f')](_0x791a('0xa8'),_0x791a('0xa9'));_0x45541b[_0x791a('0x4f')](_0x791a('0xaa'),'Contact.lastName');_0x45541b[_0x791a('0x4f')](_0x791a('0xab'),_0x791a('0xac'));_0x45541b['field'](_0x791a('0xad'),_0x791a('0xae'));_0x45541b['field'](_0x791a('0xaf'),'Contact.mobile');_0x45541b[_0x791a('0x4f')]('c.fax',_0x791a('0xb0'));_0x45541b['field']('o.fullname','Owner.fullname');_0x45541b['field'](_0x791a('0xb1'),_0x791a('0xb2'));_0x45541b[_0x791a('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x791a('0x35'));}if(_0x4e379e[_0x791a('0x21')])_0x45541b[_0x791a('0x21')](_0x4e379e[_0x791a('0x21')]);if(_0x4e379e[_0x791a('0x20')])_0x45541b['offset'](_0x4e379e['offset']);return db[_0x791a('0x9f')][_0x791a('0x45')](_0x45541b[_0x791a('0xa0')](),_0x55f42d);})['then'](function(_0x260ffd){if(_0x260ffd['length']>0x0)_0xbcab79[_0x791a('0x4e')](_0x791a('0xb3'),_[_0x791a('0x32')](_0x260ffd,'id'));return db['sequelize'][_0x791a('0x45')](_0xbcab79[_0x791a('0xa0')](),_0x55f42d)[_0x791a('0x27')](function(_0x480688){var _0x4e0f46=_[_0x791a('0xb4')](_0x480688,_0x791a('0xb5'));var _0x432795=[];_0x260ffd[_0x791a('0x36')](function(_0xb39ddf){_0x432795['push'](updateChatInteraction(_0xb39ddf,_0x3e0b17,_0x4e0f46));});return BPromise['all'](_0x432795);});});})['then'](function(_0x5d5b8a){_0x1eb5b1[_0x791a('0xb6')]=_0x5d5b8a;return _0x1eb5b1;})['then'](respondWithFilteredResult(_0x2d1f92,_0x4e379e))[_0x791a('0xb7')](handleError(_0x2d1f92,null));};exports[_0x791a('0xb8')]=function(_0x3f113c,_0x3411b9){var _0x2abd26={'raw':![],'where':{'id':_0x3f113c[_0x791a('0xb9')]['id']}},_0x1a3b01={};_0x1a3b01[_0x791a('0x43')]=_[_0x791a('0x44')](db[_0x791a('0xa2')][_0x791a('0xba')]);_0x1a3b01['query']=_[_0x791a('0x44')](_0x3f113c[_0x791a('0x45')]);_0x1a3b01['filters']=_[_0x791a('0x47')](_0x1a3b01[_0x791a('0x43')],_0x1a3b01[_0x791a('0x45')]);_0x2abd26['attributes']=_[_0x791a('0x47')](_0x1a3b01[_0x791a('0x43')],qs[_0x791a('0x49')](_0x3f113c['query'][_0x791a('0x49')]));_0x2abd26[_0x791a('0x48')]=_0x2abd26[_0x791a('0x48')][_0x791a('0x4a')]?_0x2abd26['attributes']:_0x1a3b01['model'];if(_0x3f113c['query']['includeAll']){_0x2abd26[_0x791a('0xbb')]=[{'all':!![]}];}_0x2abd26=_[_0x791a('0x2c')]({},_0x2abd26,_0x3f113c['options']);return db[_0x791a('0xa2')][_0x791a('0x66')](_0x2abd26)[_0x791a('0x27')](handleEntityNotFound(_0x3411b9,null))[_0x791a('0x27')](respondWithResult(_0x3411b9,null))[_0x791a('0xb7')](handleError(_0x3411b9,null));};exports[_0x791a('0xbc')]=function(_0x83db3a,_0x584f48){return db[_0x791a('0xa2')][_0x791a('0xbc')](_0x83db3a['body'],{})[_0x791a('0x27')](respondWithResult(_0x584f48,0xc9))['catch'](handleError(_0x584f48,null));};exports[_0x791a('0x25')]=function(_0x1a2ae1,_0x1c6574){if(_0x1a2ae1['body']['id']){delete _0x1a2ae1[_0x791a('0x2d')]['id'];}return db[_0x791a('0xa2')][_0x791a('0x66')]({'where':{'id':_0x1a2ae1[_0x791a('0xb9')]['id']}})[_0x791a('0x27')](handleEntityNotFound(_0x1c6574,null))[_0x791a('0x27')](saveUpdates(_0x1a2ae1[_0x791a('0x2d')],null))[_0x791a('0x27')](respondWithResult(_0x1c6574,null))[_0x791a('0xb7')](handleError(_0x1c6574,null));};exports[_0x791a('0x26')]=function(_0x4f1d72,_0x4e840c){return db[_0x791a('0xa2')][_0x791a('0x66')]({'where':{'id':_0x4f1d72[_0x791a('0xb9')]['id']}})[_0x791a('0x27')](handleEntityNotFound(_0x4e840c,null))[_0x791a('0x27')](removeEntity(_0x4e840c,null))['catch'](handleError(_0x4e840c,null));};exports['describe']=function(_0x439ec8,_0x1ce92c){return db[_0x791a('0xa2')][_0x791a('0xbd')]()[_0x791a('0x27')](respondWithResult(_0x1ce92c,null))[_0x791a('0xb7')](handleError(_0x1ce92c,null));};exports['createVidaooSession']=function(_0x27c37d,_0x541d45){var _0x32437e=_0x27c37d['params']['id'];var _0x2994b6;var _0x59a5b1;var _0x4c6b20;return db[_0x791a('0xa2')][_0x791a('0xbe')]({'where':{'id':_0x32437e}})[_0x791a('0x27')](function(_0x371b29){_0x2994b6=_0x371b29;return db[_0x791a('0xbf')][_0x791a('0xbe')]({'where':{'id':_0x371b29[_0x791a('0x7d')]},'attributes':['id','vidaooApiKey',_0x791a('0xc0'),_0x791a('0xc1'),_0x791a('0xc2'),_0x791a('0xc3')],'raw':!![]});})[_0x791a('0x27')](function(_0x2766a8){if(_0x2766a8&&_0x2766a8['vidaooApiKey']&&_0x2766a8[_0x791a('0xc0')]){_0x59a5b1=_0x2766a8;var _0x4b196b={'interaction':{'id':_0x32437e},'agent':{'id':_0x27c37d['user']['id'],'name':_0x27c37d[_0x791a('0x9b')]['name'],'fullname':_0x27c37d[_0x791a('0x9b')]['fullname'],'email':_0x27c37d[_0x791a('0x9b')]['email']},'contact':_0x27c37d['body'][_0x791a('0x2e')],'account':_0x27c37d[_0x791a('0x2d')]['account']};var _0x5cfaed={'rejectUnauthorized':![],'method':'POST','url':_0x791a('0xc4'),'headers':{'X-APIKEY':_0x2766a8[_0x791a('0xc5')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x27c37d[_0x791a('0x9b')][_0x791a('0xc6')]],'buttons':null,'topic':_0x59a5b1[_0x791a('0xc1')],'note':_['isNull'](_0x59a5b1['vidaooNote'])?null:getMustacheRender(_0x59a5b1[_0x791a('0xc2')],_0x4b196b),'metadata':null},'redirect':_0x791a('0xc7'),'json':!![]};try{if(!_['isNull'](_0x59a5b1[_0x791a('0xc3')])){var _0x5a49d1=getMustacheRender(_0x59a5b1[_0x791a('0xc3')],_0x4b196b);var _0x327920=JSON['parse'](_0x5a49d1);_0x5cfaed[_0x791a('0x2d')][_0x791a('0xc8')]=_0x327920;}}catch(_0x401df3){throw new db[(_0x791a('0x92'))][(_0x791a('0xc9'))](_0x791a('0xca'));}return rp(_0x5cfaed);}else{throw new db[(_0x791a('0x92'))]['ValidationError'](_0x791a('0xcb'));}})[_0x791a('0x27')](function(_0x3583fc){_0x4c6b20=_0x3583fc;if(_0x4c6b20['id']){var _0x484f0c={'body':_0x4c6b20['join_url'],'ChatWebsiteId':_0x59a5b1['id'],'ChatInteractionId':_0x2994b6['id'],'direction':'out','UserId':_0x27c37d[_0x791a('0x9b')]['id']};return db[_0x791a('0xcc')][_0x791a('0xbc')](_0x484f0c,{});}else{throw new db[(_0x791a('0x92'))]['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x2994b6[_0x791a('0xcd')]({'vidaooSessionId':_0x4c6b20['id']});})[_0x791a('0x27')](respondWithResult(_0x541d45,null))[_0x791a('0xb7')](handleError(_0x541d45,null));};exports['customUpdate']=function(_0x4bd342,_0x3b8bd7){if(_0x4bd342[_0x791a('0x2d')]['id']){delete _0x4bd342['body']['id'];}return db[_0x791a('0xa2')][_0x791a('0x66')]({'where':{'id':_0x4bd342[_0x791a('0xb9')]['id']},'include':[{'model':db[_0x791a('0xce')],'as':_0x791a('0xcf')}]})[_0x791a('0x27')](handleEntityNotFound(_0x3b8bd7,null))[_0x791a('0x27')](saveUpdates(_0x4bd342[_0x791a('0x2d')],null))[_0x791a('0x27')](respondWithResult(_0x3b8bd7,null))['catch'](handleError(_0x3b8bd7,null));};exports[_0x791a('0xd0')]=function(_0x308094,_0x15376a){if(_0x308094[_0x791a('0x2d')]['id']){delete _0x308094[_0x791a('0x2d')]['id'];}return db['ChatInteraction'][_0x791a('0x66')]({'where':{'id':_0x308094[_0x791a('0xb9')]['id']}})['then'](function(_0x19cd58){if(!_0x19cd58){logger[_0x791a('0x18')](_0x791a('0xd1'),_0x791a('0xd0'),0x194,_0x791a('0xd2'));_0x15376a[_0x791a('0x1c')](0x194);}else{if(_0x19cd58[_0x791a('0x3d')]){throw new db[(_0x791a('0x92'))][(_0x791a('0xc9'))](_0x791a('0xd3'));}}return _0x19cd58;})[_0x791a('0x27')](function(_0x226a53){if(_0x226a53){return _0x226a53[_0x791a('0x25')]({'closed':_0x308094['body'][_0x791a('0x3c')],'disposition':_0x308094[_0x791a('0x2d')][_0x791a('0x3f')]})[_0x791a('0x27')](function(_0x275b87){return _0x275b87;});}})[_0x791a('0x27')](function(){return respondWithRpcPromise('AbandonInteraction',_0x791a('0xd0'),_0x308094[_0x791a('0x2d')],client9004);})[_0x791a('0x27')](respondWithResult(_0x15376a,null))[_0x791a('0xb7')](handleError(_0x15376a,null));};exports[_0x791a('0xd4')]=function(_0x41cc4d,_0x49dd2){_0x41cc4d[_0x791a('0x2d')][_0x791a('0x29')]=_0x41cc4d[_0x791a('0xd5')]['originalname'];_0x41cc4d[_0x791a('0x2d')][_0x791a('0xd6')]=_0x41cc4d[_0x791a('0xd5')]['filename'];_0x41cc4d[_0x791a('0x2d')][_0x791a('0x70')]=_0x41cc4d[_0x791a('0xd5')]['mimetype'];return db['Attachment'][_0x791a('0xbc')](_0x41cc4d[_0x791a('0x2d')])[_0x791a('0x27')](respondWithResult(_0x49dd2,0xc9))[_0x791a('0xb7')](handleError(_0x49dd2,null));};exports[_0x791a('0xd7')]=function(_0x6422b6,_0x421483){return db[_0x791a('0xa2')][_0x791a('0xbe')]({'where':{'id':_0x6422b6[_0x791a('0xb9')]['id']},'raw':!![]})[_0x791a('0x27')](handleEntityNotFound(_0x421483,null))['then'](function(_0x50ddb){if(_0x50ddb){if(_0x50ddb[_0x791a('0x3c')]){return _0x421483[_0x791a('0x1d')](0x193)[_0x791a('0x1f')]({'status':0x193,'message':_0x791a('0xd8')});}return db[_0x791a('0xd9')][_0x791a('0xbe')]({'where':{'id':_0x6422b6[_0x791a('0x45')][_0x791a('0xda')]},'raw':!![]})[_0x791a('0x27')](handleEntityNotFound(_0x421483,null));}})[_0x791a('0x27')](function(_0x3781d1){if(_0x3781d1){var _0xac33c0=_0x3781d1[_0x791a('0xdb')]!==null;var _0x255852=path[_0x791a('0xdc')](config[_0x791a('0xdd')],'server/files/attachments/');if(_0xac33c0){_0x255852=path[_0x791a('0xdc')](_0x255852,_0x791a('0xde'));}var _0x3cd9ec=path[_0x791a('0xdc')](_0x255852,_0x3781d1[_0x791a('0xd6')]);return _0x421483['download'](_0x3cd9ec);}})[_0x791a('0xb7')](handleError(_0x421483,null));};exports[_0x791a('0xdf')]=function(_0x3bc1dc,_0x4c33af){var _0x5871b0=null;var _0x450439=null;var _0x1db761=null;if(_0x3bc1dc['body']['id']){delete _0x3bc1dc[_0x791a('0x2d')]['id'];}if(_0x3bc1dc[_0x791a('0x2d')][_0x791a('0xe0')]){_0x1db761=path[_0x791a('0xdc')](config[_0x791a('0xdd')],'server/files/chat/upload/',util['format'](_0x791a('0xe1'),Date[_0x791a('0xe2')]()));_0x3bc1dc[_0x791a('0x2d')][_0x791a('0xe3')]=_0x1db761;}return db[_0x791a('0xa2')][_0x791a('0x66')]({'where':{'id':_0x3bc1dc[_0x791a('0xb9')]['id']},'include':[{'model':db[_0x791a('0xcc')],'as':_0x791a('0xe4'),'include':[{'model':db[_0x791a('0x76')],'as':_0x791a('0x76')}]}]})['then'](handleEntityNotFound(_0x4c33af,null))['then'](saveUpdates(_0x3bc1dc[_0x791a('0x2d')],null))[_0x791a('0x27')](function(_0x152a56){if(_0x152a56){_0x5871b0=_0x152a56;return db[_0x791a('0xbf')][_0x791a('0x66')]({'where':{'id':_0x5871b0['ChatWebsiteId']}});}})[_0x791a('0x27')](function(_0x94d697){if(_0x94d697){_0x450439=_0x94d697;return db[_0x791a('0xce')][_0x791a('0x66')]({'where':{'id':_0x5871b0[_0x791a('0x6f')]}});}})[_0x791a('0x27')](function(_0x3c642c){if(_0x3c642c){if(_0x1db761){var _0x544afc=null;for(var _0x8c5f69=0x1;_0x8c5f69<_0x5871b0[_0x791a('0xe4')][_0x791a('0x4a')];++_0x8c5f69){_0x544afc=_0x5871b0[_0x791a('0xe4')][_0x8c5f69];var _0x1c8d33=_0x544afc['UserId']?util['format']('%s%d',_0x450439[_0x791a('0xe5')],_0x544afc[_0x791a('0x3d')]):_0x791a('0xe6');var _0x4080f2=_0x3bc1dc[_0x791a('0x2d')]['customer']||util[_0x791a('0xe7')](_0x791a('0xe8'),'Visitor',_0x544afc[_0x791a('0x6f')]);switch(_0x450439['agentIdentifier']){case'website_alias':_0x1c8d33=_0x544afc['UserId']?util[_0x791a('0xe7')](_0x791a('0xe8'),_0x450439[_0x791a('0xe5')],_0x544afc[_0x791a('0x3d')]):_0x791a('0xe6');break;case _0x791a('0xe9'):_0x1c8d33=_0x544afc[_0x791a('0x3d')]?_0x544afc[_0x791a('0x76')][_0x791a('0xea')]||_0x544afc[_0x791a('0x76')]['fullname']:_0x791a('0xe6');break;case _0x791a('0xeb'):_0x1c8d33=_0x544afc[_0x791a('0x3d')]?_0x544afc['User'][_0x791a('0x33')]:_0x791a('0xe6');break;default:_0x1c8d33=_0x544afc[_0x791a('0x3d')]?util[_0x791a('0xe7')]('%s%d',_0x450439[_0x791a('0xe5')],_0x544afc[_0x791a('0x3d')]):'System';}var _0x11ec18=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x544afc[_0x791a('0x80')])[_0x791a('0xe7')](_0x791a('0xec')),_0x544afc['direction']==='in'?_0x4080f2:_0x1c8d33,_0x544afc['body']);if(!_0x544afc[_0x791a('0xed')]){fs[_0x791a('0xee')](_0x1db761,_0x11ec18);}}return db[_0x791a('0xef')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x791a('0xf0')],'as':_0x791a('0xf1'),'raw':!![],'include':[{'model':db[_0x791a('0xf2')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x791a('0x27')](function(_0x3ca8df){if(!_0x3ca8df||!_0x3ca8df[_0x791a('0xf1')]||!_0x3bc1dc['body'])return _0x5871b0;var _0xb5ea00=_0x3ca8df[_0x791a('0xf3')]();return respondWithRpcPromise(_0x791a('0xf4'),_0x791a('0xf5'),{'account':_0xb5ea00,'message':{'from':util[_0x791a('0xe7')](_0x791a('0xf6'),_0x3ca8df[_0x791a('0x29')],_0x3ca8df[_0x791a('0xc6')]||_0x3ca8df['Smtp'][_0x791a('0x9b')]),'to':_0x3bc1dc[_0x791a('0x2d')][_0x791a('0xe0')],'subject':'Mail\x20Transcript','text':util[_0x791a('0xe7')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x3bc1dc[_0x791a('0x2d')][_0x791a('0xe0')]),'attachments':[{'path':_0x1db761}]}})[_0x791a('0x27')](function(){return _0x5871b0;})[_0x791a('0xb7')](function(_0x4e8801){logger[_0x791a('0x18')](_0x4e8801);});})[_0x791a('0x27')](respondWithStatusCode(_0x4c33af,0xc8))[_0x791a('0xb7')](handleError(_0x4c33af,null));};exports[_0x791a('0xf7')]=function(_0x71e04c,_0x3219d9){return db[_0x791a('0xcc')]['find']({'where':{'id':_0x71e04c[_0x791a('0xb9')]['id']}})[_0x791a('0x27')](handleEntityNotFound(_0x3219d9,null))[_0x791a('0x27')](function(_0x1f8d6d){if(_0x1f8d6d){return _0x1f8d6d[_0x791a('0xf7')](_0x71e04c[_0x791a('0x2d')][_0x791a('0xf8')],_[_0x791a('0xf9')](_0x71e04c[_0x791a('0x2d')],['ids','id'])||{});}})[_0x791a('0x27')](respondWithResult(_0x3219d9,null))[_0x791a('0xb7')](handleError(_0x3219d9,null));};exports[_0x791a('0xfa')]=function(_0x4b19c6,_0xa51ffb){var _0x3b356f={'raw':![],'where':{}};var _0x30d901={};var _0x3e0953={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x4b19c6[_0x791a('0xb9')]['id']}})[_0x791a('0x27')](handleEntityNotFound(_0xa51ffb,null))[_0x791a('0x27')](function(_0x2cb8f4){if(_0x2cb8f4){_0x30d901['model']=_[_0x791a('0x44')](db[_0x791a('0xcc')][_0x791a('0xba')]);_0x30d901[_0x791a('0x45')]=_[_0x791a('0x44')](_0x4b19c6[_0x791a('0x45')]);_0x30d901[_0x791a('0x46')]=_[_0x791a('0x47')](_0x30d901[_0x791a('0x43')],_0x30d901[_0x791a('0x45')]);_0x3b356f['attributes']=_[_0x791a('0x47')](_0x30d901[_0x791a('0x43')],qs[_0x791a('0x49')](_0x4b19c6['query'][_0x791a('0x49')]));_0x3b356f[_0x791a('0x48')]=_0x3b356f[_0x791a('0x48')][_0x791a('0x4a')]?_0x3b356f['attributes']:_0x30d901['model'];if(!_0x4b19c6[_0x791a('0x45')][_0x791a('0x4b')](_0x791a('0x4c'))){_0x3b356f['limit']=qs['limit'](_0x4b19c6[_0x791a('0x45')][_0x791a('0x21')]);_0x3b356f[_0x791a('0x20')]=qs['offset'](_0x4b19c6[_0x791a('0x45')][_0x791a('0x20')]);}_0x3b356f[_0x791a('0x4d')]=qs['sort'](_0x4b19c6[_0x791a('0x45')][_0x791a('0xfb')]);_0x3b356f['where']=qs[_0x791a('0x46')](_[_0x791a('0xfc')](_0x4b19c6[_0x791a('0x45')],_0x30d901[_0x791a('0x46')]));_0x3b356f[_0x791a('0x4e')][_0x791a('0xb5')]=_0x2cb8f4['id'];if(_0x4b19c6['query'][_0x791a('0x8b')]){_0x3b356f[_0x791a('0x4e')]=_[_0x791a('0x2c')](_0x3b356f['where'],{'$or':_[_0x791a('0x32')](_0x3b356f[_0x791a('0x48')],function(_0x133a27){var _0x48db0d={};_0x48db0d[_0x133a27]={'$like':'%'+_0x4b19c6['query']['filter']+'%'};return _0x48db0d;})});}if(_0x4b19c6[_0x791a('0x45')][_0x791a('0x82')]){var _0x124eb4=_0x4b19c6[_0x791a('0x45')][_0x791a('0x82')][_0x791a('0x6b')](',');var _0x471d1f={};_0x471d1f[_0x124eb4[0x0]]={'$gte':moment(_0x124eb4[0x1])['format'](_0x791a('0xfd'))};_0x3b356f[_0x791a('0x4e')]=_['merge'](_0x3b356f['where'],_0x471d1f);}_0x3b356f=_[_0x791a('0x2c')]({},_0x3b356f,_0x4b19c6[_0x791a('0xfe')]);return db['ChatMessage']['count']({'where':_0x3b356f[_0x791a('0x4e')]})[_0x791a('0x27')](function(_0x5a6190){_0x3e0953[_0x791a('0x23')]=_0x5a6190;if(_0x4b19c6[_0x791a('0x45')]['includeAll']){_0x3b356f[_0x791a('0xbb')]=[{'all':!![]}];}return db[_0x791a('0xcc')][_0x791a('0xff')](_0x3b356f);})[_0x791a('0x27')](function(_0xba19bb){_0x3e0953[_0x791a('0xb6')]=_0xba19bb;return _0x3e0953;});}})[_0x791a('0x27')](respondWithFilteredResult(_0xa51ffb,_0x3b356f))[_0x791a('0xb7')](handleError(_0xa51ffb,null));};exports[_0x791a('0x100')]=function(_0x3e22c5,_0x39ce3d){var _0xf23869={'where':{}},_0x3f3871={},_0x5bbbf9={'count':0x0,'rows':[]};return db[_0x791a('0xa2')][_0x791a('0xbe')]({'where':{'id':_0x3e22c5[_0x791a('0xb9')]['id']}})['then'](handleEntityNotFound(_0x39ce3d,null))[_0x791a('0x27')](function(_0x4dd8e1){if(_0x4dd8e1){_0x3f3871[_0x791a('0x43')]=_[_0x791a('0x44')](db[_0x791a('0xcc')][_0x791a('0xba')]);_0x3f3871[_0x791a('0x45')]=_[_0x791a('0x44')](_0x3e22c5[_0x791a('0x45')]);_0x3f3871[_0x791a('0x46')]=_[_0x791a('0x47')](_0x3f3871[_0x791a('0x43')],_0x3f3871[_0x791a('0x45')]);_0xf23869[_0x791a('0x48')]=_[_0x791a('0x47')](_0x3f3871[_0x791a('0x43')],qs['fields'](_0x3e22c5['query']['fields']));_0xf23869[_0x791a('0x48')]=_0xf23869[_0x791a('0x48')]['length']?_0xf23869['attributes']:_0x3f3871[_0x791a('0x43')];if(!_0x3e22c5[_0x791a('0x45')][_0x791a('0x4b')](_0x791a('0x4c'))){_0xf23869[_0x791a('0x21')]=qs[_0x791a('0x21')](_0x3e22c5['query'][_0x791a('0x21')]);_0xf23869[_0x791a('0x20')]=qs[_0x791a('0x20')](_0x3e22c5['query'][_0x791a('0x20')]);}_0xf23869[_0x791a('0x4d')]=qs[_0x791a('0xfb')](_0x3e22c5[_0x791a('0x45')][_0x791a('0xfb')]);_0xf23869[_0x791a('0x4e')]=qs[_0x791a('0x46')](_[_0x791a('0xfc')](_0x3e22c5['query'],_0x3f3871['filters']));_0xf23869[_0x791a('0x4e')][_0x791a('0xb5')]=_0x4dd8e1['id'];if(_0x3e22c5[_0x791a('0x45')][_0x791a('0x8b')]){_0xf23869[_0x791a('0x4e')]=_['merge'](_0xf23869[_0x791a('0x4e')],{'$or':_['map'](_0xf23869[_0x791a('0x48')],function(_0x196f3c){var _0xc40de0={};_0xc40de0[_0x196f3c]={'$like':'%'+_0x3e22c5[_0x791a('0x45')][_0x791a('0x8b')]+'%'};return _0xc40de0;})});}_0xf23869[_0x791a('0x4e')]['secret']=![];if(_0x3e22c5[_0x791a('0x45')]['id']){_0xf23869[_0x791a('0x4e')]['id']={'$gt':_0x3e22c5[_0x791a('0x45')]['id']};}_0xf23869=_[_0x791a('0x2c')]({},_0xf23869,_0x3e22c5['options']);return db[_0x791a('0xcc')][_0x791a('0x23')]({'where':_0xf23869[_0x791a('0x4e')]})[_0x791a('0x27')](function(_0x240038){_0x5bbbf9[_0x791a('0x23')]=_0x240038;_0xf23869[_0x791a('0xbb')]=[];if(_0x3e22c5[_0x791a('0x45')][_0x791a('0x101')]){_0xf23869[_0x791a('0xbb')]['push']({'model':db[_0x791a('0x76')],'as':'User','attributes':['id',_0x791a('0x33'),'alias']});}if(_0x3e22c5[_0x791a('0x45')][_0x791a('0x102')]){_0xf23869[_0x791a('0xbb')]=[{'all':!![]}];}return db[_0x791a('0xcc')][_0x791a('0xff')](_0xf23869);})[_0x791a('0x27')](function(_0x292de0){_0x5bbbf9[_0x791a('0xb6')]=_0x292de0;return _0x5bbbf9;});}})[_0x791a('0x27')](respondWithFilteredResult(_0x39ce3d,_0xf23869))[_0x791a('0xb7')](handleError(_0x39ce3d,null));};exports[_0x791a('0x103')]=function(_0xb751bd,_0x552328){return db[_0x791a('0xa2')][_0x791a('0x66')]({'where':{'id':_0xb751bd[_0x791a('0xb9')]['id']}})[_0x791a('0x27')](handleEntityNotFound(_0x552328,null))['then'](function(_0xcb7454){if(_0xcb7454){return _0xcb7454[_0x791a('0x104')](_0xb751bd['body']['ids'],_[_0x791a('0xf9')](_0xb751bd[_0x791a('0x2d')],[_0x791a('0xf8'),'id'])||{})['spread'](function(){return db[_0x791a('0x73')][_0x791a('0xff')]({'attributes':['id',_0x791a('0x29'),_0x791a('0x50')],'where':{'id':_0xb751bd[_0x791a('0x2d')][_0x791a('0xf8')]}});})[_0x791a('0x27')](function(_0x3c1558){socket[_0x791a('0x105')](_0x791a('0x106'),{'id':Number(_0xb751bd[_0x791a('0xb9')]['id']),'tags':_0x3c1558||[]});return{'id':Number(_0xb751bd[_0x791a('0xb9')]['id']),'tags':_0x3c1558||[]};});}})[_0x791a('0x27')](respondWithResult(_0x552328,null))[_0x791a('0xb7')](handleError(_0x552328,null));};exports['removeTags']=function(_0x19c186,_0x40b552){return db[_0x791a('0xa2')][_0x791a('0x66')]({'where':{'id':_0x19c186['params']['id']}})[_0x791a('0x27')](handleEntityNotFound(_0x40b552,null))['then'](function(_0x13cfc9){if(_0x13cfc9){return _0x13cfc9[_0x791a('0x107')](_0x19c186['query'][_0x791a('0xf8')]);}})['then'](respondWithStatusCode(_0x40b552,null))['catch'](handleError(_0x40b552,null));};exports[_0x791a('0x108')]=function(_0x387072,_0x57f824){var _0x400fb1=moment()[_0x791a('0x109')]()[_0x791a('0xa0')]();var _0x5674cb=path[_0x791a('0xdc')](config[_0x791a('0xdd')],_0x791a('0x10a'),'files',_0x791a('0x10b'));var _0x2eae42=path[_0x791a('0xdc')](config['root'],'server',_0x791a('0x10c'),_0x791a('0x10d'));var _0x2be76f=path['join'](_0x5674cb,_0x400fb1);var _0x5b4728=util[_0x791a('0xe7')]('transcript-%d-%s.zip',_0x387072['params']['id'],_0x400fb1);var _0xeeb20=path[_0x791a('0xdc')](_0x5674cb,_0x5b4728);var _0x225529=[];_0x225529[_0x791a('0x37')]({'model':db[_0x791a('0x76')],'as':_0x791a('0x76'),'attributes':['id',_0x791a('0x33')],'raw':!![]});_0x225529[_0x791a('0x37')]({'model':db[_0x791a('0xce')],'as':_0x791a('0xcf'),'attributes':['id',_0x791a('0x10e'),_0x791a('0x10f')],'raw':!![]});if(_0x387072['query'][_0x791a('0x10d')]){_0x225529['push']({'model':db[_0x791a('0xd9')],'as':'Attachment','raw':!![]});}var _0x702d29=[{'model':db[_0x791a('0xcc')],'as':_0x791a('0xe4'),'attributes':['id',_0x791a('0x2d'),_0x791a('0x80'),_0x791a('0x110'),_0x791a('0xed'),'read'],'include':_0x225529}];_0x702d29[_0x791a('0x37')]({'model':db['ChatWebsite'],'as':_0x791a('0x111'),'attributes':['id',_0x791a('0x29')]});_0x702d29[_0x791a('0x37')]({'model':db[_0x791a('0x76')],'as':_0x791a('0x112'),'attributes':['id',_0x791a('0x33')]});return db[_0x791a('0xa2')][_0x791a('0x66')]({'where':{'id':_0x387072[_0x791a('0xb9')]['id']},'include':_0x702d29})['then'](handleEntityNotFound(_0x57f824,null))[_0x791a('0x27')](function(_0x1870fe){if(_0x1870fe){var _0x8a2b07=_0x1870fe[_0x791a('0x113')]({'plain':!![]});fs['mkdirSync'](_0x2be76f);var _0x522dd0={'channel':'Chat','account':_0x8a2b07[_0x791a('0x111')][_0x791a('0x29')],'agent':_0x8a2b07['Owner']?_0x8a2b07[_0x791a('0x112')][_0x791a('0x33')]:'N.A.','createdAt':moment(_0x8a2b07[_0x791a('0x80')])[_0x791a('0xe7')](_0x791a('0xfd'))[_0x791a('0xa0')](),'closedAt':_0x8a2b07[_0x791a('0x3c')]?moment(_0x8a2b07['closedAt'])[_0x791a('0xe7')](_0x791a('0xfd'))[_0x791a('0xa0')]():'','disposition':_0x8a2b07[_0x791a('0x3f')],'chatInfo':{'browser':_0x8a2b07['browserName'],'os':_0x8a2b07[_0x791a('0x114')],'referer':_0x8a2b07['referer'],'customerIp':_0x8a2b07[_0x791a('0x115')],'customerPort':_0x8a2b07[_0x791a('0x116')]?_0x8a2b07[_0x791a('0x116')]:_0x791a('0x117')},'messages':_(_0x8a2b07[_0x791a('0xe4')])[_0x791a('0x118')]()[_0x791a('0x8b')]({'secret':![]})[_0x791a('0x32')](function(_0x3ee4f4){if(_0x3ee4f4['Attachment']){var _0xe74178=path[_0x791a('0xdc')](_0x2eae42,_0x3ee4f4[_0x791a('0xd9')]['basename']);if(fs['existsSync'](_0xe74178)){fs[_0x791a('0x119')](_0xe74178)['pipe'](fs[_0x791a('0x11a')](path['join'](_0x2be76f,_0x3ee4f4[_0x791a('0xd9')][_0x791a('0xd6')])));}}return{'date':moment(_0x3ee4f4[_0x791a('0x80')])[_0x791a('0xe7')](_0x791a('0xfd'))['toString'](),'sender':_0x3ee4f4[_0x791a('0x110')]===_0x791a('0x11b')?_0x3ee4f4[_0x791a('0x76')]?_0x3ee4f4[_0x791a('0x76')][_0x791a('0x33')]:_0x791a('0xe6'):_0x3ee4f4['Contact'][_0x791a('0x10e')]+(_0x3ee4f4[_0x791a('0xcf')][_0x791a('0x10f')]?'\x20'+_0x3ee4f4[_0x791a('0xcf')][_0x791a('0x10f')]:''),'body':_0x3ee4f4['Attachment']?_0x3ee4f4[_0x791a('0xd9')][_0x791a('0xd6')]:_0x3ee4f4['body'],'direction':_0x3ee4f4[_0x791a('0x110')]===_0x791a('0x11b')?'A':'C','secret':_0x3ee4f4[_0x791a('0xed')],'read':_0x3ee4f4[_0x791a('0x11c')],'attachment':_0x3ee4f4[_0x791a('0xd9')]};})[_0x791a('0x68')]()};return ejs[_0x791a('0x11d')](path[_0x791a('0xdc')](config[_0x791a('0xdd')],_0x791a('0x10a'),'views','downloadInteraction.ejs'),{'interaction':_0x522dd0})[_0x791a('0x27')](function(_0x58b486){var _0x44909e=path['join'](_0x2be76f,'transcript-'+_0x8a2b07['id']+'-'+_0x400fb1+'.pdf');var _0x7918b4={'path':_0x44909e,'channel':_0x791a('0x11e'),'interactionId':_0x8a2b07['id']};return pdf[_0x791a('0x11f')](_0x58b486,_0x7918b4);})[_0x791a('0x27')](function(){return new Promise(function(_0x27b7fa,_0x122702){zipdir(_0x2be76f,{'saveTo':_0xeeb20},function(_0x4ece8a,_0x2ac438){if(_0x4ece8a)return _0x122702(_0x4ece8a);return _0x27b7fa(_0x2ac438);});})[_0x791a('0x27')](function(){return new BPromise(function(_0x1e5bbb,_0x48b2c7){rimraf(_0x2be76f,function(_0x1e7b8c){if(_0x1e7b8c)_0x48b2c7(_0x1e7b8c);return _0x1e5bbb();});});})['then'](function(){return _0x57f824['download'](_0xeeb20,_0x5b4728,function(_0xb73a80){if(_0xb73a80){logger[_0x791a('0x18')](_0x791a('0x120'),_0xb73a80);}else{fs[_0x791a('0x121')](_0xeeb20);}});});});}else{return _0x57f824['sendStatus'](0xc8);}})[_0x791a('0xb7')](handleError(_0x57f824,null));};
\ No newline at end of file
index ea7e231..54721d3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x916b=['Users','findAll','unreadMessages','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','then','setDataValue'];(function(_0x45cb72,_0x2aecf7){var _0xc4e46=function(_0x15ff69){while(--_0x15ff69){_0x45cb72['push'](_0x45cb72['shift']());}};_0xc4e46(++_0x2aecf7);}(_0x916b,0x1d3));var _0xb916=function(_0x20f658,_0x46a8ca){_0x20f658=_0x20f658-0x0;var _0x2b7acd=_0x916b[_0x20f658];return _0x2b7acd;};'use strict';var EventEmitter=require(_0xb916('0x0'));var ChatInteraction=require(_0xb916('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0xb916('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb916('0x3')](0x0);var events={'afterCreate':_0xb916('0x4'),'afterUpdate':_0xb916('0x5'),'afterDestroy':_0xb916('0x6')};function emitEvent(_0x19e443){return function(_0x3ff9c6,_0x5ea7f9,_0x5ada12){_0x3ff9c6['getUsers']({'attributes':['id'],'raw':!![]})[_0xb916('0x7')](function(_0x27e842){_0x3ff9c6[_0xb916('0x8')](_0xb916('0x9'),_0x27e842['map'](function(_0x25c96b){return{'id':_0x25c96b['id']};}));return ChatMessage[_0xb916('0xa')]({'where':{'ChatInteractionId':_0x3ff9c6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb916('0x7')](function(_0x28a277){_0x3ff9c6['setDataValue'](_0xb916('0xb'),_0x28a277[_0xb916('0xc')]);ChatInteractionEvents['emit'](_0x19e443+':'+_0x3ff9c6['id'],_0x3ff9c6);ChatInteractionEvents['emit'](_0x19e443,_0x3ff9c6);_0x5ada12(null);})[_0xb916('0xd')](_0x5ada12(null));};}for(var e in events){if(events[_0xb916('0xe')](e)){var event=events[e];ChatInteraction[_0xb916('0xf')](e,emitEvent(event));}}module[_0xb916('0x10')]=ChatInteractionEvents;
\ No newline at end of file
+var _0x7696=['events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','remove','then','setDataValue','Users','findAll','unreadMessages','emit','catch','hook','exports'];(function(_0x1ca890,_0x21d0d3){var _0x3f8e01=function(_0x4ff2e2){while(--_0x4ff2e2){_0x1ca890['push'](_0x1ca890['shift']());}};_0x3f8e01(++_0x21d0d3);}(_0x7696,0x1d0));var _0x6769=function(_0x5936d1,_0x528f05){_0x5936d1=_0x5936d1-0x0;var _0x243bc9=_0x7696[_0x5936d1];return _0x243bc9;};'use strict';var EventEmitter=require(_0x6769('0x0'));var ChatInteraction=require(_0x6769('0x1'))['db'][_0x6769('0x2')];var ChatMessage=require(_0x6769('0x1'))['db'][_0x6769('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x6769('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6769('0x5'),'afterDestroy':_0x6769('0x6')};function emitEvent(_0xbf386){return function(_0x251475,_0x213707,_0x4631e9){_0x251475['getUsers']({'attributes':['id'],'raw':!![]})[_0x6769('0x7')](function(_0x434d8f){_0x251475[_0x6769('0x8')](_0x6769('0x9'),_0x434d8f['map'](function(_0x5a7d0d){return{'id':_0x5a7d0d['id']};}));return ChatMessage[_0x6769('0xa')]({'where':{'ChatInteractionId':_0x251475['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2fc021){_0x251475['setDataValue'](_0x6769('0xb'),_0x2fc021['length']);ChatInteractionEvents[_0x6769('0xc')](_0xbf386+':'+_0x251475['id'],_0x251475);ChatInteractionEvents[_0x6769('0xc')](_0xbf386,_0x251475);_0x4631e9(null);})[_0x6769('0xd')](_0x4631e9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x6769('0xe')](e,emitEvent(event));}}module[_0x6769('0xf')]=ChatInteractionEvents;
\ No newline at end of file
index f7a212e..459ada6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa5aa=['rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','request-promise','path'];(function(_0x13abf4,_0x3a37ea){var _0x33bc1e=function(_0x109f83){while(--_0x109f83){_0x13abf4['push'](_0x13abf4['shift']());}};_0x33bc1e(++_0x3a37ea);}(_0xa5aa,0x6c));var _0xaa5a=function(_0x41c315,_0x58890b){_0x41c315=_0x41c315-0x0;var _0x5a2ee2=_0xa5aa[_0x41c315];return _0x5a2ee2;};'use strict';var _=require(_0xaa5a('0x0'));var util=require(_0xaa5a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaa5a('0x2'));var fs=require('fs');var path=require(_0xaa5a('0x3'));var rimraf=require(_0xaa5a('0x4'));var config=require(_0xaa5a('0x5'));var attributes=require(_0xaa5a('0x6'));module[_0xaa5a('0x7')]=function(_0x7cdc9c,_0x51eca1){return _0x7cdc9c[_0xaa5a('0x8')](_0xaa5a('0x9'),attributes,{'tableName':_0xaa5a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x408755,_0x3c5594,_0x47a68e){if(_0x408755[_0xaa5a('0xb')](_0xaa5a('0xc'))){_0x408755[_0xaa5a('0xd')]=moment()[_0xaa5a('0xe')](_0xaa5a('0xf'));}_0x47a68e(null,_0x408755);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0x1b86=['bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment'];(function(_0x22e031,_0x491dce){var _0x4b58db=function(_0xf9d1b){while(--_0xf9d1b){_0x22e031['push'](_0x22e031['shift']());}};_0x4b58db(++_0x491dce);}(_0x1b86,0x1bf));var _0x61b8=function(_0x3df073,_0x51aa28){_0x3df073=_0x3df073-0x0;var _0x47167f=_0x1b86[_0x3df073];return _0x47167f;};'use strict';var _=require(_0x61b8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x61b8('0x1'));var moment=require(_0x61b8('0x2'));var BPromise=require(_0x61b8('0x3'));var rp=require(_0x61b8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61b8('0x5'));var config=require(_0x61b8('0x6'));var attributes=require(_0x61b8('0x7'));module[_0x61b8('0x8')]=function(_0x49c9c5,_0x1bd82b){return _0x49c9c5[_0x61b8('0x9')](_0x61b8('0xa'),attributes,{'tableName':_0x61b8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48c2f6,_0x1f6bab,_0x249d81){if(_0x48c2f6[_0x61b8('0xc')](_0x61b8('0xd'))){_0x48c2f6[_0x61b8('0xe')]=moment()['format'](_0x61b8('0xf'));}_0x249d81(null,_0x48c2f6);}},'charset':_0x61b8('0x10'),'collate':_0x61b8('0x11')});};
\ No newline at end of file
index 9f8b570..b8800b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc2a3=['localhost','socket.io-emitter','./chatInteraction.socket','register','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','UpdateChatInteraction','body','options','raw','where','attributes','limit','then','AddTagsToChatInteraction','ChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis'];(function(_0x28f3c7,_0x330d18){var _0x1e2d6a=function(_0x416238){while(--_0x416238){_0x28f3c7['push'](_0x28f3c7['shift']());}};_0x1e2d6a(++_0x330d18);}(_0xc2a3,0x6d));var _0x3c2a=function(_0x3d34da,_0x3abcc1){_0x3d34da=_0x3d34da-0x0;var _0xcf6af8=_0xc2a3[_0x3d34da];return _0xcf6af8;};'use strict';var _=require(_0x3c2a('0x0'));var util=require(_0x3c2a('0x1'));var moment=require(_0x3c2a('0x2'));var BPromise=require(_0x3c2a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c2a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c2a('0x5'));var logger=require('../../config/logger')(_0x3c2a('0x6'));var config=require(_0x3c2a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3c2a('0x8')][_0x3c2a('0x9')]({'port':0x232a});config[_0x3c2a('0xa')]=_['defaults'](config[_0x3c2a('0xa')],{'host':_0x3c2a('0xb'),'port':0x18eb});var socket=require(_0x3c2a('0xc'))(new Redis(config[_0x3c2a('0xa')]));require(_0x3c2a('0xd'))[_0x3c2a('0xe')](socket);function respondWithRpcPromise(_0x4d3daf,_0x1a7678,_0x20c53c){return new BPromise(function(_0x2287ac,_0x4426d6){return client['request'](_0x4d3daf,_0x20c53c)['then'](function(_0x1a3c43){logger[_0x3c2a('0xf')](_0x3c2a('0x10'),_0x1a7678,'request\x20sent');logger[_0x3c2a('0x11')](_0x3c2a('0x12'),_0x1a7678,_0x3c2a('0x13'),JSON[_0x3c2a('0x14')](_0x1a3c43));if(_0x1a3c43['error']){if(_0x1a3c43[_0x3c2a('0x15')]['code']===0x1f4){logger[_0x3c2a('0x15')](_0x3c2a('0x10'),_0x1a7678,_0x1a3c43[_0x3c2a('0x15')][_0x3c2a('0x16')]);return _0x4426d6(_0x1a3c43[_0x3c2a('0x15')][_0x3c2a('0x16')]);}logger[_0x3c2a('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x1a7678,_0x1a3c43[_0x3c2a('0x15')]['message']);return _0x2287ac(_0x1a3c43[_0x3c2a('0x15')][_0x3c2a('0x16')]);}else{logger['info'](_0x3c2a('0x10'),_0x1a7678,_0x3c2a('0x13'));_0x2287ac(_0x1a3c43['result'][_0x3c2a('0x16')]);}})[_0x3c2a('0x17')](function(_0x3f3817){logger['error'](_0x3c2a('0x10'),_0x1a7678,_0x3f3817);_0x4426d6(_0x3f3817);});});}exports[_0x3c2a('0x18')]=function(_0x1ee2a0){var _0xf41f07=this;return new Promise(function(_0x1a0de1,_0x498711){return db['ChatInteraction']['update'](_0x1ee2a0[_0x3c2a('0x19')],{'raw':_0x1ee2a0[_0x3c2a('0x1a')]?_0x1ee2a0[_0x3c2a('0x1a')][_0x3c2a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ee2a0['options']?_0x1ee2a0[_0x3c2a('0x1a')][_0x3c2a('0x1c')]||null:null,'attributes':_0x1ee2a0[_0x3c2a('0x1a')]?_0x1ee2a0[_0x3c2a('0x1a')][_0x3c2a('0x1d')]||null:null,'limit':_0x1ee2a0[_0x3c2a('0x1a')]?_0x1ee2a0['options'][_0x3c2a('0x1e')]||null:null})[_0x3c2a('0x1f')](function(_0x2d0bf6){logger['info'](_0x3c2a('0x18'),_0x1ee2a0);logger['debug']('UpdateChatInteraction',_0x1ee2a0,JSON[_0x3c2a('0x14')](_0x2d0bf6));_0x1a0de1(_0x2d0bf6);})[_0x3c2a('0x17')](function(_0x3377d4){logger[_0x3c2a('0x15')](_0x3c2a('0x18'),_0x3377d4[_0x3c2a('0x16')],_0x1ee2a0);_0x498711(_0xf41f07[_0x3c2a('0x15')](0x1f4,_0x3377d4[_0x3c2a('0x16')]));});});};exports[_0x3c2a('0x20')]=function(_0x30a5b7){return new Promise(function(_0x141a62,_0x1c5417){return db[_0x3c2a('0x21')][_0x3c2a('0x22')]({'where':_0x30a5b7[_0x3c2a('0x1a')]?_0x30a5b7[_0x3c2a('0x1a')][_0x3c2a('0x1c')]||null:null})['then'](function(_0x5a36ed){if(_0x5a36ed){return _0x5a36ed[_0x3c2a('0x23')](_0x30a5b7['body'][_0x3c2a('0x24')],_[_0x3c2a('0x25')](_0x30a5b7[_0x3c2a('0x19')],[_0x3c2a('0x24'),'id'])||{});}})[_0x3c2a('0x26')](function(_0x144f6f){logger[_0x3c2a('0xf')](_0x3c2a('0x27'),_0x30a5b7);logger[_0x3c2a('0x11')](_0x3c2a('0x27'),_0x30a5b7,JSON['stringify'](_0x144f6f));_0x141a62(_0x144f6f);})[_0x3c2a('0x17')](function(_0x5916ef){logger['error'](_0x3c2a('0x27'),_0x5916ef[_0x3c2a('0x16')],_0x30a5b7);_0x1c5417(_this[_0x3c2a('0x15')](0x1f4,_0x5916ef['message']));});});};
\ No newline at end of file
+var _0x0aaf=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','then','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','UpdateChatInteraction','ChatInteraction','options','where','attributes','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','lodash'];(function(_0x524ce0,_0x3670b2){var _0x38299f=function(_0x513ef4){while(--_0x513ef4){_0x524ce0['push'](_0x524ce0['shift']());}};_0x38299f(++_0x3670b2);}(_0x0aaf,0x1d3));var _0xf0aa=function(_0x46aaaa,_0x3af897){_0x46aaaa=_0x46aaaa-0x0;var _0x26d04e=_0x0aaf[_0x46aaaa];return _0x26d04e;};'use strict';var _=require(_0xf0aa('0x0'));var util=require(_0xf0aa('0x1'));var moment=require(_0xf0aa('0x2'));var BPromise=require(_0xf0aa('0x3'));var rs=require(_0xf0aa('0x4'));var fs=require('fs');var Redis=require(_0xf0aa('0x5'));var db=require(_0xf0aa('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0aa('0x7'))('rpc');var config=require(_0xf0aa('0x8'));var jayson=require(_0xf0aa('0x9'));var client=jayson[_0xf0aa('0xa')]['http']({'port':0x232a});config[_0xf0aa('0xb')]=_[_0xf0aa('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf0aa('0xd'))(new Redis(config['redis']));require(_0xf0aa('0xe'))[_0xf0aa('0xf')](socket);function respondWithRpcPromise(_0x1954b4,_0x4f347e,_0x29bd97){return new BPromise(function(_0x3344b1,_0x5b9051){return client[_0xf0aa('0x10')](_0x1954b4,_0x29bd97)[_0xf0aa('0x11')](function(_0xe054e6){logger[_0xf0aa('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x4f347e,'request\x20sent');logger[_0xf0aa('0x13')](_0xf0aa('0x14'),_0x4f347e,_0xf0aa('0x15'),JSON[_0xf0aa('0x16')](_0xe054e6));if(_0xe054e6[_0xf0aa('0x17')]){if(_0xe054e6['error'][_0xf0aa('0x18')]===0x1f4){logger[_0xf0aa('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x4f347e,_0xe054e6[_0xf0aa('0x17')]['message']);return _0x5b9051(_0xe054e6[_0xf0aa('0x17')]['message']);}logger[_0xf0aa('0x17')](_0xf0aa('0x19'),_0x4f347e,_0xe054e6[_0xf0aa('0x17')]['message']);return _0x3344b1(_0xe054e6[_0xf0aa('0x17')][_0xf0aa('0x1a')]);}else{logger[_0xf0aa('0x12')](_0xf0aa('0x19'),_0x4f347e,_0xf0aa('0x15'));_0x3344b1(_0xe054e6['result'][_0xf0aa('0x1a')]);}})[_0xf0aa('0x1b')](function(_0x46f564){logger[_0xf0aa('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x4f347e,_0x46f564);_0x5b9051(_0x46f564);});});}exports[_0xf0aa('0x1c')]=function(_0x33e772){var _0x1a5706=this;return new Promise(function(_0x2ef223,_0x37acd1){return db[_0xf0aa('0x1d')]['update'](_0x33e772['body'],{'raw':_0x33e772[_0xf0aa('0x1e')]?_0x33e772[_0xf0aa('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33e772[_0xf0aa('0x1e')]?_0x33e772[_0xf0aa('0x1e')][_0xf0aa('0x1f')]||null:null,'attributes':_0x33e772[_0xf0aa('0x1e')]?_0x33e772[_0xf0aa('0x1e')][_0xf0aa('0x20')]||null:null,'limit':_0x33e772[_0xf0aa('0x1e')]?_0x33e772['options']['limit']||null:null})[_0xf0aa('0x11')](function(_0x527782){logger[_0xf0aa('0x12')](_0xf0aa('0x1c'),_0x33e772);logger[_0xf0aa('0x13')](_0xf0aa('0x1c'),_0x33e772,JSON[_0xf0aa('0x16')](_0x527782));_0x2ef223(_0x527782);})['catch'](function(_0x2633ff){logger[_0xf0aa('0x17')](_0xf0aa('0x1c'),_0x2633ff['message'],_0x33e772);_0x37acd1(_0x1a5706[_0xf0aa('0x17')](0x1f4,_0x2633ff[_0xf0aa('0x1a')]));});});};exports[_0xf0aa('0x21')]=function(_0x5b66c0){return new Promise(function(_0x779ae2,_0x54f962){return db['ChatInteraction'][_0xf0aa('0x22')]({'where':_0x5b66c0[_0xf0aa('0x1e')]?_0x5b66c0[_0xf0aa('0x1e')][_0xf0aa('0x1f')]||null:null})[_0xf0aa('0x11')](function(_0x3a6ee0){if(_0x3a6ee0){return _0x3a6ee0[_0xf0aa('0x23')](_0x5b66c0['body'][_0xf0aa('0x24')],_[_0xf0aa('0x25')](_0x5b66c0['body'],[_0xf0aa('0x24'),'id'])||{});}})['spread'](function(_0x2841f3){logger[_0xf0aa('0x12')](_0xf0aa('0x26'),_0x5b66c0);logger['debug'](_0xf0aa('0x26'),_0x5b66c0,JSON[_0xf0aa('0x16')](_0x2841f3));_0x779ae2(_0x2841f3);})[_0xf0aa('0x1b')](function(_0x243c45){logger[_0xf0aa('0x17')](_0xf0aa('0x26'),_0x243c45[_0xf0aa('0x1a')],_0x5b66c0);_0x54f962(_this['error'](0x1f4,_0x243c45[_0xf0aa('0x1a')]));});});};
\ No newline at end of file
index 74938a4..3ee44b0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9981=['emit','register','length','remove'];(function(_0x4d4f74,_0x1c6228){var _0x1a234f=function(_0x38bbaf){while(--_0x38bbaf){_0x4d4f74['push'](_0x4d4f74['shift']());}};_0x1a234f(++_0x1c6228);}(_0x9981,0x163));var _0x1998=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x9981[_0xa8883];return _0x479426;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x1998('0x0'),'update'];function createListener(_0x49c6b7,_0x50d675){return function(_0x2ead80){_0x50d675[_0x1998('0x1')](_0x49c6b7,_0x2ead80);};}function removeListener(_0x44210d,_0x452f32){return function(){ChatInteractionEvents['removeListener'](_0x44210d,_0x452f32);};}exports[_0x1998('0x2')]=function(_0x51abf3){for(var _0x427138=0x0,_0x100e49=events[_0x1998('0x3')];_0x427138<_0x100e49;_0x427138++){var _0x5e379a=events[_0x427138];var _0x279393=createListener('chatInteraction:'+_0x5e379a,_0x51abf3);ChatInteractionEvents['on'](_0x5e379a,_0x279393);}};
\ No newline at end of file
+var _0xe6ef=['removeListener','register','length','chatInteraction:','remove','update','emit'];(function(_0x1a18fc,_0x5584d9){var _0x4ace8a=function(_0x3823ad){while(--_0x3823ad){_0x1a18fc['push'](_0x1a18fc['shift']());}};_0x4ace8a(++_0x5584d9);}(_0xe6ef,0xba));var _0xfe6e=function(_0x258630,_0x39fa43){_0x258630=_0x258630-0x0;var _0x459391=_0xe6ef[_0x258630];return _0x459391;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0xfe6e('0x0'),_0xfe6e('0x1')];function createListener(_0x1e9b71,_0x551264){return function(_0x3b2fbf){_0x551264[_0xfe6e('0x2')](_0x1e9b71,_0x3b2fbf);};}function removeListener(_0x5c4e64,_0x433fb4){return function(){ChatInteractionEvents[_0xfe6e('0x3')](_0x5c4e64,_0x433fb4);};}exports[_0xfe6e('0x4')]=function(_0xf3673){for(var _0xe61a4a=0x0,_0x5ed355=events[_0xfe6e('0x5')];_0xe61a4a<_0x5ed355;_0xe61a4a++){var _0x3d0202=events[_0xe61a4a];var _0x3daf9c=createListener(_0xfe6e('0x6')+_0x3d0202,_0xf3673);ChatInteractionEvents['on'](_0x3d0202,_0x3daf9c);}};
\ No newline at end of file
index 34a8240..1fc4ad5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x45c0=['now','originalname','replace','/:id/attachment_upload','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','chatinteraction:update','update','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','/:id/download','create','post','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s'];(function(_0x20f745,_0x2f8d37){var _0x45e2a5=function(_0x5e6408){while(--_0x5e6408){_0x20f745['push'](_0x20f745['shift']());}};_0x45e2a5(++_0x2f8d37);}(_0x45c0,0x1b6));var _0x045c=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x45c0[_0xea8947];return _0x2455e9;};'use strict';var multer=require(_0x045c('0x0'));var util=require(_0x045c('0x1'));var path=require(_0x045c('0x2'));var timeout=require(_0x045c('0x3'));var express=require(_0x045c('0x4'));var router=express[_0x045c('0x5')]();var fs_extra=require(_0x045c('0x6'));var auth=require(_0x045c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x045c('0x8'));router[_0x045c('0x9')]('/',auth[_0x045c('0xa')](),controller[_0x045c('0xb')]);router[_0x045c('0x9')](_0x045c('0xc'),auth['isAuthenticated'](),controller[_0x045c('0xd')]);router[_0x045c('0x9')]('/:id',auth[_0x045c('0xe')](),controller[_0x045c('0xf')]);router[_0x045c('0x9')](_0x045c('0x10'),auth[_0x045c('0xe')](),controller[_0x045c('0x11')]);router['get'](_0x045c('0x12'),auth[_0x045c('0xa')](),controller['getMessages']);router[_0x045c('0x9')](_0x045c('0x13'),auth[_0x045c('0xe')](),controller['getMyMessages']);router[_0x045c('0x9')](_0x045c('0x14'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x045c('0x15')]);router[_0x045c('0x16')]('/:id/vidaoo',auth[_0x045c('0xa')](),controller[_0x045c('0x17')]);var upload=multer({'storage':multer[_0x045c('0x18')]({'destination':function(_0x16af5b,_0x1e066f,_0x482f9f){_0x482f9f(null,path[_0x045c('0x19')](config[_0x045c('0x1a')],_0x045c('0x1b')));},'filename':function(_0x5712df,_0x542070,_0x396c03){_0x396c03(null,util[_0x045c('0x1c')](_0x045c('0x1d'),Date[_0x045c('0x1e')](),_0x542070[_0x045c('0x1f')][_0x045c('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x045c('0x16')](_0x045c('0x21'),upload['single'](_0x045c('0x22')),controller['attachmentUpload']);router[_0x045c('0x16')](_0x045c('0x12'),auth[_0x045c('0xe')](),controller[_0x045c('0x23')]);router[_0x045c('0x16')](_0x045c('0x24'),auth[_0x045c('0xa')](),interaction[_0x045c('0x25')](_0x045c('0x26'),_0x045c('0x27')),controller[_0x045c('0x28')]);router[_0x045c('0x29')](_0x045c('0x2a'),auth[_0x045c('0xa')](),interaction['tracked'](_0x045c('0x26'),_0x045c('0x2b')),controller[_0x045c('0x2c')]);router['put']('/:id/custom_update',controller['customUpdate']);router[_0x045c('0x29')](_0x045c('0x2d'),auth[_0x045c('0xe')](),controller[_0x045c('0x2e')]);router[_0x045c('0x29')]('/:id/close',controller[_0x045c('0x2f')]);router[_0x045c('0x30')](_0x045c('0x2a'),auth['isAuthenticated'](),interaction[_0x045c('0x25')](_0x045c('0x26'),_0x045c('0x31')),controller[_0x045c('0x32')]);router['delete'](_0x045c('0x24'),auth[_0x045c('0xa')](),controller['removeTags']);module[_0x045c('0x33')]=router;
\ No newline at end of file
+var _0xc284=['isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','createVidaooSession','diskStorage','join','root','%s-%s','originalname','replace','single','file','addMessage','/:id/tags','tracked','addTags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x19fab3,_0x2379c7){var _0x3ed5f7=function(_0x1e2b75){while(--_0x1e2b75){_0x19fab3['push'](_0x19fab3['shift']());}};_0x3ed5f7(++_0x2379c7);}(_0xc284,0xed));var _0x4c28=function(_0x5b082a,_0x5bfdce){_0x5b082a=_0x5b082a-0x0;var _0x5141dc=_0xc284[_0x5b082a];return _0x5141dc;};'use strict';var multer=require('multer');var util=require(_0x4c28('0x0'));var path=require(_0x4c28('0x1'));var timeout=require(_0x4c28('0x2'));var express=require(_0x4c28('0x3'));var router=express['Router']();var fs_extra=require(_0x4c28('0x4'));var auth=require(_0x4c28('0x5'));var interaction=require(_0x4c28('0x6'));var config=require('../../config/environment');var controller=require(_0x4c28('0x7'));router[_0x4c28('0x8')]('/',auth[_0x4c28('0x9')](),controller['index']);router[_0x4c28('0x8')](_0x4c28('0xa'),auth[_0x4c28('0x9')](),controller[_0x4c28('0xb')]);router[_0x4c28('0x8')](_0x4c28('0xc'),auth[_0x4c28('0xd')](),controller[_0x4c28('0xe')]);router['get'](_0x4c28('0xf'),auth[_0x4c28('0xd')](),controller[_0x4c28('0x10')]);router[_0x4c28('0x8')](_0x4c28('0x11'),auth[_0x4c28('0x9')](),controller['getMessages']);router[_0x4c28('0x8')](_0x4c28('0x12'),auth[_0x4c28('0xd')](),controller[_0x4c28('0x13')]);router[_0x4c28('0x8')](_0x4c28('0x14'),auth[_0x4c28('0x9')](),controller[_0x4c28('0x15')]);router['post']('/',auth[_0x4c28('0x9')](),controller['create']);router[_0x4c28('0x16')]('/:id/vidaoo',auth[_0x4c28('0x9')](),controller[_0x4c28('0x17')]);var upload=multer({'storage':multer[_0x4c28('0x18')]({'destination':function(_0x2f2670,_0x2bce48,_0x5bc81f){_0x5bc81f(null,path[_0x4c28('0x19')](config[_0x4c28('0x1a')],'server/files/attachments/'));},'filename':function(_0x2740eb,_0x4168f3,_0xaf3e98){_0xaf3e98(null,util['format'](_0x4c28('0x1b'),Date['now'](),_0x4168f3[_0x4c28('0x1c')][_0x4c28('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4c28('0x16')]('/:id/attachment_upload',upload[_0x4c28('0x1e')](_0x4c28('0x1f')),controller['attachmentUpload']);router[_0x4c28('0x16')]('/:id/messages',auth[_0x4c28('0xd')](),controller[_0x4c28('0x20')]);router[_0x4c28('0x16')](_0x4c28('0x21'),auth['isAuthenticated'](),interaction[_0x4c28('0x22')]('chat','chatinteraction:addtags'),controller[_0x4c28('0x23')]);router[_0x4c28('0x24')](_0x4c28('0xc'),auth[_0x4c28('0x9')](),interaction[_0x4c28('0x22')](_0x4c28('0x25'),_0x4c28('0x26')),controller[_0x4c28('0x27')]);router[_0x4c28('0x24')](_0x4c28('0x28'),controller[_0x4c28('0x29')]);router[_0x4c28('0x24')](_0x4c28('0x2a'),auth[_0x4c28('0xd')](),controller[_0x4c28('0x2b')]);router[_0x4c28('0x24')](_0x4c28('0x2c'),controller[_0x4c28('0x2d')]);router['delete']('/:id',auth[_0x4c28('0x9')](),interaction[_0x4c28('0x22')](_0x4c28('0x25'),_0x4c28('0x2e')),controller[_0x4c28('0x2f')]);router['delete'](_0x4c28('0x21'),auth['isAuthenticated'](),controller[_0x4c28('0x30')]);module[_0x4c28('0x31')]=router;
\ No newline at end of file
index 9b63059..831e89f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9be9=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9be9,0xa8));var _0x99be=function(_0x436119,_0x111d76){_0x436119=_0x436119-0x0;var _0x266e14=_0x9be9[_0x436119];return _0x266e14;};'use strict';var Sequelize=require('sequelize');module[_0x99be('0x0')]={'body':{'type':Sequelize[_0x99be('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x99be('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x99be('0x3')]}};
\ No newline at end of file
+var _0xb3e9=['medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x2c0a00,_0x3548e4){var _0x119901=function(_0x2a3f40){while(--_0x2a3f40){_0x2c0a00['push'](_0x2c0a00['shift']());}};_0x119901(++_0x3548e4);}(_0xb3e9,0x170));var _0x9b3e=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xb3e9[_0x5a9c0c];return _0x53c77d;};'use strict';var Sequelize=require(_0x9b3e('0x0'));module[_0x9b3e('0x1')]={'body':{'type':Sequelize['TEXT'](_0x9b3e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9b3e('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x9b3e('0x4')]}};
\ No newline at end of file
index 0ba735d..a57b743 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xef1b=['describe','get','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','agent','admin','user','fullname','role','online','lastLoginAt','allowmessenger','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','createdAt','FromId','ToId','read','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','index','map','ChatInternalMessage','key','model','query','keys','filters','intersection','attributes','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','then','rows','catch','show','params','fields','length','include','find','create','body'];(function(_0x2cfe85,_0x23a249){var _0x32977e=function(_0x1ca2b0){while(--_0x1ca2b0){_0x2cfe85['push'](_0x2cfe85['shift']());}};_0x32977e(++_0x23a249);}(_0xef1b,0xf9));var _0xbef1=function(_0x4dfeae,_0xf47dcb){_0x4dfeae=_0x4dfeae-0x0;var _0x475e1f=_0xef1b[_0x4dfeae];return _0x475e1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbef1('0x0'));var zipdir=require(_0xbef1('0x1'));var jsonpatch=require(_0xbef1('0x2'));var rp=require(_0xbef1('0x3'));var moment=require(_0xbef1('0x4'));var BPromise=require(_0xbef1('0x5'));var Mustache=require(_0xbef1('0x6'));var util=require(_0xbef1('0x7'));var path=require(_0xbef1('0x8'));var sox=require(_0xbef1('0x9'));var csv=require(_0xbef1('0xa'));var ejs=require(_0xbef1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbef1('0xc'));var squel=require(_0xbef1('0xd'));var crypto=require('crypto');var jsforce=require(_0xbef1('0xe'));var deskjs=require(_0xbef1('0xf'));var toCsv=require(_0xbef1('0xa'));var querystring=require(_0xbef1('0x10'));var Papa=require(_0xbef1('0x11'));var Redis=require(_0xbef1('0x12'));var authService=require(_0xbef1('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbef1('0x14'));var logger=require(_0xbef1('0x15'))(_0xbef1('0x16'));var utils=require(_0xbef1('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbef1('0x18'))['db'];config[_0xbef1('0x19')]=_[_0xbef1('0x1a')](config[_0xbef1('0x19')],{'host':_0xbef1('0x1b'),'port':0x18eb});var socket=require(_0xbef1('0x1c'))(new Redis(config[_0xbef1('0x19')]));require(_0xbef1('0x1d'))['register'](socket);function respondWithStatusCode(_0x431a98,_0x344e7f){_0x344e7f=_0x344e7f||0xcc;return function(_0x32413b){if(_0x32413b){return _0x431a98[_0xbef1('0x1e')](_0x344e7f);}return _0x431a98[_0xbef1('0x1f')](_0x344e7f)['end']();};}function respondWithResult(_0xa5e5ce,_0xa7d844){_0xa7d844=_0xa7d844||0xc8;return function(_0x405aa5){if(_0x405aa5){return _0xa5e5ce[_0xbef1('0x1f')](_0xa7d844)['json'](_0x405aa5);}};}function respondWithFilteredResult(_0x35e638,_0x3991c7){return function(_0x1c8d27){if(_0x1c8d27){var _0x1b243c=typeof _0x3991c7[_0xbef1('0x20')]===_0xbef1('0x21')&&typeof _0x3991c7['limit']==='undefined';var _0xf04f95=_0x1c8d27[_0xbef1('0x22')];var _0x5dbc09=_0x1b243c?0x0:_0x3991c7[_0xbef1('0x20')];var _0x5e796c=_0x1b243c?_0x1c8d27[_0xbef1('0x22')]:_0x3991c7[_0xbef1('0x20')]+_0x3991c7[_0xbef1('0x23')];var _0x1df3e7;if(_0x5e796c>=_0xf04f95){_0x5e796c=_0xf04f95;_0x1df3e7=0xc8;}else{_0x1df3e7=0xce;}_0x35e638[_0xbef1('0x1f')](_0x1df3e7);return _0x35e638[_0xbef1('0x24')](_0xbef1('0x25'),_0x5dbc09+'-'+_0x5e796c+'/'+_0xf04f95)[_0xbef1('0x26')](_0x1c8d27);}return null;};}function patchUpdates(_0x53d55c){return function(_0x54a114){try{jsonpatch[_0xbef1('0x27')](_0x54a114,_0x53d55c,!![]);}catch(_0x361cd6){return BPromise[_0xbef1('0x28')](_0x361cd6);}return _0x54a114[_0xbef1('0x29')]();};}function saveUpdates(_0x1a8fe8,_0x567477){return function(_0x545cc5){if(_0x545cc5){return _0x545cc5[_0xbef1('0x2a')](_0x1a8fe8)['then'](function(_0x2c7098){return _0x2c7098;});}return null;};}function removeEntity(_0x2e9abe,_0x1d2276){return function(_0x2499b6){if(_0x2499b6){return _0x2499b6[_0xbef1('0x2b')]()['then'](function(){_0x2e9abe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x165f92,_0x131eda){return function(_0x540faf){if(!_0x540faf){_0x165f92[_0xbef1('0x1e')](0x194);}return _0x540faf;};}function handleError(_0x4df8a3,_0x31cbaa){_0x31cbaa=_0x31cbaa||0x1f4;return function(_0x47bc11){logger[_0xbef1('0x2c')](_0x47bc11[_0xbef1('0x2d')]);if(_0x47bc11[_0xbef1('0x2e')]){delete _0x47bc11['name'];}_0x4df8a3[_0xbef1('0x1f')](_0x31cbaa)[_0xbef1('0x2f')](_0x47bc11);};}exports[_0xbef1('0x30')]=function(_0x30df14,_0x4e6fbf){var _0x281a8f={},_0x2f5c39={},_0x5eb35a={'count':0x0,'rows':[]};var _0x355581=_[_0xbef1('0x31')](db[_0xbef1('0x32')]['rawAttributes'],function(_0x168871){return{'name':_0x168871['fieldName'],'type':_0x168871['type'][_0xbef1('0x33')]};});_0x2f5c39[_0xbef1('0x34')]=_[_0xbef1('0x31')](_0x355581,_0xbef1('0x2e'));_0x2f5c39[_0xbef1('0x35')]=_[_0xbef1('0x36')](_0x30df14['query']);_0x2f5c39[_0xbef1('0x37')]=_[_0xbef1('0x38')](_0x2f5c39[_0xbef1('0x34')],_0x2f5c39[_0xbef1('0x35')]);_0x281a8f[_0xbef1('0x39')]=_['intersection'](_0x2f5c39['model'],qs['fields'](_0x30df14[_0xbef1('0x35')]['fields']));_0x281a8f['attributes']=_0x281a8f['attributes']['length']?_0x281a8f[_0xbef1('0x39')]:_0x2f5c39['model'];if(!_0x30df14['query']['hasOwnProperty']('nolimit')){_0x281a8f[_0xbef1('0x23')]=qs['limit'](_0x30df14[_0xbef1('0x35')]['limit']);_0x281a8f[_0xbef1('0x20')]=qs[_0xbef1('0x20')](_0x30df14['query']['offset']);}_0x281a8f['order']=qs[_0xbef1('0x3a')](_0x30df14[_0xbef1('0x35')][_0xbef1('0x3a')]);_0x281a8f[_0xbef1('0x3b')]=qs[_0xbef1('0x37')](_['pick'](_0x30df14[_0xbef1('0x35')],_0x2f5c39[_0xbef1('0x37')]),_0x355581);if(_0x30df14['query'][_0xbef1('0x3c')]){_0x281a8f[_0xbef1('0x3b')]=_[_0xbef1('0x3d')](_0x281a8f[_0xbef1('0x3b')],{'$or':_[_0xbef1('0x31')](_0x355581,function(_0xa6b60){if(_0xa6b60[_0xbef1('0x3e')]!==_0xbef1('0x3f')){var _0x995be5={};_0x995be5[_0xa6b60['name']]={'$like':'%'+_0x30df14['query'][_0xbef1('0x3c')]+'%'};return _0x995be5;}})});}_0x281a8f=_[_0xbef1('0x3d')]({},_0x281a8f,_0x30df14[_0xbef1('0x40')]);var _0x246eb4={'where':_0x281a8f['where']};return db[_0xbef1('0x32')]['count'](_0x246eb4)['then'](function(_0x62f94d){_0x5eb35a[_0xbef1('0x22')]=_0x62f94d;if(_0x30df14[_0xbef1('0x35')][_0xbef1('0x41')]){_0x281a8f['include']=[{'all':!![]}];}return db[_0xbef1('0x32')][_0xbef1('0x42')](_0x281a8f);})[_0xbef1('0x43')](function(_0x3a8fba){_0x5eb35a[_0xbef1('0x44')]=_0x3a8fba;return _0x5eb35a;})[_0xbef1('0x43')](respondWithFilteredResult(_0x4e6fbf,_0x281a8f))[_0xbef1('0x45')](handleError(_0x4e6fbf,null));};exports[_0xbef1('0x46')]=function(_0x4329b1,_0x1820a9){var _0x165fdf={'raw':!![],'where':{'id':_0x4329b1[_0xbef1('0x47')]['id']}},_0x5f4abb={};_0x5f4abb[_0xbef1('0x34')]=_[_0xbef1('0x36')](db[_0xbef1('0x32')]['rawAttributes']);_0x5f4abb[_0xbef1('0x35')]=_[_0xbef1('0x36')](_0x4329b1[_0xbef1('0x35')]);_0x5f4abb['filters']=_[_0xbef1('0x38')](_0x5f4abb[_0xbef1('0x34')],_0x5f4abb[_0xbef1('0x35')]);_0x165fdf[_0xbef1('0x39')]=_['intersection'](_0x5f4abb[_0xbef1('0x34')],qs[_0xbef1('0x48')](_0x4329b1[_0xbef1('0x35')][_0xbef1('0x48')]));_0x165fdf[_0xbef1('0x39')]=_0x165fdf[_0xbef1('0x39')][_0xbef1('0x49')]?_0x165fdf[_0xbef1('0x39')]:_0x5f4abb['model'];if(_0x4329b1[_0xbef1('0x35')][_0xbef1('0x41')]){_0x165fdf[_0xbef1('0x4a')]=[{'all':!![]}];}_0x165fdf=_['merge']({},_0x165fdf,_0x4329b1[_0xbef1('0x40')]);return db['ChatInternalMessage'][_0xbef1('0x4b')](_0x165fdf)['then'](handleEntityNotFound(_0x1820a9,null))['then'](respondWithResult(_0x1820a9,null))[_0xbef1('0x45')](handleError(_0x1820a9,null));};exports['create']=function(_0xf2b0e6,_0x48d843){return db[_0xbef1('0x32')][_0xbef1('0x4c')](_0xf2b0e6[_0xbef1('0x4d')],{})['then'](respondWithResult(_0x48d843,0xc9))[_0xbef1('0x45')](handleError(_0x48d843,null));};exports[_0xbef1('0x2a')]=function(_0xb9b6a6,_0x562605){if(_0xb9b6a6['body']['id']){delete _0xb9b6a6['body']['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0xb9b6a6[_0xbef1('0x47')]['id']}})['then'](handleEntityNotFound(_0x562605,null))[_0xbef1('0x43')](saveUpdates(_0xb9b6a6['body'],null))[_0xbef1('0x43')](respondWithResult(_0x562605,null))['catch'](handleError(_0x562605,null));};exports[_0xbef1('0x2b')]=function(_0xc50b3,_0x2a1322){return db[_0xbef1('0x32')]['find']({'where':{'id':_0xc50b3[_0xbef1('0x47')]['id']}})[_0xbef1('0x43')](handleEntityNotFound(_0x2a1322,null))['then'](removeEntity(_0x2a1322,null))[_0xbef1('0x45')](handleError(_0x2a1322,null));};exports[_0xbef1('0x4e')]=function(_0x3cd048,_0x4b12c9){return db['ChatInternalMessage'][_0xbef1('0x4e')]()[_0xbef1('0x43')](respondWithResult(_0x4b12c9,null))[_0xbef1('0x45')](handleError(_0x4b12c9,null));};function wrapUser(_0x30546a){return function(_0xe98f6f){var _0x37374b=_0x30546a[_0xbef1('0x4f')]({'plain':!![]});_0x37374b['messages']=[];if(_0xe98f6f){_0x37374b[_0xbef1('0x50')]=_0xe98f6f['createdAt'];_0x37374b['lastMessage']=_0xe98f6f;}else{_0x37374b[_0xbef1('0x50')]=moment(0x0)[_0xbef1('0x51')](_0xbef1('0x52'));_0x37374b[_0xbef1('0x53')]={};}return _0x37374b;};}exports['getUsers']=function(_0x5a4079,_0x856435,_0xb8485f){var _0x22756a=[];return db[_0xbef1('0x54')][_0xbef1('0x42')]({'where':{'role':[_0xbef1('0x55'),_0xbef1('0x56'),_0xbef1('0x57')]},'attributes':['id',_0xbef1('0x58'),_0xbef1('0x2e'),_0xbef1('0x59'),'userpic','internal',_0xbef1('0x5a'),_0xbef1('0x5b'),_0xbef1('0x5c'),'showWebBar'],'order':qs[_0xbef1('0x3a')]('-online'),'include':[{'model':db[_0xbef1('0x5d')],'as':_0xbef1('0x5e'),'attributes':['id',_0xbef1('0x2e'),'type'],'through':{'attributes':[]}}]})[_0xbef1('0x43')](function(_0x4a1929){if(_0x4a1929){var _0x1164f2=_0x5a4079[_0xbef1('0x57')][_0xbef1('0x4f')]({'plain':!![]});if(!_0x1164f2)throw new Error(_0xbef1('0x5f'));if(_0x1164f2[_0xbef1('0x59')]===_0xbef1('0x57')){return db[_0xbef1('0x60')]['find']({'where':{'name':_0xbef1('0x61'),'userProfileId':_0x1164f2[_0xbef1('0x62')]},'raw':!![]})[_0xbef1('0x43')](function(_0x879bdf){if(_0x879bdf){if(_0x879bdf[_0xbef1('0x63')]===0x0){return db[_0xbef1('0x64')][_0xbef1('0x42')]({'where':{'sectionId':_0x879bdf['id']},'raw':!![]})[_0xbef1('0x43')](function(_0xfdd13d){var _0x4933d1=[];if(_[_0xbef1('0x65')](_0xfdd13d)){_0x4933d1=_['filter'](_0x4a1929,function(_0x28329f){if(_0x28329f[_0xbef1('0x59')]!==_0xbef1('0x55')){return _0x28329f;}});return _0x4933d1;}else{for(var _0x2deaa8=0x0;_0x2deaa8<_0x4a1929['length'];_0x2deaa8++){var _0x594bdd=_0x4a1929[_0x2deaa8];if(_0x594bdd[_0xbef1('0x59')]===_0xbef1('0x55')){var _0x48ef83=_[_0xbef1('0x4b')](_0xfdd13d,function(_0x2a384d){return _0x2a384d[_0xbef1('0x66')]===_0x594bdd['id'];});if(_0x48ef83)_0x4933d1[_0xbef1('0x67')](_0x594bdd);}else{_0x4933d1[_0xbef1('0x67')](_0x594bdd);}}return _0x4933d1;}});}else{return _0x4a1929;}}else{var _0x5117e2=_[_0xbef1('0x3c')](_0x4a1929,function(_0x1e3a3e){if(_0x1e3a3e[_0xbef1('0x59')]!==_0xbef1('0x55')){return _0x1e3a3e;}});return _0x5117e2;}});}else{return _0x4a1929;}}})['then'](function(_0x300dd3){var _0x1fb913=[];if(_0x300dd3){_0x22756a=_0x300dd3;for(var _0x381513=0x0;_0x381513<_0x300dd3[_0xbef1('0x49')];_0x381513+=0x1){_0x22756a[_0x381513][_0xbef1('0x68')]=[];_0x1fb913[_0xbef1('0x67')](db[_0xbef1('0x32')][_0xbef1('0x4b')]({'where':{'FromId':[_0x5a4079['user']['id'],_0x300dd3[_0x381513]['id']],'ToId':[_0x5a4079[_0xbef1('0x57')]['id'],_0x300dd3[_0x381513]['id']],'ChatGroupId':null},'attributes':['id',_0xbef1('0x69'),_0xbef1('0x6a'),_0xbef1('0x6b'),_0xbef1('0x6c'),_0xbef1('0x4d')],'order':qs[_0xbef1('0x3a')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xbef1('0x43')](wrapUser(_0x300dd3[_0x381513])));}return BPromise['all'](_0x1fb913);}return[];})[_0xbef1('0x43')](function(_0x24be26){return{'rows':_0x24be26,'count':_0x24be26[_0xbef1('0x49')]};})['then'](respondWithResult(_0x856435,null))['catch'](handleError(_0x856435,null));};
\ No newline at end of file
+var _0x7a1c=['create','body','params','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','user','fullname','role','internal','online','lastLoginAt','allowmessenger','VoiceQueue','UserProfileSection','Agents','UserProfileResource','isEmpty','push','createdAt','FromId','ToId','-createdAt','all','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatInternalMessage.socket','status','end','undefined','count','limit','json','reject','save','update','then','destroy','sendStatus','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','offset','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','catch','length','find'];(function(_0x48ffc9,_0x581b31){var _0x1985cb=function(_0x4702d6){while(--_0x4702d6){_0x48ffc9['push'](_0x48ffc9['shift']());}};_0x1985cb(++_0x581b31);}(_0x7a1c,0xe7));var _0xc7a1=function(_0x45f5b1,_0xe4dd6f){_0x45f5b1=_0x45f5b1-0x0;var _0x204c5f=_0x7a1c[_0x45f5b1];return _0x204c5f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc7a1('0x0'));var jsonpatch=require(_0xc7a1('0x1'));var rp=require(_0xc7a1('0x2'));var moment=require(_0xc7a1('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc7a1('0x4'));var sox=require(_0xc7a1('0x5'));var csv=require(_0xc7a1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc7a1('0x7'));var crypto=require(_0xc7a1('0x8'));var jsforce=require(_0xc7a1('0x9'));var deskjs=require(_0xc7a1('0xa'));var toCsv=require(_0xc7a1('0x6'));var querystring=require(_0xc7a1('0xb'));var Papa=require(_0xc7a1('0xc'));var Redis=require(_0xc7a1('0xd'));var authService=require(_0xc7a1('0xe'));var qs=require(_0xc7a1('0xf'));var as=require(_0xc7a1('0x10'));var hardwareService=require(_0xc7a1('0x11'));var logger=require(_0xc7a1('0x12'))(_0xc7a1('0x13'));var utils=require(_0xc7a1('0x14'));var config=require(_0xc7a1('0x15'));var licenseUtil=require(_0xc7a1('0x16'));var db=require(_0xc7a1('0x17'))['db'];config[_0xc7a1('0x18')]=_['defaults'](config[_0xc7a1('0x18')],{'host':_0xc7a1('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc7a1('0x1a'))['register'](socket);function respondWithStatusCode(_0x4afaeb,_0x5509f8){_0x5509f8=_0x5509f8||0xcc;return function(_0x1f28ed){if(_0x1f28ed){return _0x4afaeb['sendStatus'](_0x5509f8);}return _0x4afaeb[_0xc7a1('0x1b')](_0x5509f8)[_0xc7a1('0x1c')]();};}function respondWithResult(_0x5de2d5,_0x4fa696){_0x4fa696=_0x4fa696||0xc8;return function(_0x51a324){if(_0x51a324){return _0x5de2d5[_0xc7a1('0x1b')](_0x4fa696)['json'](_0x51a324);}};}function respondWithFilteredResult(_0x560a75,_0x51b7df){return function(_0x3b525a){if(_0x3b525a){var _0x4abf83=typeof _0x51b7df['offset']===_0xc7a1('0x1d')&&typeof _0x51b7df['limit']==='undefined';var _0x4bb84b=_0x3b525a[_0xc7a1('0x1e')];var _0x14acd2=_0x4abf83?0x0:_0x51b7df['offset'];var _0x1c7801=_0x4abf83?_0x3b525a[_0xc7a1('0x1e')]:_0x51b7df['offset']+_0x51b7df[_0xc7a1('0x1f')];var _0x1fb448;if(_0x1c7801>=_0x4bb84b){_0x1c7801=_0x4bb84b;_0x1fb448=0xc8;}else{_0x1fb448=0xce;}_0x560a75[_0xc7a1('0x1b')](_0x1fb448);return _0x560a75['set']('Content-Range',_0x14acd2+'-'+_0x1c7801+'/'+_0x4bb84b)[_0xc7a1('0x20')](_0x3b525a);}return null;};}function patchUpdates(_0x390468){return function(_0x7d0ff9){try{jsonpatch['apply'](_0x7d0ff9,_0x390468,!![]);}catch(_0x145681){return BPromise[_0xc7a1('0x21')](_0x145681);}return _0x7d0ff9[_0xc7a1('0x22')]();};}function saveUpdates(_0x1372f7,_0x410e84){return function(_0x44f387){if(_0x44f387){return _0x44f387[_0xc7a1('0x23')](_0x1372f7)[_0xc7a1('0x24')](function(_0x36d8b6){return _0x36d8b6;});}return null;};}function removeEntity(_0x2b3616,_0x13c99f){return function(_0xb208b7){if(_0xb208b7){return _0xb208b7[_0xc7a1('0x25')]()[_0xc7a1('0x24')](function(){_0x2b3616[_0xc7a1('0x1b')](0xcc)[_0xc7a1('0x1c')]();});}};}function handleEntityNotFound(_0x59c05f,_0xb4fdd6){return function(_0x4b182b){if(!_0x4b182b){_0x59c05f[_0xc7a1('0x26')](0x194);}return _0x4b182b;};}function handleError(_0x1b881f,_0x53b7cd){_0x53b7cd=_0x53b7cd||0x1f4;return function(_0x5a29e6){logger['error'](_0x5a29e6[_0xc7a1('0x27')]);if(_0x5a29e6[_0xc7a1('0x28')]){delete _0x5a29e6['name'];}_0x1b881f[_0xc7a1('0x1b')](_0x53b7cd)[_0xc7a1('0x29')](_0x5a29e6);};}exports['index']=function(_0x491b58,_0x2cf2c3){var _0x3c8379={},_0x508561={},_0x21db98={'count':0x0,'rows':[]};var _0x3529dd=_[_0xc7a1('0x2a')](db[_0xc7a1('0x2b')][_0xc7a1('0x2c')],function(_0x2dadbc){return{'name':_0x2dadbc[_0xc7a1('0x2d')],'type':_0x2dadbc[_0xc7a1('0x2e')][_0xc7a1('0x2f')]};});_0x508561[_0xc7a1('0x30')]=_[_0xc7a1('0x2a')](_0x3529dd,_0xc7a1('0x28'));_0x508561[_0xc7a1('0x31')]=_[_0xc7a1('0x32')](_0x491b58[_0xc7a1('0x31')]);_0x508561[_0xc7a1('0x33')]=_[_0xc7a1('0x34')](_0x508561[_0xc7a1('0x30')],_0x508561[_0xc7a1('0x31')]);_0x3c8379[_0xc7a1('0x35')]=_[_0xc7a1('0x34')](_0x508561[_0xc7a1('0x30')],qs[_0xc7a1('0x36')](_0x491b58[_0xc7a1('0x31')][_0xc7a1('0x36')]));_0x3c8379[_0xc7a1('0x35')]=_0x3c8379['attributes']['length']?_0x3c8379[_0xc7a1('0x35')]:_0x508561[_0xc7a1('0x30')];if(!_0x491b58[_0xc7a1('0x31')][_0xc7a1('0x37')]('nolimit')){_0x3c8379[_0xc7a1('0x1f')]=qs['limit'](_0x491b58[_0xc7a1('0x31')]['limit']);_0x3c8379['offset']=qs[_0xc7a1('0x38')](_0x491b58[_0xc7a1('0x31')][_0xc7a1('0x38')]);}_0x3c8379[_0xc7a1('0x39')]=qs[_0xc7a1('0x3a')](_0x491b58[_0xc7a1('0x31')]['sort']);_0x3c8379[_0xc7a1('0x3b')]=qs['filters'](_[_0xc7a1('0x3c')](_0x491b58[_0xc7a1('0x31')],_0x508561[_0xc7a1('0x33')]),_0x3529dd);if(_0x491b58['query']['filter']){_0x3c8379[_0xc7a1('0x3b')]=_[_0xc7a1('0x3d')](_0x3c8379[_0xc7a1('0x3b')],{'$or':_[_0xc7a1('0x2a')](_0x3529dd,function(_0x122e7f){if(_0x122e7f[_0xc7a1('0x2e')]!==_0xc7a1('0x3e')){var _0x604444={};_0x604444[_0x122e7f[_0xc7a1('0x28')]]={'$like':'%'+_0x491b58[_0xc7a1('0x31')][_0xc7a1('0x3f')]+'%'};return _0x604444;}})});}_0x3c8379=_['merge']({},_0x3c8379,_0x491b58['options']);var _0x3fd94e={'where':_0x3c8379[_0xc7a1('0x3b')]};return db[_0xc7a1('0x2b')][_0xc7a1('0x1e')](_0x3fd94e)[_0xc7a1('0x24')](function(_0x334f7e){_0x21db98[_0xc7a1('0x1e')]=_0x334f7e;if(_0x491b58['query'][_0xc7a1('0x40')]){_0x3c8379['include']=[{'all':!![]}];}return db[_0xc7a1('0x2b')][_0xc7a1('0x41')](_0x3c8379);})[_0xc7a1('0x24')](function(_0x3814d3){_0x21db98['rows']=_0x3814d3;return _0x21db98;})[_0xc7a1('0x24')](respondWithFilteredResult(_0x2cf2c3,_0x3c8379))[_0xc7a1('0x42')](handleError(_0x2cf2c3,null));};exports['show']=function(_0x4b8ea3,_0x2abbd6){var _0x460fa0={'raw':!![],'where':{'id':_0x4b8ea3['params']['id']}},_0x17333a={};_0x17333a[_0xc7a1('0x30')]=_[_0xc7a1('0x32')](db[_0xc7a1('0x2b')][_0xc7a1('0x2c')]);_0x17333a[_0xc7a1('0x31')]=_[_0xc7a1('0x32')](_0x4b8ea3['query']);_0x17333a['filters']=_['intersection'](_0x17333a[_0xc7a1('0x30')],_0x17333a['query']);_0x460fa0[_0xc7a1('0x35')]=_[_0xc7a1('0x34')](_0x17333a[_0xc7a1('0x30')],qs[_0xc7a1('0x36')](_0x4b8ea3[_0xc7a1('0x31')][_0xc7a1('0x36')]));_0x460fa0['attributes']=_0x460fa0['attributes'][_0xc7a1('0x43')]?_0x460fa0[_0xc7a1('0x35')]:_0x17333a['model'];if(_0x4b8ea3[_0xc7a1('0x31')][_0xc7a1('0x40')]){_0x460fa0['include']=[{'all':!![]}];}_0x460fa0=_['merge']({},_0x460fa0,_0x4b8ea3['options']);return db[_0xc7a1('0x2b')][_0xc7a1('0x44')](_0x460fa0)[_0xc7a1('0x24')](handleEntityNotFound(_0x2abbd6,null))[_0xc7a1('0x24')](respondWithResult(_0x2abbd6,null))[_0xc7a1('0x42')](handleError(_0x2abbd6,null));};exports[_0xc7a1('0x45')]=function(_0x3eedeb,_0x2bca88){return db[_0xc7a1('0x2b')]['create'](_0x3eedeb[_0xc7a1('0x46')],{})[_0xc7a1('0x24')](respondWithResult(_0x2bca88,0xc9))[_0xc7a1('0x42')](handleError(_0x2bca88,null));};exports['update']=function(_0x56c2e9,_0x2022e0){if(_0x56c2e9[_0xc7a1('0x46')]['id']){delete _0x56c2e9[_0xc7a1('0x46')]['id'];}return db[_0xc7a1('0x2b')][_0xc7a1('0x44')]({'where':{'id':_0x56c2e9[_0xc7a1('0x47')]['id']}})[_0xc7a1('0x24')](handleEntityNotFound(_0x2022e0,null))[_0xc7a1('0x24')](saveUpdates(_0x56c2e9[_0xc7a1('0x46')],null))[_0xc7a1('0x24')](respondWithResult(_0x2022e0,null))[_0xc7a1('0x42')](handleError(_0x2022e0,null));};exports[_0xc7a1('0x25')]=function(_0x5dba2c,_0x5d07c1){return db[_0xc7a1('0x2b')][_0xc7a1('0x44')]({'where':{'id':_0x5dba2c[_0xc7a1('0x47')]['id']}})[_0xc7a1('0x24')](handleEntityNotFound(_0x5d07c1,null))[_0xc7a1('0x24')](removeEntity(_0x5d07c1,null))['catch'](handleError(_0x5d07c1,null));};exports[_0xc7a1('0x48')]=function(_0x1812ed,_0x4c5145){return db['ChatInternalMessage'][_0xc7a1('0x48')]()[_0xc7a1('0x24')](respondWithResult(_0x4c5145,null))[_0xc7a1('0x42')](handleError(_0x4c5145,null));};function wrapUser(_0x422e5f){return function(_0x2dc027){var _0x16920e=_0x422e5f[_0xc7a1('0x49')]({'plain':!![]});_0x16920e[_0xc7a1('0x4a')]=[];if(_0x2dc027){_0x16920e[_0xc7a1('0x4b')]=_0x2dc027['createdAt'];_0x16920e[_0xc7a1('0x4c')]=_0x2dc027;}else{_0x16920e[_0xc7a1('0x4b')]=moment(0x0)[_0xc7a1('0x4d')](_0xc7a1('0x4e'));_0x16920e['lastMessage']={};}return _0x16920e;};}exports[_0xc7a1('0x4f')]=function(_0x5704bd,_0x2b6d95,_0x14a0d5){var _0x4cf9e1=[];return db[_0xc7a1('0x50')][_0xc7a1('0x41')]({'where':{'role':[_0xc7a1('0x51'),'admin',_0xc7a1('0x52')]},'attributes':['id',_0xc7a1('0x53'),'name',_0xc7a1('0x54'),'userpic',_0xc7a1('0x55'),_0xc7a1('0x56'),_0xc7a1('0x57'),_0xc7a1('0x58'),'showWebBar'],'order':qs['sort']('-online'),'include':[{'model':db[_0xc7a1('0x59')],'as':'VoiceQueues','attributes':['id','name',_0xc7a1('0x2e')],'through':{'attributes':[]}}]})[_0xc7a1('0x24')](function(_0x2bf13e){if(_0x2bf13e){var _0x4607d5=_0x5704bd['user'][_0xc7a1('0x49')]({'plain':!![]});if(!_0x4607d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4607d5[_0xc7a1('0x54')]===_0xc7a1('0x52')){return db[_0xc7a1('0x5a')][_0xc7a1('0x44')]({'where':{'name':_0xc7a1('0x5b'),'userProfileId':_0x4607d5['userProfileId']},'raw':!![]})[_0xc7a1('0x24')](function(_0x4a5e70){if(_0x4a5e70){if(_0x4a5e70['autoAssociation']===0x0){return db[_0xc7a1('0x5c')][_0xc7a1('0x41')]({'where':{'sectionId':_0x4a5e70['id']},'raw':!![]})[_0xc7a1('0x24')](function(_0xd5dd37){var _0x231186=[];if(_[_0xc7a1('0x5d')](_0xd5dd37)){_0x231186=_[_0xc7a1('0x3f')](_0x2bf13e,function(_0x32f75f){if(_0x32f75f[_0xc7a1('0x54')]!==_0xc7a1('0x51')){return _0x32f75f;}});return _0x231186;}else{for(var _0x1e4312=0x0;_0x1e4312<_0x2bf13e['length'];_0x1e4312++){var _0x37c455=_0x2bf13e[_0x1e4312];if(_0x37c455[_0xc7a1('0x54')]===_0xc7a1('0x51')){var _0x2b8406=_['find'](_0xd5dd37,function(_0x1aac36){return _0x1aac36['resourceId']===_0x37c455['id'];});if(_0x2b8406)_0x231186[_0xc7a1('0x5e')](_0x37c455);}else{_0x231186[_0xc7a1('0x5e')](_0x37c455);}}return _0x231186;}});}else{return _0x2bf13e;}}else{var _0x1e205a=_[_0xc7a1('0x3f')](_0x2bf13e,function(_0x196b40){if(_0x196b40['role']!==_0xc7a1('0x51')){return _0x196b40;}});return _0x1e205a;}});}else{return _0x2bf13e;}}})[_0xc7a1('0x24')](function(_0x3aeb80){var _0x387d34=[];if(_0x3aeb80){_0x4cf9e1=_0x3aeb80;for(var _0x4979b7=0x0;_0x4979b7<_0x3aeb80[_0xc7a1('0x43')];_0x4979b7+=0x1){_0x4cf9e1[_0x4979b7]['messages']=[];_0x387d34[_0xc7a1('0x5e')](db[_0xc7a1('0x2b')][_0xc7a1('0x44')]({'where':{'FromId':[_0x5704bd[_0xc7a1('0x52')]['id'],_0x3aeb80[_0x4979b7]['id']],'ToId':[_0x5704bd[_0xc7a1('0x52')]['id'],_0x3aeb80[_0x4979b7]['id']],'ChatGroupId':null},'attributes':['id',_0xc7a1('0x5f'),_0xc7a1('0x60'),_0xc7a1('0x61'),'read',_0xc7a1('0x46')],'order':qs['sort'](_0xc7a1('0x62')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xc7a1('0x24')](wrapUser(_0x3aeb80[_0x4979b7])));}return BPromise[_0xc7a1('0x63')](_0x387d34);}return[];})[_0xc7a1('0x24')](function(_0x1a3ef0){return{'rows':_0x1a3ef0,'count':_0x1a3ef0[_0xc7a1('0x43')]};})[_0xc7a1('0x24')](respondWithResult(_0x2b6d95,null))[_0xc7a1('0x42')](handleError(_0x2b6d95,null));};
\ No newline at end of file
index 5d33a75..339e033 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa128=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x2f89bc,_0x152531){var _0x57ae37=function(_0x4c9dd4){while(--_0x4c9dd4){_0x2f89bc['push'](_0x2f89bc['shift']());}};_0x57ae37(++_0x152531);}(_0xa128,0xef));var _0x8a12=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa128[_0x2763f2];return _0x3ef471;};'use strict';var EventEmitter=require(_0x8a12('0x0'));var ChatInternalMessage=require(_0x8a12('0x1'))['db'][_0x8a12('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x8a12('0x3')](0x0);var events={'afterCreate':_0x8a12('0x4'),'afterUpdate':_0x8a12('0x5'),'afterDestroy':_0x8a12('0x6')};function emitEvent(_0x7bf092){return function(_0x4cfb8c,_0x384d60,_0x3cf8d9){ChatInternalMessageEvents[_0x8a12('0x7')](_0x7bf092+':'+_0x4cfb8c['id'],_0x4cfb8c);ChatInternalMessageEvents[_0x8a12('0x7')](_0x7bf092,_0x4cfb8c);_0x3cf8d9(null);};}for(var e in events){if(events[_0x8a12('0x8')](e)){var event=events[e];ChatInternalMessage[_0x8a12('0x9')](e,emitEvent(event));}}module[_0x8a12('0xa')]=ChatInternalMessageEvents;
\ No newline at end of file
+var _0x9ecd=['emit','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x265aec,_0x4ec8ab){var _0xa460a4=function(_0x301184){while(--_0x301184){_0x265aec['push'](_0x265aec['shift']());}};_0xa460a4(++_0x4ec8ab);}(_0x9ecd,0x17f));var _0xd9ec=function(_0x4ba0bc,_0x99a5c5){_0x4ba0bc=_0x4ba0bc-0x0;var _0x18aabe=_0x9ecd[_0x4ba0bc];return _0x18aabe;};'use strict';var EventEmitter=require(_0xd9ec('0x0'));var ChatInternalMessage=require(_0xd9ec('0x1'))['db'][_0xd9ec('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd9ec('0x3')](0x0);var events={'afterCreate':_0xd9ec('0x4'),'afterUpdate':_0xd9ec('0x5'),'afterDestroy':_0xd9ec('0x6')};function emitEvent(_0x1cd462){return function(_0x16e533,_0x5ed022,_0x529142){ChatInternalMessageEvents[_0xd9ec('0x7')](_0x1cd462+':'+_0x16e533['id'],_0x16e533);ChatInternalMessageEvents[_0xd9ec('0x7')](_0x1cd462,_0x16e533);_0x529142(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xd9ec('0x8')](e,emitEvent(event));}}module[_0xd9ec('0x9')]=ChatInternalMessageEvents;
\ No newline at end of file
index 2f4492d..b806fc0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5b2e=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatInternalMessage'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x5b2e,0x109));var _0xe5b2=function(_0x5968f8,_0x5215dd){_0x5968f8=_0x5968f8-0x0;var _0x5a2bcb=_0x5b2e[_0x5968f8];return _0x5a2bcb;};'use strict';var _=require(_0xe5b2('0x0'));var util=require(_0xe5b2('0x1'));var logger=require(_0xe5b2('0x2'))(_0xe5b2('0x3'));var moment=require('moment');var BPromise=require(_0xe5b2('0x4'));var rp=require(_0xe5b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe5b2('0x6'));var config=require(_0xe5b2('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0xe5b2('0x8')]=function(_0xc723c3,_0xea51ba){return _0xc723c3[_0xe5b2('0x9')](_0xe5b2('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe5b2('0xb')});};
\ No newline at end of file
+var _0x61bc=['api','moment','bluebird','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x56017b,_0x1915df){var _0x744d4=function(_0x571036){while(--_0x571036){_0x56017b['push'](_0x56017b['shift']());}};_0x744d4(++_0x1915df);}(_0x61bc,0x169));var _0xc61b=function(_0x83f5af,_0x1ac4a1){_0x83f5af=_0x83f5af-0x0;var _0x314027=_0x61bc[_0x83f5af];return _0x314027;};'use strict';var _=require(_0xc61b('0x0'));var util=require(_0xc61b('0x1'));var logger=require(_0xc61b('0x2'))(_0xc61b('0x3'));var moment=require(_0xc61b('0x4'));var BPromise=require(_0xc61b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc61b('0x6'));var config=require(_0xc61b('0x7'));var attributes=require(_0xc61b('0x8'));module[_0xc61b('0x9')]=function(_0x3839a8,_0x5971ac){return _0x3839a8['define']('ChatInternalMessage',attributes,{'tableName':_0xc61b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc61b('0xb'),'collate':_0xc61b('0xc')});};
\ No newline at end of file
index 5a01653..8958ece 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9264=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash'];(function(_0x510f14,_0x5e145e){var _0x58cc0a=function(_0x2b88bc){while(--_0x2b88bc){_0x510f14['push'](_0x510f14['shift']());}};_0x58cc0a(++_0x5e145e);}(_0x9264,0xae));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4926('0x0'));var util=require(_0x4926('0x1'));var moment=require(_0x4926('0x2'));var BPromise=require(_0x4926('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4926('0x4'));var db=require(_0x4926('0x5'))['db'];var utils=require(_0x4926('0x6'));var logger=require(_0x4926('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4926('0x8'));var client=jayson['client'][_0x4926('0x9')]({'port':0x232a});config['redis']=_[_0x4926('0xa')](config[_0x4926('0xb')],{'host':_0x4926('0xc'),'port':0x18eb});var socket=require(_0x4926('0xd'))(new Redis(config[_0x4926('0xb')]));require('./chatInternalMessage.socket')[_0x4926('0xe')](socket);function respondWithRpcPromise(_0x25079f,_0x8e7092,_0x1d46ab){return new BPromise(function(_0xe8e37e,_0x415125){return client[_0x4926('0xf')](_0x25079f,_0x1d46ab)['then'](function(_0x211afa){logger[_0x4926('0x10')](_0x4926('0x11'),_0x8e7092,_0x4926('0x12'));logger['debug'](_0x4926('0x13'),_0x8e7092,_0x4926('0x12'),JSON['stringify'](_0x211afa));if(_0x211afa['error']){if(_0x211afa['error'][_0x4926('0x14')]===0x1f4){logger[_0x4926('0x15')](_0x4926('0x11'),_0x8e7092,_0x211afa[_0x4926('0x15')][_0x4926('0x16')]);return _0x415125(_0x211afa['error']['message']);}logger['error'](_0x4926('0x11'),_0x8e7092,_0x211afa['error'][_0x4926('0x16')]);return _0xe8e37e(_0x211afa[_0x4926('0x15')]['message']);}else{logger[_0x4926('0x10')](_0x4926('0x11'),_0x8e7092,_0x4926('0x12'));_0xe8e37e(_0x211afa[_0x4926('0x17')]['message']);}})[_0x4926('0x18')](function(_0x3fde52){logger[_0x4926('0x15')](_0x4926('0x11'),_0x8e7092,_0x3fde52);_0x415125(_0x3fde52);});});}
\ No newline at end of file
+var _0x5010=['../../config/utils','../../config/logger','rpc','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x58dcda,_0x5242b9){var _0x586586=function(_0x2d9d2a){while(--_0x2d9d2a){_0x58dcda['push'](_0x58dcda['shift']());}};_0x586586(++_0x5242b9);}(_0x5010,0x1c9));var _0x0501=function(_0x20f58f,_0x18985a){_0x20f58f=_0x20f58f-0x0;var _0x2d4f20=_0x5010[_0x20f58f];return _0x2d4f20;};'use strict';var _=require(_0x0501('0x0'));var util=require(_0x0501('0x1'));var moment=require(_0x0501('0x2'));var BPromise=require(_0x0501('0x3'));var rs=require(_0x0501('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0501('0x5'));var logger=require(_0x0501('0x6'))(_0x0501('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0501('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0501('0x9')],{'host':_0x0501('0xa'),'port':0x18eb});var socket=require(_0x0501('0xb'))(new Redis(config[_0x0501('0x9')]));require(_0x0501('0xc'))['register'](socket);function respondWithRpcPromise(_0x201281,_0x3dbf5b,_0x261654){return new BPromise(function(_0x2fd7c1,_0x35ab82){return client['request'](_0x201281,_0x261654)['then'](function(_0x4983db){logger[_0x0501('0xd')](_0x0501('0xe'),_0x3dbf5b,_0x0501('0xf'));logger[_0x0501('0x10')](_0x0501('0x11'),_0x3dbf5b,_0x0501('0xf'),JSON[_0x0501('0x12')](_0x4983db));if(_0x4983db['error']){if(_0x4983db[_0x0501('0x13')]['code']===0x1f4){logger[_0x0501('0x13')](_0x0501('0xe'),_0x3dbf5b,_0x4983db[_0x0501('0x13')][_0x0501('0x14')]);return _0x35ab82(_0x4983db[_0x0501('0x13')][_0x0501('0x14')]);}logger[_0x0501('0x13')](_0x0501('0xe'),_0x3dbf5b,_0x4983db[_0x0501('0x13')][_0x0501('0x14')]);return _0x2fd7c1(_0x4983db[_0x0501('0x13')]['message']);}else{logger[_0x0501('0xd')](_0x0501('0xe'),_0x3dbf5b,_0x0501('0xf'));_0x2fd7c1(_0x4983db[_0x0501('0x15')][_0x0501('0x14')]);}})['catch'](function(_0x281ad3){logger[_0x0501('0x13')](_0x0501('0xe'),_0x3dbf5b,_0x281ad3);_0x35ab82(_0x281ad3);});});}
\ No newline at end of file
index a3e3776..44298ef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1fef=['save','remove','emit','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x53f812,_0x3a47e5){var _0x466856=function(_0x164719){while(--_0x164719){_0x53f812['push'](_0x53f812['shift']());}};_0x466856(++_0x3a47e5);}(_0x1fef,0x8f));var _0xf1fe=function(_0x11257f,_0x242a74){_0x11257f=_0x11257f-0x0;var _0x51cbad=_0x1fef[_0x11257f];return _0x51cbad;};'use strict';var ChatInternalMessageEvents=require(_0xf1fe('0x0'));var events=[_0xf1fe('0x1'),_0xf1fe('0x2'),'update'];function createListener(_0x7df065,_0x26a3e7){return function(_0x5b8609){_0x26a3e7[_0xf1fe('0x3')](_0x7df065,_0x5b8609);};}function removeListener(_0x4a3fec,_0x2757a1){return function(){ChatInternalMessageEvents['removeListener'](_0x4a3fec,_0x2757a1);};}exports['register']=function(_0x1933ca){for(var _0xdd72f5=0x0,_0x12e226=events[_0xf1fe('0x4')];_0xdd72f5<_0x12e226;_0xdd72f5++){var _0x42ee95=events[_0xdd72f5];var _0x54ab6c=createListener(_0xf1fe('0x5')+_0x42ee95,_0x1933ca);ChatInternalMessageEvents['on'](_0x42ee95,_0x54ab6c);}};
\ No newline at end of file
+var _0x2234=['./chatInternalMessage.events','save','remove','update','emit','removeListener','length'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x2234,0x1d5));var _0x4223=function(_0x3ba4b3,_0x584dac){_0x3ba4b3=_0x3ba4b3-0x0;var _0x53bb31=_0x2234[_0x3ba4b3];return _0x53bb31;};'use strict';var ChatInternalMessageEvents=require(_0x4223('0x0'));var events=[_0x4223('0x1'),_0x4223('0x2'),_0x4223('0x3')];function createListener(_0xfe9e57,_0xa572fe){return function(_0x57ccbf){_0xa572fe[_0x4223('0x4')](_0xfe9e57,_0x57ccbf);};}function removeListener(_0x1ffd7d,_0x5693ff){return function(){ChatInternalMessageEvents[_0x4223('0x5')](_0x1ffd7d,_0x5693ff);};}exports['register']=function(_0x5a72c7){for(var _0x9cf7bf=0x0,_0x420c07=events[_0x4223('0x6')];_0x9cf7bf<_0x420c07;_0x9cf7bf++){var _0x502588=events[_0x9cf7bf];var _0x30b8a3=createListener('chatInternalMessage:'+_0x502588,_0x5a72c7);ChatInternalMessageEvents['on'](_0x502588,_0x30b8a3);}};
\ No newline at end of file
index a40c9f5..eea3618 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x17c5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','create','put','update','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x5db097,_0x539741){var _0x2d2438=function(_0x8fefa3){while(--_0x8fefa3){_0x5db097['push'](_0x5db097['shift']());}};_0x2d2438(++_0x539741);}(_0x17c5,0x7f));var _0x517c=function(_0x18fdb2,_0x4fcfd0){_0x18fdb2=_0x18fdb2-0x0;var _0x451e77=_0x17c5[_0x18fdb2];return _0x451e77;};'use strict';var multer=require('multer');var util=require(_0x517c('0x0'));var path=require('path');var timeout=require(_0x517c('0x1'));var express=require(_0x517c('0x2'));var router=express[_0x517c('0x3')]();var fs_extra=require(_0x517c('0x4'));var auth=require(_0x517c('0x5'));var interaction=require(_0x517c('0x6'));var config=require(_0x517c('0x7'));var controller=require(_0x517c('0x8'));router[_0x517c('0x9')]('/',auth[_0x517c('0xa')](),controller[_0x517c('0xb')]);router[_0x517c('0x9')](_0x517c('0xc'),auth[_0x517c('0xa')](),controller[_0x517c('0xd')]);router[_0x517c('0x9')](_0x517c('0xe'),auth[_0x517c('0xa')](),controller[_0x517c('0xf')]);router[_0x517c('0x9')](_0x517c('0x10'),auth[_0x517c('0xa')](),controller[_0x517c('0x11')]);router['post']('/',auth[_0x517c('0xa')](),controller[_0x517c('0x12')]);router[_0x517c('0x13')](_0x517c('0x10'),controller[_0x517c('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x517c('0x15')]=router;
\ No newline at end of file
+var _0x47f3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x47f3,0xa4));var _0x347f=function(_0x4838bd,_0x214c0f){_0x4838bd=_0x4838bd-0x0;var _0x579f91=_0x47f3[_0x4838bd];return _0x579f91;};'use strict';var multer=require(_0x347f('0x0'));var util=require(_0x347f('0x1'));var path=require(_0x347f('0x2'));var timeout=require(_0x347f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x347f('0x4'));var interaction=require(_0x347f('0x5'));var config=require(_0x347f('0x6'));var controller=require(_0x347f('0x7'));router[_0x347f('0x8')]('/',auth[_0x347f('0x9')](),controller[_0x347f('0xa')]);router[_0x347f('0x8')]('/describe',auth[_0x347f('0x9')](),controller[_0x347f('0xb')]);router[_0x347f('0x8')](_0x347f('0xc'),auth[_0x347f('0x9')](),controller[_0x347f('0xd')]);router[_0x347f('0x8')](_0x347f('0xe'),auth[_0x347f('0x9')](),controller[_0x347f('0xf')]);router[_0x347f('0x10')]('/',auth[_0x347f('0x9')](),controller[_0x347f('0x11')]);router[_0x347f('0x12')](_0x347f('0xe'),controller[_0x347f('0x13')]);router[_0x347f('0x14')](_0x347f('0xe'),auth[_0x347f('0x9')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index fe0b9c2..b5846df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6215=['out','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5621('0x0'));module[_0x5621('0x1')]={'body':{'type':Sequelize[_0x5621('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5621('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5621('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5621('0x4')]('in',_0x5621('0x5')),'defaultValue':_0x5621('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x5621('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}};
\ No newline at end of file
+var _0x4024=['BOOLEAN','ENUM','out','DATE','sequelize','exports','medium'];(function(_0x4e2fe3,_0x15fb77){var _0x4f9d24=function(_0xc32b26){while(--_0xc32b26){_0x4e2fe3['push'](_0x4e2fe3['shift']());}};_0x4f9d24(++_0x15fb77);}(_0x4024,0x89));var _0x4402=function(_0x5ccd90,_0x8f617){_0x5ccd90=_0x5ccd90-0x0;var _0x4f82b5=_0x4024[_0x5ccd90];return _0x4f82b5;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4402('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4402('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4402('0x4')]('in','out'),'defaultValue':_0x4402('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4402('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}};
\ No newline at end of file
index 14171f3..92a3bec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1a0e=['limit','count','offset','set','Content-Range','reject','save','stack','name','send','map','ChatMessage','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','includeAll','include','findAll','rows','show','params','keys','rawAttributes','options','create','body','update','find','destroy','describe','../../config/logger','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','agent','manual','interface','channel','motionChannel','accept','acceptmessage','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','fullname','SIP/%s','event','EventManager','formData','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./chatMessage.socket','jayson/promise','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','undefined'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0x1a0e,0x15d));var _0xe1a0=function(_0xafdec6,_0x3d94df){_0xafdec6=_0xafdec6-0x0;var _0x372bdb=_0x1a0e[_0xafdec6];return _0x372bdb;};'use strict';var emlformat=require(_0xe1a0('0x0'));var rimraf=require(_0xe1a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe1a0('0x2'));var rp=require(_0xe1a0('0x3'));var moment=require(_0xe1a0('0x4'));var BPromise=require(_0xe1a0('0x5'));var Mustache=require(_0xe1a0('0x6'));var util=require('util');var path=require(_0xe1a0('0x7'));var sox=require(_0xe1a0('0x8'));var csv=require(_0xe1a0('0x9'));var ejs=require(_0xe1a0('0xa'));var fs=require('fs');var fs_extra=require(_0xe1a0('0xb'));var _=require('lodash');var squel=require(_0xe1a0('0xc'));var crypto=require(_0xe1a0('0xd'));var jsforce=require(_0xe1a0('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe1a0('0xf'));var Redis=require(_0xe1a0('0x10'));var authService=require(_0xe1a0('0x11'));var qs=require(_0xe1a0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1a0('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe1a0('0x14'));var config=require(_0xe1a0('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe1a0('0x16')]=_[_0xe1a0('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe1a0('0x18'))(new Redis(config[_0xe1a0('0x16')]));require(_0xe1a0('0x19'))['register'](socket);var jayson=require(_0xe1a0('0x1a'));var client=jayson['client'][_0xe1a0('0x1b')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c62e7,_0x26b698,_0x4659e,_0x3b2d9e){return new BPromise(function(_0x4d9abb,_0x363728){var _0x58ce38=_0x3b2d9e||client;return _0x58ce38[_0xe1a0('0x1c')](_0x3c62e7,_0x4659e)[_0xe1a0('0x1d')](function(_0x13f495){logger[_0xe1a0('0x1e')]('ChatMessage,\x20%s,\x20%s',_0x26b698,_0xe1a0('0x1f'));logger[_0xe1a0('0x20')](_0xe1a0('0x21'),_0x26b698,_0xe1a0('0x1f'),JSON[_0xe1a0('0x22')](_0x13f495));if(_0x13f495[_0xe1a0('0x23')]){if(_0x13f495['error']['code']===0x1f4){logger[_0xe1a0('0x23')](_0xe1a0('0x24'),_0x26b698,_0x13f495[_0xe1a0('0x23')][_0xe1a0('0x25')]);return _0x363728(_0x13f495[_0xe1a0('0x23')][_0xe1a0('0x25')]);}logger['error'](_0xe1a0('0x24'),_0x26b698,_0x13f495[_0xe1a0('0x23')][_0xe1a0('0x25')]);return _0x4d9abb(_0x13f495[_0xe1a0('0x23')][_0xe1a0('0x25')]);}else{logger[_0xe1a0('0x1e')](_0xe1a0('0x24'),_0x26b698,_0xe1a0('0x1f'));_0x4d9abb(_0x13f495[_0xe1a0('0x26')][_0xe1a0('0x25')]);}})[_0xe1a0('0x27')](function(_0x5b082b){logger[_0xe1a0('0x23')]('ChatMessage,\x20%s,\x20%s',_0x26b698,_0x5b082b);_0x363728(_0x5b082b);});});}function respondWithStatusCode(_0x1f4971,_0x281ef0){_0x281ef0=_0x281ef0||0xcc;return function(_0x182b0e){if(_0x182b0e){return _0x1f4971[_0xe1a0('0x28')](_0x281ef0);}return _0x1f4971[_0xe1a0('0x29')](_0x281ef0)[_0xe1a0('0x2a')]();};}function respondWithResult(_0xb337b2,_0x2546ff){_0x2546ff=_0x2546ff||0xc8;return function(_0x4ec0b6){if(_0x4ec0b6){return _0xb337b2[_0xe1a0('0x29')](_0x2546ff)['json'](_0x4ec0b6);}};}function respondWithFilteredResult(_0x239ecb,_0x4a5605){return function(_0x3b7ae5){if(_0x3b7ae5){var _0x2df540=typeof _0x4a5605['offset']===_0xe1a0('0x2b')&&typeof _0x4a5605[_0xe1a0('0x2c')]===_0xe1a0('0x2b');var _0x429432=_0x3b7ae5[_0xe1a0('0x2d')];var _0x3e62f2=_0x2df540?0x0:_0x4a5605['offset'];var _0x605c8e=_0x2df540?_0x3b7ae5[_0xe1a0('0x2d')]:_0x4a5605[_0xe1a0('0x2e')]+_0x4a5605[_0xe1a0('0x2c')];var _0x22b1b7;if(_0x605c8e>=_0x429432){_0x605c8e=_0x429432;_0x22b1b7=0xc8;}else{_0x22b1b7=0xce;}_0x239ecb[_0xe1a0('0x29')](_0x22b1b7);return _0x239ecb[_0xe1a0('0x2f')](_0xe1a0('0x30'),_0x3e62f2+'-'+_0x605c8e+'/'+_0x429432)['json'](_0x3b7ae5);}return null;};}function patchUpdates(_0x36b24b){return function(_0x483072){try{jsonpatch['apply'](_0x483072,_0x36b24b,!![]);}catch(_0x22dc18){return BPromise[_0xe1a0('0x31')](_0x22dc18);}return _0x483072[_0xe1a0('0x32')]();};}function saveUpdates(_0x489964,_0x384a38){return function(_0x39621e){if(_0x39621e){return _0x39621e['update'](_0x489964)[_0xe1a0('0x1d')](function(_0x3bbeb4){return _0x3bbeb4;});}return null;};}function removeEntity(_0x5a997e,_0x194390){return function(_0x5eff80){if(_0x5eff80){return _0x5eff80['destroy']()['then'](function(){_0x5a997e[_0xe1a0('0x29')](0xcc)[_0xe1a0('0x2a')]();});}};}function handleEntityNotFound(_0x221fe8,_0x38db49){return function(_0x1db847){if(!_0x1db847){_0x221fe8[_0xe1a0('0x28')](0x194);}return _0x1db847;};}function handleError(_0x5919b1,_0x4a055a){_0x4a055a=_0x4a055a||0x1f4;return function(_0x1c0d87){logger['error'](_0x1c0d87[_0xe1a0('0x33')]);if(_0x1c0d87['name']){delete _0x1c0d87[_0xe1a0('0x34')];}_0x5919b1[_0xe1a0('0x29')](_0x4a055a)[_0xe1a0('0x35')](_0x1c0d87);};}exports['index']=function(_0x5eda90,_0x2489a7){var _0x15fc49={},_0x5b480d={},_0x1321b4={'count':0x0,'rows':[]};var _0x107c7b=_[_0xe1a0('0x36')](db[_0xe1a0('0x37')]['rawAttributes'],function(_0x53490c){return{'name':_0x53490c[_0xe1a0('0x38')],'type':_0x53490c[_0xe1a0('0x39')][_0xe1a0('0x3a')]};});_0x5b480d[_0xe1a0('0x3b')]=_[_0xe1a0('0x36')](_0x107c7b,_0xe1a0('0x34'));_0x5b480d[_0xe1a0('0x3c')]=_['keys'](_0x5eda90[_0xe1a0('0x3c')]);_0x5b480d['filters']=_[_0xe1a0('0x3d')](_0x5b480d[_0xe1a0('0x3b')],_0x5b480d[_0xe1a0('0x3c')]);_0x15fc49[_0xe1a0('0x3e')]=_[_0xe1a0('0x3d')](_0x5b480d[_0xe1a0('0x3b')],qs[_0xe1a0('0x3f')](_0x5eda90[_0xe1a0('0x3c')][_0xe1a0('0x3f')]));_0x15fc49[_0xe1a0('0x3e')]=_0x15fc49[_0xe1a0('0x3e')][_0xe1a0('0x40')]?_0x15fc49[_0xe1a0('0x3e')]:_0x5b480d['model'];if(!_0x5eda90[_0xe1a0('0x3c')][_0xe1a0('0x41')]('nolimit')){_0x15fc49[_0xe1a0('0x2c')]=qs[_0xe1a0('0x2c')](_0x5eda90['query'][_0xe1a0('0x2c')]);_0x15fc49[_0xe1a0('0x2e')]=qs[_0xe1a0('0x2e')](_0x5eda90[_0xe1a0('0x3c')]['offset']);}_0x15fc49[_0xe1a0('0x42')]=qs[_0xe1a0('0x43')](_0x5eda90['query']['sort']);_0x15fc49[_0xe1a0('0x44')]=qs[_0xe1a0('0x45')](_[_0xe1a0('0x46')](_0x5eda90[_0xe1a0('0x3c')],_0x5b480d[_0xe1a0('0x45')]),_0x107c7b);if(_0x5eda90[_0xe1a0('0x3c')]['filter']){_0x15fc49['where']=_[_0xe1a0('0x47')](_0x15fc49[_0xe1a0('0x44')],{'$or':_[_0xe1a0('0x36')](_0x107c7b,function(_0xd596b4){if(_0xd596b4[_0xe1a0('0x39')]!=='VIRTUAL'){var _0x3bccb7={};_0x3bccb7[_0xd596b4[_0xe1a0('0x34')]]={'$like':'%'+_0x5eda90['query'][_0xe1a0('0x48')]+'%'};return _0x3bccb7;}})});}_0x15fc49=_['merge']({},_0x15fc49,_0x5eda90['options']);var _0x3f57d3={'where':_0x15fc49['where']};return db[_0xe1a0('0x37')][_0xe1a0('0x2d')](_0x3f57d3)['then'](function(_0x2131c9){_0x1321b4[_0xe1a0('0x2d')]=_0x2131c9;if(_0x5eda90[_0xe1a0('0x3c')][_0xe1a0('0x49')]){_0x15fc49[_0xe1a0('0x4a')]=[{'all':!![]}];}return db['ChatMessage'][_0xe1a0('0x4b')](_0x15fc49);})[_0xe1a0('0x1d')](function(_0x1e1357){_0x1321b4[_0xe1a0('0x4c')]=_0x1e1357;return _0x1321b4;})[_0xe1a0('0x1d')](respondWithFilteredResult(_0x2489a7,_0x15fc49))[_0xe1a0('0x27')](handleError(_0x2489a7,null));};exports[_0xe1a0('0x4d')]=function(_0x3fe584,_0x4ef39f){var _0x266193={'raw':!![],'where':{'id':_0x3fe584[_0xe1a0('0x4e')]['id']}},_0x489477={};_0x489477[_0xe1a0('0x3b')]=_[_0xe1a0('0x4f')](db[_0xe1a0('0x37')][_0xe1a0('0x50')]);_0x489477[_0xe1a0('0x3c')]=_[_0xe1a0('0x4f')](_0x3fe584[_0xe1a0('0x3c')]);_0x489477[_0xe1a0('0x45')]=_[_0xe1a0('0x3d')](_0x489477[_0xe1a0('0x3b')],_0x489477[_0xe1a0('0x3c')]);_0x266193[_0xe1a0('0x3e')]=_[_0xe1a0('0x3d')](_0x489477[_0xe1a0('0x3b')],qs['fields'](_0x3fe584[_0xe1a0('0x3c')]['fields']));_0x266193[_0xe1a0('0x3e')]=_0x266193['attributes'][_0xe1a0('0x40')]?_0x266193[_0xe1a0('0x3e')]:_0x489477[_0xe1a0('0x3b')];if(_0x3fe584[_0xe1a0('0x3c')]['includeAll']){_0x266193[_0xe1a0('0x4a')]=[{'all':!![]}];}_0x266193=_[_0xe1a0('0x47')]({},_0x266193,_0x3fe584[_0xe1a0('0x51')]);return db[_0xe1a0('0x37')]['find'](_0x266193)['then'](handleEntityNotFound(_0x4ef39f,null))['then'](respondWithResult(_0x4ef39f,null))[_0xe1a0('0x27')](handleError(_0x4ef39f,null));};exports[_0xe1a0('0x52')]=function(_0x2bf5f7,_0xe707a2){return db[_0xe1a0('0x37')][_0xe1a0('0x52')](_0x2bf5f7[_0xe1a0('0x53')],{})[_0xe1a0('0x1d')](respondWithResult(_0xe707a2,0xc9))[_0xe1a0('0x27')](handleError(_0xe707a2,null));};exports[_0xe1a0('0x54')]=function(_0x19cf0f,_0x458af3){if(_0x19cf0f['body']['id']){delete _0x19cf0f['body']['id'];}return db[_0xe1a0('0x37')][_0xe1a0('0x55')]({'where':{'id':_0x19cf0f[_0xe1a0('0x4e')]['id']}})[_0xe1a0('0x1d')](handleEntityNotFound(_0x458af3,null))[_0xe1a0('0x1d')](saveUpdates(_0x19cf0f['body'],null))[_0xe1a0('0x1d')](respondWithResult(_0x458af3,null))[_0xe1a0('0x27')](handleError(_0x458af3,null));};exports[_0xe1a0('0x56')]=function(_0x16be57,_0x4c3f55){return db[_0xe1a0('0x37')][_0xe1a0('0x55')]({'where':{'id':_0x16be57[_0xe1a0('0x4e')]['id']}})[_0xe1a0('0x1d')](handleEntityNotFound(_0x4c3f55,null))[_0xe1a0('0x1d')](removeEntity(_0x4c3f55,null))[_0xe1a0('0x27')](handleError(_0x4c3f55,null));};exports[_0xe1a0('0x57')]=function(_0x4a83c9,_0x4f747e){return db[_0xe1a0('0x37')][_0xe1a0('0x57')]()[_0xe1a0('0x1d')](respondWithResult(_0x4f747e,null))[_0xe1a0('0x27')](handleError(_0x4f747e,null));};var interaction_log=require(_0xe1a0('0x58'))(_0xe1a0('0x59'));exports['accept']=function(_0x156a6e,_0x4926fe,_0x1bb0e8){var _0x2f9924={'agent':{},'channel':_0xe1a0('0x5a')};if(_0x156a6e['body']['id']){delete _0x156a6e[_0xe1a0('0x53')]['id'];}_0x156a6e[_0xe1a0('0x53')][_0xe1a0('0x5b')]=!![];_0x156a6e[_0xe1a0('0x53')][_0xe1a0('0x5c')]=moment()[_0xe1a0('0x5d')](_0xe1a0('0x5e'));_0x156a6e[_0xe1a0('0x53')][_0xe1a0('0x5f')]=_0x156a6e[_0xe1a0('0x53')][_0xe1a0('0x5f')]||_0x156a6e[_0xe1a0('0x60')]['id'];_0x2f9924['agent']['id']=_0x156a6e[_0xe1a0('0x53')][_0xe1a0('0x5f')];return db[_0xe1a0('0x37')]['find']({'where':{'id':_0x156a6e[_0xe1a0('0x4e')]['id'],'UserId':null}})[_0xe1a0('0x1d')](handleEntityNotFound(_0x4926fe,null))['then'](saveUpdates(_0x156a6e[_0xe1a0('0x53')],null))[_0xe1a0('0x1d')](function(_0x4d02e4){if(_0x4d02e4){_0x2f9924[_0xe1a0('0x25')]=_0x4d02e4[_0xe1a0('0x61')]({'plain':!![]});return db[_0xe1a0('0x62')][_0xe1a0('0x55')]({'where':{'id':_0x4d02e4[_0xe1a0('0x63')]}});}return null;})[_0xe1a0('0x1d')](handleEntityNotFound(_0x4926fe,null))[_0xe1a0('0x1d')](function(_0x15b002){if(_0x15b002){return _0x15b002[_0xe1a0('0x54')]({'UserId':_0x156a6e[_0xe1a0('0x53')][_0xe1a0('0x5f')],'read1stAt':_[_0xe1a0('0x64')](_0x15b002[_0xe1a0('0x65')])?moment()[_0xe1a0('0x5d')](_0xe1a0('0x5e')):undefined});}return null;})['then'](function(_0x67a55b){if(_0x67a55b){_0x2f9924[_0xe1a0('0x66')]=_0x67a55b['get']({'plain':!![]});interaction_log[_0xe1a0('0x1e')](_0xe1a0('0x67'),_0x156a6e[_0xe1a0('0x60')]['id'],_0x156a6e[_0xe1a0('0x60')][_0xe1a0('0x34')],_0x156a6e[_0xe1a0('0x60')][_0xe1a0('0x68')],_0x2f9924['interaction']['id'],_0x156a6e[_0xe1a0('0x53')]?JSON[_0xe1a0('0x22')](_0x156a6e['body']):'null');return respondWithRpcPromise('AcceptMessage',_0xe1a0('0x69'),_0x2f9924);}return null;})['then'](function(_0x438193){var _0x1b2278=_0xe1a0('0x6a')+_0x438193[_0xe1a0('0x25')][_0xe1a0('0x6b')];return db[_0xe1a0('0x6c')]['query'](_0x1b2278,{'type':db[_0xe1a0('0x6d')][_0xe1a0('0x6e')][_0xe1a0('0x6f')],'raw':!![]})['then'](function(_0x543992){return _0x543992;});})['then'](function(_0x6d8954){if(_0x6d8954){_0x2f9924[_0xe1a0('0x25')]['contact']=_0x6d8954[0x0];if(!_0x156a6e[_0xe1a0('0x53')][_0xe1a0('0x5f')])return;return db[_0xe1a0('0x70')][_0xe1a0('0x55')]({'where':{'id':_0x156a6e[_0xe1a0('0x53')]['UserId'],'role':'agent'},'attributes':['id',_0xe1a0('0x34'),'fullname',_0xe1a0('0x71'),_0xe1a0('0x72')],'raw':!![]});}return null;})[_0xe1a0('0x1d')](function(_0x2ecb00){if(!_0x2ecb00)return null;_0x2f9924[_0xe1a0('0x25')][_0xe1a0('0x73')]=_0x2ecb00;return _0x2f9924;})[_0xe1a0('0x1d')](function(_0x5b912a){if(_0x5b912a){if(_0x156a6e['body'][_0xe1a0('0x74')]){_0x2f9924[_0xe1a0('0x25')][_0xe1a0('0x75')]=util[_0xe1a0('0x5d')]('SIP/%s',_0x156a6e[_0xe1a0('0x60')]['name']);_0x2f9924[_0xe1a0('0x25')][_0xe1a0('0x76')]=_0x2f9924[_0xe1a0('0x76')];_0x2f9924[_0xe1a0('0x25')][_0xe1a0('0x77')]=_0x2f9924[_0xe1a0('0x76')];_0x2f9924[_0xe1a0('0x25')]['event']=_0xe1a0('0x78');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xe1a0('0x79'),'message':_[_0xe1a0('0x47')](_0x2f9924[_0xe1a0('0x25')],JSON['parse'](_0x2f9924[_0xe1a0('0x66')]['formData']))},client9002)[_0xe1a0('0x1d')](function(){return _0x2f9924;});}return _0x2f9924;}return null;})[_0xe1a0('0x1d')](respondWithResult(_0x4926fe,null))['catch'](handleError(_0x4926fe,null));};var interaction_log=require(_0xe1a0('0x58'))(_0xe1a0('0x59'));exports[_0xe1a0('0x31')]=function(_0xc57590,_0x27c6ba,_0x129b62){var _0x225626={'agent':{},'channel':_0xe1a0('0x5a')};if(_0xc57590[_0xe1a0('0x53')]['id']){delete _0xc57590[_0xe1a0('0x53')]['id'];}_0xc57590[_0xe1a0('0x53')][_0xe1a0('0x5f')]=_0xc57590[_0xe1a0('0x53')][_0xe1a0('0x5f')]||_0xc57590[_0xe1a0('0x60')]['id'];_0x225626[_0xe1a0('0x73')]['id']=_0xc57590[_0xe1a0('0x53')][_0xe1a0('0x5f')];return db[_0xe1a0('0x37')]['find']({'where':{'id':_0xc57590[_0xe1a0('0x4e')]['id'],'UserId':null}})[_0xe1a0('0x1d')](handleEntityNotFound(_0x27c6ba,null))[_0xe1a0('0x1d')](function(_0x5ac756){if(_0x5ac756){_0x225626[_0xe1a0('0x25')]=_0x5ac756[_0xe1a0('0x61')]({'plain':!![]});return db[_0xe1a0('0x62')][_0xe1a0('0x55')]({'where':{'id':_0x5ac756[_0xe1a0('0x63')]}});}return null;})[_0xe1a0('0x1d')](handleEntityNotFound(_0x27c6ba,null))['then'](function(_0x15406f){if(_0x15406f){_0x225626[_0xe1a0('0x66')]=_0x15406f[_0xe1a0('0x61')]({'plain':!![]});interaction_log[_0xe1a0('0x1e')](_0xe1a0('0x7a'),_0xc57590['user']['id'],_0xc57590[_0xe1a0('0x60')][_0xe1a0('0x34')],_0xc57590[_0xe1a0('0x60')][_0xe1a0('0x68')],_0x225626['interaction']['id'],_0xc57590[_0xe1a0('0x53')]?JSON[_0xe1a0('0x22')](_0xc57590[_0xe1a0('0x53')]):_0xe1a0('0x7b'));return respondWithRpcPromise(_0xe1a0('0x7c'),_0xe1a0('0x7d'),_0x225626);}return null;})[_0xe1a0('0x1d')](function(_0x2510ce){var _0xd7cda2=_0xe1a0('0x6a')+_0x2510ce[_0xe1a0('0x25')][_0xe1a0('0x6b')];return db[_0xe1a0('0x6c')][_0xe1a0('0x3c')](_0xd7cda2,{'type':db[_0xe1a0('0x6d')][_0xe1a0('0x6e')][_0xe1a0('0x6f')],'raw':!![]})[_0xe1a0('0x1d')](function(_0x916bd2){return _0x916bd2;});})[_0xe1a0('0x1d')](function(_0x11ba98){if(_0x11ba98){_0x225626[_0xe1a0('0x25')]['contact']=_0x11ba98[0x0];if(!_0xc57590[_0xe1a0('0x53')][_0xe1a0('0x5f')])return;return db[_0xe1a0('0x70')][_0xe1a0('0x55')]({'where':{'id':_0xc57590[_0xe1a0('0x53')]['UserId'],'role':'agent'},'attributes':['id','name',_0xe1a0('0x7e'),_0xe1a0('0x71'),'internal'],'raw':!![]});}return null;})[_0xe1a0('0x1d')](function(_0x1162d6){if(!_0x1162d6)return null;_0x225626[_0xe1a0('0x25')][_0xe1a0('0x73')]=_0x1162d6;return _0x225626;})[_0xe1a0('0x1d')](function(_0x547049){if(_0x547049){_0x547049[_0xe1a0('0x25')][_0xe1a0('0x75')]=util['format'](_0xe1a0('0x7f'),_0xc57590[_0xe1a0('0x60')]['name']);_0x547049['message']['channel']=_0x225626['channel'];_0x547049['message'][_0xe1a0('0x77')]=_0x225626['channel'];_0x547049[_0xe1a0('0x25')][_0xe1a0('0x80')]=_0xe1a0('0x31');respondWithRpcPromise(_0xe1a0('0x81'),_0xe1a0('0x81'),{'event':'rejectmessage','message':_[_0xe1a0('0x47')](_0x225626[_0xe1a0('0x25')],JSON['parse'](_0x225626['interaction'][_0xe1a0('0x82')]))},client9002);return _0x225626;}return null;})[_0xe1a0('0x1d')](respondWithResult(_0x27c6ba,null))[_0xe1a0('0x27')](handleError(_0x27c6ba,null));};
\ No newline at end of file
+var _0x78dc=['update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','params','keys','create','body','find','describe','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','ChatInteractionId','isNil','read1stAt','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','formData','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','jayson/promise','client','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x78dc,0x1d8));var _0xc78d=function(_0x3f465d,_0xbd2037){_0x3f465d=_0x3f465d-0x0;var _0x121ad1=_0x78dc[_0x3f465d];return _0x121ad1;};'use strict';var emlformat=require(_0xc78d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc78d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc78d('0x2'));var moment=require('moment');var BPromise=require(_0xc78d('0x3'));var Mustache=require(_0xc78d('0x4'));var util=require(_0xc78d('0x5'));var path=require(_0xc78d('0x6'));var sox=require(_0xc78d('0x7'));var csv=require(_0xc78d('0x8'));var ejs=require(_0xc78d('0x9'));var fs=require('fs');var fs_extra=require(_0xc78d('0xa'));var _=require(_0xc78d('0xb'));var squel=require(_0xc78d('0xc'));var crypto=require('crypto');var jsforce=require(_0xc78d('0xd'));var deskjs=require(_0xc78d('0xe'));var toCsv=require(_0xc78d('0x8'));var querystring=require(_0xc78d('0xf'));var Papa=require(_0xc78d('0x10'));var Redis=require(_0xc78d('0x11'));var authService=require(_0xc78d('0x12'));var qs=require(_0xc78d('0x13'));var as=require(_0xc78d('0x14'));var hardwareService=require(_0xc78d('0x15'));var logger=require(_0xc78d('0x16'))(_0xc78d('0x17'));var utils=require(_0xc78d('0x18'));var config=require(_0xc78d('0x19'));var licenseUtil=require(_0xc78d('0x1a'));var db=require(_0xc78d('0x1b'))['db'];config[_0xc78d('0x1c')]=_[_0xc78d('0x1d')](config[_0xc78d('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xc78d('0x1e'))(new Redis(config[_0xc78d('0x1c')]));require(_0xc78d('0x1f'))['register'](socket);var jayson=require(_0xc78d('0x20'));var client=jayson[_0xc78d('0x21')]['http']({'port':0x232c});var client9002=jayson[_0xc78d('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ef92e,_0x4e09f5,_0x3b3aa1,_0x3edd4a){return new BPromise(function(_0x38f8f7,_0x237d0d){var _0x1e2451=_0x3edd4a||client;return _0x1e2451[_0xc78d('0x22')](_0x4ef92e,_0x3b3aa1)[_0xc78d('0x23')](function(_0x487981){logger['info'](_0xc78d('0x24'),_0x4e09f5,_0xc78d('0x25'));logger['debug'](_0xc78d('0x26'),_0x4e09f5,'request\x20sent',JSON['stringify'](_0x487981));if(_0x487981['error']){if(_0x487981[_0xc78d('0x27')][_0xc78d('0x28')]===0x1f4){logger['error'](_0xc78d('0x24'),_0x4e09f5,_0x487981[_0xc78d('0x27')][_0xc78d('0x29')]);return _0x237d0d(_0x487981[_0xc78d('0x27')]['message']);}logger['error'](_0xc78d('0x24'),_0x4e09f5,_0x487981[_0xc78d('0x27')]['message']);return _0x38f8f7(_0x487981[_0xc78d('0x27')]['message']);}else{logger[_0xc78d('0x2a')](_0xc78d('0x24'),_0x4e09f5,'request\x20sent');_0x38f8f7(_0x487981['result']['message']);}})[_0xc78d('0x2b')](function(_0x37e1ec){logger[_0xc78d('0x27')]('ChatMessage,\x20%s,\x20%s',_0x4e09f5,_0x37e1ec);_0x237d0d(_0x37e1ec);});});}function respondWithStatusCode(_0xf5c761,_0x28bd44){_0x28bd44=_0x28bd44||0xcc;return function(_0x405f84){if(_0x405f84){return _0xf5c761[_0xc78d('0x2c')](_0x28bd44);}return _0xf5c761['status'](_0x28bd44)[_0xc78d('0x2d')]();};}function respondWithResult(_0x335e17,_0x5ae193){_0x5ae193=_0x5ae193||0xc8;return function(_0x24e104){if(_0x24e104){return _0x335e17[_0xc78d('0x2e')](_0x5ae193)['json'](_0x24e104);}};}function respondWithFilteredResult(_0x1f282c,_0x43c890){return function(_0x5859c1){if(_0x5859c1){var _0xc5dd4e=typeof _0x43c890[_0xc78d('0x2f')]===_0xc78d('0x30')&&typeof _0x43c890[_0xc78d('0x31')]===_0xc78d('0x30');var _0x1c2fb2=_0x5859c1[_0xc78d('0x32')];var _0x5d6d79=_0xc5dd4e?0x0:_0x43c890['offset'];var _0x17f30e=_0xc5dd4e?_0x5859c1[_0xc78d('0x32')]:_0x43c890['offset']+_0x43c890['limit'];var _0x68a9ba;if(_0x17f30e>=_0x1c2fb2){_0x17f30e=_0x1c2fb2;_0x68a9ba=0xc8;}else{_0x68a9ba=0xce;}_0x1f282c['status'](_0x68a9ba);return _0x1f282c[_0xc78d('0x33')](_0xc78d('0x34'),_0x5d6d79+'-'+_0x17f30e+'/'+_0x1c2fb2)[_0xc78d('0x35')](_0x5859c1);}return null;};}function patchUpdates(_0x530d96){return function(_0x335d74){try{jsonpatch[_0xc78d('0x36')](_0x335d74,_0x530d96,!![]);}catch(_0x12966b){return BPromise[_0xc78d('0x37')](_0x12966b);}return _0x335d74['save']();};}function saveUpdates(_0x42a5ca,_0x237533){return function(_0xccc351){if(_0xccc351){return _0xccc351[_0xc78d('0x38')](_0x42a5ca)[_0xc78d('0x23')](function(_0x35fc80){return _0x35fc80;});}return null;};}function removeEntity(_0x17fe43,_0x1c2a0b){return function(_0x5b7545){if(_0x5b7545){return _0x5b7545[_0xc78d('0x39')]()[_0xc78d('0x23')](function(){_0x17fe43[_0xc78d('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54e856,_0x4adb37){return function(_0x38e763){if(!_0x38e763){_0x54e856[_0xc78d('0x2c')](0x194);}return _0x38e763;};}function handleError(_0x523478,_0x4b422e){_0x4b422e=_0x4b422e||0x1f4;return function(_0x2a6f72){logger['error'](_0x2a6f72[_0xc78d('0x3a')]);if(_0x2a6f72[_0xc78d('0x3b')]){delete _0x2a6f72['name'];}_0x523478['status'](_0x4b422e)[_0xc78d('0x3c')](_0x2a6f72);};}exports[_0xc78d('0x3d')]=function(_0x15d436,_0x53beed){var _0x121ddd={},_0x2df4ed={},_0xf25c2d={'count':0x0,'rows':[]};var _0x3f6e48=_[_0xc78d('0x3e')](db[_0xc78d('0x3f')][_0xc78d('0x40')],function(_0x135a52){return{'name':_0x135a52[_0xc78d('0x41')],'type':_0x135a52[_0xc78d('0x42')]['key']};});_0x2df4ed[_0xc78d('0x43')]=_['map'](_0x3f6e48,_0xc78d('0x3b'));_0x2df4ed[_0xc78d('0x44')]=_['keys'](_0x15d436[_0xc78d('0x44')]);_0x2df4ed['filters']=_[_0xc78d('0x45')](_0x2df4ed[_0xc78d('0x43')],_0x2df4ed['query']);_0x121ddd[_0xc78d('0x46')]=_[_0xc78d('0x45')](_0x2df4ed['model'],qs['fields'](_0x15d436['query'][_0xc78d('0x47')]));_0x121ddd['attributes']=_0x121ddd[_0xc78d('0x46')][_0xc78d('0x48')]?_0x121ddd[_0xc78d('0x46')]:_0x2df4ed[_0xc78d('0x43')];if(!_0x15d436[_0xc78d('0x44')][_0xc78d('0x49')](_0xc78d('0x4a'))){_0x121ddd['limit']=qs[_0xc78d('0x31')](_0x15d436[_0xc78d('0x44')][_0xc78d('0x31')]);_0x121ddd[_0xc78d('0x2f')]=qs[_0xc78d('0x2f')](_0x15d436[_0xc78d('0x44')]['offset']);}_0x121ddd[_0xc78d('0x4b')]=qs[_0xc78d('0x4c')](_0x15d436[_0xc78d('0x44')][_0xc78d('0x4c')]);_0x121ddd[_0xc78d('0x4d')]=qs[_0xc78d('0x4e')](_[_0xc78d('0x4f')](_0x15d436[_0xc78d('0x44')],_0x2df4ed[_0xc78d('0x4e')]),_0x3f6e48);if(_0x15d436[_0xc78d('0x44')][_0xc78d('0x50')]){_0x121ddd[_0xc78d('0x4d')]=_['merge'](_0x121ddd[_0xc78d('0x4d')],{'$or':_[_0xc78d('0x3e')](_0x3f6e48,function(_0x2e0ffc){if(_0x2e0ffc['type']!=='VIRTUAL'){var _0x5628d0={};_0x5628d0[_0x2e0ffc[_0xc78d('0x3b')]]={'$like':'%'+_0x15d436['query']['filter']+'%'};return _0x5628d0;}})});}_0x121ddd=_[_0xc78d('0x51')]({},_0x121ddd,_0x15d436['options']);var _0x32dbb8={'where':_0x121ddd['where']};return db['ChatMessage'][_0xc78d('0x32')](_0x32dbb8)['then'](function(_0x576f85){_0xf25c2d[_0xc78d('0x32')]=_0x576f85;if(_0x15d436[_0xc78d('0x44')][_0xc78d('0x52')]){_0x121ddd[_0xc78d('0x53')]=[{'all':!![]}];}return db[_0xc78d('0x3f')]['findAll'](_0x121ddd);})['then'](function(_0x2e0280){_0xf25c2d['rows']=_0x2e0280;return _0xf25c2d;})['then'](respondWithFilteredResult(_0x53beed,_0x121ddd))[_0xc78d('0x2b')](handleError(_0x53beed,null));};exports['show']=function(_0x354a50,_0x49b403){var _0x18d5a5={'raw':!![],'where':{'id':_0x354a50[_0xc78d('0x54')]['id']}},_0x20888={};_0x20888['model']=_[_0xc78d('0x55')](db[_0xc78d('0x3f')]['rawAttributes']);_0x20888['query']=_[_0xc78d('0x55')](_0x354a50[_0xc78d('0x44')]);_0x20888['filters']=_[_0xc78d('0x45')](_0x20888[_0xc78d('0x43')],_0x20888['query']);_0x18d5a5[_0xc78d('0x46')]=_[_0xc78d('0x45')](_0x20888[_0xc78d('0x43')],qs[_0xc78d('0x47')](_0x354a50[_0xc78d('0x44')]['fields']));_0x18d5a5[_0xc78d('0x46')]=_0x18d5a5[_0xc78d('0x46')][_0xc78d('0x48')]?_0x18d5a5[_0xc78d('0x46')]:_0x20888[_0xc78d('0x43')];if(_0x354a50[_0xc78d('0x44')][_0xc78d('0x52')]){_0x18d5a5[_0xc78d('0x53')]=[{'all':!![]}];}_0x18d5a5=_['merge']({},_0x18d5a5,_0x354a50['options']);return db[_0xc78d('0x3f')]['find'](_0x18d5a5)['then'](handleEntityNotFound(_0x49b403,null))[_0xc78d('0x23')](respondWithResult(_0x49b403,null))['catch'](handleError(_0x49b403,null));};exports[_0xc78d('0x56')]=function(_0x25a61e,_0x400e3d){return db[_0xc78d('0x3f')][_0xc78d('0x56')](_0x25a61e[_0xc78d('0x57')],{})[_0xc78d('0x23')](respondWithResult(_0x400e3d,0xc9))[_0xc78d('0x2b')](handleError(_0x400e3d,null));};exports[_0xc78d('0x38')]=function(_0x461b1f,_0xe112cb){if(_0x461b1f[_0xc78d('0x57')]['id']){delete _0x461b1f[_0xc78d('0x57')]['id'];}return db[_0xc78d('0x3f')][_0xc78d('0x58')]({'where':{'id':_0x461b1f[_0xc78d('0x54')]['id']}})[_0xc78d('0x23')](handleEntityNotFound(_0xe112cb,null))[_0xc78d('0x23')](saveUpdates(_0x461b1f[_0xc78d('0x57')],null))[_0xc78d('0x23')](respondWithResult(_0xe112cb,null))['catch'](handleError(_0xe112cb,null));};exports[_0xc78d('0x39')]=function(_0x2d7e1b,_0x4ecac){return db[_0xc78d('0x3f')][_0xc78d('0x58')]({'where':{'id':_0x2d7e1b['params']['id']}})[_0xc78d('0x23')](handleEntityNotFound(_0x4ecac,null))[_0xc78d('0x23')](removeEntity(_0x4ecac,null))[_0xc78d('0x2b')](handleError(_0x4ecac,null));};exports[_0xc78d('0x59')]=function(_0x3b0e07,_0x765cef){return db[_0xc78d('0x3f')][_0xc78d('0x59')]()[_0xc78d('0x23')](respondWithResult(_0x765cef,null))[_0xc78d('0x2b')](handleError(_0x765cef,null));};var interaction_log=require(_0xc78d('0x16'))('chat-interactions');exports['accept']=function(_0x192bdd,_0x4875db,_0x5003c6){var _0x433937={'agent':{},'channel':_0xc78d('0x5a')};if(_0x192bdd[_0xc78d('0x57')]['id']){delete _0x192bdd['body']['id'];}_0x192bdd['body'][_0xc78d('0x5b')]=!![];_0x192bdd['body'][_0xc78d('0x5c')]=moment()[_0xc78d('0x5d')](_0xc78d('0x5e'));_0x192bdd[_0xc78d('0x57')][_0xc78d('0x5f')]=_0x192bdd[_0xc78d('0x57')][_0xc78d('0x5f')]||_0x192bdd[_0xc78d('0x60')]['id'];_0x433937[_0xc78d('0x61')]['id']=_0x192bdd[_0xc78d('0x57')][_0xc78d('0x5f')];return db[_0xc78d('0x3f')]['find']({'where':{'id':_0x192bdd[_0xc78d('0x54')]['id'],'UserId':null}})[_0xc78d('0x23')](handleEntityNotFound(_0x4875db,null))[_0xc78d('0x23')](saveUpdates(_0x192bdd[_0xc78d('0x57')],null))[_0xc78d('0x23')](function(_0x41e46f){if(_0x41e46f){_0x433937['message']=_0x41e46f['get']({'plain':!![]});return db[_0xc78d('0x62')][_0xc78d('0x58')]({'where':{'id':_0x41e46f[_0xc78d('0x63')]}});}return null;})[_0xc78d('0x23')](handleEntityNotFound(_0x4875db,null))[_0xc78d('0x23')](function(_0x4e9dcc){if(_0x4e9dcc){return _0x4e9dcc[_0xc78d('0x38')]({'UserId':_0x192bdd['body'][_0xc78d('0x5f')],'read1stAt':_[_0xc78d('0x64')](_0x4e9dcc[_0xc78d('0x65')])?moment()[_0xc78d('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc78d('0x23')](function(_0x4c2afd){if(_0x4c2afd){_0x433937['interaction']=_0x4c2afd[_0xc78d('0x66')]({'plain':!![]});interaction_log[_0xc78d('0x2a')](_0xc78d('0x67'),_0x192bdd[_0xc78d('0x60')]['id'],_0x192bdd[_0xc78d('0x60')][_0xc78d('0x3b')],_0x192bdd[_0xc78d('0x60')][_0xc78d('0x68')],_0x433937[_0xc78d('0x69')]['id'],_0x192bdd[_0xc78d('0x57')]?JSON[_0xc78d('0x6a')](_0x192bdd['body']):_0xc78d('0x6b'));return respondWithRpcPromise(_0xc78d('0x6c'),'acceptMessage',_0x433937);}return null;})[_0xc78d('0x23')](function(_0xaa4aac){var _0x41b302='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xaa4aac[_0xc78d('0x29')][_0xc78d('0x6d')];return db[_0xc78d('0x6e')][_0xc78d('0x44')](_0x41b302,{'type':db[_0xc78d('0x6f')][_0xc78d('0x70')][_0xc78d('0x71')],'raw':!![]})[_0xc78d('0x23')](function(_0x4840a7){return _0x4840a7;});})[_0xc78d('0x23')](function(_0x94e296){if(_0x94e296){_0x433937[_0xc78d('0x29')][_0xc78d('0x72')]=_0x94e296[0x0];if(!_0x192bdd[_0xc78d('0x57')][_0xc78d('0x5f')])return;return db[_0xc78d('0x73')]['find']({'where':{'id':_0x192bdd['body']['UserId'],'role':_0xc78d('0x61')},'attributes':['id',_0xc78d('0x3b'),_0xc78d('0x74'),_0xc78d('0x75'),_0xc78d('0x76')],'raw':!![]});}return null;})[_0xc78d('0x23')](function(_0x4f1f1f){if(!_0x4f1f1f)return null;_0x433937[_0xc78d('0x29')][_0xc78d('0x61')]=_0x4f1f1f;return _0x433937;})[_0xc78d('0x23')](function(_0x173737){if(_0x173737){if(_0x192bdd['body'][_0xc78d('0x77')]){_0x433937[_0xc78d('0x29')][_0xc78d('0x78')]=util['format'](_0xc78d('0x79'),_0x192bdd[_0xc78d('0x60')][_0xc78d('0x3b')]);_0x433937[_0xc78d('0x29')]['channel']=_0x433937[_0xc78d('0x7a')];_0x433937[_0xc78d('0x29')][_0xc78d('0x7b')]=_0x433937[_0xc78d('0x7a')];_0x433937['message'][_0xc78d('0x7c')]=_0xc78d('0x7d');return respondWithRpcPromise(_0xc78d('0x7e'),'EventManager',{'event':_0xc78d('0x7f'),'message':_[_0xc78d('0x51')](_0x433937['message'],JSON[_0xc78d('0x80')](_0x433937[_0xc78d('0x69')]['formData']))},client9002)[_0xc78d('0x23')](function(){return _0x433937;});}return _0x433937;}return null;})['then'](respondWithResult(_0x4875db,null))[_0xc78d('0x2b')](handleError(_0x4875db,null));};var interaction_log=require(_0xc78d('0x16'))('chat-interactions');exports[_0xc78d('0x37')]=function(_0x6d0717,_0x3a62aa,_0x4b0361){var _0x3f94ed={'agent':{},'channel':'chat'};if(_0x6d0717[_0xc78d('0x57')]['id']){delete _0x6d0717['body']['id'];}_0x6d0717['body'][_0xc78d('0x5f')]=_0x6d0717[_0xc78d('0x57')][_0xc78d('0x5f')]||_0x6d0717[_0xc78d('0x60')]['id'];_0x3f94ed['agent']['id']=_0x6d0717[_0xc78d('0x57')][_0xc78d('0x5f')];return db[_0xc78d('0x3f')][_0xc78d('0x58')]({'where':{'id':_0x6d0717['params']['id'],'UserId':null}})[_0xc78d('0x23')](handleEntityNotFound(_0x3a62aa,null))[_0xc78d('0x23')](function(_0x4bdddf){if(_0x4bdddf){_0x3f94ed[_0xc78d('0x29')]=_0x4bdddf[_0xc78d('0x66')]({'plain':!![]});return db[_0xc78d('0x62')][_0xc78d('0x58')]({'where':{'id':_0x4bdddf[_0xc78d('0x63')]}});}return null;})[_0xc78d('0x23')](handleEntityNotFound(_0x3a62aa,null))[_0xc78d('0x23')](function(_0x38f38f){if(_0x38f38f){_0x3f94ed['interaction']=_0x38f38f[_0xc78d('0x66')]({'plain':!![]});interaction_log['info'](_0xc78d('0x81'),_0x6d0717[_0xc78d('0x60')]['id'],_0x6d0717[_0xc78d('0x60')]['name'],_0x6d0717[_0xc78d('0x60')][_0xc78d('0x68')],_0x3f94ed[_0xc78d('0x69')]['id'],_0x6d0717[_0xc78d('0x57')]?JSON['stringify'](_0x6d0717['body']):_0xc78d('0x6b'));return respondWithRpcPromise(_0xc78d('0x82'),'rejectMessage',_0x3f94ed);}return null;})[_0xc78d('0x23')](function(_0x35437e){var _0x40ac03='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x35437e[_0xc78d('0x29')]['ContactId'];return db['sequelize'][_0xc78d('0x44')](_0x40ac03,{'type':db['Sequelize'][_0xc78d('0x70')][_0xc78d('0x71')],'raw':!![]})[_0xc78d('0x23')](function(_0x5164c0){return _0x5164c0;});})[_0xc78d('0x23')](function(_0x24cddb){if(_0x24cddb){_0x3f94ed['message']['contact']=_0x24cddb[0x0];if(!_0x6d0717[_0xc78d('0x57')][_0xc78d('0x5f')])return;return db[_0xc78d('0x73')][_0xc78d('0x58')]({'where':{'id':_0x6d0717[_0xc78d('0x57')][_0xc78d('0x5f')],'role':'agent'},'attributes':['id',_0xc78d('0x3b'),_0xc78d('0x74'),_0xc78d('0x75'),_0xc78d('0x76')],'raw':!![]});}return null;})['then'](function(_0x12a238){if(!_0x12a238)return null;_0x3f94ed[_0xc78d('0x29')][_0xc78d('0x61')]=_0x12a238;return _0x3f94ed;})[_0xc78d('0x23')](function(_0x4099b0){if(_0x4099b0){_0x4099b0[_0xc78d('0x29')]['interface']=util[_0xc78d('0x5d')](_0xc78d('0x79'),_0x6d0717[_0xc78d('0x60')][_0xc78d('0x3b')]);_0x4099b0[_0xc78d('0x29')]['channel']=_0x3f94ed['channel'];_0x4099b0[_0xc78d('0x29')][_0xc78d('0x7b')]=_0x3f94ed[_0xc78d('0x7a')];_0x4099b0[_0xc78d('0x29')][_0xc78d('0x7c')]=_0xc78d('0x37');respondWithRpcPromise('EventManager',_0xc78d('0x7e'),{'event':'rejectmessage','message':_[_0xc78d('0x51')](_0x3f94ed[_0xc78d('0x29')],JSON[_0xc78d('0x80')](_0x3f94ed[_0xc78d('0x69')][_0xc78d('0x83')]))},client9002);return _0x3f94ed;}return null;})[_0xc78d('0x23')](respondWithResult(_0x3a62aa,null))[_0xc78d('0x2b')](handleError(_0x3a62aa,null));};
\ No newline at end of file
index 63dd2cf..0be446a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7b83=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7b83,0x1e1));var _0x37b8=function(_0x297b46,_0xdb64ac){_0x297b46=_0x297b46-0x0;var _0xf7342b=_0x7b83[_0x297b46];return _0xf7342b;};'use strict';var EventEmitter=require(_0x37b8('0x0'));var ChatMessage=require(_0x37b8('0x1'))['db'][_0x37b8('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x37b8('0x3')](0x0);var events={'afterCreate':_0x37b8('0x4'),'afterUpdate':'update','afterDestroy':_0x37b8('0x5')};function emitEvent(_0x21fa99){return function(_0x196289,_0x13fc31,_0x966301){ChatMessageEvents[_0x37b8('0x6')](_0x21fa99+':'+_0x196289['id'],_0x196289);ChatMessageEvents['emit'](_0x21fa99,_0x196289);_0x966301(null);};}for(var e in events){if(events[_0x37b8('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x37b8('0x8')]=ChatMessageEvents;
\ No newline at end of file
+var _0x0d6e=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x1fa4ed,_0xc9a39a){var _0x3f0ee4=function(_0x568391){while(--_0x568391){_0x1fa4ed['push'](_0x1fa4ed['shift']());}};_0x3f0ee4(++_0xc9a39a);}(_0x0d6e,0xf0));var _0xe0d6=function(_0x22de09,_0x27b16b){_0x22de09=_0x22de09-0x0;var _0x4e07d1=_0x0d6e[_0x22de09];return _0x4e07d1;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xe0d6('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xe0d6('0x1')](0x0);var events={'afterCreate':_0xe0d6('0x2'),'afterUpdate':_0xe0d6('0x3'),'afterDestroy':_0xe0d6('0x4')};function emitEvent(_0x15a81d){return function(_0x375b32,_0x19e430,_0x5ae415){ChatMessageEvents['emit'](_0x15a81d+':'+_0x375b32['id'],_0x375b32);ChatMessageEvents[_0xe0d6('0x5')](_0x15a81d,_0x375b32);_0x5ae415(null);};}for(var e in events){if(events[_0xe0d6('0x6')](e)){var event=events[e];ChatMessage[_0xe0d6('0x7')](e,emitEvent(event));}}module[_0xe0d6('0x8')]=ChatMessageEvents;
\ No newline at end of file
index 59fe667..a464637 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb3bf=['ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define'];(function(_0x200827,_0x4af951){var _0x120047=function(_0x4431de){while(--_0x4431de){_0x200827['push'](_0x200827['shift']());}};_0x120047(++_0x4af951);}(_0xb3bf,0x135));var _0xfb3b=function(_0x96c538,_0xc5e208){_0x96c538=_0x96c538-0x0;var _0x38f9d3=_0xb3bf[_0x96c538];return _0x38f9d3;};'use strict';var _=require('lodash');var util=require(_0xfb3b('0x0'));var logger=require(_0xfb3b('0x1'))('api');var moment=require(_0xfb3b('0x2'));var BPromise=require(_0xfb3b('0x3'));var rp=require(_0xfb3b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb3b('0x5'));var config=require(_0xfb3b('0x6'));var attributes=require(_0xfb3b('0x7'));module[_0xfb3b('0x8')]=function(_0x1046e8,_0x18cded){return _0x1046e8[_0xfb3b('0x9')](_0xfb3b('0xa'),attributes,{'tableName':_0xfb3b('0xb'),'paranoid':![],'indexes':[{'name':_0xfb3b('0xc'),'fields':['body'],'type':_0xfb3b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5787fd,_0x5538d7,_0x5eca78){var _0x555706=_0x1046e8[_0xfb3b('0xe')];var _0x480395=_0x5787fd[_0xfb3b('0xf')]({'plain':!![]});if(_0x480395[_0xfb3b('0x10')]['toLowerCase']()==='in'||_0x480395[_0xfb3b('0x10')][_0xfb3b('0x11')]()===_0xfb3b('0x12')&&!_0x480395[_0xfb3b('0x13')]&&!_[_0xfb3b('0x14')](_0x480395[_0xfb3b('0x15')])){_0x555706['ChatInteraction'][_0xfb3b('0x16')]({'where':{'id':_0x480395['ChatInteractionId']}})[_0xfb3b('0x17')](function(_0x4630f1){if(_0x4630f1){_0x4630f1[_0xfb3b('0x18')]({'lastMsgAt':_0x480395[_0xfb3b('0x19')],'lastMsgDirection':_0x480395[_0xfb3b('0x10')][_0xfb3b('0x11')]()});}})[_0xfb3b('0x1a')](function(_0x5c8789){console[_0xfb3b('0x1b')](_0x5c8789);});}_0x5eca78();}},'charset':_0xfb3b('0x1c'),'collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0x780c=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util'];(function(_0x338264,_0x2130dc){var _0x47118a=function(_0x488811){while(--_0x488811){_0x338264['push'](_0x338264['shift']());}};_0x47118a(++_0x2130dc);}(_0x780c,0x72));var _0xc780=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x780c[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xc780('0x0'));var util=require(_0xc780('0x1'));var logger=require(_0xc780('0x2'))(_0xc780('0x3'));var moment=require(_0xc780('0x4'));var BPromise=require('bluebird');var rp=require(_0xc780('0x5'));var fs=require('fs');var path=require(_0xc780('0x6'));var rimraf=require(_0xc780('0x7'));var config=require(_0xc780('0x8'));var attributes=require(_0xc780('0x9'));module[_0xc780('0xa')]=function(_0x1f4260,_0xc0ad98){return _0x1f4260[_0xc780('0xb')](_0xc780('0xc'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xc780('0xd'),'fields':[_0xc780('0xe')],'type':_0xc780('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xcf7be6,_0x10541a,_0xb0d3d7){var _0x34f1e8=_0x1f4260['models'];var _0x4c697f=_0xcf7be6[_0xc780('0x10')]({'plain':!![]});if(_0x4c697f[_0xc780('0x11')][_0xc780('0x12')]()==='in'||_0x4c697f['direction'][_0xc780('0x12')]()==='out'&&!_0x4c697f[_0xc780('0x13')]&&!_[_0xc780('0x14')](_0x4c697f[_0xc780('0x15')])){_0x34f1e8[_0xc780('0x16')][_0xc780('0x17')]({'where':{'id':_0x4c697f['ChatInteractionId']}})[_0xc780('0x18')](function(_0x429ae4){if(_0x429ae4){_0x429ae4[_0xc780('0x19')]({'lastMsgAt':_0x4c697f[_0xc780('0x1a')],'lastMsgDirection':_0x4c697f[_0xc780('0x11')][_0xc780('0x12')]()});}})[_0xc780('0x1b')](function(_0x181e38){console['error'](_0x181e38);});}_0xb0d3d7();}},'charset':'utf8mb4','collate':_0xc780('0x1c')});};
\ No newline at end of file
index 3ce4661..209eea1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8be6=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','debug','lodash'];(function(_0x54fa12,_0x5c4ae9){var _0x3466e9=function(_0x99a9a7){while(--_0x99a9a7){_0x54fa12['push'](_0x54fa12['shift']());}};_0x3466e9(++_0x5c4ae9);}(_0x8be6,0xa4));var _0x68be=function(_0x3780df,_0x4edd12){_0x3780df=_0x3780df-0x0;var _0x1e8f2a=_0x8be6[_0x3780df];return _0x1e8f2a;};'use strict';var _=require(_0x68be('0x0'));var util=require('util');var moment=require(_0x68be('0x1'));var BPromise=require('bluebird');var rs=require(_0x68be('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68be('0x3'))['db'];var utils=require(_0x68be('0x4'));var logger=require(_0x68be('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x68be('0x6'));var client=jayson[_0x68be('0x7')][_0x68be('0x8')]({'port':0x232a});config[_0x68be('0x9')]=_[_0x68be('0xa')](config[_0x68be('0x9')],{'host':_0x68be('0xb'),'port':0x18eb});var socket=require(_0x68be('0xc'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x68be('0xd')](socket);function respondWithRpcPromise(_0x2c02ba,_0x4252a4,_0x5a7192){return new BPromise(function(_0x113e38,_0xdbc657){return client[_0x68be('0xe')](_0x2c02ba,_0x5a7192)['then'](function(_0x523850){logger[_0x68be('0xf')](_0x68be('0x10'),_0x4252a4,_0x68be('0x11'));logger['debug'](_0x68be('0x12'),_0x4252a4,_0x68be('0x11'),JSON[_0x68be('0x13')](_0x523850));if(_0x523850[_0x68be('0x14')]){if(_0x523850[_0x68be('0x14')][_0x68be('0x15')]===0x1f4){logger[_0x68be('0x14')](_0x68be('0x10'),_0x4252a4,_0x523850[_0x68be('0x14')][_0x68be('0x16')]);return _0xdbc657(_0x523850[_0x68be('0x14')]['message']);}logger['error'](_0x68be('0x10'),_0x4252a4,_0x523850[_0x68be('0x14')][_0x68be('0x16')]);return _0x113e38(_0x523850[_0x68be('0x14')]['message']);}else{logger[_0x68be('0xf')](_0x68be('0x10'),_0x4252a4,_0x68be('0x11'));_0x113e38(_0x523850[_0x68be('0x17')][_0x68be('0x16')]);}})[_0x68be('0x18')](function(_0x5da787){logger[_0x68be('0x14')](_0x68be('0x10'),_0x4252a4,_0x5da787);_0xdbc657(_0x5da787);});});}exports[_0x68be('0x19')]=function(_0x2ff259){var _0x2aaa99=this;return new Promise(function(_0x38cf09,_0x2fe21e){return db[_0x68be('0x1a')][_0x68be('0x1b')](_0x2ff259[_0x68be('0x1c')],{'raw':_0x2ff259['options']?_0x2ff259[_0x68be('0x1d')][_0x68be('0x1e')]===undefined?!![]:![]:!![]})[_0x68be('0x1f')](function(_0x27b7fa){logger[_0x68be('0xf')]('CreateChatMessage',_0x2ff259);logger[_0x68be('0x20')](_0x68be('0x19'),_0x2ff259,JSON['stringify'](_0x27b7fa));_0x38cf09(_0x27b7fa);})[_0x68be('0x18')](function(_0x2ef7ec){logger[_0x68be('0x14')](_0x68be('0x19'),_0x2ef7ec[_0x68be('0x16')],_0x2ff259);_0x2fe21e(_0x2aaa99[_0x68be('0x14')](0x1f4,_0x2ef7ec[_0x68be('0x16')]));});});};
\ No newline at end of file
+var _0xcfd2=['jayson/promise','client','http','redis','defaults','localhost','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0xcfd2,0x1e7));var _0x2cfd=function(_0x2ca44c,_0x3a5cbe){_0x2ca44c=_0x2ca44c-0x0;var _0x45c118=_0xcfd2[_0x2ca44c];return _0x45c118;};'use strict';var _=require(_0x2cfd('0x0'));var util=require('util');var moment=require(_0x2cfd('0x1'));var BPromise=require('bluebird');var rs=require(_0x2cfd('0x2'));var fs=require('fs');var Redis=require(_0x2cfd('0x3'));var db=require(_0x2cfd('0x4'))['db'];var utils=require(_0x2cfd('0x5'));var logger=require('../../config/logger')(_0x2cfd('0x6'));var config=require(_0x2cfd('0x7'));var jayson=require(_0x2cfd('0x8'));var client=jayson[_0x2cfd('0x9')][_0x2cfd('0xa')]({'port':0x232a});config[_0x2cfd('0xb')]=_[_0x2cfd('0xc')](config[_0x2cfd('0xb')],{'host':_0x2cfd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2cfd('0xb')]));require(_0x2cfd('0xe'))[_0x2cfd('0xf')](socket);function respondWithRpcPromise(_0x2e87dd,_0x57fd1c,_0x3ef6f8){return new BPromise(function(_0x2bbdcf,_0x3899a4){return client['request'](_0x2e87dd,_0x3ef6f8)[_0x2cfd('0x10')](function(_0x535970){logger[_0x2cfd('0x11')](_0x2cfd('0x12'),_0x57fd1c,_0x2cfd('0x13'));logger[_0x2cfd('0x14')](_0x2cfd('0x15'),_0x57fd1c,_0x2cfd('0x13'),JSON[_0x2cfd('0x16')](_0x535970));if(_0x535970[_0x2cfd('0x17')]){if(_0x535970[_0x2cfd('0x17')][_0x2cfd('0x18')]===0x1f4){logger[_0x2cfd('0x17')](_0x2cfd('0x12'),_0x57fd1c,_0x535970[_0x2cfd('0x17')][_0x2cfd('0x19')]);return _0x3899a4(_0x535970[_0x2cfd('0x17')][_0x2cfd('0x19')]);}logger[_0x2cfd('0x17')]('ChatMessage,\x20%s,\x20%s',_0x57fd1c,_0x535970[_0x2cfd('0x17')][_0x2cfd('0x19')]);return _0x2bbdcf(_0x535970[_0x2cfd('0x17')]['message']);}else{logger[_0x2cfd('0x11')](_0x2cfd('0x12'),_0x57fd1c,_0x2cfd('0x13'));_0x2bbdcf(_0x535970[_0x2cfd('0x1a')][_0x2cfd('0x19')]);}})[_0x2cfd('0x1b')](function(_0x1a1358){logger[_0x2cfd('0x17')](_0x2cfd('0x12'),_0x57fd1c,_0x1a1358);_0x3899a4(_0x1a1358);});});}exports[_0x2cfd('0x1c')]=function(_0x2559cb){var _0x127636=this;return new Promise(function(_0x319c66,_0x4352a7){return db[_0x2cfd('0x1d')][_0x2cfd('0x1e')](_0x2559cb[_0x2cfd('0x1f')],{'raw':_0x2559cb[_0x2cfd('0x20')]?_0x2559cb[_0x2cfd('0x20')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x22cbb0){logger['info'](_0x2cfd('0x1c'),_0x2559cb);logger['debug'](_0x2cfd('0x1c'),_0x2559cb,JSON[_0x2cfd('0x16')](_0x22cbb0));_0x319c66(_0x22cbb0);})[_0x2cfd('0x1b')](function(_0x360914){logger[_0x2cfd('0x17')](_0x2cfd('0x1c'),_0x360914[_0x2cfd('0x19')],_0x2559cb);_0x4352a7(_0x127636[_0x2cfd('0x17')](0x1f4,_0x360914[_0x2cfd('0x19')]));});});};
\ No newline at end of file
index 4076681..c201e19 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6596=['update','emit','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x5b77b3,_0x161d77){var _0x16c027=function(_0x5b1da4){while(--_0x5b1da4){_0x5b77b3['push'](_0x5b77b3['shift']());}};_0x16c027(++_0x161d77);}(_0x6596,0x1d3));var _0x6659=function(_0x37f4c0,_0x2d79a3){_0x37f4c0=_0x37f4c0-0x0;var _0x3d11aa=_0x6596[_0x37f4c0];return _0x3d11aa;};'use strict';var ChatMessageEvents=require(_0x6659('0x0'));var events=[_0x6659('0x1'),'remove',_0x6659('0x2')];function createListener(_0x114579,_0x3b1b74){return function(_0x2c58e1){_0x3b1b74[_0x6659('0x3')](_0x114579,_0x2c58e1);};}function removeListener(_0x67ac1d,_0x4bfd3c){return function(){ChatMessageEvents['removeListener'](_0x67ac1d,_0x4bfd3c);};}exports[_0x6659('0x4')]=function(_0x3091f1){for(var _0xd6bf59=0x0,_0x1ed458=events[_0x6659('0x5')];_0xd6bf59<_0x1ed458;_0xd6bf59++){var _0x4a900d=events[_0xd6bf59];var _0x485ea0=createListener(_0x6659('0x6')+_0x4a900d,_0x3091f1);ChatMessageEvents['on'](_0x4a900d,_0x485ea0);}};
\ No newline at end of file
+var _0x50d0=['update','removeListener','register','length','chatMessage:','./chatMessage.events','remove'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x50d0,0x101));var _0x050d=function(_0x27bd0d,_0x47d42c){_0x27bd0d=_0x27bd0d-0x0;var _0x34b7d5=_0x50d0[_0x27bd0d];return _0x34b7d5;};'use strict';var ChatMessageEvents=require(_0x050d('0x0'));var events=['save',_0x050d('0x1'),_0x050d('0x2')];function createListener(_0x449ea6,_0x3a26e2){return function(_0x2d73d4){_0x3a26e2['emit'](_0x449ea6,_0x2d73d4);};}function removeListener(_0x3553e3,_0xd37556){return function(){ChatMessageEvents[_0x050d('0x3')](_0x3553e3,_0xd37556);};}exports[_0x050d('0x4')]=function(_0x3c2dbe){for(var _0x20bede=0x0,_0x348909=events[_0x050d('0x5')];_0x20bede<_0x348909;_0x20bede++){var _0x2b2faa=events[_0x20bede];var _0x516f5d=createListener(_0x050d('0x6')+_0x2b2faa,_0x3c2dbe);ChatMessageEvents['on'](_0x2b2faa,_0x516f5d);}};
\ No newline at end of file
index 4409797..cd4f159 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4f27=['put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','describe','/:id','show','post','chat','chatmessage:create'];(function(_0x2ec5b9,_0x56e0a3){var _0x10dcea=function(_0x1d403d){while(--_0x1d403d){_0x2ec5b9['push'](_0x2ec5b9['shift']());}};_0x10dcea(++_0x56e0a3);}(_0x4f27,0x126));var _0x74f2=function(_0x34e386,_0x4aa7b5){_0x34e386=_0x34e386-0x0;var _0x1de185=_0x4f27[_0x34e386];return _0x1de185;};'use strict';var multer=require(_0x74f2('0x0'));var util=require(_0x74f2('0x1'));var path=require(_0x74f2('0x2'));var timeout=require(_0x74f2('0x3'));var express=require(_0x74f2('0x4'));var router=express[_0x74f2('0x5')]();var fs_extra=require(_0x74f2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x74f2('0x7'));var config=require(_0x74f2('0x8'));var controller=require(_0x74f2('0x9'));router[_0x74f2('0xa')]('/',auth[_0x74f2('0xb')](),controller['index']);router[_0x74f2('0xa')]('/describe',auth[_0x74f2('0xb')](),controller[_0x74f2('0xc')]);router['get'](_0x74f2('0xd'),auth[_0x74f2('0xb')](),controller[_0x74f2('0xe')]);router[_0x74f2('0xf')]('/',auth[_0x74f2('0xb')](),interaction['tracked'](_0x74f2('0x10'),_0x74f2('0x11')),controller['create']);router[_0x74f2('0x12')](_0x74f2('0xd'),controller[_0x74f2('0x13')]);router[_0x74f2('0x12')](_0x74f2('0x14'),auth['isAuthenticated'](),controller[_0x74f2('0x15')]);router[_0x74f2('0x12')]('/:id/reject',auth[_0x74f2('0xb')](),controller[_0x74f2('0x16')]);router[_0x74f2('0x17')]('/:id',auth[_0x74f2('0xb')](),controller[_0x74f2('0x18')]);module[_0x74f2('0x19')]=router;
\ No newline at end of file
+var _0x6f80=['multer','util','connect-timeout','Router','fs-extra','../../config/environment','./chatMessage.controller','get','isAuthenticated','describe','show','post','tracked','chat','create','put','/:id','/:id/accept','/:id/reject','reject','delete','destroy','exports'];(function(_0xe67e22,_0x547e07){var _0x39ff12=function(_0x4496d2){while(--_0x4496d2){_0xe67e22['push'](_0xe67e22['shift']());}};_0x39ff12(++_0x547e07);}(_0x6f80,0x73));var _0x06f8=function(_0xff0854,_0x50fd52){_0xff0854=_0xff0854-0x0;var _0x12f6bf=_0x6f80[_0xff0854];return _0x12f6bf;};'use strict';var multer=require(_0x06f8('0x0'));var util=require(_0x06f8('0x1'));var path=require('path');var timeout=require(_0x06f8('0x2'));var express=require('express');var router=express[_0x06f8('0x3')]();var fs_extra=require(_0x06f8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x06f8('0x5'));var controller=require(_0x06f8('0x6'));router[_0x06f8('0x7')]('/',auth[_0x06f8('0x8')](),controller['index']);router[_0x06f8('0x7')]('/describe',auth[_0x06f8('0x8')](),controller[_0x06f8('0x9')]);router[_0x06f8('0x7')]('/:id',auth[_0x06f8('0x8')](),controller[_0x06f8('0xa')]);router[_0x06f8('0xb')]('/',auth[_0x06f8('0x8')](),interaction[_0x06f8('0xc')](_0x06f8('0xd'),'chatmessage:create'),controller[_0x06f8('0xe')]);router[_0x06f8('0xf')](_0x06f8('0x10'),controller['update']);router[_0x06f8('0xf')](_0x06f8('0x11'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x06f8('0x12'),auth[_0x06f8('0x8')](),controller[_0x06f8('0x13')]);router[_0x06f8('0x14')](_0x06f8('0x10'),auth['isAuthenticated'](),controller[_0x06f8('0x15')]);module[_0x06f8('0x16')]=router;
\ No newline at end of file
index 91975d7..4331ad5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadb5=['medium','TEXT','exports'];(function(_0x15b6b0,_0x29764f){var _0x1ca0e1=function(_0x3d6d0f){while(--_0x3d6d0f){_0x15b6b0['push'](_0x15b6b0['shift']());}};_0x1ca0e1(++_0x29764f);}(_0xadb5,0xad));var _0x5adb=function(_0x311eab,_0x22e385){_0x311eab=_0x311eab-0x0;var _0x43579e=_0xadb5[_0x311eab];return _0x43579e;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}};
\ No newline at end of file
+var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x24ebe6,_0x50d1e0){var _0x3b13f9=function(_0xa07a9b){while(--_0xa07a9b){_0x24ebe6['push'](_0x24ebe6['shift']());}};_0x3b13f9(++_0x50d1e0);}(_0xdb28,0x106));var _0x8db2=function(_0x46681,_0x27b30e){_0x46681=_0x46681-0x0;var _0x172c73=_0xdb28[_0x46681];return _0x172c73;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}};
\ No newline at end of file
index cf7ce5d..34e04b8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0xf5eaf5,_0x3120bd){var _0xb24780=function(_0x304dc2){while(--_0x304dc2){_0xf5eaf5['push'](_0xf5eaf5['shift']());}};_0xb24780(++_0x3120bd);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));};
\ No newline at end of file
+var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1e3dc0,_0xd0573e){var _0x1bc1c3=function(_0x4c2c91){while(--_0x4c2c91){_0x1e3dc0['push'](_0x1e3dc0['shift']());}};_0x1bc1c3(++_0xd0573e);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));};
\ No newline at end of file
index 45d6b34..7f1ebe7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe946=['update','remove','emit','hook','exports','../../mysqldb','ChatOfflineMessage','save'];(function(_0x10fc41,_0x54c2d6){var _0x31b127=function(_0x1708de){while(--_0x1708de){_0x10fc41['push'](_0x10fc41['shift']());}};_0x31b127(++_0x54c2d6);}(_0xe946,0x18d));var _0x6e94=function(_0x238ff3,_0x2d212e){_0x238ff3=_0x238ff3-0x0;var _0x191e86=_0xe946[_0x238ff3];return _0x191e86;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x6e94('0x0'))['db'][_0x6e94('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e94('0x2'),'afterUpdate':_0x6e94('0x3'),'afterDestroy':_0x6e94('0x4')};function emitEvent(_0x135e88){return function(_0x4be8bc,_0x2bd627,_0x4aafb1){ChatOfflineMessageEvents[_0x6e94('0x5')](_0x135e88+':'+_0x4be8bc['id'],_0x4be8bc);ChatOfflineMessageEvents[_0x6e94('0x5')](_0x135e88,_0x4be8bc);_0x4aafb1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x6e94('0x6')](e,emitEvent(event));}}module[_0x6e94('0x7')]=ChatOfflineMessageEvents;
\ No newline at end of file
+var _0xb7d8=['hasOwnProperty','hook','exports','events','../../mysqldb','save','emit'];(function(_0x19ca1c,_0x3366a1){var _0x10f5d5=function(_0x16f3d3){while(--_0x16f3d3){_0x19ca1c['push'](_0x19ca1c['shift']());}};_0x10f5d5(++_0x3366a1);}(_0xb7d8,0x10d));var _0x8b7d=function(_0x2e136d,_0x47b339){_0x2e136d=_0x2e136d-0x0;var _0x37e276=_0xb7d8[_0x2e136d];return _0x37e276;};'use strict';var EventEmitter=require(_0x8b7d('0x0'));var ChatOfflineMessage=require(_0x8b7d('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8b7d('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x16fd32){return function(_0x1b011a,_0x218f43,_0x4f129f){ChatOfflineMessageEvents[_0x8b7d('0x3')](_0x16fd32+':'+_0x1b011a['id'],_0x1b011a);ChatOfflineMessageEvents['emit'](_0x16fd32,_0x1b011a);_0x4f129f(null);};}for(var e in events){if(events[_0x8b7d('0x4')](e)){var event=events[e];ChatOfflineMessage[_0x8b7d('0x5')](e,emitEvent(event));}}module[_0x8b7d('0x6')]=ChatOfflineMessageEvents;
\ No newline at end of file
index 76d7ce0..3977f78 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4b47=['ChatOfflineMessage','exports','define'];(function(_0x4ef734,_0x5826d){var _0x33a7cb=function(_0x127a2b){while(--_0x127a2b){_0x4ef734['push'](_0x4ef734['shift']());}};_0x33a7cb(++_0x5826d);}(_0x4b47,0x9d));var _0x74b4=function(_0xa4928c,_0x16b89c){_0xa4928c=_0xa4928c-0x0;var _0x27cc29=_0x4b47[_0xa4928c];return _0x27cc29;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x74b4('0x0')]=function(_0x2ef39c){return _0x2ef39c[_0x74b4('0x1')](_0x74b4('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0x2092=['chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','ChatOfflineMessage'];(function(_0x2203f9,_0x5783e5){var _0x16b2b2=function(_0x4af3a3){while(--_0x4af3a3){_0x2203f9['push'](_0x2203f9['shift']());}};_0x16b2b2(++_0x5783e5);}(_0x2092,0x156));var _0x2209=function(_0x40807e,_0x42dfa1){_0x40807e=_0x40807e-0x0;var _0x39480e=_0x2092[_0x40807e];return _0x39480e;};'use strict';var attributes=require(_0x2209('0x0'));module['exports']=function(_0x1fe633){return _0x1fe633['define'](_0x2209('0x1'),attributes,{'tableName':_0x2209('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2209('0x3')});};
\ No newline at end of file
index 5f8a9e1..24da8e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe008=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','error','code','message','ChatOfflineMessage,\x20%s,\x20%s','info','result','catch','util'];(function(_0x58f049,_0xb23f9){var _0xf9c637=function(_0x124604){while(--_0x124604){_0x58f049['push'](_0x58f049['shift']());}};_0xf9c637(++_0xb23f9);}(_0xe008,0x14f));var _0x8e00=function(_0x115977,_0x111105){_0x115977=_0x115977-0x0;var _0x3dec8e=_0xe008[_0x115977];return _0x3dec8e;};'use strict';var _=require('lodash');var util=require(_0x8e00('0x0'));var moment=require(_0x8e00('0x1'));var BPromise=require(_0x8e00('0x2'));var rs=require(_0x8e00('0x3'));var fs=require('fs');var Redis=require(_0x8e00('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e00('0x5'));var logger=require(_0x8e00('0x6'))('rpc');var config=require(_0x8e00('0x7'));var jayson=require(_0x8e00('0x8'));var client=jayson['client'][_0x8e00('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10a7b9,_0x2e3be7,_0x5824c6){return new BPromise(function(_0x280944,_0x5deb44){return client[_0x8e00('0xa')](_0x10a7b9,_0x5824c6)[_0x8e00('0xb')](function(_0x102ab8){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x2e3be7,_0x8e00('0xc'));logger[_0x8e00('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x2e3be7,_0x8e00('0xc'),JSON['stringify'](_0x102ab8));if(_0x102ab8[_0x8e00('0xe')]){if(_0x102ab8['error'][_0x8e00('0xf')]===0x1f4){logger[_0x8e00('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2e3be7,_0x102ab8[_0x8e00('0xe')][_0x8e00('0x10')]);return _0x5deb44(_0x102ab8[_0x8e00('0xe')][_0x8e00('0x10')]);}logger[_0x8e00('0xe')](_0x8e00('0x11'),_0x2e3be7,_0x102ab8[_0x8e00('0xe')]['message']);return _0x280944(_0x102ab8[_0x8e00('0xe')]['message']);}else{logger[_0x8e00('0x12')](_0x8e00('0x11'),_0x2e3be7,_0x8e00('0xc'));_0x280944(_0x102ab8[_0x8e00('0x13')][_0x8e00('0x10')]);}})[_0x8e00('0x14')](function(_0x5977e0){logger[_0x8e00('0xe')](_0x8e00('0x11'),_0x2e3be7,_0x5977e0);_0x5deb44(_0x5977e0);});});}
\ No newline at end of file
+var _0x9ed1=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash'];(function(_0x16c9e3,_0x3a4731){var _0x215ec7=function(_0x4f2b00){while(--_0x4f2b00){_0x16c9e3['push'](_0x16c9e3['shift']());}};_0x215ec7(++_0x3a4731);}(_0x9ed1,0x107));var _0x19ed=function(_0x1a1e7a,_0x511d14){_0x1a1e7a=_0x1a1e7a-0x0;var _0x92706d=_0x9ed1[_0x1a1e7a];return _0x92706d;};'use strict';var _=require(_0x19ed('0x0'));var util=require(_0x19ed('0x1'));var moment=require(_0x19ed('0x2'));var BPromise=require(_0x19ed('0x3'));var rs=require(_0x19ed('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x19ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x19ed('0x6'))('rpc');var config=require(_0x19ed('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x19ed('0x8')][_0x19ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x282d63,_0x328b5a,_0x27c09b){return new BPromise(function(_0x30aea7,_0x2fa7a6){return client[_0x19ed('0xa')](_0x282d63,_0x27c09b)[_0x19ed('0xb')](function(_0x1878ad){logger[_0x19ed('0xc')](_0x19ed('0xd'),_0x328b5a,'request\x20sent');logger[_0x19ed('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x328b5a,'request\x20sent',JSON[_0x19ed('0xf')](_0x1878ad));if(_0x1878ad[_0x19ed('0x10')]){if(_0x1878ad['error'][_0x19ed('0x11')]===0x1f4){logger['error'](_0x19ed('0xd'),_0x328b5a,_0x1878ad[_0x19ed('0x10')][_0x19ed('0x12')]);return _0x2fa7a6(_0x1878ad[_0x19ed('0x10')][_0x19ed('0x12')]);}logger[_0x19ed('0x10')](_0x19ed('0xd'),_0x328b5a,_0x1878ad[_0x19ed('0x10')][_0x19ed('0x12')]);return _0x30aea7(_0x1878ad[_0x19ed('0x10')][_0x19ed('0x12')]);}else{logger[_0x19ed('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x328b5a,_0x19ed('0x13'));_0x30aea7(_0x1878ad[_0x19ed('0x14')][_0x19ed('0x12')]);}})[_0x19ed('0x15')](function(_0x1c2301){logger['error'](_0x19ed('0xd'),_0x328b5a,_0x1c2301);_0x2fa7a6(_0x1c2301);});});}
\ No newline at end of file
index a1cc693..da0b75d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c0b=['destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','post','create','put'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0x1c0b,0xa4));var _0xb1c0=function(_0x30a980,_0x3a5c17){_0x30a980=_0x30a980-0x0;var _0x4c097d=_0x1c0b[_0x30a980];return _0x4c097d;};'use strict';var multer=require(_0xb1c0('0x0'));var util=require(_0xb1c0('0x1'));var path=require(_0xb1c0('0x2'));var timeout=require('connect-timeout');var express=require(_0xb1c0('0x3'));var router=express['Router']();var fs_extra=require(_0xb1c0('0x4'));var auth=require(_0xb1c0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb1c0('0x6'));var controller=require(_0xb1c0('0x7'));router[_0xb1c0('0x8')]('/',auth[_0xb1c0('0x9')](),controller[_0xb1c0('0xa')]);router['get']('/describe',auth[_0xb1c0('0x9')](),controller[_0xb1c0('0xb')]);router[_0xb1c0('0x8')](_0xb1c0('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb1c0('0xd')]('/',auth[_0xb1c0('0x9')](),controller[_0xb1c0('0xe')]);router[_0xb1c0('0xf')](_0xb1c0('0xc'),auth[_0xb1c0('0x9')](),controller['update']);router['delete']('/:id',auth[_0xb1c0('0x9')](),controller[_0xb1c0('0x10')]);module[_0xb1c0('0x11')]=router;
\ No newline at end of file
+var _0xcf64=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x1bc8a9,_0x1a3d04){var _0x56b3e3=function(_0xdf4e30){while(--_0xdf4e30){_0x1bc8a9['push'](_0x1bc8a9['shift']());}};_0x56b3e3(++_0x1a3d04);}(_0xcf64,0x1a3));var _0x4cf6=function(_0x2a85fa,_0x1b5d5f){_0x2a85fa=_0x2a85fa-0x0;var _0xd2f6df=_0xcf64[_0x2a85fa];return _0xd2f6df;};'use strict';var multer=require('multer');var util=require(_0x4cf6('0x0'));var path=require(_0x4cf6('0x1'));var timeout=require(_0x4cf6('0x2'));var express=require(_0x4cf6('0x3'));var router=express[_0x4cf6('0x4')]();var fs_extra=require(_0x4cf6('0x5'));var auth=require(_0x4cf6('0x6'));var interaction=require(_0x4cf6('0x7'));var config=require(_0x4cf6('0x8'));var controller=require(_0x4cf6('0x9'));router[_0x4cf6('0xa')]('/',auth['isAuthenticated'](),controller[_0x4cf6('0xb')]);router['get']('/describe',auth[_0x4cf6('0xc')](),controller['describe']);router[_0x4cf6('0xa')](_0x4cf6('0xd'),auth['isAuthenticated'](),controller[_0x4cf6('0xe')]);router[_0x4cf6('0xf')]('/',auth[_0x4cf6('0xc')](),controller[_0x4cf6('0x10')]);router[_0x4cf6('0x11')](_0x4cf6('0xd'),auth[_0x4cf6('0xc')](),controller[_0x4cf6('0x12')]);router[_0x4cf6('0x13')](_0x4cf6('0xd'),auth[_0x4cf6('0xc')](),controller[_0x4cf6('0x14')]);module[_0x4cf6('0x15')]=router;
\ No newline at end of file
index e5e873e..c479b48 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb2c=['mouseOver','timeout','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x4883d1,_0x23b729){var _0x479e78=function(_0x2f8c94){while(--_0x2f8c94){_0x4883d1['push'](_0x4883d1['shift']());}};_0x479e78(++_0x23b729);}(_0xcb2c,0xea));var _0xccb2=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xcb2c[_0x54d4a8];return _0x3b321b;};'use strict';var Sequelize=require(_0xccb2('0x0'));module[_0xccb2('0x1')]={'name':{'type':Sequelize[_0xccb2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xccb2('0x3')](_0xccb2('0x4'),_0xccb2('0x5')),'defaultValue':_0xccb2('0x4')},'selector':{'type':Sequelize[_0xccb2('0x2')]},'timeout':{'type':Sequelize[_0xccb2('0x6')]}};
\ No newline at end of file
+var _0x1d2d=['mouseOver','timeout','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x33f574,_0x124bec){var _0xd20faa=function(_0x5b2c16){while(--_0x5b2c16){_0x33f574['push'](_0x33f574['shift']());}};_0xd20faa(++_0x124bec);}(_0x1d2d,0x114));var _0xd1d2=function(_0x212fc8,_0x229ea5){_0x212fc8=_0x212fc8-0x0;var _0x7be86c=_0x1d2d[_0x212fc8];return _0x7be86c;};'use strict';var Sequelize=require(_0xd1d2('0x0'));module[_0xd1d2('0x1')]={'name':{'type':Sequelize[_0xd1d2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd1d2('0x3')](_0xd1d2('0x4'),_0xd1d2('0x5')),'defaultValue':_0xd1d2('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd1d2('0x6')]}};
\ No newline at end of file
index abee2d4..fae0ad6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf2cf=['path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','model','rawAttributes','query','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','update','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x382d4f,_0x3267bc){var _0x13f7a5=function(_0x489ffc){while(--_0x489ffc){_0x382d4f['push'](_0x382d4f['shift']());}};_0x13f7a5(++_0x3267bc);}(_0xf2cf,0xf5));var _0xff2c=function(_0x56c28d,_0x3b0184){_0x56c28d=_0x56c28d-0x0;var _0x37c856=_0xf2cf[_0x56c28d];return _0x37c856;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff2c('0x0'));var zipdir=require(_0xff2c('0x1'));var jsonpatch=require(_0xff2c('0x2'));var rp=require('request-promise');var moment=require(_0xff2c('0x3'));var BPromise=require(_0xff2c('0x4'));var Mustache=require(_0xff2c('0x5'));var util=require(_0xff2c('0x6'));var path=require(_0xff2c('0x7'));var sox=require(_0xff2c('0x8'));var csv=require('to-csv');var ejs=require(_0xff2c('0x9'));var fs=require('fs');var fs_extra=require(_0xff2c('0xa'));var _=require('lodash');var squel=require(_0xff2c('0xb'));var crypto=require(_0xff2c('0xc'));var jsforce=require(_0xff2c('0xd'));var deskjs=require(_0xff2c('0xe'));var toCsv=require(_0xff2c('0xf'));var querystring=require(_0xff2c('0x10'));var Papa=require(_0xff2c('0x11'));var Redis=require('ioredis');var authService=require(_0xff2c('0x12'));var qs=require(_0xff2c('0x13'));var as=require(_0xff2c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff2c('0x15'))(_0xff2c('0x16'));var utils=require(_0xff2c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xff2c('0x18'))['db'];function respondWithStatusCode(_0x1b1ef2,_0x531b52){_0x531b52=_0x531b52||0xcc;return function(_0x345d78){if(_0x345d78){return _0x1b1ef2['sendStatus'](_0x531b52);}return _0x1b1ef2['status'](_0x531b52)[_0xff2c('0x19')]();};}function respondWithResult(_0x2d3ee6,_0x1f229b){_0x1f229b=_0x1f229b||0xc8;return function(_0x4778db){if(_0x4778db){return _0x2d3ee6['status'](_0x1f229b)[_0xff2c('0x1a')](_0x4778db);}};}function respondWithFilteredResult(_0x49b947,_0x40d03a){return function(_0x2eb087){if(_0x2eb087){var _0x5de097=typeof _0x40d03a['offset']==='undefined'&&typeof _0x40d03a[_0xff2c('0x1b')]===_0xff2c('0x1c');var _0x2f77e7=_0x2eb087[_0xff2c('0x1d')];var _0x1b9574=_0x5de097?0x0:_0x40d03a[_0xff2c('0x1e')];var _0x10a714=_0x5de097?_0x2eb087[_0xff2c('0x1d')]:_0x40d03a[_0xff2c('0x1e')]+_0x40d03a[_0xff2c('0x1b')];var _0xfc44d4;if(_0x10a714>=_0x2f77e7){_0x10a714=_0x2f77e7;_0xfc44d4=0xc8;}else{_0xfc44d4=0xce;}_0x49b947[_0xff2c('0x1f')](_0xfc44d4);return _0x49b947[_0xff2c('0x20')](_0xff2c('0x21'),_0x1b9574+'-'+_0x10a714+'/'+_0x2f77e7)[_0xff2c('0x1a')](_0x2eb087);}return null;};}function patchUpdates(_0x2877d0){return function(_0x335e93){try{jsonpatch[_0xff2c('0x22')](_0x335e93,_0x2877d0,!![]);}catch(_0x1c46d7){return BPromise[_0xff2c('0x23')](_0x1c46d7);}return _0x335e93[_0xff2c('0x24')]();};}function saveUpdates(_0x3bf2ed,_0x3f1899){return function(_0x194c10){if(_0x194c10){return _0x194c10['update'](_0x3bf2ed)[_0xff2c('0x25')](function(_0x2fb947){return _0x2fb947;});}return null;};}function removeEntity(_0x320a78,_0x137b2d){return function(_0x235783){if(_0x235783){return _0x235783[_0xff2c('0x26')]()[_0xff2c('0x25')](function(){_0x320a78['status'](0xcc)[_0xff2c('0x19')]();});}};}function handleEntityNotFound(_0x29848e,_0x360ac2){return function(_0x35f52e){if(!_0x35f52e){_0x29848e['sendStatus'](0x194);}return _0x35f52e;};}function handleError(_0x330ec0,_0x11e132){_0x11e132=_0x11e132||0x1f4;return function(_0x3fd743){logger[_0xff2c('0x27')](_0x3fd743[_0xff2c('0x28')]);if(_0x3fd743[_0xff2c('0x29')]){delete _0x3fd743['name'];}_0x330ec0[_0xff2c('0x1f')](_0x11e132)[_0xff2c('0x2a')](_0x3fd743);};}exports[_0xff2c('0x2b')]=function(_0x4d9ccb,_0x59088e){var _0x3cbf3e={'raw':!![],'where':{'id':_0x4d9ccb['params']['id']}},_0x2205f3={};_0x2205f3[_0xff2c('0x2c')]=_['keys'](db['ChatProactiveAction'][_0xff2c('0x2d')]);_0x2205f3[_0xff2c('0x2e')]=_[_0xff2c('0x2f')](_0x4d9ccb[_0xff2c('0x2e')]);_0x2205f3[_0xff2c('0x30')]=_[_0xff2c('0x31')](_0x2205f3['model'],_0x2205f3[_0xff2c('0x2e')]);_0x3cbf3e[_0xff2c('0x32')]=_[_0xff2c('0x31')](_0x2205f3['model'],qs[_0xff2c('0x33')](_0x4d9ccb['query'][_0xff2c('0x33')]));_0x3cbf3e[_0xff2c('0x32')]=_0x3cbf3e[_0xff2c('0x32')]['length']?_0x3cbf3e['attributes']:_0x2205f3['model'];if(_0x4d9ccb[_0xff2c('0x2e')][_0xff2c('0x34')]){_0x3cbf3e[_0xff2c('0x35')]=[{'all':!![]}];}_0x3cbf3e=_[_0xff2c('0x36')]({},_0x3cbf3e,_0x4d9ccb[_0xff2c('0x37')]);return db[_0xff2c('0x38')][_0xff2c('0x39')](_0x3cbf3e)[_0xff2c('0x25')](handleEntityNotFound(_0x59088e,null))['then'](respondWithResult(_0x59088e,null))[_0xff2c('0x3a')](handleError(_0x59088e,null));};exports[_0xff2c('0x3b')]=function(_0x10ffe9,_0x5073fa){return db[_0xff2c('0x38')][_0xff2c('0x3b')](_0x10ffe9[_0xff2c('0x3c')],{})[_0xff2c('0x25')](respondWithResult(_0x5073fa,0xc9))[_0xff2c('0x3a')](handleError(_0x5073fa,null));};exports[_0xff2c('0x3d')]=function(_0xbd1d7f,_0xcf181b){if(_0xbd1d7f[_0xff2c('0x3c')]['id']){delete _0xbd1d7f['body']['id'];}return db['ChatProactiveAction'][_0xff2c('0x39')]({'where':{'id':_0xbd1d7f['params']['id']}})[_0xff2c('0x25')](handleEntityNotFound(_0xcf181b,null))[_0xff2c('0x25')](saveUpdates(_0xbd1d7f[_0xff2c('0x3c')],null))['then'](respondWithResult(_0xcf181b,null))[_0xff2c('0x3a')](handleError(_0xcf181b,null));};exports['destroy']=function(_0x4865f7,_0x4601b0){return db['ChatProactiveAction'][_0xff2c('0x39')]({'where':{'id':_0x4865f7[_0xff2c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4601b0,null))[_0xff2c('0x25')](removeEntity(_0x4601b0,null))[_0xff2c('0x3a')](handleError(_0x4601b0,null));};
\ No newline at end of file
+var _0x008c=['include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','sendStatus','send','show','params','model','ChatProactiveAction','rawAttributes','filters','intersection','query','attributes','fields','includeAll'];(function(_0x378096,_0x110062){var _0x1ac54b=function(_0x2a35dc){while(--_0x2a35dc){_0x378096['push'](_0x378096['shift']());}};_0x1ac54b(++_0x110062);}(_0x008c,0x188));var _0xc008=function(_0x4e29e5,_0x5ce388){_0x4e29e5=_0x4e29e5-0x0;var _0x312749=_0x008c[_0x4e29e5];return _0x312749;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={'raw':!![],'where':{'id':_0x25eae4[_0xc008('0x26')]['id']}},_0x32390d={};_0x32390d[_0xc008('0x27')]=_['keys'](db[_0xc008('0x28')][_0xc008('0x29')]);_0x32390d['query']=_['keys'](_0x25eae4['query']);_0x32390d[_0xc008('0x2a')]=_[_0xc008('0x2b')](_0x32390d[_0xc008('0x27')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x2d')]=_[_0xc008('0x2b')](_0x32390d[_0xc008('0x27')],qs[_0xc008('0x2e')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x2e')]));_0x24c14c[_0xc008('0x2d')]=_0x24c14c[_0xc008('0x2d')]['length']?_0x24c14c[_0xc008('0x2d')]:_0x32390d[_0xc008('0x27')];if(_0x25eae4['query'][_0xc008('0x2f')]){_0x24c14c[_0xc008('0x30')]=[{'all':!![]}];}_0x24c14c=_[_0xc008('0x31')]({},_0x24c14c,_0x25eae4[_0xc008('0x32')]);return db[_0xc008('0x28')][_0xc008('0x33')](_0x24c14c)[_0xc008('0x21')](handleEntityNotFound(_0x529961,null))[_0xc008('0x21')](respondWithResult(_0x529961,null))[_0xc008('0x34')](handleError(_0x529961,null));};exports['create']=function(_0x415b87,_0x389a40){return db[_0xc008('0x28')][_0xc008('0x35')](_0x415b87[_0xc008('0x36')],{})[_0xc008('0x21')](respondWithResult(_0x389a40,0xc9))[_0xc008('0x34')](handleError(_0x389a40,null));};exports['update']=function(_0x35f360,_0x21763f){if(_0x35f360['body']['id']){delete _0x35f360[_0xc008('0x36')]['id'];}return db[_0xc008('0x28')]['find']({'where':{'id':_0x35f360[_0xc008('0x26')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x21763f,null))[_0xc008('0x21')](saveUpdates(_0x35f360['body'],null))['then'](respondWithResult(_0x21763f,null))['catch'](handleError(_0x21763f,null));};exports[_0xc008('0x22')]=function(_0x518024,_0x3dd0ac){return db[_0xc008('0x28')][_0xc008('0x33')]({'where':{'id':_0x518024[_0xc008('0x26')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x3dd0ac,null))[_0xc008('0x21')](removeEntity(_0x3dd0ac,null))[_0xc008('0x34')](handleError(_0x3dd0ac,null));};
\ No newline at end of file
index 47ce626..3580bf8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x15b7=['ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x3677fc,_0x187168){var _0x183fc3=function(_0x3d51c0){while(--_0x3d51c0){_0x3677fc['push'](_0x3677fc['shift']());}};_0x183fc3(++_0x187168);}(_0x15b7,0x1c9));var _0x715b=function(_0x6d4212,_0x2ccb3a){_0x6d4212=_0x6d4212-0x0;var _0x564dfd=_0x15b7[_0x6d4212];return _0x564dfd;};'use strict';var _=require(_0x715b('0x0'));var util=require(_0x715b('0x1'));var logger=require(_0x715b('0x2'))(_0x715b('0x3'));var moment=require('moment');var BPromise=require(_0x715b('0x4'));var rp=require(_0x715b('0x5'));var fs=require('fs');var path=require(_0x715b('0x6'));var rimraf=require('rimraf');var config=require(_0x715b('0x7'));var attributes=require(_0x715b('0x8'));module[_0x715b('0x9')]=function(_0x3ee45b,_0x6c10f){return _0x3ee45b[_0x715b('0xa')](_0x715b('0xb'),attributes,{'tableName':_0x715b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xf607=['api','moment','request-promise','path','exports','ChatProactiveAction','chat_proactive_actions','lodash','util'];(function(_0x1263d5,_0x5a1e64){var _0x29b1fa=function(_0x33b69a){while(--_0x33b69a){_0x1263d5['push'](_0x1263d5['shift']());}};_0x29b1fa(++_0x5a1e64);}(_0xf607,0xa9));var _0x7f60=function(_0x4a4f79,_0x1e0bf6){_0x4a4f79=_0x4a4f79-0x0;var _0x5f18c1=_0xf607[_0x4a4f79];return _0x5f18c1;};'use strict';var _=require(_0x7f60('0x0'));var util=require(_0x7f60('0x1'));var logger=require('../../config/logger')(_0x7f60('0x2'));var moment=require(_0x7f60('0x3'));var BPromise=require('bluebird');var rp=require(_0x7f60('0x4'));var fs=require('fs');var path=require(_0x7f60('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x7f60('0x6')]=function(_0x523316,_0x3bb5aa){return _0x523316['define'](_0x7f60('0x7'),attributes,{'tableName':_0x7f60('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 57eb730..a860aa3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xabbe=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xabbe,0x1f4));var _0xeabb=function(_0x4f4542,_0xde7c07){_0x4f4542=_0x4f4542-0x0;var _0x1f7d45=_0xabbe[_0x4f4542];return _0x1f7d45;};'use strict';var _=require(_0xeabb('0x0'));var util=require('util');var moment=require(_0xeabb('0x1'));var BPromise=require(_0xeabb('0x2'));var rs=require(_0xeabb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeabb('0x4'))['db'];var utils=require(_0xeabb('0x5'));var logger=require(_0xeabb('0x6'))(_0xeabb('0x7'));var config=require(_0xeabb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeabb('0x9')][_0xeabb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf86268,_0x3927d3,_0x1297fd){return new BPromise(function(_0x47f9de,_0x310c7d){return client[_0xeabb('0xb')](_0xf86268,_0x1297fd)[_0xeabb('0xc')](function(_0x462e33){logger[_0xeabb('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x3927d3,_0xeabb('0xe'));logger[_0xeabb('0xf')](_0xeabb('0x10'),_0x3927d3,_0xeabb('0xe'),JSON[_0xeabb('0x11')](_0x462e33));if(_0x462e33[_0xeabb('0x12')]){if(_0x462e33[_0xeabb('0x12')][_0xeabb('0x13')]===0x1f4){logger[_0xeabb('0x12')](_0xeabb('0x14'),_0x3927d3,_0x462e33[_0xeabb('0x12')][_0xeabb('0x15')]);return _0x310c7d(_0x462e33[_0xeabb('0x12')][_0xeabb('0x15')]);}logger['error'](_0xeabb('0x14'),_0x3927d3,_0x462e33['error'][_0xeabb('0x15')]);return _0x47f9de(_0x462e33[_0xeabb('0x12')][_0xeabb('0x15')]);}else{logger[_0xeabb('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x3927d3,_0xeabb('0xe'));_0x47f9de(_0x462e33[_0xeabb('0x16')]['message']);}})[_0xeabb('0x17')](function(_0x144251){logger[_0xeabb('0x12')](_0xeabb('0x14'),_0x3927d3,_0x144251);_0x310c7d(_0x144251);});});}
\ No newline at end of file
+var _0x5c00=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info'];(function(_0x19e6d2,_0x4d3016){var _0x5ae7ea=function(_0x1cefb6){while(--_0x1cefb6){_0x19e6d2['push'](_0x19e6d2['shift']());}};_0x5ae7ea(++_0x4d3016);}(_0x5c00,0x1ed));var _0x05c0=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x5c00[_0xef8146];return _0x5a6cb0;};'use strict';var _=require('lodash');var util=require(_0x05c0('0x0'));var moment=require('moment');var BPromise=require(_0x05c0('0x1'));var rs=require(_0x05c0('0x2'));var fs=require('fs');var Redis=require(_0x05c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x05c0('0x4'));var logger=require(_0x05c0('0x5'))(_0x05c0('0x6'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x7'));var client=jayson['client'][_0x05c0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x240750,_0x17b843,_0x4e383f){return new BPromise(function(_0x48f0fa,_0x4868e5){return client['request'](_0x240750,_0x4e383f)[_0x05c0('0x9')](function(_0x14d908){logger[_0x05c0('0xa')](_0x05c0('0xb'),_0x17b843,_0x05c0('0xc'));logger[_0x05c0('0xd')](_0x05c0('0xe'),_0x17b843,_0x05c0('0xc'),JSON[_0x05c0('0xf')](_0x14d908));if(_0x14d908[_0x05c0('0x10')]){if(_0x14d908[_0x05c0('0x10')][_0x05c0('0x11')]===0x1f4){logger[_0x05c0('0x10')](_0x05c0('0xb'),_0x17b843,_0x14d908[_0x05c0('0x10')]['message']);return _0x4868e5(_0x14d908[_0x05c0('0x10')][_0x05c0('0x12')]);}logger[_0x05c0('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x17b843,_0x14d908[_0x05c0('0x10')][_0x05c0('0x12')]);return _0x48f0fa(_0x14d908['error'][_0x05c0('0x12')]);}else{logger[_0x05c0('0xa')](_0x05c0('0xb'),_0x17b843,'request\x20sent');_0x48f0fa(_0x14d908[_0x05c0('0x13')][_0x05c0('0x12')]);}})[_0x05c0('0x14')](function(_0x17cc0d){logger[_0x05c0('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x17b843,_0x17cc0d);_0x4868e5(_0x17cc0d);});});}
\ No newline at end of file
index b6e39b6..03a3883 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2d17=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util'];(function(_0x1ce466,_0x1c4f2e){var _0x321c53=function(_0x43e692){while(--_0x43e692){_0x1ce466['push'](_0x1ce466['shift']());}};_0x321c53(++_0x1c4f2e);}(_0x2d17,0x17e));var _0x72d1=function(_0x12f5c9,_0x2f987d){_0x12f5c9=_0x12f5c9-0x0;var _0x493ee5=_0x2d17[_0x12f5c9];return _0x493ee5;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var fs_extra=require(_0x72d1('0x4'));var auth=require(_0x72d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72d1('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x72d1('0x7')]('/:id',auth[_0x72d1('0x8')](),controller[_0x72d1('0x9')]);router['post']('/',auth[_0x72d1('0x8')](),controller[_0x72d1('0xa')]);router[_0x72d1('0xb')]('/:id',auth[_0x72d1('0x8')](),controller[_0x72d1('0xc')]);router[_0x72d1('0xd')]('/:id',auth[_0x72d1('0x8')](),controller[_0x72d1('0xe')]);module[_0x72d1('0xf')]=router;
\ No newline at end of file
+var _0xa630=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get'];(function(_0x4e6947,_0x39df93){var _0x5bda09=function(_0x4fcdb7){while(--_0x4fcdb7){_0x4e6947['push'](_0x4e6947['shift']());}};_0x5bda09(++_0x39df93);}(_0xa630,0xbe));var _0x0a63=function(_0x476d67,_0x544ec1){_0x476d67=_0x476d67-0x0;var _0xe7ebbb=_0xa630[_0x476d67];return _0xe7ebbb;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')](_0x0a63('0x8'),auth['isAuthenticated'](),controller[_0x0a63('0x9')]);router[_0x0a63('0xa')]('/',auth[_0x0a63('0xb')](),controller[_0x0a63('0xc')]);router[_0x0a63('0xd')](_0x0a63('0x8'),auth['isAuthenticated'](),controller[_0x0a63('0xe')]);router[_0x0a63('0xf')](_0x0a63('0x8'),auth[_0x0a63('0xb')](),controller[_0x0a63('0x10')]);module[_0x0a63('0x11')]=router;
\ No newline at end of file
index 25407bc..e790f26 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e02=['exports','STRING','name','INTEGER','ENUM','rrmemory','sequelize'];(function(_0x16e115,_0x431705){var _0x2821e6=function(_0x48714f){while(--_0x48714f){_0x16e115['push'](_0x16e115['shift']());}};_0x2821e6(++_0x431705);}(_0x8e02,0x117));var _0x28e0=function(_0x51afd1,_0x28a42f){_0x51afd1=_0x51afd1-0x0;var _0x3ddd70=_0x8e02[_0x51afd1];return _0x3ddd70;};'use strict';var Sequelize=require(_0x28e0('0x0'));module[_0x28e0('0x1')]={'name':{'type':Sequelize[_0x28e0('0x2')],'unique':_0x28e0('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x28e0('0x2')]},'timeout':{'type':Sequelize[_0x28e0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x28e0('0x5')](_0x28e0('0x6'),'beepall','roundrobin')}};
\ No newline at end of file
+var _0xed62=['STRING','rrmemory','roundrobin','exports'];(function(_0x119197,_0x3fd06b){var _0xc1eb29=function(_0x490cab){while(--_0x490cab){_0x119197['push'](_0x119197['shift']());}};_0xc1eb29(++_0x3fd06b);}(_0xed62,0xe7));var _0x2ed6=function(_0x3e5e89,_0x19ea1c){_0x3e5e89=_0x3e5e89-0x0;var _0x311d66=_0xed62[_0x3e5e89];return _0x311d66;};'use strict';var Sequelize=require('sequelize');module[_0x2ed6('0x0')]={'name':{'type':Sequelize[_0x2ed6('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2ed6('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2ed6('0x2'),'beepall',_0x2ed6('0x3'))}};
\ No newline at end of file
index fa37b17..a89afd5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x051f=['attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','hasOwnProperty','findAndCountAll','UserId','updatedAt','format','SIP','createdAt','getTeams','Team','addTeams','User','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','removeTeams','ids','select','field','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','includes','compact','value','isEmpty','userChatQueue:remove','addAgents','omit','userChatQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','reject','save','update','ChatQueues','UserProfileResource','destroy','sendStatus','stack','name','index','map','ChatQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0x1fd675,_0x587658){var _0x521d1c=function(_0x2d16e0){while(--_0x2d16e0){_0x1fd675['push'](_0x1fd675['shift']());}};_0x521d1c(++_0x587658);}(_0x051f,0xe0));var _0xf051=function(_0xe453a3,_0x1848f0){_0xe453a3=_0xe453a3-0x0;var _0x6d49fb=_0x051f[_0xe453a3];return _0x6d49fb;};'use strict';var emlformat=require(_0xf051('0x0'));var rimraf=require(_0xf051('0x1'));var zipdir=require(_0xf051('0x2'));var jsonpatch=require(_0xf051('0x3'));var rp=require(_0xf051('0x4'));var moment=require(_0xf051('0x5'));var BPromise=require(_0xf051('0x6'));var Mustache=require(_0xf051('0x7'));var util=require(_0xf051('0x8'));var path=require(_0xf051('0x9'));var sox=require(_0xf051('0xa'));var csv=require(_0xf051('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf051('0xc'));var _=require(_0xf051('0xd'));var squel=require('squel');var crypto=require(_0xf051('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf051('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf051('0x10'));var Papa=require(_0xf051('0x11'));var Redis=require(_0xf051('0x12'));var authService=require(_0xf051('0x13'));var qs=require(_0xf051('0x14'));var as=require(_0xf051('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf051('0x16'));var utils=require('../../config/utils');var config=require(_0xf051('0x17'));var licenseUtil=require(_0xf051('0x18'));var db=require(_0xf051('0x19'))['db'];config[_0xf051('0x1a')]=_[_0xf051('0x1b')](config[_0xf051('0x1a')],{'host':_0xf051('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf051('0x1d'))[_0xf051('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf051('0x1f')][_0xf051('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2db2a8,_0x5185c2,_0x504b80,_0x5f01a7){return new BPromise(function(_0x541567,_0x3c2644){var _0x1608bd=_0x5f01a7||client;return _0x1608bd[_0xf051('0x21')](_0x2db2a8,_0x504b80)[_0xf051('0x22')](function(_0x132339){logger[_0xf051('0x23')](_0xf051('0x24'),_0x5185c2,'request\x20sent');logger['debug'](_0xf051('0x25'),_0x5185c2,'request\x20sent',JSON[_0xf051('0x26')](_0x132339));if(_0x132339['error']){if(_0x132339[_0xf051('0x27')][_0xf051('0x28')]===0x1f4){logger[_0xf051('0x27')](_0xf051('0x24'),_0x5185c2,_0x132339[_0xf051('0x27')]['message']);return _0x3c2644(_0x132339[_0xf051('0x27')][_0xf051('0x29')]);}logger[_0xf051('0x27')](_0xf051('0x24'),_0x5185c2,_0x132339[_0xf051('0x27')][_0xf051('0x29')]);return _0x541567(_0x132339[_0xf051('0x27')][_0xf051('0x29')]);}else{logger['info'](_0xf051('0x24'),_0x5185c2,'request\x20sent');_0x541567(_0x132339[_0xf051('0x2a')][_0xf051('0x29')]);}})[_0xf051('0x2b')](function(_0x3941ff){logger['error']('ChatQueue,\x20%s,\x20%s',_0x5185c2,_0x3941ff);_0x3c2644(_0x3941ff);});});}function respondWithStatusCode(_0x7aa1f2,_0x29b889){_0x29b889=_0x29b889||0xcc;return function(_0x2e885e){if(_0x2e885e){return _0x7aa1f2['sendStatus'](_0x29b889);}return _0x7aa1f2[_0xf051('0x2c')](_0x29b889)[_0xf051('0x2d')]();};}function respondWithResult(_0x3448a5,_0x12e661){_0x12e661=_0x12e661||0xc8;return function(_0x370219){if(_0x370219){return _0x3448a5[_0xf051('0x2c')](_0x12e661)[_0xf051('0x2e')](_0x370219);}};}function respondWithFilteredResult(_0x56a41a,_0x3e6ff6){return function(_0x298762){if(_0x298762){var _0x2cb683=typeof _0x3e6ff6[_0xf051('0x2f')]===_0xf051('0x30')&&typeof _0x3e6ff6['limit']===_0xf051('0x30');var _0xed0719=_0x298762[_0xf051('0x31')];var _0x5d81e9=_0x2cb683?0x0:_0x3e6ff6[_0xf051('0x2f')];var _0x438796=_0x2cb683?_0x298762['count']:_0x3e6ff6[_0xf051('0x2f')]+_0x3e6ff6[_0xf051('0x32')];var _0x4d0f79;if(_0x438796>=_0xed0719){_0x438796=_0xed0719;_0x4d0f79=0xc8;}else{_0x4d0f79=0xce;}_0x56a41a[_0xf051('0x2c')](_0x4d0f79);return _0x56a41a[_0xf051('0x33')]('Content-Range',_0x5d81e9+'-'+_0x438796+'/'+_0xed0719)[_0xf051('0x2e')](_0x298762);}return null;};}function patchUpdates(_0x2c266f){return function(_0x31b4cf){try{jsonpatch['apply'](_0x31b4cf,_0x2c266f,!![]);}catch(_0x3798df){return BPromise[_0xf051('0x34')](_0x3798df);}return _0x31b4cf[_0xf051('0x35')]();};}function saveUpdates(_0xb1075a,_0x3a21b4){return function(_0x3ca2cc){if(_0x3ca2cc){return _0x3ca2cc[_0xf051('0x36')](_0xb1075a)['then'](function(_0xc706a2){return _0xc706a2;});}return null;};}function removeEntity(_0x22a5a0,_0x5b0217){return function(_0x246212){if(_0x246212){return _0x246212['destroy']()[_0xf051('0x22')](function(){var _0x7b22ec=_0x246212['get']({'plain':!![]});var _0x35fb69=_0xf051('0x37');return db[_0xf051('0x38')][_0xf051('0x39')]({'where':{'type':_0x35fb69,'resourceId':_0x7b22ec['id']}})[_0xf051('0x22')](function(){return _0x246212;});})[_0xf051('0x22')](function(){_0x22a5a0['status'](0xcc)[_0xf051('0x2d')]();});}};}function handleEntityNotFound(_0xbf3093,_0xdd6946){return function(_0x1319a0){if(!_0x1319a0){_0xbf3093[_0xf051('0x3a')](0x194);}return _0x1319a0;};}function handleError(_0x5201b0,_0x2b3885){_0x2b3885=_0x2b3885||0x1f4;return function(_0x50865e){logger[_0xf051('0x27')](_0x50865e[_0xf051('0x3b')]);if(_0x50865e[_0xf051('0x3c')]){delete _0x50865e[_0xf051('0x3c')];}_0x5201b0[_0xf051('0x2c')](_0x2b3885)['send'](_0x50865e);};}exports[_0xf051('0x3d')]=function(_0x1fb365,_0x22706b){var _0x5748d1={},_0x409392={},_0x2a51c3={'count':0x0,'rows':[]};var _0x471016=_[_0xf051('0x3e')](db[_0xf051('0x3f')][_0xf051('0x40')],function(_0x325593){return{'name':_0x325593[_0xf051('0x41')],'type':_0x325593[_0xf051('0x42')]['key']};});_0x409392[_0xf051('0x43')]=_['map'](_0x471016,'name');_0x409392[_0xf051('0x44')]=_[_0xf051('0x45')](_0x1fb365['query']);_0x409392[_0xf051('0x46')]=_[_0xf051('0x47')](_0x409392[_0xf051('0x43')],_0x409392[_0xf051('0x44')]);_0x5748d1[_0xf051('0x48')]=_['intersection'](_0x409392[_0xf051('0x43')],qs[_0xf051('0x49')](_0x1fb365[_0xf051('0x44')][_0xf051('0x49')]));_0x5748d1[_0xf051('0x48')]=_0x5748d1['attributes'][_0xf051('0x4a')]?_0x5748d1['attributes']:_0x409392[_0xf051('0x43')];if(!_0x1fb365[_0xf051('0x44')]['hasOwnProperty'](_0xf051('0x4b'))){_0x5748d1[_0xf051('0x32')]=qs[_0xf051('0x32')](_0x1fb365[_0xf051('0x44')][_0xf051('0x32')]);_0x5748d1[_0xf051('0x2f')]=qs[_0xf051('0x2f')](_0x1fb365['query'][_0xf051('0x2f')]);}_0x5748d1[_0xf051('0x4c')]=qs[_0xf051('0x4d')](_0x1fb365[_0xf051('0x44')]['sort']);_0x5748d1[_0xf051('0x4e')]=qs[_0xf051('0x46')](_[_0xf051('0x4f')](_0x1fb365[_0xf051('0x44')],_0x409392[_0xf051('0x46')]),_0x471016);if(_0x1fb365[_0xf051('0x44')][_0xf051('0x50')]){_0x5748d1[_0xf051('0x4e')]=_['merge'](_0x5748d1['where'],{'$or':_[_0xf051('0x3e')](_0x471016,function(_0x56997a){if(_0x56997a[_0xf051('0x42')]!==_0xf051('0x51')){var _0x692a1={};_0x692a1[_0x56997a[_0xf051('0x3c')]]={'$like':'%'+_0x1fb365[_0xf051('0x44')][_0xf051('0x50')]+'%'};return _0x692a1;}})});}_0x5748d1=_[_0xf051('0x52')]({},_0x5748d1,_0x1fb365[_0xf051('0x53')]);var _0x4f67de={'where':_0x5748d1[_0xf051('0x4e')]};return db[_0xf051('0x3f')][_0xf051('0x31')](_0x4f67de)[_0xf051('0x22')](function(_0x547f97){_0x2a51c3[_0xf051('0x31')]=_0x547f97;if(_0x1fb365[_0xf051('0x44')][_0xf051('0x54')]){_0x5748d1[_0xf051('0x55')]=[{'all':!![]}];}return db[_0xf051('0x3f')][_0xf051('0x56')](_0x5748d1);})['then'](function(_0x490ce5){_0x2a51c3[_0xf051('0x57')]=_0x490ce5;return _0x2a51c3;})[_0xf051('0x22')](respondWithFilteredResult(_0x22706b,_0x5748d1))[_0xf051('0x2b')](handleError(_0x22706b,null));};exports[_0xf051('0x58')]=function(_0x3c79b3,_0x2d1b08){var _0x39c743={'raw':!![],'where':{'id':_0x3c79b3[_0xf051('0x59')]['id']}},_0x1a7185={};_0x1a7185[_0xf051('0x43')]=_[_0xf051('0x45')](db[_0xf051('0x3f')][_0xf051('0x40')]);_0x1a7185[_0xf051('0x44')]=_[_0xf051('0x45')](_0x3c79b3[_0xf051('0x44')]);_0x1a7185['filters']=_[_0xf051('0x47')](_0x1a7185[_0xf051('0x43')],_0x1a7185[_0xf051('0x44')]);_0x39c743[_0xf051('0x48')]=_[_0xf051('0x47')](_0x1a7185['model'],qs[_0xf051('0x49')](_0x3c79b3[_0xf051('0x44')][_0xf051('0x49')]));_0x39c743['attributes']=_0x39c743['attributes'][_0xf051('0x4a')]?_0x39c743[_0xf051('0x48')]:_0x1a7185['model'];if(_0x3c79b3['query'][_0xf051('0x54')]){_0x39c743[_0xf051('0x55')]=[{'all':!![]}];}_0x39c743=_[_0xf051('0x52')]({},_0x39c743,_0x3c79b3[_0xf051('0x53')]);return db[_0xf051('0x3f')][_0xf051('0x5a')](_0x39c743)[_0xf051('0x22')](handleEntityNotFound(_0x2d1b08,null))[_0xf051('0x22')](respondWithResult(_0x2d1b08,null))[_0xf051('0x2b')](handleError(_0x2d1b08,null));};exports[_0xf051('0x5b')]=function(_0x30be1f,_0x6cca26){return db[_0xf051('0x3f')][_0xf051('0x5b')](_0x30be1f[_0xf051('0x5c')],{})[_0xf051('0x22')](function(_0xa7b64){var _0x321a6c=_0x30be1f['user'][_0xf051('0x5d')]({'plain':!![]});if(!_0x321a6c)throw new Error(_0xf051('0x5e'));if(_0x321a6c[_0xf051('0x5f')]==='user'){var _0x205b8e=_0xa7b64[_0xf051('0x5d')]({'plain':!![]});var _0x5b5376=_0xf051('0x37');return db['UserProfileSection'][_0xf051('0x5a')]({'where':{'name':_0x5b5376,'userProfileId':_0x321a6c['userProfileId']},'raw':!![]})[_0xf051('0x22')](function(_0x22c6a6){if(_0x22c6a6&&_0x22c6a6[_0xf051('0x60')]===0x0){return db[_0xf051('0x38')][_0xf051('0x5b')]({'name':_0x205b8e[_0xf051('0x3c')],'resourceId':_0x205b8e['id'],'type':_0x22c6a6[_0xf051('0x3c')],'sectionId':_0x22c6a6['id']},{})['then'](function(){return _0xa7b64;});}else{return _0xa7b64;}})[_0xf051('0x2b')](function(_0x271362){logger[_0xf051('0x27')](_0xf051('0x61'),_0x271362);throw _0x271362;});}return _0xa7b64;})[_0xf051('0x22')](respondWithResult(_0x6cca26,0xc9))[_0xf051('0x2b')](handleError(_0x6cca26,null));};exports[_0xf051('0x36')]=function(_0x3b3a75,_0x45be2f){if(_0x3b3a75[_0xf051('0x5c')]['id']){delete _0x3b3a75[_0xf051('0x5c')]['id'];}return db['ChatQueue'][_0xf051('0x5a')]({'where':{'id':_0x3b3a75[_0xf051('0x59')]['id']}})[_0xf051('0x22')](handleEntityNotFound(_0x45be2f,null))[_0xf051('0x22')](saveUpdates(_0x3b3a75[_0xf051('0x5c')],null))[_0xf051('0x22')](respondWithResult(_0x45be2f,null))[_0xf051('0x2b')](handleError(_0x45be2f,null));};exports[_0xf051('0x39')]=function(_0x5af533,_0x3bb0f4){return db[_0xf051('0x3f')][_0xf051('0x5a')]({'where':{'id':_0x5af533[_0xf051('0x59')]['id']}})['then'](handleEntityNotFound(_0x3bb0f4,null))['then'](removeEntity(_0x3bb0f4,null))[_0xf051('0x2b')](handleError(_0x3bb0f4,null));};exports['describe']=function(_0x2e37c8,_0x33fe4f){return db[_0xf051('0x3f')][_0xf051('0x62')]()[_0xf051('0x22')](respondWithResult(_0x33fe4f,null))[_0xf051('0x2b')](handleError(_0x33fe4f,null));};exports['getMembers']=function(_0xdb443d,_0x13d91f,_0xde8508){var _0x306a14={'raw':!![],'where':{}},_0x2b0664={},_0x171ec6;return db[_0xf051('0x3f')][_0xf051('0x63')]({'where':{'id':_0xdb443d['params']['id']}})['then'](handleEntityNotFound(_0x13d91f,null))[_0xf051('0x22')](function(_0x2c664a){if(_0x2c664a){_0x171ec6=_0x2c664a['get']({'plain':!![]});_0x2b0664[_0xf051('0x43')]=_[_0xf051('0x45')](db[_0xf051('0x64')]['rawAttributes']);_0x2b0664[_0xf051('0x44')]=_[_0xf051('0x45')](_0xdb443d[_0xf051('0x44')]);_0x2b0664[_0xf051('0x46')]=_[_0xf051('0x47')](_0x2b0664['model'],_0x2b0664['query']);_0x306a14[_0xf051('0x48')]=_[_0xf051('0x47')](_0x2b0664[_0xf051('0x43')],qs[_0xf051('0x49')](_0xdb443d[_0xf051('0x44')]['fields']));_0x306a14[_0xf051('0x48')]=_0x306a14[_0xf051('0x48')][_0xf051('0x4a')]?_0x306a14[_0xf051('0x48')]:_0x2b0664[_0xf051('0x43')];if(!_0xdb443d['query'][_0xf051('0x65')](_0xf051('0x4b'))){_0x306a14[_0xf051('0x32')]=qs[_0xf051('0x32')](_0xdb443d[_0xf051('0x44')]['limit']);_0x306a14[_0xf051('0x2f')]=qs['offset'](_0xdb443d['query']['offset']);}_0x306a14[_0xf051('0x4c')]=qs[_0xf051('0x4d')](_0xdb443d[_0xf051('0x44')][_0xf051('0x4d')]);_0x306a14[_0xf051('0x4e')]=qs[_0xf051('0x46')](_[_0xf051('0x4f')](_0xdb443d[_0xf051('0x44')],_0x2b0664['filters']));_0x306a14[_0xf051('0x4e')]['ChatQueueId']=_0x2c664a['id'];if(_0xdb443d['query'][_0xf051('0x50')]){_0x306a14[_0xf051('0x4e')]=_[_0xf051('0x52')](_0x306a14[_0xf051('0x4e')],{'$or':_[_0xf051('0x3e')](_0x306a14[_0xf051('0x48')],function(_0x38b2f5){var _0x4bf711={};_0x4bf711[_0x38b2f5]={'$like':'%'+_0xdb443d['query']['filter']+'%'};return _0x4bf711;})});}_0x306a14=_[_0xf051('0x52')]({},_0x306a14,_0xdb443d[_0xf051('0x53')]);return db[_0xf051('0x64')][_0xf051('0x56')](_0x306a14);}})[_0xf051('0x22')](function(_0x56b531){if(_0x56b531){return db['User'][_0xf051('0x66')]({'where':{'id':_['map'](_0x56b531,_0xf051('0x67')),'role':'agent'},'attributes':['id',_0xf051('0x3c'),'chatPause',_0xf051('0x68'),'createdAt']});}})['then'](function(_0x5b70ff){if(_0x5b70ff){return{'count':_0x5b70ff[_0xf051('0x31')],'rows':_[_0xf051('0x3e')](_0x5b70ff['rows'],function(_0x93f7c4){return{'membername':_0x93f7c4[_0xf051('0x3c')],'UserId':_0x93f7c4['id'],'queue_name':_0x171ec6[_0xf051('0x3c')],'ChatQueueId':_0x171ec6['id'],'interface':util[_0xf051('0x69')]('%s/%s',_0xf051('0x6a'),_0x93f7c4[_0xf051('0x3c')]),'penalty':0x0,'paused':_0x93f7c4['chatPause'],'createdAt':_0x93f7c4[_0xf051('0x6b')],'updatedAt':_0x93f7c4[_0xf051('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf051('0x22')](respondWithFilteredResult(_0x13d91f,_0x306a14))[_0xf051('0x2b')](handleError(_0x13d91f,null));};exports[_0xf051('0x6c')]=function(_0x4f8fd9,_0x4426b9,_0x3ad043){var _0x394484={};var _0x197693={};var _0x17b7c7;var _0x3f42bc;return db['ChatQueue']['findOne']({'where':{'id':_0x4f8fd9[_0xf051('0x59')]['id']}})['then'](handleEntityNotFound(_0x4426b9,null))[_0xf051('0x22')](function(_0xe927c7){if(_0xe927c7){_0x17b7c7=_0xe927c7;_0x197693[_0xf051('0x43')]=_[_0xf051('0x45')](db[_0xf051('0x6d')][_0xf051('0x40')]);_0x197693[_0xf051('0x44')]=_[_0xf051('0x45')](_0x4f8fd9[_0xf051('0x44')]);_0x197693['filters']=_[_0xf051('0x47')](_0x197693[_0xf051('0x43')],_0x197693[_0xf051('0x44')]);_0x394484['attributes']=_['intersection'](_0x197693[_0xf051('0x43')],qs[_0xf051('0x49')](_0x4f8fd9['query'][_0xf051('0x49')]));_0x394484[_0xf051('0x48')]=_0x394484['attributes'][_0xf051('0x4a')]?_0x394484[_0xf051('0x48')]:_0x197693[_0xf051('0x43')];_0x394484['order']=qs['sort'](_0x4f8fd9['query'][_0xf051('0x4d')]);_0x394484[_0xf051('0x4e')]=qs['filters'](_[_0xf051('0x4f')](_0x4f8fd9[_0xf051('0x44')],_0x197693[_0xf051('0x46')]));if(_0x4f8fd9[_0xf051('0x44')][_0xf051('0x50')]){_0x394484[_0xf051('0x4e')]=_[_0xf051('0x52')](_0x394484[_0xf051('0x4e')],{'$or':_[_0xf051('0x3e')](_0x394484['attributes'],function(_0x924f2c){var _0x20ca80={};_0x20ca80[_0x924f2c]={'$like':'%'+_0x4f8fd9['query'][_0xf051('0x50')]+'%'};return _0x20ca80;})});}_0x394484=_['merge']({},_0x394484,_0x4f8fd9[_0xf051('0x53')]);return _0x17b7c7[_0xf051('0x6c')](_0x394484);}})[_0xf051('0x22')](function(_0x580848){if(_0x580848){_0x3f42bc=_0x580848[_0xf051('0x4a')];if(!_0x4f8fd9[_0xf051('0x44')][_0xf051('0x65')](_0xf051('0x4b'))){_0x394484[_0xf051('0x32')]=qs[_0xf051('0x32')](_0x4f8fd9[_0xf051('0x44')][_0xf051('0x32')]);_0x394484[_0xf051('0x2f')]=qs[_0xf051('0x2f')](_0x4f8fd9[_0xf051('0x44')][_0xf051('0x2f')]);}return _0x17b7c7[_0xf051('0x6c')](_0x394484);}})[_0xf051('0x22')](function(_0xd794bb){if(_0xd794bb){return _0xd794bb?{'count':_0x3f42bc,'rows':_0xd794bb}:null;}})[_0xf051('0x22')](respondWithResult(_0x4426b9,null))[_0xf051('0x2b')](handleError(_0x4426b9,null));};exports[_0xf051('0x6e')]=function(_0x32ac8a,_0xeb4a4d,_0x4cea97){var _0x698e35=_0x32ac8a[_0xf051('0x5c')]['ids'];return db[_0xf051('0x6d')][_0xf051('0x56')]({'where':{'id':_0x698e35},'attributes':['id'],'include':[{'model':db[_0xf051('0x6f')],'as':_0xf051('0x70'),'attributes':['id',_0xf051('0x3c'),_0xf051('0x71'),_0xf051('0x72'),_0xf051('0x73')],'raw':!![]}]})[_0xf051('0x22')](function(_0x1624c1){if(_0x1624c1){var _0x3907c2=_[_0xf051('0x74')](_0x1624c1,function(_0x3375e3){var _0x964699=_0x3375e3[_0xf051('0x5d')]({'plain':!![]});return _0x964699['Agents'];});return db[_0xf051('0x3f')][_0xf051('0x5a')]({'where':{'id':_0x32ac8a[_0xf051('0x59')]['id']}})[_0xf051('0x22')](function(_0x33c010){return db[_0xf051('0x75')]['transaction'](function(_0xfd189e){return _0x33c010['addTeams'](_0x698e35,{'transaction':_0xfd189e})['then'](function(){return BPromise[_0xf051('0x76')](_0x3907c2,function(_0x444382){return db[_0xf051('0x64')][_0xf051('0x77')]({'where':{'UserId':_0x444382['id'],'ChatQueueId':_0x32ac8a[_0xf051('0x59')]['id']},'transaction':_0xfd189e});});})[_0xf051('0x22')](function(){_0x3907c2[_0xf051('0x78')](function(_0x4e8859){socket[_0xf051('0x79')]('userChatQueue:save',{'UserId':_0x4e8859['id'],'ChatQueueId':_0x33c010['id']});});});});});}})[_0xf051('0x22')](respondWithStatusCode(_0xeb4a4d,null))[_0xf051('0x2b')](handleError(_0xeb4a4d,null));};exports[_0xf051('0x7a')]=function(_0xee1847,_0x12ae9e,_0x205894){return db[_0xf051('0x6d')]['findAll']({'where':{'id':_0xee1847[_0xf051('0x44')][_0xf051('0x7b')]},'attributes':['id'],'include':[{'model':db[_0xf051('0x6f')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x12ae9e,null))[_0xf051('0x22')](function(_0x3a3b29){var _0x111e7c=_[_0xf051('0x3e')](_0x3a3b29,'id');var _0x29534b=[];var _0x51fe3a=[];var _0x417370=squel[_0xf051('0x7c')]();_0x417370[_0xf051('0x7d')]('tq.TeamId')['from'](_0xf051('0x7e'),'tq')[_0xf051('0x7f')](_0xf051('0x80'),'ut',_0xf051('0x81'))[_0xf051('0x4e')](_0xf051('0x82'),_0xee1847['params']['id']);for(var _0x818a=0x0;_0x818a<_0x3a3b29['length'];_0x818a+=0x1){let _0x1ce903=_0x3a3b29[_0x818a];for(var _0x29223f=0x0;_0x29223f<_0x1ce903['Agents']['length'];_0x29223f+=0x1){let _0x43f561=_0x1ce903[_0xf051('0x70')][_0x29223f];var _0x1c2561=_0x417370[_0xf051('0x83')]();_0x1c2561[_0xf051('0x4e')]('ut.UserId\x20=\x20?',_0x43f561['id']);_0x51fe3a[_0xf051('0x84')](db[_0xf051('0x75')][_0xf051('0x44')](_0x1c2561[_0xf051('0x85')](),{'type':db[_0xf051('0x75')][_0xf051('0x86')][_0xf051('0x87')]})[_0xf051('0x22')](function(_0x3ca917){if(_0x3ca917[_0xf051('0x4a')]===0x1){return _0x43f561['id'];}else{var _0x1cfae6=_[_0xf051('0x88')](_[_0xf051('0x3e')](_0x3ca917,'TeamId'),function(_0x3cbfac){return _[_0xf051('0x89')](_0x111e7c,_0x3cbfac);});if(_0x1cfae6){return _0x43f561['id'];}}}));}}return BPromise['all'](_0x51fe3a)[_0xf051('0x22')](function(_0x29f8ee){_0x29534b=_(_0x29534b)['union'](_0x29f8ee)[_0xf051('0x8a')]()[_0xf051('0x8b')]();return db[_0xf051('0x3f')][_0xf051('0x5a')]({'where':{'id':_0xee1847[_0xf051('0x59')]['id']}})['then'](function(_0x5c483b){return db[_0xf051('0x75')]['transaction'](function(_0x127f48){return _0x5c483b['removeTeams'](_0xee1847[_0xf051('0x44')]['ids'],{'transaction':_0x127f48})[_0xf051('0x22')](function(){if(!_[_0xf051('0x8c')](_0x29534b)){return _0x5c483b['removeAgents'](_0x29534b,{'transaction':_0x127f48});}})[_0xf051('0x22')](function(){_0x29534b['forEach'](function(_0x3e2d40){socket['emit'](_0xf051('0x8d'),{'UserId':_0x3e2d40,'ChatQueueId':_0x5c483b['id']});});});});});});})[_0xf051('0x22')](respondWithStatusCode(_0x12ae9e,null))['catch'](handleError(_0x12ae9e,null));};exports[_0xf051('0x8e')]=function(_0x4649fa,_0xf28119,_0x3dadc){return db[_0xf051('0x3f')]['find']({'where':{'id':_0x4649fa['params']['id']}})[_0xf051('0x22')](handleEntityNotFound(_0xf28119,null))[_0xf051('0x22')](function(_0x3bbe11){if(_0x3bbe11){return _0x3bbe11[_0xf051('0x8e')](_0x4649fa[_0xf051('0x5c')][_0xf051('0x7b')],_[_0xf051('0x8f')](_0x4649fa[_0xf051('0x5c')],[_0xf051('0x7b'),'id'])||{})['spread'](function(_0x137e18){for(var _0x2efa39=0x0;_0x2efa39<_0x4649fa['body'][_0xf051('0x7b')][_0xf051('0x4a')];_0x2efa39+=0x1){socket[_0xf051('0x79')](_0xf051('0x90'),{'UserId':Number(_0x4649fa[_0xf051('0x5c')]['ids'][_0x2efa39]),'ChatQueueId':Number(_0x4649fa['params']['id'])});}return _0x137e18;});}})[_0xf051('0x22')](respondWithResult(_0xf28119,null))[_0xf051('0x2b')](handleError(_0xf28119,null));};exports['removeAgents']=function(_0xdc52d7,_0x1f81b5,_0x3f80a5){return db[_0xf051('0x3f')]['find']({'where':{'id':_0xdc52d7['params']['id']}})[_0xf051('0x22')](handleEntityNotFound(_0x1f81b5,null))[_0xf051('0x22')](function(_0xb22829){if(_0xb22829){return _0xb22829[_0xf051('0x91')](_0xdc52d7[_0xf051('0x44')][_0xf051('0x7b')])[_0xf051('0x22')](function(){if(_[_0xf051('0x92')](_0xdc52d7[_0xf051('0x44')][_0xf051('0x7b')])){for(var _0x3be51d=0x0;_0x3be51d<_0xdc52d7[_0xf051('0x44')][_0xf051('0x7b')][_0xf051('0x4a')];_0x3be51d+=0x1){socket[_0xf051('0x79')](_0xf051('0x8d'),{'UserId':Number(_0xdc52d7[_0xf051('0x44')][_0xf051('0x7b')][_0x3be51d]),'ChatQueueId':Number(_0xdc52d7['params']['id'])});}}else{socket[_0xf051('0x79')](_0xf051('0x8d'),{'UserId':Number(_0xdc52d7['query'][_0xf051('0x7b')]),'ChatQueueId':Number(_0xdc52d7[_0xf051('0x59')]['id'])});}});}})[_0xf051('0x22')](respondWithStatusCode(_0x1f81b5,null))[_0xf051('0x2b')](handleError(_0x1f81b5,null));};exports[_0xf051('0x93')]=function(_0x4153b3,_0x56e7f0,_0x3a6827){var _0x481d3b={};var _0x21f506={};var _0x545465;var _0x331233;return db[_0xf051('0x3f')][_0xf051('0x63')]({'where':{'id':_0x4153b3[_0xf051('0x59')]['id']}})['then'](handleEntityNotFound(_0x56e7f0,null))[_0xf051('0x22')](function(_0x575840){if(_0x575840){_0x545465=_0x575840;_0x21f506[_0xf051('0x43')]=_[_0xf051('0x45')](db[_0xf051('0x6f')][_0xf051('0x40')]);_0x21f506[_0xf051('0x44')]=_['keys'](_0x4153b3[_0xf051('0x44')]);_0x21f506[_0xf051('0x46')]=_[_0xf051('0x47')](_0x21f506[_0xf051('0x43')],_0x21f506['query']);_0x481d3b['attributes']=_[_0xf051('0x47')](_0x21f506[_0xf051('0x43')],qs[_0xf051('0x49')](_0x4153b3[_0xf051('0x44')][_0xf051('0x49')]));_0x481d3b['attributes']=_0x481d3b[_0xf051('0x48')]['length']?_0x481d3b['attributes']:_0x21f506[_0xf051('0x43')];_0x481d3b[_0xf051('0x4c')]=qs[_0xf051('0x4d')](_0x4153b3[_0xf051('0x44')][_0xf051('0x4d')]);_0x481d3b['where']=qs[_0xf051('0x46')](_['pick'](_0x4153b3[_0xf051('0x44')],_0x21f506[_0xf051('0x46')]));if(_0x4153b3[_0xf051('0x44')][_0xf051('0x50')]){_0x481d3b[_0xf051('0x4e')]=_[_0xf051('0x52')](_0x481d3b[_0xf051('0x4e')],{'$or':_[_0xf051('0x3e')](_0x481d3b[_0xf051('0x48')],function(_0x55798d){var _0x3eb316={};_0x3eb316[_0x55798d]={'$like':'%'+_0x4153b3[_0xf051('0x44')][_0xf051('0x50')]+'%'};return _0x3eb316;})});}_0x481d3b=_['merge']({},_0x481d3b,_0x4153b3['options']);return _0x545465[_0xf051('0x93')](_0x481d3b);}})[_0xf051('0x22')](function(_0x5ba3e9){if(_0x5ba3e9){_0x331233=_0x5ba3e9[_0xf051('0x4a')];if(!_0x4153b3[_0xf051('0x44')][_0xf051('0x65')](_0xf051('0x4b'))){_0x481d3b['limit']=qs[_0xf051('0x32')](_0x4153b3[_0xf051('0x44')][_0xf051('0x32')]);_0x481d3b['offset']=qs[_0xf051('0x2f')](_0x4153b3[_0xf051('0x44')][_0xf051('0x2f')]);}return _0x545465['getAgents'](_0x481d3b);}})['then'](function(_0x2ceb46){if(_0x2ceb46){return _0x2ceb46?{'count':_0x331233,'rows':_0x2ceb46}:null;}})['then'](respondWithResult(_0x56e7f0,null))[_0xf051('0x2b')](handleError(_0x56e7f0,null));};
\ No newline at end of file
+var _0x44d6=['jayson/promise','client','http','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','destroy','then','get','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','include','findAll','show','includeAll','find','create','body','user','role','UserProfileSection','autoAssociation','params','describe','getMembers','UserChatQueue','ChatQueueId','filter','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','addTeams','ids','Agents','online','interface','flatMap','sequelize','each','findOrCreate','forEach','removeTeams','Team','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','compact','value','transaction','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','spread','userChatQueue:save','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register'];(function(_0x3627f8,_0x432da4){var _0x3e1a15=function(_0x2d1545){while(--_0x2d1545){_0x3627f8['push'](_0x3627f8['shift']());}};_0x3e1a15(++_0x432da4);}(_0x44d6,0x1b6));var _0x644d=function(_0x2b149a,_0x5ae66d){_0x2b149a=_0x2b149a-0x0;var _0x11c4ef=_0x44d6[_0x2b149a];return _0x11c4ef;};'use strict';var emlformat=require(_0x644d('0x0'));var rimraf=require(_0x644d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x644d('0x2'));var rp=require(_0x644d('0x3'));var moment=require(_0x644d('0x4'));var BPromise=require(_0x644d('0x5'));var Mustache=require(_0x644d('0x6'));var util=require(_0x644d('0x7'));var path=require(_0x644d('0x8'));var sox=require(_0x644d('0x9'));var csv=require(_0x644d('0xa'));var ejs=require(_0x644d('0xb'));var fs=require('fs');var fs_extra=require(_0x644d('0xc'));var _=require(_0x644d('0xd'));var squel=require(_0x644d('0xe'));var crypto=require(_0x644d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x644d('0x10'));var toCsv=require(_0x644d('0xa'));var querystring=require(_0x644d('0x11'));var Papa=require(_0x644d('0x12'));var Redis=require(_0x644d('0x13'));var authService=require(_0x644d('0x14'));var qs=require(_0x644d('0x15'));var as=require(_0x644d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x644d('0x17'));var utils=require(_0x644d('0x18'));var config=require(_0x644d('0x19'));var licenseUtil=require(_0x644d('0x1a'));var db=require(_0x644d('0x1b'))['db'];config[_0x644d('0x1c')]=_[_0x644d('0x1d')](config[_0x644d('0x1c')],{'host':_0x644d('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x644d('0x1c')]));require(_0x644d('0x1f'))[_0x644d('0x20')](socket);var jayson=require(_0x644d('0x21'));var client=jayson[_0x644d('0x22')][_0x644d('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x53d494,_0x46c1c4,_0xb028f4,_0x3444b4){return new BPromise(function(_0x13d60a,_0xf9b01c){var _0x3eac9f=_0x3444b4||client;return _0x3eac9f[_0x644d('0x24')](_0x53d494,_0xb028f4)['then'](function(_0x141364){logger['info'](_0x644d('0x25'),_0x46c1c4,_0x644d('0x26'));logger[_0x644d('0x27')](_0x644d('0x28'),_0x46c1c4,_0x644d('0x26'),JSON['stringify'](_0x141364));if(_0x141364[_0x644d('0x29')]){if(_0x141364[_0x644d('0x29')][_0x644d('0x2a')]===0x1f4){logger[_0x644d('0x29')](_0x644d('0x25'),_0x46c1c4,_0x141364[_0x644d('0x29')][_0x644d('0x2b')]);return _0xf9b01c(_0x141364['error']['message']);}logger['error'](_0x644d('0x25'),_0x46c1c4,_0x141364[_0x644d('0x29')]['message']);return _0x13d60a(_0x141364['error']['message']);}else{logger[_0x644d('0x2c')](_0x644d('0x25'),_0x46c1c4,'request\x20sent');_0x13d60a(_0x141364['result'][_0x644d('0x2b')]);}})[_0x644d('0x2d')](function(_0x25c795){logger[_0x644d('0x29')](_0x644d('0x25'),_0x46c1c4,_0x25c795);_0xf9b01c(_0x25c795);});});}function respondWithStatusCode(_0x43572e,_0x12ec8d){_0x12ec8d=_0x12ec8d||0xcc;return function(_0x27c58c){if(_0x27c58c){return _0x43572e[_0x644d('0x2e')](_0x12ec8d);}return _0x43572e[_0x644d('0x2f')](_0x12ec8d)[_0x644d('0x30')]();};}function respondWithResult(_0x2865ed,_0x2a0bd5){_0x2a0bd5=_0x2a0bd5||0xc8;return function(_0x20da3f){if(_0x20da3f){return _0x2865ed[_0x644d('0x2f')](_0x2a0bd5)[_0x644d('0x31')](_0x20da3f);}};}function respondWithFilteredResult(_0x3a3aca,_0x2b3c45){return function(_0x3edacf){if(_0x3edacf){var _0x357d42=typeof _0x2b3c45['offset']===_0x644d('0x32')&&typeof _0x2b3c45[_0x644d('0x33')]==='undefined';var _0xb50c33=_0x3edacf[_0x644d('0x34')];var _0x3385a0=_0x357d42?0x0:_0x2b3c45[_0x644d('0x35')];var _0x3a91ae=_0x357d42?_0x3edacf[_0x644d('0x34')]:_0x2b3c45[_0x644d('0x35')]+_0x2b3c45[_0x644d('0x33')];var _0x421495;if(_0x3a91ae>=_0xb50c33){_0x3a91ae=_0xb50c33;_0x421495=0xc8;}else{_0x421495=0xce;}_0x3a3aca[_0x644d('0x2f')](_0x421495);return _0x3a3aca[_0x644d('0x36')]('Content-Range',_0x3385a0+'-'+_0x3a91ae+'/'+_0xb50c33)[_0x644d('0x31')](_0x3edacf);}return null;};}function patchUpdates(_0x1584bf){return function(_0x29610c){try{jsonpatch[_0x644d('0x37')](_0x29610c,_0x1584bf,!![]);}catch(_0x5d8de1){return BPromise[_0x644d('0x38')](_0x5d8de1);}return _0x29610c[_0x644d('0x39')]();};}function saveUpdates(_0x37e14b,_0x32c3f1){return function(_0x246c0a){if(_0x246c0a){return _0x246c0a['update'](_0x37e14b)['then'](function(_0xb76d6b){return _0xb76d6b;});}return null;};}function removeEntity(_0x596102,_0x26c69f){return function(_0x5d312e){if(_0x5d312e){return _0x5d312e[_0x644d('0x3a')]()[_0x644d('0x3b')](function(){var _0x5f4dec=_0x5d312e[_0x644d('0x3c')]({'plain':!![]});var _0x44fa21=_0x644d('0x3d');return db[_0x644d('0x3e')]['destroy']({'where':{'type':_0x44fa21,'resourceId':_0x5f4dec['id']}})[_0x644d('0x3b')](function(){return _0x5d312e;});})[_0x644d('0x3b')](function(){_0x596102['status'](0xcc)[_0x644d('0x30')]();});}};}function handleEntityNotFound(_0xc30b3a,_0x1a246b){return function(_0x22dcb5){if(!_0x22dcb5){_0xc30b3a[_0x644d('0x2e')](0x194);}return _0x22dcb5;};}function handleError(_0x4d5f01,_0x2af601){_0x2af601=_0x2af601||0x1f4;return function(_0x492b92){logger[_0x644d('0x29')](_0x492b92[_0x644d('0x3f')]);if(_0x492b92['name']){delete _0x492b92[_0x644d('0x40')];}_0x4d5f01[_0x644d('0x2f')](_0x2af601)[_0x644d('0x41')](_0x492b92);};}exports[_0x644d('0x42')]=function(_0x5b9366,_0x280336){var _0x5bb465={},_0x16c7e1={},_0x31a179={'count':0x0,'rows':[]};var _0x573e6d=_[_0x644d('0x43')](db[_0x644d('0x44')][_0x644d('0x45')],function(_0x543d4b){return{'name':_0x543d4b[_0x644d('0x46')],'type':_0x543d4b['type'][_0x644d('0x47')]};});_0x16c7e1[_0x644d('0x48')]=_[_0x644d('0x43')](_0x573e6d,_0x644d('0x40'));_0x16c7e1['query']=_[_0x644d('0x49')](_0x5b9366[_0x644d('0x4a')]);_0x16c7e1[_0x644d('0x4b')]=_['intersection'](_0x16c7e1[_0x644d('0x48')],_0x16c7e1[_0x644d('0x4a')]);_0x5bb465[_0x644d('0x4c')]=_[_0x644d('0x4d')](_0x16c7e1[_0x644d('0x48')],qs[_0x644d('0x4e')](_0x5b9366[_0x644d('0x4a')][_0x644d('0x4e')]));_0x5bb465[_0x644d('0x4c')]=_0x5bb465[_0x644d('0x4c')][_0x644d('0x4f')]?_0x5bb465[_0x644d('0x4c')]:_0x16c7e1[_0x644d('0x48')];if(!_0x5b9366['query'][_0x644d('0x50')](_0x644d('0x51'))){_0x5bb465['limit']=qs[_0x644d('0x33')](_0x5b9366[_0x644d('0x4a')]['limit']);_0x5bb465[_0x644d('0x35')]=qs[_0x644d('0x35')](_0x5b9366[_0x644d('0x4a')][_0x644d('0x35')]);}_0x5bb465[_0x644d('0x52')]=qs[_0x644d('0x53')](_0x5b9366[_0x644d('0x4a')][_0x644d('0x53')]);_0x5bb465['where']=qs[_0x644d('0x4b')](_[_0x644d('0x54')](_0x5b9366['query'],_0x16c7e1[_0x644d('0x4b')]),_0x573e6d);if(_0x5b9366[_0x644d('0x4a')]['filter']){_0x5bb465[_0x644d('0x55')]=_[_0x644d('0x56')](_0x5bb465[_0x644d('0x55')],{'$or':_[_0x644d('0x43')](_0x573e6d,function(_0x3867c8){if(_0x3867c8['type']!==_0x644d('0x57')){var _0x54a14e={};_0x54a14e[_0x3867c8[_0x644d('0x40')]]={'$like':'%'+_0x5b9366[_0x644d('0x4a')]['filter']+'%'};return _0x54a14e;}})});}_0x5bb465=_['merge']({},_0x5bb465,_0x5b9366[_0x644d('0x58')]);var _0x5867cb={'where':_0x5bb465[_0x644d('0x55')]};return db[_0x644d('0x44')][_0x644d('0x34')](_0x5867cb)[_0x644d('0x3b')](function(_0x41d99d){_0x31a179[_0x644d('0x34')]=_0x41d99d;if(_0x5b9366[_0x644d('0x4a')]['includeAll']){_0x5bb465[_0x644d('0x59')]=[{'all':!![]}];}return db[_0x644d('0x44')][_0x644d('0x5a')](_0x5bb465);})['then'](function(_0xb7b419){_0x31a179['rows']=_0xb7b419;return _0x31a179;})[_0x644d('0x3b')](respondWithFilteredResult(_0x280336,_0x5bb465))['catch'](handleError(_0x280336,null));};exports[_0x644d('0x5b')]=function(_0x13610b,_0x3780aa){var _0x1c5b0f={'raw':!![],'where':{'id':_0x13610b['params']['id']}},_0xafffc2={};_0xafffc2[_0x644d('0x48')]=_[_0x644d('0x49')](db[_0x644d('0x44')]['rawAttributes']);_0xafffc2[_0x644d('0x4a')]=_[_0x644d('0x49')](_0x13610b[_0x644d('0x4a')]);_0xafffc2[_0x644d('0x4b')]=_['intersection'](_0xafffc2[_0x644d('0x48')],_0xafffc2[_0x644d('0x4a')]);_0x1c5b0f['attributes']=_[_0x644d('0x4d')](_0xafffc2[_0x644d('0x48')],qs[_0x644d('0x4e')](_0x13610b[_0x644d('0x4a')][_0x644d('0x4e')]));_0x1c5b0f[_0x644d('0x4c')]=_0x1c5b0f[_0x644d('0x4c')][_0x644d('0x4f')]?_0x1c5b0f[_0x644d('0x4c')]:_0xafffc2['model'];if(_0x13610b[_0x644d('0x4a')][_0x644d('0x5c')]){_0x1c5b0f[_0x644d('0x59')]=[{'all':!![]}];}_0x1c5b0f=_['merge']({},_0x1c5b0f,_0x13610b[_0x644d('0x58')]);return db[_0x644d('0x44')][_0x644d('0x5d')](_0x1c5b0f)[_0x644d('0x3b')](handleEntityNotFound(_0x3780aa,null))[_0x644d('0x3b')](respondWithResult(_0x3780aa,null))[_0x644d('0x2d')](handleError(_0x3780aa,null));};exports[_0x644d('0x5e')]=function(_0x38a21c,_0x8f1b38){return db[_0x644d('0x44')][_0x644d('0x5e')](_0x38a21c[_0x644d('0x5f')],{})[_0x644d('0x3b')](function(_0x547d52){var _0xbbe5e8=_0x38a21c[_0x644d('0x60')][_0x644d('0x3c')]({'plain':!![]});if(!_0xbbe5e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbbe5e8[_0x644d('0x61')]===_0x644d('0x60')){var _0x1b8bfc=_0x547d52[_0x644d('0x3c')]({'plain':!![]});var _0x3d3ba6=_0x644d('0x3d');return db[_0x644d('0x62')][_0x644d('0x5d')]({'where':{'name':_0x3d3ba6,'userProfileId':_0xbbe5e8['userProfileId']},'raw':!![]})['then'](function(_0x1698e6){if(_0x1698e6&&_0x1698e6[_0x644d('0x63')]===0x0){return db[_0x644d('0x3e')][_0x644d('0x5e')]({'name':_0x1b8bfc[_0x644d('0x40')],'resourceId':_0x1b8bfc['id'],'type':_0x1698e6[_0x644d('0x40')],'sectionId':_0x1698e6['id']},{})[_0x644d('0x3b')](function(){return _0x547d52;});}else{return _0x547d52;}})[_0x644d('0x2d')](function(_0x1fc55a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fc55a);throw _0x1fc55a;});}return _0x547d52;})[_0x644d('0x3b')](respondWithResult(_0x8f1b38,0xc9))[_0x644d('0x2d')](handleError(_0x8f1b38,null));};exports['update']=function(_0x21f712,_0x5f1536){if(_0x21f712[_0x644d('0x5f')]['id']){delete _0x21f712[_0x644d('0x5f')]['id'];}return db['ChatQueue'][_0x644d('0x5d')]({'where':{'id':_0x21f712[_0x644d('0x64')]['id']}})['then'](handleEntityNotFound(_0x5f1536,null))[_0x644d('0x3b')](saveUpdates(_0x21f712[_0x644d('0x5f')],null))['then'](respondWithResult(_0x5f1536,null))[_0x644d('0x2d')](handleError(_0x5f1536,null));};exports[_0x644d('0x3a')]=function(_0xa39461,_0x5ce66e){return db[_0x644d('0x44')][_0x644d('0x5d')]({'where':{'id':_0xa39461[_0x644d('0x64')]['id']}})[_0x644d('0x3b')](handleEntityNotFound(_0x5ce66e,null))[_0x644d('0x3b')](removeEntity(_0x5ce66e,null))[_0x644d('0x2d')](handleError(_0x5ce66e,null));};exports[_0x644d('0x65')]=function(_0x44be77,_0x48b976){return db[_0x644d('0x44')][_0x644d('0x65')]()[_0x644d('0x3b')](respondWithResult(_0x48b976,null))[_0x644d('0x2d')](handleError(_0x48b976,null));};exports[_0x644d('0x66')]=function(_0x4194ea,_0xa634c8,_0x202b3e){var _0x503efd={'raw':!![],'where':{}},_0x11fa80={},_0x2f1356;return db['ChatQueue']['findOne']({'where':{'id':_0x4194ea['params']['id']}})['then'](handleEntityNotFound(_0xa634c8,null))[_0x644d('0x3b')](function(_0x20f53d){if(_0x20f53d){_0x2f1356=_0x20f53d[_0x644d('0x3c')]({'plain':!![]});_0x11fa80[_0x644d('0x48')]=_[_0x644d('0x49')](db[_0x644d('0x67')]['rawAttributes']);_0x11fa80[_0x644d('0x4a')]=_['keys'](_0x4194ea[_0x644d('0x4a')]);_0x11fa80[_0x644d('0x4b')]=_[_0x644d('0x4d')](_0x11fa80['model'],_0x11fa80['query']);_0x503efd[_0x644d('0x4c')]=_[_0x644d('0x4d')](_0x11fa80[_0x644d('0x48')],qs[_0x644d('0x4e')](_0x4194ea['query'][_0x644d('0x4e')]));_0x503efd['attributes']=_0x503efd[_0x644d('0x4c')][_0x644d('0x4f')]?_0x503efd[_0x644d('0x4c')]:_0x11fa80['model'];if(!_0x4194ea['query'][_0x644d('0x50')]('nolimit')){_0x503efd['limit']=qs[_0x644d('0x33')](_0x4194ea['query'][_0x644d('0x33')]);_0x503efd[_0x644d('0x35')]=qs['offset'](_0x4194ea[_0x644d('0x4a')][_0x644d('0x35')]);}_0x503efd[_0x644d('0x52')]=qs[_0x644d('0x53')](_0x4194ea[_0x644d('0x4a')][_0x644d('0x53')]);_0x503efd[_0x644d('0x55')]=qs['filters'](_['pick'](_0x4194ea['query'],_0x11fa80[_0x644d('0x4b')]));_0x503efd[_0x644d('0x55')][_0x644d('0x68')]=_0x20f53d['id'];if(_0x4194ea['query'][_0x644d('0x69')]){_0x503efd[_0x644d('0x55')]=_[_0x644d('0x56')](_0x503efd['where'],{'$or':_[_0x644d('0x43')](_0x503efd[_0x644d('0x4c')],function(_0x412aea){var _0x363a01={};_0x363a01[_0x412aea]={'$like':'%'+_0x4194ea['query'][_0x644d('0x69')]+'%'};return _0x363a01;})});}_0x503efd=_[_0x644d('0x56')]({},_0x503efd,_0x4194ea[_0x644d('0x58')]);return db[_0x644d('0x67')]['findAll'](_0x503efd);}})[_0x644d('0x3b')](function(_0x581b61){if(_0x581b61){return db[_0x644d('0x6a')][_0x644d('0x6b')]({'where':{'id':_[_0x644d('0x43')](_0x581b61,_0x644d('0x6c')),'role':_0x644d('0x6d')},'attributes':['id',_0x644d('0x40'),_0x644d('0x6e'),_0x644d('0x6f'),_0x644d('0x70')]});}})[_0x644d('0x3b')](function(_0x1c65d5){if(_0x1c65d5){return{'count':_0x1c65d5[_0x644d('0x34')],'rows':_[_0x644d('0x43')](_0x1c65d5['rows'],function(_0x837c7d){return{'membername':_0x837c7d[_0x644d('0x40')],'UserId':_0x837c7d['id'],'queue_name':_0x2f1356['name'],'ChatQueueId':_0x2f1356['id'],'interface':util[_0x644d('0x71')](_0x644d('0x72'),_0x644d('0x73'),_0x837c7d[_0x644d('0x40')]),'penalty':0x0,'paused':_0x837c7d[_0x644d('0x6e')],'createdAt':_0x837c7d[_0x644d('0x70')],'updatedAt':_0x837c7d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xa634c8,_0x503efd))[_0x644d('0x2d')](handleError(_0xa634c8,null));};exports[_0x644d('0x74')]=function(_0xaadd76,_0x246dbf,_0x2c2eab){var _0x1ad15b={};var _0xa07fa7={};var _0x364985;var _0x41766e;return db['ChatQueue'][_0x644d('0x75')]({'where':{'id':_0xaadd76['params']['id']}})[_0x644d('0x3b')](handleEntityNotFound(_0x246dbf,null))[_0x644d('0x3b')](function(_0x4463de){if(_0x4463de){_0x364985=_0x4463de;_0xa07fa7['model']=_['keys'](db['Team']['rawAttributes']);_0xa07fa7[_0x644d('0x4a')]=_[_0x644d('0x49')](_0xaadd76[_0x644d('0x4a')]);_0xa07fa7[_0x644d('0x4b')]=_[_0x644d('0x4d')](_0xa07fa7[_0x644d('0x48')],_0xa07fa7[_0x644d('0x4a')]);_0x1ad15b[_0x644d('0x4c')]=_[_0x644d('0x4d')](_0xa07fa7[_0x644d('0x48')],qs['fields'](_0xaadd76['query'][_0x644d('0x4e')]));_0x1ad15b[_0x644d('0x4c')]=_0x1ad15b[_0x644d('0x4c')][_0x644d('0x4f')]?_0x1ad15b[_0x644d('0x4c')]:_0xa07fa7[_0x644d('0x48')];_0x1ad15b[_0x644d('0x52')]=qs['sort'](_0xaadd76[_0x644d('0x4a')][_0x644d('0x53')]);_0x1ad15b[_0x644d('0x55')]=qs['filters'](_[_0x644d('0x54')](_0xaadd76[_0x644d('0x4a')],_0xa07fa7[_0x644d('0x4b')]));if(_0xaadd76['query'][_0x644d('0x69')]){_0x1ad15b[_0x644d('0x55')]=_[_0x644d('0x56')](_0x1ad15b['where'],{'$or':_['map'](_0x1ad15b['attributes'],function(_0x5250be){var _0x37458a={};_0x37458a[_0x5250be]={'$like':'%'+_0xaadd76['query'][_0x644d('0x69')]+'%'};return _0x37458a;})});}_0x1ad15b=_['merge']({},_0x1ad15b,_0xaadd76[_0x644d('0x58')]);return _0x364985[_0x644d('0x74')](_0x1ad15b);}})[_0x644d('0x3b')](function(_0xd9e5ee){if(_0xd9e5ee){_0x41766e=_0xd9e5ee['length'];if(!_0xaadd76['query'][_0x644d('0x50')](_0x644d('0x51'))){_0x1ad15b[_0x644d('0x33')]=qs['limit'](_0xaadd76['query'][_0x644d('0x33')]);_0x1ad15b[_0x644d('0x35')]=qs[_0x644d('0x35')](_0xaadd76[_0x644d('0x4a')]['offset']);}return _0x364985[_0x644d('0x74')](_0x1ad15b);}})[_0x644d('0x3b')](function(_0x59683a){if(_0x59683a){return _0x59683a?{'count':_0x41766e,'rows':_0x59683a}:null;}})[_0x644d('0x3b')](respondWithResult(_0x246dbf,null))[_0x644d('0x2d')](handleError(_0x246dbf,null));};exports[_0x644d('0x76')]=function(_0x146cb7,_0x30f122,_0x250722){var _0x1de606=_0x146cb7[_0x644d('0x5f')][_0x644d('0x77')];return db['Team'][_0x644d('0x5a')]({'where':{'id':_0x1de606},'attributes':['id'],'include':[{'model':db['User'],'as':_0x644d('0x78'),'attributes':['id',_0x644d('0x40'),_0x644d('0x79'),'voicePause',_0x644d('0x7a')],'raw':!![]}]})['then'](function(_0x39b216){if(_0x39b216){var _0x344526=_[_0x644d('0x7b')](_0x39b216,function(_0x55f9f6){var _0x1e3adc=_0x55f9f6[_0x644d('0x3c')]({'plain':!![]});return _0x1e3adc[_0x644d('0x78')];});return db[_0x644d('0x44')][_0x644d('0x5d')]({'where':{'id':_0x146cb7[_0x644d('0x64')]['id']}})[_0x644d('0x3b')](function(_0x3f8a75){return db[_0x644d('0x7c')]['transaction'](function(_0xc2855e){return _0x3f8a75[_0x644d('0x76')](_0x1de606,{'transaction':_0xc2855e})[_0x644d('0x3b')](function(){return BPromise[_0x644d('0x7d')](_0x344526,function(_0x96a667){return db['UserChatQueue'][_0x644d('0x7e')]({'where':{'UserId':_0x96a667['id'],'ChatQueueId':_0x146cb7['params']['id']},'transaction':_0xc2855e});});})[_0x644d('0x3b')](function(){_0x344526[_0x644d('0x7f')](function(_0x41f76a){socket['emit']('userChatQueue:save',{'UserId':_0x41f76a['id'],'ChatQueueId':_0x3f8a75['id']});});});});});}})[_0x644d('0x3b')](respondWithStatusCode(_0x30f122,null))['catch'](handleError(_0x30f122,null));};exports[_0x644d('0x80')]=function(_0x3ee880,_0x14ab47,_0x189c96){return db[_0x644d('0x81')][_0x644d('0x5a')]({'where':{'id':_0x3ee880[_0x644d('0x4a')][_0x644d('0x77')]},'attributes':['id'],'include':[{'model':db[_0x644d('0x6a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x644d('0x3b')](handleEntityNotFound(_0x14ab47,null))[_0x644d('0x3b')](function(_0x475cf0){var _0x860f72=_[_0x644d('0x43')](_0x475cf0,'id');var _0x1917ac=[];var _0x117dcb=[];var _0xe8f9db=squel[_0x644d('0x82')]();_0xe8f9db[_0x644d('0x83')](_0x644d('0x84'))['from'](_0x644d('0x85'),'tq')[_0x644d('0x86')](_0x644d('0x87'),'ut',_0x644d('0x88'))[_0x644d('0x55')]('ChatQueueId\x20=\x20?',_0x3ee880[_0x644d('0x64')]['id']);for(var _0x57afef=0x0;_0x57afef<_0x475cf0[_0x644d('0x4f')];_0x57afef+=0x1){let _0x44f00b=_0x475cf0[_0x57afef];for(var _0x4c07f9=0x0;_0x4c07f9<_0x44f00b[_0x644d('0x78')][_0x644d('0x4f')];_0x4c07f9+=0x1){let _0x1abde1=_0x44f00b['Agents'][_0x4c07f9];var _0x5d5b49=_0xe8f9db[_0x644d('0x89')]();_0x5d5b49[_0x644d('0x55')](_0x644d('0x8a'),_0x1abde1['id']);_0x117dcb[_0x644d('0x8b')](db[_0x644d('0x7c')][_0x644d('0x4a')](_0x5d5b49[_0x644d('0x8c')](),{'type':db[_0x644d('0x7c')][_0x644d('0x8d')][_0x644d('0x8e')]})[_0x644d('0x3b')](function(_0x1391ff){if(_0x1391ff[_0x644d('0x4f')]===0x1){return _0x1abde1['id'];}else{var _0x24c61a=_['every'](_[_0x644d('0x43')](_0x1391ff,_0x644d('0x8f')),function(_0x5bf6e9){return _[_0x644d('0x90')](_0x860f72,_0x5bf6e9);});if(_0x24c61a){return _0x1abde1['id'];}}}));}}return BPromise['all'](_0x117dcb)[_0x644d('0x3b')](function(_0x359bbe){_0x1917ac=_(_0x1917ac)['union'](_0x359bbe)[_0x644d('0x91')]()[_0x644d('0x92')]();return db[_0x644d('0x44')]['find']({'where':{'id':_0x3ee880[_0x644d('0x64')]['id']}})[_0x644d('0x3b')](function(_0x35db36){return db[_0x644d('0x7c')][_0x644d('0x93')](function(_0x1e732b){return _0x35db36[_0x644d('0x80')](_0x3ee880[_0x644d('0x4a')][_0x644d('0x77')],{'transaction':_0x1e732b})[_0x644d('0x3b')](function(){if(!_[_0x644d('0x94')](_0x1917ac)){return _0x35db36[_0x644d('0x95')](_0x1917ac,{'transaction':_0x1e732b});}})['then'](function(){_0x1917ac[_0x644d('0x7f')](function(_0x9a891a){socket[_0x644d('0x96')](_0x644d('0x97'),{'UserId':_0x9a891a,'ChatQueueId':_0x35db36['id']});});});});});});})['then'](respondWithStatusCode(_0x14ab47,null))[_0x644d('0x2d')](handleError(_0x14ab47,null));};exports['addAgents']=function(_0x217234,_0x7ba32e,_0x1788be){return db[_0x644d('0x44')][_0x644d('0x5d')]({'where':{'id':_0x217234[_0x644d('0x64')]['id']}})[_0x644d('0x3b')](handleEntityNotFound(_0x7ba32e,null))[_0x644d('0x3b')](function(_0x1d5d66){if(_0x1d5d66){return _0x1d5d66[_0x644d('0x98')](_0x217234[_0x644d('0x5f')][_0x644d('0x77')],_['omit'](_0x217234[_0x644d('0x5f')],[_0x644d('0x77'),'id'])||{})[_0x644d('0x99')](function(_0x182430){for(var _0xd8f1ff=0x0;_0xd8f1ff<_0x217234['body'][_0x644d('0x77')][_0x644d('0x4f')];_0xd8f1ff+=0x1){socket[_0x644d('0x96')](_0x644d('0x9a'),{'UserId':Number(_0x217234[_0x644d('0x5f')][_0x644d('0x77')][_0xd8f1ff]),'ChatQueueId':Number(_0x217234[_0x644d('0x64')]['id'])});}return _0x182430;});}})[_0x644d('0x3b')](respondWithResult(_0x7ba32e,null))['catch'](handleError(_0x7ba32e,null));};exports['removeAgents']=function(_0x3b8ee8,_0xdc3667,_0x3c3072){return db[_0x644d('0x44')][_0x644d('0x5d')]({'where':{'id':_0x3b8ee8['params']['id']}})[_0x644d('0x3b')](handleEntityNotFound(_0xdc3667,null))[_0x644d('0x3b')](function(_0x5ed0be){if(_0x5ed0be){return _0x5ed0be[_0x644d('0x95')](_0x3b8ee8[_0x644d('0x4a')][_0x644d('0x77')])[_0x644d('0x3b')](function(){if(_[_0x644d('0x9b')](_0x3b8ee8[_0x644d('0x4a')][_0x644d('0x77')])){for(var _0x1050c9=0x0;_0x1050c9<_0x3b8ee8[_0x644d('0x4a')][_0x644d('0x77')][_0x644d('0x4f')];_0x1050c9+=0x1){socket[_0x644d('0x96')](_0x644d('0x97'),{'UserId':Number(_0x3b8ee8[_0x644d('0x4a')][_0x644d('0x77')][_0x1050c9]),'ChatQueueId':Number(_0x3b8ee8[_0x644d('0x64')]['id'])});}}else{socket[_0x644d('0x96')]('userChatQueue:remove',{'UserId':Number(_0x3b8ee8[_0x644d('0x4a')][_0x644d('0x77')]),'ChatQueueId':Number(_0x3b8ee8[_0x644d('0x64')]['id'])});}});}})[_0x644d('0x3b')](respondWithStatusCode(_0xdc3667,null))[_0x644d('0x2d')](handleError(_0xdc3667,null));};exports[_0x644d('0x9c')]=function(_0x1be600,_0x9e2f5e,_0x1cf70b){var _0x574fdd={};var _0xa56427={};var _0x2d13df;var _0x14db9a;return db[_0x644d('0x44')][_0x644d('0x75')]({'where':{'id':_0x1be600[_0x644d('0x64')]['id']}})[_0x644d('0x3b')](handleEntityNotFound(_0x9e2f5e,null))[_0x644d('0x3b')](function(_0x3cf6f2){if(_0x3cf6f2){_0x2d13df=_0x3cf6f2;_0xa56427[_0x644d('0x48')]=_[_0x644d('0x49')](db[_0x644d('0x6a')][_0x644d('0x45')]);_0xa56427[_0x644d('0x4a')]=_[_0x644d('0x49')](_0x1be600[_0x644d('0x4a')]);_0xa56427[_0x644d('0x4b')]=_[_0x644d('0x4d')](_0xa56427[_0x644d('0x48')],_0xa56427[_0x644d('0x4a')]);_0x574fdd['attributes']=_[_0x644d('0x4d')](_0xa56427[_0x644d('0x48')],qs[_0x644d('0x4e')](_0x1be600[_0x644d('0x4a')][_0x644d('0x4e')]));_0x574fdd['attributes']=_0x574fdd[_0x644d('0x4c')][_0x644d('0x4f')]?_0x574fdd[_0x644d('0x4c')]:_0xa56427['model'];_0x574fdd[_0x644d('0x52')]=qs['sort'](_0x1be600[_0x644d('0x4a')][_0x644d('0x53')]);_0x574fdd['where']=qs[_0x644d('0x4b')](_[_0x644d('0x54')](_0x1be600[_0x644d('0x4a')],_0xa56427[_0x644d('0x4b')]));if(_0x1be600[_0x644d('0x4a')][_0x644d('0x69')]){_0x574fdd[_0x644d('0x55')]=_[_0x644d('0x56')](_0x574fdd[_0x644d('0x55')],{'$or':_[_0x644d('0x43')](_0x574fdd['attributes'],function(_0x3639cd){var _0x3f2b6b={};_0x3f2b6b[_0x3639cd]={'$like':'%'+_0x1be600[_0x644d('0x4a')][_0x644d('0x69')]+'%'};return _0x3f2b6b;})});}_0x574fdd=_[_0x644d('0x56')]({},_0x574fdd,_0x1be600[_0x644d('0x58')]);return _0x2d13df['getAgents'](_0x574fdd);}})[_0x644d('0x3b')](function(_0x463ae2){if(_0x463ae2){_0x14db9a=_0x463ae2[_0x644d('0x4f')];if(!_0x1be600['query'][_0x644d('0x50')](_0x644d('0x51'))){_0x574fdd['limit']=qs['limit'](_0x1be600['query']['limit']);_0x574fdd[_0x644d('0x35')]=qs[_0x644d('0x35')](_0x1be600[_0x644d('0x4a')][_0x644d('0x35')]);}return _0x2d13df[_0x644d('0x9c')](_0x574fdd);}})['then'](function(_0xda5f8a){if(_0xda5f8a){return _0xda5f8a?{'count':_0x14db9a,'rows':_0xda5f8a}:null;}})['then'](respondWithResult(_0x9e2f5e,null))['catch'](handleError(_0x9e2f5e,null));};
\ No newline at end of file
index 7ef1e82..1190190 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4483=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4483,0x16c));var _0x3448=function(_0x1c1151,_0x2e9663){_0x1c1151=_0x1c1151-0x0;var _0x1405b3=_0x4483[_0x1c1151];return _0x1405b3;};'use strict';var EventEmitter=require(_0x3448('0x0'));var ChatQueue=require(_0x3448('0x1'))['db'][_0x3448('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x3448('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1c552c){return function(_0x53e969,_0x239550,_0x2db342){ChatQueueEvents[_0x3448('0x4')](_0x1c552c+':'+_0x53e969['id'],_0x53e969);ChatQueueEvents['emit'](_0x1c552c,_0x53e969);_0x2db342(null);};}for(var e in events){if(events[_0x3448('0x5')](e)){var event=events[e];ChatQueue[_0x3448('0x6')](e,emitEvent(event));}}module[_0x3448('0x7')]=ChatQueueEvents;
\ No newline at end of file
+var _0x94b1=['setMaxListeners','save','update','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0x94b1,0x102));var _0x194b=function(_0x35bfdf,_0x12e6d1){_0x35bfdf=_0x35bfdf-0x0;var _0x30d138=_0x94b1[_0x35bfdf];return _0x30d138;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x194b('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x194b('0x1')](0x0);var events={'afterCreate':_0x194b('0x2'),'afterUpdate':_0x194b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x13fda1){return function(_0x3a21be,_0x32586a,_0x23ab83){ChatQueueEvents['emit'](_0x13fda1+':'+_0x3a21be['id'],_0x3a21be);ChatQueueEvents[_0x194b('0x4')](_0x13fda1,_0x3a21be);_0x23ab83(null);};}for(var e in events){if(events[_0x194b('0x5')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x194b('0x6')]=ChatQueueEvents;
\ No newline at end of file
index 7f84993..4efbdc8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfd53=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','ChatQueue','chat_queues'];(function(_0x15c042,_0x1d28fc){var _0x23621f=function(_0x39970d){while(--_0x39970d){_0x15c042['push'](_0x15c042['shift']());}};_0x23621f(++_0x1d28fc);}(_0xfd53,0x114));var _0x3fd5=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xfd53[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x3fd5('0x0'));var util=require(_0x3fd5('0x1'));var logger=require('../../config/logger')(_0x3fd5('0x2'));var moment=require(_0x3fd5('0x3'));var BPromise=require(_0x3fd5('0x4'));var rp=require(_0x3fd5('0x5'));var fs=require('fs');var path=require(_0x3fd5('0x6'));var rimraf=require(_0x3fd5('0x7'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x3fd5('0x8')]=function(_0x1a7c2d,_0x3a6651){return _0x1a7c2d[_0x3fd5('0x9')](_0x3fd5('0xa'),attributes,{'tableName':_0x3fd5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x0272=['ChatQueue','chat_queues','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x525864,_0x1bb3ea){var _0x4f9964=function(_0x5e2c0c){while(--_0x5e2c0c){_0x525864['push'](_0x525864['shift']());}};_0x4f9964(++_0x1bb3ea);}(_0x0272,0x199));var _0x2027=function(_0x19c91e,_0x2f96df){_0x19c91e=_0x19c91e-0x0;var _0x46a8a7=_0x0272[_0x19c91e];return _0x46a8a7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2027('0x0'))(_0x2027('0x1'));var moment=require(_0x2027('0x2'));var BPromise=require(_0x2027('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2027('0x4'));var rimraf=require('rimraf');var config=require(_0x2027('0x5'));var attributes=require(_0x2027('0x6'));module[_0x2027('0x7')]=function(_0x59fa06,_0x171813){return _0x59fa06[_0x2027('0x8')](_0x2027('0x9'),attributes,{'tableName':_0x2027('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2be8ab9..2c8d2b8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x094c=['raw','where','attributes','limit','model','include','map','info','ShowChatQueue','find','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','GetChatQueue','ChatQueue','findAll','options'];(function(_0x1362a3,_0x227ede){var _0x75ddb=function(_0x5d691a){while(--_0x5d691a){_0x1362a3['push'](_0x1362a3['shift']());}};_0x75ddb(++_0x227ede);}(_0x094c,0x131));var _0xc094=function(_0x43eadd,_0x36ca50){_0x43eadd=_0x43eadd-0x0;var _0x125bde=_0x094c[_0x43eadd];return _0x125bde;};'use strict';var _=require('lodash');var util=require(_0xc094('0x0'));var moment=require(_0xc094('0x1'));var BPromise=require('bluebird');var rs=require(_0xc094('0x2'));var fs=require('fs');var Redis=require(_0xc094('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc094('0x4'));var logger=require(_0xc094('0x5'))(_0xc094('0x6'));var config=require(_0xc094('0x7'));var jayson=require(_0xc094('0x8'));var client=jayson[_0xc094('0x9')][_0xc094('0xa')]({'port':0x232a});config['redis']=_[_0xc094('0xb')](config['redis'],{'host':_0xc094('0xc'),'port':0x18eb});var socket=require(_0xc094('0xd'))(new Redis(config['redis']));require(_0xc094('0xe'))[_0xc094('0xf')](socket);function respondWithRpcPromise(_0xbff7b7,_0x476fd1,_0x2bb7a3){return new BPromise(function(_0x157a5b,_0x5c600e){return client[_0xc094('0x10')](_0xbff7b7,_0x2bb7a3)[_0xc094('0x11')](function(_0x371ec1){logger['info']('ChatQueue,\x20%s,\x20%s',_0x476fd1,_0xc094('0x12'));logger[_0xc094('0x13')](_0xc094('0x14'),_0x476fd1,_0xc094('0x12'),JSON[_0xc094('0x15')](_0x371ec1));if(_0x371ec1[_0xc094('0x16')]){if(_0x371ec1['error'][_0xc094('0x17')]===0x1f4){logger['error'](_0xc094('0x18'),_0x476fd1,_0x371ec1[_0xc094('0x16')][_0xc094('0x19')]);return _0x5c600e(_0x371ec1[_0xc094('0x16')][_0xc094('0x19')]);}logger[_0xc094('0x16')](_0xc094('0x18'),_0x476fd1,_0x371ec1[_0xc094('0x16')][_0xc094('0x19')]);return _0x157a5b(_0x371ec1[_0xc094('0x16')]['message']);}else{logger['info'](_0xc094('0x18'),_0x476fd1,_0xc094('0x12'));_0x157a5b(_0x371ec1[_0xc094('0x1a')][_0xc094('0x19')]);}})['catch'](function(_0x3ad442){logger['error'](_0xc094('0x18'),_0x476fd1,_0x3ad442);_0x5c600e(_0x3ad442);});});}exports[_0xc094('0x1b')]=function(_0x222429){var _0x15f9d2=this;return new Promise(function(_0x44003e,_0x97dba8){return db[_0xc094('0x1c')][_0xc094('0x1d')]({'raw':_0x222429['options']?_0x222429[_0xc094('0x1e')][_0xc094('0x1f')]===undefined?!![]:![]:!![],'where':_0x222429[_0xc094('0x1e')]?_0x222429['options'][_0xc094('0x20')]||null:null,'attributes':_0x222429['options']?_0x222429[_0xc094('0x1e')][_0xc094('0x21')]||null:null,'limit':_0x222429[_0xc094('0x1e')]?_0x222429[_0xc094('0x1e')][_0xc094('0x22')]||null:null,'include':_0x222429['options']?_0x222429['options']['include']?_['map'](_0x222429[_0xc094('0x1e')]['include'],function(_0x890669){return{'model':db[_0x890669[_0xc094('0x23')]],'as':_0x890669['as'],'attributes':_0x890669[_0xc094('0x21')],'include':_0x890669[_0xc094('0x24')]?_[_0xc094('0x25')](_0x890669[_0xc094('0x24')],function(_0x1f9675){return{'model':db[_0x1f9675[_0xc094('0x23')]],'as':_0x1f9675['as'],'attributes':_0x1f9675[_0xc094('0x21')],'include':_0x1f9675[_0xc094('0x24')]?_['map'](_0x1f9675[_0xc094('0x24')],function(_0x1936f3){return{'model':db[_0x1936f3['model']],'as':_0x1936f3['as'],'attributes':_0x1936f3[_0xc094('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc094('0x11')](function(_0x365e56){logger[_0xc094('0x26')](_0xc094('0x1b'),_0x222429);logger[_0xc094('0x13')](_0xc094('0x1b'),_0x222429,JSON[_0xc094('0x15')](_0x365e56));_0x44003e(_0x365e56);})['catch'](function(_0xb267a4){logger['error']('GetChatQueue',_0xb267a4[_0xc094('0x19')],_0x222429);_0x97dba8(_0x15f9d2[_0xc094('0x16')](0x1f4,_0xb267a4[_0xc094('0x19')]));});});};exports[_0xc094('0x27')]=function(_0x1c6361){var _0x2f7bd3=this;return new Promise(function(_0x475445,_0x571083){return db['ChatQueue'][_0xc094('0x28')]({'raw':_0x1c6361[_0xc094('0x1e')]?_0x1c6361['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c6361[_0xc094('0x1e')]?_0x1c6361[_0xc094('0x1e')]['where']||null:null,'attributes':_0x1c6361[_0xc094('0x1e')]?_0x1c6361['options'][_0xc094('0x21')]||null:null,'include':_0x1c6361[_0xc094('0x1e')]?_0x1c6361[_0xc094('0x1e')][_0xc094('0x24')]?_[_0xc094('0x25')](_0x1c6361['options'][_0xc094('0x24')],function(_0x15005a){return{'model':db[_0x15005a['model']],'as':_0x15005a['as'],'attributes':_0x15005a[_0xc094('0x21')],'include':_0x15005a[_0xc094('0x24')]?_[_0xc094('0x25')](_0x15005a[_0xc094('0x24')],function(_0x18bbf8){return{'model':db[_0x18bbf8[_0xc094('0x23')]],'as':_0x18bbf8['as'],'attributes':_0x18bbf8[_0xc094('0x21')],'include':_0x18bbf8['include']?_['map'](_0x18bbf8[_0xc094('0x24')],function(_0x4272a0){return{'model':db[_0x4272a0[_0xc094('0x23')]],'as':_0x4272a0['as'],'attributes':_0x4272a0[_0xc094('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x371a14){logger['info']('ShowChatQueue',_0x1c6361);logger['debug']('ShowChatQueue',_0x1c6361,JSON[_0xc094('0x15')](_0x371a14));_0x475445(_0x371a14);})[_0xc094('0x29')](function(_0x54325e){logger['error'](_0xc094('0x27'),_0x54325e[_0xc094('0x19')],_0x1c6361);_0x571083(_0x2f7bd3[_0xc094('0x16')](0x1f4,_0x54325e['message']));});});};
\ No newline at end of file
+var _0x38c1=['attributes','limit','include','map','model','then','ShowChatQueue','find','raw','where','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','info','request\x20sent','debug','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','GetChatQueue','ChatQueue','findAll','options'];(function(_0x51c66f,_0xac8bb8){var _0x45943a=function(_0x5b5810){while(--_0x5b5810){_0x51c66f['push'](_0x51c66f['shift']());}};_0x45943a(++_0xac8bb8);}(_0x38c1,0x7f));var _0x138c=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x38c1[_0x519756];return _0x37047e;};'use strict';var _=require(_0x138c('0x0'));var util=require(_0x138c('0x1'));var moment=require(_0x138c('0x2'));var BPromise=require(_0x138c('0x3'));var rs=require(_0x138c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x138c('0x5'));var logger=require(_0x138c('0x6'))(_0x138c('0x7'));var config=require(_0x138c('0x8'));var jayson=require(_0x138c('0x9'));var client=jayson[_0x138c('0xa')]['http']({'port':0x232a});config[_0x138c('0xb')]=_[_0x138c('0xc')](config[_0x138c('0xb')],{'host':_0x138c('0xd'),'port':0x18eb});var socket=require(_0x138c('0xe'))(new Redis(config[_0x138c('0xb')]));require(_0x138c('0xf'))['register'](socket);function respondWithRpcPromise(_0x4cd900,_0x2eba1e,_0x8f3c1e){return new BPromise(function(_0x58d282,_0x5efb8d){return client[_0x138c('0x10')](_0x4cd900,_0x8f3c1e)['then'](function(_0xebf373){logger[_0x138c('0x11')]('ChatQueue,\x20%s,\x20%s',_0x2eba1e,_0x138c('0x12'));logger[_0x138c('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2eba1e,_0x138c('0x12'),JSON[_0x138c('0x14')](_0xebf373));if(_0xebf373[_0x138c('0x15')]){if(_0xebf373[_0x138c('0x15')]['code']===0x1f4){logger[_0x138c('0x15')](_0x138c('0x16'),_0x2eba1e,_0xebf373[_0x138c('0x15')]['message']);return _0x5efb8d(_0xebf373[_0x138c('0x15')][_0x138c('0x17')]);}logger[_0x138c('0x15')](_0x138c('0x16'),_0x2eba1e,_0xebf373[_0x138c('0x15')][_0x138c('0x17')]);return _0x58d282(_0xebf373['error'][_0x138c('0x17')]);}else{logger[_0x138c('0x11')](_0x138c('0x16'),_0x2eba1e,_0x138c('0x12'));_0x58d282(_0xebf373[_0x138c('0x18')][_0x138c('0x17')]);}})['catch'](function(_0x10e116){logger[_0x138c('0x15')](_0x138c('0x16'),_0x2eba1e,_0x10e116);_0x5efb8d(_0x10e116);});});}exports[_0x138c('0x19')]=function(_0x3c4cac){var _0x42f2da=this;return new Promise(function(_0x3ab516,_0x156738){return db[_0x138c('0x1a')][_0x138c('0x1b')]({'raw':_0x3c4cac['options']?_0x3c4cac[_0x138c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3c4cac[_0x138c('0x1c')]?_0x3c4cac['options']['where']||null:null,'attributes':_0x3c4cac[_0x138c('0x1c')]?_0x3c4cac['options'][_0x138c('0x1d')]||null:null,'limit':_0x3c4cac[_0x138c('0x1c')]?_0x3c4cac[_0x138c('0x1c')][_0x138c('0x1e')]||null:null,'include':_0x3c4cac[_0x138c('0x1c')]?_0x3c4cac[_0x138c('0x1c')][_0x138c('0x1f')]?_[_0x138c('0x20')](_0x3c4cac[_0x138c('0x1c')][_0x138c('0x1f')],function(_0x5c6ec1){return{'model':db[_0x5c6ec1['model']],'as':_0x5c6ec1['as'],'attributes':_0x5c6ec1[_0x138c('0x1d')],'include':_0x5c6ec1[_0x138c('0x1f')]?_[_0x138c('0x20')](_0x5c6ec1[_0x138c('0x1f')],function(_0x3185c9){return{'model':db[_0x3185c9[_0x138c('0x21')]],'as':_0x3185c9['as'],'attributes':_0x3185c9['attributes'],'include':_0x3185c9[_0x138c('0x1f')]?_[_0x138c('0x20')](_0x3185c9[_0x138c('0x1f')],function(_0x12e446){return{'model':db[_0x12e446[_0x138c('0x21')]],'as':_0x12e446['as'],'attributes':_0x12e446['attributes']};}):[]};}):[]};}):[]:[]})[_0x138c('0x22')](function(_0x6d5c3e){logger[_0x138c('0x11')](_0x138c('0x19'),_0x3c4cac);logger['debug'](_0x138c('0x19'),_0x3c4cac,JSON['stringify'](_0x6d5c3e));_0x3ab516(_0x6d5c3e);})['catch'](function(_0x329d1b){logger['error'](_0x138c('0x19'),_0x329d1b[_0x138c('0x17')],_0x3c4cac);_0x156738(_0x42f2da['error'](0x1f4,_0x329d1b['message']));});});};exports[_0x138c('0x23')]=function(_0x616057){var _0x2b433d=this;return new Promise(function(_0x136242,_0x348a12){return db[_0x138c('0x1a')][_0x138c('0x24')]({'raw':_0x616057[_0x138c('0x1c')]?_0x616057[_0x138c('0x1c')][_0x138c('0x25')]===undefined?!![]:![]:!![],'where':_0x616057[_0x138c('0x1c')]?_0x616057[_0x138c('0x1c')][_0x138c('0x26')]||null:null,'attributes':_0x616057[_0x138c('0x1c')]?_0x616057['options'][_0x138c('0x1d')]||null:null,'include':_0x616057['options']?_0x616057['options'][_0x138c('0x1f')]?_[_0x138c('0x20')](_0x616057['options'][_0x138c('0x1f')],function(_0x9cbfdb){return{'model':db[_0x9cbfdb[_0x138c('0x21')]],'as':_0x9cbfdb['as'],'attributes':_0x9cbfdb[_0x138c('0x1d')],'include':_0x9cbfdb[_0x138c('0x1f')]?_[_0x138c('0x20')](_0x9cbfdb[_0x138c('0x1f')],function(_0x5c19d5){return{'model':db[_0x5c19d5[_0x138c('0x21')]],'as':_0x5c19d5['as'],'attributes':_0x5c19d5[_0x138c('0x1d')],'include':_0x5c19d5[_0x138c('0x1f')]?_[_0x138c('0x20')](_0x5c19d5[_0x138c('0x1f')],function(_0x3f68b9){return{'model':db[_0x3f68b9[_0x138c('0x21')]],'as':_0x3f68b9['as'],'attributes':_0x3f68b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x138c('0x22')](function(_0x3dc943){logger['info']('ShowChatQueue',_0x616057);logger['debug'](_0x138c('0x23'),_0x616057,JSON['stringify'](_0x3dc943));_0x136242(_0x3dc943);})['catch'](function(_0x349f24){logger[_0x138c('0x15')]('ShowChatQueue',_0x349f24[_0x138c('0x17')],_0x616057);_0x348a12(_0x2b433d[_0x138c('0x15')](0x1f4,_0x349f24['message']));});});};
\ No newline at end of file
index 05f0169..9f65878 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5636=['save','emit','removeListener','register','length','chatQueue:','./chatQueue.events'];(function(_0x39435c,_0x6711f6){var _0x398761=function(_0x47c434){while(--_0x47c434){_0x39435c['push'](_0x39435c['shift']());}};_0x398761(++_0x6711f6);}(_0x5636,0x102));var _0x6563=function(_0x1ce5d4,_0x2fc383){_0x1ce5d4=_0x1ce5d4-0x0;var _0x34efe6=_0x5636[_0x1ce5d4];return _0x34efe6;};'use strict';var ChatQueueEvents=require(_0x6563('0x0'));var events=[_0x6563('0x1'),'remove','update'];function createListener(_0x579d5c,_0x44872c){return function(_0x3a95f7){_0x44872c[_0x6563('0x2')](_0x579d5c,_0x3a95f7);};}function removeListener(_0x4ac653,_0x166a58){return function(){ChatQueueEvents[_0x6563('0x3')](_0x4ac653,_0x166a58);};}exports[_0x6563('0x4')]=function(_0x39792f){for(var _0x29f687=0x0,_0x193942=events[_0x6563('0x5')];_0x29f687<_0x193942;_0x29f687++){var _0x2d57d5=events[_0x29f687];var _0x2d0d5b=createListener(_0x6563('0x6')+_0x2d57d5,_0x39792f);ChatQueueEvents['on'](_0x2d57d5,_0x2d0d5b);}};
\ No newline at end of file
+var _0x9b67=['register','length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x58ae46,_0x51fb19){var _0x12b35b=function(_0x244079){while(--_0x244079){_0x58ae46['push'](_0x58ae46['shift']());}};_0x12b35b(++_0x51fb19);}(_0x9b67,0xf6));var _0x79b6=function(_0x1bd7eb,_0x5e589e){_0x1bd7eb=_0x1bd7eb-0x0;var _0x5b5303=_0x9b67[_0x1bd7eb];return _0x5b5303;};'use strict';var ChatQueueEvents=require(_0x79b6('0x0'));var events=[_0x79b6('0x1'),_0x79b6('0x2'),_0x79b6('0x3')];function createListener(_0x29728d,_0x5523a1){return function(_0x3ba25a){_0x5523a1[_0x79b6('0x4')](_0x29728d,_0x3ba25a);};}function removeListener(_0x5297d0,_0x4e8794){return function(){ChatQueueEvents[_0x79b6('0x5')](_0x5297d0,_0x4e8794);};}exports[_0x79b6('0x6')]=function(_0x258103){for(var _0xec367e=0x0,_0xfa6a05=events[_0x79b6('0x7')];_0xec367e<_0xfa6a05;_0xec367e++){var _0x34adbe=events[_0xec367e];var _0x58ae2d=createListener(_0x79b6('0x8')+_0x34adbe,_0x258103);ChatQueueEvents['on'](_0x34adbe,_0x58ae2d);}};
\ No newline at end of file
index 8b56cbc..3f93614 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x3f086c,_0x1c58dc){var _0x1a0ffe=function(_0x48bd2e){while(--_0x48bd2e){_0x3f086c['push'](_0x3f086c['shift']());}};_0x1a0ffe(++_0x1c58dc);}(_0x55ca,0x126));var _0xa55c=function(_0x58d8d7,_0x108377){_0x58d8d7=_0x58d8d7-0x0;var _0x339d20=_0x55ca[_0x58d8d7];return _0x339d20;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router;
\ No newline at end of file
+var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x25c797,_0x3eef5d){var _0x1f1ed3=function(_0x35213c){while(--_0x35213c){_0x25c797['push'](_0x25c797['shift']());}};_0x1f1ed3(++_0x3eef5d);}(_0x814b,0x1a2));var _0xb814=function(_0x42bb6d,_0x412255){_0x42bb6d=_0x42bb6d-0x0;var _0x1db89b=_0x814b[_0x42bb6d];return _0x1db89b;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router;
\ No newline at end of file
index 35b450d..fefc8d0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb582=['STRING','DATE','moment','exports'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xb582,0xda));var _0x2b58=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb582[_0x3bf83f];return _0x22c4a9;};'use strict';var moment=require(_0x2b58('0x0'));var Sequelize=require('sequelize');module[_0x2b58('0x1')]={'uniqueid':{'type':Sequelize[_0x2b58('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2b58('0x2')]},'joinAt':{'type':Sequelize[_0x2b58('0x3')]},'leaveAt':{'type':Sequelize[_0x2b58('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2b58('0x3')]},'reason':{'type':Sequelize[_0x2b58('0x2')]}};
\ No newline at end of file
+var _0x8071=['DATE','moment','STRING'];(function(_0x592725,_0x2352bf){var _0x260019=function(_0x570cf1){while(--_0x570cf1){_0x592725['push'](_0x592725['shift']());}};_0x260019(++_0x2352bf);}(_0x8071,0x1c3));var _0x1807=function(_0x60e93b,_0x5b2c66){_0x60e93b=_0x60e93b-0x0;var _0x10ceb7=_0x8071[_0x60e93b];return _0x10ceb7;};'use strict';var moment=require(_0x1807('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x1807('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x1807('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x1807('0x2')]},'acceptAt':{'type':Sequelize[_0x1807('0x2')]},'exitAt':{'type':Sequelize[_0x1807('0x2')]},'reason':{'type':Sequelize['STRING']}};
\ No newline at end of file
index fc9d2d0..fb594ac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb1ad=['rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','ChatQueueReport','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','pick','filters','filter','where','merge','options','then','includeAll','include'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb1ad,0x184));var _0xdb1a=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xb1ad[_0xf0bcac];return _0x4e4c65;};'use strict';var emlformat=require(_0xdb1a('0x0'));var rimraf=require(_0xdb1a('0x1'));var zipdir=require(_0xdb1a('0x2'));var jsonpatch=require(_0xdb1a('0x3'));var rp=require(_0xdb1a('0x4'));var moment=require(_0xdb1a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdb1a('0x6'));var util=require(_0xdb1a('0x7'));var path=require(_0xdb1a('0x8'));var sox=require(_0xdb1a('0x9'));var csv=require(_0xdb1a('0xa'));var ejs=require(_0xdb1a('0xb'));var fs=require('fs');var fs_extra=require(_0xdb1a('0xc'));var _=require(_0xdb1a('0xd'));var squel=require(_0xdb1a('0xe'));var crypto=require(_0xdb1a('0xf'));var jsforce=require(_0xdb1a('0x10'));var deskjs=require(_0xdb1a('0x11'));var toCsv=require(_0xdb1a('0xa'));var querystring=require(_0xdb1a('0x12'));var Papa=require(_0xdb1a('0x13'));var Redis=require('ioredis');var authService=require(_0xdb1a('0x14'));var qs=require(_0xdb1a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdb1a('0x16'));var utils=require(_0xdb1a('0x17'));var config=require(_0xdb1a('0x18'));var licenseUtil=require(_0xdb1a('0x19'));var db=require(_0xdb1a('0x1a'))['db'];function respondWithStatusCode(_0x31ccd3,_0x3ca28b){_0x3ca28b=_0x3ca28b||0xcc;return function(_0x1c40c8){if(_0x1c40c8){return _0x31ccd3[_0xdb1a('0x1b')](_0x3ca28b);}return _0x31ccd3[_0xdb1a('0x1c')](_0x3ca28b)[_0xdb1a('0x1d')]();};}function respondWithResult(_0x1d69dd,_0x857c00){_0x857c00=_0x857c00||0xc8;return function(_0x5aa761){if(_0x5aa761){return _0x1d69dd[_0xdb1a('0x1c')](_0x857c00)[_0xdb1a('0x1e')](_0x5aa761);}};}function respondWithFilteredResult(_0x112be1,_0x4bdec7){return function(_0x28dfe9){if(_0x28dfe9){var _0x504d92=typeof _0x4bdec7[_0xdb1a('0x1f')]===_0xdb1a('0x20')&&typeof _0x4bdec7[_0xdb1a('0x21')]==='undefined';var _0x9ffb77=_0x28dfe9[_0xdb1a('0x22')];var _0x268ce8=_0x504d92?0x0:_0x4bdec7['offset'];var _0xe3780b=_0x504d92?_0x28dfe9[_0xdb1a('0x22')]:_0x4bdec7[_0xdb1a('0x1f')]+_0x4bdec7[_0xdb1a('0x21')];var _0x37e10c;if(_0xe3780b>=_0x9ffb77){_0xe3780b=_0x9ffb77;_0x37e10c=0xc8;}else{_0x37e10c=0xce;}_0x112be1[_0xdb1a('0x1c')](_0x37e10c);return _0x112be1['set'](_0xdb1a('0x23'),_0x268ce8+'-'+_0xe3780b+'/'+_0x9ffb77)[_0xdb1a('0x1e')](_0x28dfe9);}return null;};}function patchUpdates(_0x386e32){return function(_0x37b776){try{jsonpatch[_0xdb1a('0x24')](_0x37b776,_0x386e32,!![]);}catch(_0x400397){return BPromise[_0xdb1a('0x25')](_0x400397);}return _0x37b776[_0xdb1a('0x26')]();};}function saveUpdates(_0x3a9b3a,_0xc92d26){return function(_0x4d1d09){if(_0x4d1d09){return _0x4d1d09[_0xdb1a('0x27')](_0x3a9b3a)['then'](function(_0x28ccfe){return _0x28ccfe;});}return null;};}function removeEntity(_0x2cc1aa,_0x3d07fc){return function(_0x5d3d24){if(_0x5d3d24){return _0x5d3d24[_0xdb1a('0x28')]()['then'](function(){_0x2cc1aa[_0xdb1a('0x1c')](0xcc)[_0xdb1a('0x1d')]();});}};}function handleEntityNotFound(_0x22c95e,_0x157c6a){return function(_0xaa6f2e){if(!_0xaa6f2e){_0x22c95e[_0xdb1a('0x1b')](0x194);}return _0xaa6f2e;};}function handleError(_0x22c260,_0x2e814e){_0x2e814e=_0x2e814e||0x1f4;return function(_0x5c963b){logger['error'](_0x5c963b[_0xdb1a('0x29')]);if(_0x5c963b[_0xdb1a('0x2a')]){delete _0x5c963b[_0xdb1a('0x2a')];}_0x22c260[_0xdb1a('0x1c')](_0x2e814e)[_0xdb1a('0x2b')](_0x5c963b);};}exports[_0xdb1a('0x2c')]=function(_0x5d1514,_0x3ec2f6){var _0x51f0ff={},_0x5a67c4={},_0xbfa09f={'count':0x0,'rows':[]};var _0x51a26d=_['map'](db[_0xdb1a('0x2d')][_0xdb1a('0x2e')],function(_0x46d019){return{'name':_0x46d019['fieldName'],'type':_0x46d019[_0xdb1a('0x2f')][_0xdb1a('0x30')]};});_0x5a67c4[_0xdb1a('0x31')]=_[_0xdb1a('0x32')](_0x51a26d,'name');_0x5a67c4[_0xdb1a('0x33')]=_[_0xdb1a('0x34')](_0x5d1514[_0xdb1a('0x33')]);_0x5a67c4['filters']=_[_0xdb1a('0x35')](_0x5a67c4[_0xdb1a('0x31')],_0x5a67c4[_0xdb1a('0x33')]);_0x51f0ff[_0xdb1a('0x36')]=_['intersection'](_0x5a67c4['model'],qs['fields'](_0x5d1514[_0xdb1a('0x33')][_0xdb1a('0x37')]));_0x51f0ff['attributes']=_0x51f0ff[_0xdb1a('0x36')][_0xdb1a('0x38')]?_0x51f0ff[_0xdb1a('0x36')]:_0x5a67c4[_0xdb1a('0x31')];if(!_0x5d1514[_0xdb1a('0x33')]['hasOwnProperty']('nolimit')){_0x51f0ff['limit']=qs[_0xdb1a('0x21')](_0x5d1514['query']['limit']);_0x51f0ff[_0xdb1a('0x1f')]=qs[_0xdb1a('0x1f')](_0x5d1514['query'][_0xdb1a('0x1f')]);}_0x51f0ff[_0xdb1a('0x39')]=qs[_0xdb1a('0x3a')](_0x5d1514[_0xdb1a('0x33')][_0xdb1a('0x3a')]);_0x51f0ff['where']=qs['filters'](_[_0xdb1a('0x3b')](_0x5d1514[_0xdb1a('0x33')],_0x5a67c4[_0xdb1a('0x3c')]),_0x51a26d);if(_0x5d1514[_0xdb1a('0x33')][_0xdb1a('0x3d')]){_0x51f0ff[_0xdb1a('0x3e')]=_[_0xdb1a('0x3f')](_0x51f0ff['where'],{'$or':_[_0xdb1a('0x32')](_0x51a26d,function(_0x5ba671){if(_0x5ba671['type']!=='VIRTUAL'){var _0x4a4366={};_0x4a4366[_0x5ba671[_0xdb1a('0x2a')]]={'$like':'%'+_0x5d1514[_0xdb1a('0x33')][_0xdb1a('0x3d')]+'%'};return _0x4a4366;}})});}_0x51f0ff=_[_0xdb1a('0x3f')]({},_0x51f0ff,_0x5d1514[_0xdb1a('0x40')]);var _0x5f535d={'where':_0x51f0ff[_0xdb1a('0x3e')]};return db[_0xdb1a('0x2d')][_0xdb1a('0x22')](_0x5f535d)[_0xdb1a('0x41')](function(_0xcffe52){_0xbfa09f[_0xdb1a('0x22')]=_0xcffe52;if(_0x5d1514[_0xdb1a('0x33')][_0xdb1a('0x42')]){_0x51f0ff[_0xdb1a('0x43')]=[{'all':!![]}];}return db[_0xdb1a('0x2d')]['findAll'](_0x51f0ff);})['then'](function(_0x43e27a){_0xbfa09f[_0xdb1a('0x44')]=_0x43e27a;return _0xbfa09f;})[_0xdb1a('0x41')](respondWithFilteredResult(_0x3ec2f6,_0x51f0ff))[_0xdb1a('0x45')](handleError(_0x3ec2f6,null));};exports[_0xdb1a('0x46')]=function(_0x4572d,_0x149fd6){var _0xad79f2={'raw':!![],'where':{'id':_0x4572d[_0xdb1a('0x47')]['id']}},_0xcb156c={};_0xcb156c[_0xdb1a('0x31')]=_[_0xdb1a('0x34')](db[_0xdb1a('0x2d')]['rawAttributes']);_0xcb156c[_0xdb1a('0x33')]=_[_0xdb1a('0x34')](_0x4572d[_0xdb1a('0x33')]);_0xcb156c[_0xdb1a('0x3c')]=_[_0xdb1a('0x35')](_0xcb156c[_0xdb1a('0x31')],_0xcb156c[_0xdb1a('0x33')]);_0xad79f2['attributes']=_['intersection'](_0xcb156c['model'],qs[_0xdb1a('0x37')](_0x4572d[_0xdb1a('0x33')]['fields']));_0xad79f2[_0xdb1a('0x36')]=_0xad79f2[_0xdb1a('0x36')]['length']?_0xad79f2['attributes']:_0xcb156c[_0xdb1a('0x31')];if(_0x4572d[_0xdb1a('0x33')]['includeAll']){_0xad79f2[_0xdb1a('0x43')]=[{'all':!![]}];}_0xad79f2=_[_0xdb1a('0x3f')]({},_0xad79f2,_0x4572d[_0xdb1a('0x40')]);return db['ChatQueueReport'][_0xdb1a('0x48')](_0xad79f2)[_0xdb1a('0x41')](handleEntityNotFound(_0x149fd6,null))[_0xdb1a('0x41')](respondWithResult(_0x149fd6,null))[_0xdb1a('0x45')](handleError(_0x149fd6,null));};exports['create']=function(_0x37aa5e,_0x452aa8){return db[_0xdb1a('0x2d')][_0xdb1a('0x49')](_0x37aa5e['body'],{})[_0xdb1a('0x41')](respondWithResult(_0x452aa8,0xc9))[_0xdb1a('0x45')](handleError(_0x452aa8,null));};exports[_0xdb1a('0x27')]=function(_0x367b1f,_0x40b193){if(_0x367b1f[_0xdb1a('0x4a')]['id']){delete _0x367b1f[_0xdb1a('0x4a')]['id'];}return db[_0xdb1a('0x2d')][_0xdb1a('0x48')]({'where':{'id':_0x367b1f[_0xdb1a('0x47')]['id']}})['then'](handleEntityNotFound(_0x40b193,null))['then'](saveUpdates(_0x367b1f['body'],null))[_0xdb1a('0x41')](respondWithResult(_0x40b193,null))[_0xdb1a('0x45')](handleError(_0x40b193,null));};exports[_0xdb1a('0x28')]=function(_0x3b018c,_0x32faa7){return db[_0xdb1a('0x2d')][_0xdb1a('0x48')]({'where':{'id':_0x3b018c['params']['id']}})['then'](handleEntityNotFound(_0x32faa7,null))['then'](removeEntity(_0x32faa7,null))['catch'](handleError(_0x32faa7,null));};exports[_0xdb1a('0x4b')]=function(_0x1f6115,_0x5663f1){return db['ChatQueueReport']['describe']()[_0xdb1a('0x41')](respondWithResult(_0x5663f1,null))[_0xdb1a('0x45')](handleError(_0x5663f1,null));};
\ No newline at end of file
+var _0x1bb4=['Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set'];(function(_0x544362,_0xc31c04){var _0x5c12f9=function(_0x365c8b){while(--_0x365c8b){_0x544362['push'](_0x544362['shift']());}};_0x5c12f9(++_0xc31c04);}(_0x1bb4,0x1c7));var _0x41bb=function(_0x46c1b9,_0x41b03b){_0x46c1b9=_0x46c1b9-0x0;var _0x5c2993=_0x1bb4[_0x46c1b9];return _0x5c2993;};'use strict';var emlformat=require(_0x41bb('0x0'));var rimraf=require(_0x41bb('0x1'));var zipdir=require(_0x41bb('0x2'));var jsonpatch=require(_0x41bb('0x3'));var rp=require(_0x41bb('0x4'));var moment=require('moment');var BPromise=require(_0x41bb('0x5'));var Mustache=require('mustache');var util=require(_0x41bb('0x6'));var path=require('path');var sox=require(_0x41bb('0x7'));var csv=require('to-csv');var ejs=require(_0x41bb('0x8'));var fs=require('fs');var fs_extra=require(_0x41bb('0x9'));var _=require(_0x41bb('0xa'));var squel=require('squel');var crypto=require(_0x41bb('0xb'));var jsforce=require(_0x41bb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x41bb('0xd'));var querystring=require(_0x41bb('0xe'));var Papa=require(_0x41bb('0xf'));var Redis=require('ioredis');var authService=require(_0x41bb('0x10'));var qs=require(_0x41bb('0x11'));var as=require(_0x41bb('0x12'));var hardwareService=require(_0x41bb('0x13'));var logger=require(_0x41bb('0x14'))('api');var utils=require(_0x41bb('0x15'));var config=require(_0x41bb('0x16'));var licenseUtil=require(_0x41bb('0x17'));var db=require(_0x41bb('0x18'))['db'];function respondWithStatusCode(_0x28c08a,_0x233473){_0x233473=_0x233473||0xcc;return function(_0x1f4b78){if(_0x1f4b78){return _0x28c08a[_0x41bb('0x19')](_0x233473);}return _0x28c08a['status'](_0x233473)['end']();};}function respondWithResult(_0x4bfeae,_0x43fd1f){_0x43fd1f=_0x43fd1f||0xc8;return function(_0x46a7ec){if(_0x46a7ec){return _0x4bfeae[_0x41bb('0x1a')](_0x43fd1f)['json'](_0x46a7ec);}};}function respondWithFilteredResult(_0x514d8f,_0x18bf70){return function(_0xa66c46){if(_0xa66c46){var _0xfa8f14=typeof _0x18bf70[_0x41bb('0x1b')]===_0x41bb('0x1c')&&typeof _0x18bf70['limit']===_0x41bb('0x1c');var _0x5a8de5=_0xa66c46[_0x41bb('0x1d')];var _0x3fa4a4=_0xfa8f14?0x0:_0x18bf70['offset'];var _0xc202d0=_0xfa8f14?_0xa66c46[_0x41bb('0x1d')]:_0x18bf70['offset']+_0x18bf70['limit'];var _0x3755d7;if(_0xc202d0>=_0x5a8de5){_0xc202d0=_0x5a8de5;_0x3755d7=0xc8;}else{_0x3755d7=0xce;}_0x514d8f['status'](_0x3755d7);return _0x514d8f[_0x41bb('0x1e')](_0x41bb('0x1f'),_0x3fa4a4+'-'+_0xc202d0+'/'+_0x5a8de5)[_0x41bb('0x20')](_0xa66c46);}return null;};}function patchUpdates(_0x2be518){return function(_0x2765e7){try{jsonpatch[_0x41bb('0x21')](_0x2765e7,_0x2be518,!![]);}catch(_0x44d02d){return BPromise[_0x41bb('0x22')](_0x44d02d);}return _0x2765e7[_0x41bb('0x23')]();};}function saveUpdates(_0x407480,_0x5bd58f){return function(_0x29b356){if(_0x29b356){return _0x29b356[_0x41bb('0x24')](_0x407480)[_0x41bb('0x25')](function(_0x177209){return _0x177209;});}return null;};}function removeEntity(_0x54ec2a,_0x4d065e){return function(_0x1a43ad){if(_0x1a43ad){return _0x1a43ad[_0x41bb('0x26')]()[_0x41bb('0x25')](function(){_0x54ec2a['status'](0xcc)[_0x41bb('0x27')]();});}};}function handleEntityNotFound(_0x19bd28,_0x592239){return function(_0x310f09){if(!_0x310f09){_0x19bd28[_0x41bb('0x19')](0x194);}return _0x310f09;};}function handleError(_0x20ebe6,_0x2fba16){_0x2fba16=_0x2fba16||0x1f4;return function(_0x440d33){logger[_0x41bb('0x28')](_0x440d33[_0x41bb('0x29')]);if(_0x440d33[_0x41bb('0x2a')]){delete _0x440d33[_0x41bb('0x2a')];}_0x20ebe6[_0x41bb('0x1a')](_0x2fba16)[_0x41bb('0x2b')](_0x440d33);};}exports[_0x41bb('0x2c')]=function(_0x430131,_0x16b1f6){var _0x148ea5={},_0x4645c8={},_0x501f78={'count':0x0,'rows':[]};var _0x32af99=_[_0x41bb('0x2d')](db[_0x41bb('0x2e')][_0x41bb('0x2f')],function(_0x3a3d23){return{'name':_0x3a3d23[_0x41bb('0x30')],'type':_0x3a3d23[_0x41bb('0x31')][_0x41bb('0x32')]};});_0x4645c8[_0x41bb('0x33')]=_[_0x41bb('0x2d')](_0x32af99,_0x41bb('0x2a'));_0x4645c8[_0x41bb('0x34')]=_[_0x41bb('0x35')](_0x430131[_0x41bb('0x34')]);_0x4645c8[_0x41bb('0x36')]=_[_0x41bb('0x37')](_0x4645c8['model'],_0x4645c8[_0x41bb('0x34')]);_0x148ea5[_0x41bb('0x38')]=_[_0x41bb('0x37')](_0x4645c8[_0x41bb('0x33')],qs[_0x41bb('0x39')](_0x430131[_0x41bb('0x34')][_0x41bb('0x39')]));_0x148ea5['attributes']=_0x148ea5['attributes'][_0x41bb('0x3a')]?_0x148ea5[_0x41bb('0x38')]:_0x4645c8[_0x41bb('0x33')];if(!_0x430131[_0x41bb('0x34')][_0x41bb('0x3b')](_0x41bb('0x3c'))){_0x148ea5[_0x41bb('0x3d')]=qs[_0x41bb('0x3d')](_0x430131['query']['limit']);_0x148ea5['offset']=qs[_0x41bb('0x1b')](_0x430131[_0x41bb('0x34')][_0x41bb('0x1b')]);}_0x148ea5[_0x41bb('0x3e')]=qs[_0x41bb('0x3f')](_0x430131['query'][_0x41bb('0x3f')]);_0x148ea5[_0x41bb('0x40')]=qs[_0x41bb('0x36')](_[_0x41bb('0x41')](_0x430131[_0x41bb('0x34')],_0x4645c8[_0x41bb('0x36')]),_0x32af99);if(_0x430131[_0x41bb('0x34')][_0x41bb('0x42')]){_0x148ea5[_0x41bb('0x40')]=_[_0x41bb('0x43')](_0x148ea5['where'],{'$or':_['map'](_0x32af99,function(_0x5f22eb){if(_0x5f22eb[_0x41bb('0x31')]!==_0x41bb('0x44')){var _0x3ac009={};_0x3ac009[_0x5f22eb[_0x41bb('0x2a')]]={'$like':'%'+_0x430131['query'][_0x41bb('0x42')]+'%'};return _0x3ac009;}})});}_0x148ea5=_[_0x41bb('0x43')]({},_0x148ea5,_0x430131['options']);var _0x4df15e={'where':_0x148ea5[_0x41bb('0x40')]};return db[_0x41bb('0x2e')]['count'](_0x4df15e)[_0x41bb('0x25')](function(_0x4aa5dc){_0x501f78[_0x41bb('0x1d')]=_0x4aa5dc;if(_0x430131[_0x41bb('0x34')][_0x41bb('0x45')]){_0x148ea5[_0x41bb('0x46')]=[{'all':!![]}];}return db[_0x41bb('0x2e')][_0x41bb('0x47')](_0x148ea5);})[_0x41bb('0x25')](function(_0x4e0c7d){_0x501f78[_0x41bb('0x48')]=_0x4e0c7d;return _0x501f78;})[_0x41bb('0x25')](respondWithFilteredResult(_0x16b1f6,_0x148ea5))['catch'](handleError(_0x16b1f6,null));};exports[_0x41bb('0x49')]=function(_0x14a908,_0x6a5364){var _0x59ed00={'raw':!![],'where':{'id':_0x14a908[_0x41bb('0x4a')]['id']}},_0x2deafc={};_0x2deafc[_0x41bb('0x33')]=_['keys'](db[_0x41bb('0x2e')][_0x41bb('0x2f')]);_0x2deafc[_0x41bb('0x34')]=_[_0x41bb('0x35')](_0x14a908[_0x41bb('0x34')]);_0x2deafc[_0x41bb('0x36')]=_[_0x41bb('0x37')](_0x2deafc[_0x41bb('0x33')],_0x2deafc['query']);_0x59ed00[_0x41bb('0x38')]=_[_0x41bb('0x37')](_0x2deafc[_0x41bb('0x33')],qs['fields'](_0x14a908[_0x41bb('0x34')][_0x41bb('0x39')]));_0x59ed00[_0x41bb('0x38')]=_0x59ed00[_0x41bb('0x38')][_0x41bb('0x3a')]?_0x59ed00[_0x41bb('0x38')]:_0x2deafc['model'];if(_0x14a908['query']['includeAll']){_0x59ed00[_0x41bb('0x46')]=[{'all':!![]}];}_0x59ed00=_[_0x41bb('0x43')]({},_0x59ed00,_0x14a908[_0x41bb('0x4b')]);return db['ChatQueueReport']['find'](_0x59ed00)['then'](handleEntityNotFound(_0x6a5364,null))[_0x41bb('0x25')](respondWithResult(_0x6a5364,null))[_0x41bb('0x4c')](handleError(_0x6a5364,null));};exports[_0x41bb('0x4d')]=function(_0x239a67,_0x69292a){return db[_0x41bb('0x2e')]['create'](_0x239a67[_0x41bb('0x4e')],{})[_0x41bb('0x25')](respondWithResult(_0x69292a,0xc9))[_0x41bb('0x4c')](handleError(_0x69292a,null));};exports['update']=function(_0x590f8f,_0x5d2e2e){if(_0x590f8f[_0x41bb('0x4e')]['id']){delete _0x590f8f[_0x41bb('0x4e')]['id'];}return db[_0x41bb('0x2e')][_0x41bb('0x4f')]({'where':{'id':_0x590f8f[_0x41bb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d2e2e,null))[_0x41bb('0x25')](saveUpdates(_0x590f8f[_0x41bb('0x4e')],null))['then'](respondWithResult(_0x5d2e2e,null))[_0x41bb('0x4c')](handleError(_0x5d2e2e,null));};exports[_0x41bb('0x26')]=function(_0x45ef28,_0x57cd4c){return db[_0x41bb('0x2e')]['find']({'where':{'id':_0x45ef28[_0x41bb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57cd4c,null))[_0x41bb('0x25')](removeEntity(_0x57cd4c,null))[_0x41bb('0x4c')](handleError(_0x57cd4c,null));};exports['describe']=function(_0x15e4c3,_0x56f98a){return db['ChatQueueReport'][_0x41bb('0x50')]()[_0x41bb('0x25')](respondWithResult(_0x56f98a,null))[_0x41bb('0x4c')](handleError(_0x56f98a,null));};
\ No newline at end of file
index 29eb306..40e67a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x568f96,_0x32d489){var _0x5a053a=function(_0x5570ce){while(--_0x5570ce){_0x568f96['push'](_0x568f96['shift']());}};_0x5a053a(++_0x32d489);}(_0xe706,0xa3));var _0x6e70=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xe706[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x15febe,_0x3c679d){var _0xac6441=function(_0x3a8d26){while(--_0x3a8d26){_0x15febe['push'](_0x15febe['shift']());}};_0xac6441(++_0x3c679d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
index 01a67cf..d44741e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6de8=['ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateChatQueueReport','ChatQueueReport','body','raw','info','update','options','attributes','limit','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x6de8,0x183));var _0x86de=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x6de8[_0x19dd7a];return _0x3feb6a;};'use strict';var _=require(_0x86de('0x0'));var util=require('util');var moment=require(_0x86de('0x1'));var BPromise=require(_0x86de('0x2'));var rs=require(_0x86de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x86de('0x4'));var logger=require(_0x86de('0x5'))(_0x86de('0x6'));var config=require(_0x86de('0x7'));var jayson=require(_0x86de('0x8'));var client=jayson[_0x86de('0x9')][_0x86de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c0b62,_0x4b3fca,_0x49abd4){return new BPromise(function(_0x2613fd,_0x6d2331){return client[_0x86de('0xb')](_0x1c0b62,_0x49abd4)[_0x86de('0xc')](function(_0xdf7986){logger['info'](_0x86de('0xd'),_0x4b3fca,_0x86de('0xe'));logger[_0x86de('0xf')](_0x86de('0x10'),_0x4b3fca,_0x86de('0xe'),JSON[_0x86de('0x11')](_0xdf7986));if(_0xdf7986[_0x86de('0x12')]){if(_0xdf7986[_0x86de('0x12')]['code']===0x1f4){logger[_0x86de('0x12')](_0x86de('0xd'),_0x4b3fca,_0xdf7986[_0x86de('0x12')][_0x86de('0x13')]);return _0x6d2331(_0xdf7986[_0x86de('0x12')]['message']);}logger[_0x86de('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x4b3fca,_0xdf7986['error'][_0x86de('0x13')]);return _0x2613fd(_0xdf7986['error'][_0x86de('0x13')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x4b3fca,_0x86de('0xe'));_0x2613fd(_0xdf7986['result']['message']);}})[_0x86de('0x14')](function(_0x43b087){logger[_0x86de('0x12')](_0x86de('0xd'),_0x4b3fca,_0x43b087);_0x6d2331(_0x43b087);});});}exports[_0x86de('0x15')]=function(_0x5bf8a9){var _0x365303=this;return new Promise(function(_0x1538ce,_0x424aee){return db[_0x86de('0x16')]['create'](_0x5bf8a9[_0x86de('0x17')],{'raw':_0x5bf8a9['options']?_0x5bf8a9['options'][_0x86de('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x56f3a6){logger[_0x86de('0x19')]('CreateChatQueueReport',_0x5bf8a9);logger[_0x86de('0xf')](_0x86de('0x15'),_0x5bf8a9,JSON[_0x86de('0x11')](_0x56f3a6));_0x1538ce(_0x56f3a6);})['catch'](function(_0x2bde12){logger[_0x86de('0x12')]('CreateChatQueueReport',_0x2bde12[_0x86de('0x13')],_0x5bf8a9);_0x424aee(_0x365303[_0x86de('0x12')](0x1f4,_0x2bde12[_0x86de('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0x7f72ef){var _0x31c941=this;return new Promise(function(_0x53219f,_0x232cda){return db['ChatQueueReport'][_0x86de('0x1a')](_0x7f72ef['body'],{'raw':_0x7f72ef[_0x86de('0x1b')]?_0x7f72ef[_0x86de('0x1b')][_0x86de('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7f72ef[_0x86de('0x1b')]?_0x7f72ef[_0x86de('0x1b')]['where']||null:null,'attributes':_0x7f72ef[_0x86de('0x1b')]?_0x7f72ef[_0x86de('0x1b')][_0x86de('0x1c')]||null:null,'limit':_0x7f72ef['options']?_0x7f72ef['options'][_0x86de('0x1d')]||null:null})['then'](function(_0xab482c){logger[_0x86de('0x19')]('UpdateChatQueueReport',_0x7f72ef);logger['debug'](_0x86de('0x1e'),_0x7f72ef,JSON[_0x86de('0x11')](_0xab482c));_0x53219f(_0xab482c);})[_0x86de('0x14')](function(_0x15779e){logger[_0x86de('0x12')](_0x86de('0x1e'),_0x15779e['message'],_0x7f72ef);_0x232cda(_0x31c941[_0x86de('0x12')](0x1f4,_0x15779e[_0x86de('0x13')]));});});};
\ No newline at end of file
+var _0x2f93=['raw','UpdateChatQueueReport','ChatQueueReport','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateChatQueueReport','create','options'];(function(_0x30f87a,_0x2cce5a){var _0x3a8efc=function(_0x225d6b){while(--_0x225d6b){_0x30f87a['push'](_0x30f87a['shift']());}};_0x3a8efc(++_0x2cce5a);}(_0x2f93,0x165));var _0x32f9=function(_0x7efbd,_0x158b95){_0x7efbd=_0x7efbd-0x0;var _0x2ad16b=_0x2f93[_0x7efbd];return _0x2ad16b;};'use strict';var _=require(_0x32f9('0x0'));var util=require(_0x32f9('0x1'));var moment=require(_0x32f9('0x2'));var BPromise=require(_0x32f9('0x3'));var rs=require(_0x32f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32f9('0x5'))['db'];var utils=require(_0x32f9('0x6'));var logger=require(_0x32f9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x32f9('0x8'));var client=jayson[_0x32f9('0x9')][_0x32f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26391d,_0x24e9cd,_0x261707){return new BPromise(function(_0x4957d4,_0x500288){return client[_0x32f9('0xb')](_0x26391d,_0x261707)[_0x32f9('0xc')](function(_0x27e7bd){logger['info'](_0x32f9('0xd'),_0x24e9cd,_0x32f9('0xe'));logger[_0x32f9('0xf')](_0x32f9('0x10'),_0x24e9cd,_0x32f9('0xe'),JSON[_0x32f9('0x11')](_0x27e7bd));if(_0x27e7bd[_0x32f9('0x12')]){if(_0x27e7bd[_0x32f9('0x12')][_0x32f9('0x13')]===0x1f4){logger[_0x32f9('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x24e9cd,_0x27e7bd[_0x32f9('0x12')][_0x32f9('0x14')]);return _0x500288(_0x27e7bd[_0x32f9('0x12')][_0x32f9('0x14')]);}logger['error'](_0x32f9('0xd'),_0x24e9cd,_0x27e7bd['error'][_0x32f9('0x14')]);return _0x4957d4(_0x27e7bd[_0x32f9('0x12')]['message']);}else{logger[_0x32f9('0x15')](_0x32f9('0xd'),_0x24e9cd,_0x32f9('0xe'));_0x4957d4(_0x27e7bd[_0x32f9('0x16')]['message']);}})[_0x32f9('0x17')](function(_0x2c298e){logger[_0x32f9('0x12')](_0x32f9('0xd'),_0x24e9cd,_0x2c298e);_0x500288(_0x2c298e);});});}exports[_0x32f9('0x18')]=function(_0x49e45c){var _0x315f3e=this;return new Promise(function(_0x1ba219,_0x474567){return db['ChatQueueReport'][_0x32f9('0x19')](_0x49e45c['body'],{'raw':_0x49e45c['options']?_0x49e45c[_0x32f9('0x1a')][_0x32f9('0x1b')]===undefined?!![]:![]:!![]})[_0x32f9('0xc')](function(_0x239c25){logger[_0x32f9('0x15')]('CreateChatQueueReport',_0x49e45c);logger[_0x32f9('0xf')](_0x32f9('0x18'),_0x49e45c,JSON[_0x32f9('0x11')](_0x239c25));_0x1ba219(_0x239c25);})[_0x32f9('0x17')](function(_0x3c1177){logger['error'](_0x32f9('0x18'),_0x3c1177['message'],_0x49e45c);_0x474567(_0x315f3e[_0x32f9('0x12')](0x1f4,_0x3c1177[_0x32f9('0x14')]));});});};exports[_0x32f9('0x1c')]=function(_0x1e7ab8){var _0x3f190f=this;return new Promise(function(_0x2b7594,_0xa7a9a4){return db[_0x32f9('0x1d')]['update'](_0x1e7ab8['body'],{'raw':_0x1e7ab8[_0x32f9('0x1a')]?_0x1e7ab8[_0x32f9('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e7ab8[_0x32f9('0x1a')]?_0x1e7ab8['options']['where']||null:null,'attributes':_0x1e7ab8[_0x32f9('0x1a')]?_0x1e7ab8[_0x32f9('0x1a')][_0x32f9('0x1e')]||null:null,'limit':_0x1e7ab8['options']?_0x1e7ab8[_0x32f9('0x1a')][_0x32f9('0x1f')]||null:null})[_0x32f9('0xc')](function(_0x3ad212){logger[_0x32f9('0x15')](_0x32f9('0x1c'),_0x1e7ab8);logger[_0x32f9('0xf')](_0x32f9('0x1c'),_0x1e7ab8,JSON[_0x32f9('0x11')](_0x3ad212));_0x2b7594(_0x3ad212);})[_0x32f9('0x17')](function(_0x584c15){logger['error'](_0x32f9('0x1c'),_0x584c15[_0x32f9('0x14')],_0x1e7ab8);_0xa7a9a4(_0x3f190f['error'](0x1f4,_0x584c15['message']));});});};
\ No newline at end of file
index 0b4f3f2..7923be4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe1c3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x546f24,_0x485e39){var _0x6c3dac=function(_0x5ee073){while(--_0x5ee073){_0x546f24['push'](_0x546f24['shift']());}};_0x6c3dac(++_0x485e39);}(_0xe1c3,0x1f4));var _0x3e1c=function(_0x3b177e,_0x1c427e){_0x3b177e=_0x3b177e-0x0;var _0x48139a=_0xe1c3[_0x3b177e];return _0x48139a;};'use strict';var multer=require(_0x3e1c('0x0'));var util=require(_0x3e1c('0x1'));var path=require(_0x3e1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x3e1c('0x3'));var router=express[_0x3e1c('0x4')]();var fs_extra=require(_0x3e1c('0x5'));var auth=require(_0x3e1c('0x6'));var interaction=require(_0x3e1c('0x7'));var config=require(_0x3e1c('0x8'));var controller=require(_0x3e1c('0x9'));router['get']('/',auth[_0x3e1c('0xa')](),controller[_0x3e1c('0xb')]);router[_0x3e1c('0xc')](_0x3e1c('0xd'),auth[_0x3e1c('0xa')](),controller[_0x3e1c('0xe')]);router[_0x3e1c('0xc')](_0x3e1c('0xf'),auth[_0x3e1c('0xa')](),controller[_0x3e1c('0x10')]);router[_0x3e1c('0x11')]('/',auth[_0x3e1c('0xa')](),controller[_0x3e1c('0x12')]);router[_0x3e1c('0x13')](_0x3e1c('0xf'),auth[_0x3e1c('0xa')](),controller[_0x3e1c('0x14')]);router[_0x3e1c('0x15')](_0x3e1c('0xf'),auth[_0x3e1c('0xa')](),controller[_0x3e1c('0x16')]);module[_0x3e1c('0x17')]=router;
\ No newline at end of file
+var _0xe5ff=['/describe','describe','/:id','show','post','update','delete','destroy','exports','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3a4a1d,_0x3ac661){var _0x5caf32=function(_0x45c2aa){while(--_0x45c2aa){_0x3a4a1d['push'](_0x3a4a1d['shift']());}};_0x5caf32(++_0x3ac661);}(_0xe5ff,0x109));var _0xfe5f=function(_0x19d6f2,_0x38aee2){_0x19d6f2=_0x19d6f2-0x0;var _0x3a44b2=_0xe5ff[_0x19d6f2];return _0x3a44b2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfe5f('0x0')]();var fs_extra=require(_0xfe5f('0x1'));var auth=require(_0xfe5f('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xfe5f('0x3'));var controller=require('./chatQueueReport.controller');router[_0xfe5f('0x4')]('/',auth[_0xfe5f('0x5')](),controller[_0xfe5f('0x6')]);router[_0xfe5f('0x4')](_0xfe5f('0x7'),auth[_0xfe5f('0x5')](),controller[_0xfe5f('0x8')]);router[_0xfe5f('0x4')](_0xfe5f('0x9'),auth[_0xfe5f('0x5')](),controller[_0xfe5f('0xa')]);router[_0xfe5f('0xb')]('/',auth[_0xfe5f('0x5')](),controller['create']);router['put'](_0xfe5f('0x9'),auth[_0xfe5f('0x5')](),controller[_0xfe5f('0xc')]);router[_0xfe5f('0xd')]('/:id',auth[_0xfe5f('0x5')](),controller[_0xfe5f('0xe')]);module[_0xfe5f('0xf')]=router;
\ No newline at end of file
index ce05361..4692b82 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0xb43b,0x1b2));var _0xbb43=function(_0x454cb8,_0x29b4a3){_0x454cb8=_0x454cb8-0x0;var _0x5e514f=_0xb43b[_0x454cb8];return _0x5e514f;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}};
\ No newline at end of file
+var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1f1283,_0x1bea3b){var _0x205041=function(_0x3f8fe4){while(--_0x3f8fe4){_0x1f1283['push'](_0x1f1283['shift']());}};_0x205041(++_0x1bea3b);}(_0xaa88,0x137));var _0x8aa8=function(_0x514260,_0x1891e1){_0x514260=_0x514260-0x0;var _0x4ac81b=_0xaa88[_0x514260];return _0x4ac81b;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}};
\ No newline at end of file
index 805a856..3ac5add 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb774=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','ChatTransferReport','includeAll','include','rows','show','rawAttributes','find','catch','create','body','params','describe','eml-format'];(function(_0x3e1bf6,_0x331cb4){var _0x9c411b=function(_0x179b4c){while(--_0x179b4c){_0x3e1bf6['push'](_0x3e1bf6['shift']());}};_0x9c411b(++_0x331cb4);}(_0xb774,0x1d3));var _0x4b77=function(_0xc303f7,_0x3cf575){_0xc303f7=_0xc303f7-0x0;var _0x5ae892=_0xb774[_0xc303f7];return _0x5ae892;};'use strict';var emlformat=require(_0x4b77('0x0'));var rimraf=require(_0x4b77('0x1'));var zipdir=require(_0x4b77('0x2'));var jsonpatch=require(_0x4b77('0x3'));var rp=require(_0x4b77('0x4'));var moment=require(_0x4b77('0x5'));var BPromise=require(_0x4b77('0x6'));var Mustache=require(_0x4b77('0x7'));var util=require(_0x4b77('0x8'));var path=require('path');var sox=require(_0x4b77('0x9'));var csv=require(_0x4b77('0xa'));var ejs=require(_0x4b77('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b77('0xc'));var squel=require('squel');var crypto=require(_0x4b77('0xd'));var jsforce=require(_0x4b77('0xe'));var deskjs=require(_0x4b77('0xf'));var toCsv=require(_0x4b77('0xa'));var querystring=require(_0x4b77('0x10'));var Papa=require(_0x4b77('0x11'));var Redis=require(_0x4b77('0x12'));var authService=require(_0x4b77('0x13'));var qs=require(_0x4b77('0x14'));var as=require(_0x4b77('0x15'));var hardwareService=require(_0x4b77('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4b77('0x17'));var config=require(_0x4b77('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b77('0x19'))['db'];function respondWithStatusCode(_0x154dae,_0x4ea8c7){_0x4ea8c7=_0x4ea8c7||0xcc;return function(_0x17a61b){if(_0x17a61b){return _0x154dae[_0x4b77('0x1a')](_0x4ea8c7);}return _0x154dae[_0x4b77('0x1b')](_0x4ea8c7)[_0x4b77('0x1c')]();};}function respondWithResult(_0xf50c74,_0x5305d4){_0x5305d4=_0x5305d4||0xc8;return function(_0x174b8a){if(_0x174b8a){return _0xf50c74[_0x4b77('0x1b')](_0x5305d4)[_0x4b77('0x1d')](_0x174b8a);}};}function respondWithFilteredResult(_0x4a17c5,_0x2f25ea){return function(_0x3cc1e0){if(_0x3cc1e0){var _0x50d1fd=typeof _0x2f25ea[_0x4b77('0x1e')]===_0x4b77('0x1f')&&typeof _0x2f25ea[_0x4b77('0x20')]===_0x4b77('0x1f');var _0x38cf18=_0x3cc1e0['count'];var _0x50ec9c=_0x50d1fd?0x0:_0x2f25ea['offset'];var _0x3a6408=_0x50d1fd?_0x3cc1e0[_0x4b77('0x21')]:_0x2f25ea['offset']+_0x2f25ea[_0x4b77('0x20')];var _0x4387aa;if(_0x3a6408>=_0x38cf18){_0x3a6408=_0x38cf18;_0x4387aa=0xc8;}else{_0x4387aa=0xce;}_0x4a17c5[_0x4b77('0x1b')](_0x4387aa);return _0x4a17c5[_0x4b77('0x22')](_0x4b77('0x23'),_0x50ec9c+'-'+_0x3a6408+'/'+_0x38cf18)[_0x4b77('0x1d')](_0x3cc1e0);}return null;};}function patchUpdates(_0x3bc556){return function(_0x1e8834){try{jsonpatch[_0x4b77('0x24')](_0x1e8834,_0x3bc556,!![]);}catch(_0x355d80){return BPromise['reject'](_0x355d80);}return _0x1e8834['save']();};}function saveUpdates(_0x35d12a,_0xa458d4){return function(_0x2e37b8){if(_0x2e37b8){return _0x2e37b8[_0x4b77('0x25')](_0x35d12a)[_0x4b77('0x26')](function(_0x4defc9){return _0x4defc9;});}return null;};}function removeEntity(_0x2f05c5,_0x47fb90){return function(_0x3acedb){if(_0x3acedb){return _0x3acedb[_0x4b77('0x27')]()['then'](function(){_0x2f05c5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d2a33,_0x2ab672){return function(_0x22e843){if(!_0x22e843){_0x4d2a33['sendStatus'](0x194);}return _0x22e843;};}function handleError(_0x1f43f3,_0x2d1dc5){_0x2d1dc5=_0x2d1dc5||0x1f4;return function(_0x42487b){logger[_0x4b77('0x28')](_0x42487b[_0x4b77('0x29')]);if(_0x42487b[_0x4b77('0x2a')]){delete _0x42487b['name'];}_0x1f43f3[_0x4b77('0x1b')](_0x2d1dc5)['send'](_0x42487b);};}exports[_0x4b77('0x2b')]=function(_0x4e930e,_0x3a361c){var _0x378ddb={},_0x2f7fe4={},_0x579e13={'count':0x0,'rows':[]};var _0x1ae946=_[_0x4b77('0x2c')](db['ChatTransferReport']['rawAttributes'],function(_0x35e54d){return{'name':_0x35e54d[_0x4b77('0x2d')],'type':_0x35e54d['type'][_0x4b77('0x2e')]};});_0x2f7fe4[_0x4b77('0x2f')]=_[_0x4b77('0x2c')](_0x1ae946,_0x4b77('0x2a'));_0x2f7fe4[_0x4b77('0x30')]=_[_0x4b77('0x31')](_0x4e930e['query']);_0x2f7fe4['filters']=_[_0x4b77('0x32')](_0x2f7fe4[_0x4b77('0x2f')],_0x2f7fe4[_0x4b77('0x30')]);_0x378ddb[_0x4b77('0x33')]=_['intersection'](_0x2f7fe4[_0x4b77('0x2f')],qs[_0x4b77('0x34')](_0x4e930e[_0x4b77('0x30')][_0x4b77('0x34')]));_0x378ddb['attributes']=_0x378ddb[_0x4b77('0x33')][_0x4b77('0x35')]?_0x378ddb['attributes']:_0x2f7fe4[_0x4b77('0x2f')];if(!_0x4e930e[_0x4b77('0x30')][_0x4b77('0x36')](_0x4b77('0x37'))){_0x378ddb['limit']=qs[_0x4b77('0x20')](_0x4e930e[_0x4b77('0x30')][_0x4b77('0x20')]);_0x378ddb[_0x4b77('0x1e')]=qs[_0x4b77('0x1e')](_0x4e930e[_0x4b77('0x30')][_0x4b77('0x1e')]);}_0x378ddb[_0x4b77('0x38')]=qs[_0x4b77('0x39')](_0x4e930e[_0x4b77('0x30')][_0x4b77('0x39')]);_0x378ddb[_0x4b77('0x3a')]=qs[_0x4b77('0x3b')](_[_0x4b77('0x3c')](_0x4e930e['query'],_0x2f7fe4[_0x4b77('0x3b')]),_0x1ae946);if(_0x4e930e[_0x4b77('0x30')][_0x4b77('0x3d')]){_0x378ddb[_0x4b77('0x3a')]=_[_0x4b77('0x3e')](_0x378ddb[_0x4b77('0x3a')],{'$or':_['map'](_0x1ae946,function(_0x436242){if(_0x436242[_0x4b77('0x3f')]!==_0x4b77('0x40')){var _0x4fb528={};_0x4fb528[_0x436242[_0x4b77('0x2a')]]={'$like':'%'+_0x4e930e[_0x4b77('0x30')][_0x4b77('0x3d')]+'%'};return _0x4fb528;}})});}_0x378ddb=_[_0x4b77('0x3e')]({},_0x378ddb,_0x4e930e[_0x4b77('0x41')]);var _0x52e955={'where':_0x378ddb['where']};return db[_0x4b77('0x42')][_0x4b77('0x21')](_0x52e955)[_0x4b77('0x26')](function(_0x235a79){_0x579e13['count']=_0x235a79;if(_0x4e930e[_0x4b77('0x30')][_0x4b77('0x43')]){_0x378ddb[_0x4b77('0x44')]=[{'all':!![]}];}return db[_0x4b77('0x42')]['findAll'](_0x378ddb);})['then'](function(_0xacbe85){_0x579e13[_0x4b77('0x45')]=_0xacbe85;return _0x579e13;})[_0x4b77('0x26')](respondWithFilteredResult(_0x3a361c,_0x378ddb))['catch'](handleError(_0x3a361c,null));};exports[_0x4b77('0x46')]=function(_0x346d14,_0x312528){var _0x15afbc={'raw':!![],'where':{'id':_0x346d14['params']['id']}},_0x40e438={};_0x40e438['model']=_[_0x4b77('0x31')](db[_0x4b77('0x42')][_0x4b77('0x47')]);_0x40e438[_0x4b77('0x30')]=_[_0x4b77('0x31')](_0x346d14['query']);_0x40e438['filters']=_[_0x4b77('0x32')](_0x40e438[_0x4b77('0x2f')],_0x40e438[_0x4b77('0x30')]);_0x15afbc['attributes']=_['intersection'](_0x40e438[_0x4b77('0x2f')],qs['fields'](_0x346d14[_0x4b77('0x30')][_0x4b77('0x34')]));_0x15afbc[_0x4b77('0x33')]=_0x15afbc[_0x4b77('0x33')][_0x4b77('0x35')]?_0x15afbc['attributes']:_0x40e438[_0x4b77('0x2f')];if(_0x346d14['query'][_0x4b77('0x43')]){_0x15afbc['include']=[{'all':!![]}];}_0x15afbc=_[_0x4b77('0x3e')]({},_0x15afbc,_0x346d14['options']);return db[_0x4b77('0x42')][_0x4b77('0x48')](_0x15afbc)[_0x4b77('0x26')](handleEntityNotFound(_0x312528,null))['then'](respondWithResult(_0x312528,null))[_0x4b77('0x49')](handleError(_0x312528,null));};exports[_0x4b77('0x4a')]=function(_0xd4fe83,_0x47ba4b){return db[_0x4b77('0x42')]['create'](_0xd4fe83['body'],{})[_0x4b77('0x26')](respondWithResult(_0x47ba4b,0xc9))[_0x4b77('0x49')](handleError(_0x47ba4b,null));};exports[_0x4b77('0x25')]=function(_0x450244,_0x1c8157){if(_0x450244[_0x4b77('0x4b')]['id']){delete _0x450244[_0x4b77('0x4b')]['id'];}return db['ChatTransferReport'][_0x4b77('0x48')]({'where':{'id':_0x450244[_0x4b77('0x4c')]['id']}})[_0x4b77('0x26')](handleEntityNotFound(_0x1c8157,null))[_0x4b77('0x26')](saveUpdates(_0x450244[_0x4b77('0x4b')],null))[_0x4b77('0x26')](respondWithResult(_0x1c8157,null))[_0x4b77('0x49')](handleError(_0x1c8157,null));};exports['destroy']=function(_0x375dd1,_0x2aee2d){return db[_0x4b77('0x42')][_0x4b77('0x48')]({'where':{'id':_0x375dd1[_0x4b77('0x4c')]['id']}})[_0x4b77('0x26')](handleEntityNotFound(_0x2aee2d,null))[_0x4b77('0x26')](removeEntity(_0x2aee2d,null))[_0x4b77('0x49')](handleError(_0x2aee2d,null));};exports[_0x4b77('0x4d')]=function(_0x3915a5,_0x2ed617){return db['ChatTransferReport'][_0x4b77('0x4d')]()[_0x4b77('0x26')](respondWithResult(_0x2ed617,null))[_0x4b77('0x49')](handleError(_0x2ed617,null));};
\ No newline at end of file
+var _0xae1e=['filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','model','query','keys'];(function(_0x50a98a,_0x54f900){var _0x19cefe=function(_0x5b53e2){while(--_0x5b53e2){_0x50a98a['push'](_0x50a98a['shift']());}};_0x19cefe(++_0x54f900);}(_0xae1e,0x148));var _0xeae1=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xae1e[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xeae1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeae1('0x1'));var jsonpatch=require(_0xeae1('0x2'));var rp=require(_0xeae1('0x3'));var moment=require(_0xeae1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeae1('0x5'));var util=require(_0xeae1('0x6'));var path=require(_0xeae1('0x7'));var sox=require(_0xeae1('0x8'));var csv=require(_0xeae1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeae1('0xa'));var _=require(_0xeae1('0xb'));var squel=require('squel');var crypto=require(_0xeae1('0xc'));var jsforce=require(_0xeae1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeae1('0x9'));var querystring=require(_0xeae1('0xe'));var Papa=require(_0xeae1('0xf'));var Redis=require(_0xeae1('0x10'));var authService=require(_0xeae1('0x11'));var qs=require(_0xeae1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeae1('0x13'));var logger=require(_0xeae1('0x14'))(_0xeae1('0x15'));var utils=require(_0xeae1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xeae1('0x17'));var db=require(_0xeae1('0x18'))['db'];function respondWithStatusCode(_0x2652e2,_0xe82d37){_0xe82d37=_0xe82d37||0xcc;return function(_0x551fa0){if(_0x551fa0){return _0x2652e2['sendStatus'](_0xe82d37);}return _0x2652e2[_0xeae1('0x19')](_0xe82d37)[_0xeae1('0x1a')]();};}function respondWithResult(_0x2ad13e,_0x1246ff){_0x1246ff=_0x1246ff||0xc8;return function(_0x4ce4de){if(_0x4ce4de){return _0x2ad13e['status'](_0x1246ff)[_0xeae1('0x1b')](_0x4ce4de);}};}function respondWithFilteredResult(_0x238ea9,_0x615ba6){return function(_0x169e1f){if(_0x169e1f){var _0x16a407=typeof _0x615ba6[_0xeae1('0x1c')]===_0xeae1('0x1d')&&typeof _0x615ba6[_0xeae1('0x1e')]===_0xeae1('0x1d');var _0x218c46=_0x169e1f[_0xeae1('0x1f')];var _0x5eb8cf=_0x16a407?0x0:_0x615ba6[_0xeae1('0x1c')];var _0x1f62f1=_0x16a407?_0x169e1f[_0xeae1('0x1f')]:_0x615ba6[_0xeae1('0x1c')]+_0x615ba6[_0xeae1('0x1e')];var _0xdba7ab;if(_0x1f62f1>=_0x218c46){_0x1f62f1=_0x218c46;_0xdba7ab=0xc8;}else{_0xdba7ab=0xce;}_0x238ea9[_0xeae1('0x19')](_0xdba7ab);return _0x238ea9[_0xeae1('0x20')](_0xeae1('0x21'),_0x5eb8cf+'-'+_0x1f62f1+'/'+_0x218c46)['json'](_0x169e1f);}return null;};}function patchUpdates(_0x47d9da){return function(_0x10b064){try{jsonpatch[_0xeae1('0x22')](_0x10b064,_0x47d9da,!![]);}catch(_0x4292c3){return BPromise[_0xeae1('0x23')](_0x4292c3);}return _0x10b064[_0xeae1('0x24')]();};}function saveUpdates(_0x18a9a3,_0x581953){return function(_0x2448fc){if(_0x2448fc){return _0x2448fc[_0xeae1('0x25')](_0x18a9a3)[_0xeae1('0x26')](function(_0xdf54aa){return _0xdf54aa;});}return null;};}function removeEntity(_0xa174e7,_0x204c99){return function(_0x5e8e72){if(_0x5e8e72){return _0x5e8e72[_0xeae1('0x27')]()['then'](function(){_0xa174e7[_0xeae1('0x19')](0xcc)[_0xeae1('0x1a')]();});}};}function handleEntityNotFound(_0x4c35e8,_0x8d7216){return function(_0x4d5e01){if(!_0x4d5e01){_0x4c35e8['sendStatus'](0x194);}return _0x4d5e01;};}function handleError(_0x5cd6da,_0x42a427){_0x42a427=_0x42a427||0x1f4;return function(_0x4091e7){logger['error'](_0x4091e7[_0xeae1('0x28')]);if(_0x4091e7[_0xeae1('0x29')]){delete _0x4091e7[_0xeae1('0x29')];}_0x5cd6da[_0xeae1('0x19')](_0x42a427)[_0xeae1('0x2a')](_0x4091e7);};}exports[_0xeae1('0x2b')]=function(_0x547bd0,_0x2b2b47){var _0x28523={},_0x23d812={},_0x403bb3={'count':0x0,'rows':[]};var _0x497ee0=_[_0xeae1('0x2c')](db[_0xeae1('0x2d')][_0xeae1('0x2e')],function(_0x5511b7){return{'name':_0x5511b7[_0xeae1('0x2f')],'type':_0x5511b7[_0xeae1('0x30')]['key']};});_0x23d812[_0xeae1('0x31')]=_[_0xeae1('0x2c')](_0x497ee0,'name');_0x23d812[_0xeae1('0x32')]=_[_0xeae1('0x33')](_0x547bd0[_0xeae1('0x32')]);_0x23d812[_0xeae1('0x34')]=_[_0xeae1('0x35')](_0x23d812['model'],_0x23d812[_0xeae1('0x32')]);_0x28523[_0xeae1('0x36')]=_[_0xeae1('0x35')](_0x23d812[_0xeae1('0x31')],qs[_0xeae1('0x37')](_0x547bd0[_0xeae1('0x32')][_0xeae1('0x37')]));_0x28523[_0xeae1('0x36')]=_0x28523[_0xeae1('0x36')]['length']?_0x28523['attributes']:_0x23d812[_0xeae1('0x31')];if(!_0x547bd0[_0xeae1('0x32')][_0xeae1('0x38')]('nolimit')){_0x28523[_0xeae1('0x1e')]=qs[_0xeae1('0x1e')](_0x547bd0[_0xeae1('0x32')][_0xeae1('0x1e')]);_0x28523[_0xeae1('0x1c')]=qs[_0xeae1('0x1c')](_0x547bd0[_0xeae1('0x32')]['offset']);}_0x28523[_0xeae1('0x39')]=qs['sort'](_0x547bd0['query'][_0xeae1('0x3a')]);_0x28523[_0xeae1('0x3b')]=qs[_0xeae1('0x34')](_[_0xeae1('0x3c')](_0x547bd0[_0xeae1('0x32')],_0x23d812[_0xeae1('0x34')]),_0x497ee0);if(_0x547bd0[_0xeae1('0x32')][_0xeae1('0x3d')]){_0x28523[_0xeae1('0x3b')]=_[_0xeae1('0x3e')](_0x28523[_0xeae1('0x3b')],{'$or':_[_0xeae1('0x2c')](_0x497ee0,function(_0x38188d){if(_0x38188d[_0xeae1('0x30')]!==_0xeae1('0x3f')){var _0x188dbe={};_0x188dbe[_0x38188d[_0xeae1('0x29')]]={'$like':'%'+_0x547bd0[_0xeae1('0x32')][_0xeae1('0x3d')]+'%'};return _0x188dbe;}})});}_0x28523=_[_0xeae1('0x3e')]({},_0x28523,_0x547bd0[_0xeae1('0x40')]);var _0xa5e559={'where':_0x28523[_0xeae1('0x3b')]};return db[_0xeae1('0x2d')][_0xeae1('0x1f')](_0xa5e559)['then'](function(_0x1600fe){_0x403bb3['count']=_0x1600fe;if(_0x547bd0['query'][_0xeae1('0x41')]){_0x28523['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0xeae1('0x42')](_0x28523);})[_0xeae1('0x26')](function(_0x3c3052){_0x403bb3[_0xeae1('0x43')]=_0x3c3052;return _0x403bb3;})['then'](respondWithFilteredResult(_0x2b2b47,_0x28523))[_0xeae1('0x44')](handleError(_0x2b2b47,null));};exports[_0xeae1('0x45')]=function(_0x4d2cb9,_0x4f3aa4){var _0x4bb8a9={'raw':!![],'where':{'id':_0x4d2cb9[_0xeae1('0x46')]['id']}},_0x2f8beb={};_0x2f8beb[_0xeae1('0x31')]=_[_0xeae1('0x33')](db[_0xeae1('0x2d')][_0xeae1('0x2e')]);_0x2f8beb['query']=_['keys'](_0x4d2cb9['query']);_0x2f8beb['filters']=_['intersection'](_0x2f8beb[_0xeae1('0x31')],_0x2f8beb[_0xeae1('0x32')]);_0x4bb8a9[_0xeae1('0x36')]=_[_0xeae1('0x35')](_0x2f8beb[_0xeae1('0x31')],qs[_0xeae1('0x37')](_0x4d2cb9[_0xeae1('0x32')][_0xeae1('0x37')]));_0x4bb8a9[_0xeae1('0x36')]=_0x4bb8a9[_0xeae1('0x36')]['length']?_0x4bb8a9['attributes']:_0x2f8beb[_0xeae1('0x31')];if(_0x4d2cb9[_0xeae1('0x32')][_0xeae1('0x41')]){_0x4bb8a9[_0xeae1('0x47')]=[{'all':!![]}];}_0x4bb8a9=_[_0xeae1('0x3e')]({},_0x4bb8a9,_0x4d2cb9[_0xeae1('0x40')]);return db[_0xeae1('0x2d')]['find'](_0x4bb8a9)[_0xeae1('0x26')](handleEntityNotFound(_0x4f3aa4,null))[_0xeae1('0x26')](respondWithResult(_0x4f3aa4,null))[_0xeae1('0x44')](handleError(_0x4f3aa4,null));};exports[_0xeae1('0x48')]=function(_0x2aec21,_0x3ff836){return db[_0xeae1('0x2d')][_0xeae1('0x48')](_0x2aec21[_0xeae1('0x49')],{})[_0xeae1('0x26')](respondWithResult(_0x3ff836,0xc9))[_0xeae1('0x44')](handleError(_0x3ff836,null));};exports[_0xeae1('0x25')]=function(_0x1fd608,_0x1b7698){if(_0x1fd608[_0xeae1('0x49')]['id']){delete _0x1fd608['body']['id'];}return db[_0xeae1('0x2d')][_0xeae1('0x4a')]({'where':{'id':_0x1fd608['params']['id']}})['then'](handleEntityNotFound(_0x1b7698,null))[_0xeae1('0x26')](saveUpdates(_0x1fd608[_0xeae1('0x49')],null))[_0xeae1('0x26')](respondWithResult(_0x1b7698,null))[_0xeae1('0x44')](handleError(_0x1b7698,null));};exports[_0xeae1('0x27')]=function(_0x323950,_0x148817){return db['ChatTransferReport'][_0xeae1('0x4a')]({'where':{'id':_0x323950[_0xeae1('0x46')]['id']}})['then'](handleEntityNotFound(_0x148817,null))[_0xeae1('0x26')](removeEntity(_0x148817,null))['catch'](handleError(_0x148817,null));};exports[_0xeae1('0x4b')]=function(_0x25cfe7,_0x3ca0bc){return db[_0xeae1('0x2d')]['describe']()[_0xeae1('0x26')](respondWithResult(_0x3ca0bc,null))[_0xeae1('0x44')](handleError(_0x3ca0bc,null));};
\ No newline at end of file
index 06b35ea..bf94df2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9865=['bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x10c751,_0x536511){var _0x372b58=function(_0x3f2ac9){while(--_0x3f2ac9){_0x10c751['push'](_0x10c751['shift']());}};_0x372b58(++_0x536511);}(_0x9865,0x190));var _0x5986=function(_0x72193d,_0x330a80){_0x72193d=_0x72193d-0x0;var _0x455d4f=_0x9865[_0x72193d];return _0x455d4f;};'use strict';var _=require(_0x5986('0x0'));var util=require(_0x5986('0x1'));var logger=require(_0x5986('0x2'))(_0x5986('0x3'));var moment=require(_0x5986('0x4'));var BPromise=require(_0x5986('0x5'));var rp=require(_0x5986('0x6'));var fs=require('fs');var path=require(_0x5986('0x7'));var rimraf=require(_0x5986('0x8'));var config=require(_0x5986('0x9'));var attributes=require(_0x5986('0xa'));module[_0x5986('0xb')]=function(_0x4912c1,_0x2064f9){return _0x4912c1['define'](_0x5986('0xc'),attributes,{'tableName':_0x5986('0xd'),'paranoid':![],'indexes':[{'name':_0x5986('0xe'),'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x15a7=['define','ChatTransferReport','report_chat_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x15a7,0x13b));var _0x715a=function(_0xf9fe63,_0x324c70){_0xf9fe63=_0xf9fe63-0x0;var _0x2d0f82=_0x15a7[_0xf9fe63];return _0x2d0f82;};'use strict';var _=require(_0x715a('0x0'));var util=require(_0x715a('0x1'));var logger=require(_0x715a('0x2'))(_0x715a('0x3'));var moment=require(_0x715a('0x4'));var BPromise=require(_0x715a('0x5'));var rp=require(_0x715a('0x6'));var fs=require('fs');var path=require(_0x715a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module[_0x715a('0x8')]=function(_0x59eb54,_0x36b5b5){return _0x59eb54[_0x715a('0x9')](_0x715a('0xa'),attributes,{'tableName':_0x715a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
index 1a0ee18..a1acbbe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd374=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0xf3f5d7,_0x20eb9d){var _0x538abc=function(_0x67f96a){while(--_0x67f96a){_0xf3f5d7['push'](_0xf3f5d7['shift']());}};_0x538abc(++_0x20eb9d);}(_0xd374,0x1a0));var _0x4d37=function(_0x44f3c8,_0x1157a1){_0x44f3c8=_0x44f3c8-0x0;var _0x298fd4=_0xd374[_0x44f3c8];return _0x298fd4;};'use strict';var _=require(_0x4d37('0x0'));var util=require(_0x4d37('0x1'));var moment=require(_0x4d37('0x2'));var BPromise=require(_0x4d37('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d37('0x4'));var db=require(_0x4d37('0x5'))['db'];var utils=require(_0x4d37('0x6'));var logger=require(_0x4d37('0x7'))('rpc');var config=require(_0x4d37('0x8'));var jayson=require(_0x4d37('0x9'));var client=jayson['client'][_0x4d37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45aee9,_0x186ffd,_0x1142ba){return new BPromise(function(_0xdb4ded,_0x246fcc){return client[_0x4d37('0xb')](_0x45aee9,_0x1142ba)['then'](function(_0x4b5307){logger[_0x4d37('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x186ffd,_0x4d37('0xd'));logger[_0x4d37('0xe')](_0x4d37('0xf'),_0x186ffd,_0x4d37('0xd'),JSON['stringify'](_0x4b5307));if(_0x4b5307[_0x4d37('0x10')]){if(_0x4b5307['error']['code']===0x1f4){logger[_0x4d37('0x10')](_0x4d37('0x11'),_0x186ffd,_0x4b5307[_0x4d37('0x10')][_0x4d37('0x12')]);return _0x246fcc(_0x4b5307['error'][_0x4d37('0x12')]);}logger[_0x4d37('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x186ffd,_0x4b5307[_0x4d37('0x10')][_0x4d37('0x12')]);return _0xdb4ded(_0x4b5307[_0x4d37('0x10')]['message']);}else{logger[_0x4d37('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x186ffd,_0x4d37('0xd'));_0xdb4ded(_0x4b5307[_0x4d37('0x13')][_0x4d37('0x12')]);}})[_0x4d37('0x14')](function(_0x1fa2dc){logger[_0x4d37('0x10')](_0x4d37('0x11'),_0x186ffd,_0x1fa2dc);_0x246fcc(_0x1fa2dc);});});}
\ No newline at end of file
+var _0xbfed=['request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x4a5ade,_0x3307f2){var _0x3d462f=function(_0x18a19a){while(--_0x18a19a){_0x4a5ade['push'](_0x4a5ade['shift']());}};_0x3d462f(++_0x3307f2);}(_0xbfed,0x1f0));var _0xdbfe=function(_0x43b22b,_0xea722c){_0x43b22b=_0x43b22b-0x0;var _0xd4e124=_0xbfed[_0x43b22b];return _0xd4e124;};'use strict';var _=require(_0xdbfe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdbfe('0x1'));var rs=require(_0xdbfe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdbfe('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdbfe('0x4'));var config=require(_0xdbfe('0x5'));var jayson=require(_0xdbfe('0x6'));var client=jayson[_0xdbfe('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3123b7,_0x2fcfe0,_0x3d0022){return new BPromise(function(_0x5965ca,_0x12f616){return client[_0xdbfe('0x8')](_0x3123b7,_0x3d0022)[_0xdbfe('0x9')](function(_0x235aef){logger[_0xdbfe('0xa')](_0xdbfe('0xb'),_0x2fcfe0,_0xdbfe('0xc'));logger[_0xdbfe('0xd')](_0xdbfe('0xe'),_0x2fcfe0,'request\x20sent',JSON[_0xdbfe('0xf')](_0x235aef));if(_0x235aef[_0xdbfe('0x10')]){if(_0x235aef['error'][_0xdbfe('0x11')]===0x1f4){logger[_0xdbfe('0x10')](_0xdbfe('0xb'),_0x2fcfe0,_0x235aef['error']['message']);return _0x12f616(_0x235aef[_0xdbfe('0x10')][_0xdbfe('0x12')]);}logger[_0xdbfe('0x10')](_0xdbfe('0xb'),_0x2fcfe0,_0x235aef[_0xdbfe('0x10')]['message']);return _0x5965ca(_0x235aef[_0xdbfe('0x10')][_0xdbfe('0x12')]);}else{logger[_0xdbfe('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x2fcfe0,'request\x20sent');_0x5965ca(_0x235aef[_0xdbfe('0x13')]['message']);}})[_0xdbfe('0x14')](function(_0x5b684c){logger[_0xdbfe('0x10')](_0xdbfe('0xb'),_0x2fcfe0,_0x5b684c);_0x12f616(_0x5b684c);});});}
\ No newline at end of file
index 2176e39..0cba800 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7bce=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x7a06d3,_0x113a6f){var _0x5e5879=function(_0x2b6bbd){while(--_0x2b6bbd){_0x7a06d3['push'](_0x7a06d3['shift']());}};_0x5e5879(++_0x113a6f);}(_0x7bce,0x138));var _0xe7bc=function(_0x581aae,_0x2b18ee){_0x581aae=_0x581aae-0x0;var _0x539df2=_0x7bce[_0x581aae];return _0x539df2;};'use strict';var multer=require(_0xe7bc('0x0'));var util=require(_0xe7bc('0x1'));var path=require(_0xe7bc('0x2'));var timeout=require(_0xe7bc('0x3'));var express=require(_0xe7bc('0x4'));var router=express[_0xe7bc('0x5')]();var fs_extra=require(_0xe7bc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe7bc('0x7'));var config=require(_0xe7bc('0x8'));var controller=require(_0xe7bc('0x9'));router[_0xe7bc('0xa')]('/',auth[_0xe7bc('0xb')](),controller[_0xe7bc('0xc')]);router[_0xe7bc('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xe7bc('0xd'),auth[_0xe7bc('0xb')](),controller[_0xe7bc('0xe')]);router['post']('/',auth[_0xe7bc('0xb')](),controller[_0xe7bc('0xf')]);router[_0xe7bc('0x10')](_0xe7bc('0xd'),auth[_0xe7bc('0xb')](),controller[_0xe7bc('0x11')]);router[_0xe7bc('0x12')](_0xe7bc('0xd'),auth[_0xe7bc('0xb')](),controller[_0xe7bc('0x13')]);module['exports']=router;
\ No newline at end of file
+var _0x017a=['show','post','create','put','/:id','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x55ee39,_0x4ee949){var _0x51ec97=function(_0x18acac){while(--_0x18acac){_0x55ee39['push'](_0x55ee39['shift']());}};_0x51ec97(++_0x4ee949);}(_0x017a,0x151));var _0xa017=function(_0x13732a,_0x283d68){_0x13732a=_0x13732a-0x0;var _0x1d205=_0x017a[_0x13732a];return _0x1d205;};'use strict';var multer=require(_0xa017('0x0'));var util=require(_0xa017('0x1'));var path=require('path');var timeout=require(_0xa017('0x2'));var express=require(_0xa017('0x3'));var router=express[_0xa017('0x4')]();var fs_extra=require(_0xa017('0x5'));var auth=require(_0xa017('0x6'));var interaction=require(_0xa017('0x7'));var config=require(_0xa017('0x8'));var controller=require(_0xa017('0x9'));router[_0xa017('0xa')]('/',auth[_0xa017('0xb')](),controller[_0xa017('0xc')]);router[_0xa017('0xa')](_0xa017('0xd'),auth[_0xa017('0xb')](),controller[_0xa017('0xe')]);router[_0xa017('0xa')]('/:id',auth[_0xa017('0xb')](),controller[_0xa017('0xf')]);router[_0xa017('0x10')]('/',auth[_0xa017('0xb')](),controller[_0xa017('0x11')]);router[_0xa017('0x12')](_0xa017('0x13'),auth[_0xa017('0xb')](),controller[_0xa017('0x14')]);router['delete'](_0xa017('0x13'),auth[_0xa017('0xb')](),controller[_0xa017('0x15')]);module['exports']=router;
\ No newline at end of file
index aab4c08..5103442 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xda55=['alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','star','stringify','input','text','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT'];(function(_0x3147f0,_0x4eba6e){var _0x546863=function(_0x330a5f){while(--_0x330a5f){_0x3147f0['push'](_0x3147f0['shift']());}};_0x546863(++_0x4eba6e);}(_0xda55,0x6d));var _0x5da5=function(_0x5ef00d,_0x990fa2){_0x5ef00d=_0x5ef00d-0x0;var _0x26017e=_0xda55[_0x5ef00d];return _0x26017e;};'use strict';var Sequelize=require(_0x5da5('0x0'));var rs=require(_0x5da5('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'unique':_0x5da5('0x3')},'description':{'type':Sequelize[_0x5da5('0x2')]},'mapKey':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x5da5('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'defaultValue':_0x5da5('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'defaultValue':_0x5da5('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'defaultValue':_0x5da5('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5da5('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5da5('0x2')]},'animation':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5da5('0x9')](_0x5da5('0xa'),_0x5da5('0xb')),'defaultValue':_0x5da5('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x5da5('0xc')},'start_chat_button':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0xd')},'header_offline':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0xe')},'download_transcript':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5da5('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5da5('0xf')]},'closingQuestion':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x5da5('0x13')},'placeholderMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x14')},'closingMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x15')},'closingMessageButton':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x16')},'conditionAgreement':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x17')},'ratingType':{'type':Sequelize[_0x5da5('0x9')]('star',_0x5da5('0x18')),'defaultValue':_0x5da5('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x5da5('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5da5('0xf')],'defaultValue':function(){return JSON[_0x5da5('0x1a')]({'items':[{'type':_0x5da5('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0x5da5('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x5da5('0x1b'),'props':{'title':_0x5da5('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x5da5('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x5da5('0x1d')](_0x5da5('0x1e'))?JSON[_0x5da5('0x1f')](this[_0x5da5('0x1d')]('onlineForm')):{};},'set':function(_0x5b0b43){return this['setDataValue'](_0x5da5('0x1e'),JSON['stringify'](_0x5b0b43));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x5da5('0x1a')]({'items':[{'type':_0x5da5('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x5da5('0x4'),'type':_0x5da5('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x5da5('0x20')},'props':{'title':_0x5da5('0x20'),'helpText':_0x5da5('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x5da5('0x1d')](_0x5da5('0x22'))?JSON['parse'](this[_0x5da5('0x1d')](_0x5da5('0x22'))):{};},'set':function(_0x31cb5f){return this[_0x5da5('0x23')]('offlineForm',JSON['stringify'](_0x31cb5f));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5da5('0x24')]();}},'autoclose':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5da5('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x25')},'offlineMessageBody':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x27')},'skipUnmanaged':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x5da5('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5da5('0x2')]},'notificationTemplate':{'type':Sequelize[_0x5da5('0xf')],'defaultValue':function(){return _0x5da5('0x28');}},'notificationSound':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x5da5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x5da5('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x2b')},'messagesAlignment':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x2c')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x5da5('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5da5('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5da5('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5da5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x2e')},'systemAvatar':{'type':Sequelize[_0x5da5('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5da5('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![],'comment':_0x5da5('0x2f'),'set':function(_0x14c3f5){if(!_0x14c3f5)this[_0x5da5('0x23')](_0x5da5('0x30'),null);this['setDataValue'](_0x5da5('0x31'),_0x14c3f5);}},'vidaooEscalation':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x5da5('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x5da5('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x5da5('0xf')]}};
\ No newline at end of file
+var _0x17ba=['BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','stringify','input','name','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','bottom_right','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER'];(function(_0x5cbfea,_0x74ffb0){var _0x168e15=function(_0x5148c4){while(--_0x5148c4){_0x5cbfea['push'](_0x5cbfea['shift']());}};_0x168e15(++_0x74ffb0);}(_0x17ba,0xab));var _0xa17b=function(_0x2d7dad,_0x21427f){_0x2d7dad=_0x2d7dad-0x0;var _0x1d4cfe=_0x17ba[_0x2d7dad];return _0x1d4cfe;};'use strict';var Sequelize=require(_0xa17b('0x0'));var rs=require(_0xa17b('0x1'));module['exports']={'name':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'unique':_0xa17b('0x3')},'description':{'type':Sequelize[_0xa17b('0x2')]},'mapKey':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x4')},'mapKeyOffline':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x4')},'key':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x5')},'customerAlias':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':_0xa17b('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':_0xa17b('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':_0xa17b('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xa17b('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa17b('0x2')]},'animation':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xa17b('0xa')](_0xa17b('0xb'),_0xa17b('0xc')),'defaultValue':_0xa17b('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0xd')},'start_chat_button':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0xf')},'header_offline':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x10')},'download_transcript':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xa17b('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0xf')},'skipMessageButton':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x15')},'conditionAgreement':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0x16')},'ratingType':{'type':Sequelize[_0xa17b('0xa')](_0xa17b('0x17'),'thumb'),'defaultValue':_0xa17b('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xa17b('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xa17b('0x11')],'defaultValue':function(){return JSON[_0xa17b('0x18')]({'items':[{'type':_0xa17b('0x19'),'variable':null,'config':{'placeholder':_0xa17b('0x1a'),'type':'text','required':!![]},'props':{'title':_0xa17b('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0xa17b('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xa17b('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xa17b('0x1b'))?JSON[_0xa17b('0x1c')](this[_0xa17b('0x1d')](_0xa17b('0x1b'))):{};},'set':function(_0x3c32a5){return this[_0xa17b('0x1e')]('onlineForm',JSON['stringify'](_0x3c32a5));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xa17b('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xa17b('0x4'),'type':'email'},'variable':null},{'type':_0xa17b('0x1f'),'config':{'placeholder':_0xa17b('0x20')},'props':{'title':_0xa17b('0x20'),'helpText':_0xa17b('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xa17b('0x1d')](_0xa17b('0x22'))?JSON[_0xa17b('0x1c')](this[_0xa17b('0x1d')](_0xa17b('0x22'))):{};},'set':function(_0x2dc1f2){return this[_0xa17b('0x1e')]('offlineForm',JSON['stringify'](_0x2dc1f2));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa17b('0x23')]();}},'autoclose':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xa17b('0x2')]},'forwardOffline':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xa17b('0x2')]},'waitingTitle':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x24')},'offlineMessageBody':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x15')},'sendUnmanaged':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xa17b('0x11')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xa17b('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa17b('0x26');}},'notificationSound':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xa17b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x27')},'verticalAlignment':{'type':Sequelize[_0xa17b('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xa17b('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa17b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x28')},'systemAvatar':{'type':Sequelize[_0xa17b('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa17b('0x8')],'comment':_0xa17b('0x29')},'mandatoryDisposition':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x468c92){if(!_0x468c92)this[_0xa17b('0x1e')]('mandatoryDispositionPauseId',null);this[_0xa17b('0x1e')](_0xa17b('0x2a'),_0x468c92);}},'vidaooEscalation':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa17b('0x2')]},'vidaooTopic':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':_0xa17b('0x2b')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xa17b('0x2c');}},'vidaooMetadata':{'type':Sequelize[_0xa17b('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}};
\ No newline at end of file
index fa8233d..2038eb2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x93dc=['error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','ChatWebsites','end','stack','name','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','Pause','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','DESC','ChatApplication','Applications','List','account','list','orderBy','priority','asc','ListId','contact','cf-connecting-ip','headers','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','vendor','%s\x20%s\x20%s','device','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','created','autoclose','push','applications','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','Start','startRouting','EventManager','offline','files','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','findOrCreate','readFileSync','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','basename','openNewInteraction','sequelize','Attachment','Smtp','forwardOffline','SendMail','\x22%s\x22\x20<%s>','forwardOfflineAddress','MailAccountId','toPairsIn','mapValues','email','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','License','chatLicenseExceeded','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','virtual','replace','alignment','labelText','textColor','textButtonColor','color_button','hideWhenOffline','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','destroy','bulkCreate','findAndCountAll','getApplications','chatProactiveAction','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','fs-extra','lodash','querystring','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x5b51d2,_0xd3846c){var _0x1ecc32=function(_0x26c8a1){while(--_0x26c8a1){_0x5b51d2['push'](_0x5b51d2['shift']());}};_0x1ecc32(++_0xd3846c);}(_0x93dc,0x10b));var _0xc93d=function(_0x398bea,_0x32338d){_0x398bea=_0x398bea-0x0;var _0x5825ed=_0x93dc[_0x398bea];return _0x5825ed;};'use strict';var BPromise=require(_0xc93d('0x0'));var Mustache=require('mustache');var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc93d('0x1'));var _=require(_0xc93d('0x2'));var querystring=require(_0xc93d('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xc93d('0x4'))(_0xc93d('0x5'));var config=require(_0xc93d('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc93d('0x7')](config[_0xc93d('0x8')],{'host':_0xc93d('0x9'),'port':0x18eb});var socket=require(_0xc93d('0xa'))(new Redis(config['redis']));require(_0xc93d('0xb'))[_0xc93d('0xc')](socket);var htmlToText=require(_0xc93d('0xd'));var jayson=require(_0xc93d('0xe'));var client=jayson[_0xc93d('0xf')][_0xc93d('0x10')]({'port':0x232c});var client9002=jayson[_0xc93d('0xf')][_0xc93d('0x10')]({'port':0x232a});var client9003=jayson[_0xc93d('0xf')][_0xc93d('0x10')]({'port':0x232b});var client9001=jayson[_0xc93d('0xf')]['http']({'port':0x2329});function respondWithRpcPromise(_0x5f562c,_0x550e19,_0x2c9d77,_0x4e5e56){return new BPromise(function(_0x8fcb1f,_0x1708e2){var _0x364a92=_0x4e5e56||client;return _0x364a92[_0xc93d('0x11')](_0x5f562c,_0x2c9d77)['then'](function(_0x190bf3){logger[_0xc93d('0x12')](_0xc93d('0x13'),_0x550e19,'request\x20sent');logger[_0xc93d('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x550e19,_0xc93d('0x15'),JSON[_0xc93d('0x16')](_0x190bf3));if(_0x190bf3[_0xc93d('0x17')]){if(_0x190bf3[_0xc93d('0x17')][_0xc93d('0x18')]===0x1f4){logger[_0xc93d('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x550e19,_0x190bf3[_0xc93d('0x17')]['message']);return _0x1708e2(_0x190bf3[_0xc93d('0x17')][_0xc93d('0x19')]);}logger[_0xc93d('0x17')](_0xc93d('0x13'),_0x550e19,_0x190bf3[_0xc93d('0x17')][_0xc93d('0x19')]);return _0x8fcb1f(_0x190bf3[_0xc93d('0x17')]['message']);}else{logger[_0xc93d('0x12')](_0xc93d('0x13'),_0x550e19,'request\x20sent');_0x8fcb1f(_0x190bf3['result'][_0xc93d('0x19')]);}})[_0xc93d('0x1a')](function(_0x2b777e){logger[_0xc93d('0x17')](_0xc93d('0x13'),_0x550e19,_0x2b777e);_0x1708e2(_0x2b777e);});});}function respondWithStatusCode(_0x57b216,_0x1afc66){_0x1afc66=_0x1afc66||0xcc;return function(_0x6298ee){if(_0x6298ee){return _0x57b216[_0xc93d('0x1b')](_0x1afc66);}return _0x57b216[_0xc93d('0x1c')](_0x1afc66)['end']();};}function respondWithResult(_0x3acc0e,_0x54054e){_0x54054e=_0x54054e||0xc8;return function(_0x439cd0){if(_0x439cd0){return _0x3acc0e[_0xc93d('0x1c')](_0x54054e)[_0xc93d('0x1d')](_0x439cd0);}};}function respondWithFilteredResult(_0x4ecdb0,_0x545ef2){return function(_0xbc6603){if(_0xbc6603){var _0x3ca78c=typeof _0x545ef2[_0xc93d('0x1e')]===_0xc93d('0x1f')&&typeof _0x545ef2[_0xc93d('0x20')]==='undefined';var _0x16e12e=_0xbc6603[_0xc93d('0x21')];var _0x33d135=_0x3ca78c?0x0:_0x545ef2[_0xc93d('0x1e')];var _0x4e9378=_0x3ca78c?_0xbc6603[_0xc93d('0x21')]:_0x545ef2[_0xc93d('0x1e')]+_0x545ef2['limit'];var _0x240cdb;if(_0x4e9378>=_0x16e12e){_0x4e9378=_0x16e12e;_0x240cdb=0xc8;}else{_0x240cdb=0xce;}_0x4ecdb0[_0xc93d('0x1c')](_0x240cdb);return _0x4ecdb0['set'](_0xc93d('0x22'),_0x33d135+'-'+_0x4e9378+'/'+_0x16e12e)[_0xc93d('0x1d')](_0xbc6603);}return null;};}function saveUpdates(_0x1b4b23){return function(_0x4838c3){if(_0x4838c3){return _0x4838c3[_0xc93d('0x23')](_0x1b4b23)[_0xc93d('0x24')](function(_0x4b9bba){return _0x4b9bba;});}return null;};}function removeEntity(_0x25d27a){return function(_0x4d7abf){if(_0x4d7abf){return _0x4d7abf['destroy']()[_0xc93d('0x24')](function(){var _0x145cf3=_0x4d7abf['get']({'plain':!![]});var _0x45843d=_0xc93d('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x45843d,'resourceId':_0x145cf3['id']}})['then'](function(){return _0x4d7abf;});})[_0xc93d('0x24')](function(){_0x25d27a[_0xc93d('0x1c')](0xcc)[_0xc93d('0x26')]();});}};}function handleEntityNotFound(_0x374cd3){return function(_0x4846de){if(!_0x4846de){_0x374cd3[_0xc93d('0x1b')](0x194);}return _0x4846de;};}function handleError(_0x942e39,_0x2215ea){_0x2215ea=_0x2215ea||0x1f4;return function(_0x224044){logger[_0xc93d('0x17')](_0x224044[_0xc93d('0x27')]);if(_0x224044['name']){delete _0x224044[_0xc93d('0x28')];}_0x942e39[_0xc93d('0x1c')](_0x2215ea)['send'](_0x224044);};}exports['index']=function(_0x27e1fc,_0x58651f){var _0x32a3b4={'include':[{'model':db['Pause'],'as':_0xc93d('0x29')}]},_0x3744f8={},_0x491def={'count':0x0,'rows':[]};var _0x43282d=_['map'](db[_0xc93d('0x2a')][_0xc93d('0x2b')],function(_0x285cbc){return{'name':_0x285cbc[_0xc93d('0x2c')],'type':_0x285cbc['type'][_0xc93d('0x2d')]};});_0x3744f8['model']=_['map'](_0x43282d,_0xc93d('0x28'));_0x3744f8[_0xc93d('0x2e')]=_[_0xc93d('0x2f')](_0x27e1fc[_0xc93d('0x2e')]);_0x3744f8[_0xc93d('0x30')]=_[_0xc93d('0x31')](_0x3744f8[_0xc93d('0x32')],_0x3744f8[_0xc93d('0x2e')]);_0x32a3b4[_0xc93d('0x33')]=_[_0xc93d('0x31')](_0x3744f8[_0xc93d('0x32')],qs[_0xc93d('0x34')](_0x27e1fc[_0xc93d('0x2e')]['fields']));_0x32a3b4[_0xc93d('0x33')]=_0x32a3b4['attributes'][_0xc93d('0x35')]?_0x32a3b4['attributes']:_0x3744f8['model'];if(!_0x27e1fc[_0xc93d('0x2e')][_0xc93d('0x36')](_0xc93d('0x37'))){_0x32a3b4[_0xc93d('0x20')]=qs[_0xc93d('0x20')](_0x27e1fc[_0xc93d('0x2e')][_0xc93d('0x20')]);_0x32a3b4[_0xc93d('0x1e')]=qs[_0xc93d('0x1e')](_0x27e1fc[_0xc93d('0x2e')][_0xc93d('0x1e')]);}_0x32a3b4[_0xc93d('0x38')]=qs[_0xc93d('0x39')](_0x27e1fc[_0xc93d('0x2e')]['sort']);_0x32a3b4['where']=qs['filters'](_[_0xc93d('0x3a')](_0x27e1fc[_0xc93d('0x2e')],_0x3744f8[_0xc93d('0x30')]),_0x43282d);if(_0x27e1fc[_0xc93d('0x2e')]['filter']){_0x32a3b4[_0xc93d('0x3b')]=_[_0xc93d('0x3c')](_0x32a3b4[_0xc93d('0x3b')],{'$or':_[_0xc93d('0x3d')](_0x43282d,function(_0x1e24ef){if(_0x1e24ef[_0xc93d('0x3e')]!==_0xc93d('0x3f')){var _0x4bddfd={};_0x4bddfd[_0x1e24ef[_0xc93d('0x28')]]={'$like':'%'+_0x27e1fc[_0xc93d('0x2e')][_0xc93d('0x40')]+'%'};return _0x4bddfd;}})});}_0x32a3b4=_[_0xc93d('0x3c')]({},_0x32a3b4,_0x27e1fc[_0xc93d('0x41')]);var _0x35a0ed={'where':_0x32a3b4[_0xc93d('0x3b')]};return db[_0xc93d('0x2a')][_0xc93d('0x21')](_0x35a0ed)[_0xc93d('0x24')](function(_0x2be0ea){_0x491def[_0xc93d('0x21')]=_0x2be0ea;if(_0x27e1fc[_0xc93d('0x2e')][_0xc93d('0x42')]){_0x32a3b4['include']=[{'all':!![]}];}return db[_0xc93d('0x2a')][_0xc93d('0x43')](_0x32a3b4);})['then'](function(_0x2af217){_0x491def[_0xc93d('0x44')]=_0x2af217;return _0x491def;})[_0xc93d('0x24')](respondWithFilteredResult(_0x58651f,_0x32a3b4))[_0xc93d('0x1a')](handleError(_0x58651f,null));};exports[_0xc93d('0x45')]=function(_0x2947e5,_0x10ba2d){var _0x5c7c7e={'raw':![],'where':{'id':_0x2947e5[_0xc93d('0x46')]['id']},'include':[{'model':db[_0xc93d('0x47')],'as':_0xc93d('0x29')}]},_0x34189a={};_0x34189a[_0xc93d('0x32')]=_[_0xc93d('0x2f')](db['ChatWebsite'][_0xc93d('0x2b')]);_0x34189a[_0xc93d('0x2e')]=_[_0xc93d('0x2f')](_0x2947e5[_0xc93d('0x2e')]);_0x34189a[_0xc93d('0x30')]=_[_0xc93d('0x31')](_0x34189a[_0xc93d('0x32')],_0x34189a[_0xc93d('0x2e')]);_0x5c7c7e['attributes']=_['intersection'](_0x34189a['model'],qs[_0xc93d('0x34')](_0x2947e5['query'][_0xc93d('0x34')]));_0x5c7c7e[_0xc93d('0x33')]=_0x5c7c7e[_0xc93d('0x33')][_0xc93d('0x35')]?_0x5c7c7e[_0xc93d('0x33')]:_0x34189a[_0xc93d('0x32')];if(_0x2947e5['query'][_0xc93d('0x42')]){_0x5c7c7e[_0xc93d('0x48')]=[{'all':!![]}];}_0x5c7c7e=_[_0xc93d('0x3c')]({},_0x5c7c7e,_0x2947e5[_0xc93d('0x41')]);return db[_0xc93d('0x2a')][_0xc93d('0x49')](_0x5c7c7e)[_0xc93d('0x24')](handleEntityNotFound(_0x10ba2d,null))['then'](respondWithResult(_0x10ba2d,null))[_0xc93d('0x1a')](handleError(_0x10ba2d,null));};exports[_0xc93d('0x4a')]=function(_0x8db5ee,_0x371454){return db[_0xc93d('0x2a')]['create'](_0x8db5ee[_0xc93d('0x4b')],{})[_0xc93d('0x24')](function(_0x360b8a){var _0x4c9f2d=_0x8db5ee[_0xc93d('0x4c')][_0xc93d('0x4d')]({'plain':!![]});if(!_0x4c9f2d)throw new Error(_0xc93d('0x4e'));if(_0x4c9f2d[_0xc93d('0x4f')]===_0xc93d('0x4c')){var _0x3ad737=_0x360b8a[_0xc93d('0x4d')]({'plain':!![]});var _0x37e57e=_0xc93d('0x25');return db[_0xc93d('0x50')][_0xc93d('0x49')]({'where':{'name':_0x37e57e,'userProfileId':_0x4c9f2d['userProfileId']},'raw':!![]})[_0xc93d('0x24')](function(_0x52a280){if(_0x52a280&&_0x52a280[_0xc93d('0x51')]===0x0){return db[_0xc93d('0x52')][_0xc93d('0x4a')]({'name':_0x3ad737[_0xc93d('0x28')],'resourceId':_0x3ad737['id'],'type':_0x52a280['name'],'sectionId':_0x52a280['id']},{})['then'](function(){return _0x360b8a;});}else{return _0x360b8a;}})[_0xc93d('0x1a')](function(_0x21f8a4){logger[_0xc93d('0x17')](_0xc93d('0x53'),_0x21f8a4);throw _0x21f8a4;});}return _0x360b8a;})[_0xc93d('0x24')](respondWithResult(_0x371454,0xc9))[_0xc93d('0x1a')](handleError(_0x371454,null));};exports['update']=function(_0x4caa72,_0x26f416){if(_0x4caa72[_0xc93d('0x4b')]['id']){delete _0x4caa72[_0xc93d('0x4b')]['id'];}return db[_0xc93d('0x2a')][_0xc93d('0x49')]({'where':{'id':_0x4caa72[_0xc93d('0x46')]['id']},'include':[{'model':db[_0xc93d('0x47')],'as':'mandatoryDispositionPause'}]})[_0xc93d('0x24')](handleEntityNotFound(_0x26f416,null))[_0xc93d('0x24')](saveUpdates(_0x4caa72['body'],null))[_0xc93d('0x24')](respondWithResult(_0x26f416,null))[_0xc93d('0x1a')](handleError(_0x26f416,null));};exports['destroy']=function(_0x55f550,_0x4a0b32){return db[_0xc93d('0x2a')][_0xc93d('0x49')]({'where':{'id':_0x55f550['params']['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x4a0b32,null))[_0xc93d('0x24')](removeEntity(_0x4a0b32,null))[_0xc93d('0x1a')](handleError(_0x4a0b32,null));};exports[_0xc93d('0x54')]=function(_0x513212,_0x57fecc){return db['ChatWebsite'][_0xc93d('0x54')]()[_0xc93d('0x24')](respondWithResult(_0x57fecc,null))[_0xc93d('0x1a')](handleError(_0x57fecc,null));};exports[_0xc93d('0x55')]=function(_0x45df78,_0x5e0b5e){if(_0x45df78['body']['id']){delete _0x45df78[_0xc93d('0x4b')]['id'];}return db[_0xc93d('0x2a')][_0xc93d('0x49')]({'where':{'id':_0x45df78['params']['id']}})['then'](handleEntityNotFound(_0x5e0b5e,null))['then'](function(_0x4c8fd8){if(_0x4c8fd8){_0x45df78[_0xc93d('0x4b')][_0xc93d('0x56')]=_0x4c8fd8['id'];return db['Disposition'][_0xc93d('0x4a')](_0x45df78[_0xc93d('0x4b')]);}})[_0xc93d('0x24')](respondWithResult(_0x5e0b5e,null))['catch'](handleError(_0x5e0b5e,null));};exports[_0xc93d('0x57')]=function(_0x4873e7,_0x51f7d2){var _0x2ed722={'raw':![],'where':{}};var _0x3f7367={};var _0x52b4f4={'count':0x0,'rows':[]};return db[_0xc93d('0x2a')][_0xc93d('0x58')]({'where':{'id':_0x4873e7[_0xc93d('0x46')]['id']}})['then'](handleEntityNotFound(_0x51f7d2,null))[_0xc93d('0x24')](function(_0x5c02f0){if(_0x5c02f0){_0x3f7367['model']=_[_0xc93d('0x2f')](db[_0xc93d('0x59')][_0xc93d('0x2b')]);_0x3f7367[_0xc93d('0x2e')]=_['keys'](_0x4873e7[_0xc93d('0x2e')]);_0x3f7367[_0xc93d('0x30')]=_[_0xc93d('0x31')](_0x3f7367[_0xc93d('0x32')],_0x3f7367[_0xc93d('0x2e')]);_0x2ed722[_0xc93d('0x33')]=_[_0xc93d('0x31')](_0x3f7367[_0xc93d('0x32')],qs[_0xc93d('0x34')](_0x4873e7[_0xc93d('0x2e')]['fields']));_0x2ed722[_0xc93d('0x33')]=_0x2ed722['attributes'][_0xc93d('0x35')]?_0x2ed722[_0xc93d('0x33')]:_0x3f7367[_0xc93d('0x32')];if(!_0x4873e7[_0xc93d('0x2e')][_0xc93d('0x36')](_0xc93d('0x37'))){_0x2ed722['limit']=qs[_0xc93d('0x20')](_0x4873e7[_0xc93d('0x2e')][_0xc93d('0x20')]);_0x2ed722[_0xc93d('0x1e')]=qs[_0xc93d('0x1e')](_0x4873e7[_0xc93d('0x2e')][_0xc93d('0x1e')]);}_0x2ed722[_0xc93d('0x38')]=qs[_0xc93d('0x39')](_0x4873e7[_0xc93d('0x2e')][_0xc93d('0x39')]);_0x2ed722[_0xc93d('0x3b')]=qs[_0xc93d('0x30')](_[_0xc93d('0x3a')](_0x4873e7['query'],_0x3f7367[_0xc93d('0x30')]));_0x2ed722[_0xc93d('0x3b')][_0xc93d('0x56')]=_0x5c02f0['id'];if(_0x4873e7['query'][_0xc93d('0x40')]){_0x2ed722[_0xc93d('0x3b')]=_[_0xc93d('0x3c')](_0x2ed722[_0xc93d('0x3b')],{'$or':_[_0xc93d('0x3d')](_0x2ed722[_0xc93d('0x33')],function(_0x1129d9){var _0x3aa0b7={};_0x3aa0b7[_0x1129d9]={'$like':'%'+_0x4873e7[_0xc93d('0x2e')][_0xc93d('0x40')]+'%'};return _0x3aa0b7;})});}_0x2ed722=_['merge']({},_0x2ed722,_0x4873e7[_0xc93d('0x41')]);return db[_0xc93d('0x59')][_0xc93d('0x21')]({'where':_0x2ed722[_0xc93d('0x3b')]})[_0xc93d('0x24')](function(_0x1a0326){_0x52b4f4['count']=_0x1a0326;if(_0x4873e7[_0xc93d('0x2e')][_0xc93d('0x42')]){_0x2ed722[_0xc93d('0x48')]=[{'all':!![]}];}return db[_0xc93d('0x59')]['findAll'](_0x2ed722);})[_0xc93d('0x24')](function(_0x437302){_0x52b4f4['rows']=_0x437302;return _0x52b4f4;});}})[_0xc93d('0x24')](respondWithFilteredResult(_0x51f7d2,_0x2ed722))['catch'](handleError(_0x51f7d2,null));};exports[_0xc93d('0x5a')]=function(_0x1a87d6,_0x54f3f7){return db[_0xc93d('0x2a')][_0xc93d('0x49')]({'where':{'id':_0x1a87d6[_0xc93d('0x46')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x54f3f7,null))[_0xc93d('0x24')](function(_0x348f59){if(_0x348f59){return _0x348f59['removeDispositions'](_0x1a87d6['query'][_0xc93d('0x5b')]);}})[_0xc93d('0x24')](respondWithStatusCode(_0x54f3f7,null))['catch'](handleError(_0x54f3f7,null));};exports[_0xc93d('0x5c')]=function(_0x140bb4,_0x382c9d){if(_0x140bb4[_0xc93d('0x4b')]['id']){delete _0x140bb4['body']['id'];}return db[_0xc93d('0x2a')][_0xc93d('0x49')]({'where':{'id':_0x140bb4[_0xc93d('0x46')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x382c9d,null))[_0xc93d('0x24')](function(_0x45f646){if(_0x45f646){_0x140bb4[_0xc93d('0x4b')][_0xc93d('0x56')]=_0x45f646['id'];return db['CannedAnswer'][_0xc93d('0x4a')](_0x140bb4[_0xc93d('0x4b')]);}})[_0xc93d('0x24')](respondWithResult(_0x382c9d,null))[_0xc93d('0x1a')](handleError(_0x382c9d,null));};exports[_0xc93d('0x5d')]=function(_0x2716e7,_0x4cbbde){var _0x1b49db={'raw':![],'where':{}};var _0x1ee046={};var _0xbf1b4e={'count':0x0,'rows':[]};return db[_0xc93d('0x2a')][_0xc93d('0x58')]({'where':{'id':_0x2716e7[_0xc93d('0x46')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x4cbbde,null))[_0xc93d('0x24')](function(_0x107b81){if(_0x107b81){_0x1ee046[_0xc93d('0x32')]=_['keys'](db[_0xc93d('0x5e')][_0xc93d('0x2b')]);_0x1ee046[_0xc93d('0x2e')]=_['keys'](_0x2716e7['query']);_0x1ee046[_0xc93d('0x30')]=_['intersection'](_0x1ee046['model'],_0x1ee046[_0xc93d('0x2e')]);_0x1b49db[_0xc93d('0x33')]=_[_0xc93d('0x31')](_0x1ee046[_0xc93d('0x32')],qs[_0xc93d('0x34')](_0x2716e7[_0xc93d('0x2e')][_0xc93d('0x34')]));_0x1b49db[_0xc93d('0x33')]=_0x1b49db[_0xc93d('0x33')][_0xc93d('0x35')]?_0x1b49db[_0xc93d('0x33')]:_0x1ee046[_0xc93d('0x32')];if(!_0x2716e7[_0xc93d('0x2e')][_0xc93d('0x36')](_0xc93d('0x37'))){_0x1b49db[_0xc93d('0x20')]=qs[_0xc93d('0x20')](_0x2716e7[_0xc93d('0x2e')][_0xc93d('0x20')]);_0x1b49db[_0xc93d('0x1e')]=qs[_0xc93d('0x1e')](_0x2716e7[_0xc93d('0x2e')][_0xc93d('0x1e')]);}_0x1b49db['order']=qs['sort'](_0x2716e7['query'][_0xc93d('0x39')]);_0x1b49db['where']=qs['filters'](_['pick'](_0x2716e7[_0xc93d('0x2e')],_0x1ee046['filters']));_0x1b49db[_0xc93d('0x3b')]['ChatWebsiteId']=_0x107b81['id'];if(_0x2716e7['query']['filter']){_0x1b49db[_0xc93d('0x3b')]=_[_0xc93d('0x3c')](_0x1b49db['where'],{'$or':_[_0xc93d('0x3d')](_0x1b49db[_0xc93d('0x33')],function(_0x2965d6){var _0x563737={};_0x563737[_0x2965d6]={'$like':'%'+_0x2716e7[_0xc93d('0x2e')]['filter']+'%'};return _0x563737;})});}_0x1b49db=_[_0xc93d('0x3c')]({},_0x1b49db,_0x2716e7[_0xc93d('0x41')]);return db[_0xc93d('0x5e')][_0xc93d('0x21')]({'where':_0x1b49db[_0xc93d('0x3b')]})[_0xc93d('0x24')](function(_0x225112){_0xbf1b4e[_0xc93d('0x21')]=_0x225112;if(_0x2716e7[_0xc93d('0x2e')][_0xc93d('0x42')]){_0x1b49db['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1b49db);})['then'](function(_0x71968c){_0xbf1b4e[_0xc93d('0x44')]=_0x71968c;return _0xbf1b4e;});}})[_0xc93d('0x24')](respondWithFilteredResult(_0x4cbbde,_0x1b49db))[_0xc93d('0x1a')](handleError(_0x4cbbde,null));};exports[_0xc93d('0x5f')]=function(_0xe2faca,_0x45927a){return db['ChatWebsite'][_0xc93d('0x49')]({'where':{'id':_0xe2faca['params']['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x45927a,null))[_0xc93d('0x24')](function(_0x2a8c84){if(_0x2a8c84){return _0x2a8c84['removeAnswers'](_0xe2faca['query'][_0xc93d('0x5b')]);}})[_0xc93d('0x24')](respondWithStatusCode(_0x45927a,null))[_0xc93d('0x1a')](handleError(_0x45927a,null));};exports['addLogo']=function(_0x301725,_0x1851ac){_0x301725['body'][_0xc93d('0x60')]=_0x301725[_0xc93d('0x61')][_0xc93d('0x62')];return db[_0xc93d('0x2a')]['find']({'where':{'id':_0x301725['params']['id']}})['then'](handleEntityNotFound(_0x1851ac,null))['then'](saveUpdates(_0x301725['body'],null))[_0xc93d('0x24')](respondWithResult(_0x1851ac,null))[_0xc93d('0x1a')](handleError(_0x1851ac,null));};exports['addAvatar']=function(_0x23f5e9,_0x364041){_0x23f5e9[_0xc93d('0x4b')][_0xc93d('0x63')]=_0x23f5e9[_0xc93d('0x61')][_0xc93d('0x62')];return db['ChatWebsite'][_0xc93d('0x49')]({'where':{'id':_0x23f5e9[_0xc93d('0x46')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x364041,null))[_0xc93d('0x24')](saveUpdates(_0x23f5e9[_0xc93d('0x4b')],null))['then'](respondWithResult(_0x364041,null))[_0xc93d('0x1a')](handleError(_0x364041,null));};exports[_0xc93d('0x64')]=function(_0x19c987,_0xd7ae29){_0x19c987[_0xc93d('0x4b')][_0xc93d('0x65')]=_0x19c987[_0xc93d('0x61')][_0xc93d('0x62')];return db['ChatWebsite']['find']({'where':{'id':_0x19c987[_0xc93d('0x46')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0xd7ae29,null))['then'](saveUpdates(_0x19c987[_0xc93d('0x4b')],null))['then'](respondWithResult(_0xd7ae29,null))[_0xc93d('0x1a')](handleError(_0xd7ae29,null));};exports['addSystemAvatar']=function(_0x3d853d,_0x3750bf){_0x3d853d[_0xc93d('0x4b')][_0xc93d('0x66')]=_0x3d853d[_0xc93d('0x61')][_0xc93d('0x62')];return db[_0xc93d('0x2a')][_0xc93d('0x49')]({'where':{'id':_0x3d853d[_0xc93d('0x46')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x3750bf,null))['then'](saveUpdates(_0x3d853d[_0xc93d('0x4b')],null))[_0xc93d('0x24')](respondWithResult(_0x3750bf,null))['catch'](handleError(_0x3750bf,null));};exports['getLogo']=function(_0x2ea38f,_0x2753ed){var _0x5c4f66=path['join'](config[_0xc93d('0x67')],_0xc93d('0x68'));var _0x3882a9={'where':{'id':_0x2ea38f[_0xc93d('0x46')]['id']},'attributes':['id',_0xc93d('0x60')],'raw':!![]};var _0xa56bcf=![];return require(_0xc93d('0x69'))[_0xc93d('0x6a')]()['then'](function(_0x377a80){if(_0x377a80){_0xa56bcf=_0x377a80[_0xc93d('0x6b')];}})['then'](function(){return db['ChatWebsite'][_0xc93d('0x49')](_0x3882a9);})[_0xc93d('0x24')](handleEntityNotFound(_0x2753ed,null))['then'](function(_0x308402){if(_0x308402){if(!_[_0xc93d('0x6c')](_0x308402[_0xc93d('0x60')])){if(fs['existsSync'](path[_0xc93d('0x6d')](config[_0xc93d('0x67')],_0xc93d('0x6e'),_0x308402[_0xc93d('0x60')]))&&_0xa56bcf){_0x5c4f66=path['join'](config[_0xc93d('0x67')],_0xc93d('0x6e'),_0x308402[_0xc93d('0x60')]);}}return _0x2753ed[_0xc93d('0x6f')](_0x5c4f66);}})[_0xc93d('0x1a')](handleError(_0x2753ed,null));};exports['getAvatar']=function(_0x392657,_0x5c62d4){var _0x3ea4f3=path[_0xc93d('0x6d')](config['root'],_0xc93d('0x70'));var _0xb1d230={'where':{'id':_0x392657[_0xc93d('0x46')]['id']},'attributes':['id',_0xc93d('0x63')],'raw':!![]};return db['ChatWebsite']['find'](_0xb1d230)[_0xc93d('0x24')](handleEntityNotFound(_0x5c62d4,null))[_0xc93d('0x24')](function(_0x29f8e7){if(_0x29f8e7){if(!_[_0xc93d('0x6c')](_0x29f8e7[_0xc93d('0x63')])){if(fs[_0xc93d('0x71')](path[_0xc93d('0x6d')](config[_0xc93d('0x67')],_0xc93d('0x72'),_0x29f8e7[_0xc93d('0x63')]))){_0x3ea4f3=path[_0xc93d('0x6d')](config[_0xc93d('0x67')],_0xc93d('0x72'),_0x29f8e7[_0xc93d('0x63')]);}}return _0x5c62d4[_0xc93d('0x6f')](_0x3ea4f3);}})[_0xc93d('0x1a')](handleError(_0x5c62d4,null));};exports['getCustomerAvatar']=function(_0xe8bece,_0x555ebe){var _0x3b0bde=path[_0xc93d('0x6d')](config[_0xc93d('0x67')],'server/files/images/avatars/customer_avatar.png');var _0x2fc039={'where':{'id':_0xe8bece[_0xc93d('0x46')]['id']},'attributes':['id','customerAvatar',_0xc93d('0x73')],'raw':!![]};return db[_0xc93d('0x2a')][_0xc93d('0x49')](_0x2fc039)[_0xc93d('0x24')](handleEntityNotFound(_0x555ebe,null))[_0xc93d('0x24')](function(_0x3bc486){if(_0x3bc486){if(!_[_0xc93d('0x6c')](_0x3bc486[_0xc93d('0x65')])){if(fs['existsSync'](path[_0xc93d('0x6d')](config[_0xc93d('0x67')],_0xc93d('0x72'),_0x3bc486[_0xc93d('0x65')]))&&_0x3bc486[_0xc93d('0x73')]){_0x3b0bde=path['join'](config[_0xc93d('0x67')],_0xc93d('0x72'),_0x3bc486[_0xc93d('0x65')]);}}return _0x555ebe[_0xc93d('0x6f')](_0x3b0bde);}})[_0xc93d('0x1a')](handleError(_0x555ebe,null));};exports[_0xc93d('0x74')]=function(_0x33c636,_0x3f28f1){var _0x20e2ca=path[_0xc93d('0x6d')](config[_0xc93d('0x67')],_0xc93d('0x75'));var _0x4b2088={'where':{'id':_0x33c636[_0xc93d('0x46')]['id']},'attributes':['id',_0xc93d('0x66')],'raw':!![]};return db[_0xc93d('0x2a')][_0xc93d('0x49')](_0x4b2088)['then'](handleEntityNotFound(_0x3f28f1,null))[_0xc93d('0x24')](function(_0x326846){if(_0x326846){if(!_[_0xc93d('0x6c')](_0x326846['systemAvatar'])){if(fs['existsSync'](path[_0xc93d('0x6d')](config[_0xc93d('0x67')],'server/files/images/avatars/',_0x326846['systemAvatar']))){_0x20e2ca=path[_0xc93d('0x6d')](config[_0xc93d('0x67')],_0xc93d('0x72'),_0x326846[_0xc93d('0x66')]);}}return _0x3f28f1[_0xc93d('0x6f')](_0x20e2ca);}})[_0xc93d('0x1a')](handleError(_0x3f28f1,null));};exports[_0xc93d('0x76')]=function(_0x1015db,_0x2b305a){var _0x30a35e=require(_0xc93d('0x77'));var _0x105cae=new _0x30a35e();var _0x5a1533=_0x105cae[_0xc93d('0x78')](_0x1015db['headers'][_0xc93d('0x79')])['getResult']();var _0x2149ee={'body':_0x1015db['body'],'channel':_0xc93d('0x7a')};var _0x45f6f3=[];var _0x2125f9=[];var _0x2d87d3={};var _0x4e11cd=![];return db[_0xc93d('0x7b')][_0xc93d('0x54')]()[_0xc93d('0x24')](function(_0x320427){if(!_0x320427){throw new db[(_0xc93d('0x7c'))][(_0xc93d('0x7d'))](_0xc93d('0x7e'));}_0x45f6f3=_[_0xc93d('0x7f')](_[_0xc93d('0x2f')](_0x320427),[_0xc93d('0x80'),_0xc93d('0x81')]);_0x2125f9=_[_0xc93d('0x7f')](_['keys'](_0x320427),['createdAt',_0xc93d('0x81'),_0xc93d('0x82'),'ListId']);if(_0x1015db[_0xc93d('0x4b')]['id']){delete _0x1015db[_0xc93d('0x4b')]['id'];}if(_[_0xc93d('0x6c')](_0x1015db[_0xc93d('0x4b')]['from'])){throw new db['Sequelize'][(_0xc93d('0x7d'))](_0xc93d('0x83'));}if(_['isNil'](_0x1015db[_0xc93d('0x4b')][_0xc93d('0x4b')])||_0x1015db[_0xc93d('0x4b')][_0xc93d('0x4b')]===''){throw new db[(_0xc93d('0x7c'))][(_0xc93d('0x7d'))](_0xc93d('0x84'));}if(_['isNil'](_0x1015db[_0xc93d('0x4b')]['mapKey'])){throw new db[(_0xc93d('0x7c'))][(_0xc93d('0x7d'))](_0xc93d('0x85')+_0x2125f9);}if(!_[_0xc93d('0x86')](_0x2125f9,_0x1015db[_0xc93d('0x4b')][_0xc93d('0x87')])){throw new db[(_0xc93d('0x7c'))][(_0xc93d('0x7d'))](_0xc93d('0x88')+_0x2125f9);}_0x2d87d3[_0x1015db['body'][_0xc93d('0x87')]]=_0x1015db[_0xc93d('0x4b')][_0xc93d('0x89')];})['then'](function(){return db[_0xc93d('0x2a')][_0xc93d('0x49')]({'where':{'id':_0x1015db[_0xc93d('0x46')]['id']},'include':[{'model':db[_0xc93d('0x8a')],'as':'List','include':[{'model':db[_0xc93d('0x7b')],'as':_0xc93d('0x8b'),'where':_0x2d87d3,'limit':0x1,'order':[[_0xc93d('0x81'),_0xc93d('0x8c')]]}]},{'model':db[_0xc93d('0x8d')],'as':_0xc93d('0x8e')}]});})[_0xc93d('0x24')](handleEntityNotFound(_0x2b305a,null))['then'](function(_0x53275e){if(_0x53275e&&_0x53275e[_0xc93d('0x8f')]){_0x2149ee[_0xc93d('0x90')]=_0x53275e;_0x2149ee['applications']=_0x53275e[_0xc93d('0x8e')];_0x2149ee[_0xc93d('0x91')]=_0x53275e[_0xc93d('0x8f')];_0x2149ee['applications']=_[_0xc93d('0x92')](_0x2149ee['applications'],[_0xc93d('0x93')],[_0xc93d('0x94')]);if(_0x2149ee['account'][_0xc93d('0x8e')]){delete _0x2149ee[_0xc93d('0x90')][_0xc93d('0x8e')];}if(_0x2149ee['account'][_0xc93d('0x8f')]&&_0x2149ee['account'][_0xc93d('0x8f')]['Contacts'][_0xc93d('0x35')]){return _0x2149ee[_0xc93d('0x90')][_0xc93d('0x8f')]['Contacts'][0x0];}var _0x8125a4=_[_0xc93d('0x7')](_0x1015db[_0xc93d('0x4b')],{'firstName':_0x1015db[_0xc93d('0x4b')][_0xc93d('0x89')],'ListId':_0x53275e[_0xc93d('0x95')]});_0x8125a4[_0x1015db['body'][_0xc93d('0x87')]]=_0x1015db[_0xc93d('0x4b')][_0xc93d('0x89')];return db[_0xc93d('0x7b')][_0xc93d('0x4a')](_0x8125a4,{'fields':_0x45f6f3,'raw':!![]});}})[_0xc93d('0x24')](handleEntityNotFound(_0x2b305a,null))[_0xc93d('0x24')](function(_0x2311ac){_0x2149ee[_0xc93d('0x96')]=_0x2311ac;var _0x2a02a6=_0x1015db[_0xc93d('0x4b')]['customerIp'];if(_0x1015db['headers'][_0xc93d('0x97')]){_0x2a02a6=_0x1015db[_0xc93d('0x98')]['cf-connecting-ip'];}else if(_0x1015db[_0xc93d('0x98')][_0xc93d('0x99')]){_0x2a02a6=_['first'](_0x1015db[_0xc93d('0x98')][_0xc93d('0x99')][_0xc93d('0x9a')](','));}if(_0x2311ac){var _0x129b85={'ContactId':_0x2311ac['id'],'ChatWebsiteId':_0x1015db[_0xc93d('0x46')]['id'],'from':(_0x2311ac[_0xc93d('0x9b')]||'')+'\x20'+(_0x2311ac[_0xc93d('0x9c')]||''),'customerIp':_0x2a02a6,'customerPort':_0x1015db[_0xc93d('0x98')][_0xc93d('0x9d')]?_0x1015db[_0xc93d('0x98')]['x-real-port']:null,'referer':_0x1015db[_0xc93d('0x4b')][_0xc93d('0x9e')],'browserName':_0x5a1533[_0xc93d('0x9f')][_0xc93d('0x28')]&&_0x5a1533[_0xc93d('0x9f')][_0xc93d('0xa0')]?util[_0xc93d('0xa1')](_0xc93d('0xa2'),_0x5a1533['browser'][_0xc93d('0x28')],_0x5a1533[_0xc93d('0x9f')]['version']):_0xc93d('0xa3'),'browserVersion':_0x5a1533[_0xc93d('0x9f')][_0xc93d('0xa0')]||'unknown','osName':util['format']('%s\x20%s',_0x5a1533['os'][_0xc93d('0x28')],_0x5a1533['os'][_0xc93d('0xa0')]),'osVersion':_0x5a1533['os'][_0xc93d('0xa0')],'deviceModel':_0x5a1533['device']['model']&&_0x5a1533['device'][_0xc93d('0xa4')]?util[_0xc93d('0xa1')](_0xc93d('0xa5'),_0x5a1533[_0xc93d('0xa6')][_0xc93d('0x32')],_0x5a1533[_0xc93d('0xa6')][_0xc93d('0xa4')],_0x5a1533[_0xc93d('0xa6')][_0xc93d('0x3e')]):null,'deviceVendor':_0x5a1533['device']['vendor'],'deviceType':_0x5a1533[_0xc93d('0xa6')][_0xc93d('0x3e')],'formData':JSON[_0xc93d('0x16')](_0x1015db[_0xc93d('0x4b')])};var _0x1c6ffe={'ChatWebsiteId':_0x1015db['params']['id'],'closed':![]};if(_0x1015db['body']['threadId']){_0x1c6ffe[_0xc93d('0xa7')]=_0x1015db['body'][_0xc93d('0xa7')];return db['ChatInteraction'][_0xc93d('0x49')]({'where':_0x1c6ffe})[_0xc93d('0x24')](function(_0x28a90d){if(_0x28a90d){return[_0x28a90d,![]];}_0x129b85[_0xc93d('0xa7')]=_0x1015db[_0xc93d('0x4b')][_0xc93d('0xa7')];_0x129b85[_0xc93d('0xa8')]=_0x1015db[_0xc93d('0x4b')]['externalUrl'];return db[_0xc93d('0xa9')][_0xc93d('0x4a')](_0x129b85)['then'](function(_0x55eb01){return[_0x55eb01,!![]];});});}_0x1c6ffe[_0xc93d('0xaa')]=_0x2311ac['id'];if(_0x1015db[_0xc93d('0x4b')][_0xc93d('0xab')]&&_0x1015db[_0xc93d('0x4b')][_0xc93d('0xab')]['id']){_0x1c6ffe['id']=_0x1015db[_0xc93d('0x4b')][_0xc93d('0xab')]['id'];return db[_0xc93d('0xa9')][_0xc93d('0x49')]({'where':_0x1c6ffe})[_0xc93d('0x24')](function(_0x5bdcbd){if(_0x5bdcbd){return[_0x5bdcbd,![]];}return db[_0xc93d('0xa9')][_0xc93d('0x4a')](_0x129b85)[_0xc93d('0x24')](function(_0x1cec75){return[_0x1cec75,!![]];});});}return db['ChatInteraction']['create'](_0x129b85)[_0xc93d('0x24')](function(_0x31bbb3){return[_0x31bbb3,!![]];});}})[_0xc93d('0xac')](function(_0x3bd8fa,_0x16fab9){if(_0x3bd8fa){_0x4e11cd=_0x16fab9;if(!_0x16fab9){var _0x362d78={'from':(_0x2149ee['contact'][_0xc93d('0x9b')]||'')+'\x20'+(_0x2149ee[_0xc93d('0x96')][_0xc93d('0x9c')]||'')};if(_0x1015db[_0xc93d('0x4b')][_0xc93d('0xa7')]&&_0x1015db[_0xc93d('0x4b')][_0xc93d('0xad')]&&_0x1015db[_0xc93d('0x4b')][_0xc93d('0xa7')]!=_0x1015db[_0xc93d('0x4b')][_0xc93d('0xad')]){_0x362d78[_0xc93d('0xa7')]=_0x1015db[_0xc93d('0x4b')]['messageId'];}return _0x3bd8fa[_0xc93d('0x23')](_0x362d78);}else{return _0x3bd8fa;}}})[_0xc93d('0x24')](function(_0x47cd54){_0x2149ee['interaction']=_0x47cd54['get']({'plain':!![]});_0x2149ee[_0xc93d('0xab')][_0xc93d('0xae')]=_0x4e11cd;if(_0x2149ee['interaction']['created']){if(_0x2149ee[_0xc93d('0x90')][_0xc93d('0xaf')]){_0x2149ee['applications'][_0xc93d('0xb0')]({'id':0x0,'priority':_0x2149ee[_0xc93d('0xb1')]['length']+0x1,'app':_0xc93d('0xb2'),'appdata':'unmanaged','interval':_0xc93d('0xb3')});}}return db[_0xc93d('0xb4')][_0xc93d('0x4a')]({'body':_0x1015db[_0xc93d('0x4b')][_0xc93d('0x4b')],'ChatWebsiteId':_0x1015db[_0xc93d('0x46')]['id'],'ChatInteractionId':_0x47cd54['id'],'direction':'in','ContactId':_0x2149ee[_0xc93d('0x96')]['id'],'AttachmentId':_0x1015db[_0xc93d('0x4b')][_0xc93d('0xb5')]});})[_0xc93d('0x24')](function(_0x123ea1){_0x2149ee[_0xc93d('0x19')]=_0x123ea1;if(_0x2149ee[_0xc93d('0xab')][_0xc93d('0xb6')]){return db[_0xc93d('0xb7')]['find']({'attributes':['id','name'],'where':{'id':_0x2149ee[_0xc93d('0xab')][_0xc93d('0xb6')]}})[_0xc93d('0x24')](function(_0x2c770f){if(_0x2c770f){_0x2149ee[_0xc93d('0xb1')][_0xc93d('0xb8')]({'id':0x0,'priority':0x0,'app':_0xc93d('0xb9'),'appdata':_0x2c770f['name']+','+(_0x2149ee[_0xc93d('0x90')]['waitForTheAssignedAgent']||0xa),'interval':_0xc93d('0xb3')});_0x2149ee['forcedOwnership']=!![];}return respondWithRpcPromise(_0xc93d('0xba'),_0xc93d('0xbb'),_0x2149ee);});}return respondWithRpcPromise('Start',_0xc93d('0xbb'),_0x2149ee);})['then'](function(_0x33f4ed){respondWithRpcPromise('EventManager',_0xc93d('0xbc'),{'event':_0xc93d('0x76'),'message':_0x33f4ed},client9002);return _0x33f4ed;})[_0xc93d('0x24')](respondWithResult(_0x2b305a,null))[_0xc93d('0x1a')](handleError(_0x2b305a,null));};exports[_0xc93d('0xbd')]=function(_0x283f05,_0x1a5fa8){var _0x45ac09,_0x3974a2,_0x34946f;var _0x56dd40=[];var _0x347476={};var _0x464b65=_0x283f05[_0xc93d('0xbe')]||[];var _0x4ec0e7=[];var _0x345b24;return db['CmContact']['describe']()[_0xc93d('0x24')](function(_0x56b682){if(!_0x56b682){throw new db['Sequelize'][(_0xc93d('0x7d'))](_0xc93d('0x7e'));}_0x56dd40=_[_0xc93d('0x7f')](_[_0xc93d('0x2f')](_0x56b682),['createdAt',_0xc93d('0x81'),_0xc93d('0x82'),_0xc93d('0x95')]);if(_0x283f05[_0xc93d('0x4b')]['id']){delete _0x283f05['body']['id'];}if(_[_0xc93d('0x6c')](_0x283f05[_0xc93d('0x4b')][_0xc93d('0x89')])){throw _0x1a5fa8[_0xc93d('0x1c')](0x1f4)[_0xc93d('0xbf')](new db['Sequelize'][(_0xc93d('0x7d'))](_0xc93d('0x83')));}if(_[_0xc93d('0x6c')](_0x283f05['body'][_0xc93d('0x4b')])||_0x283f05[_0xc93d('0x4b')]['body']===''){throw _0x1a5fa8['status'](0x1f4)[_0xc93d('0xbf')](new db[(_0xc93d('0x7c'))]['ValidationError'](_0xc93d('0x84')));}if(_[_0xc93d('0x6c')](_0x283f05['body']['mapKeyOffline'])){throw _0x1a5fa8[_0xc93d('0x1c')](0x1f4)[_0xc93d('0xbf')](new db[(_0xc93d('0x7c'))][(_0xc93d('0x7d'))](_0xc93d('0xc0')+_0x56dd40));}if(!_[_0xc93d('0x86')](_0x56dd40,_0x283f05[_0xc93d('0x4b')]['mapKeyOffline'])){throw _0x1a5fa8['status'](0x1f4)[_0xc93d('0xbf')](new db[(_0xc93d('0x7c'))][(_0xc93d('0x7d'))](_0xc93d('0xc1')+_0x56dd40));}_0x347476[_0x283f05[_0xc93d('0x4b')][_0xc93d('0xc2')]]=_0x283f05[_0xc93d('0x4b')][_0xc93d('0x89')];})['then'](function(){return db['ChatWebsite'][_0xc93d('0x49')]({'where':{'id':_0x283f05[_0xc93d('0x46')]['id']},'include':[{'model':db[_0xc93d('0x8a')],'as':_0xc93d('0x8f')},{'model':db['MailAccount'],'as':_0xc93d('0xc3')}]});})[_0xc93d('0x24')](handleEntityNotFound(_0x1a5fa8,null))[_0xc93d('0x24')](function(_0x2a14c1){if(_0x2a14c1&&_0x2a14c1[_0xc93d('0x8f')]){_0x3974a2=_0x2a14c1;var _0x596278=_[_0xc93d('0x7')](_0x283f05[_0xc93d('0x4b')],{'firstName':_0x283f05['body']['from'],'phone':_0x283f05[_0xc93d('0x4b')][_0xc93d('0x89')],'ListId':_0x2a14c1[_0xc93d('0x95')]});_0x596278[_0x283f05[_0xc93d('0x4b')][_0xc93d('0xc2')]]=_0x283f05['body'][_0xc93d('0x89')];return db[_0xc93d('0x7b')][_0xc93d('0xc4')]({'where':_0x347476,'defaults':_0x596278});}})[_0xc93d('0xac')](function(_0x524e76){if(_0x524e76){_0x34946f=_0x524e76;var _0x5472b7=fs[_0xc93d('0xc5')](path[_0xc93d('0x6d')](config[_0xc93d('0x67')],'server/files/templates/chatOfflineMessage.ejs'),_0xc93d('0xc6'));var _0x432e96=ejs[_0xc93d('0xc7')](_0x5472b7,{'body':_[_0xc93d('0xc8')](_0x283f05[_0xc93d('0x4b')][_0xc93d('0x4b')]),'bodyTitle':_0x3974a2['offlineMessageBody']});return db[_0xc93d('0xc9')][_0xc93d('0x4a')]({'body':_0x432e96,'plainBody':htmlToText[_0xc93d('0xca')](_0x432e96),'ContactId':_0x524e76['id'],'ChatWebsiteId':_0x3974a2['id']});}})[_0xc93d('0x24')](function(_0x527f07){_0x345b24=_0x527f07;if(_0x464b65[_0xc93d('0x35')]){var _0x93d653=_0x464b65[_0xc93d('0x3d')](function(_0x33b0df){return{'name':_0x33b0df[_0xc93d('0xcb')],'basename':_0x33b0df[_0xc93d('0x62')],'type':_0x33b0df[_0xc93d('0xcc')],'ChatOfflineMessageId':_0x527f07['id']};});_0x4ec0e7=_0x93d653[_0xc93d('0x3d')](_0x26d60a=>{var _0x357a2d={'filename':_0x26d60a[_0xc93d('0x28')],'path':path[_0xc93d('0x6d')](config[_0xc93d('0x67')],_0xc93d('0xcd'),_0xc93d('0xbe'),'attachments','offline-chat',_0x26d60a[_0xc93d('0xce')])};return _0x357a2d;});if(!_0x3974a2[_0xc93d('0xcf')]){return db[_0xc93d('0xd0')]['transaction'](function(_0x112a2a){return db[_0xc93d('0xd1')]['bulkCreate'](_0x93d653,{'transaction':_0x112a2a});});}}})[_0xc93d('0x24')](function(){if(_0x345b24){_0x45ac09=_0x345b24;return db[_0xc93d('0xc3')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xc93d('0xd2'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0xc93d('0x24')](function(_0x26781f){if(_0x26781f&&_0x26781f[_0xc93d('0xd2')]&&_0x3974a2[_0xc93d('0xd3')]&&_0x3974a2['forwardOfflineAddress']){var _0x146638=_0x26781f['getSmtpOptions']();return respondWithRpcPromise(_0xc93d('0xd4'),'sendMail',{'account':_0x146638,'message':{'from':util[_0xc93d('0xa1')](_0xc93d('0xd5'),_0x26781f[_0xc93d('0x28')],_0x26781f['email']||_0x26781f[_0xc93d('0xd2')][_0xc93d('0x4c')]),'to':_0x3974a2[_0xc93d('0xd6')],'subject':_0x3974a2['offlineMessageSubject'],'html':_0x45ac09[_0xc93d('0x4b')],'attachments':_0x4ec0e7}},client9003)[_0xc93d('0x24')](function(){return _0x45ac09;})[_0xc93d('0x1a')](function(_0x501411){logger['error'](_0x501411);});}})['then'](function(){if(_0x3974a2&&_0x3974a2[_0xc93d('0xcf')]&&_0x3974a2[_0xc93d('0xd7')]){var _0x5d89b9=[];if(_0x464b65[_0xc93d('0x35')]){_0x5d89b9=_0x464b65[_0xc93d('0x3d')](function(_0x210905){return{'name':_0x210905['originalname'],'basename':_0x210905['filename'],'type':_0x210905[_0xc93d('0xcc')],'ChatOfflineMessageId':_0x345b24['id']};});}var _0x2947d5;if(!_['isNil'](_0x3974a2['subjectOffline'])){var _0x101f9e=_[_0xc93d('0x3d')](_0x283f05['body'],function(_0x4a6912){return _0x4a6912;});var _0x3812ee=_[_0xc93d('0xd8')](_0x101f9e)[0x0];var _0x1641e7=_[_0xc93d('0xd9')](_0x3812ee,function(_0x49be24){return _0x49be24;});_0x2947d5=_0x1641e7[0x1][_0x3974a2['subjectOffline']];}var _0x37f460={'from':_0x34946f[_0xc93d('0xda')],'firstName':_0x34946f[_0xc93d('0x9b')],'lastName':_0x34946f[_0xc93d('0x9c')],'mapKey':_0xc93d('0xda'),'message':{'from':_0x34946f[_0xc93d('0xda')],'to':_0x3974a2['MailAccount'][_0xc93d('0xda')],'cc':'','subject':_['isNil'](_0x2947d5)?_0x3974a2[_0xc93d('0xdb')]:_0x2947d5,'messageId':'','sentAt':new Date(),'attach':_0x5d89b9[_0xc93d('0x35')],'attachments':_0x5d89b9,'originChannel':_0xc93d('0xdc'),'ChatWebsiteId':_0x3974a2['id'],'ChatOfflineMessageId':_0x45ac09['id'],'originTo':_0x3974a2['MailAccount'][_0xc93d('0xda')]},'body':_0x45ac09[_0xc93d('0x4b')]};var _0x54529a={'account':{'id':_0x3974a2['MailAccountId']},'body':_0x37f460,'log':_0xc93d('0xdd')};return respondWithRpcPromise(_0xc93d('0xdd'),_0xc93d('0xde'),_0x54529a,client9001)[_0xc93d('0x24')](function(){return _0x45ac09;})[_0xc93d('0x1a')](function(_0x33973a){logger[_0xc93d('0x17')](_0x33973a);});}return;})['then'](function(){if(_0x45ac09){return _0x45ac09;}})[_0xc93d('0x24')](respondWithResult(_0x1a5fa8,null))[_0xc93d('0x1a')](function(_0x45fff6){logger[_0xc93d('0x17')]('catch',_0x45fff6);for(var _0xf30113 of _0x464b65){var _0x4867de=path[_0xc93d('0x6d')](config[_0xc93d('0x67')],_0xc93d('0xcd'),'files','attachments',_0xc93d('0xdf'),_0xf30113[_0xc93d('0x62')]);fs_extra[_0xc93d('0xe0')](_0x4867de)[_0xc93d('0x1a')](function(_0x214549){logger[_0xc93d('0x17')](_0xc93d('0xe1'),_0x4867de,_0x214549);});}});};exports[_0xc93d('0xe2')]=function(_0x248462,_0x5a8bbc){return db['ChatInteraction']['find']({'where':{'id':_0x248462['params']['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x5a8bbc,null))[_0xc93d('0x24')](function(_0x5eadcd){if(_0x5eadcd){return _0x5eadcd[_0xc93d('0xe2')](_0x248462['body'][_0xc93d('0x5b')],_[_0xc93d('0xe3')](_0x248462[_0xc93d('0x4b')],['ids','id'])||{});}})['then'](respondWithResult(_0x5a8bbc,null))[_0xc93d('0x1a')](handleError(_0x5a8bbc,null));};exports[_0xc93d('0xe4')]=function(_0x2d8e79,_0x281ebf){var _0x4a22a1={'raw':![],'where':{}};var _0x329523={};var _0xc7efbc={'count':0x0,'rows':[]};return db[_0xc93d('0x2a')][_0xc93d('0x58')]({'where':{'id':_0x2d8e79[_0xc93d('0x46')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x281ebf,null))[_0xc93d('0x24')](function(_0x13b37f){if(_0x13b37f){_0x329523['model']=_[_0xc93d('0x2f')](db[_0xc93d('0xa9')][_0xc93d('0x2b')]);_0x329523[_0xc93d('0x2e')]=_[_0xc93d('0x2f')](_0x2d8e79[_0xc93d('0x2e')]);_0x329523[_0xc93d('0x30')]=_[_0xc93d('0x31')](_0x329523[_0xc93d('0x32')],_0x329523[_0xc93d('0x2e')]);_0x4a22a1[_0xc93d('0x33')]=_['intersection'](_0x329523[_0xc93d('0x32')],qs[_0xc93d('0x34')](_0x2d8e79[_0xc93d('0x2e')]['fields']));_0x4a22a1[_0xc93d('0x33')]=_0x4a22a1[_0xc93d('0x33')][_0xc93d('0x35')]?_0x4a22a1['attributes']:_0x329523[_0xc93d('0x32')];if(!_0x2d8e79[_0xc93d('0x2e')][_0xc93d('0x36')](_0xc93d('0x37'))){_0x4a22a1[_0xc93d('0x20')]=qs[_0xc93d('0x20')](_0x2d8e79[_0xc93d('0x2e')][_0xc93d('0x20')]);_0x4a22a1[_0xc93d('0x1e')]=qs[_0xc93d('0x1e')](_0x2d8e79[_0xc93d('0x2e')]['offset']);}_0x4a22a1[_0xc93d('0x38')]=qs['sort'](_0x2d8e79[_0xc93d('0x2e')][_0xc93d('0x39')]);_0x4a22a1[_0xc93d('0x3b')]=qs[_0xc93d('0x30')](_[_0xc93d('0x3a')](_0x2d8e79[_0xc93d('0x2e')],_0x329523[_0xc93d('0x30')]));_0x4a22a1[_0xc93d('0x3b')][_0xc93d('0x56')]=_0x13b37f['id'];if(_0x2d8e79[_0xc93d('0x2e')][_0xc93d('0x40')]){_0x4a22a1['where']=_['merge'](_0x4a22a1[_0xc93d('0x3b')],{'$or':_[_0xc93d('0x3d')](_0x4a22a1[_0xc93d('0x33')],function(_0x4dde0e){var _0x4ca4a6={};_0x4ca4a6[_0x4dde0e]={'$like':'%'+_0x2d8e79[_0xc93d('0x2e')]['filter']+'%'};return _0x4ca4a6;})});}_0x4a22a1=_[_0xc93d('0x3c')]({},_0x4a22a1,_0x2d8e79[_0xc93d('0x41')]);return db['ChatInteraction'][_0xc93d('0x21')]({'where':_0x4a22a1[_0xc93d('0x3b')]})[_0xc93d('0x24')](function(_0x3f5241){_0xc7efbc[_0xc93d('0x21')]=_0x3f5241;if(_0x2d8e79[_0xc93d('0x2e')]['includeAll']){_0x4a22a1[_0xc93d('0x48')]=[{'model':db[_0xc93d('0x7b')],'as':_0xc93d('0xe5'),'required':![]},{'model':db[_0xc93d('0xb7')],'as':_0xc93d('0xe6'),'attributes':['name',_0xc93d('0xe7'),_0xc93d('0xe8')],'required':![]},{'model':db['Tag'],'as':_0xc93d('0xe9'),'attributes':['id',_0xc93d('0x28'),'color'],'where':_0x2d8e79[_0xc93d('0x2e')]['tag']?{'id':_0x2d8e79[_0xc93d('0x2e')]['tag']}:undefined,'required':_0x2d8e79['query']['tag']?!![]:![]}];}return db[_0xc93d('0xa9')][_0xc93d('0x43')](_0x4a22a1);})[_0xc93d('0x24')](function(_0x1975b9){_0xc7efbc['rows']=_0x1975b9;return _0xc7efbc;});}})['then'](respondWithFilteredResult(_0x281ebf,_0x4a22a1))[_0xc93d('0x1a')](handleError(_0x281ebf,null));};function iftimePromise(_0x30e41b,_0x24f49e){return respondWithRpcPromise('Command',_0xc93d('0xea'),{'command':_0x24f49e[_0xc93d('0xeb')]?util[_0xc93d('0xa1')](_0xc93d('0xec'),_0x30e41b['interval'],_0x24f49e['timezone']):util[_0xc93d('0xa1')]('iftime\x20%s',_0x30e41b[_0xc93d('0xed')])},client9002)[_0xc93d('0x24')](function(_0x23c8dc){var _0x40f54c=_0x23c8dc&&_0x23c8dc[_0xc93d('0xee')](_0xc93d('0xef'))>=0x0?!![]:![];logger[_0xc93d('0x12')](_0xc93d('0xf0'),_0x24f49e['id'],_0x30e41b['id'],_0x30e41b[_0xc93d('0xed')],_0x40f54c?_0xc93d('0xf1'):_0xc93d('0xf2'),_0x24f49e[_0xc93d('0xeb')]?_0x24f49e[_0xc93d('0xeb')]:_0xc93d('0xf3'));return _0x40f54c;})[_0xc93d('0x1a')](function(_0x5d6473){logger[_0xc93d('0x17')](_0xc93d('0xf0'),_0x24f49e['id'],_0x30e41b['id'],_0x30e41b['interval'],util[_0xc93d('0xf4')](_0x5d6473,{'showHidden':![],'depth':null}),_0x24f49e[_0xc93d('0xeb')]?_0x24f49e[_0xc93d('0xeb')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x5f3580,_0x389f7f){var _0x3d927c=0x0;var _0x49bfff=0x0;var _0x80e331=![];var _0x1d9f53;var _0x210c26;return db['ChatWebsite'][_0xc93d('0x49')]({'where':{'id':_0x5f3580[_0xc93d('0x46')]['id']},'include':[{'model':db['Interval'],'as':_0xc93d('0xf5'),'include':[{'model':db[_0xc93d('0xf5')],'as':_0xc93d('0xf6'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x389f7f,null))[_0xc93d('0x24')](function(_0x3c058d){if(_0x3c058d){_0x1d9f53=_0x3c058d;return _0x3c058d['getProactiveActions']({'raw':!![]});}})['then'](function(_0xf1dc28){if(_0x1d9f53){if(_0xf1dc28){_0x210c26=_0xf1dc28;}}return require(_0xc93d('0x69'))['getLicense']();})['then'](function(_0x56ee70){if(_0x56ee70){_0x49bfff=_0x56ee70['virtual'];_0x80e331=_0x56ee70[_0xc93d('0x6b')];}})[_0xc93d('0x24')](function(){return db['ChatInteraction'][_0xc93d('0x21')]({'where':{'closed':![]}});})[_0xc93d('0x24')](function(_0x578e27){_0x3d927c=_0x578e27;if(_0x49bfff&&_0x578e27>_0x49bfff){return db[_0xc93d('0xf7')][_0xc93d('0x58')]({'where':{'id':0x1}})[_0xc93d('0x24')](function(_0x36dc0d){if(_0x36dc0d){_0x36dc0d['increment'](_0xc93d('0xf8'));}});}})[_0xc93d('0x24')](function(){if(_0x1d9f53[_0xc93d('0xf5')]&&_0x1d9f53['Interval'][_0xc93d('0xf6')]){var _0x43a9ea=[];for(var _0x32cb63=0x0;_0x32cb63<_0x1d9f53[_0xc93d('0xf5')][_0xc93d('0xf6')][_0xc93d('0x35')];_0x32cb63++){var _0x103a05=_0x1d9f53[_0xc93d('0xf5')][_0xc93d('0xf6')][_0x32cb63][_0xc93d('0x4d')]({'plain':!![]});_0x43a9ea['push'](iftimePromise(_0x103a05,_0x1d9f53));}return BPromise['all'](_0x43a9ea)[_0xc93d('0x24')](function(_0x208e12){return _[_0xc93d('0xf9')](_0x208e12);});}else{return!![];}})[_0xc93d('0x24')](function(_0x5e5b53){var _0x1b96f0=fs['readFileSync'](path[_0xc93d('0x6d')](config['root'],_0xc93d('0xfa')),_0xc93d('0xc6'));var _0x52dbbe={'remote':_0x1d9f53[_0xc93d('0xfb')],'query':querystring[_0xc93d('0x16')](_[_0xc93d('0x3c')](_0x1d9f53[_0xc93d('0x4d')]({'plain':!![]}),{'customerIp':_0x5f3580['headers'][_0xc93d('0x99')]||_0x5f3580[_0xc93d('0x98')][_0xc93d('0xfc')]||_0x5f3580[_0xc93d('0xfd')][_0xc93d('0xfe')]||_0x5f3580['ip'],'referer':_0x5f3580['headers'][_0xc93d('0x9e')],'openedInteractions':_0x3d927c,'maxInteractions':_0x49bfff,'virtual':_0x80e331[_0xc93d('0xff')],'online':_0x5e5b53,'custom':_0x80e331}))[_0xc93d('0x100')](/'/g,'\x5c\x27')};_0x389f7f[_0xc93d('0xbf')](ejs[_0xc93d('0xc7')](Mustache[_0xc93d('0xc7')](_0x1b96f0,_0x52dbbe),{'proactiveActions':_0x210c26,'alignment':_0x1d9f53[_0xc93d('0x101')],'verticalAlignment':_0x1d9f53['verticalAlignment'],'div_color':_0x1d9f53['color'],'labelText':_0x1d9f53[_0xc93d('0x102')],'text_color':_0x1d9f53[_0xc93d('0x103')],'text_button_color':_0x1d9f53[_0xc93d('0x104')],'button_color':_0x1d9f53[_0xc93d('0x105')],'background_color':_0x1d9f53['backgroundColor'],'hideWhenOffline':_0x1d9f53[_0xc93d('0x106')],'interval':_0x1d9f53['IntervalId']}));})[_0xc93d('0x1a')](handleError(_0x389f7f,null));};exports[_0xc93d('0x107')]=function(_0x6b141e,_0x4cb78d){var _0x2ed1d1=_0x6b141e[_0xc93d('0x46')]['id'];var _0x1aa011=_0x6b141e[_0xc93d('0x4b')];var _0x4414ba=0xc8;var _0x5a138d=null;return db[_0xc93d('0xd0')]['transaction']({'isolationLevel':db[_0xc93d('0xd0')][_0xc93d('0x108')][_0xc93d('0x109')][_0xc93d('0x10a')]},function(_0x18cb8a){return db[_0xc93d('0x2a')]['findOne']({'where':{'id':_0x2ed1d1},'transaction':_0x18cb8a})['then'](function(_0x3ccabb){if(_0x3ccabb){return db[_0xc93d('0x8d')][_0xc93d('0x10b')]({'where':{'ChatWebsiteId':_0x2ed1d1},'transaction':_0x18cb8a})['then'](function(){var _0x52323f=_[_0xc93d('0x3d')](_0x1aa011,function(_0x2359b2){_0x2359b2[_0xc93d('0x56')]=_0x2ed1d1;return _0x2359b2;});return db[_0xc93d('0x8d')][_0xc93d('0x10c')](_0x52323f,{'transaction':_0x18cb8a});});}else{_0x4414ba=0x194;_0x5a138d=[];}});})[_0xc93d('0x24')](function(){if(_0x4414ba!==0x194){return db[_0xc93d('0x8d')][_0xc93d('0x10d')]({'where':{'ChatWebsiteId':_0x2ed1d1},'order':_0xc93d('0x93')})[_0xc93d('0x24')](function(_0x13224d){_0x5a138d=_0x13224d;});}})[_0xc93d('0x1a')](function(_0xb5a61f){_0x4414ba=0x1f4;logger[_0xc93d('0x17')](_0xb5a61f['stack']);if(_0xb5a61f[_0xc93d('0x28')]){delete _0xb5a61f[_0xc93d('0x28')];}_0x5a138d=_0xb5a61f;})['finally'](function(){if(_0x5a138d===null){_0x4cb78d['sendStatus'](_0x4414ba);}else{if(_0x4414ba===0x1f4){_0x4cb78d[_0xc93d('0x1c')](_0x4414ba)[_0xc93d('0xbf')](_0x5a138d);}else{_0x4cb78d[_0xc93d('0x1c')](_0x4414ba)[_0xc93d('0x1d')](_0x5a138d);}}});};exports[_0xc93d('0x10e')]=function(_0x4e8182,_0x39cfc4){var _0x58707d={};var _0xd3dd39={};var _0x2ac05e;var _0x315512;return db[_0xc93d('0x2a')][_0xc93d('0x58')]({'where':{'id':_0x4e8182[_0xc93d('0x46')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x39cfc4,null))[_0xc93d('0x24')](function(_0x14265d){if(_0x14265d){_0x2ac05e=_0x14265d;_0xd3dd39[_0xc93d('0x32')]=_[_0xc93d('0x2f')](db[_0xc93d('0x8d')]['rawAttributes']);_0xd3dd39[_0xc93d('0x2e')]=_[_0xc93d('0x2f')](_0x4e8182[_0xc93d('0x2e')]);_0xd3dd39[_0xc93d('0x30')]=_[_0xc93d('0x31')](_0xd3dd39[_0xc93d('0x32')],_0xd3dd39[_0xc93d('0x2e')]);_0x58707d[_0xc93d('0x33')]=_[_0xc93d('0x31')](_0xd3dd39['model'],qs[_0xc93d('0x34')](_0x4e8182['query']['fields']));_0x58707d[_0xc93d('0x33')]=_0x58707d[_0xc93d('0x33')][_0xc93d('0x35')]?_0x58707d[_0xc93d('0x33')]:_0xd3dd39['model'];_0x58707d['order']=qs[_0xc93d('0x39')](_0x4e8182[_0xc93d('0x2e')]['sort']);_0x58707d[_0xc93d('0x3b')]=qs['filters'](_[_0xc93d('0x3a')](_0x4e8182[_0xc93d('0x2e')],_0xd3dd39[_0xc93d('0x30')]));if(_0x4e8182[_0xc93d('0x2e')]['filter']){_0x58707d[_0xc93d('0x3b')]=_[_0xc93d('0x3c')](_0x58707d[_0xc93d('0x3b')],{'$or':_[_0xc93d('0x3d')](_0x58707d[_0xc93d('0x33')],function(_0x4e77f5){var _0x133ef2={};_0x133ef2[_0x4e77f5]={'$like':'%'+_0x4e8182[_0xc93d('0x2e')][_0xc93d('0x40')]+'%'};return _0x133ef2;})});}_0x58707d=_['merge']({},_0x58707d,_0x4e8182[_0xc93d('0x41')]);return _0x2ac05e[_0xc93d('0x10e')](_0x58707d);}})['then'](function(_0x4bb3a6){if(_0x4bb3a6){_0x315512=_0x4bb3a6[_0xc93d('0x35')];if(!_0x4e8182[_0xc93d('0x2e')][_0xc93d('0x36')](_0xc93d('0x37'))){_0x58707d['limit']=qs[_0xc93d('0x20')](_0x4e8182[_0xc93d('0x2e')][_0xc93d('0x20')]);_0x58707d[_0xc93d('0x1e')]=qs[_0xc93d('0x1e')](_0x4e8182[_0xc93d('0x2e')][_0xc93d('0x1e')]);}return _0x2ac05e[_0xc93d('0x10e')](_0x58707d);}})[_0xc93d('0x24')](function(_0x581dfb){if(_0x581dfb){return _0x581dfb?{'count':_0x315512,'rows':_0x581dfb}:null;}})['then'](respondWithResult(_0x39cfc4,null))[_0xc93d('0x1a')](handleError(_0x39cfc4,null));};exports['addProactiveActions']=function(_0x1a6126,_0x5434da){return db[_0xc93d('0x10f')][_0xc93d('0x49')]({'where':{'id':_0x1a6126['params']['id']}})['then'](handleEntityNotFound(_0x5434da,null))[_0xc93d('0x24')](function(_0x17b3f5){if(_0x17b3f5){return _0x17b3f5[_0xc93d('0x110')](_0x1a6126['body']['ids'],_['omit'](_0x1a6126[_0xc93d('0x4b')],[_0xc93d('0x5b'),'id'])||{});}})[_0xc93d('0x24')](respondWithResult(_0x5434da,null))[_0xc93d('0x1a')](handleError(_0x5434da,null));};exports[_0xc93d('0x111')]=function(_0x2d23b2,_0x3678bc){var _0x1b01f0={};var _0x23bf97={};var _0x19a1fa;var _0x4ef126;return db['ChatWebsite'][_0xc93d('0x58')]({'where':{'id':_0x2d23b2[_0xc93d('0x46')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x3678bc,null))[_0xc93d('0x24')](function(_0x256888){if(_0x256888){_0x19a1fa=_0x256888;_0x23bf97['model']=_[_0xc93d('0x2f')](db[_0xc93d('0x112')][_0xc93d('0x2b')]);_0x23bf97[_0xc93d('0x2e')]=_[_0xc93d('0x2f')](_0x2d23b2[_0xc93d('0x2e')]);_0x23bf97[_0xc93d('0x30')]=_['intersection'](_0x23bf97[_0xc93d('0x32')],_0x23bf97[_0xc93d('0x2e')]);_0x1b01f0[_0xc93d('0x33')]=_[_0xc93d('0x31')](_0x23bf97['model'],qs[_0xc93d('0x34')](_0x2d23b2[_0xc93d('0x2e')][_0xc93d('0x34')]));_0x1b01f0[_0xc93d('0x33')]=_0x1b01f0[_0xc93d('0x33')][_0xc93d('0x35')]?_0x1b01f0[_0xc93d('0x33')]:_0x23bf97[_0xc93d('0x32')];_0x1b01f0[_0xc93d('0x38')]=qs[_0xc93d('0x39')](_0x2d23b2['query'][_0xc93d('0x39')]);_0x1b01f0[_0xc93d('0x3b')]=qs['filters'](_[_0xc93d('0x3a')](_0x2d23b2['query'],_0x23bf97['filters']));if(_0x2d23b2[_0xc93d('0x2e')][_0xc93d('0x40')]){_0x1b01f0[_0xc93d('0x3b')]=_[_0xc93d('0x3c')](_0x1b01f0['where'],{'$or':_[_0xc93d('0x3d')](_0x1b01f0['attributes'],function(_0x199df1){var _0x54e4d7={};_0x54e4d7[_0x199df1]={'$like':'%'+_0x2d23b2[_0xc93d('0x2e')]['filter']+'%'};return _0x54e4d7;})});}_0x1b01f0=_[_0xc93d('0x3c')]({},_0x1b01f0,_0x2d23b2['options']);return _0x19a1fa[_0xc93d('0x111')](_0x1b01f0);}})['then'](function(_0x29c48c){if(_0x29c48c){_0x4ef126=_0x29c48c[_0xc93d('0x35')];if(!_0x2d23b2[_0xc93d('0x2e')][_0xc93d('0x36')]('nolimit')){_0x1b01f0[_0xc93d('0x20')]=qs['limit'](_0x2d23b2[_0xc93d('0x2e')][_0xc93d('0x20')]);_0x1b01f0[_0xc93d('0x1e')]=qs['offset'](_0x2d23b2[_0xc93d('0x2e')][_0xc93d('0x1e')]);}return _0x19a1fa[_0xc93d('0x111')](_0x1b01f0);}})[_0xc93d('0x24')](function(_0x290286){if(_0x290286){return _0x290286?{'count':_0x4ef126,'rows':_0x290286}:null;}})[_0xc93d('0x24')](respondWithResult(_0x3678bc,null))['catch'](handleError(_0x3678bc,null));};exports[_0xc93d('0x113')]=function(_0x1b32a2,_0x5a3094){var _0x939ca5=_0x1b32a2['query'][_0xc93d('0x114')]===_0xc93d('0x115')?'offlineForm':_0xc93d('0x116');return db['ChatWebsite'][_0xc93d('0x49')]({'attributes':['id',_0x939ca5],'where':{'id':_0x1b32a2[_0xc93d('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a3094,null))[_0xc93d('0x24')](function(_0x5f1674){if(_0x5f1674){var _0x3bce62=_0x5f1674[_0x939ca5];var _0x1d3dce=_0x3bce62&&_0x3bce62[_0xc93d('0x117')]?_0x3bce62[_0xc93d('0x117')]:[];_0x5a3094[_0xc93d('0xbf')]({'fromKey':_['isNil'](_0x3bce62[_0xc93d('0x118')])?undefined:_0x3bce62[_0xc93d('0x118')],'count':_0x1d3dce['length'],'rows':_0x1d3dce});}})['catch'](handleError(_0x5a3094,null));};exports[_0xc93d('0x119')]=function(_0x2487d1,_0x929ae){var _0x5ebe3d={'raw':![],'where':{}};var _0x349586={};var _0x1818f8={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc93d('0x58')]({'where':{'id':_0x2487d1[_0xc93d('0x46')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x929ae,null))[_0xc93d('0x24')](function(_0x3b1730){if(_0x3b1730){_0x349586[_0xc93d('0x32')]=_[_0xc93d('0x2f')](db[_0xc93d('0xc9')][_0xc93d('0x2b')]);_0x349586[_0xc93d('0x2e')]=_[_0xc93d('0x2f')](_0x2487d1['query']);_0x349586['filters']=_[_0xc93d('0x31')](_0x349586[_0xc93d('0x32')],_0x349586[_0xc93d('0x2e')]);_0x5ebe3d[_0xc93d('0x33')]=_[_0xc93d('0x31')](_0x349586[_0xc93d('0x32')],qs['fields'](_0x2487d1[_0xc93d('0x2e')][_0xc93d('0x34')]));_0x5ebe3d[_0xc93d('0x33')]=_0x5ebe3d['attributes'][_0xc93d('0x35')]?_0x5ebe3d[_0xc93d('0x33')]:_0x349586['model'];if(!_0x2487d1[_0xc93d('0x2e')][_0xc93d('0x36')](_0xc93d('0x37'))){_0x5ebe3d[_0xc93d('0x20')]=qs['limit'](_0x2487d1[_0xc93d('0x2e')][_0xc93d('0x20')]);_0x5ebe3d[_0xc93d('0x1e')]=qs['offset'](_0x2487d1[_0xc93d('0x2e')]['offset']);}_0x5ebe3d[_0xc93d('0x38')]=qs[_0xc93d('0x39')](_0x2487d1[_0xc93d('0x2e')][_0xc93d('0x39')]);_0x5ebe3d[_0xc93d('0x3b')]=qs[_0xc93d('0x30')](_[_0xc93d('0x3a')](_0x2487d1[_0xc93d('0x2e')],_0x349586['filters']));_0x5ebe3d['where'][_0xc93d('0x56')]=_0x3b1730['id'];if(_0x2487d1[_0xc93d('0x2e')][_0xc93d('0x40')]){_0x5ebe3d[_0xc93d('0x3b')]=_[_0xc93d('0x3c')](_0x5ebe3d[_0xc93d('0x3b')],{'$or':_[_0xc93d('0x3d')](_0x5ebe3d[_0xc93d('0x33')],function(_0x2f7901){var _0x332ad4={};_0x332ad4[_0x2f7901]={'$like':'%'+_0x2487d1[_0xc93d('0x2e')][_0xc93d('0x40')]+'%'};return _0x332ad4;})});}_0x5ebe3d=_[_0xc93d('0x3c')]({},_0x5ebe3d,_0x2487d1[_0xc93d('0x41')]);return db['ChatOfflineMessage'][_0xc93d('0x21')]({'where':_0x5ebe3d[_0xc93d('0x3b')]})[_0xc93d('0x24')](function(_0x3c721d){_0x1818f8[_0xc93d('0x21')]=_0x3c721d;if(_0x2487d1[_0xc93d('0x2e')]['includeAll']){_0x5ebe3d['include']=[{'all':!![]}];}else{_0x5ebe3d[_0xc93d('0x48')]=[{'model':db[_0xc93d('0x7b')],'as':_0xc93d('0xe5'),'required':![]},{'model':db['Attachment'],'as':_0xc93d('0x11a'),'required':![]}];}return db['ChatOfflineMessage'][_0xc93d('0x43')](_0x5ebe3d);})[_0xc93d('0x24')](function(_0x31519e){_0x1818f8[_0xc93d('0x44')]=_0x31519e;return _0x1818f8;});}})['then'](respondWithFilteredResult(_0x929ae,_0x5ebe3d))[_0xc93d('0x1a')](handleError(_0x929ae,null));};exports[_0xc93d('0x11b')]=function(_0x540f50,_0x597e9a){return db[_0xc93d('0x2a')][_0xc93d('0x49')]({'where':{'id':_0x540f50[_0xc93d('0x46')]['id']}})['then'](handleEntityNotFound(_0x597e9a,null))[_0xc93d('0x24')](function(_0x22eb37){if(_0x22eb37){return _0x22eb37[_0xc93d('0x11b')](_0x540f50[_0xc93d('0x4b')]['ids'],_['omit'](_0x540f50[_0xc93d('0x4b')],[_0xc93d('0x5b'),'id'])||{})[_0xc93d('0xac')](function(_0x7ae7c6){for(var _0x1179f8=0x0;_0x1179f8<_0x540f50[_0xc93d('0x4b')][_0xc93d('0x5b')][_0xc93d('0x35')];_0x1179f8+=0x1){socket[_0xc93d('0x11c')](_0xc93d('0x11d'),{'UserId':Number(_0x540f50[_0xc93d('0x4b')][_0xc93d('0x5b')][_0x1179f8]),'ChatWebsiteId':Number(_0x540f50[_0xc93d('0x46')]['id'])});}return _0x7ae7c6;});}})[_0xc93d('0x24')](respondWithResult(_0x597e9a,null))[_0xc93d('0x1a')](handleError(_0x597e9a,null));};exports[_0xc93d('0x11e')]=function(_0x2fc95f,_0x5f54bd){return db['ChatWebsite'][_0xc93d('0x49')]({'where':{'id':_0x2fc95f['params']['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x5f54bd,null))['then'](function(_0xb1c852){if(_0xb1c852){return _0xb1c852[_0xc93d('0x11e')](_0x2fc95f[_0xc93d('0x2e')][_0xc93d('0x5b')])['then'](function(){if(_[_0xc93d('0x11f')](_0x2fc95f[_0xc93d('0x2e')][_0xc93d('0x5b')])){for(var _0x4ac26e=0x0;_0x4ac26e<_0x2fc95f[_0xc93d('0x2e')][_0xc93d('0x5b')][_0xc93d('0x35')];_0x4ac26e+=0x1){socket['emit'](_0xc93d('0x120'),{'UserId':Number(_0x2fc95f[_0xc93d('0x2e')][_0xc93d('0x5b')][_0x4ac26e]),'ChatWebsiteId':Number(_0x2fc95f[_0xc93d('0x46')]['id'])});}}else{socket[_0xc93d('0x11c')](_0xc93d('0x120'),{'UserId':Number(_0x2fc95f[_0xc93d('0x2e')][_0xc93d('0x5b')]),'ChatWebsiteId':Number(_0x2fc95f[_0xc93d('0x46')]['id'])});}});}})[_0xc93d('0x24')](respondWithStatusCode(_0x5f54bd,null))[_0xc93d('0x1a')](handleError(_0x5f54bd,null));};exports['getAgents']=function(_0x200950,_0x447acc){var _0x188cdc={};var _0x3a06d9={};var _0x307915;var _0x2aadb6;return db[_0xc93d('0x2a')][_0xc93d('0x58')]({'where':{'id':_0x200950[_0xc93d('0x46')]['id']}})[_0xc93d('0x24')](handleEntityNotFound(_0x447acc,null))[_0xc93d('0x24')](function(_0x3a45fc){if(_0x3a45fc){_0x307915=_0x3a45fc;_0x3a06d9[_0xc93d('0x32')]=_[_0xc93d('0x2f')](db[_0xc93d('0xb7')][_0xc93d('0x2b')]);_0x3a06d9[_0xc93d('0x2e')]=_['keys'](_0x200950[_0xc93d('0x2e')]);_0x3a06d9[_0xc93d('0x30')]=_['intersection'](_0x3a06d9[_0xc93d('0x32')],_0x3a06d9[_0xc93d('0x2e')]);_0x188cdc[_0xc93d('0x33')]=_[_0xc93d('0x31')](_0x3a06d9['model'],qs[_0xc93d('0x34')](_0x200950['query']['fields']));_0x188cdc[_0xc93d('0x33')]=_0x188cdc[_0xc93d('0x33')][_0xc93d('0x35')]?_0x188cdc['attributes']:_0x3a06d9[_0xc93d('0x32')];_0x188cdc['order']=qs[_0xc93d('0x39')](_0x200950[_0xc93d('0x2e')][_0xc93d('0x39')]);_0x188cdc[_0xc93d('0x3b')]=qs['filters'](_['pick'](_0x200950['query'],_0x3a06d9[_0xc93d('0x30')]));if(_0x200950[_0xc93d('0x2e')][_0xc93d('0x40')]){_0x188cdc[_0xc93d('0x3b')]=_[_0xc93d('0x3c')](_0x188cdc['where'],{'$or':_['map'](_0x188cdc[_0xc93d('0x33')],function(_0x928bde){var _0x3f3b9e={};_0x3f3b9e[_0x928bde]={'$like':'%'+_0x200950[_0xc93d('0x2e')][_0xc93d('0x40')]+'%'};return _0x3f3b9e;})});}_0x188cdc=_[_0xc93d('0x3c')]({},_0x188cdc,_0x200950[_0xc93d('0x41')]);return _0x307915['getAgents'](_0x188cdc);}})[_0xc93d('0x24')](function(_0x427339){if(_0x427339){_0x2aadb6=_0x427339[_0xc93d('0x35')];if(!_0x200950[_0xc93d('0x2e')][_0xc93d('0x36')]('nolimit')){_0x188cdc[_0xc93d('0x20')]=qs[_0xc93d('0x20')](_0x200950[_0xc93d('0x2e')][_0xc93d('0x20')]);_0x188cdc[_0xc93d('0x1e')]=qs[_0xc93d('0x1e')](_0x200950[_0xc93d('0x2e')][_0xc93d('0x1e')]);}return _0x307915[_0xc93d('0x121')](_0x188cdc);}})[_0xc93d('0x24')](function(_0x5d8926){if(_0x5d8926){return _0x5d8926?{'count':_0x2aadb6,'rows':_0x5d8926}:null;}})[_0xc93d('0x24')](respondWithResult(_0x447acc,null))[_0xc93d('0x1a')](handleError(_0x447acc,null));};
\ No newline at end of file
+var _0x6961=['replace','verticalAlignment','labelText','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','sequelize','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','priority','finally','sendStatus','json','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','client','http','request','then','request\x20sent','debug','error','message','ChatWebsite,\x20%s,\x20%s','info','result','catch','end','status','limit','undefined','count','offset','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','rawAttributes','keys','filters','intersection','model','fields','query','attributes','length','order','sort','where','pick','filter','map','merge','options','ChatWebsite','includeAll','include','findAll','show','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','mandatoryDispositionPause','describe','addDisposition','ChatWebsiteId','findOne','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','rows','removeAnswers','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','account','Applications','applications','asc','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','browser','version','unknown','%s\x20%s','device','format','%s\x20%s\x20%s','vendor','type','stringify','threadId','ChatInteraction','externalUrl','interaction','spread','firstName','messageId','created','autoclose','push','close','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','files','difference','CompanyId','ListId','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','CmList','MailAccount','findOrCreate','readFileSync','render','ChatOfflineMessage','fromString','mimetype','server','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','originalname','toPairsIn','mapValues','email','Chat','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','fullname','internal','Tag','Tags','color','tag','iftime\x20%s,%s','timezone','interval','indexOf','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','getSnippet','Interval','Intervals','virtual','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','remote','connection','remoteAddress'];(function(_0x2d487f,_0x203ecf){var _0x553f79=function(_0x467852){while(--_0x467852){_0x2d487f['push'](_0x2d487f['shift']());}};_0x553f79(++_0x203ecf);}(_0x6961,0x141));var _0x1696=function(_0xfe5185,_0x4b912e){_0xfe5185=_0xfe5185-0x0;var _0x1eb2ee=_0x6961[_0xfe5185];return _0x1eb2ee;};'use strict';var BPromise=require(_0x1696('0x0'));var Mustache=require(_0x1696('0x1'));var util=require('util');var path=require(_0x1696('0x2'));var ejs=require(_0x1696('0x3'));var fs=require('fs');var fs_extra=require(_0x1696('0x4'));var _=require(_0x1696('0x5'));var querystring=require(_0x1696('0x6'));var Redis=require(_0x1696('0x7'));var qs=require(_0x1696('0x8'));var logger=require('../../config/logger')(_0x1696('0x9'));var config=require(_0x1696('0xa'));var db=require(_0x1696('0xb'))['db'];config[_0x1696('0xc')]=_[_0x1696('0xd')](config[_0x1696('0xc')],{'host':_0x1696('0xe'),'port':0x18eb});var socket=require(_0x1696('0xf'))(new Redis(config[_0x1696('0xc')]));require(_0x1696('0x10'))[_0x1696('0x11')](socket);var htmlToText=require(_0x1696('0x12'));var jayson=require('jayson/promise');var client=jayson[_0x1696('0x13')][_0x1696('0x14')]({'port':0x232c});var client9002=jayson[_0x1696('0x13')][_0x1696('0x14')]({'port':0x232a});var client9003=jayson[_0x1696('0x13')][_0x1696('0x14')]({'port':0x232b});var client9001=jayson[_0x1696('0x13')][_0x1696('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x2ad60e,_0x33ce0d,_0x2a3608,_0x58a83b){return new BPromise(function(_0x177294,_0x4ec536){var _0x419a79=_0x58a83b||client;return _0x419a79[_0x1696('0x15')](_0x2ad60e,_0x2a3608)[_0x1696('0x16')](function(_0xe31a39){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x33ce0d,_0x1696('0x17'));logger[_0x1696('0x18')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x33ce0d,_0x1696('0x17'),JSON['stringify'](_0xe31a39));if(_0xe31a39[_0x1696('0x19')]){if(_0xe31a39[_0x1696('0x19')]['code']===0x1f4){logger[_0x1696('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x33ce0d,_0xe31a39[_0x1696('0x19')][_0x1696('0x1a')]);return _0x4ec536(_0xe31a39['error']['message']);}logger['error'](_0x1696('0x1b'),_0x33ce0d,_0xe31a39['error'][_0x1696('0x1a')]);return _0x177294(_0xe31a39['error']['message']);}else{logger[_0x1696('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x33ce0d,'request\x20sent');_0x177294(_0xe31a39[_0x1696('0x1d')]['message']);}})[_0x1696('0x1e')](function(_0x581792){logger[_0x1696('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x33ce0d,_0x581792);_0x4ec536(_0x581792);});});}function respondWithStatusCode(_0x43cb65,_0x451e80){_0x451e80=_0x451e80||0xcc;return function(_0x2f26c6){if(_0x2f26c6){return _0x43cb65['sendStatus'](_0x451e80);}return _0x43cb65['status'](_0x451e80)[_0x1696('0x1f')]();};}function respondWithResult(_0x4dd631,_0x27a259){_0x27a259=_0x27a259||0xc8;return function(_0x2ce47a){if(_0x2ce47a){return _0x4dd631[_0x1696('0x20')](_0x27a259)['json'](_0x2ce47a);}};}function respondWithFilteredResult(_0x24e5da,_0x411d18){return function(_0x5de867){if(_0x5de867){var _0xa744c6=typeof _0x411d18['offset']==='undefined'&&typeof _0x411d18[_0x1696('0x21')]===_0x1696('0x22');var _0x11dc5f=_0x5de867[_0x1696('0x23')];var _0x462500=_0xa744c6?0x0:_0x411d18[_0x1696('0x24')];var _0x5cd06a=_0xa744c6?_0x5de867[_0x1696('0x23')]:_0x411d18[_0x1696('0x24')]+_0x411d18['limit'];var _0x2e8a9a;if(_0x5cd06a>=_0x11dc5f){_0x5cd06a=_0x11dc5f;_0x2e8a9a=0xc8;}else{_0x2e8a9a=0xce;}_0x24e5da[_0x1696('0x20')](_0x2e8a9a);return _0x24e5da[_0x1696('0x25')](_0x1696('0x26'),_0x462500+'-'+_0x5cd06a+'/'+_0x11dc5f)['json'](_0x5de867);}return null;};}function saveUpdates(_0xb85a09){return function(_0x180cb8){if(_0x180cb8){return _0x180cb8[_0x1696('0x27')](_0xb85a09)['then'](function(_0x434e62){return _0x434e62;});}return null;};}function removeEntity(_0x113b87){return function(_0x1b684b){if(_0x1b684b){return _0x1b684b[_0x1696('0x28')]()[_0x1696('0x16')](function(){var _0x1da0c6=_0x1b684b[_0x1696('0x29')]({'plain':!![]});var _0x5e4fbc=_0x1696('0x2a');return db[_0x1696('0x2b')][_0x1696('0x28')]({'where':{'type':_0x5e4fbc,'resourceId':_0x1da0c6['id']}})[_0x1696('0x16')](function(){return _0x1b684b;});})[_0x1696('0x16')](function(){_0x113b87[_0x1696('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x288f15){return function(_0x56745e){if(!_0x56745e){_0x288f15['sendStatus'](0x194);}return _0x56745e;};}function handleError(_0xc49baf,_0x4f8b13){_0x4f8b13=_0x4f8b13||0x1f4;return function(_0x508b15){logger[_0x1696('0x19')](_0x508b15[_0x1696('0x2c')]);if(_0x508b15[_0x1696('0x2d')]){delete _0x508b15[_0x1696('0x2d')];}_0xc49baf[_0x1696('0x20')](_0x4f8b13)[_0x1696('0x2e')](_0x508b15);};}exports[_0x1696('0x2f')]=function(_0x2e0924,_0x99b4d8){var _0x1e0060={'include':[{'model':db[_0x1696('0x30')],'as':'mandatoryDispositionPause'}]},_0x4b6297={},_0x2de88e={'count':0x0,'rows':[]};var _0xf3be43=_['map'](db['ChatWebsite'][_0x1696('0x31')],function(_0x5d0959){return{'name':_0x5d0959['fieldName'],'type':_0x5d0959['type']['key']};});_0x4b6297['model']=_['map'](_0xf3be43,_0x1696('0x2d'));_0x4b6297['query']=_[_0x1696('0x32')](_0x2e0924['query']);_0x4b6297[_0x1696('0x33')]=_[_0x1696('0x34')](_0x4b6297[_0x1696('0x35')],_0x4b6297['query']);_0x1e0060['attributes']=_['intersection'](_0x4b6297['model'],qs[_0x1696('0x36')](_0x2e0924[_0x1696('0x37')][_0x1696('0x36')]));_0x1e0060[_0x1696('0x38')]=_0x1e0060['attributes'][_0x1696('0x39')]?_0x1e0060[_0x1696('0x38')]:_0x4b6297[_0x1696('0x35')];if(!_0x2e0924[_0x1696('0x37')]['hasOwnProperty']('nolimit')){_0x1e0060[_0x1696('0x21')]=qs[_0x1696('0x21')](_0x2e0924[_0x1696('0x37')][_0x1696('0x21')]);_0x1e0060[_0x1696('0x24')]=qs['offset'](_0x2e0924[_0x1696('0x37')]['offset']);}_0x1e0060[_0x1696('0x3a')]=qs[_0x1696('0x3b')](_0x2e0924['query'][_0x1696('0x3b')]);_0x1e0060[_0x1696('0x3c')]=qs['filters'](_[_0x1696('0x3d')](_0x2e0924[_0x1696('0x37')],_0x4b6297['filters']),_0xf3be43);if(_0x2e0924[_0x1696('0x37')][_0x1696('0x3e')]){_0x1e0060[_0x1696('0x3c')]=_['merge'](_0x1e0060[_0x1696('0x3c')],{'$or':_[_0x1696('0x3f')](_0xf3be43,function(_0xb01b0a){if(_0xb01b0a['type']!=='VIRTUAL'){var _0x2a850d={};_0x2a850d[_0xb01b0a[_0x1696('0x2d')]]={'$like':'%'+_0x2e0924[_0x1696('0x37')][_0x1696('0x3e')]+'%'};return _0x2a850d;}})});}_0x1e0060=_[_0x1696('0x40')]({},_0x1e0060,_0x2e0924[_0x1696('0x41')]);var _0x5b7712={'where':_0x1e0060[_0x1696('0x3c')]};return db[_0x1696('0x42')][_0x1696('0x23')](_0x5b7712)[_0x1696('0x16')](function(_0x4c3d9d){_0x2de88e[_0x1696('0x23')]=_0x4c3d9d;if(_0x2e0924[_0x1696('0x37')][_0x1696('0x43')]){_0x1e0060[_0x1696('0x44')]=[{'all':!![]}];}return db['ChatWebsite'][_0x1696('0x45')](_0x1e0060);})[_0x1696('0x16')](function(_0x3fe507){_0x2de88e['rows']=_0x3fe507;return _0x2de88e;})[_0x1696('0x16')](respondWithFilteredResult(_0x99b4d8,_0x1e0060))[_0x1696('0x1e')](handleError(_0x99b4d8,null));};exports[_0x1696('0x46')]=function(_0x3e10bd,_0x400457){var _0x1881cc={'raw':![],'where':{'id':_0x3e10bd['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5e3e1c={};_0x5e3e1c[_0x1696('0x35')]=_[_0x1696('0x32')](db[_0x1696('0x42')]['rawAttributes']);_0x5e3e1c['query']=_['keys'](_0x3e10bd[_0x1696('0x37')]);_0x5e3e1c[_0x1696('0x33')]=_[_0x1696('0x34')](_0x5e3e1c[_0x1696('0x35')],_0x5e3e1c[_0x1696('0x37')]);_0x1881cc[_0x1696('0x38')]=_[_0x1696('0x34')](_0x5e3e1c[_0x1696('0x35')],qs[_0x1696('0x36')](_0x3e10bd['query']['fields']));_0x1881cc[_0x1696('0x38')]=_0x1881cc[_0x1696('0x38')][_0x1696('0x39')]?_0x1881cc['attributes']:_0x5e3e1c[_0x1696('0x35')];if(_0x3e10bd[_0x1696('0x37')][_0x1696('0x43')]){_0x1881cc[_0x1696('0x44')]=[{'all':!![]}];}_0x1881cc=_[_0x1696('0x40')]({},_0x1881cc,_0x3e10bd[_0x1696('0x41')]);return db[_0x1696('0x42')][_0x1696('0x47')](_0x1881cc)[_0x1696('0x16')](handleEntityNotFound(_0x400457,null))[_0x1696('0x16')](respondWithResult(_0x400457,null))[_0x1696('0x1e')](handleError(_0x400457,null));};exports[_0x1696('0x48')]=function(_0x34e0ea,_0x3b1bd5){return db['ChatWebsite'][_0x1696('0x48')](_0x34e0ea['body'],{})['then'](function(_0x48f5f8){var _0x16ba2b=_0x34e0ea['user'][_0x1696('0x29')]({'plain':!![]});if(!_0x16ba2b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16ba2b[_0x1696('0x49')]===_0x1696('0x4a')){var _0x1a848a=_0x48f5f8['get']({'plain':!![]});var _0x556696=_0x1696('0x2a');return db[_0x1696('0x4b')][_0x1696('0x47')]({'where':{'name':_0x556696,'userProfileId':_0x16ba2b[_0x1696('0x4c')]},'raw':!![]})[_0x1696('0x16')](function(_0x25d859){if(_0x25d859&&_0x25d859[_0x1696('0x4d')]===0x0){return db[_0x1696('0x2b')][_0x1696('0x48')]({'name':_0x1a848a[_0x1696('0x2d')],'resourceId':_0x1a848a['id'],'type':_0x25d859[_0x1696('0x2d')],'sectionId':_0x25d859['id']},{})[_0x1696('0x16')](function(){return _0x48f5f8;});}else{return _0x48f5f8;}})[_0x1696('0x1e')](function(_0x2b6b02){logger['error'](_0x1696('0x4e'),_0x2b6b02);throw _0x2b6b02;});}return _0x48f5f8;})['then'](respondWithResult(_0x3b1bd5,0xc9))[_0x1696('0x1e')](handleError(_0x3b1bd5,null));};exports[_0x1696('0x27')]=function(_0x361270,_0x39edd5){if(_0x361270[_0x1696('0x4f')]['id']){delete _0x361270[_0x1696('0x4f')]['id'];}return db[_0x1696('0x42')][_0x1696('0x47')]({'where':{'id':_0x361270[_0x1696('0x50')]['id']},'include':[{'model':db['Pause'],'as':_0x1696('0x51')}]})[_0x1696('0x16')](handleEntityNotFound(_0x39edd5,null))[_0x1696('0x16')](saveUpdates(_0x361270[_0x1696('0x4f')],null))['then'](respondWithResult(_0x39edd5,null))[_0x1696('0x1e')](handleError(_0x39edd5,null));};exports[_0x1696('0x28')]=function(_0x5a8a98,_0x5e822a){return db[_0x1696('0x42')][_0x1696('0x47')]({'where':{'id':_0x5a8a98['params']['id']}})[_0x1696('0x16')](handleEntityNotFound(_0x5e822a,null))[_0x1696('0x16')](removeEntity(_0x5e822a,null))[_0x1696('0x1e')](handleError(_0x5e822a,null));};exports[_0x1696('0x52')]=function(_0x7422a0,_0x22b6f0){return db[_0x1696('0x42')][_0x1696('0x52')]()[_0x1696('0x16')](respondWithResult(_0x22b6f0,null))[_0x1696('0x1e')](handleError(_0x22b6f0,null));};exports[_0x1696('0x53')]=function(_0x5e2037,_0x5a2384){if(_0x5e2037[_0x1696('0x4f')]['id']){delete _0x5e2037[_0x1696('0x4f')]['id'];}return db[_0x1696('0x42')]['find']({'where':{'id':_0x5e2037['params']['id']}})['then'](handleEntityNotFound(_0x5a2384,null))[_0x1696('0x16')](function(_0x4c94e4){if(_0x4c94e4){_0x5e2037['body'][_0x1696('0x54')]=_0x4c94e4['id'];return db['Disposition'][_0x1696('0x48')](_0x5e2037[_0x1696('0x4f')]);}})['then'](respondWithResult(_0x5a2384,null))['catch'](handleError(_0x5a2384,null));};exports['getDispositions']=function(_0x1efff3,_0x1258be){var _0x31863a={'raw':![],'where':{}};var _0x4aba7c={};var _0x4472b9={'count':0x0,'rows':[]};return db[_0x1696('0x42')][_0x1696('0x55')]({'where':{'id':_0x1efff3[_0x1696('0x50')]['id']}})['then'](handleEntityNotFound(_0x1258be,null))[_0x1696('0x16')](function(_0x17aea9){if(_0x17aea9){_0x4aba7c[_0x1696('0x35')]=_[_0x1696('0x32')](db[_0x1696('0x56')][_0x1696('0x31')]);_0x4aba7c[_0x1696('0x37')]=_[_0x1696('0x32')](_0x1efff3[_0x1696('0x37')]);_0x4aba7c[_0x1696('0x33')]=_[_0x1696('0x34')](_0x4aba7c[_0x1696('0x35')],_0x4aba7c[_0x1696('0x37')]);_0x31863a['attributes']=_[_0x1696('0x34')](_0x4aba7c[_0x1696('0x35')],qs[_0x1696('0x36')](_0x1efff3['query']['fields']));_0x31863a[_0x1696('0x38')]=_0x31863a[_0x1696('0x38')][_0x1696('0x39')]?_0x31863a[_0x1696('0x38')]:_0x4aba7c[_0x1696('0x35')];if(!_0x1efff3[_0x1696('0x37')][_0x1696('0x57')]('nolimit')){_0x31863a[_0x1696('0x21')]=qs['limit'](_0x1efff3[_0x1696('0x37')]['limit']);_0x31863a[_0x1696('0x24')]=qs[_0x1696('0x24')](_0x1efff3[_0x1696('0x37')][_0x1696('0x24')]);}_0x31863a[_0x1696('0x3a')]=qs[_0x1696('0x3b')](_0x1efff3[_0x1696('0x37')]['sort']);_0x31863a[_0x1696('0x3c')]=qs[_0x1696('0x33')](_[_0x1696('0x3d')](_0x1efff3['query'],_0x4aba7c[_0x1696('0x33')]));_0x31863a[_0x1696('0x3c')][_0x1696('0x54')]=_0x17aea9['id'];if(_0x1efff3['query'][_0x1696('0x3e')]){_0x31863a[_0x1696('0x3c')]=_[_0x1696('0x40')](_0x31863a['where'],{'$or':_[_0x1696('0x3f')](_0x31863a[_0x1696('0x38')],function(_0x7a1dd3){var _0x3d30e5={};_0x3d30e5[_0x7a1dd3]={'$like':'%'+_0x1efff3[_0x1696('0x37')]['filter']+'%'};return _0x3d30e5;})});}_0x31863a=_[_0x1696('0x40')]({},_0x31863a,_0x1efff3[_0x1696('0x41')]);return db[_0x1696('0x56')][_0x1696('0x23')]({'where':_0x31863a['where']})[_0x1696('0x16')](function(_0xda316f){_0x4472b9[_0x1696('0x23')]=_0xda316f;if(_0x1efff3[_0x1696('0x37')]['includeAll']){_0x31863a[_0x1696('0x44')]=[{'all':!![]}];}return db['Disposition'][_0x1696('0x45')](_0x31863a);})[_0x1696('0x16')](function(_0x1071ac){_0x4472b9['rows']=_0x1071ac;return _0x4472b9;});}})[_0x1696('0x16')](respondWithFilteredResult(_0x1258be,_0x31863a))[_0x1696('0x1e')](handleError(_0x1258be,null));};exports[_0x1696('0x58')]=function(_0x49e747,_0x43db54){return db['ChatWebsite'][_0x1696('0x47')]({'where':{'id':_0x49e747['params']['id']}})['then'](handleEntityNotFound(_0x43db54,null))[_0x1696('0x16')](function(_0x32cc0f){if(_0x32cc0f){return _0x32cc0f[_0x1696('0x58')](_0x49e747[_0x1696('0x37')][_0x1696('0x59')]);}})[_0x1696('0x16')](respondWithStatusCode(_0x43db54,null))[_0x1696('0x1e')](handleError(_0x43db54,null));};exports[_0x1696('0x5a')]=function(_0xfb3fc0,_0x1734b2){if(_0xfb3fc0['body']['id']){delete _0xfb3fc0[_0x1696('0x4f')]['id'];}return db[_0x1696('0x42')][_0x1696('0x47')]({'where':{'id':_0xfb3fc0[_0x1696('0x50')]['id']}})['then'](handleEntityNotFound(_0x1734b2,null))[_0x1696('0x16')](function(_0x536b13){if(_0x536b13){_0xfb3fc0[_0x1696('0x4f')][_0x1696('0x54')]=_0x536b13['id'];return db[_0x1696('0x5b')][_0x1696('0x48')](_0xfb3fc0[_0x1696('0x4f')]);}})[_0x1696('0x16')](respondWithResult(_0x1734b2,null))['catch'](handleError(_0x1734b2,null));};exports[_0x1696('0x5c')]=function(_0x11ab3b,_0x32440d){var _0xe428c6={'raw':![],'where':{}};var _0x2e84d9={};var _0x17cf25={'count':0x0,'rows':[]};return db[_0x1696('0x42')][_0x1696('0x55')]({'where':{'id':_0x11ab3b[_0x1696('0x50')]['id']}})[_0x1696('0x16')](handleEntityNotFound(_0x32440d,null))['then'](function(_0x2a72dd){if(_0x2a72dd){_0x2e84d9[_0x1696('0x35')]=_[_0x1696('0x32')](db[_0x1696('0x5b')][_0x1696('0x31')]);_0x2e84d9[_0x1696('0x37')]=_[_0x1696('0x32')](_0x11ab3b[_0x1696('0x37')]);_0x2e84d9[_0x1696('0x33')]=_['intersection'](_0x2e84d9['model'],_0x2e84d9[_0x1696('0x37')]);_0xe428c6[_0x1696('0x38')]=_[_0x1696('0x34')](_0x2e84d9[_0x1696('0x35')],qs[_0x1696('0x36')](_0x11ab3b[_0x1696('0x37')]['fields']));_0xe428c6[_0x1696('0x38')]=_0xe428c6[_0x1696('0x38')][_0x1696('0x39')]?_0xe428c6[_0x1696('0x38')]:_0x2e84d9[_0x1696('0x35')];if(!_0x11ab3b['query'][_0x1696('0x57')](_0x1696('0x5d'))){_0xe428c6[_0x1696('0x21')]=qs['limit'](_0x11ab3b[_0x1696('0x37')]['limit']);_0xe428c6['offset']=qs[_0x1696('0x24')](_0x11ab3b[_0x1696('0x37')][_0x1696('0x24')]);}_0xe428c6[_0x1696('0x3a')]=qs[_0x1696('0x3b')](_0x11ab3b[_0x1696('0x37')][_0x1696('0x3b')]);_0xe428c6[_0x1696('0x3c')]=qs[_0x1696('0x33')](_[_0x1696('0x3d')](_0x11ab3b[_0x1696('0x37')],_0x2e84d9['filters']));_0xe428c6[_0x1696('0x3c')][_0x1696('0x54')]=_0x2a72dd['id'];if(_0x11ab3b[_0x1696('0x37')]['filter']){_0xe428c6[_0x1696('0x3c')]=_[_0x1696('0x40')](_0xe428c6[_0x1696('0x3c')],{'$or':_[_0x1696('0x3f')](_0xe428c6[_0x1696('0x38')],function(_0x478b86){var _0x5a7fe5={};_0x5a7fe5[_0x478b86]={'$like':'%'+_0x11ab3b[_0x1696('0x37')][_0x1696('0x3e')]+'%'};return _0x5a7fe5;})});}_0xe428c6=_['merge']({},_0xe428c6,_0x11ab3b[_0x1696('0x41')]);return db['CannedAnswer'][_0x1696('0x23')]({'where':_0xe428c6[_0x1696('0x3c')]})[_0x1696('0x16')](function(_0x342a37){_0x17cf25['count']=_0x342a37;if(_0x11ab3b['query'][_0x1696('0x43')]){_0xe428c6[_0x1696('0x44')]=[{'all':!![]}];}return db[_0x1696('0x5b')][_0x1696('0x45')](_0xe428c6);})[_0x1696('0x16')](function(_0x1eae0d){_0x17cf25[_0x1696('0x5e')]=_0x1eae0d;return _0x17cf25;});}})['then'](respondWithFilteredResult(_0x32440d,_0xe428c6))[_0x1696('0x1e')](handleError(_0x32440d,null));};exports[_0x1696('0x5f')]=function(_0xf0771e,_0x22c844){return db['ChatWebsite'][_0x1696('0x47')]({'where':{'id':_0xf0771e[_0x1696('0x50')]['id']}})[_0x1696('0x16')](handleEntityNotFound(_0x22c844,null))[_0x1696('0x16')](function(_0x1d1a34){if(_0x1d1a34){return _0x1d1a34[_0x1696('0x5f')](_0xf0771e[_0x1696('0x37')][_0x1696('0x59')]);}})[_0x1696('0x16')](respondWithStatusCode(_0x22c844,null))['catch'](handleError(_0x22c844,null));};exports['addLogo']=function(_0x313126,_0x30056){_0x313126[_0x1696('0x4f')][_0x1696('0x60')]=_0x313126['file'][_0x1696('0x61')];return db[_0x1696('0x42')]['find']({'where':{'id':_0x313126['params']['id']}})['then'](handleEntityNotFound(_0x30056,null))[_0x1696('0x16')](saveUpdates(_0x313126['body'],null))[_0x1696('0x16')](respondWithResult(_0x30056,null))['catch'](handleError(_0x30056,null));};exports[_0x1696('0x62')]=function(_0x19b449,_0x404be6){_0x19b449[_0x1696('0x4f')][_0x1696('0x63')]=_0x19b449[_0x1696('0x64')][_0x1696('0x61')];return db['ChatWebsite'][_0x1696('0x47')]({'where':{'id':_0x19b449[_0x1696('0x50')]['id']}})[_0x1696('0x16')](handleEntityNotFound(_0x404be6,null))[_0x1696('0x16')](saveUpdates(_0x19b449[_0x1696('0x4f')],null))[_0x1696('0x16')](respondWithResult(_0x404be6,null))[_0x1696('0x1e')](handleError(_0x404be6,null));};exports[_0x1696('0x65')]=function(_0x2aa66d,_0x4b6332){_0x2aa66d[_0x1696('0x4f')][_0x1696('0x66')]=_0x2aa66d['file'][_0x1696('0x61')];return db['ChatWebsite'][_0x1696('0x47')]({'where':{'id':_0x2aa66d[_0x1696('0x50')]['id']}})[_0x1696('0x16')](handleEntityNotFound(_0x4b6332,null))[_0x1696('0x16')](saveUpdates(_0x2aa66d[_0x1696('0x4f')],null))[_0x1696('0x16')](respondWithResult(_0x4b6332,null))[_0x1696('0x1e')](handleError(_0x4b6332,null));};exports[_0x1696('0x67')]=function(_0x50da5c,_0x3f4deb){_0x50da5c[_0x1696('0x4f')]['systemAvatar']=_0x50da5c[_0x1696('0x64')][_0x1696('0x61')];return db[_0x1696('0x42')][_0x1696('0x47')]({'where':{'id':_0x50da5c[_0x1696('0x50')]['id']}})['then'](handleEntityNotFound(_0x3f4deb,null))[_0x1696('0x16')](saveUpdates(_0x50da5c['body'],null))[_0x1696('0x16')](respondWithResult(_0x3f4deb,null))[_0x1696('0x1e')](handleError(_0x3f4deb,null));};exports[_0x1696('0x68')]=function(_0x1a273d,_0x39356e){var _0x5b3493=path[_0x1696('0x69')](config[_0x1696('0x6a')],_0x1696('0x6b'));var _0x2f9ec4={'where':{'id':_0x1a273d['params']['id']},'attributes':['id',_0x1696('0x60')],'raw':!![]};var _0xbdfa79=![];return require('../../config/license/util')[_0x1696('0x6c')]()[_0x1696('0x16')](function(_0x3c90a7){if(_0x3c90a7){_0xbdfa79=_0x3c90a7[_0x1696('0x6d')];}})[_0x1696('0x16')](function(){return db[_0x1696('0x42')][_0x1696('0x47')](_0x2f9ec4);})['then'](handleEntityNotFound(_0x39356e,null))[_0x1696('0x16')](function(_0xc37d6e){if(_0xc37d6e){if(!_[_0x1696('0x6e')](_0xc37d6e[_0x1696('0x60')])){if(fs[_0x1696('0x6f')](path['join'](config['root'],_0x1696('0x70'),_0xc37d6e[_0x1696('0x60')]))&&_0xbdfa79){_0x5b3493=path[_0x1696('0x69')](config['root'],_0x1696('0x70'),_0xc37d6e[_0x1696('0x60')]);}}return _0x39356e[_0x1696('0x71')](_0x5b3493);}})[_0x1696('0x1e')](handleError(_0x39356e,null));};exports[_0x1696('0x72')]=function(_0x3b491c,_0x45a974){var _0x595847=path[_0x1696('0x69')](config[_0x1696('0x6a')],_0x1696('0x73'));var _0x4d6f5d={'where':{'id':_0x3b491c[_0x1696('0x50')]['id']},'attributes':['id',_0x1696('0x63')],'raw':!![]};return db[_0x1696('0x42')][_0x1696('0x47')](_0x4d6f5d)[_0x1696('0x16')](handleEntityNotFound(_0x45a974,null))[_0x1696('0x16')](function(_0x4b1d49){if(_0x4b1d49){if(!_['isNil'](_0x4b1d49[_0x1696('0x63')])){if(fs[_0x1696('0x6f')](path['join'](config[_0x1696('0x6a')],_0x1696('0x74'),_0x4b1d49[_0x1696('0x63')]))){_0x595847=path[_0x1696('0x69')](config['root'],_0x1696('0x74'),_0x4b1d49[_0x1696('0x63')]);}}return _0x45a974[_0x1696('0x71')](_0x595847);}})[_0x1696('0x1e')](handleError(_0x45a974,null));};exports['getCustomerAvatar']=function(_0x5064e1,_0x537d8d){var _0x29b556=path[_0x1696('0x69')](config[_0x1696('0x6a')],_0x1696('0x75'));var _0x52c591={'where':{'id':_0x5064e1['params']['id']},'attributes':['id',_0x1696('0x66'),_0x1696('0x76')],'raw':!![]};return db[_0x1696('0x42')][_0x1696('0x47')](_0x52c591)[_0x1696('0x16')](handleEntityNotFound(_0x537d8d,null))['then'](function(_0x24762a){if(_0x24762a){if(!_[_0x1696('0x6e')](_0x24762a[_0x1696('0x66')])){if(fs[_0x1696('0x6f')](path[_0x1696('0x69')](config['root'],_0x1696('0x74'),_0x24762a[_0x1696('0x66')]))&&_0x24762a[_0x1696('0x76')]){_0x29b556=path[_0x1696('0x69')](config['root'],_0x1696('0x74'),_0x24762a[_0x1696('0x66')]);}}return _0x537d8d[_0x1696('0x71')](_0x29b556);}})[_0x1696('0x1e')](handleError(_0x537d8d,null));};exports[_0x1696('0x77')]=function(_0x55f376,_0x36eefe){var _0x2193a2=path['join'](config[_0x1696('0x6a')],_0x1696('0x78'));var _0x343294={'where':{'id':_0x55f376['params']['id']},'attributes':['id',_0x1696('0x79')],'raw':!![]};return db[_0x1696('0x42')][_0x1696('0x47')](_0x343294)['then'](handleEntityNotFound(_0x36eefe,null))[_0x1696('0x16')](function(_0x3cef49){if(_0x3cef49){if(!_[_0x1696('0x6e')](_0x3cef49['systemAvatar'])){if(fs[_0x1696('0x6f')](path['join'](config[_0x1696('0x6a')],'server/files/images/avatars/',_0x3cef49[_0x1696('0x79')]))){_0x2193a2=path[_0x1696('0x69')](config[_0x1696('0x6a')],_0x1696('0x74'),_0x3cef49['systemAvatar']);}}return _0x36eefe[_0x1696('0x71')](_0x2193a2);}})[_0x1696('0x1e')](handleError(_0x36eefe,null));};exports[_0x1696('0x7a')]=function(_0x178d4f,_0x232343){var _0x4a9655=require(_0x1696('0x7b'));var _0x10f9b1=new _0x4a9655();var _0x2e6b32=_0x10f9b1[_0x1696('0x7c')](_0x178d4f[_0x1696('0x7d')][_0x1696('0x7e')])[_0x1696('0x7f')]();var _0x44dab0={'body':_0x178d4f[_0x1696('0x4f')],'channel':_0x1696('0x80')};var _0x41d89b=[];var _0x40454b=[];var _0x191962={};var _0x22ad8c=![];return db[_0x1696('0x81')][_0x1696('0x52')]()[_0x1696('0x16')](function(_0x5764e7){if(!_0x5764e7){throw new db[(_0x1696('0x82'))][(_0x1696('0x83'))](_0x1696('0x84'));}_0x41d89b=_['difference'](_[_0x1696('0x32')](_0x5764e7),['createdAt',_0x1696('0x85')]);_0x40454b=_['difference'](_[_0x1696('0x32')](_0x5764e7),[_0x1696('0x86'),_0x1696('0x85'),'CompanyId','ListId']);if(_0x178d4f[_0x1696('0x4f')]['id']){delete _0x178d4f[_0x1696('0x4f')]['id'];}if(_[_0x1696('0x6e')](_0x178d4f[_0x1696('0x4f')][_0x1696('0x87')])){throw new db[(_0x1696('0x82'))][(_0x1696('0x83'))](_0x1696('0x88'));}if(_['isNil'](_0x178d4f[_0x1696('0x4f')][_0x1696('0x4f')])||_0x178d4f['body'][_0x1696('0x4f')]===''){throw new db[(_0x1696('0x82'))][(_0x1696('0x83'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1696('0x6e')](_0x178d4f['body'][_0x1696('0x89')])){throw new db['Sequelize']['ValidationError'](_0x1696('0x8a')+_0x40454b);}if(!_['includes'](_0x40454b,_0x178d4f[_0x1696('0x4f')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x1696('0x8b')+_0x40454b);}_0x191962[_0x178d4f[_0x1696('0x4f')][_0x1696('0x89')]]=_0x178d4f['body'][_0x1696('0x87')];})[_0x1696('0x16')](function(){return db[_0x1696('0x42')][_0x1696('0x47')]({'where':{'id':_0x178d4f['params']['id']},'include':[{'model':db['CmList'],'as':_0x1696('0x8c'),'include':[{'model':db[_0x1696('0x81')],'as':'Contacts','where':_0x191962,'limit':0x1,'order':[[_0x1696('0x85'),_0x1696('0x8d')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x1696('0x16')](handleEntityNotFound(_0x232343,null))[_0x1696('0x16')](function(_0x40a495){if(_0x40a495&&_0x40a495[_0x1696('0x8c')]){_0x44dab0[_0x1696('0x8e')]=_0x40a495;_0x44dab0['applications']=_0x40a495[_0x1696('0x8f')];_0x44dab0['list']=_0x40a495[_0x1696('0x8c')];_0x44dab0[_0x1696('0x90')]=_['orderBy'](_0x44dab0[_0x1696('0x90')],['priority'],[_0x1696('0x91')]);if(_0x44dab0[_0x1696('0x8e')]['Applications']){delete _0x44dab0[_0x1696('0x8e')][_0x1696('0x8f')];}if(_0x44dab0[_0x1696('0x8e')][_0x1696('0x8c')]&&_0x44dab0[_0x1696('0x8e')][_0x1696('0x8c')][_0x1696('0x92')]['length']){return _0x44dab0[_0x1696('0x8e')][_0x1696('0x8c')][_0x1696('0x92')][0x0];}var _0x3c169=_['defaults'](_0x178d4f[_0x1696('0x4f')],{'firstName':_0x178d4f['body'][_0x1696('0x87')],'ListId':_0x40a495['ListId']});_0x3c169[_0x178d4f[_0x1696('0x4f')]['mapKey']]=_0x178d4f['body']['from'];return db[_0x1696('0x81')]['create'](_0x3c169,{'fields':_0x41d89b,'raw':!![]});}})[_0x1696('0x16')](handleEntityNotFound(_0x232343,null))[_0x1696('0x16')](function(_0x380fea){_0x44dab0[_0x1696('0x93')]=_0x380fea;var _0x501490=_0x178d4f[_0x1696('0x4f')][_0x1696('0x94')];if(_0x178d4f['headers'][_0x1696('0x95')]){_0x501490=_0x178d4f[_0x1696('0x7d')]['cf-connecting-ip'];}else if(_0x178d4f['headers'][_0x1696('0x96')]){_0x501490=_['first'](_0x178d4f['headers']['x-forwarded-for'][_0x1696('0x97')](','));}if(_0x380fea){var _0x23b0bc={'ContactId':_0x380fea['id'],'ChatWebsiteId':_0x178d4f['params']['id'],'from':(_0x380fea['firstName']||'')+'\x20'+(_0x380fea[_0x1696('0x98')]||''),'customerIp':_0x501490,'customerPort':_0x178d4f[_0x1696('0x7d')]['x-real-port']?_0x178d4f['headers'][_0x1696('0x99')]:null,'referer':_0x178d4f[_0x1696('0x4f')]['referer'],'browserName':_0x2e6b32[_0x1696('0x9a')][_0x1696('0x2d')]&&_0x2e6b32['browser'][_0x1696('0x9b')]?util['format']('%s\x20%s',_0x2e6b32[_0x1696('0x9a')][_0x1696('0x2d')],_0x2e6b32['browser']['version']):_0x1696('0x9c'),'browserVersion':_0x2e6b32['browser'][_0x1696('0x9b')]||'unknown','osName':util['format'](_0x1696('0x9d'),_0x2e6b32['os'][_0x1696('0x2d')],_0x2e6b32['os'][_0x1696('0x9b')]),'osVersion':_0x2e6b32['os'][_0x1696('0x9b')],'deviceModel':_0x2e6b32[_0x1696('0x9e')]['model']&&_0x2e6b32['device']['vendor']?util[_0x1696('0x9f')](_0x1696('0xa0'),_0x2e6b32[_0x1696('0x9e')][_0x1696('0x35')],_0x2e6b32[_0x1696('0x9e')][_0x1696('0xa1')],_0x2e6b32['device'][_0x1696('0xa2')]):null,'deviceVendor':_0x2e6b32[_0x1696('0x9e')][_0x1696('0xa1')],'deviceType':_0x2e6b32[_0x1696('0x9e')][_0x1696('0xa2')],'formData':JSON[_0x1696('0xa3')](_0x178d4f[_0x1696('0x4f')])};var _0x4367d5={'ChatWebsiteId':_0x178d4f[_0x1696('0x50')]['id'],'closed':![]};if(_0x178d4f[_0x1696('0x4f')][_0x1696('0xa4')]){_0x4367d5['threadId']=_0x178d4f[_0x1696('0x4f')][_0x1696('0xa4')];return db[_0x1696('0xa5')]['find']({'where':_0x4367d5})[_0x1696('0x16')](function(_0x392376){if(_0x392376){return[_0x392376,![]];}_0x23b0bc['threadId']=_0x178d4f[_0x1696('0x4f')][_0x1696('0xa4')];_0x23b0bc['externalUrl']=_0x178d4f[_0x1696('0x4f')][_0x1696('0xa6')];return db[_0x1696('0xa5')][_0x1696('0x48')](_0x23b0bc)[_0x1696('0x16')](function(_0x369f0c){return[_0x369f0c,!![]];});});}_0x4367d5['ContactId']=_0x380fea['id'];if(_0x178d4f[_0x1696('0x4f')][_0x1696('0xa7')]&&_0x178d4f[_0x1696('0x4f')][_0x1696('0xa7')]['id']){_0x4367d5['id']=_0x178d4f[_0x1696('0x4f')][_0x1696('0xa7')]['id'];return db['ChatInteraction'][_0x1696('0x47')]({'where':_0x4367d5})['then'](function(_0x364cf7){if(_0x364cf7){return[_0x364cf7,![]];}return db[_0x1696('0xa5')]['create'](_0x23b0bc)['then'](function(_0x2f104c){return[_0x2f104c,!![]];});});}return db[_0x1696('0xa5')][_0x1696('0x48')](_0x23b0bc)['then'](function(_0x2b011f){return[_0x2b011f,!![]];});}})[_0x1696('0xa8')](function(_0x25cf1c,_0x2f4be4){if(_0x25cf1c){_0x22ad8c=_0x2f4be4;if(!_0x2f4be4){var _0x581afe={'from':(_0x44dab0[_0x1696('0x93')][_0x1696('0xa9')]||'')+'\x20'+(_0x44dab0[_0x1696('0x93')]['lastName']||'')};if(_0x178d4f[_0x1696('0x4f')][_0x1696('0xa4')]&&_0x178d4f[_0x1696('0x4f')][_0x1696('0xaa')]&&_0x178d4f[_0x1696('0x4f')][_0x1696('0xa4')]!=_0x178d4f[_0x1696('0x4f')][_0x1696('0xaa')]){_0x581afe[_0x1696('0xa4')]=_0x178d4f[_0x1696('0x4f')][_0x1696('0xaa')];}return _0x25cf1c[_0x1696('0x27')](_0x581afe);}else{return _0x25cf1c;}}})[_0x1696('0x16')](function(_0x205b98){_0x44dab0[_0x1696('0xa7')]=_0x205b98[_0x1696('0x29')]({'plain':!![]});_0x44dab0['interaction'][_0x1696('0xab')]=_0x22ad8c;if(_0x44dab0[_0x1696('0xa7')][_0x1696('0xab')]){if(_0x44dab0[_0x1696('0x8e')][_0x1696('0xac')]){_0x44dab0['applications'][_0x1696('0xad')]({'id':0x0,'priority':_0x44dab0[_0x1696('0x90')][_0x1696('0x39')]+0x1,'app':_0x1696('0xae'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db['ChatMessage'][_0x1696('0x48')]({'body':_0x178d4f[_0x1696('0x4f')][_0x1696('0x4f')],'ChatWebsiteId':_0x178d4f[_0x1696('0x50')]['id'],'ChatInteractionId':_0x205b98['id'],'direction':'in','ContactId':_0x44dab0[_0x1696('0x93')]['id'],'AttachmentId':_0x178d4f[_0x1696('0x4f')][_0x1696('0xaf')]});})[_0x1696('0x16')](function(_0x222f4e){_0x44dab0[_0x1696('0x1a')]=_0x222f4e;if(_0x44dab0[_0x1696('0xa7')][_0x1696('0xb0')]){return db[_0x1696('0xb1')]['find']({'attributes':['id',_0x1696('0x2d')],'where':{'id':_0x44dab0[_0x1696('0xa7')][_0x1696('0xb0')]}})[_0x1696('0x16')](function(_0x44537c){if(_0x44537c){_0x44dab0[_0x1696('0x90')][_0x1696('0xb2')]({'id':0x0,'priority':0x0,'app':_0x1696('0xb3'),'appdata':_0x44537c['name']+','+(_0x44dab0[_0x1696('0x8e')][_0x1696('0xb4')]||0xa),'interval':_0x1696('0xb5')});_0x44dab0[_0x1696('0xb6')]=!![];}return respondWithRpcPromise(_0x1696('0xb7'),'startRouting',_0x44dab0);});}return respondWithRpcPromise('Start',_0x1696('0xb8'),_0x44dab0);})[_0x1696('0x16')](function(_0x31b721){respondWithRpcPromise(_0x1696('0xb9'),_0x1696('0xb9'),{'event':'notify','message':_0x31b721},client9002);return _0x31b721;})[_0x1696('0x16')](respondWithResult(_0x232343,null))[_0x1696('0x1e')](handleError(_0x232343,null));};exports[_0x1696('0xba')]=function(_0x5197e2,_0x2f6f60){var _0x3ec4b9,_0x5f44fb,_0x3c6a61;var _0x542512=[];var _0x172abd={};var _0x45b5c8=_0x5197e2[_0x1696('0xbb')]||[];var _0x5b5514=[];var _0x3a4fa2;return db[_0x1696('0x81')][_0x1696('0x52')]()[_0x1696('0x16')](function(_0x551347){if(!_0x551347){throw new db[(_0x1696('0x82'))][(_0x1696('0x83'))](_0x1696('0x84'));}_0x542512=_[_0x1696('0xbc')](_[_0x1696('0x32')](_0x551347),[_0x1696('0x86'),_0x1696('0x85'),_0x1696('0xbd'),_0x1696('0xbe')]);if(_0x5197e2[_0x1696('0x4f')]['id']){delete _0x5197e2['body']['id'];}if(_[_0x1696('0x6e')](_0x5197e2['body'][_0x1696('0x87')])){throw _0x2f6f60[_0x1696('0x20')](0x1f4)['send'](new db[(_0x1696('0x82'))][(_0x1696('0x83'))](_0x1696('0x88')));}if(_[_0x1696('0x6e')](_0x5197e2['body'][_0x1696('0x4f')])||_0x5197e2[_0x1696('0x4f')][_0x1696('0x4f')]===''){throw _0x2f6f60['status'](0x1f4)[_0x1696('0x2e')](new db[(_0x1696('0x82'))][(_0x1696('0x83'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x5197e2[_0x1696('0x4f')]['mapKeyOffline'])){throw _0x2f6f60[_0x1696('0x20')](0x1f4)['send'](new db[(_0x1696('0x82'))][(_0x1696('0x83'))](_0x1696('0xbf')+_0x542512));}if(!_[_0x1696('0xc0')](_0x542512,_0x5197e2['body']['mapKeyOffline'])){throw _0x2f6f60[_0x1696('0x20')](0x1f4)['send'](new db[(_0x1696('0x82'))][(_0x1696('0x83'))](_0x1696('0xc1')+_0x542512));}_0x172abd[_0x5197e2['body'][_0x1696('0xc2')]]=_0x5197e2[_0x1696('0x4f')][_0x1696('0x87')];})[_0x1696('0x16')](function(){return db[_0x1696('0x42')][_0x1696('0x47')]({'where':{'id':_0x5197e2[_0x1696('0x50')]['id']},'include':[{'model':db[_0x1696('0xc3')],'as':_0x1696('0x8c')},{'model':db[_0x1696('0xc4')],'as':_0x1696('0xc4')}]});})[_0x1696('0x16')](handleEntityNotFound(_0x2f6f60,null))['then'](function(_0xb4d398){if(_0xb4d398&&_0xb4d398[_0x1696('0x8c')]){_0x5f44fb=_0xb4d398;var _0xaeceac=_[_0x1696('0xd')](_0x5197e2[_0x1696('0x4f')],{'firstName':_0x5197e2[_0x1696('0x4f')]['from'],'phone':_0x5197e2['body'][_0x1696('0x87')],'ListId':_0xb4d398[_0x1696('0xbe')]});_0xaeceac[_0x5197e2['body'][_0x1696('0xc2')]]=_0x5197e2[_0x1696('0x4f')][_0x1696('0x87')];return db[_0x1696('0x81')][_0x1696('0xc5')]({'where':_0x172abd,'defaults':_0xaeceac});}})[_0x1696('0xa8')](function(_0x4bf275){if(_0x4bf275){_0x3c6a61=_0x4bf275;var _0x1f4d95=fs[_0x1696('0xc6')](path[_0x1696('0x69')](config[_0x1696('0x6a')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x17e576=ejs[_0x1696('0xc7')](_0x1f4d95,{'body':_['toPairs'](_0x5197e2[_0x1696('0x4f')][_0x1696('0x4f')]),'bodyTitle':_0x5f44fb['offlineMessageBody']});return db[_0x1696('0xc8')][_0x1696('0x48')]({'body':_0x17e576,'plainBody':htmlToText[_0x1696('0xc9')](_0x17e576),'ContactId':_0x4bf275['id'],'ChatWebsiteId':_0x5f44fb['id']});}})[_0x1696('0x16')](function(_0x287505){_0x3a4fa2=_0x287505;if(_0x45b5c8[_0x1696('0x39')]){var _0x546a3f=_0x45b5c8[_0x1696('0x3f')](function(_0x1557ea){return{'name':_0x1557ea['originalname'],'basename':_0x1557ea[_0x1696('0x61')],'type':_0x1557ea[_0x1696('0xca')],'ChatOfflineMessageId':_0x287505['id']};});_0x5b5514=_0x546a3f[_0x1696('0x3f')](_0x3ea067=>{var _0x298f70={'filename':_0x3ea067['name'],'path':path[_0x1696('0x69')](config['root'],_0x1696('0xcb'),_0x1696('0xbb'),'attachments','offline-chat',_0x3ea067[_0x1696('0xcc')])};return _0x298f70;});if(!_0x5f44fb[_0x1696('0xcd')]){return db['sequelize'][_0x1696('0xce')](function(_0x96b9e3){return db[_0x1696('0xcf')][_0x1696('0xd0')](_0x546a3f,{'transaction':_0x96b9e3});});}}})[_0x1696('0x16')](function(){if(_0x3a4fa2){_0x3ec4b9=_0x3a4fa2;return db[_0x1696('0xc4')][_0x1696('0x55')]({'where':{'service':!![]},'include':[{'model':db[_0x1696('0xd1')],'as':_0x1696('0xd2'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1696('0xd3'),'raw':!![]}]}]});}})[_0x1696('0x16')](function(_0x305290){if(_0x305290&&_0x305290[_0x1696('0xd2')]&&_0x5f44fb['forwardOffline']&&_0x5f44fb[_0x1696('0xd4')]){var _0x5623c4=_0x305290[_0x1696('0xd5')]();return respondWithRpcPromise(_0x1696('0xd6'),'sendMail',{'account':_0x5623c4,'message':{'from':util[_0x1696('0x9f')](_0x1696('0xd7'),_0x305290[_0x1696('0x2d')],_0x305290['email']||_0x305290[_0x1696('0xd2')][_0x1696('0x4a')]),'to':_0x5f44fb['forwardOfflineAddress'],'subject':_0x5f44fb[_0x1696('0xd8')],'html':_0x3ec4b9[_0x1696('0x4f')],'attachments':_0x5b5514}},client9003)[_0x1696('0x16')](function(){return _0x3ec4b9;})['catch'](function(_0x493c79){logger[_0x1696('0x19')](_0x493c79);});}})[_0x1696('0x16')](function(){if(_0x5f44fb&&_0x5f44fb[_0x1696('0xcd')]&&_0x5f44fb[_0x1696('0xd9')]){var _0x3f42ec=[];if(_0x45b5c8[_0x1696('0x39')]){_0x3f42ec=_0x45b5c8[_0x1696('0x3f')](function(_0x4bc55b){return{'name':_0x4bc55b[_0x1696('0xda')],'basename':_0x4bc55b['filename'],'type':_0x4bc55b[_0x1696('0xca')],'ChatOfflineMessageId':_0x3a4fa2['id']};});}var _0x2153ce;if(!_['isNil'](_0x5f44fb['subjectOffline'])){var _0x1f41bb=_[_0x1696('0x3f')](_0x5197e2[_0x1696('0x4f')],function(_0x48a0f8){return _0x48a0f8;});var _0x8d7f12=_[_0x1696('0xdb')](_0x1f41bb)[0x0];var _0x3d6bcc=_[_0x1696('0xdc')](_0x8d7f12,function(_0x5a6f7a){return _0x5a6f7a;});_0x2153ce=_0x3d6bcc[0x1][_0x5f44fb['subjectOffline']];}var _0x4006a={'from':_0x3c6a61[_0x1696('0xdd')],'firstName':_0x3c6a61[_0x1696('0xa9')],'lastName':_0x3c6a61['lastName'],'mapKey':_0x1696('0xdd'),'message':{'from':_0x3c6a61[_0x1696('0xdd')],'to':_0x5f44fb[_0x1696('0xc4')][_0x1696('0xdd')],'cc':'','subject':_[_0x1696('0x6e')](_0x2153ce)?_0x5f44fb['offlineMessageSubject']:_0x2153ce,'messageId':'','sentAt':new Date(),'attach':_0x3f42ec[_0x1696('0x39')],'attachments':_0x3f42ec,'originChannel':_0x1696('0xde'),'ChatWebsiteId':_0x5f44fb['id'],'ChatOfflineMessageId':_0x3ec4b9['id'],'originTo':_0x5f44fb[_0x1696('0xc4')][_0x1696('0xdd')]},'body':_0x3ec4b9[_0x1696('0x4f')]};var _0x4f6356={'account':{'id':_0x5f44fb[_0x1696('0xd9')]},'body':_0x4006a,'log':_0x1696('0xdf')};return respondWithRpcPromise('NotifyMailAccount',_0x1696('0xe0'),_0x4f6356,client9001)[_0x1696('0x16')](function(){return _0x3ec4b9;})[_0x1696('0x1e')](function(_0x523205){logger[_0x1696('0x19')](_0x523205);});}return;})['then'](function(){if(_0x3ec4b9){return _0x3ec4b9;}})[_0x1696('0x16')](respondWithResult(_0x2f6f60,null))[_0x1696('0x1e')](function(_0x16b109){logger[_0x1696('0x19')](_0x1696('0x1e'),_0x16b109);for(var _0x56f01b of _0x45b5c8){var _0x13bbc1=path[_0x1696('0x69')](config[_0x1696('0x6a')],_0x1696('0xcb'),'files',_0x1696('0xe1'),'offline-chat',_0x56f01b[_0x1696('0x61')]);fs_extra[_0x1696('0xe2')](_0x13bbc1)['catch'](function(_0x50526b){logger[_0x1696('0x19')](_0x1696('0xe3'),_0x13bbc1,_0x50526b);});}});};exports[_0x1696('0xe4')]=function(_0x256f00,_0x2dc0f6){return db[_0x1696('0xa5')][_0x1696('0x47')]({'where':{'id':_0x256f00[_0x1696('0x50')]['id']}})[_0x1696('0x16')](handleEntityNotFound(_0x2dc0f6,null))[_0x1696('0x16')](function(_0x5418ee){if(_0x5418ee){return _0x5418ee['addInteraction'](_0x256f00['body'][_0x1696('0x59')],_[_0x1696('0xe5')](_0x256f00['body'],[_0x1696('0x59'),'id'])||{});}})[_0x1696('0x16')](respondWithResult(_0x2dc0f6,null))[_0x1696('0x1e')](handleError(_0x2dc0f6,null));};exports['getInteractions']=function(_0x403cc8,_0xbce0ed){var _0x5cd9db={'raw':![],'where':{}};var _0x4f54ab={};var _0x4a3dc7={'count':0x0,'rows':[]};return db[_0x1696('0x42')][_0x1696('0x55')]({'where':{'id':_0x403cc8[_0x1696('0x50')]['id']}})[_0x1696('0x16')](handleEntityNotFound(_0xbce0ed,null))[_0x1696('0x16')](function(_0x2908ad){if(_0x2908ad){_0x4f54ab['model']=_[_0x1696('0x32')](db[_0x1696('0xa5')][_0x1696('0x31')]);_0x4f54ab['query']=_['keys'](_0x403cc8[_0x1696('0x37')]);_0x4f54ab[_0x1696('0x33')]=_[_0x1696('0x34')](_0x4f54ab[_0x1696('0x35')],_0x4f54ab[_0x1696('0x37')]);_0x5cd9db[_0x1696('0x38')]=_['intersection'](_0x4f54ab[_0x1696('0x35')],qs['fields'](_0x403cc8[_0x1696('0x37')][_0x1696('0x36')]));_0x5cd9db['attributes']=_0x5cd9db[_0x1696('0x38')][_0x1696('0x39')]?_0x5cd9db[_0x1696('0x38')]:_0x4f54ab['model'];if(!_0x403cc8[_0x1696('0x37')][_0x1696('0x57')](_0x1696('0x5d'))){_0x5cd9db[_0x1696('0x21')]=qs[_0x1696('0x21')](_0x403cc8[_0x1696('0x37')][_0x1696('0x21')]);_0x5cd9db['offset']=qs[_0x1696('0x24')](_0x403cc8[_0x1696('0x37')]['offset']);}_0x5cd9db[_0x1696('0x3a')]=qs[_0x1696('0x3b')](_0x403cc8[_0x1696('0x37')]['sort']);_0x5cd9db[_0x1696('0x3c')]=qs['filters'](_[_0x1696('0x3d')](_0x403cc8[_0x1696('0x37')],_0x4f54ab[_0x1696('0x33')]));_0x5cd9db[_0x1696('0x3c')][_0x1696('0x54')]=_0x2908ad['id'];if(_0x403cc8[_0x1696('0x37')]['filter']){_0x5cd9db['where']=_['merge'](_0x5cd9db[_0x1696('0x3c')],{'$or':_['map'](_0x5cd9db[_0x1696('0x38')],function(_0x2bb358){var _0x3ad7d2={};_0x3ad7d2[_0x2bb358]={'$like':'%'+_0x403cc8[_0x1696('0x37')][_0x1696('0x3e')]+'%'};return _0x3ad7d2;})});}_0x5cd9db=_[_0x1696('0x40')]({},_0x5cd9db,_0x403cc8['options']);return db[_0x1696('0xa5')][_0x1696('0x23')]({'where':_0x5cd9db[_0x1696('0x3c')]})[_0x1696('0x16')](function(_0x24c00f){_0x4a3dc7['count']=_0x24c00f;if(_0x403cc8['query']['includeAll']){_0x5cd9db[_0x1696('0x44')]=[{'model':db[_0x1696('0x81')],'as':_0x1696('0xe6'),'required':![]},{'model':db[_0x1696('0xb1')],'as':'Owner','attributes':[_0x1696('0x2d'),_0x1696('0xe7'),_0x1696('0xe8')],'required':![]},{'model':db[_0x1696('0xe9')],'as':_0x1696('0xea'),'attributes':['id',_0x1696('0x2d'),_0x1696('0xeb')],'where':_0x403cc8['query'][_0x1696('0xec')]?{'id':_0x403cc8[_0x1696('0x37')][_0x1696('0xec')]}:undefined,'required':_0x403cc8[_0x1696('0x37')][_0x1696('0xec')]?!![]:![]}];}return db[_0x1696('0xa5')][_0x1696('0x45')](_0x5cd9db);})[_0x1696('0x16')](function(_0x599409){_0x4a3dc7[_0x1696('0x5e')]=_0x599409;return _0x4a3dc7;});}})[_0x1696('0x16')](respondWithFilteredResult(_0xbce0ed,_0x5cd9db))[_0x1696('0x1e')](handleError(_0xbce0ed,null));};function iftimePromise(_0x2a0286,_0x30777e){return respondWithRpcPromise('Command','getSnippet',{'command':_0x30777e['timezone']?util[_0x1696('0x9f')](_0x1696('0xed'),_0x2a0286['interval'],_0x30777e[_0x1696('0xee')]):util['format']('iftime\x20%s',_0x2a0286[_0x1696('0xef')])},client9002)[_0x1696('0x16')](function(_0x18b1cb){var _0x493a64=_0x18b1cb&&_0x18b1cb[_0x1696('0xf0')]('true')>=0x0?!![]:![];logger[_0x1696('0x1c')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x30777e['id'],_0x2a0286['id'],_0x2a0286[_0x1696('0xef')],_0x493a64?_0x1696('0xf1'):_0x1696('0xf2'),_0x30777e['timezone']?_0x30777e[_0x1696('0xee')]:_0x1696('0xf3'));return _0x493a64;})[_0x1696('0x1e')](function(_0x27072d){logger[_0x1696('0x19')](_0x1696('0xf4'),_0x30777e['id'],_0x2a0286['id'],_0x2a0286['interval'],util['inspect'](_0x27072d,{'showHidden':![],'depth':null}),_0x30777e[_0x1696('0xee')]?_0x30777e[_0x1696('0xee')]:_0x1696('0xf3'));return![];});}exports[_0x1696('0xf5')]=function(_0xe32555,_0x2887a4){var _0x498f57=0x0;var _0x39e1bd=0x0;var _0x2850dc=![];var _0x49f2df;var _0x150fe1;return db[_0x1696('0x42')][_0x1696('0x47')]({'where':{'id':_0xe32555[_0x1696('0x50')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x1696('0xf6')],'as':_0x1696('0xf7'),'attributes':['id',_0x1696('0xef')],'raw':!![]}]}]})[_0x1696('0x16')](handleEntityNotFound(_0x2887a4,null))[_0x1696('0x16')](function(_0x5b2a93){if(_0x5b2a93){_0x49f2df=_0x5b2a93;return _0x5b2a93['getProactiveActions']({'raw':!![]});}})[_0x1696('0x16')](function(_0x7d1fee){if(_0x49f2df){if(_0x7d1fee){_0x150fe1=_0x7d1fee;}}return require('../../config/license/util')[_0x1696('0x6c')]();})[_0x1696('0x16')](function(_0x35d283){if(_0x35d283){_0x39e1bd=_0x35d283[_0x1696('0xf8')];_0x2850dc=_0x35d283[_0x1696('0x6d')];}})[_0x1696('0x16')](function(){return db['ChatInteraction'][_0x1696('0x23')]({'where':{'closed':![]}});})[_0x1696('0x16')](function(_0xb4eb41){_0x498f57=_0xb4eb41;if(_0x39e1bd&&_0xb4eb41>_0x39e1bd){return db['License'][_0x1696('0x55')]({'where':{'id':0x1}})[_0x1696('0x16')](function(_0x3ddc88){if(_0x3ddc88){_0x3ddc88[_0x1696('0xf9')](_0x1696('0xfa'));}});}})[_0x1696('0x16')](function(){if(_0x49f2df['Interval']&&_0x49f2df[_0x1696('0xf6')][_0x1696('0xf7')]){var _0x2643fb=[];for(var _0x212ae0=0x0;_0x212ae0<_0x49f2df[_0x1696('0xf6')]['Intervals'][_0x1696('0x39')];_0x212ae0++){var _0x5bc289=_0x49f2df[_0x1696('0xf6')]['Intervals'][_0x212ae0]['get']({'plain':!![]});_0x2643fb[_0x1696('0xad')](iftimePromise(_0x5bc289,_0x49f2df));}return BPromise['all'](_0x2643fb)[_0x1696('0x16')](function(_0x3f09db){return _['some'](_0x3f09db);});}else{return!![];}})[_0x1696('0x16')](function(_0x3e8eec){var _0x11be20=fs[_0x1696('0xc6')](path['join'](config['root'],_0x1696('0xfb')),'utf8');var _0xdacbbd={'remote':_0x49f2df[_0x1696('0xfc')],'query':querystring['stringify'](_[_0x1696('0x40')](_0x49f2df[_0x1696('0x29')]({'plain':!![]}),{'customerIp':_0xe32555[_0x1696('0x7d')][_0x1696('0x96')]||_0xe32555[_0x1696('0x7d')]['x-real-ip']||_0xe32555[_0x1696('0xfd')][_0x1696('0xfe')]||_0xe32555['ip'],'referer':_0xe32555[_0x1696('0x7d')]['referer'],'openedInteractions':_0x498f57,'maxInteractions':_0x39e1bd,'virtual':_0x2850dc['virtual'],'online':_0x3e8eec,'custom':_0x2850dc}))[_0x1696('0xff')](/'/g,'\x5c\x27')};_0x2887a4[_0x1696('0x2e')](ejs['render'](Mustache['render'](_0x11be20,_0xdacbbd),{'proactiveActions':_0x150fe1,'alignment':_0x49f2df['alignment'],'verticalAlignment':_0x49f2df[_0x1696('0x100')],'div_color':_0x49f2df[_0x1696('0xeb')],'labelText':_0x49f2df[_0x1696('0x101')],'text_color':_0x49f2df['textColor'],'text_button_color':_0x49f2df[_0x1696('0x102')],'button_color':_0x49f2df[_0x1696('0x103')],'background_color':_0x49f2df[_0x1696('0x104')],'hideWhenOffline':_0x49f2df[_0x1696('0x105')],'interval':_0x49f2df[_0x1696('0x106')]}));})[_0x1696('0x1e')](handleError(_0x2887a4,null));};exports['addApplications']=function(_0x5a1e8d,_0x54d44f){var _0xb77264=_0x5a1e8d['params']['id'];var _0x435ead=_0x5a1e8d['body'];var _0x3747de=0xc8;var _0x565103=null;return db['sequelize'][_0x1696('0xce')]({'isolationLevel':db[_0x1696('0x107')]['Transaction'][_0x1696('0x108')][_0x1696('0x109')]},function(_0x589c8d){return db[_0x1696('0x42')][_0x1696('0x55')]({'where':{'id':_0xb77264},'transaction':_0x589c8d})['then'](function(_0x9ad613){if(_0x9ad613){return db[_0x1696('0x10a')][_0x1696('0x28')]({'where':{'ChatWebsiteId':_0xb77264},'transaction':_0x589c8d})[_0x1696('0x16')](function(){var _0x28ab2f=_[_0x1696('0x3f')](_0x435ead,function(_0x1a75e1){_0x1a75e1[_0x1696('0x54')]=_0xb77264;return _0x1a75e1;});return db[_0x1696('0x10a')][_0x1696('0xd0')](_0x28ab2f,{'transaction':_0x589c8d});});}else{_0x3747de=0x194;_0x565103=[];}});})[_0x1696('0x16')](function(){if(_0x3747de!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0xb77264},'order':_0x1696('0x10b')})[_0x1696('0x16')](function(_0xc0bd36){_0x565103=_0xc0bd36;});}})[_0x1696('0x1e')](function(_0x574dde){_0x3747de=0x1f4;logger[_0x1696('0x19')](_0x574dde['stack']);if(_0x574dde[_0x1696('0x2d')]){delete _0x574dde['name'];}_0x565103=_0x574dde;})[_0x1696('0x10c')](function(){if(_0x565103===null){_0x54d44f[_0x1696('0x10d')](_0x3747de);}else{if(_0x3747de===0x1f4){_0x54d44f[_0x1696('0x20')](_0x3747de)[_0x1696('0x2e')](_0x565103);}else{_0x54d44f[_0x1696('0x20')](_0x3747de)[_0x1696('0x10e')](_0x565103);}}});};exports[_0x1696('0x10f')]=function(_0x566cec,_0x4774a7){var _0xe07e1b={};var _0x21d16c={};var _0x3fce5b;var _0x9555fc;return db[_0x1696('0x42')]['findOne']({'where':{'id':_0x566cec[_0x1696('0x50')]['id']}})['then'](handleEntityNotFound(_0x4774a7,null))['then'](function(_0x443e8e){if(_0x443e8e){_0x3fce5b=_0x443e8e;_0x21d16c[_0x1696('0x35')]=_[_0x1696('0x32')](db[_0x1696('0x10a')][_0x1696('0x31')]);_0x21d16c['query']=_[_0x1696('0x32')](_0x566cec[_0x1696('0x37')]);_0x21d16c['filters']=_[_0x1696('0x34')](_0x21d16c[_0x1696('0x35')],_0x21d16c[_0x1696('0x37')]);_0xe07e1b[_0x1696('0x38')]=_['intersection'](_0x21d16c['model'],qs['fields'](_0x566cec[_0x1696('0x37')]['fields']));_0xe07e1b[_0x1696('0x38')]=_0xe07e1b[_0x1696('0x38')][_0x1696('0x39')]?_0xe07e1b['attributes']:_0x21d16c[_0x1696('0x35')];_0xe07e1b['order']=qs[_0x1696('0x3b')](_0x566cec[_0x1696('0x37')][_0x1696('0x3b')]);_0xe07e1b[_0x1696('0x3c')]=qs[_0x1696('0x33')](_[_0x1696('0x3d')](_0x566cec[_0x1696('0x37')],_0x21d16c[_0x1696('0x33')]));if(_0x566cec[_0x1696('0x37')][_0x1696('0x3e')]){_0xe07e1b[_0x1696('0x3c')]=_[_0x1696('0x40')](_0xe07e1b[_0x1696('0x3c')],{'$or':_[_0x1696('0x3f')](_0xe07e1b[_0x1696('0x38')],function(_0x46e31d){var _0x821cd1={};_0x821cd1[_0x46e31d]={'$like':'%'+_0x566cec[_0x1696('0x37')][_0x1696('0x3e')]+'%'};return _0x821cd1;})});}_0xe07e1b=_[_0x1696('0x40')]({},_0xe07e1b,_0x566cec[_0x1696('0x41')]);return _0x3fce5b[_0x1696('0x10f')](_0xe07e1b);}})[_0x1696('0x16')](function(_0xdd3cdb){if(_0xdd3cdb){_0x9555fc=_0xdd3cdb[_0x1696('0x39')];if(!_0x566cec[_0x1696('0x37')][_0x1696('0x57')](_0x1696('0x5d'))){_0xe07e1b['limit']=qs[_0x1696('0x21')](_0x566cec['query']['limit']);_0xe07e1b['offset']=qs[_0x1696('0x24')](_0x566cec['query'][_0x1696('0x24')]);}return _0x3fce5b[_0x1696('0x10f')](_0xe07e1b);}})[_0x1696('0x16')](function(_0x155884){if(_0x155884){return _0x155884?{'count':_0x9555fc,'rows':_0x155884}:null;}})[_0x1696('0x16')](respondWithResult(_0x4774a7,null))[_0x1696('0x1e')](handleError(_0x4774a7,null));};exports[_0x1696('0x110')]=function(_0x596514,_0x283f02){return db[_0x1696('0x111')]['find']({'where':{'id':_0x596514[_0x1696('0x50')]['id']}})[_0x1696('0x16')](handleEntityNotFound(_0x283f02,null))['then'](function(_0x43d562){if(_0x43d562){return _0x43d562[_0x1696('0x110')](_0x596514[_0x1696('0x4f')][_0x1696('0x59')],_[_0x1696('0xe5')](_0x596514[_0x1696('0x4f')],['ids','id'])||{});}})[_0x1696('0x16')](respondWithResult(_0x283f02,null))[_0x1696('0x1e')](handleError(_0x283f02,null));};exports[_0x1696('0x112')]=function(_0xc24199,_0x4875b2){var _0x2193a1={};var _0x4c2d78={};var _0x1debc0;var _0x25848f;return db[_0x1696('0x42')][_0x1696('0x55')]({'where':{'id':_0xc24199[_0x1696('0x50')]['id']}})[_0x1696('0x16')](handleEntityNotFound(_0x4875b2,null))[_0x1696('0x16')](function(_0x30d1d5){if(_0x30d1d5){_0x1debc0=_0x30d1d5;_0x4c2d78[_0x1696('0x35')]=_[_0x1696('0x32')](db['ChatProactiveAction'][_0x1696('0x31')]);_0x4c2d78[_0x1696('0x37')]=_[_0x1696('0x32')](_0xc24199[_0x1696('0x37')]);_0x4c2d78[_0x1696('0x33')]=_[_0x1696('0x34')](_0x4c2d78['model'],_0x4c2d78[_0x1696('0x37')]);_0x2193a1[_0x1696('0x38')]=_[_0x1696('0x34')](_0x4c2d78[_0x1696('0x35')],qs[_0x1696('0x36')](_0xc24199[_0x1696('0x37')][_0x1696('0x36')]));_0x2193a1[_0x1696('0x38')]=_0x2193a1[_0x1696('0x38')][_0x1696('0x39')]?_0x2193a1[_0x1696('0x38')]:_0x4c2d78[_0x1696('0x35')];_0x2193a1[_0x1696('0x3a')]=qs[_0x1696('0x3b')](_0xc24199[_0x1696('0x37')][_0x1696('0x3b')]);_0x2193a1[_0x1696('0x3c')]=qs[_0x1696('0x33')](_[_0x1696('0x3d')](_0xc24199[_0x1696('0x37')],_0x4c2d78[_0x1696('0x33')]));if(_0xc24199['query'][_0x1696('0x3e')]){_0x2193a1[_0x1696('0x3c')]=_[_0x1696('0x40')](_0x2193a1[_0x1696('0x3c')],{'$or':_['map'](_0x2193a1['attributes'],function(_0x34494e){var _0x476e13={};_0x476e13[_0x34494e]={'$like':'%'+_0xc24199[_0x1696('0x37')][_0x1696('0x3e')]+'%'};return _0x476e13;})});}_0x2193a1=_[_0x1696('0x40')]({},_0x2193a1,_0xc24199[_0x1696('0x41')]);return _0x1debc0[_0x1696('0x112')](_0x2193a1);}})[_0x1696('0x16')](function(_0x497eeb){if(_0x497eeb){_0x25848f=_0x497eeb[_0x1696('0x39')];if(!_0xc24199[_0x1696('0x37')][_0x1696('0x57')](_0x1696('0x5d'))){_0x2193a1[_0x1696('0x21')]=qs[_0x1696('0x21')](_0xc24199[_0x1696('0x37')][_0x1696('0x21')]);_0x2193a1['offset']=qs[_0x1696('0x24')](_0xc24199[_0x1696('0x37')]['offset']);}return _0x1debc0[_0x1696('0x112')](_0x2193a1);}})['then'](function(_0x42514f){if(_0x42514f){return _0x42514f?{'count':_0x25848f,'rows':_0x42514f}:null;}})['then'](respondWithResult(_0x4875b2,null))[_0x1696('0x1e')](handleError(_0x4875b2,null));};exports[_0x1696('0x113')]=function(_0x12699d,_0x4dac48){var _0x4654c0=_0x12699d[_0x1696('0x37')]['online']==='false'?_0x1696('0x114'):_0x1696('0x115');return db[_0x1696('0x42')]['find']({'attributes':['id',_0x4654c0],'where':{'id':_0x12699d[_0x1696('0x50')]['id']}})[_0x1696('0x16')](handleEntityNotFound(_0x4dac48,null))[_0x1696('0x16')](function(_0x543439){if(_0x543439){var _0x241ff7=_0x543439[_0x4654c0];var _0x2679c9=_0x241ff7&&_0x241ff7[_0x1696('0x116')]?_0x241ff7[_0x1696('0x116')]:[];_0x4dac48[_0x1696('0x2e')]({'fromKey':_['isNil'](_0x241ff7['fromKey'])?undefined:_0x241ff7[_0x1696('0x117')],'count':_0x2679c9[_0x1696('0x39')],'rows':_0x2679c9});}})[_0x1696('0x1e')](handleError(_0x4dac48,null));};exports[_0x1696('0x118')]=function(_0x197477,_0x1261cc){var _0x597877={'raw':![],'where':{}};var _0x6fbfc3={};var _0x36b18a={'count':0x0,'rows':[]};return db[_0x1696('0x42')][_0x1696('0x55')]({'where':{'id':_0x197477[_0x1696('0x50')]['id']}})[_0x1696('0x16')](handleEntityNotFound(_0x1261cc,null))[_0x1696('0x16')](function(_0x264cfe){if(_0x264cfe){_0x6fbfc3['model']=_[_0x1696('0x32')](db[_0x1696('0xc8')][_0x1696('0x31')]);_0x6fbfc3[_0x1696('0x37')]=_['keys'](_0x197477[_0x1696('0x37')]);_0x6fbfc3['filters']=_[_0x1696('0x34')](_0x6fbfc3[_0x1696('0x35')],_0x6fbfc3[_0x1696('0x37')]);_0x597877[_0x1696('0x38')]=_[_0x1696('0x34')](_0x6fbfc3[_0x1696('0x35')],qs['fields'](_0x197477[_0x1696('0x37')]['fields']));_0x597877['attributes']=_0x597877['attributes'][_0x1696('0x39')]?_0x597877[_0x1696('0x38')]:_0x6fbfc3[_0x1696('0x35')];if(!_0x197477[_0x1696('0x37')][_0x1696('0x57')](_0x1696('0x5d'))){_0x597877[_0x1696('0x21')]=qs['limit'](_0x197477[_0x1696('0x37')][_0x1696('0x21')]);_0x597877[_0x1696('0x24')]=qs[_0x1696('0x24')](_0x197477[_0x1696('0x37')][_0x1696('0x24')]);}_0x597877[_0x1696('0x3a')]=qs[_0x1696('0x3b')](_0x197477['query']['sort']);_0x597877[_0x1696('0x3c')]=qs[_0x1696('0x33')](_[_0x1696('0x3d')](_0x197477['query'],_0x6fbfc3['filters']));_0x597877[_0x1696('0x3c')][_0x1696('0x54')]=_0x264cfe['id'];if(_0x197477['query'][_0x1696('0x3e')]){_0x597877[_0x1696('0x3c')]=_[_0x1696('0x40')](_0x597877['where'],{'$or':_['map'](_0x597877[_0x1696('0x38')],function(_0x16bbfc){var _0x4a8b61={};_0x4a8b61[_0x16bbfc]={'$like':'%'+_0x197477[_0x1696('0x37')][_0x1696('0x3e')]+'%'};return _0x4a8b61;})});}_0x597877=_[_0x1696('0x40')]({},_0x597877,_0x197477['options']);return db[_0x1696('0xc8')][_0x1696('0x23')]({'where':_0x597877[_0x1696('0x3c')]})[_0x1696('0x16')](function(_0x2044b8){_0x36b18a[_0x1696('0x23')]=_0x2044b8;if(_0x197477[_0x1696('0x37')][_0x1696('0x43')]){_0x597877[_0x1696('0x44')]=[{'all':!![]}];}else{_0x597877[_0x1696('0x44')]=[{'model':db[_0x1696('0x81')],'as':_0x1696('0xe6'),'required':![]},{'model':db[_0x1696('0xcf')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x597877);})[_0x1696('0x16')](function(_0x56e830){_0x36b18a['rows']=_0x56e830;return _0x36b18a;});}})['then'](respondWithFilteredResult(_0x1261cc,_0x597877))['catch'](handleError(_0x1261cc,null));};exports[_0x1696('0x119')]=function(_0xb45f11,_0x43870e){return db[_0x1696('0x42')]['find']({'where':{'id':_0xb45f11['params']['id']}})[_0x1696('0x16')](handleEntityNotFound(_0x43870e,null))[_0x1696('0x16')](function(_0x3ca6d7){if(_0x3ca6d7){return _0x3ca6d7['addAgents'](_0xb45f11[_0x1696('0x4f')][_0x1696('0x59')],_[_0x1696('0xe5')](_0xb45f11[_0x1696('0x4f')],[_0x1696('0x59'),'id'])||{})['spread'](function(_0x1a9608){for(var _0x320cd1=0x0;_0x320cd1<_0xb45f11[_0x1696('0x4f')][_0x1696('0x59')][_0x1696('0x39')];_0x320cd1+=0x1){socket[_0x1696('0x11a')](_0x1696('0x11b'),{'UserId':Number(_0xb45f11[_0x1696('0x4f')]['ids'][_0x320cd1]),'ChatWebsiteId':Number(_0xb45f11['params']['id'])});}return _0x1a9608;});}})[_0x1696('0x16')](respondWithResult(_0x43870e,null))[_0x1696('0x1e')](handleError(_0x43870e,null));};exports[_0x1696('0x11c')]=function(_0x4bcc35,_0x553289){return db[_0x1696('0x42')][_0x1696('0x47')]({'where':{'id':_0x4bcc35[_0x1696('0x50')]['id']}})[_0x1696('0x16')](handleEntityNotFound(_0x553289,null))[_0x1696('0x16')](function(_0x3219b5){if(_0x3219b5){return _0x3219b5[_0x1696('0x11c')](_0x4bcc35['query']['ids'])['then'](function(){if(_[_0x1696('0x11d')](_0x4bcc35[_0x1696('0x37')][_0x1696('0x59')])){for(var _0x1b87c0=0x0;_0x1b87c0<_0x4bcc35[_0x1696('0x37')]['ids'][_0x1696('0x39')];_0x1b87c0+=0x1){socket[_0x1696('0x11a')](_0x1696('0x11e'),{'UserId':Number(_0x4bcc35['query']['ids'][_0x1b87c0]),'ChatWebsiteId':Number(_0x4bcc35[_0x1696('0x50')]['id'])});}}else{socket[_0x1696('0x11a')]('userChatWebsite:remove',{'UserId':Number(_0x4bcc35[_0x1696('0x37')][_0x1696('0x59')]),'ChatWebsiteId':Number(_0x4bcc35[_0x1696('0x50')]['id'])});}});}})[_0x1696('0x16')](respondWithStatusCode(_0x553289,null))[_0x1696('0x1e')](handleError(_0x553289,null));};exports[_0x1696('0x11f')]=function(_0x6be1f7,_0x5b7109){var _0x27de75={};var _0x2df2ce={};var _0x475017;var _0x1de0c3;return db['ChatWebsite'][_0x1696('0x55')]({'where':{'id':_0x6be1f7[_0x1696('0x50')]['id']}})['then'](handleEntityNotFound(_0x5b7109,null))[_0x1696('0x16')](function(_0x5c47c6){if(_0x5c47c6){_0x475017=_0x5c47c6;_0x2df2ce[_0x1696('0x35')]=_['keys'](db['User'][_0x1696('0x31')]);_0x2df2ce['query']=_[_0x1696('0x32')](_0x6be1f7[_0x1696('0x37')]);_0x2df2ce[_0x1696('0x33')]=_[_0x1696('0x34')](_0x2df2ce[_0x1696('0x35')],_0x2df2ce['query']);_0x27de75['attributes']=_['intersection'](_0x2df2ce[_0x1696('0x35')],qs[_0x1696('0x36')](_0x6be1f7[_0x1696('0x37')][_0x1696('0x36')]));_0x27de75[_0x1696('0x38')]=_0x27de75[_0x1696('0x38')][_0x1696('0x39')]?_0x27de75[_0x1696('0x38')]:_0x2df2ce[_0x1696('0x35')];_0x27de75[_0x1696('0x3a')]=qs[_0x1696('0x3b')](_0x6be1f7[_0x1696('0x37')][_0x1696('0x3b')]);_0x27de75[_0x1696('0x3c')]=qs['filters'](_[_0x1696('0x3d')](_0x6be1f7[_0x1696('0x37')],_0x2df2ce[_0x1696('0x33')]));if(_0x6be1f7[_0x1696('0x37')]['filter']){_0x27de75[_0x1696('0x3c')]=_[_0x1696('0x40')](_0x27de75[_0x1696('0x3c')],{'$or':_[_0x1696('0x3f')](_0x27de75[_0x1696('0x38')],function(_0xb40940){var _0x17b092={};_0x17b092[_0xb40940]={'$like':'%'+_0x6be1f7[_0x1696('0x37')][_0x1696('0x3e')]+'%'};return _0x17b092;})});}_0x27de75=_[_0x1696('0x40')]({},_0x27de75,_0x6be1f7[_0x1696('0x41')]);return _0x475017[_0x1696('0x11f')](_0x27de75);}})[_0x1696('0x16')](function(_0x9867e4){if(_0x9867e4){_0x1de0c3=_0x9867e4[_0x1696('0x39')];if(!_0x6be1f7[_0x1696('0x37')][_0x1696('0x57')](_0x1696('0x5d'))){_0x27de75[_0x1696('0x21')]=qs[_0x1696('0x21')](_0x6be1f7['query'][_0x1696('0x21')]);_0x27de75[_0x1696('0x24')]=qs[_0x1696('0x24')](_0x6be1f7[_0x1696('0x37')][_0x1696('0x24')]);}return _0x475017[_0x1696('0x11f')](_0x27de75);}})[_0x1696('0x16')](function(_0x49eae6){if(_0x49eae6){return _0x49eae6?{'count':_0x1de0c3,'rows':_0x49eae6}:null;}})[_0x1696('0x16')](respondWithResult(_0x5b7109,null))[_0x1696('0x1e')](handleError(_0x5b7109,null));};
\ No newline at end of file
index e9337c2..4976b0a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb138=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatWebsite'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0xb138,0x1dd));var _0x8b13=function(_0x24c465,_0x5599d3){_0x24c465=_0x24c465-0x0;var _0x3705cb=_0xb138[_0x24c465];return _0x3705cb;};'use strict';var EventEmitter=require(_0x8b13('0x0'));var ChatWebsite=require(_0x8b13('0x1'))['db'][_0x8b13('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8b13('0x3')](0x0);var events={'afterCreate':_0x8b13('0x4'),'afterUpdate':_0x8b13('0x5'),'afterDestroy':_0x8b13('0x6')};function emitEvent(_0x5369d4){return function(_0x4411a0,_0x241acb,_0x3af81a){ChatWebsiteEvents['emit'](_0x5369d4+':'+_0x4411a0['id'],_0x4411a0);ChatWebsiteEvents[_0x8b13('0x7')](_0x5369d4,_0x4411a0);_0x3af81a(null);};}for(var e in events){if(events[_0x8b13('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x8b13('0x9')]=ChatWebsiteEvents;
\ No newline at end of file
+var _0xee24=['save','update','remove','emit','hook','exports','../../mysqldb','ChatWebsite'];(function(_0x3cc2f6,_0xdba6a7){var _0x5bf1be=function(_0x5b9c83){while(--_0x5b9c83){_0x3cc2f6['push'](_0x3cc2f6['shift']());}};_0x5bf1be(++_0xdba6a7);}(_0xee24,0x1a6));var _0x4ee2=function(_0x3b234d,_0x249d15){_0x3b234d=_0x3b234d-0x0;var _0x47788c=_0xee24[_0x3b234d];return _0x47788c;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x4ee2('0x0'))['db'][_0x4ee2('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4ee2('0x2'),'afterUpdate':_0x4ee2('0x3'),'afterDestroy':_0x4ee2('0x4')};function emitEvent(_0x34b373){return function(_0x5546e1,_0x1aee89,_0x179bfa){ChatWebsiteEvents[_0x4ee2('0x5')](_0x34b373+':'+_0x5546e1['id'],_0x5546e1);ChatWebsiteEvents[_0x4ee2('0x5')](_0x34b373,_0x5546e1);_0x179bfa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x4ee2('0x6')](e,emitEvent(event));}}module[_0x4ee2('0x7')]=ChatWebsiteEvents;
\ No newline at end of file
index 06b58ac..0005103 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcbd6=['./chatWebsite.attributes','exports','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x207114,_0x25902e){var _0x14d3b4=function(_0x4f8fe3){while(--_0x4f8fe3){_0x207114['push'](_0x207114['shift']());}};_0x14d3b4(++_0x25902e);}(_0xcbd6,0xad));var _0x6cbd=function(_0x57a895,_0x1152cf){_0x57a895=_0x57a895-0x0;var _0xc2b0bc=_0xcbd6[_0x57a895];return _0xc2b0bc;};'use strict';var _=require(_0x6cbd('0x0'));var util=require(_0x6cbd('0x1'));var logger=require(_0x6cbd('0x2'))(_0x6cbd('0x3'));var moment=require(_0x6cbd('0x4'));var BPromise=require(_0x6cbd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6cbd('0x6'));var config=require('../../config/environment');var attributes=require(_0x6cbd('0x7'));module[_0x6cbd('0x8')]=function(_0x5f539a,_0x7ef0c5){return _0x5f539a['define']('ChatWebsite',attributes,{'tableName':_0x6cbd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x3ce7=['path','rimraf','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x88a324,_0x49d221){var _0x3585f5=function(_0x321ab8){while(--_0x321ab8){_0x88a324['push'](_0x88a324['shift']());}};_0x3585f5(++_0x49d221);}(_0x3ce7,0xd2));var _0x73ce=function(_0xb5f5ab,_0x228d71){_0xb5f5ab=_0xb5f5ab-0x0;var _0x4f465e=_0x3ce7[_0xb5f5ab];return _0x4f465e;};'use strict';var _=require(_0x73ce('0x0'));var util=require(_0x73ce('0x1'));var logger=require(_0x73ce('0x2'))(_0x73ce('0x3'));var moment=require(_0x73ce('0x4'));var BPromise=require('bluebird');var rp=require(_0x73ce('0x5'));var fs=require('fs');var path=require(_0x73ce('0x6'));var rimraf=require(_0x73ce('0x7'));var config=require('../../config/environment');var attributes=require(_0x73ce('0x8'));module[_0x73ce('0x9')]=function(_0x353b0d,_0x548c94){return _0x353b0d['define'](_0x73ce('0xa'),attributes,{'tableName':_0x73ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2e1fc99..6b8b96f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe7c6=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x39994f,_0x489c28){var _0x1ee62c=function(_0xdb96ac){while(--_0xdb96ac){_0x39994f['push'](_0x39994f['shift']());}};_0x1ee62c(++_0x489c28);}(_0xe7c6,0x8e));var _0x6e7c=function(_0x20b96d,_0x496538){_0x20b96d=_0x20b96d-0x0;var _0x31f267=_0xe7c6[_0x20b96d];return _0x31f267;};'use strict';var _=require(_0x6e7c('0x0'));var util=require(_0x6e7c('0x1'));var moment=require(_0x6e7c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e7c('0x3'));var fs=require('fs');var Redis=require(_0x6e7c('0x4'));var db=require(_0x6e7c('0x5'))['db'];var utils=require(_0x6e7c('0x6'));var logger=require('../../config/logger')(_0x6e7c('0x7'));var config=require(_0x6e7c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6e7c('0x9')]({'port':0x232a});config[_0x6e7c('0xa')]=_[_0x6e7c('0xb')](config[_0x6e7c('0xa')],{'host':_0x6e7c('0xc'),'port':0x18eb});var socket=require(_0x6e7c('0xd'))(new Redis(config[_0x6e7c('0xa')]));require(_0x6e7c('0xe'))[_0x6e7c('0xf')](socket);function respondWithRpcPromise(_0x1fba91,_0x18aa99,_0x459386){return new BPromise(function(_0x4005f4,_0x10854a){return client['request'](_0x1fba91,_0x459386)[_0x6e7c('0x10')](function(_0x4eda75){logger[_0x6e7c('0x11')](_0x6e7c('0x12'),_0x18aa99,_0x6e7c('0x13'));logger[_0x6e7c('0x14')](_0x6e7c('0x15'),_0x18aa99,_0x6e7c('0x13'),JSON[_0x6e7c('0x16')](_0x4eda75));if(_0x4eda75[_0x6e7c('0x17')]){if(_0x4eda75[_0x6e7c('0x17')][_0x6e7c('0x18')]===0x1f4){logger[_0x6e7c('0x17')](_0x6e7c('0x12'),_0x18aa99,_0x4eda75['error'][_0x6e7c('0x19')]);return _0x10854a(_0x4eda75[_0x6e7c('0x17')][_0x6e7c('0x19')]);}logger[_0x6e7c('0x17')](_0x6e7c('0x12'),_0x18aa99,_0x4eda75['error'][_0x6e7c('0x19')]);return _0x4005f4(_0x4eda75[_0x6e7c('0x17')][_0x6e7c('0x19')]);}else{logger[_0x6e7c('0x11')](_0x6e7c('0x12'),_0x18aa99,_0x6e7c('0x13'));_0x4005f4(_0x4eda75[_0x6e7c('0x1a')]['message']);}})[_0x6e7c('0x1b')](function(_0xfac6e0){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x18aa99,_0xfac6e0);_0x10854a(_0xfac6e0);});});}
\ No newline at end of file
+var _0xcba0=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result'];(function(_0x40bfc2,_0x538e26){var _0x14d1db=function(_0x3c46bc){while(--_0x3c46bc){_0x40bfc2['push'](_0x40bfc2['shift']());}};_0x14d1db(++_0x538e26);}(_0xcba0,0x169));var _0x0cba=function(_0x3fcada,_0x2cbc92){_0x3fcada=_0x3fcada-0x0;var _0x35938c=_0xcba0[_0x3fcada];return _0x35938c;};'use strict';var _=require(_0x0cba('0x0'));var util=require(_0x0cba('0x1'));var moment=require(_0x0cba('0x2'));var BPromise=require('bluebird');var rs=require(_0x0cba('0x3'));var fs=require('fs');var Redis=require(_0x0cba('0x4'));var db=require(_0x0cba('0x5'))['db'];var utils=require(_0x0cba('0x6'));var logger=require(_0x0cba('0x7'))(_0x0cba('0x8'));var config=require(_0x0cba('0x9'));var jayson=require(_0x0cba('0xa'));var client=jayson[_0x0cba('0xb')]['http']({'port':0x232a});config[_0x0cba('0xc')]=_[_0x0cba('0xd')](config[_0x0cba('0xc')],{'host':_0x0cba('0xe'),'port':0x18eb});var socket=require(_0x0cba('0xf'))(new Redis(config[_0x0cba('0xc')]));require(_0x0cba('0x10'))['register'](socket);function respondWithRpcPromise(_0x542963,_0x472473,_0x150b85){return new BPromise(function(_0x528f7c,_0x346eda){return client[_0x0cba('0x11')](_0x542963,_0x150b85)[_0x0cba('0x12')](function(_0xf39aee){logger[_0x0cba('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x472473,_0x0cba('0x14'));logger[_0x0cba('0x15')](_0x0cba('0x16'),_0x472473,'request\x20sent',JSON[_0x0cba('0x17')](_0xf39aee));if(_0xf39aee[_0x0cba('0x18')]){if(_0xf39aee[_0x0cba('0x18')][_0x0cba('0x19')]===0x1f4){logger[_0x0cba('0x18')](_0x0cba('0x1a'),_0x472473,_0xf39aee[_0x0cba('0x18')]['message']);return _0x346eda(_0xf39aee[_0x0cba('0x18')][_0x0cba('0x1b')]);}logger[_0x0cba('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x472473,_0xf39aee['error'][_0x0cba('0x1b')]);return _0x528f7c(_0xf39aee['error'][_0x0cba('0x1b')]);}else{logger[_0x0cba('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x472473,_0x0cba('0x14'));_0x528f7c(_0xf39aee[_0x0cba('0x1c')][_0x0cba('0x1b')]);}})[_0x0cba('0x1d')](function(_0x9a1153){logger[_0x0cba('0x18')](_0x0cba('0x1a'),_0x472473,_0x9a1153);_0x346eda(_0x9a1153);});});}
\ No newline at end of file
index 1f9f760..3dc3317 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x886b=['update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','remove'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x886b,0xde));var _0xb886=function(_0x1311fe,_0x26f3af){_0x1311fe=_0x1311fe-0x0;var _0x3845c4=_0x886b[_0x1311fe];return _0x3845c4;};'use strict';var ChatWebsiteEvents=require(_0xb886('0x0'));var events=['save',_0xb886('0x1'),_0xb886('0x2')];function createListener(_0x1a4d56,_0x46d7b3){return function(_0x171cdd){_0x46d7b3[_0xb886('0x3')](_0x1a4d56,_0x171cdd);};}function removeListener(_0x104f28,_0x281cd8){return function(){ChatWebsiteEvents[_0xb886('0x4')](_0x104f28,_0x281cd8);};}exports[_0xb886('0x5')]=function(_0x20a0d1){for(var _0x1ebbbf=0x0,_0x4a1a13=events[_0xb886('0x6')];_0x1ebbbf<_0x4a1a13;_0x1ebbbf++){var _0x449fad=events[_0x1ebbbf];var _0x29e98f=createListener(_0xb886('0x7')+_0x449fad,_0x20a0d1);ChatWebsiteEvents['on'](_0x449fad,_0x29e98f);}};
\ No newline at end of file
+var _0xf08e=['emit','register','length','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf08e,0x1ac));var _0xef08=function(_0x2c185a,_0x23e02d){_0x2c185a=_0x2c185a-0x0;var _0x3d919=_0xf08e[_0x2c185a];return _0x3d919;};'use strict';var ChatWebsiteEvents=require(_0xef08('0x0'));var events=[_0xef08('0x1'),_0xef08('0x2'),_0xef08('0x3')];function createListener(_0x5b0f2d,_0x5eda4d){return function(_0x9d3f4f){_0x5eda4d[_0xef08('0x4')](_0x5b0f2d,_0x9d3f4f);};}function removeListener(_0x186672,_0x4177f7){return function(){ChatWebsiteEvents['removeListener'](_0x186672,_0x4177f7);};}exports[_0xef08('0x5')]=function(_0x780ae9){for(var _0x30b47f=0x0,_0x29bb68=events[_0xef08('0x6')];_0x30b47f<_0x29bb68;_0x30b47f++){var _0x502ae5=events[_0x30b47f];var _0x4d7605=createListener(_0xef08('0x7')+_0x502ae5,_0x780ae9);ChatWebsiteEvents['on'](_0x502ae5,_0x4d7605);}};
\ No newline at end of file
index ee77245..c0eb350 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2554=['getAvatar','/:id/customer_avatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getFields','/:id/offline_messages','/:id/users','post','create','addDisposition','/:id/canned_answers','addAnswer','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','diskStorage','server/files/images/avatars/','addAvatar','addCustomerAvatar','/:id/system_avatar','/:id/notify','notify','server/files','ensureDir','replace','extname','/:id/offline','any','/:id/interactions','addApplications','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2554,0xf4));var _0x4255=function(_0x1106c4,_0x219ffd){_0x1106c4=_0x1106c4-0x0;var _0x1c07b1=_0x2554[_0x1106c4];return _0x1c07b1;};'use strict';var multer=require(_0x4255('0x0'));var util=require('util');var path=require(_0x4255('0x1'));var timeout=require('connect-timeout');var express=require(_0x4255('0x2'));var router=express[_0x4255('0x3')]();var fs_extra=require(_0x4255('0x4'));var auth=require(_0x4255('0x5'));var interaction=require(_0x4255('0x6'));var config=require(_0x4255('0x7'));var controller=require(_0x4255('0x8'));router[_0x4255('0x9')]('/',auth[_0x4255('0xa')](),controller[_0x4255('0xb')]);router[_0x4255('0x9')]('/describe',auth[_0x4255('0xa')](),controller['describe']);router[_0x4255('0x9')](_0x4255('0xc'),auth[_0x4255('0xa')](),controller[_0x4255('0xd')]);router[_0x4255('0x9')](_0x4255('0xe'),auth[_0x4255('0xa')](),controller[_0x4255('0xf')]);router[_0x4255('0x9')]('/:id/canned_answers',auth[_0x4255('0xa')](),controller[_0x4255('0x10')]);router[_0x4255('0x9')](_0x4255('0x11'),controller[_0x4255('0x12')]);router[_0x4255('0x9')](_0x4255('0x13'),controller[_0x4255('0x14')]);router[_0x4255('0x9')](_0x4255('0x15'),controller['getCustomerAvatar']);router[_0x4255('0x9')]('/:id/system_avatar',controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0x4255('0xa')](),controller[_0x4255('0x16')]);router[_0x4255('0x9')](_0x4255('0x17'),controller[_0x4255('0x18')]);router[_0x4255('0x9')](_0x4255('0x19'),auth[_0x4255('0xa')](),controller[_0x4255('0x1a')]);router['get']('/:id/proactive_actions',auth[_0x4255('0xa')](),controller['getProactiveActions']);router[_0x4255('0x9')]('/:id/fields',controller[_0x4255('0x1b')]);router[_0x4255('0x9')](_0x4255('0x1c'),auth[_0x4255('0xa')](),controller['getOfflineMessages']);router[_0x4255('0x9')](_0x4255('0x1d'),auth[_0x4255('0xa')](),controller['getAgents']);router[_0x4255('0x1e')]('/',auth['isAuthenticated'](),controller[_0x4255('0x1f')]);router['post'](_0x4255('0xe'),auth['isAuthenticated'](),controller[_0x4255('0x20')]);router['post'](_0x4255('0x21'),auth[_0x4255('0xa')](),controller[_0x4255('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x42abcf,_0xc9f8f5,_0x45fe80){_0x45fe80(null,path[_0x4255('0x23')](config[_0x4255('0x24')],_0x4255('0x25')));},'filename':function(_0x5b8c65,_0xf9c20e,_0x4d560d){_0x4d560d(null,util[_0x4255('0x26')](_0x4255('0x27'),Date[_0x4255('0x28')](),_0xf9c20e[_0x4255('0x29')]));}})});router[_0x4255('0x1e')](_0x4255('0x11'),upload[_0x4255('0x2a')](_0x4255('0x2b')),controller['addLogo']);var upload=multer({'storage':multer[_0x4255('0x2c')]({'destination':function(_0x52e682,_0x28c895,_0x54e91f){_0x54e91f(null,path[_0x4255('0x23')](config[_0x4255('0x24')],_0x4255('0x2d')));},'filename':function(_0x1a3baa,_0x2dd083,_0x1f490a){_0x1f490a(null,util['format'](_0x4255('0x27'),Date[_0x4255('0x28')](),_0x2dd083['originalname']));}})});router['post'](_0x4255('0x13'),upload['single'](_0x4255('0x2b')),controller[_0x4255('0x2e')]);var upload=multer({'storage':multer[_0x4255('0x2c')]({'destination':function(_0x2ab2d6,_0x4cc9ad,_0x1650de){_0x1650de(null,path[_0x4255('0x23')](config['root'],_0x4255('0x2d')));},'filename':function(_0x32550c,_0x5c9514,_0x5f3053){_0x5f3053(null,util[_0x4255('0x26')]('%s-%s',Date[_0x4255('0x28')](),_0x5c9514[_0x4255('0x29')]));}})});router[_0x4255('0x1e')](_0x4255('0x15'),upload[_0x4255('0x2a')](_0x4255('0x2b')),controller[_0x4255('0x2f')]);var upload=multer({'storage':multer[_0x4255('0x2c')]({'destination':function(_0x586115,_0x36b600,_0x52ba36){_0x52ba36(null,path[_0x4255('0x23')](config['root'],_0x4255('0x2d')));},'filename':function(_0x314486,_0x52733e,_0x17c2a6){_0x17c2a6(null,util[_0x4255('0x26')](_0x4255('0x27'),Date['now'](),_0x52733e[_0x4255('0x29')]));}})});router['post'](_0x4255('0x30'),upload['single']('file'),controller['addSystemAvatar']);router['post'](_0x4255('0x31'),controller[_0x4255('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0x4255('0x2c')]({'destination':function(_0x52af0d,_0xd0bcc4,_0x13bd0a){const _0x365783=path[_0x4255('0x23')](config[_0x4255('0x24')],_0x4255('0x33'),'attachments','offline-chat');fs_extra[_0x4255('0x34')](_0x365783,function(){_0x13bd0a(null,_0x365783);});},'filename':function(_0xb3bce4,_0x10dccf,_0x3962a5){const _0x1170a0=_0x10dccf[_0x4255('0x29')][_0x4255('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x231275=path[_0x4255('0x36')](_0x1170a0);const _0x4d21cc=Date[_0x4255('0x28')]()+'-'+_0x1170a0['replace'](_0x231275,'')+_0x231275;_0x3962a5(null,_0x4d21cc);}})});router[_0x4255('0x1e')](_0x4255('0x37'),offlineUploadMulter[_0x4255('0x38')](),controller['offline']);router['post'](_0x4255('0x39'),auth[_0x4255('0xa')](),controller['addInteraction']);router[_0x4255('0x1e')](_0x4255('0x19'),auth[_0x4255('0xa')](),controller[_0x4255('0x3a')]);router[_0x4255('0x1e')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x4255('0x1e')]('/:id/users',auth[_0x4255('0xa')](),controller[_0x4255('0x3b')]);router[_0x4255('0x3c')](_0x4255('0xc'),auth['isAuthenticated'](),controller[_0x4255('0x3d')]);router[_0x4255('0x3e')](_0x4255('0xc'),auth[_0x4255('0xa')](),controller[_0x4255('0x3f')]);router[_0x4255('0x3e')](_0x4255('0xe'),auth['isAuthenticated'](),controller[_0x4255('0x40')]);router[_0x4255('0x3e')](_0x4255('0x21'),auth[_0x4255('0xa')](),controller['removeAnswers']);router[_0x4255('0x3e')](_0x4255('0x1d'),auth[_0x4255('0xa')](),controller['removeAgents']);module[_0x4255('0x41')]=router;
\ No newline at end of file
+var _0x0df4=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','now','originalname','file','server/files/images/avatars/','format','single','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addAgents','/:id','delete','destroy','removeAnswers','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0df4,0x80));var _0x40df=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x0df4[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x40df('0x0'));var util=require('util');var path=require(_0x40df('0x1'));var timeout=require(_0x40df('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x40df('0x3'));var interaction=require(_0x40df('0x4'));var config=require(_0x40df('0x5'));var controller=require(_0x40df('0x6'));router[_0x40df('0x7')]('/',auth['isAuthenticated'](),controller[_0x40df('0x8')]);router[_0x40df('0x7')](_0x40df('0x9'),auth[_0x40df('0xa')](),controller[_0x40df('0xb')]);router[_0x40df('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x40df('0xc')]);router[_0x40df('0x7')](_0x40df('0xd'),auth[_0x40df('0xa')](),controller[_0x40df('0xe')]);router['get'](_0x40df('0xf'),auth['isAuthenticated'](),controller[_0x40df('0x10')]);router['get'](_0x40df('0x11'),controller[_0x40df('0x12')]);router[_0x40df('0x7')](_0x40df('0x13'),controller['getAvatar']);router[_0x40df('0x7')](_0x40df('0x14'),controller['getCustomerAvatar']);router['get'](_0x40df('0x15'),controller['getSystemAvatar']);router[_0x40df('0x7')](_0x40df('0x16'),auth[_0x40df('0xa')](),controller[_0x40df('0x17')]);router[_0x40df('0x7')](_0x40df('0x18'),controller[_0x40df('0x19')]);router[_0x40df('0x7')](_0x40df('0x1a'),auth[_0x40df('0xa')](),controller[_0x40df('0x1b')]);router[_0x40df('0x7')](_0x40df('0x1c'),auth['isAuthenticated'](),controller[_0x40df('0x1d')]);router[_0x40df('0x7')]('/:id/fields',controller[_0x40df('0x1e')]);router['get']('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x40df('0x1f')]);router[_0x40df('0x7')](_0x40df('0x20'),auth[_0x40df('0xa')](),controller[_0x40df('0x21')]);router[_0x40df('0x22')]('/',auth[_0x40df('0xa')](),controller[_0x40df('0x23')]);router['post'](_0x40df('0xd'),auth['isAuthenticated'](),controller[_0x40df('0x24')]);router[_0x40df('0x22')](_0x40df('0xf'),auth[_0x40df('0xa')](),controller[_0x40df('0x25')]);var upload=multer({'storage':multer[_0x40df('0x26')]({'destination':function(_0x3bc5cf,_0x371f24,_0x2077c4){_0x2077c4(null,path[_0x40df('0x27')](config[_0x40df('0x28')],_0x40df('0x29')));},'filename':function(_0x5c17d5,_0x934c7f,_0x7ceab2){_0x7ceab2(null,util['format'](_0x40df('0x2a'),Date[_0x40df('0x2b')](),_0x934c7f[_0x40df('0x2c')]));}})});router[_0x40df('0x22')](_0x40df('0x11'),upload['single'](_0x40df('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0x40df('0x26')]({'destination':function(_0x5109bf,_0x5a02ac,_0x3dcbba){_0x3dcbba(null,path['join'](config[_0x40df('0x28')],_0x40df('0x2e')));},'filename':function(_0x1d7ace,_0x58ffef,_0x46e0c8){_0x46e0c8(null,util[_0x40df('0x2f')](_0x40df('0x2a'),Date[_0x40df('0x2b')](),_0x58ffef[_0x40df('0x2c')]));}})});router[_0x40df('0x22')](_0x40df('0x13'),upload[_0x40df('0x30')](_0x40df('0x2d')),controller[_0x40df('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x12cb0d,_0x2e4fba,_0x33f907){_0x33f907(null,path[_0x40df('0x27')](config[_0x40df('0x28')],_0x40df('0x2e')));},'filename':function(_0x57756e,_0x5ac909,_0x360bf8){_0x360bf8(null,util[_0x40df('0x2f')]('%s-%s',Date[_0x40df('0x2b')](),_0x5ac909['originalname']));}})});router['post']('/:id/customer_avatar',upload[_0x40df('0x30')](_0x40df('0x2d')),controller[_0x40df('0x32')]);var upload=multer({'storage':multer[_0x40df('0x26')]({'destination':function(_0x5a6fe3,_0x20ad9c,_0x58c748){_0x58c748(null,path[_0x40df('0x27')](config[_0x40df('0x28')],_0x40df('0x2e')));},'filename':function(_0x2602a0,_0x4a2207,_0x1ebdc7){_0x1ebdc7(null,util[_0x40df('0x2f')](_0x40df('0x2a'),Date[_0x40df('0x2b')](),_0x4a2207[_0x40df('0x2c')]));}})});router['post'](_0x40df('0x15'),upload['single'](_0x40df('0x2d')),controller[_0x40df('0x33')]);router['post'](_0x40df('0x34'),controller[_0x40df('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x61b09c,_0xfa38cb,_0x548bbb){const _0x24303e=path[_0x40df('0x27')](config[_0x40df('0x28')],_0x40df('0x36'),_0x40df('0x37'),_0x40df('0x38'));fs_extra[_0x40df('0x39')](_0x24303e,function(){_0x548bbb(null,_0x24303e);});},'filename':function(_0x3eefe1,_0x260d7d,_0x4de6fa){const _0x1edd4e=_0x260d7d[_0x40df('0x2c')][_0x40df('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x477164=path[_0x40df('0x3b')](_0x1edd4e);const _0x2324b8=Date[_0x40df('0x2b')]()+'-'+_0x1edd4e[_0x40df('0x3a')](_0x477164,'')+_0x477164;_0x4de6fa(null,_0x2324b8);}})});router['post'](_0x40df('0x3c'),offlineUploadMulter[_0x40df('0x3d')](),controller[_0x40df('0x3e')]);router[_0x40df('0x22')](_0x40df('0x16'),auth['isAuthenticated'](),controller[_0x40df('0x3f')]);router[_0x40df('0x22')](_0x40df('0x1a'),auth[_0x40df('0xa')](),controller['addApplications']);router[_0x40df('0x22')](_0x40df('0x1c'),auth[_0x40df('0xa')](),controller['addProactiveActions']);router[_0x40df('0x22')](_0x40df('0x20'),auth[_0x40df('0xa')](),controller[_0x40df('0x40')]);router['put'](_0x40df('0x41'),auth['isAuthenticated'](),controller['update']);router[_0x40df('0x42')](_0x40df('0x41'),auth[_0x40df('0xa')](),controller[_0x40df('0x43')]);router[_0x40df('0x42')](_0x40df('0xd'),auth[_0x40df('0xa')](),controller['removeDispositions']);router[_0x40df('0x42')](_0x40df('0xf'),auth['isAuthenticated'](),controller[_0x40df('0x44')]);router[_0x40df('0x42')](_0x40df('0x20'),auth[_0x40df('0xa')](),controller['removeAgents']);module[_0x40df('0x45')]=router;
\ No newline at end of file
index b0ac686..4df4046 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa37c=['production','app','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','exports','beaver-logger/server','../config/environment','Router'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa37c,0x76));var _0xca37=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0xa37c[_0x151721];return _0x2deaa7;};var beaverLogger=require(_0xca37('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0xca37('0x1'));var router=express[_0xca37('0x2')]();var isProduction=config['env']===_0xca37('0x3')||![];function clientSideLogs(_0x5b78cb,_0x20f7c4,_0x312115){var _0x45e36c=_0x5b78cb[_0xca37('0x4')][_0xca37('0x5')]('client-side-logger');if(!_0x45e36c){throw new Error(_0xca37('0x6'));}return beaverLogger[_0xca37('0x7')]({'uri':_0xca37('0x8'),'logger':_0x45e36c,'enableCors':!isProduction})(_0x5b78cb,_0x20f7c4,_0x312115);}router['use'](auth[_0xca37('0x9')](),clientSideLogs);module[_0xca37('0xa')]=router;
\ No newline at end of file
+var _0xf9ae=['expressEndpoint','/client-logs','use','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x5b328a,_0x5c48bc){var _0xfcf474=function(_0x296320){while(--_0x296320){_0x5b328a['push'](_0x5b328a['shift']());}};_0xfcf474(++_0x5c48bc);}(_0xf9ae,0xe5));var _0xef9a=function(_0x2e7993,_0x507942){_0x2e7993=_0x2e7993-0x0;var _0x4cf86c=_0xf9ae[_0x2e7993];return _0x4cf86c;};var beaverLogger=require(_0xef9a('0x0'));var express=require(_0xef9a('0x1'));var auth=require(_0xef9a('0x2'));var config=require(_0xef9a('0x3'));var router=express[_0xef9a('0x4')]();var isProduction=config[_0xef9a('0x5')]===_0xef9a('0x6')||![];function clientSideLogs(_0x79c0b5,_0x2ba302,_0x3632a5){var _0x2dc32c=_0x79c0b5[_0xef9a('0x7')][_0xef9a('0x8')](_0xef9a('0x9'));if(!_0x2dc32c){throw new Error(_0xef9a('0xa'));}return beaverLogger[_0xef9a('0xb')]({'uri':_0xef9a('0xc'),'logger':_0x2dc32c,'enableCors':!isProduction})(_0x79c0b5,_0x2ba302,_0x3632a5);}router[_0xef9a('0xd')](auth['isAuthenticated'](),clientSideLogs);module[_0xef9a('0xe')]=router;
\ No newline at end of file
index 4e127ad..24ada1e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x81cb=['MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','STRING','ENUM','AmazonAWS','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant'];(function(_0x2b9e76,_0x467e25){var _0x4c014e=function(_0x165284){while(--_0x165284){_0x2b9e76['push'](_0x2b9e76['shift']());}};_0x4c014e(++_0x467e25);}(_0x81cb,0xe8));var _0xb81c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x81cb[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xb81c('0x0'));module['exports']={'name':{'type':Sequelize[_0xb81c('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb81c('0x2')](_0xb81c('0x3'),_0xb81c('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xb81c('0x5'),_0xb81c('0x6'))},'data1':{'type':Sequelize[_0xb81c('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xb81c('0x1')],'comment':_0xb81c('0x7')},'data3':{'type':Sequelize[_0xb81c('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xb81c('0x1')],'comment':_0xb81c('0x8')},'data5':{'type':Sequelize['TEXT'],'comment':_0xb81c('0x9')},'data6':{'type':Sequelize[_0xb81c('0xa')],'comment':_0xb81c('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}};
\ No newline at end of file
+var _0xd8ba=['STRING','ENUM','AmazonAWS','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd8ba,0x1be));var _0xad8b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd8ba[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xad8b('0x0'));module[_0xad8b('0x1')]={'name':{'type':Sequelize[_0xad8b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xad8b('0x3')](_0xad8b('0x4'),_0xad8b('0x5'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xad8b('0x3')](_0xad8b('0x6'),_0xad8b('0x7'))},'data1':{'type':Sequelize[_0xad8b('0x2')],'comment':_0xad8b('0x8')},'data2':{'type':Sequelize[_0xad8b('0x2')],'comment':_0xad8b('0x9')},'data3':{'type':Sequelize[_0xad8b('0x2')],'comment':_0xad8b('0xa')},'data4':{'type':Sequelize[_0xad8b('0x2')],'comment':_0xad8b('0xb')},'data5':{'type':Sequelize['TEXT'],'comment':_0xad8b('0xc')},'data6':{'type':Sequelize[_0xad8b('0xd')],'comment':_0xad8b('0xe')},'data7':{'type':Sequelize[_0xad8b('0xd')],'comment':_0xad8b('0xf')}};
\ No newline at end of file
index e8aa0a0..f9a10cc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4469=['create','body','Name\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','catch','update','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','get','Invalid\x20state\x20parameter','parse','state','base64','toString','oauth2Claims','del','getOauth2MicrosoftAccessToken','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','sendStatus','status','end','offset','undefined','limit','count','json','then','destroy','error','stack','name','send','padEnd','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','MicrosoftAzure','decryptString','show','params','keys','includeAll','include','find','service','data3'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0x4469,0x7e));var _0x9446=function(_0x34be64,_0x4a2f89){_0x34be64=_0x34be64-0x0;var _0x1de14e=_0x4469[_0x34be64];return _0x1de14e;};'use strict';var _=require(_0x9446('0x0'));var Redis=require(_0x9446('0x1'));var qs=require(_0x9446('0x2'));var encryptor=require(_0x9446('0x3'));var config=require(_0x9446('0x4'));var logger=require(_0x9446('0x5'))(_0x9446('0x6'));var db=require(_0x9446('0x7'))['db'];var oauth=require(_0x9446('0x8'));config[_0x9446('0x9')]=_[_0x9446('0xa')](config[_0x9446('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9446('0x9')]));var redis=new Redis(config[_0x9446('0x9')]);function respondWithStatusCode(_0x20a50c,_0x462a4d){_0x462a4d=_0x462a4d||0xcc;return function(_0x9d3119){if(_0x9d3119){return _0x20a50c[_0x9446('0xb')](_0x462a4d);}return _0x20a50c[_0x9446('0xc')](_0x462a4d)[_0x9446('0xd')]();};}function respondWithResult(_0x4ef60a,_0x4c5d50){_0x4c5d50=_0x4c5d50||0xc8;return function(_0x8e62ef){if(_0x8e62ef){return _0x4ef60a['status'](_0x4c5d50)['json'](_0x8e62ef);}};}function respondWithFilteredResult(_0x33bd4b,_0xd034ae){return function(_0x5623a4){if(_0x5623a4){var _0x18db1f=typeof _0xd034ae[_0x9446('0xe')]===_0x9446('0xf')&&typeof _0xd034ae[_0x9446('0x10')]==='undefined';var _0x510249=_0x5623a4[_0x9446('0x11')];var _0x59383f=_0x18db1f?0x0:_0xd034ae['offset'];var _0x245408=_0x18db1f?_0x5623a4[_0x9446('0x11')]:_0xd034ae['offset']+_0xd034ae[_0x9446('0x10')];var _0x5c5236;if(_0x245408>=_0x510249){_0x245408=_0x510249;_0x5c5236=0xc8;}else{_0x5c5236=0xce;}_0x33bd4b[_0x9446('0xc')](_0x5c5236);return _0x33bd4b['set']('Content-Range',_0x59383f+'-'+_0x245408+'/'+_0x510249)[_0x9446('0x12')](_0x5623a4);}return null;};}function saveUpdates(_0x163cb1){return function(_0x2b8aab){if(_0x2b8aab){return _0x2b8aab['update'](_0x163cb1)[_0x9446('0x13')](function(_0x2a188b){return _0x2a188b;});}return null;};}function removeEntity(_0x3b50f7){return function(_0x553f19){if(_0x553f19){return _0x553f19[_0x9446('0x14')]()[_0x9446('0x13')](function(){_0x3b50f7[_0x9446('0xc')](0xcc)[_0x9446('0xd')]();});}};}function handleEntityNotFound(_0x4c5fa1){return function(_0x2eb800){if(!_0x2eb800){_0x4c5fa1[_0x9446('0xb')](0x194);}return _0x2eb800;};}function handleError(_0x21cc57,_0xc3d6c6){_0xc3d6c6=_0xc3d6c6||0x1f4;return function(_0x2a3bbd){logger[_0x9446('0x15')](_0x2a3bbd[_0x9446('0x16')]);if(_0x2a3bbd[_0x9446('0x17')]){delete _0x2a3bbd[_0x9446('0x17')];}_0x21cc57[_0x9446('0xc')](_0xc3d6c6)[_0x9446('0x18')](_0x2a3bbd);};}function maskClientSecret(_0x201535){return _[_0x9446('0x19')](_0x201535['slice'](0x0,0x3),0x14,'*');}exports[_0x9446('0x1a')]=function(_0x1d3ee7,_0x23696a){var _0xa0410b={},_0x2ac38a={},_0x519c0e={'count':0x0,'rows':[]};var _0x489207=_[_0x9446('0x1b')](db[_0x9446('0x1c')][_0x9446('0x1d')],function(_0x138b10){return{'name':_0x138b10[_0x9446('0x1e')],'type':_0x138b10[_0x9446('0x1f')][_0x9446('0x20')]};});_0x2ac38a[_0x9446('0x21')]=_['map'](_0x489207,_0x9446('0x17'));_0x2ac38a['query']=_['keys'](_0x1d3ee7[_0x9446('0x22')]);_0x2ac38a['filters']=_['intersection'](_0x2ac38a[_0x9446('0x21')],_0x2ac38a[_0x9446('0x22')]);_0xa0410b[_0x9446('0x23')]=_['intersection'](_0x2ac38a[_0x9446('0x21')],qs[_0x9446('0x24')](_0x1d3ee7[_0x9446('0x22')][_0x9446('0x24')]));_0xa0410b['attributes']=_0xa0410b[_0x9446('0x23')][_0x9446('0x25')]?_0xa0410b[_0x9446('0x23')]:_0x2ac38a[_0x9446('0x21')];if(!_0x1d3ee7['query'][_0x9446('0x26')](_0x9446('0x27'))){_0xa0410b[_0x9446('0x10')]=qs['limit'](_0x1d3ee7[_0x9446('0x22')][_0x9446('0x10')]);_0xa0410b[_0x9446('0xe')]=qs['offset'](_0x1d3ee7[_0x9446('0x22')]['offset']);}_0xa0410b[_0x9446('0x28')]=qs[_0x9446('0x29')](_0x1d3ee7[_0x9446('0x22')][_0x9446('0x29')]);_0xa0410b['where']=qs[_0x9446('0x2a')](_['pick'](_0x1d3ee7['query'],_0x2ac38a[_0x9446('0x2a')]),_0x489207);if(_0x1d3ee7[_0x9446('0x22')][_0x9446('0x2b')]){_0xa0410b[_0x9446('0x2c')]=_[_0x9446('0x2d')](_0xa0410b[_0x9446('0x2c')],{'$or':_[_0x9446('0x1b')](_0x489207,function(_0x2e9b43){if(_0x2e9b43[_0x9446('0x1f')]!==_0x9446('0x2e')){var _0x4bc1d5={};_0x4bc1d5[_0x2e9b43[_0x9446('0x17')]]={'$like':'%'+_0x1d3ee7['query'][_0x9446('0x2b')]+'%'};return _0x4bc1d5;}})});}_0xa0410b=_[_0x9446('0x2d')]({},_0xa0410b,_0x1d3ee7[_0x9446('0x2f')]);var _0x5c02cc={'where':_0xa0410b[_0x9446('0x2c')]};return db[_0x9446('0x1c')][_0x9446('0x11')](_0x5c02cc)[_0x9446('0x13')](function(_0x385b3b){_0x519c0e[_0x9446('0x11')]=_0x385b3b;if(_0x1d3ee7[_0x9446('0x22')]['includeAll']){_0xa0410b['include']=[{'all':!![]}];}return db[_0x9446('0x1c')]['findAll'](_0xa0410b);})['then'](function(_0x4c8a3f){_0x519c0e['rows']=_[_0x9446('0x1b')](_0x4c8a3f,function(_0x5ac849){if(_0x5ac849['service']===_0x9446('0x30')){var _0x8f8cff=encryptor[_0x9446('0x31')](_0x5ac849['data3']);_0x5ac849['data3']=maskClientSecret(_0x8f8cff);}return _0x5ac849;});return _0x519c0e;})['then'](respondWithFilteredResult(_0x23696a,_0xa0410b))['catch'](handleError(_0x23696a,null));};exports[_0x9446('0x32')]=function(_0x1b1673,_0x48875c){var _0x4679ae={'raw':!![],'where':{'id':_0x1b1673[_0x9446('0x33')]['id']}},_0x2882bc={};_0x2882bc[_0x9446('0x21')]=_[_0x9446('0x34')](db[_0x9446('0x1c')][_0x9446('0x1d')]);_0x2882bc['query']=_['keys'](_0x1b1673[_0x9446('0x22')]);_0x2882bc['filters']=_['intersection'](_0x2882bc['model'],_0x2882bc[_0x9446('0x22')]);_0x4679ae[_0x9446('0x23')]=_['intersection'](_0x2882bc[_0x9446('0x21')],qs['fields'](_0x1b1673[_0x9446('0x22')]['fields']));_0x4679ae[_0x9446('0x23')]=_0x4679ae[_0x9446('0x23')][_0x9446('0x25')]?_0x4679ae[_0x9446('0x23')]:_0x2882bc[_0x9446('0x21')];if(_0x1b1673['query'][_0x9446('0x35')]){_0x4679ae[_0x9446('0x36')]=[{'all':!![]}];}_0x4679ae=_[_0x9446('0x2d')]({},_0x4679ae,_0x1b1673['options']);return db[_0x9446('0x1c')][_0x9446('0x37')](_0x4679ae)[_0x9446('0x13')](handleEntityNotFound(_0x48875c,null))[_0x9446('0x13')](function(_0x57037c){if(_0x57037c[_0x9446('0x38')]===_0x9446('0x30')){var _0x19307a=encryptor[_0x9446('0x31')](_0x57037c[_0x9446('0x39')]);_0x57037c[_0x9446('0x39')]=maskClientSecret(_0x19307a);}return _0x57037c;})[_0x9446('0x13')](respondWithResult(_0x48875c,null))['catch'](handleError(_0x48875c,null));};exports[_0x9446('0x3a')]=function(_0xc25d53,_0x45956d){if(!_0xc25d53[_0x9446('0x3b')]['name'])throw new Error(_0x9446('0x3c'));if(!_0xc25d53[_0x9446('0x3b')][_0x9446('0x38')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x262e85=db['CloudProvider'][_0x9446('0x1d')][_0x9446('0x38')][_0x9446('0x3d')];if(!_0x262e85[_0x9446('0x3e')](_0xc25d53[_0x9446('0x3b')][_0x9446('0x38')]))throw new Error(_0x9446('0x3f')+_0x262e85[_0x9446('0x40')](',\x20'));if(_0xc25d53[_0x9446('0x3b')][_0x9446('0x38')]===_0x9446('0x30')&&_0xc25d53['body'][_0x9446('0x39')]){_0xc25d53[_0x9446('0x3b')][_0x9446('0x39')]=encryptor[_0x9446('0x41')](_0xc25d53[_0x9446('0x3b')][_0x9446('0x39')]);}return db['CloudProvider']['create'](_0xc25d53[_0x9446('0x3b')],{})['then'](respondWithResult(_0x45956d,0xc9))[_0x9446('0x42')](handleError(_0x45956d,null));};exports[_0x9446('0x43')]=function(_0xd14121,_0x5b4ba0){if(_0xd14121[_0x9446('0x3b')]['id']){delete _0xd14121[_0x9446('0x3b')]['id'];}return db[_0x9446('0x1c')][_0x9446('0x37')]({'where':{'id':_0xd14121[_0x9446('0x33')]['id']}})[_0x9446('0x13')](handleEntityNotFound(_0x5b4ba0,null))[_0x9446('0x13')](function(_0x4722b8){if(_0x4722b8[_0x9446('0x38')]===_0x9446('0x30')&&_0xd14121[_0x9446('0x3b')][_0x9446('0x39')]){_0xd14121[_0x9446('0x3b')][_0x9446('0x39')]=encryptor[_0x9446('0x41')](_0xd14121[_0x9446('0x3b')][_0x9446('0x39')]);}return _0x4722b8;})[_0x9446('0x13')](saveUpdates(_0xd14121['body'],null))[_0x9446('0x13')](respondWithResult(_0x5b4ba0,null))['catch'](handleError(_0x5b4ba0,null));};exports['destroy']=function(_0x241a9d,_0x46a217){return db[_0x9446('0x1c')][_0x9446('0x37')]({'where':{'id':_0x241a9d[_0x9446('0x33')]['id']}})[_0x9446('0x13')](handleEntityNotFound(_0x46a217,null))['then'](removeEntity(_0x46a217,null))[_0x9446('0x42')](handleError(_0x46a217,null));};exports[_0x9446('0x44')]=function(_0x1d63e8,_0x5dcee0){return db['CloudProvider']['findOne']({'where':{'id':_0x1d63e8[_0x9446('0x33')]['id']},'raw':!![]})['then'](function(_0x3a0c38){if(!_0x3a0c38)return _0x5dcee0[_0x9446('0xb')](0x194);return{'url':oauth[_0x9446('0x45')](_0x3a0c38,_0x1d63e8[_0x9446('0x46')]['id'])};})[_0x9446('0x13')](respondWithResult(_0x5dcee0,null))[_0x9446('0x42')](handleError(_0x5dcee0,null));};exports['oauth2MicrosoftCallback']=function(_0x2439a7,_0x37e8c8){var _0x527765=_0x2439a7['body'];var _0xa9066;var _0x446a11;if(_0x527765[_0x9446('0x15')])throw _0x527765;redis[_0x9446('0x47')](_0x527765['state'])[_0x9446('0x13')](function(_0x2328ad){if(!_0x2328ad)throw new Error(_0x9446('0x48'));_0xa9066=JSON[_0x9446('0x49')](_0x2328ad);var _0x33d873=Buffer['from'](_0x527765[_0x9446('0x4a')],_0x9446('0x4b'))[_0x9446('0x4c')]('ascii');_0x446a11=JSON[_0x9446('0x49')](_0x33d873);if(!oauth['isValidIdToken'](_0x527765['id_token'],_0xa9066[_0x9446('0x4d')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x9446('0x4e')](_0x527765[_0x9446('0x4a')]);return oauth[_0x9446('0x4f')](_0x527765['code'],_0xa9066);})[_0x9446('0x13')](function(_0x208ad4){_0xa9066['data5']=_0x208ad4[_0x9446('0x50')];_0xa9066[_0x9446('0x51')]=_0x208ad4[_0x9446('0x52')];return db['CloudProvider'][_0x9446('0x43')]({'data5':_0xa9066[_0x9446('0x53')],'data6':_0xa9066[_0x9446('0x51')]},{'where':{'id':_0xa9066['id']}});})[_0x9446('0x13')](function(){oauth[_0x9446('0x54')](_0xa9066);socket[_0x9446('0x55')](_0x9446('0x56'),{'id':_0x446a11['id']});return;})[_0x9446('0x13')](respondWithStatusCode(_0x37e8c8,null))['catch'](function(_0x509e4b){if(_0x446a11){socket[_0x9446('0x55')](_0x9446('0x57'),{'id':_0x446a11['id']});}if(!_0xa9066){logger['error'](_0x9446('0x58'),_0x509e4b);return _0x37e8c8['status'](0x1f4)['send'](_0x509e4b[_0x9446('0x59')]);}logger[_0x9446('0x15')](_0x9446('0x5a'),_0xa9066['id'],JSON[_0x9446('0x5b')](_0x509e4b));});};
\ No newline at end of file
+var _0x7fc6=['keys','merge','find','create','body','Name\x20parameter\x20not\x20specified','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','error','get','state','Invalid\x20state\x20parameter','parse','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','localhost','sendStatus','status','json','offset','undefined','limit','count','update','then','destroy','end','stack','name','send','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','VIRTUAL','options','where','includeAll','include','rows','map','service','MicrosoftAzure','decryptString','data3','catch','show','params'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7fc6,0x78));var _0x67fc=function(_0x43f458,_0x1304d6){_0x43f458=_0x43f458-0x0;var _0x5e6672=_0x7fc6[_0x43f458];return _0x5e6672;};'use strict';var _=require('lodash');var Redis=require(_0x67fc('0x0'));var qs=require(_0x67fc('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0x67fc('0x2'));var logger=require(_0x67fc('0x3'))(_0x67fc('0x4'));var db=require('../../mysqldb')['db'];var oauth=require(_0x67fc('0x5'));config[_0x67fc('0x6')]=_['defaults'](config[_0x67fc('0x6')],{'host':_0x67fc('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config[_0x67fc('0x6')]);function respondWithStatusCode(_0x4565a1,_0x5ae936){_0x5ae936=_0x5ae936||0xcc;return function(_0x2cc040){if(_0x2cc040){return _0x4565a1[_0x67fc('0x8')](_0x5ae936);}return _0x4565a1['status'](_0x5ae936)['end']();};}function respondWithResult(_0x287df0,_0x15702c){_0x15702c=_0x15702c||0xc8;return function(_0x21380f){if(_0x21380f){return _0x287df0[_0x67fc('0x9')](_0x15702c)[_0x67fc('0xa')](_0x21380f);}};}function respondWithFilteredResult(_0x44be45,_0x16d77b){return function(_0x192aac){if(_0x192aac){var _0x1b37ca=typeof _0x16d77b[_0x67fc('0xb')]===_0x67fc('0xc')&&typeof _0x16d77b[_0x67fc('0xd')]===_0x67fc('0xc');var _0x3c18a0=_0x192aac[_0x67fc('0xe')];var _0x7b2a36=_0x1b37ca?0x0:_0x16d77b['offset'];var _0x436ab6=_0x1b37ca?_0x192aac['count']:_0x16d77b[_0x67fc('0xb')]+_0x16d77b[_0x67fc('0xd')];var _0x539e99;if(_0x436ab6>=_0x3c18a0){_0x436ab6=_0x3c18a0;_0x539e99=0xc8;}else{_0x539e99=0xce;}_0x44be45[_0x67fc('0x9')](_0x539e99);return _0x44be45['set']('Content-Range',_0x7b2a36+'-'+_0x436ab6+'/'+_0x3c18a0)[_0x67fc('0xa')](_0x192aac);}return null;};}function saveUpdates(_0x5cf143){return function(_0x3b0ae4){if(_0x3b0ae4){return _0x3b0ae4[_0x67fc('0xf')](_0x5cf143)[_0x67fc('0x10')](function(_0x48e098){return _0x48e098;});}return null;};}function removeEntity(_0x157546){return function(_0x2088cc){if(_0x2088cc){return _0x2088cc[_0x67fc('0x11')]()[_0x67fc('0x10')](function(){_0x157546['status'](0xcc)[_0x67fc('0x12')]();});}};}function handleEntityNotFound(_0x3c0861){return function(_0x5855e1){if(!_0x5855e1){_0x3c0861['sendStatus'](0x194);}return _0x5855e1;};}function handleError(_0x45f8be,_0x4a461a){_0x4a461a=_0x4a461a||0x1f4;return function(_0x172321){logger['error'](_0x172321[_0x67fc('0x13')]);if(_0x172321[_0x67fc('0x14')]){delete _0x172321['name'];}_0x45f8be['status'](_0x4a461a)[_0x67fc('0x15')](_0x172321);};}function maskClientSecret(_0x265139){return _[_0x67fc('0x16')](_0x265139[_0x67fc('0x17')](0x0,0x3),0x14,'*');}exports[_0x67fc('0x18')]=function(_0x7cb443,_0x2cb99){var _0x49f44a={},_0x18eac7={},_0x25d64e={'count':0x0,'rows':[]};var _0x564396=_['map'](db[_0x67fc('0x19')][_0x67fc('0x1a')],function(_0x503f2c){return{'name':_0x503f2c[_0x67fc('0x1b')],'type':_0x503f2c[_0x67fc('0x1c')]['key']};});_0x18eac7[_0x67fc('0x1d')]=_['map'](_0x564396,'name');_0x18eac7[_0x67fc('0x1e')]=_['keys'](_0x7cb443[_0x67fc('0x1e')]);_0x18eac7[_0x67fc('0x1f')]=_[_0x67fc('0x20')](_0x18eac7[_0x67fc('0x1d')],_0x18eac7[_0x67fc('0x1e')]);_0x49f44a[_0x67fc('0x21')]=_[_0x67fc('0x20')](_0x18eac7[_0x67fc('0x1d')],qs['fields'](_0x7cb443[_0x67fc('0x1e')][_0x67fc('0x22')]));_0x49f44a[_0x67fc('0x21')]=_0x49f44a[_0x67fc('0x21')][_0x67fc('0x23')]?_0x49f44a['attributes']:_0x18eac7[_0x67fc('0x1d')];if(!_0x7cb443['query']['hasOwnProperty'](_0x67fc('0x24'))){_0x49f44a[_0x67fc('0xd')]=qs['limit'](_0x7cb443['query'][_0x67fc('0xd')]);_0x49f44a[_0x67fc('0xb')]=qs[_0x67fc('0xb')](_0x7cb443[_0x67fc('0x1e')]['offset']);}_0x49f44a['order']=qs[_0x67fc('0x25')](_0x7cb443['query']['sort']);_0x49f44a['where']=qs['filters'](_[_0x67fc('0x26')](_0x7cb443[_0x67fc('0x1e')],_0x18eac7[_0x67fc('0x1f')]),_0x564396);if(_0x7cb443[_0x67fc('0x1e')][_0x67fc('0x27')]){_0x49f44a['where']=_['merge'](_0x49f44a['where'],{'$or':_['map'](_0x564396,function(_0x2f3dbc){if(_0x2f3dbc[_0x67fc('0x1c')]!==_0x67fc('0x28')){var _0x18e507={};_0x18e507[_0x2f3dbc[_0x67fc('0x14')]]={'$like':'%'+_0x7cb443['query'][_0x67fc('0x27')]+'%'};return _0x18e507;}})});}_0x49f44a=_['merge']({},_0x49f44a,_0x7cb443[_0x67fc('0x29')]);var _0x260f03={'where':_0x49f44a[_0x67fc('0x2a')]};return db['CloudProvider']['count'](_0x260f03)[_0x67fc('0x10')](function(_0x2ce482){_0x25d64e[_0x67fc('0xe')]=_0x2ce482;if(_0x7cb443[_0x67fc('0x1e')][_0x67fc('0x2b')]){_0x49f44a[_0x67fc('0x2c')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x49f44a);})['then'](function(_0x2ae8f7){_0x25d64e[_0x67fc('0x2d')]=_[_0x67fc('0x2e')](_0x2ae8f7,function(_0x5b4652){if(_0x5b4652[_0x67fc('0x2f')]===_0x67fc('0x30')){var _0x4d3653=encryptor[_0x67fc('0x31')](_0x5b4652['data3']);_0x5b4652[_0x67fc('0x32')]=maskClientSecret(_0x4d3653);}return _0x5b4652;});return _0x25d64e;})['then'](respondWithFilteredResult(_0x2cb99,_0x49f44a))[_0x67fc('0x33')](handleError(_0x2cb99,null));};exports[_0x67fc('0x34')]=function(_0x310b56,_0x53a28e){var _0x4a10c2={'raw':!![],'where':{'id':_0x310b56[_0x67fc('0x35')]['id']}},_0x59842d={};_0x59842d[_0x67fc('0x1d')]=_[_0x67fc('0x36')](db[_0x67fc('0x19')]['rawAttributes']);_0x59842d[_0x67fc('0x1e')]=_['keys'](_0x310b56[_0x67fc('0x1e')]);_0x59842d['filters']=_[_0x67fc('0x20')](_0x59842d[_0x67fc('0x1d')],_0x59842d[_0x67fc('0x1e')]);_0x4a10c2[_0x67fc('0x21')]=_[_0x67fc('0x20')](_0x59842d['model'],qs[_0x67fc('0x22')](_0x310b56[_0x67fc('0x1e')][_0x67fc('0x22')]));_0x4a10c2[_0x67fc('0x21')]=_0x4a10c2[_0x67fc('0x21')][_0x67fc('0x23')]?_0x4a10c2[_0x67fc('0x21')]:_0x59842d['model'];if(_0x310b56[_0x67fc('0x1e')][_0x67fc('0x2b')]){_0x4a10c2[_0x67fc('0x2c')]=[{'all':!![]}];}_0x4a10c2=_[_0x67fc('0x37')]({},_0x4a10c2,_0x310b56[_0x67fc('0x29')]);return db['CloudProvider'][_0x67fc('0x38')](_0x4a10c2)['then'](handleEntityNotFound(_0x53a28e,null))[_0x67fc('0x10')](function(_0x212eab){if(_0x212eab[_0x67fc('0x2f')]===_0x67fc('0x30')){var _0x35f0e8=encryptor[_0x67fc('0x31')](_0x212eab[_0x67fc('0x32')]);_0x212eab[_0x67fc('0x32')]=maskClientSecret(_0x35f0e8);}return _0x212eab;})[_0x67fc('0x10')](respondWithResult(_0x53a28e,null))[_0x67fc('0x33')](handleError(_0x53a28e,null));};exports[_0x67fc('0x39')]=function(_0x68d940,_0x2de1ed){if(!_0x68d940[_0x67fc('0x3a')][_0x67fc('0x14')])throw new Error(_0x67fc('0x3b'));if(!_0x68d940[_0x67fc('0x3a')][_0x67fc('0x2f')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x9c6554=db['CloudProvider'][_0x67fc('0x1a')][_0x67fc('0x2f')]['values'];if(!_0x9c6554['includes'](_0x68d940[_0x67fc('0x3a')]['service']))throw new Error(_0x67fc('0x3c')+_0x9c6554['join'](',\x20'));if(_0x68d940[_0x67fc('0x3a')][_0x67fc('0x2f')]==='MicrosoftAzure'&&_0x68d940['body'][_0x67fc('0x32')]){_0x68d940[_0x67fc('0x3a')][_0x67fc('0x32')]=encryptor[_0x67fc('0x3d')](_0x68d940['body'][_0x67fc('0x32')]);}return db[_0x67fc('0x19')][_0x67fc('0x39')](_0x68d940[_0x67fc('0x3a')],{})[_0x67fc('0x10')](respondWithResult(_0x2de1ed,0xc9))[_0x67fc('0x33')](handleError(_0x2de1ed,null));};exports[_0x67fc('0xf')]=function(_0x2e1e54,_0x4016d6){if(_0x2e1e54['body']['id']){delete _0x2e1e54[_0x67fc('0x3a')]['id'];}return db[_0x67fc('0x19')][_0x67fc('0x38')]({'where':{'id':_0x2e1e54[_0x67fc('0x35')]['id']}})[_0x67fc('0x10')](handleEntityNotFound(_0x4016d6,null))[_0x67fc('0x10')](function(_0x3246cc){if(_0x3246cc[_0x67fc('0x2f')]===_0x67fc('0x30')&&_0x2e1e54['body']['data3']){_0x2e1e54[_0x67fc('0x3a')][_0x67fc('0x32')]=encryptor[_0x67fc('0x3d')](_0x2e1e54[_0x67fc('0x3a')][_0x67fc('0x32')]);}return _0x3246cc;})[_0x67fc('0x10')](saveUpdates(_0x2e1e54[_0x67fc('0x3a')],null))[_0x67fc('0x10')](respondWithResult(_0x4016d6,null))[_0x67fc('0x33')](handleError(_0x4016d6,null));};exports[_0x67fc('0x11')]=function(_0x70a074,_0x2647e5){return db[_0x67fc('0x19')][_0x67fc('0x38')]({'where':{'id':_0x70a074[_0x67fc('0x35')]['id']}})[_0x67fc('0x10')](handleEntityNotFound(_0x2647e5,null))[_0x67fc('0x10')](removeEntity(_0x2647e5,null))[_0x67fc('0x33')](handleError(_0x2647e5,null));};exports[_0x67fc('0x3e')]=function(_0x52eba2,_0x35eb3b){return db[_0x67fc('0x19')][_0x67fc('0x3f')]({'where':{'id':_0x52eba2[_0x67fc('0x35')]['id']},'raw':!![]})['then'](function(_0x3d8bf7){if(!_0x3d8bf7)return _0x35eb3b['sendStatus'](0x194);return{'url':oauth[_0x67fc('0x40')](_0x3d8bf7,_0x52eba2[_0x67fc('0x41')]['id'])};})['then'](respondWithResult(_0x35eb3b,null))[_0x67fc('0x33')](handleError(_0x35eb3b,null));};exports['oauth2MicrosoftCallback']=function(_0x31088a,_0x2cb9cf){var _0x4b4e1d=_0x31088a[_0x67fc('0x3a')];var _0x3ec0de;var _0x187b1b;if(_0x4b4e1d[_0x67fc('0x42')])throw _0x4b4e1d;redis[_0x67fc('0x43')](_0x4b4e1d[_0x67fc('0x44')])[_0x67fc('0x10')](function(_0x4fb738){if(!_0x4fb738)throw new Error(_0x67fc('0x45'));_0x3ec0de=JSON[_0x67fc('0x46')](_0x4fb738);var _0x55bb08=Buffer['from'](_0x4b4e1d[_0x67fc('0x44')],'base64')[_0x67fc('0x47')](_0x67fc('0x48'));_0x187b1b=JSON[_0x67fc('0x46')](_0x55bb08);if(!oauth[_0x67fc('0x49')](_0x4b4e1d['id_token'],_0x3ec0de[_0x67fc('0x4a')]))throw new Error(_0x67fc('0x4b'));redis[_0x67fc('0x4c')](_0x4b4e1d['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x4b4e1d[_0x67fc('0x4d')],_0x3ec0de);})[_0x67fc('0x10')](function(_0x1b45e5){_0x3ec0de[_0x67fc('0x4e')]=_0x1b45e5['access_token'];_0x3ec0de[_0x67fc('0x4f')]=_0x1b45e5[_0x67fc('0x50')];return db[_0x67fc('0x19')][_0x67fc('0xf')]({'data5':_0x3ec0de[_0x67fc('0x4e')],'data6':_0x3ec0de[_0x67fc('0x4f')]},{'where':{'id':_0x3ec0de['id']}});})[_0x67fc('0x10')](function(){oauth[_0x67fc('0x51')](_0x3ec0de);socket[_0x67fc('0x52')](_0x67fc('0x53'),{'id':_0x187b1b['id']});return;})[_0x67fc('0x10')](respondWithStatusCode(_0x2cb9cf,null))[_0x67fc('0x33')](function(_0x1d0557){if(_0x187b1b){socket[_0x67fc('0x52')](_0x67fc('0x54'),{'id':_0x187b1b['id']});}if(!_0x3ec0de){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x1d0557);return _0x2cb9cf['status'](0x1f4)[_0x67fc('0x15')](_0x1d0557[_0x67fc('0x55')]);}logger[_0x67fc('0x42')](_0x67fc('0x56'),_0x3ec0de['id'],JSON['stringify'](_0x1d0557));});};
\ No newline at end of file
index 6b73f75..74fc32a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4aa4=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3ebaa3,_0x2d1249){var _0x5f2963=function(_0x5d8be7){while(--_0x5d8be7){_0x3ebaa3['push'](_0x3ebaa3['shift']());}};_0x5f2963(++_0x2d1249);}(_0x4aa4,0x13c));var _0x44aa=function(_0x40ab3d,_0x11d559){_0x40ab3d=_0x40ab3d-0x0;var _0x191c55=_0x4aa4[_0x40ab3d];return _0x191c55;};'use strict';var _=require(_0x44aa('0x0'));var util=require(_0x44aa('0x1'));var logger=require(_0x44aa('0x2'))(_0x44aa('0x3'));var moment=require('moment');var BPromise=require(_0x44aa('0x4'));var rp=require(_0x44aa('0x5'));var fs=require('fs');var path=require(_0x44aa('0x6'));var rimraf=require(_0x44aa('0x7'));var config=require(_0x44aa('0x8'));var attributes=require(_0x44aa('0x9'));module[_0x44aa('0xa')]=function(_0x621d24,_0x10f06d){return _0x621d24[_0x44aa('0xb')](_0x44aa('0xc'),attributes,{'tableName':_0x44aa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa225=['exports','define','CloudProvider','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x49c1f2,_0x468abb){var _0x2058c9=function(_0x333245){while(--_0x333245){_0x49c1f2['push'](_0x49c1f2['shift']());}};_0x2058c9(++_0x468abb);}(_0xa225,0xd5));var _0x5a22=function(_0x324b18,_0x5bc19b){_0x324b18=_0x324b18-0x0;var _0x2289da=_0xa225[_0x324b18];return _0x2289da;};'use strict';var _=require(_0x5a22('0x0'));var util=require('util');var logger=require(_0x5a22('0x1'))(_0x5a22('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5a22('0x3'));var fs=require('fs');var path=require(_0x5a22('0x4'));var rimraf=require(_0x5a22('0x5'));var config=require(_0x5a22('0x6'));var attributes=require('./cloudProvider.attributes');module[_0x5a22('0x7')]=function(_0x44a0f0,_0x1bcccb){return _0x44a0f0[_0x5a22('0x8')](_0x5a22('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 30ecc6e..de1b7f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6325=['intervals','bind','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','type','Dynamics365','push','data7','Outlook365','/.default','replace','{TENANT_ID}','data2','id_token','from','toString','base64','hex','data1','join','redirect_uri','data4','response_mode','form_post','state','nonce','prompt','login','map','key','oauth2/','set','stringify','iss','issuer','audience','unix','CloudProvider','findOne','then','refresh_token','decryptString','data3','data5','access_token','data6','catch','authorization_code','POST'];(function(_0x101f82,_0x5f01f7){var _0x19f88c=function(_0x200df9){while(--_0x200df9){_0x101f82['push'](_0x101f82['shift']());}};_0x19f88c(++_0x5f01f7);}(_0x6325,0x130));var _0x5632=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6325[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5632('0x0'));var crypto=require('crypto');var jwt=require(_0x5632('0x1'));var moment=require(_0x5632('0x2'));var Redis=require(_0x5632('0x3'));var rp=require(_0x5632('0x4'));var util=require('util');var encryptor=require(_0x5632('0x5'));var config=require(_0x5632('0x6'));var logger=require(_0x5632('0x7'))(_0x5632('0x8'));var schedule=require(_0x5632('0x9'));var db=require(_0x5632('0xa'))['db'];config[_0x5632('0xb')]=_[_0x5632('0xc')](config[_0x5632('0xb')],{'host':_0x5632('0xd'),'port':0x18eb});var redis=new Redis(config[_0x5632('0xb')]);var MICROSOFT_AUTH_URL=_0x5632('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0x5632('0xf'),_0x5632('0x10'),'email',_0x5632('0x11'),_0x5632('0x12'),_0x5632('0x13'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x5632('0xf'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x5632('0x14');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x42dd0f){var _0x5e2fe8=_['map'](AZURE_AUTH_SCOPES[_0x42dd0f[_0x5632('0x15')]]);if(_0x42dd0f[_0x5632('0x15')]===_0x5632('0x16'))_0x5e2fe8[_0x5632('0x17')](_0x42dd0f[_0x5632('0x18')]+'/.default');return _0x5e2fe8['join']('\x20');}function getAccessTokenScope(_0x22ac6e){if(_0x22ac6e[_0x5632('0x15')]===_0x5632('0x19'))return _0x5632('0x12');if(_0x22ac6e[_0x5632('0x15')]===_0x5632('0x16'))return _0x22ac6e[_0x5632('0x18')]+_0x5632('0x1a');}function generateMicrosoftAuthorizationUrl(_0x5999ba,_0x2e15fb){var _0x5c1541=MICROSOFT_AUTH_URL[_0x5632('0x1b')](_0x5632('0x1c'),_0x5999ba[_0x5632('0x1d')]);var _0x26e5ce=['code',_0x5632('0x1e')];var _0x2db4c1=Buffer[_0x5632('0x1f')](JSON['stringify']({'id':_0x2e15fb}))[_0x5632('0x20')](_0x5632('0x21'));var _0x49aa3c=crypto['randomBytes'](0x10)[_0x5632('0x20')](_0x5632('0x22'));var _0x5e8b47=getAuthorizationScopes(_0x5999ba);var _0x10b997=[{'key':'client_id','value':_0x5999ba[_0x5632('0x23')]},{'key':'response_type','value':encodeURIComponent(_0x26e5ce[_0x5632('0x24')]('\x20'))},{'key':_0x5632('0x25'),'value':_0x5999ba[_0x5632('0x26')]},{'key':_0x5632('0x27'),'value':_0x5632('0x28')},{'key':'scope','value':encodeURIComponent(_0x5e8b47)},{'key':_0x5632('0x29'),'value':_0x2db4c1},{'key':_0x5632('0x2a'),'value':_0x49aa3c},{'key':_0x5632('0x2b'),'value':_0x5632('0x2c')}];var _0x55fd36=_0x5c1541+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x5632('0x2d')](_0x10b997,function(_0x273d49){return _0x273d49[_0x5632('0x2e')]+'='+_0x273d49['value'];})[_0x5632('0x24')]('&');_0x5999ba['oauth2Claims']={'issuer':_0x5c1541[_0x5632('0x1b')](_0x5632('0x2f'),''),'audience':_0x5999ba[_0x5632('0x23')],'state':_0x2db4c1,'nonce':_0x49aa3c};redis[_0x5632('0x30')](_0x2db4c1,JSON[_0x5632('0x31')](_0x5999ba));return _0x55fd36;}function isValidIdToken(_0x517bd,_0x1b873d){try{var _0x52711a=jwt['decode'](_0x517bd,{'complete':!![]});var _0x5c3d65=_0x52711a['payload'];if(_0x5c3d65[_0x5632('0x32')]!==_0x1b873d[_0x5632('0x33')])return![];if(_0x5c3d65['aud']!==_0x1b873d[_0x5632('0x34')])return![];if(_0x5c3d65[_0x5632('0x2a')]!==_0x1b873d[_0x5632('0x2a')])return![];if(moment()['isAfter'](moment[_0x5632('0x35')](_0x5c3d65['exp'])))return![];return!![];}catch(_0x3e408f){throw _0x3e408f;}}function refreshOauth2MicrosoftAccessToken(_0x5da797){return Promise['resolve']()['then'](function(){if(_0x5da797['data3'])return _0x5da797;return db[_0x5632('0x36')][_0x5632('0x37')]({'where':{'id':_0x5da797['id']},'raw':!![]});})[_0x5632('0x38')](function(_0x270221){var _0x1c7470={'grant_type':_0x5632('0x39'),'refresh_token':_0x270221['data6'],'scope':getAccessTokenScope(_0x270221),'redirect_uri':_0x270221[_0x5632('0x26')],'client_id':_0x270221[_0x5632('0x23')],'client_secret':encryptor[_0x5632('0x3a')](_0x270221[_0x5632('0x3b')])};var _0x579149={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x5632('0x1b')](_0x5632('0x1c'),_0x270221[_0x5632('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1c7470,'json':!![]};return rp(_0x579149);})['then'](function(_0x5e5b83){_0x5da797[_0x5632('0x3c')]=_0x5e5b83[_0x5632('0x3d')];_0x5da797[_0x5632('0x3e')]=_0x5e5b83[_0x5632('0x39')];return db[_0x5632('0x36')]['update']({'data5':_0x5da797[_0x5632('0x3c')],'data6':_0x5da797['data6']},{'where':{'id':_0x5da797['id']}});})[_0x5632('0x38')](function(){return _0x5da797;})[_0x5632('0x3f')](function(_0x5b9942){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x5da797['id'],_0x5b9942);});}function getOauth2MicrosoftAccessToken(_0x56ee1c,_0x8b42e1){var _0x1acf98={'grant_type':_0x5632('0x40'),'code':_0x56ee1c,'scope':getAccessTokenScope(_0x8b42e1),'redirect_uri':_0x8b42e1[_0x5632('0x26')],'client_id':_0x8b42e1[_0x5632('0x23')],'client_secret':encryptor[_0x5632('0x3a')](_0x8b42e1[_0x5632('0x3b')])};var _0x349e0d={'method':_0x5632('0x41'),'uri':MICROSOFT_AUTH_URL[_0x5632('0x1b')]('{TENANT_ID}',_0x8b42e1[_0x5632('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1acf98,'json':!![]};return rp(_0x349e0d);}function startRefreshInterval(_0x46481e){var _0xc9c29a=schedule[_0x5632('0x42')];if(_0xc9c29a[_0x46481e['id']])clearInterval(_0xc9c29a[_0x46481e['id']]);_0xc9c29a[_0x46481e['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x5632('0x43')](this,{'id':_0x46481e['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0xc9c29a;}function startAllRefreshIntervals(){return db[_0x5632('0x36')][_0x5632('0x44')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x5632('0x38')](function(_0xb5bc66){var _0x4becca=_0xb5bc66[_0x5632('0x2d')](function(_0x38c6d2){return refreshOauth2MicrosoftAccessToken(_0x38c6d2)[_0x5632('0x38')](function(_0x3563de){startRefreshInterval(_0x3563de);});});return Promise[_0x5632('0x45')](_0x4becca);})[_0x5632('0x3f')](function(_0x12f63f){var _0x55e620=_0x12f63f?util[_0x5632('0x46')](_0x12f63f,{'showHidden':![],'depth':null}):'';logger[_0x5632('0x47')](_0x5632('0x48'),_0x55e620);});}module[_0x5632('0x49')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval};
\ No newline at end of file
+var _0x1cb3=['response_mode','form_post','scope','state','nonce','prompt','key','value','oauth2Claims','replace','oauth2/','set','decode','payload','iss','issuer','aud','exp','resolve','then','data3','CloudProvider','findOne','data6','POST','data5','access_token','refresh_token','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','findAll','all','catch','inspect','exports','lodash','crypto','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','{TENANT_ID}','data2','code','id_token','from','stringify','base64','randomBytes','toString','hex','client_id','data1','response_type','redirect_uri','data4'];(function(_0x3238ea,_0x91809d){var _0x4aaac2=function(_0xc5b102){while(--_0xc5b102){_0x3238ea['push'](_0x3238ea['shift']());}};_0x4aaac2(++_0x91809d);}(_0x1cb3,0x1c5));var _0x31cb=function(_0x376b0a,_0x34d965){_0x376b0a=_0x376b0a-0x0;var _0x4022e5=_0x1cb3[_0x376b0a];return _0x4022e5;};'use strict';var _=require(_0x31cb('0x0'));var crypto=require(_0x31cb('0x1'));var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require(_0x31cb('0x2'));var rp=require(_0x31cb('0x3'));var util=require(_0x31cb('0x4'));var encryptor=require(_0x31cb('0x5'));var config=require(_0x31cb('0x6'));var logger=require(_0x31cb('0x7'))(_0x31cb('0x8'));var schedule=require(_0x31cb('0x9'));var db=require(_0x31cb('0xa'))['db'];config['redis']=_[_0x31cb('0xb')](config['redis'],{'host':_0x31cb('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x31cb('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x31cb('0xe'),_0x31cb('0xf'),_0x31cb('0x10'),_0x31cb('0x11'),_0x31cb('0x12'),_0x31cb('0x13')],'Dynamics365':[_0x31cb('0x14'),_0x31cb('0x10')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x31cb('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3fb3ad){var _0x207af8=_[_0x31cb('0x16')](AZURE_AUTH_SCOPES[_0x3fb3ad[_0x31cb('0x17')]]);if(_0x3fb3ad[_0x31cb('0x17')]===_0x31cb('0x18'))_0x207af8[_0x31cb('0x19')](_0x3fb3ad[_0x31cb('0x1a')]+_0x31cb('0x1b'));return _0x207af8[_0x31cb('0x1c')]('\x20');}function getAccessTokenScope(_0x4491ec){if(_0x4491ec[_0x31cb('0x17')]===_0x31cb('0x1d'))return _0x31cb('0x11');if(_0x4491ec[_0x31cb('0x17')]===_0x31cb('0x18'))return _0x4491ec[_0x31cb('0x1a')]+_0x31cb('0x1b');}function generateMicrosoftAuthorizationUrl(_0x1696e8,_0x443e1f){var _0x338f24=MICROSOFT_AUTH_URL['replace'](_0x31cb('0x1e'),_0x1696e8[_0x31cb('0x1f')]);var _0x3c7a2d=[_0x31cb('0x20'),_0x31cb('0x21')];var _0x340e5c=Buffer[_0x31cb('0x22')](JSON[_0x31cb('0x23')]({'id':_0x443e1f}))['toString'](_0x31cb('0x24'));var _0x102f2c=crypto[_0x31cb('0x25')](0x10)[_0x31cb('0x26')](_0x31cb('0x27'));var _0x4a7623=getAuthorizationScopes(_0x1696e8);var _0x24c6c1=[{'key':_0x31cb('0x28'),'value':_0x1696e8[_0x31cb('0x29')]},{'key':_0x31cb('0x2a'),'value':encodeURIComponent(_0x3c7a2d[_0x31cb('0x1c')]('\x20'))},{'key':_0x31cb('0x2b'),'value':_0x1696e8[_0x31cb('0x2c')]},{'key':_0x31cb('0x2d'),'value':_0x31cb('0x2e')},{'key':_0x31cb('0x2f'),'value':encodeURIComponent(_0x4a7623)},{'key':_0x31cb('0x30'),'value':_0x340e5c},{'key':_0x31cb('0x31'),'value':_0x102f2c},{'key':_0x31cb('0x32'),'value':'login'}];var _0x3986ca=_0x338f24+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x31cb('0x16')](_0x24c6c1,function(_0x4d7916){return _0x4d7916[_0x31cb('0x33')]+'='+_0x4d7916[_0x31cb('0x34')];})[_0x31cb('0x1c')]('&');_0x1696e8[_0x31cb('0x35')]={'issuer':_0x338f24[_0x31cb('0x36')](_0x31cb('0x37'),''),'audience':_0x1696e8[_0x31cb('0x29')],'state':_0x340e5c,'nonce':_0x102f2c};redis[_0x31cb('0x38')](_0x340e5c,JSON[_0x31cb('0x23')](_0x1696e8));return _0x3986ca;}function isValidIdToken(_0x4f8928,_0x23308e){try{var _0x1bb88f=jwt[_0x31cb('0x39')](_0x4f8928,{'complete':!![]});var _0x37958d=_0x1bb88f[_0x31cb('0x3a')];if(_0x37958d[_0x31cb('0x3b')]!==_0x23308e[_0x31cb('0x3c')])return![];if(_0x37958d[_0x31cb('0x3d')]!==_0x23308e['audience'])return![];if(_0x37958d[_0x31cb('0x31')]!==_0x23308e[_0x31cb('0x31')])return![];if(moment()['isAfter'](moment['unix'](_0x37958d[_0x31cb('0x3e')])))return![];return!![];}catch(_0x3d244f){throw _0x3d244f;}}function refreshOauth2MicrosoftAccessToken(_0x20778b){return Promise[_0x31cb('0x3f')]()[_0x31cb('0x40')](function(){if(_0x20778b[_0x31cb('0x41')])return _0x20778b;return db[_0x31cb('0x42')][_0x31cb('0x43')]({'where':{'id':_0x20778b['id']},'raw':!![]});})[_0x31cb('0x40')](function(_0x539a39){var _0x2f783b={'grant_type':'refresh_token','refresh_token':_0x539a39[_0x31cb('0x44')],'scope':getAccessTokenScope(_0x539a39),'redirect_uri':_0x539a39[_0x31cb('0x2c')],'client_id':_0x539a39[_0x31cb('0x29')],'client_secret':encryptor['decryptString'](_0x539a39[_0x31cb('0x41')])};var _0x351503={'method':_0x31cb('0x45'),'uri':MICROSOFT_AUTH_URL['replace'](_0x31cb('0x1e'),_0x539a39[_0x31cb('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2f783b,'json':!![]};return rp(_0x351503);})['then'](function(_0x523c58){_0x20778b[_0x31cb('0x46')]=_0x523c58[_0x31cb('0x47')];_0x20778b['data6']=_0x523c58[_0x31cb('0x48')];return db[_0x31cb('0x42')]['update']({'data5':_0x20778b['data5'],'data6':_0x20778b['data6']},{'where':{'id':_0x20778b['id']}});})[_0x31cb('0x40')](function(){return _0x20778b;})['catch'](function(_0x4b051b){logger[_0x31cb('0x49')](_0x31cb('0x4a'),_0x20778b['id'],_0x4b051b);});}function getOauth2MicrosoftAccessToken(_0x278ee0,_0x252bc5){var _0x4daf01={'grant_type':_0x31cb('0x4b'),'code':_0x278ee0,'scope':getAccessTokenScope(_0x252bc5),'redirect_uri':_0x252bc5['data4'],'client_id':_0x252bc5[_0x31cb('0x29')],'client_secret':encryptor[_0x31cb('0x4c')](_0x252bc5[_0x31cb('0x41')])};var _0x74ef65={'method':_0x31cb('0x45'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x252bc5['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4daf01,'json':!![]};return rp(_0x74ef65);}function startRefreshInterval(_0x42b767){var _0x38af91=schedule[_0x31cb('0x4d')];if(_0x38af91[_0x42b767['id']])clearInterval(_0x38af91[_0x42b767['id']]);_0x38af91[_0x42b767['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x42b767['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x31cb('0x4d')]=_0x38af91;}function startAllRefreshIntervals(){return db[_0x31cb('0x42')][_0x31cb('0x4e')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x3ecb9c){var _0x14c77a=_0x3ecb9c[_0x31cb('0x16')](function(_0x137ee0){return refreshOauth2MicrosoftAccessToken(_0x137ee0)[_0x31cb('0x40')](function(_0x2cfe03){startRefreshInterval(_0x2cfe03);});});return Promise[_0x31cb('0x4f')](_0x14c77a);})[_0x31cb('0x50')](function(_0x6722c5){var _0x313770=_0x6722c5?util[_0x31cb('0x51')](_0x6722c5,{'showHidden':![],'depth':null}):'';logger['error']('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x313770);});}module[_0x31cb('0x52')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval};
\ No newline at end of file
index 5da7a9a..6deeb70 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f56=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x205e83,_0x2df5a4){var _0x10bb19=function(_0x41a375){while(--_0x41a375){_0x205e83['push'](_0x205e83['shift']());}};_0x10bb19(++_0x2df5a4);}(_0x2f56,0xb5));var _0x62f5=function(_0x2dcb74,_0x52d244){_0x2dcb74=_0x2dcb74-0x0;var _0x2381f=_0x2f56[_0x2dcb74];return _0x2381f;};'use strict';var _=require(_0x62f5('0x0'));var util=require(_0x62f5('0x1'));var moment=require(_0x62f5('0x2'));var BPromise=require(_0x62f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62f5('0x4'));var db=require(_0x62f5('0x5'))['db'];var utils=require(_0x62f5('0x6'));var logger=require(_0x62f5('0x7'))(_0x62f5('0x8'));var config=require('../../config/environment');var jayson=require(_0x62f5('0x9'));var client=jayson[_0x62f5('0xa')][_0x62f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x387150,_0x58ae99,_0x3ee814){return new BPromise(function(_0xc11beb,_0x505bfd){return client[_0x62f5('0xc')](_0x387150,_0x3ee814)[_0x62f5('0xd')](function(_0x4a3621){logger[_0x62f5('0xe')](_0x62f5('0xf'),_0x58ae99,_0x62f5('0x10'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x58ae99,_0x62f5('0x10'),JSON[_0x62f5('0x11')](_0x4a3621));if(_0x4a3621[_0x62f5('0x12')]){if(_0x4a3621[_0x62f5('0x12')][_0x62f5('0x13')]===0x1f4){logger[_0x62f5('0x12')](_0x62f5('0xf'),_0x58ae99,_0x4a3621['error'][_0x62f5('0x14')]);return _0x505bfd(_0x4a3621['error'][_0x62f5('0x14')]);}logger[_0x62f5('0x12')](_0x62f5('0xf'),_0x58ae99,_0x4a3621[_0x62f5('0x12')]['message']);return _0xc11beb(_0x4a3621[_0x62f5('0x12')]['message']);}else{logger[_0x62f5('0xe')](_0x62f5('0xf'),_0x58ae99,_0x62f5('0x10'));_0xc11beb(_0x4a3621[_0x62f5('0x15')][_0x62f5('0x14')]);}})[_0x62f5('0x16')](function(_0x2756cb){logger[_0x62f5('0x12')]('CloudProvider,\x20%s,\x20%s',_0x58ae99,_0x2756cb);_0x505bfd(_0x2756cb);});});}
\ No newline at end of file
+var _0xcabe=['http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x9f6f12,_0x1714e9){var _0x59f2ce=function(_0x4e1b76){while(--_0x4e1b76){_0x9f6f12['push'](_0x9f6f12['shift']());}};_0x59f2ce(++_0x1714e9);}(_0xcabe,0x1ef));var _0xecab=function(_0x1a6b16,_0x16d90f){_0x1a6b16=_0x1a6b16-0x0;var _0x2dc283=_0xcabe[_0x1a6b16];return _0x2dc283;};'use strict';var _=require(_0xecab('0x0'));var util=require('util');var moment=require(_0xecab('0x1'));var BPromise=require(_0xecab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecab('0x3'));var db=require(_0xecab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xecab('0x5'))(_0xecab('0x6'));var config=require(_0xecab('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xecab('0x8')][_0xecab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x105562,_0xbfa4bf,_0x1ead3d){return new BPromise(function(_0x2bd7c7,_0x88f839){return client[_0xecab('0xa')](_0x105562,_0x1ead3d)[_0xecab('0xb')](function(_0x5f2db6){logger['info'](_0xecab('0xc'),_0xbfa4bf,_0xecab('0xd'));logger['debug'](_0xecab('0xe'),_0xbfa4bf,_0xecab('0xd'),JSON[_0xecab('0xf')](_0x5f2db6));if(_0x5f2db6[_0xecab('0x10')]){if(_0x5f2db6[_0xecab('0x10')][_0xecab('0x11')]===0x1f4){logger['error'](_0xecab('0xc'),_0xbfa4bf,_0x5f2db6[_0xecab('0x10')][_0xecab('0x12')]);return _0x88f839(_0x5f2db6[_0xecab('0x10')][_0xecab('0x12')]);}logger[_0xecab('0x10')]('CloudProvider,\x20%s,\x20%s',_0xbfa4bf,_0x5f2db6[_0xecab('0x10')]['message']);return _0x2bd7c7(_0x5f2db6['error'][_0xecab('0x12')]);}else{logger[_0xecab('0x13')](_0xecab('0xc'),_0xbfa4bf,_0xecab('0xd'));_0x2bd7c7(_0x5f2db6['result'][_0xecab('0x12')]);}})[_0xecab('0x14')](function(_0x260a09){logger[_0xecab('0x10')](_0xecab('0xc'),_0xbfa4bf,_0x260a09);_0x88f839(_0x260a09);});});}
\ No newline at end of file
index b41e0a9..b12f40c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x182822,_0x3df902){_0x182822=_0x182822-0x0;var _0x3041af=_0x5f2f[_0x182822];return _0x3041af;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router;
\ No newline at end of file
+var _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x5d215a,_0x3ffa61){var _0x433189=function(_0x342f7c){while(--_0x342f7c){_0x5d215a['push'](_0x5d215a['shift']());}};_0x433189(++_0x3ffa61);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router;
\ No newline at end of file
index b7a7261..6a7057c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7234=['STRING','name','sequelize','exports'];(function(_0xdf8902,_0x3cac9e){var _0x3ff84d=function(_0x13a055){while(--_0x13a055){_0xdf8902['push'](_0xdf8902['shift']());}};_0x3ff84d(++_0x3cac9e);}(_0x7234,0x172));var _0x4723=function(_0x12f4d8,_0x1f6d82){_0x12f4d8=_0x12f4d8-0x0;var _0x265413=_0x7234[_0x12f4d8];return _0x265413;};'use strict';var Sequelize=require(_0x4723('0x0'));module[_0x4723('0x1')]={'name':{'type':Sequelize[_0x4723('0x2')],'unique':_0x4723('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4723('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x4723('0x2')]},'phone':{'type':Sequelize[_0x4723('0x2')]},'fax':{'type':Sequelize[_0x4723('0x2')]},'type':{'type':Sequelize[_0x4723('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x4723('0x2')]},'city':{'type':Sequelize[_0x4723('0x2')]},'country':{'type':Sequelize[_0x4723('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x4723('0x2')]},'sStreet':{'type':Sequelize[_0x4723('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x4723('0x2')]},'sCountry':{'type':Sequelize[_0x4723('0x2')]},'description':{'type':Sequelize[_0x4723('0x2')]}};
\ No newline at end of file
+var _0xa85b=['exports','STRING','name'];(function(_0x3e8d79,_0x2e11f7){var _0x5c8377=function(_0x46d934){while(--_0x46d934){_0x3e8d79['push'](_0x3e8d79['shift']());}};_0x5c8377(++_0x2e11f7);}(_0xa85b,0x12c));var _0xba85=function(_0xc1eec0,_0x61e231){_0xc1eec0=_0xc1eec0-0x0;var _0x1e0d6a=_0xa85b[_0xc1eec0];return _0x1e0d6a;};'use strict';var Sequelize=require('sequelize');module[_0xba85('0x0')]={'name':{'type':Sequelize[_0xba85('0x1')],'unique':_0xba85('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xba85('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xba85('0x1')]},'phone':{'type':Sequelize[_0xba85('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xba85('0x1')]},'street':{'type':Sequelize[_0xba85('0x1')]},'postalCode':{'type':Sequelize[_0xba85('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xba85('0x1')]},'email':{'type':Sequelize[_0xba85('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xba85('0x1')]},'sStreet':{'type':Sequelize[_0xba85('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xba85('0x1')]},'description':{'type':Sequelize[_0xba85('0x1')]}};
\ No newline at end of file
index 2a2a418..1ecb1d0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf678=['map','filter','options','count','includeAll','include','catch','show','rawAttributes','merge','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','ids','findOne','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','destroy','Companies','sendStatus','stack','name','send','index','CmCompany','describe','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters'];(function(_0x50e0bd,_0x56bf33){var _0x2c9f28=function(_0x5d30bd){while(--_0x5d30bd){_0x50e0bd['push'](_0x50e0bd['shift']());}};_0x2c9f28(++_0x56bf33);}(_0xf678,0x1c4));var _0x8f67=function(_0x20b6bf,_0x5cb7b1){_0x20b6bf=_0x20b6bf-0x0;var _0x3f6db7=_0xf678[_0x20b6bf];return _0x3f6db7;};'use strict';var emlformat=require(_0x8f67('0x0'));var rimraf=require(_0x8f67('0x1'));var zipdir=require(_0x8f67('0x2'));var jsonpatch=require(_0x8f67('0x3'));var rp=require('request-promise');var moment=require(_0x8f67('0x4'));var BPromise=require(_0x8f67('0x5'));var Mustache=require(_0x8f67('0x6'));var util=require('util');var path=require(_0x8f67('0x7'));var sox=require(_0x8f67('0x8'));var csv=require(_0x8f67('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f67('0xa'));var squel=require(_0x8f67('0xb'));var crypto=require(_0x8f67('0xc'));var jsforce=require(_0x8f67('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8f67('0xe'));var Papa=require(_0x8f67('0xf'));var Redis=require('ioredis');var authService=require(_0x8f67('0x10'));var qs=require(_0x8f67('0x11'));var as=require(_0x8f67('0x12'));var hardwareService=require(_0x8f67('0x13'));var logger=require(_0x8f67('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8f67('0x15'));var licenseUtil=require(_0x8f67('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x474f10,_0x2f6f91){_0x2f6f91=_0x2f6f91||0xcc;return function(_0x2cf0d3){if(_0x2cf0d3){return _0x474f10['sendStatus'](_0x2f6f91);}return _0x474f10[_0x8f67('0x17')](_0x2f6f91)[_0x8f67('0x18')]();};}function respondWithResult(_0x4a92fd,_0xd48919){_0xd48919=_0xd48919||0xc8;return function(_0x3866e7){if(_0x3866e7){return _0x4a92fd[_0x8f67('0x17')](_0xd48919)['json'](_0x3866e7);}};}function respondWithFilteredResult(_0x5abad1,_0x28b3c1){return function(_0xe7b4a9){if(_0xe7b4a9){var _0x15a63c=typeof _0x28b3c1[_0x8f67('0x19')]===_0x8f67('0x1a')&&typeof _0x28b3c1[_0x8f67('0x1b')]===_0x8f67('0x1a');var _0x2f5009=_0xe7b4a9['count'];var _0x3b83e8=_0x15a63c?0x0:_0x28b3c1[_0x8f67('0x19')];var _0x4443f9=_0x15a63c?_0xe7b4a9['count']:_0x28b3c1[_0x8f67('0x19')]+_0x28b3c1['limit'];var _0x26a651;if(_0x4443f9>=_0x2f5009){_0x4443f9=_0x2f5009;_0x26a651=0xc8;}else{_0x26a651=0xce;}_0x5abad1['status'](_0x26a651);return _0x5abad1['set'](_0x8f67('0x1c'),_0x3b83e8+'-'+_0x4443f9+'/'+_0x2f5009)[_0x8f67('0x1d')](_0xe7b4a9);}return null;};}function patchUpdates(_0x3fc552){return function(_0x1c60a5){try{jsonpatch[_0x8f67('0x1e')](_0x1c60a5,_0x3fc552,!![]);}catch(_0x89b71d){return BPromise[_0x8f67('0x1f')](_0x89b71d);}return _0x1c60a5[_0x8f67('0x20')]();};}function saveUpdates(_0x40d273,_0x53c7e2){return function(_0x2d3d2c){if(_0x2d3d2c){return _0x2d3d2c[_0x8f67('0x21')](_0x40d273)[_0x8f67('0x22')](function(_0x5ed3f7){return _0x5ed3f7;});}return null;};}function removeEntity(_0x139de8,_0x17f5dd){return function(_0x51d3f3){if(_0x51d3f3){return _0x51d3f3[_0x8f67('0x23')]()['then'](function(){var _0x205a70=_0x51d3f3['get']({'plain':!![]});var _0x5e4979=_0x8f67('0x24');return db['UserProfileResource'][_0x8f67('0x23')]({'where':{'type':_0x5e4979,'resourceId':_0x205a70['id']}})[_0x8f67('0x22')](function(){return _0x51d3f3;});})['then'](function(){_0x139de8['status'](0xcc)[_0x8f67('0x18')]();});}};}function handleEntityNotFound(_0x1f52f1,_0x864cdf){return function(_0x104e44){if(!_0x104e44){_0x1f52f1[_0x8f67('0x25')](0x194);}return _0x104e44;};}function handleError(_0x442755,_0x102964){_0x102964=_0x102964||0x1f4;return function(_0x27d686){logger['error'](_0x27d686[_0x8f67('0x26')]);if(_0x27d686[_0x8f67('0x27')]){delete _0x27d686[_0x8f67('0x27')];}_0x442755[_0x8f67('0x17')](_0x102964)[_0x8f67('0x28')](_0x27d686);};}exports[_0x8f67('0x29')]=function(_0x11d73c,_0x27a2c8){var _0x53e622={},_0x4d868c={},_0x50d848={'count':0x0,'rows':[]};return db[_0x8f67('0x2a')][_0x8f67('0x2b')]()[_0x8f67('0x22')](function(_0x382a05){_0x4d868c[_0x8f67('0x2c')]=_['keys'](_0x382a05);_0x4d868c[_0x8f67('0x2d')]=_[_0x8f67('0x2e')](_0x11d73c['query']);_0x4d868c['filters']=_[_0x8f67('0x2f')](_0x4d868c[_0x8f67('0x2c')],_0x4d868c[_0x8f67('0x2d')]);_0x53e622[_0x8f67('0x30')]=_['intersection'](_0x4d868c['model'],qs[_0x8f67('0x31')](_0x11d73c[_0x8f67('0x2d')][_0x8f67('0x31')]));_0x53e622[_0x8f67('0x30')]=_0x53e622[_0x8f67('0x30')][_0x8f67('0x32')]?_0x53e622[_0x8f67('0x30')]:_0x4d868c[_0x8f67('0x2c')];if(!_0x11d73c[_0x8f67('0x2d')][_0x8f67('0x33')](_0x8f67('0x34'))){_0x53e622[_0x8f67('0x1b')]=qs[_0x8f67('0x1b')](_0x11d73c[_0x8f67('0x2d')][_0x8f67('0x1b')]);_0x53e622[_0x8f67('0x19')]=qs[_0x8f67('0x19')](_0x11d73c[_0x8f67('0x2d')][_0x8f67('0x19')]);}_0x53e622[_0x8f67('0x35')]=qs[_0x8f67('0x36')](_0x11d73c[_0x8f67('0x2d')][_0x8f67('0x36')]);_0x53e622[_0x8f67('0x37')]=qs['filters'](_[_0x8f67('0x38')](_0x11d73c[_0x8f67('0x2d')],_0x4d868c[_0x8f67('0x39')]),_0x382a05);if(_0x11d73c['query']['filter']){_0x53e622[_0x8f67('0x37')]=_['merge'](_0x53e622['where'],{'$or':_[_0x8f67('0x3a')](_0x53e622[_0x8f67('0x30')],function(_0x1db04f){var _0x545e7e={};_0x545e7e[_0x1db04f]={'$like':'%'+_0x11d73c[_0x8f67('0x2d')][_0x8f67('0x3b')]+'%'};return _0x545e7e;})});}_0x53e622=_['merge']({},_0x53e622,_0x11d73c[_0x8f67('0x3c')]);var _0x91af6d={'where':_0x53e622['where']};return db[_0x8f67('0x2a')]['count'](_0x91af6d)[_0x8f67('0x22')](function(_0x4bcdfd){_0x50d848[_0x8f67('0x3d')]=_0x4bcdfd;if(_0x11d73c[_0x8f67('0x2d')][_0x8f67('0x3e')]){_0x53e622[_0x8f67('0x3f')]=[{'all':!![]}];}return db[_0x8f67('0x2a')]['findAll'](_0x53e622);})[_0x8f67('0x22')](function(_0x54119b){_0x50d848['rows']=_0x54119b;return _0x50d848;})['then'](respondWithFilteredResult(_0x27a2c8,_0x53e622))['catch'](handleError(_0x27a2c8,null));})[_0x8f67('0x40')](handleError(_0x27a2c8,null));};exports[_0x8f67('0x41')]=function(_0x3011b8,_0x43227c){var _0x596937={'raw':![],'where':{'id':_0x3011b8['params']['id']}},_0x2f5848={};_0x2f5848['model']=_[_0x8f67('0x2e')](db[_0x8f67('0x2a')][_0x8f67('0x42')]);_0x2f5848[_0x8f67('0x2d')]=_['keys'](_0x3011b8[_0x8f67('0x2d')]);_0x2f5848[_0x8f67('0x39')]=_[_0x8f67('0x2f')](_0x2f5848[_0x8f67('0x2c')],_0x2f5848[_0x8f67('0x2d')]);_0x596937['attributes']=_[_0x8f67('0x2f')](_0x2f5848[_0x8f67('0x2c')],qs[_0x8f67('0x31')](_0x3011b8[_0x8f67('0x2d')][_0x8f67('0x31')]));_0x596937['attributes']=_0x596937[_0x8f67('0x30')][_0x8f67('0x32')]?_0x596937[_0x8f67('0x30')]:_0x2f5848[_0x8f67('0x2c')];if(_0x3011b8[_0x8f67('0x2d')][_0x8f67('0x3e')]){_0x596937[_0x8f67('0x3f')]=[{'all':!![]}];}_0x596937=_[_0x8f67('0x43')]({},_0x596937,_0x3011b8[_0x8f67('0x3c')]);return db[_0x8f67('0x2a')][_0x8f67('0x44')](_0x596937)[_0x8f67('0x22')](handleEntityNotFound(_0x43227c,null))[_0x8f67('0x22')](respondWithResult(_0x43227c,null))[_0x8f67('0x40')](handleError(_0x43227c,null));};exports[_0x8f67('0x45')]=function(_0x35a6a9,_0x544039){return db[_0x8f67('0x2a')]['create'](_0x35a6a9[_0x8f67('0x46')],{})[_0x8f67('0x22')](function(_0x422fc6){var _0x47cbb7=_0x35a6a9['user'][_0x8f67('0x47')]({'plain':!![]});if(!_0x47cbb7)throw new Error(_0x8f67('0x48'));if(_0x47cbb7[_0x8f67('0x49')]==='user'){var _0xa1d514=_0x422fc6[_0x8f67('0x47')]({'plain':!![]});var _0x4033cd='Companies';return db[_0x8f67('0x4a')][_0x8f67('0x44')]({'where':{'name':_0x4033cd,'userProfileId':_0x47cbb7['userProfileId']},'raw':!![]})['then'](function(_0x54a595){if(_0x54a595&&_0x54a595[_0x8f67('0x4b')]===0x0){return db[_0x8f67('0x4c')]['create']({'name':_0xa1d514[_0x8f67('0x27')],'resourceId':_0xa1d514['id'],'type':_0x54a595[_0x8f67('0x27')],'sectionId':_0x54a595['id']},{})['then'](function(){return _0x422fc6;});}else{return _0x422fc6;}})[_0x8f67('0x40')](function(_0x154ee8){logger[_0x8f67('0x4d')](_0x8f67('0x4e'),_0x154ee8);throw _0x154ee8;});}return _0x422fc6;})[_0x8f67('0x22')](respondWithResult(_0x544039,0xc9))[_0x8f67('0x40')](handleError(_0x544039,null));};exports[_0x8f67('0x21')]=function(_0x93b4e9,_0x5d4c51){if(_0x93b4e9[_0x8f67('0x46')]['id']){delete _0x93b4e9[_0x8f67('0x46')]['id'];}return db[_0x8f67('0x2a')][_0x8f67('0x44')]({'where':{'id':_0x93b4e9[_0x8f67('0x4f')]['id']}})[_0x8f67('0x22')](handleEntityNotFound(_0x5d4c51,null))[_0x8f67('0x22')](saveUpdates(_0x93b4e9[_0x8f67('0x46')],null))[_0x8f67('0x22')](respondWithResult(_0x5d4c51,null))[_0x8f67('0x40')](handleError(_0x5d4c51,null));};exports['destroy']=function(_0xa830b8,_0x339a43){return db[_0x8f67('0x2a')][_0x8f67('0x44')]({'where':{'id':_0xa830b8[_0x8f67('0x4f')]['id']}})[_0x8f67('0x22')](handleEntityNotFound(_0x339a43,null))[_0x8f67('0x22')](removeEntity(_0x339a43,null))['catch'](handleError(_0x339a43,null));};exports[_0x8f67('0x2b')]=function(_0x5aa764,_0x3ce6d5){return db[_0x8f67('0x2a')][_0x8f67('0x2b')]()['then'](respondWithResult(_0x3ce6d5,null))[_0x8f67('0x40')](handleError(_0x3ce6d5,null));};exports[_0x8f67('0x50')]=function(_0x2123c1,_0x38352f,_0x465eed){return db[_0x8f67('0x51')][_0x8f67('0x44')]({'where':{'id':_0x2123c1['params']['id']}})[_0x8f67('0x22')](handleEntityNotFound(_0x38352f,null))[_0x8f67('0x22')](function(_0x523df3){if(_0x523df3){return _0x523df3[_0x8f67('0x50')](_0x2123c1[_0x8f67('0x46')][_0x8f67('0x52')],_['omit'](_0x2123c1[_0x8f67('0x46')],[_0x8f67('0x52'),'id'])||{});}})['then'](respondWithResult(_0x38352f,null))['catch'](handleError(_0x38352f,null));};exports['getContacts']=function(_0x5d995e,_0x1234f6,_0x12d061){var _0x5495d4={};var _0x1ee2f4={};var _0x2d1d6b;var _0x1c973c;return db[_0x8f67('0x2a')][_0x8f67('0x53')]({'where':{'id':_0x5d995e[_0x8f67('0x4f')]['id']}})[_0x8f67('0x22')](handleEntityNotFound(_0x1234f6,null))[_0x8f67('0x22')](function(_0x607ba3){if(_0x607ba3){_0x2d1d6b=_0x607ba3;_0x1ee2f4[_0x8f67('0x2c')]=_['keys'](db['CmContact'][_0x8f67('0x42')]);_0x1ee2f4[_0x8f67('0x2d')]=_[_0x8f67('0x2e')](_0x5d995e[_0x8f67('0x2d')]);_0x1ee2f4[_0x8f67('0x39')]=_[_0x8f67('0x2f')](_0x1ee2f4[_0x8f67('0x2c')],_0x1ee2f4['query']);_0x5495d4[_0x8f67('0x30')]=_[_0x8f67('0x2f')](_0x1ee2f4[_0x8f67('0x2c')],qs['fields'](_0x5d995e[_0x8f67('0x2d')][_0x8f67('0x31')]));_0x5495d4['attributes']=_0x5495d4['attributes'][_0x8f67('0x32')]?_0x5495d4[_0x8f67('0x30')]:_0x1ee2f4[_0x8f67('0x2c')];_0x5495d4[_0x8f67('0x35')]=qs[_0x8f67('0x36')](_0x5d995e[_0x8f67('0x2d')]['sort']);_0x5495d4[_0x8f67('0x37')]=qs['filters'](_['pick'](_0x5d995e['query'],_0x1ee2f4['filters']));if(_0x5d995e['query'][_0x8f67('0x3b')]){_0x5495d4['where']=_[_0x8f67('0x43')](_0x5495d4[_0x8f67('0x37')],{'$or':_['map'](_0x5495d4[_0x8f67('0x30')],function(_0x23337a){var _0xe6feb5={};_0xe6feb5[_0x23337a]={'$like':'%'+_0x5d995e[_0x8f67('0x2d')][_0x8f67('0x3b')]+'%'};return _0xe6feb5;})});}_0x5495d4=_[_0x8f67('0x43')]({},_0x5495d4,_0x5d995e[_0x8f67('0x3c')]);return _0x2d1d6b[_0x8f67('0x54')](_0x5495d4);}})[_0x8f67('0x22')](function(_0x35e4ea){if(_0x35e4ea){_0x1c973c=_0x35e4ea[_0x8f67('0x32')];if(!_0x5d995e[_0x8f67('0x2d')][_0x8f67('0x33')](_0x8f67('0x34'))){_0x5495d4[_0x8f67('0x1b')]=qs[_0x8f67('0x1b')](_0x5d995e[_0x8f67('0x2d')][_0x8f67('0x1b')]);_0x5495d4[_0x8f67('0x19')]=qs[_0x8f67('0x19')](_0x5d995e[_0x8f67('0x2d')][_0x8f67('0x19')]);}return _0x2d1d6b[_0x8f67('0x54')](_0x5495d4);}})['then'](function(_0x2268e5){if(_0x2268e5){return _0x2268e5?{'count':_0x1c973c,'rows':_0x2268e5}:null;}})['then'](respondWithResult(_0x1234f6,null))[_0x8f67('0x40')](handleError(_0x1234f6,null));};
\ No newline at end of file
+var _0x1a15=['count','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','addContacts','CmContact','ids','getContacts','order','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','reject','save','then','destroy','get','Companies','error','stack','name','CmCompany','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','map','options'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a15,0xc0));var _0x51a1=function(_0x6d3979,_0x100e01){_0x6d3979=_0x6d3979-0x0;var _0x42e5b1=_0x1a15[_0x6d3979];return _0x42e5b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x51a1('0x0'));var zipdir=require(_0x51a1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51a1('0x2'));var moment=require(_0x51a1('0x3'));var BPromise=require(_0x51a1('0x4'));var Mustache=require(_0x51a1('0x5'));var util=require(_0x51a1('0x6'));var path=require(_0x51a1('0x7'));var sox=require(_0x51a1('0x8'));var csv=require(_0x51a1('0x9'));var ejs=require(_0x51a1('0xa'));var fs=require('fs');var fs_extra=require(_0x51a1('0xb'));var _=require(_0x51a1('0xc'));var squel=require(_0x51a1('0xd'));var crypto=require(_0x51a1('0xe'));var jsforce=require(_0x51a1('0xf'));var deskjs=require(_0x51a1('0x10'));var toCsv=require(_0x51a1('0x9'));var querystring=require('querystring');var Papa=require(_0x51a1('0x11'));var Redis=require(_0x51a1('0x12'));var authService=require(_0x51a1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x51a1('0x14'));var hardwareService=require(_0x51a1('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x51a1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x51a1('0x17'));var db=require(_0x51a1('0x18'))['db'];function respondWithStatusCode(_0x283cc3,_0x583558){_0x583558=_0x583558||0xcc;return function(_0x3afa66){if(_0x3afa66){return _0x283cc3[_0x51a1('0x19')](_0x583558);}return _0x283cc3[_0x51a1('0x1a')](_0x583558)[_0x51a1('0x1b')]();};}function respondWithResult(_0x16009a,_0x2900d1){_0x2900d1=_0x2900d1||0xc8;return function(_0x44ad94){if(_0x44ad94){return _0x16009a[_0x51a1('0x1a')](_0x2900d1)[_0x51a1('0x1c')](_0x44ad94);}};}function respondWithFilteredResult(_0x3979fe,_0x184172){return function(_0x4d727d){if(_0x4d727d){var _0xb18e87=typeof _0x184172[_0x51a1('0x1d')]===_0x51a1('0x1e')&&typeof _0x184172[_0x51a1('0x1f')]==='undefined';var _0xe58fa9=_0x4d727d['count'];var _0x4e826f=_0xb18e87?0x0:_0x184172[_0x51a1('0x1d')];var _0x484aa3=_0xb18e87?_0x4d727d['count']:_0x184172[_0x51a1('0x1d')]+_0x184172[_0x51a1('0x1f')];var _0x33313b;if(_0x484aa3>=_0xe58fa9){_0x484aa3=_0xe58fa9;_0x33313b=0xc8;}else{_0x33313b=0xce;}_0x3979fe[_0x51a1('0x1a')](_0x33313b);return _0x3979fe['set'](_0x51a1('0x20'),_0x4e826f+'-'+_0x484aa3+'/'+_0xe58fa9)[_0x51a1('0x1c')](_0x4d727d);}return null;};}function patchUpdates(_0x47ee2c){return function(_0x24686c){try{jsonpatch['apply'](_0x24686c,_0x47ee2c,!![]);}catch(_0xae045d){return BPromise[_0x51a1('0x21')](_0xae045d);}return _0x24686c[_0x51a1('0x22')]();};}function saveUpdates(_0x411856,_0x14cc90){return function(_0x3d4434){if(_0x3d4434){return _0x3d4434['update'](_0x411856)[_0x51a1('0x23')](function(_0x76f216){return _0x76f216;});}return null;};}function removeEntity(_0x54e52d,_0x3307b8){return function(_0x40c0bc){if(_0x40c0bc){return _0x40c0bc[_0x51a1('0x24')]()[_0x51a1('0x23')](function(){var _0x292002=_0x40c0bc[_0x51a1('0x25')]({'plain':!![]});var _0x11c774=_0x51a1('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x11c774,'resourceId':_0x292002['id']}})[_0x51a1('0x23')](function(){return _0x40c0bc;});})[_0x51a1('0x23')](function(){_0x54e52d[_0x51a1('0x1a')](0xcc)[_0x51a1('0x1b')]();});}};}function handleEntityNotFound(_0x2a78d3,_0x154681){return function(_0x2f6f1e){if(!_0x2f6f1e){_0x2a78d3[_0x51a1('0x19')](0x194);}return _0x2f6f1e;};}function handleError(_0x9a30c2,_0xbb4508){_0xbb4508=_0xbb4508||0x1f4;return function(_0x44f4c5){logger[_0x51a1('0x27')](_0x44f4c5[_0x51a1('0x28')]);if(_0x44f4c5[_0x51a1('0x29')]){delete _0x44f4c5[_0x51a1('0x29')];}_0x9a30c2[_0x51a1('0x1a')](_0xbb4508)['send'](_0x44f4c5);};}exports['index']=function(_0x2159d7,_0x4129d8){var _0x50ab8a={},_0x9065c={},_0x406b4b={'count':0x0,'rows':[]};return db[_0x51a1('0x2a')]['describe']()['then'](function(_0x19d6c2){_0x9065c[_0x51a1('0x2b')]=_[_0x51a1('0x2c')](_0x19d6c2);_0x9065c['query']=_[_0x51a1('0x2c')](_0x2159d7[_0x51a1('0x2d')]);_0x9065c['filters']=_[_0x51a1('0x2e')](_0x9065c[_0x51a1('0x2b')],_0x9065c['query']);_0x50ab8a['attributes']=_['intersection'](_0x9065c[_0x51a1('0x2b')],qs[_0x51a1('0x2f')](_0x2159d7[_0x51a1('0x2d')]['fields']));_0x50ab8a[_0x51a1('0x30')]=_0x50ab8a[_0x51a1('0x30')][_0x51a1('0x31')]?_0x50ab8a[_0x51a1('0x30')]:_0x9065c[_0x51a1('0x2b')];if(!_0x2159d7['query'][_0x51a1('0x32')](_0x51a1('0x33'))){_0x50ab8a[_0x51a1('0x1f')]=qs['limit'](_0x2159d7[_0x51a1('0x2d')][_0x51a1('0x1f')]);_0x50ab8a[_0x51a1('0x1d')]=qs[_0x51a1('0x1d')](_0x2159d7[_0x51a1('0x2d')][_0x51a1('0x1d')]);}_0x50ab8a['order']=qs[_0x51a1('0x34')](_0x2159d7[_0x51a1('0x2d')][_0x51a1('0x34')]);_0x50ab8a['where']=qs['filters'](_[_0x51a1('0x35')](_0x2159d7[_0x51a1('0x2d')],_0x9065c[_0x51a1('0x36')]),_0x19d6c2);if(_0x2159d7[_0x51a1('0x2d')][_0x51a1('0x37')]){_0x50ab8a['where']=_[_0x51a1('0x38')](_0x50ab8a[_0x51a1('0x39')],{'$or':_[_0x51a1('0x3a')](_0x50ab8a[_0x51a1('0x30')],function(_0x4ff37d){var _0x16a6dc={};_0x16a6dc[_0x4ff37d]={'$like':'%'+_0x2159d7[_0x51a1('0x2d')][_0x51a1('0x37')]+'%'};return _0x16a6dc;})});}_0x50ab8a=_[_0x51a1('0x38')]({},_0x50ab8a,_0x2159d7[_0x51a1('0x3b')]);var _0x2bb284={'where':_0x50ab8a['where']};return db[_0x51a1('0x2a')][_0x51a1('0x3c')](_0x2bb284)[_0x51a1('0x23')](function(_0x6ecb38){_0x406b4b[_0x51a1('0x3c')]=_0x6ecb38;if(_0x2159d7['query'][_0x51a1('0x3d')]){_0x50ab8a[_0x51a1('0x3e')]=[{'all':!![]}];}return db[_0x51a1('0x2a')][_0x51a1('0x3f')](_0x50ab8a);})[_0x51a1('0x23')](function(_0x90164e){_0x406b4b['rows']=_0x90164e;return _0x406b4b;})[_0x51a1('0x23')](respondWithFilteredResult(_0x4129d8,_0x50ab8a))[_0x51a1('0x40')](handleError(_0x4129d8,null));})[_0x51a1('0x40')](handleError(_0x4129d8,null));};exports[_0x51a1('0x41')]=function(_0x4ea5be,_0x962d9){var _0x5b253d={'raw':![],'where':{'id':_0x4ea5be[_0x51a1('0x42')]['id']}},_0x1d276c={};_0x1d276c['model']=_[_0x51a1('0x2c')](db[_0x51a1('0x2a')][_0x51a1('0x43')]);_0x1d276c[_0x51a1('0x2d')]=_[_0x51a1('0x2c')](_0x4ea5be[_0x51a1('0x2d')]);_0x1d276c[_0x51a1('0x36')]=_[_0x51a1('0x2e')](_0x1d276c[_0x51a1('0x2b')],_0x1d276c[_0x51a1('0x2d')]);_0x5b253d[_0x51a1('0x30')]=_[_0x51a1('0x2e')](_0x1d276c[_0x51a1('0x2b')],qs[_0x51a1('0x2f')](_0x4ea5be[_0x51a1('0x2d')][_0x51a1('0x2f')]));_0x5b253d['attributes']=_0x5b253d['attributes']['length']?_0x5b253d[_0x51a1('0x30')]:_0x1d276c[_0x51a1('0x2b')];if(_0x4ea5be[_0x51a1('0x2d')]['includeAll']){_0x5b253d[_0x51a1('0x3e')]=[{'all':!![]}];}_0x5b253d=_[_0x51a1('0x38')]({},_0x5b253d,_0x4ea5be[_0x51a1('0x3b')]);return db[_0x51a1('0x2a')]['find'](_0x5b253d)['then'](handleEntityNotFound(_0x962d9,null))['then'](respondWithResult(_0x962d9,null))[_0x51a1('0x40')](handleError(_0x962d9,null));};exports[_0x51a1('0x44')]=function(_0x18bb9a,_0x15fd9e){return db['CmCompany'][_0x51a1('0x44')](_0x18bb9a[_0x51a1('0x45')],{})[_0x51a1('0x23')](function(_0x862f97){var _0x12a96f=_0x18bb9a[_0x51a1('0x46')][_0x51a1('0x25')]({'plain':!![]});if(!_0x12a96f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12a96f[_0x51a1('0x47')]==='user'){var _0x5a69ab=_0x862f97[_0x51a1('0x25')]({'plain':!![]});var _0x45ce6e=_0x51a1('0x26');return db[_0x51a1('0x48')]['find']({'where':{'name':_0x45ce6e,'userProfileId':_0x12a96f[_0x51a1('0x49')]},'raw':!![]})['then'](function(_0x58b120){if(_0x58b120&&_0x58b120[_0x51a1('0x4a')]===0x0){return db['UserProfileResource'][_0x51a1('0x44')]({'name':_0x5a69ab[_0x51a1('0x29')],'resourceId':_0x5a69ab['id'],'type':_0x58b120[_0x51a1('0x29')],'sectionId':_0x58b120['id']},{})[_0x51a1('0x23')](function(){return _0x862f97;});}else{return _0x862f97;}})['catch'](function(_0x1cc83a){logger[_0x51a1('0x27')](_0x51a1('0x4b'),_0x1cc83a);throw _0x1cc83a;});}return _0x862f97;})[_0x51a1('0x23')](respondWithResult(_0x15fd9e,0xc9))[_0x51a1('0x40')](handleError(_0x15fd9e,null));};exports[_0x51a1('0x4c')]=function(_0x1b418b,_0x154a55){if(_0x1b418b[_0x51a1('0x45')]['id']){delete _0x1b418b['body']['id'];}return db['CmCompany'][_0x51a1('0x4d')]({'where':{'id':_0x1b418b[_0x51a1('0x42')]['id']}})[_0x51a1('0x23')](handleEntityNotFound(_0x154a55,null))['then'](saveUpdates(_0x1b418b[_0x51a1('0x45')],null))[_0x51a1('0x23')](respondWithResult(_0x154a55,null))[_0x51a1('0x40')](handleError(_0x154a55,null));};exports[_0x51a1('0x24')]=function(_0x1d1eb7,_0x50ab4c){return db[_0x51a1('0x2a')][_0x51a1('0x4d')]({'where':{'id':_0x1d1eb7[_0x51a1('0x42')]['id']}})['then'](handleEntityNotFound(_0x50ab4c,null))[_0x51a1('0x23')](removeEntity(_0x50ab4c,null))[_0x51a1('0x40')](handleError(_0x50ab4c,null));};exports['describe']=function(_0x21cf90,_0x26724d){return db[_0x51a1('0x2a')][_0x51a1('0x4e')]()[_0x51a1('0x23')](respondWithResult(_0x26724d,null))['catch'](handleError(_0x26724d,null));};exports[_0x51a1('0x4f')]=function(_0x4257b7,_0x4393a1,_0x44f2d1){return db[_0x51a1('0x50')]['find']({'where':{'id':_0x4257b7['params']['id']}})[_0x51a1('0x23')](handleEntityNotFound(_0x4393a1,null))[_0x51a1('0x23')](function(_0x4763dd){if(_0x4763dd){return _0x4763dd[_0x51a1('0x4f')](_0x4257b7['body'][_0x51a1('0x51')],_['omit'](_0x4257b7[_0x51a1('0x45')],[_0x51a1('0x51'),'id'])||{});}})[_0x51a1('0x23')](respondWithResult(_0x4393a1,null))['catch'](handleError(_0x4393a1,null));};exports[_0x51a1('0x52')]=function(_0x5dffd6,_0x432aa3,_0x4ca7f5){var _0x4f737f={};var _0x3d46b7={};var _0x1c640e;var _0x2c5986;return db['CmCompany']['findOne']({'where':{'id':_0x5dffd6[_0x51a1('0x42')]['id']}})[_0x51a1('0x23')](handleEntityNotFound(_0x432aa3,null))[_0x51a1('0x23')](function(_0x42cf15){if(_0x42cf15){_0x1c640e=_0x42cf15;_0x3d46b7[_0x51a1('0x2b')]=_[_0x51a1('0x2c')](db[_0x51a1('0x50')]['rawAttributes']);_0x3d46b7[_0x51a1('0x2d')]=_['keys'](_0x5dffd6[_0x51a1('0x2d')]);_0x3d46b7['filters']=_[_0x51a1('0x2e')](_0x3d46b7[_0x51a1('0x2b')],_0x3d46b7[_0x51a1('0x2d')]);_0x4f737f[_0x51a1('0x30')]=_[_0x51a1('0x2e')](_0x3d46b7['model'],qs['fields'](_0x5dffd6[_0x51a1('0x2d')][_0x51a1('0x2f')]));_0x4f737f[_0x51a1('0x30')]=_0x4f737f[_0x51a1('0x30')]['length']?_0x4f737f[_0x51a1('0x30')]:_0x3d46b7[_0x51a1('0x2b')];_0x4f737f[_0x51a1('0x53')]=qs['sort'](_0x5dffd6[_0x51a1('0x2d')][_0x51a1('0x34')]);_0x4f737f[_0x51a1('0x39')]=qs[_0x51a1('0x36')](_[_0x51a1('0x35')](_0x5dffd6[_0x51a1('0x2d')],_0x3d46b7['filters']));if(_0x5dffd6[_0x51a1('0x2d')][_0x51a1('0x37')]){_0x4f737f['where']=_[_0x51a1('0x38')](_0x4f737f['where'],{'$or':_[_0x51a1('0x3a')](_0x4f737f[_0x51a1('0x30')],function(_0x244b98){var _0x2dd276={};_0x2dd276[_0x244b98]={'$like':'%'+_0x5dffd6[_0x51a1('0x2d')]['filter']+'%'};return _0x2dd276;})});}_0x4f737f=_[_0x51a1('0x38')]({},_0x4f737f,_0x5dffd6[_0x51a1('0x3b')]);return _0x1c640e[_0x51a1('0x52')](_0x4f737f);}})[_0x51a1('0x23')](function(_0x2ca741){if(_0x2ca741){_0x2c5986=_0x2ca741[_0x51a1('0x31')];if(!_0x5dffd6[_0x51a1('0x2d')][_0x51a1('0x32')]('nolimit')){_0x4f737f['limit']=qs[_0x51a1('0x1f')](_0x5dffd6[_0x51a1('0x2d')]['limit']);_0x4f737f[_0x51a1('0x1d')]=qs[_0x51a1('0x1d')](_0x5dffd6[_0x51a1('0x2d')][_0x51a1('0x1d')]);}return _0x1c640e[_0x51a1('0x52')](_0x4f737f);}})[_0x51a1('0x23')](function(_0x3e9d39){if(_0x3e9d39){return _0x3e9d39?{'count':_0x2c5986,'rows':_0x3e9d39}:null;}})[_0x51a1('0x23')](respondWithResult(_0x432aa3,null))[_0x51a1('0x40')](handleError(_0x432aa3,null));};
\ No newline at end of file
index 4e8ed37..0c58c5e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4195=['api','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','exports','define','cm_companies','lodash','util','../../config/logger'];(function(_0x4a0e68,_0x45c08c){var _0x4fb274=function(_0x5f36b1){while(--_0x5f36b1){_0x4a0e68['push'](_0x4a0e68['shift']());}};_0x4fb274(++_0x45c08c);}(_0x4195,0x17d));var _0x5419=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0x4195[_0x27e811];return _0x1627fa;};'use strict';var _=require(_0x5419('0x0'));var util=require(_0x5419('0x1'));var logger=require(_0x5419('0x2'))(_0x5419('0x3'));var moment=require('moment');var BPromise=require(_0x5419('0x4'));var rp=require(_0x5419('0x5'));var fs=require('fs');var path=require(_0x5419('0x6'));var rimraf=require('rimraf');var config=require(_0x5419('0x7'));var attributes=require(_0x5419('0x8'));module[_0x5419('0x9')]=function(_0x476ba4,_0x387697){return _0x476ba4[_0x5419('0xa')]('CmCompany',attributes,{'tableName':_0x5419('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4efc=['bluebird','request-promise','../../config/environment','exports','define','cm_companies','lodash','util','../../config/logger','api','moment'];(function(_0x4c8700,_0x25e672){var _0x16dcaa=function(_0x18c324){while(--_0x18c324){_0x4c8700['push'](_0x4c8700['shift']());}};_0x16dcaa(++_0x25e672);}(_0x4efc,0x8a));var _0xc4ef=function(_0x188d52,_0x29a97a){_0x188d52=_0x188d52-0x0;var _0xe76b1=_0x4efc[_0x188d52];return _0xe76b1;};'use strict';var _=require(_0xc4ef('0x0'));var util=require(_0xc4ef('0x1'));var logger=require(_0xc4ef('0x2'))(_0xc4ef('0x3'));var moment=require(_0xc4ef('0x4'));var BPromise=require(_0xc4ef('0x5'));var rp=require(_0xc4ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc4ef('0x7'));var attributes=require('./cmCompany.attributes');module[_0xc4ef('0x8')]=function(_0x451541,_0x2436fb){return _0x451541[_0xc4ef('0x9')]('CmCompany',attributes,{'tableName':_0xc4ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 230c6d7..2db567c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8cd1=['../../config/utils','../../config/logger','../../config/environment','http','then','info','CmCompany,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x237836,_0x5c9545){var _0x57806b=function(_0x538779){while(--_0x538779){_0x237836['push'](_0x237836['shift']());}};_0x57806b(++_0x5c9545);}(_0x8cd1,0x1e1));var _0x18cd=function(_0x516ebb,_0x36674e){_0x516ebb=_0x516ebb-0x0;var _0x4d2e08=_0x8cd1[_0x516ebb];return _0x4d2e08;};'use strict';var _=require(_0x18cd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x18cd('0x1'));var rs=require(_0x18cd('0x2'));var fs=require('fs');var Redis=require(_0x18cd('0x3'));var db=require(_0x18cd('0x4'))['db'];var utils=require(_0x18cd('0x5'));var logger=require(_0x18cd('0x6'))('rpc');var config=require(_0x18cd('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x18cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x466f10,_0x4affb7,_0x30602b){return new BPromise(function(_0x4abb50,_0x3e5211){return client['request'](_0x466f10,_0x30602b)[_0x18cd('0x9')](function(_0x1c3053){logger[_0x18cd('0xa')](_0x18cd('0xb'),_0x4affb7,'request\x20sent');logger[_0x18cd('0xc')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x4affb7,_0x18cd('0xd'),JSON['stringify'](_0x1c3053));if(_0x1c3053['error']){if(_0x1c3053[_0x18cd('0xe')][_0x18cd('0xf')]===0x1f4){logger[_0x18cd('0xe')](_0x18cd('0xb'),_0x4affb7,_0x1c3053['error']['message']);return _0x3e5211(_0x1c3053[_0x18cd('0xe')][_0x18cd('0x10')]);}logger[_0x18cd('0xe')](_0x18cd('0xb'),_0x4affb7,_0x1c3053['error']['message']);return _0x4abb50(_0x1c3053[_0x18cd('0xe')]['message']);}else{logger[_0x18cd('0xa')]('CmCompany,\x20%s,\x20%s',_0x4affb7,_0x18cd('0xd'));_0x4abb50(_0x1c3053[_0x18cd('0x11')][_0x18cd('0x10')]);}})['catch'](function(_0x1be25e){logger['error'](_0x18cd('0xb'),_0x4affb7,_0x1be25e);_0x3e5211(_0x1be25e);});});}
\ No newline at end of file
+var _0x2501=['CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0x2501,0x1eb));var _0x1250=function(_0x252afe,_0x5e2a0f){_0x252afe=_0x252afe-0x0;var _0x5f5444=_0x2501[_0x252afe];return _0x5f5444;};'use strict';var _=require(_0x1250('0x0'));var util=require(_0x1250('0x1'));var moment=require('moment');var BPromise=require(_0x1250('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1250('0x3'));var db=require(_0x1250('0x4'))['db'];var utils=require(_0x1250('0x5'));var logger=require(_0x1250('0x6'))(_0x1250('0x7'));var config=require('../../config/environment');var jayson=require(_0x1250('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d5156,_0x380721,_0x1bb3e8){return new BPromise(function(_0x1066ef,_0x593480){return client['request'](_0x4d5156,_0x1bb3e8)['then'](function(_0x44daef){logger[_0x1250('0x9')](_0x1250('0xa'),_0x380721,_0x1250('0xb'));logger[_0x1250('0xc')](_0x1250('0xd'),_0x380721,'request\x20sent',JSON[_0x1250('0xe')](_0x44daef));if(_0x44daef['error']){if(_0x44daef[_0x1250('0xf')]['code']===0x1f4){logger[_0x1250('0xf')](_0x1250('0xa'),_0x380721,_0x44daef[_0x1250('0xf')]['message']);return _0x593480(_0x44daef[_0x1250('0xf')][_0x1250('0x10')]);}logger['error'](_0x1250('0xa'),_0x380721,_0x44daef[_0x1250('0xf')][_0x1250('0x10')]);return _0x1066ef(_0x44daef[_0x1250('0xf')]['message']);}else{logger[_0x1250('0x9')](_0x1250('0xa'),_0x380721,_0x1250('0xb'));_0x1066ef(_0x44daef['result'][_0x1250('0x10')]);}})[_0x1250('0x11')](function(_0x5cfd25){logger['error'](_0x1250('0xa'),_0x380721,_0x5cfd25);_0x593480(_0x5cfd25);});});}
\ No newline at end of file
index 8deb98b..f09f87f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x977d=['addContacts','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/contacts','getContacts','post'];(function(_0x5e65a1,_0x33579c){var _0x427ab0=function(_0x14099d){while(--_0x14099d){_0x5e65a1['push'](_0x5e65a1['shift']());}};_0x427ab0(++_0x33579c);}(_0x977d,0x186));var _0xd977=function(_0x5b7b32,_0x920ea5){_0x5b7b32=_0x5b7b32-0x0;var _0x2e0d59=_0x977d[_0x5b7b32];return _0x2e0d59;};'use strict';var multer=require(_0xd977('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd977('0x1'));var express=require(_0xd977('0x2'));var router=express[_0xd977('0x3')]();var fs_extra=require(_0xd977('0x4'));var auth=require(_0xd977('0x5'));var interaction=require(_0xd977('0x6'));var config=require(_0xd977('0x7'));var controller=require(_0xd977('0x8'));router[_0xd977('0x9')]('/',auth['isAuthenticated'](),controller[_0xd977('0xa')]);router[_0xd977('0x9')](_0xd977('0xb'),auth[_0xd977('0xc')](),controller['describe']);router[_0xd977('0x9')](_0xd977('0xd'),auth[_0xd977('0xc')](),controller[_0xd977('0xe')]);router[_0xd977('0x9')](_0xd977('0xf'),auth[_0xd977('0xc')](),controller[_0xd977('0x10')]);router[_0xd977('0x11')]('/',auth[_0xd977('0xc')](),controller['create']);router[_0xd977('0x11')]('/:id/contacts',auth[_0xd977('0xc')](),controller[_0xd977('0x12')]);router[_0xd977('0x13')](_0xd977('0xd'),auth[_0xd977('0xc')](),controller[_0xd977('0x14')]);router[_0xd977('0x15')]('/:id',auth[_0xd977('0xc')](),controller[_0xd977('0x16')]);module[_0xd977('0x17')]=router;
\ No newline at end of file
+var _0x3d3a=['./cmCompany.controller','/describe','isAuthenticated','describe','get','/:id','show','/:id/contacts','getContacts','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0x3d3a,0x1f3));var _0xa3d3=function(_0x355203,_0x182fb9){_0x355203=_0x355203-0x0;var _0x50ff66=_0x3d3a[_0x355203];return _0x50ff66;};'use strict';var multer=require(_0xa3d3('0x0'));var util=require(_0xa3d3('0x1'));var path=require(_0xa3d3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa3d3('0x3')]();var fs_extra=require(_0xa3d3('0x4'));var auth=require(_0xa3d3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa3d3('0x6'));var controller=require(_0xa3d3('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa3d3('0x8'),auth[_0xa3d3('0x9')](),controller[_0xa3d3('0xa')]);router[_0xa3d3('0xb')](_0xa3d3('0xc'),auth[_0xa3d3('0x9')](),controller[_0xa3d3('0xd')]);router[_0xa3d3('0xb')](_0xa3d3('0xe'),auth['isAuthenticated'](),controller[_0xa3d3('0xf')]);router[_0xa3d3('0x10')]('/',auth[_0xa3d3('0x9')](),controller[_0xa3d3('0x11')]);router[_0xa3d3('0x10')](_0xa3d3('0xe'),auth[_0xa3d3('0x9')](),controller['addContacts']);router[_0xa3d3('0x12')]('/:id',auth[_0xa3d3('0x9')](),controller[_0xa3d3('0x13')]);router[_0xa3d3('0x14')](_0xa3d3('0xc'),auth[_0xa3d3('0x9')](),controller[_0xa3d3('0x15')]);module[_0xa3d3('0x16')]=router;
\ No newline at end of file
index 8a04046..a912603 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdeb1=['UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xdeb1,0x1aa));var _0x1deb=function(_0x4a2c27,_0x109a6f){_0x4a2c27=_0x4a2c27-0x0;var _0x1b958e=_0xdeb1[_0x4a2c27];return _0x1b958e;};'use strict';var _=require(_0x1deb('0x0'));var Sequelize=require(_0x1deb('0x1'));module[_0x1deb('0x2')]={'firstName':{'type':Sequelize[_0x1deb('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1deb('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x1deb('0x3')]},'description':{'type':Sequelize[_0x1deb('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x1deb('0x3')]},'email':{'type':Sequelize[_0x1deb('0x3')]},'url':{'type':Sequelize[_0x1deb('0x3')]},'facebook':{'type':Sequelize[_0x1deb('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x1deb('0x3')]},'skype':{'type':Sequelize[_0x1deb('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x1deb('0x3')]},'line':{'type':Sequelize[_0x1deb('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x1deb('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x1deb('0x3')]},'priority':{'type':Sequelize[_0x1deb('0x5')](0x2)[_0x1deb('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1deb('0x7')],'defaultValue':Sequelize[_0x1deb('0x8')]},'dialTimezone':{'type':Sequelize[_0x1deb('0x3')]},'utcOffset':{'type':Sequelize[_0x1deb('0x5')]}};
\ No newline at end of file
+var _0xd46f=['INTEGER','DATE','NOW','lodash','sequelize','STRING','TEXT'];(function(_0x36bc20,_0x4a5d98){var _0x3af439=function(_0x46269e){while(--_0x46269e){_0x36bc20['push'](_0x36bc20['shift']());}};_0x3af439(++_0x4a5d98);}(_0xd46f,0xd5));var _0xfd46=function(_0x39b64a,_0x4c816c){_0x39b64a=_0x39b64a-0x0;var _0x512569=_0xd46f[_0x39b64a];return _0x512569;};'use strict';var _=require(_0xfd46('0x0'));var Sequelize=require(_0xfd46('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xfd46('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xfd46('0x2')]},'street':{'type':Sequelize[_0xfd46('0x2')]},'postalCode':{'type':Sequelize[_0xfd46('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xfd46('0x2')]},'dateOfBirth':{'type':Sequelize[_0xfd46('0x2')]},'description':{'type':Sequelize[_0xfd46('0x3')]},'phone':{'type':Sequelize[_0xfd46('0x2')]},'mobile':{'type':Sequelize[_0xfd46('0x2')]},'fax':{'type':Sequelize[_0xfd46('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xfd46('0x2')]},'facebook':{'type':Sequelize[_0xfd46('0x2')]},'fb_data':{'type':Sequelize[_0xfd46('0x2')]},'twitter':{'type':Sequelize[_0xfd46('0x2')]},'skype':{'type':Sequelize[_0xfd46('0x2')]},'teams':{'type':Sequelize[_0xfd46('0x2')]},'viber':{'type':Sequelize[_0xfd46('0x2')]},'line':{'type':Sequelize[_0xfd46('0x2')]},'wechat':{'type':Sequelize[_0xfd46('0x2')]},'telegram':{'type':Sequelize[_0xfd46('0x2')]},'UserId':{'type':Sequelize[_0xfd46('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xfd46('0x2')]},'priority':{'type':Sequelize[_0xfd46('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xfd46('0x5')],'defaultValue':Sequelize[_0xfd46('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
index e29531f..ee135d1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x31c0=['GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','CmContact','columnName','displayName','analytics','findAll','alias','values','body','get','isArray','tags','join','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','findOrCreate','show','params','CmContactHasItem','Phones','ItemType','$and','omit','format','cf_%d','pickBy','cm_contacts','setFields','id\x20=\x20?','phone','findOne','intersection','pick','options','getTags','setTags','ids','all','ContactItemType','items','item_types','ItemTypeId','description','OrderBy','PHONE','CmHopper','item','literal','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','rawAttributes','ContactId','includeAll','include','rows','getHopperHistories','getHopperFinals','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','send','upload','createReadStream','meta','import','binding','socket_timestamp','stringify','pid','exit','importUpdates','../../components/import/cm/csvUpdates','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','sms','openchannel','fax','-createdAt','channel','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','VoiceCallReport','findAndCountAll','chat','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','browserName','customerIp','customerPort','deviceModel','osName','ratingType','referer','mail','subject','substatus','threadId','startCase','Interaction','Owner','sortBy','reverse','slice','moment','bluebird','util','path','lodash','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','./cmContact.socket','register','status','offset','undefined','count','limit','set','json','update','then','destroy','end','sendStatus','error','name','index','describe','length','startsWith','cf_','trimStart','fieldType','type','query','keys','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','field','color','from','tools_tags','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','c.deletedAt\x20IS\x20NULL','expr','parseSearch','search','sqlOperator','conditions','find','Tag','value','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','dateOfBirth','datetime','castTo','DATE','buildExpression','text','start','isNil','Contact','push','ListId','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','filter','replace','getFullTextValue','isNumeric','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','clone','forEach','DESC','isEmpty','having','t.id\x20IN\x20?','resolve','role','User','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','map','user','agent','sequelize','toString','keyBy','merge','c.firstName','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0x31c0,0x1e6));var _0x031c=function(_0x9951d,_0x4dc2ae){_0x9951d=_0x9951d-0x0;var _0x5c6fc8=_0x31c0[_0x9951d];return _0x5c6fc8;};'use strict';var moment=require(_0x031c('0x0'));var BPromise=require(_0x031c('0x1'));var util=require(_0x031c('0x2'));var path=require(_0x031c('0x3'));var fs=require('fs');var _=require(_0x031c('0x4'));var squel=require('squel');var Papa=require(_0x031c('0x5'));var Redis=require(_0x031c('0x6'));var qs=require(_0x031c('0x7'));var as=require(_0x031c('0x8'));var logger=require(_0x031c('0x9'))(_0x031c('0xa'));var config=require(_0x031c('0xb'));var shared=require(_0x031c('0xc'));var db=require(_0x031c('0xd'))['db'];config[_0x031c('0xe')]=_[_0x031c('0xf')](config[_0x031c('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x031c('0x10'))[_0x031c('0x11')](socket);function respondWithResult(_0x1e7b39,_0x428a93){_0x428a93=_0x428a93||0xc8;return function(_0x44384d){if(_0x44384d){return _0x1e7b39[_0x031c('0x12')](_0x428a93)['json'](_0x44384d);}};}function respondWithFilteredResult(_0x17c7a8,_0x4a77b9){return function(_0x357996){if(_0x357996){var _0x1cde94=typeof _0x4a77b9[_0x031c('0x13')]==='undefined'&&typeof _0x4a77b9['limit']===_0x031c('0x14');var _0x4aac84=_0x357996[_0x031c('0x15')];var _0x58ac13=_0x1cde94?0x0:_0x4a77b9[_0x031c('0x13')];var _0x5691d5=_0x1cde94?_0x357996[_0x031c('0x15')]:_0x4a77b9[_0x031c('0x13')]+_0x4a77b9[_0x031c('0x16')];var _0x56431f;if(_0x5691d5>=_0x4aac84){_0x5691d5=_0x4aac84;_0x56431f=0xc8;}else{_0x56431f=0xce;}_0x17c7a8[_0x031c('0x12')](_0x56431f);return _0x17c7a8[_0x031c('0x17')]('Content-Range',_0x58ac13+'-'+_0x5691d5+'/'+_0x4aac84)[_0x031c('0x18')](_0x357996);}return null;};}function saveUpdates(_0x2a1fa0){return function(_0xe03328){if(_0xe03328){return _0xe03328[_0x031c('0x19')](_0x2a1fa0)[_0x031c('0x1a')](function(_0x501a9a){return _0x501a9a;});}return null;};}function removeEntity(_0x21cf9a){return function(_0x450b64){if(_0x450b64){return _0x450b64[_0x031c('0x1b')]()['then'](function(){_0x21cf9a[_0x031c('0x12')](0xcc)[_0x031c('0x1c')]();});}};}function handleEntityNotFound(_0x6e8b2d){return function(_0x1396b7){if(!_0x1396b7){_0x6e8b2d[_0x031c('0x1d')](0x194);}return _0x1396b7;};}function handleError(_0x5508e7,_0x200a76){_0x200a76=_0x200a76||0x1f4;return function(_0x1d123d){logger[_0x031c('0x1e')](_0x1d123d['stack']);if(_0x1d123d[_0x031c('0x1f')]){delete _0x1d123d['name'];}_0x5508e7['status'](_0x200a76)['send'](_0x1d123d);};}exports[_0x031c('0x20')]=function(_0xcca414,_0x403991){var _0x503eeb={},_0x599a1c={},_0x6d3391={'count':0x0,'rows':[]};return db['CmContact'][_0x031c('0x21')]()[_0x031c('0x1a')](function(_0x39ec17){var _0x3fc15a=[];for(var _0x2c5abf=0x0;_0x2c5abf<Object['keys'](_0x39ec17)[_0x031c('0x22')];_0x2c5abf++){var _0x4fa9bf=Object['keys'](_0x39ec17)[_0x2c5abf];if(_[_0x031c('0x23')](_0x4fa9bf,_0x031c('0x24'))){_0x3fc15a['push'](db['CmCustomField']['findOne']({'where':{'id':_[_0x031c('0x25')](_0x4fa9bf,'cf_')},'raw':!![]}));}}return BPromise['all'](_0x3fc15a)[_0x031c('0x1a')](function(_0x22cc27){for(var _0x4c9447=0x0;_0x4c9447<_0x22cc27[_0x031c('0x22')];_0x4c9447++){if(_0x22cc27[_0x4c9447]){var _0x1eb1f1=_0x031c('0x24')+_0x22cc27[_0x4c9447]['id'];var _0x5aac6d=_0x39ec17[_0x1eb1f1];_0x5aac6d[_0x031c('0x26')]=_0x22cc27[_0x4c9447][_0x031c('0x27')];}}return _0x39ec17;});})[_0x031c('0x1a')](function(_0x562efc){_0x599a1c['model']=_['keys'](_0x562efc);_0x599a1c[_0x031c('0x28')]=_[_0x031c('0x29')](_0xcca414[_0x031c('0x28')]);_0x599a1c['filters']=_['intersection'](_0x599a1c[_0x031c('0x2a')],_0x599a1c['query']);_0x503eeb[_0x031c('0x2b')]=_['intersection'](_0x599a1c['model'],qs['fields'](_0xcca414[_0x031c('0x28')][_0x031c('0x2c')]));_0x503eeb[_0x031c('0x2b')]=_0x503eeb[_0x031c('0x2b')][_0x031c('0x22')]?_0x503eeb[_0x031c('0x2b')]:_0x599a1c[_0x031c('0x2a')];if(!_0xcca414[_0x031c('0x28')][_0x031c('0x2d')](_0x031c('0x2e'))){_0x503eeb[_0x031c('0x16')]=qs[_0x031c('0x16')](_0xcca414[_0x031c('0x28')][_0x031c('0x16')]);_0x503eeb[_0x031c('0x13')]=qs[_0x031c('0x13')](_0xcca414[_0x031c('0x28')][_0x031c('0x13')]);}_0x503eeb[_0x031c('0x2f')]=qs[_0x031c('0x30')](_0xcca414[_0x031c('0x28')][_0x031c('0x30')]);_0x503eeb[_0x031c('0x31')]=qs[_0x031c('0x32')](_['pick'](_0xcca414[_0x031c('0x28')],_0x599a1c[_0x031c('0x32')]),_0x562efc);var _0x564355=[];var _0x5f16bc=squel['select']()[_0x031c('0x33')]('id')[_0x031c('0x33')]('name')['field'](_0x031c('0x34'))[_0x031c('0x35')](_0x031c('0x36'));var _0x5b9f7c=squel['select']()[_0x031c('0x35')]('cm_contacts','c')[_0x031c('0x37')](_0x031c('0x38'),'uc',_0x031c('0x39'))[_0x031c('0x37')]('cm_contact_has_tags','ct',_0x031c('0x3a'))[_0x031c('0x37')]('tools_tags','t','t.id\x20=\x20ct.TagId')[_0x031c('0x31')](_0x031c('0x3b'));var _0x5c3023=squel[_0x031c('0x3c')]();var _0x46dc01=[];var _0x27809a=squel['expr']();var _0x49dbd5;if(_0xcca414[_0x031c('0x28')]['search']){_0x49dbd5=as[_0x031c('0x3d')](_0xcca414[_0x031c('0x28')][_0x031c('0x3e')]);var _0x250c1d=_0x49dbd5[_0x031c('0x3f')];for(var _0x4e4eda=0x0;_0x4e4eda<_0x49dbd5[_0x031c('0x40')][_0x031c('0x22')];_0x4e4eda++){var _0x29d7c3=_0x49dbd5[_0x031c('0x40')][_0x4e4eda];var _0x4c21c1='c';var _0x2dfc47=_(_0x562efc)[_0x031c('0x29')]()[_0x031c('0x41')](function(_0x5594f7){return _0x5594f7===_0x29d7c3[_0x031c('0x33')];});if(_0x2dfc47)_0x2dfc47=_0x562efc[_0x29d7c3[_0x031c('0x33')]];if(!_0x2dfc47){if(_0x29d7c3[_0x031c('0x33')]===_0x031c('0x42')){var _0x5ed417=_0x29d7c3[_0x031c('0x43')][_0x031c('0x44')](',')['map'](function(_0x29fc63){return Number(_0x29fc63);});_0x5ed417['forEach'](function(_0x559fbb){_0x27809a['or'](_0x031c('0x45'),'%,'+_0x559fbb+',%');});_0x46dc01=_[_0x031c('0x46')](_0x46dc01,_0x5ed417);}else if(_0x29d7c3[_0x031c('0x33')]==='User'){_0x5c3023[_0x031c('0x47')]('uc.UserId\x20=\x20?',_0x29d7c3[_0x031c('0x43')]);}}else{if(_0x29d7c3[_0x031c('0x33')]===_0x031c('0x48')||_0x2dfc47[_0x031c('0x26')]===_0x031c('0x49'))_0x29d7c3[_0x031c('0x4a')]=_0x031c('0x4b');var _0x51be51=as[_0x031c('0x4c')](_0x4c21c1,_0x2dfc47['type'],_0x29d7c3);_0x5c3023[_0x250c1d](_0x51be51[_0x031c('0x4d')],_0x51be51[_0x031c('0x43')][_0x031c('0x4e')],_0x51be51[_0x031c('0x43')][_0x031c('0x1c')]);}}}else{var _0x7307ad=_(Object[_0x031c('0x29')](_0xcca414[_0x031c('0x28')]))['map'](function(_0x5dbbca){return _0x562efc[_0x031c('0x2d')](_0x5dbbca)?_0x5dbbca:undefined;})['filter'](function(_0x3bcdd0){return!_[_0x031c('0x4f')](_0x3bcdd0);})[_0x031c('0x43')]();if(_0xcca414[_0x031c('0x28')][_0x031c('0x50')])_0x7307ad[_0x031c('0x51')](_0x031c('0x50'));if(!_['isEmpty'](_0x7307ad)){_0x7307ad['forEach'](function(_0x2e16c3){if(_0x2e16c3===_0x031c('0x52')){_0x5b9f7c['where']('c.ListId\x20IN\x20?',[]['concat'](_0xcca414['query'][_0x2e16c3]));}else if(_0x2e16c3==='Contact'){var _0x569909='%'+_0xcca414[_0x031c('0x28')][_0x2e16c3]+'%';_0x5b9f7c['where'](_0x031c('0x53'),_0x569909);}else{_0x5b9f7c[_0x031c('0x31')]('c.'+_0x2e16c3+'\x20=\x20?',_0xcca414[_0x031c('0x28')][_0x2e16c3]);}});}if(_0xcca414[_0x031c('0x28')][_0x031c('0x54')]){_0x46dc01=_['isArray'](_0xcca414[_0x031c('0x28')]['tag'])?_0xcca414[_0x031c('0x28')]['tag']:new Array(_0xcca414['query'][_0x031c('0x54')]);_0x46dc01['forEach'](function(_0x511a32){_0x27809a['or'](_0x031c('0x45'),'%,'+_0x511a32+',%');});}if(_0xcca414['query'][_0x031c('0x55')]){var _0x3f21c5=_0xcca414['query'][_0x031c('0x55')][_0x031c('0x56')]('\x5c','\x5c\x5c')[_0x031c('0x56')](/'/g,'\x27\x27');if(_0x3f21c5[_0x031c('0x44')]('\x20')[_0x031c('0x22')]>0x1){_0x5c3023['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x031c('0x57')](_0x3f21c5),null);}else{if(qs[_0x031c('0x58')](_0x3f21c5)){_0x5c3023['or']('c.id\x20LIKE\x20?',_0x3f21c5+'%');_0x5c3023['or']('c.phone\x20LIKE\x20?',_0x3f21c5+'%');_0x5c3023['or'](_0x031c('0x59'),_0x3f21c5+'%');_0x5c3023['or'](_0x031c('0x5a'),_0x3f21c5+'%');}else if(qs[_0x031c('0x5b')](_0x3f21c5)){_0x5c3023['or'](_0x031c('0x5c'),_0x3f21c5+'%');}else{_0x5c3023['or'](_0x031c('0x5d'),'%'+_0x3f21c5+'%');_0x5c3023['or'](_0x031c('0x5e'),'%'+_0x3f21c5+'%');_0x5c3023['or']('c.email\x20LIKE\x20?','%'+_0x3f21c5+'%');}}}}_0x5b9f7c[_0x031c('0x31')](_0x5c3023);_0x5b9f7c[_0x031c('0x5f')](_0x031c('0x60'));var _0x5da042={'type':db[_0x031c('0x61')][_0x031c('0x62')]['SELECT'],'raw':!![]};var _0x42cfdf=_0x5b9f7c[_0x031c('0x63')]()[_0x031c('0x33')](_0x031c('0x60'));if(_0x503eeb['order']){_0x503eeb[_0x031c('0x2f')][_0x031c('0x64')](function(_0x43ba21){_0x5b9f7c[_0x031c('0x2f')]('c.'+_0x43ba21[0x0],_0x43ba21[0x1]===_0x031c('0x65')?![]:!![]);});}if(!_[_0x031c('0x66')](_0x46dc01)){_0x5b9f7c[_0x031c('0x67')](_0x27809a);_0x42cfdf[_0x031c('0x31')](_0x031c('0x68'),_0x46dc01);}BPromise[_0x031c('0x69')]()['then'](function(){if(!_0x49dbd5)return;if(_0xcca414['user'][_0x031c('0x6a')]!=='agent')return;if(!_['some'](_0x49dbd5[_0x031c('0x40')],['field',_0x031c('0x6b')])){return _0xcca414['user'][_0x031c('0x6c')]({'attributes':['id'],'raw':!![]})[_0x031c('0x1a')](function(_0x3347d8){if(_['isEmpty'](_0x3347d8)){_0x42cfdf[_0x031c('0x31')](_0x031c('0x6d'));_0x5b9f7c[_0x031c('0x31')]('c.ListId\x20IS\x20NULL');}else{_0x42cfdf[_0x031c('0x31')](_0x031c('0x6e'),_[_0x031c('0x6f')](_0x3347d8,'id'));_0x5b9f7c[_0x031c('0x31')](_0x031c('0x6e'),_['map'](_0x3347d8,'id'));}});}})['then'](function(){if(_0xcca414[_0x031c('0x70')]['role']===_0x031c('0x71')&&!_0x49dbd5&&!_0xcca414[_0x031c('0x28')][_0x031c('0x52')])return[];return db[_0x031c('0x72')]['query'](_0x42cfdf[_0x031c('0x73')](),_0x5da042);})['then'](function(_0x3f3803){_0x6d3391['count']=_0x3f3803[_0x031c('0x22')];if(_0x6d3391[_0x031c('0x15')]===0x0)return[];return db[_0x031c('0x72')][_0x031c('0x28')](_0x5f16bc[_0x031c('0x73')](),_0x5da042)[_0x031c('0x1a')](function(_0x4b1760){_0x564355=_[_0x031c('0x74')](_0x4b1760,'id');_0x5da042=_[_0x031c('0x75')](_0x5da042,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xcca414[_0x031c('0x28')][_0x031c('0x2c')]){_0x503eeb['attributes'][_0x031c('0x64')](function(_0x4bc759){_0x5b9f7c[_0x031c('0x33')]('c.'+_0x4bc759);});}else{_0x5b9f7c['field'](_0x031c('0x60'));_0x5b9f7c['field'](_0x031c('0x76'));_0x5b9f7c[_0x031c('0x33')]('c.lastName');_0x5b9f7c[_0x031c('0x33')]('c.phone');_0x5b9f7c[_0x031c('0x33')](_0x031c('0x77'));_0x5b9f7c[_0x031c('0x33')](_0x031c('0x78'));_0x5b9f7c[_0x031c('0x33')](_0x031c('0x79'));_0x5b9f7c[_0x031c('0x33')](_0x031c('0x7a'));_0x5b9f7c[_0x031c('0x33')](_0x031c('0x7b'));_0x5b9f7c[_0x031c('0x33')](_0x031c('0x7c'));_0x5b9f7c[_0x031c('0x33')](_0x031c('0x7d'));_0x5b9f7c['field'](_0x031c('0x7e'),'TagIds');}if(_0x503eeb[_0x031c('0x16')])_0x5b9f7c['limit'](_0x503eeb[_0x031c('0x16')]);if(_0x503eeb[_0x031c('0x13')])_0x5b9f7c[_0x031c('0x13')](_0x503eeb[_0x031c('0x13')]);return db[_0x031c('0x72')][_0x031c('0x28')](_0x5b9f7c[_0x031c('0x73')](),_0x5da042);});})[_0x031c('0x1a')](function(_0x5924df){_0x5924df['forEach'](function(_0xb52d1){if(_0xb52d1[_0x031c('0x7f')]){_0xb52d1[_0x031c('0x80')]=[];_0xb52d1[_0x031c('0x7f')]['split'](',')[_0x031c('0x64')](function(_0x4e25ab){_0xb52d1[_0x031c('0x80')][_0x031c('0x51')](_0x564355[_0x4e25ab]);});}delete _0xb52d1[_0x031c('0x7f')];});_0x6d3391['rows']=_0x5924df;return _0x6d3391;})[_0x031c('0x1a')](respondWithFilteredResult(_0x403991,_0x503eeb));})['catch'](handleError(_0x403991,null));};exports[_0x031c('0x1b')]=function(_0x558572,_0x16c378){return db['CmContact']['find']({'where':{'id':_0x558572['params']['id']}})['then'](handleEntityNotFound(_0x16c378,null))[_0x031c('0x1a')](removeEntity(_0x16c378,null))[_0x031c('0x81')](handleError(_0x16c378,null));};exports['describe']=function(_0x1f5e2e,_0x55c941){return db[_0x031c('0x82')][_0x031c('0x21')]()['then'](function(_0xc2b04e){delete _0xc2b04e['tags'];for(var _0x147b03=0x0;_0x147b03<Object[_0x031c('0x29')](_0xc2b04e)['length'];_0x147b03++){var _0x19a3e4=Object['keys'](_0xc2b04e)[_0x147b03];if(!_[_0x031c('0x23')](_0x19a3e4,_0x031c('0x24'))){_0xc2b04e[_0x19a3e4][_0x031c('0x83')]=_0x19a3e4;_0xc2b04e[_0x19a3e4][_0x031c('0x84')]=_0x19a3e4;}}return _0xc2b04e;})[_0x031c('0x1a')](function(_0x3ab8eb){var _0x1a580e={'where':Boolean(_0x1f5e2e[_0x031c('0x28')][_0x031c('0x85')])===!![]?undefined:{'$or':[{'ListId':_0x1f5e2e[_0x031c('0x28')]['id']},{'ListId':null}]},'raw':!![]};return db['CmCustomField'][_0x031c('0x86')](_0x1a580e)['then'](function(_0x4f33bc){for(var _0x483637=0x0;_0x483637<_0x4f33bc[_0x031c('0x22')];_0x483637++){var _0x286d09=_0x031c('0x24')+_0x4f33bc[_0x483637]['id'];_0x3ab8eb[_0x286d09][_0x031c('0x83')]=_0x286d09;_0x3ab8eb[_0x286d09][_0x031c('0x84')]=_0x4f33bc[_0x483637][_0x031c('0x87')];_0x3ab8eb[_0x286d09]['custom']={'type':_0x4f33bc[_0x483637][_0x031c('0x27')],'values':_0x4f33bc[_0x483637][_0x031c('0x88')]};}Object[_0x031c('0x29')](_0x3ab8eb)[_0x031c('0x64')](function(_0x4bb32e){if(!_0x3ab8eb[_0x4bb32e][_0x031c('0x2d')]('columnName')){delete _0x3ab8eb[_0x4bb32e];}});return _0x3ab8eb;});})['then'](respondWithResult(_0x55c941,null))[_0x031c('0x81')](handleError(_0x55c941,null));};exports[_0x031c('0x75')]=function(_0x610948,_0x33712d){var _0x26cbd2;var _0x1288b2;var _0x5a5aa6;if(_0x610948[_0x031c('0x89')]['id']){delete _0x610948[_0x031c('0x89')]['id'];}return db[_0x031c('0x82')][_0x031c('0x86')]({'where':{'id':[_0x610948[_0x031c('0x89')]['to'],_0x610948[_0x031c('0x89')]['from']]}})[_0x031c('0x1a')](function(_0x4d1e50){if(_0x4d1e50){if(_0x4d1e50[_0x031c('0x22')]!==0x2){return null;}_0x4d1e50[0x0]=_0x4d1e50[0x0][_0x031c('0x8a')]({'plain':!![]});_0x4d1e50[0x1]=_0x4d1e50[0x1][_0x031c('0x8a')]({'plain':!![]});delete _0x4d1e50[0x0]['id'];delete _0x4d1e50[0x1]['id'];return _['mergeWith'](_0x4d1e50[0x0],_0x4d1e50[0x1],function(_0xb78df5,_0x22caf0){if(Array[_0x031c('0x8b')](_0x22caf0)&&!_0x22caf0[_0x031c('0x22')]){return _0xb78df5;}else if(!_0x22caf0){return _0xb78df5;}});}})[_0x031c('0x1a')](handleEntityNotFound(_0x33712d,null))['then'](function(_0x4daee8){if(_0x4daee8){if(_0x4daee8[_0x031c('0x8c')]&&_[_0x031c('0x8b')](_0x4daee8[_0x031c('0x8c')])){_0x4daee8[_0x031c('0x8c')]=_0x4daee8[_0x031c('0x8c')][_0x031c('0x8d')]();}logger[_0x031c('0x8e')]('[CmContact][merge]\x20to\x20%s\x20from\x20%s',_0x610948[_0x031c('0x89')]['to'],_0x610948[_0x031c('0x89')][_0x031c('0x35')]);return db['CmHopper'][_0x031c('0x1b')]({'where':{'ContactId':[_0x610948[_0x031c('0x89')]['to'],_0x610948['body'][_0x031c('0x35')]]}})['then'](function(_0x30d2ed){logger[_0x031c('0x8e')](_0x031c('0x8f'),_0x30d2ed);return db[_0x031c('0x90')][_0x031c('0x1b')]({'where':{'ContactId':[_0x610948[_0x031c('0x89')]['to'],_0x610948[_0x031c('0x89')][_0x031c('0x35')]]}})[_0x031c('0x1a')](function(_0x419b15){logger[_0x031c('0x8e')]('[CmContact][merge][destroy][CmHopperBlack],\x20%s',_0x419b15);return db[_0x031c('0x82')][_0x031c('0x91')](_0x4daee8);});});}})[_0x031c('0x1a')](function(_0x5eb06a){if(_0x5eb06a){_0x26cbd2=_0x5eb06a;_0x1288b2={'ContactId':_0x26cbd2['id']};_0x5a5aa6={'where':{'ContactId':[_0x610948[_0x031c('0x89')]['to'],_0x610948['body'][_0x031c('0x35')]]}};return db['ChatInteraction'][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0x92')]['update'](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0x93')][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0x94')][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0x95')][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0x94')][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})['then'](function(){if(_0x26cbd2){return db['MailMessage'][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db['SmsInteraction'][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0x96')][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0x97')][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0x98')][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0x99')][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})['then'](function(){if(_0x26cbd2){return db['OpenchannelMessage'][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db['CmContactHasItem']['update']({'CmContactId':_0x26cbd2['id']},{'where':{'CmContactId':[_0x610948[_0x031c('0x89')]['to'],_0x610948[_0x031c('0x89')][_0x031c('0x35')]]}});}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0x9a')][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0x9b')][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0x9c')][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db['VoiceCallReport']['update'](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0x9d')]['update'](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db['FaxQueueReport'][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})['then'](function(){if(_0x26cbd2){return db[_0x031c('0x9e')][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})['then'](function(){if(_0x26cbd2){return db[_0x031c('0x9f')]['update'](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0xa0')]['update'](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0xa1')]['update'](_0x1288b2,_0x5a5aa6);}})['then'](function(){if(_0x26cbd2){return db['WhatsappInteraction'][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0xa2')][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db['WhatsappQueueReport'][_0x031c('0x19')](_0x1288b2,_0x5a5aa6);}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return db[_0x031c('0x82')][_0x031c('0x1b')]({'where':{'id':[_0x610948['body']['to'],_0x610948[_0x031c('0x89')][_0x031c('0x35')]]}});}})[_0x031c('0x1a')](function(){if(_0x26cbd2){return _0x26cbd2;}})[_0x031c('0x1a')](respondWithResult(_0x33712d,null))[_0x031c('0x81')](handleError(_0x33712d,null));};exports[_0x031c('0x91')]=function(_0x45a3c1,_0x57820d){return db[_0x031c('0x82')]['describe']()[_0x031c('0x1a')](function(_0x536bb8){if(_0x45a3c1['body'][_0x031c('0x8c')]&&_[_0x031c('0x8b')](_0x45a3c1['body'][_0x031c('0x8c')])){if(_0x45a3c1[_0x031c('0x89')]['tags']['length']){_0x45a3c1[_0x031c('0x89')]['tags']=_0x45a3c1[_0x031c('0x89')][_0x031c('0x8c')][_0x031c('0x8d')](';')+';';}else{_0x45a3c1[_0x031c('0x89')]['tags']=null;}}else{_0x45a3c1['body'][_0x031c('0x8c')]=null;}if(!_[_0x031c('0x4f')](_0x45a3c1[_0x031c('0x89')][_0x031c('0xa3')])){var _0x571726=_0x45a3c1[_0x031c('0x89')]['dialTimezone'];if(!_[_0x031c('0x4f')](shared[_0x031c('0xa4')][_0x571726]))_0x45a3c1[_0x031c('0x89')][_0x031c('0xa5')]=shared[_0x031c('0xa4')][_0x571726][_0x031c('0xa5')];}return db[_0x031c('0x82')]['create'](_0x45a3c1[_0x031c('0x89')],{'fields':_[_0x031c('0x29')](_0x536bb8),'raw':!![]});})[_0x031c('0x1a')](function(_0x28799d){if(_0x45a3c1[_0x031c('0x89')][_0x031c('0xa6')]){return insertAdditionalPhones(_0x28799d,_0x45a3c1['body'][_0x031c('0xa6')]);}else{return _0x28799d;}})['then'](respondWithResult(_0x57820d,0xc9))[_0x031c('0x81')](handleError(_0x57820d,null));};exports[_0x031c('0xa7')]=function(_0x5a8085,_0x453eb6){var _0xd1d11e=0x0;var _0x5959cb=0x0;var _0x2e382f=0x0;var _0x388e89=[];return db['CmContact'][_0x031c('0x21')]()[_0x031c('0x1a')](function(_0x541dd8){return BPromise[_0x031c('0xa8')](_0x5a8085[_0x031c('0x89')],function(_0x2dafee){var _0x584648={'where':{'$or':[]},'defaults':_0x2dafee,'fields':_[_0x031c('0x29')](_0x541dd8),'raw':!![]};if(_0x2dafee[_0x031c('0xa9')]){for(var _0xef9bd0=0x0;_0xef9bd0<_0x2dafee['duplicates'][_0x031c('0x22')];_0xef9bd0++){var _0x56c353={};_0x56c353[_0x2dafee[_0x031c('0xa9')][_0xef9bd0]]=_0x2dafee[_0x2dafee[_0x031c('0xa9')][_0xef9bd0]];_0x584648[_0x031c('0x31')]['$or'][_0x031c('0x51')](_0x56c353);}_0x584648[_0x031c('0x31')]['ListId']=_0x2dafee[_0x031c('0x52')];}return db[_0x031c('0x82')][_0x031c('0xaa')](_0x584648)['spread'](function(_0x2ece27,_0x5bd64b){if(_0x5bd64b){if(_0x2dafee['hasOwnProperty']('additionalPhones')){_0x388e89['push']({'contact':_0x2ece27,'additionalPhones':_0x2dafee[_0x031c('0xa6')]});}_0xd1d11e++;}else{_0x2e382f++;}})[_0x031c('0x81')](function(){_0x5959cb++;});});})['then'](function(_0x341035){if(_0x341035){if(_0x388e89[_0x031c('0x22')]>0x0){return new Promise(function(_0x4bab1a,_0x32552e){var _0x5c94a3=[];for(var _0xc58274=0x0;_0xc58274<_0x388e89[_0x031c('0x22')];_0xc58274++){_0x5c94a3['push'](insertAdditionalPhones(_0x388e89[_0xc58274]['contact'],_0x388e89[_0xc58274]['additionalPhones']));}Promise['all'](_0x5c94a3)['then'](function(){_0x4bab1a(0x1);});})[_0x031c('0x1a')](function(){return{'success':_0xd1d11e,'failure':_0x5959cb,'duplicates':_0x2e382f};});}else{return{'success':_0xd1d11e,'failure':_0x5959cb,'duplicates':_0x2e382f};}}})[_0x031c('0x1a')](respondWithResult(_0x453eb6,0xc9))[_0x031c('0x81')](handleError(_0x453eb6,null));};exports[_0x031c('0xab')]=function(_0x4016ce,_0x2ffdf9){var _0x50cc7b;return db['CmContact']['describe']()['then'](function(_0x1e30e1){return db[_0x031c('0x82')][_0x031c('0x41')]({'where':{'id':_0x4016ce[_0x031c('0xac')]['id']},'include':[{'model':db['Tag'],'as':_0x031c('0x80'),'attributes':['id',_0x031c('0x1f'),_0x031c('0x34')],'required':_0x4016ce[_0x031c('0x28')][_0x031c('0x54')]?!![]:![]},{'model':db[_0x031c('0xad')],'as':_0x031c('0xae'),'where':{'CmContactId':_0x4016ce[_0x031c('0xac')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x031c('0xaf')}]}],'order':[db[_0x031c('0x72')]['literal']('Phones.OrderBy')],'attributes':_[_0x031c('0x29')](_0x1e30e1)});})[_0x031c('0x1a')](function(_0xbabdd6){if(!_[_0x031c('0x4f')](_0xbabdd6)){_0x50cc7b=_0xbabdd6[_0x031c('0x8a')]({'plain':!![]});var _0x46c05e={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xbabdd6&&_0xbabdd6[_0x031c('0x52')]){if(_0xbabdd6[_0x031c('0x52')]){_0x46c05e[_0x031c('0x31')][_0x031c('0xb0')][_0x031c('0x51')]({'ListId':{'$ne':_0xbabdd6[_0x031c('0x52')]}});}}return db['CmCustomField'][_0x031c('0x86')](_0x46c05e);}})[_0x031c('0x1a')](function(_0x59eabc){if(!_[_0x031c('0x4f')](_0x59eabc)){return _[_0x031c('0xb1')](_0x50cc7b,_[_0x031c('0x6f')](_0x59eabc,function(_0x4f2987){return util[_0x031c('0xb2')](_0x031c('0xb3'),_0x4f2987['id']);}));}})['then'](handleEntityNotFound(_0x2ffdf9,null))[_0x031c('0x1a')](respondWithResult(_0x2ffdf9,null))[_0x031c('0x81')](handleError(_0x2ffdf9,null));};exports[_0x031c('0x19')]=function(_0x67a528,_0x5db05b){var _0x5e279d;if(_0x67a528['body']['id']){delete _0x67a528[_0x031c('0x89')]['id'];}if(!_[_0x031c('0x4f')](_0x67a528['body'][_0x031c('0xa3')])){var _0x422a1a=_0x67a528[_0x031c('0x89')][_0x031c('0xa3')];if(!_['isNil'](shared['timezones'][_0x422a1a]))_0x67a528['body'][_0x031c('0xa5')]=shared['timezones'][_0x422a1a]['utcOffset'];}return db[_0x031c('0x82')][_0x031c('0x41')]({'where':{'id':_0x67a528[_0x031c('0xac')]['id']}})[_0x031c('0x1a')](handleEntityNotFound(_0x5db05b,null))['then'](saveUpdates(_0x67a528['body'],null))[_0x031c('0x1a')](function(_0x3e6d9d){_0x5e279d=_0x3e6d9d;var _0x4cca4a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3e6d9d&&_0x3e6d9d[_0x031c('0x52')]){if(_0x3e6d9d[_0x031c('0x52')]){_0x4cca4a[_0x031c('0x31')][_0x031c('0xb0')][_0x031c('0x51')]({'ListId':{'$ne':_0x3e6d9d[_0x031c('0x52')]}});}}return db['CmCustomField'][_0x031c('0x86')](_0x4cca4a);})[_0x031c('0x1a')](function(_0x1c16f3){if(_0x1c16f3){return _['omit'](_[_0x031c('0xb4')](_0x67a528['body'],function(_0x803431,_0x2ba910){return _['startsWith'](_0x2ba910,_0x031c('0x24'));}),_['map'](_0x1c16f3,function(_0x4be858){return util[_0x031c('0xb2')]('cf_%d',_0x4be858['id']);}));}})[_0x031c('0x1a')](function(_0xdb9e46){if(_0xdb9e46&&!_[_0x031c('0x66')](_0xdb9e46)){var _0x143b15=squel[_0x031c('0x19')]()['table'](_0x031c('0xb5'))[_0x031c('0xb6')](_0xdb9e46)[_0x031c('0x31')](_0x031c('0xb7'),_0x67a528['params']['id'])['toParam']();return db[_0x031c('0x72')][_0x031c('0x28')](_0x143b15[_0x031c('0x4d')],{'replacements':_0x143b15[_0x031c('0x88')]});}})[_0x031c('0x1a')](function(){if(_0x67a528['body']['phone']&&_0x5e279d){return db['CmHopper'][_0x031c('0x19')]({'phone':_0x67a528['body'][_0x031c('0xb8')],'OrderBy':0x0},{'where':{'ContactId':_0x5e279d['id']}});}})[_0x031c('0x1a')](function(){return _0x5e279d;})[_0x031c('0x1a')](respondWithResult(_0x5db05b,null))[_0x031c('0x81')](handleError(_0x5db05b,null));};exports['getTags']=function(_0x2a9125,_0x54ae8a){var _0x413ac5={};var _0x303301={};var _0x263789;var _0x198e04;return db[_0x031c('0x82')][_0x031c('0xb9')]({'where':{'id':_0x2a9125['params']['id']}})[_0x031c('0x1a')](handleEntityNotFound(_0x54ae8a,null))['then'](function(_0x4fe6b9){if(_0x4fe6b9){_0x263789=_0x4fe6b9;_0x303301['model']=_[_0x031c('0x29')](db['Tag']['rawAttributes']);_0x303301[_0x031c('0x28')]=_[_0x031c('0x29')](_0x2a9125[_0x031c('0x28')]);_0x303301['filters']=_[_0x031c('0xba')](_0x303301[_0x031c('0x2a')],_0x303301[_0x031c('0x28')]);_0x413ac5[_0x031c('0x2b')]=_[_0x031c('0xba')](_0x303301['model'],qs[_0x031c('0x2c')](_0x2a9125[_0x031c('0x28')][_0x031c('0x2c')]));_0x413ac5[_0x031c('0x2b')]=_0x413ac5[_0x031c('0x2b')][_0x031c('0x22')]?_0x413ac5[_0x031c('0x2b')]:_0x303301[_0x031c('0x2a')];_0x413ac5[_0x031c('0x2f')]=qs['sort'](_0x2a9125['query'][_0x031c('0x30')]);_0x413ac5['where']=qs['filters'](_[_0x031c('0xbb')](_0x2a9125['query'],_0x303301[_0x031c('0x32')]));if(_0x2a9125[_0x031c('0x28')][_0x031c('0x55')]){_0x413ac5['where']=_['merge'](_0x413ac5['where'],{'$or':_[_0x031c('0x6f')](_0x413ac5[_0x031c('0x2b')],function(_0x343c2f){var _0x58e9ff={};_0x58e9ff[_0x343c2f]={'$like':'%'+_0x2a9125['query'][_0x031c('0x55')]+'%'};return _0x58e9ff;})});}_0x413ac5=_[_0x031c('0x75')]({},_0x413ac5,_0x2a9125[_0x031c('0xbc')]);return _0x263789[_0x031c('0xbd')](_0x413ac5);}})[_0x031c('0x1a')](function(_0xfc958d){if(_0xfc958d){_0x198e04=_0xfc958d[_0x031c('0x22')];if(!_0x2a9125['query'][_0x031c('0x2d')](_0x031c('0x2e'))){_0x413ac5[_0x031c('0x16')]=qs[_0x031c('0x16')](_0x2a9125[_0x031c('0x28')][_0x031c('0x16')]);_0x413ac5[_0x031c('0x13')]=qs[_0x031c('0x13')](_0x2a9125[_0x031c('0x28')][_0x031c('0x13')]);}return _0x263789[_0x031c('0xbd')](_0x413ac5);}})[_0x031c('0x1a')](function(_0x4e98b5){if(_0x4e98b5){return _0x4e98b5?{'count':_0x198e04,'rows':_0x4e98b5}:null;}})['then'](respondWithResult(_0x54ae8a,null))[_0x031c('0x81')](handleError(_0x54ae8a,null));};exports[_0x031c('0xbe')]=function(_0x823380,_0x5d1a4d){if(_0x823380[_0x031c('0x89')]['id']){delete _0x823380[_0x031c('0x89')]['id'];}return db['CmContact'][_0x031c('0xb9')]({'where':{'id':_0x823380[_0x031c('0xac')]['id']}})[_0x031c('0x1a')](handleEntityNotFound(_0x5d1a4d,null))['then'](function(_0x4ddcb5){if(_0x4ddcb5){return _0x4ddcb5['setTags'](_0x823380[_0x031c('0x89')][_0x031c('0xbf')]||[]);}return null;})[_0x031c('0x1a')](respondWithResult(_0x5d1a4d,null))[_0x031c('0x81')](handleError(_0x5d1a4d,null));};exports['setAdditionalPhones']=function(_0x5391e1,_0x36d9fc){var _0x3455ad=[];_0x3455ad['push'](addAdditionalPhones(_0x5391e1[_0x031c('0x89')]));Promise[_0x031c('0xc0')](_0x3455ad)[_0x031c('0x1a')](function(){_0x3455ad=[];_0x3455ad['push'](deleteCmHopperPhones(_0x5391e1[_0x031c('0x89')]['id']));_0x3455ad[_0x031c('0x51')](addCmHopperPhones(_0x5391e1[_0x031c('0x89')]['id']));Promise['all'](_0x3455ad)['then'](function(){return[0x1];})[_0x031c('0x1a')](respondWithResult(_0x36d9fc,null));});};function addAdditionalPhones(_0x1bcdd7){var _0x2d76f1;return new Promise(function(_0x2d265e,_0x54c69f){return db[_0x031c('0xad')][_0x031c('0x1b')]({'where':{'CmContactId':_0x1bcdd7['id']}})['then'](function(){db[_0x031c('0xc1')][_0x031c('0x86')]({'raw':!![],'attributes':['id','OrderBy']})[_0x031c('0x1a')](function(_0x46f72e){var _0x1c680c=[];for(var _0x3637cf=0x0;_0x3637cf<_0x1bcdd7[_0x031c('0xc2')]['length'];_0x3637cf++){var _0x15fcb0=_0x1bcdd7[_0x031c('0xc3')]?_[_0x031c('0x4f')](_0x1bcdd7[_0x031c('0xc3')][_0x3637cf])?'':_0x1bcdd7['item_types'][_0x3637cf]:_0x1bcdd7[_0x031c('0xc2')][_0x3637cf][_0x031c('0xc4')]?_0x1bcdd7[_0x031c('0xc2')][_0x3637cf]['ItemTypeId']:'';var _0x440dfd=_[_0x031c('0x4f')](_0x1bcdd7[_0x031c('0xc2')][_0x3637cf][_0x031c('0xc5')])?'':_0x1bcdd7[_0x031c('0xc2')][_0x3637cf][_0x031c('0xc5')];var _0x2e257c=_0x15fcb0+':'+_0x1bcdd7['items'][_0x3637cf][_0x031c('0xb8')]+'§'+_0x440dfd;if(_['isNil'](_0x2d76f1))_0x2d76f1=_0x2e257c;else _0x2d76f1+=';'+_0x2e257c;var _0x29117c=null;if(_0x1bcdd7[_0x031c('0xc3')]){if(!_[_0x031c('0x4f')](_0x1bcdd7[_0x031c('0xc3')][_0x3637cf])){var _0x163358=_[_0x031c('0x41')](_0x46f72e,function(_0x2534ba){return _0x2534ba['id']===_0x1bcdd7[_0x031c('0xc3')][_0x3637cf];});if(!_['isNil'](_0x163358)){_0x29117c=_0x163358[_0x031c('0xc6')];}}}else{if(!_[_0x031c('0x4f')](_0x1bcdd7[_0x031c('0xc2')][_0x3637cf])){var _0x163358=_[_0x031c('0x41')](_0x46f72e,function(_0x3b9416){return _0x3b9416['id']===_0x1bcdd7[_0x031c('0xc2')][_0x3637cf]['ItemTypeId'];});if(!_[_0x031c('0x4f')](_0x163358)){_0x29117c=_0x3637cf;}}}if(_['isNil'](_0x29117c)){_0x29117c=0x64;}_0x1c680c[_0x031c('0x51')](addAdditionalPhone(_0x1bcdd7['id'],_0x1bcdd7['items'][_0x3637cf][_0x031c('0xb8')],_0x1bcdd7[_0x031c('0xc3')]?_['isNil'](_0x1bcdd7[_0x031c('0xc3')][_0x3637cf])?null:_0x1bcdd7[_0x031c('0xc3')][_0x3637cf]:_0x1bcdd7[_0x031c('0xc2')][_0x3637cf][_0x031c('0xc4')]?_0x1bcdd7[_0x031c('0xc2')][_0x3637cf][_0x031c('0xc4')]:null,_0x29117c,_0x440dfd));}Promise[_0x031c('0xc0')](_0x1c680c)['then'](function(){db[_0x031c('0x82')][_0x031c('0x19')]({'AdditionalPhones':_0x2d76f1},{'where':{'id':_0x1bcdd7['id']}})[_0x031c('0x1a')](function(){_0x2d265e(0x1);});});});});});}function addAdditionalPhone(_0x23289c,_0xe0dd88,_0x14ea8d,_0x369e9b,_0x5bd53b){return db[_0x031c('0xad')][_0x031c('0x41')]({'where':{'CmContactId':_0x23289c,'item':_0xe0dd88}})[_0x031c('0x1a')](function(_0x3d0430){if(_0x3d0430)logger['info']('contact\x20phone\x20exists',_0x3d0430);else{db[_0x031c('0xad')][_0x031c('0x91')]({'CmContactId':_0x23289c,'item':_0xe0dd88,'ItemTypeId':_0x14ea8d,'OrderBy':_0x369e9b,'ItemClass':_0x031c('0xc7'),'description':_0x5bd53b});}});}function deletePhones(_0x5b850f){return db[_0x031c('0xad')]['destroy']({'where':{'CmContactId':_0x5b850f}});}function deleteCmHopperPhones(_0x100889){return new Promise(function(_0x215bc0,_0x5ba7b6){return db['CmHopper'][_0x031c('0x86')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x100889}})[_0x031c('0x1a')](function(_0x26925a){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_[_0x031c('0x6f')](_0x26925a,'id')}}});})[_0x031c('0x1a')](function(){_0x215bc0(0x1);});});}function addCmHopperPhones(_0x25a282){return new Promise(function(_0x504535,_0x5bb6da){return db[_0x031c('0xc8')][_0x031c('0x86')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x25a282}})['then'](function(_0xb7bd53){var _0x54fcb3=[];_[_0x031c('0x6f')](_0xb7bd53,function(_0x379d44){_0x54fcb3[_0x031c('0x51')](createCmHopperPhone(_0x25a282,_0x379d44['id']));});Promise[_0x031c('0xc0')](_0x54fcb3)['then'](function(){_0x504535(0x1);});});});}function createCmHopperPhone(_0x336480,_0x594c64){return new Promise(function(_0xc14dab,_0x57387d){db[_0x031c('0xad')][_0x031c('0x86')]({'raw':!![],'attributes':[_0x031c('0xc9'),_0x031c('0xc6')],'where':{'CmContactId':_0x336480,'ItemClass':_0x031c('0xc7')},'include':[{'model':db[_0x031c('0xc1')],'attributes':[_0x031c('0xc6')],'as':_0x031c('0xaf')}],'order':[_0x031c('0xc6'),db[_0x031c('0x72')][_0x031c('0xca')]('`ItemType`.OrderBy')]})[_0x031c('0x1a')](function(_0x4d5279){var _0x18efde=0x1;var _0x25bc80=_[_0x031c('0x6f')](_0x4d5279,function(_0x4dafc8){_0x4dafc8['CmHopperId']=_0x594c64;_0x4dafc8['phone']=_0x4dafc8['item'];_0x4dafc8[_0x031c('0xc6')]=_0x18efde;delete _0x4dafc8['ItemType.OrderBy'];_0x18efde=_0x18efde+0x1;return _0x4dafc8;});return db[_0x031c('0xcb')][_0x031c('0xa7')](_0x25bc80,{});})[_0x031c('0x1a')](function(){_0xc14dab(0x1);});});}function insertAdditionalPhones(_0x59a293,_0x348908){return new Promise(function(_0x24393e,_0x36d0bf){var _0x2dd29e=[];for(var _0x3ea031=0x0;_0x3ea031<_0x348908[_0x031c('0x22')];_0x3ea031++){var _0x37313e=_0x348908[_0x3ea031];_0x2dd29e[_0x031c('0x51')](parseContactItemType(_0x37313e));}Promise['all'](_0x2dd29e)[_0x031c('0x1a')](function(){var _0x5cd268={'id':_0x59a293['id'],'items':_0x348908};return addAdditionalPhones(_0x5cd268)[_0x031c('0x1a')](function(_0x2c0cda){return addCmHopperPhones(_0x59a293['id']);});})[_0x031c('0x1a')](function(){_0x24393e(_0x59a293);});});}function parseContactItemType(_0x3e6435){return new Promise(function(_0x5b584c,_0x4288e3){if(_0x3e6435['hasOwnProperty'](_0x031c('0xc4'))){_0x5b584c(_0x3e6435);}else{return db[_0x031c('0xc1')][_0x031c('0x41')]({'where':{'name':_0x3e6435[_0x031c('0xaf')]}})[_0x031c('0x1a')](function(_0x22e14c){if(_[_0x031c('0x4f')](_0x22e14c))_0x3e6435[_0x031c('0xc4')]=null;else _0x3e6435[_0x031c('0xc4')]=_0x22e14c['id'];_0x5b584c(_0x3e6435);});}});}exports[_0x031c('0xcc')]=function(_0x18d15e,_0x9aac00){return db['CmContactHasItem'][_0x031c('0x86')]({'raw':!![],'where':{'CmContactId':_0x18d15e[_0x031c('0xac')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x031c('0xc1')],'as':_0x031c('0xaf')}],'order':[[_0x031c('0xc6')],[db[_0x031c('0x72')]['literal']('`ItemType`.OrderBy')]]})[_0x031c('0x1a')](function(_0x1516e8){return _0x1516e8;})[_0x031c('0x1a')](respondWithResult(_0x9aac00,null))[_0x031c('0x81')](handleError(_0x9aac00,null));};exports[_0x031c('0xcd')]=function(_0x3ce9d2,_0x18ff91){return db[_0x031c('0xad')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3ce9d2[_0x031c('0x89')][_0x031c('0xce')]}})[_0x031c('0x1a')](function(_0x3cfa07){var _0x2043a4=_[_0x031c('0x6f')](_0x3cfa07,function(_0x11d7a6){_0x11d7a6[_0x031c('0xcf')]=_0x3ce9d2[_0x031c('0x89')]['toContactId'];return _0x11d7a6;});return db[_0x031c('0xad')][_0x031c('0xa7')](_0x2043a4,{});})['then'](function(_0x479f45){return addCmHopperPhones(_0x3ce9d2[_0x031c('0x89')][_0x031c('0xd0')]);})[_0x031c('0x1a')](function(_0x15d28d){return['ok'];})[_0x031c('0x1a')](respondWithResult(_0x18ff91,null))['catch'](handleError(_0x18ff91,null));};exports[_0x031c('0xd1')]=function(_0x342db4,_0x25a375){var _0x32a827=[];_0x32a827[_0x031c('0x51')](createCmHopperPhone(_0x342db4['body']['id'],_0x342db4[_0x031c('0x89')][_0x031c('0xd2')]));Promise[_0x031c('0xc0')](_0x32a827)[_0x031c('0x1a')](function(){return[0x1];})[_0x031c('0x1a')](respondWithResult(_0x25a375,null));};exports[_0x031c('0xd3')]=function(_0x2140bd,_0x3fb868){var _0x5e9a59={'raw':![],'where':{}};var _0x5952e6={};var _0x21f0ff={'count':0x0,'rows':[]};return db[_0x031c('0x82')][_0x031c('0xb9')]({'where':{'id':_0x2140bd[_0x031c('0xac')]['id']}})['then'](handleEntityNotFound(_0x3fb868,null))[_0x031c('0x1a')](function(_0x3f7492){if(_0x3f7492){_0x5952e6['model']=_[_0x031c('0x29')](db[_0x031c('0xc8')][_0x031c('0xd4')]);_0x5952e6[_0x031c('0x28')]=_[_0x031c('0x29')](_0x2140bd[_0x031c('0x28')]);_0x5952e6['filters']=_[_0x031c('0xba')](_0x5952e6[_0x031c('0x2a')],_0x5952e6[_0x031c('0x28')]);_0x5e9a59[_0x031c('0x2b')]=_[_0x031c('0xba')](_0x5952e6['model'],qs[_0x031c('0x2c')](_0x2140bd[_0x031c('0x28')][_0x031c('0x2c')]));_0x5e9a59[_0x031c('0x2b')]=_0x5e9a59[_0x031c('0x2b')]['length']?_0x5e9a59['attributes']:_0x5952e6['model'];if(!_0x2140bd['query']['hasOwnProperty'](_0x031c('0x2e'))){_0x5e9a59[_0x031c('0x16')]=qs[_0x031c('0x16')](_0x2140bd[_0x031c('0x28')][_0x031c('0x16')]);_0x5e9a59[_0x031c('0x13')]=qs[_0x031c('0x13')](_0x2140bd[_0x031c('0x28')][_0x031c('0x13')]);}_0x5e9a59[_0x031c('0x2f')]=qs['sort'](_0x2140bd[_0x031c('0x28')]['sort']);_0x5e9a59[_0x031c('0x31')]=qs[_0x031c('0x32')](_[_0x031c('0xbb')](_0x2140bd[_0x031c('0x28')],_0x5952e6[_0x031c('0x32')]));_0x5e9a59['where'][_0x031c('0xd5')]=_0x3f7492['id'];if(_0x2140bd[_0x031c('0x28')]['filter']){_0x5e9a59[_0x031c('0x31')]=_['merge'](_0x5e9a59[_0x031c('0x31')],{'$or':_['map'](_0x5e9a59[_0x031c('0x2b')],function(_0x210d45){var _0x3948ab={};_0x3948ab[_0x210d45]={'$like':'%'+_0x2140bd[_0x031c('0x28')][_0x031c('0x55')]+'%'};return _0x3948ab;})});}_0x5e9a59=_[_0x031c('0x75')]({},_0x5e9a59,_0x2140bd[_0x031c('0xbc')]);return db['CmHopper'][_0x031c('0x15')]({'where':_0x5e9a59['where']})[_0x031c('0x1a')](function(_0x235b3d){_0x21f0ff[_0x031c('0x15')]=_0x235b3d;if(_0x2140bd[_0x031c('0x28')][_0x031c('0xd6')]){_0x5e9a59[_0x031c('0xd7')]=[{'all':!![]}];}return db[_0x031c('0xc8')][_0x031c('0x86')](_0x5e9a59);})['then'](function(_0x2fe85f){_0x21f0ff[_0x031c('0xd8')]=_0x2fe85f;return _0x21f0ff;});}})[_0x031c('0x1a')](respondWithFilteredResult(_0x3fb868,_0x5e9a59))[_0x031c('0x81')](handleError(_0x3fb868,null));};exports[_0x031c('0xd9')]=function(_0x3fcc81,_0x24df0d){var _0x27655f={'raw':!![],'where':{}};var _0x12b264={};var _0x45429d={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x3fcc81[_0x031c('0xac')]['id']}})[_0x031c('0x1a')](handleEntityNotFound(_0x24df0d,null))[_0x031c('0x1a')](function(_0x1141f1){if(_0x1141f1){_0x12b264[_0x031c('0x2a')]=_[_0x031c('0x29')](db[_0x031c('0x9b')]['rawAttributes']);_0x12b264[_0x031c('0x28')]=_[_0x031c('0x29')](_0x3fcc81[_0x031c('0x28')]);_0x12b264['filters']=_[_0x031c('0xba')](_0x12b264[_0x031c('0x2a')],_0x12b264[_0x031c('0x28')]);_0x27655f[_0x031c('0x2b')]=_['intersection'](_0x12b264[_0x031c('0x2a')],qs[_0x031c('0x2c')](_0x3fcc81[_0x031c('0x28')][_0x031c('0x2c')]));_0x27655f['attributes']=_0x27655f[_0x031c('0x2b')][_0x031c('0x22')]?_0x27655f[_0x031c('0x2b')]:_0x12b264['model'];if(!_0x3fcc81[_0x031c('0x28')][_0x031c('0x2d')](_0x031c('0x2e'))){_0x27655f[_0x031c('0x16')]=qs[_0x031c('0x16')](_0x3fcc81[_0x031c('0x28')][_0x031c('0x16')]);_0x27655f[_0x031c('0x13')]=qs[_0x031c('0x13')](_0x3fcc81['query'][_0x031c('0x13')]);}_0x27655f[_0x031c('0x2f')]=qs['sort'](_0x3fcc81[_0x031c('0x28')][_0x031c('0x30')]);_0x27655f[_0x031c('0x31')]=qs['filters'](_[_0x031c('0xbb')](_0x3fcc81['query'],_0x12b264['filters']));_0x27655f['where'][_0x031c('0xd5')]=_0x1141f1['id'];if(_0x3fcc81['query']['filter']){_0x27655f['where']=_[_0x031c('0x75')](_0x27655f['where'],{'$or':_[_0x031c('0x6f')](_0x27655f[_0x031c('0x2b')],function(_0x3d84b0){var _0x504681={};_0x504681[_0x3d84b0]={'$like':'%'+_0x3fcc81[_0x031c('0x28')][_0x031c('0x55')]+'%'};return _0x504681;})});}_0x27655f=_[_0x031c('0x75')]({},_0x27655f,_0x3fcc81[_0x031c('0xbc')]);return db[_0x031c('0x9b')][_0x031c('0x15')]({'where':_0x27655f[_0x031c('0x31')]})[_0x031c('0x1a')](function(_0x3ca6d2){_0x45429d[_0x031c('0x15')]=_0x3ca6d2;if(_0x3fcc81[_0x031c('0x28')][_0x031c('0xd6')]){_0x27655f[_0x031c('0xd7')]=[{'all':!![]}];}return db[_0x031c('0x9b')][_0x031c('0x86')](_0x27655f);})[_0x031c('0x1a')](function(_0x4e466c){_0x45429d[_0x031c('0xd8')]=_0x4e466c;return _0x45429d;});}})[_0x031c('0x1a')](respondWithFilteredResult(_0x24df0d,_0x27655f))[_0x031c('0x81')](handleError(_0x24df0d,null));};exports[_0x031c('0xda')]=function(_0x2d28e7,_0x55b6c1){var _0x3a7b26={'raw':!![],'where':{}};var _0x5bd838={};var _0x31d1b2={'count':0x0,'rows':[]};return db[_0x031c('0x82')]['findOne']({'where':{'id':_0x2d28e7['params']['id']}})['then'](handleEntityNotFound(_0x55b6c1,null))[_0x031c('0x1a')](function(_0x21e189){if(_0x21e189){_0x5bd838[_0x031c('0x2a')]=_[_0x031c('0x29')](db[_0x031c('0x9a')][_0x031c('0xd4')]);_0x5bd838[_0x031c('0x28')]=_['keys'](_0x2d28e7[_0x031c('0x28')]);_0x5bd838[_0x031c('0x32')]=_[_0x031c('0xba')](_0x5bd838['model'],_0x5bd838[_0x031c('0x28')]);_0x3a7b26[_0x031c('0x2b')]=_[_0x031c('0xba')](_0x5bd838[_0x031c('0x2a')],qs['fields'](_0x2d28e7[_0x031c('0x28')]['fields']));_0x3a7b26['attributes']=_0x3a7b26[_0x031c('0x2b')][_0x031c('0x22')]?_0x3a7b26['attributes']:_0x5bd838[_0x031c('0x2a')];if(!_0x2d28e7[_0x031c('0x28')][_0x031c('0x2d')](_0x031c('0x2e'))){_0x3a7b26[_0x031c('0x16')]=qs[_0x031c('0x16')](_0x2d28e7['query'][_0x031c('0x16')]);_0x3a7b26[_0x031c('0x13')]=qs[_0x031c('0x13')](_0x2d28e7['query'][_0x031c('0x13')]);}_0x3a7b26[_0x031c('0x2f')]=qs['sort'](_0x2d28e7['query'][_0x031c('0x30')]);_0x3a7b26[_0x031c('0x31')]=qs[_0x031c('0x32')](_[_0x031c('0xbb')](_0x2d28e7['query'],_0x5bd838['filters']));_0x3a7b26[_0x031c('0x31')][_0x031c('0xd5')]=_0x21e189['id'];if(_0x2d28e7[_0x031c('0x28')][_0x031c('0x55')]){_0x3a7b26[_0x031c('0x31')]=_['merge'](_0x3a7b26[_0x031c('0x31')],{'$or':_[_0x031c('0x6f')](_0x3a7b26[_0x031c('0x2b')],function(_0xa82a2f){var _0x25879c={};_0x25879c[_0xa82a2f]={'$like':'%'+_0x2d28e7[_0x031c('0x28')][_0x031c('0x55')]+'%'};return _0x25879c;})});}_0x3a7b26=_[_0x031c('0x75')]({},_0x3a7b26,_0x2d28e7[_0x031c('0xbc')]);return db[_0x031c('0x9a')][_0x031c('0x15')]({'where':_0x3a7b26[_0x031c('0x31')]})[_0x031c('0x1a')](function(_0x103c58){_0x31d1b2[_0x031c('0x15')]=_0x103c58;if(_0x2d28e7[_0x031c('0x28')][_0x031c('0xd6')]){_0x3a7b26[_0x031c('0xd7')]=[{'all':!![]}];}return db[_0x031c('0x9a')][_0x031c('0x86')](_0x3a7b26);})[_0x031c('0x1a')](function(_0xf82305){_0x31d1b2[_0x031c('0xd8')]=_0xf82305;return _0x31d1b2;});}})[_0x031c('0x1a')](respondWithFilteredResult(_0x55b6c1,_0x3a7b26))[_0x031c('0x81')](handleError(_0x55b6c1,null));};exports['getJscriptySessions']=function(_0xfbeda6,_0x371de0){var _0x5e7765={'raw':!![],'where':{}};var _0x12563d={};var _0x595aa8={'count':0x0,'rows':[]};return db[_0x031c('0x82')]['findOne']({'where':{'id':_0xfbeda6['params']['id']}})['then'](handleEntityNotFound(_0x371de0,null))['then'](function(_0x2c51d8){if(_0x2c51d8){_0x12563d[_0x031c('0x2a')]=_[_0x031c('0x29')](db[_0x031c('0xa1')]['rawAttributes']);_0x12563d['query']=_[_0x031c('0x29')](_0xfbeda6[_0x031c('0x28')]);_0x12563d['filters']=_[_0x031c('0xba')](_0x12563d['model'],_0x12563d['query']);_0x5e7765['attributes']=_[_0x031c('0xba')](_0x12563d[_0x031c('0x2a')],qs[_0x031c('0x2c')](_0xfbeda6[_0x031c('0x28')][_0x031c('0x2c')]));_0x5e7765[_0x031c('0x2b')]=_0x5e7765[_0x031c('0x2b')][_0x031c('0x22')]?_0x5e7765['attributes']:_0x12563d[_0x031c('0x2a')];if(!_0xfbeda6['query'][_0x031c('0x2d')](_0x031c('0x2e'))){_0x5e7765['limit']=qs[_0x031c('0x16')](_0xfbeda6['query'][_0x031c('0x16')]);_0x5e7765[_0x031c('0x13')]=qs['offset'](_0xfbeda6[_0x031c('0x28')][_0x031c('0x13')]);}_0x5e7765['order']=qs[_0x031c('0x30')](_0xfbeda6[_0x031c('0x28')]['sort']);_0x5e7765[_0x031c('0x31')]=qs[_0x031c('0x32')](_[_0x031c('0xbb')](_0xfbeda6[_0x031c('0x28')],_0x12563d['filters']));_0x5e7765[_0x031c('0x31')][_0x031c('0xd5')]=_0x2c51d8['id'];if(_0xfbeda6[_0x031c('0x28')][_0x031c('0x55')]){_0x5e7765[_0x031c('0x31')]=_[_0x031c('0x75')](_0x5e7765[_0x031c('0x31')],{'$or':_[_0x031c('0x6f')](_0x5e7765[_0x031c('0x2b')],function(_0x4cbfc4){var _0x388ba4={};_0x388ba4[_0x4cbfc4]={'$like':'%'+_0xfbeda6[_0x031c('0x28')][_0x031c('0x55')]+'%'};return _0x388ba4;})});}_0x5e7765=_[_0x031c('0x75')]({},_0x5e7765,_0xfbeda6[_0x031c('0xbc')]);return db[_0x031c('0xa1')][_0x031c('0x15')]({'where':_0x5e7765['where']})['then'](function(_0x44b1de){_0x595aa8[_0x031c('0x15')]=_0x44b1de;if(_0xfbeda6['query'][_0x031c('0xd6')]){_0x5e7765[_0x031c('0xd7')]=[{'all':!![]}];}return db[_0x031c('0xa1')][_0x031c('0x86')](_0x5e7765);})['then'](function(_0x5dc154){_0x595aa8['rows']=_0x5dc154;return _0x595aa8;});}})[_0x031c('0x1a')](respondWithFilteredResult(_0x371de0,_0x5e7765))['catch'](handleError(_0x371de0,null));};exports['uploadCsv']=function(_0x289a72,_0x19fb80){try{if(!_0x289a72[_0x031c('0x89')][_0x031c('0x52')]){throw new Error(_0x031c('0xdb'));}if(!_0x289a72[_0x031c('0x89')][_0x031c('0xdc')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x289a72['body'][_0x031c('0xdd')]){throw new Error(_0x031c('0xde'));}if(!_0x289a72[_0x031c('0x89')]['socket_timestamp']){throw new Error(_0x031c('0xdf'));}var _0x35edcc=_0x289a72['body'][_0x031c('0xdc')]['split'](',');var _0x3c4908=_0x289a72[_0x031c('0x89')][_0x031c('0xdd')]['split'](',');if(!_0x35edcc[_0x031c('0x22')]||!_0x3c4908[_0x031c('0x22')]||_0x35edcc[_0x031c('0x22')]!==_0x3c4908[_0x031c('0x22')]){throw new Error(_0x031c('0xe0'));}_0x289a72['body']['fields']=_[_0x031c('0xe1')](_0x35edcc,_0x3c4908);if(!_0x289a72[_0x031c('0x89')][_0x031c('0x2c')]['phone']){throw new Error(_0x031c('0xe2'));}if(!_0x289a72['body'][_0x031c('0x2c')][_0x031c('0xe3')]){throw new Error(_0x031c('0xe4'));}var _0x57fd38=path[_0x031c('0x8d')](config[_0x031c('0xe5')],_0x031c('0xe6'),_0x289a72[_0x031c('0xe7')][_0x031c('0xe8')]);fs[_0x031c('0xe9')](_0x57fd38,parseInt('0777',0x8));var _0x126e29=require(_0x031c('0xea'))[_0x031c('0xeb')](path['join'](__dirname,_0x031c('0xec')),[_0x57fd38,_0x289a72[_0x031c('0x89')][_0x031c('0xdc')],_0x289a72[_0x031c('0x89')][_0x031c('0xdd')],_0x289a72[_0x031c('0x89')]['ListId'],_0x289a72[_0x031c('0x89')][_0x031c('0xed')],_0x289a72[_0x031c('0x89')]['duplicates'],_0x289a72[_0x031c('0x89')]['socket_timestamp']]);return _0x19fb80[_0x031c('0x12')](0xc8)[_0x031c('0x18')]({'message':_0x031c('0xee'),'pid':_0x126e29['pid']});}catch(_0x2e5112){return _0x19fb80[_0x031c('0x12')](0x1f4)[_0x031c('0xef')](_0x2e5112);}};exports[_0x031c('0xf0')]=function(_0x4524af,_0x54c43c){var _0x1cc997=fs[_0x031c('0xf1')](_0x4524af[_0x031c('0xe7')][_0x031c('0x3')]);Papa['parse'](_0x1cc997,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3099a2){return _0x54c43c[_0x031c('0x12')](0xc8)[_0x031c('0x18')]({'file':_0x4524af[_0x031c('0xe7')],'fields':_0x3099a2[_0x031c('0xf2')][_0x031c('0x2c')]});}});};exports[_0x031c('0xf3')]=function(_0x24584f,_0x57bf21){return db[_0x031c('0x6b')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x031c('0x71')}})['then'](function(_0x1f260f){var _0xbecb7f=![];if(!_0x24584f[_0x031c('0x89')]['ListId']){throw new Error(_0x031c('0xdb'));}if(!_0x24584f[_0x031c('0x89')][_0x031c('0xf4')]['phone']){throw new Error(_0x031c('0xe2'));}if(!_0x24584f[_0x031c('0x89')][_0x031c('0xf4')][_0x031c('0xe3')]){throw new Error(_0x031c('0xe4'));}if(!_0x24584f[_0x031c('0x89')][_0x031c('0xf5')]){throw new Error(_0x031c('0xdf'));}var _0x1bf03f=require('child_process')[_0x031c('0xeb')](path[_0x031c('0x8d')](__dirname,'../../components/import/cm/csv2'),[_0x24584f['params']['id'],JSON[_0x031c('0xf6')](_0x24584f[_0x031c('0x89')]),JSON[_0x031c('0xf6')](_0x1f260f)]);_0x1bf03f['on']('message',function(){_0xbecb7f=!![];return _0x57bf21[_0x031c('0x12')](0xc8)[_0x031c('0x18')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x1bf03f[_0x031c('0xf7')]});});_0x1bf03f['on'](_0x031c('0xf8'),function(_0x3bd441){if(_0x3bd441&&!_0xbecb7f){return _0x57bf21[_0x031c('0x12')](0x1f4)[_0x031c('0x18')]({'message':'error\x20child\x20process','pid':_0x1bf03f['pid']});}});})[_0x031c('0x81')](handleError(_0x57bf21,null));};exports[_0x031c('0xf9')]=function(_0x5f1d99,_0x22e34a,_0x1240cf){return db[_0x031c('0x6b')][_0x031c('0x86')]({'raw':!![],'attributes':['id'],'where':{'role':_0x031c('0x71')}})[_0x031c('0x1a')](function(_0x302c21){var _0x284955=![];if(!_0x5f1d99[_0x031c('0x89')][_0x031c('0x52')]){throw new Error('No\x20ListId\x20specified');}if(!_0x5f1d99[_0x031c('0x89')][_0x031c('0xf4')][_0x031c('0xb8')]){throw new Error(_0x031c('0xe2'));}if(!_0x5f1d99[_0x031c('0x89')][_0x031c('0xf4')][_0x031c('0xe3')]){throw new Error(_0x031c('0xe4'));}if(!_0x5f1d99['body'][_0x031c('0xf5')]){throw new Error(_0x031c('0xdf'));}var _0x3cedbd=require(_0x031c('0xea'))[_0x031c('0xeb')](path[_0x031c('0x8d')](__dirname,_0x031c('0xfa')),[_0x5f1d99[_0x031c('0xac')]['id'],JSON[_0x031c('0xf6')](_0x5f1d99['body']),JSON[_0x031c('0xf6')](_0x302c21)]);_0x3cedbd['on'](_0x031c('0xfb'),function(_0x3fad50){_0x284955=!![];return _0x22e34a[_0x031c('0x12')](0xc8)[_0x031c('0x18')]({'message':_0x031c('0xfc'),'pid':_0x3cedbd[_0x031c('0xf7')]});});_0x3cedbd['on'](_0x031c('0xf8'),function(_0x24b4f9){if(_0x24b4f9&&!_0x284955){return _0x22e34a['status'](0x1f4)['json']({'message':_0x031c('0xfd'),'pid':_0x3cedbd[_0x031c('0xf7')]});}});})[_0x031c('0x81')](handleError(_0x22e34a,null));};exports['getJourney']=function(_0x101ce4,_0x1d75ff){var _0x4a08d8=['mail','chat',_0x031c('0xfe'),_0x031c('0xff'),_0x031c('0x100'),'whatsapp','voice'];var _0x1a1417={'offset':0x0,'order':qs[_0x031c('0x30')](_0x031c('0x101'))},_0x1ae185={'count':0x0,'rows':[]};Promise[_0x031c('0x69')]()[_0x031c('0x1a')](function(){if(_0x101ce4['query'][_0x031c('0x102')]){if(!_['includes'](_0x4a08d8,_0x101ce4['query']['channel'][_0x031c('0x103')]())){throw new Error(_0x031c('0x104'));}_0x4a08d8=[_0x101ce4[_0x031c('0x28')][_0x031c('0x102')][_0x031c('0x103')]()];}if(_0x101ce4[_0x031c('0x28')][_0x031c('0x105')]){try{var _0x5eef56=JSON[_0x031c('0x106')](_0x101ce4[_0x031c('0x28')]['range']);if(!moment(_0x5eef56[_0x031c('0x35')])[_0x031c('0x107')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x5eef56['to'])[_0x031c('0x107')]()){throw new Error(_0x031c('0x108'));}}catch(_0x1445ad){throw new Error(_0x031c('0x109'));}}if(!_0x101ce4[_0x031c('0x28')][_0x031c('0x2d')](_0x031c('0x2e'))){_0x1a1417['limit']=qs[_0x031c('0x16')](_0x101ce4[_0x031c('0x28')]['limit']||0xa);_0x1a1417[_0x031c('0x13')]=qs[_0x031c('0x13')](_0x101ce4[_0x031c('0x28')]['offset']);}var _0x1e0b0a=_0x4a08d8[_0x031c('0x6f')](function(_0x3c4e1a){if(_0x3c4e1a==='voice'){var _0x4fc1cb={'attributes':['id',_0x031c('0x10a'),_0x031c('0x27'),_0x031c('0x10b'),_0x031c('0x10c'),_0x031c('0x10d'),'starttime','endtime',_0x031c('0x10e'),_0x031c('0x10f'),_0x031c('0x110'),_0x031c('0x111'),_0x031c('0x112'),_0x031c('0x113'),_0x031c('0x114')],'where':{'ContactId':_0x101ce4[_0x031c('0xac')]['id']},'include':[{'model':db[_0x031c('0x6b')],'as':_0x031c('0x6b'),'attributes':['id','name',_0x031c('0x115'),_0x031c('0x87')]}],'order':[[_0x031c('0x110'),_0x031c('0x65')]]};if(_0x101ce4[_0x031c('0x28')]['range']){_0x4fc1cb[_0x031c('0x31')]['createdAt']={'$gte':_0x5eef56[_0x031c('0x35')],'$lte':_0x5eef56['to']};}return db[_0x031c('0x116')][_0x031c('0x117')](_0x4fc1cb)[_0x031c('0x1a')](function(_0x4260c6){_0x1ae185[_0x031c('0x15')]+=_0x4260c6[_0x031c('0x15')];return _[_0x031c('0x6f')](_0x4260c6[_0x031c('0xd8')],function(_0x2dcf80){var _0x300897=_0x2dcf80['get']({'plain':!![]});_0x300897[_0x031c('0x102')]=_0x3c4e1a;if(_0x300897[_0x031c('0x6b')]){_0x300897[_0x031c('0x6b')]={'id':_0x300897[_0x031c('0x6b')]['id'],'name':_0x300897[_0x031c('0x6b')]['name'],'fullname':_0x300897[_0x031c('0x6b')][_0x031c('0x115')],'alias':_0x300897['User'][_0x031c('0x87')]};}return _0x300897;});});}else{var _0x121a2e=_['startCase'](_0x3c4e1a)+(_0x3c4e1a===_0x031c('0x118')?_0x031c('0x119'):_0x031c('0x11a'));var _0x34d84b={'attributes':['id',_0x031c('0x11b'),_0x031c('0x11c'),_0x031c('0x110'),'note',_0x031c('0x11d'),_0x031c('0x11e'),_0x031c('0x11f'),_0x031c('0x114'),_0x121a2e+'Id'],'where':{'ContactId':_0x101ce4[_0x031c('0xac')]['id']},'include':[{'model':db[_0x121a2e],'as':_0x031c('0x11a'),'attributes':['id',_0x031c('0x1f'),_0x031c('0x120')]},{'model':db[_0x031c('0x6b')],'as':'Owner','attributes':['id',_0x031c('0x1f'),'fullname']},{'model':db['Tag'],'as':_0x031c('0x80'),'attributes':['id',_0x031c('0x1f'),_0x031c('0x34')],'through':{'attributes':[]}}],'order':[[_0x031c('0x110'),_0x031c('0x65')]]};if(_0x101ce4[_0x031c('0x28')]['range']){_0x34d84b['where'][_0x031c('0x110')]={'$gte':_0x5eef56[_0x031c('0x35')],'$lte':_0x5eef56['to']};}switch(_0x3c4e1a){case'chat':_0x34d84b['attributes']['push'](_0x031c('0x121'),_0x031c('0x122'),_0x031c('0x123'),_0x031c('0x124'),_0x031c('0x125'),'ratingMessage',_0x031c('0x126'),'ratingValue',_0x031c('0x127'));break;case _0x031c('0x128'):_0x34d84b[_0x031c('0x2b')]['push'](_0x031c('0x129'),_0x031c('0x12a'));break;case _0x031c('0xff'):_0x34d84b[_0x031c('0x2b')][_0x031c('0x51')]('externalUrl',_0x031c('0x12b'));break;}return db[_[_0x031c('0x12c')](_0x3c4e1a)+_0x031c('0x12d')][_0x031c('0x117')](_0x34d84b)['then'](function(_0x2d9c6e){_0x1ae185[_0x031c('0x15')]+=_0x2d9c6e['count'];return _[_0x031c('0x6f')](_0x2d9c6e[_0x031c('0xd8')],function(_0x1f8300){var _0x45555f=_0x1f8300[_0x031c('0x8a')]({'plain':!![]});_0x45555f[_0x031c('0x102')]=_0x3c4e1a;if(_0x45555f['Owner']){_0x45555f[_0x031c('0x12e')]={'id':_0x45555f[_0x031c('0x12e')]['id'],'name':_0x45555f[_0x031c('0x12e')][_0x031c('0x1f')],'fullname':_0x45555f[_0x031c('0x12e')][_0x031c('0x115')]};}return _0x45555f;});});}});return Promise[_0x031c('0xc0')](_0x1e0b0a);})['then'](function(_0x2feacf){return _(_0x2feacf)['flatten']()[_0x031c('0x12f')](_0x031c('0x110'))[_0x031c('0x130')]()[_0x031c('0x43')]();})[_0x031c('0x1a')](function(_0x3fc530){_0x1ae185[_0x031c('0xd8')]=_0x1a1417['limit']?_0x3fc530[_0x031c('0x131')](_0x1a1417[_0x031c('0x13')],_0x1a1417[_0x031c('0x13')]+_0x1a1417[_0x031c('0x16')]):_0x3fc530;return _0x1ae185;})[_0x031c('0x1a')](respondWithFilteredResult(_0x1d75ff,_0x1a1417))[_0x031c('0x81')](handleError(_0x1d75ff,null));};
\ No newline at end of file
+var _0xd7ef=['rawAttributes','options','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopper','CmHopperAdditionalPhone','item','PHONE','literal','CmHopperId','ItemType.OrderBy','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','ContactId','includeAll','getHopperHistories','include','CmHopperFinal','getJscriptySessions','JscriptySessionReport','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','filename','chmodSync','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','path','parse','meta','No\x20ListId\x20specified','binding','firstName','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','fork','../../components/import/cm/csvUpdates','getJourney','mail','sms','openchannel','whatsapp','-createdAt','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','destination','callerid','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','startCase','chat','Website','closed','note','disposition','secondDisposition','thirdDisposition','Account','key','Owner','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','substatus','externalUrl','Interaction','flatten','reverse','slice','moment','util','lodash','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','stack','name','send','index','describe','length','startsWith','push','CmCustomField','findOne','trimStart','cf_','all','fieldType','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filters','field','color','from','select','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','left_join','tools_tags','where','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','value','datetime','DATE','buildExpression','text','start','filter','isNil','Contact','ListId','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','isArray','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.id','Sequelize','SELECT','clone','order','DESC','isEmpty','having','t.id\x20IN\x20?','resolve','user','role','agent','some','c.ListId\x20IS\x20NULL','toString','sequelize','merge','CmContact','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','TagIds','Tags','rows','catch','destroy','params','tags','columnName','displayName','analytics','findAll','alias','custom','body','get','mergeWith','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','WhatsappInteraction','WhatsappMessage','create','join','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','findOrCreate','spread','contact','CmContactHasItem','Phones','ContactItemType','ItemType','$and','cf_%d','dialTimezone','omit','pickBy','format','table','setFields','toParam','values','phone','getTags'];(function(_0x28f61d,_0x147a60){var _0x19ac82=function(_0x748712){while(--_0x748712){_0x28f61d['push'](_0x28f61d['shift']());}};_0x19ac82(++_0x147a60);}(_0xd7ef,0x71));var _0xfd7e=function(_0x28c763,_0x1a7fe9){_0x28c763=_0x28c763-0x0;var _0x916162=_0xd7ef[_0x28c763];return _0x916162;};'use strict';var moment=require(_0xfd7e('0x0'));var BPromise=require('bluebird');var util=require(_0xfd7e('0x1'));var path=require('path');var fs=require('fs');var _=require(_0xfd7e('0x2'));var squel=require('squel');var Papa=require(_0xfd7e('0x3'));var Redis=require(_0xfd7e('0x4'));var qs=require('../../components/parsers/qs');var as=require(_0xfd7e('0x5'));var logger=require(_0xfd7e('0x6'))(_0xfd7e('0x7'));var config=require(_0xfd7e('0x8'));var shared=require(_0xfd7e('0x9'));var db=require(_0xfd7e('0xa'))['db'];config['redis']=_[_0xfd7e('0xb')](config[_0xfd7e('0xc')],{'host':_0xfd7e('0xd'),'port':0x18eb});var socket=require(_0xfd7e('0xe'))(new Redis(config[_0xfd7e('0xc')]));require(_0xfd7e('0xf'))['register'](socket);function respondWithResult(_0x4d16a4,_0x228726){_0x228726=_0x228726||0xc8;return function(_0x2f7618){if(_0x2f7618){return _0x4d16a4[_0xfd7e('0x10')](_0x228726)[_0xfd7e('0x11')](_0x2f7618);}};}function respondWithFilteredResult(_0x22afcd,_0x553ef6){return function(_0x9b160f){if(_0x9b160f){var _0x52ceb1=typeof _0x553ef6[_0xfd7e('0x12')]===_0xfd7e('0x13')&&typeof _0x553ef6[_0xfd7e('0x14')]==='undefined';var _0x8cad5b=_0x9b160f[_0xfd7e('0x15')];var _0x54f4cc=_0x52ceb1?0x0:_0x553ef6['offset'];var _0x408a92=_0x52ceb1?_0x9b160f[_0xfd7e('0x15')]:_0x553ef6['offset']+_0x553ef6[_0xfd7e('0x14')];var _0x30b4c0;if(_0x408a92>=_0x8cad5b){_0x408a92=_0x8cad5b;_0x30b4c0=0xc8;}else{_0x30b4c0=0xce;}_0x22afcd['status'](_0x30b4c0);return _0x22afcd[_0xfd7e('0x16')](_0xfd7e('0x17'),_0x54f4cc+'-'+_0x408a92+'/'+_0x8cad5b)['json'](_0x9b160f);}return null;};}function saveUpdates(_0x461267){return function(_0x34f169){if(_0x34f169){return _0x34f169[_0xfd7e('0x18')](_0x461267)[_0xfd7e('0x19')](function(_0x2b47f4){return _0x2b47f4;});}return null;};}function removeEntity(_0x2a1a5c){return function(_0x100fc0){if(_0x100fc0){return _0x100fc0['destroy']()[_0xfd7e('0x19')](function(){_0x2a1a5c[_0xfd7e('0x10')](0xcc)[_0xfd7e('0x1a')]();});}};}function handleEntityNotFound(_0xb27756){return function(_0x559351){if(!_0x559351){_0xb27756[_0xfd7e('0x1b')](0x194);}return _0x559351;};}function handleError(_0x57e0de,_0x5651fd){_0x5651fd=_0x5651fd||0x1f4;return function(_0x7b35e3){logger['error'](_0x7b35e3[_0xfd7e('0x1c')]);if(_0x7b35e3[_0xfd7e('0x1d')]){delete _0x7b35e3[_0xfd7e('0x1d')];}_0x57e0de[_0xfd7e('0x10')](_0x5651fd)[_0xfd7e('0x1e')](_0x7b35e3);};}exports[_0xfd7e('0x1f')]=function(_0x2cd0a5,_0x5011fd){var _0x313154={},_0x4a00a2={},_0x1ea645={'count':0x0,'rows':[]};return db['CmContact'][_0xfd7e('0x20')]()[_0xfd7e('0x19')](function(_0x240f30){var _0x39e3ec=[];for(var _0x55ff73=0x0;_0x55ff73<Object['keys'](_0x240f30)[_0xfd7e('0x21')];_0x55ff73++){var _0x18af5e=Object['keys'](_0x240f30)[_0x55ff73];if(_[_0xfd7e('0x22')](_0x18af5e,'cf_')){_0x39e3ec[_0xfd7e('0x23')](db[_0xfd7e('0x24')][_0xfd7e('0x25')]({'where':{'id':_[_0xfd7e('0x26')](_0x18af5e,_0xfd7e('0x27'))},'raw':!![]}));}}return BPromise[_0xfd7e('0x28')](_0x39e3ec)['then'](function(_0x17252f){for(var _0x2d1c32=0x0;_0x2d1c32<_0x17252f[_0xfd7e('0x21')];_0x2d1c32++){if(_0x17252f[_0x2d1c32]){var _0x1a5d5a=_0xfd7e('0x27')+_0x17252f[_0x2d1c32]['id'];var _0x5c1117=_0x240f30[_0x1a5d5a];_0x5c1117[_0xfd7e('0x29')]=_0x17252f[_0x2d1c32][_0xfd7e('0x2a')];}}return _0x240f30;});})[_0xfd7e('0x19')](function(_0x2ec5ad){_0x4a00a2[_0xfd7e('0x2b')]=_['keys'](_0x2ec5ad);_0x4a00a2[_0xfd7e('0x2c')]=_[_0xfd7e('0x2d')](_0x2cd0a5['query']);_0x4a00a2['filters']=_[_0xfd7e('0x2e')](_0x4a00a2[_0xfd7e('0x2b')],_0x4a00a2[_0xfd7e('0x2c')]);_0x313154[_0xfd7e('0x2f')]=_[_0xfd7e('0x2e')](_0x4a00a2[_0xfd7e('0x2b')],qs['fields'](_0x2cd0a5[_0xfd7e('0x2c')][_0xfd7e('0x30')]));_0x313154[_0xfd7e('0x2f')]=_0x313154[_0xfd7e('0x2f')]['length']?_0x313154[_0xfd7e('0x2f')]:_0x4a00a2[_0xfd7e('0x2b')];if(!_0x2cd0a5[_0xfd7e('0x2c')][_0xfd7e('0x31')](_0xfd7e('0x32'))){_0x313154[_0xfd7e('0x14')]=qs[_0xfd7e('0x14')](_0x2cd0a5[_0xfd7e('0x2c')][_0xfd7e('0x14')]);_0x313154[_0xfd7e('0x12')]=qs[_0xfd7e('0x12')](_0x2cd0a5[_0xfd7e('0x2c')]['offset']);}_0x313154['order']=qs['sort'](_0x2cd0a5[_0xfd7e('0x2c')][_0xfd7e('0x33')]);_0x313154['where']=qs['filters'](_[_0xfd7e('0x34')](_0x2cd0a5[_0xfd7e('0x2c')],_0x4a00a2[_0xfd7e('0x35')]),_0x2ec5ad);var _0x4c1c20=[];var _0x4986dd=squel['select']()[_0xfd7e('0x36')]('id')[_0xfd7e('0x36')](_0xfd7e('0x1d'))[_0xfd7e('0x36')](_0xfd7e('0x37'))[_0xfd7e('0x38')]('tools_tags');var _0xe3febc=squel[_0xfd7e('0x39')]()[_0xfd7e('0x38')](_0xfd7e('0x3a'),'c')['left_join'](_0xfd7e('0x3b'),'uc',_0xfd7e('0x3c'))['left_join'](_0xfd7e('0x3d'),'ct',_0xfd7e('0x3e'))[_0xfd7e('0x3f')](_0xfd7e('0x40'),'t','t.id\x20=\x20ct.TagId')[_0xfd7e('0x41')](_0xfd7e('0x42'));var _0x475bb4=squel[_0xfd7e('0x43')]();var _0x304aa6=[];var _0x515844=squel[_0xfd7e('0x43')]();var _0x206b5b;if(_0x2cd0a5[_0xfd7e('0x2c')][_0xfd7e('0x44')]){_0x206b5b=as[_0xfd7e('0x45')](_0x2cd0a5['query'][_0xfd7e('0x44')]);var _0x35a7d4=_0x206b5b[_0xfd7e('0x46')];for(var _0x412bba=0x0;_0x412bba<_0x206b5b[_0xfd7e('0x47')][_0xfd7e('0x21')];_0x412bba++){var _0x66bc60=_0x206b5b['conditions'][_0x412bba];var _0x50bb07='c';var _0x568afe=_(_0x2ec5ad)[_0xfd7e('0x2d')]()[_0xfd7e('0x48')](function(_0x508fa5){return _0x508fa5===_0x66bc60[_0xfd7e('0x36')];});if(_0x568afe)_0x568afe=_0x2ec5ad[_0x66bc60[_0xfd7e('0x36')]];if(!_0x568afe){if(_0x66bc60['field']===_0xfd7e('0x49')){var _0xb88d05=_0x66bc60['value'][_0xfd7e('0x4a')](',')[_0xfd7e('0x4b')](function(_0x481fbb){return Number(_0x481fbb);});_0xb88d05[_0xfd7e('0x4c')](function(_0x5e0b1d){_0x515844['or'](_0xfd7e('0x4d'),'%,'+_0x5e0b1d+',%');});_0x304aa6=_[_0xfd7e('0x4e')](_0x304aa6,_0xb88d05);}else if(_0x66bc60[_0xfd7e('0x36')]===_0xfd7e('0x4f')){_0x475bb4[_0xfd7e('0x50')]('uc.UserId\x20=\x20?',_0x66bc60[_0xfd7e('0x51')]);}}else{if(_0x66bc60['field']==='dateOfBirth'||_0x568afe[_0xfd7e('0x29')]===_0xfd7e('0x52'))_0x66bc60['castTo']=_0xfd7e('0x53');var _0x5ee335=as[_0xfd7e('0x54')](_0x50bb07,_0x568afe[_0xfd7e('0x2a')],_0x66bc60);_0x475bb4[_0x35a7d4](_0x5ee335[_0xfd7e('0x55')],_0x5ee335[_0xfd7e('0x51')][_0xfd7e('0x56')],_0x5ee335[_0xfd7e('0x51')][_0xfd7e('0x1a')]);}}}else{var _0x2a5813=_(Object[_0xfd7e('0x2d')](_0x2cd0a5[_0xfd7e('0x2c')]))[_0xfd7e('0x4b')](function(_0x3037ba){return _0x2ec5ad[_0xfd7e('0x31')](_0x3037ba)?_0x3037ba:undefined;})[_0xfd7e('0x57')](function(_0x5709a2){return!_[_0xfd7e('0x58')](_0x5709a2);})[_0xfd7e('0x51')]();if(_0x2cd0a5[_0xfd7e('0x2c')][_0xfd7e('0x59')])_0x2a5813[_0xfd7e('0x23')](_0xfd7e('0x59'));if(!_['isEmpty'](_0x2a5813)){_0x2a5813[_0xfd7e('0x4c')](function(_0x2a548c){if(_0x2a548c===_0xfd7e('0x5a')){_0xe3febc[_0xfd7e('0x41')](_0xfd7e('0x5b'),[]['concat'](_0x2cd0a5[_0xfd7e('0x2c')][_0x2a548c]));}else if(_0x2a548c===_0xfd7e('0x59')){var _0x1aaf70='%'+_0x2cd0a5['query'][_0x2a548c]+'%';_0xe3febc[_0xfd7e('0x41')](_0xfd7e('0x5c'),_0x1aaf70);}else{_0xe3febc['where']('c.'+_0x2a548c+'\x20=\x20?',_0x2cd0a5[_0xfd7e('0x2c')][_0x2a548c]);}});}if(_0x2cd0a5[_0xfd7e('0x2c')]['tag']){_0x304aa6=_[_0xfd7e('0x5d')](_0x2cd0a5[_0xfd7e('0x2c')][_0xfd7e('0x5e')])?_0x2cd0a5[_0xfd7e('0x2c')][_0xfd7e('0x5e')]:new Array(_0x2cd0a5[_0xfd7e('0x2c')][_0xfd7e('0x5e')]);_0x304aa6[_0xfd7e('0x4c')](function(_0x1e1933){_0x515844['or'](_0xfd7e('0x4d'),'%,'+_0x1e1933+',%');});}if(_0x2cd0a5['query'][_0xfd7e('0x57')]){var _0x22cf79=_0x2cd0a5[_0xfd7e('0x2c')][_0xfd7e('0x57')][_0xfd7e('0x5f')]('\x5c','\x5c\x5c')[_0xfd7e('0x5f')](/'/g,'\x27\x27');if(_0x22cf79[_0xfd7e('0x4a')]('\x20')['length']>0x1){_0x475bb4['or'](_0xfd7e('0x60'),qs[_0xfd7e('0x61')](_0x22cf79),null);}else{if(qs[_0xfd7e('0x62')](_0x22cf79)){_0x475bb4['or'](_0xfd7e('0x63'),_0x22cf79+'%');_0x475bb4['or'](_0xfd7e('0x64'),_0x22cf79+'%');_0x475bb4['or'](_0xfd7e('0x65'),_0x22cf79+'%');_0x475bb4['or'](_0xfd7e('0x66'),_0x22cf79+'%');}else if(qs[_0xfd7e('0x67')](_0x22cf79)){_0x475bb4['or'](_0xfd7e('0x68'),_0x22cf79+'%');}else{_0x475bb4['or']('c.firstName\x20LIKE\x20?','%'+_0x22cf79+'%');_0x475bb4['or'](_0xfd7e('0x69'),'%'+_0x22cf79+'%');_0x475bb4['or'](_0xfd7e('0x68'),'%'+_0x22cf79+'%');}}}}_0xe3febc[_0xfd7e('0x41')](_0x475bb4);_0xe3febc['group'](_0xfd7e('0x6a'));var _0x3cd379={'type':db[_0xfd7e('0x6b')]['QueryTypes'][_0xfd7e('0x6c')],'raw':!![]};var _0x52cb66=_0xe3febc[_0xfd7e('0x6d')]()[_0xfd7e('0x36')](_0xfd7e('0x6a'));if(_0x313154[_0xfd7e('0x6e')]){_0x313154['order']['forEach'](function(_0x3d6fa3){_0xe3febc[_0xfd7e('0x6e')]('c.'+_0x3d6fa3[0x0],_0x3d6fa3[0x1]===_0xfd7e('0x6f')?![]:!![]);});}if(!_[_0xfd7e('0x70')](_0x304aa6)){_0xe3febc[_0xfd7e('0x71')](_0x515844);_0x52cb66[_0xfd7e('0x41')](_0xfd7e('0x72'),_0x304aa6);}BPromise[_0xfd7e('0x73')]()['then'](function(){if(!_0x206b5b)return;if(_0x2cd0a5[_0xfd7e('0x74')][_0xfd7e('0x75')]!==_0xfd7e('0x76'))return;if(!_[_0xfd7e('0x77')](_0x206b5b['conditions'],[_0xfd7e('0x36'),_0xfd7e('0x4f')])){return _0x2cd0a5[_0xfd7e('0x74')]['getLists']({'attributes':['id'],'raw':!![]})[_0xfd7e('0x19')](function(_0x1e5290){if(_[_0xfd7e('0x70')](_0x1e5290)){_0x52cb66[_0xfd7e('0x41')](_0xfd7e('0x78'));_0xe3febc[_0xfd7e('0x41')]('c.ListId\x20IS\x20NULL');}else{_0x52cb66[_0xfd7e('0x41')](_0xfd7e('0x5b'),_[_0xfd7e('0x4b')](_0x1e5290,'id'));_0xe3febc[_0xfd7e('0x41')](_0xfd7e('0x5b'),_[_0xfd7e('0x4b')](_0x1e5290,'id'));}});}})[_0xfd7e('0x19')](function(){if(_0x2cd0a5[_0xfd7e('0x74')][_0xfd7e('0x75')]===_0xfd7e('0x76')&&!_0x206b5b&&!_0x2cd0a5[_0xfd7e('0x2c')]['ListId'])return[];return db['sequelize'][_0xfd7e('0x2c')](_0x52cb66[_0xfd7e('0x79')](),_0x3cd379);})['then'](function(_0x10a8c7){_0x1ea645[_0xfd7e('0x15')]=_0x10a8c7[_0xfd7e('0x21')];if(_0x1ea645[_0xfd7e('0x15')]===0x0)return[];return db[_0xfd7e('0x7a')]['query'](_0x4986dd[_0xfd7e('0x79')](),_0x3cd379)['then'](function(_0xdc3d31){_0x4c1c20=_['keyBy'](_0xdc3d31,'id');_0x3cd379=_[_0xfd7e('0x7b')](_0x3cd379,{'model':db[_0xfd7e('0x7c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2cd0a5[_0xfd7e('0x2c')][_0xfd7e('0x30')]){_0x313154[_0xfd7e('0x2f')][_0xfd7e('0x4c')](function(_0x445eb9){_0xe3febc[_0xfd7e('0x36')]('c.'+_0x445eb9);});}else{_0xe3febc[_0xfd7e('0x36')](_0xfd7e('0x6a'));_0xe3febc[_0xfd7e('0x36')](_0xfd7e('0x7d'));_0xe3febc['field'](_0xfd7e('0x7e'));_0xe3febc[_0xfd7e('0x36')](_0xfd7e('0x7f'));_0xe3febc[_0xfd7e('0x36')](_0xfd7e('0x80'));_0xe3febc[_0xfd7e('0x36')](_0xfd7e('0x81'));_0xe3febc[_0xfd7e('0x36')](_0xfd7e('0x82'));_0xe3febc[_0xfd7e('0x36')](_0xfd7e('0x83'));_0xe3febc[_0xfd7e('0x36')](_0xfd7e('0x84'));_0xe3febc[_0xfd7e('0x36')](_0xfd7e('0x85'));_0xe3febc[_0xfd7e('0x36')](_0xfd7e('0x86'));_0xe3febc[_0xfd7e('0x36')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x313154[_0xfd7e('0x14')])_0xe3febc['limit'](_0x313154[_0xfd7e('0x14')]);if(_0x313154['offset'])_0xe3febc[_0xfd7e('0x12')](_0x313154[_0xfd7e('0x12')]);return db['sequelize'][_0xfd7e('0x2c')](_0xe3febc[_0xfd7e('0x79')](),_0x3cd379);});})[_0xfd7e('0x19')](function(_0x47fbdc){_0x47fbdc[_0xfd7e('0x4c')](function(_0x1f0e2c){if(_0x1f0e2c[_0xfd7e('0x87')]){_0x1f0e2c[_0xfd7e('0x88')]=[];_0x1f0e2c[_0xfd7e('0x87')]['split'](',')[_0xfd7e('0x4c')](function(_0x3e2995){_0x1f0e2c[_0xfd7e('0x88')][_0xfd7e('0x23')](_0x4c1c20[_0x3e2995]);});}delete _0x1f0e2c[_0xfd7e('0x87')];});_0x1ea645[_0xfd7e('0x89')]=_0x47fbdc;return _0x1ea645;})[_0xfd7e('0x19')](respondWithFilteredResult(_0x5011fd,_0x313154));})[_0xfd7e('0x8a')](handleError(_0x5011fd,null));};exports[_0xfd7e('0x8b')]=function(_0x71e823,_0x5810bb){return db[_0xfd7e('0x7c')][_0xfd7e('0x48')]({'where':{'id':_0x71e823[_0xfd7e('0x8c')]['id']}})[_0xfd7e('0x19')](handleEntityNotFound(_0x5810bb,null))[_0xfd7e('0x19')](removeEntity(_0x5810bb,null))[_0xfd7e('0x8a')](handleError(_0x5810bb,null));};exports[_0xfd7e('0x20')]=function(_0xa56e24,_0xdcf40c){return db[_0xfd7e('0x7c')][_0xfd7e('0x20')]()['then'](function(_0x5c4392){delete _0x5c4392[_0xfd7e('0x8d')];for(var _0x378298=0x0;_0x378298<Object['keys'](_0x5c4392)[_0xfd7e('0x21')];_0x378298++){var _0x99efe3=Object[_0xfd7e('0x2d')](_0x5c4392)[_0x378298];if(!_[_0xfd7e('0x22')](_0x99efe3,_0xfd7e('0x27'))){_0x5c4392[_0x99efe3][_0xfd7e('0x8e')]=_0x99efe3;_0x5c4392[_0x99efe3][_0xfd7e('0x8f')]=_0x99efe3;}}return _0x5c4392;})[_0xfd7e('0x19')](function(_0x4af1e1){var _0x56ede9={'where':Boolean(_0xa56e24[_0xfd7e('0x2c')][_0xfd7e('0x90')])===!![]?undefined:{'$or':[{'ListId':_0xa56e24[_0xfd7e('0x2c')]['id']},{'ListId':null}]},'raw':!![]};return db[_0xfd7e('0x24')][_0xfd7e('0x91')](_0x56ede9)['then'](function(_0x3d9faa){for(var _0x449d5b=0x0;_0x449d5b<_0x3d9faa[_0xfd7e('0x21')];_0x449d5b++){var _0x4ede00='cf_'+_0x3d9faa[_0x449d5b]['id'];_0x4af1e1[_0x4ede00][_0xfd7e('0x8e')]=_0x4ede00;_0x4af1e1[_0x4ede00][_0xfd7e('0x8f')]=_0x3d9faa[_0x449d5b][_0xfd7e('0x92')];_0x4af1e1[_0x4ede00][_0xfd7e('0x93')]={'type':_0x3d9faa[_0x449d5b][_0xfd7e('0x2a')],'values':_0x3d9faa[_0x449d5b]['values']};}Object[_0xfd7e('0x2d')](_0x4af1e1)[_0xfd7e('0x4c')](function(_0x1344c6){if(!_0x4af1e1[_0x1344c6][_0xfd7e('0x31')](_0xfd7e('0x8e'))){delete _0x4af1e1[_0x1344c6];}});return _0x4af1e1;});})[_0xfd7e('0x19')](respondWithResult(_0xdcf40c,null))[_0xfd7e('0x8a')](handleError(_0xdcf40c,null));};exports[_0xfd7e('0x7b')]=function(_0x23b0cd,_0x155533){var _0x4a95c9;var _0x5a3a6c;var _0x3c7c77;if(_0x23b0cd['body']['id']){delete _0x23b0cd[_0xfd7e('0x94')]['id'];}return db[_0xfd7e('0x7c')]['findAll']({'where':{'id':[_0x23b0cd['body']['to'],_0x23b0cd[_0xfd7e('0x94')][_0xfd7e('0x38')]]}})['then'](function(_0x25d939){if(_0x25d939){if(_0x25d939[_0xfd7e('0x21')]!==0x2){return null;}_0x25d939[0x0]=_0x25d939[0x0][_0xfd7e('0x95')]({'plain':!![]});_0x25d939[0x1]=_0x25d939[0x1]['get']({'plain':!![]});delete _0x25d939[0x0]['id'];delete _0x25d939[0x1]['id'];return _[_0xfd7e('0x96')](_0x25d939[0x0],_0x25d939[0x1],function(_0x10cbef,_0x565135){if(Array['isArray'](_0x565135)&&!_0x565135[_0xfd7e('0x21')]){return _0x10cbef;}else if(!_0x565135){return _0x10cbef;}});}})[_0xfd7e('0x19')](handleEntityNotFound(_0x155533,null))[_0xfd7e('0x19')](function(_0x5862ee){if(_0x5862ee){if(_0x5862ee[_0xfd7e('0x8d')]&&_['isArray'](_0x5862ee[_0xfd7e('0x8d')])){_0x5862ee[_0xfd7e('0x8d')]=_0x5862ee[_0xfd7e('0x8d')]['join']();}logger[_0xfd7e('0x97')](_0xfd7e('0x98'),_0x23b0cd[_0xfd7e('0x94')]['to'],_0x23b0cd[_0xfd7e('0x94')][_0xfd7e('0x38')]);return db['CmHopper'][_0xfd7e('0x8b')]({'where':{'ContactId':[_0x23b0cd[_0xfd7e('0x94')]['to'],_0x23b0cd[_0xfd7e('0x94')][_0xfd7e('0x38')]]}})['then'](function(_0xc12e43){logger[_0xfd7e('0x97')](_0xfd7e('0x99'),_0xc12e43);return db['CmHopperBlack']['destroy']({'where':{'ContactId':[_0x23b0cd['body']['to'],_0x23b0cd['body']['from']]}})['then'](function(_0x212a0a){logger[_0xfd7e('0x97')]('[CmContact][merge][destroy][CmHopperBlack],\x20%s',_0x212a0a);return db[_0xfd7e('0x7c')]['create'](_0x5862ee);});});}})[_0xfd7e('0x19')](function(_0x48e5eb){if(_0x48e5eb){_0x4a95c9=_0x48e5eb;_0x5a3a6c={'ContactId':_0x4a95c9['id']};_0x3c7c77={'where':{'ContactId':[_0x23b0cd[_0xfd7e('0x94')]['to'],_0x23b0cd['body']['from']]}};return db['ChatInteraction'][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})['then'](function(){if(_0x4a95c9){return db['ChatMessage'][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db[_0xfd7e('0x9a')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db[_0xfd7e('0x9b')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})['then'](function(){if(_0x4a95c9){return db[_0xfd7e('0x9c')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})['then'](function(){if(_0x4a95c9){return db[_0xfd7e('0x9b')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})['then'](function(){if(_0x4a95c9){return db[_0xfd7e('0x9c')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db[_0xfd7e('0x9d')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db[_0xfd7e('0x9e')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db[_0xfd7e('0x9f')]['update'](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db[_0xfd7e('0xa0')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db[_0xfd7e('0xa1')]['update'](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db[_0xfd7e('0xa2')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})['then'](function(){if(_0x4a95c9){return db['CmContactHasItem'][_0xfd7e('0x18')]({'CmContactId':_0x4a95c9['id']},{'where':{'CmContactId':[_0x23b0cd[_0xfd7e('0x94')]['to'],_0x23b0cd[_0xfd7e('0x94')][_0xfd7e('0x38')]]}});}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db['CmHopperFinal']['update'](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db[_0xfd7e('0xa3')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})['then'](function(){if(_0x4a95c9){return db[_0xfd7e('0xa4')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db[_0xfd7e('0xa5')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db[_0xfd7e('0xa6')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})['then'](function(){if(_0x4a95c9){return db[_0xfd7e('0xa7')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})['then'](function(){if(_0x4a95c9){return db[_0xfd7e('0xa8')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db[_0xfd7e('0xa9')][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db['SmsQueueReport'][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db['JscriptySessionReport'][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db[_0xfd7e('0xaa')]['update'](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db[_0xfd7e('0xab')]['update'](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db['WhatsappQueueReport'][_0xfd7e('0x18')](_0x5a3a6c,_0x3c7c77);}})[_0xfd7e('0x19')](function(){if(_0x4a95c9){return db['CmContact'][_0xfd7e('0x8b')]({'where':{'id':[_0x23b0cd[_0xfd7e('0x94')]['to'],_0x23b0cd[_0xfd7e('0x94')][_0xfd7e('0x38')]]}});}})['then'](function(){if(_0x4a95c9){return _0x4a95c9;}})['then'](respondWithResult(_0x155533,null))[_0xfd7e('0x8a')](handleError(_0x155533,null));};exports[_0xfd7e('0xac')]=function(_0x5e801d,_0x352bdb){return db[_0xfd7e('0x7c')]['describe']()['then'](function(_0x2ff406){if(_0x5e801d['body']['tags']&&_['isArray'](_0x5e801d[_0xfd7e('0x94')][_0xfd7e('0x8d')])){if(_0x5e801d['body'][_0xfd7e('0x8d')][_0xfd7e('0x21')]){_0x5e801d[_0xfd7e('0x94')][_0xfd7e('0x8d')]=_0x5e801d['body']['tags'][_0xfd7e('0xad')](';')+';';}else{_0x5e801d[_0xfd7e('0x94')][_0xfd7e('0x8d')]=null;}}else{_0x5e801d[_0xfd7e('0x94')]['tags']=null;}if(!_[_0xfd7e('0x58')](_0x5e801d[_0xfd7e('0x94')]['dialTimezone'])){var _0x5dbc12=_0x5e801d[_0xfd7e('0x94')]['dialTimezone'];if(!_[_0xfd7e('0x58')](shared[_0xfd7e('0xae')][_0x5dbc12]))_0x5e801d[_0xfd7e('0x94')]['utcOffset']=shared[_0xfd7e('0xae')][_0x5dbc12][_0xfd7e('0xaf')];}return db[_0xfd7e('0x7c')][_0xfd7e('0xac')](_0x5e801d[_0xfd7e('0x94')],{'fields':_[_0xfd7e('0x2d')](_0x2ff406),'raw':!![]});})[_0xfd7e('0x19')](function(_0x5171c6){if(_0x5e801d[_0xfd7e('0x94')][_0xfd7e('0xb0')]){return insertAdditionalPhones(_0x5171c6,_0x5e801d['body'][_0xfd7e('0xb0')]);}else{return _0x5171c6;}})[_0xfd7e('0x19')](respondWithResult(_0x352bdb,0xc9))[_0xfd7e('0x8a')](handleError(_0x352bdb,null));};exports[_0xfd7e('0xb1')]=function(_0x134c03,_0x5906dc){var _0x27a8d0=0x0;var _0x1ed6fa=0x0;var _0x4dd22e=0x0;var _0x4e7102=[];return db[_0xfd7e('0x7c')][_0xfd7e('0x20')]()[_0xfd7e('0x19')](function(_0x150891){return BPromise[_0xfd7e('0xb2')](_0x134c03[_0xfd7e('0x94')],function(_0x3eced6){var _0x36e25f={'where':{'$or':[]},'defaults':_0x3eced6,'fields':_['keys'](_0x150891),'raw':!![]};if(_0x3eced6['duplicates']){for(var _0x13672b=0x0;_0x13672b<_0x3eced6[_0xfd7e('0xb3')][_0xfd7e('0x21')];_0x13672b++){var _0x4dfb78={};_0x4dfb78[_0x3eced6['duplicates'][_0x13672b]]=_0x3eced6[_0x3eced6[_0xfd7e('0xb3')][_0x13672b]];_0x36e25f[_0xfd7e('0x41')]['$or'][_0xfd7e('0x23')](_0x4dfb78);}_0x36e25f[_0xfd7e('0x41')][_0xfd7e('0x5a')]=_0x3eced6[_0xfd7e('0x5a')];}return db[_0xfd7e('0x7c')][_0xfd7e('0xb4')](_0x36e25f)[_0xfd7e('0xb5')](function(_0x135e07,_0x477819){if(_0x477819){if(_0x3eced6['hasOwnProperty'](_0xfd7e('0xb0'))){_0x4e7102['push']({'contact':_0x135e07,'additionalPhones':_0x3eced6[_0xfd7e('0xb0')]});}_0x27a8d0++;}else{_0x4dd22e++;}})[_0xfd7e('0x8a')](function(){_0x1ed6fa++;});});})[_0xfd7e('0x19')](function(_0x4a9221){if(_0x4a9221){if(_0x4e7102[_0xfd7e('0x21')]>0x0){return new Promise(function(_0x56850a,_0x5c3ffd){var _0x53695a=[];for(var _0x340557=0x0;_0x340557<_0x4e7102[_0xfd7e('0x21')];_0x340557++){_0x53695a[_0xfd7e('0x23')](insertAdditionalPhones(_0x4e7102[_0x340557][_0xfd7e('0xb6')],_0x4e7102[_0x340557]['additionalPhones']));}Promise['all'](_0x53695a)[_0xfd7e('0x19')](function(){_0x56850a(0x1);});})[_0xfd7e('0x19')](function(){return{'success':_0x27a8d0,'failure':_0x1ed6fa,'duplicates':_0x4dd22e};});}else{return{'success':_0x27a8d0,'failure':_0x1ed6fa,'duplicates':_0x4dd22e};}}})[_0xfd7e('0x19')](respondWithResult(_0x5906dc,0xc9))[_0xfd7e('0x8a')](handleError(_0x5906dc,null));};exports['show']=function(_0x110fd6,_0x5a1775){var _0x1aea6d;return db[_0xfd7e('0x7c')][_0xfd7e('0x20')]()[_0xfd7e('0x19')](function(_0x2e9d91){return db[_0xfd7e('0x7c')][_0xfd7e('0x48')]({'where':{'id':_0x110fd6[_0xfd7e('0x8c')]['id']},'include':[{'model':db[_0xfd7e('0x49')],'as':_0xfd7e('0x88'),'attributes':['id',_0xfd7e('0x1d'),_0xfd7e('0x37')],'required':_0x110fd6[_0xfd7e('0x2c')][_0xfd7e('0x5e')]?!![]:![]},{'model':db[_0xfd7e('0xb7')],'as':_0xfd7e('0xb8'),'where':{'CmContactId':_0x110fd6['params']['id']},'required':![],'include':[{'model':db[_0xfd7e('0xb9')],'as':_0xfd7e('0xba')}]}],'order':[db['sequelize']['literal']('Phones.OrderBy')],'attributes':_[_0xfd7e('0x2d')](_0x2e9d91)});})[_0xfd7e('0x19')](function(_0x36f1a0){if(!_[_0xfd7e('0x58')](_0x36f1a0)){_0x1aea6d=_0x36f1a0[_0xfd7e('0x95')]({'plain':!![]});var _0x5b073a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x36f1a0&&_0x36f1a0['ListId']){if(_0x36f1a0[_0xfd7e('0x5a')]){_0x5b073a[_0xfd7e('0x41')][_0xfd7e('0xbb')][_0xfd7e('0x23')]({'ListId':{'$ne':_0x36f1a0['ListId']}});}}return db[_0xfd7e('0x24')][_0xfd7e('0x91')](_0x5b073a);}})[_0xfd7e('0x19')](function(_0x13cc1f){if(!_[_0xfd7e('0x58')](_0x13cc1f)){return _['omit'](_0x1aea6d,_[_0xfd7e('0x4b')](_0x13cc1f,function(_0xdfb9ca){return util['format'](_0xfd7e('0xbc'),_0xdfb9ca['id']);}));}})[_0xfd7e('0x19')](handleEntityNotFound(_0x5a1775,null))[_0xfd7e('0x19')](respondWithResult(_0x5a1775,null))['catch'](handleError(_0x5a1775,null));};exports[_0xfd7e('0x18')]=function(_0x3804af,_0x74da6f){var _0x58c217;if(_0x3804af[_0xfd7e('0x94')]['id']){delete _0x3804af[_0xfd7e('0x94')]['id'];}if(!_['isNil'](_0x3804af[_0xfd7e('0x94')][_0xfd7e('0xbd')])){var _0x37e8dd=_0x3804af['body']['dialTimezone'];if(!_[_0xfd7e('0x58')](shared[_0xfd7e('0xae')][_0x37e8dd]))_0x3804af['body'][_0xfd7e('0xaf')]=shared[_0xfd7e('0xae')][_0x37e8dd]['utcOffset'];}return db[_0xfd7e('0x7c')][_0xfd7e('0x48')]({'where':{'id':_0x3804af[_0xfd7e('0x8c')]['id']}})['then'](handleEntityNotFound(_0x74da6f,null))['then'](saveUpdates(_0x3804af[_0xfd7e('0x94')],null))[_0xfd7e('0x19')](function(_0x571d4d){_0x58c217=_0x571d4d;var _0x1f3c75={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x571d4d&&_0x571d4d[_0xfd7e('0x5a')]){if(_0x571d4d[_0xfd7e('0x5a')]){_0x1f3c75[_0xfd7e('0x41')][_0xfd7e('0xbb')][_0xfd7e('0x23')]({'ListId':{'$ne':_0x571d4d[_0xfd7e('0x5a')]}});}}return db[_0xfd7e('0x24')][_0xfd7e('0x91')](_0x1f3c75);})['then'](function(_0x565901){if(_0x565901){return _[_0xfd7e('0xbe')](_[_0xfd7e('0xbf')](_0x3804af['body'],function(_0x4c9d8f,_0xe361fe){return _[_0xfd7e('0x22')](_0xe361fe,_0xfd7e('0x27'));}),_['map'](_0x565901,function(_0x3034b4){return util[_0xfd7e('0xc0')]('cf_%d',_0x3034b4['id']);}));}})[_0xfd7e('0x19')](function(_0x2cbc91){if(_0x2cbc91&&!_['isEmpty'](_0x2cbc91)){var _0x4a347e=squel['update']()[_0xfd7e('0xc1')](_0xfd7e('0x3a'))[_0xfd7e('0xc2')](_0x2cbc91)[_0xfd7e('0x41')]('id\x20=\x20?',_0x3804af['params']['id'])[_0xfd7e('0xc3')]();return db[_0xfd7e('0x7a')]['query'](_0x4a347e[_0xfd7e('0x55')],{'replacements':_0x4a347e[_0xfd7e('0xc4')]});}})[_0xfd7e('0x19')](function(){if(_0x3804af[_0xfd7e('0x94')][_0xfd7e('0xc5')]&&_0x58c217){return db['CmHopper'][_0xfd7e('0x18')]({'phone':_0x3804af[_0xfd7e('0x94')][_0xfd7e('0xc5')],'OrderBy':0x0},{'where':{'ContactId':_0x58c217['id']}});}})[_0xfd7e('0x19')](function(){return _0x58c217;})[_0xfd7e('0x19')](respondWithResult(_0x74da6f,null))[_0xfd7e('0x8a')](handleError(_0x74da6f,null));};exports[_0xfd7e('0xc6')]=function(_0x37cfb0,_0x5805c1){var _0x59338b={};var _0x227c33={};var _0x426b19;var _0x5dd496;return db[_0xfd7e('0x7c')][_0xfd7e('0x25')]({'where':{'id':_0x37cfb0[_0xfd7e('0x8c')]['id']}})['then'](handleEntityNotFound(_0x5805c1,null))[_0xfd7e('0x19')](function(_0x5d5ac1){if(_0x5d5ac1){_0x426b19=_0x5d5ac1;_0x227c33['model']=_[_0xfd7e('0x2d')](db[_0xfd7e('0x49')][_0xfd7e('0xc7')]);_0x227c33[_0xfd7e('0x2c')]=_[_0xfd7e('0x2d')](_0x37cfb0[_0xfd7e('0x2c')]);_0x227c33[_0xfd7e('0x35')]=_[_0xfd7e('0x2e')](_0x227c33[_0xfd7e('0x2b')],_0x227c33[_0xfd7e('0x2c')]);_0x59338b[_0xfd7e('0x2f')]=_['intersection'](_0x227c33[_0xfd7e('0x2b')],qs[_0xfd7e('0x30')](_0x37cfb0[_0xfd7e('0x2c')][_0xfd7e('0x30')]));_0x59338b[_0xfd7e('0x2f')]=_0x59338b[_0xfd7e('0x2f')][_0xfd7e('0x21')]?_0x59338b[_0xfd7e('0x2f')]:_0x227c33[_0xfd7e('0x2b')];_0x59338b[_0xfd7e('0x6e')]=qs['sort'](_0x37cfb0['query'][_0xfd7e('0x33')]);_0x59338b[_0xfd7e('0x41')]=qs[_0xfd7e('0x35')](_[_0xfd7e('0x34')](_0x37cfb0[_0xfd7e('0x2c')],_0x227c33[_0xfd7e('0x35')]));if(_0x37cfb0[_0xfd7e('0x2c')][_0xfd7e('0x57')]){_0x59338b[_0xfd7e('0x41')]=_['merge'](_0x59338b[_0xfd7e('0x41')],{'$or':_['map'](_0x59338b[_0xfd7e('0x2f')],function(_0x376f93){var _0x852dd5={};_0x852dd5[_0x376f93]={'$like':'%'+_0x37cfb0['query'][_0xfd7e('0x57')]+'%'};return _0x852dd5;})});}_0x59338b=_['merge']({},_0x59338b,_0x37cfb0[_0xfd7e('0xc8')]);return _0x426b19[_0xfd7e('0xc6')](_0x59338b);}})['then'](function(_0x5140a0){if(_0x5140a0){_0x5dd496=_0x5140a0[_0xfd7e('0x21')];if(!_0x37cfb0['query'][_0xfd7e('0x31')](_0xfd7e('0x32'))){_0x59338b[_0xfd7e('0x14')]=qs[_0xfd7e('0x14')](_0x37cfb0['query'][_0xfd7e('0x14')]);_0x59338b[_0xfd7e('0x12')]=qs[_0xfd7e('0x12')](_0x37cfb0['query'][_0xfd7e('0x12')]);}return _0x426b19[_0xfd7e('0xc6')](_0x59338b);}})[_0xfd7e('0x19')](function(_0xcbd7e0){if(_0xcbd7e0){return _0xcbd7e0?{'count':_0x5dd496,'rows':_0xcbd7e0}:null;}})[_0xfd7e('0x19')](respondWithResult(_0x5805c1,null))[_0xfd7e('0x8a')](handleError(_0x5805c1,null));};exports['setTags']=function(_0x1563a8,_0x41962f){if(_0x1563a8['body']['id']){delete _0x1563a8['body']['id'];}return db[_0xfd7e('0x7c')][_0xfd7e('0x25')]({'where':{'id':_0x1563a8[_0xfd7e('0x8c')]['id']}})[_0xfd7e('0x19')](handleEntityNotFound(_0x41962f,null))[_0xfd7e('0x19')](function(_0x46a036){if(_0x46a036){return _0x46a036['setTags'](_0x1563a8[_0xfd7e('0x94')][_0xfd7e('0xc9')]||[]);}return null;})[_0xfd7e('0x19')](respondWithResult(_0x41962f,null))[_0xfd7e('0x8a')](handleError(_0x41962f,null));};exports[_0xfd7e('0xca')]=function(_0x594e12,_0x5a8d8e){var _0x7a364c=[];_0x7a364c['push'](addAdditionalPhones(_0x594e12[_0xfd7e('0x94')]));Promise[_0xfd7e('0x28')](_0x7a364c)[_0xfd7e('0x19')](function(){_0x7a364c=[];_0x7a364c[_0xfd7e('0x23')](deleteCmHopperPhones(_0x594e12['body']['id']));_0x7a364c[_0xfd7e('0x23')](addCmHopperPhones(_0x594e12[_0xfd7e('0x94')]['id']));Promise['all'](_0x7a364c)[_0xfd7e('0x19')](function(){return[0x1];})['then'](respondWithResult(_0x5a8d8e,null));});};function addAdditionalPhones(_0x216f21){var _0xba73c;return new Promise(function(_0x402246,_0x1135f8){return db[_0xfd7e('0xb7')]['destroy']({'where':{'CmContactId':_0x216f21['id']}})[_0xfd7e('0x19')](function(){db[_0xfd7e('0xb9')]['findAll']({'raw':!![],'attributes':['id',_0xfd7e('0xcb')]})[_0xfd7e('0x19')](function(_0x5493f9){var _0x4e5aba=[];for(var _0x2752b4=0x0;_0x2752b4<_0x216f21[_0xfd7e('0xcc')][_0xfd7e('0x21')];_0x2752b4++){var _0x103660=_0x216f21[_0xfd7e('0xcd')]?_[_0xfd7e('0x58')](_0x216f21[_0xfd7e('0xcd')][_0x2752b4])?'':_0x216f21[_0xfd7e('0xcd')][_0x2752b4]:_0x216f21[_0xfd7e('0xcc')][_0x2752b4][_0xfd7e('0xce')]?_0x216f21[_0xfd7e('0xcc')][_0x2752b4][_0xfd7e('0xce')]:'';var _0x2d35fa=_['isNil'](_0x216f21[_0xfd7e('0xcc')][_0x2752b4][_0xfd7e('0xcf')])?'':_0x216f21['items'][_0x2752b4][_0xfd7e('0xcf')];var _0x586fb5=_0x103660+':'+_0x216f21[_0xfd7e('0xcc')][_0x2752b4][_0xfd7e('0xc5')]+'§'+_0x2d35fa;if(_['isNil'](_0xba73c))_0xba73c=_0x586fb5;else _0xba73c+=';'+_0x586fb5;var _0x4efbd9=null;if(_0x216f21['item_types']){if(!_[_0xfd7e('0x58')](_0x216f21[_0xfd7e('0xcd')][_0x2752b4])){var _0x3b5fa3=_['find'](_0x5493f9,function(_0x23fc12){return _0x23fc12['id']===_0x216f21['item_types'][_0x2752b4];});if(!_[_0xfd7e('0x58')](_0x3b5fa3)){_0x4efbd9=_0x3b5fa3['OrderBy'];}}}else{if(!_[_0xfd7e('0x58')](_0x216f21[_0xfd7e('0xcc')][_0x2752b4])){var _0x3b5fa3=_[_0xfd7e('0x48')](_0x5493f9,function(_0x1dccc7){return _0x1dccc7['id']===_0x216f21[_0xfd7e('0xcc')][_0x2752b4][_0xfd7e('0xce')];});if(!_[_0xfd7e('0x58')](_0x3b5fa3)){_0x4efbd9=_0x2752b4;}}}if(_[_0xfd7e('0x58')](_0x4efbd9)){_0x4efbd9=0x64;}_0x4e5aba[_0xfd7e('0x23')](addAdditionalPhone(_0x216f21['id'],_0x216f21[_0xfd7e('0xcc')][_0x2752b4][_0xfd7e('0xc5')],_0x216f21[_0xfd7e('0xcd')]?_[_0xfd7e('0x58')](_0x216f21[_0xfd7e('0xcd')][_0x2752b4])?null:_0x216f21[_0xfd7e('0xcd')][_0x2752b4]:_0x216f21['items'][_0x2752b4][_0xfd7e('0xce')]?_0x216f21['items'][_0x2752b4][_0xfd7e('0xce')]:null,_0x4efbd9,_0x2d35fa));}Promise['all'](_0x4e5aba)[_0xfd7e('0x19')](function(){db['CmContact'][_0xfd7e('0x18')]({'AdditionalPhones':_0xba73c},{'where':{'id':_0x216f21['id']}})[_0xfd7e('0x19')](function(){_0x402246(0x1);});});});});});}function addAdditionalPhone(_0x30d4fe,_0x126f2f,_0x8db60c,_0x22412f,_0x4cbda8){return db[_0xfd7e('0xb7')]['find']({'where':{'CmContactId':_0x30d4fe,'item':_0x126f2f}})[_0xfd7e('0x19')](function(_0x50c910){if(_0x50c910)logger[_0xfd7e('0x97')](_0xfd7e('0xd0'),_0x50c910);else{db['CmContactHasItem'][_0xfd7e('0xac')]({'CmContactId':_0x30d4fe,'item':_0x126f2f,'ItemTypeId':_0x8db60c,'OrderBy':_0x22412f,'ItemClass':'PHONE','description':_0x4cbda8});}});}function deletePhones(_0x449143){return db[_0xfd7e('0xb7')][_0xfd7e('0x8b')]({'where':{'CmContactId':_0x449143}});}function deleteCmHopperPhones(_0x2ae53b){return new Promise(function(_0x43a9ed,_0x29656b){return db[_0xfd7e('0xd1')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2ae53b}})[_0xfd7e('0x19')](function(_0x4b6aec){db[_0xfd7e('0xd2')][_0xfd7e('0x8b')]({'where':{'CmHopperId':{'$in':_[_0xfd7e('0x4b')](_0x4b6aec,'id')}}});})[_0xfd7e('0x19')](function(){_0x43a9ed(0x1);});});}function addCmHopperPhones(_0xbf72af){return new Promise(function(_0x19ebba,_0x19ae0b){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xbf72af}})[_0xfd7e('0x19')](function(_0x1fad42){var _0x5dc260=[];_[_0xfd7e('0x4b')](_0x1fad42,function(_0x2cb517){_0x5dc260[_0xfd7e('0x23')](createCmHopperPhone(_0xbf72af,_0x2cb517['id']));});Promise[_0xfd7e('0x28')](_0x5dc260)[_0xfd7e('0x19')](function(){_0x19ebba(0x1);});});});}function createCmHopperPhone(_0x5738da,_0x3871bd){return new Promise(function(_0x272fed,_0x421750){db['CmContactHasItem'][_0xfd7e('0x91')]({'raw':!![],'attributes':[_0xfd7e('0xd3'),_0xfd7e('0xcb')],'where':{'CmContactId':_0x5738da,'ItemClass':_0xfd7e('0xd4')},'include':[{'model':db[_0xfd7e('0xb9')],'attributes':[_0xfd7e('0xcb')],'as':_0xfd7e('0xba')}],'order':['OrderBy',db[_0xfd7e('0x7a')][_0xfd7e('0xd5')]('`ItemType`.OrderBy')]})['then'](function(_0x425128){var _0x5072b1=0x1;var _0x281579=_['map'](_0x425128,function(_0x40c125){_0x40c125[_0xfd7e('0xd6')]=_0x3871bd;_0x40c125['phone']=_0x40c125['item'];_0x40c125[_0xfd7e('0xcb')]=_0x5072b1;delete _0x40c125[_0xfd7e('0xd7')];_0x5072b1=_0x5072b1+0x1;return _0x40c125;});return db[_0xfd7e('0xd2')][_0xfd7e('0xb1')](_0x281579,{});})[_0xfd7e('0x19')](function(){_0x272fed(0x1);});});}function insertAdditionalPhones(_0x32a61e,_0x1c98e7){return new Promise(function(_0x5a9540,_0x177360){var _0x3e54f1=[];for(var _0xf55c0b=0x0;_0xf55c0b<_0x1c98e7[_0xfd7e('0x21')];_0xf55c0b++){var _0x406be6=_0x1c98e7[_0xf55c0b];_0x3e54f1[_0xfd7e('0x23')](parseContactItemType(_0x406be6));}Promise[_0xfd7e('0x28')](_0x3e54f1)[_0xfd7e('0x19')](function(){var _0xd976b9={'id':_0x32a61e['id'],'items':_0x1c98e7};return addAdditionalPhones(_0xd976b9)['then'](function(_0x36f8a2){return addCmHopperPhones(_0x32a61e['id']);});})['then'](function(){_0x5a9540(_0x32a61e);});});}function parseContactItemType(_0x1bc8a9){return new Promise(function(_0x48093b,_0x38be99){if(_0x1bc8a9[_0xfd7e('0x31')](_0xfd7e('0xce'))){_0x48093b(_0x1bc8a9);}else{return db[_0xfd7e('0xb9')][_0xfd7e('0x48')]({'where':{'name':_0x1bc8a9['ItemType']}})['then'](function(_0x39aa0f){if(_[_0xfd7e('0x58')](_0x39aa0f))_0x1bc8a9[_0xfd7e('0xce')]=null;else _0x1bc8a9[_0xfd7e('0xce')]=_0x39aa0f['id'];_0x48093b(_0x1bc8a9);});}});}exports[_0xfd7e('0xd8')]=function(_0x12e2a8,_0x422434){return db[_0xfd7e('0xb7')][_0xfd7e('0x91')]({'raw':!![],'where':{'CmContactId':_0x12e2a8[_0xfd7e('0x8c')]['id'],'ItemClass':_0xfd7e('0xd4')},'include':[{'model':db[_0xfd7e('0xb9')],'as':_0xfd7e('0xba')}],'order':[['OrderBy'],[db[_0xfd7e('0x7a')][_0xfd7e('0xd5')](_0xfd7e('0xd9'))]]})[_0xfd7e('0x19')](function(_0x4dd30c){return _0x4dd30c;})['then'](respondWithResult(_0x422434,null))[_0xfd7e('0x8a')](handleError(_0x422434,null));};exports[_0xfd7e('0xda')]=function(_0x83e8fb,_0x1cf6d8){return db[_0xfd7e('0xb7')][_0xfd7e('0x91')]({'raw':!![],'where':{'CmContactId':_0x83e8fb[_0xfd7e('0x94')][_0xfd7e('0xdb')]}})['then'](function(_0x50adce){var _0x812ee9=_[_0xfd7e('0x4b')](_0x50adce,function(_0x2e6f71){_0x2e6f71[_0xfd7e('0xdc')]=_0x83e8fb[_0xfd7e('0x94')][_0xfd7e('0xdd')];return _0x2e6f71;});return db[_0xfd7e('0xb7')]['bulkCreate'](_0x812ee9,{});})[_0xfd7e('0x19')](function(_0x36fcc4){return addCmHopperPhones(_0x83e8fb[_0xfd7e('0x94')][_0xfd7e('0xdd')]);})[_0xfd7e('0x19')](function(_0x413b02){return['ok'];})[_0xfd7e('0x19')](respondWithResult(_0x1cf6d8,null))['catch'](handleError(_0x1cf6d8,null));};exports[_0xfd7e('0xde')]=function(_0x3a82d9,_0x1fdb7d){var _0xabd0b2=[];_0xabd0b2[_0xfd7e('0x23')](createCmHopperPhone(_0x3a82d9[_0xfd7e('0x94')]['id'],_0x3a82d9[_0xfd7e('0x94')][_0xfd7e('0xdf')]));Promise[_0xfd7e('0x28')](_0xabd0b2)[_0xfd7e('0x19')](function(){return[0x1];})['then'](respondWithResult(_0x1fdb7d,null));};exports['getHoppers']=function(_0x5c5a58,_0x32111f){var _0x18f2bb={'raw':![],'where':{}};var _0x49b9a2={};var _0x231e91={'count':0x0,'rows':[]};return db[_0xfd7e('0x7c')][_0xfd7e('0x25')]({'where':{'id':_0x5c5a58[_0xfd7e('0x8c')]['id']}})[_0xfd7e('0x19')](handleEntityNotFound(_0x32111f,null))[_0xfd7e('0x19')](function(_0x35b153){if(_0x35b153){_0x49b9a2[_0xfd7e('0x2b')]=_[_0xfd7e('0x2d')](db[_0xfd7e('0xd1')]['rawAttributes']);_0x49b9a2[_0xfd7e('0x2c')]=_[_0xfd7e('0x2d')](_0x5c5a58[_0xfd7e('0x2c')]);_0x49b9a2[_0xfd7e('0x35')]=_['intersection'](_0x49b9a2['model'],_0x49b9a2[_0xfd7e('0x2c')]);_0x18f2bb[_0xfd7e('0x2f')]=_[_0xfd7e('0x2e')](_0x49b9a2[_0xfd7e('0x2b')],qs[_0xfd7e('0x30')](_0x5c5a58[_0xfd7e('0x2c')][_0xfd7e('0x30')]));_0x18f2bb['attributes']=_0x18f2bb[_0xfd7e('0x2f')]['length']?_0x18f2bb[_0xfd7e('0x2f')]:_0x49b9a2['model'];if(!_0x5c5a58[_0xfd7e('0x2c')][_0xfd7e('0x31')](_0xfd7e('0x32'))){_0x18f2bb[_0xfd7e('0x14')]=qs[_0xfd7e('0x14')](_0x5c5a58['query'][_0xfd7e('0x14')]);_0x18f2bb[_0xfd7e('0x12')]=qs['offset'](_0x5c5a58[_0xfd7e('0x2c')][_0xfd7e('0x12')]);}_0x18f2bb[_0xfd7e('0x6e')]=qs['sort'](_0x5c5a58[_0xfd7e('0x2c')][_0xfd7e('0x33')]);_0x18f2bb['where']=qs['filters'](_[_0xfd7e('0x34')](_0x5c5a58[_0xfd7e('0x2c')],_0x49b9a2['filters']));_0x18f2bb[_0xfd7e('0x41')][_0xfd7e('0xe0')]=_0x35b153['id'];if(_0x5c5a58[_0xfd7e('0x2c')]['filter']){_0x18f2bb[_0xfd7e('0x41')]=_[_0xfd7e('0x7b')](_0x18f2bb[_0xfd7e('0x41')],{'$or':_[_0xfd7e('0x4b')](_0x18f2bb[_0xfd7e('0x2f')],function(_0x506adc){var _0x4a3fbf={};_0x4a3fbf[_0x506adc]={'$like':'%'+_0x5c5a58[_0xfd7e('0x2c')][_0xfd7e('0x57')]+'%'};return _0x4a3fbf;})});}_0x18f2bb=_[_0xfd7e('0x7b')]({},_0x18f2bb,_0x5c5a58[_0xfd7e('0xc8')]);return db[_0xfd7e('0xd1')][_0xfd7e('0x15')]({'where':_0x18f2bb['where']})[_0xfd7e('0x19')](function(_0x31677c){_0x231e91['count']=_0x31677c;if(_0x5c5a58[_0xfd7e('0x2c')][_0xfd7e('0xe1')]){_0x18f2bb['include']=[{'all':!![]}];}return db[_0xfd7e('0xd1')]['findAll'](_0x18f2bb);})[_0xfd7e('0x19')](function(_0x5cf68c){_0x231e91['rows']=_0x5cf68c;return _0x231e91;});}})[_0xfd7e('0x19')](respondWithFilteredResult(_0x32111f,_0x18f2bb))['catch'](handleError(_0x32111f,null));};exports[_0xfd7e('0xe2')]=function(_0x7009bd,_0x203a38){var _0x437d57={'raw':!![],'where':{}};var _0x172b75={};var _0x3fa5ac={'count':0x0,'rows':[]};return db[_0xfd7e('0x7c')][_0xfd7e('0x25')]({'where':{'id':_0x7009bd['params']['id']}})[_0xfd7e('0x19')](handleEntityNotFound(_0x203a38,null))['then'](function(_0x3d4b2b){if(_0x3d4b2b){_0x172b75['model']=_['keys'](db['CmHopperHistory'][_0xfd7e('0xc7')]);_0x172b75[_0xfd7e('0x2c')]=_[_0xfd7e('0x2d')](_0x7009bd['query']);_0x172b75[_0xfd7e('0x35')]=_[_0xfd7e('0x2e')](_0x172b75[_0xfd7e('0x2b')],_0x172b75[_0xfd7e('0x2c')]);_0x437d57[_0xfd7e('0x2f')]=_[_0xfd7e('0x2e')](_0x172b75[_0xfd7e('0x2b')],qs[_0xfd7e('0x30')](_0x7009bd[_0xfd7e('0x2c')][_0xfd7e('0x30')]));_0x437d57[_0xfd7e('0x2f')]=_0x437d57[_0xfd7e('0x2f')]['length']?_0x437d57[_0xfd7e('0x2f')]:_0x172b75[_0xfd7e('0x2b')];if(!_0x7009bd[_0xfd7e('0x2c')][_0xfd7e('0x31')](_0xfd7e('0x32'))){_0x437d57[_0xfd7e('0x14')]=qs[_0xfd7e('0x14')](_0x7009bd[_0xfd7e('0x2c')][_0xfd7e('0x14')]);_0x437d57[_0xfd7e('0x12')]=qs[_0xfd7e('0x12')](_0x7009bd[_0xfd7e('0x2c')][_0xfd7e('0x12')]);}_0x437d57[_0xfd7e('0x6e')]=qs[_0xfd7e('0x33')](_0x7009bd[_0xfd7e('0x2c')]['sort']);_0x437d57['where']=qs[_0xfd7e('0x35')](_[_0xfd7e('0x34')](_0x7009bd[_0xfd7e('0x2c')],_0x172b75['filters']));_0x437d57['where']['ContactId']=_0x3d4b2b['id'];if(_0x7009bd['query'][_0xfd7e('0x57')]){_0x437d57[_0xfd7e('0x41')]=_['merge'](_0x437d57[_0xfd7e('0x41')],{'$or':_['map'](_0x437d57[_0xfd7e('0x2f')],function(_0x2cb4f2){var _0x5b87bd={};_0x5b87bd[_0x2cb4f2]={'$like':'%'+_0x7009bd[_0xfd7e('0x2c')][_0xfd7e('0x57')]+'%'};return _0x5b87bd;})});}_0x437d57=_[_0xfd7e('0x7b')]({},_0x437d57,_0x7009bd[_0xfd7e('0xc8')]);return db['CmHopperHistory'][_0xfd7e('0x15')]({'where':_0x437d57[_0xfd7e('0x41')]})[_0xfd7e('0x19')](function(_0x1270ba){_0x3fa5ac['count']=_0x1270ba;if(_0x7009bd['query']['includeAll']){_0x437d57[_0xfd7e('0xe3')]=[{'all':!![]}];}return db[_0xfd7e('0xa3')][_0xfd7e('0x91')](_0x437d57);})[_0xfd7e('0x19')](function(_0x482ace){_0x3fa5ac[_0xfd7e('0x89')]=_0x482ace;return _0x3fa5ac;});}})[_0xfd7e('0x19')](respondWithFilteredResult(_0x203a38,_0x437d57))[_0xfd7e('0x8a')](handleError(_0x203a38,null));};exports['getHopperFinals']=function(_0x520dd6,_0x1d1b46){var _0x5cf359={'raw':!![],'where':{}};var _0x12d53b={};var _0x2ed231={'count':0x0,'rows':[]};return db[_0xfd7e('0x7c')][_0xfd7e('0x25')]({'where':{'id':_0x520dd6[_0xfd7e('0x8c')]['id']}})['then'](handleEntityNotFound(_0x1d1b46,null))[_0xfd7e('0x19')](function(_0x43bff7){if(_0x43bff7){_0x12d53b[_0xfd7e('0x2b')]=_[_0xfd7e('0x2d')](db[_0xfd7e('0xe4')][_0xfd7e('0xc7')]);_0x12d53b[_0xfd7e('0x2c')]=_[_0xfd7e('0x2d')](_0x520dd6[_0xfd7e('0x2c')]);_0x12d53b[_0xfd7e('0x35')]=_[_0xfd7e('0x2e')](_0x12d53b[_0xfd7e('0x2b')],_0x12d53b[_0xfd7e('0x2c')]);_0x5cf359[_0xfd7e('0x2f')]=_['intersection'](_0x12d53b[_0xfd7e('0x2b')],qs[_0xfd7e('0x30')](_0x520dd6[_0xfd7e('0x2c')]['fields']));_0x5cf359[_0xfd7e('0x2f')]=_0x5cf359[_0xfd7e('0x2f')][_0xfd7e('0x21')]?_0x5cf359['attributes']:_0x12d53b[_0xfd7e('0x2b')];if(!_0x520dd6[_0xfd7e('0x2c')][_0xfd7e('0x31')]('nolimit')){_0x5cf359['limit']=qs[_0xfd7e('0x14')](_0x520dd6['query'][_0xfd7e('0x14')]);_0x5cf359[_0xfd7e('0x12')]=qs[_0xfd7e('0x12')](_0x520dd6[_0xfd7e('0x2c')][_0xfd7e('0x12')]);}_0x5cf359[_0xfd7e('0x6e')]=qs[_0xfd7e('0x33')](_0x520dd6[_0xfd7e('0x2c')]['sort']);_0x5cf359[_0xfd7e('0x41')]=qs[_0xfd7e('0x35')](_[_0xfd7e('0x34')](_0x520dd6[_0xfd7e('0x2c')],_0x12d53b[_0xfd7e('0x35')]));_0x5cf359[_0xfd7e('0x41')][_0xfd7e('0xe0')]=_0x43bff7['id'];if(_0x520dd6[_0xfd7e('0x2c')]['filter']){_0x5cf359[_0xfd7e('0x41')]=_[_0xfd7e('0x7b')](_0x5cf359[_0xfd7e('0x41')],{'$or':_[_0xfd7e('0x4b')](_0x5cf359[_0xfd7e('0x2f')],function(_0x30faea){var _0x189f4a={};_0x189f4a[_0x30faea]={'$like':'%'+_0x520dd6['query'][_0xfd7e('0x57')]+'%'};return _0x189f4a;})});}_0x5cf359=_['merge']({},_0x5cf359,_0x520dd6[_0xfd7e('0xc8')]);return db['CmHopperFinal'][_0xfd7e('0x15')]({'where':_0x5cf359[_0xfd7e('0x41')]})['then'](function(_0x5ebfd4){_0x2ed231[_0xfd7e('0x15')]=_0x5ebfd4;if(_0x520dd6[_0xfd7e('0x2c')][_0xfd7e('0xe1')]){_0x5cf359[_0xfd7e('0xe3')]=[{'all':!![]}];}return db[_0xfd7e('0xe4')]['findAll'](_0x5cf359);})['then'](function(_0x49abdb){_0x2ed231[_0xfd7e('0x89')]=_0x49abdb;return _0x2ed231;});}})[_0xfd7e('0x19')](respondWithFilteredResult(_0x1d1b46,_0x5cf359))[_0xfd7e('0x8a')](handleError(_0x1d1b46,null));};exports[_0xfd7e('0xe5')]=function(_0x3a6435,_0xed12c7){var _0x6d46a2={'raw':!![],'where':{}};var _0x1da7eb={};var _0x31b0c5={'count':0x0,'rows':[]};return db['CmContact'][_0xfd7e('0x25')]({'where':{'id':_0x3a6435[_0xfd7e('0x8c')]['id']}})[_0xfd7e('0x19')](handleEntityNotFound(_0xed12c7,null))['then'](function(_0x52c36c){if(_0x52c36c){_0x1da7eb[_0xfd7e('0x2b')]=_[_0xfd7e('0x2d')](db[_0xfd7e('0xe6')][_0xfd7e('0xc7')]);_0x1da7eb[_0xfd7e('0x2c')]=_[_0xfd7e('0x2d')](_0x3a6435['query']);_0x1da7eb[_0xfd7e('0x35')]=_['intersection'](_0x1da7eb['model'],_0x1da7eb[_0xfd7e('0x2c')]);_0x6d46a2[_0xfd7e('0x2f')]=_[_0xfd7e('0x2e')](_0x1da7eb[_0xfd7e('0x2b')],qs[_0xfd7e('0x30')](_0x3a6435[_0xfd7e('0x2c')][_0xfd7e('0x30')]));_0x6d46a2[_0xfd7e('0x2f')]=_0x6d46a2[_0xfd7e('0x2f')][_0xfd7e('0x21')]?_0x6d46a2[_0xfd7e('0x2f')]:_0x1da7eb[_0xfd7e('0x2b')];if(!_0x3a6435[_0xfd7e('0x2c')][_0xfd7e('0x31')](_0xfd7e('0x32'))){_0x6d46a2[_0xfd7e('0x14')]=qs[_0xfd7e('0x14')](_0x3a6435[_0xfd7e('0x2c')][_0xfd7e('0x14')]);_0x6d46a2[_0xfd7e('0x12')]=qs['offset'](_0x3a6435['query'][_0xfd7e('0x12')]);}_0x6d46a2[_0xfd7e('0x6e')]=qs['sort'](_0x3a6435['query'][_0xfd7e('0x33')]);_0x6d46a2[_0xfd7e('0x41')]=qs['filters'](_[_0xfd7e('0x34')](_0x3a6435['query'],_0x1da7eb['filters']));_0x6d46a2[_0xfd7e('0x41')][_0xfd7e('0xe0')]=_0x52c36c['id'];if(_0x3a6435[_0xfd7e('0x2c')][_0xfd7e('0x57')]){_0x6d46a2[_0xfd7e('0x41')]=_[_0xfd7e('0x7b')](_0x6d46a2[_0xfd7e('0x41')],{'$or':_[_0xfd7e('0x4b')](_0x6d46a2[_0xfd7e('0x2f')],function(_0x1382cf){var _0x4e3045={};_0x4e3045[_0x1382cf]={'$like':'%'+_0x3a6435[_0xfd7e('0x2c')][_0xfd7e('0x57')]+'%'};return _0x4e3045;})});}_0x6d46a2=_['merge']({},_0x6d46a2,_0x3a6435[_0xfd7e('0xc8')]);return db[_0xfd7e('0xe6')][_0xfd7e('0x15')]({'where':_0x6d46a2[_0xfd7e('0x41')]})[_0xfd7e('0x19')](function(_0x14a81a){_0x31b0c5[_0xfd7e('0x15')]=_0x14a81a;if(_0x3a6435[_0xfd7e('0x2c')][_0xfd7e('0xe1')]){_0x6d46a2[_0xfd7e('0xe3')]=[{'all':!![]}];}return db[_0xfd7e('0xe6')]['findAll'](_0x6d46a2);})[_0xfd7e('0x19')](function(_0x670e27){_0x31b0c5[_0xfd7e('0x89')]=_0x670e27;return _0x31b0c5;});}})[_0xfd7e('0x19')](respondWithFilteredResult(_0xed12c7,_0x6d46a2))[_0xfd7e('0x8a')](handleError(_0xed12c7,null));};exports[_0xfd7e('0xe7')]=function(_0xafa966,_0x52cd6e){try{if(!_0xafa966[_0xfd7e('0x94')][_0xfd7e('0x5a')]){throw new Error('No\x20ListId\x20specified');}if(!_0xafa966[_0xfd7e('0x94')][_0xfd7e('0xe8')]){throw new Error(_0xfd7e('0xe9'));}if(!_0xafa966[_0xfd7e('0x94')]['binding_values']){throw new Error(_0xfd7e('0xea'));}if(!_0xafa966[_0xfd7e('0x94')][_0xfd7e('0xeb')]){throw new Error(_0xfd7e('0xec'));}var _0x57b619=_0xafa966[_0xfd7e('0x94')]['binding_keys']['split'](',');var _0x590c68=_0xafa966[_0xfd7e('0x94')][_0xfd7e('0xed')]['split'](',');if(!_0x57b619[_0xfd7e('0x21')]||!_0x590c68[_0xfd7e('0x21')]||_0x57b619[_0xfd7e('0x21')]!==_0x590c68[_0xfd7e('0x21')]){throw new Error(_0xfd7e('0xee'));}_0xafa966[_0xfd7e('0x94')][_0xfd7e('0x30')]=_[_0xfd7e('0xef')](_0x57b619,_0x590c68);if(!_0xafa966[_0xfd7e('0x94')][_0xfd7e('0x30')][_0xfd7e('0xc5')]){throw new Error(_0xfd7e('0xf0'));}if(!_0xafa966[_0xfd7e('0x94')]['fields']['firstName']){throw new Error(_0xfd7e('0xf1'));}var _0x184132=path[_0xfd7e('0xad')](config[_0xfd7e('0xf2')],'server/files/tmp',_0xafa966['file'][_0xfd7e('0xf3')]);fs[_0xfd7e('0xf4')](_0x184132,parseInt('0777',0x8));var _0x478b2f=require('child_process')['fork'](path['join'](__dirname,_0xfd7e('0xf5')),[_0x184132,_0xafa966[_0xfd7e('0x94')]['binding_keys'],_0xafa966[_0xfd7e('0x94')]['binding_values'],_0xafa966['body']['ListId'],_0xafa966[_0xfd7e('0x94')][_0xfd7e('0xf6')],_0xafa966['body']['duplicates'],_0xafa966[_0xfd7e('0x94')]['socket_timestamp']]);return _0x52cd6e[_0xfd7e('0x10')](0xc8)[_0xfd7e('0x11')]({'message':_0xfd7e('0xf7'),'pid':_0x478b2f[_0xfd7e('0xf8')]});}catch(_0x5ef5c8){return _0x52cd6e[_0xfd7e('0x10')](0x1f4)['send'](_0x5ef5c8);}};exports[_0xfd7e('0xf9')]=function(_0x9a697b,_0x16d6b2){var _0x33dc19=fs['createReadStream'](_0x9a697b['file'][_0xfd7e('0xfa')]);Papa[_0xfd7e('0xfb')](_0x33dc19,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1eff1c){return _0x16d6b2['status'](0xc8)['json']({'file':_0x9a697b['file'],'fields':_0x1eff1c[_0xfd7e('0xfc')][_0xfd7e('0x30')]});}});};exports['import']=function(_0xc716ff,_0x25283b){return db[_0xfd7e('0x4f')][_0xfd7e('0x91')]({'raw':!![],'attributes':['id'],'where':{'role':_0xfd7e('0x76')}})[_0xfd7e('0x19')](function(_0x344fdf){var _0x4a1fa2=![];if(!_0xc716ff[_0xfd7e('0x94')][_0xfd7e('0x5a')]){throw new Error(_0xfd7e('0xfd'));}if(!_0xc716ff[_0xfd7e('0x94')][_0xfd7e('0xfe')][_0xfd7e('0xc5')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xc716ff['body'][_0xfd7e('0xfe')][_0xfd7e('0xff')]){throw new Error(_0xfd7e('0xf1'));}if(!_0xc716ff[_0xfd7e('0x94')]['socket_timestamp']){throw new Error(_0xfd7e('0xec'));}var _0x2e451f=require(_0xfd7e('0x100'))['fork'](path[_0xfd7e('0xad')](__dirname,_0xfd7e('0x101')),[_0xc716ff[_0xfd7e('0x8c')]['id'],JSON['stringify'](_0xc716ff[_0xfd7e('0x94')]),JSON[_0xfd7e('0x102')](_0x344fdf)]);_0x2e451f['on'](_0xfd7e('0x103'),function(){_0x4a1fa2=!![];return _0x25283b[_0xfd7e('0x10')](0xc8)['json']({'message':_0xfd7e('0x104'),'pid':_0x2e451f['pid']});});_0x2e451f['on']('exit',function(_0x5de7cc){if(_0x5de7cc&&!_0x4a1fa2){return _0x25283b[_0xfd7e('0x10')](0x1f4)[_0xfd7e('0x11')]({'message':_0xfd7e('0x105'),'pid':_0x2e451f[_0xfd7e('0xf8')]});}});})['catch'](handleError(_0x25283b,null));};exports['importUpdates']=function(_0x166fe1,_0x560756,_0x118a07){return db['User'][_0xfd7e('0x91')]({'raw':!![],'attributes':['id'],'where':{'role':_0xfd7e('0x76')}})['then'](function(_0x51131b){var _0x211adc=![];if(!_0x166fe1[_0xfd7e('0x94')][_0xfd7e('0x5a')]){throw new Error('No\x20ListId\x20specified');}if(!_0x166fe1[_0xfd7e('0x94')][_0xfd7e('0xfe')][_0xfd7e('0xc5')]){throw new Error(_0xfd7e('0xf0'));}if(!_0x166fe1[_0xfd7e('0x94')]['binding'][_0xfd7e('0xff')]){throw new Error(_0xfd7e('0xf1'));}if(!_0x166fe1[_0xfd7e('0x94')][_0xfd7e('0xeb')]){throw new Error(_0xfd7e('0xec'));}var _0x25a37c=require(_0xfd7e('0x100'))[_0xfd7e('0x106')](path[_0xfd7e('0xad')](__dirname,_0xfd7e('0x107')),[_0x166fe1[_0xfd7e('0x8c')]['id'],JSON[_0xfd7e('0x102')](_0x166fe1[_0xfd7e('0x94')]),JSON[_0xfd7e('0x102')](_0x51131b)]);_0x25a37c['on']('message',function(_0x22c206){_0x211adc=!![];return _0x560756[_0xfd7e('0x10')](0xc8)['json']({'message':_0xfd7e('0x104'),'pid':_0x25a37c[_0xfd7e('0xf8')]});});_0x25a37c['on']('exit',function(_0x361168){if(_0x361168&&!_0x211adc){return _0x560756[_0xfd7e('0x10')](0x1f4)[_0xfd7e('0x11')]({'message':_0xfd7e('0x105'),'pid':_0x25a37c[_0xfd7e('0xf8')]});}});})[_0xfd7e('0x8a')](handleError(_0x560756,null));};exports[_0xfd7e('0x108')]=function(_0x6609bf,_0x194f2c){var _0x1b43e5=[_0xfd7e('0x109'),'chat',_0xfd7e('0x10a'),_0xfd7e('0x10b'),'fax',_0xfd7e('0x10c'),'voice'];var _0x1c68ac={'offset':0x0,'order':qs[_0xfd7e('0x33')](_0xfd7e('0x10d'))},_0x149d99={'count':0x0,'rows':[]};Promise[_0xfd7e('0x73')]()[_0xfd7e('0x19')](function(){if(_0x6609bf[_0xfd7e('0x2c')][_0xfd7e('0x10e')]){if(!_[_0xfd7e('0x10f')](_0x1b43e5,_0x6609bf['query'][_0xfd7e('0x10e')]['toLowerCase']())){throw new Error('Invalid\x20channel');}_0x1b43e5=[_0x6609bf[_0xfd7e('0x2c')][_0xfd7e('0x10e')][_0xfd7e('0x110')]()];}if(_0x6609bf['query'][_0xfd7e('0x111')]){try{var _0x596c94=JSON['parse'](_0x6609bf[_0xfd7e('0x2c')][_0xfd7e('0x111')]);if(!moment(_0x596c94[_0xfd7e('0x38')])[_0xfd7e('0x112')]()){throw new Error(_0xfd7e('0x113'));}if(!moment(_0x596c94['to'])[_0xfd7e('0x112')]()){throw new Error(_0xfd7e('0x114'));}}catch(_0x3f6c64){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x6609bf[_0xfd7e('0x2c')][_0xfd7e('0x31')](_0xfd7e('0x32'))){_0x1c68ac[_0xfd7e('0x14')]=qs['limit'](_0x6609bf[_0xfd7e('0x2c')][_0xfd7e('0x14')]||0xa);_0x1c68ac[_0xfd7e('0x12')]=qs['offset'](_0x6609bf[_0xfd7e('0x2c')]['offset']);}var _0x49bc4d=_0x1b43e5[_0xfd7e('0x4b')](function(_0x35ffdc){if(_0x35ffdc==='voice'){var _0x5dbb83={'attributes':['id',_0xfd7e('0x115'),_0xfd7e('0x2a'),_0xfd7e('0x116'),_0xfd7e('0x117'),_0xfd7e('0x118'),'starttime','endtime','duration','note',_0xfd7e('0x119'),_0xfd7e('0x11a'),_0xfd7e('0x11b'),_0xfd7e('0x11c'),_0xfd7e('0x11d')],'where':{'ContactId':_0x6609bf[_0xfd7e('0x8c')]['id']},'include':[{'model':db[_0xfd7e('0x4f')],'as':_0xfd7e('0x4f'),'attributes':['id',_0xfd7e('0x1d'),_0xfd7e('0x11e'),'alias']}],'order':[[_0xfd7e('0x119'),_0xfd7e('0x6f')]]};if(_0x6609bf['query']['range']){_0x5dbb83[_0xfd7e('0x41')][_0xfd7e('0x119')]={'$gte':_0x596c94[_0xfd7e('0x38')],'$lte':_0x596c94['to']};}return db[_0xfd7e('0xa5')][_0xfd7e('0x11f')](_0x5dbb83)[_0xfd7e('0x19')](function(_0x392968){_0x149d99[_0xfd7e('0x15')]+=_0x392968[_0xfd7e('0x15')];return _[_0xfd7e('0x4b')](_0x392968[_0xfd7e('0x89')],function(_0x5ec9d5){var _0x23779f=_0x5ec9d5[_0xfd7e('0x95')]({'plain':!![]});_0x23779f[_0xfd7e('0x10e')]=_0x35ffdc;if(_0x23779f[_0xfd7e('0x4f')]){_0x23779f[_0xfd7e('0x4f')]={'id':_0x23779f[_0xfd7e('0x4f')]['id'],'name':_0x23779f[_0xfd7e('0x4f')][_0xfd7e('0x1d')],'fullname':_0x23779f[_0xfd7e('0x4f')][_0xfd7e('0x11e')],'alias':_0x23779f[_0xfd7e('0x4f')][_0xfd7e('0x92')]};}return _0x23779f;});});}else{var _0x50f656=_[_0xfd7e('0x120')](_0x35ffdc)+(_0x35ffdc===_0xfd7e('0x121')?_0xfd7e('0x122'):'Account');var _0x83ad9d={'attributes':['id',_0xfd7e('0x123'),'closedAt','createdAt',_0xfd7e('0x124'),_0xfd7e('0x125'),_0xfd7e('0x126'),_0xfd7e('0x127'),'UserId',_0x50f656+'Id'],'where':{'ContactId':_0x6609bf[_0xfd7e('0x8c')]['id']},'include':[{'model':db[_0x50f656],'as':_0xfd7e('0x128'),'attributes':['id','name',_0xfd7e('0x129')]},{'model':db[_0xfd7e('0x4f')],'as':_0xfd7e('0x12a'),'attributes':['id',_0xfd7e('0x1d'),_0xfd7e('0x11e')]},{'model':db[_0xfd7e('0x49')],'as':_0xfd7e('0x88'),'attributes':['id','name','color'],'through':{'attributes':[]}}],'order':[[_0xfd7e('0x119'),_0xfd7e('0x6f')]]};if(_0x6609bf[_0xfd7e('0x2c')][_0xfd7e('0x111')]){_0x83ad9d[_0xfd7e('0x41')][_0xfd7e('0x119')]={'$gte':_0x596c94[_0xfd7e('0x38')],'$lte':_0x596c94['to']};}switch(_0x35ffdc){case _0xfd7e('0x121'):_0x83ad9d[_0xfd7e('0x2f')][_0xfd7e('0x23')]('browserName',_0xfd7e('0x12b'),_0xfd7e('0x12c'),_0xfd7e('0x12d'),_0xfd7e('0x12e'),_0xfd7e('0x12f'),_0xfd7e('0x130'),_0xfd7e('0x131'),'referer');break;case _0xfd7e('0x109'):_0x83ad9d[_0xfd7e('0x2f')][_0xfd7e('0x23')]('subject',_0xfd7e('0x132'));break;case _0xfd7e('0x10b'):_0x83ad9d['attributes'][_0xfd7e('0x23')](_0xfd7e('0x133'),'threadId');break;}return db[_[_0xfd7e('0x120')](_0x35ffdc)+_0xfd7e('0x134')]['findAndCountAll'](_0x83ad9d)[_0xfd7e('0x19')](function(_0x57b8f7){_0x149d99[_0xfd7e('0x15')]+=_0x57b8f7[_0xfd7e('0x15')];return _[_0xfd7e('0x4b')](_0x57b8f7[_0xfd7e('0x89')],function(_0x1d015a){var _0x237373=_0x1d015a[_0xfd7e('0x95')]({'plain':!![]});_0x237373[_0xfd7e('0x10e')]=_0x35ffdc;if(_0x237373[_0xfd7e('0x12a')]){_0x237373[_0xfd7e('0x12a')]={'id':_0x237373[_0xfd7e('0x12a')]['id'],'name':_0x237373[_0xfd7e('0x12a')]['name'],'fullname':_0x237373[_0xfd7e('0x12a')]['fullname']};}return _0x237373;});});}});return Promise[_0xfd7e('0x28')](_0x49bc4d);})['then'](function(_0x350b1d){return _(_0x350b1d)[_0xfd7e('0x135')]()['sortBy'](_0xfd7e('0x119'))[_0xfd7e('0x136')]()[_0xfd7e('0x51')]();})[_0xfd7e('0x19')](function(_0x1a528d){_0x149d99[_0xfd7e('0x89')]=_0x1c68ac[_0xfd7e('0x14')]?_0x1a528d[_0xfd7e('0x137')](_0x1c68ac[_0xfd7e('0x12')],_0x1c68ac[_0xfd7e('0x12')]+_0x1c68ac['limit']):_0x1a528d;return _0x149d99;})[_0xfd7e('0x19')](respondWithFilteredResult(_0x194f2c,_0x1c68ac))['catch'](handleError(_0x194f2c,null));};
\ No newline at end of file
index df3dabd..d9090cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7855=['hook','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2a6c17,_0x58b2d3){var _0x2fbf07=function(_0x3eab5f){while(--_0x3eab5f){_0x2a6c17['push'](_0x2a6c17['shift']());}};_0x2fbf07(++_0x58b2d3);}(_0x7855,0x1b3));var _0x5785=function(_0xef3fc6,_0x34d2ff){_0xef3fc6=_0xef3fc6-0x0;var _0x5b5f87=_0x7855[_0xef3fc6];return _0x5b5f87;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x5785('0x0'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x5785('0x1')](0x0);var events={'afterCreate':_0x5785('0x2'),'afterUpdate':'update','afterDestroy':_0x5785('0x3')};function emitEvent(_0x58d3bf){return function(_0x22cb8a,_0x339abe,_0x319e14){CmContactEvents[_0x5785('0x4')](_0x58d3bf+':'+_0x22cb8a['id'],_0x22cb8a);CmContactEvents[_0x5785('0x4')](_0x58d3bf,_0x22cb8a);_0x319e14(null);};}for(var e in events){if(events[_0x5785('0x5')](e)){var event=events[e];CmContact[_0x5785('0x6')](e,emitEvent(event));}}module['exports']=CmContactEvents;
\ No newline at end of file
+var _0x18bf=['exports','CmContact','setMaxListeners','update','hasOwnProperty'];(function(_0x49cd1d,_0x28e4dc){var _0x4b4b03=function(_0x3a73af){while(--_0x3a73af){_0x49cd1d['push'](_0x49cd1d['shift']());}};_0x4b4b03(++_0x28e4dc);}(_0x18bf,0x1c8));var _0xf18b=function(_0x525286,_0x295f6d){_0x525286=_0x525286-0x0;var _0x8c2fe9=_0x18bf[_0x525286];return _0x8c2fe9;};'use strict';var EventEmitter=require('events');var CmContact=require('../../mysqldb')['db'][_0xf18b('0x0')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xf18b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf18b('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3e8c18){return function(_0x30f239,_0x322257,_0x2a76c6){CmContactEvents['emit'](_0x3e8c18+':'+_0x30f239['id'],_0x30f239);CmContactEvents['emit'](_0x3e8c18,_0x30f239);_0x2a76c6(null);};}for(var e in events){if(events[_0xf18b('0x3')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xf18b('0x4')]=CmContactEvents;
\ No newline at end of file
index 8eb743c..a6edfc5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x122e=['moment','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','timezones','utcOffset','scheduledat','add','minutes','then','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','format','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','ListId','catch','inspect','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','Lists','always','onlyIfOpen','length','CmHopperBlack','message','dialCheckDuplicateType','BlackLists','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api'];(function(_0x1e603a,_0x3adf70){var _0x540209=function(_0xe76b99){while(--_0xe76b99){_0x1e603a['push'](_0x1e603a['shift']());}};_0x540209(++_0x3adf70);}(_0x122e,0xe6));var _0xe122=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x122e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xe122('0x0'));var util=require(_0xe122('0x1'));var logger=require(_0xe122('0x2'))(_0xe122('0x3'));var moment=require(_0xe122('0x4'));var BPromise=require('bluebird');var rp=require(_0xe122('0x5'));var fs=require('fs');var path=require(_0xe122('0x6'));var rimraf=require(_0xe122('0x7'));var config=require(_0xe122('0x8'));var shared=require(_0xe122('0x9'));var attributes=require(_0xe122('0xa'));module[_0xe122('0xb')]=function(_0x1013d4,_0x433967){return _0x1013d4[_0xe122('0xc')](_0xe122('0xd'),attributes,{'tableName':_0xe122('0xe'),'paranoid':!![],'indexes':[{'name':_0xe122('0xf'),'fields':['phone']},{'name':_0xe122('0x10'),'fields':[_0xe122('0x11'),_0xe122('0x12'),_0xe122('0xf'),'mobile',_0xe122('0x13'),_0xe122('0x14')],'type':_0xe122('0x15')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xe122('0x16'),'hooks':{'afterCreate':function(_0x18c4cf,_0x111e02,_0x5244aa){var _0x3541d7=_0x1013d4[_0xe122('0x17')];var _0x1dc5f6=_0x18c4cf[_0xe122('0x18')]({'plain':!![]});function _0x2b65e2(){return function(_0x214336){logger[_0xe122('0x19')](_0xe122('0x1a'),_0xe122('0x1b'),util['inspect'](_0x214336,{'showHidden':![],'depth':null}));};}function _0x1e181c(_0x1eac70,_0x1657ae){var _0x373f03=_0x1657ae['scheduledat']?_0x1657ae['scheduledat']:moment()['format'](_0xe122('0x1c'));return new BPromise(function(_0x4dac23,_0x49c71a){if(_[_0xe122('0x1d')](_0x1657ae[_0xe122('0x1e')])){_0x4dac23({'ret':_0x373f03});}else{_0x3541d7[_0xe122('0x1f')][_0xe122('0x20')]({'where':{'id':_0x1eac70['id']}})['then'](function(_0x5ef56f){if(!_[_0xe122('0x1d')](_0x5ef56f)){var _0x447cec=_0x5ef56f[_0xe122('0x1e')];if(!_[_0xe122('0x1d')](_0x447cec)){var _0x126fd1=shared[_0xe122('0x21')];var _0x54411d=_0x126fd1[_0x447cec];var _0xc639c7=_0x126fd1[_0x1657ae[_0xe122('0x1e')]];if(!_['isNil'](_0x54411d)&&!_[_0xe122('0x1d')](_0xc639c7)){var _0x3e1a3e=_0x54411d[_0xe122('0x22')]-_0xc639c7[_0xe122('0x22')];_0x373f03=_0x1657ae[_0xe122('0x23')]?_0x1657ae[_0xe122('0x23')]:moment();var _0x7cdd71=moment(_0x373f03)[_0xe122('0x24')](_0x3e1a3e,_0xe122('0x25'));_0x4dac23({'ret':_0x7cdd71['format'](_0xe122('0x1c'))});}else _0x4dac23({'ret':_0x373f03});}else _0x4dac23({'ret':_0x373f03});}else{_0x4dac23({'ret':_0x373f03});}});}});return 0xa;}var _0x1108dd=function(_0x58c2c7){return new BPromise(function(_0x317fe7,_0x35e94b){_0x1e181c(_0x58c2c7,_0x1dc5f6)[_0xe122('0x26')](function(_0x214528){_0x1dc5f6['scheduledat']=_0x214528[_0xe122('0x27')];_0x3541d7[_0xe122('0x28')][_0xe122('0x20')]({'where':{'phone':_0x1dc5f6[_0xe122('0xf')],'VoiceQueueId':_0x58c2c7['id']}})[_0xe122('0x26')](function(_0x307fa9){if(!_['isNil'](_0x307fa9)){throw new Error(_0xe122('0x29')+_0x1dc5f6[_0xe122('0xf')]+_0xe122('0x2a')+_0x58c2c7['id']);}return _0x3541d7[_0xe122('0x28')][_0xe122('0x2b')]({'phone':_0x1dc5f6['phone'],'ContactId':_0x1dc5f6['id'],'ListId':_0x1dc5f6['ListId'],'priority':_0x1dc5f6[_0xe122('0x2c')]?_0x1dc5f6[_0xe122('0x2c')]:0x2,'scheduledat':_0x1dc5f6['scheduledat']?_0x1dc5f6[_0xe122('0x23')]:moment()[_0xe122('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1dc5f6[_0xe122('0x2e')]?!![]:![],'callbackuniqueid':_0x1dc5f6[_0xe122('0x2e')]?_0x1dc5f6[_0xe122('0x2e')]:undefined,'callbackat':_0x1dc5f6[_0xe122('0x2e')]?moment()[_0xe122('0x2d')](_0xe122('0x1c')):undefined,'VoiceQueueId':_0x58c2c7['id']});})['catch'](function(_0x2855b9){_0x35e94b(_0x2855b9);});});});};var _0x1bd335=function(_0x542529){return new BPromise(function(_0x550414,_0x20fc56){_0x1e181c(_0x542529,_0x1dc5f6)[_0xe122('0x26')](function(_0x152243){_0x1dc5f6[_0xe122('0x23')]=_0x152243[_0xe122('0x27')];_0x3541d7[_0xe122('0x28')]['findOne']({'where':{'phone':_0x1dc5f6[_0xe122('0xf')],'VoiceQueueId':_0x542529['id']}})[_0xe122('0x26')](function(_0x44dc6b){if(!_[_0xe122('0x1d')](_0x44dc6b)){throw new Error(_0xe122('0x29')+_0x1dc5f6[_0xe122('0xf')]+_0xe122('0x2f')+_0x542529['id']);}return _0x3541d7[_0xe122('0x30')][_0xe122('0x20')]({'where':{'calleridnum':_0x1dc5f6['phone'],'VoiceQueueId':_0x542529['id']}});})[_0xe122('0x26')](function(_0x3ae247){if(!_[_0xe122('0x1d')](_0x3ae247)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x1dc5f6[_0xe122('0xf')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x542529['id']);}return _0x3541d7[_0xe122('0x28')]['create']({'phone':_0x1dc5f6[_0xe122('0xf')],'ContactId':_0x1dc5f6['id'],'ListId':_0x1dc5f6[_0xe122('0x31')],'priority':_0x1dc5f6['priority']?_0x1dc5f6[_0xe122('0x2c')]:0x2,'scheduledat':_0x1dc5f6[_0xe122('0x23')]?_0x1dc5f6[_0xe122('0x23')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1dc5f6[_0xe122('0x2e')]?!![]:![],'callbackuniqueid':_0x1dc5f6[_0xe122('0x2e')]?_0x1dc5f6[_0xe122('0x2e')]:undefined,'callbackat':_0x1dc5f6[_0xe122('0x2e')]?moment()[_0xe122('0x2d')](_0xe122('0x1c')):undefined,'VoiceQueueId':_0x542529['id']});})[_0xe122('0x32')](function(_0x194563){_0x20fc56(_0x194563);});});});};function _0x57abfc(){return function(_0x57a61f){logger[_0xe122('0x19')](_0xe122('0x1a'),_0xe122('0x1b'),util[_0xe122('0x33')](_0x57a61f,{'showHidden':![],'depth':null}));};}function _0x40b62c(_0x4d03bc,_0x35b672){var _0x3de6e2=_0x35b672[_0xe122('0x23')]?_0x35b672['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x25890a,_0x56980d){if(_['isNil'](_0x35b672[_0xe122('0x1e')])){_0x25890a({'ret':_0x3de6e2});}else{_0x3541d7[_0xe122('0x34')][_0xe122('0x20')]({'where':{'id':_0x4d03bc['id']}})[_0xe122('0x26')](function(_0x513d64){if(!_[_0xe122('0x1d')](_0x513d64)){var _0x36f5cc=_0x513d64[_0xe122('0x1e')];if(!_[_0xe122('0x1d')](_0x36f5cc)){var _0x2c9f28=shared[_0xe122('0x21')];var _0x18b881=_0x2c9f28[_0x36f5cc];var _0xb6bc66=_0x2c9f28[_0x35b672[_0xe122('0x1e')]];if(!_[_0xe122('0x1d')](_0x18b881)&&!_[_0xe122('0x1d')](_0xb6bc66)){var _0x173dca=_0x18b881[_0xe122('0x22')]-_0xb6bc66['utcOffset'];_0x3de6e2=_0x35b672[_0xe122('0x23')]?_0x35b672[_0xe122('0x23')]:moment();var _0x448225=moment(_0x3de6e2)[_0xe122('0x24')](_0x173dca,'minutes');_0x25890a({'ret':_0x448225[_0xe122('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x25890a({'ret':_0x3de6e2});}else _0x25890a({'ret':_0x3de6e2});}else{_0x25890a({'ret':_0x3de6e2});}});}});return 0xa;}var _0x1bd3eb=function(_0x56780f){return new BPromise(function(_0x45e658,_0x303a3e){_0x40b62c(_0x56780f,_0x1dc5f6)[_0xe122('0x26')](function(_0xfbfcdf){_0x1dc5f6['scheduledat']=_0xfbfcdf[_0xe122('0x27')];_0x3541d7[_0xe122('0x28')][_0xe122('0x20')]({'where':{'phone':_0x1dc5f6[_0xe122('0xf')],'CampaignId':_0x56780f['id']}})[_0xe122('0x26')](function(_0x41d419){if(!_[_0xe122('0x1d')](_0x41d419)){throw new Error(_0xe122('0x29')+_0x1dc5f6['phone']+_0xe122('0x35')+_0x56780f['id']);}return _0x3541d7['CmHopper'][_0xe122('0x2b')]({'phone':_0x1dc5f6[_0xe122('0xf')],'ContactId':_0x1dc5f6['id'],'ListId':_0x1dc5f6['ListId'],'priority':_0x1dc5f6[_0xe122('0x2c')]?_0x1dc5f6['priority']:0x2,'scheduledat':_0x1dc5f6['scheduledat']?_0x1dc5f6['scheduledat']:moment()[_0xe122('0x2d')](_0xe122('0x1c')),'callback':_0x1dc5f6[_0xe122('0x2e')]?!![]:![],'callbackuniqueid':_0x1dc5f6[_0xe122('0x2e')]?_0x1dc5f6['callbackUniqueid']:undefined,'callbackat':_0x1dc5f6[_0xe122('0x2e')]?moment()[_0xe122('0x2d')](_0xe122('0x1c')):undefined,'CampaignId':_0x56780f['id']});})[_0xe122('0x32')](function(_0x46c59b){_0x303a3e(_0x46c59b);});});});};var _0x41f997=function(_0x466c30){return new BPromise(function(_0x32925b,_0xe60bbc){_0x40b62c(_0x466c30,_0x1dc5f6)[_0xe122('0x26')](function(_0x1d582b){_0x1dc5f6[_0xe122('0x23')]=_0x1d582b[_0xe122('0x27')];_0x3541d7[_0xe122('0x28')][_0xe122('0x20')]({'where':{'phone':_0x1dc5f6[_0xe122('0xf')],'CampaignId':_0x466c30['id']}})[_0xe122('0x26')](function(_0x19eeef){if(!_[_0xe122('0x1d')](_0x19eeef)){throw new Error(_0xe122('0x29')+_0x1dc5f6['phone']+_0xe122('0x36')+_0x466c30['id']);}return _0x3541d7[_0xe122('0x30')][_0xe122('0x20')]({'where':{'calleridnum':_0x1dc5f6['phone'],'CampaignId':_0x466c30['id']}});})[_0xe122('0x26')](function(_0x42d32d){if(!_[_0xe122('0x1d')](_0x42d32d)){throw new Error(_0xe122('0x37')+_0x1dc5f6[_0xe122('0xf')]+_0xe122('0x38')+_0x466c30['id']);}return _0x3541d7['CmHopper'][_0xe122('0x2b')]({'phone':_0x1dc5f6['phone'],'ContactId':_0x1dc5f6['id'],'ListId':_0x1dc5f6['ListId'],'priority':_0x1dc5f6[_0xe122('0x2c')]?_0x1dc5f6['priority']:0x2,'scheduledat':_0x1dc5f6[_0xe122('0x23')]?_0x1dc5f6[_0xe122('0x23')]:moment()[_0xe122('0x2d')](_0xe122('0x1c')),'callback':_0x1dc5f6['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1dc5f6[_0xe122('0x2e')]?_0x1dc5f6[_0xe122('0x2e')]:undefined,'callbackat':_0x1dc5f6[_0xe122('0x2e')]?moment()[_0xe122('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x466c30['id']});})[_0xe122('0x32')](function(_0x1d79e2){_0xe60bbc(_0x1d79e2);});});});};if(_0x1dc5f6[_0xe122('0x31')]){_0x3541d7['VoiceQueue'][_0xe122('0x39')]({'where':{'type':_0xe122('0x3a')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x3541d7[_0xe122('0x3b')],'as':_0xe122('0x3c'),'where':{'id':_0x1dc5f6[_0xe122('0x31')]}}]})[_0xe122('0x26')](function(_0x3bacbe){if(_0x3bacbe){var _0x2892a0=[];for(var _0x3956c9=0x0,_0x39d3cc;_0x3956c9<_0x3bacbe['length'];_0x3956c9+=0x1){_0x39d3cc=_0x3bacbe[_0x3956c9][_0xe122('0x18')]({'plain':!![]});switch(_0x39d3cc['dialCheckDuplicateType']){case _0xe122('0x3d'):_0x1bd335(_0x39d3cc)[_0xe122('0x32')](_0x2b65e2());break;case _0xe122('0x3e'):_0x1108dd(_0x39d3cc)[_0xe122('0x32')](_0x2b65e2());break;default:_0x40b62c(_0x39d3cc,_0x1dc5f6)['then'](function(_0x4906f3){_0x1dc5f6[_0xe122('0x23')]=_0x4906f3['ret'];_0x3541d7['CmHopper'][_0xe122('0x2b')]({'phone':_0x1dc5f6[_0xe122('0xf')],'ContactId':_0x1dc5f6['id'],'ListId':_0x1dc5f6[_0xe122('0x31')],'scheduledat':_0x1dc5f6[_0xe122('0x23')]?_0x1dc5f6[_0xe122('0x23')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x1dc5f6[_0xe122('0x2c')]?_0x1dc5f6['priority']:0x2,'callback':_0x1dc5f6['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1dc5f6[_0xe122('0x2e')]?_0x1dc5f6['callbackUniqueid']:undefined,'callbackat':_0x1dc5f6['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x39d3cc['id']})[_0xe122('0x32')](_0x2b65e2());});}}}})[_0xe122('0x26')](function(){return _0x3541d7[_0xe122('0x1f')]['findAll']({'where':{'type':_0xe122('0x3a')},'attributes':['id'],'include':[{'model':_0x3541d7[_0xe122('0x3b')],'as':'BlackLists','where':{'id':_0x1dc5f6[_0xe122('0x31')]}}]})[_0xe122('0x26')](function(_0x7235e9){if(_0x7235e9){var _0x5df288=[];for(var _0x4ce7bb=0x0,_0x15781f;_0x4ce7bb<_0x7235e9[_0xe122('0x3f')];_0x4ce7bb+=0x1){_0x15781f=_0x7235e9[_0x4ce7bb][_0xe122('0x18')]({'plain':!![]});_0x3541d7[_0xe122('0x40')][_0xe122('0x2b')]({'phone':_0x1dc5f6[_0xe122('0xf')],'ContactId':_0x1dc5f6['id'],'ListId':_0x1dc5f6[_0xe122('0x31')],'VoiceQueueId':_0x15781f['id']})['catch'](function(_0x5cfc67){logger[_0xe122('0x19')]('cmContact,\x20%s,\x20%s',_0xe122('0x1b'),_0x5cfc67[_0xe122('0x41')]);});}}});})['then'](function(){return _0x3541d7['Campaign']['findAll']({'attributes':['id',_0xe122('0x42'),_0xe122('0x1e')],'include':[{'model':_0x3541d7[_0xe122('0x3b')],'as':'Lists','where':{'id':_0x1dc5f6['ListId']}}]})[_0xe122('0x26')](function(_0x2abac8){if(_0x2abac8){var _0x129431=[];for(var _0x3f26c2=0x0,_0x39302a;_0x3f26c2<_0x2abac8[_0xe122('0x3f')];_0x3f26c2+=0x1){_0x39302a=_0x2abac8[_0x3f26c2][_0xe122('0x18')]({'plain':!![]});switch(_0x39302a[_0xe122('0x42')]){case _0xe122('0x3d'):_0x41f997(_0x39302a)[_0xe122('0x32')](_0x57abfc());break;case _0xe122('0x3e'):_0x1bd3eb(_0x39302a)[_0xe122('0x32')](_0x57abfc());break;default:_0x3541d7[_0xe122('0x28')]['create']({'phone':_0x1dc5f6[_0xe122('0xf')],'ContactId':_0x1dc5f6['id'],'ListId':_0x1dc5f6[_0xe122('0x31')],'scheduledat':_0x1dc5f6[_0xe122('0x23')]?_0x1dc5f6[_0xe122('0x23')]:moment()[_0xe122('0x2d')](_0xe122('0x1c')),'priority':_0x1dc5f6[_0xe122('0x2c')]?_0x1dc5f6[_0xe122('0x2c')]:0x2,'callback':_0x1dc5f6['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1dc5f6[_0xe122('0x2e')]?_0x1dc5f6[_0xe122('0x2e')]:undefined,'callbackat':_0x1dc5f6['callbackUniqueid']?moment()['format'](_0xe122('0x1c')):undefined,'CampaignId':_0x39302a['id']})[_0xe122('0x32')](_0x57abfc());}}}});})['then'](function(){return _0x3541d7[_0xe122('0x34')]['findAll']({'attributes':['id'],'include':[{'model':_0x3541d7[_0xe122('0x3b')],'as':_0xe122('0x43'),'where':{'id':_0x1dc5f6[_0xe122('0x31')]}}]})['then'](function(_0x1abd5d){if(_0x1abd5d){var _0x2174c5=[];for(var _0x20ad2f=0x0,_0x5c4ec2;_0x20ad2f<_0x1abd5d[_0xe122('0x3f')];_0x20ad2f+=0x1){_0x5c4ec2=_0x1abd5d[_0x20ad2f][_0xe122('0x18')]({'plain':!![]});_0x3541d7[_0xe122('0x40')][_0xe122('0x2b')]({'phone':_0x1dc5f6['phone'],'ContactId':_0x1dc5f6['id'],'ListId':_0x1dc5f6[_0xe122('0x31')],'CampaignId':_0x5c4ec2['id']})['catch'](function(_0x36283f){logger[_0xe122('0x19')]('cmContact,\x20%s,\x20%s',_0xe122('0x1b'),_0x36283f[_0xe122('0x41')]);});}}});})['then'](function(){_0x5244aa();})[_0xe122('0x32')](function(_0x4a4348){logger[_0xe122('0x19')](_0xe122('0x44'),_0xe122('0x1b'),_0x4a4348[_0xe122('0x41')]);_0x5244aa(_0x4a4348);});}else{_0x5244aa(new Error(_0xe122('0x45')));}},'afterDestroy':function(_0x157300,_0x55d68a,_0x2f3c52){var _0x2c29f6=_0x1013d4['models'];var _0x192cb8=_0x157300[_0xe122('0x18')]({'plain':!![]});return _0x2c29f6[_0xe122('0x28')]['findAll']({'raw':!![],'where':{'ListId':_0x192cb8['ListId'],'ContactId':_0x192cb8['id']}})[_0xe122('0x26')](function(_0x115107){if(!_[_0xe122('0x46')](_0x115107)){var _0x2323bf=[];for(var _0x519883=0x0;_0x519883<_0x115107['length'];_0x519883+=0x1){var _0x18d2bb=_0x2c29f6[_0xe122('0x28')][_0xe122('0x47')]({'where':{'ListId':_0x115107[_0x519883][_0xe122('0x31')],'ContactId':_0x115107[_0x519883][_0xe122('0x48')],'VoiceQueueId':_0x115107[_0x519883][_0xe122('0x49')],'CampaignId':_0x115107[_0x519883][_0xe122('0x4a')]}});_0x2323bf['push'](_0x18d2bb);}return BPromise['all'](_0x2323bf);}})[_0xe122('0x26')](function(_0x43c158){logger[_0xe122('0x4b')](_0xe122('0x4c'),util[_0xe122('0x33')](_0x43c158,{'showHidden':![],'depth':null}));_0x2f3c52();})[_0xe122('0x32')](function(_0x2665ee){logger['error'](_0xe122('0x4d'),util[_0xe122('0x33')](_0x2665ee,{'showHidden':![],'depth':null}));_0x2f3c52(_0x2665ee);});}}});};
\ No newline at end of file
+var _0x779c=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','format','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','catch','inspect','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','destroy','VoiceQueueId','CampaignId','push','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','../../config/environment/shared','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','scheduledat','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','then','isNil','timezones','utcOffset','add','ret','CmHopper','findOne','cmContact,\x20afterCreate\x20'];(function(_0x795be3,_0x30d5f4){var _0x1a31dd=function(_0xc1d67b){while(--_0xc1d67b){_0x795be3['push'](_0x795be3['shift']());}};_0x1a31dd(++_0x30d5f4);}(_0x779c,0x189));var _0xc779=function(_0x18faec,_0x2998df){_0x18faec=_0x18faec-0x0;var _0x1f4a37=_0x779c[_0x18faec];return _0x1f4a37;};'use strict';var _=require(_0xc779('0x0'));var util=require(_0xc779('0x1'));var logger=require(_0xc779('0x2'))(_0xc779('0x3'));var moment=require(_0xc779('0x4'));var BPromise=require('bluebird');var rp=require(_0xc779('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc779('0x6'));var shared=require(_0xc779('0x7'));var attributes=require('./cmContact.attributes');module[_0xc779('0x8')]=function(_0x3ac34f,_0x453bd3){return _0x3ac34f[_0xc779('0x9')](_0xc779('0xa'),attributes,{'tableName':_0xc779('0xb'),'paranoid':!![],'indexes':[{'name':_0xc779('0xc'),'fields':[_0xc779('0xc')]},{'name':_0xc779('0xd'),'fields':[_0xc779('0xe'),_0xc779('0xf'),_0xc779('0xc'),_0xc779('0x10'),_0xc779('0x11'),'email'],'type':_0xc779('0x12')}],'timestamps':!![],'charset':_0xc779('0x13'),'collate':_0xc779('0x14'),'hooks':{'afterCreate':function(_0x2e75ba,_0x20b946,_0x4aba67){var _0x78f2db=_0x3ac34f[_0xc779('0x15')];var _0x572d3b=_0x2e75ba[_0xc779('0x16')]({'plain':!![]});function _0x4532db(){return function(_0x1ff93e){logger[_0xc779('0x17')](_0xc779('0x18'),_0xc779('0x19'),util['inspect'](_0x1ff93e,{'showHidden':![],'depth':null}));};}function _0xf14237(_0x3b718e,_0xd84753){var _0x1c2057=_0xd84753[_0xc779('0x1a')]?_0xd84753[_0xc779('0x1a')]:moment()['format'](_0xc779('0x1b'));return new BPromise(function(_0x17eed7,_0x17922c){if(_['isNil'](_0xd84753[_0xc779('0x1c')])){_0x17eed7({'ret':_0x1c2057});}else{_0x78f2db[_0xc779('0x1d')]['findOne']({'where':{'id':_0x3b718e['id']}})[_0xc779('0x1e')](function(_0x1c8c9e){if(!_[_0xc779('0x1f')](_0x1c8c9e)){var _0x4c9f84=_0x1c8c9e[_0xc779('0x1c')];if(!_[_0xc779('0x1f')](_0x4c9f84)){var _0x1e106a=shared[_0xc779('0x20')];var _0x149732=_0x1e106a[_0x4c9f84];var _0x30dfb1=_0x1e106a[_0xd84753['dialTimezone']];if(!_[_0xc779('0x1f')](_0x149732)&&!_[_0xc779('0x1f')](_0x30dfb1)){var _0x15f491=_0x149732[_0xc779('0x21')]-_0x30dfb1['utcOffset'];_0x1c2057=_0xd84753['scheduledat']?_0xd84753['scheduledat']:moment();var _0x44c1a1=moment(_0x1c2057)[_0xc779('0x22')](_0x15f491,'minutes');_0x17eed7({'ret':_0x44c1a1['format'](_0xc779('0x1b'))});}else _0x17eed7({'ret':_0x1c2057});}else _0x17eed7({'ret':_0x1c2057});}else{_0x17eed7({'ret':_0x1c2057});}});}});return 0xa;}var _0x532625=function(_0x59d204){return new BPromise(function(_0x5f4505,_0x4513ed){_0xf14237(_0x59d204,_0x572d3b)[_0xc779('0x1e')](function(_0x494f49){_0x572d3b[_0xc779('0x1a')]=_0x494f49[_0xc779('0x23')];_0x78f2db[_0xc779('0x24')][_0xc779('0x25')]({'where':{'phone':_0x572d3b[_0xc779('0xc')],'VoiceQueueId':_0x59d204['id']}})[_0xc779('0x1e')](function(_0x2e6082){if(!_[_0xc779('0x1f')](_0x2e6082)){throw new Error(_0xc779('0x26')+_0x572d3b[_0xc779('0xc')]+_0xc779('0x27')+_0x59d204['id']);}return _0x78f2db['CmHopper'][_0xc779('0x28')]({'phone':_0x572d3b[_0xc779('0xc')],'ContactId':_0x572d3b['id'],'ListId':_0x572d3b[_0xc779('0x29')],'priority':_0x572d3b[_0xc779('0x2a')]?_0x572d3b[_0xc779('0x2a')]:0x2,'scheduledat':_0x572d3b[_0xc779('0x1a')]?_0x572d3b[_0xc779('0x1a')]:moment()[_0xc779('0x2b')](_0xc779('0x1b')),'callback':_0x572d3b[_0xc779('0x2c')]?!![]:![],'callbackuniqueid':_0x572d3b[_0xc779('0x2c')]?_0x572d3b[_0xc779('0x2c')]:undefined,'callbackat':_0x572d3b[_0xc779('0x2c')]?moment()[_0xc779('0x2b')](_0xc779('0x1b')):undefined,'VoiceQueueId':_0x59d204['id']});})['catch'](function(_0x352d65){_0x4513ed(_0x352d65);});});});};var _0x1ea7a0=function(_0x347349){return new BPromise(function(_0x2eded7,_0x4bb01b){_0xf14237(_0x347349,_0x572d3b)['then'](function(_0x5e9f9e){_0x572d3b['scheduledat']=_0x5e9f9e['ret'];_0x78f2db['CmHopper'][_0xc779('0x25')]({'where':{'phone':_0x572d3b['phone'],'VoiceQueueId':_0x347349['id']}})[_0xc779('0x1e')](function(_0x48cf5c){if(!_[_0xc779('0x1f')](_0x48cf5c)){throw new Error('cmContact,\x20afterCreate\x20'+_0x572d3b[_0xc779('0xc')]+_0xc779('0x2d')+_0x347349['id']);}return _0x78f2db[_0xc779('0x2e')][_0xc779('0x25')]({'where':{'calleridnum':_0x572d3b[_0xc779('0xc')],'VoiceQueueId':_0x347349['id']}});})[_0xc779('0x1e')](function(_0x4fdc05){if(!_['isNil'](_0x4fdc05)){throw new Error(_0xc779('0x2f')+_0x572d3b['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x347349['id']);}return _0x78f2db['CmHopper'][_0xc779('0x28')]({'phone':_0x572d3b[_0xc779('0xc')],'ContactId':_0x572d3b['id'],'ListId':_0x572d3b[_0xc779('0x29')],'priority':_0x572d3b['priority']?_0x572d3b['priority']:0x2,'scheduledat':_0x572d3b[_0xc779('0x1a')]?_0x572d3b[_0xc779('0x1a')]:moment()[_0xc779('0x2b')](_0xc779('0x1b')),'callback':_0x572d3b[_0xc779('0x2c')]?!![]:![],'callbackuniqueid':_0x572d3b[_0xc779('0x2c')]?_0x572d3b['callbackUniqueid']:undefined,'callbackat':_0x572d3b[_0xc779('0x2c')]?moment()[_0xc779('0x2b')](_0xc779('0x1b')):undefined,'VoiceQueueId':_0x347349['id']});})[_0xc779('0x30')](function(_0x5d1229){_0x4bb01b(_0x5d1229);});});});};function _0x4b61f1(){return function(_0x19c152){logger[_0xc779('0x17')](_0xc779('0x18'),'afterCreate',util[_0xc779('0x31')](_0x19c152,{'showHidden':![],'depth':null}));};}function _0x5a7c69(_0x4eafd8,_0x224c8b){var _0x4968db=_0x224c8b['scheduledat']?_0x224c8b[_0xc779('0x1a')]:moment()[_0xc779('0x2b')](_0xc779('0x1b'));return new BPromise(function(_0x4d5a6a,_0x328459){if(_[_0xc779('0x1f')](_0x224c8b['dialTimezone'])){_0x4d5a6a({'ret':_0x4968db});}else{_0x78f2db[_0xc779('0x32')][_0xc779('0x25')]({'where':{'id':_0x4eafd8['id']}})['then'](function(_0xd35e8c){if(!_[_0xc779('0x1f')](_0xd35e8c)){var _0x4dc5d5=_0xd35e8c[_0xc779('0x1c')];if(!_[_0xc779('0x1f')](_0x4dc5d5)){var _0x2310c3=shared[_0xc779('0x20')];var _0x168026=_0x2310c3[_0x4dc5d5];var _0x18cf63=_0x2310c3[_0x224c8b[_0xc779('0x1c')]];if(!_[_0xc779('0x1f')](_0x168026)&&!_[_0xc779('0x1f')](_0x18cf63)){var _0x3ba8ca=_0x168026[_0xc779('0x21')]-_0x18cf63[_0xc779('0x21')];_0x4968db=_0x224c8b[_0xc779('0x1a')]?_0x224c8b[_0xc779('0x1a')]:moment();var _0x5632cd=moment(_0x4968db)[_0xc779('0x22')](_0x3ba8ca,'minutes');_0x4d5a6a({'ret':_0x5632cd[_0xc779('0x2b')](_0xc779('0x1b'))});}else _0x4d5a6a({'ret':_0x4968db});}else _0x4d5a6a({'ret':_0x4968db});}else{_0x4d5a6a({'ret':_0x4968db});}});}});return 0xa;}var _0x116f16=function(_0x7b156c){return new BPromise(function(_0x1ac58c,_0x2e0452){_0x5a7c69(_0x7b156c,_0x572d3b)[_0xc779('0x1e')](function(_0x473d8c){_0x572d3b['scheduledat']=_0x473d8c['ret'];_0x78f2db[_0xc779('0x24')][_0xc779('0x25')]({'where':{'phone':_0x572d3b[_0xc779('0xc')],'CampaignId':_0x7b156c['id']}})[_0xc779('0x1e')](function(_0x2572a4){if(!_[_0xc779('0x1f')](_0x2572a4)){throw new Error(_0xc779('0x26')+_0x572d3b['phone']+_0xc779('0x33')+_0x7b156c['id']);}return _0x78f2db[_0xc779('0x24')]['create']({'phone':_0x572d3b[_0xc779('0xc')],'ContactId':_0x572d3b['id'],'ListId':_0x572d3b[_0xc779('0x29')],'priority':_0x572d3b[_0xc779('0x2a')]?_0x572d3b[_0xc779('0x2a')]:0x2,'scheduledat':_0x572d3b['scheduledat']?_0x572d3b[_0xc779('0x1a')]:moment()['format'](_0xc779('0x1b')),'callback':_0x572d3b['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x572d3b[_0xc779('0x2c')]?_0x572d3b['callbackUniqueid']:undefined,'callbackat':_0x572d3b[_0xc779('0x2c')]?moment()[_0xc779('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x7b156c['id']});})['catch'](function(_0x55f83e){_0x2e0452(_0x55f83e);});});});};var _0x405e3a=function(_0x1507a3){return new BPromise(function(_0x3e4286,_0x3dcf56){_0x5a7c69(_0x1507a3,_0x572d3b)['then'](function(_0x16670f){_0x572d3b['scheduledat']=_0x16670f[_0xc779('0x23')];_0x78f2db[_0xc779('0x24')][_0xc779('0x25')]({'where':{'phone':_0x572d3b[_0xc779('0xc')],'CampaignId':_0x1507a3['id']}})['then'](function(_0x306c6b){if(!_[_0xc779('0x1f')](_0x306c6b)){throw new Error(_0xc779('0x26')+_0x572d3b[_0xc779('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x1507a3['id']);}return _0x78f2db[_0xc779('0x2e')][_0xc779('0x25')]({'where':{'calleridnum':_0x572d3b['phone'],'CampaignId':_0x1507a3['id']}});})[_0xc779('0x1e')](function(_0x47db0d){if(!_[_0xc779('0x1f')](_0x47db0d)){throw new Error(_0xc779('0x2f')+_0x572d3b[_0xc779('0xc')]+_0xc779('0x34')+_0x1507a3['id']);}return _0x78f2db[_0xc779('0x24')][_0xc779('0x28')]({'phone':_0x572d3b['phone'],'ContactId':_0x572d3b['id'],'ListId':_0x572d3b['ListId'],'priority':_0x572d3b[_0xc779('0x2a')]?_0x572d3b['priority']:0x2,'scheduledat':_0x572d3b[_0xc779('0x1a')]?_0x572d3b['scheduledat']:moment()[_0xc779('0x2b')](_0xc779('0x1b')),'callback':_0x572d3b[_0xc779('0x2c')]?!![]:![],'callbackuniqueid':_0x572d3b[_0xc779('0x2c')]?_0x572d3b[_0xc779('0x2c')]:undefined,'callbackat':_0x572d3b[_0xc779('0x2c')]?moment()[_0xc779('0x2b')](_0xc779('0x1b')):undefined,'CampaignId':_0x1507a3['id']});})[_0xc779('0x30')](function(_0x4c2361){_0x3dcf56(_0x4c2361);});});});};if(_0x572d3b[_0xc779('0x29')]){_0x78f2db[_0xc779('0x1d')][_0xc779('0x35')]({'where':{'type':'outbound'},'attributes':['id',_0xc779('0x36'),_0xc779('0x1c')],'include':[{'model':_0x78f2db[_0xc779('0x37')],'as':_0xc779('0x38'),'where':{'id':_0x572d3b[_0xc779('0x29')]}}]})[_0xc779('0x1e')](function(_0x7a6fd1){if(_0x7a6fd1){var _0xea720c=[];for(var _0x3b61ce=0x0,_0x1df7a0;_0x3b61ce<_0x7a6fd1[_0xc779('0x39')];_0x3b61ce+=0x1){_0x1df7a0=_0x7a6fd1[_0x3b61ce][_0xc779('0x16')]({'plain':!![]});switch(_0x1df7a0['dialCheckDuplicateType']){case _0xc779('0x3a'):_0x1ea7a0(_0x1df7a0)[_0xc779('0x30')](_0x4532db());break;case _0xc779('0x3b'):_0x532625(_0x1df7a0)[_0xc779('0x30')](_0x4532db());break;default:_0x5a7c69(_0x1df7a0,_0x572d3b)[_0xc779('0x1e')](function(_0x57add6){_0x572d3b['scheduledat']=_0x57add6[_0xc779('0x23')];_0x78f2db[_0xc779('0x24')][_0xc779('0x28')]({'phone':_0x572d3b[_0xc779('0xc')],'ContactId':_0x572d3b['id'],'ListId':_0x572d3b[_0xc779('0x29')],'scheduledat':_0x572d3b[_0xc779('0x1a')]?_0x572d3b[_0xc779('0x1a')]:moment()[_0xc779('0x2b')](_0xc779('0x1b')),'priority':_0x572d3b[_0xc779('0x2a')]?_0x572d3b[_0xc779('0x2a')]:0x2,'callback':_0x572d3b[_0xc779('0x2c')]?!![]:![],'callbackuniqueid':_0x572d3b[_0xc779('0x2c')]?_0x572d3b['callbackUniqueid']:undefined,'callbackat':_0x572d3b[_0xc779('0x2c')]?moment()[_0xc779('0x2b')](_0xc779('0x1b')):undefined,'VoiceQueueId':_0x1df7a0['id']})[_0xc779('0x30')](_0x4532db());});}}}})['then'](function(){return _0x78f2db[_0xc779('0x1d')][_0xc779('0x35')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x78f2db[_0xc779('0x37')],'as':_0xc779('0x3c'),'where':{'id':_0x572d3b[_0xc779('0x29')]}}]})[_0xc779('0x1e')](function(_0x27f60e){if(_0x27f60e){var _0x218e8f=[];for(var _0x32e2d8=0x0,_0x41a36f;_0x32e2d8<_0x27f60e['length'];_0x32e2d8+=0x1){_0x41a36f=_0x27f60e[_0x32e2d8][_0xc779('0x16')]({'plain':!![]});_0x78f2db[_0xc779('0x3d')][_0xc779('0x28')]({'phone':_0x572d3b[_0xc779('0xc')],'ContactId':_0x572d3b['id'],'ListId':_0x572d3b[_0xc779('0x29')],'VoiceQueueId':_0x41a36f['id']})[_0xc779('0x30')](function(_0x2d78f4){logger[_0xc779('0x17')](_0xc779('0x3e'),_0xc779('0x19'),_0x2d78f4['message']);});}}});})[_0xc779('0x1e')](function(){return _0x78f2db[_0xc779('0x32')][_0xc779('0x35')]({'attributes':['id','dialCheckDuplicateType',_0xc779('0x1c')],'include':[{'model':_0x78f2db[_0xc779('0x37')],'as':_0xc779('0x38'),'where':{'id':_0x572d3b['ListId']}}]})['then'](function(_0x53e5b7){if(_0x53e5b7){var _0x3b0846=[];for(var _0x24acb0=0x0,_0x377568;_0x24acb0<_0x53e5b7[_0xc779('0x39')];_0x24acb0+=0x1){_0x377568=_0x53e5b7[_0x24acb0]['get']({'plain':!![]});switch(_0x377568[_0xc779('0x36')]){case _0xc779('0x3a'):_0x405e3a(_0x377568)[_0xc779('0x30')](_0x4b61f1());break;case _0xc779('0x3b'):_0x116f16(_0x377568)[_0xc779('0x30')](_0x4b61f1());break;default:_0x78f2db[_0xc779('0x24')][_0xc779('0x28')]({'phone':_0x572d3b['phone'],'ContactId':_0x572d3b['id'],'ListId':_0x572d3b[_0xc779('0x29')],'scheduledat':_0x572d3b[_0xc779('0x1a')]?_0x572d3b[_0xc779('0x1a')]:moment()[_0xc779('0x2b')](_0xc779('0x1b')),'priority':_0x572d3b[_0xc779('0x2a')]?_0x572d3b[_0xc779('0x2a')]:0x2,'callback':_0x572d3b[_0xc779('0x2c')]?!![]:![],'callbackuniqueid':_0x572d3b['callbackUniqueid']?_0x572d3b[_0xc779('0x2c')]:undefined,'callbackat':_0x572d3b['callbackUniqueid']?moment()['format'](_0xc779('0x1b')):undefined,'CampaignId':_0x377568['id']})[_0xc779('0x30')](_0x4b61f1());}}}});})[_0xc779('0x1e')](function(){return _0x78f2db[_0xc779('0x32')]['findAll']({'attributes':['id'],'include':[{'model':_0x78f2db['CmList'],'as':'BlackLists','where':{'id':_0x572d3b[_0xc779('0x29')]}}]})[_0xc779('0x1e')](function(_0x4234f8){if(_0x4234f8){var _0x44c05f=[];for(var _0x171ed6=0x0,_0x23b2b7;_0x171ed6<_0x4234f8[_0xc779('0x39')];_0x171ed6+=0x1){_0x23b2b7=_0x4234f8[_0x171ed6]['get']({'plain':!![]});_0x78f2db['CmHopperBlack'][_0xc779('0x28')]({'phone':_0x572d3b[_0xc779('0xc')],'ContactId':_0x572d3b['id'],'ListId':_0x572d3b[_0xc779('0x29')],'CampaignId':_0x23b2b7['id']})['catch'](function(_0x3212e5){logger[_0xc779('0x17')]('cmContact,\x20%s,\x20%s',_0xc779('0x19'),_0x3212e5[_0xc779('0x3f')]);});}}});})['then'](function(){_0x4aba67();})[_0xc779('0x30')](function(_0x406e06){logger['error'](_0xc779('0x3e'),_0xc779('0x19'),_0x406e06[_0xc779('0x3f')]);_0x4aba67(_0x406e06);});}else{_0x4aba67(new Error(_0xc779('0x40')));}},'afterDestroy':function(_0x3ca772,_0x2674e0,_0xb6e334){var _0x3fd252=_0x3ac34f['models'];var _0x10982e=_0x3ca772[_0xc779('0x16')]({'plain':!![]});return _0x3fd252[_0xc779('0x24')][_0xc779('0x35')]({'raw':!![],'where':{'ListId':_0x10982e[_0xc779('0x29')],'ContactId':_0x10982e['id']}})[_0xc779('0x1e')](function(_0x4a6cf2){if(!_[_0xc779('0x41')](_0x4a6cf2)){var _0x3b51b3=[];for(var _0x28954a=0x0;_0x28954a<_0x4a6cf2['length'];_0x28954a+=0x1){var _0x2c7bca=_0x3fd252[_0xc779('0x24')][_0xc779('0x42')]({'where':{'ListId':_0x4a6cf2[_0x28954a][_0xc779('0x29')],'ContactId':_0x4a6cf2[_0x28954a]['ContactId'],'VoiceQueueId':_0x4a6cf2[_0x28954a][_0xc779('0x43')],'CampaignId':_0x4a6cf2[_0x28954a][_0xc779('0x44')]}});_0x3b51b3[_0xc779('0x45')](_0x2c7bca);}return BPromise['all'](_0x3b51b3);}})[_0xc779('0x1e')](function(_0x3d552b){logger['info'](_0xc779('0x46'),util[_0xc779('0x31')](_0x3d552b,{'showHidden':![],'depth':null}));_0xb6e334();})[_0xc779('0x30')](function(_0x3eee7a){logger[_0xc779('0x17')](_0xc779('0x47'),util['inspect'](_0x3eee7a,{'showHidden':![],'depth':null}));_0xb6e334(_0x3eee7a);});}}});};
\ No newline at end of file
index 62e8d94..4937f55 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a<Object[_0x0a9e('0x2d')](_0x2cc7a0[_0x0a9e('0x2c')])[_0x0a9e('0x2e')];_0x24936a++){var _0x4f41ae=Object[_0x0a9e('0x2d')](_0x2cc7a0[_0x0a9e('0x2c')])[_0x24936a];if(_0x4f41ae[_0x0a9e('0x2f')]('cf_')){_0x5640eb=squel[_0x0a9e('0x30')]()[_0x0a9e('0x31')](_0x0a9e('0x32'))['set'](_0x4f41ae,_0x2cc7a0['body'][_0x4f41ae])[_0x0a9e('0x1d')](_0x0a9e('0x33'),_0x1e8694['id'])['toString']();break;}}if(!_0x5640eb)return _0x1e8694;return db[_0x0a9e('0x34')][_0x0a9e('0x35')](_0x5640eb)[_0x0a9e('0x23')](function(){return _0x1e8694;});})[_0x0a9e('0x23')](function(_0x4b38d9){logger['info'](_0x0a9e('0x36'),_0x2cc7a0);logger[_0x0a9e('0x12')]('CreateCmContact',_0x2cc7a0,JSON[_0x0a9e('0x24')](_0x4b38d9));_0x2b7e7f(_0x4b38d9);})[_0x0a9e('0x18')](function(_0x1459bb){logger['error'](_0x0a9e('0x36'),_0x1459bb[_0x0a9e('0x16')],_0x2cc7a0);_0x3f3d41(_0x14b13f[_0x0a9e('0x14')](0x1f4,_0x1459bb[_0x0a9e('0x16')]));});});};
\ No newline at end of file
+var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a<Object[_0x0a9e('0x2d')](_0x2cc7a0[_0x0a9e('0x2c')])[_0x0a9e('0x2e')];_0x24936a++){var _0x4f41ae=Object[_0x0a9e('0x2d')](_0x2cc7a0[_0x0a9e('0x2c')])[_0x24936a];if(_0x4f41ae[_0x0a9e('0x2f')]('cf_')){_0x5640eb=squel[_0x0a9e('0x30')]()[_0x0a9e('0x31')](_0x0a9e('0x32'))['set'](_0x4f41ae,_0x2cc7a0['body'][_0x4f41ae])[_0x0a9e('0x1d')](_0x0a9e('0x33'),_0x1e8694['id'])['toString']();break;}}if(!_0x5640eb)return _0x1e8694;return db[_0x0a9e('0x34')][_0x0a9e('0x35')](_0x5640eb)[_0x0a9e('0x23')](function(){return _0x1e8694;});})[_0x0a9e('0x23')](function(_0x4b38d9){logger['info'](_0x0a9e('0x36'),_0x2cc7a0);logger[_0x0a9e('0x12')]('CreateCmContact',_0x2cc7a0,JSON[_0x0a9e('0x24')](_0x4b38d9));_0x2b7e7f(_0x4b38d9);})[_0x0a9e('0x18')](function(_0x1459bb){logger['error'](_0x0a9e('0x36'),_0x1459bb[_0x0a9e('0x16')],_0x2cc7a0);_0x3f3d41(_0x14b13f[_0x0a9e('0x14')](0x1f4,_0x1459bb[_0x0a9e('0x16')]));});});};
\ No newline at end of file
index 61bd731..51f3e7d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['register','length','cmContact:','./cmContact.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var CmContactEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){CmContactEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);CmContactEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
+var _0xa9e0=['register','length','cmContact:','./cmContact.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var CmContactEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){CmContactEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);CmContactEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
index 81e0b45..5566063 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0xc62492,_0x31a9fe){var _0x29db3c=function(_0x2b34c6){while(--_0x2b34c6){_0xc62492['push'](_0xc62492['shift']());}};_0x29db3c(++_0x31a9fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router;
\ No newline at end of file
+var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x3f6d47,_0x3ec284){var _0x5c7ae7=function(_0x52ca55){while(--_0x52ca55){_0x3f6d47['push'](_0x3f6d47['shift']());}};_0x5c7ae7(++_0x3ec284);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router;
\ No newline at end of file
index c272587..44be1a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe13a=['exports','INTEGER','STRING','PHONE'];(function(_0x132d12,_0x2c9799){var _0x1c3163=function(_0x7d9136){while(--_0x7d9136){_0x132d12['push'](_0x132d12['shift']());}};_0x1c3163(++_0x2c9799);}(_0xe13a,0x178));var _0xae13=function(_0x5a6798,_0x353f4e){_0x5a6798=_0x5a6798-0x0;var _0x3f00e9=_0xe13a[_0x5a6798];return _0x3f00e9;};'use strict';var Sequelize=require('sequelize');module[_0xae13('0x0')]={'CmContactId':{'type':Sequelize[_0xae13('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xae13('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xae13('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xae13('0x3')},'OrderBy':{'type':Sequelize[_0xae13('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xae13('0x2')],'defaultValue':null}};
\ No newline at end of file
+var _0x5620=['INTEGER','STRING','sequelize'];(function(_0x9f05d9,_0x2ff1ca){var _0x5028a1=function(_0x1d8a44){while(--_0x1d8a44){_0x9f05d9['push'](_0x9f05d9['shift']());}};_0x5028a1(++_0x2ff1ca);}(_0x5620,0xbf));var _0x0562=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x5620[_0x37a7c6];return _0x539905;};'use strict';var Sequelize=require(_0x0562('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x0562('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x0562('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x0562('0x1')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}};
\ No newline at end of file
index 3b0ed3b..7a6bf01 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4c68=['reject','update','then','get','CmContactHasItems','UserProfileResource','destroy','error','name','send','map','CmContactHasItem','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply'];(function(_0x509f14,_0x581365){var _0x863331=function(_0x14290f){while(--_0x14290f){_0x509f14['push'](_0x509f14['shift']());}};_0x863331(++_0x581365);}(_0x4c68,0x188));var _0x84c6=function(_0x272ea6,_0x3f0673){_0x272ea6=_0x272ea6-0x0;var _0x43ef03=_0x4c68[_0x272ea6];return _0x43ef03;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x84c6('0x0'));var zipdir=require(_0x84c6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x84c6('0x2'));var moment=require(_0x84c6('0x3'));var BPromise=require(_0x84c6('0x4'));var Mustache=require(_0x84c6('0x5'));var util=require(_0x84c6('0x6'));var path=require(_0x84c6('0x7'));var sox=require(_0x84c6('0x8'));var csv=require(_0x84c6('0x9'));var ejs=require(_0x84c6('0xa'));var fs=require('fs');var fs_extra=require(_0x84c6('0xb'));var _=require(_0x84c6('0xc'));var squel=require(_0x84c6('0xd'));var crypto=require(_0x84c6('0xe'));var jsforce=require(_0x84c6('0xf'));var deskjs=require(_0x84c6('0x10'));var toCsv=require(_0x84c6('0x9'));var querystring=require(_0x84c6('0x11'));var Papa=require(_0x84c6('0x12'));var Redis=require(_0x84c6('0x13'));var authService=require(_0x84c6('0x14'));var qs=require(_0x84c6('0x15'));var as=require(_0x84c6('0x16'));var hardwareService=require(_0x84c6('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x84c6('0x18'));var config=require(_0x84c6('0x19'));var licenseUtil=require(_0x84c6('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23b158,_0x445c56){_0x445c56=_0x445c56||0xcc;return function(_0x15e61a){if(_0x15e61a){return _0x23b158[_0x84c6('0x1b')](_0x445c56);}return _0x23b158['status'](_0x445c56)[_0x84c6('0x1c')]();};}function respondWithResult(_0x54b237,_0x4eae35){_0x4eae35=_0x4eae35||0xc8;return function(_0x23b147){if(_0x23b147){return _0x54b237[_0x84c6('0x1d')](_0x4eae35)['json'](_0x23b147);}};}function respondWithFilteredResult(_0x2e0001,_0x4e2e2c){return function(_0x446010){if(_0x446010){var _0x2e0f56=typeof _0x4e2e2c['offset']===_0x84c6('0x1e')&&typeof _0x4e2e2c[_0x84c6('0x1f')]===_0x84c6('0x1e');var _0x164f65=_0x446010[_0x84c6('0x20')];var _0x373913=_0x2e0f56?0x0:_0x4e2e2c[_0x84c6('0x21')];var _0x5446c2=_0x2e0f56?_0x446010[_0x84c6('0x20')]:_0x4e2e2c[_0x84c6('0x21')]+_0x4e2e2c[_0x84c6('0x1f')];var _0xe6ea71;if(_0x5446c2>=_0x164f65){_0x5446c2=_0x164f65;_0xe6ea71=0xc8;}else{_0xe6ea71=0xce;}_0x2e0001[_0x84c6('0x1d')](_0xe6ea71);return _0x2e0001[_0x84c6('0x22')](_0x84c6('0x23'),_0x373913+'-'+_0x5446c2+'/'+_0x164f65)[_0x84c6('0x24')](_0x446010);}return null;};}function patchUpdates(_0x468cd4){return function(_0x1697cb){try{jsonpatch[_0x84c6('0x25')](_0x1697cb,_0x468cd4,!![]);}catch(_0xc48b5c){return BPromise[_0x84c6('0x26')](_0xc48b5c);}return _0x1697cb['save']();};}function saveUpdates(_0x205538,_0x160d3f){return function(_0x188456){if(_0x188456){return _0x188456[_0x84c6('0x27')](_0x205538)[_0x84c6('0x28')](function(_0x313b57){return _0x313b57;});}return null;};}function removeEntity(_0x47040f,_0x1d5938){return function(_0x563b67){if(_0x563b67){return _0x563b67['destroy']()[_0x84c6('0x28')](function(){var _0x111570=_0x563b67[_0x84c6('0x29')]({'plain':!![]});var _0x4e16f5=_0x84c6('0x2a');return db[_0x84c6('0x2b')][_0x84c6('0x2c')]({'where':{'type':_0x4e16f5,'resourceId':_0x111570['id']}})['then'](function(){return _0x563b67;});})['then'](function(){_0x47040f[_0x84c6('0x1d')](0xcc)[_0x84c6('0x1c')]();});}};}function handleEntityNotFound(_0x8ba19f,_0x36bade){return function(_0x3b472e){if(!_0x3b472e){_0x8ba19f[_0x84c6('0x1b')](0x194);}return _0x3b472e;};}function handleError(_0x3632b7,_0xe4f74c){_0xe4f74c=_0xe4f74c||0x1f4;return function(_0x2d531c){logger[_0x84c6('0x2d')](_0x2d531c['stack']);if(_0x2d531c[_0x84c6('0x2e')]){delete _0x2d531c[_0x84c6('0x2e')];}_0x3632b7['status'](_0xe4f74c)[_0x84c6('0x2f')](_0x2d531c);};}exports['index']=function(_0x4c4e1d,_0x4fa62c){var _0x2c580d={},_0xeae566={},_0x2fce89={'count':0x0,'rows':[]};var _0x4d3a2d=_[_0x84c6('0x30')](db[_0x84c6('0x31')][_0x84c6('0x32')],function(_0x9d9529){return{'name':_0x9d9529[_0x84c6('0x33')],'type':_0x9d9529['type'][_0x84c6('0x34')]};});_0xeae566['model']=_[_0x84c6('0x30')](_0x4d3a2d,_0x84c6('0x2e'));_0xeae566[_0x84c6('0x35')]=_[_0x84c6('0x36')](_0x4c4e1d[_0x84c6('0x35')]);_0xeae566[_0x84c6('0x37')]=_[_0x84c6('0x38')](_0xeae566[_0x84c6('0x39')],_0xeae566['query']);_0x2c580d['attributes']=_['intersection'](_0xeae566['model'],qs['fields'](_0x4c4e1d['query'][_0x84c6('0x3a')]));_0x2c580d[_0x84c6('0x3b')]=_0x2c580d[_0x84c6('0x3b')][_0x84c6('0x3c')]?_0x2c580d[_0x84c6('0x3b')]:_0xeae566['model'];if(!_0x4c4e1d['query']['hasOwnProperty'](_0x84c6('0x3d'))){_0x2c580d[_0x84c6('0x1f')]=qs[_0x84c6('0x1f')](_0x4c4e1d[_0x84c6('0x35')]['limit']);_0x2c580d[_0x84c6('0x21')]=qs[_0x84c6('0x21')](_0x4c4e1d['query']['offset']);}_0x2c580d[_0x84c6('0x3e')]=qs[_0x84c6('0x3f')](_0x4c4e1d['query'][_0x84c6('0x3f')]);_0x2c580d['where']=qs[_0x84c6('0x37')](_[_0x84c6('0x40')](_0x4c4e1d[_0x84c6('0x35')],_0xeae566[_0x84c6('0x37')]),_0x4d3a2d);if(_0x4c4e1d[_0x84c6('0x35')]['filter']){_0x2c580d[_0x84c6('0x41')]=_[_0x84c6('0x42')](_0x2c580d[_0x84c6('0x41')],{'$or':_[_0x84c6('0x30')](_0x4d3a2d,function(_0x434bbf){if(_0x434bbf[_0x84c6('0x43')]!==_0x84c6('0x44')){var _0x1da8a3={};_0x1da8a3[_0x434bbf['name']]={'$like':'%'+_0x4c4e1d['query'][_0x84c6('0x45')]+'%'};return _0x1da8a3;}})});}_0x2c580d=_['merge']({},_0x2c580d,_0x4c4e1d['options']);var _0xac0806={'where':_0x2c580d['where']};return db[_0x84c6('0x31')][_0x84c6('0x20')](_0xac0806)[_0x84c6('0x28')](function(_0x3a706b){_0x2fce89['count']=_0x3a706b;if(_0x4c4e1d['query'][_0x84c6('0x46')]){_0x2c580d[_0x84c6('0x47')]=[{'all':!![]}];}return db[_0x84c6('0x31')][_0x84c6('0x48')](_0x2c580d);})[_0x84c6('0x28')](function(_0x5861af){_0x2fce89[_0x84c6('0x49')]=_0x5861af;return _0x2fce89;})[_0x84c6('0x28')](respondWithFilteredResult(_0x4fa62c,_0x2c580d))[_0x84c6('0x4a')](handleError(_0x4fa62c,null));};exports[_0x84c6('0x4b')]=function(_0x6961fb,_0x32e51e){var _0xe31125={'raw':!![],'where':{'id':_0x6961fb[_0x84c6('0x4c')]['id']}},_0x3765eb={};_0x3765eb[_0x84c6('0x39')]=_[_0x84c6('0x36')](db[_0x84c6('0x31')][_0x84c6('0x32')]);_0x3765eb[_0x84c6('0x35')]=_[_0x84c6('0x36')](_0x6961fb['query']);_0x3765eb['filters']=_[_0x84c6('0x38')](_0x3765eb[_0x84c6('0x39')],_0x3765eb['query']);_0xe31125[_0x84c6('0x3b')]=_['intersection'](_0x3765eb[_0x84c6('0x39')],qs[_0x84c6('0x3a')](_0x6961fb[_0x84c6('0x35')]['fields']));_0xe31125['attributes']=_0xe31125[_0x84c6('0x3b')][_0x84c6('0x3c')]?_0xe31125['attributes']:_0x3765eb[_0x84c6('0x39')];if(_0x6961fb[_0x84c6('0x35')][_0x84c6('0x46')]){_0xe31125[_0x84c6('0x47')]=[{'all':!![]}];}_0xe31125=_[_0x84c6('0x42')]({},_0xe31125,_0x6961fb['options']);return db[_0x84c6('0x31')][_0x84c6('0x4d')](_0xe31125)[_0x84c6('0x28')](handleEntityNotFound(_0x32e51e,null))[_0x84c6('0x28')](respondWithResult(_0x32e51e,null))['catch'](handleError(_0x32e51e,null));};exports['create']=function(_0x54181f,_0x12f375){return db['CmContactHasItem'][_0x84c6('0x4e')](_0x54181f[_0x84c6('0x4f')],{})[_0x84c6('0x28')](function(_0x3148fc){var _0x21332c=_0x54181f[_0x84c6('0x50')][_0x84c6('0x29')]({'plain':!![]});if(!_0x21332c)throw new Error(_0x84c6('0x51'));if(_0x21332c[_0x84c6('0x52')]===_0x84c6('0x50')){var _0x3e22ae=_0x3148fc[_0x84c6('0x29')]({'plain':!![]});var _0x5254f9='CmContactHasItems';return db[_0x84c6('0x53')][_0x84c6('0x4d')]({'where':{'name':_0x5254f9,'userProfileId':_0x21332c[_0x84c6('0x54')]},'raw':!![]})[_0x84c6('0x28')](function(_0x1d8a69){if(_0x1d8a69&&_0x1d8a69['autoAssociation']===0x0){return db[_0x84c6('0x2b')][_0x84c6('0x4e')]({'name':_0x3e22ae[_0x84c6('0x2e')],'resourceId':_0x3e22ae['id'],'type':_0x1d8a69[_0x84c6('0x2e')],'sectionId':_0x1d8a69['id']},{})[_0x84c6('0x28')](function(){return _0x3148fc;});}else{return _0x3148fc;}})['catch'](function(_0x5baebf){logger[_0x84c6('0x2d')](_0x84c6('0x55'),_0x5baebf);throw _0x5baebf;});}return _0x3148fc;})[_0x84c6('0x28')](respondWithResult(_0x12f375,0xc9))[_0x84c6('0x4a')](handleError(_0x12f375,null));};exports[_0x84c6('0x27')]=function(_0x56cec3,_0x3f6004){if(_0x56cec3[_0x84c6('0x4f')]['id']){delete _0x56cec3['body']['id'];}return db[_0x84c6('0x31')]['find']({'where':{'id':_0x56cec3[_0x84c6('0x4c')]['id']}})[_0x84c6('0x28')](handleEntityNotFound(_0x3f6004,null))[_0x84c6('0x28')](saveUpdates(_0x56cec3[_0x84c6('0x4f')],null))[_0x84c6('0x28')](respondWithResult(_0x3f6004,null))[_0x84c6('0x4a')](handleError(_0x3f6004,null));};exports[_0x84c6('0x2c')]=function(_0x126b4a,_0xacbcdf){return db[_0x84c6('0x31')]['find']({'where':{'id':_0x126b4a[_0x84c6('0x4c')]['id']}})['then'](handleEntityNotFound(_0xacbcdf,null))[_0x84c6('0x28')](removeEntity(_0xacbcdf,null))[_0x84c6('0x4a')](handleError(_0xacbcdf,null));};
\ No newline at end of file
+var _0x07ac=['query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model'];(function(_0x4094ed,_0x2fba4d){var _0x2a6e7b=function(_0x27de28){while(--_0x27de28){_0x4094ed['push'](_0x4094ed['shift']());}};_0x2a6e7b(++_0x2fba4d);}(_0x07ac,0x6a));var _0xc07a=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x07ac[_0x341e0f];return _0x59555a;};'use strict';var emlformat=require(_0xc07a('0x0'));var rimraf=require(_0xc07a('0x1'));var zipdir=require(_0xc07a('0x2'));var jsonpatch=require(_0xc07a('0x3'));var rp=require(_0xc07a('0x4'));var moment=require(_0xc07a('0x5'));var BPromise=require(_0xc07a('0x6'));var Mustache=require(_0xc07a('0x7'));var util=require(_0xc07a('0x8'));var path=require(_0xc07a('0x9'));var sox=require('sox');var csv=require(_0xc07a('0xa'));var ejs=require(_0xc07a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc07a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc07a('0xd'));var toCsv=require(_0xc07a('0xa'));var querystring=require(_0xc07a('0xe'));var Papa=require('papaparse');var Redis=require(_0xc07a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc07a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc07a('0x11'))(_0xc07a('0x12'));var utils=require('../../config/utils');var config=require(_0xc07a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc07a('0x14'))['db'];function respondWithStatusCode(_0x2ad2a8,_0x3146b4){_0x3146b4=_0x3146b4||0xcc;return function(_0x266a81){if(_0x266a81){return _0x2ad2a8[_0xc07a('0x15')](_0x3146b4);}return _0x2ad2a8[_0xc07a('0x16')](_0x3146b4)[_0xc07a('0x17')]();};}function respondWithResult(_0x2d0740,_0x517c47){_0x517c47=_0x517c47||0xc8;return function(_0x543be0){if(_0x543be0){return _0x2d0740['status'](_0x517c47)[_0xc07a('0x18')](_0x543be0);}};}function respondWithFilteredResult(_0x99b8e5,_0x306ded){return function(_0x3f2925){if(_0x3f2925){var _0x55ae2b=typeof _0x306ded[_0xc07a('0x19')]===_0xc07a('0x1a')&&typeof _0x306ded[_0xc07a('0x1b')]===_0xc07a('0x1a');var _0x594a2f=_0x3f2925[_0xc07a('0x1c')];var _0x5a3c10=_0x55ae2b?0x0:_0x306ded[_0xc07a('0x19')];var _0x4fbc01=_0x55ae2b?_0x3f2925[_0xc07a('0x1c')]:_0x306ded[_0xc07a('0x19')]+_0x306ded[_0xc07a('0x1b')];var _0x3c344d;if(_0x4fbc01>=_0x594a2f){_0x4fbc01=_0x594a2f;_0x3c344d=0xc8;}else{_0x3c344d=0xce;}_0x99b8e5[_0xc07a('0x16')](_0x3c344d);return _0x99b8e5[_0xc07a('0x1d')](_0xc07a('0x1e'),_0x5a3c10+'-'+_0x4fbc01+'/'+_0x594a2f)[_0xc07a('0x18')](_0x3f2925);}return null;};}function patchUpdates(_0x2c8db4){return function(_0x343ce4){try{jsonpatch['apply'](_0x343ce4,_0x2c8db4,!![]);}catch(_0x2aebbd){return BPromise[_0xc07a('0x1f')](_0x2aebbd);}return _0x343ce4[_0xc07a('0x20')]();};}function saveUpdates(_0x4518a7,_0x14de78){return function(_0xe1e77d){if(_0xe1e77d){return _0xe1e77d['update'](_0x4518a7)[_0xc07a('0x21')](function(_0x5b81d5){return _0x5b81d5;});}return null;};}function removeEntity(_0x152ecd,_0xe7c28a){return function(_0x1078b1){if(_0x1078b1){return _0x1078b1[_0xc07a('0x22')]()[_0xc07a('0x21')](function(){var _0xa2394c=_0x1078b1[_0xc07a('0x23')]({'plain':!![]});var _0x302898=_0xc07a('0x24');return db[_0xc07a('0x25')][_0xc07a('0x22')]({'where':{'type':_0x302898,'resourceId':_0xa2394c['id']}})[_0xc07a('0x21')](function(){return _0x1078b1;});})[_0xc07a('0x21')](function(){_0x152ecd['status'](0xcc)[_0xc07a('0x17')]();});}};}function handleEntityNotFound(_0x31d9ad,_0x2da62b){return function(_0xfc33ca){if(!_0xfc33ca){_0x31d9ad[_0xc07a('0x15')](0x194);}return _0xfc33ca;};}function handleError(_0x9a3ea6,_0x2a4f68){_0x2a4f68=_0x2a4f68||0x1f4;return function(_0x5e92ce){logger[_0xc07a('0x26')](_0x5e92ce[_0xc07a('0x27')]);if(_0x5e92ce[_0xc07a('0x28')]){delete _0x5e92ce['name'];}_0x9a3ea6[_0xc07a('0x16')](_0x2a4f68)[_0xc07a('0x29')](_0x5e92ce);};}exports[_0xc07a('0x2a')]=function(_0x49dfbe,_0x5896e1){var _0x5c3209={},_0x30d8d6={},_0x2a1530={'count':0x0,'rows':[]};var _0x1aee98=_[_0xc07a('0x2b')](db[_0xc07a('0x2c')][_0xc07a('0x2d')],function(_0x3859e5){return{'name':_0x3859e5[_0xc07a('0x2e')],'type':_0x3859e5[_0xc07a('0x2f')][_0xc07a('0x30')]};});_0x30d8d6[_0xc07a('0x31')]=_[_0xc07a('0x2b')](_0x1aee98,'name');_0x30d8d6[_0xc07a('0x32')]=_[_0xc07a('0x33')](_0x49dfbe[_0xc07a('0x32')]);_0x30d8d6[_0xc07a('0x34')]=_[_0xc07a('0x35')](_0x30d8d6[_0xc07a('0x31')],_0x30d8d6[_0xc07a('0x32')]);_0x5c3209[_0xc07a('0x36')]=_['intersection'](_0x30d8d6[_0xc07a('0x31')],qs[_0xc07a('0x37')](_0x49dfbe['query'][_0xc07a('0x37')]));_0x5c3209[_0xc07a('0x36')]=_0x5c3209[_0xc07a('0x36')][_0xc07a('0x38')]?_0x5c3209['attributes']:_0x30d8d6[_0xc07a('0x31')];if(!_0x49dfbe['query']['hasOwnProperty'](_0xc07a('0x39'))){_0x5c3209[_0xc07a('0x1b')]=qs['limit'](_0x49dfbe[_0xc07a('0x32')]['limit']);_0x5c3209[_0xc07a('0x19')]=qs['offset'](_0x49dfbe['query'][_0xc07a('0x19')]);}_0x5c3209['order']=qs[_0xc07a('0x3a')](_0x49dfbe[_0xc07a('0x32')][_0xc07a('0x3a')]);_0x5c3209[_0xc07a('0x3b')]=qs[_0xc07a('0x34')](_[_0xc07a('0x3c')](_0x49dfbe[_0xc07a('0x32')],_0x30d8d6[_0xc07a('0x34')]),_0x1aee98);if(_0x49dfbe[_0xc07a('0x32')]['filter']){_0x5c3209['where']=_[_0xc07a('0x3d')](_0x5c3209[_0xc07a('0x3b')],{'$or':_[_0xc07a('0x2b')](_0x1aee98,function(_0x569457){if(_0x569457[_0xc07a('0x2f')]!=='VIRTUAL'){var _0x21bd63={};_0x21bd63[_0x569457[_0xc07a('0x28')]]={'$like':'%'+_0x49dfbe['query'][_0xc07a('0x3e')]+'%'};return _0x21bd63;}})});}_0x5c3209=_[_0xc07a('0x3d')]({},_0x5c3209,_0x49dfbe[_0xc07a('0x3f')]);var _0x341ff7={'where':_0x5c3209['where']};return db[_0xc07a('0x2c')]['count'](_0x341ff7)[_0xc07a('0x21')](function(_0x43ea34){_0x2a1530[_0xc07a('0x1c')]=_0x43ea34;if(_0x49dfbe[_0xc07a('0x32')][_0xc07a('0x40')]){_0x5c3209[_0xc07a('0x41')]=[{'all':!![]}];}return db[_0xc07a('0x2c')][_0xc07a('0x42')](_0x5c3209);})[_0xc07a('0x21')](function(_0x274429){_0x2a1530[_0xc07a('0x43')]=_0x274429;return _0x2a1530;})[_0xc07a('0x21')](respondWithFilteredResult(_0x5896e1,_0x5c3209))[_0xc07a('0x44')](handleError(_0x5896e1,null));};exports['show']=function(_0x4961a3,_0x5bc7d6){var _0x32d4df={'raw':!![],'where':{'id':_0x4961a3['params']['id']}},_0x3db83c={};_0x3db83c[_0xc07a('0x31')]=_['keys'](db[_0xc07a('0x2c')][_0xc07a('0x2d')]);_0x3db83c[_0xc07a('0x32')]=_[_0xc07a('0x33')](_0x4961a3[_0xc07a('0x32')]);_0x3db83c[_0xc07a('0x34')]=_['intersection'](_0x3db83c[_0xc07a('0x31')],_0x3db83c[_0xc07a('0x32')]);_0x32d4df[_0xc07a('0x36')]=_['intersection'](_0x3db83c[_0xc07a('0x31')],qs[_0xc07a('0x37')](_0x4961a3[_0xc07a('0x32')]['fields']));_0x32d4df[_0xc07a('0x36')]=_0x32d4df[_0xc07a('0x36')][_0xc07a('0x38')]?_0x32d4df['attributes']:_0x3db83c[_0xc07a('0x31')];if(_0x4961a3[_0xc07a('0x32')][_0xc07a('0x40')]){_0x32d4df['include']=[{'all':!![]}];}_0x32d4df=_[_0xc07a('0x3d')]({},_0x32d4df,_0x4961a3[_0xc07a('0x3f')]);return db[_0xc07a('0x2c')][_0xc07a('0x45')](_0x32d4df)[_0xc07a('0x21')](handleEntityNotFound(_0x5bc7d6,null))[_0xc07a('0x21')](respondWithResult(_0x5bc7d6,null))[_0xc07a('0x44')](handleError(_0x5bc7d6,null));};exports[_0xc07a('0x46')]=function(_0x129aa9,_0x588425){return db[_0xc07a('0x2c')][_0xc07a('0x46')](_0x129aa9['body'],{})['then'](function(_0xd25dc1){var _0x54364f=_0x129aa9[_0xc07a('0x47')][_0xc07a('0x23')]({'plain':!![]});if(!_0x54364f)throw new Error(_0xc07a('0x48'));if(_0x54364f['role']==='user'){var _0x2a2639=_0xd25dc1[_0xc07a('0x23')]({'plain':!![]});var _0x324f72=_0xc07a('0x24');return db[_0xc07a('0x49')][_0xc07a('0x45')]({'where':{'name':_0x324f72,'userProfileId':_0x54364f['userProfileId']},'raw':!![]})[_0xc07a('0x21')](function(_0xd2353){if(_0xd2353&&_0xd2353[_0xc07a('0x4a')]===0x0){return db[_0xc07a('0x25')][_0xc07a('0x46')]({'name':_0x2a2639['name'],'resourceId':_0x2a2639['id'],'type':_0xd2353[_0xc07a('0x28')],'sectionId':_0xd2353['id']},{})['then'](function(){return _0xd25dc1;});}else{return _0xd25dc1;}})['catch'](function(_0x33c9f1){logger[_0xc07a('0x26')](_0xc07a('0x4b'),_0x33c9f1);throw _0x33c9f1;});}return _0xd25dc1;})[_0xc07a('0x21')](respondWithResult(_0x588425,0xc9))[_0xc07a('0x44')](handleError(_0x588425,null));};exports['update']=function(_0xbc6c6d,_0x3897d2){if(_0xbc6c6d[_0xc07a('0x4c')]['id']){delete _0xbc6c6d[_0xc07a('0x4c')]['id'];}return db['CmContactHasItem'][_0xc07a('0x45')]({'where':{'id':_0xbc6c6d[_0xc07a('0x4d')]['id']}})[_0xc07a('0x21')](handleEntityNotFound(_0x3897d2,null))['then'](saveUpdates(_0xbc6c6d[_0xc07a('0x4c')],null))[_0xc07a('0x21')](respondWithResult(_0x3897d2,null))[_0xc07a('0x44')](handleError(_0x3897d2,null));};exports[_0xc07a('0x22')]=function(_0x197aa7,_0x531080){return db[_0xc07a('0x2c')]['find']({'where':{'id':_0x197aa7['params']['id']}})[_0xc07a('0x21')](handleEntityNotFound(_0x531080,null))[_0xc07a('0x21')](removeEntity(_0x531080,null))['catch'](handleError(_0x531080,null));};
\ No newline at end of file
index 105aa86..c05d259 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xab81=['exports','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x56efeb,_0x262524){var _0x4708eb=function(_0x5eed2d){while(--_0x5eed2d){_0x56efeb['push'](_0x56efeb['shift']());}};_0x4708eb(++_0x262524);}(_0xab81,0x1df));var _0x1ab8=function(_0xd35bc3,_0x5c3519){_0xd35bc3=_0xd35bc3-0x0;var _0x4c1249=_0xab81[_0xd35bc3];return _0x4c1249;};'use strict';var _=require(_0x1ab8('0x0'));var util=require('util');var logger=require(_0x1ab8('0x1'))(_0x1ab8('0x2'));var moment=require(_0x1ab8('0x3'));var BPromise=require(_0x1ab8('0x4'));var rp=require(_0x1ab8('0x5'));var fs=require('fs');var path=require(_0x1ab8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0x1ab8('0x7')]=function(_0x50d7ab,_0x1a65ed){return _0x50d7ab['define']('CmContactHasItem',attributes,{'tableName':_0x1ab8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x744e=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util'];(function(_0x5b0413,_0x3f4093){var _0x2b9b26=function(_0x58669e){while(--_0x58669e){_0x5b0413['push'](_0x5b0413['shift']());}};_0x2b9b26(++_0x3f4093);}(_0x744e,0xce));var _0xe744=function(_0x1b18f5,_0x3771ff){_0x1b18f5=_0x1b18f5-0x0;var _0x406795=_0x744e[_0x1b18f5];return _0x406795;};'use strict';var _=require(_0xe744('0x0'));var util=require(_0xe744('0x1'));var logger=require(_0xe744('0x2'))(_0xe744('0x3'));var moment=require('moment');var BPromise=require(_0xe744('0x4'));var rp=require(_0xe744('0x5'));var fs=require('fs');var path=require(_0xe744('0x6'));var rimraf=require('rimraf');var config=require(_0xe744('0x7'));var attributes=require(_0xe744('0x8'));module[_0xe744('0x9')]=function(_0x37d02d,_0x13a374){return _0x37d02d[_0xe744('0xa')](_0xe744('0xb'),attributes,{'tableName':_0xe744('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index a0e7948..03031df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x361f=['client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x167f01,_0x1775ce){var _0x2361b3=function(_0x3353d5){while(--_0x3353d5){_0x167f01['push'](_0x167f01['shift']());}};_0x2361b3(++_0x1775ce);}(_0x361f,0x13a));var _0xf361=function(_0x250964,_0x3cdcc9){_0x250964=_0x250964-0x0;var _0x5e6f77=_0x361f[_0x250964];return _0x5e6f77;};'use strict';var _=require(_0xf361('0x0'));var util=require(_0xf361('0x1'));var moment=require(_0xf361('0x2'));var BPromise=require('bluebird');var rs=require(_0xf361('0x3'));var fs=require('fs');var Redis=require(_0xf361('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf361('0x5'));var logger=require('../../config/logger')(_0xf361('0x6'));var config=require('../../config/environment');var jayson=require(_0xf361('0x7'));var client=jayson[_0xf361('0x8')][_0xf361('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59e212,_0x479ce0,_0xe52fb4){return new BPromise(function(_0x4e6105,_0xb45256){return client[_0xf361('0xa')](_0x59e212,_0xe52fb4)[_0xf361('0xb')](function(_0x57bc34){logger[_0xf361('0xc')](_0xf361('0xd'),_0x479ce0,_0xf361('0xe'));logger[_0xf361('0xf')](_0xf361('0x10'),_0x479ce0,'request\x20sent',JSON[_0xf361('0x11')](_0x57bc34));if(_0x57bc34['error']){if(_0x57bc34[_0xf361('0x12')][_0xf361('0x13')]===0x1f4){logger[_0xf361('0x12')](_0xf361('0xd'),_0x479ce0,_0x57bc34[_0xf361('0x12')][_0xf361('0x14')]);return _0xb45256(_0x57bc34[_0xf361('0x12')]['message']);}logger[_0xf361('0x12')](_0xf361('0xd'),_0x479ce0,_0x57bc34[_0xf361('0x12')]['message']);return _0x4e6105(_0x57bc34[_0xf361('0x12')][_0xf361('0x14')]);}else{logger[_0xf361('0xc')](_0xf361('0xd'),_0x479ce0,_0xf361('0xe'));_0x4e6105(_0x57bc34[_0xf361('0x15')][_0xf361('0x14')]);}})[_0xf361('0x16')](function(_0xaa42dc){logger['error'](_0xf361('0xd'),_0x479ce0,_0xaa42dc);_0xb45256(_0xaa42dc);});});}
\ No newline at end of file
+var _0x3c4d=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x577eda,_0xd5c5b1){var _0x383cf3=function(_0x13ece6){while(--_0x13ece6){_0x577eda['push'](_0x577eda['shift']());}};_0x383cf3(++_0xd5c5b1);}(_0x3c4d,0xce));var _0xd3c4=function(_0xe65e0b,_0x9a9c9){_0xe65e0b=_0xe65e0b-0x0;var _0x52a84d=_0x3c4d[_0xe65e0b];return _0x52a84d;};'use strict';var _=require(_0xd3c4('0x0'));var util=require(_0xd3c4('0x1'));var moment=require(_0xd3c4('0x2'));var BPromise=require('bluebird');var rs=require(_0xd3c4('0x3'));var fs=require('fs');var Redis=require(_0xd3c4('0x4'));var db=require(_0xd3c4('0x5'))['db'];var utils=require(_0xd3c4('0x6'));var logger=require(_0xd3c4('0x7'))(_0xd3c4('0x8'));var config=require(_0xd3c4('0x9'));var jayson=require(_0xd3c4('0xa'));var client=jayson[_0xd3c4('0xb')][_0xd3c4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32b7a5,_0x3ac719,_0x98c063){return new BPromise(function(_0xe3316c,_0x1df3b0){return client[_0xd3c4('0xd')](_0x32b7a5,_0x98c063)[_0xd3c4('0xe')](function(_0x3b76bb){logger[_0xd3c4('0xf')](_0xd3c4('0x10'),_0x3ac719,_0xd3c4('0x11'));logger[_0xd3c4('0x12')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x3ac719,_0xd3c4('0x11'),JSON[_0xd3c4('0x13')](_0x3b76bb));if(_0x3b76bb[_0xd3c4('0x14')]){if(_0x3b76bb[_0xd3c4('0x14')][_0xd3c4('0x15')]===0x1f4){logger[_0xd3c4('0x14')]('CmContactHasItem,\x20%s,\x20%s',_0x3ac719,_0x3b76bb[_0xd3c4('0x14')][_0xd3c4('0x16')]);return _0x1df3b0(_0x3b76bb['error'][_0xd3c4('0x16')]);}logger['error'](_0xd3c4('0x10'),_0x3ac719,_0x3b76bb[_0xd3c4('0x14')][_0xd3c4('0x16')]);return _0xe3316c(_0x3b76bb['error'][_0xd3c4('0x16')]);}else{logger[_0xd3c4('0xf')](_0xd3c4('0x10'),_0x3ac719,'request\x20sent');_0xe3316c(_0x3b76bb[_0xd3c4('0x17')][_0xd3c4('0x16')]);}})[_0xd3c4('0x18')](function(_0x5938c7){logger[_0xd3c4('0x14')](_0xd3c4('0x10'),_0x3ac719,_0x5938c7);_0x1df3b0(_0x5938c7);});});}
\ No newline at end of file
index 969e591..6752f3c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb74d=['create','delete','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','/:id','show','post'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xb74d,0x16e));var _0xdb74=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xb74d[_0x82129b];return _0x2ae5dc;};'use strict';var multer=require(_0xdb74('0x0'));var util=require('util');var path=require(_0xdb74('0x1'));var timeout=require('connect-timeout');var express=require(_0xdb74('0x2'));var router=express['Router']();var fs_extra=require(_0xdb74('0x3'));var auth=require(_0xdb74('0x4'));var interaction=require(_0xdb74('0x5'));var config=require('../../config/environment');var controller=require(_0xdb74('0x6'));router[_0xdb74('0x7')]('/',auth[_0xdb74('0x8')](),controller['index']);router['get'](_0xdb74('0x9'),auth['isAuthenticated'](),controller[_0xdb74('0xa')]);router[_0xdb74('0xb')]('/',auth['isAuthenticated'](),controller[_0xdb74('0xc')]);router['put'](_0xdb74('0x9'),auth[_0xdb74('0x8')](),controller['update']);router[_0xdb74('0xd')](_0xdb74('0x9'),auth[_0xdb74('0x8')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0xe293=['./cmContactHasItem.controller','get','isAuthenticated','index','show','post','create','put','/:id','destroy','multer','util','connect-timeout','Router','../../components/interaction/service'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xe293,0x172));var _0x3e29=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0xe293[_0x2d61b2];return _0x12df89;};'use strict';var multer=require(_0x3e29('0x0'));var util=require(_0x3e29('0x1'));var path=require('path');var timeout=require(_0x3e29('0x2'));var express=require('express');var router=express[_0x3e29('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3e29('0x4'));var config=require('../../config/environment');var controller=require(_0x3e29('0x5'));router[_0x3e29('0x6')]('/',auth[_0x3e29('0x7')](),controller[_0x3e29('0x8')]);router['get']('/:id',auth[_0x3e29('0x7')](),controller[_0x3e29('0x9')]);router[_0x3e29('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e29('0xb')]);router[_0x3e29('0xc')](_0x3e29('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x3e29('0x7')](),controller[_0x3e29('0xe')]);module['exports']=router;
\ No newline at end of file
index eeca88f..848f433 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa06e=['isArray','stringify','BOOLEAN','ENUM','lodash','exports','VIRTUAL','alias','STRING','setDataValue','name','getDataValue','type','parse','values'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa06e,0x14e));var _0xea06=function(_0x589f71,_0x212326){_0x589f71=_0x589f71-0x0;var _0x5763bd=_0xa06e[_0x589f71];return _0x5763bd;};'use strict';var Sequelize=require('sequelize');var _=require(_0xea06('0x0'));module[_0xea06('0x1')]={'name':{'type':Sequelize[_0xea06('0x2')],'get':function(_0x469b74){return this['getDataValue'](_0xea06('0x3'));}},'alias':{'type':Sequelize[_0xea06('0x4')],'allowNull':![],'set':function(_0x38dc1e){this[_0xea06('0x5')](_0xea06('0x3'),_0x38dc1e?_0x38dc1e:this['getDataValue'](_0xea06('0x6')));}},'type':{'type':Sequelize[_0xea06('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0xea06('0x7')](_0xea06('0x8'))==='select'){return JSON[_0xea06('0x9')](this[_0xea06('0x7')](_0xea06('0xa')));}else{return this[_0xea06('0x7')](_0xea06('0xa'));}},'set':function(_0x186c6){if(Array[_0xea06('0xb')](_0x186c6)){this[_0xea06('0x5')](_0xea06('0xa'),JSON[_0xea06('0xc')](_0x186c6));}else{this[_0xea06('0x5')](_0xea06('0xa'),_0x186c6);}}},'required':{'type':Sequelize[_0xea06('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xea06('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xea06('0xe')]('voice')}};
\ No newline at end of file
+var _0x876a=['sequelize','lodash','VIRTUAL','alias','STRING','setDataValue','getDataValue','name','long','select','parse','values','isArray','BOOLEAN','ENUM','voice'];(function(_0x177d63,_0x2990b3){var _0x17f8e5=function(_0x41492a){while(--_0x41492a){_0x177d63['push'](_0x177d63['shift']());}};_0x17f8e5(++_0x2990b3);}(_0x876a,0x110));var _0xa876=function(_0x540331,_0x3e9f10){_0x540331=_0x540331-0x0;var _0x2b705a=_0x876a[_0x540331];return _0x2b705a;};'use strict';var Sequelize=require(_0xa876('0x0'));var _=require(_0xa876('0x1'));module['exports']={'name':{'type':Sequelize[_0xa876('0x2')],'get':function(_0x1b4fec){return this['getDataValue'](_0xa876('0x3'));}},'alias':{'type':Sequelize[_0xa876('0x4')],'allowNull':![],'set':function(_0x5ad863){this[_0xa876('0x5')]('alias',_0x5ad863?_0x5ad863:this[_0xa876('0x6')](_0xa876('0x7')));}},'type':{'type':Sequelize[_0xa876('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xa876('0x8')),'get':function(){if(this['getDataValue']('type')===_0xa876('0x9')){return JSON[_0xa876('0xa')](this[_0xa876('0x6')]('values'));}else{return this[_0xa876('0x6')](_0xa876('0xb'));}},'set':function(_0x4e1046){if(Array[_0xa876('0xc')](_0x4e1046)){this[_0xa876('0x5')](_0xa876('0xb'),JSON['stringify'](_0x4e1046));}else{this[_0xa876('0x5')](_0xa876('0xb'),_0x4e1046);}}},'required':{'type':Sequelize[_0xa876('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa876('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa876('0xe')](_0xa876('0xf'))}};
\ No newline at end of file
index ae8da8b..729c774 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7601=['api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','show','find','catch','body','params','create','sequelize','transaction','text','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x7601,0x99));var _0x1760=function(_0x3c9d62,_0x34edcd){_0x3c9d62=_0x3c9d62-0x0;var _0x5e9629=_0x7601[_0x3c9d62];return _0x5e9629;};'use strict';var emlformat=require(_0x1760('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1760('0x1'));var jsonpatch=require(_0x1760('0x2'));var rp=require(_0x1760('0x3'));var moment=require('moment');var BPromise=require(_0x1760('0x4'));var Mustache=require('mustache');var util=require(_0x1760('0x5'));var path=require(_0x1760('0x6'));var sox=require(_0x1760('0x7'));var csv=require(_0x1760('0x8'));var ejs=require(_0x1760('0x9'));var fs=require('fs');var fs_extra=require(_0x1760('0xa'));var _=require(_0x1760('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1760('0xc'));var deskjs=require(_0x1760('0xd'));var toCsv=require(_0x1760('0x8'));var querystring=require(_0x1760('0xe'));var Papa=require(_0x1760('0xf'));var Redis=require('ioredis');var authService=require(_0x1760('0x10'));var qs=require(_0x1760('0x11'));var as=require(_0x1760('0x12'));var hardwareService=require(_0x1760('0x13'));var logger=require(_0x1760('0x14'))(_0x1760('0x15'));var utils=require('../../config/utils');var config=require(_0x1760('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1760('0x17'))['db'];function respondWithStatusCode(_0x2dd8fd,_0x127877){_0x127877=_0x127877||0xcc;return function(_0x173cdf){if(_0x173cdf){return _0x2dd8fd[_0x1760('0x18')](_0x127877);}return _0x2dd8fd[_0x1760('0x19')](_0x127877)[_0x1760('0x1a')]();};}function respondWithResult(_0x2469e9,_0x2ed34b){_0x2ed34b=_0x2ed34b||0xc8;return function(_0xd9adcc){if(_0xd9adcc){return _0x2469e9[_0x1760('0x19')](_0x2ed34b)[_0x1760('0x1b')](_0xd9adcc);}};}function respondWithFilteredResult(_0x1d60db,_0x386a40){return function(_0x14c735){if(_0x14c735){var _0x27bbee=typeof _0x386a40['offset']===_0x1760('0x1c')&&typeof _0x386a40[_0x1760('0x1d')]===_0x1760('0x1c');var _0x229128=_0x14c735[_0x1760('0x1e')];var _0x2d9d14=_0x27bbee?0x0:_0x386a40[_0x1760('0x1f')];var _0x29bab0=_0x27bbee?_0x14c735['count']:_0x386a40[_0x1760('0x1f')]+_0x386a40[_0x1760('0x1d')];var _0xe8ebd3;if(_0x29bab0>=_0x229128){_0x29bab0=_0x229128;_0xe8ebd3=0xc8;}else{_0xe8ebd3=0xce;}_0x1d60db['status'](_0xe8ebd3);return _0x1d60db[_0x1760('0x20')](_0x1760('0x21'),_0x2d9d14+'-'+_0x29bab0+'/'+_0x229128)[_0x1760('0x1b')](_0x14c735);}return null;};}function patchUpdates(_0x101044){return function(_0x34039b){try{jsonpatch['apply'](_0x34039b,_0x101044,!![]);}catch(_0x34f957){return BPromise[_0x1760('0x22')](_0x34f957);}return _0x34039b[_0x1760('0x23')]();};}function saveUpdates(_0x2b7bce,_0x44036a){return function(_0x52338f){if(_0x52338f){return _0x52338f[_0x1760('0x24')](_0x2b7bce)[_0x1760('0x25')](function(_0x58da16){return _0x58da16;});}return null;};}function removeEntity(_0x5b52cb,_0x27008a){return function(_0x2ffe26){if(_0x2ffe26){return _0x2ffe26[_0x1760('0x26')]()[_0x1760('0x25')](function(){_0x5b52cb[_0x1760('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb028df,_0x73412d){return function(_0x131072){if(!_0x131072){_0xb028df['sendStatus'](0x194);}return _0x131072;};}function handleError(_0x4f1a76,_0x3c76da){_0x3c76da=_0x3c76da||0x1f4;return function(_0x478a51){logger[_0x1760('0x27')](_0x478a51[_0x1760('0x28')]);if(_0x478a51[_0x1760('0x29')]){delete _0x478a51[_0x1760('0x29')];}_0x4f1a76[_0x1760('0x19')](_0x3c76da)[_0x1760('0x2a')](_0x478a51);};}exports[_0x1760('0x2b')]=function(_0x5a7cbc,_0x394884){var _0x1afb0e={},_0x50a62d={},_0x90018b={'count':0x0,'rows':[]};var _0x3469ba=_[_0x1760('0x2c')](db[_0x1760('0x2d')][_0x1760('0x2e')],function(_0x2e0f7b){return{'name':_0x2e0f7b[_0x1760('0x2f')],'type':_0x2e0f7b[_0x1760('0x30')][_0x1760('0x31')]};});_0x50a62d[_0x1760('0x32')]=_[_0x1760('0x33')](_[_0x1760('0x2c')](_0x3469ba,_0x1760('0x29')),[_0x1760('0x29')]);_0x50a62d[_0x1760('0x34')]=_[_0x1760('0x35')](_0x5a7cbc[_0x1760('0x34')]);_0x50a62d['filters']=_[_0x1760('0x36')](_0x50a62d['model'],_0x50a62d[_0x1760('0x34')]);_0x1afb0e[_0x1760('0x37')]=_['intersection'](_0x50a62d['model'],qs['fields'](_0x5a7cbc[_0x1760('0x34')][_0x1760('0x38')]));_0x1afb0e[_0x1760('0x37')]=_0x1afb0e[_0x1760('0x37')]['length']?_0x1afb0e['attributes']:_0x50a62d[_0x1760('0x32')];if(!_0x5a7cbc[_0x1760('0x34')][_0x1760('0x39')](_0x1760('0x3a'))){_0x1afb0e[_0x1760('0x1d')]=qs[_0x1760('0x1d')](_0x5a7cbc[_0x1760('0x34')][_0x1760('0x1d')]);_0x1afb0e[_0x1760('0x1f')]=qs[_0x1760('0x1f')](_0x5a7cbc['query'][_0x1760('0x1f')]);}_0x1afb0e[_0x1760('0x3b')]=qs[_0x1760('0x3c')](_0x5a7cbc[_0x1760('0x34')]['sort']);_0x1afb0e['where']=qs[_0x1760('0x3d')](_[_0x1760('0x3e')](_0x5a7cbc[_0x1760('0x34')],_0x50a62d['filters']),_0x3469ba);if(_0x5a7cbc[_0x1760('0x34')][_0x1760('0x3f')]){_0x1afb0e[_0x1760('0x40')]=_[_0x1760('0x41')](_0x1afb0e[_0x1760('0x40')],{'$or':_[_0x1760('0x2c')](_0x3469ba,function(_0x4eb906){if(_0x4eb906['type']!==_0x1760('0x42')){var _0x2cf8dc={};_0x2cf8dc[_0x4eb906['name']]={'$like':'%'+_0x5a7cbc[_0x1760('0x34')][_0x1760('0x3f')]+'%'};return _0x2cf8dc;}})});}_0x1afb0e=_[_0x1760('0x41')]({},_0x1afb0e,_0x5a7cbc[_0x1760('0x43')]);var _0x5f540a={'where':_0x1afb0e[_0x1760('0x40')]};return db[_0x1760('0x2d')][_0x1760('0x1e')](_0x5f540a)[_0x1760('0x25')](function(_0x573c51){_0x90018b[_0x1760('0x1e')]=_0x573c51;if(_0x5a7cbc[_0x1760('0x34')][_0x1760('0x44')]){_0x1afb0e[_0x1760('0x45')]=[{'all':!![]}];}return db[_0x1760('0x2d')]['findAll'](_0x1afb0e);})['then'](function(_0x13df6b){_0x90018b['rows']=_0x13df6b;return _0x90018b;})[_0x1760('0x25')](respondWithFilteredResult(_0x394884,_0x1afb0e))['catch'](handleError(_0x394884,null));};exports[_0x1760('0x46')]=function(_0x37c0c2,_0x4854b6){var _0x155b56={'raw':!![],'where':{'id':_0x37c0c2['params']['id']}},_0x2eb57b={};_0x2eb57b[_0x1760('0x32')]=_[_0x1760('0x35')](db[_0x1760('0x2d')][_0x1760('0x2e')]);_0x2eb57b[_0x1760('0x34')]=_[_0x1760('0x35')](_0x37c0c2[_0x1760('0x34')]);_0x2eb57b[_0x1760('0x3d')]=_['intersection'](_0x2eb57b[_0x1760('0x32')],_0x2eb57b[_0x1760('0x34')]);_0x155b56[_0x1760('0x37')]=_[_0x1760('0x36')](_0x2eb57b[_0x1760('0x32')],qs[_0x1760('0x38')](_0x37c0c2[_0x1760('0x34')]['fields']));_0x155b56[_0x1760('0x37')]=_0x155b56[_0x1760('0x37')]['length']?_0x155b56[_0x1760('0x37')]:_0x2eb57b['model'];if(_0x37c0c2[_0x1760('0x34')][_0x1760('0x44')]){_0x155b56[_0x1760('0x45')]=[{'all':!![]}];}_0x155b56=_[_0x1760('0x41')]({},_0x155b56,_0x37c0c2['options']);return db[_0x1760('0x2d')][_0x1760('0x47')](_0x155b56)[_0x1760('0x25')](handleEntityNotFound(_0x4854b6,null))[_0x1760('0x25')](respondWithResult(_0x4854b6,null))[_0x1760('0x48')](handleError(_0x4854b6,null));};exports[_0x1760('0x24')]=function(_0x3c5808,_0x1b4415){if(_0x3c5808[_0x1760('0x49')]['id']){delete _0x3c5808['body']['id'];}return db['CmCustomField'][_0x1760('0x47')]({'where':{'id':_0x3c5808[_0x1760('0x4a')]['id']}})[_0x1760('0x25')](handleEntityNotFound(_0x1b4415,null))[_0x1760('0x25')](saveUpdates(_0x3c5808[_0x1760('0x49')],null))[_0x1760('0x25')](respondWithResult(_0x1b4415,null))['catch'](handleError(_0x1b4415,null));};exports[_0x1760('0x26')]=function(_0x22fc89,_0x5d1ff7){return db[_0x1760('0x2d')][_0x1760('0x47')]({'where':{'id':_0x22fc89['params']['id']}})[_0x1760('0x25')](handleEntityNotFound(_0x5d1ff7,null))[_0x1760('0x25')](removeEntity(_0x5d1ff7,null))[_0x1760('0x48')](handleError(_0x5d1ff7,null));};exports[_0x1760('0x4b')]=function(_0x1d44af,_0x1093be){var _0x5c9e5a;return db[_0x1760('0x4c')][_0x1760('0x4d')](function(_0x4428ac){return db[_0x1760('0x2d')][_0x1760('0x4b')](_0x1d44af[_0x1760('0x49')],{'transaction':_0x4428ac})[_0x1760('0x25')](function(_0x26bd82){_0x5c9e5a=_0x26bd82;var _0x4df4d7={'type':db['Sequelize']['TEXT'],'transaction':_0x4428ac};switch(_0x1d44af[_0x1760('0x49')][_0x1760('0x30')]){case _0x1760('0x4e'):_0x4df4d7['type']=db[_0x1760('0x4f')]['TEXT'];break;case _0x1760('0x50'):_0x4df4d7[_0x1760('0x30')]=db[_0x1760('0x4f')][_0x1760('0x51')];break;case _0x1760('0x52'):_0x4df4d7[_0x1760('0x30')]=db[_0x1760('0x4f')]['BOOLEAN'];_0x4df4d7[_0x1760('0x53')]=![];break;default:}return db[_0x1760('0x4c')][_0x1760('0x54')][_0x1760('0x55')](_0x1760('0x56'),util['format']('cf_%d',_0x5c9e5a['id']),_0x4df4d7);})[_0x1760('0x25')](function(){return _0x5c9e5a;});})[_0x1760('0x25')](respondWithResult(_0x1093be,0xc9))[_0x1760('0x48')](handleError(_0x1093be,null));};
\ No newline at end of file
+var _0x5acf=['defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','differenceBy','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','body','find','create','sequelize','transaction','Sequelize','TEXT','number'];(function(_0x42b908,_0x109652){var _0x4c77fa=function(_0x1ccdcd){while(--_0x1ccdcd){_0x42b908['push'](_0x42b908['shift']());}};_0x4c77fa(++_0x109652);}(_0x5acf,0xab));var _0xf5ac=function(_0x59137b,_0x20880e){_0x59137b=_0x59137b-0x0;var _0x267490=_0x5acf[_0x59137b];return _0x267490;};'use strict';var emlformat=require(_0xf5ac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf5ac('0x1'));var jsonpatch=require(_0xf5ac('0x2'));var rp=require(_0xf5ac('0x3'));var moment=require(_0xf5ac('0x4'));var BPromise=require(_0xf5ac('0x5'));var Mustache=require(_0xf5ac('0x6'));var util=require('util');var path=require(_0xf5ac('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf5ac('0x8'));var fs=require('fs');var fs_extra=require(_0xf5ac('0x9'));var _=require(_0xf5ac('0xa'));var squel=require(_0xf5ac('0xb'));var crypto=require(_0xf5ac('0xc'));var jsforce=require(_0xf5ac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf5ac('0xe'));var querystring=require(_0xf5ac('0xf'));var Papa=require('papaparse');var Redis=require(_0xf5ac('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf5ac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5ac('0x12'))(_0xf5ac('0x13'));var utils=require(_0xf5ac('0x14'));var config=require(_0xf5ac('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26e1c1,_0x272380){_0x272380=_0x272380||0xcc;return function(_0x3bfec5){if(_0x3bfec5){return _0x26e1c1['sendStatus'](_0x272380);}return _0x26e1c1[_0xf5ac('0x16')](_0x272380)[_0xf5ac('0x17')]();};}function respondWithResult(_0x2b9de7,_0x5e4184){_0x5e4184=_0x5e4184||0xc8;return function(_0x23bf96){if(_0x23bf96){return _0x2b9de7[_0xf5ac('0x16')](_0x5e4184)[_0xf5ac('0x18')](_0x23bf96);}};}function respondWithFilteredResult(_0x1cb3ab,_0x4899a4){return function(_0x144517){if(_0x144517){var _0x5560e6=typeof _0x4899a4[_0xf5ac('0x19')]===_0xf5ac('0x1a')&&typeof _0x4899a4[_0xf5ac('0x1b')]==='undefined';var _0x5bc22b=_0x144517[_0xf5ac('0x1c')];var _0x162415=_0x5560e6?0x0:_0x4899a4['offset'];var _0x1b51d3=_0x5560e6?_0x144517[_0xf5ac('0x1c')]:_0x4899a4['offset']+_0x4899a4[_0xf5ac('0x1b')];var _0x457cb7;if(_0x1b51d3>=_0x5bc22b){_0x1b51d3=_0x5bc22b;_0x457cb7=0xc8;}else{_0x457cb7=0xce;}_0x1cb3ab[_0xf5ac('0x16')](_0x457cb7);return _0x1cb3ab[_0xf5ac('0x1d')](_0xf5ac('0x1e'),_0x162415+'-'+_0x1b51d3+'/'+_0x5bc22b)[_0xf5ac('0x18')](_0x144517);}return null;};}function patchUpdates(_0x2571e1){return function(_0x412bce){try{jsonpatch[_0xf5ac('0x1f')](_0x412bce,_0x2571e1,!![]);}catch(_0x2cdd62){return BPromise[_0xf5ac('0x20')](_0x2cdd62);}return _0x412bce[_0xf5ac('0x21')]();};}function saveUpdates(_0x595fae,_0x5e51bc){return function(_0x283af2){if(_0x283af2){return _0x283af2[_0xf5ac('0x22')](_0x595fae)['then'](function(_0x1dc6d0){return _0x1dc6d0;});}return null;};}function removeEntity(_0x5464b0,_0x23d06d){return function(_0x2d4dc3){if(_0x2d4dc3){return _0x2d4dc3[_0xf5ac('0x23')]()[_0xf5ac('0x24')](function(){_0x5464b0[_0xf5ac('0x16')](0xcc)[_0xf5ac('0x17')]();});}};}function handleEntityNotFound(_0x506aae,_0x10a403){return function(_0x14d7a0){if(!_0x14d7a0){_0x506aae[_0xf5ac('0x25')](0x194);}return _0x14d7a0;};}function handleError(_0x815156,_0x6120a5){_0x6120a5=_0x6120a5||0x1f4;return function(_0x40ae27){logger[_0xf5ac('0x26')](_0x40ae27['stack']);if(_0x40ae27[_0xf5ac('0x27')]){delete _0x40ae27[_0xf5ac('0x27')];}_0x815156['status'](_0x6120a5)[_0xf5ac('0x28')](_0x40ae27);};}exports[_0xf5ac('0x29')]=function(_0x33c3cd,_0x1c1be0){var _0x42c72c={},_0x145a45={},_0x17b596={'count':0x0,'rows':[]};var _0x428c5f=_[_0xf5ac('0x2a')](db[_0xf5ac('0x2b')][_0xf5ac('0x2c')],function(_0x5632a7){return{'name':_0x5632a7[_0xf5ac('0x2d')],'type':_0x5632a7['type']['key']};});_0x145a45['model']=_[_0xf5ac('0x2e')](_['map'](_0x428c5f,_0xf5ac('0x27')),[_0xf5ac('0x27')]);_0x145a45[_0xf5ac('0x2f')]=_[_0xf5ac('0x30')](_0x33c3cd[_0xf5ac('0x2f')]);_0x145a45[_0xf5ac('0x31')]=_['intersection'](_0x145a45[_0xf5ac('0x32')],_0x145a45[_0xf5ac('0x2f')]);_0x42c72c[_0xf5ac('0x33')]=_['intersection'](_0x145a45['model'],qs['fields'](_0x33c3cd[_0xf5ac('0x2f')][_0xf5ac('0x34')]));_0x42c72c[_0xf5ac('0x33')]=_0x42c72c[_0xf5ac('0x33')]['length']?_0x42c72c[_0xf5ac('0x33')]:_0x145a45[_0xf5ac('0x32')];if(!_0x33c3cd[_0xf5ac('0x2f')][_0xf5ac('0x35')](_0xf5ac('0x36'))){_0x42c72c['limit']=qs['limit'](_0x33c3cd[_0xf5ac('0x2f')]['limit']);_0x42c72c[_0xf5ac('0x19')]=qs[_0xf5ac('0x19')](_0x33c3cd[_0xf5ac('0x2f')][_0xf5ac('0x19')]);}_0x42c72c[_0xf5ac('0x37')]=qs['sort'](_0x33c3cd[_0xf5ac('0x2f')][_0xf5ac('0x38')]);_0x42c72c[_0xf5ac('0x39')]=qs[_0xf5ac('0x31')](_['pick'](_0x33c3cd[_0xf5ac('0x2f')],_0x145a45[_0xf5ac('0x31')]),_0x428c5f);if(_0x33c3cd[_0xf5ac('0x2f')]['filter']){_0x42c72c[_0xf5ac('0x39')]=_[_0xf5ac('0x3a')](_0x42c72c[_0xf5ac('0x39')],{'$or':_[_0xf5ac('0x2a')](_0x428c5f,function(_0x2a84ae){if(_0x2a84ae[_0xf5ac('0x3b')]!==_0xf5ac('0x3c')){var _0x35f086={};_0x35f086[_0x2a84ae[_0xf5ac('0x27')]]={'$like':'%'+_0x33c3cd[_0xf5ac('0x2f')]['filter']+'%'};return _0x35f086;}})});}_0x42c72c=_['merge']({},_0x42c72c,_0x33c3cd[_0xf5ac('0x3d')]);var _0x1430ba={'where':_0x42c72c[_0xf5ac('0x39')]};return db['CmCustomField'][_0xf5ac('0x1c')](_0x1430ba)['then'](function(_0x5721ba){_0x17b596[_0xf5ac('0x1c')]=_0x5721ba;if(_0x33c3cd[_0xf5ac('0x2f')][_0xf5ac('0x3e')]){_0x42c72c[_0xf5ac('0x3f')]=[{'all':!![]}];}return db[_0xf5ac('0x2b')][_0xf5ac('0x40')](_0x42c72c);})[_0xf5ac('0x24')](function(_0x5217c0){_0x17b596[_0xf5ac('0x41')]=_0x5217c0;return _0x17b596;})[_0xf5ac('0x24')](respondWithFilteredResult(_0x1c1be0,_0x42c72c))[_0xf5ac('0x42')](handleError(_0x1c1be0,null));};exports[_0xf5ac('0x43')]=function(_0x37c887,_0x161fbd){var _0x38de5c={'raw':!![],'where':{'id':_0x37c887[_0xf5ac('0x44')]['id']}},_0x53f88e={};_0x53f88e[_0xf5ac('0x32')]=_[_0xf5ac('0x30')](db[_0xf5ac('0x2b')][_0xf5ac('0x2c')]);_0x53f88e[_0xf5ac('0x2f')]=_[_0xf5ac('0x30')](_0x37c887[_0xf5ac('0x2f')]);_0x53f88e[_0xf5ac('0x31')]=_[_0xf5ac('0x45')](_0x53f88e[_0xf5ac('0x32')],_0x53f88e[_0xf5ac('0x2f')]);_0x38de5c[_0xf5ac('0x33')]=_[_0xf5ac('0x45')](_0x53f88e[_0xf5ac('0x32')],qs[_0xf5ac('0x34')](_0x37c887[_0xf5ac('0x2f')][_0xf5ac('0x34')]));_0x38de5c[_0xf5ac('0x33')]=_0x38de5c[_0xf5ac('0x33')]['length']?_0x38de5c['attributes']:_0x53f88e[_0xf5ac('0x32')];if(_0x37c887['query']['includeAll']){_0x38de5c[_0xf5ac('0x3f')]=[{'all':!![]}];}_0x38de5c=_[_0xf5ac('0x3a')]({},_0x38de5c,_0x37c887['options']);return db[_0xf5ac('0x2b')]['find'](_0x38de5c)[_0xf5ac('0x24')](handleEntityNotFound(_0x161fbd,null))[_0xf5ac('0x24')](respondWithResult(_0x161fbd,null))[_0xf5ac('0x42')](handleError(_0x161fbd,null));};exports['update']=function(_0x1ec7c7,_0x266063){if(_0x1ec7c7[_0xf5ac('0x46')]['id']){delete _0x1ec7c7['body']['id'];}return db[_0xf5ac('0x2b')][_0xf5ac('0x47')]({'where':{'id':_0x1ec7c7[_0xf5ac('0x44')]['id']}})[_0xf5ac('0x24')](handleEntityNotFound(_0x266063,null))[_0xf5ac('0x24')](saveUpdates(_0x1ec7c7['body'],null))[_0xf5ac('0x24')](respondWithResult(_0x266063,null))[_0xf5ac('0x42')](handleError(_0x266063,null));};exports[_0xf5ac('0x23')]=function(_0x5305a8,_0x5470af){return db[_0xf5ac('0x2b')]['find']({'where':{'id':_0x5305a8[_0xf5ac('0x44')]['id']}})['then'](handleEntityNotFound(_0x5470af,null))[_0xf5ac('0x24')](removeEntity(_0x5470af,null))['catch'](handleError(_0x5470af,null));};exports[_0xf5ac('0x48')]=function(_0x5f02da,_0x337272){var _0x399da0;return db[_0xf5ac('0x49')][_0xf5ac('0x4a')](function(_0x995272){return db[_0xf5ac('0x2b')]['create'](_0x5f02da[_0xf5ac('0x46')],{'transaction':_0x995272})[_0xf5ac('0x24')](function(_0x1f6fb4){_0x399da0=_0x1f6fb4;var _0x351c9d={'type':db[_0xf5ac('0x4b')][_0xf5ac('0x4c')],'transaction':_0x995272};switch(_0x5f02da['body'][_0xf5ac('0x3b')]){case'text':_0x351c9d['type']=db[_0xf5ac('0x4b')][_0xf5ac('0x4c')];break;case _0xf5ac('0x4d'):_0x351c9d['type']=db[_0xf5ac('0x4b')]['INTEGER'];break;case'switch':_0x351c9d['type']=db[_0xf5ac('0x4b')]['BOOLEAN'];_0x351c9d[_0xf5ac('0x4e')]=![];break;default:}return db[_0xf5ac('0x49')]['queryInterface'][_0xf5ac('0x4f')](_0xf5ac('0x50'),util[_0xf5ac('0x51')](_0xf5ac('0x52'),_0x399da0['id']),_0x351c9d);})['then'](function(){return _0x399da0;});})[_0xf5ac('0x24')](respondWithResult(_0x337272,0xc9))[_0xf5ac('0x42')](handleError(_0x337272,null));};
\ No newline at end of file
index 6d7898b..367327f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7b62=['../../config/logger','api','moment','request-promise','path','exports','define','CmCustomField','lodash'];(function(_0x356e8d,_0x24c719){var _0x39e65a=function(_0x27ecc2){while(--_0x27ecc2){_0x356e8d['push'](_0x356e8d['shift']());}};_0x39e65a(++_0x24c719);}(_0x7b62,0x15e));var _0x27b6=function(_0x2d2ddd,_0x2657fe){_0x2d2ddd=_0x2d2ddd-0x0;var _0x4c2a08=_0x7b62[_0x2d2ddd];return _0x4c2a08;};'use strict';var _=require(_0x27b6('0x0'));var util=require('util');var logger=require(_0x27b6('0x1'))(_0x27b6('0x2'));var moment=require(_0x27b6('0x3'));var BPromise=require('bluebird');var rp=require(_0x27b6('0x4'));var fs=require('fs');var path=require(_0x27b6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0x27b6('0x6')]=function(_0x4eff3e,_0xe2ec1f){return _0x4eff3e[_0x27b6('0x7')](_0x27b6('0x8'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa5fa=['CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x4e3bcf,_0x32f513){var _0x5d70d5=function(_0x42e230){while(--_0x42e230){_0x4e3bcf['push'](_0x4e3bcf['shift']());}};_0x5d70d5(++_0x32f513);}(_0xa5fa,0x1ee));var _0xaa5f=function(_0x19b5a0,_0x22be6a){_0x19b5a0=_0x19b5a0-0x0;var _0x3535d4=_0xa5fa[_0x19b5a0];return _0x3535d4;};'use strict';var _=require(_0xaa5f('0x0'));var util=require(_0xaa5f('0x1'));var logger=require(_0xaa5f('0x2'))(_0xaa5f('0x3'));var moment=require(_0xaa5f('0x4'));var BPromise=require(_0xaa5f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var attributes=require('./cmCustomField.attributes');module[_0xaa5f('0x8')]=function(_0x196121,_0x48e544){return _0x196121[_0xaa5f('0x9')](_0xaa5f('0xa'),attributes,{'tableName':_0xaa5f('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 3fe1a62..4433004 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9d94=['then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x1cd184,_0x2eb09c){var _0x212d79=function(_0x306805){while(--_0x306805){_0x1cd184['push'](_0x1cd184['shift']());}};_0x212d79(++_0x2eb09c);}(_0x9d94,0x1ee));var _0x49d9=function(_0x1977d5,_0x2d3375){_0x1977d5=_0x1977d5-0x0;var _0x30738a=_0x9d94[_0x1977d5];return _0x30738a;};'use strict';var _=require(_0x49d9('0x0'));var util=require('util');var moment=require(_0x49d9('0x1'));var BPromise=require(_0x49d9('0x2'));var rs=require(_0x49d9('0x3'));var fs=require('fs');var Redis=require(_0x49d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x49d9('0x5'));var logger=require(_0x49d9('0x6'))(_0x49d9('0x7'));var config=require(_0x49d9('0x8'));var jayson=require(_0x49d9('0x9'));var client=jayson[_0x49d9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x541e15,_0x3c6290,_0xcb1ac7){return new BPromise(function(_0x4ce954,_0x29b45f){return client[_0x49d9('0xb')](_0x541e15,_0xcb1ac7)[_0x49d9('0xc')](function(_0x5b4ada){logger[_0x49d9('0xd')](_0x49d9('0xe'),_0x3c6290,_0x49d9('0xf'));logger['debug'](_0x49d9('0x10'),_0x3c6290,'request\x20sent',JSON[_0x49d9('0x11')](_0x5b4ada));if(_0x5b4ada[_0x49d9('0x12')]){if(_0x5b4ada[_0x49d9('0x12')][_0x49d9('0x13')]===0x1f4){logger[_0x49d9('0x12')]('CmCustomField,\x20%s,\x20%s',_0x3c6290,_0x5b4ada['error']['message']);return _0x29b45f(_0x5b4ada[_0x49d9('0x12')][_0x49d9('0x14')]);}logger[_0x49d9('0x12')]('CmCustomField,\x20%s,\x20%s',_0x3c6290,_0x5b4ada['error'][_0x49d9('0x14')]);return _0x4ce954(_0x5b4ada[_0x49d9('0x12')][_0x49d9('0x14')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x3c6290,_0x49d9('0xf'));_0x4ce954(_0x5b4ada[_0x49d9('0x15')]['message']);}})['catch'](function(_0x39971d){logger['error'](_0x49d9('0xe'),_0x3c6290,_0x39971d);_0x29b45f(_0x39971d);});});}
\ No newline at end of file
+var _0x42e3=['../../mysqldb','../../config/environment','client','http','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring'];(function(_0x16de17,_0x334abf){var _0x361a02=function(_0x5281ee){while(--_0x5281ee){_0x16de17['push'](_0x16de17['shift']());}};_0x361a02(++_0x334abf);}(_0x42e3,0x1d7));var _0x342e=function(_0x32a3b3,_0x1e95b4){_0x32a3b3=_0x32a3b3-0x0;var _0xabf4df=_0x42e3[_0x32a3b3];return _0xabf4df;};'use strict';var _=require('lodash');var util=require(_0x342e('0x0'));var moment=require(_0x342e('0x1'));var BPromise=require(_0x342e('0x2'));var rs=require(_0x342e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x342e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x342e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x342e('0x6')][_0x342e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x69cc7c,_0x25fdc6,_0x31d4d2){return new BPromise(function(_0x5ccec0,_0x31e7ec){return client['request'](_0x69cc7c,_0x31d4d2)[_0x342e('0x8')](function(_0x3a2244){logger[_0x342e('0x9')]('CmCustomField,\x20%s,\x20%s',_0x25fdc6,_0x342e('0xa'));logger[_0x342e('0xb')](_0x342e('0xc'),_0x25fdc6,'request\x20sent',JSON[_0x342e('0xd')](_0x3a2244));if(_0x3a2244[_0x342e('0xe')]){if(_0x3a2244[_0x342e('0xe')][_0x342e('0xf')]===0x1f4){logger[_0x342e('0xe')](_0x342e('0x10'),_0x25fdc6,_0x3a2244[_0x342e('0xe')][_0x342e('0x11')]);return _0x31e7ec(_0x3a2244[_0x342e('0xe')][_0x342e('0x11')]);}logger[_0x342e('0xe')]('CmCustomField,\x20%s,\x20%s',_0x25fdc6,_0x3a2244[_0x342e('0xe')][_0x342e('0x11')]);return _0x5ccec0(_0x3a2244['error'][_0x342e('0x11')]);}else{logger[_0x342e('0x9')](_0x342e('0x10'),_0x25fdc6,_0x342e('0xa'));_0x5ccec0(_0x3a2244[_0x342e('0x12')][_0x342e('0x11')]);}})['catch'](function(_0x13a1c6){logger[_0x342e('0xe')]('CmCustomField,\x20%s,\x20%s',_0x25fdc6,_0x13a1c6);_0x31e7ec(_0x13a1c6);});});}
\ No newline at end of file
index 6296d50..67fc6e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1da9=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','post','put','/:id','update'];(function(_0x1fb151,_0x5e9b25){var _0xc2586b=function(_0x3d09ff){while(--_0x3d09ff){_0x1fb151['push'](_0x1fb151['shift']());}};_0xc2586b(++_0x5e9b25);}(_0x1da9,0x141));var _0x91da=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1da9[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x91da('0x0'));var util=require(_0x91da('0x1'));var path=require(_0x91da('0x2'));var timeout=require(_0x91da('0x3'));var express=require(_0x91da('0x4'));var router=express[_0x91da('0x5')]();var fs_extra=require(_0x91da('0x6'));var auth=require(_0x91da('0x7'));var interaction=require(_0x91da('0x8'));var config=require(_0x91da('0x9'));var controller=require(_0x91da('0xa'));router[_0x91da('0xb')]('/',auth[_0x91da('0xc')](),controller[_0x91da('0xd')]);router[_0x91da('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x91da('0xe')]);router[_0x91da('0xf')]('/',auth[_0x91da('0xc')](),controller['create']);router[_0x91da('0x10')](_0x91da('0x11'),auth[_0x91da('0xc')](),controller[_0x91da('0x12')]);router['delete'](_0x91da('0x11'),auth[_0x91da('0xc')](),controller['destroy']);module[_0x91da('0x13')]=router;
\ No newline at end of file
+var _0x741c=['get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmCustomField.controller'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x741c,0x196));var _0xc741=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x741c[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['show']);router[_0xc741('0xc')]('/',auth[_0xc741('0x9')](),controller['create']);router[_0xc741('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc741('0xe')]);router[_0xc741('0xf')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);module[_0xc741('0x11')]=router;
\ No newline at end of file
index 8345dab..1f137ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0d48=['format','INTEGER','DATE','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN'];(function(_0x3477c4,_0x309176){var _0xb1b1b5=function(_0x497eeb){while(--_0x497eeb){_0x3477c4['push'](_0x3477c4['shift']());}};_0xb1b1b5(++_0x309176);}(_0x0d48,0x188));var _0x80d4=function(_0x36d57f,_0x2f9118){_0x36d57f=_0x36d57f-0x0;var _0x3f93fb=_0x0d48[_0x36d57f];return _0x3f93fb;};'use strict';var moment=require(_0x80d4('0x0'));var Sequelize=require(_0x80d4('0x1'));module['exports']={'phone':{'type':Sequelize[_0x80d4('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x80d4('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x80d4('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x80d4('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x80d4('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x80d4('0x6')]},'priority':{'type':Sequelize[_0x80d4('0x5')](0x2)[_0x80d4('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x80d4('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x80d4('0x5')],'unique':_0x80d4('0x8')},'ListId':{'type':Sequelize[_0x80d4('0x5')],'unique':_0x80d4('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x80d4('0x8')},'CampaignId':{'type':Sequelize[_0x80d4('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x80d4('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x80d4('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x80d4('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x80d4('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x80d4('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x80d4('0x6')],'allowNull':!![],'defaultValue':null}};
\ No newline at end of file
+var _0x5bf8=['INTEGER','STRING','UNSIGNED','contactListQueue','moment','exports','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5bf8,0x1c6));var _0x85bf=function(_0x1a9b94,_0x4d763e){_0x1a9b94=_0x1a9b94-0x0;var _0x379102=_0x5bf8[_0x1a9b94];return _0x379102;};'use strict';var moment=require(_0x85bf('0x0'));var Sequelize=require('sequelize');module[_0x85bf('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x85bf('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x85bf('0x3')],'defaultValue':moment()['format'](_0x85bf('0x4'))},'countbusyretry':{'type':Sequelize[_0x85bf('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x85bf('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x85bf('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x85bf('0x3')]},'priority':{'type':Sequelize[_0x85bf('0x5')](0x2)[_0x85bf('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x85bf('0x8')},'ListId':{'type':Sequelize[_0x85bf('0x5')],'unique':_0x85bf('0x8')},'UserId':{'type':Sequelize[_0x85bf('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x85bf('0x5')],'unique':_0x85bf('0x8')},'CampaignId':{'type':Sequelize[_0x85bf('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x85bf('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x85bf('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x85bf('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x85bf('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x85bf('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x85bf('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x85bf('0x6')]},'recallmeNotifiedDate':{'type':Sequelize[_0x85bf('0x3')],'allowNull':!![],'defaultValue':null}};
\ No newline at end of file
index 53e672d..3e7249e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4b1f=['sendStatus','getTimezones','push','utcOffset','getTimezone','timezones','moment','lodash','../../config/logger','api','../../config/environment','offset','count','limit','status','set','Content-Range','json','update','then','error','send','index','map','rawAttributes','type','key','name','query','keys','filters','intersection','model','concat','$or','$gte','$lte','$ne','$eq','$between','$in','$like','$notLike','$notILike','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','CmHopper','findAll','catch','show','params','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','priority','ASC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','dialActive','transaction','LOCK','CmList','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0x4b1f,0x195));var _0xf4b1=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x4b1f[_0x411017];return _0x2adeea;};'use strict';var moment=require(_0xf4b1('0x0'));var _=require(_0xf4b1('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xf4b1('0x2'))(_0xf4b1('0x3'));var shared=require(_0xf4b1('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x19fb44,_0x2b99e2){_0x2b99e2=_0x2b99e2||0xc8;return function(_0x31acb0){if(_0x31acb0){return _0x19fb44['status'](_0x2b99e2)['json'](_0x31acb0);}};}function respondWithFilteredResult(_0x1ab96b,_0x4b676){return function(_0x310db5){if(_0x310db5){var _0x3b9c78=typeof _0x4b676[_0xf4b1('0x5')]==='undefined'&&typeof _0x4b676['limit']==='undefined';var _0x2bf9d8=_0x310db5['count'];var _0xb243d6=_0x3b9c78?0x0:_0x4b676['offset'];var _0x4abaa5=_0x3b9c78?_0x310db5[_0xf4b1('0x6')]:_0x4b676[_0xf4b1('0x5')]+_0x4b676[_0xf4b1('0x7')];var _0x253fa8;if(_0x4abaa5>=_0x2bf9d8){_0x4abaa5=_0x2bf9d8;_0x253fa8=0xc8;}else{_0x253fa8=0xce;}_0x1ab96b[_0xf4b1('0x8')](_0x253fa8);return _0x1ab96b[_0xf4b1('0x9')](_0xf4b1('0xa'),_0xb243d6+'-'+_0x4abaa5+'/'+_0x2bf9d8)[_0xf4b1('0xb')](_0x310db5);}return null;};}function saveUpdates(_0x38afbb,_0xf66b4c){return function(_0x2c4eb9){if(_0x2c4eb9){return _0x2c4eb9[_0xf4b1('0xc')](_0x38afbb)[_0xf4b1('0xd')](function(_0x58bdf0){return _0x58bdf0;});}return null;};}function handleEntityNotFound(_0x591476,_0x3ea6f3){return function(_0x5cbc25){if(!_0x5cbc25){_0x591476['sendStatus'](0x194);}return _0x5cbc25;};}function handleError(_0x476a04,_0x51c39f){_0x51c39f=_0x51c39f||0x1f4;return function(_0x5764b1){logger[_0xf4b1('0xe')](_0x5764b1['stack']);if(_0x5764b1['name']){delete _0x5764b1['name'];}_0x476a04['status'](_0x51c39f)[_0xf4b1('0xf')](_0x5764b1);};}exports[_0xf4b1('0x10')]=function(_0x534fd8,_0x3b378e){var _0x420f9e={},_0x322b38={},_0x465da2={'count':0x0,'rows':[]};var _0x2658e8=_[_0xf4b1('0x11')](db['CmHopper'][_0xf4b1('0x12')],function(_0x2efda6){return{'name':_0x2efda6['fieldName'],'type':_0x2efda6[_0xf4b1('0x13')][_0xf4b1('0x14')]};});_0x322b38['model']=_[_0xf4b1('0x11')](_0x2658e8,_0xf4b1('0x15'));_0x322b38[_0xf4b1('0x16')]=_[_0xf4b1('0x17')](_0x534fd8['query']);_0x322b38[_0xf4b1('0x18')]=_[_0xf4b1('0x19')](_0x322b38[_0xf4b1('0x1a')],_0x322b38[_0xf4b1('0x16')]);_0x322b38['filters']=_[_0xf4b1('0x1b')](_0x322b38[_0xf4b1('0x18')],['$and',_0xf4b1('0x1c'),'$gt',_0xf4b1('0x1d'),'$lt',_0xf4b1('0x1e'),_0xf4b1('0x1f'),_0xf4b1('0x20'),'$not',_0xf4b1('0x21'),'$notBetween',_0xf4b1('0x22'),'$notIn',_0xf4b1('0x23'),_0xf4b1('0x24'),'$iLike',_0xf4b1('0x25'),_0xf4b1('0x23'),'$overlap',_0xf4b1('0x26'),_0xf4b1('0x27'),_0xf4b1('0x28')]);_0x420f9e[_0xf4b1('0x29')]=_[_0xf4b1('0x19')](_0x322b38[_0xf4b1('0x1a')],qs[_0xf4b1('0x2a')](_0x534fd8['query']['fields']));_0x420f9e[_0xf4b1('0x29')]=_0x420f9e[_0xf4b1('0x29')][_0xf4b1('0x2b')]?_0x420f9e[_0xf4b1('0x29')]:_0x322b38[_0xf4b1('0x1a')];if(!_0x534fd8['query'][_0xf4b1('0x2c')](_0xf4b1('0x2d'))){_0x420f9e[_0xf4b1('0x7')]=qs[_0xf4b1('0x7')](_0x534fd8[_0xf4b1('0x16')][_0xf4b1('0x7')]);_0x420f9e[_0xf4b1('0x5')]=qs[_0xf4b1('0x5')](_0x534fd8['query'][_0xf4b1('0x5')]);}_0x420f9e['order']=qs['sort'](_0x534fd8['query'][_0xf4b1('0x2e')]);_0x420f9e[_0xf4b1('0x2f')]=qs[_0xf4b1('0x18')](_[_0xf4b1('0x30')](_0x534fd8[_0xf4b1('0x16')],_0x322b38[_0xf4b1('0x18')]),_0x2658e8);if(_0x534fd8[_0xf4b1('0x16')][_0xf4b1('0x31')]){_0x420f9e['where']=_[_0xf4b1('0x32')](_0x420f9e['where'],{'$or':_[_0xf4b1('0x11')](_0x2658e8,function(_0x303290){if(_0x303290['type']!==_0xf4b1('0x33')){var _0x6675a={};_0x6675a[_0x303290[_0xf4b1('0x15')]]={'$like':'%'+_0x534fd8[_0xf4b1('0x16')][_0xf4b1('0x31')]+'%'};return _0x6675a;}})});}_0x420f9e=_['merge']({},_0x420f9e,_0x534fd8[_0xf4b1('0x34')]);var _0x4f52dd={'where':_0x420f9e[_0xf4b1('0x2f')]};return db['CmHopper'][_0xf4b1('0x6')](_0x4f52dd)[_0xf4b1('0xd')](function(_0xfe587f){_0x465da2['count']=_0xfe587f;if(_0x534fd8[_0xf4b1('0x16')][_0xf4b1('0x35')]){_0x420f9e[_0xf4b1('0x36')]=[{'all':!![]}];}return db[_0xf4b1('0x37')][_0xf4b1('0x38')](_0x420f9e);})[_0xf4b1('0xd')](function(_0xa5e7d1){_0x465da2['rows']=_0xa5e7d1;return _0x465da2;})[_0xf4b1('0xd')](respondWithFilteredResult(_0x3b378e,_0x420f9e))[_0xf4b1('0x39')](handleError(_0x3b378e,null));};exports[_0xf4b1('0x3a')]=function(_0x3553c3,_0x39de7f){var _0x5aab12={'raw':!![],'where':{'id':_0x3553c3[_0xf4b1('0x3b')]['id']}},_0x54df38={};_0x54df38[_0xf4b1('0x1a')]=_['keys'](db['CmHopper'][_0xf4b1('0x12')]);_0x54df38[_0xf4b1('0x16')]=_[_0xf4b1('0x17')](_0x3553c3[_0xf4b1('0x16')]);_0x54df38[_0xf4b1('0x18')]=_[_0xf4b1('0x19')](_0x54df38[_0xf4b1('0x1a')],_0x54df38[_0xf4b1('0x16')]);_0x5aab12['attributes']=_[_0xf4b1('0x19')](_0x54df38['model'],qs['fields'](_0x3553c3['query'][_0xf4b1('0x2a')]));_0x5aab12[_0xf4b1('0x29')]=_0x5aab12[_0xf4b1('0x29')]['length']?_0x5aab12[_0xf4b1('0x29')]:_0x54df38[_0xf4b1('0x1a')];if(_0x3553c3[_0xf4b1('0x16')]['includeAll']){_0x5aab12[_0xf4b1('0x36')]=[{'all':!![]}];}_0x5aab12=_[_0xf4b1('0x32')]({},_0x5aab12,_0x3553c3[_0xf4b1('0x34')]);return db['CmHopper'][_0xf4b1('0x3c')](_0x5aab12)['then'](handleEntityNotFound(_0x39de7f,null))[_0xf4b1('0xd')](respondWithResult(_0x39de7f,null))[_0xf4b1('0x39')](handleError(_0x39de7f,null));};exports[_0xf4b1('0x3d')]=function(_0x54f24a,_0x16c00f){return db[_0xf4b1('0x37')]['create'](_0x54f24a[_0xf4b1('0x3e')],{})[_0xf4b1('0xd')](respondWithResult(_0x16c00f,0xc9))[_0xf4b1('0x39')](handleError(_0x16c00f,null));};exports[_0xf4b1('0xc')]=function(_0x52a080,_0x5a7b0a){if(_0x52a080[_0xf4b1('0x3e')]['id']){delete _0x52a080[_0xf4b1('0x3e')]['id'];}return db['CmHopper'][_0xf4b1('0x3c')]({'where':{'id':_0x52a080['params']['id']}})[_0xf4b1('0xd')](handleEntityNotFound(_0x5a7b0a,null))['then'](saveUpdates(_0x52a080[_0xf4b1('0x3e')],null))[_0xf4b1('0xd')](respondWithResult(_0x5a7b0a,null))['catch'](handleError(_0x5a7b0a,null));};exports[_0xf4b1('0x3f')]=function(_0x104819,_0xd8fa5a){return db[_0xf4b1('0x37')][_0xf4b1('0x3f')]()[_0xf4b1('0xd')](respondWithResult(_0xd8fa5a,null))[_0xf4b1('0x39')](handleError(_0xd8fa5a,null));};exports[_0xf4b1('0x40')]=function(_0x4e6e04,_0x4a9761){var _0xcb26;var _0x247165=_0x4e6e04['params']['id'];return db[_0xf4b1('0x37')][_0xf4b1('0x3c')]({'where':{'id':_0x4e6e04[_0xf4b1('0x3b')]['id']}})[_0xf4b1('0xd')](handleEntityNotFound(_0x4a9761,null))[_0xf4b1('0xd')](function(_0x2e8e2c){if(_0x2e8e2c){return _0x2e8e2c[_0xf4b1('0x40')]()[_0xf4b1('0xd')](function(_0x29c3c1){return _0x29c3c1;});}})[_0xf4b1('0xd')](function(_0x407ecf){_0xcb26=_0x407ecf;if(_0x407ecf){if(_0x407ecf[_0xf4b1('0x41')]||_0x407ecf[_0xf4b1('0x42')]){return db[_0x407ecf[_0xf4b1('0x41')]?_0xf4b1('0x43'):_0xf4b1('0x44')][_0xf4b1('0x3c')]({'where':{'id':_0x407ecf[_0xf4b1('0x41')]?_0x407ecf[_0xf4b1('0x41')]:_0x407ecf[_0xf4b1('0x42')]},'attributes':['id',_0xf4b1('0x15')],'raw':!![]});}}})[_0xf4b1('0xd')](function(_0x38efcd){var _0x478573={};if(_0x38efcd){_[_0xf4b1('0x32')](_0x478573,_[_0xf4b1('0x45')](_0xcb26[_0xf4b1('0x46')],[_0xf4b1('0x47'),'updatedAt','id']));_0x478573[_0xf4b1('0x48')]=0x15;_0x478573['statedesc']='deleted';_0x478573[_0xf4b1('0x49')]=_0x38efcd[_0xf4b1('0x15')];_0x478573['membername']=_0x4e6e04[_0xf4b1('0x4a')][_0xf4b1('0x15')];_0x478573[_0xf4b1('0x4b')]=_0x4e6e04['user']['id'];_0x478573['deleted']=!![];_0x478573[_0xf4b1('0x4c')]=moment()[_0xf4b1('0x4d')](_0xf4b1('0x4e'));_0x478573[_0xf4b1('0x4f')]=_0xcb26[_0xf4b1('0x50')];_0x478573[_0xf4b1('0x51')]=_0xcb26[_0xf4b1('0x41')]?_0xf4b1('0x52'):_0xf4b1('0x53');return db[_0xf4b1('0x54')][_0xf4b1('0x3c')]({'where':{'id':_0x478573[_0xf4b1('0x55')]},'attributes':[_0xf4b1('0x56'),_0xf4b1('0x57')]})['then'](function(_0x193bab){if(!_[_0xf4b1('0x58')](_0x4a9761)&&!_[_0xf4b1('0x58')](_0x193bab[_0xf4b1('0x56')])){_0x478573[_0xf4b1('0x59')]=_0x193bab[_0xf4b1('0x56')];if(!_[_0xf4b1('0x58')](_0x193bab[_0xf4b1('0x57')])){_0x478573[_0xf4b1('0x59')]+='\x20'+_0x193bab['lastName'];}}})[_0xf4b1('0x5a')](function(){return db[_0xf4b1('0x5b')][_0xf4b1('0x3d')](_0x478573);});}})['then'](function(_0x5960cd){return db[_0xf4b1('0x5c')][_0xf4b1('0x40')]({'where':{'CmHopperId':_0x247165}});})['then'](function(){return _0x4a9761[_0xf4b1('0x8')](0xcc)[_0xf4b1('0x5d')]();})[_0xf4b1('0x39')](handleError(_0x4a9761,null));};exports[_0xf4b1('0x5e')]=function(_0xb3ac46,_0x34e231){var _0xf8fbc1=[];return db[_0xf4b1('0x54')][_0xf4b1('0x3f')]()[_0xf4b1('0xd')](function(_0x2bf00c){_0xf8fbc1=_['keys'](_0x2bf00c);return _0xb3ac46[_0xf4b1('0x4a')][_0xf4b1('0x5f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xf4b1('0x60')},'attributes':['id',_0xf4b1('0x61'),_0xf4b1('0x62')],'raw':!![]});})['then'](function(_0x38769a){if(_0x38769a&&_0x38769a[_0xf4b1('0x2b')]){return db['sequelize']['transaction'](function(_0x2ad185){var _0x52c144={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xf4b1('0x4e'))},'VoiceQueueId':{'$in':_[_0xf4b1('0x11')](_0x38769a,'id')},'$or':[{'UserId':null},{'UserId':_0xb3ac46['user']['id']}]};var _0x5ae14f={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x38769a)[_0xf4b1('0x31')]([_0xf4b1('0x62'),0x0])['map']('id')[_0xf4b1('0x63')]()},'$or':[{'UserId':null},{'UserId':_0xb3ac46[_0xf4b1('0x4a')]['id']}]};var _0x1da752={'$or':[_0x52c144,_0x5ae14f]};var _0x18fef2=[];if(_0xb3ac46[_0xf4b1('0x3e')][_0xf4b1('0x64')]&&_0xb3ac46[_0xf4b1('0x3e')]['direction']===_0xf4b1('0x65')){if(!_[_0xf4b1('0x66')](_0xb3ac46[_0xf4b1('0x3e')][_0xf4b1('0x67')])){_0x1da752['id']={'$in':_0xb3ac46[_0xf4b1('0x3e')][_0xf4b1('0x67')]};}_0x18fef2=[[_0xf4b1('0x68'),'ASC'],['scheduledAt',_0x38769a[0x0][_0xf4b1('0x61')]===_0xf4b1('0x69')?'DESC':_0xf4b1('0x69')],db[_0xf4b1('0x6a')][_0xf4b1('0x6b')](_0xf4b1('0x6c')),['id','DESC']];}else{if(!_[_0xf4b1('0x66')](_0xb3ac46[_0xf4b1('0x3e')][_0xf4b1('0x67')])){_0x1da752['id']={'$notIn':_0xb3ac46['body'][_0xf4b1('0x67')]};}_0x18fef2=[[_0xf4b1('0x68'),_0xf4b1('0x6d')],[_0xf4b1('0x6e'),_0x38769a[0x0][_0xf4b1('0x61')]],db['sequelize'][_0xf4b1('0x6b')](_0xf4b1('0x6f')),['id',_0xf4b1('0x69')]];}return db[_0xf4b1('0x37')][_0xf4b1('0x70')]({'attributes':['id',_0xf4b1('0x71'),'phone',_0xf4b1('0x72')],'where':_0x1da752,'order':_0x18fef2,'transaction':_0x2ad185,'lock':_0x2ad185['LOCK'][_0xf4b1('0x73')],'include':[{'model':db['CmContact'],'as':_0xf4b1('0x74'),'attributes':_0xf8fbc1,'include':[{'model':db[_0xf4b1('0x75')],'as':_0xf4b1('0x76'),'attributes':['id',_0xf4b1('0x15')]}]},{'model':db['CmList'],'as':'List','attributes':['id','name']},{'model':db[_0xf4b1('0x43')],'as':'Queue','attributes':['id','name',_0xf4b1('0x77')]}]})[_0xf4b1('0xd')](function(_0x52588f){if(_0x52588f){return _0x52588f[_0xf4b1('0xc')]({'UserId':_0xb3ac46[_0xf4b1('0x4a')]['id']},{'transaction':_0x2ad185});}});});}})['then'](handleEntityNotFound(_0x34e231,null))[_0xf4b1('0xd')](respondWithResult(_0x34e231,null))[_0xf4b1('0x39')](handleError(_0x34e231,null));};exports['getPreviewRecall']=function(_0x218a13,_0x5c71f2,_0x1687d5){var _0x5af286=[];var _0x59ac68=_0x218a13[_0xf4b1('0x3b')]['id'];var _0x19d240=_0x218a13['user']['id'];return db[_0xf4b1('0x54')][_0xf4b1('0x3f')]()[_0xf4b1('0xd')](function(_0x32b9a1){_0x5af286=_[_0xf4b1('0x17')](_0x32b9a1);return db['sequelize'][_0xf4b1('0x78')](function(_0x28ee27){const _0x2658d0={'id':_0x59ac68};return db['CmHopper'][_0xf4b1('0x70')]({'attributes':['id',_0xf4b1('0x71'),_0xf4b1('0x72')],'where':_0x2658d0,'transaction':_0x28ee27,'lock':_0x28ee27[_0xf4b1('0x79')]['UPDATE'],'include':[{'model':db[_0xf4b1('0x54')],'as':_0xf4b1('0x74'),'attributes':_0x5af286,'include':[{'model':db[_0xf4b1('0x75')],'as':_0xf4b1('0x76'),'attributes':['id',_0xf4b1('0x15')]}]},{'model':db[_0xf4b1('0x7a')],'as':'List','attributes':['id','name']},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xf4b1('0x15'),_0xf4b1('0x77')]}]})['then'](function(_0x1af20e){if(_0x1af20e){return _0x1af20e[_0xf4b1('0xc')]({'UserId':_0x19d240},{'transaction':_0x28ee27});}});});})[_0xf4b1('0xd')](handleEntityNotFound(_0x5c71f2,null))['then'](respondWithResult(_0x5c71f2,null))[_0xf4b1('0x39')](handleError(_0x5c71f2,null));};exports['getOpenContacts']=function(_0x55fe87,_0x591d51){return _0x55fe87[_0xf4b1('0x4a')][_0xf4b1('0x5f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xf4b1('0xd')](function(_0x49302a){if(_0x49302a&&_0x49302a[_0xf4b1('0x2b')]){return db[_0xf4b1('0x37')][_0xf4b1('0x6')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf4b1('0x4d')](_0xf4b1('0x4e'))},'VoiceQueueId':{'$in':_[_0xf4b1('0x11')](_0x49302a,'id')},'$or':[{'UserId':null},{'UserId':_0x55fe87[_0xf4b1('0x4a')]['id']}]}});}return 0x0;})[_0xf4b1('0xd')](function(_0x2c2fc7){if(!_[_0xf4b1('0x58')](_0x2c2fc7)&&_[_0xf4b1('0x7b')](_0x2c2fc7)){return _0x591d51[_0xf4b1('0x8')](0xc8)['json']({'contacts':_0x2c2fc7});}else{logger[_0xf4b1('0xe')](_0xf4b1('0x7c'),_0xf4b1('0x7d'),0x194,_0xf4b1('0x7e'));_0x591d51[_0xf4b1('0x7f')](0x194);}})['catch'](handleError(_0x591d51,null));};exports[_0xf4b1('0x80')]=function(_0xcb1508,_0x704d5a){var _0x2fd77b=shared['timezones'];var _0x55559d=[];_[_0xf4b1('0x11')](_0x2fd77b,function(_0x33174b){_0x55559d[_0xf4b1('0x81')]({'id':_0x33174b[_0xf4b1('0x15')],'name':_0x33174b['name'],'utcOffset':_0x33174b[_0xf4b1('0x82')]});});return _0x704d5a[_0xf4b1('0x8')](0xc8)[_0xf4b1('0xb')]({'tz':_0x55559d});};exports[_0xf4b1('0x83')]=function(_0x48ab80,_0x503f3f){var _0x13d74f=shared[_0xf4b1('0x84')];var _0x313200={};if(!_['isNil'](_0x13d74f[_0x48ab80[_0xf4b1('0x3e')]['id']]))_0x313200=_0x13d74f[_0x48ab80[_0xf4b1('0x3e')]['id']];return _0x503f3f[_0xf4b1('0x8')](0xc8)[_0xf4b1('0xb')](_0x313200);};
\ No newline at end of file
+var _0xbd50=['set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','query','keys','filters','intersection','concat','$and','$gte','$lt','$lte','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','create','catch','body','find','describe','destroy','CampaignId','Campaign','VoiceQueueId','createdAt','updatedAt','state','deleted','campaign','membername','UserId','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','CmContact','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','getPreviewRecall','findOne','dialActive','getOpenContacts','getVoiceQueues','format','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','json','getTimezone','moment','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','offset','undefined','count','limit','status'];(function(_0x448928,_0x1b2906){var _0x2849d2=function(_0x5955db){while(--_0x5955db){_0x448928['push'](_0x448928['shift']());}};_0x2849d2(++_0x1b2906);}(_0xbd50,0x196));var _0x0bd5=function(_0x1b2a4c,_0x5e55be){_0x1b2a4c=_0x1b2a4c-0x0;var _0x395fb7=_0xbd50[_0x1b2a4c];return _0x395fb7;};'use strict';var moment=require(_0x0bd5('0x0'));var _=require(_0x0bd5('0x1'));var qs=require(_0x0bd5('0x2'));var logger=require('../../config/logger')(_0x0bd5('0x3'));var shared=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];function respondWithResult(_0x1e9877,_0x15620d){_0x15620d=_0x15620d||0xc8;return function(_0x4c17ee){if(_0x4c17ee){return _0x1e9877['status'](_0x15620d)['json'](_0x4c17ee);}};}function respondWithFilteredResult(_0x376024,_0x2ef1d0){return function(_0xcc6cfa){if(_0xcc6cfa){var _0x2c0db1=typeof _0x2ef1d0[_0x0bd5('0x6')]==='undefined'&&typeof _0x2ef1d0['limit']===_0x0bd5('0x7');var _0x25e31e=_0xcc6cfa[_0x0bd5('0x8')];var _0x5f5a0c=_0x2c0db1?0x0:_0x2ef1d0[_0x0bd5('0x6')];var _0x2fa7d1=_0x2c0db1?_0xcc6cfa['count']:_0x2ef1d0[_0x0bd5('0x6')]+_0x2ef1d0[_0x0bd5('0x9')];var _0x4d7d17;if(_0x2fa7d1>=_0x25e31e){_0x2fa7d1=_0x25e31e;_0x4d7d17=0xc8;}else{_0x4d7d17=0xce;}_0x376024[_0x0bd5('0xa')](_0x4d7d17);return _0x376024[_0x0bd5('0xb')](_0x0bd5('0xc'),_0x5f5a0c+'-'+_0x2fa7d1+'/'+_0x25e31e)['json'](_0xcc6cfa);}return null;};}function saveUpdates(_0x2f7a0c,_0x23982f){return function(_0x2f9588){if(_0x2f9588){return _0x2f9588[_0x0bd5('0xd')](_0x2f7a0c)[_0x0bd5('0xe')](function(_0x557be0){return _0x557be0;});}return null;};}function handleEntityNotFound(_0x30765e,_0x1e961d){return function(_0x4f485b){if(!_0x4f485b){_0x30765e[_0x0bd5('0xf')](0x194);}return _0x4f485b;};}function handleError(_0x325e43,_0x574315){_0x574315=_0x574315||0x1f4;return function(_0x31349f){logger[_0x0bd5('0x10')](_0x31349f[_0x0bd5('0x11')]);if(_0x31349f[_0x0bd5('0x12')]){delete _0x31349f['name'];}_0x325e43[_0x0bd5('0xa')](_0x574315)[_0x0bd5('0x13')](_0x31349f);};}exports[_0x0bd5('0x14')]=function(_0x277b32,_0x833c14){var _0x23be38={},_0xc58e12={},_0x19fe20={'count':0x0,'rows':[]};var _0x29fa4c=_[_0x0bd5('0x15')](db[_0x0bd5('0x16')][_0x0bd5('0x17')],function(_0x4008bd){return{'name':_0x4008bd[_0x0bd5('0x18')],'type':_0x4008bd['type']['key']};});_0xc58e12['model']=_['map'](_0x29fa4c,'name');_0xc58e12[_0x0bd5('0x19')]=_[_0x0bd5('0x1a')](_0x277b32[_0x0bd5('0x19')]);_0xc58e12[_0x0bd5('0x1b')]=_[_0x0bd5('0x1c')](_0xc58e12['model'],_0xc58e12[_0x0bd5('0x19')]);_0xc58e12[_0x0bd5('0x1b')]=_[_0x0bd5('0x1d')](_0xc58e12['filters'],[_0x0bd5('0x1e'),'$or','$gt',_0x0bd5('0x1f'),_0x0bd5('0x20'),_0x0bd5('0x21'),'$ne',_0x0bd5('0x22'),'$not',_0x0bd5('0x23'),_0x0bd5('0x24'),_0x0bd5('0x25'),_0x0bd5('0x26'),_0x0bd5('0x27'),_0x0bd5('0x28'),_0x0bd5('0x29'),_0x0bd5('0x2a'),_0x0bd5('0x27'),_0x0bd5('0x2b'),_0x0bd5('0x2c'),_0x0bd5('0x2d'),_0x0bd5('0x2e')]);_0x23be38[_0x0bd5('0x2f')]=_['intersection'](_0xc58e12[_0x0bd5('0x30')],qs[_0x0bd5('0x31')](_0x277b32['query'][_0x0bd5('0x31')]));_0x23be38[_0x0bd5('0x2f')]=_0x23be38['attributes'][_0x0bd5('0x32')]?_0x23be38[_0x0bd5('0x2f')]:_0xc58e12[_0x0bd5('0x30')];if(!_0x277b32[_0x0bd5('0x19')]['hasOwnProperty'](_0x0bd5('0x33'))){_0x23be38[_0x0bd5('0x9')]=qs[_0x0bd5('0x9')](_0x277b32[_0x0bd5('0x19')][_0x0bd5('0x9')]);_0x23be38[_0x0bd5('0x6')]=qs['offset'](_0x277b32[_0x0bd5('0x19')]['offset']);}_0x23be38[_0x0bd5('0x34')]=qs[_0x0bd5('0x35')](_0x277b32[_0x0bd5('0x19')][_0x0bd5('0x35')]);_0x23be38[_0x0bd5('0x36')]=qs[_0x0bd5('0x1b')](_[_0x0bd5('0x37')](_0x277b32[_0x0bd5('0x19')],_0xc58e12[_0x0bd5('0x1b')]),_0x29fa4c);if(_0x277b32[_0x0bd5('0x19')][_0x0bd5('0x38')]){_0x23be38[_0x0bd5('0x36')]=_[_0x0bd5('0x39')](_0x23be38['where'],{'$or':_[_0x0bd5('0x15')](_0x29fa4c,function(_0x10750c){if(_0x10750c['type']!=='VIRTUAL'){var _0x6b93ed={};_0x6b93ed[_0x10750c[_0x0bd5('0x12')]]={'$like':'%'+_0x277b32[_0x0bd5('0x19')][_0x0bd5('0x38')]+'%'};return _0x6b93ed;}})});}_0x23be38=_[_0x0bd5('0x39')]({},_0x23be38,_0x277b32[_0x0bd5('0x3a')]);var _0x22c10c={'where':_0x23be38[_0x0bd5('0x36')]};return db[_0x0bd5('0x16')][_0x0bd5('0x8')](_0x22c10c)[_0x0bd5('0xe')](function(_0x3c6aa5){_0x19fe20[_0x0bd5('0x8')]=_0x3c6aa5;if(_0x277b32['query'][_0x0bd5('0x3b')]){_0x23be38['include']=[{'all':!![]}];}return db[_0x0bd5('0x16')][_0x0bd5('0x3c')](_0x23be38);})[_0x0bd5('0xe')](function(_0x1fcc49){_0x19fe20[_0x0bd5('0x3d')]=_0x1fcc49;return _0x19fe20;})[_0x0bd5('0xe')](respondWithFilteredResult(_0x833c14,_0x23be38))['catch'](handleError(_0x833c14,null));};exports[_0x0bd5('0x3e')]=function(_0x975fff,_0x11b1e1){var _0x1a9dda={'raw':!![],'where':{'id':_0x975fff[_0x0bd5('0x3f')]['id']}},_0x1c73be={};_0x1c73be[_0x0bd5('0x30')]=_[_0x0bd5('0x1a')](db[_0x0bd5('0x16')]['rawAttributes']);_0x1c73be[_0x0bd5('0x19')]=_['keys'](_0x975fff[_0x0bd5('0x19')]);_0x1c73be[_0x0bd5('0x1b')]=_['intersection'](_0x1c73be[_0x0bd5('0x30')],_0x1c73be[_0x0bd5('0x19')]);_0x1a9dda[_0x0bd5('0x2f')]=_[_0x0bd5('0x1c')](_0x1c73be[_0x0bd5('0x30')],qs[_0x0bd5('0x31')](_0x975fff[_0x0bd5('0x19')]['fields']));_0x1a9dda['attributes']=_0x1a9dda[_0x0bd5('0x2f')]['length']?_0x1a9dda['attributes']:_0x1c73be[_0x0bd5('0x30')];if(_0x975fff[_0x0bd5('0x19')]['includeAll']){_0x1a9dda['include']=[{'all':!![]}];}_0x1a9dda=_['merge']({},_0x1a9dda,_0x975fff[_0x0bd5('0x3a')]);return db['CmHopper']['find'](_0x1a9dda)[_0x0bd5('0xe')](handleEntityNotFound(_0x11b1e1,null))[_0x0bd5('0xe')](respondWithResult(_0x11b1e1,null))['catch'](handleError(_0x11b1e1,null));};exports['create']=function(_0xb46d84,_0x3f645b){return db[_0x0bd5('0x16')][_0x0bd5('0x40')](_0xb46d84['body'],{})[_0x0bd5('0xe')](respondWithResult(_0x3f645b,0xc9))[_0x0bd5('0x41')](handleError(_0x3f645b,null));};exports[_0x0bd5('0xd')]=function(_0x39956f,_0x1a9c33){if(_0x39956f[_0x0bd5('0x42')]['id']){delete _0x39956f['body']['id'];}return db[_0x0bd5('0x16')][_0x0bd5('0x43')]({'where':{'id':_0x39956f[_0x0bd5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1a9c33,null))[_0x0bd5('0xe')](saveUpdates(_0x39956f[_0x0bd5('0x42')],null))[_0x0bd5('0xe')](respondWithResult(_0x1a9c33,null))['catch'](handleError(_0x1a9c33,null));};exports[_0x0bd5('0x44')]=function(_0x45240c,_0x54cd78){return db[_0x0bd5('0x16')][_0x0bd5('0x44')]()['then'](respondWithResult(_0x54cd78,null))[_0x0bd5('0x41')](handleError(_0x54cd78,null));};exports[_0x0bd5('0x45')]=function(_0x4d00c3,_0x2db9b0){var _0x20960a;var _0x146bdc=_0x4d00c3[_0x0bd5('0x3f')]['id'];return db[_0x0bd5('0x16')]['find']({'where':{'id':_0x4d00c3[_0x0bd5('0x3f')]['id']}})[_0x0bd5('0xe')](handleEntityNotFound(_0x2db9b0,null))['then'](function(_0x70d7ce){if(_0x70d7ce){return _0x70d7ce['destroy']()[_0x0bd5('0xe')](function(_0x14b74b){return _0x14b74b;});}})[_0x0bd5('0xe')](function(_0x1151ea){_0x20960a=_0x1151ea;if(_0x1151ea){if(_0x1151ea['VoiceQueueId']||_0x1151ea[_0x0bd5('0x46')]){return db[_0x1151ea['VoiceQueueId']?'VoiceQueue':_0x0bd5('0x47')][_0x0bd5('0x43')]({'where':{'id':_0x1151ea[_0x0bd5('0x48')]?_0x1151ea['VoiceQueueId']:_0x1151ea[_0x0bd5('0x46')]},'attributes':['id','name'],'raw':!![]});}}})[_0x0bd5('0xe')](function(_0x128934){var _0x473701={};if(_0x128934){_['merge'](_0x473701,_['omit'](_0x20960a['dataValues'],[_0x0bd5('0x49'),_0x0bd5('0x4a'),'id']));_0x473701[_0x0bd5('0x4b')]=0x15;_0x473701['statedesc']=_0x0bd5('0x4c');_0x473701[_0x0bd5('0x4d')]=_0x128934['name'];_0x473701[_0x0bd5('0x4e')]=_0x4d00c3['user']['name'];_0x473701[_0x0bd5('0x4f')]=_0x4d00c3[_0x0bd5('0x50')]['id'];_0x473701[_0x0bd5('0x4c')]=!![];_0x473701[_0x0bd5('0x51')]=moment()['format'](_0x0bd5('0x52'));_0x473701[_0x0bd5('0x53')]=_0x20960a[_0x0bd5('0x54')];_0x473701['campaigntype']=_0x20960a[_0x0bd5('0x48')]?_0x0bd5('0x55'):_0x0bd5('0x56');return db['CmContact']['find']({'where':{'id':_0x473701[_0x0bd5('0x57')]},'attributes':['firstName',_0x0bd5('0x58')]})[_0x0bd5('0xe')](function(_0x25e70){if(!_['isNil'](_0x2db9b0)&&!_[_0x0bd5('0x59')](_0x25e70[_0x0bd5('0x5a')])){_0x473701[_0x0bd5('0x5b')]=_0x25e70[_0x0bd5('0x5a')];if(!_['isNil'](_0x25e70[_0x0bd5('0x58')])){_0x473701[_0x0bd5('0x5b')]+='\x20'+_0x25e70[_0x0bd5('0x58')];}}})[_0x0bd5('0x5c')](function(){return db[_0x0bd5('0x5d')]['create'](_0x473701);});}})[_0x0bd5('0xe')](function(_0x4e6b26){return db[_0x0bd5('0x5e')]['destroy']({'where':{'CmHopperId':_0x146bdc}});})['then'](function(){return _0x2db9b0[_0x0bd5('0xa')](0xcc)['end']();})[_0x0bd5('0x41')](handleError(_0x2db9b0,null));};exports[_0x0bd5('0x5f')]=function(_0x6ed5,_0x5c84f9){var _0x4f7e86=[];return db[_0x0bd5('0x60')]['describe']()[_0x0bd5('0xe')](function(_0x134504){_0x4f7e86=_['keys'](_0x134504);return _0x6ed5[_0x0bd5('0x50')]['getVoiceQueues']({'where':{'type':_0x0bd5('0x61'),'dialActive':!![],'dialMethod':_0x0bd5('0x62')},'attributes':['id',_0x0bd5('0x63'),_0x0bd5('0x64')],'raw':!![]});})[_0x0bd5('0xe')](function(_0x467488){if(_0x467488&&_0x467488[_0x0bd5('0x32')]){return db['sequelize'][_0x0bd5('0x65')](function(_0x1e5e7d){var _0x33c5eb={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x0bd5('0x15')](_0x467488,'id')},'$or':[{'UserId':null},{'UserId':_0x6ed5[_0x0bd5('0x50')]['id']}]};var _0x2d7d01={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x467488)[_0x0bd5('0x38')]([_0x0bd5('0x64'),0x0])[_0x0bd5('0x15')]('id')[_0x0bd5('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x6ed5[_0x0bd5('0x50')]['id']}]};var _0x38687d={'$or':[_0x33c5eb,_0x2d7d01]};var _0x13b37b=[];if(_0x6ed5[_0x0bd5('0x42')][_0x0bd5('0x67')]&&_0x6ed5[_0x0bd5('0x42')][_0x0bd5('0x67')]===_0x0bd5('0x68')){if(!_[_0x0bd5('0x69')](_0x6ed5[_0x0bd5('0x42')][_0x0bd5('0x6a')])){_0x38687d['id']={'$in':_0x6ed5['body'][_0x0bd5('0x6a')]};}_0x13b37b=[[_0x0bd5('0x6b'),'ASC'],[_0x0bd5('0x6c'),_0x467488[0x0]['dialOrderByScheduledAt']===_0x0bd5('0x6d')?_0x0bd5('0x6e'):'ASC'],db[_0x0bd5('0x6f')][_0x0bd5('0x70')](_0x0bd5('0x71')),['id',_0x0bd5('0x6e')]];}else{if(!_[_0x0bd5('0x69')](_0x6ed5[_0x0bd5('0x42')][_0x0bd5('0x6a')])){_0x38687d['id']={'$notIn':_0x6ed5[_0x0bd5('0x42')][_0x0bd5('0x6a')]};}_0x13b37b=[['priority',_0x0bd5('0x6e')],[_0x0bd5('0x6c'),_0x467488[0x0]['dialOrderByScheduledAt']],db[_0x0bd5('0x6f')][_0x0bd5('0x70')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x0bd5('0x6d')]];}return db[_0x0bd5('0x16')]['findOne']({'attributes':['id',_0x0bd5('0x72'),'phone',_0x0bd5('0x73')],'where':_0x38687d,'order':_0x13b37b,'transaction':_0x1e5e7d,'lock':_0x1e5e7d[_0x0bd5('0x74')][_0x0bd5('0x75')],'include':[{'model':db[_0x0bd5('0x60')],'as':_0x0bd5('0x76'),'attributes':_0x4f7e86,'include':[{'model':db[_0x0bd5('0x77')],'as':_0x0bd5('0x78'),'attributes':['id',_0x0bd5('0x12')]}]},{'model':db[_0x0bd5('0x79')],'as':_0x0bd5('0x7a'),'attributes':['id',_0x0bd5('0x12')]},{'model':db[_0x0bd5('0x7b')],'as':_0x0bd5('0x7c'),'attributes':['id',_0x0bd5('0x12'),'dialActive']}]})[_0x0bd5('0xe')](function(_0x2bf49b){if(_0x2bf49b){return _0x2bf49b[_0x0bd5('0xd')]({'UserId':_0x6ed5[_0x0bd5('0x50')]['id']},{'transaction':_0x1e5e7d});}});});}})[_0x0bd5('0xe')](handleEntityNotFound(_0x5c84f9,null))[_0x0bd5('0xe')](respondWithResult(_0x5c84f9,null))['catch'](handleError(_0x5c84f9,null));};exports[_0x0bd5('0x7d')]=function(_0x37066a,_0x3a4d13,_0x371b77){var _0x3bc8cc=[];var _0x116e67=_0x37066a[_0x0bd5('0x3f')]['id'];var _0x47cd59=_0x37066a['user']['id'];return db['CmContact'][_0x0bd5('0x44')]()[_0x0bd5('0xe')](function(_0x341b28){_0x3bc8cc=_[_0x0bd5('0x1a')](_0x341b28);return db[_0x0bd5('0x6f')]['transaction'](function(_0x231792){const _0x559469={'id':_0x116e67};return db['CmHopper'][_0x0bd5('0x7e')]({'attributes':['id',_0x0bd5('0x72'),_0x0bd5('0x73')],'where':_0x559469,'transaction':_0x231792,'lock':_0x231792[_0x0bd5('0x74')][_0x0bd5('0x75')],'include':[{'model':db[_0x0bd5('0x60')],'as':_0x0bd5('0x76'),'attributes':_0x3bc8cc,'include':[{'model':db[_0x0bd5('0x77')],'as':_0x0bd5('0x78'),'attributes':['id',_0x0bd5('0x12')]}]},{'model':db[_0x0bd5('0x79')],'as':'List','attributes':['id',_0x0bd5('0x12')]},{'model':db[_0x0bd5('0x7b')],'as':_0x0bd5('0x7c'),'attributes':['id',_0x0bd5('0x12'),_0x0bd5('0x7f')]}]})['then'](function(_0x40f1a1){if(_0x40f1a1){return _0x40f1a1[_0x0bd5('0xd')]({'UserId':_0x47cd59},{'transaction':_0x231792});}});});})[_0x0bd5('0xe')](handleEntityNotFound(_0x3a4d13,null))[_0x0bd5('0xe')](respondWithResult(_0x3a4d13,null))[_0x0bd5('0x41')](handleError(_0x3a4d13,null));};exports[_0x0bd5('0x80')]=function(_0x1265ac,_0x1dca49){return _0x1265ac[_0x0bd5('0x50')][_0x0bd5('0x81')]({'where':{'type':_0x0bd5('0x61'),'dialActive':!![],'dialMethod':_0x0bd5('0x62')},'attributes':['id'],'raw':!![]})[_0x0bd5('0xe')](function(_0xcbb2fc){if(_0xcbb2fc&&_0xcbb2fc[_0x0bd5('0x32')]){return db[_0x0bd5('0x16')][_0x0bd5('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0bd5('0x82')](_0x0bd5('0x52'))},'VoiceQueueId':{'$in':_['map'](_0xcbb2fc,'id')},'$or':[{'UserId':null},{'UserId':_0x1265ac['user']['id']}]}});}return 0x0;})[_0x0bd5('0xe')](function(_0x2004fa){if(!_[_0x0bd5('0x59')](_0x2004fa)&&_[_0x0bd5('0x83')](_0x2004fa)){return _0x1dca49[_0x0bd5('0xa')](0xc8)['json']({'contacts':_0x2004fa});}else{logger[_0x0bd5('0x10')](_0x0bd5('0x84'),_0x0bd5('0x80'),0x194,_0x0bd5('0x85'));_0x1dca49[_0x0bd5('0xf')](0x194);}})['catch'](handleError(_0x1dca49,null));};exports[_0x0bd5('0x86')]=function(_0xf8ab6e,_0x7c1d11){var _0x200df8=shared[_0x0bd5('0x87')];var _0x2791b3=[];_[_0x0bd5('0x15')](_0x200df8,function(_0x23f5d0){_0x2791b3[_0x0bd5('0x88')]({'id':_0x23f5d0[_0x0bd5('0x12')],'name':_0x23f5d0[_0x0bd5('0x12')],'utcOffset':_0x23f5d0['utcOffset']});});return _0x7c1d11[_0x0bd5('0xa')](0xc8)[_0x0bd5('0x89')]({'tz':_0x2791b3});};exports[_0x0bd5('0x8a')]=function(_0xc086d0,_0x2c77eb){var _0x46a5ee=shared[_0x0bd5('0x87')];var _0x1157fd={};if(!_['isNil'](_0x46a5ee[_0xc086d0[_0x0bd5('0x42')]['id']]))_0x1157fd=_0x46a5ee[_0xc086d0[_0x0bd5('0x42')]['id']];return _0x2c77eb[_0x0bd5('0xa')](0xc8)[_0x0bd5('0x89')](_0x1157fd);};
\ No newline at end of file
index 358ed19..1577331 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2542=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x421a1d,_0x8b8445){var _0x25149a=function(_0x4d51b2){while(--_0x4d51b2){_0x421a1d['push'](_0x421a1d['shift']());}};_0x25149a(++_0x8b8445);}(_0x2542,0x169));var _0x2254=function(_0x54b556,_0x4d9b7b){_0x54b556=_0x54b556-0x0;var _0x4a952e=_0x2542[_0x54b556];return _0x4a952e;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));module[_0x2254('0x9')]=function(_0x508183,_0x19ad3c){return _0x508183[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[{'name':_0x2254('0xd'),'fields':[_0x2254('0xd')]},{'name':_0x2254('0xe'),'fields':[_0x2254('0xe')]},{'name':_0x2254('0xf'),'fields':[_0x2254('0xf')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','priority','lodash'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x326f,0xd1));var _0xf326=function(_0xaa42f9,_0x2f0d29){_0xaa42f9=_0xaa42f9-0x0;var _0xd665f1=_0x326f[_0xaa42f9];return _0xd665f1;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['scheduledat']},{'name':'phone','fields':['phone']},{'name':_0xf326('0xe'),'fields':[_0xf326('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
index bfdddfb..53bfef0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x02f7=['UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','active','transaction','MoveContactManagedDialer','COUNT','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','LOCK','GetCmHopperPreview','GetCmHopper','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','Agent','voicePause','CmList','List','NOW()','lodash','util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','CmHopper,\x20%s,\x20%s','message','catch','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','order','UPDATE','CmContact','Contact','keys','User','name','length'];(function(_0x4ac707,_0x4b874c){var _0x41c699=function(_0x36b05d){while(--_0x36b05d){_0x4ac707['push'](_0x4ac707['shift']());}};_0x41c699(++_0x4b874c);}(_0x02f7,0x1d3));var _0x702f=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x02f7[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x702f('0x0'));var util=require(_0x702f('0x1'));var moment=require(_0x702f('0x2'));var BPromise=require('bluebird');var db=require(_0x702f('0x3'))['db'];var logger=require(_0x702f('0x4'))(_0x702f('0x5'));var jayson=require(_0x702f('0x6'));var client=jayson[_0x702f('0x7')][_0x702f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47db23,_0x5f1d5d,_0x449ba1){return new BPromise(function(_0x4ff1d2,_0x69295){return client[_0x702f('0x9')](_0x47db23,_0x449ba1)[_0x702f('0xa')](function(_0xfe27d7){logger[_0x702f('0xb')]('CmHopper,\x20%s,\x20%s',_0x5f1d5d,_0x702f('0xc'));logger[_0x702f('0xd')](_0x702f('0xe'),_0x5f1d5d,'request\x20sent',JSON[_0x702f('0xf')](_0xfe27d7));if(_0xfe27d7[_0x702f('0x10')]){if(_0xfe27d7[_0x702f('0x10')]['code']===0x1f4){logger['error'](_0x702f('0x11'),_0x5f1d5d,_0xfe27d7[_0x702f('0x10')][_0x702f('0x12')]);return _0x69295(_0xfe27d7['error'][_0x702f('0x12')]);}logger[_0x702f('0x10')]('CmHopper,\x20%s,\x20%s',_0x5f1d5d,_0xfe27d7[_0x702f('0x10')][_0x702f('0x12')]);return _0x4ff1d2(_0xfe27d7[_0x702f('0x10')][_0x702f('0x12')]);}else{logger[_0x702f('0xb')](_0x702f('0x11'),_0x5f1d5d,_0x702f('0xc'));_0x4ff1d2(_0xfe27d7['result'][_0x702f('0x12')]);}})[_0x702f('0x13')](function(_0x3bef6c){logger[_0x702f('0x10')](_0x702f('0x11'),_0x5f1d5d,_0x3bef6c);_0x69295(_0x3bef6c);});});}exports['GetCmHopper']=function(_0x52f197){var _0x58ec1e=this;return new Promise(function(_0x565ad3,_0x922c85){return db[_0x702f('0x14')][_0x702f('0x15')]({'raw':_0x52f197[_0x702f('0x16')]?_0x52f197['options'][_0x702f('0x17')]===undefined?!![]:![]:!![],'where':_0x52f197['options']?_0x52f197['options'][_0x702f('0x18')]||null:null,'attributes':_0x52f197[_0x702f('0x16')]?_0x52f197[_0x702f('0x16')]['attributes']||null:null,'limit':_0x52f197[_0x702f('0x16')]?_0x52f197[_0x702f('0x16')][_0x702f('0x19')]||null:null,'include':_0x52f197['options']?_0x52f197[_0x702f('0x16')][_0x702f('0x1a')]?_[_0x702f('0x1b')](_0x52f197[_0x702f('0x16')][_0x702f('0x1a')],function(_0x431e6d){return{'model':db[_0x431e6d[_0x702f('0x1c')]],'as':_0x431e6d['as'],'attributes':_0x431e6d[_0x702f('0x1d')],'include':_0x431e6d[_0x702f('0x1a')]?_[_0x702f('0x1b')](_0x431e6d[_0x702f('0x1a')],function(_0x28a0d8){return{'model':db[_0x28a0d8[_0x702f('0x1c')]],'as':_0x28a0d8['as'],'attributes':_0x28a0d8[_0x702f('0x1d')],'include':_0x28a0d8[_0x702f('0x1a')]?_[_0x702f('0x1b')](_0x28a0d8[_0x702f('0x1a')],function(_0x5f2961){return{'model':db[_0x5f2961[_0x702f('0x1c')]],'as':_0x5f2961['as'],'attributes':_0x5f2961[_0x702f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x702f('0xa')](function(_0x244f42){logger[_0x702f('0xb')]('GetCmHopper',_0x52f197);logger[_0x702f('0xd')]('GetCmHopper',_0x52f197,JSON[_0x702f('0xf')](_0x244f42));_0x565ad3(_0x244f42);})[_0x702f('0x13')](function(_0x39d130){logger['error']('GetCmHopper',_0x39d130[_0x702f('0x12')],_0x52f197);_0x922c85(_0x58ec1e['error'](0x1f4,_0x39d130[_0x702f('0x12')]));});});};exports[_0x702f('0x1e')]=function(_0x38dde7){var _0x4c0868=this;return new Promise(function(_0xf828a6,_0x191c3f){return db[_0x702f('0x14')]['find']({'raw':_0x38dde7['options']?_0x38dde7[_0x702f('0x16')][_0x702f('0x17')]===undefined?!![]:![]:!![],'where':_0x38dde7[_0x702f('0x16')]?_0x38dde7[_0x702f('0x16')][_0x702f('0x18')]||null:null,'attributes':_0x38dde7[_0x702f('0x16')]?_0x38dde7['options'][_0x702f('0x1d')]||null:null,'include':_0x38dde7[_0x702f('0x16')]?_0x38dde7[_0x702f('0x16')][_0x702f('0x1a')]?_[_0x702f('0x1b')](_0x38dde7['options'][_0x702f('0x1a')],function(_0xba8bb0){return{'model':db[_0xba8bb0[_0x702f('0x1c')]],'as':_0xba8bb0['as'],'attributes':_0xba8bb0['attributes'],'include':_0xba8bb0[_0x702f('0x1a')]?_[_0x702f('0x1b')](_0xba8bb0[_0x702f('0x1a')],function(_0x8a908a){return{'model':db[_0x8a908a[_0x702f('0x1c')]],'as':_0x8a908a['as'],'attributes':_0x8a908a[_0x702f('0x1d')],'include':_0x8a908a[_0x702f('0x1a')]?_[_0x702f('0x1b')](_0x8a908a[_0x702f('0x1a')],function(_0x37978f){return{'model':db[_0x37978f[_0x702f('0x1c')]],'as':_0x37978f['as'],'attributes':_0x37978f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22ffbc){logger[_0x702f('0xb')](_0x702f('0x1e'),_0x38dde7);logger[_0x702f('0xd')](_0x702f('0x1e'),_0x38dde7,JSON[_0x702f('0xf')](_0x22ffbc));_0xf828a6(_0x22ffbc);})['catch'](function(_0x40ce85){logger[_0x702f('0x10')](_0x702f('0x1e'),_0x40ce85[_0x702f('0x12')],_0x38dde7);_0x191c3f(_0x4c0868[_0x702f('0x10')](0x1f4,_0x40ce85[_0x702f('0x12')]));});});};exports[_0x702f('0x1f')]=function(_0x53959d){var _0x2f17d7=this;return new Promise(function(_0x2715db,_0x250f3b){return db[_0x702f('0x14')][_0x702f('0x20')](_0x53959d[_0x702f('0x21')],{'raw':_0x53959d[_0x702f('0x16')]?_0x53959d['options']['raw']===undefined?!![]:![]:!![]})[_0x702f('0xa')](function(_0x2c071e){logger['info'](_0x702f('0x1f'),_0x53959d);logger[_0x702f('0xd')]('CreateCmHopper',_0x53959d,JSON[_0x702f('0xf')](_0x2c071e));_0x2715db(_0x2c071e);})[_0x702f('0x13')](function(_0x334630){logger[_0x702f('0x10')](_0x702f('0x1f'),_0x334630[_0x702f('0x12')],_0x53959d);_0x250f3b(_0x2f17d7[_0x702f('0x10')](0x1f4,_0x334630[_0x702f('0x12')]));});});};exports[_0x702f('0x22')]=function(_0x31ef64){var _0xbfd3c9=this;return new Promise(function(_0xbad7ce,_0x4d49ff){return db['CmHopper'][_0x702f('0x23')](_0x31ef64[_0x702f('0x21')],{'raw':_0x31ef64[_0x702f('0x16')]?_0x31ef64[_0x702f('0x16')][_0x702f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31ef64[_0x702f('0x16')]?_0x31ef64[_0x702f('0x16')][_0x702f('0x18')]||null:null,'attributes':_0x31ef64['options']?_0x31ef64['options'][_0x702f('0x1d')]||null:null,'limit':_0x31ef64[_0x702f('0x16')]?_0x31ef64[_0x702f('0x16')][_0x702f('0x19')]||null:null})['then'](function(_0x1b8d28){logger['info'](_0x702f('0x22'),_0x31ef64);logger[_0x702f('0xb')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x31ef64[_0x702f('0x16')][_0x702f('0x18')]),_0x31ef64['body']['active']);logger[_0x702f('0xd')](_0x702f('0x22'),_0x31ef64,JSON[_0x702f('0xf')](_0x1b8d28));_0xbad7ce(_0x1b8d28);})[_0x702f('0x13')](function(_0x301983){logger[_0x702f('0x10')]('UpdateCmHopper',_0x301983['message'],_0x31ef64);_0x4d49ff(_0xbfd3c9[_0x702f('0x10')](0x1f4,_0x301983[_0x702f('0x12')]));});});};exports[_0x702f('0x24')]=function(_0x3c40f1){var _0x3a86fd=this;return new Promise(function(_0x250d67,_0x4d9e5e){return db[_0x702f('0x14')][_0x702f('0x25')]({'where':_0x3c40f1['options']?_0x3c40f1[_0x702f('0x16')]['where']||null:null})['then'](function(_0x5e11b5){logger[_0x702f('0xb')](_0x702f('0x24'),_0x3c40f1);logger['debug'](_0x702f('0x24'),_0x3c40f1,JSON['stringify'](_0x5e11b5));_0x250d67(_0x5e11b5);})[_0x702f('0x13')](function(_0x3d4ae0){logger[_0x702f('0x10')](_0x702f('0x24'),_0x3d4ae0[_0x702f('0x12')],_0x3c40f1);_0x4d9e5e(_0x3a86fd[_0x702f('0x10')](0x1f4,_0x3d4ae0[_0x702f('0x12')]));});});};exports[_0x702f('0x26')]=function(_0x3f378c){var _0x8f260d=this;return new Promise(function(_0x38922b,_0x30ab3f){return db['CmContact'][_0x702f('0x27')]()[_0x702f('0xa')](function(_0x11bdfa){return db[_0x702f('0x28')]['transaction'](function(_0x13cfdc){return db[_0x702f('0x14')][_0x702f('0x15')]({'where':_0x3f378c[_0x702f('0x16')]?_0x3f378c[_0x702f('0x16')][_0x702f('0x18')]||null:null,'attributes':_0x3f378c['options']?_0x3f378c[_0x702f('0x16')][_0x702f('0x1d')]||null:null,'limit':_0x3f378c[_0x702f('0x16')]?_0x3f378c[_0x702f('0x16')]['limit']||null:null,'order':_0x3f378c[_0x702f('0x16')]?_0x3f378c[_0x702f('0x16')][_0x702f('0x29')]||null:null,'transaction':_0x13cfdc,'lock':_0x13cfdc['LOCK'][_0x702f('0x2a')],'include':[{'model':db[_0x702f('0x2b')],'as':_0x702f('0x2c'),'attributes':_[_0x702f('0x2d')](_0x11bdfa)},{'model':db[_0x702f('0x2e')],'as':'Agent','attributes':['id',_0x702f('0x2f'),'voicePause']}]})[_0x702f('0xa')](function(_0x1039f8){var _0x28ef51=[];var _0xee8e49=[];for(var _0x42c2ac=0x0;_0x42c2ac<_0x1039f8[_0x702f('0x30')];_0x42c2ac+=0x1){var _0x327600=_0x1039f8[_0x42c2ac][_0x702f('0x31')];if(_0x327600===null){_0x28ef51[_0x702f('0x32')](_0x1039f8[_0x42c2ac][_0x702f('0x23')](_0x3f378c['body'],{'transaction':_0x13cfdc}));}else if(!_0xee8e49['includes'](_0x327600)){_0xee8e49[_0x702f('0x32')](_0x327600);_0x28ef51[_0x702f('0x32')](_0x1039f8[_0x42c2ac][_0x702f('0x23')](_0x3f378c[_0x702f('0x21')],{'transaction':_0x13cfdc}));}}return BPromise[_0x702f('0x33')](_0x28ef51);});})[_0x702f('0xa')](function(_0x172e18){logger['info'](_0x702f('0x26'),_0x3f378c);if(_0x172e18[_0x702f('0x30')]>0x0){logger[_0x702f('0xb')](_0x702f('0x34'),_0x172e18[0x0]['dataValues']['id'],_0x172e18[0x0]['dataValues']['ContactId'],_0x172e18[0x0][_0x702f('0x35')][_0x702f('0x36')]);}logger[_0x702f('0xd')]('GetContactDialer',_0x3f378c,JSON['stringify'](_0x172e18));_0x38922b(_0x172e18);})[_0x702f('0x13')](function(_0x3a9d7c){logger['error'](_0x702f('0x26'),_0x3a9d7c[_0x702f('0x12')],_0x3f378c);_0x30ab3f(_0x8f260d[_0x702f('0x10')](0x1f4,_0x3a9d7c[_0x702f('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x8ee315){var _0x2c2dd6=this;return new Promise(function(_0x3a301e,_0x1118fd){return db['sequelize'][_0x702f('0x37')](function(_0x404632){return db['CmHopperFinal'][_0x702f('0x20')](_0x8ee315[_0x702f('0x21')],{'raw':_0x8ee315[_0x702f('0x16')]?_0x8ee315[_0x702f('0x16')][_0x702f('0x17')]===undefined?!![]:![]:!![],'transaction':_0x404632})[_0x702f('0xa')](function(){logger[_0x702f('0xb')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x702f('0xf')](_0x8ee315['options'][_0x702f('0x18')]),_0x8ee315[_0x702f('0x16')][_0x702f('0x18')]['active']);return db[_0x702f('0x14')]['destroy']({'where':_0x8ee315[_0x702f('0x16')]?_0x8ee315[_0x702f('0x16')][_0x702f('0x18')]||null:null,'transaction':_0x404632});});})[_0x702f('0xa')](function(_0x48601f){logger[_0x702f('0xb')]('MoveContactManagedDialer',_0x8ee315);logger[_0x702f('0xd')](_0x702f('0x38'),_0x8ee315,JSON[_0x702f('0xf')](_0x48601f));_0x3a301e(_0x48601f);})[_0x702f('0x13')](function(_0x4de3ed){logger['error'](_0x702f('0x38'),_0x4de3ed[_0x702f('0x12')],_0x8ee315);_0x1118fd(_0x2c2dd6[_0x702f('0x10')](0x1f4,_0x4de3ed[_0x702f('0x12')]));});});};exports['CountReScheduled']=function(_0x25ce32){var _0xd176b9=this;return new Promise(function(_0x7188cd,_0x47b185){return db['CmHopper']['findAll']({'raw':_0x25ce32[_0x702f('0x16')]?_0x25ce32[_0x702f('0x16')][_0x702f('0x17')]===undefined?!![]:![]:!![],'where':_0x25ce32['options']?_0x25ce32[_0x702f('0x16')][_0x702f('0x18')]||null:null,'attributes':[[db['sequelize']['fn'](_0x702f('0x39'),db[_0x702f('0x28')]['fn']('IF',db[_0x702f('0x28')]['literal']('`scheduledat`\x20>=\x20'+util['format'](_0x702f('0x3a'),moment()[_0x702f('0x3b')](_0x702f('0x3c')))+_0x702f('0x3d')))),_0x702f('0x3e')]]})['then'](function(_0x5220c5){logger[_0x702f('0xb')](_0x702f('0x3f'),_0x25ce32);logger[_0x702f('0xd')]('CountReScheduled',_0x25ce32,JSON[_0x702f('0xf')](_0x5220c5));_0x7188cd(_0x5220c5);})[_0x702f('0x13')](function(_0xdf0313){logger[_0x702f('0x10')](_0x702f('0x3f'),_0xdf0313[_0x702f('0x12')],_0x25ce32);_0x47b185(_0xd176b9[_0x702f('0x10')](0x1f4,_0xdf0313[_0x702f('0x12')]));});});};exports[_0x702f('0x40')]=function(_0x39ab89){var _0x5ac101=this;return new Promise(function(_0x48483e,_0x8d8ffe){return db[_0x702f('0x2b')]['describe']()['then'](function(_0x5508db){return db[_0x702f('0x28')][_0x702f('0x37')](function(_0x2f4447){return db['CmHopper'][_0x702f('0x15')]({'where':_0x39ab89[_0x702f('0x16')]?_0x39ab89['options']['where']||null:null,'attributes':_0x39ab89['options']?_0x39ab89[_0x702f('0x16')][_0x702f('0x1d')]||null:null,'limit':0x1,'order':_0x39ab89[_0x702f('0x16')]?_0x39ab89[_0x702f('0x16')][_0x702f('0x29')]||null:null,'group':db[_0x702f('0x14')]['UserId'],'transaction':_0x2f4447,'lock':_0x2f4447[_0x702f('0x41')]['UPDATE'],'include':_0x39ab89[_0x702f('0x16')]?_0x39ab89[_0x702f('0x16')][_0x702f('0x1a')]?_[_0x702f('0x1b')](_0x39ab89[_0x702f('0x16')][_0x702f('0x1a')],function(_0x282e9e){return{'model':db[_0x282e9e[_0x702f('0x1c')]],'as':_0x282e9e['as'],'attributes':_0x282e9e[_0x702f('0x1d')],'include':_0x282e9e[_0x702f('0x1a')]?_[_0x702f('0x1b')](_0x282e9e[_0x702f('0x1a')],function(_0x557c55){return{'model':db[_0x557c55[_0x702f('0x1c')]],'as':_0x557c55['as'],'attributes':_0x557c55[_0x702f('0x1d')],'include':_0x557c55['include']?_['map'](_0x557c55['include'],function(_0x2fb093){return{'model':db[_0x2fb093[_0x702f('0x1c')]],'as':_0x2fb093['as'],'attributes':_0x2fb093[_0x702f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x702f('0xa')](function(_0x5d1af8){var _0x4b63fa=[];for(var _0x186813=0x0;_0x186813<_0x5d1af8[_0x702f('0x30')];_0x186813+=0x1){_0x4b63fa[_0x702f('0x32')](_0x5d1af8[_0x186813][_0x702f('0x23')](_0x39ab89['body'],{'transaction':_0x2f4447}));}return BPromise[_0x702f('0x33')](_0x4b63fa);});})[_0x702f('0xa')](function(_0x43ae9a){logger[_0x702f('0xb')](_0x702f('0x40'),_0x39ab89);logger[_0x702f('0xd')](_0x702f('0x40'),_0x39ab89,JSON['stringify'](_0x43ae9a));_0x48483e(_0x43ae9a);})[_0x702f('0x13')](function(_0x1d62ab){logger[_0x702f('0x10')](_0x702f('0x40'),_0x1d62ab[_0x702f('0x12')],_0x39ab89);_0x8d8ffe(_0x5ac101[_0x702f('0x10')](0x1f4,_0x1d62ab[_0x702f('0x12')]));});});});};exports[_0x702f('0x42')]=function(_0x30d99b){var _0x2a2d33=this;return new Promise(function(_0x2fc9e8,_0x10a9e9){db[_0x702f('0x2b')][_0x702f('0x27')]()['then'](function(_0x35d658){return db[_0x702f('0x14')][_0x702f('0x15')]({'raw':_0x30d99b[_0x702f('0x16')]?_0x30d99b[_0x702f('0x16')][_0x702f('0x17')]===undefined?!![]:![]:!![],'where':_0x30d99b[_0x702f('0x16')]?_0x30d99b[_0x702f('0x16')][_0x702f('0x18')]||null:null,'attributes':_0x30d99b['options']?_0x30d99b[_0x702f('0x16')][_0x702f('0x1d')]||null:null,'limit':_0x30d99b[_0x702f('0x16')]?_0x30d99b['options']['limit']||null:null,'include':_0x30d99b[_0x702f('0x16')]?_0x30d99b['options'][_0x702f('0x1a')]?_[_0x702f('0x1b')](_0x30d99b[_0x702f('0x16')]['include'],function(_0x417eb2){return{'model':db[_0x417eb2['model']],'as':_0x417eb2['as'],'attributes':_0x417eb2['as']===_0x702f('0x2c')?_[_0x702f('0x2d')](_0x35d658):_0x417eb2[_0x702f('0x1d')],'include':_0x417eb2[_0x702f('0x1a')]?_[_0x702f('0x1b')](_0x417eb2[_0x702f('0x1a')],function(_0x13f589){return{'model':db[_0x13f589[_0x702f('0x1c')]],'as':_0x13f589['as'],'attributes':_0x13f589['attributes'],'include':_0x13f589[_0x702f('0x1a')]?_[_0x702f('0x1b')](_0x13f589[_0x702f('0x1a')],function(_0x4cf9e0){return{'model':db[_0x4cf9e0[_0x702f('0x1c')]],'as':_0x4cf9e0['as'],'attributes':_0x4cf9e0[_0x702f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x702f('0xa')](function(_0xe0c781){logger['info'](_0x702f('0x43'),_0x30d99b);logger[_0x702f('0xd')](_0x702f('0x43'),_0x30d99b,JSON['stringify'](_0xe0c781));_0x2fc9e8(_0xe0c781);})[_0x702f('0x13')](function(_0x45c4fe){logger[_0x702f('0x10')]('GetCmHopper',_0x45c4fe['message'],_0x30d99b);_0x10a9e9(_0x2a2d33[_0x702f('0x10')](0x1f4,_0x45c4fe[_0x702f('0x12')]));});});});};exports[_0x702f('0x44')]=function(_0x3735a){var _0x130edb=this;return new Promise(function(_0x3efc69,_0x2083ab){return db[_0x702f('0x2b')][_0x702f('0x45')]({'raw':!![],'where':{'phone':_0x3735a[_0x702f('0x16')][_0x702f('0x18')][_0x702f('0x46')]},'attributes':['id',_0x702f('0x47')],'order':[['id','DESC']]})[_0x702f('0xa')](function(_0x5bde0f){logger[_0x702f('0xb')](_0x702f('0x48'),_0x3735a);logger['debug'](_0x702f('0x48'),_0x3735a,JSON[_0x702f('0xf')](_0x5bde0f));_0x3efc69(_0x5bde0f);})['catch'](function(_0x2df7e2){logger[_0x702f('0x10')](_0x702f('0x48'),_0x2df7e2[_0x702f('0x12')],_0x3735a);_0x2083ab(_0x130edb[_0x702f('0x10')](0x1f4,_0x2df7e2[_0x702f('0x12')]));});});};exports['ResetActiveCalls']=function(_0x56abbe){var _0x45c8d5=this;return new Promise(function(_0x806719,_0x1dab3d){return db[_0x702f('0x28')][_0x702f('0x37')](function(_0x56316a){return db[_0x702f('0x14')][_0x702f('0x23')]({'active':![]},{'where':{},'transaction':_0x56316a})[_0x702f('0xa')](function(_0xae8080){logger['info'](_0x702f('0x49'),_0x56abbe);logger[_0x702f('0xd')](_0x702f('0x49'),_0x56abbe,JSON['stringify'](_0xae8080));_0x806719(_0xae8080);})[_0x702f('0x13')](function(_0x479072){logger[_0x702f('0x10')](_0x702f('0x49'),_0x479072[_0x702f('0x12')],_0x56abbe);_0x1dab3d(_0x45c8d5['error'](0x1f4,_0x479072[_0x702f('0x12')]));});});});};exports[_0x702f('0x4a')]=function(_0xe80cce){var _0x11a40b=this;var _0x5aab40=_0xe80cce['body'][_0x702f('0x18')][_0x702f('0x4b')];var _0x40dea0=_0xe80cce['body'][_0x702f('0x18')][_0x702f('0x4c')];var _0x352531=_0xe80cce[_0x702f('0x21')][_0x702f('0x18')][_0x702f('0x4d')];return new Promise(function(_0x40e7ac,_0x442af0){return db[_0x702f('0x14')][_0x702f('0x15')]({'where':{'voiceQueueId':{'$in':_0x5aab40},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x702f('0x28')][_0x702f('0x4e')](_0x702f('0x4f')+_0x40dea0+_0x702f('0x50')),'$gt':db[_0x702f('0x28')][_0x702f('0x4e')]('NOW()')}},'UserId':{'$in':_0x352531}},'include':[{'model':db[_0x702f('0x2b')],'as':_0x702f('0x2c')},{'model':db[_0x702f('0x2e')],'as':_0x702f('0x51'),'attributes':['id',_0x702f('0x2f'),_0x702f('0x52')]},{'model':db[_0x702f('0x53')],'as':_0x702f('0x54')}]})['then'](function(_0xd057c2){if(_0xd057c2[_0x702f('0x30')]>0x0){return db[_0x702f('0x28')]['transaction'](function(_0xd3b63f){return db['CmHopper'][_0x702f('0x23')]({'recallmeNotifiedDate':db[_0x702f('0x28')][_0x702f('0x4e')](_0x702f('0x55'))},{'where':{'id':{'$in':_[_0x702f('0x1b')](_0xd057c2,'id')}},'transaction':_0xd3b63f})[_0x702f('0xa')](function(){_0x40e7ac(_0xd057c2);})['catch'](function(_0x4b1329){logger['error'](_0x702f('0x4a'),_0x4b1329[_0x702f('0x12')],_0xe80cce);_0x442af0(_0x11a40b['error'](0x1f4,_0x4b1329[_0x702f('0x12')]));});})['catch'](function(_0xacda8e){logger[_0x702f('0x10')](_0x702f('0x4a'),_0xacda8e['message'],_0xe80cce);_0x442af0(_0x11a40b[_0x702f('0x10')](0x1f4,_0xacda8e[_0x702f('0x12')]));});}else{_0x40e7ac(_0xd057c2);}});});};
\ No newline at end of file
+var _0x7732=['push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','LOCK','GetCmHopperPreview','Contact','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Agent','voicePause','CmList','List','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetCmHopper','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowCmHopper','CmHopper','CreateCmHopper','create','body','update','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','order','UPDATE','CmContact','keys','User','name','length','UserId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7732,0x7d));var _0x2773=function(_0x102881,_0x58d723){_0x102881=_0x102881-0x0;var _0x5c63d0=_0x7732[_0x102881];return _0x5c63d0;};'use strict';var _=require(_0x2773('0x0'));var util=require(_0x2773('0x1'));var moment=require('moment');var BPromise=require(_0x2773('0x2'));var db=require(_0x2773('0x3'))['db'];var logger=require(_0x2773('0x4'))(_0x2773('0x5'));var jayson=require(_0x2773('0x6'));var client=jayson[_0x2773('0x7')][_0x2773('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36d474,_0x4c134b,_0x46daee){return new BPromise(function(_0x445c0e,_0x5f098b){return client[_0x2773('0x9')](_0x36d474,_0x46daee)[_0x2773('0xa')](function(_0x3f04dd){logger['info'](_0x2773('0xb'),_0x4c134b,'request\x20sent');logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0x4c134b,_0x2773('0xc'),JSON[_0x2773('0xd')](_0x3f04dd));if(_0x3f04dd[_0x2773('0xe')]){if(_0x3f04dd[_0x2773('0xe')]['code']===0x1f4){logger['error'](_0x2773('0xb'),_0x4c134b,_0x3f04dd[_0x2773('0xe')][_0x2773('0xf')]);return _0x5f098b(_0x3f04dd[_0x2773('0xe')]['message']);}logger[_0x2773('0xe')]('CmHopper,\x20%s,\x20%s',_0x4c134b,_0x3f04dd['error'][_0x2773('0xf')]);return _0x445c0e(_0x3f04dd[_0x2773('0xe')][_0x2773('0xf')]);}else{logger[_0x2773('0x10')](_0x2773('0xb'),_0x4c134b,_0x2773('0xc'));_0x445c0e(_0x3f04dd[_0x2773('0x11')][_0x2773('0xf')]);}})[_0x2773('0x12')](function(_0x421c9b){logger[_0x2773('0xe')](_0x2773('0xb'),_0x4c134b,_0x421c9b);_0x5f098b(_0x421c9b);});});}exports[_0x2773('0x13')]=function(_0x50fefe){var _0x490719=this;return new Promise(function(_0xa44f8d,_0x10c79f){return db['CmHopper'][_0x2773('0x14')]({'raw':_0x50fefe[_0x2773('0x15')]?_0x50fefe[_0x2773('0x15')][_0x2773('0x16')]===undefined?!![]:![]:!![],'where':_0x50fefe[_0x2773('0x15')]?_0x50fefe[_0x2773('0x15')][_0x2773('0x17')]||null:null,'attributes':_0x50fefe['options']?_0x50fefe[_0x2773('0x15')][_0x2773('0x18')]||null:null,'limit':_0x50fefe[_0x2773('0x15')]?_0x50fefe[_0x2773('0x15')][_0x2773('0x19')]||null:null,'include':_0x50fefe['options']?_0x50fefe[_0x2773('0x15')][_0x2773('0x1a')]?_[_0x2773('0x1b')](_0x50fefe['options'][_0x2773('0x1a')],function(_0x1087e5){return{'model':db[_0x1087e5[_0x2773('0x1c')]],'as':_0x1087e5['as'],'attributes':_0x1087e5['attributes'],'include':_0x1087e5[_0x2773('0x1a')]?_['map'](_0x1087e5[_0x2773('0x1a')],function(_0xbae5a2){return{'model':db[_0xbae5a2[_0x2773('0x1c')]],'as':_0xbae5a2['as'],'attributes':_0xbae5a2['attributes'],'include':_0xbae5a2[_0x2773('0x1a')]?_['map'](_0xbae5a2[_0x2773('0x1a')],function(_0x3000c1){return{'model':db[_0x3000c1[_0x2773('0x1c')]],'as':_0x3000c1['as'],'attributes':_0x3000c1['attributes']};}):[]};}):[]};}):[]:[]})[_0x2773('0xa')](function(_0x49f5b5){logger[_0x2773('0x10')]('GetCmHopper',_0x50fefe);logger[_0x2773('0x1d')](_0x2773('0x13'),_0x50fefe,JSON[_0x2773('0xd')](_0x49f5b5));_0xa44f8d(_0x49f5b5);})[_0x2773('0x12')](function(_0x21ad6b){logger[_0x2773('0xe')]('GetCmHopper',_0x21ad6b['message'],_0x50fefe);_0x10c79f(_0x490719['error'](0x1f4,_0x21ad6b[_0x2773('0xf')]));});});};exports[_0x2773('0x1e')]=function(_0x70f1ad){var _0x58b8df=this;return new Promise(function(_0x428f13,_0x44227c){return db[_0x2773('0x1f')]['find']({'raw':_0x70f1ad[_0x2773('0x15')]?_0x70f1ad['options'][_0x2773('0x16')]===undefined?!![]:![]:!![],'where':_0x70f1ad[_0x2773('0x15')]?_0x70f1ad['options'][_0x2773('0x17')]||null:null,'attributes':_0x70f1ad[_0x2773('0x15')]?_0x70f1ad[_0x2773('0x15')][_0x2773('0x18')]||null:null,'include':_0x70f1ad[_0x2773('0x15')]?_0x70f1ad[_0x2773('0x15')][_0x2773('0x1a')]?_['map'](_0x70f1ad['options'][_0x2773('0x1a')],function(_0x165c0e){return{'model':db[_0x165c0e[_0x2773('0x1c')]],'as':_0x165c0e['as'],'attributes':_0x165c0e['attributes'],'include':_0x165c0e[_0x2773('0x1a')]?_[_0x2773('0x1b')](_0x165c0e[_0x2773('0x1a')],function(_0x2c50e9){return{'model':db[_0x2c50e9[_0x2773('0x1c')]],'as':_0x2c50e9['as'],'attributes':_0x2c50e9[_0x2773('0x18')],'include':_0x2c50e9[_0x2773('0x1a')]?_['map'](_0x2c50e9[_0x2773('0x1a')],function(_0x162722){return{'model':db[_0x162722['model']],'as':_0x162722['as'],'attributes':_0x162722[_0x2773('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15cd82){logger[_0x2773('0x10')](_0x2773('0x1e'),_0x70f1ad);logger[_0x2773('0x1d')]('ShowCmHopper',_0x70f1ad,JSON[_0x2773('0xd')](_0x15cd82));_0x428f13(_0x15cd82);})[_0x2773('0x12')](function(_0x226dac){logger[_0x2773('0xe')](_0x2773('0x1e'),_0x226dac[_0x2773('0xf')],_0x70f1ad);_0x44227c(_0x58b8df[_0x2773('0xe')](0x1f4,_0x226dac[_0x2773('0xf')]));});});};exports[_0x2773('0x20')]=function(_0x3c8051){var _0x16c78a=this;return new Promise(function(_0x4c15b1,_0x5f53cb){return db['CmHopper'][_0x2773('0x21')](_0x3c8051[_0x2773('0x22')],{'raw':_0x3c8051[_0x2773('0x15')]?_0x3c8051['options'][_0x2773('0x16')]===undefined?!![]:![]:!![]})[_0x2773('0xa')](function(_0x46aa0b){logger[_0x2773('0x10')](_0x2773('0x20'),_0x3c8051);logger[_0x2773('0x1d')](_0x2773('0x20'),_0x3c8051,JSON[_0x2773('0xd')](_0x46aa0b));_0x4c15b1(_0x46aa0b);})[_0x2773('0x12')](function(_0x6c9726){logger[_0x2773('0xe')]('CreateCmHopper',_0x6c9726[_0x2773('0xf')],_0x3c8051);_0x5f53cb(_0x16c78a[_0x2773('0xe')](0x1f4,_0x6c9726[_0x2773('0xf')]));});});};exports['UpdateCmHopper']=function(_0x1bd090){var _0x576030=this;return new Promise(function(_0x212cdc,_0x3b5a18){return db[_0x2773('0x1f')][_0x2773('0x23')](_0x1bd090[_0x2773('0x22')],{'raw':_0x1bd090[_0x2773('0x15')]?_0x1bd090[_0x2773('0x15')][_0x2773('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bd090[_0x2773('0x15')]?_0x1bd090[_0x2773('0x15')][_0x2773('0x17')]||null:null,'attributes':_0x1bd090['options']?_0x1bd090[_0x2773('0x15')][_0x2773('0x18')]||null:null,'limit':_0x1bd090[_0x2773('0x15')]?_0x1bd090[_0x2773('0x15')][_0x2773('0x19')]||null:null})[_0x2773('0xa')](function(_0x505f9e){logger[_0x2773('0x10')](_0x2773('0x24'),_0x1bd090);logger[_0x2773('0x10')](_0x2773('0x25'),JSON[_0x2773('0xd')](_0x1bd090['options'][_0x2773('0x17')]),_0x1bd090[_0x2773('0x22')][_0x2773('0x26')]);logger[_0x2773('0x1d')](_0x2773('0x24'),_0x1bd090,JSON[_0x2773('0xd')](_0x505f9e));_0x212cdc(_0x505f9e);})[_0x2773('0x12')](function(_0x318ab7){logger['error'](_0x2773('0x24'),_0x318ab7['message'],_0x1bd090);_0x3b5a18(_0x576030[_0x2773('0xe')](0x1f4,_0x318ab7[_0x2773('0xf')]));});});};exports[_0x2773('0x27')]=function(_0x622fa8){var _0x4de892=this;return new Promise(function(_0x109db3,_0x5bbfc1){return db[_0x2773('0x1f')][_0x2773('0x28')]({'where':_0x622fa8['options']?_0x622fa8[_0x2773('0x15')][_0x2773('0x17')]||null:null})['then'](function(_0x40f0a3){logger[_0x2773('0x10')](_0x2773('0x27'),_0x622fa8);logger[_0x2773('0x1d')](_0x2773('0x27'),_0x622fa8,JSON['stringify'](_0x40f0a3));_0x109db3(_0x40f0a3);})[_0x2773('0x12')](function(_0x3716e9){logger[_0x2773('0xe')](_0x2773('0x27'),_0x3716e9[_0x2773('0xf')],_0x622fa8);_0x5bbfc1(_0x4de892[_0x2773('0xe')](0x1f4,_0x3716e9[_0x2773('0xf')]));});});};exports[_0x2773('0x29')]=function(_0x1c1729){var _0x171952=this;return new Promise(function(_0x28a119,_0xb339d9){return db['CmContact'][_0x2773('0x2a')]()[_0x2773('0xa')](function(_0x18db9c){return db[_0x2773('0x2b')][_0x2773('0x2c')](function(_0x231a0b){return db[_0x2773('0x1f')][_0x2773('0x14')]({'where':_0x1c1729[_0x2773('0x15')]?_0x1c1729[_0x2773('0x15')][_0x2773('0x17')]||null:null,'attributes':_0x1c1729[_0x2773('0x15')]?_0x1c1729[_0x2773('0x15')][_0x2773('0x18')]||null:null,'limit':_0x1c1729['options']?_0x1c1729[_0x2773('0x15')]['limit']||null:null,'order':_0x1c1729[_0x2773('0x15')]?_0x1c1729['options'][_0x2773('0x2d')]||null:null,'transaction':_0x231a0b,'lock':_0x231a0b['LOCK'][_0x2773('0x2e')],'include':[{'model':db[_0x2773('0x2f')],'as':'Contact','attributes':_[_0x2773('0x30')](_0x18db9c)},{'model':db[_0x2773('0x31')],'as':'Agent','attributes':['id',_0x2773('0x32'),'voicePause']}]})[_0x2773('0xa')](function(_0x556e1a){var _0x1298b8=[];var _0x1764e1=[];for(var _0x204aff=0x0;_0x204aff<_0x556e1a[_0x2773('0x33')];_0x204aff+=0x1){var _0x58a634=_0x556e1a[_0x204aff][_0x2773('0x34')];if(_0x58a634===null){_0x1298b8[_0x2773('0x35')](_0x556e1a[_0x204aff][_0x2773('0x23')](_0x1c1729[_0x2773('0x22')],{'transaction':_0x231a0b}));}else if(!_0x1764e1[_0x2773('0x36')](_0x58a634)){_0x1764e1[_0x2773('0x35')](_0x58a634);_0x1298b8['push'](_0x556e1a[_0x204aff][_0x2773('0x23')](_0x1c1729[_0x2773('0x22')],{'transaction':_0x231a0b}));}}return BPromise[_0x2773('0x37')](_0x1298b8);});})['then'](function(_0x2845ee){logger[_0x2773('0x10')]('GetContactDialer',_0x1c1729);if(_0x2845ee[_0x2773('0x33')]>0x0){logger['info'](_0x2773('0x38'),_0x2845ee[0x0][_0x2773('0x39')]['id'],_0x2845ee[0x0]['dataValues'][_0x2773('0x3a')],_0x2845ee[0x0][_0x2773('0x39')][_0x2773('0x26')]);}logger[_0x2773('0x1d')](_0x2773('0x29'),_0x1c1729,JSON['stringify'](_0x2845ee));_0x28a119(_0x2845ee);})[_0x2773('0x12')](function(_0xd99ad8){logger['error'](_0x2773('0x29'),_0xd99ad8[_0x2773('0xf')],_0x1c1729);_0xb339d9(_0x171952[_0x2773('0xe')](0x1f4,_0xd99ad8['message']));});});});};exports[_0x2773('0x3b')]=function(_0x510743){var _0x209c70=this;return new Promise(function(_0x313656,_0xe3e465){return db['sequelize']['transaction'](function(_0x40e30f){return db[_0x2773('0x3c')]['create'](_0x510743[_0x2773('0x22')],{'raw':_0x510743[_0x2773('0x15')]?_0x510743['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x40e30f})['then'](function(){logger[_0x2773('0x10')](_0x2773('0x3d'),JSON['stringify'](_0x510743['options'][_0x2773('0x17')]),_0x510743[_0x2773('0x15')][_0x2773('0x17')][_0x2773('0x26')]);return db[_0x2773('0x1f')][_0x2773('0x28')]({'where':_0x510743['options']?_0x510743[_0x2773('0x15')][_0x2773('0x17')]||null:null,'transaction':_0x40e30f});});})['then'](function(_0x478271){logger['info']('MoveContactManagedDialer',_0x510743);logger['debug'](_0x2773('0x3b'),_0x510743,JSON[_0x2773('0xd')](_0x478271));_0x313656(_0x478271);})[_0x2773('0x12')](function(_0x1eeb66){logger[_0x2773('0xe')](_0x2773('0x3b'),_0x1eeb66[_0x2773('0xf')],_0x510743);_0xe3e465(_0x209c70[_0x2773('0xe')](0x1f4,_0x1eeb66[_0x2773('0xf')]));});});};exports[_0x2773('0x3e')]=function(_0x2c10dd){var _0x4bb5e1=this;return new Promise(function(_0x559e81,_0x42f6a7){return db['CmHopper'][_0x2773('0x14')]({'raw':_0x2c10dd[_0x2773('0x15')]?_0x2c10dd[_0x2773('0x15')][_0x2773('0x16')]===undefined?!![]:![]:!![],'where':_0x2c10dd[_0x2773('0x15')]?_0x2c10dd[_0x2773('0x15')][_0x2773('0x17')]||null:null,'attributes':[[db['sequelize']['fn'](_0x2773('0x3f'),db[_0x2773('0x2b')]['fn']('IF',db[_0x2773('0x2b')][_0x2773('0x40')](_0x2773('0x41')+util[_0x2773('0x42')](_0x2773('0x43'),moment()['format'](_0x2773('0x44')))+'\x20,\x201,\x20null'))),_0x2773('0x45')]]})['then'](function(_0x5b3e1a){logger[_0x2773('0x10')](_0x2773('0x3e'),_0x2c10dd);logger[_0x2773('0x1d')]('CountReScheduled',_0x2c10dd,JSON[_0x2773('0xd')](_0x5b3e1a));_0x559e81(_0x5b3e1a);})['catch'](function(_0x34c7ba){logger['error'](_0x2773('0x3e'),_0x34c7ba[_0x2773('0xf')],_0x2c10dd);_0x42f6a7(_0x4bb5e1['error'](0x1f4,_0x34c7ba[_0x2773('0xf')]));});});};exports[_0x2773('0x46')]=function(_0x1f298b){var _0x5d7c6f=this;return new Promise(function(_0x1d65f9,_0x5c96c9){return db[_0x2773('0x2f')]['describe']()[_0x2773('0xa')](function(_0x3c7e76){return db['sequelize'][_0x2773('0x2c')](function(_0x4d5fad){return db['CmHopper'][_0x2773('0x14')]({'where':_0x1f298b[_0x2773('0x15')]?_0x1f298b[_0x2773('0x15')][_0x2773('0x17')]||null:null,'attributes':_0x1f298b[_0x2773('0x15')]?_0x1f298b[_0x2773('0x15')]['attributes']||null:null,'limit':0x1,'order':_0x1f298b[_0x2773('0x15')]?_0x1f298b[_0x2773('0x15')][_0x2773('0x2d')]||null:null,'group':db[_0x2773('0x1f')][_0x2773('0x34')],'transaction':_0x4d5fad,'lock':_0x4d5fad[_0x2773('0x47')][_0x2773('0x2e')],'include':_0x1f298b[_0x2773('0x15')]?_0x1f298b[_0x2773('0x15')][_0x2773('0x1a')]?_['map'](_0x1f298b[_0x2773('0x15')][_0x2773('0x1a')],function(_0xd89d77){return{'model':db[_0xd89d77['model']],'as':_0xd89d77['as'],'attributes':_0xd89d77[_0x2773('0x18')],'include':_0xd89d77[_0x2773('0x1a')]?_[_0x2773('0x1b')](_0xd89d77[_0x2773('0x1a')],function(_0x4169ca){return{'model':db[_0x4169ca[_0x2773('0x1c')]],'as':_0x4169ca['as'],'attributes':_0x4169ca[_0x2773('0x18')],'include':_0x4169ca['include']?_['map'](_0x4169ca['include'],function(_0x2fdac8){return{'model':db[_0x2fdac8['model']],'as':_0x2fdac8['as'],'attributes':_0x2fdac8[_0x2773('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2773('0xa')](function(_0x3a79ef){var _0x3c5549=[];for(var _0x23dd30=0x0;_0x23dd30<_0x3a79ef[_0x2773('0x33')];_0x23dd30+=0x1){_0x3c5549['push'](_0x3a79ef[_0x23dd30][_0x2773('0x23')](_0x1f298b[_0x2773('0x22')],{'transaction':_0x4d5fad}));}return BPromise[_0x2773('0x37')](_0x3c5549);});})['then'](function(_0x333106){logger[_0x2773('0x10')](_0x2773('0x46'),_0x1f298b);logger[_0x2773('0x1d')](_0x2773('0x46'),_0x1f298b,JSON[_0x2773('0xd')](_0x333106));_0x1d65f9(_0x333106);})[_0x2773('0x12')](function(_0x441118){logger[_0x2773('0xe')](_0x2773('0x46'),_0x441118[_0x2773('0xf')],_0x1f298b);_0x5c96c9(_0x5d7c6f['error'](0x1f4,_0x441118['message']));});});});};exports[_0x2773('0x48')]=function(_0x2e0713){var _0x509166=this;return new Promise(function(_0x4455a3,_0x12de36){db[_0x2773('0x2f')][_0x2773('0x2a')]()[_0x2773('0xa')](function(_0x1455da){return db[_0x2773('0x1f')][_0x2773('0x14')]({'raw':_0x2e0713[_0x2773('0x15')]?_0x2e0713['options'][_0x2773('0x16')]===undefined?!![]:![]:!![],'where':_0x2e0713[_0x2773('0x15')]?_0x2e0713[_0x2773('0x15')][_0x2773('0x17')]||null:null,'attributes':_0x2e0713[_0x2773('0x15')]?_0x2e0713[_0x2773('0x15')][_0x2773('0x18')]||null:null,'limit':_0x2e0713[_0x2773('0x15')]?_0x2e0713[_0x2773('0x15')][_0x2773('0x19')]||null:null,'include':_0x2e0713['options']?_0x2e0713[_0x2773('0x15')]['include']?_[_0x2773('0x1b')](_0x2e0713[_0x2773('0x15')][_0x2773('0x1a')],function(_0x45efe2){return{'model':db[_0x45efe2[_0x2773('0x1c')]],'as':_0x45efe2['as'],'attributes':_0x45efe2['as']===_0x2773('0x49')?_[_0x2773('0x30')](_0x1455da):_0x45efe2[_0x2773('0x18')],'include':_0x45efe2['include']?_['map'](_0x45efe2[_0x2773('0x1a')],function(_0x26c4ff){return{'model':db[_0x26c4ff['model']],'as':_0x26c4ff['as'],'attributes':_0x26c4ff[_0x2773('0x18')],'include':_0x26c4ff['include']?_[_0x2773('0x1b')](_0x26c4ff[_0x2773('0x1a')],function(_0x962729){return{'model':db[_0x962729[_0x2773('0x1c')]],'as':_0x962729['as'],'attributes':_0x962729[_0x2773('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2773('0xa')](function(_0x3fff6f){logger['info'](_0x2773('0x13'),_0x2e0713);logger[_0x2773('0x1d')](_0x2773('0x13'),_0x2e0713,JSON[_0x2773('0xd')](_0x3fff6f));_0x4455a3(_0x3fff6f);})[_0x2773('0x12')](function(_0x2f1fde){logger[_0x2773('0xe')](_0x2773('0x13'),_0x2f1fde[_0x2773('0xf')],_0x2e0713);_0x12de36(_0x509166['error'](0x1f4,_0x2f1fde['message']));});});});};exports['GetContactByPhone']=function(_0x115762){var _0x5dcef5=this;return new Promise(function(_0xc871ca,_0x55e01c){return db['CmContact'][_0x2773('0x4a')]({'raw':!![],'where':{'phone':_0x115762[_0x2773('0x15')][_0x2773('0x17')][_0x2773('0x4b')]},'attributes':['id',_0x2773('0x4c')],'order':[['id',_0x2773('0x4d')]]})[_0x2773('0xa')](function(_0x2fa7a2){logger[_0x2773('0x10')](_0x2773('0x4e'),_0x115762);logger['debug'](_0x2773('0x4e'),_0x115762,JSON[_0x2773('0xd')](_0x2fa7a2));_0xc871ca(_0x2fa7a2);})['catch'](function(_0x51fbf9){logger[_0x2773('0xe')](_0x2773('0x4e'),_0x51fbf9[_0x2773('0xf')],_0x115762);_0x55e01c(_0x5dcef5[_0x2773('0xe')](0x1f4,_0x51fbf9[_0x2773('0xf')]));});});};exports[_0x2773('0x4f')]=function(_0x36d317){var _0x4d0cf5=this;return new Promise(function(_0x210da0,_0x30d8ce){return db[_0x2773('0x2b')][_0x2773('0x2c')](function(_0x305a45){return db[_0x2773('0x1f')][_0x2773('0x23')]({'active':![]},{'where':{},'transaction':_0x305a45})[_0x2773('0xa')](function(_0x587c2c){logger[_0x2773('0x10')](_0x2773('0x4f'),_0x36d317);logger[_0x2773('0x1d')](_0x2773('0x4f'),_0x36d317,JSON['stringify'](_0x587c2c));_0x210da0(_0x587c2c);})['catch'](function(_0x28dbbd){logger[_0x2773('0xe')](_0x2773('0x4f'),_0x28dbbd['message'],_0x36d317);_0x30d8ce(_0x4d0cf5[_0x2773('0xe')](0x1f4,_0x28dbbd[_0x2773('0xf')]));});});});};exports[_0x2773('0x50')]=function(_0x40588e){var _0x261ee9=this;var _0x8af64d=_0x40588e['body']['where']['voiceQueueIds'];var _0x110780=_0x40588e[_0x2773('0x22')][_0x2773('0x17')]['interval'];var _0x146776=_0x40588e[_0x2773('0x22')][_0x2773('0x17')][_0x2773('0x51')];return new Promise(function(_0x1861ab,_0x38c709){return db['CmHopper'][_0x2773('0x14')]({'where':{'voiceQueueId':{'$in':_0x8af64d},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x2773('0x40')](_0x2773('0x52')+_0x110780+_0x2773('0x53')),'$gt':db['sequelize'][_0x2773('0x40')](_0x2773('0x54'))}},'UserId':{'$in':_0x146776}},'include':[{'model':db[_0x2773('0x2f')],'as':'Contact'},{'model':db[_0x2773('0x31')],'as':_0x2773('0x55'),'attributes':['id',_0x2773('0x32'),_0x2773('0x56')]},{'model':db[_0x2773('0x57')],'as':_0x2773('0x58')}]})[_0x2773('0xa')](function(_0xcca37f){if(_0xcca37f['length']>0x0){return db[_0x2773('0x2b')][_0x2773('0x2c')](function(_0x2df557){return db[_0x2773('0x1f')][_0x2773('0x23')]({'recallmeNotifiedDate':db[_0x2773('0x2b')][_0x2773('0x40')](_0x2773('0x54'))},{'where':{'id':{'$in':_[_0x2773('0x1b')](_0xcca37f,'id')}},'transaction':_0x2df557})[_0x2773('0xa')](function(){_0x1861ab(_0xcca37f);})[_0x2773('0x12')](function(_0x2eb8ed){logger['error'](_0x2773('0x50'),_0x2eb8ed['message'],_0x40588e);_0x38c709(_0x261ee9[_0x2773('0xe')](0x1f4,_0x2eb8ed['message']));});})['catch'](function(_0x12a9c7){logger[_0x2773('0xe')]('CmHopperHandlePreviewRecallNotifications',_0x12a9c7['message'],_0x40588e);_0x38c709(_0x261ee9['error'](0x1f4,_0x12a9c7[_0x2773('0xf')]));});}else{_0x1861ab(_0xcca37f);}});});};
\ No newline at end of file
index b73bd2d..2fee17e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x81a9=['getTimezones','/:id','getPreviewRecall','post','create','/preview','getPreview','/timezone','delete','exports','express','Router','./cmHopper.controller','get','isAuthenticated','/describe','describe','getOpenContacts'];(function(_0x401997,_0x222c54){var _0x416ec6=function(_0x355ea9){while(--_0x355ea9){_0x401997['push'](_0x401997['shift']());}};_0x416ec6(++_0x222c54);}(_0x81a9,0x160));var _0x981a=function(_0x5a3d02,_0x4aadba){_0x5a3d02=_0x5a3d02-0x0;var _0x23203a=_0x81a9[_0x5a3d02];return _0x23203a;};'use strict';var express=require(_0x981a('0x0'));var router=express[_0x981a('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x981a('0x2'));router[_0x981a('0x3')]('/',auth[_0x981a('0x4')](),controller['index']);router['get'](_0x981a('0x5'),auth['isAuthenticated'](),controller[_0x981a('0x6')]);router[_0x981a('0x3')]('/opencontacts',auth[_0x981a('0x4')](),controller[_0x981a('0x7')]);router[_0x981a('0x3')]('/timezones',auth['isAuthenticated'](),controller[_0x981a('0x8')]);router[_0x981a('0x3')](_0x981a('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x981a('0x3')]('/:id/previewrecall',auth[_0x981a('0x4')](),controller[_0x981a('0xa')]);router[_0x981a('0xb')]('/',auth[_0x981a('0x4')](),controller[_0x981a('0xc')]);router[_0x981a('0xb')](_0x981a('0xd'),auth['isAuthenticated'](),controller[_0x981a('0xe')]);router[_0x981a('0xb')](_0x981a('0xf'),auth[_0x981a('0x4')](),controller['getTimezone']);router['put'](_0x981a('0x9'),auth[_0x981a('0x4')](),controller['update']);router[_0x981a('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x981a('0x11')]=router;
\ No newline at end of file
+var _0xedae=['show','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','getTimezone','put','delete','Router','../../components/auth/service','./cmHopper.controller','get','index','/describe','isAuthenticated','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id'];(function(_0x39277e,_0x2cb1f8){var _0x450746=function(_0x89aab9){while(--_0x89aab9){_0x39277e['push'](_0x39277e['shift']());}};_0x450746(++_0x2cb1f8);}(_0xedae,0x12f));var _0xeeda=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xedae[_0x501510];return _0x1e6ee5;};'use strict';var express=require('express');var router=express[_0xeeda('0x0')]();var auth=require(_0xeeda('0x1'));var controller=require(_0xeeda('0x2'));router[_0xeeda('0x3')]('/',auth['isAuthenticated'](),controller[_0xeeda('0x4')]);router[_0xeeda('0x3')](_0xeeda('0x5'),auth[_0xeeda('0x6')](),controller['describe']);router[_0xeeda('0x3')](_0xeeda('0x7'),auth[_0xeeda('0x6')](),controller[_0xeeda('0x8')]);router[_0xeeda('0x3')](_0xeeda('0x9'),auth[_0xeeda('0x6')](),controller[_0xeeda('0xa')]);router['get'](_0xeeda('0xb'),auth['isAuthenticated'](),controller[_0xeeda('0xc')]);router[_0xeeda('0x3')](_0xeeda('0xd'),auth['isAuthenticated'](),controller[_0xeeda('0xe')]);router['post']('/',auth[_0xeeda('0x6')](),controller['create']);router[_0xeeda('0xf')](_0xeeda('0x10'),auth[_0xeeda('0x6')](),controller[_0xeeda('0x11')]);router[_0xeeda('0xf')]('/timezone',auth['isAuthenticated'](),controller[_0xeeda('0x12')]);router[_0xeeda('0x13')](_0xeeda('0xb'),auth[_0xeeda('0x6')](),controller['update']);router[_0xeeda('0x14')](_0xeeda('0xb'),auth[_0xeeda('0x6')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index 215b613..b42dd61 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb266=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x346a46,_0x3ce5e1){var _0x46dcd2=function(_0x1eec95){while(--_0x1eec95){_0x346a46['push'](_0x346a46['shift']());}};_0x46dcd2(++_0x3ce5e1);}(_0xb266,0x1c1));var _0x6b26=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb266[_0x122ef9];return _0x42fba0;};'use strict';var moment=require(_0x6b26('0x0'));var Sequelize=require(_0x6b26('0x1'));module[_0x6b26('0x2')]={'CmHopperId':{'type':Sequelize[_0x6b26('0x3')]},'phone':{'type':Sequelize[_0x6b26('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x6b26('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x6b26('0x5')],'defaultValue':moment()['format'](_0x6b26('0x6'))},'countbusyretry':{'type':Sequelize[_0x6b26('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6b26('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x6b26('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6b26('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6b26('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6b26('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6b26('0x3')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xc504=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','INTEGER','DATE','format'];(function(_0xfc1ef5,_0x21f0ed){var _0x109fa2=function(_0x2d114a){while(--_0x2d114a){_0xfc1ef5['push'](_0xfc1ef5['shift']());}};_0x109fa2(++_0x21f0ed);}(_0xc504,0x103));var _0x4c50=function(_0x1a26b9,_0x2b6111){_0x1a26b9=_0x1a26b9-0x0;var _0x1ab5e2=_0xc504[_0x1a26b9];return _0x1ab5e2;};'use strict';var moment=require(_0x4c50('0x0'));var Sequelize=require(_0x4c50('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x4c50('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x4c50('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x4c50('0x3')],'defaultValue':moment()[_0x4c50('0x4')](_0x4c50('0x5'))},'countbusyretry':{'type':Sequelize[_0x4c50('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x4c50('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4c50('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4c50('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4c50('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4c50('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index 4a06793..06b6c04 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf9a2=['CmHopperAdditionalPhone','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','error','name'];(function(_0x41c6ff,_0xe220f7){var _0x342435=function(_0xcf8d14){while(--_0xcf8d14){_0x41c6ff['push'](_0x41c6ff['shift']());}};_0x342435(++_0xe220f7);}(_0xf9a2,0x78));var _0x2f9a=function(_0x29ac22,_0x367f0a){_0x29ac22=_0x29ac22-0x0;var _0x235c5f=_0xf9a2[_0x29ac22];return _0x235c5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f9a('0x0'));var zipdir=require(_0x2f9a('0x1'));var jsonpatch=require(_0x2f9a('0x2'));var rp=require('request-promise');var moment=require(_0x2f9a('0x3'));var BPromise=require(_0x2f9a('0x4'));var Mustache=require('mustache');var util=require(_0x2f9a('0x5'));var path=require(_0x2f9a('0x6'));var sox=require(_0x2f9a('0x7'));var csv=require(_0x2f9a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f9a('0x9'));var _=require(_0x2f9a('0xa'));var squel=require(_0x2f9a('0xb'));var crypto=require(_0x2f9a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2f9a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2f9a('0xe'));var Redis=require(_0x2f9a('0xf'));var authService=require(_0x2f9a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2f9a('0x11'));var hardwareService=require(_0x2f9a('0x12'));var logger=require(_0x2f9a('0x13'))(_0x2f9a('0x14'));var utils=require('../../config/utils');var config=require(_0x2f9a('0x15'));var licenseUtil=require(_0x2f9a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a774b,_0x278abb){_0x278abb=_0x278abb||0xcc;return function(_0x12e852){if(_0x12e852){return _0x3a774b['sendStatus'](_0x278abb);}return _0x3a774b[_0x2f9a('0x17')](_0x278abb)['end']();};}function respondWithResult(_0x335f95,_0x4e2a95){_0x4e2a95=_0x4e2a95||0xc8;return function(_0x567881){if(_0x567881){return _0x335f95[_0x2f9a('0x17')](_0x4e2a95)[_0x2f9a('0x18')](_0x567881);}};}function respondWithFilteredResult(_0xe03d2b,_0x2a27cf){return function(_0x96bec4){if(_0x96bec4){var _0x537d55=typeof _0x2a27cf[_0x2f9a('0x19')]===_0x2f9a('0x1a')&&typeof _0x2a27cf[_0x2f9a('0x1b')]==='undefined';var _0xb8bd95=_0x96bec4[_0x2f9a('0x1c')];var _0x1f4901=_0x537d55?0x0:_0x2a27cf['offset'];var _0x2e9894=_0x537d55?_0x96bec4[_0x2f9a('0x1c')]:_0x2a27cf['offset']+_0x2a27cf['limit'];var _0x146aa5;if(_0x2e9894>=_0xb8bd95){_0x2e9894=_0xb8bd95;_0x146aa5=0xc8;}else{_0x146aa5=0xce;}_0xe03d2b[_0x2f9a('0x17')](_0x146aa5);return _0xe03d2b['set'](_0x2f9a('0x1d'),_0x1f4901+'-'+_0x2e9894+'/'+_0xb8bd95)['json'](_0x96bec4);}return null;};}function patchUpdates(_0x3c46d1){return function(_0x303480){try{jsonpatch[_0x2f9a('0x1e')](_0x303480,_0x3c46d1,!![]);}catch(_0x183226){return BPromise[_0x2f9a('0x1f')](_0x183226);}return _0x303480[_0x2f9a('0x20')]();};}function saveUpdates(_0x1d0a5a,_0x21eaa3){return function(_0x407f49){if(_0x407f49){return _0x407f49[_0x2f9a('0x21')](_0x1d0a5a)[_0x2f9a('0x22')](function(_0x20b2d9){return _0x20b2d9;});}return null;};}function removeEntity(_0x25322d,_0x5dd7d3){return function(_0x260b32){if(_0x260b32){return _0x260b32[_0x2f9a('0x23')]()['then'](function(){var _0xf06eec=_0x260b32['get']({'plain':!![]});var _0x96f2b7='CmHopperAdditionalPhones';return db[_0x2f9a('0x24')][_0x2f9a('0x23')]({'where':{'type':_0x96f2b7,'resourceId':_0xf06eec['id']}})[_0x2f9a('0x22')](function(){return _0x260b32;});})['then'](function(){_0x25322d[_0x2f9a('0x17')](0xcc)[_0x2f9a('0x25')]();});}};}function handleEntityNotFound(_0x4af895,_0x4995ff){return function(_0xabb640){if(!_0xabb640){_0x4af895['sendStatus'](0x194);}return _0xabb640;};}function handleError(_0x15a792,_0x3e1ad0){_0x3e1ad0=_0x3e1ad0||0x1f4;return function(_0xba6b9a){logger[_0x2f9a('0x26')](_0xba6b9a['stack']);if(_0xba6b9a[_0x2f9a('0x27')]){delete _0xba6b9a[_0x2f9a('0x27')];}_0x15a792[_0x2f9a('0x17')](_0x3e1ad0)['send'](_0xba6b9a);};}exports['index']=function(_0x1f3cf0,_0x512298){var _0x5a2f55={},_0x2bc6fe={},_0x5d42ac={'count':0x0,'rows':[]};var _0xb0ba0a=_['map'](db[_0x2f9a('0x28')][_0x2f9a('0x29')],function(_0x5715cf){return{'name':_0x5715cf[_0x2f9a('0x2a')],'type':_0x5715cf['type'][_0x2f9a('0x2b')]};});_0x2bc6fe[_0x2f9a('0x2c')]=_[_0x2f9a('0x2d')](_0xb0ba0a,'name');_0x2bc6fe['query']=_[_0x2f9a('0x2e')](_0x1f3cf0[_0x2f9a('0x2f')]);_0x2bc6fe[_0x2f9a('0x30')]=_[_0x2f9a('0x31')](_0x2bc6fe[_0x2f9a('0x2c')],_0x2bc6fe['query']);_0x5a2f55[_0x2f9a('0x32')]=_[_0x2f9a('0x31')](_0x2bc6fe[_0x2f9a('0x2c')],qs[_0x2f9a('0x33')](_0x1f3cf0['query'][_0x2f9a('0x33')]));_0x5a2f55[_0x2f9a('0x32')]=_0x5a2f55['attributes'][_0x2f9a('0x34')]?_0x5a2f55[_0x2f9a('0x32')]:_0x2bc6fe[_0x2f9a('0x2c')];if(!_0x1f3cf0[_0x2f9a('0x2f')][_0x2f9a('0x35')](_0x2f9a('0x36'))){_0x5a2f55[_0x2f9a('0x1b')]=qs[_0x2f9a('0x1b')](_0x1f3cf0[_0x2f9a('0x2f')][_0x2f9a('0x1b')]);_0x5a2f55[_0x2f9a('0x19')]=qs[_0x2f9a('0x19')](_0x1f3cf0['query'][_0x2f9a('0x19')]);}_0x5a2f55[_0x2f9a('0x37')]=qs[_0x2f9a('0x38')](_0x1f3cf0['query'][_0x2f9a('0x38')]);_0x5a2f55[_0x2f9a('0x39')]=qs['filters'](_['pick'](_0x1f3cf0[_0x2f9a('0x2f')],_0x2bc6fe[_0x2f9a('0x30')]),_0xb0ba0a);if(_0x1f3cf0[_0x2f9a('0x2f')]['filter']){_0x5a2f55['where']=_['merge'](_0x5a2f55['where'],{'$or':_[_0x2f9a('0x2d')](_0xb0ba0a,function(_0x23ac60){if(_0x23ac60[_0x2f9a('0x3a')]!=='VIRTUAL'){var _0x5699bb={};_0x5699bb[_0x23ac60['name']]={'$like':'%'+_0x1f3cf0['query'][_0x2f9a('0x3b')]+'%'};return _0x5699bb;}})});}_0x5a2f55=_[_0x2f9a('0x3c')]({},_0x5a2f55,_0x1f3cf0['options']);var _0x31f690={'where':_0x5a2f55[_0x2f9a('0x39')]};return db[_0x2f9a('0x28')]['count'](_0x31f690)[_0x2f9a('0x22')](function(_0x5a584d){_0x5d42ac[_0x2f9a('0x1c')]=_0x5a584d;if(_0x1f3cf0[_0x2f9a('0x2f')]['includeAll']){_0x5a2f55[_0x2f9a('0x3d')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x2f9a('0x3e')](_0x5a2f55);})[_0x2f9a('0x22')](function(_0x19cb8b){_0x5d42ac[_0x2f9a('0x3f')]=_0x19cb8b;return _0x5d42ac;})[_0x2f9a('0x22')](respondWithFilteredResult(_0x512298,_0x5a2f55))[_0x2f9a('0x40')](handleError(_0x512298,null));};exports[_0x2f9a('0x41')]=function(_0x2b2dd7,_0x4c9a21){var _0x519a68={'raw':!![],'where':{'id':_0x2b2dd7[_0x2f9a('0x42')]['id']}},_0x18622f={};_0x18622f[_0x2f9a('0x2c')]=_[_0x2f9a('0x2e')](db[_0x2f9a('0x28')][_0x2f9a('0x29')]);_0x18622f['query']=_['keys'](_0x2b2dd7[_0x2f9a('0x2f')]);_0x18622f[_0x2f9a('0x30')]=_[_0x2f9a('0x31')](_0x18622f['model'],_0x18622f['query']);_0x519a68[_0x2f9a('0x32')]=_['intersection'](_0x18622f[_0x2f9a('0x2c')],qs[_0x2f9a('0x33')](_0x2b2dd7[_0x2f9a('0x2f')]['fields']));_0x519a68[_0x2f9a('0x32')]=_0x519a68[_0x2f9a('0x32')][_0x2f9a('0x34')]?_0x519a68['attributes']:_0x18622f[_0x2f9a('0x2c')];if(_0x2b2dd7[_0x2f9a('0x2f')][_0x2f9a('0x43')]){_0x519a68['include']=[{'all':!![]}];}_0x519a68=_[_0x2f9a('0x3c')]({},_0x519a68,_0x2b2dd7[_0x2f9a('0x44')]);return db[_0x2f9a('0x28')]['find'](_0x519a68)[_0x2f9a('0x22')](handleEntityNotFound(_0x4c9a21,null))[_0x2f9a('0x22')](respondWithResult(_0x4c9a21,null))[_0x2f9a('0x40')](handleError(_0x4c9a21,null));};exports['create']=function(_0x4f7a2f,_0x38ce13){return db['CmHopperAdditionalPhone'][_0x2f9a('0x45')](_0x4f7a2f[_0x2f9a('0x46')],{})[_0x2f9a('0x22')](function(_0x23e9fd){var _0x27d235=_0x4f7a2f[_0x2f9a('0x47')][_0x2f9a('0x48')]({'plain':!![]});if(!_0x27d235)throw new Error(_0x2f9a('0x49'));if(_0x27d235[_0x2f9a('0x4a')]===_0x2f9a('0x47')){var _0x27debd=_0x23e9fd[_0x2f9a('0x48')]({'plain':!![]});var _0x17d713=_0x2f9a('0x4b');return db[_0x2f9a('0x4c')][_0x2f9a('0x4d')]({'where':{'name':_0x17d713,'userProfileId':_0x27d235[_0x2f9a('0x4e')]},'raw':!![]})[_0x2f9a('0x22')](function(_0x4c9ced){if(_0x4c9ced&&_0x4c9ced['autoAssociation']===0x0){return db['UserProfileResource'][_0x2f9a('0x45')]({'name':_0x27debd[_0x2f9a('0x27')],'resourceId':_0x27debd['id'],'type':_0x4c9ced[_0x2f9a('0x27')],'sectionId':_0x4c9ced['id']},{})[_0x2f9a('0x22')](function(){return _0x23e9fd;});}else{return _0x23e9fd;}})['catch'](function(_0x2d6caa){logger['error'](_0x2f9a('0x4f'),_0x2d6caa);throw _0x2d6caa;});}return _0x23e9fd;})['then'](respondWithResult(_0x38ce13,0xc9))[_0x2f9a('0x40')](handleError(_0x38ce13,null));};exports[_0x2f9a('0x21')]=function(_0x41e310,_0x4a4dbf){if(_0x41e310[_0x2f9a('0x46')]['id']){delete _0x41e310[_0x2f9a('0x46')]['id'];}return db[_0x2f9a('0x28')][_0x2f9a('0x4d')]({'where':{'id':_0x41e310[_0x2f9a('0x42')]['id']}})[_0x2f9a('0x22')](handleEntityNotFound(_0x4a4dbf,null))[_0x2f9a('0x22')](saveUpdates(_0x41e310[_0x2f9a('0x46')],null))[_0x2f9a('0x22')](respondWithResult(_0x4a4dbf,null))[_0x2f9a('0x40')](handleError(_0x4a4dbf,null));};exports[_0x2f9a('0x23')]=function(_0x10f056,_0x3fdbb5){return db['CmHopperAdditionalPhone'][_0x2f9a('0x4d')]({'where':{'id':_0x10f056[_0x2f9a('0x42')]['id']}})['then'](handleEntityNotFound(_0x3fdbb5,null))['then'](removeEntity(_0x3fdbb5,null))[_0x2f9a('0x40')](handleError(_0x3fdbb5,null));};
\ No newline at end of file
+var _0xe5c4=['CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperAdditionalPhone','includeAll','include','findAll','rows','params','length','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get'];(function(_0x3f527c,_0x33dc39){var _0x5bc470=function(_0x14b4c3){while(--_0x14b4c3){_0x3f527c['push'](_0x3f527c['shift']());}};_0x5bc470(++_0x33dc39);}(_0xe5c4,0xd3));var _0x4e5c=function(_0x1cd52b,_0x5728f0){_0x1cd52b=_0x1cd52b-0x0;var _0x17c64f=_0xe5c4[_0x1cd52b];return _0x17c64f;};'use strict';var emlformat=require(_0x4e5c('0x0'));var rimraf=require(_0x4e5c('0x1'));var zipdir=require(_0x4e5c('0x2'));var jsonpatch=require(_0x4e5c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4e5c('0x4'));var util=require(_0x4e5c('0x5'));var path=require('path');var sox=require(_0x4e5c('0x6'));var csv=require(_0x4e5c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e5c('0x8'));var squel=require(_0x4e5c('0x9'));var crypto=require('crypto');var jsforce=require(_0x4e5c('0xa'));var deskjs=require(_0x4e5c('0xb'));var toCsv=require(_0x4e5c('0x7'));var querystring=require('querystring');var Papa=require(_0x4e5c('0xc'));var Redis=require(_0x4e5c('0xd'));var authService=require(_0x4e5c('0xe'));var qs=require(_0x4e5c('0xf'));var as=require(_0x4e5c('0x10'));var hardwareService=require(_0x4e5c('0x11'));var logger=require(_0x4e5c('0x12'))('api');var utils=require(_0x4e5c('0x13'));var config=require(_0x4e5c('0x14'));var licenseUtil=require(_0x4e5c('0x15'));var db=require(_0x4e5c('0x16'))['db'];function respondWithStatusCode(_0x491f40,_0x57279e){_0x57279e=_0x57279e||0xcc;return function(_0x413f85){if(_0x413f85){return _0x491f40[_0x4e5c('0x17')](_0x57279e);}return _0x491f40[_0x4e5c('0x18')](_0x57279e)[_0x4e5c('0x19')]();};}function respondWithResult(_0x4be460,_0x5066ea){_0x5066ea=_0x5066ea||0xc8;return function(_0x31f945){if(_0x31f945){return _0x4be460[_0x4e5c('0x18')](_0x5066ea)[_0x4e5c('0x1a')](_0x31f945);}};}function respondWithFilteredResult(_0x36dac1,_0x2f4575){return function(_0x2003a6){if(_0x2003a6){var _0x2ce633=typeof _0x2f4575[_0x4e5c('0x1b')]===_0x4e5c('0x1c')&&typeof _0x2f4575['limit']===_0x4e5c('0x1c');var _0xf42624=_0x2003a6[_0x4e5c('0x1d')];var _0x7ecd87=_0x2ce633?0x0:_0x2f4575[_0x4e5c('0x1b')];var _0x5ccf52=_0x2ce633?_0x2003a6['count']:_0x2f4575['offset']+_0x2f4575[_0x4e5c('0x1e')];var _0x82a93a;if(_0x5ccf52>=_0xf42624){_0x5ccf52=_0xf42624;_0x82a93a=0xc8;}else{_0x82a93a=0xce;}_0x36dac1[_0x4e5c('0x18')](_0x82a93a);return _0x36dac1[_0x4e5c('0x1f')]('Content-Range',_0x7ecd87+'-'+_0x5ccf52+'/'+_0xf42624)[_0x4e5c('0x1a')](_0x2003a6);}return null;};}function patchUpdates(_0x65d557){return function(_0x54cca6){try{jsonpatch[_0x4e5c('0x20')](_0x54cca6,_0x65d557,!![]);}catch(_0x7f6361){return BPromise[_0x4e5c('0x21')](_0x7f6361);}return _0x54cca6['save']();};}function saveUpdates(_0x45b8d9,_0x434e17){return function(_0x1cde16){if(_0x1cde16){return _0x1cde16[_0x4e5c('0x22')](_0x45b8d9)[_0x4e5c('0x23')](function(_0x2091c0){return _0x2091c0;});}return null;};}function removeEntity(_0x3dfeef,_0x21e970){return function(_0x3aef73){if(_0x3aef73){return _0x3aef73[_0x4e5c('0x24')]()[_0x4e5c('0x23')](function(){var _0x3e105=_0x3aef73[_0x4e5c('0x25')]({'plain':!![]});var _0x367aee=_0x4e5c('0x26');return db[_0x4e5c('0x27')][_0x4e5c('0x24')]({'where':{'type':_0x367aee,'resourceId':_0x3e105['id']}})['then'](function(){return _0x3aef73;});})[_0x4e5c('0x23')](function(){_0x3dfeef[_0x4e5c('0x18')](0xcc)[_0x4e5c('0x19')]();});}};}function handleEntityNotFound(_0x1f73d3,_0x2d2a51){return function(_0x45c445){if(!_0x45c445){_0x1f73d3['sendStatus'](0x194);}return _0x45c445;};}function handleError(_0x51b193,_0x5d865c){_0x5d865c=_0x5d865c||0x1f4;return function(_0x1c94af){logger[_0x4e5c('0x28')](_0x1c94af[_0x4e5c('0x29')]);if(_0x1c94af[_0x4e5c('0x2a')]){delete _0x1c94af['name'];}_0x51b193[_0x4e5c('0x18')](_0x5d865c)[_0x4e5c('0x2b')](_0x1c94af);};}exports[_0x4e5c('0x2c')]=function(_0x55b28f,_0x4f2969){var _0x28082c={},_0x2a0b7c={},_0x23fcb0={'count':0x0,'rows':[]};var _0x3d4ba1=_[_0x4e5c('0x2d')](db['CmHopperAdditionalPhone'][_0x4e5c('0x2e')],function(_0x4b6f0c){return{'name':_0x4b6f0c[_0x4e5c('0x2f')],'type':_0x4b6f0c[_0x4e5c('0x30')][_0x4e5c('0x31')]};});_0x2a0b7c[_0x4e5c('0x32')]=_[_0x4e5c('0x2d')](_0x3d4ba1,_0x4e5c('0x2a'));_0x2a0b7c['query']=_[_0x4e5c('0x33')](_0x55b28f[_0x4e5c('0x34')]);_0x2a0b7c[_0x4e5c('0x35')]=_[_0x4e5c('0x36')](_0x2a0b7c[_0x4e5c('0x32')],_0x2a0b7c[_0x4e5c('0x34')]);_0x28082c[_0x4e5c('0x37')]=_[_0x4e5c('0x36')](_0x2a0b7c[_0x4e5c('0x32')],qs[_0x4e5c('0x38')](_0x55b28f[_0x4e5c('0x34')][_0x4e5c('0x38')]));_0x28082c[_0x4e5c('0x37')]=_0x28082c[_0x4e5c('0x37')]['length']?_0x28082c['attributes']:_0x2a0b7c['model'];if(!_0x55b28f[_0x4e5c('0x34')][_0x4e5c('0x39')]('nolimit')){_0x28082c[_0x4e5c('0x1e')]=qs[_0x4e5c('0x1e')](_0x55b28f[_0x4e5c('0x34')]['limit']);_0x28082c[_0x4e5c('0x1b')]=qs[_0x4e5c('0x1b')](_0x55b28f['query'][_0x4e5c('0x1b')]);}_0x28082c[_0x4e5c('0x3a')]=qs['sort'](_0x55b28f[_0x4e5c('0x34')][_0x4e5c('0x3b')]);_0x28082c[_0x4e5c('0x3c')]=qs[_0x4e5c('0x35')](_[_0x4e5c('0x3d')](_0x55b28f[_0x4e5c('0x34')],_0x2a0b7c[_0x4e5c('0x35')]),_0x3d4ba1);if(_0x55b28f[_0x4e5c('0x34')][_0x4e5c('0x3e')]){_0x28082c[_0x4e5c('0x3c')]=_[_0x4e5c('0x3f')](_0x28082c[_0x4e5c('0x3c')],{'$or':_[_0x4e5c('0x2d')](_0x3d4ba1,function(_0x55f043){if(_0x55f043[_0x4e5c('0x30')]!==_0x4e5c('0x40')){var _0x168dfa={};_0x168dfa[_0x55f043[_0x4e5c('0x2a')]]={'$like':'%'+_0x55b28f[_0x4e5c('0x34')][_0x4e5c('0x3e')]+'%'};return _0x168dfa;}})});}_0x28082c=_[_0x4e5c('0x3f')]({},_0x28082c,_0x55b28f[_0x4e5c('0x41')]);var _0x59e4fc={'where':_0x28082c[_0x4e5c('0x3c')]};return db[_0x4e5c('0x42')][_0x4e5c('0x1d')](_0x59e4fc)[_0x4e5c('0x23')](function(_0x4118e8){_0x23fcb0[_0x4e5c('0x1d')]=_0x4118e8;if(_0x55b28f[_0x4e5c('0x34')][_0x4e5c('0x43')]){_0x28082c[_0x4e5c('0x44')]=[{'all':!![]}];}return db[_0x4e5c('0x42')][_0x4e5c('0x45')](_0x28082c);})[_0x4e5c('0x23')](function(_0x6570b9){_0x23fcb0[_0x4e5c('0x46')]=_0x6570b9;return _0x23fcb0;})[_0x4e5c('0x23')](respondWithFilteredResult(_0x4f2969,_0x28082c))['catch'](handleError(_0x4f2969,null));};exports['show']=function(_0xec152f,_0x13f95a){var _0x56b09e={'raw':!![],'where':{'id':_0xec152f[_0x4e5c('0x47')]['id']}},_0x11f06a={};_0x11f06a['model']=_['keys'](db[_0x4e5c('0x42')][_0x4e5c('0x2e')]);_0x11f06a[_0x4e5c('0x34')]=_[_0x4e5c('0x33')](_0xec152f['query']);_0x11f06a[_0x4e5c('0x35')]=_[_0x4e5c('0x36')](_0x11f06a[_0x4e5c('0x32')],_0x11f06a[_0x4e5c('0x34')]);_0x56b09e[_0x4e5c('0x37')]=_['intersection'](_0x11f06a[_0x4e5c('0x32')],qs[_0x4e5c('0x38')](_0xec152f[_0x4e5c('0x34')][_0x4e5c('0x38')]));_0x56b09e['attributes']=_0x56b09e['attributes'][_0x4e5c('0x48')]?_0x56b09e[_0x4e5c('0x37')]:_0x11f06a['model'];if(_0xec152f[_0x4e5c('0x34')][_0x4e5c('0x43')]){_0x56b09e[_0x4e5c('0x44')]=[{'all':!![]}];}_0x56b09e=_[_0x4e5c('0x3f')]({},_0x56b09e,_0xec152f[_0x4e5c('0x41')]);return db[_0x4e5c('0x42')][_0x4e5c('0x49')](_0x56b09e)[_0x4e5c('0x23')](handleEntityNotFound(_0x13f95a,null))[_0x4e5c('0x23')](respondWithResult(_0x13f95a,null))[_0x4e5c('0x4a')](handleError(_0x13f95a,null));};exports[_0x4e5c('0x4b')]=function(_0x2d84c7,_0x4acc14){return db[_0x4e5c('0x42')][_0x4e5c('0x4b')](_0x2d84c7[_0x4e5c('0x4c')],{})[_0x4e5c('0x23')](function(_0x35cd51){var _0x1a894e=_0x2d84c7['user'][_0x4e5c('0x25')]({'plain':!![]});if(!_0x1a894e)throw new Error(_0x4e5c('0x4d'));if(_0x1a894e[_0x4e5c('0x4e')]===_0x4e5c('0x4f')){var _0x34536b=_0x35cd51['get']({'plain':!![]});var _0x205f6f='CmHopperAdditionalPhones';return db[_0x4e5c('0x50')][_0x4e5c('0x49')]({'where':{'name':_0x205f6f,'userProfileId':_0x1a894e[_0x4e5c('0x51')]},'raw':!![]})[_0x4e5c('0x23')](function(_0x2a3539){if(_0x2a3539&&_0x2a3539[_0x4e5c('0x52')]===0x0){return db[_0x4e5c('0x27')][_0x4e5c('0x4b')]({'name':_0x34536b['name'],'resourceId':_0x34536b['id'],'type':_0x2a3539[_0x4e5c('0x2a')],'sectionId':_0x2a3539['id']},{})[_0x4e5c('0x23')](function(){return _0x35cd51;});}else{return _0x35cd51;}})[_0x4e5c('0x4a')](function(_0x45d6fc){logger[_0x4e5c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45d6fc);throw _0x45d6fc;});}return _0x35cd51;})[_0x4e5c('0x23')](respondWithResult(_0x4acc14,0xc9))[_0x4e5c('0x4a')](handleError(_0x4acc14,null));};exports[_0x4e5c('0x22')]=function(_0x178a59,_0x508dc8){if(_0x178a59[_0x4e5c('0x4c')]['id']){delete _0x178a59[_0x4e5c('0x4c')]['id'];}return db[_0x4e5c('0x42')]['find']({'where':{'id':_0x178a59[_0x4e5c('0x47')]['id']}})[_0x4e5c('0x23')](handleEntityNotFound(_0x508dc8,null))[_0x4e5c('0x23')](saveUpdates(_0x178a59[_0x4e5c('0x4c')],null))[_0x4e5c('0x23')](respondWithResult(_0x508dc8,null))[_0x4e5c('0x4a')](handleError(_0x508dc8,null));};exports['destroy']=function(_0x49a4dc,_0x5568f3){return db['CmHopperAdditionalPhone'][_0x4e5c('0x49')]({'where':{'id':_0x49a4dc[_0x4e5c('0x47')]['id']}})[_0x4e5c('0x23')](handleEntityNotFound(_0x5568f3,null))[_0x4e5c('0x23')](removeEntity(_0x5568f3,null))[_0x4e5c('0x4a')](handleError(_0x5568f3,null));};
\ No newline at end of file
index 2f98019..5398a6d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8d19=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','api'];(function(_0x33e25a,_0x3cb978){var _0x547d7f=function(_0x12417c){while(--_0x12417c){_0x33e25a['push'](_0x33e25a['shift']());}};_0x547d7f(++_0x3cb978);}(_0x8d19,0x142));var _0x98d1=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0x8d19[_0x6f1a87];return _0x2495c7;};'use strict';var _=require(_0x98d1('0x0'));var util=require(_0x98d1('0x1'));var logger=require('../../config/logger')(_0x98d1('0x2'));var moment=require(_0x98d1('0x3'));var BPromise=require(_0x98d1('0x4'));var rp=require(_0x98d1('0x5'));var fs=require('fs');var path=require(_0x98d1('0x6'));var rimraf=require(_0x98d1('0x7'));var config=require(_0x98d1('0x8'));var attributes=require(_0x98d1('0x9'));module['exports']=function(_0x5be1df,_0x497392){return _0x5be1df[_0x98d1('0xa')](_0x98d1('0xb'),attributes,{'tableName':_0x98d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8cdb=['exports','CmHopperAdditionalPhone','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8cdb,0x138));var _0xb8cd=function(_0xed29e,_0x58b775){_0xed29e=_0xed29e-0x0;var _0x46952b=_0x8cdb[_0xed29e];return _0x46952b;};'use strict';var _=require(_0xb8cd('0x0'));var util=require('util');var logger=require(_0xb8cd('0x1'))(_0xb8cd('0x2'));var moment=require(_0xb8cd('0x3'));var BPromise=require('bluebird');var rp=require(_0xb8cd('0x4'));var fs=require('fs');var path=require(_0xb8cd('0x5'));var rimraf=require(_0xb8cd('0x6'));var config=require(_0xb8cd('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xb8cd('0x8')]=function(_0x572605,_0x17d9f2){return _0x572605['define'](_0xb8cd('0x9'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index a8e457e..f6f7012 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb3b8=['request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','countbusyretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','catch','SwapAdditionalPhones','OrderBy','ASC','duration','waitTime','scheduledat','minutes','isNil','add','phone','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x37087e,_0x719222){var _0x117e6f=function(_0x1591bf){while(--_0x1591bf){_0x37087e['push'](_0x37087e['shift']());}};_0x117e6f(++_0x719222);}(_0xb3b8,0x109));var _0x8b3b=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xb3b8[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0x8b3b('0x0'));var util=require('util');var moment=require(_0x8b3b('0x1'));var BPromise=require(_0x8b3b('0x2'));var rs=require(_0x8b3b('0x3'));var fs=require('fs');var Redis=require(_0x8b3b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b3b('0x5'));var logger=require(_0x8b3b('0x6'))(_0x8b3b('0x7'));var config=require(_0x8b3b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x229fe2,_0x55b6d5,_0xa85e00){return new BPromise(function(_0x31f1ec,_0x185b17){return client[_0x8b3b('0xa')](_0x229fe2,_0xa85e00)[_0x8b3b('0xb')](function(_0x406f9d){logger['info'](_0x8b3b('0xc'),_0x55b6d5,'request\x20sent');logger[_0x8b3b('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x55b6d5,_0x8b3b('0xe'),JSON[_0x8b3b('0xf')](_0x406f9d));if(_0x406f9d[_0x8b3b('0x10')]){if(_0x406f9d['error']['code']===0x1f4){logger[_0x8b3b('0x10')](_0x8b3b('0xc'),_0x55b6d5,_0x406f9d[_0x8b3b('0x10')][_0x8b3b('0x11')]);return _0x185b17(_0x406f9d['error'][_0x8b3b('0x11')]);}logger['error'](_0x8b3b('0xc'),_0x55b6d5,_0x406f9d[_0x8b3b('0x10')][_0x8b3b('0x11')]);return _0x31f1ec(_0x406f9d[_0x8b3b('0x10')][_0x8b3b('0x11')]);}else{logger['info'](_0x8b3b('0xc'),_0x55b6d5,'request\x20sent');_0x31f1ec(_0x406f9d['result']['message']);}})['catch'](function(_0x213ad4){logger[_0x8b3b('0x10')](_0x8b3b('0xc'),_0x55b6d5,_0x213ad4);_0x185b17(_0x213ad4);});});}exports[_0x8b3b('0x12')]=function(_0x2f0782){var _0xb1f986=this;return new Promise(function(_0x570f04,_0x26a1da){return db[_0x8b3b('0x13')][_0x8b3b('0x14')]({'raw':!![],'where':{'ContactId':_0x2f0782[_0x8b3b('0x15')][_0x8b3b('0x16')],'ListId':_0x2f0782['body'][_0x8b3b('0x17')],'VoiceQueueId':_0x2f0782[_0x8b3b('0x15')][_0x8b3b('0x18')]===undefined?null:_0x2f0782[_0x8b3b('0x15')][_0x8b3b('0x18')],'CampaignId':_0x2f0782[_0x8b3b('0x15')][_0x8b3b('0x19')]===undefined?null:_0x2f0782[_0x8b3b('0x15')][_0x8b3b('0x19')]}})[_0x8b3b('0xb')](function(_0x2c23ff){if(_0x2c23ff!=null){return db[_0x8b3b('0x1a')][_0x8b3b('0x14')]({'raw':!![],'where':{'CmHopperId':_0x2c23ff['id'],'OrderBy':{'$gt':_0x2c23ff['OrderBy']}},'order':[['OrderBy','ASC']]})['then'](function(_0x5e637a){var _0x3b714e=0x0;if(_0x5e637a){if(_0x5e637a[_0x8b3b('0x1b')]+_0x5e637a['countcongestionretry']+_0x5e637a['countnoanswerretry']+_0x5e637a[_0x8b3b('0x1c')]+_0x5e637a['countdropretry']+_0x5e637a['countabandonedretry']+_0x5e637a[_0x8b3b('0x1d')]+_0x5e637a[_0x8b3b('0x1e')]<_0x2f0782[_0x8b3b('0x1f')][_0x8b3b('0x20')])_0x3b714e=0x1;_0x570f04({'additional':_0x3b714e});}else{return db[_0x8b3b('0x1a')][_0x8b3b('0x14')]({'raw':!![],'where':{'CmHopperId':_0x2c23ff['id']},'order':[['OrderBy','ASC']]})[_0x8b3b('0xb')](function(_0x2b43e2){var _0x30b71d=0x0;if(_0x2b43e2){if(_0x2b43e2[_0x8b3b('0x1b')]+_0x2b43e2[_0x8b3b('0x21')]+_0x2b43e2[_0x8b3b('0x22')]+_0x2b43e2[_0x8b3b('0x1c')]+_0x2b43e2[_0x8b3b('0x23')]+_0x2b43e2[_0x8b3b('0x24')]+_0x2b43e2[_0x8b3b('0x1d')]+_0x2b43e2[_0x8b3b('0x1e')]<_0x2f0782['entity'][_0x8b3b('0x20')])_0x30b71d=0x1;_0x570f04({'additional':_0x30b71d});}else{_0x570f04({'additional':0x0});}})[_0x8b3b('0x25')](function(_0x167409){logger['error']('VerifyAdditionalPhones',_0x167409[_0x8b3b('0x11')]);_0x26a1da(_0xb1f986[_0x8b3b('0x10')](0x1f4,_0x167409['message']));});}})[_0x8b3b('0x25')](function(_0x301fc6){logger[_0x8b3b('0x10')]('VerifyAdditionalPhones',_0x301fc6[_0x8b3b('0x11')]);_0x26a1da(_0xb1f986[_0x8b3b('0x10')](0x1f4,_0x301fc6[_0x8b3b('0x11')]));});}else _0x570f04({'additional':0x0});});});};exports[_0x8b3b('0x26')]=function(_0x199a9e){var _0x1a0e9f=this;return new Promise(function(_0x31b82a,_0x404a68){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x199a9e['body'][_0x8b3b('0x16')],'ListId':_0x199a9e[_0x8b3b('0x15')][_0x8b3b('0x17')],'VoiceQueueId':_0x199a9e['body'][_0x8b3b('0x18')]===undefined?null:_0x199a9e[_0x8b3b('0x15')][_0x8b3b('0x18')],'CampaignId':_0x199a9e['body']['CampaignId']===undefined?null:_0x199a9e[_0x8b3b('0x15')][_0x8b3b('0x19')]}})[_0x8b3b('0xb')](function(_0x37f949){if(_0x37f949!=null){return db[_0x8b3b('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x37f949['id'],'OrderBy':{'$gte':_0x37f949[_0x8b3b('0x27')]}},'order':[[_0x8b3b('0x27'),_0x8b3b('0x28')]]})[_0x8b3b('0xb')](function(_0x15d381){if(_0x15d381)return activateAdditionalPhone(_0x37f949,_0x199a9e['body'],_0x15d381,_0x199a9e[_0x8b3b('0x29')],_0x199a9e[_0x8b3b('0x2a')])[_0x8b3b('0xb')](function(_0x2f3307){_0x31b82a(_0x2f3307);});else{return db[_0x8b3b('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x37f949['id']},'order':[[_0x8b3b('0x27'),'ASC']]})[_0x8b3b('0xb')](function(_0x2c814e){if(_0x2c814e)return activateAdditionalPhone(_0x37f949,_0x199a9e[_0x8b3b('0x15')],_0x2c814e,_0x199a9e[_0x8b3b('0x29')],_0x199a9e['waitTime'])['then'](function(_0x33ac5a){_0x31b82a(_0x33ac5a);});else{_0x31b82a({'id':_0x37f949['id'],'phone':''});}})[_0x8b3b('0x25')](function(_0x5e14bb){logger[_0x8b3b('0x10')](_0x8b3b('0x12'),_0x5e14bb['message']);_0x404a68(_0x1a0e9f[_0x8b3b('0x10')](0x1f4,_0x5e14bb[_0x8b3b('0x11')]));});}})[_0x8b3b('0x25')](function(_0x53f9d2){logger['error'](_0x8b3b('0x12'),_0x53f9d2[_0x8b3b('0x11')]);_0x404a68(_0x1a0e9f[_0x8b3b('0x10')](0x1f4,_0x53f9d2[_0x8b3b('0x11')]));});}else _0x31b82a(0x1);});});};function activateAdditionalPhone(_0x25339b,_0x1bff29,_0x43bbc9,_0x10581b,_0x9905ca){return new Promise(function(_0x444330,_0x35a7b8){var _0x1d93e8;if(_['isNil'](_0x43bbc9[_0x8b3b('0x2b')])){_0x43bbc9['scheduledat']=moment();}if(moment()>moment(_0x43bbc9[_0x8b3b('0x2b')])){_0x1d93e8=moment()['add'](_0x9905ca||0x3,_0x8b3b('0x2c'));}else{if(_0x43bbc9['OrderBy']==0x0){_0x1d93e8=moment(_0x43bbc9[_0x8b3b('0x2b')]);}else{_0x1d93e8=moment()['add'](_0x9905ca||0x3,_0x8b3b('0x2c'));}}if(_[_0x8b3b('0x2d')](_0x1d93e8)){_0x1d93e8=moment()[_0x8b3b('0x2e')](_0x9905ca||0x3,_0x8b3b('0x2c'));}var _0x1a616e={'phone':_0x25339b[_0x8b3b('0x2f')],'active':0x0,'OrderBy':_[_0x8b3b('0x2d')](_0x25339b[_0x8b3b('0x27')])?0x0:_0x25339b[_0x8b3b('0x27')],'scheduledat':moment()[_0x8b3b('0x2e')](_0x10581b||0x1,_0x8b3b('0x2c')),'countbusyretry':_0x1bff29[_0x8b3b('0x1b')],'countcongestionretry':_0x1bff29['countcongestionretry'],'countnoanswerretry':_0x1bff29['countnoanswerretry'],'countnosuchnumberretry':_0x1bff29[_0x8b3b('0x1c')],'countdropretry':_0x1bff29[_0x8b3b('0x23')],'countabandonedretry':_0x1bff29[_0x8b3b('0x24')],'countmachineretry':_0x1bff29['countmachineretry'],'countagentrejectretry':_0x1bff29['countagentrejectretry'],'createdAt':_0x1bff29[_0x8b3b('0x30')],'updatedAt':_0x1bff29[_0x8b3b('0x31')]};var _0x5368fc={'CmHopperId':_0x25339b['id'],'phone':_0x43bbc9[_0x8b3b('0x2f')],'active':0x0,'OrderBy':_[_0x8b3b('0x2d')](_0x43bbc9[_0x8b3b('0x27')])?0x0:_0x43bbc9[_0x8b3b('0x27')],'scheduledat':_0x1d93e8,'countbusyretry':_0x43bbc9[_0x8b3b('0x1b')],'countcongestionretry':_0x43bbc9[_0x8b3b('0x21')],'countnoanswerretry':_0x43bbc9[_0x8b3b('0x22')],'countnosuchnumberretry':_0x43bbc9[_0x8b3b('0x1c')],'countdropretry':_0x43bbc9[_0x8b3b('0x23')],'countabandonedretry':_0x43bbc9['countabandonedretry'],'countmachineretry':_0x43bbc9[_0x8b3b('0x1d')],'countagentrejectretry':_0x43bbc9['countagentrejectretry'],'createdAt':_0x43bbc9[_0x8b3b('0x30')],'updatedAt':_0x43bbc9[_0x8b3b('0x31')]};return db[_0x8b3b('0x32')]['transaction'](function(_0x1f7d00){return db[_0x8b3b('0x1a')]['update'](_0x1a616e,{'where':{'id':_0x43bbc9['id']}},{'transaction':_0x1f7d00})[_0x8b3b('0xb')](function(){return db[_0x8b3b('0x13')][_0x8b3b('0x33')](_0x5368fc,{'where':{'id':_0x25339b['id']}},{'transaction':_0x1f7d00});});})[_0x8b3b('0xb')](function(_0x28ebcf){_0x444330({'id':_0x25339b['id'],'phone':_0x43bbc9['phone']});})[_0x8b3b('0x25')](function(_0x42695e){logger['error'](_0x8b3b('0x34'),_0x42695e['message']);_0x35a7b8({'error':_0x42695e[_0x8b3b('0x11')]});});});}exports[_0x8b3b('0x35')]=function(_0x2eddae){var _0x32cc1d=this;return new Promise(function(_0x3680d1,_0x38187c){return db[_0x8b3b('0x13')]['update'](_0x2eddae['body'][_0x8b3b('0x36')],{'where':{'id':_0x2eddae[_0x8b3b('0x15')]['id']}})[_0x8b3b('0xb')](function(_0x15bc31){_0x3680d1(_0x15bc31);})[_0x8b3b('0x25')](function(_0x429b2e){logger['error']('IncrementPreviewCounters',_0x429b2e[_0x8b3b('0x11')]);_0x38187c(_0x32cc1d[_0x8b3b('0x10')](0x1f4,_0x429b2e[_0x8b3b('0x11')]));});});};
\ No newline at end of file
+var _0x4b13=['ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','countdropretry','countabandonedretry','entity','duration','waitTime','scheduledat','add','minutes','isNil','phone','countnosuchnumberretry','createdAt','updatedAt','sequelize','transaction','update','field','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body'];(function(_0x4c32b6,_0x14d106){var _0x57aebd=function(_0x43f9ff){while(--_0x43f9ff){_0x4c32b6['push'](_0x4c32b6['shift']());}};_0x57aebd(++_0x14d106);}(_0x4b13,0x1b4));var _0x34b1=function(_0x5bac8e,_0x933acc){_0x5bac8e=_0x5bac8e-0x0;var _0x74b2b0=_0x4b13[_0x5bac8e];return _0x74b2b0;};'use strict';var _=require(_0x34b1('0x0'));var util=require(_0x34b1('0x1'));var moment=require('moment');var BPromise=require(_0x34b1('0x2'));var rs=require(_0x34b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34b1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x34b1('0x5'))(_0x34b1('0x6'));var config=require(_0x34b1('0x7'));var jayson=require(_0x34b1('0x8'));var client=jayson[_0x34b1('0x9')][_0x34b1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x195c8c,_0xf40712,_0x5b2c38){return new BPromise(function(_0x4dddaa,_0x4f2cfa){return client[_0x34b1('0xb')](_0x195c8c,_0x5b2c38)[_0x34b1('0xc')](function(_0x34e63f){logger[_0x34b1('0xd')](_0x34b1('0xe'),_0xf40712,_0x34b1('0xf'));logger[_0x34b1('0x10')](_0x34b1('0x11'),_0xf40712,_0x34b1('0xf'),JSON[_0x34b1('0x12')](_0x34e63f));if(_0x34e63f['error']){if(_0x34e63f[_0x34b1('0x13')][_0x34b1('0x14')]===0x1f4){logger[_0x34b1('0x13')](_0x34b1('0xe'),_0xf40712,_0x34e63f[_0x34b1('0x13')]['message']);return _0x4f2cfa(_0x34e63f[_0x34b1('0x13')][_0x34b1('0x15')]);}logger[_0x34b1('0x13')](_0x34b1('0xe'),_0xf40712,_0x34e63f[_0x34b1('0x13')]['message']);return _0x4dddaa(_0x34e63f['error'][_0x34b1('0x15')]);}else{logger[_0x34b1('0xd')](_0x34b1('0xe'),_0xf40712,_0x34b1('0xf'));_0x4dddaa(_0x34e63f[_0x34b1('0x16')][_0x34b1('0x15')]);}})[_0x34b1('0x17')](function(_0x1a2181){logger[_0x34b1('0x13')](_0x34b1('0xe'),_0xf40712,_0x1a2181);_0x4f2cfa(_0x1a2181);});});}exports[_0x34b1('0x18')]=function(_0x38ba81){var _0x43c4fd=this;return new Promise(function(_0x4ca74f,_0x2e62e3){return db[_0x34b1('0x19')][_0x34b1('0x1a')]({'raw':!![],'where':{'ContactId':_0x38ba81[_0x34b1('0x1b')][_0x34b1('0x1c')],'ListId':_0x38ba81[_0x34b1('0x1b')][_0x34b1('0x1d')],'VoiceQueueId':_0x38ba81['body'][_0x34b1('0x1e')]===undefined?null:_0x38ba81[_0x34b1('0x1b')][_0x34b1('0x1e')],'CampaignId':_0x38ba81[_0x34b1('0x1b')][_0x34b1('0x1f')]===undefined?null:_0x38ba81[_0x34b1('0x1b')][_0x34b1('0x1f')]}})['then'](function(_0x1ac1d5){if(_0x1ac1d5!=null){return db[_0x34b1('0x20')][_0x34b1('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x1ac1d5['id'],'OrderBy':{'$gt':_0x1ac1d5[_0x34b1('0x21')]}},'order':[[_0x34b1('0x21'),_0x34b1('0x22')]]})[_0x34b1('0xc')](function(_0x44f5aa){var _0x412c7f=0x0;if(_0x44f5aa){if(_0x44f5aa[_0x34b1('0x23')]+_0x44f5aa[_0x34b1('0x24')]+_0x44f5aa[_0x34b1('0x25')]+_0x44f5aa['countnosuchnumberretry']+_0x44f5aa['countdropretry']+_0x44f5aa['countabandonedretry']+_0x44f5aa[_0x34b1('0x26')]+_0x44f5aa[_0x34b1('0x27')]<_0x38ba81['entity'][_0x34b1('0x28')])_0x412c7f=0x1;_0x4ca74f({'additional':_0x412c7f});}else{return db[_0x34b1('0x20')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1ac1d5['id']},'order':[[_0x34b1('0x21'),_0x34b1('0x22')]]})[_0x34b1('0xc')](function(_0x35503b){var _0x5298ea=0x0;if(_0x35503b){if(_0x35503b[_0x34b1('0x23')]+_0x35503b[_0x34b1('0x24')]+_0x35503b[_0x34b1('0x25')]+_0x35503b['countnosuchnumberretry']+_0x35503b[_0x34b1('0x29')]+_0x35503b[_0x34b1('0x2a')]+_0x35503b[_0x34b1('0x26')]+_0x35503b[_0x34b1('0x27')]<_0x38ba81[_0x34b1('0x2b')][_0x34b1('0x28')])_0x5298ea=0x1;_0x4ca74f({'additional':_0x5298ea});}else{_0x4ca74f({'additional':0x0});}})[_0x34b1('0x17')](function(_0x2bce2a){logger[_0x34b1('0x13')](_0x34b1('0x18'),_0x2bce2a['message']);_0x2e62e3(_0x43c4fd['error'](0x1f4,_0x2bce2a[_0x34b1('0x15')]));});}})[_0x34b1('0x17')](function(_0x13c2e4){logger['error']('VerifyAdditionalPhones',_0x13c2e4['message']);_0x2e62e3(_0x43c4fd[_0x34b1('0x13')](0x1f4,_0x13c2e4[_0x34b1('0x15')]));});}else _0x4ca74f({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x48c7ae){var _0x215aa1=this;return new Promise(function(_0x47a166,_0x4e05f0){return db['CmHopper'][_0x34b1('0x1a')]({'raw':!![],'where':{'ContactId':_0x48c7ae[_0x34b1('0x1b')][_0x34b1('0x1c')],'ListId':_0x48c7ae[_0x34b1('0x1b')][_0x34b1('0x1d')],'VoiceQueueId':_0x48c7ae[_0x34b1('0x1b')][_0x34b1('0x1e')]===undefined?null:_0x48c7ae[_0x34b1('0x1b')][_0x34b1('0x1e')],'CampaignId':_0x48c7ae[_0x34b1('0x1b')][_0x34b1('0x1f')]===undefined?null:_0x48c7ae[_0x34b1('0x1b')]['CampaignId']}})['then'](function(_0x3c7577){if(_0x3c7577!=null){return db[_0x34b1('0x20')][_0x34b1('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x3c7577['id'],'OrderBy':{'$gte':_0x3c7577[_0x34b1('0x21')]}},'order':[['OrderBy','ASC']]})[_0x34b1('0xc')](function(_0x48eb5c){if(_0x48eb5c)return activateAdditionalPhone(_0x3c7577,_0x48c7ae[_0x34b1('0x1b')],_0x48eb5c,_0x48c7ae[_0x34b1('0x2c')],_0x48c7ae[_0x34b1('0x2d')])[_0x34b1('0xc')](function(_0x4c56b5){_0x47a166(_0x4c56b5);});else{return db[_0x34b1('0x20')][_0x34b1('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x3c7577['id']},'order':[['OrderBy','ASC']]})[_0x34b1('0xc')](function(_0xcf2559){if(_0xcf2559)return activateAdditionalPhone(_0x3c7577,_0x48c7ae['body'],_0xcf2559,_0x48c7ae[_0x34b1('0x2c')],_0x48c7ae[_0x34b1('0x2d')])[_0x34b1('0xc')](function(_0x3bd33e){_0x47a166(_0x3bd33e);});else{_0x47a166({'id':_0x3c7577['id'],'phone':''});}})['catch'](function(_0x4bf2bd){logger[_0x34b1('0x13')](_0x34b1('0x18'),_0x4bf2bd['message']);_0x4e05f0(_0x215aa1[_0x34b1('0x13')](0x1f4,_0x4bf2bd['message']));});}})[_0x34b1('0x17')](function(_0x1a67a6){logger[_0x34b1('0x13')]('VerifyAdditionalPhones',_0x1a67a6[_0x34b1('0x15')]);_0x4e05f0(_0x215aa1['error'](0x1f4,_0x1a67a6[_0x34b1('0x15')]));});}else _0x47a166(0x1);});});};function activateAdditionalPhone(_0x3a013b,_0x50bdfc,_0x5d99c7,_0x371179,_0x21662b){return new Promise(function(_0x34de44,_0x2e5715){var _0x317c5f;if(_['isNil'](_0x5d99c7[_0x34b1('0x2e')])){_0x5d99c7['scheduledat']=moment();}if(moment()>moment(_0x5d99c7[_0x34b1('0x2e')])){_0x317c5f=moment()[_0x34b1('0x2f')](_0x21662b||0x3,_0x34b1('0x30'));}else{if(_0x5d99c7[_0x34b1('0x21')]==0x0){_0x317c5f=moment(_0x5d99c7['scheduledat']);}else{_0x317c5f=moment()[_0x34b1('0x2f')](_0x21662b||0x3,'minutes');}}if(_[_0x34b1('0x31')](_0x317c5f)){_0x317c5f=moment()[_0x34b1('0x2f')](_0x21662b||0x3,'minutes');}var _0x29bdcd={'phone':_0x3a013b[_0x34b1('0x32')],'active':0x0,'OrderBy':_[_0x34b1('0x31')](_0x3a013b[_0x34b1('0x21')])?0x0:_0x3a013b[_0x34b1('0x21')],'scheduledat':moment()[_0x34b1('0x2f')](_0x371179||0x1,_0x34b1('0x30')),'countbusyretry':_0x50bdfc[_0x34b1('0x23')],'countcongestionretry':_0x50bdfc[_0x34b1('0x24')],'countnoanswerretry':_0x50bdfc['countnoanswerretry'],'countnosuchnumberretry':_0x50bdfc[_0x34b1('0x33')],'countdropretry':_0x50bdfc[_0x34b1('0x29')],'countabandonedretry':_0x50bdfc['countabandonedretry'],'countmachineretry':_0x50bdfc[_0x34b1('0x26')],'countagentrejectretry':_0x50bdfc[_0x34b1('0x27')],'createdAt':_0x50bdfc[_0x34b1('0x34')],'updatedAt':_0x50bdfc['updatedAt']};var _0x23639e={'CmHopperId':_0x3a013b['id'],'phone':_0x5d99c7[_0x34b1('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x5d99c7[_0x34b1('0x21')])?0x0:_0x5d99c7['OrderBy'],'scheduledat':_0x317c5f,'countbusyretry':_0x5d99c7[_0x34b1('0x23')],'countcongestionretry':_0x5d99c7[_0x34b1('0x24')],'countnoanswerretry':_0x5d99c7[_0x34b1('0x25')],'countnosuchnumberretry':_0x5d99c7[_0x34b1('0x33')],'countdropretry':_0x5d99c7[_0x34b1('0x29')],'countabandonedretry':_0x5d99c7[_0x34b1('0x2a')],'countmachineretry':_0x5d99c7[_0x34b1('0x26')],'countagentrejectretry':_0x5d99c7['countagentrejectretry'],'createdAt':_0x5d99c7[_0x34b1('0x34')],'updatedAt':_0x5d99c7[_0x34b1('0x35')]};return db[_0x34b1('0x36')][_0x34b1('0x37')](function(_0x213c46){return db[_0x34b1('0x20')][_0x34b1('0x38')](_0x29bdcd,{'where':{'id':_0x5d99c7['id']}},{'transaction':_0x213c46})['then'](function(){return db['CmHopper'][_0x34b1('0x38')](_0x23639e,{'where':{'id':_0x3a013b['id']}},{'transaction':_0x213c46});});})[_0x34b1('0xc')](function(_0x1b8906){_0x34de44({'id':_0x3a013b['id'],'phone':_0x5d99c7[_0x34b1('0x32')]});})[_0x34b1('0x17')](function(_0x1598b8){logger[_0x34b1('0x13')]('activateAdditionalPhone',_0x1598b8['message']);_0x2e5715({'error':_0x1598b8[_0x34b1('0x15')]});});});}exports['IncrementPreviewCounters']=function(_0xe438b2){var _0x1f9ed3=this;return new Promise(function(_0x3fa3a1,_0x47e9e2){return db[_0x34b1('0x19')][_0x34b1('0x38')](_0xe438b2[_0x34b1('0x1b')][_0x34b1('0x39')],{'where':{'id':_0xe438b2['body']['id']}})[_0x34b1('0xc')](function(_0x5c28a8){_0x3fa3a1(_0x5c28a8);})['catch'](function(_0x249d56){logger[_0x34b1('0x13')]('IncrementPreviewCounters',_0x249d56[_0x34b1('0x15')]);_0x47e9e2(_0x1f9ed3[_0x34b1('0x13')](0x1f4,_0x249d56[_0x34b1('0x15')]));});});};
\ No newline at end of file
index 2d5a186..cdacba8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3527=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','create','update','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x3527,0x171));var _0x7352=function(_0x311909,_0x414bf7){_0x311909=_0x311909-0x0;var _0x8d3163=_0x3527[_0x311909];return _0x8d3163;};'use strict';var multer=require(_0x7352('0x0'));var util=require('util');var path=require(_0x7352('0x1'));var timeout=require(_0x7352('0x2'));var express=require('express');var router=express[_0x7352('0x3')]();var fs_extra=require(_0x7352('0x4'));var auth=require(_0x7352('0x5'));var interaction=require(_0x7352('0x6'));var config=require(_0x7352('0x7'));var controller=require(_0x7352('0x8'));router[_0x7352('0x9')]('/',auth[_0x7352('0xa')](),controller[_0x7352('0xb')]);router[_0x7352('0x9')](_0x7352('0xc'),auth[_0x7352('0xa')](),controller[_0x7352('0xd')]);router['post']('/',auth[_0x7352('0xa')](),controller[_0x7352('0xe')]);router['put'](_0x7352('0xc'),auth[_0x7352('0xa')](),controller[_0x7352('0xf')]);router['delete'](_0x7352('0xc'),auth[_0x7352('0xa')](),controller['destroy']);module[_0x7352('0x10')]=router;
\ No newline at end of file
+var _0x99f5=['put','/:id','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create'];(function(_0xd5e978,_0x1f2519){var _0x538d2e=function(_0x3fabe6){while(--_0x3fabe6){_0xd5e978['push'](_0xd5e978['shift']());}};_0x538d2e(++_0x1f2519);}(_0x99f5,0x16d));var _0x599f=function(_0x50d8c7,_0x4aec18){_0x50d8c7=_0x50d8c7-0x0;var _0xdbce86=_0x99f5[_0x50d8c7];return _0xdbce86;};'use strict';var multer=require('multer');var util=require(_0x599f('0x0'));var path=require(_0x599f('0x1'));var timeout=require(_0x599f('0x2'));var express=require('express');var router=express[_0x599f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x599f('0x4'));var interaction=require(_0x599f('0x5'));var config=require(_0x599f('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x599f('0x7')]('/',auth[_0x599f('0x8')](),controller[_0x599f('0x9')]);router[_0x599f('0x7')]('/:id',auth[_0x599f('0x8')](),controller[_0x599f('0xa')]);router[_0x599f('0xb')]('/',auth[_0x599f('0x8')](),controller[_0x599f('0xc')]);router[_0x599f('0xd')](_0x599f('0xe'),auth[_0x599f('0x8')](),controller[_0x599f('0xf')]);router['delete'](_0x599f('0xe'),auth[_0x599f('0x8')](),controller[_0x599f('0x10')]);module[_0x599f('0x11')]=router;
\ No newline at end of file
index 4786cbd..4656df4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c88=['moment','exports','STRING','INTEGER','contactListQueue'];(function(_0x275da2,_0x1501e4){var _0x1195a2=function(_0x28d383){while(--_0x28d383){_0x275da2['push'](_0x275da2['shift']());}};_0x1195a2(++_0x1501e4);}(_0x1c88,0x1a9));var _0x81c8=function(_0x377ddf,_0x102e9a){_0x377ddf=_0x377ddf-0x0;var _0x5b8465=_0x1c88[_0x377ddf];return _0x5b8465;};'use strict';var moment=require(_0x81c8('0x0'));var Sequelize=require('sequelize');module[_0x81c8('0x1')]={'phone':{'type':Sequelize[_0x81c8('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x81c8('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x81c8('0x4')},'VoiceQueueId':{'type':Sequelize[_0x81c8('0x3')],'unique':_0x81c8('0x4')}};
\ No newline at end of file
+var _0x2234=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2234,0x16e));var _0x4223=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0x2234[_0x454e6d];return _0x4bc294;};'use strict';var moment=require(_0x4223('0x0'));var Sequelize=require(_0x4223('0x1'));module[_0x4223('0x2')]={'phone':{'type':Sequelize[_0x4223('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4223('0x4')],'unique':_0x4223('0x5')},'ListId':{'type':Sequelize[_0x4223('0x4')],'unique':_0x4223('0x5')},'VoiceQueueId':{'type':Sequelize[_0x4223('0x4')],'unique':_0x4223('0x5')}};
\ No newline at end of file
index fc5a059..662ff5e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe23a=['reject','save','update','then','destroy','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set'];(function(_0x394e0b,_0x5d70de){var _0x2bf408=function(_0x315efa){while(--_0x315efa){_0x394e0b['push'](_0x394e0b['shift']());}};_0x2bf408(++_0x5d70de);}(_0xe23a,0xf3));var _0xae23=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xe23a[_0x1db251];return _0x56685a;};'use strict';var emlformat=require(_0xae23('0x0'));var rimraf=require(_0xae23('0x1'));var zipdir=require(_0xae23('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae23('0x3'));var moment=require(_0xae23('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xae23('0x5'));var sox=require('sox');var csv=require(_0xae23('0x6'));var ejs=require(_0xae23('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xae23('0x8'));var crypto=require(_0xae23('0x9'));var jsforce=require(_0xae23('0xa'));var deskjs=require(_0xae23('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae23('0xc'));var Redis=require('ioredis');var authService=require(_0xae23('0xd'));var qs=require(_0xae23('0xe'));var as=require(_0xae23('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae23('0x10'))(_0xae23('0x11'));var utils=require(_0xae23('0x12'));var config=require(_0xae23('0x13'));var licenseUtil=require(_0xae23('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xac0492,_0xe3267c){_0xe3267c=_0xe3267c||0xcc;return function(_0x477642){if(_0x477642){return _0xac0492['sendStatus'](_0xe3267c);}return _0xac0492[_0xae23('0x15')](_0xe3267c)[_0xae23('0x16')]();};}function respondWithResult(_0x1e32f2,_0x28964d){_0x28964d=_0x28964d||0xc8;return function(_0x30022e){if(_0x30022e){return _0x1e32f2[_0xae23('0x15')](_0x28964d)[_0xae23('0x17')](_0x30022e);}};}function respondWithFilteredResult(_0x5fc172,_0x4abc44){return function(_0x2bdac3){if(_0x2bdac3){var _0x2a5f43=typeof _0x4abc44['offset']===_0xae23('0x18')&&typeof _0x4abc44[_0xae23('0x19')]===_0xae23('0x18');var _0x482c2f=_0x2bdac3[_0xae23('0x1a')];var _0x17baf6=_0x2a5f43?0x0:_0x4abc44[_0xae23('0x1b')];var _0x35542c=_0x2a5f43?_0x2bdac3['count']:_0x4abc44[_0xae23('0x1b')]+_0x4abc44[_0xae23('0x19')];var _0x4a79e5;if(_0x35542c>=_0x482c2f){_0x35542c=_0x482c2f;_0x4a79e5=0xc8;}else{_0x4a79e5=0xce;}_0x5fc172[_0xae23('0x15')](_0x4a79e5);return _0x5fc172[_0xae23('0x1c')]('Content-Range',_0x17baf6+'-'+_0x35542c+'/'+_0x482c2f)[_0xae23('0x17')](_0x2bdac3);}return null;};}function patchUpdates(_0x8385a1){return function(_0xa37e5e){try{jsonpatch['apply'](_0xa37e5e,_0x8385a1,!![]);}catch(_0x2e03bc){return BPromise[_0xae23('0x1d')](_0x2e03bc);}return _0xa37e5e[_0xae23('0x1e')]();};}function saveUpdates(_0x30a08a,_0x4a1e79){return function(_0x511df8){if(_0x511df8){return _0x511df8[_0xae23('0x1f')](_0x30a08a)[_0xae23('0x20')](function(_0x4e1842){return _0x4e1842;});}return null;};}function removeEntity(_0x1d814c,_0x107224){return function(_0x1f3c1e){if(_0x1f3c1e){return _0x1f3c1e[_0xae23('0x21')]()[_0xae23('0x20')](function(){_0x1d814c[_0xae23('0x15')](0xcc)[_0xae23('0x16')]();});}};}function handleEntityNotFound(_0x122a7d,_0x18bae5){return function(_0x5c4421){if(!_0x5c4421){_0x122a7d['sendStatus'](0x194);}return _0x5c4421;};}function handleError(_0x3dd3f9,_0x4a1a1e){_0x4a1a1e=_0x4a1a1e||0x1f4;return function(_0x3abf01){logger['error'](_0x3abf01[_0xae23('0x22')]);if(_0x3abf01[_0xae23('0x23')]){delete _0x3abf01[_0xae23('0x23')];}_0x3dd3f9[_0xae23('0x15')](_0x4a1a1e)['send'](_0x3abf01);};}exports[_0xae23('0x24')]=function(_0x33b696,_0x50dde6){var _0xc6ca0e={},_0x1b281d={},_0x3c5861={'count':0x0,'rows':[]};var _0x550f50=_[_0xae23('0x25')](db[_0xae23('0x26')][_0xae23('0x27')],function(_0x12e528){return{'name':_0x12e528[_0xae23('0x28')],'type':_0x12e528[_0xae23('0x29')]['key']};});_0x1b281d[_0xae23('0x2a')]=_['map'](_0x550f50,_0xae23('0x23'));_0x1b281d[_0xae23('0x2b')]=_[_0xae23('0x2c')](_0x33b696[_0xae23('0x2b')]);_0x1b281d[_0xae23('0x2d')]=_[_0xae23('0x2e')](_0x1b281d['model'],_0x1b281d[_0xae23('0x2b')]);_0xc6ca0e[_0xae23('0x2f')]=_['intersection'](_0x1b281d['model'],qs[_0xae23('0x30')](_0x33b696[_0xae23('0x2b')][_0xae23('0x30')]));_0xc6ca0e['attributes']=_0xc6ca0e[_0xae23('0x2f')][_0xae23('0x31')]?_0xc6ca0e['attributes']:_0x1b281d['model'];if(!_0x33b696['query']['hasOwnProperty'](_0xae23('0x32'))){_0xc6ca0e['limit']=qs['limit'](_0x33b696[_0xae23('0x2b')][_0xae23('0x19')]);_0xc6ca0e[_0xae23('0x1b')]=qs[_0xae23('0x1b')](_0x33b696[_0xae23('0x2b')][_0xae23('0x1b')]);}_0xc6ca0e[_0xae23('0x33')]=qs[_0xae23('0x34')](_0x33b696[_0xae23('0x2b')][_0xae23('0x34')]);_0xc6ca0e[_0xae23('0x35')]=qs[_0xae23('0x2d')](_[_0xae23('0x36')](_0x33b696[_0xae23('0x2b')],_0x1b281d[_0xae23('0x2d')]),_0x550f50);if(_0x33b696[_0xae23('0x2b')][_0xae23('0x37')]){_0xc6ca0e[_0xae23('0x35')]=_[_0xae23('0x38')](_0xc6ca0e[_0xae23('0x35')],{'$or':_['map'](_0x550f50,function(_0x2b0fac){if(_0x2b0fac['type']!=='VIRTUAL'){var _0x1ecaaa={};_0x1ecaaa[_0x2b0fac[_0xae23('0x23')]]={'$like':'%'+_0x33b696[_0xae23('0x2b')][_0xae23('0x37')]+'%'};return _0x1ecaaa;}})});}_0xc6ca0e=_[_0xae23('0x38')]({},_0xc6ca0e,_0x33b696[_0xae23('0x39')]);var _0xfb7c50={'where':_0xc6ca0e['where']};return db[_0xae23('0x26')][_0xae23('0x1a')](_0xfb7c50)[_0xae23('0x20')](function(_0x298cbb){_0x3c5861[_0xae23('0x1a')]=_0x298cbb;if(_0x33b696[_0xae23('0x2b')][_0xae23('0x3a')]){_0xc6ca0e[_0xae23('0x3b')]=[{'all':!![]}];}return db[_0xae23('0x26')][_0xae23('0x3c')](_0xc6ca0e);})[_0xae23('0x20')](function(_0x1b0104){_0x3c5861[_0xae23('0x3d')]=_0x1b0104;return _0x3c5861;})['then'](respondWithFilteredResult(_0x50dde6,_0xc6ca0e))[_0xae23('0x3e')](handleError(_0x50dde6,null));};exports[_0xae23('0x3f')]=function(_0x4739ef,_0x5dbcfd){var _0x5db222={'raw':!![],'where':{'id':_0x4739ef[_0xae23('0x40')]['id']}},_0x48e5c5={};_0x48e5c5[_0xae23('0x2a')]=_[_0xae23('0x2c')](db[_0xae23('0x26')]['rawAttributes']);_0x48e5c5['query']=_[_0xae23('0x2c')](_0x4739ef[_0xae23('0x2b')]);_0x48e5c5['filters']=_[_0xae23('0x2e')](_0x48e5c5[_0xae23('0x2a')],_0x48e5c5[_0xae23('0x2b')]);_0x5db222['attributes']=_['intersection'](_0x48e5c5[_0xae23('0x2a')],qs[_0xae23('0x30')](_0x4739ef[_0xae23('0x2b')][_0xae23('0x30')]));_0x5db222[_0xae23('0x2f')]=_0x5db222[_0xae23('0x2f')]['length']?_0x5db222[_0xae23('0x2f')]:_0x48e5c5[_0xae23('0x2a')];if(_0x4739ef[_0xae23('0x2b')][_0xae23('0x3a')]){_0x5db222[_0xae23('0x3b')]=[{'all':!![]}];}_0x5db222=_[_0xae23('0x38')]({},_0x5db222,_0x4739ef[_0xae23('0x39')]);return db['CmHopperBlack'][_0xae23('0x41')](_0x5db222)[_0xae23('0x20')](handleEntityNotFound(_0x5dbcfd,null))[_0xae23('0x20')](respondWithResult(_0x5dbcfd,null))[_0xae23('0x3e')](handleError(_0x5dbcfd,null));};exports[_0xae23('0x1f')]=function(_0x11f050,_0x3d5abd){if(_0x11f050[_0xae23('0x42')]['id']){delete _0x11f050[_0xae23('0x42')]['id'];}return db[_0xae23('0x26')][_0xae23('0x41')]({'where':{'id':_0x11f050[_0xae23('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d5abd,null))[_0xae23('0x20')](saveUpdates(_0x11f050['body'],null))[_0xae23('0x20')](respondWithResult(_0x3d5abd,null))['catch'](handleError(_0x3d5abd,null));};exports[_0xae23('0x21')]=function(_0x201a80,_0x28c0be){return db['CmHopperBlack'][_0xae23('0x41')]({'where':{'id':_0x201a80[_0xae23('0x40')]['id']}})['then'](handleEntityNotFound(_0x28c0be,null))[_0xae23('0x20')](removeEntity(_0x28c0be,null))[_0xae23('0x3e')](handleError(_0x28c0be,null));};exports[_0xae23('0x43')]=function(_0x37d312,_0x57a726){return db[_0xae23('0x26')][_0xae23('0x43')]()[_0xae23('0x20')](respondWithResult(_0x57a726,null))[_0xae23('0x3e')](handleError(_0x57a726,null));};
\ No newline at end of file
+var _0x5050=['save','update','then','destroy','error','name','index','CmHopperBlack','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','catch','show','params','includeAll','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject'];(function(_0x6606dc,_0x407e3b){var _0x414327=function(_0x51e8ec){while(--_0x51e8ec){_0x6606dc['push'](_0x6606dc['shift']());}};_0x414327(++_0x407e3b);}(_0x5050,0x1dd));var _0x0505=function(_0x415006,_0x53ceb4){_0x415006=_0x415006-0x0;var _0x1698ca=_0x5050[_0x415006];return _0x1698ca;};'use strict';var emlformat=require(_0x0505('0x0'));var rimraf=require(_0x0505('0x1'));var zipdir=require(_0x0505('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0505('0x3'));var moment=require(_0x0505('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0505('0x5'));var sox=require(_0x0505('0x6'));var csv=require(_0x0505('0x7'));var ejs=require(_0x0505('0x8'));var fs=require('fs');var fs_extra=require(_0x0505('0x9'));var _=require(_0x0505('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0505('0xb'));var deskjs=require(_0x0505('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0505('0xd'));var Papa=require(_0x0505('0xe'));var Redis=require(_0x0505('0xf'));var authService=require(_0x0505('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0505('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0505('0x12'));var utils=require(_0x0505('0x13'));var config=require(_0x0505('0x14'));var licenseUtil=require(_0x0505('0x15'));var db=require(_0x0505('0x16'))['db'];function respondWithStatusCode(_0x1d2455,_0x10d8ec){_0x10d8ec=_0x10d8ec||0xcc;return function(_0x578164){if(_0x578164){return _0x1d2455[_0x0505('0x17')](_0x10d8ec);}return _0x1d2455[_0x0505('0x18')](_0x10d8ec)[_0x0505('0x19')]();};}function respondWithResult(_0x72ac6b,_0x47dc6d){_0x47dc6d=_0x47dc6d||0xc8;return function(_0x5022fc){if(_0x5022fc){return _0x72ac6b['status'](_0x47dc6d)['json'](_0x5022fc);}};}function respondWithFilteredResult(_0x4ceecd,_0x2381ee){return function(_0x25d1f){if(_0x25d1f){var _0x3bf563=typeof _0x2381ee[_0x0505('0x1a')]===_0x0505('0x1b')&&typeof _0x2381ee[_0x0505('0x1c')]===_0x0505('0x1b');var _0xaa4ab8=_0x25d1f['count'];var _0x148737=_0x3bf563?0x0:_0x2381ee['offset'];var _0xfddf7=_0x3bf563?_0x25d1f[_0x0505('0x1d')]:_0x2381ee[_0x0505('0x1a')]+_0x2381ee[_0x0505('0x1c')];var _0x2e2f80;if(_0xfddf7>=_0xaa4ab8){_0xfddf7=_0xaa4ab8;_0x2e2f80=0xc8;}else{_0x2e2f80=0xce;}_0x4ceecd['status'](_0x2e2f80);return _0x4ceecd[_0x0505('0x1e')](_0x0505('0x1f'),_0x148737+'-'+_0xfddf7+'/'+_0xaa4ab8)[_0x0505('0x20')](_0x25d1f);}return null;};}function patchUpdates(_0x4c7a37){return function(_0x430cc1){try{jsonpatch['apply'](_0x430cc1,_0x4c7a37,!![]);}catch(_0x1d2375){return BPromise[_0x0505('0x21')](_0x1d2375);}return _0x430cc1[_0x0505('0x22')]();};}function saveUpdates(_0x1633f2,_0xe7bed0){return function(_0x501179){if(_0x501179){return _0x501179[_0x0505('0x23')](_0x1633f2)[_0x0505('0x24')](function(_0x44e0c6){return _0x44e0c6;});}return null;};}function removeEntity(_0x522879,_0xec9ef0){return function(_0x61b138){if(_0x61b138){return _0x61b138[_0x0505('0x25')]()[_0x0505('0x24')](function(){_0x522879['status'](0xcc)[_0x0505('0x19')]();});}};}function handleEntityNotFound(_0x5c5180,_0x50ba22){return function(_0x3e6bdf){if(!_0x3e6bdf){_0x5c5180['sendStatus'](0x194);}return _0x3e6bdf;};}function handleError(_0xdda687,_0x130bd1){_0x130bd1=_0x130bd1||0x1f4;return function(_0x42ba76){logger[_0x0505('0x26')](_0x42ba76['stack']);if(_0x42ba76[_0x0505('0x27')]){delete _0x42ba76[_0x0505('0x27')];}_0xdda687[_0x0505('0x18')](_0x130bd1)['send'](_0x42ba76);};}exports[_0x0505('0x28')]=function(_0x486821,_0x537e05){var _0x577609={},_0x318028={},_0x1ae3c9={'count':0x0,'rows':[]};var _0x53a808=_['map'](db[_0x0505('0x29')][_0x0505('0x2a')],function(_0xdd1847){return{'name':_0xdd1847['fieldName'],'type':_0xdd1847[_0x0505('0x2b')][_0x0505('0x2c')]};});_0x318028[_0x0505('0x2d')]=_['map'](_0x53a808,_0x0505('0x27'));_0x318028['query']=_[_0x0505('0x2e')](_0x486821[_0x0505('0x2f')]);_0x318028[_0x0505('0x30')]=_[_0x0505('0x31')](_0x318028[_0x0505('0x2d')],_0x318028[_0x0505('0x2f')]);_0x577609[_0x0505('0x32')]=_['intersection'](_0x318028['model'],qs[_0x0505('0x33')](_0x486821[_0x0505('0x2f')]['fields']));_0x577609['attributes']=_0x577609[_0x0505('0x32')][_0x0505('0x34')]?_0x577609[_0x0505('0x32')]:_0x318028[_0x0505('0x2d')];if(!_0x486821['query'][_0x0505('0x35')](_0x0505('0x36'))){_0x577609['limit']=qs['limit'](_0x486821[_0x0505('0x2f')][_0x0505('0x1c')]);_0x577609[_0x0505('0x1a')]=qs['offset'](_0x486821[_0x0505('0x2f')][_0x0505('0x1a')]);}_0x577609[_0x0505('0x37')]=qs[_0x0505('0x38')](_0x486821['query']['sort']);_0x577609[_0x0505('0x39')]=qs[_0x0505('0x30')](_[_0x0505('0x3a')](_0x486821[_0x0505('0x2f')],_0x318028[_0x0505('0x30')]),_0x53a808);if(_0x486821['query'][_0x0505('0x3b')]){_0x577609['where']=_[_0x0505('0x3c')](_0x577609[_0x0505('0x39')],{'$or':_[_0x0505('0x3d')](_0x53a808,function(_0x25e0a7){if(_0x25e0a7[_0x0505('0x2b')]!==_0x0505('0x3e')){var _0x3d06b5={};_0x3d06b5[_0x25e0a7['name']]={'$like':'%'+_0x486821[_0x0505('0x2f')]['filter']+'%'};return _0x3d06b5;}})});}_0x577609=_['merge']({},_0x577609,_0x486821[_0x0505('0x3f')]);var _0x3ff51d={'where':_0x577609['where']};return db[_0x0505('0x29')][_0x0505('0x1d')](_0x3ff51d)[_0x0505('0x24')](function(_0x40e3f8){_0x1ae3c9[_0x0505('0x1d')]=_0x40e3f8;if(_0x486821['query']['includeAll']){_0x577609[_0x0505('0x40')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0505('0x41')](_0x577609);})[_0x0505('0x24')](function(_0x371fc2){_0x1ae3c9['rows']=_0x371fc2;return _0x1ae3c9;})[_0x0505('0x24')](respondWithFilteredResult(_0x537e05,_0x577609))[_0x0505('0x42')](handleError(_0x537e05,null));};exports[_0x0505('0x43')]=function(_0x14287f,_0x5b8d64){var _0x5da0bb={'raw':!![],'where':{'id':_0x14287f[_0x0505('0x44')]['id']}},_0x51f7a2={};_0x51f7a2[_0x0505('0x2d')]=_[_0x0505('0x2e')](db[_0x0505('0x29')][_0x0505('0x2a')]);_0x51f7a2[_0x0505('0x2f')]=_[_0x0505('0x2e')](_0x14287f['query']);_0x51f7a2[_0x0505('0x30')]=_[_0x0505('0x31')](_0x51f7a2[_0x0505('0x2d')],_0x51f7a2[_0x0505('0x2f')]);_0x5da0bb[_0x0505('0x32')]=_[_0x0505('0x31')](_0x51f7a2[_0x0505('0x2d')],qs[_0x0505('0x33')](_0x14287f[_0x0505('0x2f')][_0x0505('0x33')]));_0x5da0bb[_0x0505('0x32')]=_0x5da0bb[_0x0505('0x32')][_0x0505('0x34')]?_0x5da0bb[_0x0505('0x32')]:_0x51f7a2[_0x0505('0x2d')];if(_0x14287f[_0x0505('0x2f')][_0x0505('0x45')]){_0x5da0bb['include']=[{'all':!![]}];}_0x5da0bb=_[_0x0505('0x3c')]({},_0x5da0bb,_0x14287f['options']);return db[_0x0505('0x29')]['find'](_0x5da0bb)[_0x0505('0x24')](handleEntityNotFound(_0x5b8d64,null))[_0x0505('0x24')](respondWithResult(_0x5b8d64,null))[_0x0505('0x42')](handleError(_0x5b8d64,null));};exports[_0x0505('0x23')]=function(_0x4eefc3,_0x10b303){if(_0x4eefc3[_0x0505('0x46')]['id']){delete _0x4eefc3[_0x0505('0x46')]['id'];}return db[_0x0505('0x29')][_0x0505('0x47')]({'where':{'id':_0x4eefc3[_0x0505('0x44')]['id']}})[_0x0505('0x24')](handleEntityNotFound(_0x10b303,null))[_0x0505('0x24')](saveUpdates(_0x4eefc3['body'],null))[_0x0505('0x24')](respondWithResult(_0x10b303,null))['catch'](handleError(_0x10b303,null));};exports[_0x0505('0x25')]=function(_0x291f7d,_0x3af01d){return db[_0x0505('0x29')][_0x0505('0x47')]({'where':{'id':_0x291f7d['params']['id']}})[_0x0505('0x24')](handleEntityNotFound(_0x3af01d,null))[_0x0505('0x24')](removeEntity(_0x3af01d,null))['catch'](handleError(_0x3af01d,null));};exports[_0x0505('0x48')]=function(_0xea43d4,_0x31582d){return db[_0x0505('0x29')][_0x0505('0x48')]()[_0x0505('0x24')](respondWithResult(_0x31582d,null))['catch'](handleError(_0x31582d,null));};
\ No newline at end of file
index 178b367..3e7d25f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb1ec=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util'];(function(_0x5a6de2,_0x5c8b10){var _0x2c0525=function(_0x59d072){while(--_0x59d072){_0x5a6de2['push'](_0x5a6de2['shift']());}};_0x2c0525(++_0x5c8b10);}(_0xb1ec,0x194));var _0xcb1e=function(_0x154b87,_0x1c22c7){_0x154b87=_0x154b87-0x0;var _0x59a5bf=_0xb1ec[_0x154b87];return _0x59a5bf;};'use strict';var _=require(_0xcb1e('0x0'));var util=require(_0xcb1e('0x1'));var logger=require(_0xcb1e('0x2'))(_0xcb1e('0x3'));var moment=require('moment');var BPromise=require(_0xcb1e('0x4'));var rp=require(_0xcb1e('0x5'));var fs=require('fs');var path=require(_0xcb1e('0x6'));var rimraf=require(_0xcb1e('0x7'));var config=require(_0xcb1e('0x8'));var attributes=require(_0xcb1e('0x9'));module[_0xcb1e('0xa')]=function(_0x3cdf76,_0x101dbb){return _0x3cdf76[_0xcb1e('0xb')](_0xcb1e('0xc'),attributes,{'tableName':_0xcb1e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x3fcd=['cm_hopper_black','lodash','util','api','moment','bluebird','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x41d0da,_0x2cb8c0){var _0x102c5f=function(_0x102b02){while(--_0x102b02){_0x41d0da['push'](_0x41d0da['shift']());}};_0x102c5f(++_0x2cb8c0);}(_0x3fcd,0x1ed));var _0xd3fc=function(_0xb85437,_0x29f6a3){_0xb85437=_0xb85437-0x0;var _0x27ffa3=_0x3fcd[_0xb85437];return _0x27ffa3;};'use strict';var _=require(_0xd3fc('0x0'));var util=require(_0xd3fc('0x1'));var logger=require('../../config/logger')(_0xd3fc('0x2'));var moment=require(_0xd3fc('0x3'));var BPromise=require(_0xd3fc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd3fc('0x5'));var rimraf=require(_0xd3fc('0x6'));var config=require('../../config/environment');var attributes=require(_0xd3fc('0x7'));module[_0xd3fc('0x8')]=function(_0x24216f,_0x37bb6b){return _0x24216f[_0xd3fc('0x9')](_0xd3fc('0xa'),attributes,{'tableName':_0xd3fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 6e6ff15..bd3b5f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4b47=['result','catch','GetCmHopperBlack','options','raw','where','attributes','map','include','model','stringify','CmHopperBlack','update','body','limit','then','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','CmHopperBlack,\x20%s,\x20%s','message'];(function(_0x5adc7f,_0x41c563){var _0x529810=function(_0x51461b){while(--_0x51461b){_0x5adc7f['push'](_0x5adc7f['shift']());}};_0x529810(++_0x41c563);}(_0x4b47,0x1e7));var _0x74b4=function(_0x17c9e6,_0x16bf2b){_0x17c9e6=_0x17c9e6-0x0;var _0x338388=_0x4b47[_0x17c9e6];return _0x338388;};'use strict';var _=require(_0x74b4('0x0'));var util=require(_0x74b4('0x1'));var moment=require(_0x74b4('0x2'));var BPromise=require(_0x74b4('0x3'));var rs=require(_0x74b4('0x4'));var fs=require('fs');var Redis=require(_0x74b4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x74b4('0x6'));var logger=require('../../config/logger')(_0x74b4('0x7'));var config=require('../../config/environment');var jayson=require(_0x74b4('0x8'));var client=jayson[_0x74b4('0x9')][_0x74b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x314408,_0xc5ac3e,_0x3aad75){return new BPromise(function(_0x228caa,_0x211d3a){return client[_0x74b4('0xb')](_0x314408,_0x3aad75)['then'](function(_0xe383a4){logger[_0x74b4('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0xc5ac3e,_0x74b4('0xd'));logger[_0x74b4('0xe')](_0x74b4('0xf'),_0xc5ac3e,_0x74b4('0xd'),JSON['stringify'](_0xe383a4));if(_0xe383a4[_0x74b4('0x10')]){if(_0xe383a4[_0x74b4('0x10')][_0x74b4('0x11')]===0x1f4){logger[_0x74b4('0x10')](_0x74b4('0x12'),_0xc5ac3e,_0xe383a4['error'][_0x74b4('0x13')]);return _0x211d3a(_0xe383a4[_0x74b4('0x10')]['message']);}logger[_0x74b4('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0xc5ac3e,_0xe383a4[_0x74b4('0x10')][_0x74b4('0x13')]);return _0x228caa(_0xe383a4['error']['message']);}else{logger[_0x74b4('0xc')](_0x74b4('0x12'),_0xc5ac3e,'request\x20sent');_0x228caa(_0xe383a4[_0x74b4('0x14')][_0x74b4('0x13')]);}})[_0x74b4('0x15')](function(_0x39e3d5){logger[_0x74b4('0x10')](_0x74b4('0x12'),_0xc5ac3e,_0x39e3d5);_0x211d3a(_0x39e3d5);});});}exports[_0x74b4('0x16')]=function(_0x429305){var _0x31cc71=this;return new Promise(function(_0x245420,_0x31c0de){return db['CmHopperBlack']['findAll']({'raw':_0x429305[_0x74b4('0x17')]?_0x429305[_0x74b4('0x17')][_0x74b4('0x18')]===undefined?!![]:![]:!![],'where':_0x429305[_0x74b4('0x17')]?_0x429305[_0x74b4('0x17')][_0x74b4('0x19')]||null:null,'attributes':_0x429305[_0x74b4('0x17')]?_0x429305['options'][_0x74b4('0x1a')]||null:null,'limit':_0x429305[_0x74b4('0x17')]?_0x429305['options']['limit']||null:null,'include':_0x429305[_0x74b4('0x17')]?_0x429305[_0x74b4('0x17')]['include']?_[_0x74b4('0x1b')](_0x429305[_0x74b4('0x17')][_0x74b4('0x1c')],function(_0x2671f1){return{'model':db[_0x2671f1[_0x74b4('0x1d')]],'as':_0x2671f1['as'],'attributes':_0x2671f1[_0x74b4('0x1a')],'include':_0x2671f1[_0x74b4('0x1c')]?_[_0x74b4('0x1b')](_0x2671f1['include'],function(_0x2d3dd0){return{'model':db[_0x2d3dd0['model']],'as':_0x2d3dd0['as'],'attributes':_0x2d3dd0[_0x74b4('0x1a')],'include':_0x2d3dd0[_0x74b4('0x1c')]?_['map'](_0x2d3dd0['include'],function(_0x43a878){return{'model':db[_0x43a878[_0x74b4('0x1d')]],'as':_0x43a878['as'],'attributes':_0x43a878[_0x74b4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12fe5a){logger[_0x74b4('0xc')](_0x74b4('0x16'),_0x429305);logger[_0x74b4('0xe')]('GetCmHopperBlack',_0x429305,JSON[_0x74b4('0x1e')](_0x12fe5a));_0x245420(_0x12fe5a);})['catch'](function(_0x2746c5){logger[_0x74b4('0x10')](_0x74b4('0x16'),_0x2746c5['message'],_0x429305);_0x31c0de(_0x31cc71[_0x74b4('0x10')](0x1f4,_0x2746c5[_0x74b4('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x2a91c8){var _0x2b3c5=this;return new Promise(function(_0x49cd84,_0x3a3630){return db[_0x74b4('0x1f')][_0x74b4('0x20')](_0x2a91c8[_0x74b4('0x21')],{'raw':_0x2a91c8[_0x74b4('0x17')]?_0x2a91c8[_0x74b4('0x17')][_0x74b4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a91c8['options']?_0x2a91c8[_0x74b4('0x17')]['where']||null:null,'attributes':_0x2a91c8[_0x74b4('0x17')]?_0x2a91c8[_0x74b4('0x17')][_0x74b4('0x1a')]||null:null,'limit':_0x2a91c8[_0x74b4('0x17')]?_0x2a91c8[_0x74b4('0x17')][_0x74b4('0x22')]||null:null})[_0x74b4('0x23')](function(_0x5856c9){logger['info']('UpdateCmHopperBlack',_0x2a91c8);logger[_0x74b4('0xe')]('UpdateCmHopperBlack',_0x2a91c8,JSON[_0x74b4('0x1e')](_0x5856c9));_0x49cd84(_0x5856c9);})[_0x74b4('0x15')](function(_0x552356){logger[_0x74b4('0x10')](_0x74b4('0x24'),_0x552356['message'],_0x2a91c8);_0x3a3630(_0x2b3c5[_0x74b4('0x10')](0x1f4,_0x552356[_0x74b4('0x13')]));});});};exports[_0x74b4('0x25')]=function(_0x25485d){var _0x7f955c=this;return new Promise(function(_0x31d1d8,_0x41ac16){return db[_0x74b4('0x1f')][_0x74b4('0x26')]({'where':_0x25485d[_0x74b4('0x17')]?_0x25485d[_0x74b4('0x17')][_0x74b4('0x19')]||null:null})[_0x74b4('0x23')](function(_0x2f18ce){logger[_0x74b4('0xc')]('DestroyCmHopperBlack',_0x25485d);logger[_0x74b4('0xe')]('DestroyCmHopperBlack',_0x25485d,JSON[_0x74b4('0x1e')](_0x2f18ce));_0x31d1d8(_0x2f18ce);})['catch'](function(_0x22afc1){logger[_0x74b4('0x10')](_0x74b4('0x25'),_0x22afc1[_0x74b4('0x13')],_0x25485d);_0x41ac16(_0x7f955c[_0x74b4('0x10')](0x1f4,_0x22afc1[_0x74b4('0x13')]));});});};
\ No newline at end of file
+var _0x7885=['request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','body','DestroyCmHopperBlack','destroy','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x55df3f,_0x298b77){var _0x217f11=function(_0x4298f8){while(--_0x4298f8){_0x55df3f['push'](_0x55df3f['shift']());}};_0x217f11(++_0x298b77);}(_0x7885,0x89));var _0x5788=function(_0x2ff24f,_0x306f5a){_0x2ff24f=_0x2ff24f-0x0;var _0x4d4c05=_0x7885[_0x2ff24f];return _0x4d4c05;};'use strict';var _=require('lodash');var util=require(_0x5788('0x0'));var moment=require('moment');var BPromise=require(_0x5788('0x1'));var rs=require(_0x5788('0x2'));var fs=require('fs');var Redis=require(_0x5788('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5788('0x4'));var logger=require(_0x5788('0x5'))(_0x5788('0x6'));var config=require(_0x5788('0x7'));var jayson=require(_0x5788('0x8'));var client=jayson[_0x5788('0x9')][_0x5788('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17018d,_0x25884c,_0x2ac9ee){return new BPromise(function(_0x3bbc3c,_0x4caa7d){return client[_0x5788('0xb')](_0x17018d,_0x2ac9ee)[_0x5788('0xc')](function(_0x48dbd5){logger['info'](_0x5788('0xd'),_0x25884c,_0x5788('0xe'));logger[_0x5788('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x25884c,_0x5788('0xe'),JSON[_0x5788('0x10')](_0x48dbd5));if(_0x48dbd5[_0x5788('0x11')]){if(_0x48dbd5[_0x5788('0x11')][_0x5788('0x12')]===0x1f4){logger[_0x5788('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x25884c,_0x48dbd5[_0x5788('0x11')]['message']);return _0x4caa7d(_0x48dbd5[_0x5788('0x11')][_0x5788('0x13')]);}logger['error'](_0x5788('0xd'),_0x25884c,_0x48dbd5[_0x5788('0x11')]['message']);return _0x3bbc3c(_0x48dbd5[_0x5788('0x11')][_0x5788('0x13')]);}else{logger[_0x5788('0x14')](_0x5788('0xd'),_0x25884c,_0x5788('0xe'));_0x3bbc3c(_0x48dbd5['result'][_0x5788('0x13')]);}})[_0x5788('0x15')](function(_0x3a8471){logger[_0x5788('0x11')](_0x5788('0xd'),_0x25884c,_0x3a8471);_0x4caa7d(_0x3a8471);});});}exports[_0x5788('0x16')]=function(_0x288fcc){var _0x595ec4=this;return new Promise(function(_0x25a5c6,_0x3448bf){return db[_0x5788('0x17')][_0x5788('0x18')]({'raw':_0x288fcc[_0x5788('0x19')]?_0x288fcc[_0x5788('0x19')][_0x5788('0x1a')]===undefined?!![]:![]:!![],'where':_0x288fcc[_0x5788('0x19')]?_0x288fcc[_0x5788('0x19')][_0x5788('0x1b')]||null:null,'attributes':_0x288fcc[_0x5788('0x19')]?_0x288fcc[_0x5788('0x19')][_0x5788('0x1c')]||null:null,'limit':_0x288fcc[_0x5788('0x19')]?_0x288fcc[_0x5788('0x19')][_0x5788('0x1d')]||null:null,'include':_0x288fcc[_0x5788('0x19')]?_0x288fcc['options'][_0x5788('0x1e')]?_[_0x5788('0x1f')](_0x288fcc[_0x5788('0x19')][_0x5788('0x1e')],function(_0x4f4d67){return{'model':db[_0x4f4d67[_0x5788('0x20')]],'as':_0x4f4d67['as'],'attributes':_0x4f4d67[_0x5788('0x1c')],'include':_0x4f4d67[_0x5788('0x1e')]?_['map'](_0x4f4d67['include'],function(_0x5cdcb6){return{'model':db[_0x5cdcb6[_0x5788('0x20')]],'as':_0x5cdcb6['as'],'attributes':_0x5cdcb6[_0x5788('0x1c')],'include':_0x5cdcb6['include']?_[_0x5788('0x1f')](_0x5cdcb6['include'],function(_0xd44368){return{'model':db[_0xd44368[_0x5788('0x20')]],'as':_0xd44368['as'],'attributes':_0xd44368[_0x5788('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f5ebf){logger[_0x5788('0x14')](_0x5788('0x16'),_0x288fcc);logger[_0x5788('0xf')](_0x5788('0x16'),_0x288fcc,JSON[_0x5788('0x10')](_0x2f5ebf));_0x25a5c6(_0x2f5ebf);})['catch'](function(_0x2bc5f4){logger[_0x5788('0x11')]('GetCmHopperBlack',_0x2bc5f4[_0x5788('0x13')],_0x288fcc);_0x3448bf(_0x595ec4[_0x5788('0x11')](0x1f4,_0x2bc5f4[_0x5788('0x13')]));});});};exports[_0x5788('0x21')]=function(_0x39b6ae){var _0x3d9259=this;return new Promise(function(_0x3d1ddd,_0x36b10c){return db['CmHopperBlack']['update'](_0x39b6ae[_0x5788('0x22')],{'raw':_0x39b6ae[_0x5788('0x19')]?_0x39b6ae[_0x5788('0x19')][_0x5788('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39b6ae[_0x5788('0x19')]?_0x39b6ae[_0x5788('0x19')][_0x5788('0x1b')]||null:null,'attributes':_0x39b6ae[_0x5788('0x19')]?_0x39b6ae[_0x5788('0x19')]['attributes']||null:null,'limit':_0x39b6ae['options']?_0x39b6ae[_0x5788('0x19')][_0x5788('0x1d')]||null:null})[_0x5788('0xc')](function(_0x2ecc56){logger['info'](_0x5788('0x21'),_0x39b6ae);logger[_0x5788('0xf')](_0x5788('0x21'),_0x39b6ae,JSON[_0x5788('0x10')](_0x2ecc56));_0x3d1ddd(_0x2ecc56);})[_0x5788('0x15')](function(_0x278b5d){logger[_0x5788('0x11')](_0x5788('0x21'),_0x278b5d[_0x5788('0x13')],_0x39b6ae);_0x36b10c(_0x3d9259[_0x5788('0x11')](0x1f4,_0x278b5d[_0x5788('0x13')]));});});};exports[_0x5788('0x23')]=function(_0x8472a8){var _0x116493=this;return new Promise(function(_0x11f393,_0x419a1f){return db[_0x5788('0x17')][_0x5788('0x24')]({'where':_0x8472a8[_0x5788('0x19')]?_0x8472a8[_0x5788('0x19')]['where']||null:null})['then'](function(_0x1f6879){logger[_0x5788('0x14')]('DestroyCmHopperBlack',_0x8472a8);logger[_0x5788('0xf')]('DestroyCmHopperBlack',_0x8472a8,JSON[_0x5788('0x10')](_0x1f6879));_0x11f393(_0x1f6879);})[_0x5788('0x15')](function(_0x2fbcc4){logger['error'](_0x5788('0x23'),_0x2fbcc4['message'],_0x8472a8);_0x419a1f(_0x116493[_0x5788('0x11')](0x1f4,_0x2fbcc4[_0x5788('0x13')]));});});};
\ No newline at end of file
index f671af4..be0b8bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d38=['exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x1fa973,_0x5bbca5){var _0x2946d4=function(_0x258f4b){while(--_0x258f4b){_0x1fa973['push'](_0x1fa973['shift']());}};_0x2946d4(++_0x5bbca5);}(_0x6d38,0x1ef));var _0x86d3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6d38[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['put'](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['update']);router['delete'](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['destroy']);module[_0x86d3('0xc')]=router;
\ No newline at end of file
+var _0xe3da=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','exports','multer'];(function(_0x295049,_0x59246e){var _0x4c1452=function(_0x15f1a9){while(--_0x15f1a9){_0x295049['push'](_0x295049['shift']());}};_0x4c1452(++_0x59246e);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0x11')](_0xae3d('0x12'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x13')]);router[_0xae3d('0x14')]('/:id',auth[_0xae3d('0xc')](),controller['destroy']);module[_0xae3d('0x15')]=router;
\ No newline at end of file
index 8e0a3f9..f1c6f79 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x045a=['followuptime','diff','BOOLEAN','sequelize','moment','exports','INTEGER','DATE','STRING','getDataValue','setDataValue'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x045a,0x92));var _0xa045=function(_0x3895cc,_0x5e85de){_0x3895cc=_0x3895cc-0x0;var _0x82ffb2=_0x045a[_0x3895cc];return _0x82ffb2;};'use strict';var Sequelize=require(_0xa045('0x0'));var moment=require(_0xa045('0x1'));module[_0xa045('0x2')]={'state':{'type':Sequelize[_0xa045('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xa045('0x4')]},'countbusyretry':{'type':Sequelize[_0xa045('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa045('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa045('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa045('0x5')]},'originatecalleridnum':{'type':Sequelize[_0xa045('0x5')]},'originatecalleridname':{'type':Sequelize[_0xa045('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa045('0x5')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xa045('0x4')]},'droptime':{'type':Sequelize[_0xa045('0x4')]},'endtime':{'type':Sequelize[_0xa045('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa045('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa045('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa045('0x5')]},'campaign':{'type':Sequelize[_0xa045('0x5')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa045('0x5')]},'reason':{'type':Sequelize[_0xa045('0x5')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa045('0x5')]},'thirdDisposition':{'type':Sequelize[_0xa045('0x5')]},'dispositionat':{'type':Sequelize[_0xa045('0x4')],'set':function(_0x2ea5e7){var _0xc1a308=this[_0xa045('0x6')]('endtime');if(_0xc1a308&&_0x2ea5e7){this[_0xa045('0x7')](_0xa045('0x8'),moment(_0x2ea5e7)[_0xa045('0x9')](moment(_0xc1a308),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xa045('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa045('0x4')]},'callback':{'type':Sequelize[_0xa045('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa045('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa045('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xa045('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xa045('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xa045('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa045('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa045('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa045('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa045('0x3')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x9702=['seconds','BOOLEAN','sequelize','moment','exports','INTEGER','DATE','STRING','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0xb7fb38,_0x4e657c){var _0x305669=function(_0x27f4b2){while(--_0x27f4b2){_0xb7fb38['push'](_0xb7fb38['shift']());}};_0x305669(++_0x4e657c);}(_0x9702,0x154));var _0x2970=function(_0x2ef5e4,_0x6cad14){_0x2ef5e4=_0x2ef5e4-0x0;var _0x5bb7fe=_0x9702[_0x2ef5e4];return _0x5bb7fe;};'use strict';var Sequelize=require(_0x2970('0x0'));var moment=require(_0x2970('0x1'));module[_0x2970('0x2')]={'state':{'type':Sequelize[_0x2970('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x2970('0x4')]},'countbusyretry':{'type':Sequelize[_0x2970('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2970('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2970('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2970('0x5')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x2970('0x5')]},'calleridname':{'type':Sequelize[_0x2970('0x5')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x2970('0x4')]},'answertime':{'type':Sequelize[_0x2970('0x4')]},'droptime':{'type':Sequelize[_0x2970('0x4')]},'endtime':{'type':Sequelize[_0x2970('0x4')]},'ringtime':{'type':Sequelize[_0x2970('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2970('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2970('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2970('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2970('0x5')]},'campaign':{'type':Sequelize[_0x2970('0x5')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2970('0x5')]},'reason':{'type':Sequelize[_0x2970('0x5')]},'disposition':{'type':Sequelize[_0x2970('0x5')]},'secondDisposition':{'type':Sequelize[_0x2970('0x5')]},'thirdDisposition':{'type':Sequelize[_0x2970('0x5')]},'dispositionat':{'type':Sequelize[_0x2970('0x4')],'set':function(_0x5167b5){var _0x5ee454=this[_0x2970('0x6')](_0x2970('0x7'));if(_0x5ee454&&_0x5167b5){this[_0x2970('0x8')](_0x2970('0x9'),moment(_0x5167b5)[_0x2970('0xa')](moment(_0x5ee454),_0x2970('0xb')));}}},'amd':{'type':Sequelize[_0x2970('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2970('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x2970('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2970('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x2970('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2970('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2970('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2970('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x2970('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2970('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2970('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2970('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
index 7b287aa..3188b65 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x33af=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','fromQuery','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x105089,_0x1c6cee){var _0x5422ed=function(_0x3f30a3){while(--_0x3f30a3){_0x105089['push'](_0x105089['shift']());}};_0x5422ed(++_0x1c6cee);}(_0x33af,0xec));var _0xf33a=function(_0x5351d4,_0x9fad72){_0x5351d4=_0x5351d4-0x0;var _0x158dd6=_0x33af[_0x5351d4];return _0x158dd6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['CmHopperFinal'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':!![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')]()[_0xf33a('0x26')](respondWithResult(_0x1a98f9,null))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x4107b1,_0x190a2b){if(_0x4107b1[_0xf33a('0x48')][_0xf33a('0x49')]){delete _0x4107b1[_0xf33a('0x48')][_0xf33a('0x49')];}return db[_0xf33a('0x2d')][_0xf33a('0x4a')]({'where':{'uniqueid':_0x4107b1[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x190a2b,null))[_0xf33a('0x26')](saveUpdates(_0x4107b1[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x190a2b,null))[_0xf33a('0x42')](handleError(_0x190a2b,null));};exports[_0xf33a('0x4b')]=function(_0x3bab07,_0x1f7d8c,_0x57815c){return db['CmHopperFinal'][_0xf33a('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x3bab07[_0xf33a('0x44')]['id']},'attributes':[[db['sequelize']['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal'](_0xf33a('0x4e')))),_0xf33a('0x4f')],[db[_0xf33a('0x4d')]['fn']('COUNT',db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x51')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal'](_0xf33a('0x52')))),_0xf33a('0x53')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xf33a('0x54')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x55')))),'dropContacts'],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x56')))),_0xf33a('0x57')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x58')))),'answeringMachine']]})[_0xf33a('0x26')](handleEntityNotFound(_0x1f7d8c,null))[_0xf33a('0x26')](respondWithResult(_0x1f7d8c,null))[_0xf33a('0x42')](handleError(_0x1f7d8c,null));};exports[_0xf33a('0x59')]=function(_0x2f1fef,_0x129229,_0x473484){return db[_0xf33a('0x2d')][_0xf33a('0x40')]({'raw':![],'where':{'CampaignId':_0x2f1fef[_0xf33a('0x44')]['id']},'attributes':[[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xf33a('0x4f')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x51')))),_0xf33a('0x5a')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x52')))),_0xf33a('0x53')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x5b')))),'congestionContacts'],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x55')))),_0xf33a('0x5c')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x5d')))),_0xf33a('0x5e')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x56')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x58')))),_0xf33a('0x5f')]]})[_0xf33a('0x26')](handleEntityNotFound(_0x129229,null))[_0xf33a('0x26')](respondWithResult(_0x129229,null))[_0xf33a('0x42')](handleError(_0x129229,null));};exports[_0xf33a('0x60')]=function(_0x3bebca,_0x40bb02,_0x10a271){return db['VoiceQueue'][_0xf33a('0x4a')]({'where':{'id':_0x3bebca['params']['id']}})['then'](handleEntityNotFound(_0x40bb02,null))[_0xf33a('0x26')](function(_0x25cc49){var _0x132764;if(_0x25cc49){_0x132764=squel['insert']()['into'](_0xf33a('0x61'))['fromQuery']([_0xf33a('0x62'),_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),_0xf33a('0x66'),'createdAt','updatedAt'],squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x62'))['field'](_0xf33a('0x6a'),_0xf33a('0x63'))['field'](_0xf33a('0x6b'),_0xf33a('0x64'))[_0xf33a('0x68')]('ANY_VALUE(ListId)',_0xf33a('0x65'))[_0xf33a('0x68')](_0xf33a('0x6c'),_0xf33a('0x66'))['field'](_0xf33a('0x6a'),_0xf33a('0x6d'))[_0xf33a('0x68')]('NOW()',_0xf33a('0x6e'))[_0xf33a('0x6f')](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id'][_0xf33a('0x72')]())[_0xf33a('0x3b')](_0xf33a('0x73'),_0x3bebca[_0xf33a('0x48')][_0xf33a('0x74')][_0xf33a('0x72')]())[_0xf33a('0x3b')](_0xf33a('0x75'))[_0xf33a('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x62'))[_0xf33a('0x6f')](_0xf33a('0x61'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id'][_0xf33a('0x72')]()))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))['from'](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id']['toString']())[_0xf33a('0x3b')](_0xf33a('0x78')))[_0xf33a('0x79')](_0xf33a('0x64')))[_0xf33a('0x72')]();return db[_0xf33a('0x4d')][_0xf33a('0x32')](_0x132764);}return[];})[_0xf33a('0x26')](respondWithResult(_0x40bb02,null))['catch'](handleError(_0x40bb02,null));};exports[_0xf33a('0x7a')]=function(_0x1dfb59,_0x9c0b99,_0x17b2fa){return db['Campaign']['find']({'where':{'id':_0x1dfb59[_0xf33a('0x44')]['id']}})['then'](handleEntityNotFound(_0x9c0b99,null))[_0xf33a('0x26')](function(_0x1595b7){var _0x3d8dbe;if(_0x1595b7){_0x3d8dbe=squel[_0xf33a('0x7b')]()['into']('cm_hopper')[_0xf33a('0x7c')](['phone',_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),_0xf33a('0x7d'),_0xf33a('0x6d'),_0xf33a('0x6e')],squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x62'))[_0xf33a('0x68')](_0xf33a('0x6a'),_0xf33a('0x63'))[_0xf33a('0x68')](_0xf33a('0x6b'),_0xf33a('0x64'))['field'](_0xf33a('0x7e'),'ListId')[_0xf33a('0x68')]('ANY_VALUE(CampaignId)','CampaignId')['field'](_0xf33a('0x6a'),_0xf33a('0x6d'))['field'](_0xf33a('0x6a'),_0xf33a('0x6e'))[_0xf33a('0x6f')](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x7f'),_0x1dfb59['params']['id'][_0xf33a('0x72')]())[_0xf33a('0x3b')]('state\x20=\x20?',_0x1dfb59[_0xf33a('0x48')][_0xf33a('0x74')][_0xf33a('0x72')]())['where'](_0xf33a('0x75'))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')]('phone')[_0xf33a('0x6f')](_0xf33a('0x61'))[_0xf33a('0x3b')](_0xf33a('0x7f'),_0x1dfb59[_0xf33a('0x44')]['id']['toString']()))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))['from'](_0xf33a('0x70'))['where']('CampaignId\x20=\x20?',_0x1dfb59[_0xf33a('0x44')]['id']['toString']())[_0xf33a('0x3b')](_0xf33a('0x78')))['group'](_0xf33a('0x64')))[_0xf33a('0x72')]();return db[_0xf33a('0x4d')][_0xf33a('0x32')](_0x3d8dbe);}return[];})[_0xf33a('0x26')](respondWithResult(_0x9c0b99,null))[_0xf33a('0x42')](handleError(_0x9c0b99,null));};exports[_0xf33a('0x80')]=function(_0x4abd84,_0x1205d1,_0x1d83a0){return db[_0xf33a('0x81')][_0xf33a('0x82')]({'where':{'VoiceQueueId':_0x4abd84['body'][_0xf33a('0x66')],'CampaignId':_0x4abd84['body'][_0xf33a('0x7d')],'ContactId':_0x4abd84[_0xf33a('0x48')][_0xf33a('0x64')]}})[_0xf33a('0x26')](handleEntityNotFound(_0x1205d1,null))[_0xf33a('0x26')](function(_0x49c40a){if(_0x49c40a){return _0x49c40a;}return null;})[_0xf33a('0x26')](respondWithResult(_0x1205d1,null))[_0xf33a('0x42')](handleError(_0x1205d1,null));};
\ No newline at end of file
+var _0xeff8=['eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','noAnswerContacts','`state`\x20=\x2011\x20,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','toString','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne'];(function(_0x56d91d,_0x59b68a){var _0x4b263c=function(_0x2bb11d){while(--_0x2bb11d){_0x56d91d['push'](_0x56d91d['shift']());}};_0x4b263c(++_0x59b68a);}(_0xeff8,0x186));var _0x8eff=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xeff8[_0x1f9f37];return _0x21c080;};'use strict';var emlformat=require(_0x8eff('0x0'));var rimraf=require(_0x8eff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eff('0x2'));var rp=require(_0x8eff('0x3'));var moment=require(_0x8eff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8eff('0x5'));var util=require(_0x8eff('0x6'));var path=require(_0x8eff('0x7'));var sox=require(_0x8eff('0x8'));var csv=require('to-csv');var ejs=require(_0x8eff('0x9'));var fs=require('fs');var fs_extra=require(_0x8eff('0xa'));var _=require(_0x8eff('0xb'));var squel=require(_0x8eff('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eff('0xd'));var deskjs=require(_0x8eff('0xe'));var toCsv=require(_0x8eff('0xf'));var querystring=require(_0x8eff('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eff('0x11'));var qs=require(_0x8eff('0x12'));var as=require(_0x8eff('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eff('0x14'))(_0x8eff('0x15'));var utils=require('../../config/utils');var config=require(_0x8eff('0x16'));var licenseUtil=require(_0x8eff('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xcc;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0x18')](_0x45f280);}return _0x4a399e[_0x8eff('0x19')](_0x45f280)[_0x8eff('0x1a')]();};}function respondWithResult(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0xc8;return function(_0x212a2e){if(_0x212a2e){return _0x56efdf[_0x8eff('0x19')](_0x3e7c01)[_0x8eff('0x1b')](_0x212a2e);}};}function respondWithFilteredResult(_0x228eb1,_0x4cfc91){return function(_0x16202e){if(_0x16202e){var _0xdbb753=typeof _0x4cfc91[_0x8eff('0x1c')]===_0x8eff('0x1d')&&typeof _0x4cfc91[_0x8eff('0x1e')]==='undefined';var _0x32b791=_0x16202e[_0x8eff('0x1f')];var _0x3cd1dc=_0xdbb753?0x0:_0x4cfc91[_0x8eff('0x1c')];var _0x2cd7c5=_0xdbb753?_0x16202e[_0x8eff('0x1f')]:_0x4cfc91[_0x8eff('0x1c')]+_0x4cfc91[_0x8eff('0x1e')];var _0x1b003c;if(_0x2cd7c5>=_0x32b791){_0x2cd7c5=_0x32b791;_0x1b003c=0xc8;}else{_0x1b003c=0xce;}_0x228eb1[_0x8eff('0x19')](_0x1b003c);return _0x228eb1[_0x8eff('0x20')](_0x8eff('0x21'),_0x3cd1dc+'-'+_0x2cd7c5+'/'+_0x32b791)[_0x8eff('0x1b')](_0x16202e);}return null;};}function patchUpdates(_0x2a7337){return function(_0xdbb7b5){try{jsonpatch[_0x8eff('0x22')](_0xdbb7b5,_0x2a7337,!![]);}catch(_0x5e157c){return BPromise[_0x8eff('0x23')](_0x5e157c);}return _0xdbb7b5[_0x8eff('0x24')]();};}function saveUpdates(_0x5a2492,_0x1c4ad3){return function(_0x5ea31f){if(_0x5ea31f){return _0x5ea31f[_0x8eff('0x25')](_0x5a2492)[_0x8eff('0x26')](function(_0x1ccc79){return _0x1ccc79;});}return null;};}function removeEntity(_0x59cc32,_0x1ee09c){return function(_0x4e891c){if(_0x4e891c){return _0x4e891c[_0x8eff('0x27')]()[_0x8eff('0x26')](function(){_0x59cc32['status'](0xcc)[_0x8eff('0x1a')]();});}};}function handleEntityNotFound(_0x5ec3d7,_0x40404b){return function(_0x3b698b){if(!_0x3b698b){_0x5ec3d7[_0x8eff('0x18')](0x194);}return _0x3b698b;};}function handleError(_0x41324b,_0x6359df){_0x6359df=_0x6359df||0x1f4;return function(_0x2e8067){logger['error'](_0x2e8067[_0x8eff('0x28')]);if(_0x2e8067[_0x8eff('0x29')]){delete _0x2e8067[_0x8eff('0x29')];}_0x41324b[_0x8eff('0x19')](_0x6359df)[_0x8eff('0x2a')](_0x2e8067);};}exports[_0x8eff('0x2b')]=function(_0x4cc146,_0x4ed3b8){var _0x44dcdb={},_0x472b19={},_0x17ff3f={'count':0x0,'rows':[]};var _0x5ce071=_[_0x8eff('0x2c')](db[_0x8eff('0x2d')][_0x8eff('0x2e')],function(_0x1da0fa){return{'name':_0x1da0fa[_0x8eff('0x2f')],'type':_0x1da0fa[_0x8eff('0x30')][_0x8eff('0x31')]};});_0x472b19[_0x8eff('0x32')]=_[_0x8eff('0x2c')](_0x5ce071,_0x8eff('0x29'));_0x472b19[_0x8eff('0x33')]=_[_0x8eff('0x34')](_0x4cc146['query']);_0x472b19[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],_0x472b19[_0x8eff('0x33')]);_0x44dcdb['attributes']=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],qs['fields'](_0x4cc146['query'][_0x8eff('0x37')]));_0x44dcdb[_0x8eff('0x38')]=_0x44dcdb['attributes']['length']?_0x44dcdb['attributes']:_0x472b19[_0x8eff('0x32')];if(!_0x4cc146['query'][_0x8eff('0x39')]('nolimit')){_0x44dcdb[_0x8eff('0x1e')]=qs[_0x8eff('0x1e')](_0x4cc146[_0x8eff('0x33')][_0x8eff('0x1e')]);_0x44dcdb[_0x8eff('0x1c')]=qs[_0x8eff('0x1c')](_0x4cc146['query'][_0x8eff('0x1c')]);}_0x44dcdb['order']=qs[_0x8eff('0x3a')](_0x4cc146['query'][_0x8eff('0x3a')]);_0x44dcdb[_0x8eff('0x3b')]=qs[_0x8eff('0x35')](_[_0x8eff('0x3c')](_0x4cc146['query'],_0x472b19[_0x8eff('0x35')]),_0x5ce071);if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x3d')]){_0x44dcdb['where']=_[_0x8eff('0x3e')](_0x44dcdb[_0x8eff('0x3b')],{'$or':_[_0x8eff('0x2c')](_0x5ce071,function(_0x345bc7){if(_0x345bc7[_0x8eff('0x30')]!==_0x8eff('0x3f')){var _0x29f68e={};_0x29f68e[_0x345bc7[_0x8eff('0x29')]]={'$like':'%'+_0x4cc146[_0x8eff('0x33')]['filter']+'%'};return _0x29f68e;}})});}_0x44dcdb=_['merge']({},_0x44dcdb,_0x4cc146[_0x8eff('0x40')]);var _0x114f8e={'where':_0x44dcdb[_0x8eff('0x3b')]};return db[_0x8eff('0x2d')][_0x8eff('0x1f')](_0x114f8e)[_0x8eff('0x26')](function(_0x18b132){_0x17ff3f['count']=_0x18b132;if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x41')]){_0x44dcdb['include']=[{'all':!![]}];}return db[_0x8eff('0x2d')][_0x8eff('0x42')](_0x44dcdb);})[_0x8eff('0x26')](function(_0x18309b){_0x17ff3f[_0x8eff('0x43')]=_0x18309b;return _0x17ff3f;})[_0x8eff('0x26')](respondWithFilteredResult(_0x4ed3b8,_0x44dcdb))[_0x8eff('0x44')](handleError(_0x4ed3b8,null));};exports[_0x8eff('0x45')]=function(_0x6d0568,_0x480c4c){var _0x37f376={'raw':!![],'where':{'id':_0x6d0568[_0x8eff('0x46')]['id']}},_0x27a8c9={};_0x27a8c9[_0x8eff('0x32')]=_[_0x8eff('0x34')](db['CmHopperFinal'][_0x8eff('0x2e')]);_0x27a8c9['query']=_[_0x8eff('0x34')](_0x6d0568[_0x8eff('0x33')]);_0x27a8c9[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x27a8c9['model'],_0x27a8c9[_0x8eff('0x33')]);_0x37f376[_0x8eff('0x38')]=_[_0x8eff('0x36')](_0x27a8c9['model'],qs['fields'](_0x6d0568[_0x8eff('0x33')][_0x8eff('0x37')]));_0x37f376[_0x8eff('0x38')]=_0x37f376[_0x8eff('0x38')][_0x8eff('0x47')]?_0x37f376['attributes']:_0x27a8c9[_0x8eff('0x32')];if(_0x6d0568['query'][_0x8eff('0x41')]){_0x37f376[_0x8eff('0x48')]=[{'all':!![]}];}_0x37f376=_['merge']({},_0x37f376,_0x6d0568['options']);return db['CmHopperFinal']['find'](_0x37f376)['then'](handleEntityNotFound(_0x480c4c,null))['then'](respondWithResult(_0x480c4c,null))[_0x8eff('0x44')](handleError(_0x480c4c,null));};exports[_0x8eff('0x49')]=function(_0x33aa8d,_0x1b5fda){return db[_0x8eff('0x2d')][_0x8eff('0x49')]()[_0x8eff('0x26')](respondWithResult(_0x1b5fda,null))[_0x8eff('0x44')](handleError(_0x1b5fda,null));};exports[_0x8eff('0x25')]=function(_0x3287d6,_0x4c7013){if(_0x3287d6[_0x8eff('0x4a')]['uniqueid']){delete _0x3287d6[_0x8eff('0x4a')][_0x8eff('0x4b')];}return db[_0x8eff('0x2d')][_0x8eff('0x4c')]({'where':{'uniqueid':_0x3287d6[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x4c7013,null))[_0x8eff('0x26')](saveUpdates(_0x3287d6[_0x8eff('0x4a')],null))[_0x8eff('0x26')](respondWithResult(_0x4c7013,null))[_0x8eff('0x44')](handleError(_0x4c7013,null));};exports[_0x8eff('0x4d')]=function(_0x452f7a,_0x47b28d,_0x13ae7c){return db[_0x8eff('0x2d')][_0x8eff('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x452f7a[_0x8eff('0x46')]['id']},'attributes':[[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x51')))),'noAnswerContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db['sequelize'][_0x8eff('0x50')](_0x8eff('0x52')))),_0x8eff('0x53')],[db[_0x8eff('0x4e')]['fn']('COUNT',db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x54')))),_0x8eff('0x55')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x56')))),_0x8eff('0x57')],[db[_0x8eff('0x4e')]['fn']('COUNT',db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x8eff('0x58')],[db['sequelize']['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x59')))),_0x8eff('0x5a')],[db[_0x8eff('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eff('0x4e')]['literal'](_0x8eff('0x5b')))),_0x8eff('0x5c')]]})[_0x8eff('0x26')](handleEntityNotFound(_0x47b28d,null))[_0x8eff('0x26')](respondWithResult(_0x47b28d,null))[_0x8eff('0x44')](handleError(_0x47b28d,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x4064bd,_0x36afc3,_0x1813df){return db[_0x8eff('0x2d')][_0x8eff('0x42')]({'raw':![],'where':{'CampaignId':_0x4064bd[_0x8eff('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0x8eff('0x5d')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x51')))),_0x8eff('0x5e')],[db['sequelize']['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0x8eff('0x50')](_0x8eff('0x52')))),'busyContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0x8eff('0x55')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x56')))),'dropContacts'],[db['sequelize']['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x5f')))),_0x8eff('0x58')],[db[_0x8eff('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eff('0x4e')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x5b')))),_0x8eff('0x5c')]]})[_0x8eff('0x26')](handleEntityNotFound(_0x36afc3,null))['then'](respondWithResult(_0x36afc3,null))[_0x8eff('0x44')](handleError(_0x36afc3,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x42efc6,_0x35a221,_0x12ebd1){return db[_0x8eff('0x60')][_0x8eff('0x4c')]({'where':{'id':_0x42efc6[_0x8eff('0x46')]['id']}})['then'](handleEntityNotFound(_0x35a221,null))[_0x8eff('0x26')](function(_0x545fcf){var _0x1d8d8f;if(_0x545fcf){_0x1d8d8f=squel[_0x8eff('0x61')]()[_0x8eff('0x62')](_0x8eff('0x63'))[_0x8eff('0x64')]([_0x8eff('0x65'),_0x8eff('0x66'),_0x8eff('0x67'),_0x8eff('0x68'),'VoiceQueueId',_0x8eff('0x69'),_0x8eff('0x6a')],squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')](_0x8eff('0x6d'),_0x8eff('0x65'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x66'))[_0x8eff('0x6c')]('ANY_VALUE(ContactId)','ContactId')['field']('ANY_VALUE(ListId)',_0x8eff('0x68'))[_0x8eff('0x6c')](_0x8eff('0x6f'),_0x8eff('0x70'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x69'))['field'](_0x8eff('0x6e'),_0x8eff('0x6a'))[_0x8eff('0x71')](_0x8eff('0x72'))['where'](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id']['toString']())[_0x8eff('0x3b')](_0x8eff('0x74'),_0x42efc6[_0x8eff('0x4a')]['state']['toString']())['where'](_0x8eff('0x75'))[_0x8eff('0x3b')](_0x8eff('0x76'),squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')](_0x8eff('0x65'))[_0x8eff('0x71')](_0x8eff('0x63'))[_0x8eff('0x3b')](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id']['toString']()))[_0x8eff('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')]('calleridnum')[_0x8eff('0x71')]('cm_hopper_final')[_0x8eff('0x3b')](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id'][_0x8eff('0x77')]())[_0x8eff('0x3b')]('state\x20=\x204'))[_0x8eff('0x78')](_0x8eff('0x67')))[_0x8eff('0x77')]();return db[_0x8eff('0x4e')][_0x8eff('0x33')](_0x1d8d8f);}return[];})[_0x8eff('0x26')](respondWithResult(_0x35a221,null))[_0x8eff('0x44')](handleError(_0x35a221,null));};exports[_0x8eff('0x79')]=function(_0x23a771,_0x452b90,_0x43bbce){return db['Campaign'][_0x8eff('0x4c')]({'where':{'id':_0x23a771[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x452b90,null))[_0x8eff('0x26')](function(_0x17f63b){var _0x582478;if(_0x17f63b){_0x582478=squel[_0x8eff('0x61')]()[_0x8eff('0x62')]('cm_hopper')['fromQuery']([_0x8eff('0x65'),_0x8eff('0x66'),_0x8eff('0x67'),_0x8eff('0x68'),_0x8eff('0x7a'),_0x8eff('0x69'),'updatedAt'],squel[_0x8eff('0x6b')]()['field'](_0x8eff('0x6d'),_0x8eff('0x65'))['field'](_0x8eff('0x6e'),'scheduledAt')['field'](_0x8eff('0x7b'),'ContactId')[_0x8eff('0x6c')](_0x8eff('0x7c'),'ListId')[_0x8eff('0x6c')](_0x8eff('0x7d'),'CampaignId')[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x69'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x6a'))[_0x8eff('0x71')](_0x8eff('0x72'))[_0x8eff('0x3b')]('CampaignId\x20=\x20?',_0x23a771['params']['id']['toString']())[_0x8eff('0x3b')](_0x8eff('0x74'),_0x23a771[_0x8eff('0x4a')]['state'][_0x8eff('0x77')]())[_0x8eff('0x3b')](_0x8eff('0x75'))[_0x8eff('0x3b')](_0x8eff('0x76'),squel[_0x8eff('0x6b')]()['field'](_0x8eff('0x65'))['from'](_0x8eff('0x63'))[_0x8eff('0x3b')](_0x8eff('0x7e'),_0x23a771[_0x8eff('0x46')]['id'][_0x8eff('0x77')]()))[_0x8eff('0x3b')](_0x8eff('0x76'),squel['select']()[_0x8eff('0x6c')](_0x8eff('0x7f'))[_0x8eff('0x71')](_0x8eff('0x72'))[_0x8eff('0x3b')]('CampaignId\x20=\x20?',_0x23a771[_0x8eff('0x46')]['id'][_0x8eff('0x77')]())[_0x8eff('0x3b')]('state\x20=\x204'))['group'](_0x8eff('0x67')))[_0x8eff('0x77')]();return db[_0x8eff('0x4e')]['query'](_0x582478);}return[];})[_0x8eff('0x26')](respondWithResult(_0x452b90,null))['catch'](handleError(_0x452b90,null));};exports['checkContactHopper']=function(_0x10b9ac,_0x6bc93b,_0x10ade6){return db[_0x8eff('0x80')][_0x8eff('0x81')]({'where':{'VoiceQueueId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x70')],'CampaignId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x7a')],'ContactId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x67')]}})[_0x8eff('0x26')](handleEntityNotFound(_0x6bc93b,null))['then'](function(_0x34a0f7){if(_0x34a0f7){return _0x34a0f7;}return null;})[_0x8eff('0x26')](respondWithResult(_0x6bc93b,null))[_0x8eff('0x44')](handleError(_0x6bc93b,null));};
\ No newline at end of file
index 938b8b9..77fbb06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x81d6=['../../config/environment','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x3d2aac,_0x4df601){var _0x5e31ee=function(_0x27e9ed){while(--_0x27e9ed){_0x3d2aac['push'](_0x3d2aac['shift']());}};_0x5e31ee(++_0x4df601);}(_0x81d6,0x165));var _0x681d=function(_0x25ae22,_0x517484){_0x25ae22=_0x25ae22-0x0;var _0x258569=_0x81d6[_0x25ae22];return _0x258569;};'use strict';var _=require(_0x681d('0x0'));var util=require(_0x681d('0x1'));var logger=require(_0x681d('0x2'))(_0x681d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x681d('0x4'));var fs=require('fs');var path=require(_0x681d('0x5'));var rimraf=require(_0x681d('0x6'));var config=require(_0x681d('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0x681d('0x8')]=function(_0xf89c41,_0x5ebbe1){return _0xf89c41[_0x681d('0x9')]('CmHopperFinal',attributes,{'tableName':_0x681d('0xa'),'paranoid':![],'indexes':[{'name':_0x681d('0xb'),'fields':[_0x681d('0xb')]},{'name':_0x681d('0xc'),'fields':[_0x681d('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x9586=['calleridnum','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final'];(function(_0x2cc013,_0x151a6a){var _0x17e52e=function(_0x4ba2bd){while(--_0x4ba2bd){_0x2cc013['push'](_0x2cc013['shift']());}};_0x17e52e(++_0x151a6a);}(_0x9586,0x12e));var _0x6958=function(_0x5d8a0f,_0x36c1da){_0x5d8a0f=_0x5d8a0f-0x0;var _0x19b518=_0x9586[_0x5d8a0f];return _0x19b518;};'use strict';var _=require('lodash');var util=require(_0x6958('0x0'));var logger=require(_0x6958('0x1'))(_0x6958('0x2'));var moment=require(_0x6958('0x3'));var BPromise=require(_0x6958('0x4'));var rp=require(_0x6958('0x5'));var fs=require('fs');var path=require(_0x6958('0x6'));var rimraf=require(_0x6958('0x7'));var config=require(_0x6958('0x8'));var attributes=require(_0x6958('0x9'));module[_0x6958('0xa')]=function(_0x5b8bb9,_0xbc2fc8){return _0x5b8bb9[_0x6958('0xb')]('CmHopperFinal',attributes,{'tableName':_0x6958('0xc'),'paranoid':![],'indexes':[{'name':_0x6958('0xd'),'fields':['calleridnum']},{'name':'uniqueid','fields':[_0x6958('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
index 41c1399..12a4e3c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xd38de0,_0x21597f){var _0x20bd73=function(_0x5701a7){while(--_0x5701a7){_0xd38de0['push'](_0xd38de0['shift']());}};_0x20bd73(++_0x21597f);}(_0x7a54,0x106));var _0x47a5=function(_0x536cf7,_0x1d0385){_0x536cf7=_0x536cf7-0x0;var _0x2c1877=_0x7a54[_0x536cf7];return _0x2c1877;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};
\ No newline at end of file
+var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x41d4ec,_0x5b9da2){var _0x2f7df9=function(_0x59dde7){while(--_0x59dde7){_0x41d4ec['push'](_0x41d4ec['shift']());}};_0x2f7df9(++_0x5b9da2);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c12ae,_0x29ab56){_0x5c12ae=_0x5c12ae-0x0;var _0x6b60d1=_0xb10b[_0x5c12ae];return _0x6b60d1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});};
\ No newline at end of file
index f5eb903..c4b2a10 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe57d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','update','exports','multer','util','path','connect-timeout','Router'];(function(_0x1608df,_0x556c7c){var _0x157270=function(_0x6ec6fd){while(--_0x6ec6fd){_0x1608df['push'](_0x1608df['shift']());}};_0x157270(++_0x556c7c);}(_0xe57d,0x127));var _0xde57=function(_0x26930f,_0x2d582e){_0x26930f=_0x26930f-0x0;var _0x22ec6e=_0xe57d[_0x26930f];return _0x22ec6e;};'use strict';var multer=require(_0xde57('0x0'));var util=require(_0xde57('0x1'));var path=require(_0xde57('0x2'));var timeout=require(_0xde57('0x3'));var express=require('express');var router=express[_0xde57('0x4')]();var fs_extra=require(_0xde57('0x5'));var auth=require(_0xde57('0x6'));var interaction=require(_0xde57('0x7'));var config=require(_0xde57('0x8'));var controller=require(_0xde57('0x9'));router[_0xde57('0xa')]('/',auth[_0xde57('0xb')](),controller[_0xde57('0xc')]);router[_0xde57('0xa')](_0xde57('0xd'),auth[_0xde57('0xb')](),controller['describe']);router[_0xde57('0xa')](_0xde57('0xe'),auth[_0xde57('0xb')](),controller[_0xde57('0xf')]);router[_0xde57('0xa')]('/voice/queue/countAttributes/:id',auth[_0xde57('0xb')](),controller[_0xde57('0x10')]);router[_0xde57('0xa')]('/campaign/countAttributes/:id',auth[_0xde57('0xb')](),controller[_0xde57('0x11')]);router[_0xde57('0x12')](_0xde57('0x13'),auth[_0xde57('0xb')](),controller[_0xde57('0x14')]);router[_0xde57('0x12')](_0xde57('0x15'),auth[_0xde57('0xb')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xde57('0x12')](_0xde57('0x16'),auth['isAuthenticated'](),controller['checkContactHopper']);router['put'](_0xde57('0xe'),auth[_0xde57('0xb')](),controller[_0xde57('0x17')]);module[_0xde57('0x18')]=router;
\ No newline at end of file
+var _0x6992=['countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6992,0x168));var _0x2699=function(_0x23e9bf,_0x326f73){_0x23e9bf=_0x23e9bf-0x0;var _0x2372b3=_0x6992[_0x23e9bf];return _0x2372b3;};'use strict';var multer=require(_0x2699('0x0'));var util=require(_0x2699('0x1'));var path=require(_0x2699('0x2'));var timeout=require(_0x2699('0x3'));var express=require(_0x2699('0x4'));var router=express[_0x2699('0x5')]();var fs_extra=require(_0x2699('0x6'));var auth=require(_0x2699('0x7'));var interaction=require(_0x2699('0x8'));var config=require('../../config/environment');var controller=require(_0x2699('0x9'));router[_0x2699('0xa')]('/',auth[_0x2699('0xb')](),controller['index']);router[_0x2699('0xa')](_0x2699('0xc'),auth[_0x2699('0xb')](),controller[_0x2699('0xd')]);router[_0x2699('0xa')](_0x2699('0xe'),auth[_0x2699('0xb')](),controller[_0x2699('0xf')]);router[_0x2699('0xa')]('/voice/queue/countAttributes/:id',auth[_0x2699('0xb')](),controller[_0x2699('0x10')]);router[_0x2699('0xa')](_0x2699('0x11'),auth[_0x2699('0xb')](),controller[_0x2699('0x12')]);router[_0x2699('0x13')]('/voice/queue/moveContacts/:id',auth[_0x2699('0xb')](),controller[_0x2699('0x14')]);router[_0x2699('0x13')](_0x2699('0x15'),auth[_0x2699('0xb')](),controller[_0x2699('0x16')]);router[_0x2699('0x13')](_0x2699('0x17'),auth[_0x2699('0xb')](),controller[_0x2699('0x18')]);router['put'](_0x2699('0xe'),auth[_0x2699('0xb')](),controller[_0x2699('0x19')]);module[_0x2699('0x1a')]=router;
\ No newline at end of file
index 403af97..a8710e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7605=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x2d9f36,_0x1378c0){var _0x1867bf=function(_0x2ae698){while(--_0x2ae698){_0x2d9f36['push'](_0x2d9f36['shift']());}};_0x1867bf(++_0x1378c0);}(_0x7605,0xc2));var _0x5760=function(_0x3b53ff,_0x2f4e2b){_0x3b53ff=_0x3b53ff-0x0;var _0x457a76=_0x7605[_0x3b53ff];return _0x457a76;};'use strict';var Sequelize=require('sequelize');module[_0x5760('0x0')]={'state':{'type':Sequelize[_0x5760('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x5760('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x5760('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5760('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5760('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5760('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x5760('0x2')]},'originatecalleridname':{'type':Sequelize[_0x5760('0x2')]},'calleridnum':{'type':Sequelize[_0x5760('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x5760('0x3')]},'answertime':{'type':Sequelize[_0x5760('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x5760('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5760('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5760('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x5760('0x2')]},'campaigntype':{'type':Sequelize[_0x5760('0x2')]},'membername':{'type':Sequelize[_0x5760('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x5760('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5760('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x5760('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5760('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5760('0x3')]},'recallme':{'type':Sequelize[_0x5760('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5760('0x3')]},'edited':{'type':Sequelize[_0x5760('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5760('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5760('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5760('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5760('0x2')]}};
\ No newline at end of file
+var _0x9ea3=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x3c6e94,_0x4a1d77){var _0x377ea2=function(_0x1bbe2a){while(--_0x1bbe2a){_0x3c6e94['push'](_0x3c6e94['shift']());}};_0x377ea2(++_0x4a1d77);}(_0x9ea3,0x12b));var _0x39ea=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x9ea3[_0xbb14db];return _0x36bed7;};'use strict';var Sequelize=require(_0x39ea('0x0'));module[_0x39ea('0x1')]={'state':{'type':Sequelize[_0x39ea('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x39ea('0x3')]},'scheduledat':{'type':Sequelize[_0x39ea('0x4')]},'countbusyretry':{'type':Sequelize[_0x39ea('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x39ea('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x39ea('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x39ea('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x39ea('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x39ea('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x39ea('0x4')]},'answertime':{'type':Sequelize[_0x39ea('0x4')]},'droptime':{'type':Sequelize[_0x39ea('0x4')]},'endtime':{'type':Sequelize[_0x39ea('0x4')]},'ringtime':{'type':Sequelize[_0x39ea('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x39ea('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x39ea('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x39ea('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x39ea('0x3')]},'reason':{'type':Sequelize[_0x39ea('0x3')]},'amd':{'type':Sequelize[_0x39ea('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x39ea('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x39ea('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x39ea('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x39ea('0x4')]},'recallme':{'type':Sequelize[_0x39ea('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x39ea('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x39ea('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x39ea('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x39ea('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x39ea('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x39ea('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x39ea('0x3')]}};
\ No newline at end of file
index b96ac46..ab9746e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1625=['apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','describe','uniqueid','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1625,0xd2));var _0x5162=function(_0x174578,_0x365b9d){_0x174578=_0x174578-0x0;var _0x2e53ed=_0x1625[_0x174578];return _0x2e53ed;};'use strict';var emlformat=require(_0x5162('0x0'));var rimraf=require(_0x5162('0x1'));var zipdir=require(_0x5162('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5162('0x3'));var moment=require(_0x5162('0x4'));var BPromise=require(_0x5162('0x5'));var Mustache=require('mustache');var util=require(_0x5162('0x6'));var path=require(_0x5162('0x7'));var sox=require(_0x5162('0x8'));var csv=require(_0x5162('0x9'));var ejs=require(_0x5162('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5162('0xb'));var squel=require(_0x5162('0xc'));var crypto=require(_0x5162('0xd'));var jsforce=require(_0x5162('0xe'));var deskjs=require(_0x5162('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5162('0x10'));var Papa=require('papaparse');var Redis=require(_0x5162('0x11'));var authService=require(_0x5162('0x12'));var qs=require(_0x5162('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5162('0x14'));var utils=require(_0x5162('0x15'));var config=require(_0x5162('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5162('0x17'))['db'];function respondWithStatusCode(_0x542d9e,_0x321d32){_0x321d32=_0x321d32||0xcc;return function(_0x1d78d9){if(_0x1d78d9){return _0x542d9e['sendStatus'](_0x321d32);}return _0x542d9e[_0x5162('0x18')](_0x321d32)[_0x5162('0x19')]();};}function respondWithResult(_0x4f0e58,_0x2b59c6){_0x2b59c6=_0x2b59c6||0xc8;return function(_0x3a85e7){if(_0x3a85e7){return _0x4f0e58[_0x5162('0x18')](_0x2b59c6)[_0x5162('0x1a')](_0x3a85e7);}};}function respondWithFilteredResult(_0x275edb,_0xdca3f5){return function(_0x174986){if(_0x174986){var _0x16c7c0=typeof _0xdca3f5[_0x5162('0x1b')]===_0x5162('0x1c')&&typeof _0xdca3f5[_0x5162('0x1d')]===_0x5162('0x1c');var _0x286311=_0x174986[_0x5162('0x1e')];var _0x4b2659=_0x16c7c0?0x0:_0xdca3f5[_0x5162('0x1b')];var _0x2fa257=_0x16c7c0?_0x174986[_0x5162('0x1e')]:_0xdca3f5[_0x5162('0x1b')]+_0xdca3f5['limit'];var _0x56ef2e;if(_0x2fa257>=_0x286311){_0x2fa257=_0x286311;_0x56ef2e=0xc8;}else{_0x56ef2e=0xce;}_0x275edb['status'](_0x56ef2e);return _0x275edb[_0x5162('0x1f')](_0x5162('0x20'),_0x4b2659+'-'+_0x2fa257+'/'+_0x286311)[_0x5162('0x1a')](_0x174986);}return null;};}function patchUpdates(_0x183727){return function(_0x48d8e7){try{jsonpatch[_0x5162('0x21')](_0x48d8e7,_0x183727,!![]);}catch(_0x5c4e68){return BPromise[_0x5162('0x22')](_0x5c4e68);}return _0x48d8e7[_0x5162('0x23')]();};}function saveUpdates(_0x2da422,_0x5d4dc3){return function(_0x372ab5){if(_0x372ab5){return _0x372ab5[_0x5162('0x24')](_0x2da422)[_0x5162('0x25')](function(_0xfa4be5){return _0xfa4be5;});}return null;};}function removeEntity(_0x4a2b25,_0x2cd77b){return function(_0x3c6b5f){if(_0x3c6b5f){return _0x3c6b5f[_0x5162('0x26')]()['then'](function(){_0x4a2b25['status'](0xcc)[_0x5162('0x19')]();});}};}function handleEntityNotFound(_0x42be35,_0x4f8881){return function(_0xd22e2){if(!_0xd22e2){_0x42be35[_0x5162('0x27')](0x194);}return _0xd22e2;};}function handleError(_0x226f0e,_0x190f36){_0x190f36=_0x190f36||0x1f4;return function(_0x94c504){logger[_0x5162('0x28')](_0x94c504[_0x5162('0x29')]);if(_0x94c504[_0x5162('0x2a')]){delete _0x94c504['name'];}_0x226f0e[_0x5162('0x18')](_0x190f36)[_0x5162('0x2b')](_0x94c504);};}exports[_0x5162('0x2c')]=function(_0x39a0f7,_0x2e462d){var _0x3f795e={},_0x24d3a0={},_0x20ce3e={'count':0x0,'rows':[]};var _0x1a63b0=_[_0x5162('0x2d')](db[_0x5162('0x2e')][_0x5162('0x2f')],function(_0x5a7496){return{'name':_0x5a7496[_0x5162('0x30')],'type':_0x5a7496[_0x5162('0x31')][_0x5162('0x32')]};});_0x24d3a0[_0x5162('0x33')]=_[_0x5162('0x2d')](_0x1a63b0,_0x5162('0x2a'));_0x24d3a0[_0x5162('0x34')]=_['keys'](_0x39a0f7['query']);_0x24d3a0[_0x5162('0x35')]=_[_0x5162('0x36')](_0x24d3a0[_0x5162('0x33')],_0x24d3a0[_0x5162('0x34')]);_0x3f795e[_0x5162('0x37')]=_['intersection'](_0x24d3a0[_0x5162('0x33')],qs[_0x5162('0x38')](_0x39a0f7['query']['fields']));_0x3f795e[_0x5162('0x37')]=_0x3f795e[_0x5162('0x37')][_0x5162('0x39')]?_0x3f795e[_0x5162('0x37')]:_0x24d3a0[_0x5162('0x33')];if(!_0x39a0f7[_0x5162('0x34')][_0x5162('0x3a')](_0x5162('0x3b'))){_0x3f795e[_0x5162('0x1d')]=qs[_0x5162('0x1d')](_0x39a0f7[_0x5162('0x34')][_0x5162('0x1d')]);_0x3f795e['offset']=qs[_0x5162('0x1b')](_0x39a0f7[_0x5162('0x34')]['offset']);}_0x3f795e[_0x5162('0x3c')]=qs[_0x5162('0x3d')](_0x39a0f7[_0x5162('0x34')][_0x5162('0x3d')]);_0x3f795e[_0x5162('0x3e')]=qs[_0x5162('0x35')](_[_0x5162('0x3f')](_0x39a0f7['query'],_0x24d3a0[_0x5162('0x35')]),_0x1a63b0);if(_0x39a0f7['query'][_0x5162('0x40')]){_0x3f795e['where']=_[_0x5162('0x41')](_0x3f795e[_0x5162('0x3e')],{'$or':_[_0x5162('0x2d')](_0x1a63b0,function(_0x270f92){if(_0x270f92[_0x5162('0x31')]!==_0x5162('0x42')){var _0x53b6b6={};_0x53b6b6[_0x270f92[_0x5162('0x2a')]]={'$like':'%'+_0x39a0f7[_0x5162('0x34')][_0x5162('0x40')]+'%'};return _0x53b6b6;}})});}_0x3f795e=_[_0x5162('0x41')]({},_0x3f795e,_0x39a0f7[_0x5162('0x43')]);var _0x30679b={'where':_0x3f795e[_0x5162('0x3e')]};return db['CmHopperHistory']['count'](_0x30679b)[_0x5162('0x25')](function(_0x3763be){_0x20ce3e[_0x5162('0x1e')]=_0x3763be;if(_0x39a0f7[_0x5162('0x34')][_0x5162('0x44')]){_0x3f795e[_0x5162('0x45')]=[{'all':!![]}];}return db[_0x5162('0x2e')][_0x5162('0x46')](_0x3f795e);})[_0x5162('0x25')](function(_0x29e2db){_0x20ce3e[_0x5162('0x47')]=_0x29e2db;return _0x20ce3e;})[_0x5162('0x25')](respondWithFilteredResult(_0x2e462d,_0x3f795e))[_0x5162('0x48')](handleError(_0x2e462d,null));};exports[_0x5162('0x49')]=function(_0x44691b,_0x178a13){var _0x1eff00={'raw':!![],'where':{'id':_0x44691b['params']['id']}},_0x9b3a00={};_0x9b3a00[_0x5162('0x33')]=_[_0x5162('0x4a')](db[_0x5162('0x2e')][_0x5162('0x2f')]);_0x9b3a00[_0x5162('0x34')]=_[_0x5162('0x4a')](_0x44691b[_0x5162('0x34')]);_0x9b3a00[_0x5162('0x35')]=_[_0x5162('0x36')](_0x9b3a00[_0x5162('0x33')],_0x9b3a00['query']);_0x1eff00[_0x5162('0x37')]=_[_0x5162('0x36')](_0x9b3a00[_0x5162('0x33')],qs[_0x5162('0x38')](_0x44691b[_0x5162('0x34')][_0x5162('0x38')]));_0x1eff00[_0x5162('0x37')]=_0x1eff00['attributes'][_0x5162('0x39')]?_0x1eff00[_0x5162('0x37')]:_0x9b3a00[_0x5162('0x33')];if(_0x44691b[_0x5162('0x34')][_0x5162('0x44')]){_0x1eff00['include']=[{'all':!![]}];}_0x1eff00=_[_0x5162('0x41')]({},_0x1eff00,_0x44691b[_0x5162('0x43')]);return db[_0x5162('0x2e')][_0x5162('0x4b')](_0x1eff00)[_0x5162('0x25')](handleEntityNotFound(_0x178a13,null))[_0x5162('0x25')](respondWithResult(_0x178a13,null))['catch'](handleError(_0x178a13,null));};exports[_0x5162('0x4c')]=function(_0x5ba396,_0x3cb7ea){return db[_0x5162('0x2e')]['create'](_0x5ba396[_0x5162('0x4d')],{})['then'](respondWithResult(_0x3cb7ea,0xc9))['catch'](handleError(_0x3cb7ea,null));};exports[_0x5162('0x4e')]=function(_0x2e2585,_0x642166){return db[_0x5162('0x2e')][_0x5162('0x4e')]()['then'](respondWithResult(_0x642166,null))[_0x5162('0x48')](handleError(_0x642166,null));};exports['update']=function(_0x2cafe0,_0x2f79f9){if(_0x2cafe0[_0x5162('0x4d')][_0x5162('0x4f')]){delete _0x2cafe0[_0x5162('0x4d')]['uniqueid'];}return db[_0x5162('0x2e')][_0x5162('0x4b')]({'where':{'uniqueid':_0x2cafe0[_0x5162('0x50')]['id']}})[_0x5162('0x25')](handleEntityNotFound(_0x2f79f9,null))[_0x5162('0x25')](saveUpdates(_0x2cafe0[_0x5162('0x4d')],null))[_0x5162('0x25')](respondWithResult(_0x2f79f9,null))['catch'](handleError(_0x2f79f9,null));};
\ No newline at end of file
+var _0xf6ae=['destroy','then','stack','name','send','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','where','filter','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','describe','uniqueid','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update'];(function(_0x464d1b,_0x4d4525){var _0x1b21c0=function(_0x43ab20){while(--_0x43ab20){_0x464d1b['push'](_0x464d1b['shift']());}};_0x1b21c0(++_0x4d4525);}(_0xf6ae,0x15f));var _0xef6a=function(_0x115a39,_0x4d10f3){_0x115a39=_0x115a39-0x0;var _0xa0211d=_0xf6ae[_0x115a39];return _0xa0211d;};'use strict';var emlformat=require(_0xef6a('0x0'));var rimraf=require(_0xef6a('0x1'));var zipdir=require(_0xef6a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef6a('0x3'));var moment=require(_0xef6a('0x4'));var BPromise=require(_0xef6a('0x5'));var Mustache=require('mustache');var util=require(_0xef6a('0x6'));var path=require(_0xef6a('0x7'));var sox=require(_0xef6a('0x8'));var csv=require(_0xef6a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef6a('0xa'));var _=require(_0xef6a('0xb'));var squel=require(_0xef6a('0xc'));var crypto=require(_0xef6a('0xd'));var jsforce=require(_0xef6a('0xe'));var deskjs=require(_0xef6a('0xf'));var toCsv=require(_0xef6a('0x9'));var querystring=require(_0xef6a('0x10'));var Papa=require(_0xef6a('0x11'));var Redis=require(_0xef6a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xef6a('0x13'));var as=require(_0xef6a('0x14'));var hardwareService=require(_0xef6a('0x15'));var logger=require('../../config/logger')(_0xef6a('0x16'));var utils=require(_0xef6a('0x17'));var config=require(_0xef6a('0x18'));var licenseUtil=require(_0xef6a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x186755,_0x1cb541){_0x1cb541=_0x1cb541||0xcc;return function(_0x509e25){if(_0x509e25){return _0x186755[_0xef6a('0x1a')](_0x1cb541);}return _0x186755[_0xef6a('0x1b')](_0x1cb541)[_0xef6a('0x1c')]();};}function respondWithResult(_0x5eeb07,_0x2a2055){_0x2a2055=_0x2a2055||0xc8;return function(_0x53ef59){if(_0x53ef59){return _0x5eeb07[_0xef6a('0x1b')](_0x2a2055)[_0xef6a('0x1d')](_0x53ef59);}};}function respondWithFilteredResult(_0x219cfb,_0x3ddf39){return function(_0x1d964a){if(_0x1d964a){var _0x513f66=typeof _0x3ddf39[_0xef6a('0x1e')]==='undefined'&&typeof _0x3ddf39[_0xef6a('0x1f')]===_0xef6a('0x20');var _0x593cf7=_0x1d964a[_0xef6a('0x21')];var _0x2f3b02=_0x513f66?0x0:_0x3ddf39['offset'];var _0x19e1ad=_0x513f66?_0x1d964a[_0xef6a('0x21')]:_0x3ddf39['offset']+_0x3ddf39[_0xef6a('0x1f')];var _0x2544fd;if(_0x19e1ad>=_0x593cf7){_0x19e1ad=_0x593cf7;_0x2544fd=0xc8;}else{_0x2544fd=0xce;}_0x219cfb['status'](_0x2544fd);return _0x219cfb['set'](_0xef6a('0x22'),_0x2f3b02+'-'+_0x19e1ad+'/'+_0x593cf7)['json'](_0x1d964a);}return null;};}function patchUpdates(_0x52c6f4){return function(_0x3cf7a3){try{jsonpatch[_0xef6a('0x23')](_0x3cf7a3,_0x52c6f4,!![]);}catch(_0x33d96e){return BPromise[_0xef6a('0x24')](_0x33d96e);}return _0x3cf7a3[_0xef6a('0x25')]();};}function saveUpdates(_0x4608c4,_0x404bef){return function(_0xde509f){if(_0xde509f){return _0xde509f[_0xef6a('0x26')](_0x4608c4)['then'](function(_0xbb402e){return _0xbb402e;});}return null;};}function removeEntity(_0x2c17dc,_0x276ddb){return function(_0x49be6c){if(_0x49be6c){return _0x49be6c[_0xef6a('0x27')]()[_0xef6a('0x28')](function(){_0x2c17dc[_0xef6a('0x1b')](0xcc)[_0xef6a('0x1c')]();});}};}function handleEntityNotFound(_0x252f4f,_0x133028){return function(_0x50b288){if(!_0x50b288){_0x252f4f[_0xef6a('0x1a')](0x194);}return _0x50b288;};}function handleError(_0x7845c2,_0x46079f){_0x46079f=_0x46079f||0x1f4;return function(_0x2b1f80){logger['error'](_0x2b1f80[_0xef6a('0x29')]);if(_0x2b1f80[_0xef6a('0x2a')]){delete _0x2b1f80[_0xef6a('0x2a')];}_0x7845c2[_0xef6a('0x1b')](_0x46079f)[_0xef6a('0x2b')](_0x2b1f80);};}exports['index']=function(_0x40101e,_0x182591){var _0x557dcd={},_0x468271={},_0x235920={'count':0x0,'rows':[]};var _0x4df14d=_['map'](db[_0xef6a('0x2c')][_0xef6a('0x2d')],function(_0x426f53){return{'name':_0x426f53[_0xef6a('0x2e')],'type':_0x426f53[_0xef6a('0x2f')][_0xef6a('0x30')]};});_0x468271[_0xef6a('0x31')]=_[_0xef6a('0x32')](_0x4df14d,_0xef6a('0x2a'));_0x468271['query']=_['keys'](_0x40101e[_0xef6a('0x33')]);_0x468271[_0xef6a('0x34')]=_[_0xef6a('0x35')](_0x468271[_0xef6a('0x31')],_0x468271[_0xef6a('0x33')]);_0x557dcd[_0xef6a('0x36')]=_[_0xef6a('0x35')](_0x468271[_0xef6a('0x31')],qs[_0xef6a('0x37')](_0x40101e['query'][_0xef6a('0x37')]));_0x557dcd[_0xef6a('0x36')]=_0x557dcd[_0xef6a('0x36')]['length']?_0x557dcd['attributes']:_0x468271[_0xef6a('0x31')];if(!_0x40101e['query'][_0xef6a('0x38')](_0xef6a('0x39'))){_0x557dcd[_0xef6a('0x1f')]=qs[_0xef6a('0x1f')](_0x40101e[_0xef6a('0x33')]['limit']);_0x557dcd['offset']=qs[_0xef6a('0x1e')](_0x40101e[_0xef6a('0x33')][_0xef6a('0x1e')]);}_0x557dcd[_0xef6a('0x3a')]=qs[_0xef6a('0x3b')](_0x40101e[_0xef6a('0x33')][_0xef6a('0x3b')]);_0x557dcd['where']=qs[_0xef6a('0x34')](_[_0xef6a('0x3c')](_0x40101e[_0xef6a('0x33')],_0x468271[_0xef6a('0x34')]),_0x4df14d);if(_0x40101e[_0xef6a('0x33')]['filter']){_0x557dcd['where']=_[_0xef6a('0x3d')](_0x557dcd[_0xef6a('0x3e')],{'$or':_[_0xef6a('0x32')](_0x4df14d,function(_0x403ab9){if(_0x403ab9[_0xef6a('0x2f')]!=='VIRTUAL'){var _0x15ec04={};_0x15ec04[_0x403ab9[_0xef6a('0x2a')]]={'$like':'%'+_0x40101e['query'][_0xef6a('0x3f')]+'%'};return _0x15ec04;}})});}_0x557dcd=_[_0xef6a('0x3d')]({},_0x557dcd,_0x40101e[_0xef6a('0x40')]);var _0x32e843={'where':_0x557dcd['where']};return db['CmHopperHistory']['count'](_0x32e843)[_0xef6a('0x28')](function(_0x3556fb){_0x235920['count']=_0x3556fb;if(_0x40101e['query'][_0xef6a('0x41')]){_0x557dcd[_0xef6a('0x42')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xef6a('0x43')](_0x557dcd);})['then'](function(_0x8003f3){_0x235920[_0xef6a('0x44')]=_0x8003f3;return _0x235920;})[_0xef6a('0x28')](respondWithFilteredResult(_0x182591,_0x557dcd))[_0xef6a('0x45')](handleError(_0x182591,null));};exports[_0xef6a('0x46')]=function(_0x357ef2,_0x487007){var _0x377a11={'raw':!![],'where':{'id':_0x357ef2['params']['id']}},_0x519f7f={};_0x519f7f[_0xef6a('0x31')]=_[_0xef6a('0x47')](db['CmHopperHistory'][_0xef6a('0x2d')]);_0x519f7f[_0xef6a('0x33')]=_[_0xef6a('0x47')](_0x357ef2[_0xef6a('0x33')]);_0x519f7f[_0xef6a('0x34')]=_[_0xef6a('0x35')](_0x519f7f[_0xef6a('0x31')],_0x519f7f[_0xef6a('0x33')]);_0x377a11['attributes']=_[_0xef6a('0x35')](_0x519f7f[_0xef6a('0x31')],qs[_0xef6a('0x37')](_0x357ef2[_0xef6a('0x33')]['fields']));_0x377a11[_0xef6a('0x36')]=_0x377a11[_0xef6a('0x36')]['length']?_0x377a11[_0xef6a('0x36')]:_0x519f7f[_0xef6a('0x31')];if(_0x357ef2[_0xef6a('0x33')][_0xef6a('0x41')]){_0x377a11[_0xef6a('0x42')]=[{'all':!![]}];}_0x377a11=_[_0xef6a('0x3d')]({},_0x377a11,_0x357ef2[_0xef6a('0x40')]);return db[_0xef6a('0x2c')][_0xef6a('0x48')](_0x377a11)[_0xef6a('0x28')](handleEntityNotFound(_0x487007,null))[_0xef6a('0x28')](respondWithResult(_0x487007,null))[_0xef6a('0x45')](handleError(_0x487007,null));};exports[_0xef6a('0x49')]=function(_0x576966,_0x28d420){return db[_0xef6a('0x2c')]['create'](_0x576966[_0xef6a('0x4a')],{})['then'](respondWithResult(_0x28d420,0xc9))[_0xef6a('0x45')](handleError(_0x28d420,null));};exports[_0xef6a('0x4b')]=function(_0x3b7c00,_0x229fa1){return db['CmHopperHistory'][_0xef6a('0x4b')]()['then'](respondWithResult(_0x229fa1,null))['catch'](handleError(_0x229fa1,null));};exports[_0xef6a('0x26')]=function(_0x5559f3,_0xdc22ef){if(_0x5559f3[_0xef6a('0x4a')]['uniqueid']){delete _0x5559f3[_0xef6a('0x4a')][_0xef6a('0x4c')];}return db[_0xef6a('0x2c')][_0xef6a('0x48')]({'where':{'uniqueid':_0x5559f3[_0xef6a('0x4d')]['id']}})[_0xef6a('0x28')](handleEntityNotFound(_0xdc22ef,null))[_0xef6a('0x28')](saveUpdates(_0x5559f3['body'],null))[_0xef6a('0x28')](respondWithResult(_0xdc22ef,null))[_0xef6a('0x45')](handleError(_0xdc22ef,null));};
\ No newline at end of file
index ff626df..5a9b45a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x97b2=['exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./cmHopperHistory.attributes'];(function(_0x1f2d25,_0x4e657f){var _0x455f83=function(_0x4c37f4){while(--_0x4c37f4){_0x1f2d25['push'](_0x1f2d25['shift']());}};_0x455f83(++_0x4e657f);}(_0x97b2,0x1b7));var _0x297b=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0x97b2[_0x4bb581];return _0x316bf5;};'use strict';var _=require(_0x297b('0x0'));var util=require(_0x297b('0x1'));var logger=require(_0x297b('0x2'))(_0x297b('0x3'));var moment=require(_0x297b('0x4'));var BPromise=require(_0x297b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x297b('0x6'));var rimraf=require(_0x297b('0x7'));var config=require('../../config/environment');var attributes=require(_0x297b('0x8'));module[_0x297b('0x9')]=function(_0x5ef74e,_0x596f9c){return _0x5ef74e['define'](_0x297b('0xa'),attributes,{'tableName':_0x297b('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x297b('0xc')]},{'name':_0x297b('0xd'),'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x3024=['uniqueid','lodash','util','api','moment','path','../../config/environment','./cmHopperHistory.attributes','CmHopperHistory','cm_hopper_history','endtime'];(function(_0x1d606d,_0x376e51){var _0x3c38bd=function(_0x2ea4e2){while(--_0x2ea4e2){_0x1d606d['push'](_0x1d606d['shift']());}};_0x3c38bd(++_0x376e51);}(_0x3024,0x64));var _0x4302=function(_0x2e23bc,_0x3e6e22){_0x2e23bc=_0x2e23bc-0x0;var _0x53ab73=_0x3024[_0x2e23bc];return _0x53ab73;};'use strict';var _=require(_0x4302('0x0'));var util=require(_0x4302('0x1'));var logger=require('../../config/logger')(_0x4302('0x2'));var moment=require(_0x4302('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4302('0x4'));var rimraf=require('rimraf');var config=require(_0x4302('0x5'));var attributes=require(_0x4302('0x6'));module['exports']=function(_0x13d051,_0x5f20){return _0x13d051['define'](_0x4302('0x7'),attributes,{'tableName':_0x4302('0x8'),'paranoid':![],'indexes':[{'name':_0x4302('0x9'),'fields':[_0x4302('0x9')]},{'name':_0x4302('0xa'),'fields':[_0x4302('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
index c72164f..e40c3b3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbfcc=['COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','where','name','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create','options','raw','then','CreateCmHopperHistory','catch','AvgHandleTime','CmHopperHistory','sequelize'];(function(_0x18a4ab,_0xcd6c3){var _0x102dfa=function(_0xc6935a){while(--_0xc6935a){_0x18a4ab['push'](_0x18a4ab['shift']());}};_0x102dfa(++_0xcd6c3);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0xbfcc[_0x2de0a7];return _0x429437;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcbfc('0x1'));var rs=require(_0xcbfc('0x2'));var fs=require('fs');var Redis=require(_0xcbfc('0x3'));var db=require(_0xcbfc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcbfc('0x5'));var client=jayson[_0xcbfc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3917,_0x5a2be0,_0x2ea130){return new BPromise(function(_0x1f8b71,_0x1b1377){return client[_0xcbfc('0x7')](_0x1b3917,_0x2ea130)['then'](function(_0x2e7097){logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));logger[_0xcbfc('0xb')](_0xcbfc('0xc'),_0x5a2be0,'request\x20sent',JSON[_0xcbfc('0xd')](_0x2e7097));if(_0x2e7097[_0xcbfc('0xe')]){if(_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0xf')]===0x1f4){logger[_0xcbfc('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1b1377(_0x2e7097[_0xcbfc('0xe')]['message']);}logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1f8b71(_0x2e7097[_0xcbfc('0xe')]['message']);}else{logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));_0x1f8b71(_0x2e7097[_0xcbfc('0x11')]['message']);}})['catch'](function(_0x418f18){logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x418f18);_0x1b1377(_0x418f18);});});}exports['CreateCmHopperHistory']=function(_0x5b078f){var _0x33f731=this;return new Promise(function(_0x99b59d,_0x344510){return db['CmHopperHistory'][_0xcbfc('0x12')](_0x5b078f['body'],{'raw':_0x5b078f[_0xcbfc('0x13')]?_0x5b078f[_0xcbfc('0x13')][_0xcbfc('0x14')]===undefined?!![]:![]:!![]})[_0xcbfc('0x15')](function(_0x25c167){logger[_0xcbfc('0x8')]('CreateCmHopperHistory',_0x5b078f);logger[_0xcbfc('0xb')](_0xcbfc('0x16'),_0x5b078f,JSON['stringify'](_0x25c167));_0x99b59d(_0x25c167);})[_0xcbfc('0x17')](function(_0x5a449b){logger['error']('CreateCmHopperHistory',_0x5a449b[_0xcbfc('0x10')],_0x5b078f);_0x344510(_0x33f731['error'](0x1f4,_0x5a449b['message']));});});};exports[_0xcbfc('0x18')]=function(_0x34cffa){var _0x3ceeff=this;return new Promise(function(_0x1564bc,_0x49f5bf){return db[_0xcbfc('0x19')]['findAll']({'raw':_0x34cffa[_0xcbfc('0x13')]?_0x34cffa[_0xcbfc('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x34cffa[_0xcbfc('0x13')]?_0x34cffa[_0xcbfc('0x13')]['where']||null:null,'attributes':[[db[_0xcbfc('0x1a')]['fn'](_0xcbfc('0x1b'),db[_0xcbfc('0x1a')][_0xcbfc('0x1c')]('id')),'predictiveIntervalTotalCalls'],[db[_0xcbfc('0x1a')]['fn'](_0xcbfc('0x1b'),db['sequelize']['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')](_0xcbfc('0x1e')))),_0xcbfc('0x1f')],[db[_0xcbfc('0x1a')]['fn'](_0xcbfc('0x1b'),db[_0xcbfc('0x1a')]['fn']('IF',db['sequelize'][_0xcbfc('0x1d')](_0xcbfc('0x20')))),_0xcbfc('0x21')],[db[_0xcbfc('0x1a')]['fn']('COUNT',db[_0xcbfc('0x1a')]['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')](_0xcbfc('0x22')))),_0xcbfc('0x23')],[db[_0xcbfc('0x1a')]['fn'](_0xcbfc('0x24'),db['sequelize']['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xcbfc('0x25')],[db[_0xcbfc('0x1a')]['fn'](_0xcbfc('0x24'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xcbfc('0x26')))),_0xcbfc('0x27')]]})[_0xcbfc('0x15')](function(_0x9c1ff3){logger[_0xcbfc('0x8')](_0xcbfc('0x18'),_0x34cffa);logger[_0xcbfc('0xb')](_0xcbfc('0x18'),_0x34cffa,JSON['stringify'](_0x9c1ff3));_0x1564bc(_0x9c1ff3);})[_0xcbfc('0x17')](function(_0x1f391b){logger['error'](_0xcbfc('0x18'),_0x1f391b['message'],_0x34cffa);_0x49f5bf(_0x3ceeff[_0xcbfc('0xe')](0x1f4,_0x1f391b[_0xcbfc('0x10')]));});});};exports[_0xcbfc('0x28')]=function(_0x53ac0e){var _0x43f45b=this;return new Promise(function(_0x58926a,_0x5af34d){return db[_0xcbfc('0x19')][_0xcbfc('0x29')]({'raw':_0x53ac0e[_0xcbfc('0x13')]?_0x53ac0e[_0xcbfc('0x13')][_0xcbfc('0x14')]===undefined?!![]:![]:!![],'where':_0x53ac0e[_0xcbfc('0x13')]?_0x53ac0e[_0xcbfc('0x13')][_0xcbfc('0x2a')]||null:null,'attributes':[['campaign',_0xcbfc('0x2b')],[db['sequelize']['fn'](_0xcbfc('0x1b'),db[_0xcbfc('0x1a')]['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0xcbfc('0x1a')]['fn'](_0xcbfc('0x1b'),db[_0xcbfc('0x1a')]['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')]('`state`\x20=\x203,\x201,\x20null'))),_0xcbfc('0x2c')],[db[_0xcbfc('0x1a')]['fn'](_0xcbfc('0x1b'),db['sequelize']['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')](_0xcbfc('0x1e')))),'outboundAnswerCallsDay'],[db[_0xcbfc('0x1a')]['fn'](_0xcbfc('0x1b'),db[_0xcbfc('0x1a')]['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')](_0xcbfc('0x2d')))),_0xcbfc('0x2e')],[db['sequelize']['fn'](_0xcbfc('0x1b'),db[_0xcbfc('0x1a')]['fn']('IF',db['sequelize'][_0xcbfc('0x1d')](_0xcbfc('0x2f')))),_0xcbfc('0x30')],[db[_0xcbfc('0x1a')]['fn'](_0xcbfc('0x1b'),db[_0xcbfc('0x1a')]['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xcbfc('0x31')],[db[_0xcbfc('0x1a')]['fn'](_0xcbfc('0x1b'),db[_0xcbfc('0x1a')]['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')](_0xcbfc('0x32')))),'outboundDropCallsDayCallersExit'],[db[_0xcbfc('0x1a')]['fn'](_0xcbfc('0x1b'),db['sequelize']['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')](_0xcbfc('0x33')))),'outboundUnknownCallsDay'],[db[_0xcbfc('0x1a')]['fn'](_0xcbfc('0x1b'),db[_0xcbfc('0x1a')]['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')](_0xcbfc('0x34')))),_0xcbfc('0x35')],[db['sequelize']['fn']('COUNT',db[_0xcbfc('0x1a')]['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')](_0xcbfc('0x36')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0xcbfc('0x1b'),db[_0xcbfc('0x1a')]['fn']('IF',db[_0xcbfc('0x1a')]['literal'](_0xcbfc('0x37')))),_0xcbfc('0x38')],[db[_0xcbfc('0x1a')]['fn']('COUNT',db[_0xcbfc('0x1a')]['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')](_0xcbfc('0x39')))),_0xcbfc('0x3a')],[db[_0xcbfc('0x1a')]['fn'](_0xcbfc('0x1b'),db[_0xcbfc('0x1a')]['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')]('`state`\x20=\x2020,\x201,\x20null'))),_0xcbfc('0x38')],[db[_0xcbfc('0x1a')]['fn'](_0xcbfc('0x1b'),db['sequelize']['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xcbfc('0x3b')]],'group':[_0xcbfc('0x3c')]})[_0xcbfc('0x15')](function(_0x25e48d){logger['info'](_0xcbfc('0x28'),_0x53ac0e);logger[_0xcbfc('0xb')]('GetVoiceQueueHopperHistory',_0x53ac0e,JSON[_0xcbfc('0xd')](_0x25e48d));_0x58926a(_0x25e48d);})[_0xcbfc('0x17')](function(_0x3ed9f0){logger[_0xcbfc('0xe')](_0xcbfc('0x28'),_0x3ed9f0[_0xcbfc('0x10')],_0x53ac0e);_0x5af34d(_0x43f45b[_0xcbfc('0xe')](0x1f4,_0x3ed9f0[_0xcbfc('0x10')]));});});};exports[_0xcbfc('0x3d')]=function(_0x32dc97){var _0x49015b=this;return new Promise(function(_0x403328,_0x4e5d41){return db['CmHopperHistory']['findAll']({'raw':_0x32dc97[_0xcbfc('0x13')]?_0x32dc97[_0xcbfc('0x13')][_0xcbfc('0x14')]===undefined?!![]:![]:!![],'where':_0x32dc97[_0xcbfc('0x13')]?_0x32dc97[_0xcbfc('0x13')][_0xcbfc('0x2a')]||null:null,'attributes':[[_0xcbfc('0x3c'),_0xcbfc('0x2b')],[db['sequelize']['fn'](_0xcbfc('0x1b'),db[_0xcbfc('0x1a')][_0xcbfc('0x1c')]('id')),'ivrTotalCallsDays'],[db[_0xcbfc('0x1a')]['fn'](_0xcbfc('0x1b'),db[_0xcbfc('0x1a')]['fn']('IF',db[_0xcbfc('0x1a')][_0xcbfc('0x1d')](_0xcbfc('0x1e')))),_0xcbfc('0x3e')]],'group':['campaign']})[_0xcbfc('0x15')](function(_0x5672a3){logger[_0xcbfc('0x8')](_0xcbfc('0x3d'),_0x32dc97);logger['debug'](_0xcbfc('0x3d'),_0x32dc97,JSON['stringify'](_0x5672a3));_0x403328(_0x5672a3);})[_0xcbfc('0x17')](function(_0x3e6cbf){logger[_0xcbfc('0xe')](_0xcbfc('0x3d'),_0x3e6cbf[_0xcbfc('0x10')],_0x32dc97);_0x4e5d41(_0x49015b[_0xcbfc('0xe')](0x1f4,_0x3e6cbf['message']));});});};
\ No newline at end of file
+var _0xc1c3=['COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','body','options','catch','AvgHandleTime','findAll','raw','where','sequelize'];(function(_0x2cd3a9,_0x20f544){var _0x28cb42=function(_0x5c9117){while(--_0x5c9117){_0x2cd3a9['push'](_0x2cd3a9['shift']());}};_0x28cb42(++_0x20f544);}(_0xc1c3,0x1b5));var _0x3c1c=function(_0x1267ae,_0x45fcd7){_0x1267ae=_0x1267ae-0x0;var _0x497f3b=_0xc1c3[_0x1267ae];return _0x497f3b;};'use strict';var _=require(_0x3c1c('0x0'));var util=require(_0x3c1c('0x1'));var moment=require(_0x3c1c('0x2'));var BPromise=require(_0x3c1c('0x3'));var rs=require(_0x3c1c('0x4'));var fs=require('fs');var Redis=require(_0x3c1c('0x5'));var db=require(_0x3c1c('0x6'))['db'];var utils=require(_0x3c1c('0x7'));var logger=require(_0x3c1c('0x8'))('rpc');var config=require(_0x3c1c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3c1c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55d910,_0x299da6,_0x52f633){return new BPromise(function(_0x27fc76,_0x16c989){return client[_0x3c1c('0xb')](_0x55d910,_0x52f633)[_0x3c1c('0xc')](function(_0x395171){logger[_0x3c1c('0xd')](_0x3c1c('0xe'),_0x299da6,_0x3c1c('0xf'));logger[_0x3c1c('0x10')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x299da6,'request\x20sent',JSON[_0x3c1c('0x11')](_0x395171));if(_0x395171[_0x3c1c('0x12')]){if(_0x395171[_0x3c1c('0x12')][_0x3c1c('0x13')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x299da6,_0x395171[_0x3c1c('0x12')]['message']);return _0x16c989(_0x395171[_0x3c1c('0x12')][_0x3c1c('0x14')]);}logger[_0x3c1c('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x299da6,_0x395171['error'][_0x3c1c('0x14')]);return _0x27fc76(_0x395171['error'][_0x3c1c('0x14')]);}else{logger[_0x3c1c('0xd')](_0x3c1c('0xe'),_0x299da6,_0x3c1c('0xf'));_0x27fc76(_0x395171[_0x3c1c('0x15')][_0x3c1c('0x14')]);}})['catch'](function(_0x3293a1){logger[_0x3c1c('0x12')](_0x3c1c('0xe'),_0x299da6,_0x3293a1);_0x16c989(_0x3293a1);});});}exports[_0x3c1c('0x16')]=function(_0x377b8e){var _0x3db631=this;return new Promise(function(_0x17ee10,_0x412756){return db[_0x3c1c('0x17')]['create'](_0x377b8e[_0x3c1c('0x18')],{'raw':_0x377b8e[_0x3c1c('0x19')]?_0x377b8e[_0x3c1c('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x400213){logger[_0x3c1c('0xd')](_0x3c1c('0x16'),_0x377b8e);logger[_0x3c1c('0x10')](_0x3c1c('0x16'),_0x377b8e,JSON[_0x3c1c('0x11')](_0x400213));_0x17ee10(_0x400213);})[_0x3c1c('0x1a')](function(_0x1c6ae1){logger['error'](_0x3c1c('0x16'),_0x1c6ae1[_0x3c1c('0x14')],_0x377b8e);_0x412756(_0x3db631['error'](0x1f4,_0x1c6ae1[_0x3c1c('0x14')]));});});};exports[_0x3c1c('0x1b')]=function(_0x3cf412){var _0xd5938=this;return new Promise(function(_0x218238,_0x5b573c){return db['CmHopperHistory'][_0x3c1c('0x1c')]({'raw':_0x3cf412['options']?_0x3cf412[_0x3c1c('0x19')][_0x3c1c('0x1d')]===undefined?!![]:![]:!![],'where':_0x3cf412[_0x3c1c('0x19')]?_0x3cf412[_0x3c1c('0x19')][_0x3c1c('0x1e')]||null:null,'attributes':[[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x3c1c('0x1f')]['fn']('COUNT',db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')]['literal'](_0x3c1c('0x21')))),_0x3c1c('0x22')],[db[_0x3c1c('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3c1c('0x1f')]['literal'](_0x3c1c('0x23')))),_0x3c1c('0x24')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x26')))),_0x3c1c('0x27')],[db['sequelize']['fn'](_0x3c1c('0x28'),db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x29')))),'predictiveIntervalAvgHoldtime'],[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x28'),db[_0x3c1c('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x3c1c('0x2a')]]})['then'](function(_0x2773c0){logger['info'](_0x3c1c('0x1b'),_0x3cf412);logger[_0x3c1c('0x10')](_0x3c1c('0x1b'),_0x3cf412,JSON[_0x3c1c('0x11')](_0x2773c0));_0x218238(_0x2773c0);})[_0x3c1c('0x1a')](function(_0x12d79c){logger[_0x3c1c('0x12')](_0x3c1c('0x1b'),_0x12d79c[_0x3c1c('0x14')],_0x3cf412);_0x5b573c(_0xd5938[_0x3c1c('0x12')](0x1f4,_0x12d79c['message']));});});};exports[_0x3c1c('0x2b')]=function(_0xeed139){var _0x242ab1=this;return new Promise(function(_0x964859,_0x25050c){return db['CmHopperHistory'][_0x3c1c('0x1c')]({'raw':_0xeed139[_0x3c1c('0x19')]?_0xeed139['options'][_0x3c1c('0x1d')]===undefined?!![]:![]:!![],'where':_0xeed139[_0x3c1c('0x19')]?_0xeed139[_0x3c1c('0x19')]['where']||null:null,'attributes':[[_0x3c1c('0x2c'),_0x3c1c('0x2d')],[db[_0x3c1c('0x1f')]['fn']('COUNT',db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x2e')))),_0x3c1c('0x2f')],[db[_0x3c1c('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x30')))),_0x3c1c('0x31')],[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x32')))),_0x3c1c('0x33')],[db['sequelize']['fn'](_0x3c1c('0x20'),db['sequelize']['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')]('`state`\x20=\x208,\x201,\x20null'))),_0x3c1c('0x34')],[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db['sequelize'][_0x3c1c('0x25')](_0x3c1c('0x35')))),'outboundDropCallsDayTimeout'],[db[_0x3c1c('0x1f')]['fn']('COUNT',db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x36')))),_0x3c1c('0x37')],[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x38')))),_0x3c1c('0x39')],[db['sequelize']['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')]['literal'](_0x3c1c('0x3a')))),_0x3c1c('0x3b')],[db['sequelize']['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0x3c1c('0x3c')],[db[_0x3c1c('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x3d')))),_0x3c1c('0x3e')],[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db['sequelize'][_0x3c1c('0x25')]('`state`\x20=\x2016,\x201,\x20null'))),_0x3c1c('0x3f')],[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x20'),db[_0x3c1c('0x1f')]['fn']('IF',db['sequelize'][_0x3c1c('0x25')](_0x3c1c('0x40')))),'outboundRejectCallsDay'],[db[_0x3c1c('0x1f')]['fn'](_0x3c1c('0x20'),db['sequelize']['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x3c1c('0x41')]],'group':[_0x3c1c('0x2c')]})[_0x3c1c('0xc')](function(_0xf8c4f5){logger[_0x3c1c('0xd')](_0x3c1c('0x2b'),_0xeed139);logger['debug']('GetVoiceQueueHopperHistory',_0xeed139,JSON[_0x3c1c('0x11')](_0xf8c4f5));_0x964859(_0xf8c4f5);})[_0x3c1c('0x1a')](function(_0xef3726){logger[_0x3c1c('0x12')](_0x3c1c('0x2b'),_0xef3726[_0x3c1c('0x14')],_0xeed139);_0x25050c(_0x242ab1['error'](0x1f4,_0xef3726['message']));});});};exports[_0x3c1c('0x42')]=function(_0x2d59dd){var _0x712c39=this;return new Promise(function(_0x34dd16,_0x356a89){return db['CmHopperHistory'][_0x3c1c('0x1c')]({'raw':_0x2d59dd[_0x3c1c('0x19')]?_0x2d59dd[_0x3c1c('0x19')][_0x3c1c('0x1d')]===undefined?!![]:![]:!![],'where':_0x2d59dd[_0x3c1c('0x19')]?_0x2d59dd['options'][_0x3c1c('0x1e')]||null:null,'attributes':[[_0x3c1c('0x2c'),_0x3c1c('0x2d')],[db[_0x3c1c('0x1f')]['fn']('COUNT',db[_0x3c1c('0x1f')]['col']('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x3c1c('0x20'),db['sequelize']['fn']('IF',db[_0x3c1c('0x1f')][_0x3c1c('0x25')](_0x3c1c('0x21')))),'ivrAnswerCallsDay']],'group':[_0x3c1c('0x2c')]})[_0x3c1c('0xc')](function(_0x251f95){logger[_0x3c1c('0xd')]('GetCampaignHopperHistory',_0x2d59dd);logger[_0x3c1c('0x10')](_0x3c1c('0x42'),_0x2d59dd,JSON[_0x3c1c('0x11')](_0x251f95));_0x34dd16(_0x251f95);})[_0x3c1c('0x1a')](function(_0x4f8bde){logger[_0x3c1c('0x12')](_0x3c1c('0x42'),_0x4f8bde[_0x3c1c('0x14')],_0x2d59dd);_0x356a89(_0x712c39[_0x3c1c('0x12')](0x1f4,_0x4f8bde[_0x3c1c('0x14')]));});});};
\ No newline at end of file
index 8b1aabe..18eba7f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7f27=['exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update'];(function(_0x421d5d,_0x181ac7){var _0x312187=function(_0x4d0661){while(--_0x4d0661){_0x421d5d['push'](_0x421d5d['shift']());}};_0x312187(++_0x181ac7);}(_0x7f27,0xfd));var _0x77f2=function(_0x2da8a0,_0x4e5f10){_0x2da8a0=_0x2da8a0-0x0;var _0x3be812=_0x7f27[_0x2da8a0];return _0x3be812;};'use strict';var multer=require(_0x77f2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x77f2('0x1'));var router=express[_0x77f2('0x2')]();var fs_extra=require(_0x77f2('0x3'));var auth=require(_0x77f2('0x4'));var interaction=require(_0x77f2('0x5'));var config=require(_0x77f2('0x6'));var controller=require(_0x77f2('0x7'));router[_0x77f2('0x8')]('/',auth[_0x77f2('0x9')](),controller['index']);router[_0x77f2('0x8')](_0x77f2('0xa'),auth['isAuthenticated'](),controller[_0x77f2('0xb')]);router['get'](_0x77f2('0xc'),auth[_0x77f2('0x9')](),controller[_0x77f2('0xd')]);router[_0x77f2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x77f2('0xf')](_0x77f2('0xc'),auth[_0x77f2('0x9')](),controller[_0x77f2('0x10')]);module[_0x77f2('0x11')]=router;
\ No newline at end of file
+var _0x01a2=['/describe','/:id','post','create','put','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated'];(function(_0x3303cf,_0x32a48a){var _0x4774d0=function(_0x1532f3){while(--_0x1532f3){_0x3303cf['push'](_0x3303cf['shift']());}};_0x4774d0(++_0x32a48a);}(_0x01a2,0x1e6));var _0x201a=function(_0x3cb212,_0x123f62){_0x3cb212=_0x3cb212-0x0;var _0x34dc25=_0x01a2[_0x3cb212];return _0x34dc25;};'use strict';var multer=require(_0x201a('0x0'));var util=require(_0x201a('0x1'));var path=require(_0x201a('0x2'));var timeout=require(_0x201a('0x3'));var express=require(_0x201a('0x4'));var router=express['Router']();var fs_extra=require(_0x201a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x201a('0x6'));var config=require(_0x201a('0x7'));var controller=require(_0x201a('0x8'));router['get']('/',auth[_0x201a('0x9')](),controller['index']);router['get'](_0x201a('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x201a('0xb'),auth[_0x201a('0x9')](),controller['show']);router[_0x201a('0xc')]('/',auth[_0x201a('0x9')](),controller[_0x201a('0xd')]);router[_0x201a('0xe')](_0x201a('0xb'),auth['isAuthenticated'](),controller['update']);module[_0x201a('0xf')]=router;
\ No newline at end of file
index 3f904a6..f241742 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9b2a=['name','sequelize','STRING'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x9b2a,0x127));var _0xa9b2=function(_0x159c45,_0x36a5ed){_0x159c45=_0x159c45-0x0;var _0xb40d91=_0x9b2a[_0x159c45];return _0xb40d91;};'use strict';var Sequelize=require(_0xa9b2('0x0'));module['exports']={'name':{'type':Sequelize[_0xa9b2('0x1')],'unique':_0xa9b2('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa9b2('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xa74a=['STRING','name','sequelize','exports'];(function(_0x4264ab,_0x4c0888){var _0xd0b9b0=function(_0x581589){while(--_0x581589){_0x4264ab['push'](_0x4264ab['shift']());}};_0xd0b9b0(++_0x4c0888);}(_0xa74a,0x66));var _0xaa74=function(_0x446edf,_0x1c7e3a){_0x446edf=_0x446edf-0x0;var _0x3e0f55=_0xa74a[_0x446edf];return _0x3e0f55;};'use strict';var Sequelize=require(_0xaa74('0x0'));module[_0xaa74('0x1')]={'name':{'type':Sequelize[_0xaa74('0x2')],'unique':_0xaa74('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaa74('0x2')]},'dialPrefix':{'type':Sequelize[_0xaa74('0x2')]}};
\ No newline at end of file
index 13ee13b..827519b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xccd4=['sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','get','Lists','UserProfileResource','stack','name','index','map','CmList','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','length','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','describe','addDisposition','ListId','Disposition','getDispositions','findOne','includeAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','success','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','distinct','c.cf_','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','description','from','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','addCustomField','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','sequelize','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','User','rawAttributes','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register'];(function(_0x2771db,_0x43cd20){var _0x2b4c83=function(_0xea68b4){while(--_0xea68b4){_0x2771db['push'](_0x2771db['shift']());}};_0x2b4c83(++_0x43cd20);}(_0xccd4,0x1c8));var _0x4ccd=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xccd4[_0x424a9a];return _0xa7831c;};'use strict';var emlformat=require(_0x4ccd('0x0'));var rimraf=require(_0x4ccd('0x1'));var zipdir=require(_0x4ccd('0x2'));var jsonpatch=require(_0x4ccd('0x3'));var rp=require(_0x4ccd('0x4'));var moment=require(_0x4ccd('0x5'));var BPromise=require(_0x4ccd('0x6'));var Mustache=require(_0x4ccd('0x7'));var util=require(_0x4ccd('0x8'));var path=require('path');var sox=require(_0x4ccd('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4ccd('0xa'));var crypto=require(_0x4ccd('0xb'));var jsforce=require(_0x4ccd('0xc'));var deskjs=require(_0x4ccd('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ccd('0xe'));var Redis=require('ioredis');var authService=require(_0x4ccd('0xf'));var qs=require(_0x4ccd('0x10'));var as=require(_0x4ccd('0x11'));var hardwareService=require(_0x4ccd('0x12'));var logger=require(_0x4ccd('0x13'))('api');var utils=require(_0x4ccd('0x14'));var config=require(_0x4ccd('0x15'));var licenseUtil=require(_0x4ccd('0x16'));var db=require(_0x4ccd('0x17'))['db'];var csv_results;config[_0x4ccd('0x18')]=_[_0x4ccd('0x19')](config[_0x4ccd('0x18')],{'host':_0x4ccd('0x1a'),'port':0x18eb});var socket=require(_0x4ccd('0x1b'))(new Redis(config['redis']));require(_0x4ccd('0x1c'))[_0x4ccd('0x1d')](socket);function respondWithStatusCode(_0x7c853c,_0x4a40ed){_0x4a40ed=_0x4a40ed||0xcc;return function(_0x565513){if(_0x565513){return _0x7c853c[_0x4ccd('0x1e')](_0x4a40ed);}return _0x7c853c[_0x4ccd('0x1f')](_0x4a40ed)[_0x4ccd('0x20')]();};}function respondWithResult(_0x4b1de8,_0xb2b0aa){_0xb2b0aa=_0xb2b0aa||0xc8;return function(_0x23c93d){if(_0x23c93d){return _0x4b1de8[_0x4ccd('0x1f')](_0xb2b0aa)[_0x4ccd('0x21')](_0x23c93d);}};}function respondWithFilteredResult(_0x1a5429,_0x11d906){return function(_0x5b22af){if(_0x5b22af){var _0x4ba04d=typeof _0x11d906[_0x4ccd('0x22')]===_0x4ccd('0x23')&&typeof _0x11d906[_0x4ccd('0x24')]===_0x4ccd('0x23');var _0x2b347c=_0x5b22af[_0x4ccd('0x25')];var _0x183536=_0x4ba04d?0x0:_0x11d906[_0x4ccd('0x22')];var _0x282324=_0x4ba04d?_0x5b22af['count']:_0x11d906[_0x4ccd('0x22')]+_0x11d906[_0x4ccd('0x24')];var _0x5047d6;if(_0x282324>=_0x2b347c){_0x282324=_0x2b347c;_0x5047d6=0xc8;}else{_0x5047d6=0xce;}_0x1a5429[_0x4ccd('0x1f')](_0x5047d6);return _0x1a5429['set'](_0x4ccd('0x26'),_0x183536+'-'+_0x282324+'/'+_0x2b347c)[_0x4ccd('0x21')](_0x5b22af);}return null;};}function patchUpdates(_0x118eee){return function(_0x38e21a){try{jsonpatch['apply'](_0x38e21a,_0x118eee,!![]);}catch(_0x27d793){return BPromise['reject'](_0x27d793);}return _0x38e21a[_0x4ccd('0x27')]();};}function saveUpdates(_0x2adafa,_0x5b6951){return function(_0x165287){if(_0x165287){return _0x165287[_0x4ccd('0x28')](_0x2adafa)[_0x4ccd('0x29')](function(_0x22f000){return _0x22f000;});}return null;};}function removeEntity(_0x36f4fd,_0x172cae){return function(_0x5d8a24){if(_0x5d8a24){return _0x5d8a24[_0x4ccd('0x2a')]()[_0x4ccd('0x29')](function(){var _0x26ab73=_0x5d8a24[_0x4ccd('0x2b')]({'plain':!![]});var _0x3129d2=_0x4ccd('0x2c');return db[_0x4ccd('0x2d')][_0x4ccd('0x2a')]({'where':{'type':_0x3129d2,'resourceId':_0x26ab73['id']}})[_0x4ccd('0x29')](function(){return _0x5d8a24;});})['then'](function(){_0x36f4fd[_0x4ccd('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4426ce,_0xb6d56){return function(_0x39a24d){if(!_0x39a24d){_0x4426ce['sendStatus'](0x194);}return _0x39a24d;};}function handleError(_0x40bb31,_0x496d81){_0x496d81=_0x496d81||0x1f4;return function(_0x5b945b){logger['error'](_0x5b945b[_0x4ccd('0x2e')]);if(_0x5b945b[_0x4ccd('0x2f')]){delete _0x5b945b[_0x4ccd('0x2f')];}_0x40bb31[_0x4ccd('0x1f')](_0x496d81)['send'](_0x5b945b);};}exports[_0x4ccd('0x30')]=function(_0xf6c21f,_0x563e3e){var _0x1f3c85={},_0x1db92b={},_0x52ac77={'count':0x0,'rows':[]};var _0x2fc519=_[_0x4ccd('0x31')](db[_0x4ccd('0x32')]['rawAttributes'],function(_0x2278e5){return{'name':_0x2278e5[_0x4ccd('0x33')],'type':_0x2278e5[_0x4ccd('0x34')][_0x4ccd('0x35')]};});_0x1db92b['model']=_[_0x4ccd('0x31')](_0x2fc519,_0x4ccd('0x2f'));_0x1db92b[_0x4ccd('0x36')]=_[_0x4ccd('0x37')](_0xf6c21f[_0x4ccd('0x36')]);_0x1db92b[_0x4ccd('0x38')]=_[_0x4ccd('0x39')](_0x1db92b[_0x4ccd('0x3a')],_0x1db92b[_0x4ccd('0x36')]);_0x1f3c85[_0x4ccd('0x3b')]=_['intersection'](_0x1db92b[_0x4ccd('0x3a')],qs[_0x4ccd('0x3c')](_0xf6c21f[_0x4ccd('0x36')][_0x4ccd('0x3c')]));_0x1f3c85[_0x4ccd('0x3b')]=_0x1f3c85['attributes']['length']?_0x1f3c85[_0x4ccd('0x3b')]:_0x1db92b['model'];if(!_0xf6c21f['query'][_0x4ccd('0x3d')](_0x4ccd('0x3e'))){_0x1f3c85['limit']=qs[_0x4ccd('0x24')](_0xf6c21f[_0x4ccd('0x36')][_0x4ccd('0x24')]);_0x1f3c85[_0x4ccd('0x22')]=qs['offset'](_0xf6c21f[_0x4ccd('0x36')][_0x4ccd('0x22')]);}_0x1f3c85[_0x4ccd('0x3f')]=qs[_0x4ccd('0x40')](_0xf6c21f[_0x4ccd('0x36')][_0x4ccd('0x40')]);_0x1f3c85[_0x4ccd('0x41')]=qs[_0x4ccd('0x38')](_[_0x4ccd('0x42')](_0xf6c21f['query'],_0x1db92b[_0x4ccd('0x38')]),_0x2fc519);if(_0xf6c21f[_0x4ccd('0x36')][_0x4ccd('0x43')]){_0x1f3c85['where']=_[_0x4ccd('0x44')](_0x1f3c85[_0x4ccd('0x41')],{'$or':_['map'](_0x2fc519,function(_0x4391ad){if(_0x4391ad[_0x4ccd('0x34')]!=='VIRTUAL'){var _0x1d3e48={};_0x1d3e48[_0x4391ad[_0x4ccd('0x2f')]]={'$like':'%'+_0xf6c21f[_0x4ccd('0x36')][_0x4ccd('0x43')]+'%'};return _0x1d3e48;}})});}_0x1f3c85=_[_0x4ccd('0x44')]({},_0x1f3c85,_0xf6c21f['options']);var _0x51f16e={'where':_0x1f3c85[_0x4ccd('0x41')]};return db['CmList'][_0x4ccd('0x25')](_0x51f16e)['then'](function(_0x46e796){_0x52ac77['count']=_0x46e796;if(_0xf6c21f[_0x4ccd('0x36')]['includeAll']){_0x1f3c85[_0x4ccd('0x45')]=[{'all':!![]}];}return db[_0x4ccd('0x32')][_0x4ccd('0x46')](_0x1f3c85);})[_0x4ccd('0x29')](function(_0x390f10){_0x52ac77[_0x4ccd('0x47')]=_0x390f10;return _0x52ac77;})[_0x4ccd('0x29')](respondWithFilteredResult(_0x563e3e,_0x1f3c85))[_0x4ccd('0x48')](handleError(_0x563e3e,null));};exports[_0x4ccd('0x49')]=function(_0x14c196,_0x50367c){var _0x27337a={'raw':![],'where':{'id':_0x14c196[_0x4ccd('0x4a')]['id']}},_0x4dd89c={};_0x4dd89c[_0x4ccd('0x3a')]=_[_0x4ccd('0x37')](db[_0x4ccd('0x32')]['rawAttributes']);_0x4dd89c['query']=_[_0x4ccd('0x37')](_0x14c196[_0x4ccd('0x36')]);_0x4dd89c[_0x4ccd('0x38')]=_['intersection'](_0x4dd89c[_0x4ccd('0x3a')],_0x4dd89c[_0x4ccd('0x36')]);_0x27337a[_0x4ccd('0x3b')]=_[_0x4ccd('0x39')](_0x4dd89c['model'],qs[_0x4ccd('0x3c')](_0x14c196[_0x4ccd('0x36')][_0x4ccd('0x3c')]));_0x27337a[_0x4ccd('0x3b')]=_0x27337a[_0x4ccd('0x3b')][_0x4ccd('0x4b')]?_0x27337a[_0x4ccd('0x3b')]:_0x4dd89c[_0x4ccd('0x3a')];if(_0x14c196[_0x4ccd('0x36')]['includeAll']){_0x27337a['include']=[{'all':!![]}];}_0x27337a=_[_0x4ccd('0x44')]({},_0x27337a,_0x14c196[_0x4ccd('0x4c')]);return db['CmList']['find'](_0x27337a)[_0x4ccd('0x29')](handleEntityNotFound(_0x50367c,null))[_0x4ccd('0x29')](respondWithResult(_0x50367c,null))['catch'](handleError(_0x50367c,null));};exports['create']=function(_0x1ee4c4,_0x41bd70){return db[_0x4ccd('0x32')][_0x4ccd('0x4d')](_0x1ee4c4[_0x4ccd('0x4e')],{})[_0x4ccd('0x29')](function(_0x53e7dc){var _0x127fbc=_0x1ee4c4['user'][_0x4ccd('0x2b')]({'plain':!![]});if(!_0x127fbc)throw new Error(_0x4ccd('0x4f'));if(_0x127fbc[_0x4ccd('0x50')]==='user'){var _0x16c8e9=_0x53e7dc[_0x4ccd('0x2b')]({'plain':!![]});var _0xdeb6b4=_0x4ccd('0x2c');return db[_0x4ccd('0x51')][_0x4ccd('0x52')]({'where':{'name':_0xdeb6b4,'userProfileId':_0x127fbc[_0x4ccd('0x53')]},'raw':!![]})[_0x4ccd('0x29')](function(_0x3b9fc0){if(_0x3b9fc0&&_0x3b9fc0[_0x4ccd('0x54')]===0x0){return db[_0x4ccd('0x2d')]['create']({'name':_0x16c8e9[_0x4ccd('0x2f')],'resourceId':_0x16c8e9['id'],'type':_0x3b9fc0[_0x4ccd('0x2f')],'sectionId':_0x3b9fc0['id']},{})[_0x4ccd('0x29')](function(){return _0x53e7dc;});}else{return _0x53e7dc;}})['catch'](function(_0xe28471){logger[_0x4ccd('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe28471);throw _0xe28471;});}return _0x53e7dc;})[_0x4ccd('0x29')](respondWithResult(_0x41bd70,0xc9))[_0x4ccd('0x48')](handleError(_0x41bd70,null));};exports[_0x4ccd('0x28')]=function(_0xe55df8,_0x3b2864){if(_0xe55df8[_0x4ccd('0x4e')]['id']){delete _0xe55df8[_0x4ccd('0x4e')]['id'];}return db[_0x4ccd('0x32')][_0x4ccd('0x52')]({'where':{'id':_0xe55df8[_0x4ccd('0x4a')]['id']}})[_0x4ccd('0x29')](handleEntityNotFound(_0x3b2864,null))[_0x4ccd('0x29')](saveUpdates(_0xe55df8['body'],null))[_0x4ccd('0x29')](respondWithResult(_0x3b2864,null))['catch'](handleError(_0x3b2864,null));};exports[_0x4ccd('0x2a')]=function(_0x2beb57,_0x6bcfcb){return db[_0x4ccd('0x32')][_0x4ccd('0x52')]({'where':{'id':_0x2beb57[_0x4ccd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x6bcfcb,null))[_0x4ccd('0x29')](removeEntity(_0x6bcfcb,null))[_0x4ccd('0x48')](handleError(_0x6bcfcb,null));};exports[_0x4ccd('0x56')]=function(_0x104606,_0x4dd425){return db[_0x4ccd('0x32')][_0x4ccd('0x56')]()[_0x4ccd('0x29')](respondWithResult(_0x4dd425,null))[_0x4ccd('0x48')](handleError(_0x4dd425,null));};exports[_0x4ccd('0x57')]=function(_0x44f91a,_0x30ed13,_0x9a6de4){if(_0x44f91a[_0x4ccd('0x4e')]['id']){delete _0x44f91a['body']['id'];}return db[_0x4ccd('0x32')]['find']({'where':{'id':_0x44f91a[_0x4ccd('0x4a')]['id']}})[_0x4ccd('0x29')](handleEntityNotFound(_0x30ed13,null))[_0x4ccd('0x29')](function(_0x2021b2){if(_0x2021b2){_0x44f91a[_0x4ccd('0x4e')][_0x4ccd('0x58')]=_0x2021b2['id'];return db[_0x4ccd('0x59')][_0x4ccd('0x4d')](_0x44f91a[_0x4ccd('0x4e')]);}})[_0x4ccd('0x29')](respondWithResult(_0x30ed13,null))['catch'](handleError(_0x30ed13,null));};exports[_0x4ccd('0x5a')]=function(_0x5d9a5f,_0x38a7ed,_0x174344){var _0x4323e8={'raw':![],'where':{}};var _0x5e483f={};var _0x14748b={'count':0x0,'rows':[]};return db[_0x4ccd('0x32')][_0x4ccd('0x5b')]({'where':{'id':_0x5d9a5f[_0x4ccd('0x4a')]['id']}})[_0x4ccd('0x29')](handleEntityNotFound(_0x38a7ed,null))['then'](function(_0x1070e1){if(_0x1070e1){_0x5e483f[_0x4ccd('0x3a')]=_[_0x4ccd('0x37')](db['Disposition']['rawAttributes']);_0x5e483f['query']=_[_0x4ccd('0x37')](_0x5d9a5f[_0x4ccd('0x36')]);_0x5e483f[_0x4ccd('0x38')]=_['intersection'](_0x5e483f['model'],_0x5e483f[_0x4ccd('0x36')]);_0x4323e8[_0x4ccd('0x3b')]=_[_0x4ccd('0x39')](_0x5e483f[_0x4ccd('0x3a')],qs['fields'](_0x5d9a5f[_0x4ccd('0x36')]['fields']));_0x4323e8[_0x4ccd('0x3b')]=_0x4323e8['attributes'][_0x4ccd('0x4b')]?_0x4323e8[_0x4ccd('0x3b')]:_0x5e483f[_0x4ccd('0x3a')];if(!_0x5d9a5f['query'][_0x4ccd('0x3d')](_0x4ccd('0x3e'))){_0x4323e8[_0x4ccd('0x24')]=qs[_0x4ccd('0x24')](_0x5d9a5f[_0x4ccd('0x36')][_0x4ccd('0x24')]);_0x4323e8['offset']=qs['offset'](_0x5d9a5f[_0x4ccd('0x36')][_0x4ccd('0x22')]);}_0x4323e8[_0x4ccd('0x3f')]=qs[_0x4ccd('0x40')](_0x5d9a5f['query'][_0x4ccd('0x40')]);_0x4323e8['where']=qs['filters'](_['pick'](_0x5d9a5f['query'],_0x5e483f[_0x4ccd('0x38')]));_0x4323e8['where'][_0x4ccd('0x58')]=_0x1070e1['id'];if(_0x5d9a5f['query'][_0x4ccd('0x43')]){_0x4323e8[_0x4ccd('0x41')]=_[_0x4ccd('0x44')](_0x4323e8[_0x4ccd('0x41')],{'$or':_[_0x4ccd('0x31')](_0x4323e8[_0x4ccd('0x3b')],function(_0x57ff8c){var _0x4ee3ff={};_0x4ee3ff[_0x57ff8c]={'$like':'%'+_0x5d9a5f[_0x4ccd('0x36')][_0x4ccd('0x43')]+'%'};return _0x4ee3ff;})});}_0x4323e8=_['merge']({},_0x4323e8,_0x5d9a5f[_0x4ccd('0x4c')]);return db[_0x4ccd('0x59')][_0x4ccd('0x25')]({'where':_0x4323e8[_0x4ccd('0x41')]})[_0x4ccd('0x29')](function(_0x4a7dc9){_0x14748b[_0x4ccd('0x25')]=_0x4a7dc9;if(_0x5d9a5f[_0x4ccd('0x36')][_0x4ccd('0x5c')]){_0x4323e8[_0x4ccd('0x45')]=[{'all':!![]}];}return db[_0x4ccd('0x59')][_0x4ccd('0x46')](_0x4323e8);})['then'](function(_0x4b077a){_0x14748b[_0x4ccd('0x47')]=_0x4b077a;return _0x14748b;});}})['then'](respondWithFilteredResult(_0x38a7ed,_0x4323e8))[_0x4ccd('0x48')](handleError(_0x38a7ed,null));};exports[_0x4ccd('0x5d')]=function(_0x5eff58,_0x54a6cc,_0x271368){return db[_0x4ccd('0x32')][_0x4ccd('0x52')]({'where':{'id':_0x5eff58[_0x4ccd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x54a6cc,null))[_0x4ccd('0x29')](function(_0xe264c6){if(_0xe264c6){return _0xe264c6[_0x4ccd('0x5d')](_0x5eff58[_0x4ccd('0x36')][_0x4ccd('0x5e')]);}})[_0x4ccd('0x29')](respondWithStatusCode(_0x54a6cc,null))[_0x4ccd('0x48')](handleError(_0x54a6cc,null));};exports[_0x4ccd('0x5f')]=function(_0x142863,_0x2b7f3f,_0x4faf1d){return db[_0x4ccd('0x32')][_0x4ccd('0x52')]({'where':{'id':_0x142863['params']['id']}})['then'](handleEntityNotFound(_0x2b7f3f,null))['then'](function(_0x26f9e1){if(_0x26f9e1){var _0x5864c9=[];var _0x752552={'success':[],'errors':[]};return db[_0x4ccd('0x60')][_0x4ccd('0x56')]()[_0x4ccd('0x29')](function(_0x2512df){if(_0x142863[_0x4ccd('0x4e')][_0x4ccd('0x61')]&&_[_0x4ccd('0x62')](_0x142863[_0x4ccd('0x4e')]['tags'])){if(_0x142863[_0x4ccd('0x4e')][_0x4ccd('0x61')][_0x4ccd('0x4b')]){_0x142863[_0x4ccd('0x4e')][_0x4ccd('0x61')]=_0x142863[_0x4ccd('0x4e')][_0x4ccd('0x61')][_0x4ccd('0x63')](';')+';';}else{_0x142863[_0x4ccd('0x4e')][_0x4ccd('0x61')]=null;}}else{_0x142863[_0x4ccd('0x4e')][_0x4ccd('0x61')]=null;}if(_0x142863['body']&&_[_0x4ccd('0x62')](_0x142863['body'])){for(var _0x10189a=0x0;_0x10189a<_0x142863['body']['length'];_0x10189a+=0x1){_0x142863['body'][_0x10189a]['ListId']=_0x142863[_0x4ccd('0x4a')]['id'];_0x5864c9['push'](_0x142863[_0x4ccd('0x4e')][_0x10189a]);}return BPromise[_0x4ccd('0x64')](_0x5864c9,function(_0x3005dc){return db['CmContact'][_0x4ccd('0x4d')](_['omit'](_0x3005dc,[_0x4ccd('0x5e'),'id'])||{},{'fields':_[_0x4ccd('0x37')](_0x2512df),'raw':!![]})[_0x4ccd('0x29')](function(_0x168bde){_0x752552[_0x4ccd('0x65')]['push'](_0x168bde['dataValues']);})[_0x4ccd('0x48')](function(_0x5a714a){_0x752552['errors']['push']({'data':_0x3005dc,'error':_0x5a714a[_0x4ccd('0x66')]});});})[_0x4ccd('0x29')](function(_0xfade7a){return _0x752552;})['catch'](function(_0x43ab28){return _0x43ab28;});}else{_0x2b7f3f['status'](0x190)['json']({'message':_0x4ccd('0x67')});}});}})[_0x4ccd('0x29')](respondWithResult(_0x2b7f3f,null))['catch'](handleError(_0x2b7f3f,null));};exports[_0x4ccd('0x68')]=function(_0x3a814c,_0x4d02de,_0x5b7b52){var _0x11a14d;return db[_0x4ccd('0x32')]['find']({'where':{'id':_0x3a814c['params']['id']},'include':[{'model':db[_0x4ccd('0x69')],'as':'CustomFields'}]})[_0x4ccd('0x29')](handleEntityNotFound(_0x4d02de,null))[_0x4ccd('0x29')](function(_0x3c4af0){if(_0x3c4af0){_0x11a14d=_0x3c4af0;return db[_0x4ccd('0x60')]['rawAttributes'];}})[_0x4ccd('0x29')](function(_0x71ca6c){if(_0x71ca6c){var _0x417e91={};var _0x3eea38={};_0x3eea38[_0x4ccd('0x3a')]=_[_0x4ccd('0x6a')](_[_0x4ccd('0x37')](_0x71ca6c),_[_0x4ccd('0x31')](_0x11a14d[_0x4ccd('0x6b')],function(_0x45f98f){return util[_0x4ccd('0x6c')]('cf_%d',_0x45f98f['id']);}));_0x3eea38[_0x4ccd('0x36')]=_[_0x4ccd('0x37')](_0x3a814c['query']);_0x3eea38[_0x4ccd('0x38')]=_[_0x4ccd('0x39')](_0x3eea38[_0x4ccd('0x3a')],_0x3eea38[_0x4ccd('0x36')]);_0x417e91[_0x4ccd('0x3b')]=_[_0x4ccd('0x39')](_0x3eea38[_0x4ccd('0x3a')],qs[_0x4ccd('0x3c')](_0x3a814c[_0x4ccd('0x36')][_0x4ccd('0x3c')]));_0x417e91[_0x4ccd('0x3b')]=_0x417e91['attributes'][_0x4ccd('0x4b')]?_0x417e91['attributes']:_0x3eea38[_0x4ccd('0x3a')];if(!_0x3a814c[_0x4ccd('0x36')][_0x4ccd('0x3d')](_0x4ccd('0x3e'))){_0x417e91[_0x4ccd('0x24')]=qs['limit'](_0x3a814c['query'][_0x4ccd('0x24')]);_0x417e91[_0x4ccd('0x22')]=qs[_0x4ccd('0x22')](_0x3a814c['query'][_0x4ccd('0x22')]);}_0x417e91[_0x4ccd('0x3f')]=qs['sort'](_0x3a814c[_0x4ccd('0x36')]['sort']);_0x417e91[_0x4ccd('0x41')]=qs['filters'](_[_0x4ccd('0x42')](_0x3a814c[_0x4ccd('0x36')],_0x3eea38[_0x4ccd('0x38')]));_0x417e91['raw']=!![];if(_0x3a814c[_0x4ccd('0x36')][_0x4ccd('0x43')]){_0x417e91[_0x4ccd('0x41')]=_[_0x4ccd('0x44')](_0x417e91[_0x4ccd('0x41')],{'$or':_[_0x4ccd('0x31')](_0x417e91[_0x4ccd('0x3b')],function(_0x2b5f86){var _0x4ca8e2={};_0x4ca8e2[_0x2b5f86]={'$like':'%'+_0x3a814c[_0x4ccd('0x36')][_0x4ccd('0x43')]+'%'};return _0x4ca8e2;})});}_0x417e91=_[_0x4ccd('0x44')]({},_0x417e91,_0x3a814c[_0x4ccd('0x4c')]);return _0x11a14d['getContacts'](_0x417e91);}})['then'](respondWithResult(_0x4d02de,null))[_0x4ccd('0x48')](handleError(_0x4d02de,null));};exports[_0x4ccd('0x6d')]=function(_0x2e87f0,_0x51a143,_0x406613){var _0x9780b1;var _0x4a882f;var _0xb01fa8;var _0x4f8c3a=_0x2e87f0[_0x4ccd('0x4a')]['id'];csv_results=[];return db[_0x4ccd('0x6e')][_0x4ccd('0x46')]({'attributes':['id',_0x4ccd('0x2f')],'raw':!![],'order':[_0x4ccd('0x6f')]})[_0x4ccd('0x29')](function(_0x5eb807){_0x9780b1=_0x5eb807;var _0x3fc7ae=_[_0x4ccd('0x37')](db[_0x4ccd('0x60')]['rawAttributes']);return db[_0x4ccd('0x69')]['findAll']({'raw':!![],'attributes':['id',_0x4ccd('0x70')]})['then'](function(_0x2ba8ac){_0x4a882f=_0x2ba8ac;var _0x323f78=squel[_0x4ccd('0x71')]()['fields'](_0x3fc7ae)['from'](_0x4ccd('0x72'),'c')['where'](_0x4ccd('0x73'),_0x4f8c3a)[_0x4ccd('0x41')]('c.deletedAt\x20is\x20null')[_0x4ccd('0x74')]();for(var _0x1052fb=0x0;_0x1052fb<_0x4a882f[_0x4ccd('0x4b')];_0x1052fb++){_0x323f78['field'](_0x4ccd('0x75')+_0x4a882f[_0x1052fb]['id'],'customField_'+_0x4a882f[_0x1052fb]['alias']);}for(var _0x1052fb=0x0;_0x1052fb<_0x9780b1['length'];_0x1052fb++){_0x323f78[_0x4ccd('0x76')](squel[_0x4ccd('0x71')]()[_0x4ccd('0x76')](_0x4ccd('0x77'))['from'](_0x4ccd('0x78'))[_0x4ccd('0x41')](_0x4ccd('0x79'),_0x9780b1[_0x1052fb]['id'])[_0x4ccd('0x41')]('CmContactId\x20=\x20c.id'),'additionalPhone_'+_0x9780b1[_0x1052fb][_0x4ccd('0x2f')]);_0x323f78[_0x4ccd('0x76')](squel[_0x4ccd('0x71')]()[_0x4ccd('0x76')](_0x4ccd('0x7a'))[_0x4ccd('0x7b')](_0x4ccd('0x78'))['where'](_0x4ccd('0x79'),_0x9780b1[_0x1052fb]['id'])['where'](_0x4ccd('0x7c')),_0x4ccd('0x7d')+_0x9780b1[_0x1052fb][_0x4ccd('0x2f')]);}var _0x441c93=[];_0x441c93['push'](_0x323f78[_0x4ccd('0x7e')]());BPromise[_0x4ccd('0x64')](_0x441c93,handleQuery)[_0x4ccd('0x29')](function(_0x148536){handleQuery(_0x323f78[_0x4ccd('0x7e')]());var _0x248a63=csv_results[0x0];if(!_[_0x4ccd('0x7f')](_0x248a63)){var _0x32d5b0=toCsv(_0x248a63);var _0x191f65=Date[_0x4ccd('0x80')]();fs[_0x4ccd('0x81')](util[_0x4ccd('0x6c')](_0x4ccd('0x82'),_0x4f8c3a,_0x191f65),_0x32d5b0);_0x51a143[_0x4ccd('0x83')](_0x4ccd('0x84'),_0x4ccd('0x85')+util[_0x4ccd('0x6c')](_0x4ccd('0x86'),_0x4f8c3a,_0x191f65));_0x51a143[_0x4ccd('0x83')]('Content-type',_0x4ccd('0x87'));return _0x51a143['download'](util[_0x4ccd('0x6c')](_0x4ccd('0x82'),_0x4f8c3a,_0x191f65));}else{return _0x51a143[_0x4ccd('0x1e')](0xcc);}});});});};exports[_0x4ccd('0x88')]=function(_0x59fcea,_0x39a055,_0x24fb8f){var _0x4c20ef;delete _0x59fcea[_0x4ccd('0x4e')]['id'];return db[_0x4ccd('0x32')][_0x4ccd('0x5b')]({'where':{'id':_0x59fcea['params']['id']}})[_0x4ccd('0x29')](handleEntityNotFound(_0x39a055,null))[_0x4ccd('0x29')](function(_0x3bcf2a){if(_0x3bcf2a){return db['sequelize'][_0x4ccd('0x89')](function(_0x564781){return db['CmCustomField'][_0x4ccd('0x4d')](_0x59fcea[_0x4ccd('0x4e')],{'transaction':_0x564781})['then'](function(_0xffcff7){_0x4c20ef=_0xffcff7;return _0x3bcf2a[_0x4ccd('0x8a')](_0xffcff7,{'transaction':_0x564781});})['then'](function(){var _0x59803b={'type':db[_0x4ccd('0x8b')][_0x4ccd('0x8c')],'transaction':_0x564781};switch(_0x59fcea[_0x4ccd('0x4e')][_0x4ccd('0x34')]){case _0x4ccd('0x8d'):_0x59803b['type']=db[_0x4ccd('0x8b')][_0x4ccd('0x8c')];break;case _0x4ccd('0x8e'):_0x59803b[_0x4ccd('0x34')]=db[_0x4ccd('0x8b')][_0x4ccd('0x8f')];break;case _0x4ccd('0x90'):_0x59803b['type']=db[_0x4ccd('0x8b')]['BOOLEAN'];_0x59803b[_0x4ccd('0x91')]=![];break;default:}return db[_0x4ccd('0x92')][_0x4ccd('0x93')][_0x4ccd('0x94')](_0x4ccd('0x72'),util[_0x4ccd('0x6c')](_0x4ccd('0x95'),_0x4c20ef['id']),_0x59803b);})['then'](function(){return _0x4c20ef;});});}})[_0x4ccd('0x29')](respondWithResult(_0x39a055,null))['catch'](handleError(_0x39a055,null));};exports[_0x4ccd('0x96')]=function(_0x15c76f,_0x30bd9e,_0x506f47){var _0x5ec88e={};var _0x5f3673={};var _0x2c108a;var _0xcdd12;return db[_0x4ccd('0x32')]['findOne']({'where':{'id':_0x15c76f[_0x4ccd('0x4a')]['id']}})[_0x4ccd('0x29')](handleEntityNotFound(_0x30bd9e,null))[_0x4ccd('0x29')](function(_0x250b28){if(_0x250b28){_0x2c108a=_0x250b28;_0x5f3673['model']=_[_0x4ccd('0x37')](db[_0x4ccd('0x69')]['rawAttributes']);_0x5f3673[_0x4ccd('0x36')]=_['keys'](_0x15c76f['query']);_0x5f3673[_0x4ccd('0x38')]=_[_0x4ccd('0x39')](_0x5f3673[_0x4ccd('0x3a')],_0x5f3673['query']);_0x5ec88e['attributes']=_['intersection'](_0x5f3673['model'],qs[_0x4ccd('0x3c')](_0x15c76f[_0x4ccd('0x36')]['fields']));_0x5ec88e[_0x4ccd('0x3b')]=_0x5ec88e['attributes']['length']?_0x5ec88e[_0x4ccd('0x3b')]:_0x5f3673[_0x4ccd('0x3a')];_0x5ec88e[_0x4ccd('0x3f')]=qs[_0x4ccd('0x40')](_0x15c76f['query'][_0x4ccd('0x40')]);_0x5ec88e[_0x4ccd('0x41')]=qs[_0x4ccd('0x38')](_[_0x4ccd('0x42')](_0x15c76f[_0x4ccd('0x36')],_0x5f3673[_0x4ccd('0x38')]));_0x5ec88e[_0x4ccd('0x41')]=_['merge'](_0x5ec88e[_0x4ccd('0x41')],{'$or':[{'ListId':_0x250b28['id']},{'ListId':null}]});if(_0x15c76f[_0x4ccd('0x36')]['filter']){_0x5ec88e[_0x4ccd('0x41')]=_[_0x4ccd('0x44')](_0x5ec88e[_0x4ccd('0x41')],{'$or':_[_0x4ccd('0x31')](_0x5ec88e[_0x4ccd('0x3b')],function(_0x5aa8f3){var _0x2c8877={};_0x2c8877[_0x5aa8f3]={'$like':'%'+_0x15c76f['query'][_0x4ccd('0x43')]+'%'};return _0x2c8877;})});}_0x5ec88e=_[_0x4ccd('0x44')]({},_0x5ec88e,_0x15c76f[_0x4ccd('0x4c')]);return db[_0x4ccd('0x69')][_0x4ccd('0x97')](_0x5ec88e);}})[_0x4ccd('0x29')](respondWithResult(_0x30bd9e,null))[_0x4ccd('0x48')](handleError(_0x30bd9e,null));};exports[_0x4ccd('0x98')]=function(_0x5807d5,_0x2935ea){return db[_0x4ccd('0x69')]['findAndCountAll']({'where':{'ListId':null}})[_0x4ccd('0x29')](handleEntityNotFound(_0x2935ea,null))['then'](function(_0x48b049){return _0x48b049;})[_0x4ccd('0x29')](respondWithResult(_0x2935ea,null))[_0x4ccd('0x48')](handleError(_0x2935ea,null));};exports[_0x4ccd('0x99')]=function(_0x110de4,_0x5bea01,_0x9aaaca){return db[_0x4ccd('0x32')][_0x4ccd('0x52')]({'where':{'id':_0x110de4[_0x4ccd('0x4a')]['id']}})[_0x4ccd('0x29')](handleEntityNotFound(_0x5bea01,null))[_0x4ccd('0x29')](function(_0x3ea214){if(_0x3ea214){return _0x3ea214['addAgents'](_0x110de4[_0x4ccd('0x4e')][_0x4ccd('0x5e')],_['omit'](_0x110de4[_0x4ccd('0x4e')],[_0x4ccd('0x5e'),'id'])||{})[_0x4ccd('0x9a')](function(_0x460f10){for(var _0xf0c64c=0x0;_0xf0c64c<_0x110de4[_0x4ccd('0x4e')][_0x4ccd('0x5e')]['length'];_0xf0c64c+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x110de4['body'][_0x4ccd('0x5e')][_0xf0c64c]),'CmListId':Number(_0x110de4[_0x4ccd('0x4a')]['id'])});}return _0x460f10;});}})[_0x4ccd('0x29')](respondWithResult(_0x5bea01,null))['catch'](handleError(_0x5bea01,null));};exports[_0x4ccd('0x9b')]=function(_0x5c3571,_0x3748f8,_0x1b76c2){return db[_0x4ccd('0x32')][_0x4ccd('0x52')]({'where':{'id':_0x5c3571[_0x4ccd('0x4a')]['id']}})[_0x4ccd('0x29')](handleEntityNotFound(_0x3748f8,null))['then'](function(_0x593b26){if(_0x593b26){return _0x593b26['removeAgents'](_0x5c3571['query']['ids'])['then'](function(){if(_['isArray'](_0x5c3571[_0x4ccd('0x36')][_0x4ccd('0x5e')])){for(var _0x453d83=0x0;_0x453d83<_0x5c3571['query'][_0x4ccd('0x5e')][_0x4ccd('0x4b')];_0x453d83+=0x1){socket[_0x4ccd('0x9c')]('userCmList:remove',{'UserId':Number(_0x5c3571[_0x4ccd('0x36')][_0x4ccd('0x5e')][_0x453d83]),'CmListId':Number(_0x5c3571['params']['id'])});}}else{socket[_0x4ccd('0x9c')](_0x4ccd('0x9d'),{'UserId':Number(_0x5c3571[_0x4ccd('0x36')]['ids']),'CmListId':Number(_0x5c3571[_0x4ccd('0x4a')]['id'])});}});}})[_0x4ccd('0x29')](respondWithStatusCode(_0x3748f8,null))['catch'](handleError(_0x3748f8,null));};exports['getAgents']=function(_0x3f3cbf,_0x3c1cf3,_0x5ecee8){var _0x4f5f6d={};var _0x1c0226={};var _0x3b0035;var _0x39dd1d;return db[_0x4ccd('0x32')][_0x4ccd('0x5b')]({'where':{'id':_0x3f3cbf[_0x4ccd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3c1cf3,null))['then'](function(_0x359754){if(_0x359754){_0x3b0035=_0x359754;_0x1c0226[_0x4ccd('0x3a')]=_[_0x4ccd('0x37')](db[_0x4ccd('0x9e')][_0x4ccd('0x9f')]);_0x1c0226[_0x4ccd('0x36')]=_[_0x4ccd('0x37')](_0x3f3cbf['query']);_0x1c0226[_0x4ccd('0x38')]=_['intersection'](_0x1c0226[_0x4ccd('0x3a')],_0x1c0226['query']);_0x4f5f6d[_0x4ccd('0x3b')]=_[_0x4ccd('0x39')](_0x1c0226[_0x4ccd('0x3a')],qs[_0x4ccd('0x3c')](_0x3f3cbf['query'][_0x4ccd('0x3c')]));_0x4f5f6d[_0x4ccd('0x3b')]=_0x4f5f6d['attributes'][_0x4ccd('0x4b')]?_0x4f5f6d[_0x4ccd('0x3b')]:_0x1c0226[_0x4ccd('0x3a')];_0x4f5f6d['order']=qs['sort'](_0x3f3cbf[_0x4ccd('0x36')][_0x4ccd('0x40')]);_0x4f5f6d[_0x4ccd('0x41')]=qs[_0x4ccd('0x38')](_[_0x4ccd('0x42')](_0x3f3cbf[_0x4ccd('0x36')],_0x1c0226[_0x4ccd('0x38')]));if(_0x3f3cbf[_0x4ccd('0x36')][_0x4ccd('0x43')]){_0x4f5f6d[_0x4ccd('0x41')]=_[_0x4ccd('0x44')](_0x4f5f6d[_0x4ccd('0x41')],{'$or':_['map'](_0x4f5f6d[_0x4ccd('0x3b')],function(_0x29f676){var _0x4e6d35={};_0x4e6d35[_0x29f676]={'$like':'%'+_0x3f3cbf[_0x4ccd('0x36')][_0x4ccd('0x43')]+'%'};return _0x4e6d35;})});}_0x4f5f6d=_[_0x4ccd('0x44')]({},_0x4f5f6d,_0x3f3cbf[_0x4ccd('0x4c')]);return _0x3b0035[_0x4ccd('0xa0')](_0x4f5f6d);}})['then'](function(_0x43a0a1){if(_0x43a0a1){_0x39dd1d=_0x43a0a1[_0x4ccd('0x4b')];if(!_0x3f3cbf['query'][_0x4ccd('0x3d')](_0x4ccd('0x3e'))){_0x4f5f6d[_0x4ccd('0x24')]=qs[_0x4ccd('0x24')](_0x3f3cbf[_0x4ccd('0x36')][_0x4ccd('0x24')]);_0x4f5f6d['offset']=qs['offset'](_0x3f3cbf[_0x4ccd('0x36')][_0x4ccd('0x22')]);}return _0x3b0035['getAgents'](_0x4f5f6d);}})[_0x4ccd('0x29')](function(_0xe38848){if(_0xe38848){return _0xe38848?{'count':_0x39dd1d,'rows':_0xe38848}:null;}})[_0x4ccd('0x29')](respondWithResult(_0x3c1cf3,null))['catch'](handleError(_0x3c1cf3,null));};function handleQuery(_0x3c3a84){logger[_0x4ccd('0xa1')](_0x3c3a84);return db[_0x4ccd('0x92')][_0x4ccd('0x36')](_0x3c3a84)['spread'](function(_0x440967){csv_results['push'](_0x440967);})['catch'](function(_0x237fce){logger[_0x4ccd('0x55')](_0x237fce[_0x4ccd('0x66')]);});}
\ No newline at end of file
+var _0x0a5e=['defaultValue','addColumn','getCustomFields','order','findAndCountAll','getGlobalCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','info','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','sendStatus','error','stack','name','index','map','fieldName','type','key','query','model','attributes','intersection','length','hasOwnProperty','sort','where','pick','filter','merge','CmList','includeAll','include','findAll','rows','catch','show','keys','filters','fields','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','body','params','describe','addDisposition','ListId','Disposition','getDispositions','nolimit','removeDispositions','ids','addContacts','tags','isArray','each','CmContact','omit','success','push','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','rawAttributes','concat','CustomFields','format','cf_%d','raw','ContactItemType','OrderBy','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','alias','from','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','toString','isEmpty','writeFileSync','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','findOne','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN'];(function(_0x202b9e,_0x289c30){var _0xc65432=function(_0x12e945){while(--_0x12e945){_0x202b9e['push'](_0x202b9e['shift']());}};_0xc65432(++_0x289c30);}(_0x0a5e,0x1eb));var _0xe0a5=function(_0x3e8c30,_0xa25e4d){_0x3e8c30=_0x3e8c30-0x0;var _0x2c2fb4=_0x0a5e[_0x3e8c30];return _0x2c2fb4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe0a5('0x0'));var zipdir=require(_0xe0a5('0x1'));var jsonpatch=require(_0xe0a5('0x2'));var rp=require(_0xe0a5('0x3'));var moment=require(_0xe0a5('0x4'));var BPromise=require(_0xe0a5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe0a5('0x6'));var sox=require('sox');var csv=require(_0xe0a5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0a5('0x8'));var _=require(_0xe0a5('0x9'));var squel=require(_0xe0a5('0xa'));var crypto=require(_0xe0a5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe0a5('0xc'));var toCsv=require(_0xe0a5('0x7'));var querystring=require('querystring');var Papa=require(_0xe0a5('0xd'));var Redis=require(_0xe0a5('0xe'));var authService=require(_0xe0a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe0a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0a5('0x11'))('api');var utils=require(_0xe0a5('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xe0a5('0x13'));var db=require(_0xe0a5('0x14'))['db'];var csv_results;config['redis']=_[_0xe0a5('0x15')](config[_0xe0a5('0x16')],{'host':_0xe0a5('0x17'),'port':0x18eb});var socket=require(_0xe0a5('0x18'))(new Redis(config[_0xe0a5('0x16')]));require(_0xe0a5('0x19'))[_0xe0a5('0x1a')](socket);function respondWithStatusCode(_0xdb0019,_0x2be5a0){_0x2be5a0=_0x2be5a0||0xcc;return function(_0x14ae74){if(_0x14ae74){return _0xdb0019['sendStatus'](_0x2be5a0);}return _0xdb0019[_0xe0a5('0x1b')](_0x2be5a0)['end']();};}function respondWithResult(_0x42395c,_0x385100){_0x385100=_0x385100||0xc8;return function(_0x2e492b){if(_0x2e492b){return _0x42395c[_0xe0a5('0x1b')](_0x385100)[_0xe0a5('0x1c')](_0x2e492b);}};}function respondWithFilteredResult(_0x35538f,_0x17d567){return function(_0x29d68d){if(_0x29d68d){var _0x363af4=typeof _0x17d567[_0xe0a5('0x1d')]==='undefined'&&typeof _0x17d567[_0xe0a5('0x1e')]===_0xe0a5('0x1f');var _0x32125e=_0x29d68d['count'];var _0x1efa0c=_0x363af4?0x0:_0x17d567[_0xe0a5('0x1d')];var _0x4e9625=_0x363af4?_0x29d68d[_0xe0a5('0x20')]:_0x17d567[_0xe0a5('0x1d')]+_0x17d567[_0xe0a5('0x1e')];var _0x4bdb72;if(_0x4e9625>=_0x32125e){_0x4e9625=_0x32125e;_0x4bdb72=0xc8;}else{_0x4bdb72=0xce;}_0x35538f['status'](_0x4bdb72);return _0x35538f['set'](_0xe0a5('0x21'),_0x1efa0c+'-'+_0x4e9625+'/'+_0x32125e)[_0xe0a5('0x1c')](_0x29d68d);}return null;};}function patchUpdates(_0x3b135b){return function(_0x1ea673){try{jsonpatch[_0xe0a5('0x22')](_0x1ea673,_0x3b135b,!![]);}catch(_0x41d1f5){return BPromise[_0xe0a5('0x23')](_0x41d1f5);}return _0x1ea673[_0xe0a5('0x24')]();};}function saveUpdates(_0x100f0e,_0x5ecc05){return function(_0x1da64e){if(_0x1da64e){return _0x1da64e[_0xe0a5('0x25')](_0x100f0e)[_0xe0a5('0x26')](function(_0xff62ba){return _0xff62ba;});}return null;};}function removeEntity(_0x136385,_0x8f03cf){return function(_0xac0b70){if(_0xac0b70){return _0xac0b70[_0xe0a5('0x27')]()[_0xe0a5('0x26')](function(){var _0x28761e=_0xac0b70[_0xe0a5('0x28')]({'plain':!![]});var _0x43898f=_0xe0a5('0x29');return db[_0xe0a5('0x2a')]['destroy']({'where':{'type':_0x43898f,'resourceId':_0x28761e['id']}})[_0xe0a5('0x26')](function(){return _0xac0b70;});})[_0xe0a5('0x26')](function(){_0x136385[_0xe0a5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e9eb1,_0x3f3714){return function(_0x4e2efa){if(!_0x4e2efa){_0x5e9eb1[_0xe0a5('0x2b')](0x194);}return _0x4e2efa;};}function handleError(_0x10c39b,_0x1329d6){_0x1329d6=_0x1329d6||0x1f4;return function(_0x350bb3){logger[_0xe0a5('0x2c')](_0x350bb3[_0xe0a5('0x2d')]);if(_0x350bb3['name']){delete _0x350bb3[_0xe0a5('0x2e')];}_0x10c39b[_0xe0a5('0x1b')](_0x1329d6)['send'](_0x350bb3);};}exports[_0xe0a5('0x2f')]=function(_0x5c0dbf,_0x33129a){var _0x1b67e6={},_0x572f0f={},_0x58cbc1={'count':0x0,'rows':[]};var _0x1f9e08=_[_0xe0a5('0x30')](db['CmList']['rawAttributes'],function(_0x3aa306){return{'name':_0x3aa306[_0xe0a5('0x31')],'type':_0x3aa306[_0xe0a5('0x32')][_0xe0a5('0x33')]};});_0x572f0f['model']=_[_0xe0a5('0x30')](_0x1f9e08,_0xe0a5('0x2e'));_0x572f0f[_0xe0a5('0x34')]=_['keys'](_0x5c0dbf[_0xe0a5('0x34')]);_0x572f0f['filters']=_['intersection'](_0x572f0f[_0xe0a5('0x35')],_0x572f0f[_0xe0a5('0x34')]);_0x1b67e6[_0xe0a5('0x36')]=_[_0xe0a5('0x37')](_0x572f0f['model'],qs['fields'](_0x5c0dbf[_0xe0a5('0x34')]['fields']));_0x1b67e6[_0xe0a5('0x36')]=_0x1b67e6[_0xe0a5('0x36')][_0xe0a5('0x38')]?_0x1b67e6[_0xe0a5('0x36')]:_0x572f0f['model'];if(!_0x5c0dbf['query'][_0xe0a5('0x39')]('nolimit')){_0x1b67e6[_0xe0a5('0x1e')]=qs['limit'](_0x5c0dbf['query'][_0xe0a5('0x1e')]);_0x1b67e6[_0xe0a5('0x1d')]=qs[_0xe0a5('0x1d')](_0x5c0dbf[_0xe0a5('0x34')][_0xe0a5('0x1d')]);}_0x1b67e6['order']=qs[_0xe0a5('0x3a')](_0x5c0dbf[_0xe0a5('0x34')][_0xe0a5('0x3a')]);_0x1b67e6[_0xe0a5('0x3b')]=qs['filters'](_[_0xe0a5('0x3c')](_0x5c0dbf[_0xe0a5('0x34')],_0x572f0f['filters']),_0x1f9e08);if(_0x5c0dbf[_0xe0a5('0x34')][_0xe0a5('0x3d')]){_0x1b67e6[_0xe0a5('0x3b')]=_[_0xe0a5('0x3e')](_0x1b67e6[_0xe0a5('0x3b')],{'$or':_[_0xe0a5('0x30')](_0x1f9e08,function(_0xb68304){if(_0xb68304[_0xe0a5('0x32')]!=='VIRTUAL'){var _0x18bcde={};_0x18bcde[_0xb68304[_0xe0a5('0x2e')]]={'$like':'%'+_0x5c0dbf[_0xe0a5('0x34')]['filter']+'%'};return _0x18bcde;}})});}_0x1b67e6=_[_0xe0a5('0x3e')]({},_0x1b67e6,_0x5c0dbf['options']);var _0x4e774e={'where':_0x1b67e6[_0xe0a5('0x3b')]};return db[_0xe0a5('0x3f')][_0xe0a5('0x20')](_0x4e774e)[_0xe0a5('0x26')](function(_0x3693aa){_0x58cbc1[_0xe0a5('0x20')]=_0x3693aa;if(_0x5c0dbf[_0xe0a5('0x34')][_0xe0a5('0x40')]){_0x1b67e6[_0xe0a5('0x41')]=[{'all':!![]}];}return db[_0xe0a5('0x3f')][_0xe0a5('0x42')](_0x1b67e6);})[_0xe0a5('0x26')](function(_0x207905){_0x58cbc1[_0xe0a5('0x43')]=_0x207905;return _0x58cbc1;})['then'](respondWithFilteredResult(_0x33129a,_0x1b67e6))[_0xe0a5('0x44')](handleError(_0x33129a,null));};exports[_0xe0a5('0x45')]=function(_0x282e06,_0x3d40ed){var _0x33d11a={'raw':![],'where':{'id':_0x282e06['params']['id']}},_0x76a973={};_0x76a973['model']=_[_0xe0a5('0x46')](db[_0xe0a5('0x3f')]['rawAttributes']);_0x76a973['query']=_[_0xe0a5('0x46')](_0x282e06[_0xe0a5('0x34')]);_0x76a973[_0xe0a5('0x47')]=_[_0xe0a5('0x37')](_0x76a973[_0xe0a5('0x35')],_0x76a973[_0xe0a5('0x34')]);_0x33d11a[_0xe0a5('0x36')]=_[_0xe0a5('0x37')](_0x76a973['model'],qs['fields'](_0x282e06[_0xe0a5('0x34')][_0xe0a5('0x48')]));_0x33d11a[_0xe0a5('0x36')]=_0x33d11a[_0xe0a5('0x36')]['length']?_0x33d11a[_0xe0a5('0x36')]:_0x76a973[_0xe0a5('0x35')];if(_0x282e06[_0xe0a5('0x34')]['includeAll']){_0x33d11a[_0xe0a5('0x41')]=[{'all':!![]}];}_0x33d11a=_[_0xe0a5('0x3e')]({},_0x33d11a,_0x282e06[_0xe0a5('0x49')]);return db[_0xe0a5('0x3f')][_0xe0a5('0x4a')](_0x33d11a)[_0xe0a5('0x26')](handleEntityNotFound(_0x3d40ed,null))['then'](respondWithResult(_0x3d40ed,null))[_0xe0a5('0x44')](handleError(_0x3d40ed,null));};exports[_0xe0a5('0x4b')]=function(_0x4f9877,_0x197ce9){return db[_0xe0a5('0x3f')][_0xe0a5('0x4b')](_0x4f9877['body'],{})[_0xe0a5('0x26')](function(_0x4ed0ed){var _0x39f007=_0x4f9877['user']['get']({'plain':!![]});if(!_0x39f007)throw new Error(_0xe0a5('0x4c'));if(_0x39f007['role']===_0xe0a5('0x4d')){var _0x3ab5bd=_0x4ed0ed[_0xe0a5('0x28')]({'plain':!![]});var _0x51c0d3='Lists';return db['UserProfileSection'][_0xe0a5('0x4a')]({'where':{'name':_0x51c0d3,'userProfileId':_0x39f007[_0xe0a5('0x4e')]},'raw':!![]})[_0xe0a5('0x26')](function(_0x7ceda7){if(_0x7ceda7&&_0x7ceda7[_0xe0a5('0x4f')]===0x0){return db[_0xe0a5('0x2a')][_0xe0a5('0x4b')]({'name':_0x3ab5bd[_0xe0a5('0x2e')],'resourceId':_0x3ab5bd['id'],'type':_0x7ceda7[_0xe0a5('0x2e')],'sectionId':_0x7ceda7['id']},{})['then'](function(){return _0x4ed0ed;});}else{return _0x4ed0ed;}})[_0xe0a5('0x44')](function(_0x2b58b6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b58b6);throw _0x2b58b6;});}return _0x4ed0ed;})[_0xe0a5('0x26')](respondWithResult(_0x197ce9,0xc9))['catch'](handleError(_0x197ce9,null));};exports[_0xe0a5('0x25')]=function(_0x10e488,_0x1c04bc){if(_0x10e488[_0xe0a5('0x50')]['id']){delete _0x10e488['body']['id'];}return db[_0xe0a5('0x3f')]['find']({'where':{'id':_0x10e488[_0xe0a5('0x51')]['id']}})[_0xe0a5('0x26')](handleEntityNotFound(_0x1c04bc,null))['then'](saveUpdates(_0x10e488[_0xe0a5('0x50')],null))[_0xe0a5('0x26')](respondWithResult(_0x1c04bc,null))[_0xe0a5('0x44')](handleError(_0x1c04bc,null));};exports['destroy']=function(_0x3a27cd,_0x4852aa){return db[_0xe0a5('0x3f')][_0xe0a5('0x4a')]({'where':{'id':_0x3a27cd[_0xe0a5('0x51')]['id']}})[_0xe0a5('0x26')](handleEntityNotFound(_0x4852aa,null))[_0xe0a5('0x26')](removeEntity(_0x4852aa,null))[_0xe0a5('0x44')](handleError(_0x4852aa,null));};exports[_0xe0a5('0x52')]=function(_0x298b43,_0x3d6d85){return db[_0xe0a5('0x3f')][_0xe0a5('0x52')]()[_0xe0a5('0x26')](respondWithResult(_0x3d6d85,null))[_0xe0a5('0x44')](handleError(_0x3d6d85,null));};exports[_0xe0a5('0x53')]=function(_0x5c39c3,_0x4c8277,_0x4b5f79){if(_0x5c39c3[_0xe0a5('0x50')]['id']){delete _0x5c39c3[_0xe0a5('0x50')]['id'];}return db['CmList'][_0xe0a5('0x4a')]({'where':{'id':_0x5c39c3[_0xe0a5('0x51')]['id']}})[_0xe0a5('0x26')](handleEntityNotFound(_0x4c8277,null))[_0xe0a5('0x26')](function(_0x1f3bab){if(_0x1f3bab){_0x5c39c3[_0xe0a5('0x50')][_0xe0a5('0x54')]=_0x1f3bab['id'];return db[_0xe0a5('0x55')][_0xe0a5('0x4b')](_0x5c39c3[_0xe0a5('0x50')]);}})[_0xe0a5('0x26')](respondWithResult(_0x4c8277,null))[_0xe0a5('0x44')](handleError(_0x4c8277,null));};exports[_0xe0a5('0x56')]=function(_0x2ab0bb,_0x24a358,_0x129b41){var _0x2d8d17={'raw':![],'where':{}};var _0x2dc578={};var _0x5322ee={'count':0x0,'rows':[]};return db[_0xe0a5('0x3f')]['findOne']({'where':{'id':_0x2ab0bb[_0xe0a5('0x51')]['id']}})[_0xe0a5('0x26')](handleEntityNotFound(_0x24a358,null))[_0xe0a5('0x26')](function(_0x43e6ba){if(_0x43e6ba){_0x2dc578[_0xe0a5('0x35')]=_[_0xe0a5('0x46')](db[_0xe0a5('0x55')]['rawAttributes']);_0x2dc578['query']=_[_0xe0a5('0x46')](_0x2ab0bb['query']);_0x2dc578[_0xe0a5('0x47')]=_[_0xe0a5('0x37')](_0x2dc578[_0xe0a5('0x35')],_0x2dc578['query']);_0x2d8d17[_0xe0a5('0x36')]=_[_0xe0a5('0x37')](_0x2dc578['model'],qs[_0xe0a5('0x48')](_0x2ab0bb['query'][_0xe0a5('0x48')]));_0x2d8d17[_0xe0a5('0x36')]=_0x2d8d17[_0xe0a5('0x36')][_0xe0a5('0x38')]?_0x2d8d17[_0xe0a5('0x36')]:_0x2dc578[_0xe0a5('0x35')];if(!_0x2ab0bb['query']['hasOwnProperty'](_0xe0a5('0x57'))){_0x2d8d17[_0xe0a5('0x1e')]=qs[_0xe0a5('0x1e')](_0x2ab0bb[_0xe0a5('0x34')][_0xe0a5('0x1e')]);_0x2d8d17[_0xe0a5('0x1d')]=qs[_0xe0a5('0x1d')](_0x2ab0bb[_0xe0a5('0x34')][_0xe0a5('0x1d')]);}_0x2d8d17['order']=qs[_0xe0a5('0x3a')](_0x2ab0bb['query'][_0xe0a5('0x3a')]);_0x2d8d17[_0xe0a5('0x3b')]=qs[_0xe0a5('0x47')](_['pick'](_0x2ab0bb[_0xe0a5('0x34')],_0x2dc578[_0xe0a5('0x47')]));_0x2d8d17['where'][_0xe0a5('0x54')]=_0x43e6ba['id'];if(_0x2ab0bb[_0xe0a5('0x34')]['filter']){_0x2d8d17[_0xe0a5('0x3b')]=_[_0xe0a5('0x3e')](_0x2d8d17['where'],{'$or':_[_0xe0a5('0x30')](_0x2d8d17[_0xe0a5('0x36')],function(_0x5f2daa){var _0x147ff8={};_0x147ff8[_0x5f2daa]={'$like':'%'+_0x2ab0bb['query']['filter']+'%'};return _0x147ff8;})});}_0x2d8d17=_[_0xe0a5('0x3e')]({},_0x2d8d17,_0x2ab0bb['options']);return db[_0xe0a5('0x55')][_0xe0a5('0x20')]({'where':_0x2d8d17['where']})[_0xe0a5('0x26')](function(_0x5275dd){_0x5322ee[_0xe0a5('0x20')]=_0x5275dd;if(_0x2ab0bb[_0xe0a5('0x34')][_0xe0a5('0x40')]){_0x2d8d17[_0xe0a5('0x41')]=[{'all':!![]}];}return db[_0xe0a5('0x55')][_0xe0a5('0x42')](_0x2d8d17);})[_0xe0a5('0x26')](function(_0x24eace){_0x5322ee[_0xe0a5('0x43')]=_0x24eace;return _0x5322ee;});}})[_0xe0a5('0x26')](respondWithFilteredResult(_0x24a358,_0x2d8d17))['catch'](handleError(_0x24a358,null));};exports[_0xe0a5('0x58')]=function(_0x253920,_0x2603bf,_0x9121df){return db[_0xe0a5('0x3f')][_0xe0a5('0x4a')]({'where':{'id':_0x253920[_0xe0a5('0x51')]['id']}})[_0xe0a5('0x26')](handleEntityNotFound(_0x2603bf,null))[_0xe0a5('0x26')](function(_0x4af037){if(_0x4af037){return _0x4af037[_0xe0a5('0x58')](_0x253920[_0xe0a5('0x34')][_0xe0a5('0x59')]);}})[_0xe0a5('0x26')](respondWithStatusCode(_0x2603bf,null))['catch'](handleError(_0x2603bf,null));};exports[_0xe0a5('0x5a')]=function(_0x12704b,_0x36ba3d,_0x21c720){return db[_0xe0a5('0x3f')]['find']({'where':{'id':_0x12704b[_0xe0a5('0x51')]['id']}})[_0xe0a5('0x26')](handleEntityNotFound(_0x36ba3d,null))[_0xe0a5('0x26')](function(_0x201b0c){if(_0x201b0c){var _0x245206=[];var _0x366a6f={'success':[],'errors':[]};return db['CmContact']['describe']()[_0xe0a5('0x26')](function(_0x55c5db){if(_0x12704b[_0xe0a5('0x50')][_0xe0a5('0x5b')]&&_[_0xe0a5('0x5c')](_0x12704b[_0xe0a5('0x50')]['tags'])){if(_0x12704b['body']['tags'][_0xe0a5('0x38')]){_0x12704b[_0xe0a5('0x50')][_0xe0a5('0x5b')]=_0x12704b[_0xe0a5('0x50')][_0xe0a5('0x5b')]['join'](';')+';';}else{_0x12704b[_0xe0a5('0x50')][_0xe0a5('0x5b')]=null;}}else{_0x12704b[_0xe0a5('0x50')][_0xe0a5('0x5b')]=null;}if(_0x12704b['body']&&_['isArray'](_0x12704b['body'])){for(var _0x38d890=0x0;_0x38d890<_0x12704b[_0xe0a5('0x50')][_0xe0a5('0x38')];_0x38d890+=0x1){_0x12704b[_0xe0a5('0x50')][_0x38d890]['ListId']=_0x12704b[_0xe0a5('0x51')]['id'];_0x245206['push'](_0x12704b[_0xe0a5('0x50')][_0x38d890]);}return BPromise[_0xe0a5('0x5d')](_0x245206,function(_0x56350f){return db[_0xe0a5('0x5e')][_0xe0a5('0x4b')](_[_0xe0a5('0x5f')](_0x56350f,[_0xe0a5('0x59'),'id'])||{},{'fields':_['keys'](_0x55c5db),'raw':!![]})[_0xe0a5('0x26')](function(_0x58bdf6){_0x366a6f[_0xe0a5('0x60')][_0xe0a5('0x61')](_0x58bdf6[_0xe0a5('0x62')]);})[_0xe0a5('0x44')](function(_0x374d82){_0x366a6f[_0xe0a5('0x63')][_0xe0a5('0x61')]({'data':_0x56350f,'error':_0x374d82[_0xe0a5('0x64')]});});})[_0xe0a5('0x26')](function(_0x1d8f1a){return _0x366a6f;})[_0xe0a5('0x44')](function(_0x1a412b){return _0x1a412b;});}else{_0x36ba3d[_0xe0a5('0x1b')](0x190)[_0xe0a5('0x1c')]({'message':_0xe0a5('0x65')});}});}})[_0xe0a5('0x26')](respondWithResult(_0x36ba3d,null))[_0xe0a5('0x44')](handleError(_0x36ba3d,null));};exports[_0xe0a5('0x66')]=function(_0x1cc694,_0x5bb0a8,_0x4f574c){var _0xcb144a;return db[_0xe0a5('0x3f')]['find']({'where':{'id':_0x1cc694[_0xe0a5('0x51')]['id']},'include':[{'model':db[_0xe0a5('0x67')],'as':'CustomFields'}]})[_0xe0a5('0x26')](handleEntityNotFound(_0x5bb0a8,null))[_0xe0a5('0x26')](function(_0x32b1df){if(_0x32b1df){_0xcb144a=_0x32b1df;return db['CmContact'][_0xe0a5('0x68')];}})['then'](function(_0x1b10d4){if(_0x1b10d4){var _0x115c3c={};var _0x416180={};_0x416180['model']=_[_0xe0a5('0x69')](_[_0xe0a5('0x46')](_0x1b10d4),_['map'](_0xcb144a[_0xe0a5('0x6a')],function(_0x54a77f){return util[_0xe0a5('0x6b')](_0xe0a5('0x6c'),_0x54a77f['id']);}));_0x416180[_0xe0a5('0x34')]=_[_0xe0a5('0x46')](_0x1cc694[_0xe0a5('0x34')]);_0x416180[_0xe0a5('0x47')]=_[_0xe0a5('0x37')](_0x416180['model'],_0x416180[_0xe0a5('0x34')]);_0x115c3c[_0xe0a5('0x36')]=_[_0xe0a5('0x37')](_0x416180[_0xe0a5('0x35')],qs[_0xe0a5('0x48')](_0x1cc694[_0xe0a5('0x34')][_0xe0a5('0x48')]));_0x115c3c[_0xe0a5('0x36')]=_0x115c3c[_0xe0a5('0x36')][_0xe0a5('0x38')]?_0x115c3c['attributes']:_0x416180[_0xe0a5('0x35')];if(!_0x1cc694[_0xe0a5('0x34')][_0xe0a5('0x39')](_0xe0a5('0x57'))){_0x115c3c['limit']=qs[_0xe0a5('0x1e')](_0x1cc694['query'][_0xe0a5('0x1e')]);_0x115c3c['offset']=qs[_0xe0a5('0x1d')](_0x1cc694[_0xe0a5('0x34')][_0xe0a5('0x1d')]);}_0x115c3c['order']=qs[_0xe0a5('0x3a')](_0x1cc694[_0xe0a5('0x34')][_0xe0a5('0x3a')]);_0x115c3c[_0xe0a5('0x3b')]=qs['filters'](_[_0xe0a5('0x3c')](_0x1cc694['query'],_0x416180[_0xe0a5('0x47')]));_0x115c3c[_0xe0a5('0x6d')]=!![];if(_0x1cc694[_0xe0a5('0x34')]['filter']){_0x115c3c[_0xe0a5('0x3b')]=_['merge'](_0x115c3c[_0xe0a5('0x3b')],{'$or':_[_0xe0a5('0x30')](_0x115c3c['attributes'],function(_0x21f005){var _0xd38bd5={};_0xd38bd5[_0x21f005]={'$like':'%'+_0x1cc694[_0xe0a5('0x34')]['filter']+'%'};return _0xd38bd5;})});}_0x115c3c=_[_0xe0a5('0x3e')]({},_0x115c3c,_0x1cc694[_0xe0a5('0x49')]);return _0xcb144a['getContacts'](_0x115c3c);}})[_0xe0a5('0x26')](respondWithResult(_0x5bb0a8,null))[_0xe0a5('0x44')](handleError(_0x5bb0a8,null));};exports['getContactsCsv']=function(_0x55725c,_0x5c9edc,_0x5e98e7){var _0x1c7028;var _0x3f53e7;var _0x44cca0;var _0x3b35f0=_0x55725c[_0xe0a5('0x51')]['id'];csv_results=[];return db[_0xe0a5('0x6e')][_0xe0a5('0x42')]({'attributes':['id',_0xe0a5('0x2e')],'raw':!![],'order':[_0xe0a5('0x6f')]})[_0xe0a5('0x26')](function(_0x3a4c0e){_0x1c7028=_0x3a4c0e;var _0x22d810=_['keys'](db[_0xe0a5('0x5e')][_0xe0a5('0x68')]);return db[_0xe0a5('0x67')][_0xe0a5('0x42')]({'raw':!![],'attributes':['id','alias']})['then'](function(_0x1a15a8){_0x3f53e7=_0x1a15a8;var _0x4e3226=squel[_0xe0a5('0x70')]()[_0xe0a5('0x48')](_0x22d810)['from'](_0xe0a5('0x71'),'c')[_0xe0a5('0x3b')](_0xe0a5('0x72'),_0x3b35f0)[_0xe0a5('0x3b')](_0xe0a5('0x73'))['distinct']();for(var _0x299776=0x0;_0x299776<_0x3f53e7[_0xe0a5('0x38')];_0x299776++){_0x4e3226[_0xe0a5('0x74')](_0xe0a5('0x75')+_0x3f53e7[_0x299776]['id'],_0xe0a5('0x76')+_0x3f53e7[_0x299776][_0xe0a5('0x77')]);}for(var _0x299776=0x0;_0x299776<_0x1c7028['length'];_0x299776++){_0x4e3226['field'](squel[_0xe0a5('0x70')]()['field']('item')[_0xe0a5('0x78')](_0xe0a5('0x79'))[_0xe0a5('0x3b')](_0xe0a5('0x7a'),_0x1c7028[_0x299776]['id'])[_0xe0a5('0x3b')]('CmContactId\x20=\x20c.id'),_0xe0a5('0x7b')+_0x1c7028[_0x299776][_0xe0a5('0x2e')]);_0x4e3226[_0xe0a5('0x74')](squel[_0xe0a5('0x70')]()[_0xe0a5('0x74')](_0xe0a5('0x7c'))[_0xe0a5('0x78')](_0xe0a5('0x79'))[_0xe0a5('0x3b')](_0xe0a5('0x7a'),_0x1c7028[_0x299776]['id'])['where'](_0xe0a5('0x7d')),'description_additionalPhone_'+_0x1c7028[_0x299776]['name']);}var _0x2fc0e1=[];_0x2fc0e1[_0xe0a5('0x61')](_0x4e3226['toString']());BPromise[_0xe0a5('0x5d')](_0x2fc0e1,handleQuery)[_0xe0a5('0x26')](function(_0x12586e){handleQuery(_0x4e3226[_0xe0a5('0x7e')]());var _0x11890e=csv_results[0x0];if(!_[_0xe0a5('0x7f')](_0x11890e)){var _0x5ca835=toCsv(_0x11890e);var _0x3a9db7=Date['now']();fs[_0xe0a5('0x80')](util['format']('/tmp/list_%d_%s.csv',_0x3b35f0,_0x3a9db7),_0x5ca835);_0x5c9edc[_0xe0a5('0x81')]('Content-disposition',_0xe0a5('0x82')+util['format'](_0xe0a5('0x83'),_0x3b35f0,_0x3a9db7));_0x5c9edc[_0xe0a5('0x81')](_0xe0a5('0x84'),'text/csv');return _0x5c9edc[_0xe0a5('0x85')](util[_0xe0a5('0x6b')]('/tmp/list_%d_%s.csv',_0x3b35f0,_0x3a9db7));}else{return _0x5c9edc[_0xe0a5('0x2b')](0xcc);}});});});};exports['addCustomField']=function(_0x5755b4,_0x53e931,_0x3c5bf2){var _0x5d9744;delete _0x5755b4['body']['id'];return db[_0xe0a5('0x3f')][_0xe0a5('0x86')]({'where':{'id':_0x5755b4['params']['id']}})['then'](handleEntityNotFound(_0x53e931,null))[_0xe0a5('0x26')](function(_0x54209e){if(_0x54209e){return db[_0xe0a5('0x87')][_0xe0a5('0x88')](function(_0x12818e){return db['CmCustomField']['create'](_0x5755b4[_0xe0a5('0x50')],{'transaction':_0x12818e})[_0xe0a5('0x26')](function(_0x52ec7c){_0x5d9744=_0x52ec7c;return _0x54209e[_0xe0a5('0x89')](_0x52ec7c,{'transaction':_0x12818e});})[_0xe0a5('0x26')](function(){var _0x9f389c={'type':db[_0xe0a5('0x8a')]['TEXT'],'transaction':_0x12818e};switch(_0x5755b4[_0xe0a5('0x50')]['type']){case _0xe0a5('0x8b'):_0x9f389c[_0xe0a5('0x32')]=db[_0xe0a5('0x8a')][_0xe0a5('0x8c')];break;case _0xe0a5('0x8d'):_0x9f389c[_0xe0a5('0x32')]=db[_0xe0a5('0x8a')][_0xe0a5('0x8e')];break;case _0xe0a5('0x8f'):_0x9f389c[_0xe0a5('0x32')]=db[_0xe0a5('0x8a')][_0xe0a5('0x90')];_0x9f389c[_0xe0a5('0x91')]=![];break;default:}return db[_0xe0a5('0x87')]['queryInterface'][_0xe0a5('0x92')](_0xe0a5('0x71'),util['format']('cf_%s',_0x5d9744['id']),_0x9f389c);})['then'](function(){return _0x5d9744;});});}})[_0xe0a5('0x26')](respondWithResult(_0x53e931,null))['catch'](handleError(_0x53e931,null));};exports[_0xe0a5('0x93')]=function(_0x2bea2e,_0x58a599,_0x2701cf){var _0xf380a2={};var _0x747975={};var _0xd05ac2;var _0x3fa1ce;return db[_0xe0a5('0x3f')][_0xe0a5('0x86')]({'where':{'id':_0x2bea2e[_0xe0a5('0x51')]['id']}})['then'](handleEntityNotFound(_0x58a599,null))[_0xe0a5('0x26')](function(_0x33a68a){if(_0x33a68a){_0xd05ac2=_0x33a68a;_0x747975[_0xe0a5('0x35')]=_[_0xe0a5('0x46')](db[_0xe0a5('0x67')][_0xe0a5('0x68')]);_0x747975['query']=_[_0xe0a5('0x46')](_0x2bea2e['query']);_0x747975[_0xe0a5('0x47')]=_[_0xe0a5('0x37')](_0x747975['model'],_0x747975['query']);_0xf380a2['attributes']=_[_0xe0a5('0x37')](_0x747975['model'],qs[_0xe0a5('0x48')](_0x2bea2e[_0xe0a5('0x34')]['fields']));_0xf380a2[_0xe0a5('0x36')]=_0xf380a2['attributes'][_0xe0a5('0x38')]?_0xf380a2[_0xe0a5('0x36')]:_0x747975[_0xe0a5('0x35')];_0xf380a2[_0xe0a5('0x94')]=qs[_0xe0a5('0x3a')](_0x2bea2e[_0xe0a5('0x34')][_0xe0a5('0x3a')]);_0xf380a2[_0xe0a5('0x3b')]=qs[_0xe0a5('0x47')](_[_0xe0a5('0x3c')](_0x2bea2e[_0xe0a5('0x34')],_0x747975[_0xe0a5('0x47')]));_0xf380a2[_0xe0a5('0x3b')]=_[_0xe0a5('0x3e')](_0xf380a2[_0xe0a5('0x3b')],{'$or':[{'ListId':_0x33a68a['id']},{'ListId':null}]});if(_0x2bea2e[_0xe0a5('0x34')][_0xe0a5('0x3d')]){_0xf380a2[_0xe0a5('0x3b')]=_['merge'](_0xf380a2[_0xe0a5('0x3b')],{'$or':_[_0xe0a5('0x30')](_0xf380a2[_0xe0a5('0x36')],function(_0x111b8a){var _0x21a0e2={};_0x21a0e2[_0x111b8a]={'$like':'%'+_0x2bea2e[_0xe0a5('0x34')][_0xe0a5('0x3d')]+'%'};return _0x21a0e2;})});}_0xf380a2=_[_0xe0a5('0x3e')]({},_0xf380a2,_0x2bea2e['options']);return db['CmCustomField'][_0xe0a5('0x95')](_0xf380a2);}})[_0xe0a5('0x26')](respondWithResult(_0x58a599,null))[_0xe0a5('0x44')](handleError(_0x58a599,null));};exports[_0xe0a5('0x96')]=function(_0x2a3697,_0x4d9883){return db[_0xe0a5('0x67')][_0xe0a5('0x95')]({'where':{'ListId':null}})[_0xe0a5('0x26')](handleEntityNotFound(_0x4d9883,null))[_0xe0a5('0x26')](function(_0x62e3b4){return _0x62e3b4;})[_0xe0a5('0x26')](respondWithResult(_0x4d9883,null))['catch'](handleError(_0x4d9883,null));};exports[_0xe0a5('0x97')]=function(_0x21563e,_0x416021,_0x4cf093){return db[_0xe0a5('0x3f')][_0xe0a5('0x4a')]({'where':{'id':_0x21563e[_0xe0a5('0x51')]['id']}})['then'](handleEntityNotFound(_0x416021,null))[_0xe0a5('0x26')](function(_0xe9e20b){if(_0xe9e20b){return _0xe9e20b[_0xe0a5('0x97')](_0x21563e['body'][_0xe0a5('0x59')],_[_0xe0a5('0x5f')](_0x21563e[_0xe0a5('0x50')],['ids','id'])||{})[_0xe0a5('0x98')](function(_0x50d2ce){for(var _0x36d73c=0x0;_0x36d73c<_0x21563e[_0xe0a5('0x50')][_0xe0a5('0x59')][_0xe0a5('0x38')];_0x36d73c+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x21563e[_0xe0a5('0x50')][_0xe0a5('0x59')][_0x36d73c]),'CmListId':Number(_0x21563e[_0xe0a5('0x51')]['id'])});}return _0x50d2ce;});}})[_0xe0a5('0x26')](respondWithResult(_0x416021,null))[_0xe0a5('0x44')](handleError(_0x416021,null));};exports['removeAgents']=function(_0xa6b453,_0x3fb3dc,_0x101421){return db[_0xe0a5('0x3f')]['find']({'where':{'id':_0xa6b453[_0xe0a5('0x51')]['id']}})[_0xe0a5('0x26')](handleEntityNotFound(_0x3fb3dc,null))[_0xe0a5('0x26')](function(_0x1938ce){if(_0x1938ce){return _0x1938ce[_0xe0a5('0x99')](_0xa6b453[_0xe0a5('0x34')][_0xe0a5('0x59')])[_0xe0a5('0x26')](function(){if(_[_0xe0a5('0x5c')](_0xa6b453[_0xe0a5('0x34')][_0xe0a5('0x59')])){for(var _0xf3bde7=0x0;_0xf3bde7<_0xa6b453['query'][_0xe0a5('0x59')][_0xe0a5('0x38')];_0xf3bde7+=0x1){socket[_0xe0a5('0x9a')](_0xe0a5('0x9b'),{'UserId':Number(_0xa6b453[_0xe0a5('0x34')][_0xe0a5('0x59')][_0xf3bde7]),'CmListId':Number(_0xa6b453[_0xe0a5('0x51')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0xa6b453[_0xe0a5('0x34')][_0xe0a5('0x59')]),'CmListId':Number(_0xa6b453[_0xe0a5('0x51')]['id'])});}});}})[_0xe0a5('0x26')](respondWithStatusCode(_0x3fb3dc,null))[_0xe0a5('0x44')](handleError(_0x3fb3dc,null));};exports[_0xe0a5('0x9c')]=function(_0x6ed777,_0x3722e8,_0x7ebbd7){var _0x18beba={};var _0x5a51cc={};var _0x2ec1f9;var _0x14d7e3;return db['CmList'][_0xe0a5('0x86')]({'where':{'id':_0x6ed777[_0xe0a5('0x51')]['id']}})[_0xe0a5('0x26')](handleEntityNotFound(_0x3722e8,null))[_0xe0a5('0x26')](function(_0x1e47d0){if(_0x1e47d0){_0x2ec1f9=_0x1e47d0;_0x5a51cc[_0xe0a5('0x35')]=_[_0xe0a5('0x46')](db[_0xe0a5('0x9d')][_0xe0a5('0x68')]);_0x5a51cc['query']=_['keys'](_0x6ed777['query']);_0x5a51cc[_0xe0a5('0x47')]=_[_0xe0a5('0x37')](_0x5a51cc[_0xe0a5('0x35')],_0x5a51cc[_0xe0a5('0x34')]);_0x18beba[_0xe0a5('0x36')]=_[_0xe0a5('0x37')](_0x5a51cc[_0xe0a5('0x35')],qs[_0xe0a5('0x48')](_0x6ed777[_0xe0a5('0x34')][_0xe0a5('0x48')]));_0x18beba[_0xe0a5('0x36')]=_0x18beba[_0xe0a5('0x36')][_0xe0a5('0x38')]?_0x18beba[_0xe0a5('0x36')]:_0x5a51cc[_0xe0a5('0x35')];_0x18beba[_0xe0a5('0x94')]=qs[_0xe0a5('0x3a')](_0x6ed777[_0xe0a5('0x34')][_0xe0a5('0x3a')]);_0x18beba[_0xe0a5('0x3b')]=qs[_0xe0a5('0x47')](_['pick'](_0x6ed777['query'],_0x5a51cc[_0xe0a5('0x47')]));if(_0x6ed777[_0xe0a5('0x34')]['filter']){_0x18beba[_0xe0a5('0x3b')]=_[_0xe0a5('0x3e')](_0x18beba[_0xe0a5('0x3b')],{'$or':_[_0xe0a5('0x30')](_0x18beba[_0xe0a5('0x36')],function(_0xdc22c9){var _0xe6dfec={};_0xe6dfec[_0xdc22c9]={'$like':'%'+_0x6ed777[_0xe0a5('0x34')]['filter']+'%'};return _0xe6dfec;})});}_0x18beba=_[_0xe0a5('0x3e')]({},_0x18beba,_0x6ed777[_0xe0a5('0x49')]);return _0x2ec1f9[_0xe0a5('0x9c')](_0x18beba);}})[_0xe0a5('0x26')](function(_0x21d810){if(_0x21d810){_0x14d7e3=_0x21d810[_0xe0a5('0x38')];if(!_0x6ed777[_0xe0a5('0x34')][_0xe0a5('0x39')](_0xe0a5('0x57'))){_0x18beba[_0xe0a5('0x1e')]=qs['limit'](_0x6ed777[_0xe0a5('0x34')]['limit']);_0x18beba['offset']=qs[_0xe0a5('0x1d')](_0x6ed777['query']['offset']);}return _0x2ec1f9[_0xe0a5('0x9c')](_0x18beba);}})[_0xe0a5('0x26')](function(_0x3d038a){if(_0x3d038a){return _0x3d038a?{'count':_0x14d7e3,'rows':_0x3d038a}:null;}})[_0xe0a5('0x26')](respondWithResult(_0x3722e8,null))[_0xe0a5('0x44')](handleError(_0x3722e8,null));};function handleQuery(_0x328fa6){logger[_0xe0a5('0x9e')](_0x328fa6);return db[_0xe0a5('0x87')][_0xe0a5('0x34')](_0x328fa6)[_0xe0a5('0x98')](function(_0x29cf22){csv_results['push'](_0x29cf22);})[_0xe0a5('0x44')](function(_0xf1fd26){logger[_0xe0a5('0x2c')](_0xf1fd26[_0xe0a5('0x64')]);});}
\ No newline at end of file
index 41dc5aa..4438cb9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x5a6a2b,_0xd10440){_0x5a6a2b=_0x5a6a2b-0x0;var _0x5aec16=_0x3e74[_0x5a6a2b];return _0x5aec16;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents;
\ No newline at end of file
+var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x55ca,0x126));var _0xa55c=function(_0x30d371,_0x198ed4){_0x30d371=_0x30d371-0x0;var _0x5cc451=_0x55ca[_0x30d371];return _0x5cc451;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents;
\ No newline at end of file
index 54de07c..1452e96 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','CmList','util'];(function(_0x13ab85,_0x278a12){var _0x5e6aca=function(_0x58d0c5){while(--_0x58d0c5){_0x13ab85['push'](_0x13ab85['shift']());}};_0x5e6aca(++_0x278a12);}(_0xedd9,0xfc));var _0x9edd=function(_0x371223,_0x536f4b){_0x371223=_0x371223-0x0;var _0x1c3557=_0xedd9[_0x371223];return _0x1c3557;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x878f=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x878f,0x173));var _0xf878=function(_0x1092f2,_0xd88f1b){_0x1092f2=_0x1092f2-0x0;var _0x469344=_0x878f[_0x1092f2];return _0x469344;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var moment=require(_0xf878('0x3'));var BPromise=require(_0xf878('0x4'));var rp=require(_0xf878('0x5'));var fs=require('fs');var path=require(_0xf878('0x6'));var rimraf=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var attributes=require(_0xf878('0x9'));module[_0xf878('0xa')]=function(_0x4bc9aa,_0x4ac8d8){return _0x4bc9aa[_0xf878('0xb')](_0xf878('0xc'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2bc210a..a5bef46 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x52c6=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','then','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5421a4,_0x362d8b){var _0x16b546=function(_0x2aa318){while(--_0x2aa318){_0x5421a4['push'](_0x5421a4['shift']());}};_0x16b546(++_0x362d8b);}(_0x52c6,0x1e6));var _0x652c=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x52c6[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x652c('0x0'));var util=require(_0x652c('0x1'));var moment=require(_0x652c('0x2'));var BPromise=require('bluebird');var rs=require(_0x652c('0x3'));var fs=require('fs');var Redis=require(_0x652c('0x4'));var db=require(_0x652c('0x5'))['db'];var utils=require(_0x652c('0x6'));var logger=require(_0x652c('0x7'))(_0x652c('0x8'));var config=require(_0x652c('0x9'));var jayson=require(_0x652c('0xa'));var client=jayson['client'][_0x652c('0xb')]({'port':0x232a});config[_0x652c('0xc')]=_[_0x652c('0xd')](config[_0x652c('0xc')],{'host':_0x652c('0xe'),'port':0x18eb});var socket=require(_0x652c('0xf'))(new Redis(config[_0x652c('0xc')]));require(_0x652c('0x10'))['register'](socket);function respondWithRpcPromise(_0xe4a24a,_0x1af7e1,_0x54f75b){return new BPromise(function(_0x90e653,_0x14358c){return client['request'](_0xe4a24a,_0x54f75b)[_0x652c('0x11')](function(_0x43a625){logger['info']('CmList,\x20%s,\x20%s',_0x1af7e1,_0x652c('0x12'));logger[_0x652c('0x13')](_0x652c('0x14'),_0x1af7e1,_0x652c('0x12'),JSON[_0x652c('0x15')](_0x43a625));if(_0x43a625[_0x652c('0x16')]){if(_0x43a625['error'][_0x652c('0x17')]===0x1f4){logger['error'](_0x652c('0x18'),_0x1af7e1,_0x43a625[_0x652c('0x16')][_0x652c('0x19')]);return _0x14358c(_0x43a625[_0x652c('0x16')][_0x652c('0x19')]);}logger['error']('CmList,\x20%s,\x20%s',_0x1af7e1,_0x43a625[_0x652c('0x16')][_0x652c('0x19')]);return _0x90e653(_0x43a625[_0x652c('0x16')][_0x652c('0x19')]);}else{logger[_0x652c('0x1a')](_0x652c('0x18'),_0x1af7e1,_0x652c('0x12'));_0x90e653(_0x43a625[_0x652c('0x1b')]['message']);}})[_0x652c('0x1c')](function(_0x1ef1a3){logger[_0x652c('0x16')]('CmList,\x20%s,\x20%s',_0x1af7e1,_0x1ef1a3);_0x14358c(_0x1ef1a3);});});}
\ No newline at end of file
+var _0x6367=['client','http','redis','defaults','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment'];(function(_0x3d1604,_0x29edac){var _0x529d96=function(_0x3a0ffa){while(--_0x3a0ffa){_0x3d1604['push'](_0x3d1604['shift']());}};_0x529d96(++_0x29edac);}(_0x6367,0x1a2));var _0x7636=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0x6367[_0x4c73ac];return _0x9839ee;};'use strict';var _=require(_0x7636('0x0'));var util=require(_0x7636('0x1'));var moment=require('moment');var BPromise=require(_0x7636('0x2'));var rs=require(_0x7636('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7636('0x4'));var logger=require('../../config/logger')(_0x7636('0x5'));var config=require(_0x7636('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7636('0x7')][_0x7636('0x8')]({'port':0x232a});config[_0x7636('0x9')]=_[_0x7636('0xa')](config[_0x7636('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7636('0xb'))(new Redis(config[_0x7636('0x9')]));require('./cmList.socket')[_0x7636('0xc')](socket);function respondWithRpcPromise(_0x228d16,_0x29c801,_0xa1ee5b){return new BPromise(function(_0xc0eec2,_0x3b812f){return client[_0x7636('0xd')](_0x228d16,_0xa1ee5b)[_0x7636('0xe')](function(_0x52583b){logger[_0x7636('0xf')](_0x7636('0x10'),_0x29c801,_0x7636('0x11'));logger[_0x7636('0x12')](_0x7636('0x13'),_0x29c801,_0x7636('0x11'),JSON[_0x7636('0x14')](_0x52583b));if(_0x52583b[_0x7636('0x15')]){if(_0x52583b[_0x7636('0x15')][_0x7636('0x16')]===0x1f4){logger['error'](_0x7636('0x10'),_0x29c801,_0x52583b[_0x7636('0x15')]['message']);return _0x3b812f(_0x52583b[_0x7636('0x15')][_0x7636('0x17')]);}logger['error'](_0x7636('0x10'),_0x29c801,_0x52583b[_0x7636('0x15')][_0x7636('0x17')]);return _0xc0eec2(_0x52583b['error']['message']);}else{logger[_0x7636('0xf')]('CmList,\x20%s,\x20%s',_0x29c801,_0x7636('0x11'));_0xc0eec2(_0x52583b['result'][_0x7636('0x17')]);}})[_0x7636('0x18')](function(_0x2483a7){logger[_0x7636('0x15')](_0x7636('0x10'),_0x29c801,_0x2483a7);_0x3b812f(_0x2483a7);});});}
\ No newline at end of file
index cf9ab66..23ae4fb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f6e=['register','length','cmList:','remove','update','emit','removeListener'];(function(_0x13e342,_0x2e21ad){var _0x30a491=function(_0x507789){while(--_0x507789){_0x13e342['push'](_0x13e342['shift']());}};_0x30a491(++_0x2e21ad);}(_0x3f6e,0x11b));var _0xe3f6=function(_0x470e72,_0x532a0e){_0x470e72=_0x470e72-0x0;var _0x3386f9=_0x3f6e[_0x470e72];return _0x3386f9;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xe3f6('0x0'),_0xe3f6('0x1')];function createListener(_0x4f752e,_0x16b651){return function(_0x53fa9b){_0x16b651[_0xe3f6('0x2')](_0x4f752e,_0x53fa9b);};}function removeListener(_0x579570,_0xaca2d){return function(){CmListEvents[_0xe3f6('0x3')](_0x579570,_0xaca2d);};}exports[_0xe3f6('0x4')]=function(_0x380da4){for(var _0x3efa15=0x0,_0x20641e=events[_0xe3f6('0x5')];_0x3efa15<_0x20641e;_0x3efa15++){var _0x558efb=events[_0x3efa15];var _0x1d8e4a=createListener(_0xe3f6('0x6')+_0x558efb,_0x380da4);CmListEvents['on'](_0x558efb,_0x1d8e4a);}};
\ No newline at end of file
+var _0xf773=['length','./cmList.events','save','update','removeListener','register'];(function(_0x39b22d,_0x50e095){var _0x5c8f20=function(_0x1e2f36){while(--_0x1e2f36){_0x39b22d['push'](_0x39b22d['shift']());}};_0x5c8f20(++_0x50e095);}(_0xf773,0x6d));var _0x3f77=function(_0x418477,_0x341b07){_0x418477=_0x418477-0x0;var _0x1a3a15=_0xf773[_0x418477];return _0x1a3a15;};'use strict';var CmListEvents=require(_0x3f77('0x0'));var events=[_0x3f77('0x1'),'remove',_0x3f77('0x2')];function createListener(_0x1f88a5,_0x2dd1c0){return function(_0x153b3b){_0x2dd1c0['emit'](_0x1f88a5,_0x153b3b);};}function removeListener(_0x462bb3,_0x2e0e62){return function(){CmListEvents[_0x3f77('0x3')](_0x462bb3,_0x2e0e62);};}exports[_0x3f77('0x4')]=function(_0x11a897){for(var _0x423d7b=0x0,_0x5946dd=events[_0x3f77('0x5')];_0x423d7b<_0x5946dd;_0x423d7b++){var _0x1625ba=events[_0x423d7b];var _0x475a80=createListener('cmList:'+_0x1625ba,_0x11a897);CmListEvents['on'](_0x1625ba,_0x475a80);}};
\ No newline at end of file
index 89505c2..269df3c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa454=['express','../../components/auth/service','../../components/interaction/service','./cmList.controller','isAuthenticated','get','describe','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getCustomFields','/:id/users','post','create','addContacts','addAgents','put','update','delete','removeDispositions','exports','util','path','connect-timeout'];(function(_0x19d90a,_0x1cd5ce){var _0xc28ec8=function(_0xd02e92){while(--_0xd02e92){_0x19d90a['push'](_0x19d90a['shift']());}};_0xc28ec8(++_0x1cd5ce);}(_0xa454,0xc8));var _0x4a45=function(_0x5f518e,_0xa9787d){_0x5f518e=_0x5f518e-0x0;var _0x3e8ec3=_0xa454[_0x5f518e];return _0x3e8ec3;};'use strict';var multer=require('multer');var util=require(_0x4a45('0x0'));var path=require(_0x4a45('0x1'));var timeout=require(_0x4a45('0x2'));var express=require(_0x4a45('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4a45('0x4'));var interaction=require(_0x4a45('0x5'));var config=require('../../config/environment');var controller=require(_0x4a45('0x6'));router['get']('/',auth[_0x4a45('0x7')](),controller['index']);router[_0x4a45('0x8')]('/describe',auth[_0x4a45('0x7')](),controller[_0x4a45('0x9')]);router['get']('/global_fields',auth['isAuthenticated'](),controller[_0x4a45('0xa')]);router[_0x4a45('0x8')](_0x4a45('0xb'),auth[_0x4a45('0x7')](),controller[_0x4a45('0xc')]);router[_0x4a45('0x8')](_0x4a45('0xd'),auth[_0x4a45('0x7')](),controller[_0x4a45('0xe')]);router[_0x4a45('0x8')](_0x4a45('0xf'),auth[_0x4a45('0x7')](),controller[_0x4a45('0x10')]);router[_0x4a45('0x8')](_0x4a45('0x11'),auth[_0x4a45('0x7')](),controller['getContactsCsv']);router[_0x4a45('0x8')]('/:id/fields',auth[_0x4a45('0x7')](),controller[_0x4a45('0x12')]);router[_0x4a45('0x8')](_0x4a45('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x4a45('0x14')]('/',auth[_0x4a45('0x7')](),controller[_0x4a45('0x15')]);router[_0x4a45('0x14')](_0x4a45('0xd'),auth[_0x4a45('0x7')](),controller['addDisposition']);router['post'](_0x4a45('0xf'),auth[_0x4a45('0x7')](),controller[_0x4a45('0x16')]);router[_0x4a45('0x14')]('/:id/fields',auth[_0x4a45('0x7')](),controller['addCustomField']);router[_0x4a45('0x14')](_0x4a45('0x13'),auth[_0x4a45('0x7')](),controller[_0x4a45('0x17')]);router[_0x4a45('0x18')]('/:id',auth[_0x4a45('0x7')](),controller[_0x4a45('0x19')]);router[_0x4a45('0x1a')]('/:id',auth[_0x4a45('0x7')](),controller['destroy']);router[_0x4a45('0x1a')](_0x4a45('0xd'),auth[_0x4a45('0x7')](),controller[_0x4a45('0x1b')]);router[_0x4a45('0x1a')]('/:id/users',auth[_0x4a45('0x7')](),controller['removeAgents']);module[_0x4a45('0x1c')]=router;
\ No newline at end of file
+var _0xaf3f=['getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addContacts','addCustomField','addAgents','put','update','destroy','delete','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/contacts','getContacts','/:id/contacts/csv'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0xaf3f,0xa8));var _0xfaf3=function(_0x202546,_0x28e45d){_0x202546=_0x202546-0x0;var _0x1fd524=_0xaf3f[_0x202546];return _0x1fd524;};'use strict';var multer=require(_0xfaf3('0x0'));var util=require(_0xfaf3('0x1'));var path=require(_0xfaf3('0x2'));var timeout=require(_0xfaf3('0x3'));var express=require(_0xfaf3('0x4'));var router=express[_0xfaf3('0x5')]();var fs_extra=require(_0xfaf3('0x6'));var auth=require(_0xfaf3('0x7'));var interaction=require(_0xfaf3('0x8'));var config=require(_0xfaf3('0x9'));var controller=require('./cmList.controller');router[_0xfaf3('0xa')]('/',auth[_0xfaf3('0xb')](),controller[_0xfaf3('0xc')]);router[_0xfaf3('0xa')](_0xfaf3('0xd'),auth['isAuthenticated'](),controller[_0xfaf3('0xe')]);router[_0xfaf3('0xa')](_0xfaf3('0xf'),auth[_0xfaf3('0xb')](),controller[_0xfaf3('0x10')]);router['get'](_0xfaf3('0x11'),auth[_0xfaf3('0xb')](),controller[_0xfaf3('0x12')]);router[_0xfaf3('0xa')]('/:id/dispositions',auth[_0xfaf3('0xb')](),controller['getDispositions']);router[_0xfaf3('0xa')](_0xfaf3('0x13'),auth[_0xfaf3('0xb')](),controller[_0xfaf3('0x14')]);router['get'](_0xfaf3('0x15'),auth[_0xfaf3('0xb')](),controller[_0xfaf3('0x16')]);router[_0xfaf3('0xa')](_0xfaf3('0x17'),auth[_0xfaf3('0xb')](),controller[_0xfaf3('0x18')]);router[_0xfaf3('0xa')](_0xfaf3('0x19'),auth[_0xfaf3('0xb')](),controller[_0xfaf3('0x1a')]);router[_0xfaf3('0x1b')]('/',auth['isAuthenticated'](),controller[_0xfaf3('0x1c')]);router[_0xfaf3('0x1b')](_0xfaf3('0x1d'),auth[_0xfaf3('0xb')](),controller['addDisposition']);router[_0xfaf3('0x1b')](_0xfaf3('0x13'),auth['isAuthenticated'](),controller[_0xfaf3('0x1e')]);router[_0xfaf3('0x1b')]('/:id/fields',auth[_0xfaf3('0xb')](),controller[_0xfaf3('0x1f')]);router[_0xfaf3('0x1b')](_0xfaf3('0x19'),auth[_0xfaf3('0xb')](),controller[_0xfaf3('0x20')]);router[_0xfaf3('0x21')]('/:id',auth[_0xfaf3('0xb')](),controller[_0xfaf3('0x22')]);router['delete']('/:id',auth[_0xfaf3('0xb')](),controller[_0xfaf3('0x23')]);router[_0xfaf3('0x24')](_0xfaf3('0x1d'),auth[_0xfaf3('0xb')](),controller['removeDispositions']);router[_0xfaf3('0x24')](_0xfaf3('0x19'),auth[_0xfaf3('0xb')](),controller[_0xfaf3('0x25')]);module['exports']=router;
\ No newline at end of file
index 6258829..e222ed3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbab5=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x430a33,_0xfc9184){var _0x370338=function(_0x33e803){while(--_0x33e803){_0x430a33['push'](_0x430a33['shift']());}};_0x370338(++_0xfc9184);}(_0xbab5,0xf7));var _0x5bab=function(_0x1de16a,_0x5111ba){_0x1de16a=_0x1de16a-0x0;var _0x34cb5d=_0xbab5[_0x1de16a];return _0x34cb5d;};'use strict';var Sequelize=require(_0x5bab('0x0'));module[_0x5bab('0x1')]={'name':{'type':Sequelize[_0x5bab('0x2')],'get':function(_0x349caf){return this[_0x5bab('0x3')](_0x5bab('0x4'));}},'field':{'type':Sequelize[_0x5bab('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x5bab('0x5')],'allowNull':![]}};
\ No newline at end of file
+var _0x81bc=['exports','getDataValue','field','STRING'];(function(_0x4b93ec,_0x3c29bf){var _0x17d57d=function(_0x5ade5e){while(--_0x5ade5e){_0x4b93ec['push'](_0x4b93ec['shift']());}};_0x17d57d(++_0x3c29bf);}(_0x81bc,0x64));var _0xc81b=function(_0x181dfe,_0xf84557){_0x181dfe=_0x181dfe-0x0;var _0x40c38f=_0x81bc[_0x181dfe];return _0x40c38f;};'use strict';var Sequelize=require('sequelize');module[_0xc81b('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x30516c){return this[_0xc81b('0x1')](_0xc81b('0x2'));}},'field':{'type':Sequelize[_0xc81b('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xc81b('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xc81b('0x3')],'allowNull':![]}};
\ No newline at end of file
index a57393c..77c7192 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x15110d,_0x5c1324){var _0x41f145=function(_0x3e2210){while(--_0x3e2210){_0x15110d['push'](_0x15110d['shift']());}};_0x41f145(++_0x5c1324);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));};
\ No newline at end of file
+var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x302e70,_0xd1b07f){var _0x18eb94=function(_0x40b2c1){while(--_0x40b2c1){_0x302e70['push'](_0x302e70['shift']());}};_0x18eb94(++_0xd1b07f);}(_0x7a54,0x106));var _0x47a5=function(_0x259ca4,_0x5745fb){_0x259ca4=_0x259ca4-0x0;var _0x51d319=_0x7a54[_0x259ca4];return _0x51d319;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));};
\ No newline at end of file
index acb9a84..df08e29 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x07cf=['request-promise','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','bluebird'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x07cf,0x140));var _0xf07c=function(_0x210d7f,_0x2abe4f){_0x210d7f=_0x210d7f-0x0;var _0x42d687=_0x07cf[_0x210d7f];return _0x42d687;};'use strict';var _=require(_0xf07c('0x0'));var util=require(_0xf07c('0x1'));var logger=require(_0xf07c('0x2'))(_0xf07c('0x3'));var moment=require('moment');var BPromise=require(_0xf07c('0x4'));var rp=require(_0xf07c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf07c('0x6'));var config=require(_0xf07c('0x7'));var attributes=require(_0xf07c('0x8'));module[_0xf07c('0x9')]=function(_0x2162dd,_0x409f86){return _0x2162dd[_0xf07c('0xa')](_0xf07c('0xb'),attributes,{'tableName':_0xf07c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xbd70=['request-promise','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','lodash','util','../../config/logger'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0xbd70,0xc5));var _0x0bd7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd70[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0bd7('0x0'));var util=require(_0x0bd7('0x1'));var logger=require(_0x0bd7('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0bd7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bd7('0x4'));var config=require(_0x0bd7('0x5'));var attributes=require(_0x0bd7('0x6'));module[_0x0bd7('0x7')]=function(_0x524f70,_0x2ec53b){return _0x524f70[_0x0bd7('0x8')](_0x0bd7('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 1d5faab..4881651 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x489a=['../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','Condition,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3a1821,_0x3e6d85){var _0x57f0a1=function(_0x3a98d2){while(--_0x3a98d2){_0x3a1821['push'](_0x3a1821['shift']());}};_0x57f0a1(++_0x3e6d85);}(_0x489a,0xff));var _0xa489=function(_0x31cae7,_0x297087){_0x31cae7=_0x31cae7-0x0;var _0x3f8521=_0x489a[_0x31cae7];return _0x3f8521;};'use strict';var _=require(_0xa489('0x0'));var util=require(_0xa489('0x1'));var moment=require(_0xa489('0x2'));var BPromise=require(_0xa489('0x3'));var rs=require(_0xa489('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa489('0x5'));var logger=require('../../config/logger')(_0xa489('0x6'));var config=require(_0xa489('0x7'));var jayson=require(_0xa489('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e9f2a,_0xfa66f6,_0xed9907){return new BPromise(function(_0x13bca0,_0x4be57d){return client[_0xa489('0x9')](_0x2e9f2a,_0xed9907)[_0xa489('0xa')](function(_0x5ea737){logger[_0xa489('0xb')]('Condition,\x20%s,\x20%s',_0xfa66f6,_0xa489('0xc'));logger[_0xa489('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0xfa66f6,_0xa489('0xc'),JSON[_0xa489('0xe')](_0x5ea737));if(_0x5ea737[_0xa489('0xf')]){if(_0x5ea737[_0xa489('0xf')][_0xa489('0x10')]===0x1f4){logger[_0xa489('0xf')](_0xa489('0x11'),_0xfa66f6,_0x5ea737[_0xa489('0xf')][_0xa489('0x12')]);return _0x4be57d(_0x5ea737[_0xa489('0xf')][_0xa489('0x12')]);}logger[_0xa489('0xf')]('Condition,\x20%s,\x20%s',_0xfa66f6,_0x5ea737[_0xa489('0xf')][_0xa489('0x12')]);return _0x13bca0(_0x5ea737[_0xa489('0xf')][_0xa489('0x12')]);}else{logger[_0xa489('0xb')](_0xa489('0x11'),_0xfa66f6,'request\x20sent');_0x13bca0(_0x5ea737['result'][_0xa489('0x12')]);}})[_0xa489('0x13')](function(_0x5f0ba0){logger[_0xa489('0xf')](_0xa489('0x11'),_0xfa66f6,_0x5f0ba0);_0x4be57d(_0x5f0ba0);});});}
\ No newline at end of file
+var _0x20cd=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','error','code','Condition,\x20%s,\x20%s','message','result'];(function(_0xc1a914,_0x4a8775){var _0x52f635=function(_0x2d0601){while(--_0x2d0601){_0xc1a914['push'](_0xc1a914['shift']());}};_0x52f635(++_0x4a8775);}(_0x20cd,0xa1));var _0xd20c=function(_0xa0d2b3,_0x3ed4e7){_0xa0d2b3=_0xa0d2b3-0x0;var _0x2171eb=_0x20cd[_0xa0d2b3];return _0x2171eb;};'use strict';var _=require(_0xd20c('0x0'));var util=require(_0xd20c('0x1'));var moment=require(_0xd20c('0x2'));var BPromise=require(_0xd20c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd20c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd20c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd20c('0x6'));var client=jayson[_0xd20c('0x7')][_0xd20c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5461b3,_0x97ca65,_0x63f427){return new BPromise(function(_0x53eaeb,_0x486e25){return client[_0xd20c('0x9')](_0x5461b3,_0x63f427)['then'](function(_0x584602){logger[_0xd20c('0xa')]('Condition,\x20%s,\x20%s',_0x97ca65,'request\x20sent');logger[_0xd20c('0xb')]('Condition,\x20%s,\x20%s,\x20%s',_0x97ca65,_0xd20c('0xc'),JSON[_0xd20c('0xd')](_0x584602));if(_0x584602['error']){if(_0x584602[_0xd20c('0xe')][_0xd20c('0xf')]===0x1f4){logger[_0xd20c('0xe')](_0xd20c('0x10'),_0x97ca65,_0x584602[_0xd20c('0xe')][_0xd20c('0x11')]);return _0x486e25(_0x584602[_0xd20c('0xe')][_0xd20c('0x11')]);}logger[_0xd20c('0xe')](_0xd20c('0x10'),_0x97ca65,_0x584602[_0xd20c('0xe')]['message']);return _0x53eaeb(_0x584602[_0xd20c('0xe')][_0xd20c('0x11')]);}else{logger[_0xd20c('0xa')]('Condition,\x20%s,\x20%s',_0x97ca65,_0xd20c('0xc'));_0x53eaeb(_0x584602[_0xd20c('0x12')]['message']);}})[_0xd20c('0x13')](function(_0x2a5c74){logger[_0xd20c('0xe')](_0xd20c('0x10'),_0x97ca65,_0x2a5c74);_0x486e25(_0x2a5c74);});});}
\ No newline at end of file
index 6a69547..c44d07e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb593=['multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete','/:id','destroy','exports'];(function(_0x4fe7be,_0x1086f4){var _0x5d4e7d=function(_0x2f89ab){while(--_0x2f89ab){_0x4fe7be['push'](_0x4fe7be['shift']());}};_0x5d4e7d(++_0x1086f4);}(_0xb593,0x1dc));var _0x3b59=function(_0x3edc8b,_0x1996cb){_0x3edc8b=_0x3edc8b-0x0;var _0xbf74e5=_0xb593[_0x3edc8b];return _0xbf74e5;};'use strict';var multer=require(_0x3b59('0x0'));var util=require('util');var path=require(_0x3b59('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3b59('0x2'));var auth=require(_0x3b59('0x3'));var interaction=require(_0x3b59('0x4'));var config=require(_0x3b59('0x5'));var controller=require(_0x3b59('0x6'));router[_0x3b59('0x7')]('/:id',auth[_0x3b59('0x8')](),controller[_0x3b59('0x9')]);router[_0x3b59('0xa')](_0x3b59('0xb'),auth['isAuthenticated'](),controller[_0x3b59('0xc')]);module[_0x3b59('0xd')]=router;
\ No newline at end of file
+var _0x5540=['/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','isAuthenticated','update','delete'];(function(_0x36239a,_0x504a85){var _0x25214c=function(_0x2c66c0){while(--_0x2c66c0){_0x36239a['push'](_0x36239a['shift']());}};_0x25214c(++_0x504a85);}(_0x5540,0x10d));var _0x0554=function(_0x525c0e,_0x2da864){_0x525c0e=_0x525c0e-0x0;var _0x48985a=_0x5540[_0x525c0e];return _0x48985a;};'use strict';var multer=require(_0x0554('0x0'));var util=require(_0x0554('0x1'));var path=require('path');var timeout=require(_0x0554('0x2'));var express=require('express');var router=express[_0x0554('0x3')]();var fs_extra=require(_0x0554('0x4'));var auth=require(_0x0554('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0554('0x6'));var controller=require(_0x0554('0x7'));router['put']('/:id',auth[_0x0554('0x8')](),controller[_0x0554('0x9')]);router[_0x0554('0xa')](_0x0554('0xb'),auth[_0x0554('0x8')](),controller[_0x0554('0xc')]);module[_0x0554('0xd')]=router;
\ No newline at end of file
index 3f72a8c..5d12d82 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x989a=['STRING','INTEGER','sequelize','exports'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x989a,0x76));var _0xa989=function(_0x1cd864,_0x5c82db){_0x1cd864=_0x1cd864-0x0;var _0x22b87f=_0x989a[_0x1cd864];return _0x22b87f;};'use strict';var Sequelize=require(_0xa989('0x0'));module[_0xa989('0x1')]={'name':{'type':Sequelize[_0xa989('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xa989('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa989('0x2')],'allowNull':!![]}};
\ No newline at end of file
+var _0xd8c8=['name','INTEGER','STRING','sequelize','exports'];(function(_0x4bffb6,_0x15fb8e){var _0x1a44f3=function(_0x47145e){while(--_0x47145e){_0x4bffb6['push'](_0x4bffb6['shift']());}};_0x1a44f3(++_0x15fb8e);}(_0xd8c8,0x8f));var _0x8d8c=function(_0x1d9c7a,_0x2daabb){_0x1d9c7a=_0x1d9c7a-0x0;var _0x11b832=_0xd8c8[_0x1d9c7a];return _0x11b832;};'use strict';var Sequelize=require(_0x8d8c('0x0'));module[_0x8d8c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8d8c('0x2')},'OrderBy':{'type':Sequelize[_0x8d8c('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8d8c('0x4')],'allowNull':!![]}};
\ No newline at end of file
index 34b6611..75b363f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f2f=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','options','ContactItemType','includeAll','catch','show','params','length','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','ContactItemTypes','UserProfileResource','destroy','stack','name','index','map'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x241df0,_0x5352d0){_0x241df0=_0x241df0-0x0;var _0x36f64f=_0x5f2f[_0x241df0];return _0x36f64f;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){var _0x5f1124=_0x287ad5[_0xf5f2('0x25')]({'plain':!![]});var _0x13da6f=_0xf5f2('0x26');return db[_0xf5f2('0x27')][_0xf5f2('0x28')]({'where':{'type':_0x13da6f,'resourceId':_0x5f1124['id']}})[_0xf5f2('0x24')](function(){return _0x287ad5;});})[_0xf5f2('0x24')](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaa2602,_0x102449){return function(_0x375ca8){if(!_0x375ca8){_0xaa2602[_0xf5f2('0x18')](0x194);}return _0x375ca8;};}function handleError(_0x198c73,_0x477604){_0x477604=_0x477604||0x1f4;return function(_0x5b6672){logger['error'](_0x5b6672[_0xf5f2('0x29')]);if(_0x5b6672[_0xf5f2('0x2a')]){delete _0x5b6672[_0xf5f2('0x2a')];}_0x198c73['status'](_0x477604)['send'](_0x5b6672);};}exports[_0xf5f2('0x2b')]=function(_0x50b8a2,_0x17394a){var _0x153924={},_0x1b381e={},_0x54c0c8={'count':0x0,'rows':[]};var _0x52e959=_[_0xf5f2('0x2c')](db['ContactItemType'][_0xf5f2('0x2d')],function(_0x58a4df){return{'name':_0x58a4df[_0xf5f2('0x2e')],'type':_0x58a4df[_0xf5f2('0x2f')][_0xf5f2('0x30')]};});_0x1b381e[_0xf5f2('0x31')]=_[_0xf5f2('0x2c')](_0x52e959,_0xf5f2('0x2a'));_0x1b381e[_0xf5f2('0x32')]=_[_0xf5f2('0x33')](_0x50b8a2['query']);_0x1b381e[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x1b381e[_0xf5f2('0x31')],_0x1b381e[_0xf5f2('0x32')]);_0x153924[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x1b381e[_0xf5f2('0x31')],qs['fields'](_0x50b8a2[_0xf5f2('0x32')][_0xf5f2('0x37')]));_0x153924['attributes']=_0x153924[_0xf5f2('0x36')]['length']?_0x153924[_0xf5f2('0x36')]:_0x1b381e[_0xf5f2('0x31')];if(!_0x50b8a2[_0xf5f2('0x32')][_0xf5f2('0x38')]('nolimit')){_0x153924['limit']=qs[_0xf5f2('0x1d')](_0x50b8a2[_0xf5f2('0x32')][_0xf5f2('0x1d')]);_0x153924['offset']=qs[_0xf5f2('0x1b')](_0x50b8a2['query'][_0xf5f2('0x1b')]);}_0x153924['order']=qs[_0xf5f2('0x39')](_0x50b8a2[_0xf5f2('0x32')]['sort']);_0x153924[_0xf5f2('0x3a')]=qs[_0xf5f2('0x34')](_[_0xf5f2('0x3b')](_0x50b8a2[_0xf5f2('0x32')],_0x1b381e['filters']),_0x52e959);if(_0x50b8a2['query'][_0xf5f2('0x3c')]){_0x153924[_0xf5f2('0x3a')]=_[_0xf5f2('0x3d')](_0x153924[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2c')](_0x52e959,function(_0xe62b57){if(_0xe62b57[_0xf5f2('0x2f')]!=='VIRTUAL'){var _0x110fe5={};_0x110fe5[_0xe62b57[_0xf5f2('0x2a')]]={'$like':'%'+_0x50b8a2['query'][_0xf5f2('0x3c')]+'%'};return _0x110fe5;}})});}_0x153924=_[_0xf5f2('0x3d')]({},_0x153924,_0x50b8a2[_0xf5f2('0x3e')]);var _0x85b6d0={'where':_0x153924[_0xf5f2('0x3a')]};return db[_0xf5f2('0x3f')][_0xf5f2('0x1e')](_0x85b6d0)[_0xf5f2('0x24')](function(_0x574f24){_0x54c0c8[_0xf5f2('0x1e')]=_0x574f24;if(_0x50b8a2[_0xf5f2('0x32')][_0xf5f2('0x40')]){_0x153924['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x153924);})[_0xf5f2('0x24')](function(_0x2ad13c){_0x54c0c8['rows']=_0x2ad13c;return _0x54c0c8;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x17394a,_0x153924))[_0xf5f2('0x41')](handleError(_0x17394a,null));};exports[_0xf5f2('0x42')]=function(_0x31f86c,_0x354c34){var _0x2b3b1c={'raw':!![],'where':{'id':_0x31f86c[_0xf5f2('0x43')]['id']}},_0x1a6ec1={};_0x1a6ec1[_0xf5f2('0x31')]=_[_0xf5f2('0x33')](db[_0xf5f2('0x3f')][_0xf5f2('0x2d')]);_0x1a6ec1[_0xf5f2('0x32')]=_[_0xf5f2('0x33')](_0x31f86c['query']);_0x1a6ec1[_0xf5f2('0x34')]=_['intersection'](_0x1a6ec1[_0xf5f2('0x31')],_0x1a6ec1[_0xf5f2('0x32')]);_0x2b3b1c[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x1a6ec1[_0xf5f2('0x31')],qs[_0xf5f2('0x37')](_0x31f86c['query'][_0xf5f2('0x37')]));_0x2b3b1c[_0xf5f2('0x36')]=_0x2b3b1c[_0xf5f2('0x36')][_0xf5f2('0x44')]?_0x2b3b1c[_0xf5f2('0x36')]:_0x1a6ec1[_0xf5f2('0x31')];if(_0x31f86c[_0xf5f2('0x32')][_0xf5f2('0x40')]){_0x2b3b1c['include']=[{'all':!![]}];}_0x2b3b1c=_[_0xf5f2('0x3d')]({},_0x2b3b1c,_0x31f86c[_0xf5f2('0x3e')]);return db[_0xf5f2('0x3f')]['find'](_0x2b3b1c)[_0xf5f2('0x24')](handleEntityNotFound(_0x354c34,null))[_0xf5f2('0x24')](respondWithResult(_0x354c34,null))[_0xf5f2('0x41')](handleError(_0x354c34,null));};exports['create']=function(_0x57a7cb,_0x7bb942){return db[_0xf5f2('0x3f')]['create'](_0x57a7cb[_0xf5f2('0x45')],{})['then'](function(_0x740321){var _0x497eb8=_0x57a7cb[_0xf5f2('0x46')]['get']({'plain':!![]});if(!_0x497eb8)throw new Error(_0xf5f2('0x47'));if(_0x497eb8[_0xf5f2('0x48')]===_0xf5f2('0x46')){var _0x11a083=_0x740321['get']({'plain':!![]});var _0x3154c1=_0xf5f2('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x3154c1,'userProfileId':_0x497eb8[_0xf5f2('0x49')]},'raw':!![]})[_0xf5f2('0x24')](function(_0x57782c){if(_0x57782c&&_0x57782c[_0xf5f2('0x4a')]===0x0){return db[_0xf5f2('0x27')][_0xf5f2('0x4b')]({'name':_0x11a083[_0xf5f2('0x2a')],'resourceId':_0x11a083['id'],'type':_0x57782c['name'],'sectionId':_0x57782c['id']},{})['then'](function(){return _0x740321;});}else{return _0x740321;}})[_0xf5f2('0x41')](function(_0xa3cc67){logger['error'](_0xf5f2('0x4c'),_0xa3cc67);throw _0xa3cc67;});}return _0x740321;})[_0xf5f2('0x24')](respondWithResult(_0x7bb942,0xc9))[_0xf5f2('0x41')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x4d')]=function(_0x2b038e,_0x73c9f1){if(_0x2b038e[_0xf5f2('0x45')]['id']){delete _0x2b038e['body']['id'];}return db['ContactItemType'][_0xf5f2('0x4e')]({'where':{'id':_0x2b038e[_0xf5f2('0x43')]['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x73c9f1,null))[_0xf5f2('0x24')](saveUpdates(_0x2b038e[_0xf5f2('0x45')],null))['then'](respondWithResult(_0x73c9f1,null))[_0xf5f2('0x41')](handleError(_0x73c9f1,null));};exports[_0xf5f2('0x28')]=function(_0x18b124,_0x519c24){return db[_0xf5f2('0x3f')]['find']({'where':{'id':_0x18b124[_0xf5f2('0x43')]['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x519c24,null))[_0xf5f2('0x24')](db[_0xf5f2('0x4f')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x18b124['params']['id']}}))[_0xf5f2('0x24')](removeEntity(_0x519c24,null))['catch'](handleError(_0x519c24,null));};
\ No newline at end of file
+var _0x056b=['find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','CmContactHasItem','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','ContactItemTypes','error','stack','name','index','map','ContactItemType','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll'];(function(_0xae0505,_0x453bc5){var _0x4c505b=function(_0x38d438){while(--_0x38d438){_0xae0505['push'](_0xae0505['shift']());}};_0x4c505b(++_0x453bc5);}(_0x056b,0xb6));var _0xb056=function(_0x2698b5,_0x2faad4){_0x2698b5=_0x2698b5-0x0;var _0x5375c1=_0x056b[_0x2698b5];return _0x5375c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb056('0x0'));var zipdir=require(_0xb056('0x1'));var jsonpatch=require(_0xb056('0x2'));var rp=require(_0xb056('0x3'));var moment=require(_0xb056('0x4'));var BPromise=require(_0xb056('0x5'));var Mustache=require(_0xb056('0x6'));var util=require(_0xb056('0x7'));var path=require(_0xb056('0x8'));var sox=require(_0xb056('0x9'));var csv=require(_0xb056('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb056('0xb'));var _=require(_0xb056('0xc'));var squel=require(_0xb056('0xd'));var crypto=require(_0xb056('0xe'));var jsforce=require(_0xb056('0xf'));var deskjs=require(_0xb056('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb056('0x11'));var Redis=require(_0xb056('0x12'));var authService=require(_0xb056('0x13'));var qs=require(_0xb056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb056('0x15'));var logger=require('../../config/logger')(_0xb056('0x16'));var utils=require(_0xb056('0x17'));var config=require(_0xb056('0x18'));var licenseUtil=require(_0xb056('0x19'));var db=require(_0xb056('0x1a'))['db'];function respondWithStatusCode(_0x5d8306,_0x49c5ec){_0x49c5ec=_0x49c5ec||0xcc;return function(_0xf3e80f){if(_0xf3e80f){return _0x5d8306[_0xb056('0x1b')](_0x49c5ec);}return _0x5d8306['status'](_0x49c5ec)[_0xb056('0x1c')]();};}function respondWithResult(_0x34611b,_0xf1c2e9){_0xf1c2e9=_0xf1c2e9||0xc8;return function(_0x1197e5){if(_0x1197e5){return _0x34611b[_0xb056('0x1d')](_0xf1c2e9)[_0xb056('0x1e')](_0x1197e5);}};}function respondWithFilteredResult(_0x179e49,_0x4b838e){return function(_0x162146){if(_0x162146){var _0x43565e=typeof _0x4b838e[_0xb056('0x1f')]===_0xb056('0x20')&&typeof _0x4b838e['limit']===_0xb056('0x20');var _0x4e501a=_0x162146[_0xb056('0x21')];var _0x311eb9=_0x43565e?0x0:_0x4b838e['offset'];var _0x29c77e=_0x43565e?_0x162146['count']:_0x4b838e[_0xb056('0x1f')]+_0x4b838e[_0xb056('0x22')];var _0x5e4bd9;if(_0x29c77e>=_0x4e501a){_0x29c77e=_0x4e501a;_0x5e4bd9=0xc8;}else{_0x5e4bd9=0xce;}_0x179e49[_0xb056('0x1d')](_0x5e4bd9);return _0x179e49['set'](_0xb056('0x23'),_0x311eb9+'-'+_0x29c77e+'/'+_0x4e501a)[_0xb056('0x1e')](_0x162146);}return null;};}function patchUpdates(_0x457b54){return function(_0x33dd35){try{jsonpatch['apply'](_0x33dd35,_0x457b54,!![]);}catch(_0x1db585){return BPromise['reject'](_0x1db585);}return _0x33dd35[_0xb056('0x24')]();};}function saveUpdates(_0x5dea90,_0x324ce6){return function(_0x40ac2d){if(_0x40ac2d){return _0x40ac2d[_0xb056('0x25')](_0x5dea90)[_0xb056('0x26')](function(_0x36e539){return _0x36e539;});}return null;};}function removeEntity(_0x4bb6c0,_0x4e66c3){return function(_0x1016da){if(_0x1016da){return _0x1016da[_0xb056('0x27')]()[_0xb056('0x26')](function(){var _0x1bd6ac=_0x1016da['get']({'plain':!![]});var _0x44a14f=_0xb056('0x28');return db['UserProfileResource'][_0xb056('0x27')]({'where':{'type':_0x44a14f,'resourceId':_0x1bd6ac['id']}})[_0xb056('0x26')](function(){return _0x1016da;});})[_0xb056('0x26')](function(){_0x4bb6c0[_0xb056('0x1d')](0xcc)[_0xb056('0x1c')]();});}};}function handleEntityNotFound(_0x4024d7,_0x211898){return function(_0x2042f1){if(!_0x2042f1){_0x4024d7['sendStatus'](0x194);}return _0x2042f1;};}function handleError(_0x29fbc1,_0x51b06b){_0x51b06b=_0x51b06b||0x1f4;return function(_0x3d83d3){logger[_0xb056('0x29')](_0x3d83d3[_0xb056('0x2a')]);if(_0x3d83d3['name']){delete _0x3d83d3[_0xb056('0x2b')];}_0x29fbc1[_0xb056('0x1d')](_0x51b06b)['send'](_0x3d83d3);};}exports[_0xb056('0x2c')]=function(_0x43aa63,_0x329eaa){var _0x1fad05={},_0x3ce984={},_0x4ebca5={'count':0x0,'rows':[]};var _0x87f31e=_[_0xb056('0x2d')](db[_0xb056('0x2e')][_0xb056('0x2f')],function(_0x103482){return{'name':_0x103482['fieldName'],'type':_0x103482[_0xb056('0x30')][_0xb056('0x31')]};});_0x3ce984[_0xb056('0x32')]=_[_0xb056('0x2d')](_0x87f31e,_0xb056('0x2b'));_0x3ce984[_0xb056('0x33')]=_[_0xb056('0x34')](_0x43aa63[_0xb056('0x33')]);_0x3ce984['filters']=_[_0xb056('0x35')](_0x3ce984['model'],_0x3ce984[_0xb056('0x33')]);_0x1fad05['attributes']=_['intersection'](_0x3ce984[_0xb056('0x32')],qs[_0xb056('0x36')](_0x43aa63[_0xb056('0x33')][_0xb056('0x36')]));_0x1fad05[_0xb056('0x37')]=_0x1fad05[_0xb056('0x37')][_0xb056('0x38')]?_0x1fad05['attributes']:_0x3ce984[_0xb056('0x32')];if(!_0x43aa63[_0xb056('0x33')]['hasOwnProperty']('nolimit')){_0x1fad05[_0xb056('0x22')]=qs[_0xb056('0x22')](_0x43aa63[_0xb056('0x33')]['limit']);_0x1fad05[_0xb056('0x1f')]=qs[_0xb056('0x1f')](_0x43aa63[_0xb056('0x33')][_0xb056('0x1f')]);}_0x1fad05[_0xb056('0x39')]=qs[_0xb056('0x3a')](_0x43aa63[_0xb056('0x33')][_0xb056('0x3a')]);_0x1fad05[_0xb056('0x3b')]=qs[_0xb056('0x3c')](_[_0xb056('0x3d')](_0x43aa63[_0xb056('0x33')],_0x3ce984['filters']),_0x87f31e);if(_0x43aa63[_0xb056('0x33')]['filter']){_0x1fad05[_0xb056('0x3b')]=_[_0xb056('0x3e')](_0x1fad05[_0xb056('0x3b')],{'$or':_[_0xb056('0x2d')](_0x87f31e,function(_0x460f28){if(_0x460f28[_0xb056('0x30')]!==_0xb056('0x3f')){var _0x42b54f={};_0x42b54f[_0x460f28['name']]={'$like':'%'+_0x43aa63[_0xb056('0x33')][_0xb056('0x40')]+'%'};return _0x42b54f;}})});}_0x1fad05=_[_0xb056('0x3e')]({},_0x1fad05,_0x43aa63[_0xb056('0x41')]);var _0x134db7={'where':_0x1fad05['where']};return db[_0xb056('0x2e')][_0xb056('0x21')](_0x134db7)[_0xb056('0x26')](function(_0x216f72){_0x4ebca5[_0xb056('0x21')]=_0x216f72;if(_0x43aa63[_0xb056('0x33')]['includeAll']){_0x1fad05[_0xb056('0x42')]=[{'all':!![]}];}return db['ContactItemType'][_0xb056('0x43')](_0x1fad05);})[_0xb056('0x26')](function(_0x21d98e){_0x4ebca5[_0xb056('0x44')]=_0x21d98e;return _0x4ebca5;})[_0xb056('0x26')](respondWithFilteredResult(_0x329eaa,_0x1fad05))[_0xb056('0x45')](handleError(_0x329eaa,null));};exports[_0xb056('0x46')]=function(_0x248819,_0x2c8b61){var _0x149341={'raw':!![],'where':{'id':_0x248819[_0xb056('0x47')]['id']}},_0x4fa3c5={};_0x4fa3c5[_0xb056('0x32')]=_[_0xb056('0x34')](db['ContactItemType'][_0xb056('0x2f')]);_0x4fa3c5[_0xb056('0x33')]=_['keys'](_0x248819['query']);_0x4fa3c5[_0xb056('0x3c')]=_[_0xb056('0x35')](_0x4fa3c5[_0xb056('0x32')],_0x4fa3c5[_0xb056('0x33')]);_0x149341['attributes']=_['intersection'](_0x4fa3c5['model'],qs['fields'](_0x248819['query']['fields']));_0x149341[_0xb056('0x37')]=_0x149341['attributes'][_0xb056('0x38')]?_0x149341[_0xb056('0x37')]:_0x4fa3c5[_0xb056('0x32')];if(_0x248819[_0xb056('0x33')][_0xb056('0x48')]){_0x149341[_0xb056('0x42')]=[{'all':!![]}];}_0x149341=_[_0xb056('0x3e')]({},_0x149341,_0x248819[_0xb056('0x41')]);return db['ContactItemType'][_0xb056('0x49')](_0x149341)[_0xb056('0x26')](handleEntityNotFound(_0x2c8b61,null))['then'](respondWithResult(_0x2c8b61,null))[_0xb056('0x45')](handleError(_0x2c8b61,null));};exports[_0xb056('0x4a')]=function(_0xe40439,_0x2f2d22){return db[_0xb056('0x2e')][_0xb056('0x4a')](_0xe40439['body'],{})[_0xb056('0x26')](function(_0x5e2224){var _0x132268=_0xe40439[_0xb056('0x4b')][_0xb056('0x4c')]({'plain':!![]});if(!_0x132268)throw new Error(_0xb056('0x4d'));if(_0x132268[_0xb056('0x4e')]===_0xb056('0x4b')){var _0x2b6733=_0x5e2224[_0xb056('0x4c')]({'plain':!![]});var _0x5a3bbf=_0xb056('0x28');return db[_0xb056('0x4f')][_0xb056('0x49')]({'where':{'name':_0x5a3bbf,'userProfileId':_0x132268[_0xb056('0x50')]},'raw':!![]})[_0xb056('0x26')](function(_0x35acab){if(_0x35acab&&_0x35acab[_0xb056('0x51')]===0x0){return db[_0xb056('0x52')]['create']({'name':_0x2b6733[_0xb056('0x2b')],'resourceId':_0x2b6733['id'],'type':_0x35acab[_0xb056('0x2b')],'sectionId':_0x35acab['id']},{})[_0xb056('0x26')](function(){return _0x5e2224;});}else{return _0x5e2224;}})[_0xb056('0x45')](function(_0x1a5170){logger[_0xb056('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a5170);throw _0x1a5170;});}return _0x5e2224;})[_0xb056('0x26')](respondWithResult(_0x2f2d22,0xc9))[_0xb056('0x45')](handleError(_0x2f2d22,null));};exports[_0xb056('0x25')]=function(_0x536d85,_0x37c64c){if(_0x536d85['body']['id']){delete _0x536d85[_0xb056('0x53')]['id'];}return db[_0xb056('0x2e')][_0xb056('0x49')]({'where':{'id':_0x536d85[_0xb056('0x47')]['id']}})['then'](handleEntityNotFound(_0x37c64c,null))[_0xb056('0x26')](saveUpdates(_0x536d85[_0xb056('0x53')],null))['then'](respondWithResult(_0x37c64c,null))[_0xb056('0x45')](handleError(_0x37c64c,null));};exports[_0xb056('0x27')]=function(_0x1d3cdd,_0x1546e5){return db[_0xb056('0x2e')]['find']({'where':{'id':_0x1d3cdd[_0xb056('0x47')]['id']}})[_0xb056('0x26')](handleEntityNotFound(_0x1546e5,null))[_0xb056('0x26')](db[_0xb056('0x54')][_0xb056('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1d3cdd[_0xb056('0x47')]['id']}}))[_0xb056('0x26')](removeEntity(_0x1546e5,null))[_0xb056('0x45')](handleError(_0x1546e5,null));};
\ No newline at end of file
index a7cf9b0..5f60660 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x60a0=['moment','bluebird','rimraf','../../config/environment','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger'];(function(_0x21141c,_0xed9815){var _0x2addaf=function(_0x53dcd6){while(--_0x53dcd6){_0x21141c['push'](_0x21141c['shift']());}};_0x2addaf(++_0xed9815);}(_0x60a0,0x10b));var _0x060a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x60a0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x060a('0x0'));var util=require(_0x060a('0x1'));var logger=require(_0x060a('0x2'))('api');var moment=require(_0x060a('0x3'));var BPromise=require(_0x060a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x060a('0x5'));var config=require(_0x060a('0x6'));var attributes=require('./contactItemType.attributes');module['exports']=function(_0x509a26,_0x2b8ab5){return _0x509a26[_0x060a('0x7')](_0x060a('0x8'),attributes,{'tableName':_0x060a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x995c=['../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1eaeeb,_0x3b3775){var _0x535626=function(_0x2e6bc2){while(--_0x2e6bc2){_0x1eaeeb['push'](_0x1eaeeb['shift']());}};_0x535626(++_0x3b3775);}(_0x995c,0x18e));var _0xc995=function(_0x2719bf,_0x9a3595){_0x2719bf=_0x2719bf-0x0;var _0x1c073e=_0x995c[_0x2719bf];return _0x1c073e;};'use strict';var _=require(_0xc995('0x0'));var util=require(_0xc995('0x1'));var logger=require(_0xc995('0x2'))(_0xc995('0x3'));var moment=require(_0xc995('0x4'));var BPromise=require(_0xc995('0x5'));var rp=require(_0xc995('0x6'));var fs=require('fs');var path=require(_0xc995('0x7'));var rimraf=require('rimraf');var config=require(_0xc995('0x8'));var attributes=require(_0xc995('0x9'));module[_0xc995('0xa')]=function(_0x3d0daf,_0x3a4ac5){return _0x3d0daf[_0xc995('0xb')](_0xc995('0xc'),attributes,{'tableName':_0xc995('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 1553531..624aabc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0820=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x9f27a3,_0x3716d9){var _0x1e712e=function(_0x5cb75a){while(--_0x5cb75a){_0x9f27a3['push'](_0x9f27a3['shift']());}};_0x1e712e(++_0x3716d9);}(_0x0820,0x1c8));var _0x0082=function(_0x212a44,_0x24f890){_0x212a44=_0x212a44-0x0;var _0x31e452=_0x0820[_0x212a44];return _0x31e452;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0082('0x0'));var BPromise=require(_0x0082('0x1'));var rs=require(_0x0082('0x2'));var fs=require('fs');var Redis=require(_0x0082('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0082('0x4'));var logger=require(_0x0082('0x5'))(_0x0082('0x6'));var config=require(_0x0082('0x7'));var jayson=require(_0x0082('0x8'));var client=jayson[_0x0082('0x9')][_0x0082('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d0db8,_0x15e111,_0x189d59){return new BPromise(function(_0x76348a,_0x317203){return client[_0x0082('0xb')](_0x5d0db8,_0x189d59)['then'](function(_0x3b2c51){logger[_0x0082('0xc')](_0x0082('0xd'),_0x15e111,_0x0082('0xe'));logger[_0x0082('0xf')](_0x0082('0x10'),_0x15e111,_0x0082('0xe'),JSON[_0x0082('0x11')](_0x3b2c51));if(_0x3b2c51[_0x0082('0x12')]){if(_0x3b2c51[_0x0082('0x12')][_0x0082('0x13')]===0x1f4){logger[_0x0082('0x12')]('ContactItemType,\x20%s,\x20%s',_0x15e111,_0x3b2c51[_0x0082('0x12')][_0x0082('0x14')]);return _0x317203(_0x3b2c51[_0x0082('0x12')][_0x0082('0x14')]);}logger['error'](_0x0082('0xd'),_0x15e111,_0x3b2c51[_0x0082('0x12')]['message']);return _0x76348a(_0x3b2c51[_0x0082('0x12')]['message']);}else{logger[_0x0082('0xc')](_0x0082('0xd'),_0x15e111,_0x0082('0xe'));_0x76348a(_0x3b2c51[_0x0082('0x15')][_0x0082('0x14')]);}})[_0x0082('0x16')](function(_0x3cade9){logger[_0x0082('0x12')]('ContactItemType,\x20%s,\x20%s',_0x15e111,_0x3cade9);_0x317203(_0x3cade9);});});}
\ No newline at end of file
+var _0x43ea=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x35877e,_0x55951c){var _0x2396cc=function(_0x3db840){while(--_0x3db840){_0x35877e['push'](_0x35877e['shift']());}};_0x2396cc(++_0x55951c);}(_0x43ea,0x142));var _0xa43e=function(_0x270fe1,_0x4221e6){_0x270fe1=_0x270fe1-0x0;var _0x4b69c4=_0x43ea[_0x270fe1];return _0x4b69c4;};'use strict';var _=require(_0xa43e('0x0'));var util=require(_0xa43e('0x1'));var moment=require(_0xa43e('0x2'));var BPromise=require(_0xa43e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa43e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa43e('0x5'));var logger=require(_0xa43e('0x6'))(_0xa43e('0x7'));var config=require(_0xa43e('0x8'));var jayson=require(_0xa43e('0x9'));var client=jayson['client'][_0xa43e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b81b3,_0x2d55ae,_0x6e45db){return new BPromise(function(_0x55a7ab,_0x3fc26d){return client[_0xa43e('0xb')](_0x4b81b3,_0x6e45db)[_0xa43e('0xc')](function(_0x1227aa){logger[_0xa43e('0xd')](_0xa43e('0xe'),_0x2d55ae,_0xa43e('0xf'));logger[_0xa43e('0x10')](_0xa43e('0x11'),_0x2d55ae,_0xa43e('0xf'),JSON['stringify'](_0x1227aa));if(_0x1227aa[_0xa43e('0x12')]){if(_0x1227aa[_0xa43e('0x12')][_0xa43e('0x13')]===0x1f4){logger[_0xa43e('0x12')](_0xa43e('0xe'),_0x2d55ae,_0x1227aa[_0xa43e('0x12')][_0xa43e('0x14')]);return _0x3fc26d(_0x1227aa[_0xa43e('0x12')]['message']);}logger['error'](_0xa43e('0xe'),_0x2d55ae,_0x1227aa['error'][_0xa43e('0x14')]);return _0x55a7ab(_0x1227aa[_0xa43e('0x12')][_0xa43e('0x14')]);}else{logger['info'](_0xa43e('0xe'),_0x2d55ae,_0xa43e('0xf'));_0x55a7ab(_0x1227aa[_0xa43e('0x15')][_0xa43e('0x14')]);}})[_0xa43e('0x16')](function(_0x438a9e){logger[_0xa43e('0x12')](_0xa43e('0xe'),_0x2d55ae,_0x438a9e);_0x3fc26d(_0x438a9e);});});}
\ No newline at end of file
index e8830f5..40d40df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbf85=['index','/:id','show','post','create','put','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated'];(function(_0x1fcfdc,_0x2ba377){var _0x496df3=function(_0x27ba07){while(--_0x27ba07){_0x1fcfdc['push'](_0x1fcfdc['shift']());}};_0x496df3(++_0x2ba377);}(_0xbf85,0x15b));var _0x5bf8=function(_0x2e4a0f,_0x3a9bb6){_0x2e4a0f=_0x2e4a0f-0x0;var _0x25a3cd=_0xbf85[_0x2e4a0f];return _0x25a3cd;};'use strict';var multer=require('multer');var util=require(_0x5bf8('0x0'));var path=require(_0x5bf8('0x1'));var timeout=require('connect-timeout');var express=require(_0x5bf8('0x2'));var router=express[_0x5bf8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5bf8('0x4'));var interaction=require(_0x5bf8('0x5'));var config=require(_0x5bf8('0x6'));var controller=require(_0x5bf8('0x7'));router[_0x5bf8('0x8')]('/',auth[_0x5bf8('0x9')](),controller[_0x5bf8('0xa')]);router[_0x5bf8('0x8')](_0x5bf8('0xb'),auth[_0x5bf8('0x9')](),controller[_0x5bf8('0xc')]);router[_0x5bf8('0xd')]('/',auth[_0x5bf8('0x9')](),controller[_0x5bf8('0xe')]);router[_0x5bf8('0xf')](_0x5bf8('0xb'),auth[_0x5bf8('0x9')](),controller['update']);router['delete'](_0x5bf8('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x5bf8('0x10')]=router;
\ No newline at end of file
+var _0x0610=['post','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','show'];(function(_0x341c44,_0x2e1057){var _0x2bda72=function(_0x11d26a){while(--_0x11d26a){_0x341c44['push'](_0x341c44['shift']());}};_0x2bda72(++_0x2e1057);}(_0x0610,0xfe));var _0x0061=function(_0x2986b4,_0x31db3f){_0x2986b4=_0x2986b4-0x0;var _0x22c032=_0x0610[_0x2986b4];return _0x22c032;};'use strict';var multer=require(_0x0061('0x0'));var util=require(_0x0061('0x1'));var path=require('path');var timeout=require(_0x0061('0x2'));var express=require(_0x0061('0x3'));var router=express[_0x0061('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0061('0x5'));var interaction=require(_0x0061('0x6'));var config=require(_0x0061('0x7'));var controller=require(_0x0061('0x8'));router[_0x0061('0x9')]('/',auth[_0x0061('0xa')](),controller['index']);router[_0x0061('0x9')]('/:id',auth[_0x0061('0xa')](),controller[_0x0061('0xb')]);router[_0x0061('0xc')]('/',auth[_0x0061('0xa')](),controller['create']);router[_0x0061('0xd')](_0x0061('0xe'),auth[_0x0061('0xa')](),controller[_0x0061('0xf')]);router[_0x0061('0x10')](_0x0061('0xe'),auth[_0x0061('0xa')](),controller[_0x0061('0x11')]);module[_0x0061('0x12')]=router;
\ No newline at end of file
index 69896b1..585574b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['name','sequelize','STRING'];(function(_0x4a2826,_0x29a539){var _0x11d2ec=function(_0x87f5e9){while(--_0x87f5e9){_0x4a2826['push'](_0x4a2826['shift']());}};_0x11d2ec(++_0x29a539);}(_0xb10b,0x12a));var _0xbb10=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0xb10b[_0x3861f7];return _0x50879f;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}};
\ No newline at end of file
+var _0x2032=['name','exports','STRING'];(function(_0x219f66,_0x2407b6){var _0x365dfa=function(_0x2f7dcb){while(--_0x2f7dcb){_0x219f66['push'](_0x219f66['shift']());}};_0x365dfa(++_0x2407b6);}(_0x2032,0xd9));var _0x2203=function(_0x4de7d7,_0x5caec9){_0x4de7d7=_0x4de7d7-0x0;var _0x1aafed=_0x2032[_0x4de7d7];return _0x1aafed;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 737384a..e538de6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4adc=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrChatWebsites','web-report','reportType','attrReport','attrRefresh','addItem','DashboardId','DashboardItem','getItems','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','map','Dashboard','rawAttributes','type','key','model','query','filters'];(function(_0x2bf907,_0x50994b){var _0x2cdf43=function(_0x2b7517){while(--_0x2b7517){_0x2bf907['push'](_0x2bf907['shift']());}};_0x2cdf43(++_0x50994b);}(_0x4adc,0xc2));var _0xc4ad=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4adc[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0xc4ad('0x0'));var rimraf=require(_0xc4ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc4ad('0x2'));var moment=require(_0xc4ad('0x3'));var BPromise=require(_0xc4ad('0x4'));var Mustache=require('mustache');var util=require(_0xc4ad('0x5'));var path=require(_0xc4ad('0x6'));var sox=require(_0xc4ad('0x7'));var csv=require(_0xc4ad('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc4ad('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc4ad('0xa'));var jsforce=require(_0xc4ad('0xb'));var deskjs=require(_0xc4ad('0xc'));var toCsv=require(_0xc4ad('0x8'));var querystring=require('querystring');var Papa=require(_0xc4ad('0xd'));var Redis=require(_0xc4ad('0xe'));var authService=require(_0xc4ad('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc4ad('0x10'));var hardwareService=require(_0xc4ad('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc4ad('0x12'));var db=require(_0xc4ad('0x13'))['db'];config[_0xc4ad('0x14')]=_[_0xc4ad('0x15')](config[_0xc4ad('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xc4ad('0x16'))(new Redis(config[_0xc4ad('0x14')]));require(_0xc4ad('0x17'))[_0xc4ad('0x18')](socket);function respondWithStatusCode(_0x15d2da,_0x5a75ac){_0x5a75ac=_0x5a75ac||0xcc;return function(_0x587ffa){if(_0x587ffa){return _0x15d2da[_0xc4ad('0x19')](_0x5a75ac);}return _0x15d2da[_0xc4ad('0x1a')](_0x5a75ac)[_0xc4ad('0x1b')]();};}function respondWithResult(_0x5d1962,_0x2ac7ca){_0x2ac7ca=_0x2ac7ca||0xc8;return function(_0x5486e9){if(_0x5486e9){return _0x5d1962[_0xc4ad('0x1a')](_0x2ac7ca)[_0xc4ad('0x1c')](_0x5486e9);}};}function respondWithFilteredResult(_0x19fff5,_0x54134c){return function(_0x5cfba1){if(_0x5cfba1){var _0x26f8f3=typeof _0x54134c[_0xc4ad('0x1d')]===_0xc4ad('0x1e')&&typeof _0x54134c[_0xc4ad('0x1f')]===_0xc4ad('0x1e');var _0x1bdee1=_0x5cfba1[_0xc4ad('0x20')];var _0x42ba0f=_0x26f8f3?0x0:_0x54134c[_0xc4ad('0x1d')];var _0x2a1df4=_0x26f8f3?_0x5cfba1[_0xc4ad('0x20')]:_0x54134c[_0xc4ad('0x1d')]+_0x54134c[_0xc4ad('0x1f')];var _0x33c0f6;if(_0x2a1df4>=_0x1bdee1){_0x2a1df4=_0x1bdee1;_0x33c0f6=0xc8;}else{_0x33c0f6=0xce;}_0x19fff5['status'](_0x33c0f6);return _0x19fff5[_0xc4ad('0x21')](_0xc4ad('0x22'),_0x42ba0f+'-'+_0x2a1df4+'/'+_0x1bdee1)[_0xc4ad('0x1c')](_0x5cfba1);}return null;};}function patchUpdates(_0x33252a){return function(_0x3b3d16){try{jsonpatch['apply'](_0x3b3d16,_0x33252a,!![]);}catch(_0x3455f5){return BPromise[_0xc4ad('0x23')](_0x3455f5);}return _0x3b3d16[_0xc4ad('0x24')]();};}function saveUpdates(_0x596f42,_0x222c13){return function(_0x42946f){if(_0x42946f){return _0x42946f[_0xc4ad('0x25')](_0x596f42)[_0xc4ad('0x26')](function(_0x63e673){return _0x63e673;});}return null;};}function removeEntity(_0x27fe75,_0x584c77){return function(_0x16934e){if(_0x16934e){return _0x16934e['destroy']()['then'](function(){var _0x2c9468=_0x16934e[_0xc4ad('0x27')]({'plain':!![]});var _0x1dbc20=_0xc4ad('0x28');return db[_0xc4ad('0x29')][_0xc4ad('0x2a')]({'where':{'type':_0x1dbc20,'resourceId':_0x2c9468['id']}})[_0xc4ad('0x26')](function(){return _0x16934e;});})[_0xc4ad('0x26')](function(){_0x27fe75[_0xc4ad('0x1a')](0xcc)[_0xc4ad('0x1b')]();});}};}function handleEntityNotFound(_0x27829e,_0x7f3f5c){return function(_0x1de3b6){if(!_0x1de3b6){_0x27829e[_0xc4ad('0x19')](0x194);}return _0x1de3b6;};}function handleError(_0x3ee036,_0x36ff9b){_0x36ff9b=_0x36ff9b||0x1f4;return function(_0x8eac86){logger[_0xc4ad('0x2b')](_0x8eac86[_0xc4ad('0x2c')]);if(_0x8eac86['name']){delete _0x8eac86[_0xc4ad('0x2d')];}_0x3ee036[_0xc4ad('0x1a')](_0x36ff9b)['send'](_0x8eac86);};}exports['index']=function(_0x488361,_0x9e608d){var _0x27a301={},_0xc4c052={},_0x24cd93={'count':0x0,'rows':[]};var _0x5f03e2=_[_0xc4ad('0x2e')](db[_0xc4ad('0x2f')][_0xc4ad('0x30')],function(_0x593745){return{'name':_0x593745['fieldName'],'type':_0x593745[_0xc4ad('0x31')][_0xc4ad('0x32')]};});_0xc4c052[_0xc4ad('0x33')]=_[_0xc4ad('0x2e')](_0x5f03e2,_0xc4ad('0x2d'));_0xc4c052[_0xc4ad('0x34')]=_['keys'](_0x488361['query']);_0xc4c052[_0xc4ad('0x35')]=_[_0xc4ad('0x36')](_0xc4c052[_0xc4ad('0x33')],_0xc4c052[_0xc4ad('0x34')]);_0x27a301[_0xc4ad('0x37')]=_[_0xc4ad('0x36')](_0xc4c052[_0xc4ad('0x33')],qs[_0xc4ad('0x38')](_0x488361['query'][_0xc4ad('0x38')]));_0x27a301[_0xc4ad('0x37')]=_0x27a301['attributes'][_0xc4ad('0x39')]?_0x27a301['attributes']:_0xc4c052[_0xc4ad('0x33')];if(!_0x488361[_0xc4ad('0x34')][_0xc4ad('0x3a')](_0xc4ad('0x3b'))){_0x27a301[_0xc4ad('0x1f')]=qs[_0xc4ad('0x1f')](_0x488361[_0xc4ad('0x34')]['limit']);_0x27a301[_0xc4ad('0x1d')]=qs[_0xc4ad('0x1d')](_0x488361['query'][_0xc4ad('0x1d')]);}_0x27a301[_0xc4ad('0x3c')]=qs[_0xc4ad('0x3d')](_0x488361[_0xc4ad('0x34')][_0xc4ad('0x3d')]);_0x27a301[_0xc4ad('0x3e')]=qs['filters'](_[_0xc4ad('0x3f')](_0x488361['query'],_0xc4c052[_0xc4ad('0x35')]),_0x5f03e2);if(_0x488361[_0xc4ad('0x34')][_0xc4ad('0x40')]){_0x27a301[_0xc4ad('0x3e')]=_[_0xc4ad('0x41')](_0x27a301[_0xc4ad('0x3e')],{'$or':_['map'](_0x5f03e2,function(_0x210613){if(_0x210613[_0xc4ad('0x31')]!==_0xc4ad('0x42')){var _0x6fe79c={};_0x6fe79c[_0x210613[_0xc4ad('0x2d')]]={'$like':'%'+_0x488361[_0xc4ad('0x34')][_0xc4ad('0x40')]+'%'};return _0x6fe79c;}})});}_0x27a301=_[_0xc4ad('0x41')]({},_0x27a301,_0x488361[_0xc4ad('0x43')]);var _0x5ecbb6={'where':_0x27a301[_0xc4ad('0x3e')]};return db['Dashboard'][_0xc4ad('0x20')](_0x5ecbb6)[_0xc4ad('0x26')](function(_0x1136e2){_0x24cd93[_0xc4ad('0x20')]=_0x1136e2;if(_0x488361['query']['includeAll']){_0x27a301[_0xc4ad('0x44')]=[{'all':!![]}];}return db[_0xc4ad('0x2f')]['findAll'](_0x27a301);})[_0xc4ad('0x26')](function(_0x207f5e){_0x24cd93[_0xc4ad('0x45')]=_0x207f5e;return _0x24cd93;})[_0xc4ad('0x26')](respondWithFilteredResult(_0x9e608d,_0x27a301))[_0xc4ad('0x46')](handleError(_0x9e608d,null));};exports['show']=function(_0x5a5910,_0x29fd96){var _0x901c3e={'raw':![],'where':{'id':_0x5a5910[_0xc4ad('0x47')]['id']}},_0x153916={};_0x153916['model']=_['keys'](db[_0xc4ad('0x2f')][_0xc4ad('0x30')]);_0x153916['query']=_['keys'](_0x5a5910[_0xc4ad('0x34')]);_0x153916[_0xc4ad('0x35')]=_[_0xc4ad('0x36')](_0x153916['model'],_0x153916[_0xc4ad('0x34')]);_0x901c3e['attributes']=_[_0xc4ad('0x36')](_0x153916[_0xc4ad('0x33')],qs[_0xc4ad('0x38')](_0x5a5910[_0xc4ad('0x34')][_0xc4ad('0x38')]));_0x901c3e[_0xc4ad('0x37')]=_0x901c3e[_0xc4ad('0x37')]['length']?_0x901c3e[_0xc4ad('0x37')]:_0x153916[_0xc4ad('0x33')];if(_0x5a5910[_0xc4ad('0x34')][_0xc4ad('0x48')]){_0x901c3e['include']=[{'all':!![]}];}_0x901c3e=_[_0xc4ad('0x41')]({},_0x901c3e,_0x5a5910[_0xc4ad('0x43')]);return db[_0xc4ad('0x2f')][_0xc4ad('0x49')](_0x901c3e)[_0xc4ad('0x26')](handleEntityNotFound(_0x29fd96,null))[_0xc4ad('0x26')](respondWithResult(_0x29fd96,null))[_0xc4ad('0x46')](handleError(_0x29fd96,null));};exports[_0xc4ad('0x4a')]=function(_0x326568,_0x1759aa){return db[_0xc4ad('0x2f')][_0xc4ad('0x4a')](_0x326568[_0xc4ad('0x4b')],{})[_0xc4ad('0x26')](function(_0x2e9c26){var _0x53a2c1=_0x326568[_0xc4ad('0x4c')][_0xc4ad('0x27')]({'plain':!![]});if(!_0x53a2c1)throw new Error(_0xc4ad('0x4d'));if(_0x53a2c1[_0xc4ad('0x4e')]===_0xc4ad('0x4c')){var _0x2bfe1f=_0x2e9c26[_0xc4ad('0x27')]({'plain':!![]});var _0x5182f0='CustomDashboards';return db[_0xc4ad('0x4f')][_0xc4ad('0x49')]({'where':{'name':_0x5182f0,'userProfileId':_0x53a2c1[_0xc4ad('0x50')]},'raw':!![]})[_0xc4ad('0x26')](function(_0x46c3ce){if(_0x46c3ce&&_0x46c3ce[_0xc4ad('0x51')]===0x0){return db[_0xc4ad('0x29')][_0xc4ad('0x4a')]({'name':_0x2bfe1f['name'],'resourceId':_0x2bfe1f['id'],'type':_0x46c3ce[_0xc4ad('0x2d')],'sectionId':_0x46c3ce['id']},{})[_0xc4ad('0x26')](function(){return _0x2e9c26;});}else{return _0x2e9c26;}})[_0xc4ad('0x46')](function(_0x1915dd){logger[_0xc4ad('0x2b')](_0xc4ad('0x52'),_0x1915dd);throw _0x1915dd;});}return _0x2e9c26;})['then'](respondWithResult(_0x1759aa,0xc9))[_0xc4ad('0x46')](handleError(_0x1759aa,null));};exports[_0xc4ad('0x53')]=function(_0x64af30,_0x131197){var _0x1b72d6={'where':{'id':_0x64af30[_0xc4ad('0x47')]['id']}},_0x564361={};_0x564361[_0xc4ad('0x33')]=_[_0xc4ad('0x54')](db[_0xc4ad('0x2f')][_0xc4ad('0x30')]);_0x1b72d6[_0xc4ad('0x37')]=_[_0xc4ad('0x36')](_0x564361[_0xc4ad('0x33')],qs[_0xc4ad('0x38')](_0x64af30[_0xc4ad('0x34')][_0xc4ad('0x38')]));_0x1b72d6[_0xc4ad('0x37')]=_0x1b72d6['attributes']['length']?_0x1b72d6[_0xc4ad('0x37')]:_0x564361[_0xc4ad('0x33')];if(_0x64af30[_0xc4ad('0x34')][_0xc4ad('0x48')]){_0x1b72d6[_0xc4ad('0x44')]=[{'all':!![]}];}_0x1b72d6=_[_0xc4ad('0x41')]({},_0x1b72d6,_0x64af30['options']);return db[_0xc4ad('0x2f')][_0xc4ad('0x49')](_0x1b72d6)[_0xc4ad('0x26')](handleEntityNotFound(_0x131197,null))[_0xc4ad('0x26')](function(_0x147a40){if(_0x147a40){var _0x13ff3f=_0x147a40[_0xc4ad('0x27')]({'plain':!![]});_0x13ff3f=qs[_0xc4ad('0x55')](_0x13ff3f,['id',_0xc4ad('0x56'),'updatedAt']);_0x64af30[_0xc4ad('0x4b')]=_[_0xc4ad('0x55')](_0x64af30[_0xc4ad('0x4b')],['id',_0xc4ad('0x56'),_0xc4ad('0x57')]);return db[_0xc4ad('0x2f')][_0xc4ad('0x4a')](_[_0xc4ad('0x41')](_0x13ff3f,_0x64af30['body']),{'include':_0x64af30[_0xc4ad('0x34')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x5b11c2){var _0xcc6c56=_0x64af30['user'][_0xc4ad('0x27')]({'plain':!![]});if(!_0xcc6c56)throw new Error(_0xc4ad('0x4d'));if(_0xcc6c56[_0xc4ad('0x4e')]===_0xc4ad('0x4c')){var _0x2becc4=_0x5b11c2[_0xc4ad('0x27')]({'plain':!![]});var _0x52aa7c='CustomDashboards';return db[_0xc4ad('0x4f')][_0xc4ad('0x49')]({'where':{'name':_0x52aa7c,'userProfileId':_0xcc6c56[_0xc4ad('0x50')]},'raw':!![]})[_0xc4ad('0x26')](function(_0x4d8305){if(_0x4d8305&&_0x4d8305[_0xc4ad('0x51')]===0x0){return db['UserProfileResource'][_0xc4ad('0x4a')]({'name':_0x2becc4[_0xc4ad('0x2d')],'resourceId':_0x2becc4['id'],'type':_0x4d8305[_0xc4ad('0x2d')],'sectionId':_0x4d8305['id']},{})[_0xc4ad('0x26')](function(){return _0x5b11c2;});}else{return _0x5b11c2;}})['catch'](function(_0x3a9df2){logger[_0xc4ad('0x2b')](_0xc4ad('0x52'),_0x3a9df2);throw _0x3a9df2;});}return _0x5b11c2;});}})[_0xc4ad('0x26')](respondWithResult(_0x131197,0xc9))[_0xc4ad('0x46')](handleError(_0x131197,null));};exports[_0xc4ad('0x25')]=function(_0x48e96a,_0x198409){if(_0x48e96a[_0xc4ad('0x4b')]['id']){delete _0x48e96a[_0xc4ad('0x4b')]['id'];}return db[_0xc4ad('0x2f')][_0xc4ad('0x49')]({'where':{'id':_0x48e96a[_0xc4ad('0x47')]['id']}})[_0xc4ad('0x26')](handleEntityNotFound(_0x198409,null))['then'](saveUpdates(_0x48e96a[_0xc4ad('0x4b')],null))[_0xc4ad('0x26')](respondWithResult(_0x198409,null))[_0xc4ad('0x46')](handleError(_0x198409,null));};exports[_0xc4ad('0x2a')]=function(_0x1826dd,_0x2c90f0){return db['Dashboard']['find']({'where':{'id':_0x1826dd[_0xc4ad('0x47')]['id']}})[_0xc4ad('0x26')](handleEntityNotFound(_0x2c90f0,null))[_0xc4ad('0x26')](removeEntity(_0x2c90f0,null))[_0xc4ad('0x46')](handleError(_0x2c90f0,null));};function widgetAttributes(_0x3c3cbc){try{switch(_0x3c3cbc[_0xc4ad('0x31')]){case _0xc4ad('0x58'):return[{'name':_0xc4ad('0x59'),'value':_0x3c3cbc['attrUrl']||(_0x3c3cbc['attrs']&&_0x3c3cbc[_0xc4ad('0x5a')][0x0]?_0x3c3cbc[_0xc4ad('0x5a')][0x0][_0xc4ad('0x5b')]:undefined)||_0xc4ad('0x5c')}];case _0xc4ad('0x5d'):return[{'name':_0xc4ad('0x5e'),'value':_0x3c3cbc[_0xc4ad('0x5e')]||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc['attrs'][0x0]?_0x3c3cbc[_0xc4ad('0x5a')][0x0][_0xc4ad('0x5b')]:undefined)||''}];case _0xc4ad('0x5f'):return[{'name':_0xc4ad('0x60'),'value':_0x3c3cbc[_0xc4ad('0x60')]||(_0x3c3cbc['attrs']&&_0x3c3cbc[_0xc4ad('0x5a')][0x0]?_0x3c3cbc['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xc4ad('0x61'),'value':_0x3c3cbc[_0xc4ad('0x61')]||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc['attrs'][0x1]?_0x3c3cbc[_0xc4ad('0x5a')][0x1]['value']:undefined)||_0xc4ad('0x62')},{'name':_0xc4ad('0x63'),'value':_0x3c3cbc[_0xc4ad('0x63')]||(_0x3c3cbc['attrs']&&_0x3c3cbc[_0xc4ad('0x5a')][0x2]?_0x3c3cbc[_0xc4ad('0x5a')][0x2][_0xc4ad('0x5b')]:undefined)||0xc}];case _0xc4ad('0x64'):return[{'name':_0xc4ad('0x65'),'value':_0x3c3cbc[_0xc4ad('0x65')]||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc[_0xc4ad('0x5a')][0x0]?_0x3c3cbc[_0xc4ad('0x5a')][0x0][_0xc4ad('0x5b')]:undefined)||'total'},{'name':_0xc4ad('0x66'),'value':_0x3c3cbc[_0xc4ad('0x66')]||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc['attrs'][0x1]?_0x3c3cbc['attrs'][0x1][_0xc4ad('0x5b')]:undefined)||[]},{'name':'attrFontSize','value':_0x3c3cbc[_0xc4ad('0x63')]||(_0x3c3cbc['attrs']&&_0x3c3cbc['attrs'][0x2]?_0x3c3cbc['attrs'][0x2][_0xc4ad('0x5b')]:undefined)||0x14},{'name':_0xc4ad('0x67'),'value':_0x3c3cbc['attrChannel']||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc[_0xc4ad('0x5a')][0x3]?_0x3c3cbc['attrs'][0x3]['value']:undefined)||_0xc4ad('0x68')},{'name':'attrEmailAccounts','value':_0x3c3cbc[_0xc4ad('0x69')]||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc[_0xc4ad('0x5a')][0x4]?_0x3c3cbc['attrs'][0x4]['value']:undefined)||''},{'name':_0xc4ad('0x6a'),'value':_0x3c3cbc['attrFaxAccounts']||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc[_0xc4ad('0x5a')][0x5]?_0x3c3cbc[_0xc4ad('0x5a')][0x5][_0xc4ad('0x5b')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3c3cbc[_0xc4ad('0x6b')]||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc[_0xc4ad('0x5a')][0x6]?_0x3c3cbc[_0xc4ad('0x5a')][0x6][_0xc4ad('0x5b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3c3cbc[_0xc4ad('0x6c')]||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc[_0xc4ad('0x5a')][0x7]?_0x3c3cbc['attrs'][0x7]['value']:undefined)||''},{'name':_0xc4ad('0x6d'),'value':_0x3c3cbc[_0xc4ad('0x6d')]||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc[_0xc4ad('0x5a')][0x8]?_0x3c3cbc[_0xc4ad('0x5a')][0x8][_0xc4ad('0x5b')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3c3cbc['attrChatWebsites']||(_0x3c3cbc['attrs']&&_0x3c3cbc[_0xc4ad('0x5a')][0x9]?_0x3c3cbc[_0xc4ad('0x5a')][0x9][_0xc4ad('0x5b')]:undefined)||''}];case'multibar-chart':case _0xc4ad('0x6e'):return[{'name':_0xc4ad('0x6f'),'value':_0x3c3cbc[_0xc4ad('0x6f')]||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc['attrs'][0x0]?_0x3c3cbc[_0xc4ad('0x5a')][0x0][_0xc4ad('0x5b')]:undefined)||_0xc4ad('0x70')},{'name':_0xc4ad('0x71'),'value':_0x3c3cbc['attrSerie2']||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc[_0xc4ad('0x5a')][0x1]?_0x3c3cbc[_0xc4ad('0x5a')][0x1]['value']:undefined)||null},{'name':_0xc4ad('0x72'),'value':_0x3c3cbc[_0xc4ad('0x72')]||(_0x3c3cbc['attrs']&&_0x3c3cbc[_0xc4ad('0x5a')][0x2]?_0x3c3cbc['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x3c3cbc[_0xc4ad('0x66')]||(_0x3c3cbc['attrs']&&_0x3c3cbc[_0xc4ad('0x5a')][0x3]?_0x3c3cbc[_0xc4ad('0x5a')][0x3][_0xc4ad('0x5b')]:undefined)||[]},{'name':_0xc4ad('0x67'),'value':_0x3c3cbc[_0xc4ad('0x67')]||(_0x3c3cbc['attrs']&&_0x3c3cbc[_0xc4ad('0x5a')][0x4]?_0x3c3cbc[_0xc4ad('0x5a')][0x4][_0xc4ad('0x5b')]:undefined)||_0xc4ad('0x68')},{'name':_0xc4ad('0x69'),'value':_0x3c3cbc[_0xc4ad('0x69')]||(_0x3c3cbc['attrs']&&_0x3c3cbc[_0xc4ad('0x5a')][0x5]?_0x3c3cbc[_0xc4ad('0x5a')][0x5][_0xc4ad('0x5b')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3c3cbc['attrFaxAccounts']||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc['attrs'][0x6]?_0x3c3cbc[_0xc4ad('0x5a')][0x6]['value']:undefined)||''},{'name':_0xc4ad('0x6b'),'value':_0x3c3cbc[_0xc4ad('0x6b')]||(_0x3c3cbc['attrs']&&_0x3c3cbc[_0xc4ad('0x5a')][0x7]?_0x3c3cbc[_0xc4ad('0x5a')][0x7]['value']:undefined)||''},{'name':_0xc4ad('0x6c'),'value':_0x3c3cbc['attrOpenchannelAccounts']||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc['attrs'][0x8]?_0x3c3cbc[_0xc4ad('0x5a')][0x8][_0xc4ad('0x5b')]:undefined)||''},{'name':_0xc4ad('0x6d'),'value':_0x3c3cbc[_0xc4ad('0x6d')]||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc[_0xc4ad('0x5a')][0x9]?_0x3c3cbc[_0xc4ad('0x5a')][0x9][_0xc4ad('0x5b')]:undefined)||''},{'name':_0xc4ad('0x73'),'value':_0x3c3cbc[_0xc4ad('0x73')]||(_0x3c3cbc['attrs']&&_0x3c3cbc['attrs'][0xa]?_0x3c3cbc[_0xc4ad('0x5a')][0xa]['value']:undefined)||''}];case _0xc4ad('0x74'):return[{'name':'attrReport','type':_0x3c3cbc[_0xc4ad('0x75')]||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc['attrs'][0x0]?_0x3c3cbc[_0xc4ad('0x5a')][0x0][_0xc4ad('0x31')]:undefined)||null,'value':_0x3c3cbc[_0xc4ad('0x76')]||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc[_0xc4ad('0x5a')][0x0]?_0x3c3cbc[_0xc4ad('0x5a')][0x0][_0xc4ad('0x5b')]:undefined)||null},{'name':_0xc4ad('0x77'),'value':_0x3c3cbc[_0xc4ad('0x77')]||(_0x3c3cbc[_0xc4ad('0x5a')]&&_0x3c3cbc[_0xc4ad('0x5a')][0x1]?_0x3c3cbc[_0xc4ad('0x5a')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x22328d){logger[_0xc4ad('0x2b')]('widgetAttributes:\x20%s',JSON['stringify'](_0x22328d));return[];}}exports[_0xc4ad('0x78')]=function(_0x2e5668,_0x13a9ea,_0x3b72c4){if(_0x2e5668[_0xc4ad('0x4b')]['id']){delete _0x2e5668[_0xc4ad('0x4b')]['id'];}return db['Dashboard'][_0xc4ad('0x49')]({'where':{'id':_0x2e5668[_0xc4ad('0x47')]['id']}})[_0xc4ad('0x26')](handleEntityNotFound(_0x13a9ea,null))['then'](function(_0x50c023){if(_0x50c023){_0x2e5668[_0xc4ad('0x4b')][_0xc4ad('0x79')]=_0x50c023['id'];_0x2e5668[_0xc4ad('0x4b')][_0xc4ad('0x5a')]=widgetAttributes(_0x2e5668[_0xc4ad('0x4b')]);return db[_0xc4ad('0x7a')][_0xc4ad('0x4a')](_0x2e5668[_0xc4ad('0x4b')]);}})[_0xc4ad('0x26')](respondWithResult(_0x13a9ea,null))[_0xc4ad('0x46')](handleError(_0x13a9ea,null));};exports['getItems']=function(_0xda9a48,_0x2312cb,_0x12f930){var _0xe15b0f={};var _0x3f93b4={};var _0xb330cd;var _0x3ba3b3;return db['Dashboard']['findOne']({'where':{'id':_0xda9a48[_0xc4ad('0x47')]['id']}})[_0xc4ad('0x26')](handleEntityNotFound(_0x2312cb,null))['then'](function(_0x20b10c){if(_0x20b10c){_0xb330cd=_0x20b10c;_0x3f93b4[_0xc4ad('0x33')]=_[_0xc4ad('0x54')](db[_0xc4ad('0x7a')]['rawAttributes']);_0x3f93b4[_0xc4ad('0x34')]=_[_0xc4ad('0x54')](_0xda9a48[_0xc4ad('0x34')]);_0x3f93b4[_0xc4ad('0x35')]=_['intersection'](_0x3f93b4[_0xc4ad('0x33')],_0x3f93b4[_0xc4ad('0x34')]);_0xe15b0f[_0xc4ad('0x37')]=_[_0xc4ad('0x36')](_0x3f93b4[_0xc4ad('0x33')],qs[_0xc4ad('0x38')](_0xda9a48[_0xc4ad('0x34')][_0xc4ad('0x38')]));_0xe15b0f['attributes']=_0xe15b0f['attributes'][_0xc4ad('0x39')]?_0xe15b0f['attributes']:_0x3f93b4[_0xc4ad('0x33')];_0xe15b0f[_0xc4ad('0x3c')]=qs['sort'](_0xda9a48['query'][_0xc4ad('0x3d')]);_0xe15b0f[_0xc4ad('0x3e')]=qs[_0xc4ad('0x35')](_[_0xc4ad('0x3f')](_0xda9a48['query'],_0x3f93b4[_0xc4ad('0x35')]));if(_0xda9a48[_0xc4ad('0x34')][_0xc4ad('0x40')]){_0xe15b0f['where']=_[_0xc4ad('0x41')](_0xe15b0f['where'],{'$or':_[_0xc4ad('0x2e')](_0xe15b0f[_0xc4ad('0x37')],function(_0xf4ab04){var _0x872f3={};_0x872f3[_0xf4ab04]={'$like':'%'+_0xda9a48[_0xc4ad('0x34')][_0xc4ad('0x40')]+'%'};return _0x872f3;})});}_0xe15b0f=_[_0xc4ad('0x41')]({},_0xe15b0f,_0xda9a48[_0xc4ad('0x43')]);return _0xb330cd[_0xc4ad('0x7b')](_0xe15b0f);}})[_0xc4ad('0x26')](function(_0x200bce){if(_0x200bce){_0x3ba3b3=_0x200bce[_0xc4ad('0x39')];if(!_0xda9a48[_0xc4ad('0x34')][_0xc4ad('0x3a')](_0xc4ad('0x3b'))){_0xe15b0f[_0xc4ad('0x1f')]=qs[_0xc4ad('0x1f')](_0xda9a48['query'][_0xc4ad('0x1f')]);_0xe15b0f[_0xc4ad('0x1d')]=qs['offset'](_0xda9a48[_0xc4ad('0x34')][_0xc4ad('0x1d')]);}return _0xb330cd[_0xc4ad('0x7b')](_0xe15b0f);}})[_0xc4ad('0x26')](function(_0x1b5804){if(_0x1b5804){return _0x1b5804?{'count':_0x3ba3b3,'rows':_0x1b5804}:null;}})[_0xc4ad('0x26')](respondWithResult(_0x2312cb,null))['catch'](handleError(_0x2312cb,null));};
\ No newline at end of file
+var _0x891e=['clone','intersection','omit','createdAt','updatedAt','user','error','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','getItems','findOne','DashboardItem','hasOwnProperty','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./dashboard.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','CustomDashboards','UserProfileResource','destroy','name','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','nolimit','order','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xefd3e6,_0x10d71e){var _0x52a204=function(_0x14222e){while(--_0x14222e){_0xefd3e6['push'](_0xefd3e6['shift']());}};_0x52a204(++_0x10d71e);}(_0x891e,0x1b6));var _0xe891=function(_0x16e5d1,_0x9cf085){_0x16e5d1=_0x16e5d1-0x0;var _0x3f72e6=_0x891e[_0x16e5d1];return _0x3f72e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe891('0x0'));var zipdir=require(_0xe891('0x1'));var jsonpatch=require(_0xe891('0x2'));var rp=require('request-promise');var moment=require(_0xe891('0x3'));var BPromise=require(_0xe891('0x4'));var Mustache=require(_0xe891('0x5'));var util=require(_0xe891('0x6'));var path=require(_0xe891('0x7'));var sox=require('sox');var csv=require(_0xe891('0x8'));var ejs=require(_0xe891('0x9'));var fs=require('fs');var fs_extra=require(_0xe891('0xa'));var _=require(_0xe891('0xb'));var squel=require(_0xe891('0xc'));var crypto=require(_0xe891('0xd'));var jsforce=require(_0xe891('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe891('0x8'));var querystring=require(_0xe891('0xf'));var Papa=require(_0xe891('0x10'));var Redis=require(_0xe891('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe891('0x12'));var as=require(_0xe891('0x13'));var hardwareService=require(_0xe891('0x14'));var logger=require(_0xe891('0x15'))(_0xe891('0x16'));var utils=require(_0xe891('0x17'));var config=require(_0xe891('0x18'));var licenseUtil=require(_0xe891('0x19'));var db=require('../../mysqldb')['db'];config[_0xe891('0x1a')]=_[_0xe891('0x1b')](config[_0xe891('0x1a')],{'host':_0xe891('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe891('0x1a')]));require(_0xe891('0x1d'))['register'](socket);function respondWithStatusCode(_0x48f1a5,_0x4ae6b8){_0x4ae6b8=_0x4ae6b8||0xcc;return function(_0x473876){if(_0x473876){return _0x48f1a5[_0xe891('0x1e')](_0x4ae6b8);}return _0x48f1a5[_0xe891('0x1f')](_0x4ae6b8)[_0xe891('0x20')]();};}function respondWithResult(_0x270a58,_0xdabd5c){_0xdabd5c=_0xdabd5c||0xc8;return function(_0x4bc829){if(_0x4bc829){return _0x270a58['status'](_0xdabd5c)[_0xe891('0x21')](_0x4bc829);}};}function respondWithFilteredResult(_0x29b967,_0xb97e88){return function(_0xb3dbd0){if(_0xb3dbd0){var _0x559b61=typeof _0xb97e88[_0xe891('0x22')]===_0xe891('0x23')&&typeof _0xb97e88['limit']===_0xe891('0x23');var _0xe51f0a=_0xb3dbd0[_0xe891('0x24')];var _0xa0ca2e=_0x559b61?0x0:_0xb97e88[_0xe891('0x22')];var _0x44f0f3=_0x559b61?_0xb3dbd0[_0xe891('0x24')]:_0xb97e88[_0xe891('0x22')]+_0xb97e88[_0xe891('0x25')];var _0xf9e928;if(_0x44f0f3>=_0xe51f0a){_0x44f0f3=_0xe51f0a;_0xf9e928=0xc8;}else{_0xf9e928=0xce;}_0x29b967[_0xe891('0x1f')](_0xf9e928);return _0x29b967[_0xe891('0x26')](_0xe891('0x27'),_0xa0ca2e+'-'+_0x44f0f3+'/'+_0xe51f0a)['json'](_0xb3dbd0);}return null;};}function patchUpdates(_0xa88afe){return function(_0xd57666){try{jsonpatch[_0xe891('0x28')](_0xd57666,_0xa88afe,!![]);}catch(_0x3d403b){return BPromise[_0xe891('0x29')](_0x3d403b);}return _0xd57666[_0xe891('0x2a')]();};}function saveUpdates(_0x119252,_0x264bbd){return function(_0x319c24){if(_0x319c24){return _0x319c24[_0xe891('0x2b')](_0x119252)['then'](function(_0x9d49b0){return _0x9d49b0;});}return null;};}function removeEntity(_0x2d464b,_0x12b171){return function(_0x27009d){if(_0x27009d){return _0x27009d['destroy']()[_0xe891('0x2c')](function(){var _0x1a1b8d=_0x27009d['get']({'plain':!![]});var _0xefb27e=_0xe891('0x2d');return db[_0xe891('0x2e')][_0xe891('0x2f')]({'where':{'type':_0xefb27e,'resourceId':_0x1a1b8d['id']}})[_0xe891('0x2c')](function(){return _0x27009d;});})['then'](function(){_0x2d464b[_0xe891('0x1f')](0xcc)[_0xe891('0x20')]();});}};}function handleEntityNotFound(_0x5bb787,_0x41ffc7){return function(_0x80e889){if(!_0x80e889){_0x5bb787[_0xe891('0x1e')](0x194);}return _0x80e889;};}function handleError(_0x11f00e,_0x249d03){_0x249d03=_0x249d03||0x1f4;return function(_0x3835c0){logger['error'](_0x3835c0['stack']);if(_0x3835c0[_0xe891('0x30')]){delete _0x3835c0[_0xe891('0x30')];}_0x11f00e[_0xe891('0x1f')](_0x249d03)['send'](_0x3835c0);};}exports['index']=function(_0x24502f,_0x54046d){var _0x1b4b64={},_0x3d08d5={},_0x318c93={'count':0x0,'rows':[]};var _0x19f719=_[_0xe891('0x31')](db[_0xe891('0x32')][_0xe891('0x33')],function(_0x1a6598){return{'name':_0x1a6598[_0xe891('0x34')],'type':_0x1a6598[_0xe891('0x35')][_0xe891('0x36')]};});_0x3d08d5[_0xe891('0x37')]=_[_0xe891('0x31')](_0x19f719,_0xe891('0x30'));_0x3d08d5['query']=_[_0xe891('0x38')](_0x24502f[_0xe891('0x39')]);_0x3d08d5[_0xe891('0x3a')]=_['intersection'](_0x3d08d5['model'],_0x3d08d5[_0xe891('0x39')]);_0x1b4b64[_0xe891('0x3b')]=_['intersection'](_0x3d08d5[_0xe891('0x37')],qs['fields'](_0x24502f['query'][_0xe891('0x3c')]));_0x1b4b64[_0xe891('0x3b')]=_0x1b4b64[_0xe891('0x3b')][_0xe891('0x3d')]?_0x1b4b64[_0xe891('0x3b')]:_0x3d08d5['model'];if(!_0x24502f[_0xe891('0x39')]['hasOwnProperty'](_0xe891('0x3e'))){_0x1b4b64[_0xe891('0x25')]=qs[_0xe891('0x25')](_0x24502f[_0xe891('0x39')][_0xe891('0x25')]);_0x1b4b64['offset']=qs[_0xe891('0x22')](_0x24502f[_0xe891('0x39')][_0xe891('0x22')]);}_0x1b4b64[_0xe891('0x3f')]=qs[_0xe891('0x40')](_0x24502f['query'][_0xe891('0x40')]);_0x1b4b64['where']=qs[_0xe891('0x3a')](_['pick'](_0x24502f['query'],_0x3d08d5[_0xe891('0x3a')]),_0x19f719);if(_0x24502f[_0xe891('0x39')][_0xe891('0x41')]){_0x1b4b64['where']=_[_0xe891('0x42')](_0x1b4b64[_0xe891('0x43')],{'$or':_['map'](_0x19f719,function(_0x4c94dc){if(_0x4c94dc['type']!=='VIRTUAL'){var _0x7ea718={};_0x7ea718[_0x4c94dc[_0xe891('0x30')]]={'$like':'%'+_0x24502f[_0xe891('0x39')][_0xe891('0x41')]+'%'};return _0x7ea718;}})});}_0x1b4b64=_['merge']({},_0x1b4b64,_0x24502f[_0xe891('0x44')]);var _0x5553fc={'where':_0x1b4b64[_0xe891('0x43')]};return db['Dashboard'][_0xe891('0x24')](_0x5553fc)[_0xe891('0x2c')](function(_0x2c9f3f){_0x318c93[_0xe891('0x24')]=_0x2c9f3f;if(_0x24502f[_0xe891('0x39')][_0xe891('0x45')]){_0x1b4b64[_0xe891('0x46')]=[{'all':!![]}];}return db[_0xe891('0x32')][_0xe891('0x47')](_0x1b4b64);})['then'](function(_0x41e71c){_0x318c93[_0xe891('0x48')]=_0x41e71c;return _0x318c93;})[_0xe891('0x2c')](respondWithFilteredResult(_0x54046d,_0x1b4b64))[_0xe891('0x49')](handleError(_0x54046d,null));};exports[_0xe891('0x4a')]=function(_0x509c27,_0x30f41c){var _0x59a7c8={'raw':![],'where':{'id':_0x509c27[_0xe891('0x4b')]['id']}},_0x2b1c70={};_0x2b1c70[_0xe891('0x37')]=_['keys'](db['Dashboard'][_0xe891('0x33')]);_0x2b1c70['query']=_[_0xe891('0x38')](_0x509c27[_0xe891('0x39')]);_0x2b1c70[_0xe891('0x3a')]=_['intersection'](_0x2b1c70[_0xe891('0x37')],_0x2b1c70['query']);_0x59a7c8[_0xe891('0x3b')]=_['intersection'](_0x2b1c70[_0xe891('0x37')],qs['fields'](_0x509c27[_0xe891('0x39')][_0xe891('0x3c')]));_0x59a7c8[_0xe891('0x3b')]=_0x59a7c8['attributes'][_0xe891('0x3d')]?_0x59a7c8[_0xe891('0x3b')]:_0x2b1c70[_0xe891('0x37')];if(_0x509c27[_0xe891('0x39')][_0xe891('0x45')]){_0x59a7c8[_0xe891('0x46')]=[{'all':!![]}];}_0x59a7c8=_['merge']({},_0x59a7c8,_0x509c27['options']);return db[_0xe891('0x32')][_0xe891('0x4c')](_0x59a7c8)[_0xe891('0x2c')](handleEntityNotFound(_0x30f41c,null))[_0xe891('0x2c')](respondWithResult(_0x30f41c,null))['catch'](handleError(_0x30f41c,null));};exports['create']=function(_0x546b67,_0x2c1c4c){return db[_0xe891('0x32')][_0xe891('0x4d')](_0x546b67[_0xe891('0x4e')],{})['then'](function(_0x28d6a2){var _0xd9ab7d=_0x546b67['user']['get']({'plain':!![]});if(!_0xd9ab7d)throw new Error(_0xe891('0x4f'));if(_0xd9ab7d[_0xe891('0x50')]==='user'){var _0x2d00cb=_0x28d6a2[_0xe891('0x51')]({'plain':!![]});var _0xed25f=_0xe891('0x2d');return db[_0xe891('0x52')]['find']({'where':{'name':_0xed25f,'userProfileId':_0xd9ab7d[_0xe891('0x53')]},'raw':!![]})[_0xe891('0x2c')](function(_0x1f17ac){if(_0x1f17ac&&_0x1f17ac[_0xe891('0x54')]===0x0){return db[_0xe891('0x2e')][_0xe891('0x4d')]({'name':_0x2d00cb[_0xe891('0x30')],'resourceId':_0x2d00cb['id'],'type':_0x1f17ac['name'],'sectionId':_0x1f17ac['id']},{})['then'](function(){return _0x28d6a2;});}else{return _0x28d6a2;}})[_0xe891('0x49')](function(_0x349566){logger['error'](_0xe891('0x55'),_0x349566);throw _0x349566;});}return _0x28d6a2;})[_0xe891('0x2c')](respondWithResult(_0x2c1c4c,0xc9))[_0xe891('0x49')](handleError(_0x2c1c4c,null));};exports[_0xe891('0x56')]=function(_0xa7a248,_0x393456){var _0x39ec87={'where':{'id':_0xa7a248[_0xe891('0x4b')]['id']}},_0xdcd081={};_0xdcd081[_0xe891('0x37')]=_['keys'](db[_0xe891('0x32')][_0xe891('0x33')]);_0x39ec87['attributes']=_[_0xe891('0x57')](_0xdcd081['model'],qs[_0xe891('0x3c')](_0xa7a248[_0xe891('0x39')][_0xe891('0x3c')]));_0x39ec87[_0xe891('0x3b')]=_0x39ec87['attributes'][_0xe891('0x3d')]?_0x39ec87[_0xe891('0x3b')]:_0xdcd081['model'];if(_0xa7a248[_0xe891('0x39')][_0xe891('0x45')]){_0x39ec87[_0xe891('0x46')]=[{'all':!![]}];}_0x39ec87=_[_0xe891('0x42')]({},_0x39ec87,_0xa7a248[_0xe891('0x44')]);return db[_0xe891('0x32')][_0xe891('0x4c')](_0x39ec87)[_0xe891('0x2c')](handleEntityNotFound(_0x393456,null))[_0xe891('0x2c')](function(_0x45b1f1){if(_0x45b1f1){var _0x10e35d=_0x45b1f1[_0xe891('0x51')]({'plain':!![]});_0x10e35d=qs[_0xe891('0x58')](_0x10e35d,['id',_0xe891('0x59'),_0xe891('0x5a')]);_0xa7a248[_0xe891('0x4e')]=_[_0xe891('0x58')](_0xa7a248[_0xe891('0x4e')],['id','createdAt',_0xe891('0x5a')]);return db[_0xe891('0x32')][_0xe891('0x4d')](_[_0xe891('0x42')](_0x10e35d,_0xa7a248['body']),{'include':_0xa7a248[_0xe891('0x39')][_0xe891('0x45')]?[{'all':!![]}]:undefined})[_0xe891('0x2c')](function(_0x1c5a24){var _0x3a204d=_0xa7a248['user'][_0xe891('0x51')]({'plain':!![]});if(!_0x3a204d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a204d[_0xe891('0x50')]===_0xe891('0x5b')){var _0x1a90bd=_0x1c5a24[_0xe891('0x51')]({'plain':!![]});var _0x31b10c=_0xe891('0x2d');return db[_0xe891('0x52')][_0xe891('0x4c')]({'where':{'name':_0x31b10c,'userProfileId':_0x3a204d[_0xe891('0x53')]},'raw':!![]})[_0xe891('0x2c')](function(_0x3dfd4f){if(_0x3dfd4f&&_0x3dfd4f[_0xe891('0x54')]===0x0){return db[_0xe891('0x2e')][_0xe891('0x4d')]({'name':_0x1a90bd[_0xe891('0x30')],'resourceId':_0x1a90bd['id'],'type':_0x3dfd4f['name'],'sectionId':_0x3dfd4f['id']},{})[_0xe891('0x2c')](function(){return _0x1c5a24;});}else{return _0x1c5a24;}})[_0xe891('0x49')](function(_0x441861){logger[_0xe891('0x5c')](_0xe891('0x55'),_0x441861);throw _0x441861;});}return _0x1c5a24;});}})[_0xe891('0x2c')](respondWithResult(_0x393456,0xc9))[_0xe891('0x49')](handleError(_0x393456,null));};exports['update']=function(_0x285c41,_0x42ecc5){if(_0x285c41[_0xe891('0x4e')]['id']){delete _0x285c41['body']['id'];}return db[_0xe891('0x32')]['find']({'where':{'id':_0x285c41[_0xe891('0x4b')]['id']}})[_0xe891('0x2c')](handleEntityNotFound(_0x42ecc5,null))['then'](saveUpdates(_0x285c41[_0xe891('0x4e')],null))['then'](respondWithResult(_0x42ecc5,null))[_0xe891('0x49')](handleError(_0x42ecc5,null));};exports[_0xe891('0x2f')]=function(_0x666154,_0x29a2e2){return db['Dashboard'][_0xe891('0x4c')]({'where':{'id':_0x666154[_0xe891('0x4b')]['id']}})[_0xe891('0x2c')](handleEntityNotFound(_0x29a2e2,null))['then'](removeEntity(_0x29a2e2,null))[_0xe891('0x49')](handleError(_0x29a2e2,null));};function widgetAttributes(_0x39981e){try{switch(_0x39981e[_0xe891('0x35')]){case _0xe891('0x5d'):return[{'name':_0xe891('0x5e'),'value':_0x39981e[_0xe891('0x5e')]||(_0x39981e['attrs']&&_0x39981e[_0xe891('0x5f')][0x0]?_0x39981e[_0xe891('0x5f')][0x0][_0xe891('0x60')]:undefined)||_0xe891('0x61')}];case _0xe891('0x62'):return[{'name':_0xe891('0x63'),'value':_0x39981e[_0xe891('0x63')]||(_0x39981e['attrs']&&_0x39981e[_0xe891('0x5f')][0x0]?_0x39981e['attrs'][0x0][_0xe891('0x60')]:undefined)||''}];case _0xe891('0x64'):return[{'name':_0xe891('0x65'),'value':_0x39981e['attrHourFormat']||(_0x39981e[_0xe891('0x5f')]&&_0x39981e[_0xe891('0x5f')][0x0]?_0x39981e['attrs'][0x0][_0xe891('0x60')]:undefined)||'HH:mm:ss'},{'name':_0xe891('0x66'),'value':_0x39981e[_0xe891('0x66')]||(_0x39981e[_0xe891('0x5f')]&&_0x39981e[_0xe891('0x5f')][0x1]?_0x39981e[_0xe891('0x5f')][0x1]['value']:undefined)||'0.00'},{'name':_0xe891('0x67'),'value':_0x39981e['attrFontSize']||(_0x39981e[_0xe891('0x5f')]&&_0x39981e[_0xe891('0x5f')][0x2]?_0x39981e['attrs'][0x2]['value']:undefined)||0xc}];case _0xe891('0x68'):return[{'name':_0xe891('0x69'),'value':_0x39981e[_0xe891('0x69')]||(_0x39981e['attrs']&&_0x39981e['attrs'][0x0]?_0x39981e[_0xe891('0x5f')][0x0]['value']:undefined)||_0xe891('0x6a')},{'name':_0xe891('0x6b'),'value':_0x39981e['attrVoiceQueues']||(_0x39981e[_0xe891('0x5f')]&&_0x39981e[_0xe891('0x5f')][0x1]?_0x39981e[_0xe891('0x5f')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x39981e[_0xe891('0x67')]||(_0x39981e[_0xe891('0x5f')]&&_0x39981e['attrs'][0x2]?_0x39981e[_0xe891('0x5f')][0x2][_0xe891('0x60')]:undefined)||0x14},{'name':'attrChannel','value':_0x39981e[_0xe891('0x6c')]||(_0x39981e['attrs']&&_0x39981e[_0xe891('0x5f')][0x3]?_0x39981e[_0xe891('0x5f')][0x3]['value']:undefined)||'voice'},{'name':_0xe891('0x6d'),'value':_0x39981e[_0xe891('0x6d')]||(_0x39981e['attrs']&&_0x39981e[_0xe891('0x5f')][0x4]?_0x39981e[_0xe891('0x5f')][0x4]['value']:undefined)||''},{'name':_0xe891('0x6e'),'value':_0x39981e[_0xe891('0x6e')]||(_0x39981e[_0xe891('0x5f')]&&_0x39981e[_0xe891('0x5f')][0x5]?_0x39981e['attrs'][0x5][_0xe891('0x60')]:undefined)||''},{'name':_0xe891('0x6f'),'value':_0x39981e[_0xe891('0x6f')]||(_0x39981e['attrs']&&_0x39981e[_0xe891('0x5f')][0x6]?_0x39981e[_0xe891('0x5f')][0x6][_0xe891('0x60')]:undefined)||''},{'name':_0xe891('0x70'),'value':_0x39981e['attrOpenchannelAccounts']||(_0x39981e[_0xe891('0x5f')]&&_0x39981e[_0xe891('0x5f')][0x7]?_0x39981e['attrs'][0x7][_0xe891('0x60')]:undefined)||''},{'name':_0xe891('0x71'),'value':_0x39981e['attrWhatsappAccounts']||(_0x39981e[_0xe891('0x5f')]&&_0x39981e[_0xe891('0x5f')][0x8]?_0x39981e['attrs'][0x8][_0xe891('0x60')]:undefined)||''},{'name':_0xe891('0x72'),'value':_0x39981e[_0xe891('0x72')]||(_0x39981e[_0xe891('0x5f')]&&_0x39981e['attrs'][0x9]?_0x39981e[_0xe891('0x5f')][0x9][_0xe891('0x60')]:undefined)||''}];case _0xe891('0x73'):case _0xe891('0x74'):return[{'name':_0xe891('0x75'),'value':_0x39981e[_0xe891('0x75')]||(_0x39981e[_0xe891('0x5f')]&&_0x39981e[_0xe891('0x5f')][0x0]?_0x39981e[_0xe891('0x5f')][0x0][_0xe891('0x60')]:undefined)||'total'},{'name':_0xe891('0x76'),'value':_0x39981e[_0xe891('0x76')]||(_0x39981e['attrs']&&_0x39981e[_0xe891('0x5f')][0x1]?_0x39981e[_0xe891('0x5f')][0x1][_0xe891('0x60')]:undefined)||null},{'name':_0xe891('0x77'),'value':_0x39981e[_0xe891('0x77')]||(_0x39981e[_0xe891('0x5f')]&&_0x39981e['attrs'][0x2]?_0x39981e['attrs'][0x2][_0xe891('0x60')]:undefined)||null},{'name':_0xe891('0x6b'),'value':_0x39981e[_0xe891('0x6b')]||(_0x39981e[_0xe891('0x5f')]&&_0x39981e[_0xe891('0x5f')][0x3]?_0x39981e[_0xe891('0x5f')][0x3]['value']:undefined)||[]},{'name':_0xe891('0x6c'),'value':_0x39981e[_0xe891('0x6c')]||(_0x39981e['attrs']&&_0x39981e['attrs'][0x4]?_0x39981e[_0xe891('0x5f')][0x4]['value']:undefined)||_0xe891('0x78')},{'name':_0xe891('0x6d'),'value':_0x39981e[_0xe891('0x6d')]||(_0x39981e['attrs']&&_0x39981e[_0xe891('0x5f')][0x5]?_0x39981e[_0xe891('0x5f')][0x5][_0xe891('0x60')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x39981e[_0xe891('0x6e')]||(_0x39981e[_0xe891('0x5f')]&&_0x39981e[_0xe891('0x5f')][0x6]?_0x39981e['attrs'][0x6][_0xe891('0x60')]:undefined)||''},{'name':_0xe891('0x6f'),'value':_0x39981e[_0xe891('0x6f')]||(_0x39981e[_0xe891('0x5f')]&&_0x39981e[_0xe891('0x5f')][0x7]?_0x39981e[_0xe891('0x5f')][0x7][_0xe891('0x60')]:undefined)||''},{'name':_0xe891('0x70'),'value':_0x39981e[_0xe891('0x70')]||(_0x39981e['attrs']&&_0x39981e['attrs'][0x8]?_0x39981e[_0xe891('0x5f')][0x8][_0xe891('0x60')]:undefined)||''},{'name':_0xe891('0x71'),'value':_0x39981e[_0xe891('0x71')]||(_0x39981e[_0xe891('0x5f')]&&_0x39981e[_0xe891('0x5f')][0x9]?_0x39981e[_0xe891('0x5f')][0x9][_0xe891('0x60')]:undefined)||''},{'name':'attrChatWebsites','value':_0x39981e[_0xe891('0x72')]||(_0x39981e['attrs']&&_0x39981e[_0xe891('0x5f')][0xa]?_0x39981e[_0xe891('0x5f')][0xa]['value']:undefined)||''}];case _0xe891('0x79'):return[{'name':'attrReport','type':_0x39981e[_0xe891('0x7a')]||(_0x39981e['attrs']&&_0x39981e['attrs'][0x0]?_0x39981e[_0xe891('0x5f')][0x0][_0xe891('0x35')]:undefined)||null,'value':_0x39981e['attrReport']||(_0x39981e[_0xe891('0x5f')]&&_0x39981e[_0xe891('0x5f')][0x0]?_0x39981e[_0xe891('0x5f')][0x0][_0xe891('0x60')]:undefined)||null},{'name':'attrRefresh','value':_0x39981e[_0xe891('0x7b')]||(_0x39981e['attrs']&&_0x39981e[_0xe891('0x5f')][0x1]?_0x39981e['attrs'][0x1][_0xe891('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x4ee2fd){logger[_0xe891('0x5c')](_0xe891('0x7c'),JSON['stringify'](_0x4ee2fd));return[];}}exports[_0xe891('0x7d')]=function(_0x15a20c,_0xf1b0a3,_0x344e93){if(_0x15a20c[_0xe891('0x4e')]['id']){delete _0x15a20c[_0xe891('0x4e')]['id'];}return db[_0xe891('0x32')]['find']({'where':{'id':_0x15a20c[_0xe891('0x4b')]['id']}})[_0xe891('0x2c')](handleEntityNotFound(_0xf1b0a3,null))[_0xe891('0x2c')](function(_0x1185d0){if(_0x1185d0){_0x15a20c[_0xe891('0x4e')][_0xe891('0x7e')]=_0x1185d0['id'];_0x15a20c['body'][_0xe891('0x5f')]=widgetAttributes(_0x15a20c['body']);return db['DashboardItem'][_0xe891('0x4d')](_0x15a20c[_0xe891('0x4e')]);}})[_0xe891('0x2c')](respondWithResult(_0xf1b0a3,null))['catch'](handleError(_0xf1b0a3,null));};exports[_0xe891('0x7f')]=function(_0x5b31fc,_0x50ac27,_0x50ce74){var _0x580530={};var _0x3eb7a2={};var _0x424e62;var _0x1311d4;return db[_0xe891('0x32')][_0xe891('0x80')]({'where':{'id':_0x5b31fc[_0xe891('0x4b')]['id']}})['then'](handleEntityNotFound(_0x50ac27,null))[_0xe891('0x2c')](function(_0x5bc6df){if(_0x5bc6df){_0x424e62=_0x5bc6df;_0x3eb7a2['model']=_['keys'](db[_0xe891('0x81')][_0xe891('0x33')]);_0x3eb7a2[_0xe891('0x39')]=_[_0xe891('0x38')](_0x5b31fc[_0xe891('0x39')]);_0x3eb7a2[_0xe891('0x3a')]=_[_0xe891('0x57')](_0x3eb7a2['model'],_0x3eb7a2[_0xe891('0x39')]);_0x580530[_0xe891('0x3b')]=_[_0xe891('0x57')](_0x3eb7a2['model'],qs[_0xe891('0x3c')](_0x5b31fc[_0xe891('0x39')]['fields']));_0x580530[_0xe891('0x3b')]=_0x580530[_0xe891('0x3b')][_0xe891('0x3d')]?_0x580530[_0xe891('0x3b')]:_0x3eb7a2['model'];_0x580530['order']=qs[_0xe891('0x40')](_0x5b31fc[_0xe891('0x39')][_0xe891('0x40')]);_0x580530[_0xe891('0x43')]=qs['filters'](_['pick'](_0x5b31fc[_0xe891('0x39')],_0x3eb7a2['filters']));if(_0x5b31fc[_0xe891('0x39')][_0xe891('0x41')]){_0x580530[_0xe891('0x43')]=_[_0xe891('0x42')](_0x580530['where'],{'$or':_['map'](_0x580530['attributes'],function(_0x4251ea){var _0x1d92cc={};_0x1d92cc[_0x4251ea]={'$like':'%'+_0x5b31fc[_0xe891('0x39')][_0xe891('0x41')]+'%'};return _0x1d92cc;})});}_0x580530=_[_0xe891('0x42')]({},_0x580530,_0x5b31fc['options']);return _0x424e62['getItems'](_0x580530);}})[_0xe891('0x2c')](function(_0x24148b){if(_0x24148b){_0x1311d4=_0x24148b['length'];if(!_0x5b31fc[_0xe891('0x39')][_0xe891('0x82')]('nolimit')){_0x580530['limit']=qs[_0xe891('0x25')](_0x5b31fc[_0xe891('0x39')][_0xe891('0x25')]);_0x580530[_0xe891('0x22')]=qs[_0xe891('0x22')](_0x5b31fc['query'][_0xe891('0x22')]);}return _0x424e62[_0xe891('0x7f')](_0x580530);}})['then'](function(_0x1d37ab){if(_0x1d37ab){return _0x1d37ab?{'count':_0x1311d4,'rows':_0x1d37ab}:null;}})[_0xe891('0x2c')](respondWithResult(_0x50ac27,null))['catch'](handleError(_0x50ac27,null));};
\ No newline at end of file
index e52d1fd..c1dbbc3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7e1d=['hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x40b1ec,_0x324605){var _0x226bc7=function(_0x13a793){while(--_0x13a793){_0x40b1ec['push'](_0x40b1ec['shift']());}};_0x226bc7(++_0x324605);}(_0x7e1d,0x15a));var _0xd7e1=function(_0x499360,_0x20a256){_0x499360=_0x499360-0x0;var _0x422f01=_0x7e1d[_0x499360];return _0x422f01;};'use strict';var EventEmitter=require(_0xd7e1('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xd7e1('0x1')](0x0);var events={'afterCreate':_0xd7e1('0x2'),'afterUpdate':_0xd7e1('0x3'),'afterDestroy':_0xd7e1('0x4')};function emitEvent(_0x11af92){return function(_0x143b3f,_0x51424f,_0x28bddc){DashboardEvents[_0xd7e1('0x5')](_0x11af92+':'+_0x143b3f['id'],_0x143b3f);DashboardEvents[_0xd7e1('0x5')](_0x11af92,_0x143b3f);_0x28bddc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xd7e1('0x6')](e,emitEvent(event));}}module[_0xd7e1('0x7')]=DashboardEvents;
\ No newline at end of file
+var _0xf62d=['events','../../mysqldb','setMaxListeners','save','update','remove','hook'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0xf62d,0x1c0));var _0xdf62=function(_0x3544d6,_0xdb5f3f){_0x3544d6=_0x3544d6-0x0;var _0x247e37=_0xf62d[_0x3544d6];return _0x247e37;};'use strict';var EventEmitter=require(_0xdf62('0x0'));var Dashboard=require(_0xdf62('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xdf62('0x2')](0x0);var events={'afterCreate':_0xdf62('0x3'),'afterUpdate':_0xdf62('0x4'),'afterDestroy':_0xdf62('0x5')};function emitEvent(_0x2f7d73){return function(_0x451a23,_0x3fcfc7,_0x76ca4){DashboardEvents['emit'](_0x2f7d73+':'+_0x451a23['id'],_0x451a23);DashboardEvents['emit'](_0x2f7d73,_0x451a23);_0x76ca4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xdf62('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents;
\ No newline at end of file
index 9ff76e1..7abaf09 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc799=['Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./dashboard.attributes','exports','define'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0xc799,0x1a6));var _0x9c79=function(_0x2253f4,_0xbc511d){_0x2253f4=_0x2253f4-0x0;var _0x41f06c=_0xc799[_0x2253f4];return _0x41f06c;};'use strict';var _=require(_0x9c79('0x0'));var util=require(_0x9c79('0x1'));var logger=require(_0x9c79('0x2'))(_0x9c79('0x3'));var moment=require(_0x9c79('0x4'));var BPromise=require(_0x9c79('0x5'));var rp=require(_0x9c79('0x6'));var fs=require('fs');var path=require(_0x9c79('0x7'));var rimraf=require(_0x9c79('0x8'));var config=require('../../config/environment');var attributes=require(_0x9c79('0x9'));module[_0x9c79('0xa')]=function(_0x419a7f,_0x157883){return _0x419a7f[_0x9c79('0xb')](_0x9c79('0xc'),attributes,{'tableName':_0x9c79('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x1acc=['bluebird','request-promise','path','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','moment'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x1acc,0x15c));var _0xc1ac=function(_0x34880c,_0x4533fe){_0x34880c=_0x34880c-0x0;var _0x3ee14b=_0x1acc[_0x34880c];return _0x3ee14b;};'use strict';var _=require(_0xc1ac('0x0'));var util=require(_0xc1ac('0x1'));var logger=require(_0xc1ac('0x2'))('api');var moment=require(_0xc1ac('0x3'));var BPromise=require(_0xc1ac('0x4'));var rp=require(_0xc1ac('0x5'));var fs=require('fs');var path=require(_0xc1ac('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0xc1ac('0x7')]=function(_0x4effaf,_0x3581ac){return _0x4effaf[_0xc1ac('0x8')](_0xc1ac('0x9'),attributes,{'tableName':_0xc1ac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c505372..2d04235 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9af6=['socket.io-emitter','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x16ee9b,_0x34f102){var _0xa45ece=function(_0x45b169){while(--_0x45b169){_0x16ee9b['push'](_0x16ee9b['shift']());}};_0xa45ece(++_0x34f102);}(_0x9af6,0xca));var _0x69af=function(_0x1e8106,_0x548def){_0x1e8106=_0x1e8106-0x0;var _0x364dca=_0x9af6[_0x1e8106];return _0x364dca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x69af('0x0'));var BPromise=require(_0x69af('0x1'));var rs=require(_0x69af('0x2'));var fs=require('fs');var Redis=require(_0x69af('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x69af('0x4'));var logger=require(_0x69af('0x5'))(_0x69af('0x6'));var config=require(_0x69af('0x7'));var jayson=require(_0x69af('0x8'));var client=jayson[_0x69af('0x9')][_0x69af('0xa')]({'port':0x232a});config['redis']=_[_0x69af('0xb')](config[_0x69af('0xc')],{'host':_0x69af('0xd'),'port':0x18eb});var socket=require(_0x69af('0xe'))(new Redis(config[_0x69af('0xc')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x14823d,_0x4dbc4c,_0x253c8b){return new BPromise(function(_0x3593e4,_0xba7127){return client[_0x69af('0xf')](_0x14823d,_0x253c8b)['then'](function(_0x1d2748){logger[_0x69af('0x10')](_0x69af('0x11'),_0x4dbc4c,_0x69af('0x12'));logger[_0x69af('0x13')](_0x69af('0x14'),_0x4dbc4c,_0x69af('0x12'),JSON[_0x69af('0x15')](_0x1d2748));if(_0x1d2748[_0x69af('0x16')]){if(_0x1d2748[_0x69af('0x16')][_0x69af('0x17')]===0x1f4){logger[_0x69af('0x16')]('Dashboard,\x20%s,\x20%s',_0x4dbc4c,_0x1d2748[_0x69af('0x16')][_0x69af('0x18')]);return _0xba7127(_0x1d2748['error'][_0x69af('0x18')]);}logger[_0x69af('0x16')](_0x69af('0x11'),_0x4dbc4c,_0x1d2748[_0x69af('0x16')][_0x69af('0x18')]);return _0x3593e4(_0x1d2748[_0x69af('0x16')][_0x69af('0x18')]);}else{logger[_0x69af('0x10')]('Dashboard,\x20%s,\x20%s',_0x4dbc4c,_0x69af('0x12'));_0x3593e4(_0x1d2748[_0x69af('0x19')]['message']);}})[_0x69af('0x1a')](function(_0x241e86){logger[_0x69af('0x16')](_0x69af('0x11'),_0x4dbc4c,_0x241e86);_0xba7127(_0x241e86);});});}
\ No newline at end of file
+var _0x1a65=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xfa8178,_0x3db32b){var _0x14d8f6=function(_0xb96ced){while(--_0xb96ced){_0xfa8178['push'](_0xfa8178['shift']());}};_0x14d8f6(++_0x3db32b);}(_0x1a65,0x19c));var _0x51a6=function(_0x5d81c5,_0x2a4bb3){_0x5d81c5=_0x5d81c5-0x0;var _0x5500d7=_0x1a65[_0x5d81c5];return _0x5500d7;};'use strict';var _=require(_0x51a6('0x0'));var util=require(_0x51a6('0x1'));var moment=require(_0x51a6('0x2'));var BPromise=require(_0x51a6('0x3'));var rs=require(_0x51a6('0x4'));var fs=require('fs');var Redis=require(_0x51a6('0x5'));var db=require(_0x51a6('0x6'))['db'];var utils=require(_0x51a6('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x51a6('0x8'));var jayson=require(_0x51a6('0x9'));var client=jayson['client'][_0x51a6('0xa')]({'port':0x232a});config[_0x51a6('0xb')]=_[_0x51a6('0xc')](config[_0x51a6('0xb')],{'host':_0x51a6('0xd'),'port':0x18eb});var socket=require(_0x51a6('0xe'))(new Redis(config[_0x51a6('0xb')]));require(_0x51a6('0xf'))[_0x51a6('0x10')](socket);function respondWithRpcPromise(_0x270234,_0x214939,_0x302198){return new BPromise(function(_0x4673a4,_0x599b00){return client[_0x51a6('0x11')](_0x270234,_0x302198)[_0x51a6('0x12')](function(_0x263f5a){logger[_0x51a6('0x13')](_0x51a6('0x14'),_0x214939,_0x51a6('0x15'));logger[_0x51a6('0x16')](_0x51a6('0x17'),_0x214939,_0x51a6('0x15'),JSON[_0x51a6('0x18')](_0x263f5a));if(_0x263f5a[_0x51a6('0x19')]){if(_0x263f5a[_0x51a6('0x19')][_0x51a6('0x1a')]===0x1f4){logger[_0x51a6('0x19')](_0x51a6('0x14'),_0x214939,_0x263f5a[_0x51a6('0x19')][_0x51a6('0x1b')]);return _0x599b00(_0x263f5a[_0x51a6('0x19')]['message']);}logger['error']('Dashboard,\x20%s,\x20%s',_0x214939,_0x263f5a['error'][_0x51a6('0x1b')]);return _0x4673a4(_0x263f5a[_0x51a6('0x19')][_0x51a6('0x1b')]);}else{logger['info'](_0x51a6('0x14'),_0x214939,_0x51a6('0x15'));_0x4673a4(_0x263f5a[_0x51a6('0x1c')]['message']);}})[_0x51a6('0x1d')](function(_0x3e1e58){logger[_0x51a6('0x19')]('Dashboard,\x20%s,\x20%s',_0x214939,_0x3e1e58);_0x599b00(_0x3e1e58);});});}
\ No newline at end of file
index 05b7fdc..ce19142 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xce59=['save','remove','update','removeListener','register','length','dashboard:','./dashboard.events'];(function(_0x3f9ff2,_0x584496){var _0x534d62=function(_0x1cfd31){while(--_0x1cfd31){_0x3f9ff2['push'](_0x3f9ff2['shift']());}};_0x534d62(++_0x584496);}(_0xce59,0xd7));var _0x9ce5=function(_0x257216,_0x8df834){_0x257216=_0x257216-0x0;var _0x8b0e03=_0xce59[_0x257216];return _0x8b0e03;};'use strict';var DashboardEvents=require(_0x9ce5('0x0'));var events=[_0x9ce5('0x1'),_0x9ce5('0x2'),_0x9ce5('0x3')];function createListener(_0x87d0d4,_0x3c5300){return function(_0x2ff265){_0x3c5300['emit'](_0x87d0d4,_0x2ff265);};}function removeListener(_0x1b5719,_0x5bf80e){return function(){DashboardEvents[_0x9ce5('0x4')](_0x1b5719,_0x5bf80e);};}exports[_0x9ce5('0x5')]=function(_0x3e2e51){for(var _0x2df5b0=0x0,_0x3ce12e=events[_0x9ce5('0x6')];_0x2df5b0<_0x3ce12e;_0x2df5b0++){var _0x3e236a=events[_0x2df5b0];var _0x5e8c98=createListener(_0x9ce5('0x7')+_0x3e236a,_0x3e2e51);DashboardEvents['on'](_0x3e236a,_0x5e8c98);}};
\ No newline at end of file
+var _0xa709=['update','removeListener','register','length','dashboard:','./dashboard.events','save','remove'];(function(_0x43a4e9,_0x1192a3){var _0x317f14=function(_0x234177){while(--_0x234177){_0x43a4e9['push'](_0x43a4e9['shift']());}};_0x317f14(++_0x1192a3);}(_0xa709,0x12d));var _0x9a70=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xa709[_0x34843e];return _0x598f7f;};'use strict';var DashboardEvents=require(_0x9a70('0x0'));var events=[_0x9a70('0x1'),_0x9a70('0x2'),_0x9a70('0x3')];function createListener(_0x2efdb4,_0x155678){return function(_0x1d6348){_0x155678['emit'](_0x2efdb4,_0x1d6348);};}function removeListener(_0x4d4607,_0x1d2905){return function(){DashboardEvents[_0x9a70('0x4')](_0x4d4607,_0x1d2905);};}exports[_0x9a70('0x5')]=function(_0x50f7c0){for(var _0x11b3b8=0x0,_0x511eb5=events[_0x9a70('0x6')];_0x11b3b8<_0x511eb5;_0x11b3b8++){var _0x44f42a=events[_0x11b3b8];var _0x221658=createListener(_0x9a70('0x7')+_0x44f42a,_0x50f7c0);DashboardEvents['on'](_0x44f42a,_0x221658);}};
\ No newline at end of file
index b8bdf0c..8fedc3a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa12c=['addItem','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','index','/:id','isAuthenticated','show','/:id/items','getItems','post','/:id/clone'];(function(_0x494def,_0x30960b){var _0x5b6a23=function(_0x667c9c){while(--_0x667c9c){_0x494def['push'](_0x494def['shift']());}};_0x5b6a23(++_0x30960b);}(_0xa12c,0xd5));var _0xca12=function(_0x4df3ab,_0x1f66e7){_0x4df3ab=_0x4df3ab-0x0;var _0x399cf6=_0xa12c[_0x4df3ab];return _0x399cf6;};'use strict';var multer=require('multer');var util=require(_0xca12('0x0'));var path=require(_0xca12('0x1'));var timeout=require(_0xca12('0x2'));var express=require(_0xca12('0x3'));var router=express[_0xca12('0x4')]();var fs_extra=require(_0xca12('0x5'));var auth=require(_0xca12('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xca12('0x7'));var controller=require(_0xca12('0x8'));router[_0xca12('0x9')]('/',auth['isAuthenticated'](),controller[_0xca12('0xa')]);router[_0xca12('0x9')](_0xca12('0xb'),auth[_0xca12('0xc')](),controller[_0xca12('0xd')]);router[_0xca12('0x9')](_0xca12('0xe'),auth['isAuthenticated'](),controller[_0xca12('0xf')]);router[_0xca12('0x10')]('/',auth[_0xca12('0xc')](),controller['create']);router[_0xca12('0x10')](_0xca12('0x11'),auth[_0xca12('0xc')](),controller['clone']);router[_0xca12('0x10')]('/:id/items',auth[_0xca12('0xc')](),controller[_0xca12('0x12')]);router['put'](_0xca12('0xb'),auth[_0xca12('0xc')](),controller['update']);router[_0xca12('0x13')](_0xca12('0xb'),auth[_0xca12('0xc')](),controller['destroy']);module[_0xca12('0x14')]=router;
\ No newline at end of file
+var _0x154c=['get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','clone','addItem','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller'];(function(_0xb93ad,_0x34a40b){var _0x4af28a=function(_0x23da28){while(--_0x23da28){_0xb93ad['push'](_0xb93ad['shift']());}};_0x4af28a(++_0x34a40b);}(_0x154c,0xb0));var _0xc154=function(_0x550552,_0x911116){_0x550552=_0x550552-0x0;var _0x2486df=_0x154c[_0x550552];return _0x2486df;};'use strict';var multer=require(_0xc154('0x0'));var util=require('util');var path=require(_0xc154('0x1'));var timeout=require('connect-timeout');var express=require(_0xc154('0x2'));var router=express[_0xc154('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc154('0x4'));var interaction=require(_0xc154('0x5'));var config=require(_0xc154('0x6'));var controller=require(_0xc154('0x7'));router[_0xc154('0x8')]('/',auth[_0xc154('0x9')](),controller[_0xc154('0xa')]);router[_0xc154('0x8')](_0xc154('0xb'),auth['isAuthenticated'](),controller[_0xc154('0xc')]);router[_0xc154('0x8')](_0xc154('0xd'),auth[_0xc154('0x9')](),controller[_0xc154('0xe')]);router['post']('/',auth[_0xc154('0x9')](),controller['create']);router[_0xc154('0xf')]('/:id/clone',auth['isAuthenticated'](),controller[_0xc154('0x10')]);router['post'](_0xc154('0xd'),auth['isAuthenticated'](),controller[_0xc154('0x11')]);router[_0xc154('0x12')](_0xc154('0xb'),auth['isAuthenticated'](),controller[_0xc154('0x13')]);router[_0xc154('0x14')](_0xc154('0xb'),auth[_0xc154('0x9')](),controller[_0xc154('0x15')]);module[_0xc154('0x16')]=router;
\ No newline at end of file
index 70dcc5a..7f53dc0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x524e=['exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','lodash'];(function(_0x7a2ee3,_0x105495){var _0x4aa3a0=function(_0x532352){while(--_0x532352){_0x7a2ee3['push'](_0x7a2ee3['shift']());}};_0x4aa3a0(++_0x105495);}(_0x524e,0x15e));var _0xe524=function(_0x2b5bb3,_0x37bd44){_0x2b5bb3=_0x2b5bb3-0x0;var _0x5dd84e=_0x524e[_0x2b5bb3];return _0x5dd84e;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0xe524('0x0'));module[_0xe524('0x1')]={'title':{'type':Sequelize[_0xe524('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe524('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xe524('0x3')](_0xe524('0x4')),'get':function(){try{return JSON[_0xe524('0x5')](this[_0xe524('0x6')](_0xe524('0x7')));}catch(_0x110cff){return[];}},'set':function(_0x4f75d6){try{this[_0xe524('0x8')](_0xe524('0x7'),JSON[_0xe524('0x9')](_0x4f75d6));}catch(_0x533c14){this[_0xe524('0x8')](_0xe524('0x7'),JSON[_0xe524('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xe524('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xe524('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xe524('0xa')]},'col':{'type':Sequelize[_0xe524('0xa')]},'background':{'type':Sequelize[_0xe524('0x2')],'allowNull':![],'defaultValue':_0xe524('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xe524('0x2')],'allowNull':![],'defaultValue':_0xe524('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xe524('0x2')]},'titleFontSize':{'type':Sequelize[_0xe524('0xa')],'defaultValue':0xc}};
\ No newline at end of file
+var _0x4c60=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x2240a2,_0x55540b){var _0x172a06=function(_0x458887){while(--_0x458887){_0x2240a2['push'](_0x2240a2['shift']());}};_0x172a06(++_0x55540b);}(_0x4c60,0xc1));var _0x04c6=function(_0x364356,_0x499d5b){_0x364356=_0x364356-0x0;var _0x2ac9eb=_0x4c60[_0x364356];return _0x2ac9eb;};'use strict';var Sequelize=require(_0x04c6('0x0'));var squel=require(_0x04c6('0x1'));var _=require(_0x04c6('0x2'));module[_0x04c6('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x04c6('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x04c6('0x5')));}catch(_0xc6e772){return[];}},'set':function(_0x2054da){try{this[_0x04c6('0x6')](_0x04c6('0x5'),JSON[_0x04c6('0x7')](_0x2054da));}catch(_0x8f9b13){this['setDataValue'](_0x04c6('0x5'),JSON[_0x04c6('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x04c6('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}};
\ No newline at end of file
index a265f87..36b791a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x814b=['attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrOpenchannelAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','model','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','include','options','find','catch','params','type','attrUrl','attrs','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice'];(function(_0x1e3902,_0x47fa46){var _0x1c1416=function(_0x43a6d7){while(--_0x43a6d7){_0x1e3902['push'](_0x1e3902['shift']());}};_0x1c1416(++_0x47fa46);}(_0x814b,0x1a2));var _0xb814=function(_0x2b18d8,_0x21778e){_0x2b18d8=_0x2b18d8-0x0;var _0x2bcce2=_0x814b[_0x2b18d8];return _0x2bcce2;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];config[_0xb814('0x1b')]=_[_0xb814('0x1c')](config[_0xb814('0x1b')],{'host':_0xb814('0x1d'),'port':0x18eb});var socket=require(_0xb814('0x1e'))(new Redis(config[_0xb814('0x1b')]));require(_0xb814('0x1f'))[_0xb814('0x20')](socket);function respondWithStatusCode(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xcc;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x21')](_0x44fb96);}return _0x3f4881[_0xb814('0x22')](_0x44fb96)[_0xb814('0x23')]();};}function respondWithResult(_0x45e0d0,_0x265a83){_0x265a83=_0x265a83||0xc8;return function(_0x125ce2){if(_0x125ce2){return _0x45e0d0[_0xb814('0x22')](_0x265a83)[_0xb814('0x24')](_0x125ce2);}};}function respondWithFilteredResult(_0x48c9df,_0x168a48){return function(_0x55ba16){if(_0x55ba16){var _0x270598=typeof _0x168a48[_0xb814('0x25')]==='undefined'&&typeof _0x168a48['limit']==='undefined';var _0x399b43=_0x55ba16['count'];var _0x57c128=_0x270598?0x0:_0x168a48[_0xb814('0x25')];var _0x24211d=_0x270598?_0x55ba16[_0xb814('0x26')]:_0x168a48['offset']+_0x168a48[_0xb814('0x27')];var _0x531032;if(_0x24211d>=_0x399b43){_0x24211d=_0x399b43;_0x531032=0xc8;}else{_0x531032=0xce;}_0x48c9df[_0xb814('0x22')](_0x531032);return _0x48c9df[_0xb814('0x28')](_0xb814('0x29'),_0x57c128+'-'+_0x24211d+'/'+_0x399b43)[_0xb814('0x24')](_0x55ba16);}return null;};}function patchUpdates(_0x27352e){return function(_0x2bd039){try{jsonpatch[_0xb814('0x2a')](_0x2bd039,_0x27352e,!![]);}catch(_0x594470){return BPromise[_0xb814('0x2b')](_0x594470);}return _0x2bd039['save']();};}function saveUpdates(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x2c')](_0x3f81d0)[_0xb814('0x2d')](function(_0xb9e57d){return _0xb9e57d;});}return null;};}function removeEntity(_0x3d836c,_0x5755ea){return function(_0x392222){if(_0x392222){return _0x392222[_0xb814('0x2e')]()[_0xb814('0x2d')](function(){_0x3d836c[_0xb814('0x22')](0xcc)[_0xb814('0x23')]();});}};}function handleEntityNotFound(_0x1d5965,_0x3f0150){return function(_0x1e4e89){if(!_0x1e4e89){_0x1d5965['sendStatus'](0x194);}return _0x1e4e89;};}function handleError(_0x271aa8,_0x328a08){_0x328a08=_0x328a08||0x1f4;return function(_0x52ed64){logger[_0xb814('0x2f')](_0x52ed64[_0xb814('0x30')]);if(_0x52ed64[_0xb814('0x31')]){delete _0x52ed64['name'];}_0x271aa8[_0xb814('0x22')](_0x328a08)[_0xb814('0x32')](_0x52ed64);};}exports['show']=function(_0x338a28,_0x526610){var _0x6efe9a={'raw':![],'where':{'id':_0x338a28['params']['id']}},_0x5f3e9b={};_0x5f3e9b[_0xb814('0x33')]=_['keys'](db[_0xb814('0x34')][_0xb814('0x35')]);_0x5f3e9b[_0xb814('0x36')]=_['keys'](_0x338a28['query']);_0x5f3e9b[_0xb814('0x37')]=_[_0xb814('0x38')](_0x5f3e9b['model'],_0x5f3e9b[_0xb814('0x36')]);_0x6efe9a[_0xb814('0x39')]=_[_0xb814('0x38')](_0x5f3e9b[_0xb814('0x33')],qs[_0xb814('0x3a')](_0x338a28[_0xb814('0x36')][_0xb814('0x3a')]));_0x6efe9a['attributes']=_0x6efe9a[_0xb814('0x39')][_0xb814('0x3b')]?_0x6efe9a[_0xb814('0x39')]:_0x5f3e9b[_0xb814('0x33')];if(_0x338a28[_0xb814('0x36')]['includeAll']){_0x6efe9a[_0xb814('0x3c')]=[{'all':!![]}];}_0x6efe9a=_['merge']({},_0x6efe9a,_0x338a28[_0xb814('0x3d')]);return db[_0xb814('0x34')][_0xb814('0x3e')](_0x6efe9a)['then'](handleEntityNotFound(_0x526610,null))[_0xb814('0x2d')](respondWithResult(_0x526610,null))[_0xb814('0x3f')](handleError(_0x526610,null));};exports['destroy']=function(_0x2fcd92,_0x2d0e27){return db[_0xb814('0x34')][_0xb814('0x3e')]({'where':{'id':_0x2fcd92[_0xb814('0x40')]['id']}})[_0xb814('0x2d')](handleEntityNotFound(_0x2d0e27,null))['then'](removeEntity(_0x2d0e27,null))[_0xb814('0x3f')](handleError(_0x2d0e27,null));};function widgetAttributes(_0x4e4684){try{switch(_0x4e4684[_0xb814('0x41')]){case'iframe':return[{'name':_0xb814('0x42'),'value':_0x4e4684['attrUrl']||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684[_0xb814('0x43')][0x0]?_0x4e4684['attrs'][0x0]['value']:undefined)||'https://'}];case'custom':return[{'name':_0xb814('0x44'),'value':_0x4e4684[_0xb814('0x44')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684[_0xb814('0x43')][0x0]?_0x4e4684['attrs'][0x0]['value']:undefined)||''}];case _0xb814('0x45'):return[{'name':'attrHourFormat','value':_0x4e4684[_0xb814('0x46')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684[_0xb814('0x43')][0x0]?_0x4e4684[_0xb814('0x43')][0x0][_0xb814('0x47')]:undefined)||_0xb814('0x48')},{'name':_0xb814('0x49'),'value':_0x4e4684[_0xb814('0x49')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684['attrs'][0x1]?_0x4e4684['attrs'][0x1]['value']:undefined)||_0xb814('0x4a')},{'name':'attrFontSize','value':_0x4e4684[_0xb814('0x4b')]||(_0x4e4684['attrs']&&_0x4e4684[_0xb814('0x43')][0x2]?_0x4e4684[_0xb814('0x43')][0x2][_0xb814('0x47')]:undefined)||0xc}];case _0xb814('0x4c'):return[{'name':'attrMetric','value':_0x4e4684[_0xb814('0x4d')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684[_0xb814('0x43')][0x0]?_0x4e4684[_0xb814('0x43')][0x0][_0xb814('0x47')]:undefined)||_0xb814('0x4e')},{'name':'attrVoiceQueues','value':_0x4e4684[_0xb814('0x4f')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684[_0xb814('0x43')][0x1]?_0x4e4684[_0xb814('0x43')][0x1][_0xb814('0x47')]:undefined)||[]},{'name':_0xb814('0x4b'),'value':_0x4e4684[_0xb814('0x4b')]||(_0x4e4684['attrs']&&_0x4e4684['attrs'][0x2]?_0x4e4684[_0xb814('0x43')][0x2][_0xb814('0x47')]:undefined)||0x14},{'name':_0xb814('0x50'),'value':_0x4e4684[_0xb814('0x50')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684[_0xb814('0x43')][0x3]?_0x4e4684[_0xb814('0x43')][0x3][_0xb814('0x47')]:undefined)||_0xb814('0x51')},{'name':_0xb814('0x52'),'value':_0x4e4684[_0xb814('0x52')]||(_0x4e4684['attrs']&&_0x4e4684[_0xb814('0x43')][0x4]?_0x4e4684[_0xb814('0x43')][0x4]['value']:undefined)||''},{'name':_0xb814('0x53'),'value':_0x4e4684['attrFaxAccounts']||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684[_0xb814('0x43')][0x5]?_0x4e4684[_0xb814('0x43')][0x5][_0xb814('0x47')]:undefined)||''},{'name':_0xb814('0x54'),'value':_0x4e4684[_0xb814('0x54')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684[_0xb814('0x43')][0x6]?_0x4e4684[_0xb814('0x43')][0x6][_0xb814('0x47')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4e4684['attrOpenchannelAccounts']||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684[_0xb814('0x43')][0x7]?_0x4e4684[_0xb814('0x43')][0x7][_0xb814('0x47')]:undefined)||''},{'name':_0xb814('0x55'),'value':_0x4e4684[_0xb814('0x55')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684['attrs'][0x8]?_0x4e4684[_0xb814('0x43')][0x8][_0xb814('0x47')]:undefined)||''},{'name':_0xb814('0x56'),'value':_0x4e4684['attrChatWebsites']||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684['attrs'][0x9]?_0x4e4684[_0xb814('0x43')][0x9]['value']:undefined)||''}];case _0xb814('0x57'):case _0xb814('0x58'):return[{'name':'attrSerie1','value':_0x4e4684[_0xb814('0x59')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684[_0xb814('0x43')][0x0]?_0x4e4684['attrs'][0x0][_0xb814('0x47')]:undefined)||'total'},{'name':_0xb814('0x5a'),'value':_0x4e4684[_0xb814('0x5a')]||(_0x4e4684['attrs']&&_0x4e4684[_0xb814('0x43')][0x1]?_0x4e4684['attrs'][0x1]['value']:undefined)||null},{'name':_0xb814('0x5b'),'value':_0x4e4684[_0xb814('0x5b')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684['attrs'][0x2]?_0x4e4684[_0xb814('0x43')][0x2]['value']:undefined)||null},{'name':_0xb814('0x4f'),'value':_0x4e4684[_0xb814('0x4f')]||(_0x4e4684['attrs']&&_0x4e4684[_0xb814('0x43')][0x3]?_0x4e4684['attrs'][0x3][_0xb814('0x47')]:undefined)||[]},{'name':_0xb814('0x50'),'value':_0x4e4684[_0xb814('0x50')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684[_0xb814('0x43')][0x4]?_0x4e4684[_0xb814('0x43')][0x4][_0xb814('0x47')]:undefined)||_0xb814('0x51')},{'name':'attrEmailAccounts','value':_0x4e4684[_0xb814('0x52')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684['attrs'][0x5]?_0x4e4684[_0xb814('0x43')][0x5][_0xb814('0x47')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x4e4684[_0xb814('0x53')]||(_0x4e4684['attrs']&&_0x4e4684['attrs'][0x6]?_0x4e4684[_0xb814('0x43')][0x6]['value']:undefined)||''},{'name':_0xb814('0x54'),'value':_0x4e4684[_0xb814('0x54')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684['attrs'][0x7]?_0x4e4684[_0xb814('0x43')][0x7]['value']:undefined)||''},{'name':_0xb814('0x5c'),'value':_0x4e4684[_0xb814('0x5c')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684[_0xb814('0x43')][0x8]?_0x4e4684[_0xb814('0x43')][0x8][_0xb814('0x47')]:undefined)||''},{'name':_0xb814('0x55'),'value':_0x4e4684[_0xb814('0x55')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684['attrs'][0x9]?_0x4e4684[_0xb814('0x43')][0x9][_0xb814('0x47')]:undefined)||''},{'name':_0xb814('0x56'),'value':_0x4e4684[_0xb814('0x56')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684[_0xb814('0x43')][0xa]?_0x4e4684['attrs'][0xa][_0xb814('0x47')]:undefined)||''}];case'web-report':return[{'name':_0xb814('0x5d'),'type':_0x4e4684[_0xb814('0x5e')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684['attrs'][0x0]?_0x4e4684[_0xb814('0x43')][0x0]['type']:undefined)||null,'value':_0x4e4684[_0xb814('0x5d')]||(_0x4e4684['attrs']&&_0x4e4684[_0xb814('0x43')][0x0]?_0x4e4684[_0xb814('0x43')][0x0][_0xb814('0x47')]:undefined)||null},{'name':_0xb814('0x5f'),'value':_0x4e4684[_0xb814('0x5f')]||(_0x4e4684[_0xb814('0x43')]&&_0x4e4684[_0xb814('0x43')][0x1]?_0x4e4684['attrs'][0x1][_0xb814('0x47')]:undefined)||0x0}];default:return[];}}catch(_0x51ca51){logger[_0xb814('0x2f')](_0xb814('0x60'),JSON[_0xb814('0x61')](_0x51ca51));return[];}}exports[_0xb814('0x62')]=function(_0x19fa45,_0x139531){if(_0x19fa45['body']){_0x19fa45[_0xb814('0x63')][_0xb814('0x43')]=widgetAttributes(_0x19fa45['body']);}return db[_0xb814('0x34')][_0xb814('0x62')](_0x19fa45[_0xb814('0x63')],{})[_0xb814('0x2d')](respondWithResult(_0x139531,0xc9))[_0xb814('0x3f')](handleError(_0x139531,null));};exports['update']=function(_0x3a4d4b,_0x5e8e8e){if(_0x3a4d4b[_0xb814('0x63')]['id']){delete _0x3a4d4b[_0xb814('0x63')]['id'];}_0x3a4d4b[_0xb814('0x63')][_0xb814('0x43')]=widgetAttributes(_0x3a4d4b[_0xb814('0x63')]);return db[_0xb814('0x34')]['find']({'where':{'id':_0x3a4d4b['params']['id']}})['then'](handleEntityNotFound(_0x5e8e8e,null))[_0xb814('0x2d')](saveUpdates(_0x3a4d4b['body'],null))[_0xb814('0x2d')](respondWithResult(_0x5e8e8e,null))[_0xb814('0x3f')](handleError(_0x5e8e8e,null));};
\ No newline at end of file
+var _0x16ce=['intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','params','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./dashboardItem.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','show','model','keys','DashboardItem','rawAttributes','query','filters'];(function(_0x1344f3,_0x3dd300){var _0x472b06=function(_0x32214f){while(--_0x32214f){_0x1344f3['push'](_0x1344f3['shift']());}};_0x472b06(++_0x3dd300);}(_0x16ce,0xfb));var _0xe16c=function(_0x184947,_0x5011b8){_0x184947=_0x184947-0x0;var _0x503a4f=_0x16ce[_0x184947];return _0x503a4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe16c('0x0'));var zipdir=require(_0xe16c('0x1'));var jsonpatch=require(_0xe16c('0x2'));var rp=require(_0xe16c('0x3'));var moment=require(_0xe16c('0x4'));var BPromise=require(_0xe16c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe16c('0x6'));var csv=require('to-csv');var ejs=require(_0xe16c('0x7'));var fs=require('fs');var fs_extra=require(_0xe16c('0x8'));var _=require(_0xe16c('0x9'));var squel=require(_0xe16c('0xa'));var crypto=require(_0xe16c('0xb'));var jsforce=require(_0xe16c('0xc'));var deskjs=require(_0xe16c('0xd'));var toCsv=require(_0xe16c('0xe'));var querystring=require('querystring');var Papa=require(_0xe16c('0xf'));var Redis=require(_0xe16c('0x10'));var authService=require(_0xe16c('0x11'));var qs=require(_0xe16c('0x12'));var as=require(_0xe16c('0x13'));var hardwareService=require(_0xe16c('0x14'));var logger=require(_0xe16c('0x15'))(_0xe16c('0x16'));var utils=require(_0xe16c('0x17'));var config=require(_0xe16c('0x18'));var licenseUtil=require(_0xe16c('0x19'));var db=require('../../mysqldb')['db'];config[_0xe16c('0x1a')]=_[_0xe16c('0x1b')](config[_0xe16c('0x1a')],{'host':_0xe16c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe16c('0x1d'))[_0xe16c('0x1e')](socket);function respondWithStatusCode(_0xb1f263,_0x14fc33){_0x14fc33=_0x14fc33||0xcc;return function(_0x4a4a21){if(_0x4a4a21){return _0xb1f263[_0xe16c('0x1f')](_0x14fc33);}return _0xb1f263['status'](_0x14fc33)[_0xe16c('0x20')]();};}function respondWithResult(_0x7a62b9,_0x353a5b){_0x353a5b=_0x353a5b||0xc8;return function(_0x5b7439){if(_0x5b7439){return _0x7a62b9[_0xe16c('0x21')](_0x353a5b)[_0xe16c('0x22')](_0x5b7439);}};}function respondWithFilteredResult(_0x3a99db,_0x3bb637){return function(_0x2afddf){if(_0x2afddf){var _0x5121f8=typeof _0x3bb637[_0xe16c('0x23')]===_0xe16c('0x24')&&typeof _0x3bb637[_0xe16c('0x25')]==='undefined';var _0x52ef0f=_0x2afddf['count'];var _0x30e657=_0x5121f8?0x0:_0x3bb637[_0xe16c('0x23')];var _0x611939=_0x5121f8?_0x2afddf[_0xe16c('0x26')]:_0x3bb637[_0xe16c('0x23')]+_0x3bb637[_0xe16c('0x25')];var _0x48beef;if(_0x611939>=_0x52ef0f){_0x611939=_0x52ef0f;_0x48beef=0xc8;}else{_0x48beef=0xce;}_0x3a99db[_0xe16c('0x21')](_0x48beef);return _0x3a99db[_0xe16c('0x27')](_0xe16c('0x28'),_0x30e657+'-'+_0x611939+'/'+_0x52ef0f)[_0xe16c('0x22')](_0x2afddf);}return null;};}function patchUpdates(_0x5a88ed){return function(_0x27eb44){try{jsonpatch[_0xe16c('0x29')](_0x27eb44,_0x5a88ed,!![]);}catch(_0x453aed){return BPromise[_0xe16c('0x2a')](_0x453aed);}return _0x27eb44[_0xe16c('0x2b')]();};}function saveUpdates(_0x18669a,_0x1d888d){return function(_0x8a9b36){if(_0x8a9b36){return _0x8a9b36['update'](_0x18669a)[_0xe16c('0x2c')](function(_0x9fd053){return _0x9fd053;});}return null;};}function removeEntity(_0x4fdc91,_0xd0799){return function(_0x5b6ca6){if(_0x5b6ca6){return _0x5b6ca6[_0xe16c('0x2d')]()['then'](function(){_0x4fdc91[_0xe16c('0x21')](0xcc)[_0xe16c('0x20')]();});}};}function handleEntityNotFound(_0x234c26,_0x156de3){return function(_0x473025){if(!_0x473025){_0x234c26[_0xe16c('0x1f')](0x194);}return _0x473025;};}function handleError(_0xfa565a,_0x69cd87){_0x69cd87=_0x69cd87||0x1f4;return function(_0x3472ef){logger[_0xe16c('0x2e')](_0x3472ef['stack']);if(_0x3472ef[_0xe16c('0x2f')]){delete _0x3472ef[_0xe16c('0x2f')];}_0xfa565a[_0xe16c('0x21')](_0x69cd87)['send'](_0x3472ef);};}exports[_0xe16c('0x30')]=function(_0x48d6b3,_0x4a0548){var _0x1ce8f5={'raw':![],'where':{'id':_0x48d6b3['params']['id']}},_0x25ec64={};_0x25ec64[_0xe16c('0x31')]=_[_0xe16c('0x32')](db[_0xe16c('0x33')][_0xe16c('0x34')]);_0x25ec64[_0xe16c('0x35')]=_[_0xe16c('0x32')](_0x48d6b3['query']);_0x25ec64[_0xe16c('0x36')]=_[_0xe16c('0x37')](_0x25ec64['model'],_0x25ec64[_0xe16c('0x35')]);_0x1ce8f5[_0xe16c('0x38')]=_[_0xe16c('0x37')](_0x25ec64[_0xe16c('0x31')],qs[_0xe16c('0x39')](_0x48d6b3[_0xe16c('0x35')][_0xe16c('0x39')]));_0x1ce8f5['attributes']=_0x1ce8f5[_0xe16c('0x38')][_0xe16c('0x3a')]?_0x1ce8f5[_0xe16c('0x38')]:_0x25ec64[_0xe16c('0x31')];if(_0x48d6b3[_0xe16c('0x35')][_0xe16c('0x3b')]){_0x1ce8f5[_0xe16c('0x3c')]=[{'all':!![]}];}_0x1ce8f5=_[_0xe16c('0x3d')]({},_0x1ce8f5,_0x48d6b3[_0xe16c('0x3e')]);return db[_0xe16c('0x33')][_0xe16c('0x3f')](_0x1ce8f5)[_0xe16c('0x2c')](handleEntityNotFound(_0x4a0548,null))[_0xe16c('0x2c')](respondWithResult(_0x4a0548,null))[_0xe16c('0x40')](handleError(_0x4a0548,null));};exports[_0xe16c('0x2d')]=function(_0x46bc4b,_0x5a3351){return db[_0xe16c('0x33')][_0xe16c('0x3f')]({'where':{'id':_0x46bc4b[_0xe16c('0x41')]['id']}})[_0xe16c('0x2c')](handleEntityNotFound(_0x5a3351,null))[_0xe16c('0x2c')](removeEntity(_0x5a3351,null))['catch'](handleError(_0x5a3351,null));};function widgetAttributes(_0x4e9b4a){try{switch(_0x4e9b4a[_0xe16c('0x42')]){case _0xe16c('0x43'):return[{'name':_0xe16c('0x44'),'value':_0x4e9b4a[_0xe16c('0x44')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a['attrs'][0x0]?_0x4e9b4a[_0xe16c('0x45')][0x0][_0xe16c('0x46')]:undefined)||_0xe16c('0x47')}];case'custom':return[{'name':_0xe16c('0x48'),'value':_0x4e9b4a[_0xe16c('0x48')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a[_0xe16c('0x45')][0x0]?_0x4e9b4a['attrs'][0x0][_0xe16c('0x46')]:undefined)||''}];case _0xe16c('0x49'):return[{'name':_0xe16c('0x4a'),'value':_0x4e9b4a[_0xe16c('0x4a')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a[_0xe16c('0x45')][0x0]?_0x4e9b4a['attrs'][0x0][_0xe16c('0x46')]:undefined)||'HH:mm:ss'},{'name':_0xe16c('0x4b'),'value':_0x4e9b4a[_0xe16c('0x4b')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a[_0xe16c('0x45')][0x1]?_0x4e9b4a[_0xe16c('0x45')][0x1]['value']:undefined)||_0xe16c('0x4c')},{'name':_0xe16c('0x4d'),'value':_0x4e9b4a[_0xe16c('0x4d')]||(_0x4e9b4a['attrs']&&_0x4e9b4a[_0xe16c('0x45')][0x2]?_0x4e9b4a[_0xe16c('0x45')][0x2][_0xe16c('0x46')]:undefined)||0xc}];case _0xe16c('0x4e'):return[{'name':'attrMetric','value':_0x4e9b4a[_0xe16c('0x4f')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a[_0xe16c('0x45')][0x0]?_0x4e9b4a[_0xe16c('0x45')][0x0]['value']:undefined)||_0xe16c('0x50')},{'name':_0xe16c('0x51'),'value':_0x4e9b4a[_0xe16c('0x51')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a[_0xe16c('0x45')][0x1]?_0x4e9b4a[_0xe16c('0x45')][0x1][_0xe16c('0x46')]:undefined)||[]},{'name':_0xe16c('0x4d'),'value':_0x4e9b4a[_0xe16c('0x4d')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a['attrs'][0x2]?_0x4e9b4a[_0xe16c('0x45')][0x2][_0xe16c('0x46')]:undefined)||0x14},{'name':'attrChannel','value':_0x4e9b4a['attrChannel']||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a[_0xe16c('0x45')][0x3]?_0x4e9b4a[_0xe16c('0x45')][0x3][_0xe16c('0x46')]:undefined)||_0xe16c('0x52')},{'name':_0xe16c('0x53'),'value':_0x4e9b4a[_0xe16c('0x53')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a[_0xe16c('0x45')][0x4]?_0x4e9b4a[_0xe16c('0x45')][0x4][_0xe16c('0x46')]:undefined)||''},{'name':_0xe16c('0x54'),'value':_0x4e9b4a[_0xe16c('0x54')]||(_0x4e9b4a['attrs']&&_0x4e9b4a[_0xe16c('0x45')][0x5]?_0x4e9b4a[_0xe16c('0x45')][0x5][_0xe16c('0x46')]:undefined)||''},{'name':_0xe16c('0x55'),'value':_0x4e9b4a[_0xe16c('0x55')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a[_0xe16c('0x45')][0x6]?_0x4e9b4a[_0xe16c('0x45')][0x6][_0xe16c('0x46')]:undefined)||''},{'name':_0xe16c('0x56'),'value':_0x4e9b4a[_0xe16c('0x56')]||(_0x4e9b4a['attrs']&&_0x4e9b4a['attrs'][0x7]?_0x4e9b4a['attrs'][0x7][_0xe16c('0x46')]:undefined)||''},{'name':_0xe16c('0x57'),'value':_0x4e9b4a[_0xe16c('0x57')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a['attrs'][0x8]?_0x4e9b4a[_0xe16c('0x45')][0x8]['value']:undefined)||''},{'name':_0xe16c('0x58'),'value':_0x4e9b4a[_0xe16c('0x58')]||(_0x4e9b4a['attrs']&&_0x4e9b4a['attrs'][0x9]?_0x4e9b4a['attrs'][0x9]['value']:undefined)||''}];case _0xe16c('0x59'):case _0xe16c('0x5a'):return[{'name':_0xe16c('0x5b'),'value':_0x4e9b4a[_0xe16c('0x5b')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a[_0xe16c('0x45')][0x0]?_0x4e9b4a[_0xe16c('0x45')][0x0]['value']:undefined)||'total'},{'name':_0xe16c('0x5c'),'value':_0x4e9b4a[_0xe16c('0x5c')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a[_0xe16c('0x45')][0x1]?_0x4e9b4a[_0xe16c('0x45')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x4e9b4a[_0xe16c('0x5d')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a[_0xe16c('0x45')][0x2]?_0x4e9b4a[_0xe16c('0x45')][0x2][_0xe16c('0x46')]:undefined)||null},{'name':_0xe16c('0x51'),'value':_0x4e9b4a[_0xe16c('0x51')]||(_0x4e9b4a['attrs']&&_0x4e9b4a[_0xe16c('0x45')][0x3]?_0x4e9b4a[_0xe16c('0x45')][0x3][_0xe16c('0x46')]:undefined)||[]},{'name':_0xe16c('0x5e'),'value':_0x4e9b4a['attrChannel']||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a['attrs'][0x4]?_0x4e9b4a[_0xe16c('0x45')][0x4][_0xe16c('0x46')]:undefined)||_0xe16c('0x52')},{'name':_0xe16c('0x53'),'value':_0x4e9b4a[_0xe16c('0x53')]||(_0x4e9b4a['attrs']&&_0x4e9b4a[_0xe16c('0x45')][0x5]?_0x4e9b4a[_0xe16c('0x45')][0x5]['value']:undefined)||''},{'name':_0xe16c('0x54'),'value':_0x4e9b4a[_0xe16c('0x54')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a[_0xe16c('0x45')][0x6]?_0x4e9b4a[_0xe16c('0x45')][0x6][_0xe16c('0x46')]:undefined)||''},{'name':_0xe16c('0x55'),'value':_0x4e9b4a[_0xe16c('0x55')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a[_0xe16c('0x45')][0x7]?_0x4e9b4a['attrs'][0x7][_0xe16c('0x46')]:undefined)||''},{'name':_0xe16c('0x56'),'value':_0x4e9b4a[_0xe16c('0x56')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a['attrs'][0x8]?_0x4e9b4a['attrs'][0x8]['value']:undefined)||''},{'name':_0xe16c('0x57'),'value':_0x4e9b4a[_0xe16c('0x57')]||(_0x4e9b4a['attrs']&&_0x4e9b4a['attrs'][0x9]?_0x4e9b4a[_0xe16c('0x45')][0x9][_0xe16c('0x46')]:undefined)||''},{'name':_0xe16c('0x58'),'value':_0x4e9b4a[_0xe16c('0x58')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a[_0xe16c('0x45')][0xa]?_0x4e9b4a[_0xe16c('0x45')][0xa][_0xe16c('0x46')]:undefined)||''}];case _0xe16c('0x5f'):return[{'name':'attrReport','type':_0x4e9b4a[_0xe16c('0x60')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a[_0xe16c('0x45')][0x0]?_0x4e9b4a['attrs'][0x0]['type']:undefined)||null,'value':_0x4e9b4a['attrReport']||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a['attrs'][0x0]?_0x4e9b4a['attrs'][0x0][_0xe16c('0x46')]:undefined)||null},{'name':_0xe16c('0x61'),'value':_0x4e9b4a[_0xe16c('0x61')]||(_0x4e9b4a[_0xe16c('0x45')]&&_0x4e9b4a['attrs'][0x1]?_0x4e9b4a[_0xe16c('0x45')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1937e3){logger[_0xe16c('0x2e')](_0xe16c('0x62'),JSON['stringify'](_0x1937e3));return[];}}exports[_0xe16c('0x63')]=function(_0x4f8e03,_0x998487){if(_0x4f8e03[_0xe16c('0x64')]){_0x4f8e03[_0xe16c('0x64')][_0xe16c('0x45')]=widgetAttributes(_0x4f8e03['body']);}return db[_0xe16c('0x33')][_0xe16c('0x63')](_0x4f8e03['body'],{})[_0xe16c('0x2c')](respondWithResult(_0x998487,0xc9))['catch'](handleError(_0x998487,null));};exports[_0xe16c('0x65')]=function(_0x18ed00,_0x33b10d){if(_0x18ed00[_0xe16c('0x64')]['id']){delete _0x18ed00['body']['id'];}_0x18ed00['body'][_0xe16c('0x45')]=widgetAttributes(_0x18ed00[_0xe16c('0x64')]);return db['DashboardItem'][_0xe16c('0x3f')]({'where':{'id':_0x18ed00[_0xe16c('0x41')]['id']}})['then'](handleEntityNotFound(_0x33b10d,null))['then'](saveUpdates(_0x18ed00[_0xe16c('0x64')],null))[_0xe16c('0x2c')](respondWithResult(_0x33b10d,null))['catch'](handleError(_0x33b10d,null));};
\ No newline at end of file
index bf9c216..ee3637b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1469=['hook','exports','events','../../mysqldb','DashboardItem','save','update','remove','hasOwnProperty'];(function(_0x6ca7f4,_0x51a5df){var _0x494fa6=function(_0x359532){while(--_0x359532){_0x6ca7f4['push'](_0x6ca7f4['shift']());}};_0x494fa6(++_0x51a5df);}(_0x1469,0x197));var _0x9146=function(_0x4716c0,_0xe2d591){_0x4716c0=_0x4716c0-0x0;var _0x22db36=_0x1469[_0x4716c0];return _0x22db36;};'use strict';var EventEmitter=require(_0x9146('0x0'));var DashboardItem=require(_0x9146('0x1'))['db'][_0x9146('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9146('0x3'),'afterUpdate':_0x9146('0x4'),'afterDestroy':_0x9146('0x5')};function emitEvent(_0x3163fd){return function(_0x215740,_0x3c314f,_0xbf83aa){DashboardItemEvents['emit'](_0x3163fd+':'+_0x215740['id'],_0x215740);DashboardItemEvents['emit'](_0x3163fd,_0x215740);_0xbf83aa(null);};}for(var e in events){if(events[_0x9146('0x6')](e)){var event=events[e];DashboardItem[_0x9146('0x7')](e,emitEvent(event));}}module[_0x9146('0x8')]=DashboardItemEvents;
\ No newline at end of file
+var _0xac80=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x3f6cf7,_0x56735e){var _0xb90b33=function(_0x5db786){while(--_0x5db786){_0x3f6cf7['push'](_0x3f6cf7['shift']());}};_0xb90b33(++_0x56735e);}(_0xac80,0x164));var _0x0ac8=function(_0x53141d,_0x46a54e){_0x53141d=_0x53141d-0x0;var _0x153e87=_0xac80[_0x53141d];return _0x153e87;};'use strict';var EventEmitter=require(_0x0ac8('0x0'));var DashboardItem=require(_0x0ac8('0x1'))['db'][_0x0ac8('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0ac8('0x3')](0x0);var events={'afterCreate':_0x0ac8('0x4'),'afterUpdate':'update','afterDestroy':_0x0ac8('0x5')};function emitEvent(_0x441e57){return function(_0x2c9486,_0x726d51,_0x4eedf8){DashboardItemEvents[_0x0ac8('0x6')](_0x441e57+':'+_0x2c9486['id'],_0x2c9486);DashboardItemEvents[_0x0ac8('0x6')](_0x441e57,_0x2c9486);_0x4eedf8(null);};}for(var e in events){if(events[_0x0ac8('0x7')](e)){var event=events[e];DashboardItem[_0x0ac8('0x8')](e,emitEvent(event));}}module[_0x0ac8('0x9')]=DashboardItemEvents;
\ No newline at end of file
index 0f3ec43..6374b02 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9bae=['exports','define','DashboardItem','dashboard_items','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x15e1cb,_0x195b3d){var _0x308876=function(_0x1c8e21){while(--_0x1c8e21){_0x15e1cb['push'](_0x15e1cb['shift']());}};_0x308876(++_0x195b3d);}(_0x9bae,0x7c));var _0xe9ba=function(_0x324c7e,_0x4b24b4){_0x324c7e=_0x324c7e-0x0;var _0x3231ad=_0x9bae[_0x324c7e];return _0x3231ad;};'use strict';var _=require(_0xe9ba('0x0'));var util=require(_0xe9ba('0x1'));var logger=require('../../config/logger')(_0xe9ba('0x2'));var moment=require(_0xe9ba('0x3'));var BPromise=require(_0xe9ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9ba('0x5'));var rimraf=require(_0xe9ba('0x6'));var config=require(_0xe9ba('0x7'));var attributes=require('./dashboardItem.attributes');module[_0xe9ba('0x8')]=function(_0xa2ea31,_0x19bc82){return _0xa2ea31[_0xe9ba('0x9')](_0xe9ba('0xa'),attributes,{'tableName':_0xe9ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xfd4f=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash'];(function(_0x2876a4,_0x503518){var _0x10dc3d=function(_0x508f41){while(--_0x508f41){_0x2876a4['push'](_0x2876a4['shift']());}};_0x10dc3d(++_0x503518);}(_0xfd4f,0x133));var _0xffd4=function(_0x4759af,_0x110d87){_0x4759af=_0x4759af-0x0;var _0x51610c=_0xfd4f[_0x4759af];return _0x51610c;};'use strict';var _=require(_0xffd4('0x0'));var util=require(_0xffd4('0x1'));var logger=require(_0xffd4('0x2'))('api');var moment=require('moment');var BPromise=require(_0xffd4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xffd4('0x4'));var rimraf=require(_0xffd4('0x5'));var config=require(_0xffd4('0x6'));var attributes=require(_0xffd4('0x7'));module['exports']=function(_0x4c35e1,_0x677b40){return _0x4c35e1[_0xffd4('0x8')](_0xffd4('0x9'),attributes,{'tableName':_0xffd4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 8419378..2b607ad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf7a3=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','localhost','socket.io-emitter','redis','register','request','then','debug','request\x20sent','error','DashboardItem,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x476bac,_0x4a35b2){var _0x279841=function(_0x46870d){while(--_0x46870d){_0x476bac['push'](_0x476bac['shift']());}};_0x279841(++_0x4a35b2);}(_0xf7a3,0x10d));var _0x3f7a=function(_0x5465e6,_0x2a8809){_0x5465e6=_0x5465e6-0x0;var _0x10044e=_0xf7a3[_0x5465e6];return _0x10044e;};'use strict';var _=require(_0x3f7a('0x0'));var util=require(_0x3f7a('0x1'));var moment=require(_0x3f7a('0x2'));var BPromise=require(_0x3f7a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f7a('0x4'));var db=require(_0x3f7a('0x5'))['db'];var utils=require(_0x3f7a('0x6'));var logger=require(_0x3f7a('0x7'))(_0x3f7a('0x8'));var config=require(_0x3f7a('0x9'));var jayson=require(_0x3f7a('0xa'));var client=jayson['client'][_0x3f7a('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x3f7a('0xc'),'port':0x18eb});var socket=require(_0x3f7a('0xd'))(new Redis(config[_0x3f7a('0xe')]));require('./dashboardItem.socket')[_0x3f7a('0xf')](socket);function respondWithRpcPromise(_0x413483,_0x33cd64,_0xca6e62){return new BPromise(function(_0x291e6c,_0x1aa18f){return client[_0x3f7a('0x10')](_0x413483,_0xca6e62)[_0x3f7a('0x11')](function(_0x3cdb97){logger['info']('DashboardItem,\x20%s,\x20%s',_0x33cd64,'request\x20sent');logger[_0x3f7a('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x33cd64,_0x3f7a('0x13'),JSON['stringify'](_0x3cdb97));if(_0x3cdb97['error']){if(_0x3cdb97[_0x3f7a('0x14')]['code']===0x1f4){logger['error'](_0x3f7a('0x15'),_0x33cd64,_0x3cdb97[_0x3f7a('0x14')][_0x3f7a('0x16')]);return _0x1aa18f(_0x3cdb97['error'][_0x3f7a('0x16')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x33cd64,_0x3cdb97[_0x3f7a('0x14')][_0x3f7a('0x16')]);return _0x291e6c(_0x3cdb97['error'][_0x3f7a('0x16')]);}else{logger[_0x3f7a('0x17')]('DashboardItem,\x20%s,\x20%s',_0x33cd64,'request\x20sent');_0x291e6c(_0x3cdb97['result'][_0x3f7a('0x16')]);}})[_0x3f7a('0x18')](function(_0x579730){logger[_0x3f7a('0x14')](_0x3f7a('0x15'),_0x33cd64,_0x579730);_0x1aa18f(_0x579730);});});}
\ No newline at end of file
+var _0x6417=['./dashboardItem.socket','request','then','info','request\x20sent','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x46531e,_0x17ac9b){var _0x3d7873=function(_0x32ca62){while(--_0x32ca62){_0x46531e['push'](_0x46531e['shift']());}};_0x3d7873(++_0x17ac9b);}(_0x6417,0xc9));var _0x7641=function(_0x356da5,_0x36bcb3){_0x356da5=_0x356da5-0x0;var _0x55156f=_0x6417[_0x356da5];return _0x55156f;};'use strict';var _=require(_0x7641('0x0'));var util=require(_0x7641('0x1'));var moment=require(_0x7641('0x2'));var BPromise=require('bluebird');var rs=require(_0x7641('0x3'));var fs=require('fs');var Redis=require(_0x7641('0x4'));var db=require(_0x7641('0x5'))['db'];var utils=require(_0x7641('0x6'));var logger=require(_0x7641('0x7'))(_0x7641('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7641('0x9')][_0x7641('0xa')]({'port':0x232a});config[_0x7641('0xb')]=_[_0x7641('0xc')](config[_0x7641('0xb')],{'host':_0x7641('0xd'),'port':0x18eb});var socket=require(_0x7641('0xe'))(new Redis(config[_0x7641('0xb')]));require(_0x7641('0xf'))['register'](socket);function respondWithRpcPromise(_0x4c3678,_0x3d9195,_0x171040){return new BPromise(function(_0x3793d0,_0x1bcc06){return client[_0x7641('0x10')](_0x4c3678,_0x171040)[_0x7641('0x11')](function(_0x24e1cb){logger[_0x7641('0x12')]('DashboardItem,\x20%s,\x20%s',_0x3d9195,_0x7641('0x13'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x3d9195,'request\x20sent',JSON[_0x7641('0x14')](_0x24e1cb));if(_0x24e1cb[_0x7641('0x15')]){if(_0x24e1cb[_0x7641('0x15')][_0x7641('0x16')]===0x1f4){logger[_0x7641('0x15')](_0x7641('0x17'),_0x3d9195,_0x24e1cb[_0x7641('0x15')][_0x7641('0x18')]);return _0x1bcc06(_0x24e1cb[_0x7641('0x15')][_0x7641('0x18')]);}logger[_0x7641('0x15')](_0x7641('0x17'),_0x3d9195,_0x24e1cb[_0x7641('0x15')][_0x7641('0x18')]);return _0x3793d0(_0x24e1cb[_0x7641('0x15')]['message']);}else{logger['info'](_0x7641('0x17'),_0x3d9195,'request\x20sent');_0x3793d0(_0x24e1cb[_0x7641('0x19')][_0x7641('0x18')]);}})[_0x7641('0x1a')](function(_0x1992ae){logger['error'](_0x7641('0x17'),_0x3d9195,_0x1992ae);_0x1bcc06(_0x1992ae);});});}
\ No newline at end of file
index 8b78f13..380b053 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xab98=['length','dashboardItem:','./dashboardItem.events','save','update','emit','removeListener','register'];(function(_0x3132c4,_0x321a8d){var _0xb0d3c=function(_0x18f4b6){while(--_0x18f4b6){_0x3132c4['push'](_0x3132c4['shift']());}};_0xb0d3c(++_0x321a8d);}(_0xab98,0x1b2));var _0x8ab9=function(_0x554fab,_0x24814d){_0x554fab=_0x554fab-0x0;var _0x3e2138=_0xab98[_0x554fab];return _0x3e2138;};'use strict';var DashboardItemEvents=require(_0x8ab9('0x0'));var events=[_0x8ab9('0x1'),'remove',_0x8ab9('0x2')];function createListener(_0x574efc,_0x2b579d){return function(_0x48c0d1){_0x2b579d[_0x8ab9('0x3')](_0x574efc,_0x48c0d1);};}function removeListener(_0x52ae21,_0xb5a93f){return function(){DashboardItemEvents[_0x8ab9('0x4')](_0x52ae21,_0xb5a93f);};}exports[_0x8ab9('0x5')]=function(_0x1873db){for(var _0x1637f2=0x0,_0x59c033=events[_0x8ab9('0x6')];_0x1637f2<_0x59c033;_0x1637f2++){var _0x27e867=events[_0x1637f2];var _0x1b8bee=createListener(_0x8ab9('0x7')+_0x27e867,_0x1873db);DashboardItemEvents['on'](_0x27e867,_0x1b8bee);}};
\ No newline at end of file
+var _0xd516=['remove','update','removeListener','register','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd516,0x1c6));var _0x6d51=function(_0x1ce55e,_0x1625a9){_0x1ce55e=_0x1ce55e-0x0;var _0x4ec6b6=_0xd516[_0x1ce55e];return _0x4ec6b6;};'use strict';var DashboardItemEvents=require(_0x6d51('0x0'));var events=[_0x6d51('0x1'),_0x6d51('0x2'),_0x6d51('0x3')];function createListener(_0x13b0e9,_0x17912b){return function(_0x29b19d){_0x17912b['emit'](_0x13b0e9,_0x29b19d);};}function removeListener(_0x17d69f,_0x3eb031){return function(){DashboardItemEvents[_0x6d51('0x4')](_0x17d69f,_0x3eb031);};}exports[_0x6d51('0x5')]=function(_0x1c2ae6){for(var _0x3ba7a2=0x0,_0x57c260=events[_0x6d51('0x6')];_0x3ba7a2<_0x57c260;_0x3ba7a2++){var _0x52c9f8=events[_0x3ba7a2];var _0xe32f9b=createListener(_0x6d51('0x7')+_0x52c9f8,_0x1c2ae6);DashboardItemEvents['on'](_0x52c9f8,_0xe32f9b);}};
\ No newline at end of file
index 61bc4d5..56c26be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3bb0=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','post','create','put','/:id','update','delete','exports','multer','util'];(function(_0x4e23bd,_0x14529a){var _0x103375=function(_0x1a6538){while(--_0x1a6538){_0x4e23bd['push'](_0x4e23bd['shift']());}};_0x103375(++_0x14529a);}(_0x3bb0,0x1eb));var _0x03bb=function(_0xf0bb53,_0x1b1b6c){_0xf0bb53=_0xf0bb53-0x0;var _0xb299cd=_0x3bb0[_0xf0bb53];return _0xb299cd;};'use strict';var multer=require(_0x03bb('0x0'));var util=require(_0x03bb('0x1'));var path=require(_0x03bb('0x2'));var timeout=require(_0x03bb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x03bb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x03bb('0x5'));var config=require(_0x03bb('0x6'));var controller=require(_0x03bb('0x7'));router[_0x03bb('0x8')]('/:id',auth[_0x03bb('0x9')](),controller['show']);router[_0x03bb('0xa')]('/',auth['isAuthenticated'](),controller[_0x03bb('0xb')]);router[_0x03bb('0xc')](_0x03bb('0xd'),auth[_0x03bb('0x9')](),controller[_0x03bb('0xe')]);router[_0x03bb('0xf')](_0x03bb('0xd'),auth[_0x03bb('0x9')](),controller['destroy']);module[_0x03bb('0x10')]=router;
\ No newline at end of file
+var _0x73da=['delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','create','put','update'];(function(_0x46349d,_0x53850d){var _0x1937a0=function(_0x3c44dc){while(--_0x3c44dc){_0x46349d['push'](_0x46349d['shift']());}};_0x1937a0(++_0x53850d);}(_0x73da,0x180));var _0xa73d=function(_0x5a3d95,_0x16bee6){_0x5a3d95=_0x5a3d95-0x0;var _0x2928e9=_0x73da[_0x5a3d95];return _0x2928e9;};'use strict';var multer=require('multer');var util=require(_0xa73d('0x0'));var path=require(_0xa73d('0x1'));var timeout=require(_0xa73d('0x2'));var express=require(_0xa73d('0x3'));var router=express[_0xa73d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa73d('0x5'));var interaction=require(_0xa73d('0x6'));var config=require(_0xa73d('0x7'));var controller=require(_0xa73d('0x8'));router[_0xa73d('0x9')]('/:id',auth[_0xa73d('0xa')](),controller[_0xa73d('0xb')]);router['post']('/',auth[_0xa73d('0xa')](),controller[_0xa73d('0xc')]);router[_0xa73d('0xd')]('/:id',auth[_0xa73d('0xa')](),controller[_0xa73d('0xe')]);router[_0xa73d('0xf')](_0xa73d('0x10'),auth[_0xa73d('0xa')](),controller[_0xa73d('0x11')]);module[_0xa73d('0x12')]=router;
\ No newline at end of file
index 9ac4382..4c3ffc6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9a4e=['first','second','third','sequelize','exports','STRING','ENUM'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0x9a4e,0x1d1));var _0xe9a4=function(_0xca663c,_0xb4dd19){_0xca663c=_0xca663c-0x0;var _0x2563ee=_0x9a4e[_0xca663c];return _0x2563ee;};'use strict';var Sequelize=require(_0xe9a4('0x0'));module[_0xe9a4('0x1')]={'name':{'type':Sequelize[_0xe9a4('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xe9a4('0x3')](_0xe9a4('0x4'),_0xe9a4('0x5'),_0xe9a4('0x6')),'allowNull':![],'defaultValue':_0xe9a4('0x4')},'description':{'type':Sequelize[_0xe9a4('0x2')]}};
\ No newline at end of file
+var _0x43a3=['first','second','STRING','sequelize','ENUM'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x43a3,0x7b));var _0x343a=function(_0x16dcea,_0x4364db){_0x16dcea=_0x16dcea-0x0;var _0x2d990b=_0x43a3[_0x16dcea];return _0x2d990b;};'use strict';var Sequelize=require(_0x343a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x343a('0x1')](_0x343a('0x2'),_0x343a('0x3'),'third'),'allowNull':![],'defaultValue':_0x343a('0x2')},'description':{'type':Sequelize[_0x343a('0x4')]}};
\ No newline at end of file
index 5735a75..35b1653 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x746f=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','set','apply','reject','update','then','get','destroy','end','error','name','index','map','Disposition','rawAttributes','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x30b6f2,_0x27a397){var _0x593234=function(_0x569104){while(--_0x569104){_0x30b6f2['push'](_0x30b6f2['shift']());}};_0x593234(++_0x27a397);}(_0x746f,0x9c));var _0xf746=function(_0x5cd133,_0x8c5cf2){_0x5cd133=_0x5cd133-0x0;var _0x1fae31=_0x746f[_0x5cd133];return _0x1fae31;};'use strict';var emlformat=require(_0xf746('0x0'));var rimraf=require(_0xf746('0x1'));var zipdir=require(_0xf746('0x2'));var jsonpatch=require(_0xf746('0x3'));var rp=require(_0xf746('0x4'));var moment=require(_0xf746('0x5'));var BPromise=require(_0xf746('0x6'));var Mustache=require(_0xf746('0x7'));var util=require(_0xf746('0x8'));var path=require(_0xf746('0x9'));var sox=require(_0xf746('0xa'));var csv=require(_0xf746('0xb'));var ejs=require(_0xf746('0xc'));var fs=require('fs');var fs_extra=require(_0xf746('0xd'));var _=require(_0xf746('0xe'));var squel=require(_0xf746('0xf'));var crypto=require(_0xf746('0x10'));var jsforce=require(_0xf746('0x11'));var deskjs=require(_0xf746('0x12'));var toCsv=require(_0xf746('0xb'));var querystring=require(_0xf746('0x13'));var Papa=require(_0xf746('0x14'));var Redis=require(_0xf746('0x15'));var authService=require(_0xf746('0x16'));var qs=require(_0xf746('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf746('0x18'));var logger=require(_0xf746('0x19'))(_0xf746('0x1a'));var utils=require('../../config/utils');var config=require(_0xf746('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xf746('0x1c'))['db'];function respondWithStatusCode(_0x39edcf,_0x123c24){_0x123c24=_0x123c24||0xcc;return function(_0x4010f2){if(_0x4010f2){return _0x39edcf[_0xf746('0x1d')](_0x123c24);}return _0x39edcf[_0xf746('0x1e')](_0x123c24)['end']();};}function respondWithResult(_0x255ecb,_0x3e4ebd){_0x3e4ebd=_0x3e4ebd||0xc8;return function(_0x206b05){if(_0x206b05){return _0x255ecb['status'](_0x3e4ebd)[_0xf746('0x1f')](_0x206b05);}};}function respondWithFilteredResult(_0xced60b,_0x217bcb){return function(_0xea80a6){if(_0xea80a6){var _0x336f54=typeof _0x217bcb[_0xf746('0x20')]==='undefined'&&typeof _0x217bcb[_0xf746('0x21')]==='undefined';var _0x412483=_0xea80a6[_0xf746('0x22')];var _0x5bebf7=_0x336f54?0x0:_0x217bcb[_0xf746('0x20')];var _0x221d2e=_0x336f54?_0xea80a6[_0xf746('0x22')]:_0x217bcb[_0xf746('0x20')]+_0x217bcb[_0xf746('0x21')];var _0x965a66;if(_0x221d2e>=_0x412483){_0x221d2e=_0x412483;_0x965a66=0xc8;}else{_0x965a66=0xce;}_0xced60b['status'](_0x965a66);return _0xced60b[_0xf746('0x23')]('Content-Range',_0x5bebf7+'-'+_0x221d2e+'/'+_0x412483)[_0xf746('0x1f')](_0xea80a6);}return null;};}function patchUpdates(_0x386445){return function(_0x2f9ab2){try{jsonpatch[_0xf746('0x24')](_0x2f9ab2,_0x386445,!![]);}catch(_0x2d871d){return BPromise[_0xf746('0x25')](_0x2d871d);}return _0x2f9ab2['save']();};}function saveUpdates(_0xdf0afb,_0x5d68a1){return function(_0x57615b){if(_0x57615b){return _0x57615b[_0xf746('0x26')](_0xdf0afb)[_0xf746('0x27')](function(_0x7bf33a){return _0x7bf33a;});}return null;};}function removeEntity(_0x19c81a,_0x2c10f4){return function(_0x281631){if(_0x281631){return _0x281631['destroy']()[_0xf746('0x27')](function(){var _0x16ee90=_0x281631[_0xf746('0x28')]({'plain':!![]});var _0x614a62='Dispositions';return db['UserProfileResource'][_0xf746('0x29')]({'where':{'type':_0x614a62,'resourceId':_0x16ee90['id']}})['then'](function(){return _0x281631;});})[_0xf746('0x27')](function(){_0x19c81a[_0xf746('0x1e')](0xcc)[_0xf746('0x2a')]();});}};}function handleEntityNotFound(_0x24fe20,_0x292307){return function(_0x48eeba){if(!_0x48eeba){_0x24fe20['sendStatus'](0x194);}return _0x48eeba;};}function handleError(_0x34f13c,_0x7714fc){_0x7714fc=_0x7714fc||0x1f4;return function(_0x2c76a2){logger[_0xf746('0x2b')](_0x2c76a2['stack']);if(_0x2c76a2[_0xf746('0x2c')]){delete _0x2c76a2['name'];}_0x34f13c[_0xf746('0x1e')](_0x7714fc)['send'](_0x2c76a2);};}exports[_0xf746('0x2d')]=function(_0x299886,_0x3dd598){var _0x1af081={},_0x3eb10c={},_0x316607={'count':0x0,'rows':[]};var _0x51f429=_[_0xf746('0x2e')](db[_0xf746('0x2f')][_0xf746('0x30')],function(_0x5648b8){return{'name':_0x5648b8['fieldName'],'type':_0x5648b8['type'][_0xf746('0x31')]};});_0x3eb10c['model']=_[_0xf746('0x2e')](_0x51f429,_0xf746('0x2c'));_0x3eb10c['query']=_[_0xf746('0x32')](_0x299886[_0xf746('0x33')]);_0x3eb10c['filters']=_[_0xf746('0x34')](_0x3eb10c[_0xf746('0x35')],_0x3eb10c[_0xf746('0x33')]);_0x1af081[_0xf746('0x36')]=_[_0xf746('0x34')](_0x3eb10c[_0xf746('0x35')],qs[_0xf746('0x37')](_0x299886['query']['fields']));_0x1af081[_0xf746('0x36')]=_0x1af081['attributes']['length']?_0x1af081[_0xf746('0x36')]:_0x3eb10c[_0xf746('0x35')];if(!_0x299886['query'][_0xf746('0x38')]('nolimit')){_0x1af081[_0xf746('0x21')]=qs[_0xf746('0x21')](_0x299886['query']['limit']);_0x1af081[_0xf746('0x20')]=qs['offset'](_0x299886[_0xf746('0x33')][_0xf746('0x20')]);}_0x1af081[_0xf746('0x39')]=qs[_0xf746('0x3a')](_0x299886[_0xf746('0x33')][_0xf746('0x3a')]);_0x1af081[_0xf746('0x3b')]=qs[_0xf746('0x3c')](_['pick'](_0x299886[_0xf746('0x33')],_0x3eb10c[_0xf746('0x3c')]),_0x51f429);if(_0x299886[_0xf746('0x33')][_0xf746('0x3d')]){_0x1af081['where']=_[_0xf746('0x3e')](_0x1af081[_0xf746('0x3b')],{'$or':_['map'](_0x51f429,function(_0x141a78){if(_0x141a78[_0xf746('0x3f')]!==_0xf746('0x40')){var _0x5c4ee3={};_0x5c4ee3[_0x141a78['name']]={'$like':'%'+_0x299886[_0xf746('0x33')][_0xf746('0x3d')]+'%'};return _0x5c4ee3;}})});}_0x1af081=_[_0xf746('0x3e')]({},_0x1af081,_0x299886[_0xf746('0x41')]);var _0x21d3a5={'where':_0x1af081['where']};return db[_0xf746('0x2f')]['count'](_0x21d3a5)[_0xf746('0x27')](function(_0x5a0a10){_0x316607[_0xf746('0x22')]=_0x5a0a10;if(_0x299886[_0xf746('0x33')][_0xf746('0x42')]){_0x1af081[_0xf746('0x43')]=[{'all':!![]}];}return db[_0xf746('0x2f')]['findAll'](_0x1af081);})[_0xf746('0x27')](function(_0x48a3a3){_0x316607[_0xf746('0x44')]=_0x48a3a3;return _0x316607;})[_0xf746('0x27')](respondWithFilteredResult(_0x3dd598,_0x1af081))[_0xf746('0x45')](handleError(_0x3dd598,null));};exports[_0xf746('0x46')]=function(_0x25866c,_0x3bd086){var _0x24b617={'raw':!![],'where':{'id':_0x25866c[_0xf746('0x47')]['id']}},_0x14769d={};_0x14769d[_0xf746('0x35')]=_[_0xf746('0x32')](db['Disposition'][_0xf746('0x30')]);_0x14769d[_0xf746('0x33')]=_[_0xf746('0x32')](_0x25866c[_0xf746('0x33')]);_0x14769d['filters']=_[_0xf746('0x34')](_0x14769d[_0xf746('0x35')],_0x14769d['query']);_0x24b617[_0xf746('0x36')]=_['intersection'](_0x14769d[_0xf746('0x35')],qs['fields'](_0x25866c[_0xf746('0x33')]['fields']));_0x24b617[_0xf746('0x36')]=_0x24b617[_0xf746('0x36')][_0xf746('0x48')]?_0x24b617[_0xf746('0x36')]:_0x14769d[_0xf746('0x35')];if(_0x25866c[_0xf746('0x33')][_0xf746('0x42')]){_0x24b617[_0xf746('0x43')]=[{'all':!![]}];}_0x24b617=_[_0xf746('0x3e')]({},_0x24b617,_0x25866c[_0xf746('0x41')]);return db['Disposition']['find'](_0x24b617)[_0xf746('0x27')](handleEntityNotFound(_0x3bd086,null))[_0xf746('0x27')](respondWithResult(_0x3bd086,null))[_0xf746('0x45')](handleError(_0x3bd086,null));};exports[_0xf746('0x49')]=function(_0x19c0a0,_0x38c8e0){return db['Disposition']['create'](_0x19c0a0[_0xf746('0x4a')],{})[_0xf746('0x27')](function(_0xbad7ef){var _0x55e8cf=_0x19c0a0[_0xf746('0x4b')]['get']({'plain':!![]});if(!_0x55e8cf)throw new Error(_0xf746('0x4c'));if(_0x55e8cf[_0xf746('0x4d')]===_0xf746('0x4b')){var _0xae66db=_0xbad7ef[_0xf746('0x28')]({'plain':!![]});var _0x4c6111=_0xf746('0x4e');return db[_0xf746('0x4f')][_0xf746('0x50')]({'where':{'name':_0x4c6111,'userProfileId':_0x55e8cf[_0xf746('0x51')]},'raw':!![]})[_0xf746('0x27')](function(_0x2914bb){if(_0x2914bb&&_0x2914bb[_0xf746('0x52')]===0x0){return db[_0xf746('0x53')][_0xf746('0x49')]({'name':_0xae66db[_0xf746('0x2c')],'resourceId':_0xae66db['id'],'type':_0x2914bb['name'],'sectionId':_0x2914bb['id']},{})[_0xf746('0x27')](function(){return _0xbad7ef;});}else{return _0xbad7ef;}})[_0xf746('0x45')](function(_0x2fe4a9){logger[_0xf746('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fe4a9);throw _0x2fe4a9;});}return _0xbad7ef;})[_0xf746('0x27')](respondWithResult(_0x38c8e0,0xc9))['catch'](handleError(_0x38c8e0,null));};exports[_0xf746('0x26')]=function(_0x5dbfcc,_0x4e69ea){if(_0x5dbfcc[_0xf746('0x4a')]['id']){delete _0x5dbfcc[_0xf746('0x4a')]['id'];}return db[_0xf746('0x2f')][_0xf746('0x50')]({'where':{'id':_0x5dbfcc[_0xf746('0x47')]['id']}})[_0xf746('0x27')](handleEntityNotFound(_0x4e69ea,null))[_0xf746('0x27')](saveUpdates(_0x5dbfcc['body'],null))[_0xf746('0x27')](respondWithResult(_0x4e69ea,null))['catch'](handleError(_0x4e69ea,null));};exports['destroy']=function(_0xa28ed9,_0x174a75){return db[_0xf746('0x2f')]['find']({'where':{'id':_0xa28ed9[_0xf746('0x47')]['id']}})[_0xf746('0x27')](handleEntityNotFound(_0x174a75,null))[_0xf746('0x27')](removeEntity(_0x174a75,null))['catch'](handleError(_0x174a75,null));};
\ No newline at end of file
+var _0x65ac=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','length','create','user','role','Dispositions','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x297003,_0x846a4b){var _0x20377e=function(_0x1292e3){while(--_0x1292e3){_0x297003['push'](_0x297003['shift']());}};_0x20377e(++_0x846a4b);}(_0x65ac,0x100));var _0xc65a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x65ac[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc65a('0x0'));var zipdir=require(_0xc65a('0x1'));var jsonpatch=require(_0xc65a('0x2'));var rp=require('request-promise');var moment=require(_0xc65a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc65a('0x4'));var util=require('util');var path=require(_0xc65a('0x5'));var sox=require(_0xc65a('0x6'));var csv=require(_0xc65a('0x7'));var ejs=require(_0xc65a('0x8'));var fs=require('fs');var fs_extra=require(_0xc65a('0x9'));var _=require(_0xc65a('0xa'));var squel=require(_0xc65a('0xb'));var crypto=require(_0xc65a('0xc'));var jsforce=require(_0xc65a('0xd'));var deskjs=require(_0xc65a('0xe'));var toCsv=require(_0xc65a('0x7'));var querystring=require(_0xc65a('0xf'));var Papa=require(_0xc65a('0x10'));var Redis=require(_0xc65a('0x11'));var authService=require(_0xc65a('0x12'));var qs=require(_0xc65a('0x13'));var as=require(_0xc65a('0x14'));var hardwareService=require(_0xc65a('0x15'));var logger=require(_0xc65a('0x16'))(_0xc65a('0x17'));var utils=require(_0xc65a('0x18'));var config=require(_0xc65a('0x19'));var licenseUtil=require(_0xc65a('0x1a'));var db=require(_0xc65a('0x1b'))['db'];function respondWithStatusCode(_0x2f8620,_0x4e46fb){_0x4e46fb=_0x4e46fb||0xcc;return function(_0x3efaab){if(_0x3efaab){return _0x2f8620[_0xc65a('0x1c')](_0x4e46fb);}return _0x2f8620[_0xc65a('0x1d')](_0x4e46fb)['end']();};}function respondWithResult(_0x5755d7,_0x4489d7){_0x4489d7=_0x4489d7||0xc8;return function(_0x35f5d4){if(_0x35f5d4){return _0x5755d7['status'](_0x4489d7)[_0xc65a('0x1e')](_0x35f5d4);}};}function respondWithFilteredResult(_0x5e80fd,_0x114237){return function(_0x45c819){if(_0x45c819){var _0x48ba52=typeof _0x114237[_0xc65a('0x1f')]==='undefined'&&typeof _0x114237[_0xc65a('0x20')]==='undefined';var _0x40e039=_0x45c819['count'];var _0x3e411a=_0x48ba52?0x0:_0x114237[_0xc65a('0x1f')];var _0x49144f=_0x48ba52?_0x45c819[_0xc65a('0x21')]:_0x114237[_0xc65a('0x1f')]+_0x114237[_0xc65a('0x20')];var _0x37f229;if(_0x49144f>=_0x40e039){_0x49144f=_0x40e039;_0x37f229=0xc8;}else{_0x37f229=0xce;}_0x5e80fd[_0xc65a('0x1d')](_0x37f229);return _0x5e80fd[_0xc65a('0x22')](_0xc65a('0x23'),_0x3e411a+'-'+_0x49144f+'/'+_0x40e039)[_0xc65a('0x1e')](_0x45c819);}return null;};}function patchUpdates(_0x281aa5){return function(_0x569f8e){try{jsonpatch[_0xc65a('0x24')](_0x569f8e,_0x281aa5,!![]);}catch(_0x381b5b){return BPromise[_0xc65a('0x25')](_0x381b5b);}return _0x569f8e[_0xc65a('0x26')]();};}function saveUpdates(_0x11d132,_0x50c395){return function(_0x7881c){if(_0x7881c){return _0x7881c['update'](_0x11d132)[_0xc65a('0x27')](function(_0x45f147){return _0x45f147;});}return null;};}function removeEntity(_0x3126ee,_0x19c85e){return function(_0x344b58){if(_0x344b58){return _0x344b58[_0xc65a('0x28')]()[_0xc65a('0x27')](function(){var _0x32d1c3=_0x344b58[_0xc65a('0x29')]({'plain':!![]});var _0x2d1719='Dispositions';return db[_0xc65a('0x2a')][_0xc65a('0x28')]({'where':{'type':_0x2d1719,'resourceId':_0x32d1c3['id']}})['then'](function(){return _0x344b58;});})[_0xc65a('0x27')](function(){_0x3126ee[_0xc65a('0x1d')](0xcc)[_0xc65a('0x2b')]();});}};}function handleEntityNotFound(_0x52e439,_0x5f4d8c){return function(_0xcddcce){if(!_0xcddcce){_0x52e439[_0xc65a('0x1c')](0x194);}return _0xcddcce;};}function handleError(_0x5165c1,_0x5e4a65){_0x5e4a65=_0x5e4a65||0x1f4;return function(_0x3f523a){logger[_0xc65a('0x2c')](_0x3f523a[_0xc65a('0x2d')]);if(_0x3f523a[_0xc65a('0x2e')]){delete _0x3f523a['name'];}_0x5165c1[_0xc65a('0x1d')](_0x5e4a65)[_0xc65a('0x2f')](_0x3f523a);};}exports[_0xc65a('0x30')]=function(_0x12e06c,_0x338f78){var _0x3c45b2={},_0x23b577={},_0x51c2aa={'count':0x0,'rows':[]};var _0x1fe5a2=_[_0xc65a('0x31')](db[_0xc65a('0x32')][_0xc65a('0x33')],function(_0x22c5ef){return{'name':_0x22c5ef[_0xc65a('0x34')],'type':_0x22c5ef[_0xc65a('0x35')][_0xc65a('0x36')]};});_0x23b577['model']=_[_0xc65a('0x31')](_0x1fe5a2,_0xc65a('0x2e'));_0x23b577[_0xc65a('0x37')]=_[_0xc65a('0x38')](_0x12e06c[_0xc65a('0x37')]);_0x23b577[_0xc65a('0x39')]=_[_0xc65a('0x3a')](_0x23b577[_0xc65a('0x3b')],_0x23b577[_0xc65a('0x37')]);_0x3c45b2[_0xc65a('0x3c')]=_[_0xc65a('0x3a')](_0x23b577[_0xc65a('0x3b')],qs[_0xc65a('0x3d')](_0x12e06c[_0xc65a('0x37')][_0xc65a('0x3d')]));_0x3c45b2[_0xc65a('0x3c')]=_0x3c45b2[_0xc65a('0x3c')]['length']?_0x3c45b2[_0xc65a('0x3c')]:_0x23b577[_0xc65a('0x3b')];if(!_0x12e06c[_0xc65a('0x37')][_0xc65a('0x3e')](_0xc65a('0x3f'))){_0x3c45b2[_0xc65a('0x20')]=qs[_0xc65a('0x20')](_0x12e06c[_0xc65a('0x37')][_0xc65a('0x20')]);_0x3c45b2[_0xc65a('0x1f')]=qs['offset'](_0x12e06c[_0xc65a('0x37')][_0xc65a('0x1f')]);}_0x3c45b2[_0xc65a('0x40')]=qs[_0xc65a('0x41')](_0x12e06c['query'][_0xc65a('0x41')]);_0x3c45b2[_0xc65a('0x42')]=qs[_0xc65a('0x39')](_[_0xc65a('0x43')](_0x12e06c[_0xc65a('0x37')],_0x23b577[_0xc65a('0x39')]),_0x1fe5a2);if(_0x12e06c[_0xc65a('0x37')]['filter']){_0x3c45b2[_0xc65a('0x42')]=_[_0xc65a('0x44')](_0x3c45b2[_0xc65a('0x42')],{'$or':_[_0xc65a('0x31')](_0x1fe5a2,function(_0x10bd50){if(_0x10bd50['type']!==_0xc65a('0x45')){var _0x1109b9={};_0x1109b9[_0x10bd50[_0xc65a('0x2e')]]={'$like':'%'+_0x12e06c[_0xc65a('0x37')][_0xc65a('0x46')]+'%'};return _0x1109b9;}})});}_0x3c45b2=_[_0xc65a('0x44')]({},_0x3c45b2,_0x12e06c[_0xc65a('0x47')]);var _0x1f0344={'where':_0x3c45b2[_0xc65a('0x42')]};return db['Disposition'][_0xc65a('0x21')](_0x1f0344)[_0xc65a('0x27')](function(_0x17b922){_0x51c2aa[_0xc65a('0x21')]=_0x17b922;if(_0x12e06c['query'][_0xc65a('0x48')]){_0x3c45b2[_0xc65a('0x49')]=[{'all':!![]}];}return db[_0xc65a('0x32')][_0xc65a('0x4a')](_0x3c45b2);})[_0xc65a('0x27')](function(_0x213ced){_0x51c2aa['rows']=_0x213ced;return _0x51c2aa;})['then'](respondWithFilteredResult(_0x338f78,_0x3c45b2))[_0xc65a('0x4b')](handleError(_0x338f78,null));};exports['show']=function(_0x12a100,_0x5eef5e){var _0x13adb2={'raw':!![],'where':{'id':_0x12a100[_0xc65a('0x4c')]['id']}},_0x2df8a5={};_0x2df8a5[_0xc65a('0x3b')]=_['keys'](db['Disposition'][_0xc65a('0x33')]);_0x2df8a5[_0xc65a('0x37')]=_[_0xc65a('0x38')](_0x12a100[_0xc65a('0x37')]);_0x2df8a5[_0xc65a('0x39')]=_[_0xc65a('0x3a')](_0x2df8a5[_0xc65a('0x3b')],_0x2df8a5[_0xc65a('0x37')]);_0x13adb2[_0xc65a('0x3c')]=_[_0xc65a('0x3a')](_0x2df8a5[_0xc65a('0x3b')],qs['fields'](_0x12a100[_0xc65a('0x37')][_0xc65a('0x3d')]));_0x13adb2['attributes']=_0x13adb2[_0xc65a('0x3c')][_0xc65a('0x4d')]?_0x13adb2[_0xc65a('0x3c')]:_0x2df8a5[_0xc65a('0x3b')];if(_0x12a100[_0xc65a('0x37')][_0xc65a('0x48')]){_0x13adb2[_0xc65a('0x49')]=[{'all':!![]}];}_0x13adb2=_[_0xc65a('0x44')]({},_0x13adb2,_0x12a100[_0xc65a('0x47')]);return db[_0xc65a('0x32')]['find'](_0x13adb2)[_0xc65a('0x27')](handleEntityNotFound(_0x5eef5e,null))[_0xc65a('0x27')](respondWithResult(_0x5eef5e,null))[_0xc65a('0x4b')](handleError(_0x5eef5e,null));};exports['create']=function(_0x15eb79,_0x5c456b){return db[_0xc65a('0x32')][_0xc65a('0x4e')](_0x15eb79['body'],{})[_0xc65a('0x27')](function(_0x46e4af){var _0x57816c=_0x15eb79[_0xc65a('0x4f')][_0xc65a('0x29')]({'plain':!![]});if(!_0x57816c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57816c[_0xc65a('0x50')]===_0xc65a('0x4f')){var _0x25b463=_0x46e4af['get']({'plain':!![]});var _0x58720e=_0xc65a('0x51');return db[_0xc65a('0x52')][_0xc65a('0x53')]({'where':{'name':_0x58720e,'userProfileId':_0x57816c[_0xc65a('0x54')]},'raw':!![]})[_0xc65a('0x27')](function(_0x1a4f04){if(_0x1a4f04&&_0x1a4f04[_0xc65a('0x55')]===0x0){return db['UserProfileResource'][_0xc65a('0x4e')]({'name':_0x25b463[_0xc65a('0x2e')],'resourceId':_0x25b463['id'],'type':_0x1a4f04[_0xc65a('0x2e')],'sectionId':_0x1a4f04['id']},{})[_0xc65a('0x27')](function(){return _0x46e4af;});}else{return _0x46e4af;}})[_0xc65a('0x4b')](function(_0x5a9531){logger[_0xc65a('0x2c')](_0xc65a('0x56'),_0x5a9531);throw _0x5a9531;});}return _0x46e4af;})['then'](respondWithResult(_0x5c456b,0xc9))[_0xc65a('0x4b')](handleError(_0x5c456b,null));};exports[_0xc65a('0x57')]=function(_0x5abaa5,_0x1929c4){if(_0x5abaa5['body']['id']){delete _0x5abaa5[_0xc65a('0x58')]['id'];}return db[_0xc65a('0x32')]['find']({'where':{'id':_0x5abaa5['params']['id']}})[_0xc65a('0x27')](handleEntityNotFound(_0x1929c4,null))[_0xc65a('0x27')](saveUpdates(_0x5abaa5[_0xc65a('0x58')],null))['then'](respondWithResult(_0x1929c4,null))['catch'](handleError(_0x1929c4,null));};exports['destroy']=function(_0x34d442,_0x21ac78){return db['Disposition'][_0xc65a('0x53')]({'where':{'id':_0x34d442[_0xc65a('0x4c')]['id']}})[_0xc65a('0x27')](handleEntityNotFound(_0x21ac78,null))['then'](removeEntity(_0x21ac78,null))[_0xc65a('0x4b')](handleError(_0x21ac78,null));};
\ No newline at end of file
index 91ea945..94890a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xefb8=['lodash','api','bluebird','rimraf','./disposition.attributes','exports','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','MailAccountId','SmsAccountId','FaxAccountId','name_openchannel','name_whatsapp'];(function(_0x1cf688,_0x5b6111){var _0x4001bd=function(_0x5acccf){while(--_0x5acccf){_0x1cf688['push'](_0x1cf688['shift']());}};_0x4001bd(++_0x5b6111);}(_0xefb8,0xa0));var _0x8efb=function(_0x47c640,_0x2dd529){_0x47c640=_0x47c640-0x0;var _0x4a62d6=_0xefb8[_0x47c640];return _0x4a62d6;};'use strict';var _=require(_0x8efb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8efb('0x1'));var moment=require('moment');var BPromise=require(_0x8efb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8efb('0x3'));var config=require('../../config/environment');var attributes=require(_0x8efb('0x4'));module[_0x8efb('0x5')]=function(_0x55e9f0,_0x2e9e99){return _0x55e9f0['define']('Disposition',attributes,{'tableName':_0x8efb('0x6'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x8efb('0x7'),'fields':[_0x8efb('0x8'),'ListId']},{'unique':!![],'name':_0x8efb('0x9'),'fields':[_0x8efb('0x8'),_0x8efb('0xa')]},{'unique':!![],'name':'name_mail','fields':[_0x8efb('0x8'),_0x8efb('0xb')]},{'unique':!![],'name':'name_sms','fields':[_0x8efb('0x8'),_0x8efb('0xc')]},{'unique':!![],'name':'name_fax','fields':[_0x8efb('0x8'),_0x8efb('0xd')]},{'unique':!![],'name':_0x8efb('0xe'),'fields':[_0x8efb('0x8'),'OpenchannelAccountId']},{'unique':!![],'name':_0x8efb('0xf'),'fields':[_0x8efb('0x8'),'WhatsappAccountId']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x7197=['name','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','ListId','name_chat','name_mail','MailAccountId','name_sms'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0x7197,0x126));var _0x7719=function(_0x1a5141,_0x4cf07e){_0x1a5141=_0x1a5141-0x0;var _0x451e60=_0x7197[_0x1a5141];return _0x451e60;};'use strict';var _=require(_0x7719('0x0'));var util=require(_0x7719('0x1'));var logger=require('../../config/logger')(_0x7719('0x2'));var moment=require(_0x7719('0x3'));var BPromise=require(_0x7719('0x4'));var rp=require(_0x7719('0x5'));var fs=require('fs');var path=require(_0x7719('0x6'));var rimraf=require('rimraf');var config=require(_0x7719('0x7'));var attributes=require(_0x7719('0x8'));module['exports']=function(_0x89c1a4,_0x59775d){return _0x89c1a4[_0x7719('0x9')](_0x7719('0xa'),attributes,{'tableName':_0x7719('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7719('0xc'),'fields':['name',_0x7719('0xd')]},{'unique':!![],'name':_0x7719('0xe'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0x7719('0xf'),'fields':['name',_0x7719('0x10')]},{'unique':!![],'name':_0x7719('0x11'),'fields':[_0x7719('0x12'),_0x7719('0x13')]},{'unique':!![],'name':_0x7719('0x14'),'fields':[_0x7719('0x12'),_0x7719('0x15')]},{'unique':!![],'name':_0x7719('0x16'),'fields':['name',_0x7719('0x17')]},{'unique':!![],'name':_0x7719('0x18'),'fields':[_0x7719('0x12'),_0x7719('0x19')]}],'timestamps':!![]});};
\ No newline at end of file
index a84f584..162f64f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b4379,_0x10cb7f){var _0x3d1d03=function(_0x5d5ee2){while(--_0x5d5ee2){_0x1b4379['push'](_0x1b4379['shift']());}};_0x3d1d03(++_0x10cb7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}
\ No newline at end of file
+var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xa691ac,_0x1141a7){var _0x555a35=function(_0x174e56){while(--_0x174e56){_0xa691ac['push'](_0xa691ac['shift']());}};_0x555a35(++_0x1141a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}
\ No newline at end of file
index 96cec13..7776a23 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9b28=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports','multer','util'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0x9b28,0x1b3));var _0x89b2=function(_0x26f8ec,_0x3b9697){_0x26f8ec=_0x26f8ec-0x0;var _0x4d770b=_0x9b28[_0x26f8ec];return _0x4d770b;};'use strict';var multer=require(_0x89b2('0x0'));var util=require(_0x89b2('0x1'));var path=require('path');var timeout=require(_0x89b2('0x2'));var express=require('express');var router=express[_0x89b2('0x3')]();var fs_extra=require(_0x89b2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x89b2('0x5'));var config=require(_0x89b2('0x6'));var controller=require(_0x89b2('0x7'));router['get']('/',auth[_0x89b2('0x8')](),controller[_0x89b2('0x9')]);router[_0x89b2('0xa')](_0x89b2('0xb'),auth['isAuthenticated'](),controller[_0x89b2('0xc')]);router['post']('/',auth[_0x89b2('0x8')](),controller[_0x89b2('0xd')]);router[_0x89b2('0xe')](_0x89b2('0xb'),auth[_0x89b2('0x8')](),controller[_0x89b2('0xf')]);router[_0x89b2('0x10')](_0x89b2('0xb'),auth[_0x89b2('0x8')](),controller[_0x89b2('0x11')]);module[_0x89b2('0x12')]=router;
\ No newline at end of file
+var _0xd203=['multer','util','express','Router','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','show','post','put','update','destroy','exports'];(function(_0x44701a,_0x529f1d){var _0xcebe1=function(_0x532e12){while(--_0x532e12){_0x44701a['push'](_0x44701a['shift']());}};_0xcebe1(++_0x529f1d);}(_0xd203,0xf0));var _0x3d20=function(_0x35197f,_0x4653ff){_0x35197f=_0x35197f-0x0;var _0x58c093=_0xd203[_0x35197f];return _0x58c093;};'use strict';var multer=require(_0x3d20('0x0'));var util=require(_0x3d20('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3d20('0x2'));var router=express[_0x3d20('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3d20('0x4'));var config=require(_0x3d20('0x5'));var controller=require(_0x3d20('0x6'));router[_0x3d20('0x7')]('/',auth[_0x3d20('0x8')](),controller['index']);router[_0x3d20('0x7')](_0x3d20('0x9'),auth[_0x3d20('0x8')](),controller[_0x3d20('0xa')]);router[_0x3d20('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3d20('0xc')](_0x3d20('0x9'),auth['isAuthenticated'](),controller[_0x3d20('0xd')]);router['delete']('/:id',auth[_0x3d20('0x8')](),controller[_0x3d20('0xe')]);module[_0x3d20('0xf')]=router;
\ No newline at end of file
index 4161ec0..cd4c579 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa4c7=['exports','STRING','yes','ENUM','4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize'];(function(_0x318cdf,_0x9b0a50){var _0x7c1925=function(_0xb508a8){while(--_0xb508a8){_0x318cdf['push'](_0x318cdf['shift']());}};_0x7c1925(++_0x9b0a50);}(_0xa4c7,0x133));var _0x7a4c=function(_0x1b88fc,_0x3d14ef){_0x1b88fc=_0x1b88fc-0x0;var _0x4a90b1=_0xa4c7[_0x1b88fc];return _0x4a90b1;};'use strict';var Sequelize=require(_0x7a4c('0x0'));module[_0x7a4c('0x1')]={'name':{'type':Sequelize[_0x7a4c('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7a4c('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x7a4c('0x3'),'no'),'defaultValue':_0x7a4c('0x3')},'headerinfo':{'type':Sequelize[_0x7a4c('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x7a4c('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x7a4c('0x4')]('2400',_0x7a4c('0x5'),_0x7a4c('0x6'),_0x7a4c('0x7'),_0x7a4c('0x8'),_0x7a4c('0x9')),'defaultValue':_0x7a4c('0x5')},'maxrate':{'type':Sequelize[_0x7a4c('0x4')](_0x7a4c('0xa'),_0x7a4c('0x5'),_0x7a4c('0x6'),'9600',_0x7a4c('0x8'),_0x7a4c('0x9')),'defaultValue':_0x7a4c('0x9')},'modem':{'type':Sequelize[_0x7a4c('0x2')],'defaultValue':_0x7a4c('0xb')},'gateway':{'type':Sequelize[_0x7a4c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x7a4c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x7a4c('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x7a4c('0x4')](_0x7a4c('0xd'),_0x7a4c('0xe'),_0x7a4c('0xf'),_0x7a4c('0x10')),'defaultValue':_0x7a4c('0xd')},'key':{'type':Sequelize[_0x7a4c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7a4c('0x11');}},'notificationSound':{'type':Sequelize[_0x7a4c('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7a4c('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7a4c('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7a4c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7a4c('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7a4c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7a4c('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x7a4c('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x7a4c('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1f8191){if(!_0x1f8191)this[_0x7a4c('0x14')](_0x7a4c('0x15'),null);this[_0x7a4c('0x14')]('mandatoryDisposition',_0x1f8191);}}};
\ No newline at end of file
+var _0x7e89=['TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','12000','14400','7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI'];(function(_0x5b1c5a,_0x390f8b){var _0x88673b=function(_0x317c26){while(--_0x317c26){_0x5b1c5a['push'](_0x5b1c5a['shift']());}};_0x88673b(++_0x390f8b);}(_0x7e89,0x181));var _0x97e8=function(_0x3a8b2d,_0x4ea870){_0x3a8b2d=_0x3a8b2d-0x0;var _0x54f1be=_0x7e89[_0x3a8b2d];return _0x54f1be;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x97e8('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x97e8('0x0')]},'ecm':{'type':Sequelize[_0x97e8('0x1')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x97e8('0x0')],'defaultValue':_0x97e8('0x2')},'localstationid':{'type':Sequelize[_0x97e8('0x0')],'unique':_0x97e8('0x3')},'minrate':{'type':Sequelize['ENUM'](_0x97e8('0x4'),_0x97e8('0x5'),'7200','9600',_0x97e8('0x6'),_0x97e8('0x7')),'defaultValue':_0x97e8('0x5')},'maxrate':{'type':Sequelize[_0x97e8('0x1')](_0x97e8('0x4'),_0x97e8('0x5'),_0x97e8('0x8'),'9600',_0x97e8('0x6'),_0x97e8('0x7')),'defaultValue':_0x97e8('0x7')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x97e8('0x9')},'gateway':{'type':Sequelize[_0x97e8('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x97e8('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x97e8('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x97e8('0x1')](_0x97e8('0xb'),_0x97e8('0xc'),_0x97e8('0xd'),'KHOMP'),'defaultValue':_0x97e8('0xb')},'key':{'type':Sequelize[_0x97e8('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x97e8('0xe')],'defaultValue':function(){return _0x97e8('0xf');}},'notificationSound':{'type':Sequelize[_0x97e8('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x97e8('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x97e8('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x97e8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x97e8('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x97e8('0xa')],'allowNull':!![],'defaultValue':null,'comment':_0x97e8('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4dae7d){if(!_0x4dae7d)this[_0x97e8('0x12')](_0x97e8('0x13'),null);this[_0x97e8('0x12')](_0x97e8('0x14'),_0x4dae7d);}}};
\ No newline at end of file
index c7fff8c..1c8df5b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2913=['emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','Pause','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','FaxAccount','rows','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','mandatoryDispositionPause','describe','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tags','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','system','appdata','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','push','FAXOPT(','Wait','ReceiveFax','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','basename','isNil','path','from','\x22%s\x22\x20<%s>','List\x20not\x20found','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents'];(function(_0x37e796,_0x24784e){var _0x287054=function(_0x3f52c1){while(--_0x3f52c1){_0x37e796['push'](_0x37e796['shift']());}};_0x287054(++_0x24784e);}(_0x2913,0xc9));var _0x3291=function(_0x4dc565,_0x55fbee){_0x4dc565=_0x4dc565-0x0;var _0xabb583=_0x2913[_0x4dc565];return _0xabb583;};'use strict';var emlformat=require(_0x3291('0x0'));var rimraf=require(_0x3291('0x1'));var zipdir=require(_0x3291('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3291('0x3'));var moment=require(_0x3291('0x4'));var BPromise=require(_0x3291('0x5'));var Mustache=require('mustache');var util=require(_0x3291('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3291('0x7'));var ejs=require(_0x3291('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3291('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3291('0xa'));var deskjs=require(_0x3291('0xb'));var toCsv=require(_0x3291('0x7'));var querystring=require(_0x3291('0xc'));var Papa=require(_0x3291('0xd'));var Redis=require('ioredis');var authService=require(_0x3291('0xe'));var qs=require(_0x3291('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3291('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x3291('0x11'));var config=require(_0x3291('0x12'));var licenseUtil=require(_0x3291('0x13'));var db=require('../../mysqldb')['db'];config[_0x3291('0x14')]=_[_0x3291('0x15')](config['redis'],{'host':_0x3291('0x16'),'port':0x18eb});var socket=require(_0x3291('0x17'))(new Redis(config['redis']));require(_0x3291('0x18'))[_0x3291('0x19')](socket);var jayson=require(_0x3291('0x1a'));var client=jayson[_0x3291('0x1b')][_0x3291('0x1c')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x290d39,_0x2146fd,_0x216105,_0x3fb83e){return new BPromise(function(_0x496c0f,_0xd5e460){var _0x4d458d=_0x3fb83e||client;return _0x4d458d[_0x3291('0x1d')](_0x290d39,_0x216105)[_0x3291('0x1e')](function(_0x2865fa){logger['info'](_0x3291('0x1f'),_0x2146fd,_0x3291('0x20'));logger[_0x3291('0x21')](_0x3291('0x22'),_0x2146fd,_0x3291('0x20'),JSON[_0x3291('0x23')](_0x2865fa));if(_0x2865fa['error']){if(_0x2865fa[_0x3291('0x24')][_0x3291('0x25')]===0x1f4){logger[_0x3291('0x24')](_0x3291('0x1f'),_0x2146fd,_0x2865fa[_0x3291('0x24')][_0x3291('0x26')]);return _0xd5e460(_0x2865fa['error'][_0x3291('0x26')]);}logger[_0x3291('0x24')]('FaxAccount,\x20%s,\x20%s',_0x2146fd,_0x2865fa['error'][_0x3291('0x26')]);return _0x496c0f(_0x2865fa['error']['message']);}else{logger[_0x3291('0x27')](_0x3291('0x1f'),_0x2146fd,_0x3291('0x20'));_0x496c0f(_0x2865fa['result'][_0x3291('0x26')]);}})[_0x3291('0x28')](function(_0x3297f0){logger[_0x3291('0x24')](_0x3291('0x1f'),_0x2146fd,_0x3297f0);_0xd5e460(_0x3297f0);});});}function respondWithStatusCode(_0x22b69c,_0x3fc83a){_0x3fc83a=_0x3fc83a||0xcc;return function(_0x194be4){if(_0x194be4){return _0x22b69c[_0x3291('0x29')](_0x3fc83a);}return _0x22b69c['status'](_0x3fc83a)[_0x3291('0x2a')]();};}function respondWithResult(_0xe8b4ec,_0xec3de8){_0xec3de8=_0xec3de8||0xc8;return function(_0x3cd39f){if(_0x3cd39f){return _0xe8b4ec[_0x3291('0x2b')](_0xec3de8)[_0x3291('0x2c')](_0x3cd39f);}};}function respondWithFilteredResult(_0x19a377,_0x15fb49){return function(_0x56f645){if(_0x56f645){var _0x591bdb=typeof _0x15fb49[_0x3291('0x2d')]===_0x3291('0x2e')&&typeof _0x15fb49[_0x3291('0x2f')]==='undefined';var _0x4c6486=_0x56f645[_0x3291('0x30')];var _0x49c1d2=_0x591bdb?0x0:_0x15fb49[_0x3291('0x2d')];var _0x4b1fd0=_0x591bdb?_0x56f645[_0x3291('0x30')]:_0x15fb49[_0x3291('0x2d')]+_0x15fb49[_0x3291('0x2f')];var _0x548d98;if(_0x4b1fd0>=_0x4c6486){_0x4b1fd0=_0x4c6486;_0x548d98=0xc8;}else{_0x548d98=0xce;}_0x19a377['status'](_0x548d98);return _0x19a377['set'](_0x3291('0x31'),_0x49c1d2+'-'+_0x4b1fd0+'/'+_0x4c6486)[_0x3291('0x2c')](_0x56f645);}return null;};}function patchUpdates(_0x210781){return function(_0x4cabb0){try{jsonpatch[_0x3291('0x32')](_0x4cabb0,_0x210781,!![]);}catch(_0x819912){return BPromise['reject'](_0x819912);}return _0x4cabb0['save']();};}function saveUpdates(_0x2cecb8,_0x1cf8eb){return function(_0x5e631d){if(_0x5e631d){return _0x5e631d[_0x3291('0x33')](_0x2cecb8)[_0x3291('0x1e')](function(_0x4d9dff){return _0x4d9dff;});}return null;};}function removeEntity(_0x3bffc8,_0x7e252e){return function(_0x46b708){if(_0x46b708){return _0x46b708[_0x3291('0x34')]()[_0x3291('0x1e')](function(){var _0x373227=_0x46b708[_0x3291('0x35')]({'plain':!![]});var _0xcad77f=_0x3291('0x36');return db[_0x3291('0x37')][_0x3291('0x34')]({'where':{'type':_0xcad77f,'resourceId':_0x373227['id']}})[_0x3291('0x1e')](function(){return _0x46b708;});})[_0x3291('0x1e')](function(){_0x3bffc8[_0x3291('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b139f,_0x574ef2){return function(_0x4640b3){if(!_0x4640b3){_0x1b139f[_0x3291('0x29')](0x194);}return _0x4640b3;};}function handleError(_0x2d1c8d,_0x2822f1){_0x2822f1=_0x2822f1||0x1f4;return function(_0xcb7669){logger['error'](_0xcb7669[_0x3291('0x38')]);if(_0xcb7669[_0x3291('0x39')]){delete _0xcb7669[_0x3291('0x39')];}_0x2d1c8d[_0x3291('0x2b')](_0x2822f1)[_0x3291('0x3a')](_0xcb7669);};}exports['index']=function(_0x1ae4ce,_0x183d6c){var _0x437970={'include':[{'model':db[_0x3291('0x3b')],'as':'mandatoryDispositionPause'}]},_0x4a4dff={},_0x275e07={'count':0x0,'rows':[]};var _0x204026=_['map'](db['FaxAccount'][_0x3291('0x3c')],function(_0x4dc737){return{'name':_0x4dc737[_0x3291('0x3d')],'type':_0x4dc737['type']['key']};});_0x4a4dff['model']=_[_0x3291('0x3e')](_0x204026,_0x3291('0x39'));_0x4a4dff[_0x3291('0x3f')]=_[_0x3291('0x40')](_0x1ae4ce[_0x3291('0x3f')]);_0x4a4dff[_0x3291('0x41')]=_[_0x3291('0x42')](_0x4a4dff[_0x3291('0x43')],_0x4a4dff[_0x3291('0x3f')]);_0x437970[_0x3291('0x44')]=_[_0x3291('0x42')](_0x4a4dff[_0x3291('0x43')],qs[_0x3291('0x45')](_0x1ae4ce[_0x3291('0x3f')][_0x3291('0x45')]));_0x437970['attributes']=_0x437970['attributes'][_0x3291('0x46')]?_0x437970[_0x3291('0x44')]:_0x4a4dff['model'];if(!_0x1ae4ce[_0x3291('0x3f')]['hasOwnProperty'](_0x3291('0x47'))){_0x437970[_0x3291('0x2f')]=qs[_0x3291('0x2f')](_0x1ae4ce['query']['limit']);_0x437970['offset']=qs[_0x3291('0x2d')](_0x1ae4ce['query']['offset']);}_0x437970[_0x3291('0x48')]=qs['sort'](_0x1ae4ce[_0x3291('0x3f')][_0x3291('0x49')]);_0x437970[_0x3291('0x4a')]=qs[_0x3291('0x41')](_[_0x3291('0x4b')](_0x1ae4ce[_0x3291('0x3f')],_0x4a4dff[_0x3291('0x41')]),_0x204026);if(_0x1ae4ce[_0x3291('0x3f')][_0x3291('0x4c')]){_0x437970['where']=_[_0x3291('0x4d')](_0x437970[_0x3291('0x4a')],{'$or':_[_0x3291('0x3e')](_0x204026,function(_0x23ac7a){if(_0x23ac7a[_0x3291('0x4e')]!==_0x3291('0x4f')){var _0x14f808={};_0x14f808[_0x23ac7a[_0x3291('0x39')]]={'$like':'%'+_0x1ae4ce['query'][_0x3291('0x4c')]+'%'};return _0x14f808;}})});}_0x437970=_[_0x3291('0x4d')]({},_0x437970,_0x1ae4ce['options']);var _0x23701e={'where':_0x437970[_0x3291('0x4a')]};return db['FaxAccount']['count'](_0x23701e)['then'](function(_0x13dfaa){_0x275e07['count']=_0x13dfaa;if(_0x1ae4ce[_0x3291('0x3f')][_0x3291('0x50')]){_0x437970[_0x3291('0x51')]=[{'all':!![]}];}return db[_0x3291('0x52')]['findAll'](_0x437970);})[_0x3291('0x1e')](function(_0x37abb9){_0x275e07[_0x3291('0x53')]=_0x37abb9;return _0x275e07;})['then'](respondWithFilteredResult(_0x183d6c,_0x437970))[_0x3291('0x28')](handleError(_0x183d6c,null));};exports[_0x3291('0x54')]=function(_0xddee10,_0xb9b431){var _0x257204={'raw':![],'where':{'id':_0xddee10[_0x3291('0x55')]['id']},'include':[{'model':db[_0x3291('0x3b')],'as':'mandatoryDispositionPause'}]},_0x258e52={};_0x258e52[_0x3291('0x43')]=_['keys'](db[_0x3291('0x52')]['rawAttributes']);_0x258e52[_0x3291('0x3f')]=_[_0x3291('0x40')](_0xddee10['query']);_0x258e52['filters']=_['intersection'](_0x258e52['model'],_0x258e52[_0x3291('0x3f')]);_0x257204['attributes']=_['intersection'](_0x258e52[_0x3291('0x43')],qs[_0x3291('0x45')](_0xddee10[_0x3291('0x3f')]['fields']));_0x257204[_0x3291('0x44')]=_0x257204[_0x3291('0x44')][_0x3291('0x46')]?_0x257204[_0x3291('0x44')]:_0x258e52[_0x3291('0x43')];if(_0xddee10['query'][_0x3291('0x50')]){_0x257204[_0x3291('0x51')]=[{'all':!![]}];}_0x257204=_[_0x3291('0x4d')]({},_0x257204,_0xddee10[_0x3291('0x56')]);return db[_0x3291('0x52')][_0x3291('0x57')](_0x257204)[_0x3291('0x1e')](handleEntityNotFound(_0xb9b431,null))[_0x3291('0x1e')](respondWithResult(_0xb9b431,null))['catch'](handleError(_0xb9b431,null));};exports['create']=function(_0x18e066,_0x36f5db){return db[_0x3291('0x52')][_0x3291('0x58')](_0x18e066[_0x3291('0x59')],{})[_0x3291('0x1e')](function(_0x12a07e){var _0x331510=_0x18e066['user'][_0x3291('0x35')]({'plain':!![]});if(!_0x331510)throw new Error(_0x3291('0x5a'));if(_0x331510[_0x3291('0x5b')]===_0x3291('0x5c')){var _0x12297a=_0x12a07e[_0x3291('0x35')]({'plain':!![]});var _0x5f241=_0x3291('0x36');return db[_0x3291('0x5d')][_0x3291('0x57')]({'where':{'name':_0x5f241,'userProfileId':_0x331510[_0x3291('0x5e')]},'raw':!![]})[_0x3291('0x1e')](function(_0x32999b){if(_0x32999b&&_0x32999b[_0x3291('0x5f')]===0x0){return db['UserProfileResource'][_0x3291('0x58')]({'name':_0x12297a[_0x3291('0x39')],'resourceId':_0x12297a['id'],'type':_0x32999b[_0x3291('0x39')],'sectionId':_0x32999b['id']},{})[_0x3291('0x1e')](function(){return _0x12a07e;});}else{return _0x12a07e;}})[_0x3291('0x28')](function(_0x1b330b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b330b);throw _0x1b330b;});}return _0x12a07e;})[_0x3291('0x1e')](respondWithResult(_0x36f5db,0xc9))[_0x3291('0x28')](handleError(_0x36f5db,null));};exports[_0x3291('0x33')]=function(_0x4089a2,_0x10e03c){if(_0x4089a2['body']['id']){delete _0x4089a2[_0x3291('0x59')]['id'];}return db[_0x3291('0x52')]['find']({'where':{'id':_0x4089a2[_0x3291('0x55')]['id']},'include':[{'model':db[_0x3291('0x3b')],'as':_0x3291('0x60')}]})['then'](handleEntityNotFound(_0x10e03c,null))[_0x3291('0x1e')](saveUpdates(_0x4089a2[_0x3291('0x59')],null))[_0x3291('0x1e')](respondWithResult(_0x10e03c,null))[_0x3291('0x28')](handleError(_0x10e03c,null));};exports[_0x3291('0x34')]=function(_0x30ec96,_0x515da1){return db[_0x3291('0x52')][_0x3291('0x57')]({'where':{'id':_0x30ec96[_0x3291('0x55')]['id']}})[_0x3291('0x1e')](handleEntityNotFound(_0x515da1,null))[_0x3291('0x1e')](removeEntity(_0x515da1,null))[_0x3291('0x28')](handleError(_0x515da1,null));};exports[_0x3291('0x61')]=function(_0x5b97ed,_0x44aeae){return db[_0x3291('0x52')]['describe']()[_0x3291('0x1e')](respondWithResult(_0x44aeae,null))[_0x3291('0x28')](handleError(_0x44aeae,null));};exports['addDisposition']=function(_0x493ab4,_0x3bba2b,_0x15da38){if(_0x493ab4[_0x3291('0x59')]['id']){delete _0x493ab4[_0x3291('0x59')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x493ab4[_0x3291('0x55')]['id']}})[_0x3291('0x1e')](handleEntityNotFound(_0x3bba2b,null))[_0x3291('0x1e')](function(_0x4d575d){if(_0x4d575d){_0x493ab4[_0x3291('0x59')][_0x3291('0x62')]=_0x4d575d['id'];return db[_0x3291('0x63')][_0x3291('0x58')](_0x493ab4['body']);}})[_0x3291('0x1e')](respondWithResult(_0x3bba2b,null))['catch'](handleError(_0x3bba2b,null));};exports[_0x3291('0x64')]=function(_0x16eebe,_0x1637ac,_0x1b1fef){var _0x471f6a={'raw':![],'where':{}};var _0x4d1cc4={};var _0x56cd2e={'count':0x0,'rows':[]};return db[_0x3291('0x52')][_0x3291('0x65')]({'where':{'id':_0x16eebe['params']['id']}})[_0x3291('0x1e')](handleEntityNotFound(_0x1637ac,null))['then'](function(_0x13027f){if(_0x13027f){_0x4d1cc4[_0x3291('0x43')]=_[_0x3291('0x40')](db['Disposition'][_0x3291('0x3c')]);_0x4d1cc4[_0x3291('0x3f')]=_[_0x3291('0x40')](_0x16eebe['query']);_0x4d1cc4[_0x3291('0x41')]=_['intersection'](_0x4d1cc4[_0x3291('0x43')],_0x4d1cc4[_0x3291('0x3f')]);_0x471f6a['attributes']=_[_0x3291('0x42')](_0x4d1cc4[_0x3291('0x43')],qs['fields'](_0x16eebe['query'][_0x3291('0x45')]));_0x471f6a['attributes']=_0x471f6a[_0x3291('0x44')][_0x3291('0x46')]?_0x471f6a[_0x3291('0x44')]:_0x4d1cc4[_0x3291('0x43')];if(!_0x16eebe[_0x3291('0x3f')][_0x3291('0x66')](_0x3291('0x47'))){_0x471f6a[_0x3291('0x2f')]=qs[_0x3291('0x2f')](_0x16eebe[_0x3291('0x3f')][_0x3291('0x2f')]);_0x471f6a['offset']=qs['offset'](_0x16eebe['query'][_0x3291('0x2d')]);}_0x471f6a['order']=qs['sort'](_0x16eebe['query'][_0x3291('0x49')]);_0x471f6a[_0x3291('0x4a')]=qs[_0x3291('0x41')](_[_0x3291('0x4b')](_0x16eebe['query'],_0x4d1cc4['filters']));_0x471f6a[_0x3291('0x4a')]['FaxAccountId']=_0x13027f['id'];if(_0x16eebe[_0x3291('0x3f')][_0x3291('0x4c')]){_0x471f6a[_0x3291('0x4a')]=_['merge'](_0x471f6a['where'],{'$or':_[_0x3291('0x3e')](_0x471f6a[_0x3291('0x44')],function(_0x32ab49){var _0x4fd2bb={};_0x4fd2bb[_0x32ab49]={'$like':'%'+_0x16eebe[_0x3291('0x3f')]['filter']+'%'};return _0x4fd2bb;})});}_0x471f6a=_[_0x3291('0x4d')]({},_0x471f6a,_0x16eebe[_0x3291('0x56')]);return db[_0x3291('0x63')][_0x3291('0x30')]({'where':_0x471f6a[_0x3291('0x4a')]})[_0x3291('0x1e')](function(_0x19d8ea){_0x56cd2e[_0x3291('0x30')]=_0x19d8ea;if(_0x16eebe['query'][_0x3291('0x50')]){_0x471f6a[_0x3291('0x51')]=[{'all':!![]}];}return db[_0x3291('0x63')][_0x3291('0x67')](_0x471f6a);})[_0x3291('0x1e')](function(_0x3c17f0){_0x56cd2e['rows']=_0x3c17f0;return _0x56cd2e;});}})[_0x3291('0x1e')](respondWithFilteredResult(_0x1637ac,_0x471f6a))[_0x3291('0x28')](handleError(_0x1637ac,null));};exports[_0x3291('0x68')]=function(_0x396c23,_0x4400dc,_0x11e599){return db['FaxAccount'][_0x3291('0x57')]({'where':{'id':_0x396c23[_0x3291('0x55')]['id']}})['then'](handleEntityNotFound(_0x4400dc,null))['then'](function(_0x462c33){if(_0x462c33){return _0x462c33['removeDispositions'](_0x396c23[_0x3291('0x3f')][_0x3291('0x69')]);}})['then'](respondWithStatusCode(_0x4400dc,null))[_0x3291('0x28')](handleError(_0x4400dc,null));};exports[_0x3291('0x6a')]=function(_0x550e15,_0x191c0d,_0x398eca){if(_0x550e15[_0x3291('0x59')]['id']){delete _0x550e15[_0x3291('0x59')]['id'];}return db[_0x3291('0x52')][_0x3291('0x57')]({'where':{'id':_0x550e15[_0x3291('0x55')]['id']}})['then'](handleEntityNotFound(_0x191c0d,null))[_0x3291('0x1e')](function(_0x242dee){if(_0x242dee){_0x550e15['body']['FaxAccountId']=_0x242dee['id'];return db[_0x3291('0x6b')][_0x3291('0x58')](_0x550e15[_0x3291('0x59')]);}})[_0x3291('0x1e')](respondWithResult(_0x191c0d,null))[_0x3291('0x28')](handleError(_0x191c0d,null));};exports[_0x3291('0x6c')]=function(_0x572b39,_0x48ee06,_0x4ea83c){var _0x102680={'raw':![],'where':{}};var _0x112912={};var _0x55b01d={'count':0x0,'rows':[]};return db[_0x3291('0x52')]['findOne']({'where':{'id':_0x572b39[_0x3291('0x55')]['id']}})[_0x3291('0x1e')](handleEntityNotFound(_0x48ee06,null))['then'](function(_0x2dfdae){if(_0x2dfdae){_0x112912[_0x3291('0x43')]=_[_0x3291('0x40')](db['CannedAnswer'][_0x3291('0x3c')]);_0x112912[_0x3291('0x3f')]=_[_0x3291('0x40')](_0x572b39[_0x3291('0x3f')]);_0x112912['filters']=_[_0x3291('0x42')](_0x112912[_0x3291('0x43')],_0x112912[_0x3291('0x3f')]);_0x102680['attributes']=_[_0x3291('0x42')](_0x112912[_0x3291('0x43')],qs[_0x3291('0x45')](_0x572b39[_0x3291('0x3f')][_0x3291('0x45')]));_0x102680['attributes']=_0x102680[_0x3291('0x44')][_0x3291('0x46')]?_0x102680[_0x3291('0x44')]:_0x112912[_0x3291('0x43')];if(!_0x572b39['query']['hasOwnProperty'](_0x3291('0x47'))){_0x102680[_0x3291('0x2f')]=qs[_0x3291('0x2f')](_0x572b39[_0x3291('0x3f')][_0x3291('0x2f')]);_0x102680[_0x3291('0x2d')]=qs['offset'](_0x572b39[_0x3291('0x3f')][_0x3291('0x2d')]);}_0x102680[_0x3291('0x48')]=qs['sort'](_0x572b39[_0x3291('0x3f')][_0x3291('0x49')]);_0x102680[_0x3291('0x4a')]=qs[_0x3291('0x41')](_[_0x3291('0x4b')](_0x572b39['query'],_0x112912[_0x3291('0x41')]));_0x102680[_0x3291('0x4a')][_0x3291('0x62')]=_0x2dfdae['id'];if(_0x572b39[_0x3291('0x3f')]['filter']){_0x102680[_0x3291('0x4a')]=_[_0x3291('0x4d')](_0x102680[_0x3291('0x4a')],{'$or':_['map'](_0x102680[_0x3291('0x44')],function(_0x1e2a83){var _0x4f7cca={};_0x4f7cca[_0x1e2a83]={'$like':'%'+_0x572b39['query'][_0x3291('0x4c')]+'%'};return _0x4f7cca;})});}_0x102680=_[_0x3291('0x4d')]({},_0x102680,_0x572b39[_0x3291('0x56')]);return db['CannedAnswer'][_0x3291('0x30')]({'where':_0x102680[_0x3291('0x4a')]})['then'](function(_0x3c3601){_0x55b01d['count']=_0x3c3601;if(_0x572b39['query']['includeAll']){_0x102680['include']=[{'all':!![]}];}return db[_0x3291('0x6b')][_0x3291('0x67')](_0x102680);})[_0x3291('0x1e')](function(_0x470310){_0x55b01d[_0x3291('0x53')]=_0x470310;return _0x55b01d;});}})['then'](respondWithFilteredResult(_0x48ee06,_0x102680))[_0x3291('0x28')](handleError(_0x48ee06,null));};exports[_0x3291('0x6d')]=function(_0x53c131,_0x393fbf,_0x366cbc){return db[_0x3291('0x52')][_0x3291('0x57')]({'where':{'id':_0x53c131['params']['id']}})[_0x3291('0x1e')](handleEntityNotFound(_0x393fbf,null))[_0x3291('0x1e')](function(_0xd333ac){if(_0xd333ac){return _0xd333ac[_0x3291('0x6d')](_0x53c131[_0x3291('0x3f')]['ids']);}})[_0x3291('0x1e')](respondWithStatusCode(_0x393fbf,null))[_0x3291('0x28')](handleError(_0x393fbf,null));};exports[_0x3291('0x6e')]=function(_0xe60df0,_0x45817d,_0x159b95){return db[_0x3291('0x6f')]['find']({'where':{'id':_0xe60df0[_0x3291('0x55')]['id']}})['then'](handleEntityNotFound(_0x45817d,null))['then'](function(_0x2263c7){if(_0x2263c7){return _0x2263c7['addInteraction'](_0xe60df0[_0x3291('0x59')][_0x3291('0x69')],_[_0x3291('0x70')](_0xe60df0[_0x3291('0x59')],[_0x3291('0x69'),'id'])||{});}})['then'](respondWithResult(_0x45817d,null))[_0x3291('0x28')](handleError(_0x45817d,null));};exports[_0x3291('0x71')]=function(_0x6bb166,_0x28f299,_0x28223a){var _0x5b30c0={'raw':![],'where':{}};var _0x209423={};var _0x490d37={'count':0x0,'rows':[]};return db[_0x3291('0x52')]['findOne']({'where':{'id':_0x6bb166[_0x3291('0x55')]['id']}})[_0x3291('0x1e')](handleEntityNotFound(_0x28f299,null))[_0x3291('0x1e')](function(_0x4c1a68){if(_0x4c1a68){_0x209423[_0x3291('0x43')]=_[_0x3291('0x40')](db[_0x3291('0x6f')]['rawAttributes']);_0x209423[_0x3291('0x3f')]=_[_0x3291('0x40')](_0x6bb166['query']);_0x209423[_0x3291('0x41')]=_[_0x3291('0x42')](_0x209423[_0x3291('0x43')],_0x209423[_0x3291('0x3f')]);_0x5b30c0[_0x3291('0x44')]=_[_0x3291('0x42')](_0x209423[_0x3291('0x43')],qs['fields'](_0x6bb166['query'][_0x3291('0x45')]));_0x5b30c0[_0x3291('0x44')]=_0x5b30c0['attributes'][_0x3291('0x46')]?_0x5b30c0[_0x3291('0x44')]:_0x209423[_0x3291('0x43')];if(!_0x6bb166['query'][_0x3291('0x66')]('nolimit')){_0x5b30c0[_0x3291('0x2f')]=qs[_0x3291('0x2f')](_0x6bb166['query'][_0x3291('0x2f')]);_0x5b30c0[_0x3291('0x2d')]=qs['offset'](_0x6bb166[_0x3291('0x3f')][_0x3291('0x2d')]);}_0x5b30c0[_0x3291('0x48')]=qs['sort'](_0x6bb166[_0x3291('0x3f')]['sort']);_0x5b30c0['where']=qs[_0x3291('0x41')](_['pick'](_0x6bb166['query'],_0x209423['filters']));_0x5b30c0['where'][_0x3291('0x62')]=_0x4c1a68['id'];if(_0x6bb166[_0x3291('0x3f')][_0x3291('0x4c')]){_0x5b30c0[_0x3291('0x4a')]=_[_0x3291('0x4d')](_0x5b30c0[_0x3291('0x4a')],{'$or':_['map'](_0x5b30c0[_0x3291('0x44')],function(_0x43eff6){var _0x58133={};_0x58133[_0x43eff6]={'$like':'%'+_0x6bb166['query'][_0x3291('0x4c')]+'%'};return _0x58133;})});}_0x5b30c0=_[_0x3291('0x4d')]({},_0x5b30c0,_0x6bb166[_0x3291('0x56')]);return db['FaxInteraction'][_0x3291('0x30')]({'where':_0x5b30c0[_0x3291('0x4a')]})[_0x3291('0x1e')](function(_0x371e00){_0x490d37['count']=_0x371e00;if(_0x6bb166['query']['includeAll']){_0x5b30c0[_0x3291('0x51')]=[{'model':db['CmContact'],'as':_0x3291('0x72'),'required':![]},{'model':db[_0x3291('0x73')],'as':_0x3291('0x74'),'attributes':[_0x3291('0x39'),_0x3291('0x75'),_0x3291('0x76')],'required':![]},{'model':db['Tag'],'as':_0x3291('0x77'),'attributes':['id',_0x3291('0x39'),'color'],'where':_0x6bb166[_0x3291('0x3f')][_0x3291('0x78')]?{'id':_0x6bb166['query'][_0x3291('0x78')]}:undefined,'required':_0x6bb166[_0x3291('0x3f')]['tag']?!![]:![]}];}return db[_0x3291('0x6f')][_0x3291('0x67')](_0x5b30c0);})[_0x3291('0x1e')](function(_0x1ae279){_0x490d37[_0x3291('0x53')]=_0x1ae279;return _0x490d37;});}})[_0x3291('0x1e')](respondWithFilteredResult(_0x28f299,_0x5b30c0))[_0x3291('0x28')](handleError(_0x28f299,null));};exports[_0x3291('0x79')]=function(_0x44e5a1,_0x4ba4a2){var _0x3d76a4=_0x44e5a1[_0x3291('0x55')]['id'];var _0x5da66b=_0x44e5a1[_0x3291('0x59')];var _0x587446=0xc8;var _0x57ee87=null;return db[_0x3291('0x7a')][_0x3291('0x7b')]({'isolationLevel':db[_0x3291('0x7a')]['Transaction'][_0x3291('0x7c')][_0x3291('0x7d')]},function(_0x16f94e){return db[_0x3291('0x52')][_0x3291('0x65')]({'where':{'id':_0x3d76a4},'transaction':_0x16f94e})[_0x3291('0x1e')](function(_0x3f38ee){if(_0x3f38ee){return db[_0x3291('0x7e')]['destroy']({'where':{'FaxAccountId':_0x3d76a4},'transaction':_0x16f94e})['then'](function(){var _0x5d83ff=_['map'](_0x5da66b,function(_0x172aaa){_0x172aaa[_0x3291('0x62')]=_0x3d76a4;return _0x172aaa;});return db['FaxApplication'][_0x3291('0x7f')](_0x5d83ff,{'transaction':_0x16f94e});});}else{_0x587446=0x194;_0x57ee87=[];}});})[_0x3291('0x1e')](function(){if(_0x587446!==0x194){return db[_0x3291('0x7e')][_0x3291('0x80')]({'where':{'FaxAccountId':_0x3d76a4},'order':_0x3291('0x81')})[_0x3291('0x1e')](function(_0x4a00a7){_0x57ee87=_0x4a00a7;});}})[_0x3291('0x28')](function(_0x171698){_0x587446=0x1f4;logger['error'](_0x171698[_0x3291('0x38')]);if(_0x171698[_0x3291('0x39')]){delete _0x171698[_0x3291('0x39')];}_0x57ee87=_0x171698;})['finally'](function(){if(_0x57ee87===null){_0x4ba4a2[_0x3291('0x29')](_0x587446);}else{if(_0x587446===0x1f4){_0x4ba4a2[_0x3291('0x2b')](_0x587446)[_0x3291('0x3a')](_0x57ee87);}else{_0x4ba4a2[_0x3291('0x2b')](_0x587446)[_0x3291('0x2c')](_0x57ee87);}}});};exports['getApplications']=function(_0x564a3b,_0x23a512,_0x2b5960){var _0x129158={};var _0x1a1dd4={};var _0x434f89;var _0x3ea8ac;return db[_0x3291('0x52')][_0x3291('0x65')]({'where':{'id':_0x564a3b['params']['id']}})['then'](handleEntityNotFound(_0x23a512,null))[_0x3291('0x1e')](function(_0x3e58d8){if(_0x3e58d8){_0x434f89=_0x3e58d8;_0x1a1dd4['model']=_['keys'](db[_0x3291('0x7e')][_0x3291('0x3c')]);_0x1a1dd4[_0x3291('0x3f')]=_[_0x3291('0x40')](_0x564a3b['query']);_0x1a1dd4[_0x3291('0x41')]=_[_0x3291('0x42')](_0x1a1dd4[_0x3291('0x43')],_0x1a1dd4['query']);_0x129158[_0x3291('0x44')]=_['intersection'](_0x1a1dd4[_0x3291('0x43')],qs[_0x3291('0x45')](_0x564a3b[_0x3291('0x3f')][_0x3291('0x45')]));_0x129158[_0x3291('0x44')]=_0x129158[_0x3291('0x44')][_0x3291('0x46')]?_0x129158['attributes']:_0x1a1dd4[_0x3291('0x43')];_0x129158[_0x3291('0x48')]=qs['sort'](_0x564a3b[_0x3291('0x3f')][_0x3291('0x49')]);_0x129158['where']=qs[_0x3291('0x41')](_['pick'](_0x564a3b[_0x3291('0x3f')],_0x1a1dd4['filters']));if(_0x564a3b[_0x3291('0x3f')][_0x3291('0x4c')]){_0x129158[_0x3291('0x4a')]=_[_0x3291('0x4d')](_0x129158['where'],{'$or':_[_0x3291('0x3e')](_0x129158[_0x3291('0x44')],function(_0x1161d2){var _0x718847={};_0x718847[_0x1161d2]={'$like':'%'+_0x564a3b[_0x3291('0x3f')][_0x3291('0x4c')]+'%'};return _0x718847;})});}_0x129158=_['merge']({},_0x129158,_0x564a3b[_0x3291('0x56')]);return _0x434f89[_0x3291('0x82')](_0x129158);}})[_0x3291('0x1e')](function(_0x39c309){if(_0x39c309){_0x3ea8ac=_0x39c309['length'];if(!_0x564a3b['query'][_0x3291('0x66')]('nolimit')){_0x129158[_0x3291('0x2f')]=qs['limit'](_0x564a3b[_0x3291('0x3f')]['limit']);_0x129158[_0x3291('0x2d')]=qs[_0x3291('0x2d')](_0x564a3b[_0x3291('0x3f')]['offset']);}return _0x434f89[_0x3291('0x82')](_0x129158);}})[_0x3291('0x1e')](function(_0x3d0d57){if(_0x3d0d57){return _0x3d0d57?{'count':_0x3ea8ac,'rows':_0x3d0d57}:null;}})[_0x3291('0x1e')](respondWithResult(_0x23a512,null))['catch'](handleError(_0x23a512,null));};function Extension(_0x265ed8,_0x8c7339,_0x584a0d,_0x47e2f4){this[_0x3291('0x83')]=_0x3291('0x84');this[_0x3291('0x85')]=_0x265ed8['localstationid'];this['app']=_0x47e2f4;this[_0x3291('0x4e')]=_0x3291('0x86');this['description']='Fax\x20Extension';this[_0x3291('0x62')]=_0x265ed8['id'];this['priority']=_0x8c7339;this[_0x3291('0x87')]=_0x584a0d;}function createExtensionsReciveFax(_0x73d28b){var _0x1b89c3=0x1;var _0x1f7e4f=[];_0x1f7e4f['push'](new Extension(_0x73d28b,_0x1b89c3,'',_0x3291('0x88')));_0x1b89c3+=0x1;_0x1f7e4f['push'](new Extension(_0x73d28b,_0x1b89c3,_0x3291('0x89'),_0x3291('0x8a')));_0x1b89c3+=0x1;for(var _0x3a841d in _0x73d28b){if(_0x73d28b[_0x3291('0x66')](_0x3a841d)&&(_0x3a841d===_0x3291('0x8b')||_0x3a841d===_0x3291('0x8c')||_0x3a841d===_0x3291('0x8d')||_0x3a841d===_0x3291('0x8e')||_0x3a841d===_0x3291('0x8f')||_0x3a841d===_0x3291('0x90')||_0x3a841d==='minrate'||_0x3a841d===_0x3291('0x91')||_0x3a841d===_0x3291('0x92'))){_0x1f7e4f[_0x3291('0x93')](new Extension(_0x73d28b,_0x1b89c3,_0x3291('0x94')+_0x3a841d+')='+_0x73d28b[_0x3a841d],_0x3291('0x8a')));_0x1b89c3+=0x1;}}_0x1f7e4f['push'](new Extension(_0x73d28b,_0x1b89c3,'6',_0x3291('0x95')));_0x1b89c3+=0x1;_0x1f7e4f[_0x3291('0x93')](new Extension(_0x73d28b,_0x1b89c3,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d',_0x3291('0x96')));_0x1b89c3=0x0;return _0x1f7e4f;}exports['addAccountApplications']=function(_0x135698,_0x2ef05c,_0x263324){var _0xa6782;return db[_0x3291('0x7a')]['transaction'](function(_0x1b949a){return db[_0x3291('0x52')][_0x3291('0x58')](_0x135698[_0x3291('0x59')],{'transaction':_0x1b949a})['then'](function(_0x310e1e){_0xa6782=_0x310e1e['get']({'plain':!![]});return db['VoiceExtension'][_0x3291('0x7f')](createExtensionsReciveFax(_0xa6782),{'transaction':_0x1b949a});});})[_0x3291('0x1e')](function(){return _0xa6782;})['then'](respondWithResult(_0x2ef05c,null))['catch'](handleError(_0x2ef05c,null));};exports[_0x3291('0x97')]=function(_0x35c980,_0x3ea1b4,_0x2e5391){var _0x203aa3;return db[_0x3291('0x7a')][_0x3291('0x7b')](function(_0x3e7cab){return db[_0x3291('0x52')][_0x3291('0x33')](_0x35c980['body'],{'where':{'id':_0x35c980['body']['id']},'transaction':_0x3e7cab})[_0x3291('0x1e')](function(_0x222844){return db[_0x3291('0x98')]['destroy']({'where':{'FaxAccountId':_0x35c980['body']['id']},'transaction':_0x3e7cab})['then'](function(_0x5e7362){return db[_0x3291('0x98')][_0x3291('0x7f')](createExtensionsReciveFax(_['omit'](_0x35c980[_0x3291('0x59')],[_0x3291('0x99'),'key',_0x3291('0x9a'),_0x3291('0x9b'),_0x3291('0x9c'),_0x3291('0x9d')])),{'transaction':_0x3e7cab});});});})[_0x3291('0x1e')](function(){return db[_0x3291('0x52')][_0x3291('0x9e')](_0x35c980['body']['id']);})[_0x3291('0x1e')](respondWithResult(_0x3ea1b4,null))[_0x3291('0x28')](handleError(_0x3ea1b4,null));};exports[_0x3291('0x9f')]=function(_0x1d7a85,_0x32a46e,_0x4ea9b8){var _0x1584ca={'raw':!![],'where':{}};var _0x40ad65={};var _0x5a0990={'count':0x0,'rows':[]};return db[_0x3291('0x52')]['findOne']({'where':{'id':_0x1d7a85[_0x3291('0x55')]['id']}})[_0x3291('0x1e')](handleEntityNotFound(_0x32a46e,null))[_0x3291('0x1e')](function(_0x47dd85){if(_0x47dd85){_0x40ad65[_0x3291('0x43')]=_[_0x3291('0x40')](db['FaxMessage'][_0x3291('0x3c')]);_0x40ad65[_0x3291('0x3f')]=_[_0x3291('0x40')](_0x1d7a85[_0x3291('0x3f')]);_0x40ad65[_0x3291('0x41')]=_['intersection'](_0x40ad65['model'],_0x40ad65[_0x3291('0x3f')]);_0x1584ca['attributes']=_[_0x3291('0x42')](_0x40ad65['model'],qs['fields'](_0x1d7a85[_0x3291('0x3f')][_0x3291('0x45')]));_0x1584ca['attributes']=_0x1584ca[_0x3291('0x44')][_0x3291('0x46')]?_0x1584ca[_0x3291('0x44')]:_0x40ad65[_0x3291('0x43')];if(!_0x1d7a85[_0x3291('0x3f')][_0x3291('0x66')]('nolimit')){_0x1584ca[_0x3291('0x2f')]=qs[_0x3291('0x2f')](_0x1d7a85[_0x3291('0x3f')]['limit']);_0x1584ca['offset']=qs[_0x3291('0x2d')](_0x1d7a85[_0x3291('0x3f')]['offset']);}_0x1584ca[_0x3291('0x48')]=qs[_0x3291('0x49')](_0x1d7a85['query']['sort']);_0x1584ca[_0x3291('0x4a')]=qs[_0x3291('0x41')](_['pick'](_0x1d7a85[_0x3291('0x3f')],_0x40ad65[_0x3291('0x41')]));_0x1584ca[_0x3291('0x4a')][_0x3291('0x62')]=_0x47dd85['id'];if(_0x1d7a85['query'][_0x3291('0x4c')]){_0x1584ca[_0x3291('0x4a')]=_[_0x3291('0x4d')](_0x1584ca['where'],{'$or':_[_0x3291('0x3e')](_0x1584ca[_0x3291('0x44')],function(_0x3da979){var _0x568f54={};_0x568f54[_0x3da979]={'$like':'%'+_0x1d7a85[_0x3291('0x3f')][_0x3291('0x4c')]+'%'};return _0x568f54;})});}if(_0x1d7a85[_0x3291('0x3f')][_0x3291('0xa0')]){var _0x5ab258=_0x1d7a85['query'][_0x3291('0xa0')][_0x3291('0xa1')](',');var _0x13f0de={};_0x13f0de[_0x5ab258[0x0]]={'$gte':moment(_0x5ab258[0x1])[_0x3291('0xa2')](_0x3291('0xa3'))};_0x1584ca[_0x3291('0x4a')]=_['merge'](_0x1584ca[_0x3291('0x4a')],_0x13f0de);}_0x1584ca=_[_0x3291('0x4d')]({},_0x1584ca,_0x1d7a85[_0x3291('0x56')]);return db[_0x3291('0xa4')][_0x3291('0x30')]({'where':_0x1584ca[_0x3291('0x4a')]})['then'](function(_0x437e38){_0x5a0990[_0x3291('0x30')]=_0x437e38;if(_0x1d7a85[_0x3291('0x3f')][_0x3291('0x50')]){_0x1584ca[_0x3291('0x51')]=[{'all':!![]}];}return db[_0x3291('0xa4')][_0x3291('0x67')](_0x1584ca);})[_0x3291('0x1e')](function(_0x2fb1c7){_0x5a0990[_0x3291('0x53')]=_0x2fb1c7;return _0x5a0990;});}})[_0x3291('0x1e')](respondWithFilteredResult(_0x32a46e,_0x1584ca))[_0x3291('0x28')](handleError(_0x32a46e,null));};exports['send']=function(_0x19fbe1,_0x2c8013,_0x2050ea){var _0x382886,_0x3a1d70={},_0x390275;if(_0x19fbe1[_0x3291('0x59')]['to']){_0x390275=_0x19fbe1['body']['to'][0x0];}return db[_0x3291('0x52')][_0x3291('0x57')]({'where':{'id':_0x19fbe1[_0x3291('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0x3291('0xa5'),'include':[{'model':db[_0x3291('0xa6')],'as':_0x3291('0xa7'),'where':{'fax':_0x390275},'limit':0x1,'order':[[_0x3291('0x9b'),_0x3291('0xa8')]]}]}]})[_0x3291('0x1e')](handleEntityNotFound(_0x2c8013,null))[_0x3291('0x1e')](function(_0x3c93cf){_0x382886=_0x3c93cf;if(_0x19fbe1[_0x3291('0x59')][_0x3291('0xa9')]&&_0x19fbe1['body'][_0x3291('0xa9')][_0x3291('0x46')]){for(var _0x33ae11=0x0;_0x33ae11<_0x19fbe1[_0x3291('0x59')]['attachments'][_0x3291('0x46')];_0x33ae11+=0x1){_0x19fbe1[_0x3291('0x59')][_0x3291('0xa9')][_0x33ae11]={'filename':_0x19fbe1[_0x3291('0x59')][_0x3291('0xa9')][_0x33ae11][_0x3291('0x39')],'id':_0x19fbe1[_0x3291('0x59')]['attachments'][_0x33ae11]['id'],'path':path[_0x3291('0xaa')](config[_0x3291('0xab')],_0x3291('0xac'),_0x19fbe1[_0x3291('0x59')][_0x3291('0xa9')][_0x33ae11][_0x3291('0xad')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_['isNil'](_0x19fbe1[_0x3291('0x55')]['id'])?undefined:_0x19fbe1[_0x3291('0x55')]['id'],'path':_[_0x3291('0xae')](_0x19fbe1[_0x3291('0x59')][_0x3291('0xa9')][0x0][_0x3291('0xaf')])?undefined:_0x19fbe1[_0x3291('0x59')][_0x3291('0xa9')][0x0]['path'],'fax':_['isNil'](_0x19fbe1['body']['to'][0x0])?undefined:_0x19fbe1[_0x3291('0x59')]['to'][0x0]},client9002);})['then'](function(){if(_0x382886){if(_[_0x3291('0xae')](_0x19fbe1[_0x3291('0x59')][_0x3291('0xb0')])){_0x19fbe1[_0x3291('0x59')][_0x3291('0xb0')]=util['format'](_0x3291('0xb1'),_0x382886[_0x3291('0x39')],_0x382886['fax']);}if(_0x382886[_0x3291('0xa5')]){if(_0x382886['List'][_0x3291('0xa7')][_0x3291('0x46')]){return _0x382886['List'][_0x3291('0xa7')][0x0];}else{return db[_0x3291('0xa6')][_0x3291('0x58')](_[_0x3291('0x15')](_0x19fbe1['body'],{'firstName':_0x19fbe1[_0x3291('0x59')]['to'][0x0],'phone':_0x19fbe1[_0x3291('0x59')]['to'][0x0],'fax':_0x19fbe1[_0x3291('0x59')]['to'][0x0],'ListId':_0x382886[_0x3291('0x9d')]}));}}else{throw new Error(_0x3291('0xb2'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x3291('0x1e')](function(_0x1aba8c){if(_0x1aba8c){return db[_0x3291('0x6f')][_0x3291('0x57')]({'where':{'ContactId':_0x1aba8c['id'],'closed':![],'FaxAccountId':_0x382886['id']}})[_0x3291('0x1e')](function(_0x5b123a){if(_0x5b123a){return[_0x5b123a,![]];}return db['FaxInteraction']['create']({'UserId':_0x19fbe1[_0x3291('0x5c')]['id'],'ContactId':_0x1aba8c['id'],'FaxAccountId':_0x382886['id'],'fax':_0x19fbe1['body']['to'][0x0],'firstMsgDirection':_0x3291('0xb3'),'Messages':[_[_0x3291('0x4d')](_0x19fbe1[_0x3291('0x59')],{'read':![],'body':_0x19fbe1[_0x3291('0x59')][_0x3291('0xa9')][0x0]['filename'],'FaxAccountId':_0x382886['id'],'UserId':_0x19fbe1['user']['id'],'ContactId':_0x1aba8c['id'],'AttachmentId':_0x19fbe1[_0x3291('0x59')][_0x3291('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0x3291('0xa4')],'as':_0x3291('0xb4')}]})[_0x3291('0x1e')](function(_0x381096){return[_0x381096,!![]];});});}else{throw new Error(_0x3291('0xb5'));}})[_0x3291('0xb6')](function(_0x5bfaa1,_0x10c821){if(_0x10c821){return _0x5bfaa1;}return db[_0x3291('0xa4')]['create']({'direction':_0x3291('0xb3'),'read':![],'body':_0x19fbe1[_0x3291('0x59')]['attachments'][0x0][_0x3291('0xb7')],'FaxAccountId':_0x382886['id'],'FaxInteractionId':_0x5bfaa1['id'],'UserId':_0x19fbe1[_0x3291('0x5c')]['id'],'ContactId':_0x5bfaa1[_0x3291('0xb8')],'AttachmentId':_0x19fbe1[_0x3291('0x59')][_0x3291('0xa9')][0x0]['id']})['then'](function(_0x4ee4f8){_0x5bfaa1[_0x3291('0xb9')][_0x3291('0xb4')]=[];_0x5bfaa1[_0x3291('0xb9')]['Messages'][_0x3291('0x93')](_0x4ee4f8[_0x3291('0xb9')]);return _0x5bfaa1;});})[_0x3291('0x1e')](function(_0x4b3f9f){respondWithRpcPromise(_0x3291('0xba'),_0x3291('0xba'),{'FaxAccountId':_[_0x3291('0xae')](_0x19fbe1[_0x3291('0x55')]['id'])?undefined:_0x19fbe1[_0x3291('0x55')]['id'],'path':_[_0x3291('0xae')](_0x19fbe1[_0x3291('0x59')][_0x3291('0xa9')][0x0][_0x3291('0xaf')])?undefined:_0x19fbe1[_0x3291('0x59')][_0x3291('0xa9')][0x0][_0x3291('0xaf')],'fax':_['isNil'](_0x19fbe1[_0x3291('0x59')]['to'][0x0])?undefined:_0x19fbe1[_0x3291('0x59')]['to'][0x0],'AttachmentId':_0x19fbe1['body'][_0x3291('0xa9')][0x0]['id']},client9002)[_0x3291('0x1e')](function(_0x305d72){logger[_0x3291('0x27')](_0x3291('0xbb'),_0x305d72);})['catch'](function(_0x248073){logger[_0x3291('0x27')]('SendFaxRpc,\x20%s',_0x248073);});return _0x4b3f9f;})['then'](respondWithResult(_0x2c8013,null))[_0x3291('0x28')](handleError(_0x2c8013,null));};exports['addAgents']=function(_0x1b087a,_0x153e66,_0x341a7a){return db[_0x3291('0x52')][_0x3291('0x57')]({'where':{'id':_0x1b087a[_0x3291('0x55')]['id']}})[_0x3291('0x1e')](handleEntityNotFound(_0x153e66,null))[_0x3291('0x1e')](function(_0x14389e){if(_0x14389e){return _0x14389e[_0x3291('0xbc')](_0x1b087a[_0x3291('0x59')][_0x3291('0x69')],_[_0x3291('0x70')](_0x1b087a[_0x3291('0x59')],[_0x3291('0x69'),'id'])||{})[_0x3291('0xb6')](function(_0x2261b4){for(var _0x3152f6=0x0;_0x3152f6<_0x1b087a[_0x3291('0x59')][_0x3291('0x69')][_0x3291('0x46')];_0x3152f6+=0x1){socket[_0x3291('0xbd')](_0x3291('0xbe'),{'UserId':Number(_0x1b087a[_0x3291('0x59')][_0x3291('0x69')][_0x3152f6]),'FaxAccountId':Number(_0x1b087a['params']['id'])});}return _0x2261b4;});}})[_0x3291('0x1e')](respondWithResult(_0x153e66,null))['catch'](handleError(_0x153e66,null));};exports['removeAgents']=function(_0x9ddc5b,_0x202931,_0x19973a){return db[_0x3291('0x52')][_0x3291('0x57')]({'where':{'id':_0x9ddc5b[_0x3291('0x55')]['id']}})[_0x3291('0x1e')](handleEntityNotFound(_0x202931,null))[_0x3291('0x1e')](function(_0x132620){if(_0x132620){return _0x132620[_0x3291('0xbf')](_0x9ddc5b[_0x3291('0x3f')][_0x3291('0x69')])[_0x3291('0x1e')](function(){if(_[_0x3291('0xc0')](_0x9ddc5b[_0x3291('0x3f')][_0x3291('0x69')])){for(var _0x2deb6e=0x0;_0x2deb6e<_0x9ddc5b['query'][_0x3291('0x69')][_0x3291('0x46')];_0x2deb6e+=0x1){socket['emit'](_0x3291('0xc1'),{'UserId':Number(_0x9ddc5b[_0x3291('0x3f')][_0x3291('0x69')][_0x2deb6e]),'FaxAccountId':Number(_0x9ddc5b[_0x3291('0x55')]['id'])});}}else{socket[_0x3291('0xbd')](_0x3291('0xc1'),{'UserId':Number(_0x9ddc5b['query']['ids']),'FaxAccountId':Number(_0x9ddc5b[_0x3291('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x202931,null))[_0x3291('0x28')](handleError(_0x202931,null));};exports[_0x3291('0xc2')]=function(_0x9861,_0x59194f,_0x7bf6a7){var _0x527ff0={};var _0x300741={};var _0x72b50e;var _0x3902ba;return db[_0x3291('0x52')][_0x3291('0x65')]({'where':{'id':_0x9861[_0x3291('0x55')]['id']}})[_0x3291('0x1e')](handleEntityNotFound(_0x59194f,null))[_0x3291('0x1e')](function(_0x5c1e74){if(_0x5c1e74){_0x72b50e=_0x5c1e74;_0x300741['model']=_[_0x3291('0x40')](db['User'][_0x3291('0x3c')]);_0x300741[_0x3291('0x3f')]=_[_0x3291('0x40')](_0x9861[_0x3291('0x3f')]);_0x300741[_0x3291('0x41')]=_['intersection'](_0x300741['model'],_0x300741[_0x3291('0x3f')]);_0x527ff0[_0x3291('0x44')]=_[_0x3291('0x42')](_0x300741[_0x3291('0x43')],qs[_0x3291('0x45')](_0x9861[_0x3291('0x3f')][_0x3291('0x45')]));_0x527ff0['attributes']=_0x527ff0[_0x3291('0x44')][_0x3291('0x46')]?_0x527ff0[_0x3291('0x44')]:_0x300741[_0x3291('0x43')];_0x527ff0[_0x3291('0x48')]=qs[_0x3291('0x49')](_0x9861['query'][_0x3291('0x49')]);_0x527ff0['where']=qs[_0x3291('0x41')](_[_0x3291('0x4b')](_0x9861[_0x3291('0x3f')],_0x300741['filters']));if(_0x9861[_0x3291('0x3f')][_0x3291('0x4c')]){_0x527ff0[_0x3291('0x4a')]=_[_0x3291('0x4d')](_0x527ff0['where'],{'$or':_[_0x3291('0x3e')](_0x527ff0[_0x3291('0x44')],function(_0x2290a4){var _0x2b0b43={};_0x2b0b43[_0x2290a4]={'$like':'%'+_0x9861[_0x3291('0x3f')][_0x3291('0x4c')]+'%'};return _0x2b0b43;})});}_0x527ff0=_[_0x3291('0x4d')]({},_0x527ff0,_0x9861[_0x3291('0x56')]);return _0x72b50e[_0x3291('0xc2')](_0x527ff0);}})['then'](function(_0x571309){if(_0x571309){_0x3902ba=_0x571309[_0x3291('0x46')];if(!_0x9861[_0x3291('0x3f')]['hasOwnProperty'](_0x3291('0x47'))){_0x527ff0['limit']=qs[_0x3291('0x2f')](_0x9861[_0x3291('0x3f')]['limit']);_0x527ff0[_0x3291('0x2d')]=qs[_0x3291('0x2d')](_0x9861[_0x3291('0x3f')][_0x3291('0x2d')]);}return _0x72b50e[_0x3291('0xc2')](_0x527ff0);}})[_0x3291('0x1e')](function(_0x44053c){if(_0x44053c){return _0x44053c?{'count':_0x3902ba,'rows':_0x44053c}:null;}})[_0x3291('0x1e')](respondWithResult(_0x59194f,null))[_0x3291('0x28')](handleError(_0x59194f,null));};
\ No newline at end of file
+var _0xc990=['Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','update','tech','createdAt','TrunkId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','List','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','Contacts','ListId','Send\x20Fax\x20failed','out','Messages','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','get','FaxAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','params','Disposition','getDispositions','nolimit','FaxAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','rows','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','getApplications','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','push','FAXOPT('];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xc990,0x1b9));var _0x0c99=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc990[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0x0c99('0x0'));var rimraf=require(_0x0c99('0x1'));var zipdir=require(_0x0c99('0x2'));var jsonpatch=require(_0x0c99('0x3'));var rp=require('request-promise');var moment=require(_0x0c99('0x4'));var BPromise=require(_0x0c99('0x5'));var Mustache=require(_0x0c99('0x6'));var util=require(_0x0c99('0x7'));var path=require(_0x0c99('0x8'));var sox=require('sox');var csv=require(_0x0c99('0x9'));var ejs=require(_0x0c99('0xa'));var fs=require('fs');var fs_extra=require(_0x0c99('0xb'));var _=require(_0x0c99('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0c99('0xd'));var deskjs=require(_0x0c99('0xe'));var toCsv=require(_0x0c99('0x9'));var querystring=require(_0x0c99('0xf'));var Papa=require(_0x0c99('0x10'));var Redis=require('ioredis');var authService=require(_0x0c99('0x11'));var qs=require(_0x0c99('0x12'));var as=require(_0x0c99('0x13'));var hardwareService=require(_0x0c99('0x14'));var logger=require('../../config/logger')(_0x0c99('0x15'));var utils=require(_0x0c99('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0c99('0x17'))['db'];config[_0x0c99('0x18')]=_[_0x0c99('0x19')](config['redis'],{'host':_0x0c99('0x1a'),'port':0x18eb});var socket=require(_0x0c99('0x1b'))(new Redis(config[_0x0c99('0x18')]));require('./faxAccount.socket')[_0x0c99('0x1c')](socket);var jayson=require(_0x0c99('0x1d'));var client=jayson[_0x0c99('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x0c99('0x1e')][_0x0c99('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5bb758,_0x317f46,_0x2b2b5a,_0x461b06){return new BPromise(function(_0xb7c682,_0x37fb09){var _0x5d8706=_0x461b06||client;return _0x5d8706[_0x0c99('0x20')](_0x5bb758,_0x2b2b5a)[_0x0c99('0x21')](function(_0x22f5b3){logger['info'](_0x0c99('0x22'),_0x317f46,'request\x20sent');logger[_0x0c99('0x23')](_0x0c99('0x24'),_0x317f46,_0x0c99('0x25'),JSON[_0x0c99('0x26')](_0x22f5b3));if(_0x22f5b3['error']){if(_0x22f5b3[_0x0c99('0x27')][_0x0c99('0x28')]===0x1f4){logger[_0x0c99('0x27')](_0x0c99('0x22'),_0x317f46,_0x22f5b3[_0x0c99('0x27')][_0x0c99('0x29')]);return _0x37fb09(_0x22f5b3[_0x0c99('0x27')][_0x0c99('0x29')]);}logger[_0x0c99('0x27')](_0x0c99('0x22'),_0x317f46,_0x22f5b3['error'][_0x0c99('0x29')]);return _0xb7c682(_0x22f5b3[_0x0c99('0x27')][_0x0c99('0x29')]);}else{logger[_0x0c99('0x2a')](_0x0c99('0x22'),_0x317f46,_0x0c99('0x25'));_0xb7c682(_0x22f5b3[_0x0c99('0x2b')]['message']);}})[_0x0c99('0x2c')](function(_0x106019){logger['error'](_0x0c99('0x22'),_0x317f46,_0x106019);_0x37fb09(_0x106019);});});}function respondWithStatusCode(_0x7795ff,_0x34bf43){_0x34bf43=_0x34bf43||0xcc;return function(_0x516c86){if(_0x516c86){return _0x7795ff[_0x0c99('0x2d')](_0x34bf43);}return _0x7795ff[_0x0c99('0x2e')](_0x34bf43)[_0x0c99('0x2f')]();};}function respondWithResult(_0x2a3364,_0x2a5b4f){_0x2a5b4f=_0x2a5b4f||0xc8;return function(_0x866d95){if(_0x866d95){return _0x2a3364[_0x0c99('0x2e')](_0x2a5b4f)[_0x0c99('0x30')](_0x866d95);}};}function respondWithFilteredResult(_0xc37815,_0xc2f9ab){return function(_0x269829){if(_0x269829){var _0x6c2493=typeof _0xc2f9ab['offset']===_0x0c99('0x31')&&typeof _0xc2f9ab[_0x0c99('0x32')]===_0x0c99('0x31');var _0x3fe24b=_0x269829['count'];var _0x2f671a=_0x6c2493?0x0:_0xc2f9ab['offset'];var _0x30f2b5=_0x6c2493?_0x269829[_0x0c99('0x33')]:_0xc2f9ab[_0x0c99('0x34')]+_0xc2f9ab[_0x0c99('0x32')];var _0x9a8a53;if(_0x30f2b5>=_0x3fe24b){_0x30f2b5=_0x3fe24b;_0x9a8a53=0xc8;}else{_0x9a8a53=0xce;}_0xc37815['status'](_0x9a8a53);return _0xc37815['set'](_0x0c99('0x35'),_0x2f671a+'-'+_0x30f2b5+'/'+_0x3fe24b)[_0x0c99('0x30')](_0x269829);}return null;};}function patchUpdates(_0x3e929a){return function(_0x353e4e){try{jsonpatch[_0x0c99('0x36')](_0x353e4e,_0x3e929a,!![]);}catch(_0x1b24ba){return BPromise[_0x0c99('0x37')](_0x1b24ba);}return _0x353e4e[_0x0c99('0x38')]();};}function saveUpdates(_0x5d3e69,_0xa0c74b){return function(_0x401505){if(_0x401505){return _0x401505['update'](_0x5d3e69)[_0x0c99('0x21')](function(_0x305e2f){return _0x305e2f;});}return null;};}function removeEntity(_0x354e0d,_0x2c85e7){return function(_0x156245){if(_0x156245){return _0x156245[_0x0c99('0x39')]()['then'](function(){var _0x35a0ef=_0x156245[_0x0c99('0x3a')]({'plain':!![]});var _0x298644=_0x0c99('0x3b');return db[_0x0c99('0x3c')][_0x0c99('0x39')]({'where':{'type':_0x298644,'resourceId':_0x35a0ef['id']}})[_0x0c99('0x21')](function(){return _0x156245;});})[_0x0c99('0x21')](function(){_0x354e0d['status'](0xcc)[_0x0c99('0x2f')]();});}};}function handleEntityNotFound(_0x5f4b68,_0xabae80){return function(_0x25be20){if(!_0x25be20){_0x5f4b68['sendStatus'](0x194);}return _0x25be20;};}function handleError(_0x43011e,_0x2be361){_0x2be361=_0x2be361||0x1f4;return function(_0x52914f){logger[_0x0c99('0x27')](_0x52914f['stack']);if(_0x52914f[_0x0c99('0x3d')]){delete _0x52914f[_0x0c99('0x3d')];}_0x43011e[_0x0c99('0x2e')](_0x2be361)[_0x0c99('0x3e')](_0x52914f);};}exports[_0x0c99('0x3f')]=function(_0x21a8e2,_0x2374a8){var _0x53a5bf={'include':[{'model':db[_0x0c99('0x40')],'as':_0x0c99('0x41')}]},_0x11fab8={},_0x34be53={'count':0x0,'rows':[]};var _0x24fe61=_[_0x0c99('0x42')](db[_0x0c99('0x43')][_0x0c99('0x44')],function(_0x46d9fd){return{'name':_0x46d9fd[_0x0c99('0x45')],'type':_0x46d9fd[_0x0c99('0x46')][_0x0c99('0x47')]};});_0x11fab8[_0x0c99('0x48')]=_[_0x0c99('0x42')](_0x24fe61,_0x0c99('0x3d'));_0x11fab8[_0x0c99('0x49')]=_[_0x0c99('0x4a')](_0x21a8e2[_0x0c99('0x49')]);_0x11fab8[_0x0c99('0x4b')]=_[_0x0c99('0x4c')](_0x11fab8[_0x0c99('0x48')],_0x11fab8[_0x0c99('0x49')]);_0x53a5bf[_0x0c99('0x4d')]=_[_0x0c99('0x4c')](_0x11fab8[_0x0c99('0x48')],qs['fields'](_0x21a8e2[_0x0c99('0x49')]['fields']));_0x53a5bf['attributes']=_0x53a5bf[_0x0c99('0x4d')][_0x0c99('0x4e')]?_0x53a5bf['attributes']:_0x11fab8[_0x0c99('0x48')];if(!_0x21a8e2[_0x0c99('0x49')][_0x0c99('0x4f')]('nolimit')){_0x53a5bf[_0x0c99('0x32')]=qs[_0x0c99('0x32')](_0x21a8e2[_0x0c99('0x49')]['limit']);_0x53a5bf[_0x0c99('0x34')]=qs['offset'](_0x21a8e2['query'][_0x0c99('0x34')]);}_0x53a5bf[_0x0c99('0x50')]=qs[_0x0c99('0x51')](_0x21a8e2[_0x0c99('0x49')][_0x0c99('0x51')]);_0x53a5bf[_0x0c99('0x52')]=qs[_0x0c99('0x4b')](_[_0x0c99('0x53')](_0x21a8e2[_0x0c99('0x49')],_0x11fab8['filters']),_0x24fe61);if(_0x21a8e2[_0x0c99('0x49')][_0x0c99('0x54')]){_0x53a5bf[_0x0c99('0x52')]=_[_0x0c99('0x55')](_0x53a5bf[_0x0c99('0x52')],{'$or':_[_0x0c99('0x42')](_0x24fe61,function(_0x423b96){if(_0x423b96[_0x0c99('0x46')]!=='VIRTUAL'){var _0x726e33={};_0x726e33[_0x423b96['name']]={'$like':'%'+_0x21a8e2[_0x0c99('0x49')][_0x0c99('0x54')]+'%'};return _0x726e33;}})});}_0x53a5bf=_[_0x0c99('0x55')]({},_0x53a5bf,_0x21a8e2[_0x0c99('0x56')]);var _0x3e7a3c={'where':_0x53a5bf[_0x0c99('0x52')]};return db['FaxAccount'][_0x0c99('0x33')](_0x3e7a3c)[_0x0c99('0x21')](function(_0x19c505){_0x34be53[_0x0c99('0x33')]=_0x19c505;if(_0x21a8e2[_0x0c99('0x49')][_0x0c99('0x57')]){_0x53a5bf[_0x0c99('0x58')]=[{'all':!![]}];}return db[_0x0c99('0x43')][_0x0c99('0x59')](_0x53a5bf);})['then'](function(_0x5d17ac){_0x34be53['rows']=_0x5d17ac;return _0x34be53;})[_0x0c99('0x21')](respondWithFilteredResult(_0x2374a8,_0x53a5bf))[_0x0c99('0x2c')](handleError(_0x2374a8,null));};exports[_0x0c99('0x5a')]=function(_0x19e7f4,_0x214cf6){var _0x54c13a={'raw':![],'where':{'id':_0x19e7f4['params']['id']},'include':[{'model':db[_0x0c99('0x40')],'as':_0x0c99('0x41')}]},_0x37bc12={};_0x37bc12[_0x0c99('0x48')]=_['keys'](db[_0x0c99('0x43')][_0x0c99('0x44')]);_0x37bc12[_0x0c99('0x49')]=_[_0x0c99('0x4a')](_0x19e7f4['query']);_0x37bc12[_0x0c99('0x4b')]=_[_0x0c99('0x4c')](_0x37bc12['model'],_0x37bc12[_0x0c99('0x49')]);_0x54c13a[_0x0c99('0x4d')]=_[_0x0c99('0x4c')](_0x37bc12[_0x0c99('0x48')],qs['fields'](_0x19e7f4[_0x0c99('0x49')][_0x0c99('0x5b')]));_0x54c13a[_0x0c99('0x4d')]=_0x54c13a['attributes'][_0x0c99('0x4e')]?_0x54c13a[_0x0c99('0x4d')]:_0x37bc12['model'];if(_0x19e7f4['query'][_0x0c99('0x57')]){_0x54c13a[_0x0c99('0x58')]=[{'all':!![]}];}_0x54c13a=_[_0x0c99('0x55')]({},_0x54c13a,_0x19e7f4[_0x0c99('0x56')]);return db[_0x0c99('0x43')][_0x0c99('0x5c')](_0x54c13a)[_0x0c99('0x21')](handleEntityNotFound(_0x214cf6,null))[_0x0c99('0x21')](respondWithResult(_0x214cf6,null))[_0x0c99('0x2c')](handleError(_0x214cf6,null));};exports['create']=function(_0x41ffb3,_0xed4e43){return db[_0x0c99('0x43')][_0x0c99('0x5d')](_0x41ffb3[_0x0c99('0x5e')],{})[_0x0c99('0x21')](function(_0x19f405){var _0x276add=_0x41ffb3[_0x0c99('0x5f')]['get']({'plain':!![]});if(!_0x276add)throw new Error(_0x0c99('0x60'));if(_0x276add[_0x0c99('0x61')]===_0x0c99('0x5f')){var _0x5e8f30=_0x19f405[_0x0c99('0x3a')]({'plain':!![]});var _0x5ce738=_0x0c99('0x3b');return db[_0x0c99('0x62')]['find']({'where':{'name':_0x5ce738,'userProfileId':_0x276add[_0x0c99('0x63')]},'raw':!![]})[_0x0c99('0x21')](function(_0x40adba){if(_0x40adba&&_0x40adba[_0x0c99('0x64')]===0x0){return db['UserProfileResource'][_0x0c99('0x5d')]({'name':_0x5e8f30[_0x0c99('0x3d')],'resourceId':_0x5e8f30['id'],'type':_0x40adba[_0x0c99('0x3d')],'sectionId':_0x40adba['id']},{})[_0x0c99('0x21')](function(){return _0x19f405;});}else{return _0x19f405;}})['catch'](function(_0x1ce0d0){logger['error'](_0x0c99('0x65'),_0x1ce0d0);throw _0x1ce0d0;});}return _0x19f405;})[_0x0c99('0x21')](respondWithResult(_0xed4e43,0xc9))[_0x0c99('0x2c')](handleError(_0xed4e43,null));};exports['update']=function(_0x45e0b2,_0x331fd8){if(_0x45e0b2['body']['id']){delete _0x45e0b2[_0x0c99('0x5e')]['id'];}return db[_0x0c99('0x43')][_0x0c99('0x5c')]({'where':{'id':_0x45e0b2['params']['id']},'include':[{'model':db[_0x0c99('0x40')],'as':_0x0c99('0x41')}]})['then'](handleEntityNotFound(_0x331fd8,null))[_0x0c99('0x21')](saveUpdates(_0x45e0b2[_0x0c99('0x5e')],null))[_0x0c99('0x21')](respondWithResult(_0x331fd8,null))[_0x0c99('0x2c')](handleError(_0x331fd8,null));};exports[_0x0c99('0x39')]=function(_0x1f51d2,_0x2ef368){return db[_0x0c99('0x43')][_0x0c99('0x5c')]({'where':{'id':_0x1f51d2['params']['id']}})[_0x0c99('0x21')](handleEntityNotFound(_0x2ef368,null))[_0x0c99('0x21')](removeEntity(_0x2ef368,null))['catch'](handleError(_0x2ef368,null));};exports[_0x0c99('0x66')]=function(_0x4c3a92,_0xc75808){return db[_0x0c99('0x43')][_0x0c99('0x66')]()[_0x0c99('0x21')](respondWithResult(_0xc75808,null))[_0x0c99('0x2c')](handleError(_0xc75808,null));};exports[_0x0c99('0x67')]=function(_0x3fbe85,_0x4c5d0a,_0xa35d65){if(_0x3fbe85['body']['id']){delete _0x3fbe85[_0x0c99('0x5e')]['id'];}return db[_0x0c99('0x43')][_0x0c99('0x5c')]({'where':{'id':_0x3fbe85[_0x0c99('0x68')]['id']}})[_0x0c99('0x21')](handleEntityNotFound(_0x4c5d0a,null))[_0x0c99('0x21')](function(_0x31a682){if(_0x31a682){_0x3fbe85[_0x0c99('0x5e')]['FaxAccountId']=_0x31a682['id'];return db[_0x0c99('0x69')][_0x0c99('0x5d')](_0x3fbe85['body']);}})['then'](respondWithResult(_0x4c5d0a,null))[_0x0c99('0x2c')](handleError(_0x4c5d0a,null));};exports[_0x0c99('0x6a')]=function(_0x57fb85,_0x4bdffb,_0x2e301e){var _0x400502={'raw':![],'where':{}};var _0x51e191={};var _0x1aba76={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x57fb85['params']['id']}})['then'](handleEntityNotFound(_0x4bdffb,null))['then'](function(_0x269c2a){if(_0x269c2a){_0x51e191[_0x0c99('0x48')]=_[_0x0c99('0x4a')](db[_0x0c99('0x69')]['rawAttributes']);_0x51e191['query']=_[_0x0c99('0x4a')](_0x57fb85[_0x0c99('0x49')]);_0x51e191[_0x0c99('0x4b')]=_[_0x0c99('0x4c')](_0x51e191[_0x0c99('0x48')],_0x51e191[_0x0c99('0x49')]);_0x400502['attributes']=_[_0x0c99('0x4c')](_0x51e191[_0x0c99('0x48')],qs[_0x0c99('0x5b')](_0x57fb85[_0x0c99('0x49')][_0x0c99('0x5b')]));_0x400502['attributes']=_0x400502[_0x0c99('0x4d')][_0x0c99('0x4e')]?_0x400502[_0x0c99('0x4d')]:_0x51e191[_0x0c99('0x48')];if(!_0x57fb85[_0x0c99('0x49')][_0x0c99('0x4f')](_0x0c99('0x6b'))){_0x400502[_0x0c99('0x32')]=qs[_0x0c99('0x32')](_0x57fb85['query'][_0x0c99('0x32')]);_0x400502[_0x0c99('0x34')]=qs['offset'](_0x57fb85[_0x0c99('0x49')][_0x0c99('0x34')]);}_0x400502[_0x0c99('0x50')]=qs['sort'](_0x57fb85[_0x0c99('0x49')][_0x0c99('0x51')]);_0x400502['where']=qs[_0x0c99('0x4b')](_[_0x0c99('0x53')](_0x57fb85[_0x0c99('0x49')],_0x51e191[_0x0c99('0x4b')]));_0x400502[_0x0c99('0x52')][_0x0c99('0x6c')]=_0x269c2a['id'];if(_0x57fb85[_0x0c99('0x49')][_0x0c99('0x54')]){_0x400502['where']=_[_0x0c99('0x55')](_0x400502['where'],{'$or':_[_0x0c99('0x42')](_0x400502[_0x0c99('0x4d')],function(_0x37868c){var _0x1355a5={};_0x1355a5[_0x37868c]={'$like':'%'+_0x57fb85[_0x0c99('0x49')][_0x0c99('0x54')]+'%'};return _0x1355a5;})});}_0x400502=_[_0x0c99('0x55')]({},_0x400502,_0x57fb85[_0x0c99('0x56')]);return db[_0x0c99('0x69')][_0x0c99('0x33')]({'where':_0x400502['where']})[_0x0c99('0x21')](function(_0x54b042){_0x1aba76[_0x0c99('0x33')]=_0x54b042;if(_0x57fb85[_0x0c99('0x49')][_0x0c99('0x57')]){_0x400502[_0x0c99('0x58')]=[{'all':!![]}];}return db[_0x0c99('0x69')]['findAll'](_0x400502);})['then'](function(_0x4f0478){_0x1aba76['rows']=_0x4f0478;return _0x1aba76;});}})[_0x0c99('0x21')](respondWithFilteredResult(_0x4bdffb,_0x400502))[_0x0c99('0x2c')](handleError(_0x4bdffb,null));};exports[_0x0c99('0x6d')]=function(_0x1b243d,_0x413a4c,_0x4ee090){return db[_0x0c99('0x43')]['find']({'where':{'id':_0x1b243d['params']['id']}})['then'](handleEntityNotFound(_0x413a4c,null))[_0x0c99('0x21')](function(_0x3271da){if(_0x3271da){return _0x3271da[_0x0c99('0x6d')](_0x1b243d[_0x0c99('0x49')][_0x0c99('0x6e')]);}})['then'](respondWithStatusCode(_0x413a4c,null))[_0x0c99('0x2c')](handleError(_0x413a4c,null));};exports[_0x0c99('0x6f')]=function(_0x1caa37,_0x25cbbd,_0x5b276a){if(_0x1caa37[_0x0c99('0x5e')]['id']){delete _0x1caa37[_0x0c99('0x5e')]['id'];}return db[_0x0c99('0x43')]['find']({'where':{'id':_0x1caa37['params']['id']}})[_0x0c99('0x21')](handleEntityNotFound(_0x25cbbd,null))[_0x0c99('0x21')](function(_0x3dc3f8){if(_0x3dc3f8){_0x1caa37[_0x0c99('0x5e')][_0x0c99('0x6c')]=_0x3dc3f8['id'];return db[_0x0c99('0x70')][_0x0c99('0x5d')](_0x1caa37['body']);}})['then'](respondWithResult(_0x25cbbd,null))[_0x0c99('0x2c')](handleError(_0x25cbbd,null));};exports[_0x0c99('0x71')]=function(_0x5befb5,_0x82ce2,_0x4361d5){var _0x44a883={'raw':![],'where':{}};var _0x2df6cf={};var _0x4bd230={'count':0x0,'rows':[]};return db[_0x0c99('0x43')][_0x0c99('0x72')]({'where':{'id':_0x5befb5[_0x0c99('0x68')]['id']}})[_0x0c99('0x21')](handleEntityNotFound(_0x82ce2,null))[_0x0c99('0x21')](function(_0x3f1bd0){if(_0x3f1bd0){_0x2df6cf['model']=_[_0x0c99('0x4a')](db[_0x0c99('0x70')][_0x0c99('0x44')]);_0x2df6cf[_0x0c99('0x49')]=_[_0x0c99('0x4a')](_0x5befb5[_0x0c99('0x49')]);_0x2df6cf[_0x0c99('0x4b')]=_['intersection'](_0x2df6cf['model'],_0x2df6cf[_0x0c99('0x49')]);_0x44a883[_0x0c99('0x4d')]=_[_0x0c99('0x4c')](_0x2df6cf['model'],qs['fields'](_0x5befb5[_0x0c99('0x49')][_0x0c99('0x5b')]));_0x44a883[_0x0c99('0x4d')]=_0x44a883[_0x0c99('0x4d')][_0x0c99('0x4e')]?_0x44a883[_0x0c99('0x4d')]:_0x2df6cf[_0x0c99('0x48')];if(!_0x5befb5[_0x0c99('0x49')][_0x0c99('0x4f')](_0x0c99('0x6b'))){_0x44a883['limit']=qs[_0x0c99('0x32')](_0x5befb5[_0x0c99('0x49')]['limit']);_0x44a883[_0x0c99('0x34')]=qs['offset'](_0x5befb5[_0x0c99('0x49')]['offset']);}_0x44a883[_0x0c99('0x50')]=qs[_0x0c99('0x51')](_0x5befb5[_0x0c99('0x49')][_0x0c99('0x51')]);_0x44a883['where']=qs[_0x0c99('0x4b')](_['pick'](_0x5befb5[_0x0c99('0x49')],_0x2df6cf[_0x0c99('0x4b')]));_0x44a883[_0x0c99('0x52')]['FaxAccountId']=_0x3f1bd0['id'];if(_0x5befb5[_0x0c99('0x49')]['filter']){_0x44a883[_0x0c99('0x52')]=_[_0x0c99('0x55')](_0x44a883[_0x0c99('0x52')],{'$or':_[_0x0c99('0x42')](_0x44a883[_0x0c99('0x4d')],function(_0x4d2a00){var _0x25d4a3={};_0x25d4a3[_0x4d2a00]={'$like':'%'+_0x5befb5[_0x0c99('0x49')][_0x0c99('0x54')]+'%'};return _0x25d4a3;})});}_0x44a883=_[_0x0c99('0x55')]({},_0x44a883,_0x5befb5['options']);return db[_0x0c99('0x70')][_0x0c99('0x33')]({'where':_0x44a883[_0x0c99('0x52')]})['then'](function(_0xd2cb9d){_0x4bd230[_0x0c99('0x33')]=_0xd2cb9d;if(_0x5befb5['query']['includeAll']){_0x44a883[_0x0c99('0x58')]=[{'all':!![]}];}return db[_0x0c99('0x70')][_0x0c99('0x59')](_0x44a883);})[_0x0c99('0x21')](function(_0x12b9f8){_0x4bd230['rows']=_0x12b9f8;return _0x4bd230;});}})[_0x0c99('0x21')](respondWithFilteredResult(_0x82ce2,_0x44a883))['catch'](handleError(_0x82ce2,null));};exports[_0x0c99('0x73')]=function(_0x4f92fc,_0x3dfa93,_0x53bc01){return db[_0x0c99('0x43')][_0x0c99('0x5c')]({'where':{'id':_0x4f92fc['params']['id']}})['then'](handleEntityNotFound(_0x3dfa93,null))[_0x0c99('0x21')](function(_0x31069c){if(_0x31069c){return _0x31069c[_0x0c99('0x73')](_0x4f92fc[_0x0c99('0x49')]['ids']);}})[_0x0c99('0x21')](respondWithStatusCode(_0x3dfa93,null))[_0x0c99('0x2c')](handleError(_0x3dfa93,null));};exports[_0x0c99('0x74')]=function(_0x284894,_0x1b23e0,_0x11a23b){return db[_0x0c99('0x75')][_0x0c99('0x5c')]({'where':{'id':_0x284894[_0x0c99('0x68')]['id']}})['then'](handleEntityNotFound(_0x1b23e0,null))['then'](function(_0x5ec52c){if(_0x5ec52c){return _0x5ec52c[_0x0c99('0x74')](_0x284894[_0x0c99('0x5e')]['ids'],_[_0x0c99('0x76')](_0x284894[_0x0c99('0x5e')],['ids','id'])||{});}})[_0x0c99('0x21')](respondWithResult(_0x1b23e0,null))[_0x0c99('0x2c')](handleError(_0x1b23e0,null));};exports[_0x0c99('0x77')]=function(_0x48f59f,_0x2c959d,_0x2933f3){var _0x1b720e={'raw':![],'where':{}};var _0x5eacd9={};var _0x302ffb={'count':0x0,'rows':[]};return db[_0x0c99('0x43')][_0x0c99('0x72')]({'where':{'id':_0x48f59f[_0x0c99('0x68')]['id']}})[_0x0c99('0x21')](handleEntityNotFound(_0x2c959d,null))['then'](function(_0x2a3e38){if(_0x2a3e38){_0x5eacd9[_0x0c99('0x48')]=_['keys'](db['FaxInteraction'][_0x0c99('0x44')]);_0x5eacd9['query']=_[_0x0c99('0x4a')](_0x48f59f[_0x0c99('0x49')]);_0x5eacd9[_0x0c99('0x4b')]=_[_0x0c99('0x4c')](_0x5eacd9['model'],_0x5eacd9[_0x0c99('0x49')]);_0x1b720e['attributes']=_[_0x0c99('0x4c')](_0x5eacd9[_0x0c99('0x48')],qs[_0x0c99('0x5b')](_0x48f59f[_0x0c99('0x49')]['fields']));_0x1b720e[_0x0c99('0x4d')]=_0x1b720e['attributes'][_0x0c99('0x4e')]?_0x1b720e[_0x0c99('0x4d')]:_0x5eacd9[_0x0c99('0x48')];if(!_0x48f59f[_0x0c99('0x49')]['hasOwnProperty']('nolimit')){_0x1b720e[_0x0c99('0x32')]=qs[_0x0c99('0x32')](_0x48f59f[_0x0c99('0x49')]['limit']);_0x1b720e[_0x0c99('0x34')]=qs['offset'](_0x48f59f['query'][_0x0c99('0x34')]);}_0x1b720e[_0x0c99('0x50')]=qs[_0x0c99('0x51')](_0x48f59f[_0x0c99('0x49')]['sort']);_0x1b720e['where']=qs[_0x0c99('0x4b')](_[_0x0c99('0x53')](_0x48f59f[_0x0c99('0x49')],_0x5eacd9[_0x0c99('0x4b')]));_0x1b720e[_0x0c99('0x52')][_0x0c99('0x6c')]=_0x2a3e38['id'];if(_0x48f59f['query'][_0x0c99('0x54')]){_0x1b720e['where']=_['merge'](_0x1b720e[_0x0c99('0x52')],{'$or':_[_0x0c99('0x42')](_0x1b720e[_0x0c99('0x4d')],function(_0x3f874f){var _0x286b13={};_0x286b13[_0x3f874f]={'$like':'%'+_0x48f59f[_0x0c99('0x49')][_0x0c99('0x54')]+'%'};return _0x286b13;})});}_0x1b720e=_[_0x0c99('0x55')]({},_0x1b720e,_0x48f59f['options']);return db[_0x0c99('0x75')][_0x0c99('0x33')]({'where':_0x1b720e[_0x0c99('0x52')]})['then'](function(_0x1ae9d7){_0x302ffb[_0x0c99('0x33')]=_0x1ae9d7;if(_0x48f59f[_0x0c99('0x49')]['includeAll']){_0x1b720e['include']=[{'model':db[_0x0c99('0x78')],'as':_0x0c99('0x79'),'required':![]},{'model':db[_0x0c99('0x7a')],'as':_0x0c99('0x7b'),'attributes':[_0x0c99('0x3d'),_0x0c99('0x7c'),_0x0c99('0x7d')],'required':![]},{'model':db[_0x0c99('0x7e')],'as':_0x0c99('0x7f'),'attributes':['id','name','color'],'where':_0x48f59f[_0x0c99('0x49')][_0x0c99('0x80')]?{'id':_0x48f59f['query'][_0x0c99('0x80')]}:undefined,'required':_0x48f59f[_0x0c99('0x49')]['tag']?!![]:![]}];}return db[_0x0c99('0x75')][_0x0c99('0x59')](_0x1b720e);})[_0x0c99('0x21')](function(_0x41c8f6){_0x302ffb[_0x0c99('0x81')]=_0x41c8f6;return _0x302ffb;});}})['then'](respondWithFilteredResult(_0x2c959d,_0x1b720e))[_0x0c99('0x2c')](handleError(_0x2c959d,null));};exports['addApplications']=function(_0x884794,_0x228273){var _0x23f64d=_0x884794[_0x0c99('0x68')]['id'];var _0x36d52b=_0x884794['body'];var _0x46b952=0xc8;var _0xc926e5=null;return db['sequelize'][_0x0c99('0x82')]({'isolationLevel':db[_0x0c99('0x83')][_0x0c99('0x84')][_0x0c99('0x85')][_0x0c99('0x86')]},function(_0x22bd76){return db[_0x0c99('0x43')]['findOne']({'where':{'id':_0x23f64d},'transaction':_0x22bd76})['then'](function(_0x506c0c){if(_0x506c0c){return db['FaxApplication'][_0x0c99('0x39')]({'where':{'FaxAccountId':_0x23f64d},'transaction':_0x22bd76})['then'](function(){var _0x29b717=_['map'](_0x36d52b,function(_0x15e151){_0x15e151['FaxAccountId']=_0x23f64d;return _0x15e151;});return db[_0x0c99('0x87')][_0x0c99('0x88')](_0x29b717,{'transaction':_0x22bd76});});}else{_0x46b952=0x194;_0xc926e5=[];}});})[_0x0c99('0x21')](function(){if(_0x46b952!==0x194){return db[_0x0c99('0x87')][_0x0c99('0x89')]({'where':{'FaxAccountId':_0x23f64d},'order':_0x0c99('0x8a')})[_0x0c99('0x21')](function(_0x2b2018){_0xc926e5=_0x2b2018;});}})[_0x0c99('0x2c')](function(_0x20092f){_0x46b952=0x1f4;logger[_0x0c99('0x27')](_0x20092f[_0x0c99('0x8b')]);if(_0x20092f[_0x0c99('0x3d')]){delete _0x20092f[_0x0c99('0x3d')];}_0xc926e5=_0x20092f;})['finally'](function(){if(_0xc926e5===null){_0x228273[_0x0c99('0x2d')](_0x46b952);}else{if(_0x46b952===0x1f4){_0x228273[_0x0c99('0x2e')](_0x46b952)[_0x0c99('0x3e')](_0xc926e5);}else{_0x228273[_0x0c99('0x2e')](_0x46b952)[_0x0c99('0x30')](_0xc926e5);}}});};exports[_0x0c99('0x8c')]=function(_0x50ad2b,_0x14b9fd,_0x345cce){var _0x13a95e={};var _0x58df2f={};var _0x1344d7;var _0x3ea371;return db[_0x0c99('0x43')][_0x0c99('0x72')]({'where':{'id':_0x50ad2b[_0x0c99('0x68')]['id']}})['then'](handleEntityNotFound(_0x14b9fd,null))[_0x0c99('0x21')](function(_0x5b66ed){if(_0x5b66ed){_0x1344d7=_0x5b66ed;_0x58df2f[_0x0c99('0x48')]=_['keys'](db[_0x0c99('0x87')][_0x0c99('0x44')]);_0x58df2f[_0x0c99('0x49')]=_['keys'](_0x50ad2b[_0x0c99('0x49')]);_0x58df2f['filters']=_['intersection'](_0x58df2f['model'],_0x58df2f[_0x0c99('0x49')]);_0x13a95e['attributes']=_[_0x0c99('0x4c')](_0x58df2f[_0x0c99('0x48')],qs[_0x0c99('0x5b')](_0x50ad2b['query'][_0x0c99('0x5b')]));_0x13a95e[_0x0c99('0x4d')]=_0x13a95e[_0x0c99('0x4d')]['length']?_0x13a95e[_0x0c99('0x4d')]:_0x58df2f[_0x0c99('0x48')];_0x13a95e['order']=qs[_0x0c99('0x51')](_0x50ad2b[_0x0c99('0x49')]['sort']);_0x13a95e[_0x0c99('0x52')]=qs[_0x0c99('0x4b')](_[_0x0c99('0x53')](_0x50ad2b['query'],_0x58df2f['filters']));if(_0x50ad2b[_0x0c99('0x49')]['filter']){_0x13a95e['where']=_[_0x0c99('0x55')](_0x13a95e[_0x0c99('0x52')],{'$or':_[_0x0c99('0x42')](_0x13a95e['attributes'],function(_0x1bc9a2){var _0x4c0945={};_0x4c0945[_0x1bc9a2]={'$like':'%'+_0x50ad2b['query'][_0x0c99('0x54')]+'%'};return _0x4c0945;})});}_0x13a95e=_[_0x0c99('0x55')]({},_0x13a95e,_0x50ad2b[_0x0c99('0x56')]);return _0x1344d7[_0x0c99('0x8c')](_0x13a95e);}})[_0x0c99('0x21')](function(_0xd53cb2){if(_0xd53cb2){_0x3ea371=_0xd53cb2[_0x0c99('0x4e')];if(!_0x50ad2b['query'][_0x0c99('0x4f')](_0x0c99('0x6b'))){_0x13a95e[_0x0c99('0x32')]=qs[_0x0c99('0x32')](_0x50ad2b[_0x0c99('0x49')][_0x0c99('0x32')]);_0x13a95e['offset']=qs[_0x0c99('0x34')](_0x50ad2b[_0x0c99('0x49')][_0x0c99('0x34')]);}return _0x1344d7[_0x0c99('0x8c')](_0x13a95e);}})[_0x0c99('0x21')](function(_0x30c88a){if(_0x30c88a){return _0x30c88a?{'count':_0x3ea371,'rows':_0x30c88a}:null;}})['then'](respondWithResult(_0x14b9fd,null))[_0x0c99('0x2c')](handleError(_0x14b9fd,null));};function Extension(_0x1f1758,_0x5809c3,_0x78d747,_0x1ade66){this['context']=_0x0c99('0x8d');this[_0x0c99('0x8e')]=_0x1f1758['localstationid'];this[_0x0c99('0x8f')]=_0x1ade66;this[_0x0c99('0x46')]=_0x0c99('0x90');this[_0x0c99('0x91')]=_0x0c99('0x92');this[_0x0c99('0x6c')]=_0x1f1758['id'];this[_0x0c99('0x8a')]=_0x5809c3;this[_0x0c99('0x93')]=_0x78d747;}function createExtensionsReciveFax(_0x137b96){var _0xbaa896=0x1;var _0x251a77=[];_0x251a77['push'](new Extension(_0x137b96,_0xbaa896,'',_0x0c99('0x94')));_0xbaa896+=0x1;_0x251a77['push'](new Extension(_0x137b96,_0xbaa896,_0x0c99('0x95'),_0x0c99('0x96')));_0xbaa896+=0x1;for(var _0x268c00 in _0x137b96){if(_0x137b96[_0x0c99('0x4f')](_0x268c00)&&(_0x268c00===_0x0c99('0x97')||_0x268c00===_0x0c99('0x98')||_0x268c00===_0x0c99('0x99')||_0x268c00===_0x0c99('0x9a')||_0x268c00===_0x0c99('0x9b')||_0x268c00===_0x0c99('0x9c')||_0x268c00===_0x0c99('0x9d')||_0x268c00===_0x0c99('0x9e')||_0x268c00===_0x0c99('0x9f'))){_0x251a77[_0x0c99('0xa0')](new Extension(_0x137b96,_0xbaa896,_0x0c99('0xa1')+_0x268c00+')='+_0x137b96[_0x268c00],_0x0c99('0x96')));_0xbaa896+=0x1;}}_0x251a77[_0x0c99('0xa0')](new Extension(_0x137b96,_0xbaa896,'6',_0x0c99('0xa2')));_0xbaa896+=0x1;_0x251a77[_0x0c99('0xa0')](new Extension(_0x137b96,_0xbaa896,_0x0c99('0xa3'),_0x0c99('0xa4')));_0xbaa896=0x0;return _0x251a77;}exports['addAccountApplications']=function(_0x2bae65,_0x2ea9f4,_0x21d1dd){var _0x339f6f;return db[_0x0c99('0x83')][_0x0c99('0x82')](function(_0x55a038){return db[_0x0c99('0x43')][_0x0c99('0x5d')](_0x2bae65[_0x0c99('0x5e')],{'transaction':_0x55a038})[_0x0c99('0x21')](function(_0x492f70){_0x339f6f=_0x492f70[_0x0c99('0x3a')]({'plain':!![]});return db[_0x0c99('0xa5')][_0x0c99('0x88')](createExtensionsReciveFax(_0x339f6f),{'transaction':_0x55a038});});})[_0x0c99('0x21')](function(){return _0x339f6f;})[_0x0c99('0x21')](respondWithResult(_0x2ea9f4,null))[_0x0c99('0x2c')](handleError(_0x2ea9f4,null));};exports[_0x0c99('0xa6')]=function(_0x109090,_0x88f727,_0x27b7bc){var _0x556ba4;return db[_0x0c99('0x83')]['transaction'](function(_0x407ada){return db[_0x0c99('0x43')][_0x0c99('0xa7')](_0x109090[_0x0c99('0x5e')],{'where':{'id':_0x109090[_0x0c99('0x5e')]['id']},'transaction':_0x407ada})[_0x0c99('0x21')](function(_0x57cbc2){return db[_0x0c99('0xa5')][_0x0c99('0x39')]({'where':{'FaxAccountId':_0x109090[_0x0c99('0x5e')]['id']},'transaction':_0x407ada})['then'](function(_0x2afe48){return db[_0x0c99('0xa5')][_0x0c99('0x88')](createExtensionsReciveFax(_['omit'](_0x109090['body'],[_0x0c99('0xa8'),'key',_0x0c99('0xa9'),'updatedAt',_0x0c99('0xaa'),'ListId'])),{'transaction':_0x407ada});});});})[_0x0c99('0x21')](function(){return db[_0x0c99('0x43')]['findById'](_0x109090['body']['id']);})['then'](respondWithResult(_0x88f727,null))[_0x0c99('0x2c')](handleError(_0x88f727,null));};exports['getMessages']=function(_0x3831dd,_0x2460e7,_0x4d8642){var _0x57792f={'raw':!![],'where':{}};var _0x21756e={};var _0x216234={'count':0x0,'rows':[]};return db['FaxAccount'][_0x0c99('0x72')]({'where':{'id':_0x3831dd['params']['id']}})[_0x0c99('0x21')](handleEntityNotFound(_0x2460e7,null))[_0x0c99('0x21')](function(_0x181c65){if(_0x181c65){_0x21756e['model']=_[_0x0c99('0x4a')](db['FaxMessage'][_0x0c99('0x44')]);_0x21756e[_0x0c99('0x49')]=_[_0x0c99('0x4a')](_0x3831dd[_0x0c99('0x49')]);_0x21756e[_0x0c99('0x4b')]=_[_0x0c99('0x4c')](_0x21756e[_0x0c99('0x48')],_0x21756e['query']);_0x57792f['attributes']=_[_0x0c99('0x4c')](_0x21756e[_0x0c99('0x48')],qs[_0x0c99('0x5b')](_0x3831dd['query'][_0x0c99('0x5b')]));_0x57792f[_0x0c99('0x4d')]=_0x57792f[_0x0c99('0x4d')][_0x0c99('0x4e')]?_0x57792f['attributes']:_0x21756e[_0x0c99('0x48')];if(!_0x3831dd[_0x0c99('0x49')][_0x0c99('0x4f')](_0x0c99('0x6b'))){_0x57792f[_0x0c99('0x32')]=qs[_0x0c99('0x32')](_0x3831dd[_0x0c99('0x49')][_0x0c99('0x32')]);_0x57792f[_0x0c99('0x34')]=qs[_0x0c99('0x34')](_0x3831dd['query']['offset']);}_0x57792f['order']=qs[_0x0c99('0x51')](_0x3831dd[_0x0c99('0x49')][_0x0c99('0x51')]);_0x57792f[_0x0c99('0x52')]=qs[_0x0c99('0x4b')](_[_0x0c99('0x53')](_0x3831dd['query'],_0x21756e[_0x0c99('0x4b')]));_0x57792f[_0x0c99('0x52')]['FaxAccountId']=_0x181c65['id'];if(_0x3831dd[_0x0c99('0x49')]['filter']){_0x57792f[_0x0c99('0x52')]=_[_0x0c99('0x55')](_0x57792f[_0x0c99('0x52')],{'$or':_[_0x0c99('0x42')](_0x57792f[_0x0c99('0x4d')],function(_0x525bbc){var _0x1906ff={};_0x1906ff[_0x525bbc]={'$like':'%'+_0x3831dd['query'][_0x0c99('0x54')]+'%'};return _0x1906ff;})});}if(_0x3831dd[_0x0c99('0x49')][_0x0c99('0xab')]){var _0x24b455=_0x3831dd['query'][_0x0c99('0xab')][_0x0c99('0xac')](',');var _0x245327={};_0x245327[_0x24b455[0x0]]={'$gte':moment(_0x24b455[0x1])[_0x0c99('0xad')](_0x0c99('0xae'))};_0x57792f[_0x0c99('0x52')]=_[_0x0c99('0x55')](_0x57792f[_0x0c99('0x52')],_0x245327);}_0x57792f=_['merge']({},_0x57792f,_0x3831dd[_0x0c99('0x56')]);return db[_0x0c99('0xaf')][_0x0c99('0x33')]({'where':_0x57792f[_0x0c99('0x52')]})['then'](function(_0x3553cf){_0x216234[_0x0c99('0x33')]=_0x3553cf;if(_0x3831dd['query']['includeAll']){_0x57792f[_0x0c99('0x58')]=[{'all':!![]}];}return db[_0x0c99('0xaf')][_0x0c99('0x59')](_0x57792f);})[_0x0c99('0x21')](function(_0x198f98){_0x216234[_0x0c99('0x81')]=_0x198f98;return _0x216234;});}})[_0x0c99('0x21')](respondWithFilteredResult(_0x2460e7,_0x57792f))[_0x0c99('0x2c')](handleError(_0x2460e7,null));};exports['send']=function(_0x5a0d40,_0x33b03d,_0x1db033){var _0x2db9b5,_0x20d8c4={},_0x51b7f4;if(_0x5a0d40[_0x0c99('0x5e')]['to']){_0x51b7f4=_0x5a0d40[_0x0c99('0x5e')]['to'][0x0];}return db[_0x0c99('0x43')][_0x0c99('0x5c')]({'where':{'id':_0x5a0d40[_0x0c99('0x68')]['id']},'include':[{'model':db['CmList'],'as':_0x0c99('0xb0'),'include':[{'model':db[_0x0c99('0x78')],'as':'Contacts','where':{'fax':_0x51b7f4},'limit':0x1,'order':[['updatedAt',_0x0c99('0xb1')]]}]}]})[_0x0c99('0x21')](handleEntityNotFound(_0x33b03d,null))[_0x0c99('0x21')](function(_0x90e36a){_0x2db9b5=_0x90e36a;if(_0x5a0d40[_0x0c99('0x5e')][_0x0c99('0xb2')]&&_0x5a0d40[_0x0c99('0x5e')][_0x0c99('0xb2')][_0x0c99('0x4e')]){for(var _0x146b5f=0x0;_0x146b5f<_0x5a0d40[_0x0c99('0x5e')][_0x0c99('0xb2')][_0x0c99('0x4e')];_0x146b5f+=0x1){_0x5a0d40[_0x0c99('0x5e')][_0x0c99('0xb2')][_0x146b5f]={'filename':_0x5a0d40[_0x0c99('0x5e')][_0x0c99('0xb2')][_0x146b5f][_0x0c99('0x3d')],'id':_0x5a0d40[_0x0c99('0x5e')][_0x0c99('0xb2')][_0x146b5f]['id'],'path':path[_0x0c99('0xb3')](config['root'],_0x0c99('0xb4'),_0x5a0d40[_0x0c99('0x5e')]['attachments'][_0x146b5f][_0x0c99('0xb5')])};}}return respondWithRpcPromise(_0x0c99('0xb6'),_0x0c99('0xb6'),{'FaxAccountId':_['isNil'](_0x5a0d40[_0x0c99('0x68')]['id'])?undefined:_0x5a0d40[_0x0c99('0x68')]['id'],'path':_[_0x0c99('0xb7')](_0x5a0d40['body'][_0x0c99('0xb2')][0x0][_0x0c99('0x8')])?undefined:_0x5a0d40[_0x0c99('0x5e')][_0x0c99('0xb2')][0x0][_0x0c99('0x8')],'fax':_[_0x0c99('0xb7')](_0x5a0d40['body']['to'][0x0])?undefined:_0x5a0d40['body']['to'][0x0]},client9002);})['then'](function(){if(_0x2db9b5){if(_[_0x0c99('0xb7')](_0x5a0d40[_0x0c99('0x5e')][_0x0c99('0xb8')])){_0x5a0d40[_0x0c99('0x5e')]['from']=util[_0x0c99('0xad')]('\x22%s\x22\x20<%s>',_0x2db9b5[_0x0c99('0x3d')],_0x2db9b5[_0x0c99('0xb9')]);}if(_0x2db9b5[_0x0c99('0xb0')]){if(_0x2db9b5[_0x0c99('0xb0')][_0x0c99('0xba')]['length']){return _0x2db9b5['List'][_0x0c99('0xba')][0x0];}else{return db['CmContact'][_0x0c99('0x5d')](_[_0x0c99('0x19')](_0x5a0d40[_0x0c99('0x5e')],{'firstName':_0x5a0d40[_0x0c99('0x5e')]['to'][0x0],'phone':_0x5a0d40['body']['to'][0x0],'fax':_0x5a0d40[_0x0c99('0x5e')]['to'][0x0],'ListId':_0x2db9b5[_0x0c99('0xbb')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x0c99('0xbc'));}})['then'](function(_0x32fa98){if(_0x32fa98){return db[_0x0c99('0x75')]['find']({'where':{'ContactId':_0x32fa98['id'],'closed':![],'FaxAccountId':_0x2db9b5['id']}})[_0x0c99('0x21')](function(_0x40d55d){if(_0x40d55d){return[_0x40d55d,![]];}return db['FaxInteraction'][_0x0c99('0x5d')]({'UserId':_0x5a0d40['user']['id'],'ContactId':_0x32fa98['id'],'FaxAccountId':_0x2db9b5['id'],'fax':_0x5a0d40['body']['to'][0x0],'firstMsgDirection':_0x0c99('0xbd'),'Messages':[_[_0x0c99('0x55')](_0x5a0d40[_0x0c99('0x5e')],{'read':![],'body':_0x5a0d40[_0x0c99('0x5e')][_0x0c99('0xb2')][0x0]['filename'],'FaxAccountId':_0x2db9b5['id'],'UserId':_0x5a0d40[_0x0c99('0x5f')]['id'],'ContactId':_0x32fa98['id'],'AttachmentId':_0x5a0d40[_0x0c99('0x5e')][_0x0c99('0xb2')][0x0]['id']})]},{'include':[{'model':db[_0x0c99('0xaf')],'as':_0x0c99('0xbe')}]})[_0x0c99('0x21')](function(_0x53915e){return[_0x53915e,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x14492a,_0x52cb46){if(_0x52cb46){return _0x14492a;}return db['FaxMessage']['create']({'direction':_0x0c99('0xbd'),'read':![],'body':_0x5a0d40[_0x0c99('0x5e')]['attachments'][0x0][_0x0c99('0xbf')],'FaxAccountId':_0x2db9b5['id'],'FaxInteractionId':_0x14492a['id'],'UserId':_0x5a0d40['user']['id'],'ContactId':_0x14492a[_0x0c99('0xc0')],'AttachmentId':_0x5a0d40[_0x0c99('0x5e')][_0x0c99('0xb2')][0x0]['id']})[_0x0c99('0x21')](function(_0x24472b){_0x14492a['dataValues'][_0x0c99('0xbe')]=[];_0x14492a[_0x0c99('0xc1')][_0x0c99('0xbe')][_0x0c99('0xa0')](_0x24472b['dataValues']);return _0x14492a;});})[_0x0c99('0x21')](function(_0x431c01){respondWithRpcPromise(_0x0c99('0xc2'),_0x0c99('0xc2'),{'FaxAccountId':_[_0x0c99('0xb7')](_0x5a0d40[_0x0c99('0x68')]['id'])?undefined:_0x5a0d40['params']['id'],'path':_[_0x0c99('0xb7')](_0x5a0d40[_0x0c99('0x5e')][_0x0c99('0xb2')][0x0]['path'])?undefined:_0x5a0d40[_0x0c99('0x5e')][_0x0c99('0xb2')][0x0]['path'],'fax':_[_0x0c99('0xb7')](_0x5a0d40[_0x0c99('0x5e')]['to'][0x0])?undefined:_0x5a0d40['body']['to'][0x0],'AttachmentId':_0x5a0d40[_0x0c99('0x5e')][_0x0c99('0xb2')][0x0]['id']},client9002)[_0x0c99('0x21')](function(_0x201828){logger['info']('SendFaxRpc,\x20%s',_0x201828);})[_0x0c99('0x2c')](function(_0x1d8dd6){logger['info'](_0x0c99('0xc3'),_0x1d8dd6);});return _0x431c01;})['then'](respondWithResult(_0x33b03d,null))['catch'](handleError(_0x33b03d,null));};exports[_0x0c99('0xc4')]=function(_0x479597,_0x4e8f1e,_0x5da9ac){return db[_0x0c99('0x43')]['find']({'where':{'id':_0x479597[_0x0c99('0x68')]['id']}})['then'](handleEntityNotFound(_0x4e8f1e,null))[_0x0c99('0x21')](function(_0x2291e8){if(_0x2291e8){return _0x2291e8[_0x0c99('0xc4')](_0x479597[_0x0c99('0x5e')][_0x0c99('0x6e')],_['omit'](_0x479597[_0x0c99('0x5e')],[_0x0c99('0x6e'),'id'])||{})['spread'](function(_0x3c883a){for(var _0x56820a=0x0;_0x56820a<_0x479597['body'][_0x0c99('0x6e')]['length'];_0x56820a+=0x1){socket[_0x0c99('0xc5')]('userFaxAccount:save',{'UserId':Number(_0x479597['body'][_0x0c99('0x6e')][_0x56820a]),'FaxAccountId':Number(_0x479597[_0x0c99('0x68')]['id'])});}return _0x3c883a;});}})[_0x0c99('0x21')](respondWithResult(_0x4e8f1e,null))[_0x0c99('0x2c')](handleError(_0x4e8f1e,null));};exports[_0x0c99('0xc6')]=function(_0x51f2ba,_0x3e286a,_0x1c8cda){return db[_0x0c99('0x43')][_0x0c99('0x5c')]({'where':{'id':_0x51f2ba[_0x0c99('0x68')]['id']}})[_0x0c99('0x21')](handleEntityNotFound(_0x3e286a,null))[_0x0c99('0x21')](function(_0x57ce43){if(_0x57ce43){return _0x57ce43[_0x0c99('0xc6')](_0x51f2ba[_0x0c99('0x49')][_0x0c99('0x6e')])[_0x0c99('0x21')](function(){if(_['isArray'](_0x51f2ba['query'][_0x0c99('0x6e')])){for(var _0x3ecd5a=0x0;_0x3ecd5a<_0x51f2ba[_0x0c99('0x49')][_0x0c99('0x6e')][_0x0c99('0x4e')];_0x3ecd5a+=0x1){socket[_0x0c99('0xc5')](_0x0c99('0xc7'),{'UserId':Number(_0x51f2ba['query'][_0x0c99('0x6e')][_0x3ecd5a]),'FaxAccountId':Number(_0x51f2ba['params']['id'])});}}else{socket[_0x0c99('0xc5')]('userFaxAccount:remove',{'UserId':Number(_0x51f2ba['query'][_0x0c99('0x6e')]),'FaxAccountId':Number(_0x51f2ba[_0x0c99('0x68')]['id'])});}});}})[_0x0c99('0x21')](respondWithStatusCode(_0x3e286a,null))[_0x0c99('0x2c')](handleError(_0x3e286a,null));};exports[_0x0c99('0xc8')]=function(_0x254afd,_0x2b335f,_0x557090){var _0x52ef93={};var _0x1be9d2={};var _0x4203e2;var _0x3fc82c;return db[_0x0c99('0x43')]['findOne']({'where':{'id':_0x254afd[_0x0c99('0x68')]['id']}})['then'](handleEntityNotFound(_0x2b335f,null))[_0x0c99('0x21')](function(_0x374157){if(_0x374157){_0x4203e2=_0x374157;_0x1be9d2['model']=_['keys'](db[_0x0c99('0x7a')][_0x0c99('0x44')]);_0x1be9d2[_0x0c99('0x49')]=_[_0x0c99('0x4a')](_0x254afd[_0x0c99('0x49')]);_0x1be9d2[_0x0c99('0x4b')]=_[_0x0c99('0x4c')](_0x1be9d2['model'],_0x1be9d2['query']);_0x52ef93['attributes']=_['intersection'](_0x1be9d2[_0x0c99('0x48')],qs[_0x0c99('0x5b')](_0x254afd[_0x0c99('0x49')][_0x0c99('0x5b')]));_0x52ef93[_0x0c99('0x4d')]=_0x52ef93[_0x0c99('0x4d')][_0x0c99('0x4e')]?_0x52ef93[_0x0c99('0x4d')]:_0x1be9d2['model'];_0x52ef93[_0x0c99('0x50')]=qs[_0x0c99('0x51')](_0x254afd['query']['sort']);_0x52ef93[_0x0c99('0x52')]=qs[_0x0c99('0x4b')](_[_0x0c99('0x53')](_0x254afd[_0x0c99('0x49')],_0x1be9d2[_0x0c99('0x4b')]));if(_0x254afd[_0x0c99('0x49')][_0x0c99('0x54')]){_0x52ef93[_0x0c99('0x52')]=_['merge'](_0x52ef93[_0x0c99('0x52')],{'$or':_[_0x0c99('0x42')](_0x52ef93[_0x0c99('0x4d')],function(_0x4d1860){var _0xcca7af={};_0xcca7af[_0x4d1860]={'$like':'%'+_0x254afd['query'][_0x0c99('0x54')]+'%'};return _0xcca7af;})});}_0x52ef93=_[_0x0c99('0x55')]({},_0x52ef93,_0x254afd['options']);return _0x4203e2['getAgents'](_0x52ef93);}})[_0x0c99('0x21')](function(_0x59d9cf){if(_0x59d9cf){_0x3fc82c=_0x59d9cf[_0x0c99('0x4e')];if(!_0x254afd[_0x0c99('0x49')][_0x0c99('0x4f')]('nolimit')){_0x52ef93[_0x0c99('0x32')]=qs[_0x0c99('0x32')](_0x254afd[_0x0c99('0x49')]['limit']);_0x52ef93['offset']=qs[_0x0c99('0x34')](_0x254afd['query'][_0x0c99('0x34')]);}return _0x4203e2[_0x0c99('0xc8')](_0x52ef93);}})[_0x0c99('0x21')](function(_0x23cb24){if(_0x23cb24){return _0x23cb24?{'count':_0x3fc82c,'rows':_0x23cb24}:null;}})[_0x0c99('0x21')](respondWithResult(_0x2b335f,null))[_0x0c99('0x2c')](handleError(_0x2b335f,null));};
\ No newline at end of file
index 5de46fa..1842b6e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2403=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxAccount'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x2403,0x180));var _0x3240=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2403[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x3240('0x0'));var FaxAccount=require(_0x3240('0x1'))['db'][_0x3240('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3240('0x3')](0x0);var events={'afterCreate':_0x3240('0x4'),'afterUpdate':'update','afterDestroy':_0x3240('0x5')};function emitEvent(_0x286d80){return function(_0x3ee053,_0x3f6a62,_0x191204){FaxAccountEvents[_0x3240('0x6')](_0x286d80+':'+_0x3ee053['id'],_0x3ee053);FaxAccountEvents[_0x3240('0x6')](_0x286d80,_0x3ee053);_0x191204(null);};}for(var e in events){if(events[_0x3240('0x7')](e)){var event=events[e];FaxAccount[_0x3240('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents;
\ No newline at end of file
+var _0x09ef=['events','../../mysqldb','FaxAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x207a02,_0x278c56){var _0xd995c3=function(_0x24e415){while(--_0x24e415){_0x207a02['push'](_0x207a02['shift']());}};_0xd995c3(++_0x278c56);}(_0x09ef,0x15e));var _0xf09e=function(_0x1e9ad5,_0x349933){_0x1e9ad5=_0x1e9ad5-0x0;var _0x4d1db8=_0x09ef[_0x1e9ad5];return _0x4d1db8;};'use strict';var EventEmitter=require(_0xf09e('0x0'));var FaxAccount=require(_0xf09e('0x1'))['db'][_0xf09e('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf09e('0x3')](0x0);var events={'afterCreate':_0xf09e('0x4'),'afterUpdate':_0xf09e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x18e8b4){return function(_0x56eab9,_0xbefffe,_0xd42c53){FaxAccountEvents[_0xf09e('0x6')](_0x18e8b4+':'+_0x56eab9['id'],_0x56eab9);FaxAccountEvents[_0xf09e('0x6')](_0x18e8b4,_0x56eab9);_0xd42c53(null);};}for(var e in events){if(events[_0xf09e('0x7')](e)){var event=events[e];FaxAccount[_0xf09e('0x8')](e,emitEvent(event));}}module[_0xf09e('0x9')]=FaxAccountEvents;
\ No newline at end of file
index 4b751bb..0ceede4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbb49=['path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5c1246,_0x19e562){var _0x2f03c4=function(_0x15976c){while(--_0x15976c){_0x5c1246['push'](_0x5c1246['shift']());}};_0x2f03c4(++_0x19e562);}(_0xbb49,0xf8));var _0x9bb4=function(_0x471f8f,_0x2eaaf8){_0x471f8f=_0x471f8f-0x0;var _0x31da61=_0xbb49[_0x471f8f];return _0x31da61;};'use strict';var _=require(_0x9bb4('0x0'));var util=require(_0x9bb4('0x1'));var logger=require(_0x9bb4('0x2'))(_0x9bb4('0x3'));var moment=require(_0x9bb4('0x4'));var BPromise=require(_0x9bb4('0x5'));var rp=require(_0x9bb4('0x6'));var fs=require('fs');var path=require(_0x9bb4('0x7'));var rimraf=require(_0x9bb4('0x8'));var config=require(_0x9bb4('0x9'));var attributes=require(_0x9bb4('0xa'));module[_0x9bb4('0xb')]=function(_0x53134f,_0x453ae1){return _0x53134f[_0x9bb4('0xc')](_0x9bb4('0xd'),attributes,{'tableName':_0x9bb4('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xcc9f=['exports','FaxAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0x3cada3,_0x3cae87){var _0xaa29b4=function(_0x11d868){while(--_0x11d868){_0x3cada3['push'](_0x3cada3['shift']());}};_0xaa29b4(++_0x3cae87);}(_0xcc9f,0x1d6));var _0xfcc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc9f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfcc9('0x0'));var util=require(_0xfcc9('0x1'));var logger=require(_0xfcc9('0x2'))(_0xfcc9('0x3'));var moment=require(_0xfcc9('0x4'));var BPromise=require(_0xfcc9('0x5'));var rp=require(_0xfcc9('0x6'));var fs=require('fs');var path=require(_0xfcc9('0x7'));var rimraf=require(_0xfcc9('0x8'));var config=require(_0xfcc9('0x9'));var attributes=require(_0xfcc9('0xa'));module[_0xfcc9('0xb')]=function(_0x7a7063,_0x483bd7){return _0x7a7063['define'](_0xfcc9('0xc'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 0330598..7cb6cd6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x765f=['client','http','localhost','socket.io-emitter','redis','request','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','stringify','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','keys','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','FaxApplication','Applications','get','list','applications','priority','account','length','ListId','contact','FaxInteraction','find','create','Contact\x20not\x20found','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','User','UserId','unshift','Start','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x67b97a,_0x503a86){var _0x1c50b2=function(_0x1f76d7){while(--_0x1f76d7){_0x67b97a['push'](_0x67b97a['shift']());}};_0x1c50b2(++_0x503a86);}(_0x765f,0xf8));var _0xf765=function(_0x8184f0,_0x4148ee){_0x8184f0=_0x8184f0-0x0;var _0x41f2f2=_0x765f[_0x8184f0];return _0x41f2f2;};'use strict';var _=require('lodash');var util=require(_0xf765('0x0'));var moment=require(_0xf765('0x1'));var BPromise=require(_0xf765('0x2'));var rs=require(_0xf765('0x3'));var fs=require('fs');var Redis=require(_0xf765('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf765('0x5'));var logger=require(_0xf765('0x6'))(_0xf765('0x7'));var config=require(_0xf765('0x8'));var jayson=require(_0xf765('0x9'));var client=jayson[_0xf765('0xa')][_0xf765('0xb')]({'port':0x232c});config['redis']=_['defaults'](config['redis'],{'host':_0xf765('0xc'),'port':0x18eb});var socket=require(_0xf765('0xd'))(new Redis(config[_0xf765('0xe')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x399062,_0x3499e7,_0x2ff777){return new BPromise(function(_0x1f1ff7,_0x51153b){return client[_0xf765('0xf')](_0x399062,_0x2ff777)[_0xf765('0x10')](function(_0xb3f26c){logger[_0xf765('0x11')](_0xf765('0x12'),_0x3499e7,'request\x20sent');logger[_0xf765('0x13')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3499e7,_0xf765('0x14'),JSON['stringify'](_0xb3f26c));if(_0xb3f26c[_0xf765('0x15')]){if(_0xb3f26c['error'][_0xf765('0x16')]===0x1f4){logger[_0xf765('0x15')](_0xf765('0x12'),_0x3499e7,_0xb3f26c[_0xf765('0x15')][_0xf765('0x17')]);return _0x51153b(_0xb3f26c[_0xf765('0x15')][_0xf765('0x17')]);}logger['error'](_0xf765('0x12'),_0x3499e7,_0xb3f26c[_0xf765('0x15')][_0xf765('0x17')]);return _0x1f1ff7(_0xb3f26c[_0xf765('0x15')]['message']);}else{logger[_0xf765('0x11')](_0xf765('0x12'),_0x3499e7,_0xf765('0x14'));_0x1f1ff7(_0xb3f26c[_0xf765('0x18')][_0xf765('0x17')]);}})[_0xf765('0x19')](function(_0x1b5632){logger[_0xf765('0x15')](_0xf765('0x12'),_0x3499e7,_0x1b5632);_0x51153b(_0x1b5632);});});}exports['GetFaxAccount']=function(_0x2c2de7){var _0x5cdb71=this;return new Promise(function(_0x39b10c,_0x5db378){return db[_0xf765('0x1a')][_0xf765('0x1b')]({'raw':_0x2c2de7['options']?_0x2c2de7[_0xf765('0x1c')][_0xf765('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c2de7[_0xf765('0x1c')]?_0x2c2de7[_0xf765('0x1c')][_0xf765('0x1e')]||null:null,'attributes':_0x2c2de7[_0xf765('0x1c')]?_0x2c2de7[_0xf765('0x1c')][_0xf765('0x1f')]||null:null,'limit':_0x2c2de7['options']?_0x2c2de7[_0xf765('0x1c')][_0xf765('0x20')]||null:null,'include':_0x2c2de7[_0xf765('0x1c')]?_0x2c2de7[_0xf765('0x1c')][_0xf765('0x21')]?_[_0xf765('0x22')](_0x2c2de7['options']['include'],function(_0x11afb3){return{'model':db[_0x11afb3[_0xf765('0x23')]],'as':_0x11afb3['as'],'attributes':_0x11afb3[_0xf765('0x1f')],'include':_0x11afb3['include']?_['map'](_0x11afb3[_0xf765('0x21')],function(_0x31d32c){return{'model':db[_0x31d32c[_0xf765('0x23')]],'as':_0x31d32c['as'],'attributes':_0x31d32c['attributes'],'include':_0x31d32c[_0xf765('0x21')]?_[_0xf765('0x22')](_0x31d32c[_0xf765('0x21')],function(_0x2e37e1){return{'model':db[_0x2e37e1['model']],'as':_0x2e37e1['as'],'attributes':_0x2e37e1[_0xf765('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf765('0x10')](function(_0x1d25fe){logger[_0xf765('0x11')](_0xf765('0x24'),_0x2c2de7);logger[_0xf765('0x13')](_0xf765('0x24'),_0x2c2de7,JSON[_0xf765('0x25')](_0x1d25fe));_0x39b10c(_0x1d25fe);})[_0xf765('0x19')](function(_0x303fa7){logger[_0xf765('0x15')](_0xf765('0x24'),_0x303fa7[_0xf765('0x17')],_0x2c2de7);_0x5db378(_0x5cdb71[_0xf765('0x15')](0x1f4,_0x303fa7['message']));});});};exports['NotifyFaxAccount']=function(_0x15b3b1,_0x4e37c8,_0x4e0a20){var _0x56fb04=this;return new Promise(function(_0x20962f,_0xfecee4){var _0x56b504={'body':_0x15b3b1[_0xf765('0x26')],'channel':'fax'};var _0x26ef04=[];var _0x13b820=[];var _0x16801b={};return db[_0xf765('0x27')][_0xf765('0x28')]()[_0xf765('0x10')](function(_0x512e9a){if(!_0x512e9a){throw new db[(_0xf765('0x29'))][(_0xf765('0x2a'))](_0xf765('0x2b'));}_0x26ef04=_['difference'](_['keys'](_0x512e9a),[_0xf765('0x2c'),_0xf765('0x2d')]);_0x13b820=_[_0xf765('0x2e')](_[_0xf765('0x2f')](_0x512e9a),[_0xf765('0x2c'),_0xf765('0x2d'),_0xf765('0x30'),'ListId']);if(_0x15b3b1['body']['id']){delete _0x15b3b1[_0xf765('0x26')]['id'];}if(_[_0xf765('0x31')](_0x15b3b1[_0xf765('0x26')][_0xf765('0x32')])){throw new db[(_0xf765('0x29'))][(_0xf765('0x2a'))](_0xf765('0x33'));}if(_[_0xf765('0x31')](_0x15b3b1[_0xf765('0x26')]['body'])||_0x15b3b1[_0xf765('0x26')]['body']===''){throw new db[(_0xf765('0x29'))][(_0xf765('0x2a'))](_0xf765('0x34'));}if(_[_0xf765('0x31')](_0x15b3b1[_0xf765('0x26')][_0xf765('0x35')])){throw new db[(_0xf765('0x29'))][(_0xf765('0x2a'))](_0xf765('0x36')+_0x13b820);}if(!_['includes'](_0x13b820,_0x15b3b1[_0xf765('0x26')][_0xf765('0x35')])){throw new db[(_0xf765('0x29'))][(_0xf765('0x2a'))](_0xf765('0x37')+_0x13b820);}_0x16801b[_0x15b3b1[_0xf765('0x26')][_0xf765('0x35')]]=_0x15b3b1[_0xf765('0x26')][_0xf765('0x32')];})[_0xf765('0x10')](function(){return db[_0xf765('0x1a')]['find']({'where':{'id':_0x15b3b1['account']['id']},'include':[{'model':db[_0xf765('0x38')],'as':_0xf765('0x39'),'include':[{'model':db[_0xf765('0x27')],'as':_0xf765('0x3a'),'where':_0x16801b,'limit':0x1,'order':[['updatedAt',_0xf765('0x3b')]]}]},{'model':db[_0xf765('0x3c')],'as':_0xf765('0x3d')}]});})[_0xf765('0x10')](function(_0x58a7f5){if(_0x58a7f5&&_0x58a7f5['List']){var _0x52b5e5=_0x58a7f5[_0xf765('0x3e')]({'plain':!![]});_0x56b504['account']=_0x52b5e5;_0x56b504['applications']=_0x52b5e5[_0xf765('0x3d')];_0x56b504[_0xf765('0x3f')]=_0x52b5e5['List'];_0x56b504[_0xf765('0x40')]=_['orderBy'](_0x56b504['applications'],[_0xf765('0x41')],['asc']);if(_0x56b504['account'][_0xf765('0x3d')]){delete _0x56b504[_0xf765('0x42')]['Applications'];}if(_0x56b504['account'][_0xf765('0x39')]&&_0x56b504['account'][_0xf765('0x39')][_0xf765('0x3a')][_0xf765('0x43')]){return _0x56b504[_0xf765('0x42')][_0xf765('0x39')][_0xf765('0x3a')][0x0];}var _0x10d10a=_['defaults'](_0x15b3b1[_0xf765('0x26')],{'firstName':_0x15b3b1[_0xf765('0x26')]['from'],'ListId':_0x52b5e5[_0xf765('0x44')]});_0x10d10a[_0x15b3b1[_0xf765('0x26')][_0xf765('0x35')]]=_0x15b3b1[_0xf765('0x26')][_0xf765('0x32')];return db['CmContact']['create'](_0x10d10a,{'fields':_0x26ef04,'raw':!![]});}})[_0xf765('0x10')](function(_0x48bf14){_0x56b504[_0xf765('0x45')]=_0x48bf14;if(_0x48bf14){var _0x3368fb={'ContactId':_0x48bf14['id'],'FaxAccountId':_0x15b3b1[_0xf765('0x42')]['id'],'fax':_0x48bf14['fax']};return db[_0xf765('0x46')][_0xf765('0x47')]({'where':{'ContactId':_0x48bf14['id'],'closed':![],'FaxAccountId':_0x15b3b1[_0xf765('0x42')]['id']}})[_0xf765('0x10')](function(_0x20d442){if(_0x20d442){return[_0x20d442,![]];}return db[_0xf765('0x46')][_0xf765('0x48')](_0x3368fb)[_0xf765('0x10')](function(_0x3241c6){return[_0x3241c6,!![]];});});}else{throw new Error(_0xf765('0x49'));}})['spread'](function(_0x4b5517,_0x1f1cbb){var _0x5d810a=_0x4b5517[_0xf765('0x3e')]({'plain':!![]});if(_0x1f1cbb){if(_0x56b504[_0xf765('0x42')][_0xf765('0x4a')]){_0x56b504[_0xf765('0x40')][_0xf765('0x4b')]({'id':0x0,'priority':_0x56b504[_0xf765('0x40')]['length']+0x1,'app':'close','appdata':_0xf765('0x4c'),'interval':_0xf765('0x4d')});}_0x5d810a[_0xf765('0x4e')]=!![];}else{_0x5d810a[_0xf765('0x4e')]=![];}_0x56b504[_0xf765('0x4f')]=_0x5d810a;return db[_0xf765('0x50')][_0xf765('0x48')]({'body':_0x15b3b1[_0xf765('0x26')][_0xf765('0x26')],'FaxAccountId':_0x15b3b1[_0xf765('0x42')]['id'],'FaxInteractionId':_0x4b5517['id'],'direction':'in','ContactId':_0x4b5517['ContactId'],'AttachmentId':_0x15b3b1['body'][_0xf765('0x51')]});})[_0xf765('0x10')](function(_0x1ca281){_0x56b504['message']=_0x1ca281;if(_0x56b504[_0xf765('0x4f')]['UserId']){return db[_0xf765('0x52')][_0xf765('0x47')]({'attributes':['id','name'],'where':{'id':_0x56b504[_0xf765('0x4f')][_0xf765('0x53')]}})[_0xf765('0x10')](function(_0x26702f){if(_0x26702f){_0x56b504[_0xf765('0x40')][_0xf765('0x54')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x26702f['name']+','+(_0x56b504[_0xf765('0x42')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf765('0x55'),'startRouting',_0x56b504);});}return respondWithRpcPromise(_0xf765('0x55'),'startRouting',_0x56b504);})[_0xf765('0x10')](function(_0x3965c6){_0x20962f(_0x3965c6);})[_0xf765('0x19')](function(_0x291c47){_0xfecee4(_0x56fb04['error'](0x1f4,_0x291c47['message']));});});};
\ No newline at end of file
+var _0xbda9=['agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','FaxAccount,\x20%s,\x20%s','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','GetFaxAccount','stringify','catch','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Contacts','DESC','FaxApplication','get','account','applications','Applications','list','orderBy','priority','length','FaxInteraction','create','spread','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift'];(function(_0x2af160,_0x765b1){var _0x439d67=function(_0x4d26af){while(--_0x4d26af){_0x2af160['push'](_0x2af160['shift']());}};_0x439d67(++_0x765b1);}(_0xbda9,0xb2));var _0x9bda=function(_0xf11e2e,_0xdafac9){_0xf11e2e=_0xf11e2e-0x0;var _0x44cdfe=_0xbda9[_0xf11e2e];return _0x44cdfe;};'use strict';var _=require(_0x9bda('0x0'));var util=require(_0x9bda('0x1'));var moment=require('moment');var BPromise=require(_0x9bda('0x2'));var rs=require(_0x9bda('0x3'));var fs=require('fs');var Redis=require(_0x9bda('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9bda('0x5'))(_0x9bda('0x6'));var config=require(_0x9bda('0x7'));var jayson=require(_0x9bda('0x8'));var client=jayson[_0x9bda('0x9')]['http']({'port':0x232c});config[_0x9bda('0xa')]=_[_0x9bda('0xb')](config['redis'],{'host':_0x9bda('0xc'),'port':0x18eb});var socket=require(_0x9bda('0xd'))(new Redis(config[_0x9bda('0xa')]));require(_0x9bda('0xe'))[_0x9bda('0xf')](socket);function respondWithRpcPromise(_0x4bb0bb,_0x1c24d6,_0x53f7f4){return new BPromise(function(_0x65a1ce,_0x534647){return client[_0x9bda('0x10')](_0x4bb0bb,_0x53f7f4)[_0x9bda('0x11')](function(_0x5e3365){logger['info']('FaxAccount,\x20%s,\x20%s',_0x1c24d6,_0x9bda('0x12'));logger[_0x9bda('0x13')](_0x9bda('0x14'),_0x1c24d6,_0x9bda('0x12'),JSON['stringify'](_0x5e3365));if(_0x5e3365[_0x9bda('0x15')]){if(_0x5e3365['error']['code']===0x1f4){logger[_0x9bda('0x15')]('FaxAccount,\x20%s,\x20%s',_0x1c24d6,_0x5e3365[_0x9bda('0x15')][_0x9bda('0x16')]);return _0x534647(_0x5e3365[_0x9bda('0x15')][_0x9bda('0x16')]);}logger[_0x9bda('0x15')]('FaxAccount,\x20%s,\x20%s',_0x1c24d6,_0x5e3365['error']['message']);return _0x65a1ce(_0x5e3365[_0x9bda('0x15')]['message']);}else{logger['info'](_0x9bda('0x17'),_0x1c24d6,_0x9bda('0x12'));_0x65a1ce(_0x5e3365['result'][_0x9bda('0x16')]);}})['catch'](function(_0xf3d4ab){logger[_0x9bda('0x15')](_0x9bda('0x17'),_0x1c24d6,_0xf3d4ab);_0x534647(_0xf3d4ab);});});}exports['GetFaxAccount']=function(_0xf42ad3){var _0x130c64=this;return new Promise(function(_0x29a9d8,_0x4ff635){return db[_0x9bda('0x18')][_0x9bda('0x19')]({'raw':_0xf42ad3[_0x9bda('0x1a')]?_0xf42ad3[_0x9bda('0x1a')][_0x9bda('0x1b')]===undefined?!![]:![]:!![],'where':_0xf42ad3[_0x9bda('0x1a')]?_0xf42ad3[_0x9bda('0x1a')]['where']||null:null,'attributes':_0xf42ad3['options']?_0xf42ad3[_0x9bda('0x1a')][_0x9bda('0x1c')]||null:null,'limit':_0xf42ad3['options']?_0xf42ad3[_0x9bda('0x1a')][_0x9bda('0x1d')]||null:null,'include':_0xf42ad3[_0x9bda('0x1a')]?_0xf42ad3[_0x9bda('0x1a')][_0x9bda('0x1e')]?_[_0x9bda('0x1f')](_0xf42ad3[_0x9bda('0x1a')][_0x9bda('0x1e')],function(_0x317b4b){return{'model':db[_0x317b4b['model']],'as':_0x317b4b['as'],'attributes':_0x317b4b[_0x9bda('0x1c')],'include':_0x317b4b[_0x9bda('0x1e')]?_[_0x9bda('0x1f')](_0x317b4b['include'],function(_0x19b946){return{'model':db[_0x19b946[_0x9bda('0x20')]],'as':_0x19b946['as'],'attributes':_0x19b946[_0x9bda('0x1c')],'include':_0x19b946['include']?_[_0x9bda('0x1f')](_0x19b946[_0x9bda('0x1e')],function(_0x44897a){return{'model':db[_0x44897a[_0x9bda('0x20')]],'as':_0x44897a['as'],'attributes':_0x44897a[_0x9bda('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9bda('0x11')](function(_0x3002ba){logger['info'](_0x9bda('0x21'),_0xf42ad3);logger[_0x9bda('0x13')](_0x9bda('0x21'),_0xf42ad3,JSON[_0x9bda('0x22')](_0x3002ba));_0x29a9d8(_0x3002ba);})[_0x9bda('0x23')](function(_0x3c9885){logger[_0x9bda('0x15')](_0x9bda('0x21'),_0x3c9885['message'],_0xf42ad3);_0x4ff635(_0x130c64[_0x9bda('0x15')](0x1f4,_0x3c9885[_0x9bda('0x16')]));});});};exports[_0x9bda('0x24')]=function(_0x5b0c3a,_0x31443b,_0x5a3d4e){var _0x450841=this;return new Promise(function(_0x312bb4,_0x3ae163){var _0x3e0f33={'body':_0x5b0c3a[_0x9bda('0x25')],'channel':_0x9bda('0x26')};var _0x29f4ac=[];var _0x2ebae6=[];var _0x536346={};return db[_0x9bda('0x27')][_0x9bda('0x28')]()[_0x9bda('0x11')](function(_0x17c294){if(!_0x17c294){throw new db[(_0x9bda('0x29'))][(_0x9bda('0x2a'))](_0x9bda('0x2b'));}_0x29f4ac=_[_0x9bda('0x2c')](_[_0x9bda('0x2d')](_0x17c294),[_0x9bda('0x2e'),'updatedAt']);_0x2ebae6=_['difference'](_[_0x9bda('0x2d')](_0x17c294),[_0x9bda('0x2e'),_0x9bda('0x2f'),_0x9bda('0x30'),'ListId']);if(_0x5b0c3a['body']['id']){delete _0x5b0c3a[_0x9bda('0x25')]['id'];}if(_[_0x9bda('0x31')](_0x5b0c3a['body'][_0x9bda('0x32')])){throw new db[(_0x9bda('0x29'))][(_0x9bda('0x2a'))]('from\x20is\x20mandatory');}if(_[_0x9bda('0x31')](_0x5b0c3a[_0x9bda('0x25')][_0x9bda('0x25')])||_0x5b0c3a[_0x9bda('0x25')][_0x9bda('0x25')]===''){throw new db['Sequelize'][(_0x9bda('0x2a'))](_0x9bda('0x33'));}if(_[_0x9bda('0x31')](_0x5b0c3a[_0x9bda('0x25')][_0x9bda('0x34')])){throw new db['Sequelize'][(_0x9bda('0x2a'))](_0x9bda('0x35')+_0x2ebae6);}if(!_['includes'](_0x2ebae6,_0x5b0c3a[_0x9bda('0x25')][_0x9bda('0x34')])){throw new db[(_0x9bda('0x29'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ebae6);}_0x536346[_0x5b0c3a['body'][_0x9bda('0x34')]]=_0x5b0c3a[_0x9bda('0x25')]['from'];})[_0x9bda('0x11')](function(){return db['FaxAccount'][_0x9bda('0x36')]({'where':{'id':_0x5b0c3a['account']['id']},'include':[{'model':db[_0x9bda('0x37')],'as':_0x9bda('0x38'),'include':[{'model':db[_0x9bda('0x27')],'as':_0x9bda('0x39'),'where':_0x536346,'limit':0x1,'order':[[_0x9bda('0x2f'),_0x9bda('0x3a')]]}]},{'model':db[_0x9bda('0x3b')],'as':'Applications'}]});})[_0x9bda('0x11')](function(_0x9fb11e){if(_0x9fb11e&&_0x9fb11e[_0x9bda('0x38')]){var _0x2eb8d0=_0x9fb11e[_0x9bda('0x3c')]({'plain':!![]});_0x3e0f33[_0x9bda('0x3d')]=_0x2eb8d0;_0x3e0f33[_0x9bda('0x3e')]=_0x2eb8d0[_0x9bda('0x3f')];_0x3e0f33[_0x9bda('0x40')]=_0x2eb8d0[_0x9bda('0x38')];_0x3e0f33['applications']=_[_0x9bda('0x41')](_0x3e0f33[_0x9bda('0x3e')],[_0x9bda('0x42')],['asc']);if(_0x3e0f33[_0x9bda('0x3d')]['Applications']){delete _0x3e0f33['account']['Applications'];}if(_0x3e0f33[_0x9bda('0x3d')]['List']&&_0x3e0f33['account'][_0x9bda('0x38')][_0x9bda('0x39')][_0x9bda('0x43')]){return _0x3e0f33[_0x9bda('0x3d')][_0x9bda('0x38')][_0x9bda('0x39')][0x0];}var _0x11a55a=_[_0x9bda('0xb')](_0x5b0c3a[_0x9bda('0x25')],{'firstName':_0x5b0c3a['body'][_0x9bda('0x32')],'ListId':_0x2eb8d0['ListId']});_0x11a55a[_0x5b0c3a[_0x9bda('0x25')][_0x9bda('0x34')]]=_0x5b0c3a['body'][_0x9bda('0x32')];return db[_0x9bda('0x27')]['create'](_0x11a55a,{'fields':_0x29f4ac,'raw':!![]});}})[_0x9bda('0x11')](function(_0x575c1d){_0x3e0f33['contact']=_0x575c1d;if(_0x575c1d){var _0x39b4a3={'ContactId':_0x575c1d['id'],'FaxAccountId':_0x5b0c3a['account']['id'],'fax':_0x575c1d['fax']};return db[_0x9bda('0x44')]['find']({'where':{'ContactId':_0x575c1d['id'],'closed':![],'FaxAccountId':_0x5b0c3a[_0x9bda('0x3d')]['id']}})['then'](function(_0x3f9e17){if(_0x3f9e17){return[_0x3f9e17,![]];}return db[_0x9bda('0x44')][_0x9bda('0x45')](_0x39b4a3)['then'](function(_0x49bbdc){return[_0x49bbdc,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9bda('0x46')](function(_0x584f6d,_0x387454){var _0x2bccc7=_0x584f6d[_0x9bda('0x3c')]({'plain':!![]});if(_0x387454){if(_0x3e0f33['account']['autoclose']){_0x3e0f33[_0x9bda('0x3e')][_0x9bda('0x47')]({'id':0x0,'priority':_0x3e0f33[_0x9bda('0x3e')][_0x9bda('0x43')]+0x1,'app':_0x9bda('0x48'),'appdata':_0x9bda('0x49'),'interval':_0x9bda('0x4a')});}_0x2bccc7['created']=!![];}else{_0x2bccc7[_0x9bda('0x4b')]=![];}_0x3e0f33[_0x9bda('0x4c')]=_0x2bccc7;return db[_0x9bda('0x4d')][_0x9bda('0x45')]({'body':_0x5b0c3a['body'][_0x9bda('0x25')],'FaxAccountId':_0x5b0c3a['account']['id'],'FaxInteractionId':_0x584f6d['id'],'direction':'in','ContactId':_0x584f6d['ContactId'],'AttachmentId':_0x5b0c3a[_0x9bda('0x25')][_0x9bda('0x4e')]});})[_0x9bda('0x11')](function(_0x259d9a){_0x3e0f33[_0x9bda('0x16')]=_0x259d9a;if(_0x3e0f33[_0x9bda('0x4c')][_0x9bda('0x4f')]){return db[_0x9bda('0x50')]['find']({'attributes':['id',_0x9bda('0x51')],'where':{'id':_0x3e0f33[_0x9bda('0x4c')][_0x9bda('0x4f')]}})[_0x9bda('0x11')](function(_0x52b1c6){if(_0x52b1c6){_0x3e0f33[_0x9bda('0x3e')][_0x9bda('0x52')]({'id':0x0,'priority':0x0,'app':_0x9bda('0x53'),'appdata':_0x52b1c6[_0x9bda('0x51')]+','+(_0x3e0f33[_0x9bda('0x3d')][_0x9bda('0x54')]||0xa),'interval':_0x9bda('0x4a')});}return respondWithRpcPromise(_0x9bda('0x55'),_0x9bda('0x56'),_0x3e0f33);});}return respondWithRpcPromise(_0x9bda('0x55'),'startRouting',_0x3e0f33);})[_0x9bda('0x11')](function(_0x3bf325){_0x312bb4(_0x3bf325);})['catch'](function(_0x2eebde){_0x3ae163(_0x450841[_0x9bda('0x15')](0x1f4,_0x2eebde[_0x9bda('0x16')]));});});};
\ No newline at end of file
index d968ca0..63d9463 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d4f=['emit','removeListener','faxAccount:','./faxAccount.events','save','remove'];(function(_0xb7abc,_0x2c9d6c){var _0xe845f7=function(_0x2332c3){while(--_0x2332c3){_0xb7abc['push'](_0xb7abc['shift']());}};_0xe845f7(++_0x2c9d6c);}(_0x6d4f,0x1d1));var _0xf6d4=function(_0x2d2e85,_0x22faa9){_0x2d2e85=_0x2d2e85-0x0;var _0x3e9f5e=_0x6d4f[_0x2d2e85];return _0x3e9f5e;};'use strict';var FaxAccountEvents=require(_0xf6d4('0x0'));var events=[_0xf6d4('0x1'),_0xf6d4('0x2'),'update'];function createListener(_0x5a56c6,_0x52ca0d){return function(_0x310073){_0x52ca0d[_0xf6d4('0x3')](_0x5a56c6,_0x310073);};}function removeListener(_0x8072e7,_0x207c5e){return function(){FaxAccountEvents[_0xf6d4('0x4')](_0x8072e7,_0x207c5e);};}exports['register']=function(_0x32627e){for(var _0x6fef78=0x0,_0x26e583=events['length'];_0x6fef78<_0x26e583;_0x6fef78++){var _0x16575b=events[_0x6fef78];var _0x58a57a=createListener(_0xf6d4('0x5')+_0x16575b,_0x32627e);FaxAccountEvents['on'](_0x16575b,_0x58a57a);}};
\ No newline at end of file
+var _0x85ef=['length','faxAccount:','save','remove','update','emit','removeListener','register'];(function(_0x3a6b82,_0x3eeeba){var _0x5c52b4=function(_0x2fac4f){while(--_0x2fac4f){_0x3a6b82['push'](_0x3a6b82['shift']());}};_0x5c52b4(++_0x3eeeba);}(_0x85ef,0xa2));var _0xf85e=function(_0xebc268,_0x538f08){_0xebc268=_0xebc268-0x0;var _0x51f046=_0x85ef[_0xebc268];return _0x51f046;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xf85e('0x0'),_0xf85e('0x1'),_0xf85e('0x2')];function createListener(_0x571e3a,_0x359931){return function(_0x36d448){_0x359931[_0xf85e('0x3')](_0x571e3a,_0x36d448);};}function removeListener(_0x3d0643,_0x24a8e4){return function(){FaxAccountEvents[_0xf85e('0x4')](_0x3d0643,_0x24a8e4);};}exports[_0xf85e('0x5')]=function(_0xd94e31){for(var _0x50e797=0x0,_0x74846e=events[_0xf85e('0x6')];_0x50e797<_0x74846e;_0x50e797++){var _0x46cfe2=events[_0x50e797];var _0x10d37c=createListener(_0xf85e('0x7')+_0x46cfe2,_0xd94e31);FaxAccountEvents['on'](_0x46cfe2,_0x10d37c);}};
\ No newline at end of file
index 3fc97d7..8398780 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x34ebcf,_0x592d5c){var _0x5636e2=function(_0x1d1960){while(--_0x1d1960){_0x34ebcf['push'](_0x34ebcf['shift']());}};_0x5636e2(++_0x592d5c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router;
\ No newline at end of file
+var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x155b4f,_0x5ae81b){var _0xe70959=function(_0x58c089){while(--_0x58c089){_0x155b4f['push'](_0x155b4f['shift']());}};_0xe70959(++_0x5ae81b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router;
\ No newline at end of file
index d3c1281..41791ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd212=['sequelize','exports','noop','TEXT','STRING','*,*,*,*'];(function(_0x49addb,_0x3e3a9a){var _0x286778=function(_0x5d58a0){while(--_0x5d58a0){_0x49addb['push'](_0x49addb['shift']());}};_0x286778(++_0x3e3a9a);}(_0xd212,0xd2));var _0x2d21=function(_0xd307d9,_0x50e8e0){_0xd307d9=_0xd307d9-0x0;var _0x209bf8=_0xd212[_0xd307d9];return _0x209bf8;};'use strict';var Sequelize=require(_0x2d21('0x0'));module[_0x2d21('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2d21('0x2')},'appdata':{'type':Sequelize[_0x2d21('0x3')]()},'description':{'type':Sequelize[_0x2d21('0x4')]},'interval':{'type':Sequelize[_0x2d21('0x4')],'defaultValue':_0x2d21('0x5')}};
\ No newline at end of file
+var _0x7e3d=['noop','TEXT','INTEGER','STRING'];(function(_0x2431a,_0x3cb486){var _0x4ecd65=function(_0x3a5d6d){while(--_0x3a5d6d){_0x2431a['push'](_0x2431a['shift']());}};_0x4ecd65(++_0x3cb486);}(_0x7e3d,0xe2));var _0xd7e3=function(_0x347ecc,_0x11d621){_0x347ecc=_0x347ecc-0x0;var _0x4a728d=_0x7e3d[_0x347ecc];return _0x4a728d;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xd7e3('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xd7e3('0x1')],'allowNull':![],'defaultValue':_0xd7e3('0x2')},'appdata':{'type':Sequelize[_0xd7e3('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd7e3('0x1')],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
index d15b0a9..3cc4d43 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x415c=['undefined','count','limit','reject','update','then','destroy','sendStatus','stack','name','index','map','FaxApplication','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','keys','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x62f01c,_0x4e93a2){var _0x19910e=function(_0x461b18){while(--_0x461b18){_0x62f01c['push'](_0x62f01c['shift']());}};_0x19910e(++_0x4e93a2);}(_0x415c,0x1cd));var _0xc415=function(_0x1776fe,_0x43b939){_0x1776fe=_0x1776fe-0x0;var _0x2dcc0c=_0x415c[_0x1776fe];return _0x2dcc0c;};'use strict';var emlformat=require(_0xc415('0x0'));var rimraf=require(_0xc415('0x1'));var zipdir=require(_0xc415('0x2'));var jsonpatch=require(_0xc415('0x3'));var rp=require(_0xc415('0x4'));var moment=require(_0xc415('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc415('0x6'));var util=require('util');var path=require(_0xc415('0x7'));var sox=require('sox');var csv=require(_0xc415('0x8'));var ejs=require(_0xc415('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc415('0xa'));var squel=require(_0xc415('0xb'));var crypto=require(_0xc415('0xc'));var jsforce=require(_0xc415('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc415('0x8'));var querystring=require(_0xc415('0xe'));var Papa=require(_0xc415('0xf'));var Redis=require(_0xc415('0x10'));var authService=require(_0xc415('0x11'));var qs=require(_0xc415('0x12'));var as=require(_0xc415('0x13'));var hardwareService=require(_0xc415('0x14'));var logger=require('../../config/logger')(_0xc415('0x15'));var utils=require(_0xc415('0x16'));var config=require(_0xc415('0x17'));var licenseUtil=require(_0xc415('0x18'));var db=require(_0xc415('0x19'))['db'];function respondWithStatusCode(_0x5d83f3,_0x11ce24){_0x11ce24=_0x11ce24||0xcc;return function(_0x4757b5){if(_0x4757b5){return _0x5d83f3['sendStatus'](_0x11ce24);}return _0x5d83f3[_0xc415('0x1a')](_0x11ce24)['end']();};}function respondWithResult(_0x4aac1d,_0x2f2e64){_0x2f2e64=_0x2f2e64||0xc8;return function(_0x327f3f){if(_0x327f3f){return _0x4aac1d[_0xc415('0x1a')](_0x2f2e64)[_0xc415('0x1b')](_0x327f3f);}};}function respondWithFilteredResult(_0x3de94e,_0x49332b){return function(_0x5c6335){if(_0x5c6335){var _0x5ce327=typeof _0x49332b[_0xc415('0x1c')]===_0xc415('0x1d')&&typeof _0x49332b['limit']===_0xc415('0x1d');var _0x43b728=_0x5c6335[_0xc415('0x1e')];var _0x4d899d=_0x5ce327?0x0:_0x49332b[_0xc415('0x1c')];var _0x50cbaa=_0x5ce327?_0x5c6335[_0xc415('0x1e')]:_0x49332b[_0xc415('0x1c')]+_0x49332b[_0xc415('0x1f')];var _0x198cd2;if(_0x50cbaa>=_0x43b728){_0x50cbaa=_0x43b728;_0x198cd2=0xc8;}else{_0x198cd2=0xce;}_0x3de94e[_0xc415('0x1a')](_0x198cd2);return _0x3de94e['set']('Content-Range',_0x4d899d+'-'+_0x50cbaa+'/'+_0x43b728)[_0xc415('0x1b')](_0x5c6335);}return null;};}function patchUpdates(_0x5f11f6){return function(_0x39a271){try{jsonpatch['apply'](_0x39a271,_0x5f11f6,!![]);}catch(_0x1870c5){return BPromise[_0xc415('0x20')](_0x1870c5);}return _0x39a271['save']();};}function saveUpdates(_0x2586e0,_0x440391){return function(_0x3170bc){if(_0x3170bc){return _0x3170bc[_0xc415('0x21')](_0x2586e0)[_0xc415('0x22')](function(_0x5f2528){return _0x5f2528;});}return null;};}function removeEntity(_0x4826c1,_0x4419e3){return function(_0x4fefca){if(_0x4fefca){return _0x4fefca[_0xc415('0x23')]()[_0xc415('0x22')](function(){_0x4826c1[_0xc415('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e387c,_0x3caa11){return function(_0x41eca9){if(!_0x41eca9){_0x4e387c[_0xc415('0x24')](0x194);}return _0x41eca9;};}function handleError(_0xda5dc4,_0x579991){_0x579991=_0x579991||0x1f4;return function(_0x58ad4c){logger['error'](_0x58ad4c[_0xc415('0x25')]);if(_0x58ad4c[_0xc415('0x26')]){delete _0x58ad4c['name'];}_0xda5dc4[_0xc415('0x1a')](_0x579991)['send'](_0x58ad4c);};}exports[_0xc415('0x27')]=function(_0x36769d,_0x37f993){var _0x327bea={},_0x516b5c={},_0x231aa2={'count':0x0,'rows':[]};var _0x17c606=_[_0xc415('0x28')](db[_0xc415('0x29')][_0xc415('0x2a')],function(_0x213439){return{'name':_0x213439['fieldName'],'type':_0x213439[_0xc415('0x2b')][_0xc415('0x2c')]};});_0x516b5c[_0xc415('0x2d')]=_[_0xc415('0x28')](_0x17c606,_0xc415('0x26'));_0x516b5c[_0xc415('0x2e')]=_['keys'](_0x36769d[_0xc415('0x2e')]);_0x516b5c[_0xc415('0x2f')]=_['intersection'](_0x516b5c[_0xc415('0x2d')],_0x516b5c[_0xc415('0x2e')]);_0x327bea[_0xc415('0x30')]=_[_0xc415('0x31')](_0x516b5c[_0xc415('0x2d')],qs[_0xc415('0x32')](_0x36769d[_0xc415('0x2e')][_0xc415('0x32')]));_0x327bea[_0xc415('0x30')]=_0x327bea['attributes'][_0xc415('0x33')]?_0x327bea[_0xc415('0x30')]:_0x516b5c[_0xc415('0x2d')];if(!_0x36769d[_0xc415('0x2e')][_0xc415('0x34')](_0xc415('0x35'))){_0x327bea['limit']=qs[_0xc415('0x1f')](_0x36769d[_0xc415('0x2e')][_0xc415('0x1f')]);_0x327bea['offset']=qs[_0xc415('0x1c')](_0x36769d[_0xc415('0x2e')]['offset']);}_0x327bea['order']=qs['sort'](_0x36769d[_0xc415('0x2e')][_0xc415('0x36')]);_0x327bea[_0xc415('0x37')]=qs[_0xc415('0x2f')](_[_0xc415('0x38')](_0x36769d[_0xc415('0x2e')],_0x516b5c[_0xc415('0x2f')]),_0x17c606);if(_0x36769d['query'][_0xc415('0x39')]){_0x327bea[_0xc415('0x37')]=_['merge'](_0x327bea[_0xc415('0x37')],{'$or':_[_0xc415('0x28')](_0x17c606,function(_0x45dca5){if(_0x45dca5[_0xc415('0x2b')]!=='VIRTUAL'){var _0x1c7108={};_0x1c7108[_0x45dca5[_0xc415('0x26')]]={'$like':'%'+_0x36769d['query'][_0xc415('0x39')]+'%'};return _0x1c7108;}})});}_0x327bea=_[_0xc415('0x3a')]({},_0x327bea,_0x36769d[_0xc415('0x3b')]);var _0x4c0d58={'where':_0x327bea[_0xc415('0x37')]};return db[_0xc415('0x29')]['count'](_0x4c0d58)[_0xc415('0x22')](function(_0x500321){_0x231aa2[_0xc415('0x1e')]=_0x500321;if(_0x36769d[_0xc415('0x2e')][_0xc415('0x3c')]){_0x327bea[_0xc415('0x3d')]=[{'all':!![]}];}return db[_0xc415('0x29')][_0xc415('0x3e')](_0x327bea);})[_0xc415('0x22')](function(_0x5e1fb4){_0x231aa2[_0xc415('0x3f')]=_0x5e1fb4;return _0x231aa2;})[_0xc415('0x22')](respondWithFilteredResult(_0x37f993,_0x327bea))[_0xc415('0x40')](handleError(_0x37f993,null));};exports['show']=function(_0x5f03a5,_0x53820b){var _0x2b561e={'raw':!![],'where':{'id':_0x5f03a5['params']['id']}},_0x291cd1={};_0x291cd1['model']=_[_0xc415('0x41')](db['FaxApplication']['rawAttributes']);_0x291cd1[_0xc415('0x2e')]=_[_0xc415('0x41')](_0x5f03a5[_0xc415('0x2e')]);_0x291cd1[_0xc415('0x2f')]=_['intersection'](_0x291cd1[_0xc415('0x2d')],_0x291cd1[_0xc415('0x2e')]);_0x2b561e[_0xc415('0x30')]=_[_0xc415('0x31')](_0x291cd1[_0xc415('0x2d')],qs[_0xc415('0x32')](_0x5f03a5['query'][_0xc415('0x32')]));_0x2b561e['attributes']=_0x2b561e[_0xc415('0x30')]['length']?_0x2b561e[_0xc415('0x30')]:_0x291cd1['model'];if(_0x5f03a5['query'][_0xc415('0x3c')]){_0x2b561e[_0xc415('0x3d')]=[{'all':!![]}];}_0x2b561e=_['merge']({},_0x2b561e,_0x5f03a5[_0xc415('0x3b')]);return db[_0xc415('0x29')]['find'](_0x2b561e)['then'](handleEntityNotFound(_0x53820b,null))[_0xc415('0x22')](respondWithResult(_0x53820b,null))['catch'](handleError(_0x53820b,null));};exports['create']=function(_0x39a1ba,_0x534db6){return db[_0xc415('0x29')][_0xc415('0x42')](_0x39a1ba[_0xc415('0x43')],{})[_0xc415('0x22')](respondWithResult(_0x534db6,0xc9))[_0xc415('0x40')](handleError(_0x534db6,null));};exports[_0xc415('0x21')]=function(_0x48f37a,_0x204f0c){if(_0x48f37a[_0xc415('0x43')]['id']){delete _0x48f37a[_0xc415('0x43')]['id'];}return db[_0xc415('0x29')][_0xc415('0x44')]({'where':{'id':_0x48f37a[_0xc415('0x45')]['id']}})[_0xc415('0x22')](handleEntityNotFound(_0x204f0c,null))[_0xc415('0x22')](saveUpdates(_0x48f37a[_0xc415('0x43')],null))[_0xc415('0x22')](respondWithResult(_0x204f0c,null))['catch'](handleError(_0x204f0c,null));};exports['destroy']=function(_0x5620c2,_0x52d0dd){return db['FaxApplication'][_0xc415('0x44')]({'where':{'id':_0x5620c2['params']['id']}})['then'](handleEntityNotFound(_0x52d0dd,null))[_0xc415('0x22')](removeEntity(_0x52d0dd,null))[_0xc415('0x40')](handleError(_0x52d0dd,null));};
\ No newline at end of file
+var _0xf555=['save','update','then','destroy','error','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','model','find','create','body','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject'];(function(_0x24cfca,_0xfe2097){var _0x492d6c=function(_0x3f36d3){while(--_0x3f36d3){_0x24cfca['push'](_0x24cfca['shift']());}};_0x492d6c(++_0xfe2097);}(_0xf555,0x15d));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5f55('0x0'));var jsonpatch=require(_0x5f55('0x1'));var rp=require(_0x5f55('0x2'));var moment=require('moment');var BPromise=require(_0x5f55('0x3'));var Mustache=require(_0x5f55('0x4'));var util=require(_0x5f55('0x5'));var path=require(_0x5f55('0x6'));var sox=require(_0x5f55('0x7'));var csv=require(_0x5f55('0x8'));var ejs=require(_0x5f55('0x9'));var fs=require('fs');var fs_extra=require(_0x5f55('0xa'));var _=require(_0x5f55('0xb'));var squel=require('squel');var crypto=require(_0x5f55('0xc'));var jsforce=require(_0x5f55('0xd'));var deskjs=require(_0x5f55('0xe'));var toCsv=require(_0x5f55('0x8'));var querystring=require(_0x5f55('0xf'));var Papa=require(_0x5f55('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5f55('0x11'));var as=require(_0x5f55('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f55('0x13'))(_0x5f55('0x14'));var utils=require(_0x5f55('0x15'));var config=require(_0x5f55('0x16'));var licenseUtil=require(_0x5f55('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa4f85a,_0x2e6041){_0x2e6041=_0x2e6041||0xcc;return function(_0x3f79d8){if(_0x3f79d8){return _0xa4f85a[_0x5f55('0x18')](_0x2e6041);}return _0xa4f85a[_0x5f55('0x19')](_0x2e6041)[_0x5f55('0x1a')]();};}function respondWithResult(_0x16d42f,_0x4b2a74){_0x4b2a74=_0x4b2a74||0xc8;return function(_0x504991){if(_0x504991){return _0x16d42f[_0x5f55('0x19')](_0x4b2a74)['json'](_0x504991);}};}function respondWithFilteredResult(_0x55bd6a,_0x70f511){return function(_0x20541b){if(_0x20541b){var _0x2dca15=typeof _0x70f511[_0x5f55('0x1b')]===_0x5f55('0x1c')&&typeof _0x70f511[_0x5f55('0x1d')]===_0x5f55('0x1c');var _0x247125=_0x20541b[_0x5f55('0x1e')];var _0xf85299=_0x2dca15?0x0:_0x70f511['offset'];var _0xcc5e32=_0x2dca15?_0x20541b[_0x5f55('0x1e')]:_0x70f511['offset']+_0x70f511[_0x5f55('0x1d')];var _0x7dfffb;if(_0xcc5e32>=_0x247125){_0xcc5e32=_0x247125;_0x7dfffb=0xc8;}else{_0x7dfffb=0xce;}_0x55bd6a['status'](_0x7dfffb);return _0x55bd6a[_0x5f55('0x1f')](_0x5f55('0x20'),_0xf85299+'-'+_0xcc5e32+'/'+_0x247125)[_0x5f55('0x21')](_0x20541b);}return null;};}function patchUpdates(_0x18bff3){return function(_0x108ecf){try{jsonpatch[_0x5f55('0x22')](_0x108ecf,_0x18bff3,!![]);}catch(_0x389bd7){return BPromise[_0x5f55('0x23')](_0x389bd7);}return _0x108ecf[_0x5f55('0x24')]();};}function saveUpdates(_0x1898a5,_0x9675c1){return function(_0x1b3f17){if(_0x1b3f17){return _0x1b3f17[_0x5f55('0x25')](_0x1898a5)[_0x5f55('0x26')](function(_0x5b7f59){return _0x5b7f59;});}return null;};}function removeEntity(_0x2d3fa2,_0x5c94d1){return function(_0x43a6c5){if(_0x43a6c5){return _0x43a6c5[_0x5f55('0x27')]()[_0x5f55('0x26')](function(){_0x2d3fa2[_0x5f55('0x19')](0xcc)[_0x5f55('0x1a')]();});}};}function handleEntityNotFound(_0x13e977,_0x1beda1){return function(_0x5ade77){if(!_0x5ade77){_0x13e977[_0x5f55('0x18')](0x194);}return _0x5ade77;};}function handleError(_0x5d4e13,_0x234620){_0x234620=_0x234620||0x1f4;return function(_0x1fddc2){logger[_0x5f55('0x28')](_0x1fddc2['stack']);if(_0x1fddc2[_0x5f55('0x29')]){delete _0x1fddc2[_0x5f55('0x29')];}_0x5d4e13[_0x5f55('0x19')](_0x234620)[_0x5f55('0x2a')](_0x1fddc2);};}exports[_0x5f55('0x2b')]=function(_0x34bbfd,_0xbd4c0f){var _0x407c94={},_0x8f8c58={},_0xfe060c={'count':0x0,'rows':[]};var _0x136aab=_[_0x5f55('0x2c')](db[_0x5f55('0x2d')][_0x5f55('0x2e')],function(_0x22cf40){return{'name':_0x22cf40[_0x5f55('0x2f')],'type':_0x22cf40[_0x5f55('0x30')][_0x5f55('0x31')]};});_0x8f8c58['model']=_[_0x5f55('0x2c')](_0x136aab,_0x5f55('0x29'));_0x8f8c58[_0x5f55('0x32')]=_[_0x5f55('0x33')](_0x34bbfd[_0x5f55('0x32')]);_0x8f8c58['filters']=_[_0x5f55('0x34')](_0x8f8c58['model'],_0x8f8c58[_0x5f55('0x32')]);_0x407c94[_0x5f55('0x35')]=_[_0x5f55('0x34')](_0x8f8c58['model'],qs['fields'](_0x34bbfd[_0x5f55('0x32')][_0x5f55('0x36')]));_0x407c94[_0x5f55('0x35')]=_0x407c94[_0x5f55('0x35')][_0x5f55('0x37')]?_0x407c94[_0x5f55('0x35')]:_0x8f8c58['model'];if(!_0x34bbfd['query'][_0x5f55('0x38')](_0x5f55('0x39'))){_0x407c94[_0x5f55('0x1d')]=qs[_0x5f55('0x1d')](_0x34bbfd[_0x5f55('0x32')][_0x5f55('0x1d')]);_0x407c94[_0x5f55('0x1b')]=qs[_0x5f55('0x1b')](_0x34bbfd[_0x5f55('0x32')]['offset']);}_0x407c94[_0x5f55('0x3a')]=qs[_0x5f55('0x3b')](_0x34bbfd['query'][_0x5f55('0x3b')]);_0x407c94[_0x5f55('0x3c')]=qs['filters'](_[_0x5f55('0x3d')](_0x34bbfd[_0x5f55('0x32')],_0x8f8c58[_0x5f55('0x3e')]),_0x136aab);if(_0x34bbfd[_0x5f55('0x32')][_0x5f55('0x3f')]){_0x407c94['where']=_[_0x5f55('0x40')](_0x407c94[_0x5f55('0x3c')],{'$or':_[_0x5f55('0x2c')](_0x136aab,function(_0x50c394){if(_0x50c394[_0x5f55('0x30')]!==_0x5f55('0x41')){var _0x1132ce={};_0x1132ce[_0x50c394[_0x5f55('0x29')]]={'$like':'%'+_0x34bbfd[_0x5f55('0x32')][_0x5f55('0x3f')]+'%'};return _0x1132ce;}})});}_0x407c94=_[_0x5f55('0x40')]({},_0x407c94,_0x34bbfd[_0x5f55('0x42')]);var _0x298df7={'where':_0x407c94['where']};return db[_0x5f55('0x2d')]['count'](_0x298df7)['then'](function(_0x24fa4d){_0xfe060c[_0x5f55('0x1e')]=_0x24fa4d;if(_0x34bbfd[_0x5f55('0x32')][_0x5f55('0x43')]){_0x407c94['include']=[{'all':!![]}];}return db[_0x5f55('0x2d')][_0x5f55('0x44')](_0x407c94);})['then'](function(_0x1b06cd){_0xfe060c[_0x5f55('0x45')]=_0x1b06cd;return _0xfe060c;})[_0x5f55('0x26')](respondWithFilteredResult(_0xbd4c0f,_0x407c94))[_0x5f55('0x46')](handleError(_0xbd4c0f,null));};exports[_0x5f55('0x47')]=function(_0x4248ea,_0x312c88){var _0x285b05={'raw':!![],'where':{'id':_0x4248ea[_0x5f55('0x48')]['id']}},_0x4e555d={};_0x4e555d[_0x5f55('0x49')]=_['keys'](db[_0x5f55('0x2d')][_0x5f55('0x2e')]);_0x4e555d['query']=_[_0x5f55('0x33')](_0x4248ea[_0x5f55('0x32')]);_0x4e555d[_0x5f55('0x3e')]=_['intersection'](_0x4e555d[_0x5f55('0x49')],_0x4e555d['query']);_0x285b05[_0x5f55('0x35')]=_[_0x5f55('0x34')](_0x4e555d[_0x5f55('0x49')],qs[_0x5f55('0x36')](_0x4248ea[_0x5f55('0x32')][_0x5f55('0x36')]));_0x285b05[_0x5f55('0x35')]=_0x285b05[_0x5f55('0x35')][_0x5f55('0x37')]?_0x285b05[_0x5f55('0x35')]:_0x4e555d[_0x5f55('0x49')];if(_0x4248ea['query']['includeAll']){_0x285b05['include']=[{'all':!![]}];}_0x285b05=_[_0x5f55('0x40')]({},_0x285b05,_0x4248ea[_0x5f55('0x42')]);return db['FaxApplication'][_0x5f55('0x4a')](_0x285b05)[_0x5f55('0x26')](handleEntityNotFound(_0x312c88,null))[_0x5f55('0x26')](respondWithResult(_0x312c88,null))[_0x5f55('0x46')](handleError(_0x312c88,null));};exports[_0x5f55('0x4b')]=function(_0x1152b3,_0x2cffb1){return db[_0x5f55('0x2d')]['create'](_0x1152b3[_0x5f55('0x4c')],{})['then'](respondWithResult(_0x2cffb1,0xc9))[_0x5f55('0x46')](handleError(_0x2cffb1,null));};exports[_0x5f55('0x25')]=function(_0x1613f0,_0x46d5a5){if(_0x1613f0[_0x5f55('0x4c')]['id']){delete _0x1613f0[_0x5f55('0x4c')]['id'];}return db['FaxApplication'][_0x5f55('0x4a')]({'where':{'id':_0x1613f0[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0x46d5a5,null))[_0x5f55('0x26')](saveUpdates(_0x1613f0[_0x5f55('0x4c')],null))[_0x5f55('0x26')](respondWithResult(_0x46d5a5,null))[_0x5f55('0x46')](handleError(_0x46d5a5,null));};exports[_0x5f55('0x27')]=function(_0x27e4b1,_0x68d558){return db[_0x5f55('0x2d')]['find']({'where':{'id':_0x27e4b1[_0x5f55('0x48')]['id']}})[_0x5f55('0x26')](handleEntityNotFound(_0x68d558,null))[_0x5f55('0x26')](removeEntity(_0x68d558,null))[_0x5f55('0x46')](handleError(_0x68d558,null));};
\ No newline at end of file
index 02bdb00..942065e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcc73=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications'];(function(_0xda6f2c,_0x4d5932){var _0x20ee51=function(_0x1a31b0){while(--_0x1a31b0){_0xda6f2c['push'](_0xda6f2c['shift']());}};_0x20ee51(++_0x4d5932);}(_0xcc73,0x10c));var _0x3cc7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xcc73[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x3cc7('0x0'));var logger=require(_0x3cc7('0x1'))('api');var moment=require(_0x3cc7('0x2'));var BPromise=require(_0x3cc7('0x3'));var rp=require(_0x3cc7('0x4'));var fs=require('fs');var path=require(_0x3cc7('0x5'));var rimraf=require(_0x3cc7('0x6'));var config=require(_0x3cc7('0x7'));var attributes=require('./faxApplication.attributes');module[_0x3cc7('0x8')]=function(_0x118d6,_0x483c17){return _0x118d6[_0x3cc7('0x9')](_0x3cc7('0xa'),attributes,{'tableName':_0x3cc7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3cc7('0xc'),'collate':_0x3cc7('0xd')});};
\ No newline at end of file
+var _0x1fe3=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x4a096c,_0x125607){var _0x3cff1c=function(_0x102874){while(--_0x102874){_0x4a096c['push'](_0x4a096c['shift']());}};_0x3cff1c(++_0x125607);}(_0x1fe3,0x17e));var _0x31fe=function(_0x5b5dba,_0x28061a){_0x5b5dba=_0x5b5dba-0x0;var _0x211ad9=_0x1fe3[_0x5b5dba];return _0x211ad9;};'use strict';var _=require(_0x31fe('0x0'));var util=require(_0x31fe('0x1'));var logger=require(_0x31fe('0x2'))(_0x31fe('0x3'));var moment=require(_0x31fe('0x4'));var BPromise=require(_0x31fe('0x5'));var rp=require(_0x31fe('0x6'));var fs=require('fs');var path=require(_0x31fe('0x7'));var rimraf=require('rimraf');var config=require(_0x31fe('0x8'));var attributes=require(_0x31fe('0x9'));module[_0x31fe('0xa')]=function(_0x31bc03,_0x48a239){return _0x31bc03[_0x31fe('0xb')](_0x31fe('0xc'),attributes,{'tableName':_0x31fe('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x31fe('0xe'),'collate':_0x31fe('0xf')});};
\ No newline at end of file
index 46137f1..22a4ed2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3082=['FaxApplication,\x20%s,\x20%s','UpdateFaxApplication','FaxApplication','body','options','raw','attributes','limit','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','info','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x9b497,_0x419469){var _0x18f86f=function(_0x378407){while(--_0x378407){_0x9b497['push'](_0x9b497['shift']());}};_0x18f86f(++_0x419469);}(_0x3082,0x1ca));var _0x2308=function(_0x35a2e8,_0x38f67c){_0x35a2e8=_0x35a2e8-0x0;var _0x49d266=_0x3082[_0x35a2e8];return _0x49d266;};'use strict';var _=require(_0x2308('0x0'));var util=require(_0x2308('0x1'));var moment=require(_0x2308('0x2'));var BPromise=require(_0x2308('0x3'));var rs=require(_0x2308('0x4'));var fs=require('fs');var Redis=require(_0x2308('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2308('0x6'));var logger=require(_0x2308('0x7'))(_0x2308('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2308('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x523abe,_0x1caaf7,_0xe32e0a){return new BPromise(function(_0x6790f0,_0x46566c){return client[_0x2308('0xa')](_0x523abe,_0xe32e0a)['then'](function(_0x593e78){logger[_0x2308('0xb')]('FaxApplication,\x20%s,\x20%s',_0x1caaf7,_0x2308('0xc'));logger['debug'](_0x2308('0xd'),_0x1caaf7,_0x2308('0xc'),JSON[_0x2308('0xe')](_0x593e78));if(_0x593e78[_0x2308('0xf')]){if(_0x593e78[_0x2308('0xf')][_0x2308('0x10')]===0x1f4){logger[_0x2308('0xf')]('FaxApplication,\x20%s,\x20%s',_0x1caaf7,_0x593e78[_0x2308('0xf')][_0x2308('0x11')]);return _0x46566c(_0x593e78[_0x2308('0xf')]['message']);}logger[_0x2308('0xf')](_0x2308('0x12'),_0x1caaf7,_0x593e78[_0x2308('0xf')]['message']);return _0x6790f0(_0x593e78['error'][_0x2308('0x11')]);}else{logger[_0x2308('0xb')]('FaxApplication,\x20%s,\x20%s',_0x1caaf7,_0x2308('0xc'));_0x6790f0(_0x593e78['result'][_0x2308('0x11')]);}})['catch'](function(_0x3528bf){logger[_0x2308('0xf')](_0x2308('0x12'),_0x1caaf7,_0x3528bf);_0x46566c(_0x3528bf);});});}exports[_0x2308('0x13')]=function(_0x260d9f){var _0x3bf542=this;return new Promise(function(_0x1d9439,_0x5e6f41){return db[_0x2308('0x14')]['update'](_0x260d9f[_0x2308('0x15')],{'raw':_0x260d9f[_0x2308('0x16')]?_0x260d9f[_0x2308('0x16')][_0x2308('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x260d9f[_0x2308('0x16')]?_0x260d9f['options']['where']||null:null,'attributes':_0x260d9f['options']?_0x260d9f[_0x2308('0x16')][_0x2308('0x18')]||null:null,'limit':_0x260d9f['options']?_0x260d9f[_0x2308('0x16')][_0x2308('0x19')]||null:null})[_0x2308('0x1a')](function(_0xe4ebf9){logger[_0x2308('0xb')](_0x2308('0x13'),_0x260d9f);logger['debug'](_0x2308('0x13'),_0x260d9f,JSON[_0x2308('0xe')](_0xe4ebf9));_0x1d9439(_0xe4ebf9);})[_0x2308('0x1b')](function(_0x2e01b5){logger[_0x2308('0xf')]('UpdateFaxApplication',_0x2e01b5[_0x2308('0x11')],_0x260d9f);_0x5e6f41(_0x3bf542[_0x2308('0xf')](0x1f4,_0x2e01b5[_0x2308('0x11')]));});});};
\ No newline at end of file
+var _0xc468=['info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','then','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x4bc25a,_0x3c9550){var _0x3caac6=function(_0x31cfa9){while(--_0x31cfa9){_0x4bc25a['push'](_0x4bc25a['shift']());}};_0x3caac6(++_0x3c9550);}(_0xc468,0xec));var _0x8c46=function(_0x2c6e5e,_0x4c2b21){_0x2c6e5e=_0x2c6e5e-0x0;var _0x438188=_0xc468[_0x2c6e5e];return _0x438188;};'use strict';var _=require(_0x8c46('0x0'));var util=require(_0x8c46('0x1'));var moment=require(_0x8c46('0x2'));var BPromise=require(_0x8c46('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c46('0x4'));var db=require(_0x8c46('0x5'))['db'];var utils=require(_0x8c46('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8c46('0x7'));var jayson=require(_0x8c46('0x8'));var client=jayson[_0x8c46('0x9')][_0x8c46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d60a0,_0x4087c4,_0x2fb8ca){return new BPromise(function(_0x1d9db8,_0x3b31a3){return client[_0x8c46('0xb')](_0x5d60a0,_0x2fb8ca)['then'](function(_0x1a35c2){logger[_0x8c46('0xc')](_0x8c46('0xd'),_0x4087c4,_0x8c46('0xe'));logger['debug'](_0x8c46('0xf'),_0x4087c4,_0x8c46('0xe'),JSON[_0x8c46('0x10')](_0x1a35c2));if(_0x1a35c2['error']){if(_0x1a35c2['error'][_0x8c46('0x11')]===0x1f4){logger[_0x8c46('0x12')](_0x8c46('0xd'),_0x4087c4,_0x1a35c2[_0x8c46('0x12')][_0x8c46('0x13')]);return _0x3b31a3(_0x1a35c2[_0x8c46('0x12')][_0x8c46('0x13')]);}logger[_0x8c46('0x12')]('FaxApplication,\x20%s,\x20%s',_0x4087c4,_0x1a35c2[_0x8c46('0x12')][_0x8c46('0x13')]);return _0x1d9db8(_0x1a35c2[_0x8c46('0x12')]['message']);}else{logger[_0x8c46('0xc')](_0x8c46('0xd'),_0x4087c4,_0x8c46('0xe'));_0x1d9db8(_0x1a35c2[_0x8c46('0x14')][_0x8c46('0x13')]);}})[_0x8c46('0x15')](function(_0x4ad1ba){logger[_0x8c46('0x12')](_0x8c46('0xd'),_0x4087c4,_0x4ad1ba);_0x3b31a3(_0x4ad1ba);});});}exports[_0x8c46('0x16')]=function(_0x4a3f7a){var _0x40459c=this;return new Promise(function(_0x530d6f,_0x4a9d9b){return db[_0x8c46('0x17')]['update'](_0x4a3f7a[_0x8c46('0x18')],{'raw':_0x4a3f7a[_0x8c46('0x19')]?_0x4a3f7a[_0x8c46('0x19')][_0x8c46('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a3f7a[_0x8c46('0x19')]?_0x4a3f7a[_0x8c46('0x19')][_0x8c46('0x1b')]||null:null,'attributes':_0x4a3f7a[_0x8c46('0x19')]?_0x4a3f7a[_0x8c46('0x19')][_0x8c46('0x1c')]||null:null,'limit':_0x4a3f7a[_0x8c46('0x19')]?_0x4a3f7a[_0x8c46('0x19')]['limit']||null:null})[_0x8c46('0x1d')](function(_0x1aa9ab){logger[_0x8c46('0xc')](_0x8c46('0x16'),_0x4a3f7a);logger[_0x8c46('0x1e')]('UpdateFaxApplication',_0x4a3f7a,JSON[_0x8c46('0x10')](_0x1aa9ab));_0x530d6f(_0x1aa9ab);})['catch'](function(_0x59b4e5){logger[_0x8c46('0x12')]('UpdateFaxApplication',_0x59b4e5[_0x8c46('0x13')],_0x4a3f7a);_0x4a9d9b(_0x40459c['error'](0x1f4,_0x59b4e5[_0x8c46('0x13')]));});});};
\ No newline at end of file
index d29b1ef..f6694e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8603=['../../components/interaction/service','./faxApplication.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x1f1fb4,_0x15a561){var _0x12fa15=function(_0x5ecc9b){while(--_0x5ecc9b){_0x1f1fb4['push'](_0x1f1fb4['shift']());}};_0x12fa15(++_0x15a561);}(_0x8603,0x190));var _0x3860=function(_0x1b792f,_0x28bc50){_0x1b792f=_0x1b792f-0x0;var _0xb7e658=_0x8603[_0x1b792f];return _0xb7e658;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router;
\ No newline at end of file
+var _0x955f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x955f,0x1eb));var _0xf955=function(_0x471399,_0x319c18){_0x471399=_0x471399-0x0;var _0x1eab32=_0x955f[_0x471399];return _0x1eab32;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./faxApplication.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['show']);router[_0xf955('0xb')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')](_0xf955('0xa'),auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['delete'](_0xf955('0xa'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);module[_0xf955('0x10')]=router;
\ No newline at end of file
index 1e5fdb4..518fd4a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x337e=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x30fb7c,_0x2a814c){var _0x52bdac=function(_0x52ed15){while(--_0x52ed15){_0x30fb7c['push'](_0x30fb7c['shift']());}};_0x52bdac(++_0x2a814c);}(_0x337e,0x69));var _0xe337=function(_0x5dd35a,_0x543f8d){_0x5dd35a=_0x5dd35a-0x0;var _0x6a3f73=_0x337e[_0x5dd35a];return _0x6a3f73;};'use strict';var Sequelize=require(_0xe337('0x0'));module[_0xe337('0x1')]={'closed':{'type':Sequelize[_0xe337('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe337('0x3')]},'disposition':{'type':Sequelize[_0xe337('0x4')]},'secondDisposition':{'type':Sequelize[_0xe337('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe337('0x4')]},'note':{'type':Sequelize[_0xe337('0x4')]},'read1stAt':{'type':Sequelize[_0xe337('0x3')]},'fax':{'type':Sequelize[_0xe337('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe337('0x5')]('in',_0xe337('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe337('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe337('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}};
\ No newline at end of file
+var _0x41ef=['BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x41ef,0xc8));var _0xf41e=function(_0x550b7b,_0x3d6314){_0x550b7b=_0x550b7b-0x0;var _0x451b9f=_0x41ef[_0x550b7b];return _0x451b9f;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xf41e('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf41e('0x1')]},'disposition':{'type':Sequelize[_0xf41e('0x2')]},'secondDisposition':{'type':Sequelize[_0xf41e('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf41e('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xf41e('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf41e('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf41e('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf41e('0x4')),'defaultValue':'in','allowNull':![]}};
\ No newline at end of file
index 2df85f0..85d7b8b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6094=['fullname','Tags','TagIds','forEach','push','catch','talking','answered','unmanaged','closed','UserId','waiting','total','index','FaxInteraction','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','field','color','from','select','u.id','ui.FaxInteractionId','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','split','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','buildExpression','body','text','keys','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','show','params','rawAttributes','includeAll','include','options','create','describe','addMessage','FaxMessage','omit','findOne','nolimit','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','ids','emit','faxInteractionTags:save','download','join','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','pipe','createWriteStream','log','err','unlinkSync','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','end','json','offset','undefined','count','status','set','Content-Range','apply','update','destroy','then','sendStatus','error','stack','name','send','map'];(function(_0x2efb4a,_0x5c83f0){var _0xed66ca=function(_0x3577b4){while(--_0x3577b4){_0x2efb4a['push'](_0x2efb4a['shift']());}};_0xed66ca(++_0x5c83f0);}(_0x6094,0x192));var _0x4609=function(_0x54dcce,_0x363d1f){_0x54dcce=_0x54dcce-0x0;var _0x540941=_0x6094[_0x54dcce];return _0x540941;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4609('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4609('0x1'));var rp=require('request-promise');var moment=require(_0x4609('0x2'));var BPromise=require(_0x4609('0x3'));var Mustache=require(_0x4609('0x4'));var util=require('util');var path=require(_0x4609('0x5'));var sox=require(_0x4609('0x6'));var csv=require(_0x4609('0x7'));var ejs=require(_0x4609('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4609('0x9'));var squel=require('squel');var crypto=require(_0x4609('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4609('0xb'));var toCsv=require(_0x4609('0x7'));var querystring=require(_0x4609('0xc'));var Papa=require('papaparse');var Redis=require(_0x4609('0xd'));var authService=require(_0x4609('0xe'));var qs=require(_0x4609('0xf'));var as=require(_0x4609('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4609('0x11'));var utils=require('../../config/utils');var config=require(_0x4609('0x12'));var licenseUtil=require(_0x4609('0x13'));var db=require(_0x4609('0x14'))['db'];config[_0x4609('0x15')]=_[_0x4609('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4609('0x17'))(new Redis(config['redis']));require(_0x4609('0x18'))[_0x4609('0x19')](socket);function respondWithStatusCode(_0x5abeea,_0xf95f63){_0xf95f63=_0xf95f63||0xcc;return function(_0x5a3504){if(_0x5a3504){return _0x5abeea['sendStatus'](_0xf95f63);}return _0x5abeea['status'](_0xf95f63)[_0x4609('0x1a')]();};}function respondWithResult(_0x4ece24,_0x265559){_0x265559=_0x265559||0xc8;return function(_0x4bcc48){if(_0x4bcc48){return _0x4ece24['status'](_0x265559)[_0x4609('0x1b')](_0x4bcc48);}};}function respondWithFilteredResult(_0x2ef5d0,_0x4de7de){return function(_0x12b8fd){if(_0x12b8fd){var _0x16fc6c=typeof _0x4de7de[_0x4609('0x1c')]==='undefined'&&typeof _0x4de7de['limit']===_0x4609('0x1d');var _0x341e44=_0x12b8fd[_0x4609('0x1e')];var _0x197a17=_0x16fc6c?0x0:_0x4de7de[_0x4609('0x1c')];var _0x11750b=_0x16fc6c?_0x12b8fd['count']:_0x4de7de[_0x4609('0x1c')]+_0x4de7de['limit'];var _0x2c629f;if(_0x11750b>=_0x341e44){_0x11750b=_0x341e44;_0x2c629f=0xc8;}else{_0x2c629f=0xce;}_0x2ef5d0[_0x4609('0x1f')](_0x2c629f);return _0x2ef5d0[_0x4609('0x20')](_0x4609('0x21'),_0x197a17+'-'+_0x11750b+'/'+_0x341e44)['json'](_0x12b8fd);}return null;};}function patchUpdates(_0x1bf49a){return function(_0x4ed612){try{jsonpatch[_0x4609('0x22')](_0x4ed612,_0x1bf49a,!![]);}catch(_0x3693d0){return BPromise['reject'](_0x3693d0);}return _0x4ed612['save']();};}function saveUpdates(_0xd0c8dc,_0x33b165){return function(_0xb128c8){if(_0xb128c8){return _0xb128c8[_0x4609('0x23')](_0xd0c8dc)['then'](function(_0x14f4cd){return _0x14f4cd;});}return null;};}function removeEntity(_0x1a9d9a,_0x1ba973){return function(_0x4c8a2c){if(_0x4c8a2c){return _0x4c8a2c[_0x4609('0x24')]()[_0x4609('0x25')](function(){_0x1a9d9a[_0x4609('0x1f')](0xcc)[_0x4609('0x1a')]();});}};}function handleEntityNotFound(_0x3ccfc0,_0x5153d4){return function(_0x554437){if(!_0x554437){_0x3ccfc0[_0x4609('0x26')](0x194);}return _0x554437;};}function handleError(_0x44b6fd,_0x48837f){_0x48837f=_0x48837f||0x1f4;return function(_0x48459f){logger[_0x4609('0x27')](_0x48459f[_0x4609('0x28')]);if(_0x48459f[_0x4609('0x29')]){delete _0x48459f[_0x4609('0x29')];}_0x44b6fd[_0x4609('0x1f')](_0x48837f)[_0x4609('0x2a')](_0x48459f);};}function getInteractionUsers(_0x50b168,_0x753ccd){return new BPromise(function(_0x360fe2,_0x394d44){try{if(_0x753ccd[_0x50b168['id']]){_0x50b168['Users']=_[_0x4609('0x2b')](_0x753ccd[_0x50b168['id']],function(_0x1bafdc){return{'id':_0x1bafdc['id'],'fullname':_0x1bafdc[_0x4609('0x2c')]};});}}catch(_0x41d6fd){_0x394d44(_0x41d6fd);}_0x360fe2(_0x50b168);});}function getInteractionTags(_0x339c0a,_0x56881c){return new BPromise(function(_0x4c7176,_0x1d3e20){try{if(_0x339c0a['TagIds']){_0x339c0a[_0x4609('0x2d')]=[];_0x339c0a[_0x4609('0x2e')]['split'](',')[_0x4609('0x2f')](function(_0x520c61){_0x339c0a['Tags'][_0x4609('0x30')](_0x56881c[_0x520c61]);});}delete _0x339c0a[_0x4609('0x2e')];}catch(_0x2e6ef8){_0x1d3e20(_0x2e6ef8);}_0x4c7176(_0x339c0a);});}function updateFaxInteraction(_0x4c3772,_0x430189,_0x1e71fb){return new BPromise(function(_0x382d6f,_0x2ac82e){return getInteractionUsers(_0x4c3772,_0x1e71fb)['then'](function(_0x5765fa){return getInteractionTags(_0x5765fa,_0x430189);})['then'](function(_0xf29dcb){return getStateInteraction(_0xf29dcb);})[_0x4609('0x25')](function(_0x5a08ca){_0x382d6f(_0x5a08ca);})[_0x4609('0x31')](function(_0x3ec92b){_0x2ac82e(_0x3ec92b);});});}function getStateInteraction(_0xd69a63){return new BPromise(function(_0x4e1a6e){_0xd69a63['waiting']=0x0;_0xd69a63[_0x4609('0x32')]=0x0;_0xd69a63[_0x4609('0x33')]=0x0;_0xd69a63[_0x4609('0x34')]=0x0;_0xd69a63['total']=0x0;if(!_0xd69a63[_0x4609('0x35')]&&!_0xd69a63[_0x4609('0x36')]){_0xd69a63[_0x4609('0x37')]+=0x1;}if(!_0xd69a63['closed']&&_0xd69a63['UserId']){_0xd69a63[_0x4609('0x32')]+=0x1;if(_0xd69a63[_0x4609('0x37')]){_0xd69a63[_0x4609('0x37')]-=0x1;}}if(_0xd69a63[_0x4609('0x35')]&&_0xd69a63[_0x4609('0x36')]){_0xd69a63['answered']+=0x1;if(_0xd69a63['talking']){_0xd69a63['talking']-=0x1;}}if(_0xd69a63[_0x4609('0x35')]&&!_0xd69a63[_0x4609('0x36')]){_0xd69a63[_0x4609('0x34')]+=0x1;if(_0xd69a63[_0x4609('0x37')]){_0xd69a63[_0x4609('0x37')]-=0x1;}}_0xd69a63[_0x4609('0x38')]+=0x1;_0x4e1a6e(_0xd69a63);});}exports[_0x4609('0x39')]=function(_0x1f7de4,_0xa3d7e){var _0xce0df={},_0x3062c0={},_0x5080f1={'count':0x0,'rows':[]};var _0x272998=_[_0x4609('0x2b')](db[_0x4609('0x3a')]['rawAttributes'],function(_0xc62967){return{'name':_0xc62967[_0x4609('0x3b')],'type':_0xc62967[_0x4609('0x3c')][_0x4609('0x3d')]};});_0x3062c0[_0x4609('0x3e')]=_[_0x4609('0x2b')](_0x272998,_0x4609('0x29'));_0x3062c0[_0x4609('0x3f')]=_['keys'](_0x1f7de4[_0x4609('0x3f')]);_0x3062c0[_0x4609('0x40')]=_[_0x4609('0x41')](_0x3062c0[_0x4609('0x3e')],_0x3062c0[_0x4609('0x3f')]);_0xce0df[_0x4609('0x42')]=_[_0x4609('0x41')](_0x3062c0[_0x4609('0x3e')],qs['fields'](_0x1f7de4[_0x4609('0x3f')][_0x4609('0x43')]));_0xce0df[_0x4609('0x42')]=_0xce0df[_0x4609('0x42')]['length']?_0xce0df[_0x4609('0x42')]:_0x3062c0[_0x4609('0x3e')];if(!_0x1f7de4[_0x4609('0x3f')][_0x4609('0x44')]('nolimit')){_0xce0df[_0x4609('0x45')]=qs['limit'](_0x1f7de4[_0x4609('0x3f')][_0x4609('0x45')]);_0xce0df['offset']=qs[_0x4609('0x1c')](_0x1f7de4[_0x4609('0x3f')]['offset']);}_0xce0df[_0x4609('0x46')]=qs[_0x4609('0x47')](_0x1f7de4[_0x4609('0x3f')][_0x4609('0x47')]);_0xce0df[_0x4609('0x48')]=qs[_0x4609('0x40')](_[_0x4609('0x49')](_0x1f7de4[_0x4609('0x3f')],_0x3062c0[_0x4609('0x40')]),_0x272998);var _0x59b92d=[];var _0x25dedc=squel['select']()[_0x4609('0x4a')]('id')[_0x4609('0x4a')]('name')[_0x4609('0x4a')](_0x4609('0x4b'))[_0x4609('0x4c')]('tools_tags');var _0x3b5ebc=squel[_0x4609('0x4d')]()[_0x4609('0x4a')](_0x4609('0x4e'))[_0x4609('0x4a')]('u.fullname')[_0x4609('0x4a')](_0x4609('0x4f'))[_0x4609('0x4c')]('user_has_fax_interactions','ui')[_0x4609('0x50')](_0x4609('0x51'),'u',_0x4609('0x52'));var _0x27b1dc=squel[_0x4609('0x4d')]()[_0x4609('0x4c')](_0x4609('0x53'),'i')['left_join'](_0x4609('0x54'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4609('0x50')](_0x4609('0x51'),'o',_0x4609('0x55'))[_0x4609('0x50')](_0x4609('0x56'),'a',_0x4609('0x57'))[_0x4609('0x50')](_0x4609('0x58'),'me',_0x4609('0x59'))[_0x4609('0x50')](_0x4609('0x5a'),'it',_0x4609('0x5b'))[_0x4609('0x50')]('tools_tags','t',_0x4609('0x5c'));var _0x19aa84=squel[_0x4609('0x5d')]();var _0x27c71f=[];var _0x287cc2=squel[_0x4609('0x5d')]();var _0x5321d2;if(_0x1f7de4['query']['search']){_0x5321d2=as[_0x4609('0x5e')](_0x1f7de4['query'][_0x4609('0x5f')]);var _0x2560c5=_0x5321d2[_0x4609('0x60')];for(var _0x5c1e16=0x0;_0x5c1e16<_0x5321d2[_0x4609('0x61')][_0x4609('0x62')];_0x5c1e16++){var _0x5ce6d6=_0x5321d2[_0x4609('0x61')][_0x5c1e16];var _0x5b9c3d='i';var _0x54d1f8=_['find'](_0x272998,[_0x4609('0x29'),_0x5ce6d6[_0x4609('0x4a')]]);if(!_0x54d1f8){switch(_0x5ce6d6['field']){case _0x4609('0x63'):if(_0x5ce6d6[_0x4609('0x64')]==0x1){_0x27b1dc['having']('`'+_0x5ce6d6[_0x4609('0x4a')]+_0x4609('0x65'));}else{_0x27b1dc[_0x4609('0x66')]('`'+_0x5ce6d6[_0x4609('0x4a')]+_0x4609('0x67'));}break;case'Contact':if(_0x5ce6d6[_0x4609('0x68')]===_0x4609('0x69')){if(_0x5ce6d6[_0x4609('0x64')]['split']('\x20')['length']>0x1){_0x19aa84[_0x2560c5](_0x4609('0x6a'),qs['getFullTextValue'](_0x5ce6d6[_0x4609('0x64')]),null);}else{var _0x308de0='%'+_0x5ce6d6[_0x4609('0x64')]+'%';_0x19aa84[_0x2560c5](_0x4609('0x6b'),_0x308de0,_0x308de0,_0x308de0);}}else{_0x54d1f8=_['find'](_0x272998,[_0x4609('0x29'),_0x4609('0x6c')]);_0x5ce6d6[_0x4609('0x4a')]=_0x4609('0x6c');_0x2b6a78=as['buildExpression'](_0x5b9c3d,_0x54d1f8['type'],_0x5ce6d6);_0x19aa84[_0x2560c5](_0x2b6a78['text'],_0x2b6a78[_0x4609('0x64')][_0x4609('0x6d')],_0x2b6a78[_0x4609('0x64')][_0x4609('0x1a')]);}break;case _0x4609('0x6e'):var _0x269f56=_0x5ce6d6['value'][_0x4609('0x6f')](',')[_0x4609('0x2b')](function(_0x18c675){return Number(_0x18c675);});_0x269f56[_0x4609('0x2f')](function(_0x54b5da){_0x287cc2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x54b5da+',%');});_0x27c71f=_[_0x4609('0x70')](_0x27c71f,_0x269f56);break;case _0x4609('0x71'):if(_0x5ce6d6[_0x4609('0x68')]===_0x4609('0x69')){_0x19aa84[_0x2560c5](_0x4609('0x72'),'%'+_0x5ce6d6[_0x4609('0x64')]+'%',null);}else{_0x54d1f8=_[_0x4609('0x73')](_0x272998,[_0x4609('0x29'),_0x4609('0x36')]);_0x5ce6d6[_0x4609('0x4a')]=_0x4609('0x36');_0x2b6a78=as[_0x4609('0x74')](_0x5b9c3d,_0x54d1f8[_0x4609('0x3c')],_0x5ce6d6);_0x19aa84[_0x2560c5](_0x2b6a78['text'],_0x2b6a78[_0x4609('0x64')][_0x4609('0x6d')],_0x2b6a78[_0x4609('0x64')][_0x4609('0x1a')]);}break;case _0x4609('0x75'):_0x2b6a78=as[_0x4609('0x74')]('me',null,_0x5ce6d6);_0x19aa84[_0x2560c5](_0x2b6a78[_0x4609('0x76')],_0x2b6a78[_0x4609('0x64')][_0x4609('0x6d')],_0x2b6a78[_0x4609('0x64')][_0x4609('0x1a')]);break;}}else{var _0x2b6a78=as[_0x4609('0x74')](_0x5b9c3d,_0x54d1f8[_0x4609('0x3c')],_0x5ce6d6);_0x19aa84[_0x2560c5](_0x2b6a78[_0x4609('0x76')],_0x2b6a78[_0x4609('0x64')]['start'],_0x2b6a78['value'][_0x4609('0x1a')]);}}}else{var _0x5d39c5=_(_0x1f7de4[_0x4609('0x3f')])[_0x4609('0x77')]()[_0x4609('0x2b')](function(_0x35e4b1){return _[_0x4609('0x78')](_0x272998,[_0x4609('0x29'),_0x35e4b1])?_0x35e4b1:undefined;})[_0x4609('0x79')]()[_0x4609('0x64')]();if(!_[_0x4609('0x7a')](_0x5d39c5)){_0x5d39c5[_0x4609('0x2f')](function(_0x5db624){if(_0x5db624===_0x4609('0x7b')){_0x27b1dc[_0x4609('0x48')](_0x4609('0x7c'),[][_0x4609('0x7d')](_0x1f7de4[_0x4609('0x3f')][_0x5db624]));}else if(_0x5db624===_0x4609('0x7e')){var _0x4c4c65=JSON[_0x4609('0x7f')](_0x1f7de4[_0x4609('0x3f')][_0x5db624])[_0x4609('0x80')];var _0x13fb02=JSON['parse'](_0x1f7de4[_0x4609('0x3f')][_0x5db624])[_0x4609('0x81')];_0x27b1dc[_0x4609('0x48')](_0x4609('0x82'),_0x4c4c65,_0x13fb02);}else{if(_0x1f7de4[_0x4609('0x3f')][_0x5db624]===_0x4609('0x83')){_0x27b1dc[_0x4609('0x48')]('i.'+_0x5db624+_0x4609('0x84'));}else{_0x27b1dc['where']('i.'+_0x5db624+_0x4609('0x85'),_0x1f7de4[_0x4609('0x3f')][_0x5db624]);}}});}if(_0x1f7de4[_0x4609('0x3f')][_0x4609('0x86')]){if(_0x1f7de4[_0x4609('0x3f')][_0x4609('0x86')]==0x1){_0x27b1dc[_0x4609('0x66')](_0x4609('0x87'));}else{_0x27b1dc[_0x4609('0x66')](_0x4609('0x88'));}}if(_0x1f7de4[_0x4609('0x3f')][_0x4609('0x89')]){_0x27c71f=_['isArray'](_0x1f7de4[_0x4609('0x3f')][_0x4609('0x89')])?_0x1f7de4[_0x4609('0x3f')]['tag']:new Array(_0x1f7de4[_0x4609('0x3f')]['tag']);_0x27c71f[_0x4609('0x2f')](function(_0x31118d){_0x287cc2['or'](_0x4609('0x8a'),'%,'+_0x31118d+',%');});}if(_0x1f7de4[_0x4609('0x3f')][_0x4609('0x8b')]){var _0x136f8b=_0x1f7de4[_0x4609('0x3f')][_0x4609('0x8b')][_0x4609('0x8c')]('\x5c','\x5c\x5c')[_0x4609('0x8c')](/'/g,'\x27\x27');if(qs[_0x4609('0x8d')](_0x136f8b)){_0x19aa84['or'](_0x4609('0x8e'),_0x136f8b+'%')['or'](_0x4609('0x8f'),_0x136f8b+'%');}_0x19aa84['or'](_0x4609('0x90'),_0x136f8b+'%');}}_0x27b1dc['where'](_0x19aa84);_0x27b1dc[_0x4609('0x91')](_0x4609('0x92'));var _0x4ae972={'type':db[_0x4609('0x93')][_0x4609('0x94')][_0x4609('0x95')],'raw':!![]};var _0x1a4017=_0x27b1dc[_0x4609('0x96')]();_0x1a4017[_0x4609('0x4a')](_0x4609('0x92'));_0x1a4017[_0x4609('0x4a')](_0x4609('0x97'),_0x4609('0x63'));if(_0xce0df[_0x4609('0x46')]){_0xce0df['order'][_0x4609('0x2f')](function(_0xdea3c8){var _0x2f678c=_0xdea3c8[0x0]===_0x4609('0x98')?_0xdea3c8[0x0]:'i.'+_0xdea3c8[0x0];_0x27b1dc['order'](_0x2f678c,_0xdea3c8[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4609('0x7a')](_0x27c71f)){_0x27b1dc[_0x4609('0x66')](_0x287cc2);_0x1a4017['where'](_0x4609('0x99'),_0x27c71f);}BPromise[_0x4609('0x9a')]()[_0x4609('0x25')](function(){if(!_0x5321d2){if(_0x1f7de4[_0x4609('0x3f')][_0x4609('0x7b')])return;_0x1a4017[_0x4609('0x48')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x27b1dc['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1f7de4[_0x4609('0x9b')][_0x4609('0x9c')]!=='agent')return;return _0x1f7de4[_0x4609('0x9b')][_0x4609('0x9d')]({'attributes':['id'],'raw':!![]})[_0x4609('0x25')](function(_0x482f51){if(_[_0x4609('0x7a')](_0x482f51)){_0x1a4017[_0x4609('0x48')](_0x4609('0x9e'));_0x27b1dc['where'](_0x4609('0x9e'));}else{_0x1a4017[_0x4609('0x48')](_0x4609('0x7c'),_['map'](_0x482f51,'id'));_0x27b1dc[_0x4609('0x48')](_0x4609('0x7c'),_[_0x4609('0x2b')](_0x482f51,'id'));}});})[_0x4609('0x25')](function(){if(_0x1f7de4[_0x4609('0x9b')][_0x4609('0x9c')]===_0x4609('0x9f')&&!_0x5321d2&&!_0x1f7de4[_0x4609('0x3f')][_0x4609('0x7b')])return[];return db['sequelize']['query'](_0x1a4017[_0x4609('0xa0')](),_0x4ae972);})[_0x4609('0x25')](function(_0x3274f5){_0x5080f1[_0x4609('0x1e')]=_0x3274f5[_0x4609('0x62')];if(_0x5080f1['count']===0x0)return[];return db[_0x4609('0xa1')]['query'](_0x25dedc['toString'](),_0x4ae972)['then'](function(_0x25365b){_0x59b92d=_[_0x4609('0xa2')](_0x25365b,'id');_0x4ae972=_[_0x4609('0xa3')](_0x4ae972,{'model':db[_0x4609('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f7de4[_0x4609('0x3f')]['fields']){_0xce0df['attributes'][_0x4609('0x2f')](function(_0x15461e){_0x27b1dc[_0x4609('0x4a')]('i.'+_0x15461e);});}else{_0x27b1dc['field'](_0x4609('0x97'),'unreadMessages');_0x27b1dc[_0x4609('0x4a')](_0x4609('0xa4'),_0x4609('0xa5'));_0x27b1dc[_0x4609('0x4a')](_0x4609('0xa6'),_0x4609('0xa7'));_0x27b1dc[_0x4609('0x4a')](_0x4609('0xa8'),_0x4609('0x98'));_0x27b1dc[_0x4609('0x4a')](_0x4609('0xa9'));_0x27b1dc[_0x4609('0x4a')]('c.firstName',_0x4609('0xaa'));_0x27b1dc[_0x4609('0x4a')](_0x4609('0xab'),_0x4609('0xac'));_0x27b1dc[_0x4609('0x4a')]('c.email',_0x4609('0xad'));_0x27b1dc[_0x4609('0x4a')](_0x4609('0xae'),_0x4609('0xaf'));_0x27b1dc['field']('c.mobile',_0x4609('0xb0'));_0x27b1dc[_0x4609('0x4a')]('c.fax',_0x4609('0xb1'));_0x27b1dc[_0x4609('0x4a')](_0x4609('0xb2'),_0x4609('0xb3'));_0x27b1dc[_0x4609('0x4a')](_0x4609('0xb4'),_0x4609('0xb5'));_0x27b1dc[_0x4609('0x4a')](_0x4609('0xb6'),_0x4609('0x2e'));}if(_0xce0df['limit'])_0x27b1dc[_0x4609('0x45')](_0xce0df[_0x4609('0x45')]);if(_0xce0df['offset'])_0x27b1dc[_0x4609('0x1c')](_0xce0df[_0x4609('0x1c')]);return db[_0x4609('0xa1')][_0x4609('0x3f')](_0x27b1dc[_0x4609('0xa0')](),_0x4ae972);})[_0x4609('0x25')](function(_0x26f863){if(_0x26f863[_0x4609('0x62')]>0x0)_0x3b5ebc[_0x4609('0x48')]('ui.FaxInteractionId\x20IN\x20?',_[_0x4609('0x2b')](_0x26f863,'id'));return db[_0x4609('0xa1')]['query'](_0x3b5ebc['toString'](),_0x4ae972)[_0x4609('0x25')](function(_0x19d8ad){var _0x5dd1e4=_[_0x4609('0xb7')](_0x19d8ad,'FaxInteractionId');var _0x47fc3a=[];_0x26f863[_0x4609('0x2f')](function(_0xbfbca6){_0x47fc3a[_0x4609('0x30')](updateFaxInteraction(_0xbfbca6,_0x59b92d,_0x5dd1e4));});return BPromise['all'](_0x47fc3a);});});})[_0x4609('0x25')](function(_0x1f2243){_0x5080f1['rows']=_0x1f2243;return _0x5080f1;})[_0x4609('0x25')](respondWithFilteredResult(_0xa3d7e,_0xce0df))['catch'](handleError(_0xa3d7e,null));};exports[_0x4609('0xb8')]=function(_0x22ee8b,_0xaa63e3){var _0x33bee8={'raw':![],'where':{'id':_0x22ee8b[_0x4609('0xb9')]['id']}},_0x28506f={};_0x28506f['model']=_['keys'](db[_0x4609('0x3a')][_0x4609('0xba')]);_0x28506f[_0x4609('0x3f')]=_[_0x4609('0x77')](_0x22ee8b['query']);_0x28506f[_0x4609('0x40')]=_[_0x4609('0x41')](_0x28506f[_0x4609('0x3e')],_0x28506f['query']);_0x33bee8['attributes']=_[_0x4609('0x41')](_0x28506f[_0x4609('0x3e')],qs[_0x4609('0x43')](_0x22ee8b[_0x4609('0x3f')][_0x4609('0x43')]));_0x33bee8[_0x4609('0x42')]=_0x33bee8[_0x4609('0x42')]['length']?_0x33bee8[_0x4609('0x42')]:_0x28506f[_0x4609('0x3e')];if(_0x22ee8b[_0x4609('0x3f')][_0x4609('0xbb')]){_0x33bee8[_0x4609('0xbc')]=[{'all':!![]}];}_0x33bee8=_[_0x4609('0xa3')]({},_0x33bee8,_0x22ee8b[_0x4609('0xbd')]);return db['FaxInteraction'][_0x4609('0x73')](_0x33bee8)['then'](handleEntityNotFound(_0xaa63e3,null))['then'](respondWithResult(_0xaa63e3,null))[_0x4609('0x31')](handleError(_0xaa63e3,null));};exports[_0x4609('0xbe')]=function(_0x26a854,_0x347e82){return db[_0x4609('0x3a')][_0x4609('0xbe')](_0x26a854[_0x4609('0x75')],{})[_0x4609('0x25')](respondWithResult(_0x347e82,0xc9))[_0x4609('0x31')](handleError(_0x347e82,null));};exports[_0x4609('0x23')]=function(_0x35f6ca,_0x16a09a){if(_0x35f6ca[_0x4609('0x75')]['id']){delete _0x35f6ca[_0x4609('0x75')]['id'];}return db['FaxInteraction'][_0x4609('0x73')]({'where':{'id':_0x35f6ca[_0x4609('0xb9')]['id']}})[_0x4609('0x25')](handleEntityNotFound(_0x16a09a,null))[_0x4609('0x25')](saveUpdates(_0x35f6ca['body'],null))[_0x4609('0x25')](respondWithResult(_0x16a09a,null))[_0x4609('0x31')](handleError(_0x16a09a,null));};exports[_0x4609('0x24')]=function(_0x110396,_0x331ab6){return db[_0x4609('0x3a')][_0x4609('0x73')]({'where':{'id':_0x110396[_0x4609('0xb9')]['id']}})[_0x4609('0x25')](handleEntityNotFound(_0x331ab6,null))[_0x4609('0x25')](removeEntity(_0x331ab6,null))[_0x4609('0x31')](handleError(_0x331ab6,null));};exports[_0x4609('0xbf')]=function(_0x630d4a,_0x50ff58){return db[_0x4609('0x3a')]['describe']()[_0x4609('0x25')](respondWithResult(_0x50ff58,null))[_0x4609('0x31')](handleError(_0x50ff58,null));};exports[_0x4609('0xc0')]=function(_0x355c5f,_0x24021d,_0x5c47ba){return db[_0x4609('0xc1')][_0x4609('0x73')]({'where':{'id':_0x355c5f[_0x4609('0xb9')]['id']}})['then'](handleEntityNotFound(_0x24021d,null))[_0x4609('0x25')](function(_0x187d53){if(_0x187d53){return _0x187d53[_0x4609('0xc0')](_0x355c5f[_0x4609('0x75')]['ids'],_[_0x4609('0xc2')](_0x355c5f[_0x4609('0x75')],['ids','id'])||{});}})['then'](respondWithResult(_0x24021d,null))['catch'](handleError(_0x24021d,null));};exports['getMessages']=function(_0x508da5,_0x5ef4e4,_0x56ce1e){var _0x45550d={'raw':![],'where':{}};var _0x20d046={};var _0x112eb7={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x4609('0xc3')]({'where':{'id':_0x508da5[_0x4609('0xb9')]['id']}})[_0x4609('0x25')](handleEntityNotFound(_0x5ef4e4,null))[_0x4609('0x25')](function(_0x371e66){if(_0x371e66){_0x20d046['model']=_[_0x4609('0x77')](db[_0x4609('0xc1')]['rawAttributes']);_0x20d046[_0x4609('0x3f')]=_[_0x4609('0x77')](_0x508da5[_0x4609('0x3f')]);_0x20d046['filters']=_[_0x4609('0x41')](_0x20d046['model'],_0x20d046['query']);_0x45550d[_0x4609('0x42')]=_['intersection'](_0x20d046[_0x4609('0x3e')],qs[_0x4609('0x43')](_0x508da5[_0x4609('0x3f')][_0x4609('0x43')]));_0x45550d['attributes']=_0x45550d['attributes']['length']?_0x45550d['attributes']:_0x20d046[_0x4609('0x3e')];if(!_0x508da5[_0x4609('0x3f')][_0x4609('0x44')](_0x4609('0xc4'))){_0x45550d['limit']=qs['limit'](_0x508da5[_0x4609('0x3f')][_0x4609('0x45')]);_0x45550d['offset']=qs[_0x4609('0x1c')](_0x508da5[_0x4609('0x3f')][_0x4609('0x1c')]);}_0x45550d[_0x4609('0x46')]=qs[_0x4609('0x47')](_0x508da5['query'][_0x4609('0x47')]);_0x45550d[_0x4609('0x48')]=qs['filters'](_[_0x4609('0x49')](_0x508da5[_0x4609('0x3f')],_0x20d046[_0x4609('0x40')]));_0x45550d[_0x4609('0x48')][_0x4609('0xc5')]=_0x371e66['id'];if(_0x508da5[_0x4609('0x3f')][_0x4609('0x8b')]){_0x45550d[_0x4609('0x48')]=_[_0x4609('0xa3')](_0x45550d[_0x4609('0x48')],{'$or':_[_0x4609('0x2b')](_0x45550d[_0x4609('0x42')],function(_0xe2c39a){var _0x3970d2={};_0x3970d2[_0xe2c39a]={'$like':'%'+_0x508da5[_0x4609('0x3f')][_0x4609('0x8b')]+'%'};return _0x3970d2;})});}if(_0x508da5[_0x4609('0x3f')]['$gte']){var _0x154c4c=_0x508da5[_0x4609('0x3f')][_0x4609('0x80')][_0x4609('0x6f')](',');var _0x1457be={};_0x1457be[_0x154c4c[0x0]]={'$gte':moment(_0x154c4c[0x1])[_0x4609('0xc6')](_0x4609('0xc7'))};_0x45550d[_0x4609('0x48')]=_['merge'](_0x45550d['where'],_0x1457be);}_0x45550d=_[_0x4609('0xa3')]({},_0x45550d,_0x508da5[_0x4609('0xbd')]);return db[_0x4609('0xc1')][_0x4609('0x1e')]({'where':_0x45550d['where']})[_0x4609('0x25')](function(_0x2039c0){_0x112eb7['count']=_0x2039c0;if(_0x508da5[_0x4609('0x3f')][_0x4609('0xbb')]){_0x45550d[_0x4609('0xbc')]=[{'all':!![]}];}return db[_0x4609('0xc1')][_0x4609('0xc8')](_0x45550d);})[_0x4609('0x25')](function(_0x15b16e){_0x112eb7[_0x4609('0xc9')]=_0x15b16e;return _0x112eb7;});}})[_0x4609('0x25')](respondWithFilteredResult(_0x5ef4e4,_0x45550d))[_0x4609('0x31')](handleError(_0x5ef4e4,null));};exports[_0x4609('0xca')]=function(_0x12ae9d,_0x2bd1f5,_0x3c9f7a){return db[_0x4609('0x3a')][_0x4609('0x73')]({'where':{'id':_0x12ae9d[_0x4609('0xb9')]['id']}})[_0x4609('0x25')](handleEntityNotFound(_0x2bd1f5,null))['then'](function(_0x406bb0){if(_0x406bb0){return _0x406bb0['setTags'](_0x12ae9d[_0x4609('0x75')][_0x4609('0xcb')],_['omit'](_0x12ae9d[_0x4609('0x75')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x4609('0xc8')]({'attributes':['id',_0x4609('0x29'),_0x4609('0x4b')],'where':{'id':_0x12ae9d[_0x4609('0x75')]['ids']}});})['then'](function(_0x29cab3){socket[_0x4609('0xcc')](_0x4609('0xcd'),{'id':Number(_0x12ae9d[_0x4609('0xb9')]['id']),'tags':_0x29cab3||[]});return{'id':Number(_0x12ae9d['params']['id']),'tags':_0x29cab3||[]};});}})['then'](respondWithResult(_0x2bd1f5,null))[_0x4609('0x31')](handleError(_0x2bd1f5,null));};exports['removeTags']=function(_0xd799b9,_0xf24913,_0x97f394){return db[_0x4609('0x3a')]['find']({'where':{'id':_0xd799b9[_0x4609('0xb9')]['id']}})[_0x4609('0x25')](handleEntityNotFound(_0xf24913,null))[_0x4609('0x25')](function(_0x8ee9dd){if(_0x8ee9dd){return _0x8ee9dd['removeTags'](_0xd799b9[_0x4609('0x3f')][_0x4609('0xcb')]);}})[_0x4609('0x25')](respondWithStatusCode(_0xf24913,null))[_0x4609('0x31')](handleError(_0xf24913,null));};exports[_0x4609('0xce')]=function(_0x3b6510,_0x3da4c2){var _0x257eea=moment()['unix']()[_0x4609('0xa0')]();var _0x2fed1c=path[_0x4609('0xcf')](config['root'],_0x4609('0xd0'),_0x4609('0xd1'),'tmp');var _0x3df137=path[_0x4609('0xcf')](config['root'],_0x4609('0xd0'),_0x4609('0xd1'),_0x4609('0xd2'));var _0x2f6191=path[_0x4609('0xcf')](_0x2fed1c,_0x257eea);var _0x33b74c=util['format'](_0x4609('0xd3'),_0x3b6510[_0x4609('0xb9')]['id'],_0x257eea);var _0x1f8133=path['join'](_0x2fed1c,_0x33b74c);var _0x417b2d=[];_0x417b2d['push']({'model':db[_0x4609('0xd4')],'as':_0x4609('0xd4'),'raw':!![]});var _0x18a19e=[{'model':db[_0x4609('0xc1')],'as':_0x4609('0xd5'),'attributes':['id',_0x4609('0x75'),_0x4609('0x7e')],'include':_0x417b2d}];return db[_0x4609('0x3a')][_0x4609('0x73')]({'where':{'id':_0x3b6510[_0x4609('0xb9')]['id']},'include':_0x18a19e})[_0x4609('0x25')](handleEntityNotFound(_0x3da4c2,null))[_0x4609('0x25')](function(_0x35541d){if(_0x35541d&&_0x35541d['Messages']){var _0x6159a7=_0x35541d[_0x4609('0xd6')]({'plain':!![]});fs[_0x4609('0xd7')](_0x2f6191);for(var _0x16eacc=0x0;_0x16eacc<_0x6159a7[_0x4609('0xd5')][_0x4609('0x62')];_0x16eacc++){var _0x38c3df=_0x6159a7[_0x4609('0xd5')][_0x16eacc][_0x4609('0xd4')];if(_0x38c3df){var _0x3c693a=path['join'](_0x3df137,_0x38c3df[_0x4609('0xd8')]);if(fs[_0x4609('0xd9')](_0x3c693a)){fs['createReadStream'](_0x3c693a)[_0x4609('0xda')](fs[_0x4609('0xdb')](path[_0x4609('0xcf')](_0x2f6191,_0x38c3df[_0x4609('0xd8')])));}}}return BPromise[_0x4609('0x9a')]()[_0x4609('0x25')](function(){return new BPromise(function(_0x58f70a,_0x911585){zipdir(_0x2f6191,{'saveTo':_0x1f8133},function(_0x130e36,_0x303d9c){if(_0x130e36)return _0x911585(_0x130e36);return _0x58f70a(_0x303d9c);});})['then'](function(){return new BPromise(function(_0x26b082,_0x5b4c61){rimraf(_0x2f6191,function(_0x4ba4e8){if(_0x4ba4e8)_0x5b4c61(_0x4ba4e8);return _0x26b082();});});})[_0x4609('0x25')](function(){return _0x3da4c2[_0x4609('0xce')](_0x1f8133,_0x33b74c,function(_0x19c8c6){if(_0x19c8c6){console[_0x4609('0xdc')](_0x4609('0xdd'),_0x19c8c6);}else{fs[_0x4609('0xde')](_0x1f8133);}});});});}else{return _0x3da4c2[_0x4609('0x26')](0xc8);}})['catch'](handleError(_0x3da4c2,null));};
\ No newline at end of file
+var _0xdfac=['omit','getMessages','rawAttributes','nolimit','$gte','format','findAll','rows','spread','Tag','color','emit','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','basename','createReadStream','pipe','createWriteStream','log','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','name','send','Users','map','fullname','Tags','TagIds','forEach','push','then','catch','talking','answered','unmanaged','total','closed','UserId','waiting','index','FaxInteraction','type','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick','select','field','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','$substring','value','split','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','buildExpression','some','compact','isEmpty','FaxAccountId','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','show','params','includeAll','include','options','create','destroy','describe','addMessage','FaxMessage','ids'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xdfac,0x1da));var _0xcdfa=function(_0xf94131,_0x58b63d){_0xf94131=_0xf94131-0x0;var _0xdf5c19=_0xdfac[_0xf94131];return _0xdf5c19;};'use strict';var emlformat=require(_0xcdfa('0x0'));var rimraf=require(_0xcdfa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcdfa('0x2'));var rp=require(_0xcdfa('0x3'));var moment=require(_0xcdfa('0x4'));var BPromise=require(_0xcdfa('0x5'));var Mustache=require(_0xcdfa('0x6'));var util=require(_0xcdfa('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcdfa('0x8'));var fs=require('fs');var fs_extra=require(_0xcdfa('0x9'));var _=require(_0xcdfa('0xa'));var squel=require('squel');var crypto=require(_0xcdfa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcdfa('0xc'));var toCsv=require(_0xcdfa('0xd'));var querystring=require(_0xcdfa('0xe'));var Papa=require('papaparse');var Redis=require(_0xcdfa('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcdfa('0x10'));var as=require(_0xcdfa('0x11'));var hardwareService=require(_0xcdfa('0x12'));var logger=require(_0xcdfa('0x13'))(_0xcdfa('0x14'));var utils=require(_0xcdfa('0x15'));var config=require(_0xcdfa('0x16'));var licenseUtil=require(_0xcdfa('0x17'));var db=require(_0xcdfa('0x18'))['db'];config['redis']=_[_0xcdfa('0x19')](config[_0xcdfa('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xcdfa('0x1b'))(new Redis(config['redis']));require(_0xcdfa('0x1c'))[_0xcdfa('0x1d')](socket);function respondWithStatusCode(_0x47f698,_0x245c57){_0x245c57=_0x245c57||0xcc;return function(_0x5945e3){if(_0x5945e3){return _0x47f698[_0xcdfa('0x1e')](_0x245c57);}return _0x47f698['status'](_0x245c57)[_0xcdfa('0x1f')]();};}function respondWithResult(_0xfdaadc,_0x22385a){_0x22385a=_0x22385a||0xc8;return function(_0x3c898e){if(_0x3c898e){return _0xfdaadc[_0xcdfa('0x20')](_0x22385a)[_0xcdfa('0x21')](_0x3c898e);}};}function respondWithFilteredResult(_0xdeffa0,_0x33062a){return function(_0x9c8364){if(_0x9c8364){var _0x4b9eb4=typeof _0x33062a[_0xcdfa('0x22')]===_0xcdfa('0x23')&&typeof _0x33062a[_0xcdfa('0x24')]===_0xcdfa('0x23');var _0x23d9c3=_0x9c8364[_0xcdfa('0x25')];var _0x352cad=_0x4b9eb4?0x0:_0x33062a['offset'];var _0x20770b=_0x4b9eb4?_0x9c8364[_0xcdfa('0x25')]:_0x33062a[_0xcdfa('0x22')]+_0x33062a[_0xcdfa('0x24')];var _0x50d4e1;if(_0x20770b>=_0x23d9c3){_0x20770b=_0x23d9c3;_0x50d4e1=0xc8;}else{_0x50d4e1=0xce;}_0xdeffa0['status'](_0x50d4e1);return _0xdeffa0[_0xcdfa('0x26')](_0xcdfa('0x27'),_0x352cad+'-'+_0x20770b+'/'+_0x23d9c3)[_0xcdfa('0x21')](_0x9c8364);}return null;};}function patchUpdates(_0x361135){return function(_0x26238c){try{jsonpatch['apply'](_0x26238c,_0x361135,!![]);}catch(_0x553685){return BPromise[_0xcdfa('0x28')](_0x553685);}return _0x26238c['save']();};}function saveUpdates(_0x387d33,_0x2d186a){return function(_0x3d4652){if(_0x3d4652){return _0x3d4652[_0xcdfa('0x29')](_0x387d33)['then'](function(_0x14a91a){return _0x14a91a;});}return null;};}function removeEntity(_0x3cc8fa,_0x11d734){return function(_0x653fdc){if(_0x653fdc){return _0x653fdc['destroy']()['then'](function(){_0x3cc8fa[_0xcdfa('0x20')](0xcc)[_0xcdfa('0x1f')]();});}};}function handleEntityNotFound(_0x19e4a7,_0xe1244d){return function(_0x320c45){if(!_0x320c45){_0x19e4a7[_0xcdfa('0x1e')](0x194);}return _0x320c45;};}function handleError(_0x48ed7e,_0x1882f3){_0x1882f3=_0x1882f3||0x1f4;return function(_0x58985e){logger['error'](_0x58985e['stack']);if(_0x58985e[_0xcdfa('0x2a')]){delete _0x58985e[_0xcdfa('0x2a')];}_0x48ed7e[_0xcdfa('0x20')](_0x1882f3)[_0xcdfa('0x2b')](_0x58985e);};}function getInteractionUsers(_0x5dabd3,_0x5220cd){return new BPromise(function(_0x1e3fc9,_0x2a4796){try{if(_0x5220cd[_0x5dabd3['id']]){_0x5dabd3[_0xcdfa('0x2c')]=_[_0xcdfa('0x2d')](_0x5220cd[_0x5dabd3['id']],function(_0xf751f8){return{'id':_0xf751f8['id'],'fullname':_0xf751f8[_0xcdfa('0x2e')]};});}}catch(_0x2ccdc4){_0x2a4796(_0x2ccdc4);}_0x1e3fc9(_0x5dabd3);});}function getInteractionTags(_0x3edd01,_0x5986fa){return new BPromise(function(_0x20949a,_0x10a80e){try{if(_0x3edd01['TagIds']){_0x3edd01[_0xcdfa('0x2f')]=[];_0x3edd01[_0xcdfa('0x30')]['split'](',')[_0xcdfa('0x31')](function(_0x3c8f15){_0x3edd01[_0xcdfa('0x2f')][_0xcdfa('0x32')](_0x5986fa[_0x3c8f15]);});}delete _0x3edd01['TagIds'];}catch(_0x4e2072){_0x10a80e(_0x4e2072);}_0x20949a(_0x3edd01);});}function updateFaxInteraction(_0x260c8f,_0x1e1764,_0x52b296){return new BPromise(function(_0x210216,_0x5af58b){return getInteractionUsers(_0x260c8f,_0x52b296)[_0xcdfa('0x33')](function(_0x21f2c3){return getInteractionTags(_0x21f2c3,_0x1e1764);})[_0xcdfa('0x33')](function(_0xc047ec){return getStateInteraction(_0xc047ec);})[_0xcdfa('0x33')](function(_0x4c54ba){_0x210216(_0x4c54ba);})[_0xcdfa('0x34')](function(_0x189a92){_0x5af58b(_0x189a92);});});}function getStateInteraction(_0x10bac4){return new BPromise(function(_0x103b31){_0x10bac4['waiting']=0x0;_0x10bac4[_0xcdfa('0x35')]=0x0;_0x10bac4[_0xcdfa('0x36')]=0x0;_0x10bac4[_0xcdfa('0x37')]=0x0;_0x10bac4[_0xcdfa('0x38')]=0x0;if(!_0x10bac4[_0xcdfa('0x39')]&&!_0x10bac4[_0xcdfa('0x3a')]){_0x10bac4[_0xcdfa('0x3b')]+=0x1;}if(!_0x10bac4[_0xcdfa('0x39')]&&_0x10bac4[_0xcdfa('0x3a')]){_0x10bac4[_0xcdfa('0x35')]+=0x1;if(_0x10bac4['waiting']){_0x10bac4['waiting']-=0x1;}}if(_0x10bac4['closed']&&_0x10bac4[_0xcdfa('0x3a')]){_0x10bac4[_0xcdfa('0x36')]+=0x1;if(_0x10bac4[_0xcdfa('0x35')]){_0x10bac4[_0xcdfa('0x35')]-=0x1;}}if(_0x10bac4['closed']&&!_0x10bac4['UserId']){_0x10bac4[_0xcdfa('0x37')]+=0x1;if(_0x10bac4[_0xcdfa('0x3b')]){_0x10bac4[_0xcdfa('0x3b')]-=0x1;}}_0x10bac4[_0xcdfa('0x38')]+=0x1;_0x103b31(_0x10bac4);});}exports[_0xcdfa('0x3c')]=function(_0x3207b5,_0x56c5f2){var _0x47b26c={},_0x556984={},_0x222d3e={'count':0x0,'rows':[]};var _0x3603b0=_[_0xcdfa('0x2d')](db[_0xcdfa('0x3d')]['rawAttributes'],function(_0x25b1f1){return{'name':_0x25b1f1['fieldName'],'type':_0x25b1f1[_0xcdfa('0x3e')]['key']};});_0x556984['model']=_[_0xcdfa('0x2d')](_0x3603b0,_0xcdfa('0x2a'));_0x556984[_0xcdfa('0x3f')]=_[_0xcdfa('0x40')](_0x3207b5[_0xcdfa('0x3f')]);_0x556984['filters']=_[_0xcdfa('0x41')](_0x556984[_0xcdfa('0x42')],_0x556984[_0xcdfa('0x3f')]);_0x47b26c[_0xcdfa('0x43')]=_[_0xcdfa('0x41')](_0x556984[_0xcdfa('0x42')],qs['fields'](_0x3207b5['query'][_0xcdfa('0x44')]));_0x47b26c[_0xcdfa('0x43')]=_0x47b26c['attributes'][_0xcdfa('0x45')]?_0x47b26c[_0xcdfa('0x43')]:_0x556984['model'];if(!_0x3207b5[_0xcdfa('0x3f')]['hasOwnProperty']('nolimit')){_0x47b26c[_0xcdfa('0x24')]=qs[_0xcdfa('0x24')](_0x3207b5['query'][_0xcdfa('0x24')]);_0x47b26c[_0xcdfa('0x22')]=qs[_0xcdfa('0x22')](_0x3207b5[_0xcdfa('0x3f')][_0xcdfa('0x22')]);}_0x47b26c[_0xcdfa('0x46')]=qs[_0xcdfa('0x47')](_0x3207b5[_0xcdfa('0x3f')][_0xcdfa('0x47')]);_0x47b26c[_0xcdfa('0x48')]=qs[_0xcdfa('0x49')](_[_0xcdfa('0x4a')](_0x3207b5[_0xcdfa('0x3f')],_0x556984[_0xcdfa('0x49')]),_0x3603b0);var _0x2288e5=[];var _0x4a6f22=squel[_0xcdfa('0x4b')]()['field']('id')[_0xcdfa('0x4c')](_0xcdfa('0x2a'))[_0xcdfa('0x4c')]('color')[_0xcdfa('0x4d')]('tools_tags');var _0x49567b=squel[_0xcdfa('0x4b')]()[_0xcdfa('0x4c')](_0xcdfa('0x4e'))[_0xcdfa('0x4c')](_0xcdfa('0x4f'))[_0xcdfa('0x4c')](_0xcdfa('0x50'))[_0xcdfa('0x4d')](_0xcdfa('0x51'),'ui')['left_join'](_0xcdfa('0x52'),'u',_0xcdfa('0x53'));var _0x40aca1=squel[_0xcdfa('0x4b')]()['from']('fax_interactions','i')['left_join'](_0xcdfa('0x54'),'c',_0xcdfa('0x55'))[_0xcdfa('0x56')](_0xcdfa('0x52'),'o','o.id\x20=\x20i.UserId')[_0xcdfa('0x56')](_0xcdfa('0x57'),'a',_0xcdfa('0x58'))[_0xcdfa('0x56')](_0xcdfa('0x59'),'me',_0xcdfa('0x5a'))['left_join'](_0xcdfa('0x5b'),'it',_0xcdfa('0x5c'))[_0xcdfa('0x56')](_0xcdfa('0x5d'),'t',_0xcdfa('0x5e'));var _0x276fd5=squel[_0xcdfa('0x5f')]();var _0x4e9c42=[];var _0x1da3ae=squel[_0xcdfa('0x5f')]();var _0x613ef8;if(_0x3207b5[_0xcdfa('0x3f')]['search']){_0x613ef8=as[_0xcdfa('0x60')](_0x3207b5['query'][_0xcdfa('0x61')]);var _0x35a7bf=_0x613ef8[_0xcdfa('0x62')];for(var _0x2d2408=0x0;_0x2d2408<_0x613ef8[_0xcdfa('0x63')][_0xcdfa('0x45')];_0x2d2408++){var _0x429606=_0x613ef8['conditions'][_0x2d2408];var _0x44b2e9='i';var _0x47a1a5=_[_0xcdfa('0x64')](_0x3603b0,[_0xcdfa('0x2a'),_0x429606[_0xcdfa('0x4c')]]);if(!_0x47a1a5){switch(_0x429606['field']){case _0xcdfa('0x65'):if(_0x429606['value']==0x1){_0x40aca1['having']('`'+_0x429606[_0xcdfa('0x4c')]+_0xcdfa('0x66'));}else{_0x40aca1[_0xcdfa('0x67')]('`'+_0x429606[_0xcdfa('0x4c')]+_0xcdfa('0x68'));}break;case _0xcdfa('0x69'):if(_0x429606['operator']===_0xcdfa('0x6a')){if(_0x429606[_0xcdfa('0x6b')][_0xcdfa('0x6c')]('\x20')[_0xcdfa('0x45')]>0x1){_0x276fd5[_0x35a7bf]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x429606[_0xcdfa('0x6b')]),null);}else{var _0x3d4b2f='%'+_0x429606[_0xcdfa('0x6b')]+'%';_0x276fd5[_0x35a7bf]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3d4b2f,_0x3d4b2f,_0x3d4b2f);}}else{_0x47a1a5=_[_0xcdfa('0x64')](_0x3603b0,['name',_0xcdfa('0x6d')]);_0x429606[_0xcdfa('0x4c')]=_0xcdfa('0x6d');_0x38d00d=as['buildExpression'](_0x44b2e9,_0x47a1a5[_0xcdfa('0x3e')],_0x429606);_0x276fd5[_0x35a7bf](_0x38d00d[_0xcdfa('0x6e')],_0x38d00d[_0xcdfa('0x6b')][_0xcdfa('0x6f')],_0x38d00d[_0xcdfa('0x6b')]['end']);}break;case'Tag':var _0x41d75d=_0x429606[_0xcdfa('0x6b')][_0xcdfa('0x6c')](',')[_0xcdfa('0x2d')](function(_0x40e7cf){return Number(_0x40e7cf);});_0x41d75d[_0xcdfa('0x31')](function(_0x451cdb){_0x1da3ae['or'](_0xcdfa('0x70'),'%,'+_0x451cdb+',%');});_0x4e9c42=_[_0xcdfa('0x71')](_0x4e9c42,_0x41d75d);break;case _0xcdfa('0x72'):if(_0x429606['operator']===_0xcdfa('0x6a')){_0x276fd5[_0x35a7bf](_0xcdfa('0x73'),'%'+_0x429606[_0xcdfa('0x6b')]+'%',null);}else{_0x47a1a5=_[_0xcdfa('0x64')](_0x3603b0,[_0xcdfa('0x2a'),_0xcdfa('0x3a')]);_0x429606['field']=_0xcdfa('0x3a');_0x38d00d=as['buildExpression'](_0x44b2e9,_0x47a1a5[_0xcdfa('0x3e')],_0x429606);_0x276fd5[_0x35a7bf](_0x38d00d[_0xcdfa('0x6e')],_0x38d00d[_0xcdfa('0x6b')][_0xcdfa('0x6f')],_0x38d00d[_0xcdfa('0x6b')][_0xcdfa('0x1f')]);}break;case _0xcdfa('0x74'):_0x38d00d=as['buildExpression']('me',null,_0x429606);_0x276fd5[_0x35a7bf](_0x38d00d[_0xcdfa('0x6e')],_0x38d00d[_0xcdfa('0x6b')][_0xcdfa('0x6f')],_0x38d00d[_0xcdfa('0x6b')][_0xcdfa('0x1f')]);break;}}else{var _0x38d00d=as[_0xcdfa('0x75')](_0x44b2e9,_0x47a1a5['type'],_0x429606);_0x276fd5[_0x35a7bf](_0x38d00d[_0xcdfa('0x6e')],_0x38d00d[_0xcdfa('0x6b')][_0xcdfa('0x6f')],_0x38d00d[_0xcdfa('0x6b')]['end']);}}}else{var _0x33f8a8=_(_0x3207b5[_0xcdfa('0x3f')])[_0xcdfa('0x40')]()[_0xcdfa('0x2d')](function(_0x4d985a){return _[_0xcdfa('0x76')](_0x3603b0,[_0xcdfa('0x2a'),_0x4d985a])?_0x4d985a:undefined;})[_0xcdfa('0x77')]()[_0xcdfa('0x6b')]();if(!_[_0xcdfa('0x78')](_0x33f8a8)){_0x33f8a8[_0xcdfa('0x31')](function(_0x463959){if(_0x463959===_0xcdfa('0x79')){_0x40aca1['where']('i.FaxAccountId\x20IN\x20?',[][_0xcdfa('0x7a')](_0x3207b5['query'][_0x463959]));}else if(_0x463959===_0xcdfa('0x7b')){var _0x28b71e=JSON[_0xcdfa('0x7c')](_0x3207b5[_0xcdfa('0x3f')][_0x463959])['$gte'];var _0x546f1d=JSON['parse'](_0x3207b5[_0xcdfa('0x3f')][_0x463959])['$lte'];_0x40aca1[_0xcdfa('0x48')](_0xcdfa('0x7d'),_0x28b71e,_0x546f1d);}else{if(_0x3207b5['query'][_0x463959]==='null'){_0x40aca1[_0xcdfa('0x48')]('i.'+_0x463959+_0xcdfa('0x7e'));}else{_0x40aca1[_0xcdfa('0x48')]('i.'+_0x463959+_0xcdfa('0x7f'),_0x3207b5[_0xcdfa('0x3f')][_0x463959]);}}});}if(_0x3207b5[_0xcdfa('0x3f')][_0xcdfa('0x80')]){if(_0x3207b5[_0xcdfa('0x3f')]['read']==0x1){_0x40aca1['having'](_0xcdfa('0x81'));}else{_0x40aca1['having'](_0xcdfa('0x82'));}}if(_0x3207b5['query']['tag']){_0x4e9c42=_[_0xcdfa('0x83')](_0x3207b5[_0xcdfa('0x3f')][_0xcdfa('0x84')])?_0x3207b5[_0xcdfa('0x3f')][_0xcdfa('0x84')]:new Array(_0x3207b5[_0xcdfa('0x3f')][_0xcdfa('0x84')]);_0x4e9c42[_0xcdfa('0x31')](function(_0x52b4e4){_0x1da3ae['or'](_0xcdfa('0x70'),'%,'+_0x52b4e4+',%');});}if(_0x3207b5['query'][_0xcdfa('0x85')]){var _0x50ad63=_0x3207b5['query'][_0xcdfa('0x85')][_0xcdfa('0x86')]('\x5c','\x5c\x5c')[_0xcdfa('0x86')](/'/g,'\x27\x27');if(qs[_0xcdfa('0x87')](_0x50ad63)){_0x276fd5['or'](_0xcdfa('0x88'),_0x50ad63+'%')['or'](_0xcdfa('0x89'),_0x50ad63+'%');}_0x276fd5['or'](_0xcdfa('0x8a'),_0x50ad63+'%');}}_0x40aca1[_0xcdfa('0x48')](_0x276fd5);_0x40aca1['group'](_0xcdfa('0x8b'));var _0x39bbff={'type':db[_0xcdfa('0x8c')]['QueryTypes']['SELECT'],'raw':!![]};var _0x250518=_0x40aca1[_0xcdfa('0x8d')]();_0x250518[_0xcdfa('0x4c')](_0xcdfa('0x8b'));_0x250518[_0xcdfa('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xcdfa('0x65'));if(_0x47b26c[_0xcdfa('0x46')]){_0x47b26c[_0xcdfa('0x46')][_0xcdfa('0x31')](function(_0x157bcb){var _0x5bb408=_0x157bcb[0x0]===_0xcdfa('0x8e')?_0x157bcb[0x0]:'i.'+_0x157bcb[0x0];_0x40aca1[_0xcdfa('0x46')](_0x5bb408,_0x157bcb[0x1]===_0xcdfa('0x8f')?![]:!![]);});}if(!_[_0xcdfa('0x78')](_0x4e9c42)){_0x40aca1['having'](_0x1da3ae);_0x250518[_0xcdfa('0x48')](_0xcdfa('0x90'),_0x4e9c42);}BPromise[_0xcdfa('0x91')]()['then'](function(){if(!_0x613ef8){if(_0x3207b5[_0xcdfa('0x3f')][_0xcdfa('0x79')])return;_0x250518[_0xcdfa('0x48')](_0xcdfa('0x92'));_0x40aca1[_0xcdfa('0x48')](_0xcdfa('0x92'));return;}if(_0x3207b5[_0xcdfa('0x93')][_0xcdfa('0x94')]!==_0xcdfa('0x95'))return;return _0x3207b5[_0xcdfa('0x93')][_0xcdfa('0x96')]({'attributes':['id'],'raw':!![]})[_0xcdfa('0x33')](function(_0x2708e5){if(_['isEmpty'](_0x2708e5)){_0x250518['where'](_0xcdfa('0x97'));_0x40aca1['where'](_0xcdfa('0x97'));}else{_0x250518[_0xcdfa('0x48')](_0xcdfa('0x98'),_[_0xcdfa('0x2d')](_0x2708e5,'id'));_0x40aca1[_0xcdfa('0x48')](_0xcdfa('0x98'),_['map'](_0x2708e5,'id'));}});})['then'](function(){if(_0x3207b5['user'][_0xcdfa('0x94')]===_0xcdfa('0x95')&&!_0x613ef8&&!_0x3207b5[_0xcdfa('0x3f')][_0xcdfa('0x79')])return[];return db[_0xcdfa('0x99')][_0xcdfa('0x3f')](_0x250518[_0xcdfa('0x9a')](),_0x39bbff);})[_0xcdfa('0x33')](function(_0x17a69d){_0x222d3e['count']=_0x17a69d[_0xcdfa('0x45')];if(_0x222d3e[_0xcdfa('0x25')]===0x0)return[];return db[_0xcdfa('0x99')][_0xcdfa('0x3f')](_0x4a6f22[_0xcdfa('0x9a')](),_0x39bbff)[_0xcdfa('0x33')](function(_0x1529a5){_0x2288e5=_[_0xcdfa('0x9b')](_0x1529a5,'id');_0x39bbff=_[_0xcdfa('0x9c')](_0x39bbff,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3207b5[_0xcdfa('0x3f')]['fields']){_0x47b26c['attributes'][_0xcdfa('0x31')](function(_0x20c2f9){_0x40aca1[_0xcdfa('0x4c')]('i.'+_0x20c2f9);});}else{_0x40aca1[_0xcdfa('0x4c')](_0xcdfa('0x9d'),_0xcdfa('0x65'));_0x40aca1[_0xcdfa('0x4c')](_0xcdfa('0x9e'),_0xcdfa('0x9f'));_0x40aca1[_0xcdfa('0x4c')](_0xcdfa('0xa0'),_0xcdfa('0xa1'));_0x40aca1[_0xcdfa('0x4c')](_0xcdfa('0xa2'),_0xcdfa('0x8e'));_0x40aca1['field'](_0xcdfa('0xa3'));_0x40aca1['field']('c.firstName',_0xcdfa('0xa4'));_0x40aca1[_0xcdfa('0x4c')](_0xcdfa('0xa5'),_0xcdfa('0xa6'));_0x40aca1['field'](_0xcdfa('0xa7'),_0xcdfa('0xa8'));_0x40aca1[_0xcdfa('0x4c')](_0xcdfa('0xa9'),_0xcdfa('0xaa'));_0x40aca1[_0xcdfa('0x4c')](_0xcdfa('0xab'),_0xcdfa('0xac'));_0x40aca1[_0xcdfa('0x4c')]('c.fax','Contact.fax');_0x40aca1[_0xcdfa('0x4c')](_0xcdfa('0xad'),_0xcdfa('0xae'));_0x40aca1[_0xcdfa('0x4c')](_0xcdfa('0xaf'),_0xcdfa('0xb0'));_0x40aca1[_0xcdfa('0x4c')](_0xcdfa('0xb1'),'TagIds');}if(_0x47b26c['limit'])_0x40aca1['limit'](_0x47b26c[_0xcdfa('0x24')]);if(_0x47b26c[_0xcdfa('0x22')])_0x40aca1[_0xcdfa('0x22')](_0x47b26c[_0xcdfa('0x22')]);return db['sequelize'][_0xcdfa('0x3f')](_0x40aca1[_0xcdfa('0x9a')](),_0x39bbff);})[_0xcdfa('0x33')](function(_0x547d){if(_0x547d[_0xcdfa('0x45')]>0x0)_0x49567b['where']('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x547d,'id'));return db[_0xcdfa('0x99')][_0xcdfa('0x3f')](_0x49567b[_0xcdfa('0x9a')](),_0x39bbff)[_0xcdfa('0x33')](function(_0x2e9a7d){var _0x440fe3=_[_0xcdfa('0xb2')](_0x2e9a7d,_0xcdfa('0xb3'));var _0x61304a=[];_0x547d[_0xcdfa('0x31')](function(_0x54da2b){_0x61304a[_0xcdfa('0x32')](updateFaxInteraction(_0x54da2b,_0x2288e5,_0x440fe3));});return BPromise[_0xcdfa('0xb4')](_0x61304a);});});})[_0xcdfa('0x33')](function(_0xa3282e){_0x222d3e['rows']=_0xa3282e;return _0x222d3e;})[_0xcdfa('0x33')](respondWithFilteredResult(_0x56c5f2,_0x47b26c))[_0xcdfa('0x34')](handleError(_0x56c5f2,null));};exports[_0xcdfa('0xb5')]=function(_0x5a9ff1,_0x27d650){var _0x4df55d={'raw':![],'where':{'id':_0x5a9ff1[_0xcdfa('0xb6')]['id']}},_0x4b3226={};_0x4b3226[_0xcdfa('0x42')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x4b3226[_0xcdfa('0x3f')]=_[_0xcdfa('0x40')](_0x5a9ff1['query']);_0x4b3226[_0xcdfa('0x49')]=_[_0xcdfa('0x41')](_0x4b3226['model'],_0x4b3226[_0xcdfa('0x3f')]);_0x4df55d[_0xcdfa('0x43')]=_[_0xcdfa('0x41')](_0x4b3226['model'],qs[_0xcdfa('0x44')](_0x5a9ff1[_0xcdfa('0x3f')][_0xcdfa('0x44')]));_0x4df55d[_0xcdfa('0x43')]=_0x4df55d['attributes'][_0xcdfa('0x45')]?_0x4df55d['attributes']:_0x4b3226['model'];if(_0x5a9ff1[_0xcdfa('0x3f')][_0xcdfa('0xb7')]){_0x4df55d[_0xcdfa('0xb8')]=[{'all':!![]}];}_0x4df55d=_[_0xcdfa('0x9c')]({},_0x4df55d,_0x5a9ff1[_0xcdfa('0xb9')]);return db[_0xcdfa('0x3d')]['find'](_0x4df55d)['then'](handleEntityNotFound(_0x27d650,null))[_0xcdfa('0x33')](respondWithResult(_0x27d650,null))['catch'](handleError(_0x27d650,null));};exports['create']=function(_0x606d01,_0x485202){return db[_0xcdfa('0x3d')][_0xcdfa('0xba')](_0x606d01[_0xcdfa('0x74')],{})['then'](respondWithResult(_0x485202,0xc9))[_0xcdfa('0x34')](handleError(_0x485202,null));};exports[_0xcdfa('0x29')]=function(_0x25e4c5,_0x522b83){if(_0x25e4c5[_0xcdfa('0x74')]['id']){delete _0x25e4c5[_0xcdfa('0x74')]['id'];}return db[_0xcdfa('0x3d')][_0xcdfa('0x64')]({'where':{'id':_0x25e4c5[_0xcdfa('0xb6')]['id']}})['then'](handleEntityNotFound(_0x522b83,null))[_0xcdfa('0x33')](saveUpdates(_0x25e4c5[_0xcdfa('0x74')],null))[_0xcdfa('0x33')](respondWithResult(_0x522b83,null))['catch'](handleError(_0x522b83,null));};exports[_0xcdfa('0xbb')]=function(_0x1f4d01,_0x2f92ed){return db['FaxInteraction']['find']({'where':{'id':_0x1f4d01[_0xcdfa('0xb6')]['id']}})['then'](handleEntityNotFound(_0x2f92ed,null))['then'](removeEntity(_0x2f92ed,null))[_0xcdfa('0x34')](handleError(_0x2f92ed,null));};exports[_0xcdfa('0xbc')]=function(_0x272cd5,_0x5bab00){return db[_0xcdfa('0x3d')][_0xcdfa('0xbc')]()['then'](respondWithResult(_0x5bab00,null))[_0xcdfa('0x34')](handleError(_0x5bab00,null));};exports[_0xcdfa('0xbd')]=function(_0x14cdb7,_0x5560f5,_0x62cca3){return db[_0xcdfa('0xbe')][_0xcdfa('0x64')]({'where':{'id':_0x14cdb7[_0xcdfa('0xb6')]['id']}})[_0xcdfa('0x33')](handleEntityNotFound(_0x5560f5,null))[_0xcdfa('0x33')](function(_0x2eb9fc){if(_0x2eb9fc){return _0x2eb9fc[_0xcdfa('0xbd')](_0x14cdb7[_0xcdfa('0x74')][_0xcdfa('0xbf')],_[_0xcdfa('0xc0')](_0x14cdb7[_0xcdfa('0x74')],[_0xcdfa('0xbf'),'id'])||{});}})[_0xcdfa('0x33')](respondWithResult(_0x5560f5,null))[_0xcdfa('0x34')](handleError(_0x5560f5,null));};exports[_0xcdfa('0xc1')]=function(_0x5b39ab,_0x3fb184,_0x3d9c7d){var _0xa3aba1={'raw':![],'where':{}};var _0x53b541={};var _0x48029d={'count':0x0,'rows':[]};return db[_0xcdfa('0x3d')]['findOne']({'where':{'id':_0x5b39ab[_0xcdfa('0xb6')]['id']}})[_0xcdfa('0x33')](handleEntityNotFound(_0x3fb184,null))[_0xcdfa('0x33')](function(_0x5493d7){if(_0x5493d7){_0x53b541['model']=_[_0xcdfa('0x40')](db[_0xcdfa('0xbe')][_0xcdfa('0xc2')]);_0x53b541[_0xcdfa('0x3f')]=_[_0xcdfa('0x40')](_0x5b39ab[_0xcdfa('0x3f')]);_0x53b541[_0xcdfa('0x49')]=_[_0xcdfa('0x41')](_0x53b541[_0xcdfa('0x42')],_0x53b541[_0xcdfa('0x3f')]);_0xa3aba1[_0xcdfa('0x43')]=_[_0xcdfa('0x41')](_0x53b541[_0xcdfa('0x42')],qs[_0xcdfa('0x44')](_0x5b39ab['query'][_0xcdfa('0x44')]));_0xa3aba1[_0xcdfa('0x43')]=_0xa3aba1[_0xcdfa('0x43')][_0xcdfa('0x45')]?_0xa3aba1[_0xcdfa('0x43')]:_0x53b541['model'];if(!_0x5b39ab[_0xcdfa('0x3f')]['hasOwnProperty'](_0xcdfa('0xc3'))){_0xa3aba1[_0xcdfa('0x24')]=qs[_0xcdfa('0x24')](_0x5b39ab[_0xcdfa('0x3f')][_0xcdfa('0x24')]);_0xa3aba1[_0xcdfa('0x22')]=qs[_0xcdfa('0x22')](_0x5b39ab[_0xcdfa('0x3f')]['offset']);}_0xa3aba1[_0xcdfa('0x46')]=qs['sort'](_0x5b39ab[_0xcdfa('0x3f')][_0xcdfa('0x47')]);_0xa3aba1[_0xcdfa('0x48')]=qs[_0xcdfa('0x49')](_['pick'](_0x5b39ab['query'],_0x53b541[_0xcdfa('0x49')]));_0xa3aba1[_0xcdfa('0x48')][_0xcdfa('0xb3')]=_0x5493d7['id'];if(_0x5b39ab['query'][_0xcdfa('0x85')]){_0xa3aba1[_0xcdfa('0x48')]=_['merge'](_0xa3aba1['where'],{'$or':_[_0xcdfa('0x2d')](_0xa3aba1[_0xcdfa('0x43')],function(_0x559748){var _0x12c279={};_0x12c279[_0x559748]={'$like':'%'+_0x5b39ab[_0xcdfa('0x3f')][_0xcdfa('0x85')]+'%'};return _0x12c279;})});}if(_0x5b39ab[_0xcdfa('0x3f')]['$gte']){var _0x40afdd=_0x5b39ab[_0xcdfa('0x3f')][_0xcdfa('0xc4')]['split'](',');var _0x46e93e={};_0x46e93e[_0x40afdd[0x0]]={'$gte':moment(_0x40afdd[0x1])[_0xcdfa('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')};_0xa3aba1[_0xcdfa('0x48')]=_['merge'](_0xa3aba1[_0xcdfa('0x48')],_0x46e93e);}_0xa3aba1=_['merge']({},_0xa3aba1,_0x5b39ab[_0xcdfa('0xb9')]);return db['FaxMessage'][_0xcdfa('0x25')]({'where':_0xa3aba1['where']})[_0xcdfa('0x33')](function(_0x284052){_0x48029d[_0xcdfa('0x25')]=_0x284052;if(_0x5b39ab[_0xcdfa('0x3f')][_0xcdfa('0xb7')]){_0xa3aba1[_0xcdfa('0xb8')]=[{'all':!![]}];}return db[_0xcdfa('0xbe')][_0xcdfa('0xc6')](_0xa3aba1);})[_0xcdfa('0x33')](function(_0x36d230){_0x48029d[_0xcdfa('0xc7')]=_0x36d230;return _0x48029d;});}})['then'](respondWithFilteredResult(_0x3fb184,_0xa3aba1))[_0xcdfa('0x34')](handleError(_0x3fb184,null));};exports['addTags']=function(_0x3c21a8,_0x776ea7,_0x4d558e){return db[_0xcdfa('0x3d')][_0xcdfa('0x64')]({'where':{'id':_0x3c21a8[_0xcdfa('0xb6')]['id']}})['then'](handleEntityNotFound(_0x776ea7,null))[_0xcdfa('0x33')](function(_0x498eaf){if(_0x498eaf){return _0x498eaf['setTags'](_0x3c21a8[_0xcdfa('0x74')][_0xcdfa('0xbf')],_[_0xcdfa('0xc0')](_0x3c21a8[_0xcdfa('0x74')],['ids','id'])||{})[_0xcdfa('0xc8')](function(){return db[_0xcdfa('0xc9')][_0xcdfa('0xc6')]({'attributes':['id',_0xcdfa('0x2a'),_0xcdfa('0xca')],'where':{'id':_0x3c21a8[_0xcdfa('0x74')][_0xcdfa('0xbf')]}});})[_0xcdfa('0x33')](function(_0x283540){socket[_0xcdfa('0xcb')]('faxInteractionTags:save',{'id':Number(_0x3c21a8['params']['id']),'tags':_0x283540||[]});return{'id':Number(_0x3c21a8['params']['id']),'tags':_0x283540||[]};});}})['then'](respondWithResult(_0x776ea7,null))[_0xcdfa('0x34')](handleError(_0x776ea7,null));};exports[_0xcdfa('0xcc')]=function(_0x2bc4a3,_0x20b613,_0x5b906d){return db[_0xcdfa('0x3d')][_0xcdfa('0x64')]({'where':{'id':_0x2bc4a3[_0xcdfa('0xb6')]['id']}})['then'](handleEntityNotFound(_0x20b613,null))[_0xcdfa('0x33')](function(_0x1936ac){if(_0x1936ac){return _0x1936ac['removeTags'](_0x2bc4a3[_0xcdfa('0x3f')]['ids']);}})[_0xcdfa('0x33')](respondWithStatusCode(_0x20b613,null))['catch'](handleError(_0x20b613,null));};exports[_0xcdfa('0xcd')]=function(_0x35b614,_0x1d30e4){var _0x37df4a=moment()['unix']()[_0xcdfa('0x9a')]();var _0x2c6e8a=path[_0xcdfa('0xce')](config[_0xcdfa('0xcf')],_0xcdfa('0xd0'),_0xcdfa('0xd1'),_0xcdfa('0xd2'));var _0x196f9a=path['join'](config['root'],_0xcdfa('0xd0'),_0xcdfa('0xd1'),_0xcdfa('0xd3'));var _0x272e5c=path[_0xcdfa('0xce')](_0x2c6e8a,_0x37df4a);var _0x56573c=util[_0xcdfa('0xc5')](_0xcdfa('0xd4'),_0x35b614[_0xcdfa('0xb6')]['id'],_0x37df4a);var _0x30ca1a=path['join'](_0x2c6e8a,_0x56573c);var _0x4389da=[];_0x4389da['push']({'model':db[_0xcdfa('0xd5')],'as':_0xcdfa('0xd5'),'raw':!![]});var _0x1f33f7=[{'model':db[_0xcdfa('0xbe')],'as':_0xcdfa('0xd6'),'attributes':['id','body',_0xcdfa('0x7b')],'include':_0x4389da}];return db[_0xcdfa('0x3d')][_0xcdfa('0x64')]({'where':{'id':_0x35b614[_0xcdfa('0xb6')]['id']},'include':_0x1f33f7})['then'](handleEntityNotFound(_0x1d30e4,null))[_0xcdfa('0x33')](function(_0x5a636e){if(_0x5a636e&&_0x5a636e['Messages']){var _0x4396d2=_0x5a636e[_0xcdfa('0xd7')]({'plain':!![]});fs['mkdirSync'](_0x272e5c);for(var _0xb684f5=0x0;_0xb684f5<_0x4396d2[_0xcdfa('0xd6')]['length'];_0xb684f5++){var _0x2d2e4e=_0x4396d2['Messages'][_0xb684f5]['Attachment'];if(_0x2d2e4e){var _0x2019a1=path[_0xcdfa('0xce')](_0x196f9a,_0x2d2e4e[_0xcdfa('0xd8')]);if(fs['existsSync'](_0x2019a1)){fs[_0xcdfa('0xd9')](_0x2019a1)[_0xcdfa('0xda')](fs[_0xcdfa('0xdb')](path[_0xcdfa('0xce')](_0x272e5c,_0x2d2e4e['basename'])));}}}return BPromise[_0xcdfa('0x91')]()[_0xcdfa('0x33')](function(){return new BPromise(function(_0x34b28e,_0x2a93ad){zipdir(_0x272e5c,{'saveTo':_0x30ca1a},function(_0x559b9b,_0x39f2de){if(_0x559b9b)return _0x2a93ad(_0x559b9b);return _0x34b28e(_0x39f2de);});})[_0xcdfa('0x33')](function(){return new BPromise(function(_0x3df413,_0x4e4e57){rimraf(_0x272e5c,function(_0x10bd59){if(_0x10bd59)_0x4e4e57(_0x10bd59);return _0x3df413();});});})[_0xcdfa('0x33')](function(){return _0x1d30e4[_0xcdfa('0xcd')](_0x30ca1a,_0x56573c,function(_0x29cee0){if(_0x29cee0){console[_0xcdfa('0xdc')]('err',_0x29cee0);}else{fs[_0xcdfa('0xdd')](_0x30ca1a);}});});});}else{return _0x1d30e4[_0xcdfa('0x1e')](0xc8);}})[_0xcdfa('0x34')](handleError(_0x1d30e4,null));};
\ No newline at end of file
index 10239d3..11c9899 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xba82=['update','then','setDataValue','map','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','setMaxListeners','save'];(function(_0x4f2994,_0x3f4052){var _0x145625=function(_0x4daf53){while(--_0x4daf53){_0x4f2994['push'](_0x4f2994['shift']());}};_0x145625(++_0x3f4052);}(_0xba82,0x71));var _0x2ba8=function(_0x5964aa,_0x40275b){_0x5964aa=_0x5964aa-0x0;var _0x315ff0=_0xba82[_0x5964aa];return _0x315ff0;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x2ba8('0x0'))['db'][_0x2ba8('0x1')];var FaxMessage=require(_0x2ba8('0x0'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2ba8('0x2')](0x0);var events={'afterCreate':_0x2ba8('0x3'),'afterUpdate':_0x2ba8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c9baa){return function(_0x1deaf0,_0x5a2759,_0x4b7d38){_0x1deaf0['getUsers']({'attributes':['id'],'raw':!![]})[_0x2ba8('0x5')](function(_0x15d2ef){_0x1deaf0[_0x2ba8('0x6')]('Users',_0x15d2ef[_0x2ba8('0x7')](function(_0x3d71bd){return{'id':_0x3d71bd['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x1deaf0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2ba8('0x5')](function(_0x1112e8){_0x1deaf0['setDataValue']('unreadMessages',_0x1112e8['length']);FaxInteractionEvents[_0x2ba8('0x8')](_0x5c9baa+':'+_0x1deaf0['id'],_0x1deaf0);FaxInteractionEvents[_0x2ba8('0x8')](_0x5c9baa,_0x1deaf0);_0x4b7d38(null);})[_0x2ba8('0x9')](_0x4b7d38(null));};}for(var e in events){if(events[_0x2ba8('0xa')](e)){var event=events[e];FaxInteraction[_0x2ba8('0xb')](e,emitEvent(event));}}module[_0x2ba8('0xc')]=FaxInteractionEvents;
\ No newline at end of file
+var _0x812a=['Users','map','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','then'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x812a,0x1dd));var _0xa812=function(_0x3e1803,_0x3c9ba8){_0x3e1803=_0x3e1803-0x0;var _0x496f50=_0x812a[_0x3e1803];return _0x496f50;};'use strict';var EventEmitter=require(_0xa812('0x0'));var FaxInteraction=require(_0xa812('0x1'))['db'][_0xa812('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0xa812('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xa812('0x4')](0x0);var events={'afterCreate':_0xa812('0x5'),'afterUpdate':_0xa812('0x6'),'afterDestroy':_0xa812('0x7')};function emitEvent(_0x49adca){return function(_0x224554,_0x5ce791,_0x88806a){_0x224554['getUsers']({'attributes':['id'],'raw':!![]})[_0xa812('0x8')](function(_0x512558){_0x224554['setDataValue'](_0xa812('0x9'),_0x512558[_0xa812('0xa')](function(_0x348365){return{'id':_0x348365['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x224554['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa812('0x8')](function(_0x4e18e1){_0x224554[_0xa812('0xb')]('unreadMessages',_0x4e18e1[_0xa812('0xc')]);FaxInteractionEvents['emit'](_0x49adca+':'+_0x224554['id'],_0x224554);FaxInteractionEvents[_0xa812('0xd')](_0x49adca,_0x224554);_0x88806a(null);})[_0xa812('0xe')](_0x88806a(null));};}for(var e in events){if(events[_0xa812('0xf')](e)){var event=events[e];FaxInteraction[_0xa812('0x10')](e,emitEvent(event));}}module[_0xa812('0x11')]=FaxInteractionEvents;
\ No newline at end of file
index b5d502a..69bcdee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8165=['closed','closedAt','format','lodash','util','api','moment','request-promise','path','rimraf','./faxInteraction.attributes','define','FaxInteraction','fax_interactions'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x8165,0x1c3));var _0x5816=function(_0x5ad362,_0x3c3033){_0x5ad362=_0x5ad362-0x0;var _0x281e1e=_0x8165[_0x5ad362];return _0x281e1e;};'use strict';var _=require(_0x5816('0x0'));var util=require(_0x5816('0x1'));var logger=require('../../config/logger')(_0x5816('0x2'));var moment=require(_0x5816('0x3'));var BPromise=require('bluebird');var rp=require(_0x5816('0x4'));var fs=require('fs');var path=require(_0x5816('0x5'));var rimraf=require(_0x5816('0x6'));var config=require('../../config/environment');var attributes=require(_0x5816('0x7'));module['exports']=function(_0x367dbd,_0x459879){return _0x367dbd[_0x5816('0x8')](_0x5816('0x9'),attributes,{'tableName':_0x5816('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x234305,_0xee9a93,_0x507f92){if(_0x234305['changed'](_0x5816('0xb'))){_0x234305[_0x5816('0xc')]=moment()[_0x5816('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x507f92(null,_0x234305);}}});};
\ No newline at end of file
+var _0x269b=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','exports','define','FaxInteraction','fax_interactions','changed'];(function(_0x499b83,_0xde81d0){var _0x15d62a=function(_0x3500b5){while(--_0x3500b5){_0x499b83['push'](_0x499b83['shift']());}};_0x15d62a(++_0xde81d0);}(_0x269b,0x9a));var _0xb269=function(_0x27f49f,_0x267fef){_0x27f49f=_0x27f49f-0x0;var _0x33fd6c=_0x269b[_0x27f49f];return _0x33fd6c;};'use strict';var _=require(_0xb269('0x0'));var util=require('util');var logger=require(_0xb269('0x1'))(_0xb269('0x2'));var moment=require(_0xb269('0x3'));var BPromise=require(_0xb269('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb269('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0xb269('0x6')]=function(_0x2398bb,_0x456d40){return _0x2398bb[_0xb269('0x7')](_0xb269('0x8'),attributes,{'tableName':_0xb269('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1572cc,_0x5dbfef,_0x57a954){if(_0x1572cc[_0xb269('0xa')](_0xb269('0xb'))){_0x1572cc[_0xb269('0xc')]=moment()[_0xb269('0xd')](_0xb269('0xe'));}_0x57a954(null,_0x1572cc);}}});};
\ No newline at end of file
index 04733d5..7dc2013 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3337=['limit','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','AddTags','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','UpdateFaxInteraction','update','body','options','raw','where','attributes'];(function(_0x59f3dd,_0x28cb3e){var _0x965af3=function(_0x402dbb){while(--_0x402dbb){_0x59f3dd['push'](_0x59f3dd['shift']());}};_0x965af3(++_0x28cb3e);}(_0x3337,0x11f));var _0x7333=function(_0x224012,_0x293e50){_0x224012=_0x224012-0x0;var _0x544142=_0x3337[_0x224012];return _0x544142;};'use strict';var _=require(_0x7333('0x0'));var util=require('util');var moment=require(_0x7333('0x1'));var BPromise=require(_0x7333('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7333('0x3'));var logger=require(_0x7333('0x4'))(_0x7333('0x5'));var config=require(_0x7333('0x6'));var jayson=require(_0x7333('0x7'));var client=jayson[_0x7333('0x8')][_0x7333('0x9')]({'port':0x232a});config[_0x7333('0xa')]=_[_0x7333('0xb')](config['redis'],{'host':_0x7333('0xc'),'port':0x18eb});var socket=require(_0x7333('0xd'))(new Redis(config[_0x7333('0xa')]));require(_0x7333('0xe'))['register'](socket);function respondWithRpcPromise(_0x41372e,_0x513eae,_0xcac913){return new BPromise(function(_0xf2f383,_0x2c4430){return client[_0x7333('0xf')](_0x41372e,_0xcac913)[_0x7333('0x10')](function(_0x33a7a3){logger['info'](_0x7333('0x11'),_0x513eae,_0x7333('0x12'));logger[_0x7333('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x513eae,_0x7333('0x12'),JSON[_0x7333('0x14')](_0x33a7a3));if(_0x33a7a3[_0x7333('0x15')]){if(_0x33a7a3['error']['code']===0x1f4){logger[_0x7333('0x15')](_0x7333('0x11'),_0x513eae,_0x33a7a3[_0x7333('0x15')]['message']);return _0x2c4430(_0x33a7a3[_0x7333('0x15')][_0x7333('0x16')]);}logger[_0x7333('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x513eae,_0x33a7a3[_0x7333('0x15')]['message']);return _0xf2f383(_0x33a7a3['error']['message']);}else{logger[_0x7333('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x513eae,_0x7333('0x12'));_0xf2f383(_0x33a7a3[_0x7333('0x18')][_0x7333('0x16')]);}})[_0x7333('0x19')](function(_0x25c3be){logger[_0x7333('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x513eae,_0x25c3be);_0x2c4430(_0x25c3be);});});}exports[_0x7333('0x1a')]=function(_0x4fecb7){var _0x2d5029=this;return new Promise(function(_0x488eef,_0x2041a9){return db['FaxInteraction'][_0x7333('0x1b')](_0x4fecb7[_0x7333('0x1c')],{'raw':_0x4fecb7[_0x7333('0x1d')]?_0x4fecb7[_0x7333('0x1d')][_0x7333('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fecb7[_0x7333('0x1d')]?_0x4fecb7['options'][_0x7333('0x1f')]||null:null,'attributes':_0x4fecb7[_0x7333('0x1d')]?_0x4fecb7[_0x7333('0x1d')][_0x7333('0x20')]||null:null,'limit':_0x4fecb7['options']?_0x4fecb7['options'][_0x7333('0x21')]||null:null})['then'](function(_0x473b3d){logger['info'](_0x7333('0x1a'),_0x4fecb7);logger[_0x7333('0x13')](_0x7333('0x1a'),_0x4fecb7,JSON[_0x7333('0x14')](_0x473b3d));_0x488eef(_0x473b3d);})['catch'](function(_0x458cb6){logger[_0x7333('0x15')](_0x7333('0x1a'),_0x458cb6['message'],_0x4fecb7);_0x2041a9(_0x2d5029[_0x7333('0x15')](0x1f4,_0x458cb6[_0x7333('0x16')]));});});};exports[_0x7333('0x22')]=function(_0x84adb6){return new Promise(function(_0x3ce296,_0x4c422f){return db[_0x7333('0x23')][_0x7333('0x24')]({'where':_0x84adb6[_0x7333('0x1d')]?_0x84adb6[_0x7333('0x1d')][_0x7333('0x1f')]||null:null})['then'](function(_0x52c2fb){if(_0x52c2fb){return _0x52c2fb[_0x7333('0x25')](_0x84adb6[_0x7333('0x1c')][_0x7333('0x26')],_['omit'](_0x84adb6['body'],['ids','id'])||{});}})['spread'](function(_0x55aebf){logger['info']('AddTags',_0x84adb6);logger[_0x7333('0x13')]('AddTags',_0x84adb6,JSON[_0x7333('0x14')](_0x55aebf));_0x3ce296(_0x55aebf);})[_0x7333('0x19')](function(_0x1b8459){logger[_0x7333('0x15')](_0x7333('0x27'),_0x1b8459[_0x7333('0x16')],_0x84adb6);_0x4c422f(_this[_0x7333('0x15')](0x1f4,_0x1b8459['message']));});});};
\ No newline at end of file
+var _0x2b1b=['addTags','ids','spread','AddTags','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','defaults','redis','localhost','./faxInteraction.socket','register','request','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','debug','AddTagsToFaxInteraction','find','where'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x2b1b,0xf4));var _0xb2b1=function(_0x1d4197,_0x4ab9a4){_0x1d4197=_0x1d4197-0x0;var _0x46a458=_0x2b1b[_0x1d4197];return _0x46a458;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb2b1('0x0'));var BPromise=require('bluebird');var rs=require(_0xb2b1('0x1'));var fs=require('fs');var Redis=require(_0xb2b1('0x2'));var db=require(_0xb2b1('0x3'))['db'];var utils=require(_0xb2b1('0x4'));var logger=require('../../config/logger')(_0xb2b1('0x5'));var config=require('../../config/environment');var jayson=require(_0xb2b1('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xb2b1('0x7')](config[_0xb2b1('0x8')],{'host':_0xb2b1('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb2b1('0x8')]));require(_0xb2b1('0xa'))[_0xb2b1('0xb')](socket);function respondWithRpcPromise(_0x517130,_0x239efc,_0x4c543d){return new BPromise(function(_0x308033,_0x2632ef){return client[_0xb2b1('0xc')](_0x517130,_0x4c543d)[_0xb2b1('0xd')](function(_0x1e7fb2){logger[_0xb2b1('0xe')]('FaxInteraction,\x20%s,\x20%s',_0x239efc,_0xb2b1('0xf'));logger['debug'](_0xb2b1('0x10'),_0x239efc,'request\x20sent',JSON[_0xb2b1('0x11')](_0x1e7fb2));if(_0x1e7fb2['error']){if(_0x1e7fb2[_0xb2b1('0x12')][_0xb2b1('0x13')]===0x1f4){logger['error'](_0xb2b1('0x14'),_0x239efc,_0x1e7fb2[_0xb2b1('0x12')][_0xb2b1('0x15')]);return _0x2632ef(_0x1e7fb2[_0xb2b1('0x12')][_0xb2b1('0x15')]);}logger[_0xb2b1('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x239efc,_0x1e7fb2[_0xb2b1('0x12')][_0xb2b1('0x15')]);return _0x308033(_0x1e7fb2[_0xb2b1('0x12')][_0xb2b1('0x15')]);}else{logger[_0xb2b1('0xe')]('FaxInteraction,\x20%s,\x20%s',_0x239efc,_0xb2b1('0xf'));_0x308033(_0x1e7fb2[_0xb2b1('0x16')][_0xb2b1('0x15')]);}})[_0xb2b1('0x17')](function(_0x34feb8){logger[_0xb2b1('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x239efc,_0x34feb8);_0x2632ef(_0x34feb8);});});}exports[_0xb2b1('0x18')]=function(_0x17c4f1){var _0x3fd575=this;return new Promise(function(_0x28b5a5,_0x172ee6){return db[_0xb2b1('0x19')][_0xb2b1('0x1a')](_0x17c4f1[_0xb2b1('0x1b')],{'raw':_0x17c4f1[_0xb2b1('0x1c')]?_0x17c4f1['options'][_0xb2b1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17c4f1[_0xb2b1('0x1c')]?_0x17c4f1[_0xb2b1('0x1c')]['where']||null:null,'attributes':_0x17c4f1[_0xb2b1('0x1c')]?_0x17c4f1['options'][_0xb2b1('0x1e')]||null:null,'limit':_0x17c4f1[_0xb2b1('0x1c')]?_0x17c4f1[_0xb2b1('0x1c')][_0xb2b1('0x1f')]||null:null})[_0xb2b1('0xd')](function(_0xb9539a){logger[_0xb2b1('0xe')]('UpdateFaxInteraction',_0x17c4f1);logger[_0xb2b1('0x20')](_0xb2b1('0x18'),_0x17c4f1,JSON[_0xb2b1('0x11')](_0xb9539a));_0x28b5a5(_0xb9539a);})[_0xb2b1('0x17')](function(_0x9f6b59){logger[_0xb2b1('0x12')](_0xb2b1('0x18'),_0x9f6b59[_0xb2b1('0x15')],_0x17c4f1);_0x172ee6(_0x3fd575['error'](0x1f4,_0x9f6b59[_0xb2b1('0x15')]));});});};exports[_0xb2b1('0x21')]=function(_0xa9c1a5){return new Promise(function(_0x56eabb,_0xf35ea0){return db[_0xb2b1('0x19')][_0xb2b1('0x22')]({'where':_0xa9c1a5[_0xb2b1('0x1c')]?_0xa9c1a5['options'][_0xb2b1('0x23')]||null:null})[_0xb2b1('0xd')](function(_0x29c2c5){if(_0x29c2c5){return _0x29c2c5[_0xb2b1('0x24')](_0xa9c1a5[_0xb2b1('0x1b')][_0xb2b1('0x25')],_['omit'](_0xa9c1a5['body'],['ids','id'])||{});}})[_0xb2b1('0x26')](function(_0x3226cb){logger['info'](_0xb2b1('0x27'),_0xa9c1a5);logger['debug'](_0xb2b1('0x27'),_0xa9c1a5,JSON['stringify'](_0x3226cb));_0x56eabb(_0x3226cb);})[_0xb2b1('0x17')](function(_0x41d992){logger[_0xb2b1('0x12')](_0xb2b1('0x27'),_0x41d992[_0xb2b1('0x15')],_0xa9c1a5);_0xf35ea0(_this[_0xb2b1('0x12')](0x1f4,_0x41d992[_0xb2b1('0x15')]));});});};
\ No newline at end of file
index 8a751bd..abdb143 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5dbd=['register','length','faxInteraction:','./faxInteraction.events','update','emit','removeListener'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x5dbd,0xce));var _0xd5db=function(_0x54fc08,_0x34b2a4){_0x54fc08=_0x54fc08-0x0;var _0x26823b=_0x5dbd[_0x54fc08];return _0x26823b;};'use strict';var FaxInteractionEvents=require(_0xd5db('0x0'));var events=['save','remove',_0xd5db('0x1')];function createListener(_0x1c36b9,_0x2925d5){return function(_0x56481d){_0x2925d5[_0xd5db('0x2')](_0x1c36b9,_0x56481d);};}function removeListener(_0x4c03fe,_0x5073a8){return function(){FaxInteractionEvents[_0xd5db('0x3')](_0x4c03fe,_0x5073a8);};}exports[_0xd5db('0x4')]=function(_0x18bb10){for(var _0x4c6b55=0x0,_0x340f00=events[_0xd5db('0x5')];_0x4c6b55<_0x340f00;_0x4c6b55++){var _0x4d8820=events[_0x4c6b55];var _0x29d47c=createListener(_0xd5db('0x6')+_0x4d8820,_0x18bb10);FaxInteractionEvents['on'](_0x4d8820,_0x29d47c);}};
\ No newline at end of file
+var _0x49e2=['register','length','faxInteraction:','./faxInteraction.events','update','emit','removeListener'];(function(_0x8ee4e8,_0x192cf2){var _0x4b1ec4=function(_0xc3cfa5){while(--_0xc3cfa5){_0x8ee4e8['push'](_0x8ee4e8['shift']());}};_0x4b1ec4(++_0x192cf2);}(_0x49e2,0x122));var _0x249e=function(_0xd8bf17,_0xa472ec){_0xd8bf17=_0xd8bf17-0x0;var _0x39a0e1=_0x49e2[_0xd8bf17];return _0x39a0e1;};'use strict';var FaxInteractionEvents=require(_0x249e('0x0'));var events=['save','remove',_0x249e('0x1')];function createListener(_0x1a455e,_0x5ec6bc){return function(_0x1a6d7e){_0x5ec6bc[_0x249e('0x2')](_0x1a455e,_0x1a6d7e);};}function removeListener(_0x2cd4a8,_0x3ab755){return function(){FaxInteractionEvents[_0x249e('0x3')](_0x2cd4a8,_0x3ab755);};}exports[_0x249e('0x4')]=function(_0x3bb5c2){for(var _0x40e8c2=0x0,_0x5c71d2=events[_0x249e('0x5')];_0x40e8c2<_0x5c71d2;_0x40e8c2++){var _0x515146=events[_0x40e8c2];var _0x462fd9=createListener(_0x249e('0x6')+_0x515146,_0x3bb5c2);FaxInteractionEvents['on'](_0x515146,_0x462fd9);}};
\ No newline at end of file
index 2236483..13b751b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d15=['delete','tracked','faxinteraction:destroy','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','fax','addTags','put','faxinteraction:update','update'];(function(_0x39c009,_0x21b330){var _0x2c6cb8=function(_0xad6ad3){while(--_0xad6ad3){_0x39c009['push'](_0x39c009['shift']());}};_0x2c6cb8(++_0x21b330);}(_0x7d15,0x14f));var _0x57d1=function(_0x1b6fb5,_0x472e0e){_0x1b6fb5=_0x1b6fb5-0x0;var _0x35d663=_0x7d15[_0x1b6fb5];return _0x35d663;};'use strict';var multer=require(_0x57d1('0x0'));var util=require('util');var path=require(_0x57d1('0x1'));var timeout=require('connect-timeout');var express=require(_0x57d1('0x2'));var router=express[_0x57d1('0x3')]();var fs_extra=require(_0x57d1('0x4'));var auth=require(_0x57d1('0x5'));var interaction=require(_0x57d1('0x6'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0x57d1('0x7')]('/',auth['isAuthenticated'](),controller[_0x57d1('0x8')]);router[_0x57d1('0x7')](_0x57d1('0x9'),auth[_0x57d1('0xa')](),controller[_0x57d1('0xb')]);router['get'](_0x57d1('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/messages',auth[_0x57d1('0xa')](),controller[_0x57d1('0xd')]);router[_0x57d1('0x7')](_0x57d1('0xe'),auth[_0x57d1('0xa')](),controller[_0x57d1('0xf')]);router[_0x57d1('0x10')]('/',auth[_0x57d1('0xa')](),controller[_0x57d1('0x11')]);router[_0x57d1('0x10')](_0x57d1('0x12'),auth[_0x57d1('0xa')](),controller['addMessage']);router['post'](_0x57d1('0x13'),auth[_0x57d1('0xa')](),interaction['tracked'](_0x57d1('0x14'),'faxinteraction:addtags'),controller[_0x57d1('0x15')]);router[_0x57d1('0x16')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x57d1('0x14'),_0x57d1('0x17')),controller[_0x57d1('0x18')]);router[_0x57d1('0x19')](_0x57d1('0xc'),auth[_0x57d1('0xa')](),interaction[_0x57d1('0x1a')](_0x57d1('0x14'),_0x57d1('0x1b')),controller[_0x57d1('0x1c')]);router[_0x57d1('0x19')](_0x57d1('0x13'),auth[_0x57d1('0xa')](),controller['removeTags']);module[_0x57d1('0x1d')]=router;
\ No newline at end of file
+var _0xa50d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa50d,0x86));var _0xda50=function(_0xf2e0c5,_0x460e89){_0xf2e0c5=_0xf2e0c5-0x0;var _0x277da5=_0xa50d[_0xf2e0c5];return _0x277da5;};'use strict';var multer=require(_0xda50('0x0'));var util=require(_0xda50('0x1'));var path=require(_0xda50('0x2'));var timeout=require(_0xda50('0x3'));var express=require(_0xda50('0x4'));var router=express[_0xda50('0x5')]();var fs_extra=require(_0xda50('0x6'));var auth=require(_0xda50('0x7'));var interaction=require(_0xda50('0x8'));var config=require(_0xda50('0x9'));var controller=require(_0xda50('0xa'));router[_0xda50('0xb')]('/',auth[_0xda50('0xc')](),controller['index']);router[_0xda50('0xb')](_0xda50('0xd'),auth['isAuthenticated'](),controller[_0xda50('0xe')]);router['get'](_0xda50('0xf'),auth[_0xda50('0xc')](),controller[_0xda50('0x10')]);router[_0xda50('0xb')](_0xda50('0x11'),auth[_0xda50('0xc')](),controller[_0xda50('0x12')]);router[_0xda50('0xb')](_0xda50('0x13'),auth[_0xda50('0xc')](),controller[_0xda50('0x14')]);router[_0xda50('0x15')]('/',auth[_0xda50('0xc')](),controller['create']);router[_0xda50('0x15')](_0xda50('0x11'),auth[_0xda50('0xc')](),controller['addMessage']);router[_0xda50('0x15')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xda50('0x16')](_0xda50('0x17'),_0xda50('0x18')),controller[_0xda50('0x19')]);router[_0xda50('0x1a')](_0xda50('0xf'),auth[_0xda50('0xc')](),interaction[_0xda50('0x16')](_0xda50('0x17'),_0xda50('0x1b')),controller[_0xda50('0x1c')]);router[_0xda50('0x1d')](_0xda50('0xf'),auth[_0xda50('0xc')](),interaction[_0xda50('0x16')](_0xda50('0x17'),_0xda50('0x1e')),controller[_0xda50('0x1f')]);router['delete'](_0xda50('0x20'),auth[_0xda50('0xc')](),controller[_0xda50('0x21')]);module[_0xda50('0x22')]=router;
\ No newline at end of file
index 1b3e790..1e40a0a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3c7b=['medium','BOOLEAN','DATE','sequelize','exports','TEXT'];(function(_0x5d0207,_0x4000c4){var _0xf3e249=function(_0x1a1fd9){while(--_0x1a1fd9){_0x5d0207['push'](_0x5d0207['shift']());}};_0xf3e249(++_0x4000c4);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x26e2d9,_0x15159f){_0x26e2d9=_0x26e2d9-0x0;var _0x9dc81=_0x3c7b[_0x26e2d9];return _0x9dc81;};'use strict';var Sequelize=require(_0xb3c7('0x0'));module[_0xb3c7('0x1')]={'body':{'type':Sequelize[_0xb3c7('0x2')](_0xb3c7('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb3c7('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xb3c7('0x5')]}};
\ No newline at end of file
+var _0xe57e=['out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe57e,0xf2));var _0xee57=function(_0x52ad3e,_0x3672f2){_0x52ad3e=_0x52ad3e-0x0;var _0x14b667=_0xe57e[_0x52ad3e];return _0x14b667;};'use strict';var Sequelize=require(_0xee57('0x0'));module['exports']={'body':{'type':Sequelize[_0xee57('0x1')](_0xee57('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xee57('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xee57('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xee57('0x5')]}};
\ No newline at end of file
index bdb904d..ef60148 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5026=['EventManager','acceptmessage','fax','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','Sequelize','SELECT','fullname','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','attachments','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','end','stack','name','send','index','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','FaxMessage','includeAll','include','findAll','rows','show','params','rawAttributes','keys','length','body','destroy','find','describe','../../config/logger','fax-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','email','internal','manual','channel','motionChannel','event','accept'];(function(_0x17db8b,_0x305439){var _0x3ad9e3=function(_0x14cd2b){while(--_0x14cd2b){_0x17db8b['push'](_0x17db8b['shift']());}};_0x3ad9e3(++_0x305439);}(_0x5026,0x1e5));var _0x6502=function(_0x472901,_0x496e3e){_0x472901=_0x472901-0x0;var _0x399381=_0x5026[_0x472901];return _0x399381;};'use strict';var emlformat=require(_0x6502('0x0'));var rimraf=require(_0x6502('0x1'));var zipdir=require(_0x6502('0x2'));var jsonpatch=require(_0x6502('0x3'));var rp=require(_0x6502('0x4'));var moment=require(_0x6502('0x5'));var BPromise=require(_0x6502('0x6'));var Mustache=require(_0x6502('0x7'));var util=require(_0x6502('0x8'));var path=require(_0x6502('0x9'));var sox=require(_0x6502('0xa'));var csv=require(_0x6502('0xb'));var ejs=require(_0x6502('0xc'));var fs=require('fs');var fs_extra=require(_0x6502('0xd'));var _=require('lodash');var squel=require(_0x6502('0xe'));var crypto=require(_0x6502('0xf'));var jsforce=require(_0x6502('0x10'));var deskjs=require(_0x6502('0x11'));var toCsv=require('to-csv');var querystring=require(_0x6502('0x12'));var Papa=require(_0x6502('0x13'));var Redis=require(_0x6502('0x14'));var authService=require(_0x6502('0x15'));var qs=require(_0x6502('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6502('0x17'));var config=require(_0x6502('0x18'));var licenseUtil=require(_0x6502('0x19'));var db=require(_0x6502('0x1a'))['db'];config[_0x6502('0x1b')]=_[_0x6502('0x1c')](config[_0x6502('0x1b')],{'host':_0x6502('0x1d'),'port':0x18eb});var socket=require(_0x6502('0x1e'))(new Redis(config['redis']));require(_0x6502('0x1f'))[_0x6502('0x20')](socket);var jayson=require(_0x6502('0x21'));var client=jayson[_0x6502('0x22')]['http']({'port':0x232c});var client9002=jayson[_0x6502('0x22')][_0x6502('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x3a9322,_0x3f3cdc,_0x45d1f6,_0x21b715){return new BPromise(function(_0x4cac91,_0x392ac0){var _0x233f8f=_0x21b715||client;return _0x233f8f[_0x6502('0x24')](_0x3a9322,_0x45d1f6)[_0x6502('0x25')](function(_0xd8e2db){logger[_0x6502('0x26')](_0x6502('0x27'),_0x3f3cdc,_0x6502('0x28'));logger[_0x6502('0x29')](_0x6502('0x2a'),_0x3f3cdc,_0x6502('0x28'),JSON['stringify'](_0xd8e2db));if(_0xd8e2db['error']){if(_0xd8e2db[_0x6502('0x2b')][_0x6502('0x2c')]===0x1f4){logger['error'](_0x6502('0x27'),_0x3f3cdc,_0xd8e2db[_0x6502('0x2b')][_0x6502('0x2d')]);return _0x392ac0(_0xd8e2db[_0x6502('0x2b')][_0x6502('0x2d')]);}logger['error'](_0x6502('0x27'),_0x3f3cdc,_0xd8e2db[_0x6502('0x2b')][_0x6502('0x2d')]);return _0x4cac91(_0xd8e2db['error'][_0x6502('0x2d')]);}else{logger[_0x6502('0x26')]('FaxMessage,\x20%s,\x20%s',_0x3f3cdc,_0x6502('0x28'));_0x4cac91(_0xd8e2db[_0x6502('0x2e')]['message']);}})[_0x6502('0x2f')](function(_0x4d7bdd){logger['error'](_0x6502('0x27'),_0x3f3cdc,_0x4d7bdd);_0x392ac0(_0x4d7bdd);});});}function respondWithStatusCode(_0x459adf,_0x5c0ea0){_0x5c0ea0=_0x5c0ea0||0xcc;return function(_0x4db42d){if(_0x4db42d){return _0x459adf[_0x6502('0x30')](_0x5c0ea0);}return _0x459adf[_0x6502('0x31')](_0x5c0ea0)['end']();};}function respondWithResult(_0x3f5f69,_0x4ba8e5){_0x4ba8e5=_0x4ba8e5||0xc8;return function(_0x3a5e3d){if(_0x3a5e3d){return _0x3f5f69[_0x6502('0x31')](_0x4ba8e5)[_0x6502('0x32')](_0x3a5e3d);}};}function respondWithFilteredResult(_0x28bfd9,_0x1c6f87){return function(_0x21b48b){if(_0x21b48b){var _0x195c21=typeof _0x1c6f87[_0x6502('0x33')]===_0x6502('0x34')&&typeof _0x1c6f87[_0x6502('0x35')]===_0x6502('0x34');var _0x25276c=_0x21b48b[_0x6502('0x36')];var _0x46648b=_0x195c21?0x0:_0x1c6f87[_0x6502('0x33')];var _0xcee2a7=_0x195c21?_0x21b48b[_0x6502('0x36')]:_0x1c6f87[_0x6502('0x33')]+_0x1c6f87['limit'];var _0x1a42da;if(_0xcee2a7>=_0x25276c){_0xcee2a7=_0x25276c;_0x1a42da=0xc8;}else{_0x1a42da=0xce;}_0x28bfd9[_0x6502('0x31')](_0x1a42da);return _0x28bfd9[_0x6502('0x37')](_0x6502('0x38'),_0x46648b+'-'+_0xcee2a7+'/'+_0x25276c)['json'](_0x21b48b);}return null;};}function patchUpdates(_0x2b5a98){return function(_0x1ee27f){try{jsonpatch[_0x6502('0x39')](_0x1ee27f,_0x2b5a98,!![]);}catch(_0xa9114a){return BPromise[_0x6502('0x3a')](_0xa9114a);}return _0x1ee27f[_0x6502('0x3b')]();};}function saveUpdates(_0x266fe1,_0x4e2dd1){return function(_0x514dc5){if(_0x514dc5){return _0x514dc5[_0x6502('0x3c')](_0x266fe1)[_0x6502('0x25')](function(_0xa58fb1){return _0xa58fb1;});}return null;};}function removeEntity(_0xf6c2b5,_0x5cf433){return function(_0x80e620){if(_0x80e620){return _0x80e620['destroy']()[_0x6502('0x25')](function(){_0xf6c2b5[_0x6502('0x31')](0xcc)[_0x6502('0x3d')]();});}};}function handleEntityNotFound(_0x43129a,_0x16dbec){return function(_0x593275){if(!_0x593275){_0x43129a[_0x6502('0x30')](0x194);}return _0x593275;};}function handleError(_0x37fb43,_0x19ef49){_0x19ef49=_0x19ef49||0x1f4;return function(_0x10d26b){logger[_0x6502('0x2b')](_0x10d26b[_0x6502('0x3e')]);if(_0x10d26b[_0x6502('0x3f')]){delete _0x10d26b[_0x6502('0x3f')];}_0x37fb43[_0x6502('0x31')](_0x19ef49)[_0x6502('0x40')](_0x10d26b);};}exports[_0x6502('0x41')]=function(_0xe6f56b,_0xba9b8){var _0x24b7fe={},_0x1e1ad4={},_0x270689={'count':0x0,'rows':[]};var _0x42584a=_['map'](db['FaxMessage']['rawAttributes'],function(_0x54b54a){return{'name':_0x54b54a['fieldName'],'type':_0x54b54a[_0x6502('0x42')][_0x6502('0x43')]};});_0x1e1ad4[_0x6502('0x44')]=_[_0x6502('0x45')](_0x42584a,_0x6502('0x3f'));_0x1e1ad4[_0x6502('0x46')]=_['keys'](_0xe6f56b[_0x6502('0x46')]);_0x1e1ad4[_0x6502('0x47')]=_[_0x6502('0x48')](_0x1e1ad4[_0x6502('0x44')],_0x1e1ad4['query']);_0x24b7fe['attributes']=_['intersection'](_0x1e1ad4[_0x6502('0x44')],qs[_0x6502('0x49')](_0xe6f56b['query']['fields']));_0x24b7fe[_0x6502('0x4a')]=_0x24b7fe[_0x6502('0x4a')]['length']?_0x24b7fe['attributes']:_0x1e1ad4['model'];if(!_0xe6f56b['query'][_0x6502('0x4b')](_0x6502('0x4c'))){_0x24b7fe['limit']=qs['limit'](_0xe6f56b[_0x6502('0x46')][_0x6502('0x35')]);_0x24b7fe[_0x6502('0x33')]=qs['offset'](_0xe6f56b[_0x6502('0x46')][_0x6502('0x33')]);}_0x24b7fe[_0x6502('0x4d')]=qs[_0x6502('0x4e')](_0xe6f56b[_0x6502('0x46')][_0x6502('0x4e')]);_0x24b7fe[_0x6502('0x4f')]=qs[_0x6502('0x47')](_[_0x6502('0x50')](_0xe6f56b[_0x6502('0x46')],_0x1e1ad4[_0x6502('0x47')]),_0x42584a);if(_0xe6f56b[_0x6502('0x46')]['filter']){_0x24b7fe['where']=_[_0x6502('0x51')](_0x24b7fe[_0x6502('0x4f')],{'$or':_['map'](_0x42584a,function(_0x4f54df){if(_0x4f54df[_0x6502('0x42')]!=='VIRTUAL'){var _0x11e927={};_0x11e927[_0x4f54df[_0x6502('0x3f')]]={'$like':'%'+_0xe6f56b[_0x6502('0x46')][_0x6502('0x52')]+'%'};return _0x11e927;}})});}_0x24b7fe=_[_0x6502('0x51')]({},_0x24b7fe,_0xe6f56b[_0x6502('0x53')]);var _0x276f32={'where':_0x24b7fe[_0x6502('0x4f')]};return db[_0x6502('0x54')][_0x6502('0x36')](_0x276f32)[_0x6502('0x25')](function(_0x3a3f4b){_0x270689['count']=_0x3a3f4b;if(_0xe6f56b[_0x6502('0x46')][_0x6502('0x55')]){_0x24b7fe[_0x6502('0x56')]=[{'all':!![]}];}return db[_0x6502('0x54')][_0x6502('0x57')](_0x24b7fe);})[_0x6502('0x25')](function(_0x7fab6e){_0x270689[_0x6502('0x58')]=_0x7fab6e;return _0x270689;})['then'](respondWithFilteredResult(_0xba9b8,_0x24b7fe))[_0x6502('0x2f')](handleError(_0xba9b8,null));};exports[_0x6502('0x59')]=function(_0x2ea883,_0x9c4793){var _0x1bae76={'raw':!![],'where':{'id':_0x2ea883[_0x6502('0x5a')]['id']}},_0x49d8f2={};_0x49d8f2['model']=_['keys'](db[_0x6502('0x54')][_0x6502('0x5b')]);_0x49d8f2[_0x6502('0x46')]=_[_0x6502('0x5c')](_0x2ea883[_0x6502('0x46')]);_0x49d8f2[_0x6502('0x47')]=_[_0x6502('0x48')](_0x49d8f2[_0x6502('0x44')],_0x49d8f2[_0x6502('0x46')]);_0x1bae76[_0x6502('0x4a')]=_['intersection'](_0x49d8f2[_0x6502('0x44')],qs[_0x6502('0x49')](_0x2ea883[_0x6502('0x46')][_0x6502('0x49')]));_0x1bae76['attributes']=_0x1bae76[_0x6502('0x4a')][_0x6502('0x5d')]?_0x1bae76[_0x6502('0x4a')]:_0x49d8f2[_0x6502('0x44')];if(_0x2ea883[_0x6502('0x46')][_0x6502('0x55')]){_0x1bae76[_0x6502('0x56')]=[{'all':!![]}];}_0x1bae76=_[_0x6502('0x51')]({},_0x1bae76,_0x2ea883['options']);return db[_0x6502('0x54')]['find'](_0x1bae76)[_0x6502('0x25')](handleEntityNotFound(_0x9c4793,null))[_0x6502('0x25')](respondWithResult(_0x9c4793,null))[_0x6502('0x2f')](handleError(_0x9c4793,null));};exports[_0x6502('0x3c')]=function(_0x1da910,_0x5df2b8){if(_0x1da910[_0x6502('0x5e')]['id']){delete _0x1da910[_0x6502('0x5e')]['id'];}return db[_0x6502('0x54')]['find']({'where':{'id':_0x1da910[_0x6502('0x5a')]['id']}})[_0x6502('0x25')](handleEntityNotFound(_0x5df2b8,null))[_0x6502('0x25')](saveUpdates(_0x1da910[_0x6502('0x5e')],null))[_0x6502('0x25')](respondWithResult(_0x5df2b8,null))[_0x6502('0x2f')](handleError(_0x5df2b8,null));};exports[_0x6502('0x5f')]=function(_0x4dae7a,_0xeb4637){return db[_0x6502('0x54')][_0x6502('0x60')]({'where':{'id':_0x4dae7a[_0x6502('0x5a')]['id']}})['then'](handleEntityNotFound(_0xeb4637,null))[_0x6502('0x25')](removeEntity(_0xeb4637,null))['catch'](handleError(_0xeb4637,null));};exports[_0x6502('0x61')]=function(_0x4bc116,_0x4e2c5e){return db[_0x6502('0x54')]['describe']()[_0x6502('0x25')](respondWithResult(_0x4e2c5e,null))[_0x6502('0x2f')](handleError(_0x4e2c5e,null));};var interaction_log=require(_0x6502('0x62'))(_0x6502('0x63'));exports['accept']=function(_0x35520f,_0x4e67f3,_0x371055){var _0x317488={'agent':{},'channel':'fax'};if(_0x35520f[_0x6502('0x5e')]['id']){delete _0x35520f[_0x6502('0x5e')]['id'];}_0x35520f[_0x6502('0x5e')][_0x6502('0x64')]=!![];_0x35520f[_0x6502('0x5e')][_0x6502('0x65')]=moment()[_0x6502('0x66')](_0x6502('0x67'));_0x35520f[_0x6502('0x5e')][_0x6502('0x68')]=_0x35520f[_0x6502('0x5e')][_0x6502('0x68')]||_0x35520f[_0x6502('0x69')]['id'];_0x317488[_0x6502('0x6a')]['id']=_0x35520f['body'][_0x6502('0x68')];return db['FaxMessage'][_0x6502('0x60')]({'where':{'id':_0x35520f[_0x6502('0x5a')]['id'],'UserId':null}})[_0x6502('0x25')](handleEntityNotFound(_0x4e67f3,null))[_0x6502('0x25')](saveUpdates(_0x35520f['body'],null))['then'](function(_0x1c85f7){if(_0x1c85f7){_0x317488['message']=_0x1c85f7['get']({'plain':!![]});return db[_0x6502('0x6b')][_0x6502('0x60')]({'where':{'id':_0x1c85f7[_0x6502('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x4e67f3,null))['then'](function(_0x158a68){if(_0x158a68){return _0x158a68[_0x6502('0x3c')]({'UserId':_0x35520f[_0x6502('0x5e')][_0x6502('0x68')],'read1stAt':_[_0x6502('0x6d')](_0x158a68['read1stAt'])?moment()[_0x6502('0x66')](_0x6502('0x67')):undefined});}return null;})[_0x6502('0x25')](function(_0x4669ad){if(_0x4669ad){_0x317488[_0x6502('0x6e')]=_0x4669ad['get']({'plain':!![]});interaction_log['info'](_0x6502('0x6f'),_0x35520f[_0x6502('0x69')]['id'],_0x35520f[_0x6502('0x69')]['name'],_0x35520f[_0x6502('0x69')][_0x6502('0x70')],_0x317488[_0x6502('0x6e')]['id'],_0x35520f[_0x6502('0x5e')]?JSON[_0x6502('0x71')](_0x35520f[_0x6502('0x5e')]):_0x6502('0x72'));return respondWithRpcPromise(_0x6502('0x73'),_0x6502('0x74'),_0x317488);}return null;})[_0x6502('0x25')](function(_0x685bd5){var _0x2f019d=_0x6502('0x75')+_0x685bd5[_0x6502('0x2d')]['ContactId'];return db[_0x6502('0x76')][_0x6502('0x46')](_0x2f019d,{'type':db['Sequelize'][_0x6502('0x77')]['SELECT'],'raw':!![]})['then'](function(_0x2dc470){return _0x2dc470;});})[_0x6502('0x25')](function(_0x4f5cda){if(_0x4f5cda){_0x317488[_0x6502('0x2d')]['contact']=_0x4f5cda[0x0];if(!_0x35520f[_0x6502('0x5e')]['UserId'])return;return db['User']['find']({'where':{'id':_0x35520f[_0x6502('0x5e')][_0x6502('0x68')],'role':'agent'},'attributes':['id',_0x6502('0x3f'),'fullname',_0x6502('0x78'),_0x6502('0x79')],'raw':!![]});}return null;})[_0x6502('0x25')](function(_0x155e84){if(!_0x155e84)return null;_0x317488['message'][_0x6502('0x6a')]=_0x155e84;return _0x317488;})[_0x6502('0x25')](function(_0x5b8088){if(_0x5b8088){if(_0x35520f['body'][_0x6502('0x7a')]){_0x317488[_0x6502('0x2d')]['interface']=util['format']('SIP/%s',_0x35520f[_0x6502('0x69')][_0x6502('0x3f')]);_0x317488[_0x6502('0x2d')][_0x6502('0x7b')]=_0x317488[_0x6502('0x7b')];_0x317488[_0x6502('0x2d')][_0x6502('0x7c')]=_0x317488['channel'];_0x317488[_0x6502('0x2d')][_0x6502('0x7d')]=_0x6502('0x7e');return respondWithRpcPromise(_0x6502('0x7f'),'EventManager',{'event':_0x6502('0x80'),'message':_0x317488[_0x6502('0x2d')]},client9002)[_0x6502('0x25')](function(){return _0x317488;});}return _0x317488;}return null;})[_0x6502('0x25')](respondWithResult(_0x4e67f3,null))[_0x6502('0x2f')](handleError(_0x4e67f3,null));};var interaction_log=require('../../config/logger')(_0x6502('0x63'));exports[_0x6502('0x3a')]=function(_0x1df88d,_0x50196c,_0x34d811){var _0x16dc8a={'agent':{},'channel':_0x6502('0x81')};if(_0x1df88d['body']['id']){delete _0x1df88d[_0x6502('0x5e')]['id'];}_0x1df88d[_0x6502('0x5e')]['UserId']=_0x1df88d[_0x6502('0x5e')]['UserId']||_0x1df88d[_0x6502('0x69')]['id'];_0x16dc8a[_0x6502('0x6a')]['id']=_0x1df88d[_0x6502('0x5e')][_0x6502('0x68')];return db[_0x6502('0x54')][_0x6502('0x60')]({'where':{'id':_0x1df88d[_0x6502('0x5a')]['id'],'UserId':null}})[_0x6502('0x25')](handleEntityNotFound(_0x50196c,null))[_0x6502('0x25')](function(_0x2a0a79){if(_0x2a0a79){_0x16dc8a['message']=_0x2a0a79[_0x6502('0x82')]({'plain':!![]});return db[_0x6502('0x6b')]['find']({'where':{'id':_0x2a0a79[_0x6502('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x50196c,null))[_0x6502('0x25')](function(_0x9af945){if(_0x9af945){_0x16dc8a[_0x6502('0x6e')]=_0x9af945[_0x6502('0x82')]({'plain':!![]});interaction_log[_0x6502('0x26')](_0x6502('0x83'),_0x1df88d[_0x6502('0x69')]['id'],_0x1df88d[_0x6502('0x69')][_0x6502('0x3f')],_0x1df88d['user'][_0x6502('0x70')],_0x16dc8a[_0x6502('0x6e')]['id'],_0x1df88d[_0x6502('0x5e')]?JSON[_0x6502('0x71')](_0x1df88d['body']):'null');return respondWithRpcPromise(_0x6502('0x84'),'rejectMessage',_0x16dc8a);}return null;})[_0x6502('0x25')](function(_0x328838){var _0x24ff1f=_0x6502('0x75')+_0x328838[_0x6502('0x2d')][_0x6502('0x85')];return db[_0x6502('0x76')]['query'](_0x24ff1f,{'type':db[_0x6502('0x86')][_0x6502('0x77')][_0x6502('0x87')],'raw':!![]})[_0x6502('0x25')](function(_0x351a0f){return _0x351a0f;});})[_0x6502('0x25')](function(_0x300964){if(_0x300964){_0x16dc8a[_0x6502('0x2d')]['contact']=_0x300964[0x0];if(!_0x1df88d['body']['UserId'])return;return db['User'][_0x6502('0x60')]({'where':{'id':_0x1df88d[_0x6502('0x5e')][_0x6502('0x68')],'role':_0x6502('0x6a')},'attributes':['id',_0x6502('0x3f'),_0x6502('0x88'),'email',_0x6502('0x79')],'raw':!![]});}return null;})[_0x6502('0x25')](function(_0x426c7c){if(!_0x426c7c)return null;_0x16dc8a[_0x6502('0x2d')]['agent']=_0x426c7c;return _0x16dc8a;})[_0x6502('0x25')](function(_0x5604db){if(_0x5604db){_0x5604db[_0x6502('0x2d')]['interface']=util['format']('SIP/%s',_0x1df88d['user'][_0x6502('0x3f')]);_0x5604db['message'][_0x6502('0x7b')]=_0x16dc8a['channel'];_0x5604db[_0x6502('0x2d')][_0x6502('0x7c')]=_0x16dc8a[_0x6502('0x7b')];_0x5604db[_0x6502('0x2d')][_0x6502('0x7d')]=_0x6502('0x3a');respondWithRpcPromise(_0x6502('0x7f'),'EventManager',{'event':_0x6502('0x89'),'message':_0x5604db['message']},client9002);return _0x16dc8a;}return null;})[_0x6502('0x25')](respondWithResult(_0x50196c,null))[_0x6502('0x2f')](handleError(_0x50196c,null));};exports[_0x6502('0x8a')]=function(_0x2f7800,_0x27a8f6){var _0x2fa0ef;return db[_0x6502('0x54')]['create'](_0x2f7800['body'],{})[_0x6502('0x25')](function(_0x3d7a56){_0x2fa0ef=_0x3d7a56;return db[_0x6502('0x8b')][_0x6502('0x8c')]({'where':{'id':_0x2fa0ef[_0x6502('0x85')]}});})[_0x6502('0x25')](function(_0x53486d){if(_[_0x6502('0x6d')](_0x53486d)){return;}else{_0x2fa0ef[_0x6502('0x81')]=_0x53486d[_0x6502('0x81')];return db[_0x6502('0x8d')]['findOne']({'where':{'id':_0x2fa0ef[_0x6502('0x8e')]}});}})[_0x6502('0x25')](function(_0x3877ff){return respondWithRpcPromise(_0x6502('0x8f'),_0x6502('0x8f'),{'FaxAccountId':_[_0x6502('0x6d')](_0x2f7800[_0x6502('0x5e')])?undefined:_0x2f7800[_0x6502('0x5e')][_0x6502('0x90')],'path':_['isNil'](_0x3877ff)?undefined:util[_0x6502('0x66')](_0x6502('0x91'),_0x3877ff[_0x6502('0x92')]),'fax':_[_0x6502('0x6d')](_0x2fa0ef[_0x6502('0x81')])?undefined:_0x2fa0ef[_0x6502('0x81')],'AttachmentId':_0x2fa0ef[_0x6502('0x8e')]},client9002);})[_0x6502('0x25')](respondWithResult(_0x27a8f6,0xc9))['catch'](handleError(_0x27a8f6,null));};exports[_0x6502('0x93')]=function(_0x16f99f,_0x5e2829){var _0x5ea432=path['join'](config[_0x6502('0x94')],_0x6502('0x95'),_0x6502('0x96'),_0x6502('0x97'));return db[_0x6502('0x54')][_0x6502('0x60')]({'where':{'id':_0x16f99f[_0x6502('0x5a')]['id']},'include':[{'model':db[_0x6502('0x8d')],'as':_0x6502('0x8d')}]})[_0x6502('0x25')](handleEntityNotFound(_0x5e2829,null))[_0x6502('0x25')](function(_0x2b5b7){if(_0x2b5b7){return _0x5e2829[_0x6502('0x93')](path[_0x6502('0x98')](_0x5ea432,_0x2b5b7[_0x6502('0x8d')][_0x6502('0x92')]));}})[_0x6502('0x2f')](handleError(_0x5e2829,null));};
\ No newline at end of file
+var _0x6392=['type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','options','show','params','keys','include','FaxMessage','find','body','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','internal','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','save','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x4f5474,_0x5c5882){var _0x534d8a=function(_0xbc2c90){while(--_0xbc2c90){_0x4f5474['push'](_0x4f5474['shift']());}};_0x534d8a(++_0x5c5882);}(_0x6392,0xe3));var _0x2639=function(_0x11333b,_0x379784){_0x11333b=_0x11333b-0x0;var _0xc2a565=_0x6392[_0x11333b];return _0xc2a565;};'use strict';var emlformat=require(_0x2639('0x0'));var rimraf=require(_0x2639('0x1'));var zipdir=require(_0x2639('0x2'));var jsonpatch=require(_0x2639('0x3'));var rp=require(_0x2639('0x4'));var moment=require(_0x2639('0x5'));var BPromise=require(_0x2639('0x6'));var Mustache=require(_0x2639('0x7'));var util=require('util');var path=require(_0x2639('0x8'));var sox=require(_0x2639('0x9'));var csv=require(_0x2639('0xa'));var ejs=require(_0x2639('0xb'));var fs=require('fs');var fs_extra=require(_0x2639('0xc'));var _=require(_0x2639('0xd'));var squel=require(_0x2639('0xe'));var crypto=require(_0x2639('0xf'));var jsforce=require(_0x2639('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2639('0x11'));var Papa=require(_0x2639('0x12'));var Redis=require('ioredis');var authService=require(_0x2639('0x13'));var qs=require(_0x2639('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2639('0x15'));var logger=require(_0x2639('0x16'))('api');var utils=require(_0x2639('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2639('0x18')]=_[_0x2639('0x19')](config[_0x2639('0x18')],{'host':_0x2639('0x1a'),'port':0x18eb});var socket=require(_0x2639('0x1b'))(new Redis(config[_0x2639('0x18')]));require(_0x2639('0x1c'))[_0x2639('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2639('0x1e')][_0x2639('0x1f')]({'port':0x232c});var client9002=jayson[_0x2639('0x1e')][_0x2639('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x464dd6,_0x4f15f9,_0x1b017e,_0x39a233){return new BPromise(function(_0x2d1a23,_0x33edd4){var _0x422913=_0x39a233||client;return _0x422913[_0x2639('0x20')](_0x464dd6,_0x1b017e)[_0x2639('0x21')](function(_0x562a5a){logger[_0x2639('0x22')](_0x2639('0x23'),_0x4f15f9,_0x2639('0x24'));logger['debug'](_0x2639('0x25'),_0x4f15f9,_0x2639('0x24'),JSON[_0x2639('0x26')](_0x562a5a));if(_0x562a5a[_0x2639('0x27')]){if(_0x562a5a['error']['code']===0x1f4){logger[_0x2639('0x27')]('FaxMessage,\x20%s,\x20%s',_0x4f15f9,_0x562a5a[_0x2639('0x27')]['message']);return _0x33edd4(_0x562a5a[_0x2639('0x27')][_0x2639('0x28')]);}logger[_0x2639('0x27')]('FaxMessage,\x20%s,\x20%s',_0x4f15f9,_0x562a5a['error'][_0x2639('0x28')]);return _0x2d1a23(_0x562a5a[_0x2639('0x27')][_0x2639('0x28')]);}else{logger[_0x2639('0x22')](_0x2639('0x23'),_0x4f15f9,_0x2639('0x24'));_0x2d1a23(_0x562a5a[_0x2639('0x29')][_0x2639('0x28')]);}})[_0x2639('0x2a')](function(_0x20b2da){logger[_0x2639('0x27')]('FaxMessage,\x20%s,\x20%s',_0x4f15f9,_0x20b2da);_0x33edd4(_0x20b2da);});});}function respondWithStatusCode(_0x17b9ed,_0x34e9f2){_0x34e9f2=_0x34e9f2||0xcc;return function(_0x40c9ac){if(_0x40c9ac){return _0x17b9ed[_0x2639('0x2b')](_0x34e9f2);}return _0x17b9ed[_0x2639('0x2c')](_0x34e9f2)['end']();};}function respondWithResult(_0x57c4f5,_0x6f505){_0x6f505=_0x6f505||0xc8;return function(_0xec8aad){if(_0xec8aad){return _0x57c4f5[_0x2639('0x2c')](_0x6f505)[_0x2639('0x2d')](_0xec8aad);}};}function respondWithFilteredResult(_0x23751b,_0x2db183){return function(_0x23319c){if(_0x23319c){var _0x330741=typeof _0x2db183['offset']==='undefined'&&typeof _0x2db183[_0x2639('0x2e')]==='undefined';var _0xa3aa68=_0x23319c[_0x2639('0x2f')];var _0x40e137=_0x330741?0x0:_0x2db183[_0x2639('0x30')];var _0x2697e3=_0x330741?_0x23319c['count']:_0x2db183[_0x2639('0x30')]+_0x2db183[_0x2639('0x2e')];var _0x3f31ab;if(_0x2697e3>=_0xa3aa68){_0x2697e3=_0xa3aa68;_0x3f31ab=0xc8;}else{_0x3f31ab=0xce;}_0x23751b[_0x2639('0x2c')](_0x3f31ab);return _0x23751b[_0x2639('0x31')](_0x2639('0x32'),_0x40e137+'-'+_0x2697e3+'/'+_0xa3aa68)['json'](_0x23319c);}return null;};}function patchUpdates(_0x1c612c){return function(_0x49a45f){try{jsonpatch[_0x2639('0x33')](_0x49a45f,_0x1c612c,!![]);}catch(_0x41ecc5){return BPromise['reject'](_0x41ecc5);}return _0x49a45f[_0x2639('0x34')]();};}function saveUpdates(_0x31e3de,_0x50f33b){return function(_0x34968c){if(_0x34968c){return _0x34968c[_0x2639('0x35')](_0x31e3de)['then'](function(_0x52e2ce){return _0x52e2ce;});}return null;};}function removeEntity(_0xef4ba3,_0x120b2f){return function(_0x5e2da5){if(_0x5e2da5){return _0x5e2da5[_0x2639('0x36')]()[_0x2639('0x21')](function(){_0xef4ba3['status'](0xcc)[_0x2639('0x37')]();});}};}function handleEntityNotFound(_0x494d07,_0x22ceb6){return function(_0x2bd372){if(!_0x2bd372){_0x494d07[_0x2639('0x2b')](0x194);}return _0x2bd372;};}function handleError(_0x2c258f,_0x476558){_0x476558=_0x476558||0x1f4;return function(_0xb20c03){logger['error'](_0xb20c03[_0x2639('0x38')]);if(_0xb20c03[_0x2639('0x39')]){delete _0xb20c03[_0x2639('0x39')];}_0x2c258f['status'](_0x476558)[_0x2639('0x3a')](_0xb20c03);};}exports[_0x2639('0x3b')]=function(_0x4a451d,_0x5a4a9c){var _0x38aab0={},_0x339c17={},_0x1de917={'count':0x0,'rows':[]};var _0x2b98d2=_[_0x2639('0x3c')](db['FaxMessage'][_0x2639('0x3d')],function(_0x421771){return{'name':_0x421771[_0x2639('0x3e')],'type':_0x421771[_0x2639('0x3f')][_0x2639('0x40')]};});_0x339c17[_0x2639('0x41')]=_['map'](_0x2b98d2,_0x2639('0x39'));_0x339c17['query']=_['keys'](_0x4a451d['query']);_0x339c17['filters']=_['intersection'](_0x339c17[_0x2639('0x41')],_0x339c17[_0x2639('0x42')]);_0x38aab0['attributes']=_[_0x2639('0x43')](_0x339c17[_0x2639('0x41')],qs[_0x2639('0x44')](_0x4a451d[_0x2639('0x42')][_0x2639('0x44')]));_0x38aab0['attributes']=_0x38aab0[_0x2639('0x45')][_0x2639('0x46')]?_0x38aab0[_0x2639('0x45')]:_0x339c17[_0x2639('0x41')];if(!_0x4a451d[_0x2639('0x42')][_0x2639('0x47')](_0x2639('0x48'))){_0x38aab0[_0x2639('0x2e')]=qs['limit'](_0x4a451d[_0x2639('0x42')][_0x2639('0x2e')]);_0x38aab0[_0x2639('0x30')]=qs['offset'](_0x4a451d[_0x2639('0x42')]['offset']);}_0x38aab0[_0x2639('0x49')]=qs['sort'](_0x4a451d[_0x2639('0x42')]['sort']);_0x38aab0[_0x2639('0x4a')]=qs[_0x2639('0x4b')](_[_0x2639('0x4c')](_0x4a451d[_0x2639('0x42')],_0x339c17[_0x2639('0x4b')]),_0x2b98d2);if(_0x4a451d['query'][_0x2639('0x4d')]){_0x38aab0[_0x2639('0x4a')]=_[_0x2639('0x4e')](_0x38aab0[_0x2639('0x4a')],{'$or':_[_0x2639('0x3c')](_0x2b98d2,function(_0x250627){if(_0x250627['type']!=='VIRTUAL'){var _0x2afa6e={};_0x2afa6e[_0x250627['name']]={'$like':'%'+_0x4a451d[_0x2639('0x42')][_0x2639('0x4d')]+'%'};return _0x2afa6e;}})});}_0x38aab0=_[_0x2639('0x4e')]({},_0x38aab0,_0x4a451d[_0x2639('0x4f')]);var _0x1a3936={'where':_0x38aab0['where']};return db['FaxMessage'][_0x2639('0x2f')](_0x1a3936)[_0x2639('0x21')](function(_0x44622d){_0x1de917[_0x2639('0x2f')]=_0x44622d;if(_0x4a451d[_0x2639('0x42')]['includeAll']){_0x38aab0['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x38aab0);})[_0x2639('0x21')](function(_0x3380f6){_0x1de917['rows']=_0x3380f6;return _0x1de917;})[_0x2639('0x21')](respondWithFilteredResult(_0x5a4a9c,_0x38aab0))[_0x2639('0x2a')](handleError(_0x5a4a9c,null));};exports[_0x2639('0x50')]=function(_0x27f9f5,_0x4b8b3c){var _0x5816e4={'raw':!![],'where':{'id':_0x27f9f5[_0x2639('0x51')]['id']}},_0x433cad={};_0x433cad['model']=_['keys'](db['FaxMessage'][_0x2639('0x3d')]);_0x433cad[_0x2639('0x42')]=_[_0x2639('0x52')](_0x27f9f5[_0x2639('0x42')]);_0x433cad[_0x2639('0x4b')]=_[_0x2639('0x43')](_0x433cad[_0x2639('0x41')],_0x433cad[_0x2639('0x42')]);_0x5816e4[_0x2639('0x45')]=_[_0x2639('0x43')](_0x433cad[_0x2639('0x41')],qs[_0x2639('0x44')](_0x27f9f5[_0x2639('0x42')]['fields']));_0x5816e4[_0x2639('0x45')]=_0x5816e4[_0x2639('0x45')][_0x2639('0x46')]?_0x5816e4[_0x2639('0x45')]:_0x433cad[_0x2639('0x41')];if(_0x27f9f5[_0x2639('0x42')]['includeAll']){_0x5816e4[_0x2639('0x53')]=[{'all':!![]}];}_0x5816e4=_['merge']({},_0x5816e4,_0x27f9f5['options']);return db[_0x2639('0x54')][_0x2639('0x55')](_0x5816e4)[_0x2639('0x21')](handleEntityNotFound(_0x4b8b3c,null))[_0x2639('0x21')](respondWithResult(_0x4b8b3c,null))['catch'](handleError(_0x4b8b3c,null));};exports[_0x2639('0x35')]=function(_0x5521ec,_0x16844b){if(_0x5521ec['body']['id']){delete _0x5521ec[_0x2639('0x56')]['id'];}return db[_0x2639('0x54')][_0x2639('0x55')]({'where':{'id':_0x5521ec[_0x2639('0x51')]['id']}})['then'](handleEntityNotFound(_0x16844b,null))['then'](saveUpdates(_0x5521ec[_0x2639('0x56')],null))[_0x2639('0x21')](respondWithResult(_0x16844b,null))[_0x2639('0x2a')](handleError(_0x16844b,null));};exports[_0x2639('0x36')]=function(_0x25c8a1,_0xd85e86){return db[_0x2639('0x54')][_0x2639('0x55')]({'where':{'id':_0x25c8a1[_0x2639('0x51')]['id']}})['then'](handleEntityNotFound(_0xd85e86,null))['then'](removeEntity(_0xd85e86,null))['catch'](handleError(_0xd85e86,null));};exports[_0x2639('0x57')]=function(_0x2addca,_0x4a6665){return db[_0x2639('0x54')]['describe']()[_0x2639('0x21')](respondWithResult(_0x4a6665,null))[_0x2639('0x2a')](handleError(_0x4a6665,null));};var interaction_log=require(_0x2639('0x16'))(_0x2639('0x58'));exports[_0x2639('0x59')]=function(_0x5470e1,_0x398ab0,_0x4140d9){var _0x5926c2={'agent':{},'channel':_0x2639('0x5a')};if(_0x5470e1[_0x2639('0x56')]['id']){delete _0x5470e1[_0x2639('0x56')]['id'];}_0x5470e1[_0x2639('0x56')][_0x2639('0x5b')]=!![];_0x5470e1[_0x2639('0x56')]['readAt']=moment()[_0x2639('0x5c')](_0x2639('0x5d'));_0x5470e1[_0x2639('0x56')][_0x2639('0x5e')]=_0x5470e1[_0x2639('0x56')][_0x2639('0x5e')]||_0x5470e1[_0x2639('0x5f')]['id'];_0x5926c2[_0x2639('0x60')]['id']=_0x5470e1[_0x2639('0x56')][_0x2639('0x5e')];return db['FaxMessage'][_0x2639('0x55')]({'where':{'id':_0x5470e1[_0x2639('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x398ab0,null))[_0x2639('0x21')](saveUpdates(_0x5470e1[_0x2639('0x56')],null))[_0x2639('0x21')](function(_0x3c1139){if(_0x3c1139){_0x5926c2['message']=_0x3c1139[_0x2639('0x61')]({'plain':!![]});return db['FaxInteraction'][_0x2639('0x55')]({'where':{'id':_0x3c1139[_0x2639('0x62')]}});}return null;})[_0x2639('0x21')](handleEntityNotFound(_0x398ab0,null))[_0x2639('0x21')](function(_0x439728){if(_0x439728){return _0x439728[_0x2639('0x35')]({'UserId':_0x5470e1[_0x2639('0x56')][_0x2639('0x5e')],'read1stAt':_[_0x2639('0x63')](_0x439728[_0x2639('0x64')])?moment()[_0x2639('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2639('0x21')](function(_0x1279c0){if(_0x1279c0){_0x5926c2[_0x2639('0x65')]=_0x1279c0[_0x2639('0x61')]({'plain':!![]});interaction_log[_0x2639('0x22')](_0x2639('0x66'),_0x5470e1[_0x2639('0x5f')]['id'],_0x5470e1[_0x2639('0x5f')][_0x2639('0x39')],_0x5470e1['user'][_0x2639('0x67')],_0x5926c2[_0x2639('0x65')]['id'],_0x5470e1[_0x2639('0x56')]?JSON[_0x2639('0x26')](_0x5470e1[_0x2639('0x56')]):_0x2639('0x68'));return respondWithRpcPromise(_0x2639('0x69'),_0x2639('0x6a'),_0x5926c2);}return null;})['then'](function(_0x371108){var _0x5433cb=_0x2639('0x6b')+_0x371108['message'][_0x2639('0x6c')];return db[_0x2639('0x6d')][_0x2639('0x42')](_0x5433cb,{'type':db['Sequelize'][_0x2639('0x6e')]['SELECT'],'raw':!![]})[_0x2639('0x21')](function(_0x1adc19){return _0x1adc19;});})['then'](function(_0x52e7c8){if(_0x52e7c8){_0x5926c2[_0x2639('0x28')][_0x2639('0x6f')]=_0x52e7c8[0x0];if(!_0x5470e1[_0x2639('0x56')][_0x2639('0x5e')])return;return db[_0x2639('0x70')][_0x2639('0x55')]({'where':{'id':_0x5470e1[_0x2639('0x56')]['UserId'],'role':_0x2639('0x60')},'attributes':['id','name',_0x2639('0x71'),_0x2639('0x72'),'internal'],'raw':!![]});}return null;})[_0x2639('0x21')](function(_0x84364f){if(!_0x84364f)return null;_0x5926c2[_0x2639('0x28')][_0x2639('0x60')]=_0x84364f;return _0x5926c2;})['then'](function(_0x43109d){if(_0x43109d){if(_0x5470e1[_0x2639('0x56')][_0x2639('0x73')]){_0x5926c2[_0x2639('0x28')][_0x2639('0x74')]=util[_0x2639('0x5c')](_0x2639('0x75'),_0x5470e1[_0x2639('0x5f')][_0x2639('0x39')]);_0x5926c2['message'][_0x2639('0x76')]=_0x5926c2[_0x2639('0x76')];_0x5926c2[_0x2639('0x28')][_0x2639('0x77')]=_0x5926c2[_0x2639('0x76')];_0x5926c2[_0x2639('0x28')][_0x2639('0x78')]=_0x2639('0x59');return respondWithRpcPromise(_0x2639('0x79'),_0x2639('0x79'),{'event':_0x2639('0x7a'),'message':_0x5926c2['message']},client9002)['then'](function(){return _0x5926c2;});}return _0x5926c2;}return null;})[_0x2639('0x21')](respondWithResult(_0x398ab0,null))[_0x2639('0x2a')](handleError(_0x398ab0,null));};var interaction_log=require(_0x2639('0x16'))(_0x2639('0x58'));exports[_0x2639('0x7b')]=function(_0x36231f,_0x1c9a77,_0x4ac0d){var _0x5bff89={'agent':{},'channel':_0x2639('0x5a')};if(_0x36231f[_0x2639('0x56')]['id']){delete _0x36231f['body']['id'];}_0x36231f['body'][_0x2639('0x5e')]=_0x36231f[_0x2639('0x56')]['UserId']||_0x36231f['user']['id'];_0x5bff89[_0x2639('0x60')]['id']=_0x36231f[_0x2639('0x56')][_0x2639('0x5e')];return db[_0x2639('0x54')][_0x2639('0x55')]({'where':{'id':_0x36231f[_0x2639('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1c9a77,null))[_0x2639('0x21')](function(_0x250160){if(_0x250160){_0x5bff89[_0x2639('0x28')]=_0x250160[_0x2639('0x61')]({'plain':!![]});return db[_0x2639('0x7c')]['find']({'where':{'id':_0x250160['FaxInteractionId']}});}return null;})[_0x2639('0x21')](handleEntityNotFound(_0x1c9a77,null))[_0x2639('0x21')](function(_0x3594a2){if(_0x3594a2){_0x5bff89[_0x2639('0x65')]=_0x3594a2['get']({'plain':!![]});interaction_log[_0x2639('0x22')](_0x2639('0x7d'),_0x36231f[_0x2639('0x5f')]['id'],_0x36231f[_0x2639('0x5f')][_0x2639('0x39')],_0x36231f[_0x2639('0x5f')][_0x2639('0x67')],_0x5bff89[_0x2639('0x65')]['id'],_0x36231f[_0x2639('0x56')]?JSON[_0x2639('0x26')](_0x36231f[_0x2639('0x56')]):'null');return respondWithRpcPromise(_0x2639('0x7e'),'rejectMessage',_0x5bff89);}return null;})[_0x2639('0x21')](function(_0x28ee01){var _0x41dd1a=_0x2639('0x6b')+_0x28ee01[_0x2639('0x28')][_0x2639('0x6c')];return db[_0x2639('0x6d')][_0x2639('0x42')](_0x41dd1a,{'type':db[_0x2639('0x7f')][_0x2639('0x6e')]['SELECT'],'raw':!![]})['then'](function(_0x54c17e){return _0x54c17e;});})[_0x2639('0x21')](function(_0x579502){if(_0x579502){_0x5bff89[_0x2639('0x28')][_0x2639('0x6f')]=_0x579502[0x0];if(!_0x36231f['body'][_0x2639('0x5e')])return;return db[_0x2639('0x70')][_0x2639('0x55')]({'where':{'id':_0x36231f[_0x2639('0x56')][_0x2639('0x5e')],'role':_0x2639('0x60')},'attributes':['id',_0x2639('0x39'),_0x2639('0x71'),_0x2639('0x72'),_0x2639('0x80')],'raw':!![]});}return null;})[_0x2639('0x21')](function(_0x4f0dce){if(!_0x4f0dce)return null;_0x5bff89['message'][_0x2639('0x60')]=_0x4f0dce;return _0x5bff89;})['then'](function(_0x3805d8){if(_0x3805d8){_0x3805d8[_0x2639('0x28')][_0x2639('0x74')]=util[_0x2639('0x5c')]('SIP/%s',_0x36231f['user']['name']);_0x3805d8[_0x2639('0x28')][_0x2639('0x76')]=_0x5bff89[_0x2639('0x76')];_0x3805d8[_0x2639('0x28')][_0x2639('0x77')]=_0x5bff89['channel'];_0x3805d8[_0x2639('0x28')][_0x2639('0x78')]=_0x2639('0x7b');respondWithRpcPromise(_0x2639('0x79'),_0x2639('0x79'),{'event':_0x2639('0x81'),'message':_0x3805d8['message']},client9002);return _0x5bff89;}return null;})[_0x2639('0x21')](respondWithResult(_0x1c9a77,null))[_0x2639('0x2a')](handleError(_0x1c9a77,null));};exports[_0x2639('0x82')]=function(_0x19c80a,_0x5a26b8){var _0x5326b1;return db[_0x2639('0x54')][_0x2639('0x82')](_0x19c80a['body'],{})[_0x2639('0x21')](function(_0x22627e){_0x5326b1=_0x22627e;return db[_0x2639('0x83')][_0x2639('0x84')]({'where':{'id':_0x5326b1['ContactId']}});})[_0x2639('0x21')](function(_0x68c3d4){if(_[_0x2639('0x63')](_0x68c3d4)){return;}else{_0x5326b1[_0x2639('0x5a')]=_0x68c3d4[_0x2639('0x5a')];return db[_0x2639('0x85')][_0x2639('0x84')]({'where':{'id':_0x5326b1[_0x2639('0x86')]}});}})[_0x2639('0x21')](function(_0x53b7ac){return respondWithRpcPromise('SendFax',_0x2639('0x87'),{'FaxAccountId':_[_0x2639('0x63')](_0x19c80a[_0x2639('0x56')])?undefined:_0x19c80a[_0x2639('0x56')][_0x2639('0x88')],'path':_[_0x2639('0x63')](_0x53b7ac)?undefined:util[_0x2639('0x5c')](_0x2639('0x89'),_0x53b7ac['basename']),'fax':_[_0x2639('0x63')](_0x5326b1[_0x2639('0x5a')])?undefined:_0x5326b1[_0x2639('0x5a')],'AttachmentId':_0x5326b1['AttachmentId']},client9002);})[_0x2639('0x21')](respondWithResult(_0x5a26b8,0xc9))[_0x2639('0x2a')](handleError(_0x5a26b8,null));};exports[_0x2639('0x8a')]=function(_0x35bd4d,_0x1e973f){var _0x249957=path[_0x2639('0x8b')](config[_0x2639('0x8c')],_0x2639('0x8d'),_0x2639('0x8e'),_0x2639('0x8f'));return db['FaxMessage'][_0x2639('0x55')]({'where':{'id':_0x35bd4d[_0x2639('0x51')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x2639('0x21')](handleEntityNotFound(_0x1e973f,null))[_0x2639('0x21')](function(_0x598838){if(_0x598838){return _0x1e973f[_0x2639('0x8a')](path['join'](_0x249957,_0x598838[_0x2639('0x85')][_0x2639('0x90')]));}})['catch'](handleError(_0x1e973f,null));};
\ No newline at end of file
index 011d9ab..4242956 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x20de=['update','remove','emit','hook','events','FaxMessage','setMaxListeners','save'];(function(_0x2bf198,_0x51f391){var _0x331c0e=function(_0xd9273b){while(--_0xd9273b){_0x2bf198['push'](_0x2bf198['shift']());}};_0x331c0e(++_0x51f391);}(_0x20de,0x134));var _0xe20d=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x20de[_0x35da42];return _0x370035;};'use strict';var EventEmitter=require(_0xe20d('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xe20d('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xe20d('0x2')](0x0);var events={'afterCreate':_0xe20d('0x3'),'afterUpdate':_0xe20d('0x4'),'afterDestroy':_0xe20d('0x5')};function emitEvent(_0x39a7f3){return function(_0x31c533,_0x174186,_0x7b02d6){FaxMessageEvents[_0xe20d('0x6')](_0x39a7f3+':'+_0x31c533['id'],_0x31c533);FaxMessageEvents[_0xe20d('0x6')](_0x39a7f3,_0x31c533);_0x7b02d6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xe20d('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents;
\ No newline at end of file
+var _0x55c1=['hasOwnProperty','exports','events','../../mysqldb','update','remove','emit'];(function(_0x36e5d5,_0x46bdd3){var _0x1cca07=function(_0x195808){while(--_0x195808){_0x36e5d5['push'](_0x36e5d5['shift']());}};_0x1cca07(++_0x46bdd3);}(_0x55c1,0x1e5));var _0x155c=function(_0x3c0c92,_0x267969){_0x3c0c92=_0x3c0c92-0x0;var _0xe3859b=_0x55c1[_0x3c0c92];return _0xe3859b;};'use strict';var EventEmitter=require(_0x155c('0x0'));var FaxMessage=require(_0x155c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x155c('0x2'),'afterDestroy':_0x155c('0x3')};function emitEvent(_0x30444a){return function(_0x64c8aa,_0xb127e8,_0x5305d5){FaxMessageEvents[_0x155c('0x4')](_0x30444a+':'+_0x64c8aa['id'],_0x64c8aa);FaxMessageEvents[_0x155c('0x4')](_0x30444a,_0x64c8aa);_0x5305d5(null);};}for(var e in events){if(events[_0x155c('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x155c('0x6')]=FaxMessageEvents;
\ No newline at end of file
index 1d8eef2..fdea3e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf37f=['path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','body','models','get','toLowerCase','direction','secret','isNil','UserId','FaxInteraction','findOne','then','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0xf37f,0x140));var _0xff37=function(_0x28b5cc,_0x5e2395){_0x28b5cc=_0x28b5cc-0x0;var _0x5ac9f3=_0xf37f[_0x28b5cc];return _0x5ac9f3;};'use strict';var _=require(_0xff37('0x0'));var util=require(_0xff37('0x1'));var logger=require(_0xff37('0x2'))('api');var moment=require(_0xff37('0x3'));var BPromise=require('bluebird');var rp=require(_0xff37('0x4'));var fs=require('fs');var path=require(_0xff37('0x5'));var rimraf=require('rimraf');var config=require(_0xff37('0x6'));var attributes=require(_0xff37('0x7'));module[_0xff37('0x8')]=function(_0x389d59,_0x521c9b){return _0x389d59[_0xff37('0x9')](_0xff37('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xff37('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a605d,_0x350d3b,_0x56509b){var _0x3b73a6=_0x389d59[_0xff37('0xc')];var _0x200678=_0x3a605d[_0xff37('0xd')]({'plain':!![]});if(_0x200678['direction'][_0xff37('0xe')]()==='in'||_0x200678[_0xff37('0xf')][_0xff37('0xe')]()==='out'&&!_0x200678[_0xff37('0x10')]&&!_[_0xff37('0x11')](_0x200678[_0xff37('0x12')])){_0x3b73a6[_0xff37('0x13')][_0xff37('0x14')]({'where':{'id':_0x200678['FaxInteractionId']}})[_0xff37('0x15')](function(_0x40577e){if(_0x40577e){_0x40577e['update']({'lastMsgAt':_0x200678['createdAt'],'lastMsgDirection':_0x200678[_0xff37('0xf')][_0xff37('0xe')]()});}})[_0xff37('0x16')](function(_0x60eb77){console[_0xff37('0x17')](_0x60eb77);});}_0x56509b();}},'charset':'utf8mb4','collate':_0xff37('0x18')});};
\ No newline at end of file
+var _0x3e20=['createdAt','direction','error','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','get','toLowerCase','out','secret','UserId','FaxInteraction','findOne','then','update'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x3e20,0x1eb));var _0x03e2=function(_0x17d02d,_0xd6dcba){_0x17d02d=_0x17d02d-0x0;var _0x558144=_0x3e20[_0x17d02d];return _0x558144;};'use strict';var _=require(_0x03e2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x03e2('0x1'));var moment=require(_0x03e2('0x2'));var BPromise=require('bluebird');var rp=require(_0x03e2('0x3'));var fs=require('fs');var path=require(_0x03e2('0x4'));var rimraf=require(_0x03e2('0x5'));var config=require('../../config/environment');var attributes=require(_0x03e2('0x6'));module[_0x03e2('0x7')]=function(_0x52f376,_0x2136d6){return _0x52f376[_0x03e2('0x8')](_0x03e2('0x9'),attributes,{'tableName':_0x03e2('0xa'),'paranoid':![],'indexes':[{'name':_0x03e2('0xb'),'fields':['body'],'type':_0x03e2('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d1c9f,_0x5a57c6,_0x55ac93){var _0x211241=_0x52f376['models'];var _0x35ae2c=_0x3d1c9f[_0x03e2('0xd')]({'plain':!![]});if(_0x35ae2c['direction'][_0x03e2('0xe')]()==='in'||_0x35ae2c['direction'][_0x03e2('0xe')]()===_0x03e2('0xf')&&!_0x35ae2c[_0x03e2('0x10')]&&!_['isNil'](_0x35ae2c[_0x03e2('0x11')])){_0x211241[_0x03e2('0x12')][_0x03e2('0x13')]({'where':{'id':_0x35ae2c['FaxInteractionId']}})[_0x03e2('0x14')](function(_0x4576a9){if(_0x4576a9){_0x4576a9[_0x03e2('0x15')]({'lastMsgAt':_0x35ae2c[_0x03e2('0x16')],'lastMsgDirection':_0x35ae2c[_0x03e2('0x17')][_0x03e2('0xe')]()});}})['catch'](function(_0x3c3e5a){console[_0x03e2('0x18')](_0x3c3e5a);});}_0x55ac93();}},'charset':_0x03e2('0x19'),'collate':_0x03e2('0x1a')});};
\ No newline at end of file
index ab4d881..6643519 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','body','options','raw','CreateFaxMessage','catch','UpdateFaxMessage','FaxMessage','where','attributes','lodash'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});config[_0x7995('0xc')]=_[_0x7995('0xd')](config['redis'],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require(_0x7995('0xf'))(new Redis(config['redis']));require(_0x7995('0x10'))[_0x7995('0x11')](socket);function respondWithRpcPromise(_0x18c8a3,_0x35b5fe,_0x3c1d19){return new BPromise(function(_0x1e400a,_0x341672){return client['request'](_0x18c8a3,_0x3c1d19)[_0x7995('0x12')](function(_0x41c652){logger['info'](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x35b5fe,_0x7995('0x14'),JSON[_0x7995('0x17')](_0x41c652));if(_0x41c652[_0x7995('0x18')]){if(_0x41c652['error']['code']===0x1f4){logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);return _0x341672(_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);}logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652['error'][_0x7995('0x19')]);return _0x1e400a(_0x41c652['error'][_0x7995('0x19')]);}else{logger[_0x7995('0x1a')](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));_0x1e400a(_0x41c652[_0x7995('0x1b')][_0x7995('0x19')]);}})['catch'](function(_0x54c9ae){logger[_0x7995('0x18')]('FaxMessage,\x20%s,\x20%s',_0x35b5fe,_0x54c9ae);_0x341672(_0x54c9ae);});});}exports['CreateFaxMessage']=function(_0x3ec178){var _0x3d463e=this;return new Promise(function(_0x4cbe10,_0x3a9b54){return db['FaxMessage']['create'](_0x3ec178[_0x7995('0x1c')],{'raw':_0x3ec178[_0x7995('0x1d')]?_0x3ec178[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![]})[_0x7995('0x12')](function(_0x1c278a){logger['info'](_0x7995('0x1f'),_0x3ec178);logger[_0x7995('0x15')](_0x7995('0x1f'),_0x3ec178,JSON[_0x7995('0x17')](_0x1c278a));_0x4cbe10(_0x1c278a);})[_0x7995('0x20')](function(_0x13bc35){logger[_0x7995('0x18')](_0x7995('0x1f'),_0x13bc35['message'],_0x3ec178);_0x3a9b54(_0x3d463e[_0x7995('0x18')](0x1f4,_0x13bc35[_0x7995('0x19')]));});});};exports[_0x7995('0x21')]=function(_0x268ce7){var _0x3a3fcf=this;return new Promise(function(_0x2a307e,_0x56691a){return db[_0x7995('0x22')]['update'](_0x268ce7[_0x7995('0x1c')],{'raw':_0x268ce7[_0x7995('0x1d')]?_0x268ce7[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options'][_0x7995('0x23')]||null:null,'attributes':_0x268ce7['options']?_0x268ce7[_0x7995('0x1d')][_0x7995('0x24')]||null:null,'limit':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options']['limit']||null:null})['then'](function(_0x3573be){logger[_0x7995('0x1a')](_0x7995('0x21'),_0x268ce7);logger[_0x7995('0x15')](_0x7995('0x21'),_0x268ce7,JSON[_0x7995('0x17')](_0x3573be));_0x2a307e(_0x3573be);})['catch'](function(_0x481c74){logger[_0x7995('0x18')]('UpdateFaxMessage',_0x481c74[_0x7995('0x19')],_0x268ce7);_0x56691a(_0x3a3fcf[_0x7995('0x18')](0x1f4,_0x481c74[_0x7995('0x19')]));});});};
\ No newline at end of file
+var _0xd6d6=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','info','CreateFaxMessage','update','where','limit','UpdateFaxMessage'];(function(_0x5db0d6,_0x2d6013){var _0x4b48ac=function(_0xf12dbb){while(--_0xf12dbb){_0x5db0d6['push'](_0x5db0d6['shift']());}};_0x4b48ac(++_0x2d6013);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x38bb64,_0x4c4f8e){_0x38bb64=_0x38bb64-0x0;var _0x14c7f4=_0xd6d6[_0x38bb64];return _0x14c7f4;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});config[_0x6d6d('0xc')]=_[_0x6d6d('0xd')](config[_0x6d6d('0xc')],{'host':_0x6d6d('0xe'),'port':0x18eb});var socket=require(_0x6d6d('0xf'))(new Redis(config[_0x6d6d('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x404c88,_0x1fa46d,_0x23b18a){return new BPromise(function(_0x290dfb,_0xf84314){return client['request'](_0x404c88,_0x23b18a)[_0x6d6d('0x10')](function(_0x158f82){logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fa46d,_0x6d6d('0x11'));logger[_0x6d6d('0x12')](_0x6d6d('0x13'),_0x1fa46d,_0x6d6d('0x11'),JSON[_0x6d6d('0x14')](_0x158f82));if(_0x158f82[_0x6d6d('0x15')]){if(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x16')]===0x1f4){logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);return _0xf84314(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);}logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x158f82['error'][_0x6d6d('0x18')]);return _0x290dfb(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fa46d,_0x6d6d('0x11'));_0x290dfb(_0x158f82[_0x6d6d('0x19')][_0x6d6d('0x18')]);}})[_0x6d6d('0x1a')](function(_0x51fff6){logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x51fff6);_0xf84314(_0x51fff6);});});}exports['CreateFaxMessage']=function(_0x26f631){var _0xb8590d=this;return new Promise(function(_0x30d87d,_0x450352){return db[_0x6d6d('0x1b')][_0x6d6d('0x1c')](_0x26f631[_0x6d6d('0x1d')],{'raw':_0x26f631[_0x6d6d('0x1e')]?_0x26f631[_0x6d6d('0x1e')][_0x6d6d('0x1f')]===undefined?!![]:![]:!![]})[_0x6d6d('0x10')](function(_0x6e58e3){logger[_0x6d6d('0x20')](_0x6d6d('0x21'),_0x26f631);logger[_0x6d6d('0x12')](_0x6d6d('0x21'),_0x26f631,JSON[_0x6d6d('0x14')](_0x6e58e3));_0x30d87d(_0x6e58e3);})['catch'](function(_0x3b73e5){logger[_0x6d6d('0x15')](_0x6d6d('0x21'),_0x3b73e5[_0x6d6d('0x18')],_0x26f631);_0x450352(_0xb8590d[_0x6d6d('0x15')](0x1f4,_0x3b73e5[_0x6d6d('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x2851dd){var _0x2b5e31=this;return new Promise(function(_0x235451,_0x126ac8){return db[_0x6d6d('0x1b')][_0x6d6d('0x22')](_0x2851dd[_0x6d6d('0x1d')],{'raw':_0x2851dd['options']?_0x2851dd[_0x6d6d('0x1e')][_0x6d6d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2851dd['options']?_0x2851dd['options'][_0x6d6d('0x23')]||null:null,'attributes':_0x2851dd[_0x6d6d('0x1e')]?_0x2851dd[_0x6d6d('0x1e')]['attributes']||null:null,'limit':_0x2851dd[_0x6d6d('0x1e')]?_0x2851dd[_0x6d6d('0x1e')][_0x6d6d('0x24')]||null:null})[_0x6d6d('0x10')](function(_0x64d1f7){logger[_0x6d6d('0x20')](_0x6d6d('0x25'),_0x2851dd);logger[_0x6d6d('0x12')](_0x6d6d('0x25'),_0x2851dd,JSON[_0x6d6d('0x14')](_0x64d1f7));_0x235451(_0x64d1f7);})['catch'](function(_0x1f9469){logger['error'](_0x6d6d('0x25'),_0x1f9469[_0x6d6d('0x18')],_0x2851dd);_0x126ac8(_0x2b5e31[_0x6d6d('0x15')](0x1f4,_0x1f9469[_0x6d6d('0x18')]));});});};
\ No newline at end of file
index 9b9409a..c49a9f9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc776=['register','faxMessage:','./faxMessage.events','save','update','emit','removeListener'];(function(_0x34a4b4,_0x551aaa){var _0x389d81=function(_0x168bce){while(--_0x168bce){_0x34a4b4['push'](_0x34a4b4['shift']());}};_0x389d81(++_0x551aaa);}(_0xc776,0xf7));var _0x6c77=function(_0x224158,_0x1972da){_0x224158=_0x224158-0x0;var _0x3c8c97=_0xc776[_0x224158];return _0x3c8c97;};'use strict';var FaxMessageEvents=require(_0x6c77('0x0'));var events=[_0x6c77('0x1'),'remove',_0x6c77('0x2')];function createListener(_0x2cff21,_0x5d9818){return function(_0x1a8af9){_0x5d9818[_0x6c77('0x3')](_0x2cff21,_0x1a8af9);};}function removeListener(_0x1345ad,_0x2c865a){return function(){FaxMessageEvents[_0x6c77('0x4')](_0x1345ad,_0x2c865a);};}exports[_0x6c77('0x5')]=function(_0x24f4a4){for(var _0x502cee=0x0,_0x1b0ff2=events['length'];_0x502cee<_0x1b0ff2;_0x502cee++){var _0x40c107=events[_0x502cee];var _0x402e37=createListener(_0x6c77('0x6')+_0x40c107,_0x24f4a4);FaxMessageEvents['on'](_0x40c107,_0x402e37);}};
\ No newline at end of file
+var _0x5626=['emit','removeListener','register','length','faxMessage:','save','remove','update'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0x5626,0x1a5));var _0x6562=function(_0x4787f2,_0x1c8856){_0x4787f2=_0x4787f2-0x0;var _0xaccaa7=_0x5626[_0x4787f2];return _0xaccaa7;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x6562('0x0'),_0x6562('0x1'),_0x6562('0x2')];function createListener(_0x1f11cb,_0x274c5a){return function(_0x48b04b){_0x274c5a[_0x6562('0x3')](_0x1f11cb,_0x48b04b);};}function removeListener(_0x55d37c,_0x3419cc){return function(){FaxMessageEvents[_0x6562('0x4')](_0x55d37c,_0x3419cc);};}exports[_0x6562('0x5')]=function(_0x5b3ce5){for(var _0x524d41=0x0,_0x58f415=events[_0x6562('0x6')];_0x524d41<_0x58f415;_0x524d41++){var _0x4392cb=events[_0x524d41];var _0x21b530=createListener(_0x6562('0x7')+_0x4392cb,_0x5b3ce5);FaxMessageEvents['on'](_0x4392cb,_0x21b530);}};
\ No newline at end of file
index 9ab81bb..86f606d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x16d2=['./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3e32a8,_0x255953){var _0x2997b0=function(_0x2d564a){while(--_0x2d564a){_0x3e32a8['push'](_0x3e32a8['shift']());}};_0x2997b0(++_0x255953);}(_0x16d2,0x123));var _0x216d=function(_0xa1181c,_0x1724a4){_0xa1181c=_0xa1181c-0x0;var _0x1ef296=_0x16d2[_0xa1181c];return _0x1ef296;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var fs_extra=require(_0x216d('0x6'));var auth=require(_0x216d('0x7'));var interaction=require(_0x216d('0x8'));var config=require('../../config/environment');var controller=require(_0x216d('0x9'));router[_0x216d('0xa')]('/',auth[_0x216d('0xb')](),controller[_0x216d('0xc')]);router[_0x216d('0xa')](_0x216d('0xd'),auth[_0x216d('0xb')](),controller[_0x216d('0xe')]);router['get'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x10')]);router[_0x216d('0xa')](_0x216d('0x11'),auth[_0x216d('0xb')](),controller['download']);router[_0x216d('0x12')]('/',auth['isAuthenticated'](),interaction[_0x216d('0x13')](_0x216d('0x14'),_0x216d('0x15')),controller[_0x216d('0x16')]);router[_0x216d('0x17')](_0x216d('0xf'),auth['isAuthenticated'](),controller[_0x216d('0x18')]);router['put'](_0x216d('0x19'),auth[_0x216d('0xb')](),controller['accept']);router[_0x216d('0x17')](_0x216d('0x1a'),auth['isAuthenticated'](),controller[_0x216d('0x1b')]);router['delete'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x1c')]);module[_0x216d('0x1d')]=router;
\ No newline at end of file
+var _0x222f=['/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/download','post','tracked','fax','create','put','update','/:id/accept'];(function(_0x185c5e,_0x1b05f5){var _0x14053a=function(_0xd55b4){while(--_0xd55b4){_0x185c5e['push'](_0x185c5e['shift']());}};_0x14053a(++_0x1b05f5);}(_0x222f,0x1a4));var _0xf222=function(_0x46e182,_0x1046a8){_0x46e182=_0x46e182-0x0;var _0x42ade0=_0x222f[_0x46e182];return _0x42ade0;};'use strict';var multer=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var path=require(_0xf222('0x2'));var timeout=require(_0xf222('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf222('0x4'));var auth=require(_0xf222('0x5'));var interaction=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var controller=require('./faxMessage.controller');router[_0xf222('0x8')]('/',auth['isAuthenticated'](),controller[_0xf222('0x9')]);router[_0xf222('0x8')]('/describe',auth[_0xf222('0xa')](),controller[_0xf222('0xb')]);router['get'](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0xd')]);router[_0xf222('0x8')](_0xf222('0xe'),auth[_0xf222('0xa')](),controller['download']);router[_0xf222('0xf')]('/',auth[_0xf222('0xa')](),interaction[_0xf222('0x10')](_0xf222('0x11'),'faxmessage:create'),controller[_0xf222('0x12')]);router[_0xf222('0x13')](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0x14')]);router[_0xf222('0x13')](_0xf222('0x15'),auth[_0xf222('0xa')](),controller['accept']);router['put'](_0xf222('0x16'),auth[_0xf222('0xa')](),controller['reject']);router[_0xf222('0x17')](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0x18')]);module[_0xf222('0x19')]=router;
\ No newline at end of file
index 3c16086..0527293 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfc9a=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x54ba97,_0x5866dc){var _0x57291f=function(_0x4230b0){while(--_0x4230b0){_0x54ba97['push'](_0x54ba97['shift']());}};_0x57291f(++_0x5866dc);}(_0xfc9a,0x83));var _0xafc9=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xfc9a[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xafc9('0x0'));module[_0xafc9('0x1')]={'name':{'type':Sequelize[_0xafc9('0x2')],'unique':_0xafc9('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xafc9('0x2')]},'timeout':{'type':Sequelize[_0xafc9('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xafc9('0x5')](_0xafc9('0x6'),_0xafc9('0x7'),_0xafc9('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xafc9('0x4')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x9d44=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x44cd28,_0x1502d9){var _0x39356e=function(_0x4dfe82){while(--_0x4dfe82){_0x44cd28['push'](_0x44cd28['shift']());}};_0x39356e(++_0x1502d9);}(_0x9d44,0x1af));var _0x49d4=function(_0x29cb88,_0x36e887){_0x29cb88=_0x29cb88-0x0;var _0x7988a7=_0x9d44[_0x29cb88];return _0x7988a7;};'use strict';var Sequelize=require(_0x49d4('0x0'));module[_0x49d4('0x1')]={'name':{'type':Sequelize[_0x49d4('0x2')],'unique':_0x49d4('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x49d4('0x2')]},'timeout':{'type':Sequelize[_0x49d4('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x49d4('0x5')](_0x49d4('0x6'),_0x49d4('0x7'),_0x49d4('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x49d4('0x4')],'defaultValue':0x0}};
\ No newline at end of file
index 59c0709..4e39a85 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1527=['reject','save','update','then','destroy','UserProfileResource','end','error','stack','name','map','FaxQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','model','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','length','FaxQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','Team','pick','getTeams','nolimit','addTeams','ids','Agents','online','voicePause','interface','get','sequelize','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','union','compact','removeAgents','userFaxQueue:remove','addAgents','omit','isArray','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','Content-Range'];(function(_0x4ad323,_0x40e25e){var _0xe4b67d=function(_0x993c26){while(--_0x993c26){_0x4ad323['push'](_0x4ad323['shift']());}};_0xe4b67d(++_0x40e25e);}(_0x1527,0xf7));var _0x7152=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x1527[_0x45783c];return _0x1161da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7152('0x0'));var zipdir=require(_0x7152('0x1'));var jsonpatch=require(_0x7152('0x2'));var rp=require(_0x7152('0x3'));var moment=require('moment');var BPromise=require(_0x7152('0x4'));var Mustache=require(_0x7152('0x5'));var util=require(_0x7152('0x6'));var path=require(_0x7152('0x7'));var sox=require(_0x7152('0x8'));var csv=require(_0x7152('0x9'));var ejs=require(_0x7152('0xa'));var fs=require('fs');var fs_extra=require(_0x7152('0xb'));var _=require(_0x7152('0xc'));var squel=require(_0x7152('0xd'));var crypto=require('crypto');var jsforce=require(_0x7152('0xe'));var deskjs=require(_0x7152('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7152('0x10'));var Papa=require(_0x7152('0x11'));var Redis=require(_0x7152('0x12'));var authService=require(_0x7152('0x13'));var qs=require(_0x7152('0x14'));var as=require(_0x7152('0x15'));var hardwareService=require(_0x7152('0x16'));var logger=require(_0x7152('0x17'))(_0x7152('0x18'));var utils=require(_0x7152('0x19'));var config=require(_0x7152('0x1a'));var licenseUtil=require(_0x7152('0x1b'));var db=require(_0x7152('0x1c'))['db'];config['redis']=_[_0x7152('0x1d')](config[_0x7152('0x1e')],{'host':_0x7152('0x1f'),'port':0x18eb});var socket=require(_0x7152('0x20'))(new Redis(config[_0x7152('0x1e')]));require('./faxQueue.socket')[_0x7152('0x21')](socket);function respondWithStatusCode(_0x216707,_0x1e8863){_0x1e8863=_0x1e8863||0xcc;return function(_0x110e08){if(_0x110e08){return _0x216707[_0x7152('0x22')](_0x1e8863);}return _0x216707[_0x7152('0x23')](_0x1e8863)['end']();};}function respondWithResult(_0x3afba2,_0x394743){_0x394743=_0x394743||0xc8;return function(_0x5b6011){if(_0x5b6011){return _0x3afba2['status'](_0x394743)[_0x7152('0x24')](_0x5b6011);}};}function respondWithFilteredResult(_0x3fd2e6,_0x3df16a){return function(_0x1e2742){if(_0x1e2742){var _0x279aac=typeof _0x3df16a[_0x7152('0x25')]===_0x7152('0x26')&&typeof _0x3df16a['limit']===_0x7152('0x26');var _0xb57e19=_0x1e2742[_0x7152('0x27')];var _0x19a6b8=_0x279aac?0x0:_0x3df16a[_0x7152('0x25')];var _0x2985dd=_0x279aac?_0x1e2742['count']:_0x3df16a[_0x7152('0x25')]+_0x3df16a['limit'];var _0x133c25;if(_0x2985dd>=_0xb57e19){_0x2985dd=_0xb57e19;_0x133c25=0xc8;}else{_0x133c25=0xce;}_0x3fd2e6[_0x7152('0x23')](_0x133c25);return _0x3fd2e6['set'](_0x7152('0x28'),_0x19a6b8+'-'+_0x2985dd+'/'+_0xb57e19)[_0x7152('0x24')](_0x1e2742);}return null;};}function patchUpdates(_0x2a1bac){return function(_0x3b077c){try{jsonpatch['apply'](_0x3b077c,_0x2a1bac,!![]);}catch(_0x135e11){return BPromise[_0x7152('0x29')](_0x135e11);}return _0x3b077c[_0x7152('0x2a')]();};}function saveUpdates(_0x1aee71,_0x1108d2){return function(_0x234497){if(_0x234497){return _0x234497[_0x7152('0x2b')](_0x1aee71)[_0x7152('0x2c')](function(_0x2a61bf){return _0x2a61bf;});}return null;};}function removeEntity(_0x2bd20b,_0xfc0f8b){return function(_0x3921e9){if(_0x3921e9){return _0x3921e9[_0x7152('0x2d')]()[_0x7152('0x2c')](function(){var _0xc68ecf=_0x3921e9['get']({'plain':!![]});var _0x3c1ad6='FaxQueues';return db[_0x7152('0x2e')]['destroy']({'where':{'type':_0x3c1ad6,'resourceId':_0xc68ecf['id']}})[_0x7152('0x2c')](function(){return _0x3921e9;});})[_0x7152('0x2c')](function(){_0x2bd20b[_0x7152('0x23')](0xcc)[_0x7152('0x2f')]();});}};}function handleEntityNotFound(_0x1b289e,_0xb7f803){return function(_0xf35f4d){if(!_0xf35f4d){_0x1b289e['sendStatus'](0x194);}return _0xf35f4d;};}function handleError(_0x2e75cc,_0xb819b6){_0xb819b6=_0xb819b6||0x1f4;return function(_0x4302e2){logger[_0x7152('0x30')](_0x4302e2[_0x7152('0x31')]);if(_0x4302e2[_0x7152('0x32')]){delete _0x4302e2[_0x7152('0x32')];}_0x2e75cc[_0x7152('0x23')](_0xb819b6)['send'](_0x4302e2);};}exports['index']=function(_0x4b2881,_0xa4b1c0){var _0x328ba5={},_0x178e7e={},_0x1ccfa0={'count':0x0,'rows':[]};var _0x1126b2=_[_0x7152('0x33')](db[_0x7152('0x34')][_0x7152('0x35')],function(_0x5f436e){return{'name':_0x5f436e[_0x7152('0x36')],'type':_0x5f436e[_0x7152('0x37')][_0x7152('0x38')]};});_0x178e7e['model']=_['map'](_0x1126b2,'name');_0x178e7e[_0x7152('0x39')]=_[_0x7152('0x3a')](_0x4b2881[_0x7152('0x39')]);_0x178e7e[_0x7152('0x3b')]=_[_0x7152('0x3c')](_0x178e7e['model'],_0x178e7e['query']);_0x328ba5[_0x7152('0x3d')]=_[_0x7152('0x3c')](_0x178e7e['model'],qs['fields'](_0x4b2881[_0x7152('0x39')][_0x7152('0x3e')]));_0x328ba5['attributes']=_0x328ba5[_0x7152('0x3d')]['length']?_0x328ba5[_0x7152('0x3d')]:_0x178e7e['model'];if(!_0x4b2881[_0x7152('0x39')][_0x7152('0x3f')]('nolimit')){_0x328ba5[_0x7152('0x40')]=qs[_0x7152('0x40')](_0x4b2881[_0x7152('0x39')]['limit']);_0x328ba5[_0x7152('0x25')]=qs[_0x7152('0x25')](_0x4b2881[_0x7152('0x39')][_0x7152('0x25')]);}_0x328ba5[_0x7152('0x41')]=qs[_0x7152('0x42')](_0x4b2881[_0x7152('0x39')]['sort']);_0x328ba5[_0x7152('0x43')]=qs[_0x7152('0x3b')](_['pick'](_0x4b2881[_0x7152('0x39')],_0x178e7e[_0x7152('0x3b')]),_0x1126b2);if(_0x4b2881[_0x7152('0x39')][_0x7152('0x44')]){_0x328ba5[_0x7152('0x43')]=_[_0x7152('0x45')](_0x328ba5[_0x7152('0x43')],{'$or':_[_0x7152('0x33')](_0x1126b2,function(_0x1d34a1){if(_0x1d34a1[_0x7152('0x37')]!==_0x7152('0x46')){var _0x549b08={};_0x549b08[_0x1d34a1[_0x7152('0x32')]]={'$like':'%'+_0x4b2881['query'][_0x7152('0x44')]+'%'};return _0x549b08;}})});}_0x328ba5=_[_0x7152('0x45')]({},_0x328ba5,_0x4b2881[_0x7152('0x47')]);var _0xa0f481={'where':_0x328ba5['where']};return db['FaxQueue'][_0x7152('0x27')](_0xa0f481)[_0x7152('0x2c')](function(_0x5710a9){_0x1ccfa0['count']=_0x5710a9;if(_0x4b2881[_0x7152('0x39')][_0x7152('0x48')]){_0x328ba5[_0x7152('0x49')]=[{'all':!![]}];}return db[_0x7152('0x34')][_0x7152('0x4a')](_0x328ba5);})['then'](function(_0x41e74c){_0x1ccfa0[_0x7152('0x4b')]=_0x41e74c;return _0x1ccfa0;})[_0x7152('0x2c')](respondWithFilteredResult(_0xa4b1c0,_0x328ba5))[_0x7152('0x4c')](handleError(_0xa4b1c0,null));};exports[_0x7152('0x4d')]=function(_0x47227a,_0x354228){var _0x2e78d5={'raw':!![],'where':{'id':_0x47227a[_0x7152('0x4e')]['id']}},_0x653bc5={};_0x653bc5[_0x7152('0x4f')]=_[_0x7152('0x3a')](db['FaxQueue'][_0x7152('0x35')]);_0x653bc5[_0x7152('0x39')]=_[_0x7152('0x3a')](_0x47227a[_0x7152('0x39')]);_0x653bc5[_0x7152('0x3b')]=_[_0x7152('0x3c')](_0x653bc5[_0x7152('0x4f')],_0x653bc5['query']);_0x2e78d5[_0x7152('0x3d')]=_['intersection'](_0x653bc5[_0x7152('0x4f')],qs['fields'](_0x47227a['query'][_0x7152('0x3e')]));_0x2e78d5['attributes']=_0x2e78d5[_0x7152('0x3d')]['length']?_0x2e78d5['attributes']:_0x653bc5[_0x7152('0x4f')];if(_0x47227a['query']['includeAll']){_0x2e78d5[_0x7152('0x49')]=[{'all':!![]}];}_0x2e78d5=_['merge']({},_0x2e78d5,_0x47227a['options']);return db['FaxQueue']['find'](_0x2e78d5)[_0x7152('0x2c')](handleEntityNotFound(_0x354228,null))[_0x7152('0x2c')](respondWithResult(_0x354228,null))[_0x7152('0x4c')](handleError(_0x354228,null));};exports['create']=function(_0xe754d1,_0x2142f6){return db[_0x7152('0x34')][_0x7152('0x50')](_0xe754d1[_0x7152('0x51')],{})[_0x7152('0x2c')](function(_0x2e3938){var _0x36fe67=_0xe754d1['user']['get']({'plain':!![]});if(!_0x36fe67)throw new Error(_0x7152('0x52'));if(_0x36fe67[_0x7152('0x53')]==='user'){var _0x2c973b=_0x2e3938['get']({'plain':!![]});var _0x489100=_0x7152('0x54');return db[_0x7152('0x55')][_0x7152('0x56')]({'where':{'name':_0x489100,'userProfileId':_0x36fe67[_0x7152('0x57')]},'raw':!![]})[_0x7152('0x2c')](function(_0x4b8a7a){if(_0x4b8a7a&&_0x4b8a7a[_0x7152('0x58')]===0x0){return db[_0x7152('0x2e')][_0x7152('0x50')]({'name':_0x2c973b[_0x7152('0x32')],'resourceId':_0x2c973b['id'],'type':_0x4b8a7a[_0x7152('0x32')],'sectionId':_0x4b8a7a['id']},{})['then'](function(){return _0x2e3938;});}else{return _0x2e3938;}})[_0x7152('0x4c')](function(_0x2b82c5){logger[_0x7152('0x30')](_0x7152('0x59'),_0x2b82c5);throw _0x2b82c5;});}return _0x2e3938;})[_0x7152('0x2c')](respondWithResult(_0x2142f6,0xc9))[_0x7152('0x4c')](handleError(_0x2142f6,null));};exports[_0x7152('0x2b')]=function(_0xc3d3d6,_0x2461ab){if(_0xc3d3d6[_0x7152('0x51')]['id']){delete _0xc3d3d6[_0x7152('0x51')]['id'];}return db[_0x7152('0x34')][_0x7152('0x56')]({'where':{'id':_0xc3d3d6['params']['id']}})[_0x7152('0x2c')](handleEntityNotFound(_0x2461ab,null))[_0x7152('0x2c')](saveUpdates(_0xc3d3d6['body'],null))[_0x7152('0x2c')](respondWithResult(_0x2461ab,null))[_0x7152('0x4c')](handleError(_0x2461ab,null));};exports[_0x7152('0x2d')]=function(_0x1e8a7e,_0x19ad3a){return db['FaxQueue'][_0x7152('0x56')]({'where':{'id':_0x1e8a7e[_0x7152('0x4e')]['id']}})[_0x7152('0x2c')](handleEntityNotFound(_0x19ad3a,null))[_0x7152('0x2c')](removeEntity(_0x19ad3a,null))[_0x7152('0x4c')](handleError(_0x19ad3a,null));};exports[_0x7152('0x5a')]=function(_0x3b0daf,_0x127fd9){return db['FaxQueue']['describe']()[_0x7152('0x2c')](respondWithResult(_0x127fd9,null))['catch'](handleError(_0x127fd9,null));};exports[_0x7152('0x5b')]=function(_0x15d7fd,_0x414c86,_0x40d613){var _0x58147e={'raw':!![],'where':{}},_0x1da970={},_0x3dff7e;return db[_0x7152('0x34')][_0x7152('0x5c')]({'where':{'id':_0x15d7fd['params']['id']}})[_0x7152('0x2c')](handleEntityNotFound(_0x414c86,null))['then'](function(_0x24c702){if(_0x24c702){_0x3dff7e=_0x24c702['get']({'plain':!![]});_0x1da970['model']=_[_0x7152('0x3a')](db[_0x7152('0x5d')][_0x7152('0x35')]);_0x1da970[_0x7152('0x39')]=_['keys'](_0x15d7fd['query']);_0x1da970[_0x7152('0x3b')]=_['intersection'](_0x1da970[_0x7152('0x4f')],_0x1da970[_0x7152('0x39')]);_0x58147e[_0x7152('0x3d')]=_[_0x7152('0x3c')](_0x1da970['model'],qs['fields'](_0x15d7fd['query'][_0x7152('0x3e')]));_0x58147e[_0x7152('0x3d')]=_0x58147e[_0x7152('0x3d')][_0x7152('0x5e')]?_0x58147e['attributes']:_0x1da970[_0x7152('0x4f')];if(!_0x15d7fd[_0x7152('0x39')][_0x7152('0x3f')]('nolimit')){_0x58147e[_0x7152('0x40')]=qs[_0x7152('0x40')](_0x15d7fd[_0x7152('0x39')][_0x7152('0x40')]);_0x58147e[_0x7152('0x25')]=qs[_0x7152('0x25')](_0x15d7fd[_0x7152('0x39')][_0x7152('0x25')]);}_0x58147e['order']=qs[_0x7152('0x42')](_0x15d7fd[_0x7152('0x39')][_0x7152('0x42')]);_0x58147e['where']=qs[_0x7152('0x3b')](_['pick'](_0x15d7fd[_0x7152('0x39')],_0x1da970[_0x7152('0x3b')]));_0x58147e['where'][_0x7152('0x5f')]=_0x24c702['id'];if(_0x15d7fd[_0x7152('0x39')][_0x7152('0x44')]){_0x58147e[_0x7152('0x43')]=_[_0x7152('0x45')](_0x58147e['where'],{'$or':_[_0x7152('0x33')](_0x58147e['attributes'],function(_0x53272d){var _0x85ca82={};_0x85ca82[_0x53272d]={'$like':'%'+_0x15d7fd[_0x7152('0x39')][_0x7152('0x44')]+'%'};return _0x85ca82;})});}_0x58147e=_[_0x7152('0x45')]({},_0x58147e,_0x15d7fd[_0x7152('0x47')]);return db['UserFaxQueue'][_0x7152('0x4a')](_0x58147e);}})[_0x7152('0x2c')](function(_0x5d30ec){if(_0x5d30ec){return db[_0x7152('0x60')][_0x7152('0x61')]({'where':{'id':_['map'](_0x5d30ec,_0x7152('0x62')),'role':_0x7152('0x63')},'attributes':['id','name','faxPause',_0x7152('0x64'),_0x7152('0x65')]});}})['then'](function(_0x506fe1){if(_0x506fe1){return{'count':_0x506fe1['count'],'rows':_[_0x7152('0x33')](_0x506fe1['rows'],function(_0x4577e6){return{'membername':_0x4577e6[_0x7152('0x32')],'UserId':_0x4577e6['id'],'queue_name':_0x3dff7e[_0x7152('0x32')],'FaxQueueId':_0x3dff7e['id'],'interface':util[_0x7152('0x66')](_0x7152('0x67'),'SIP',_0x4577e6[_0x7152('0x32')]),'penalty':0x0,'paused':_0x4577e6['faxPause'],'createdAt':_0x4577e6[_0x7152('0x65')],'updatedAt':_0x4577e6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7152('0x2c')](respondWithFilteredResult(_0x414c86,_0x58147e))[_0x7152('0x4c')](handleError(_0x414c86,null));};exports['getTeams']=function(_0x20d60a,_0x247474,_0x5d6178){var _0x28bc7a={};var _0x33c957={};var _0x135310;var _0x56cc4c;return db[_0x7152('0x34')]['findOne']({'where':{'id':_0x20d60a[_0x7152('0x4e')]['id']}})[_0x7152('0x2c')](handleEntityNotFound(_0x247474,null))[_0x7152('0x2c')](function(_0x45cd98){if(_0x45cd98){_0x135310=_0x45cd98;_0x33c957['model']=_[_0x7152('0x3a')](db[_0x7152('0x68')][_0x7152('0x35')]);_0x33c957[_0x7152('0x39')]=_[_0x7152('0x3a')](_0x20d60a[_0x7152('0x39')]);_0x33c957['filters']=_[_0x7152('0x3c')](_0x33c957[_0x7152('0x4f')],_0x33c957[_0x7152('0x39')]);_0x28bc7a['attributes']=_[_0x7152('0x3c')](_0x33c957[_0x7152('0x4f')],qs[_0x7152('0x3e')](_0x20d60a[_0x7152('0x39')][_0x7152('0x3e')]));_0x28bc7a[_0x7152('0x3d')]=_0x28bc7a[_0x7152('0x3d')][_0x7152('0x5e')]?_0x28bc7a[_0x7152('0x3d')]:_0x33c957[_0x7152('0x4f')];_0x28bc7a[_0x7152('0x41')]=qs['sort'](_0x20d60a[_0x7152('0x39')]['sort']);_0x28bc7a[_0x7152('0x43')]=qs[_0x7152('0x3b')](_[_0x7152('0x69')](_0x20d60a[_0x7152('0x39')],_0x33c957['filters']));if(_0x20d60a['query'][_0x7152('0x44')]){_0x28bc7a['where']=_['merge'](_0x28bc7a['where'],{'$or':_['map'](_0x28bc7a['attributes'],function(_0x56f881){var _0x4065fb={};_0x4065fb[_0x56f881]={'$like':'%'+_0x20d60a['query'][_0x7152('0x44')]+'%'};return _0x4065fb;})});}_0x28bc7a=_[_0x7152('0x45')]({},_0x28bc7a,_0x20d60a['options']);return _0x135310[_0x7152('0x6a')](_0x28bc7a);}})[_0x7152('0x2c')](function(_0x1e379c){if(_0x1e379c){_0x56cc4c=_0x1e379c[_0x7152('0x5e')];if(!_0x20d60a['query'][_0x7152('0x3f')](_0x7152('0x6b'))){_0x28bc7a[_0x7152('0x40')]=qs[_0x7152('0x40')](_0x20d60a['query'][_0x7152('0x40')]);_0x28bc7a[_0x7152('0x25')]=qs[_0x7152('0x25')](_0x20d60a[_0x7152('0x39')][_0x7152('0x25')]);}return _0x135310[_0x7152('0x6a')](_0x28bc7a);}})['then'](function(_0x4e6904){if(_0x4e6904){return _0x4e6904?{'count':_0x56cc4c,'rows':_0x4e6904}:null;}})[_0x7152('0x2c')](respondWithResult(_0x247474,null))[_0x7152('0x4c')](handleError(_0x247474,null));};exports[_0x7152('0x6c')]=function(_0x5d4bc1,_0x4a8d79,_0x7e1fb2){var _0x3b9774=_0x5d4bc1[_0x7152('0x51')][_0x7152('0x6d')];return db['Team'][_0x7152('0x4a')]({'where':{'id':_0x3b9774},'attributes':['id'],'include':[{'model':db[_0x7152('0x60')],'as':_0x7152('0x6e'),'attributes':['id',_0x7152('0x32'),_0x7152('0x6f'),_0x7152('0x70'),_0x7152('0x71')],'raw':!![]}]})[_0x7152('0x2c')](function(_0x444185){if(_0x444185){var _0x145da7=_['flatMap'](_0x444185,function(_0x30a16d){var _0x25cbb7=_0x30a16d[_0x7152('0x72')]({'plain':!![]});return _0x25cbb7[_0x7152('0x6e')];});return db[_0x7152('0x34')][_0x7152('0x56')]({'where':{'id':_0x5d4bc1[_0x7152('0x4e')]['id']}})['then'](function(_0x2c35cb){return db[_0x7152('0x73')][_0x7152('0x74')](function(_0xf597fb){return _0x2c35cb[_0x7152('0x6c')](_0x3b9774,{'transaction':_0xf597fb})[_0x7152('0x2c')](function(){return BPromise['each'](_0x145da7,function(_0x457c31){return db[_0x7152('0x5d')][_0x7152('0x75')]({'where':{'UserId':_0x457c31['id'],'FaxQueueId':_0x5d4bc1['params']['id']},'transaction':_0xf597fb});});})[_0x7152('0x2c')](function(){_0x145da7[_0x7152('0x76')](function(_0x8c83ed){socket[_0x7152('0x77')](_0x7152('0x78'),{'UserId':_0x8c83ed['id'],'FaxQueueId':_0x2c35cb['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8d79,null))[_0x7152('0x4c')](handleError(_0x4a8d79,null));};exports[_0x7152('0x79')]=function(_0x4cf20d,_0x379d29,_0x2ae17e){return db['Team']['findAll']({'where':{'id':_0x4cf20d[_0x7152('0x39')][_0x7152('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x7152('0x60')],'as':_0x7152('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x379d29,null))[_0x7152('0x2c')](function(_0x158600){var _0x2abc2c=_[_0x7152('0x33')](_0x158600,'id');var _0x2b042b=[];var _0x2315f6=[];var _0x1503ec=squel[_0x7152('0x7a')]();_0x1503ec[_0x7152('0x7b')](_0x7152('0x7c'))['from'](_0x7152('0x7d'),'tq')['join'](_0x7152('0x7e'),'ut',_0x7152('0x7f'))[_0x7152('0x43')](_0x7152('0x80'),_0x4cf20d[_0x7152('0x4e')]['id']);for(var _0x16d35e=0x0;_0x16d35e<_0x158600[_0x7152('0x5e')];_0x16d35e+=0x1){let _0x2478ef=_0x158600[_0x16d35e];for(var _0xbcb8cc=0x0;_0xbcb8cc<_0x2478ef[_0x7152('0x6e')][_0x7152('0x5e')];_0xbcb8cc+=0x1){let _0x38203b=_0x2478ef[_0x7152('0x6e')][_0xbcb8cc];var _0x43e612=_0x1503ec[_0x7152('0x81')]();_0x43e612[_0x7152('0x43')](_0x7152('0x82'),_0x38203b['id']);_0x2315f6[_0x7152('0x83')](db[_0x7152('0x73')][_0x7152('0x39')](_0x43e612[_0x7152('0x84')](),{'type':db[_0x7152('0x73')]['QueryTypes'][_0x7152('0x85')]})[_0x7152('0x2c')](function(_0x2791e8){if(_0x2791e8[_0x7152('0x5e')]===0x1){return _0x38203b['id'];}else{var _0x1ab2f9=_[_0x7152('0x86')](_[_0x7152('0x33')](_0x2791e8,'TeamId'),function(_0x3cc386){return _[_0x7152('0x87')](_0x2abc2c,_0x3cc386);});if(_0x1ab2f9){return _0x38203b['id'];}}}));}}return BPromise[_0x7152('0x88')](_0x2315f6)['then'](function(_0x3ac7c6){_0x2b042b=_(_0x2b042b)[_0x7152('0x89')](_0x3ac7c6)[_0x7152('0x8a')]()['value']();return db['FaxQueue'][_0x7152('0x56')]({'where':{'id':_0x4cf20d['params']['id']}})[_0x7152('0x2c')](function(_0x4720be){return db[_0x7152('0x73')][_0x7152('0x74')](function(_0x36680b){return _0x4720be[_0x7152('0x79')](_0x4cf20d[_0x7152('0x39')][_0x7152('0x6d')],{'transaction':_0x36680b})['then'](function(){if(!_['isEmpty'](_0x2b042b)){return _0x4720be[_0x7152('0x8b')](_0x2b042b,{'transaction':_0x36680b});}})[_0x7152('0x2c')](function(){_0x2b042b[_0x7152('0x76')](function(_0x54e8e9){socket[_0x7152('0x77')](_0x7152('0x8c'),{'UserId':_0x54e8e9,'FaxQueueId':_0x4720be['id']});});});});});});})[_0x7152('0x2c')](respondWithStatusCode(_0x379d29,null))[_0x7152('0x4c')](handleError(_0x379d29,null));};exports[_0x7152('0x8d')]=function(_0x293928,_0x3a20be,_0x2d7051){return db[_0x7152('0x34')][_0x7152('0x56')]({'where':{'id':_0x293928[_0x7152('0x4e')]['id']}})[_0x7152('0x2c')](handleEntityNotFound(_0x3a20be,null))['then'](function(_0x11a18d){if(_0x11a18d){return _0x11a18d[_0x7152('0x8d')](_0x293928['body'][_0x7152('0x6d')],_[_0x7152('0x8e')](_0x293928[_0x7152('0x51')],[_0x7152('0x6d'),'id'])||{})['spread'](function(_0x23b82d){for(var _0x2d7ac0=0x0;_0x2d7ac0<_0x293928[_0x7152('0x51')][_0x7152('0x6d')][_0x7152('0x5e')];_0x2d7ac0+=0x1){socket[_0x7152('0x77')](_0x7152('0x78'),{'UserId':Number(_0x293928['body'][_0x7152('0x6d')][_0x2d7ac0]),'FaxQueueId':Number(_0x293928['params']['id'])});}return _0x23b82d;});}})[_0x7152('0x2c')](respondWithResult(_0x3a20be,null))['catch'](handleError(_0x3a20be,null));};exports[_0x7152('0x8b')]=function(_0x47a24f,_0x5b218c,_0x4e5964){return db[_0x7152('0x34')][_0x7152('0x56')]({'where':{'id':_0x47a24f[_0x7152('0x4e')]['id']}})[_0x7152('0x2c')](handleEntityNotFound(_0x5b218c,null))[_0x7152('0x2c')](function(_0x332d26){if(_0x332d26){return _0x332d26[_0x7152('0x8b')](_0x47a24f[_0x7152('0x39')][_0x7152('0x6d')])['then'](function(){if(_[_0x7152('0x8f')](_0x47a24f[_0x7152('0x39')][_0x7152('0x6d')])){for(var _0x4a1000=0x0;_0x4a1000<_0x47a24f[_0x7152('0x39')]['ids']['length'];_0x4a1000+=0x1){socket[_0x7152('0x77')](_0x7152('0x8c'),{'UserId':Number(_0x47a24f[_0x7152('0x39')][_0x7152('0x6d')][_0x4a1000]),'FaxQueueId':Number(_0x47a24f[_0x7152('0x4e')]['id'])});}}else{socket[_0x7152('0x77')](_0x7152('0x8c'),{'UserId':Number(_0x47a24f[_0x7152('0x39')][_0x7152('0x6d')]),'FaxQueueId':Number(_0x47a24f[_0x7152('0x4e')]['id'])});}});}})[_0x7152('0x2c')](respondWithStatusCode(_0x5b218c,null))[_0x7152('0x4c')](handleError(_0x5b218c,null));};exports['getAgents']=function(_0x2e257c,_0x5d18a3,_0x31e935){var _0xb28b91={};var _0x2d41c8={};var _0x50d1f5;var _0x3bd031;return db[_0x7152('0x34')][_0x7152('0x5c')]({'where':{'id':_0x2e257c[_0x7152('0x4e')]['id']}})[_0x7152('0x2c')](handleEntityNotFound(_0x5d18a3,null))[_0x7152('0x2c')](function(_0x50501b){if(_0x50501b){_0x50d1f5=_0x50501b;_0x2d41c8[_0x7152('0x4f')]=_[_0x7152('0x3a')](db[_0x7152('0x60')][_0x7152('0x35')]);_0x2d41c8['query']=_['keys'](_0x2e257c[_0x7152('0x39')]);_0x2d41c8[_0x7152('0x3b')]=_[_0x7152('0x3c')](_0x2d41c8[_0x7152('0x4f')],_0x2d41c8['query']);_0xb28b91['attributes']=_['intersection'](_0x2d41c8[_0x7152('0x4f')],qs[_0x7152('0x3e')](_0x2e257c[_0x7152('0x39')][_0x7152('0x3e')]));_0xb28b91[_0x7152('0x3d')]=_0xb28b91[_0x7152('0x3d')][_0x7152('0x5e')]?_0xb28b91[_0x7152('0x3d')]:_0x2d41c8[_0x7152('0x4f')];_0xb28b91[_0x7152('0x41')]=qs[_0x7152('0x42')](_0x2e257c[_0x7152('0x39')]['sort']);_0xb28b91[_0x7152('0x43')]=qs[_0x7152('0x3b')](_[_0x7152('0x69')](_0x2e257c['query'],_0x2d41c8[_0x7152('0x3b')]));if(_0x2e257c[_0x7152('0x39')][_0x7152('0x44')]){_0xb28b91[_0x7152('0x43')]=_[_0x7152('0x45')](_0xb28b91['where'],{'$or':_[_0x7152('0x33')](_0xb28b91['attributes'],function(_0x1430fe){var _0xdec667={};_0xdec667[_0x1430fe]={'$like':'%'+_0x2e257c[_0x7152('0x39')][_0x7152('0x44')]+'%'};return _0xdec667;})});}_0xb28b91=_['merge']({},_0xb28b91,_0x2e257c['options']);return _0x50d1f5['getAgents'](_0xb28b91);}})[_0x7152('0x2c')](function(_0x3e1d1f){if(_0x3e1d1f){_0x3bd031=_0x3e1d1f[_0x7152('0x5e')];if(!_0x2e257c[_0x7152('0x39')]['hasOwnProperty'](_0x7152('0x6b'))){_0xb28b91[_0x7152('0x40')]=qs[_0x7152('0x40')](_0x2e257c['query'][_0x7152('0x40')]);_0xb28b91['offset']=qs[_0x7152('0x25')](_0x2e257c[_0x7152('0x39')][_0x7152('0x25')]);}return _0x50d1f5['getAgents'](_0xb28b91);}})[_0x7152('0x2c')](function(_0x4ced47){if(_0x4ced47){return _0x4ced47?{'count':_0x3bd031,'rows':_0x4ced47}:null;}})[_0x7152('0x2c')](respondWithResult(_0x5d18a3,null))[_0x7152('0x4c')](handleError(_0x5d18a3,null));};
\ No newline at end of file
+var _0x151e=['moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','./faxQueue.socket','register','sendStatus','status','json','offset','limit','count','set','apply','reject','update','then','destroy','get','FaxQueues','UserProfileResource','error','name','send','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxQueue','include','findAll','rows','catch','params','keys','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','agent','faxPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','hasOwnProperty','addTeams','ids','online','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x151e,0x109));var _0xe151=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0x151e[_0x4fa291];return _0x506d9b;};'use strict';var emlformat=require(_0xe151('0x0'));var rimraf=require(_0xe151('0x1'));var zipdir=require(_0xe151('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe151('0x3'));var BPromise=require(_0xe151('0x4'));var Mustache=require(_0xe151('0x5'));var util=require(_0xe151('0x6'));var path=require(_0xe151('0x7'));var sox=require(_0xe151('0x8'));var csv=require(_0xe151('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe151('0xa'));var squel=require(_0xe151('0xb'));var crypto=require(_0xe151('0xc'));var jsforce=require(_0xe151('0xd'));var deskjs=require(_0xe151('0xe'));var toCsv=require(_0xe151('0x9'));var querystring=require(_0xe151('0xf'));var Papa=require('papaparse');var Redis=require(_0xe151('0x10'));var authService=require(_0xe151('0x11'));var qs=require(_0xe151('0x12'));var as=require(_0xe151('0x13'));var hardwareService=require(_0xe151('0x14'));var logger=require(_0xe151('0x15'))(_0xe151('0x16'));var utils=require('../../config/utils');var config=require(_0xe151('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe151('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe151('0x19'))[_0xe151('0x1a')](socket);function respondWithStatusCode(_0x489a64,_0x33f3c6){_0x33f3c6=_0x33f3c6||0xcc;return function(_0x3c2725){if(_0x3c2725){return _0x489a64[_0xe151('0x1b')](_0x33f3c6);}return _0x489a64['status'](_0x33f3c6)['end']();};}function respondWithResult(_0x183d20,_0x34c5dc){_0x34c5dc=_0x34c5dc||0xc8;return function(_0x31e99e){if(_0x31e99e){return _0x183d20[_0xe151('0x1c')](_0x34c5dc)[_0xe151('0x1d')](_0x31e99e);}};}function respondWithFilteredResult(_0x35bbc0,_0x151828){return function(_0x2760e7){if(_0x2760e7){var _0x20fc91=typeof _0x151828[_0xe151('0x1e')]==='undefined'&&typeof _0x151828[_0xe151('0x1f')]==='undefined';var _0x4c5285=_0x2760e7['count'];var _0x5394cb=_0x20fc91?0x0:_0x151828[_0xe151('0x1e')];var _0x14e58d=_0x20fc91?_0x2760e7[_0xe151('0x20')]:_0x151828[_0xe151('0x1e')]+_0x151828[_0xe151('0x1f')];var _0xaf19fb;if(_0x14e58d>=_0x4c5285){_0x14e58d=_0x4c5285;_0xaf19fb=0xc8;}else{_0xaf19fb=0xce;}_0x35bbc0[_0xe151('0x1c')](_0xaf19fb);return _0x35bbc0[_0xe151('0x21')]('Content-Range',_0x5394cb+'-'+_0x14e58d+'/'+_0x4c5285)['json'](_0x2760e7);}return null;};}function patchUpdates(_0x39ad68){return function(_0x2b7948){try{jsonpatch[_0xe151('0x22')](_0x2b7948,_0x39ad68,!![]);}catch(_0xf63d8b){return BPromise[_0xe151('0x23')](_0xf63d8b);}return _0x2b7948['save']();};}function saveUpdates(_0x582bde,_0x5e1d32){return function(_0x5867cc){if(_0x5867cc){return _0x5867cc[_0xe151('0x24')](_0x582bde)[_0xe151('0x25')](function(_0x5da308){return _0x5da308;});}return null;};}function removeEntity(_0x5408b2,_0x32e99d){return function(_0x19f13f){if(_0x19f13f){return _0x19f13f[_0xe151('0x26')]()[_0xe151('0x25')](function(){var _0x1e30ff=_0x19f13f[_0xe151('0x27')]({'plain':!![]});var _0x185b55=_0xe151('0x28');return db[_0xe151('0x29')][_0xe151('0x26')]({'where':{'type':_0x185b55,'resourceId':_0x1e30ff['id']}})['then'](function(){return _0x19f13f;});})[_0xe151('0x25')](function(){_0x5408b2[_0xe151('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40dc44,_0x2f9f92){return function(_0x2d99fc){if(!_0x2d99fc){_0x40dc44[_0xe151('0x1b')](0x194);}return _0x2d99fc;};}function handleError(_0x538239,_0x36f41d){_0x36f41d=_0x36f41d||0x1f4;return function(_0x110ae9){logger[_0xe151('0x2a')](_0x110ae9['stack']);if(_0x110ae9[_0xe151('0x2b')]){delete _0x110ae9[_0xe151('0x2b')];}_0x538239[_0xe151('0x1c')](_0x36f41d)[_0xe151('0x2c')](_0x110ae9);};}exports['index']=function(_0x69cc50,_0xaf22d8){var _0x4db68c={},_0x66100c={},_0x5d8218={'count':0x0,'rows':[]};var _0x12c0ad=_[_0xe151('0x2d')](db['FaxQueue'][_0xe151('0x2e')],function(_0x1ef6fb){return{'name':_0x1ef6fb[_0xe151('0x2f')],'type':_0x1ef6fb['type']['key']};});_0x66100c[_0xe151('0x30')]=_['map'](_0x12c0ad,_0xe151('0x2b'));_0x66100c[_0xe151('0x31')]=_['keys'](_0x69cc50[_0xe151('0x31')]);_0x66100c[_0xe151('0x32')]=_[_0xe151('0x33')](_0x66100c[_0xe151('0x30')],_0x66100c[_0xe151('0x31')]);_0x4db68c[_0xe151('0x34')]=_[_0xe151('0x33')](_0x66100c[_0xe151('0x30')],qs[_0xe151('0x35')](_0x69cc50[_0xe151('0x31')][_0xe151('0x35')]));_0x4db68c[_0xe151('0x34')]=_0x4db68c[_0xe151('0x34')][_0xe151('0x36')]?_0x4db68c[_0xe151('0x34')]:_0x66100c['model'];if(!_0x69cc50['query']['hasOwnProperty'](_0xe151('0x37'))){_0x4db68c[_0xe151('0x1f')]=qs[_0xe151('0x1f')](_0x69cc50['query'][_0xe151('0x1f')]);_0x4db68c[_0xe151('0x1e')]=qs['offset'](_0x69cc50[_0xe151('0x31')]['offset']);}_0x4db68c[_0xe151('0x38')]=qs[_0xe151('0x39')](_0x69cc50[_0xe151('0x31')][_0xe151('0x39')]);_0x4db68c[_0xe151('0x3a')]=qs[_0xe151('0x32')](_[_0xe151('0x3b')](_0x69cc50[_0xe151('0x31')],_0x66100c[_0xe151('0x32')]),_0x12c0ad);if(_0x69cc50[_0xe151('0x31')][_0xe151('0x3c')]){_0x4db68c['where']=_[_0xe151('0x3d')](_0x4db68c[_0xe151('0x3a')],{'$or':_[_0xe151('0x2d')](_0x12c0ad,function(_0x21bcf3){if(_0x21bcf3['type']!==_0xe151('0x3e')){var _0x58af25={};_0x58af25[_0x21bcf3[_0xe151('0x2b')]]={'$like':'%'+_0x69cc50[_0xe151('0x31')][_0xe151('0x3c')]+'%'};return _0x58af25;}})});}_0x4db68c=_[_0xe151('0x3d')]({},_0x4db68c,_0x69cc50[_0xe151('0x3f')]);var _0x2dfd8f={'where':_0x4db68c[_0xe151('0x3a')]};return db[_0xe151('0x40')][_0xe151('0x20')](_0x2dfd8f)[_0xe151('0x25')](function(_0x905ebe){_0x5d8218[_0xe151('0x20')]=_0x905ebe;if(_0x69cc50[_0xe151('0x31')]['includeAll']){_0x4db68c[_0xe151('0x41')]=[{'all':!![]}];}return db[_0xe151('0x40')][_0xe151('0x42')](_0x4db68c);})[_0xe151('0x25')](function(_0x926504){_0x5d8218[_0xe151('0x43')]=_0x926504;return _0x5d8218;})[_0xe151('0x25')](respondWithFilteredResult(_0xaf22d8,_0x4db68c))[_0xe151('0x44')](handleError(_0xaf22d8,null));};exports['show']=function(_0x483f44,_0x5cb0f5){var _0x3fa73f={'raw':!![],'where':{'id':_0x483f44[_0xe151('0x45')]['id']}},_0x313609={};_0x313609[_0xe151('0x30')]=_[_0xe151('0x46')](db[_0xe151('0x40')]['rawAttributes']);_0x313609[_0xe151('0x31')]=_['keys'](_0x483f44[_0xe151('0x31')]);_0x313609[_0xe151('0x32')]=_['intersection'](_0x313609['model'],_0x313609[_0xe151('0x31')]);_0x3fa73f[_0xe151('0x34')]=_['intersection'](_0x313609[_0xe151('0x30')],qs[_0xe151('0x35')](_0x483f44[_0xe151('0x31')][_0xe151('0x35')]));_0x3fa73f[_0xe151('0x34')]=_0x3fa73f[_0xe151('0x34')][_0xe151('0x36')]?_0x3fa73f[_0xe151('0x34')]:_0x313609[_0xe151('0x30')];if(_0x483f44['query']['includeAll']){_0x3fa73f[_0xe151('0x41')]=[{'all':!![]}];}_0x3fa73f=_[_0xe151('0x3d')]({},_0x3fa73f,_0x483f44[_0xe151('0x3f')]);return db[_0xe151('0x40')]['find'](_0x3fa73f)[_0xe151('0x25')](handleEntityNotFound(_0x5cb0f5,null))[_0xe151('0x25')](respondWithResult(_0x5cb0f5,null))[_0xe151('0x44')](handleError(_0x5cb0f5,null));};exports['create']=function(_0x1105af,_0x415b4c){return db[_0xe151('0x40')]['create'](_0x1105af[_0xe151('0x47')],{})[_0xe151('0x25')](function(_0x36c759){var _0x291512=_0x1105af[_0xe151('0x48')][_0xe151('0x27')]({'plain':!![]});if(!_0x291512)throw new Error(_0xe151('0x49'));if(_0x291512[_0xe151('0x4a')]===_0xe151('0x48')){var _0x545b60=_0x36c759['get']({'plain':!![]});var _0x1b65b0=_0xe151('0x28');return db[_0xe151('0x4b')][_0xe151('0x4c')]({'where':{'name':_0x1b65b0,'userProfileId':_0x291512[_0xe151('0x4d')]},'raw':!![]})[_0xe151('0x25')](function(_0x28564f){if(_0x28564f&&_0x28564f['autoAssociation']===0x0){return db['UserProfileResource'][_0xe151('0x4e')]({'name':_0x545b60[_0xe151('0x2b')],'resourceId':_0x545b60['id'],'type':_0x28564f[_0xe151('0x2b')],'sectionId':_0x28564f['id']},{})['then'](function(){return _0x36c759;});}else{return _0x36c759;}})['catch'](function(_0x25d13f){logger[_0xe151('0x2a')](_0xe151('0x4f'),_0x25d13f);throw _0x25d13f;});}return _0x36c759;})[_0xe151('0x25')](respondWithResult(_0x415b4c,0xc9))[_0xe151('0x44')](handleError(_0x415b4c,null));};exports[_0xe151('0x24')]=function(_0x59379c,_0x1dceb0){if(_0x59379c['body']['id']){delete _0x59379c[_0xe151('0x47')]['id'];}return db[_0xe151('0x40')][_0xe151('0x4c')]({'where':{'id':_0x59379c['params']['id']}})[_0xe151('0x25')](handleEntityNotFound(_0x1dceb0,null))['then'](saveUpdates(_0x59379c[_0xe151('0x47')],null))[_0xe151('0x25')](respondWithResult(_0x1dceb0,null))['catch'](handleError(_0x1dceb0,null));};exports['destroy']=function(_0x374784,_0x335d2e){return db[_0xe151('0x40')][_0xe151('0x4c')]({'where':{'id':_0x374784['params']['id']}})[_0xe151('0x25')](handleEntityNotFound(_0x335d2e,null))['then'](removeEntity(_0x335d2e,null))[_0xe151('0x44')](handleError(_0x335d2e,null));};exports[_0xe151('0x50')]=function(_0x366d44,_0x12458f){return db[_0xe151('0x40')][_0xe151('0x50')]()['then'](respondWithResult(_0x12458f,null))[_0xe151('0x44')](handleError(_0x12458f,null));};exports['getMembers']=function(_0x108440,_0x4a32f2,_0x348228){var _0x789327={'raw':!![],'where':{}},_0xef4d8={},_0x50237f;return db['FaxQueue'][_0xe151('0x51')]({'where':{'id':_0x108440[_0xe151('0x45')]['id']}})[_0xe151('0x25')](handleEntityNotFound(_0x4a32f2,null))[_0xe151('0x25')](function(_0x421b18){if(_0x421b18){_0x50237f=_0x421b18[_0xe151('0x27')]({'plain':!![]});_0xef4d8[_0xe151('0x30')]=_[_0xe151('0x46')](db[_0xe151('0x52')]['rawAttributes']);_0xef4d8[_0xe151('0x31')]=_[_0xe151('0x46')](_0x108440[_0xe151('0x31')]);_0xef4d8[_0xe151('0x32')]=_[_0xe151('0x33')](_0xef4d8['model'],_0xef4d8['query']);_0x789327[_0xe151('0x34')]=_[_0xe151('0x33')](_0xef4d8[_0xe151('0x30')],qs[_0xe151('0x35')](_0x108440[_0xe151('0x31')][_0xe151('0x35')]));_0x789327['attributes']=_0x789327[_0xe151('0x34')][_0xe151('0x36')]?_0x789327[_0xe151('0x34')]:_0xef4d8[_0xe151('0x30')];if(!_0x108440[_0xe151('0x31')]['hasOwnProperty'](_0xe151('0x37'))){_0x789327[_0xe151('0x1f')]=qs['limit'](_0x108440[_0xe151('0x31')][_0xe151('0x1f')]);_0x789327[_0xe151('0x1e')]=qs[_0xe151('0x1e')](_0x108440['query']['offset']);}_0x789327['order']=qs[_0xe151('0x39')](_0x108440[_0xe151('0x31')][_0xe151('0x39')]);_0x789327['where']=qs[_0xe151('0x32')](_[_0xe151('0x3b')](_0x108440[_0xe151('0x31')],_0xef4d8[_0xe151('0x32')]));_0x789327[_0xe151('0x3a')][_0xe151('0x53')]=_0x421b18['id'];if(_0x108440[_0xe151('0x31')][_0xe151('0x3c')]){_0x789327[_0xe151('0x3a')]=_[_0xe151('0x3d')](_0x789327[_0xe151('0x3a')],{'$or':_[_0xe151('0x2d')](_0x789327[_0xe151('0x34')],function(_0x36246b){var _0x4de937={};_0x4de937[_0x36246b]={'$like':'%'+_0x108440['query'][_0xe151('0x3c')]+'%'};return _0x4de937;})});}_0x789327=_[_0xe151('0x3d')]({},_0x789327,_0x108440['options']);return db[_0xe151('0x52')]['findAll'](_0x789327);}})[_0xe151('0x25')](function(_0xb40a44){if(_0xb40a44){return db[_0xe151('0x54')][_0xe151('0x55')]({'where':{'id':_['map'](_0xb40a44,'UserId'),'role':_0xe151('0x56')},'attributes':['id',_0xe151('0x2b'),_0xe151('0x57'),_0xe151('0x58'),_0xe151('0x59')]});}})[_0xe151('0x25')](function(_0x40d585){if(_0x40d585){return{'count':_0x40d585['count'],'rows':_[_0xe151('0x2d')](_0x40d585['rows'],function(_0x305391){return{'membername':_0x305391[_0xe151('0x2b')],'UserId':_0x305391['id'],'queue_name':_0x50237f[_0xe151('0x2b')],'FaxQueueId':_0x50237f['id'],'interface':util[_0xe151('0x5a')](_0xe151('0x5b'),'SIP',_0x305391['name']),'penalty':0x0,'paused':_0x305391[_0xe151('0x57')],'createdAt':_0x305391['createdAt'],'updatedAt':_0x305391[_0xe151('0x58')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe151('0x25')](respondWithFilteredResult(_0x4a32f2,_0x789327))[_0xe151('0x44')](handleError(_0x4a32f2,null));};exports[_0xe151('0x5c')]=function(_0x4070a8,_0x5056bb,_0x252c04){var _0x8ff745={};var _0x384ca6={};var _0xd6d5e2;var _0x4d1f42;return db[_0xe151('0x40')][_0xe151('0x51')]({'where':{'id':_0x4070a8[_0xe151('0x45')]['id']}})[_0xe151('0x25')](handleEntityNotFound(_0x5056bb,null))[_0xe151('0x25')](function(_0x3354c7){if(_0x3354c7){_0xd6d5e2=_0x3354c7;_0x384ca6[_0xe151('0x30')]=_[_0xe151('0x46')](db[_0xe151('0x5d')][_0xe151('0x2e')]);_0x384ca6[_0xe151('0x31')]=_[_0xe151('0x46')](_0x4070a8[_0xe151('0x31')]);_0x384ca6[_0xe151('0x32')]=_[_0xe151('0x33')](_0x384ca6['model'],_0x384ca6['query']);_0x8ff745['attributes']=_[_0xe151('0x33')](_0x384ca6[_0xe151('0x30')],qs[_0xe151('0x35')](_0x4070a8[_0xe151('0x31')]['fields']));_0x8ff745[_0xe151('0x34')]=_0x8ff745[_0xe151('0x34')][_0xe151('0x36')]?_0x8ff745['attributes']:_0x384ca6['model'];_0x8ff745[_0xe151('0x38')]=qs['sort'](_0x4070a8[_0xe151('0x31')]['sort']);_0x8ff745[_0xe151('0x3a')]=qs[_0xe151('0x32')](_[_0xe151('0x3b')](_0x4070a8[_0xe151('0x31')],_0x384ca6[_0xe151('0x32')]));if(_0x4070a8['query'][_0xe151('0x3c')]){_0x8ff745['where']=_[_0xe151('0x3d')](_0x8ff745[_0xe151('0x3a')],{'$or':_[_0xe151('0x2d')](_0x8ff745[_0xe151('0x34')],function(_0x19a911){var _0x3daeb1={};_0x3daeb1[_0x19a911]={'$like':'%'+_0x4070a8['query'][_0xe151('0x3c')]+'%'};return _0x3daeb1;})});}_0x8ff745=_['merge']({},_0x8ff745,_0x4070a8[_0xe151('0x3f')]);return _0xd6d5e2[_0xe151('0x5c')](_0x8ff745);}})[_0xe151('0x25')](function(_0xef9f0d){if(_0xef9f0d){_0x4d1f42=_0xef9f0d[_0xe151('0x36')];if(!_0x4070a8[_0xe151('0x31')][_0xe151('0x5e')](_0xe151('0x37'))){_0x8ff745[_0xe151('0x1f')]=qs[_0xe151('0x1f')](_0x4070a8[_0xe151('0x31')][_0xe151('0x1f')]);_0x8ff745['offset']=qs[_0xe151('0x1e')](_0x4070a8[_0xe151('0x31')][_0xe151('0x1e')]);}return _0xd6d5e2[_0xe151('0x5c')](_0x8ff745);}})[_0xe151('0x25')](function(_0x398c0d){if(_0x398c0d){return _0x398c0d?{'count':_0x4d1f42,'rows':_0x398c0d}:null;}})[_0xe151('0x25')](respondWithResult(_0x5056bb,null))[_0xe151('0x44')](handleError(_0x5056bb,null));};exports[_0xe151('0x5f')]=function(_0x5ab7cf,_0xad6bb7,_0x23afc3){var _0x260419=_0x5ab7cf['body'][_0xe151('0x60')];return db[_0xe151('0x5d')][_0xe151('0x42')]({'where':{'id':_0x260419},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xe151('0x2b'),_0xe151('0x61'),'voicePause','interface'],'raw':!![]}]})[_0xe151('0x25')](function(_0x5624ee){if(_0x5624ee){var _0x11785f=_[_0xe151('0x62')](_0x5624ee,function(_0x51893c){var _0x597c82=_0x51893c[_0xe151('0x27')]({'plain':!![]});return _0x597c82[_0xe151('0x63')];});return db[_0xe151('0x40')][_0xe151('0x4c')]({'where':{'id':_0x5ab7cf['params']['id']}})['then'](function(_0x5c2885){return db[_0xe151('0x64')][_0xe151('0x65')](function(_0x553725){return _0x5c2885[_0xe151('0x5f')](_0x260419,{'transaction':_0x553725})[_0xe151('0x25')](function(){return BPromise[_0xe151('0x66')](_0x11785f,function(_0x1f88bf){return db['UserFaxQueue'][_0xe151('0x67')]({'where':{'UserId':_0x1f88bf['id'],'FaxQueueId':_0x5ab7cf[_0xe151('0x45')]['id']},'transaction':_0x553725});});})['then'](function(){_0x11785f['forEach'](function(_0x1a40f0){socket[_0xe151('0x68')]('userFaxQueue:save',{'UserId':_0x1a40f0['id'],'FaxQueueId':_0x5c2885['id']});});});});});}})[_0xe151('0x25')](respondWithStatusCode(_0xad6bb7,null))[_0xe151('0x44')](handleError(_0xad6bb7,null));};exports[_0xe151('0x69')]=function(_0xecb70d,_0x50a436,_0x3caba5){return db[_0xe151('0x5d')]['findAll']({'where':{'id':_0xecb70d[_0xe151('0x31')][_0xe151('0x60')]},'attributes':['id'],'include':[{'model':db[_0xe151('0x54')],'as':_0xe151('0x63'),'attributes':['id'],'raw':!![]}]})[_0xe151('0x25')](handleEntityNotFound(_0x50a436,null))[_0xe151('0x25')](function(_0x5acf32){var _0x2fb113=_[_0xe151('0x2d')](_0x5acf32,'id');var _0x229247=[];var _0x1fdeaf=[];var _0x19dc5f=squel[_0xe151('0x6a')]();_0x19dc5f[_0xe151('0x6b')](_0xe151('0x6c'))[_0xe151('0x6d')]('team_has_fax_queues','tq')[_0xe151('0x6e')](_0xe151('0x6f'),'ut',_0xe151('0x70'))['where']('FaxQueueId\x20=\x20?',_0xecb70d['params']['id']);for(var _0x349a24=0x0;_0x349a24<_0x5acf32[_0xe151('0x36')];_0x349a24+=0x1){let _0x439e18=_0x5acf32[_0x349a24];for(var _0x97911e=0x0;_0x97911e<_0x439e18[_0xe151('0x63')][_0xe151('0x36')];_0x97911e+=0x1){let _0x4ae35f=_0x439e18[_0xe151('0x63')][_0x97911e];var _0x191692=_0x19dc5f[_0xe151('0x71')]();_0x191692['where']('ut.UserId\x20=\x20?',_0x4ae35f['id']);_0x1fdeaf[_0xe151('0x72')](db['sequelize'][_0xe151('0x31')](_0x191692['toString'](),{'type':db[_0xe151('0x64')][_0xe151('0x73')][_0xe151('0x74')]})[_0xe151('0x25')](function(_0x1a3475){if(_0x1a3475[_0xe151('0x36')]===0x1){return _0x4ae35f['id'];}else{var _0x35070f=_[_0xe151('0x75')](_[_0xe151('0x2d')](_0x1a3475,_0xe151('0x76')),function(_0x529e38){return _[_0xe151('0x77')](_0x2fb113,_0x529e38);});if(_0x35070f){return _0x4ae35f['id'];}}}));}}return BPromise[_0xe151('0x78')](_0x1fdeaf)[_0xe151('0x25')](function(_0x2b31e7){_0x229247=_(_0x229247)[_0xe151('0x79')](_0x2b31e7)[_0xe151('0x7a')]()[_0xe151('0x7b')]();return db['FaxQueue'][_0xe151('0x4c')]({'where':{'id':_0xecb70d[_0xe151('0x45')]['id']}})[_0xe151('0x25')](function(_0xfc890f){return db[_0xe151('0x64')][_0xe151('0x65')](function(_0x5e9c5f){return _0xfc890f[_0xe151('0x69')](_0xecb70d[_0xe151('0x31')][_0xe151('0x60')],{'transaction':_0x5e9c5f})['then'](function(){if(!_[_0xe151('0x7c')](_0x229247)){return _0xfc890f[_0xe151('0x7d')](_0x229247,{'transaction':_0x5e9c5f});}})['then'](function(){_0x229247[_0xe151('0x7e')](function(_0x483a5c){socket[_0xe151('0x68')]('userFaxQueue:remove',{'UserId':_0x483a5c,'FaxQueueId':_0xfc890f['id']});});});});});});})['then'](respondWithStatusCode(_0x50a436,null))[_0xe151('0x44')](handleError(_0x50a436,null));};exports['addAgents']=function(_0x2a325d,_0x2bdb1a,_0x2431fe){return db[_0xe151('0x40')][_0xe151('0x4c')]({'where':{'id':_0x2a325d[_0xe151('0x45')]['id']}})['then'](handleEntityNotFound(_0x2bdb1a,null))['then'](function(_0x1cfd41){if(_0x1cfd41){return _0x1cfd41[_0xe151('0x7f')](_0x2a325d[_0xe151('0x47')][_0xe151('0x60')],_[_0xe151('0x80')](_0x2a325d['body'],[_0xe151('0x60'),'id'])||{})[_0xe151('0x81')](function(_0x466cf7){for(var _0xbf082b=0x0;_0xbf082b<_0x2a325d[_0xe151('0x47')][_0xe151('0x60')][_0xe151('0x36')];_0xbf082b+=0x1){socket[_0xe151('0x68')](_0xe151('0x82'),{'UserId':Number(_0x2a325d[_0xe151('0x47')][_0xe151('0x60')][_0xbf082b]),'FaxQueueId':Number(_0x2a325d[_0xe151('0x45')]['id'])});}return _0x466cf7;});}})['then'](respondWithResult(_0x2bdb1a,null))['catch'](handleError(_0x2bdb1a,null));};exports['removeAgents']=function(_0x454604,_0x3f0b42,_0x42a791){return db[_0xe151('0x40')]['find']({'where':{'id':_0x454604[_0xe151('0x45')]['id']}})[_0xe151('0x25')](handleEntityNotFound(_0x3f0b42,null))[_0xe151('0x25')](function(_0x5d0091){if(_0x5d0091){return _0x5d0091[_0xe151('0x7d')](_0x454604['query'][_0xe151('0x60')])[_0xe151('0x25')](function(){if(_[_0xe151('0x83')](_0x454604[_0xe151('0x31')][_0xe151('0x60')])){for(var _0x413923=0x0;_0x413923<_0x454604[_0xe151('0x31')][_0xe151('0x60')]['length'];_0x413923+=0x1){socket[_0xe151('0x68')](_0xe151('0x84'),{'UserId':Number(_0x454604['query'][_0xe151('0x60')][_0x413923]),'FaxQueueId':Number(_0x454604[_0xe151('0x45')]['id'])});}}else{socket[_0xe151('0x68')]('userFaxQueue:remove',{'UserId':Number(_0x454604[_0xe151('0x31')][_0xe151('0x60')]),'FaxQueueId':Number(_0x454604[_0xe151('0x45')]['id'])});}});}})[_0xe151('0x25')](respondWithStatusCode(_0x3f0b42,null))[_0xe151('0x44')](handleError(_0x3f0b42,null));};exports[_0xe151('0x85')]=function(_0x4be445,_0x68c007,_0xfd3c84){var _0x4b410a={};var _0x1e8840={};var _0x4ffb4a;var _0x2fc823;return db['FaxQueue'][_0xe151('0x51')]({'where':{'id':_0x4be445[_0xe151('0x45')]['id']}})[_0xe151('0x25')](handleEntityNotFound(_0x68c007,null))[_0xe151('0x25')](function(_0x5912f9){if(_0x5912f9){_0x4ffb4a=_0x5912f9;_0x1e8840[_0xe151('0x30')]=_['keys'](db[_0xe151('0x54')][_0xe151('0x2e')]);_0x1e8840[_0xe151('0x31')]=_[_0xe151('0x46')](_0x4be445[_0xe151('0x31')]);_0x1e8840['filters']=_[_0xe151('0x33')](_0x1e8840[_0xe151('0x30')],_0x1e8840['query']);_0x4b410a[_0xe151('0x34')]=_[_0xe151('0x33')](_0x1e8840[_0xe151('0x30')],qs[_0xe151('0x35')](_0x4be445[_0xe151('0x31')]['fields']));_0x4b410a['attributes']=_0x4b410a[_0xe151('0x34')][_0xe151('0x36')]?_0x4b410a['attributes']:_0x1e8840[_0xe151('0x30')];_0x4b410a[_0xe151('0x38')]=qs[_0xe151('0x39')](_0x4be445[_0xe151('0x31')][_0xe151('0x39')]);_0x4b410a[_0xe151('0x3a')]=qs[_0xe151('0x32')](_[_0xe151('0x3b')](_0x4be445[_0xe151('0x31')],_0x1e8840[_0xe151('0x32')]));if(_0x4be445[_0xe151('0x31')][_0xe151('0x3c')]){_0x4b410a[_0xe151('0x3a')]=_[_0xe151('0x3d')](_0x4b410a[_0xe151('0x3a')],{'$or':_[_0xe151('0x2d')](_0x4b410a['attributes'],function(_0xf2eaef){var _0x4693f0={};_0x4693f0[_0xf2eaef]={'$like':'%'+_0x4be445[_0xe151('0x31')]['filter']+'%'};return _0x4693f0;})});}_0x4b410a=_[_0xe151('0x3d')]({},_0x4b410a,_0x4be445[_0xe151('0x3f')]);return _0x4ffb4a[_0xe151('0x85')](_0x4b410a);}})[_0xe151('0x25')](function(_0xdd6a33){if(_0xdd6a33){_0x2fc823=_0xdd6a33[_0xe151('0x36')];if(!_0x4be445[_0xe151('0x31')]['hasOwnProperty']('nolimit')){_0x4b410a[_0xe151('0x1f')]=qs[_0xe151('0x1f')](_0x4be445[_0xe151('0x31')]['limit']);_0x4b410a[_0xe151('0x1e')]=qs[_0xe151('0x1e')](_0x4be445[_0xe151('0x31')][_0xe151('0x1e')]);}return _0x4ffb4a[_0xe151('0x85')](_0x4b410a);}})['then'](function(_0x39b801){if(_0x39b801){return _0x39b801?{'count':_0x2fc823,'rows':_0x39b801}:null;}})[_0xe151('0x25')](respondWithResult(_0x68c007,null))[_0xe151('0x44')](handleError(_0x68c007,null));};
\ No newline at end of file
index dcfa690..8dfc258 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9207=['hook','exports','../../mysqldb','update','remove','hasOwnProperty'];(function(_0x3f8380,_0x1b5401){var _0x234dc8=function(_0x2bf97a){while(--_0x2bf97a){_0x3f8380['push'](_0x3f8380['shift']());}};_0x234dc8(++_0x1b5401);}(_0x9207,0xb0));var _0x7920=function(_0x1b58b8,_0x3e1c2a){_0x1b58b8=_0x1b58b8-0x0;var _0x479502=_0x9207[_0x1b58b8];return _0x479502;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x7920('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7920('0x1'),'afterDestroy':_0x7920('0x2')};function emitEvent(_0xe48688){return function(_0x2a997a,_0x5033a3,_0x5a2861){FaxQueueEvents['emit'](_0xe48688+':'+_0x2a997a['id'],_0x2a997a);FaxQueueEvents['emit'](_0xe48688,_0x2a997a);_0x5a2861(null);};}for(var e in events){if(events[_0x7920('0x3')](e)){var event=events[e];FaxQueue[_0x7920('0x4')](e,emitEvent(event));}}module[_0x7920('0x5')]=FaxQueueEvents;
\ No newline at end of file
+var _0x3fa2=['hook','events','FaxQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x579de4,_0x34dac7){var _0x1d971f=function(_0x4ed314){while(--_0x4ed314){_0x579de4['push'](_0x579de4['shift']());}};_0x1d971f(++_0x34dac7);}(_0x3fa2,0x1d1));var _0x23fa=function(_0x27e297,_0x789346){_0x27e297=_0x27e297-0x0;var _0x2c1458=_0x3fa2[_0x27e297];return _0x2c1458;};'use strict';var EventEmitter=require(_0x23fa('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x23fa('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x23fa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x23fa('0x3'),'afterDestroy':_0x23fa('0x4')};function emitEvent(_0x3fc9f5){return function(_0x28943a,_0x56caab,_0x413eb4){FaxQueueEvents['emit'](_0x3fc9f5+':'+_0x28943a['id'],_0x28943a);FaxQueueEvents[_0x23fa('0x5')](_0x3fc9f5,_0x28943a);_0x413eb4(null);};}for(var e in events){if(events[_0x23fa('0x6')](e)){var event=events[e];FaxQueue[_0x23fa('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents;
\ No newline at end of file
index e07bc2c..7a14fa5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5221=['FaxQueue','fax_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5221,0x10a));var _0x1522=function(_0x495512,_0x40cbed){_0x495512=_0x495512-0x0;var _0x485ed0=_0x5221[_0x495512];return _0x485ed0;};'use strict';var _=require(_0x1522('0x0'));var util=require('util');var logger=require(_0x1522('0x1'))('api');var moment=require(_0x1522('0x2'));var BPromise=require(_0x1522('0x3'));var rp=require(_0x1522('0x4'));var fs=require('fs');var path=require(_0x1522('0x5'));var rimraf=require(_0x1522('0x6'));var config=require('../../config/environment');var attributes=require(_0x1522('0x7'));module['exports']=function(_0x4d3751,_0x5de5da){return _0x4d3751[_0x1522('0x8')](_0x1522('0x9'),attributes,{'tableName':_0x1522('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x760a=['api','request-promise','path','rimraf','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger'];(function(_0xa6feb7,_0x4fd6c2){var _0x13f339=function(_0x502d69){while(--_0x502d69){_0xa6feb7['push'](_0xa6feb7['shift']());}};_0x13f339(++_0x4fd6c2);}(_0x760a,0x1c5));var _0xa760=function(_0x5e2c00,_0x5acc41){_0x5e2c00=_0x5e2c00-0x0;var _0x3eb680=_0x760a[_0x5e2c00];return _0x3eb680;};'use strict';var _=require(_0xa760('0x0'));var util=require(_0xa760('0x1'));var logger=require(_0xa760('0x2'))(_0xa760('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa760('0x4'));var fs=require('fs');var path=require(_0xa760('0x5'));var rimraf=require(_0xa760('0x6'));var config=require('../../config/environment');var attributes=require(_0xa760('0x7'));module[_0xa760('0x8')]=function(_0x6625d3,_0x295310){return _0x6625d3[_0xa760('0x9')](_0xa760('0xa'),attributes,{'tableName':_0xa760('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ecaf5ff..e89769d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x57b6=['../../config/environment','jayson/promise','http','redis','defaults','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','limit','include','map','model','ShowFaxQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2cdf9c,_0x56a574){var _0x5bf4fb=function(_0xef1599){while(--_0xef1599){_0x2cdf9c['push'](_0x2cdf9c['shift']());}};_0x5bf4fb(++_0x56a574);}(_0x57b6,0x191));var _0x657b=function(_0x36e5c6,_0x220dba){_0x36e5c6=_0x36e5c6-0x0;var _0x2eaaa4=_0x57b6[_0x36e5c6];return _0x2eaaa4;};'use strict';var _=require('lodash');var util=require(_0x657b('0x0'));var moment=require(_0x657b('0x1'));var BPromise=require(_0x657b('0x2'));var rs=require(_0x657b('0x3'));var fs=require('fs');var Redis=require(_0x657b('0x4'));var db=require(_0x657b('0x5'))['db'];var utils=require(_0x657b('0x6'));var logger=require(_0x657b('0x7'))(_0x657b('0x8'));var config=require(_0x657b('0x9'));var jayson=require(_0x657b('0xa'));var client=jayson['client'][_0x657b('0xb')]({'port':0x232a});config[_0x657b('0xc')]=_[_0x657b('0xd')](config[_0x657b('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x657b('0xc')]));require(_0x657b('0xe'))[_0x657b('0xf')](socket);function respondWithRpcPromise(_0x10cb10,_0x1ff720,_0x2f7717){return new BPromise(function(_0x3ca8a0,_0x122011){return client[_0x657b('0x10')](_0x10cb10,_0x2f7717)[_0x657b('0x11')](function(_0x374944){logger['info'](_0x657b('0x12'),_0x1ff720,_0x657b('0x13'));logger[_0x657b('0x14')](_0x657b('0x15'),_0x1ff720,_0x657b('0x13'),JSON[_0x657b('0x16')](_0x374944));if(_0x374944['error']){if(_0x374944['error'][_0x657b('0x17')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x1ff720,_0x374944[_0x657b('0x18')][_0x657b('0x19')]);return _0x122011(_0x374944['error'][_0x657b('0x19')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x1ff720,_0x374944[_0x657b('0x18')][_0x657b('0x19')]);return _0x3ca8a0(_0x374944['error'][_0x657b('0x19')]);}else{logger[_0x657b('0x1a')](_0x657b('0x12'),_0x1ff720,_0x657b('0x13'));_0x3ca8a0(_0x374944[_0x657b('0x1b')]['message']);}})[_0x657b('0x1c')](function(_0x3ffd80){logger[_0x657b('0x18')]('FaxQueue,\x20%s,\x20%s',_0x1ff720,_0x3ffd80);_0x122011(_0x3ffd80);});});}exports[_0x657b('0x1d')]=function(_0x4d7977){var _0x1b8b15=this;return new Promise(function(_0x1fe859,_0x103b28){return db[_0x657b('0x1e')][_0x657b('0x1f')]({'raw':_0x4d7977[_0x657b('0x20')]?_0x4d7977[_0x657b('0x20')][_0x657b('0x21')]===undefined?!![]:![]:!![],'where':_0x4d7977['options']?_0x4d7977[_0x657b('0x20')]['where']||null:null,'attributes':_0x4d7977['options']?_0x4d7977[_0x657b('0x20')][_0x657b('0x22')]||null:null,'limit':_0x4d7977['options']?_0x4d7977[_0x657b('0x20')][_0x657b('0x23')]||null:null,'include':_0x4d7977['options']?_0x4d7977[_0x657b('0x20')][_0x657b('0x24')]?_[_0x657b('0x25')](_0x4d7977['options']['include'],function(_0x5639ff){return{'model':db[_0x5639ff[_0x657b('0x26')]],'as':_0x5639ff['as'],'attributes':_0x5639ff[_0x657b('0x22')],'include':_0x5639ff[_0x657b('0x24')]?_[_0x657b('0x25')](_0x5639ff[_0x657b('0x24')],function(_0x2b0209){return{'model':db[_0x2b0209[_0x657b('0x26')]],'as':_0x2b0209['as'],'attributes':_0x2b0209[_0x657b('0x22')],'include':_0x2b0209[_0x657b('0x24')]?_['map'](_0x2b0209[_0x657b('0x24')],function(_0x18bd39){return{'model':db[_0x18bd39[_0x657b('0x26')]],'as':_0x18bd39['as'],'attributes':_0x18bd39[_0x657b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x657b('0x11')](function(_0x21c1b3){logger[_0x657b('0x1a')](_0x657b('0x1d'),_0x4d7977);logger[_0x657b('0x14')]('GetFaxQueue',_0x4d7977,JSON[_0x657b('0x16')](_0x21c1b3));_0x1fe859(_0x21c1b3);})[_0x657b('0x1c')](function(_0x2db605){logger[_0x657b('0x18')]('GetFaxQueue',_0x2db605[_0x657b('0x19')],_0x4d7977);_0x103b28(_0x1b8b15['error'](0x1f4,_0x2db605[_0x657b('0x19')]));});});};exports[_0x657b('0x27')]=function(_0x171f72){var _0x2f8921=this;return new Promise(function(_0x3b04be,_0x548441){return db['FaxQueue'][_0x657b('0x28')]({'raw':_0x171f72['options']?_0x171f72[_0x657b('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x171f72['options']?_0x171f72[_0x657b('0x20')]['where']||null:null,'attributes':_0x171f72[_0x657b('0x20')]?_0x171f72['options']['attributes']||null:null,'include':_0x171f72[_0x657b('0x20')]?_0x171f72[_0x657b('0x20')][_0x657b('0x24')]?_[_0x657b('0x25')](_0x171f72[_0x657b('0x20')][_0x657b('0x24')],function(_0x1bbd54){return{'model':db[_0x1bbd54['model']],'as':_0x1bbd54['as'],'attributes':_0x1bbd54[_0x657b('0x22')],'include':_0x1bbd54[_0x657b('0x24')]?_['map'](_0x1bbd54[_0x657b('0x24')],function(_0xa12a4e){return{'model':db[_0xa12a4e['model']],'as':_0xa12a4e['as'],'attributes':_0xa12a4e[_0x657b('0x22')],'include':_0xa12a4e[_0x657b('0x24')]?_[_0x657b('0x25')](_0xa12a4e[_0x657b('0x24')],function(_0x17e9c7){return{'model':db[_0x17e9c7[_0x657b('0x26')]],'as':_0x17e9c7['as'],'attributes':_0x17e9c7[_0x657b('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a9d86){logger[_0x657b('0x1a')](_0x657b('0x27'),_0x171f72);logger[_0x657b('0x14')]('ShowFaxQueue',_0x171f72,JSON[_0x657b('0x16')](_0x4a9d86));_0x3b04be(_0x4a9d86);})[_0x657b('0x1c')](function(_0xeef6ac){logger[_0x657b('0x18')]('ShowFaxQueue',_0xeef6ac[_0x657b('0x19')],_0x171f72);_0x548441(_0x2f8921[_0x657b('0x18')](0x1f4,_0xeef6ac[_0x657b('0x19')]));});});};
\ No newline at end of file
+var _0x8132=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetFaxQueue','options','where','include','model','attributes','map','stringify','ShowFaxQueue','FaxQueue','find','raw','lodash'];(function(_0x1a1496,_0x4da05a){var _0x41401b=function(_0x5a4fa5){while(--_0x5a4fa5){_0x1a1496['push'](_0x1a1496['shift']());}};_0x41401b(++_0x4da05a);}(_0x8132,0x167));var _0x2813=function(_0x4d5fff,_0x2c0307){_0x4d5fff=_0x4d5fff-0x0;var _0x375f65=_0x8132[_0x4d5fff];return _0x375f65;};'use strict';var _=require(_0x2813('0x0'));var util=require(_0x2813('0x1'));var moment=require(_0x2813('0x2'));var BPromise=require(_0x2813('0x3'));var rs=require(_0x2813('0x4'));var fs=require('fs');var Redis=require(_0x2813('0x5'));var db=require(_0x2813('0x6'))['db'];var utils=require(_0x2813('0x7'));var logger=require(_0x2813('0x8'))(_0x2813('0x9'));var config=require(_0x2813('0xa'));var jayson=require(_0x2813('0xb'));var client=jayson['client'][_0x2813('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2813('0xd')],{'host':_0x2813('0xe'),'port':0x18eb});var socket=require(_0x2813('0xf'))(new Redis(config[_0x2813('0xd')]));require(_0x2813('0x10'))[_0x2813('0x11')](socket);function respondWithRpcPromise(_0x277269,_0x309512,_0x2016b3){return new BPromise(function(_0x1425b8,_0x211580){return client[_0x2813('0x12')](_0x277269,_0x2016b3)[_0x2813('0x13')](function(_0x573db8){logger[_0x2813('0x14')](_0x2813('0x15'),_0x309512,_0x2813('0x16'));logger[_0x2813('0x17')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x309512,_0x2813('0x16'),JSON['stringify'](_0x573db8));if(_0x573db8['error']){if(_0x573db8[_0x2813('0x18')]['code']===0x1f4){logger[_0x2813('0x18')]('FaxQueue,\x20%s,\x20%s',_0x309512,_0x573db8[_0x2813('0x18')][_0x2813('0x19')]);return _0x211580(_0x573db8['error']['message']);}logger[_0x2813('0x18')](_0x2813('0x15'),_0x309512,_0x573db8[_0x2813('0x18')][_0x2813('0x19')]);return _0x1425b8(_0x573db8[_0x2813('0x18')]['message']);}else{logger[_0x2813('0x14')]('FaxQueue,\x20%s,\x20%s',_0x309512,_0x2813('0x16'));_0x1425b8(_0x573db8[_0x2813('0x1a')]['message']);}})[_0x2813('0x1b')](function(_0x3dfe56){logger['error'](_0x2813('0x15'),_0x309512,_0x3dfe56);_0x211580(_0x3dfe56);});});}exports[_0x2813('0x1c')]=function(_0x5c5020){var _0x314e4a=this;return new Promise(function(_0x27ca86,_0x21ca55){return db['FaxQueue']['findAll']({'raw':_0x5c5020[_0x2813('0x1d')]?_0x5c5020['options']['raw']===undefined?!![]:![]:!![],'where':_0x5c5020[_0x2813('0x1d')]?_0x5c5020[_0x2813('0x1d')][_0x2813('0x1e')]||null:null,'attributes':_0x5c5020[_0x2813('0x1d')]?_0x5c5020[_0x2813('0x1d')]['attributes']||null:null,'limit':_0x5c5020['options']?_0x5c5020[_0x2813('0x1d')]['limit']||null:null,'include':_0x5c5020[_0x2813('0x1d')]?_0x5c5020[_0x2813('0x1d')][_0x2813('0x1f')]?_['map'](_0x5c5020[_0x2813('0x1d')][_0x2813('0x1f')],function(_0x9231d0){return{'model':db[_0x9231d0[_0x2813('0x20')]],'as':_0x9231d0['as'],'attributes':_0x9231d0[_0x2813('0x21')],'include':_0x9231d0['include']?_['map'](_0x9231d0[_0x2813('0x1f')],function(_0x4bdcfa){return{'model':db[_0x4bdcfa[_0x2813('0x20')]],'as':_0x4bdcfa['as'],'attributes':_0x4bdcfa[_0x2813('0x21')],'include':_0x4bdcfa[_0x2813('0x1f')]?_[_0x2813('0x22')](_0x4bdcfa[_0x2813('0x1f')],function(_0x2bda27){return{'model':db[_0x2bda27[_0x2813('0x20')]],'as':_0x2bda27['as'],'attributes':_0x2bda27[_0x2813('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2813('0x13')](function(_0x1b7956){logger[_0x2813('0x14')](_0x2813('0x1c'),_0x5c5020);logger[_0x2813('0x17')](_0x2813('0x1c'),_0x5c5020,JSON[_0x2813('0x23')](_0x1b7956));_0x27ca86(_0x1b7956);})[_0x2813('0x1b')](function(_0x4ddc81){logger[_0x2813('0x18')](_0x2813('0x1c'),_0x4ddc81[_0x2813('0x19')],_0x5c5020);_0x21ca55(_0x314e4a[_0x2813('0x18')](0x1f4,_0x4ddc81['message']));});});};exports[_0x2813('0x24')]=function(_0x13e2e2){var _0x585b7a=this;return new Promise(function(_0x5d143c,_0x478590){return db[_0x2813('0x25')][_0x2813('0x26')]({'raw':_0x13e2e2['options']?_0x13e2e2[_0x2813('0x1d')][_0x2813('0x27')]===undefined?!![]:![]:!![],'where':_0x13e2e2['options']?_0x13e2e2['options'][_0x2813('0x1e')]||null:null,'attributes':_0x13e2e2['options']?_0x13e2e2[_0x2813('0x1d')][_0x2813('0x21')]||null:null,'include':_0x13e2e2[_0x2813('0x1d')]?_0x13e2e2[_0x2813('0x1d')][_0x2813('0x1f')]?_[_0x2813('0x22')](_0x13e2e2['options']['include'],function(_0x4decfd){return{'model':db[_0x4decfd[_0x2813('0x20')]],'as':_0x4decfd['as'],'attributes':_0x4decfd[_0x2813('0x21')],'include':_0x4decfd['include']?_[_0x2813('0x22')](_0x4decfd['include'],function(_0x332dff){return{'model':db[_0x332dff[_0x2813('0x20')]],'as':_0x332dff['as'],'attributes':_0x332dff[_0x2813('0x21')],'include':_0x332dff[_0x2813('0x1f')]?_['map'](_0x332dff[_0x2813('0x1f')],function(_0x2707d4){return{'model':db[_0x2707d4[_0x2813('0x20')]],'as':_0x2707d4['as'],'attributes':_0x2707d4[_0x2813('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2813('0x13')](function(_0x27b535){logger[_0x2813('0x14')](_0x2813('0x24'),_0x13e2e2);logger[_0x2813('0x17')](_0x2813('0x24'),_0x13e2e2,JSON[_0x2813('0x23')](_0x27b535));_0x5d143c(_0x27b535);})[_0x2813('0x1b')](function(_0x490ceb){logger[_0x2813('0x18')]('ShowFaxQueue',_0x490ceb[_0x2813('0x19')],_0x13e2e2);_0x478590(_0x585b7a[_0x2813('0x18')](0x1f4,_0x490ceb[_0x2813('0x19')]));});});};
\ No newline at end of file
index bbf50fe..220740e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5665=['remove','emit','removeListener','faxQueue:','./faxQueue.events'];(function(_0x258b93,_0x188ccc){var _0x35484b=function(_0x2563ea){while(--_0x2563ea){_0x258b93['push'](_0x258b93['shift']());}};_0x35484b(++_0x188ccc);}(_0x5665,0x162));var _0x5566=function(_0x27d7d5,_0x11b16e){_0x27d7d5=_0x27d7d5-0x0;var _0x6b6b77=_0x5665[_0x27d7d5];return _0x6b6b77;};'use strict';var FaxQueueEvents=require(_0x5566('0x0'));var events=['save',_0x5566('0x1'),'update'];function createListener(_0x155908,_0x5ccde7){return function(_0x5e1f66){_0x5ccde7[_0x5566('0x2')](_0x155908,_0x5e1f66);};}function removeListener(_0x27cea0,_0x292ae0){return function(){FaxQueueEvents[_0x5566('0x3')](_0x27cea0,_0x292ae0);};}exports['register']=function(_0x1a6a13){for(var _0x2394c6=0x0,_0x516a98=events['length'];_0x2394c6<_0x516a98;_0x2394c6++){var _0x3cd57a=events[_0x2394c6];var _0x210b55=createListener(_0x5566('0x4')+_0x3cd57a,_0x1a6a13);FaxQueueEvents['on'](_0x3cd57a,_0x210b55);}};
\ No newline at end of file
+var _0xd45e=['faxQueue:','save','remove','emit','removeListener','register','length'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0xd45e,0x182));var _0xed45=function(_0x59ce68,_0x98d1b5){_0x59ce68=_0x59ce68-0x0;var _0x37c816=_0xd45e[_0x59ce68];return _0x37c816;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xed45('0x0'),_0xed45('0x1'),'update'];function createListener(_0x2d14c4,_0x5591e8){return function(_0x18aa20){_0x5591e8[_0xed45('0x2')](_0x2d14c4,_0x18aa20);};}function removeListener(_0x9c1494,_0x5667ca){return function(){FaxQueueEvents[_0xed45('0x3')](_0x9c1494,_0x5667ca);};}exports[_0xed45('0x4')]=function(_0x5332aa){for(var _0x528ca3=0x0,_0x3185ae=events[_0xed45('0x5')];_0x528ca3<_0x3185ae;_0x528ca3++){var _0x4afe6c=events[_0x528ca3];var _0x380a8=createListener(_0xed45('0x6')+_0x4afe6c,_0x5332aa);FaxQueueEvents['on'](_0x4afe6c,_0x380a8);}};
\ No newline at end of file
index a7e872c..264d5d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadb5=['index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1703c6,_0x42c17f){var _0x5e0b6d=function(_0x400189){while(--_0x400189){_0x1703c6['push'](_0x1703c6['shift']());}};_0x5e0b6d(++_0x42c17f);}(_0xadb5,0xad));var _0x5adb=function(_0x4812e1,_0x4dae3a){_0x4812e1=_0x4812e1-0x0;var _0x2c0157=_0xadb5[_0x4812e1];return _0x2c0157;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./faxQueue.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getMembers']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['get'](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x12')]);router['post']('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x13')]);router[_0x5adb('0x14')]('/:id/teams',auth[_0x5adb('0x8')](),controller[_0x5adb('0x15')]);router[_0x5adb('0x14')]('/:id/users',auth[_0x5adb('0x8')](),controller['addAgents']);router[_0x5adb('0x16')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);router[_0x5adb('0x18')]('/:id/teams',auth[_0x5adb('0x8')](),controller['removeTeams']);router[_0x5adb('0x18')]('/:id/users',auth[_0x5adb('0x8')](),controller['removeAgents']);module['exports']=router;
\ No newline at end of file
+var _0x68b3=['addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x68b3,0x1d8));var _0x368b=function(_0x58753b,_0xdee410){_0x58753b=_0x58753b-0x0;var _0x2c25e6=_0x68b3[_0x58753b];return _0x2c25e6;};'use strict';var multer=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var path=require(_0x368b('0x2'));var timeout=require(_0x368b('0x3'));var express=require(_0x368b('0x4'));var router=express['Router']();var fs_extra=require(_0x368b('0x5'));var auth=require(_0x368b('0x6'));var interaction=require(_0x368b('0x7'));var config=require(_0x368b('0x8'));var controller=require('./faxQueue.controller');router[_0x368b('0x9')]('/',auth[_0x368b('0xa')](),controller[_0x368b('0xb')]);router[_0x368b('0x9')](_0x368b('0xc'),auth[_0x368b('0xa')](),controller[_0x368b('0xd')]);router[_0x368b('0x9')](_0x368b('0xe'),auth[_0x368b('0xa')](),controller[_0x368b('0xf')]);router['get'](_0x368b('0x10'),auth[_0x368b('0xa')](),controller[_0x368b('0x11')]);router['get'](_0x368b('0x12'),auth[_0x368b('0xa')](),controller[_0x368b('0x13')]);router['get'](_0x368b('0x14'),auth[_0x368b('0xa')](),controller['getAgents']);router[_0x368b('0x15')]('/',auth[_0x368b('0xa')](),controller[_0x368b('0x16')]);router[_0x368b('0x15')](_0x368b('0x12'),auth['isAuthenticated'](),controller[_0x368b('0x17')]);router[_0x368b('0x15')]('/:id/users',auth[_0x368b('0xa')](),controller[_0x368b('0x18')]);router[_0x368b('0x19')]('/:id',auth[_0x368b('0xa')](),controller[_0x368b('0x1a')]);router[_0x368b('0x1b')]('/:id',auth[_0x368b('0xa')](),controller[_0x368b('0x1c')]);router[_0x368b('0x1b')]('/:id/teams',auth['isAuthenticated'](),controller[_0x368b('0x1d')]);router[_0x368b('0x1b')](_0x368b('0x14'),auth[_0x368b('0xa')](),controller[_0x368b('0x1e')]);module['exports']=router;
\ No newline at end of file
index 3c17b47..d5691e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7604=['moment','sequelize','exports','STRING','DATE'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0x7604,0xd2));var _0x4760=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7604[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0x4760('0x0'));var Sequelize=require(_0x4760('0x1'));module[_0x4760('0x2')]={'uniqueid':{'type':Sequelize[_0x4760('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4760('0x4')]},'acceptAt':{'type':Sequelize[_0x4760('0x4')]},'exitAt':{'type':Sequelize[_0x4760('0x4')]},'reason':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xef23=['STRING','DATE','moment','sequelize','exports'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xef23,0x93));var _0x3ef2=function(_0x5f58fa,_0x3f8276){_0x5f58fa=_0x5f58fa-0x0;var _0xafbcca=_0xef23[_0x5f58fa];return _0xafbcca;};'use strict';var moment=require(_0x3ef2('0x0'));var Sequelize=require(_0x3ef2('0x1'));module[_0x3ef2('0x2')]={'uniqueid':{'type':Sequelize[_0x3ef2('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3ef2('0x3')]},'joinAt':{'type':Sequelize[_0x3ef2('0x4')]},'leaveAt':{'type':Sequelize[_0x3ef2('0x4')]},'acceptAt':{'type':Sequelize[_0x3ef2('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}};
\ No newline at end of file
index d81232b..7b43e19 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb575=['util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','mustache'];(function(_0x4c693b,_0x4e5aa2){var _0x56f867=function(_0x29b1a2){while(--_0x29b1a2){_0x4c693b['push'](_0x4c693b['shift']());}};_0x56f867(++_0x4e5aa2);}(_0xb575,0xda));var _0x5b57=function(_0x45d04,_0x3775bc){_0x45d04=_0x45d04-0x0;var _0x175160=_0xb575[_0x45d04];return _0x175160;};'use strict';var emlformat=require(_0x5b57('0x0'));var rimraf=require(_0x5b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b57('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5b57('0x3'));var util=require(_0x5b57('0x4'));var path=require('path');var sox=require(_0x5b57('0x5'));var csv=require(_0x5b57('0x6'));var ejs=require(_0x5b57('0x7'));var fs=require('fs');var fs_extra=require(_0x5b57('0x8'));var _=require(_0x5b57('0x9'));var squel=require('squel');var crypto=require(_0x5b57('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5b57('0xb'));var toCsv=require(_0x5b57('0x6'));var querystring=require(_0x5b57('0xc'));var Papa=require('papaparse');var Redis=require(_0x5b57('0xd'));var authService=require(_0x5b57('0xe'));var qs=require(_0x5b57('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b57('0x10'));var logger=require(_0x5b57('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x5b57('0x12'));var licenseUtil=require(_0x5b57('0x13'));var db=require(_0x5b57('0x14'))['db'];function respondWithStatusCode(_0xd897ba,_0x355dab){_0x355dab=_0x355dab||0xcc;return function(_0x45cb5c){if(_0x45cb5c){return _0xd897ba[_0x5b57('0x15')](_0x355dab);}return _0xd897ba[_0x5b57('0x16')](_0x355dab)[_0x5b57('0x17')]();};}function respondWithResult(_0x42ba90,_0x53df3e){_0x53df3e=_0x53df3e||0xc8;return function(_0x16ffe0){if(_0x16ffe0){return _0x42ba90[_0x5b57('0x16')](_0x53df3e)[_0x5b57('0x18')](_0x16ffe0);}};}function respondWithFilteredResult(_0x4ba858,_0x2a0a1b){return function(_0x3b4631){if(_0x3b4631){var _0x132430=typeof _0x2a0a1b[_0x5b57('0x19')]===_0x5b57('0x1a')&&typeof _0x2a0a1b[_0x5b57('0x1b')]===_0x5b57('0x1a');var _0x32f18d=_0x3b4631['count'];var _0x336db6=_0x132430?0x0:_0x2a0a1b[_0x5b57('0x19')];var _0x2cb809=_0x132430?_0x3b4631[_0x5b57('0x1c')]:_0x2a0a1b[_0x5b57('0x19')]+_0x2a0a1b[_0x5b57('0x1b')];var _0x5f0dc6;if(_0x2cb809>=_0x32f18d){_0x2cb809=_0x32f18d;_0x5f0dc6=0xc8;}else{_0x5f0dc6=0xce;}_0x4ba858[_0x5b57('0x16')](_0x5f0dc6);return _0x4ba858[_0x5b57('0x1d')](_0x5b57('0x1e'),_0x336db6+'-'+_0x2cb809+'/'+_0x32f18d)[_0x5b57('0x18')](_0x3b4631);}return null;};}function patchUpdates(_0x53378c){return function(_0x3c7f4f){try{jsonpatch[_0x5b57('0x1f')](_0x3c7f4f,_0x53378c,!![]);}catch(_0x3cb5c0){return BPromise['reject'](_0x3cb5c0);}return _0x3c7f4f[_0x5b57('0x20')]();};}function saveUpdates(_0xd8567a,_0x3a4488){return function(_0x28721f){if(_0x28721f){return _0x28721f[_0x5b57('0x21')](_0xd8567a)[_0x5b57('0x22')](function(_0x4a4ed8){return _0x4a4ed8;});}return null;};}function removeEntity(_0x139214,_0x50ea5f){return function(_0x11c149){if(_0x11c149){return _0x11c149[_0x5b57('0x23')]()['then'](function(){_0x139214['status'](0xcc)[_0x5b57('0x17')]();});}};}function handleEntityNotFound(_0x5eab3d,_0x120dc6){return function(_0xc173a4){if(!_0xc173a4){_0x5eab3d[_0x5b57('0x15')](0x194);}return _0xc173a4;};}function handleError(_0x20a95a,_0x39b2f4){_0x39b2f4=_0x39b2f4||0x1f4;return function(_0x17ac8b){logger[_0x5b57('0x24')](_0x17ac8b[_0x5b57('0x25')]);if(_0x17ac8b[_0x5b57('0x26')]){delete _0x17ac8b[_0x5b57('0x26')];}_0x20a95a[_0x5b57('0x16')](_0x39b2f4)[_0x5b57('0x27')](_0x17ac8b);};}exports[_0x5b57('0x28')]=function(_0x53c81b,_0xc59d9f){var _0x42664f={},_0x3e8bc6={},_0x4da4a8={'count':0x0,'rows':[]};var _0x42b276=_['map'](db[_0x5b57('0x29')][_0x5b57('0x2a')],function(_0x33b262){return{'name':_0x33b262[_0x5b57('0x2b')],'type':_0x33b262[_0x5b57('0x2c')][_0x5b57('0x2d')]};});_0x3e8bc6['model']=_[_0x5b57('0x2e')](_0x42b276,_0x5b57('0x26'));_0x3e8bc6[_0x5b57('0x2f')]=_[_0x5b57('0x30')](_0x53c81b[_0x5b57('0x2f')]);_0x3e8bc6['filters']=_[_0x5b57('0x31')](_0x3e8bc6['model'],_0x3e8bc6[_0x5b57('0x2f')]);_0x42664f['attributes']=_[_0x5b57('0x31')](_0x3e8bc6[_0x5b57('0x32')],qs[_0x5b57('0x33')](_0x53c81b[_0x5b57('0x2f')][_0x5b57('0x33')]));_0x42664f[_0x5b57('0x34')]=_0x42664f[_0x5b57('0x34')][_0x5b57('0x35')]?_0x42664f[_0x5b57('0x34')]:_0x3e8bc6[_0x5b57('0x32')];if(!_0x53c81b['query'][_0x5b57('0x36')](_0x5b57('0x37'))){_0x42664f[_0x5b57('0x1b')]=qs[_0x5b57('0x1b')](_0x53c81b[_0x5b57('0x2f')][_0x5b57('0x1b')]);_0x42664f[_0x5b57('0x19')]=qs[_0x5b57('0x19')](_0x53c81b[_0x5b57('0x2f')][_0x5b57('0x19')]);}_0x42664f[_0x5b57('0x38')]=qs[_0x5b57('0x39')](_0x53c81b[_0x5b57('0x2f')][_0x5b57('0x39')]);_0x42664f['where']=qs[_0x5b57('0x3a')](_['pick'](_0x53c81b[_0x5b57('0x2f')],_0x3e8bc6[_0x5b57('0x3a')]),_0x42b276);if(_0x53c81b[_0x5b57('0x2f')][_0x5b57('0x3b')]){_0x42664f[_0x5b57('0x3c')]=_[_0x5b57('0x3d')](_0x42664f[_0x5b57('0x3c')],{'$or':_['map'](_0x42b276,function(_0x25a1be){if(_0x25a1be[_0x5b57('0x2c')]!==_0x5b57('0x3e')){var _0x569c87={};_0x569c87[_0x25a1be[_0x5b57('0x26')]]={'$like':'%'+_0x53c81b[_0x5b57('0x2f')]['filter']+'%'};return _0x569c87;}})});}_0x42664f=_[_0x5b57('0x3d')]({},_0x42664f,_0x53c81b[_0x5b57('0x3f')]);var _0xa417ce={'where':_0x42664f['where']};return db['FaxQueueReport'][_0x5b57('0x1c')](_0xa417ce)[_0x5b57('0x22')](function(_0x529d25){_0x4da4a8[_0x5b57('0x1c')]=_0x529d25;if(_0x53c81b['query'][_0x5b57('0x40')]){_0x42664f[_0x5b57('0x41')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x5b57('0x42')](_0x42664f);})[_0x5b57('0x22')](function(_0x16a177){_0x4da4a8[_0x5b57('0x43')]=_0x16a177;return _0x4da4a8;})[_0x5b57('0x22')](respondWithFilteredResult(_0xc59d9f,_0x42664f))[_0x5b57('0x44')](handleError(_0xc59d9f,null));};exports[_0x5b57('0x45')]=function(_0x4d80e7,_0x4a0431){var _0x140d23={'raw':!![],'where':{'id':_0x4d80e7[_0x5b57('0x46')]['id']}},_0x48fb91={};_0x48fb91['model']=_[_0x5b57('0x30')](db[_0x5b57('0x29')][_0x5b57('0x2a')]);_0x48fb91[_0x5b57('0x2f')]=_[_0x5b57('0x30')](_0x4d80e7[_0x5b57('0x2f')]);_0x48fb91[_0x5b57('0x3a')]=_[_0x5b57('0x31')](_0x48fb91[_0x5b57('0x32')],_0x48fb91[_0x5b57('0x2f')]);_0x140d23[_0x5b57('0x34')]=_[_0x5b57('0x31')](_0x48fb91[_0x5b57('0x32')],qs[_0x5b57('0x33')](_0x4d80e7[_0x5b57('0x2f')][_0x5b57('0x33')]));_0x140d23[_0x5b57('0x34')]=_0x140d23[_0x5b57('0x34')][_0x5b57('0x35')]?_0x140d23['attributes']:_0x48fb91[_0x5b57('0x32')];if(_0x4d80e7[_0x5b57('0x2f')][_0x5b57('0x40')]){_0x140d23['include']=[{'all':!![]}];}_0x140d23=_[_0x5b57('0x3d')]({},_0x140d23,_0x4d80e7[_0x5b57('0x3f')]);return db[_0x5b57('0x29')][_0x5b57('0x47')](_0x140d23)['then'](handleEntityNotFound(_0x4a0431,null))['then'](respondWithResult(_0x4a0431,null))['catch'](handleError(_0x4a0431,null));};exports[_0x5b57('0x48')]=function(_0x3aabe2,_0x5e6129){return db[_0x5b57('0x29')][_0x5b57('0x48')](_0x3aabe2[_0x5b57('0x49')],{})[_0x5b57('0x22')](respondWithResult(_0x5e6129,0xc9))[_0x5b57('0x44')](handleError(_0x5e6129,null));};exports[_0x5b57('0x21')]=function(_0x22ea65,_0x2027b4){if(_0x22ea65[_0x5b57('0x49')]['id']){delete _0x22ea65[_0x5b57('0x49')]['id'];}return db[_0x5b57('0x29')][_0x5b57('0x47')]({'where':{'id':_0x22ea65[_0x5b57('0x46')]['id']}})[_0x5b57('0x22')](handleEntityNotFound(_0x2027b4,null))[_0x5b57('0x22')](saveUpdates(_0x22ea65[_0x5b57('0x49')],null))[_0x5b57('0x22')](respondWithResult(_0x2027b4,null))[_0x5b57('0x44')](handleError(_0x2027b4,null));};exports[_0x5b57('0x23')]=function(_0x115dda,_0x4761ab){return db[_0x5b57('0x29')]['find']({'where':{'id':_0x115dda['params']['id']}})[_0x5b57('0x22')](handleEntityNotFound(_0x4761ab,null))['then'](removeEntity(_0x4761ab,null))[_0x5b57('0x44')](handleError(_0x4761ab,null));};exports['describe']=function(_0x9ad4eb,_0x302176){return db[_0x5b57('0x29')]['describe']()['then'](respondWithResult(_0x302176,null))['catch'](handleError(_0x302176,null));};
\ No newline at end of file
+var _0x86f5=['FaxQueueReport','includeAll','include','findAll','rows','params','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options'];(function(_0x36eb18,_0x149e1f){var _0x4233fb=function(_0x115a6f){while(--_0x115a6f){_0x36eb18['push'](_0x36eb18['shift']());}};_0x4233fb(++_0x149e1f);}(_0x86f5,0x178));var _0x586f=function(_0xa6cb09,_0x39410f){_0xa6cb09=_0xa6cb09-0x0;var _0x12b437=_0x86f5[_0xa6cb09];return _0x12b437;};'use strict';var emlformat=require(_0x586f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x586f('0x1'));var jsonpatch=require(_0x586f('0x2'));var rp=require('request-promise');var moment=require(_0x586f('0x3'));var BPromise=require(_0x586f('0x4'));var Mustache=require(_0x586f('0x5'));var util=require(_0x586f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x586f('0x7'));var ejs=require(_0x586f('0x8'));var fs=require('fs');var fs_extra=require(_0x586f('0x9'));var _=require('lodash');var squel=require(_0x586f('0xa'));var crypto=require(_0x586f('0xb'));var jsforce=require(_0x586f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x586f('0xd'));var Papa=require(_0x586f('0xe'));var Redis=require(_0x586f('0xf'));var authService=require(_0x586f('0x10'));var qs=require(_0x586f('0x11'));var as=require(_0x586f('0x12'));var hardwareService=require(_0x586f('0x13'));var logger=require('../../config/logger')(_0x586f('0x14'));var utils=require('../../config/utils');var config=require(_0x586f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x586f('0x16'))['db'];function respondWithStatusCode(_0x5a0c86,_0xf6b7f9){_0xf6b7f9=_0xf6b7f9||0xcc;return function(_0x560019){if(_0x560019){return _0x5a0c86[_0x586f('0x17')](_0xf6b7f9);}return _0x5a0c86[_0x586f('0x18')](_0xf6b7f9)[_0x586f('0x19')]();};}function respondWithResult(_0x3fc15c,_0x1056cf){_0x1056cf=_0x1056cf||0xc8;return function(_0x23d237){if(_0x23d237){return _0x3fc15c['status'](_0x1056cf)[_0x586f('0x1a')](_0x23d237);}};}function respondWithFilteredResult(_0x4da2fa,_0x5d838c){return function(_0x3381c6){if(_0x3381c6){var _0x24d0ca=typeof _0x5d838c[_0x586f('0x1b')]===_0x586f('0x1c')&&typeof _0x5d838c[_0x586f('0x1d')]===_0x586f('0x1c');var _0x5ef362=_0x3381c6['count'];var _0x44f938=_0x24d0ca?0x0:_0x5d838c[_0x586f('0x1b')];var _0x287faf=_0x24d0ca?_0x3381c6[_0x586f('0x1e')]:_0x5d838c[_0x586f('0x1b')]+_0x5d838c[_0x586f('0x1d')];var _0x276f07;if(_0x287faf>=_0x5ef362){_0x287faf=_0x5ef362;_0x276f07=0xc8;}else{_0x276f07=0xce;}_0x4da2fa[_0x586f('0x18')](_0x276f07);return _0x4da2fa[_0x586f('0x1f')](_0x586f('0x20'),_0x44f938+'-'+_0x287faf+'/'+_0x5ef362)[_0x586f('0x1a')](_0x3381c6);}return null;};}function patchUpdates(_0x38fda7){return function(_0x2c9e43){try{jsonpatch['apply'](_0x2c9e43,_0x38fda7,!![]);}catch(_0x3e36fb){return BPromise[_0x586f('0x21')](_0x3e36fb);}return _0x2c9e43[_0x586f('0x22')]();};}function saveUpdates(_0x32b709,_0x4a7c6a){return function(_0xbd3f34){if(_0xbd3f34){return _0xbd3f34[_0x586f('0x23')](_0x32b709)[_0x586f('0x24')](function(_0x2457b3){return _0x2457b3;});}return null;};}function removeEntity(_0x2d226e,_0x4c1b9c){return function(_0x45e18e){if(_0x45e18e){return _0x45e18e[_0x586f('0x25')]()[_0x586f('0x24')](function(){_0x2d226e[_0x586f('0x18')](0xcc)[_0x586f('0x19')]();});}};}function handleEntityNotFound(_0x2683d7,_0x5cb2ba){return function(_0x1743f2){if(!_0x1743f2){_0x2683d7[_0x586f('0x17')](0x194);}return _0x1743f2;};}function handleError(_0x3e8b53,_0xcee521){_0xcee521=_0xcee521||0x1f4;return function(_0x5536ce){logger[_0x586f('0x26')](_0x5536ce['stack']);if(_0x5536ce[_0x586f('0x27')]){delete _0x5536ce[_0x586f('0x27')];}_0x3e8b53[_0x586f('0x18')](_0xcee521)[_0x586f('0x28')](_0x5536ce);};}exports[_0x586f('0x29')]=function(_0x410d51,_0x2ba6f1){var _0x4d1cfe={},_0x44e83f={},_0x550277={'count':0x0,'rows':[]};var _0x3d6bb2=_['map'](db['FaxQueueReport'][_0x586f('0x2a')],function(_0x2a2f9f){return{'name':_0x2a2f9f['fieldName'],'type':_0x2a2f9f['type'][_0x586f('0x2b')]};});_0x44e83f[_0x586f('0x2c')]=_['map'](_0x3d6bb2,_0x586f('0x27'));_0x44e83f[_0x586f('0x2d')]=_[_0x586f('0x2e')](_0x410d51[_0x586f('0x2d')]);_0x44e83f[_0x586f('0x2f')]=_[_0x586f('0x30')](_0x44e83f['model'],_0x44e83f[_0x586f('0x2d')]);_0x4d1cfe['attributes']=_[_0x586f('0x30')](_0x44e83f[_0x586f('0x2c')],qs[_0x586f('0x31')](_0x410d51[_0x586f('0x2d')][_0x586f('0x31')]));_0x4d1cfe[_0x586f('0x32')]=_0x4d1cfe[_0x586f('0x32')][_0x586f('0x33')]?_0x4d1cfe['attributes']:_0x44e83f[_0x586f('0x2c')];if(!_0x410d51[_0x586f('0x2d')][_0x586f('0x34')](_0x586f('0x35'))){_0x4d1cfe[_0x586f('0x1d')]=qs['limit'](_0x410d51[_0x586f('0x2d')]['limit']);_0x4d1cfe[_0x586f('0x1b')]=qs['offset'](_0x410d51[_0x586f('0x2d')][_0x586f('0x1b')]);}_0x4d1cfe[_0x586f('0x36')]=qs[_0x586f('0x37')](_0x410d51[_0x586f('0x2d')][_0x586f('0x37')]);_0x4d1cfe[_0x586f('0x38')]=qs[_0x586f('0x2f')](_[_0x586f('0x39')](_0x410d51[_0x586f('0x2d')],_0x44e83f['filters']),_0x3d6bb2);if(_0x410d51[_0x586f('0x2d')][_0x586f('0x3a')]){_0x4d1cfe['where']=_['merge'](_0x4d1cfe[_0x586f('0x38')],{'$or':_['map'](_0x3d6bb2,function(_0x47afad){if(_0x47afad[_0x586f('0x3b')]!=='VIRTUAL'){var _0x346a56={};_0x346a56[_0x47afad[_0x586f('0x27')]]={'$like':'%'+_0x410d51[_0x586f('0x2d')][_0x586f('0x3a')]+'%'};return _0x346a56;}})});}_0x4d1cfe=_[_0x586f('0x3c')]({},_0x4d1cfe,_0x410d51[_0x586f('0x3d')]);var _0x5269e7={'where':_0x4d1cfe[_0x586f('0x38')]};return db[_0x586f('0x3e')]['count'](_0x5269e7)[_0x586f('0x24')](function(_0x47c881){_0x550277[_0x586f('0x1e')]=_0x47c881;if(_0x410d51[_0x586f('0x2d')][_0x586f('0x3f')]){_0x4d1cfe[_0x586f('0x40')]=[{'all':!![]}];}return db[_0x586f('0x3e')][_0x586f('0x41')](_0x4d1cfe);})[_0x586f('0x24')](function(_0x1ece6d){_0x550277[_0x586f('0x42')]=_0x1ece6d;return _0x550277;})[_0x586f('0x24')](respondWithFilteredResult(_0x2ba6f1,_0x4d1cfe))['catch'](handleError(_0x2ba6f1,null));};exports['show']=function(_0x2e9b2d,_0x4ac7fc){var _0x5ef3f6={'raw':!![],'where':{'id':_0x2e9b2d[_0x586f('0x43')]['id']}},_0x5729cb={};_0x5729cb[_0x586f('0x2c')]=_[_0x586f('0x2e')](db[_0x586f('0x3e')][_0x586f('0x2a')]);_0x5729cb[_0x586f('0x2d')]=_['keys'](_0x2e9b2d[_0x586f('0x2d')]);_0x5729cb[_0x586f('0x2f')]=_[_0x586f('0x30')](_0x5729cb[_0x586f('0x2c')],_0x5729cb['query']);_0x5ef3f6[_0x586f('0x32')]=_[_0x586f('0x30')](_0x5729cb['model'],qs[_0x586f('0x31')](_0x2e9b2d[_0x586f('0x2d')]['fields']));_0x5ef3f6[_0x586f('0x32')]=_0x5ef3f6[_0x586f('0x32')][_0x586f('0x33')]?_0x5ef3f6[_0x586f('0x32')]:_0x5729cb[_0x586f('0x2c')];if(_0x2e9b2d['query'][_0x586f('0x3f')]){_0x5ef3f6['include']=[{'all':!![]}];}_0x5ef3f6=_[_0x586f('0x3c')]({},_0x5ef3f6,_0x2e9b2d[_0x586f('0x3d')]);return db[_0x586f('0x3e')]['find'](_0x5ef3f6)[_0x586f('0x24')](handleEntityNotFound(_0x4ac7fc,null))[_0x586f('0x24')](respondWithResult(_0x4ac7fc,null))[_0x586f('0x44')](handleError(_0x4ac7fc,null));};exports[_0x586f('0x45')]=function(_0x487d20,_0x470e74){return db['FaxQueueReport'][_0x586f('0x45')](_0x487d20[_0x586f('0x46')],{})[_0x586f('0x24')](respondWithResult(_0x470e74,0xc9))[_0x586f('0x44')](handleError(_0x470e74,null));};exports['update']=function(_0x1207e9,_0x1da394){if(_0x1207e9[_0x586f('0x46')]['id']){delete _0x1207e9[_0x586f('0x46')]['id'];}return db[_0x586f('0x3e')][_0x586f('0x47')]({'where':{'id':_0x1207e9['params']['id']}})[_0x586f('0x24')](handleEntityNotFound(_0x1da394,null))['then'](saveUpdates(_0x1207e9[_0x586f('0x46')],null))[_0x586f('0x24')](respondWithResult(_0x1da394,null))[_0x586f('0x44')](handleError(_0x1da394,null));};exports[_0x586f('0x25')]=function(_0x2df877,_0xef5a6a){return db[_0x586f('0x3e')][_0x586f('0x47')]({'where':{'id':_0x2df877[_0x586f('0x43')]['id']}})[_0x586f('0x24')](handleEntityNotFound(_0xef5a6a,null))[_0x586f('0x24')](removeEntity(_0xef5a6a,null))[_0x586f('0x44')](handleError(_0xef5a6a,null));};exports['describe']=function(_0x2e5b00,_0x51d5df){return db['FaxQueueReport'][_0x586f('0x48')]()[_0x586f('0x24')](respondWithResult(_0x51d5df,null))['catch'](handleError(_0x51d5df,null));};
\ No newline at end of file
index 6090852..e7b48e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x4fb45e,_0x5a0989){var _0x376db0=function(_0x396e70){while(--_0x396e70){_0x4fb45e['push'](_0x4fb45e['shift']());}};_0x376db0(++_0x5a0989);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xc4aa[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0xe14b=['bluebird','path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','moment'];(function(_0x2517b5,_0x2c2ef9){var _0x24626a=function(_0x241aee){while(--_0x241aee){_0x2517b5['push'](_0x2517b5['shift']());}};_0x24626a(++_0x2c2ef9);}(_0xe14b,0x93));var _0xbe14=function(_0x315180,_0x2095be){_0x315180=_0x315180-0x0;var _0xed6861=_0xe14b[_0x315180];return _0xed6861;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
index 42fd9bc..2ba5501 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5cc5=['raw','UpdateFaxQueueReport','update','body','attributes','limit','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options'];(function(_0x3ad331,_0x16c834){var _0x115e41=function(_0x1b5a11){while(--_0x1b5a11){_0x3ad331['push'](_0x3ad331['shift']());}};_0x115e41(++_0x16c834);}(_0x5cc5,0x114));var _0x55cc=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x5cc5[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0x55cc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x55cc('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55cc('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x55cc('0x3'))(_0x55cc('0x4'));var config=require(_0x55cc('0x5'));var jayson=require(_0x55cc('0x6'));var client=jayson[_0x55cc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x268b16,_0x77bce9,_0x3c98a2){return new BPromise(function(_0x773b33,_0x467df9){return client[_0x55cc('0x8')](_0x268b16,_0x3c98a2)[_0x55cc('0x9')](function(_0xe31d96){logger[_0x55cc('0xa')](_0x55cc('0xb'),_0x77bce9,_0x55cc('0xc'));logger[_0x55cc('0xd')](_0x55cc('0xe'),_0x77bce9,'request\x20sent',JSON[_0x55cc('0xf')](_0xe31d96));if(_0xe31d96[_0x55cc('0x10')]){if(_0xe31d96[_0x55cc('0x10')]['code']===0x1f4){logger['error'](_0x55cc('0xb'),_0x77bce9,_0xe31d96['error'][_0x55cc('0x11')]);return _0x467df9(_0xe31d96[_0x55cc('0x10')]['message']);}logger['error'](_0x55cc('0xb'),_0x77bce9,_0xe31d96[_0x55cc('0x10')]['message']);return _0x773b33(_0xe31d96[_0x55cc('0x10')][_0x55cc('0x11')]);}else{logger[_0x55cc('0xa')](_0x55cc('0xb'),_0x77bce9,_0x55cc('0xc'));_0x773b33(_0xe31d96[_0x55cc('0x12')][_0x55cc('0x11')]);}})[_0x55cc('0x13')](function(_0x4e4474){logger[_0x55cc('0x10')](_0x55cc('0xb'),_0x77bce9,_0x4e4474);_0x467df9(_0x4e4474);});});}exports[_0x55cc('0x14')]=function(_0x16b549){var _0x331f14=this;return new Promise(function(_0x46cc74,_0x56c5cf){return db[_0x55cc('0x15')][_0x55cc('0x16')](_0x16b549['body'],{'raw':_0x16b549[_0x55cc('0x17')]?_0x16b549['options'][_0x55cc('0x18')]===undefined?!![]:![]:!![]})[_0x55cc('0x9')](function(_0x55b7a0){logger[_0x55cc('0xa')]('CreateFaxQueueReport',_0x16b549);logger[_0x55cc('0xd')]('CreateFaxQueueReport',_0x16b549,JSON[_0x55cc('0xf')](_0x55b7a0));_0x46cc74(_0x55b7a0);})['catch'](function(_0xe89ff8){logger[_0x55cc('0x10')](_0x55cc('0x14'),_0xe89ff8[_0x55cc('0x11')],_0x16b549);_0x56c5cf(_0x331f14['error'](0x1f4,_0xe89ff8[_0x55cc('0x11')]));});});};exports[_0x55cc('0x19')]=function(_0x21a7ff){var _0x2c05c5=this;return new Promise(function(_0x5b4457,_0x51dfbd){return db[_0x55cc('0x15')][_0x55cc('0x1a')](_0x21a7ff[_0x55cc('0x1b')],{'raw':_0x21a7ff['options']?_0x21a7ff['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21a7ff[_0x55cc('0x17')]?_0x21a7ff[_0x55cc('0x17')]['where']||null:null,'attributes':_0x21a7ff[_0x55cc('0x17')]?_0x21a7ff[_0x55cc('0x17')][_0x55cc('0x1c')]||null:null,'limit':_0x21a7ff[_0x55cc('0x17')]?_0x21a7ff[_0x55cc('0x17')][_0x55cc('0x1d')]||null:null})[_0x55cc('0x9')](function(_0x2a969b){logger['info'](_0x55cc('0x19'),_0x21a7ff);logger[_0x55cc('0xd')]('UpdateFaxQueueReport',_0x21a7ff,JSON['stringify'](_0x2a969b));_0x5b4457(_0x2a969b);})[_0x55cc('0x13')](function(_0xd57b44){logger[_0x55cc('0x10')]('UpdateFaxQueueReport',_0xd57b44[_0x55cc('0x11')],_0x21a7ff);_0x51dfbd(_0x2c05c5[_0x55cc('0x10')](0x1f4,_0xd57b44[_0x55cc('0x11')]));});});};
\ No newline at end of file
+var _0xb711=['body','options','raw','UpdateFaxQueueReport','where','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateFaxQueueReport','create'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb711,0x18e));var _0x1b71=function(_0x499db2,_0xcca0e2){_0x499db2=_0x499db2-0x0;var _0xab23b4=_0xb711[_0x499db2];return _0xab23b4;};'use strict';var _=require(_0x1b71('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1b71('0x1'));var rs=require(_0x1b71('0x2'));var fs=require('fs');var Redis=require(_0x1b71('0x3'));var db=require(_0x1b71('0x4'))['db'];var utils=require(_0x1b71('0x5'));var logger=require(_0x1b71('0x6'))(_0x1b71('0x7'));var config=require('../../config/environment');var jayson=require(_0x1b71('0x8'));var client=jayson['client'][_0x1b71('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3205d1,_0xa823ec,_0x2c58ac){return new BPromise(function(_0x397914,_0xb4f7c7){return client['request'](_0x3205d1,_0x2c58ac)[_0x1b71('0xa')](function(_0x13a426){logger[_0x1b71('0xb')](_0x1b71('0xc'),_0xa823ec,_0x1b71('0xd'));logger[_0x1b71('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0xa823ec,_0x1b71('0xd'),JSON[_0x1b71('0xf')](_0x13a426));if(_0x13a426[_0x1b71('0x10')]){if(_0x13a426[_0x1b71('0x10')][_0x1b71('0x11')]===0x1f4){logger['error'](_0x1b71('0xc'),_0xa823ec,_0x13a426[_0x1b71('0x10')][_0x1b71('0x12')]);return _0xb4f7c7(_0x13a426[_0x1b71('0x10')][_0x1b71('0x12')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0xa823ec,_0x13a426[_0x1b71('0x10')]['message']);return _0x397914(_0x13a426[_0x1b71('0x10')][_0x1b71('0x12')]);}else{logger['info'](_0x1b71('0xc'),_0xa823ec,_0x1b71('0xd'));_0x397914(_0x13a426['result'][_0x1b71('0x12')]);}})[_0x1b71('0x13')](function(_0x333667){logger[_0x1b71('0x10')](_0x1b71('0xc'),_0xa823ec,_0x333667);_0xb4f7c7(_0x333667);});});}exports[_0x1b71('0x14')]=function(_0x463585){var _0x1b4994=this;return new Promise(function(_0x5c9cfc,_0x5194ad){return db['FaxQueueReport'][_0x1b71('0x15')](_0x463585[_0x1b71('0x16')],{'raw':_0x463585[_0x1b71('0x17')]?_0x463585[_0x1b71('0x17')][_0x1b71('0x18')]===undefined?!![]:![]:!![]})[_0x1b71('0xa')](function(_0x43ad9f){logger[_0x1b71('0xb')](_0x1b71('0x14'),_0x463585);logger[_0x1b71('0xe')]('CreateFaxQueueReport',_0x463585,JSON[_0x1b71('0xf')](_0x43ad9f));_0x5c9cfc(_0x43ad9f);})[_0x1b71('0x13')](function(_0x15f0b0){logger[_0x1b71('0x10')]('CreateFaxQueueReport',_0x15f0b0['message'],_0x463585);_0x5194ad(_0x1b4994['error'](0x1f4,_0x15f0b0[_0x1b71('0x12')]));});});};exports[_0x1b71('0x19')]=function(_0x121654){var _0x21aaf3=this;return new Promise(function(_0x5a6a7e,_0x397889){return db['FaxQueueReport']['update'](_0x121654[_0x1b71('0x16')],{'raw':_0x121654['options']?_0x121654[_0x1b71('0x17')][_0x1b71('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x121654[_0x1b71('0x17')]?_0x121654['options'][_0x1b71('0x1a')]||null:null,'attributes':_0x121654['options']?_0x121654[_0x1b71('0x17')]['attributes']||null:null,'limit':_0x121654[_0x1b71('0x17')]?_0x121654[_0x1b71('0x17')][_0x1b71('0x1b')]||null:null})['then'](function(_0x533c54){logger[_0x1b71('0xb')](_0x1b71('0x19'),_0x121654);logger['debug']('UpdateFaxQueueReport',_0x121654,JSON[_0x1b71('0xf')](_0x533c54));_0x5a6a7e(_0x533c54);})[_0x1b71('0x13')](function(_0x2a3f24){logger[_0x1b71('0x10')](_0x1b71('0x19'),_0x2a3f24[_0x1b71('0x12')],_0x121654);_0x397889(_0x21aaf3[_0x1b71('0x10')](0x1f4,_0x2a3f24[_0x1b71('0x12')]));});});};
\ No newline at end of file
index 3afa706..8937deb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x796d=['put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create'];(function(_0x5c8eae,_0x272f80){var _0x3899b5=function(_0x13dd14){while(--_0x13dd14){_0x5c8eae['push'](_0x5c8eae['shift']());}};_0x3899b5(++_0x272f80);}(_0x796d,0xad));var _0xd796=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x796d[_0x16629d];return _0x56ccee;};'use strict';var multer=require(_0xd796('0x0'));var util=require(_0xd796('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd796('0x2'));var router=express[_0xd796('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd796('0x4'));var interaction=require(_0xd796('0x5'));var config=require(_0xd796('0x6'));var controller=require(_0xd796('0x7'));router['get']('/',auth[_0xd796('0x8')](),controller['index']);router[_0xd796('0x9')](_0xd796('0xa'),auth['isAuthenticated'](),controller[_0xd796('0xb')]);router[_0xd796('0x9')](_0xd796('0xc'),auth[_0xd796('0x8')](),controller[_0xd796('0xd')]);router[_0xd796('0xe')]('/',auth[_0xd796('0x8')](),controller[_0xd796('0xf')]);router[_0xd796('0x10')](_0xd796('0xc'),auth[_0xd796('0x8')](),controller[_0xd796('0x11')]);router[_0xd796('0x12')](_0xd796('0xc'),auth[_0xd796('0x8')](),controller[_0xd796('0x13')]);module[_0xd796('0x14')]=router;
\ No newline at end of file
+var _0xa735=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x5bff3d,_0x299fb9){var _0x29aabf=function(_0x2e6fda){while(--_0x2e6fda){_0x5bff3d['push'](_0x5bff3d['shift']());}};_0x29aabf(++_0x299fb9);}(_0xa735,0x121));var _0x5a73=function(_0x3dcc6a,_0x453b17){_0x3dcc6a=_0x3dcc6a-0x0;var _0xb70eef=_0xa735[_0x3dcc6a];return _0xb70eef;};'use strict';var multer=require(_0x5a73('0x0'));var util=require('util');var path=require(_0x5a73('0x1'));var timeout=require(_0x5a73('0x2'));var express=require('express');var router=express[_0x5a73('0x3')]();var fs_extra=require(_0x5a73('0x4'));var auth=require(_0x5a73('0x5'));var interaction=require(_0x5a73('0x6'));var config=require(_0x5a73('0x7'));var controller=require('./faxQueueReport.controller');router[_0x5a73('0x8')]('/',auth['isAuthenticated'](),controller[_0x5a73('0x9')]);router[_0x5a73('0x8')](_0x5a73('0xa'),auth[_0x5a73('0xb')](),controller[_0x5a73('0xc')]);router[_0x5a73('0x8')](_0x5a73('0xd'),auth[_0x5a73('0xb')](),controller[_0x5a73('0xe')]);router[_0x5a73('0xf')]('/',auth[_0x5a73('0xb')](),controller[_0x5a73('0x10')]);router[_0x5a73('0x11')](_0x5a73('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5a73('0x12')]('/:id',auth[_0x5a73('0xb')](),controller[_0x5a73('0x13')]);module[_0x5a73('0x14')]=router;
\ No newline at end of file
index 0906fc0..f697a50 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0xb43b,0x1b2));var _0xbb43=function(_0x437021,_0x27edad){_0x437021=_0x437021-0x0;var _0x485a11=_0xb43b[_0x437021];return _0x485a11;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}};
\ No newline at end of file
+var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2b4ca4,_0x3cdbf7){var _0x57bfad=function(_0x44df0d){while(--_0x44df0d){_0x2b4ca4['push'](_0x2b4ca4['shift']());}};_0x57bfad(++_0x3cdbf7);}(_0xaa88,0x137));var _0x8aa8=function(_0x49f8c2,_0x5166b7){_0x49f8c2=_0x49f8c2-0x0;var _0x3e63ec=_0xaa88[_0x49f8c2];return _0x3e63ec;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}};
\ No newline at end of file
index 903b6a4..16a62ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc79b=['util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','FaxTransferReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','include','findAll','rows','show','length','includeAll','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc79b,0x99));var _0xbc79=function(_0x17f219,_0x2cbb18){_0x17f219=_0x17f219-0x0;var _0x2fc957=_0xc79b[_0x17f219];return _0x2fc957;};'use strict';var emlformat=require(_0xbc79('0x0'));var rimraf=require(_0xbc79('0x1'));var zipdir=require(_0xbc79('0x2'));var jsonpatch=require(_0xbc79('0x3'));var rp=require(_0xbc79('0x4'));var moment=require('moment');var BPromise=require(_0xbc79('0x5'));var Mustache=require(_0xbc79('0x6'));var util=require(_0xbc79('0x7'));var path=require(_0xbc79('0x8'));var sox=require(_0xbc79('0x9'));var csv=require(_0xbc79('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc79('0xb'));var _=require(_0xbc79('0xc'));var squel=require(_0xbc79('0xd'));var crypto=require(_0xbc79('0xe'));var jsforce=require(_0xbc79('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbc79('0x10'));var Papa=require(_0xbc79('0x11'));var Redis=require(_0xbc79('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbc79('0x13'));var as=require(_0xbc79('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xbc79('0x15'));var config=require(_0xbc79('0x16'));var licenseUtil=require(_0xbc79('0x17'));var db=require(_0xbc79('0x18'))['db'];function respondWithStatusCode(_0x356c94,_0xf2d161){_0xf2d161=_0xf2d161||0xcc;return function(_0xa81012){if(_0xa81012){return _0x356c94[_0xbc79('0x19')](_0xf2d161);}return _0x356c94[_0xbc79('0x1a')](_0xf2d161)['end']();};}function respondWithResult(_0x7acd09,_0x345053){_0x345053=_0x345053||0xc8;return function(_0x207667){if(_0x207667){return _0x7acd09['status'](_0x345053)['json'](_0x207667);}};}function respondWithFilteredResult(_0x55fcb5,_0x9a8b65){return function(_0x3bfc98){if(_0x3bfc98){var _0x5b9efd=typeof _0x9a8b65['offset']==='undefined'&&typeof _0x9a8b65[_0xbc79('0x1b')]===_0xbc79('0x1c');var _0x59a6ab=_0x3bfc98[_0xbc79('0x1d')];var _0xfecff6=_0x5b9efd?0x0:_0x9a8b65['offset'];var _0x2d3027=_0x5b9efd?_0x3bfc98['count']:_0x9a8b65[_0xbc79('0x1e')]+_0x9a8b65[_0xbc79('0x1b')];var _0x4c362f;if(_0x2d3027>=_0x59a6ab){_0x2d3027=_0x59a6ab;_0x4c362f=0xc8;}else{_0x4c362f=0xce;}_0x55fcb5[_0xbc79('0x1a')](_0x4c362f);return _0x55fcb5[_0xbc79('0x1f')](_0xbc79('0x20'),_0xfecff6+'-'+_0x2d3027+'/'+_0x59a6ab)[_0xbc79('0x21')](_0x3bfc98);}return null;};}function patchUpdates(_0x1608e7){return function(_0x470739){try{jsonpatch[_0xbc79('0x22')](_0x470739,_0x1608e7,!![]);}catch(_0x44513e){return BPromise[_0xbc79('0x23')](_0x44513e);}return _0x470739[_0xbc79('0x24')]();};}function saveUpdates(_0xc3353b,_0x41ce2f){return function(_0x82a128){if(_0x82a128){return _0x82a128[_0xbc79('0x25')](_0xc3353b)['then'](function(_0x34448c){return _0x34448c;});}return null;};}function removeEntity(_0x1ddf12,_0x566b29){return function(_0x21c6de){if(_0x21c6de){return _0x21c6de[_0xbc79('0x26')]()[_0xbc79('0x27')](function(){_0x1ddf12['status'](0xcc)[_0xbc79('0x28')]();});}};}function handleEntityNotFound(_0x56b798,_0x3d1662){return function(_0xcea00e){if(!_0xcea00e){_0x56b798[_0xbc79('0x19')](0x194);}return _0xcea00e;};}function handleError(_0x2ca9bd,_0x3e2588){_0x3e2588=_0x3e2588||0x1f4;return function(_0x54d25b){logger[_0xbc79('0x29')](_0x54d25b[_0xbc79('0x2a')]);if(_0x54d25b[_0xbc79('0x2b')]){delete _0x54d25b[_0xbc79('0x2b')];}_0x2ca9bd[_0xbc79('0x1a')](_0x3e2588)[_0xbc79('0x2c')](_0x54d25b);};}exports[_0xbc79('0x2d')]=function(_0x130a02,_0x1ed6a2){var _0xc3a39c={},_0x30fd22={},_0xc5aac5={'count':0x0,'rows':[]};var _0x1cfeca=_['map'](db[_0xbc79('0x2e')][_0xbc79('0x2f')],function(_0x119f91){return{'name':_0x119f91['fieldName'],'type':_0x119f91[_0xbc79('0x30')][_0xbc79('0x31')]};});_0x30fd22[_0xbc79('0x32')]=_['map'](_0x1cfeca,_0xbc79('0x2b'));_0x30fd22['query']=_[_0xbc79('0x33')](_0x130a02[_0xbc79('0x34')]);_0x30fd22[_0xbc79('0x35')]=_[_0xbc79('0x36')](_0x30fd22[_0xbc79('0x32')],_0x30fd22['query']);_0xc3a39c[_0xbc79('0x37')]=_['intersection'](_0x30fd22[_0xbc79('0x32')],qs['fields'](_0x130a02[_0xbc79('0x34')][_0xbc79('0x38')]));_0xc3a39c[_0xbc79('0x37')]=_0xc3a39c['attributes']['length']?_0xc3a39c['attributes']:_0x30fd22['model'];if(!_0x130a02[_0xbc79('0x34')][_0xbc79('0x39')](_0xbc79('0x3a'))){_0xc3a39c['limit']=qs[_0xbc79('0x1b')](_0x130a02[_0xbc79('0x34')][_0xbc79('0x1b')]);_0xc3a39c[_0xbc79('0x1e')]=qs[_0xbc79('0x1e')](_0x130a02[_0xbc79('0x34')]['offset']);}_0xc3a39c[_0xbc79('0x3b')]=qs[_0xbc79('0x3c')](_0x130a02['query'][_0xbc79('0x3c')]);_0xc3a39c[_0xbc79('0x3d')]=qs[_0xbc79('0x35')](_[_0xbc79('0x3e')](_0x130a02['query'],_0x30fd22['filters']),_0x1cfeca);if(_0x130a02[_0xbc79('0x34')]['filter']){_0xc3a39c['where']=_[_0xbc79('0x3f')](_0xc3a39c[_0xbc79('0x3d')],{'$or':_[_0xbc79('0x40')](_0x1cfeca,function(_0x2e59d5){if(_0x2e59d5[_0xbc79('0x30')]!==_0xbc79('0x41')){var _0x3e9cdf={};_0x3e9cdf[_0x2e59d5[_0xbc79('0x2b')]]={'$like':'%'+_0x130a02[_0xbc79('0x34')][_0xbc79('0x42')]+'%'};return _0x3e9cdf;}})});}_0xc3a39c=_[_0xbc79('0x3f')]({},_0xc3a39c,_0x130a02[_0xbc79('0x43')]);var _0x2c7065={'where':_0xc3a39c['where']};return db[_0xbc79('0x2e')][_0xbc79('0x1d')](_0x2c7065)[_0xbc79('0x27')](function(_0x160093){_0xc5aac5[_0xbc79('0x1d')]=_0x160093;if(_0x130a02[_0xbc79('0x34')]['includeAll']){_0xc3a39c[_0xbc79('0x44')]=[{'all':!![]}];}return db[_0xbc79('0x2e')][_0xbc79('0x45')](_0xc3a39c);})[_0xbc79('0x27')](function(_0x183012){_0xc5aac5[_0xbc79('0x46')]=_0x183012;return _0xc5aac5;})['then'](respondWithFilteredResult(_0x1ed6a2,_0xc3a39c))['catch'](handleError(_0x1ed6a2,null));};exports[_0xbc79('0x47')]=function(_0x486a76,_0x2f1987){var _0x3c7450={'raw':!![],'where':{'id':_0x486a76['params']['id']}},_0x156c39={};_0x156c39[_0xbc79('0x32')]=_[_0xbc79('0x33')](db[_0xbc79('0x2e')][_0xbc79('0x2f')]);_0x156c39[_0xbc79('0x34')]=_[_0xbc79('0x33')](_0x486a76[_0xbc79('0x34')]);_0x156c39[_0xbc79('0x35')]=_[_0xbc79('0x36')](_0x156c39[_0xbc79('0x32')],_0x156c39['query']);_0x3c7450[_0xbc79('0x37')]=_[_0xbc79('0x36')](_0x156c39[_0xbc79('0x32')],qs['fields'](_0x486a76[_0xbc79('0x34')]['fields']));_0x3c7450[_0xbc79('0x37')]=_0x3c7450['attributes'][_0xbc79('0x48')]?_0x3c7450[_0xbc79('0x37')]:_0x156c39['model'];if(_0x486a76[_0xbc79('0x34')][_0xbc79('0x49')]){_0x3c7450['include']=[{'all':!![]}];}_0x3c7450=_[_0xbc79('0x3f')]({},_0x3c7450,_0x486a76[_0xbc79('0x43')]);return db['FaxTransferReport'][_0xbc79('0x4a')](_0x3c7450)[_0xbc79('0x27')](handleEntityNotFound(_0x2f1987,null))['then'](respondWithResult(_0x2f1987,null))[_0xbc79('0x4b')](handleError(_0x2f1987,null));};exports[_0xbc79('0x4c')]=function(_0x3ab85a,_0x334f62){return db[_0xbc79('0x2e')][_0xbc79('0x4c')](_0x3ab85a[_0xbc79('0x4d')],{})[_0xbc79('0x27')](respondWithResult(_0x334f62,0xc9))[_0xbc79('0x4b')](handleError(_0x334f62,null));};exports['update']=function(_0x460648,_0x3109f3){if(_0x460648[_0xbc79('0x4d')]['id']){delete _0x460648[_0xbc79('0x4d')]['id'];}return db['FaxTransferReport'][_0xbc79('0x4a')]({'where':{'id':_0x460648[_0xbc79('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3109f3,null))[_0xbc79('0x27')](saveUpdates(_0x460648['body'],null))[_0xbc79('0x27')](respondWithResult(_0x3109f3,null))[_0xbc79('0x4b')](handleError(_0x3109f3,null));};exports[_0xbc79('0x26')]=function(_0x269168,_0x42df46){return db[_0xbc79('0x2e')]['find']({'where':{'id':_0x269168[_0xbc79('0x4e')]['id']}})[_0xbc79('0x27')](handleEntityNotFound(_0x42df46,null))[_0xbc79('0x27')](removeEntity(_0x42df46,null))[_0xbc79('0x4b')](handleError(_0x42df46,null));};exports[_0xbc79('0x4f')]=function(_0xd2d9ab,_0x2a5f42){return db[_0xbc79('0x2e')][_0xbc79('0x4f')]()[_0xbc79('0x27')](respondWithResult(_0x2a5f42,null))[_0xbc79('0x4b')](handleError(_0x2a5f42,null));};
\ No newline at end of file
+var _0xa2b1=['limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','catch','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0x3fb92e,_0x28b547){var _0x1a7943=function(_0x18b8a2){while(--_0x18b8a2){_0x3fb92e['push'](_0x3fb92e['shift']());}};_0x1a7943(++_0x28b547);}(_0xa2b1,0x77));var _0x1a2b=function(_0x3ed49f,_0x54b865){_0x3ed49f=_0x3ed49f-0x0;var _0x1890a1=_0xa2b1[_0x3ed49f];return _0x1890a1;};'use strict';var emlformat=require(_0x1a2b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a2b('0x1'));var jsonpatch=require(_0x1a2b('0x2'));var rp=require(_0x1a2b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1a2b('0x4'));var sox=require(_0x1a2b('0x5'));var csv=require(_0x1a2b('0x6'));var ejs=require(_0x1a2b('0x7'));var fs=require('fs');var fs_extra=require(_0x1a2b('0x8'));var _=require('lodash');var squel=require(_0x1a2b('0x9'));var crypto=require(_0x1a2b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1a2b('0xb'));var toCsv=require(_0x1a2b('0x6'));var querystring=require(_0x1a2b('0xc'));var Papa=require(_0x1a2b('0xd'));var Redis=require(_0x1a2b('0xe'));var authService=require(_0x1a2b('0xf'));var qs=require(_0x1a2b('0x10'));var as=require(_0x1a2b('0x11'));var hardwareService=require(_0x1a2b('0x12'));var logger=require(_0x1a2b('0x13'))(_0x1a2b('0x14'));var utils=require('../../config/utils');var config=require(_0x1a2b('0x15'));var licenseUtil=require(_0x1a2b('0x16'));var db=require(_0x1a2b('0x17'))['db'];function respondWithStatusCode(_0x548407,_0x4f7cfa){_0x4f7cfa=_0x4f7cfa||0xcc;return function(_0x3eb33b){if(_0x3eb33b){return _0x548407[_0x1a2b('0x18')](_0x4f7cfa);}return _0x548407[_0x1a2b('0x19')](_0x4f7cfa)[_0x1a2b('0x1a')]();};}function respondWithResult(_0x3a896b,_0x38c810){_0x38c810=_0x38c810||0xc8;return function(_0x25ac9c){if(_0x25ac9c){return _0x3a896b[_0x1a2b('0x19')](_0x38c810)[_0x1a2b('0x1b')](_0x25ac9c);}};}function respondWithFilteredResult(_0x395c29,_0x45839d){return function(_0x2bef15){if(_0x2bef15){var _0x3e37a8=typeof _0x45839d[_0x1a2b('0x1c')]===_0x1a2b('0x1d')&&typeof _0x45839d['limit']===_0x1a2b('0x1d');var _0x4b1123=_0x2bef15[_0x1a2b('0x1e')];var _0x14e1f5=_0x3e37a8?0x0:_0x45839d[_0x1a2b('0x1c')];var _0x1165ea=_0x3e37a8?_0x2bef15[_0x1a2b('0x1e')]:_0x45839d[_0x1a2b('0x1c')]+_0x45839d[_0x1a2b('0x1f')];var _0x48ac7c;if(_0x1165ea>=_0x4b1123){_0x1165ea=_0x4b1123;_0x48ac7c=0xc8;}else{_0x48ac7c=0xce;}_0x395c29[_0x1a2b('0x19')](_0x48ac7c);return _0x395c29[_0x1a2b('0x20')](_0x1a2b('0x21'),_0x14e1f5+'-'+_0x1165ea+'/'+_0x4b1123)[_0x1a2b('0x1b')](_0x2bef15);}return null;};}function patchUpdates(_0x244ea4){return function(_0x5f398f){try{jsonpatch[_0x1a2b('0x22')](_0x5f398f,_0x244ea4,!![]);}catch(_0x30b646){return BPromise[_0x1a2b('0x23')](_0x30b646);}return _0x5f398f['save']();};}function saveUpdates(_0x1f720e,_0x22f20a){return function(_0x53fedd){if(_0x53fedd){return _0x53fedd[_0x1a2b('0x24')](_0x1f720e)[_0x1a2b('0x25')](function(_0xeb8518){return _0xeb8518;});}return null;};}function removeEntity(_0x18e588,_0x126d6e){return function(_0x28541c){if(_0x28541c){return _0x28541c[_0x1a2b('0x26')]()['then'](function(){_0x18e588[_0x1a2b('0x19')](0xcc)[_0x1a2b('0x1a')]();});}};}function handleEntityNotFound(_0x7d7f70,_0x2ed4bb){return function(_0x551a75){if(!_0x551a75){_0x7d7f70[_0x1a2b('0x18')](0x194);}return _0x551a75;};}function handleError(_0x1e12f5,_0xeb214e){_0xeb214e=_0xeb214e||0x1f4;return function(_0x465663){logger[_0x1a2b('0x27')](_0x465663[_0x1a2b('0x28')]);if(_0x465663[_0x1a2b('0x29')]){delete _0x465663['name'];}_0x1e12f5[_0x1a2b('0x19')](_0xeb214e)[_0x1a2b('0x2a')](_0x465663);};}exports[_0x1a2b('0x2b')]=function(_0x90e0ed,_0x6fa910){var _0x497f9b={},_0x40c3d4={},_0x3eed98={'count':0x0,'rows':[]};var _0x5cad5c=_['map'](db[_0x1a2b('0x2c')][_0x1a2b('0x2d')],function(_0x2ce8d9){return{'name':_0x2ce8d9[_0x1a2b('0x2e')],'type':_0x2ce8d9[_0x1a2b('0x2f')][_0x1a2b('0x30')]};});_0x40c3d4[_0x1a2b('0x31')]=_['map'](_0x5cad5c,_0x1a2b('0x29'));_0x40c3d4[_0x1a2b('0x32')]=_[_0x1a2b('0x33')](_0x90e0ed[_0x1a2b('0x32')]);_0x40c3d4[_0x1a2b('0x34')]=_[_0x1a2b('0x35')](_0x40c3d4[_0x1a2b('0x31')],_0x40c3d4[_0x1a2b('0x32')]);_0x497f9b[_0x1a2b('0x36')]=_[_0x1a2b('0x35')](_0x40c3d4[_0x1a2b('0x31')],qs[_0x1a2b('0x37')](_0x90e0ed['query'][_0x1a2b('0x37')]));_0x497f9b[_0x1a2b('0x36')]=_0x497f9b[_0x1a2b('0x36')][_0x1a2b('0x38')]?_0x497f9b[_0x1a2b('0x36')]:_0x40c3d4[_0x1a2b('0x31')];if(!_0x90e0ed[_0x1a2b('0x32')][_0x1a2b('0x39')]('nolimit')){_0x497f9b[_0x1a2b('0x1f')]=qs[_0x1a2b('0x1f')](_0x90e0ed[_0x1a2b('0x32')][_0x1a2b('0x1f')]);_0x497f9b['offset']=qs['offset'](_0x90e0ed['query'][_0x1a2b('0x1c')]);}_0x497f9b[_0x1a2b('0x3a')]=qs[_0x1a2b('0x3b')](_0x90e0ed[_0x1a2b('0x32')]['sort']);_0x497f9b[_0x1a2b('0x3c')]=qs['filters'](_[_0x1a2b('0x3d')](_0x90e0ed[_0x1a2b('0x32')],_0x40c3d4['filters']),_0x5cad5c);if(_0x90e0ed[_0x1a2b('0x32')][_0x1a2b('0x3e')]){_0x497f9b[_0x1a2b('0x3c')]=_[_0x1a2b('0x3f')](_0x497f9b[_0x1a2b('0x3c')],{'$or':_[_0x1a2b('0x40')](_0x5cad5c,function(_0x2e6a23){if(_0x2e6a23[_0x1a2b('0x2f')]!==_0x1a2b('0x41')){var _0x69f045={};_0x69f045[_0x2e6a23[_0x1a2b('0x29')]]={'$like':'%'+_0x90e0ed[_0x1a2b('0x32')][_0x1a2b('0x3e')]+'%'};return _0x69f045;}})});}_0x497f9b=_['merge']({},_0x497f9b,_0x90e0ed[_0x1a2b('0x42')]);var _0x4b1f0a={'where':_0x497f9b['where']};return db[_0x1a2b('0x2c')][_0x1a2b('0x1e')](_0x4b1f0a)['then'](function(_0x149e3f){_0x3eed98[_0x1a2b('0x1e')]=_0x149e3f;if(_0x90e0ed[_0x1a2b('0x32')]['includeAll']){_0x497f9b[_0x1a2b('0x43')]=[{'all':!![]}];}return db[_0x1a2b('0x2c')]['findAll'](_0x497f9b);})['then'](function(_0x5b919a){_0x3eed98['rows']=_0x5b919a;return _0x3eed98;})[_0x1a2b('0x25')](respondWithFilteredResult(_0x6fa910,_0x497f9b))[_0x1a2b('0x44')](handleError(_0x6fa910,null));};exports['show']=function(_0x451666,_0x336e65){var _0x2163db={'raw':!![],'where':{'id':_0x451666[_0x1a2b('0x45')]['id']}},_0x293b16={};_0x293b16[_0x1a2b('0x31')]=_['keys'](db[_0x1a2b('0x2c')][_0x1a2b('0x2d')]);_0x293b16[_0x1a2b('0x32')]=_['keys'](_0x451666[_0x1a2b('0x32')]);_0x293b16[_0x1a2b('0x34')]=_[_0x1a2b('0x35')](_0x293b16['model'],_0x293b16[_0x1a2b('0x32')]);_0x2163db[_0x1a2b('0x36')]=_['intersection'](_0x293b16['model'],qs[_0x1a2b('0x37')](_0x451666[_0x1a2b('0x32')]['fields']));_0x2163db[_0x1a2b('0x36')]=_0x2163db[_0x1a2b('0x36')][_0x1a2b('0x38')]?_0x2163db[_0x1a2b('0x36')]:_0x293b16[_0x1a2b('0x31')];if(_0x451666['query'][_0x1a2b('0x46')]){_0x2163db[_0x1a2b('0x43')]=[{'all':!![]}];}_0x2163db=_['merge']({},_0x2163db,_0x451666[_0x1a2b('0x42')]);return db['FaxTransferReport'][_0x1a2b('0x47')](_0x2163db)[_0x1a2b('0x25')](handleEntityNotFound(_0x336e65,null))['then'](respondWithResult(_0x336e65,null))[_0x1a2b('0x44')](handleError(_0x336e65,null));};exports[_0x1a2b('0x48')]=function(_0x4950bb,_0x50bce){return db[_0x1a2b('0x2c')][_0x1a2b('0x48')](_0x4950bb[_0x1a2b('0x49')],{})['then'](respondWithResult(_0x50bce,0xc9))[_0x1a2b('0x44')](handleError(_0x50bce,null));};exports[_0x1a2b('0x24')]=function(_0x48f6c9,_0x5d30f2){if(_0x48f6c9[_0x1a2b('0x49')]['id']){delete _0x48f6c9[_0x1a2b('0x49')]['id'];}return db[_0x1a2b('0x2c')][_0x1a2b('0x47')]({'where':{'id':_0x48f6c9[_0x1a2b('0x45')]['id']}})[_0x1a2b('0x25')](handleEntityNotFound(_0x5d30f2,null))[_0x1a2b('0x25')](saveUpdates(_0x48f6c9[_0x1a2b('0x49')],null))[_0x1a2b('0x25')](respondWithResult(_0x5d30f2,null))['catch'](handleError(_0x5d30f2,null));};exports[_0x1a2b('0x26')]=function(_0x4b760d,_0x2d87cf){return db[_0x1a2b('0x2c')][_0x1a2b('0x47')]({'where':{'id':_0x4b760d[_0x1a2b('0x45')]['id']}})[_0x1a2b('0x25')](handleEntityNotFound(_0x2d87cf,null))[_0x1a2b('0x25')](removeEntity(_0x2d87cf,null))[_0x1a2b('0x44')](handleError(_0x2d87cf,null));};exports[_0x1a2b('0x4a')]=function(_0x2b8a78,_0x2c1c73){return db['FaxTransferReport']['describe']()[_0x1a2b('0x25')](respondWithResult(_0x2c1c73,null))[_0x1a2b('0x44')](handleError(_0x2c1c73,null));};
\ No newline at end of file
index 16f6149..2f818c4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa55=['report_fax_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0xaa55,0x183));var _0x5aa5=function(_0x45e849,_0x3bdbf8){_0x45e849=_0x45e849-0x0;var _0x35f80d=_0xaa55[_0x45e849];return _0x35f80d;};'use strict';var _=require('lodash');var util=require(_0x5aa5('0x0'));var logger=require(_0x5aa5('0x1'))(_0x5aa5('0x2'));var moment=require(_0x5aa5('0x3'));var BPromise=require(_0x5aa5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5aa5('0x5'));var config=require(_0x5aa5('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0x5aa5('0x7')]=function(_0x53764b,_0x603d33){return _0x53764b[_0x5aa5('0x8')]('FaxTransferReport',attributes,{'tableName':_0x5aa5('0x9'),'paranoid':![],'indexes':[{'name':_0x5aa5('0xa'),'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x6380=['request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x2d8d08,_0x9a15e8){var _0x3d8d4d=function(_0x34cb0c){while(--_0x34cb0c){_0x2d8d08['push'](_0x2d8d08['shift']());}};_0x3d8d4d(++_0x9a15e8);}(_0x6380,0x159));var _0x0638=function(_0x41dbb4,_0x10879c){_0x41dbb4=_0x41dbb4-0x0;var _0x262bb2=_0x6380[_0x41dbb4];return _0x262bb2;};'use strict';var _=require('lodash');var util=require(_0x0638('0x0'));var logger=require(_0x0638('0x1'))(_0x0638('0x2'));var moment=require(_0x0638('0x3'));var BPromise=require(_0x0638('0x4'));var rp=require(_0x0638('0x5'));var fs=require('fs');var path=require(_0x0638('0x6'));var rimraf=require('rimraf');var config=require(_0x0638('0x7'));var attributes=require(_0x0638('0x8'));module[_0x0638('0x9')]=function(_0x2eaa94,_0x1c0531){return _0x2eaa94[_0x0638('0xa')](_0x0638('0xb'),attributes,{'tableName':_0x0638('0xc'),'paranoid':![],'indexes':[{'name':_0x0638('0xd'),'fields':[_0x0638('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
index 66fa2f5..5fdc9db 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8d7a=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x127e24,_0x274535){var _0x265a41=function(_0x14b997){while(--_0x14b997){_0x127e24['push'](_0x127e24['shift']());}};_0x265a41(++_0x274535);}(_0x8d7a,0x1b6));var _0xa8d7=function(_0x17b51f,_0x40500c){_0x17b51f=_0x17b51f-0x0;var _0x2f8043=_0x8d7a[_0x17b51f];return _0x2f8043;};'use strict';var _=require(_0xa8d7('0x0'));var util=require(_0xa8d7('0x1'));var moment=require(_0xa8d7('0x2'));var BPromise=require('bluebird');var rs=require(_0xa8d7('0x3'));var fs=require('fs');var Redis=require(_0xa8d7('0x4'));var db=require(_0xa8d7('0x5'))['db'];var utils=require(_0xa8d7('0x6'));var logger=require(_0xa8d7('0x7'))(_0xa8d7('0x8'));var config=require(_0xa8d7('0x9'));var jayson=require(_0xa8d7('0xa'));var client=jayson[_0xa8d7('0xb')][_0xa8d7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x266acf,_0x105cb3,_0xc04b27){return new BPromise(function(_0x17a88d,_0x556c65){return client['request'](_0x266acf,_0xc04b27)['then'](function(_0x5a9506){logger['info'](_0xa8d7('0xd'),_0x105cb3,_0xa8d7('0xe'));logger[_0xa8d7('0xf')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x105cb3,_0xa8d7('0xe'),JSON[_0xa8d7('0x10')](_0x5a9506));if(_0x5a9506[_0xa8d7('0x11')]){if(_0x5a9506[_0xa8d7('0x11')][_0xa8d7('0x12')]===0x1f4){logger[_0xa8d7('0x11')](_0xa8d7('0xd'),_0x105cb3,_0x5a9506[_0xa8d7('0x11')][_0xa8d7('0x13')]);return _0x556c65(_0x5a9506[_0xa8d7('0x11')][_0xa8d7('0x13')]);}logger['error'](_0xa8d7('0xd'),_0x105cb3,_0x5a9506[_0xa8d7('0x11')][_0xa8d7('0x13')]);return _0x17a88d(_0x5a9506[_0xa8d7('0x11')][_0xa8d7('0x13')]);}else{logger[_0xa8d7('0x14')](_0xa8d7('0xd'),_0x105cb3,'request\x20sent');_0x17a88d(_0x5a9506['result'][_0xa8d7('0x13')]);}})[_0xa8d7('0x15')](function(_0x1c0406){logger[_0xa8d7('0x11')](_0xa8d7('0xd'),_0x105cb3,_0x1c0406);_0x556c65(_0x1c0406);});});}
\ No newline at end of file
+var _0xfa52=['result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','FaxTransferReport,\x20%s,\x20%s','message'];(function(_0x1fed7e,_0x530359){var _0x24496d=function(_0x5bd57b){while(--_0x5bd57b){_0x1fed7e['push'](_0x1fed7e['shift']());}};_0x24496d(++_0x530359);}(_0xfa52,0x1e4));var _0x2fa5=function(_0x1c0813,_0x277913){_0x1c0813=_0x1c0813-0x0;var _0x5edc6c=_0xfa52[_0x1c0813];return _0x5edc6c;};'use strict';var _=require(_0x2fa5('0x0'));var util=require('util');var moment=require(_0x2fa5('0x1'));var BPromise=require(_0x2fa5('0x2'));var rs=require(_0x2fa5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fa5('0x4'))['db'];var utils=require(_0x2fa5('0x5'));var logger=require(_0x2fa5('0x6'))(_0x2fa5('0x7'));var config=require(_0x2fa5('0x8'));var jayson=require(_0x2fa5('0x9'));var client=jayson['client'][_0x2fa5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f378a,_0x6470ba,_0x30f999){return new BPromise(function(_0x27f6c7,_0xa27ca2){return client[_0x2fa5('0xb')](_0x5f378a,_0x30f999)[_0x2fa5('0xc')](function(_0x24bd14){logger[_0x2fa5('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x6470ba,'request\x20sent');logger[_0x2fa5('0xe')](_0x2fa5('0xf'),_0x6470ba,_0x2fa5('0x10'),JSON['stringify'](_0x24bd14));if(_0x24bd14[_0x2fa5('0x11')]){if(_0x24bd14[_0x2fa5('0x11')]['code']===0x1f4){logger['error'](_0x2fa5('0x12'),_0x6470ba,_0x24bd14[_0x2fa5('0x11')]['message']);return _0xa27ca2(_0x24bd14[_0x2fa5('0x11')][_0x2fa5('0x13')]);}logger['error'](_0x2fa5('0x12'),_0x6470ba,_0x24bd14[_0x2fa5('0x11')][_0x2fa5('0x13')]);return _0x27f6c7(_0x24bd14[_0x2fa5('0x11')][_0x2fa5('0x13')]);}else{logger[_0x2fa5('0xd')](_0x2fa5('0x12'),_0x6470ba,_0x2fa5('0x10'));_0x27f6c7(_0x24bd14[_0x2fa5('0x14')][_0x2fa5('0x13')]);}})['catch'](function(_0x1db8b4){logger[_0x2fa5('0x11')](_0x2fa5('0x12'),_0x6470ba,_0x1db8b4);_0xa27ca2(_0x1db8b4);});});}
\ No newline at end of file
index e894615..0bf30b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0433=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','create','put','update','delete','destroy'];(function(_0x3f5dd4,_0x23e2e1){var _0x344407=function(_0x300e7b){while(--_0x300e7b){_0x3f5dd4['push'](_0x3f5dd4['shift']());}};_0x344407(++_0x23e2e1);}(_0x0433,0xc9));var _0x3043=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x0433[_0x273c39];return _0x46d6b5;};'use strict';var multer=require(_0x3043('0x0'));var util=require(_0x3043('0x1'));var path=require(_0x3043('0x2'));var timeout=require(_0x3043('0x3'));var express=require(_0x3043('0x4'));var router=express['Router']();var fs_extra=require(_0x3043('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3043('0x6'));var config=require(_0x3043('0x7'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x3043('0x8')](),controller[_0x3043('0x9')]);router[_0x3043('0xa')]('/describe',auth[_0x3043('0x8')](),controller[_0x3043('0xb')]);router[_0x3043('0xa')](_0x3043('0xc'),auth['isAuthenticated'](),controller[_0x3043('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3043('0xe')]);router[_0x3043('0xf')](_0x3043('0xc'),auth[_0x3043('0x8')](),controller[_0x3043('0x10')]);router[_0x3043('0x11')](_0x3043('0xc'),auth[_0x3043('0x8')](),controller[_0x3043('0x12')]);module[_0x3043('0x13')]=router;
\ No newline at end of file
+var _0x9d8a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','post','put','/:id','update','delete','destroy','multer','util','connect-timeout'];(function(_0x254c64,_0x369948){var _0x179762=function(_0x33aed8){while(--_0x33aed8){_0x254c64['push'](_0x254c64['shift']());}};_0x179762(++_0x369948);}(_0x9d8a,0xc5));var _0xa9d8=function(_0x170703,_0x5d11c4){_0x170703=_0x170703-0x0;var _0x47b361=_0x9d8a[_0x170703];return _0x47b361;};'use strict';var multer=require(_0xa9d8('0x0'));var util=require(_0xa9d8('0x1'));var path=require('path');var timeout=require(_0xa9d8('0x2'));var express=require(_0xa9d8('0x3'));var router=express[_0xa9d8('0x4')]();var fs_extra=require(_0xa9d8('0x5'));var auth=require(_0xa9d8('0x6'));var interaction=require(_0xa9d8('0x7'));var config=require('../../config/environment');var controller=require(_0xa9d8('0x8'));router[_0xa9d8('0x9')]('/',auth[_0xa9d8('0xa')](),controller[_0xa9d8('0xb')]);router[_0xa9d8('0x9')](_0xa9d8('0xc'),auth[_0xa9d8('0xa')](),controller[_0xa9d8('0xd')]);router[_0xa9d8('0x9')]('/:id',auth[_0xa9d8('0xa')](),controller['show']);router[_0xa9d8('0xe')]('/',auth[_0xa9d8('0xa')](),controller['create']);router[_0xa9d8('0xf')](_0xa9d8('0x10'),auth[_0xa9d8('0xa')](),controller[_0xa9d8('0x11')]);router[_0xa9d8('0x12')](_0xa9d8('0x10'),auth[_0xa9d8('0xa')](),controller[_0xa9d8('0x13')]);module['exports']=router;
\ No newline at end of file
index 1b2e7be..9443927 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x040b=['isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get'];(function(_0xfd5311,_0x2a4dc7){var _0x2a3652=function(_0x4ecdb3){while(--_0x4ecdb3){_0xfd5311['push'](_0xfd5311['shift']());}};_0x2a3652(++_0x2a4dc7);}(_0x040b,0xac));var _0xb040=function(_0x8da9a1,_0x56115c){_0x8da9a1=_0x8da9a1-0x0;var _0x48b9e4=_0x040b[_0x8da9a1];return _0x48b9e4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb040('0x0'));var timeout=require(_0xb040('0x1'));var express=require(_0xb040('0x2'));var router=express[_0xb040('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb040('0x4'));var interaction=require(_0xb040('0x5'));var config=require('../../config/environment');var controller=require(_0xb040('0x6'));router[_0xb040('0x7')]('/',auth[_0xb040('0x8')](),controller['index']);router[_0xb040('0x7')](_0xb040('0x9'),auth[_0xb040('0x8')](),controller[_0xb040('0xa')]);router['get'](_0xb040('0xb'),auth[_0xb040('0x8')](),controller[_0xb040('0xc')]);router[_0xb040('0x7')](_0xb040('0xd'),auth[_0xb040('0x8')](),controller[_0xb040('0xe')]);router[_0xb040('0xf')]('/',auth[_0xb040('0x8')](),controller[_0xb040('0x10')]);router['post'](_0xb040('0xb'),auth[_0xb040('0x8')](),controller[_0xb040('0x11')]);router['put'](_0xb040('0x9'),auth[_0xb040('0x8')](),controller['update']);router[_0xb040('0x12')](_0xb040('0x9'),auth['isAuthenticated'](),controller[_0xb040('0x13')]);module['exports']=router;
\ No newline at end of file
+var _0x0f03=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0f03,0x7c));var _0x30f0=function(_0x2ad9fd,_0x532050){_0x2ad9fd=_0x2ad9fd-0x0;var _0x38aa2d=_0x0f03[_0x2ad9fd];return _0x38aa2d;};'use strict';var multer=require(_0x30f0('0x0'));var util=require(_0x30f0('0x1'));var path=require(_0x30f0('0x2'));var timeout=require(_0x30f0('0x3'));var express=require(_0x30f0('0x4'));var router=express[_0x30f0('0x5')]();var fs_extra=require(_0x30f0('0x6'));var auth=require(_0x30f0('0x7'));var interaction=require(_0x30f0('0x8'));var config=require(_0x30f0('0x9'));var controller=require(_0x30f0('0xa'));router[_0x30f0('0xb')]('/',auth[_0x30f0('0xc')](),controller[_0x30f0('0xd')]);router['get'](_0x30f0('0xe'),auth[_0x30f0('0xc')](),controller[_0x30f0('0xf')]);router[_0x30f0('0xb')](_0x30f0('0x10'),auth[_0x30f0('0xc')](),controller[_0x30f0('0x11')]);router[_0x30f0('0xb')](_0x30f0('0x12'),auth[_0x30f0('0xc')](),controller[_0x30f0('0x13')]);router[_0x30f0('0x14')]('/',auth[_0x30f0('0xc')](),controller[_0x30f0('0x15')]);router[_0x30f0('0x14')](_0x30f0('0x10'),auth[_0x30f0('0xc')](),controller[_0x30f0('0x16')]);router[_0x30f0('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x30f0('0xe'),auth[_0x30f0('0xc')](),controller[_0x30f0('0x18')]);module[_0x30f0('0x19')]=router;
\ No newline at end of file
index d16784b..86a43ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc822=['ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x4ff47a,_0x13380c){var _0x497539=function(_0x490945){while(--_0x490945){_0x4ff47a['push'](_0x4ff47a['shift']());}};_0x497539(++_0x13380c);}(_0xc822,0x99));var _0x2c82=function(_0x3ff2f9,_0x544ba1){_0x3ff2f9=_0x3ff2f9-0x0;var _0x3b0913=_0xc822[_0x3ff2f9];return _0x3b0913;};'use strict';var Sequelize=require(_0x2c82('0x0'));module[_0x2c82('0x1')]={'name':{'type':Sequelize[_0x2c82('0x2')]},'description':{'type':Sequelize[_0x2c82('0x2')]},'username':{'type':Sequelize[_0x2c82('0x2')]},'remoteUri':{'type':Sequelize[_0x2c82('0x2')]},'authType':{'type':Sequelize[_0x2c82('0x3')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x2c82('0x2')]},'consumerSecret':{'type':Sequelize[_0x2c82('0x2')]},'token':{'type':Sequelize[_0x2c82('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x2c82('0x4'),_0x2c82('0x5')),'defaultValue':'integrationTab'}};
\ No newline at end of file
+var _0x3509=['ENUM','basic','integrationTab','newTab','exports','STRING'];(function(_0x2707e0,_0xf47117){var _0x8c434c=function(_0x21e794){while(--_0x21e794){_0x2707e0['push'](_0x2707e0['shift']());}};_0x8c434c(++_0xf47117);}(_0x3509,0x12a));var _0x9350=function(_0x237f45,_0x45987a){_0x237f45=_0x237f45-0x0;var _0x268b78=_0x3509[_0x237f45];return _0x268b78;};'use strict';var Sequelize=require('sequelize');module[_0x9350('0x0')]={'name':{'type':Sequelize[_0x9350('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x9350('0x2')](_0x9350('0x3')),'defaultValue':_0x9350('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x9350('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x9350('0x1')]},'tokenSecret':{'type':Sequelize[_0x9350('0x1')]},'serverUrl':{'type':Sequelize[_0x9350('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9350('0x2')](_0x9350('0x4'),_0x9350('0x5')),'defaultValue':_0x9350('0x4')}};
\ No newline at end of file
index e9f6363..29fcfd7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc44c=['VIRTUAL','merge','count','includeAll','include','rows','show','params','options','find','create','body','catch','update','destroy','getConfigurations','findOne','DeskConfiguration','order','pick','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','base64','concat','_embedded','entries','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','then','stack','name','send','DeskAccount','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','type'];(function(_0x58b407,_0x42b218){var _0x3dda59=function(_0x58e69c){while(--_0x58e69c){_0x58b407['push'](_0x58b407['shift']());}};_0x3dda59(++_0x42b218);}(_0xc44c,0xb1));var _0xcc44=function(_0x335557,_0x5b67b6){_0x335557=_0x335557-0x0;var _0x19e98c=_0xc44c[_0x335557];return _0x19e98c;};'use strict';var emlformat=require(_0xcc44('0x0'));var rimraf=require(_0xcc44('0x1'));var zipdir=require(_0xcc44('0x2'));var jsonpatch=require(_0xcc44('0x3'));var rp=require('request-promise');var moment=require(_0xcc44('0x4'));var BPromise=require(_0xcc44('0x5'));var Mustache=require(_0xcc44('0x6'));var util=require(_0xcc44('0x7'));var path=require(_0xcc44('0x8'));var sox=require(_0xcc44('0x9'));var csv=require('to-csv');var ejs=require(_0xcc44('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc44('0xb'));var squel=require(_0xcc44('0xc'));var crypto=require(_0xcc44('0xd'));var jsforce=require(_0xcc44('0xe'));var deskjs=require(_0xcc44('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcc44('0x10'));var Papa=require(_0xcc44('0x11'));var Redis=require(_0xcc44('0x12'));var authService=require(_0xcc44('0x13'));var qs=require(_0xcc44('0x14'));var as=require(_0xcc44('0x15'));var hardwareService=require(_0xcc44('0x16'));var logger=require(_0xcc44('0x17'))(_0xcc44('0x18'));var utils=require(_0xcc44('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xcc44('0x1a'));var db=require(_0xcc44('0x1b'))['db'];var integrations=require(_0xcc44('0x1c'));function respondWithStatusCode(_0x1fd0d9,_0x566d1b){_0x566d1b=_0x566d1b||0xcc;return function(_0x24f02f){if(_0x24f02f){return _0x1fd0d9[_0xcc44('0x1d')](_0x566d1b);}return _0x1fd0d9['status'](_0x566d1b)[_0xcc44('0x1e')]();};}function respondWithResult(_0x5ad8bc,_0x12a8f0){_0x12a8f0=_0x12a8f0||0xc8;return function(_0x543c19){if(_0x543c19){return _0x5ad8bc[_0xcc44('0x1f')](_0x12a8f0)[_0xcc44('0x20')](_0x543c19);}};}function respondWithFilteredResult(_0x50f8a5,_0x536c3d){return function(_0x5d5403){if(_0x5d5403){var _0x2fdf05=typeof _0x536c3d[_0xcc44('0x21')]===_0xcc44('0x22')&&typeof _0x536c3d[_0xcc44('0x23')]===_0xcc44('0x22');var _0x7ce1ec=_0x5d5403['count'];var _0xf7891=_0x2fdf05?0x0:_0x536c3d[_0xcc44('0x21')];var _0x1391d1=_0x2fdf05?_0x5d5403['count']:_0x536c3d[_0xcc44('0x21')]+_0x536c3d['limit'];var _0x1a2c64;if(_0x1391d1>=_0x7ce1ec){_0x1391d1=_0x7ce1ec;_0x1a2c64=0xc8;}else{_0x1a2c64=0xce;}_0x50f8a5[_0xcc44('0x1f')](_0x1a2c64);return _0x50f8a5[_0xcc44('0x24')](_0xcc44('0x25'),_0xf7891+'-'+_0x1391d1+'/'+_0x7ce1ec)[_0xcc44('0x20')](_0x5d5403);}return null;};}function patchUpdates(_0x4f28b7){return function(_0x38bf13){try{jsonpatch[_0xcc44('0x26')](_0x38bf13,_0x4f28b7,!![]);}catch(_0x1272e9){return BPromise['reject'](_0x1272e9);}return _0x38bf13[_0xcc44('0x27')]();};}function saveUpdates(_0x3d52f6,_0x26c581){return function(_0x5d942c){if(_0x5d942c){return _0x5d942c['update'](_0x3d52f6)[_0xcc44('0x28')](function(_0x1b33d1){return _0x1b33d1;});}return null;};}function removeEntity(_0x26ad02,_0x5c521c){return function(_0x2f0653){if(_0x2f0653){return _0x2f0653['destroy']()[_0xcc44('0x28')](function(){_0x26ad02[_0xcc44('0x1f')](0xcc)[_0xcc44('0x1e')]();});}};}function handleEntityNotFound(_0x23d5c3,_0x3ba1db){return function(_0x2ca13c){if(!_0x2ca13c){_0x23d5c3[_0xcc44('0x1d')](0x194);}return _0x2ca13c;};}function handleError(_0x3e8f85,_0xa1739c){_0xa1739c=_0xa1739c||0x1f4;return function(_0x2bbbd7){logger['error'](_0x2bbbd7[_0xcc44('0x29')]);if(_0x2bbbd7[_0xcc44('0x2a')]){delete _0x2bbbd7[_0xcc44('0x2a')];}_0x3e8f85[_0xcc44('0x1f')](_0xa1739c)[_0xcc44('0x2b')](_0x2bbbd7);};}exports['index']=function(_0x5c9cc9,_0x1a4861){var _0x1591ab={},_0xe6c35={},_0x26156a={'count':0x0,'rows':[]};var _0x2dac9d=_['map'](db[_0xcc44('0x2c')][_0xcc44('0x2d')],function(_0x372e0c){return{'name':_0x372e0c[_0xcc44('0x2e')],'type':_0x372e0c['type'][_0xcc44('0x2f')]};});_0xe6c35[_0xcc44('0x30')]=_[_0xcc44('0x31')](_0x2dac9d,'name');_0xe6c35['query']=_[_0xcc44('0x32')](_0x5c9cc9[_0xcc44('0x33')]);_0xe6c35[_0xcc44('0x34')]=_[_0xcc44('0x35')](_0xe6c35[_0xcc44('0x30')],_0xe6c35[_0xcc44('0x33')]);_0x1591ab['attributes']=_[_0xcc44('0x35')](_0xe6c35[_0xcc44('0x30')],qs[_0xcc44('0x36')](_0x5c9cc9['query']['fields']));_0x1591ab[_0xcc44('0x37')]=_0x1591ab[_0xcc44('0x37')][_0xcc44('0x38')]?_0x1591ab[_0xcc44('0x37')]:_0xe6c35[_0xcc44('0x30')];if(!_0x5c9cc9[_0xcc44('0x33')][_0xcc44('0x39')](_0xcc44('0x3a'))){_0x1591ab[_0xcc44('0x23')]=qs['limit'](_0x5c9cc9[_0xcc44('0x33')]['limit']);_0x1591ab[_0xcc44('0x21')]=qs[_0xcc44('0x21')](_0x5c9cc9[_0xcc44('0x33')][_0xcc44('0x21')]);}_0x1591ab['order']=qs[_0xcc44('0x3b')](_0x5c9cc9[_0xcc44('0x33')][_0xcc44('0x3b')]);_0x1591ab[_0xcc44('0x3c')]=qs[_0xcc44('0x34')](_['pick'](_0x5c9cc9[_0xcc44('0x33')],_0xe6c35['filters']),_0x2dac9d);if(_0x5c9cc9[_0xcc44('0x33')][_0xcc44('0x3d')]){_0x1591ab[_0xcc44('0x3c')]=_['merge'](_0x1591ab[_0xcc44('0x3c')],{'$or':_[_0xcc44('0x31')](_0x2dac9d,function(_0x2064cd){if(_0x2064cd[_0xcc44('0x3e')]!==_0xcc44('0x3f')){var _0x5d7873={};_0x5d7873[_0x2064cd[_0xcc44('0x2a')]]={'$like':'%'+_0x5c9cc9['query'][_0xcc44('0x3d')]+'%'};return _0x5d7873;}})});}_0x1591ab=_[_0xcc44('0x40')]({},_0x1591ab,_0x5c9cc9['options']);var _0x25831a={'where':_0x1591ab[_0xcc44('0x3c')]};return db[_0xcc44('0x2c')][_0xcc44('0x41')](_0x25831a)['then'](function(_0x88479b){_0x26156a['count']=_0x88479b;if(_0x5c9cc9[_0xcc44('0x33')][_0xcc44('0x42')]){_0x1591ab[_0xcc44('0x43')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x1591ab);})[_0xcc44('0x28')](function(_0x39f873){_0x26156a[_0xcc44('0x44')]=_0x39f873;return _0x26156a;})['then'](respondWithFilteredResult(_0x1a4861,_0x1591ab))['catch'](handleError(_0x1a4861,null));};exports[_0xcc44('0x45')]=function(_0xc8915,_0x35f0de){var _0x33458c={'raw':![],'where':{'id':_0xc8915[_0xcc44('0x46')]['id']}},_0x3960cc={};_0x3960cc['model']=_[_0xcc44('0x32')](db[_0xcc44('0x2c')][_0xcc44('0x2d')]);_0x3960cc[_0xcc44('0x33')]=_[_0xcc44('0x32')](_0xc8915['query']);_0x3960cc[_0xcc44('0x34')]=_[_0xcc44('0x35')](_0x3960cc[_0xcc44('0x30')],_0x3960cc[_0xcc44('0x33')]);_0x33458c[_0xcc44('0x37')]=_[_0xcc44('0x35')](_0x3960cc['model'],qs[_0xcc44('0x36')](_0xc8915[_0xcc44('0x33')][_0xcc44('0x36')]));_0x33458c[_0xcc44('0x37')]=_0x33458c[_0xcc44('0x37')][_0xcc44('0x38')]?_0x33458c[_0xcc44('0x37')]:_0x3960cc[_0xcc44('0x30')];if(_0xc8915[_0xcc44('0x33')][_0xcc44('0x42')]){_0x33458c[_0xcc44('0x43')]=[{'all':!![]}];}_0x33458c=_[_0xcc44('0x40')]({},_0x33458c,_0xc8915[_0xcc44('0x47')]);return db[_0xcc44('0x2c')][_0xcc44('0x48')](_0x33458c)[_0xcc44('0x28')](handleEntityNotFound(_0x35f0de,null))[_0xcc44('0x28')](respondWithResult(_0x35f0de,null))['catch'](handleError(_0x35f0de,null));};exports[_0xcc44('0x49')]=function(_0x2a4e59,_0x259874){return db['DeskAccount'][_0xcc44('0x49')](_0x2a4e59[_0xcc44('0x4a')],{})[_0xcc44('0x28')](respondWithResult(_0x259874,0xc9))[_0xcc44('0x4b')](handleError(_0x259874,null));};exports[_0xcc44('0x4c')]=function(_0x4d5aef,_0x17dca6){if(_0x4d5aef[_0xcc44('0x4a')]['id']){delete _0x4d5aef[_0xcc44('0x4a')]['id'];}return db[_0xcc44('0x2c')]['find']({'where':{'id':_0x4d5aef['params']['id']}})[_0xcc44('0x28')](handleEntityNotFound(_0x17dca6,null))[_0xcc44('0x28')](saveUpdates(_0x4d5aef[_0xcc44('0x4a')],null))['then'](respondWithResult(_0x17dca6,null))[_0xcc44('0x4b')](handleError(_0x17dca6,null));};exports[_0xcc44('0x4d')]=function(_0x205778,_0x4ad7e2){return db['DeskAccount'][_0xcc44('0x48')]({'where':{'id':_0x205778['params']['id']}})[_0xcc44('0x28')](handleEntityNotFound(_0x4ad7e2,null))[_0xcc44('0x28')](removeEntity(_0x4ad7e2,null))[_0xcc44('0x4b')](handleError(_0x4ad7e2,null));};exports[_0xcc44('0x4e')]=function(_0x29aff3,_0xea5ec9,_0x1bcbc3){var _0x529d01={};var _0xb184b0={};var _0x26cad1;var _0x4cb716;return db['DeskAccount'][_0xcc44('0x4f')]({'where':{'id':_0x29aff3[_0xcc44('0x46')]['id']}})['then'](handleEntityNotFound(_0xea5ec9,null))[_0xcc44('0x28')](function(_0xaac5c2){if(_0xaac5c2){_0x26cad1=_0xaac5c2;_0xb184b0[_0xcc44('0x30')]=_['keys'](db[_0xcc44('0x50')]['rawAttributes']);_0xb184b0[_0xcc44('0x33')]=_['keys'](_0x29aff3['query']);_0xb184b0[_0xcc44('0x34')]=_[_0xcc44('0x35')](_0xb184b0[_0xcc44('0x30')],_0xb184b0[_0xcc44('0x33')]);_0x529d01[_0xcc44('0x37')]=_['intersection'](_0xb184b0['model'],qs[_0xcc44('0x36')](_0x29aff3['query'][_0xcc44('0x36')]));_0x529d01['attributes']=_0x529d01['attributes'][_0xcc44('0x38')]?_0x529d01[_0xcc44('0x37')]:_0xb184b0[_0xcc44('0x30')];_0x529d01[_0xcc44('0x51')]=qs['sort'](_0x29aff3[_0xcc44('0x33')][_0xcc44('0x3b')]);_0x529d01[_0xcc44('0x3c')]=qs[_0xcc44('0x34')](_[_0xcc44('0x52')](_0x29aff3['query'],_0xb184b0[_0xcc44('0x34')]));if(_0x29aff3[_0xcc44('0x33')][_0xcc44('0x3d')]){_0x529d01['where']=_[_0xcc44('0x40')](_0x529d01['where'],{'$or':_[_0xcc44('0x31')](_0x529d01[_0xcc44('0x37')],function(_0x3119a0){var _0xa20d92={};_0xa20d92[_0x3119a0]={'$like':'%'+_0x29aff3[_0xcc44('0x33')][_0xcc44('0x3d')]+'%'};return _0xa20d92;})});}_0x529d01=_[_0xcc44('0x40')]({},_0x529d01,_0x29aff3[_0xcc44('0x47')]);return _0x26cad1[_0xcc44('0x4e')](_0x529d01);}})[_0xcc44('0x28')](function(_0x1efbb9){if(_0x1efbb9){_0x4cb716=_0x1efbb9['length'];if(!_0x29aff3[_0xcc44('0x33')][_0xcc44('0x39')](_0xcc44('0x3a'))){_0x529d01[_0xcc44('0x23')]=qs[_0xcc44('0x23')](_0x29aff3[_0xcc44('0x33')][_0xcc44('0x23')]);_0x529d01[_0xcc44('0x21')]=qs[_0xcc44('0x21')](_0x29aff3[_0xcc44('0x33')][_0xcc44('0x21')]);}return _0x26cad1[_0xcc44('0x4e')](_0x529d01);}})[_0xcc44('0x28')](function(_0x53ab6e){if(_0x53ab6e){return _0x53ab6e?{'count':_0x4cb716,'rows':_0x53ab6e}:null;}})[_0xcc44('0x28')](respondWithResult(_0xea5ec9,null))[_0xcc44('0x4b')](handleError(_0xea5ec9,null));};exports['addConfiguration']=function(_0x26bffb,_0x17dab0,_0x128119){if(_0x26bffb[_0xcc44('0x4a')]['id']){delete _0x26bffb[_0xcc44('0x4a')]['id'];}return db[_0xcc44('0x2c')][_0xcc44('0x4f')]({'where':{'id':_0x26bffb[_0xcc44('0x46')]['id']}})['then'](handleEntityNotFound(_0x17dab0,null))['then'](function(_0x47cc49){if(_0x47cc49){_0x26bffb['body'][_0xcc44('0x53')]=_0x47cc49['id'];_0x26bffb[_0xcc44('0x4a')][_0xcc44('0x54')]=integrations['getSubjects'](_0x26bffb[_0xcc44('0x4a')][_0xcc44('0x55')],_0x26bffb[_0xcc44('0x4a')][_0xcc44('0x3e')]);_0x26bffb[_0xcc44('0x4a')][_0xcc44('0x56')]=integrations[_0xcc44('0x57')](_0x26bffb[_0xcc44('0x4a')][_0xcc44('0x55')],_0x26bffb[_0xcc44('0x4a')][_0xcc44('0x3e')]);return db[_0xcc44('0x50')]['create'](_0x26bffb[_0xcc44('0x4a')],{'include':[{'model':db[_0xcc44('0x58')],'as':_0xcc44('0x54')},{'model':db[_0xcc44('0x58')],'as':_0xcc44('0x56')}]});}return null;})['then'](respondWithResult(_0x17dab0,null))[_0xcc44('0x4b')](handleError(_0x17dab0,null));};exports[_0xcc44('0x59')]=function(_0x31f2f4,_0xb2105e,_0x362469){var _0x3b2e8b=[{'name':'priority','label':_0xcc44('0x5a'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x319acc='';return db[_0xcc44('0x2c')]['findOne']({'where':{'id':_0x31f2f4['params']['id']},'attributes':['id','remoteUri',_0xcc44('0x5b'),_0xcc44('0x5c'),_0xcc44('0x5d'),_0xcc44('0x5e'),_0xcc44('0x5f'),_0xcc44('0x60'),_0xcc44('0x61')]})[_0xcc44('0x28')](handleEntityNotFound(_0xb2105e,null))[_0xcc44('0x28')](function(_0xcada4e){if(_0xcada4e){_0x319acc=_0xcada4e['remoteUri'];var _0x44cb49=_0x319acc[_0xcc44('0x62')](-0x1);if(_0x44cb49==='/'){_0x319acc=_0x319acc[_0xcc44('0x63')](0x0,_0x319acc['lastIndexOf'](_0x44cb49));}var _0x3dfa73={'method':_0xcc44('0x64'),'uri':util[_0xcc44('0x65')](_0xcc44('0x66'),_0x319acc),'headers':{'Content-Type':'application/json','Accept':_0xcc44('0x67')},'json':!![]};if(_0xcada4e[_0xcc44('0x5b')]===_0xcc44('0x68')){_0x3dfa73[_0xcc44('0x69')][_0xcc44('0x6a')]=util['format'](_0xcc44('0x6b'),new Buffer(util[_0xcc44('0x65')]('%s:%s',_0xcada4e[_0xcc44('0x5c')],_0xcada4e[_0xcc44('0x5d')]))['toString'](_0xcc44('0x6c')));}return rp(_0x3dfa73)[_0xcc44('0x28')](function(_0x1c7be9){return _0x3b2e8b[_0xcc44('0x6d')](_[_0xcc44('0x31')](_0x1c7be9[_0xcc44('0x6e')][_0xcc44('0x6f')],function(_0x3a23d9){return{'id':_0x3a23d9[_0xcc44('0x2a')],'name':_0x3a23d9[_0xcc44('0x2a')],'type':_0x3a23d9[_0xcc44('0x3e')],'active':_0x3a23d9[_0xcc44('0x70')],'label':_0x3a23d9[_0xcc44('0x71')],'custom':!![]};}));});}})[_0xcc44('0x28')](function(_0x4c1190){return{'count':_0x4c1190[_0xcc44('0x38')],'rows':_0x4c1190};})[_0xcc44('0x28')](respondWithResult(_0xb2105e,null))[_0xcc44('0x4b')](function(_0x7c8868){var _0x58dfd7=_0x31f2f4[_0xcc44('0x33')][_0xcc44('0x72')]?0x1f4:_0x7c8868[_0xcc44('0x73')]||0x1f4;logger[_0xcc44('0x74')](_0xcc44('0x75'),_0xcc44('0x59'),_0x58dfd7,JSON[_0xcc44('0x76')](_0x7c8868));delete _0x7c8868[_0xcc44('0x2a')];if(_0x58dfd7===0x191){_0x58dfd7=0x190;}_0xb2105e[_0xcc44('0x1f')](_0x58dfd7)[_0xcc44('0x2b')](_0x31f2f4[_0xcc44('0x33')][_0xcc44('0x72')]?{'message':_0xcc44('0x77'),'statusCode':_0x7c8868[_0xcc44('0x73')]}:_0x7c8868);});};
\ No newline at end of file
+var _0x9acc=['../../config/environment','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','findAll','rows','catch','show','params','intersection','find','create','body','update','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','channel','DeskConfiguration','DeskField','Subjects','getFields','priority','findOne','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','GET','format','basic','Authorization','toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x1553c8,_0x5f08df){var _0x305f5f=function(_0x429a97){while(--_0x429a97){_0x1553c8['push'](_0x1553c8['shift']());}};_0x305f5f(++_0x5f08df);}(_0x9acc,0x135));var _0xc9ac=function(_0x27bf56,_0xea8883){_0x27bf56=_0x27bf56-0x0;var _0x28f048=_0x9acc[_0x27bf56];return _0x28f048;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9ac('0x0'));var zipdir=require(_0xc9ac('0x1'));var jsonpatch=require(_0xc9ac('0x2'));var rp=require(_0xc9ac('0x3'));var moment=require(_0xc9ac('0x4'));var BPromise=require(_0xc9ac('0x5'));var Mustache=require('mustache');var util=require(_0xc9ac('0x6'));var path=require(_0xc9ac('0x7'));var sox=require('sox');var csv=require(_0xc9ac('0x8'));var ejs=require(_0xc9ac('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9ac('0xa'));var squel=require(_0xc9ac('0xb'));var crypto=require(_0xc9ac('0xc'));var jsforce=require(_0xc9ac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc9ac('0x8'));var querystring=require(_0xc9ac('0xe'));var Papa=require(_0xc9ac('0xf'));var Redis=require(_0xc9ac('0x10'));var authService=require(_0xc9ac('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9ac('0x12'));var logger=require(_0xc9ac('0x13'))('api');var utils=require(_0xc9ac('0x14'));var config=require(_0xc9ac('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xc9ac('0x16'));function respondWithStatusCode(_0x314663,_0x14a996){_0x14a996=_0x14a996||0xcc;return function(_0x7ad976){if(_0x7ad976){return _0x314663['sendStatus'](_0x14a996);}return _0x314663['status'](_0x14a996)[_0xc9ac('0x17')]();};}function respondWithResult(_0xa06533,_0x19c0d2){_0x19c0d2=_0x19c0d2||0xc8;return function(_0x240d8c){if(_0x240d8c){return _0xa06533[_0xc9ac('0x18')](_0x19c0d2)[_0xc9ac('0x19')](_0x240d8c);}};}function respondWithFilteredResult(_0x2ff052,_0x1719cf){return function(_0x58c0d4){if(_0x58c0d4){var _0x1e918a=typeof _0x1719cf[_0xc9ac('0x1a')]===_0xc9ac('0x1b')&&typeof _0x1719cf[_0xc9ac('0x1c')]===_0xc9ac('0x1b');var _0x4be483=_0x58c0d4[_0xc9ac('0x1d')];var _0x208e1c=_0x1e918a?0x0:_0x1719cf['offset'];var _0xaee7d2=_0x1e918a?_0x58c0d4[_0xc9ac('0x1d')]:_0x1719cf[_0xc9ac('0x1a')]+_0x1719cf[_0xc9ac('0x1c')];var _0x4629f8;if(_0xaee7d2>=_0x4be483){_0xaee7d2=_0x4be483;_0x4629f8=0xc8;}else{_0x4629f8=0xce;}_0x2ff052[_0xc9ac('0x18')](_0x4629f8);return _0x2ff052[_0xc9ac('0x1e')](_0xc9ac('0x1f'),_0x208e1c+'-'+_0xaee7d2+'/'+_0x4be483)[_0xc9ac('0x19')](_0x58c0d4);}return null;};}function patchUpdates(_0x49f4eb){return function(_0x4ebec8){try{jsonpatch['apply'](_0x4ebec8,_0x49f4eb,!![]);}catch(_0xf4e514){return BPromise[_0xc9ac('0x20')](_0xf4e514);}return _0x4ebec8[_0xc9ac('0x21')]();};}function saveUpdates(_0x5aae94,_0x17c7fa){return function(_0x36b3d4){if(_0x36b3d4){return _0x36b3d4['update'](_0x5aae94)[_0xc9ac('0x22')](function(_0x1c2d86){return _0x1c2d86;});}return null;};}function removeEntity(_0x38e114,_0x2a4877){return function(_0x32d086){if(_0x32d086){return _0x32d086[_0xc9ac('0x23')]()[_0xc9ac('0x22')](function(){_0x38e114[_0xc9ac('0x18')](0xcc)[_0xc9ac('0x17')]();});}};}function handleEntityNotFound(_0x1545d9,_0x457b49){return function(_0xb0b499){if(!_0xb0b499){_0x1545d9['sendStatus'](0x194);}return _0xb0b499;};}function handleError(_0x5807be,_0x32a12e){_0x32a12e=_0x32a12e||0x1f4;return function(_0x393c0b){logger[_0xc9ac('0x24')](_0x393c0b[_0xc9ac('0x25')]);if(_0x393c0b[_0xc9ac('0x26')]){delete _0x393c0b[_0xc9ac('0x26')];}_0x5807be['status'](_0x32a12e)[_0xc9ac('0x27')](_0x393c0b);};}exports[_0xc9ac('0x28')]=function(_0x2d8941,_0x380efe){var _0x121683={},_0x2492af={},_0x582683={'count':0x0,'rows':[]};var _0xf01047=_[_0xc9ac('0x29')](db[_0xc9ac('0x2a')][_0xc9ac('0x2b')],function(_0x1025ec){return{'name':_0x1025ec[_0xc9ac('0x2c')],'type':_0x1025ec[_0xc9ac('0x2d')][_0xc9ac('0x2e')]};});_0x2492af[_0xc9ac('0x2f')]=_[_0xc9ac('0x29')](_0xf01047,'name');_0x2492af['query']=_[_0xc9ac('0x30')](_0x2d8941[_0xc9ac('0x31')]);_0x2492af[_0xc9ac('0x32')]=_['intersection'](_0x2492af[_0xc9ac('0x2f')],_0x2492af['query']);_0x121683[_0xc9ac('0x33')]=_['intersection'](_0x2492af[_0xc9ac('0x2f')],qs[_0xc9ac('0x34')](_0x2d8941[_0xc9ac('0x31')][_0xc9ac('0x34')]));_0x121683[_0xc9ac('0x33')]=_0x121683['attributes'][_0xc9ac('0x35')]?_0x121683['attributes']:_0x2492af[_0xc9ac('0x2f')];if(!_0x2d8941[_0xc9ac('0x31')][_0xc9ac('0x36')](_0xc9ac('0x37'))){_0x121683[_0xc9ac('0x1c')]=qs[_0xc9ac('0x1c')](_0x2d8941[_0xc9ac('0x31')]['limit']);_0x121683[_0xc9ac('0x1a')]=qs['offset'](_0x2d8941[_0xc9ac('0x31')][_0xc9ac('0x1a')]);}_0x121683[_0xc9ac('0x38')]=qs[_0xc9ac('0x39')](_0x2d8941[_0xc9ac('0x31')]['sort']);_0x121683['where']=qs[_0xc9ac('0x32')](_[_0xc9ac('0x3a')](_0x2d8941[_0xc9ac('0x31')],_0x2492af[_0xc9ac('0x32')]),_0xf01047);if(_0x2d8941[_0xc9ac('0x31')]['filter']){_0x121683[_0xc9ac('0x3b')]=_[_0xc9ac('0x3c')](_0x121683['where'],{'$or':_[_0xc9ac('0x29')](_0xf01047,function(_0x420979){if(_0x420979[_0xc9ac('0x2d')]!=='VIRTUAL'){var _0x19158c={};_0x19158c[_0x420979[_0xc9ac('0x26')]]={'$like':'%'+_0x2d8941[_0xc9ac('0x31')][_0xc9ac('0x3d')]+'%'};return _0x19158c;}})});}_0x121683=_[_0xc9ac('0x3c')]({},_0x121683,_0x2d8941[_0xc9ac('0x3e')]);var _0x5c7312={'where':_0x121683['where']};return db[_0xc9ac('0x2a')]['count'](_0x5c7312)[_0xc9ac('0x22')](function(_0x3a1d49){_0x582683['count']=_0x3a1d49;if(_0x2d8941[_0xc9ac('0x31')][_0xc9ac('0x3f')]){_0x121683['include']=[{'all':!![]}];}return db[_0xc9ac('0x2a')][_0xc9ac('0x40')](_0x121683);})[_0xc9ac('0x22')](function(_0x232082){_0x582683[_0xc9ac('0x41')]=_0x232082;return _0x582683;})[_0xc9ac('0x22')](respondWithFilteredResult(_0x380efe,_0x121683))[_0xc9ac('0x42')](handleError(_0x380efe,null));};exports[_0xc9ac('0x43')]=function(_0x1c99bf,_0xb3beb){var _0x5c9c33={'raw':![],'where':{'id':_0x1c99bf[_0xc9ac('0x44')]['id']}},_0x222dae={};_0x222dae[_0xc9ac('0x2f')]=_[_0xc9ac('0x30')](db[_0xc9ac('0x2a')][_0xc9ac('0x2b')]);_0x222dae[_0xc9ac('0x31')]=_[_0xc9ac('0x30')](_0x1c99bf[_0xc9ac('0x31')]);_0x222dae[_0xc9ac('0x32')]=_[_0xc9ac('0x45')](_0x222dae[_0xc9ac('0x2f')],_0x222dae['query']);_0x5c9c33['attributes']=_[_0xc9ac('0x45')](_0x222dae[_0xc9ac('0x2f')],qs[_0xc9ac('0x34')](_0x1c99bf[_0xc9ac('0x31')][_0xc9ac('0x34')]));_0x5c9c33[_0xc9ac('0x33')]=_0x5c9c33[_0xc9ac('0x33')][_0xc9ac('0x35')]?_0x5c9c33[_0xc9ac('0x33')]:_0x222dae[_0xc9ac('0x2f')];if(_0x1c99bf[_0xc9ac('0x31')][_0xc9ac('0x3f')]){_0x5c9c33['include']=[{'all':!![]}];}_0x5c9c33=_[_0xc9ac('0x3c')]({},_0x5c9c33,_0x1c99bf['options']);return db[_0xc9ac('0x2a')][_0xc9ac('0x46')](_0x5c9c33)[_0xc9ac('0x22')](handleEntityNotFound(_0xb3beb,null))[_0xc9ac('0x22')](respondWithResult(_0xb3beb,null))[_0xc9ac('0x42')](handleError(_0xb3beb,null));};exports[_0xc9ac('0x47')]=function(_0x31bb9a,_0x57d9d6){return db[_0xc9ac('0x2a')][_0xc9ac('0x47')](_0x31bb9a[_0xc9ac('0x48')],{})[_0xc9ac('0x22')](respondWithResult(_0x57d9d6,0xc9))[_0xc9ac('0x42')](handleError(_0x57d9d6,null));};exports[_0xc9ac('0x49')]=function(_0x1c6616,_0x438025){if(_0x1c6616['body']['id']){delete _0x1c6616['body']['id'];}return db[_0xc9ac('0x2a')][_0xc9ac('0x46')]({'where':{'id':_0x1c6616[_0xc9ac('0x44')]['id']}})[_0xc9ac('0x22')](handleEntityNotFound(_0x438025,null))[_0xc9ac('0x22')](saveUpdates(_0x1c6616[_0xc9ac('0x48')],null))['then'](respondWithResult(_0x438025,null))['catch'](handleError(_0x438025,null));};exports['destroy']=function(_0x8d3c29,_0x10edfd){return db[_0xc9ac('0x2a')][_0xc9ac('0x46')]({'where':{'id':_0x8d3c29[_0xc9ac('0x44')]['id']}})['then'](handleEntityNotFound(_0x10edfd,null))[_0xc9ac('0x22')](removeEntity(_0x10edfd,null))['catch'](handleError(_0x10edfd,null));};exports['getConfigurations']=function(_0x92839b,_0x62f2fe,_0x65534a){var _0x55b314={};var _0x13b034={};var _0x47aae3;var _0x27ebab;return db[_0xc9ac('0x2a')]['findOne']({'where':{'id':_0x92839b['params']['id']}})[_0xc9ac('0x22')](handleEntityNotFound(_0x62f2fe,null))[_0xc9ac('0x22')](function(_0x23721b){if(_0x23721b){_0x47aae3=_0x23721b;_0x13b034['model']=_[_0xc9ac('0x30')](db['DeskConfiguration'][_0xc9ac('0x2b')]);_0x13b034['query']=_['keys'](_0x92839b['query']);_0x13b034[_0xc9ac('0x32')]=_[_0xc9ac('0x45')](_0x13b034[_0xc9ac('0x2f')],_0x13b034[_0xc9ac('0x31')]);_0x55b314['attributes']=_[_0xc9ac('0x45')](_0x13b034[_0xc9ac('0x2f')],qs[_0xc9ac('0x34')](_0x92839b[_0xc9ac('0x31')][_0xc9ac('0x34')]));_0x55b314[_0xc9ac('0x33')]=_0x55b314[_0xc9ac('0x33')][_0xc9ac('0x35')]?_0x55b314['attributes']:_0x13b034[_0xc9ac('0x2f')];_0x55b314[_0xc9ac('0x38')]=qs[_0xc9ac('0x39')](_0x92839b[_0xc9ac('0x31')][_0xc9ac('0x39')]);_0x55b314[_0xc9ac('0x3b')]=qs[_0xc9ac('0x32')](_['pick'](_0x92839b[_0xc9ac('0x31')],_0x13b034[_0xc9ac('0x32')]));if(_0x92839b[_0xc9ac('0x31')][_0xc9ac('0x3d')]){_0x55b314[_0xc9ac('0x3b')]=_['merge'](_0x55b314['where'],{'$or':_[_0xc9ac('0x29')](_0x55b314['attributes'],function(_0x451a90){var _0x282159={};_0x282159[_0x451a90]={'$like':'%'+_0x92839b[_0xc9ac('0x31')][_0xc9ac('0x3d')]+'%'};return _0x282159;})});}_0x55b314=_[_0xc9ac('0x3c')]({},_0x55b314,_0x92839b[_0xc9ac('0x3e')]);return _0x47aae3[_0xc9ac('0x4a')](_0x55b314);}})[_0xc9ac('0x22')](function(_0x3f1181){if(_0x3f1181){_0x27ebab=_0x3f1181[_0xc9ac('0x35')];if(!_0x92839b[_0xc9ac('0x31')]['hasOwnProperty'](_0xc9ac('0x37'))){_0x55b314[_0xc9ac('0x1c')]=qs[_0xc9ac('0x1c')](_0x92839b[_0xc9ac('0x31')][_0xc9ac('0x1c')]);_0x55b314[_0xc9ac('0x1a')]=qs['offset'](_0x92839b[_0xc9ac('0x31')]['offset']);}return _0x47aae3[_0xc9ac('0x4a')](_0x55b314);}})[_0xc9ac('0x22')](function(_0x50698b){if(_0x50698b){return _0x50698b?{'count':_0x27ebab,'rows':_0x50698b}:null;}})[_0xc9ac('0x22')](respondWithResult(_0x62f2fe,null))[_0xc9ac('0x42')](handleError(_0x62f2fe,null));};exports[_0xc9ac('0x4b')]=function(_0x502527,_0x14a904,_0x26be2f){if(_0x502527[_0xc9ac('0x48')]['id']){delete _0x502527[_0xc9ac('0x48')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x502527[_0xc9ac('0x44')]['id']}})[_0xc9ac('0x22')](handleEntityNotFound(_0x14a904,null))[_0xc9ac('0x22')](function(_0x4f697a){if(_0x4f697a){_0x502527[_0xc9ac('0x48')][_0xc9ac('0x4c')]=_0x4f697a['id'];_0x502527[_0xc9ac('0x48')]['Subjects']=integrations[_0xc9ac('0x4d')](_0x502527[_0xc9ac('0x48')]['channel'],_0x502527[_0xc9ac('0x48')][_0xc9ac('0x2d')]);_0x502527[_0xc9ac('0x48')][_0xc9ac('0x4e')]=integrations['getDescriptions'](_0x502527[_0xc9ac('0x48')][_0xc9ac('0x4f')],_0x502527[_0xc9ac('0x48')][_0xc9ac('0x2d')]);return db[_0xc9ac('0x50')][_0xc9ac('0x47')](_0x502527[_0xc9ac('0x48')],{'include':[{'model':db[_0xc9ac('0x51')],'as':_0xc9ac('0x52')},{'model':db['DeskField'],'as':_0xc9ac('0x4e')}]});}return null;})[_0xc9ac('0x22')](respondWithResult(_0x14a904,null))[_0xc9ac('0x42')](handleError(_0x14a904,null));};exports[_0xc9ac('0x53')]=function(_0x3cdad6,_0x544b87,_0x16b06e){var _0x2d91a2=[{'name':_0xc9ac('0x54'),'label':_0xc9ac('0x54'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0xb28b13='';return db['DeskAccount'][_0xc9ac('0x55')]({'where':{'id':_0x3cdad6[_0xc9ac('0x44')]['id']},'attributes':['id','remoteUri',_0xc9ac('0x56'),_0xc9ac('0x57'),_0xc9ac('0x58'),_0xc9ac('0x59'),_0xc9ac('0x5a'),_0xc9ac('0x5b'),_0xc9ac('0x5c')]})[_0xc9ac('0x22')](handleEntityNotFound(_0x544b87,null))[_0xc9ac('0x22')](function(_0x1c3cef){if(_0x1c3cef){_0xb28b13=_0x1c3cef[_0xc9ac('0x5d')];var _0x542900=_0xb28b13[_0xc9ac('0x5e')](-0x1);if(_0x542900==='/'){_0xb28b13=_0xb28b13['substring'](0x0,_0xb28b13['lastIndexOf'](_0x542900));}var _0x3f98c8={'method':_0xc9ac('0x5f'),'uri':util[_0xc9ac('0x60')]('%s/custom_fields',_0xb28b13),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x1c3cef[_0xc9ac('0x56')]===_0xc9ac('0x61')){_0x3f98c8['headers'][_0xc9ac('0x62')]=util['format']('Basic\x20%s',new Buffer(util[_0xc9ac('0x60')]('%s:%s',_0x1c3cef[_0xc9ac('0x57')],_0x1c3cef[_0xc9ac('0x58')]))[_0xc9ac('0x63')](_0xc9ac('0x64')));}return rp(_0x3f98c8)[_0xc9ac('0x22')](function(_0x3240a9){return _0x2d91a2[_0xc9ac('0x65')](_[_0xc9ac('0x29')](_0x3240a9[_0xc9ac('0x66')][_0xc9ac('0x67')],function(_0x1834aa){return{'id':_0x1834aa[_0xc9ac('0x26')],'name':_0x1834aa[_0xc9ac('0x26')],'type':_0x1834aa[_0xc9ac('0x2d')],'active':_0x1834aa['active'],'label':_0x1834aa[_0xc9ac('0x68')],'custom':!![]};}));});}})[_0xc9ac('0x22')](function(_0x32d415){return{'count':_0x32d415[_0xc9ac('0x35')],'rows':_0x32d415};})[_0xc9ac('0x22')](respondWithResult(_0x544b87,null))[_0xc9ac('0x42')](function(_0x10c549){var _0x4be3a2=_0x3cdad6[_0xc9ac('0x31')][_0xc9ac('0x69')]?0x1f4:_0x10c549[_0xc9ac('0x6a')]||0x1f4;logger[_0xc9ac('0x24')](_0xc9ac('0x6b'),_0xc9ac('0x53'),_0x4be3a2,JSON[_0xc9ac('0x6c')](_0x10c549));delete _0x10c549[_0xc9ac('0x26')];if(_0x4be3a2===0x191){_0x4be3a2=0x190;}_0x544b87[_0xc9ac('0x18')](_0x4be3a2)[_0xc9ac('0x27')](_0x3cdad6[_0xc9ac('0x31')][_0xc9ac('0x69')]?{'message':_0xc9ac('0x6d'),'statusCode':_0x10c549[_0xc9ac('0x6a')]}:_0x10c549);});};
\ No newline at end of file
index 62aa98b..20dc504 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x84b3=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','int_desk_accounts'];(function(_0x1cfad3,_0x16fda0){var _0x16ab1c=function(_0x3e9a71){while(--_0x3e9a71){_0x1cfad3['push'](_0x1cfad3['shift']());}};_0x16ab1c(++_0x16fda0);}(_0x84b3,0x12c));var _0x384b=function(_0x569055,_0x491032){_0x569055=_0x569055-0x0;var _0x5115d5=_0x84b3[_0x569055];return _0x5115d5;};'use strict';var _=require(_0x384b('0x0'));var util=require(_0x384b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x384b('0x2'));var BPromise=require(_0x384b('0x3'));var rp=require(_0x384b('0x4'));var fs=require('fs');var path=require(_0x384b('0x5'));var rimraf=require(_0x384b('0x6'));var config=require(_0x384b('0x7'));var attributes=require(_0x384b('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x384b('0x9')]=function(_0x579486,_0x474d27){return _0x579486[_0x384b('0xa')]('DeskAccount',attributes,{'tableName':_0x384b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x5d65=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','lodash'];(function(_0x301e16,_0x502bfe){var _0x103926=function(_0xd6c595){while(--_0xd6c595){_0x301e16['push'](_0x301e16['shift']());}};_0x103926(++_0x502bfe);}(_0x5d65,0x7d));var _0x55d6=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x5d65[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x55d6('0x0'));var util=require(_0x55d6('0x1'));var logger=require(_0x55d6('0x2'))('api');var moment=require(_0x55d6('0x3'));var BPromise=require(_0x55d6('0x4'));var rp=require(_0x55d6('0x5'));var fs=require('fs');var path=require(_0x55d6('0x6'));var rimraf=require(_0x55d6('0x7'));var config=require(_0x55d6('0x8'));var attributes=require(_0x55d6('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x55d6('0xa')]=function(_0x56830c,_0x3411f1){return _0x56830c[_0x55d6('0xb')](_0x55d6('0xc'),attributes,{'tableName':_0x55d6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 98f902b..0fe2f0d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8f0e=['then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowDeskAccount','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0x8f0e,0x165));var _0xe8f0=function(_0x589460,_0x48c134){_0x589460=_0x589460-0x0;var _0x1d3f42=_0x8f0e[_0x589460];return _0x1d3f42;};'use strict';var _=require(_0xe8f0('0x0'));var util=require(_0xe8f0('0x1'));var moment=require(_0xe8f0('0x2'));var BPromise=require('bluebird');var rs=require(_0xe8f0('0x3'));var fs=require('fs');var Redis=require(_0xe8f0('0x4'));var db=require(_0xe8f0('0x5'))['db'];var utils=require(_0xe8f0('0x6'));var logger=require(_0xe8f0('0x7'))(_0xe8f0('0x8'));var config=require('../../config/environment');var jayson=require(_0xe8f0('0x9'));var client=jayson[_0xe8f0('0xa')][_0xe8f0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56c645,_0x2e8306,_0x1df59a){return new BPromise(function(_0x2699ee,_0x41a7ab){return client[_0xe8f0('0xc')](_0x56c645,_0x1df59a)[_0xe8f0('0xd')](function(_0x58f2c5){logger[_0xe8f0('0xe')](_0xe8f0('0xf'),_0x2e8306,_0xe8f0('0x10'));logger[_0xe8f0('0x11')](_0xe8f0('0x12'),_0x2e8306,_0xe8f0('0x10'),JSON['stringify'](_0x58f2c5));if(_0x58f2c5[_0xe8f0('0x13')]){if(_0x58f2c5[_0xe8f0('0x13')][_0xe8f0('0x14')]===0x1f4){logger[_0xe8f0('0x13')](_0xe8f0('0xf'),_0x2e8306,_0x58f2c5[_0xe8f0('0x13')]['message']);return _0x41a7ab(_0x58f2c5['error']['message']);}logger[_0xe8f0('0x13')](_0xe8f0('0xf'),_0x2e8306,_0x58f2c5[_0xe8f0('0x13')]['message']);return _0x2699ee(_0x58f2c5[_0xe8f0('0x13')][_0xe8f0('0x15')]);}else{logger['info'](_0xe8f0('0xf'),_0x2e8306,_0xe8f0('0x10'));_0x2699ee(_0x58f2c5['result'][_0xe8f0('0x15')]);}})[_0xe8f0('0x16')](function(_0x3a533c){logger['error'](_0xe8f0('0xf'),_0x2e8306,_0x3a533c);_0x41a7ab(_0x3a533c);});});}exports[_0xe8f0('0x17')]=function(_0x1f1751){var _0x43f386=this;return new Promise(function(_0x3ff223,_0x1eceae){return db[_0xe8f0('0x18')][_0xe8f0('0x19')]({'raw':_0x1f1751[_0xe8f0('0x1a')]?_0x1f1751[_0xe8f0('0x1a')][_0xe8f0('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f1751[_0xe8f0('0x1a')]?_0x1f1751[_0xe8f0('0x1a')]['where']||null:null,'attributes':_0x1f1751[_0xe8f0('0x1a')]?_0x1f1751[_0xe8f0('0x1a')][_0xe8f0('0x1c')]||null:null,'limit':_0x1f1751[_0xe8f0('0x1a')]?_0x1f1751[_0xe8f0('0x1a')][_0xe8f0('0x1d')]||null:null,'include':_0x1f1751[_0xe8f0('0x1a')]?_0x1f1751['options'][_0xe8f0('0x1e')]?_[_0xe8f0('0x1f')](_0x1f1751[_0xe8f0('0x1a')]['include'],function(_0x455c5e){return{'model':db[_0x455c5e[_0xe8f0('0x20')]],'as':_0x455c5e['as'],'attributes':_0x455c5e[_0xe8f0('0x1c')],'include':_0x455c5e[_0xe8f0('0x1e')]?_[_0xe8f0('0x1f')](_0x455c5e[_0xe8f0('0x1e')],function(_0x1ce216){return{'model':db[_0x1ce216[_0xe8f0('0x20')]],'as':_0x1ce216['as'],'attributes':_0x1ce216['attributes'],'include':_0x1ce216[_0xe8f0('0x1e')]?_[_0xe8f0('0x1f')](_0x1ce216[_0xe8f0('0x1e')],function(_0x5a0f58){return{'model':db[_0x5a0f58['model']],'as':_0x5a0f58['as'],'attributes':_0x5a0f58[_0xe8f0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe8f0('0xd')](function(_0x4ca2f4){logger[_0xe8f0('0xe')](_0xe8f0('0x17'),_0x1f1751);logger['debug'](_0xe8f0('0x17'),_0x1f1751,JSON[_0xe8f0('0x21')](_0x4ca2f4));_0x3ff223(_0x4ca2f4);})['catch'](function(_0x2f2c5a){logger[_0xe8f0('0x13')](_0xe8f0('0x17'),_0x2f2c5a[_0xe8f0('0x15')],_0x1f1751);_0x1eceae(_0x43f386[_0xe8f0('0x13')](0x1f4,_0x2f2c5a[_0xe8f0('0x15')]));});});};exports[_0xe8f0('0x22')]=function(_0x24ef90){var _0x5dc396=this;return new Promise(function(_0x514b69,_0x43340a){return db['DeskAccount'][_0xe8f0('0x23')]({'raw':_0x24ef90[_0xe8f0('0x1a')]?_0x24ef90[_0xe8f0('0x1a')][_0xe8f0('0x1b')]===undefined?!![]:![]:!![],'where':_0x24ef90[_0xe8f0('0x1a')]?_0x24ef90['options'][_0xe8f0('0x24')]||null:null,'attributes':_0x24ef90[_0xe8f0('0x1a')]?_0x24ef90[_0xe8f0('0x1a')][_0xe8f0('0x1c')]||null:null,'include':_0x24ef90[_0xe8f0('0x1a')]?_0x24ef90[_0xe8f0('0x1a')][_0xe8f0('0x1e')]?_[_0xe8f0('0x1f')](_0x24ef90[_0xe8f0('0x1a')][_0xe8f0('0x1e')],function(_0x1d85b9){return{'model':db[_0x1d85b9['model']],'as':_0x1d85b9['as'],'attributes':_0x1d85b9[_0xe8f0('0x1c')],'include':_0x1d85b9[_0xe8f0('0x1e')]?_[_0xe8f0('0x1f')](_0x1d85b9['include'],function(_0x195dee){return{'model':db[_0x195dee['model']],'as':_0x195dee['as'],'attributes':_0x195dee['attributes'],'include':_0x195dee['include']?_['map'](_0x195dee[_0xe8f0('0x1e')],function(_0x5e6377){return{'model':db[_0x5e6377['model']],'as':_0x5e6377['as'],'attributes':_0x5e6377['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d14b2){logger[_0xe8f0('0xe')](_0xe8f0('0x22'),_0x24ef90);logger[_0xe8f0('0x11')]('ShowDeskAccount',_0x24ef90,JSON[_0xe8f0('0x21')](_0x1d14b2));_0x514b69(_0x1d14b2);})[_0xe8f0('0x16')](function(_0x31a216){logger[_0xe8f0('0x13')](_0xe8f0('0x22'),_0x31a216[_0xe8f0('0x15')],_0x24ef90);_0x43340a(_0x5dc396[_0xe8f0('0x13')](0x1f4,_0x31a216[_0xe8f0('0x15')]));});});};
\ No newline at end of file
+var _0x90db=['model','GetDeskAccount','debug','catch','map','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','DeskAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x773743,_0x15b02c){var _0x1dc1ff=function(_0x3e1275){while(--_0x3e1275){_0x773743['push'](_0x773743['shift']());}};_0x1dc1ff(++_0x15b02c);}(_0x90db,0x1aa));var _0xb90d=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x90db[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0xb90d('0x0'));var util=require(_0xb90d('0x1'));var moment=require(_0xb90d('0x2'));var BPromise=require(_0xb90d('0x3'));var rs=require(_0xb90d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb90d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb90d('0x6'))('rpc');var config=require(_0xb90d('0x7'));var jayson=require(_0xb90d('0x8'));var client=jayson[_0xb90d('0x9')][_0xb90d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7bcffa,_0x34ca64,_0x1c3076){return new BPromise(function(_0x4801cb,_0xa6db13){return client[_0xb90d('0xb')](_0x7bcffa,_0x1c3076)[_0xb90d('0xc')](function(_0xcc6812){logger[_0xb90d('0xd')](_0xb90d('0xe'),_0x34ca64,_0xb90d('0xf'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x34ca64,_0xb90d('0xf'),JSON[_0xb90d('0x10')](_0xcc6812));if(_0xcc6812[_0xb90d('0x11')]){if(_0xcc6812[_0xb90d('0x11')][_0xb90d('0x12')]===0x1f4){logger[_0xb90d('0x11')](_0xb90d('0xe'),_0x34ca64,_0xcc6812['error']['message']);return _0xa6db13(_0xcc6812['error'][_0xb90d('0x13')]);}logger[_0xb90d('0x11')](_0xb90d('0xe'),_0x34ca64,_0xcc6812[_0xb90d('0x11')][_0xb90d('0x13')]);return _0x4801cb(_0xcc6812['error'][_0xb90d('0x13')]);}else{logger[_0xb90d('0xd')](_0xb90d('0xe'),_0x34ca64,_0xb90d('0xf'));_0x4801cb(_0xcc6812[_0xb90d('0x14')][_0xb90d('0x13')]);}})['catch'](function(_0x23a3ad){logger[_0xb90d('0x11')]('DeskAccount,\x20%s,\x20%s',_0x34ca64,_0x23a3ad);_0xa6db13(_0x23a3ad);});});}exports['GetDeskAccount']=function(_0x35e69e){var _0x467f96=this;return new Promise(function(_0x2f5102,_0x3735ef){return db[_0xb90d('0x15')][_0xb90d('0x16')]({'raw':_0x35e69e[_0xb90d('0x17')]?_0x35e69e['options'][_0xb90d('0x18')]===undefined?!![]:![]:!![],'where':_0x35e69e[_0xb90d('0x17')]?_0x35e69e[_0xb90d('0x17')][_0xb90d('0x19')]||null:null,'attributes':_0x35e69e['options']?_0x35e69e[_0xb90d('0x17')][_0xb90d('0x1a')]||null:null,'limit':_0x35e69e[_0xb90d('0x17')]?_0x35e69e['options'][_0xb90d('0x1b')]||null:null,'include':_0x35e69e['options']?_0x35e69e['options'][_0xb90d('0x1c')]?_['map'](_0x35e69e[_0xb90d('0x17')][_0xb90d('0x1c')],function(_0x2666cb){return{'model':db[_0x2666cb['model']],'as':_0x2666cb['as'],'attributes':_0x2666cb[_0xb90d('0x1a')],'include':_0x2666cb['include']?_['map'](_0x2666cb[_0xb90d('0x1c')],function(_0x2d4fbd){return{'model':db[_0x2d4fbd[_0xb90d('0x1d')]],'as':_0x2d4fbd['as'],'attributes':_0x2d4fbd['attributes'],'include':_0x2d4fbd[_0xb90d('0x1c')]?_['map'](_0x2d4fbd[_0xb90d('0x1c')],function(_0x51569c){return{'model':db[_0x51569c[_0xb90d('0x1d')]],'as':_0x51569c['as'],'attributes':_0x51569c[_0xb90d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb90d('0xc')](function(_0x4e0785){logger[_0xb90d('0xd')](_0xb90d('0x1e'),_0x35e69e);logger[_0xb90d('0x1f')](_0xb90d('0x1e'),_0x35e69e,JSON[_0xb90d('0x10')](_0x4e0785));_0x2f5102(_0x4e0785);})[_0xb90d('0x20')](function(_0x42e0b7){logger['error'](_0xb90d('0x1e'),_0x42e0b7[_0xb90d('0x13')],_0x35e69e);_0x3735ef(_0x467f96[_0xb90d('0x11')](0x1f4,_0x42e0b7[_0xb90d('0x13')]));});});};exports['ShowDeskAccount']=function(_0x4ff3d2){var _0x15a4e4=this;return new Promise(function(_0x537545,_0x4a3610){return db[_0xb90d('0x15')]['find']({'raw':_0x4ff3d2[_0xb90d('0x17')]?_0x4ff3d2[_0xb90d('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4ff3d2['options']?_0x4ff3d2[_0xb90d('0x17')][_0xb90d('0x19')]||null:null,'attributes':_0x4ff3d2['options']?_0x4ff3d2[_0xb90d('0x17')][_0xb90d('0x1a')]||null:null,'include':_0x4ff3d2['options']?_0x4ff3d2[_0xb90d('0x17')][_0xb90d('0x1c')]?_[_0xb90d('0x21')](_0x4ff3d2['options'][_0xb90d('0x1c')],function(_0x17e2ba){return{'model':db[_0x17e2ba['model']],'as':_0x17e2ba['as'],'attributes':_0x17e2ba[_0xb90d('0x1a')],'include':_0x17e2ba['include']?_['map'](_0x17e2ba[_0xb90d('0x1c')],function(_0x54408e){return{'model':db[_0x54408e[_0xb90d('0x1d')]],'as':_0x54408e['as'],'attributes':_0x54408e[_0xb90d('0x1a')],'include':_0x54408e[_0xb90d('0x1c')]?_[_0xb90d('0x21')](_0x54408e['include'],function(_0x1ba292){return{'model':db[_0x1ba292[_0xb90d('0x1d')]],'as':_0x1ba292['as'],'attributes':_0x1ba292[_0xb90d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb90d('0xc')](function(_0x1b2a03){logger[_0xb90d('0xd')]('ShowDeskAccount',_0x4ff3d2);logger[_0xb90d('0x1f')](_0xb90d('0x22'),_0x4ff3d2,JSON[_0xb90d('0x10')](_0x1b2a03));_0x537545(_0x1b2a03);})['catch'](function(_0x1efa8b){logger[_0xb90d('0x11')](_0xb90d('0x22'),_0x1efa8b[_0xb90d('0x13')],_0x4ff3d2);_0x4a3610(_0x15a4e4[_0xb90d('0x11')](0x1f4,_0x1efa8b['message']));});});};
\ No newline at end of file
index 461b91e..d75954d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1c71ae,_0xbf901e){var _0x21fb3a=function(_0x35a7c7){while(--_0x35a7c7){_0x1c71ae['push'](_0x1c71ae['shift']());}};_0x21fb3a(++_0xbf901e);}(_0x34e8,0x12c));var _0x834e=function(_0x2c0903,_0x326e2e){_0x2c0903=_0x2c0903-0x0;var _0xf131c3=_0x34e8[_0x2c0903];return _0xf131c3;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router;
\ No newline at end of file
+var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x4b4331,_0x473272){var _0x1e1b62=function(_0x50d9f6){while(--_0x50d9f6){_0x4b4331['push'](_0x4b4331['shift']());}};_0x1e1b62(++_0x473272);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router;
\ No newline at end of file
index f3b6b73..f200f98 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9cf=['sequelize','exports','STRING'];(function(_0x4d8f52,_0x5e9e52){var _0x100c8b=function(_0x532cfa){while(--_0x532cfa){_0x4d8f52['push'](_0x4d8f52['shift']());}};_0x100c8b(++_0x5e9e52);}(_0xa9cf,0xf6));var _0xfa9c=function(_0x27465e,_0x5850af){_0x27465e=_0x27465e-0x0;var _0x24d85b=_0xa9cf[_0x27465e];return _0x24d85b;};'use strict';var Sequelize=require(_0xfa9c('0x0'));module[_0xfa9c('0x1')]={'name':{'type':Sequelize[_0xfa9c('0x2')]},'description':{'type':Sequelize[_0xfa9c('0x2')]}};
\ No newline at end of file
+var _0x90de=['STRING','exports'];(function(_0x3a1190,_0x1c9117){var _0x4335d1=function(_0x102095){while(--_0x102095){_0x3a1190['push'](_0x3a1190['shift']());}};_0x4335d1(++_0x1c9117);}(_0x90de,0x169));var _0xe90d=function(_0x26f4a8,_0x9bdd19){_0x26f4a8=_0x26f4a8-0x0;var _0x2c3ad6=_0x90de[_0x26f4a8];return _0x2c3ad6;};'use strict';var Sequelize=require('sequelize');module[_0xe90d('0x0')]={'name':{'type':Sequelize[_0xe90d('0x1')]},'description':{'type':Sequelize[_0xe90d('0x1')]}};
\ No newline at end of file
index 0f2821c..d52bf79 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcf04=['../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','model','keys','query','filters','attributes','intersection','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','DeskConfiguration','includeAll','rows','catch','include','find','create','body','params','getFields','DeskField','hasOwnProperty','nolimit','findOne','getDescriptions','getTags','setTags','ids','rimraf','mustache','util','sox','to-csv','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0xcf04,0xce));var _0x4cf0=function(_0x40c7a7,_0x21a2f1){_0x40c7a7=_0x40c7a7-0x0;var _0x3e26a4=_0xcf04[_0x40c7a7];return _0x3e26a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4cf0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4cf0('0x1'));var util=require(_0x4cf0('0x2'));var path=require('path');var sox=require(_0x4cf0('0x3'));var csv=require(_0x4cf0('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4cf0('0x5'));var squel=require('squel');var crypto=require(_0x4cf0('0x6'));var jsforce=require('jsforce');var deskjs=require(_0x4cf0('0x7'));var toCsv=require(_0x4cf0('0x4'));var querystring=require('querystring');var Papa=require(_0x4cf0('0x8'));var Redis=require('ioredis');var authService=require(_0x4cf0('0x9'));var qs=require(_0x4cf0('0xa'));var as=require(_0x4cf0('0xb'));var hardwareService=require(_0x4cf0('0xc'));var logger=require(_0x4cf0('0xd'))(_0x4cf0('0xe'));var utils=require(_0x4cf0('0xf'));var config=require(_0x4cf0('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47a963,_0x163a62){_0x163a62=_0x163a62||0xcc;return function(_0xccbb6d){if(_0xccbb6d){return _0x47a963[_0x4cf0('0x11')](_0x163a62);}return _0x47a963[_0x4cf0('0x12')](_0x163a62)[_0x4cf0('0x13')]();};}function respondWithResult(_0x27258c,_0x3d04c4){_0x3d04c4=_0x3d04c4||0xc8;return function(_0x47a1d1){if(_0x47a1d1){return _0x27258c[_0x4cf0('0x12')](_0x3d04c4)[_0x4cf0('0x14')](_0x47a1d1);}};}function respondWithFilteredResult(_0x3c4ecb,_0x3ca5d9){return function(_0x406351){if(_0x406351){var _0x58df8f=typeof _0x3ca5d9[_0x4cf0('0x15')]===_0x4cf0('0x16')&&typeof _0x3ca5d9[_0x4cf0('0x17')]===_0x4cf0('0x16');var _0x57ee7f=_0x406351['count'];var _0x46a361=_0x58df8f?0x0:_0x3ca5d9[_0x4cf0('0x15')];var _0x593089=_0x58df8f?_0x406351[_0x4cf0('0x18')]:_0x3ca5d9[_0x4cf0('0x15')]+_0x3ca5d9[_0x4cf0('0x17')];var _0xda6866;if(_0x593089>=_0x57ee7f){_0x593089=_0x57ee7f;_0xda6866=0xc8;}else{_0xda6866=0xce;}_0x3c4ecb[_0x4cf0('0x12')](_0xda6866);return _0x3c4ecb[_0x4cf0('0x19')]('Content-Range',_0x46a361+'-'+_0x593089+'/'+_0x57ee7f)[_0x4cf0('0x14')](_0x406351);}return null;};}function patchUpdates(_0x34f8ae){return function(_0x508c19){try{jsonpatch[_0x4cf0('0x1a')](_0x508c19,_0x34f8ae,!![]);}catch(_0x2e2a2a){return BPromise[_0x4cf0('0x1b')](_0x2e2a2a);}return _0x508c19[_0x4cf0('0x1c')]();};}function saveUpdates(_0x1bb694,_0x4d6cf8){return function(_0x1e0085){if(_0x1e0085){return _0x1e0085[_0x4cf0('0x1d')](_0x1bb694)[_0x4cf0('0x1e')](function(_0x4cba50){return _0x4cba50;});}return null;};}function removeEntity(_0x1f1e13,_0x2dbc16){return function(_0x4b1331){if(_0x4b1331){return _0x4b1331[_0x4cf0('0x1f')]()[_0x4cf0('0x1e')](function(){_0x1f1e13[_0x4cf0('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f40fe,_0x2e9176){return function(_0x365e07){if(!_0x365e07){_0x5f40fe[_0x4cf0('0x11')](0x194);}return _0x365e07;};}function handleError(_0xff546f,_0xdf80d4){_0xdf80d4=_0xdf80d4||0x1f4;return function(_0x4d39b8){logger[_0x4cf0('0x20')](_0x4d39b8[_0x4cf0('0x21')]);if(_0x4d39b8[_0x4cf0('0x22')]){delete _0x4d39b8['name'];}_0xff546f[_0x4cf0('0x12')](_0xdf80d4)[_0x4cf0('0x23')](_0x4d39b8);};}exports[_0x4cf0('0x24')]=function(_0x45e0d6,_0x3685f9){var _0x10b1e9={},_0x109921={},_0xf9a300={'count':0x0,'rows':[]};var _0x1aa112=_[_0x4cf0('0x25')](db['DeskConfiguration'][_0x4cf0('0x26')],function(_0x18aaeb){return{'name':_0x18aaeb['fieldName'],'type':_0x18aaeb[_0x4cf0('0x27')]['key']};});_0x109921[_0x4cf0('0x28')]=_[_0x4cf0('0x25')](_0x1aa112,_0x4cf0('0x22'));_0x109921['query']=_[_0x4cf0('0x29')](_0x45e0d6[_0x4cf0('0x2a')]);_0x109921[_0x4cf0('0x2b')]=_['intersection'](_0x109921[_0x4cf0('0x28')],_0x109921[_0x4cf0('0x2a')]);_0x10b1e9[_0x4cf0('0x2c')]=_[_0x4cf0('0x2d')](_0x109921[_0x4cf0('0x28')],qs[_0x4cf0('0x2e')](_0x45e0d6[_0x4cf0('0x2a')][_0x4cf0('0x2e')]));_0x10b1e9[_0x4cf0('0x2c')]=_0x10b1e9[_0x4cf0('0x2c')][_0x4cf0('0x2f')]?_0x10b1e9[_0x4cf0('0x2c')]:_0x109921[_0x4cf0('0x28')];if(!_0x45e0d6[_0x4cf0('0x2a')]['hasOwnProperty']('nolimit')){_0x10b1e9[_0x4cf0('0x17')]=qs['limit'](_0x45e0d6[_0x4cf0('0x2a')]['limit']);_0x10b1e9[_0x4cf0('0x15')]=qs[_0x4cf0('0x15')](_0x45e0d6[_0x4cf0('0x2a')][_0x4cf0('0x15')]);}_0x10b1e9[_0x4cf0('0x30')]=qs[_0x4cf0('0x31')](_0x45e0d6[_0x4cf0('0x2a')][_0x4cf0('0x31')]);_0x10b1e9['where']=qs['filters'](_[_0x4cf0('0x32')](_0x45e0d6[_0x4cf0('0x2a')],_0x109921[_0x4cf0('0x2b')]),_0x1aa112);if(_0x45e0d6['query'][_0x4cf0('0x33')]){_0x10b1e9[_0x4cf0('0x34')]=_[_0x4cf0('0x35')](_0x10b1e9['where'],{'$or':_[_0x4cf0('0x25')](_0x1aa112,function(_0x6405a2){if(_0x6405a2['type']!==_0x4cf0('0x36')){var _0x46c0ac={};_0x46c0ac[_0x6405a2[_0x4cf0('0x22')]]={'$like':'%'+_0x45e0d6[_0x4cf0('0x2a')]['filter']+'%'};return _0x46c0ac;}})});}_0x10b1e9=_[_0x4cf0('0x35')]({},_0x10b1e9,_0x45e0d6[_0x4cf0('0x37')]);var _0x27b852={'where':_0x10b1e9[_0x4cf0('0x34')]};return db[_0x4cf0('0x38')][_0x4cf0('0x18')](_0x27b852)[_0x4cf0('0x1e')](function(_0x629719){_0xf9a300[_0x4cf0('0x18')]=_0x629719;if(_0x45e0d6[_0x4cf0('0x2a')][_0x4cf0('0x39')]){_0x10b1e9['include']=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x10b1e9);})['then'](function(_0x1547bc){_0xf9a300[_0x4cf0('0x3a')]=_0x1547bc;return _0xf9a300;})[_0x4cf0('0x1e')](respondWithFilteredResult(_0x3685f9,_0x10b1e9))[_0x4cf0('0x3b')](handleError(_0x3685f9,null));};exports['show']=function(_0x3980d3,_0x30ff68){var _0x44a735={'raw':![],'where':{'id':_0x3980d3['params']['id']}},_0x1db9a2={};_0x1db9a2[_0x4cf0('0x28')]=_[_0x4cf0('0x29')](db[_0x4cf0('0x38')][_0x4cf0('0x26')]);_0x1db9a2[_0x4cf0('0x2a')]=_[_0x4cf0('0x29')](_0x3980d3['query']);_0x1db9a2['filters']=_[_0x4cf0('0x2d')](_0x1db9a2[_0x4cf0('0x28')],_0x1db9a2[_0x4cf0('0x2a')]);_0x44a735[_0x4cf0('0x2c')]=_[_0x4cf0('0x2d')](_0x1db9a2[_0x4cf0('0x28')],qs[_0x4cf0('0x2e')](_0x3980d3[_0x4cf0('0x2a')]['fields']));_0x44a735[_0x4cf0('0x2c')]=_0x44a735[_0x4cf0('0x2c')]['length']?_0x44a735['attributes']:_0x1db9a2[_0x4cf0('0x28')];if(_0x3980d3[_0x4cf0('0x2a')][_0x4cf0('0x39')]){_0x44a735[_0x4cf0('0x3c')]=[{'all':!![]}];}_0x44a735=_['merge']({},_0x44a735,_0x3980d3[_0x4cf0('0x37')]);return db['DeskConfiguration'][_0x4cf0('0x3d')](_0x44a735)['then'](handleEntityNotFound(_0x30ff68,null))[_0x4cf0('0x1e')](respondWithResult(_0x30ff68,null))[_0x4cf0('0x3b')](handleError(_0x30ff68,null));};exports[_0x4cf0('0x3e')]=function(_0x5939f6,_0x158622){return db['DeskConfiguration']['create'](_0x5939f6[_0x4cf0('0x3f')],{})[_0x4cf0('0x1e')](respondWithResult(_0x158622,0xc9))[_0x4cf0('0x3b')](handleError(_0x158622,null));};exports[_0x4cf0('0x1d')]=function(_0x1a7594,_0x6b8e8d){if(_0x1a7594[_0x4cf0('0x3f')]['id']){delete _0x1a7594['body']['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x1a7594['params']['id']}})[_0x4cf0('0x1e')](handleEntityNotFound(_0x6b8e8d,null))[_0x4cf0('0x1e')](saveUpdates(_0x1a7594['body'],null))[_0x4cf0('0x1e')](respondWithResult(_0x6b8e8d,null))[_0x4cf0('0x3b')](handleError(_0x6b8e8d,null));};exports[_0x4cf0('0x1f')]=function(_0x687552,_0x2b82d){return db[_0x4cf0('0x38')][_0x4cf0('0x3d')]({'where':{'id':_0x687552[_0x4cf0('0x40')]['id']}})['then'](handleEntityNotFound(_0x2b82d,null))['then'](removeEntity(_0x2b82d,null))[_0x4cf0('0x3b')](handleError(_0x2b82d,null));};exports[_0x4cf0('0x41')]=function(_0x220be9,_0x235f65,_0x53d758){var _0x37f17c={};var _0x2777b9={};var _0x2f03ba;var _0x2b35f3;return db['DeskConfiguration']['findOne']({'where':{'id':_0x220be9['params']['id']}})[_0x4cf0('0x1e')](handleEntityNotFound(_0x235f65,null))[_0x4cf0('0x1e')](function(_0x38d7fe){if(_0x38d7fe){_0x2f03ba=_0x38d7fe;_0x2777b9[_0x4cf0('0x28')]=_[_0x4cf0('0x29')](db[_0x4cf0('0x42')][_0x4cf0('0x26')]);_0x2777b9[_0x4cf0('0x2a')]=_[_0x4cf0('0x29')](_0x220be9[_0x4cf0('0x2a')]);_0x2777b9[_0x4cf0('0x2b')]=_[_0x4cf0('0x2d')](_0x2777b9[_0x4cf0('0x28')],_0x2777b9[_0x4cf0('0x2a')]);_0x37f17c[_0x4cf0('0x2c')]=_['intersection'](_0x2777b9['model'],qs[_0x4cf0('0x2e')](_0x220be9['query'][_0x4cf0('0x2e')]));_0x37f17c[_0x4cf0('0x2c')]=_0x37f17c[_0x4cf0('0x2c')]['length']?_0x37f17c[_0x4cf0('0x2c')]:_0x2777b9[_0x4cf0('0x28')];_0x37f17c[_0x4cf0('0x30')]=qs[_0x4cf0('0x31')](_0x220be9[_0x4cf0('0x2a')][_0x4cf0('0x31')]);_0x37f17c['where']=qs[_0x4cf0('0x2b')](_[_0x4cf0('0x32')](_0x220be9[_0x4cf0('0x2a')],_0x2777b9[_0x4cf0('0x2b')]));if(_0x220be9[_0x4cf0('0x2a')]['filter']){_0x37f17c[_0x4cf0('0x34')]=_[_0x4cf0('0x35')](_0x37f17c['where'],{'$or':_[_0x4cf0('0x25')](_0x37f17c[_0x4cf0('0x2c')],function(_0x47d5a7){var _0x29bdab={};_0x29bdab[_0x47d5a7]={'$like':'%'+_0x220be9['query'][_0x4cf0('0x33')]+'%'};return _0x29bdab;})});}_0x37f17c=_[_0x4cf0('0x35')]({},_0x37f17c,_0x220be9['options']);return _0x2f03ba['getFields'](_0x37f17c);}})[_0x4cf0('0x1e')](function(_0x39cd0e){if(_0x39cd0e){_0x2b35f3=_0x39cd0e[_0x4cf0('0x2f')];if(!_0x220be9[_0x4cf0('0x2a')][_0x4cf0('0x43')](_0x4cf0('0x44'))){_0x37f17c[_0x4cf0('0x17')]=qs[_0x4cf0('0x17')](_0x220be9[_0x4cf0('0x2a')][_0x4cf0('0x17')]);_0x37f17c[_0x4cf0('0x15')]=qs[_0x4cf0('0x15')](_0x220be9[_0x4cf0('0x2a')][_0x4cf0('0x15')]);}return _0x2f03ba[_0x4cf0('0x41')](_0x37f17c);}})[_0x4cf0('0x1e')](function(_0x59f440){if(_0x59f440){return _0x59f440?{'count':_0x2b35f3,'rows':_0x59f440}:null;}})[_0x4cf0('0x1e')](respondWithResult(_0x235f65,null))['catch'](handleError(_0x235f65,null));};exports['getSubjects']=function(_0x5306f4,_0x13a915,_0x2c3992){var _0x256eed={};var _0x235e41={};var _0x390d89;var _0x79d452;return db[_0x4cf0('0x38')][_0x4cf0('0x45')]({'where':{'id':_0x5306f4[_0x4cf0('0x40')]['id']}})['then'](handleEntityNotFound(_0x13a915,null))[_0x4cf0('0x1e')](function(_0xf5f467){if(_0xf5f467){_0x390d89=_0xf5f467;_0x235e41[_0x4cf0('0x28')]=_[_0x4cf0('0x29')](db[_0x4cf0('0x42')][_0x4cf0('0x26')]);_0x235e41['query']=_[_0x4cf0('0x29')](_0x5306f4[_0x4cf0('0x2a')]);_0x235e41['filters']=_[_0x4cf0('0x2d')](_0x235e41[_0x4cf0('0x28')],_0x235e41[_0x4cf0('0x2a')]);_0x256eed[_0x4cf0('0x2c')]=_[_0x4cf0('0x2d')](_0x235e41[_0x4cf0('0x28')],qs[_0x4cf0('0x2e')](_0x5306f4[_0x4cf0('0x2a')]['fields']));_0x256eed[_0x4cf0('0x2c')]=_0x256eed[_0x4cf0('0x2c')][_0x4cf0('0x2f')]?_0x256eed['attributes']:_0x235e41[_0x4cf0('0x28')];_0x256eed['order']=qs[_0x4cf0('0x31')](_0x5306f4[_0x4cf0('0x2a')][_0x4cf0('0x31')]);_0x256eed['where']=qs[_0x4cf0('0x2b')](_[_0x4cf0('0x32')](_0x5306f4['query'],_0x235e41['filters']));if(_0x5306f4[_0x4cf0('0x2a')][_0x4cf0('0x33')]){_0x256eed[_0x4cf0('0x34')]=_[_0x4cf0('0x35')](_0x256eed[_0x4cf0('0x34')],{'$or':_[_0x4cf0('0x25')](_0x256eed[_0x4cf0('0x2c')],function(_0x21c77a){var _0x9b4ff4={};_0x9b4ff4[_0x21c77a]={'$like':'%'+_0x5306f4['query'][_0x4cf0('0x33')]+'%'};return _0x9b4ff4;})});}_0x256eed=_[_0x4cf0('0x35')]({},_0x256eed,_0x5306f4[_0x4cf0('0x37')]);return _0x390d89['getSubjects'](_0x256eed);}})[_0x4cf0('0x1e')](function(_0x2c0801){if(_0x2c0801){_0x79d452=_0x2c0801[_0x4cf0('0x2f')];if(!_0x5306f4[_0x4cf0('0x2a')]['hasOwnProperty']('nolimit')){_0x256eed['limit']=qs['limit'](_0x5306f4['query'][_0x4cf0('0x17')]);_0x256eed[_0x4cf0('0x15')]=qs[_0x4cf0('0x15')](_0x5306f4[_0x4cf0('0x2a')]['offset']);}return _0x390d89['getSubjects'](_0x256eed);}})[_0x4cf0('0x1e')](function(_0x283226){if(_0x283226){return _0x283226?{'count':_0x79d452,'rows':_0x283226}:null;}})[_0x4cf0('0x1e')](respondWithResult(_0x13a915,null))[_0x4cf0('0x3b')](handleError(_0x13a915,null));};exports['getDescriptions']=function(_0x21e1a4,_0x583666,_0x3dbb35){var _0x1509a0={};var _0xf56bef={};var _0x3f3e7b;var _0x29aaab;return db[_0x4cf0('0x38')]['findOne']({'where':{'id':_0x21e1a4[_0x4cf0('0x40')]['id']}})[_0x4cf0('0x1e')](handleEntityNotFound(_0x583666,null))[_0x4cf0('0x1e')](function(_0x583672){if(_0x583672){_0x3f3e7b=_0x583672;_0xf56bef[_0x4cf0('0x28')]=_[_0x4cf0('0x29')](db[_0x4cf0('0x42')][_0x4cf0('0x26')]);_0xf56bef['query']=_['keys'](_0x21e1a4[_0x4cf0('0x2a')]);_0xf56bef[_0x4cf0('0x2b')]=_['intersection'](_0xf56bef[_0x4cf0('0x28')],_0xf56bef['query']);_0x1509a0[_0x4cf0('0x2c')]=_['intersection'](_0xf56bef[_0x4cf0('0x28')],qs['fields'](_0x21e1a4[_0x4cf0('0x2a')]['fields']));_0x1509a0[_0x4cf0('0x2c')]=_0x1509a0['attributes'][_0x4cf0('0x2f')]?_0x1509a0[_0x4cf0('0x2c')]:_0xf56bef[_0x4cf0('0x28')];_0x1509a0['order']=qs[_0x4cf0('0x31')](_0x21e1a4[_0x4cf0('0x2a')]['sort']);_0x1509a0['where']=qs[_0x4cf0('0x2b')](_['pick'](_0x21e1a4[_0x4cf0('0x2a')],_0xf56bef[_0x4cf0('0x2b')]));if(_0x21e1a4[_0x4cf0('0x2a')][_0x4cf0('0x33')]){_0x1509a0[_0x4cf0('0x34')]=_[_0x4cf0('0x35')](_0x1509a0[_0x4cf0('0x34')],{'$or':_[_0x4cf0('0x25')](_0x1509a0[_0x4cf0('0x2c')],function(_0x29f9e0){var _0x2313f6={};_0x2313f6[_0x29f9e0]={'$like':'%'+_0x21e1a4[_0x4cf0('0x2a')][_0x4cf0('0x33')]+'%'};return _0x2313f6;})});}_0x1509a0=_[_0x4cf0('0x35')]({},_0x1509a0,_0x21e1a4['options']);return _0x3f3e7b[_0x4cf0('0x46')](_0x1509a0);}})[_0x4cf0('0x1e')](function(_0x30cbae){if(_0x30cbae){_0x29aaab=_0x30cbae[_0x4cf0('0x2f')];if(!_0x21e1a4['query'][_0x4cf0('0x43')](_0x4cf0('0x44'))){_0x1509a0['limit']=qs[_0x4cf0('0x17')](_0x21e1a4[_0x4cf0('0x2a')][_0x4cf0('0x17')]);_0x1509a0[_0x4cf0('0x15')]=qs[_0x4cf0('0x15')](_0x21e1a4[_0x4cf0('0x2a')]['offset']);}return _0x3f3e7b['getDescriptions'](_0x1509a0);}})[_0x4cf0('0x1e')](function(_0x22a602){if(_0x22a602){return _0x22a602?{'count':_0x29aaab,'rows':_0x22a602}:null;}})['then'](respondWithResult(_0x583666,null))[_0x4cf0('0x3b')](handleError(_0x583666,null));};exports[_0x4cf0('0x47')]=function(_0x2dd590,_0x25c107,_0x86fe4c){var _0x424bfc={};var _0x314f76={};var _0x54d182;var _0x31f65e;return db[_0x4cf0('0x38')]['findOne']({'where':{'id':_0x2dd590[_0x4cf0('0x40')]['id']}})[_0x4cf0('0x1e')](handleEntityNotFound(_0x25c107,null))['then'](function(_0x46bd26){if(_0x46bd26){_0x54d182=_0x46bd26;_0x314f76['model']=_[_0x4cf0('0x29')](db['Tag']['rawAttributes']);_0x314f76[_0x4cf0('0x2a')]=_['keys'](_0x2dd590[_0x4cf0('0x2a')]);_0x314f76[_0x4cf0('0x2b')]=_[_0x4cf0('0x2d')](_0x314f76[_0x4cf0('0x28')],_0x314f76[_0x4cf0('0x2a')]);_0x424bfc['attributes']=_['intersection'](_0x314f76[_0x4cf0('0x28')],qs[_0x4cf0('0x2e')](_0x2dd590[_0x4cf0('0x2a')][_0x4cf0('0x2e')]));_0x424bfc[_0x4cf0('0x2c')]=_0x424bfc[_0x4cf0('0x2c')][_0x4cf0('0x2f')]?_0x424bfc['attributes']:_0x314f76[_0x4cf0('0x28')];_0x424bfc['order']=qs[_0x4cf0('0x31')](_0x2dd590[_0x4cf0('0x2a')][_0x4cf0('0x31')]);_0x424bfc[_0x4cf0('0x34')]=qs[_0x4cf0('0x2b')](_['pick'](_0x2dd590['query'],_0x314f76[_0x4cf0('0x2b')]));if(_0x2dd590[_0x4cf0('0x2a')]['filter']){_0x424bfc[_0x4cf0('0x34')]=_['merge'](_0x424bfc[_0x4cf0('0x34')],{'$or':_['map'](_0x424bfc[_0x4cf0('0x2c')],function(_0x1f2205){var _0x1f6633={};_0x1f6633[_0x1f2205]={'$like':'%'+_0x2dd590[_0x4cf0('0x2a')][_0x4cf0('0x33')]+'%'};return _0x1f6633;})});}_0x424bfc=_[_0x4cf0('0x35')]({},_0x424bfc,_0x2dd590[_0x4cf0('0x37')]);return _0x54d182[_0x4cf0('0x47')](_0x424bfc);}})[_0x4cf0('0x1e')](function(_0x48e504){if(_0x48e504){_0x31f65e=_0x48e504[_0x4cf0('0x2f')];if(!_0x2dd590[_0x4cf0('0x2a')]['hasOwnProperty'](_0x4cf0('0x44'))){_0x424bfc['limit']=qs['limit'](_0x2dd590[_0x4cf0('0x2a')]['limit']);_0x424bfc[_0x4cf0('0x15')]=qs[_0x4cf0('0x15')](_0x2dd590['query']['offset']);}return _0x54d182[_0x4cf0('0x47')](_0x424bfc);}})[_0x4cf0('0x1e')](function(_0x1d1610){if(_0x1d1610){return _0x1d1610?{'count':_0x31f65e,'rows':_0x1d1610}:null;}})[_0x4cf0('0x1e')](respondWithResult(_0x25c107,null))[_0x4cf0('0x3b')](handleError(_0x25c107,null));};exports[_0x4cf0('0x48')]=function(_0xfe2c3b,_0x11b6a0,_0x55e1ea){if(_0xfe2c3b['body']['id']){delete _0xfe2c3b[_0x4cf0('0x3f')]['id'];}return db['DeskConfiguration'][_0x4cf0('0x45')]({'where':{'id':_0xfe2c3b[_0x4cf0('0x40')]['id']}})['then'](handleEntityNotFound(_0x11b6a0,null))[_0x4cf0('0x1e')](function(_0x1e78fc){if(_0x1e78fc){return _0x1e78fc['setTags'](_0xfe2c3b['body'][_0x4cf0('0x49')]||[]);}return null;})[_0x4cf0('0x1e')](respondWithResult(_0x11b6a0,null))[_0x4cf0('0x3b')](handleError(_0x11b6a0,null));};
\ No newline at end of file
+var _0xec40=['options','includeAll','include','DeskConfiguration','findAll','rows','catch','show','params','keys','find','create','body','update','getFields','pick','length','getSubjects','findOne','DeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','then','destroy','end','error','stack','name','send','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL'];(function(_0x3e61d4,_0x224d2d){var _0x40bd4e=function(_0x21432f){while(--_0x21432f){_0x3e61d4['push'](_0x3e61d4['shift']());}};_0x40bd4e(++_0x224d2d);}(_0xec40,0xbd));var _0x0ec4=function(_0x18fe54,_0xff789){_0x18fe54=_0x18fe54-0x0;var _0xccb1ee=_0xec40[_0x18fe54];return _0xccb1ee;};'use strict';var emlformat=require(_0x0ec4('0x0'));var rimraf=require(_0x0ec4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ec4('0x2'));var rp=require(_0x0ec4('0x3'));var moment=require(_0x0ec4('0x4'));var BPromise=require(_0x0ec4('0x5'));var Mustache=require(_0x0ec4('0x6'));var util=require('util');var path=require(_0x0ec4('0x7'));var sox=require(_0x0ec4('0x8'));var csv=require(_0x0ec4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ec4('0xa'));var _=require(_0x0ec4('0xb'));var squel=require(_0x0ec4('0xc'));var crypto=require(_0x0ec4('0xd'));var jsforce=require(_0x0ec4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0ec4('0x9'));var querystring=require('querystring');var Papa=require(_0x0ec4('0xf'));var Redis=require(_0x0ec4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0ec4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ec4('0x12'));var logger=require(_0x0ec4('0x13'))(_0x0ec4('0x14'));var utils=require('../../config/utils');var config=require(_0x0ec4('0x15'));var licenseUtil=require(_0x0ec4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5985fe,_0x10d51d){_0x10d51d=_0x10d51d||0xcc;return function(_0x3250fd){if(_0x3250fd){return _0x5985fe[_0x0ec4('0x17')](_0x10d51d);}return _0x5985fe[_0x0ec4('0x18')](_0x10d51d)['end']();};}function respondWithResult(_0x4fffc7,_0x1a6677){_0x1a6677=_0x1a6677||0xc8;return function(_0xab76c5){if(_0xab76c5){return _0x4fffc7[_0x0ec4('0x18')](_0x1a6677)[_0x0ec4('0x19')](_0xab76c5);}};}function respondWithFilteredResult(_0xcc979b,_0x4479d5){return function(_0x18155e){if(_0x18155e){var _0x1d2729=typeof _0x4479d5['offset']==='undefined'&&typeof _0x4479d5['limit']===_0x0ec4('0x1a');var _0x37c4cf=_0x18155e[_0x0ec4('0x1b')];var _0x826877=_0x1d2729?0x0:_0x4479d5[_0x0ec4('0x1c')];var _0xce3f3b=_0x1d2729?_0x18155e[_0x0ec4('0x1b')]:_0x4479d5[_0x0ec4('0x1c')]+_0x4479d5[_0x0ec4('0x1d')];var _0x33270d;if(_0xce3f3b>=_0x37c4cf){_0xce3f3b=_0x37c4cf;_0x33270d=0xc8;}else{_0x33270d=0xce;}_0xcc979b[_0x0ec4('0x18')](_0x33270d);return _0xcc979b['set'](_0x0ec4('0x1e'),_0x826877+'-'+_0xce3f3b+'/'+_0x37c4cf)[_0x0ec4('0x19')](_0x18155e);}return null;};}function patchUpdates(_0x248245){return function(_0x148646){try{jsonpatch[_0x0ec4('0x1f')](_0x148646,_0x248245,!![]);}catch(_0x220f6b){return BPromise['reject'](_0x220f6b);}return _0x148646['save']();};}function saveUpdates(_0x5f322c,_0x443e46){return function(_0x5e4e13){if(_0x5e4e13){return _0x5e4e13['update'](_0x5f322c)[_0x0ec4('0x20')](function(_0x285a6c){return _0x285a6c;});}return null;};}function removeEntity(_0x56f302,_0x351662){return function(_0x37088f){if(_0x37088f){return _0x37088f[_0x0ec4('0x21')]()[_0x0ec4('0x20')](function(){_0x56f302[_0x0ec4('0x18')](0xcc)[_0x0ec4('0x22')]();});}};}function handleEntityNotFound(_0x1cdc06,_0x224d1d){return function(_0x1825e4){if(!_0x1825e4){_0x1cdc06[_0x0ec4('0x17')](0x194);}return _0x1825e4;};}function handleError(_0x2e48bc,_0x46d24b){_0x46d24b=_0x46d24b||0x1f4;return function(_0x5ff835){logger[_0x0ec4('0x23')](_0x5ff835[_0x0ec4('0x24')]);if(_0x5ff835[_0x0ec4('0x25')]){delete _0x5ff835[_0x0ec4('0x25')];}_0x2e48bc['status'](_0x46d24b)[_0x0ec4('0x26')](_0x5ff835);};}exports['index']=function(_0x5ddd8a,_0x4c194e){var _0x305285={},_0x4f0497={},_0x449495={'count':0x0,'rows':[]};var _0x3a00d7=_['map'](db['DeskConfiguration'][_0x0ec4('0x27')],function(_0x4fcc4a){return{'name':_0x4fcc4a['fieldName'],'type':_0x4fcc4a[_0x0ec4('0x28')][_0x0ec4('0x29')]};});_0x4f0497[_0x0ec4('0x2a')]=_[_0x0ec4('0x2b')](_0x3a00d7,_0x0ec4('0x25'));_0x4f0497[_0x0ec4('0x2c')]=_['keys'](_0x5ddd8a['query']);_0x4f0497[_0x0ec4('0x2d')]=_[_0x0ec4('0x2e')](_0x4f0497[_0x0ec4('0x2a')],_0x4f0497[_0x0ec4('0x2c')]);_0x305285[_0x0ec4('0x2f')]=_[_0x0ec4('0x2e')](_0x4f0497[_0x0ec4('0x2a')],qs['fields'](_0x5ddd8a[_0x0ec4('0x2c')][_0x0ec4('0x30')]));_0x305285[_0x0ec4('0x2f')]=_0x305285['attributes']['length']?_0x305285[_0x0ec4('0x2f')]:_0x4f0497['model'];if(!_0x5ddd8a[_0x0ec4('0x2c')][_0x0ec4('0x31')](_0x0ec4('0x32'))){_0x305285[_0x0ec4('0x1d')]=qs['limit'](_0x5ddd8a[_0x0ec4('0x2c')][_0x0ec4('0x1d')]);_0x305285[_0x0ec4('0x1c')]=qs[_0x0ec4('0x1c')](_0x5ddd8a[_0x0ec4('0x2c')][_0x0ec4('0x1c')]);}_0x305285[_0x0ec4('0x33')]=qs['sort'](_0x5ddd8a[_0x0ec4('0x2c')][_0x0ec4('0x34')]);_0x305285[_0x0ec4('0x35')]=qs[_0x0ec4('0x2d')](_['pick'](_0x5ddd8a[_0x0ec4('0x2c')],_0x4f0497[_0x0ec4('0x2d')]),_0x3a00d7);if(_0x5ddd8a[_0x0ec4('0x2c')][_0x0ec4('0x36')]){_0x305285[_0x0ec4('0x35')]=_[_0x0ec4('0x37')](_0x305285[_0x0ec4('0x35')],{'$or':_[_0x0ec4('0x2b')](_0x3a00d7,function(_0x57595d){if(_0x57595d[_0x0ec4('0x28')]!==_0x0ec4('0x38')){var _0x4b9488={};_0x4b9488[_0x57595d[_0x0ec4('0x25')]]={'$like':'%'+_0x5ddd8a[_0x0ec4('0x2c')][_0x0ec4('0x36')]+'%'};return _0x4b9488;}})});}_0x305285=_['merge']({},_0x305285,_0x5ddd8a[_0x0ec4('0x39')]);var _0x46f9b0={'where':_0x305285[_0x0ec4('0x35')]};return db['DeskConfiguration'][_0x0ec4('0x1b')](_0x46f9b0)[_0x0ec4('0x20')](function(_0x4e9b60){_0x449495[_0x0ec4('0x1b')]=_0x4e9b60;if(_0x5ddd8a[_0x0ec4('0x2c')][_0x0ec4('0x3a')]){_0x305285[_0x0ec4('0x3b')]=[{'all':!![]}];}return db[_0x0ec4('0x3c')][_0x0ec4('0x3d')](_0x305285);})[_0x0ec4('0x20')](function(_0x184607){_0x449495[_0x0ec4('0x3e')]=_0x184607;return _0x449495;})[_0x0ec4('0x20')](respondWithFilteredResult(_0x4c194e,_0x305285))[_0x0ec4('0x3f')](handleError(_0x4c194e,null));};exports[_0x0ec4('0x40')]=function(_0x1c5dd5,_0x2a54a1){var _0x5f43c1={'raw':![],'where':{'id':_0x1c5dd5[_0x0ec4('0x41')]['id']}},_0x5b6a1a={};_0x5b6a1a[_0x0ec4('0x2a')]=_[_0x0ec4('0x42')](db[_0x0ec4('0x3c')][_0x0ec4('0x27')]);_0x5b6a1a[_0x0ec4('0x2c')]=_[_0x0ec4('0x42')](_0x1c5dd5[_0x0ec4('0x2c')]);_0x5b6a1a['filters']=_[_0x0ec4('0x2e')](_0x5b6a1a['model'],_0x5b6a1a['query']);_0x5f43c1[_0x0ec4('0x2f')]=_[_0x0ec4('0x2e')](_0x5b6a1a[_0x0ec4('0x2a')],qs[_0x0ec4('0x30')](_0x1c5dd5['query'][_0x0ec4('0x30')]));_0x5f43c1[_0x0ec4('0x2f')]=_0x5f43c1['attributes']['length']?_0x5f43c1['attributes']:_0x5b6a1a['model'];if(_0x1c5dd5[_0x0ec4('0x2c')][_0x0ec4('0x3a')]){_0x5f43c1[_0x0ec4('0x3b')]=[{'all':!![]}];}_0x5f43c1=_[_0x0ec4('0x37')]({},_0x5f43c1,_0x1c5dd5[_0x0ec4('0x39')]);return db[_0x0ec4('0x3c')][_0x0ec4('0x43')](_0x5f43c1)[_0x0ec4('0x20')](handleEntityNotFound(_0x2a54a1,null))[_0x0ec4('0x20')](respondWithResult(_0x2a54a1,null))['catch'](handleError(_0x2a54a1,null));};exports[_0x0ec4('0x44')]=function(_0x5b6347,_0x4b2bbf){return db[_0x0ec4('0x3c')][_0x0ec4('0x44')](_0x5b6347[_0x0ec4('0x45')],{})[_0x0ec4('0x20')](respondWithResult(_0x4b2bbf,0xc9))[_0x0ec4('0x3f')](handleError(_0x4b2bbf,null));};exports[_0x0ec4('0x46')]=function(_0x5e2751,_0x13cb25){if(_0x5e2751[_0x0ec4('0x45')]['id']){delete _0x5e2751['body']['id'];}return db['DeskConfiguration'][_0x0ec4('0x43')]({'where':{'id':_0x5e2751[_0x0ec4('0x41')]['id']}})[_0x0ec4('0x20')](handleEntityNotFound(_0x13cb25,null))[_0x0ec4('0x20')](saveUpdates(_0x5e2751[_0x0ec4('0x45')],null))['then'](respondWithResult(_0x13cb25,null))[_0x0ec4('0x3f')](handleError(_0x13cb25,null));};exports[_0x0ec4('0x21')]=function(_0x4cc552,_0x12b984){return db[_0x0ec4('0x3c')][_0x0ec4('0x43')]({'where':{'id':_0x4cc552[_0x0ec4('0x41')]['id']}})[_0x0ec4('0x20')](handleEntityNotFound(_0x12b984,null))['then'](removeEntity(_0x12b984,null))[_0x0ec4('0x3f')](handleError(_0x12b984,null));};exports[_0x0ec4('0x47')]=function(_0x4a538d,_0x42e887,_0x5444f4){var _0x35531b={};var _0x5c3d8d={};var _0x4106e5;var _0x4cafec;return db['DeskConfiguration']['findOne']({'where':{'id':_0x4a538d[_0x0ec4('0x41')]['id']}})[_0x0ec4('0x20')](handleEntityNotFound(_0x42e887,null))[_0x0ec4('0x20')](function(_0x20607c){if(_0x20607c){_0x4106e5=_0x20607c;_0x5c3d8d[_0x0ec4('0x2a')]=_[_0x0ec4('0x42')](db['DeskField'][_0x0ec4('0x27')]);_0x5c3d8d[_0x0ec4('0x2c')]=_[_0x0ec4('0x42')](_0x4a538d[_0x0ec4('0x2c')]);_0x5c3d8d[_0x0ec4('0x2d')]=_[_0x0ec4('0x2e')](_0x5c3d8d[_0x0ec4('0x2a')],_0x5c3d8d[_0x0ec4('0x2c')]);_0x35531b[_0x0ec4('0x2f')]=_[_0x0ec4('0x2e')](_0x5c3d8d[_0x0ec4('0x2a')],qs[_0x0ec4('0x30')](_0x4a538d[_0x0ec4('0x2c')][_0x0ec4('0x30')]));_0x35531b[_0x0ec4('0x2f')]=_0x35531b[_0x0ec4('0x2f')]['length']?_0x35531b[_0x0ec4('0x2f')]:_0x5c3d8d[_0x0ec4('0x2a')];_0x35531b[_0x0ec4('0x33')]=qs[_0x0ec4('0x34')](_0x4a538d['query']['sort']);_0x35531b[_0x0ec4('0x35')]=qs['filters'](_[_0x0ec4('0x48')](_0x4a538d[_0x0ec4('0x2c')],_0x5c3d8d[_0x0ec4('0x2d')]));if(_0x4a538d[_0x0ec4('0x2c')][_0x0ec4('0x36')]){_0x35531b[_0x0ec4('0x35')]=_[_0x0ec4('0x37')](_0x35531b[_0x0ec4('0x35')],{'$or':_[_0x0ec4('0x2b')](_0x35531b[_0x0ec4('0x2f')],function(_0x1ec103){var _0x545bee={};_0x545bee[_0x1ec103]={'$like':'%'+_0x4a538d[_0x0ec4('0x2c')][_0x0ec4('0x36')]+'%'};return _0x545bee;})});}_0x35531b=_[_0x0ec4('0x37')]({},_0x35531b,_0x4a538d[_0x0ec4('0x39')]);return _0x4106e5[_0x0ec4('0x47')](_0x35531b);}})[_0x0ec4('0x20')](function(_0x3c6eff){if(_0x3c6eff){_0x4cafec=_0x3c6eff[_0x0ec4('0x49')];if(!_0x4a538d[_0x0ec4('0x2c')][_0x0ec4('0x31')]('nolimit')){_0x35531b[_0x0ec4('0x1d')]=qs[_0x0ec4('0x1d')](_0x4a538d[_0x0ec4('0x2c')][_0x0ec4('0x1d')]);_0x35531b[_0x0ec4('0x1c')]=qs[_0x0ec4('0x1c')](_0x4a538d[_0x0ec4('0x2c')][_0x0ec4('0x1c')]);}return _0x4106e5[_0x0ec4('0x47')](_0x35531b);}})[_0x0ec4('0x20')](function(_0x3b613d){if(_0x3b613d){return _0x3b613d?{'count':_0x4cafec,'rows':_0x3b613d}:null;}})[_0x0ec4('0x20')](respondWithResult(_0x42e887,null))['catch'](handleError(_0x42e887,null));};exports[_0x0ec4('0x4a')]=function(_0xa65a2a,_0x4dcfba,_0x50bf50){var _0x9e1f44={};var _0xee5cb4={};var _0x2e7362;var _0x310e5d;return db[_0x0ec4('0x3c')][_0x0ec4('0x4b')]({'where':{'id':_0xa65a2a[_0x0ec4('0x41')]['id']}})['then'](handleEntityNotFound(_0x4dcfba,null))[_0x0ec4('0x20')](function(_0x3c4272){if(_0x3c4272){_0x2e7362=_0x3c4272;_0xee5cb4[_0x0ec4('0x2a')]=_[_0x0ec4('0x42')](db[_0x0ec4('0x4c')][_0x0ec4('0x27')]);_0xee5cb4[_0x0ec4('0x2c')]=_['keys'](_0xa65a2a[_0x0ec4('0x2c')]);_0xee5cb4['filters']=_[_0x0ec4('0x2e')](_0xee5cb4['model'],_0xee5cb4['query']);_0x9e1f44['attributes']=_[_0x0ec4('0x2e')](_0xee5cb4[_0x0ec4('0x2a')],qs['fields'](_0xa65a2a[_0x0ec4('0x2c')]['fields']));_0x9e1f44[_0x0ec4('0x2f')]=_0x9e1f44['attributes'][_0x0ec4('0x49')]?_0x9e1f44[_0x0ec4('0x2f')]:_0xee5cb4[_0x0ec4('0x2a')];_0x9e1f44[_0x0ec4('0x33')]=qs[_0x0ec4('0x34')](_0xa65a2a['query'][_0x0ec4('0x34')]);_0x9e1f44[_0x0ec4('0x35')]=qs[_0x0ec4('0x2d')](_[_0x0ec4('0x48')](_0xa65a2a[_0x0ec4('0x2c')],_0xee5cb4[_0x0ec4('0x2d')]));if(_0xa65a2a[_0x0ec4('0x2c')][_0x0ec4('0x36')]){_0x9e1f44[_0x0ec4('0x35')]=_[_0x0ec4('0x37')](_0x9e1f44[_0x0ec4('0x35')],{'$or':_['map'](_0x9e1f44[_0x0ec4('0x2f')],function(_0x4d80ca){var _0x1a7e51={};_0x1a7e51[_0x4d80ca]={'$like':'%'+_0xa65a2a[_0x0ec4('0x2c')][_0x0ec4('0x36')]+'%'};return _0x1a7e51;})});}_0x9e1f44=_[_0x0ec4('0x37')]({},_0x9e1f44,_0xa65a2a[_0x0ec4('0x39')]);return _0x2e7362[_0x0ec4('0x4a')](_0x9e1f44);}})[_0x0ec4('0x20')](function(_0x10cb5c){if(_0x10cb5c){_0x310e5d=_0x10cb5c[_0x0ec4('0x49')];if(!_0xa65a2a[_0x0ec4('0x2c')][_0x0ec4('0x31')](_0x0ec4('0x32'))){_0x9e1f44['limit']=qs['limit'](_0xa65a2a['query'][_0x0ec4('0x1d')]);_0x9e1f44[_0x0ec4('0x1c')]=qs[_0x0ec4('0x1c')](_0xa65a2a[_0x0ec4('0x2c')][_0x0ec4('0x1c')]);}return _0x2e7362[_0x0ec4('0x4a')](_0x9e1f44);}})[_0x0ec4('0x20')](function(_0x4f7cd2){if(_0x4f7cd2){return _0x4f7cd2?{'count':_0x310e5d,'rows':_0x4f7cd2}:null;}})[_0x0ec4('0x20')](respondWithResult(_0x4dcfba,null))[_0x0ec4('0x3f')](handleError(_0x4dcfba,null));};exports['getDescriptions']=function(_0x27da5b,_0xc458d8,_0xe1c3ab){var _0x2f7e13={};var _0x172695={};var _0x1597e4;var _0x48ee44;return db['DeskConfiguration']['findOne']({'where':{'id':_0x27da5b[_0x0ec4('0x41')]['id']}})[_0x0ec4('0x20')](handleEntityNotFound(_0xc458d8,null))[_0x0ec4('0x20')](function(_0x2523e7){if(_0x2523e7){_0x1597e4=_0x2523e7;_0x172695[_0x0ec4('0x2a')]=_[_0x0ec4('0x42')](db['DeskField'][_0x0ec4('0x27')]);_0x172695[_0x0ec4('0x2c')]=_[_0x0ec4('0x42')](_0x27da5b[_0x0ec4('0x2c')]);_0x172695[_0x0ec4('0x2d')]=_[_0x0ec4('0x2e')](_0x172695[_0x0ec4('0x2a')],_0x172695[_0x0ec4('0x2c')]);_0x2f7e13[_0x0ec4('0x2f')]=_['intersection'](_0x172695[_0x0ec4('0x2a')],qs[_0x0ec4('0x30')](_0x27da5b[_0x0ec4('0x2c')][_0x0ec4('0x30')]));_0x2f7e13[_0x0ec4('0x2f')]=_0x2f7e13['attributes'][_0x0ec4('0x49')]?_0x2f7e13[_0x0ec4('0x2f')]:_0x172695[_0x0ec4('0x2a')];_0x2f7e13[_0x0ec4('0x33')]=qs[_0x0ec4('0x34')](_0x27da5b[_0x0ec4('0x2c')][_0x0ec4('0x34')]);_0x2f7e13[_0x0ec4('0x35')]=qs[_0x0ec4('0x2d')](_[_0x0ec4('0x48')](_0x27da5b[_0x0ec4('0x2c')],_0x172695[_0x0ec4('0x2d')]));if(_0x27da5b['query'][_0x0ec4('0x36')]){_0x2f7e13['where']=_[_0x0ec4('0x37')](_0x2f7e13[_0x0ec4('0x35')],{'$or':_['map'](_0x2f7e13[_0x0ec4('0x2f')],function(_0x1a1ec5){var _0x1933e5={};_0x1933e5[_0x1a1ec5]={'$like':'%'+_0x27da5b[_0x0ec4('0x2c')][_0x0ec4('0x36')]+'%'};return _0x1933e5;})});}_0x2f7e13=_['merge']({},_0x2f7e13,_0x27da5b[_0x0ec4('0x39')]);return _0x1597e4[_0x0ec4('0x4d')](_0x2f7e13);}})['then'](function(_0x230765){if(_0x230765){_0x48ee44=_0x230765[_0x0ec4('0x49')];if(!_0x27da5b[_0x0ec4('0x2c')][_0x0ec4('0x31')](_0x0ec4('0x32'))){_0x2f7e13['limit']=qs[_0x0ec4('0x1d')](_0x27da5b['query'][_0x0ec4('0x1d')]);_0x2f7e13[_0x0ec4('0x1c')]=qs['offset'](_0x27da5b[_0x0ec4('0x2c')][_0x0ec4('0x1c')]);}return _0x1597e4['getDescriptions'](_0x2f7e13);}})['then'](function(_0x5c893c){if(_0x5c893c){return _0x5c893c?{'count':_0x48ee44,'rows':_0x5c893c}:null;}})[_0x0ec4('0x20')](respondWithResult(_0xc458d8,null))[_0x0ec4('0x3f')](handleError(_0xc458d8,null));};exports[_0x0ec4('0x4e')]=function(_0x38a145,_0x356a66,_0x612157){var _0x427df0={};var _0x10f22e={};var _0x2bab7d;var _0x3f17c3;return db[_0x0ec4('0x3c')][_0x0ec4('0x4b')]({'where':{'id':_0x38a145[_0x0ec4('0x41')]['id']}})[_0x0ec4('0x20')](handleEntityNotFound(_0x356a66,null))[_0x0ec4('0x20')](function(_0x27d5f8){if(_0x27d5f8){_0x2bab7d=_0x27d5f8;_0x10f22e[_0x0ec4('0x2a')]=_[_0x0ec4('0x42')](db[_0x0ec4('0x4f')][_0x0ec4('0x27')]);_0x10f22e[_0x0ec4('0x2c')]=_[_0x0ec4('0x42')](_0x38a145[_0x0ec4('0x2c')]);_0x10f22e[_0x0ec4('0x2d')]=_['intersection'](_0x10f22e[_0x0ec4('0x2a')],_0x10f22e[_0x0ec4('0x2c')]);_0x427df0[_0x0ec4('0x2f')]=_[_0x0ec4('0x2e')](_0x10f22e[_0x0ec4('0x2a')],qs['fields'](_0x38a145[_0x0ec4('0x2c')]['fields']));_0x427df0[_0x0ec4('0x2f')]=_0x427df0[_0x0ec4('0x2f')][_0x0ec4('0x49')]?_0x427df0[_0x0ec4('0x2f')]:_0x10f22e[_0x0ec4('0x2a')];_0x427df0[_0x0ec4('0x33')]=qs['sort'](_0x38a145[_0x0ec4('0x2c')][_0x0ec4('0x34')]);_0x427df0['where']=qs[_0x0ec4('0x2d')](_['pick'](_0x38a145[_0x0ec4('0x2c')],_0x10f22e['filters']));if(_0x38a145['query'][_0x0ec4('0x36')]){_0x427df0['where']=_[_0x0ec4('0x37')](_0x427df0[_0x0ec4('0x35')],{'$or':_[_0x0ec4('0x2b')](_0x427df0[_0x0ec4('0x2f')],function(_0x16a10f){var _0xb9cd04={};_0xb9cd04[_0x16a10f]={'$like':'%'+_0x38a145[_0x0ec4('0x2c')][_0x0ec4('0x36')]+'%'};return _0xb9cd04;})});}_0x427df0=_[_0x0ec4('0x37')]({},_0x427df0,_0x38a145[_0x0ec4('0x39')]);return _0x2bab7d[_0x0ec4('0x4e')](_0x427df0);}})[_0x0ec4('0x20')](function(_0x1f5ec8){if(_0x1f5ec8){_0x3f17c3=_0x1f5ec8[_0x0ec4('0x49')];if(!_0x38a145[_0x0ec4('0x2c')][_0x0ec4('0x31')](_0x0ec4('0x32'))){_0x427df0[_0x0ec4('0x1d')]=qs['limit'](_0x38a145['query']['limit']);_0x427df0[_0x0ec4('0x1c')]=qs[_0x0ec4('0x1c')](_0x38a145[_0x0ec4('0x2c')][_0x0ec4('0x1c')]);}return _0x2bab7d['getTags'](_0x427df0);}})[_0x0ec4('0x20')](function(_0x3f6041){if(_0x3f6041){return _0x3f6041?{'count':_0x3f17c3,'rows':_0x3f6041}:null;}})[_0x0ec4('0x20')](respondWithResult(_0x356a66,null))[_0x0ec4('0x3f')](handleError(_0x356a66,null));};exports[_0x0ec4('0x50')]=function(_0x5eb560,_0x8d526d,_0x3e946d){if(_0x5eb560[_0x0ec4('0x45')]['id']){delete _0x5eb560[_0x0ec4('0x45')]['id'];}return db[_0x0ec4('0x3c')]['findOne']({'where':{'id':_0x5eb560[_0x0ec4('0x41')]['id']}})['then'](handleEntityNotFound(_0x8d526d,null))[_0x0ec4('0x20')](function(_0x3a53ed){if(_0x3a53ed){return _0x3a53ed['setTags'](_0x5eb560[_0x0ec4('0x45')][_0x0ec4('0x51')]||[]);}return null;})[_0x0ec4('0x20')](respondWithResult(_0x8d526d,null))[_0x0ec4('0x3f')](handleError(_0x8d526d,null));};
\ No newline at end of file
index 4545d98..63c36e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8d39=['define','DeskConfiguration','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x42a9b9,_0x57359c){var _0x5bdc00=function(_0x244858){while(--_0x244858){_0x42a9b9['push'](_0x42a9b9['shift']());}};_0x5bdc00(++_0x57359c);}(_0x8d39,0x120));var _0x98d3=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x8d39[_0x119280];return _0x481797;};'use strict';var _=require(_0x98d3('0x0'));var util=require(_0x98d3('0x1'));var logger=require(_0x98d3('0x2'))(_0x98d3('0x3'));var moment=require('moment');var BPromise=require(_0x98d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x98d3('0x5'));var config=require(_0x98d3('0x6'));var attributes=require(_0x98d3('0x7'));module[_0x98d3('0x8')]=function(_0x3cabf7,_0x457505){return _0x3cabf7[_0x98d3('0x9')](_0x98d3('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xab25=['../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x199685,_0x59dcc9){var _0x224644=function(_0x164bec){while(--_0x164bec){_0x199685['push'](_0x199685['shift']());}};_0x224644(++_0x59dcc9);}(_0xab25,0x1e7));var _0x5ab2=function(_0x1eb811,_0x192b87){_0x1eb811=_0x1eb811-0x0;var _0x19e024=_0xab25[_0x1eb811];return _0x19e024;};'use strict';var _=require(_0x5ab2('0x0'));var util=require(_0x5ab2('0x1'));var logger=require('../../config/logger')(_0x5ab2('0x2'));var moment=require(_0x5ab2('0x3'));var BPromise=require(_0x5ab2('0x4'));var rp=require(_0x5ab2('0x5'));var fs=require('fs');var path=require(_0x5ab2('0x6'));var rimraf=require('rimraf');var config=require(_0x5ab2('0x7'));var attributes=require(_0x5ab2('0x8'));module[_0x5ab2('0x9')]=function(_0x3eebb3,_0x2facaa){return _0x3eebb3[_0x5ab2('0xa')](_0x5ab2('0xb'),attributes,{'tableName':_0x5ab2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 118a34c..8ffc7c0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4bd3=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring'];(function(_0x1dcdbf,_0xf62087){var _0x4226bb=function(_0xb0d51d){while(--_0xb0d51d){_0x1dcdbf['push'](_0x1dcdbf['shift']());}};_0x4226bb(++_0xf62087);}(_0x4bd3,0x10f));var _0x34bd=function(_0x362b12,_0x273223){_0x362b12=_0x362b12-0x0;var _0x5af4fd=_0x4bd3[_0x362b12];return _0x5af4fd;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x34bd('0x0'));var rs=require(_0x34bd('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x34bd('0x2'));var logger=require(_0x34bd('0x3'))(_0x34bd('0x4'));var config=require('../../config/environment');var jayson=require(_0x34bd('0x5'));var client=jayson[_0x34bd('0x6')][_0x34bd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x211fe,_0xa458b3,_0x1f6921){return new BPromise(function(_0x187f4f,_0x34bfa2){return client[_0x34bd('0x8')](_0x211fe,_0x1f6921)[_0x34bd('0x9')](function(_0x4b5eb0){logger[_0x34bd('0xa')](_0x34bd('0xb'),_0xa458b3,_0x34bd('0xc'));logger[_0x34bd('0xd')](_0x34bd('0xe'),_0xa458b3,_0x34bd('0xc'),JSON[_0x34bd('0xf')](_0x4b5eb0));if(_0x4b5eb0[_0x34bd('0x10')]){if(_0x4b5eb0[_0x34bd('0x10')][_0x34bd('0x11')]===0x1f4){logger['error'](_0x34bd('0xb'),_0xa458b3,_0x4b5eb0[_0x34bd('0x10')][_0x34bd('0x12')]);return _0x34bfa2(_0x4b5eb0['error'][_0x34bd('0x12')]);}logger[_0x34bd('0x10')](_0x34bd('0xb'),_0xa458b3,_0x4b5eb0[_0x34bd('0x10')][_0x34bd('0x12')]);return _0x187f4f(_0x4b5eb0[_0x34bd('0x10')][_0x34bd('0x12')]);}else{logger[_0x34bd('0xa')](_0x34bd('0xb'),_0xa458b3,'request\x20sent');_0x187f4f(_0x4b5eb0[_0x34bd('0x13')][_0x34bd('0x12')]);}})[_0x34bd('0x14')](function(_0x5e2fd1){logger[_0x34bd('0x10')](_0x34bd('0xb'),_0xa458b3,_0x5e2fd1);_0x34bfa2(_0x5e2fd1);});});}
\ No newline at end of file
+var _0x20d6=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0x2e8582,_0x1a4cb9){var _0x4af1eb=function(_0x9177d2){while(--_0x9177d2){_0x2e8582['push'](_0x2e8582['shift']());}};_0x4af1eb(++_0x1a4cb9);}(_0x20d6,0x1b8));var _0x620d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x20d6[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var moment=require(_0x620d('0x2'));var BPromise=require(_0x620d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x620d('0x4'));var db=require(_0x620d('0x5'))['db'];var utils=require(_0x620d('0x6'));var logger=require(_0x620d('0x7'))(_0x620d('0x8'));var config=require(_0x620d('0x9'));var jayson=require(_0x620d('0xa'));var client=jayson[_0x620d('0xb')][_0x620d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3aa4f3,_0x260d43,_0x52657f){return new BPromise(function(_0x3d93af,_0x478aeb){return client['request'](_0x3aa4f3,_0x52657f)[_0x620d('0xd')](function(_0x473790){logger[_0x620d('0xe')](_0x620d('0xf'),_0x260d43,_0x620d('0x10'));logger[_0x620d('0x11')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x260d43,_0x620d('0x10'),JSON[_0x620d('0x12')](_0x473790));if(_0x473790['error']){if(_0x473790[_0x620d('0x13')][_0x620d('0x14')]===0x1f4){logger[_0x620d('0x13')](_0x620d('0xf'),_0x260d43,_0x473790[_0x620d('0x13')][_0x620d('0x15')]);return _0x478aeb(_0x473790[_0x620d('0x13')][_0x620d('0x15')]);}logger['error'](_0x620d('0xf'),_0x260d43,_0x473790[_0x620d('0x13')][_0x620d('0x15')]);return _0x3d93af(_0x473790[_0x620d('0x13')][_0x620d('0x15')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x260d43,'request\x20sent');_0x3d93af(_0x473790[_0x620d('0x16')]['message']);}})[_0x620d('0x17')](function(_0x20a91e){logger[_0x620d('0x13')](_0x620d('0xf'),_0x260d43,_0x20a91e);_0x478aeb(_0x20a91e);});});}
\ No newline at end of file
index 8f79518..5d9b561 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f11=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','create','put','/:id','destroy','multer','util','path','express'];(function(_0x27e20a,_0xe76009){var _0x3d388f=function(_0x39322c){while(--_0x39322c){_0x27e20a['push'](_0x27e20a['shift']());}};_0x3d388f(++_0xe76009);}(_0x2f11,0xd9));var _0x12f1=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2f11[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x12f1('0x0'));var util=require(_0x12f1('0x1'));var path=require(_0x12f1('0x2'));var timeout=require('connect-timeout');var express=require(_0x12f1('0x3'));var router=express['Router']();var fs_extra=require(_0x12f1('0x4'));var auth=require(_0x12f1('0x5'));var interaction=require(_0x12f1('0x6'));var config=require(_0x12f1('0x7'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0x12f1('0x8')](),controller[_0x12f1('0x9')]);router[_0x12f1('0xa')]('/:id',auth[_0x12f1('0x8')](),controller[_0x12f1('0xb')]);router[_0x12f1('0xc')]('/',auth[_0x12f1('0x8')](),controller[_0x12f1('0xd')]);router[_0x12f1('0xe')]('/:id',auth[_0x12f1('0x8')](),controller['update']);router['delete'](_0x12f1('0xf'),auth['isAuthenticated'](),controller[_0x12f1('0x10')]);module['exports']=router;
\ No newline at end of file
+var _0xa880=['isAuthenticated','index','get','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller'];(function(_0x8a22fd,_0x3f6c4e){var _0x3e12fe=function(_0x23f52e){while(--_0x23f52e){_0x8a22fd['push'](_0x8a22fd['shift']());}};_0x3e12fe(++_0x3f6c4e);}(_0xa880,0x106));var _0x0a88=function(_0x58916b,_0x43fc5d){_0x58916b=_0x58916b-0x0;var _0x238322=_0xa880[_0x58916b];return _0x238322;};'use strict';var multer=require(_0x0a88('0x0'));var util=require(_0x0a88('0x1'));var path=require(_0x0a88('0x2'));var timeout=require(_0x0a88('0x3'));var express=require(_0x0a88('0x4'));var router=express[_0x0a88('0x5')]();var fs_extra=require(_0x0a88('0x6'));var auth=require(_0x0a88('0x7'));var interaction=require(_0x0a88('0x8'));var config=require(_0x0a88('0x9'));var controller=require(_0x0a88('0xa'));router['get']('/',auth[_0x0a88('0xb')](),controller[_0x0a88('0xc')]);router[_0x0a88('0xd')](_0x0a88('0xe'),auth['isAuthenticated'](),controller[_0x0a88('0xf')]);router[_0x0a88('0x10')]('/',auth[_0x0a88('0xb')](),controller['create']);router['put']('/:id',auth[_0x0a88('0xb')](),controller[_0x0a88('0x11')]);router[_0x0a88('0x12')](_0x0a88('0xe'),auth[_0x0a88('0xb')](),controller[_0x0a88('0x13')]);module[_0x0a88('0x14')]=router;
\ No newline at end of file
index 7f9f02d..0f95634 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdc99=['picklist','string','STRING','sequelize','exports','ENUM','variable','customVariable'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdc99,0x10b));var _0x9dc9=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0xdc99[_0x2d61b2];return _0x12df89;};'use strict';var Sequelize=require(_0x9dc9('0x0'));module[_0x9dc9('0x1')]={'type':{'type':Sequelize[_0x9dc9('0x2')]('string',_0x9dc9('0x3'),_0x9dc9('0x4'),'keyValue',_0x9dc9('0x5')),'defaultValue':_0x9dc9('0x6')},'content':{'type':Sequelize[_0x9dc9('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9dc9('0x2')]('string',_0x9dc9('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9dc9('0x7')]},'nameField':{'type':Sequelize[_0x9dc9('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9dc9('0x7')]}};
\ No newline at end of file
+var _0xda1e=['BOOLEAN','sequelize','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x46c59b,_0x5635dd){var _0x16dd2d=function(_0x4e7378){while(--_0x4e7378){_0x46c59b['push'](_0x46c59b['shift']());}};_0x16dd2d(++_0x5635dd);}(_0xda1e,0x141));var _0xeda1=function(_0x50d6d6,_0x189c68){_0x50d6d6=_0x50d6d6-0x0;var _0x5d9bb4=_0xda1e[_0x50d6d6];return _0x5d9bb4;};'use strict';var Sequelize=require(_0xeda1('0x0'));module['exports']={'type':{'type':Sequelize[_0xeda1('0x1')](_0xeda1('0x2'),'variable',_0xeda1('0x3'),_0xeda1('0x4'),'picklist'),'defaultValue':_0xeda1('0x2')},'content':{'type':Sequelize[_0xeda1('0x5')]},'key':{'type':Sequelize[_0xeda1('0x5')]},'keyType':{'type':Sequelize[_0xeda1('0x1')](_0xeda1('0x2'),_0xeda1('0x6'),_0xeda1('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xeda1('0x5')]},'nameField':{'type':Sequelize[_0xeda1('0x5')]},'customField':{'type':Sequelize[_0xeda1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 9ae06ac..9a7c2f3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x28b1=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','DeskField','findAll','catch','show','params','fields','create','body','find','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x28b1,0x1d6));var _0x128b=function(_0x3815de,_0x93ba8f){_0x3815de=_0x3815de-0x0;var _0x3cc9ee=_0x28b1[_0x3815de];return _0x3cc9ee;};'use strict';var emlformat=require(_0x128b('0x0'));var rimraf=require(_0x128b('0x1'));var zipdir=require(_0x128b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x128b('0x3'));var moment=require(_0x128b('0x4'));var BPromise=require(_0x128b('0x5'));var Mustache=require(_0x128b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x128b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x128b('0x8'));var _=require('lodash');var squel=require(_0x128b('0x9'));var crypto=require(_0x128b('0xa'));var jsforce=require(_0x128b('0xb'));var deskjs=require(_0x128b('0xc'));var toCsv=require(_0x128b('0xd'));var querystring=require(_0x128b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x128b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x128b('0x10'));var logger=require(_0x128b('0x11'))(_0x128b('0x12'));var utils=require(_0x128b('0x13'));var config=require(_0x128b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x128b('0x15'))['db'];function respondWithStatusCode(_0x4f06b0,_0x7258dc){_0x7258dc=_0x7258dc||0xcc;return function(_0x9e7123){if(_0x9e7123){return _0x4f06b0[_0x128b('0x16')](_0x7258dc);}return _0x4f06b0[_0x128b('0x17')](_0x7258dc)[_0x128b('0x18')]();};}function respondWithResult(_0x41a85,_0x33c1c6){_0x33c1c6=_0x33c1c6||0xc8;return function(_0x129056){if(_0x129056){return _0x41a85[_0x128b('0x17')](_0x33c1c6)[_0x128b('0x19')](_0x129056);}};}function respondWithFilteredResult(_0x19838f,_0x43327f){return function(_0x4267d0){if(_0x4267d0){var _0x51f09a=typeof _0x43327f['offset']==='undefined'&&typeof _0x43327f['limit']==='undefined';var _0x2b36c0=_0x4267d0[_0x128b('0x1a')];var _0x2f04a5=_0x51f09a?0x0:_0x43327f[_0x128b('0x1b')];var _0x4479f9=_0x51f09a?_0x4267d0['count']:_0x43327f[_0x128b('0x1b')]+_0x43327f[_0x128b('0x1c')];var _0x3ed3b0;if(_0x4479f9>=_0x2b36c0){_0x4479f9=_0x2b36c0;_0x3ed3b0=0xc8;}else{_0x3ed3b0=0xce;}_0x19838f[_0x128b('0x17')](_0x3ed3b0);return _0x19838f['set'](_0x128b('0x1d'),_0x2f04a5+'-'+_0x4479f9+'/'+_0x2b36c0)[_0x128b('0x19')](_0x4267d0);}return null;};}function patchUpdates(_0x53275d){return function(_0x2fd53e){try{jsonpatch['apply'](_0x2fd53e,_0x53275d,!![]);}catch(_0x1606f5){return BPromise[_0x128b('0x1e')](_0x1606f5);}return _0x2fd53e[_0x128b('0x1f')]();};}function saveUpdates(_0x508a34,_0x55c795){return function(_0x39bc81){if(_0x39bc81){return _0x39bc81[_0x128b('0x20')](_0x508a34)[_0x128b('0x21')](function(_0x1e4503){return _0x1e4503;});}return null;};}function removeEntity(_0x3cf9e1,_0x215d4d){return function(_0x182692){if(_0x182692){return _0x182692['destroy']()['then'](function(){_0x3cf9e1[_0x128b('0x17')](0xcc)[_0x128b('0x18')]();});}};}function handleEntityNotFound(_0x25bb95,_0x224c70){return function(_0x2fb086){if(!_0x2fb086){_0x25bb95['sendStatus'](0x194);}return _0x2fb086;};}function handleError(_0x495a15,_0x13f722){_0x13f722=_0x13f722||0x1f4;return function(_0x3bb156){logger[_0x128b('0x22')](_0x3bb156['stack']);if(_0x3bb156[_0x128b('0x23')]){delete _0x3bb156[_0x128b('0x23')];}_0x495a15['status'](_0x13f722)[_0x128b('0x24')](_0x3bb156);};}exports[_0x128b('0x25')]=function(_0x2a512a,_0xccef37){var _0x1a5e69={},_0xa2f5bb={},_0x1bc1ef={'count':0x0,'rows':[]};var _0xdf67a7=_[_0x128b('0x26')](db['DeskField'][_0x128b('0x27')],function(_0x286e6f){return{'name':_0x286e6f[_0x128b('0x28')],'type':_0x286e6f[_0x128b('0x29')]['key']};});_0xa2f5bb['model']=_['map'](_0xdf67a7,_0x128b('0x23'));_0xa2f5bb[_0x128b('0x2a')]=_[_0x128b('0x2b')](_0x2a512a[_0x128b('0x2a')]);_0xa2f5bb[_0x128b('0x2c')]=_[_0x128b('0x2d')](_0xa2f5bb[_0x128b('0x2e')],_0xa2f5bb[_0x128b('0x2a')]);_0x1a5e69[_0x128b('0x2f')]=_['intersection'](_0xa2f5bb['model'],qs['fields'](_0x2a512a[_0x128b('0x2a')]['fields']));_0x1a5e69[_0x128b('0x2f')]=_0x1a5e69[_0x128b('0x2f')][_0x128b('0x30')]?_0x1a5e69[_0x128b('0x2f')]:_0xa2f5bb[_0x128b('0x2e')];if(!_0x2a512a['query'][_0x128b('0x31')](_0x128b('0x32'))){_0x1a5e69[_0x128b('0x1c')]=qs[_0x128b('0x1c')](_0x2a512a[_0x128b('0x2a')]['limit']);_0x1a5e69[_0x128b('0x1b')]=qs[_0x128b('0x1b')](_0x2a512a[_0x128b('0x2a')][_0x128b('0x1b')]);}_0x1a5e69['order']=qs[_0x128b('0x33')](_0x2a512a[_0x128b('0x2a')][_0x128b('0x33')]);_0x1a5e69[_0x128b('0x34')]=qs[_0x128b('0x2c')](_[_0x128b('0x35')](_0x2a512a['query'],_0xa2f5bb['filters']),_0xdf67a7);if(_0x2a512a[_0x128b('0x2a')][_0x128b('0x36')]){_0x1a5e69[_0x128b('0x34')]=_['merge'](_0x1a5e69[_0x128b('0x34')],{'$or':_['map'](_0xdf67a7,function(_0x41b9e6){if(_0x41b9e6[_0x128b('0x29')]!==_0x128b('0x37')){var _0x1329b9={};_0x1329b9[_0x41b9e6['name']]={'$like':'%'+_0x2a512a[_0x128b('0x2a')][_0x128b('0x36')]+'%'};return _0x1329b9;}})});}_0x1a5e69=_[_0x128b('0x38')]({},_0x1a5e69,_0x2a512a[_0x128b('0x39')]);var _0xcb359c={'where':_0x1a5e69[_0x128b('0x34')]};return db['DeskField'][_0x128b('0x1a')](_0xcb359c)[_0x128b('0x21')](function(_0x17fd01){_0x1bc1ef['count']=_0x17fd01;if(_0x2a512a['query'][_0x128b('0x3a')]){_0x1a5e69[_0x128b('0x3b')]=[{'all':!![]}];}return db[_0x128b('0x3c')][_0x128b('0x3d')](_0x1a5e69);})[_0x128b('0x21')](function(_0x44561d){_0x1bc1ef['rows']=_0x44561d;return _0x1bc1ef;})['then'](respondWithFilteredResult(_0xccef37,_0x1a5e69))[_0x128b('0x3e')](handleError(_0xccef37,null));};exports[_0x128b('0x3f')]=function(_0x100bb4,_0x2c6f02){var _0x480041={'raw':!![],'where':{'id':_0x100bb4[_0x128b('0x40')]['id']}},_0x136fae={};_0x136fae[_0x128b('0x2e')]=_[_0x128b('0x2b')](db['DeskField']['rawAttributes']);_0x136fae['query']=_['keys'](_0x100bb4[_0x128b('0x2a')]);_0x136fae[_0x128b('0x2c')]=_[_0x128b('0x2d')](_0x136fae[_0x128b('0x2e')],_0x136fae['query']);_0x480041[_0x128b('0x2f')]=_['intersection'](_0x136fae['model'],qs[_0x128b('0x41')](_0x100bb4[_0x128b('0x2a')][_0x128b('0x41')]));_0x480041[_0x128b('0x2f')]=_0x480041['attributes'][_0x128b('0x30')]?_0x480041[_0x128b('0x2f')]:_0x136fae[_0x128b('0x2e')];if(_0x100bb4['query'][_0x128b('0x3a')]){_0x480041[_0x128b('0x3b')]=[{'all':!![]}];}_0x480041=_[_0x128b('0x38')]({},_0x480041,_0x100bb4[_0x128b('0x39')]);return db[_0x128b('0x3c')]['find'](_0x480041)['then'](handleEntityNotFound(_0x2c6f02,null))['then'](respondWithResult(_0x2c6f02,null))['catch'](handleError(_0x2c6f02,null));};exports[_0x128b('0x42')]=function(_0x2d95a8,_0x5afb87){return db[_0x128b('0x3c')][_0x128b('0x42')](_0x2d95a8[_0x128b('0x43')],{})[_0x128b('0x21')](respondWithResult(_0x5afb87,0xc9))[_0x128b('0x3e')](handleError(_0x5afb87,null));};exports['update']=function(_0x2c6a7b,_0x1bc130){if(_0x2c6a7b[_0x128b('0x43')]['id']){delete _0x2c6a7b[_0x128b('0x43')]['id'];}return db['DeskField'][_0x128b('0x44')]({'where':{'id':_0x2c6a7b[_0x128b('0x40')]['id']}})[_0x128b('0x21')](handleEntityNotFound(_0x1bc130,null))[_0x128b('0x21')](saveUpdates(_0x2c6a7b[_0x128b('0x43')],null))['then'](respondWithResult(_0x1bc130,null))[_0x128b('0x3e')](handleError(_0x1bc130,null));};exports[_0x128b('0x45')]=function(_0x3bbfcf,_0x5a1533){return db[_0x128b('0x3c')]['find']({'where':{'id':_0x3bbfcf[_0x128b('0x40')]['id']}})['then'](handleEntityNotFound(_0x5a1533,null))['then'](removeEntity(_0x5a1533,null))[_0x128b('0x3e')](handleError(_0x5a1533,null));};
\ No newline at end of file
+var _0xbd1f=['filters','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','body','update','params','destroy','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','error','name','index','DeskField','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x12028c,_0x5d346c){var _0x19505d=function(_0x41d89a){while(--_0x41d89a){_0x12028c['push'](_0x12028c['shift']());}};_0x19505d(++_0x5d346c);}(_0xbd1f,0x139));var _0xfbd1=function(_0x5c06fe,_0x12193a){_0x5c06fe=_0x5c06fe-0x0;var _0xf8ec9a=_0xbd1f[_0x5c06fe];return _0xf8ec9a;};'use strict';var emlformat=require(_0xfbd1('0x0'));var rimraf=require(_0xfbd1('0x1'));var zipdir=require(_0xfbd1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbd1('0x3'));var moment=require(_0xfbd1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfbd1('0x5'));var util=require(_0xfbd1('0x6'));var path=require(_0xfbd1('0x7'));var sox=require('sox');var csv=require(_0xfbd1('0x8'));var ejs=require(_0xfbd1('0x9'));var fs=require('fs');var fs_extra=require(_0xfbd1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfbd1('0xb'));var jsforce=require(_0xfbd1('0xc'));var deskjs=require(_0xfbd1('0xd'));var toCsv=require(_0xfbd1('0x8'));var querystring=require(_0xfbd1('0xe'));var Papa=require(_0xfbd1('0xf'));var Redis=require(_0xfbd1('0x10'));var authService=require(_0xfbd1('0x11'));var qs=require(_0xfbd1('0x12'));var as=require(_0xfbd1('0x13'));var hardwareService=require(_0xfbd1('0x14'));var logger=require('../../config/logger')(_0xfbd1('0x15'));var utils=require(_0xfbd1('0x16'));var config=require(_0xfbd1('0x17'));var licenseUtil=require(_0xfbd1('0x18'));var db=require(_0xfbd1('0x19'))['db'];function respondWithStatusCode(_0x10ec46,_0x3911ee){_0x3911ee=_0x3911ee||0xcc;return function(_0x373657){if(_0x373657){return _0x10ec46[_0xfbd1('0x1a')](_0x3911ee);}return _0x10ec46[_0xfbd1('0x1b')](_0x3911ee)['end']();};}function respondWithResult(_0x32f1e7,_0x38ec4e){_0x38ec4e=_0x38ec4e||0xc8;return function(_0x4142e0){if(_0x4142e0){return _0x32f1e7['status'](_0x38ec4e)[_0xfbd1('0x1c')](_0x4142e0);}};}function respondWithFilteredResult(_0x29de79,_0x5ddf30){return function(_0xf53e0a){if(_0xf53e0a){var _0x58dc2e=typeof _0x5ddf30[_0xfbd1('0x1d')]===_0xfbd1('0x1e')&&typeof _0x5ddf30[_0xfbd1('0x1f')]===_0xfbd1('0x1e');var _0x55c34b=_0xf53e0a[_0xfbd1('0x20')];var _0x481dc2=_0x58dc2e?0x0:_0x5ddf30[_0xfbd1('0x1d')];var _0x93dc13=_0x58dc2e?_0xf53e0a[_0xfbd1('0x20')]:_0x5ddf30[_0xfbd1('0x1d')]+_0x5ddf30[_0xfbd1('0x1f')];var _0x4d2d41;if(_0x93dc13>=_0x55c34b){_0x93dc13=_0x55c34b;_0x4d2d41=0xc8;}else{_0x4d2d41=0xce;}_0x29de79[_0xfbd1('0x1b')](_0x4d2d41);return _0x29de79[_0xfbd1('0x21')](_0xfbd1('0x22'),_0x481dc2+'-'+_0x93dc13+'/'+_0x55c34b)[_0xfbd1('0x1c')](_0xf53e0a);}return null;};}function patchUpdates(_0x2d7b41){return function(_0x34e2ad){try{jsonpatch[_0xfbd1('0x23')](_0x34e2ad,_0x2d7b41,!![]);}catch(_0x3e5e22){return BPromise[_0xfbd1('0x24')](_0x3e5e22);}return _0x34e2ad['save']();};}function saveUpdates(_0x59bc87,_0x1febc9){return function(_0x364016){if(_0x364016){return _0x364016['update'](_0x59bc87)['then'](function(_0x2b8d7d){return _0x2b8d7d;});}return null;};}function removeEntity(_0xaac635,_0x245939){return function(_0x4f7afa){if(_0x4f7afa){return _0x4f7afa['destroy']()['then'](function(){_0xaac635['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x118afb,_0x2e97e8){return function(_0x39506e){if(!_0x39506e){_0x118afb[_0xfbd1('0x1a')](0x194);}return _0x39506e;};}function handleError(_0x2daa5b,_0x2fc9b1){_0x2fc9b1=_0x2fc9b1||0x1f4;return function(_0x4f3af5){logger[_0xfbd1('0x25')](_0x4f3af5['stack']);if(_0x4f3af5[_0xfbd1('0x26')]){delete _0x4f3af5['name'];}_0x2daa5b[_0xfbd1('0x1b')](_0x2fc9b1)['send'](_0x4f3af5);};}exports[_0xfbd1('0x27')]=function(_0x12ad4b,_0x1ec87d){var _0x5385fb={},_0x5f3ed8={},_0x3210a5={'count':0x0,'rows':[]};var _0xade87b=_['map'](db[_0xfbd1('0x28')][_0xfbd1('0x29')],function(_0x57fca8){return{'name':_0x57fca8[_0xfbd1('0x2a')],'type':_0x57fca8[_0xfbd1('0x2b')][_0xfbd1('0x2c')]};});_0x5f3ed8[_0xfbd1('0x2d')]=_[_0xfbd1('0x2e')](_0xade87b,'name');_0x5f3ed8[_0xfbd1('0x2f')]=_[_0xfbd1('0x30')](_0x12ad4b[_0xfbd1('0x2f')]);_0x5f3ed8['filters']=_[_0xfbd1('0x31')](_0x5f3ed8['model'],_0x5f3ed8['query']);_0x5385fb[_0xfbd1('0x32')]=_[_0xfbd1('0x31')](_0x5f3ed8[_0xfbd1('0x2d')],qs[_0xfbd1('0x33')](_0x12ad4b['query'][_0xfbd1('0x33')]));_0x5385fb['attributes']=_0x5385fb[_0xfbd1('0x32')][_0xfbd1('0x34')]?_0x5385fb[_0xfbd1('0x32')]:_0x5f3ed8[_0xfbd1('0x2d')];if(!_0x12ad4b['query'][_0xfbd1('0x35')]('nolimit')){_0x5385fb[_0xfbd1('0x1f')]=qs[_0xfbd1('0x1f')](_0x12ad4b[_0xfbd1('0x2f')][_0xfbd1('0x1f')]);_0x5385fb[_0xfbd1('0x1d')]=qs[_0xfbd1('0x1d')](_0x12ad4b[_0xfbd1('0x2f')][_0xfbd1('0x1d')]);}_0x5385fb[_0xfbd1('0x36')]=qs['sort'](_0x12ad4b['query'][_0xfbd1('0x37')]);_0x5385fb[_0xfbd1('0x38')]=qs[_0xfbd1('0x39')](_[_0xfbd1('0x3a')](_0x12ad4b[_0xfbd1('0x2f')],_0x5f3ed8[_0xfbd1('0x39')]),_0xade87b);if(_0x12ad4b[_0xfbd1('0x2f')][_0xfbd1('0x3b')]){_0x5385fb['where']=_[_0xfbd1('0x3c')](_0x5385fb[_0xfbd1('0x38')],{'$or':_['map'](_0xade87b,function(_0x3b1c2d){if(_0x3b1c2d['type']!==_0xfbd1('0x3d')){var _0x572ce0={};_0x572ce0[_0x3b1c2d[_0xfbd1('0x26')]]={'$like':'%'+_0x12ad4b['query']['filter']+'%'};return _0x572ce0;}})});}_0x5385fb=_['merge']({},_0x5385fb,_0x12ad4b[_0xfbd1('0x3e')]);var _0x1d2d15={'where':_0x5385fb[_0xfbd1('0x38')]};return db[_0xfbd1('0x28')][_0xfbd1('0x20')](_0x1d2d15)[_0xfbd1('0x3f')](function(_0x1b1d8b){_0x3210a5[_0xfbd1('0x20')]=_0x1b1d8b;if(_0x12ad4b[_0xfbd1('0x2f')][_0xfbd1('0x40')]){_0x5385fb[_0xfbd1('0x41')]=[{'all':!![]}];}return db[_0xfbd1('0x28')][_0xfbd1('0x42')](_0x5385fb);})[_0xfbd1('0x3f')](function(_0x48fe78){_0x3210a5[_0xfbd1('0x43')]=_0x48fe78;return _0x3210a5;})[_0xfbd1('0x3f')](respondWithFilteredResult(_0x1ec87d,_0x5385fb))[_0xfbd1('0x44')](handleError(_0x1ec87d,null));};exports['show']=function(_0x384bb8,_0x3c9e50){var _0x18d408={'raw':!![],'where':{'id':_0x384bb8['params']['id']}},_0x5c0f5a={};_0x5c0f5a[_0xfbd1('0x2d')]=_[_0xfbd1('0x30')](db['DeskField'][_0xfbd1('0x29')]);_0x5c0f5a[_0xfbd1('0x2f')]=_[_0xfbd1('0x30')](_0x384bb8[_0xfbd1('0x2f')]);_0x5c0f5a['filters']=_[_0xfbd1('0x31')](_0x5c0f5a[_0xfbd1('0x2d')],_0x5c0f5a['query']);_0x18d408[_0xfbd1('0x32')]=_[_0xfbd1('0x31')](_0x5c0f5a[_0xfbd1('0x2d')],qs['fields'](_0x384bb8[_0xfbd1('0x2f')][_0xfbd1('0x33')]));_0x18d408[_0xfbd1('0x32')]=_0x18d408[_0xfbd1('0x32')]['length']?_0x18d408[_0xfbd1('0x32')]:_0x5c0f5a[_0xfbd1('0x2d')];if(_0x384bb8[_0xfbd1('0x2f')][_0xfbd1('0x40')]){_0x18d408['include']=[{'all':!![]}];}_0x18d408=_['merge']({},_0x18d408,_0x384bb8[_0xfbd1('0x3e')]);return db[_0xfbd1('0x28')]['find'](_0x18d408)[_0xfbd1('0x3f')](handleEntityNotFound(_0x3c9e50,null))['then'](respondWithResult(_0x3c9e50,null))[_0xfbd1('0x44')](handleError(_0x3c9e50,null));};exports['create']=function(_0x2a4f90,_0x4586cb){return db['DeskField']['create'](_0x2a4f90[_0xfbd1('0x45')],{})[_0xfbd1('0x3f')](respondWithResult(_0x4586cb,0xc9))['catch'](handleError(_0x4586cb,null));};exports[_0xfbd1('0x46')]=function(_0x10ac81,_0x5c6907){if(_0x10ac81[_0xfbd1('0x45')]['id']){delete _0x10ac81[_0xfbd1('0x45')]['id'];}return db[_0xfbd1('0x28')]['find']({'where':{'id':_0x10ac81[_0xfbd1('0x47')]['id']}})[_0xfbd1('0x3f')](handleEntityNotFound(_0x5c6907,null))[_0xfbd1('0x3f')](saveUpdates(_0x10ac81['body'],null))[_0xfbd1('0x3f')](respondWithResult(_0x5c6907,null))[_0xfbd1('0x44')](handleError(_0x5c6907,null));};exports[_0xfbd1('0x48')]=function(_0x519c27,_0x1d9bf4){return db[_0xfbd1('0x28')][_0xfbd1('0x49')]({'where':{'id':_0x519c27[_0xfbd1('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d9bf4,null))[_0xfbd1('0x3f')](removeEntity(_0x1d9bf4,null))[_0xfbd1('0x44')](handleError(_0x1d9bf4,null));};
\ No newline at end of file
index e3d6a2f..5eaecaa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6e3e=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField','FieldId','lodash'];(function(_0x28fbe3,_0x4ac6f8){var _0x45db6a=function(_0x296ecb){while(--_0x296ecb){_0x28fbe3['push'](_0x28fbe3['shift']());}};_0x45db6a(++_0x4ac6f8);}(_0x6e3e,0x18f));var _0xe6e3=function(_0x3bbe25,_0x45b458){_0x3bbe25=_0x3bbe25-0x0;var _0x35d684=_0x6e3e[_0x3bbe25];return _0x35d684;};'use strict';var _=require(_0xe6e3('0x0'));var util=require(_0xe6e3('0x1'));var logger=require(_0xe6e3('0x2'))(_0xe6e3('0x3'));var moment=require(_0xe6e3('0x4'));var BPromise=require(_0xe6e3('0x5'));var rp=require(_0xe6e3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6e3('0x7'));var config=require(_0xe6e3('0x8'));var attributes=require(_0xe6e3('0x9'));module[_0xe6e3('0xa')]=function(_0x10f4d4,_0x53f08e){return _0x10f4d4[_0xe6e3('0xb')]('DeskField',attributes,{'tableName':_0xe6e3('0xc'),'paranoid':![],'indexes':[{'name':_0xe6e3('0xd'),'fields':[_0xe6e3('0xe'),_0xe6e3('0xf')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xea52=['idField','util','../../config/logger','api','moment','request-promise','rimraf','define'];(function(_0x36b4d8,_0x17f88b){var _0xa414d9=function(_0x3fcf1b){while(--_0x3fcf1b){_0x36b4d8['push'](_0x36b4d8['shift']());}};_0xa414d9(++_0x17f88b);}(_0xea52,0x109));var _0x2ea5=function(_0x2e3416,_0x5073f4){_0x2e3416=_0x2e3416-0x0;var _0x1749ff=_0xea52[_0x2e3416];return _0x1749ff;};'use strict';var _=require('lodash');var util=require(_0x2ea5('0x0'));var logger=require(_0x2ea5('0x1'))(_0x2ea5('0x2'));var moment=require(_0x2ea5('0x3'));var BPromise=require('bluebird');var rp=require(_0x2ea5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ea5('0x5'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module['exports']=function(_0x28c23e,_0x576b99){return _0x28c23e[_0x2ea5('0x6')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x2ea5('0x7'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 4de5020..15cfc45 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8845=['../../config/environment','jayson/promise','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8845,0x1af));var _0x5884=function(_0x439987,_0x1776e7){_0x439987=_0x439987-0x0;var _0x2f15db=_0x8845[_0x439987];return _0x2f15db;};'use strict';var _=require(_0x5884('0x0'));var util=require(_0x5884('0x1'));var moment=require(_0x5884('0x2'));var BPromise=require('bluebird');var rs=require(_0x5884('0x3'));var fs=require('fs');var Redis=require(_0x5884('0x4'));var db=require(_0x5884('0x5'))['db'];var utils=require(_0x5884('0x6'));var logger=require(_0x5884('0x7'))(_0x5884('0x8'));var config=require(_0x5884('0x9'));var jayson=require(_0x5884('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4196b6,_0x247961,_0x1a1180){return new BPromise(function(_0x3f1bc9,_0x1a5791){return client['request'](_0x4196b6,_0x1a1180)['then'](function(_0x16d06a){logger[_0x5884('0xb')](_0x5884('0xc'),_0x247961,_0x5884('0xd'));logger[_0x5884('0xe')](_0x5884('0xf'),_0x247961,'request\x20sent',JSON[_0x5884('0x10')](_0x16d06a));if(_0x16d06a['error']){if(_0x16d06a['error']['code']===0x1f4){logger[_0x5884('0x11')](_0x5884('0xc'),_0x247961,_0x16d06a['error']['message']);return _0x1a5791(_0x16d06a[_0x5884('0x11')][_0x5884('0x12')]);}logger[_0x5884('0x11')](_0x5884('0xc'),_0x247961,_0x16d06a['error'][_0x5884('0x12')]);return _0x3f1bc9(_0x16d06a['error'][_0x5884('0x12')]);}else{logger['info'](_0x5884('0xc'),_0x247961,_0x5884('0xd'));_0x3f1bc9(_0x16d06a['result'][_0x5884('0x12')]);}})[_0x5884('0x13')](function(_0x20ee91){logger['error'](_0x5884('0xc'),_0x247961,_0x20ee91);_0x1a5791(_0x20ee91);});});}
\ No newline at end of file
+var _0xe539=['../../config/utils','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring'];(function(_0x40230d,_0x17f672){var _0x1f1d98=function(_0x9369b3){while(--_0x9369b3){_0x40230d['push'](_0x40230d['shift']());}};_0x1f1d98(++_0x17f672);}(_0xe539,0x1f4));var _0x9e53=function(_0x356127,_0x4873ac){_0x356127=_0x356127-0x0;var _0x5d4c75=_0xe539[_0x356127];return _0x5d4c75;};'use strict';var _=require('lodash');var util=require(_0x9e53('0x0'));var moment=require(_0x9e53('0x1'));var BPromise=require(_0x9e53('0x2'));var rs=require(_0x9e53('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9e53('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9e53('0x5'));var client=jayson[_0x9e53('0x6')][_0x9e53('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x309aaa,_0x4a4f22,_0x34e677){return new BPromise(function(_0x1c0a4f,_0x4673d9){return client['request'](_0x309aaa,_0x34e677)[_0x9e53('0x8')](function(_0x187b8c){logger[_0x9e53('0x9')](_0x9e53('0xa'),_0x4a4f22,_0x9e53('0xb'));logger[_0x9e53('0xc')](_0x9e53('0xd'),_0x4a4f22,_0x9e53('0xb'),JSON[_0x9e53('0xe')](_0x187b8c));if(_0x187b8c['error']){if(_0x187b8c[_0x9e53('0xf')]['code']===0x1f4){logger[_0x9e53('0xf')]('DeskField,\x20%s,\x20%s',_0x4a4f22,_0x187b8c[_0x9e53('0xf')]['message']);return _0x4673d9(_0x187b8c['error'][_0x9e53('0x10')]);}logger[_0x9e53('0xf')](_0x9e53('0xa'),_0x4a4f22,_0x187b8c[_0x9e53('0xf')][_0x9e53('0x10')]);return _0x1c0a4f(_0x187b8c[_0x9e53('0xf')][_0x9e53('0x10')]);}else{logger[_0x9e53('0x9')](_0x9e53('0xa'),_0x4a4f22,_0x9e53('0xb'));_0x1c0a4f(_0x187b8c['result'][_0x9e53('0x10')]);}})[_0x9e53('0x11')](function(_0x15d7f6){logger[_0x9e53('0xf')]('DeskField,\x20%s,\x20%s',_0x4a4f22,_0x15d7f6);_0x4673d9(_0x15d7f6);});});}
\ No newline at end of file
index ad81d23..fdd636d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9e79=['../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x9e79,0xb6));var _0x99e7=function(_0x587a71,_0x332e22){_0x587a71=_0x587a71-0x0;var _0x4b9fea=_0x9e79[_0x587a71];return _0x4b9fea;};'use strict';var multer=require(_0x99e7('0x0'));var util=require('util');var path=require(_0x99e7('0x1'));var timeout=require(_0x99e7('0x2'));var express=require(_0x99e7('0x3'));var router=express[_0x99e7('0x4')]();var fs_extra=require(_0x99e7('0x5'));var auth=require(_0x99e7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99e7('0x7'));var controller=require(_0x99e7('0x8'));router['get']('/',auth[_0x99e7('0x9')](),controller[_0x99e7('0xa')]);router[_0x99e7('0xb')](_0x99e7('0xc'),auth[_0x99e7('0x9')](),controller['show']);router[_0x99e7('0xb')](_0x99e7('0xd'),auth[_0x99e7('0x9')](),controller[_0x99e7('0xe')]);router['get'](_0x99e7('0xf'),auth[_0x99e7('0x9')](),controller['getFields']);router[_0x99e7('0x10')]('/',auth[_0x99e7('0x9')](),controller['create']);router[_0x99e7('0x10')]('/:id/configurations',auth[_0x99e7('0x9')](),controller[_0x99e7('0x11')]);router['put'](_0x99e7('0xc'),auth[_0x99e7('0x9')](),controller['update']);router[_0x99e7('0x12')](_0x99e7('0xc'),auth[_0x99e7('0x9')](),controller[_0x99e7('0x13')]);module[_0x99e7('0x14')]=router;
\ No newline at end of file
+var _0xb1c0=['show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','/:id','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0xc6d176,_0xfbf195){var _0x40e95d=function(_0x14f112){while(--_0x14f112){_0xc6d176['push'](_0xc6d176['shift']());}};_0x40e95d(++_0xfbf195);}(_0xb1c0,0x7f));var _0x0b1c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb1c0[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x0b1c('0x0'));var util=require('util');var path=require(_0x0b1c('0x1'));var timeout=require(_0x0b1c('0x2'));var express=require(_0x0b1c('0x3'));var router=express[_0x0b1c('0x4')]();var fs_extra=require(_0x0b1c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0b1c('0x6'));var config=require(_0x0b1c('0x7'));var controller=require(_0x0b1c('0x8'));router[_0x0b1c('0x9')]('/',auth[_0x0b1c('0xa')](),controller['index']);router[_0x0b1c('0x9')]('/:id',auth[_0x0b1c('0xa')](),controller[_0x0b1c('0xb')]);router['get'](_0x0b1c('0xc'),auth[_0x0b1c('0xa')](),controller[_0x0b1c('0xd')]);router[_0x0b1c('0x9')]('/:id/fields',auth[_0x0b1c('0xa')](),controller[_0x0b1c('0xe')]);router[_0x0b1c('0xf')]('/',auth[_0x0b1c('0xa')](),controller[_0x0b1c('0x10')]);router[_0x0b1c('0xf')](_0x0b1c('0xc'),auth[_0x0b1c('0xa')](),controller[_0x0b1c('0x11')]);router[_0x0b1c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0b1c('0x13')]);router[_0x0b1c('0x14')](_0x0b1c('0x15'),auth[_0x0b1c('0xa')](),controller[_0x0b1c('0x16')]);module['exports']=router;
\ No newline at end of file
index deacaa4..5c5a4e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x277c=['STRING','sequelize'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0x277c,0x153));var _0xc277=function(_0x55f9e7,_0x42f5d1){_0x55f9e7=_0x55f9e7-0x0;var _0x2f8d72=_0x277c[_0x55f9e7];return _0x2f8d72;};'use strict';var Sequelize=require(_0xc277('0x0'));module['exports']={'name':{'type':Sequelize[_0xc277('0x1')]},'username':{'type':Sequelize[_0xc277('0x1')]},'password':{'type':Sequelize[_0xc277('0x1')]},'remoteUri':{'type':Sequelize[_0xc277('0x1')]},'tenantId':{'type':Sequelize[_0xc277('0x1')]},'clientId':{'type':Sequelize[_0xc277('0x1')]},'clientSecret':{'type':Sequelize[_0xc277('0x1')]},'serverUrl':{'type':Sequelize[_0xc277('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}};
\ No newline at end of file
+var _0xf3a7=['STRING','exports'];(function(_0x2da4f7,_0x1b14ac){var _0x209f70=function(_0x1e1774){while(--_0x1e1774){_0x2da4f7['push'](_0x2da4f7['shift']());}};_0x209f70(++_0x1b14ac);}(_0xf3a7,0x99));var _0x7f3a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf3a7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x7f3a('0x0')]={'name':{'type':Sequelize[_0x7f3a('0x1')]},'username':{'type':Sequelize[_0x7f3a('0x1')]},'password':{'type':Sequelize[_0x7f3a('0x1')]},'remoteUri':{'type':Sequelize[_0x7f3a('0x1')]},'tenantId':{'type':Sequelize[_0x7f3a('0x1')]},'clientId':{'type':Sequelize[_0x7f3a('0x1')]},'clientSecret':{'type':Sequelize[_0x7f3a('0x1')]},'serverUrl':{'type':Sequelize[_0x7f3a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7f3a('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}};
\ No newline at end of file
index 1b63418..0ffb1f8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1f8f=['clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','https://login.microsoftonline.com/','tenantId','/oauth2/token','GET','MetadataId','Bearer\x20','4.0','includes','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','LogicalName',')/Microsoft.Dynamics.CRM.','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','then','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','lastIndexOf','format','%s/api/data/v9.0/','ticketType','incident','Incident','PhoneCall','title','description','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','exchangerate','followupby','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','responsiblecontactidyominame','slainvokedidname','slaname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId'];(function(_0x41180f,_0x568350){var _0x75a088=function(_0x5e0d45){while(--_0x5e0d45){_0x41180f['push'](_0x41180f['shift']());}};_0x75a088(++_0x568350);}(_0x1f8f,0x19c));var _0xf1f8=function(_0x1f1033,_0x349c73){_0x1f1033=_0x1f1033-0x0;var _0xf79d4d=_0x1f8f[_0x1f1033];return _0xf79d4d;};'use strict';var rp=require(_0xf1f8('0x0'));var util=require(_0xf1f8('0x1'));var _=require('lodash');var qs=require(_0xf1f8('0x2'));var logger=require(_0xf1f8('0x3'))(_0xf1f8('0x4'));var db=require(_0xf1f8('0x5'))['db'];var integrations=require(_0xf1f8('0x6'));function respondWithResult(_0x2bc927,_0x5dda04){_0x5dda04=_0x5dda04||0xc8;return function(_0x2a7b94){if(_0x2a7b94){return _0x2bc927['status'](_0x5dda04)[_0xf1f8('0x7')](_0x2a7b94);}};}function respondWithFilteredResult(_0x112def,_0x4c96f6){return function(_0x494fce){if(_0x494fce){var _0xee2940=typeof _0x4c96f6[_0xf1f8('0x8')]===_0xf1f8('0x9')&&typeof _0x4c96f6[_0xf1f8('0xa')]===_0xf1f8('0x9');var _0x32bc61=_0x494fce[_0xf1f8('0xb')];var _0xb6f811=_0xee2940?0x0:_0x4c96f6[_0xf1f8('0x8')];var _0x4d7eba=_0xee2940?_0x494fce[_0xf1f8('0xb')]:_0x4c96f6[_0xf1f8('0x8')]+_0x4c96f6[_0xf1f8('0xa')];var _0x2fbdcf;if(_0x4d7eba>=_0x32bc61){_0x4d7eba=_0x32bc61;_0x2fbdcf=0xc8;}else{_0x2fbdcf=0xce;}_0x112def[_0xf1f8('0xc')](_0x2fbdcf);return _0x112def[_0xf1f8('0xd')](_0xf1f8('0xe'),_0xb6f811+'-'+_0x4d7eba+'/'+_0x32bc61)[_0xf1f8('0x7')](_0x494fce);}return null;};}function saveUpdates(_0x3ae1b2){return function(_0x37d42e){if(_0x37d42e){return _0x37d42e[_0xf1f8('0xf')](_0x3ae1b2)['then'](function(_0x347435){return _0x347435;});}return null;};}function removeEntity(_0x1d66f7){return function(_0x1a2d7f){if(_0x1a2d7f){return _0x1a2d7f[_0xf1f8('0x10')]()[_0xf1f8('0x11')](function(){_0x1d66f7[_0xf1f8('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a30d){return function(_0x4378da){if(!_0x4378da){_0x51a30d['sendStatus'](0x194);}return _0x4378da;};}function handleError(_0x10387f,_0x222155){_0x222155=_0x222155||0x1f4;return function(_0x4e5b9d){logger['error'](_0x4e5b9d[_0xf1f8('0x12')]);if(_0x4e5b9d['name']){delete _0x4e5b9d[_0xf1f8('0x13')];}_0x10387f[_0xf1f8('0xc')](_0x222155)[_0xf1f8('0x14')](_0x4e5b9d);};}exports['index']=function(_0xd8761c,_0x4cc6fe){var _0x2f44d4={},_0x16d13c={},_0x1609e8={'count':0x0,'rows':[]};var _0x439bd4=_[_0xf1f8('0x15')](db[_0xf1f8('0x16')][_0xf1f8('0x17')],function(_0x556b51){return{'name':_0x556b51[_0xf1f8('0x18')],'type':_0x556b51['type'][_0xf1f8('0x19')]};});_0x16d13c[_0xf1f8('0x1a')]=_[_0xf1f8('0x15')](_0x439bd4,_0xf1f8('0x13'));_0x16d13c[_0xf1f8('0x1b')]=_[_0xf1f8('0x1c')](_0xd8761c['query']);_0x16d13c[_0xf1f8('0x1d')]=_['intersection'](_0x16d13c[_0xf1f8('0x1a')],_0x16d13c[_0xf1f8('0x1b')]);_0x2f44d4[_0xf1f8('0x1e')]=_[_0xf1f8('0x1f')](_0x16d13c[_0xf1f8('0x1a')],qs[_0xf1f8('0x20')](_0xd8761c[_0xf1f8('0x1b')][_0xf1f8('0x20')]));_0x2f44d4['attributes']=_0x2f44d4[_0xf1f8('0x1e')][_0xf1f8('0x21')]?_0x2f44d4[_0xf1f8('0x1e')]:_0x16d13c[_0xf1f8('0x1a')];if(!_0xd8761c[_0xf1f8('0x1b')][_0xf1f8('0x22')](_0xf1f8('0x23'))){_0x2f44d4['limit']=qs[_0xf1f8('0xa')](_0xd8761c['query'][_0xf1f8('0xa')]);_0x2f44d4[_0xf1f8('0x8')]=qs[_0xf1f8('0x8')](_0xd8761c[_0xf1f8('0x1b')][_0xf1f8('0x8')]);}_0x2f44d4[_0xf1f8('0x24')]=qs[_0xf1f8('0x25')](_0xd8761c[_0xf1f8('0x1b')][_0xf1f8('0x25')]);_0x2f44d4['where']=qs[_0xf1f8('0x1d')](_[_0xf1f8('0x26')](_0xd8761c[_0xf1f8('0x1b')],_0x16d13c['filters']),_0x439bd4);if(_0xd8761c[_0xf1f8('0x1b')][_0xf1f8('0x27')]){_0x2f44d4[_0xf1f8('0x28')]=_['merge'](_0x2f44d4[_0xf1f8('0x28')],{'$or':_[_0xf1f8('0x15')](_0x439bd4,function(_0x31b4de){if(_0x31b4de[_0xf1f8('0x29')]!==_0xf1f8('0x2a')){var _0x37a7dc={};_0x37a7dc[_0x31b4de[_0xf1f8('0x13')]]={'$like':'%'+_0xd8761c[_0xf1f8('0x1b')][_0xf1f8('0x27')]+'%'};return _0x37a7dc;}})});}_0x2f44d4=_[_0xf1f8('0x2b')]({},_0x2f44d4,_0xd8761c['options']);var _0x1c4c32={'where':_0x2f44d4['where']};return db[_0xf1f8('0x16')][_0xf1f8('0xb')](_0x1c4c32)[_0xf1f8('0x11')](function(_0x13329f){_0x1609e8[_0xf1f8('0xb')]=_0x13329f;if(_0xd8761c[_0xf1f8('0x1b')][_0xf1f8('0x2c')]){_0x2f44d4[_0xf1f8('0x2d')]=[{'all':!![]}];}return db[_0xf1f8('0x16')][_0xf1f8('0x2e')](_0x2f44d4);})['then'](function(_0x1982be){_0x1609e8[_0xf1f8('0x2f')]=_0x1982be;return _0x1609e8;})['then'](respondWithFilteredResult(_0x4cc6fe,_0x2f44d4))[_0xf1f8('0x30')](handleError(_0x4cc6fe,null));};exports['show']=function(_0x2f6499,_0x4d9256){var _0x5ee1bc={'raw':![],'where':{'id':_0x2f6499[_0xf1f8('0x31')]['id']}},_0x3845b6={};_0x3845b6['model']=_['keys'](db[_0xf1f8('0x16')][_0xf1f8('0x17')]);_0x3845b6[_0xf1f8('0x1b')]=_[_0xf1f8('0x1c')](_0x2f6499[_0xf1f8('0x1b')]);_0x3845b6[_0xf1f8('0x1d')]=_[_0xf1f8('0x1f')](_0x3845b6[_0xf1f8('0x1a')],_0x3845b6[_0xf1f8('0x1b')]);_0x5ee1bc[_0xf1f8('0x1e')]=_[_0xf1f8('0x1f')](_0x3845b6[_0xf1f8('0x1a')],qs[_0xf1f8('0x20')](_0x2f6499[_0xf1f8('0x1b')]['fields']));_0x5ee1bc['attributes']=_0x5ee1bc[_0xf1f8('0x1e')][_0xf1f8('0x21')]?_0x5ee1bc[_0xf1f8('0x1e')]:_0x3845b6[_0xf1f8('0x1a')];if(_0x2f6499['query']['includeAll']){_0x5ee1bc[_0xf1f8('0x2d')]=[{'all':!![]}];}_0x5ee1bc=_[_0xf1f8('0x2b')]({},_0x5ee1bc,_0x2f6499[_0xf1f8('0x32')]);return db[_0xf1f8('0x16')][_0xf1f8('0x33')](_0x5ee1bc)[_0xf1f8('0x11')](handleEntityNotFound(_0x4d9256,null))[_0xf1f8('0x11')](respondWithResult(_0x4d9256,null))[_0xf1f8('0x30')](handleError(_0x4d9256,null));};exports[_0xf1f8('0x34')]=function(_0x26a033,_0x32e85c){return db[_0xf1f8('0x16')][_0xf1f8('0x34')](_0x26a033[_0xf1f8('0x35')],{})[_0xf1f8('0x11')](respondWithResult(_0x32e85c,0xc9))[_0xf1f8('0x30')](handleError(_0x32e85c,null));};exports['update']=function(_0x5f1ba7,_0x2a0380){if(_0x5f1ba7[_0xf1f8('0x35')]['id']){delete _0x5f1ba7['body']['id'];}return db['Dynamics365Account'][_0xf1f8('0x33')]({'where':{'id':_0x5f1ba7[_0xf1f8('0x31')]['id']}})['then'](handleEntityNotFound(_0x2a0380,null))['then'](saveUpdates(_0x5f1ba7[_0xf1f8('0x35')],null))['then'](respondWithResult(_0x2a0380,null))[_0xf1f8('0x30')](handleError(_0x2a0380,null));};exports['destroy']=function(_0x98b9ab,_0x50d5b6){return db['Dynamics365Account']['find']({'where':{'id':_0x98b9ab[_0xf1f8('0x31')]['id']}})[_0xf1f8('0x11')](handleEntityNotFound(_0x50d5b6,null))['then'](removeEntity(_0x50d5b6,null))[_0xf1f8('0x30')](handleError(_0x50d5b6,null));};exports[_0xf1f8('0x36')]=function(_0x3ba07e,_0x3f7e54){var _0x26cef6={};var _0x445fc1={};var _0x2d4dc7;var _0x458f70;return db[_0xf1f8('0x16')][_0xf1f8('0x37')]({'where':{'id':_0x3ba07e[_0xf1f8('0x31')]['id']}})[_0xf1f8('0x11')](handleEntityNotFound(_0x3f7e54,null))[_0xf1f8('0x11')](function(_0x577f9e){if(_0x577f9e){_0x2d4dc7=_0x577f9e;_0x445fc1[_0xf1f8('0x1a')]=_['keys'](db[_0xf1f8('0x38')][_0xf1f8('0x17')]);_0x445fc1[_0xf1f8('0x1b')]=_[_0xf1f8('0x1c')](_0x3ba07e[_0xf1f8('0x1b')]);_0x445fc1[_0xf1f8('0x1d')]=_[_0xf1f8('0x1f')](_0x445fc1[_0xf1f8('0x1a')],_0x445fc1[_0xf1f8('0x1b')]);_0x26cef6['attributes']=_[_0xf1f8('0x1f')](_0x445fc1[_0xf1f8('0x1a')],qs[_0xf1f8('0x20')](_0x3ba07e[_0xf1f8('0x1b')][_0xf1f8('0x20')]));_0x26cef6[_0xf1f8('0x1e')]=_0x26cef6[_0xf1f8('0x1e')]['length']?_0x26cef6[_0xf1f8('0x1e')]:_0x445fc1[_0xf1f8('0x1a')];_0x26cef6[_0xf1f8('0x24')]=qs[_0xf1f8('0x25')](_0x3ba07e['query'][_0xf1f8('0x25')]);_0x26cef6['where']=qs[_0xf1f8('0x1d')](_[_0xf1f8('0x26')](_0x3ba07e[_0xf1f8('0x1b')],_0x445fc1[_0xf1f8('0x1d')]));if(_0x3ba07e[_0xf1f8('0x1b')]['filter']){_0x26cef6[_0xf1f8('0x28')]=_[_0xf1f8('0x2b')](_0x26cef6[_0xf1f8('0x28')],{'$or':_['map'](_0x26cef6[_0xf1f8('0x1e')],function(_0x37eee7){var _0x226efd={};_0x226efd[_0x37eee7]={'$like':'%'+_0x3ba07e['query'][_0xf1f8('0x27')]+'%'};return _0x226efd;})});}_0x26cef6=_[_0xf1f8('0x2b')]({},_0x26cef6,_0x3ba07e['options']);return _0x2d4dc7['getConfigurations'](_0x26cef6);}})[_0xf1f8('0x11')](function(_0x19bec0){if(_0x19bec0){_0x458f70=_0x19bec0[_0xf1f8('0x21')];if(!_0x3ba07e['query'][_0xf1f8('0x22')](_0xf1f8('0x23'))){_0x26cef6[_0xf1f8('0xa')]=qs[_0xf1f8('0xa')](_0x3ba07e[_0xf1f8('0x1b')]['limit']);_0x26cef6[_0xf1f8('0x8')]=qs['offset'](_0x3ba07e[_0xf1f8('0x1b')][_0xf1f8('0x8')]);}return _0x2d4dc7[_0xf1f8('0x36')](_0x26cef6);}})[_0xf1f8('0x11')](function(_0x3313d5){if(_0x3313d5){return _0x3313d5?{'count':_0x458f70,'rows':_0x3313d5}:null;}})['then'](respondWithResult(_0x3f7e54,null))[_0xf1f8('0x30')](handleError(_0x3f7e54,null));};exports[_0xf1f8('0x39')]=function(_0x4fe2ae,_0x545598){if(_0x4fe2ae['body']['id']){delete _0x4fe2ae[_0xf1f8('0x35')]['id'];}return db[_0xf1f8('0x16')][_0xf1f8('0x37')]({'where':{'id':_0x4fe2ae[_0xf1f8('0x31')]['id']}})[_0xf1f8('0x11')](handleEntityNotFound(_0x545598,null))['then'](function(_0xebbd51){if(_0xebbd51){_0x4fe2ae[_0xf1f8('0x35')][_0xf1f8('0x3a')]=_0xebbd51['id'];_0x4fe2ae[_0xf1f8('0x35')][_0xf1f8('0x3b')]=integrations[_0xf1f8('0x3c')](_0x4fe2ae['body'][_0xf1f8('0x3d')],_0x4fe2ae[_0xf1f8('0x35')]['type']);_0x4fe2ae[_0xf1f8('0x35')][_0xf1f8('0x3e')]=integrations[_0xf1f8('0x3f')](_0x4fe2ae[_0xf1f8('0x35')][_0xf1f8('0x3d')],_0x4fe2ae['body'][_0xf1f8('0x29')]);return db[_0xf1f8('0x38')]['create'](_0x4fe2ae[_0xf1f8('0x35')],{'include':[{'model':db[_0xf1f8('0x40')],'as':_0xf1f8('0x3b')},{'model':db[_0xf1f8('0x40')],'as':_0xf1f8('0x3e')}]});}return null;})[_0xf1f8('0x11')](respondWithResult(_0x545598,null))[_0xf1f8('0x30')](handleError(_0x545598,null));};function sanitizeRemoteUri(_0x37d633){var _0x2378f1=_0x37d633['slice'](-0x1);if(_0x2378f1==='/')return _0x37d633['substring'](0x0,_0x37d633[_0xf1f8('0x41')](_0x2378f1));return _0x37d633;}function getWebApiUrl(_0x3c7fee){return util[_0xf1f8('0x42')](_0xf1f8('0x43'),_0x3c7fee);}exports['getFields']=function(_0x4048ae,_0xdd8eda){var _0x568379=_0x4048ae[_0xf1f8('0x1b')][_0xf1f8('0x44')];var _0xa492db=_0x568379===_0xf1f8('0x45')?_0xf1f8('0x46'):_0xf1f8('0x47');var _0x2206bb='';var _0x5d1a14='';var _0x2f521c='';var _0x3a052f='';var _0x58331d='';var _0x433dba='';var _0x2befb2='';var _0x5beea6='';var _0x4007fb=[_0xf1f8('0x48'),_0xf1f8('0x49'),'customerid','ownerid',_0xf1f8('0x4a'),_0xf1f8('0x4b'),_0xf1f8('0x4c'),'regardingobjectid',_0xf1f8('0x4d'),_0xf1f8('0x4e')];var _0x4821f1=[_0xf1f8('0x4f'),'accountidyominame',_0xf1f8('0x50'),'billedserviceunits',_0xf1f8('0x51'),_0xf1f8('0x52'),_0xf1f8('0x53'),'contractidname',_0xf1f8('0x54'),_0xf1f8('0x55'),_0xf1f8('0x56'),_0xf1f8('0x57'),_0xf1f8('0x58'),_0xf1f8('0x59'),_0xf1f8('0x5a'),'customeridname',_0xf1f8('0x5b'),_0xf1f8('0x5c'),'emailaddress',_0xf1f8('0x5d'),_0xf1f8('0x5e'),'entityimage_url','escalatedon',_0xf1f8('0x5f'),'firstresponsebykpiidname',_0xf1f8('0x60'),'importsequencenumber','influencescore',_0xf1f8('0x61'),_0xf1f8('0x62'),_0xf1f8('0x63'),_0xf1f8('0x64'),'modifiedbyexternalpartyyominame',_0xf1f8('0x65'),_0xf1f8('0x66'),_0xf1f8('0x67'),'modifiedonbehalfbyname',_0xf1f8('0x68'),_0xf1f8('0x69'),_0xf1f8('0x6a'),_0xf1f8('0x6b'),_0xf1f8('0x6c'),'overriddencreatedon',_0xf1f8('0x6d'),_0xf1f8('0x6e'),_0xf1f8('0x6f'),_0xf1f8('0x70'),_0xf1f8('0x71'),_0xf1f8('0x72'),'prioritycodename',_0xf1f8('0x73'),_0xf1f8('0x74'),_0xf1f8('0x75'),'resolvebykpiidname','responseby','responsiblecontactidname',_0xf1f8('0x76'),'sentimentvalue',_0xf1f8('0x77'),_0xf1f8('0x78'),'socialprofileidname',_0xf1f8('0x79'),_0xf1f8('0x7a'),'subjectidname',_0xf1f8('0x7b'),_0xf1f8('0x7c'),_0xf1f8('0x7d'),_0xf1f8('0x7e'),_0xf1f8('0x7f'),_0xf1f8('0x80')];var _0x4b74e2=_0x4007fb[_0xf1f8('0x81')](_0x4821f1);return db[_0xf1f8('0x16')][_0xf1f8('0x37')]({'where':{'id':_0x4048ae['params']['id']},'attributes':['id',_0xf1f8('0x82'),_0xf1f8('0x83'),_0xf1f8('0x84'),'tenantId',_0xf1f8('0x85'),_0xf1f8('0x86'),_0xf1f8('0x87')],'include':[{'model':db[_0xf1f8('0x88')],'as':'CloudProvider','attributes':['id',_0xf1f8('0x89'),_0xf1f8('0x8a')]}]})['then'](handleEntityNotFound(_0xdd8eda,null))[_0xf1f8('0x11')](function(_0x42c5a1){if(_0x42c5a1){if(_0x42c5a1[_0xf1f8('0x87')]){_0x42c5a1[_0xf1f8('0x8b')]=_0x42c5a1[_0xf1f8('0x88')][_0xf1f8('0x89')];_0x5beea6=sanitizeRemoteUri(_0x42c5a1['CloudProvider'][_0xf1f8('0x8a')]);_0x2befb2=getWebApiUrl(_0x5beea6);return _0x42c5a1;}_0x5beea6=sanitizeRemoteUri(_0x42c5a1[_0xf1f8('0x84')]);_0x2befb2=getWebApiUrl(_0x5beea6);var _0x1ed9d0={'method':'POST','uri':_0xf1f8('0x8c')+_0x42c5a1[_0xf1f8('0x8d')]+_0xf1f8('0x8e'),'form':{'client_id':_0x42c5a1['clientId'],'resource':_0x5beea6,'username':_0x42c5a1[_0xf1f8('0x82')],'password':_0x42c5a1[_0xf1f8('0x83')],'grant_type':_0xf1f8('0x83'),'client_secret':_0x42c5a1['clientSecret']},'json':!![]};return rp(_0x1ed9d0);}})[_0xf1f8('0x11')](function(_0xcc839a){_0x433dba=_0xcc839a['access_token'];var _0x19a6b1={'method':_0xf1f8('0x8f'),'uri':encodeURI(_0x2befb2+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0xa492db+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x433dba,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x19a6b1);})[_0xf1f8('0x11')](function(_0x53de13){var _0x219e58=_0x53de13['value'][0x0];var _0x470cad=_0x219e58[_0xf1f8('0x90')];var _0x3ef764={'method':'GET','uri':_0x2befb2+'EntityDefinitions('+_0x470cad+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xf1f8('0x91')+_0x433dba,'If-None-Match':null,'OData-Version':_0xf1f8('0x92')},'json':!![]};return rp(_0x3ef764);})['then'](function(_0x46e0c9){_0x2206bb=_0x46e0c9;_0x5d1a14=_0x2206bb['Attributes'];_0x5d1a14=_['remove'](_0x5d1a14,function(_0x29c61f){return!_0x4b74e2[_0xf1f8('0x93')](_0x29c61f['LogicalName']);});var _0x41fa06=[];var _0x6e9e3c=[];_0x5d1a14[_0xf1f8('0x94')](function(_0x4cbb74){if(_0x4cbb74['@odata.type']){var _0x51cb1d=_0x4cbb74[_0xf1f8('0x95')][_0xf1f8('0x96')](_0x4cbb74['@odata.type'][_0xf1f8('0x41')]('.')+0x1);if(_0x51cb1d===_0xf1f8('0x97')){_0x41fa06[_0xf1f8('0x98')](getSelectList(_0x2befb2,_0x568379,_0x6e9e3c,_0x2206bb['MetadataId'],_0x4cbb74[_0xf1f8('0x90')],_0x433dba));}}});return Promise[_0xf1f8('0x99')](_0x41fa06);})['then'](function(_0x4b54dc){_0x2f521c=_0x4b54dc[0x0];var _0x164da2=[];var _0x236cde=[];_0x5d1a14['forEach'](function(_0x30dd74){if(!_['isNil'](_0x30dd74[_0xf1f8('0x95')])){var _0xebdd6a=_0x30dd74['@odata.type'][_0xf1f8('0x96')](_0x30dd74[_0xf1f8('0x95')][_0xf1f8('0x41')]('.')+0x1);if(_0xebdd6a===_0xf1f8('0x9a')){_0x164da2[_0xf1f8('0x98')](getBooleanList(_0x2befb2,_0x568379,_0x236cde,_0x2206bb['MetadataId'],_0x30dd74[_0xf1f8('0x90')],_0x433dba));}}});return Promise['all'](_0x164da2);})[_0xf1f8('0x11')](function(_0x519f31){_0x3a052f=_0x519f31[0x0];var _0x349bac=[];var _0x4ef17d=[];_0x5d1a14[_0xf1f8('0x94')](function(_0x5b8744){if(_0x5b8744['@odata.type']){var _0x340ee7=_0x5b8744[_0xf1f8('0x95')][_0xf1f8('0x96')](_0x5b8744[_0xf1f8('0x95')][_0xf1f8('0x41')]('.')+0x1);if(_0x340ee7==='StringAttributeMetadata'||_0x340ee7===_0xf1f8('0x9b')||_0x340ee7==='BigIntAttributeMetadata'||_0x340ee7===_0xf1f8('0x9c')||_0x340ee7===_0xf1f8('0x9d')||_0x340ee7===_0xf1f8('0x9e')||_0x340ee7===_0xf1f8('0x9f')||_0x340ee7===_0xf1f8('0xa0')||_0x340ee7===_0xf1f8('0xa1')||_0x340ee7===_0xf1f8('0xa2')){_0x349bac['push'](getInputList(_0x2befb2,_0x568379,_0x340ee7,_0x4ef17d,_0x2206bb['MetadataId'],_0x5b8744[_0xf1f8('0x90')],_0x433dba));}}});return Promise[_0xf1f8('0x99')](_0x349bac);})[_0xf1f8('0x11')](function(_0x51c2c5){_0x58331d=_0x51c2c5[0x0];var _0x242877=_0x2f521c[_0xf1f8('0x81')](_0x3a052f)['concat'](_0x58331d);var _0x4e2c8c={'count':_0x242877[_0xf1f8('0x21')],'rows':_0x242877};return _0x4e2c8c;})['then'](respondWithResult(_0xdd8eda,null))[_0xf1f8('0x30')](function(_0xf5bcf7){var _0x2f00d4=_0x4048ae[_0xf1f8('0x1b')][_0xf1f8('0xa3')]?0x1f4:_0xf5bcf7[_0xf1f8('0xa4')]||0x1f4;logger[_0xf1f8('0xa5')](_0xf5bcf7[_0xf1f8('0x12')]);delete _0xf5bcf7[_0xf1f8('0x13')];if(_0x2f00d4===0x191){_0x2f00d4=0x190;}_0xdd8eda[_0xf1f8('0xc')](_0x2f00d4)[_0xf1f8('0x14')](_0x4048ae[_0xf1f8('0x1b')][_0xf1f8('0xa3')]?{'message':'Wrong\x20credentials','statusCode':_0xf5bcf7['statusCode']}:_0xf5bcf7);});};function getSelectList(_0x204b8d,_0xcb0d7a,_0x74467c,_0x293886,_0x3b18eb,_0x324b6e){var _0x149958={'method':'GET','uri':_0x204b8d+_0xf1f8('0xa6')+_0x293886+_0xf1f8('0xa7')+_0x3b18eb+_0xf1f8('0xa8')+_0xf1f8('0xa9'),'headers':{'Authorization':_0xf1f8('0x91')+_0x324b6e,'If-None-Match':null,'OData-Version':_0xf1f8('0x92')},'json':!![]};return rp(_0x149958)[_0xf1f8('0x11')](function(_0x474041){var _0x4acdd5=[];var _0x1209b=_0x474041[_0xf1f8('0xaa')]['Options'];_0x1209b[_0xf1f8('0x94')](function(_0x28b52e){_0x4acdd5[_0xf1f8('0x98')]({'name':_0x28b52e[_0xf1f8('0xab')][_0xf1f8('0xac')][_0xf1f8('0xab')],'value':String(_0x28b52e[_0xf1f8('0xad')])});});var _0x4bdf2c={'id':_0xcb0d7a+'_'+_0x474041['LogicalName'],'name':_0x474041[_0xf1f8('0xae')]['UserLocalizedLabel'][_0xf1f8('0xab')],'custom':![],'options':_0x4acdd5};_0x74467c['push'](_0x4bdf2c);return _0x74467c;});}function getBooleanList(_0x177f6e,_0x196763,_0x201c12,_0x25a9a8,_0x3a627f,_0x36454a){var _0x2e080c={'method':_0xf1f8('0x8f'),'uri':_0x177f6e+_0xf1f8('0xa6')+_0x25a9a8+_0xf1f8('0xa7')+_0x3a627f+_0xf1f8('0xaf'),'headers':{'Authorization':_0xf1f8('0x91')+_0x36454a,'If-None-Match':null,'OData-Version':_0xf1f8('0x92')},'json':!![]};return rp(_0x2e080c)[_0xf1f8('0x11')](function(_0x327231){var _0x18197d=[];_0x18197d['push']({'name':_0x327231[_0xf1f8('0xaa')][_0xf1f8('0xb0')][_0xf1f8('0xab')][_0xf1f8('0xac')]['Label'],'value':_0xf1f8('0xb1')},{'name':_0x327231[_0xf1f8('0xaa')][_0xf1f8('0xb2')][_0xf1f8('0xab')][_0xf1f8('0xac')][_0xf1f8('0xab')],'value':_0xf1f8('0xb3')});var _0x2d9a9e={'id':_0x196763+'_'+_0x327231[_0xf1f8('0xb4')],'name':_0x327231[_0xf1f8('0xae')][_0xf1f8('0xac')][_0xf1f8('0xab')],'custom':![],'options':_0x18197d};_0x201c12[_0xf1f8('0x98')](_0x2d9a9e);return _0x201c12;});}function getInputList(_0x4032ec,_0x4821da,_0x4a140d,_0x3c3445,_0x1334e9,_0x1820dc,_0x3636d1){var _0xc7e5bb={'method':_0xf1f8('0x8f'),'uri':_0x4032ec+'EntityDefinitions('+_0x1334e9+_0xf1f8('0xa7')+_0x1820dc+_0xf1f8('0xb5')+_0x4a140d+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xf1f8('0x91')+_0x3636d1,'If-None-Match':null,'OData-Version':_0xf1f8('0x92')},'json':!![]};return rp(_0xc7e5bb)[_0xf1f8('0x11')](function(_0x3dabf7){var _0x27e3f6={'id':_0x4821da+'_'+_0x3dabf7[_0xf1f8('0xb4')],'name':_0x3dabf7['DisplayName'][_0xf1f8('0xac')]?_0x3dabf7[_0xf1f8('0xae')]['UserLocalizedLabel'][_0xf1f8('0xab')]:_0x3dabf7[_0xf1f8('0xb4')],'custom':![],'options':[]};_0x3c3445[_0xf1f8('0x98')](_0x27e3f6);return _0x3c3445;});}
\ No newline at end of file
+var _0x20d6=['statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','remoteUri','POST','https://login.microsoftonline.com/','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','push','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','Dynamics365Account','rawAttributes','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','findOne','getConfigurations','hasOwnProperty','nolimit','Subjects','channel','Descriptions','Dynamics365Field','slice','lastIndexOf','format','getFields','ticketType','incident','PhoneCall','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode'];(function(_0x4bd38f,_0x3ef83b){var _0x525542=function(_0x51d424){while(--_0x51d424){_0x4bd38f['push'](_0x4bd38f['shift']());}};_0x525542(++_0x3ef83b);}(_0x20d6,0x1b8));var _0x620d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x20d6[_0x2dafbe];return _0x58a45a;};'use strict';var rp=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var _=require(_0x620d('0x2'));var qs=require(_0x620d('0x3'));var logger=require('../../config/logger')(_0x620d('0x4'));var db=require(_0x620d('0x5'))['db'];var integrations=require(_0x620d('0x6'));function respondWithResult(_0x37ef4e,_0xe56e86){_0xe56e86=_0xe56e86||0xc8;return function(_0x38b12d){if(_0x38b12d){return _0x37ef4e[_0x620d('0x7')](_0xe56e86)[_0x620d('0x8')](_0x38b12d);}};}function respondWithFilteredResult(_0x28e29a,_0x3aa4f3){return function(_0x260d43){if(_0x260d43){var _0x52657f=typeof _0x3aa4f3[_0x620d('0x9')]==='undefined'&&typeof _0x3aa4f3['limit']===_0x620d('0xa');var _0x473790=_0x260d43[_0x620d('0xb')];var _0x4325de=_0x52657f?0x0:_0x3aa4f3[_0x620d('0x9')];var _0x420803=_0x52657f?_0x260d43['count']:_0x3aa4f3[_0x620d('0x9')]+_0x3aa4f3[_0x620d('0xc')];var _0x498358;if(_0x420803>=_0x473790){_0x420803=_0x473790;_0x498358=0xc8;}else{_0x498358=0xce;}_0x28e29a[_0x620d('0x7')](_0x498358);return _0x28e29a[_0x620d('0xd')](_0x620d('0xe'),_0x4325de+'-'+_0x420803+'/'+_0x473790)[_0x620d('0x8')](_0x260d43);}return null;};}function saveUpdates(_0x15f37c){return function(_0x347939){if(_0x347939){return _0x347939[_0x620d('0xf')](_0x15f37c)[_0x620d('0x10')](function(_0x55867d){return _0x55867d;});}return null;};}function removeEntity(_0x329e22){return function(_0x312502){if(_0x312502){return _0x312502[_0x620d('0x11')]()[_0x620d('0x10')](function(){_0x329e22[_0x620d('0x7')](0xcc)['end']();});}};}function handleEntityNotFound(_0x502812){return function(_0x5c3c68){if(!_0x5c3c68){_0x502812[_0x620d('0x12')](0x194);}return _0x5c3c68;};}function handleError(_0x5a74cc,_0x35f368){_0x35f368=_0x35f368||0x1f4;return function(_0x20a91e){logger[_0x620d('0x13')](_0x20a91e[_0x620d('0x14')]);if(_0x20a91e[_0x620d('0x15')]){delete _0x20a91e[_0x620d('0x15')];}_0x5a74cc[_0x620d('0x7')](_0x35f368)['send'](_0x20a91e);};}exports['index']=function(_0x4538f3,_0x4e4e1e){var _0x52f8a8={},_0x933c8f={},_0x5bc792={'count':0x0,'rows':[]};var _0x437970=_['map'](db[_0x620d('0x16')][_0x620d('0x17')],function(_0x4d8640){return{'name':_0x4d8640['fieldName'],'type':_0x4d8640[_0x620d('0x18')][_0x620d('0x19')]};});_0x933c8f[_0x620d('0x1a')]=_[_0x620d('0x1b')](_0x437970,_0x620d('0x15'));_0x933c8f['query']=_[_0x620d('0x1c')](_0x4538f3['query']);_0x933c8f[_0x620d('0x1d')]=_[_0x620d('0x1e')](_0x933c8f[_0x620d('0x1a')],_0x933c8f[_0x620d('0x1f')]);_0x52f8a8[_0x620d('0x20')]=_[_0x620d('0x1e')](_0x933c8f[_0x620d('0x1a')],qs[_0x620d('0x21')](_0x4538f3[_0x620d('0x1f')][_0x620d('0x21')]));_0x52f8a8[_0x620d('0x20')]=_0x52f8a8[_0x620d('0x20')][_0x620d('0x22')]?_0x52f8a8[_0x620d('0x20')]:_0x933c8f[_0x620d('0x1a')];if(!_0x4538f3[_0x620d('0x1f')]['hasOwnProperty']('nolimit')){_0x52f8a8[_0x620d('0xc')]=qs['limit'](_0x4538f3[_0x620d('0x1f')][_0x620d('0xc')]);_0x52f8a8[_0x620d('0x9')]=qs[_0x620d('0x9')](_0x4538f3[_0x620d('0x1f')][_0x620d('0x9')]);}_0x52f8a8[_0x620d('0x23')]=qs[_0x620d('0x24')](_0x4538f3[_0x620d('0x1f')][_0x620d('0x24')]);_0x52f8a8[_0x620d('0x25')]=qs['filters'](_[_0x620d('0x26')](_0x4538f3[_0x620d('0x1f')],_0x933c8f[_0x620d('0x1d')]),_0x437970);if(_0x4538f3[_0x620d('0x1f')][_0x620d('0x27')]){_0x52f8a8[_0x620d('0x25')]=_['merge'](_0x52f8a8[_0x620d('0x25')],{'$or':_[_0x620d('0x1b')](_0x437970,function(_0x540b74){if(_0x540b74[_0x620d('0x18')]!=='VIRTUAL'){var _0x427c27={};_0x427c27[_0x540b74[_0x620d('0x15')]]={'$like':'%'+_0x4538f3[_0x620d('0x1f')][_0x620d('0x27')]+'%'};return _0x427c27;}})});}_0x52f8a8=_[_0x620d('0x28')]({},_0x52f8a8,_0x4538f3[_0x620d('0x29')]);var _0x56df55={'where':_0x52f8a8[_0x620d('0x25')]};return db[_0x620d('0x16')]['count'](_0x56df55)[_0x620d('0x10')](function(_0x13f736){_0x5bc792[_0x620d('0xb')]=_0x13f736;if(_0x4538f3[_0x620d('0x1f')][_0x620d('0x2a')]){_0x52f8a8['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x620d('0x2b')](_0x52f8a8);})[_0x620d('0x10')](function(_0x55ab45){_0x5bc792[_0x620d('0x2c')]=_0x55ab45;return _0x5bc792;})[_0x620d('0x10')](respondWithFilteredResult(_0x4e4e1e,_0x52f8a8))[_0x620d('0x2d')](handleError(_0x4e4e1e,null));};exports[_0x620d('0x2e')]=function(_0xb3d28a,_0x4caf46){var _0x20a621={'raw':![],'where':{'id':_0xb3d28a[_0x620d('0x2f')]['id']}},_0x3287b3={};_0x3287b3[_0x620d('0x1a')]=_[_0x620d('0x1c')](db[_0x620d('0x16')]['rawAttributes']);_0x3287b3[_0x620d('0x1f')]=_[_0x620d('0x1c')](_0xb3d28a[_0x620d('0x1f')]);_0x3287b3[_0x620d('0x1d')]=_[_0x620d('0x1e')](_0x3287b3[_0x620d('0x1a')],_0x3287b3['query']);_0x20a621[_0x620d('0x20')]=_['intersection'](_0x3287b3[_0x620d('0x1a')],qs[_0x620d('0x21')](_0xb3d28a[_0x620d('0x1f')]['fields']));_0x20a621[_0x620d('0x20')]=_0x20a621[_0x620d('0x20')]['length']?_0x20a621[_0x620d('0x20')]:_0x3287b3[_0x620d('0x1a')];if(_0xb3d28a[_0x620d('0x1f')][_0x620d('0x2a')]){_0x20a621[_0x620d('0x30')]=[{'all':!![]}];}_0x20a621=_[_0x620d('0x28')]({},_0x20a621,_0xb3d28a['options']);return db[_0x620d('0x16')]['find'](_0x20a621)['then'](handleEntityNotFound(_0x4caf46,null))['then'](respondWithResult(_0x4caf46,null))[_0x620d('0x2d')](handleError(_0x4caf46,null));};exports[_0x620d('0x31')]=function(_0x303f55,_0x246dfc){return db['Dynamics365Account'][_0x620d('0x31')](_0x303f55[_0x620d('0x32')],{})[_0x620d('0x10')](respondWithResult(_0x246dfc,0xc9))[_0x620d('0x2d')](handleError(_0x246dfc,null));};exports[_0x620d('0xf')]=function(_0x5ccccd,_0x21c8b2){if(_0x5ccccd[_0x620d('0x32')]['id']){delete _0x5ccccd[_0x620d('0x32')]['id'];}return db[_0x620d('0x16')]['find']({'where':{'id':_0x5ccccd[_0x620d('0x2f')]['id']}})['then'](handleEntityNotFound(_0x21c8b2,null))[_0x620d('0x10')](saveUpdates(_0x5ccccd[_0x620d('0x32')],null))['then'](respondWithResult(_0x21c8b2,null))['catch'](handleError(_0x21c8b2,null));};exports[_0x620d('0x11')]=function(_0x2debf5,_0x34b47c){return db['Dynamics365Account']['find']({'where':{'id':_0x2debf5[_0x620d('0x2f')]['id']}})[_0x620d('0x10')](handleEntityNotFound(_0x34b47c,null))['then'](removeEntity(_0x34b47c,null))['catch'](handleError(_0x34b47c,null));};exports['getConfigurations']=function(_0x2840c3,_0x4c5863){var _0x26369b={};var _0x265d61={};var _0x3eb1ce;var _0xf6900;return db[_0x620d('0x16')][_0x620d('0x33')]({'where':{'id':_0x2840c3[_0x620d('0x2f')]['id']}})[_0x620d('0x10')](handleEntityNotFound(_0x4c5863,null))[_0x620d('0x10')](function(_0x4398b2){if(_0x4398b2){_0x3eb1ce=_0x4398b2;_0x265d61[_0x620d('0x1a')]=_[_0x620d('0x1c')](db['Dynamics365Configuration']['rawAttributes']);_0x265d61[_0x620d('0x1f')]=_[_0x620d('0x1c')](_0x2840c3['query']);_0x265d61['filters']=_[_0x620d('0x1e')](_0x265d61[_0x620d('0x1a')],_0x265d61[_0x620d('0x1f')]);_0x26369b[_0x620d('0x20')]=_[_0x620d('0x1e')](_0x265d61[_0x620d('0x1a')],qs['fields'](_0x2840c3[_0x620d('0x1f')][_0x620d('0x21')]));_0x26369b[_0x620d('0x20')]=_0x26369b[_0x620d('0x20')][_0x620d('0x22')]?_0x26369b['attributes']:_0x265d61[_0x620d('0x1a')];_0x26369b[_0x620d('0x23')]=qs[_0x620d('0x24')](_0x2840c3[_0x620d('0x1f')][_0x620d('0x24')]);_0x26369b[_0x620d('0x25')]=qs[_0x620d('0x1d')](_[_0x620d('0x26')](_0x2840c3['query'],_0x265d61[_0x620d('0x1d')]));if(_0x2840c3[_0x620d('0x1f')][_0x620d('0x27')]){_0x26369b[_0x620d('0x25')]=_[_0x620d('0x28')](_0x26369b[_0x620d('0x25')],{'$or':_['map'](_0x26369b[_0x620d('0x20')],function(_0x18f8d8){var _0x28e1d9={};_0x28e1d9[_0x18f8d8]={'$like':'%'+_0x2840c3[_0x620d('0x1f')]['filter']+'%'};return _0x28e1d9;})});}_0x26369b=_[_0x620d('0x28')]({},_0x26369b,_0x2840c3[_0x620d('0x29')]);return _0x3eb1ce[_0x620d('0x34')](_0x26369b);}})['then'](function(_0x3f2503){if(_0x3f2503){_0xf6900=_0x3f2503[_0x620d('0x22')];if(!_0x2840c3['query'][_0x620d('0x35')](_0x620d('0x36'))){_0x26369b[_0x620d('0xc')]=qs[_0x620d('0xc')](_0x2840c3[_0x620d('0x1f')][_0x620d('0xc')]);_0x26369b[_0x620d('0x9')]=qs['offset'](_0x2840c3[_0x620d('0x1f')][_0x620d('0x9')]);}return _0x3eb1ce['getConfigurations'](_0x26369b);}})[_0x620d('0x10')](function(_0x297e6f){if(_0x297e6f){return _0x297e6f?{'count':_0xf6900,'rows':_0x297e6f}:null;}})['then'](respondWithResult(_0x4c5863,null))[_0x620d('0x2d')](handleError(_0x4c5863,null));};exports['addConfiguration']=function(_0x253836,_0x2b4d0f){if(_0x253836[_0x620d('0x32')]['id']){delete _0x253836['body']['id'];}return db[_0x620d('0x16')][_0x620d('0x33')]({'where':{'id':_0x253836[_0x620d('0x2f')]['id']}})[_0x620d('0x10')](handleEntityNotFound(_0x2b4d0f,null))[_0x620d('0x10')](function(_0x38cba2){if(_0x38cba2){_0x253836[_0x620d('0x32')]['AccountId']=_0x38cba2['id'];_0x253836['body'][_0x620d('0x37')]=integrations['getSubjects'](_0x253836[_0x620d('0x32')][_0x620d('0x38')],_0x253836['body'][_0x620d('0x18')]);_0x253836[_0x620d('0x32')][_0x620d('0x39')]=integrations['getDescriptions'](_0x253836['body']['channel'],_0x253836[_0x620d('0x32')][_0x620d('0x18')]);return db['Dynamics365Configuration']['create'](_0x253836[_0x620d('0x32')],{'include':[{'model':db[_0x620d('0x3a')],'as':'Subjects'},{'model':db[_0x620d('0x3a')],'as':_0x620d('0x39')}]});}return null;})['then'](respondWithResult(_0x2b4d0f,null))[_0x620d('0x2d')](handleError(_0x2b4d0f,null));};function sanitizeRemoteUri(_0x299e7a){var _0xcea65=_0x299e7a[_0x620d('0x3b')](-0x1);if(_0xcea65==='/')return _0x299e7a['substring'](0x0,_0x299e7a[_0x620d('0x3c')](_0xcea65));return _0x299e7a;}function getWebApiUrl(_0x5af25a){return util[_0x620d('0x3d')]('%s/api/data/v9.0/',_0x5af25a);}exports[_0x620d('0x3e')]=function(_0x1a1af0,_0x3d07d4){var _0x6639cf=_0x1a1af0[_0x620d('0x1f')][_0x620d('0x3f')];var _0x3b760a=_0x6639cf===_0x620d('0x40')?'Incident':_0x620d('0x41');var _0x4c42bc='';var _0x25b1af='';var _0x386540='';var _0x33d923='';var _0x1760ed='';var _0x48bb3a='';var _0x59f539='';var _0x33a9e5='';var _0x12ce51=[_0x620d('0x42'),_0x620d('0x43'),'customerid',_0x620d('0x44'),_0x620d('0x45'),_0x620d('0x46'),_0x620d('0x47'),_0x620d('0x48'),_0x620d('0x49'),_0x620d('0x4a')];var _0x332066=[_0x620d('0x4b'),_0x620d('0x4c'),_0x620d('0x4d'),_0x620d('0x4e'),_0x620d('0x4f'),_0x620d('0x50'),_0x620d('0x51'),_0x620d('0x52'),_0x620d('0x53'),'createdbyexternalpartyyominame',_0x620d('0x54'),_0x620d('0x55'),_0x620d('0x56'),_0x620d('0x57'),_0x620d('0x58'),_0x620d('0x59'),'customeridtype',_0x620d('0x5a'),'emailaddress','entitlementidname',_0x620d('0x5b'),_0x620d('0x5c'),_0x620d('0x5d'),_0x620d('0x5e'),_0x620d('0x5f'),_0x620d('0x60'),_0x620d('0x61'),_0x620d('0x62'),'kbarticleidname',_0x620d('0x63'),_0x620d('0x64'),'modifiedbyexternalpartyname',_0x620d('0x65'),_0x620d('0x66'),'modifiedbyyominame',_0x620d('0x67'),_0x620d('0x68'),_0x620d('0x69'),_0x620d('0x6a'),_0x620d('0x6b'),_0x620d('0x6c'),_0x620d('0x6d'),_0x620d('0x6e'),_0x620d('0x6f'),_0x620d('0x70'),'owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber',_0x620d('0x71'),_0x620d('0x72'),'responseby',_0x620d('0x73'),_0x620d('0x74'),'sentimentvalue',_0x620d('0x75'),_0x620d('0x76'),_0x620d('0x77'),_0x620d('0x78'),_0x620d('0x79'),_0x620d('0x7a'),'ticketnumber',_0x620d('0x7b'),_0x620d('0x7c'),_0x620d('0x7d'),_0x620d('0x7e'),'versionnumber'];var _0x868330=_0x12ce51[_0x620d('0x7f')](_0x332066);return db[_0x620d('0x16')][_0x620d('0x33')]({'where':{'id':_0x1a1af0[_0x620d('0x2f')]['id']},'attributes':['id',_0x620d('0x80'),_0x620d('0x81'),'remoteUri',_0x620d('0x82'),_0x620d('0x83'),_0x620d('0x84'),_0x620d('0x85')],'include':[{'model':db['CloudProvider'],'as':_0x620d('0x86'),'attributes':['id',_0x620d('0x87'),_0x620d('0x88')]}]})['then'](handleEntityNotFound(_0x3d07d4,null))[_0x620d('0x10')](function(_0x4ca050){if(_0x4ca050){if(_0x4ca050[_0x620d('0x85')]){_0x4ca050[_0x620d('0x89')]=_0x4ca050['CloudProvider'][_0x620d('0x87')];_0x33a9e5=sanitizeRemoteUri(_0x4ca050[_0x620d('0x86')][_0x620d('0x88')]);_0x59f539=getWebApiUrl(_0x33a9e5);return _0x4ca050;}_0x33a9e5=sanitizeRemoteUri(_0x4ca050[_0x620d('0x8a')]);_0x59f539=getWebApiUrl(_0x33a9e5);var _0x54b5dd={'method':_0x620d('0x8b'),'uri':_0x620d('0x8c')+_0x4ca050['tenantId']+_0x620d('0x8d'),'form':{'client_id':_0x4ca050['clientId'],'resource':_0x33a9e5,'username':_0x4ca050[_0x620d('0x80')],'password':_0x4ca050['password'],'grant_type':_0x620d('0x81'),'client_secret':_0x4ca050[_0x620d('0x84')]},'json':!![]};return rp(_0x54b5dd);}})['then'](function(_0x1f5924){_0x48bb3a=_0x1f5924[_0x620d('0x89')];var _0x322c9e={'method':'GET','uri':encodeURI(_0x59f539+_0x620d('0x8e')+_0x3b760a+'\x27'),'headers':{'Authorization':_0x620d('0x8f')+_0x48bb3a,'If-None-Match':null,'OData-Version':_0x620d('0x90')},'json':!![]};return rp(_0x322c9e);})[_0x620d('0x10')](function(_0x342323){var _0x1cf073=_0x342323[_0x620d('0x91')][0x0];var _0x21ba75=_0x1cf073[_0x620d('0x92')];var _0x4c0073={'method':_0x620d('0x93'),'uri':_0x59f539+_0x620d('0x94')+_0x21ba75+_0x620d('0x95'),'headers':{'Authorization':_0x620d('0x8f')+_0x48bb3a,'If-None-Match':null,'OData-Version':_0x620d('0x90')},'json':!![]};return rp(_0x4c0073);})[_0x620d('0x10')](function(_0x58f13e){_0x4c42bc=_0x58f13e;_0x25b1af=_0x4c42bc[_0x620d('0x96')];_0x25b1af=_[_0x620d('0x97')](_0x25b1af,function(_0xef9780){return!_0x868330[_0x620d('0x98')](_0xef9780[_0x620d('0x99')]);});var _0x4a8061=[];var _0x4ffc72=[];_0x25b1af[_0x620d('0x9a')](function(_0x3eeded){if(_0x3eeded[_0x620d('0x9b')]){var _0x27e853=_0x3eeded['@odata.type'][_0x620d('0x9c')](_0x3eeded[_0x620d('0x9b')][_0x620d('0x3c')]('.')+0x1);if(_0x27e853===_0x620d('0x9d')){_0x4a8061['push'](getSelectList(_0x59f539,_0x6639cf,_0x4ffc72,_0x4c42bc[_0x620d('0x92')],_0x3eeded[_0x620d('0x92')],_0x48bb3a));}}});return Promise['all'](_0x4a8061);})[_0x620d('0x10')](function(_0x169970){_0x386540=_0x169970[0x0];var _0x1f8247=[];var _0x4ccddb=[];_0x25b1af['forEach'](function(_0x1ed85b){if(!_[_0x620d('0x9e')](_0x1ed85b['@odata.type'])){var _0x3462e4=_0x1ed85b[_0x620d('0x9b')][_0x620d('0x9c')](_0x1ed85b['@odata.type'][_0x620d('0x3c')]('.')+0x1);if(_0x3462e4===_0x620d('0x9f')){_0x1f8247['push'](getBooleanList(_0x59f539,_0x6639cf,_0x4ccddb,_0x4c42bc['MetadataId'],_0x1ed85b[_0x620d('0x92')],_0x48bb3a));}}});return Promise[_0x620d('0xa0')](_0x1f8247);})[_0x620d('0x10')](function(_0x17f294){_0x33d923=_0x17f294[0x0];var _0x2cb9cd=[];var _0x5c3c6a=[];_0x25b1af[_0x620d('0x9a')](function(_0x365d8c){if(_0x365d8c['@odata.type']){var _0x5845e3=_0x365d8c[_0x620d('0x9b')][_0x620d('0x9c')](_0x365d8c[_0x620d('0x9b')][_0x620d('0x3c')]('.')+0x1);if(_0x5845e3===_0x620d('0xa1')||_0x5845e3===_0x620d('0xa2')||_0x5845e3===_0x620d('0xa3')||_0x5845e3==='IntegerAttributeMetadata'||_0x5845e3===_0x620d('0xa4')||_0x5845e3===_0x620d('0xa5')||_0x5845e3==='StatusAttributeMetadata'||_0x5845e3===_0x620d('0xa6')||_0x5845e3==='StateAttributeMetadata'||_0x5845e3===_0x620d('0xa7')){_0x2cb9cd['push'](getInputList(_0x59f539,_0x6639cf,_0x5845e3,_0x5c3c6a,_0x4c42bc['MetadataId'],_0x365d8c[_0x620d('0x92')],_0x48bb3a));}}});return Promise[_0x620d('0xa0')](_0x2cb9cd);})[_0x620d('0x10')](function(_0x32cda1){_0x1760ed=_0x32cda1[0x0];var _0x10f510=_0x386540[_0x620d('0x7f')](_0x33d923)[_0x620d('0x7f')](_0x1760ed);var _0x44839={'count':_0x10f510[_0x620d('0x22')],'rows':_0x10f510};return _0x44839;})[_0x620d('0x10')](respondWithResult(_0x3d07d4,null))['catch'](function(_0x538b83){var _0x2c07bb=_0x1a1af0[_0x620d('0x1f')][_0x620d('0xa8')]?0x1f4:_0x538b83[_0x620d('0xa9')]||0x1f4;logger[_0x620d('0x13')](_0x538b83[_0x620d('0x14')]);delete _0x538b83['name'];if(_0x2c07bb===0x191){_0x2c07bb=0x190;}_0x3d07d4[_0x620d('0x7')](_0x2c07bb)['send'](_0x1a1af0[_0x620d('0x1f')][_0x620d('0xa8')]?{'message':_0x620d('0xaa'),'statusCode':_0x538b83[_0x620d('0xa9')]}:_0x538b83);});};function getSelectList(_0x1fbd0d,_0x10e53b,_0x31c321,_0x496d12,_0x364646,_0x15e807){var _0x50182a={'method':_0x620d('0x93'),'uri':_0x1fbd0d+'EntityDefinitions('+_0x496d12+_0x620d('0xab')+_0x364646+_0x620d('0xac')+_0x620d('0xad'),'headers':{'Authorization':_0x620d('0x8f')+_0x15e807,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x50182a)[_0x620d('0x10')](function(_0xefc712){var _0x4c050c=[];var _0xfa1802=_0xefc712[_0x620d('0xae')][_0x620d('0xaf')];_0xfa1802[_0x620d('0x9a')](function(_0x31f6dd){_0x4c050c[_0x620d('0xb0')]({'name':_0x31f6dd[_0x620d('0xb1')][_0x620d('0xb2')][_0x620d('0xb1')],'value':String(_0x31f6dd[_0x620d('0xb3')])});});var _0x26cfc5={'id':_0x10e53b+'_'+_0xefc712[_0x620d('0x99')],'name':_0xefc712['DisplayName'][_0x620d('0xb2')][_0x620d('0xb1')],'custom':![],'options':_0x4c050c};_0x31c321['push'](_0x26cfc5);return _0x31c321;});}function getBooleanList(_0x514770,_0x3fdc59,_0x5322af,_0x4ff50f,_0x2e9ec5,_0x224e95){var _0x449240={'method':_0x620d('0x93'),'uri':_0x514770+_0x620d('0x94')+_0x4ff50f+')/Attributes('+_0x2e9ec5+_0x620d('0xb4'),'headers':{'Authorization':_0x620d('0x8f')+_0x224e95,'If-None-Match':null,'OData-Version':_0x620d('0x90')},'json':!![]};return rp(_0x449240)[_0x620d('0x10')](function(_0x1aff11){var _0x1b52c0=[];_0x1b52c0[_0x620d('0xb0')]({'name':_0x1aff11['OptionSet']['TrueOption'][_0x620d('0xb1')][_0x620d('0xb2')][_0x620d('0xb1')],'value':_0x620d('0xb5')},{'name':_0x1aff11[_0x620d('0xae')][_0x620d('0xb6')][_0x620d('0xb1')][_0x620d('0xb2')]['Label'],'value':_0x620d('0xb7')});var _0x850423={'id':_0x3fdc59+'_'+_0x1aff11['LogicalName'],'name':_0x1aff11[_0x620d('0xb8')][_0x620d('0xb2')][_0x620d('0xb1')],'custom':![],'options':_0x1b52c0};_0x5322af[_0x620d('0xb0')](_0x850423);return _0x5322af;});}function getInputList(_0x5884d9,_0x2e7395,_0x3aacc2,_0x6fc433,_0x219be1,_0x4c4202,_0x27477f){var _0xad537f={'method':_0x620d('0x93'),'uri':_0x5884d9+_0x620d('0x94')+_0x219be1+')/Attributes('+_0x4c4202+_0x620d('0xb9')+_0x3aacc2+_0x620d('0xba'),'headers':{'Authorization':_0x620d('0x8f')+_0x27477f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xad537f)['then'](function(_0x444724){var _0x28b136={'id':_0x2e7395+'_'+_0x444724[_0x620d('0x99')],'name':_0x444724[_0x620d('0xb8')][_0x620d('0xb2')]?_0x444724[_0x620d('0xb8')][_0x620d('0xb2')]['Label']:_0x444724['LogicalName'],'custom':![],'options':[]};_0x6fc433[_0x620d('0xb0')](_0x28b136);return _0x6fc433;});}
\ No newline at end of file
index 73a1e80..2052a23 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x5ebc04,_0x14a363){var _0x17845c=function(_0x360850){while(--_0x360850){_0x5ebc04['push'](_0x5ebc04['shift']());}};_0x17845c(++_0x14a363);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0xfdaa2c,_0x27b789){var _0x58619f=function(_0x1baa06){while(--_0x1baa06){_0xfdaa2c['push'](_0xfdaa2c['shift']());}};_0x58619f(++_0x27b789);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0xcb91[_0x510c60];return _0x49c4aa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c9375af..7830bd6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x74fe=['request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowDynamics365Account','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x74fe,0x130));var _0xe74f=function(_0x3f7981,_0x1cd7ef){_0x3f7981=_0x3f7981-0x0;var _0x3c5b85=_0x74fe[_0x3f7981];return _0x3c5b85;};'use strict';var _=require(_0xe74f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe74f('0x1'));var fs=require('fs');var Redis=require(_0xe74f('0x2'));var db=require(_0xe74f('0x3'))['db'];var utils=require(_0xe74f('0x4'));var logger=require(_0xe74f('0x5'))(_0xe74f('0x6'));var config=require(_0xe74f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe74f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x270083,_0x147649,_0xa3ea5c){return new BPromise(function(_0x34eb7d,_0x5860d2){return client[_0xe74f('0x9')](_0x270083,_0xa3ea5c)['then'](function(_0x47e389){logger[_0xe74f('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x147649,_0xe74f('0xb'));logger[_0xe74f('0xc')](_0xe74f('0xd'),_0x147649,_0xe74f('0xb'),JSON[_0xe74f('0xe')](_0x47e389));if(_0x47e389['error']){if(_0x47e389[_0xe74f('0xf')][_0xe74f('0x10')]===0x1f4){logger[_0xe74f('0xf')](_0xe74f('0x11'),_0x147649,_0x47e389[_0xe74f('0xf')][_0xe74f('0x12')]);return _0x5860d2(_0x47e389[_0xe74f('0xf')][_0xe74f('0x12')]);}logger[_0xe74f('0xf')](_0xe74f('0x11'),_0x147649,_0x47e389[_0xe74f('0xf')]['message']);return _0x34eb7d(_0x47e389[_0xe74f('0xf')]['message']);}else{logger['info'](_0xe74f('0x11'),_0x147649,'request\x20sent');_0x34eb7d(_0x47e389[_0xe74f('0x13')][_0xe74f('0x12')]);}})[_0xe74f('0x14')](function(_0x407646){logger[_0xe74f('0xf')](_0xe74f('0x11'),_0x147649,_0x407646);_0x5860d2(_0x407646);});});}exports[_0xe74f('0x15')]=function(_0x2d5f0a){var _0x578680=this;return new Promise(function(_0x2eb08f,_0x47c220){return db[_0xe74f('0x16')][_0xe74f('0x17')]({'raw':_0x2d5f0a[_0xe74f('0x18')]?_0x2d5f0a[_0xe74f('0x18')][_0xe74f('0x19')]===undefined?!![]:![]:!![],'where':_0x2d5f0a[_0xe74f('0x18')]?_0x2d5f0a[_0xe74f('0x18')][_0xe74f('0x1a')]||null:null,'attributes':_0x2d5f0a[_0xe74f('0x18')]?_0x2d5f0a['options'][_0xe74f('0x1b')]||null:null,'limit':_0x2d5f0a[_0xe74f('0x18')]?_0x2d5f0a[_0xe74f('0x18')][_0xe74f('0x1c')]||null:null,'include':_0x2d5f0a[_0xe74f('0x18')]?_0x2d5f0a[_0xe74f('0x18')][_0xe74f('0x1d')]?_[_0xe74f('0x1e')](_0x2d5f0a[_0xe74f('0x18')]['include'],function(_0x5b8263){return{'model':db[_0x5b8263['model']],'as':_0x5b8263['as'],'attributes':_0x5b8263[_0xe74f('0x1b')],'include':_0x5b8263[_0xe74f('0x1d')]?_[_0xe74f('0x1e')](_0x5b8263[_0xe74f('0x1d')],function(_0x149b0c){return{'model':db[_0x149b0c['model']],'as':_0x149b0c['as'],'attributes':_0x149b0c['attributes'],'include':_0x149b0c[_0xe74f('0x1d')]?_[_0xe74f('0x1e')](_0x149b0c[_0xe74f('0x1d')],function(_0x9a8dba){return{'model':db[_0x9a8dba[_0xe74f('0x1f')]],'as':_0x9a8dba['as'],'attributes':_0x9a8dba['attributes']};}):[]};}):[]};}):[]:[]})[_0xe74f('0x20')](function(_0x58a839){logger[_0xe74f('0xa')](_0xe74f('0x15'),_0x2d5f0a);logger[_0xe74f('0xc')](_0xe74f('0x15'),_0x2d5f0a,JSON[_0xe74f('0xe')](_0x58a839));_0x2eb08f(_0x58a839);})[_0xe74f('0x14')](function(_0x2cc027){logger[_0xe74f('0xf')](_0xe74f('0x15'),_0x2cc027[_0xe74f('0x12')],_0x2d5f0a);_0x47c220(_0x578680[_0xe74f('0xf')](0x1f4,_0x2cc027[_0xe74f('0x12')]));});});};exports['ShowDynamics365Account']=function(_0x196a3a){var _0x4e31ea=this;return new Promise(function(_0x24dc7,_0x3e0c47){return db[_0xe74f('0x16')][_0xe74f('0x21')]({'raw':_0x196a3a['options']?_0x196a3a[_0xe74f('0x18')][_0xe74f('0x19')]===undefined?!![]:![]:!![],'where':_0x196a3a['options']?_0x196a3a['options'][_0xe74f('0x1a')]||null:null,'attributes':_0x196a3a['options']?_0x196a3a[_0xe74f('0x18')][_0xe74f('0x1b')]||null:null,'include':_0x196a3a[_0xe74f('0x18')]?_0x196a3a[_0xe74f('0x18')][_0xe74f('0x1d')]?_['map'](_0x196a3a[_0xe74f('0x18')][_0xe74f('0x1d')],function(_0x1e6672){return{'model':db[_0x1e6672[_0xe74f('0x1f')]],'as':_0x1e6672['as'],'attributes':_0x1e6672[_0xe74f('0x1b')],'include':_0x1e6672[_0xe74f('0x1d')]?_['map'](_0x1e6672[_0xe74f('0x1d')],function(_0x3e5ff2){return{'model':db[_0x3e5ff2[_0xe74f('0x1f')]],'as':_0x3e5ff2['as'],'attributes':_0x3e5ff2[_0xe74f('0x1b')],'include':_0x3e5ff2[_0xe74f('0x1d')]?_[_0xe74f('0x1e')](_0x3e5ff2['include'],function(_0x40943d){return{'model':db[_0x40943d['model']],'as':_0x40943d['as'],'attributes':_0x40943d[_0xe74f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe74f('0x20')](function(_0x34fa6a){logger[_0xe74f('0xa')]('ShowDynamics365Account',_0x196a3a);logger['debug']('ShowDynamics365Account',_0x196a3a,JSON[_0xe74f('0xe')](_0x34fa6a));_0x24dc7(_0x34fa6a);})[_0xe74f('0x14')](function(_0xace0e6){logger['error'](_0xe74f('0x22'),_0xace0e6[_0xe74f('0x12')],_0x196a3a);_0x3e0c47(_0x4e31ea[_0xe74f('0xf')](0x1f4,_0xace0e6['message']));});});};
\ No newline at end of file
+var _0x64e9=['debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x20a1b0,_0x18fe84){var _0x321e14=function(_0x69fdf6){while(--_0x69fdf6){_0x20a1b0['push'](_0x20a1b0['shift']());}};_0x321e14(++_0x18fe84);}(_0x64e9,0x1b9));var _0x964e=function(_0x3ba4ef,_0x2667e9){_0x3ba4ef=_0x3ba4ef-0x0;var _0x35edf9=_0x64e9[_0x3ba4ef];return _0x35edf9;};'use strict';var _=require(_0x964e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x964e('0x1'));var rs=require(_0x964e('0x2'));var fs=require('fs');var Redis=require(_0x964e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x964e('0x4'));var logger=require(_0x964e('0x5'))(_0x964e('0x6'));var config=require(_0x964e('0x7'));var jayson=require(_0x964e('0x8'));var client=jayson['client'][_0x964e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x545479,_0x5ccf72,_0x50d388){return new BPromise(function(_0x67a46a,_0x12e722){return client[_0x964e('0xa')](_0x545479,_0x50d388)[_0x964e('0xb')](function(_0x36574b){logger[_0x964e('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x5ccf72,_0x964e('0xd'));logger[_0x964e('0xe')](_0x964e('0xf'),_0x5ccf72,'request\x20sent',JSON[_0x964e('0x10')](_0x36574b));if(_0x36574b[_0x964e('0x11')]){if(_0x36574b[_0x964e('0x11')][_0x964e('0x12')]===0x1f4){logger[_0x964e('0x11')](_0x964e('0x13'),_0x5ccf72,_0x36574b[_0x964e('0x11')]['message']);return _0x12e722(_0x36574b[_0x964e('0x11')][_0x964e('0x14')]);}logger[_0x964e('0x11')](_0x964e('0x13'),_0x5ccf72,_0x36574b[_0x964e('0x11')][_0x964e('0x14')]);return _0x67a46a(_0x36574b[_0x964e('0x11')][_0x964e('0x14')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x5ccf72,_0x964e('0xd'));_0x67a46a(_0x36574b[_0x964e('0x15')][_0x964e('0x14')]);}})[_0x964e('0x16')](function(_0x38747b){logger[_0x964e('0x11')](_0x964e('0x13'),_0x5ccf72,_0x38747b);_0x12e722(_0x38747b);});});}exports['GetDynamics365Account']=function(_0x3d913f){var _0x3d64ce=this;return new Promise(function(_0x34fefc,_0x399308){return db[_0x964e('0x17')][_0x964e('0x18')]({'raw':_0x3d913f[_0x964e('0x19')]?_0x3d913f[_0x964e('0x19')][_0x964e('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d913f[_0x964e('0x19')]?_0x3d913f['options'][_0x964e('0x1b')]||null:null,'attributes':_0x3d913f['options']?_0x3d913f[_0x964e('0x19')][_0x964e('0x1c')]||null:null,'limit':_0x3d913f[_0x964e('0x19')]?_0x3d913f['options'][_0x964e('0x1d')]||null:null,'include':_0x3d913f['options']?_0x3d913f[_0x964e('0x19')][_0x964e('0x1e')]?_[_0x964e('0x1f')](_0x3d913f[_0x964e('0x19')][_0x964e('0x1e')],function(_0x5229c6){return{'model':db[_0x5229c6['model']],'as':_0x5229c6['as'],'attributes':_0x5229c6[_0x964e('0x1c')],'include':_0x5229c6['include']?_['map'](_0x5229c6[_0x964e('0x1e')],function(_0x285a01){return{'model':db[_0x285a01[_0x964e('0x20')]],'as':_0x285a01['as'],'attributes':_0x285a01[_0x964e('0x1c')],'include':_0x285a01[_0x964e('0x1e')]?_[_0x964e('0x1f')](_0x285a01[_0x964e('0x1e')],function(_0x1aeeb4){return{'model':db[_0x1aeeb4[_0x964e('0x20')]],'as':_0x1aeeb4['as'],'attributes':_0x1aeeb4[_0x964e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x964e('0xb')](function(_0x4e8aa8){logger[_0x964e('0xc')]('GetDynamics365Account',_0x3d913f);logger[_0x964e('0xe')](_0x964e('0x21'),_0x3d913f,JSON['stringify'](_0x4e8aa8));_0x34fefc(_0x4e8aa8);})[_0x964e('0x16')](function(_0xe10b86){logger['error']('GetDynamics365Account',_0xe10b86[_0x964e('0x14')],_0x3d913f);_0x399308(_0x3d64ce[_0x964e('0x11')](0x1f4,_0xe10b86[_0x964e('0x14')]));});});};exports[_0x964e('0x22')]=function(_0x293ee7){var _0x4d7dc3=this;return new Promise(function(_0xcf6f60,_0x980c){return db[_0x964e('0x17')]['find']({'raw':_0x293ee7[_0x964e('0x19')]?_0x293ee7[_0x964e('0x19')][_0x964e('0x1a')]===undefined?!![]:![]:!![],'where':_0x293ee7[_0x964e('0x19')]?_0x293ee7['options'][_0x964e('0x1b')]||null:null,'attributes':_0x293ee7[_0x964e('0x19')]?_0x293ee7[_0x964e('0x19')][_0x964e('0x1c')]||null:null,'include':_0x293ee7[_0x964e('0x19')]?_0x293ee7[_0x964e('0x19')]['include']?_[_0x964e('0x1f')](_0x293ee7['options'][_0x964e('0x1e')],function(_0x23207b){return{'model':db[_0x23207b[_0x964e('0x20')]],'as':_0x23207b['as'],'attributes':_0x23207b[_0x964e('0x1c')],'include':_0x23207b['include']?_[_0x964e('0x1f')](_0x23207b[_0x964e('0x1e')],function(_0x1b01e6){return{'model':db[_0x1b01e6['model']],'as':_0x1b01e6['as'],'attributes':_0x1b01e6[_0x964e('0x1c')],'include':_0x1b01e6[_0x964e('0x1e')]?_[_0x964e('0x1f')](_0x1b01e6[_0x964e('0x1e')],function(_0x24aca9){return{'model':db[_0x24aca9['model']],'as':_0x24aca9['as'],'attributes':_0x24aca9['attributes']};}):[]};}):[]};}):[]:[]})[_0x964e('0xb')](function(_0x23506a){logger[_0x964e('0xc')](_0x964e('0x22'),_0x293ee7);logger[_0x964e('0xe')](_0x964e('0x22'),_0x293ee7,JSON[_0x964e('0x10')](_0x23506a));_0xcf6f60(_0x23506a);})['catch'](function(_0x1ac7e3){logger[_0x964e('0x11')]('ShowDynamics365Account',_0x1ac7e3[_0x964e('0x14')],_0x293ee7);_0x980c(_0x4d7dc3['error'](0x1f4,_0x1ac7e3[_0x964e('0x14')]));});});};
\ No newline at end of file
index 339ef2e..5aed144 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcf37=['isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get'];(function(_0x4280d2,_0x596883){var _0x25a9ad=function(_0x2a9d8e){while(--_0x2a9d8e){_0x4280d2['push'](_0x4280d2['shift']());}};_0x25a9ad(++_0x596883);}(_0xcf37,0xdc));var _0x7cf3=function(_0x591f3d,_0xc63190){_0x591f3d=_0x591f3d-0x0;var _0x344743=_0xcf37[_0x591f3d];return _0x344743;};'use strict';var multer=require('multer');var util=require(_0x7cf3('0x0'));var path=require(_0x7cf3('0x1'));var timeout=require(_0x7cf3('0x2'));var express=require(_0x7cf3('0x3'));var router=express[_0x7cf3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7cf3('0x5'));var interaction=require(_0x7cf3('0x6'));var config=require(_0x7cf3('0x7'));var controller=require(_0x7cf3('0x8'));router[_0x7cf3('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x7cf3('0xa')](),controller[_0x7cf3('0xb')]);router[_0x7cf3('0x9')]('/:id/fields',auth[_0x7cf3('0xa')](),controller[_0x7cf3('0xc')]);router[_0x7cf3('0x9')](_0x7cf3('0xd'),auth[_0x7cf3('0xa')](),controller[_0x7cf3('0xe')]);router['get'](_0x7cf3('0xf'),auth[_0x7cf3('0xa')](),controller[_0x7cf3('0x10')]);router[_0x7cf3('0x11')]('/',auth[_0x7cf3('0xa')](),controller['create']);router[_0x7cf3('0x12')]('/:id',auth[_0x7cf3('0xa')](),controller['update']);router[_0x7cf3('0x13')](_0x7cf3('0x14'),auth['isAuthenticated'](),controller[_0x7cf3('0x15')]);module[_0x7cf3('0x16')]=router;
\ No newline at end of file
+var _0xecf5=['/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','/:id','destroy','exports','util','path','express','Router','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index'];(function(_0x1bd377,_0xbf88d6){var _0x2ef6a0=function(_0x50a5b0){while(--_0x50a5b0){_0x1bd377['push'](_0x1bd377['shift']());}};_0x2ef6a0(++_0xbf88d6);}(_0xecf5,0x1c5));var _0x5ecf=function(_0x18d7aa,_0x494c2a){_0x18d7aa=_0x18d7aa-0x0;var _0x175f36=_0xecf5[_0x18d7aa];return _0x175f36;};'use strict';var multer=require('multer');var util=require(_0x5ecf('0x0'));var path=require(_0x5ecf('0x1'));var timeout=require('connect-timeout');var express=require(_0x5ecf('0x2'));var router=express[_0x5ecf('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5ecf('0x4'));var controller=require(_0x5ecf('0x5'));router[_0x5ecf('0x6')]('/',auth[_0x5ecf('0x7')](),controller[_0x5ecf('0x8')]);router[_0x5ecf('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5ecf('0x6')](_0x5ecf('0x9'),auth[_0x5ecf('0x7')](),controller['getFields']);router[_0x5ecf('0x6')](_0x5ecf('0xa'),auth[_0x5ecf('0x7')](),controller[_0x5ecf('0xb')]);router[_0x5ecf('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x5ecf('0xc')]);router[_0x5ecf('0xd')]('/',auth[_0x5ecf('0x7')](),controller[_0x5ecf('0xe')]);router[_0x5ecf('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5ecf('0x10')]);router[_0x5ecf('0x11')](_0x5ecf('0x12'),auth['isAuthenticated'](),controller[_0x5ecf('0x13')]);module[_0x5ecf('0x14')]=router;
\ No newline at end of file
index 4dd75b8..e086a75 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3ca0=['contact','nothing','BOOLEAN','sequelize','exports','STRING','incident','phonecall'];(function(_0x2f09ce,_0x4a11c9){var _0x54a24c=function(_0xb88dcc){while(--_0xb88dcc){_0x2f09ce['push'](_0x2f09ce['shift']());}};_0x54a24c(++_0x4a11c9);}(_0x3ca0,0x103));var _0x03ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ca0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x03ca('0x0'));module[_0x03ca('0x1')]={'name':{'type':Sequelize[_0x03ca('0x2')]},'description':{'type':Sequelize[_0x03ca('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x03ca('0x3'),_0x03ca('0x4')),'defaultValue':_0x03ca('0x3')},'moduleCreate':{'type':Sequelize['ENUM'](_0x03ca('0x5'),_0x03ca('0x6')),'defaultValue':_0x03ca('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x03ca('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x03ca('0x7')],'defaultValue':!![]}};
\ No newline at end of file
+var _0xfbc9=['contact','nothing','sequelize','STRING','ENUM','incident','phonecall'];(function(_0x1141a2,_0x165358){var _0x2098a6=function(_0x46a85e){while(--_0x46a85e){_0x1141a2['push'](_0x1141a2['shift']());}};_0x2098a6(++_0x165358);}(_0xfbc9,0xb8));var _0x9fbc=function(_0xb881be,_0x6b8050){_0xb881be=_0xb881be-0x0;var _0x87b985=_0xfbc9[_0xb881be];return _0x87b985;};'use strict';var Sequelize=require(_0x9fbc('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9fbc('0x1')]},'ticketType':{'type':Sequelize[_0x9fbc('0x2')](_0x9fbc('0x3'),_0x9fbc('0x4')),'defaultValue':_0x9fbc('0x3')},'moduleCreate':{'type':Sequelize[_0x9fbc('0x2')](_0x9fbc('0x5'),_0x9fbc('0x6')),'defaultValue':_0x9fbc('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x9fbc('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}};
\ No newline at end of file
index 0a5266b..bd43ede 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1a05=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','end','error','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','findOne','Dynamics365Field','getFields','getSubjects','getDescriptions','eml-format','rimraf','request-promise','bluebird','path'];(function(_0x2fe994,_0x37ec28){var _0x26dfbb=function(_0x11c986){while(--_0x11c986){_0x2fe994['push'](_0x2fe994['shift']());}};_0x26dfbb(++_0x37ec28);}(_0x1a05,0x9d));var _0x51a0=function(_0x2b0bb0,_0x53fcb0){_0x2b0bb0=_0x2b0bb0-0x0;var _0x375933=_0x1a05[_0x2b0bb0];return _0x375933;};'use strict';var emlformat=require(_0x51a0('0x0'));var rimraf=require(_0x51a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x51a0('0x2'));var moment=require('moment');var BPromise=require(_0x51a0('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x51a0('0x4'));var sox=require('sox');var csv=require(_0x51a0('0x5'));var ejs=require(_0x51a0('0x6'));var fs=require('fs');var fs_extra=require(_0x51a0('0x7'));var _=require(_0x51a0('0x8'));var squel=require(_0x51a0('0x9'));var crypto=require(_0x51a0('0xa'));var jsforce=require(_0x51a0('0xb'));var deskjs=require(_0x51a0('0xc'));var toCsv=require(_0x51a0('0x5'));var querystring=require(_0x51a0('0xd'));var Papa=require('papaparse');var Redis=require(_0x51a0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x51a0('0xf'));var as=require(_0x51a0('0x10'));var hardwareService=require(_0x51a0('0x11'));var logger=require(_0x51a0('0x12'))(_0x51a0('0x13'));var utils=require(_0x51a0('0x14'));var config=require(_0x51a0('0x15'));var licenseUtil=require(_0x51a0('0x16'));var db=require(_0x51a0('0x17'))['db'];function respondWithStatusCode(_0x217510,_0x1e7426){_0x1e7426=_0x1e7426||0xcc;return function(_0x217b2d){if(_0x217b2d){return _0x217510[_0x51a0('0x18')](_0x1e7426);}return _0x217510[_0x51a0('0x19')](_0x1e7426)['end']();};}function respondWithResult(_0xdceb01,_0x45a37a){_0x45a37a=_0x45a37a||0xc8;return function(_0x33f8ed){if(_0x33f8ed){return _0xdceb01['status'](_0x45a37a)[_0x51a0('0x1a')](_0x33f8ed);}};}function respondWithFilteredResult(_0x2eaba4,_0x53472c){return function(_0x2fc893){if(_0x2fc893){var _0x58237f=typeof _0x53472c['offset']===_0x51a0('0x1b')&&typeof _0x53472c[_0x51a0('0x1c')]===_0x51a0('0x1b');var _0x4a789f=_0x2fc893[_0x51a0('0x1d')];var _0x4d0418=_0x58237f?0x0:_0x53472c['offset'];var _0xa27563=_0x58237f?_0x2fc893['count']:_0x53472c[_0x51a0('0x1e')]+_0x53472c['limit'];var _0x2d3360;if(_0xa27563>=_0x4a789f){_0xa27563=_0x4a789f;_0x2d3360=0xc8;}else{_0x2d3360=0xce;}_0x2eaba4[_0x51a0('0x19')](_0x2d3360);return _0x2eaba4[_0x51a0('0x1f')](_0x51a0('0x20'),_0x4d0418+'-'+_0xa27563+'/'+_0x4a789f)['json'](_0x2fc893);}return null;};}function patchUpdates(_0x3b6c29){return function(_0x2535cf){try{jsonpatch['apply'](_0x2535cf,_0x3b6c29,!![]);}catch(_0x35d97a){return BPromise[_0x51a0('0x21')](_0x35d97a);}return _0x2535cf[_0x51a0('0x22')]();};}function saveUpdates(_0x16c532,_0x2ace3e){return function(_0x29382b){if(_0x29382b){return _0x29382b['update'](_0x16c532)[_0x51a0('0x23')](function(_0x4d3b10){return _0x4d3b10;});}return null;};}function removeEntity(_0x5b9e38,_0x110f04){return function(_0x16afd2){if(_0x16afd2){return _0x16afd2[_0x51a0('0x24')]()[_0x51a0('0x23')](function(){_0x5b9e38[_0x51a0('0x19')](0xcc)[_0x51a0('0x25')]();});}};}function handleEntityNotFound(_0x31ea31,_0x24b148){return function(_0xff3aa3){if(!_0xff3aa3){_0x31ea31[_0x51a0('0x18')](0x194);}return _0xff3aa3;};}function handleError(_0x2a8141,_0x49fd93){_0x49fd93=_0x49fd93||0x1f4;return function(_0x2a9841){logger[_0x51a0('0x26')](_0x2a9841['stack']);if(_0x2a9841['name']){delete _0x2a9841['name'];}_0x2a8141[_0x51a0('0x19')](_0x49fd93)[_0x51a0('0x27')](_0x2a9841);};}exports[_0x51a0('0x28')]=function(_0x19ffe1,_0x5f178d){var _0x35e17b={},_0x1f0a64={},_0x49468c={'count':0x0,'rows':[]};var _0x294765=_[_0x51a0('0x29')](db[_0x51a0('0x2a')][_0x51a0('0x2b')],function(_0x3da815){return{'name':_0x3da815[_0x51a0('0x2c')],'type':_0x3da815[_0x51a0('0x2d')][_0x51a0('0x2e')]};});_0x1f0a64[_0x51a0('0x2f')]=_[_0x51a0('0x29')](_0x294765,_0x51a0('0x30'));_0x1f0a64[_0x51a0('0x31')]=_[_0x51a0('0x32')](_0x19ffe1[_0x51a0('0x31')]);_0x1f0a64[_0x51a0('0x33')]=_[_0x51a0('0x34')](_0x1f0a64[_0x51a0('0x2f')],_0x1f0a64[_0x51a0('0x31')]);_0x35e17b[_0x51a0('0x35')]=_[_0x51a0('0x34')](_0x1f0a64[_0x51a0('0x2f')],qs[_0x51a0('0x36')](_0x19ffe1[_0x51a0('0x31')][_0x51a0('0x36')]));_0x35e17b[_0x51a0('0x35')]=_0x35e17b['attributes'][_0x51a0('0x37')]?_0x35e17b[_0x51a0('0x35')]:_0x1f0a64[_0x51a0('0x2f')];if(!_0x19ffe1['query'][_0x51a0('0x38')](_0x51a0('0x39'))){_0x35e17b['limit']=qs[_0x51a0('0x1c')](_0x19ffe1[_0x51a0('0x31')][_0x51a0('0x1c')]);_0x35e17b['offset']=qs['offset'](_0x19ffe1[_0x51a0('0x31')][_0x51a0('0x1e')]);}_0x35e17b[_0x51a0('0x3a')]=qs[_0x51a0('0x3b')](_0x19ffe1[_0x51a0('0x31')]['sort']);_0x35e17b['where']=qs[_0x51a0('0x33')](_[_0x51a0('0x3c')](_0x19ffe1[_0x51a0('0x31')],_0x1f0a64[_0x51a0('0x33')]),_0x294765);if(_0x19ffe1[_0x51a0('0x31')][_0x51a0('0x3d')]){_0x35e17b[_0x51a0('0x3e')]=_[_0x51a0('0x3f')](_0x35e17b[_0x51a0('0x3e')],{'$or':_[_0x51a0('0x29')](_0x294765,function(_0x2e2f49){if(_0x2e2f49['type']!==_0x51a0('0x40')){var _0x440c66={};_0x440c66[_0x2e2f49['name']]={'$like':'%'+_0x19ffe1[_0x51a0('0x31')][_0x51a0('0x3d')]+'%'};return _0x440c66;}})});}_0x35e17b=_[_0x51a0('0x3f')]({},_0x35e17b,_0x19ffe1[_0x51a0('0x41')]);var _0x368ab3={'where':_0x35e17b[_0x51a0('0x3e')]};return db[_0x51a0('0x2a')]['count'](_0x368ab3)[_0x51a0('0x23')](function(_0x2615ff){_0x49468c[_0x51a0('0x1d')]=_0x2615ff;if(_0x19ffe1[_0x51a0('0x31')][_0x51a0('0x42')]){_0x35e17b['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x51a0('0x43')](_0x35e17b);})['then'](function(_0x3dd86b){_0x49468c[_0x51a0('0x44')]=_0x3dd86b;return _0x49468c;})[_0x51a0('0x23')](respondWithFilteredResult(_0x5f178d,_0x35e17b))[_0x51a0('0x45')](handleError(_0x5f178d,null));};exports[_0x51a0('0x46')]=function(_0x5aa209,_0x2f61e4){var _0xc270ae={'raw':![],'where':{'id':_0x5aa209[_0x51a0('0x47')]['id']}},_0x5e6ea7={};_0x5e6ea7['model']=_[_0x51a0('0x32')](db[_0x51a0('0x2a')][_0x51a0('0x2b')]);_0x5e6ea7[_0x51a0('0x31')]=_[_0x51a0('0x32')](_0x5aa209[_0x51a0('0x31')]);_0x5e6ea7[_0x51a0('0x33')]=_['intersection'](_0x5e6ea7[_0x51a0('0x2f')],_0x5e6ea7['query']);_0xc270ae[_0x51a0('0x35')]=_['intersection'](_0x5e6ea7[_0x51a0('0x2f')],qs[_0x51a0('0x36')](_0x5aa209['query'][_0x51a0('0x36')]));_0xc270ae['attributes']=_0xc270ae[_0x51a0('0x35')]['length']?_0xc270ae['attributes']:_0x5e6ea7[_0x51a0('0x2f')];if(_0x5aa209[_0x51a0('0x31')]['includeAll']){_0xc270ae[_0x51a0('0x48')]=[{'all':!![]}];}_0xc270ae=_[_0x51a0('0x3f')]({},_0xc270ae,_0x5aa209[_0x51a0('0x41')]);return db[_0x51a0('0x2a')][_0x51a0('0x49')](_0xc270ae)['then'](handleEntityNotFound(_0x2f61e4,null))[_0x51a0('0x23')](respondWithResult(_0x2f61e4,null))['catch'](handleError(_0x2f61e4,null));};exports[_0x51a0('0x4a')]=function(_0x5ef406,_0x359d1a){return db[_0x51a0('0x2a')][_0x51a0('0x4a')](_0x5ef406['body'],{})[_0x51a0('0x23')](respondWithResult(_0x359d1a,0xc9))[_0x51a0('0x45')](handleError(_0x359d1a,null));};exports['update']=function(_0x333ad2,_0x103ec3){if(_0x333ad2[_0x51a0('0x4b')]['id']){delete _0x333ad2[_0x51a0('0x4b')]['id'];}return db[_0x51a0('0x2a')]['find']({'where':{'id':_0x333ad2[_0x51a0('0x47')]['id']}})['then'](handleEntityNotFound(_0x103ec3,null))[_0x51a0('0x23')](saveUpdates(_0x333ad2['body'],null))[_0x51a0('0x23')](respondWithResult(_0x103ec3,null))[_0x51a0('0x45')](handleError(_0x103ec3,null));};exports[_0x51a0('0x24')]=function(_0x103313,_0x7285ea){return db[_0x51a0('0x2a')]['find']({'where':{'id':_0x103313[_0x51a0('0x47')]['id']}})[_0x51a0('0x23')](handleEntityNotFound(_0x7285ea,null))[_0x51a0('0x23')](removeEntity(_0x7285ea,null))['catch'](handleError(_0x7285ea,null));};exports['getFields']=function(_0xd7bfd,_0x3530c5,_0xf73b33){var _0x11ffce={};var _0x203e59={};var _0x23f340;var _0x30b90a;return db[_0x51a0('0x2a')][_0x51a0('0x4c')]({'where':{'id':_0xd7bfd[_0x51a0('0x47')]['id']}})[_0x51a0('0x23')](handleEntityNotFound(_0x3530c5,null))[_0x51a0('0x23')](function(_0x526151){if(_0x526151){_0x23f340=_0x526151;_0x203e59[_0x51a0('0x2f')]=_[_0x51a0('0x32')](db[_0x51a0('0x4d')][_0x51a0('0x2b')]);_0x203e59['query']=_[_0x51a0('0x32')](_0xd7bfd[_0x51a0('0x31')]);_0x203e59[_0x51a0('0x33')]=_['intersection'](_0x203e59['model'],_0x203e59[_0x51a0('0x31')]);_0x11ffce[_0x51a0('0x35')]=_[_0x51a0('0x34')](_0x203e59[_0x51a0('0x2f')],qs[_0x51a0('0x36')](_0xd7bfd[_0x51a0('0x31')][_0x51a0('0x36')]));_0x11ffce[_0x51a0('0x35')]=_0x11ffce[_0x51a0('0x35')][_0x51a0('0x37')]?_0x11ffce[_0x51a0('0x35')]:_0x203e59[_0x51a0('0x2f')];_0x11ffce['order']=qs[_0x51a0('0x3b')](_0xd7bfd[_0x51a0('0x31')][_0x51a0('0x3b')]);_0x11ffce[_0x51a0('0x3e')]=qs['filters'](_[_0x51a0('0x3c')](_0xd7bfd[_0x51a0('0x31')],_0x203e59['filters']));if(_0xd7bfd[_0x51a0('0x31')][_0x51a0('0x3d')]){_0x11ffce['where']=_[_0x51a0('0x3f')](_0x11ffce[_0x51a0('0x3e')],{'$or':_[_0x51a0('0x29')](_0x11ffce[_0x51a0('0x35')],function(_0x312e3f){var _0x489e93={};_0x489e93[_0x312e3f]={'$like':'%'+_0xd7bfd['query']['filter']+'%'};return _0x489e93;})});}_0x11ffce=_['merge']({},_0x11ffce,_0xd7bfd[_0x51a0('0x41')]);return _0x23f340['getFields'](_0x11ffce);}})[_0x51a0('0x23')](function(_0x405296){if(_0x405296){_0x30b90a=_0x405296[_0x51a0('0x37')];if(!_0xd7bfd[_0x51a0('0x31')][_0x51a0('0x38')](_0x51a0('0x39'))){_0x11ffce['limit']=qs[_0x51a0('0x1c')](_0xd7bfd[_0x51a0('0x31')][_0x51a0('0x1c')]);_0x11ffce[_0x51a0('0x1e')]=qs[_0x51a0('0x1e')](_0xd7bfd[_0x51a0('0x31')]['offset']);}return _0x23f340[_0x51a0('0x4e')](_0x11ffce);}})[_0x51a0('0x23')](function(_0xd428fd){if(_0xd428fd){return _0xd428fd?{'count':_0x30b90a,'rows':_0xd428fd}:null;}})[_0x51a0('0x23')](respondWithResult(_0x3530c5,null))[_0x51a0('0x45')](handleError(_0x3530c5,null));};exports[_0x51a0('0x4f')]=function(_0x422ac3,_0x453c07,_0x583a13){var _0x4389ff={};var _0x4d04a9={};var _0x36cbe5;var _0x49dc44;return db[_0x51a0('0x2a')][_0x51a0('0x4c')]({'where':{'id':_0x422ac3[_0x51a0('0x47')]['id']}})[_0x51a0('0x23')](handleEntityNotFound(_0x453c07,null))[_0x51a0('0x23')](function(_0x1aff65){if(_0x1aff65){_0x36cbe5=_0x1aff65;_0x4d04a9[_0x51a0('0x2f')]=_[_0x51a0('0x32')](db['Dynamics365Field'][_0x51a0('0x2b')]);_0x4d04a9[_0x51a0('0x31')]=_[_0x51a0('0x32')](_0x422ac3[_0x51a0('0x31')]);_0x4d04a9[_0x51a0('0x33')]=_[_0x51a0('0x34')](_0x4d04a9[_0x51a0('0x2f')],_0x4d04a9['query']);_0x4389ff[_0x51a0('0x35')]=_[_0x51a0('0x34')](_0x4d04a9[_0x51a0('0x2f')],qs[_0x51a0('0x36')](_0x422ac3[_0x51a0('0x31')][_0x51a0('0x36')]));_0x4389ff[_0x51a0('0x35')]=_0x4389ff[_0x51a0('0x35')][_0x51a0('0x37')]?_0x4389ff['attributes']:_0x4d04a9['model'];_0x4389ff[_0x51a0('0x3a')]=qs[_0x51a0('0x3b')](_0x422ac3['query'][_0x51a0('0x3b')]);_0x4389ff[_0x51a0('0x3e')]=qs[_0x51a0('0x33')](_[_0x51a0('0x3c')](_0x422ac3['query'],_0x4d04a9[_0x51a0('0x33')]));if(_0x422ac3[_0x51a0('0x31')][_0x51a0('0x3d')]){_0x4389ff[_0x51a0('0x3e')]=_[_0x51a0('0x3f')](_0x4389ff[_0x51a0('0x3e')],{'$or':_[_0x51a0('0x29')](_0x4389ff[_0x51a0('0x35')],function(_0x55d222){var _0x19f399={};_0x19f399[_0x55d222]={'$like':'%'+_0x422ac3[_0x51a0('0x31')][_0x51a0('0x3d')]+'%'};return _0x19f399;})});}_0x4389ff=_[_0x51a0('0x3f')]({},_0x4389ff,_0x422ac3[_0x51a0('0x41')]);return _0x36cbe5['getSubjects'](_0x4389ff);}})[_0x51a0('0x23')](function(_0x274f0a){if(_0x274f0a){_0x49dc44=_0x274f0a[_0x51a0('0x37')];if(!_0x422ac3[_0x51a0('0x31')][_0x51a0('0x38')]('nolimit')){_0x4389ff[_0x51a0('0x1c')]=qs[_0x51a0('0x1c')](_0x422ac3[_0x51a0('0x31')][_0x51a0('0x1c')]);_0x4389ff[_0x51a0('0x1e')]=qs[_0x51a0('0x1e')](_0x422ac3[_0x51a0('0x31')][_0x51a0('0x1e')]);}return _0x36cbe5[_0x51a0('0x4f')](_0x4389ff);}})[_0x51a0('0x23')](function(_0x36a8e9){if(_0x36a8e9){return _0x36a8e9?{'count':_0x49dc44,'rows':_0x36a8e9}:null;}})['then'](respondWithResult(_0x453c07,null))['catch'](handleError(_0x453c07,null));};exports[_0x51a0('0x50')]=function(_0x19f0f8,_0x341e46,_0x5542fb){var _0xd21335={};var _0x273a75={};var _0x1da32c;var _0x5a2540;return db[_0x51a0('0x2a')]['findOne']({'where':{'id':_0x19f0f8[_0x51a0('0x47')]['id']}})[_0x51a0('0x23')](handleEntityNotFound(_0x341e46,null))['then'](function(_0x4c4f4d){if(_0x4c4f4d){_0x1da32c=_0x4c4f4d;_0x273a75[_0x51a0('0x2f')]=_[_0x51a0('0x32')](db['Dynamics365Field'][_0x51a0('0x2b')]);_0x273a75[_0x51a0('0x31')]=_['keys'](_0x19f0f8['query']);_0x273a75[_0x51a0('0x33')]=_[_0x51a0('0x34')](_0x273a75['model'],_0x273a75[_0x51a0('0x31')]);_0xd21335[_0x51a0('0x35')]=_[_0x51a0('0x34')](_0x273a75[_0x51a0('0x2f')],qs[_0x51a0('0x36')](_0x19f0f8[_0x51a0('0x31')][_0x51a0('0x36')]));_0xd21335[_0x51a0('0x35')]=_0xd21335[_0x51a0('0x35')]['length']?_0xd21335[_0x51a0('0x35')]:_0x273a75[_0x51a0('0x2f')];_0xd21335[_0x51a0('0x3a')]=qs[_0x51a0('0x3b')](_0x19f0f8[_0x51a0('0x31')]['sort']);_0xd21335[_0x51a0('0x3e')]=qs[_0x51a0('0x33')](_[_0x51a0('0x3c')](_0x19f0f8[_0x51a0('0x31')],_0x273a75[_0x51a0('0x33')]));if(_0x19f0f8[_0x51a0('0x31')][_0x51a0('0x3d')]){_0xd21335[_0x51a0('0x3e')]=_['merge'](_0xd21335[_0x51a0('0x3e')],{'$or':_[_0x51a0('0x29')](_0xd21335[_0x51a0('0x35')],function(_0x3eed30){var _0xb69995={};_0xb69995[_0x3eed30]={'$like':'%'+_0x19f0f8[_0x51a0('0x31')][_0x51a0('0x3d')]+'%'};return _0xb69995;})});}_0xd21335=_[_0x51a0('0x3f')]({},_0xd21335,_0x19f0f8['options']);return _0x1da32c['getDescriptions'](_0xd21335);}})[_0x51a0('0x23')](function(_0x410f93){if(_0x410f93){_0x5a2540=_0x410f93[_0x51a0('0x37')];if(!_0x19f0f8[_0x51a0('0x31')][_0x51a0('0x38')]('nolimit')){_0xd21335[_0x51a0('0x1c')]=qs[_0x51a0('0x1c')](_0x19f0f8[_0x51a0('0x31')][_0x51a0('0x1c')]);_0xd21335[_0x51a0('0x1e')]=qs[_0x51a0('0x1e')](_0x19f0f8[_0x51a0('0x31')][_0x51a0('0x1e')]);}return _0x1da32c['getDescriptions'](_0xd21335);}})[_0x51a0('0x23')](function(_0x428fa2){if(_0x428fa2){return _0x428fa2?{'count':_0x5a2540,'rows':_0x428fa2}:null;}})['then'](respondWithResult(_0x341e46,null))[_0x51a0('0x45')](handleError(_0x341e46,null));};
\ No newline at end of file
+var _0xb8bd=['squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','sendStatus','error','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','show','params','includeAll','include','find','create','body','catch','update','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash'];(function(_0x457e15,_0x9af2c0){var _0x5256da=function(_0x31076d){while(--_0x31076d){_0x457e15['push'](_0x457e15['shift']());}};_0x5256da(++_0x9af2c0);}(_0xb8bd,0x126));var _0xdb8b=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xb8bd[_0x58e469];return _0x4c01c5;};'use strict';var emlformat=require(_0xdb8b('0x0'));var rimraf=require(_0xdb8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb8b('0x2'));var rp=require(_0xdb8b('0x3'));var moment=require('moment');var BPromise=require(_0xdb8b('0x4'));var Mustache=require(_0xdb8b('0x5'));var util=require(_0xdb8b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdb8b('0x7'));var fs=require('fs');var fs_extra=require(_0xdb8b('0x8'));var _=require(_0xdb8b('0x9'));var squel=require(_0xdb8b('0xa'));var crypto=require('crypto');var jsforce=require(_0xdb8b('0xb'));var deskjs=require(_0xdb8b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdb8b('0xd'));var authService=require(_0xdb8b('0xe'));var qs=require(_0xdb8b('0xf'));var as=require(_0xdb8b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdb8b('0x11'));var licenseUtil=require(_0xdb8b('0x12'));var db=require(_0xdb8b('0x13'))['db'];function respondWithStatusCode(_0x2c7dd6,_0x5df341){_0x5df341=_0x5df341||0xcc;return function(_0x10e1f9){if(_0x10e1f9){return _0x2c7dd6['sendStatus'](_0x5df341);}return _0x2c7dd6[_0xdb8b('0x14')](_0x5df341)[_0xdb8b('0x15')]();};}function respondWithResult(_0x2c7def,_0x2c7c26){_0x2c7c26=_0x2c7c26||0xc8;return function(_0x504980){if(_0x504980){return _0x2c7def[_0xdb8b('0x14')](_0x2c7c26)['json'](_0x504980);}};}function respondWithFilteredResult(_0x53743e,_0x11f42a){return function(_0x4f84dd){if(_0x4f84dd){var _0x29f29e=typeof _0x11f42a[_0xdb8b('0x16')]===_0xdb8b('0x17')&&typeof _0x11f42a[_0xdb8b('0x18')]==='undefined';var _0x9a0416=_0x4f84dd[_0xdb8b('0x19')];var _0x595faf=_0x29f29e?0x0:_0x11f42a[_0xdb8b('0x16')];var _0x4fadd6=_0x29f29e?_0x4f84dd[_0xdb8b('0x19')]:_0x11f42a[_0xdb8b('0x16')]+_0x11f42a['limit'];var _0x4f4206;if(_0x4fadd6>=_0x9a0416){_0x4fadd6=_0x9a0416;_0x4f4206=0xc8;}else{_0x4f4206=0xce;}_0x53743e[_0xdb8b('0x14')](_0x4f4206);return _0x53743e[_0xdb8b('0x1a')](_0xdb8b('0x1b'),_0x595faf+'-'+_0x4fadd6+'/'+_0x9a0416)[_0xdb8b('0x1c')](_0x4f84dd);}return null;};}function patchUpdates(_0x35ce5b){return function(_0x44e324){try{jsonpatch[_0xdb8b('0x1d')](_0x44e324,_0x35ce5b,!![]);}catch(_0x37dae1){return BPromise['reject'](_0x37dae1);}return _0x44e324[_0xdb8b('0x1e')]();};}function saveUpdates(_0x494063,_0x299eef){return function(_0x5e8a2a){if(_0x5e8a2a){return _0x5e8a2a['update'](_0x494063)[_0xdb8b('0x1f')](function(_0x27f3cc){return _0x27f3cc;});}return null;};}function removeEntity(_0x331634,_0x16ca35){return function(_0xa888a3){if(_0xa888a3){return _0xa888a3[_0xdb8b('0x20')]()['then'](function(){_0x331634[_0xdb8b('0x14')](0xcc)[_0xdb8b('0x15')]();});}};}function handleEntityNotFound(_0x4c7328,_0x45151c){return function(_0x265841){if(!_0x265841){_0x4c7328[_0xdb8b('0x21')](0x194);}return _0x265841;};}function handleError(_0x7d82c,_0x1e6510){_0x1e6510=_0x1e6510||0x1f4;return function(_0x4be143){logger[_0xdb8b('0x22')](_0x4be143['stack']);if(_0x4be143[_0xdb8b('0x23')]){delete _0x4be143['name'];}_0x7d82c['status'](_0x1e6510)[_0xdb8b('0x24')](_0x4be143);};}exports[_0xdb8b('0x25')]=function(_0x2d68cf,_0x277561){var _0x44e076={},_0x37ecd9={},_0xe57562={'count':0x0,'rows':[]};var _0x34b13f=_[_0xdb8b('0x26')](db[_0xdb8b('0x27')][_0xdb8b('0x28')],function(_0x358ed8){return{'name':_0x358ed8['fieldName'],'type':_0x358ed8[_0xdb8b('0x29')][_0xdb8b('0x2a')]};});_0x37ecd9[_0xdb8b('0x2b')]=_['map'](_0x34b13f,_0xdb8b('0x23'));_0x37ecd9['query']=_[_0xdb8b('0x2c')](_0x2d68cf[_0xdb8b('0x2d')]);_0x37ecd9[_0xdb8b('0x2e')]=_[_0xdb8b('0x2f')](_0x37ecd9[_0xdb8b('0x2b')],_0x37ecd9[_0xdb8b('0x2d')]);_0x44e076[_0xdb8b('0x30')]=_[_0xdb8b('0x2f')](_0x37ecd9[_0xdb8b('0x2b')],qs[_0xdb8b('0x31')](_0x2d68cf[_0xdb8b('0x2d')][_0xdb8b('0x31')]));_0x44e076[_0xdb8b('0x30')]=_0x44e076['attributes'][_0xdb8b('0x32')]?_0x44e076[_0xdb8b('0x30')]:_0x37ecd9[_0xdb8b('0x2b')];if(!_0x2d68cf['query'][_0xdb8b('0x33')](_0xdb8b('0x34'))){_0x44e076[_0xdb8b('0x18')]=qs[_0xdb8b('0x18')](_0x2d68cf[_0xdb8b('0x2d')][_0xdb8b('0x18')]);_0x44e076[_0xdb8b('0x16')]=qs[_0xdb8b('0x16')](_0x2d68cf[_0xdb8b('0x2d')][_0xdb8b('0x16')]);}_0x44e076[_0xdb8b('0x35')]=qs[_0xdb8b('0x36')](_0x2d68cf[_0xdb8b('0x2d')]['sort']);_0x44e076[_0xdb8b('0x37')]=qs[_0xdb8b('0x2e')](_[_0xdb8b('0x38')](_0x2d68cf[_0xdb8b('0x2d')],_0x37ecd9[_0xdb8b('0x2e')]),_0x34b13f);if(_0x2d68cf['query'][_0xdb8b('0x39')]){_0x44e076[_0xdb8b('0x37')]=_['merge'](_0x44e076['where'],{'$or':_[_0xdb8b('0x26')](_0x34b13f,function(_0x53d6bd){if(_0x53d6bd[_0xdb8b('0x29')]!==_0xdb8b('0x3a')){var _0x534a12={};_0x534a12[_0x53d6bd[_0xdb8b('0x23')]]={'$like':'%'+_0x2d68cf[_0xdb8b('0x2d')]['filter']+'%'};return _0x534a12;}})});}_0x44e076=_[_0xdb8b('0x3b')]({},_0x44e076,_0x2d68cf[_0xdb8b('0x3c')]);var _0x4c5061={'where':_0x44e076[_0xdb8b('0x37')]};return db[_0xdb8b('0x27')][_0xdb8b('0x19')](_0x4c5061)[_0xdb8b('0x1f')](function(_0x26a3a8){_0xe57562['count']=_0x26a3a8;if(_0x2d68cf['query']['includeAll']){_0x44e076['include']=[{'all':!![]}];}return db[_0xdb8b('0x27')][_0xdb8b('0x3d')](_0x44e076);})[_0xdb8b('0x1f')](function(_0xb16d43){_0xe57562['rows']=_0xb16d43;return _0xe57562;})[_0xdb8b('0x1f')](respondWithFilteredResult(_0x277561,_0x44e076))['catch'](handleError(_0x277561,null));};exports[_0xdb8b('0x3e')]=function(_0x5e485c,_0x302bd0){var _0x5dc1a7={'raw':![],'where':{'id':_0x5e485c[_0xdb8b('0x3f')]['id']}},_0x3ae852={};_0x3ae852[_0xdb8b('0x2b')]=_[_0xdb8b('0x2c')](db[_0xdb8b('0x27')][_0xdb8b('0x28')]);_0x3ae852[_0xdb8b('0x2d')]=_[_0xdb8b('0x2c')](_0x5e485c[_0xdb8b('0x2d')]);_0x3ae852[_0xdb8b('0x2e')]=_[_0xdb8b('0x2f')](_0x3ae852[_0xdb8b('0x2b')],_0x3ae852[_0xdb8b('0x2d')]);_0x5dc1a7[_0xdb8b('0x30')]=_[_0xdb8b('0x2f')](_0x3ae852[_0xdb8b('0x2b')],qs[_0xdb8b('0x31')](_0x5e485c[_0xdb8b('0x2d')][_0xdb8b('0x31')]));_0x5dc1a7[_0xdb8b('0x30')]=_0x5dc1a7['attributes']['length']?_0x5dc1a7[_0xdb8b('0x30')]:_0x3ae852[_0xdb8b('0x2b')];if(_0x5e485c[_0xdb8b('0x2d')][_0xdb8b('0x40')]){_0x5dc1a7[_0xdb8b('0x41')]=[{'all':!![]}];}_0x5dc1a7=_[_0xdb8b('0x3b')]({},_0x5dc1a7,_0x5e485c[_0xdb8b('0x3c')]);return db[_0xdb8b('0x27')][_0xdb8b('0x42')](_0x5dc1a7)[_0xdb8b('0x1f')](handleEntityNotFound(_0x302bd0,null))[_0xdb8b('0x1f')](respondWithResult(_0x302bd0,null))['catch'](handleError(_0x302bd0,null));};exports[_0xdb8b('0x43')]=function(_0x160a7a,_0x31ad06){return db['Dynamics365Configuration'][_0xdb8b('0x43')](_0x160a7a[_0xdb8b('0x44')],{})['then'](respondWithResult(_0x31ad06,0xc9))[_0xdb8b('0x45')](handleError(_0x31ad06,null));};exports[_0xdb8b('0x46')]=function(_0x460d7a,_0x366508){if(_0x460d7a['body']['id']){delete _0x460d7a[_0xdb8b('0x44')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x460d7a[_0xdb8b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x366508,null))['then'](saveUpdates(_0x460d7a[_0xdb8b('0x44')],null))[_0xdb8b('0x1f')](respondWithResult(_0x366508,null))[_0xdb8b('0x45')](handleError(_0x366508,null));};exports['destroy']=function(_0x54deca,_0x904f68){return db['Dynamics365Configuration'][_0xdb8b('0x42')]({'where':{'id':_0x54deca[_0xdb8b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x904f68,null))[_0xdb8b('0x1f')](removeEntity(_0x904f68,null))[_0xdb8b('0x45')](handleError(_0x904f68,null));};exports[_0xdb8b('0x47')]=function(_0x7bff5a,_0x467f00,_0x33b9a0){var _0x25727d={};var _0x39cfc5={};var _0x2983b1;var _0x219622;return db[_0xdb8b('0x27')][_0xdb8b('0x48')]({'where':{'id':_0x7bff5a[_0xdb8b('0x3f')]['id']}})[_0xdb8b('0x1f')](handleEntityNotFound(_0x467f00,null))[_0xdb8b('0x1f')](function(_0x5eae43){if(_0x5eae43){_0x2983b1=_0x5eae43;_0x39cfc5[_0xdb8b('0x2b')]=_[_0xdb8b('0x2c')](db[_0xdb8b('0x49')]['rawAttributes']);_0x39cfc5[_0xdb8b('0x2d')]=_[_0xdb8b('0x2c')](_0x7bff5a['query']);_0x39cfc5[_0xdb8b('0x2e')]=_[_0xdb8b('0x2f')](_0x39cfc5['model'],_0x39cfc5['query']);_0x25727d[_0xdb8b('0x30')]=_[_0xdb8b('0x2f')](_0x39cfc5[_0xdb8b('0x2b')],qs[_0xdb8b('0x31')](_0x7bff5a[_0xdb8b('0x2d')]['fields']));_0x25727d[_0xdb8b('0x30')]=_0x25727d[_0xdb8b('0x30')]['length']?_0x25727d[_0xdb8b('0x30')]:_0x39cfc5['model'];_0x25727d[_0xdb8b('0x35')]=qs[_0xdb8b('0x36')](_0x7bff5a['query'][_0xdb8b('0x36')]);_0x25727d[_0xdb8b('0x37')]=qs[_0xdb8b('0x2e')](_[_0xdb8b('0x38')](_0x7bff5a[_0xdb8b('0x2d')],_0x39cfc5[_0xdb8b('0x2e')]));if(_0x7bff5a[_0xdb8b('0x2d')][_0xdb8b('0x39')]){_0x25727d['where']=_[_0xdb8b('0x3b')](_0x25727d['where'],{'$or':_[_0xdb8b('0x26')](_0x25727d[_0xdb8b('0x30')],function(_0x175dc7){var _0x59c95f={};_0x59c95f[_0x175dc7]={'$like':'%'+_0x7bff5a[_0xdb8b('0x2d')][_0xdb8b('0x39')]+'%'};return _0x59c95f;})});}_0x25727d=_[_0xdb8b('0x3b')]({},_0x25727d,_0x7bff5a[_0xdb8b('0x3c')]);return _0x2983b1[_0xdb8b('0x47')](_0x25727d);}})[_0xdb8b('0x1f')](function(_0x1e848c){if(_0x1e848c){_0x219622=_0x1e848c[_0xdb8b('0x32')];if(!_0x7bff5a[_0xdb8b('0x2d')][_0xdb8b('0x33')](_0xdb8b('0x34'))){_0x25727d['limit']=qs[_0xdb8b('0x18')](_0x7bff5a['query'][_0xdb8b('0x18')]);_0x25727d['offset']=qs[_0xdb8b('0x16')](_0x7bff5a[_0xdb8b('0x2d')][_0xdb8b('0x16')]);}return _0x2983b1[_0xdb8b('0x47')](_0x25727d);}})[_0xdb8b('0x1f')](function(_0x35fd75){if(_0x35fd75){return _0x35fd75?{'count':_0x219622,'rows':_0x35fd75}:null;}})[_0xdb8b('0x1f')](respondWithResult(_0x467f00,null))[_0xdb8b('0x45')](handleError(_0x467f00,null));};exports['getSubjects']=function(_0xa83d82,_0x11450a,_0x4c11c5){var _0x5199a9={};var _0x3075da={};var _0x913909;var _0x3051f7;return db[_0xdb8b('0x27')]['findOne']({'where':{'id':_0xa83d82['params']['id']}})[_0xdb8b('0x1f')](handleEntityNotFound(_0x11450a,null))[_0xdb8b('0x1f')](function(_0x55027a){if(_0x55027a){_0x913909=_0x55027a;_0x3075da[_0xdb8b('0x2b')]=_[_0xdb8b('0x2c')](db[_0xdb8b('0x49')]['rawAttributes']);_0x3075da[_0xdb8b('0x2d')]=_[_0xdb8b('0x2c')](_0xa83d82[_0xdb8b('0x2d')]);_0x3075da[_0xdb8b('0x2e')]=_[_0xdb8b('0x2f')](_0x3075da['model'],_0x3075da[_0xdb8b('0x2d')]);_0x5199a9['attributes']=_[_0xdb8b('0x2f')](_0x3075da[_0xdb8b('0x2b')],qs[_0xdb8b('0x31')](_0xa83d82[_0xdb8b('0x2d')][_0xdb8b('0x31')]));_0x5199a9[_0xdb8b('0x30')]=_0x5199a9['attributes'][_0xdb8b('0x32')]?_0x5199a9[_0xdb8b('0x30')]:_0x3075da['model'];_0x5199a9[_0xdb8b('0x35')]=qs[_0xdb8b('0x36')](_0xa83d82['query'][_0xdb8b('0x36')]);_0x5199a9[_0xdb8b('0x37')]=qs[_0xdb8b('0x2e')](_['pick'](_0xa83d82['query'],_0x3075da[_0xdb8b('0x2e')]));if(_0xa83d82['query'][_0xdb8b('0x39')]){_0x5199a9[_0xdb8b('0x37')]=_[_0xdb8b('0x3b')](_0x5199a9[_0xdb8b('0x37')],{'$or':_['map'](_0x5199a9[_0xdb8b('0x30')],function(_0x1d9e63){var _0x11f920={};_0x11f920[_0x1d9e63]={'$like':'%'+_0xa83d82['query'][_0xdb8b('0x39')]+'%'};return _0x11f920;})});}_0x5199a9=_[_0xdb8b('0x3b')]({},_0x5199a9,_0xa83d82['options']);return _0x913909['getSubjects'](_0x5199a9);}})['then'](function(_0x24c6e1){if(_0x24c6e1){_0x3051f7=_0x24c6e1['length'];if(!_0xa83d82['query'][_0xdb8b('0x33')](_0xdb8b('0x34'))){_0x5199a9[_0xdb8b('0x18')]=qs['limit'](_0xa83d82['query'][_0xdb8b('0x18')]);_0x5199a9[_0xdb8b('0x16')]=qs[_0xdb8b('0x16')](_0xa83d82[_0xdb8b('0x2d')][_0xdb8b('0x16')]);}return _0x913909[_0xdb8b('0x4a')](_0x5199a9);}})[_0xdb8b('0x1f')](function(_0x213a98){if(_0x213a98){return _0x213a98?{'count':_0x3051f7,'rows':_0x213a98}:null;}})[_0xdb8b('0x1f')](respondWithResult(_0x11450a,null))[_0xdb8b('0x45')](handleError(_0x11450a,null));};exports[_0xdb8b('0x4b')]=function(_0x5ed415,_0x300b9c,_0x5e8cbb){var _0x109d88={};var _0x2562cd={};var _0x56271c;var _0x57f8f6;return db['Dynamics365Configuration'][_0xdb8b('0x48')]({'where':{'id':_0x5ed415['params']['id']}})[_0xdb8b('0x1f')](handleEntityNotFound(_0x300b9c,null))['then'](function(_0x513bc4){if(_0x513bc4){_0x56271c=_0x513bc4;_0x2562cd[_0xdb8b('0x2b')]=_[_0xdb8b('0x2c')](db[_0xdb8b('0x49')]['rawAttributes']);_0x2562cd[_0xdb8b('0x2d')]=_[_0xdb8b('0x2c')](_0x5ed415[_0xdb8b('0x2d')]);_0x2562cd[_0xdb8b('0x2e')]=_[_0xdb8b('0x2f')](_0x2562cd[_0xdb8b('0x2b')],_0x2562cd[_0xdb8b('0x2d')]);_0x109d88[_0xdb8b('0x30')]=_['intersection'](_0x2562cd['model'],qs[_0xdb8b('0x31')](_0x5ed415[_0xdb8b('0x2d')]['fields']));_0x109d88['attributes']=_0x109d88[_0xdb8b('0x30')][_0xdb8b('0x32')]?_0x109d88[_0xdb8b('0x30')]:_0x2562cd['model'];_0x109d88[_0xdb8b('0x35')]=qs[_0xdb8b('0x36')](_0x5ed415[_0xdb8b('0x2d')][_0xdb8b('0x36')]);_0x109d88[_0xdb8b('0x37')]=qs['filters'](_['pick'](_0x5ed415[_0xdb8b('0x2d')],_0x2562cd[_0xdb8b('0x2e')]));if(_0x5ed415['query'][_0xdb8b('0x39')]){_0x109d88[_0xdb8b('0x37')]=_[_0xdb8b('0x3b')](_0x109d88[_0xdb8b('0x37')],{'$or':_[_0xdb8b('0x26')](_0x109d88['attributes'],function(_0x3a3add){var _0x1c73a1={};_0x1c73a1[_0x3a3add]={'$like':'%'+_0x5ed415[_0xdb8b('0x2d')][_0xdb8b('0x39')]+'%'};return _0x1c73a1;})});}_0x109d88=_[_0xdb8b('0x3b')]({},_0x109d88,_0x5ed415[_0xdb8b('0x3c')]);return _0x56271c['getDescriptions'](_0x109d88);}})[_0xdb8b('0x1f')](function(_0x18b78c){if(_0x18b78c){_0x57f8f6=_0x18b78c[_0xdb8b('0x32')];if(!_0x5ed415[_0xdb8b('0x2d')][_0xdb8b('0x33')](_0xdb8b('0x34'))){_0x109d88['limit']=qs[_0xdb8b('0x18')](_0x5ed415[_0xdb8b('0x2d')][_0xdb8b('0x18')]);_0x109d88['offset']=qs[_0xdb8b('0x16')](_0x5ed415['query']['offset']);}return _0x56271c[_0xdb8b('0x4b')](_0x109d88);}})[_0xdb8b('0x1f')](function(_0x5c9f76){if(_0x5c9f76){return _0x5c9f76?{'count':_0x57f8f6,'rows':_0x5c9f76}:null;}})[_0xdb8b('0x1f')](respondWithResult(_0x300b9c,null))[_0xdb8b('0x45')](handleError(_0x300b9c,null));};
\ No newline at end of file
index 8f4ee51..ad618ec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','util','api'];(function(_0x512a3a,_0x2434c8){var _0x31ac04=function(_0x135dcc){while(--_0x135dcc){_0x512a3a['push'](_0x512a3a['shift']());}};_0x31ac04(++_0x2434c8);}(_0xa41a,0x6b));var _0xaa41=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xa41a[_0x99868f];return _0x27a71b;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Dynamics365Configuration',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','int_dynamics365_configurations','lodash'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xe14d,0x1ee));var _0xde14=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xe14d[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('Dynamics365Configuration',attributes,{'tableName':_0xde14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 106372a..832001b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa522=['util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','Dynamics365Configuration,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa522,0x18f));var _0x2a52=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xa522[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0x2a52('0x0'));var util=require(_0x2a52('0x1'));var moment=require('moment');var BPromise=require(_0x2a52('0x2'));var rs=require(_0x2a52('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a52('0x4'))['db'];var utils=require(_0x2a52('0x5'));var logger=require('../../config/logger')(_0x2a52('0x6'));var config=require(_0x2a52('0x7'));var jayson=require(_0x2a52('0x8'));var client=jayson[_0x2a52('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x318398,_0xf55192,_0x84e9b5){return new BPromise(function(_0x5a87d3,_0x22650d){return client[_0x2a52('0xa')](_0x318398,_0x84e9b5)[_0x2a52('0xb')](function(_0x58b4e0){logger['info'](_0x2a52('0xc'),_0xf55192,'request\x20sent');logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0xf55192,'request\x20sent',JSON[_0x2a52('0xd')](_0x58b4e0));if(_0x58b4e0[_0x2a52('0xe')]){if(_0x58b4e0['error'][_0x2a52('0xf')]===0x1f4){logger[_0x2a52('0xe')](_0x2a52('0xc'),_0xf55192,_0x58b4e0['error'][_0x2a52('0x10')]);return _0x22650d(_0x58b4e0['error'][_0x2a52('0x10')]);}logger[_0x2a52('0xe')](_0x2a52('0xc'),_0xf55192,_0x58b4e0[_0x2a52('0xe')][_0x2a52('0x10')]);return _0x5a87d3(_0x58b4e0[_0x2a52('0xe')][_0x2a52('0x10')]);}else{logger[_0x2a52('0x11')](_0x2a52('0xc'),_0xf55192,_0x2a52('0x12'));_0x5a87d3(_0x58b4e0[_0x2a52('0x13')][_0x2a52('0x10')]);}})['catch'](function(_0x4ac8ba){logger['error'](_0x2a52('0xc'),_0xf55192,_0x4ac8ba);_0x22650d(_0x4ac8ba);});});}
\ No newline at end of file
+var _0x6845=['request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0xdef3c6,_0x5e06b6){var _0x477186=function(_0x381c74){while(--_0x381c74){_0xdef3c6['push'](_0xdef3c6['shift']());}};_0x477186(++_0x5e06b6);}(_0x6845,0x6c));var _0x5684=function(_0x526a2d,_0xea2ac){_0x526a2d=_0x526a2d-0x0;var _0x2511a3=_0x6845[_0x526a2d];return _0x2511a3;};'use strict';var _=require(_0x5684('0x0'));var util=require(_0x5684('0x1'));var moment=require(_0x5684('0x2'));var BPromise=require(_0x5684('0x3'));var rs=require(_0x5684('0x4'));var fs=require('fs');var Redis=require(_0x5684('0x5'));var db=require(_0x5684('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5684('0x7'))(_0x5684('0x8'));var config=require(_0x5684('0x9'));var jayson=require(_0x5684('0xa'));var client=jayson['client'][_0x5684('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42de93,_0x307720,_0x19f827){return new BPromise(function(_0x1e9150,_0x734fa5){return client[_0x5684('0xc')](_0x42de93,_0x19f827)[_0x5684('0xd')](function(_0x53fd9a){logger[_0x5684('0xe')](_0x5684('0xf'),_0x307720,_0x5684('0x10'));logger[_0x5684('0x11')](_0x5684('0x12'),_0x307720,'request\x20sent',JSON[_0x5684('0x13')](_0x53fd9a));if(_0x53fd9a['error']){if(_0x53fd9a[_0x5684('0x14')]['code']===0x1f4){logger[_0x5684('0x14')](_0x5684('0xf'),_0x307720,_0x53fd9a[_0x5684('0x14')]['message']);return _0x734fa5(_0x53fd9a[_0x5684('0x14')][_0x5684('0x15')]);}logger[_0x5684('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x307720,_0x53fd9a[_0x5684('0x14')][_0x5684('0x15')]);return _0x1e9150(_0x53fd9a[_0x5684('0x14')][_0x5684('0x15')]);}else{logger[_0x5684('0xe')](_0x5684('0xf'),_0x307720,'request\x20sent');_0x1e9150(_0x53fd9a[_0x5684('0x16')]['message']);}})[_0x5684('0x17')](function(_0xe125a0){logger['error'](_0x5684('0xf'),_0x307720,_0xe125a0);_0x734fa5(_0xe125a0);});});}
\ No newline at end of file
index f8d8809..924947e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc63a=['index','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x127074,_0x3bd855){var _0x4c9463=function(_0xf337a6){while(--_0xf337a6){_0x127074['push'](_0x127074['shift']());}};_0x4c9463(++_0x3bd855);}(_0xc63a,0x190));var _0xac63=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc63a[_0x199572];return _0x13cfa3;};'use strict';var multer=require('multer');var util=require(_0xac63('0x0'));var path=require(_0xac63('0x1'));var timeout=require(_0xac63('0x2'));var express=require(_0xac63('0x3'));var router=express[_0xac63('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xac63('0x5'));var config=require(_0xac63('0x6'));var controller=require('./intDynamics365Field.controller');router[_0xac63('0x7')]('/',auth['isAuthenticated'](),controller[_0xac63('0x8')]);router['get'](_0xac63('0x9'),auth[_0xac63('0xa')](),controller[_0xac63('0xb')]);router['post']('/',auth[_0xac63('0xa')](),controller['create']);router[_0xac63('0xc')](_0xac63('0x9'),auth[_0xac63('0xa')](),controller[_0xac63('0xd')]);router[_0xac63('0xe')](_0xac63('0x9'),auth[_0xac63('0xa')](),controller[_0xac63('0xf')]);module[_0xac63('0x10')]=router;
\ No newline at end of file
+var _0x1932=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x5d7a25,_0x33136c){var _0x10f10d=function(_0x51163d){while(--_0x51163d){_0x5d7a25['push'](_0x5d7a25['shift']());}};_0x10f10d(++_0x33136c);}(_0x1932,0x93));var _0x2193=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x1932[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0x2193('0x0'));var util=require(_0x2193('0x1'));var path=require(_0x2193('0x2'));var timeout=require(_0x2193('0x3'));var express=require(_0x2193('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2193('0x5'));var interaction=require(_0x2193('0x6'));var config=require(_0x2193('0x7'));var controller=require(_0x2193('0x8'));router['get']('/',auth[_0x2193('0x9')](),controller[_0x2193('0xa')]);router[_0x2193('0xb')](_0x2193('0xc'),auth[_0x2193('0x9')](),controller[_0x2193('0xd')]);router[_0x2193('0xe')]('/',auth['isAuthenticated'](),controller[_0x2193('0xf')]);router['put']('/:id',auth[_0x2193('0x9')](),controller[_0x2193('0x10')]);router[_0x2193('0x11')](_0x2193('0xc'),auth[_0x2193('0x9')](),controller[_0x2193('0x12')]);module['exports']=router;
\ No newline at end of file
index 95a073f..58e4c1d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb72d=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue'];(function(_0x1536ec,_0x11c8b8){var _0x562f11=function(_0x42b780){while(--_0x42b780){_0x1536ec['push'](_0x1536ec['shift']());}};_0x562f11(++_0x11c8b8);}(_0xb72d,0x9b));var _0xdb72=function(_0x2e6fa0,_0x4b8a9d){_0x2e6fa0=_0x2e6fa0-0x0;var _0x3d39b5=_0xb72d[_0x2e6fa0];return _0x3d39b5;};'use strict';var Sequelize=require(_0xdb72('0x0'));module[_0xdb72('0x1')]={'type':{'type':Sequelize[_0xdb72('0x2')](_0xdb72('0x3'),'variable','customVariable',_0xdb72('0x4'),'picklist'),'defaultValue':_0xdb72('0x3')},'content':{'type':Sequelize[_0xdb72('0x5')]},'key':{'type':Sequelize[_0xdb72('0x5')]},'keyType':{'type':Sequelize[_0xdb72('0x2')](_0xdb72('0x3'),'variable',_0xdb72('0x6'))},'keyContent':{'type':Sequelize[_0xdb72('0x5')]},'idField':{'type':Sequelize[_0xdb72('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdb72('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdb72('0x5')]}};
\ No newline at end of file
+var _0xc612=['exports','ENUM','customVariable','keyValue','string','STRING','BOOLEAN','sequelize'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0xc612,0x197));var _0x2c61=function(_0x456340,_0xfa5adc){_0x456340=_0x456340-0x0;var _0x30f293=_0xc612[_0x456340];return _0x30f293;};'use strict';var Sequelize=require(_0x2c61('0x0'));module[_0x2c61('0x1')]={'type':{'type':Sequelize[_0x2c61('0x2')]('string','variable',_0x2c61('0x3'),_0x2c61('0x4'),'picklist'),'defaultValue':_0x2c61('0x5')},'content':{'type':Sequelize[_0x2c61('0x6')]},'key':{'type':Sequelize[_0x2c61('0x6')]},'keyType':{'type':Sequelize[_0x2c61('0x2')]('string','variable',_0x2c61('0x3'))},'keyContent':{'type':Sequelize[_0x2c61('0x6')]},'idField':{'type':Sequelize[_0x2c61('0x6')]},'nameField':{'type':Sequelize[_0x2c61('0x6')]},'customField':{'type':Sequelize[_0x2c61('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2c61('0x6')]}};
\ No newline at end of file
index 8357828..04e210d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x29f6=['options','count','include','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','reject','save','update','destroy','then','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL'];(function(_0x4648d0,_0x111f70){var _0x43e744=function(_0x45bae5){while(--_0x45bae5){_0x4648d0['push'](_0x4648d0['shift']());}};_0x43e744(++_0x111f70);}(_0x29f6,0x143));var _0x629f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29f6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x629f('0x0'));var rimraf=require(_0x629f('0x1'));var zipdir=require(_0x629f('0x2'));var jsonpatch=require(_0x629f('0x3'));var rp=require(_0x629f('0x4'));var moment=require(_0x629f('0x5'));var BPromise=require(_0x629f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x629f('0x7'));var sox=require(_0x629f('0x8'));var csv=require(_0x629f('0x9'));var ejs=require(_0x629f('0xa'));var fs=require('fs');var fs_extra=require(_0x629f('0xb'));var _=require(_0x629f('0xc'));var squel=require(_0x629f('0xd'));var crypto=require(_0x629f('0xe'));var jsforce=require(_0x629f('0xf'));var deskjs=require(_0x629f('0x10'));var toCsv=require(_0x629f('0x9'));var querystring=require('querystring');var Papa=require(_0x629f('0x11'));var Redis=require(_0x629f('0x12'));var authService=require(_0x629f('0x13'));var qs=require(_0x629f('0x14'));var as=require(_0x629f('0x15'));var hardwareService=require(_0x629f('0x16'));var logger=require(_0x629f('0x17'))(_0x629f('0x18'));var utils=require(_0x629f('0x19'));var config=require(_0x629f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x629f('0x1b'))['db'];function respondWithStatusCode(_0x21a7e7,_0x5167d9){_0x5167d9=_0x5167d9||0xcc;return function(_0x284a16){if(_0x284a16){return _0x21a7e7[_0x629f('0x1c')](_0x5167d9);}return _0x21a7e7[_0x629f('0x1d')](_0x5167d9)[_0x629f('0x1e')]();};}function respondWithResult(_0x3387dc,_0x34310c){_0x34310c=_0x34310c||0xc8;return function(_0x5a40cf){if(_0x5a40cf){return _0x3387dc[_0x629f('0x1d')](_0x34310c)['json'](_0x5a40cf);}};}function respondWithFilteredResult(_0x1c4d2d,_0x4902b0){return function(_0x370ec2){if(_0x370ec2){var _0x536a4d=typeof _0x4902b0['offset']===_0x629f('0x1f')&&typeof _0x4902b0[_0x629f('0x20')]==='undefined';var _0x11c221=_0x370ec2['count'];var _0x23fed9=_0x536a4d?0x0:_0x4902b0[_0x629f('0x21')];var _0x23608e=_0x536a4d?_0x370ec2['count']:_0x4902b0['offset']+_0x4902b0[_0x629f('0x20')];var _0x17bd0a;if(_0x23608e>=_0x11c221){_0x23608e=_0x11c221;_0x17bd0a=0xc8;}else{_0x17bd0a=0xce;}_0x1c4d2d['status'](_0x17bd0a);return _0x1c4d2d[_0x629f('0x22')](_0x629f('0x23'),_0x23fed9+'-'+_0x23608e+'/'+_0x11c221)[_0x629f('0x24')](_0x370ec2);}return null;};}function patchUpdates(_0x4b3503){return function(_0x3b6d63){try{jsonpatch['apply'](_0x3b6d63,_0x4b3503,!![]);}catch(_0x17d7be){return BPromise[_0x629f('0x25')](_0x17d7be);}return _0x3b6d63[_0x629f('0x26')]();};}function saveUpdates(_0x2de8dc,_0x85dafe){return function(_0x2ba4ee){if(_0x2ba4ee){return _0x2ba4ee[_0x629f('0x27')](_0x2de8dc)['then'](function(_0x3367ab){return _0x3367ab;});}return null;};}function removeEntity(_0x39d935,_0x2d7570){return function(_0x488b82){if(_0x488b82){return _0x488b82[_0x629f('0x28')]()[_0x629f('0x29')](function(){_0x39d935[_0x629f('0x1d')](0xcc)[_0x629f('0x1e')]();});}};}function handleEntityNotFound(_0x349e88,_0x790240){return function(_0x56470f){if(!_0x56470f){_0x349e88[_0x629f('0x1c')](0x194);}return _0x56470f;};}function handleError(_0x18a0b7,_0x70084d){_0x70084d=_0x70084d||0x1f4;return function(_0x52621e){logger['error'](_0x52621e[_0x629f('0x2a')]);if(_0x52621e[_0x629f('0x2b')]){delete _0x52621e[_0x629f('0x2b')];}_0x18a0b7[_0x629f('0x1d')](_0x70084d)['send'](_0x52621e);};}exports[_0x629f('0x2c')]=function(_0x2b90e1,_0x293882){var _0x4dec26={},_0x580fd0={},_0x49fe66={'count':0x0,'rows':[]};var _0x40c44d=_[_0x629f('0x2d')](db[_0x629f('0x2e')][_0x629f('0x2f')],function(_0x48b399){return{'name':_0x48b399[_0x629f('0x30')],'type':_0x48b399['type'][_0x629f('0x31')]};});_0x580fd0['model']=_[_0x629f('0x2d')](_0x40c44d,_0x629f('0x2b'));_0x580fd0['query']=_[_0x629f('0x32')](_0x2b90e1[_0x629f('0x33')]);_0x580fd0[_0x629f('0x34')]=_[_0x629f('0x35')](_0x580fd0[_0x629f('0x36')],_0x580fd0[_0x629f('0x33')]);_0x4dec26[_0x629f('0x37')]=_[_0x629f('0x35')](_0x580fd0[_0x629f('0x36')],qs[_0x629f('0x38')](_0x2b90e1['query']['fields']));_0x4dec26[_0x629f('0x37')]=_0x4dec26['attributes'][_0x629f('0x39')]?_0x4dec26['attributes']:_0x580fd0[_0x629f('0x36')];if(!_0x2b90e1[_0x629f('0x33')][_0x629f('0x3a')]('nolimit')){_0x4dec26['limit']=qs[_0x629f('0x20')](_0x2b90e1['query']['limit']);_0x4dec26[_0x629f('0x21')]=qs['offset'](_0x2b90e1['query'][_0x629f('0x21')]);}_0x4dec26[_0x629f('0x3b')]=qs[_0x629f('0x3c')](_0x2b90e1[_0x629f('0x33')]['sort']);_0x4dec26[_0x629f('0x3d')]=qs[_0x629f('0x34')](_[_0x629f('0x3e')](_0x2b90e1['query'],_0x580fd0[_0x629f('0x34')]),_0x40c44d);if(_0x2b90e1[_0x629f('0x33')][_0x629f('0x3f')]){_0x4dec26[_0x629f('0x3d')]=_[_0x629f('0x40')](_0x4dec26[_0x629f('0x3d')],{'$or':_[_0x629f('0x2d')](_0x40c44d,function(_0x229bc7){if(_0x229bc7[_0x629f('0x41')]!==_0x629f('0x42')){var _0x3be2b9={};_0x3be2b9[_0x229bc7[_0x629f('0x2b')]]={'$like':'%'+_0x2b90e1['query'][_0x629f('0x3f')]+'%'};return _0x3be2b9;}})});}_0x4dec26=_['merge']({},_0x4dec26,_0x2b90e1[_0x629f('0x43')]);var _0xdae383={'where':_0x4dec26[_0x629f('0x3d')]};return db['Dynamics365Field'][_0x629f('0x44')](_0xdae383)[_0x629f('0x29')](function(_0x20418c){_0x49fe66[_0x629f('0x44')]=_0x20418c;if(_0x2b90e1[_0x629f('0x33')]['includeAll']){_0x4dec26[_0x629f('0x45')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x4dec26);})[_0x629f('0x29')](function(_0xbcf585){_0x49fe66[_0x629f('0x46')]=_0xbcf585;return _0x49fe66;})[_0x629f('0x29')](respondWithFilteredResult(_0x293882,_0x4dec26))[_0x629f('0x47')](handleError(_0x293882,null));};exports[_0x629f('0x48')]=function(_0x10b29c,_0x32d882){var _0x37a9eb={'raw':!![],'where':{'id':_0x10b29c[_0x629f('0x49')]['id']}},_0x3288c1={};_0x3288c1[_0x629f('0x36')]=_[_0x629f('0x32')](db[_0x629f('0x2e')][_0x629f('0x2f')]);_0x3288c1[_0x629f('0x33')]=_['keys'](_0x10b29c[_0x629f('0x33')]);_0x3288c1['filters']=_[_0x629f('0x35')](_0x3288c1['model'],_0x3288c1[_0x629f('0x33')]);_0x37a9eb[_0x629f('0x37')]=_[_0x629f('0x35')](_0x3288c1['model'],qs[_0x629f('0x38')](_0x10b29c[_0x629f('0x33')]['fields']));_0x37a9eb[_0x629f('0x37')]=_0x37a9eb[_0x629f('0x37')]['length']?_0x37a9eb['attributes']:_0x3288c1['model'];if(_0x10b29c[_0x629f('0x33')][_0x629f('0x4a')]){_0x37a9eb[_0x629f('0x45')]=[{'all':!![]}];}_0x37a9eb=_[_0x629f('0x40')]({},_0x37a9eb,_0x10b29c[_0x629f('0x43')]);return db[_0x629f('0x2e')][_0x629f('0x4b')](_0x37a9eb)[_0x629f('0x29')](handleEntityNotFound(_0x32d882,null))[_0x629f('0x29')](respondWithResult(_0x32d882,null))[_0x629f('0x47')](handleError(_0x32d882,null));};exports[_0x629f('0x4c')]=function(_0x56be5d,_0x5c0206){return db[_0x629f('0x2e')][_0x629f('0x4c')](_0x56be5d[_0x629f('0x4d')],{})[_0x629f('0x29')](respondWithResult(_0x5c0206,0xc9))[_0x629f('0x47')](handleError(_0x5c0206,null));};exports['update']=function(_0x4a6bcc,_0x542d16){if(_0x4a6bcc[_0x629f('0x4d')]['id']){delete _0x4a6bcc[_0x629f('0x4d')]['id'];}return db[_0x629f('0x2e')][_0x629f('0x4b')]({'where':{'id':_0x4a6bcc[_0x629f('0x49')]['id']}})['then'](handleEntityNotFound(_0x542d16,null))[_0x629f('0x29')](saveUpdates(_0x4a6bcc[_0x629f('0x4d')],null))[_0x629f('0x29')](respondWithResult(_0x542d16,null))['catch'](handleError(_0x542d16,null));};exports[_0x629f('0x28')]=function(_0x46d749,_0x32fc3a){return db[_0x629f('0x2e')][_0x629f('0x4b')]({'where':{'id':_0x46d749[_0x629f('0x49')]['id']}})[_0x629f('0x29')](handleEntityNotFound(_0x32fc3a,null))['then'](removeEntity(_0x32fc3a,null))['catch'](handleError(_0x32fc3a,null));};
\ No newline at end of file
+var _0xec36=['count','offset','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','Dynamics365Field','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined'];(function(_0x2889ae,_0x429f4d){var _0x3d7b4c=function(_0x4ae893){while(--_0x4ae893){_0x2889ae['push'](_0x2889ae['shift']());}};_0x3d7b4c(++_0x429f4d);}(_0xec36,0x6d));var _0x6ec3=function(_0x3db122,_0x5e6bee){_0x3db122=_0x3db122-0x0;var _0x325b67=_0xec36[_0x3db122];return _0x325b67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6ec3('0x0'));var zipdir=require(_0x6ec3('0x1'));var jsonpatch=require(_0x6ec3('0x2'));var rp=require('request-promise');var moment=require(_0x6ec3('0x3'));var BPromise=require(_0x6ec3('0x4'));var Mustache=require(_0x6ec3('0x5'));var util=require(_0x6ec3('0x6'));var path=require(_0x6ec3('0x7'));var sox=require(_0x6ec3('0x8'));var csv=require('to-csv');var ejs=require(_0x6ec3('0x9'));var fs=require('fs');var fs_extra=require(_0x6ec3('0xa'));var _=require(_0x6ec3('0xb'));var squel=require('squel');var crypto=require(_0x6ec3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6ec3('0xd'));var querystring=require(_0x6ec3('0xe'));var Papa=require(_0x6ec3('0xf'));var Redis=require(_0x6ec3('0x10'));var authService=require(_0x6ec3('0x11'));var qs=require(_0x6ec3('0x12'));var as=require(_0x6ec3('0x13'));var hardwareService=require(_0x6ec3('0x14'));var logger=require(_0x6ec3('0x15'))(_0x6ec3('0x16'));var utils=require('../../config/utils');var config=require(_0x6ec3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ec3('0x18'))['db'];function respondWithStatusCode(_0x3d5fa4,_0x1227eb){_0x1227eb=_0x1227eb||0xcc;return function(_0x57a150){if(_0x57a150){return _0x3d5fa4[_0x6ec3('0x19')](_0x1227eb);}return _0x3d5fa4[_0x6ec3('0x1a')](_0x1227eb)[_0x6ec3('0x1b')]();};}function respondWithResult(_0xa0571f,_0x53847b){_0x53847b=_0x53847b||0xc8;return function(_0x4e86b8){if(_0x4e86b8){return _0xa0571f[_0x6ec3('0x1a')](_0x53847b)[_0x6ec3('0x1c')](_0x4e86b8);}};}function respondWithFilteredResult(_0x262656,_0x239b5e){return function(_0x52ec29){if(_0x52ec29){var _0x4d2275=typeof _0x239b5e['offset']==='undefined'&&typeof _0x239b5e[_0x6ec3('0x1d')]===_0x6ec3('0x1e');var _0x186998=_0x52ec29[_0x6ec3('0x1f')];var _0x1c7f8c=_0x4d2275?0x0:_0x239b5e[_0x6ec3('0x20')];var _0xd56f4=_0x4d2275?_0x52ec29[_0x6ec3('0x1f')]:_0x239b5e['offset']+_0x239b5e[_0x6ec3('0x1d')];var _0x2df0e1;if(_0xd56f4>=_0x186998){_0xd56f4=_0x186998;_0x2df0e1=0xc8;}else{_0x2df0e1=0xce;}_0x262656[_0x6ec3('0x1a')](_0x2df0e1);return _0x262656[_0x6ec3('0x21')](_0x6ec3('0x22'),_0x1c7f8c+'-'+_0xd56f4+'/'+_0x186998)[_0x6ec3('0x1c')](_0x52ec29);}return null;};}function patchUpdates(_0x144ea5){return function(_0x362c15){try{jsonpatch['apply'](_0x362c15,_0x144ea5,!![]);}catch(_0x5ddc69){return BPromise[_0x6ec3('0x23')](_0x5ddc69);}return _0x362c15[_0x6ec3('0x24')]();};}function saveUpdates(_0x254881,_0x5b20ac){return function(_0x414c6d){if(_0x414c6d){return _0x414c6d[_0x6ec3('0x25')](_0x254881)[_0x6ec3('0x26')](function(_0x2ff627){return _0x2ff627;});}return null;};}function removeEntity(_0x21dfbf,_0x566409){return function(_0x4e22b9){if(_0x4e22b9){return _0x4e22b9[_0x6ec3('0x27')]()[_0x6ec3('0x26')](function(){_0x21dfbf[_0x6ec3('0x1a')](0xcc)[_0x6ec3('0x1b')]();});}};}function handleEntityNotFound(_0x596e13,_0x4b1ba2){return function(_0x2c6ae9){if(!_0x2c6ae9){_0x596e13[_0x6ec3('0x19')](0x194);}return _0x2c6ae9;};}function handleError(_0xf156d5,_0x20eacf){_0x20eacf=_0x20eacf||0x1f4;return function(_0x1e42aa){logger[_0x6ec3('0x28')](_0x1e42aa['stack']);if(_0x1e42aa[_0x6ec3('0x29')]){delete _0x1e42aa[_0x6ec3('0x29')];}_0xf156d5['status'](_0x20eacf)['send'](_0x1e42aa);};}exports[_0x6ec3('0x2a')]=function(_0x44db65,_0x52b2ad){var _0x4240dd={},_0xdead7a={},_0x5caf96={'count':0x0,'rows':[]};var _0x205ee0=_[_0x6ec3('0x2b')](db[_0x6ec3('0x2c')]['rawAttributes'],function(_0x1545ff){return{'name':_0x1545ff['fieldName'],'type':_0x1545ff[_0x6ec3('0x2d')]['key']};});_0xdead7a[_0x6ec3('0x2e')]=_[_0x6ec3('0x2b')](_0x205ee0,_0x6ec3('0x29'));_0xdead7a[_0x6ec3('0x2f')]=_[_0x6ec3('0x30')](_0x44db65[_0x6ec3('0x2f')]);_0xdead7a[_0x6ec3('0x31')]=_[_0x6ec3('0x32')](_0xdead7a[_0x6ec3('0x2e')],_0xdead7a[_0x6ec3('0x2f')]);_0x4240dd[_0x6ec3('0x33')]=_[_0x6ec3('0x32')](_0xdead7a[_0x6ec3('0x2e')],qs[_0x6ec3('0x34')](_0x44db65[_0x6ec3('0x2f')][_0x6ec3('0x34')]));_0x4240dd[_0x6ec3('0x33')]=_0x4240dd[_0x6ec3('0x33')][_0x6ec3('0x35')]?_0x4240dd[_0x6ec3('0x33')]:_0xdead7a[_0x6ec3('0x2e')];if(!_0x44db65[_0x6ec3('0x2f')][_0x6ec3('0x36')]('nolimit')){_0x4240dd[_0x6ec3('0x1d')]=qs[_0x6ec3('0x1d')](_0x44db65[_0x6ec3('0x2f')]['limit']);_0x4240dd['offset']=qs[_0x6ec3('0x20')](_0x44db65[_0x6ec3('0x2f')][_0x6ec3('0x20')]);}_0x4240dd['order']=qs[_0x6ec3('0x37')](_0x44db65[_0x6ec3('0x2f')][_0x6ec3('0x37')]);_0x4240dd[_0x6ec3('0x38')]=qs[_0x6ec3('0x31')](_['pick'](_0x44db65[_0x6ec3('0x2f')],_0xdead7a[_0x6ec3('0x31')]),_0x205ee0);if(_0x44db65[_0x6ec3('0x2f')]['filter']){_0x4240dd[_0x6ec3('0x38')]=_[_0x6ec3('0x39')](_0x4240dd[_0x6ec3('0x38')],{'$or':_['map'](_0x205ee0,function(_0x2f0353){if(_0x2f0353[_0x6ec3('0x2d')]!==_0x6ec3('0x3a')){var _0x51f8ae={};_0x51f8ae[_0x2f0353['name']]={'$like':'%'+_0x44db65['query']['filter']+'%'};return _0x51f8ae;}})});}_0x4240dd=_[_0x6ec3('0x39')]({},_0x4240dd,_0x44db65['options']);var _0xdbb4e1={'where':_0x4240dd[_0x6ec3('0x38')]};return db['Dynamics365Field'][_0x6ec3('0x1f')](_0xdbb4e1)[_0x6ec3('0x26')](function(_0x50d8ae){_0x5caf96[_0x6ec3('0x1f')]=_0x50d8ae;if(_0x44db65[_0x6ec3('0x2f')][_0x6ec3('0x3b')]){_0x4240dd[_0x6ec3('0x3c')]=[{'all':!![]}];}return db[_0x6ec3('0x2c')][_0x6ec3('0x3d')](_0x4240dd);})[_0x6ec3('0x26')](function(_0x354d7d){_0x5caf96[_0x6ec3('0x3e')]=_0x354d7d;return _0x5caf96;})[_0x6ec3('0x26')](respondWithFilteredResult(_0x52b2ad,_0x4240dd))['catch'](handleError(_0x52b2ad,null));};exports[_0x6ec3('0x3f')]=function(_0x521e0b,_0x2e26dc){var _0x30a96e={'raw':!![],'where':{'id':_0x521e0b[_0x6ec3('0x40')]['id']}},_0x267877={};_0x267877[_0x6ec3('0x2e')]=_[_0x6ec3('0x30')](db[_0x6ec3('0x2c')]['rawAttributes']);_0x267877[_0x6ec3('0x2f')]=_[_0x6ec3('0x30')](_0x521e0b[_0x6ec3('0x2f')]);_0x267877[_0x6ec3('0x31')]=_[_0x6ec3('0x32')](_0x267877[_0x6ec3('0x2e')],_0x267877[_0x6ec3('0x2f')]);_0x30a96e[_0x6ec3('0x33')]=_[_0x6ec3('0x32')](_0x267877[_0x6ec3('0x2e')],qs[_0x6ec3('0x34')](_0x521e0b[_0x6ec3('0x2f')]['fields']));_0x30a96e[_0x6ec3('0x33')]=_0x30a96e[_0x6ec3('0x33')][_0x6ec3('0x35')]?_0x30a96e[_0x6ec3('0x33')]:_0x267877[_0x6ec3('0x2e')];if(_0x521e0b[_0x6ec3('0x2f')][_0x6ec3('0x3b')]){_0x30a96e['include']=[{'all':!![]}];}_0x30a96e=_[_0x6ec3('0x39')]({},_0x30a96e,_0x521e0b[_0x6ec3('0x41')]);return db['Dynamics365Field'][_0x6ec3('0x42')](_0x30a96e)[_0x6ec3('0x26')](handleEntityNotFound(_0x2e26dc,null))[_0x6ec3('0x26')](respondWithResult(_0x2e26dc,null))[_0x6ec3('0x43')](handleError(_0x2e26dc,null));};exports[_0x6ec3('0x44')]=function(_0x5e99c4,_0x3dd288){return db[_0x6ec3('0x2c')]['create'](_0x5e99c4[_0x6ec3('0x45')],{})[_0x6ec3('0x26')](respondWithResult(_0x3dd288,0xc9))['catch'](handleError(_0x3dd288,null));};exports['update']=function(_0x39073e,_0x1f7807){if(_0x39073e[_0x6ec3('0x45')]['id']){delete _0x39073e[_0x6ec3('0x45')]['id'];}return db[_0x6ec3('0x2c')]['find']({'where':{'id':_0x39073e[_0x6ec3('0x40')]['id']}})[_0x6ec3('0x26')](handleEntityNotFound(_0x1f7807,null))[_0x6ec3('0x26')](saveUpdates(_0x39073e[_0x6ec3('0x45')],null))['then'](respondWithResult(_0x1f7807,null))['catch'](handleError(_0x1f7807,null));};exports[_0x6ec3('0x27')]=function(_0x4424e9,_0x3ac5c4){return db[_0x6ec3('0x2c')][_0x6ec3('0x42')]({'where':{'id':_0x4424e9[_0x6ec3('0x40')]['id']}})[_0x6ec3('0x26')](handleEntityNotFound(_0x3ac5c4,null))[_0x6ec3('0x26')](removeEntity(_0x3ac5c4,null))['catch'](handleError(_0x3ac5c4,null));};
\ No newline at end of file
index 3fb3ba0..07e8677 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcafc=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash'];(function(_0x5605d6,_0x1c2bba){var _0x1a227b=function(_0xa3f0ce){while(--_0xa3f0ce){_0x5605d6['push'](_0x5605d6['shift']());}};_0x1a227b(++_0x1c2bba);}(_0xcafc,0xc2));var _0xccaf=function(_0x34a9d4,_0x51e4b0){_0x34a9d4=_0x34a9d4-0x0;var _0x32c910=_0xcafc[_0x34a9d4];return _0x32c910;};'use strict';var _=require(_0xccaf('0x0'));var util=require(_0xccaf('0x1'));var logger=require('../../config/logger')(_0xccaf('0x2'));var moment=require(_0xccaf('0x3'));var BPromise=require(_0xccaf('0x4'));var rp=require(_0xccaf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xccaf('0x6'));var config=require(_0xccaf('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0xccaf('0x8')]=function(_0x19d989,_0x3c02f2){return _0x19d989[_0xccaf('0x9')](_0xccaf('0xa'),attributes,{'tableName':_0xccaf('0xb'),'paranoid':![],'indexes':[{'name':_0xccaf('0xc'),'fields':[_0xccaf('0xd'),_0xccaf('0xe')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x7ea0=['api','moment','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','int_dynamics365_fields','dynamics365_unique_index','FieldId','../../config/logger'];(function(_0x161190,_0x7c7e0c){var _0x553001=function(_0x58880c){while(--_0x58880c){_0x161190['push'](_0x161190['shift']());}};_0x553001(++_0x7c7e0c);}(_0x7ea0,0x153));var _0x07ea=function(_0x3effd2,_0x2faf28){_0x3effd2=_0x3effd2-0x0;var _0x263cb2=_0x7ea0[_0x3effd2];return _0x263cb2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x07ea('0x0'))(_0x07ea('0x1'));var moment=require(_0x07ea('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x07ea('0x3'));var config=require(_0x07ea('0x4'));var attributes=require(_0x07ea('0x5'));module[_0x07ea('0x6')]=function(_0x154cad,_0x2497f2){return _0x154cad['define']('Dynamics365Field',attributes,{'tableName':_0x07ea('0x7'),'paranoid':![],'indexes':[{'name':_0x07ea('0x8'),'fields':['idField',_0x07ea('0x9')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index ad9c49e..a863cd8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8401=['request\x20sent','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x218162,_0x4d9a24){var _0x291cd2=function(_0x47d840){while(--_0x47d840){_0x218162['push'](_0x218162['shift']());}};_0x291cd2(++_0x4d9a24);}(_0x8401,0x165));var _0x1840=function(_0x90229a,_0x36acd3){_0x90229a=_0x90229a-0x0;var _0xcdbea2=_0x8401[_0x90229a];return _0xcdbea2;};'use strict';var _=require(_0x1840('0x0'));var util=require(_0x1840('0x1'));var moment=require(_0x1840('0x2'));var BPromise=require('bluebird');var rs=require(_0x1840('0x3'));var fs=require('fs');var Redis=require(_0x1840('0x4'));var db=require(_0x1840('0x5'))['db'];var utils=require(_0x1840('0x6'));var logger=require(_0x1840('0x7'))(_0x1840('0x8'));var config=require(_0x1840('0x9'));var jayson=require(_0x1840('0xa'));var client=jayson['client'][_0x1840('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32560e,_0x3683f6,_0x1df87c){return new BPromise(function(_0x1d1ae5,_0x58b0e6){return client[_0x1840('0xc')](_0x32560e,_0x1df87c)['then'](function(_0x135295){logger[_0x1840('0xd')](_0x1840('0xe'),_0x3683f6,'request\x20sent');logger[_0x1840('0xf')](_0x1840('0x10'),_0x3683f6,_0x1840('0x11'),JSON[_0x1840('0x12')](_0x135295));if(_0x135295[_0x1840('0x13')]){if(_0x135295['error']['code']===0x1f4){logger['error'](_0x1840('0xe'),_0x3683f6,_0x135295[_0x1840('0x13')][_0x1840('0x14')]);return _0x58b0e6(_0x135295[_0x1840('0x13')][_0x1840('0x14')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x3683f6,_0x135295[_0x1840('0x13')][_0x1840('0x14')]);return _0x1d1ae5(_0x135295[_0x1840('0x13')][_0x1840('0x14')]);}else{logger[_0x1840('0xd')](_0x1840('0xe'),_0x3683f6,'request\x20sent');_0x1d1ae5(_0x135295['result'][_0x1840('0x14')]);}})[_0x1840('0x15')](function(_0x1acf7b){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x3683f6,_0x1acf7b);_0x58b0e6(_0x1acf7b);});});}
\ No newline at end of file
+var _0xed92=['Dynamics365Field,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','request\x20sent','debug','stringify','error'];(function(_0x4ee29c,_0x5b8930){var _0x5a8524=function(_0x1c22da){while(--_0x1c22da){_0x4ee29c['push'](_0x4ee29c['shift']());}};_0x5a8524(++_0x5b8930);}(_0xed92,0xef));var _0x2ed9=function(_0x484e9e,_0x5a541e){_0x484e9e=_0x484e9e-0x0;var _0x42f1e8=_0xed92[_0x484e9e];return _0x42f1e8;};'use strict';var _=require(_0x2ed9('0x0'));var util=require(_0x2ed9('0x1'));var moment=require('moment');var BPromise=require(_0x2ed9('0x2'));var rs=require(_0x2ed9('0x3'));var fs=require('fs');var Redis=require(_0x2ed9('0x4'));var db=require(_0x2ed9('0x5'))['db'];var utils=require(_0x2ed9('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2ed9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d7fe7,_0x4d54aa,_0x1a4e22){return new BPromise(function(_0x219214,_0x93b6b){return client[_0x2ed9('0x8')](_0x5d7fe7,_0x1a4e22)['then'](function(_0xad5703){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x4d54aa,_0x2ed9('0x9'));logger[_0x2ed9('0xa')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4d54aa,_0x2ed9('0x9'),JSON[_0x2ed9('0xb')](_0xad5703));if(_0xad5703[_0x2ed9('0xc')]){if(_0xad5703[_0x2ed9('0xc')]['code']===0x1f4){logger[_0x2ed9('0xc')](_0x2ed9('0xd'),_0x4d54aa,_0xad5703[_0x2ed9('0xc')][_0x2ed9('0xe')]);return _0x93b6b(_0xad5703[_0x2ed9('0xc')][_0x2ed9('0xe')]);}logger[_0x2ed9('0xc')](_0x2ed9('0xd'),_0x4d54aa,_0xad5703['error'][_0x2ed9('0xe')]);return _0x219214(_0xad5703['error'][_0x2ed9('0xe')]);}else{logger[_0x2ed9('0xf')](_0x2ed9('0xd'),_0x4d54aa,_0x2ed9('0x9'));_0x219214(_0xad5703[_0x2ed9('0x10')][_0x2ed9('0xe')]);}})[_0x2ed9('0x11')](function(_0x235028){logger[_0x2ed9('0xc')](_0x2ed9('0xd'),_0x4d54aa,_0x235028);_0x93b6b(_0x235028);});});}
\ No newline at end of file
index dcd8b56..1f2d57d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9409=['destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete'];(function(_0x423b6d,_0x3c4e34){var _0x560ad9=function(_0x40c075){while(--_0x40c075){_0x423b6d['push'](_0x423b6d['shift']());}};_0x560ad9(++_0x3c4e34);}(_0x9409,0xd9));var _0x9940=function(_0x2f81ef,_0x33953a){_0x2f81ef=_0x2f81ef-0x0;var _0x1ca14d=_0x9409[_0x2f81ef];return _0x1ca14d;};'use strict';var multer=require('multer');var util=require(_0x9940('0x0'));var path=require('path');var timeout=require(_0x9940('0x1'));var express=require(_0x9940('0x2'));var router=express[_0x9940('0x3')]();var fs_extra=require(_0x9940('0x4'));var auth=require(_0x9940('0x5'));var interaction=require(_0x9940('0x6'));var config=require(_0x9940('0x7'));var controller=require(_0x9940('0x8'));router[_0x9940('0x9')]('/',auth[_0x9940('0xa')](),controller['index']);router[_0x9940('0x9')](_0x9940('0xb'),auth[_0x9940('0xa')](),controller[_0x9940('0xc')]);router[_0x9940('0x9')](_0x9940('0xd'),auth[_0x9940('0xa')](),controller[_0x9940('0xe')]);router[_0x9940('0x9')](_0x9940('0xf'),auth[_0x9940('0xa')](),controller[_0x9940('0x10')]);router['post']('/',auth[_0x9940('0xa')](),controller[_0x9940('0x11')]);router[_0x9940('0x12')](_0x9940('0xd'),auth['isAuthenticated'](),controller[_0x9940('0x13')]);router[_0x9940('0x14')](_0x9940('0xb'),auth[_0x9940('0xa')](),controller[_0x9940('0x15')]);router[_0x9940('0x16')](_0x9940('0xb'),auth[_0x9940('0xa')](),controller[_0x9940('0x17')]);module['exports']=router;
\ No newline at end of file
+var _0xc28b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util'];(function(_0x51bcc8,_0x72833){var _0x1a4271=function(_0x5ab633){while(--_0x5ab633){_0x51bcc8['push'](_0x51bcc8['shift']());}};_0x1a4271(++_0x72833);}(_0xc28b,0x1c0));var _0xbc28=function(_0x2d91e2,_0x100355){_0x2d91e2=_0x2d91e2-0x0;var _0xd9b271=_0xc28b[_0x2d91e2];return _0xd9b271;};'use strict';var multer=require(_0xbc28('0x0'));var util=require(_0xbc28('0x1'));var path=require(_0xbc28('0x2'));var timeout=require(_0xbc28('0x3'));var express=require(_0xbc28('0x4'));var router=express[_0xbc28('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbc28('0x6'));var interaction=require(_0xbc28('0x7'));var config=require(_0xbc28('0x8'));var controller=require(_0xbc28('0x9'));router[_0xbc28('0xa')]('/',auth[_0xbc28('0xb')](),controller['index']);router['get'](_0xbc28('0xc'),auth[_0xbc28('0xb')](),controller[_0xbc28('0xd')]);router[_0xbc28('0xa')](_0xbc28('0xe'),auth['isAuthenticated'](),controller[_0xbc28('0xf')]);router[_0xbc28('0xa')](_0xbc28('0x10'),auth[_0xbc28('0xb')](),controller[_0xbc28('0x11')]);router[_0xbc28('0x12')]('/',auth[_0xbc28('0xb')](),controller[_0xbc28('0x13')]);router[_0xbc28('0x12')]('/:id/configurations',auth[_0xbc28('0xb')](),controller[_0xbc28('0x14')]);router[_0xbc28('0x15')](_0xbc28('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xbc28('0x16')](_0xbc28('0xc'),auth[_0xbc28('0xb')](),controller[_0xbc28('0x17')]);module[_0xbc28('0x18')]=router;
\ No newline at end of file
index 405114c..3e7555e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d11=['exports','STRING','sequelize'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6d11,0xbf));var _0x16d1=function(_0x291d6b,_0x941f4d){_0x291d6b=_0x291d6b-0x0;var _0x5363e5=_0x6d11[_0x291d6b];return _0x5363e5;};'use strict';var Sequelize=require(_0x16d1('0x0'));module[_0x16d1('0x1')]={'name':{'type':Sequelize[_0x16d1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x16d1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x16d1('0x2')]},'remoteUri':{'type':Sequelize[_0x16d1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}};
\ No newline at end of file
+var _0x3266=['remoteUri','sequelize','exports','STRING','username'];(function(_0x24b53b,_0x57c20d){var _0x3b5c00=function(_0xed1211){while(--_0xed1211){_0x24b53b['push'](_0x24b53b['shift']());}};_0x3b5c00(++_0x57c20d);}(_0x3266,0x6a));var _0x6326=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x3266[_0x44bcb0];return _0xfaf881;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'name':{'type':Sequelize[_0x6326('0x2')]},'description':{'type':Sequelize[_0x6326('0x2')]},'username':{'type':Sequelize[_0x6326('0x2')],'unique':_0x6326('0x3')},'apiKey':{'type':Sequelize[_0x6326('0x2')]},'remoteUri':{'type':Sequelize[_0x6326('0x2')],'unique':_0x6326('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}};
\ No newline at end of file
index ebdc21f..24c0a3f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0487=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','error','name','index','map','FreshdeskAccount','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','order','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring'];(function(_0xe3f330,_0x5d85d5){var _0x32bf08=function(_0x48f9d4){while(--_0x48f9d4){_0xe3f330['push'](_0xe3f330['shift']());}};_0x32bf08(++_0x5d85d5);}(_0x0487,0x14f));var _0x7048=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x0487[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0x7048('0x0'));var rimraf=require(_0x7048('0x1'));var zipdir=require(_0x7048('0x2'));var jsonpatch=require(_0x7048('0x3'));var rp=require(_0x7048('0x4'));var moment=require(_0x7048('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7048('0x6'));var util=require('util');var path=require(_0x7048('0x7'));var sox=require(_0x7048('0x8'));var csv=require(_0x7048('0x9'));var ejs=require(_0x7048('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7048('0xb'));var squel=require(_0x7048('0xc'));var crypto=require(_0x7048('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7048('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7048('0xf'));var Papa=require(_0x7048('0x10'));var Redis=require(_0x7048('0x11'));var authService=require(_0x7048('0x12'));var qs=require(_0x7048('0x13'));var as=require(_0x7048('0x14'));var hardwareService=require(_0x7048('0x15'));var logger=require('../../config/logger')(_0x7048('0x16'));var utils=require(_0x7048('0x17'));var config=require(_0x7048('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7048('0x19'))['db'];var integrations=require(_0x7048('0x1a'));function respondWithStatusCode(_0x59542b,_0x116386){_0x116386=_0x116386||0xcc;return function(_0xeba050){if(_0xeba050){return _0x59542b[_0x7048('0x1b')](_0x116386);}return _0x59542b[_0x7048('0x1c')](_0x116386)[_0x7048('0x1d')]();};}function respondWithResult(_0x546c51,_0x1072d0){_0x1072d0=_0x1072d0||0xc8;return function(_0x493067){if(_0x493067){return _0x546c51[_0x7048('0x1c')](_0x1072d0)[_0x7048('0x1e')](_0x493067);}};}function respondWithFilteredResult(_0x6a2a55,_0x2b9800){return function(_0x4ec491){if(_0x4ec491){var _0x24a6f9=typeof _0x2b9800['offset']===_0x7048('0x1f')&&typeof _0x2b9800[_0x7048('0x20')]==='undefined';var _0x4b7b1e=_0x4ec491[_0x7048('0x21')];var _0xbef931=_0x24a6f9?0x0:_0x2b9800[_0x7048('0x22')];var _0xe5fd91=_0x24a6f9?_0x4ec491['count']:_0x2b9800[_0x7048('0x22')]+_0x2b9800['limit'];var _0x521a61;if(_0xe5fd91>=_0x4b7b1e){_0xe5fd91=_0x4b7b1e;_0x521a61=0xc8;}else{_0x521a61=0xce;}_0x6a2a55['status'](_0x521a61);return _0x6a2a55[_0x7048('0x23')](_0x7048('0x24'),_0xbef931+'-'+_0xe5fd91+'/'+_0x4b7b1e)[_0x7048('0x1e')](_0x4ec491);}return null;};}function patchUpdates(_0x4b9def){return function(_0x14a7d2){try{jsonpatch['apply'](_0x14a7d2,_0x4b9def,!![]);}catch(_0xe33081){return BPromise['reject'](_0xe33081);}return _0x14a7d2[_0x7048('0x25')]();};}function saveUpdates(_0x43a621,_0x31c5dc){return function(_0x248142){if(_0x248142){return _0x248142[_0x7048('0x26')](_0x43a621)[_0x7048('0x27')](function(_0x5a683d){return _0x5a683d;});}return null;};}function removeEntity(_0x4c8709,_0x519649){return function(_0x2422db){if(_0x2422db){return _0x2422db['destroy']()[_0x7048('0x27')](function(){_0x4c8709[_0x7048('0x1c')](0xcc)[_0x7048('0x1d')]();});}};}function handleEntityNotFound(_0x4fc143,_0x1e0c61){return function(_0x4ff0a8){if(!_0x4ff0a8){_0x4fc143[_0x7048('0x1b')](0x194);}return _0x4ff0a8;};}function handleError(_0x4a0f3b,_0xe3b552){_0xe3b552=_0xe3b552||0x1f4;return function(_0x2186a5){logger[_0x7048('0x28')](_0x2186a5['stack']);if(_0x2186a5[_0x7048('0x29')]){delete _0x2186a5['name'];}_0x4a0f3b[_0x7048('0x1c')](_0xe3b552)['send'](_0x2186a5);};}exports[_0x7048('0x2a')]=function(_0x5ee10a,_0x30d90b){var _0x3ccc34={},_0x52e437={},_0x5f2459={'count':0x0,'rows':[]};var _0x5ccd85=_[_0x7048('0x2b')](db[_0x7048('0x2c')]['rawAttributes'],function(_0x1d5889){return{'name':_0x1d5889['fieldName'],'type':_0x1d5889['type'][_0x7048('0x2d')]};});_0x52e437['model']=_[_0x7048('0x2b')](_0x5ccd85,_0x7048('0x29'));_0x52e437[_0x7048('0x2e')]=_[_0x7048('0x2f')](_0x5ee10a[_0x7048('0x2e')]);_0x52e437[_0x7048('0x30')]=_[_0x7048('0x31')](_0x52e437[_0x7048('0x32')],_0x52e437[_0x7048('0x2e')]);_0x3ccc34['attributes']=_['intersection'](_0x52e437[_0x7048('0x32')],qs[_0x7048('0x33')](_0x5ee10a[_0x7048('0x2e')]['fields']));_0x3ccc34[_0x7048('0x34')]=_0x3ccc34[_0x7048('0x34')][_0x7048('0x35')]?_0x3ccc34[_0x7048('0x34')]:_0x52e437[_0x7048('0x32')];if(!_0x5ee10a[_0x7048('0x2e')][_0x7048('0x36')](_0x7048('0x37'))){_0x3ccc34[_0x7048('0x20')]=qs[_0x7048('0x20')](_0x5ee10a[_0x7048('0x2e')]['limit']);_0x3ccc34['offset']=qs[_0x7048('0x22')](_0x5ee10a['query'][_0x7048('0x22')]);}_0x3ccc34['order']=qs[_0x7048('0x38')](_0x5ee10a[_0x7048('0x2e')][_0x7048('0x38')]);_0x3ccc34[_0x7048('0x39')]=qs['filters'](_[_0x7048('0x3a')](_0x5ee10a[_0x7048('0x2e')],_0x52e437[_0x7048('0x30')]),_0x5ccd85);if(_0x5ee10a[_0x7048('0x2e')]['filter']){_0x3ccc34['where']=_[_0x7048('0x3b')](_0x3ccc34[_0x7048('0x39')],{'$or':_[_0x7048('0x2b')](_0x5ccd85,function(_0x305720){if(_0x305720[_0x7048('0x3c')]!==_0x7048('0x3d')){var _0x19bf2e={};_0x19bf2e[_0x305720[_0x7048('0x29')]]={'$like':'%'+_0x5ee10a['query'][_0x7048('0x3e')]+'%'};return _0x19bf2e;}})});}_0x3ccc34=_['merge']({},_0x3ccc34,_0x5ee10a[_0x7048('0x3f')]);var _0x2e4918={'where':_0x3ccc34['where']};return db[_0x7048('0x2c')][_0x7048('0x21')](_0x2e4918)[_0x7048('0x27')](function(_0x5d268b){_0x5f2459[_0x7048('0x21')]=_0x5d268b;if(_0x5ee10a[_0x7048('0x2e')]['includeAll']){_0x3ccc34[_0x7048('0x40')]=[{'all':!![]}];}return db[_0x7048('0x2c')][_0x7048('0x41')](_0x3ccc34);})[_0x7048('0x27')](function(_0x16df50){_0x5f2459[_0x7048('0x42')]=_0x16df50;return _0x5f2459;})['then'](respondWithFilteredResult(_0x30d90b,_0x3ccc34))[_0x7048('0x43')](handleError(_0x30d90b,null));};exports[_0x7048('0x44')]=function(_0x52afa9,_0x5b23d0){var _0x360bd9={'raw':![],'where':{'id':_0x52afa9[_0x7048('0x45')]['id']}},_0x159598={};_0x159598[_0x7048('0x32')]=_[_0x7048('0x2f')](db[_0x7048('0x2c')][_0x7048('0x46')]);_0x159598[_0x7048('0x2e')]=_['keys'](_0x52afa9[_0x7048('0x2e')]);_0x159598[_0x7048('0x30')]=_[_0x7048('0x31')](_0x159598[_0x7048('0x32')],_0x159598[_0x7048('0x2e')]);_0x360bd9['attributes']=_[_0x7048('0x31')](_0x159598[_0x7048('0x32')],qs[_0x7048('0x33')](_0x52afa9[_0x7048('0x2e')]['fields']));_0x360bd9[_0x7048('0x34')]=_0x360bd9[_0x7048('0x34')][_0x7048('0x35')]?_0x360bd9['attributes']:_0x159598[_0x7048('0x32')];if(_0x52afa9['query'][_0x7048('0x47')]){_0x360bd9['include']=[{'all':!![]}];}_0x360bd9=_['merge']({},_0x360bd9,_0x52afa9[_0x7048('0x3f')]);return db[_0x7048('0x2c')][_0x7048('0x48')](_0x360bd9)[_0x7048('0x27')](handleEntityNotFound(_0x5b23d0,null))[_0x7048('0x27')](respondWithResult(_0x5b23d0,null))['catch'](handleError(_0x5b23d0,null));};exports[_0x7048('0x49')]=function(_0x2c579a,_0x3640d5){return db['FreshdeskAccount'][_0x7048('0x49')](_0x2c579a['body'],{})[_0x7048('0x27')](respondWithResult(_0x3640d5,0xc9))['catch'](handleError(_0x3640d5,null));};exports[_0x7048('0x26')]=function(_0x213d74,_0x4176e6){if(_0x213d74['body']['id']){delete _0x213d74[_0x7048('0x4a')]['id'];}return db[_0x7048('0x2c')]['find']({'where':{'id':_0x213d74['params']['id']}})['then'](handleEntityNotFound(_0x4176e6,null))['then'](saveUpdates(_0x213d74[_0x7048('0x4a')],null))[_0x7048('0x27')](respondWithResult(_0x4176e6,null))[_0x7048('0x43')](handleError(_0x4176e6,null));};exports[_0x7048('0x4b')]=function(_0x5799dc,_0x16aa5f){return db[_0x7048('0x2c')][_0x7048('0x48')]({'where':{'id':_0x5799dc[_0x7048('0x45')]['id']}})[_0x7048('0x27')](handleEntityNotFound(_0x16aa5f,null))['then'](removeEntity(_0x16aa5f,null))[_0x7048('0x43')](handleError(_0x16aa5f,null));};exports['getConfigurations']=function(_0x38b0d9,_0x3d30f3,_0x4e155c){var _0x544e2e={};var _0x21188={};var _0x48201d;var _0x2324e1;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x38b0d9[_0x7048('0x45')]['id']}})[_0x7048('0x27')](handleEntityNotFound(_0x3d30f3,null))[_0x7048('0x27')](function(_0x27111b){if(_0x27111b){_0x48201d=_0x27111b;_0x21188[_0x7048('0x32')]=_['keys'](db['FreshdeskConfiguration']['rawAttributes']);_0x21188[_0x7048('0x2e')]=_['keys'](_0x38b0d9['query']);_0x21188['filters']=_['intersection'](_0x21188[_0x7048('0x32')],_0x21188[_0x7048('0x2e')]);_0x544e2e[_0x7048('0x34')]=_[_0x7048('0x31')](_0x21188['model'],qs[_0x7048('0x33')](_0x38b0d9['query'][_0x7048('0x33')]));_0x544e2e['attributes']=_0x544e2e['attributes']['length']?_0x544e2e['attributes']:_0x21188[_0x7048('0x32')];_0x544e2e[_0x7048('0x4c')]=qs['sort'](_0x38b0d9[_0x7048('0x2e')]['sort']);_0x544e2e[_0x7048('0x39')]=qs['filters'](_[_0x7048('0x3a')](_0x38b0d9[_0x7048('0x2e')],_0x21188[_0x7048('0x30')]));if(_0x38b0d9['query'][_0x7048('0x3e')]){_0x544e2e[_0x7048('0x39')]=_['merge'](_0x544e2e[_0x7048('0x39')],{'$or':_[_0x7048('0x2b')](_0x544e2e[_0x7048('0x34')],function(_0x5a965b){var _0x49f460={};_0x49f460[_0x5a965b]={'$like':'%'+_0x38b0d9[_0x7048('0x2e')]['filter']+'%'};return _0x49f460;})});}_0x544e2e=_[_0x7048('0x3b')]({},_0x544e2e,_0x38b0d9['options']);return _0x48201d[_0x7048('0x4d')](_0x544e2e);}})[_0x7048('0x27')](function(_0x25c161){if(_0x25c161){_0x2324e1=_0x25c161[_0x7048('0x35')];if(!_0x38b0d9[_0x7048('0x2e')][_0x7048('0x36')](_0x7048('0x37'))){_0x544e2e[_0x7048('0x20')]=qs['limit'](_0x38b0d9[_0x7048('0x2e')]['limit']);_0x544e2e[_0x7048('0x22')]=qs[_0x7048('0x22')](_0x38b0d9[_0x7048('0x2e')][_0x7048('0x22')]);}return _0x48201d[_0x7048('0x4d')](_0x544e2e);}})['then'](function(_0x477297){if(_0x477297){return _0x477297?{'count':_0x2324e1,'rows':_0x477297}:null;}})['then'](respondWithResult(_0x3d30f3,null))[_0x7048('0x43')](handleError(_0x3d30f3,null));};exports[_0x7048('0x4e')]=function(_0x582e5f,_0x14aa99,_0x3edca3){if(_0x582e5f[_0x7048('0x4a')]['id']){delete _0x582e5f[_0x7048('0x4a')]['id'];}return db[_0x7048('0x2c')][_0x7048('0x4f')]({'where':{'id':_0x582e5f[_0x7048('0x45')]['id']}})[_0x7048('0x27')](handleEntityNotFound(_0x14aa99,null))[_0x7048('0x27')](function(_0x111f5a){if(_0x111f5a){_0x582e5f[_0x7048('0x4a')][_0x7048('0x50')]=_0x111f5a['id'];_0x582e5f[_0x7048('0x4a')][_0x7048('0x51')]=integrations[_0x7048('0x52')](_0x582e5f['body'][_0x7048('0x53')],_0x582e5f['body']['type']);_0x582e5f[_0x7048('0x4a')][_0x7048('0x54')]=integrations[_0x7048('0x55')](_0x582e5f[_0x7048('0x4a')][_0x7048('0x53')],_0x582e5f[_0x7048('0x4a')]['type']);return db['FreshdeskConfiguration'][_0x7048('0x49')](_0x582e5f['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x7048('0x51')},{'model':db[_0x7048('0x56')],'as':_0x7048('0x54')}]});}return null;})[_0x7048('0x27')](respondWithResult(_0x14aa99,null))[_0x7048('0x43')](handleError(_0x14aa99,null));};exports[_0x7048('0x57')]=function(_0x58f607,_0x4af837,_0x58bf48){var _0x30c96b='';return db['FreshdeskAccount'][_0x7048('0x4f')]({'where':{'id':_0x58f607[_0x7048('0x45')]['id']},'attributes':['id',_0x7048('0x58'),_0x7048('0x59')]})[_0x7048('0x27')](handleEntityNotFound(_0x4af837,null))[_0x7048('0x27')](function(_0x111b68){if(_0x111b68){_0x30c96b=_0x111b68[_0x7048('0x58')];var _0x407db1=_0x30c96b[_0x7048('0x5a')](-0x1);if(_0x407db1==='/'){_0x30c96b=_0x30c96b['substring'](0x0,_0x30c96b['lastIndexOf'](_0x407db1));}return rp({'method':_0x7048('0x5b'),'uri':util[_0x7048('0x5c')](_0x7048('0x5d'),_0x30c96b,_0x7048('0x5e')),'headers':{'Authorization':util[_0x7048('0x5c')](_0x7048('0x5f'),new Buffer(util[_0x7048('0x5c')](_0x7048('0x60'),_0x111b68['apiKey']))[_0x7048('0x61')](_0x7048('0x62')))},'json':!![]});}})['then'](function(_0x4896bd){if(_0x4896bd){var _0x370d58=[_0x7048('0x63'),_0x7048('0x64'),_0x7048('0x65'),_0x7048('0x66'),_0x7048('0x1c'),_0x7048('0x67'),_0x7048('0x68'),_0x7048('0x69'),_0x7048('0x6a'),_0x7048('0x68'),_0x7048('0x6b')];_['remove'](_0x4896bd,function(_0x1a1d71){return _0x370d58['includes'](_0x1a1d71[_0x7048('0x29')])||!_0x1a1d71[_0x7048('0x6c')]&&_0x1a1d71[_0x7048('0x3c')]!==_0x7048('0x6d')&&_0x1a1d71[_0x7048('0x3c')]!=='custom_dropdown';});return{'count':_0x4896bd[_0x7048('0x35')],'rows':_[_0x7048('0x2b')](_0x4896bd,function(_0x53a614){return{'id':_0x53a614['name'],'name':_0x53a614[_0x7048('0x6e')],'custom':!_0x53a614['default'],'options':_0x53a614[_0x7048('0x6f')]?_['map'](_0x53a614['choices'],function(_0x58c87a){return{'name':_[_0x7048('0x70')](_0x58c87a),'value':_0x58c87a};}):[]};})};}})[_0x7048('0x27')](respondWithResult(_0x4af837,null))[_0x7048('0x43')](function(_0x3e134f){var _0x82c690=_0x58f607['query'][_0x7048('0x71')]?0x1f4:_0x3e134f[_0x7048('0x72')]||0x1f4;logger['error'](_0x7048('0x73'),_0x7048('0x57'),_0x82c690,JSON['stringify'](_0x3e134f));delete _0x3e134f[_0x7048('0x29')];if(_0x82c690===0x191){_0x82c690=0x190;}_0x4af837[_0x7048('0x1c')](_0x82c690)['send'](_0x58f607[_0x7048('0x2e')][_0x7048('0x71')]?{'message':_0x7048('0x74'),'statusCode':_0x3e134f[_0x7048('0x72')]}:_0x3e134f);});};
\ No newline at end of file
+var _0x570f=['rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','FreshdeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','sort','pick','filter','where','merge','type','options','includeAll','include','catch','show','create','body','find','getConfigurations','findOne','params','FreshdeskConfiguration','order','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','remoteUri','apiKey','slice','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','requester','agent','description','group','source','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','statusCode','eml-format'];(function(_0x2df84d,_0x56d874){var _0x2634ce=function(_0x8e8e31){while(--_0x8e8e31){_0x2df84d['push'](_0x2df84d['shift']());}};_0x2634ce(++_0x56d874);}(_0x570f,0x152));var _0xf570=function(_0x51a13a,_0x9b9ee5){_0x51a13a=_0x51a13a-0x0;var _0x579f61=_0x570f[_0x51a13a];return _0x579f61;};'use strict';var emlformat=require(_0xf570('0x0'));var rimraf=require(_0xf570('0x1'));var zipdir=require(_0xf570('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf570('0x3'));var BPromise=require(_0xf570('0x4'));var Mustache=require(_0xf570('0x5'));var util=require(_0xf570('0x6'));var path=require(_0xf570('0x7'));var sox=require(_0xf570('0x8'));var csv=require(_0xf570('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf570('0xa'));var _=require('lodash');var squel=require(_0xf570('0xb'));var crypto=require('crypto');var jsforce=require(_0xf570('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf570('0x9'));var querystring=require('querystring');var Papa=require(_0xf570('0xd'));var Redis=require(_0xf570('0xe'));var authService=require(_0xf570('0xf'));var qs=require(_0xf570('0x10'));var as=require(_0xf570('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf570('0x12'))(_0xf570('0x13'));var utils=require(_0xf570('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf570('0x15'));var db=require(_0xf570('0x16'))['db'];var integrations=require(_0xf570('0x17'));function respondWithStatusCode(_0x51cb42,_0x32e0b0){_0x32e0b0=_0x32e0b0||0xcc;return function(_0xe2d1a4){if(_0xe2d1a4){return _0x51cb42[_0xf570('0x18')](_0x32e0b0);}return _0x51cb42[_0xf570('0x19')](_0x32e0b0)['end']();};}function respondWithResult(_0x9a5e4f,_0x2e0329){_0x2e0329=_0x2e0329||0xc8;return function(_0x31c58e){if(_0x31c58e){return _0x9a5e4f[_0xf570('0x19')](_0x2e0329)[_0xf570('0x1a')](_0x31c58e);}};}function respondWithFilteredResult(_0xf3423e,_0x2531f9){return function(_0x1065a9){if(_0x1065a9){var _0x14456a=typeof _0x2531f9[_0xf570('0x1b')]===_0xf570('0x1c')&&typeof _0x2531f9['limit']===_0xf570('0x1c');var _0x97f023=_0x1065a9[_0xf570('0x1d')];var _0x438e5b=_0x14456a?0x0:_0x2531f9[_0xf570('0x1b')];var _0x5cde47=_0x14456a?_0x1065a9[_0xf570('0x1d')]:_0x2531f9[_0xf570('0x1b')]+_0x2531f9[_0xf570('0x1e')];var _0x4e2649;if(_0x5cde47>=_0x97f023){_0x5cde47=_0x97f023;_0x4e2649=0xc8;}else{_0x4e2649=0xce;}_0xf3423e[_0xf570('0x19')](_0x4e2649);return _0xf3423e[_0xf570('0x1f')](_0xf570('0x20'),_0x438e5b+'-'+_0x5cde47+'/'+_0x97f023)[_0xf570('0x1a')](_0x1065a9);}return null;};}function patchUpdates(_0x576a2f){return function(_0x2f20a0){try{jsonpatch[_0xf570('0x21')](_0x2f20a0,_0x576a2f,!![]);}catch(_0x14fdef){return BPromise[_0xf570('0x22')](_0x14fdef);}return _0x2f20a0[_0xf570('0x23')]();};}function saveUpdates(_0x570703,_0xe71f1){return function(_0x101d2d){if(_0x101d2d){return _0x101d2d[_0xf570('0x24')](_0x570703)[_0xf570('0x25')](function(_0x4844e5){return _0x4844e5;});}return null;};}function removeEntity(_0x46bd4a,_0x40c4f1){return function(_0x3eb3cb){if(_0x3eb3cb){return _0x3eb3cb[_0xf570('0x26')]()[_0xf570('0x25')](function(){_0x46bd4a[_0xf570('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39d487,_0x23c6f0){return function(_0x2a8701){if(!_0x2a8701){_0x39d487[_0xf570('0x18')](0x194);}return _0x2a8701;};}function handleError(_0xe4b67f,_0x268be7){_0x268be7=_0x268be7||0x1f4;return function(_0x40a638){logger[_0xf570('0x27')](_0x40a638[_0xf570('0x28')]);if(_0x40a638[_0xf570('0x29')]){delete _0x40a638[_0xf570('0x29')];}_0xe4b67f[_0xf570('0x19')](_0x268be7)['send'](_0x40a638);};}exports['index']=function(_0x2eece8,_0x29ee27){var _0x18680a={},_0x3929e3={},_0x170eca={'count':0x0,'rows':[]};var _0x116f50=_[_0xf570('0x2a')](db[_0xf570('0x2b')][_0xf570('0x2c')],function(_0x47aff8){return{'name':_0x47aff8[_0xf570('0x2d')],'type':_0x47aff8['type'][_0xf570('0x2e')]};});_0x3929e3[_0xf570('0x2f')]=_[_0xf570('0x2a')](_0x116f50,'name');_0x3929e3[_0xf570('0x30')]=_[_0xf570('0x31')](_0x2eece8['query']);_0x3929e3[_0xf570('0x32')]=_['intersection'](_0x3929e3[_0xf570('0x2f')],_0x3929e3[_0xf570('0x30')]);_0x18680a[_0xf570('0x33')]=_[_0xf570('0x34')](_0x3929e3['model'],qs['fields'](_0x2eece8[_0xf570('0x30')][_0xf570('0x35')]));_0x18680a[_0xf570('0x33')]=_0x18680a[_0xf570('0x33')][_0xf570('0x36')]?_0x18680a['attributes']:_0x3929e3[_0xf570('0x2f')];if(!_0x2eece8['query']['hasOwnProperty']('nolimit')){_0x18680a[_0xf570('0x1e')]=qs['limit'](_0x2eece8[_0xf570('0x30')][_0xf570('0x1e')]);_0x18680a['offset']=qs['offset'](_0x2eece8[_0xf570('0x30')]['offset']);}_0x18680a['order']=qs[_0xf570('0x37')](_0x2eece8['query']['sort']);_0x18680a['where']=qs[_0xf570('0x32')](_[_0xf570('0x38')](_0x2eece8[_0xf570('0x30')],_0x3929e3[_0xf570('0x32')]),_0x116f50);if(_0x2eece8[_0xf570('0x30')][_0xf570('0x39')]){_0x18680a[_0xf570('0x3a')]=_[_0xf570('0x3b')](_0x18680a[_0xf570('0x3a')],{'$or':_[_0xf570('0x2a')](_0x116f50,function(_0x77f74f){if(_0x77f74f[_0xf570('0x3c')]!=='VIRTUAL'){var _0x417a37={};_0x417a37[_0x77f74f[_0xf570('0x29')]]={'$like':'%'+_0x2eece8[_0xf570('0x30')]['filter']+'%'};return _0x417a37;}})});}_0x18680a=_[_0xf570('0x3b')]({},_0x18680a,_0x2eece8[_0xf570('0x3d')]);var _0x22b201={'where':_0x18680a[_0xf570('0x3a')]};return db[_0xf570('0x2b')][_0xf570('0x1d')](_0x22b201)[_0xf570('0x25')](function(_0x3ae19e){_0x170eca[_0xf570('0x1d')]=_0x3ae19e;if(_0x2eece8[_0xf570('0x30')][_0xf570('0x3e')]){_0x18680a[_0xf570('0x3f')]=[{'all':!![]}];}return db[_0xf570('0x2b')]['findAll'](_0x18680a);})[_0xf570('0x25')](function(_0x8ad932){_0x170eca['rows']=_0x8ad932;return _0x170eca;})[_0xf570('0x25')](respondWithFilteredResult(_0x29ee27,_0x18680a))[_0xf570('0x40')](handleError(_0x29ee27,null));};exports[_0xf570('0x41')]=function(_0x164d2b,_0x934d12){var _0xabf891={'raw':![],'where':{'id':_0x164d2b['params']['id']}},_0x4a337={};_0x4a337[_0xf570('0x2f')]=_[_0xf570('0x31')](db[_0xf570('0x2b')][_0xf570('0x2c')]);_0x4a337[_0xf570('0x30')]=_[_0xf570('0x31')](_0x164d2b['query']);_0x4a337['filters']=_[_0xf570('0x34')](_0x4a337[_0xf570('0x2f')],_0x4a337[_0xf570('0x30')]);_0xabf891[_0xf570('0x33')]=_['intersection'](_0x4a337[_0xf570('0x2f')],qs[_0xf570('0x35')](_0x164d2b[_0xf570('0x30')]['fields']));_0xabf891[_0xf570('0x33')]=_0xabf891['attributes'][_0xf570('0x36')]?_0xabf891[_0xf570('0x33')]:_0x4a337[_0xf570('0x2f')];if(_0x164d2b[_0xf570('0x30')][_0xf570('0x3e')]){_0xabf891[_0xf570('0x3f')]=[{'all':!![]}];}_0xabf891=_[_0xf570('0x3b')]({},_0xabf891,_0x164d2b[_0xf570('0x3d')]);return db['FreshdeskAccount']['find'](_0xabf891)[_0xf570('0x25')](handleEntityNotFound(_0x934d12,null))['then'](respondWithResult(_0x934d12,null))[_0xf570('0x40')](handleError(_0x934d12,null));};exports[_0xf570('0x42')]=function(_0x31c94f,_0x42e69){return db[_0xf570('0x2b')][_0xf570('0x42')](_0x31c94f[_0xf570('0x43')],{})[_0xf570('0x25')](respondWithResult(_0x42e69,0xc9))[_0xf570('0x40')](handleError(_0x42e69,null));};exports['update']=function(_0x3698d6,_0x5b9858){if(_0x3698d6[_0xf570('0x43')]['id']){delete _0x3698d6[_0xf570('0x43')]['id'];}return db[_0xf570('0x2b')]['find']({'where':{'id':_0x3698d6['params']['id']}})[_0xf570('0x25')](handleEntityNotFound(_0x5b9858,null))['then'](saveUpdates(_0x3698d6[_0xf570('0x43')],null))['then'](respondWithResult(_0x5b9858,null))['catch'](handleError(_0x5b9858,null));};exports[_0xf570('0x26')]=function(_0x1e0964,_0x2991e9){return db[_0xf570('0x2b')][_0xf570('0x44')]({'where':{'id':_0x1e0964['params']['id']}})[_0xf570('0x25')](handleEntityNotFound(_0x2991e9,null))[_0xf570('0x25')](removeEntity(_0x2991e9,null))['catch'](handleError(_0x2991e9,null));};exports[_0xf570('0x45')]=function(_0x4d442d,_0x4673c,_0x3d6adc){var _0x3d566e={};var _0xb5247f={};var _0x273cda;var _0x563e3f;return db['FreshdeskAccount'][_0xf570('0x46')]({'where':{'id':_0x4d442d[_0xf570('0x47')]['id']}})[_0xf570('0x25')](handleEntityNotFound(_0x4673c,null))[_0xf570('0x25')](function(_0x5d84c4){if(_0x5d84c4){_0x273cda=_0x5d84c4;_0xb5247f[_0xf570('0x2f')]=_['keys'](db[_0xf570('0x48')][_0xf570('0x2c')]);_0xb5247f[_0xf570('0x30')]=_[_0xf570('0x31')](_0x4d442d['query']);_0xb5247f[_0xf570('0x32')]=_['intersection'](_0xb5247f['model'],_0xb5247f[_0xf570('0x30')]);_0x3d566e['attributes']=_['intersection'](_0xb5247f[_0xf570('0x2f')],qs[_0xf570('0x35')](_0x4d442d['query'][_0xf570('0x35')]));_0x3d566e[_0xf570('0x33')]=_0x3d566e['attributes'][_0xf570('0x36')]?_0x3d566e['attributes']:_0xb5247f[_0xf570('0x2f')];_0x3d566e[_0xf570('0x49')]=qs[_0xf570('0x37')](_0x4d442d[_0xf570('0x30')][_0xf570('0x37')]);_0x3d566e['where']=qs[_0xf570('0x32')](_[_0xf570('0x38')](_0x4d442d['query'],_0xb5247f[_0xf570('0x32')]));if(_0x4d442d['query'][_0xf570('0x39')]){_0x3d566e[_0xf570('0x3a')]=_['merge'](_0x3d566e[_0xf570('0x3a')],{'$or':_['map'](_0x3d566e[_0xf570('0x33')],function(_0x193b47){var _0xa3a1e9={};_0xa3a1e9[_0x193b47]={'$like':'%'+_0x4d442d[_0xf570('0x30')][_0xf570('0x39')]+'%'};return _0xa3a1e9;})});}_0x3d566e=_[_0xf570('0x3b')]({},_0x3d566e,_0x4d442d['options']);return _0x273cda['getConfigurations'](_0x3d566e);}})['then'](function(_0x4b443f){if(_0x4b443f){_0x563e3f=_0x4b443f['length'];if(!_0x4d442d[_0xf570('0x30')][_0xf570('0x4a')](_0xf570('0x4b'))){_0x3d566e['limit']=qs[_0xf570('0x1e')](_0x4d442d[_0xf570('0x30')][_0xf570('0x1e')]);_0x3d566e[_0xf570('0x1b')]=qs['offset'](_0x4d442d[_0xf570('0x30')][_0xf570('0x1b')]);}return _0x273cda[_0xf570('0x45')](_0x3d566e);}})['then'](function(_0x4983c2){if(_0x4983c2){return _0x4983c2?{'count':_0x563e3f,'rows':_0x4983c2}:null;}})[_0xf570('0x25')](respondWithResult(_0x4673c,null))[_0xf570('0x40')](handleError(_0x4673c,null));};exports['addConfiguration']=function(_0x11c1d4,_0x4efc54,_0x534efc){if(_0x11c1d4['body']['id']){delete _0x11c1d4['body']['id'];}return db[_0xf570('0x2b')]['findOne']({'where':{'id':_0x11c1d4[_0xf570('0x47')]['id']}})[_0xf570('0x25')](handleEntityNotFound(_0x4efc54,null))[_0xf570('0x25')](function(_0x511e08){if(_0x511e08){_0x11c1d4[_0xf570('0x43')][_0xf570('0x4c')]=_0x511e08['id'];_0x11c1d4['body'][_0xf570('0x4d')]=integrations[_0xf570('0x4e')](_0x11c1d4[_0xf570('0x43')]['channel'],_0x11c1d4[_0xf570('0x43')][_0xf570('0x3c')]);_0x11c1d4[_0xf570('0x43')][_0xf570('0x4f')]=integrations[_0xf570('0x50')](_0x11c1d4[_0xf570('0x43')][_0xf570('0x51')],_0x11c1d4[_0xf570('0x43')]['type']);return db[_0xf570('0x48')][_0xf570('0x42')](_0x11c1d4[_0xf570('0x43')],{'include':[{'model':db[_0xf570('0x52')],'as':'Subjects'},{'model':db[_0xf570('0x52')],'as':_0xf570('0x4f')}]});}return null;})['then'](respondWithResult(_0x4efc54,null))[_0xf570('0x40')](handleError(_0x4efc54,null));};exports['getFields']=function(_0x4bb2ed,_0x5b0abd,_0x172c88){var _0xcb8228='';return db[_0xf570('0x2b')][_0xf570('0x46')]({'where':{'id':_0x4bb2ed[_0xf570('0x47')]['id']},'attributes':['id',_0xf570('0x53'),_0xf570('0x54')]})['then'](handleEntityNotFound(_0x5b0abd,null))[_0xf570('0x25')](function(_0x5c1372){if(_0x5c1372){_0xcb8228=_0x5c1372[_0xf570('0x53')];var _0x437246=_0xcb8228[_0xf570('0x55')](-0x1);if(_0x437246==='/'){_0xcb8228=_0xcb8228['substring'](0x0,_0xcb8228['lastIndexOf'](_0x437246));}return rp({'method':_0xf570('0x56'),'uri':util[_0xf570('0x57')](_0xf570('0x58'),_0xcb8228,_0xf570('0x59')),'headers':{'Authorization':util[_0xf570('0x57')]('Basic\x20%s',new Buffer(util[_0xf570('0x57')](_0xf570('0x5a'),_0x5c1372[_0xf570('0x54')]))[_0xf570('0x5b')](_0xf570('0x5c')))},'json':!![]});}})['then'](function(_0x5b004e){if(_0x5b004e){var _0x43be69=[_0xf570('0x5d'),'subject',_0xf570('0x5e'),_0xf570('0x5f'),_0xf570('0x19'),'priority',_0xf570('0x60'),_0xf570('0x61'),'ticket_type',_0xf570('0x60'),_0xf570('0x62')];_[_0xf570('0x63')](_0x5b004e,function(_0x4b3118){return _0x43be69[_0xf570('0x64')](_0x4b3118[_0xf570('0x29')])||!_0x4b3118[_0xf570('0x65')]&&_0x4b3118[_0xf570('0x3c')]!==_0xf570('0x66')&&_0x4b3118['type']!==_0xf570('0x67');});return{'count':_0x5b004e[_0xf570('0x36')],'rows':_[_0xf570('0x2a')](_0x5b004e,function(_0x138e17){return{'id':_0x138e17[_0xf570('0x29')],'name':_0x138e17[_0xf570('0x68')],'custom':!_0x138e17[_0xf570('0x65')],'options':_0x138e17[_0xf570('0x69')]?_[_0xf570('0x2a')](_0x138e17['choices'],function(_0x45e9c7){return{'name':_[_0xf570('0x6a')](_0x45e9c7),'value':_0x45e9c7};}):[]};})};}})[_0xf570('0x25')](respondWithResult(_0x5b0abd,null))[_0xf570('0x40')](function(_0x37611b){var _0x551fda=_0x4bb2ed['query']['test']?0x1f4:_0x37611b['statusCode']||0x1f4;logger[_0xf570('0x27')](_0xf570('0x6b'),_0xf570('0x6c'),_0x551fda,JSON[_0xf570('0x6d')](_0x37611b));delete _0x37611b['name'];if(_0x551fda===0x191){_0x551fda=0x190;}_0x5b0abd[_0xf570('0x19')](_0x551fda)['send'](_0x4bb2ed[_0xf570('0x30')][_0xf570('0x6e')]?{'message':_0xf570('0x6f'),'statusCode':_0x37611b[_0xf570('0x70')]}:_0x37611b);});};
\ No newline at end of file
index d7d3046..ca5f82c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb8eb=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','define','int_freshdesk_accounts'];(function(_0x4ce019,_0x11ce5d){var _0x4e56b4=function(_0x5eff6f){while(--_0x5eff6f){_0x4ce019['push'](_0x4ce019['shift']());}};_0x4e56b4(++_0x11ce5d);}(_0xb8eb,0x140));var _0xbb8e=function(_0x12733,_0x5872d4){_0x12733=_0x12733-0x0;var _0xcbb2f8=_0xb8eb[_0x12733];return _0xcbb2f8;};'use strict';var _=require(_0xbb8e('0x0'));var util=require('util');var logger=require(_0xbb8e('0x1'))('api');var moment=require(_0xbb8e('0x2'));var BPromise=require(_0xbb8e('0x3'));var rp=require(_0xbb8e('0x4'));var fs=require('fs');var path=require(_0xbb8e('0x5'));var rimraf=require(_0xbb8e('0x6'));var config=require('../../config/environment');var attributes=require(_0xbb8e('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x24c90a,_0x2104af){return _0x24c90a[_0xbb8e('0x8')]('FreshdeskAccount',attributes,{'tableName':_0xbb8e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x16f3=['../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x34fd61,_0x2d742a){var _0x309d6b=function(_0x2e9dc1){while(--_0x2e9dc1){_0x34fd61['push'](_0x34fd61['shift']());}};_0x309d6b(++_0x2d742a);}(_0x16f3,0x151));var _0x316f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16f3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x316f('0x0'));var util=require(_0x316f('0x1'));var logger=require(_0x316f('0x2'))('api');var moment=require(_0x316f('0x3'));var BPromise=require(_0x316f('0x4'));var rp=require(_0x316f('0x5'));var fs=require('fs');var path=require(_0x316f('0x6'));var rimraf=require(_0x316f('0x7'));var config=require(_0x316f('0x8'));var attributes=require(_0x316f('0x9'));var integrations=require(_0x316f('0xa'));module[_0x316f('0xb')]=function(_0x154304,_0x1a8836){return _0x154304[_0x316f('0xc')](_0x316f('0xd'),attributes,{'tableName':_0x316f('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 19e3dbe..40e2c3e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x69e5=['map','model','find','raw','ShowFreshdeskAccount','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','include'];(function(_0x597646,_0x3b7fa5){var _0x3d2ee8=function(_0x8fe622){while(--_0x8fe622){_0x597646['push'](_0x597646['shift']());}};_0x3d2ee8(++_0x3b7fa5);}(_0x69e5,0x1cc));var _0x569e=function(_0x1aed80,_0x3ca6f6){_0x1aed80=_0x1aed80-0x0;var _0x43961e=_0x69e5[_0x1aed80];return _0x43961e;};'use strict';var _=require(_0x569e('0x0'));var util=require(_0x569e('0x1'));var moment=require(_0x569e('0x2'));var BPromise=require(_0x569e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x569e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x569e('0x5'));var logger=require('../../config/logger')(_0x569e('0x6'));var config=require(_0x569e('0x7'));var jayson=require(_0x569e('0x8'));var client=jayson[_0x569e('0x9')][_0x569e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11f56f,_0x531654,_0x27ce08){return new BPromise(function(_0x447d0e,_0x2556de){return client[_0x569e('0xb')](_0x11f56f,_0x27ce08)[_0x569e('0xc')](function(_0x3caf36){logger[_0x569e('0xd')](_0x569e('0xe'),_0x531654,'request\x20sent');logger[_0x569e('0xf')](_0x569e('0x10'),_0x531654,_0x569e('0x11'),JSON[_0x569e('0x12')](_0x3caf36));if(_0x3caf36[_0x569e('0x13')]){if(_0x3caf36[_0x569e('0x13')][_0x569e('0x14')]===0x1f4){logger['error'](_0x569e('0xe'),_0x531654,_0x3caf36[_0x569e('0x13')][_0x569e('0x15')]);return _0x2556de(_0x3caf36[_0x569e('0x13')]['message']);}logger[_0x569e('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x531654,_0x3caf36[_0x569e('0x13')][_0x569e('0x15')]);return _0x447d0e(_0x3caf36[_0x569e('0x13')]['message']);}else{logger[_0x569e('0xd')](_0x569e('0xe'),_0x531654,_0x569e('0x11'));_0x447d0e(_0x3caf36['result'][_0x569e('0x15')]);}})[_0x569e('0x16')](function(_0x56a80c){logger[_0x569e('0x13')](_0x569e('0xe'),_0x531654,_0x56a80c);_0x2556de(_0x56a80c);});});}exports[_0x569e('0x17')]=function(_0x3c4c39){var _0x48efad=this;return new Promise(function(_0x2873e8,_0x3b448a){return db[_0x569e('0x18')][_0x569e('0x19')]({'raw':_0x3c4c39[_0x569e('0x1a')]?_0x3c4c39['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c4c39[_0x569e('0x1a')]?_0x3c4c39[_0x569e('0x1a')][_0x569e('0x1b')]||null:null,'attributes':_0x3c4c39[_0x569e('0x1a')]?_0x3c4c39['options'][_0x569e('0x1c')]||null:null,'limit':_0x3c4c39[_0x569e('0x1a')]?_0x3c4c39['options']['limit']||null:null,'include':_0x3c4c39[_0x569e('0x1a')]?_0x3c4c39['options'][_0x569e('0x1d')]?_[_0x569e('0x1e')](_0x3c4c39['options'][_0x569e('0x1d')],function(_0x2649b2){return{'model':db[_0x2649b2[_0x569e('0x1f')]],'as':_0x2649b2['as'],'attributes':_0x2649b2[_0x569e('0x1c')],'include':_0x2649b2[_0x569e('0x1d')]?_[_0x569e('0x1e')](_0x2649b2[_0x569e('0x1d')],function(_0x415e80){return{'model':db[_0x415e80['model']],'as':_0x415e80['as'],'attributes':_0x415e80[_0x569e('0x1c')],'include':_0x415e80[_0x569e('0x1d')]?_['map'](_0x415e80[_0x569e('0x1d')],function(_0x35d838){return{'model':db[_0x35d838[_0x569e('0x1f')]],'as':_0x35d838['as'],'attributes':_0x35d838['attributes']};}):[]};}):[]};}):[]:[]})[_0x569e('0xc')](function(_0x46788b){logger[_0x569e('0xd')]('GetFreshdeskAccount',_0x3c4c39);logger[_0x569e('0xf')](_0x569e('0x17'),_0x3c4c39,JSON['stringify'](_0x46788b));_0x2873e8(_0x46788b);})[_0x569e('0x16')](function(_0x326e31){logger[_0x569e('0x13')](_0x569e('0x17'),_0x326e31[_0x569e('0x15')],_0x3c4c39);_0x3b448a(_0x48efad['error'](0x1f4,_0x326e31['message']));});});};exports['ShowFreshdeskAccount']=function(_0x1f940b){var _0x3c5ba7=this;return new Promise(function(_0x568c62,_0x4ef223){return db['FreshdeskAccount'][_0x569e('0x20')]({'raw':_0x1f940b['options']?_0x1f940b['options'][_0x569e('0x21')]===undefined?!![]:![]:!![],'where':_0x1f940b[_0x569e('0x1a')]?_0x1f940b[_0x569e('0x1a')][_0x569e('0x1b')]||null:null,'attributes':_0x1f940b[_0x569e('0x1a')]?_0x1f940b[_0x569e('0x1a')][_0x569e('0x1c')]||null:null,'include':_0x1f940b[_0x569e('0x1a')]?_0x1f940b['options'][_0x569e('0x1d')]?_['map'](_0x1f940b[_0x569e('0x1a')][_0x569e('0x1d')],function(_0x243ab6){return{'model':db[_0x243ab6['model']],'as':_0x243ab6['as'],'attributes':_0x243ab6[_0x569e('0x1c')],'include':_0x243ab6[_0x569e('0x1d')]?_[_0x569e('0x1e')](_0x243ab6['include'],function(_0x28d4d6){return{'model':db[_0x28d4d6[_0x569e('0x1f')]],'as':_0x28d4d6['as'],'attributes':_0x28d4d6[_0x569e('0x1c')],'include':_0x28d4d6[_0x569e('0x1d')]?_[_0x569e('0x1e')](_0x28d4d6['include'],function(_0x19bd0c){return{'model':db[_0x19bd0c[_0x569e('0x1f')]],'as':_0x19bd0c['as'],'attributes':_0x19bd0c[_0x569e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x569e('0xc')](function(_0xfec21){logger['info'](_0x569e('0x22'),_0x1f940b);logger[_0x569e('0xf')]('ShowFreshdeskAccount',_0x1f940b,JSON[_0x569e('0x12')](_0xfec21));_0x568c62(_0xfec21);})[_0x569e('0x16')](function(_0x48e17b){logger['error']('ShowFreshdeskAccount',_0x48e17b[_0x569e('0x15')],_0x1f940b);_0x4ef223(_0x3c5ba7[_0x569e('0x13')](0x1f4,_0x48e17b[_0x569e('0x15')]));});});};
\ No newline at end of file
+var _0x8ef6=['jayson/promise','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshdeskAccount','findAll','options','raw','limit','map','include','model','attributes','GetFreshdeskAccount','ShowFreshdeskAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3ca452,_0x171c36){var _0x22bb38=function(_0x2d3737){while(--_0x2d3737){_0x3ca452['push'](_0x3ca452['shift']());}};_0x22bb38(++_0x171c36);}(_0x8ef6,0xf2));var _0x68ef=function(_0x31e3ad,_0x4c70e1){_0x31e3ad=_0x31e3ad-0x0;var _0x5f32be=_0x8ef6[_0x31e3ad];return _0x5f32be;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['GetFreshdeskAccount']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'limit':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]||null:null,'include':_0x2633c1['options']?_0x2633c1['options']['include']?_[_0x68ef('0x1d')](_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1e')],function(_0x2e6e39){return{'model':db[_0x2e6e39[_0x68ef('0x1f')]],'as':_0x2e6e39['as'],'attributes':_0x2e6e39[_0x68ef('0x20')],'include':_0x2e6e39[_0x68ef('0x1e')]?_[_0x68ef('0x1d')](_0x2e6e39[_0x68ef('0x1e')],function(_0x13280b){return{'model':db[_0x13280b['model']],'as':_0x13280b['as'],'attributes':_0x13280b[_0x68ef('0x20')],'include':_0x13280b['include']?_['map'](_0x13280b['include'],function(_0x1a7ce1){return{'model':db[_0x1a7ce1[_0x68ef('0x1f')]],'as':_0x1a7ce1['as'],'attributes':_0x1a7ce1[_0x68ef('0x20')]};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x52e67e){logger['info'](_0x68ef('0x21'),_0x2633c1);logger[_0x68ef('0x10')](_0x68ef('0x21'),_0x2633c1,JSON[_0x68ef('0x12')](_0x52e67e));_0x4ade0d(_0x52e67e);})[_0x68ef('0x17')](function(_0x201884){logger[_0x68ef('0x13')](_0x68ef('0x21'),_0x201884['message'],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x201884[_0x68ef('0x15')]));});});};exports[_0x68ef('0x22')]=function(_0x4c25aa){var _0x370a8f=this;return new Promise(function(_0x523120,_0x133788){return db[_0x68ef('0x18')]['find']({'raw':_0x4c25aa['options']?_0x4c25aa[_0x68ef('0x1a')][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c25aa['options']?_0x4c25aa[_0x68ef('0x1a')][_0x68ef('0x23')]||null:null,'attributes':_0x4c25aa[_0x68ef('0x1a')]?_0x4c25aa[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x4c25aa[_0x68ef('0x1a')]?_0x4c25aa[_0x68ef('0x1a')]['include']?_[_0x68ef('0x1d')](_0x4c25aa['options'][_0x68ef('0x1e')],function(_0xab3c17){return{'model':db[_0xab3c17['model']],'as':_0xab3c17['as'],'attributes':_0xab3c17[_0x68ef('0x20')],'include':_0xab3c17['include']?_[_0x68ef('0x1d')](_0xab3c17['include'],function(_0x2fbb0d){return{'model':db[_0x2fbb0d[_0x68ef('0x1f')]],'as':_0x2fbb0d['as'],'attributes':_0x2fbb0d[_0x68ef('0x20')],'include':_0x2fbb0d['include']?_[_0x68ef('0x1d')](_0x2fbb0d['include'],function(_0x476938){return{'model':db[_0x476938['model']],'as':_0x476938['as'],'attributes':_0x476938[_0x68ef('0x20')]};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x102df9){logger[_0x68ef('0xd')](_0x68ef('0x22'),_0x4c25aa);logger[_0x68ef('0x10')]('ShowFreshdeskAccount',_0x4c25aa,JSON[_0x68ef('0x12')](_0x102df9));_0x523120(_0x102df9);})[_0x68ef('0x17')](function(_0x32074a){logger['error'](_0x68ef('0x22'),_0x32074a[_0x68ef('0x15')],_0x4c25aa);_0x133788(_0x370a8f[_0x68ef('0x13')](0x1f4,_0x32074a['message']));});});};
\ No newline at end of file
index 45e7824..021dd94 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf512=['isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','getTags','create','post','/:id/tags','setTags','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5d3f51,_0x3025b6){var _0x24bcdb=function(_0x3d2ed1){while(--_0x3d2ed1){_0x5d3f51['push'](_0x5d3f51['shift']());}};_0x24bcdb(++_0x3025b6);}(_0xf512,0x1c2));var _0x2f51=function(_0x40fecc,_0x4f4e4e){_0x40fecc=_0x40fecc-0x0;var _0x38096b=_0xf512[_0x40fecc];return _0x38096b;};'use strict';var multer=require(_0x2f51('0x0'));var util=require('util');var path=require(_0x2f51('0x1'));var timeout=require(_0x2f51('0x2'));var express=require(_0x2f51('0x3'));var router=express['Router']();var fs_extra=require(_0x2f51('0x4'));var auth=require(_0x2f51('0x5'));var interaction=require(_0x2f51('0x6'));var config=require(_0x2f51('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x2f51('0x8')]('/',auth[_0x2f51('0x9')](),controller['index']);router[_0x2f51('0x8')](_0x2f51('0xa'),auth[_0x2f51('0x9')](),controller[_0x2f51('0xb')]);router[_0x2f51('0x8')](_0x2f51('0xc'),auth['isAuthenticated'](),controller[_0x2f51('0xd')]);router['get'](_0x2f51('0xe'),auth[_0x2f51('0x9')](),controller['getSubjects']);router['get'](_0x2f51('0xf'),auth[_0x2f51('0x9')](),controller[_0x2f51('0x10')]);router['get']('/:id/tags',auth[_0x2f51('0x9')](),controller[_0x2f51('0x11')]);router['post']('/',auth[_0x2f51('0x9')](),controller[_0x2f51('0x12')]);router[_0x2f51('0x13')](_0x2f51('0x14'),auth['isAuthenticated'](),controller[_0x2f51('0x15')]);router[_0x2f51('0x16')](_0x2f51('0xa'),auth[_0x2f51('0x9')](),controller[_0x2f51('0x17')]);router[_0x2f51('0x18')](_0x2f51('0xa'),auth[_0x2f51('0x9')](),controller[_0x2f51('0x19')]);module[_0x2f51('0x1a')]=router;
\ No newline at end of file
+var _0x9069=['fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/tags','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2ff8ec,_0x22a71f){var _0x37a7b8=function(_0x4d2256){while(--_0x4d2256){_0x2ff8ec['push'](_0x2ff8ec['shift']());}};_0x37a7b8(++_0x22a71f);}(_0x9069,0xaa));var _0x9906=function(_0x50337b,_0x35a8ee){_0x50337b=_0x50337b-0x0;var _0x53d607=_0x9069[_0x50337b];return _0x53d607;};'use strict';var multer=require(_0x9906('0x0'));var util=require(_0x9906('0x1'));var path=require(_0x9906('0x2'));var timeout=require(_0x9906('0x3'));var express=require(_0x9906('0x4'));var router=express[_0x9906('0x5')]();var fs_extra=require(_0x9906('0x6'));var auth=require(_0x9906('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9906('0x8'));var controller=require(_0x9906('0x9'));router[_0x9906('0xa')]('/',auth[_0x9906('0xb')](),controller['index']);router[_0x9906('0xa')]('/:id',auth[_0x9906('0xb')](),controller[_0x9906('0xc')]);router[_0x9906('0xa')](_0x9906('0xd'),auth[_0x9906('0xb')](),controller[_0x9906('0xe')]);router[_0x9906('0xa')](_0x9906('0xf'),auth[_0x9906('0xb')](),controller['getSubjects']);router[_0x9906('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x9906('0xa')](_0x9906('0x10'),auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth[_0x9906('0xb')](),controller['create']);router['post']('/:id/tags',auth[_0x9906('0xb')](),controller['setTags']);router[_0x9906('0x11')](_0x9906('0x12'),auth[_0x9906('0xb')](),controller[_0x9906('0x13')]);router[_0x9906('0x14')](_0x9906('0x12'),auth[_0x9906('0xb')](),controller['destroy']);module[_0x9906('0x15')]=router;
\ No newline at end of file
index 8a40e88..441fbfe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcdfb=['STRING'];(function(_0x2d8ddd,_0xea8217){var _0x55576c=function(_0x25666a){while(--_0x25666a){_0x2d8ddd['push'](_0x2d8ddd['shift']());}};_0x55576c(++_0xea8217);}(_0xcdfb,0x1f3));var _0xbcdf=function(_0x262ac7,_0x1ed4a3){_0x262ac7=_0x262ac7-0x0;var _0x36fcb5=_0xcdfb[_0x262ac7];return _0x36fcb5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbcdf('0x0')]},'description':{'type':Sequelize[_0xbcdf('0x0')]}};
\ No newline at end of file
+var _0xa19f=['STRING','exports'];(function(_0x38d3b5,_0xd6a11f){var _0x3161c1=function(_0xd24a1){while(--_0xd24a1){_0x38d3b5['push'](_0x38d3b5['shift']());}};_0x3161c1(++_0xd6a11f);}(_0xa19f,0x89));var _0xfa19=function(_0x1a8a31,_0x1cd27e){_0x1a8a31=_0x1a8a31-0x0;var _0x3cd8a9=_0xa19f[_0x1a8a31];return _0x3cd8a9;};'use strict';var Sequelize=require('sequelize');module[_0xfa19('0x0')]={'name':{'type':Sequelize[_0xfa19('0x1')]},'description':{'type':Sequelize[_0xfa19('0x1')]}};
\ No newline at end of file
index 701dadc..7ac2a0a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2358=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','length','includeAll','find','create','body','params','getFields','FreshdeskField','getSubjects','findOne','getTags','Tag','setTags','ids','eml-format'];(function(_0x5bcfed,_0x34f2f8){var _0x149d7c=function(_0x4b2ef7){while(--_0x4b2ef7){_0x5bcfed['push'](_0x5bcfed['shift']());}};_0x149d7c(++_0x34f2f8);}(_0x2358,0x1eb));var _0x8235=function(_0x53db56,_0x48d021){_0x53db56=_0x53db56-0x0;var _0x19418c=_0x2358[_0x53db56];return _0x19418c;};'use strict';var emlformat=require(_0x8235('0x0'));var rimraf=require(_0x8235('0x1'));var zipdir=require(_0x8235('0x2'));var jsonpatch=require(_0x8235('0x3'));var rp=require(_0x8235('0x4'));var moment=require(_0x8235('0x5'));var BPromise=require(_0x8235('0x6'));var Mustache=require(_0x8235('0x7'));var util=require(_0x8235('0x8'));var path=require(_0x8235('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8235('0xa'));var squel=require(_0x8235('0xb'));var crypto=require(_0x8235('0xc'));var jsforce=require(_0x8235('0xd'));var deskjs=require(_0x8235('0xe'));var toCsv=require(_0x8235('0xf'));var querystring=require(_0x8235('0x10'));var Papa=require(_0x8235('0x11'));var Redis=require(_0x8235('0x12'));var authService=require(_0x8235('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8235('0x14'));var logger=require(_0x8235('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8235('0x16'));var licenseUtil=require(_0x8235('0x17'));var db=require(_0x8235('0x18'))['db'];function respondWithStatusCode(_0x22ef2b,_0x47bea5){_0x47bea5=_0x47bea5||0xcc;return function(_0xb058a7){if(_0xb058a7){return _0x22ef2b[_0x8235('0x19')](_0x47bea5);}return _0x22ef2b['status'](_0x47bea5)[_0x8235('0x1a')]();};}function respondWithResult(_0x55a619,_0x1b1185){_0x1b1185=_0x1b1185||0xc8;return function(_0x1f6634){if(_0x1f6634){return _0x55a619[_0x8235('0x1b')](_0x1b1185)[_0x8235('0x1c')](_0x1f6634);}};}function respondWithFilteredResult(_0x1b49b7,_0x3919d4){return function(_0x2302d6){if(_0x2302d6){var _0x9ee5b8=typeof _0x3919d4['offset']===_0x8235('0x1d')&&typeof _0x3919d4[_0x8235('0x1e')]==='undefined';var _0x47cd8c=_0x2302d6[_0x8235('0x1f')];var _0x3fa4bf=_0x9ee5b8?0x0:_0x3919d4[_0x8235('0x20')];var _0x22ee1f=_0x9ee5b8?_0x2302d6[_0x8235('0x1f')]:_0x3919d4[_0x8235('0x20')]+_0x3919d4['limit'];var _0x496ccc;if(_0x22ee1f>=_0x47cd8c){_0x22ee1f=_0x47cd8c;_0x496ccc=0xc8;}else{_0x496ccc=0xce;}_0x1b49b7[_0x8235('0x1b')](_0x496ccc);return _0x1b49b7['set'](_0x8235('0x21'),_0x3fa4bf+'-'+_0x22ee1f+'/'+_0x47cd8c)[_0x8235('0x1c')](_0x2302d6);}return null;};}function patchUpdates(_0x13107){return function(_0xe72d4b){try{jsonpatch[_0x8235('0x22')](_0xe72d4b,_0x13107,!![]);}catch(_0x2b1251){return BPromise[_0x8235('0x23')](_0x2b1251);}return _0xe72d4b[_0x8235('0x24')]();};}function saveUpdates(_0x57cfec,_0x3a5378){return function(_0x4a75bb){if(_0x4a75bb){return _0x4a75bb[_0x8235('0x25')](_0x57cfec)[_0x8235('0x26')](function(_0xeccd9f){return _0xeccd9f;});}return null;};}function removeEntity(_0x40956f,_0x362eec){return function(_0x377c82){if(_0x377c82){return _0x377c82[_0x8235('0x27')]()[_0x8235('0x26')](function(){_0x40956f[_0x8235('0x1b')](0xcc)[_0x8235('0x1a')]();});}};}function handleEntityNotFound(_0x38e737,_0x156d4f){return function(_0x254aa5){if(!_0x254aa5){_0x38e737[_0x8235('0x19')](0x194);}return _0x254aa5;};}function handleError(_0x4864c3,_0x2c5857){_0x2c5857=_0x2c5857||0x1f4;return function(_0x5a0493){logger[_0x8235('0x28')](_0x5a0493[_0x8235('0x29')]);if(_0x5a0493[_0x8235('0x2a')]){delete _0x5a0493['name'];}_0x4864c3[_0x8235('0x1b')](_0x2c5857)[_0x8235('0x2b')](_0x5a0493);};}exports['index']=function(_0x506414,_0x36c4e9){var _0x1117d9={},_0x5dc426={},_0x2aa1fe={'count':0x0,'rows':[]};var _0x41689d=_[_0x8235('0x2c')](db[_0x8235('0x2d')][_0x8235('0x2e')],function(_0x54b775){return{'name':_0x54b775[_0x8235('0x2f')],'type':_0x54b775[_0x8235('0x30')]['key']};});_0x5dc426[_0x8235('0x31')]=_[_0x8235('0x2c')](_0x41689d,_0x8235('0x2a'));_0x5dc426[_0x8235('0x32')]=_[_0x8235('0x33')](_0x506414['query']);_0x5dc426[_0x8235('0x34')]=_[_0x8235('0x35')](_0x5dc426['model'],_0x5dc426[_0x8235('0x32')]);_0x1117d9[_0x8235('0x36')]=_['intersection'](_0x5dc426['model'],qs['fields'](_0x506414[_0x8235('0x32')][_0x8235('0x37')]));_0x1117d9[_0x8235('0x36')]=_0x1117d9[_0x8235('0x36')]['length']?_0x1117d9[_0x8235('0x36')]:_0x5dc426[_0x8235('0x31')];if(!_0x506414['query'][_0x8235('0x38')](_0x8235('0x39'))){_0x1117d9[_0x8235('0x1e')]=qs[_0x8235('0x1e')](_0x506414[_0x8235('0x32')]['limit']);_0x1117d9[_0x8235('0x20')]=qs[_0x8235('0x20')](_0x506414[_0x8235('0x32')]['offset']);}_0x1117d9[_0x8235('0x3a')]=qs[_0x8235('0x3b')](_0x506414[_0x8235('0x32')][_0x8235('0x3b')]);_0x1117d9[_0x8235('0x3c')]=qs[_0x8235('0x34')](_[_0x8235('0x3d')](_0x506414[_0x8235('0x32')],_0x5dc426[_0x8235('0x34')]),_0x41689d);if(_0x506414[_0x8235('0x32')][_0x8235('0x3e')]){_0x1117d9[_0x8235('0x3c')]=_[_0x8235('0x3f')](_0x1117d9[_0x8235('0x3c')],{'$or':_[_0x8235('0x2c')](_0x41689d,function(_0x1c1709){if(_0x1c1709[_0x8235('0x30')]!==_0x8235('0x40')){var _0x5bf640={};_0x5bf640[_0x1c1709['name']]={'$like':'%'+_0x506414['query'][_0x8235('0x3e')]+'%'};return _0x5bf640;}})});}_0x1117d9=_[_0x8235('0x3f')]({},_0x1117d9,_0x506414[_0x8235('0x41')]);var _0x35a469={'where':_0x1117d9[_0x8235('0x3c')]};return db['FreshdeskConfiguration'][_0x8235('0x1f')](_0x35a469)[_0x8235('0x26')](function(_0x4ac7e6){_0x2aa1fe[_0x8235('0x1f')]=_0x4ac7e6;if(_0x506414['query']['includeAll']){_0x1117d9['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x8235('0x42')](_0x1117d9);})[_0x8235('0x26')](function(_0x505f36){_0x2aa1fe['rows']=_0x505f36;return _0x2aa1fe;})['then'](respondWithFilteredResult(_0x36c4e9,_0x1117d9))[_0x8235('0x43')](handleError(_0x36c4e9,null));};exports['show']=function(_0x546fd3,_0x4f5538){var _0xc740ca={'raw':![],'where':{'id':_0x546fd3['params']['id']}},_0x48a84={};_0x48a84[_0x8235('0x31')]=_[_0x8235('0x33')](db[_0x8235('0x2d')]['rawAttributes']);_0x48a84[_0x8235('0x32')]=_[_0x8235('0x33')](_0x546fd3['query']);_0x48a84['filters']=_[_0x8235('0x35')](_0x48a84[_0x8235('0x31')],_0x48a84[_0x8235('0x32')]);_0xc740ca[_0x8235('0x36')]=_[_0x8235('0x35')](_0x48a84['model'],qs[_0x8235('0x37')](_0x546fd3['query'][_0x8235('0x37')]));_0xc740ca[_0x8235('0x36')]=_0xc740ca[_0x8235('0x36')][_0x8235('0x44')]?_0xc740ca['attributes']:_0x48a84[_0x8235('0x31')];if(_0x546fd3[_0x8235('0x32')][_0x8235('0x45')]){_0xc740ca['include']=[{'all':!![]}];}_0xc740ca=_[_0x8235('0x3f')]({},_0xc740ca,_0x546fd3['options']);return db['FreshdeskConfiguration'][_0x8235('0x46')](_0xc740ca)[_0x8235('0x26')](handleEntityNotFound(_0x4f5538,null))['then'](respondWithResult(_0x4f5538,null))['catch'](handleError(_0x4f5538,null));};exports[_0x8235('0x47')]=function(_0x489014,_0x556efe){return db[_0x8235('0x2d')][_0x8235('0x47')](_0x489014[_0x8235('0x48')],{})[_0x8235('0x26')](respondWithResult(_0x556efe,0xc9))[_0x8235('0x43')](handleError(_0x556efe,null));};exports[_0x8235('0x25')]=function(_0x416321,_0x4374b8){if(_0x416321[_0x8235('0x48')]['id']){delete _0x416321[_0x8235('0x48')]['id'];}return db[_0x8235('0x2d')][_0x8235('0x46')]({'where':{'id':_0x416321['params']['id']}})['then'](handleEntityNotFound(_0x4374b8,null))[_0x8235('0x26')](saveUpdates(_0x416321[_0x8235('0x48')],null))[_0x8235('0x26')](respondWithResult(_0x4374b8,null))[_0x8235('0x43')](handleError(_0x4374b8,null));};exports[_0x8235('0x27')]=function(_0x2e1e99,_0x361818){return db['FreshdeskConfiguration'][_0x8235('0x46')]({'where':{'id':_0x2e1e99[_0x8235('0x49')]['id']}})['then'](handleEntityNotFound(_0x361818,null))[_0x8235('0x26')](removeEntity(_0x361818,null))['catch'](handleError(_0x361818,null));};exports[_0x8235('0x4a')]=function(_0x512265,_0x39c208,_0x1f9666){var _0x371237={};var _0x399941={};var _0x4587e0;var _0x149322;return db[_0x8235('0x2d')]['findOne']({'where':{'id':_0x512265[_0x8235('0x49')]['id']}})['then'](handleEntityNotFound(_0x39c208,null))[_0x8235('0x26')](function(_0x4a1fcc){if(_0x4a1fcc){_0x4587e0=_0x4a1fcc;_0x399941[_0x8235('0x31')]=_[_0x8235('0x33')](db[_0x8235('0x4b')][_0x8235('0x2e')]);_0x399941[_0x8235('0x32')]=_['keys'](_0x512265['query']);_0x399941[_0x8235('0x34')]=_['intersection'](_0x399941[_0x8235('0x31')],_0x399941[_0x8235('0x32')]);_0x371237[_0x8235('0x36')]=_[_0x8235('0x35')](_0x399941['model'],qs[_0x8235('0x37')](_0x512265[_0x8235('0x32')][_0x8235('0x37')]));_0x371237['attributes']=_0x371237['attributes']['length']?_0x371237[_0x8235('0x36')]:_0x399941['model'];_0x371237['order']=qs['sort'](_0x512265[_0x8235('0x32')][_0x8235('0x3b')]);_0x371237[_0x8235('0x3c')]=qs[_0x8235('0x34')](_[_0x8235('0x3d')](_0x512265[_0x8235('0x32')],_0x399941[_0x8235('0x34')]));if(_0x512265['query'][_0x8235('0x3e')]){_0x371237[_0x8235('0x3c')]=_[_0x8235('0x3f')](_0x371237[_0x8235('0x3c')],{'$or':_[_0x8235('0x2c')](_0x371237[_0x8235('0x36')],function(_0x4b6f5f){var _0x4f72c7={};_0x4f72c7[_0x4b6f5f]={'$like':'%'+_0x512265['query'][_0x8235('0x3e')]+'%'};return _0x4f72c7;})});}_0x371237=_[_0x8235('0x3f')]({},_0x371237,_0x512265[_0x8235('0x41')]);return _0x4587e0[_0x8235('0x4a')](_0x371237);}})[_0x8235('0x26')](function(_0x37694f){if(_0x37694f){_0x149322=_0x37694f['length'];if(!_0x512265[_0x8235('0x32')]['hasOwnProperty'](_0x8235('0x39'))){_0x371237[_0x8235('0x1e')]=qs[_0x8235('0x1e')](_0x512265[_0x8235('0x32')][_0x8235('0x1e')]);_0x371237['offset']=qs[_0x8235('0x20')](_0x512265[_0x8235('0x32')][_0x8235('0x20')]);}return _0x4587e0[_0x8235('0x4a')](_0x371237);}})[_0x8235('0x26')](function(_0x1d09aa){if(_0x1d09aa){return _0x1d09aa?{'count':_0x149322,'rows':_0x1d09aa}:null;}})[_0x8235('0x26')](respondWithResult(_0x39c208,null))['catch'](handleError(_0x39c208,null));};exports[_0x8235('0x4c')]=function(_0xd51016,_0x5a04a5,_0x30260c){var _0x589e0c={};var _0xcdcf72={};var _0x2121a6;var _0x5d4fac;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xd51016[_0x8235('0x49')]['id']}})['then'](handleEntityNotFound(_0x5a04a5,null))[_0x8235('0x26')](function(_0x244e7e){if(_0x244e7e){_0x2121a6=_0x244e7e;_0xcdcf72['model']=_[_0x8235('0x33')](db['FreshdeskField']['rawAttributes']);_0xcdcf72['query']=_[_0x8235('0x33')](_0xd51016[_0x8235('0x32')]);_0xcdcf72[_0x8235('0x34')]=_[_0x8235('0x35')](_0xcdcf72[_0x8235('0x31')],_0xcdcf72[_0x8235('0x32')]);_0x589e0c[_0x8235('0x36')]=_['intersection'](_0xcdcf72['model'],qs['fields'](_0xd51016['query']['fields']));_0x589e0c[_0x8235('0x36')]=_0x589e0c[_0x8235('0x36')][_0x8235('0x44')]?_0x589e0c[_0x8235('0x36')]:_0xcdcf72['model'];_0x589e0c[_0x8235('0x3a')]=qs[_0x8235('0x3b')](_0xd51016['query'][_0x8235('0x3b')]);_0x589e0c['where']=qs[_0x8235('0x34')](_[_0x8235('0x3d')](_0xd51016['query'],_0xcdcf72[_0x8235('0x34')]));if(_0xd51016[_0x8235('0x32')]['filter']){_0x589e0c['where']=_[_0x8235('0x3f')](_0x589e0c['where'],{'$or':_[_0x8235('0x2c')](_0x589e0c[_0x8235('0x36')],function(_0x48720b){var _0x547695={};_0x547695[_0x48720b]={'$like':'%'+_0xd51016['query'][_0x8235('0x3e')]+'%'};return _0x547695;})});}_0x589e0c=_[_0x8235('0x3f')]({},_0x589e0c,_0xd51016['options']);return _0x2121a6[_0x8235('0x4c')](_0x589e0c);}})[_0x8235('0x26')](function(_0xd6bcdb){if(_0xd6bcdb){_0x5d4fac=_0xd6bcdb[_0x8235('0x44')];if(!_0xd51016[_0x8235('0x32')][_0x8235('0x38')](_0x8235('0x39'))){_0x589e0c[_0x8235('0x1e')]=qs[_0x8235('0x1e')](_0xd51016['query'][_0x8235('0x1e')]);_0x589e0c['offset']=qs[_0x8235('0x20')](_0xd51016['query'][_0x8235('0x20')]);}return _0x2121a6[_0x8235('0x4c')](_0x589e0c);}})['then'](function(_0x16f4da){if(_0x16f4da){return _0x16f4da?{'count':_0x5d4fac,'rows':_0x16f4da}:null;}})[_0x8235('0x26')](respondWithResult(_0x5a04a5,null))[_0x8235('0x43')](handleError(_0x5a04a5,null));};exports['getDescriptions']=function(_0x1d0f56,_0x2a46b2,_0x532372){var _0x295ae4={};var _0x5c046e={};var _0x1b4098;var _0x104a53;return db['FreshdeskConfiguration'][_0x8235('0x4d')]({'where':{'id':_0x1d0f56[_0x8235('0x49')]['id']}})[_0x8235('0x26')](handleEntityNotFound(_0x2a46b2,null))[_0x8235('0x26')](function(_0x2e94f1){if(_0x2e94f1){_0x1b4098=_0x2e94f1;_0x5c046e[_0x8235('0x31')]=_[_0x8235('0x33')](db[_0x8235('0x4b')][_0x8235('0x2e')]);_0x5c046e[_0x8235('0x32')]=_[_0x8235('0x33')](_0x1d0f56['query']);_0x5c046e[_0x8235('0x34')]=_[_0x8235('0x35')](_0x5c046e[_0x8235('0x31')],_0x5c046e['query']);_0x295ae4[_0x8235('0x36')]=_['intersection'](_0x5c046e[_0x8235('0x31')],qs[_0x8235('0x37')](_0x1d0f56[_0x8235('0x32')][_0x8235('0x37')]));_0x295ae4['attributes']=_0x295ae4[_0x8235('0x36')][_0x8235('0x44')]?_0x295ae4[_0x8235('0x36')]:_0x5c046e[_0x8235('0x31')];_0x295ae4['order']=qs['sort'](_0x1d0f56['query']['sort']);_0x295ae4[_0x8235('0x3c')]=qs[_0x8235('0x34')](_[_0x8235('0x3d')](_0x1d0f56[_0x8235('0x32')],_0x5c046e[_0x8235('0x34')]));if(_0x1d0f56[_0x8235('0x32')]['filter']){_0x295ae4[_0x8235('0x3c')]=_['merge'](_0x295ae4[_0x8235('0x3c')],{'$or':_[_0x8235('0x2c')](_0x295ae4['attributes'],function(_0x28f3b7){var _0x1d06f7={};_0x1d06f7[_0x28f3b7]={'$like':'%'+_0x1d0f56[_0x8235('0x32')]['filter']+'%'};return _0x1d06f7;})});}_0x295ae4=_[_0x8235('0x3f')]({},_0x295ae4,_0x1d0f56[_0x8235('0x41')]);return _0x1b4098['getDescriptions'](_0x295ae4);}})[_0x8235('0x26')](function(_0x3457a4){if(_0x3457a4){_0x104a53=_0x3457a4[_0x8235('0x44')];if(!_0x1d0f56['query'][_0x8235('0x38')]('nolimit')){_0x295ae4[_0x8235('0x1e')]=qs[_0x8235('0x1e')](_0x1d0f56[_0x8235('0x32')][_0x8235('0x1e')]);_0x295ae4[_0x8235('0x20')]=qs[_0x8235('0x20')](_0x1d0f56[_0x8235('0x32')][_0x8235('0x20')]);}return _0x1b4098['getDescriptions'](_0x295ae4);}})[_0x8235('0x26')](function(_0x240c0d){if(_0x240c0d){return _0x240c0d?{'count':_0x104a53,'rows':_0x240c0d}:null;}})['then'](respondWithResult(_0x2a46b2,null))['catch'](handleError(_0x2a46b2,null));};exports[_0x8235('0x4e')]=function(_0x4061ab,_0x4e6bde,_0x10e51d){var _0x57980f={};var _0x497242={};var _0x56d59c;var _0x598c7b;return db[_0x8235('0x2d')]['findOne']({'where':{'id':_0x4061ab[_0x8235('0x49')]['id']}})[_0x8235('0x26')](handleEntityNotFound(_0x4e6bde,null))[_0x8235('0x26')](function(_0x5cbd84){if(_0x5cbd84){_0x56d59c=_0x5cbd84;_0x497242[_0x8235('0x31')]=_[_0x8235('0x33')](db[_0x8235('0x4f')][_0x8235('0x2e')]);_0x497242[_0x8235('0x32')]=_[_0x8235('0x33')](_0x4061ab[_0x8235('0x32')]);_0x497242[_0x8235('0x34')]=_['intersection'](_0x497242[_0x8235('0x31')],_0x497242[_0x8235('0x32')]);_0x57980f['attributes']=_['intersection'](_0x497242[_0x8235('0x31')],qs[_0x8235('0x37')](_0x4061ab[_0x8235('0x32')]['fields']));_0x57980f[_0x8235('0x36')]=_0x57980f[_0x8235('0x36')]['length']?_0x57980f[_0x8235('0x36')]:_0x497242[_0x8235('0x31')];_0x57980f['order']=qs[_0x8235('0x3b')](_0x4061ab['query'][_0x8235('0x3b')]);_0x57980f['where']=qs[_0x8235('0x34')](_[_0x8235('0x3d')](_0x4061ab[_0x8235('0x32')],_0x497242[_0x8235('0x34')]));if(_0x4061ab[_0x8235('0x32')][_0x8235('0x3e')]){_0x57980f['where']=_['merge'](_0x57980f[_0x8235('0x3c')],{'$or':_[_0x8235('0x2c')](_0x57980f[_0x8235('0x36')],function(_0x2ef88b){var _0x5d6ad5={};_0x5d6ad5[_0x2ef88b]={'$like':'%'+_0x4061ab[_0x8235('0x32')][_0x8235('0x3e')]+'%'};return _0x5d6ad5;})});}_0x57980f=_[_0x8235('0x3f')]({},_0x57980f,_0x4061ab[_0x8235('0x41')]);return _0x56d59c[_0x8235('0x4e')](_0x57980f);}})[_0x8235('0x26')](function(_0x2e7309){if(_0x2e7309){_0x598c7b=_0x2e7309[_0x8235('0x44')];if(!_0x4061ab[_0x8235('0x32')]['hasOwnProperty']('nolimit')){_0x57980f[_0x8235('0x1e')]=qs[_0x8235('0x1e')](_0x4061ab[_0x8235('0x32')]['limit']);_0x57980f['offset']=qs[_0x8235('0x20')](_0x4061ab[_0x8235('0x32')][_0x8235('0x20')]);}return _0x56d59c[_0x8235('0x4e')](_0x57980f);}})[_0x8235('0x26')](function(_0x56e0ec){if(_0x56e0ec){return _0x56e0ec?{'count':_0x598c7b,'rows':_0x56e0ec}:null;}})[_0x8235('0x26')](respondWithResult(_0x4e6bde,null))[_0x8235('0x43')](handleError(_0x4e6bde,null));};exports[_0x8235('0x50')]=function(_0x3fe7c0,_0x5af953,_0x411fef){if(_0x3fe7c0[_0x8235('0x48')]['id']){delete _0x3fe7c0[_0x8235('0x48')]['id'];}return db['FreshdeskConfiguration'][_0x8235('0x4d')]({'where':{'id':_0x3fe7c0['params']['id']}})['then'](handleEntityNotFound(_0x5af953,null))['then'](function(_0x152b61){if(_0x152b61){return _0x152b61['setTags'](_0x3fe7c0['body'][_0x8235('0x51')]||[]);}return null;})['then'](respondWithResult(_0x5af953,null))[_0x8235('0x43')](handleError(_0x5af953,null));};
\ No newline at end of file
+var _0x894f=['count','set','apply','save','update','then','destroy','error','stack','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','name','options','includeAll','include','rows','catch','show','find','create','body','params','getFields','findOne','keys','FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x894f,0xdf));var _0xf894=function(_0x503f30,_0x4e9ed8){_0x503f30=_0x503f30-0x0;var _0x4ddbe9=_0x894f[_0x503f30];return _0x4ddbe9;};'use strict';var emlformat=require(_0xf894('0x0'));var rimraf=require(_0xf894('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf894('0x2'));var rp=require(_0xf894('0x3'));var moment=require(_0xf894('0x4'));var BPromise=require(_0xf894('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf894('0x6'));var sox=require(_0xf894('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf894('0x8'));var _=require(_0xf894('0x9'));var squel=require('squel');var crypto=require(_0xf894('0xa'));var jsforce=require(_0xf894('0xb'));var deskjs=require(_0xf894('0xc'));var toCsv=require(_0xf894('0xd'));var querystring=require(_0xf894('0xe'));var Papa=require(_0xf894('0xf'));var Redis=require(_0xf894('0x10'));var authService=require(_0xf894('0x11'));var qs=require(_0xf894('0x12'));var as=require(_0xf894('0x13'));var hardwareService=require(_0xf894('0x14'));var logger=require(_0xf894('0x15'))(_0xf894('0x16'));var utils=require(_0xf894('0x17'));var config=require(_0xf894('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x519138,_0x3aa08d){_0x3aa08d=_0x3aa08d||0xcc;return function(_0x3fc9ea){if(_0x3fc9ea){return _0x519138[_0xf894('0x19')](_0x3aa08d);}return _0x519138[_0xf894('0x1a')](_0x3aa08d)[_0xf894('0x1b')]();};}function respondWithResult(_0x3581c7,_0x273bc4){_0x273bc4=_0x273bc4||0xc8;return function(_0x456c19){if(_0x456c19){return _0x3581c7[_0xf894('0x1a')](_0x273bc4)[_0xf894('0x1c')](_0x456c19);}};}function respondWithFilteredResult(_0x33f74b,_0x1e9d52){return function(_0x5c89a2){if(_0x5c89a2){var _0xe3ee4e=typeof _0x1e9d52[_0xf894('0x1d')]===_0xf894('0x1e')&&typeof _0x1e9d52[_0xf894('0x1f')]===_0xf894('0x1e');var _0x2a4d2e=_0x5c89a2[_0xf894('0x20')];var _0x13e780=_0xe3ee4e?0x0:_0x1e9d52[_0xf894('0x1d')];var _0x1c1a76=_0xe3ee4e?_0x5c89a2['count']:_0x1e9d52['offset']+_0x1e9d52[_0xf894('0x1f')];var _0x32c4e5;if(_0x1c1a76>=_0x2a4d2e){_0x1c1a76=_0x2a4d2e;_0x32c4e5=0xc8;}else{_0x32c4e5=0xce;}_0x33f74b[_0xf894('0x1a')](_0x32c4e5);return _0x33f74b[_0xf894('0x21')]('Content-Range',_0x13e780+'-'+_0x1c1a76+'/'+_0x2a4d2e)[_0xf894('0x1c')](_0x5c89a2);}return null;};}function patchUpdates(_0x11b14a){return function(_0x145d4a){try{jsonpatch[_0xf894('0x22')](_0x145d4a,_0x11b14a,!![]);}catch(_0x5248cd){return BPromise['reject'](_0x5248cd);}return _0x145d4a[_0xf894('0x23')]();};}function saveUpdates(_0x126e06,_0xf15cce){return function(_0x622a47){if(_0x622a47){return _0x622a47[_0xf894('0x24')](_0x126e06)[_0xf894('0x25')](function(_0x567c02){return _0x567c02;});}return null;};}function removeEntity(_0x2c60c2,_0x8cf79){return function(_0x626e4d){if(_0x626e4d){return _0x626e4d[_0xf894('0x26')]()['then'](function(){_0x2c60c2['status'](0xcc)[_0xf894('0x1b')]();});}};}function handleEntityNotFound(_0x55ff0d,_0x12fe8c){return function(_0x3d65e9){if(!_0x3d65e9){_0x55ff0d[_0xf894('0x19')](0x194);}return _0x3d65e9;};}function handleError(_0x50d3da,_0x211a33){_0x211a33=_0x211a33||0x1f4;return function(_0x23dfad){logger[_0xf894('0x27')](_0x23dfad[_0xf894('0x28')]);if(_0x23dfad['name']){delete _0x23dfad['name'];}_0x50d3da[_0xf894('0x1a')](_0x211a33)[_0xf894('0x29')](_0x23dfad);};}exports[_0xf894('0x2a')]=function(_0xabd58b,_0x19247e){var _0x5de595={},_0x2d2461={},_0x7f2f95={'count':0x0,'rows':[]};var _0x188d1b=_[_0xf894('0x2b')](db[_0xf894('0x2c')][_0xf894('0x2d')],function(_0x650e48){return{'name':_0x650e48[_0xf894('0x2e')],'type':_0x650e48[_0xf894('0x2f')][_0xf894('0x30')]};});_0x2d2461['model']=_[_0xf894('0x2b')](_0x188d1b,'name');_0x2d2461['query']=_['keys'](_0xabd58b[_0xf894('0x31')]);_0x2d2461['filters']=_[_0xf894('0x32')](_0x2d2461[_0xf894('0x33')],_0x2d2461[_0xf894('0x31')]);_0x5de595[_0xf894('0x34')]=_['intersection'](_0x2d2461['model'],qs['fields'](_0xabd58b['query'][_0xf894('0x35')]));_0x5de595[_0xf894('0x34')]=_0x5de595[_0xf894('0x34')][_0xf894('0x36')]?_0x5de595['attributes']:_0x2d2461[_0xf894('0x33')];if(!_0xabd58b['query']['hasOwnProperty'](_0xf894('0x37'))){_0x5de595[_0xf894('0x1f')]=qs[_0xf894('0x1f')](_0xabd58b['query'][_0xf894('0x1f')]);_0x5de595[_0xf894('0x1d')]=qs[_0xf894('0x1d')](_0xabd58b[_0xf894('0x31')][_0xf894('0x1d')]);}_0x5de595[_0xf894('0x38')]=qs[_0xf894('0x39')](_0xabd58b[_0xf894('0x31')][_0xf894('0x39')]);_0x5de595['where']=qs[_0xf894('0x3a')](_[_0xf894('0x3b')](_0xabd58b[_0xf894('0x31')],_0x2d2461['filters']),_0x188d1b);if(_0xabd58b[_0xf894('0x31')][_0xf894('0x3c')]){_0x5de595['where']=_[_0xf894('0x3d')](_0x5de595[_0xf894('0x3e')],{'$or':_[_0xf894('0x2b')](_0x188d1b,function(_0x1f5a52){if(_0x1f5a52[_0xf894('0x2f')]!==_0xf894('0x3f')){var _0x2db634={};_0x2db634[_0x1f5a52[_0xf894('0x40')]]={'$like':'%'+_0xabd58b[_0xf894('0x31')][_0xf894('0x3c')]+'%'};return _0x2db634;}})});}_0x5de595=_[_0xf894('0x3d')]({},_0x5de595,_0xabd58b[_0xf894('0x41')]);var _0x322460={'where':_0x5de595[_0xf894('0x3e')]};return db['FreshdeskConfiguration'][_0xf894('0x20')](_0x322460)[_0xf894('0x25')](function(_0x57b8d2){_0x7f2f95['count']=_0x57b8d2;if(_0xabd58b[_0xf894('0x31')][_0xf894('0x42')]){_0x5de595[_0xf894('0x43')]=[{'all':!![]}];}return db[_0xf894('0x2c')]['findAll'](_0x5de595);})['then'](function(_0x2ff57){_0x7f2f95[_0xf894('0x44')]=_0x2ff57;return _0x7f2f95;})[_0xf894('0x25')](respondWithFilteredResult(_0x19247e,_0x5de595))[_0xf894('0x45')](handleError(_0x19247e,null));};exports[_0xf894('0x46')]=function(_0x965902,_0x4c5e1e){var _0x2d25f3={'raw':![],'where':{'id':_0x965902['params']['id']}},_0x4080d8={};_0x4080d8[_0xf894('0x33')]=_['keys'](db[_0xf894('0x2c')][_0xf894('0x2d')]);_0x4080d8[_0xf894('0x31')]=_['keys'](_0x965902['query']);_0x4080d8[_0xf894('0x3a')]=_['intersection'](_0x4080d8['model'],_0x4080d8[_0xf894('0x31')]);_0x2d25f3['attributes']=_[_0xf894('0x32')](_0x4080d8['model'],qs[_0xf894('0x35')](_0x965902[_0xf894('0x31')]['fields']));_0x2d25f3[_0xf894('0x34')]=_0x2d25f3[_0xf894('0x34')]['length']?_0x2d25f3[_0xf894('0x34')]:_0x4080d8[_0xf894('0x33')];if(_0x965902[_0xf894('0x31')][_0xf894('0x42')]){_0x2d25f3['include']=[{'all':!![]}];}_0x2d25f3=_[_0xf894('0x3d')]({},_0x2d25f3,_0x965902[_0xf894('0x41')]);return db['FreshdeskConfiguration'][_0xf894('0x47')](_0x2d25f3)['then'](handleEntityNotFound(_0x4c5e1e,null))['then'](respondWithResult(_0x4c5e1e,null))['catch'](handleError(_0x4c5e1e,null));};exports[_0xf894('0x48')]=function(_0xb65f10,_0x4a60bb){return db['FreshdeskConfiguration']['create'](_0xb65f10[_0xf894('0x49')],{})[_0xf894('0x25')](respondWithResult(_0x4a60bb,0xc9))[_0xf894('0x45')](handleError(_0x4a60bb,null));};exports[_0xf894('0x24')]=function(_0x5b98d1,_0x5d613b){if(_0x5b98d1[_0xf894('0x49')]['id']){delete _0x5b98d1['body']['id'];}return db[_0xf894('0x2c')]['find']({'where':{'id':_0x5b98d1[_0xf894('0x4a')]['id']}})[_0xf894('0x25')](handleEntityNotFound(_0x5d613b,null))[_0xf894('0x25')](saveUpdates(_0x5b98d1[_0xf894('0x49')],null))[_0xf894('0x25')](respondWithResult(_0x5d613b,null))[_0xf894('0x45')](handleError(_0x5d613b,null));};exports[_0xf894('0x26')]=function(_0x266564,_0x6a8323){return db[_0xf894('0x2c')]['find']({'where':{'id':_0x266564['params']['id']}})['then'](handleEntityNotFound(_0x6a8323,null))['then'](removeEntity(_0x6a8323,null))[_0xf894('0x45')](handleError(_0x6a8323,null));};exports[_0xf894('0x4b')]=function(_0x2b0f58,_0xf0f07f,_0x2f8a33){var _0x54de87={};var _0x28842e={};var _0x1cc18a;var _0x84db68;return db[_0xf894('0x2c')][_0xf894('0x4c')]({'where':{'id':_0x2b0f58[_0xf894('0x4a')]['id']}})[_0xf894('0x25')](handleEntityNotFound(_0xf0f07f,null))['then'](function(_0x1ff8ee){if(_0x1ff8ee){_0x1cc18a=_0x1ff8ee;_0x28842e['model']=_[_0xf894('0x4d')](db[_0xf894('0x4e')][_0xf894('0x2d')]);_0x28842e[_0xf894('0x31')]=_[_0xf894('0x4d')](_0x2b0f58[_0xf894('0x31')]);_0x28842e[_0xf894('0x3a')]=_[_0xf894('0x32')](_0x28842e[_0xf894('0x33')],_0x28842e[_0xf894('0x31')]);_0x54de87[_0xf894('0x34')]=_[_0xf894('0x32')](_0x28842e['model'],qs[_0xf894('0x35')](_0x2b0f58[_0xf894('0x31')]['fields']));_0x54de87[_0xf894('0x34')]=_0x54de87[_0xf894('0x34')][_0xf894('0x36')]?_0x54de87[_0xf894('0x34')]:_0x28842e[_0xf894('0x33')];_0x54de87[_0xf894('0x38')]=qs['sort'](_0x2b0f58[_0xf894('0x31')][_0xf894('0x39')]);_0x54de87[_0xf894('0x3e')]=qs['filters'](_['pick'](_0x2b0f58[_0xf894('0x31')],_0x28842e[_0xf894('0x3a')]));if(_0x2b0f58[_0xf894('0x31')]['filter']){_0x54de87[_0xf894('0x3e')]=_['merge'](_0x54de87['where'],{'$or':_[_0xf894('0x2b')](_0x54de87[_0xf894('0x34')],function(_0x280563){var _0x294579={};_0x294579[_0x280563]={'$like':'%'+_0x2b0f58[_0xf894('0x31')]['filter']+'%'};return _0x294579;})});}_0x54de87=_[_0xf894('0x3d')]({},_0x54de87,_0x2b0f58[_0xf894('0x41')]);return _0x1cc18a[_0xf894('0x4b')](_0x54de87);}})['then'](function(_0x21bae3){if(_0x21bae3){_0x84db68=_0x21bae3[_0xf894('0x36')];if(!_0x2b0f58[_0xf894('0x31')][_0xf894('0x4f')]('nolimit')){_0x54de87['limit']=qs[_0xf894('0x1f')](_0x2b0f58[_0xf894('0x31')]['limit']);_0x54de87[_0xf894('0x1d')]=qs[_0xf894('0x1d')](_0x2b0f58[_0xf894('0x31')][_0xf894('0x1d')]);}return _0x1cc18a[_0xf894('0x4b')](_0x54de87);}})[_0xf894('0x25')](function(_0x253657){if(_0x253657){return _0x253657?{'count':_0x84db68,'rows':_0x253657}:null;}})['then'](respondWithResult(_0xf0f07f,null))[_0xf894('0x45')](handleError(_0xf0f07f,null));};exports['getSubjects']=function(_0x450b9c,_0x19803c,_0xea5533){var _0x3e6a76={};var _0x2d30e0={};var _0x11ca32;var _0x46a252;return db[_0xf894('0x2c')][_0xf894('0x4c')]({'where':{'id':_0x450b9c[_0xf894('0x4a')]['id']}})[_0xf894('0x25')](handleEntityNotFound(_0x19803c,null))['then'](function(_0x17951b){if(_0x17951b){_0x11ca32=_0x17951b;_0x2d30e0['model']=_['keys'](db[_0xf894('0x4e')][_0xf894('0x2d')]);_0x2d30e0[_0xf894('0x31')]=_[_0xf894('0x4d')](_0x450b9c[_0xf894('0x31')]);_0x2d30e0['filters']=_[_0xf894('0x32')](_0x2d30e0[_0xf894('0x33')],_0x2d30e0[_0xf894('0x31')]);_0x3e6a76['attributes']=_[_0xf894('0x32')](_0x2d30e0[_0xf894('0x33')],qs[_0xf894('0x35')](_0x450b9c['query'][_0xf894('0x35')]));_0x3e6a76[_0xf894('0x34')]=_0x3e6a76[_0xf894('0x34')][_0xf894('0x36')]?_0x3e6a76[_0xf894('0x34')]:_0x2d30e0[_0xf894('0x33')];_0x3e6a76[_0xf894('0x38')]=qs['sort'](_0x450b9c[_0xf894('0x31')]['sort']);_0x3e6a76['where']=qs[_0xf894('0x3a')](_[_0xf894('0x3b')](_0x450b9c[_0xf894('0x31')],_0x2d30e0[_0xf894('0x3a')]));if(_0x450b9c[_0xf894('0x31')][_0xf894('0x3c')]){_0x3e6a76[_0xf894('0x3e')]=_[_0xf894('0x3d')](_0x3e6a76[_0xf894('0x3e')],{'$or':_[_0xf894('0x2b')](_0x3e6a76[_0xf894('0x34')],function(_0x488d1e){var _0x444497={};_0x444497[_0x488d1e]={'$like':'%'+_0x450b9c['query'][_0xf894('0x3c')]+'%'};return _0x444497;})});}_0x3e6a76=_[_0xf894('0x3d')]({},_0x3e6a76,_0x450b9c[_0xf894('0x41')]);return _0x11ca32[_0xf894('0x50')](_0x3e6a76);}})[_0xf894('0x25')](function(_0x498ccf){if(_0x498ccf){_0x46a252=_0x498ccf[_0xf894('0x36')];if(!_0x450b9c[_0xf894('0x31')]['hasOwnProperty'](_0xf894('0x37'))){_0x3e6a76[_0xf894('0x1f')]=qs['limit'](_0x450b9c[_0xf894('0x31')][_0xf894('0x1f')]);_0x3e6a76[_0xf894('0x1d')]=qs[_0xf894('0x1d')](_0x450b9c['query']['offset']);}return _0x11ca32[_0xf894('0x50')](_0x3e6a76);}})[_0xf894('0x25')](function(_0x2597c3){if(_0x2597c3){return _0x2597c3?{'count':_0x46a252,'rows':_0x2597c3}:null;}})['then'](respondWithResult(_0x19803c,null))[_0xf894('0x45')](handleError(_0x19803c,null));};exports[_0xf894('0x51')]=function(_0x51f5ac,_0x1b7c0c,_0x1a45a2){var _0xfc4186={};var _0x5ca929={};var _0x24a3c0;var _0x2f43b7;return db[_0xf894('0x2c')]['findOne']({'where':{'id':_0x51f5ac[_0xf894('0x4a')]['id']}})[_0xf894('0x25')](handleEntityNotFound(_0x1b7c0c,null))[_0xf894('0x25')](function(_0x2ca6c2){if(_0x2ca6c2){_0x24a3c0=_0x2ca6c2;_0x5ca929[_0xf894('0x33')]=_['keys'](db[_0xf894('0x4e')][_0xf894('0x2d')]);_0x5ca929[_0xf894('0x31')]=_['keys'](_0x51f5ac[_0xf894('0x31')]);_0x5ca929[_0xf894('0x3a')]=_[_0xf894('0x32')](_0x5ca929['model'],_0x5ca929[_0xf894('0x31')]);_0xfc4186['attributes']=_[_0xf894('0x32')](_0x5ca929['model'],qs[_0xf894('0x35')](_0x51f5ac[_0xf894('0x31')][_0xf894('0x35')]));_0xfc4186[_0xf894('0x34')]=_0xfc4186[_0xf894('0x34')][_0xf894('0x36')]?_0xfc4186[_0xf894('0x34')]:_0x5ca929[_0xf894('0x33')];_0xfc4186[_0xf894('0x38')]=qs[_0xf894('0x39')](_0x51f5ac[_0xf894('0x31')][_0xf894('0x39')]);_0xfc4186[_0xf894('0x3e')]=qs['filters'](_[_0xf894('0x3b')](_0x51f5ac[_0xf894('0x31')],_0x5ca929['filters']));if(_0x51f5ac['query']['filter']){_0xfc4186[_0xf894('0x3e')]=_[_0xf894('0x3d')](_0xfc4186['where'],{'$or':_[_0xf894('0x2b')](_0xfc4186[_0xf894('0x34')],function(_0x5c7309){var _0x5f0108={};_0x5f0108[_0x5c7309]={'$like':'%'+_0x51f5ac[_0xf894('0x31')]['filter']+'%'};return _0x5f0108;})});}_0xfc4186=_[_0xf894('0x3d')]({},_0xfc4186,_0x51f5ac[_0xf894('0x41')]);return _0x24a3c0[_0xf894('0x51')](_0xfc4186);}})[_0xf894('0x25')](function(_0x3c0540){if(_0x3c0540){_0x2f43b7=_0x3c0540['length'];if(!_0x51f5ac[_0xf894('0x31')][_0xf894('0x4f')](_0xf894('0x37'))){_0xfc4186['limit']=qs['limit'](_0x51f5ac[_0xf894('0x31')][_0xf894('0x1f')]);_0xfc4186[_0xf894('0x1d')]=qs[_0xf894('0x1d')](_0x51f5ac[_0xf894('0x31')][_0xf894('0x1d')]);}return _0x24a3c0[_0xf894('0x51')](_0xfc4186);}})['then'](function(_0x21f508){if(_0x21f508){return _0x21f508?{'count':_0x2f43b7,'rows':_0x21f508}:null;}})[_0xf894('0x25')](respondWithResult(_0x1b7c0c,null))[_0xf894('0x45')](handleError(_0x1b7c0c,null));};exports[_0xf894('0x52')]=function(_0x51552d,_0x107eed,_0x3b4cae){var _0x836dcd={};var _0x4281fd={};var _0x4cba73;var _0x4dd843;return db[_0xf894('0x2c')]['findOne']({'where':{'id':_0x51552d[_0xf894('0x4a')]['id']}})[_0xf894('0x25')](handleEntityNotFound(_0x107eed,null))[_0xf894('0x25')](function(_0x154b0b){if(_0x154b0b){_0x4cba73=_0x154b0b;_0x4281fd[_0xf894('0x33')]=_['keys'](db[_0xf894('0x53')][_0xf894('0x2d')]);_0x4281fd[_0xf894('0x31')]=_[_0xf894('0x4d')](_0x51552d['query']);_0x4281fd[_0xf894('0x3a')]=_[_0xf894('0x32')](_0x4281fd['model'],_0x4281fd[_0xf894('0x31')]);_0x836dcd[_0xf894('0x34')]=_[_0xf894('0x32')](_0x4281fd[_0xf894('0x33')],qs[_0xf894('0x35')](_0x51552d['query'][_0xf894('0x35')]));_0x836dcd[_0xf894('0x34')]=_0x836dcd[_0xf894('0x34')][_0xf894('0x36')]?_0x836dcd['attributes']:_0x4281fd['model'];_0x836dcd[_0xf894('0x38')]=qs[_0xf894('0x39')](_0x51552d['query']['sort']);_0x836dcd[_0xf894('0x3e')]=qs['filters'](_[_0xf894('0x3b')](_0x51552d['query'],_0x4281fd[_0xf894('0x3a')]));if(_0x51552d[_0xf894('0x31')][_0xf894('0x3c')]){_0x836dcd[_0xf894('0x3e')]=_[_0xf894('0x3d')](_0x836dcd[_0xf894('0x3e')],{'$or':_[_0xf894('0x2b')](_0x836dcd[_0xf894('0x34')],function(_0x35cc3f){var _0x4ebb32={};_0x4ebb32[_0x35cc3f]={'$like':'%'+_0x51552d[_0xf894('0x31')][_0xf894('0x3c')]+'%'};return _0x4ebb32;})});}_0x836dcd=_[_0xf894('0x3d')]({},_0x836dcd,_0x51552d[_0xf894('0x41')]);return _0x4cba73[_0xf894('0x52')](_0x836dcd);}})[_0xf894('0x25')](function(_0x539c41){if(_0x539c41){_0x4dd843=_0x539c41[_0xf894('0x36')];if(!_0x51552d[_0xf894('0x31')][_0xf894('0x4f')](_0xf894('0x37'))){_0x836dcd['limit']=qs[_0xf894('0x1f')](_0x51552d['query'][_0xf894('0x1f')]);_0x836dcd['offset']=qs['offset'](_0x51552d[_0xf894('0x31')][_0xf894('0x1d')]);}return _0x4cba73['getTags'](_0x836dcd);}})[_0xf894('0x25')](function(_0x179399){if(_0x179399){return _0x179399?{'count':_0x4dd843,'rows':_0x179399}:null;}})[_0xf894('0x25')](respondWithResult(_0x107eed,null))[_0xf894('0x45')](handleError(_0x107eed,null));};exports[_0xf894('0x54')]=function(_0x35bad2,_0x483336,_0x46b775){if(_0x35bad2[_0xf894('0x49')]['id']){delete _0x35bad2[_0xf894('0x49')]['id'];}return db[_0xf894('0x2c')][_0xf894('0x4c')]({'where':{'id':_0x35bad2[_0xf894('0x4a')]['id']}})[_0xf894('0x25')](handleEntityNotFound(_0x483336,null))[_0xf894('0x25')](function(_0x46d0e4){if(_0x46d0e4){return _0x46d0e4[_0xf894('0x54')](_0x35bad2[_0xf894('0x49')]['ids']||[]);}return null;})[_0xf894('0x25')](respondWithResult(_0x483336,null))[_0xf894('0x45')](handleError(_0x483336,null));};
\ No newline at end of file
index 9c67ded..edf60af 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6270=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0xaf28bf,_0xa3bfc5){var _0x490278=function(_0x23a358){while(--_0x23a358){_0xaf28bf['push'](_0xaf28bf['shift']());}};_0x490278(++_0xa3bfc5);}(_0x6270,0xea));var _0x0627=function(_0x3b89cb,_0x356ca9){_0x3b89cb=_0x3b89cb-0x0;var _0x4b6c3d=_0x6270[_0x3b89cb];return _0x4b6c3d;};'use strict';var _=require(_0x0627('0x0'));var util=require(_0x0627('0x1'));var logger=require('../../config/logger')(_0x0627('0x2'));var moment=require(_0x0627('0x3'));var BPromise=require(_0x0627('0x4'));var rp=require(_0x0627('0x5'));var fs=require('fs');var path=require(_0x0627('0x6'));var rimraf=require(_0x0627('0x7'));var config=require(_0x0627('0x8'));var attributes=require(_0x0627('0x9'));module[_0x0627('0xa')]=function(_0x10c880,_0x364716){return _0x10c880['define'](_0x0627('0xb'),attributes,{'tableName':_0x0627('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd923=['request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x32a446,_0x291c6e){var _0x54114b=function(_0x4ba3e4){while(--_0x4ba3e4){_0x32a446['push'](_0x32a446['shift']());}};_0x54114b(++_0x291c6e);}(_0xd923,0xd3));var _0x3d92=function(_0x50cc0d,_0x546b04){_0x50cc0d=_0x50cc0d-0x0;var _0x5e639f=_0xd923[_0x50cc0d];return _0x5e639f;};'use strict';var _=require(_0x3d92('0x0'));var util=require(_0x3d92('0x1'));var logger=require(_0x3d92('0x2'))(_0x3d92('0x3'));var moment=require(_0x3d92('0x4'));var BPromise=require('bluebird');var rp=require(_0x3d92('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d92('0x6'));var config=require(_0x3d92('0x7'));var attributes=require(_0x3d92('0x8'));module['exports']=function(_0x2f4eac,_0x2a2390){return _0x2f4eac[_0x3d92('0x9')](_0x3d92('0xa'),attributes,{'tableName':_0x3d92('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 81dfd41..ba41221 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa91a=['FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2178fb,_0x2dffe1){var _0x57b579=function(_0x5232ff){while(--_0x5232ff){_0x2178fb['push'](_0x2178fb['shift']());}};_0x57b579(++_0x2dffe1);}(_0xa91a,0x130));var _0xaa91=function(_0x199636,_0x4c1cbc){_0x199636=_0x199636-0x0;var _0x2eb150=_0xa91a[_0x199636];return _0x2eb150;};'use strict';var _=require(_0xaa91('0x0'));var util=require('util');var moment=require(_0xaa91('0x1'));var BPromise=require(_0xaa91('0x2'));var rs=require(_0xaa91('0x3'));var fs=require('fs');var Redis=require(_0xaa91('0x4'));var db=require(_0xaa91('0x5'))['db'];var utils=require(_0xaa91('0x6'));var logger=require(_0xaa91('0x7'))(_0xaa91('0x8'));var config=require('../../config/environment');var jayson=require(_0xaa91('0x9'));var client=jayson[_0xaa91('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57d219,_0x1e2429,_0x408d04){return new BPromise(function(_0x110403,_0x967118){return client[_0xaa91('0xb')](_0x57d219,_0x408d04)[_0xaa91('0xc')](function(_0x3fe252){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e2429,'request\x20sent');logger[_0xaa91('0xd')](_0xaa91('0xe'),_0x1e2429,_0xaa91('0xf'),JSON[_0xaa91('0x10')](_0x3fe252));if(_0x3fe252[_0xaa91('0x11')]){if(_0x3fe252['error']['code']===0x1f4){logger[_0xaa91('0x11')](_0xaa91('0x12'),_0x1e2429,_0x3fe252[_0xaa91('0x11')][_0xaa91('0x13')]);return _0x967118(_0x3fe252[_0xaa91('0x11')]['message']);}logger['error'](_0xaa91('0x12'),_0x1e2429,_0x3fe252[_0xaa91('0x11')][_0xaa91('0x13')]);return _0x110403(_0x3fe252['error']['message']);}else{logger[_0xaa91('0x14')](_0xaa91('0x12'),_0x1e2429,_0xaa91('0xf'));_0x110403(_0x3fe252[_0xaa91('0x15')]['message']);}})[_0xaa91('0x16')](function(_0x2fc572){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e2429,_0x2fc572);_0x967118(_0x2fc572);});});}
\ No newline at end of file
+var _0x9662=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x5397d4,_0x5a2b72){var _0xb9fd15=function(_0x371185){while(--_0x371185){_0x5397d4['push'](_0x5397d4['shift']());}};_0xb9fd15(++_0x5a2b72);}(_0x9662,0x190));var _0x2966=function(_0x19bcc8,_0x11df70){_0x19bcc8=_0x19bcc8-0x0;var _0x5cdd09=_0x9662[_0x19bcc8];return _0x5cdd09;};'use strict';var _=require(_0x2966('0x0'));var util=require('util');var moment=require(_0x2966('0x1'));var BPromise=require(_0x2966('0x2'));var rs=require(_0x2966('0x3'));var fs=require('fs');var Redis=require(_0x2966('0x4'));var db=require(_0x2966('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2966('0x6'))(_0x2966('0x7'));var config=require(_0x2966('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2966('0x9')][_0x2966('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fe44d,_0x490050,_0x460d49){return new BPromise(function(_0x343a02,_0x34228b){return client[_0x2966('0xb')](_0x3fe44d,_0x460d49)[_0x2966('0xc')](function(_0x2c7fcf){logger[_0x2966('0xd')](_0x2966('0xe'),_0x490050,'request\x20sent');logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x490050,_0x2966('0xf'),JSON[_0x2966('0x10')](_0x2c7fcf));if(_0x2c7fcf[_0x2966('0x11')]){if(_0x2c7fcf[_0x2966('0x11')]['code']===0x1f4){logger['error'](_0x2966('0xe'),_0x490050,_0x2c7fcf[_0x2966('0x11')][_0x2966('0x12')]);return _0x34228b(_0x2c7fcf[_0x2966('0x11')][_0x2966('0x12')]);}logger[_0x2966('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x490050,_0x2c7fcf['error'][_0x2966('0x12')]);return _0x343a02(_0x2c7fcf['error'][_0x2966('0x12')]);}else{logger[_0x2966('0xd')](_0x2966('0xe'),_0x490050,_0x2966('0xf'));_0x343a02(_0x2c7fcf[_0x2966('0x13')][_0x2966('0x12')]);}})[_0x2966('0x14')](function(_0x4c7e12){logger[_0x2966('0x11')](_0x2966('0xe'),_0x490050,_0x4c7e12);_0x34228b(_0x4c7e12);});});}
\ No newline at end of file
index 1545b8f..73043e9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x563a=['/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','index','get'];(function(_0x1fd8f2,_0x1e5994){var _0x5813e4=function(_0x365e65){while(--_0x365e65){_0x1fd8f2['push'](_0x1fd8f2['shift']());}};_0x5813e4(++_0x1e5994);}(_0x563a,0x81));var _0xa563=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x563a[_0x576170];return _0x397c70;};'use strict';var multer=require(_0xa563('0x0'));var util=require(_0xa563('0x1'));var path=require('path');var timeout=require(_0xa563('0x2'));var express=require(_0xa563('0x3'));var router=express[_0xa563('0x4')]();var fs_extra=require(_0xa563('0x5'));var auth=require(_0xa563('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa563('0x7'));var controller=require(_0xa563('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa563('0x9')]);router[_0xa563('0xa')](_0xa563('0xb'),auth[_0xa563('0xc')](),controller[_0xa563('0xd')]);router[_0xa563('0xe')]('/',auth[_0xa563('0xc')](),controller[_0xa563('0xf')]);router['put']('/:id',auth[_0xa563('0xc')](),controller[_0xa563('0x10')]);router[_0xa563('0x11')](_0xa563('0xb'),auth[_0xa563('0xc')](),controller[_0xa563('0x12')]);module[_0xa563('0x13')]=router;
\ No newline at end of file
+var _0x0717=['update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x3f6b67,_0x2736d1){var _0x3d2b4c=function(_0x402dd4){while(--_0x402dd4){_0x3f6b67['push'](_0x3f6b67['shift']());}};_0x3d2b4c(++_0x2736d1);}(_0x0717,0x143));var _0x7071=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0717[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x7071('0x0'));var util=require(_0x7071('0x1'));var path=require('path');var timeout=require(_0x7071('0x2'));var express=require(_0x7071('0x3'));var router=express[_0x7071('0x4')]();var fs_extra=require(_0x7071('0x5'));var auth=require(_0x7071('0x6'));var interaction=require(_0x7071('0x7'));var config=require(_0x7071('0x8'));var controller=require(_0x7071('0x9'));router[_0x7071('0xa')]('/',auth[_0x7071('0xb')](),controller['index']);router[_0x7071('0xa')]('/:id',auth[_0x7071('0xb')](),controller[_0x7071('0xc')]);router[_0x7071('0xd')]('/',auth['isAuthenticated'](),controller[_0x7071('0xe')]);router[_0x7071('0xf')](_0x7071('0x10'),auth[_0x7071('0xb')](),controller[_0x7071('0x11')]);router[_0x7071('0x12')](_0x7071('0x10'),auth[_0x7071('0xb')](),controller[_0x7071('0x13')]);module['exports']=router;
\ No newline at end of file
index e18074f..1ed3399 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xec9f=['keyValue','STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xec9f,0xd4));var _0xfec9=function(_0x41eba,_0x621e16){_0x41eba=_0x41eba-0x0;var _0x4f2a13=_0xec9f[_0x41eba];return _0x4f2a13;};'use strict';var Sequelize=require(_0xfec9('0x0'));module[_0xfec9('0x1')]={'type':{'type':Sequelize[_0xfec9('0x2')](_0xfec9('0x3'),'variable','customVariable',_0xfec9('0x4'),'picklist'),'defaultValue':_0xfec9('0x3')},'content':{'type':Sequelize[_0xfec9('0x5')]},'key':{'type':Sequelize[_0xfec9('0x5')]},'keyType':{'type':Sequelize[_0xfec9('0x2')](_0xfec9('0x3'),_0xfec9('0x6'),_0xfec9('0x7'))},'keyContent':{'type':Sequelize[_0xfec9('0x5')]},'idField':{'type':Sequelize[_0xfec9('0x5')]},'nameField':{'type':Sequelize[_0xfec9('0x5')]},'customField':{'type':Sequelize[_0xfec9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfec9('0x5')]}};
\ No newline at end of file
+var _0xee37=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x321994,_0x4d36e2){var _0x38b2c3=function(_0x525b72){while(--_0x525b72){_0x321994['push'](_0x321994['shift']());}};_0x38b2c3(++_0x4d36e2);}(_0xee37,0x1e7));var _0x7ee3=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0xee37[_0x52a857];return _0x4e2aae;};'use strict';var Sequelize=require(_0x7ee3('0x0'));module['exports']={'type':{'type':Sequelize[_0x7ee3('0x1')](_0x7ee3('0x2'),_0x7ee3('0x3'),_0x7ee3('0x4'),_0x7ee3('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7ee3('0x6')]},'keyType':{'type':Sequelize[_0x7ee3('0x1')](_0x7ee3('0x2'),_0x7ee3('0x3'),_0x7ee3('0x4'))},'keyContent':{'type':Sequelize[_0x7ee3('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7ee3('0x6')]},'customField':{'type':Sequelize[_0x7ee3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7ee3('0x6')]}};
\ No newline at end of file
index 80b2ddb..9f9276f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbf6e=['rawAttributes','type','key','model','query','filters','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','FreshdeskField','includeAll','include','rows','catch','show','keys','intersection','length','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map'];(function(_0x30d8d5,_0x55db63){var _0xf1ce3c=function(_0x1f24f0){while(--_0x1f24f0){_0x30d8d5['push'](_0x30d8d5['shift']());}};_0xf1ce3c(++_0x55db63);}(_0xbf6e,0x149));var _0xebf6=function(_0x2edb97,_0x20ec23){_0x2edb97=_0x2edb97-0x0;var _0x2c45a2=_0xbf6e[_0x2edb97];return _0x2c45a2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xebf6('0x0'));var jsonpatch=require(_0xebf6('0x1'));var rp=require(_0xebf6('0x2'));var moment=require(_0xebf6('0x3'));var BPromise=require(_0xebf6('0x4'));var Mustache=require(_0xebf6('0x5'));var util=require(_0xebf6('0x6'));var path=require('path');var sox=require(_0xebf6('0x7'));var csv=require(_0xebf6('0x8'));var ejs=require(_0xebf6('0x9'));var fs=require('fs');var fs_extra=require(_0xebf6('0xa'));var _=require(_0xebf6('0xb'));var squel=require(_0xebf6('0xc'));var crypto=require(_0xebf6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xebf6('0xe'));var toCsv=require(_0xebf6('0x8'));var querystring=require(_0xebf6('0xf'));var Papa=require('papaparse');var Redis=require(_0xebf6('0x10'));var authService=require(_0xebf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebf6('0x12'));var hardwareService=require(_0xebf6('0x13'));var logger=require(_0xebf6('0x14'))(_0xebf6('0x15'));var utils=require(_0xebf6('0x16'));var config=require(_0xebf6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xebf6('0x18'))['db'];function respondWithStatusCode(_0xedc361,_0x4919f1){_0x4919f1=_0x4919f1||0xcc;return function(_0x332ca0){if(_0x332ca0){return _0xedc361[_0xebf6('0x19')](_0x4919f1);}return _0xedc361[_0xebf6('0x1a')](_0x4919f1)[_0xebf6('0x1b')]();};}function respondWithResult(_0x3f69e6,_0x4dbf51){_0x4dbf51=_0x4dbf51||0xc8;return function(_0x4c01f4){if(_0x4c01f4){return _0x3f69e6['status'](_0x4dbf51)[_0xebf6('0x1c')](_0x4c01f4);}};}function respondWithFilteredResult(_0x1ae2f7,_0x50d80f){return function(_0x35570e){if(_0x35570e){var _0x2c980f=typeof _0x50d80f[_0xebf6('0x1d')]===_0xebf6('0x1e')&&typeof _0x50d80f[_0xebf6('0x1f')]===_0xebf6('0x1e');var _0x219621=_0x35570e[_0xebf6('0x20')];var _0x2d3984=_0x2c980f?0x0:_0x50d80f[_0xebf6('0x1d')];var _0x55fa31=_0x2c980f?_0x35570e['count']:_0x50d80f[_0xebf6('0x1d')]+_0x50d80f[_0xebf6('0x1f')];var _0x10051e;if(_0x55fa31>=_0x219621){_0x55fa31=_0x219621;_0x10051e=0xc8;}else{_0x10051e=0xce;}_0x1ae2f7[_0xebf6('0x1a')](_0x10051e);return _0x1ae2f7[_0xebf6('0x21')](_0xebf6('0x22'),_0x2d3984+'-'+_0x55fa31+'/'+_0x219621)[_0xebf6('0x1c')](_0x35570e);}return null;};}function patchUpdates(_0x80f523){return function(_0x4fb497){try{jsonpatch[_0xebf6('0x23')](_0x4fb497,_0x80f523,!![]);}catch(_0x81fdb3){return BPromise[_0xebf6('0x24')](_0x81fdb3);}return _0x4fb497[_0xebf6('0x25')]();};}function saveUpdates(_0x6303ac,_0x14c8ac){return function(_0x2f419e){if(_0x2f419e){return _0x2f419e[_0xebf6('0x26')](_0x6303ac)[_0xebf6('0x27')](function(_0x2e32c6){return _0x2e32c6;});}return null;};}function removeEntity(_0x232074,_0x2dd2ed){return function(_0x43c4e2){if(_0x43c4e2){return _0x43c4e2[_0xebf6('0x28')]()[_0xebf6('0x27')](function(){_0x232074[_0xebf6('0x1a')](0xcc)[_0xebf6('0x1b')]();});}};}function handleEntityNotFound(_0x1534b2,_0x3b58cb){return function(_0x4dadf7){if(!_0x4dadf7){_0x1534b2['sendStatus'](0x194);}return _0x4dadf7;};}function handleError(_0x2605a2,_0x4dc5be){_0x4dc5be=_0x4dc5be||0x1f4;return function(_0x230d84){logger[_0xebf6('0x29')](_0x230d84['stack']);if(_0x230d84['name']){delete _0x230d84[_0xebf6('0x2a')];}_0x2605a2[_0xebf6('0x1a')](_0x4dc5be)[_0xebf6('0x2b')](_0x230d84);};}exports[_0xebf6('0x2c')]=function(_0xedaaeb,_0x2dc0cf){var _0x7976d={},_0x7551ce={},_0x4c3495={'count':0x0,'rows':[]};var _0x37cd67=_[_0xebf6('0x2d')](db['FreshdeskField'][_0xebf6('0x2e')],function(_0x28bbea){return{'name':_0x28bbea['fieldName'],'type':_0x28bbea[_0xebf6('0x2f')][_0xebf6('0x30')]};});_0x7551ce[_0xebf6('0x31')]=_[_0xebf6('0x2d')](_0x37cd67,_0xebf6('0x2a'));_0x7551ce[_0xebf6('0x32')]=_['keys'](_0xedaaeb[_0xebf6('0x32')]);_0x7551ce[_0xebf6('0x33')]=_['intersection'](_0x7551ce['model'],_0x7551ce[_0xebf6('0x32')]);_0x7976d[_0xebf6('0x34')]=_['intersection'](_0x7551ce[_0xebf6('0x31')],qs[_0xebf6('0x35')](_0xedaaeb['query'][_0xebf6('0x35')]));_0x7976d[_0xebf6('0x34')]=_0x7976d[_0xebf6('0x34')]['length']?_0x7976d[_0xebf6('0x34')]:_0x7551ce[_0xebf6('0x31')];if(!_0xedaaeb[_0xebf6('0x32')][_0xebf6('0x36')]('nolimit')){_0x7976d['limit']=qs[_0xebf6('0x1f')](_0xedaaeb[_0xebf6('0x32')]['limit']);_0x7976d[_0xebf6('0x1d')]=qs[_0xebf6('0x1d')](_0xedaaeb['query'][_0xebf6('0x1d')]);}_0x7976d[_0xebf6('0x37')]=qs[_0xebf6('0x38')](_0xedaaeb[_0xebf6('0x32')][_0xebf6('0x38')]);_0x7976d['where']=qs[_0xebf6('0x33')](_['pick'](_0xedaaeb[_0xebf6('0x32')],_0x7551ce['filters']),_0x37cd67);if(_0xedaaeb[_0xebf6('0x32')][_0xebf6('0x39')]){_0x7976d[_0xebf6('0x3a')]=_[_0xebf6('0x3b')](_0x7976d[_0xebf6('0x3a')],{'$or':_[_0xebf6('0x2d')](_0x37cd67,function(_0x5eb1ea){if(_0x5eb1ea[_0xebf6('0x2f')]!==_0xebf6('0x3c')){var _0x3cd9a0={};_0x3cd9a0[_0x5eb1ea[_0xebf6('0x2a')]]={'$like':'%'+_0xedaaeb[_0xebf6('0x32')][_0xebf6('0x39')]+'%'};return _0x3cd9a0;}})});}_0x7976d=_['merge']({},_0x7976d,_0xedaaeb[_0xebf6('0x3d')]);var _0x2782a5={'where':_0x7976d[_0xebf6('0x3a')]};return db[_0xebf6('0x3e')][_0xebf6('0x20')](_0x2782a5)[_0xebf6('0x27')](function(_0x4887a8){_0x4c3495['count']=_0x4887a8;if(_0xedaaeb['query'][_0xebf6('0x3f')]){_0x7976d[_0xebf6('0x40')]=[{'all':!![]}];}return db[_0xebf6('0x3e')]['findAll'](_0x7976d);})[_0xebf6('0x27')](function(_0x1c3809){_0x4c3495[_0xebf6('0x41')]=_0x1c3809;return _0x4c3495;})['then'](respondWithFilteredResult(_0x2dc0cf,_0x7976d))[_0xebf6('0x42')](handleError(_0x2dc0cf,null));};exports[_0xebf6('0x43')]=function(_0x53ccc8,_0x3813a5){var _0x1de50e={'raw':!![],'where':{'id':_0x53ccc8['params']['id']}},_0x17c4af={};_0x17c4af[_0xebf6('0x31')]=_['keys'](db['FreshdeskField'][_0xebf6('0x2e')]);_0x17c4af[_0xebf6('0x32')]=_[_0xebf6('0x44')](_0x53ccc8[_0xebf6('0x32')]);_0x17c4af['filters']=_[_0xebf6('0x45')](_0x17c4af['model'],_0x17c4af[_0xebf6('0x32')]);_0x1de50e[_0xebf6('0x34')]=_[_0xebf6('0x45')](_0x17c4af[_0xebf6('0x31')],qs[_0xebf6('0x35')](_0x53ccc8['query']['fields']));_0x1de50e[_0xebf6('0x34')]=_0x1de50e[_0xebf6('0x34')][_0xebf6('0x46')]?_0x1de50e[_0xebf6('0x34')]:_0x17c4af['model'];if(_0x53ccc8[_0xebf6('0x32')][_0xebf6('0x3f')]){_0x1de50e[_0xebf6('0x40')]=[{'all':!![]}];}_0x1de50e=_[_0xebf6('0x3b')]({},_0x1de50e,_0x53ccc8[_0xebf6('0x3d')]);return db[_0xebf6('0x3e')][_0xebf6('0x47')](_0x1de50e)['then'](handleEntityNotFound(_0x3813a5,null))[_0xebf6('0x27')](respondWithResult(_0x3813a5,null))[_0xebf6('0x42')](handleError(_0x3813a5,null));};exports[_0xebf6('0x48')]=function(_0x42e3e1,_0x166664){return db[_0xebf6('0x3e')][_0xebf6('0x48')](_0x42e3e1['body'],{})[_0xebf6('0x27')](respondWithResult(_0x166664,0xc9))['catch'](handleError(_0x166664,null));};exports[_0xebf6('0x26')]=function(_0x31d8ba,_0x5d84ac){if(_0x31d8ba[_0xebf6('0x49')]['id']){delete _0x31d8ba['body']['id'];}return db[_0xebf6('0x3e')][_0xebf6('0x47')]({'where':{'id':_0x31d8ba[_0xebf6('0x4a')]['id']}})[_0xebf6('0x27')](handleEntityNotFound(_0x5d84ac,null))[_0xebf6('0x27')](saveUpdates(_0x31d8ba['body'],null))[_0xebf6('0x27')](respondWithResult(_0x5d84ac,null))[_0xebf6('0x42')](handleError(_0x5d84ac,null));};exports['destroy']=function(_0x1f98fd,_0x2765f2){return db[_0xebf6('0x3e')][_0xebf6('0x47')]({'where':{'id':_0x1f98fd[_0xebf6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2765f2,null))[_0xebf6('0x27')](removeEntity(_0x2765f2,null))[_0xebf6('0x42')](handleError(_0x2765f2,null));};
\ No newline at end of file
+var _0xac4a=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskField','type','key','model','query','filters','intersection','attributes','fields'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xac4a,0x13f));var _0xaac4=function(_0x55f97e,_0x2589e2){_0x55f97e=_0x55f97e-0x0;var _0x1f0707=_0xac4a[_0x55f97e];return _0x1f0707;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={},_0x16b33c={},_0xda10b6={'count':0x0,'rows':[]};var _0xb76ccc=_[_0xaac4('0x29')](db[_0xaac4('0x2a')]['rawAttributes'],function(_0xcf6c1){return{'name':_0xcf6c1['fieldName'],'type':_0xcf6c1[_0xaac4('0x2b')][_0xaac4('0x2c')]};});_0x16b33c[_0xaac4('0x2d')]=_[_0xaac4('0x29')](_0xb76ccc,'name');_0x16b33c['query']=_['keys'](_0x386c9b[_0xaac4('0x2e')]);_0x16b33c[_0xaac4('0x2f')]=_[_0xaac4('0x30')](_0x16b33c[_0xaac4('0x2d')],_0x16b33c[_0xaac4('0x2e')]);_0x316445[_0xaac4('0x31')]=_[_0xaac4('0x30')](_0x16b33c[_0xaac4('0x2d')],qs[_0xaac4('0x32')](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x32')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x33')]?_0x316445[_0xaac4('0x31')]:_0x16b33c['model'];if(!_0x386c9b['query'][_0xaac4('0x34')](_0xaac4('0x35'))){_0x316445[_0xaac4('0x1a')]=qs['limit'](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x1a')]);_0x316445[_0xaac4('0x18')]=qs[_0xaac4('0x18')](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x18')]);}_0x316445[_0xaac4('0x36')]=qs['sort'](_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x37')]);_0x316445[_0xaac4('0x38')]=qs['filters'](_[_0xaac4('0x39')](_0x386c9b['query'],_0x16b33c['filters']),_0xb76ccc);if(_0x386c9b[_0xaac4('0x2e')][_0xaac4('0x3a')]){_0x316445[_0xaac4('0x38')]=_['merge'](_0x316445['where'],{'$or':_[_0xaac4('0x29')](_0xb76ccc,function(_0x33cc4){if(_0x33cc4[_0xaac4('0x2b')]!==_0xaac4('0x3b')){var _0x2b65b1={};_0x2b65b1[_0x33cc4[_0xaac4('0x26')]]={'$like':'%'+_0x386c9b['query']['filter']+'%'};return _0x2b65b1;}})});}_0x316445=_[_0xaac4('0x3c')]({},_0x316445,_0x386c9b[_0xaac4('0x3d')]);var _0x5371b4={'where':_0x316445[_0xaac4('0x38')]};return db[_0xaac4('0x2a')][_0xaac4('0x1b')](_0x5371b4)['then'](function(_0x74a1c){_0xda10b6[_0xaac4('0x1b')]=_0x74a1c;if(_0x386c9b[_0xaac4('0x2e')]['includeAll']){_0x316445[_0xaac4('0x3e')]=[{'all':!![]}];}return db[_0xaac4('0x2a')][_0xaac4('0x3f')](_0x316445);})[_0xaac4('0x23')](function(_0x51e59d){_0xda10b6[_0xaac4('0x40')]=_0x51e59d;return _0xda10b6;})['then'](respondWithFilteredResult(_0x4d0f5f,_0x316445))['catch'](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x41')]=function(_0x31e240,_0x27df36){var _0x40c007={'raw':!![],'where':{'id':_0x31e240[_0xaac4('0x42')]['id']}},_0x43bc12={};_0x43bc12[_0xaac4('0x2d')]=_[_0xaac4('0x43')](db['FreshdeskField'][_0xaac4('0x44')]);_0x43bc12[_0xaac4('0x2e')]=_[_0xaac4('0x43')](_0x31e240[_0xaac4('0x2e')]);_0x43bc12['filters']=_[_0xaac4('0x30')](_0x43bc12[_0xaac4('0x2d')],_0x43bc12[_0xaac4('0x2e')]);_0x40c007['attributes']=_[_0xaac4('0x30')](_0x43bc12[_0xaac4('0x2d')],qs[_0xaac4('0x32')](_0x31e240[_0xaac4('0x2e')]['fields']));_0x40c007[_0xaac4('0x31')]=_0x40c007[_0xaac4('0x31')][_0xaac4('0x33')]?_0x40c007['attributes']:_0x43bc12[_0xaac4('0x2d')];if(_0x31e240[_0xaac4('0x2e')][_0xaac4('0x45')]){_0x40c007[_0xaac4('0x3e')]=[{'all':!![]}];}_0x40c007=_[_0xaac4('0x3c')]({},_0x40c007,_0x31e240[_0xaac4('0x3d')]);return db[_0xaac4('0x2a')][_0xaac4('0x46')](_0x40c007)[_0xaac4('0x23')](handleEntityNotFound(_0x27df36,null))['then'](respondWithResult(_0x27df36,null))[_0xaac4('0x47')](handleError(_0x27df36,null));};exports[_0xaac4('0x48')]=function(_0x27425a,_0x360420){return db[_0xaac4('0x2a')]['create'](_0x27425a['body'],{})[_0xaac4('0x23')](respondWithResult(_0x360420,0xc9))[_0xaac4('0x47')](handleError(_0x360420,null));};exports[_0xaac4('0x21')]=function(_0x16c7f4,_0x5f33ea){if(_0x16c7f4[_0xaac4('0x49')]['id']){delete _0x16c7f4['body']['id'];}return db[_0xaac4('0x2a')][_0xaac4('0x46')]({'where':{'id':_0x16c7f4['params']['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x5f33ea,null))[_0xaac4('0x23')](saveUpdates(_0x16c7f4[_0xaac4('0x49')],null))['then'](respondWithResult(_0x5f33ea,null))['catch'](handleError(_0x5f33ea,null));};exports[_0xaac4('0x22')]=function(_0x2c1751,_0x22dda7){return db[_0xaac4('0x2a')][_0xaac4('0x46')]({'where':{'id':_0x2c1751[_0xaac4('0x42')]['id']}})['then'](handleEntityNotFound(_0x22dda7,null))[_0xaac4('0x23')](removeEntity(_0x22dda7,null))[_0xaac4('0x47')](handleError(_0x22dda7,null));};
\ No newline at end of file
index 6943b7d..2b9f3e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcd16=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util','../../config/logger','api','moment'];(function(_0x3815cf,_0x28a5f0){var _0x2ce13c=function(_0x3435eb){while(--_0x3435eb){_0x3815cf['push'](_0x3815cf['shift']());}};_0x2ce13c(++_0x28a5f0);}(_0xcd16,0x13e));var _0x6cd1=function(_0xe9578c,_0x1fb22c){_0xe9578c=_0xe9578c-0x0;var _0x5da284=_0xcd16[_0xe9578c];return _0x5da284;};'use strict';var _=require(_0x6cd1('0x0'));var util=require(_0x6cd1('0x1'));var logger=require(_0x6cd1('0x2'))(_0x6cd1('0x3'));var moment=require(_0x6cd1('0x4'));var BPromise=require(_0x6cd1('0x5'));var rp=require(_0x6cd1('0x6'));var fs=require('fs');var path=require(_0x6cd1('0x7'));var rimraf=require(_0x6cd1('0x8'));var config=require(_0x6cd1('0x9'));var attributes=require(_0x6cd1('0xa'));module[_0x6cd1('0xb')]=function(_0x6113be,_0x418c07){return _0x6113be[_0x6cd1('0xc')](_0x6cd1('0xd'),attributes,{'tableName':_0x6cd1('0xe'),'paranoid':![],'indexes':[{'name':_0x6cd1('0xf'),'fields':[_0x6cd1('0x10'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x14f6=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intFreshdeskField.attributes','define'];(function(_0x4c669e,_0x3f44a3){var _0xed82ad=function(_0x1b10e8){while(--_0x1b10e8){_0x4c669e['push'](_0x4c669e['shift']());}};_0xed82ad(++_0x3f44a3);}(_0x14f6,0x170));var _0x614f=function(_0x46e642,_0x1cb3d2){_0x46e642=_0x46e642-0x0;var _0x1a0fed=_0x14f6[_0x46e642];return _0x1a0fed;};'use strict';var _=require(_0x614f('0x0'));var util=require(_0x614f('0x1'));var logger=require(_0x614f('0x2'))(_0x614f('0x3'));var moment=require(_0x614f('0x4'));var BPromise=require(_0x614f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x614f('0x6'));var config=require(_0x614f('0x7'));var attributes=require(_0x614f('0x8'));module['exports']=function(_0x48bbf6,_0x1e5a4f){return _0x48bbf6[_0x614f('0x9')]('FreshdeskField',attributes,{'tableName':_0x614f('0xa'),'paranoid':![],'indexes':[{'name':_0x614f('0xb'),'fields':[_0x614f('0xc'),_0x614f('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index e8df07b..f9e9cc7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc931=['then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x5048c2,_0x3786d2){var _0x4bf2a6=function(_0x2104dc){while(--_0x2104dc){_0x5048c2['push'](_0x5048c2['shift']());}};_0x4bf2a6(++_0x3786d2);}(_0xc931,0x15d));var _0x1c93=function(_0xdc716c,_0x272127){_0xdc716c=_0xdc716c-0x0;var _0x3ba44d=_0xc931[_0xdc716c];return _0x3ba44d;};'use strict';var _=require(_0x1c93('0x0'));var util=require('util');var moment=require(_0x1c93('0x1'));var BPromise=require(_0x1c93('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c93('0x3'));var db=require(_0x1c93('0x4'))['db'];var utils=require(_0x1c93('0x5'));var logger=require(_0x1c93('0x6'))('rpc');var config=require(_0x1c93('0x7'));var jayson=require(_0x1c93('0x8'));var client=jayson[_0x1c93('0x9')][_0x1c93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7c24ec,_0xdb815,_0x3695c7){return new BPromise(function(_0x1779dd,_0x363282){return client['request'](_0x7c24ec,_0x3695c7)[_0x1c93('0xb')](function(_0x3b80b5){logger[_0x1c93('0xc')](_0x1c93('0xd'),_0xdb815,_0x1c93('0xe'));logger['debug'](_0x1c93('0xf'),_0xdb815,'request\x20sent',JSON[_0x1c93('0x10')](_0x3b80b5));if(_0x3b80b5[_0x1c93('0x11')]){if(_0x3b80b5[_0x1c93('0x11')][_0x1c93('0x12')]===0x1f4){logger[_0x1c93('0x11')](_0x1c93('0xd'),_0xdb815,_0x3b80b5[_0x1c93('0x11')][_0x1c93('0x13')]);return _0x363282(_0x3b80b5['error'][_0x1c93('0x13')]);}logger[_0x1c93('0x11')](_0x1c93('0xd'),_0xdb815,_0x3b80b5[_0x1c93('0x11')]['message']);return _0x1779dd(_0x3b80b5[_0x1c93('0x11')][_0x1c93('0x13')]);}else{logger[_0x1c93('0xc')](_0x1c93('0xd'),_0xdb815,_0x1c93('0xe'));_0x1779dd(_0x3b80b5['result'][_0x1c93('0x13')]);}})['catch'](function(_0x2e363c){logger[_0x1c93('0x11')](_0x1c93('0xd'),_0xdb815,_0x2e363c);_0x363282(_0x2e363c);});});}
\ No newline at end of file
+var _0xd5c6=['util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x5de5ac,_0x268da1){var _0x3b2dea=function(_0x481344){while(--_0x481344){_0x5de5ac['push'](_0x5de5ac['shift']());}};_0x3b2dea(++_0x268da1);}(_0xd5c6,0x99));var _0x6d5c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd5c6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6d5c('0x0'));var util=require(_0x6d5c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d5c('0x2'));var db=require(_0x6d5c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d5c('0x4'))(_0x6d5c('0x5'));var config=require(_0x6d5c('0x6'));var jayson=require(_0x6d5c('0x7'));var client=jayson[_0x6d5c('0x8')][_0x6d5c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39f767,_0x37c9de,_0x5a090a){return new BPromise(function(_0xcc3572,_0xcd9166){return client['request'](_0x39f767,_0x5a090a)[_0x6d5c('0xa')](function(_0x20c97c){logger[_0x6d5c('0xb')](_0x6d5c('0xc'),_0x37c9de,_0x6d5c('0xd'));logger[_0x6d5c('0xe')](_0x6d5c('0xf'),_0x37c9de,_0x6d5c('0xd'),JSON[_0x6d5c('0x10')](_0x20c97c));if(_0x20c97c['error']){if(_0x20c97c[_0x6d5c('0x11')][_0x6d5c('0x12')]===0x1f4){logger['error'](_0x6d5c('0xc'),_0x37c9de,_0x20c97c[_0x6d5c('0x11')][_0x6d5c('0x13')]);return _0xcd9166(_0x20c97c[_0x6d5c('0x11')][_0x6d5c('0x13')]);}logger[_0x6d5c('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x37c9de,_0x20c97c[_0x6d5c('0x11')][_0x6d5c('0x13')]);return _0xcc3572(_0x20c97c[_0x6d5c('0x11')][_0x6d5c('0x13')]);}else{logger[_0x6d5c('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x37c9de,_0x6d5c('0xd'));_0xcc3572(_0x20c97c[_0x6d5c('0x14')][_0x6d5c('0x13')]);}})[_0x6d5c('0x15')](function(_0x74e70a){logger[_0x6d5c('0x11')](_0x6d5c('0xc'),_0x37c9de,_0x74e70a);_0xcd9166(_0x74e70a);});});}
\ No newline at end of file
index b866fa4..f857034 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa74f=['post','create','/:id/configurations','put','update','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','index','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields'];(function(_0x19f683,_0x445ee2){var _0x50128f=function(_0x4365d9){while(--_0x4365d9){_0x19f683['push'](_0x19f683['shift']());}};_0x50128f(++_0x445ee2);}(_0xa74f,0x9a));var _0xfa74=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xa74f[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id/configurations',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0x7')](_0xfa74('0xc'),auth['isAuthenticated'](),controller[_0xfa74('0xd')]);router[_0xfa74('0xe')]('/',auth['isAuthenticated'](),controller[_0xfa74('0xf')]);router[_0xfa74('0xe')](_0xfa74('0x10'),auth[_0xfa74('0x9')](),controller['addConfiguration']);router[_0xfa74('0x11')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0x12')]);router['delete'](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0x13')]);module[_0xfa74('0x14')]=router;
\ No newline at end of file
+var _0xd404=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show'];(function(_0x1a4a0b,_0x5e8e4f){var _0x15d52a=function(_0x559941){while(--_0x559941){_0x1a4a0b['push'](_0x1a4a0b['shift']());}};_0x15d52a(++_0x5e8e4f);}(_0xd404,0x15b));var _0x4d40=function(_0x6e7446,_0x120a01){_0x6e7446=_0x6e7446-0x0;var _0x167b36=_0xd404[_0x6e7446];return _0x167b36;};'use strict';var multer=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var path=require('path');var timeout=require(_0x4d40('0x2'));var express=require(_0x4d40('0x3'));var router=express['Router']();var fs_extra=require(_0x4d40('0x4'));var auth=require(_0x4d40('0x5'));var interaction=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var controller=require(_0x4d40('0x8'));router[_0x4d40('0x9')]('/',auth[_0x4d40('0xa')](),controller[_0x4d40('0xb')]);router[_0x4d40('0x9')]('/:id',auth[_0x4d40('0xa')](),controller[_0x4d40('0xc')]);router['get'](_0x4d40('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x4d40('0x9')](_0x4d40('0xe'),auth[_0x4d40('0xa')](),controller[_0x4d40('0xf')]);router[_0x4d40('0x10')]('/',auth[_0x4d40('0xa')](),controller[_0x4d40('0x11')]);router[_0x4d40('0x10')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x12')]);router[_0x4d40('0x13')](_0x4d40('0x14'),auth[_0x4d40('0xa')](),controller['update']);router[_0x4d40('0x15')](_0x4d40('0x14'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x16')]);module[_0x4d40('0x17')]=router;
\ No newline at end of file
index f7a85ee..5ea599a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3de3=['username','remoteUri','sequelize','STRING'];(function(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_0x3de3,0x1ce));var _0x33de=function(_0x29d42d,_0x49a750){_0x29d42d=_0x29d42d-0x0;var _0x3dfb06=_0x3de3[_0x29d42d];return _0x3dfb06;};'use strict';var Sequelize=require(_0x33de('0x0'));module['exports']={'name':{'type':Sequelize[_0x33de('0x1')]},'description':{'type':Sequelize[_0x33de('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x33de('0x2')},'apiKey':{'type':Sequelize[_0x33de('0x1')]},'remoteUri':{'type':Sequelize[_0x33de('0x1')],'unique':_0x33de('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}};
\ No newline at end of file
+var _0x958a=['sequelize','exports','STRING','username'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x958a,0x128));var _0xa958=function(_0x2481b4,_0x353fd8){_0x2481b4=_0x2481b4-0x0;var _0x25ac14=_0x958a[_0x2481b4];return _0x25ac14;};'use strict';var Sequelize=require(_0xa958('0x0'));module[_0xa958('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa958('0x2')]},'username':{'type':Sequelize[_0xa958('0x2')],'unique':_0xa958('0x3')},'apiKey':{'type':Sequelize[_0xa958('0x2')]},'remoteUri':{'type':Sequelize[_0xa958('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xa958('0x2')],'allowNull':![]}};
\ No newline at end of file
index 0c44db5..a16b09f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9788=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','error','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','query','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','create','find','body','destroy','findOne','pick','nolimit','getConfigurations','addConfiguration','Subjects','getSubjects','channel','getDescriptions','FreshsalesConfiguration','FreshsalesField','Descriptions','username','remoteUri','apiKey','slice','lastIndexOf','format','/api/selector/owners','Token\x20token=','users','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path'];(function(_0x34b5df,_0x30bb13){var _0x132b30=function(_0x3b7ec6){while(--_0x3b7ec6){_0x34b5df['push'](_0x34b5df['shift']());}};_0x132b30(++_0x30bb13);}(_0x9788,0x189));var _0x8978=function(_0x1ce7ff,_0x27949e){_0x1ce7ff=_0x1ce7ff-0x0;var _0x375f54=_0x9788[_0x1ce7ff];return _0x375f54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8978('0x0'));var zipdir=require(_0x8978('0x1'));var jsonpatch=require(_0x8978('0x2'));var rp=require('request-promise');var moment=require(_0x8978('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8978('0x4'));var util=require(_0x8978('0x5'));var path=require(_0x8978('0x6'));var sox=require(_0x8978('0x7'));var csv=require(_0x8978('0x8'));var ejs=require(_0x8978('0x9'));var fs=require('fs');var fs_extra=require(_0x8978('0xa'));var _=require(_0x8978('0xb'));var squel=require(_0x8978('0xc'));var crypto=require('crypto');var jsforce=require(_0x8978('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8978('0x8'));var querystring=require(_0x8978('0xe'));var Papa=require(_0x8978('0xf'));var Redis=require(_0x8978('0x10'));var authService=require(_0x8978('0x11'));var qs=require(_0x8978('0x12'));var as=require(_0x8978('0x13'));var hardwareService=require(_0x8978('0x14'));var logger=require(_0x8978('0x15'))('api');var utils=require(_0x8978('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8978('0x17'))['db'];var integrations=require(_0x8978('0x18'));function respondWithStatusCode(_0x3db290,_0x12aea2){_0x12aea2=_0x12aea2||0xcc;return function(_0x25cf07){if(_0x25cf07){return _0x3db290[_0x8978('0x19')](_0x12aea2);}return _0x3db290[_0x8978('0x1a')](_0x12aea2)[_0x8978('0x1b')]();};}function respondWithResult(_0x50c083,_0x3a754d){_0x3a754d=_0x3a754d||0xc8;return function(_0x2024b4){if(_0x2024b4){return _0x50c083[_0x8978('0x1a')](_0x3a754d)['json'](_0x2024b4);}};}function respondWithFilteredResult(_0xd8b8a8,_0x278d76){return function(_0x385ad5){if(_0x385ad5){var _0x8c3bfa=typeof _0x278d76[_0x8978('0x1c')]===_0x8978('0x1d')&&typeof _0x278d76[_0x8978('0x1e')]===_0x8978('0x1d');var _0x4e7ec1=_0x385ad5[_0x8978('0x1f')];var _0xadb45b=_0x8c3bfa?0x0:_0x278d76['offset'];var _0x2f4fa8=_0x8c3bfa?_0x385ad5[_0x8978('0x1f')]:_0x278d76['offset']+_0x278d76[_0x8978('0x1e')];var _0x1c9629;if(_0x2f4fa8>=_0x4e7ec1){_0x2f4fa8=_0x4e7ec1;_0x1c9629=0xc8;}else{_0x1c9629=0xce;}_0xd8b8a8['status'](_0x1c9629);return _0xd8b8a8[_0x8978('0x20')]('Content-Range',_0xadb45b+'-'+_0x2f4fa8+'/'+_0x4e7ec1)[_0x8978('0x21')](_0x385ad5);}return null;};}function patchUpdates(_0x1a6256){return function(_0x7c91bd){try{jsonpatch[_0x8978('0x22')](_0x7c91bd,_0x1a6256,!![]);}catch(_0x1fc048){return BPromise['reject'](_0x1fc048);}return _0x7c91bd[_0x8978('0x23')]();};}function saveUpdates(_0x1cf80d,_0xc427f7){return function(_0x31d776){if(_0x31d776){return _0x31d776[_0x8978('0x24')](_0x1cf80d)['then'](function(_0x52e46e){return _0x52e46e;});}return null;};}function removeEntity(_0x14756f,_0xf52e2c){return function(_0x53a4cf){if(_0x53a4cf){return _0x53a4cf['destroy']()[_0x8978('0x25')](function(){_0x14756f[_0x8978('0x1a')](0xcc)[_0x8978('0x1b')]();});}};}function handleEntityNotFound(_0x27a813,_0x162f00){return function(_0x115ca4){if(!_0x115ca4){_0x27a813[_0x8978('0x19')](0x194);}return _0x115ca4;};}function handleError(_0x379a4b,_0x116f83){_0x116f83=_0x116f83||0x1f4;return function(_0xbe41b5){logger[_0x8978('0x26')](_0xbe41b5[_0x8978('0x27')]);if(_0xbe41b5[_0x8978('0x28')]){delete _0xbe41b5[_0x8978('0x28')];}_0x379a4b[_0x8978('0x1a')](_0x116f83)['send'](_0xbe41b5);};}exports[_0x8978('0x29')]=function(_0x1b29b7,_0xa0066d){var _0x5d1f66={},_0xf8b331={},_0x4e4cb9={'count':0x0,'rows':[]};var _0x34bf86=_[_0x8978('0x2a')](db[_0x8978('0x2b')][_0x8978('0x2c')],function(_0x48b231){return{'name':_0x48b231[_0x8978('0x2d')],'type':_0x48b231[_0x8978('0x2e')]['key']};});_0xf8b331['model']=_[_0x8978('0x2a')](_0x34bf86,'name');_0xf8b331[_0x8978('0x2f')]=_['keys'](_0x1b29b7[_0x8978('0x2f')]);_0xf8b331['filters']=_['intersection'](_0xf8b331['model'],_0xf8b331[_0x8978('0x2f')]);_0x5d1f66[_0x8978('0x30')]=_[_0x8978('0x31')](_0xf8b331[_0x8978('0x32')],qs[_0x8978('0x33')](_0x1b29b7['query']['fields']));_0x5d1f66[_0x8978('0x30')]=_0x5d1f66[_0x8978('0x30')][_0x8978('0x34')]?_0x5d1f66[_0x8978('0x30')]:_0xf8b331[_0x8978('0x32')];if(!_0x1b29b7[_0x8978('0x2f')][_0x8978('0x35')]('nolimit')){_0x5d1f66[_0x8978('0x1e')]=qs[_0x8978('0x1e')](_0x1b29b7[_0x8978('0x2f')][_0x8978('0x1e')]);_0x5d1f66[_0x8978('0x1c')]=qs[_0x8978('0x1c')](_0x1b29b7[_0x8978('0x2f')]['offset']);}_0x5d1f66[_0x8978('0x36')]=qs[_0x8978('0x37')](_0x1b29b7[_0x8978('0x2f')][_0x8978('0x37')]);_0x5d1f66['where']=qs['filters'](_['pick'](_0x1b29b7['query'],_0xf8b331[_0x8978('0x38')]),_0x34bf86);if(_0x1b29b7[_0x8978('0x2f')][_0x8978('0x39')]){_0x5d1f66[_0x8978('0x3a')]=_[_0x8978('0x3b')](_0x5d1f66[_0x8978('0x3a')],{'$or':_['map'](_0x34bf86,function(_0x5ba5c9){if(_0x5ba5c9['type']!==_0x8978('0x3c')){var _0x34dbb3={};_0x34dbb3[_0x5ba5c9[_0x8978('0x28')]]={'$like':'%'+_0x1b29b7['query'][_0x8978('0x39')]+'%'};return _0x34dbb3;}})});}_0x5d1f66=_[_0x8978('0x3b')]({},_0x5d1f66,_0x1b29b7[_0x8978('0x3d')]);var _0x209094={'where':_0x5d1f66[_0x8978('0x3a')]};return db['FreshsalesAccount'][_0x8978('0x1f')](_0x209094)[_0x8978('0x25')](function(_0xeae6f1){_0x4e4cb9[_0x8978('0x1f')]=_0xeae6f1;if(_0x1b29b7['query'][_0x8978('0x3e')]){_0x5d1f66[_0x8978('0x3f')]=[{'all':!![]}];}return db[_0x8978('0x2b')]['findAll'](_0x5d1f66);})[_0x8978('0x25')](function(_0x538e85){_0x4e4cb9['rows']=_0x538e85;return _0x4e4cb9;})[_0x8978('0x25')](respondWithFilteredResult(_0xa0066d,_0x5d1f66))[_0x8978('0x40')](handleError(_0xa0066d,null));};exports[_0x8978('0x41')]=function(_0x4f40ea,_0x2cd852){var _0x2383c1={'raw':![],'where':{'id':_0x4f40ea[_0x8978('0x42')]['id']}},_0x6c4299={};_0x6c4299[_0x8978('0x32')]=_[_0x8978('0x43')](db[_0x8978('0x2b')][_0x8978('0x2c')]);_0x6c4299[_0x8978('0x2f')]=_[_0x8978('0x43')](_0x4f40ea['query']);_0x6c4299[_0x8978('0x38')]=_[_0x8978('0x31')](_0x6c4299[_0x8978('0x32')],_0x6c4299[_0x8978('0x2f')]);_0x2383c1[_0x8978('0x30')]=_[_0x8978('0x31')](_0x6c4299[_0x8978('0x32')],qs[_0x8978('0x33')](_0x4f40ea[_0x8978('0x2f')][_0x8978('0x33')]));_0x2383c1[_0x8978('0x30')]=_0x2383c1[_0x8978('0x30')]['length']?_0x2383c1[_0x8978('0x30')]:_0x6c4299[_0x8978('0x32')];if(_0x4f40ea[_0x8978('0x2f')][_0x8978('0x3e')]){_0x2383c1['include']=[{'all':!![]}];}_0x2383c1=_[_0x8978('0x3b')]({},_0x2383c1,_0x4f40ea['options']);return db['FreshsalesAccount']['find'](_0x2383c1)[_0x8978('0x25')](handleEntityNotFound(_0x2cd852,null))['then'](respondWithResult(_0x2cd852,null))[_0x8978('0x40')](handleError(_0x2cd852,null));};exports[_0x8978('0x44')]=function(_0x24c38b,_0x4309aa){return db[_0x8978('0x2b')][_0x8978('0x44')](_0x24c38b['body'],{})[_0x8978('0x25')](respondWithResult(_0x4309aa,0xc9))[_0x8978('0x40')](handleError(_0x4309aa,null));};exports[_0x8978('0x24')]=function(_0x14da05,_0x237ec4){if(_0x14da05['body']['id']){delete _0x14da05['body']['id'];}return db[_0x8978('0x2b')][_0x8978('0x45')]({'where':{'id':_0x14da05[_0x8978('0x42')]['id']}})[_0x8978('0x25')](handleEntityNotFound(_0x237ec4,null))['then'](saveUpdates(_0x14da05[_0x8978('0x46')],null))[_0x8978('0x25')](respondWithResult(_0x237ec4,null))[_0x8978('0x40')](handleError(_0x237ec4,null));};exports[_0x8978('0x47')]=function(_0x11f25c,_0x50e11f){return db['FreshsalesAccount']['find']({'where':{'id':_0x11f25c['params']['id']}})[_0x8978('0x25')](handleEntityNotFound(_0x50e11f,null))[_0x8978('0x25')](removeEntity(_0x50e11f,null))[_0x8978('0x40')](handleError(_0x50e11f,null));};exports['getConfigurations']=function(_0x43a3eb,_0x21d2be,_0x4166cf){var _0x124ca7={};var _0xa14b97={};var _0xb387d6;var _0x1d8e6b;return db[_0x8978('0x2b')][_0x8978('0x48')]({'where':{'id':_0x43a3eb['params']['id']}})[_0x8978('0x25')](handleEntityNotFound(_0x21d2be,null))['then'](function(_0x1236e6){if(_0x1236e6){_0xb387d6=_0x1236e6;_0xa14b97[_0x8978('0x32')]=_['keys'](db['FreshsalesConfiguration'][_0x8978('0x2c')]);_0xa14b97[_0x8978('0x2f')]=_[_0x8978('0x43')](_0x43a3eb['query']);_0xa14b97[_0x8978('0x38')]=_[_0x8978('0x31')](_0xa14b97[_0x8978('0x32')],_0xa14b97[_0x8978('0x2f')]);_0x124ca7[_0x8978('0x30')]=_['intersection'](_0xa14b97[_0x8978('0x32')],qs[_0x8978('0x33')](_0x43a3eb[_0x8978('0x2f')][_0x8978('0x33')]));_0x124ca7[_0x8978('0x30')]=_0x124ca7[_0x8978('0x30')][_0x8978('0x34')]?_0x124ca7[_0x8978('0x30')]:_0xa14b97[_0x8978('0x32')];_0x124ca7[_0x8978('0x36')]=qs[_0x8978('0x37')](_0x43a3eb[_0x8978('0x2f')]['sort']);_0x124ca7[_0x8978('0x3a')]=qs[_0x8978('0x38')](_[_0x8978('0x49')](_0x43a3eb[_0x8978('0x2f')],_0xa14b97[_0x8978('0x38')]));if(_0x43a3eb['query'][_0x8978('0x39')]){_0x124ca7[_0x8978('0x3a')]=_[_0x8978('0x3b')](_0x124ca7[_0x8978('0x3a')],{'$or':_['map'](_0x124ca7[_0x8978('0x30')],function(_0x21886d){var _0x19d56e={};_0x19d56e[_0x21886d]={'$like':'%'+_0x43a3eb[_0x8978('0x2f')][_0x8978('0x39')]+'%'};return _0x19d56e;})});}_0x124ca7=_['merge']({},_0x124ca7,_0x43a3eb[_0x8978('0x3d')]);return _0xb387d6['getConfigurations'](_0x124ca7);}})[_0x8978('0x25')](function(_0x745d00){if(_0x745d00){_0x1d8e6b=_0x745d00[_0x8978('0x34')];if(!_0x43a3eb['query']['hasOwnProperty'](_0x8978('0x4a'))){_0x124ca7['limit']=qs['limit'](_0x43a3eb[_0x8978('0x2f')][_0x8978('0x1e')]);_0x124ca7[_0x8978('0x1c')]=qs[_0x8978('0x1c')](_0x43a3eb[_0x8978('0x2f')]['offset']);}return _0xb387d6[_0x8978('0x4b')](_0x124ca7);}})[_0x8978('0x25')](function(_0x153119){if(_0x153119){return _0x153119?{'count':_0x1d8e6b,'rows':_0x153119}:null;}})[_0x8978('0x25')](respondWithResult(_0x21d2be,null))[_0x8978('0x40')](handleError(_0x21d2be,null));};exports[_0x8978('0x4c')]=function(_0x208552,_0x9d5ab5,_0x1ab8ba){if(_0x208552['body']['id']){delete _0x208552['body']['id'];}return db[_0x8978('0x2b')][_0x8978('0x48')]({'where':{'id':_0x208552['params']['id']}})[_0x8978('0x25')](handleEntityNotFound(_0x9d5ab5,null))[_0x8978('0x25')](function(_0x5097fd){if(_0x5097fd){_0x208552['body']['AccountId']=_0x5097fd['id'];_0x208552[_0x8978('0x46')][_0x8978('0x4d')]=integrations[_0x8978('0x4e')](_0x208552[_0x8978('0x46')][_0x8978('0x4f')],_0x208552[_0x8978('0x46')]['type']);_0x208552[_0x8978('0x46')]['Descriptions']=integrations[_0x8978('0x50')](_0x208552['body']['channel'],_0x208552['body'][_0x8978('0x2e')]);return db[_0x8978('0x51')][_0x8978('0x44')](_0x208552[_0x8978('0x46')],{'include':[{'model':db[_0x8978('0x52')],'as':_0x8978('0x4d')},{'model':db[_0x8978('0x52')],'as':_0x8978('0x53')}]});}return null;})[_0x8978('0x25')](respondWithResult(_0x9d5ab5,null))[_0x8978('0x40')](handleError(_0x9d5ab5,null));};exports['getFields']=function(_0x84f3bf,_0x49dfff,_0x590ce5){var _0x15a533='';var _0x4c6e69='';return db['FreshsalesAccount'][_0x8978('0x48')]({'where':{'id':_0x84f3bf[_0x8978('0x42')]['id']},'attributes':['id',_0x8978('0x54'),_0x8978('0x55'),_0x8978('0x56')]})[_0x8978('0x25')](handleEntityNotFound(_0x49dfff,null))[_0x8978('0x25')](function(_0x212124){if(_0x212124){_0x4c6e69=_0x212124['username'];_0x15a533=_0x212124[_0x8978('0x55')];var _0x5be706=_0x212124['remoteUri'][_0x8978('0x57')](-0x1);if(_0x5be706==='/'){_0x15a533=_0x15a533['substring'](0x0,_0x15a533[_0x8978('0x58')](_0x5be706));}return rp({'method':'GET','uri':util[_0x8978('0x59')]('%s%s',_0x15a533,_0x8978('0x5a')),'headers':{'Authorization':_0x8978('0x5b')+_0x212124[_0x8978('0x56')]},'json':!![]});}})[_0x8978('0x25')](function(_0xcf29b1){if(_0xcf29b1){var _0x3ce385=_0xcf29b1[_0x8978('0x5c')];var _0x415eee=![];var _0x58f80b=null;for(_0x58f80b=0x0;_0x58f80b<_0x3ce385[_0x8978('0x34')];_0x58f80b++){if(_0x3ce385[_0x58f80b]['email']===_0x4c6e69){_0x415eee=!![];}}if(_0x415eee){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x8978('0x25')](respondWithResult(_0x49dfff,null))['catch'](function(_0xe994a1){var _0x32664b=_0x84f3bf[_0x8978('0x2f')][_0x8978('0x5d')]?0x1f4:_0xe994a1[_0x8978('0x5e')]||0x1f4;logger[_0x8978('0x26')](_0x8978('0x5f'),_0x8978('0x60'),_0x32664b,JSON[_0x8978('0x61')](_0xe994a1));delete _0xe994a1[_0x8978('0x28')];if(_0x32664b===0x191){_0x32664b=0x190;}_0x49dfff[_0x8978('0x1a')](_0x32664b)[_0x8978('0x62')](_0x84f3bf[_0x8978('0x2f')][_0x8978('0x5d')]?{'message':_0x8978('0x63'),'statusCode':_0xe994a1[_0x8978('0x5e')]}:_0xe994a1);});};
\ No newline at end of file
+var _0xc3ba=['FreshsalesAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','nolimit','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','%s%s','/api/selector/owners','apiKey','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map'];(function(_0x1f530d,_0x18a19e){var _0x22103f=function(_0x2664c5){while(--_0x2664c5){_0x1f530d['push'](_0x1f530d['shift']());}};_0x22103f(++_0x18a19e);}(_0xc3ba,0xa4));var _0xac3b=function(_0x48b69c,_0x4d465f){_0x48b69c=_0x48b69c-0x0;var _0xec8357=_0xc3ba[_0x48b69c];return _0xec8357;};'use strict';var emlformat=require(_0xac3b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac3b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac3b('0x2'));var moment=require(_0xac3b('0x3'));var BPromise=require(_0xac3b('0x4'));var Mustache=require(_0xac3b('0x5'));var util=require(_0xac3b('0x6'));var path=require(_0xac3b('0x7'));var sox=require(_0xac3b('0x8'));var csv=require(_0xac3b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac3b('0xa'));var _=require(_0xac3b('0xb'));var squel=require(_0xac3b('0xc'));var crypto=require(_0xac3b('0xd'));var jsforce=require(_0xac3b('0xe'));var deskjs=require(_0xac3b('0xf'));var toCsv=require(_0xac3b('0x9'));var querystring=require(_0xac3b('0x10'));var Papa=require(_0xac3b('0x11'));var Redis=require(_0xac3b('0x12'));var authService=require(_0xac3b('0x13'));var qs=require(_0xac3b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xac3b('0x15'));var utils=require(_0xac3b('0x16'));var config=require(_0xac3b('0x17'));var licenseUtil=require(_0xac3b('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xac3b('0x19'));function respondWithStatusCode(_0x22abf7,_0x4328b9){_0x4328b9=_0x4328b9||0xcc;return function(_0x3d423c){if(_0x3d423c){return _0x22abf7['sendStatus'](_0x4328b9);}return _0x22abf7[_0xac3b('0x1a')](_0x4328b9)[_0xac3b('0x1b')]();};}function respondWithResult(_0x1dfa81,_0x4f87fa){_0x4f87fa=_0x4f87fa||0xc8;return function(_0x19637b){if(_0x19637b){return _0x1dfa81[_0xac3b('0x1a')](_0x4f87fa)[_0xac3b('0x1c')](_0x19637b);}};}function respondWithFilteredResult(_0x2016a3,_0x5e5fd0){return function(_0x2f32a8){if(_0x2f32a8){var _0x365d89=typeof _0x5e5fd0[_0xac3b('0x1d')]==='undefined'&&typeof _0x5e5fd0['limit']===_0xac3b('0x1e');var _0x30263e=_0x2f32a8[_0xac3b('0x1f')];var _0x5d8439=_0x365d89?0x0:_0x5e5fd0[_0xac3b('0x1d')];var _0x26a428=_0x365d89?_0x2f32a8[_0xac3b('0x1f')]:_0x5e5fd0[_0xac3b('0x1d')]+_0x5e5fd0['limit'];var _0x379f0a;if(_0x26a428>=_0x30263e){_0x26a428=_0x30263e;_0x379f0a=0xc8;}else{_0x379f0a=0xce;}_0x2016a3['status'](_0x379f0a);return _0x2016a3[_0xac3b('0x20')](_0xac3b('0x21'),_0x5d8439+'-'+_0x26a428+'/'+_0x30263e)[_0xac3b('0x1c')](_0x2f32a8);}return null;};}function patchUpdates(_0x3ebd14){return function(_0x40464d){try{jsonpatch[_0xac3b('0x22')](_0x40464d,_0x3ebd14,!![]);}catch(_0x48576c){return BPromise['reject'](_0x48576c);}return _0x40464d[_0xac3b('0x23')]();};}function saveUpdates(_0x169aff,_0x93c254){return function(_0x541cd2){if(_0x541cd2){return _0x541cd2[_0xac3b('0x24')](_0x169aff)[_0xac3b('0x25')](function(_0x573f08){return _0x573f08;});}return null;};}function removeEntity(_0x4bb7d7,_0xaba1b5){return function(_0x110530){if(_0x110530){return _0x110530[_0xac3b('0x26')]()[_0xac3b('0x25')](function(){_0x4bb7d7['status'](0xcc)[_0xac3b('0x1b')]();});}};}function handleEntityNotFound(_0x4a4d02,_0x5baf71){return function(_0x49c7c5){if(!_0x49c7c5){_0x4a4d02[_0xac3b('0x27')](0x194);}return _0x49c7c5;};}function handleError(_0x53a55b,_0x4b76e9){_0x4b76e9=_0x4b76e9||0x1f4;return function(_0x393a7d){logger[_0xac3b('0x28')](_0x393a7d[_0xac3b('0x29')]);if(_0x393a7d[_0xac3b('0x2a')]){delete _0x393a7d[_0xac3b('0x2a')];}_0x53a55b[_0xac3b('0x1a')](_0x4b76e9)[_0xac3b('0x2b')](_0x393a7d);};}exports[_0xac3b('0x2c')]=function(_0x137f63,_0x3d34cd){var _0xa28351={},_0x26527d={},_0x39156a={'count':0x0,'rows':[]};var _0x1ffde7=_[_0xac3b('0x2d')](db[_0xac3b('0x2e')][_0xac3b('0x2f')],function(_0x133c5f){return{'name':_0x133c5f[_0xac3b('0x30')],'type':_0x133c5f['type'][_0xac3b('0x31')]};});_0x26527d['model']=_['map'](_0x1ffde7,_0xac3b('0x2a'));_0x26527d[_0xac3b('0x32')]=_[_0xac3b('0x33')](_0x137f63[_0xac3b('0x32')]);_0x26527d[_0xac3b('0x34')]=_[_0xac3b('0x35')](_0x26527d[_0xac3b('0x36')],_0x26527d[_0xac3b('0x32')]);_0xa28351[_0xac3b('0x37')]=_[_0xac3b('0x35')](_0x26527d[_0xac3b('0x36')],qs['fields'](_0x137f63[_0xac3b('0x32')][_0xac3b('0x38')]));_0xa28351[_0xac3b('0x37')]=_0xa28351[_0xac3b('0x37')]['length']?_0xa28351[_0xac3b('0x37')]:_0x26527d['model'];if(!_0x137f63[_0xac3b('0x32')][_0xac3b('0x39')]('nolimit')){_0xa28351['limit']=qs[_0xac3b('0x3a')](_0x137f63[_0xac3b('0x32')][_0xac3b('0x3a')]);_0xa28351[_0xac3b('0x1d')]=qs[_0xac3b('0x1d')](_0x137f63[_0xac3b('0x32')]['offset']);}_0xa28351[_0xac3b('0x3b')]=qs[_0xac3b('0x3c')](_0x137f63[_0xac3b('0x32')][_0xac3b('0x3c')]);_0xa28351['where']=qs[_0xac3b('0x34')](_['pick'](_0x137f63[_0xac3b('0x32')],_0x26527d[_0xac3b('0x34')]),_0x1ffde7);if(_0x137f63[_0xac3b('0x32')]['filter']){_0xa28351[_0xac3b('0x3d')]=_['merge'](_0xa28351[_0xac3b('0x3d')],{'$or':_['map'](_0x1ffde7,function(_0x370594){if(_0x370594['type']!==_0xac3b('0x3e')){var _0x5f021e={};_0x5f021e[_0x370594[_0xac3b('0x2a')]]={'$like':'%'+_0x137f63['query'][_0xac3b('0x3f')]+'%'};return _0x5f021e;}})});}_0xa28351=_[_0xac3b('0x40')]({},_0xa28351,_0x137f63[_0xac3b('0x41')]);var _0x1aabc9={'where':_0xa28351[_0xac3b('0x3d')]};return db[_0xac3b('0x2e')][_0xac3b('0x1f')](_0x1aabc9)[_0xac3b('0x25')](function(_0x35325b){_0x39156a[_0xac3b('0x1f')]=_0x35325b;if(_0x137f63[_0xac3b('0x32')][_0xac3b('0x42')]){_0xa28351[_0xac3b('0x43')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xac3b('0x44')](_0xa28351);})[_0xac3b('0x25')](function(_0x513240){_0x39156a[_0xac3b('0x45')]=_0x513240;return _0x39156a;})[_0xac3b('0x25')](respondWithFilteredResult(_0x3d34cd,_0xa28351))[_0xac3b('0x46')](handleError(_0x3d34cd,null));};exports[_0xac3b('0x47')]=function(_0x35598f,_0x39d80f){var _0x537b26={'raw':![],'where':{'id':_0x35598f[_0xac3b('0x48')]['id']}},_0x267dee={};_0x267dee['model']=_[_0xac3b('0x33')](db['FreshsalesAccount'][_0xac3b('0x2f')]);_0x267dee[_0xac3b('0x32')]=_[_0xac3b('0x33')](_0x35598f['query']);_0x267dee['filters']=_[_0xac3b('0x35')](_0x267dee[_0xac3b('0x36')],_0x267dee[_0xac3b('0x32')]);_0x537b26['attributes']=_[_0xac3b('0x35')](_0x267dee['model'],qs['fields'](_0x35598f[_0xac3b('0x32')][_0xac3b('0x38')]));_0x537b26[_0xac3b('0x37')]=_0x537b26[_0xac3b('0x37')][_0xac3b('0x49')]?_0x537b26[_0xac3b('0x37')]:_0x267dee[_0xac3b('0x36')];if(_0x35598f[_0xac3b('0x32')][_0xac3b('0x42')]){_0x537b26[_0xac3b('0x43')]=[{'all':!![]}];}_0x537b26=_[_0xac3b('0x40')]({},_0x537b26,_0x35598f[_0xac3b('0x41')]);return db[_0xac3b('0x2e')][_0xac3b('0x4a')](_0x537b26)[_0xac3b('0x25')](handleEntityNotFound(_0x39d80f,null))[_0xac3b('0x25')](respondWithResult(_0x39d80f,null))[_0xac3b('0x46')](handleError(_0x39d80f,null));};exports[_0xac3b('0x4b')]=function(_0x25a418,_0x5a4579){return db[_0xac3b('0x2e')][_0xac3b('0x4b')](_0x25a418[_0xac3b('0x4c')],{})[_0xac3b('0x25')](respondWithResult(_0x5a4579,0xc9))[_0xac3b('0x46')](handleError(_0x5a4579,null));};exports[_0xac3b('0x24')]=function(_0x2e0e77,_0x248f9d){if(_0x2e0e77[_0xac3b('0x4c')]['id']){delete _0x2e0e77[_0xac3b('0x4c')]['id'];}return db[_0xac3b('0x2e')][_0xac3b('0x4a')]({'where':{'id':_0x2e0e77[_0xac3b('0x48')]['id']}})[_0xac3b('0x25')](handleEntityNotFound(_0x248f9d,null))[_0xac3b('0x25')](saveUpdates(_0x2e0e77[_0xac3b('0x4c')],null))['then'](respondWithResult(_0x248f9d,null))[_0xac3b('0x46')](handleError(_0x248f9d,null));};exports['destroy']=function(_0x4784ba,_0x41707f){return db[_0xac3b('0x2e')]['find']({'where':{'id':_0x4784ba[_0xac3b('0x48')]['id']}})['then'](handleEntityNotFound(_0x41707f,null))[_0xac3b('0x25')](removeEntity(_0x41707f,null))[_0xac3b('0x46')](handleError(_0x41707f,null));};exports[_0xac3b('0x4d')]=function(_0x361183,_0x6945cc,_0x23c861){var _0x23fc46={};var _0x3362af={};var _0x24160a;var _0x471094;return db[_0xac3b('0x2e')][_0xac3b('0x4e')]({'where':{'id':_0x361183[_0xac3b('0x48')]['id']}})[_0xac3b('0x25')](handleEntityNotFound(_0x6945cc,null))['then'](function(_0x38435e){if(_0x38435e){_0x24160a=_0x38435e;_0x3362af[_0xac3b('0x36')]=_[_0xac3b('0x33')](db[_0xac3b('0x4f')]['rawAttributes']);_0x3362af[_0xac3b('0x32')]=_['keys'](_0x361183[_0xac3b('0x32')]);_0x3362af['filters']=_[_0xac3b('0x35')](_0x3362af[_0xac3b('0x36')],_0x3362af[_0xac3b('0x32')]);_0x23fc46[_0xac3b('0x37')]=_['intersection'](_0x3362af['model'],qs['fields'](_0x361183[_0xac3b('0x32')][_0xac3b('0x38')]));_0x23fc46['attributes']=_0x23fc46['attributes']['length']?_0x23fc46[_0xac3b('0x37')]:_0x3362af['model'];_0x23fc46[_0xac3b('0x3b')]=qs[_0xac3b('0x3c')](_0x361183[_0xac3b('0x32')][_0xac3b('0x3c')]);_0x23fc46[_0xac3b('0x3d')]=qs[_0xac3b('0x34')](_['pick'](_0x361183[_0xac3b('0x32')],_0x3362af[_0xac3b('0x34')]));if(_0x361183[_0xac3b('0x32')][_0xac3b('0x3f')]){_0x23fc46[_0xac3b('0x3d')]=_[_0xac3b('0x40')](_0x23fc46[_0xac3b('0x3d')],{'$or':_['map'](_0x23fc46[_0xac3b('0x37')],function(_0x6fe771){var _0x1d8a10={};_0x1d8a10[_0x6fe771]={'$like':'%'+_0x361183['query'][_0xac3b('0x3f')]+'%'};return _0x1d8a10;})});}_0x23fc46=_[_0xac3b('0x40')]({},_0x23fc46,_0x361183[_0xac3b('0x41')]);return _0x24160a[_0xac3b('0x4d')](_0x23fc46);}})['then'](function(_0x3eb27c){if(_0x3eb27c){_0x471094=_0x3eb27c['length'];if(!_0x361183[_0xac3b('0x32')][_0xac3b('0x39')](_0xac3b('0x50'))){_0x23fc46[_0xac3b('0x3a')]=qs[_0xac3b('0x3a')](_0x361183[_0xac3b('0x32')]['limit']);_0x23fc46[_0xac3b('0x1d')]=qs[_0xac3b('0x1d')](_0x361183[_0xac3b('0x32')][_0xac3b('0x1d')]);}return _0x24160a[_0xac3b('0x4d')](_0x23fc46);}})[_0xac3b('0x25')](function(_0x173f5c){if(_0x173f5c){return _0x173f5c?{'count':_0x471094,'rows':_0x173f5c}:null;}})['then'](respondWithResult(_0x6945cc,null))['catch'](handleError(_0x6945cc,null));};exports['addConfiguration']=function(_0x297b1d,_0x4cb78a,_0x3c311d){if(_0x297b1d['body']['id']){delete _0x297b1d['body']['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x297b1d[_0xac3b('0x48')]['id']}})[_0xac3b('0x25')](handleEntityNotFound(_0x4cb78a,null))['then'](function(_0x1fbf07){if(_0x1fbf07){_0x297b1d[_0xac3b('0x4c')][_0xac3b('0x51')]=_0x1fbf07['id'];_0x297b1d['body'][_0xac3b('0x52')]=integrations[_0xac3b('0x53')](_0x297b1d['body']['channel'],_0x297b1d[_0xac3b('0x4c')][_0xac3b('0x54')]);_0x297b1d[_0xac3b('0x4c')][_0xac3b('0x55')]=integrations[_0xac3b('0x56')](_0x297b1d['body'][_0xac3b('0x57')],_0x297b1d['body']['type']);return db['FreshsalesConfiguration']['create'](_0x297b1d[_0xac3b('0x4c')],{'include':[{'model':db[_0xac3b('0x58')],'as':_0xac3b('0x52')},{'model':db[_0xac3b('0x58')],'as':_0xac3b('0x55')}]});}return null;})[_0xac3b('0x25')](respondWithResult(_0x4cb78a,null))[_0xac3b('0x46')](handleError(_0x4cb78a,null));};exports[_0xac3b('0x59')]=function(_0x5e7ef4,_0x4fe777,_0x26d565){var _0x249982='';var _0x22338b='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x5e7ef4[_0xac3b('0x48')]['id']},'attributes':['id',_0xac3b('0x5a'),_0xac3b('0x5b'),'apiKey']})[_0xac3b('0x25')](handleEntityNotFound(_0x4fe777,null))['then'](function(_0x3b01f4){if(_0x3b01f4){_0x22338b=_0x3b01f4[_0xac3b('0x5a')];_0x249982=_0x3b01f4[_0xac3b('0x5b')];var _0x3b1e43=_0x3b01f4[_0xac3b('0x5b')][_0xac3b('0x5c')](-0x1);if(_0x3b1e43==='/'){_0x249982=_0x249982[_0xac3b('0x5d')](0x0,_0x249982[_0xac3b('0x5e')](_0x3b1e43));}return rp({'method':'GET','uri':util['format'](_0xac3b('0x5f'),_0x249982,_0xac3b('0x60')),'headers':{'Authorization':'Token\x20token='+_0x3b01f4[_0xac3b('0x61')]},'json':!![]});}})[_0xac3b('0x25')](function(_0x4460ff){if(_0x4460ff){var _0x4a1eef=_0x4460ff[_0xac3b('0x62')];var _0xc6c95=![];var _0x3b39cd=null;for(_0x3b39cd=0x0;_0x3b39cd<_0x4a1eef[_0xac3b('0x49')];_0x3b39cd++){if(_0x4a1eef[_0x3b39cd][_0xac3b('0x63')]===_0x22338b){_0xc6c95=!![];}}if(_0xc6c95){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xac3b('0x64')});}}})['then'](respondWithResult(_0x4fe777,null))['catch'](function(_0x8cff22){var _0x229555=_0x5e7ef4[_0xac3b('0x32')]['test']?0x1f4:_0x8cff22[_0xac3b('0x65')]||0x1f4;logger[_0xac3b('0x28')](_0xac3b('0x66'),_0xac3b('0x59'),_0x229555,JSON[_0xac3b('0x67')](_0x8cff22));delete _0x8cff22['name'];if(_0x229555===0x191){_0x229555=0x190;}_0x4fe777[_0xac3b('0x1a')](_0x229555)[_0xac3b('0x2b')](_0x5e7ef4['query']['test']?{'message':_0xac3b('0x68'),'statusCode':_0x8cff22[_0xac3b('0x65')]}:_0x8cff22);});};
\ No newline at end of file
index d03c9f1..07e3a2b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xacf4=['define','FreshsalesAccount','int_freshsales_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x3693af,_0x134aae){var _0x1f0939=function(_0x1b2c1d){while(--_0x1b2c1d){_0x3693af['push'](_0x3693af['shift']());}};_0x1f0939(++_0x134aae);}(_0xacf4,0xe7));var _0x4acf=function(_0x309e30,_0x788f3){_0x309e30=_0x309e30-0x0;var _0x2f971f=_0xacf4[_0x309e30];return _0x2f971f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));var integrations=require(_0x4acf('0x8'));module['exports']=function(_0x24bf24,_0x2ba08a){return _0x24bf24[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xe3da=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x3535b6,_0x380589){var _0x11ec47=function(_0x64a99d){while(--_0x64a99d){_0x3535b6['push'](_0x3535b6['shift']());}};_0x11ec47(++_0x380589);}(_0xe3da,0x1cd));var _0xae3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe3da[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));var integrations=require(_0xae3d('0xb'));module[_0xae3d('0xc')]=function(_0xa54808,_0x476579){return _0xa54808[_0xae3d('0xd')]('FreshsalesAccount',attributes,{'tableName':_0xae3d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 06f567f..0f8c07d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7bd0=['limit','include','model','map','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','FreshsalesAccount','findAll','options','raw','where','attributes'];(function(_0x30fcd6,_0x290a7e){var _0x25531d=function(_0x30fe4f){while(--_0x30fe4f){_0x30fcd6['push'](_0x30fcd6['shift']());}};_0x25531d(++_0x290a7e);}(_0x7bd0,0x111));var _0x07bd=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0x7bd0[_0x7ad123];return _0x37d073;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('FreshsalesAccount,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});}exports['GetFreshsalesAccount']=function(_0x3f9f0b){var _0xc4cf4c=this;return new Promise(function(_0x4948f4,_0x3e8ec4){return db[_0x07bd('0x19')][_0x07bd('0x1a')]({'raw':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1d')]||null:null,'attributes':_0x3f9f0b['options']?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'limit':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1f')]||null:null,'include':_0x3f9f0b['options']?_0x3f9f0b['options'][_0x07bd('0x20')]?_['map'](_0x3f9f0b[_0x07bd('0x1b')]['include'],function(_0x50bd12){return{'model':db[_0x50bd12[_0x07bd('0x21')]],'as':_0x50bd12['as'],'attributes':_0x50bd12[_0x07bd('0x1e')],'include':_0x50bd12[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x50bd12[_0x07bd('0x20')],function(_0x43cbc8){return{'model':db[_0x43cbc8['model']],'as':_0x43cbc8['as'],'attributes':_0x43cbc8[_0x07bd('0x1e')],'include':_0x43cbc8[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x43cbc8[_0x07bd('0x20')],function(_0x12ce26){return{'model':db[_0x12ce26[_0x07bd('0x21')]],'as':_0x12ce26['as'],'attributes':_0x12ce26['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5184dc){logger[_0x07bd('0x17')](_0x07bd('0x23'),_0x3f9f0b);logger[_0x07bd('0x11')]('GetFreshsalesAccount',_0x3f9f0b,JSON[_0x07bd('0x13')](_0x5184dc));_0x4948f4(_0x5184dc);})[_0x07bd('0x18')](function(_0x253dc0){logger[_0x07bd('0x14')](_0x07bd('0x23'),_0x253dc0[_0x07bd('0x16')],_0x3f9f0b);_0x3e8ec4(_0xc4cf4c['error'](0x1f4,_0x253dc0[_0x07bd('0x16')]));});});};exports[_0x07bd('0x24')]=function(_0x4182b9){var _0x321200=this;return new Promise(function(_0x1b6cc,_0x314bda){return db[_0x07bd('0x19')][_0x07bd('0x25')]({'raw':_0x4182b9['options']?_0x4182b9['options'][_0x07bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x4182b9[_0x07bd('0x1b')]?_0x4182b9[_0x07bd('0x1b')]['where']||null:null,'attributes':_0x4182b9[_0x07bd('0x1b')]?_0x4182b9[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'include':_0x4182b9['options']?_0x4182b9['options'][_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x4182b9[_0x07bd('0x1b')][_0x07bd('0x20')],function(_0x5f29c5){return{'model':db[_0x5f29c5[_0x07bd('0x21')]],'as':_0x5f29c5['as'],'attributes':_0x5f29c5[_0x07bd('0x1e')],'include':_0x5f29c5[_0x07bd('0x20')]?_['map'](_0x5f29c5[_0x07bd('0x20')],function(_0x31c381){return{'model':db[_0x31c381['model']],'as':_0x31c381['as'],'attributes':_0x31c381[_0x07bd('0x1e')],'include':_0x31c381[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x31c381[_0x07bd('0x20')],function(_0x5cde8d){return{'model':db[_0x5cde8d['model']],'as':_0x5cde8d['as'],'attributes':_0x5cde8d[_0x07bd('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c2878){logger[_0x07bd('0x17')](_0x07bd('0x24'),_0x4182b9);logger[_0x07bd('0x11')](_0x07bd('0x24'),_0x4182b9,JSON[_0x07bd('0x13')](_0x3c2878));_0x1b6cc(_0x3c2878);})[_0x07bd('0x18')](function(_0x333ac2){logger[_0x07bd('0x14')](_0x07bd('0x24'),_0x333ac2[_0x07bd('0x16')],_0x4182b9);_0x314bda(_0x321200[_0x07bd('0x14')](0x1f4,_0x333ac2[_0x07bd('0x16')]));});});};
\ No newline at end of file
+var _0x7bd0=['limit','include','model','map','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','FreshsalesAccount','findAll','options','raw','where','attributes'];(function(_0x391eb3,_0x2b3fe2){var _0x108fdc=function(_0x21e9b7){while(--_0x21e9b7){_0x391eb3['push'](_0x391eb3['shift']());}};_0x108fdc(++_0x2b3fe2);}(_0x7bd0,0x111));var _0x07bd=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x7bd0[_0x2e8418];return _0x548fe6;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('FreshsalesAccount,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});}exports['GetFreshsalesAccount']=function(_0x3f9f0b){var _0xc4cf4c=this;return new Promise(function(_0x4948f4,_0x3e8ec4){return db[_0x07bd('0x19')][_0x07bd('0x1a')]({'raw':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1d')]||null:null,'attributes':_0x3f9f0b['options']?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'limit':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1f')]||null:null,'include':_0x3f9f0b['options']?_0x3f9f0b['options'][_0x07bd('0x20')]?_['map'](_0x3f9f0b[_0x07bd('0x1b')]['include'],function(_0x50bd12){return{'model':db[_0x50bd12[_0x07bd('0x21')]],'as':_0x50bd12['as'],'attributes':_0x50bd12[_0x07bd('0x1e')],'include':_0x50bd12[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x50bd12[_0x07bd('0x20')],function(_0x43cbc8){return{'model':db[_0x43cbc8['model']],'as':_0x43cbc8['as'],'attributes':_0x43cbc8[_0x07bd('0x1e')],'include':_0x43cbc8[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x43cbc8[_0x07bd('0x20')],function(_0x12ce26){return{'model':db[_0x12ce26[_0x07bd('0x21')]],'as':_0x12ce26['as'],'attributes':_0x12ce26['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5184dc){logger[_0x07bd('0x17')](_0x07bd('0x23'),_0x3f9f0b);logger[_0x07bd('0x11')]('GetFreshsalesAccount',_0x3f9f0b,JSON[_0x07bd('0x13')](_0x5184dc));_0x4948f4(_0x5184dc);})[_0x07bd('0x18')](function(_0x253dc0){logger[_0x07bd('0x14')](_0x07bd('0x23'),_0x253dc0[_0x07bd('0x16')],_0x3f9f0b);_0x3e8ec4(_0xc4cf4c['error'](0x1f4,_0x253dc0[_0x07bd('0x16')]));});});};exports[_0x07bd('0x24')]=function(_0x4182b9){var _0x321200=this;return new Promise(function(_0x1b6cc,_0x314bda){return db[_0x07bd('0x19')][_0x07bd('0x25')]({'raw':_0x4182b9['options']?_0x4182b9['options'][_0x07bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x4182b9[_0x07bd('0x1b')]?_0x4182b9[_0x07bd('0x1b')]['where']||null:null,'attributes':_0x4182b9[_0x07bd('0x1b')]?_0x4182b9[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'include':_0x4182b9['options']?_0x4182b9['options'][_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x4182b9[_0x07bd('0x1b')][_0x07bd('0x20')],function(_0x5f29c5){return{'model':db[_0x5f29c5[_0x07bd('0x21')]],'as':_0x5f29c5['as'],'attributes':_0x5f29c5[_0x07bd('0x1e')],'include':_0x5f29c5[_0x07bd('0x20')]?_['map'](_0x5f29c5[_0x07bd('0x20')],function(_0x31c381){return{'model':db[_0x31c381['model']],'as':_0x31c381['as'],'attributes':_0x31c381[_0x07bd('0x1e')],'include':_0x31c381[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x31c381[_0x07bd('0x20')],function(_0x5cde8d){return{'model':db[_0x5cde8d['model']],'as':_0x5cde8d['as'],'attributes':_0x5cde8d[_0x07bd('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c2878){logger[_0x07bd('0x17')](_0x07bd('0x24'),_0x4182b9);logger[_0x07bd('0x11')](_0x07bd('0x24'),_0x4182b9,JSON[_0x07bd('0x13')](_0x3c2878));_0x1b6cc(_0x3c2878);})[_0x07bd('0x18')](function(_0x333ac2){logger[_0x07bd('0x14')](_0x07bd('0x24'),_0x333ac2[_0x07bd('0x16')],_0x4182b9);_0x314bda(_0x321200[_0x07bd('0x14')](0x1f4,_0x333ac2[_0x07bd('0x16')]));});});};
\ No newline at end of file
index 82b8f9c..a39b068 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0ef8=['index','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated'];(function(_0x1cf0e1,_0x2e37b7){var _0x53f2d2=function(_0x5ba296){while(--_0x5ba296){_0x1cf0e1['push'](_0x1cf0e1['shift']());}};_0x53f2d2(++_0x2e37b7);}(_0x0ef8,0x140));var _0x80ef=function(_0x22332f,_0x3e688d){_0x22332f=_0x22332f-0x0;var _0x137154=_0x0ef8[_0x22332f];return _0x137154;};'use strict';var multer=require(_0x80ef('0x0'));var util=require(_0x80ef('0x1'));var path=require('path');var timeout=require(_0x80ef('0x2'));var express=require(_0x80ef('0x3'));var router=express[_0x80ef('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x80ef('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x80ef('0x6'));var controller=require(_0x80ef('0x7'));router[_0x80ef('0x8')]('/',auth[_0x80ef('0x9')](),controller[_0x80ef('0xa')]);router[_0x80ef('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x80ef('0xb')]);router[_0x80ef('0x8')](_0x80ef('0xc'),auth['isAuthenticated'](),controller[_0x80ef('0xd')]);router['get']('/:id/descriptions',auth[_0x80ef('0x9')](),controller[_0x80ef('0xe')]);router[_0x80ef('0x8')](_0x80ef('0xf'),auth[_0x80ef('0x9')](),controller[_0x80ef('0x10')]);router['post']('/',auth[_0x80ef('0x9')](),controller['create']);router[_0x80ef('0x11')](_0x80ef('0x12'),auth[_0x80ef('0x9')](),controller['update']);router[_0x80ef('0x13')](_0x80ef('0x12'),auth[_0x80ef('0x9')](),controller[_0x80ef('0x14')]);module[_0x80ef('0x15')]=router;
\ No newline at end of file
+var _0x51a3=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','index','/:id','isAuthenticated','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update'];(function(_0x4f7f3e,_0x243a44){var _0x266a5a=function(_0x3bb48d){while(--_0x3bb48d){_0x4f7f3e['push'](_0x4f7f3e['shift']());}};_0x266a5a(++_0x243a44);}(_0x51a3,0x7b));var _0x351a=function(_0x29d51d,_0x203d98){_0x29d51d=_0x29d51d-0x0;var _0x2d2b00=_0x51a3[_0x29d51d];return _0x2d2b00;};'use strict';var multer=require(_0x351a('0x0'));var util=require(_0x351a('0x1'));var path=require(_0x351a('0x2'));var timeout=require(_0x351a('0x3'));var express=require(_0x351a('0x4'));var router=express[_0x351a('0x5')]();var fs_extra=require(_0x351a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x351a('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x351a('0x8')]('/',auth['isAuthenticated'](),controller[_0x351a('0x9')]);router['get'](_0x351a('0xa'),auth[_0x351a('0xb')](),controller['show']);router['get'](_0x351a('0xc'),auth[_0x351a('0xb')](),controller['getSubjects']);router[_0x351a('0x8')](_0x351a('0xd'),auth[_0x351a('0xb')](),controller[_0x351a('0xe')]);router['get'](_0x351a('0xf'),auth[_0x351a('0xb')](),controller[_0x351a('0x10')]);router[_0x351a('0x11')]('/',auth['isAuthenticated'](),controller[_0x351a('0x12')]);router[_0x351a('0x13')](_0x351a('0xa'),auth[_0x351a('0xb')](),controller[_0x351a('0x14')]);router[_0x351a('0x15')](_0x351a('0xa'),auth['isAuthenticated'](),controller[_0x351a('0x16')]);module[_0x351a('0x17')]=router;
\ No newline at end of file
index 9086b96..5e09ebe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xce28=['sequelize','exports','STRING'];(function(_0x465e03,_0x1baeaa){var _0x39feb3=function(_0x1e33b9){while(--_0x1e33b9){_0x465e03['push'](_0x465e03['shift']());}};_0x39feb3(++_0x1baeaa);}(_0xce28,0x78));var _0x8ce2=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xce28[_0x1da527];return _0x40fc7c;};'use strict';var Sequelize=require(_0x8ce2('0x0'));module[_0x8ce2('0x1')]={'name':{'type':Sequelize[_0x8ce2('0x2')]},'description':{'type':Sequelize[_0x8ce2('0x2')]}};
\ No newline at end of file
+var _0x2fc9=['sequelize','STRING'];(function(_0x31917d,_0x2eaebb){var _0x229b43=function(_0xb08744){while(--_0xb08744){_0x31917d['push'](_0x31917d['shift']());}};_0x229b43(++_0x2eaebb);}(_0x2fc9,0x158));var _0x92fc=function(_0x3124f8,_0x1a8b23){_0x3124f8=_0x3124f8-0x0;var _0x5bab5f=_0x2fc9[_0x3124f8];return _0x5bab5f;};'use strict';var Sequelize=require(_0x92fc('0x0'));module['exports']={'name':{'type':Sequelize[_0x92fc('0x1')]},'description':{'type':Sequelize[_0x92fc('0x1')]}};
\ No newline at end of file
index a42f4b0..feabaac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x88f5=['end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FreshsalesConfiguration','includeAll','include','rows','catch','params','find','create','body','destroy','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status'];(function(_0x47a12a,_0x70f591){var _0x30cd40=function(_0x46b68f){while(--_0x46b68f){_0x47a12a['push'](_0x47a12a['shift']());}};_0x30cd40(++_0x70f591);}(_0x88f5,0x165));var _0x588f=function(_0x4abf55,_0x323282){_0x4abf55=_0x4abf55-0x0;var _0x83b275=_0x88f5[_0x4abf55];return _0x83b275;};'use strict';var emlformat=require(_0x588f('0x0'));var rimraf=require(_0x588f('0x1'));var zipdir=require(_0x588f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x588f('0x3'));var moment=require(_0x588f('0x4'));var BPromise=require(_0x588f('0x5'));var Mustache=require(_0x588f('0x6'));var util=require('util');var path=require(_0x588f('0x7'));var sox=require(_0x588f('0x8'));var csv=require(_0x588f('0x9'));var ejs=require(_0x588f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x588f('0xb'));var squel=require('squel');var crypto=require(_0x588f('0xc'));var jsforce=require(_0x588f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x588f('0x9'));var querystring=require(_0x588f('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x588f('0xf'));var qs=require(_0x588f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x588f('0x11'));var logger=require(_0x588f('0x12'))(_0x588f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x588f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5248c4,_0xae0dd0){_0xae0dd0=_0xae0dd0||0xcc;return function(_0xdebf78){if(_0xdebf78){return _0x5248c4[_0x588f('0x15')](_0xae0dd0);}return _0x5248c4[_0x588f('0x16')](_0xae0dd0)[_0x588f('0x17')]();};}function respondWithResult(_0x5c88df,_0x17c388){_0x17c388=_0x17c388||0xc8;return function(_0x5cd8f4){if(_0x5cd8f4){return _0x5c88df[_0x588f('0x16')](_0x17c388)[_0x588f('0x18')](_0x5cd8f4);}};}function respondWithFilteredResult(_0x2fac03,_0x4f5c4b){return function(_0x4e7cac){if(_0x4e7cac){var _0x9b935d=typeof _0x4f5c4b['offset']===_0x588f('0x19')&&typeof _0x4f5c4b['limit']===_0x588f('0x19');var _0x27613c=_0x4e7cac['count'];var _0x19387d=_0x9b935d?0x0:_0x4f5c4b[_0x588f('0x1a')];var _0x1b93d3=_0x9b935d?_0x4e7cac[_0x588f('0x1b')]:_0x4f5c4b[_0x588f('0x1a')]+_0x4f5c4b[_0x588f('0x1c')];var _0x168b01;if(_0x1b93d3>=_0x27613c){_0x1b93d3=_0x27613c;_0x168b01=0xc8;}else{_0x168b01=0xce;}_0x2fac03[_0x588f('0x16')](_0x168b01);return _0x2fac03[_0x588f('0x1d')](_0x588f('0x1e'),_0x19387d+'-'+_0x1b93d3+'/'+_0x27613c)[_0x588f('0x18')](_0x4e7cac);}return null;};}function patchUpdates(_0x2d275c){return function(_0x118e70){try{jsonpatch[_0x588f('0x1f')](_0x118e70,_0x2d275c,!![]);}catch(_0x10c457){return BPromise[_0x588f('0x20')](_0x10c457);}return _0x118e70[_0x588f('0x21')]();};}function saveUpdates(_0x50aa72,_0x22f9c2){return function(_0x5ebf38){if(_0x5ebf38){return _0x5ebf38[_0x588f('0x22')](_0x50aa72)[_0x588f('0x23')](function(_0x302f55){return _0x302f55;});}return null;};}function removeEntity(_0x306705,_0x4cacee){return function(_0x84669a){if(_0x84669a){return _0x84669a['destroy']()['then'](function(){_0x306705['status'](0xcc)[_0x588f('0x17')]();});}};}function handleEntityNotFound(_0x32b48f,_0x3e9e75){return function(_0x1baad9){if(!_0x1baad9){_0x32b48f[_0x588f('0x15')](0x194);}return _0x1baad9;};}function handleError(_0x418dcc,_0x138971){_0x138971=_0x138971||0x1f4;return function(_0xc6faf1){logger['error'](_0xc6faf1[_0x588f('0x24')]);if(_0xc6faf1['name']){delete _0xc6faf1[_0x588f('0x25')];}_0x418dcc['status'](_0x138971)['send'](_0xc6faf1);};}exports[_0x588f('0x26')]=function(_0x23449c,_0x5f323c){var _0x3bc9c4={},_0x7a1b80={},_0x38e910={'count':0x0,'rows':[]};var _0x4445dd=_[_0x588f('0x27')](db['FreshsalesConfiguration'][_0x588f('0x28')],function(_0x5436cf){return{'name':_0x5436cf[_0x588f('0x29')],'type':_0x5436cf[_0x588f('0x2a')][_0x588f('0x2b')]};});_0x7a1b80[_0x588f('0x2c')]=_[_0x588f('0x27')](_0x4445dd,_0x588f('0x25'));_0x7a1b80[_0x588f('0x2d')]=_[_0x588f('0x2e')](_0x23449c[_0x588f('0x2d')]);_0x7a1b80[_0x588f('0x2f')]=_[_0x588f('0x30')](_0x7a1b80[_0x588f('0x2c')],_0x7a1b80[_0x588f('0x2d')]);_0x3bc9c4['attributes']=_[_0x588f('0x30')](_0x7a1b80[_0x588f('0x2c')],qs['fields'](_0x23449c[_0x588f('0x2d')][_0x588f('0x31')]));_0x3bc9c4[_0x588f('0x32')]=_0x3bc9c4[_0x588f('0x32')][_0x588f('0x33')]?_0x3bc9c4[_0x588f('0x32')]:_0x7a1b80[_0x588f('0x2c')];if(!_0x23449c[_0x588f('0x2d')][_0x588f('0x34')](_0x588f('0x35'))){_0x3bc9c4['limit']=qs[_0x588f('0x1c')](_0x23449c[_0x588f('0x2d')]['limit']);_0x3bc9c4[_0x588f('0x1a')]=qs[_0x588f('0x1a')](_0x23449c[_0x588f('0x2d')][_0x588f('0x1a')]);}_0x3bc9c4[_0x588f('0x36')]=qs[_0x588f('0x37')](_0x23449c[_0x588f('0x2d')]['sort']);_0x3bc9c4[_0x588f('0x38')]=qs[_0x588f('0x2f')](_[_0x588f('0x39')](_0x23449c[_0x588f('0x2d')],_0x7a1b80[_0x588f('0x2f')]),_0x4445dd);if(_0x23449c[_0x588f('0x2d')]['filter']){_0x3bc9c4[_0x588f('0x38')]=_['merge'](_0x3bc9c4['where'],{'$or':_[_0x588f('0x27')](_0x4445dd,function(_0x57e6d2){if(_0x57e6d2[_0x588f('0x2a')]!=='VIRTUAL'){var _0x9bb989={};_0x9bb989[_0x57e6d2[_0x588f('0x25')]]={'$like':'%'+_0x23449c[_0x588f('0x2d')][_0x588f('0x3a')]+'%'};return _0x9bb989;}})});}_0x3bc9c4=_[_0x588f('0x3b')]({},_0x3bc9c4,_0x23449c[_0x588f('0x3c')]);var _0x4aa46f={'where':_0x3bc9c4['where']};return db[_0x588f('0x3d')][_0x588f('0x1b')](_0x4aa46f)['then'](function(_0x15e649){_0x38e910[_0x588f('0x1b')]=_0x15e649;if(_0x23449c['query'][_0x588f('0x3e')]){_0x3bc9c4[_0x588f('0x3f')]=[{'all':!![]}];}return db[_0x588f('0x3d')]['findAll'](_0x3bc9c4);})[_0x588f('0x23')](function(_0x3f3f1b){_0x38e910[_0x588f('0x40')]=_0x3f3f1b;return _0x38e910;})[_0x588f('0x23')](respondWithFilteredResult(_0x5f323c,_0x3bc9c4))[_0x588f('0x41')](handleError(_0x5f323c,null));};exports['show']=function(_0x3f44d5,_0x4767cd){var _0x211d7e={'raw':![],'where':{'id':_0x3f44d5[_0x588f('0x42')]['id']}},_0x1fa5d9={};_0x1fa5d9[_0x588f('0x2c')]=_['keys'](db['FreshsalesConfiguration'][_0x588f('0x28')]);_0x1fa5d9[_0x588f('0x2d')]=_[_0x588f('0x2e')](_0x3f44d5[_0x588f('0x2d')]);_0x1fa5d9[_0x588f('0x2f')]=_[_0x588f('0x30')](_0x1fa5d9[_0x588f('0x2c')],_0x1fa5d9[_0x588f('0x2d')]);_0x211d7e[_0x588f('0x32')]=_[_0x588f('0x30')](_0x1fa5d9[_0x588f('0x2c')],qs[_0x588f('0x31')](_0x3f44d5['query']['fields']));_0x211d7e[_0x588f('0x32')]=_0x211d7e[_0x588f('0x32')][_0x588f('0x33')]?_0x211d7e[_0x588f('0x32')]:_0x1fa5d9[_0x588f('0x2c')];if(_0x3f44d5[_0x588f('0x2d')][_0x588f('0x3e')]){_0x211d7e[_0x588f('0x3f')]=[{'all':!![]}];}_0x211d7e=_[_0x588f('0x3b')]({},_0x211d7e,_0x3f44d5[_0x588f('0x3c')]);return db['FreshsalesConfiguration'][_0x588f('0x43')](_0x211d7e)[_0x588f('0x23')](handleEntityNotFound(_0x4767cd,null))['then'](respondWithResult(_0x4767cd,null))[_0x588f('0x41')](handleError(_0x4767cd,null));};exports[_0x588f('0x44')]=function(_0x49cd59,_0x52e636){return db[_0x588f('0x3d')][_0x588f('0x44')](_0x49cd59[_0x588f('0x45')],{})[_0x588f('0x23')](respondWithResult(_0x52e636,0xc9))[_0x588f('0x41')](handleError(_0x52e636,null));};exports[_0x588f('0x22')]=function(_0x2a20d6,_0x304089){if(_0x2a20d6['body']['id']){delete _0x2a20d6[_0x588f('0x45')]['id'];}return db['FreshsalesConfiguration'][_0x588f('0x43')]({'where':{'id':_0x2a20d6[_0x588f('0x42')]['id']}})[_0x588f('0x23')](handleEntityNotFound(_0x304089,null))['then'](saveUpdates(_0x2a20d6[_0x588f('0x45')],null))['then'](respondWithResult(_0x304089,null))['catch'](handleError(_0x304089,null));};exports[_0x588f('0x46')]=function(_0x259d69,_0xc8bde){return db[_0x588f('0x3d')][_0x588f('0x43')]({'where':{'id':_0x259d69[_0x588f('0x42')]['id']}})[_0x588f('0x23')](handleEntityNotFound(_0xc8bde,null))[_0x588f('0x23')](removeEntity(_0xc8bde,null))[_0x588f('0x41')](handleError(_0xc8bde,null));};exports[_0x588f('0x47')]=function(_0x28cb6b,_0x27be1c,_0x40deaa){var _0x4420e0={};var _0x35740c={};var _0x42a340;var _0x45010a;return db[_0x588f('0x3d')][_0x588f('0x48')]({'where':{'id':_0x28cb6b[_0x588f('0x42')]['id']}})['then'](handleEntityNotFound(_0x27be1c,null))[_0x588f('0x23')](function(_0x3af889){if(_0x3af889){_0x42a340=_0x3af889;_0x35740c[_0x588f('0x2c')]=_['keys'](db[_0x588f('0x49')]['rawAttributes']);_0x35740c[_0x588f('0x2d')]=_['keys'](_0x28cb6b[_0x588f('0x2d')]);_0x35740c[_0x588f('0x2f')]=_[_0x588f('0x30')](_0x35740c[_0x588f('0x2c')],_0x35740c['query']);_0x4420e0[_0x588f('0x32')]=_[_0x588f('0x30')](_0x35740c[_0x588f('0x2c')],qs[_0x588f('0x31')](_0x28cb6b[_0x588f('0x2d')][_0x588f('0x31')]));_0x4420e0['attributes']=_0x4420e0['attributes'][_0x588f('0x33')]?_0x4420e0[_0x588f('0x32')]:_0x35740c[_0x588f('0x2c')];_0x4420e0[_0x588f('0x36')]=qs[_0x588f('0x37')](_0x28cb6b['query'][_0x588f('0x37')]);_0x4420e0[_0x588f('0x38')]=qs['filters'](_['pick'](_0x28cb6b[_0x588f('0x2d')],_0x35740c[_0x588f('0x2f')]));if(_0x28cb6b[_0x588f('0x2d')][_0x588f('0x3a')]){_0x4420e0[_0x588f('0x38')]=_['merge'](_0x4420e0['where'],{'$or':_[_0x588f('0x27')](_0x4420e0[_0x588f('0x32')],function(_0x36697c){var _0xeb7593={};_0xeb7593[_0x36697c]={'$like':'%'+_0x28cb6b['query']['filter']+'%'};return _0xeb7593;})});}_0x4420e0=_['merge']({},_0x4420e0,_0x28cb6b[_0x588f('0x3c')]);return _0x42a340[_0x588f('0x47')](_0x4420e0);}})['then'](function(_0x24aef5){if(_0x24aef5){_0x45010a=_0x24aef5[_0x588f('0x33')];if(!_0x28cb6b[_0x588f('0x2d')][_0x588f('0x34')](_0x588f('0x35'))){_0x4420e0[_0x588f('0x1c')]=qs['limit'](_0x28cb6b['query']['limit']);_0x4420e0['offset']=qs[_0x588f('0x1a')](_0x28cb6b['query'][_0x588f('0x1a')]);}return _0x42a340[_0x588f('0x47')](_0x4420e0);}})['then'](function(_0x14fa6b){if(_0x14fa6b){return _0x14fa6b?{'count':_0x45010a,'rows':_0x14fa6b}:null;}})[_0x588f('0x23')](respondWithResult(_0x27be1c,null))[_0x588f('0x41')](handleError(_0x27be1c,null));};exports[_0x588f('0x4a')]=function(_0x623458,_0x456ff7,_0x60f1ce){var _0x5004b4={};var _0x212e18={};var _0x284a44;var _0x2be071;return db[_0x588f('0x3d')]['findOne']({'where':{'id':_0x623458[_0x588f('0x42')]['id']}})[_0x588f('0x23')](handleEntityNotFound(_0x456ff7,null))[_0x588f('0x23')](function(_0x1d45e2){if(_0x1d45e2){_0x284a44=_0x1d45e2;_0x212e18[_0x588f('0x2c')]=_[_0x588f('0x2e')](db[_0x588f('0x49')][_0x588f('0x28')]);_0x212e18[_0x588f('0x2d')]=_[_0x588f('0x2e')](_0x623458[_0x588f('0x2d')]);_0x212e18[_0x588f('0x2f')]=_[_0x588f('0x30')](_0x212e18[_0x588f('0x2c')],_0x212e18['query']);_0x5004b4[_0x588f('0x32')]=_[_0x588f('0x30')](_0x212e18[_0x588f('0x2c')],qs[_0x588f('0x31')](_0x623458[_0x588f('0x2d')][_0x588f('0x31')]));_0x5004b4[_0x588f('0x32')]=_0x5004b4[_0x588f('0x32')][_0x588f('0x33')]?_0x5004b4['attributes']:_0x212e18[_0x588f('0x2c')];_0x5004b4[_0x588f('0x36')]=qs[_0x588f('0x37')](_0x623458['query']['sort']);_0x5004b4['where']=qs[_0x588f('0x2f')](_['pick'](_0x623458['query'],_0x212e18['filters']));if(_0x623458[_0x588f('0x2d')]['filter']){_0x5004b4[_0x588f('0x38')]=_[_0x588f('0x3b')](_0x5004b4['where'],{'$or':_[_0x588f('0x27')](_0x5004b4['attributes'],function(_0x270cd9){var _0x106c1b={};_0x106c1b[_0x270cd9]={'$like':'%'+_0x623458[_0x588f('0x2d')]['filter']+'%'};return _0x106c1b;})});}_0x5004b4=_[_0x588f('0x3b')]({},_0x5004b4,_0x623458['options']);return _0x284a44[_0x588f('0x4a')](_0x5004b4);}})[_0x588f('0x23')](function(_0x532da1){if(_0x532da1){_0x2be071=_0x532da1['length'];if(!_0x623458[_0x588f('0x2d')]['hasOwnProperty']('nolimit')){_0x5004b4['limit']=qs[_0x588f('0x1c')](_0x623458[_0x588f('0x2d')][_0x588f('0x1c')]);_0x5004b4[_0x588f('0x1a')]=qs[_0x588f('0x1a')](_0x623458[_0x588f('0x2d')][_0x588f('0x1a')]);}return _0x284a44[_0x588f('0x4a')](_0x5004b4);}})[_0x588f('0x23')](function(_0x4c280d){if(_0x4c280d){return _0x4c280d?{'count':_0x2be071,'rows':_0x4c280d}:null;}})[_0x588f('0x23')](respondWithResult(_0x456ff7,null))[_0x588f('0x41')](handleError(_0x456ff7,null));};exports[_0x588f('0x4b')]=function(_0x55f244,_0x572ce9,_0x13daa7){var _0x202f38={};var _0x352e8f={};var _0x40a0fb;var _0x5a6237;return db[_0x588f('0x3d')][_0x588f('0x48')]({'where':{'id':_0x55f244[_0x588f('0x42')]['id']}})[_0x588f('0x23')](handleEntityNotFound(_0x572ce9,null))[_0x588f('0x23')](function(_0x1b0f16){if(_0x1b0f16){_0x40a0fb=_0x1b0f16;_0x352e8f[_0x588f('0x2c')]=_[_0x588f('0x2e')](db[_0x588f('0x49')][_0x588f('0x28')]);_0x352e8f[_0x588f('0x2d')]=_[_0x588f('0x2e')](_0x55f244[_0x588f('0x2d')]);_0x352e8f[_0x588f('0x2f')]=_[_0x588f('0x30')](_0x352e8f['model'],_0x352e8f['query']);_0x202f38[_0x588f('0x32')]=_[_0x588f('0x30')](_0x352e8f['model'],qs[_0x588f('0x31')](_0x55f244['query'][_0x588f('0x31')]));_0x202f38[_0x588f('0x32')]=_0x202f38['attributes'][_0x588f('0x33')]?_0x202f38[_0x588f('0x32')]:_0x352e8f[_0x588f('0x2c')];_0x202f38[_0x588f('0x36')]=qs[_0x588f('0x37')](_0x55f244[_0x588f('0x2d')][_0x588f('0x37')]);_0x202f38[_0x588f('0x38')]=qs[_0x588f('0x2f')](_[_0x588f('0x39')](_0x55f244[_0x588f('0x2d')],_0x352e8f[_0x588f('0x2f')]));if(_0x55f244[_0x588f('0x2d')][_0x588f('0x3a')]){_0x202f38[_0x588f('0x38')]=_['merge'](_0x202f38[_0x588f('0x38')],{'$or':_[_0x588f('0x27')](_0x202f38['attributes'],function(_0x59935f){var _0x4c9594={};_0x4c9594[_0x59935f]={'$like':'%'+_0x55f244[_0x588f('0x2d')]['filter']+'%'};return _0x4c9594;})});}_0x202f38=_[_0x588f('0x3b')]({},_0x202f38,_0x55f244[_0x588f('0x3c')]);return _0x40a0fb[_0x588f('0x4b')](_0x202f38);}})[_0x588f('0x23')](function(_0x1c90d4){if(_0x1c90d4){_0x5a6237=_0x1c90d4[_0x588f('0x33')];if(!_0x55f244[_0x588f('0x2d')]['hasOwnProperty'](_0x588f('0x35'))){_0x202f38[_0x588f('0x1c')]=qs[_0x588f('0x1c')](_0x55f244['query'][_0x588f('0x1c')]);_0x202f38[_0x588f('0x1a')]=qs['offset'](_0x55f244[_0x588f('0x2d')][_0x588f('0x1a')]);}return _0x40a0fb[_0x588f('0x4b')](_0x202f38);}})[_0x588f('0x23')](function(_0xc54570){if(_0xc54570){return _0xc54570?{'count':_0x5a6237,'rows':_0xc54570}:null;}})['then'](respondWithResult(_0x572ce9,null))[_0x588f('0x41')](handleError(_0x572ce9,null));};
\ No newline at end of file
+var _0x1b9c=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','index','map','FreshsalesConfiguration','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','rawAttributes','find','create','body','params','getSubjects','getDescriptions','findOne','FreshsalesField','getFields','nolimit'];(function(_0x662a05,_0x541cc5){var _0x421218=function(_0x18be53){while(--_0x18be53){_0x662a05['push'](_0x662a05['shift']());}};_0x421218(++_0x541cc5);}(_0x1b9c,0x195));var _0xc1b9=function(_0x4387db,_0x1dcc89){_0x4387db=_0x4387db-0x0;var _0x57723e=_0x1b9c[_0x4387db];return _0x57723e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1b9('0x0'));var zipdir=require(_0xc1b9('0x1'));var jsonpatch=require(_0xc1b9('0x2'));var rp=require(_0xc1b9('0x3'));var moment=require(_0xc1b9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1b9('0x5'));var util=require(_0xc1b9('0x6'));var path=require('path');var sox=require(_0xc1b9('0x7'));var csv=require(_0xc1b9('0x8'));var ejs=require(_0xc1b9('0x9'));var fs=require('fs');var fs_extra=require(_0xc1b9('0xa'));var _=require(_0xc1b9('0xb'));var squel=require(_0xc1b9('0xc'));var crypto=require(_0xc1b9('0xd'));var jsforce=require(_0xc1b9('0xe'));var deskjs=require(_0xc1b9('0xf'));var toCsv=require(_0xc1b9('0x8'));var querystring=require(_0xc1b9('0x10'));var Papa=require(_0xc1b9('0x11'));var Redis=require(_0xc1b9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc1b9('0x13'));var as=require(_0xc1b9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1b9('0x15'))(_0xc1b9('0x16'));var utils=require(_0xc1b9('0x17'));var config=require(_0xc1b9('0x18'));var licenseUtil=require(_0xc1b9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d8fa2,_0x3f31b2){_0x3f31b2=_0x3f31b2||0xcc;return function(_0xf316fc){if(_0xf316fc){return _0x2d8fa2[_0xc1b9('0x1a')](_0x3f31b2);}return _0x2d8fa2[_0xc1b9('0x1b')](_0x3f31b2)['end']();};}function respondWithResult(_0x12ec16,_0x85fedf){_0x85fedf=_0x85fedf||0xc8;return function(_0x446041){if(_0x446041){return _0x12ec16['status'](_0x85fedf)[_0xc1b9('0x1c')](_0x446041);}};}function respondWithFilteredResult(_0x4691f1,_0x11b271){return function(_0x398f17){if(_0x398f17){var _0x2514d5=typeof _0x11b271['offset']===_0xc1b9('0x1d')&&typeof _0x11b271['limit']===_0xc1b9('0x1d');var _0x5123e3=_0x398f17[_0xc1b9('0x1e')];var _0x479b50=_0x2514d5?0x0:_0x11b271['offset'];var _0x3ea44c=_0x2514d5?_0x398f17[_0xc1b9('0x1e')]:_0x11b271[_0xc1b9('0x1f')]+_0x11b271[_0xc1b9('0x20')];var _0x5db314;if(_0x3ea44c>=_0x5123e3){_0x3ea44c=_0x5123e3;_0x5db314=0xc8;}else{_0x5db314=0xce;}_0x4691f1[_0xc1b9('0x1b')](_0x5db314);return _0x4691f1['set'](_0xc1b9('0x21'),_0x479b50+'-'+_0x3ea44c+'/'+_0x5123e3)[_0xc1b9('0x1c')](_0x398f17);}return null;};}function patchUpdates(_0x1d243a){return function(_0x450a64){try{jsonpatch[_0xc1b9('0x22')](_0x450a64,_0x1d243a,!![]);}catch(_0x2ac7f1){return BPromise[_0xc1b9('0x23')](_0x2ac7f1);}return _0x450a64['save']();};}function saveUpdates(_0x620cc1,_0x11eb4d){return function(_0x1f1d38){if(_0x1f1d38){return _0x1f1d38[_0xc1b9('0x24')](_0x620cc1)['then'](function(_0x2910be){return _0x2910be;});}return null;};}function removeEntity(_0x5ecb70,_0x450594){return function(_0x1c20e4){if(_0x1c20e4){return _0x1c20e4[_0xc1b9('0x25')]()[_0xc1b9('0x26')](function(){_0x5ecb70[_0xc1b9('0x1b')](0xcc)[_0xc1b9('0x27')]();});}};}function handleEntityNotFound(_0x36234c,_0xac7703){return function(_0x400609){if(!_0x400609){_0x36234c['sendStatus'](0x194);}return _0x400609;};}function handleError(_0x1c512d,_0x4d0196){_0x4d0196=_0x4d0196||0x1f4;return function(_0x369222){logger[_0xc1b9('0x28')](_0x369222[_0xc1b9('0x29')]);if(_0x369222[_0xc1b9('0x2a')]){delete _0x369222['name'];}_0x1c512d[_0xc1b9('0x1b')](_0x4d0196)['send'](_0x369222);};}exports[_0xc1b9('0x2b')]=function(_0x4ae95d,_0x56ba7e){var _0x57c9b5={},_0x3c862f={},_0x5b5cde={'count':0x0,'rows':[]};var _0x18fdc2=_[_0xc1b9('0x2c')](db[_0xc1b9('0x2d')]['rawAttributes'],function(_0xcb1bde){return{'name':_0xcb1bde['fieldName'],'type':_0xcb1bde[_0xc1b9('0x2e')][_0xc1b9('0x2f')]};});_0x3c862f['model']=_[_0xc1b9('0x2c')](_0x18fdc2,'name');_0x3c862f[_0xc1b9('0x30')]=_['keys'](_0x4ae95d[_0xc1b9('0x30')]);_0x3c862f[_0xc1b9('0x31')]=_[_0xc1b9('0x32')](_0x3c862f[_0xc1b9('0x33')],_0x3c862f[_0xc1b9('0x30')]);_0x57c9b5['attributes']=_[_0xc1b9('0x32')](_0x3c862f[_0xc1b9('0x33')],qs['fields'](_0x4ae95d['query'][_0xc1b9('0x34')]));_0x57c9b5['attributes']=_0x57c9b5[_0xc1b9('0x35')][_0xc1b9('0x36')]?_0x57c9b5['attributes']:_0x3c862f['model'];if(!_0x4ae95d[_0xc1b9('0x30')][_0xc1b9('0x37')]('nolimit')){_0x57c9b5[_0xc1b9('0x20')]=qs[_0xc1b9('0x20')](_0x4ae95d['query'][_0xc1b9('0x20')]);_0x57c9b5['offset']=qs[_0xc1b9('0x1f')](_0x4ae95d[_0xc1b9('0x30')][_0xc1b9('0x1f')]);}_0x57c9b5[_0xc1b9('0x38')]=qs[_0xc1b9('0x39')](_0x4ae95d[_0xc1b9('0x30')][_0xc1b9('0x39')]);_0x57c9b5[_0xc1b9('0x3a')]=qs[_0xc1b9('0x31')](_[_0xc1b9('0x3b')](_0x4ae95d[_0xc1b9('0x30')],_0x3c862f[_0xc1b9('0x31')]),_0x18fdc2);if(_0x4ae95d[_0xc1b9('0x30')][_0xc1b9('0x3c')]){_0x57c9b5['where']=_[_0xc1b9('0x3d')](_0x57c9b5['where'],{'$or':_['map'](_0x18fdc2,function(_0x4d2c6b){if(_0x4d2c6b[_0xc1b9('0x2e')]!==_0xc1b9('0x3e')){var _0x353468={};_0x353468[_0x4d2c6b['name']]={'$like':'%'+_0x4ae95d[_0xc1b9('0x30')][_0xc1b9('0x3c')]+'%'};return _0x353468;}})});}_0x57c9b5=_[_0xc1b9('0x3d')]({},_0x57c9b5,_0x4ae95d[_0xc1b9('0x3f')]);var _0x5c0cbc={'where':_0x57c9b5['where']};return db['FreshsalesConfiguration'][_0xc1b9('0x1e')](_0x5c0cbc)[_0xc1b9('0x26')](function(_0x2d0eb9){_0x5b5cde['count']=_0x2d0eb9;if(_0x4ae95d[_0xc1b9('0x30')][_0xc1b9('0x40')]){_0x57c9b5[_0xc1b9('0x41')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xc1b9('0x42')](_0x57c9b5);})[_0xc1b9('0x26')](function(_0x34c838){_0x5b5cde['rows']=_0x34c838;return _0x5b5cde;})['then'](respondWithFilteredResult(_0x56ba7e,_0x57c9b5))[_0xc1b9('0x43')](handleError(_0x56ba7e,null));};exports[_0xc1b9('0x44')]=function(_0x598fc7,_0x34ed0b){var _0xca1f0a={'raw':![],'where':{'id':_0x598fc7['params']['id']}},_0x5d950b={};_0x5d950b[_0xc1b9('0x33')]=_[_0xc1b9('0x45')](db[_0xc1b9('0x2d')][_0xc1b9('0x46')]);_0x5d950b['query']=_[_0xc1b9('0x45')](_0x598fc7[_0xc1b9('0x30')]);_0x5d950b['filters']=_[_0xc1b9('0x32')](_0x5d950b[_0xc1b9('0x33')],_0x5d950b[_0xc1b9('0x30')]);_0xca1f0a[_0xc1b9('0x35')]=_[_0xc1b9('0x32')](_0x5d950b[_0xc1b9('0x33')],qs['fields'](_0x598fc7['query'][_0xc1b9('0x34')]));_0xca1f0a[_0xc1b9('0x35')]=_0xca1f0a[_0xc1b9('0x35')][_0xc1b9('0x36')]?_0xca1f0a['attributes']:_0x5d950b[_0xc1b9('0x33')];if(_0x598fc7['query']['includeAll']){_0xca1f0a[_0xc1b9('0x41')]=[{'all':!![]}];}_0xca1f0a=_[_0xc1b9('0x3d')]({},_0xca1f0a,_0x598fc7[_0xc1b9('0x3f')]);return db['FreshsalesConfiguration'][_0xc1b9('0x47')](_0xca1f0a)[_0xc1b9('0x26')](handleEntityNotFound(_0x34ed0b,null))[_0xc1b9('0x26')](respondWithResult(_0x34ed0b,null))[_0xc1b9('0x43')](handleError(_0x34ed0b,null));};exports['create']=function(_0x8f9389,_0xb17762){return db['FreshsalesConfiguration'][_0xc1b9('0x48')](_0x8f9389[_0xc1b9('0x49')],{})[_0xc1b9('0x26')](respondWithResult(_0xb17762,0xc9))[_0xc1b9('0x43')](handleError(_0xb17762,null));};exports[_0xc1b9('0x24')]=function(_0x2fe3ee,_0x13308e){if(_0x2fe3ee[_0xc1b9('0x49')]['id']){delete _0x2fe3ee[_0xc1b9('0x49')]['id'];}return db['FreshsalesConfiguration'][_0xc1b9('0x47')]({'where':{'id':_0x2fe3ee['params']['id']}})[_0xc1b9('0x26')](handleEntityNotFound(_0x13308e,null))[_0xc1b9('0x26')](saveUpdates(_0x2fe3ee[_0xc1b9('0x49')],null))[_0xc1b9('0x26')](respondWithResult(_0x13308e,null))['catch'](handleError(_0x13308e,null));};exports[_0xc1b9('0x25')]=function(_0x45f99d,_0x259543){return db[_0xc1b9('0x2d')][_0xc1b9('0x47')]({'where':{'id':_0x45f99d[_0xc1b9('0x4a')]['id']}})[_0xc1b9('0x26')](handleEntityNotFound(_0x259543,null))['then'](removeEntity(_0x259543,null))[_0xc1b9('0x43')](handleError(_0x259543,null));};exports['getSubjects']=function(_0x2e8551,_0x424f5c,_0x4e648b){var _0x5df6cd={};var _0x1a7bf4={};var _0x3a0a70;var _0x1c17c2;return db[_0xc1b9('0x2d')]['findOne']({'where':{'id':_0x2e8551[_0xc1b9('0x4a')]['id']}})[_0xc1b9('0x26')](handleEntityNotFound(_0x424f5c,null))[_0xc1b9('0x26')](function(_0x25e2ab){if(_0x25e2ab){_0x3a0a70=_0x25e2ab;_0x1a7bf4[_0xc1b9('0x33')]=_[_0xc1b9('0x45')](db['FreshsalesField'][_0xc1b9('0x46')]);_0x1a7bf4['query']=_[_0xc1b9('0x45')](_0x2e8551[_0xc1b9('0x30')]);_0x1a7bf4[_0xc1b9('0x31')]=_[_0xc1b9('0x32')](_0x1a7bf4[_0xc1b9('0x33')],_0x1a7bf4[_0xc1b9('0x30')]);_0x5df6cd[_0xc1b9('0x35')]=_[_0xc1b9('0x32')](_0x1a7bf4[_0xc1b9('0x33')],qs[_0xc1b9('0x34')](_0x2e8551[_0xc1b9('0x30')][_0xc1b9('0x34')]));_0x5df6cd[_0xc1b9('0x35')]=_0x5df6cd[_0xc1b9('0x35')][_0xc1b9('0x36')]?_0x5df6cd['attributes']:_0x1a7bf4['model'];_0x5df6cd[_0xc1b9('0x38')]=qs[_0xc1b9('0x39')](_0x2e8551['query'][_0xc1b9('0x39')]);_0x5df6cd[_0xc1b9('0x3a')]=qs['filters'](_['pick'](_0x2e8551[_0xc1b9('0x30')],_0x1a7bf4['filters']));if(_0x2e8551['query'][_0xc1b9('0x3c')]){_0x5df6cd[_0xc1b9('0x3a')]=_['merge'](_0x5df6cd['where'],{'$or':_[_0xc1b9('0x2c')](_0x5df6cd[_0xc1b9('0x35')],function(_0x53201e){var _0x440a82={};_0x440a82[_0x53201e]={'$like':'%'+_0x2e8551[_0xc1b9('0x30')]['filter']+'%'};return _0x440a82;})});}_0x5df6cd=_[_0xc1b9('0x3d')]({},_0x5df6cd,_0x2e8551[_0xc1b9('0x3f')]);return _0x3a0a70[_0xc1b9('0x4b')](_0x5df6cd);}})[_0xc1b9('0x26')](function(_0x2539a5){if(_0x2539a5){_0x1c17c2=_0x2539a5['length'];if(!_0x2e8551['query']['hasOwnProperty']('nolimit')){_0x5df6cd[_0xc1b9('0x20')]=qs[_0xc1b9('0x20')](_0x2e8551[_0xc1b9('0x30')]['limit']);_0x5df6cd[_0xc1b9('0x1f')]=qs['offset'](_0x2e8551[_0xc1b9('0x30')][_0xc1b9('0x1f')]);}return _0x3a0a70[_0xc1b9('0x4b')](_0x5df6cd);}})[_0xc1b9('0x26')](function(_0x2c7fa7){if(_0x2c7fa7){return _0x2c7fa7?{'count':_0x1c17c2,'rows':_0x2c7fa7}:null;}})[_0xc1b9('0x26')](respondWithResult(_0x424f5c,null))['catch'](handleError(_0x424f5c,null));};exports[_0xc1b9('0x4c')]=function(_0x5d14b3,_0xedb76a,_0x52e9ac){var _0x2a38da={};var _0x151b52={};var _0x112815;var _0x1a6e6d;return db['FreshsalesConfiguration'][_0xc1b9('0x4d')]({'where':{'id':_0x5d14b3[_0xc1b9('0x4a')]['id']}})[_0xc1b9('0x26')](handleEntityNotFound(_0xedb76a,null))['then'](function(_0xb4093b){if(_0xb4093b){_0x112815=_0xb4093b;_0x151b52[_0xc1b9('0x33')]=_[_0xc1b9('0x45')](db[_0xc1b9('0x4e')][_0xc1b9('0x46')]);_0x151b52[_0xc1b9('0x30')]=_['keys'](_0x5d14b3[_0xc1b9('0x30')]);_0x151b52['filters']=_[_0xc1b9('0x32')](_0x151b52['model'],_0x151b52[_0xc1b9('0x30')]);_0x2a38da['attributes']=_['intersection'](_0x151b52[_0xc1b9('0x33')],qs[_0xc1b9('0x34')](_0x5d14b3['query'][_0xc1b9('0x34')]));_0x2a38da['attributes']=_0x2a38da['attributes'][_0xc1b9('0x36')]?_0x2a38da[_0xc1b9('0x35')]:_0x151b52['model'];_0x2a38da[_0xc1b9('0x38')]=qs[_0xc1b9('0x39')](_0x5d14b3[_0xc1b9('0x30')]['sort']);_0x2a38da[_0xc1b9('0x3a')]=qs[_0xc1b9('0x31')](_[_0xc1b9('0x3b')](_0x5d14b3[_0xc1b9('0x30')],_0x151b52[_0xc1b9('0x31')]));if(_0x5d14b3['query'][_0xc1b9('0x3c')]){_0x2a38da[_0xc1b9('0x3a')]=_[_0xc1b9('0x3d')](_0x2a38da[_0xc1b9('0x3a')],{'$or':_[_0xc1b9('0x2c')](_0x2a38da[_0xc1b9('0x35')],function(_0x3064ba){var _0x1c8e15={};_0x1c8e15[_0x3064ba]={'$like':'%'+_0x5d14b3['query']['filter']+'%'};return _0x1c8e15;})});}_0x2a38da=_[_0xc1b9('0x3d')]({},_0x2a38da,_0x5d14b3[_0xc1b9('0x3f')]);return _0x112815[_0xc1b9('0x4c')](_0x2a38da);}})[_0xc1b9('0x26')](function(_0x439336){if(_0x439336){_0x1a6e6d=_0x439336['length'];if(!_0x5d14b3['query'][_0xc1b9('0x37')]('nolimit')){_0x2a38da[_0xc1b9('0x20')]=qs[_0xc1b9('0x20')](_0x5d14b3[_0xc1b9('0x30')][_0xc1b9('0x20')]);_0x2a38da['offset']=qs[_0xc1b9('0x1f')](_0x5d14b3[_0xc1b9('0x30')]['offset']);}return _0x112815[_0xc1b9('0x4c')](_0x2a38da);}})['then'](function(_0x4c14e0){if(_0x4c14e0){return _0x4c14e0?{'count':_0x1a6e6d,'rows':_0x4c14e0}:null;}})[_0xc1b9('0x26')](respondWithResult(_0xedb76a,null))['catch'](handleError(_0xedb76a,null));};exports[_0xc1b9('0x4f')]=function(_0x444f33,_0x1007d8,_0x20d9d9){var _0x2bf0d6={};var _0x47d361={};var _0x40250d;var _0x5eb804;return db[_0xc1b9('0x2d')]['findOne']({'where':{'id':_0x444f33[_0xc1b9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1007d8,null))['then'](function(_0x228abf){if(_0x228abf){_0x40250d=_0x228abf;_0x47d361[_0xc1b9('0x33')]=_[_0xc1b9('0x45')](db[_0xc1b9('0x4e')][_0xc1b9('0x46')]);_0x47d361[_0xc1b9('0x30')]=_[_0xc1b9('0x45')](_0x444f33[_0xc1b9('0x30')]);_0x47d361[_0xc1b9('0x31')]=_['intersection'](_0x47d361[_0xc1b9('0x33')],_0x47d361[_0xc1b9('0x30')]);_0x2bf0d6[_0xc1b9('0x35')]=_['intersection'](_0x47d361[_0xc1b9('0x33')],qs[_0xc1b9('0x34')](_0x444f33['query'][_0xc1b9('0x34')]));_0x2bf0d6[_0xc1b9('0x35')]=_0x2bf0d6[_0xc1b9('0x35')][_0xc1b9('0x36')]?_0x2bf0d6[_0xc1b9('0x35')]:_0x47d361['model'];_0x2bf0d6[_0xc1b9('0x38')]=qs[_0xc1b9('0x39')](_0x444f33[_0xc1b9('0x30')]['sort']);_0x2bf0d6[_0xc1b9('0x3a')]=qs[_0xc1b9('0x31')](_[_0xc1b9('0x3b')](_0x444f33[_0xc1b9('0x30')],_0x47d361['filters']));if(_0x444f33[_0xc1b9('0x30')][_0xc1b9('0x3c')]){_0x2bf0d6[_0xc1b9('0x3a')]=_[_0xc1b9('0x3d')](_0x2bf0d6[_0xc1b9('0x3a')],{'$or':_[_0xc1b9('0x2c')](_0x2bf0d6['attributes'],function(_0xe69bfa){var _0x2dd2da={};_0x2dd2da[_0xe69bfa]={'$like':'%'+_0x444f33['query'][_0xc1b9('0x3c')]+'%'};return _0x2dd2da;})});}_0x2bf0d6=_['merge']({},_0x2bf0d6,_0x444f33[_0xc1b9('0x3f')]);return _0x40250d['getFields'](_0x2bf0d6);}})[_0xc1b9('0x26')](function(_0x4ffb23){if(_0x4ffb23){_0x5eb804=_0x4ffb23[_0xc1b9('0x36')];if(!_0x444f33[_0xc1b9('0x30')][_0xc1b9('0x37')](_0xc1b9('0x50'))){_0x2bf0d6['limit']=qs[_0xc1b9('0x20')](_0x444f33[_0xc1b9('0x30')][_0xc1b9('0x20')]);_0x2bf0d6[_0xc1b9('0x1f')]=qs[_0xc1b9('0x1f')](_0x444f33[_0xc1b9('0x30')][_0xc1b9('0x1f')]);}return _0x40250d[_0xc1b9('0x4f')](_0x2bf0d6);}})[_0xc1b9('0x26')](function(_0x4950aa){if(_0x4950aa){return _0x4950aa?{'count':_0x5eb804,'rows':_0x4950aa}:null;}})['then'](respondWithResult(_0x1007d8,null))[_0xc1b9('0x43')](handleError(_0x1007d8,null));};
\ No newline at end of file
index e4cf323..6c311cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac99=['./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x46d450,_0x4c67a1){var _0x3777b4=function(_0x4a134d){while(--_0x4a134d){_0x46d450['push'](_0x46d450['shift']());}};_0x3777b4(++_0x4c67a1);}(_0xac99,0xc8));var _0x9ac9=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xac99[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x9ac9('0x0'));var util=require(_0x9ac9('0x1'));var logger=require(_0x9ac9('0x2'))(_0x9ac9('0x3'));var moment=require(_0x9ac9('0x4'));var BPromise=require(_0x9ac9('0x5'));var rp=require(_0x9ac9('0x6'));var fs=require('fs');var path=require(_0x9ac9('0x7'));var rimraf=require(_0x9ac9('0x8'));var config=require(_0x9ac9('0x9'));var attributes=require(_0x9ac9('0xa'));module['exports']=function(_0x3b1beb,_0x3fa130){return _0x3b1beb[_0x9ac9('0xb')](_0x9ac9('0xc'),attributes,{'tableName':_0x9ac9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8c60=['define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0x10d7c9,_0x33ccef){var _0xebcaa9=function(_0x584dc9){while(--_0x584dc9){_0x10d7c9['push'](_0x10d7c9['shift']());}};_0xebcaa9(++_0x33ccef);}(_0x8c60,0x16f));var _0x08c6=function(_0x4ac7f4,_0x5af7d1){_0x4ac7f4=_0x4ac7f4-0x0;var _0x5b749b=_0x8c60[_0x4ac7f4];return _0x5b749b;};'use strict';var _=require('lodash');var util=require(_0x08c6('0x0'));var logger=require(_0x08c6('0x1'))(_0x08c6('0x2'));var moment=require(_0x08c6('0x3'));var BPromise=require(_0x08c6('0x4'));var rp=require(_0x08c6('0x5'));var fs=require('fs');var path=require(_0x08c6('0x6'));var rimraf=require(_0x08c6('0x7'));var config=require(_0x08c6('0x8'));var attributes=require(_0x08c6('0x9'));module[_0x08c6('0xa')]=function(_0x4cb067,_0x1136de){return _0x4cb067[_0x08c6('0xb')](_0x08c6('0xc'),attributes,{'tableName':_0x08c6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 1768c22..2b01396 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3c00=['request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x5d57bd,_0x5568b9){var _0x480ad9=function(_0x539e41){while(--_0x539e41){_0x5d57bd['push'](_0x5d57bd['shift']());}};_0x480ad9(++_0x5568b9);}(_0x3c00,0xad));var _0x03c0=function(_0x4c8983,_0x45927a){_0x4c8983=_0x4c8983-0x0;var _0x552459=_0x3c00[_0x4c8983];return _0x552459;};'use strict';var _=require(_0x03c0('0x0'));var util=require(_0x03c0('0x1'));var moment=require(_0x03c0('0x2'));var BPromise=require(_0x03c0('0x3'));var rs=require(_0x03c0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x03c0('0x5'))['db'];var utils=require(_0x03c0('0x6'));var logger=require('../../config/logger')(_0x03c0('0x7'));var config=require(_0x03c0('0x8'));var jayson=require(_0x03c0('0x9'));var client=jayson[_0x03c0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cdcfc,_0x54ffe9,_0x25cb22){return new BPromise(function(_0x2fd2e5,_0x3bb36a){return client[_0x03c0('0xb')](_0x5cdcfc,_0x25cb22)[_0x03c0('0xc')](function(_0x3ec6e0){logger[_0x03c0('0xd')](_0x03c0('0xe'),_0x54ffe9,_0x03c0('0xf'));logger[_0x03c0('0x10')](_0x03c0('0x11'),_0x54ffe9,_0x03c0('0xf'),JSON[_0x03c0('0x12')](_0x3ec6e0));if(_0x3ec6e0[_0x03c0('0x13')]){if(_0x3ec6e0[_0x03c0('0x13')][_0x03c0('0x14')]===0x1f4){logger[_0x03c0('0x13')](_0x03c0('0xe'),_0x54ffe9,_0x3ec6e0[_0x03c0('0x13')]['message']);return _0x3bb36a(_0x3ec6e0[_0x03c0('0x13')][_0x03c0('0x15')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x54ffe9,_0x3ec6e0['error']['message']);return _0x2fd2e5(_0x3ec6e0['error'][_0x03c0('0x15')]);}else{logger[_0x03c0('0xd')](_0x03c0('0xe'),_0x54ffe9,_0x03c0('0xf'));_0x2fd2e5(_0x3ec6e0['result']['message']);}})[_0x03c0('0x16')](function(_0x23a31b){logger[_0x03c0('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x54ffe9,_0x23a31b);_0x3bb36a(_0x23a31b);});});}
\ No newline at end of file
+var _0x3d2a=['code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error'];(function(_0x1da3a1,_0x131510){var _0x4f6503=function(_0x4c0d2f){while(--_0x4c0d2f){_0x1da3a1['push'](_0x1da3a1['shift']());}};_0x4f6503(++_0x131510);}(_0x3d2a,0xdd));var _0xa3d2=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x3d2a[_0x43b584];return _0x48f27b;};'use strict';var _=require(_0xa3d2('0x0'));var util=require(_0xa3d2('0x1'));var moment=require(_0xa3d2('0x2'));var BPromise=require('bluebird');var rs=require(_0xa3d2('0x3'));var fs=require('fs');var Redis=require(_0xa3d2('0x4'));var db=require(_0xa3d2('0x5'))['db'];var utils=require(_0xa3d2('0x6'));var logger=require('../../config/logger')(_0xa3d2('0x7'));var config=require(_0xa3d2('0x8'));var jayson=require(_0xa3d2('0x9'));var client=jayson[_0xa3d2('0xa')][_0xa3d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b8ea4,_0x54cbfd,_0x132782){return new BPromise(function(_0xe62917,_0xca6bb8){return client[_0xa3d2('0xc')](_0x4b8ea4,_0x132782)[_0xa3d2('0xd')](function(_0x139c82){logger[_0xa3d2('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x54cbfd,'request\x20sent');logger[_0xa3d2('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x54cbfd,_0xa3d2('0x10'),JSON[_0xa3d2('0x11')](_0x139c82));if(_0x139c82[_0xa3d2('0x12')]){if(_0x139c82[_0xa3d2('0x12')][_0xa3d2('0x13')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x54cbfd,_0x139c82[_0xa3d2('0x12')][_0xa3d2('0x14')]);return _0xca6bb8(_0x139c82[_0xa3d2('0x12')][_0xa3d2('0x14')]);}logger[_0xa3d2('0x12')](_0xa3d2('0x15'),_0x54cbfd,_0x139c82[_0xa3d2('0x12')]['message']);return _0xe62917(_0x139c82[_0xa3d2('0x12')][_0xa3d2('0x14')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x54cbfd,_0xa3d2('0x10'));_0xe62917(_0x139c82[_0xa3d2('0x16')][_0xa3d2('0x14')]);}})[_0xa3d2('0x17')](function(_0x502ee4){logger[_0xa3d2('0x12')](_0xa3d2('0x15'),_0x54cbfd,_0x502ee4);_0xca6bb8(_0x502ee4);});});}
\ No newline at end of file
index cac38b1..e81fe42 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa5ca=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x51fd48,_0x17c334){var _0x32dc62=function(_0x5476ad){while(--_0x5476ad){_0x51fd48['push'](_0x51fd48['shift']());}};_0x32dc62(++_0x17c334);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xa5ca[_0x725b8e];return _0x43ac45;};'use strict';var multer=require(_0xaa5c('0x0'));var util=require(_0xaa5c('0x1'));var path=require(_0xaa5c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaa5c('0x3')]();var fs_extra=require(_0xaa5c('0x4'));var auth=require(_0xaa5c('0x5'));var interaction=require(_0xaa5c('0x6'));var config=require(_0xaa5c('0x7'));var controller=require(_0xaa5c('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xaa5c('0x9')](_0xaa5c('0xa'),auth[_0xaa5c('0xb')](),controller['show']);router['post']('/',auth[_0xaa5c('0xb')](),controller[_0xaa5c('0xc')]);router[_0xaa5c('0xd')]('/:id',auth[_0xaa5c('0xb')](),controller[_0xaa5c('0xe')]);router[_0xaa5c('0xf')](_0xaa5c('0xa'),auth[_0xaa5c('0xb')](),controller[_0xaa5c('0x10')]);module[_0xaa5c('0x11')]=router;
\ No newline at end of file
+var _0xe3ee=['/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','fs-extra','../../config/environment','get','isAuthenticated','index'];(function(_0x5055fd,_0x171f4e){var _0x4eeb0f=function(_0x4d81cc){while(--_0x4d81cc){_0x5055fd['push'](_0x5055fd['shift']());}};_0x4eeb0f(++_0x171f4e);}(_0xe3ee,0x116));var _0xee3e=function(_0x5e7c02,_0x30b097){_0x5e7c02=_0x5e7c02-0x0;var _0x3bddc2=_0xe3ee[_0x5e7c02];return _0x3bddc2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee3e('0x0'));var timeout=require(_0xee3e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xee3e('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xee3e('0x3'));var controller=require('./intFreshsalesField.controller');router[_0xee3e('0x4')]('/',auth[_0xee3e('0x5')](),controller[_0xee3e('0x6')]);router[_0xee3e('0x4')](_0xee3e('0x7'),auth[_0xee3e('0x5')](),controller[_0xee3e('0x8')]);router[_0xee3e('0x9')]('/',auth['isAuthenticated'](),controller[_0xee3e('0xa')]);router[_0xee3e('0xb')]('/:id',auth[_0xee3e('0x5')](),controller[_0xee3e('0xc')]);router['delete'](_0xee3e('0x7'),auth[_0xee3e('0x5')](),controller[_0xee3e('0xd')]);module[_0xee3e('0xe')]=router;
\ No newline at end of file
index a829b12..95835ab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd843=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x556632,_0xc57c26){var _0x56aee8=function(_0x11d307){while(--_0x11d307){_0x556632['push'](_0x556632['shift']());}};_0x56aee8(++_0xc57c26);}(_0xd843,0x11b));var _0x3d84=function(_0x279522,_0x497270){_0x279522=_0x279522-0x0;var _0xc6071d=_0xd843[_0x279522];return _0xc6071d;};'use strict';var Sequelize=require(_0x3d84('0x0'));module[_0x3d84('0x1')]={'type':{'type':Sequelize[_0x3d84('0x2')](_0x3d84('0x3'),'variable',_0x3d84('0x4'),_0x3d84('0x5'),_0x3d84('0x6')),'defaultValue':_0x3d84('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3d84('0x7')]},'keyType':{'type':Sequelize[_0x3d84('0x2')](_0x3d84('0x3'),_0x3d84('0x8'),_0x3d84('0x4'))},'keyContent':{'type':Sequelize[_0x3d84('0x7')]},'idField':{'type':Sequelize[_0x3d84('0x7')]},'nameField':{'type':Sequelize[_0x3d84('0x7')]},'customField':{'type':Sequelize[_0x3d84('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x19b8=['customVariable','keyValue','picklist','string','STRING','sequelize','exports','ENUM','variable'];(function(_0x4c0735,_0x1275c5){var _0xdfa98b=function(_0x53a281){while(--_0x53a281){_0x4c0735['push'](_0x4c0735['shift']());}};_0xdfa98b(++_0x1275c5);}(_0x19b8,0x12e));var _0x819b=function(_0x4af8a5,_0x235b51){_0x4af8a5=_0x4af8a5-0x0;var _0x2f73a0=_0x19b8[_0x4af8a5];return _0x2f73a0;};'use strict';var Sequelize=require(_0x819b('0x0'));module[_0x819b('0x1')]={'type':{'type':Sequelize[_0x819b('0x2')]('string',_0x819b('0x3'),_0x819b('0x4'),_0x819b('0x5'),_0x819b('0x6')),'defaultValue':_0x819b('0x7')},'content':{'type':Sequelize[_0x819b('0x8')]},'key':{'type':Sequelize[_0x819b('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0x819b('0x3'),_0x819b('0x4'))},'keyContent':{'type':Sequelize[_0x819b('0x8')]},'idField':{'type':Sequelize[_0x819b('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x819b('0x8')]}};
\ No newline at end of file
index 04f2511..e63c20b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ee4=['json','apply','reject','update','then','destroy','error','stack','name','send','index','FreshsalesField','rawAttributes','type','model','map','filters','query','attributes','intersection','fields','length','order','sort','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','find','create','body','eml-format','fast-json-patch','moment','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x25da9f,_0x47d72c){var _0x447588=function(_0x212fa5){while(--_0x212fa5){_0x25da9f['push'](_0x25da9f['shift']());}};_0x447588(++_0x47d72c);}(_0x1ee4,0x13b));var _0x41ee=function(_0x3b6fbd,_0xfb0487){_0x3b6fbd=_0x3b6fbd-0x0;var _0x1e3d5c=_0x1ee4[_0x3b6fbd];return _0x1e3d5c;};'use strict';var emlformat=require(_0x41ee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x41ee('0x1'));var rp=require('request-promise');var moment=require(_0x41ee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x41ee('0x3'));var util=require('util');var path=require('path');var sox=require(_0x41ee('0x4'));var csv=require('to-csv');var ejs=require(_0x41ee('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41ee('0x6'));var squel=require('squel');var crypto=require(_0x41ee('0x7'));var jsforce=require(_0x41ee('0x8'));var deskjs=require(_0x41ee('0x9'));var toCsv=require(_0x41ee('0xa'));var querystring=require(_0x41ee('0xb'));var Papa=require(_0x41ee('0xc'));var Redis=require(_0x41ee('0xd'));var authService=require(_0x41ee('0xe'));var qs=require(_0x41ee('0xf'));var as=require(_0x41ee('0x10'));var hardwareService=require(_0x41ee('0x11'));var logger=require(_0x41ee('0x12'))(_0x41ee('0x13'));var utils=require(_0x41ee('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x41ee('0x15'))['db'];function respondWithStatusCode(_0x37c7bb,_0x556964){_0x556964=_0x556964||0xcc;return function(_0x11e7ed){if(_0x11e7ed){return _0x37c7bb['sendStatus'](_0x556964);}return _0x37c7bb['status'](_0x556964)[_0x41ee('0x16')]();};}function respondWithResult(_0x4d8b63,_0x4b9958){_0x4b9958=_0x4b9958||0xc8;return function(_0x344fa4){if(_0x344fa4){return _0x4d8b63[_0x41ee('0x17')](_0x4b9958)['json'](_0x344fa4);}};}function respondWithFilteredResult(_0x24dc55,_0x1db6db){return function(_0x1d6788){if(_0x1d6788){var _0x4fadcb=typeof _0x1db6db[_0x41ee('0x18')]===_0x41ee('0x19')&&typeof _0x1db6db[_0x41ee('0x1a')]===_0x41ee('0x19');var _0x5a32c4=_0x1d6788['count'];var _0x359cf3=_0x4fadcb?0x0:_0x1db6db['offset'];var _0x5bf605=_0x4fadcb?_0x1d6788[_0x41ee('0x1b')]:_0x1db6db[_0x41ee('0x18')]+_0x1db6db[_0x41ee('0x1a')];var _0x340b5c;if(_0x5bf605>=_0x5a32c4){_0x5bf605=_0x5a32c4;_0x340b5c=0xc8;}else{_0x340b5c=0xce;}_0x24dc55[_0x41ee('0x17')](_0x340b5c);return _0x24dc55[_0x41ee('0x1c')](_0x41ee('0x1d'),_0x359cf3+'-'+_0x5bf605+'/'+_0x5a32c4)[_0x41ee('0x1e')](_0x1d6788);}return null;};}function patchUpdates(_0x1d9016){return function(_0x36b0b1){try{jsonpatch[_0x41ee('0x1f')](_0x36b0b1,_0x1d9016,!![]);}catch(_0x5d5083){return BPromise[_0x41ee('0x20')](_0x5d5083);}return _0x36b0b1['save']();};}function saveUpdates(_0x241854,_0x1241ec){return function(_0x5c2e11){if(_0x5c2e11){return _0x5c2e11[_0x41ee('0x21')](_0x241854)[_0x41ee('0x22')](function(_0xedac7a){return _0xedac7a;});}return null;};}function removeEntity(_0xfd904f,_0x1aa5ef){return function(_0x3660e9){if(_0x3660e9){return _0x3660e9[_0x41ee('0x23')]()[_0x41ee('0x22')](function(){_0xfd904f[_0x41ee('0x17')](0xcc)[_0x41ee('0x16')]();});}};}function handleEntityNotFound(_0x2a2892,_0x18e5ef){return function(_0xcc19cd){if(!_0xcc19cd){_0x2a2892['sendStatus'](0x194);}return _0xcc19cd;};}function handleError(_0x766773,_0x283df0){_0x283df0=_0x283df0||0x1f4;return function(_0xd32a96){logger[_0x41ee('0x24')](_0xd32a96[_0x41ee('0x25')]);if(_0xd32a96[_0x41ee('0x26')]){delete _0xd32a96['name'];}_0x766773['status'](_0x283df0)[_0x41ee('0x27')](_0xd32a96);};}exports[_0x41ee('0x28')]=function(_0x23beef,_0x202861){var _0x34f35a={},_0x42bfef={},_0x30e076={'count':0x0,'rows':[]};var _0x535269=_['map'](db[_0x41ee('0x29')][_0x41ee('0x2a')],function(_0x2d8b2d){return{'name':_0x2d8b2d['fieldName'],'type':_0x2d8b2d[_0x41ee('0x2b')]['key']};});_0x42bfef[_0x41ee('0x2c')]=_[_0x41ee('0x2d')](_0x535269,'name');_0x42bfef['query']=_['keys'](_0x23beef['query']);_0x42bfef[_0x41ee('0x2e')]=_['intersection'](_0x42bfef['model'],_0x42bfef[_0x41ee('0x2f')]);_0x34f35a[_0x41ee('0x30')]=_[_0x41ee('0x31')](_0x42bfef['model'],qs[_0x41ee('0x32')](_0x23beef[_0x41ee('0x2f')][_0x41ee('0x32')]));_0x34f35a[_0x41ee('0x30')]=_0x34f35a[_0x41ee('0x30')][_0x41ee('0x33')]?_0x34f35a[_0x41ee('0x30')]:_0x42bfef[_0x41ee('0x2c')];if(!_0x23beef['query']['hasOwnProperty']('nolimit')){_0x34f35a[_0x41ee('0x1a')]=qs[_0x41ee('0x1a')](_0x23beef[_0x41ee('0x2f')][_0x41ee('0x1a')]);_0x34f35a[_0x41ee('0x18')]=qs[_0x41ee('0x18')](_0x23beef[_0x41ee('0x2f')][_0x41ee('0x18')]);}_0x34f35a[_0x41ee('0x34')]=qs[_0x41ee('0x35')](_0x23beef['query'][_0x41ee('0x35')]);_0x34f35a['where']=qs[_0x41ee('0x2e')](_['pick'](_0x23beef['query'],_0x42bfef[_0x41ee('0x2e')]),_0x535269);if(_0x23beef[_0x41ee('0x2f')][_0x41ee('0x36')]){_0x34f35a[_0x41ee('0x37')]=_[_0x41ee('0x38')](_0x34f35a[_0x41ee('0x37')],{'$or':_['map'](_0x535269,function(_0x48d0ac){if(_0x48d0ac[_0x41ee('0x2b')]!==_0x41ee('0x39')){var _0x291e9c={};_0x291e9c[_0x48d0ac[_0x41ee('0x26')]]={'$like':'%'+_0x23beef[_0x41ee('0x2f')][_0x41ee('0x36')]+'%'};return _0x291e9c;}})});}_0x34f35a=_[_0x41ee('0x38')]({},_0x34f35a,_0x23beef['options']);var _0x5cbe9b={'where':_0x34f35a[_0x41ee('0x37')]};return db[_0x41ee('0x29')]['count'](_0x5cbe9b)[_0x41ee('0x22')](function(_0x477ea2){_0x30e076[_0x41ee('0x1b')]=_0x477ea2;if(_0x23beef[_0x41ee('0x2f')][_0x41ee('0x3a')]){_0x34f35a[_0x41ee('0x3b')]=[{'all':!![]}];}return db[_0x41ee('0x29')]['findAll'](_0x34f35a);})[_0x41ee('0x22')](function(_0x45b187){_0x30e076[_0x41ee('0x3c')]=_0x45b187;return _0x30e076;})['then'](respondWithFilteredResult(_0x202861,_0x34f35a))[_0x41ee('0x3d')](handleError(_0x202861,null));};exports[_0x41ee('0x3e')]=function(_0x2a53c2,_0x29ae96){var _0x27d5d5={'raw':!![],'where':{'id':_0x2a53c2[_0x41ee('0x3f')]['id']}},_0x1c2b82={};_0x1c2b82[_0x41ee('0x2c')]=_[_0x41ee('0x40')](db[_0x41ee('0x29')][_0x41ee('0x2a')]);_0x1c2b82[_0x41ee('0x2f')]=_[_0x41ee('0x40')](_0x2a53c2[_0x41ee('0x2f')]);_0x1c2b82[_0x41ee('0x2e')]=_['intersection'](_0x1c2b82[_0x41ee('0x2c')],_0x1c2b82[_0x41ee('0x2f')]);_0x27d5d5['attributes']=_['intersection'](_0x1c2b82[_0x41ee('0x2c')],qs[_0x41ee('0x32')](_0x2a53c2[_0x41ee('0x2f')]['fields']));_0x27d5d5['attributes']=_0x27d5d5[_0x41ee('0x30')]['length']?_0x27d5d5[_0x41ee('0x30')]:_0x1c2b82[_0x41ee('0x2c')];if(_0x2a53c2[_0x41ee('0x2f')][_0x41ee('0x3a')]){_0x27d5d5['include']=[{'all':!![]}];}_0x27d5d5=_[_0x41ee('0x38')]({},_0x27d5d5,_0x2a53c2[_0x41ee('0x41')]);return db[_0x41ee('0x29')][_0x41ee('0x42')](_0x27d5d5)[_0x41ee('0x22')](handleEntityNotFound(_0x29ae96,null))[_0x41ee('0x22')](respondWithResult(_0x29ae96,null))[_0x41ee('0x3d')](handleError(_0x29ae96,null));};exports[_0x41ee('0x43')]=function(_0x3f4399,_0x421677){return db[_0x41ee('0x29')][_0x41ee('0x43')](_0x3f4399[_0x41ee('0x44')],{})['then'](respondWithResult(_0x421677,0xc9))[_0x41ee('0x3d')](handleError(_0x421677,null));};exports[_0x41ee('0x21')]=function(_0x254711,_0x588083){if(_0x254711[_0x41ee('0x44')]['id']){delete _0x254711[_0x41ee('0x44')]['id'];}return db[_0x41ee('0x29')][_0x41ee('0x42')]({'where':{'id':_0x254711[_0x41ee('0x3f')]['id']}})['then'](handleEntityNotFound(_0x588083,null))['then'](saveUpdates(_0x254711[_0x41ee('0x44')],null))[_0x41ee('0x22')](respondWithResult(_0x588083,null))[_0x41ee('0x3d')](handleError(_0x588083,null));};exports[_0x41ee('0x23')]=function(_0x56fa6d,_0x5edc3f){return db[_0x41ee('0x29')][_0x41ee('0x42')]({'where':{'id':_0x56fa6d[_0x41ee('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5edc3f,null))[_0x41ee('0x22')](removeEntity(_0x5edc3f,null))[_0x41ee('0x3d')](handleError(_0x5edc3f,null));};
\ No newline at end of file
+var _0xfbf6=['sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','stack','name','send','map','FreshsalesField','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','include','show','params','includeAll','create','catch','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x4b8a8b,_0x1df174){var _0x532079=function(_0x2175a6){while(--_0x2175a6){_0x4b8a8b['push'](_0x4b8a8b['shift']());}};_0x532079(++_0x1df174);}(_0xfbf6,0xc5));var _0x6fbf=function(_0x4434f7,_0x431595){_0x4434f7=_0x4434f7-0x0;var _0x364db2=_0xfbf6[_0x4434f7];return _0x364db2;};'use strict';var emlformat=require(_0x6fbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6fbf('0x1'));var jsonpatch=require(_0x6fbf('0x2'));var rp=require(_0x6fbf('0x3'));var moment=require(_0x6fbf('0x4'));var BPromise=require(_0x6fbf('0x5'));var Mustache=require(_0x6fbf('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6fbf('0x7'));var csv=require('to-csv');var ejs=require(_0x6fbf('0x8'));var fs=require('fs');var fs_extra=require(_0x6fbf('0x9'));var _=require(_0x6fbf('0xa'));var squel=require('squel');var crypto=require(_0x6fbf('0xb'));var jsforce=require(_0x6fbf('0xc'));var deskjs=require(_0x6fbf('0xd'));var toCsv=require(_0x6fbf('0xe'));var querystring=require(_0x6fbf('0xf'));var Papa=require(_0x6fbf('0x10'));var Redis=require(_0x6fbf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6fbf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6fbf('0x13'))(_0x6fbf('0x14'));var utils=require(_0x6fbf('0x15'));var config=require(_0x6fbf('0x16'));var licenseUtil=require(_0x6fbf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37159d,_0x657030){_0x657030=_0x657030||0xcc;return function(_0x3e4d11){if(_0x3e4d11){return _0x37159d[_0x6fbf('0x18')](_0x657030);}return _0x37159d[_0x6fbf('0x19')](_0x657030)[_0x6fbf('0x1a')]();};}function respondWithResult(_0x3f5574,_0x201b72){_0x201b72=_0x201b72||0xc8;return function(_0xc46e99){if(_0xc46e99){return _0x3f5574[_0x6fbf('0x19')](_0x201b72)[_0x6fbf('0x1b')](_0xc46e99);}};}function respondWithFilteredResult(_0x44963d,_0x104536){return function(_0x317250){if(_0x317250){var _0x29674b=typeof _0x104536[_0x6fbf('0x1c')]===_0x6fbf('0x1d')&&typeof _0x104536[_0x6fbf('0x1e')]===_0x6fbf('0x1d');var _0x3ac047=_0x317250[_0x6fbf('0x1f')];var _0x2396bb=_0x29674b?0x0:_0x104536[_0x6fbf('0x1c')];var _0xdf7fbd=_0x29674b?_0x317250['count']:_0x104536['offset']+_0x104536[_0x6fbf('0x1e')];var _0x27ce49;if(_0xdf7fbd>=_0x3ac047){_0xdf7fbd=_0x3ac047;_0x27ce49=0xc8;}else{_0x27ce49=0xce;}_0x44963d[_0x6fbf('0x19')](_0x27ce49);return _0x44963d['set'](_0x6fbf('0x20'),_0x2396bb+'-'+_0xdf7fbd+'/'+_0x3ac047)[_0x6fbf('0x1b')](_0x317250);}return null;};}function patchUpdates(_0x2578f4){return function(_0x282f6f){try{jsonpatch[_0x6fbf('0x21')](_0x282f6f,_0x2578f4,!![]);}catch(_0x2abfb1){return BPromise['reject'](_0x2abfb1);}return _0x282f6f[_0x6fbf('0x22')]();};}function saveUpdates(_0x5790da,_0x2418d9){return function(_0x3807ae){if(_0x3807ae){return _0x3807ae[_0x6fbf('0x23')](_0x5790da)['then'](function(_0x133171){return _0x133171;});}return null;};}function removeEntity(_0x5ce92d,_0x446ec2){return function(_0x35ed7b){if(_0x35ed7b){return _0x35ed7b[_0x6fbf('0x24')]()[_0x6fbf('0x25')](function(){_0x5ce92d[_0x6fbf('0x19')](0xcc)[_0x6fbf('0x1a')]();});}};}function handleEntityNotFound(_0x2ed34c,_0x148647){return function(_0xd42c36){if(!_0xd42c36){_0x2ed34c[_0x6fbf('0x18')](0x194);}return _0xd42c36;};}function handleError(_0x12f4c0,_0x2b590f){_0x2b590f=_0x2b590f||0x1f4;return function(_0x3f6dbe){logger[_0x6fbf('0x26')](_0x3f6dbe[_0x6fbf('0x27')]);if(_0x3f6dbe[_0x6fbf('0x28')]){delete _0x3f6dbe[_0x6fbf('0x28')];}_0x12f4c0['status'](_0x2b590f)[_0x6fbf('0x29')](_0x3f6dbe);};}exports['index']=function(_0x240838,_0x1e02c7){var _0x221562={},_0x58f20d={},_0x34f86b={'count':0x0,'rows':[]};var _0x3e2d9a=_[_0x6fbf('0x2a')](db[_0x6fbf('0x2b')]['rawAttributes'],function(_0x2653ee){return{'name':_0x2653ee[_0x6fbf('0x2c')],'type':_0x2653ee[_0x6fbf('0x2d')]['key']};});_0x58f20d['model']=_['map'](_0x3e2d9a,_0x6fbf('0x28'));_0x58f20d['query']=_[_0x6fbf('0x2e')](_0x240838[_0x6fbf('0x2f')]);_0x58f20d[_0x6fbf('0x30')]=_[_0x6fbf('0x31')](_0x58f20d[_0x6fbf('0x32')],_0x58f20d[_0x6fbf('0x2f')]);_0x221562['attributes']=_['intersection'](_0x58f20d[_0x6fbf('0x32')],qs[_0x6fbf('0x33')](_0x240838['query'][_0x6fbf('0x33')]));_0x221562[_0x6fbf('0x34')]=_0x221562['attributes'][_0x6fbf('0x35')]?_0x221562['attributes']:_0x58f20d[_0x6fbf('0x32')];if(!_0x240838[_0x6fbf('0x2f')][_0x6fbf('0x36')]('nolimit')){_0x221562[_0x6fbf('0x1e')]=qs[_0x6fbf('0x1e')](_0x240838[_0x6fbf('0x2f')][_0x6fbf('0x1e')]);_0x221562[_0x6fbf('0x1c')]=qs[_0x6fbf('0x1c')](_0x240838['query']['offset']);}_0x221562[_0x6fbf('0x37')]=qs[_0x6fbf('0x38')](_0x240838['query'][_0x6fbf('0x38')]);_0x221562['where']=qs[_0x6fbf('0x30')](_[_0x6fbf('0x39')](_0x240838['query'],_0x58f20d[_0x6fbf('0x30')]),_0x3e2d9a);if(_0x240838[_0x6fbf('0x2f')]['filter']){_0x221562[_0x6fbf('0x3a')]=_[_0x6fbf('0x3b')](_0x221562[_0x6fbf('0x3a')],{'$or':_[_0x6fbf('0x2a')](_0x3e2d9a,function(_0x1955df){if(_0x1955df[_0x6fbf('0x2d')]!=='VIRTUAL'){var _0x24a6ed={};_0x24a6ed[_0x1955df['name']]={'$like':'%'+_0x240838['query']['filter']+'%'};return _0x24a6ed;}})});}_0x221562=_['merge']({},_0x221562,_0x240838['options']);var _0x1f9470={'where':_0x221562['where']};return db['FreshsalesField'][_0x6fbf('0x1f')](_0x1f9470)[_0x6fbf('0x25')](function(_0x1842a9){_0x34f86b[_0x6fbf('0x1f')]=_0x1842a9;if(_0x240838['query']['includeAll']){_0x221562[_0x6fbf('0x3c')]=[{'all':!![]}];}return db[_0x6fbf('0x2b')]['findAll'](_0x221562);})[_0x6fbf('0x25')](function(_0x3fb9be){_0x34f86b['rows']=_0x3fb9be;return _0x34f86b;})['then'](respondWithFilteredResult(_0x1e02c7,_0x221562))['catch'](handleError(_0x1e02c7,null));};exports[_0x6fbf('0x3d')]=function(_0x4be65a,_0x14d4e3){var _0x55795b={'raw':!![],'where':{'id':_0x4be65a[_0x6fbf('0x3e')]['id']}},_0x452b4c={};_0x452b4c[_0x6fbf('0x32')]=_[_0x6fbf('0x2e')](db['FreshsalesField']['rawAttributes']);_0x452b4c[_0x6fbf('0x2f')]=_[_0x6fbf('0x2e')](_0x4be65a[_0x6fbf('0x2f')]);_0x452b4c['filters']=_[_0x6fbf('0x31')](_0x452b4c[_0x6fbf('0x32')],_0x452b4c[_0x6fbf('0x2f')]);_0x55795b['attributes']=_[_0x6fbf('0x31')](_0x452b4c[_0x6fbf('0x32')],qs[_0x6fbf('0x33')](_0x4be65a[_0x6fbf('0x2f')][_0x6fbf('0x33')]));_0x55795b['attributes']=_0x55795b[_0x6fbf('0x34')][_0x6fbf('0x35')]?_0x55795b[_0x6fbf('0x34')]:_0x452b4c[_0x6fbf('0x32')];if(_0x4be65a[_0x6fbf('0x2f')][_0x6fbf('0x3f')]){_0x55795b['include']=[{'all':!![]}];}_0x55795b=_['merge']({},_0x55795b,_0x4be65a['options']);return db[_0x6fbf('0x2b')]['find'](_0x55795b)[_0x6fbf('0x25')](handleEntityNotFound(_0x14d4e3,null))['then'](respondWithResult(_0x14d4e3,null))['catch'](handleError(_0x14d4e3,null));};exports[_0x6fbf('0x40')]=function(_0xcf4c3d,_0x55cea2){return db[_0x6fbf('0x2b')]['create'](_0xcf4c3d['body'],{})[_0x6fbf('0x25')](respondWithResult(_0x55cea2,0xc9))[_0x6fbf('0x41')](handleError(_0x55cea2,null));};exports['update']=function(_0x32afab,_0x2a2b08){if(_0x32afab[_0x6fbf('0x42')]['id']){delete _0x32afab[_0x6fbf('0x42')]['id'];}return db[_0x6fbf('0x2b')]['find']({'where':{'id':_0x32afab[_0x6fbf('0x3e')]['id']}})[_0x6fbf('0x25')](handleEntityNotFound(_0x2a2b08,null))[_0x6fbf('0x25')](saveUpdates(_0x32afab['body'],null))[_0x6fbf('0x25')](respondWithResult(_0x2a2b08,null))['catch'](handleError(_0x2a2b08,null));};exports[_0x6fbf('0x24')]=function(_0x514df2,_0x37f279){return db[_0x6fbf('0x2b')][_0x6fbf('0x43')]({'where':{'id':_0x514df2[_0x6fbf('0x3e')]['id']}})[_0x6fbf('0x25')](handleEntityNotFound(_0x37f279,null))[_0x6fbf('0x25')](removeEntity(_0x37f279,null))['catch'](handleError(_0x37f279,null));};
\ No newline at end of file
index ace70c2..5620508 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb2af=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId'];(function(_0x3b319d,_0x4572c7){var _0x41d500=function(_0x198edb){while(--_0x198edb){_0x3b319d['push'](_0x3b319d['shift']());}};_0x41d500(++_0x4572c7);}(_0xb2af,0xd2));var _0xfb2a=function(_0x1af110,_0xbb0e3e){_0x1af110=_0x1af110-0x0;var _0x4e2935=_0xb2af[_0x1af110];return _0x4e2935;};'use strict';var _=require(_0xfb2a('0x0'));var util=require(_0xfb2a('0x1'));var logger=require(_0xfb2a('0x2'))(_0xfb2a('0x3'));var moment=require('moment');var BPromise=require(_0xfb2a('0x4'));var rp=require(_0xfb2a('0x5'));var fs=require('fs');var path=require(_0xfb2a('0x6'));var rimraf=require(_0xfb2a('0x7'));var config=require(_0xfb2a('0x8'));var attributes=require('./intFreshsalesField.attributes');module[_0xfb2a('0x9')]=function(_0x1f4f1b,_0xb1be3f){return _0x1f4f1b['define'](_0xfb2a('0xa'),attributes,{'tableName':_0xfb2a('0xb'),'paranoid':![],'indexes':[{'name':_0xfb2a('0xc'),'fields':[_0xfb2a('0xd'),_0xfb2a('0xe')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x60a5=['FieldId','lodash','api','request-promise','path','rimraf','./intFreshsalesField.attributes','exports','freshsales_unique_index','idField'];(function(_0x447120,_0x1cbabc){var _0x26d66a=function(_0xd96c47){while(--_0xd96c47){_0x447120['push'](_0x447120['shift']());}};_0x26d66a(++_0x1cbabc);}(_0x60a5,0x83));var _0x560a=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x60a5[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x560a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x560a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x560a('0x2'));var fs=require('fs');var path=require(_0x560a('0x3'));var rimraf=require(_0x560a('0x4'));var config=require('../../config/environment');var attributes=require(_0x560a('0x5'));module[_0x560a('0x6')]=function(_0x3856ae,_0x5aaec6){return _0x3856ae['define']('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x560a('0x7'),'fields':[_0x560a('0x8'),_0x560a('0x9')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index a2ca545..5985a6f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7096=['code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x7096,0x10c));var _0x6709=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7096[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2223,_0x11ad23,_0x985814){return new BPromise(function(_0x30147f,_0x513ab6){return client['request'](_0x3e2223,_0x985814)[_0x6709('0xb')](function(_0x2d8c0b){logger[_0x6709('0xc')](_0x6709('0xd'),_0x11ad23,_0x6709('0xe'));logger[_0x6709('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x11ad23,'request\x20sent',JSON[_0x6709('0x10')](_0x2d8c0b));if(_0x2d8c0b[_0x6709('0x11')]){if(_0x2d8c0b[_0x6709('0x11')][_0x6709('0x12')]===0x1f4){logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')][_0x6709('0x13')]);return _0x513ab6(_0x2d8c0b['error'][_0x6709('0x13')]);}logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')]['message']);return _0x30147f(_0x2d8c0b[_0x6709('0x11')]['message']);}else{logger[_0x6709('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x11ad23,_0x6709('0xe'));_0x30147f(_0x2d8c0b[_0x6709('0x14')][_0x6709('0x13')]);}})[_0x6709('0x15')](function(_0x4cab30){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x11ad23,_0x4cab30);_0x513ab6(_0x4cab30);});});}
\ No newline at end of file
+var _0x2542=['info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x28512a,_0x35c811){var _0x475244=function(_0x1a61da){while(--_0x1a61da){_0x28512a['push'](_0x28512a['shift']());}};_0x475244(++_0x35c811);}(_0x2542,0x169));var _0x2254=function(_0x5b29f7,_0x335b71){_0x5b29f7=_0x5b29f7-0x0;var _0x47d235=_0x2542[_0x5b29f7];return _0x47d235;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});}
\ No newline at end of file
index 22ba834..2f89cb9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x14cb92,_0x43857a){var _0x53ca3e=function(_0xe7ff63){while(--_0xe7ff63){_0x14cb92['push'](_0x14cb92['shift']());}};_0x53ca3e(++_0x43857a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router;
\ No newline at end of file
+var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x28482e,_0x5dc22f){var _0x4bd980=function(_0x4de4bb){while(--_0x4de4bb){_0x28482e['push'](_0x28482e['shift']());}};_0x4bd980(++_0x5dc22f);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router;
\ No newline at end of file
index 2cd0849..24662a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c1d=['STRING','username','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x216eb4,_0x4e48ed){var _0x3ab48f=function(_0x59c08c){while(--_0x59c08c){_0x216eb4['push'](_0x216eb4['shift']());}};_0x3ab48f(++_0x4e48ed);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x47b9f4,_0x165d27){_0x47b9f4=_0x47b9f4-0x0;var _0x4a1dce=_0x9c1d[_0x47b9f4];return _0x4a1dce;};'use strict';var Sequelize=require(_0xd9c1('0x0'));module[_0xd9c1('0x1')]={'name':{'type':Sequelize[_0xd9c1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd9c1('0x2')],'unique':_0xd9c1('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xd9c1('0x2')]},'clientId':{'type':Sequelize[_0xd9c1('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xd9c1('0x2')]},'serverUrl':{'type':Sequelize[_0xd9c1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd9c1('0x4')](_0xd9c1('0x5'),_0xd9c1('0x6')),'defaultValue':_0xd9c1('0x5')}};
\ No newline at end of file
+var _0x4547=['STRING','ENUM','newTab','sequelize','exports'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x4547,0x11b));var _0x7454=function(_0x5ae8f7,_0x330d91){_0x5ae8f7=_0x5ae8f7-0x0;var _0x54c636=_0x4547[_0x5ae8f7];return _0x54c636;};'use strict';var Sequelize=require(_0x7454('0x0'));module[_0x7454('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7454('0x2')]},'username':{'type':Sequelize[_0x7454('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x7454('0x2')]},'password':{'type':Sequelize[_0x7454('0x2')]},'clientId':{'type':Sequelize[_0x7454('0x2')]},'clientSecret':{'type':Sequelize[_0x7454('0x2')]},'securityToken':{'type':Sequelize[_0x7454('0x2')]},'serverUrl':{'type':Sequelize[_0x7454('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7454('0x3')]('integrationTab',_0x7454('0x4')),'defaultValue':'integrationTab'}};
\ No newline at end of file
index 92a69a1..5bd08e3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb9fa=['length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceAccount','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','SalesforceField','getFields','Task','remoteUri','securityToken','slice','substring','lastIndexOf','Connection','clientId','password','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Description','string','int','picklist','email','textarea','remove','includes','label','custom','picklistValues','boolean','true','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb9fa,0x132));var _0xab9f=function(_0x22cd53,_0x17c666){_0x22cd53=_0x22cd53-0x0;var _0x3f4496=_0xb9fa[_0x22cd53];return _0x3f4496;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab9f('0x0'));var zipdir=require(_0xab9f('0x1'));var jsonpatch=require(_0xab9f('0x2'));var rp=require(_0xab9f('0x3'));var moment=require(_0xab9f('0x4'));var BPromise=require(_0xab9f('0x5'));var Mustache=require('mustache');var util=require(_0xab9f('0x6'));var path=require('path');var sox=require(_0xab9f('0x7'));var csv=require(_0xab9f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab9f('0x9'));var _=require(_0xab9f('0xa'));var squel=require('squel');var crypto=require(_0xab9f('0xb'));var jsforce=require(_0xab9f('0xc'));var deskjs=require(_0xab9f('0xd'));var toCsv=require(_0xab9f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xab9f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xab9f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab9f('0x10'));var logger=require(_0xab9f('0x11'))(_0xab9f('0x12'));var utils=require('../../config/utils');var config=require(_0xab9f('0x13'));var licenseUtil=require(_0xab9f('0x14'));var db=require(_0xab9f('0x15'))['db'];var integrations=require(_0xab9f('0x16'));function respondWithStatusCode(_0x445ebc,_0x5c53c9){_0x5c53c9=_0x5c53c9||0xcc;return function(_0x7a1bc9){if(_0x7a1bc9){return _0x445ebc[_0xab9f('0x17')](_0x5c53c9);}return _0x445ebc['status'](_0x5c53c9)[_0xab9f('0x18')]();};}function respondWithResult(_0x5d41dc,_0x350631){_0x350631=_0x350631||0xc8;return function(_0x18024c){if(_0x18024c){return _0x5d41dc['status'](_0x350631)[_0xab9f('0x19')](_0x18024c);}};}function respondWithFilteredResult(_0x980ae8,_0x564fff){return function(_0x39bdf2){if(_0x39bdf2){var _0x183200=typeof _0x564fff['offset']===_0xab9f('0x1a')&&typeof _0x564fff[_0xab9f('0x1b')]===_0xab9f('0x1a');var _0x4eb3cd=_0x39bdf2[_0xab9f('0x1c')];var _0x1a90b3=_0x183200?0x0:_0x564fff[_0xab9f('0x1d')];var _0x532ec7=_0x183200?_0x39bdf2[_0xab9f('0x1c')]:_0x564fff[_0xab9f('0x1d')]+_0x564fff[_0xab9f('0x1b')];var _0x580806;if(_0x532ec7>=_0x4eb3cd){_0x532ec7=_0x4eb3cd;_0x580806=0xc8;}else{_0x580806=0xce;}_0x980ae8[_0xab9f('0x1e')](_0x580806);return _0x980ae8[_0xab9f('0x1f')](_0xab9f('0x20'),_0x1a90b3+'-'+_0x532ec7+'/'+_0x4eb3cd)[_0xab9f('0x19')](_0x39bdf2);}return null;};}function patchUpdates(_0x34200d){return function(_0x4a88e4){try{jsonpatch[_0xab9f('0x21')](_0x4a88e4,_0x34200d,!![]);}catch(_0x21442b){return BPromise[_0xab9f('0x22')](_0x21442b);}return _0x4a88e4[_0xab9f('0x23')]();};}function saveUpdates(_0xbe5f71,_0x367dc8){return function(_0x2dcc85){if(_0x2dcc85){return _0x2dcc85[_0xab9f('0x24')](_0xbe5f71)['then'](function(_0x1692ca){return _0x1692ca;});}return null;};}function removeEntity(_0x436533,_0x2ee9ed){return function(_0x51e3c5){if(_0x51e3c5){return _0x51e3c5[_0xab9f('0x25')]()[_0xab9f('0x26')](function(){_0x436533['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28eb0c,_0x25da83){return function(_0x19d6e4){if(!_0x19d6e4){_0x28eb0c[_0xab9f('0x17')](0x194);}return _0x19d6e4;};}function handleError(_0x5029ac,_0x32cdce){_0x32cdce=_0x32cdce||0x1f4;return function(_0x17a394){logger[_0xab9f('0x27')](_0x17a394[_0xab9f('0x28')]);if(_0x17a394['name']){delete _0x17a394[_0xab9f('0x29')];}_0x5029ac[_0xab9f('0x1e')](_0x32cdce)[_0xab9f('0x2a')](_0x17a394);};}exports[_0xab9f('0x2b')]=function(_0x5b4a88,_0x509813){var _0x1fc71a={},_0x5b3447={},_0x16219a={'count':0x0,'rows':[]};var _0x62a459=_[_0xab9f('0x2c')](db['SalesforceAccount'][_0xab9f('0x2d')],function(_0x5e71e0){return{'name':_0x5e71e0['fieldName'],'type':_0x5e71e0[_0xab9f('0x2e')][_0xab9f('0x2f')]};});_0x5b3447[_0xab9f('0x30')]=_['map'](_0x62a459,_0xab9f('0x29'));_0x5b3447['query']=_['keys'](_0x5b4a88[_0xab9f('0x31')]);_0x5b3447[_0xab9f('0x32')]=_[_0xab9f('0x33')](_0x5b3447[_0xab9f('0x30')],_0x5b3447[_0xab9f('0x31')]);_0x1fc71a[_0xab9f('0x34')]=_['intersection'](_0x5b3447[_0xab9f('0x30')],qs['fields'](_0x5b4a88[_0xab9f('0x31')][_0xab9f('0x35')]));_0x1fc71a[_0xab9f('0x34')]=_0x1fc71a['attributes'][_0xab9f('0x36')]?_0x1fc71a['attributes']:_0x5b3447['model'];if(!_0x5b4a88['query']['hasOwnProperty'](_0xab9f('0x37'))){_0x1fc71a[_0xab9f('0x1b')]=qs[_0xab9f('0x1b')](_0x5b4a88[_0xab9f('0x31')][_0xab9f('0x1b')]);_0x1fc71a[_0xab9f('0x1d')]=qs[_0xab9f('0x1d')](_0x5b4a88[_0xab9f('0x31')]['offset']);}_0x1fc71a[_0xab9f('0x38')]=qs['sort'](_0x5b4a88[_0xab9f('0x31')][_0xab9f('0x39')]);_0x1fc71a[_0xab9f('0x3a')]=qs['filters'](_[_0xab9f('0x3b')](_0x5b4a88[_0xab9f('0x31')],_0x5b3447[_0xab9f('0x32')]),_0x62a459);if(_0x5b4a88['query'][_0xab9f('0x3c')]){_0x1fc71a[_0xab9f('0x3a')]=_[_0xab9f('0x3d')](_0x1fc71a[_0xab9f('0x3a')],{'$or':_[_0xab9f('0x2c')](_0x62a459,function(_0x4dcc2e){if(_0x4dcc2e[_0xab9f('0x2e')]!==_0xab9f('0x3e')){var _0x3f9fbb={};_0x3f9fbb[_0x4dcc2e[_0xab9f('0x29')]]={'$like':'%'+_0x5b4a88['query'][_0xab9f('0x3c')]+'%'};return _0x3f9fbb;}})});}_0x1fc71a=_[_0xab9f('0x3d')]({},_0x1fc71a,_0x5b4a88[_0xab9f('0x3f')]);var _0x483ac1={'where':_0x1fc71a[_0xab9f('0x3a')]};return db[_0xab9f('0x40')][_0xab9f('0x1c')](_0x483ac1)['then'](function(_0x2bc3d3){_0x16219a[_0xab9f('0x1c')]=_0x2bc3d3;if(_0x5b4a88['query'][_0xab9f('0x41')]){_0x1fc71a[_0xab9f('0x42')]=[{'all':!![]}];}return db[_0xab9f('0x40')][_0xab9f('0x43')](_0x1fc71a);})[_0xab9f('0x26')](function(_0x46cec9){_0x16219a[_0xab9f('0x44')]=_0x46cec9;return _0x16219a;})[_0xab9f('0x26')](respondWithFilteredResult(_0x509813,_0x1fc71a))[_0xab9f('0x45')](handleError(_0x509813,null));};exports[_0xab9f('0x46')]=function(_0x5061e3,_0x5d6f2a){var _0x3100e7={'raw':![],'where':{'id':_0x5061e3[_0xab9f('0x47')]['id']}},_0x259bf7={};_0x259bf7['model']=_[_0xab9f('0x48')](db[_0xab9f('0x40')][_0xab9f('0x2d')]);_0x259bf7[_0xab9f('0x31')]=_[_0xab9f('0x48')](_0x5061e3[_0xab9f('0x31')]);_0x259bf7[_0xab9f('0x32')]=_[_0xab9f('0x33')](_0x259bf7['model'],_0x259bf7['query']);_0x3100e7[_0xab9f('0x34')]=_['intersection'](_0x259bf7[_0xab9f('0x30')],qs[_0xab9f('0x35')](_0x5061e3[_0xab9f('0x31')][_0xab9f('0x35')]));_0x3100e7[_0xab9f('0x34')]=_0x3100e7['attributes'][_0xab9f('0x36')]?_0x3100e7[_0xab9f('0x34')]:_0x259bf7['model'];if(_0x5061e3[_0xab9f('0x31')][_0xab9f('0x41')]){_0x3100e7[_0xab9f('0x42')]=[{'all':!![]}];}_0x3100e7=_[_0xab9f('0x3d')]({},_0x3100e7,_0x5061e3['options']);return db[_0xab9f('0x40')]['find'](_0x3100e7)[_0xab9f('0x26')](handleEntityNotFound(_0x5d6f2a,null))['then'](respondWithResult(_0x5d6f2a,null))[_0xab9f('0x45')](handleError(_0x5d6f2a,null));};exports[_0xab9f('0x49')]=function(_0x357612,_0x15760c){return db[_0xab9f('0x40')][_0xab9f('0x49')](_0x357612[_0xab9f('0x4a')],{})[_0xab9f('0x26')](respondWithResult(_0x15760c,0xc9))[_0xab9f('0x45')](handleError(_0x15760c,null));};exports[_0xab9f('0x24')]=function(_0x14f637,_0x423849){if(_0x14f637[_0xab9f('0x4a')]['id']){delete _0x14f637['body']['id'];}return db[_0xab9f('0x40')][_0xab9f('0x4b')]({'where':{'id':_0x14f637[_0xab9f('0x47')]['id']}})[_0xab9f('0x26')](handleEntityNotFound(_0x423849,null))[_0xab9f('0x26')](saveUpdates(_0x14f637[_0xab9f('0x4a')],null))[_0xab9f('0x26')](respondWithResult(_0x423849,null))[_0xab9f('0x45')](handleError(_0x423849,null));};exports['destroy']=function(_0x2ad14e,_0x5acf26){return db[_0xab9f('0x40')][_0xab9f('0x4b')]({'where':{'id':_0x2ad14e[_0xab9f('0x47')]['id']}})[_0xab9f('0x26')](handleEntityNotFound(_0x5acf26,null))[_0xab9f('0x26')](removeEntity(_0x5acf26,null))[_0xab9f('0x45')](handleError(_0x5acf26,null));};exports[_0xab9f('0x4c')]=function(_0x53f01d,_0x2fe0ba,_0x21043d){var _0x5612bb={};var _0xd0b541={};var _0x4d9bd5;var _0x1285d1;return db[_0xab9f('0x40')][_0xab9f('0x4d')]({'where':{'id':_0x53f01d['params']['id']}})[_0xab9f('0x26')](handleEntityNotFound(_0x2fe0ba,null))[_0xab9f('0x26')](function(_0x48657b){if(_0x48657b){_0x4d9bd5=_0x48657b;_0xd0b541[_0xab9f('0x30')]=_['keys'](db[_0xab9f('0x4e')]['rawAttributes']);_0xd0b541[_0xab9f('0x31')]=_[_0xab9f('0x48')](_0x53f01d[_0xab9f('0x31')]);_0xd0b541['filters']=_[_0xab9f('0x33')](_0xd0b541['model'],_0xd0b541[_0xab9f('0x31')]);_0x5612bb[_0xab9f('0x34')]=_[_0xab9f('0x33')](_0xd0b541[_0xab9f('0x30')],qs['fields'](_0x53f01d[_0xab9f('0x31')][_0xab9f('0x35')]));_0x5612bb[_0xab9f('0x34')]=_0x5612bb[_0xab9f('0x34')][_0xab9f('0x36')]?_0x5612bb['attributes']:_0xd0b541[_0xab9f('0x30')];_0x5612bb[_0xab9f('0x38')]=qs[_0xab9f('0x39')](_0x53f01d[_0xab9f('0x31')][_0xab9f('0x39')]);_0x5612bb[_0xab9f('0x3a')]=qs['filters'](_[_0xab9f('0x3b')](_0x53f01d[_0xab9f('0x31')],_0xd0b541[_0xab9f('0x32')]));if(_0x53f01d[_0xab9f('0x31')][_0xab9f('0x3c')]){_0x5612bb['where']=_[_0xab9f('0x3d')](_0x5612bb[_0xab9f('0x3a')],{'$or':_[_0xab9f('0x2c')](_0x5612bb[_0xab9f('0x34')],function(_0x5799df){var _0x396f3b={};_0x396f3b[_0x5799df]={'$like':'%'+_0x53f01d['query'][_0xab9f('0x3c')]+'%'};return _0x396f3b;})});}_0x5612bb=_['merge']({},_0x5612bb,_0x53f01d['options']);return _0x4d9bd5[_0xab9f('0x4c')](_0x5612bb);}})[_0xab9f('0x26')](function(_0x274ce5){if(_0x274ce5){_0x1285d1=_0x274ce5[_0xab9f('0x36')];if(!_0x53f01d[_0xab9f('0x31')]['hasOwnProperty'](_0xab9f('0x37'))){_0x5612bb[_0xab9f('0x1b')]=qs[_0xab9f('0x1b')](_0x53f01d[_0xab9f('0x31')][_0xab9f('0x1b')]);_0x5612bb[_0xab9f('0x1d')]=qs[_0xab9f('0x1d')](_0x53f01d[_0xab9f('0x31')][_0xab9f('0x1d')]);}return _0x4d9bd5[_0xab9f('0x4c')](_0x5612bb);}})['then'](function(_0x56a510){if(_0x56a510){return _0x56a510?{'count':_0x1285d1,'rows':_0x56a510}:null;}})[_0xab9f('0x26')](respondWithResult(_0x2fe0ba,null))[_0xab9f('0x45')](handleError(_0x2fe0ba,null));};exports[_0xab9f('0x4f')]=function(_0x237c96,_0x21cc6a,_0x1871c4){if(_0x237c96['body']['id']){delete _0x237c96['body']['id'];}return db['SalesforceAccount'][_0xab9f('0x4d')]({'where':{'id':_0x237c96[_0xab9f('0x47')]['id']}})[_0xab9f('0x26')](handleEntityNotFound(_0x21cc6a,null))[_0xab9f('0x26')](function(_0x14cc15){if(_0x14cc15){_0x237c96[_0xab9f('0x4a')][_0xab9f('0x50')]=_0x14cc15['id'];_0x237c96['body'][_0xab9f('0x51')]=integrations[_0xab9f('0x52')](_0x237c96[_0xab9f('0x4a')]['channel'],_0x237c96['body'][_0xab9f('0x2e')]);_0x237c96['body'][_0xab9f('0x53')]=integrations['getDescriptions'](_0x237c96[_0xab9f('0x4a')][_0xab9f('0x54')],_0x237c96['body']['type']);return db[_0xab9f('0x4e')][_0xab9f('0x49')](_0x237c96[_0xab9f('0x4a')],{'include':[{'model':db[_0xab9f('0x55')],'as':_0xab9f('0x51')},{'model':db[_0xab9f('0x55')],'as':'Descriptions'}]});}return null;})[_0xab9f('0x26')](respondWithResult(_0x21cc6a,null))['catch'](handleError(_0x21cc6a,null));};exports[_0xab9f('0x56')]=function(_0x193010,_0x1ce04c,_0x283f96){var _0x57fbab;var _0x22462e='';var _0x1060ae=_0xab9f('0x57');return db['SalesforceAccount'][_0xab9f('0x4d')]({'where':{'id':_0x193010['params']['id']},'attributes':['id',_0xab9f('0x58'),'clientId','clientSecret','username','password',_0xab9f('0x59')]})[_0xab9f('0x26')](handleEntityNotFound(_0x1ce04c,null))[_0xab9f('0x26')](function(_0x5953e9){if(_0x5953e9){_0x22462e=_0x5953e9[_0xab9f('0x58')];var _0x49b561=_0x22462e[_0xab9f('0x5a')](-0x1);if(_0x49b561==='/'){_0x22462e=_0x22462e[_0xab9f('0x5b')](0x0,_0x22462e[_0xab9f('0x5c')](_0x49b561));}_0x57fbab=new jsforce[(_0xab9f('0x5d'))]({'oauth2':{'loginUrl':_0x22462e,'clientId':_0x5953e9[_0xab9f('0x5e')],'clientSecret':_0x5953e9['clientSecret']}});return _0x57fbab['login'](_0x5953e9['username'],_0x5953e9[_0xab9f('0x5f')][_0xab9f('0x60')](_0x5953e9[_0xab9f('0x59')]));}})[_0xab9f('0x26')](function(_0x4f0e70){if(_0x4f0e70){if(!_['isNil'](_0x193010[_0xab9f('0x31')]['ticketType'])){_0x1060ae=_0x193010[_0xab9f('0x31')][_0xab9f('0x61')];}return _0x57fbab[_0xab9f('0x62')](_0x1060ae)[_0xab9f('0x63')]();}})[_0xab9f('0x26')](function(_0x3474f7){var _0x571a3e=[_0xab9f('0x64'),_0xab9f('0x65'),_0xab9f('0x66'),'IsRecurrence','Subject',_0xab9f('0x67')];var _0xd0df75=[_0xab9f('0x68'),_0xab9f('0x69'),_0xab9f('0x6a'),'boolean',_0xab9f('0x6b'),_0xab9f('0x6c'),'phone'];if(_0x3474f7){_[_0xab9f('0x6d')](_0x3474f7[_0xab9f('0x35')],function(_0x43a7f5){return _0x571a3e[_0xab9f('0x6e')](_0x43a7f5[_0xab9f('0x29')])||!_0xd0df75[_0xab9f('0x6e')](_0x43a7f5[_0xab9f('0x2e')]);});return{'count':_0x3474f7[_0xab9f('0x35')]['length'],'rows':_[_0xab9f('0x2c')](_0x3474f7[_0xab9f('0x35')],function(_0x2677be){return{'id':_0x2677be[_0xab9f('0x29')],'name':_0x2677be[_0xab9f('0x6f')],'custom':_0x2677be[_0xab9f('0x70')],'options':_0x2677be['picklistValues'][_0xab9f('0x36')]>0x0?_['map'](_0x2677be[_0xab9f('0x71')],function(_0x151f09){return{'name':_0x151f09[_0xab9f('0x6f')],'value':_0x151f09['value']};}):_0x2677be[_0xab9f('0x2e')]==_0xab9f('0x72')?[{'name':'True','value':_0xab9f('0x73')},{'name':'False','value':'false'}]:[]};})};}})[_0xab9f('0x26')](respondWithResult(_0x1ce04c,null))['catch'](function(_0x53c35b){var _0x1eec3b=_0x193010[_0xab9f('0x31')][_0xab9f('0x74')]?0x1f4:_0x53c35b[_0xab9f('0x75')]||0x1f4;logger[_0xab9f('0x27')](_0xab9f('0x76'),_0xab9f('0x56'),_0x1eec3b,JSON['stringify'](_0x53c35b));delete _0x53c35b[_0xab9f('0x29')];if(_0x1eec3b===0x191){_0x1eec3b=0x190;}_0x1ce04c['status'](_0x1eec3b)['send'](_0x193010[_0xab9f('0x31')]['test']?{'message':_0xab9f('0x77'),'statusCode':_0x53c35b[_0xab9f('0x75')]}:_0x53c35b);});};
\ No newline at end of file
+var _0x62ff=['remoteUri','clientId','clientSecret','username','securityToken','lastIndexOf','Connection','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Description','string','int','picklist','boolean','textarea','includes','label','custom','picklistValues','value','True','true','False','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','include','findAll','rows','show','params','keys','merge','find','catch','create','body','findOne','getConfigurations','addConfiguration','getSubjects','channel','type','Descriptions','getDescriptions','SalesforceField','getFields'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x62ff,0x98));var _0xf62f=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x62ff[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0xf62f('0x0'));var rimraf=require(_0xf62f('0x1'));var zipdir=require(_0xf62f('0x2'));var jsonpatch=require(_0xf62f('0x3'));var rp=require(_0xf62f('0x4'));var moment=require(_0xf62f('0x5'));var BPromise=require(_0xf62f('0x6'));var Mustache=require(_0xf62f('0x7'));var util=require('util');var path=require(_0xf62f('0x8'));var sox=require(_0xf62f('0x9'));var csv=require('to-csv');var ejs=require(_0xf62f('0xa'));var fs=require('fs');var fs_extra=require(_0xf62f('0xb'));var _=require(_0xf62f('0xc'));var squel=require(_0xf62f('0xd'));var crypto=require('crypto');var jsforce=require(_0xf62f('0xe'));var deskjs=require(_0xf62f('0xf'));var toCsv=require(_0xf62f('0x10'));var querystring=require(_0xf62f('0x11'));var Papa=require('papaparse');var Redis=require(_0xf62f('0x12'));var authService=require(_0xf62f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf62f('0x14'));var logger=require('../../config/logger')(_0xf62f('0x15'));var utils=require(_0xf62f('0x16'));var config=require(_0xf62f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf62f('0x18'))['db'];var integrations=require(_0xf62f('0x19'));function respondWithStatusCode(_0x73716a,_0x4a50ca){_0x4a50ca=_0x4a50ca||0xcc;return function(_0xfff976){if(_0xfff976){return _0x73716a['sendStatus'](_0x4a50ca);}return _0x73716a[_0xf62f('0x1a')](_0x4a50ca)[_0xf62f('0x1b')]();};}function respondWithResult(_0x2c9ab6,_0x37a00b){_0x37a00b=_0x37a00b||0xc8;return function(_0x4037c5){if(_0x4037c5){return _0x2c9ab6[_0xf62f('0x1a')](_0x37a00b)[_0xf62f('0x1c')](_0x4037c5);}};}function respondWithFilteredResult(_0x453c46,_0x4a7a86){return function(_0x3d00f3){if(_0x3d00f3){var _0x22b4f9=typeof _0x4a7a86[_0xf62f('0x1d')]===_0xf62f('0x1e')&&typeof _0x4a7a86[_0xf62f('0x1f')]==='undefined';var _0x47b92e=_0x3d00f3['count'];var _0x9034f6=_0x22b4f9?0x0:_0x4a7a86[_0xf62f('0x1d')];var _0x2a7a03=_0x22b4f9?_0x3d00f3[_0xf62f('0x20')]:_0x4a7a86['offset']+_0x4a7a86['limit'];var _0x1e3e35;if(_0x2a7a03>=_0x47b92e){_0x2a7a03=_0x47b92e;_0x1e3e35=0xc8;}else{_0x1e3e35=0xce;}_0x453c46[_0xf62f('0x1a')](_0x1e3e35);return _0x453c46['set'](_0xf62f('0x21'),_0x9034f6+'-'+_0x2a7a03+'/'+_0x47b92e)[_0xf62f('0x1c')](_0x3d00f3);}return null;};}function patchUpdates(_0x53dbc3){return function(_0x1ba0bf){try{jsonpatch[_0xf62f('0x22')](_0x1ba0bf,_0x53dbc3,!![]);}catch(_0x4cab70){return BPromise['reject'](_0x4cab70);}return _0x1ba0bf[_0xf62f('0x23')]();};}function saveUpdates(_0x44e3ee,_0x372b81){return function(_0x4dfb14){if(_0x4dfb14){return _0x4dfb14[_0xf62f('0x24')](_0x44e3ee)[_0xf62f('0x25')](function(_0x26d6a3){return _0x26d6a3;});}return null;};}function removeEntity(_0x81f2af,_0x1daa76){return function(_0x37152b){if(_0x37152b){return _0x37152b[_0xf62f('0x26')]()[_0xf62f('0x25')](function(){_0x81f2af[_0xf62f('0x1a')](0xcc)[_0xf62f('0x1b')]();});}};}function handleEntityNotFound(_0x131aaf,_0x4cce00){return function(_0x5b7208){if(!_0x5b7208){_0x131aaf[_0xf62f('0x27')](0x194);}return _0x5b7208;};}function handleError(_0x2dd98e,_0x5711da){_0x5711da=_0x5711da||0x1f4;return function(_0x10b16e){logger[_0xf62f('0x28')](_0x10b16e[_0xf62f('0x29')]);if(_0x10b16e[_0xf62f('0x2a')]){delete _0x10b16e['name'];}_0x2dd98e['status'](_0x5711da)[_0xf62f('0x2b')](_0x10b16e);};}exports[_0xf62f('0x2c')]=function(_0x324219,_0xbadf9d){var _0x4440c4={},_0x34fc36={},_0x256a56={'count':0x0,'rows':[]};var _0x445061=_[_0xf62f('0x2d')](db[_0xf62f('0x2e')][_0xf62f('0x2f')],function(_0x36c255){return{'name':_0x36c255[_0xf62f('0x30')],'type':_0x36c255['type']['key']};});_0x34fc36[_0xf62f('0x31')]=_['map'](_0x445061,'name');_0x34fc36[_0xf62f('0x32')]=_['keys'](_0x324219[_0xf62f('0x32')]);_0x34fc36['filters']=_[_0xf62f('0x33')](_0x34fc36['model'],_0x34fc36[_0xf62f('0x32')]);_0x4440c4['attributes']=_[_0xf62f('0x33')](_0x34fc36['model'],qs[_0xf62f('0x34')](_0x324219[_0xf62f('0x32')][_0xf62f('0x34')]));_0x4440c4[_0xf62f('0x35')]=_0x4440c4[_0xf62f('0x35')][_0xf62f('0x36')]?_0x4440c4[_0xf62f('0x35')]:_0x34fc36[_0xf62f('0x31')];if(!_0x324219[_0xf62f('0x32')][_0xf62f('0x37')](_0xf62f('0x38'))){_0x4440c4[_0xf62f('0x1f')]=qs[_0xf62f('0x1f')](_0x324219[_0xf62f('0x32')]['limit']);_0x4440c4[_0xf62f('0x1d')]=qs[_0xf62f('0x1d')](_0x324219[_0xf62f('0x32')]['offset']);}_0x4440c4[_0xf62f('0x39')]=qs[_0xf62f('0x3a')](_0x324219[_0xf62f('0x32')][_0xf62f('0x3a')]);_0x4440c4[_0xf62f('0x3b')]=qs[_0xf62f('0x3c')](_[_0xf62f('0x3d')](_0x324219[_0xf62f('0x32')],_0x34fc36[_0xf62f('0x3c')]),_0x445061);if(_0x324219['query'][_0xf62f('0x3e')]){_0x4440c4['where']=_['merge'](_0x4440c4[_0xf62f('0x3b')],{'$or':_[_0xf62f('0x2d')](_0x445061,function(_0x189bbf){if(_0x189bbf['type']!==_0xf62f('0x3f')){var _0xf5f081={};_0xf5f081[_0x189bbf['name']]={'$like':'%'+_0x324219[_0xf62f('0x32')][_0xf62f('0x3e')]+'%'};return _0xf5f081;}})});}_0x4440c4=_['merge']({},_0x4440c4,_0x324219[_0xf62f('0x40')]);var _0x5672c2={'where':_0x4440c4['where']};return db[_0xf62f('0x2e')][_0xf62f('0x20')](_0x5672c2)[_0xf62f('0x25')](function(_0x424af4){_0x256a56['count']=_0x424af4;if(_0x324219[_0xf62f('0x32')]['includeAll']){_0x4440c4[_0xf62f('0x41')]=[{'all':!![]}];}return db[_0xf62f('0x2e')][_0xf62f('0x42')](_0x4440c4);})[_0xf62f('0x25')](function(_0x366688){_0x256a56[_0xf62f('0x43')]=_0x366688;return _0x256a56;})[_0xf62f('0x25')](respondWithFilteredResult(_0xbadf9d,_0x4440c4))['catch'](handleError(_0xbadf9d,null));};exports[_0xf62f('0x44')]=function(_0x232e16,_0x315e84){var _0x2ebfae={'raw':![],'where':{'id':_0x232e16[_0xf62f('0x45')]['id']}},_0x31f1eb={};_0x31f1eb[_0xf62f('0x31')]=_[_0xf62f('0x46')](db[_0xf62f('0x2e')][_0xf62f('0x2f')]);_0x31f1eb['query']=_[_0xf62f('0x46')](_0x232e16[_0xf62f('0x32')]);_0x31f1eb['filters']=_[_0xf62f('0x33')](_0x31f1eb[_0xf62f('0x31')],_0x31f1eb[_0xf62f('0x32')]);_0x2ebfae[_0xf62f('0x35')]=_[_0xf62f('0x33')](_0x31f1eb[_0xf62f('0x31')],qs[_0xf62f('0x34')](_0x232e16['query']['fields']));_0x2ebfae['attributes']=_0x2ebfae['attributes'][_0xf62f('0x36')]?_0x2ebfae[_0xf62f('0x35')]:_0x31f1eb[_0xf62f('0x31')];if(_0x232e16['query']['includeAll']){_0x2ebfae[_0xf62f('0x41')]=[{'all':!![]}];}_0x2ebfae=_[_0xf62f('0x47')]({},_0x2ebfae,_0x232e16['options']);return db[_0xf62f('0x2e')][_0xf62f('0x48')](_0x2ebfae)['then'](handleEntityNotFound(_0x315e84,null))[_0xf62f('0x25')](respondWithResult(_0x315e84,null))[_0xf62f('0x49')](handleError(_0x315e84,null));};exports[_0xf62f('0x4a')]=function(_0x11ffff,_0x521f83){return db[_0xf62f('0x2e')][_0xf62f('0x4a')](_0x11ffff[_0xf62f('0x4b')],{})[_0xf62f('0x25')](respondWithResult(_0x521f83,0xc9))[_0xf62f('0x49')](handleError(_0x521f83,null));};exports['update']=function(_0x7a1000,_0x2987d0){if(_0x7a1000['body']['id']){delete _0x7a1000['body']['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x7a1000[_0xf62f('0x45')]['id']}})[_0xf62f('0x25')](handleEntityNotFound(_0x2987d0,null))[_0xf62f('0x25')](saveUpdates(_0x7a1000['body'],null))['then'](respondWithResult(_0x2987d0,null))[_0xf62f('0x49')](handleError(_0x2987d0,null));};exports['destroy']=function(_0x216f00,_0x562548){return db[_0xf62f('0x2e')]['find']({'where':{'id':_0x216f00['params']['id']}})[_0xf62f('0x25')](handleEntityNotFound(_0x562548,null))[_0xf62f('0x25')](removeEntity(_0x562548,null))[_0xf62f('0x49')](handleError(_0x562548,null));};exports['getConfigurations']=function(_0x33291d,_0x46ae9a,_0x20ab61){var _0x17c746={};var _0x473976={};var _0x3495cf;var _0x49925c;return db[_0xf62f('0x2e')][_0xf62f('0x4c')]({'where':{'id':_0x33291d['params']['id']}})['then'](handleEntityNotFound(_0x46ae9a,null))[_0xf62f('0x25')](function(_0x5f2424){if(_0x5f2424){_0x3495cf=_0x5f2424;_0x473976['model']=_['keys'](db['SalesforceConfiguration']['rawAttributes']);_0x473976[_0xf62f('0x32')]=_['keys'](_0x33291d[_0xf62f('0x32')]);_0x473976[_0xf62f('0x3c')]=_[_0xf62f('0x33')](_0x473976[_0xf62f('0x31')],_0x473976[_0xf62f('0x32')]);_0x17c746['attributes']=_[_0xf62f('0x33')](_0x473976[_0xf62f('0x31')],qs['fields'](_0x33291d[_0xf62f('0x32')]['fields']));_0x17c746[_0xf62f('0x35')]=_0x17c746[_0xf62f('0x35')][_0xf62f('0x36')]?_0x17c746[_0xf62f('0x35')]:_0x473976[_0xf62f('0x31')];_0x17c746[_0xf62f('0x39')]=qs[_0xf62f('0x3a')](_0x33291d['query'][_0xf62f('0x3a')]);_0x17c746[_0xf62f('0x3b')]=qs['filters'](_[_0xf62f('0x3d')](_0x33291d[_0xf62f('0x32')],_0x473976[_0xf62f('0x3c')]));if(_0x33291d['query']['filter']){_0x17c746['where']=_[_0xf62f('0x47')](_0x17c746[_0xf62f('0x3b')],{'$or':_[_0xf62f('0x2d')](_0x17c746[_0xf62f('0x35')],function(_0xa319db){var _0x23e131={};_0x23e131[_0xa319db]={'$like':'%'+_0x33291d[_0xf62f('0x32')][_0xf62f('0x3e')]+'%'};return _0x23e131;})});}_0x17c746=_[_0xf62f('0x47')]({},_0x17c746,_0x33291d[_0xf62f('0x40')]);return _0x3495cf[_0xf62f('0x4d')](_0x17c746);}})['then'](function(_0xf56eba){if(_0xf56eba){_0x49925c=_0xf56eba['length'];if(!_0x33291d[_0xf62f('0x32')][_0xf62f('0x37')](_0xf62f('0x38'))){_0x17c746[_0xf62f('0x1f')]=qs[_0xf62f('0x1f')](_0x33291d[_0xf62f('0x32')][_0xf62f('0x1f')]);_0x17c746[_0xf62f('0x1d')]=qs[_0xf62f('0x1d')](_0x33291d[_0xf62f('0x32')][_0xf62f('0x1d')]);}return _0x3495cf[_0xf62f('0x4d')](_0x17c746);}})[_0xf62f('0x25')](function(_0x21a2dc){if(_0x21a2dc){return _0x21a2dc?{'count':_0x49925c,'rows':_0x21a2dc}:null;}})[_0xf62f('0x25')](respondWithResult(_0x46ae9a,null))[_0xf62f('0x49')](handleError(_0x46ae9a,null));};exports[_0xf62f('0x4e')]=function(_0x463233,_0x595bc8,_0x2c0f47){if(_0x463233[_0xf62f('0x4b')]['id']){delete _0x463233[_0xf62f('0x4b')]['id'];}return db[_0xf62f('0x2e')]['findOne']({'where':{'id':_0x463233[_0xf62f('0x45')]['id']}})['then'](handleEntityNotFound(_0x595bc8,null))[_0xf62f('0x25')](function(_0x5c3976){if(_0x5c3976){_0x463233[_0xf62f('0x4b')]['AccountId']=_0x5c3976['id'];_0x463233[_0xf62f('0x4b')]['Subjects']=integrations[_0xf62f('0x4f')](_0x463233[_0xf62f('0x4b')][_0xf62f('0x50')],_0x463233[_0xf62f('0x4b')][_0xf62f('0x51')]);_0x463233['body'][_0xf62f('0x52')]=integrations[_0xf62f('0x53')](_0x463233['body'][_0xf62f('0x50')],_0x463233[_0xf62f('0x4b')][_0xf62f('0x51')]);return db['SalesforceConfiguration']['create'](_0x463233[_0xf62f('0x4b')],{'include':[{'model':db[_0xf62f('0x54')],'as':'Subjects'},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0xf62f('0x25')](respondWithResult(_0x595bc8,null))['catch'](handleError(_0x595bc8,null));};exports[_0xf62f('0x55')]=function(_0x10dc9a,_0x20849f,_0x3a6668){var _0x227d7c;var _0x3b2daa='';var _0x471424='Task';return db['SalesforceAccount'][_0xf62f('0x4c')]({'where':{'id':_0x10dc9a[_0xf62f('0x45')]['id']},'attributes':['id',_0xf62f('0x56'),_0xf62f('0x57'),_0xf62f('0x58'),_0xf62f('0x59'),'password',_0xf62f('0x5a')]})[_0xf62f('0x25')](handleEntityNotFound(_0x20849f,null))[_0xf62f('0x25')](function(_0x41eec9){if(_0x41eec9){_0x3b2daa=_0x41eec9['remoteUri'];var _0xe3c3fa=_0x3b2daa['slice'](-0x1);if(_0xe3c3fa==='/'){_0x3b2daa=_0x3b2daa['substring'](0x0,_0x3b2daa[_0xf62f('0x5b')](_0xe3c3fa));}_0x227d7c=new jsforce[(_0xf62f('0x5c'))]({'oauth2':{'loginUrl':_0x3b2daa,'clientId':_0x41eec9[_0xf62f('0x57')],'clientSecret':_0x41eec9[_0xf62f('0x58')]}});return _0x227d7c['login'](_0x41eec9['username'],_0x41eec9['password']['concat'](_0x41eec9[_0xf62f('0x5a')]));}})[_0xf62f('0x25')](function(_0x28de0f){if(_0x28de0f){if(!_[_0xf62f('0x5d')](_0x10dc9a[_0xf62f('0x32')][_0xf62f('0x5e')])){_0x471424=_0x10dc9a[_0xf62f('0x32')]['ticketType'];}return _0x227d7c[_0xf62f('0x5f')](_0x471424)[_0xf62f('0x60')]();}})['then'](function(_0x4276fd){var _0x5b14b7=['OwnerId',_0xf62f('0x61'),_0xf62f('0x62'),_0xf62f('0x63'),'Subject',_0xf62f('0x64')];var _0x2cbd6b=[_0xf62f('0x65'),_0xf62f('0x66'),_0xf62f('0x67'),_0xf62f('0x68'),'email',_0xf62f('0x69'),'phone'];if(_0x4276fd){_['remove'](_0x4276fd[_0xf62f('0x34')],function(_0x5747c0){return _0x5b14b7['includes'](_0x5747c0['name'])||!_0x2cbd6b[_0xf62f('0x6a')](_0x5747c0[_0xf62f('0x51')]);});return{'count':_0x4276fd['fields'][_0xf62f('0x36')],'rows':_[_0xf62f('0x2d')](_0x4276fd[_0xf62f('0x34')],function(_0x5ed26a){return{'id':_0x5ed26a[_0xf62f('0x2a')],'name':_0x5ed26a[_0xf62f('0x6b')],'custom':_0x5ed26a[_0xf62f('0x6c')],'options':_0x5ed26a[_0xf62f('0x6d')][_0xf62f('0x36')]>0x0?_[_0xf62f('0x2d')](_0x5ed26a['picklistValues'],function(_0x5effa4){return{'name':_0x5effa4[_0xf62f('0x6b')],'value':_0x5effa4[_0xf62f('0x6e')]};}):_0x5ed26a[_0xf62f('0x51')]==_0xf62f('0x68')?[{'name':_0xf62f('0x6f'),'value':_0xf62f('0x70')},{'name':_0xf62f('0x71'),'value':'false'}]:[]};})};}})[_0xf62f('0x25')](respondWithResult(_0x20849f,null))['catch'](function(_0x23530f){var _0x5ab594=_0x10dc9a[_0xf62f('0x32')]['test']?0x1f4:_0x23530f[_0xf62f('0x72')]||0x1f4;logger[_0xf62f('0x28')](_0xf62f('0x73'),_0xf62f('0x55'),_0x5ab594,JSON[_0xf62f('0x74')](_0x23530f));delete _0x23530f['name'];if(_0x5ab594===0x191){_0x5ab594=0x190;}_0x20849f[_0xf62f('0x1a')](_0x5ab594)[_0xf62f('0x2b')](_0x10dc9a['query'][_0xf62f('0x75')]?{'message':_0xf62f('0x76'),'statusCode':_0x23530f[_0xf62f('0x72')]}:_0x23530f);});};
\ No newline at end of file
index 4cb329d..91888b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc594=['../../config/logger','api','moment','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util'];(function(_0x13fdea,_0x58e82c){var _0x344499=function(_0x468218){while(--_0x468218){_0x13fdea['push'](_0x13fdea['shift']());}};_0x344499(++_0x58e82c);}(_0xc594,0x132));var _0x4c59=function(_0x451fa4,_0x41bbf5){_0x451fa4=_0x451fa4-0x0;var _0x1b90f7=_0xc594[_0x451fa4];return _0x1b90f7;};'use strict';var _=require(_0x4c59('0x0'));var util=require(_0x4c59('0x1'));var logger=require(_0x4c59('0x2'))(_0x4c59('0x3'));var moment=require(_0x4c59('0x4'));var BPromise=require('bluebird');var rp=require(_0x4c59('0x5'));var fs=require('fs');var path=require(_0x4c59('0x6'));var rimraf=require(_0x4c59('0x7'));var config=require('../../config/environment');var attributes=require(_0x4c59('0x8'));var integrations=require(_0x4c59('0x9'));module[_0x4c59('0xa')]=function(_0x165c8b,_0x45298a){return _0x165c8b[_0x4c59('0xb')](_0x4c59('0xc'),attributes,{'tableName':_0x4c59('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8cb4=['exports','define','SalesforceAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x295e7f,_0x1a4d59){var _0xdb8b56=function(_0x41e909){while(--_0x41e909){_0x295e7f['push'](_0x295e7f['shift']());}};_0xdb8b56(++_0x1a4d59);}(_0x8cb4,0xf3));var _0x48cb=function(_0x59df36,_0x1abdb0){_0x59df36=_0x59df36-0x0;var _0x18ae6d=_0x8cb4[_0x59df36];return _0x18ae6d;};'use strict';var _=require(_0x48cb('0x0'));var util=require(_0x48cb('0x1'));var logger=require(_0x48cb('0x2'))('api');var moment=require(_0x48cb('0x3'));var BPromise=require(_0x48cb('0x4'));var rp=require(_0x48cb('0x5'));var fs=require('fs');var path=require(_0x48cb('0x6'));var rimraf=require(_0x48cb('0x7'));var config=require(_0x48cb('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x48cb('0x9')]=function(_0x2fd844,_0x3471c5){return _0x2fd844[_0x48cb('0xa')](_0x48cb('0xb'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 992eeaa..0a4b1e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaaf5=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model','ShowSalesforceAccount','find','raw'];(function(_0x585e55,_0x2f9c3b){var _0x4d2ee2=function(_0x5b81ce){while(--_0x5b81ce){_0x585e55['push'](_0x585e55['shift']());}};_0x4d2ee2(++_0x2f9c3b);}(_0xaaf5,0x14d));var _0x5aaf=function(_0x4812df,_0xb2d9c8){_0x4812df=_0x4812df-0x0;var _0x286758=_0xaaf5[_0x4812df];return _0x286758;};'use strict';var _=require(_0x5aaf('0x0'));var util=require(_0x5aaf('0x1'));var moment=require(_0x5aaf('0x2'));var BPromise=require(_0x5aaf('0x3'));var rs=require(_0x5aaf('0x4'));var fs=require('fs');var Redis=require(_0x5aaf('0x5'));var db=require(_0x5aaf('0x6'))['db'];var utils=require(_0x5aaf('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x5aaf('0x8'));var jayson=require(_0x5aaf('0x9'));var client=jayson[_0x5aaf('0xa')][_0x5aaf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4eba00,_0x5edeb3,_0x1a2c42){return new BPromise(function(_0x37e49d,_0x3f7fed){return client[_0x5aaf('0xc')](_0x4eba00,_0x1a2c42)[_0x5aaf('0xd')](function(_0x4bb630){logger[_0x5aaf('0xe')](_0x5aaf('0xf'),_0x5edeb3,_0x5aaf('0x10'));logger[_0x5aaf('0x11')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x5edeb3,_0x5aaf('0x10'),JSON[_0x5aaf('0x12')](_0x4bb630));if(_0x4bb630['error']){if(_0x4bb630[_0x5aaf('0x13')][_0x5aaf('0x14')]===0x1f4){logger['error'](_0x5aaf('0xf'),_0x5edeb3,_0x4bb630[_0x5aaf('0x13')][_0x5aaf('0x15')]);return _0x3f7fed(_0x4bb630[_0x5aaf('0x13')][_0x5aaf('0x15')]);}logger[_0x5aaf('0x13')](_0x5aaf('0xf'),_0x5edeb3,_0x4bb630[_0x5aaf('0x13')]['message']);return _0x37e49d(_0x4bb630[_0x5aaf('0x13')][_0x5aaf('0x15')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x5edeb3,_0x5aaf('0x10'));_0x37e49d(_0x4bb630[_0x5aaf('0x16')][_0x5aaf('0x15')]);}})[_0x5aaf('0x17')](function(_0x32543d){logger[_0x5aaf('0x13')](_0x5aaf('0xf'),_0x5edeb3,_0x32543d);_0x3f7fed(_0x32543d);});});}exports[_0x5aaf('0x18')]=function(_0x1897e3){var _0x4e6fc3=this;return new Promise(function(_0x6ed455,_0x3dd3e9){return db[_0x5aaf('0x19')][_0x5aaf('0x1a')]({'raw':_0x1897e3[_0x5aaf('0x1b')]?_0x1897e3['options']['raw']===undefined?!![]:![]:!![],'where':_0x1897e3[_0x5aaf('0x1b')]?_0x1897e3['options'][_0x5aaf('0x1c')]||null:null,'attributes':_0x1897e3[_0x5aaf('0x1b')]?_0x1897e3[_0x5aaf('0x1b')][_0x5aaf('0x1d')]||null:null,'limit':_0x1897e3[_0x5aaf('0x1b')]?_0x1897e3['options'][_0x5aaf('0x1e')]||null:null,'include':_0x1897e3[_0x5aaf('0x1b')]?_0x1897e3[_0x5aaf('0x1b')][_0x5aaf('0x1f')]?_[_0x5aaf('0x20')](_0x1897e3[_0x5aaf('0x1b')][_0x5aaf('0x1f')],function(_0x2954e8){return{'model':db[_0x2954e8[_0x5aaf('0x21')]],'as':_0x2954e8['as'],'attributes':_0x2954e8['attributes'],'include':_0x2954e8[_0x5aaf('0x1f')]?_[_0x5aaf('0x20')](_0x2954e8['include'],function(_0x317247){return{'model':db[_0x317247[_0x5aaf('0x21')]],'as':_0x317247['as'],'attributes':_0x317247['attributes'],'include':_0x317247[_0x5aaf('0x1f')]?_[_0x5aaf('0x20')](_0x317247[_0x5aaf('0x1f')],function(_0x556f2d){return{'model':db[_0x556f2d[_0x5aaf('0x21')]],'as':_0x556f2d['as'],'attributes':_0x556f2d[_0x5aaf('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5aaf('0xd')](function(_0x28289e){logger['info'](_0x5aaf('0x18'),_0x1897e3);logger[_0x5aaf('0x11')](_0x5aaf('0x18'),_0x1897e3,JSON[_0x5aaf('0x12')](_0x28289e));_0x6ed455(_0x28289e);})[_0x5aaf('0x17')](function(_0x223624){logger[_0x5aaf('0x13')](_0x5aaf('0x18'),_0x223624[_0x5aaf('0x15')],_0x1897e3);_0x3dd3e9(_0x4e6fc3[_0x5aaf('0x13')](0x1f4,_0x223624[_0x5aaf('0x15')]));});});};exports[_0x5aaf('0x22')]=function(_0x515017){var _0x1ced75=this;return new Promise(function(_0x4b2be0,_0x45ec68){return db[_0x5aaf('0x19')][_0x5aaf('0x23')]({'raw':_0x515017['options']?_0x515017['options'][_0x5aaf('0x24')]===undefined?!![]:![]:!![],'where':_0x515017[_0x5aaf('0x1b')]?_0x515017['options']['where']||null:null,'attributes':_0x515017[_0x5aaf('0x1b')]?_0x515017[_0x5aaf('0x1b')]['attributes']||null:null,'include':_0x515017[_0x5aaf('0x1b')]?_0x515017[_0x5aaf('0x1b')]['include']?_['map'](_0x515017[_0x5aaf('0x1b')][_0x5aaf('0x1f')],function(_0x1c73d5){return{'model':db[_0x1c73d5[_0x5aaf('0x21')]],'as':_0x1c73d5['as'],'attributes':_0x1c73d5[_0x5aaf('0x1d')],'include':_0x1c73d5[_0x5aaf('0x1f')]?_[_0x5aaf('0x20')](_0x1c73d5['include'],function(_0x123f2c){return{'model':db[_0x123f2c[_0x5aaf('0x21')]],'as':_0x123f2c['as'],'attributes':_0x123f2c[_0x5aaf('0x1d')],'include':_0x123f2c[_0x5aaf('0x1f')]?_[_0x5aaf('0x20')](_0x123f2c['include'],function(_0x5b4860){return{'model':db[_0x5b4860[_0x5aaf('0x21')]],'as':_0x5b4860['as'],'attributes':_0x5b4860['attributes']};}):[]};}):[]};}):[]:[]})[_0x5aaf('0xd')](function(_0x11bfa5){logger['info'](_0x5aaf('0x22'),_0x515017);logger[_0x5aaf('0x11')](_0x5aaf('0x22'),_0x515017,JSON[_0x5aaf('0x12')](_0x11bfa5));_0x4b2be0(_0x11bfa5);})['catch'](function(_0x2bf7f4){logger[_0x5aaf('0x13')](_0x5aaf('0x22'),_0x2bf7f4[_0x5aaf('0x15')],_0x515017);_0x45ec68(_0x1ced75[_0x5aaf('0x13')](0x1f4,_0x2bf7f4[_0x5aaf('0x15')]));});});};
\ No newline at end of file
+var _0x945e=['../../config/logger','../../config/environment','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x945e,0x14e));var _0xe945=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x945e[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xe945('0x0'));var util=require(_0xe945('0x1'));var moment=require(_0xe945('0x2'));var BPromise=require(_0xe945('0x3'));var rs=require(_0xe945('0x4'));var fs=require('fs');var Redis=require(_0xe945('0x5'));var db=require(_0xe945('0x6'))['db'];var utils=require(_0xe945('0x7'));var logger=require(_0xe945('0x8'))('rpc');var config=require(_0xe945('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe945('0xa')][_0xe945('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7aba83,_0x606acf,_0x45b044){return new BPromise(function(_0x531756,_0x23c820){return client[_0xe945('0xc')](_0x7aba83,_0x45b044)[_0xe945('0xd')](function(_0x5cd960){logger[_0xe945('0xe')](_0xe945('0xf'),_0x606acf,_0xe945('0x10'));logger[_0xe945('0x11')](_0xe945('0x12'),_0x606acf,'request\x20sent',JSON[_0xe945('0x13')](_0x5cd960));if(_0x5cd960['error']){if(_0x5cd960[_0xe945('0x14')][_0xe945('0x15')]===0x1f4){logger[_0xe945('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x606acf,_0x5cd960[_0xe945('0x14')]['message']);return _0x23c820(_0x5cd960['error'][_0xe945('0x16')]);}logger[_0xe945('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x606acf,_0x5cd960[_0xe945('0x14')][_0xe945('0x16')]);return _0x531756(_0x5cd960[_0xe945('0x14')][_0xe945('0x16')]);}else{logger[_0xe945('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x606acf,'request\x20sent');_0x531756(_0x5cd960[_0xe945('0x17')][_0xe945('0x16')]);}})[_0xe945('0x18')](function(_0x2cbd29){logger[_0xe945('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x606acf,_0x2cbd29);_0x23c820(_0x2cbd29);});});}exports['GetSalesforceAccount']=function(_0x17d8ed){var _0x3d9694=this;return new Promise(function(_0x2f214f,_0x55f04e){return db[_0xe945('0x19')][_0xe945('0x1a')]({'raw':_0x17d8ed[_0xe945('0x1b')]?_0x17d8ed[_0xe945('0x1b')][_0xe945('0x1c')]===undefined?!![]:![]:!![],'where':_0x17d8ed[_0xe945('0x1b')]?_0x17d8ed[_0xe945('0x1b')][_0xe945('0x1d')]||null:null,'attributes':_0x17d8ed[_0xe945('0x1b')]?_0x17d8ed[_0xe945('0x1b')][_0xe945('0x1e')]||null:null,'limit':_0x17d8ed[_0xe945('0x1b')]?_0x17d8ed['options'][_0xe945('0x1f')]||null:null,'include':_0x17d8ed[_0xe945('0x1b')]?_0x17d8ed[_0xe945('0x1b')][_0xe945('0x20')]?_[_0xe945('0x21')](_0x17d8ed[_0xe945('0x1b')][_0xe945('0x20')],function(_0x5e3f50){return{'model':db[_0x5e3f50[_0xe945('0x22')]],'as':_0x5e3f50['as'],'attributes':_0x5e3f50[_0xe945('0x1e')],'include':_0x5e3f50['include']?_[_0xe945('0x21')](_0x5e3f50[_0xe945('0x20')],function(_0x1fc8bb){return{'model':db[_0x1fc8bb[_0xe945('0x22')]],'as':_0x1fc8bb['as'],'attributes':_0x1fc8bb[_0xe945('0x1e')],'include':_0x1fc8bb[_0xe945('0x20')]?_[_0xe945('0x21')](_0x1fc8bb[_0xe945('0x20')],function(_0x282a86){return{'model':db[_0x282a86[_0xe945('0x22')]],'as':_0x282a86['as'],'attributes':_0x282a86[_0xe945('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe945('0xd')](function(_0x51cf10){logger[_0xe945('0xe')](_0xe945('0x23'),_0x17d8ed);logger[_0xe945('0x11')](_0xe945('0x23'),_0x17d8ed,JSON[_0xe945('0x13')](_0x51cf10));_0x2f214f(_0x51cf10);})[_0xe945('0x18')](function(_0x476968){logger['error'](_0xe945('0x23'),_0x476968[_0xe945('0x16')],_0x17d8ed);_0x55f04e(_0x3d9694[_0xe945('0x14')](0x1f4,_0x476968[_0xe945('0x16')]));});});};exports[_0xe945('0x24')]=function(_0x69d72f){var _0x3a673b=this;return new Promise(function(_0x4aa1e2,_0x38485b){return db[_0xe945('0x19')][_0xe945('0x25')]({'raw':_0x69d72f[_0xe945('0x1b')]?_0x69d72f[_0xe945('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x69d72f[_0xe945('0x1b')]?_0x69d72f[_0xe945('0x1b')][_0xe945('0x1d')]||null:null,'attributes':_0x69d72f[_0xe945('0x1b')]?_0x69d72f[_0xe945('0x1b')][_0xe945('0x1e')]||null:null,'include':_0x69d72f[_0xe945('0x1b')]?_0x69d72f[_0xe945('0x1b')][_0xe945('0x20')]?_[_0xe945('0x21')](_0x69d72f[_0xe945('0x1b')]['include'],function(_0x466ac0){return{'model':db[_0x466ac0[_0xe945('0x22')]],'as':_0x466ac0['as'],'attributes':_0x466ac0[_0xe945('0x1e')],'include':_0x466ac0['include']?_['map'](_0x466ac0['include'],function(_0x5c8309){return{'model':db[_0x5c8309['model']],'as':_0x5c8309['as'],'attributes':_0x5c8309[_0xe945('0x1e')],'include':_0x5c8309[_0xe945('0x20')]?_[_0xe945('0x21')](_0x5c8309[_0xe945('0x20')],function(_0xc6f46){return{'model':db[_0xc6f46[_0xe945('0x22')]],'as':_0xc6f46['as'],'attributes':_0xc6f46[_0xe945('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe945('0xd')](function(_0x495003){logger[_0xe945('0xe')](_0xe945('0x24'),_0x69d72f);logger[_0xe945('0x11')](_0xe945('0x24'),_0x69d72f,JSON['stringify'](_0x495003));_0x4aa1e2(_0x495003);})[_0xe945('0x18')](function(_0x59242e){logger[_0xe945('0x14')](_0xe945('0x24'),_0x59242e['message'],_0x69d72f);_0x38485b(_0x3a673b[_0xe945('0x14')](0x1f4,_0x59242e[_0xe945('0x16')]));});});};
\ No newline at end of file
index 7d4e4bc..d6c8c92 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0xcc18cf,_0x29f1d0){var _0x11aada=function(_0x417814){while(--_0x417814){_0xcc18cf['push'](_0xcc18cf['shift']());}};_0x11aada(++_0x29f1d0);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router;
\ No newline at end of file
+var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4e691a,_0x33e1a2){var _0x3998a7=function(_0x22618d){while(--_0x22618d){_0x4e691a['push'](_0x4e691a['shift']());}};_0x3998a7(++_0x33e1a2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4578df,_0x5c5ff0){_0x4578df=_0x4578df-0x0;var _0x360f93=_0x5f2f[_0x4578df];return _0x360f93;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router;
\ No newline at end of file
index 3ef4096..92862da 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbaaf=['account_contact_lead','account','nothing','contact','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','lead'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbaaf,0x1a8));var _0xfbaa=function(_0xe8b616,_0x53d9e6){_0xe8b616=_0xe8b616-0x0;var _0x2c73ba=_0xbaaf[_0xe8b616];return _0x2c73ba;};'use strict';var Sequelize=require(_0xfbaa('0x0'));module[_0xfbaa('0x1')]={'name':{'type':Sequelize[_0xfbaa('0x2')]},'description':{'type':Sequelize[_0xfbaa('0x2')]},'ticketType':{'type':Sequelize[_0xfbaa('0x3')](_0xfbaa('0x4'),_0xfbaa('0x5')),'defaultValue':_0xfbaa('0x4')},'moduleSearch':{'type':Sequelize[_0xfbaa('0x3')](_0xfbaa('0x6'),'contact',_0xfbaa('0x7'),_0xfbaa('0x8'),_0xfbaa('0x9')),'defaultValue':_0xfbaa('0x6')},'moduleCreate':{'type':Sequelize[_0xfbaa('0x3')](_0xfbaa('0xa'),_0xfbaa('0xb'),_0xfbaa('0x7'),'account'),'defaultValue':_0xfbaa('0x7')},'leadId':{'type':Sequelize[_0xfbaa('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xfbaa('0x2')]}};
\ No newline at end of file
+var _0xc759=['exports','STRING','ENUM','Task','contact','account_contact_lead','account','contact_lead','nothing','lead','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc759,0x78));var _0x9c75=function(_0x2efe4c,_0x23945b){_0x2efe4c=_0x2efe4c-0x0;var _0x5d7465=_0xc759[_0x2efe4c];return _0x5d7465;};'use strict';var Sequelize=require(_0x9c75('0x0'));module[_0x9c75('0x1')]={'name':{'type':Sequelize[_0x9c75('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x9c75('0x3')](_0x9c75('0x4'),'Case'),'defaultValue':_0x9c75('0x4')},'moduleSearch':{'type':Sequelize[_0x9c75('0x3')]('contact_lead',_0x9c75('0x5'),'lead',_0x9c75('0x6'),_0x9c75('0x7')),'defaultValue':_0x9c75('0x8')},'moduleCreate':{'type':Sequelize[_0x9c75('0x3')](_0x9c75('0x9'),_0x9c75('0x5'),_0x9c75('0xa'),'account'),'defaultValue':_0x9c75('0xa')},'leadId':{'type':Sequelize[_0x9c75('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x9c75('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x9c75('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x9c75('0x2')]}};
\ No newline at end of file
index 8db714e..d3f4969 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8c25=['length','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','params','create','body','find','getFields','findOne','getSubjects','SalesforceField','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x181a0a,_0x2a9c1d){var _0x16df0c=function(_0x4bf52a){while(--_0x4bf52a){_0x181a0a['push'](_0x181a0a['shift']());}};_0x16df0c(++_0x2a9c1d);}(_0x8c25,0x15e));var _0x58c2=function(_0x1abc8d,_0x1e9760){_0x1abc8d=_0x1abc8d-0x0;var _0xa3c72f=_0x8c25[_0x1abc8d];return _0xa3c72f;};'use strict';var emlformat=require(_0x58c2('0x0'));var rimraf=require(_0x58c2('0x1'));var zipdir=require(_0x58c2('0x2'));var jsonpatch=require(_0x58c2('0x3'));var rp=require(_0x58c2('0x4'));var moment=require(_0x58c2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x58c2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x58c2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x58c2('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x58c2('0x9'));var jsforce=require(_0x58c2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x58c2('0x7'));var querystring=require(_0x58c2('0xb'));var Papa=require(_0x58c2('0xc'));var Redis=require(_0x58c2('0xd'));var authService=require(_0x58c2('0xe'));var qs=require(_0x58c2('0xf'));var as=require(_0x58c2('0x10'));var hardwareService=require(_0x58c2('0x11'));var logger=require('../../config/logger')(_0x58c2('0x12'));var utils=require(_0x58c2('0x13'));var config=require(_0x58c2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x58c2('0x15'))['db'];function respondWithStatusCode(_0x4454a6,_0x3bd7fc){_0x3bd7fc=_0x3bd7fc||0xcc;return function(_0x378fd2){if(_0x378fd2){return _0x4454a6[_0x58c2('0x16')](_0x3bd7fc);}return _0x4454a6[_0x58c2('0x17')](_0x3bd7fc)[_0x58c2('0x18')]();};}function respondWithResult(_0x3cbe45,_0x1a9306){_0x1a9306=_0x1a9306||0xc8;return function(_0xe79567){if(_0xe79567){return _0x3cbe45['status'](_0x1a9306)['json'](_0xe79567);}};}function respondWithFilteredResult(_0x428dd7,_0x752290){return function(_0x346efe){if(_0x346efe){var _0x20d6d6=typeof _0x752290[_0x58c2('0x19')]==='undefined'&&typeof _0x752290[_0x58c2('0x1a')]===_0x58c2('0x1b');var _0x4a94c6=_0x346efe['count'];var _0x55d76b=_0x20d6d6?0x0:_0x752290[_0x58c2('0x19')];var _0x4924c6=_0x20d6d6?_0x346efe['count']:_0x752290['offset']+_0x752290['limit'];var _0x4083ef;if(_0x4924c6>=_0x4a94c6){_0x4924c6=_0x4a94c6;_0x4083ef=0xc8;}else{_0x4083ef=0xce;}_0x428dd7[_0x58c2('0x17')](_0x4083ef);return _0x428dd7[_0x58c2('0x1c')](_0x58c2('0x1d'),_0x55d76b+'-'+_0x4924c6+'/'+_0x4a94c6)[_0x58c2('0x1e')](_0x346efe);}return null;};}function patchUpdates(_0x367400){return function(_0x58b064){try{jsonpatch[_0x58c2('0x1f')](_0x58b064,_0x367400,!![]);}catch(_0xbcdbcc){return BPromise[_0x58c2('0x20')](_0xbcdbcc);}return _0x58b064[_0x58c2('0x21')]();};}function saveUpdates(_0x59f55c,_0x34c54b){return function(_0x148d67){if(_0x148d67){return _0x148d67[_0x58c2('0x22')](_0x59f55c)[_0x58c2('0x23')](function(_0x21f3de){return _0x21f3de;});}return null;};}function removeEntity(_0x224fde,_0x7800b2){return function(_0x1f42da){if(_0x1f42da){return _0x1f42da[_0x58c2('0x24')]()[_0x58c2('0x23')](function(){_0x224fde[_0x58c2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dc27e,_0xe95092){return function(_0x2481fa){if(!_0x2481fa){_0x4dc27e[_0x58c2('0x16')](0x194);}return _0x2481fa;};}function handleError(_0x36f38e,_0x333e38){_0x333e38=_0x333e38||0x1f4;return function(_0x3f42cd){logger[_0x58c2('0x25')](_0x3f42cd[_0x58c2('0x26')]);if(_0x3f42cd[_0x58c2('0x27')]){delete _0x3f42cd[_0x58c2('0x27')];}_0x36f38e[_0x58c2('0x17')](_0x333e38)[_0x58c2('0x28')](_0x3f42cd);};}exports[_0x58c2('0x29')]=function(_0xda8f66,_0x1487da){var _0x2e4546={},_0x543745={},_0x2ce592={'count':0x0,'rows':[]};var _0x40d5aa=_[_0x58c2('0x2a')](db[_0x58c2('0x2b')][_0x58c2('0x2c')],function(_0x2544fa){return{'name':_0x2544fa[_0x58c2('0x2d')],'type':_0x2544fa[_0x58c2('0x2e')][_0x58c2('0x2f')]};});_0x543745[_0x58c2('0x30')]=_[_0x58c2('0x2a')](_0x40d5aa,_0x58c2('0x27'));_0x543745[_0x58c2('0x31')]=_[_0x58c2('0x32')](_0xda8f66[_0x58c2('0x31')]);_0x543745[_0x58c2('0x33')]=_[_0x58c2('0x34')](_0x543745['model'],_0x543745['query']);_0x2e4546[_0x58c2('0x35')]=_[_0x58c2('0x34')](_0x543745['model'],qs[_0x58c2('0x36')](_0xda8f66['query']['fields']));_0x2e4546['attributes']=_0x2e4546[_0x58c2('0x35')][_0x58c2('0x37')]?_0x2e4546['attributes']:_0x543745[_0x58c2('0x30')];if(!_0xda8f66[_0x58c2('0x31')][_0x58c2('0x38')](_0x58c2('0x39'))){_0x2e4546['limit']=qs[_0x58c2('0x1a')](_0xda8f66[_0x58c2('0x31')]['limit']);_0x2e4546[_0x58c2('0x19')]=qs[_0x58c2('0x19')](_0xda8f66[_0x58c2('0x31')][_0x58c2('0x19')]);}_0x2e4546[_0x58c2('0x3a')]=qs[_0x58c2('0x3b')](_0xda8f66[_0x58c2('0x31')][_0x58c2('0x3b')]);_0x2e4546['where']=qs['filters'](_['pick'](_0xda8f66[_0x58c2('0x31')],_0x543745[_0x58c2('0x33')]),_0x40d5aa);if(_0xda8f66[_0x58c2('0x31')]['filter']){_0x2e4546['where']=_[_0x58c2('0x3c')](_0x2e4546[_0x58c2('0x3d')],{'$or':_['map'](_0x40d5aa,function(_0x3ef5b7){if(_0x3ef5b7['type']!==_0x58c2('0x3e')){var _0xc8292c={};_0xc8292c[_0x3ef5b7[_0x58c2('0x27')]]={'$like':'%'+_0xda8f66[_0x58c2('0x31')][_0x58c2('0x3f')]+'%'};return _0xc8292c;}})});}_0x2e4546=_[_0x58c2('0x3c')]({},_0x2e4546,_0xda8f66[_0x58c2('0x40')]);var _0x59b808={'where':_0x2e4546[_0x58c2('0x3d')]};return db[_0x58c2('0x2b')][_0x58c2('0x41')](_0x59b808)[_0x58c2('0x23')](function(_0x1e349f){_0x2ce592['count']=_0x1e349f;if(_0xda8f66[_0x58c2('0x31')][_0x58c2('0x42')]){_0x2e4546[_0x58c2('0x43')]=[{'all':!![]}];}return db[_0x58c2('0x2b')][_0x58c2('0x44')](_0x2e4546);})['then'](function(_0x1fdb04){_0x2ce592[_0x58c2('0x45')]=_0x1fdb04;return _0x2ce592;})[_0x58c2('0x23')](respondWithFilteredResult(_0x1487da,_0x2e4546))[_0x58c2('0x46')](handleError(_0x1487da,null));};exports['show']=function(_0x4db4f5,_0x17072a){var _0x5bd179={'raw':![],'where':{'id':_0x4db4f5[_0x58c2('0x47')]['id']}},_0x46f284={};_0x46f284['model']=_[_0x58c2('0x32')](db[_0x58c2('0x2b')][_0x58c2('0x2c')]);_0x46f284[_0x58c2('0x31')]=_[_0x58c2('0x32')](_0x4db4f5['query']);_0x46f284[_0x58c2('0x33')]=_[_0x58c2('0x34')](_0x46f284[_0x58c2('0x30')],_0x46f284['query']);_0x5bd179['attributes']=_[_0x58c2('0x34')](_0x46f284['model'],qs[_0x58c2('0x36')](_0x4db4f5[_0x58c2('0x31')]['fields']));_0x5bd179[_0x58c2('0x35')]=_0x5bd179['attributes'][_0x58c2('0x37')]?_0x5bd179['attributes']:_0x46f284[_0x58c2('0x30')];if(_0x4db4f5[_0x58c2('0x31')][_0x58c2('0x42')]){_0x5bd179[_0x58c2('0x43')]=[{'all':!![]}];}_0x5bd179=_[_0x58c2('0x3c')]({},_0x5bd179,_0x4db4f5[_0x58c2('0x40')]);return db[_0x58c2('0x2b')]['find'](_0x5bd179)['then'](handleEntityNotFound(_0x17072a,null))[_0x58c2('0x23')](respondWithResult(_0x17072a,null))[_0x58c2('0x46')](handleError(_0x17072a,null));};exports[_0x58c2('0x48')]=function(_0x380644,_0x693625){return db['SalesforceConfiguration'][_0x58c2('0x48')](_0x380644[_0x58c2('0x49')],{})[_0x58c2('0x23')](respondWithResult(_0x693625,0xc9))[_0x58c2('0x46')](handleError(_0x693625,null));};exports[_0x58c2('0x22')]=function(_0xfc6a7e,_0x4e788d){if(_0xfc6a7e['body']['id']){delete _0xfc6a7e['body']['id'];}return db['SalesforceConfiguration'][_0x58c2('0x4a')]({'where':{'id':_0xfc6a7e[_0x58c2('0x47')]['id']}})[_0x58c2('0x23')](handleEntityNotFound(_0x4e788d,null))[_0x58c2('0x23')](saveUpdates(_0xfc6a7e[_0x58c2('0x49')],null))['then'](respondWithResult(_0x4e788d,null))['catch'](handleError(_0x4e788d,null));};exports[_0x58c2('0x24')]=function(_0x2edceb,_0x221a0f){return db[_0x58c2('0x2b')][_0x58c2('0x4a')]({'where':{'id':_0x2edceb['params']['id']}})[_0x58c2('0x23')](handleEntityNotFound(_0x221a0f,null))['then'](removeEntity(_0x221a0f,null))[_0x58c2('0x46')](handleError(_0x221a0f,null));};exports[_0x58c2('0x4b')]=function(_0x382edc,_0x1778c5,_0x280cf1){var _0x48750a={};var _0x1e336f={};var _0x35faa8;var _0xc9939d;return db[_0x58c2('0x2b')][_0x58c2('0x4c')]({'where':{'id':_0x382edc[_0x58c2('0x47')]['id']}})[_0x58c2('0x23')](handleEntityNotFound(_0x1778c5,null))[_0x58c2('0x23')](function(_0xeddae5){if(_0xeddae5){_0x35faa8=_0xeddae5;_0x1e336f[_0x58c2('0x30')]=_[_0x58c2('0x32')](db['SalesforceField'][_0x58c2('0x2c')]);_0x1e336f[_0x58c2('0x31')]=_[_0x58c2('0x32')](_0x382edc[_0x58c2('0x31')]);_0x1e336f[_0x58c2('0x33')]=_[_0x58c2('0x34')](_0x1e336f[_0x58c2('0x30')],_0x1e336f[_0x58c2('0x31')]);_0x48750a[_0x58c2('0x35')]=_[_0x58c2('0x34')](_0x1e336f[_0x58c2('0x30')],qs['fields'](_0x382edc[_0x58c2('0x31')][_0x58c2('0x36')]));_0x48750a[_0x58c2('0x35')]=_0x48750a[_0x58c2('0x35')]['length']?_0x48750a[_0x58c2('0x35')]:_0x1e336f['model'];_0x48750a[_0x58c2('0x3a')]=qs[_0x58c2('0x3b')](_0x382edc['query']['sort']);_0x48750a[_0x58c2('0x3d')]=qs['filters'](_['pick'](_0x382edc[_0x58c2('0x31')],_0x1e336f[_0x58c2('0x33')]));if(_0x382edc[_0x58c2('0x31')][_0x58c2('0x3f')]){_0x48750a[_0x58c2('0x3d')]=_[_0x58c2('0x3c')](_0x48750a[_0x58c2('0x3d')],{'$or':_['map'](_0x48750a[_0x58c2('0x35')],function(_0x519c1d){var _0x57ea04={};_0x57ea04[_0x519c1d]={'$like':'%'+_0x382edc['query'][_0x58c2('0x3f')]+'%'};return _0x57ea04;})});}_0x48750a=_[_0x58c2('0x3c')]({},_0x48750a,_0x382edc[_0x58c2('0x40')]);return _0x35faa8[_0x58c2('0x4b')](_0x48750a);}})[_0x58c2('0x23')](function(_0x238e6e){if(_0x238e6e){_0xc9939d=_0x238e6e['length'];if(!_0x382edc[_0x58c2('0x31')][_0x58c2('0x38')](_0x58c2('0x39'))){_0x48750a[_0x58c2('0x1a')]=qs[_0x58c2('0x1a')](_0x382edc['query'][_0x58c2('0x1a')]);_0x48750a[_0x58c2('0x19')]=qs['offset'](_0x382edc[_0x58c2('0x31')][_0x58c2('0x19')]);}return _0x35faa8['getFields'](_0x48750a);}})[_0x58c2('0x23')](function(_0xf2e9ad){if(_0xf2e9ad){return _0xf2e9ad?{'count':_0xc9939d,'rows':_0xf2e9ad}:null;}})[_0x58c2('0x23')](respondWithResult(_0x1778c5,null))[_0x58c2('0x46')](handleError(_0x1778c5,null));};exports[_0x58c2('0x4d')]=function(_0x33d3cc,_0x60898c,_0x3d1c2d){var _0x370979={};var _0x3ce842={};var _0x116e28;var _0x384602;return db[_0x58c2('0x2b')][_0x58c2('0x4c')]({'where':{'id':_0x33d3cc[_0x58c2('0x47')]['id']}})[_0x58c2('0x23')](handleEntityNotFound(_0x60898c,null))[_0x58c2('0x23')](function(_0x8ab2d3){if(_0x8ab2d3){_0x116e28=_0x8ab2d3;_0x3ce842['model']=_[_0x58c2('0x32')](db[_0x58c2('0x4e')][_0x58c2('0x2c')]);_0x3ce842[_0x58c2('0x31')]=_[_0x58c2('0x32')](_0x33d3cc['query']);_0x3ce842[_0x58c2('0x33')]=_['intersection'](_0x3ce842[_0x58c2('0x30')],_0x3ce842[_0x58c2('0x31')]);_0x370979[_0x58c2('0x35')]=_['intersection'](_0x3ce842[_0x58c2('0x30')],qs[_0x58c2('0x36')](_0x33d3cc[_0x58c2('0x31')][_0x58c2('0x36')]));_0x370979[_0x58c2('0x35')]=_0x370979[_0x58c2('0x35')][_0x58c2('0x37')]?_0x370979['attributes']:_0x3ce842['model'];_0x370979[_0x58c2('0x3a')]=qs[_0x58c2('0x3b')](_0x33d3cc[_0x58c2('0x31')][_0x58c2('0x3b')]);_0x370979[_0x58c2('0x3d')]=qs[_0x58c2('0x33')](_[_0x58c2('0x4f')](_0x33d3cc[_0x58c2('0x31')],_0x3ce842['filters']));if(_0x33d3cc[_0x58c2('0x31')]['filter']){_0x370979['where']=_[_0x58c2('0x3c')](_0x370979[_0x58c2('0x3d')],{'$or':_[_0x58c2('0x2a')](_0x370979[_0x58c2('0x35')],function(_0xbeeb16){var _0x54d42b={};_0x54d42b[_0xbeeb16]={'$like':'%'+_0x33d3cc[_0x58c2('0x31')][_0x58c2('0x3f')]+'%'};return _0x54d42b;})});}_0x370979=_[_0x58c2('0x3c')]({},_0x370979,_0x33d3cc[_0x58c2('0x40')]);return _0x116e28['getSubjects'](_0x370979);}})[_0x58c2('0x23')](function(_0x23ad72){if(_0x23ad72){_0x384602=_0x23ad72['length'];if(!_0x33d3cc[_0x58c2('0x31')][_0x58c2('0x38')](_0x58c2('0x39'))){_0x370979[_0x58c2('0x1a')]=qs['limit'](_0x33d3cc[_0x58c2('0x31')]['limit']);_0x370979['offset']=qs['offset'](_0x33d3cc[_0x58c2('0x31')][_0x58c2('0x19')]);}return _0x116e28[_0x58c2('0x4d')](_0x370979);}})[_0x58c2('0x23')](function(_0x420ede){if(_0x420ede){return _0x420ede?{'count':_0x384602,'rows':_0x420ede}:null;}})[_0x58c2('0x23')](respondWithResult(_0x60898c,null))['catch'](handleError(_0x60898c,null));};exports['getDescriptions']=function(_0x2c126f,_0x544776,_0x3d06d4){var _0x573824={};var _0x4439dd={};var _0x39cb75;var _0x51a4cd;return db[_0x58c2('0x2b')][_0x58c2('0x4c')]({'where':{'id':_0x2c126f['params']['id']}})[_0x58c2('0x23')](handleEntityNotFound(_0x544776,null))['then'](function(_0x68d4f){if(_0x68d4f){_0x39cb75=_0x68d4f;_0x4439dd['model']=_[_0x58c2('0x32')](db['SalesforceField'][_0x58c2('0x2c')]);_0x4439dd['query']=_[_0x58c2('0x32')](_0x2c126f['query']);_0x4439dd['filters']=_[_0x58c2('0x34')](_0x4439dd[_0x58c2('0x30')],_0x4439dd[_0x58c2('0x31')]);_0x573824[_0x58c2('0x35')]=_[_0x58c2('0x34')](_0x4439dd[_0x58c2('0x30')],qs['fields'](_0x2c126f['query'][_0x58c2('0x36')]));_0x573824[_0x58c2('0x35')]=_0x573824[_0x58c2('0x35')][_0x58c2('0x37')]?_0x573824[_0x58c2('0x35')]:_0x4439dd[_0x58c2('0x30')];_0x573824['order']=qs[_0x58c2('0x3b')](_0x2c126f[_0x58c2('0x31')][_0x58c2('0x3b')]);_0x573824[_0x58c2('0x3d')]=qs[_0x58c2('0x33')](_[_0x58c2('0x4f')](_0x2c126f['query'],_0x4439dd['filters']));if(_0x2c126f[_0x58c2('0x31')][_0x58c2('0x3f')]){_0x573824[_0x58c2('0x3d')]=_[_0x58c2('0x3c')](_0x573824['where'],{'$or':_[_0x58c2('0x2a')](_0x573824[_0x58c2('0x35')],function(_0x37d617){var _0x20cf94={};_0x20cf94[_0x37d617]={'$like':'%'+_0x2c126f[_0x58c2('0x31')]['filter']+'%'};return _0x20cf94;})});}_0x573824=_['merge']({},_0x573824,_0x2c126f[_0x58c2('0x40')]);return _0x39cb75[_0x58c2('0x50')](_0x573824);}})[_0x58c2('0x23')](function(_0x6868d5){if(_0x6868d5){_0x51a4cd=_0x6868d5[_0x58c2('0x37')];if(!_0x2c126f[_0x58c2('0x31')][_0x58c2('0x38')](_0x58c2('0x39'))){_0x573824[_0x58c2('0x1a')]=qs[_0x58c2('0x1a')](_0x2c126f[_0x58c2('0x31')]['limit']);_0x573824[_0x58c2('0x19')]=qs['offset'](_0x2c126f[_0x58c2('0x31')][_0x58c2('0x19')]);}return _0x39cb75[_0x58c2('0x50')](_0x573824);}})[_0x58c2('0x23')](function(_0x11a874){if(_0x11a874){return _0x11a874?{'count':_0x51a4cd,'rows':_0x11a874}:null;}})[_0x58c2('0x23')](respondWithResult(_0x544776,null))['catch'](handleError(_0x544776,null));};
\ No newline at end of file
+var _0x589b=['reject','save','update','then','destroy','stack','map','rawAttributes','type','key','name','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','SalesforceConfiguration','findAll','rows','catch','params','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x589b,0x1b2));var _0xb589=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x589b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb589('0x0'));var rimraf=require(_0xb589('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb589('0x2'));var rp=require(_0xb589('0x3'));var moment=require(_0xb589('0x4'));var BPromise=require(_0xb589('0x5'));var Mustache=require(_0xb589('0x6'));var util=require(_0xb589('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb589('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb589('0x9'));var _=require(_0xb589('0xa'));var squel=require(_0xb589('0xb'));var crypto=require(_0xb589('0xc'));var jsforce=require(_0xb589('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb589('0x8'));var querystring=require(_0xb589('0xe'));var Papa=require(_0xb589('0xf'));var Redis=require('ioredis');var authService=require(_0xb589('0x10'));var qs=require(_0xb589('0x11'));var as=require(_0xb589('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb589('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb589('0x14'));var licenseUtil=require(_0xb589('0x15'));var db=require(_0xb589('0x16'))['db'];function respondWithStatusCode(_0x5d66dd,_0x334998){_0x334998=_0x334998||0xcc;return function(_0x516851){if(_0x516851){return _0x5d66dd[_0xb589('0x17')](_0x334998);}return _0x5d66dd['status'](_0x334998)[_0xb589('0x18')]();};}function respondWithResult(_0x3bcb50,_0x4acffe){_0x4acffe=_0x4acffe||0xc8;return function(_0x1d9f85){if(_0x1d9f85){return _0x3bcb50[_0xb589('0x19')](_0x4acffe)['json'](_0x1d9f85);}};}function respondWithFilteredResult(_0x645661,_0x512e3a){return function(_0x413d3e){if(_0x413d3e){var _0x24dbfe=typeof _0x512e3a[_0xb589('0x1a')]==='undefined'&&typeof _0x512e3a[_0xb589('0x1b')]===_0xb589('0x1c');var _0x3d7cec=_0x413d3e[_0xb589('0x1d')];var _0x252544=_0x24dbfe?0x0:_0x512e3a[_0xb589('0x1a')];var _0x20a97=_0x24dbfe?_0x413d3e[_0xb589('0x1d')]:_0x512e3a['offset']+_0x512e3a['limit'];var _0x315902;if(_0x20a97>=_0x3d7cec){_0x20a97=_0x3d7cec;_0x315902=0xc8;}else{_0x315902=0xce;}_0x645661[_0xb589('0x19')](_0x315902);return _0x645661[_0xb589('0x1e')](_0xb589('0x1f'),_0x252544+'-'+_0x20a97+'/'+_0x3d7cec)[_0xb589('0x20')](_0x413d3e);}return null;};}function patchUpdates(_0x5a181e){return function(_0x4cd26f){try{jsonpatch[_0xb589('0x21')](_0x4cd26f,_0x5a181e,!![]);}catch(_0x5452e6){return BPromise[_0xb589('0x22')](_0x5452e6);}return _0x4cd26f[_0xb589('0x23')]();};}function saveUpdates(_0x32cab4,_0x4b08c9){return function(_0xb85c7d){if(_0xb85c7d){return _0xb85c7d[_0xb589('0x24')](_0x32cab4)[_0xb589('0x25')](function(_0x58dc61){return _0x58dc61;});}return null;};}function removeEntity(_0x5386df,_0x1729a2){return function(_0xfc14c9){if(_0xfc14c9){return _0xfc14c9[_0xb589('0x26')]()[_0xb589('0x25')](function(){_0x5386df[_0xb589('0x19')](0xcc)[_0xb589('0x18')]();});}};}function handleEntityNotFound(_0x2b8b9d,_0x452bbc){return function(_0xb0ea03){if(!_0xb0ea03){_0x2b8b9d[_0xb589('0x17')](0x194);}return _0xb0ea03;};}function handleError(_0x4bc137,_0x4c4038){_0x4c4038=_0x4c4038||0x1f4;return function(_0x22d404){logger['error'](_0x22d404[_0xb589('0x27')]);if(_0x22d404['name']){delete _0x22d404['name'];}_0x4bc137[_0xb589('0x19')](_0x4c4038)['send'](_0x22d404);};}exports['index']=function(_0x4e1a67,_0x472b0b){var _0x471ae6={},_0x5bb620={},_0x5b7e0f={'count':0x0,'rows':[]};var _0x22ead3=_[_0xb589('0x28')](db['SalesforceConfiguration'][_0xb589('0x29')],function(_0x2b1382){return{'name':_0x2b1382['fieldName'],'type':_0x2b1382[_0xb589('0x2a')][_0xb589('0x2b')]};});_0x5bb620['model']=_[_0xb589('0x28')](_0x22ead3,_0xb589('0x2c'));_0x5bb620[_0xb589('0x2d')]=_[_0xb589('0x2e')](_0x4e1a67['query']);_0x5bb620['filters']=_[_0xb589('0x2f')](_0x5bb620['model'],_0x5bb620[_0xb589('0x2d')]);_0x471ae6['attributes']=_[_0xb589('0x2f')](_0x5bb620[_0xb589('0x30')],qs[_0xb589('0x31')](_0x4e1a67[_0xb589('0x2d')][_0xb589('0x31')]));_0x471ae6['attributes']=_0x471ae6[_0xb589('0x32')][_0xb589('0x33')]?_0x471ae6[_0xb589('0x32')]:_0x5bb620[_0xb589('0x30')];if(!_0x4e1a67[_0xb589('0x2d')][_0xb589('0x34')](_0xb589('0x35'))){_0x471ae6[_0xb589('0x1b')]=qs[_0xb589('0x1b')](_0x4e1a67[_0xb589('0x2d')][_0xb589('0x1b')]);_0x471ae6[_0xb589('0x1a')]=qs[_0xb589('0x1a')](_0x4e1a67[_0xb589('0x2d')]['offset']);}_0x471ae6[_0xb589('0x36')]=qs[_0xb589('0x37')](_0x4e1a67['query'][_0xb589('0x37')]);_0x471ae6[_0xb589('0x38')]=qs['filters'](_[_0xb589('0x39')](_0x4e1a67[_0xb589('0x2d')],_0x5bb620[_0xb589('0x3a')]),_0x22ead3);if(_0x4e1a67[_0xb589('0x2d')][_0xb589('0x3b')]){_0x471ae6['where']=_[_0xb589('0x3c')](_0x471ae6[_0xb589('0x38')],{'$or':_[_0xb589('0x28')](_0x22ead3,function(_0x4f38f9){if(_0x4f38f9[_0xb589('0x2a')]!==_0xb589('0x3d')){var _0x234cd6={};_0x234cd6[_0x4f38f9[_0xb589('0x2c')]]={'$like':'%'+_0x4e1a67['query'][_0xb589('0x3b')]+'%'};return _0x234cd6;}})});}_0x471ae6=_[_0xb589('0x3c')]({},_0x471ae6,_0x4e1a67[_0xb589('0x3e')]);var _0x609b88={'where':_0x471ae6[_0xb589('0x38')]};return db['SalesforceConfiguration'][_0xb589('0x1d')](_0x609b88)[_0xb589('0x25')](function(_0x3d83b1){_0x5b7e0f[_0xb589('0x1d')]=_0x3d83b1;if(_0x4e1a67['query'][_0xb589('0x3f')]){_0x471ae6[_0xb589('0x40')]=[{'all':!![]}];}return db[_0xb589('0x41')][_0xb589('0x42')](_0x471ae6);})[_0xb589('0x25')](function(_0x3c861f){_0x5b7e0f[_0xb589('0x43')]=_0x3c861f;return _0x5b7e0f;})[_0xb589('0x25')](respondWithFilteredResult(_0x472b0b,_0x471ae6))[_0xb589('0x44')](handleError(_0x472b0b,null));};exports['show']=function(_0x52bb33,_0x2cab13){var _0x2257c0={'raw':![],'where':{'id':_0x52bb33[_0xb589('0x45')]['id']}},_0x4d3986={};_0x4d3986[_0xb589('0x30')]=_[_0xb589('0x2e')](db['SalesforceConfiguration'][_0xb589('0x29')]);_0x4d3986[_0xb589('0x2d')]=_[_0xb589('0x2e')](_0x52bb33['query']);_0x4d3986[_0xb589('0x3a')]=_[_0xb589('0x2f')](_0x4d3986[_0xb589('0x30')],_0x4d3986['query']);_0x2257c0['attributes']=_[_0xb589('0x2f')](_0x4d3986[_0xb589('0x30')],qs[_0xb589('0x31')](_0x52bb33[_0xb589('0x2d')][_0xb589('0x31')]));_0x2257c0[_0xb589('0x32')]=_0x2257c0[_0xb589('0x32')][_0xb589('0x33')]?_0x2257c0['attributes']:_0x4d3986[_0xb589('0x30')];if(_0x52bb33[_0xb589('0x2d')][_0xb589('0x3f')]){_0x2257c0['include']=[{'all':!![]}];}_0x2257c0=_[_0xb589('0x3c')]({},_0x2257c0,_0x52bb33[_0xb589('0x3e')]);return db[_0xb589('0x41')][_0xb589('0x46')](_0x2257c0)[_0xb589('0x25')](handleEntityNotFound(_0x2cab13,null))[_0xb589('0x25')](respondWithResult(_0x2cab13,null))[_0xb589('0x44')](handleError(_0x2cab13,null));};exports[_0xb589('0x47')]=function(_0x10776e,_0x4322d3){return db['SalesforceConfiguration'][_0xb589('0x47')](_0x10776e[_0xb589('0x48')],{})[_0xb589('0x25')](respondWithResult(_0x4322d3,0xc9))[_0xb589('0x44')](handleError(_0x4322d3,null));};exports['update']=function(_0x4bbe33,_0x1a1a59){if(_0x4bbe33[_0xb589('0x48')]['id']){delete _0x4bbe33[_0xb589('0x48')]['id'];}return db[_0xb589('0x41')][_0xb589('0x46')]({'where':{'id':_0x4bbe33[_0xb589('0x45')]['id']}})[_0xb589('0x25')](handleEntityNotFound(_0x1a1a59,null))[_0xb589('0x25')](saveUpdates(_0x4bbe33['body'],null))[_0xb589('0x25')](respondWithResult(_0x1a1a59,null))['catch'](handleError(_0x1a1a59,null));};exports['destroy']=function(_0x717248,_0x38954c){return db[_0xb589('0x41')][_0xb589('0x46')]({'where':{'id':_0x717248[_0xb589('0x45')]['id']}})[_0xb589('0x25')](handleEntityNotFound(_0x38954c,null))[_0xb589('0x25')](removeEntity(_0x38954c,null))[_0xb589('0x44')](handleError(_0x38954c,null));};exports[_0xb589('0x49')]=function(_0x21fd59,_0x365193,_0x554172){var _0x5b4959={};var _0x19e052={};var _0x457607;var _0x37fbd3;return db[_0xb589('0x41')][_0xb589('0x4a')]({'where':{'id':_0x21fd59[_0xb589('0x45')]['id']}})['then'](handleEntityNotFound(_0x365193,null))['then'](function(_0x18a407){if(_0x18a407){_0x457607=_0x18a407;_0x19e052['model']=_[_0xb589('0x2e')](db[_0xb589('0x4b')]['rawAttributes']);_0x19e052[_0xb589('0x2d')]=_[_0xb589('0x2e')](_0x21fd59[_0xb589('0x2d')]);_0x19e052[_0xb589('0x3a')]=_[_0xb589('0x2f')](_0x19e052[_0xb589('0x30')],_0x19e052[_0xb589('0x2d')]);_0x5b4959[_0xb589('0x32')]=_['intersection'](_0x19e052[_0xb589('0x30')],qs['fields'](_0x21fd59[_0xb589('0x2d')][_0xb589('0x31')]));_0x5b4959[_0xb589('0x32')]=_0x5b4959[_0xb589('0x32')][_0xb589('0x33')]?_0x5b4959[_0xb589('0x32')]:_0x19e052[_0xb589('0x30')];_0x5b4959['order']=qs[_0xb589('0x37')](_0x21fd59[_0xb589('0x2d')]['sort']);_0x5b4959[_0xb589('0x38')]=qs['filters'](_[_0xb589('0x39')](_0x21fd59[_0xb589('0x2d')],_0x19e052[_0xb589('0x3a')]));if(_0x21fd59[_0xb589('0x2d')][_0xb589('0x3b')]){_0x5b4959[_0xb589('0x38')]=_[_0xb589('0x3c')](_0x5b4959[_0xb589('0x38')],{'$or':_[_0xb589('0x28')](_0x5b4959[_0xb589('0x32')],function(_0x28a1c4){var _0x3c9d10={};_0x3c9d10[_0x28a1c4]={'$like':'%'+_0x21fd59[_0xb589('0x2d')][_0xb589('0x3b')]+'%'};return _0x3c9d10;})});}_0x5b4959=_[_0xb589('0x3c')]({},_0x5b4959,_0x21fd59[_0xb589('0x3e')]);return _0x457607[_0xb589('0x49')](_0x5b4959);}})['then'](function(_0x497c68){if(_0x497c68){_0x37fbd3=_0x497c68[_0xb589('0x33')];if(!_0x21fd59[_0xb589('0x2d')][_0xb589('0x34')](_0xb589('0x35'))){_0x5b4959['limit']=qs['limit'](_0x21fd59['query'][_0xb589('0x1b')]);_0x5b4959[_0xb589('0x1a')]=qs['offset'](_0x21fd59[_0xb589('0x2d')][_0xb589('0x1a')]);}return _0x457607[_0xb589('0x49')](_0x5b4959);}})[_0xb589('0x25')](function(_0x548ab7){if(_0x548ab7){return _0x548ab7?{'count':_0x37fbd3,'rows':_0x548ab7}:null;}})[_0xb589('0x25')](respondWithResult(_0x365193,null))[_0xb589('0x44')](handleError(_0x365193,null));};exports[_0xb589('0x4c')]=function(_0x1e75c5,_0x171cd8,_0x4917d1){var _0x15b5fb={};var _0x506bf8={};var _0x2e49c3;var _0x4a0dd6;return db[_0xb589('0x41')][_0xb589('0x4a')]({'where':{'id':_0x1e75c5['params']['id']}})[_0xb589('0x25')](handleEntityNotFound(_0x171cd8,null))[_0xb589('0x25')](function(_0x30d821){if(_0x30d821){_0x2e49c3=_0x30d821;_0x506bf8[_0xb589('0x30')]=_[_0xb589('0x2e')](db[_0xb589('0x4b')][_0xb589('0x29')]);_0x506bf8['query']=_[_0xb589('0x2e')](_0x1e75c5['query']);_0x506bf8[_0xb589('0x3a')]=_[_0xb589('0x2f')](_0x506bf8['model'],_0x506bf8['query']);_0x15b5fb[_0xb589('0x32')]=_[_0xb589('0x2f')](_0x506bf8[_0xb589('0x30')],qs[_0xb589('0x31')](_0x1e75c5[_0xb589('0x2d')][_0xb589('0x31')]));_0x15b5fb['attributes']=_0x15b5fb['attributes'][_0xb589('0x33')]?_0x15b5fb[_0xb589('0x32')]:_0x506bf8[_0xb589('0x30')];_0x15b5fb['order']=qs[_0xb589('0x37')](_0x1e75c5[_0xb589('0x2d')][_0xb589('0x37')]);_0x15b5fb[_0xb589('0x38')]=qs['filters'](_[_0xb589('0x39')](_0x1e75c5[_0xb589('0x2d')],_0x506bf8['filters']));if(_0x1e75c5['query'][_0xb589('0x3b')]){_0x15b5fb['where']=_[_0xb589('0x3c')](_0x15b5fb[_0xb589('0x38')],{'$or':_[_0xb589('0x28')](_0x15b5fb[_0xb589('0x32')],function(_0x15e9c5){var _0x345cb6={};_0x345cb6[_0x15e9c5]={'$like':'%'+_0x1e75c5[_0xb589('0x2d')][_0xb589('0x3b')]+'%'};return _0x345cb6;})});}_0x15b5fb=_[_0xb589('0x3c')]({},_0x15b5fb,_0x1e75c5['options']);return _0x2e49c3[_0xb589('0x4c')](_0x15b5fb);}})[_0xb589('0x25')](function(_0x2d204d){if(_0x2d204d){_0x4a0dd6=_0x2d204d[_0xb589('0x33')];if(!_0x1e75c5[_0xb589('0x2d')]['hasOwnProperty'](_0xb589('0x35'))){_0x15b5fb[_0xb589('0x1b')]=qs[_0xb589('0x1b')](_0x1e75c5[_0xb589('0x2d')][_0xb589('0x1b')]);_0x15b5fb[_0xb589('0x1a')]=qs[_0xb589('0x1a')](_0x1e75c5[_0xb589('0x2d')][_0xb589('0x1a')]);}return _0x2e49c3[_0xb589('0x4c')](_0x15b5fb);}})[_0xb589('0x25')](function(_0x69c5c3){if(_0x69c5c3){return _0x69c5c3?{'count':_0x4a0dd6,'rows':_0x69c5c3}:null;}})[_0xb589('0x25')](respondWithResult(_0x171cd8,null))[_0xb589('0x44')](handleError(_0x171cd8,null));};exports['getDescriptions']=function(_0x1f88e9,_0x2e7d18,_0x285a5d){var _0x573b03={};var _0x50aa33={};var _0x3c9dbd;var _0x2455d9;return db['SalesforceConfiguration'][_0xb589('0x4a')]({'where':{'id':_0x1f88e9[_0xb589('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e7d18,null))[_0xb589('0x25')](function(_0x416642){if(_0x416642){_0x3c9dbd=_0x416642;_0x50aa33[_0xb589('0x30')]=_[_0xb589('0x2e')](db[_0xb589('0x4b')]['rawAttributes']);_0x50aa33['query']=_[_0xb589('0x2e')](_0x1f88e9['query']);_0x50aa33[_0xb589('0x3a')]=_[_0xb589('0x2f')](_0x50aa33[_0xb589('0x30')],_0x50aa33[_0xb589('0x2d')]);_0x573b03[_0xb589('0x32')]=_[_0xb589('0x2f')](_0x50aa33[_0xb589('0x30')],qs[_0xb589('0x31')](_0x1f88e9[_0xb589('0x2d')][_0xb589('0x31')]));_0x573b03[_0xb589('0x32')]=_0x573b03['attributes'][_0xb589('0x33')]?_0x573b03['attributes']:_0x50aa33[_0xb589('0x30')];_0x573b03[_0xb589('0x36')]=qs[_0xb589('0x37')](_0x1f88e9[_0xb589('0x2d')][_0xb589('0x37')]);_0x573b03['where']=qs['filters'](_[_0xb589('0x39')](_0x1f88e9[_0xb589('0x2d')],_0x50aa33['filters']));if(_0x1f88e9[_0xb589('0x2d')][_0xb589('0x3b')]){_0x573b03['where']=_[_0xb589('0x3c')](_0x573b03[_0xb589('0x38')],{'$or':_[_0xb589('0x28')](_0x573b03[_0xb589('0x32')],function(_0x371573){var _0x4d02f8={};_0x4d02f8[_0x371573]={'$like':'%'+_0x1f88e9[_0xb589('0x2d')][_0xb589('0x3b')]+'%'};return _0x4d02f8;})});}_0x573b03=_[_0xb589('0x3c')]({},_0x573b03,_0x1f88e9[_0xb589('0x3e')]);return _0x3c9dbd[_0xb589('0x4d')](_0x573b03);}})[_0xb589('0x25')](function(_0x5aaabd){if(_0x5aaabd){_0x2455d9=_0x5aaabd['length'];if(!_0x1f88e9[_0xb589('0x2d')][_0xb589('0x34')](_0xb589('0x35'))){_0x573b03[_0xb589('0x1b')]=qs['limit'](_0x1f88e9[_0xb589('0x2d')]['limit']);_0x573b03[_0xb589('0x1a')]=qs[_0xb589('0x1a')](_0x1f88e9[_0xb589('0x2d')]['offset']);}return _0x3c9dbd[_0xb589('0x4d')](_0x573b03);}})[_0xb589('0x25')](function(_0x4be92f){if(_0x4be92f){return _0x4be92f?{'count':_0x2455d9,'rows':_0x4be92f}:null;}})['then'](respondWithResult(_0x2e7d18,null))['catch'](handleError(_0x2e7d18,null));};
\ No newline at end of file
index cb8124b..e3f7fb4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b5d=['SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x1ed256,_0x49c722){var _0xac5d99=function(_0x44bb07){while(--_0x44bb07){_0x1ed256['push'](_0x1ed256['shift']());}};_0xac5d99(++_0x49c722);}(_0x0b5d,0x1af));var _0xd0b5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b5d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd0b5('0x0'));var logger=require(_0xd0b5('0x1'))(_0xd0b5('0x2'));var moment=require(_0xd0b5('0x3'));var BPromise=require(_0xd0b5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0b5('0x5'));var rimraf=require(_0xd0b5('0x6'));var config=require(_0xd0b5('0x7'));var attributes=require(_0xd0b5('0x8'));module[_0xd0b5('0x9')]=function(_0x5d42bf,_0x42762b){return _0x5d42bf[_0xd0b5('0xa')](_0xd0b5('0xb'),attributes,{'tableName':_0xd0b5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x088a=['bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment'];(function(_0xe73bdd,_0x6fa765){var _0xa9f84a=function(_0x44cdea){while(--_0x44cdea){_0xe73bdd['push'](_0xe73bdd['shift']());}};_0xa9f84a(++_0x6fa765);}(_0x088a,0x1ac));var _0xa088=function(_0x1d4574,_0x2e735f){_0x1d4574=_0x1d4574-0x0;var _0x46c8b6=_0x088a[_0x1d4574];return _0x46c8b6;};'use strict';var _=require(_0xa088('0x0'));var util=require(_0xa088('0x1'));var logger=require(_0xa088('0x2'))('api');var moment=require(_0xa088('0x3'));var BPromise=require(_0xa088('0x4'));var rp=require(_0xa088('0x5'));var fs=require('fs');var path=require(_0xa088('0x6'));var rimraf=require('rimraf');var config=require(_0xa088('0x7'));var attributes=require(_0xa088('0x8'));module[_0xa088('0x9')]=function(_0x4f3b,_0x223c6e){return _0x4f3b['define'](_0xa088('0xa'),attributes,{'tableName':_0xa088('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 6ac8ac6..d4c4de8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f74=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3e9ccb,_0x12a20e){var _0x21f81d=function(_0x31f855){while(--_0x31f855){_0x3e9ccb['push'](_0x3e9ccb['shift']());}};_0x21f81d(++_0x12a20e);}(_0x6f74,0xe0));var _0x46f7=function(_0x190725,_0x4c879f){_0x190725=_0x190725-0x0;var _0x4fe2de=_0x6f74[_0x190725];return _0x4fe2de;};'use strict';var _=require(_0x46f7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x46f7('0x1'));var rs=require(_0x46f7('0x2'));var fs=require('fs');var Redis=require(_0x46f7('0x3'));var db=require(_0x46f7('0x4'))['db'];var utils=require(_0x46f7('0x5'));var logger=require(_0x46f7('0x6'))(_0x46f7('0x7'));var config=require('../../config/environment');var jayson=require(_0x46f7('0x8'));var client=jayson[_0x46f7('0x9')][_0x46f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe94156,_0xf2f5ea,_0xd46d2c){return new BPromise(function(_0x58989d,_0x7ec2a2){return client[_0x46f7('0xb')](_0xe94156,_0xd46d2c)[_0x46f7('0xc')](function(_0x565e75){logger[_0x46f7('0xd')](_0x46f7('0xe'),_0xf2f5ea,'request\x20sent');logger[_0x46f7('0xf')](_0x46f7('0x10'),_0xf2f5ea,_0x46f7('0x11'),JSON['stringify'](_0x565e75));if(_0x565e75[_0x46f7('0x12')]){if(_0x565e75[_0x46f7('0x12')][_0x46f7('0x13')]===0x1f4){logger['error'](_0x46f7('0xe'),_0xf2f5ea,_0x565e75['error'][_0x46f7('0x14')]);return _0x7ec2a2(_0x565e75[_0x46f7('0x12')]['message']);}logger[_0x46f7('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0xf2f5ea,_0x565e75[_0x46f7('0x12')][_0x46f7('0x14')]);return _0x58989d(_0x565e75['error']['message']);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0xf2f5ea,_0x46f7('0x11'));_0x58989d(_0x565e75[_0x46f7('0x15')]['message']);}})[_0x46f7('0x16')](function(_0x18b46a){logger[_0x46f7('0x12')](_0x46f7('0xe'),_0xf2f5ea,_0x18b46a);_0x7ec2a2(_0x18b46a);});});}
\ No newline at end of file
+var _0xf066=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0xf066,0x191));var _0x6f06=function(_0x16bfae,_0x36ed25){_0x16bfae=_0x16bfae-0x0;var _0x3870f5=_0xf066[_0x16bfae];return _0x3870f5;};'use strict';var _=require(_0x6f06('0x0'));var util=require(_0x6f06('0x1'));var moment=require(_0x6f06('0x2'));var BPromise=require(_0x6f06('0x3'));var rs=require(_0x6f06('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f06('0x5'))['db'];var utils=require(_0x6f06('0x6'));var logger=require(_0x6f06('0x7'))(_0x6f06('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6f06('0x9')][_0x6f06('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x194ac1,_0x7daa71,_0x3dc6b2){return new BPromise(function(_0x217366,_0x3e42ce){return client['request'](_0x194ac1,_0x3dc6b2)[_0x6f06('0xb')](function(_0x897de5){logger[_0x6f06('0xc')](_0x6f06('0xd'),_0x7daa71,_0x6f06('0xe'));logger[_0x6f06('0xf')](_0x6f06('0x10'),_0x7daa71,_0x6f06('0xe'),JSON[_0x6f06('0x11')](_0x897de5));if(_0x897de5[_0x6f06('0x12')]){if(_0x897de5[_0x6f06('0x12')][_0x6f06('0x13')]===0x1f4){logger[_0x6f06('0x12')](_0x6f06('0xd'),_0x7daa71,_0x897de5[_0x6f06('0x12')][_0x6f06('0x14')]);return _0x3e42ce(_0x897de5[_0x6f06('0x12')][_0x6f06('0x14')]);}logger['error'](_0x6f06('0xd'),_0x7daa71,_0x897de5[_0x6f06('0x12')]['message']);return _0x217366(_0x897de5['error']['message']);}else{logger[_0x6f06('0xc')](_0x6f06('0xd'),_0x7daa71,_0x6f06('0xe'));_0x217366(_0x897de5[_0x6f06('0x15')]['message']);}})[_0x6f06('0x16')](function(_0x14faea){logger['error'](_0x6f06('0xd'),_0x7daa71,_0x14faea);_0x3e42ce(_0x14faea);});});}
\ No newline at end of file
index 502da69..2372949 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa540=['create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intSalesforceField.controller','isAuthenticated','get','/:id','show','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa540,0x1a2));var _0x0a54=function(_0x16eb11,_0x1a2251){_0x16eb11=_0x16eb11-0x0;var _0x3ae7ef=_0xa540[_0x16eb11];return _0x3ae7ef;};'use strict';var multer=require(_0x0a54('0x0'));var util=require(_0x0a54('0x1'));var path=require(_0x0a54('0x2'));var timeout=require(_0x0a54('0x3'));var express=require(_0x0a54('0x4'));var router=express[_0x0a54('0x5')]();var fs_extra=require(_0x0a54('0x6'));var auth=require(_0x0a54('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0a54('0x8'));router['get']('/',auth[_0x0a54('0x9')](),controller['index']);router[_0x0a54('0xa')](_0x0a54('0xb'),auth[_0x0a54('0x9')](),controller[_0x0a54('0xc')]);router[_0x0a54('0xd')]('/',auth[_0x0a54('0x9')](),controller[_0x0a54('0xe')]);router[_0x0a54('0xf')](_0x0a54('0xb'),auth['isAuthenticated'](),controller[_0x0a54('0x10')]);router['delete'](_0x0a54('0xb'),auth[_0x0a54('0x9')](),controller['destroy']);module[_0x0a54('0x11')]=router;
\ No newline at end of file
+var _0xd584=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0xd584,0xc0));var _0x4d58=function(_0x37b824,_0x30bb58){_0x37b824=_0x37b824-0x0;var _0x15e1b1=_0xd584[_0x37b824];return _0x15e1b1;};'use strict';var multer=require(_0x4d58('0x0'));var util=require(_0x4d58('0x1'));var path=require(_0x4d58('0x2'));var timeout=require(_0x4d58('0x3'));var express=require('express');var router=express[_0x4d58('0x4')]();var fs_extra=require(_0x4d58('0x5'));var auth=require(_0x4d58('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4d58('0x7'));var controller=require(_0x4d58('0x8'));router[_0x4d58('0x9')]('/',auth['isAuthenticated'](),controller[_0x4d58('0xa')]);router[_0x4d58('0x9')](_0x4d58('0xb'),auth[_0x4d58('0xc')](),controller[_0x4d58('0xd')]);router[_0x4d58('0xe')]('/',auth[_0x4d58('0xc')](),controller[_0x4d58('0xf')]);router[_0x4d58('0x10')](_0x4d58('0xb'),auth[_0x4d58('0xc')](),controller['update']);router['delete'](_0x4d58('0xb'),auth['isAuthenticated'](),controller[_0x4d58('0x11')]);module[_0x4d58('0x12')]=router;
\ No newline at end of file
index 1532d13..8b141e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd3a9=['exports','string','picklist','STRING','ENUM','variable','customVariable'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd3a9,0x126));var _0x9d3a=function(_0x35bedd,_0xd94c7e){_0x35bedd=_0x35bedd-0x0;var _0x143f5e=_0xd3a9[_0x35bedd];return _0x143f5e;};'use strict';var Sequelize=require('sequelize');module[_0x9d3a('0x0')]={'type':{'type':Sequelize['ENUM'](_0x9d3a('0x1'),'variable','customVariable','keyValue',_0x9d3a('0x2')),'defaultValue':_0x9d3a('0x1')},'content':{'type':Sequelize[_0x9d3a('0x3')]},'key':{'type':Sequelize[_0x9d3a('0x3')]},'keyType':{'type':Sequelize[_0x9d3a('0x4')]('string',_0x9d3a('0x5'),_0x9d3a('0x6'))},'keyContent':{'type':Sequelize[_0x9d3a('0x3')]},'idField':{'type':Sequelize[_0x9d3a('0x3')]},'variableName':{'type':Sequelize[_0x9d3a('0x3')]}};
\ No newline at end of file
+var _0x9316=['keyValue','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x46172a,_0x56af84){var _0x13dc62=function(_0x4db3ec){while(--_0x4db3ec){_0x46172a['push'](_0x46172a['shift']());}};_0x13dc62(++_0x56af84);}(_0x9316,0x14b));var _0x6931=function(_0x597581,_0x3668f1){_0x597581=_0x597581-0x0;var _0x5b9750=_0x9316[_0x597581];return _0x5b9750;};'use strict';var Sequelize=require(_0x6931('0x0'));module['exports']={'type':{'type':Sequelize[_0x6931('0x1')](_0x6931('0x2'),_0x6931('0x3'),_0x6931('0x4'),_0x6931('0x5'),'picklist'),'defaultValue':_0x6931('0x2')},'content':{'type':Sequelize[_0x6931('0x6')]},'key':{'type':Sequelize[_0x6931('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x6931('0x2'),_0x6931('0x3'),_0x6931('0x4'))},'keyContent':{'type':Sequelize[_0x6931('0x6')]},'idField':{'type':Sequelize[_0x6931('0x6')]},'variableName':{'type':Sequelize[_0x6931('0x6')]}};
\ No newline at end of file
index 86707fd..4254844 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa451=['count','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','SalesforceField','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xa451,0x187));var _0x1a45=function(_0x39dbfb,_0x3c8b20){_0x39dbfb=_0x39dbfb-0x0;var _0x438790=_0xa451[_0x39dbfb];return _0x438790;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a45('0x0'));var zipdir=require(_0x1a45('0x1'));var jsonpatch=require(_0x1a45('0x2'));var rp=require(_0x1a45('0x3'));var moment=require('moment');var BPromise=require(_0x1a45('0x4'));var Mustache=require(_0x1a45('0x5'));var util=require(_0x1a45('0x6'));var path=require(_0x1a45('0x7'));var sox=require('sox');var csv=require(_0x1a45('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a45('0x9'));var _=require(_0x1a45('0xa'));var squel=require(_0x1a45('0xb'));var crypto=require(_0x1a45('0xc'));var jsforce=require(_0x1a45('0xd'));var deskjs=require(_0x1a45('0xe'));var toCsv=require(_0x1a45('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1a45('0xf'));var authService=require(_0x1a45('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1a45('0x11'));var hardwareService=require(_0x1a45('0x12'));var logger=require('../../config/logger')(_0x1a45('0x13'));var utils=require('../../config/utils');var config=require(_0x1a45('0x14'));var licenseUtil=require(_0x1a45('0x15'));var db=require(_0x1a45('0x16'))['db'];function respondWithStatusCode(_0x60ed34,_0x5f340d){_0x5f340d=_0x5f340d||0xcc;return function(_0x302684){if(_0x302684){return _0x60ed34['sendStatus'](_0x5f340d);}return _0x60ed34['status'](_0x5f340d)[_0x1a45('0x17')]();};}function respondWithResult(_0x415f00,_0x55ee70){_0x55ee70=_0x55ee70||0xc8;return function(_0x41c67a){if(_0x41c67a){return _0x415f00[_0x1a45('0x18')](_0x55ee70)[_0x1a45('0x19')](_0x41c67a);}};}function respondWithFilteredResult(_0x2fd0be,_0x339cb9){return function(_0x3cc7bb){if(_0x3cc7bb){var _0x3d5ed0=typeof _0x339cb9[_0x1a45('0x1a')]===_0x1a45('0x1b')&&typeof _0x339cb9[_0x1a45('0x1c')]===_0x1a45('0x1b');var _0x1a34b0=_0x3cc7bb[_0x1a45('0x1d')];var _0x146324=_0x3d5ed0?0x0:_0x339cb9[_0x1a45('0x1a')];var _0x36ee76=_0x3d5ed0?_0x3cc7bb[_0x1a45('0x1d')]:_0x339cb9[_0x1a45('0x1a')]+_0x339cb9[_0x1a45('0x1c')];var _0x3d66b9;if(_0x36ee76>=_0x1a34b0){_0x36ee76=_0x1a34b0;_0x3d66b9=0xc8;}else{_0x3d66b9=0xce;}_0x2fd0be[_0x1a45('0x18')](_0x3d66b9);return _0x2fd0be['set'](_0x1a45('0x1e'),_0x146324+'-'+_0x36ee76+'/'+_0x1a34b0)['json'](_0x3cc7bb);}return null;};}function patchUpdates(_0x59e500){return function(_0x146ad8){try{jsonpatch[_0x1a45('0x1f')](_0x146ad8,_0x59e500,!![]);}catch(_0x1a1004){return BPromise[_0x1a45('0x20')](_0x1a1004);}return _0x146ad8[_0x1a45('0x21')]();};}function saveUpdates(_0x17c99e,_0x4c0123){return function(_0x54b5df){if(_0x54b5df){return _0x54b5df[_0x1a45('0x22')](_0x17c99e)['then'](function(_0x4c7d5e){return _0x4c7d5e;});}return null;};}function removeEntity(_0x511784,_0x157861){return function(_0x112f04){if(_0x112f04){return _0x112f04[_0x1a45('0x23')]()[_0x1a45('0x24')](function(){_0x511784[_0x1a45('0x18')](0xcc)[_0x1a45('0x17')]();});}};}function handleEntityNotFound(_0x3dee1f,_0x497688){return function(_0x2dc335){if(!_0x2dc335){_0x3dee1f[_0x1a45('0x25')](0x194);}return _0x2dc335;};}function handleError(_0x3c99da,_0x44b7f8){_0x44b7f8=_0x44b7f8||0x1f4;return function(_0x1a632e){logger[_0x1a45('0x26')](_0x1a632e[_0x1a45('0x27')]);if(_0x1a632e[_0x1a45('0x28')]){delete _0x1a632e[_0x1a45('0x28')];}_0x3c99da[_0x1a45('0x18')](_0x44b7f8)[_0x1a45('0x29')](_0x1a632e);};}exports['index']=function(_0x55ca6a,_0x1377bf){var _0x5360e8={},_0x32a3b4={},_0x535159={'count':0x0,'rows':[]};var _0x2a5b4a=_[_0x1a45('0x2a')](db[_0x1a45('0x2b')][_0x1a45('0x2c')],function(_0xf6dc99){return{'name':_0xf6dc99['fieldName'],'type':_0xf6dc99[_0x1a45('0x2d')]['key']};});_0x32a3b4[_0x1a45('0x2e')]=_[_0x1a45('0x2a')](_0x2a5b4a,_0x1a45('0x28'));_0x32a3b4[_0x1a45('0x2f')]=_['keys'](_0x55ca6a[_0x1a45('0x2f')]);_0x32a3b4[_0x1a45('0x30')]=_[_0x1a45('0x31')](_0x32a3b4[_0x1a45('0x2e')],_0x32a3b4[_0x1a45('0x2f')]);_0x5360e8['attributes']=_[_0x1a45('0x31')](_0x32a3b4[_0x1a45('0x2e')],qs[_0x1a45('0x32')](_0x55ca6a[_0x1a45('0x2f')][_0x1a45('0x32')]));_0x5360e8['attributes']=_0x5360e8[_0x1a45('0x33')][_0x1a45('0x34')]?_0x5360e8[_0x1a45('0x33')]:_0x32a3b4[_0x1a45('0x2e')];if(!_0x55ca6a[_0x1a45('0x2f')]['hasOwnProperty']('nolimit')){_0x5360e8[_0x1a45('0x1c')]=qs['limit'](_0x55ca6a[_0x1a45('0x2f')][_0x1a45('0x1c')]);_0x5360e8[_0x1a45('0x1a')]=qs[_0x1a45('0x1a')](_0x55ca6a['query'][_0x1a45('0x1a')]);}_0x5360e8[_0x1a45('0x35')]=qs['sort'](_0x55ca6a['query'][_0x1a45('0x36')]);_0x5360e8[_0x1a45('0x37')]=qs[_0x1a45('0x30')](_[_0x1a45('0x38')](_0x55ca6a[_0x1a45('0x2f')],_0x32a3b4[_0x1a45('0x30')]),_0x2a5b4a);if(_0x55ca6a['query']['filter']){_0x5360e8[_0x1a45('0x37')]=_['merge'](_0x5360e8[_0x1a45('0x37')],{'$or':_['map'](_0x2a5b4a,function(_0x18ce8b){if(_0x18ce8b[_0x1a45('0x2d')]!==_0x1a45('0x39')){var _0x4fa57f={};_0x4fa57f[_0x18ce8b[_0x1a45('0x28')]]={'$like':'%'+_0x55ca6a[_0x1a45('0x2f')]['filter']+'%'};return _0x4fa57f;}})});}_0x5360e8=_[_0x1a45('0x3a')]({},_0x5360e8,_0x55ca6a[_0x1a45('0x3b')]);var _0x5df1fe={'where':_0x5360e8[_0x1a45('0x37')]};return db[_0x1a45('0x2b')][_0x1a45('0x1d')](_0x5df1fe)[_0x1a45('0x24')](function(_0x246a26){_0x535159['count']=_0x246a26;if(_0x55ca6a[_0x1a45('0x2f')][_0x1a45('0x3c')]){_0x5360e8[_0x1a45('0x3d')]=[{'all':!![]}];}return db[_0x1a45('0x2b')][_0x1a45('0x3e')](_0x5360e8);})[_0x1a45('0x24')](function(_0x57c6b3){_0x535159[_0x1a45('0x3f')]=_0x57c6b3;return _0x535159;})[_0x1a45('0x24')](respondWithFilteredResult(_0x1377bf,_0x5360e8))[_0x1a45('0x40')](handleError(_0x1377bf,null));};exports['show']=function(_0x155d09,_0x53e51f){var _0x10eafd={'raw':!![],'where':{'id':_0x155d09[_0x1a45('0x41')]['id']}},_0x27a566={};_0x27a566['model']=_['keys'](db[_0x1a45('0x2b')][_0x1a45('0x2c')]);_0x27a566[_0x1a45('0x2f')]=_[_0x1a45('0x42')](_0x155d09[_0x1a45('0x2f')]);_0x27a566[_0x1a45('0x30')]=_[_0x1a45('0x31')](_0x27a566['model'],_0x27a566[_0x1a45('0x2f')]);_0x10eafd[_0x1a45('0x33')]=_[_0x1a45('0x31')](_0x27a566['model'],qs[_0x1a45('0x32')](_0x155d09[_0x1a45('0x2f')]['fields']));_0x10eafd[_0x1a45('0x33')]=_0x10eafd['attributes'][_0x1a45('0x34')]?_0x10eafd[_0x1a45('0x33')]:_0x27a566[_0x1a45('0x2e')];if(_0x155d09[_0x1a45('0x2f')][_0x1a45('0x3c')]){_0x10eafd[_0x1a45('0x3d')]=[{'all':!![]}];}_0x10eafd=_[_0x1a45('0x3a')]({},_0x10eafd,_0x155d09['options']);return db['SalesforceField'][_0x1a45('0x43')](_0x10eafd)[_0x1a45('0x24')](handleEntityNotFound(_0x53e51f,null))[_0x1a45('0x24')](respondWithResult(_0x53e51f,null))[_0x1a45('0x40')](handleError(_0x53e51f,null));};exports[_0x1a45('0x44')]=function(_0x40dc85,_0x5c61e2){return db[_0x1a45('0x2b')][_0x1a45('0x44')](_0x40dc85[_0x1a45('0x45')],{})[_0x1a45('0x24')](respondWithResult(_0x5c61e2,0xc9))[_0x1a45('0x40')](handleError(_0x5c61e2,null));};exports['update']=function(_0x323fac,_0x4994f7){if(_0x323fac[_0x1a45('0x45')]['id']){delete _0x323fac[_0x1a45('0x45')]['id'];}return db['SalesforceField'][_0x1a45('0x43')]({'where':{'id':_0x323fac[_0x1a45('0x41')]['id']}})['then'](handleEntityNotFound(_0x4994f7,null))[_0x1a45('0x24')](saveUpdates(_0x323fac[_0x1a45('0x45')],null))[_0x1a45('0x24')](respondWithResult(_0x4994f7,null))[_0x1a45('0x40')](handleError(_0x4994f7,null));};exports[_0x1a45('0x23')]=function(_0x1c80e0,_0x23817d){return db[_0x1a45('0x2b')][_0x1a45('0x43')]({'where':{'id':_0x1c80e0[_0x1a45('0x41')]['id']}})[_0x1a45('0x24')](handleEntityNotFound(_0x23817d,null))['then'](removeEntity(_0x23817d,null))['catch'](handleError(_0x23817d,null));};
\ No newline at end of file
+var _0x6bfc=['then','destroy','end','error','name','send','map','SalesforceField','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','catch','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x6bfc,0xba));var _0xc6bf=function(_0x1ab6ad,_0x1a2247){_0x1ab6ad=_0x1ab6ad-0x0;var _0x1c6b63=_0x6bfc[_0x1ab6ad];return _0x1c6b63;};'use strict';var emlformat=require(_0xc6bf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6bf('0x1'));var jsonpatch=require(_0xc6bf('0x2'));var rp=require(_0xc6bf('0x3'));var moment=require(_0xc6bf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc6bf('0x5'));var util=require('util');var path=require(_0xc6bf('0x6'));var sox=require(_0xc6bf('0x7'));var csv=require(_0xc6bf('0x8'));var ejs=require(_0xc6bf('0x9'));var fs=require('fs');var fs_extra=require(_0xc6bf('0xa'));var _=require(_0xc6bf('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc6bf('0xc'));var Papa=require(_0xc6bf('0xd'));var Redis=require(_0xc6bf('0xe'));var authService=require(_0xc6bf('0xf'));var qs=require(_0xc6bf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6bf('0x11'));var logger=require(_0xc6bf('0x12'))(_0xc6bf('0x13'));var utils=require(_0xc6bf('0x14'));var config=require(_0xc6bf('0x15'));var licenseUtil=require(_0xc6bf('0x16'));var db=require(_0xc6bf('0x17'))['db'];function respondWithStatusCode(_0x20255c,_0x56cf61){_0x56cf61=_0x56cf61||0xcc;return function(_0x3247cc){if(_0x3247cc){return _0x20255c[_0xc6bf('0x18')](_0x56cf61);}return _0x20255c['status'](_0x56cf61)['end']();};}function respondWithResult(_0xdc60b6,_0x2b852d){_0x2b852d=_0x2b852d||0xc8;return function(_0x2b5483){if(_0x2b5483){return _0xdc60b6[_0xc6bf('0x19')](_0x2b852d)[_0xc6bf('0x1a')](_0x2b5483);}};}function respondWithFilteredResult(_0x387117,_0x241c0a){return function(_0x4d5d84){if(_0x4d5d84){var _0x5c6a71=typeof _0x241c0a[_0xc6bf('0x1b')]===_0xc6bf('0x1c')&&typeof _0x241c0a[_0xc6bf('0x1d')]===_0xc6bf('0x1c');var _0x2ee8ea=_0x4d5d84['count'];var _0x2b23f9=_0x5c6a71?0x0:_0x241c0a[_0xc6bf('0x1b')];var _0x3b0254=_0x5c6a71?_0x4d5d84[_0xc6bf('0x1e')]:_0x241c0a[_0xc6bf('0x1b')]+_0x241c0a[_0xc6bf('0x1d')];var _0x360cce;if(_0x3b0254>=_0x2ee8ea){_0x3b0254=_0x2ee8ea;_0x360cce=0xc8;}else{_0x360cce=0xce;}_0x387117['status'](_0x360cce);return _0x387117[_0xc6bf('0x1f')](_0xc6bf('0x20'),_0x2b23f9+'-'+_0x3b0254+'/'+_0x2ee8ea)[_0xc6bf('0x1a')](_0x4d5d84);}return null;};}function patchUpdates(_0x3010ad){return function(_0x518104){try{jsonpatch[_0xc6bf('0x21')](_0x518104,_0x3010ad,!![]);}catch(_0x3eeaa1){return BPromise[_0xc6bf('0x22')](_0x3eeaa1);}return _0x518104[_0xc6bf('0x23')]();};}function saveUpdates(_0x52ae20,_0x418c3d){return function(_0xf70d00){if(_0xf70d00){return _0xf70d00['update'](_0x52ae20)[_0xc6bf('0x24')](function(_0x47fbd3){return _0x47fbd3;});}return null;};}function removeEntity(_0x134b68,_0x1ffa02){return function(_0x1a6c0b){if(_0x1a6c0b){return _0x1a6c0b[_0xc6bf('0x25')]()['then'](function(){_0x134b68[_0xc6bf('0x19')](0xcc)[_0xc6bf('0x26')]();});}};}function handleEntityNotFound(_0x299057,_0x524391){return function(_0x36b5e5){if(!_0x36b5e5){_0x299057[_0xc6bf('0x18')](0x194);}return _0x36b5e5;};}function handleError(_0x3b063b,_0x508e99){_0x508e99=_0x508e99||0x1f4;return function(_0x1453ce){logger[_0xc6bf('0x27')](_0x1453ce['stack']);if(_0x1453ce[_0xc6bf('0x28')]){delete _0x1453ce[_0xc6bf('0x28')];}_0x3b063b[_0xc6bf('0x19')](_0x508e99)[_0xc6bf('0x29')](_0x1453ce);};}exports['index']=function(_0x207c53,_0x555b2c){var _0xc3c777={},_0x28e35e={},_0xfd1d29={'count':0x0,'rows':[]};var _0x4c1ffb=_[_0xc6bf('0x2a')](db[_0xc6bf('0x2b')][_0xc6bf('0x2c')],function(_0xda1d6f){return{'name':_0xda1d6f[_0xc6bf('0x2d')],'type':_0xda1d6f[_0xc6bf('0x2e')]['key']};});_0x28e35e[_0xc6bf('0x2f')]=_[_0xc6bf('0x2a')](_0x4c1ffb,_0xc6bf('0x28'));_0x28e35e[_0xc6bf('0x30')]=_['keys'](_0x207c53[_0xc6bf('0x30')]);_0x28e35e['filters']=_[_0xc6bf('0x31')](_0x28e35e[_0xc6bf('0x2f')],_0x28e35e['query']);_0xc3c777[_0xc6bf('0x32')]=_[_0xc6bf('0x31')](_0x28e35e[_0xc6bf('0x2f')],qs[_0xc6bf('0x33')](_0x207c53[_0xc6bf('0x30')]['fields']));_0xc3c777[_0xc6bf('0x32')]=_0xc3c777[_0xc6bf('0x32')]['length']?_0xc3c777[_0xc6bf('0x32')]:_0x28e35e[_0xc6bf('0x2f')];if(!_0x207c53['query'][_0xc6bf('0x34')](_0xc6bf('0x35'))){_0xc3c777['limit']=qs[_0xc6bf('0x1d')](_0x207c53[_0xc6bf('0x30')][_0xc6bf('0x1d')]);_0xc3c777[_0xc6bf('0x1b')]=qs[_0xc6bf('0x1b')](_0x207c53[_0xc6bf('0x30')][_0xc6bf('0x1b')]);}_0xc3c777[_0xc6bf('0x36')]=qs[_0xc6bf('0x37')](_0x207c53['query'][_0xc6bf('0x37')]);_0xc3c777['where']=qs['filters'](_[_0xc6bf('0x38')](_0x207c53[_0xc6bf('0x30')],_0x28e35e[_0xc6bf('0x39')]),_0x4c1ffb);if(_0x207c53[_0xc6bf('0x30')][_0xc6bf('0x3a')]){_0xc3c777[_0xc6bf('0x3b')]=_[_0xc6bf('0x3c')](_0xc3c777[_0xc6bf('0x3b')],{'$or':_['map'](_0x4c1ffb,function(_0x3a6413){if(_0x3a6413[_0xc6bf('0x2e')]!==_0xc6bf('0x3d')){var _0x1b92a5={};_0x1b92a5[_0x3a6413[_0xc6bf('0x28')]]={'$like':'%'+_0x207c53[_0xc6bf('0x30')][_0xc6bf('0x3a')]+'%'};return _0x1b92a5;}})});}_0xc3c777=_[_0xc6bf('0x3c')]({},_0xc3c777,_0x207c53[_0xc6bf('0x3e')]);var _0x2bb26b={'where':_0xc3c777['where']};return db['SalesforceField'][_0xc6bf('0x1e')](_0x2bb26b)[_0xc6bf('0x24')](function(_0x2369d5){_0xfd1d29[_0xc6bf('0x1e')]=_0x2369d5;if(_0x207c53[_0xc6bf('0x30')]['includeAll']){_0xc3c777[_0xc6bf('0x3f')]=[{'all':!![]}];}return db[_0xc6bf('0x2b')][_0xc6bf('0x40')](_0xc3c777);})[_0xc6bf('0x24')](function(_0x609392){_0xfd1d29[_0xc6bf('0x41')]=_0x609392;return _0xfd1d29;})[_0xc6bf('0x24')](respondWithFilteredResult(_0x555b2c,_0xc3c777))['catch'](handleError(_0x555b2c,null));};exports[_0xc6bf('0x42')]=function(_0x4c92b2,_0x3e337c){var _0x11a0fe={'raw':!![],'where':{'id':_0x4c92b2[_0xc6bf('0x43')]['id']}},_0x5c687a={};_0x5c687a[_0xc6bf('0x2f')]=_['keys'](db[_0xc6bf('0x2b')][_0xc6bf('0x2c')]);_0x5c687a['query']=_['keys'](_0x4c92b2[_0xc6bf('0x30')]);_0x5c687a[_0xc6bf('0x39')]=_['intersection'](_0x5c687a[_0xc6bf('0x2f')],_0x5c687a[_0xc6bf('0x30')]);_0x11a0fe[_0xc6bf('0x32')]=_[_0xc6bf('0x31')](_0x5c687a['model'],qs['fields'](_0x4c92b2[_0xc6bf('0x30')]['fields']));_0x11a0fe[_0xc6bf('0x32')]=_0x11a0fe[_0xc6bf('0x32')][_0xc6bf('0x44')]?_0x11a0fe[_0xc6bf('0x32')]:_0x5c687a[_0xc6bf('0x2f')];if(_0x4c92b2[_0xc6bf('0x30')][_0xc6bf('0x45')]){_0x11a0fe[_0xc6bf('0x3f')]=[{'all':!![]}];}_0x11a0fe=_[_0xc6bf('0x3c')]({},_0x11a0fe,_0x4c92b2[_0xc6bf('0x3e')]);return db[_0xc6bf('0x2b')]['find'](_0x11a0fe)['then'](handleEntityNotFound(_0x3e337c,null))[_0xc6bf('0x24')](respondWithResult(_0x3e337c,null))[_0xc6bf('0x46')](handleError(_0x3e337c,null));};exports[_0xc6bf('0x47')]=function(_0x4fda0c,_0x4d75da){return db[_0xc6bf('0x2b')][_0xc6bf('0x47')](_0x4fda0c[_0xc6bf('0x48')],{})[_0xc6bf('0x24')](respondWithResult(_0x4d75da,0xc9))[_0xc6bf('0x46')](handleError(_0x4d75da,null));};exports['update']=function(_0x4397ff,_0x5509c0){if(_0x4397ff[_0xc6bf('0x48')]['id']){delete _0x4397ff['body']['id'];}return db[_0xc6bf('0x2b')][_0xc6bf('0x49')]({'where':{'id':_0x4397ff[_0xc6bf('0x43')]['id']}})[_0xc6bf('0x24')](handleEntityNotFound(_0x5509c0,null))['then'](saveUpdates(_0x4397ff[_0xc6bf('0x48')],null))[_0xc6bf('0x24')](respondWithResult(_0x5509c0,null))['catch'](handleError(_0x5509c0,null));};exports[_0xc6bf('0x25')]=function(_0x46473f,_0x6be44d){return db[_0xc6bf('0x2b')]['find']({'where':{'id':_0x46473f[_0xc6bf('0x43')]['id']}})[_0xc6bf('0x24')](handleEntityNotFound(_0x6be44d,null))[_0xc6bf('0x24')](removeEntity(_0x6be44d,null))[_0xc6bf('0x46')](handleError(_0x6be44d,null));};
\ No newline at end of file
index f83e79d..256bfbd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5c40=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','idField','FieldId','lodash','api'];(function(_0x4e4e02,_0xfd6b08){var _0xb19c65=function(_0x3e92bb){while(--_0x3e92bb){_0x4e4e02['push'](_0x4e4e02['shift']());}};_0xb19c65(++_0xfd6b08);}(_0x5c40,0xc1));var _0x05c4=function(_0x244be9,_0x40cb6b){_0x244be9=_0x244be9-0x0;var _0x1e8f95=_0x5c40[_0x244be9];return _0x1e8f95;};'use strict';var _=require(_0x05c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x05c4('0x1'));var moment=require(_0x05c4('0x2'));var BPromise=require(_0x05c4('0x3'));var rp=require(_0x05c4('0x4'));var fs=require('fs');var path=require(_0x05c4('0x5'));var rimraf=require(_0x05c4('0x6'));var config=require(_0x05c4('0x7'));var attributes=require(_0x05c4('0x8'));module['exports']=function(_0x570d74,_0x5bf19b){return _0x570d74[_0x05c4('0x9')](_0x05c4('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x05c4('0xb'),_0x05c4('0xc')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xcc37=['path','../../config/environment','./intSalesforceField.attributes','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5a4682,_0x221344){var _0x1d7bbc=function(_0x2fae59){while(--_0x2fae59){_0x5a4682['push'](_0x5a4682['shift']());}};_0x1d7bbc(++_0x221344);}(_0xcc37,0xa3));var _0x7cc3=function(_0x873b89,_0xa33cbb){_0x873b89=_0x873b89-0x0;var _0x179d56=_0xcc37[_0x873b89];return _0x179d56;};'use strict';var _=require('lodash');var util=require(_0x7cc3('0x0'));var logger=require(_0x7cc3('0x1'))('api');var moment=require(_0x7cc3('0x2'));var BPromise=require(_0x7cc3('0x3'));var rp=require(_0x7cc3('0x4'));var fs=require('fs');var path=require(_0x7cc3('0x5'));var rimraf=require('rimraf');var config=require(_0x7cc3('0x6'));var attributes=require(_0x7cc3('0x7'));module['exports']=function(_0x4cdc48,_0x506759){return _0x4cdc48['define']('SalesforceField',attributes,{'tableName':_0x7cc3('0x8'),'paranoid':![],'indexes':[{'name':_0x7cc3('0x9'),'fields':[_0x7cc3('0xa'),_0x7cc3('0xb')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index b4c8a02..65fc030 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5705=['SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x77a047,_0x2db097){var _0x5ac573=function(_0x3f273f){while(--_0x3f273f){_0x77a047['push'](_0x77a047['shift']());}};_0x5ac573(++_0x2db097);}(_0x5705,0xc1));var _0x5570=function(_0x2d5f67,_0x125f70){_0x2d5f67=_0x2d5f67-0x0;var _0x4c0890=_0x5705[_0x2d5f67];return _0x4c0890;};'use strict';var _=require(_0x5570('0x0'));var util=require(_0x5570('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5570('0x2'))['db'];var utils=require(_0x5570('0x3'));var logger=require(_0x5570('0x4'))('rpc');var config=require(_0x5570('0x5'));var jayson=require(_0x5570('0x6'));var client=jayson[_0x5570('0x7')][_0x5570('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f1529,_0x585535,_0x13043f){return new BPromise(function(_0x3589c2,_0x22121c){return client[_0x5570('0x9')](_0x1f1529,_0x13043f)['then'](function(_0x351ceb){logger[_0x5570('0xa')]('SalesforceField,\x20%s,\x20%s',_0x585535,'request\x20sent');logger[_0x5570('0xb')](_0x5570('0xc'),_0x585535,_0x5570('0xd'),JSON[_0x5570('0xe')](_0x351ceb));if(_0x351ceb[_0x5570('0xf')]){if(_0x351ceb[_0x5570('0xf')][_0x5570('0x10')]===0x1f4){logger[_0x5570('0xf')](_0x5570('0x11'),_0x585535,_0x351ceb[_0x5570('0xf')]['message']);return _0x22121c(_0x351ceb['error'][_0x5570('0x12')]);}logger[_0x5570('0xf')](_0x5570('0x11'),_0x585535,_0x351ceb[_0x5570('0xf')][_0x5570('0x12')]);return _0x3589c2(_0x351ceb[_0x5570('0xf')][_0x5570('0x12')]);}else{logger[_0x5570('0xa')]('SalesforceField,\x20%s,\x20%s',_0x585535,'request\x20sent');_0x3589c2(_0x351ceb[_0x5570('0x13')]['message']);}})[_0x5570('0x14')](function(_0x2dce67){logger[_0x5570('0xf')](_0x5570('0x11'),_0x585535,_0x2dce67);_0x22121c(_0x2dce67);});});}
\ No newline at end of file
+var _0x1913=['error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x557b84,_0x2b3da4){var _0x51f74d=function(_0x426a1b){while(--_0x426a1b){_0x557b84['push'](_0x557b84['shift']());}};_0x51f74d(++_0x2b3da4);}(_0x1913,0x6f));var _0x3191=function(_0x30dcb6,_0x3f62d5){_0x30dcb6=_0x30dcb6-0x0;var _0x786d58=_0x1913[_0x30dcb6];return _0x786d58;};'use strict';var _=require(_0x3191('0x0'));var util=require(_0x3191('0x1'));var moment=require(_0x3191('0x2'));var BPromise=require(_0x3191('0x3'));var rs=require(_0x3191('0x4'));var fs=require('fs');var Redis=require(_0x3191('0x5'));var db=require(_0x3191('0x6'))['db'];var utils=require(_0x3191('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3191('0x8'));var jayson=require(_0x3191('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2850ff,_0x7263f1,_0x12bcd4){return new BPromise(function(_0x3b2e2c,_0x52d4ef){return client[_0x3191('0xa')](_0x2850ff,_0x12bcd4)[_0x3191('0xb')](function(_0x369f1e){logger['info'](_0x3191('0xc'),_0x7263f1,_0x3191('0xd'));logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x7263f1,_0x3191('0xd'),JSON[_0x3191('0xe')](_0x369f1e));if(_0x369f1e[_0x3191('0xf')]){if(_0x369f1e[_0x3191('0xf')][_0x3191('0x10')]===0x1f4){logger[_0x3191('0xf')](_0x3191('0xc'),_0x7263f1,_0x369f1e[_0x3191('0xf')][_0x3191('0x11')]);return _0x52d4ef(_0x369f1e[_0x3191('0xf')][_0x3191('0x11')]);}logger[_0x3191('0xf')](_0x3191('0xc'),_0x7263f1,_0x369f1e[_0x3191('0xf')][_0x3191('0x11')]);return _0x3b2e2c(_0x369f1e[_0x3191('0xf')][_0x3191('0x11')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x7263f1,_0x3191('0xd'));_0x3b2e2c(_0x369f1e['result']['message']);}})['catch'](function(_0x22adac){logger[_0x3191('0xf')](_0x3191('0xc'),_0x7263f1,_0x22adac);_0x52d4ef(_0x22adac);});});}
\ No newline at end of file
index a2e92a9..24913a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x878f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','/:id','/:id/configurations','/:id/fields','isAuthenticated','post','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x878f,0x173));var _0xf878=function(_0x3148ab,_0x2ff6ed){_0x3148ab=_0x3148ab-0x0;var _0x5c5044=_0x878f[_0x3148ab];return _0x5c5044;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xf878('0xa')](_0xf878('0xd'),auth[_0xf878('0xe')](),controller['getFields']);router[_0xf878('0xf')]('/',auth[_0xf878('0xe')](),controller['create']);router[_0xf878('0xf')]('/:id/configurations',auth[_0xf878('0xe')](),controller[_0xf878('0x10')]);router[_0xf878('0x11')]('/:id',auth[_0xf878('0xe')](),controller[_0xf878('0x12')]);router[_0xf878('0x13')]('/:id',auth[_0xf878('0xe')](),controller[_0xf878('0x14')]);module[_0xf878('0x15')]=router;
\ No newline at end of file
+var _0x45ea=['./intServicenowAccount.controller','isAuthenticated','index','show','get','/:id/configurations','getConfigurations','getFields','post','addConfiguration','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2dc955,_0x194f38){var _0x18bce6=function(_0x4a9090){while(--_0x4a9090){_0x2dc955['push'](_0x2dc955['shift']());}};_0x18bce6(++_0x194f38);}(_0x45ea,0x1f0));var _0xa45e=function(_0x2756f0,_0x3106bb){_0x2756f0=_0x2756f0-0x0;var _0x529f93=_0x45ea[_0x2756f0];return _0x529f93;};'use strict';var multer=require(_0xa45e('0x0'));var util=require(_0xa45e('0x1'));var path=require(_0xa45e('0x2'));var timeout=require(_0xa45e('0x3'));var express=require(_0xa45e('0x4'));var router=express[_0xa45e('0x5')]();var fs_extra=require(_0xa45e('0x6'));var auth=require(_0xa45e('0x7'));var interaction=require(_0xa45e('0x8'));var config=require(_0xa45e('0x9'));var controller=require(_0xa45e('0xa'));router['get']('/',auth[_0xa45e('0xb')](),controller[_0xa45e('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa45e('0xd')]);router[_0xa45e('0xe')](_0xa45e('0xf'),auth[_0xa45e('0xb')](),controller[_0xa45e('0x10')]);router['get']('/:id/fields',auth[_0xa45e('0xb')](),controller[_0xa45e('0x11')]);router[_0xa45e('0x12')]('/',auth[_0xa45e('0xb')](),controller['create']);router[_0xa45e('0x12')]('/:id/configurations',auth[_0xa45e('0xb')](),controller[_0xa45e('0x13')]);router['put']('/:id',auth[_0xa45e('0xb')](),controller['update']);router[_0xa45e('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa45e('0x15')]=router;
\ No newline at end of file
index 529d1f9..1a74e0e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbe8b=['STRING','username','remoteUri','sequelize','exports'];(function(_0x129f95,_0x873196){var _0x3dfe12=function(_0x1426a4){while(--_0x1426a4){_0x129f95['push'](_0x129f95['shift']());}};_0x3dfe12(++_0x873196);}(_0xbe8b,0x1c5));var _0xbbe8=function(_0x4c471f,_0x45f98c){_0x4c471f=_0x4c471f-0x0;var _0x19dedc=_0xbe8b[_0x4c471f];return _0x19dedc;};'use strict';var Sequelize=require(_0xbbe8('0x0'));module[_0xbbe8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbbe8('0x2')]},'username':{'type':Sequelize[_0xbbe8('0x2')],'unique':_0xbbe8('0x3')},'password':{'type':Sequelize[_0xbbe8('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbbe8('0x2')],'unique':_0xbbe8('0x4')},'serverUrl':{'type':Sequelize[_0xbbe8('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0xd071=['username','remoteUri','sequelize','exports','STRING'];(function(_0x33a556,_0x2d4648){var _0xdf1e5c=function(_0xfcb69f){while(--_0xfcb69f){_0x33a556['push'](_0x33a556['shift']());}};_0xdf1e5c(++_0x2d4648);}(_0xd071,0x188));var _0x1d07=function(_0xa43040,_0x40caba){_0xa43040=_0xa43040-0x0;var _0x17d2cb=_0xd071[_0xa43040];return _0x17d2cb;};'use strict';var Sequelize=require(_0x1d07('0x0'));module[_0x1d07('0x1')]={'name':{'type':Sequelize[_0x1d07('0x2')]},'description':{'type':Sequelize[_0x1d07('0x2')]},'username':{'type':Sequelize[_0x1d07('0x2')],'unique':_0x1d07('0x3')},'password':{'type':Sequelize[_0x1d07('0x2')]},'email':{'type':Sequelize[_0x1d07('0x2')]},'remoteUri':{'type':Sequelize[_0x1d07('0x2')],'unique':_0x1d07('0x4')},'serverUrl':{'type':Sequelize[_0x1d07('0x2')],'allowNull':![]}};
\ No newline at end of file
index 2fbd6e9..b55f48d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x596b=['../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','ServicenowConfiguration','sort','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','calendar_stc','cmdb_ci','delivery_plan','active','business_service','priority','sys_domain_path','rfc','time_worked','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','correlation_display','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','severity','sla_due','approval','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','location','password','email','remoteUri','serverUrl','slice','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','includes','forEach','label','push','remove','internalType','all','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','rimraf','zip-dir','request-promise','mustache','path','to-csv','ejs','lodash','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x140c4d,_0x400d45){var _0x4cb138=function(_0x59d616){while(--_0x59d616){_0x140c4d['push'](_0x140c4d['shift']());}};_0x4cb138(++_0x400d45);}(_0x596b,0x9e));var _0xb596=function(_0x301f39,_0x192d7b){_0x301f39=_0x301f39-0x0;var _0xd2a00c=_0x596b[_0x301f39];return _0xd2a00c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb596('0x0'));var zipdir=require(_0xb596('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb596('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb596('0x3'));var util=require('util');var path=require(_0xb596('0x4'));var sox=require('sox');var csv=require(_0xb596('0x5'));var ejs=require(_0xb596('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb596('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb596('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb596('0x8'));var authService=require(_0xb596('0x9'));var qs=require('../../components/parsers/qs');var as=require(_0xb596('0xa'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb596('0xb'))(_0xb596('0xc'));var utils=require(_0xb596('0xd'));var config=require(_0xb596('0xe'));var licenseUtil=require('../../config/license/util');var db=require(_0xb596('0xf'))['db'];var integrations=require(_0xb596('0x10'));function respondWithStatusCode(_0x3edae5,_0x28aee5){_0x28aee5=_0x28aee5||0xcc;return function(_0x301a4c){if(_0x301a4c){return _0x3edae5['sendStatus'](_0x28aee5);}return _0x3edae5[_0xb596('0x11')](_0x28aee5)[_0xb596('0x12')]();};}function respondWithResult(_0x11eb54,_0x4a2de5){_0x4a2de5=_0x4a2de5||0xc8;return function(_0x8e9810){if(_0x8e9810){return _0x11eb54[_0xb596('0x11')](_0x4a2de5)['json'](_0x8e9810);}};}function respondWithFilteredResult(_0x5ecffb,_0x4c9f2f){return function(_0x2d4c20){if(_0x2d4c20){var _0x54418e=typeof _0x4c9f2f[_0xb596('0x13')]===_0xb596('0x14')&&typeof _0x4c9f2f[_0xb596('0x15')]===_0xb596('0x14');var _0x34fb55=_0x2d4c20[_0xb596('0x16')];var _0x523ac6=_0x54418e?0x0:_0x4c9f2f['offset'];var _0x4e6218=_0x54418e?_0x2d4c20[_0xb596('0x16')]:_0x4c9f2f[_0xb596('0x13')]+_0x4c9f2f[_0xb596('0x15')];var _0x2a75b6;if(_0x4e6218>=_0x34fb55){_0x4e6218=_0x34fb55;_0x2a75b6=0xc8;}else{_0x2a75b6=0xce;}_0x5ecffb[_0xb596('0x11')](_0x2a75b6);return _0x5ecffb[_0xb596('0x17')](_0xb596('0x18'),_0x523ac6+'-'+_0x4e6218+'/'+_0x34fb55)[_0xb596('0x19')](_0x2d4c20);}return null;};}function patchUpdates(_0x320002){return function(_0x4f7a12){try{jsonpatch[_0xb596('0x1a')](_0x4f7a12,_0x320002,!![]);}catch(_0x733003){return BPromise[_0xb596('0x1b')](_0x733003);}return _0x4f7a12[_0xb596('0x1c')]();};}function saveUpdates(_0x4f99a4,_0x19c767){return function(_0x3b1667){if(_0x3b1667){return _0x3b1667[_0xb596('0x1d')](_0x4f99a4)['then'](function(_0x2e60e3){return _0x2e60e3;});}return null;};}function removeEntity(_0x2cc299,_0x43f818){return function(_0x11a9ac){if(_0x11a9ac){return _0x11a9ac[_0xb596('0x1e')]()[_0xb596('0x1f')](function(){_0x2cc299[_0xb596('0x11')](0xcc)[_0xb596('0x12')]();});}};}function handleEntityNotFound(_0x5c87cb,_0x33639d){return function(_0x71297b){if(!_0x71297b){_0x5c87cb[_0xb596('0x20')](0x194);}return _0x71297b;};}function handleError(_0xd8f6e0,_0x1bf0e5){_0x1bf0e5=_0x1bf0e5||0x1f4;return function(_0x58d0ce){logger[_0xb596('0x21')](_0x58d0ce[_0xb596('0x22')]);if(_0x58d0ce[_0xb596('0x23')]){delete _0x58d0ce[_0xb596('0x23')];}_0xd8f6e0[_0xb596('0x11')](_0x1bf0e5)[_0xb596('0x24')](_0x58d0ce);};}exports[_0xb596('0x25')]=function(_0x3ebb15,_0x2eed9c){var _0x2b4079={},_0x336881={},_0x408417={'count':0x0,'rows':[]};var _0x495c75=_[_0xb596('0x26')](db[_0xb596('0x27')][_0xb596('0x28')],function(_0x14d8fc){return{'name':_0x14d8fc['fieldName'],'type':_0x14d8fc[_0xb596('0x29')]['key']};});_0x336881[_0xb596('0x2a')]=_[_0xb596('0x26')](_0x495c75,_0xb596('0x23'));_0x336881[_0xb596('0x2b')]=_[_0xb596('0x2c')](_0x3ebb15[_0xb596('0x2b')]);_0x336881[_0xb596('0x2d')]=_[_0xb596('0x2e')](_0x336881[_0xb596('0x2a')],_0x336881[_0xb596('0x2b')]);_0x2b4079['attributes']=_[_0xb596('0x2e')](_0x336881[_0xb596('0x2a')],qs['fields'](_0x3ebb15[_0xb596('0x2b')][_0xb596('0x2f')]));_0x2b4079[_0xb596('0x30')]=_0x2b4079[_0xb596('0x30')][_0xb596('0x31')]?_0x2b4079['attributes']:_0x336881[_0xb596('0x2a')];if(!_0x3ebb15[_0xb596('0x2b')][_0xb596('0x32')](_0xb596('0x33'))){_0x2b4079[_0xb596('0x15')]=qs[_0xb596('0x15')](_0x3ebb15[_0xb596('0x2b')][_0xb596('0x15')]);_0x2b4079[_0xb596('0x13')]=qs[_0xb596('0x13')](_0x3ebb15[_0xb596('0x2b')][_0xb596('0x13')]);}_0x2b4079[_0xb596('0x34')]=qs['sort'](_0x3ebb15[_0xb596('0x2b')]['sort']);_0x2b4079[_0xb596('0x35')]=qs['filters'](_[_0xb596('0x36')](_0x3ebb15['query'],_0x336881['filters']),_0x495c75);if(_0x3ebb15[_0xb596('0x2b')][_0xb596('0x37')]){_0x2b4079[_0xb596('0x35')]=_['merge'](_0x2b4079[_0xb596('0x35')],{'$or':_['map'](_0x495c75,function(_0x1b4cf0){if(_0x1b4cf0['type']!==_0xb596('0x38')){var _0x345f9b={};_0x345f9b[_0x1b4cf0[_0xb596('0x23')]]={'$like':'%'+_0x3ebb15[_0xb596('0x2b')][_0xb596('0x37')]+'%'};return _0x345f9b;}})});}_0x2b4079=_[_0xb596('0x39')]({},_0x2b4079,_0x3ebb15[_0xb596('0x3a')]);var _0x196a6a={'where':_0x2b4079[_0xb596('0x35')]};return db[_0xb596('0x27')]['count'](_0x196a6a)['then'](function(_0x490348){_0x408417[_0xb596('0x16')]=_0x490348;if(_0x3ebb15[_0xb596('0x2b')][_0xb596('0x3b')]){_0x2b4079[_0xb596('0x3c')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xb596('0x3d')](_0x2b4079);})['then'](function(_0x4ba76f){_0x408417[_0xb596('0x3e')]=_0x4ba76f;return _0x408417;})[_0xb596('0x1f')](respondWithFilteredResult(_0x2eed9c,_0x2b4079))[_0xb596('0x3f')](handleError(_0x2eed9c,null));};exports[_0xb596('0x40')]=function(_0x5e2d7f,_0x252cdc){var _0x2b3ee8={'raw':![],'where':{'id':_0x5e2d7f[_0xb596('0x41')]['id']}},_0x46377c={};_0x46377c[_0xb596('0x2a')]=_['keys'](db['ServicenowAccount'][_0xb596('0x28')]);_0x46377c[_0xb596('0x2b')]=_[_0xb596('0x2c')](_0x5e2d7f[_0xb596('0x2b')]);_0x46377c[_0xb596('0x2d')]=_[_0xb596('0x2e')](_0x46377c[_0xb596('0x2a')],_0x46377c[_0xb596('0x2b')]);_0x2b3ee8[_0xb596('0x30')]=_[_0xb596('0x2e')](_0x46377c[_0xb596('0x2a')],qs['fields'](_0x5e2d7f['query']['fields']));_0x2b3ee8['attributes']=_0x2b3ee8[_0xb596('0x30')][_0xb596('0x31')]?_0x2b3ee8[_0xb596('0x30')]:_0x46377c[_0xb596('0x2a')];if(_0x5e2d7f[_0xb596('0x2b')]['includeAll']){_0x2b3ee8[_0xb596('0x3c')]=[{'all':!![]}];}_0x2b3ee8=_[_0xb596('0x39')]({},_0x2b3ee8,_0x5e2d7f[_0xb596('0x3a')]);return db[_0xb596('0x27')][_0xb596('0x42')](_0x2b3ee8)[_0xb596('0x1f')](handleEntityNotFound(_0x252cdc,null))[_0xb596('0x1f')](respondWithResult(_0x252cdc,null))[_0xb596('0x3f')](handleError(_0x252cdc,null));};exports[_0xb596('0x43')]=function(_0x28e346,_0x169e5e){return db[_0xb596('0x27')][_0xb596('0x43')](_0x28e346[_0xb596('0x44')],{})[_0xb596('0x1f')](respondWithResult(_0x169e5e,0xc9))[_0xb596('0x3f')](handleError(_0x169e5e,null));};exports[_0xb596('0x1d')]=function(_0x1e725a,_0x26b460){if(_0x1e725a[_0xb596('0x44')]['id']){delete _0x1e725a['body']['id'];}return db[_0xb596('0x27')][_0xb596('0x42')]({'where':{'id':_0x1e725a['params']['id']}})['then'](handleEntityNotFound(_0x26b460,null))[_0xb596('0x1f')](saveUpdates(_0x1e725a[_0xb596('0x44')],null))[_0xb596('0x1f')](respondWithResult(_0x26b460,null))[_0xb596('0x3f')](handleError(_0x26b460,null));};exports[_0xb596('0x1e')]=function(_0x3ab876,_0x3b56fa){return db[_0xb596('0x27')][_0xb596('0x42')]({'where':{'id':_0x3ab876[_0xb596('0x41')]['id']}})[_0xb596('0x1f')](handleEntityNotFound(_0x3b56fa,null))[_0xb596('0x1f')](removeEntity(_0x3b56fa,null))[_0xb596('0x3f')](handleError(_0x3b56fa,null));};exports[_0xb596('0x45')]=function(_0x20cf9b,_0x355491,_0x577c41){var _0x5864f6={};var _0x59c528={};var _0x4d4edb;var _0x3ff9a0;return db[_0xb596('0x27')][_0xb596('0x46')]({'where':{'id':_0x20cf9b[_0xb596('0x41')]['id']}})['then'](handleEntityNotFound(_0x355491,null))[_0xb596('0x1f')](function(_0x4b0c32){if(_0x4b0c32){_0x4d4edb=_0x4b0c32;_0x59c528['model']=_[_0xb596('0x2c')](db[_0xb596('0x47')][_0xb596('0x28')]);_0x59c528[_0xb596('0x2b')]=_[_0xb596('0x2c')](_0x20cf9b[_0xb596('0x2b')]);_0x59c528[_0xb596('0x2d')]=_[_0xb596('0x2e')](_0x59c528[_0xb596('0x2a')],_0x59c528[_0xb596('0x2b')]);_0x5864f6[_0xb596('0x30')]=_['intersection'](_0x59c528[_0xb596('0x2a')],qs[_0xb596('0x2f')](_0x20cf9b['query'][_0xb596('0x2f')]));_0x5864f6[_0xb596('0x30')]=_0x5864f6['attributes'][_0xb596('0x31')]?_0x5864f6[_0xb596('0x30')]:_0x59c528['model'];_0x5864f6[_0xb596('0x34')]=qs[_0xb596('0x48')](_0x20cf9b[_0xb596('0x2b')][_0xb596('0x48')]);_0x5864f6[_0xb596('0x35')]=qs[_0xb596('0x2d')](_[_0xb596('0x36')](_0x20cf9b[_0xb596('0x2b')],_0x59c528[_0xb596('0x2d')]));if(_0x20cf9b[_0xb596('0x2b')][_0xb596('0x37')]){_0x5864f6[_0xb596('0x35')]=_[_0xb596('0x39')](_0x5864f6[_0xb596('0x35')],{'$or':_[_0xb596('0x26')](_0x5864f6[_0xb596('0x30')],function(_0x3748eb){var _0x39ec1a={};_0x39ec1a[_0x3748eb]={'$like':'%'+_0x20cf9b[_0xb596('0x2b')]['filter']+'%'};return _0x39ec1a;})});}_0x5864f6=_[_0xb596('0x39')]({},_0x5864f6,_0x20cf9b[_0xb596('0x3a')]);return _0x4d4edb[_0xb596('0x45')](_0x5864f6);}})[_0xb596('0x1f')](function(_0x79abfc){if(_0x79abfc){_0x3ff9a0=_0x79abfc[_0xb596('0x31')];if(!_0x20cf9b[_0xb596('0x2b')][_0xb596('0x32')]('nolimit')){_0x5864f6[_0xb596('0x15')]=qs[_0xb596('0x15')](_0x20cf9b[_0xb596('0x2b')][_0xb596('0x15')]);_0x5864f6['offset']=qs[_0xb596('0x13')](_0x20cf9b['query']['offset']);}return _0x4d4edb['getConfigurations'](_0x5864f6);}})[_0xb596('0x1f')](function(_0x547a44){if(_0x547a44){return _0x547a44?{'count':_0x3ff9a0,'rows':_0x547a44}:null;}})['then'](respondWithResult(_0x355491,null))[_0xb596('0x3f')](handleError(_0x355491,null));};exports['addConfiguration']=function(_0x497df0,_0x35f96f,_0x13876d){if(_0x497df0[_0xb596('0x44')]['id']){delete _0x497df0[_0xb596('0x44')]['id'];}return db[_0xb596('0x27')][_0xb596('0x46')]({'where':{'id':_0x497df0[_0xb596('0x41')]['id']}})[_0xb596('0x1f')](handleEntityNotFound(_0x35f96f,null))[_0xb596('0x1f')](function(_0x49f199){if(_0x49f199){_0x497df0[_0xb596('0x44')][_0xb596('0x49')]=_0x49f199['id'];_0x497df0[_0xb596('0x44')][_0xb596('0x4a')]=integrations[_0xb596('0x4b')](_0x497df0[_0xb596('0x44')][_0xb596('0x4c')],_0x497df0[_0xb596('0x44')][_0xb596('0x29')]);_0x497df0[_0xb596('0x44')]['Descriptions']=integrations[_0xb596('0x4d')](_0x497df0[_0xb596('0x44')][_0xb596('0x4c')],_0x497df0[_0xb596('0x44')][_0xb596('0x29')]);return db[_0xb596('0x47')][_0xb596('0x43')](_0x497df0['body'],{'include':[{'model':db[_0xb596('0x4e')],'as':_0xb596('0x4a')},{'model':db[_0xb596('0x4e')],'as':_0xb596('0x4f')}]});}return null;})['then'](respondWithResult(_0x35f96f,null))[_0xb596('0x3f')](handleError(_0x35f96f,null));};exports['getFields']=function(_0x3b2033,_0x2f011f,_0x95edb3){var _0x16b256=[_0xb596('0x50'),_0xb596('0x51'),_0xb596('0x52'),_0xb596('0x53'),_0xb596('0x54'),_0xb596('0x55'),_0xb596('0x56'),'severity',_0xb596('0x57')];var _0x124ba4=[_0xb596('0x58'),_0xb596('0x50'),_0xb596('0x59'),'watch_list',_0xb596('0x5a'),_0xb596('0x5b'),_0xb596('0x5c'),_0xb596('0x51'),'approval_history',_0xb596('0x5d'),_0xb596('0x5e'),_0xb596('0x5f'),'opened_by',_0xb596('0x60'),_0xb596('0x61'),_0xb596('0x62'),_0xb596('0x63'),'sys_created_by',_0xb596('0x52'),_0xb596('0x34'),_0xb596('0x64'),'closed_at',_0xb596('0x65'),_0xb596('0x66'),'impact',_0xb596('0x67'),'work_notes_list',_0xb596('0x68'),_0xb596('0x69'),_0xb596('0x6a'),_0xb596('0x6b'),_0xb596('0x6c'),'expected_start','opened_at',_0xb596('0x6d'),_0xb596('0x6e'),_0xb596('0x6f'),_0xb596('0x70'),_0xb596('0x71'),'caller_id',_0xb596('0x72'),_0xb596('0x53'),'work_notes','short_description',_0xb596('0x54'),_0xb596('0x73'),'delivery_task','work_start',_0xb596('0x74'),_0xb596('0x75'),_0xb596('0x76'),_0xb596('0x77'),_0xb596('0x78'),_0xb596('0x55'),_0xb596('0x79'),'close_notes',_0xb596('0x7a'),_0xb596('0x7b'),_0xb596('0x7c'),_0xb596('0x7d'),_0xb596('0x7e'),_0xb596('0x7f'),'incident_state',_0xb596('0x80'),_0xb596('0x81'),_0xb596('0x82'),_0xb596('0x83'),_0xb596('0x84'),'assigned_to',_0xb596('0x85'),'comments',_0xb596('0x86'),_0xb596('0x87'),'comments_and_work_notes',_0xb596('0x88'),_0xb596('0x89'),'reopen_count',_0xb596('0x8a'),_0xb596('0x8b'),_0xb596('0x8c'),_0xb596('0x8d'),_0xb596('0x8e'),_0xb596('0x57')];var _0x2bee5d='';var _0x99057e='';var _0x1af7db=[];var _0x1a3840='';var _0x416d21='';var _0x294dd5=[];var _0x4f79c6='';var _0x4fb68c='';var _0x40f87d={};var _0x23a561='';return db['ServicenowAccount'][_0xb596('0x46')]({'where':{'id':_0x3b2033[_0xb596('0x41')]['id']},'attributes':['id','username',_0xb596('0x8f'),_0xb596('0x90'),_0xb596('0x91'),_0xb596('0x92')]})['then'](handleEntityNotFound(_0x2f011f,null))['then'](function(_0x29433c){if(_0x29433c){_0x23a561=_0x29433c[_0xb596('0x91')];var _0x3cdff9=_0x23a561[_0xb596('0x93')](-0x1);if(_0x3cdff9==='/'){_0x23a561=_0x23a561['substring'](0x0,_0x23a561[_0xb596('0x94')](_0x3cdff9));}_0x4fb68c=util['format'](_0xb596('0x95'),_0x23a561);_0x4f79c6=util['format'](_0xb596('0x96'),_0x23a561);_0x40f87d={'user':_0x29433c['username'],'pass':_0x29433c[_0xb596('0x8f')]};var _0x333303={'method':_0xb596('0x97'),'uri':_0x4fb68c+'incident?sysparm_display_value=all','auth':_0x40f87d,'json':!![]};return rp(_0x333303);}})[_0xb596('0x1f')](function(_0x577b2b){if(_0x577b2b[_0xb596('0x98')][_0xb596('0x31')]>0x0){_0x2bee5d=_0x577b2b[_0xb596('0x98')];}console[_0xb596('0x99')](_0xb596('0x9a'),_0x2bee5d);_0x294dd5=[];_0x99057e=Object[_0xb596('0x9b')]([],_0x2bee5d);_['remove'](_0x99057e,function(_0x46b7e4){return!_0x16b256[_0xb596('0x9c')](_0x46b7e4[_0xb596('0x23')]);});_0x99057e[_0xb596('0x9d')](function(_0x5182fe){var _0x1ca913=createFieldObject(_0x4f79c6,_0x40f87d,_0x5182fe['internalType'],_0x5182fe['name'],_0x5182fe[_0xb596('0x9e')],![]);_0x294dd5[_0xb596('0x9f')](_0x1ca913);});return Promise['all'](_0x294dd5);})['then'](function(_0x52e611){_0x1af7db=_0x52e611;_0x1a3840=Object[_0xb596('0x9b')]([],_0x2bee5d);console[_0xb596('0x99')]('TCL:\x20_object',_0x2bee5d);_[_0xb596('0xa0')](_0x1a3840,function(_0x3b78de){return _0x124ba4[_0xb596('0x9c')](_0x3b78de[_0xb596('0x23')]);});console[_0xb596('0x99')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x1a3840);_0x294dd5=[];_0x1a3840['forEach'](function(_0x2c97f9){var _0x40ed2b=createFieldObject(_0x4f79c6,_0x40f87d,_0x2c97f9[_0xb596('0xa1')],_0x2c97f9['name'],_0x2c97f9[_0xb596('0x9e')],!![]);_0x294dd5[_0xb596('0x9f')](_0x40ed2b);});return Promise[_0xb596('0xa2')](_0x294dd5);})[_0xb596('0x1f')](function(_0x1e754f){_0x416d21=_0x1e754f;var _0x4f7486=_0x1af7db[_0xb596('0xa3')](_0x416d21);return{'count':_0x4f7486[_0xb596('0x31')],'rows':_0x4f7486};})[_0xb596('0x1f')](respondWithResult(_0x2f011f,null))['catch'](function(_0x2dbc7a){console[_0xb596('0x99')](_0xb596('0xa4')+_0x2dbc7a);var _0x2dd298=_0x3b2033[_0xb596('0x2b')]['test']?0x1f4:_0x2dbc7a[_0xb596('0xa5')]||0x1f4;logger[_0xb596('0x21')](_0x2dbc7a[_0xb596('0x22')]);delete _0x2dbc7a[_0xb596('0x23')];if(_0x2dd298===0x191){_0x2dd298=0x190;}_0x2f011f[_0xb596('0x11')](_0x2dd298)['send'](_0x3b2033['query'][_0xb596('0xa6')]?{'message':_0xb596('0xa7'),'statusCode':_0x2dbc7a['statusCode']}:_0x2dbc7a);});};function createFieldObject(_0x40d053,_0x558ce8,_0x426d4b,_0x53a27f,_0x286f05,_0x39b89e){return new Promise(function(_0x320be4,_0x4f76f8){var _0x5e910d={'id':_0x53a27f,'name':_0x286f05,'custom':_0x39b89e};if(_0x426d4b===_0xb596('0xa8')){_0x5e910d[_0xb596('0x3a')]=[{'name':_0xb596('0xa9'),'value':_0xb596('0xaa')},{'name':_0xb596('0xab'),'value':'false'}];_0x320be4(_0x5e910d);}else{var _0x1eb279={'method':'GET','uri':_0x40d053+_0xb596('0xac')+_0x53a27f,'auth':_0x558ce8,'json':!![]};return rp(_0x1eb279)[_0xb596('0x1f')](function(_0x2b8f61){var _0x3dfd2d=[];if(_0x2b8f61[_0xb596('0x98')]['length']>0x0){_0x2b8f61[_0xb596('0x98')][_0xb596('0x9d')](function(_0x7fe90f){if(_0x7fe90f['inactive']==='false'){var _0x5b00d9={'name':_0x7fe90f[_0xb596('0x9e')],'value':_0x7fe90f['value']};_0x3dfd2d[_0xb596('0x9f')](_0x5b00d9);}});}_0x5e910d[_0xb596('0x3a')]=_0x3dfd2d;if(_0x5e910d[_0xb596('0x3a')][_0xb596('0x31')]>0x0){_0x320be4(_0x5e910d);}else{if(_0x39b89e==![]){_0x320be4();}else{_0x320be4(_0x5e910d);}}});}});}
\ No newline at end of file
+var _0x7d48=['limit','count','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','ServicenowAccount','include','findAll','rows','show','params','includeAll','find','catch','create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','made_sla','hold_reason','subcategory','severity','category','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_created_on','state','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','assignment_group','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','username','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','password','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','label','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','all','ServiceNow\x20error:\x20','test','statusCode','True','False','inactive','false','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x7d48,0x99));var _0x87d4=function(_0x523d97,_0x13f7ae){_0x523d97=_0x523d97-0x0;var _0x1181be=_0x7d48[_0x523d97];return _0x1181be;};'use strict';var emlformat=require(_0x87d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x87d4('0x1'));var jsonpatch=require(_0x87d4('0x2'));var rp=require(_0x87d4('0x3'));var moment=require(_0x87d4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x87d4('0x5'));var path=require(_0x87d4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87d4('0x7'));var squel=require(_0x87d4('0x8'));var crypto=require(_0x87d4('0x9'));var jsforce=require(_0x87d4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x87d4('0xb'));var querystring=require(_0x87d4('0xc'));var Papa=require(_0x87d4('0xd'));var Redis=require('ioredis');var authService=require(_0x87d4('0xe'));var qs=require(_0x87d4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x87d4('0x10'));var logger=require(_0x87d4('0x11'))(_0x87d4('0x12'));var utils=require(_0x87d4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x87d4('0x14'))['db'];var integrations=require(_0x87d4('0x15'));function respondWithStatusCode(_0x53de4d,_0x12e73a){_0x12e73a=_0x12e73a||0xcc;return function(_0x49915e){if(_0x49915e){return _0x53de4d[_0x87d4('0x16')](_0x12e73a);}return _0x53de4d[_0x87d4('0x17')](_0x12e73a)[_0x87d4('0x18')]();};}function respondWithResult(_0x4f01fb,_0x221192){_0x221192=_0x221192||0xc8;return function(_0x28d1cf){if(_0x28d1cf){return _0x4f01fb[_0x87d4('0x17')](_0x221192)[_0x87d4('0x19')](_0x28d1cf);}};}function respondWithFilteredResult(_0x12b787,_0x30a886){return function(_0x3e5953){if(_0x3e5953){var _0x5719e4=typeof _0x30a886[_0x87d4('0x1a')]===_0x87d4('0x1b')&&typeof _0x30a886[_0x87d4('0x1c')]==='undefined';var _0xf9d2b9=_0x3e5953['count'];var _0x4ad07c=_0x5719e4?0x0:_0x30a886[_0x87d4('0x1a')];var _0x43ec9b=_0x5719e4?_0x3e5953[_0x87d4('0x1d')]:_0x30a886['offset']+_0x30a886[_0x87d4('0x1c')];var _0x19fa5c;if(_0x43ec9b>=_0xf9d2b9){_0x43ec9b=_0xf9d2b9;_0x19fa5c=0xc8;}else{_0x19fa5c=0xce;}_0x12b787[_0x87d4('0x17')](_0x19fa5c);return _0x12b787['set'](_0x87d4('0x1e'),_0x4ad07c+'-'+_0x43ec9b+'/'+_0xf9d2b9)[_0x87d4('0x19')](_0x3e5953);}return null;};}function patchUpdates(_0x25e88a){return function(_0x3e63be){try{jsonpatch[_0x87d4('0x1f')](_0x3e63be,_0x25e88a,!![]);}catch(_0x472596){return BPromise['reject'](_0x472596);}return _0x3e63be[_0x87d4('0x20')]();};}function saveUpdates(_0x160cd7,_0x7a3925){return function(_0x57c7b1){if(_0x57c7b1){return _0x57c7b1[_0x87d4('0x21')](_0x160cd7)[_0x87d4('0x22')](function(_0x416d8c){return _0x416d8c;});}return null;};}function removeEntity(_0x5c2d58,_0x128b81){return function(_0x32334e){if(_0x32334e){return _0x32334e[_0x87d4('0x23')]()[_0x87d4('0x22')](function(){_0x5c2d58[_0x87d4('0x17')](0xcc)[_0x87d4('0x18')]();});}};}function handleEntityNotFound(_0x2fce44,_0xf31169){return function(_0x4c684a){if(!_0x4c684a){_0x2fce44[_0x87d4('0x16')](0x194);}return _0x4c684a;};}function handleError(_0x2c828a,_0x574c17){_0x574c17=_0x574c17||0x1f4;return function(_0x2c4865){logger['error'](_0x2c4865[_0x87d4('0x24')]);if(_0x2c4865[_0x87d4('0x25')]){delete _0x2c4865['name'];}_0x2c828a[_0x87d4('0x17')](_0x574c17)[_0x87d4('0x26')](_0x2c4865);};}exports[_0x87d4('0x27')]=function(_0x1f2ea9,_0x190add){var _0x45d84c={},_0x22757b={},_0x36ab2c={'count':0x0,'rows':[]};var _0xd17510=_[_0x87d4('0x28')](db['ServicenowAccount'][_0x87d4('0x29')],function(_0x4ed173){return{'name':_0x4ed173['fieldName'],'type':_0x4ed173['type'][_0x87d4('0x2a')]};});_0x22757b[_0x87d4('0x2b')]=_[_0x87d4('0x28')](_0xd17510,_0x87d4('0x25'));_0x22757b['query']=_[_0x87d4('0x2c')](_0x1f2ea9[_0x87d4('0x2d')]);_0x22757b[_0x87d4('0x2e')]=_[_0x87d4('0x2f')](_0x22757b[_0x87d4('0x2b')],_0x22757b[_0x87d4('0x2d')]);_0x45d84c['attributes']=_[_0x87d4('0x2f')](_0x22757b['model'],qs[_0x87d4('0x30')](_0x1f2ea9['query'][_0x87d4('0x30')]));_0x45d84c[_0x87d4('0x31')]=_0x45d84c[_0x87d4('0x31')][_0x87d4('0x32')]?_0x45d84c[_0x87d4('0x31')]:_0x22757b[_0x87d4('0x2b')];if(!_0x1f2ea9[_0x87d4('0x2d')][_0x87d4('0x33')](_0x87d4('0x34'))){_0x45d84c[_0x87d4('0x1c')]=qs[_0x87d4('0x1c')](_0x1f2ea9['query'][_0x87d4('0x1c')]);_0x45d84c[_0x87d4('0x1a')]=qs[_0x87d4('0x1a')](_0x1f2ea9[_0x87d4('0x2d')][_0x87d4('0x1a')]);}_0x45d84c[_0x87d4('0x35')]=qs['sort'](_0x1f2ea9['query'][_0x87d4('0x36')]);_0x45d84c['where']=qs['filters'](_[_0x87d4('0x37')](_0x1f2ea9[_0x87d4('0x2d')],_0x22757b[_0x87d4('0x2e')]),_0xd17510);if(_0x1f2ea9[_0x87d4('0x2d')][_0x87d4('0x38')]){_0x45d84c[_0x87d4('0x39')]=_[_0x87d4('0x3a')](_0x45d84c[_0x87d4('0x39')],{'$or':_[_0x87d4('0x28')](_0xd17510,function(_0x362936){if(_0x362936[_0x87d4('0x3b')]!==_0x87d4('0x3c')){var _0x433b9a={};_0x433b9a[_0x362936['name']]={'$like':'%'+_0x1f2ea9[_0x87d4('0x2d')][_0x87d4('0x38')]+'%'};return _0x433b9a;}})});}_0x45d84c=_[_0x87d4('0x3a')]({},_0x45d84c,_0x1f2ea9[_0x87d4('0x3d')]);var _0x18c344={'where':_0x45d84c[_0x87d4('0x39')]};return db[_0x87d4('0x3e')][_0x87d4('0x1d')](_0x18c344)[_0x87d4('0x22')](function(_0x4a8b4a){_0x36ab2c[_0x87d4('0x1d')]=_0x4a8b4a;if(_0x1f2ea9[_0x87d4('0x2d')]['includeAll']){_0x45d84c[_0x87d4('0x3f')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x87d4('0x40')](_0x45d84c);})[_0x87d4('0x22')](function(_0x3eff18){_0x36ab2c[_0x87d4('0x41')]=_0x3eff18;return _0x36ab2c;})[_0x87d4('0x22')](respondWithFilteredResult(_0x190add,_0x45d84c))['catch'](handleError(_0x190add,null));};exports[_0x87d4('0x42')]=function(_0x385993,_0x2b107b){var _0x4ab76d={'raw':![],'where':{'id':_0x385993[_0x87d4('0x43')]['id']}},_0x2c9350={};_0x2c9350[_0x87d4('0x2b')]=_[_0x87d4('0x2c')](db[_0x87d4('0x3e')][_0x87d4('0x29')]);_0x2c9350[_0x87d4('0x2d')]=_[_0x87d4('0x2c')](_0x385993[_0x87d4('0x2d')]);_0x2c9350[_0x87d4('0x2e')]=_[_0x87d4('0x2f')](_0x2c9350[_0x87d4('0x2b')],_0x2c9350[_0x87d4('0x2d')]);_0x4ab76d[_0x87d4('0x31')]=_[_0x87d4('0x2f')](_0x2c9350[_0x87d4('0x2b')],qs[_0x87d4('0x30')](_0x385993[_0x87d4('0x2d')]['fields']));_0x4ab76d[_0x87d4('0x31')]=_0x4ab76d[_0x87d4('0x31')][_0x87d4('0x32')]?_0x4ab76d['attributes']:_0x2c9350['model'];if(_0x385993[_0x87d4('0x2d')][_0x87d4('0x44')]){_0x4ab76d[_0x87d4('0x3f')]=[{'all':!![]}];}_0x4ab76d=_[_0x87d4('0x3a')]({},_0x4ab76d,_0x385993[_0x87d4('0x3d')]);return db[_0x87d4('0x3e')][_0x87d4('0x45')](_0x4ab76d)[_0x87d4('0x22')](handleEntityNotFound(_0x2b107b,null))[_0x87d4('0x22')](respondWithResult(_0x2b107b,null))[_0x87d4('0x46')](handleError(_0x2b107b,null));};exports[_0x87d4('0x47')]=function(_0x172547,_0x110cd5){return db[_0x87d4('0x3e')]['create'](_0x172547[_0x87d4('0x48')],{})[_0x87d4('0x22')](respondWithResult(_0x110cd5,0xc9))[_0x87d4('0x46')](handleError(_0x110cd5,null));};exports[_0x87d4('0x21')]=function(_0x4a098a,_0x1015c7){if(_0x4a098a[_0x87d4('0x48')]['id']){delete _0x4a098a[_0x87d4('0x48')]['id'];}return db[_0x87d4('0x3e')][_0x87d4('0x45')]({'where':{'id':_0x4a098a[_0x87d4('0x43')]['id']}})[_0x87d4('0x22')](handleEntityNotFound(_0x1015c7,null))[_0x87d4('0x22')](saveUpdates(_0x4a098a[_0x87d4('0x48')],null))[_0x87d4('0x22')](respondWithResult(_0x1015c7,null))[_0x87d4('0x46')](handleError(_0x1015c7,null));};exports[_0x87d4('0x23')]=function(_0x1cd89f,_0x2fa241){return db[_0x87d4('0x3e')][_0x87d4('0x45')]({'where':{'id':_0x1cd89f['params']['id']}})[_0x87d4('0x22')](handleEntityNotFound(_0x2fa241,null))[_0x87d4('0x22')](removeEntity(_0x2fa241,null))[_0x87d4('0x46')](handleError(_0x2fa241,null));};exports[_0x87d4('0x49')]=function(_0xd9c251,_0x2f81b8,_0x339d6e){var _0x4de740={};var _0x4f91a8={};var _0x1233ed;var _0x5cade0;return db[_0x87d4('0x3e')][_0x87d4('0x4a')]({'where':{'id':_0xd9c251[_0x87d4('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f81b8,null))[_0x87d4('0x22')](function(_0x5aef32){if(_0x5aef32){_0x1233ed=_0x5aef32;_0x4f91a8[_0x87d4('0x2b')]=_[_0x87d4('0x2c')](db[_0x87d4('0x4b')][_0x87d4('0x29')]);_0x4f91a8[_0x87d4('0x2d')]=_['keys'](_0xd9c251['query']);_0x4f91a8[_0x87d4('0x2e')]=_[_0x87d4('0x2f')](_0x4f91a8[_0x87d4('0x2b')],_0x4f91a8[_0x87d4('0x2d')]);_0x4de740[_0x87d4('0x31')]=_['intersection'](_0x4f91a8[_0x87d4('0x2b')],qs['fields'](_0xd9c251[_0x87d4('0x2d')][_0x87d4('0x30')]));_0x4de740[_0x87d4('0x31')]=_0x4de740[_0x87d4('0x31')][_0x87d4('0x32')]?_0x4de740['attributes']:_0x4f91a8[_0x87d4('0x2b')];_0x4de740[_0x87d4('0x35')]=qs[_0x87d4('0x36')](_0xd9c251[_0x87d4('0x2d')][_0x87d4('0x36')]);_0x4de740[_0x87d4('0x39')]=qs[_0x87d4('0x2e')](_[_0x87d4('0x37')](_0xd9c251['query'],_0x4f91a8['filters']));if(_0xd9c251['query'][_0x87d4('0x38')]){_0x4de740['where']=_[_0x87d4('0x3a')](_0x4de740[_0x87d4('0x39')],{'$or':_[_0x87d4('0x28')](_0x4de740[_0x87d4('0x31')],function(_0xfd80f1){var _0x38c5d5={};_0x38c5d5[_0xfd80f1]={'$like':'%'+_0xd9c251[_0x87d4('0x2d')]['filter']+'%'};return _0x38c5d5;})});}_0x4de740=_['merge']({},_0x4de740,_0xd9c251[_0x87d4('0x3d')]);return _0x1233ed[_0x87d4('0x49')](_0x4de740);}})[_0x87d4('0x22')](function(_0x164918){if(_0x164918){_0x5cade0=_0x164918[_0x87d4('0x32')];if(!_0xd9c251[_0x87d4('0x2d')][_0x87d4('0x33')]('nolimit')){_0x4de740[_0x87d4('0x1c')]=qs[_0x87d4('0x1c')](_0xd9c251['query'][_0x87d4('0x1c')]);_0x4de740[_0x87d4('0x1a')]=qs['offset'](_0xd9c251[_0x87d4('0x2d')][_0x87d4('0x1a')]);}return _0x1233ed[_0x87d4('0x49')](_0x4de740);}})['then'](function(_0x2aa930){if(_0x2aa930){return _0x2aa930?{'count':_0x5cade0,'rows':_0x2aa930}:null;}})[_0x87d4('0x22')](respondWithResult(_0x2f81b8,null))[_0x87d4('0x46')](handleError(_0x2f81b8,null));};exports[_0x87d4('0x4c')]=function(_0x40c204,_0x26c1d7,_0x4a94d7){if(_0x40c204[_0x87d4('0x48')]['id']){delete _0x40c204[_0x87d4('0x48')]['id'];}return db[_0x87d4('0x3e')]['findOne']({'where':{'id':_0x40c204['params']['id']}})[_0x87d4('0x22')](handleEntityNotFound(_0x26c1d7,null))['then'](function(_0x4066f6){if(_0x4066f6){_0x40c204[_0x87d4('0x48')][_0x87d4('0x4d')]=_0x4066f6['id'];_0x40c204[_0x87d4('0x48')][_0x87d4('0x4e')]=integrations[_0x87d4('0x4f')](_0x40c204['body'][_0x87d4('0x50')],_0x40c204[_0x87d4('0x48')][_0x87d4('0x3b')]);_0x40c204['body'][_0x87d4('0x51')]=integrations['getDescriptions'](_0x40c204[_0x87d4('0x48')][_0x87d4('0x50')],_0x40c204[_0x87d4('0x48')][_0x87d4('0x3b')]);return db[_0x87d4('0x4b')]['create'](_0x40c204[_0x87d4('0x48')],{'include':[{'model':db[_0x87d4('0x52')],'as':_0x87d4('0x4e')},{'model':db[_0x87d4('0x52')],'as':_0x87d4('0x51')}]});}return null;})['then'](respondWithResult(_0x26c1d7,null))['catch'](handleError(_0x26c1d7,null));};exports[_0x87d4('0x53')]=function(_0xb7410d,_0x44c3f2,_0x4e2739){var _0x448d4c=[_0x87d4('0x54'),_0x87d4('0x55'),'knowledge',_0x87d4('0x56'),'close_code','notify','incident_state',_0x87d4('0x57'),_0x87d4('0x58')];var _0x50e480=['parent',_0x87d4('0x54'),_0x87d4('0x59'),_0x87d4('0x5a'),_0x87d4('0x5b'),'sys_updated_on',_0x87d4('0x5c'),_0x87d4('0x55'),_0x87d4('0x5d'),_0x87d4('0x5e'),'resolved_by',_0x87d4('0x5f'),_0x87d4('0x60'),_0x87d4('0x61'),_0x87d4('0x62'),'sys_domain',_0x87d4('0x63'),'sys_created_by',_0x87d4('0x64'),_0x87d4('0x35'),_0x87d4('0x65'),_0x87d4('0x66'),_0x87d4('0x67'),_0x87d4('0x68'),_0x87d4('0x69'),_0x87d4('0x6a'),_0x87d4('0x6b'),_0x87d4('0x6c'),_0x87d4('0x6d'),_0x87d4('0x6e'),_0x87d4('0x6f'),_0x87d4('0x70'),_0x87d4('0x71'),_0x87d4('0x72'),_0x87d4('0x73'),_0x87d4('0x74'),_0x87d4('0x75'),_0x87d4('0x76'),_0x87d4('0x77'),_0x87d4('0x78'),_0x87d4('0x79'),_0x87d4('0x56'),_0x87d4('0x7a'),'short_description','close_code','correlation_display','delivery_task','work_start',_0x87d4('0x7b'),'business_stc',_0x87d4('0x7c'),_0x87d4('0x7d'),_0x87d4('0x7e'),_0x87d4('0x7f'),_0x87d4('0x80'),_0x87d4('0x81'),'closed_by',_0x87d4('0x82'),_0x87d4('0x83'),'sys_id',_0x87d4('0x84'),_0x87d4('0x85'),'incident_state',_0x87d4('0x86'),_0x87d4('0x87'),_0x87d4('0x88'),_0x87d4('0x89'),'activity_due',_0x87d4('0x8a'),_0x87d4('0x57'),_0x87d4('0x8b'),_0x87d4('0x8c'),_0x87d4('0x8d'),_0x87d4('0x8e'),_0x87d4('0x8f'),_0x87d4('0x90'),_0x87d4('0x91'),_0x87d4('0x92'),_0x87d4('0x93'),_0x87d4('0x94'),'correlation_id',_0x87d4('0x95'),'category'];var _0x38c882='';var _0x477b29='';var _0x3de68e=[];var _0x102b8f='';var _0x416121='';var _0x24846b=[];var _0x30378d='';var _0x26249e='';var _0x4b1373={};var _0x945aa6='';return db[_0x87d4('0x3e')][_0x87d4('0x4a')]({'where':{'id':_0xb7410d[_0x87d4('0x43')]['id']},'attributes':['id',_0x87d4('0x96'),'password',_0x87d4('0x97'),_0x87d4('0x98'),'serverUrl']})[_0x87d4('0x22')](handleEntityNotFound(_0x44c3f2,null))[_0x87d4('0x22')](function(_0x2904ad){if(_0x2904ad){_0x945aa6=_0x2904ad[_0x87d4('0x98')];var _0x37755a=_0x945aa6[_0x87d4('0x99')](-0x1);if(_0x37755a==='/'){_0x945aa6=_0x945aa6[_0x87d4('0x9a')](0x0,_0x945aa6[_0x87d4('0x9b')](_0x37755a));}_0x26249e=util[_0x87d4('0x9c')](_0x87d4('0x9d'),_0x945aa6);_0x30378d=util[_0x87d4('0x9c')]('%s/api/now/table/',_0x945aa6);_0x4b1373={'user':_0x2904ad[_0x87d4('0x96')],'pass':_0x2904ad[_0x87d4('0x9e')]};var _0xecd64={'method':_0x87d4('0x9f'),'uri':_0x26249e+_0x87d4('0xa0'),'auth':_0x4b1373,'json':!![]};return rp(_0xecd64);}})[_0x87d4('0x22')](function(_0x2cd416){if(_0x2cd416[_0x87d4('0xa1')]['length']>0x0){_0x38c882=_0x2cd416['result'];}console[_0x87d4('0xa2')]('incident\x20table\x20objects',_0x38c882);_0x24846b=[];_0x477b29=Object[_0x87d4('0xa3')]([],_0x38c882);_[_0x87d4('0xa4')](_0x477b29,function(_0x316995){return!_0x448d4c[_0x87d4('0xa5')](_0x316995[_0x87d4('0x25')]);});_0x477b29[_0x87d4('0xa6')](function(_0x17f43f){var _0x5145d2=createFieldObject(_0x30378d,_0x4b1373,_0x17f43f[_0x87d4('0xa7')],_0x17f43f[_0x87d4('0x25')],_0x17f43f[_0x87d4('0xa8')],![]);_0x24846b['push'](_0x5145d2);});return Promise['all'](_0x24846b);})['then'](function(_0x513bae){_0x3de68e=_0x513bae;_0x102b8f=Object[_0x87d4('0xa3')]([],_0x38c882);console[_0x87d4('0xa2')](_0x87d4('0xa9'),_0x38c882);_['remove'](_0x102b8f,function(_0x3bdf6c){return _0x50e480[_0x87d4('0xa5')](_0x3bdf6c['name']);});console[_0x87d4('0xa2')](_0x87d4('0xaa'),_0x102b8f);_0x24846b=[];_0x102b8f[_0x87d4('0xa6')](function(_0x1ff64b){var _0x5a5a87=createFieldObject(_0x30378d,_0x4b1373,_0x1ff64b[_0x87d4('0xa7')],_0x1ff64b[_0x87d4('0x25')],_0x1ff64b[_0x87d4('0xa8')],!![]);_0x24846b[_0x87d4('0xab')](_0x5a5a87);});return Promise[_0x87d4('0xac')](_0x24846b);})[_0x87d4('0x22')](function(_0x508ba6){_0x416121=_0x508ba6;var _0x466c30=_0x3de68e['concat'](_0x416121);return{'count':_0x466c30['length'],'rows':_0x466c30};})[_0x87d4('0x22')](respondWithResult(_0x44c3f2,null))[_0x87d4('0x46')](function(_0xae4094){console[_0x87d4('0xa2')](_0x87d4('0xad')+_0xae4094);var _0x4ff49f=_0xb7410d['query'][_0x87d4('0xae')]?0x1f4:_0xae4094[_0x87d4('0xaf')]||0x1f4;logger['error'](_0xae4094[_0x87d4('0x24')]);delete _0xae4094[_0x87d4('0x25')];if(_0x4ff49f===0x191){_0x4ff49f=0x190;}_0x44c3f2[_0x87d4('0x17')](_0x4ff49f)[_0x87d4('0x26')](_0xb7410d['query'][_0x87d4('0xae')]?{'message':'Wrong\x20credentials','statusCode':_0xae4094[_0x87d4('0xaf')]}:_0xae4094);});};function createFieldObject(_0x356ade,_0x26703a,_0x438e1d,_0x4361ce,_0x32b1fd,_0x25d607){return new Promise(function(_0x285999,_0x5b97b3){var _0x393f03={'id':_0x4361ce,'name':_0x32b1fd,'custom':_0x25d607};if(_0x438e1d==='boolean'){_0x393f03[_0x87d4('0x3d')]=[{'name':_0x87d4('0xb0'),'value':'true'},{'name':_0x87d4('0xb1'),'value':'false'}];_0x285999(_0x393f03);}else{var _0x466bad={'method':'GET','uri':_0x356ade+'sys_choice?sysparm_query=name=incident^element='+_0x4361ce,'auth':_0x26703a,'json':!![]};return rp(_0x466bad)[_0x87d4('0x22')](function(_0xb23ab1){var _0x4c17b9=[];if(_0xb23ab1[_0x87d4('0xa1')][_0x87d4('0x32')]>0x0){_0xb23ab1['result']['forEach'](function(_0x431bf6){if(_0x431bf6[_0x87d4('0xb2')]===_0x87d4('0xb3')){var _0x1536c2={'name':_0x431bf6[_0x87d4('0xa8')],'value':_0x431bf6[_0x87d4('0xb4')]};_0x4c17b9['push'](_0x1536c2);}});}_0x393f03['options']=_0x4c17b9;if(_0x393f03[_0x87d4('0x3d')][_0x87d4('0x32')]>0x0){_0x285999(_0x393f03);}else{if(_0x25d607==![]){_0x285999();}else{_0x285999(_0x393f03);}}});}});}
\ No newline at end of file
index d0ce531..001c792 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2bd8=['bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment'];(function(_0xc3e5b6,_0x2619f0){var _0x5e5efb=function(_0x8e49b9){while(--_0x8e49b9){_0xc3e5b6['push'](_0xc3e5b6['shift']());}};_0x5e5efb(++_0x2619f0);}(_0x2bd8,0x130));var _0x82bd=function(_0x2652f7,_0x7664cb){_0x2652f7=_0x2652f7-0x0;var _0xcc0791=_0x2bd8[_0x2652f7];return _0xcc0791;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));var integrations=require(_0x82bd('0x9'));module[_0x82bd('0xa')]=function(_0x5ceb60,_0x19dbb1){return _0x5ceb60[_0x82bd('0xb')](_0x82bd('0xc'),attributes,{'tableName':_0x82bd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4819=['request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x94372b,_0x186f99){var _0x4e4ea2=function(_0x50efb0){while(--_0x50efb0){_0x94372b['push'](_0x94372b['shift']());}};_0x4e4ea2(++_0x186f99);}(_0x4819,0xcd));var _0x9481=function(_0xd62e7a,_0xac4f19){_0xd62e7a=_0xd62e7a-0x0;var _0x1bf0c8=_0x4819[_0xd62e7a];return _0x1bf0c8;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x9481('0xa')]=function(_0x5def07,_0x54cc78){return _0x5def07[_0x9481('0xb')](_0x9481('0xc'),attributes,{'tableName':_0x9481('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index cec7052..750fe37 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x64bf=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowServicenowAccount','find'];(function(_0x494dfc,_0x222926){var _0x1a2eca=function(_0x4246e1){while(--_0x4246e1){_0x494dfc['push'](_0x494dfc['shift']());}};_0x1a2eca(++_0x222926);}(_0x64bf,0xcb));var _0xf64b=function(_0x9ba4a0,_0x5ed2a2){_0x9ba4a0=_0x9ba4a0-0x0;var _0x291fc8=_0x64bf[_0x9ba4a0];return _0x291fc8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf64b('0x0'));var BPromise=require(_0xf64b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf64b('0x2'));var db=require(_0xf64b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf64b('0x4'))(_0xf64b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf64b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3458a5,_0x621b5f,_0x476518){return new BPromise(function(_0x38c44d,_0x14dc7b){return client['request'](_0x3458a5,_0x476518)[_0xf64b('0x7')](function(_0x5a7539){logger['info'](_0xf64b('0x8'),_0x621b5f,_0xf64b('0x9'));logger[_0xf64b('0xa')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x621b5f,_0xf64b('0x9'),JSON['stringify'](_0x5a7539));if(_0x5a7539[_0xf64b('0xb')]){if(_0x5a7539['error']['code']===0x1f4){logger[_0xf64b('0xb')](_0xf64b('0x8'),_0x621b5f,_0x5a7539[_0xf64b('0xb')]['message']);return _0x14dc7b(_0x5a7539[_0xf64b('0xb')][_0xf64b('0xc')]);}logger[_0xf64b('0xb')](_0xf64b('0x8'),_0x621b5f,_0x5a7539[_0xf64b('0xb')][_0xf64b('0xc')]);return _0x38c44d(_0x5a7539['error'][_0xf64b('0xc')]);}else{logger[_0xf64b('0xd')](_0xf64b('0x8'),_0x621b5f,_0xf64b('0x9'));_0x38c44d(_0x5a7539[_0xf64b('0xe')][_0xf64b('0xc')]);}})['catch'](function(_0x119329){logger[_0xf64b('0xb')](_0xf64b('0x8'),_0x621b5f,_0x119329);_0x14dc7b(_0x119329);});});}exports[_0xf64b('0xf')]=function(_0x269716){var _0x34542b=this;return new Promise(function(_0x2d167e,_0x39d21f){return db[_0xf64b('0x10')]['findAll']({'raw':_0x269716['options']?_0x269716[_0xf64b('0x11')][_0xf64b('0x12')]===undefined?!![]:![]:!![],'where':_0x269716['options']?_0x269716[_0xf64b('0x11')][_0xf64b('0x13')]||null:null,'attributes':_0x269716[_0xf64b('0x11')]?_0x269716[_0xf64b('0x11')][_0xf64b('0x14')]||null:null,'limit':_0x269716[_0xf64b('0x11')]?_0x269716['options'][_0xf64b('0x15')]||null:null,'include':_0x269716['options']?_0x269716['options'][_0xf64b('0x16')]?_[_0xf64b('0x17')](_0x269716[_0xf64b('0x11')]['include'],function(_0x1027e5){return{'model':db[_0x1027e5[_0xf64b('0x18')]],'as':_0x1027e5['as'],'attributes':_0x1027e5[_0xf64b('0x14')],'include':_0x1027e5[_0xf64b('0x16')]?_[_0xf64b('0x17')](_0x1027e5[_0xf64b('0x16')],function(_0x571aa9){return{'model':db[_0x571aa9[_0xf64b('0x18')]],'as':_0x571aa9['as'],'attributes':_0x571aa9[_0xf64b('0x14')],'include':_0x571aa9[_0xf64b('0x16')]?_[_0xf64b('0x17')](_0x571aa9[_0xf64b('0x16')],function(_0x20a6d8){return{'model':db[_0x20a6d8['model']],'as':_0x20a6d8['as'],'attributes':_0x20a6d8[_0xf64b('0x14')]};}):[]};}):[]};}):[]:[]})[_0xf64b('0x7')](function(_0x4a27f8){logger[_0xf64b('0xd')](_0xf64b('0xf'),_0x269716);logger[_0xf64b('0xa')](_0xf64b('0xf'),_0x269716,JSON[_0xf64b('0x19')](_0x4a27f8));_0x2d167e(_0x4a27f8);})[_0xf64b('0x1a')](function(_0x51fe0c){logger[_0xf64b('0xb')](_0xf64b('0xf'),_0x51fe0c['message'],_0x269716);_0x39d21f(_0x34542b['error'](0x1f4,_0x51fe0c[_0xf64b('0xc')]));});});};exports[_0xf64b('0x1b')]=function(_0xa9565d){var _0x5b7e80=this;return new Promise(function(_0xd60974,_0x44f4dd){return db[_0xf64b('0x10')][_0xf64b('0x1c')]({'raw':_0xa9565d[_0xf64b('0x11')]?_0xa9565d[_0xf64b('0x11')][_0xf64b('0x12')]===undefined?!![]:![]:!![],'where':_0xa9565d['options']?_0xa9565d['options'][_0xf64b('0x13')]||null:null,'attributes':_0xa9565d['options']?_0xa9565d['options']['attributes']||null:null,'include':_0xa9565d[_0xf64b('0x11')]?_0xa9565d['options'][_0xf64b('0x16')]?_[_0xf64b('0x17')](_0xa9565d[_0xf64b('0x11')]['include'],function(_0x37a650){return{'model':db[_0x37a650[_0xf64b('0x18')]],'as':_0x37a650['as'],'attributes':_0x37a650['attributes'],'include':_0x37a650[_0xf64b('0x16')]?_[_0xf64b('0x17')](_0x37a650[_0xf64b('0x16')],function(_0x92e65b){return{'model':db[_0x92e65b[_0xf64b('0x18')]],'as':_0x92e65b['as'],'attributes':_0x92e65b[_0xf64b('0x14')],'include':_0x92e65b[_0xf64b('0x16')]?_[_0xf64b('0x17')](_0x92e65b[_0xf64b('0x16')],function(_0x384378){return{'model':db[_0x384378[_0xf64b('0x18')]],'as':_0x384378['as'],'attributes':_0x384378['attributes']};}):[]};}):[]};}):[]:[]})[_0xf64b('0x7')](function(_0x212bcb){logger[_0xf64b('0xd')](_0xf64b('0x1b'),_0xa9565d);logger[_0xf64b('0xa')](_0xf64b('0x1b'),_0xa9565d,JSON[_0xf64b('0x19')](_0x212bcb));_0xd60974(_0x212bcb);})[_0xf64b('0x1a')](function(_0xdff46d){logger['error']('ShowServicenowAccount',_0xdff46d['message'],_0xa9565d);_0x44f4dd(_0x5b7e80['error'](0x1f4,_0xdff46d[_0xf64b('0xc')]));});});};
\ No newline at end of file
+var _0x813c=['ServicenowAccount','findAll','options','attributes','limit','include','map','model','debug','stringify','catch','ShowServicenowAccount','raw','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetServicenowAccount'];(function(_0x5abda7,_0x27e97a){var _0x48d568=function(_0xa7a425){while(--_0xa7a425){_0x5abda7['push'](_0x5abda7['shift']());}};_0x48d568(++_0x27e97a);}(_0x813c,0x9a));var _0xc813=function(_0x14a7fb,_0x57c148){_0x14a7fb=_0x14a7fb-0x0;var _0x2c3f7d=_0x813c[_0x14a7fb];return _0x2c3f7d;};'use strict';var _=require(_0xc813('0x0'));var util=require(_0xc813('0x1'));var moment=require(_0xc813('0x2'));var BPromise=require(_0xc813('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc813('0x4'))['db'];var utils=require(_0xc813('0x5'));var logger=require(_0xc813('0x6'))('rpc');var config=require(_0xc813('0x7'));var jayson=require(_0xc813('0x8'));var client=jayson[_0xc813('0x9')][_0xc813('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41aa9c,_0x463bf3,_0x4b20c5){return new BPromise(function(_0x4c4b0e,_0x21a702){return client[_0xc813('0xb')](_0x41aa9c,_0x4b20c5)[_0xc813('0xc')](function(_0x5abb6b){logger[_0xc813('0xd')](_0xc813('0xe'),_0x463bf3,_0xc813('0xf'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x463bf3,_0xc813('0xf'),JSON['stringify'](_0x5abb6b));if(_0x5abb6b[_0xc813('0x10')]){if(_0x5abb6b[_0xc813('0x10')][_0xc813('0x11')]===0x1f4){logger['error'](_0xc813('0xe'),_0x463bf3,_0x5abb6b['error']['message']);return _0x21a702(_0x5abb6b[_0xc813('0x10')][_0xc813('0x12')]);}logger[_0xc813('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x463bf3,_0x5abb6b[_0xc813('0x10')]['message']);return _0x4c4b0e(_0x5abb6b['error']['message']);}else{logger['info'](_0xc813('0xe'),_0x463bf3,'request\x20sent');_0x4c4b0e(_0x5abb6b[_0xc813('0x13')][_0xc813('0x12')]);}})['catch'](function(_0x589bd0){logger[_0xc813('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x463bf3,_0x589bd0);_0x21a702(_0x589bd0);});});}exports[_0xc813('0x14')]=function(_0x2a2e9b){var _0x11f25f=this;return new Promise(function(_0x297229,_0x2b6fdd){return db[_0xc813('0x15')][_0xc813('0x16')]({'raw':_0x2a2e9b[_0xc813('0x17')]?_0x2a2e9b[_0xc813('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2a2e9b[_0xc813('0x17')]?_0x2a2e9b[_0xc813('0x17')]['where']||null:null,'attributes':_0x2a2e9b['options']?_0x2a2e9b[_0xc813('0x17')][_0xc813('0x18')]||null:null,'limit':_0x2a2e9b[_0xc813('0x17')]?_0x2a2e9b[_0xc813('0x17')][_0xc813('0x19')]||null:null,'include':_0x2a2e9b[_0xc813('0x17')]?_0x2a2e9b[_0xc813('0x17')][_0xc813('0x1a')]?_[_0xc813('0x1b')](_0x2a2e9b[_0xc813('0x17')][_0xc813('0x1a')],function(_0x630aa6){return{'model':db[_0x630aa6[_0xc813('0x1c')]],'as':_0x630aa6['as'],'attributes':_0x630aa6[_0xc813('0x18')],'include':_0x630aa6[_0xc813('0x1a')]?_[_0xc813('0x1b')](_0x630aa6['include'],function(_0x4ae198){return{'model':db[_0x4ae198['model']],'as':_0x4ae198['as'],'attributes':_0x4ae198[_0xc813('0x18')],'include':_0x4ae198[_0xc813('0x1a')]?_[_0xc813('0x1b')](_0x4ae198[_0xc813('0x1a')],function(_0x4f6dbd){return{'model':db[_0x4f6dbd[_0xc813('0x1c')]],'as':_0x4f6dbd['as'],'attributes':_0x4f6dbd[_0xc813('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc813('0xc')](function(_0x39a150){logger['info'](_0xc813('0x14'),_0x2a2e9b);logger[_0xc813('0x1d')](_0xc813('0x14'),_0x2a2e9b,JSON[_0xc813('0x1e')](_0x39a150));_0x297229(_0x39a150);})[_0xc813('0x1f')](function(_0x734937){logger[_0xc813('0x10')](_0xc813('0x14'),_0x734937[_0xc813('0x12')],_0x2a2e9b);_0x2b6fdd(_0x11f25f[_0xc813('0x10')](0x1f4,_0x734937['message']));});});};exports[_0xc813('0x20')]=function(_0x7826a6){var _0x3a20fd=this;return new Promise(function(_0x5d3af4,_0x1b4c2c){return db[_0xc813('0x15')]['find']({'raw':_0x7826a6[_0xc813('0x17')]?_0x7826a6[_0xc813('0x17')][_0xc813('0x21')]===undefined?!![]:![]:!![],'where':_0x7826a6[_0xc813('0x17')]?_0x7826a6['options'][_0xc813('0x22')]||null:null,'attributes':_0x7826a6['options']?_0x7826a6[_0xc813('0x17')][_0xc813('0x18')]||null:null,'include':_0x7826a6[_0xc813('0x17')]?_0x7826a6[_0xc813('0x17')][_0xc813('0x1a')]?_[_0xc813('0x1b')](_0x7826a6[_0xc813('0x17')][_0xc813('0x1a')],function(_0x5f39e2){return{'model':db[_0x5f39e2['model']],'as':_0x5f39e2['as'],'attributes':_0x5f39e2[_0xc813('0x18')],'include':_0x5f39e2['include']?_[_0xc813('0x1b')](_0x5f39e2[_0xc813('0x1a')],function(_0x20e676){return{'model':db[_0x20e676[_0xc813('0x1c')]],'as':_0x20e676['as'],'attributes':_0x20e676[_0xc813('0x18')],'include':_0x20e676[_0xc813('0x1a')]?_[_0xc813('0x1b')](_0x20e676[_0xc813('0x1a')],function(_0x244e1d){return{'model':db[_0x244e1d[_0xc813('0x1c')]],'as':_0x244e1d['as'],'attributes':_0x244e1d[_0xc813('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38eef1){logger[_0xc813('0xd')](_0xc813('0x20'),_0x7826a6);logger['debug'](_0xc813('0x20'),_0x7826a6,JSON[_0xc813('0x1e')](_0x38eef1));_0x5d3af4(_0x38eef1);})['catch'](function(_0x549d34){logger[_0xc813('0x10')]('ShowServicenowAccount',_0x549d34[_0xc813('0x12')],_0x7826a6);_0x1b4c2c(_0x3a20fd[_0xc813('0x10')](0x1f4,_0x549d34[_0xc813('0x12')]));});});};
\ No newline at end of file
index 7440d12..a4e0b17 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9450=['fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x147694,_0x257ab9){var _0x2657bc=function(_0x363bae){while(--_0x363bae){_0x147694['push'](_0x147694['shift']());}};_0x2657bc(++_0x257ab9);}(_0x9450,0x1a3));var _0x0945=function(_0x4f6ea1,_0x301b70){_0x4f6ea1=_0x4f6ea1-0x0;var _0x3331c9=_0x9450[_0x4f6ea1];return _0x3331c9;};'use strict';var multer=require(_0x0945('0x0'));var util=require(_0x0945('0x1'));var path=require(_0x0945('0x2'));var timeout=require(_0x0945('0x3'));var express=require(_0x0945('0x4'));var router=express[_0x0945('0x5')]();var fs_extra=require(_0x0945('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0945('0x7'));var config=require(_0x0945('0x8'));var controller=require(_0x0945('0x9'));router[_0x0945('0xa')]('/',auth[_0x0945('0xb')](),controller[_0x0945('0xc')]);router['get'](_0x0945('0xd'),auth['isAuthenticated'](),controller[_0x0945('0xe')]);router[_0x0945('0xa')]('/:id/fields',auth[_0x0945('0xb')](),controller[_0x0945('0xf')]);router[_0x0945('0xa')](_0x0945('0x10'),auth[_0x0945('0xb')](),controller['getSubjects']);router[_0x0945('0xa')](_0x0945('0x11'),auth[_0x0945('0xb')](),controller[_0x0945('0x12')]);router[_0x0945('0x13')]('/',auth['isAuthenticated'](),controller[_0x0945('0x14')]);router['put'](_0x0945('0xd'),auth[_0x0945('0xb')](),controller[_0x0945('0x15')]);router[_0x0945('0x16')](_0x0945('0xd'),auth[_0x0945('0xb')](),controller[_0x0945('0x17')]);module[_0x0945('0x18')]=router;
\ No newline at end of file
+var _0xdd65=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields'];(function(_0x29800a,_0x2d33a7){var _0x5adb5=function(_0x3ce2e6){while(--_0x3ce2e6){_0x29800a['push'](_0x29800a['shift']());}};_0x5adb5(++_0x2d33a7);}(_0xdd65,0x12f));var _0x5dd6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xdd65[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x5dd6('0x0'));var util=require('util');var path=require(_0x5dd6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5dd6('0x2'));var auth=require(_0x5dd6('0x3'));var interaction=require(_0x5dd6('0x4'));var config=require(_0x5dd6('0x5'));var controller=require(_0x5dd6('0x6'));router['get']('/',auth[_0x5dd6('0x7')](),controller['index']);router[_0x5dd6('0x8')](_0x5dd6('0x9'),auth[_0x5dd6('0x7')](),controller[_0x5dd6('0xa')]);router[_0x5dd6('0x8')](_0x5dd6('0xb'),auth[_0x5dd6('0x7')](),controller['getFields']);router[_0x5dd6('0x8')]('/:id/subjects',auth[_0x5dd6('0x7')](),controller[_0x5dd6('0xc')]);router[_0x5dd6('0x8')](_0x5dd6('0xd'),auth[_0x5dd6('0x7')](),controller[_0x5dd6('0xe')]);router[_0x5dd6('0xf')]('/',auth[_0x5dd6('0x7')](),controller[_0x5dd6('0x10')]);router[_0x5dd6('0x11')](_0x5dd6('0x9'),auth['isAuthenticated'](),controller[_0x5dd6('0x12')]);router[_0x5dd6('0x13')](_0x5dd6('0x9'),auth['isAuthenticated'](),controller[_0x5dd6('0x14')]);module['exports']=router;
\ No newline at end of file
index 74db8f7..cb7ca46 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xef58=['sequelize','exports','STRING'];(function(_0x2bde39,_0x1c165f){var _0x26ab02=function(_0xccdf12){while(--_0xccdf12){_0x2bde39['push'](_0x2bde39['shift']());}};_0x26ab02(++_0x1c165f);}(_0xef58,0x159));var _0x8ef5=function(_0x331160,_0x410e43){_0x331160=_0x331160-0x0;var _0x324617=_0xef58[_0x331160];return _0x324617;};'use strict';var Sequelize=require(_0x8ef5('0x0'));module[_0x8ef5('0x1')]={'name':{'type':Sequelize[_0x8ef5('0x2')]},'description':{'type':Sequelize[_0x8ef5('0x2')]}};
\ No newline at end of file
+var _0x68aa=['exports','STRING','sequelize'];(function(_0x1c97d8,_0x3d4bd9){var _0x25a11f=function(_0x4269ed){while(--_0x4269ed){_0x1c97d8['push'](_0x1c97d8['shift']());}};_0x25a11f(++_0x3d4bd9);}(_0x68aa,0x1eb));var _0xa68a=function(_0xb126b0,_0x358406){_0xb126b0=_0xb126b0-0x0;var _0x32c744=_0x68aa[_0xb126b0];return _0x32c744;};'use strict';var Sequelize=require(_0xa68a('0x0'));module[_0xa68a('0x1')]={'name':{'type':Sequelize[_0xa68a('0x2')]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index bdffc52..14ee24c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a10=['to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','getFields','findOne','ServicenowField','length','getSubjects','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x588e35,_0x1989a8){var _0x281004=function(_0x40c756){while(--_0x40c756){_0x588e35['push'](_0x588e35['shift']());}};_0x281004(++_0x1989a8);}(_0x7a10,0xef));var _0x07a1=function(_0x3748ea,_0x2bbf6f){_0x3748ea=_0x3748ea-0x0;var _0x223662=_0x7a10[_0x3748ea];return _0x223662;};'use strict';var emlformat=require(_0x07a1('0x0'));var rimraf=require(_0x07a1('0x1'));var zipdir=require(_0x07a1('0x2'));var jsonpatch=require(_0x07a1('0x3'));var rp=require(_0x07a1('0x4'));var moment=require('moment');var BPromise=require(_0x07a1('0x5'));var Mustache=require(_0x07a1('0x6'));var util=require(_0x07a1('0x7'));var path=require(_0x07a1('0x8'));var sox=require(_0x07a1('0x9'));var csv=require(_0x07a1('0xa'));var ejs=require(_0x07a1('0xb'));var fs=require('fs');var fs_extra=require(_0x07a1('0xc'));var _=require(_0x07a1('0xd'));var squel=require(_0x07a1('0xe'));var crypto=require(_0x07a1('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x07a1('0x10'));var toCsv=require(_0x07a1('0xa'));var querystring=require(_0x07a1('0x11'));var Papa=require(_0x07a1('0x12'));var Redis=require(_0x07a1('0x13'));var authService=require(_0x07a1('0x14'));var qs=require(_0x07a1('0x15'));var as=require(_0x07a1('0x16'));var hardwareService=require(_0x07a1('0x17'));var logger=require('../../config/logger')(_0x07a1('0x18'));var utils=require(_0x07a1('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x07a1('0x1a'))['db'];function respondWithStatusCode(_0x2ad397,_0xc00105){_0xc00105=_0xc00105||0xcc;return function(_0x3db318){if(_0x3db318){return _0x2ad397[_0x07a1('0x1b')](_0xc00105);}return _0x2ad397[_0x07a1('0x1c')](_0xc00105)['end']();};}function respondWithResult(_0x906549,_0x1c638d){_0x1c638d=_0x1c638d||0xc8;return function(_0x256cea){if(_0x256cea){return _0x906549[_0x07a1('0x1c')](_0x1c638d)['json'](_0x256cea);}};}function respondWithFilteredResult(_0xa82d74,_0x2d0a48){return function(_0x26821f){if(_0x26821f){var _0x254e94=typeof _0x2d0a48[_0x07a1('0x1d')]===_0x07a1('0x1e')&&typeof _0x2d0a48['limit']===_0x07a1('0x1e');var _0x503f32=_0x26821f[_0x07a1('0x1f')];var _0x594186=_0x254e94?0x0:_0x2d0a48[_0x07a1('0x1d')];var _0x4f4cd3=_0x254e94?_0x26821f[_0x07a1('0x1f')]:_0x2d0a48['offset']+_0x2d0a48['limit'];var _0x5c4ede;if(_0x4f4cd3>=_0x503f32){_0x4f4cd3=_0x503f32;_0x5c4ede=0xc8;}else{_0x5c4ede=0xce;}_0xa82d74[_0x07a1('0x1c')](_0x5c4ede);return _0xa82d74[_0x07a1('0x20')](_0x07a1('0x21'),_0x594186+'-'+_0x4f4cd3+'/'+_0x503f32)['json'](_0x26821f);}return null;};}function patchUpdates(_0x566996){return function(_0x1c5ac8){try{jsonpatch[_0x07a1('0x22')](_0x1c5ac8,_0x566996,!![]);}catch(_0x404b4f){return BPromise[_0x07a1('0x23')](_0x404b4f);}return _0x1c5ac8[_0x07a1('0x24')]();};}function saveUpdates(_0x2edf73,_0x361c5c){return function(_0xd763e8){if(_0xd763e8){return _0xd763e8[_0x07a1('0x25')](_0x2edf73)[_0x07a1('0x26')](function(_0xd80319){return _0xd80319;});}return null;};}function removeEntity(_0x2181c3,_0x1ea17a){return function(_0x1695e6){if(_0x1695e6){return _0x1695e6[_0x07a1('0x27')]()[_0x07a1('0x26')](function(){_0x2181c3[_0x07a1('0x1c')](0xcc)[_0x07a1('0x28')]();});}};}function handleEntityNotFound(_0x32e36a,_0x244847){return function(_0x1f654e){if(!_0x1f654e){_0x32e36a[_0x07a1('0x1b')](0x194);}return _0x1f654e;};}function handleError(_0x429877,_0xbb57a6){_0xbb57a6=_0xbb57a6||0x1f4;return function(_0x339d2c){logger[_0x07a1('0x29')](_0x339d2c[_0x07a1('0x2a')]);if(_0x339d2c['name']){delete _0x339d2c[_0x07a1('0x2b')];}_0x429877[_0x07a1('0x1c')](_0xbb57a6)['send'](_0x339d2c);};}exports['index']=function(_0x124cf5,_0x3cf0a8){var _0x55f7a1={},_0x3f3fb5={},_0x361edc={'count':0x0,'rows':[]};var _0x3cb45d=_[_0x07a1('0x2c')](db[_0x07a1('0x2d')][_0x07a1('0x2e')],function(_0x4abce6){return{'name':_0x4abce6[_0x07a1('0x2f')],'type':_0x4abce6[_0x07a1('0x30')][_0x07a1('0x31')]};});_0x3f3fb5['model']=_[_0x07a1('0x2c')](_0x3cb45d,'name');_0x3f3fb5[_0x07a1('0x32')]=_[_0x07a1('0x33')](_0x124cf5[_0x07a1('0x32')]);_0x3f3fb5[_0x07a1('0x34')]=_[_0x07a1('0x35')](_0x3f3fb5[_0x07a1('0x36')],_0x3f3fb5[_0x07a1('0x32')]);_0x55f7a1[_0x07a1('0x37')]=_[_0x07a1('0x35')](_0x3f3fb5['model'],qs[_0x07a1('0x38')](_0x124cf5[_0x07a1('0x32')][_0x07a1('0x38')]));_0x55f7a1[_0x07a1('0x37')]=_0x55f7a1[_0x07a1('0x37')]['length']?_0x55f7a1[_0x07a1('0x37')]:_0x3f3fb5[_0x07a1('0x36')];if(!_0x124cf5[_0x07a1('0x32')][_0x07a1('0x39')](_0x07a1('0x3a'))){_0x55f7a1[_0x07a1('0x3b')]=qs[_0x07a1('0x3b')](_0x124cf5[_0x07a1('0x32')][_0x07a1('0x3b')]);_0x55f7a1[_0x07a1('0x1d')]=qs[_0x07a1('0x1d')](_0x124cf5[_0x07a1('0x32')][_0x07a1('0x1d')]);}_0x55f7a1[_0x07a1('0x3c')]=qs[_0x07a1('0x3d')](_0x124cf5[_0x07a1('0x32')][_0x07a1('0x3d')]);_0x55f7a1[_0x07a1('0x3e')]=qs[_0x07a1('0x34')](_[_0x07a1('0x3f')](_0x124cf5['query'],_0x3f3fb5['filters']),_0x3cb45d);if(_0x124cf5[_0x07a1('0x32')][_0x07a1('0x40')]){_0x55f7a1[_0x07a1('0x3e')]=_[_0x07a1('0x41')](_0x55f7a1[_0x07a1('0x3e')],{'$or':_[_0x07a1('0x2c')](_0x3cb45d,function(_0x1f372d){if(_0x1f372d[_0x07a1('0x30')]!==_0x07a1('0x42')){var _0x114e15={};_0x114e15[_0x1f372d[_0x07a1('0x2b')]]={'$like':'%'+_0x124cf5[_0x07a1('0x32')]['filter']+'%'};return _0x114e15;}})});}_0x55f7a1=_[_0x07a1('0x41')]({},_0x55f7a1,_0x124cf5['options']);var _0x2ba4b5={'where':_0x55f7a1[_0x07a1('0x3e')]};return db['ServicenowConfiguration'][_0x07a1('0x1f')](_0x2ba4b5)[_0x07a1('0x26')](function(_0x44c0b0){_0x361edc[_0x07a1('0x1f')]=_0x44c0b0;if(_0x124cf5[_0x07a1('0x32')]['includeAll']){_0x55f7a1[_0x07a1('0x43')]=[{'all':!![]}];}return db[_0x07a1('0x2d')][_0x07a1('0x44')](_0x55f7a1);})[_0x07a1('0x26')](function(_0x4e1ae4){_0x361edc[_0x07a1('0x45')]=_0x4e1ae4;return _0x361edc;})['then'](respondWithFilteredResult(_0x3cf0a8,_0x55f7a1))[_0x07a1('0x46')](handleError(_0x3cf0a8,null));};exports[_0x07a1('0x47')]=function(_0x306ed9,_0x535e31){var _0x59e585={'raw':![],'where':{'id':_0x306ed9[_0x07a1('0x48')]['id']}},_0x3cf345={};_0x3cf345[_0x07a1('0x36')]=_[_0x07a1('0x33')](db['ServicenowConfiguration'][_0x07a1('0x2e')]);_0x3cf345[_0x07a1('0x32')]=_[_0x07a1('0x33')](_0x306ed9[_0x07a1('0x32')]);_0x3cf345[_0x07a1('0x34')]=_[_0x07a1('0x35')](_0x3cf345[_0x07a1('0x36')],_0x3cf345[_0x07a1('0x32')]);_0x59e585[_0x07a1('0x37')]=_['intersection'](_0x3cf345[_0x07a1('0x36')],qs[_0x07a1('0x38')](_0x306ed9[_0x07a1('0x32')][_0x07a1('0x38')]));_0x59e585['attributes']=_0x59e585['attributes']['length']?_0x59e585[_0x07a1('0x37')]:_0x3cf345[_0x07a1('0x36')];if(_0x306ed9['query'][_0x07a1('0x49')]){_0x59e585[_0x07a1('0x43')]=[{'all':!![]}];}_0x59e585=_['merge']({},_0x59e585,_0x306ed9[_0x07a1('0x4a')]);return db['ServicenowConfiguration'][_0x07a1('0x4b')](_0x59e585)[_0x07a1('0x26')](handleEntityNotFound(_0x535e31,null))[_0x07a1('0x26')](respondWithResult(_0x535e31,null))[_0x07a1('0x46')](handleError(_0x535e31,null));};exports[_0x07a1('0x4c')]=function(_0x571c30,_0x4b4802){return db[_0x07a1('0x2d')]['create'](_0x571c30['body'],{})[_0x07a1('0x26')](respondWithResult(_0x4b4802,0xc9))[_0x07a1('0x46')](handleError(_0x4b4802,null));};exports[_0x07a1('0x25')]=function(_0x5945c3,_0x19e6fd){if(_0x5945c3[_0x07a1('0x4d')]['id']){delete _0x5945c3['body']['id'];}return db[_0x07a1('0x2d')][_0x07a1('0x4b')]({'where':{'id':_0x5945c3[_0x07a1('0x48')]['id']}})[_0x07a1('0x26')](handleEntityNotFound(_0x19e6fd,null))[_0x07a1('0x26')](saveUpdates(_0x5945c3['body'],null))['then'](respondWithResult(_0x19e6fd,null))[_0x07a1('0x46')](handleError(_0x19e6fd,null));};exports[_0x07a1('0x27')]=function(_0x343b4a,_0x5a0519){return db[_0x07a1('0x2d')][_0x07a1('0x4b')]({'where':{'id':_0x343b4a['params']['id']}})['then'](handleEntityNotFound(_0x5a0519,null))[_0x07a1('0x26')](removeEntity(_0x5a0519,null))[_0x07a1('0x46')](handleError(_0x5a0519,null));};exports[_0x07a1('0x4e')]=function(_0x5c5b68,_0x2c44cd,_0x50b26a){var _0x47666b={};var _0x1c77d9={};var _0x2de31b;var _0x1fd52b;return db[_0x07a1('0x2d')][_0x07a1('0x4f')]({'where':{'id':_0x5c5b68[_0x07a1('0x48')]['id']}})['then'](handleEntityNotFound(_0x2c44cd,null))['then'](function(_0x41f1c7){if(_0x41f1c7){_0x2de31b=_0x41f1c7;_0x1c77d9[_0x07a1('0x36')]=_['keys'](db[_0x07a1('0x50')][_0x07a1('0x2e')]);_0x1c77d9['query']=_[_0x07a1('0x33')](_0x5c5b68[_0x07a1('0x32')]);_0x1c77d9[_0x07a1('0x34')]=_[_0x07a1('0x35')](_0x1c77d9[_0x07a1('0x36')],_0x1c77d9[_0x07a1('0x32')]);_0x47666b[_0x07a1('0x37')]=_['intersection'](_0x1c77d9[_0x07a1('0x36')],qs[_0x07a1('0x38')](_0x5c5b68[_0x07a1('0x32')]['fields']));_0x47666b[_0x07a1('0x37')]=_0x47666b[_0x07a1('0x37')]['length']?_0x47666b[_0x07a1('0x37')]:_0x1c77d9[_0x07a1('0x36')];_0x47666b[_0x07a1('0x3c')]=qs[_0x07a1('0x3d')](_0x5c5b68[_0x07a1('0x32')][_0x07a1('0x3d')]);_0x47666b[_0x07a1('0x3e')]=qs[_0x07a1('0x34')](_[_0x07a1('0x3f')](_0x5c5b68[_0x07a1('0x32')],_0x1c77d9['filters']));if(_0x5c5b68[_0x07a1('0x32')][_0x07a1('0x40')]){_0x47666b[_0x07a1('0x3e')]=_[_0x07a1('0x41')](_0x47666b[_0x07a1('0x3e')],{'$or':_[_0x07a1('0x2c')](_0x47666b[_0x07a1('0x37')],function(_0x107688){var _0x58cc4e={};_0x58cc4e[_0x107688]={'$like':'%'+_0x5c5b68[_0x07a1('0x32')][_0x07a1('0x40')]+'%'};return _0x58cc4e;})});}_0x47666b=_[_0x07a1('0x41')]({},_0x47666b,_0x5c5b68['options']);return _0x2de31b[_0x07a1('0x4e')](_0x47666b);}})[_0x07a1('0x26')](function(_0x6005e0){if(_0x6005e0){_0x1fd52b=_0x6005e0['length'];if(!_0x5c5b68[_0x07a1('0x32')][_0x07a1('0x39')](_0x07a1('0x3a'))){_0x47666b['limit']=qs[_0x07a1('0x3b')](_0x5c5b68[_0x07a1('0x32')][_0x07a1('0x3b')]);_0x47666b[_0x07a1('0x1d')]=qs[_0x07a1('0x1d')](_0x5c5b68[_0x07a1('0x32')]['offset']);}return _0x2de31b[_0x07a1('0x4e')](_0x47666b);}})['then'](function(_0x22927a){if(_0x22927a){return _0x22927a?{'count':_0x1fd52b,'rows':_0x22927a}:null;}})[_0x07a1('0x26')](respondWithResult(_0x2c44cd,null))['catch'](handleError(_0x2c44cd,null));};exports['getSubjects']=function(_0x29eba4,_0x4b2715,_0x3af966){var _0x109fb5={};var _0x3eab8f={};var _0x51f4f7;var _0x365612;return db['ServicenowConfiguration'][_0x07a1('0x4f')]({'where':{'id':_0x29eba4['params']['id']}})['then'](handleEntityNotFound(_0x4b2715,null))[_0x07a1('0x26')](function(_0x43b1e5){if(_0x43b1e5){_0x51f4f7=_0x43b1e5;_0x3eab8f[_0x07a1('0x36')]=_[_0x07a1('0x33')](db['ServicenowField'][_0x07a1('0x2e')]);_0x3eab8f[_0x07a1('0x32')]=_[_0x07a1('0x33')](_0x29eba4['query']);_0x3eab8f['filters']=_['intersection'](_0x3eab8f[_0x07a1('0x36')],_0x3eab8f[_0x07a1('0x32')]);_0x109fb5[_0x07a1('0x37')]=_[_0x07a1('0x35')](_0x3eab8f[_0x07a1('0x36')],qs[_0x07a1('0x38')](_0x29eba4[_0x07a1('0x32')][_0x07a1('0x38')]));_0x109fb5[_0x07a1('0x37')]=_0x109fb5[_0x07a1('0x37')][_0x07a1('0x51')]?_0x109fb5[_0x07a1('0x37')]:_0x3eab8f['model'];_0x109fb5[_0x07a1('0x3c')]=qs[_0x07a1('0x3d')](_0x29eba4[_0x07a1('0x32')][_0x07a1('0x3d')]);_0x109fb5[_0x07a1('0x3e')]=qs[_0x07a1('0x34')](_['pick'](_0x29eba4['query'],_0x3eab8f['filters']));if(_0x29eba4[_0x07a1('0x32')][_0x07a1('0x40')]){_0x109fb5[_0x07a1('0x3e')]=_[_0x07a1('0x41')](_0x109fb5['where'],{'$or':_[_0x07a1('0x2c')](_0x109fb5[_0x07a1('0x37')],function(_0x2a538b){var _0x3dce55={};_0x3dce55[_0x2a538b]={'$like':'%'+_0x29eba4[_0x07a1('0x32')][_0x07a1('0x40')]+'%'};return _0x3dce55;})});}_0x109fb5=_[_0x07a1('0x41')]({},_0x109fb5,_0x29eba4[_0x07a1('0x4a')]);return _0x51f4f7[_0x07a1('0x52')](_0x109fb5);}})[_0x07a1('0x26')](function(_0x3825c4){if(_0x3825c4){_0x365612=_0x3825c4[_0x07a1('0x51')];if(!_0x29eba4[_0x07a1('0x32')][_0x07a1('0x39')](_0x07a1('0x3a'))){_0x109fb5['limit']=qs[_0x07a1('0x3b')](_0x29eba4[_0x07a1('0x32')]['limit']);_0x109fb5[_0x07a1('0x1d')]=qs[_0x07a1('0x1d')](_0x29eba4['query'][_0x07a1('0x1d')]);}return _0x51f4f7[_0x07a1('0x52')](_0x109fb5);}})['then'](function(_0x2b0687){if(_0x2b0687){return _0x2b0687?{'count':_0x365612,'rows':_0x2b0687}:null;}})[_0x07a1('0x26')](respondWithResult(_0x4b2715,null))[_0x07a1('0x46')](handleError(_0x4b2715,null));};exports['getDescriptions']=function(_0x251ebb,_0x5c3afc,_0x584fab){var _0x50bfc8={};var _0x1be959={};var _0x3ebeb2;var _0xf11e3;return db[_0x07a1('0x2d')][_0x07a1('0x4f')]({'where':{'id':_0x251ebb['params']['id']}})[_0x07a1('0x26')](handleEntityNotFound(_0x5c3afc,null))[_0x07a1('0x26')](function(_0x1b678a){if(_0x1b678a){_0x3ebeb2=_0x1b678a;_0x1be959[_0x07a1('0x36')]=_[_0x07a1('0x33')](db[_0x07a1('0x50')][_0x07a1('0x2e')]);_0x1be959[_0x07a1('0x32')]=_[_0x07a1('0x33')](_0x251ebb[_0x07a1('0x32')]);_0x1be959[_0x07a1('0x34')]=_[_0x07a1('0x35')](_0x1be959[_0x07a1('0x36')],_0x1be959['query']);_0x50bfc8[_0x07a1('0x37')]=_['intersection'](_0x1be959[_0x07a1('0x36')],qs[_0x07a1('0x38')](_0x251ebb['query'][_0x07a1('0x38')]));_0x50bfc8[_0x07a1('0x37')]=_0x50bfc8[_0x07a1('0x37')][_0x07a1('0x51')]?_0x50bfc8[_0x07a1('0x37')]:_0x1be959['model'];_0x50bfc8['order']=qs['sort'](_0x251ebb['query'][_0x07a1('0x3d')]);_0x50bfc8[_0x07a1('0x3e')]=qs[_0x07a1('0x34')](_[_0x07a1('0x3f')](_0x251ebb[_0x07a1('0x32')],_0x1be959[_0x07a1('0x34')]));if(_0x251ebb[_0x07a1('0x32')][_0x07a1('0x40')]){_0x50bfc8[_0x07a1('0x3e')]=_[_0x07a1('0x41')](_0x50bfc8[_0x07a1('0x3e')],{'$or':_[_0x07a1('0x2c')](_0x50bfc8[_0x07a1('0x37')],function(_0x48a004){var _0x2d66c9={};_0x2d66c9[_0x48a004]={'$like':'%'+_0x251ebb[_0x07a1('0x32')][_0x07a1('0x40')]+'%'};return _0x2d66c9;})});}_0x50bfc8=_[_0x07a1('0x41')]({},_0x50bfc8,_0x251ebb['options']);return _0x3ebeb2['getDescriptions'](_0x50bfc8);}})[_0x07a1('0x26')](function(_0x4ea727){if(_0x4ea727){_0xf11e3=_0x4ea727['length'];if(!_0x251ebb[_0x07a1('0x32')][_0x07a1('0x39')]('nolimit')){_0x50bfc8[_0x07a1('0x3b')]=qs[_0x07a1('0x3b')](_0x251ebb[_0x07a1('0x32')][_0x07a1('0x3b')]);_0x50bfc8[_0x07a1('0x1d')]=qs[_0x07a1('0x1d')](_0x251ebb['query']['offset']);}return _0x3ebeb2['getDescriptions'](_0x50bfc8);}})[_0x07a1('0x26')](function(_0xb66e56){if(_0xb66e56){return _0xb66e56?{'count':_0xf11e3,'rows':_0xb66e56}:null;}})[_0x07a1('0x26')](respondWithResult(_0x5c3afc,null))[_0x07a1('0x46')](handleError(_0x5c3afc,null));};
\ No newline at end of file
+var _0x0f9d=['body','ServicenowField','hasOwnProperty','nolimit','getFields','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','save','update','destroy','then','error','stack','name','index','map','ServicenowConfiguration','fieldName','type','model','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find'];(function(_0x98032f,_0x46b52d){var _0x1dee59=function(_0x59c184){while(--_0x59c184){_0x98032f['push'](_0x98032f['shift']());}};_0x1dee59(++_0x46b52d);}(_0x0f9d,0x154));var _0xd0f9=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0x0f9d[_0x199b1f];return _0x267ac9;};'use strict';var emlformat=require(_0xd0f9('0x0'));var rimraf=require(_0xd0f9('0x1'));var zipdir=require(_0xd0f9('0x2'));var jsonpatch=require(_0xd0f9('0x3'));var rp=require(_0xd0f9('0x4'));var moment=require('moment');var BPromise=require(_0xd0f9('0x5'));var Mustache=require(_0xd0f9('0x6'));var util=require(_0xd0f9('0x7'));var path=require(_0xd0f9('0x8'));var sox=require('sox');var csv=require(_0xd0f9('0x9'));var ejs=require(_0xd0f9('0xa'));var fs=require('fs');var fs_extra=require(_0xd0f9('0xb'));var _=require(_0xd0f9('0xc'));var squel=require(_0xd0f9('0xd'));var crypto=require(_0xd0f9('0xe'));var jsforce=require(_0xd0f9('0xf'));var deskjs=require(_0xd0f9('0x10'));var toCsv=require(_0xd0f9('0x9'));var querystring=require(_0xd0f9('0x11'));var Papa=require('papaparse');var Redis=require(_0xd0f9('0x12'));var authService=require(_0xd0f9('0x13'));var qs=require(_0xd0f9('0x14'));var as=require(_0xd0f9('0x15'));var hardwareService=require(_0xd0f9('0x16'));var logger=require(_0xd0f9('0x17'))('api');var utils=require(_0xd0f9('0x18'));var config=require(_0xd0f9('0x19'));var licenseUtil=require(_0xd0f9('0x1a'));var db=require(_0xd0f9('0x1b'))['db'];function respondWithStatusCode(_0x1e6fed,_0x22d6f9){_0x22d6f9=_0x22d6f9||0xcc;return function(_0x107f64){if(_0x107f64){return _0x1e6fed[_0xd0f9('0x1c')](_0x22d6f9);}return _0x1e6fed[_0xd0f9('0x1d')](_0x22d6f9)[_0xd0f9('0x1e')]();};}function respondWithResult(_0x12541a,_0x1ca7fc){_0x1ca7fc=_0x1ca7fc||0xc8;return function(_0x5d3f79){if(_0x5d3f79){return _0x12541a[_0xd0f9('0x1d')](_0x1ca7fc)[_0xd0f9('0x1f')](_0x5d3f79);}};}function respondWithFilteredResult(_0x5679d8,_0x150163){return function(_0x32f475){if(_0x32f475){var _0xe8f485=typeof _0x150163['offset']===_0xd0f9('0x20')&&typeof _0x150163['limit']==='undefined';var _0x2dd6f2=_0x32f475[_0xd0f9('0x21')];var _0x44b210=_0xe8f485?0x0:_0x150163['offset'];var _0x580e82=_0xe8f485?_0x32f475['count']:_0x150163[_0xd0f9('0x22')]+_0x150163[_0xd0f9('0x23')];var _0x2898cd;if(_0x580e82>=_0x2dd6f2){_0x580e82=_0x2dd6f2;_0x2898cd=0xc8;}else{_0x2898cd=0xce;}_0x5679d8['status'](_0x2898cd);return _0x5679d8[_0xd0f9('0x24')]('Content-Range',_0x44b210+'-'+_0x580e82+'/'+_0x2dd6f2)['json'](_0x32f475);}return null;};}function patchUpdates(_0x4226b6){return function(_0x5673e3){try{jsonpatch['apply'](_0x5673e3,_0x4226b6,!![]);}catch(_0x1ee3f7){return BPromise[_0xd0f9('0x25')](_0x1ee3f7);}return _0x5673e3[_0xd0f9('0x26')]();};}function saveUpdates(_0x4eb491,_0x44daed){return function(_0x223b05){if(_0x223b05){return _0x223b05[_0xd0f9('0x27')](_0x4eb491)['then'](function(_0x5bad11){return _0x5bad11;});}return null;};}function removeEntity(_0x49e2c0,_0x2818fb){return function(_0x5c0193){if(_0x5c0193){return _0x5c0193[_0xd0f9('0x28')]()[_0xd0f9('0x29')](function(){_0x49e2c0[_0xd0f9('0x1d')](0xcc)[_0xd0f9('0x1e')]();});}};}function handleEntityNotFound(_0x47da4d,_0x1e125c){return function(_0x33b87d){if(!_0x33b87d){_0x47da4d[_0xd0f9('0x1c')](0x194);}return _0x33b87d;};}function handleError(_0x3ab6c3,_0x437ce0){_0x437ce0=_0x437ce0||0x1f4;return function(_0x1ab45a){logger[_0xd0f9('0x2a')](_0x1ab45a[_0xd0f9('0x2b')]);if(_0x1ab45a['name']){delete _0x1ab45a[_0xd0f9('0x2c')];}_0x3ab6c3[_0xd0f9('0x1d')](_0x437ce0)['send'](_0x1ab45a);};}exports[_0xd0f9('0x2d')]=function(_0x3e6d5b,_0x33b6f6){var _0x350e2f={},_0x16d84b={},_0x9d48cd={'count':0x0,'rows':[]};var _0x541864=_[_0xd0f9('0x2e')](db[_0xd0f9('0x2f')]['rawAttributes'],function(_0x949c10){return{'name':_0x949c10[_0xd0f9('0x30')],'type':_0x949c10[_0xd0f9('0x31')]['key']};});_0x16d84b[_0xd0f9('0x32')]=_['map'](_0x541864,_0xd0f9('0x2c'));_0x16d84b[_0xd0f9('0x33')]=_[_0xd0f9('0x34')](_0x3e6d5b[_0xd0f9('0x33')]);_0x16d84b['filters']=_[_0xd0f9('0x35')](_0x16d84b[_0xd0f9('0x32')],_0x16d84b['query']);_0x350e2f[_0xd0f9('0x36')]=_[_0xd0f9('0x35')](_0x16d84b[_0xd0f9('0x32')],qs[_0xd0f9('0x37')](_0x3e6d5b[_0xd0f9('0x33')][_0xd0f9('0x37')]));_0x350e2f[_0xd0f9('0x36')]=_0x350e2f['attributes'][_0xd0f9('0x38')]?_0x350e2f[_0xd0f9('0x36')]:_0x16d84b[_0xd0f9('0x32')];if(!_0x3e6d5b[_0xd0f9('0x33')]['hasOwnProperty']('nolimit')){_0x350e2f[_0xd0f9('0x23')]=qs[_0xd0f9('0x23')](_0x3e6d5b[_0xd0f9('0x33')]['limit']);_0x350e2f['offset']=qs['offset'](_0x3e6d5b['query'][_0xd0f9('0x22')]);}_0x350e2f[_0xd0f9('0x39')]=qs[_0xd0f9('0x3a')](_0x3e6d5b[_0xd0f9('0x33')]['sort']);_0x350e2f['where']=qs[_0xd0f9('0x3b')](_[_0xd0f9('0x3c')](_0x3e6d5b[_0xd0f9('0x33')],_0x16d84b['filters']),_0x541864);if(_0x3e6d5b[_0xd0f9('0x33')][_0xd0f9('0x3d')]){_0x350e2f[_0xd0f9('0x3e')]=_[_0xd0f9('0x3f')](_0x350e2f[_0xd0f9('0x3e')],{'$or':_['map'](_0x541864,function(_0x8c8a9d){if(_0x8c8a9d[_0xd0f9('0x31')]!==_0xd0f9('0x40')){var _0x54eed1={};_0x54eed1[_0x8c8a9d[_0xd0f9('0x2c')]]={'$like':'%'+_0x3e6d5b[_0xd0f9('0x33')][_0xd0f9('0x3d')]+'%'};return _0x54eed1;}})});}_0x350e2f=_['merge']({},_0x350e2f,_0x3e6d5b[_0xd0f9('0x41')]);var _0x1d458f={'where':_0x350e2f['where']};return db[_0xd0f9('0x2f')][_0xd0f9('0x21')](_0x1d458f)[_0xd0f9('0x29')](function(_0x1583d4){_0x9d48cd[_0xd0f9('0x21')]=_0x1583d4;if(_0x3e6d5b[_0xd0f9('0x33')][_0xd0f9('0x42')]){_0x350e2f[_0xd0f9('0x43')]=[{'all':!![]}];}return db[_0xd0f9('0x2f')][_0xd0f9('0x44')](_0x350e2f);})[_0xd0f9('0x29')](function(_0x2eca1a){_0x9d48cd[_0xd0f9('0x45')]=_0x2eca1a;return _0x9d48cd;})['then'](respondWithFilteredResult(_0x33b6f6,_0x350e2f))[_0xd0f9('0x46')](handleError(_0x33b6f6,null));};exports[_0xd0f9('0x47')]=function(_0x2de2f7,_0x5e88cb){var _0xea6b89={'raw':![],'where':{'id':_0x2de2f7[_0xd0f9('0x48')]['id']}},_0x2907e1={};_0x2907e1[_0xd0f9('0x32')]=_[_0xd0f9('0x34')](db[_0xd0f9('0x2f')][_0xd0f9('0x49')]);_0x2907e1[_0xd0f9('0x33')]=_[_0xd0f9('0x34')](_0x2de2f7[_0xd0f9('0x33')]);_0x2907e1[_0xd0f9('0x3b')]=_[_0xd0f9('0x35')](_0x2907e1[_0xd0f9('0x32')],_0x2907e1['query']);_0xea6b89[_0xd0f9('0x36')]=_[_0xd0f9('0x35')](_0x2907e1[_0xd0f9('0x32')],qs[_0xd0f9('0x37')](_0x2de2f7['query'][_0xd0f9('0x37')]));_0xea6b89['attributes']=_0xea6b89[_0xd0f9('0x36')][_0xd0f9('0x38')]?_0xea6b89['attributes']:_0x2907e1[_0xd0f9('0x32')];if(_0x2de2f7[_0xd0f9('0x33')]['includeAll']){_0xea6b89['include']=[{'all':!![]}];}_0xea6b89=_['merge']({},_0xea6b89,_0x2de2f7[_0xd0f9('0x41')]);return db[_0xd0f9('0x2f')][_0xd0f9('0x4a')](_0xea6b89)[_0xd0f9('0x29')](handleEntityNotFound(_0x5e88cb,null))[_0xd0f9('0x29')](respondWithResult(_0x5e88cb,null))[_0xd0f9('0x46')](handleError(_0x5e88cb,null));};exports['create']=function(_0x2d1596,_0xaa28e2){return db[_0xd0f9('0x2f')]['create'](_0x2d1596[_0xd0f9('0x4b')],{})[_0xd0f9('0x29')](respondWithResult(_0xaa28e2,0xc9))[_0xd0f9('0x46')](handleError(_0xaa28e2,null));};exports[_0xd0f9('0x27')]=function(_0x5ea996,_0x156088){if(_0x5ea996[_0xd0f9('0x4b')]['id']){delete _0x5ea996['body']['id'];}return db[_0xd0f9('0x2f')]['find']({'where':{'id':_0x5ea996['params']['id']}})[_0xd0f9('0x29')](handleEntityNotFound(_0x156088,null))[_0xd0f9('0x29')](saveUpdates(_0x5ea996['body'],null))['then'](respondWithResult(_0x156088,null))[_0xd0f9('0x46')](handleError(_0x156088,null));};exports[_0xd0f9('0x28')]=function(_0x30b249,_0x53aa92){return db[_0xd0f9('0x2f')][_0xd0f9('0x4a')]({'where':{'id':_0x30b249['params']['id']}})[_0xd0f9('0x29')](handleEntityNotFound(_0x53aa92,null))[_0xd0f9('0x29')](removeEntity(_0x53aa92,null))[_0xd0f9('0x46')](handleError(_0x53aa92,null));};exports['getFields']=function(_0x4b5f6f,_0x43b797,_0x37f72c){var _0x261e41={};var _0x3bdf86={};var _0x13791d;var _0x49b722;return db[_0xd0f9('0x2f')]['findOne']({'where':{'id':_0x4b5f6f[_0xd0f9('0x48')]['id']}})[_0xd0f9('0x29')](handleEntityNotFound(_0x43b797,null))[_0xd0f9('0x29')](function(_0x279a25){if(_0x279a25){_0x13791d=_0x279a25;_0x3bdf86[_0xd0f9('0x32')]=_[_0xd0f9('0x34')](db[_0xd0f9('0x4c')][_0xd0f9('0x49')]);_0x3bdf86[_0xd0f9('0x33')]=_[_0xd0f9('0x34')](_0x4b5f6f[_0xd0f9('0x33')]);_0x3bdf86[_0xd0f9('0x3b')]=_[_0xd0f9('0x35')](_0x3bdf86[_0xd0f9('0x32')],_0x3bdf86[_0xd0f9('0x33')]);_0x261e41['attributes']=_[_0xd0f9('0x35')](_0x3bdf86['model'],qs[_0xd0f9('0x37')](_0x4b5f6f[_0xd0f9('0x33')][_0xd0f9('0x37')]));_0x261e41[_0xd0f9('0x36')]=_0x261e41[_0xd0f9('0x36')][_0xd0f9('0x38')]?_0x261e41[_0xd0f9('0x36')]:_0x3bdf86[_0xd0f9('0x32')];_0x261e41[_0xd0f9('0x39')]=qs[_0xd0f9('0x3a')](_0x4b5f6f['query'][_0xd0f9('0x3a')]);_0x261e41['where']=qs[_0xd0f9('0x3b')](_[_0xd0f9('0x3c')](_0x4b5f6f['query'],_0x3bdf86['filters']));if(_0x4b5f6f[_0xd0f9('0x33')][_0xd0f9('0x3d')]){_0x261e41[_0xd0f9('0x3e')]=_[_0xd0f9('0x3f')](_0x261e41[_0xd0f9('0x3e')],{'$or':_['map'](_0x261e41[_0xd0f9('0x36')],function(_0x26a8a3){var _0x525390={};_0x525390[_0x26a8a3]={'$like':'%'+_0x4b5f6f[_0xd0f9('0x33')][_0xd0f9('0x3d')]+'%'};return _0x525390;})});}_0x261e41=_['merge']({},_0x261e41,_0x4b5f6f['options']);return _0x13791d['getFields'](_0x261e41);}})['then'](function(_0x4fc560){if(_0x4fc560){_0x49b722=_0x4fc560['length'];if(!_0x4b5f6f[_0xd0f9('0x33')][_0xd0f9('0x4d')](_0xd0f9('0x4e'))){_0x261e41[_0xd0f9('0x23')]=qs[_0xd0f9('0x23')](_0x4b5f6f[_0xd0f9('0x33')][_0xd0f9('0x23')]);_0x261e41[_0xd0f9('0x22')]=qs['offset'](_0x4b5f6f['query'][_0xd0f9('0x22')]);}return _0x13791d[_0xd0f9('0x4f')](_0x261e41);}})[_0xd0f9('0x29')](function(_0x2e992b){if(_0x2e992b){return _0x2e992b?{'count':_0x49b722,'rows':_0x2e992b}:null;}})[_0xd0f9('0x29')](respondWithResult(_0x43b797,null))['catch'](handleError(_0x43b797,null));};exports['getSubjects']=function(_0x15f8fa,_0x550497,_0x2bec26){var _0x205ae2={};var _0x19e963={};var _0x2b6cd;var _0x11e717;return db[_0xd0f9('0x2f')]['findOne']({'where':{'id':_0x15f8fa[_0xd0f9('0x48')]['id']}})[_0xd0f9('0x29')](handleEntityNotFound(_0x550497,null))[_0xd0f9('0x29')](function(_0x2390bb){if(_0x2390bb){_0x2b6cd=_0x2390bb;_0x19e963[_0xd0f9('0x32')]=_[_0xd0f9('0x34')](db[_0xd0f9('0x4c')][_0xd0f9('0x49')]);_0x19e963[_0xd0f9('0x33')]=_['keys'](_0x15f8fa[_0xd0f9('0x33')]);_0x19e963[_0xd0f9('0x3b')]=_[_0xd0f9('0x35')](_0x19e963['model'],_0x19e963[_0xd0f9('0x33')]);_0x205ae2[_0xd0f9('0x36')]=_['intersection'](_0x19e963['model'],qs['fields'](_0x15f8fa[_0xd0f9('0x33')]['fields']));_0x205ae2['attributes']=_0x205ae2['attributes'][_0xd0f9('0x38')]?_0x205ae2[_0xd0f9('0x36')]:_0x19e963[_0xd0f9('0x32')];_0x205ae2[_0xd0f9('0x39')]=qs['sort'](_0x15f8fa[_0xd0f9('0x33')]['sort']);_0x205ae2[_0xd0f9('0x3e')]=qs[_0xd0f9('0x3b')](_[_0xd0f9('0x3c')](_0x15f8fa[_0xd0f9('0x33')],_0x19e963[_0xd0f9('0x3b')]));if(_0x15f8fa[_0xd0f9('0x33')]['filter']){_0x205ae2[_0xd0f9('0x3e')]=_['merge'](_0x205ae2['where'],{'$or':_[_0xd0f9('0x2e')](_0x205ae2['attributes'],function(_0x13ee6b){var _0xa691c7={};_0xa691c7[_0x13ee6b]={'$like':'%'+_0x15f8fa['query'][_0xd0f9('0x3d')]+'%'};return _0xa691c7;})});}_0x205ae2=_[_0xd0f9('0x3f')]({},_0x205ae2,_0x15f8fa[_0xd0f9('0x41')]);return _0x2b6cd[_0xd0f9('0x50')](_0x205ae2);}})[_0xd0f9('0x29')](function(_0x666adf){if(_0x666adf){_0x11e717=_0x666adf['length'];if(!_0x15f8fa[_0xd0f9('0x33')]['hasOwnProperty'](_0xd0f9('0x4e'))){_0x205ae2['limit']=qs[_0xd0f9('0x23')](_0x15f8fa[_0xd0f9('0x33')]['limit']);_0x205ae2['offset']=qs[_0xd0f9('0x22')](_0x15f8fa[_0xd0f9('0x33')][_0xd0f9('0x22')]);}return _0x2b6cd[_0xd0f9('0x50')](_0x205ae2);}})['then'](function(_0xfd8879){if(_0xfd8879){return _0xfd8879?{'count':_0x11e717,'rows':_0xfd8879}:null;}})['then'](respondWithResult(_0x550497,null))[_0xd0f9('0x46')](handleError(_0x550497,null));};exports[_0xd0f9('0x51')]=function(_0x5ad7aa,_0x1f9a49,_0x2940b5){var _0x1f0365={};var _0x1de086={};var _0x34c623;var _0x1ee539;return db['ServicenowConfiguration'][_0xd0f9('0x52')]({'where':{'id':_0x5ad7aa[_0xd0f9('0x48')]['id']}})[_0xd0f9('0x29')](handleEntityNotFound(_0x1f9a49,null))['then'](function(_0x407e61){if(_0x407e61){_0x34c623=_0x407e61;_0x1de086[_0xd0f9('0x32')]=_[_0xd0f9('0x34')](db[_0xd0f9('0x4c')][_0xd0f9('0x49')]);_0x1de086[_0xd0f9('0x33')]=_[_0xd0f9('0x34')](_0x5ad7aa['query']);_0x1de086[_0xd0f9('0x3b')]=_[_0xd0f9('0x35')](_0x1de086['model'],_0x1de086['query']);_0x1f0365[_0xd0f9('0x36')]=_[_0xd0f9('0x35')](_0x1de086[_0xd0f9('0x32')],qs['fields'](_0x5ad7aa[_0xd0f9('0x33')][_0xd0f9('0x37')]));_0x1f0365[_0xd0f9('0x36')]=_0x1f0365[_0xd0f9('0x36')]['length']?_0x1f0365[_0xd0f9('0x36')]:_0x1de086[_0xd0f9('0x32')];_0x1f0365[_0xd0f9('0x39')]=qs['sort'](_0x5ad7aa[_0xd0f9('0x33')][_0xd0f9('0x3a')]);_0x1f0365[_0xd0f9('0x3e')]=qs[_0xd0f9('0x3b')](_[_0xd0f9('0x3c')](_0x5ad7aa[_0xd0f9('0x33')],_0x1de086[_0xd0f9('0x3b')]));if(_0x5ad7aa[_0xd0f9('0x33')][_0xd0f9('0x3d')]){_0x1f0365['where']=_[_0xd0f9('0x3f')](_0x1f0365[_0xd0f9('0x3e')],{'$or':_['map'](_0x1f0365[_0xd0f9('0x36')],function(_0x41f617){var _0x4ccbf4={};_0x4ccbf4[_0x41f617]={'$like':'%'+_0x5ad7aa['query'][_0xd0f9('0x3d')]+'%'};return _0x4ccbf4;})});}_0x1f0365=_['merge']({},_0x1f0365,_0x5ad7aa[_0xd0f9('0x41')]);return _0x34c623[_0xd0f9('0x51')](_0x1f0365);}})[_0xd0f9('0x29')](function(_0x2b8bee){if(_0x2b8bee){_0x1ee539=_0x2b8bee[_0xd0f9('0x38')];if(!_0x5ad7aa['query'][_0xd0f9('0x4d')](_0xd0f9('0x4e'))){_0x1f0365[_0xd0f9('0x23')]=qs['limit'](_0x5ad7aa[_0xd0f9('0x33')]['limit']);_0x1f0365[_0xd0f9('0x22')]=qs[_0xd0f9('0x22')](_0x5ad7aa[_0xd0f9('0x33')][_0xd0f9('0x22')]);}return _0x34c623[_0xd0f9('0x51')](_0x1f0365);}})[_0xd0f9('0x29')](function(_0x12a627){if(_0x12a627){return _0x12a627?{'count':_0x1ee539,'rows':_0x12a627}:null;}})['then'](respondWithResult(_0x1f9a49,null))[_0xd0f9('0x46')](handleError(_0x1f9a49,null));};
\ No newline at end of file
index 71c3bfc..b40ae36 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdac7=['util','bluebird','request-promise','path','rimraf','ServicenowConfiguration','lodash'];(function(_0x1d7599,_0x49929f){var _0x55da12=function(_0x3f7a5f){while(--_0x3f7a5f){_0x1d7599['push'](_0x1d7599['shift']());}};_0x55da12(++_0x49929f);}(_0xdac7,0x180));var _0x7dac=function(_0x217d6e,_0x21ee99){_0x217d6e=_0x217d6e-0x0;var _0x3dc4df=_0xdac7[_0x217d6e];return _0x3dc4df;};'use strict';var _=require(_0x7dac('0x0'));var util=require(_0x7dac('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7dac('0x2'));var rp=require(_0x7dac('0x3'));var fs=require('fs');var path=require(_0x7dac('0x4'));var rimraf=require(_0x7dac('0x5'));var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x17a05f,_0x2557ee){return _0x17a05f['define'](_0x7dac('0x6'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa880=['define','ServicenowConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x1741c0,_0x3156c8){var _0x3e043a=function(_0x46646a){while(--_0x46646a){_0x1741c0['push'](_0x1741c0['shift']());}};_0x3e043a(++_0x3156c8);}(_0xa880,0x106));var _0x0a88=function(_0x2ba94a,_0x20634f){_0x2ba94a=_0x2ba94a-0x0;var _0x55f423=_0xa880[_0x2ba94a];return _0x55f423;};'use strict';var _=require(_0x0a88('0x0'));var util=require(_0x0a88('0x1'));var logger=require(_0x0a88('0x2'))(_0x0a88('0x3'));var moment=require(_0x0a88('0x4'));var BPromise=require(_0x0a88('0x5'));var rp=require(_0x0a88('0x6'));var fs=require('fs');var path=require(_0x0a88('0x7'));var rimraf=require(_0x0a88('0x8'));var config=require(_0x0a88('0x9'));var attributes=require(_0x0a88('0xa'));module['exports']=function(_0x35c530,_0x2aac39){return _0x35c530[_0x0a88('0xb')](_0x0a88('0xc'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index b424a3d..e0b1997 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x741c=['jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1854b6,_0x28a70e){var _0xee0f17=function(_0xd6fb60){while(--_0xd6fb60){_0x1854b6['push'](_0x1854b6['shift']());}};_0xee0f17(++_0x28a70e);}(_0x741c,0x98));var _0xc741=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x741c[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var moment=require(_0xc741('0x2'));var BPromise=require(_0xc741('0x3'));var rs=require(_0xc741('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc741('0x5'))['db'];var utils=require(_0xc741('0x6'));var logger=require(_0xc741('0x7'))(_0xc741('0x8'));var config=require('../../config/environment');var jayson=require(_0xc741('0x9'));var client=jayson[_0xc741('0xa')][_0xc741('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49e447,_0x5a69e2,_0x5cff27){return new BPromise(function(_0x4300ef,_0x30fba2){return client['request'](_0x49e447,_0x5cff27)['then'](function(_0x3a0b90){logger[_0xc741('0xc')](_0xc741('0xd'),_0x5a69e2,_0xc741('0xe'));logger[_0xc741('0xf')](_0xc741('0x10'),_0x5a69e2,'request\x20sent',JSON[_0xc741('0x11')](_0x3a0b90));if(_0x3a0b90[_0xc741('0x12')]){if(_0x3a0b90[_0xc741('0x12')][_0xc741('0x13')]===0x1f4){logger['error'](_0xc741('0xd'),_0x5a69e2,_0x3a0b90[_0xc741('0x12')][_0xc741('0x14')]);return _0x30fba2(_0x3a0b90[_0xc741('0x12')][_0xc741('0x14')]);}logger[_0xc741('0x12')](_0xc741('0xd'),_0x5a69e2,_0x3a0b90[_0xc741('0x12')][_0xc741('0x14')]);return _0x4300ef(_0x3a0b90[_0xc741('0x12')][_0xc741('0x14')]);}else{logger[_0xc741('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5a69e2,_0xc741('0xe'));_0x4300ef(_0x3a0b90[_0xc741('0x15')][_0xc741('0x14')]);}})[_0xc741('0x16')](function(_0x374b90){logger[_0xc741('0x12')](_0xc741('0xd'),_0x5a69e2,_0x374b90);_0x30fba2(_0x374b90);});});}
\ No newline at end of file
+var _0xe2a5=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x35cb9d,_0x19d7c4){var _0x23b205=function(_0x44ada4){while(--_0x44ada4){_0x35cb9d['push'](_0x35cb9d['shift']());}};_0x23b205(++_0x19d7c4);}(_0xe2a5,0xbe));var _0x5e2a=function(_0x15cb02,_0x2e1160){_0x15cb02=_0x15cb02-0x0;var _0x2e9c50=_0xe2a5[_0x15cb02];return _0x2e9c50;};'use strict';var _=require('lodash');var util=require(_0x5e2a('0x0'));var moment=require('moment');var BPromise=require(_0x5e2a('0x1'));var rs=require(_0x5e2a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e2a('0x3'))['db'];var utils=require(_0x5e2a('0x4'));var logger=require(_0x5e2a('0x5'))(_0x5e2a('0x6'));var config=require('../../config/environment');var jayson=require(_0x5e2a('0x7'));var client=jayson['client'][_0x5e2a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bd050,_0x23b945,_0x5d7313){return new BPromise(function(_0xe7fc13,_0x2d190c){return client['request'](_0x1bd050,_0x5d7313)[_0x5e2a('0x9')](function(_0x58eaae){logger[_0x5e2a('0xa')](_0x5e2a('0xb'),_0x23b945,'request\x20sent');logger['debug'](_0x5e2a('0xc'),_0x23b945,_0x5e2a('0xd'),JSON[_0x5e2a('0xe')](_0x58eaae));if(_0x58eaae[_0x5e2a('0xf')]){if(_0x58eaae['error'][_0x5e2a('0x10')]===0x1f4){logger[_0x5e2a('0xf')](_0x5e2a('0xb'),_0x23b945,_0x58eaae[_0x5e2a('0xf')][_0x5e2a('0x11')]);return _0x2d190c(_0x58eaae[_0x5e2a('0xf')][_0x5e2a('0x11')]);}logger[_0x5e2a('0xf')](_0x5e2a('0xb'),_0x23b945,_0x58eaae['error']['message']);return _0xe7fc13(_0x58eaae[_0x5e2a('0xf')][_0x5e2a('0x11')]);}else{logger[_0x5e2a('0xa')](_0x5e2a('0xb'),_0x23b945,_0x5e2a('0xd'));_0xe7fc13(_0x58eaae['result'][_0x5e2a('0x11')]);}})[_0x5e2a('0x12')](function(_0x2771e8){logger['error'](_0x5e2a('0xb'),_0x23b945,_0x2771e8);_0x2d190c(_0x2771e8);});});}
\ No newline at end of file
index 089e1b4..bfc0489 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d88=['../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1572e5,_0x4b364f){var _0x481bfc=function(_0x3e3b68){while(--_0x3e3b68){_0x1572e5['push'](_0x1572e5['shift']());}};_0x481bfc(++_0x4b364f);}(_0x6d88,0xe9));var _0x86d8=function(_0x21eba9,_0x1768fa){_0x21eba9=_0x21eba9-0x0;var _0xa9540c=_0x6d88[_0x21eba9];return _0xa9540c;};'use strict';var multer=require(_0x86d8('0x0'));var util=require('util');var path=require(_0x86d8('0x1'));var timeout=require('connect-timeout');var express=require(_0x86d8('0x2'));var router=express[_0x86d8('0x3')]();var fs_extra=require(_0x86d8('0x4'));var auth=require(_0x86d8('0x5'));var interaction=require(_0x86d8('0x6'));var config=require(_0x86d8('0x7'));var controller=require(_0x86d8('0x8'));router[_0x86d8('0x9')]('/',auth[_0x86d8('0xa')](),controller[_0x86d8('0xb')]);router[_0x86d8('0x9')](_0x86d8('0xc'),auth[_0x86d8('0xa')](),controller[_0x86d8('0xd')]);router[_0x86d8('0xe')]('/',auth[_0x86d8('0xa')](),controller[_0x86d8('0xf')]);router[_0x86d8('0x10')](_0x86d8('0xc'),auth[_0x86d8('0xa')](),controller['update']);router[_0x86d8('0x11')](_0x86d8('0xc'),auth[_0x86d8('0xa')](),controller[_0x86d8('0x12')]);module[_0x86d8('0x13')]=router;
\ No newline at end of file
+var _0x060d=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x060d,0x70));var _0xd060=function(_0x4511ca,_0x320da6){_0x4511ca=_0x4511ca-0x0;var _0x481881=_0x060d[_0x4511ca];return _0x481881;};'use strict';var multer=require(_0xd060('0x0'));var util=require(_0xd060('0x1'));var path=require(_0xd060('0x2'));var timeout=require(_0xd060('0x3'));var express=require(_0xd060('0x4'));var router=express[_0xd060('0x5')]();var fs_extra=require(_0xd060('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd060('0x7'));var config=require('../../config/environment');var controller=require(_0xd060('0x8'));router['get']('/',auth[_0xd060('0x9')](),controller[_0xd060('0xa')]);router[_0xd060('0xb')](_0xd060('0xc'),auth['isAuthenticated'](),controller[_0xd060('0xd')]);router[_0xd060('0xe')]('/',auth['isAuthenticated'](),controller[_0xd060('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd060('0x10')](_0xd060('0xc'),auth[_0xd060('0x9')](),controller[_0xd060('0x11')]);module[_0xd060('0x12')]=router;
\ No newline at end of file
index 38f2c06..18cbcfd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x03ce=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','STRING','string','BOOLEAN'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x03ce,0x1d6));var _0xe03c=function(_0x2194b4,_0x186e6a){_0x2194b4=_0x2194b4-0x0;var _0x289253=_0x03ce[_0x2194b4];return _0x289253;};'use strict';var Sequelize=require(_0xe03c('0x0'));module[_0xe03c('0x1')]={'type':{'type':Sequelize[_0xe03c('0x2')]('string',_0xe03c('0x3'),_0xe03c('0x4'),_0xe03c('0x5'),_0xe03c('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe03c('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xe03c('0x8'),'variable',_0xe03c('0x4'))},'keyContent':{'type':Sequelize[_0xe03c('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe03c('0x7')]},'customField':{'type':Sequelize[_0xe03c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe03c('0x7')]}};
\ No newline at end of file
+var _0xa0ae=['picklist','STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa0ae,0x12c));var _0xea0a=function(_0x31e2cd,_0x4c05ba){_0x31e2cd=_0x31e2cd-0x0;var _0x48af4e=_0xa0ae[_0x31e2cd];return _0x48af4e;};'use strict';var Sequelize=require(_0xea0a('0x0'));module[_0xea0a('0x1')]={'type':{'type':Sequelize['ENUM'](_0xea0a('0x2'),_0xea0a('0x3'),_0xea0a('0x4'),_0xea0a('0x5'),_0xea0a('0x6')),'defaultValue':_0xea0a('0x2')},'content':{'type':Sequelize[_0xea0a('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xea0a('0x2'),_0xea0a('0x3'),_0xea0a('0x4'))},'keyContent':{'type':Sequelize[_0xea0a('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xea0a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xea0a('0x7')]}};
\ No newline at end of file
index 9580a4e..a6ec22d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe107=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ServicenowField','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x1e6722,_0x52313f){var _0x586bd=function(_0x9c332e){while(--_0x9c332e){_0x1e6722['push'](_0x1e6722['shift']());}};_0x586bd(++_0x52313f);}(_0xe107,0x117));var _0x7e10=function(_0x2526e8,_0x500aa3){_0x2526e8=_0x2526e8-0x0;var _0x592c58=_0xe107[_0x2526e8];return _0x592c58;};'use strict';var emlformat=require(_0x7e10('0x0'));var rimraf=require(_0x7e10('0x1'));var zipdir=require(_0x7e10('0x2'));var jsonpatch=require(_0x7e10('0x3'));var rp=require(_0x7e10('0x4'));var moment=require(_0x7e10('0x5'));var BPromise=require(_0x7e10('0x6'));var Mustache=require(_0x7e10('0x7'));var util=require(_0x7e10('0x8'));var path=require(_0x7e10('0x9'));var sox=require(_0x7e10('0xa'));var csv=require(_0x7e10('0xb'));var ejs=require(_0x7e10('0xc'));var fs=require('fs');var fs_extra=require(_0x7e10('0xd'));var _=require(_0x7e10('0xe'));var squel=require(_0x7e10('0xf'));var crypto=require(_0x7e10('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e10('0xb'));var querystring=require(_0x7e10('0x11'));var Papa=require(_0x7e10('0x12'));var Redis=require(_0x7e10('0x13'));var authService=require(_0x7e10('0x14'));var qs=require(_0x7e10('0x15'));var as=require(_0x7e10('0x16'));var hardwareService=require(_0x7e10('0x17'));var logger=require(_0x7e10('0x18'))(_0x7e10('0x19'));var utils=require(_0x7e10('0x1a'));var config=require(_0x7e10('0x1b'));var licenseUtil=require(_0x7e10('0x1c'));var db=require(_0x7e10('0x1d'))['db'];function respondWithStatusCode(_0x24b6dc,_0x2eb83f){_0x2eb83f=_0x2eb83f||0xcc;return function(_0x391e51){if(_0x391e51){return _0x24b6dc[_0x7e10('0x1e')](_0x2eb83f);}return _0x24b6dc[_0x7e10('0x1f')](_0x2eb83f)[_0x7e10('0x20')]();};}function respondWithResult(_0x33e096,_0x4ea5b5){_0x4ea5b5=_0x4ea5b5||0xc8;return function(_0x5db6a7){if(_0x5db6a7){return _0x33e096[_0x7e10('0x1f')](_0x4ea5b5)['json'](_0x5db6a7);}};}function respondWithFilteredResult(_0x369d43,_0x3ed553){return function(_0x51b37e){if(_0x51b37e){var _0x2992df=typeof _0x3ed553[_0x7e10('0x21')]===_0x7e10('0x22')&&typeof _0x3ed553[_0x7e10('0x23')]===_0x7e10('0x22');var _0x1bad77=_0x51b37e[_0x7e10('0x24')];var _0x360802=_0x2992df?0x0:_0x3ed553[_0x7e10('0x21')];var _0x317254=_0x2992df?_0x51b37e[_0x7e10('0x24')]:_0x3ed553[_0x7e10('0x21')]+_0x3ed553[_0x7e10('0x23')];var _0x560b08;if(_0x317254>=_0x1bad77){_0x317254=_0x1bad77;_0x560b08=0xc8;}else{_0x560b08=0xce;}_0x369d43['status'](_0x560b08);return _0x369d43[_0x7e10('0x25')](_0x7e10('0x26'),_0x360802+'-'+_0x317254+'/'+_0x1bad77)['json'](_0x51b37e);}return null;};}function patchUpdates(_0x12fd4d){return function(_0x2ec5c0){try{jsonpatch[_0x7e10('0x27')](_0x2ec5c0,_0x12fd4d,!![]);}catch(_0x4912db){return BPromise[_0x7e10('0x28')](_0x4912db);}return _0x2ec5c0[_0x7e10('0x29')]();};}function saveUpdates(_0x197c99,_0x35491f){return function(_0x49f7cd){if(_0x49f7cd){return _0x49f7cd[_0x7e10('0x2a')](_0x197c99)[_0x7e10('0x2b')](function(_0x3ab7bf){return _0x3ab7bf;});}return null;};}function removeEntity(_0x4d5c8c,_0x171db0){return function(_0x2b4f65){if(_0x2b4f65){return _0x2b4f65[_0x7e10('0x2c')]()[_0x7e10('0x2b')](function(){_0x4d5c8c[_0x7e10('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3db78f,_0x209a76){return function(_0x5aea92){if(!_0x5aea92){_0x3db78f[_0x7e10('0x1e')](0x194);}return _0x5aea92;};}function handleError(_0x2cbeec,_0x19599c){_0x19599c=_0x19599c||0x1f4;return function(_0x706566){logger[_0x7e10('0x2d')](_0x706566['stack']);if(_0x706566[_0x7e10('0x2e')]){delete _0x706566['name'];}_0x2cbeec[_0x7e10('0x1f')](_0x19599c)[_0x7e10('0x2f')](_0x706566);};}exports[_0x7e10('0x30')]=function(_0x425682,_0x3e0b0e){var _0x272926={},_0x261336={},_0x28449f={'count':0x0,'rows':[]};var _0x2f00a=_[_0x7e10('0x31')](db[_0x7e10('0x32')][_0x7e10('0x33')],function(_0x1ef8ae){return{'name':_0x1ef8ae['fieldName'],'type':_0x1ef8ae[_0x7e10('0x34')][_0x7e10('0x35')]};});_0x261336['model']=_[_0x7e10('0x31')](_0x2f00a,_0x7e10('0x2e'));_0x261336['query']=_[_0x7e10('0x36')](_0x425682[_0x7e10('0x37')]);_0x261336[_0x7e10('0x38')]=_[_0x7e10('0x39')](_0x261336[_0x7e10('0x3a')],_0x261336[_0x7e10('0x37')]);_0x272926[_0x7e10('0x3b')]=_[_0x7e10('0x39')](_0x261336[_0x7e10('0x3a')],qs['fields'](_0x425682[_0x7e10('0x37')][_0x7e10('0x3c')]));_0x272926[_0x7e10('0x3b')]=_0x272926[_0x7e10('0x3b')][_0x7e10('0x3d')]?_0x272926['attributes']:_0x261336['model'];if(!_0x425682[_0x7e10('0x37')][_0x7e10('0x3e')]('nolimit')){_0x272926[_0x7e10('0x23')]=qs[_0x7e10('0x23')](_0x425682[_0x7e10('0x37')][_0x7e10('0x23')]);_0x272926[_0x7e10('0x21')]=qs[_0x7e10('0x21')](_0x425682[_0x7e10('0x37')][_0x7e10('0x21')]);}_0x272926['order']=qs[_0x7e10('0x3f')](_0x425682[_0x7e10('0x37')][_0x7e10('0x3f')]);_0x272926[_0x7e10('0x40')]=qs[_0x7e10('0x38')](_[_0x7e10('0x41')](_0x425682[_0x7e10('0x37')],_0x261336[_0x7e10('0x38')]),_0x2f00a);if(_0x425682[_0x7e10('0x37')][_0x7e10('0x42')]){_0x272926[_0x7e10('0x40')]=_[_0x7e10('0x43')](_0x272926['where'],{'$or':_[_0x7e10('0x31')](_0x2f00a,function(_0x489bc1){if(_0x489bc1['type']!==_0x7e10('0x44')){var _0x275f72={};_0x275f72[_0x489bc1[_0x7e10('0x2e')]]={'$like':'%'+_0x425682['query'][_0x7e10('0x42')]+'%'};return _0x275f72;}})});}_0x272926=_[_0x7e10('0x43')]({},_0x272926,_0x425682[_0x7e10('0x45')]);var _0x8eadbd={'where':_0x272926[_0x7e10('0x40')]};return db[_0x7e10('0x32')][_0x7e10('0x24')](_0x8eadbd)['then'](function(_0x3e7a26){_0x28449f[_0x7e10('0x24')]=_0x3e7a26;if(_0x425682[_0x7e10('0x37')]['includeAll']){_0x272926['include']=[{'all':!![]}];}return db[_0x7e10('0x32')][_0x7e10('0x46')](_0x272926);})['then'](function(_0x49b180){_0x28449f[_0x7e10('0x47')]=_0x49b180;return _0x28449f;})['then'](respondWithFilteredResult(_0x3e0b0e,_0x272926))[_0x7e10('0x48')](handleError(_0x3e0b0e,null));};exports['show']=function(_0x568d41,_0x82b411){var _0x1914ba={'raw':!![],'where':{'id':_0x568d41[_0x7e10('0x49')]['id']}},_0x4290d4={};_0x4290d4[_0x7e10('0x3a')]=_[_0x7e10('0x36')](db[_0x7e10('0x32')][_0x7e10('0x33')]);_0x4290d4[_0x7e10('0x37')]=_['keys'](_0x568d41[_0x7e10('0x37')]);_0x4290d4['filters']=_[_0x7e10('0x39')](_0x4290d4[_0x7e10('0x3a')],_0x4290d4[_0x7e10('0x37')]);_0x1914ba['attributes']=_[_0x7e10('0x39')](_0x4290d4[_0x7e10('0x3a')],qs['fields'](_0x568d41['query'][_0x7e10('0x3c')]));_0x1914ba['attributes']=_0x1914ba[_0x7e10('0x3b')][_0x7e10('0x3d')]?_0x1914ba[_0x7e10('0x3b')]:_0x4290d4[_0x7e10('0x3a')];if(_0x568d41[_0x7e10('0x37')][_0x7e10('0x4a')]){_0x1914ba['include']=[{'all':!![]}];}_0x1914ba=_['merge']({},_0x1914ba,_0x568d41['options']);return db[_0x7e10('0x32')]['find'](_0x1914ba)[_0x7e10('0x2b')](handleEntityNotFound(_0x82b411,null))[_0x7e10('0x2b')](respondWithResult(_0x82b411,null))[_0x7e10('0x48')](handleError(_0x82b411,null));};exports[_0x7e10('0x4b')]=function(_0x5ccf2e,_0x5879ea){return db[_0x7e10('0x32')][_0x7e10('0x4b')](_0x5ccf2e['body'],{})[_0x7e10('0x2b')](respondWithResult(_0x5879ea,0xc9))[_0x7e10('0x48')](handleError(_0x5879ea,null));};exports[_0x7e10('0x2a')]=function(_0x402ba1,_0x441af2){if(_0x402ba1[_0x7e10('0x4c')]['id']){delete _0x402ba1[_0x7e10('0x4c')]['id'];}return db['ServicenowField'][_0x7e10('0x4d')]({'where':{'id':_0x402ba1[_0x7e10('0x49')]['id']}})[_0x7e10('0x2b')](handleEntityNotFound(_0x441af2,null))[_0x7e10('0x2b')](saveUpdates(_0x402ba1[_0x7e10('0x4c')],null))[_0x7e10('0x2b')](respondWithResult(_0x441af2,null))[_0x7e10('0x48')](handleError(_0x441af2,null));};exports[_0x7e10('0x2c')]=function(_0x5a8f3f,_0x371873){return db[_0x7e10('0x32')][_0x7e10('0x4d')]({'where':{'id':_0x5a8f3f['params']['id']}})[_0x7e10('0x2b')](handleEntityNotFound(_0x371873,null))['then'](removeEntity(_0x371873,null))[_0x7e10('0x48')](handleError(_0x371873,null));};
\ No newline at end of file
+var _0x3563=['reject','then','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','keys','find','update','body','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x993f24,_0x227b78){var _0x3064db=function(_0x5c0d9e){while(--_0x5c0d9e){_0x993f24['push'](_0x993f24['shift']());}};_0x3064db(++_0x227b78);}(_0x3563,0xf4));var _0x3356=function(_0x52038a,_0x202a1c){_0x52038a=_0x52038a-0x0;var _0x38c023=_0x3563[_0x52038a];return _0x38c023;};'use strict';var emlformat=require(_0x3356('0x0'));var rimraf=require(_0x3356('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3356('0x2'));var moment=require(_0x3356('0x3'));var BPromise=require(_0x3356('0x4'));var Mustache=require(_0x3356('0x5'));var util=require(_0x3356('0x6'));var path=require(_0x3356('0x7'));var sox=require('sox');var csv=require(_0x3356('0x8'));var ejs=require(_0x3356('0x9'));var fs=require('fs');var fs_extra=require(_0x3356('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3356('0xb'));var jsforce=require(_0x3356('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3356('0x8'));var querystring=require('querystring');var Papa=require(_0x3356('0xd'));var Redis=require(_0x3356('0xe'));var authService=require(_0x3356('0xf'));var qs=require(_0x3356('0x10'));var as=require(_0x3356('0x11'));var hardwareService=require(_0x3356('0x12'));var logger=require(_0x3356('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3356('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3356('0x15'))['db'];function respondWithStatusCode(_0x4b3784,_0x320add){_0x320add=_0x320add||0xcc;return function(_0x53e04b){if(_0x53e04b){return _0x4b3784[_0x3356('0x16')](_0x320add);}return _0x4b3784[_0x3356('0x17')](_0x320add)[_0x3356('0x18')]();};}function respondWithResult(_0x255c8c,_0x5cd257){_0x5cd257=_0x5cd257||0xc8;return function(_0x53d76d){if(_0x53d76d){return _0x255c8c[_0x3356('0x17')](_0x5cd257)[_0x3356('0x19')](_0x53d76d);}};}function respondWithFilteredResult(_0x1a518f,_0x3b6918){return function(_0x2582a6){if(_0x2582a6){var _0x437817=typeof _0x3b6918[_0x3356('0x1a')]===_0x3356('0x1b')&&typeof _0x3b6918[_0x3356('0x1c')]===_0x3356('0x1b');var _0x15342d=_0x2582a6[_0x3356('0x1d')];var _0x58a81e=_0x437817?0x0:_0x3b6918[_0x3356('0x1a')];var _0x2745ef=_0x437817?_0x2582a6[_0x3356('0x1d')]:_0x3b6918[_0x3356('0x1a')]+_0x3b6918['limit'];var _0x4ce70d;if(_0x2745ef>=_0x15342d){_0x2745ef=_0x15342d;_0x4ce70d=0xc8;}else{_0x4ce70d=0xce;}_0x1a518f[_0x3356('0x17')](_0x4ce70d);return _0x1a518f['set'](_0x3356('0x1e'),_0x58a81e+'-'+_0x2745ef+'/'+_0x15342d)['json'](_0x2582a6);}return null;};}function patchUpdates(_0x455d27){return function(_0x4dcbf4){try{jsonpatch[_0x3356('0x1f')](_0x4dcbf4,_0x455d27,!![]);}catch(_0x24aae6){return BPromise[_0x3356('0x20')](_0x24aae6);}return _0x4dcbf4['save']();};}function saveUpdates(_0x14f27f,_0x13050b){return function(_0x130058){if(_0x130058){return _0x130058['update'](_0x14f27f)[_0x3356('0x21')](function(_0x29b91a){return _0x29b91a;});}return null;};}function removeEntity(_0x1be127,_0x241a5b){return function(_0x3398a8){if(_0x3398a8){return _0x3398a8[_0x3356('0x22')]()['then'](function(){_0x1be127[_0x3356('0x17')](0xcc)[_0x3356('0x18')]();});}};}function handleEntityNotFound(_0x286136,_0x2b5f28){return function(_0xbb562a){if(!_0xbb562a){_0x286136[_0x3356('0x16')](0x194);}return _0xbb562a;};}function handleError(_0x59d9c0,_0xcf8540){_0xcf8540=_0xcf8540||0x1f4;return function(_0x26407a){logger[_0x3356('0x23')](_0x26407a[_0x3356('0x24')]);if(_0x26407a[_0x3356('0x25')]){delete _0x26407a[_0x3356('0x25')];}_0x59d9c0[_0x3356('0x17')](_0xcf8540)[_0x3356('0x26')](_0x26407a);};}exports[_0x3356('0x27')]=function(_0x5b99e3,_0x2cd317){var _0x222d1c={},_0x497494={},_0x4af92a={'count':0x0,'rows':[]};var _0x28d0c8=_[_0x3356('0x28')](db[_0x3356('0x29')][_0x3356('0x2a')],function(_0x2cd49f){return{'name':_0x2cd49f['fieldName'],'type':_0x2cd49f[_0x3356('0x2b')][_0x3356('0x2c')]};});_0x497494[_0x3356('0x2d')]=_[_0x3356('0x28')](_0x28d0c8,_0x3356('0x25'));_0x497494[_0x3356('0x2e')]=_['keys'](_0x5b99e3[_0x3356('0x2e')]);_0x497494[_0x3356('0x2f')]=_[_0x3356('0x30')](_0x497494[_0x3356('0x2d')],_0x497494['query']);_0x222d1c[_0x3356('0x31')]=_[_0x3356('0x30')](_0x497494[_0x3356('0x2d')],qs[_0x3356('0x32')](_0x5b99e3[_0x3356('0x2e')][_0x3356('0x32')]));_0x222d1c[_0x3356('0x31')]=_0x222d1c[_0x3356('0x31')]['length']?_0x222d1c[_0x3356('0x31')]:_0x497494[_0x3356('0x2d')];if(!_0x5b99e3[_0x3356('0x2e')]['hasOwnProperty'](_0x3356('0x33'))){_0x222d1c['limit']=qs[_0x3356('0x1c')](_0x5b99e3['query'][_0x3356('0x1c')]);_0x222d1c[_0x3356('0x1a')]=qs['offset'](_0x5b99e3[_0x3356('0x2e')][_0x3356('0x1a')]);}_0x222d1c[_0x3356('0x34')]=qs[_0x3356('0x35')](_0x5b99e3[_0x3356('0x2e')][_0x3356('0x35')]);_0x222d1c[_0x3356('0x36')]=qs[_0x3356('0x2f')](_[_0x3356('0x37')](_0x5b99e3[_0x3356('0x2e')],_0x497494['filters']),_0x28d0c8);if(_0x5b99e3[_0x3356('0x2e')][_0x3356('0x38')]){_0x222d1c[_0x3356('0x36')]=_[_0x3356('0x39')](_0x222d1c[_0x3356('0x36')],{'$or':_[_0x3356('0x28')](_0x28d0c8,function(_0x17383d){if(_0x17383d[_0x3356('0x2b')]!=='VIRTUAL'){var _0x1cac1d={};_0x1cac1d[_0x17383d['name']]={'$like':'%'+_0x5b99e3[_0x3356('0x2e')][_0x3356('0x38')]+'%'};return _0x1cac1d;}})});}_0x222d1c=_[_0x3356('0x39')]({},_0x222d1c,_0x5b99e3[_0x3356('0x3a')]);var _0x269401={'where':_0x222d1c['where']};return db[_0x3356('0x29')][_0x3356('0x1d')](_0x269401)[_0x3356('0x21')](function(_0x4907a4){_0x4af92a[_0x3356('0x1d')]=_0x4907a4;if(_0x5b99e3[_0x3356('0x2e')][_0x3356('0x3b')]){_0x222d1c[_0x3356('0x3c')]=[{'all':!![]}];}return db['ServicenowField'][_0x3356('0x3d')](_0x222d1c);})[_0x3356('0x21')](function(_0x3e0996){_0x4af92a[_0x3356('0x3e')]=_0x3e0996;return _0x4af92a;})['then'](respondWithFilteredResult(_0x2cd317,_0x222d1c))[_0x3356('0x3f')](handleError(_0x2cd317,null));};exports['show']=function(_0x2dc648,_0x27830c){var _0x5b7f39={'raw':!![],'where':{'id':_0x2dc648['params']['id']}},_0x91b44f={};_0x91b44f[_0x3356('0x2d')]=_[_0x3356('0x40')](db[_0x3356('0x29')][_0x3356('0x2a')]);_0x91b44f['query']=_[_0x3356('0x40')](_0x2dc648[_0x3356('0x2e')]);_0x91b44f[_0x3356('0x2f')]=_[_0x3356('0x30')](_0x91b44f[_0x3356('0x2d')],_0x91b44f[_0x3356('0x2e')]);_0x5b7f39[_0x3356('0x31')]=_[_0x3356('0x30')](_0x91b44f[_0x3356('0x2d')],qs[_0x3356('0x32')](_0x2dc648[_0x3356('0x2e')][_0x3356('0x32')]));_0x5b7f39[_0x3356('0x31')]=_0x5b7f39['attributes']['length']?_0x5b7f39[_0x3356('0x31')]:_0x91b44f[_0x3356('0x2d')];if(_0x2dc648[_0x3356('0x2e')][_0x3356('0x3b')]){_0x5b7f39[_0x3356('0x3c')]=[{'all':!![]}];}_0x5b7f39=_['merge']({},_0x5b7f39,_0x2dc648[_0x3356('0x3a')]);return db['ServicenowField'][_0x3356('0x41')](_0x5b7f39)[_0x3356('0x21')](handleEntityNotFound(_0x27830c,null))['then'](respondWithResult(_0x27830c,null))[_0x3356('0x3f')](handleError(_0x27830c,null));};exports['create']=function(_0xaeeec1,_0x3a27c0){return db[_0x3356('0x29')]['create'](_0xaeeec1['body'],{})[_0x3356('0x21')](respondWithResult(_0x3a27c0,0xc9))[_0x3356('0x3f')](handleError(_0x3a27c0,null));};exports[_0x3356('0x42')]=function(_0x14f5ca,_0x214da1){if(_0x14f5ca[_0x3356('0x43')]['id']){delete _0x14f5ca[_0x3356('0x43')]['id'];}return db[_0x3356('0x29')][_0x3356('0x41')]({'where':{'id':_0x14f5ca['params']['id']}})[_0x3356('0x21')](handleEntityNotFound(_0x214da1,null))[_0x3356('0x21')](saveUpdates(_0x14f5ca[_0x3356('0x43')],null))[_0x3356('0x21')](respondWithResult(_0x214da1,null))[_0x3356('0x3f')](handleError(_0x214da1,null));};exports[_0x3356('0x22')]=function(_0x5ab8a5,_0x275288){return db[_0x3356('0x29')][_0x3356('0x41')]({'where':{'id':_0x5ab8a5[_0x3356('0x44')]['id']}})[_0x3356('0x21')](handleEntityNotFound(_0x275288,null))[_0x3356('0x21')](removeEntity(_0x275288,null))[_0x3356('0x3f')](handleError(_0x275288,null));};
\ No newline at end of file
index 405b802..bb362d2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa255=['exports','ServicenowField','int_servicenow_fields','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0x5c72ee,_0x5a8bf8){var _0x231876=function(_0x955276){while(--_0x955276){_0x5c72ee['push'](_0x5c72ee['shift']());}};_0x231876(++_0x5a8bf8);}(_0xa255,0x15f));var _0x5a25=function(_0x1b69aa,_0x5aa147){_0x1b69aa=_0x1b69aa-0x0;var _0x42647d=_0xa255[_0x1b69aa];return _0x42647d;};'use strict';var _=require(_0x5a25('0x0'));var util=require(_0x5a25('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5a25('0x2'));var BPromise=require(_0x5a25('0x3'));var rp=require(_0x5a25('0x4'));var fs=require('fs');var path=require(_0x5a25('0x5'));var rimraf=require(_0x5a25('0x6'));var config=require(_0x5a25('0x7'));var attributes=require(_0x5a25('0x8'));module[_0x5a25('0x9')]=function(_0xdc7175,_0x201065){return _0xdc7175['define'](_0x5a25('0xa'),attributes,{'tableName':_0x5a25('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xde34=['path','../../config/environment','exports','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x333427,_0x4e5067){var _0x1e9f9a=function(_0x459e27){while(--_0x459e27){_0x333427['push'](_0x333427['shift']());}};_0x1e9f9a(++_0x4e5067);}(_0xde34,0x17a));var _0x4de3=function(_0x371eb0,_0x2e8285){_0x371eb0=_0x371eb0-0x0;var _0x2112b2=_0xde34[_0x371eb0];return _0x2112b2;};'use strict';var _=require(_0x4de3('0x0'));var util=require(_0x4de3('0x1'));var logger=require(_0x4de3('0x2'))(_0x4de3('0x3'));var moment=require(_0x4de3('0x4'));var BPromise=require(_0x4de3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4de3('0x6'));var rimraf=require('rimraf');var config=require(_0x4de3('0x7'));var attributes=require('./intServicenowField.attributes');module[_0x4de3('0x8')]=function(_0x2139b3,_0x4da42c){return _0x2139b3['define']('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x4de3('0x9'),'fields':[_0x4de3('0xa'),_0x4de3('0xb')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 5ba89c3..d622074 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x305d8c,_0x153576){_0x305d8c=_0x305d8c-0x0;var _0x1e6143=_0xbdb7[_0x305d8c];return _0x1e6143;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});}
\ No newline at end of file
+var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x19b89e,_0x6d7575){var _0x58707b=function(_0x451d93){while(--_0x451d93){_0x19b89e['push'](_0x19b89e['shift']());}};_0x58707b(++_0x6d7575);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}
\ No newline at end of file
index 569cf5a..ee46069 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x331da3,_0x143973){var _0x5e8cca=function(_0xb1a8bf){while(--_0xb1a8bf){_0x331da3['push'](_0x331da3['shift']());}};_0x5e8cca(++_0x143973);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router;
\ No newline at end of file
+var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5eac95,_0x273977){var _0x56ef51=function(_0x403480){while(--_0x403480){_0x5eac95['push'](_0x5eac95['shift']());}};_0x56ef51(++_0x273977);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router;
\ No newline at end of file
index b9487a3..83a6750 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5b917e,_0x358702){var _0x426e98=function(_0x5c2bd7){while(--_0x5c2bd7){_0x5b917e['push'](_0x5b917e['shift']());}};_0x426e98(++_0x358702);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x327e6e,_0x418f43){var _0x44bde1=function(_0x748530){while(--_0x748530){_0x327e6e['push'](_0x327e6e['shift']());}};_0x44bde1(++_0x418f43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}};
\ No newline at end of file
index f88735a..2ad4b95 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x381c=['status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','error','stack','name','index','map','SugarcrmAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','%s%s','Calls','values','remove','includes','label','endsWith','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus'];(function(_0x33220b,_0x557d47){var _0xbc4404=function(_0x5d7ecd){while(--_0x5d7ecd){_0x33220b['push'](_0x33220b['shift']());}};_0xbc4404(++_0x557d47);}(_0x381c,0xd2));var _0xc381=function(_0x228364,_0x3f2b5b){_0x228364=_0x228364-0x0;var _0x18711e=_0x381c[_0x228364];return _0x18711e;};'use strict';var emlformat=require(_0xc381('0x0'));var rimraf=require(_0xc381('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc381('0x2'));var rp=require(_0xc381('0x3'));var moment=require(_0xc381('0x4'));var BPromise=require(_0xc381('0x5'));var Mustache=require(_0xc381('0x6'));var util=require(_0xc381('0x7'));var path=require('path');var sox=require(_0xc381('0x8'));var csv=require(_0xc381('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc381('0xa'));var _=require(_0xc381('0xb'));var squel=require(_0xc381('0xc'));var crypto=require(_0xc381('0xd'));var jsforce=require(_0xc381('0xe'));var deskjs=require(_0xc381('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc381('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc381('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc381('0x12'));var config=require(_0xc381('0x13'));var licenseUtil=require(_0xc381('0x14'));var db=require(_0xc381('0x15'))['db'];var integrations=require(_0xc381('0x16'));function respondWithStatusCode(_0x1b65f3,_0x15d8d3){_0x15d8d3=_0x15d8d3||0xcc;return function(_0x11418b){if(_0x11418b){return _0x1b65f3[_0xc381('0x17')](_0x15d8d3);}return _0x1b65f3[_0xc381('0x18')](_0x15d8d3)['end']();};}function respondWithResult(_0x1baf09,_0x92ad5b){_0x92ad5b=_0x92ad5b||0xc8;return function(_0x17199b){if(_0x17199b){return _0x1baf09[_0xc381('0x18')](_0x92ad5b)[_0xc381('0x19')](_0x17199b);}};}function respondWithFilteredResult(_0x487781,_0x194c3a){return function(_0x41d806){if(_0x41d806){var _0x5901e2=typeof _0x194c3a[_0xc381('0x1a')]===_0xc381('0x1b')&&typeof _0x194c3a[_0xc381('0x1c')]==='undefined';var _0x480803=_0x41d806['count'];var _0x1b2908=_0x5901e2?0x0:_0x194c3a[_0xc381('0x1a')];var _0x58ba3f=_0x5901e2?_0x41d806[_0xc381('0x1d')]:_0x194c3a[_0xc381('0x1a')]+_0x194c3a[_0xc381('0x1c')];var _0x2b05b6;if(_0x58ba3f>=_0x480803){_0x58ba3f=_0x480803;_0x2b05b6=0xc8;}else{_0x2b05b6=0xce;}_0x487781['status'](_0x2b05b6);return _0x487781[_0xc381('0x1e')](_0xc381('0x1f'),_0x1b2908+'-'+_0x58ba3f+'/'+_0x480803)['json'](_0x41d806);}return null;};}function patchUpdates(_0x136f98){return function(_0xa1a00c){try{jsonpatch[_0xc381('0x20')](_0xa1a00c,_0x136f98,!![]);}catch(_0x3ef666){return BPromise['reject'](_0x3ef666);}return _0xa1a00c[_0xc381('0x21')]();};}function saveUpdates(_0x154d88,_0x2bd84a){return function(_0x110e16){if(_0x110e16){return _0x110e16[_0xc381('0x22')](_0x154d88)['then'](function(_0x39cbd3){return _0x39cbd3;});}return null;};}function removeEntity(_0xa93d58,_0x129dfb){return function(_0x526048){if(_0x526048){return _0x526048['destroy']()[_0xc381('0x23')](function(){_0xa93d58[_0xc381('0x18')](0xcc)[_0xc381('0x24')]();});}};}function handleEntityNotFound(_0x278c58,_0x1f784f){return function(_0x25b917){if(!_0x25b917){_0x278c58[_0xc381('0x17')](0x194);}return _0x25b917;};}function handleError(_0x588e55,_0x37b065){_0x37b065=_0x37b065||0x1f4;return function(_0x52f993){logger[_0xc381('0x25')](_0x52f993[_0xc381('0x26')]);if(_0x52f993[_0xc381('0x27')]){delete _0x52f993[_0xc381('0x27')];}_0x588e55[_0xc381('0x18')](_0x37b065)['send'](_0x52f993);};}exports[_0xc381('0x28')]=function(_0x550620,_0x39e445){var _0x5763b7={},_0x2e2b20={},_0xb46db4={'count':0x0,'rows':[]};var _0x2f5908=_[_0xc381('0x29')](db[_0xc381('0x2a')]['rawAttributes'],function(_0x2b3512){return{'name':_0x2b3512[_0xc381('0x2b')],'type':_0x2b3512[_0xc381('0x2c')][_0xc381('0x2d')]};});_0x2e2b20['model']=_['map'](_0x2f5908,_0xc381('0x27'));_0x2e2b20[_0xc381('0x2e')]=_[_0xc381('0x2f')](_0x550620[_0xc381('0x2e')]);_0x2e2b20[_0xc381('0x30')]=_[_0xc381('0x31')](_0x2e2b20[_0xc381('0x32')],_0x2e2b20['query']);_0x5763b7[_0xc381('0x33')]=_['intersection'](_0x2e2b20[_0xc381('0x32')],qs[_0xc381('0x34')](_0x550620[_0xc381('0x2e')][_0xc381('0x34')]));_0x5763b7[_0xc381('0x33')]=_0x5763b7['attributes'][_0xc381('0x35')]?_0x5763b7[_0xc381('0x33')]:_0x2e2b20[_0xc381('0x32')];if(!_0x550620[_0xc381('0x2e')][_0xc381('0x36')](_0xc381('0x37'))){_0x5763b7[_0xc381('0x1c')]=qs[_0xc381('0x1c')](_0x550620[_0xc381('0x2e')][_0xc381('0x1c')]);_0x5763b7[_0xc381('0x1a')]=qs[_0xc381('0x1a')](_0x550620[_0xc381('0x2e')][_0xc381('0x1a')]);}_0x5763b7[_0xc381('0x38')]=qs[_0xc381('0x39')](_0x550620[_0xc381('0x2e')][_0xc381('0x39')]);_0x5763b7[_0xc381('0x3a')]=qs[_0xc381('0x30')](_[_0xc381('0x3b')](_0x550620[_0xc381('0x2e')],_0x2e2b20[_0xc381('0x30')]),_0x2f5908);if(_0x550620[_0xc381('0x2e')][_0xc381('0x3c')]){_0x5763b7['where']=_[_0xc381('0x3d')](_0x5763b7[_0xc381('0x3a')],{'$or':_[_0xc381('0x29')](_0x2f5908,function(_0x4d1c48){if(_0x4d1c48[_0xc381('0x2c')]!==_0xc381('0x3e')){var _0x27b9e0={};_0x27b9e0[_0x4d1c48['name']]={'$like':'%'+_0x550620[_0xc381('0x2e')][_0xc381('0x3c')]+'%'};return _0x27b9e0;}})});}_0x5763b7=_[_0xc381('0x3d')]({},_0x5763b7,_0x550620[_0xc381('0x3f')]);var _0x543480={'where':_0x5763b7['where']};return db['SugarcrmAccount']['count'](_0x543480)[_0xc381('0x23')](function(_0x5f3e40){_0xb46db4['count']=_0x5f3e40;if(_0x550620[_0xc381('0x2e')][_0xc381('0x40')]){_0x5763b7['include']=[{'all':!![]}];}return db[_0xc381('0x2a')][_0xc381('0x41')](_0x5763b7);})[_0xc381('0x23')](function(_0x5b91f3){_0xb46db4[_0xc381('0x42')]=_0x5b91f3;return _0xb46db4;})['then'](respondWithFilteredResult(_0x39e445,_0x5763b7))[_0xc381('0x43')](handleError(_0x39e445,null));};exports['show']=function(_0xad2e68,_0x4200c0){var _0x26e970={'raw':![],'where':{'id':_0xad2e68[_0xc381('0x44')]['id']}},_0x563ae4={};_0x563ae4[_0xc381('0x32')]=_[_0xc381('0x2f')](db[_0xc381('0x2a')][_0xc381('0x45')]);_0x563ae4[_0xc381('0x2e')]=_['keys'](_0xad2e68[_0xc381('0x2e')]);_0x563ae4[_0xc381('0x30')]=_['intersection'](_0x563ae4['model'],_0x563ae4[_0xc381('0x2e')]);_0x26e970['attributes']=_['intersection'](_0x563ae4[_0xc381('0x32')],qs[_0xc381('0x34')](_0xad2e68[_0xc381('0x2e')][_0xc381('0x34')]));_0x26e970['attributes']=_0x26e970['attributes'][_0xc381('0x35')]?_0x26e970[_0xc381('0x33')]:_0x563ae4['model'];if(_0xad2e68[_0xc381('0x2e')]['includeAll']){_0x26e970[_0xc381('0x46')]=[{'all':!![]}];}_0x26e970=_[_0xc381('0x3d')]({},_0x26e970,_0xad2e68[_0xc381('0x3f')]);return db[_0xc381('0x2a')][_0xc381('0x47')](_0x26e970)[_0xc381('0x23')](handleEntityNotFound(_0x4200c0,null))[_0xc381('0x23')](respondWithResult(_0x4200c0,null))['catch'](handleError(_0x4200c0,null));};exports[_0xc381('0x48')]=function(_0x2aca2d,_0x139d03){return db[_0xc381('0x2a')]['create'](_0x2aca2d['body'],{})[_0xc381('0x23')](respondWithResult(_0x139d03,0xc9))['catch'](handleError(_0x139d03,null));};exports['update']=function(_0x355601,_0x50ef50){if(_0x355601[_0xc381('0x49')]['id']){delete _0x355601[_0xc381('0x49')]['id'];}return db[_0xc381('0x2a')][_0xc381('0x47')]({'where':{'id':_0x355601['params']['id']}})[_0xc381('0x23')](handleEntityNotFound(_0x50ef50,null))['then'](saveUpdates(_0x355601[_0xc381('0x49')],null))[_0xc381('0x23')](respondWithResult(_0x50ef50,null))['catch'](handleError(_0x50ef50,null));};exports[_0xc381('0x4a')]=function(_0x1a93b5,_0x33d1ca){return db[_0xc381('0x2a')][_0xc381('0x47')]({'where':{'id':_0x1a93b5[_0xc381('0x44')]['id']}})[_0xc381('0x23')](handleEntityNotFound(_0x33d1ca,null))[_0xc381('0x23')](removeEntity(_0x33d1ca,null))[_0xc381('0x43')](handleError(_0x33d1ca,null));};exports[_0xc381('0x4b')]=function(_0x2dc5ef,_0x321578,_0x254605){var _0x1a5d49={};var _0x5142ee={};var _0x306716;var _0x5b828f;return db[_0xc381('0x2a')][_0xc381('0x4c')]({'where':{'id':_0x2dc5ef[_0xc381('0x44')]['id']}})['then'](handleEntityNotFound(_0x321578,null))[_0xc381('0x23')](function(_0x4d2a57){if(_0x4d2a57){_0x306716=_0x4d2a57;_0x5142ee['model']=_[_0xc381('0x2f')](db[_0xc381('0x4d')][_0xc381('0x45')]);_0x5142ee[_0xc381('0x2e')]=_[_0xc381('0x2f')](_0x2dc5ef[_0xc381('0x2e')]);_0x5142ee[_0xc381('0x30')]=_[_0xc381('0x31')](_0x5142ee['model'],_0x5142ee[_0xc381('0x2e')]);_0x1a5d49['attributes']=_[_0xc381('0x31')](_0x5142ee[_0xc381('0x32')],qs[_0xc381('0x34')](_0x2dc5ef[_0xc381('0x2e')]['fields']));_0x1a5d49[_0xc381('0x33')]=_0x1a5d49[_0xc381('0x33')][_0xc381('0x35')]?_0x1a5d49['attributes']:_0x5142ee['model'];_0x1a5d49[_0xc381('0x38')]=qs[_0xc381('0x39')](_0x2dc5ef['query'][_0xc381('0x39')]);_0x1a5d49[_0xc381('0x3a')]=qs[_0xc381('0x30')](_[_0xc381('0x3b')](_0x2dc5ef[_0xc381('0x2e')],_0x5142ee['filters']));if(_0x2dc5ef[_0xc381('0x2e')]['filter']){_0x1a5d49[_0xc381('0x3a')]=_[_0xc381('0x3d')](_0x1a5d49[_0xc381('0x3a')],{'$or':_[_0xc381('0x29')](_0x1a5d49[_0xc381('0x33')],function(_0x4afa33){var _0x481426={};_0x481426[_0x4afa33]={'$like':'%'+_0x2dc5ef[_0xc381('0x2e')][_0xc381('0x3c')]+'%'};return _0x481426;})});}_0x1a5d49=_[_0xc381('0x3d')]({},_0x1a5d49,_0x2dc5ef[_0xc381('0x3f')]);return _0x306716[_0xc381('0x4b')](_0x1a5d49);}})[_0xc381('0x23')](function(_0x10681b){if(_0x10681b){_0x5b828f=_0x10681b['length'];if(!_0x2dc5ef['query']['hasOwnProperty'](_0xc381('0x37'))){_0x1a5d49[_0xc381('0x1c')]=qs[_0xc381('0x1c')](_0x2dc5ef[_0xc381('0x2e')][_0xc381('0x1c')]);_0x1a5d49[_0xc381('0x1a')]=qs[_0xc381('0x1a')](_0x2dc5ef[_0xc381('0x2e')][_0xc381('0x1a')]);}return _0x306716['getConfigurations'](_0x1a5d49);}})[_0xc381('0x23')](function(_0x2bb22c){if(_0x2bb22c){return _0x2bb22c?{'count':_0x5b828f,'rows':_0x2bb22c}:null;}})[_0xc381('0x23')](respondWithResult(_0x321578,null))[_0xc381('0x43')](handleError(_0x321578,null));};exports[_0xc381('0x4e')]=function(_0x3e3b88,_0x249f63,_0x5e5c7e){if(_0x3e3b88[_0xc381('0x49')]['id']){delete _0x3e3b88['body']['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x3e3b88[_0xc381('0x44')]['id']}})[_0xc381('0x23')](handleEntityNotFound(_0x249f63,null))[_0xc381('0x23')](function(_0x512bf8){if(_0x512bf8){_0x3e3b88[_0xc381('0x49')]['AccountId']=_0x512bf8['id'];_0x3e3b88[_0xc381('0x49')][_0xc381('0x4f')]=integrations[_0xc381('0x50')](_0x3e3b88['body'][_0xc381('0x51')],_0x3e3b88['body'][_0xc381('0x2c')]);_0x3e3b88[_0xc381('0x49')][_0xc381('0x52')]=integrations[_0xc381('0x53')](_0x3e3b88['body'][_0xc381('0x51')],_0x3e3b88[_0xc381('0x49')][_0xc381('0x2c')]);return db[_0xc381('0x4d')][_0xc381('0x48')](_0x3e3b88[_0xc381('0x49')],{'include':[{'model':db[_0xc381('0x54')],'as':'Subjects'},{'model':db[_0xc381('0x54')],'as':_0xc381('0x52')}]});}return null;})[_0xc381('0x23')](respondWithResult(_0x249f63,null))['catch'](handleError(_0x249f63,null));};exports[_0xc381('0x55')]=function(_0x2053c8,_0x4555e2,_0x125cef){var _0x48b837='';var _0x150680=['id',_0xc381('0x27'),_0xc381('0x56'),_0xc381('0x57'),'description','date_start',_0xc381('0x58'),_0xc381('0x59'),_0xc381('0x5a'),_0xc381('0x5b'),'parent_name',_0xc381('0x5c')];return db[_0xc381('0x2a')][_0xc381('0x4c')]({'where':{'id':_0x2053c8[_0xc381('0x44')]['id']},'attributes':['id',_0xc381('0x5d'),_0xc381('0x5e'),_0xc381('0x5f')]})[_0xc381('0x23')](handleEntityNotFound(_0x4555e2,null))['then'](function(_0x1d3228){if(_0x1d3228){_0x48b837=_0x1d3228['remoteUri'];var _0x148d8b=_0x48b837['slice'](-0x1);if(_0x148d8b==='/'){_0x48b837=_0x48b837[_0xc381('0x60')](0x0,_0x48b837[_0xc381('0x61')](_0x148d8b));}return rp({'method':_0xc381('0x62'),'uri':util[_0xc381('0x63')]('%s%s',_0x48b837,_0xc381('0x64')),'json':!![],'form':{'method':'login','input_type':_0xc381('0x65'),'response_type':'JSON','rest_data':JSON[_0xc381('0x66')]({'user_auth':{'user_name':_0x1d3228[_0xc381('0x5d')],'password':_0x1d3228[_0xc381('0x5e')],'encryption':_0xc381('0x67')},'application':_0xc381('0x68')})}});}})[_0xc381('0x23')](function(_0x520063){if(_0x520063&&_0x520063[_0xc381('0x27')]!=='Invalid\x20Login'&&_0x520063[_0xc381('0x27')]!==_0xc381('0x69')){return rp({'method':_0xc381('0x62'),'uri':util['format'](_0xc381('0x6a'),_0x48b837,_0xc381('0x64')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xc381('0x65'),'response_type':_0xc381('0x65'),'rest_data':JSON[_0xc381('0x66')]({'session':_0x520063['id'],'module_name':_0xc381('0x6b')})}})[_0xc381('0x23')](function(_0x4c1f56){if(_0x4c1f56){var _0x137d6c=_[_0xc381('0x6c')](_0x4c1f56['module_fields']);_[_0xc381('0x6d')](_0x137d6c,function(_0x11a3ac){return _0x150680[_0xc381('0x6e')](_0x11a3ac[_0xc381('0x27')]);});return{'count':_0x137d6c[_0xc381('0x35')],'rows':_[_0xc381('0x29')](_0x137d6c,function(_0x5945de){return{'id':_0x5945de['name'],'name':_0x5945de[_0xc381('0x6f')],'custom':_[_0xc381('0x70')](_0x5945de['name'],'_c')?!![]:![],'options':_0x5945de[_0xc381('0x3f')]?_[_0xc381('0x29')](_[_0xc381('0x6c')](_0x5945de[_0xc381('0x3f')]),function(_0x5804da){return{'name':_0x5804da['value'],'value':_0x5804da[_0xc381('0x27')]};}):[]};})};}})[_0xc381('0x23')](respondWithResult(_0x4555e2,null))[_0xc381('0x43')](function(_0x16b807){var _0x5a7994=_0x2053c8[_0xc381('0x2e')][_0xc381('0x71')]?0x1f4:_0x16b807['statusCode']||0x1f4;logger[_0xc381('0x25')](_0xc381('0x72'),_0xc381('0x55'),_0x5a7994,JSON[_0xc381('0x66')](_0x16b807));delete _0x16b807[_0xc381('0x27')];if(_0x5a7994===0x191){_0x5a7994=0x190;}_0x4555e2[_0xc381('0x18')](_0x5a7994)[_0xc381('0x73')](_0x2053c8['query'][_0xc381('0x71')]?{'message':_0xc381('0x74'),'statusCode':_0x16b807['statusCode']}:_0x16b807);});}else{var _0x2f9485=0x1f4;_0x4555e2[_0xc381('0x18')](_0x2f9485)[_0xc381('0x73')]({'message':'Wrong\x20credentials','statusCode':0x190});}});};
\ No newline at end of file
+var _0xb38a=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','SugarcrmAccount','includeAll','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','pick','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','Calls','values','module_fields','remove','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0xb1d93c,_0x158b59){var _0x6e188a=function(_0x124f45){while(--_0x124f45){_0xb1d93c['push'](_0xb1d93c['shift']());}};_0x6e188a(++_0x158b59);}(_0xb38a,0x77));var _0xab38=function(_0x2aee34,_0x5bf8d6){_0x2aee34=_0x2aee34-0x0;var _0x57f0a9=_0xb38a[_0x2aee34];return _0x57f0a9;};'use strict';var emlformat=require(_0xab38('0x0'));var rimraf=require(_0xab38('0x1'));var zipdir=require(_0xab38('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xab38('0x3'));var BPromise=require(_0xab38('0x4'));var Mustache=require(_0xab38('0x5'));var util=require(_0xab38('0x6'));var path=require(_0xab38('0x7'));var sox=require('sox');var csv=require(_0xab38('0x8'));var ejs=require(_0xab38('0x9'));var fs=require('fs');var fs_extra=require(_0xab38('0xa'));var _=require('lodash');var squel=require(_0xab38('0xb'));var crypto=require(_0xab38('0xc'));var jsforce=require(_0xab38('0xd'));var deskjs=require(_0xab38('0xe'));var toCsv=require('to-csv');var querystring=require(_0xab38('0xf'));var Papa=require(_0xab38('0x10'));var Redis=require(_0xab38('0x11'));var authService=require(_0xab38('0x12'));var qs=require(_0xab38('0x13'));var as=require(_0xab38('0x14'));var hardwareService=require(_0xab38('0x15'));var logger=require(_0xab38('0x16'))(_0xab38('0x17'));var utils=require(_0xab38('0x18'));var config=require(_0xab38('0x19'));var licenseUtil=require(_0xab38('0x1a'));var db=require(_0xab38('0x1b'))['db'];var integrations=require(_0xab38('0x1c'));function respondWithStatusCode(_0x2d4600,_0x486235){_0x486235=_0x486235||0xcc;return function(_0x1a7cc8){if(_0x1a7cc8){return _0x2d4600[_0xab38('0x1d')](_0x486235);}return _0x2d4600[_0xab38('0x1e')](_0x486235)[_0xab38('0x1f')]();};}function respondWithResult(_0x536964,_0x6cccb7){_0x6cccb7=_0x6cccb7||0xc8;return function(_0x37033b){if(_0x37033b){return _0x536964[_0xab38('0x1e')](_0x6cccb7)[_0xab38('0x20')](_0x37033b);}};}function respondWithFilteredResult(_0x194ea8,_0x4f4be2){return function(_0x2a6c5d){if(_0x2a6c5d){var _0x2206c0=typeof _0x4f4be2[_0xab38('0x21')]==='undefined'&&typeof _0x4f4be2[_0xab38('0x22')]===_0xab38('0x23');var _0x512de5=_0x2a6c5d[_0xab38('0x24')];var _0x495980=_0x2206c0?0x0:_0x4f4be2[_0xab38('0x21')];var _0x4e6a92=_0x2206c0?_0x2a6c5d['count']:_0x4f4be2[_0xab38('0x21')]+_0x4f4be2[_0xab38('0x22')];var _0x106dbf;if(_0x4e6a92>=_0x512de5){_0x4e6a92=_0x512de5;_0x106dbf=0xc8;}else{_0x106dbf=0xce;}_0x194ea8[_0xab38('0x1e')](_0x106dbf);return _0x194ea8[_0xab38('0x25')]('Content-Range',_0x495980+'-'+_0x4e6a92+'/'+_0x512de5)[_0xab38('0x20')](_0x2a6c5d);}return null;};}function patchUpdates(_0x4f721c){return function(_0x756873){try{jsonpatch[_0xab38('0x26')](_0x756873,_0x4f721c,!![]);}catch(_0x4c4b05){return BPromise[_0xab38('0x27')](_0x4c4b05);}return _0x756873[_0xab38('0x28')]();};}function saveUpdates(_0x379d8b,_0x289743){return function(_0x45fd18){if(_0x45fd18){return _0x45fd18[_0xab38('0x29')](_0x379d8b)[_0xab38('0x2a')](function(_0x4ac34c){return _0x4ac34c;});}return null;};}function removeEntity(_0x54e28f,_0x449192){return function(_0x455474){if(_0x455474){return _0x455474[_0xab38('0x2b')]()['then'](function(){_0x54e28f[_0xab38('0x1e')](0xcc)[_0xab38('0x1f')]();});}};}function handleEntityNotFound(_0xe84a9a,_0x45f787){return function(_0x15de43){if(!_0x15de43){_0xe84a9a['sendStatus'](0x194);}return _0x15de43;};}function handleError(_0xabea06,_0x21ebe5){_0x21ebe5=_0x21ebe5||0x1f4;return function(_0x136d2a){logger[_0xab38('0x2c')](_0x136d2a[_0xab38('0x2d')]);if(_0x136d2a[_0xab38('0x2e')]){delete _0x136d2a[_0xab38('0x2e')];}_0xabea06['status'](_0x21ebe5)[_0xab38('0x2f')](_0x136d2a);};}exports[_0xab38('0x30')]=function(_0x5b5a4a,_0x9f37b8){var _0x363ea0={},_0x126fac={},_0x104a21={'count':0x0,'rows':[]};var _0x1c33a1=_[_0xab38('0x31')](db['SugarcrmAccount']['rawAttributes'],function(_0x156395){return{'name':_0x156395['fieldName'],'type':_0x156395[_0xab38('0x32')][_0xab38('0x33')]};});_0x126fac['model']=_[_0xab38('0x31')](_0x1c33a1,_0xab38('0x2e'));_0x126fac[_0xab38('0x34')]=_[_0xab38('0x35')](_0x5b5a4a['query']);_0x126fac['filters']=_[_0xab38('0x36')](_0x126fac[_0xab38('0x37')],_0x126fac[_0xab38('0x34')]);_0x363ea0['attributes']=_['intersection'](_0x126fac[_0xab38('0x37')],qs[_0xab38('0x38')](_0x5b5a4a[_0xab38('0x34')][_0xab38('0x38')]));_0x363ea0['attributes']=_0x363ea0[_0xab38('0x39')][_0xab38('0x3a')]?_0x363ea0['attributes']:_0x126fac[_0xab38('0x37')];if(!_0x5b5a4a['query'][_0xab38('0x3b')](_0xab38('0x3c'))){_0x363ea0[_0xab38('0x22')]=qs[_0xab38('0x22')](_0x5b5a4a[_0xab38('0x34')]['limit']);_0x363ea0[_0xab38('0x21')]=qs[_0xab38('0x21')](_0x5b5a4a[_0xab38('0x34')][_0xab38('0x21')]);}_0x363ea0[_0xab38('0x3d')]=qs[_0xab38('0x3e')](_0x5b5a4a[_0xab38('0x34')]['sort']);_0x363ea0[_0xab38('0x3f')]=qs['filters'](_['pick'](_0x5b5a4a[_0xab38('0x34')],_0x126fac[_0xab38('0x40')]),_0x1c33a1);if(_0x5b5a4a['query'][_0xab38('0x41')]){_0x363ea0[_0xab38('0x3f')]=_[_0xab38('0x42')](_0x363ea0[_0xab38('0x3f')],{'$or':_[_0xab38('0x31')](_0x1c33a1,function(_0x58636f){if(_0x58636f[_0xab38('0x32')]!==_0xab38('0x43')){var _0x3a42a5={};_0x3a42a5[_0x58636f[_0xab38('0x2e')]]={'$like':'%'+_0x5b5a4a[_0xab38('0x34')]['filter']+'%'};return _0x3a42a5;}})});}_0x363ea0=_[_0xab38('0x42')]({},_0x363ea0,_0x5b5a4a[_0xab38('0x44')]);var _0x2b626d={'where':_0x363ea0[_0xab38('0x3f')]};return db[_0xab38('0x45')]['count'](_0x2b626d)[_0xab38('0x2a')](function(_0x2c70c3){_0x104a21[_0xab38('0x24')]=_0x2c70c3;if(_0x5b5a4a[_0xab38('0x34')][_0xab38('0x46')]){_0x363ea0['include']=[{'all':!![]}];}return db[_0xab38('0x45')][_0xab38('0x47')](_0x363ea0);})[_0xab38('0x2a')](function(_0x7103f8){_0x104a21[_0xab38('0x48')]=_0x7103f8;return _0x104a21;})[_0xab38('0x2a')](respondWithFilteredResult(_0x9f37b8,_0x363ea0))[_0xab38('0x49')](handleError(_0x9f37b8,null));};exports[_0xab38('0x4a')]=function(_0x12084d,_0x49bcd9){var _0x46d7fb={'raw':![],'where':{'id':_0x12084d[_0xab38('0x4b')]['id']}},_0x6a13aa={};_0x6a13aa[_0xab38('0x37')]=_[_0xab38('0x35')](db[_0xab38('0x45')]['rawAttributes']);_0x6a13aa[_0xab38('0x34')]=_[_0xab38('0x35')](_0x12084d[_0xab38('0x34')]);_0x6a13aa['filters']=_[_0xab38('0x36')](_0x6a13aa[_0xab38('0x37')],_0x6a13aa[_0xab38('0x34')]);_0x46d7fb[_0xab38('0x39')]=_[_0xab38('0x36')](_0x6a13aa[_0xab38('0x37')],qs[_0xab38('0x38')](_0x12084d[_0xab38('0x34')][_0xab38('0x38')]));_0x46d7fb[_0xab38('0x39')]=_0x46d7fb[_0xab38('0x39')][_0xab38('0x3a')]?_0x46d7fb['attributes']:_0x6a13aa[_0xab38('0x37')];if(_0x12084d[_0xab38('0x34')]['includeAll']){_0x46d7fb['include']=[{'all':!![]}];}_0x46d7fb=_['merge']({},_0x46d7fb,_0x12084d['options']);return db[_0xab38('0x45')][_0xab38('0x4c')](_0x46d7fb)[_0xab38('0x2a')](handleEntityNotFound(_0x49bcd9,null))[_0xab38('0x2a')](respondWithResult(_0x49bcd9,null))[_0xab38('0x49')](handleError(_0x49bcd9,null));};exports[_0xab38('0x4d')]=function(_0x4b0866,_0x5e3465){return db[_0xab38('0x45')][_0xab38('0x4d')](_0x4b0866[_0xab38('0x4e')],{})[_0xab38('0x2a')](respondWithResult(_0x5e3465,0xc9))['catch'](handleError(_0x5e3465,null));};exports[_0xab38('0x29')]=function(_0x5198f3,_0x15d188){if(_0x5198f3[_0xab38('0x4e')]['id']){delete _0x5198f3[_0xab38('0x4e')]['id'];}return db[_0xab38('0x45')][_0xab38('0x4c')]({'where':{'id':_0x5198f3['params']['id']}})[_0xab38('0x2a')](handleEntityNotFound(_0x15d188,null))[_0xab38('0x2a')](saveUpdates(_0x5198f3[_0xab38('0x4e')],null))[_0xab38('0x2a')](respondWithResult(_0x15d188,null))[_0xab38('0x49')](handleError(_0x15d188,null));};exports['destroy']=function(_0x491b8e,_0x924f97){return db[_0xab38('0x45')][_0xab38('0x4c')]({'where':{'id':_0x491b8e['params']['id']}})[_0xab38('0x2a')](handleEntityNotFound(_0x924f97,null))[_0xab38('0x2a')](removeEntity(_0x924f97,null))[_0xab38('0x49')](handleError(_0x924f97,null));};exports[_0xab38('0x4f')]=function(_0x686cbd,_0x1fd3d2,_0x4eeb72){var _0x15323c={};var _0x1e8c05={};var _0x1dd3ff;var _0x47c7a2;return db[_0xab38('0x45')][_0xab38('0x50')]({'where':{'id':_0x686cbd['params']['id']}})[_0xab38('0x2a')](handleEntityNotFound(_0x1fd3d2,null))[_0xab38('0x2a')](function(_0x45b845){if(_0x45b845){_0x1dd3ff=_0x45b845;_0x1e8c05['model']=_[_0xab38('0x35')](db[_0xab38('0x51')]['rawAttributes']);_0x1e8c05[_0xab38('0x34')]=_[_0xab38('0x35')](_0x686cbd[_0xab38('0x34')]);_0x1e8c05['filters']=_[_0xab38('0x36')](_0x1e8c05[_0xab38('0x37')],_0x1e8c05[_0xab38('0x34')]);_0x15323c[_0xab38('0x39')]=_[_0xab38('0x36')](_0x1e8c05[_0xab38('0x37')],qs[_0xab38('0x38')](_0x686cbd['query'][_0xab38('0x38')]));_0x15323c[_0xab38('0x39')]=_0x15323c[_0xab38('0x39')][_0xab38('0x3a')]?_0x15323c[_0xab38('0x39')]:_0x1e8c05[_0xab38('0x37')];_0x15323c[_0xab38('0x3d')]=qs[_0xab38('0x3e')](_0x686cbd[_0xab38('0x34')][_0xab38('0x3e')]);_0x15323c[_0xab38('0x3f')]=qs[_0xab38('0x40')](_[_0xab38('0x52')](_0x686cbd[_0xab38('0x34')],_0x1e8c05[_0xab38('0x40')]));if(_0x686cbd['query']['filter']){_0x15323c['where']=_[_0xab38('0x42')](_0x15323c[_0xab38('0x3f')],{'$or':_[_0xab38('0x31')](_0x15323c[_0xab38('0x39')],function(_0x5a3e9f){var _0x5cb570={};_0x5cb570[_0x5a3e9f]={'$like':'%'+_0x686cbd[_0xab38('0x34')][_0xab38('0x41')]+'%'};return _0x5cb570;})});}_0x15323c=_[_0xab38('0x42')]({},_0x15323c,_0x686cbd[_0xab38('0x44')]);return _0x1dd3ff['getConfigurations'](_0x15323c);}})[_0xab38('0x2a')](function(_0x2b4ccf){if(_0x2b4ccf){_0x47c7a2=_0x2b4ccf[_0xab38('0x3a')];if(!_0x686cbd[_0xab38('0x34')]['hasOwnProperty'](_0xab38('0x3c'))){_0x15323c[_0xab38('0x22')]=qs['limit'](_0x686cbd['query']['limit']);_0x15323c[_0xab38('0x21')]=qs[_0xab38('0x21')](_0x686cbd[_0xab38('0x34')][_0xab38('0x21')]);}return _0x1dd3ff[_0xab38('0x4f')](_0x15323c);}})['then'](function(_0x5094c2){if(_0x5094c2){return _0x5094c2?{'count':_0x47c7a2,'rows':_0x5094c2}:null;}})['then'](respondWithResult(_0x1fd3d2,null))[_0xab38('0x49')](handleError(_0x1fd3d2,null));};exports['addConfiguration']=function(_0x1d4586,_0x5e5625,_0x1e30f4){if(_0x1d4586['body']['id']){delete _0x1d4586[_0xab38('0x4e')]['id'];}return db[_0xab38('0x45')][_0xab38('0x50')]({'where':{'id':_0x1d4586[_0xab38('0x4b')]['id']}})[_0xab38('0x2a')](handleEntityNotFound(_0x5e5625,null))[_0xab38('0x2a')](function(_0x56ea67){if(_0x56ea67){_0x1d4586[_0xab38('0x4e')][_0xab38('0x53')]=_0x56ea67['id'];_0x1d4586[_0xab38('0x4e')][_0xab38('0x54')]=integrations[_0xab38('0x55')](_0x1d4586['body'][_0xab38('0x56')],_0x1d4586[_0xab38('0x4e')][_0xab38('0x32')]);_0x1d4586[_0xab38('0x4e')]['Descriptions']=integrations[_0xab38('0x57')](_0x1d4586[_0xab38('0x4e')][_0xab38('0x56')],_0x1d4586['body']['type']);return db[_0xab38('0x51')][_0xab38('0x4d')](_0x1d4586[_0xab38('0x4e')],{'include':[{'model':db[_0xab38('0x58')],'as':'Subjects'},{'model':db[_0xab38('0x58')],'as':_0xab38('0x59')}]});}return null;})[_0xab38('0x2a')](respondWithResult(_0x5e5625,null))[_0xab38('0x49')](handleError(_0x5e5625,null));};exports[_0xab38('0x5a')]=function(_0xaf746b,_0x1e9b18,_0xd8325){var _0x429199='';var _0x184135=['id','name','assigned_user_id',_0xab38('0x5b'),_0xab38('0x5c'),_0xab38('0x5d'),_0xab38('0x5e'),_0xab38('0x5f'),'parent_id',_0xab38('0x60'),_0xab38('0x61'),_0xab38('0x62')];return db[_0xab38('0x45')][_0xab38('0x50')]({'where':{'id':_0xaf746b[_0xab38('0x4b')]['id']},'attributes':['id',_0xab38('0x63'),_0xab38('0x64'),_0xab38('0x65')]})['then'](handleEntityNotFound(_0x1e9b18,null))[_0xab38('0x2a')](function(_0x293bac){if(_0x293bac){_0x429199=_0x293bac[_0xab38('0x65')];var _0x4add4a=_0x429199[_0xab38('0x66')](-0x1);if(_0x4add4a==='/'){_0x429199=_0x429199[_0xab38('0x67')](0x0,_0x429199[_0xab38('0x68')](_0x4add4a));}return rp({'method':_0xab38('0x69'),'uri':util[_0xab38('0x6a')](_0xab38('0x6b'),_0x429199,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xab38('0x6c'),'input_type':_0xab38('0x6d'),'response_type':_0xab38('0x6d'),'rest_data':JSON[_0xab38('0x6e')]({'user_auth':{'user_name':_0x293bac[_0xab38('0x63')],'password':_0x293bac[_0xab38('0x64')],'encryption':_0xab38('0x6f')},'application':_0xab38('0x70')})}});}})[_0xab38('0x2a')](function(_0x4f30e9){if(_0x4f30e9&&_0x4f30e9['name']!==_0xab38('0x71')&&_0x4f30e9[_0xab38('0x2e')]!==_0xab38('0x72')){return rp({'method':_0xab38('0x69'),'uri':util['format']('%s%s',_0x429199,_0xab38('0x73')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xab38('0x6d'),'response_type':_0xab38('0x6d'),'rest_data':JSON[_0xab38('0x6e')]({'session':_0x4f30e9['id'],'module_name':_0xab38('0x74')})}})[_0xab38('0x2a')](function(_0xd6a482){if(_0xd6a482){var _0x204845=_[_0xab38('0x75')](_0xd6a482[_0xab38('0x76')]);_[_0xab38('0x77')](_0x204845,function(_0x1852f0){return _0x184135['includes'](_0x1852f0[_0xab38('0x2e')]);});return{'count':_0x204845[_0xab38('0x3a')],'rows':_[_0xab38('0x31')](_0x204845,function(_0x337c72){return{'id':_0x337c72[_0xab38('0x2e')],'name':_0x337c72[_0xab38('0x78')],'custom':_[_0xab38('0x79')](_0x337c72['name'],'_c')?!![]:![],'options':_0x337c72[_0xab38('0x44')]?_[_0xab38('0x31')](_[_0xab38('0x75')](_0x337c72['options']),function(_0x274ed0){return{'name':_0x274ed0[_0xab38('0x7a')],'value':_0x274ed0['name']};}):[]};})};}})[_0xab38('0x2a')](respondWithResult(_0x1e9b18,null))[_0xab38('0x49')](function(_0x5135f0){var _0x11b7c1=_0xaf746b[_0xab38('0x34')][_0xab38('0x7b')]?0x1f4:_0x5135f0[_0xab38('0x7c')]||0x1f4;logger[_0xab38('0x2c')](_0xab38('0x7d'),_0xab38('0x5a'),_0x11b7c1,JSON['stringify'](_0x5135f0));delete _0x5135f0['name'];if(_0x11b7c1===0x191){_0x11b7c1=0x190;}_0x1e9b18[_0xab38('0x1e')](_0x11b7c1)['send'](_0xaf746b[_0xab38('0x34')][_0xab38('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x5135f0[_0xab38('0x7c')]}:_0x5135f0);});}else{var _0x5029b4=0x1f4;_0x1e9b18[_0xab38('0x1e')](_0x5029b4)[_0xab38('0x2f')]({'message':_0xab38('0x7e'),'statusCode':0x190});}});};
\ No newline at end of file
index ca00708..9f82e94 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe4c0=['request-promise','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x114592,_0x42b7e0){var _0x35327e=function(_0xccdc21){while(--_0xccdc21){_0x114592['push'](_0x114592['shift']());}};_0x35327e(++_0x42b7e0);}(_0xe4c0,0x10c));var _0x0e4c=function(_0x43afbb,_0x448109){_0x43afbb=_0x43afbb-0x0;var _0xa9ddec=_0xe4c0[_0x43afbb];return _0xa9ddec;};'use strict';var _=require(_0x0e4c('0x0'));var util=require(_0x0e4c('0x1'));var logger=require(_0x0e4c('0x2'))(_0x0e4c('0x3'));var moment=require(_0x0e4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e4c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e4c('0x6'));var config=require('../../config/environment');var attributes=require(_0x0e4c('0x7'));var integrations=require(_0x0e4c('0x8'));module[_0x0e4c('0x9')]=function(_0x94230a,_0x34e32a){return _0x94230a[_0x0e4c('0xa')](_0x0e4c('0xb'),attributes,{'tableName':_0x0e4c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8eb7=['../../config/logger','api','bluebird','request-promise','path','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash'];(function(_0x4d4176,_0x3dd6a8){var _0x2947e8=function(_0x4b3057){while(--_0x4b3057){_0x4d4176['push'](_0x4d4176['shift']());}};_0x2947e8(++_0x3dd6a8);}(_0x8eb7,0xfb));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x78eb('0x0'));var util=require('util');var logger=require(_0x78eb('0x1'))(_0x78eb('0x2'));var moment=require('moment');var BPromise=require(_0x78eb('0x3'));var rp=require(_0x78eb('0x4'));var fs=require('fs');var path=require(_0x78eb('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x78eb('0x6'));var integrations=require(_0x78eb('0x7'));module[_0x78eb('0x8')]=function(_0x1b71ec,_0x468ffa){return _0x1b71ec[_0x78eb('0x9')](_0x78eb('0xa'),attributes,{'tableName':_0x78eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ff3763d..45ea2e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6334=['model','stringify','find','ShowSugarcrmAccount','catch','lodash','util','moment','ioredis','../../config/environment','jayson/promise','client','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x4ccc2c,_0x22c657){var _0x287125=function(_0x4b5b46){while(--_0x4b5b46){_0x4ccc2c['push'](_0x4ccc2c['shift']());}};_0x287125(++_0x22c657);}(_0x6334,0x12e));var _0x4633=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0x6334[_0x2fd69d];return _0x5d5ef3;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var moment=require(_0x4633('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4633('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4633('0x4'));var jayson=require(_0x4633('0x5'));var client=jayson[_0x4633('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22fd7c,_0x1ddde6,_0x1c5e7c){return new BPromise(function(_0x171cb2,_0x2e688a){return client[_0x4633('0x7')](_0x22fd7c,_0x1c5e7c)[_0x4633('0x8')](function(_0x31ba2c){logger['info'](_0x4633('0x9'),_0x1ddde6,_0x4633('0xa'));logger[_0x4633('0xb')](_0x4633('0xc'),_0x1ddde6,_0x4633('0xa'),JSON['stringify'](_0x31ba2c));if(_0x31ba2c[_0x4633('0xd')]){if(_0x31ba2c[_0x4633('0xd')][_0x4633('0xe')]===0x1f4){logger[_0x4633('0xd')](_0x4633('0x9'),_0x1ddde6,_0x31ba2c[_0x4633('0xd')]['message']);return _0x2e688a(_0x31ba2c[_0x4633('0xd')]['message']);}logger[_0x4633('0xd')](_0x4633('0x9'),_0x1ddde6,_0x31ba2c[_0x4633('0xd')]['message']);return _0x171cb2(_0x31ba2c[_0x4633('0xd')][_0x4633('0xf')]);}else{logger[_0x4633('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x1ddde6,'request\x20sent');_0x171cb2(_0x31ba2c[_0x4633('0x11')][_0x4633('0xf')]);}})['catch'](function(_0x3cd339){logger[_0x4633('0xd')](_0x4633('0x9'),_0x1ddde6,_0x3cd339);_0x2e688a(_0x3cd339);});});}exports[_0x4633('0x12')]=function(_0x4a96d7){var _0x48eba0=this;return new Promise(function(_0x340fa1,_0x237c80){return db[_0x4633('0x13')][_0x4633('0x14')]({'raw':_0x4a96d7['options']?_0x4a96d7[_0x4633('0x15')][_0x4633('0x16')]===undefined?!![]:![]:!![],'where':_0x4a96d7[_0x4633('0x15')]?_0x4a96d7[_0x4633('0x15')][_0x4633('0x17')]||null:null,'attributes':_0x4a96d7['options']?_0x4a96d7[_0x4633('0x15')][_0x4633('0x18')]||null:null,'limit':_0x4a96d7[_0x4633('0x15')]?_0x4a96d7['options'][_0x4633('0x19')]||null:null,'include':_0x4a96d7['options']?_0x4a96d7[_0x4633('0x15')][_0x4633('0x1a')]?_[_0x4633('0x1b')](_0x4a96d7['options'][_0x4633('0x1a')],function(_0x307b73){return{'model':db[_0x307b73[_0x4633('0x1c')]],'as':_0x307b73['as'],'attributes':_0x307b73['attributes'],'include':_0x307b73['include']?_[_0x4633('0x1b')](_0x307b73['include'],function(_0x2089c7){return{'model':db[_0x2089c7[_0x4633('0x1c')]],'as':_0x2089c7['as'],'attributes':_0x2089c7['attributes'],'include':_0x2089c7[_0x4633('0x1a')]?_[_0x4633('0x1b')](_0x2089c7[_0x4633('0x1a')],function(_0x4f72eb){return{'model':db[_0x4f72eb[_0x4633('0x1c')]],'as':_0x4f72eb['as'],'attributes':_0x4f72eb[_0x4633('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ca277){logger[_0x4633('0x10')](_0x4633('0x12'),_0x4a96d7);logger[_0x4633('0xb')](_0x4633('0x12'),_0x4a96d7,JSON[_0x4633('0x1d')](_0x1ca277));_0x340fa1(_0x1ca277);})['catch'](function(_0x3c7730){logger[_0x4633('0xd')](_0x4633('0x12'),_0x3c7730[_0x4633('0xf')],_0x4a96d7);_0x237c80(_0x48eba0['error'](0x1f4,_0x3c7730[_0x4633('0xf')]));});});};exports['ShowSugarcrmAccount']=function(_0x4a13f3){var _0xdefbef=this;return new Promise(function(_0x9c6804,_0x62aefd){return db[_0x4633('0x13')][_0x4633('0x1e')]({'raw':_0x4a13f3[_0x4633('0x15')]?_0x4a13f3['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a13f3[_0x4633('0x15')]?_0x4a13f3['options'][_0x4633('0x17')]||null:null,'attributes':_0x4a13f3['options']?_0x4a13f3[_0x4633('0x15')]['attributes']||null:null,'include':_0x4a13f3[_0x4633('0x15')]?_0x4a13f3[_0x4633('0x15')]['include']?_['map'](_0x4a13f3[_0x4633('0x15')]['include'],function(_0x3c4385){return{'model':db[_0x3c4385[_0x4633('0x1c')]],'as':_0x3c4385['as'],'attributes':_0x3c4385[_0x4633('0x18')],'include':_0x3c4385['include']?_[_0x4633('0x1b')](_0x3c4385[_0x4633('0x1a')],function(_0x49cbd7){return{'model':db[_0x49cbd7['model']],'as':_0x49cbd7['as'],'attributes':_0x49cbd7[_0x4633('0x18')],'include':_0x49cbd7['include']?_['map'](_0x49cbd7[_0x4633('0x1a')],function(_0x750d8b){return{'model':db[_0x750d8b[_0x4633('0x1c')]],'as':_0x750d8b['as'],'attributes':_0x750d8b[_0x4633('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4633('0x8')](function(_0x44c0ff){logger[_0x4633('0x10')](_0x4633('0x1f'),_0x4a13f3);logger[_0x4633('0xb')]('ShowSugarcrmAccount',_0x4a13f3,JSON[_0x4633('0x1d')](_0x44c0ff));_0x9c6804(_0x44c0ff);})[_0x4633('0x20')](function(_0x49b52f){logger[_0x4633('0xd')](_0x4633('0x1f'),_0x49b52f[_0x4633('0xf')],_0x4a13f3);_0x62aefd(_0xdefbef[_0x4633('0xd')](0x1f4,_0x49b52f[_0x4633('0xf')]));});});};
\ No newline at end of file
+var _0x8a14=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetSugarcrmAccount','findAll','options','raw','limit','include','map','model','attributes','SugarcrmAccount','find','where','ShowSugarcrmAccount','lodash','util'];(function(_0x5a69a0,_0x1df174){var _0x3560be=function(_0x16dc55){while(--_0x16dc55){_0x5a69a0['push'](_0x5a69a0['shift']());}};_0x3560be(++_0x1df174);}(_0x8a14,0xa8));var _0x48a1=function(_0x598d4a,_0x3872b7){_0x598d4a=_0x598d4a-0x0;var _0x9c8baa=_0x8a14[_0x598d4a];return _0x9c8baa;};'use strict';var _=require(_0x48a1('0x0'));var util=require(_0x48a1('0x1'));var moment=require('moment');var BPromise=require(_0x48a1('0x2'));var rs=require(_0x48a1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48a1('0x4'))['db'];var utils=require(_0x48a1('0x5'));var logger=require(_0x48a1('0x6'))(_0x48a1('0x7'));var config=require(_0x48a1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x48a1('0x9')][_0x48a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8f34f,_0x498ff7,_0x5090bc){return new BPromise(function(_0x1751f4,_0x339c23){return client[_0x48a1('0xb')](_0x8f34f,_0x5090bc)[_0x48a1('0xc')](function(_0x3b20f0){logger[_0x48a1('0xd')](_0x48a1('0xe'),_0x498ff7,'request\x20sent');logger[_0x48a1('0xf')](_0x48a1('0x10'),_0x498ff7,'request\x20sent',JSON[_0x48a1('0x11')](_0x3b20f0));if(_0x3b20f0['error']){if(_0x3b20f0['error']['code']===0x1f4){logger[_0x48a1('0x12')](_0x48a1('0xe'),_0x498ff7,_0x3b20f0['error']['message']);return _0x339c23(_0x3b20f0[_0x48a1('0x12')]['message']);}logger[_0x48a1('0x12')](_0x48a1('0xe'),_0x498ff7,_0x3b20f0[_0x48a1('0x12')][_0x48a1('0x13')]);return _0x1751f4(_0x3b20f0[_0x48a1('0x12')][_0x48a1('0x13')]);}else{logger[_0x48a1('0xd')](_0x48a1('0xe'),_0x498ff7,'request\x20sent');_0x1751f4(_0x3b20f0['result'][_0x48a1('0x13')]);}})[_0x48a1('0x14')](function(_0x1899c9){logger['error'](_0x48a1('0xe'),_0x498ff7,_0x1899c9);_0x339c23(_0x1899c9);});});}exports[_0x48a1('0x15')]=function(_0x4fbe90){var _0x25932f=this;return new Promise(function(_0x752d9b,_0x222460){return db['SugarcrmAccount'][_0x48a1('0x16')]({'raw':_0x4fbe90[_0x48a1('0x17')]?_0x4fbe90[_0x48a1('0x17')][_0x48a1('0x18')]===undefined?!![]:![]:!![],'where':_0x4fbe90['options']?_0x4fbe90[_0x48a1('0x17')]['where']||null:null,'attributes':_0x4fbe90[_0x48a1('0x17')]?_0x4fbe90['options']['attributes']||null:null,'limit':_0x4fbe90['options']?_0x4fbe90[_0x48a1('0x17')][_0x48a1('0x19')]||null:null,'include':_0x4fbe90[_0x48a1('0x17')]?_0x4fbe90['options'][_0x48a1('0x1a')]?_[_0x48a1('0x1b')](_0x4fbe90[_0x48a1('0x17')]['include'],function(_0x40c35f){return{'model':db[_0x40c35f[_0x48a1('0x1c')]],'as':_0x40c35f['as'],'attributes':_0x40c35f[_0x48a1('0x1d')],'include':_0x40c35f[_0x48a1('0x1a')]?_[_0x48a1('0x1b')](_0x40c35f[_0x48a1('0x1a')],function(_0x55c2ff){return{'model':db[_0x55c2ff[_0x48a1('0x1c')]],'as':_0x55c2ff['as'],'attributes':_0x55c2ff[_0x48a1('0x1d')],'include':_0x55c2ff['include']?_[_0x48a1('0x1b')](_0x55c2ff[_0x48a1('0x1a')],function(_0x318e02){return{'model':db[_0x318e02[_0x48a1('0x1c')]],'as':_0x318e02['as'],'attributes':_0x318e02[_0x48a1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34669c){logger[_0x48a1('0xd')](_0x48a1('0x15'),_0x4fbe90);logger[_0x48a1('0xf')](_0x48a1('0x15'),_0x4fbe90,JSON['stringify'](_0x34669c));_0x752d9b(_0x34669c);})['catch'](function(_0x4636c0){logger[_0x48a1('0x12')](_0x48a1('0x15'),_0x4636c0[_0x48a1('0x13')],_0x4fbe90);_0x222460(_0x25932f[_0x48a1('0x12')](0x1f4,_0x4636c0[_0x48a1('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x68230e){var _0x8b04b=this;return new Promise(function(_0x3e283a,_0x473433){return db[_0x48a1('0x1e')][_0x48a1('0x1f')]({'raw':_0x68230e['options']?_0x68230e[_0x48a1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x68230e[_0x48a1('0x17')]?_0x68230e[_0x48a1('0x17')][_0x48a1('0x20')]||null:null,'attributes':_0x68230e[_0x48a1('0x17')]?_0x68230e['options'][_0x48a1('0x1d')]||null:null,'include':_0x68230e[_0x48a1('0x17')]?_0x68230e[_0x48a1('0x17')][_0x48a1('0x1a')]?_[_0x48a1('0x1b')](_0x68230e[_0x48a1('0x17')][_0x48a1('0x1a')],function(_0x451f3a){return{'model':db[_0x451f3a['model']],'as':_0x451f3a['as'],'attributes':_0x451f3a[_0x48a1('0x1d')],'include':_0x451f3a[_0x48a1('0x1a')]?_[_0x48a1('0x1b')](_0x451f3a[_0x48a1('0x1a')],function(_0x1dc63b){return{'model':db[_0x1dc63b[_0x48a1('0x1c')]],'as':_0x1dc63b['as'],'attributes':_0x1dc63b[_0x48a1('0x1d')],'include':_0x1dc63b['include']?_[_0x48a1('0x1b')](_0x1dc63b[_0x48a1('0x1a')],function(_0xe8e7e5){return{'model':db[_0xe8e7e5[_0x48a1('0x1c')]],'as':_0xe8e7e5['as'],'attributes':_0xe8e7e5[_0x48a1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4eb081){logger[_0x48a1('0xd')](_0x48a1('0x21'),_0x68230e);logger[_0x48a1('0xf')](_0x48a1('0x21'),_0x68230e,JSON['stringify'](_0x4eb081));_0x3e283a(_0x4eb081);})[_0x48a1('0x14')](function(_0x3b75fa){logger[_0x48a1('0x12')](_0x48a1('0x21'),_0x3b75fa['message'],_0x68230e);_0x473433(_0x8b04b[_0x48a1('0x12')](0x1f4,_0x3b75fa[_0x48a1('0x13')]));});});};
\ No newline at end of file
index fd84cbb..fb58e31 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2a32=['destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/fields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update'];(function(_0x52a0fb,_0x49ae81){var _0x35225f=function(_0x450153){while(--_0x450153){_0x52a0fb['push'](_0x52a0fb['shift']());}};_0x35225f(++_0x49ae81);}(_0x2a32,0x172));var _0x22a3=function(_0x593d56,_0x10d793){_0x593d56=_0x593d56-0x0;var _0xb1c92c=_0x2a32[_0x593d56];return _0xb1c92c;};'use strict';var multer=require(_0x22a3('0x0'));var util=require(_0x22a3('0x1'));var path=require('path');var timeout=require(_0x22a3('0x2'));var express=require('express');var router=express[_0x22a3('0x3')]();var fs_extra=require(_0x22a3('0x4'));var auth=require(_0x22a3('0x5'));var interaction=require(_0x22a3('0x6'));var config=require(_0x22a3('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x22a3('0x8')]('/',auth['isAuthenticated'](),controller[_0x22a3('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x22a3('0xa')]);router[_0x22a3('0x8')](_0x22a3('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x22a3('0x8')](_0x22a3('0xc'),auth[_0x22a3('0xd')](),controller[_0x22a3('0xe')]);router['get'](_0x22a3('0xf'),auth[_0x22a3('0xd')](),controller[_0x22a3('0x10')]);router[_0x22a3('0x11')]('/',auth[_0x22a3('0xd')](),controller[_0x22a3('0x12')]);router['put'](_0x22a3('0x13'),auth[_0x22a3('0xd')](),controller[_0x22a3('0x14')]);router['delete'](_0x22a3('0x13'),auth[_0x22a3('0xd')](),controller[_0x22a3('0x15')]);module[_0x22a3('0x16')]=router;
\ No newline at end of file
+var _0xe469=['../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','show','getFields','/:id/subjects','getSubjects','getDescriptions','create','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x396b5f,_0x10760c){var _0x55a927=function(_0x493f10){while(--_0x493f10){_0x396b5f['push'](_0x396b5f['shift']());}};_0x55a927(++_0x10760c);}(_0xe469,0x109));var _0x9e46=function(_0x46d14b,_0x147907){_0x46d14b=_0x46d14b-0x0;var _0x367dfd=_0xe469[_0x46d14b];return _0x367dfd;};'use strict';var multer=require(_0x9e46('0x0'));var util=require(_0x9e46('0x1'));var path=require('path');var timeout=require(_0x9e46('0x2'));var express=require(_0x9e46('0x3'));var router=express[_0x9e46('0x4')]();var fs_extra=require(_0x9e46('0x5'));var auth=require(_0x9e46('0x6'));var interaction=require(_0x9e46('0x7'));var config=require(_0x9e46('0x8'));var controller=require(_0x9e46('0x9'));router[_0x9e46('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9e46('0xa')]('/:id',auth[_0x9e46('0xb')](),controller[_0x9e46('0xc')]);router[_0x9e46('0xa')]('/:id/fields',auth[_0x9e46('0xb')](),controller[_0x9e46('0xd')]);router['get'](_0x9e46('0xe'),auth[_0x9e46('0xb')](),controller[_0x9e46('0xf')]);router['get']('/:id/descriptions',auth[_0x9e46('0xb')](),controller[_0x9e46('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9e46('0x11')]);router['put'](_0x9e46('0x12'),auth[_0x9e46('0xb')](),controller['update']);router['delete'](_0x9e46('0x12'),auth[_0x9e46('0xb')](),controller[_0x9e46('0x13')]);module[_0x9e46('0x14')]=router;
\ No newline at end of file
index ccb9dfd..9437634 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2428=['STRING','exports'];(function(_0x133b18,_0x10ede2){var _0x221ed7=function(_0x8c85b){while(--_0x8c85b){_0x133b18['push'](_0x133b18['shift']());}};_0x221ed7(++_0x10ede2);}(_0x2428,0x185));var _0x8242=function(_0x70398a,_0x5c6e47){_0x70398a=_0x70398a-0x0;var _0x47b0e8=_0x2428[_0x70398a];return _0x47b0e8;};'use strict';var Sequelize=require('sequelize');module[_0x8242('0x0')]={'name':{'type':Sequelize[_0x8242('0x1')]},'description':{'type':Sequelize[_0x8242('0x1')]}};
\ No newline at end of file
+var _0xe68c=['sequelize','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe68c,0x172));var _0xce68=function(_0x25b65e,_0x4d0a81){_0x25b65e=_0x25b65e-0x0;var _0x4fffb0=_0xe68c[_0x25b65e];return _0x4fffb0;};'use strict';var Sequelize=require(_0xce68('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xce68('0x1')]}};
\ No newline at end of file
index e9e1c62..99f4bb8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x75ec=['getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','SugarcrmConfiguration','includeAll','findAll','catch','show','params','keys','include','create','body','find','destroy','getFields','findOne','SugarcrmField','getSubjects'];(function(_0x25b40d,_0x59be14){var _0x475280=function(_0x37df61){while(--_0x37df61){_0x25b40d['push'](_0x25b40d['shift']());}};_0x475280(++_0x59be14);}(_0x75ec,0x1ed));var _0xc75e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x75ec[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xc75e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc75e('0x1'));var jsonpatch=require(_0xc75e('0x2'));var rp=require(_0xc75e('0x3'));var moment=require(_0xc75e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc75e('0x5'));var path=require(_0xc75e('0x6'));var sox=require(_0xc75e('0x7'));var csv=require('to-csv');var ejs=require(_0xc75e('0x8'));var fs=require('fs');var fs_extra=require(_0xc75e('0x9'));var _=require(_0xc75e('0xa'));var squel=require(_0xc75e('0xb'));var crypto=require(_0xc75e('0xc'));var jsforce=require(_0xc75e('0xd'));var deskjs=require(_0xc75e('0xe'));var toCsv=require(_0xc75e('0xf'));var querystring=require(_0xc75e('0x10'));var Papa=require(_0xc75e('0x11'));var Redis=require(_0xc75e('0x12'));var authService=require(_0xc75e('0x13'));var qs=require(_0xc75e('0x14'));var as=require(_0xc75e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc75e('0x16'));var utils=require(_0xc75e('0x17'));var config=require(_0xc75e('0x18'));var licenseUtil=require(_0xc75e('0x19'));var db=require(_0xc75e('0x1a'))['db'];function respondWithStatusCode(_0x41b628,_0x6e9cb9){_0x6e9cb9=_0x6e9cb9||0xcc;return function(_0x1483a2){if(_0x1483a2){return _0x41b628[_0xc75e('0x1b')](_0x6e9cb9);}return _0x41b628['status'](_0x6e9cb9)['end']();};}function respondWithResult(_0x3cb43d,_0x57baa4){_0x57baa4=_0x57baa4||0xc8;return function(_0x366a4a){if(_0x366a4a){return _0x3cb43d[_0xc75e('0x1c')](_0x57baa4)[_0xc75e('0x1d')](_0x366a4a);}};}function respondWithFilteredResult(_0x4e97e9,_0x867094){return function(_0x58f790){if(_0x58f790){var _0x3eff19=typeof _0x867094[_0xc75e('0x1e')]===_0xc75e('0x1f')&&typeof _0x867094[_0xc75e('0x20')]==='undefined';var _0x24501a=_0x58f790[_0xc75e('0x21')];var _0x120e38=_0x3eff19?0x0:_0x867094[_0xc75e('0x1e')];var _0x2278f0=_0x3eff19?_0x58f790[_0xc75e('0x21')]:_0x867094['offset']+_0x867094['limit'];var _0x145060;if(_0x2278f0>=_0x24501a){_0x2278f0=_0x24501a;_0x145060=0xc8;}else{_0x145060=0xce;}_0x4e97e9[_0xc75e('0x1c')](_0x145060);return _0x4e97e9[_0xc75e('0x22')](_0xc75e('0x23'),_0x120e38+'-'+_0x2278f0+'/'+_0x24501a)[_0xc75e('0x1d')](_0x58f790);}return null;};}function patchUpdates(_0x236b63){return function(_0x59a2cd){try{jsonpatch[_0xc75e('0x24')](_0x59a2cd,_0x236b63,!![]);}catch(_0x5eb18d){return BPromise['reject'](_0x5eb18d);}return _0x59a2cd[_0xc75e('0x25')]();};}function saveUpdates(_0x4562b0,_0x259c2e){return function(_0x1216e7){if(_0x1216e7){return _0x1216e7[_0xc75e('0x26')](_0x4562b0)[_0xc75e('0x27')](function(_0x36028e){return _0x36028e;});}return null;};}function removeEntity(_0x49c35d,_0x433169){return function(_0x3d1097){if(_0x3d1097){return _0x3d1097['destroy']()[_0xc75e('0x27')](function(){_0x49c35d[_0xc75e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x596f03,_0x595dc){return function(_0x533c83){if(!_0x533c83){_0x596f03[_0xc75e('0x1b')](0x194);}return _0x533c83;};}function handleError(_0x439ff7,_0xb5794a){_0xb5794a=_0xb5794a||0x1f4;return function(_0x1d4036){logger[_0xc75e('0x28')](_0x1d4036[_0xc75e('0x29')]);if(_0x1d4036[_0xc75e('0x2a')]){delete _0x1d4036[_0xc75e('0x2a')];}_0x439ff7[_0xc75e('0x1c')](_0xb5794a)[_0xc75e('0x2b')](_0x1d4036);};}exports[_0xc75e('0x2c')]=function(_0x4335ad,_0x15dd00){var _0x1ecf4c={},_0x5d1fee={},_0x2e1f08={'count':0x0,'rows':[]};var _0x2e09c2=_[_0xc75e('0x2d')](db['SugarcrmConfiguration'][_0xc75e('0x2e')],function(_0x32ae78){return{'name':_0x32ae78['fieldName'],'type':_0x32ae78['type'][_0xc75e('0x2f')]};});_0x5d1fee[_0xc75e('0x30')]=_[_0xc75e('0x2d')](_0x2e09c2,_0xc75e('0x2a'));_0x5d1fee['query']=_['keys'](_0x4335ad['query']);_0x5d1fee[_0xc75e('0x31')]=_[_0xc75e('0x32')](_0x5d1fee[_0xc75e('0x30')],_0x5d1fee['query']);_0x1ecf4c[_0xc75e('0x33')]=_[_0xc75e('0x32')](_0x5d1fee[_0xc75e('0x30')],qs[_0xc75e('0x34')](_0x4335ad[_0xc75e('0x35')]['fields']));_0x1ecf4c['attributes']=_0x1ecf4c[_0xc75e('0x33')][_0xc75e('0x36')]?_0x1ecf4c[_0xc75e('0x33')]:_0x5d1fee[_0xc75e('0x30')];if(!_0x4335ad['query'][_0xc75e('0x37')](_0xc75e('0x38'))){_0x1ecf4c['limit']=qs['limit'](_0x4335ad[_0xc75e('0x35')][_0xc75e('0x20')]);_0x1ecf4c['offset']=qs[_0xc75e('0x1e')](_0x4335ad['query'][_0xc75e('0x1e')]);}_0x1ecf4c[_0xc75e('0x39')]=qs[_0xc75e('0x3a')](_0x4335ad[_0xc75e('0x35')][_0xc75e('0x3a')]);_0x1ecf4c[_0xc75e('0x3b')]=qs['filters'](_[_0xc75e('0x3c')](_0x4335ad[_0xc75e('0x35')],_0x5d1fee[_0xc75e('0x31')]),_0x2e09c2);if(_0x4335ad[_0xc75e('0x35')][_0xc75e('0x3d')]){_0x1ecf4c[_0xc75e('0x3b')]=_[_0xc75e('0x3e')](_0x1ecf4c[_0xc75e('0x3b')],{'$or':_[_0xc75e('0x2d')](_0x2e09c2,function(_0x5bdd97){if(_0x5bdd97[_0xc75e('0x3f')]!=='VIRTUAL'){var _0x105b7f={};_0x105b7f[_0x5bdd97[_0xc75e('0x2a')]]={'$like':'%'+_0x4335ad[_0xc75e('0x35')][_0xc75e('0x3d')]+'%'};return _0x105b7f;}})});}_0x1ecf4c=_[_0xc75e('0x3e')]({},_0x1ecf4c,_0x4335ad[_0xc75e('0x40')]);var _0x3eb1e1={'where':_0x1ecf4c[_0xc75e('0x3b')]};return db[_0xc75e('0x41')][_0xc75e('0x21')](_0x3eb1e1)['then'](function(_0x53ded0){_0x2e1f08[_0xc75e('0x21')]=_0x53ded0;if(_0x4335ad[_0xc75e('0x35')][_0xc75e('0x42')]){_0x1ecf4c['include']=[{'all':!![]}];}return db[_0xc75e('0x41')][_0xc75e('0x43')](_0x1ecf4c);})[_0xc75e('0x27')](function(_0xd793ae){_0x2e1f08['rows']=_0xd793ae;return _0x2e1f08;})[_0xc75e('0x27')](respondWithFilteredResult(_0x15dd00,_0x1ecf4c))[_0xc75e('0x44')](handleError(_0x15dd00,null));};exports[_0xc75e('0x45')]=function(_0x20ec9f,_0x5a60c6){var _0x31d513={'raw':![],'where':{'id':_0x20ec9f[_0xc75e('0x46')]['id']}},_0x3a93b6={};_0x3a93b6['model']=_[_0xc75e('0x47')](db['SugarcrmConfiguration'][_0xc75e('0x2e')]);_0x3a93b6[_0xc75e('0x35')]=_[_0xc75e('0x47')](_0x20ec9f[_0xc75e('0x35')]);_0x3a93b6[_0xc75e('0x31')]=_[_0xc75e('0x32')](_0x3a93b6['model'],_0x3a93b6[_0xc75e('0x35')]);_0x31d513[_0xc75e('0x33')]=_['intersection'](_0x3a93b6[_0xc75e('0x30')],qs[_0xc75e('0x34')](_0x20ec9f['query'][_0xc75e('0x34')]));_0x31d513['attributes']=_0x31d513[_0xc75e('0x33')][_0xc75e('0x36')]?_0x31d513[_0xc75e('0x33')]:_0x3a93b6['model'];if(_0x20ec9f['query'][_0xc75e('0x42')]){_0x31d513[_0xc75e('0x48')]=[{'all':!![]}];}_0x31d513=_[_0xc75e('0x3e')]({},_0x31d513,_0x20ec9f[_0xc75e('0x40')]);return db[_0xc75e('0x41')]['find'](_0x31d513)[_0xc75e('0x27')](handleEntityNotFound(_0x5a60c6,null))['then'](respondWithResult(_0x5a60c6,null))[_0xc75e('0x44')](handleError(_0x5a60c6,null));};exports[_0xc75e('0x49')]=function(_0x1fcf0e,_0x48d579){return db[_0xc75e('0x41')][_0xc75e('0x49')](_0x1fcf0e[_0xc75e('0x4a')],{})[_0xc75e('0x27')](respondWithResult(_0x48d579,0xc9))['catch'](handleError(_0x48d579,null));};exports['update']=function(_0x34aed3,_0x12ad73){if(_0x34aed3[_0xc75e('0x4a')]['id']){delete _0x34aed3[_0xc75e('0x4a')]['id'];}return db[_0xc75e('0x41')][_0xc75e('0x4b')]({'where':{'id':_0x34aed3['params']['id']}})[_0xc75e('0x27')](handleEntityNotFound(_0x12ad73,null))[_0xc75e('0x27')](saveUpdates(_0x34aed3[_0xc75e('0x4a')],null))[_0xc75e('0x27')](respondWithResult(_0x12ad73,null))[_0xc75e('0x44')](handleError(_0x12ad73,null));};exports[_0xc75e('0x4c')]=function(_0x34d779,_0x584d60){return db['SugarcrmConfiguration'][_0xc75e('0x4b')]({'where':{'id':_0x34d779[_0xc75e('0x46')]['id']}})[_0xc75e('0x27')](handleEntityNotFound(_0x584d60,null))[_0xc75e('0x27')](removeEntity(_0x584d60,null))['catch'](handleError(_0x584d60,null));};exports[_0xc75e('0x4d')]=function(_0x17383d,_0x14001d,_0x400b78){var _0x596f81={};var _0x21200c={};var _0x324475;var _0x4102c9;return db[_0xc75e('0x41')][_0xc75e('0x4e')]({'where':{'id':_0x17383d[_0xc75e('0x46')]['id']}})[_0xc75e('0x27')](handleEntityNotFound(_0x14001d,null))[_0xc75e('0x27')](function(_0x366330){if(_0x366330){_0x324475=_0x366330;_0x21200c[_0xc75e('0x30')]=_[_0xc75e('0x47')](db[_0xc75e('0x4f')][_0xc75e('0x2e')]);_0x21200c['query']=_[_0xc75e('0x47')](_0x17383d['query']);_0x21200c[_0xc75e('0x31')]=_['intersection'](_0x21200c[_0xc75e('0x30')],_0x21200c['query']);_0x596f81[_0xc75e('0x33')]=_[_0xc75e('0x32')](_0x21200c[_0xc75e('0x30')],qs[_0xc75e('0x34')](_0x17383d['query'][_0xc75e('0x34')]));_0x596f81[_0xc75e('0x33')]=_0x596f81[_0xc75e('0x33')][_0xc75e('0x36')]?_0x596f81['attributes']:_0x21200c[_0xc75e('0x30')];_0x596f81['order']=qs[_0xc75e('0x3a')](_0x17383d[_0xc75e('0x35')][_0xc75e('0x3a')]);_0x596f81[_0xc75e('0x3b')]=qs[_0xc75e('0x31')](_['pick'](_0x17383d[_0xc75e('0x35')],_0x21200c[_0xc75e('0x31')]));if(_0x17383d['query']['filter']){_0x596f81['where']=_[_0xc75e('0x3e')](_0x596f81['where'],{'$or':_[_0xc75e('0x2d')](_0x596f81['attributes'],function(_0x40f7db){var _0xcc9f80={};_0xcc9f80[_0x40f7db]={'$like':'%'+_0x17383d[_0xc75e('0x35')][_0xc75e('0x3d')]+'%'};return _0xcc9f80;})});}_0x596f81=_[_0xc75e('0x3e')]({},_0x596f81,_0x17383d[_0xc75e('0x40')]);return _0x324475['getFields'](_0x596f81);}})[_0xc75e('0x27')](function(_0x2e71d8){if(_0x2e71d8){_0x4102c9=_0x2e71d8[_0xc75e('0x36')];if(!_0x17383d[_0xc75e('0x35')][_0xc75e('0x37')]('nolimit')){_0x596f81[_0xc75e('0x20')]=qs[_0xc75e('0x20')](_0x17383d[_0xc75e('0x35')][_0xc75e('0x20')]);_0x596f81[_0xc75e('0x1e')]=qs[_0xc75e('0x1e')](_0x17383d[_0xc75e('0x35')][_0xc75e('0x1e')]);}return _0x324475[_0xc75e('0x4d')](_0x596f81);}})[_0xc75e('0x27')](function(_0x2fe58c){if(_0x2fe58c){return _0x2fe58c?{'count':_0x4102c9,'rows':_0x2fe58c}:null;}})[_0xc75e('0x27')](respondWithResult(_0x14001d,null))[_0xc75e('0x44')](handleError(_0x14001d,null));};exports[_0xc75e('0x50')]=function(_0x1d70cb,_0x2ad651,_0x3b4fa6){var _0x1a5b29={};var _0x191a0d={};var _0x57100a;var _0x11d960;return db[_0xc75e('0x41')][_0xc75e('0x4e')]({'where':{'id':_0x1d70cb[_0xc75e('0x46')]['id']}})[_0xc75e('0x27')](handleEntityNotFound(_0x2ad651,null))[_0xc75e('0x27')](function(_0x5d281e){if(_0x5d281e){_0x57100a=_0x5d281e;_0x191a0d['model']=_[_0xc75e('0x47')](db[_0xc75e('0x4f')]['rawAttributes']);_0x191a0d['query']=_['keys'](_0x1d70cb[_0xc75e('0x35')]);_0x191a0d[_0xc75e('0x31')]=_[_0xc75e('0x32')](_0x191a0d['model'],_0x191a0d[_0xc75e('0x35')]);_0x1a5b29[_0xc75e('0x33')]=_[_0xc75e('0x32')](_0x191a0d[_0xc75e('0x30')],qs[_0xc75e('0x34')](_0x1d70cb[_0xc75e('0x35')][_0xc75e('0x34')]));_0x1a5b29[_0xc75e('0x33')]=_0x1a5b29['attributes'][_0xc75e('0x36')]?_0x1a5b29[_0xc75e('0x33')]:_0x191a0d[_0xc75e('0x30')];_0x1a5b29[_0xc75e('0x39')]=qs[_0xc75e('0x3a')](_0x1d70cb[_0xc75e('0x35')][_0xc75e('0x3a')]);_0x1a5b29[_0xc75e('0x3b')]=qs[_0xc75e('0x31')](_[_0xc75e('0x3c')](_0x1d70cb['query'],_0x191a0d[_0xc75e('0x31')]));if(_0x1d70cb[_0xc75e('0x35')][_0xc75e('0x3d')]){_0x1a5b29[_0xc75e('0x3b')]=_['merge'](_0x1a5b29[_0xc75e('0x3b')],{'$or':_['map'](_0x1a5b29['attributes'],function(_0x1bef2d){var _0x1ea6fb={};_0x1ea6fb[_0x1bef2d]={'$like':'%'+_0x1d70cb[_0xc75e('0x35')]['filter']+'%'};return _0x1ea6fb;})});}_0x1a5b29=_[_0xc75e('0x3e')]({},_0x1a5b29,_0x1d70cb[_0xc75e('0x40')]);return _0x57100a[_0xc75e('0x50')](_0x1a5b29);}})[_0xc75e('0x27')](function(_0x2c6bc4){if(_0x2c6bc4){_0x11d960=_0x2c6bc4[_0xc75e('0x36')];if(!_0x1d70cb[_0xc75e('0x35')][_0xc75e('0x37')]('nolimit')){_0x1a5b29[_0xc75e('0x20')]=qs[_0xc75e('0x20')](_0x1d70cb['query'][_0xc75e('0x20')]);_0x1a5b29[_0xc75e('0x1e')]=qs[_0xc75e('0x1e')](_0x1d70cb['query']['offset']);}return _0x57100a['getSubjects'](_0x1a5b29);}})['then'](function(_0x53ad24){if(_0x53ad24){return _0x53ad24?{'count':_0x11d960,'rows':_0x53ad24}:null;}})['then'](respondWithResult(_0x2ad651,null))['catch'](handleError(_0x2ad651,null));};exports[_0xc75e('0x51')]=function(_0x418fd8,_0x45428a,_0x2fea6f){var _0x2679a9={};var _0xa2ee2c={};var _0x32f17c;var _0x34d30e;return db[_0xc75e('0x41')][_0xc75e('0x4e')]({'where':{'id':_0x418fd8[_0xc75e('0x46')]['id']}})['then'](handleEntityNotFound(_0x45428a,null))[_0xc75e('0x27')](function(_0x4b419b){if(_0x4b419b){_0x32f17c=_0x4b419b;_0xa2ee2c[_0xc75e('0x30')]=_['keys'](db[_0xc75e('0x4f')][_0xc75e('0x2e')]);_0xa2ee2c['query']=_[_0xc75e('0x47')](_0x418fd8[_0xc75e('0x35')]);_0xa2ee2c[_0xc75e('0x31')]=_[_0xc75e('0x32')](_0xa2ee2c[_0xc75e('0x30')],_0xa2ee2c[_0xc75e('0x35')]);_0x2679a9['attributes']=_[_0xc75e('0x32')](_0xa2ee2c[_0xc75e('0x30')],qs[_0xc75e('0x34')](_0x418fd8[_0xc75e('0x35')][_0xc75e('0x34')]));_0x2679a9[_0xc75e('0x33')]=_0x2679a9[_0xc75e('0x33')][_0xc75e('0x36')]?_0x2679a9[_0xc75e('0x33')]:_0xa2ee2c[_0xc75e('0x30')];_0x2679a9[_0xc75e('0x39')]=qs[_0xc75e('0x3a')](_0x418fd8[_0xc75e('0x35')][_0xc75e('0x3a')]);_0x2679a9[_0xc75e('0x3b')]=qs[_0xc75e('0x31')](_['pick'](_0x418fd8[_0xc75e('0x35')],_0xa2ee2c[_0xc75e('0x31')]));if(_0x418fd8['query'][_0xc75e('0x3d')]){_0x2679a9[_0xc75e('0x3b')]=_[_0xc75e('0x3e')](_0x2679a9[_0xc75e('0x3b')],{'$or':_[_0xc75e('0x2d')](_0x2679a9['attributes'],function(_0x607093){var _0x4b6929={};_0x4b6929[_0x607093]={'$like':'%'+_0x418fd8[_0xc75e('0x35')]['filter']+'%'};return _0x4b6929;})});}_0x2679a9=_[_0xc75e('0x3e')]({},_0x2679a9,_0x418fd8[_0xc75e('0x40')]);return _0x32f17c[_0xc75e('0x51')](_0x2679a9);}})[_0xc75e('0x27')](function(_0x583fd0){if(_0x583fd0){_0x34d30e=_0x583fd0[_0xc75e('0x36')];if(!_0x418fd8[_0xc75e('0x35')][_0xc75e('0x37')]('nolimit')){_0x2679a9['limit']=qs['limit'](_0x418fd8['query']['limit']);_0x2679a9[_0xc75e('0x1e')]=qs['offset'](_0x418fd8['query']['offset']);}return _0x32f17c['getDescriptions'](_0x2679a9);}})['then'](function(_0x5ca93d){if(_0x5ca93d){return _0x5ca93d?{'count':_0x34d30e,'rows':_0x5ca93d}:null;}})[_0xc75e('0x27')](respondWithResult(_0x45428a,null))['catch'](handleError(_0x45428a,null));};
\ No newline at end of file
+var _0x0424=['save','update','destroy','then','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','params','find','catch','create','body','getFields','SugarcrmField','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply'];(function(_0x234c66,_0x115e0e){var _0x378e12=function(_0x45cd73){while(--_0x45cd73){_0x234c66['push'](_0x234c66['shift']());}};_0x378e12(++_0x115e0e);}(_0x0424,0xd1));var _0x4042=function(_0x8d8917,_0x504e20){_0x8d8917=_0x8d8917-0x0;var _0x55bd93=_0x0424[_0x8d8917];return _0x55bd93;};'use strict';var emlformat=require(_0x4042('0x0'));var rimraf=require(_0x4042('0x1'));var zipdir=require(_0x4042('0x2'));var jsonpatch=require(_0x4042('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4042('0x4'));var Mustache=require('mustache');var util=require(_0x4042('0x5'));var path=require(_0x4042('0x6'));var sox=require(_0x4042('0x7'));var csv=require(_0x4042('0x8'));var ejs=require(_0x4042('0x9'));var fs=require('fs');var fs_extra=require(_0x4042('0xa'));var _=require(_0x4042('0xb'));var squel=require('squel');var crypto=require(_0x4042('0xc'));var jsforce=require(_0x4042('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4042('0x8'));var querystring=require(_0x4042('0xe'));var Papa=require(_0x4042('0xf'));var Redis=require(_0x4042('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4042('0x11'));var as=require(_0x4042('0x12'));var hardwareService=require(_0x4042('0x13'));var logger=require(_0x4042('0x14'))(_0x4042('0x15'));var utils=require(_0x4042('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4042('0x17'));var db=require(_0x4042('0x18'))['db'];function respondWithStatusCode(_0x5896c2,_0x54066e){_0x54066e=_0x54066e||0xcc;return function(_0x2543ed){if(_0x2543ed){return _0x5896c2[_0x4042('0x19')](_0x54066e);}return _0x5896c2[_0x4042('0x1a')](_0x54066e)[_0x4042('0x1b')]();};}function respondWithResult(_0x4e8f5b,_0x84f34d){_0x84f34d=_0x84f34d||0xc8;return function(_0x4983bb){if(_0x4983bb){return _0x4e8f5b['status'](_0x84f34d)[_0x4042('0x1c')](_0x4983bb);}};}function respondWithFilteredResult(_0xa4e629,_0x250067){return function(_0x59bf02){if(_0x59bf02){var _0x3e2d1b=typeof _0x250067[_0x4042('0x1d')]===_0x4042('0x1e')&&typeof _0x250067['limit']===_0x4042('0x1e');var _0x5c3e7d=_0x59bf02['count'];var _0x4c178d=_0x3e2d1b?0x0:_0x250067[_0x4042('0x1d')];var _0x315a3d=_0x3e2d1b?_0x59bf02['count']:_0x250067[_0x4042('0x1d')]+_0x250067[_0x4042('0x1f')];var _0x441e93;if(_0x315a3d>=_0x5c3e7d){_0x315a3d=_0x5c3e7d;_0x441e93=0xc8;}else{_0x441e93=0xce;}_0xa4e629[_0x4042('0x1a')](_0x441e93);return _0xa4e629[_0x4042('0x20')]('Content-Range',_0x4c178d+'-'+_0x315a3d+'/'+_0x5c3e7d)[_0x4042('0x1c')](_0x59bf02);}return null;};}function patchUpdates(_0x106d8b){return function(_0x32afd5){try{jsonpatch[_0x4042('0x21')](_0x32afd5,_0x106d8b,!![]);}catch(_0x6bb05f){return BPromise['reject'](_0x6bb05f);}return _0x32afd5[_0x4042('0x22')]();};}function saveUpdates(_0xd1625c,_0x5ca004){return function(_0x2cce1b){if(_0x2cce1b){return _0x2cce1b[_0x4042('0x23')](_0xd1625c)['then'](function(_0x1c7bdc){return _0x1c7bdc;});}return null;};}function removeEntity(_0x1e505f,_0x122c19){return function(_0x30ff58){if(_0x30ff58){return _0x30ff58[_0x4042('0x24')]()[_0x4042('0x25')](function(){_0x1e505f[_0x4042('0x1a')](0xcc)[_0x4042('0x1b')]();});}};}function handleEntityNotFound(_0x6cb0d2,_0x3c6c21){return function(_0x1d6172){if(!_0x1d6172){_0x6cb0d2[_0x4042('0x19')](0x194);}return _0x1d6172;};}function handleError(_0xb23fb4,_0x8bd06a){_0x8bd06a=_0x8bd06a||0x1f4;return function(_0x764dab){logger[_0x4042('0x26')](_0x764dab[_0x4042('0x27')]);if(_0x764dab[_0x4042('0x28')]){delete _0x764dab[_0x4042('0x28')];}_0xb23fb4['status'](_0x8bd06a)[_0x4042('0x29')](_0x764dab);};}exports[_0x4042('0x2a')]=function(_0x5884bf,_0x41c92b){var _0x44c4c5={},_0x11eb19={},_0x3ae3ab={'count':0x0,'rows':[]};var _0x2f2e0a=_[_0x4042('0x2b')](db[_0x4042('0x2c')][_0x4042('0x2d')],function(_0x44256d){return{'name':_0x44256d[_0x4042('0x2e')],'type':_0x44256d[_0x4042('0x2f')][_0x4042('0x30')]};});_0x11eb19[_0x4042('0x31')]=_[_0x4042('0x2b')](_0x2f2e0a,_0x4042('0x28'));_0x11eb19[_0x4042('0x32')]=_[_0x4042('0x33')](_0x5884bf['query']);_0x11eb19[_0x4042('0x34')]=_['intersection'](_0x11eb19[_0x4042('0x31')],_0x11eb19[_0x4042('0x32')]);_0x44c4c5['attributes']=_[_0x4042('0x35')](_0x11eb19[_0x4042('0x31')],qs[_0x4042('0x36')](_0x5884bf['query'][_0x4042('0x36')]));_0x44c4c5[_0x4042('0x37')]=_0x44c4c5[_0x4042('0x37')][_0x4042('0x38')]?_0x44c4c5[_0x4042('0x37')]:_0x11eb19[_0x4042('0x31')];if(!_0x5884bf[_0x4042('0x32')]['hasOwnProperty'](_0x4042('0x39'))){_0x44c4c5['limit']=qs['limit'](_0x5884bf[_0x4042('0x32')][_0x4042('0x1f')]);_0x44c4c5[_0x4042('0x1d')]=qs['offset'](_0x5884bf[_0x4042('0x32')][_0x4042('0x1d')]);}_0x44c4c5[_0x4042('0x3a')]=qs[_0x4042('0x3b')](_0x5884bf['query'][_0x4042('0x3b')]);_0x44c4c5[_0x4042('0x3c')]=qs['filters'](_[_0x4042('0x3d')](_0x5884bf[_0x4042('0x32')],_0x11eb19[_0x4042('0x34')]),_0x2f2e0a);if(_0x5884bf[_0x4042('0x32')][_0x4042('0x3e')]){_0x44c4c5[_0x4042('0x3c')]=_[_0x4042('0x3f')](_0x44c4c5[_0x4042('0x3c')],{'$or':_[_0x4042('0x2b')](_0x2f2e0a,function(_0x594834){if(_0x594834['type']!=='VIRTUAL'){var _0x4a41f2={};_0x4a41f2[_0x594834[_0x4042('0x28')]]={'$like':'%'+_0x5884bf[_0x4042('0x32')]['filter']+'%'};return _0x4a41f2;}})});}_0x44c4c5=_['merge']({},_0x44c4c5,_0x5884bf[_0x4042('0x40')]);var _0x14a5a9={'where':_0x44c4c5[_0x4042('0x3c')]};return db[_0x4042('0x2c')]['count'](_0x14a5a9)[_0x4042('0x25')](function(_0x5a7385){_0x3ae3ab[_0x4042('0x41')]=_0x5a7385;if(_0x5884bf['query'][_0x4042('0x42')]){_0x44c4c5[_0x4042('0x43')]=[{'all':!![]}];}return db[_0x4042('0x2c')][_0x4042('0x44')](_0x44c4c5);})['then'](function(_0x5af42b){_0x3ae3ab[_0x4042('0x45')]=_0x5af42b;return _0x3ae3ab;})[_0x4042('0x25')](respondWithFilteredResult(_0x41c92b,_0x44c4c5))['catch'](handleError(_0x41c92b,null));};exports['show']=function(_0x1e9641,_0x1228da){var _0x48c7a5={'raw':![],'where':{'id':_0x1e9641[_0x4042('0x46')]['id']}},_0x5545cb={};_0x5545cb[_0x4042('0x31')]=_[_0x4042('0x33')](db[_0x4042('0x2c')]['rawAttributes']);_0x5545cb['query']=_['keys'](_0x1e9641[_0x4042('0x32')]);_0x5545cb[_0x4042('0x34')]=_['intersection'](_0x5545cb[_0x4042('0x31')],_0x5545cb[_0x4042('0x32')]);_0x48c7a5[_0x4042('0x37')]=_[_0x4042('0x35')](_0x5545cb[_0x4042('0x31')],qs[_0x4042('0x36')](_0x1e9641['query'][_0x4042('0x36')]));_0x48c7a5['attributes']=_0x48c7a5[_0x4042('0x37')][_0x4042('0x38')]?_0x48c7a5[_0x4042('0x37')]:_0x5545cb[_0x4042('0x31')];if(_0x1e9641[_0x4042('0x32')][_0x4042('0x42')]){_0x48c7a5[_0x4042('0x43')]=[{'all':!![]}];}_0x48c7a5=_[_0x4042('0x3f')]({},_0x48c7a5,_0x1e9641[_0x4042('0x40')]);return db[_0x4042('0x2c')][_0x4042('0x47')](_0x48c7a5)[_0x4042('0x25')](handleEntityNotFound(_0x1228da,null))[_0x4042('0x25')](respondWithResult(_0x1228da,null))[_0x4042('0x48')](handleError(_0x1228da,null));};exports[_0x4042('0x49')]=function(_0x4df818,_0x287b2d){return db[_0x4042('0x2c')][_0x4042('0x49')](_0x4df818[_0x4042('0x4a')],{})['then'](respondWithResult(_0x287b2d,0xc9))[_0x4042('0x48')](handleError(_0x287b2d,null));};exports[_0x4042('0x23')]=function(_0x39c008,_0x463522){if(_0x39c008[_0x4042('0x4a')]['id']){delete _0x39c008['body']['id'];}return db[_0x4042('0x2c')][_0x4042('0x47')]({'where':{'id':_0x39c008['params']['id']}})['then'](handleEntityNotFound(_0x463522,null))[_0x4042('0x25')](saveUpdates(_0x39c008[_0x4042('0x4a')],null))['then'](respondWithResult(_0x463522,null))['catch'](handleError(_0x463522,null));};exports[_0x4042('0x24')]=function(_0x178113,_0x1649f6){return db[_0x4042('0x2c')][_0x4042('0x47')]({'where':{'id':_0x178113[_0x4042('0x46')]['id']}})[_0x4042('0x25')](handleEntityNotFound(_0x1649f6,null))[_0x4042('0x25')](removeEntity(_0x1649f6,null))['catch'](handleError(_0x1649f6,null));};exports[_0x4042('0x4b')]=function(_0x29605c,_0x55a7bc,_0x2633f4){var _0x2eb0dc={};var _0x5ed071={};var _0x6bd4cc;var _0x38c26e;return db[_0x4042('0x2c')]['findOne']({'where':{'id':_0x29605c[_0x4042('0x46')]['id']}})[_0x4042('0x25')](handleEntityNotFound(_0x55a7bc,null))[_0x4042('0x25')](function(_0x11db33){if(_0x11db33){_0x6bd4cc=_0x11db33;_0x5ed071[_0x4042('0x31')]=_[_0x4042('0x33')](db[_0x4042('0x4c')]['rawAttributes']);_0x5ed071[_0x4042('0x32')]=_[_0x4042('0x33')](_0x29605c[_0x4042('0x32')]);_0x5ed071['filters']=_[_0x4042('0x35')](_0x5ed071[_0x4042('0x31')],_0x5ed071[_0x4042('0x32')]);_0x2eb0dc[_0x4042('0x37')]=_[_0x4042('0x35')](_0x5ed071[_0x4042('0x31')],qs['fields'](_0x29605c[_0x4042('0x32')][_0x4042('0x36')]));_0x2eb0dc[_0x4042('0x37')]=_0x2eb0dc[_0x4042('0x37')][_0x4042('0x38')]?_0x2eb0dc[_0x4042('0x37')]:_0x5ed071[_0x4042('0x31')];_0x2eb0dc['order']=qs[_0x4042('0x3b')](_0x29605c[_0x4042('0x32')]['sort']);_0x2eb0dc[_0x4042('0x3c')]=qs['filters'](_['pick'](_0x29605c[_0x4042('0x32')],_0x5ed071[_0x4042('0x34')]));if(_0x29605c['query'][_0x4042('0x3e')]){_0x2eb0dc[_0x4042('0x3c')]=_[_0x4042('0x3f')](_0x2eb0dc['where'],{'$or':_['map'](_0x2eb0dc['attributes'],function(_0x4f02d2){var _0x3ec722={};_0x3ec722[_0x4f02d2]={'$like':'%'+_0x29605c[_0x4042('0x32')][_0x4042('0x3e')]+'%'};return _0x3ec722;})});}_0x2eb0dc=_[_0x4042('0x3f')]({},_0x2eb0dc,_0x29605c[_0x4042('0x40')]);return _0x6bd4cc['getFields'](_0x2eb0dc);}})[_0x4042('0x25')](function(_0x538be7){if(_0x538be7){_0x38c26e=_0x538be7[_0x4042('0x38')];if(!_0x29605c[_0x4042('0x32')][_0x4042('0x4d')](_0x4042('0x39'))){_0x2eb0dc[_0x4042('0x1f')]=qs['limit'](_0x29605c['query'][_0x4042('0x1f')]);_0x2eb0dc[_0x4042('0x1d')]=qs['offset'](_0x29605c[_0x4042('0x32')][_0x4042('0x1d')]);}return _0x6bd4cc['getFields'](_0x2eb0dc);}})[_0x4042('0x25')](function(_0x1b6470){if(_0x1b6470){return _0x1b6470?{'count':_0x38c26e,'rows':_0x1b6470}:null;}})['then'](respondWithResult(_0x55a7bc,null))[_0x4042('0x48')](handleError(_0x55a7bc,null));};exports[_0x4042('0x4e')]=function(_0xf3dc60,_0x178840,_0x6f0eda){var _0x544625={};var _0x31671e={};var _0x34c531;var _0x1f997a;return db['SugarcrmConfiguration'][_0x4042('0x4f')]({'where':{'id':_0xf3dc60[_0x4042('0x46')]['id']}})[_0x4042('0x25')](handleEntityNotFound(_0x178840,null))['then'](function(_0x210d39){if(_0x210d39){_0x34c531=_0x210d39;_0x31671e[_0x4042('0x31')]=_[_0x4042('0x33')](db[_0x4042('0x4c')][_0x4042('0x2d')]);_0x31671e[_0x4042('0x32')]=_[_0x4042('0x33')](_0xf3dc60[_0x4042('0x32')]);_0x31671e[_0x4042('0x34')]=_[_0x4042('0x35')](_0x31671e[_0x4042('0x31')],_0x31671e[_0x4042('0x32')]);_0x544625[_0x4042('0x37')]=_[_0x4042('0x35')](_0x31671e[_0x4042('0x31')],qs[_0x4042('0x36')](_0xf3dc60[_0x4042('0x32')][_0x4042('0x36')]));_0x544625[_0x4042('0x37')]=_0x544625[_0x4042('0x37')][_0x4042('0x38')]?_0x544625[_0x4042('0x37')]:_0x31671e['model'];_0x544625[_0x4042('0x3a')]=qs[_0x4042('0x3b')](_0xf3dc60[_0x4042('0x32')][_0x4042('0x3b')]);_0x544625[_0x4042('0x3c')]=qs[_0x4042('0x34')](_[_0x4042('0x3d')](_0xf3dc60[_0x4042('0x32')],_0x31671e['filters']));if(_0xf3dc60['query']['filter']){_0x544625['where']=_[_0x4042('0x3f')](_0x544625['where'],{'$or':_[_0x4042('0x2b')](_0x544625[_0x4042('0x37')],function(_0x74b755){var _0x102fe7={};_0x102fe7[_0x74b755]={'$like':'%'+_0xf3dc60[_0x4042('0x32')][_0x4042('0x3e')]+'%'};return _0x102fe7;})});}_0x544625=_[_0x4042('0x3f')]({},_0x544625,_0xf3dc60[_0x4042('0x40')]);return _0x34c531[_0x4042('0x4e')](_0x544625);}})['then'](function(_0x3832a6){if(_0x3832a6){_0x1f997a=_0x3832a6[_0x4042('0x38')];if(!_0xf3dc60['query']['hasOwnProperty']('nolimit')){_0x544625[_0x4042('0x1f')]=qs[_0x4042('0x1f')](_0xf3dc60['query'][_0x4042('0x1f')]);_0x544625['offset']=qs[_0x4042('0x1d')](_0xf3dc60['query']['offset']);}return _0x34c531['getSubjects'](_0x544625);}})['then'](function(_0x257544){if(_0x257544){return _0x257544?{'count':_0x1f997a,'rows':_0x257544}:null;}})['then'](respondWithResult(_0x178840,null))['catch'](handleError(_0x178840,null));};exports['getDescriptions']=function(_0x2c3fef,_0x5ab069,_0x3b5b83){var _0x247fcf={};var _0x28073f={};var _0x41a53c;var _0x3d2293;return db[_0x4042('0x2c')]['findOne']({'where':{'id':_0x2c3fef[_0x4042('0x46')]['id']}})[_0x4042('0x25')](handleEntityNotFound(_0x5ab069,null))['then'](function(_0x2a990e){if(_0x2a990e){_0x41a53c=_0x2a990e;_0x28073f['model']=_[_0x4042('0x33')](db[_0x4042('0x4c')]['rawAttributes']);_0x28073f[_0x4042('0x32')]=_[_0x4042('0x33')](_0x2c3fef[_0x4042('0x32')]);_0x28073f[_0x4042('0x34')]=_['intersection'](_0x28073f['model'],_0x28073f[_0x4042('0x32')]);_0x247fcf[_0x4042('0x37')]=_['intersection'](_0x28073f[_0x4042('0x31')],qs[_0x4042('0x36')](_0x2c3fef[_0x4042('0x32')][_0x4042('0x36')]));_0x247fcf['attributes']=_0x247fcf[_0x4042('0x37')]['length']?_0x247fcf[_0x4042('0x37')]:_0x28073f[_0x4042('0x31')];_0x247fcf['order']=qs[_0x4042('0x3b')](_0x2c3fef['query']['sort']);_0x247fcf[_0x4042('0x3c')]=qs[_0x4042('0x34')](_['pick'](_0x2c3fef['query'],_0x28073f[_0x4042('0x34')]));if(_0x2c3fef[_0x4042('0x32')][_0x4042('0x3e')]){_0x247fcf[_0x4042('0x3c')]=_[_0x4042('0x3f')](_0x247fcf[_0x4042('0x3c')],{'$or':_['map'](_0x247fcf[_0x4042('0x37')],function(_0x32b98e){var _0x45a177={};_0x45a177[_0x32b98e]={'$like':'%'+_0x2c3fef['query'][_0x4042('0x3e')]+'%'};return _0x45a177;})});}_0x247fcf=_[_0x4042('0x3f')]({},_0x247fcf,_0x2c3fef[_0x4042('0x40')]);return _0x41a53c[_0x4042('0x50')](_0x247fcf);}})['then'](function(_0x8e4047){if(_0x8e4047){_0x3d2293=_0x8e4047[_0x4042('0x38')];if(!_0x2c3fef['query'][_0x4042('0x4d')]('nolimit')){_0x247fcf['limit']=qs[_0x4042('0x1f')](_0x2c3fef[_0x4042('0x32')][_0x4042('0x1f')]);_0x247fcf['offset']=qs[_0x4042('0x1d')](_0x2c3fef['query'][_0x4042('0x1d')]);}return _0x41a53c[_0x4042('0x50')](_0x247fcf);}})[_0x4042('0x25')](function(_0x591506){if(_0x591506){return _0x591506?{'count':_0x3d2293,'rows':_0x591506}:null;}})[_0x4042('0x25')](respondWithResult(_0x5ab069,null))[_0x4042('0x48')](handleError(_0x5ab069,null));};
\ No newline at end of file
index 59544e3..0dafdef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4220=['define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','api','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x299584,_0x680cf8){var _0x288b3b=function(_0x5046e0){while(--_0x5046e0){_0x299584['push'](_0x299584['shift']());}};_0x288b3b(++_0x680cf8);}(_0x4220,0x1c5));var _0x0422=function(_0x4ac93a,_0x2ca7a6){_0x4ac93a=_0x4ac93a-0x0;var _0x37426b=_0x4220[_0x4ac93a];return _0x37426b;};'use strict';var _=require(_0x0422('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0422('0x1'));var moment=require('moment');var BPromise=require(_0x0422('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0422('0x3'));var rimraf=require(_0x0422('0x4'));var config=require(_0x0422('0x5'));var attributes=require(_0x0422('0x6'));module['exports']=function(_0x418fec,_0x7882e4){return _0x418fec[_0x0422('0x7')](_0x0422('0x8'),attributes,{'tableName':_0x0422('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x1475=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0x1475,0x1e8));var _0x5147=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x1475[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x5147('0x0'));var util=require(_0x5147('0x1'));var logger=require(_0x5147('0x2'))(_0x5147('0x3'));var moment=require(_0x5147('0x4'));var BPromise=require(_0x5147('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5147('0x6'));var rimraf=require(_0x5147('0x7'));var config=require(_0x5147('0x8'));var attributes=require(_0x5147('0x9'));module[_0x5147('0xa')]=function(_0x52835b,_0x1126c6){return _0x52835b[_0x5147('0xb')](_0x5147('0xc'),attributes,{'tableName':_0x5147('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 8bdfe0e..e01d024 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x19e3=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2265da,_0xfbbd2e){var _0x430c2b=function(_0x20d671){while(--_0x20d671){_0x2265da['push'](_0x2265da['shift']());}};_0x430c2b(++_0xfbbd2e);}(_0x19e3,0x1f2));var _0x319e=function(_0x9ca1cc,_0x55cd3a){_0x9ca1cc=_0x9ca1cc-0x0;var _0x6a92a=_0x19e3[_0x9ca1cc];return _0x6a92a;};'use strict';var _=require(_0x319e('0x0'));var util=require(_0x319e('0x1'));var moment=require(_0x319e('0x2'));var BPromise=require(_0x319e('0x3'));var rs=require(_0x319e('0x4'));var fs=require('fs');var Redis=require(_0x319e('0x5'));var db=require(_0x319e('0x6'))['db'];var utils=require(_0x319e('0x7'));var logger=require(_0x319e('0x8'))(_0x319e('0x9'));var config=require(_0x319e('0xa'));var jayson=require(_0x319e('0xb'));var client=jayson[_0x319e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28b78d,_0x4908f9,_0x33925c){return new BPromise(function(_0x59c6c4,_0x30d38d){return client[_0x319e('0xd')](_0x28b78d,_0x33925c)[_0x319e('0xe')](function(_0x316c24){logger[_0x319e('0xf')](_0x319e('0x10'),_0x4908f9,_0x319e('0x11'));logger[_0x319e('0x12')](_0x319e('0x13'),_0x4908f9,_0x319e('0x11'),JSON[_0x319e('0x14')](_0x316c24));if(_0x316c24[_0x319e('0x15')]){if(_0x316c24[_0x319e('0x15')][_0x319e('0x16')]===0x1f4){logger[_0x319e('0x15')](_0x319e('0x10'),_0x4908f9,_0x316c24[_0x319e('0x15')]['message']);return _0x30d38d(_0x316c24[_0x319e('0x15')][_0x319e('0x17')]);}logger['error'](_0x319e('0x10'),_0x4908f9,_0x316c24[_0x319e('0x15')][_0x319e('0x17')]);return _0x59c6c4(_0x316c24[_0x319e('0x15')][_0x319e('0x17')]);}else{logger[_0x319e('0xf')](_0x319e('0x10'),_0x4908f9,'request\x20sent');_0x59c6c4(_0x316c24[_0x319e('0x18')][_0x319e('0x17')]);}})[_0x319e('0x19')](function(_0x354d2c){logger[_0x319e('0x15')](_0x319e('0x10'),_0x4908f9,_0x354d2c);_0x30d38d(_0x354d2c);});});}
\ No newline at end of file
+var _0x96f1=['jayson/promise','client','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x34c0bf,_0x3b8460){var _0x315559=function(_0x42f409){while(--_0x42f409){_0x34c0bf['push'](_0x34c0bf['shift']());}};_0x315559(++_0x3b8460);}(_0x96f1,0x185));var _0x196f=function(_0x14ac9e,_0x443c98){_0x14ac9e=_0x14ac9e-0x0;var _0x455527=_0x96f1[_0x14ac9e];return _0x455527;};'use strict';var _=require(_0x196f('0x0'));var util=require(_0x196f('0x1'));var moment=require(_0x196f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x196f('0x3'))['db'];var utils=require(_0x196f('0x4'));var logger=require(_0x196f('0x5'))(_0x196f('0x6'));var config=require('../../config/environment');var jayson=require(_0x196f('0x7'));var client=jayson[_0x196f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18b7f3,_0x77ad0c,_0x359221){return new BPromise(function(_0x58997e,_0xa82fee){return client['request'](_0x18b7f3,_0x359221)[_0x196f('0x9')](function(_0x46b541){logger[_0x196f('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x77ad0c,_0x196f('0xb'));logger[_0x196f('0xc')](_0x196f('0xd'),_0x77ad0c,_0x196f('0xb'),JSON['stringify'](_0x46b541));if(_0x46b541['error']){if(_0x46b541[_0x196f('0xe')][_0x196f('0xf')]===0x1f4){logger[_0x196f('0xe')](_0x196f('0x10'),_0x77ad0c,_0x46b541[_0x196f('0xe')][_0x196f('0x11')]);return _0xa82fee(_0x46b541[_0x196f('0xe')][_0x196f('0x11')]);}logger[_0x196f('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x77ad0c,_0x46b541[_0x196f('0xe')][_0x196f('0x11')]);return _0x58997e(_0x46b541['error'][_0x196f('0x11')]);}else{logger[_0x196f('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x77ad0c,_0x196f('0xb'));_0x58997e(_0x46b541['result']['message']);}})['catch'](function(_0x51e63d){logger[_0x196f('0xe')](_0x196f('0x10'),_0x77ad0c,_0x51e63d);_0xa82fee(_0x51e63d);});});}
\ No newline at end of file
index 83a6ee2..23ebf00 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x736f=['show','create','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id'];(function(_0x2c3255,_0x4e00ae){var _0x282aba=function(_0x5721d5){while(--_0x5721d5){_0x2c3255['push'](_0x2c3255['shift']());}};_0x282aba(++_0x4e00ae);}(_0x736f,0x1bf));var _0xf736=function(_0x404458,_0x320912){_0x404458=_0x404458-0x0;var _0x5313c9=_0x736f[_0x404458];return _0x5313c9;};'use strict';var multer=require(_0xf736('0x0'));var util=require(_0xf736('0x1'));var path=require(_0xf736('0x2'));var timeout=require('connect-timeout');var express=require(_0xf736('0x3'));var router=express[_0xf736('0x4')]();var fs_extra=require(_0xf736('0x5'));var auth=require(_0xf736('0x6'));var interaction=require(_0xf736('0x7'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router['get']('/',auth[_0xf736('0x8')](),controller[_0xf736('0x9')]);router[_0xf736('0xa')](_0xf736('0xb'),auth[_0xf736('0x8')](),controller[_0xf736('0xc')]);router['post']('/',auth[_0xf736('0x8')](),controller[_0xf736('0xd')]);router[_0xf736('0xe')](_0xf736('0xb'),auth['isAuthenticated'](),controller[_0xf736('0xf')]);router['delete'](_0xf736('0xb'),auth[_0xf736('0x8')](),controller[_0xf736('0x10')]);module['exports']=router;
\ No newline at end of file
+var _0x3d0a=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','path','connect-timeout'];(function(_0x318ee3,_0x357e32){var _0x410d8b=function(_0x5e8071){while(--_0x5e8071){_0x318ee3['push'](_0x318ee3['shift']());}};_0x410d8b(++_0x357e32);}(_0x3d0a,0x154));var _0xa3d0=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x3d0a[_0x28d18d];return _0x470640;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa3d0('0x0'));var timeout=require(_0xa3d0('0x1'));var express=require(_0xa3d0('0x2'));var router=express['Router']();var fs_extra=require(_0xa3d0('0x3'));var auth=require(_0xa3d0('0x4'));var interaction=require(_0xa3d0('0x5'));var config=require('../../config/environment');var controller=require(_0xa3d0('0x6'));router[_0xa3d0('0x7')]('/',auth[_0xa3d0('0x8')](),controller[_0xa3d0('0x9')]);router[_0xa3d0('0x7')](_0xa3d0('0xa'),auth[_0xa3d0('0x8')](),controller[_0xa3d0('0xb')]);router[_0xa3d0('0xc')]('/',auth[_0xa3d0('0x8')](),controller[_0xa3d0('0xd')]);router[_0xa3d0('0xe')]('/:id',auth[_0xa3d0('0x8')](),controller[_0xa3d0('0xf')]);router[_0xa3d0('0x10')](_0xa3d0('0xa'),auth['isAuthenticated'](),controller[_0xa3d0('0x11')]);module[_0xa3d0('0x12')]=router;
\ No newline at end of file
index f74bffb..5f5f6e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3aba=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x23e5d2,_0x415e7a){var _0x51ee49=function(_0x2cc5fd){while(--_0x2cc5fd){_0x23e5d2['push'](_0x23e5d2['shift']());}};_0x51ee49(++_0x415e7a);}(_0x3aba,0x14a));var _0xa3ab=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0x3aba[_0x210603];return _0x1bcb7d;};'use strict';var Sequelize=require(_0xa3ab('0x0'));module[_0xa3ab('0x1')]={'type':{'type':Sequelize[_0xa3ab('0x2')](_0xa3ab('0x3'),_0xa3ab('0x4'),_0xa3ab('0x5'),_0xa3ab('0x6'),_0xa3ab('0x7')),'defaultValue':_0xa3ab('0x3')},'content':{'type':Sequelize[_0xa3ab('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa3ab('0x2')]('string',_0xa3ab('0x4'),_0xa3ab('0x5'))},'keyContent':{'type':Sequelize[_0xa3ab('0x8')]},'idField':{'type':Sequelize[_0xa3ab('0x8')]},'nameField':{'type':Sequelize[_0xa3ab('0x8')]},'customField':{'type':Sequelize[_0xa3ab('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa3ab('0x8')]}};
\ No newline at end of file
+var _0x5b4d=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x51bb6a,_0x19fa16){var _0x419391=function(_0x1fc9ef){while(--_0x1fc9ef){_0x51bb6a['push'](_0x51bb6a['shift']());}};_0x419391(++_0x19fa16);}(_0x5b4d,0x161));var _0xd5b4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5b4d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xd5b4('0x0'));module[_0xd5b4('0x1')]={'type':{'type':Sequelize[_0xd5b4('0x2')]('string',_0xd5b4('0x3'),_0xd5b4('0x4'),_0xd5b4('0x5'),_0xd5b4('0x6')),'defaultValue':_0xd5b4('0x7')},'content':{'type':Sequelize[_0xd5b4('0x8')]},'key':{'type':Sequelize[_0xd5b4('0x8')]},'keyType':{'type':Sequelize[_0xd5b4('0x2')](_0xd5b4('0x7'),_0xd5b4('0x3'),_0xd5b4('0x4'))},'keyContent':{'type':Sequelize[_0xd5b4('0x8')]},'idField':{'type':Sequelize[_0xd5b4('0x8')]},'nameField':{'type':Sequelize[_0xd5b4('0x8')]},'customField':{'type':Sequelize[_0xd5b4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd5b4('0x8')]}};
\ No newline at end of file
index 7634866..a54a28f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c5a=['crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','SugarcrmField','include','findAll','catch','show','params','intersection','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x1c5a,0x173));var _0xa1c5=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x1c5a[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0xa1c5('0x0'));var rimraf=require(_0xa1c5('0x1'));var zipdir=require(_0xa1c5('0x2'));var jsonpatch=require(_0xa1c5('0x3'));var rp=require(_0xa1c5('0x4'));var moment=require(_0xa1c5('0x5'));var BPromise=require(_0xa1c5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa1c5('0x7'));var sox=require(_0xa1c5('0x8'));var csv=require(_0xa1c5('0x9'));var ejs=require(_0xa1c5('0xa'));var fs=require('fs');var fs_extra=require(_0xa1c5('0xb'));var _=require(_0xa1c5('0xc'));var squel=require(_0xa1c5('0xd'));var crypto=require(_0xa1c5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa1c5('0xf'));var toCsv=require(_0xa1c5('0x9'));var querystring=require(_0xa1c5('0x10'));var Papa=require('papaparse');var Redis=require(_0xa1c5('0x11'));var authService=require(_0xa1c5('0x12'));var qs=require(_0xa1c5('0x13'));var as=require(_0xa1c5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1c5('0x15'))(_0xa1c5('0x16'));var utils=require(_0xa1c5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa1c5('0x18'));var db=require(_0xa1c5('0x19'))['db'];function respondWithStatusCode(_0x3a2f20,_0x2bf045){_0x2bf045=_0x2bf045||0xcc;return function(_0x2018eb){if(_0x2018eb){return _0x3a2f20[_0xa1c5('0x1a')](_0x2bf045);}return _0x3a2f20[_0xa1c5('0x1b')](_0x2bf045)[_0xa1c5('0x1c')]();};}function respondWithResult(_0xa6d66f,_0x3d0b93){_0x3d0b93=_0x3d0b93||0xc8;return function(_0x3b5076){if(_0x3b5076){return _0xa6d66f['status'](_0x3d0b93)[_0xa1c5('0x1d')](_0x3b5076);}};}function respondWithFilteredResult(_0x2f3993,_0xc76405){return function(_0x486022){if(_0x486022){var _0x1a948f=typeof _0xc76405['offset']===_0xa1c5('0x1e')&&typeof _0xc76405['limit']===_0xa1c5('0x1e');var _0x3da84d=_0x486022[_0xa1c5('0x1f')];var _0x98823c=_0x1a948f?0x0:_0xc76405['offset'];var _0x59ff41=_0x1a948f?_0x486022['count']:_0xc76405[_0xa1c5('0x20')]+_0xc76405['limit'];var _0x1ed354;if(_0x59ff41>=_0x3da84d){_0x59ff41=_0x3da84d;_0x1ed354=0xc8;}else{_0x1ed354=0xce;}_0x2f3993['status'](_0x1ed354);return _0x2f3993[_0xa1c5('0x21')](_0xa1c5('0x22'),_0x98823c+'-'+_0x59ff41+'/'+_0x3da84d)[_0xa1c5('0x1d')](_0x486022);}return null;};}function patchUpdates(_0x2b7d9e){return function(_0x3b42b0){try{jsonpatch[_0xa1c5('0x23')](_0x3b42b0,_0x2b7d9e,!![]);}catch(_0x21c0e2){return BPromise['reject'](_0x21c0e2);}return _0x3b42b0[_0xa1c5('0x24')]();};}function saveUpdates(_0x184531,_0x39f746){return function(_0x2fc56e){if(_0x2fc56e){return _0x2fc56e[_0xa1c5('0x25')](_0x184531)[_0xa1c5('0x26')](function(_0x19f5ce){return _0x19f5ce;});}return null;};}function removeEntity(_0x2ee49a,_0x36b525){return function(_0x59f525){if(_0x59f525){return _0x59f525[_0xa1c5('0x27')]()[_0xa1c5('0x26')](function(){_0x2ee49a['status'](0xcc)[_0xa1c5('0x1c')]();});}};}function handleEntityNotFound(_0xc7321f,_0x485ce8){return function(_0x4496e9){if(!_0x4496e9){_0xc7321f['sendStatus'](0x194);}return _0x4496e9;};}function handleError(_0x4a37fb,_0xbf84b0){_0xbf84b0=_0xbf84b0||0x1f4;return function(_0x5eaa24){logger['error'](_0x5eaa24[_0xa1c5('0x28')]);if(_0x5eaa24[_0xa1c5('0x29')]){delete _0x5eaa24[_0xa1c5('0x29')];}_0x4a37fb[_0xa1c5('0x1b')](_0xbf84b0)[_0xa1c5('0x2a')](_0x5eaa24);};}exports[_0xa1c5('0x2b')]=function(_0x300158,_0x57ff55){var _0x2c0c0c={},_0x2286ad={},_0x18e288={'count':0x0,'rows':[]};var _0x1d922d=_[_0xa1c5('0x2c')](db['SugarcrmField'][_0xa1c5('0x2d')],function(_0xa065a0){return{'name':_0xa065a0[_0xa1c5('0x2e')],'type':_0xa065a0['type'][_0xa1c5('0x2f')]};});_0x2286ad[_0xa1c5('0x30')]=_[_0xa1c5('0x2c')](_0x1d922d,_0xa1c5('0x29'));_0x2286ad[_0xa1c5('0x31')]=_[_0xa1c5('0x32')](_0x300158[_0xa1c5('0x31')]);_0x2286ad[_0xa1c5('0x33')]=_['intersection'](_0x2286ad[_0xa1c5('0x30')],_0x2286ad[_0xa1c5('0x31')]);_0x2c0c0c['attributes']=_['intersection'](_0x2286ad[_0xa1c5('0x30')],qs[_0xa1c5('0x34')](_0x300158['query'][_0xa1c5('0x34')]));_0x2c0c0c[_0xa1c5('0x35')]=_0x2c0c0c[_0xa1c5('0x35')][_0xa1c5('0x36')]?_0x2c0c0c[_0xa1c5('0x35')]:_0x2286ad[_0xa1c5('0x30')];if(!_0x300158[_0xa1c5('0x31')][_0xa1c5('0x37')](_0xa1c5('0x38'))){_0x2c0c0c[_0xa1c5('0x39')]=qs['limit'](_0x300158['query'][_0xa1c5('0x39')]);_0x2c0c0c[_0xa1c5('0x20')]=qs[_0xa1c5('0x20')](_0x300158[_0xa1c5('0x31')][_0xa1c5('0x20')]);}_0x2c0c0c['order']=qs['sort'](_0x300158[_0xa1c5('0x31')][_0xa1c5('0x3a')]);_0x2c0c0c[_0xa1c5('0x3b')]=qs[_0xa1c5('0x33')](_[_0xa1c5('0x3c')](_0x300158['query'],_0x2286ad[_0xa1c5('0x33')]),_0x1d922d);if(_0x300158[_0xa1c5('0x31')][_0xa1c5('0x3d')]){_0x2c0c0c['where']=_[_0xa1c5('0x3e')](_0x2c0c0c['where'],{'$or':_[_0xa1c5('0x2c')](_0x1d922d,function(_0xa67466){if(_0xa67466[_0xa1c5('0x3f')]!==_0xa1c5('0x40')){var _0xc9303c={};_0xc9303c[_0xa67466[_0xa1c5('0x29')]]={'$like':'%'+_0x300158['query'][_0xa1c5('0x3d')]+'%'};return _0xc9303c;}})});}_0x2c0c0c=_[_0xa1c5('0x3e')]({},_0x2c0c0c,_0x300158[_0xa1c5('0x41')]);var _0x26f302={'where':_0x2c0c0c[_0xa1c5('0x3b')]};return db[_0xa1c5('0x42')][_0xa1c5('0x1f')](_0x26f302)[_0xa1c5('0x26')](function(_0x28d7f6){_0x18e288[_0xa1c5('0x1f')]=_0x28d7f6;if(_0x300158[_0xa1c5('0x31')]['includeAll']){_0x2c0c0c[_0xa1c5('0x43')]=[{'all':!![]}];}return db[_0xa1c5('0x42')][_0xa1c5('0x44')](_0x2c0c0c);})[_0xa1c5('0x26')](function(_0x221883){_0x18e288['rows']=_0x221883;return _0x18e288;})[_0xa1c5('0x26')](respondWithFilteredResult(_0x57ff55,_0x2c0c0c))[_0xa1c5('0x45')](handleError(_0x57ff55,null));};exports[_0xa1c5('0x46')]=function(_0x2760a1,_0x303fd4){var _0xdf4107={'raw':!![],'where':{'id':_0x2760a1[_0xa1c5('0x47')]['id']}},_0x16c9f0={};_0x16c9f0['model']=_['keys'](db[_0xa1c5('0x42')]['rawAttributes']);_0x16c9f0[_0xa1c5('0x31')]=_[_0xa1c5('0x32')](_0x2760a1[_0xa1c5('0x31')]);_0x16c9f0[_0xa1c5('0x33')]=_[_0xa1c5('0x48')](_0x16c9f0[_0xa1c5('0x30')],_0x16c9f0[_0xa1c5('0x31')]);_0xdf4107['attributes']=_[_0xa1c5('0x48')](_0x16c9f0[_0xa1c5('0x30')],qs[_0xa1c5('0x34')](_0x2760a1[_0xa1c5('0x31')]['fields']));_0xdf4107[_0xa1c5('0x35')]=_0xdf4107['attributes'][_0xa1c5('0x36')]?_0xdf4107['attributes']:_0x16c9f0[_0xa1c5('0x30')];if(_0x2760a1[_0xa1c5('0x31')][_0xa1c5('0x49')]){_0xdf4107[_0xa1c5('0x43')]=[{'all':!![]}];}_0xdf4107=_['merge']({},_0xdf4107,_0x2760a1[_0xa1c5('0x41')]);return db[_0xa1c5('0x42')][_0xa1c5('0x4a')](_0xdf4107)['then'](handleEntityNotFound(_0x303fd4,null))[_0xa1c5('0x26')](respondWithResult(_0x303fd4,null))[_0xa1c5('0x45')](handleError(_0x303fd4,null));};exports[_0xa1c5('0x4b')]=function(_0xbdb30f,_0x1cc815){return db[_0xa1c5('0x42')][_0xa1c5('0x4b')](_0xbdb30f[_0xa1c5('0x4c')],{})[_0xa1c5('0x26')](respondWithResult(_0x1cc815,0xc9))[_0xa1c5('0x45')](handleError(_0x1cc815,null));};exports[_0xa1c5('0x25')]=function(_0xbadb7e,_0x140d13){if(_0xbadb7e['body']['id']){delete _0xbadb7e[_0xa1c5('0x4c')]['id'];}return db[_0xa1c5('0x42')]['find']({'where':{'id':_0xbadb7e['params']['id']}})[_0xa1c5('0x26')](handleEntityNotFound(_0x140d13,null))['then'](saveUpdates(_0xbadb7e[_0xa1c5('0x4c')],null))[_0xa1c5('0x26')](respondWithResult(_0x140d13,null))['catch'](handleError(_0x140d13,null));};exports[_0xa1c5('0x27')]=function(_0x5732a0,_0x3be5ba){return db[_0xa1c5('0x42')][_0xa1c5('0x4a')]({'where':{'id':_0x5732a0['params']['id']}})[_0xa1c5('0x26')](handleEntityNotFound(_0x3be5ba,null))[_0xa1c5('0x26')](removeEntity(_0x3be5ba,null))['catch'](handleError(_0x3be5ba,null));};
\ No newline at end of file
+var _0x9257=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x2da6c2,_0x4a71cc){var _0x460428=function(_0x40773a){while(--_0x40773a){_0x2da6c2['push'](_0x2da6c2['shift']());}};_0x460428(++_0x4a71cc);}(_0x9257,0x8b));var _0x7925=function(_0x34f553,_0x5885f0){_0x34f553=_0x34f553-0x0;var _0x271bf2=_0x9257[_0x34f553];return _0x271bf2;};'use strict';var emlformat=require(_0x7925('0x0'));var rimraf=require(_0x7925('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7925('0x2'));var rp=require('request-promise');var moment=require(_0x7925('0x3'));var BPromise=require(_0x7925('0x4'));var Mustache=require(_0x7925('0x5'));var util=require(_0x7925('0x6'));var path=require(_0x7925('0x7'));var sox=require(_0x7925('0x8'));var csv=require(_0x7925('0x9'));var ejs=require(_0x7925('0xa'));var fs=require('fs');var fs_extra=require(_0x7925('0xb'));var _=require('lodash');var squel=require(_0x7925('0xc'));var crypto=require(_0x7925('0xd'));var jsforce=require(_0x7925('0xe'));var deskjs=require(_0x7925('0xf'));var toCsv=require(_0x7925('0x9'));var querystring=require(_0x7925('0x10'));var Papa=require(_0x7925('0x11'));var Redis=require(_0x7925('0x12'));var authService=require(_0x7925('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7925('0x14'));var hardwareService=require(_0x7925('0x15'));var logger=require('../../config/logger')(_0x7925('0x16'));var utils=require('../../config/utils');var config=require(_0x7925('0x17'));var licenseUtil=require(_0x7925('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4451f6,_0x155265){_0x155265=_0x155265||0xcc;return function(_0x2db5b8){if(_0x2db5b8){return _0x4451f6[_0x7925('0x19')](_0x155265);}return _0x4451f6[_0x7925('0x1a')](_0x155265)[_0x7925('0x1b')]();};}function respondWithResult(_0x5cd66a,_0x2ebbaa){_0x2ebbaa=_0x2ebbaa||0xc8;return function(_0x3fc87d){if(_0x3fc87d){return _0x5cd66a[_0x7925('0x1a')](_0x2ebbaa)[_0x7925('0x1c')](_0x3fc87d);}};}function respondWithFilteredResult(_0x4a695d,_0x55748f){return function(_0x5f9a5b){if(_0x5f9a5b){var _0x5c856b=typeof _0x55748f[_0x7925('0x1d')]===_0x7925('0x1e')&&typeof _0x55748f[_0x7925('0x1f')]===_0x7925('0x1e');var _0x18fffb=_0x5f9a5b['count'];var _0x16e319=_0x5c856b?0x0:_0x55748f[_0x7925('0x1d')];var _0x2591af=_0x5c856b?_0x5f9a5b[_0x7925('0x20')]:_0x55748f[_0x7925('0x1d')]+_0x55748f[_0x7925('0x1f')];var _0x57bf93;if(_0x2591af>=_0x18fffb){_0x2591af=_0x18fffb;_0x57bf93=0xc8;}else{_0x57bf93=0xce;}_0x4a695d[_0x7925('0x1a')](_0x57bf93);return _0x4a695d[_0x7925('0x21')]('Content-Range',_0x16e319+'-'+_0x2591af+'/'+_0x18fffb)[_0x7925('0x1c')](_0x5f9a5b);}return null;};}function patchUpdates(_0x1fe1b9){return function(_0x135932){try{jsonpatch[_0x7925('0x22')](_0x135932,_0x1fe1b9,!![]);}catch(_0x19de25){return BPromise['reject'](_0x19de25);}return _0x135932[_0x7925('0x23')]();};}function saveUpdates(_0x4ee9a1,_0x41c1c8){return function(_0x1bb2c0){if(_0x1bb2c0){return _0x1bb2c0['update'](_0x4ee9a1)[_0x7925('0x24')](function(_0x508c06){return _0x508c06;});}return null;};}function removeEntity(_0x13cbb6,_0x2d4a90){return function(_0x533b7c){if(_0x533b7c){return _0x533b7c[_0x7925('0x25')]()[_0x7925('0x24')](function(){_0x13cbb6[_0x7925('0x1a')](0xcc)[_0x7925('0x1b')]();});}};}function handleEntityNotFound(_0x4cd319,_0x320949){return function(_0x480fb8){if(!_0x480fb8){_0x4cd319[_0x7925('0x19')](0x194);}return _0x480fb8;};}function handleError(_0x1f5789,_0x25aed1){_0x25aed1=_0x25aed1||0x1f4;return function(_0x5d4abc){logger[_0x7925('0x26')](_0x5d4abc[_0x7925('0x27')]);if(_0x5d4abc[_0x7925('0x28')]){delete _0x5d4abc[_0x7925('0x28')];}_0x1f5789['status'](_0x25aed1)[_0x7925('0x29')](_0x5d4abc);};}exports[_0x7925('0x2a')]=function(_0xcafde2,_0x3a82c6){var _0x5eedd3={},_0x2dcff9={},_0x4e4872={'count':0x0,'rows':[]};var _0x2ceec3=_[_0x7925('0x2b')](db[_0x7925('0x2c')][_0x7925('0x2d')],function(_0x293a26){return{'name':_0x293a26['fieldName'],'type':_0x293a26[_0x7925('0x2e')][_0x7925('0x2f')]};});_0x2dcff9[_0x7925('0x30')]=_[_0x7925('0x2b')](_0x2ceec3,_0x7925('0x28'));_0x2dcff9[_0x7925('0x31')]=_[_0x7925('0x32')](_0xcafde2[_0x7925('0x31')]);_0x2dcff9[_0x7925('0x33')]=_[_0x7925('0x34')](_0x2dcff9['model'],_0x2dcff9[_0x7925('0x31')]);_0x5eedd3['attributes']=_[_0x7925('0x34')](_0x2dcff9[_0x7925('0x30')],qs[_0x7925('0x35')](_0xcafde2[_0x7925('0x31')][_0x7925('0x35')]));_0x5eedd3[_0x7925('0x36')]=_0x5eedd3['attributes'][_0x7925('0x37')]?_0x5eedd3['attributes']:_0x2dcff9[_0x7925('0x30')];if(!_0xcafde2['query'][_0x7925('0x38')](_0x7925('0x39'))){_0x5eedd3[_0x7925('0x1f')]=qs[_0x7925('0x1f')](_0xcafde2['query'][_0x7925('0x1f')]);_0x5eedd3['offset']=qs['offset'](_0xcafde2[_0x7925('0x31')][_0x7925('0x1d')]);}_0x5eedd3['order']=qs['sort'](_0xcafde2[_0x7925('0x31')][_0x7925('0x3a')]);_0x5eedd3['where']=qs[_0x7925('0x33')](_['pick'](_0xcafde2[_0x7925('0x31')],_0x2dcff9[_0x7925('0x33')]),_0x2ceec3);if(_0xcafde2[_0x7925('0x31')]['filter']){_0x5eedd3[_0x7925('0x3b')]=_[_0x7925('0x3c')](_0x5eedd3[_0x7925('0x3b')],{'$or':_[_0x7925('0x2b')](_0x2ceec3,function(_0x4e7078){if(_0x4e7078[_0x7925('0x2e')]!==_0x7925('0x3d')){var _0x1d0dc9={};_0x1d0dc9[_0x4e7078[_0x7925('0x28')]]={'$like':'%'+_0xcafde2[_0x7925('0x31')][_0x7925('0x3e')]+'%'};return _0x1d0dc9;}})});}_0x5eedd3=_[_0x7925('0x3c')]({},_0x5eedd3,_0xcafde2[_0x7925('0x3f')]);var _0x3f520f={'where':_0x5eedd3['where']};return db[_0x7925('0x2c')][_0x7925('0x20')](_0x3f520f)[_0x7925('0x24')](function(_0x5bf4c7){_0x4e4872['count']=_0x5bf4c7;if(_0xcafde2[_0x7925('0x31')][_0x7925('0x40')]){_0x5eedd3['include']=[{'all':!![]}];}return db[_0x7925('0x2c')][_0x7925('0x41')](_0x5eedd3);})[_0x7925('0x24')](function(_0x1ebf50){_0x4e4872['rows']=_0x1ebf50;return _0x4e4872;})[_0x7925('0x24')](respondWithFilteredResult(_0x3a82c6,_0x5eedd3))[_0x7925('0x42')](handleError(_0x3a82c6,null));};exports[_0x7925('0x43')]=function(_0x5f135a,_0x27ea08){var _0x4c106e={'raw':!![],'where':{'id':_0x5f135a[_0x7925('0x44')]['id']}},_0x9587c0={};_0x9587c0[_0x7925('0x30')]=_['keys'](db[_0x7925('0x2c')][_0x7925('0x2d')]);_0x9587c0['query']=_[_0x7925('0x32')](_0x5f135a['query']);_0x9587c0['filters']=_[_0x7925('0x34')](_0x9587c0[_0x7925('0x30')],_0x9587c0[_0x7925('0x31')]);_0x4c106e[_0x7925('0x36')]=_[_0x7925('0x34')](_0x9587c0[_0x7925('0x30')],qs[_0x7925('0x35')](_0x5f135a[_0x7925('0x31')][_0x7925('0x35')]));_0x4c106e[_0x7925('0x36')]=_0x4c106e[_0x7925('0x36')]['length']?_0x4c106e[_0x7925('0x36')]:_0x9587c0[_0x7925('0x30')];if(_0x5f135a[_0x7925('0x31')][_0x7925('0x40')]){_0x4c106e[_0x7925('0x45')]=[{'all':!![]}];}_0x4c106e=_['merge']({},_0x4c106e,_0x5f135a[_0x7925('0x3f')]);return db[_0x7925('0x2c')][_0x7925('0x46')](_0x4c106e)[_0x7925('0x24')](handleEntityNotFound(_0x27ea08,null))[_0x7925('0x24')](respondWithResult(_0x27ea08,null))[_0x7925('0x42')](handleError(_0x27ea08,null));};exports[_0x7925('0x47')]=function(_0x537ea5,_0x59c2a9){return db[_0x7925('0x2c')]['create'](_0x537ea5[_0x7925('0x48')],{})[_0x7925('0x24')](respondWithResult(_0x59c2a9,0xc9))['catch'](handleError(_0x59c2a9,null));};exports['update']=function(_0x4c7ae3,_0x4c56e6){if(_0x4c7ae3[_0x7925('0x48')]['id']){delete _0x4c7ae3[_0x7925('0x48')]['id'];}return db['SugarcrmField'][_0x7925('0x46')]({'where':{'id':_0x4c7ae3['params']['id']}})[_0x7925('0x24')](handleEntityNotFound(_0x4c56e6,null))['then'](saveUpdates(_0x4c7ae3['body'],null))[_0x7925('0x24')](respondWithResult(_0x4c56e6,null))[_0x7925('0x42')](handleError(_0x4c56e6,null));};exports[_0x7925('0x25')]=function(_0x150be5,_0xe35a7c){return db[_0x7925('0x2c')][_0x7925('0x46')]({'where':{'id':_0x150be5[_0x7925('0x44')]['id']}})['then'](handleEntityNotFound(_0xe35a7c,null))[_0x7925('0x24')](removeEntity(_0xe35a7c,null))[_0x7925('0x42')](handleError(_0xe35a7c,null));};
\ No newline at end of file
index faed453..f998422 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x79ad=['bluebird','path','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','api'];(function(_0x278935,_0x4db279){var _0x362009=function(_0x1d0e08){while(--_0x1d0e08){_0x278935['push'](_0x278935['shift']());}};_0x362009(++_0x4db279);}(_0x79ad,0x1b7));var _0xd79a=function(_0xf9b20f,_0x23866c){_0xf9b20f=_0xf9b20f-0x0;var _0x3c99d6=_0x79ad[_0xf9b20f];return _0x3c99d6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd79a('0x0'));var moment=require('moment');var BPromise=require(_0xd79a('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd79a('0x2'));var rimraf=require(_0xd79a('0x3'));var config=require(_0xd79a('0x4'));var attributes=require('./intSugarcrmField.attributes');module[_0xd79a('0x5')]=function(_0x14c668,_0x7bb49a){return _0x14c668[_0xd79a('0x6')](_0xd79a('0x7'),attributes,{'tableName':_0xd79a('0x8'),'paranoid':![],'indexes':[{'name':_0xd79a('0x9'),'fields':['idField',_0xd79a('0xa')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xc2cb=['request-promise','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','../../config/logger','moment'];(function(_0x3c6655,_0x5f3c6e){var _0x15d035=function(_0x14a553){while(--_0x14a553){_0x3c6655['push'](_0x3c6655['shift']());}};_0x15d035(++_0x5f3c6e);}(_0xc2cb,0x18f));var _0xbc2c=function(_0x1c31fa,_0x2925cb){_0x1c31fa=_0x1c31fa-0x0;var _0xdf751=_0xc2cb[_0x1c31fa];return _0xdf751;};'use strict';var _=require(_0xbc2c('0x0'));var util=require(_0xbc2c('0x1'));var logger=require(_0xbc2c('0x2'))('api');var moment=require(_0xbc2c('0x3'));var BPromise=require('bluebird');var rp=require(_0xbc2c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbc2c('0x5'));var attributes=require(_0xbc2c('0x6'));module[_0xbc2c('0x7')]=function(_0x5e9302,_0x228808){return _0x5e9302[_0xbc2c('0x8')](_0xbc2c('0x9'),attributes,{'tableName':_0xbc2c('0xa'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xbc2c('0xb'),_0xbc2c('0xc')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index ef3dc6b..5816fdd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3fa0=['request\x20sent','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','debug','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x351144,_0x6c45c3){var _0x3238c7=function(_0x33c9eb){while(--_0x33c9eb){_0x351144['push'](_0x351144['shift']());}};_0x3238c7(++_0x6c45c3);}(_0x3fa0,0xaf));var _0x03fa=function(_0x49be3a,_0x4d5b06){_0x49be3a=_0x49be3a-0x0;var _0x1f4686=_0x3fa0[_0x49be3a];return _0x1f4686;};'use strict';var _=require('lodash');var util=require(_0x03fa('0x0'));var moment=require('moment');var BPromise=require(_0x03fa('0x1'));var rs=require(_0x03fa('0x2'));var fs=require('fs');var Redis=require(_0x03fa('0x3'));var db=require(_0x03fa('0x4'))['db'];var utils=require(_0x03fa('0x5'));var logger=require(_0x03fa('0x6'))(_0x03fa('0x7'));var config=require(_0x03fa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x03fa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49b8d5,_0x4e7cd4,_0x149508){return new BPromise(function(_0x1e3849,_0x36460e){return client['request'](_0x49b8d5,_0x149508)[_0x03fa('0xa')](function(_0x41552a){logger[_0x03fa('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x4e7cd4,'request\x20sent');logger[_0x03fa('0xc')](_0x03fa('0xd'),_0x4e7cd4,_0x03fa('0xe'),JSON['stringify'](_0x41552a));if(_0x41552a['error']){if(_0x41552a[_0x03fa('0xf')][_0x03fa('0x10')]===0x1f4){logger['error'](_0x03fa('0x11'),_0x4e7cd4,_0x41552a[_0x03fa('0xf')][_0x03fa('0x12')]);return _0x36460e(_0x41552a[_0x03fa('0xf')][_0x03fa('0x12')]);}logger[_0x03fa('0xf')](_0x03fa('0x11'),_0x4e7cd4,_0x41552a['error'][_0x03fa('0x12')]);return _0x1e3849(_0x41552a['error']['message']);}else{logger[_0x03fa('0xb')](_0x03fa('0x11'),_0x4e7cd4,_0x03fa('0xe'));_0x1e3849(_0x41552a[_0x03fa('0x13')]['message']);}})[_0x03fa('0x14')](function(_0x41c36e){logger[_0x03fa('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x4e7cd4,_0x41c36e);_0x36460e(_0x41c36e);});});}
\ No newline at end of file
+var _0x138e=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s'];(function(_0xdd1f52,_0x227e9e){var _0x368782=function(_0x480309){while(--_0x480309){_0xdd1f52['push'](_0xdd1f52['shift']());}};_0x368782(++_0x227e9e);}(_0x138e,0x153));var _0xe138=function(_0x4c7a92,_0x28778a){_0x4c7a92=_0x4c7a92-0x0;var _0xbb110a=_0x138e[_0x4c7a92];return _0xbb110a;};'use strict';var _=require(_0xe138('0x0'));var util=require(_0xe138('0x1'));var moment=require(_0xe138('0x2'));var BPromise=require(_0xe138('0x3'));var rs=require(_0xe138('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe138('0x5'))['db'];var utils=require(_0xe138('0x6'));var logger=require(_0xe138('0x7'))(_0xe138('0x8'));var config=require(_0xe138('0x9'));var jayson=require(_0xe138('0xa'));var client=jayson[_0xe138('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1741c2,_0xea3d64,_0x5a5fe0){return new BPromise(function(_0x30d46f,_0x13ce42){return client[_0xe138('0xc')](_0x1741c2,_0x5a5fe0)[_0xe138('0xd')](function(_0x26cb4a){logger[_0xe138('0xe')]('SugarcrmField,\x20%s,\x20%s',_0xea3d64,_0xe138('0xf'));logger['debug'](_0xe138('0x10'),_0xea3d64,_0xe138('0xf'),JSON[_0xe138('0x11')](_0x26cb4a));if(_0x26cb4a[_0xe138('0x12')]){if(_0x26cb4a[_0xe138('0x12')][_0xe138('0x13')]===0x1f4){logger['error'](_0xe138('0x14'),_0xea3d64,_0x26cb4a[_0xe138('0x12')]['message']);return _0x13ce42(_0x26cb4a['error'][_0xe138('0x15')]);}logger[_0xe138('0x12')](_0xe138('0x14'),_0xea3d64,_0x26cb4a[_0xe138('0x12')][_0xe138('0x15')]);return _0x30d46f(_0x26cb4a[_0xe138('0x12')]['message']);}else{logger[_0xe138('0xe')](_0xe138('0x14'),_0xea3d64,_0xe138('0xf'));_0x30d46f(_0x26cb4a[_0xe138('0x16')][_0xe138('0x15')]);}})[_0xe138('0x17')](function(_0x49950e){logger[_0xe138('0x12')](_0xe138('0x14'),_0xea3d64,_0x49950e);_0x13ce42(_0x49950e);});});}
\ No newline at end of file
index 9b6e9bb..30f1485 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe3c5=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','create','/:id/configurations','put','update','delete','destroy','multer','util','path'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0xe3c5[_0x35d8af];return _0x1d08b0;};'use strict';var multer=require(_0x5e3c('0x0'));var util=require(_0x5e3c('0x1'));var path=require(_0x5e3c('0x2'));var timeout=require(_0x5e3c('0x3'));var express=require(_0x5e3c('0x4'));var router=express[_0x5e3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5e3c('0x6'));var interaction=require(_0x5e3c('0x7'));var config=require(_0x5e3c('0x8'));var controller=require(_0x5e3c('0x9'));router[_0x5e3c('0xa')]('/',auth[_0x5e3c('0xb')](),controller[_0x5e3c('0xc')]);router[_0x5e3c('0xa')](_0x5e3c('0xd'),auth[_0x5e3c('0xb')](),controller[_0x5e3c('0xe')]);router[_0x5e3c('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x5e3c('0xf')]);router[_0x5e3c('0xa')](_0x5e3c('0x10'),auth[_0x5e3c('0xb')](),controller[_0x5e3c('0x11')]);router['post']('/',auth[_0x5e3c('0xb')](),controller[_0x5e3c('0x12')]);router['post'](_0x5e3c('0x13'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x5e3c('0x14')](_0x5e3c('0xd'),auth[_0x5e3c('0xb')](),controller[_0x5e3c('0x15')]);router[_0x5e3c('0x16')](_0x5e3c('0xd'),auth[_0x5e3c('0xb')](),controller[_0x5e3c('0x17')]);module['exports']=router;
\ No newline at end of file
+var _0x22f6=['/:id/configurations','addConfiguration','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post','create'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0x22f6,0x10e));var _0x622f=function(_0x321467,_0x33bdec){_0x321467=_0x321467-0x0;var _0x68c483=_0x22f6[_0x321467];return _0x68c483;};'use strict';var multer=require(_0x622f('0x0'));var util=require('util');var path=require(_0x622f('0x1'));var timeout=require('connect-timeout');var express=require(_0x622f('0x2'));var router=express[_0x622f('0x3')]();var fs_extra=require(_0x622f('0x4'));var auth=require(_0x622f('0x5'));var interaction=require(_0x622f('0x6'));var config=require(_0x622f('0x7'));var controller=require(_0x622f('0x8'));router[_0x622f('0x9')]('/',auth[_0x622f('0xa')](),controller[_0x622f('0xb')]);router['get'](_0x622f('0xc'),auth[_0x622f('0xa')](),controller[_0x622f('0xd')]);router[_0x622f('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x622f('0xe')]);router[_0x622f('0x9')](_0x622f('0xf'),auth[_0x622f('0xa')](),controller['getFields']);router[_0x622f('0x10')]('/',auth[_0x622f('0xa')](),controller[_0x622f('0x11')]);router[_0x622f('0x10')](_0x622f('0x12'),auth[_0x622f('0xa')](),controller[_0x622f('0x13')]);router[_0x622f('0x14')](_0x622f('0xc'),auth['isAuthenticated'](),controller[_0x622f('0x15')]);router[_0x622f('0x16')](_0x622f('0xc'),auth['isAuthenticated'](),controller[_0x622f('0x17')]);module['exports']=router;
\ No newline at end of file
index 22d892f..9217239 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd0c=['STRING','HelpDesk','sequelize','exports'];(function(_0x3101f6,_0x449445){var _0x35dee2=function(_0x3e4f86){while(--_0x3e4f86){_0x3101f6['push'](_0x3101f6['shift']());}};_0x35dee2(++_0x449445);}(_0xbd0c,0x1da));var _0xcbd0=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbd0c[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0xcbd0('0x0'));module[_0xcbd0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xcbd0('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xcbd0('0x2')],'allowNull':![],'defaultValue':_0xcbd0('0x3')},'remoteUri':{'type':Sequelize[_0xcbd0('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xcbd0('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xcbd0('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0xb2d7=['sequelize','STRING'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xb2d7,0x17c));var _0x7b2d=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0xb2d7[_0xdd827a];return _0x2f46f1;};'use strict';var Sequelize=require(_0x7b2d('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b2d('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7b2d('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7b2d('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7b2d('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7b2d('0x1')],'allowNull':![]}};
\ No newline at end of file
index 17c3ced..8692fe0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b82=['sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','rows','catch','show','params','includeAll','include','options','create','body','find','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','getDescriptions','channel','VtigerField','Subjects','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','false','startsWith','label','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration'];(function(_0x66bd89,_0xc289ca){var _0x43b6c3=function(_0x8314ba){while(--_0x8314ba){_0x66bd89['push'](_0x66bd89['shift']());}};_0x43b6c3(++_0xc289ca);}(_0x0b82,0x1bc));var _0x20b8=function(_0x23e48f,_0x496e5d){_0x23e48f=_0x23e48f-0x0;var _0x441762=_0x0b82[_0x23e48f];return _0x441762;};'use strict';var emlformat=require(_0x20b8('0x0'));var rimraf=require(_0x20b8('0x1'));var zipdir=require(_0x20b8('0x2'));var jsonpatch=require(_0x20b8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x20b8('0x4'));var Mustache=require(_0x20b8('0x5'));var util=require(_0x20b8('0x6'));var path=require(_0x20b8('0x7'));var sox=require(_0x20b8('0x8'));var csv=require(_0x20b8('0x9'));var ejs=require(_0x20b8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x20b8('0xb'));var squel=require('squel');var crypto=require(_0x20b8('0xc'));var jsforce=require(_0x20b8('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x20b8('0xe'));var Papa=require(_0x20b8('0xf'));var Redis=require(_0x20b8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x20b8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20b8('0x12'));var logger=require(_0x20b8('0x13'))(_0x20b8('0x14'));var utils=require(_0x20b8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x20b8('0x16'))['db'];var integrations=require(_0x20b8('0x17'));function respondWithStatusCode(_0x1b4183,_0x44b6b0){_0x44b6b0=_0x44b6b0||0xcc;return function(_0x31c011){if(_0x31c011){return _0x1b4183[_0x20b8('0x18')](_0x44b6b0);}return _0x1b4183[_0x20b8('0x19')](_0x44b6b0)[_0x20b8('0x1a')]();};}function respondWithResult(_0x2f26e7,_0x2c0675){_0x2c0675=_0x2c0675||0xc8;return function(_0x2cedd1){if(_0x2cedd1){return _0x2f26e7[_0x20b8('0x19')](_0x2c0675)[_0x20b8('0x1b')](_0x2cedd1);}};}function respondWithFilteredResult(_0x2086c1,_0x1dea3d){return function(_0x32fe07){if(_0x32fe07){var _0x22829f=typeof _0x1dea3d[_0x20b8('0x1c')]===_0x20b8('0x1d')&&typeof _0x1dea3d['limit']===_0x20b8('0x1d');var _0x81b899=_0x32fe07[_0x20b8('0x1e')];var _0x2664ec=_0x22829f?0x0:_0x1dea3d[_0x20b8('0x1c')];var _0x4c61be=_0x22829f?_0x32fe07['count']:_0x1dea3d['offset']+_0x1dea3d['limit'];var _0x3de589;if(_0x4c61be>=_0x81b899){_0x4c61be=_0x81b899;_0x3de589=0xc8;}else{_0x3de589=0xce;}_0x2086c1['status'](_0x3de589);return _0x2086c1['set'](_0x20b8('0x1f'),_0x2664ec+'-'+_0x4c61be+'/'+_0x81b899)[_0x20b8('0x1b')](_0x32fe07);}return null;};}function patchUpdates(_0x4b1455){return function(_0x32eff5){try{jsonpatch[_0x20b8('0x20')](_0x32eff5,_0x4b1455,!![]);}catch(_0x352b18){return BPromise[_0x20b8('0x21')](_0x352b18);}return _0x32eff5[_0x20b8('0x22')]();};}function saveUpdates(_0x110cb4,_0x3177e7){return function(_0x5d5670){if(_0x5d5670){return _0x5d5670[_0x20b8('0x23')](_0x110cb4)[_0x20b8('0x24')](function(_0x4502a5){return _0x4502a5;});}return null;};}function removeEntity(_0x4705e0,_0x58ad14){return function(_0x7a35d8){if(_0x7a35d8){return _0x7a35d8[_0x20b8('0x25')]()['then'](function(){_0x4705e0[_0x20b8('0x19')](0xcc)[_0x20b8('0x1a')]();});}};}function handleEntityNotFound(_0x24fa6b,_0x1de9ee){return function(_0x34fd23){if(!_0x34fd23){_0x24fa6b[_0x20b8('0x18')](0x194);}return _0x34fd23;};}function handleError(_0x5024cd,_0x2afb11){_0x2afb11=_0x2afb11||0x1f4;return function(_0x46f24c){logger[_0x20b8('0x26')](_0x46f24c[_0x20b8('0x27')]);if(_0x46f24c[_0x20b8('0x28')]){delete _0x46f24c['name'];}_0x5024cd[_0x20b8('0x19')](_0x2afb11)[_0x20b8('0x29')](_0x46f24c);};}exports['index']=function(_0x522329,_0x3facd3){var _0x31478e={},_0x24dab6={},_0xe874e5={'count':0x0,'rows':[]};var _0x485459=_[_0x20b8('0x2a')](db[_0x20b8('0x2b')][_0x20b8('0x2c')],function(_0x40bf11){return{'name':_0x40bf11[_0x20b8('0x2d')],'type':_0x40bf11[_0x20b8('0x2e')][_0x20b8('0x2f')]};});_0x24dab6['model']=_[_0x20b8('0x2a')](_0x485459,_0x20b8('0x28'));_0x24dab6['query']=_[_0x20b8('0x30')](_0x522329[_0x20b8('0x31')]);_0x24dab6[_0x20b8('0x32')]=_[_0x20b8('0x33')](_0x24dab6[_0x20b8('0x34')],_0x24dab6[_0x20b8('0x31')]);_0x31478e[_0x20b8('0x35')]=_[_0x20b8('0x33')](_0x24dab6[_0x20b8('0x34')],qs[_0x20b8('0x36')](_0x522329['query'][_0x20b8('0x36')]));_0x31478e['attributes']=_0x31478e[_0x20b8('0x35')][_0x20b8('0x37')]?_0x31478e['attributes']:_0x24dab6[_0x20b8('0x34')];if(!_0x522329['query']['hasOwnProperty'](_0x20b8('0x38'))){_0x31478e[_0x20b8('0x39')]=qs[_0x20b8('0x39')](_0x522329[_0x20b8('0x31')][_0x20b8('0x39')]);_0x31478e[_0x20b8('0x1c')]=qs['offset'](_0x522329[_0x20b8('0x31')][_0x20b8('0x1c')]);}_0x31478e[_0x20b8('0x3a')]=qs[_0x20b8('0x3b')](_0x522329['query']['sort']);_0x31478e['where']=qs['filters'](_[_0x20b8('0x3c')](_0x522329['query'],_0x24dab6[_0x20b8('0x32')]),_0x485459);if(_0x522329['query'][_0x20b8('0x3d')]){_0x31478e[_0x20b8('0x3e')]=_[_0x20b8('0x3f')](_0x31478e[_0x20b8('0x3e')],{'$or':_[_0x20b8('0x2a')](_0x485459,function(_0x227182){if(_0x227182[_0x20b8('0x2e')]!==_0x20b8('0x40')){var _0x2a0843={};_0x2a0843[_0x227182[_0x20b8('0x28')]]={'$like':'%'+_0x522329[_0x20b8('0x31')][_0x20b8('0x3d')]+'%'};return _0x2a0843;}})});}_0x31478e=_[_0x20b8('0x3f')]({},_0x31478e,_0x522329['options']);var _0x183b27={'where':_0x31478e[_0x20b8('0x3e')]};return db[_0x20b8('0x2b')][_0x20b8('0x1e')](_0x183b27)[_0x20b8('0x24')](function(_0x44d08d){_0xe874e5[_0x20b8('0x1e')]=_0x44d08d;if(_0x522329[_0x20b8('0x31')]['includeAll']){_0x31478e['include']=[{'all':!![]}];}return db[_0x20b8('0x2b')]['findAll'](_0x31478e);})[_0x20b8('0x24')](function(_0x64e6e6){_0xe874e5[_0x20b8('0x41')]=_0x64e6e6;return _0xe874e5;})[_0x20b8('0x24')](respondWithFilteredResult(_0x3facd3,_0x31478e))[_0x20b8('0x42')](handleError(_0x3facd3,null));};exports[_0x20b8('0x43')]=function(_0x2377d5,_0x504f02){var _0x1449ff={'raw':![],'where':{'id':_0x2377d5[_0x20b8('0x44')]['id']}},_0x273074={};_0x273074[_0x20b8('0x34')]=_[_0x20b8('0x30')](db[_0x20b8('0x2b')][_0x20b8('0x2c')]);_0x273074[_0x20b8('0x31')]=_[_0x20b8('0x30')](_0x2377d5[_0x20b8('0x31')]);_0x273074['filters']=_[_0x20b8('0x33')](_0x273074['model'],_0x273074[_0x20b8('0x31')]);_0x1449ff['attributes']=_[_0x20b8('0x33')](_0x273074[_0x20b8('0x34')],qs[_0x20b8('0x36')](_0x2377d5[_0x20b8('0x31')]['fields']));_0x1449ff[_0x20b8('0x35')]=_0x1449ff[_0x20b8('0x35')][_0x20b8('0x37')]?_0x1449ff[_0x20b8('0x35')]:_0x273074[_0x20b8('0x34')];if(_0x2377d5[_0x20b8('0x31')][_0x20b8('0x45')]){_0x1449ff[_0x20b8('0x46')]=[{'all':!![]}];}_0x1449ff=_[_0x20b8('0x3f')]({},_0x1449ff,_0x2377d5[_0x20b8('0x47')]);return db['VtigerAccount']['find'](_0x1449ff)['then'](handleEntityNotFound(_0x504f02,null))[_0x20b8('0x24')](respondWithResult(_0x504f02,null))[_0x20b8('0x42')](handleError(_0x504f02,null));};exports[_0x20b8('0x48')]=function(_0x2da615,_0x26e4d7){return db[_0x20b8('0x2b')][_0x20b8('0x48')](_0x2da615['body'],{})[_0x20b8('0x24')](respondWithResult(_0x26e4d7,0xc9))[_0x20b8('0x42')](handleError(_0x26e4d7,null));};exports[_0x20b8('0x23')]=function(_0x310624,_0x226835){if(_0x310624[_0x20b8('0x49')]['id']){delete _0x310624[_0x20b8('0x49')]['id'];}return db[_0x20b8('0x2b')][_0x20b8('0x4a')]({'where':{'id':_0x310624[_0x20b8('0x44')]['id']}})[_0x20b8('0x24')](handleEntityNotFound(_0x226835,null))[_0x20b8('0x24')](saveUpdates(_0x310624[_0x20b8('0x49')],null))[_0x20b8('0x24')](respondWithResult(_0x226835,null))['catch'](handleError(_0x226835,null));};exports[_0x20b8('0x25')]=function(_0x432b12,_0x31150b){return db[_0x20b8('0x2b')][_0x20b8('0x4a')]({'where':{'id':_0x432b12[_0x20b8('0x44')]['id']}})[_0x20b8('0x24')](handleEntityNotFound(_0x31150b,null))['then'](removeEntity(_0x31150b,null))[_0x20b8('0x42')](handleError(_0x31150b,null));};exports['getConfigurations']=function(_0x1e0598,_0x28b477,_0x1f9566){var _0x521523={};var _0x1bde0b={};var _0x14e9d8;var _0x11f600;return db[_0x20b8('0x2b')]['findOne']({'where':{'id':_0x1e0598[_0x20b8('0x44')]['id']}})[_0x20b8('0x24')](handleEntityNotFound(_0x28b477,null))[_0x20b8('0x24')](function(_0x56f004){if(_0x56f004){_0x14e9d8=_0x56f004;_0x1bde0b[_0x20b8('0x34')]=_[_0x20b8('0x30')](db['VtigerConfiguration']['rawAttributes']);_0x1bde0b[_0x20b8('0x31')]=_['keys'](_0x1e0598[_0x20b8('0x31')]);_0x1bde0b['filters']=_[_0x20b8('0x33')](_0x1bde0b[_0x20b8('0x34')],_0x1bde0b[_0x20b8('0x31')]);_0x521523[_0x20b8('0x35')]=_['intersection'](_0x1bde0b[_0x20b8('0x34')],qs[_0x20b8('0x36')](_0x1e0598['query'][_0x20b8('0x36')]));_0x521523['attributes']=_0x521523[_0x20b8('0x35')][_0x20b8('0x37')]?_0x521523[_0x20b8('0x35')]:_0x1bde0b[_0x20b8('0x34')];_0x521523['order']=qs['sort'](_0x1e0598[_0x20b8('0x31')]['sort']);_0x521523[_0x20b8('0x3e')]=qs[_0x20b8('0x32')](_[_0x20b8('0x3c')](_0x1e0598['query'],_0x1bde0b['filters']));if(_0x1e0598['query'][_0x20b8('0x3d')]){_0x521523['where']=_[_0x20b8('0x3f')](_0x521523[_0x20b8('0x3e')],{'$or':_[_0x20b8('0x2a')](_0x521523[_0x20b8('0x35')],function(_0xf7d762){var _0x59573f={};_0x59573f[_0xf7d762]={'$like':'%'+_0x1e0598[_0x20b8('0x31')]['filter']+'%'};return _0x59573f;})});}_0x521523=_[_0x20b8('0x3f')]({},_0x521523,_0x1e0598[_0x20b8('0x47')]);return _0x14e9d8[_0x20b8('0x4b')](_0x521523);}})[_0x20b8('0x24')](function(_0x4e5c0f){if(_0x4e5c0f){_0x11f600=_0x4e5c0f['length'];if(!_0x1e0598[_0x20b8('0x31')]['hasOwnProperty'](_0x20b8('0x38'))){_0x521523['limit']=qs[_0x20b8('0x39')](_0x1e0598[_0x20b8('0x31')][_0x20b8('0x39')]);_0x521523[_0x20b8('0x1c')]=qs[_0x20b8('0x1c')](_0x1e0598[_0x20b8('0x31')]['offset']);}return _0x14e9d8[_0x20b8('0x4b')](_0x521523);}})[_0x20b8('0x24')](function(_0x5d7fa4){if(_0x5d7fa4){return _0x5d7fa4?{'count':_0x11f600,'rows':_0x5d7fa4}:null;}})['then'](respondWithResult(_0x28b477,null))[_0x20b8('0x42')](handleError(_0x28b477,null));};exports[_0x20b8('0x4c')]=function(_0x2abe80,_0x5d5468,_0x59a8a5){if(_0x2abe80[_0x20b8('0x49')]['id']){delete _0x2abe80[_0x20b8('0x49')]['id'];}return db[_0x20b8('0x2b')][_0x20b8('0x4d')]({'where':{'id':_0x2abe80[_0x20b8('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d5468,null))['then'](function(_0x4b21ca){if(_0x4b21ca){_0x2abe80['body'][_0x20b8('0x4e')]=_0x4b21ca['id'];_0x2abe80[_0x20b8('0x49')]['Subjects']=integrations[_0x20b8('0x4f')](_0x2abe80[_0x20b8('0x49')]['channel'],_0x2abe80[_0x20b8('0x49')][_0x20b8('0x2e')]);_0x2abe80['body']['Descriptions']=integrations[_0x20b8('0x50')](_0x2abe80[_0x20b8('0x49')][_0x20b8('0x51')],_0x2abe80[_0x20b8('0x49')][_0x20b8('0x2e')]);return db['VtigerConfiguration'][_0x20b8('0x48')](_0x2abe80['body'],{'include':[{'model':db[_0x20b8('0x52')],'as':_0x20b8('0x53')},{'model':db[_0x20b8('0x52')],'as':'Descriptions'}]});}return null;})[_0x20b8('0x24')](respondWithResult(_0x5d5468,null))[_0x20b8('0x42')](handleError(_0x5d5468,null));};var md5=require(_0x20b8('0x54'));exports[_0x20b8('0x55')]=function(_0xcbdf4b,_0x1327c4,_0x1ad9ae){var _0x4d9187=null;var _0x283c4c=null;var _0x4afdb3=null;var _0x1c6594=null;var _0xa6e079='';return db['VtigerAccount'][_0x20b8('0x4d')]({'where':{'id':_0xcbdf4b['params']['id']},'attributes':['id','name','username',_0x20b8('0x56'),_0x20b8('0x57'),_0x20b8('0x58'),_0x20b8('0x59'),_0x20b8('0x5a')]})['then'](handleEntityNotFound(_0x1327c4,null))[_0x20b8('0x24')](function(_0x373581){if(_0x373581){_0x4d9187=_0x373581[_0x20b8('0x5b')];_0x283c4c=_0x373581[_0x20b8('0x5a')];_0x4afdb3=_0x373581['moduleName'];_0xa6e079=_0x373581[_0x20b8('0x58')];var _0xab5906=_0xa6e079['slice'](-0x1);if(_0xab5906==='/'){_0xa6e079=_0xa6e079[_0x20b8('0x5c')](0x0,_0xa6e079[_0x20b8('0x5d')](_0xab5906));}_0x1c6594=util[_0x20b8('0x5e')](_0x20b8('0x5f'),_0xa6e079);var _0x29dde1={'method':_0x20b8('0x60'),'uri':_0x1c6594,'qs':{'operation':_0x20b8('0x61'),'username':_0x373581[_0x20b8('0x5b')]},'json':!![]};return rp(_0x29dde1);}})[_0x20b8('0x24')](function(_0x4ed8f2){if(_0x4ed8f2[_0x20b8('0x62')]){var _0x3b18ba={'method':_0x20b8('0x63'),'uri':_0x1c6594,'form':{'operation':'login','username':_0x4d9187,'accessKey':md5(_0x4ed8f2[_0x20b8('0x64')][_0x20b8('0x65')]+_0x283c4c)},'json':!![]};return rp(_0x3b18ba);}})[_0x20b8('0x24')](function(_0x33fbbb){if(_0x33fbbb['success']){var _0x5c2e40={'method':_0x20b8('0x60'),'uri':_0x1c6594,'qs':{'operation':_0x20b8('0x66'),'username':_0x4d9187,'sessionName':_0x33fbbb[_0x20b8('0x64')][_0x20b8('0x67')],'elementType':_0x4afdb3},'json':!![]};return rp(_0x5c2e40);}})['then'](function(_0x20bb60){if(_0x20bb60['success']){var _0x126eaf=[_0x20b8('0x68'),_0x20b8('0x69'),_0x20b8('0x6a')];_[_0x20b8('0x6b')](_0x20bb60['result']['fields'],function(_0x212576){return _0x126eaf[_0x20b8('0x6c')](_0x212576[_0x20b8('0x2e')][_0x20b8('0x28')]);});_[_0x20b8('0x6b')](_0x20bb60[_0x20b8('0x64')][_0x20b8('0x36')],function(_0x107d79){return _0x107d79['editable']===_0x20b8('0x6d');});return{'count':_0x20bb60['result'][_0x20b8('0x36')]['length'],'rows':_[_0x20b8('0x2a')](_0x20bb60[_0x20b8('0x64')][_0x20b8('0x36')],function(_0x5d7153){return{'id':_0x5d7153[_0x20b8('0x28')],'name':_0x5d7153['label'],'custom':_[_0x20b8('0x6e')](_0x5d7153[_0x20b8('0x28')],'cf_')?!![]:![],'options':_0x5d7153[_0x20b8('0x2e')][_0x20b8('0x28')]==='picklist'&&_0x5d7153[_0x20b8('0x2e')]['picklistValues'][_0x20b8('0x37')]>0x0?_[_0x20b8('0x2a')](_0x5d7153[_0x20b8('0x2e')]['picklistValues'],function(_0x397ffe){return{'name':_0x397ffe[_0x20b8('0x6f')],'value':_0x397ffe[_0x20b8('0x70')]};}):[]};})};}})[_0x20b8('0x24')](respondWithResult(_0x1327c4,null))[_0x20b8('0x42')](function(_0x28eed0){console[_0x20b8('0x71')](_0x20b8('0x72')+_0x28eed0);var _0x2b1413=_0xcbdf4b[_0x20b8('0x31')]['test']?0x1f4:_0x28eed0[_0x20b8('0x73')]||0x1f4;logger[_0x20b8('0x26')](_0x20b8('0x74'),'getFields',_0x2b1413,JSON['stringify'](_0x28eed0));delete _0x28eed0[_0x20b8('0x28')];if(_0x2b1413===0x191){_0x2b1413=0x190;}_0x1327c4[_0x20b8('0x19')](_0x2b1413)[_0x20b8('0x29')](_0xcbdf4b[_0x20b8('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x28eed0[_0x20b8('0x73')]}:_0x28eed0);});};
\ No newline at end of file
+var _0x3b1f=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','destroy','params','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','GET','POST','login','result','token','success','describe','autogenerated','reference','remove','includes','false','startsWith','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','map','VtigerAccount','type','key'];(function(_0x2c1cde,_0xfa16c2){var _0x4fa7b8=function(_0x2ed28b){while(--_0x2ed28b){_0x2c1cde['push'](_0x2c1cde['shift']());}};_0x4fa7b8(++_0xfa16c2);}(_0x3b1f,0x198));var _0xf3b1=function(_0x4082f2,_0x139bc7){_0x4082f2=_0x4082f2-0x0;var _0x47168b=_0x3b1f[_0x4082f2];return _0x47168b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf3b1('0x0'));var zipdir=require(_0xf3b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf3b1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf3b1('0x3'));var util=require(_0xf3b1('0x4'));var path=require(_0xf3b1('0x5'));var sox=require('sox');var csv=require(_0xf3b1('0x6'));var ejs=require(_0xf3b1('0x7'));var fs=require('fs');var fs_extra=require(_0xf3b1('0x8'));var _=require('lodash');var squel=require(_0xf3b1('0x9'));var crypto=require('crypto');var jsforce=require(_0xf3b1('0xa'));var deskjs=require(_0xf3b1('0xb'));var toCsv=require(_0xf3b1('0x6'));var querystring=require(_0xf3b1('0xc'));var Papa=require(_0xf3b1('0xd'));var Redis=require('ioredis');var authService=require(_0xf3b1('0xe'));var qs=require(_0xf3b1('0xf'));var as=require(_0xf3b1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3b1('0x11'))(_0xf3b1('0x12'));var utils=require('../../config/utils');var config=require(_0xf3b1('0x13'));var licenseUtil=require(_0xf3b1('0x14'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5a79cc,_0x43025c){_0x43025c=_0x43025c||0xcc;return function(_0x4fba46){if(_0x4fba46){return _0x5a79cc[_0xf3b1('0x15')](_0x43025c);}return _0x5a79cc[_0xf3b1('0x16')](_0x43025c)['end']();};}function respondWithResult(_0x1796a0,_0x4b0862){_0x4b0862=_0x4b0862||0xc8;return function(_0x1298f3){if(_0x1298f3){return _0x1796a0[_0xf3b1('0x16')](_0x4b0862)[_0xf3b1('0x17')](_0x1298f3);}};}function respondWithFilteredResult(_0x907e0e,_0x5b0007){return function(_0x182f5d){if(_0x182f5d){var _0xb81464=typeof _0x5b0007['offset']===_0xf3b1('0x18')&&typeof _0x5b0007[_0xf3b1('0x19')]===_0xf3b1('0x18');var _0x3eadf8=_0x182f5d[_0xf3b1('0x1a')];var _0x337d1a=_0xb81464?0x0:_0x5b0007[_0xf3b1('0x1b')];var _0xcc61b1=_0xb81464?_0x182f5d[_0xf3b1('0x1a')]:_0x5b0007[_0xf3b1('0x1b')]+_0x5b0007[_0xf3b1('0x19')];var _0x262179;if(_0xcc61b1>=_0x3eadf8){_0xcc61b1=_0x3eadf8;_0x262179=0xc8;}else{_0x262179=0xce;}_0x907e0e[_0xf3b1('0x16')](_0x262179);return _0x907e0e[_0xf3b1('0x1c')](_0xf3b1('0x1d'),_0x337d1a+'-'+_0xcc61b1+'/'+_0x3eadf8)['json'](_0x182f5d);}return null;};}function patchUpdates(_0xcc4b5b){return function(_0x32972a){try{jsonpatch[_0xf3b1('0x1e')](_0x32972a,_0xcc4b5b,!![]);}catch(_0x17fe0d){return BPromise[_0xf3b1('0x1f')](_0x17fe0d);}return _0x32972a['save']();};}function saveUpdates(_0x4f9cb3,_0xf749b3){return function(_0xd5e2f){if(_0xd5e2f){return _0xd5e2f[_0xf3b1('0x20')](_0x4f9cb3)[_0xf3b1('0x21')](function(_0x3ee33c){return _0x3ee33c;});}return null;};}function removeEntity(_0x28e440,_0x484e97){return function(_0x2d0971){if(_0x2d0971){return _0x2d0971['destroy']()[_0xf3b1('0x21')](function(){_0x28e440[_0xf3b1('0x16')](0xcc)[_0xf3b1('0x22')]();});}};}function handleEntityNotFound(_0x3b246f,_0x3dbce7){return function(_0x19c197){if(!_0x19c197){_0x3b246f[_0xf3b1('0x15')](0x194);}return _0x19c197;};}function handleError(_0x45fe55,_0x24df8f){_0x24df8f=_0x24df8f||0x1f4;return function(_0x44c809){logger[_0xf3b1('0x23')](_0x44c809[_0xf3b1('0x24')]);if(_0x44c809['name']){delete _0x44c809[_0xf3b1('0x25')];}_0x45fe55[_0xf3b1('0x16')](_0x24df8f)[_0xf3b1('0x26')](_0x44c809);};}exports[_0xf3b1('0x27')]=function(_0x31f0f3,_0x636a35){var _0x1a99e9={},_0x28ab34={},_0x35b6dd={'count':0x0,'rows':[]};var _0xf2567=_[_0xf3b1('0x28')](db[_0xf3b1('0x29')]['rawAttributes'],function(_0x39c0f4){return{'name':_0x39c0f4['fieldName'],'type':_0x39c0f4[_0xf3b1('0x2a')][_0xf3b1('0x2b')]};});_0x28ab34['model']=_[_0xf3b1('0x28')](_0xf2567,'name');_0x28ab34[_0xf3b1('0x2c')]=_[_0xf3b1('0x2d')](_0x31f0f3[_0xf3b1('0x2c')]);_0x28ab34[_0xf3b1('0x2e')]=_[_0xf3b1('0x2f')](_0x28ab34[_0xf3b1('0x30')],_0x28ab34[_0xf3b1('0x2c')]);_0x1a99e9[_0xf3b1('0x31')]=_[_0xf3b1('0x2f')](_0x28ab34['model'],qs[_0xf3b1('0x32')](_0x31f0f3[_0xf3b1('0x2c')][_0xf3b1('0x32')]));_0x1a99e9['attributes']=_0x1a99e9[_0xf3b1('0x31')][_0xf3b1('0x33')]?_0x1a99e9[_0xf3b1('0x31')]:_0x28ab34[_0xf3b1('0x30')];if(!_0x31f0f3[_0xf3b1('0x2c')][_0xf3b1('0x34')](_0xf3b1('0x35'))){_0x1a99e9[_0xf3b1('0x19')]=qs[_0xf3b1('0x19')](_0x31f0f3[_0xf3b1('0x2c')][_0xf3b1('0x19')]);_0x1a99e9[_0xf3b1('0x1b')]=qs[_0xf3b1('0x1b')](_0x31f0f3['query']['offset']);}_0x1a99e9[_0xf3b1('0x36')]=qs[_0xf3b1('0x37')](_0x31f0f3[_0xf3b1('0x2c')][_0xf3b1('0x37')]);_0x1a99e9[_0xf3b1('0x38')]=qs['filters'](_['pick'](_0x31f0f3[_0xf3b1('0x2c')],_0x28ab34['filters']),_0xf2567);if(_0x31f0f3['query'][_0xf3b1('0x39')]){_0x1a99e9[_0xf3b1('0x38')]=_['merge'](_0x1a99e9['where'],{'$or':_[_0xf3b1('0x28')](_0xf2567,function(_0x4621ca){if(_0x4621ca[_0xf3b1('0x2a')]!=='VIRTUAL'){var _0x5a8bf0={};_0x5a8bf0[_0x4621ca['name']]={'$like':'%'+_0x31f0f3[_0xf3b1('0x2c')]['filter']+'%'};return _0x5a8bf0;}})});}_0x1a99e9=_[_0xf3b1('0x3a')]({},_0x1a99e9,_0x31f0f3[_0xf3b1('0x3b')]);var _0x38673c={'where':_0x1a99e9[_0xf3b1('0x38')]};return db[_0xf3b1('0x29')][_0xf3b1('0x1a')](_0x38673c)['then'](function(_0x2a01cd){_0x35b6dd[_0xf3b1('0x1a')]=_0x2a01cd;if(_0x31f0f3[_0xf3b1('0x2c')][_0xf3b1('0x3c')]){_0x1a99e9[_0xf3b1('0x3d')]=[{'all':!![]}];}return db[_0xf3b1('0x29')][_0xf3b1('0x3e')](_0x1a99e9);})[_0xf3b1('0x21')](function(_0x33e68e){_0x35b6dd[_0xf3b1('0x3f')]=_0x33e68e;return _0x35b6dd;})[_0xf3b1('0x21')](respondWithFilteredResult(_0x636a35,_0x1a99e9))['catch'](handleError(_0x636a35,null));};exports[_0xf3b1('0x40')]=function(_0x308478,_0x5cd4ca){var _0x19cede={'raw':![],'where':{'id':_0x308478['params']['id']}},_0x5e0e44={};_0x5e0e44[_0xf3b1('0x30')]=_['keys'](db[_0xf3b1('0x29')][_0xf3b1('0x41')]);_0x5e0e44['query']=_[_0xf3b1('0x2d')](_0x308478[_0xf3b1('0x2c')]);_0x5e0e44[_0xf3b1('0x2e')]=_[_0xf3b1('0x2f')](_0x5e0e44[_0xf3b1('0x30')],_0x5e0e44[_0xf3b1('0x2c')]);_0x19cede[_0xf3b1('0x31')]=_[_0xf3b1('0x2f')](_0x5e0e44[_0xf3b1('0x30')],qs['fields'](_0x308478[_0xf3b1('0x2c')]['fields']));_0x19cede[_0xf3b1('0x31')]=_0x19cede['attributes']['length']?_0x19cede[_0xf3b1('0x31')]:_0x5e0e44[_0xf3b1('0x30')];if(_0x308478['query'][_0xf3b1('0x3c')]){_0x19cede[_0xf3b1('0x3d')]=[{'all':!![]}];}_0x19cede=_[_0xf3b1('0x3a')]({},_0x19cede,_0x308478['options']);return db[_0xf3b1('0x29')][_0xf3b1('0x42')](_0x19cede)['then'](handleEntityNotFound(_0x5cd4ca,null))[_0xf3b1('0x21')](respondWithResult(_0x5cd4ca,null))[_0xf3b1('0x43')](handleError(_0x5cd4ca,null));};exports[_0xf3b1('0x44')]=function(_0x44dcd2,_0x1d9748){return db['VtigerAccount'][_0xf3b1('0x44')](_0x44dcd2[_0xf3b1('0x45')],{})[_0xf3b1('0x21')](respondWithResult(_0x1d9748,0xc9))['catch'](handleError(_0x1d9748,null));};exports[_0xf3b1('0x20')]=function(_0x36fe32,_0x475054){if(_0x36fe32['body']['id']){delete _0x36fe32[_0xf3b1('0x45')]['id'];}return db[_0xf3b1('0x29')][_0xf3b1('0x42')]({'where':{'id':_0x36fe32['params']['id']}})[_0xf3b1('0x21')](handleEntityNotFound(_0x475054,null))[_0xf3b1('0x21')](saveUpdates(_0x36fe32[_0xf3b1('0x45')],null))['then'](respondWithResult(_0x475054,null))[_0xf3b1('0x43')](handleError(_0x475054,null));};exports[_0xf3b1('0x46')]=function(_0x86e9fd,_0x447635){return db['VtigerAccount'][_0xf3b1('0x42')]({'where':{'id':_0x86e9fd[_0xf3b1('0x47')]['id']}})[_0xf3b1('0x21')](handleEntityNotFound(_0x447635,null))[_0xf3b1('0x21')](removeEntity(_0x447635,null))['catch'](handleError(_0x447635,null));};exports[_0xf3b1('0x48')]=function(_0x1c8f52,_0xe4a709,_0x409f38){var _0x2a126c={};var _0x30c57a={};var _0x3de712;var _0x397125;return db[_0xf3b1('0x29')][_0xf3b1('0x49')]({'where':{'id':_0x1c8f52[_0xf3b1('0x47')]['id']}})[_0xf3b1('0x21')](handleEntityNotFound(_0xe4a709,null))[_0xf3b1('0x21')](function(_0x53d119){if(_0x53d119){_0x3de712=_0x53d119;_0x30c57a['model']=_['keys'](db[_0xf3b1('0x4a')][_0xf3b1('0x41')]);_0x30c57a['query']=_[_0xf3b1('0x2d')](_0x1c8f52[_0xf3b1('0x2c')]);_0x30c57a['filters']=_['intersection'](_0x30c57a[_0xf3b1('0x30')],_0x30c57a['query']);_0x2a126c[_0xf3b1('0x31')]=_[_0xf3b1('0x2f')](_0x30c57a['model'],qs[_0xf3b1('0x32')](_0x1c8f52[_0xf3b1('0x2c')][_0xf3b1('0x32')]));_0x2a126c[_0xf3b1('0x31')]=_0x2a126c['attributes']['length']?_0x2a126c[_0xf3b1('0x31')]:_0x30c57a[_0xf3b1('0x30')];_0x2a126c['order']=qs[_0xf3b1('0x37')](_0x1c8f52[_0xf3b1('0x2c')][_0xf3b1('0x37')]);_0x2a126c['where']=qs[_0xf3b1('0x2e')](_['pick'](_0x1c8f52[_0xf3b1('0x2c')],_0x30c57a[_0xf3b1('0x2e')]));if(_0x1c8f52['query'][_0xf3b1('0x39')]){_0x2a126c[_0xf3b1('0x38')]=_[_0xf3b1('0x3a')](_0x2a126c[_0xf3b1('0x38')],{'$or':_[_0xf3b1('0x28')](_0x2a126c[_0xf3b1('0x31')],function(_0x2495ce){var _0x3f75d5={};_0x3f75d5[_0x2495ce]={'$like':'%'+_0x1c8f52[_0xf3b1('0x2c')][_0xf3b1('0x39')]+'%'};return _0x3f75d5;})});}_0x2a126c=_[_0xf3b1('0x3a')]({},_0x2a126c,_0x1c8f52[_0xf3b1('0x3b')]);return _0x3de712['getConfigurations'](_0x2a126c);}})['then'](function(_0x443775){if(_0x443775){_0x397125=_0x443775[_0xf3b1('0x33')];if(!_0x1c8f52[_0xf3b1('0x2c')][_0xf3b1('0x34')](_0xf3b1('0x35'))){_0x2a126c['limit']=qs[_0xf3b1('0x19')](_0x1c8f52[_0xf3b1('0x2c')]['limit']);_0x2a126c['offset']=qs[_0xf3b1('0x1b')](_0x1c8f52[_0xf3b1('0x2c')][_0xf3b1('0x1b')]);}return _0x3de712['getConfigurations'](_0x2a126c);}})[_0xf3b1('0x21')](function(_0x5530bb){if(_0x5530bb){return _0x5530bb?{'count':_0x397125,'rows':_0x5530bb}:null;}})[_0xf3b1('0x21')](respondWithResult(_0xe4a709,null))[_0xf3b1('0x43')](handleError(_0xe4a709,null));};exports[_0xf3b1('0x4b')]=function(_0x1f17ce,_0xdad598,_0x1e8846){if(_0x1f17ce[_0xf3b1('0x45')]['id']){delete _0x1f17ce[_0xf3b1('0x45')]['id'];}return db['VtigerAccount'][_0xf3b1('0x49')]({'where':{'id':_0x1f17ce[_0xf3b1('0x47')]['id']}})['then'](handleEntityNotFound(_0xdad598,null))[_0xf3b1('0x21')](function(_0x12fb3e){if(_0x12fb3e){_0x1f17ce['body'][_0xf3b1('0x4c')]=_0x12fb3e['id'];_0x1f17ce[_0xf3b1('0x45')][_0xf3b1('0x4d')]=integrations[_0xf3b1('0x4e')](_0x1f17ce[_0xf3b1('0x45')][_0xf3b1('0x4f')],_0x1f17ce[_0xf3b1('0x45')][_0xf3b1('0x2a')]);_0x1f17ce[_0xf3b1('0x45')][_0xf3b1('0x50')]=integrations[_0xf3b1('0x51')](_0x1f17ce[_0xf3b1('0x45')][_0xf3b1('0x4f')],_0x1f17ce[_0xf3b1('0x45')][_0xf3b1('0x2a')]);return db[_0xf3b1('0x4a')][_0xf3b1('0x44')](_0x1f17ce[_0xf3b1('0x45')],{'include':[{'model':db[_0xf3b1('0x52')],'as':_0xf3b1('0x4d')},{'model':db[_0xf3b1('0x52')],'as':_0xf3b1('0x50')}]});}return null;})['then'](respondWithResult(_0xdad598,null))[_0xf3b1('0x43')](handleError(_0xdad598,null));};var md5=require('md5');exports['getFields']=function(_0x139a43,_0x3dac2a,_0xa0d9c8){var _0xcef89a=null;var _0x17f209=null;var _0x3e7b05=null;var _0x560c8f=null;var _0x4a9a04='';return db[_0xf3b1('0x29')]['findOne']({'where':{'id':_0x139a43[_0xf3b1('0x47')]['id']},'attributes':['id','name',_0xf3b1('0x53'),_0xf3b1('0x54'),'moduleName',_0xf3b1('0x55'),_0xf3b1('0x56'),_0xf3b1('0x57')]})[_0xf3b1('0x21')](handleEntityNotFound(_0x3dac2a,null))[_0xf3b1('0x21')](function(_0x5e8296){if(_0x5e8296){_0xcef89a=_0x5e8296['username'];_0x17f209=_0x5e8296[_0xf3b1('0x57')];_0x3e7b05=_0x5e8296[_0xf3b1('0x58')];_0x4a9a04=_0x5e8296['remoteUri'];var _0x2b7fa4=_0x4a9a04[_0xf3b1('0x59')](-0x1);if(_0x2b7fa4==='/'){_0x4a9a04=_0x4a9a04[_0xf3b1('0x5a')](0x0,_0x4a9a04['lastIndexOf'](_0x2b7fa4));}_0x560c8f=util['format']('%s/webservice.php',_0x4a9a04);var _0x9f0b99={'method':_0xf3b1('0x5b'),'uri':_0x560c8f,'qs':{'operation':'getchallenge','username':_0x5e8296['username']},'json':!![]};return rp(_0x9f0b99);}})[_0xf3b1('0x21')](function(_0x12e561){if(_0x12e561['success']){var _0x5ae8a9={'method':_0xf3b1('0x5c'),'uri':_0x560c8f,'form':{'operation':_0xf3b1('0x5d'),'username':_0xcef89a,'accessKey':md5(_0x12e561[_0xf3b1('0x5e')][_0xf3b1('0x5f')]+_0x17f209)},'json':!![]};return rp(_0x5ae8a9);}})[_0xf3b1('0x21')](function(_0xb45a89){if(_0xb45a89[_0xf3b1('0x60')]){var _0x29ab3b={'method':_0xf3b1('0x5b'),'uri':_0x560c8f,'qs':{'operation':_0xf3b1('0x61'),'username':_0xcef89a,'sessionName':_0xb45a89[_0xf3b1('0x5e')]['sessionName'],'elementType':_0x3e7b05},'json':!![]};return rp(_0x29ab3b);}})[_0xf3b1('0x21')](function(_0x4dd534){if(_0x4dd534[_0xf3b1('0x60')]){var _0x5c5161=[_0xf3b1('0x62'),_0xf3b1('0x63'),'owner'];_[_0xf3b1('0x64')](_0x4dd534[_0xf3b1('0x5e')]['fields'],function(_0x134baa){return _0x5c5161[_0xf3b1('0x65')](_0x134baa[_0xf3b1('0x2a')][_0xf3b1('0x25')]);});_[_0xf3b1('0x64')](_0x4dd534['result'][_0xf3b1('0x32')],function(_0x8aa6ab){return _0x8aa6ab['editable']===_0xf3b1('0x66');});return{'count':_0x4dd534[_0xf3b1('0x5e')]['fields'][_0xf3b1('0x33')],'rows':_[_0xf3b1('0x28')](_0x4dd534[_0xf3b1('0x5e')][_0xf3b1('0x32')],function(_0x2661e0){return{'id':_0x2661e0[_0xf3b1('0x25')],'name':_0x2661e0['label'],'custom':_[_0xf3b1('0x67')](_0x2661e0[_0xf3b1('0x25')],'cf_')?!![]:![],'options':_0x2661e0['type'][_0xf3b1('0x25')]==='picklist'&&_0x2661e0[_0xf3b1('0x2a')][_0xf3b1('0x68')]['length']>0x0?_[_0xf3b1('0x28')](_0x2661e0['type']['picklistValues'],function(_0x7a75e0){return{'name':_0x7a75e0[_0xf3b1('0x69')],'value':_0x7a75e0[_0xf3b1('0x6a')]};}):[]};})};}})[_0xf3b1('0x21')](respondWithResult(_0x3dac2a,null))['catch'](function(_0x44953f){console[_0xf3b1('0x6b')](_0xf3b1('0x6c')+_0x44953f);var _0x47b4d0=_0x139a43[_0xf3b1('0x2c')][_0xf3b1('0x6d')]?0x1f4:_0x44953f[_0xf3b1('0x6e')]||0x1f4;logger[_0xf3b1('0x23')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x47b4d0,JSON[_0xf3b1('0x6f')](_0x44953f));delete _0x44953f['name'];if(_0x47b4d0===0x191){_0x47b4d0=0x190;}_0x3dac2a[_0xf3b1('0x16')](_0x47b4d0)[_0xf3b1('0x26')](_0x139a43[_0xf3b1('0x2c')]['test']?{'message':_0xf3b1('0x70'),'statusCode':_0x44953f[_0xf3b1('0x6e')]}:_0x44953f);});};
\ No newline at end of file
index b2a8421..c91d427 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8a62=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x58d29e,_0x2acbe2){var _0x41908a=function(_0x118f83){while(--_0x118f83){_0x58d29e['push'](_0x58d29e['shift']());}};_0x41908a(++_0x2acbe2);}(_0x8a62,0x19c));var _0x28a6=function(_0x46a97e,_0x2cfbc7){_0x46a97e=_0x46a97e-0x0;var _0x5e4d6d=_0x8a62[_0x46a97e];return _0x5e4d6d;};'use strict';var _=require(_0x28a6('0x0'));var util=require(_0x28a6('0x1'));var logger=require(_0x28a6('0x2'))(_0x28a6('0x3'));var moment=require(_0x28a6('0x4'));var BPromise=require(_0x28a6('0x5'));var rp=require(_0x28a6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28a6('0x7'));var config=require(_0x28a6('0x8'));var attributes=require(_0x28a6('0x9'));var integrations=require(_0x28a6('0xa'));module[_0x28a6('0xb')]=function(_0x443ba0,_0x1a5bd3){return _0x443ba0[_0x28a6('0xc')](_0x28a6('0xd'),attributes,{'tableName':_0x28a6('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd905=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','lodash','util'];(function(_0x2fc16a,_0x43e559){var _0x4e9733=function(_0x5a81df){while(--_0x5a81df){_0x2fc16a['push'](_0x2fc16a['shift']());}};_0x4e9733(++_0x43e559);}(_0xd905,0x150));var _0x5d90=function(_0x1e71b8,_0x2ba29c){_0x1e71b8=_0x1e71b8-0x0;var _0x32f86e=_0xd905[_0x1e71b8];return _0x32f86e;};'use strict';var _=require(_0x5d90('0x0'));var util=require(_0x5d90('0x1'));var logger=require(_0x5d90('0x2'))(_0x5d90('0x3'));var moment=require('moment');var BPromise=require(_0x5d90('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d90('0x5'));var rimraf=require(_0x5d90('0x6'));var config=require(_0x5d90('0x7'));var attributes=require(_0x5d90('0x8'));var integrations=require(_0x5d90('0x9'));module[_0x5d90('0xa')]=function(_0xe2a32c,_0x4a0c22){return _0xe2a32c[_0x5d90('0xb')](_0x5d90('0xc'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index de219df..7381d25 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f68=['info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','attributes','limit','include','map','model','ShowVtigerAccount','find','where','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x2015f5,_0x3df0a2){var _0x1ac6d1=function(_0xde176c){while(--_0xde176c){_0x2015f5['push'](_0x2015f5['shift']());}};_0x1ac6d1(++_0x3df0a2);}(_0x2f68,0x9a));var _0x82f6=function(_0x36e1c8,_0x4e224c){_0x36e1c8=_0x36e1c8-0x0;var _0x5345dd=_0x2f68[_0x36e1c8];return _0x5345dd;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82f6('0x5'))(_0x82f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x82f6('0x7'));var client=jayson[_0x82f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a8089,_0x1bc0be,_0x5660bf){return new BPromise(function(_0x5daa3c,_0x864400){return client[_0x82f6('0x9')](_0x5a8089,_0x5660bf)[_0x82f6('0xa')](function(_0x5ee0e5){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');logger[_0x82f6('0xd')](_0x82f6('0xe'),_0x1bc0be,_0x82f6('0xf'),JSON[_0x82f6('0x10')](_0x5ee0e5));if(_0x5ee0e5[_0x82f6('0x11')]){if(_0x5ee0e5[_0x82f6('0x11')]['code']===0x1f4){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5['error'][_0x82f6('0x12')]);return _0x864400(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);return _0x5daa3c(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}else{logger['info'](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');_0x5daa3c(_0x5ee0e5[_0x82f6('0x13')][_0x82f6('0x12')]);}})[_0x82f6('0x14')](function(_0x1033d3){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x1033d3);_0x864400(_0x1033d3);});});}exports[_0x82f6('0x15')]=function(_0xcbc95f){var _0x4072f0=this;return new Promise(function(_0x2bfd57,_0x1c79f9){return db[_0x82f6('0x16')][_0x82f6('0x17')]({'raw':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f[_0x82f6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f[_0x82f6('0x18')]['where']||null:null,'attributes':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f[_0x82f6('0x18')][_0x82f6('0x19')]||null:null,'limit':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f['options'][_0x82f6('0x1a')]||null:null,'include':_0xcbc95f['options']?_0xcbc95f[_0x82f6('0x18')][_0x82f6('0x1b')]?_['map'](_0xcbc95f['options'][_0x82f6('0x1b')],function(_0x1d96d5){return{'model':db[_0x1d96d5['model']],'as':_0x1d96d5['as'],'attributes':_0x1d96d5['attributes'],'include':_0x1d96d5[_0x82f6('0x1b')]?_[_0x82f6('0x1c')](_0x1d96d5['include'],function(_0xfd8b68){return{'model':db[_0xfd8b68[_0x82f6('0x1d')]],'as':_0xfd8b68['as'],'attributes':_0xfd8b68['attributes'],'include':_0xfd8b68['include']?_[_0x82f6('0x1c')](_0xfd8b68['include'],function(_0x469b6b){return{'model':db[_0x469b6b[_0x82f6('0x1d')]],'as':_0x469b6b['as'],'attributes':_0x469b6b['attributes']};}):[]};}):[]};}):[]:[]})[_0x82f6('0xa')](function(_0x15c9b7){logger[_0x82f6('0xb')](_0x82f6('0x15'),_0xcbc95f);logger['debug'](_0x82f6('0x15'),_0xcbc95f,JSON[_0x82f6('0x10')](_0x15c9b7));_0x2bfd57(_0x15c9b7);})[_0x82f6('0x14')](function(_0x400137){logger[_0x82f6('0x11')](_0x82f6('0x15'),_0x400137[_0x82f6('0x12')],_0xcbc95f);_0x1c79f9(_0x4072f0[_0x82f6('0x11')](0x1f4,_0x400137[_0x82f6('0x12')]));});});};exports[_0x82f6('0x1e')]=function(_0x3c9419){var _0x20d1c5=this;return new Promise(function(_0x6ce179,_0x91117b){return db['VtigerAccount'][_0x82f6('0x1f')]({'raw':_0x3c9419[_0x82f6('0x18')]?_0x3c9419[_0x82f6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3c9419[_0x82f6('0x18')]?_0x3c9419[_0x82f6('0x18')][_0x82f6('0x20')]||null:null,'attributes':_0x3c9419[_0x82f6('0x18')]?_0x3c9419[_0x82f6('0x18')][_0x82f6('0x19')]||null:null,'include':_0x3c9419[_0x82f6('0x18')]?_0x3c9419[_0x82f6('0x18')][_0x82f6('0x1b')]?_[_0x82f6('0x1c')](_0x3c9419[_0x82f6('0x18')][_0x82f6('0x1b')],function(_0x1e028a){return{'model':db[_0x1e028a[_0x82f6('0x1d')]],'as':_0x1e028a['as'],'attributes':_0x1e028a['attributes'],'include':_0x1e028a[_0x82f6('0x1b')]?_[_0x82f6('0x1c')](_0x1e028a[_0x82f6('0x1b')],function(_0x276451){return{'model':db[_0x276451[_0x82f6('0x1d')]],'as':_0x276451['as'],'attributes':_0x276451[_0x82f6('0x19')],'include':_0x276451[_0x82f6('0x1b')]?_[_0x82f6('0x1c')](_0x276451[_0x82f6('0x1b')],function(_0x30c6f8){return{'model':db[_0x30c6f8[_0x82f6('0x1d')]],'as':_0x30c6f8['as'],'attributes':_0x30c6f8[_0x82f6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x82f6('0xa')](function(_0x34665a){logger['info'](_0x82f6('0x1e'),_0x3c9419);logger['debug']('ShowVtigerAccount',_0x3c9419,JSON[_0x82f6('0x10')](_0x34665a));_0x6ce179(_0x34665a);})[_0x82f6('0x14')](function(_0x5e8828){logger[_0x82f6('0x11')](_0x82f6('0x1e'),_0x5e8828[_0x82f6('0x12')],_0x3c9419);_0x91117b(_0x20d1c5['error'](0x1f4,_0x5e8828[_0x82f6('0x12')]));});});};
\ No newline at end of file
+var _0x2547=['../../config/logger','../../config/environment','jayson/promise','client','http','request','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowVtigerAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x229031,_0x46d7ee){var _0x1e788e=function(_0x3465bb){while(--_0x3465bb){_0x229031['push'](_0x229031['shift']());}};_0x1e788e(++_0x46d7ee);}(_0x2547,0x1cd));var _0x7254=function(_0x2aa06c,_0x3cd5d3){_0x2aa06c=_0x2aa06c-0x0;var _0x134f35=_0x2547[_0x2aa06c];return _0x134f35;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var moment=require(_0x7254('0x1'));var BPromise=require(_0x7254('0x2'));var rs=require(_0x7254('0x3'));var fs=require('fs');var Redis=require(_0x7254('0x4'));var db=require(_0x7254('0x5'))['db'];var utils=require(_0x7254('0x6'));var logger=require(_0x7254('0x7'))('rpc');var config=require(_0x7254('0x8'));var jayson=require(_0x7254('0x9'));var client=jayson[_0x7254('0xa')][_0x7254('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b845f,_0x253b1e,_0x6e3d84){return new BPromise(function(_0x395913,_0x5da1ec){return client[_0x7254('0xc')](_0x4b845f,_0x6e3d84)['then'](function(_0x50925f){logger['info'](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));logger[_0x7254('0xf')](_0x7254('0x10'),_0x253b1e,_0x7254('0xe'),JSON[_0x7254('0x11')](_0x50925f));if(_0x50925f['error']){if(_0x50925f[_0x7254('0x12')]['code']===0x1f4){logger[_0x7254('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x5da1ec(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x395913(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}else{logger[_0x7254('0x14')](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));_0x395913(_0x50925f['result'][_0x7254('0x13')]);}})[_0x7254('0x15')](function(_0xf47255){logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0xf47255);_0x5da1ec(_0xf47255);});});}exports[_0x7254('0x16')]=function(_0x2737e0){var _0x5dd23b=this;return new Promise(function(_0x1f48f6,_0x2283b7){return db[_0x7254('0x17')][_0x7254('0x18')]({'raw':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1a')]===undefined?!![]:![]:!![],'where':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1b')]||null:null,'attributes':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1c')]||null:null,'limit':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1d')]||null:null,'include':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x2737e0[_0x7254('0x19')]['include'],function(_0x493bfd){return{'model':db[_0x493bfd[_0x7254('0x20')]],'as':_0x493bfd['as'],'attributes':_0x493bfd[_0x7254('0x1c')],'include':_0x493bfd[_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x493bfd[_0x7254('0x1e')],function(_0x36b5d5){return{'model':db[_0x36b5d5[_0x7254('0x20')]],'as':_0x36b5d5['as'],'attributes':_0x36b5d5['attributes'],'include':_0x36b5d5[_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x36b5d5[_0x7254('0x1e')],function(_0x494cdb){return{'model':db[_0x494cdb[_0x7254('0x20')]],'as':_0x494cdb['as'],'attributes':_0x494cdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x7254('0x21')](function(_0x134a9e){logger['info'](_0x7254('0x16'),_0x2737e0);logger[_0x7254('0xf')]('GetVtigerAccount',_0x2737e0,JSON[_0x7254('0x11')](_0x134a9e));_0x1f48f6(_0x134a9e);})[_0x7254('0x15')](function(_0x37cb5c){logger[_0x7254('0x12')](_0x7254('0x16'),_0x37cb5c[_0x7254('0x13')],_0x2737e0);_0x2283b7(_0x5dd23b['error'](0x1f4,_0x37cb5c[_0x7254('0x13')]));});});};exports[_0x7254('0x22')]=function(_0x5569be){var _0x2f75ea=this;return new Promise(function(_0x1279cd,_0x2be5fc){return db['VtigerAccount'][_0x7254('0x23')]({'raw':_0x5569be[_0x7254('0x19')]?_0x5569be[_0x7254('0x19')][_0x7254('0x1a')]===undefined?!![]:![]:!![],'where':_0x5569be[_0x7254('0x19')]?_0x5569be[_0x7254('0x19')][_0x7254('0x1b')]||null:null,'attributes':_0x5569be['options']?_0x5569be[_0x7254('0x19')]['attributes']||null:null,'include':_0x5569be['options']?_0x5569be[_0x7254('0x19')][_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x5569be[_0x7254('0x19')][_0x7254('0x1e')],function(_0x430420){return{'model':db[_0x430420[_0x7254('0x20')]],'as':_0x430420['as'],'attributes':_0x430420[_0x7254('0x1c')],'include':_0x430420[_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x430420[_0x7254('0x1e')],function(_0x3b0abd){return{'model':db[_0x3b0abd[_0x7254('0x20')]],'as':_0x3b0abd['as'],'attributes':_0x3b0abd[_0x7254('0x1c')],'include':_0x3b0abd['include']?_[_0x7254('0x1f')](_0x3b0abd[_0x7254('0x1e')],function(_0x2ea976){return{'model':db[_0x2ea976[_0x7254('0x20')]],'as':_0x2ea976['as'],'attributes':_0x2ea976[_0x7254('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x140bb2){logger['info'](_0x7254('0x22'),_0x5569be);logger[_0x7254('0xf')](_0x7254('0x22'),_0x5569be,JSON[_0x7254('0x11')](_0x140bb2));_0x1279cd(_0x140bb2);})[_0x7254('0x15')](function(_0x4e6213){logger[_0x7254('0x12')]('ShowVtigerAccount',_0x4e6213[_0x7254('0x13')],_0x5569be);_0x2be5fc(_0x2f75ea[_0x7254('0x12')](0x1f4,_0x4e6213['message']));});});};
\ No newline at end of file
index c27df4d..18eab64 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x20ab=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x20ab,0x15b));var _0xb20a=function(_0x139ff6,_0xddca5){_0x139ff6=_0x139ff6-0x0;var _0x71b083=_0x20ab[_0x139ff6];return _0x71b083;};'use strict';var multer=require(_0xb20a('0x0'));var util=require(_0xb20a('0x1'));var path=require('path');var timeout=require(_0xb20a('0x2'));var express=require('express');var router=express[_0xb20a('0x3')]();var fs_extra=require(_0xb20a('0x4'));var auth=require(_0xb20a('0x5'));var interaction=require(_0xb20a('0x6'));var config=require(_0xb20a('0x7'));var controller=require(_0xb20a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb20a('0x9')]);router[_0xb20a('0xa')](_0xb20a('0xb'),auth[_0xb20a('0xc')](),controller['show']);router[_0xb20a('0xa')](_0xb20a('0xd'),auth[_0xb20a('0xc')](),controller[_0xb20a('0xe')]);router[_0xb20a('0xa')](_0xb20a('0xf'),auth[_0xb20a('0xc')](),controller[_0xb20a('0x10')]);router[_0xb20a('0xa')](_0xb20a('0x11'),auth[_0xb20a('0xc')](),controller[_0xb20a('0x12')]);router[_0xb20a('0x13')]('/',auth[_0xb20a('0xc')](),controller[_0xb20a('0x14')]);router[_0xb20a('0x15')](_0xb20a('0xb'),auth[_0xb20a('0xc')](),controller[_0xb20a('0x16')]);router['delete'](_0xb20a('0xb'),auth[_0xb20a('0xc')](),controller[_0xb20a('0x17')]);module[_0xb20a('0x18')]=router;
\ No newline at end of file
+var _0x4f27=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','/:id','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x52e524,_0x26e405){var _0x3e911d=function(_0x461456){while(--_0x461456){_0x52e524['push'](_0x52e524['shift']());}};_0x3e911d(++_0x26e405);}(_0x4f27,0x126));var _0x74f2=function(_0x383d5b,_0x1a2ad3){_0x383d5b=_0x383d5b-0x0;var _0x4d6f16=_0x4f27[_0x383d5b];return _0x4d6f16;};'use strict';var multer=require(_0x74f2('0x0'));var util=require(_0x74f2('0x1'));var path=require(_0x74f2('0x2'));var timeout=require(_0x74f2('0x3'));var express=require(_0x74f2('0x4'));var router=express[_0x74f2('0x5')]();var fs_extra=require(_0x74f2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x74f2('0x7'));var config=require(_0x74f2('0x8'));var controller=require(_0x74f2('0x9'));router[_0x74f2('0xa')]('/',auth[_0x74f2('0xb')](),controller['index']);router[_0x74f2('0xa')]('/:id',auth[_0x74f2('0xb')](),controller[_0x74f2('0xc')]);router['get'](_0x74f2('0xd'),auth[_0x74f2('0xb')](),controller[_0x74f2('0xe')]);router[_0x74f2('0xa')](_0x74f2('0xf'),auth['isAuthenticated'](),controller[_0x74f2('0x10')]);router[_0x74f2('0xa')]('/:id/descriptions',auth[_0x74f2('0xb')](),controller[_0x74f2('0x11')]);router[_0x74f2('0x12')]('/',auth[_0x74f2('0xb')](),controller[_0x74f2('0x13')]);router['put'](_0x74f2('0x14'),auth[_0x74f2('0xb')](),controller['update']);router[_0x74f2('0x15')](_0x74f2('0x14'),auth[_0x74f2('0xb')](),controller['destroy']);module[_0x74f2('0x16')]=router;
\ No newline at end of file
index bcb84b8..7c1fdf5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaf28=['STRING','sequelize','exports'];(function(_0x142e1c,_0x5e6ba8){var _0x126353=function(_0x6c151d){while(--_0x6c151d){_0x142e1c['push'](_0x142e1c['shift']());}};_0x126353(++_0x5e6ba8);}(_0xaf28,0xd0));var _0x8af2=function(_0x855e77,_0x348ad7){_0x855e77=_0x855e77-0x0;var _0x1edd15=_0xaf28[_0x855e77];return _0x1edd15;};'use strict';var Sequelize=require(_0x8af2('0x0'));module[_0x8af2('0x1')]={'name':{'type':Sequelize[_0x8af2('0x2')]},'description':{'type':Sequelize[_0x8af2('0x2')]}};
\ No newline at end of file
+var _0xadec=['STRING','sequelize'];(function(_0x2e2f84,_0x24e46f){var _0x448191=function(_0x336e06){while(--_0x336e06){_0x2e2f84['push'](_0x2e2f84['shift']());}};_0x448191(++_0x24e46f);}(_0xadec,0x191));var _0xcade=function(_0x26ded6,_0x552c8e){_0x26ded6=_0x26ded6-0x0;var _0x227322=_0xadec[_0x26ded6];return _0x227322;};'use strict';var Sequelize=require(_0xcade('0x0'));module['exports']={'name':{'type':Sequelize[_0xcade('0x1')]},'description':{'type':Sequelize[_0xcade('0x1')]}};
\ No newline at end of file
index 78f8db4..70e3c9f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3868=['apply','reject','save','then','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','destroy','getFields','findOne','VtigerField','length','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','Content-Range','json'];(function(_0x346caa,_0x46888d){var _0x1f4548=function(_0x3e7c1b){while(--_0x3e7c1b){_0x346caa['push'](_0x346caa['shift']());}};_0x1f4548(++_0x46888d);}(_0x3868,0x1ad));var _0x8386=function(_0x21bcd6,_0x31ef4f){_0x21bcd6=_0x21bcd6-0x0;var _0x5077d5=_0x3868[_0x21bcd6];return _0x5077d5;};'use strict';var emlformat=require(_0x8386('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8386('0x1'));var jsonpatch=require(_0x8386('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8386('0x3'));var Mustache=require(_0x8386('0x4'));var util=require('util');var path=require('path');var sox=require(_0x8386('0x5'));var csv=require(_0x8386('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8386('0x7'));var squel=require(_0x8386('0x8'));var crypto=require(_0x8386('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8386('0xa'));var toCsv=require(_0x8386('0x6'));var querystring=require(_0x8386('0xb'));var Papa=require('papaparse');var Redis=require(_0x8386('0xc'));var authService=require(_0x8386('0xd'));var qs=require(_0x8386('0xe'));var as=require(_0x8386('0xf'));var hardwareService=require(_0x8386('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x8386('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x8386('0x12'));var db=require(_0x8386('0x13'))['db'];function respondWithStatusCode(_0x240569,_0x59e35b){_0x59e35b=_0x59e35b||0xcc;return function(_0x5154f3){if(_0x5154f3){return _0x240569['sendStatus'](_0x59e35b);}return _0x240569[_0x8386('0x14')](_0x59e35b)['end']();};}function respondWithResult(_0x910ce9,_0x5c66d4){_0x5c66d4=_0x5c66d4||0xc8;return function(_0x3207f0){if(_0x3207f0){return _0x910ce9['status'](_0x5c66d4)['json'](_0x3207f0);}};}function respondWithFilteredResult(_0x29b6a7,_0x54af78){return function(_0x31f039){if(_0x31f039){var _0x1a7f55=typeof _0x54af78[_0x8386('0x15')]===_0x8386('0x16')&&typeof _0x54af78[_0x8386('0x17')]===_0x8386('0x16');var _0x3c04e9=_0x31f039[_0x8386('0x18')];var _0x5707e1=_0x1a7f55?0x0:_0x54af78[_0x8386('0x15')];var _0x3ad0b8=_0x1a7f55?_0x31f039[_0x8386('0x18')]:_0x54af78[_0x8386('0x15')]+_0x54af78[_0x8386('0x17')];var _0x1798e4;if(_0x3ad0b8>=_0x3c04e9){_0x3ad0b8=_0x3c04e9;_0x1798e4=0xc8;}else{_0x1798e4=0xce;}_0x29b6a7[_0x8386('0x14')](_0x1798e4);return _0x29b6a7['set'](_0x8386('0x19'),_0x5707e1+'-'+_0x3ad0b8+'/'+_0x3c04e9)[_0x8386('0x1a')](_0x31f039);}return null;};}function patchUpdates(_0x9e23e4){return function(_0x1892fe){try{jsonpatch[_0x8386('0x1b')](_0x1892fe,_0x9e23e4,!![]);}catch(_0x23693b){return BPromise[_0x8386('0x1c')](_0x23693b);}return _0x1892fe[_0x8386('0x1d')]();};}function saveUpdates(_0x24d20a,_0x38a61e){return function(_0x45ba06){if(_0x45ba06){return _0x45ba06['update'](_0x24d20a)[_0x8386('0x1e')](function(_0x3b0aaa){return _0x3b0aaa;});}return null;};}function removeEntity(_0x22ce02,_0x1b885e){return function(_0xcecb68){if(_0xcecb68){return _0xcecb68['destroy']()['then'](function(){_0x22ce02['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ba6ac,_0x44f9c3){return function(_0x37a28b){if(!_0x37a28b){_0x3ba6ac['sendStatus'](0x194);}return _0x37a28b;};}function handleError(_0x2f6074,_0x21e108){_0x21e108=_0x21e108||0x1f4;return function(_0x4fa243){logger[_0x8386('0x1f')](_0x4fa243[_0x8386('0x20')]);if(_0x4fa243['name']){delete _0x4fa243[_0x8386('0x21')];}_0x2f6074[_0x8386('0x14')](_0x21e108)[_0x8386('0x22')](_0x4fa243);};}exports[_0x8386('0x23')]=function(_0x55562f,_0x4332eb){var _0x2fb807={},_0x108d53={},_0xdf1534={'count':0x0,'rows':[]};var _0x46acde=_['map'](db[_0x8386('0x24')][_0x8386('0x25')],function(_0x17b833){return{'name':_0x17b833[_0x8386('0x26')],'type':_0x17b833[_0x8386('0x27')][_0x8386('0x28')]};});_0x108d53[_0x8386('0x29')]=_[_0x8386('0x2a')](_0x46acde,_0x8386('0x21'));_0x108d53[_0x8386('0x2b')]=_[_0x8386('0x2c')](_0x55562f['query']);_0x108d53[_0x8386('0x2d')]=_[_0x8386('0x2e')](_0x108d53[_0x8386('0x29')],_0x108d53[_0x8386('0x2b')]);_0x2fb807[_0x8386('0x2f')]=_[_0x8386('0x2e')](_0x108d53['model'],qs[_0x8386('0x30')](_0x55562f['query'][_0x8386('0x30')]));_0x2fb807[_0x8386('0x2f')]=_0x2fb807[_0x8386('0x2f')]['length']?_0x2fb807[_0x8386('0x2f')]:_0x108d53['model'];if(!_0x55562f['query']['hasOwnProperty'](_0x8386('0x31'))){_0x2fb807[_0x8386('0x17')]=qs['limit'](_0x55562f['query']['limit']);_0x2fb807['offset']=qs['offset'](_0x55562f[_0x8386('0x2b')][_0x8386('0x15')]);}_0x2fb807[_0x8386('0x32')]=qs[_0x8386('0x33')](_0x55562f['query'][_0x8386('0x33')]);_0x2fb807[_0x8386('0x34')]=qs[_0x8386('0x2d')](_[_0x8386('0x35')](_0x55562f[_0x8386('0x2b')],_0x108d53[_0x8386('0x2d')]),_0x46acde);if(_0x55562f[_0x8386('0x2b')][_0x8386('0x36')]){_0x2fb807[_0x8386('0x34')]=_[_0x8386('0x37')](_0x2fb807[_0x8386('0x34')],{'$or':_[_0x8386('0x2a')](_0x46acde,function(_0x436988){if(_0x436988[_0x8386('0x27')]!==_0x8386('0x38')){var _0x3a6ae8={};_0x3a6ae8[_0x436988[_0x8386('0x21')]]={'$like':'%'+_0x55562f[_0x8386('0x2b')][_0x8386('0x36')]+'%'};return _0x3a6ae8;}})});}_0x2fb807=_[_0x8386('0x37')]({},_0x2fb807,_0x55562f[_0x8386('0x39')]);var _0xbcc40={'where':_0x2fb807[_0x8386('0x34')]};return db[_0x8386('0x24')][_0x8386('0x18')](_0xbcc40)['then'](function(_0x5716cc){_0xdf1534[_0x8386('0x18')]=_0x5716cc;if(_0x55562f[_0x8386('0x2b')][_0x8386('0x3a')]){_0x2fb807[_0x8386('0x3b')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x2fb807);})[_0x8386('0x1e')](function(_0x53c975){_0xdf1534[_0x8386('0x3c')]=_0x53c975;return _0xdf1534;})[_0x8386('0x1e')](respondWithFilteredResult(_0x4332eb,_0x2fb807))[_0x8386('0x3d')](handleError(_0x4332eb,null));};exports[_0x8386('0x3e')]=function(_0x3c58af,_0x533c16){var _0x31fdbe={'raw':![],'where':{'id':_0x3c58af[_0x8386('0x3f')]['id']}},_0x12dbe4={};_0x12dbe4[_0x8386('0x29')]=_['keys'](db[_0x8386('0x24')][_0x8386('0x25')]);_0x12dbe4[_0x8386('0x2b')]=_['keys'](_0x3c58af[_0x8386('0x2b')]);_0x12dbe4['filters']=_[_0x8386('0x2e')](_0x12dbe4[_0x8386('0x29')],_0x12dbe4[_0x8386('0x2b')]);_0x31fdbe['attributes']=_[_0x8386('0x2e')](_0x12dbe4['model'],qs['fields'](_0x3c58af[_0x8386('0x2b')][_0x8386('0x30')]));_0x31fdbe[_0x8386('0x2f')]=_0x31fdbe[_0x8386('0x2f')]['length']?_0x31fdbe[_0x8386('0x2f')]:_0x12dbe4[_0x8386('0x29')];if(_0x3c58af['query'][_0x8386('0x3a')]){_0x31fdbe[_0x8386('0x3b')]=[{'all':!![]}];}_0x31fdbe=_[_0x8386('0x37')]({},_0x31fdbe,_0x3c58af[_0x8386('0x39')]);return db[_0x8386('0x24')][_0x8386('0x40')](_0x31fdbe)[_0x8386('0x1e')](handleEntityNotFound(_0x533c16,null))[_0x8386('0x1e')](respondWithResult(_0x533c16,null))[_0x8386('0x3d')](handleError(_0x533c16,null));};exports[_0x8386('0x41')]=function(_0x55d03b,_0x5ebcd7){return db[_0x8386('0x24')][_0x8386('0x41')](_0x55d03b[_0x8386('0x42')],{})[_0x8386('0x1e')](respondWithResult(_0x5ebcd7,0xc9))[_0x8386('0x3d')](handleError(_0x5ebcd7,null));};exports[_0x8386('0x43')]=function(_0xf91000,_0x1966e){if(_0xf91000[_0x8386('0x42')]['id']){delete _0xf91000[_0x8386('0x42')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0xf91000[_0x8386('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1966e,null))['then'](saveUpdates(_0xf91000[_0x8386('0x42')],null))[_0x8386('0x1e')](respondWithResult(_0x1966e,null))[_0x8386('0x3d')](handleError(_0x1966e,null));};exports[_0x8386('0x44')]=function(_0x393f60,_0x5dfc5b){return db[_0x8386('0x24')][_0x8386('0x40')]({'where':{'id':_0x393f60[_0x8386('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5dfc5b,null))[_0x8386('0x1e')](removeEntity(_0x5dfc5b,null))[_0x8386('0x3d')](handleError(_0x5dfc5b,null));};exports[_0x8386('0x45')]=function(_0x55d7a7,_0x31a19c,_0x5804fd){var _0x5a7dca={};var _0x13aa24={};var _0x70c9c6;var _0x1ea8dc;return db[_0x8386('0x24')][_0x8386('0x46')]({'where':{'id':_0x55d7a7[_0x8386('0x3f')]['id']}})[_0x8386('0x1e')](handleEntityNotFound(_0x31a19c,null))[_0x8386('0x1e')](function(_0x1f57c3){if(_0x1f57c3){_0x70c9c6=_0x1f57c3;_0x13aa24['model']=_['keys'](db[_0x8386('0x47')][_0x8386('0x25')]);_0x13aa24[_0x8386('0x2b')]=_[_0x8386('0x2c')](_0x55d7a7[_0x8386('0x2b')]);_0x13aa24['filters']=_['intersection'](_0x13aa24['model'],_0x13aa24[_0x8386('0x2b')]);_0x5a7dca[_0x8386('0x2f')]=_[_0x8386('0x2e')](_0x13aa24['model'],qs['fields'](_0x55d7a7['query'][_0x8386('0x30')]));_0x5a7dca[_0x8386('0x2f')]=_0x5a7dca[_0x8386('0x2f')][_0x8386('0x48')]?_0x5a7dca[_0x8386('0x2f')]:_0x13aa24[_0x8386('0x29')];_0x5a7dca[_0x8386('0x32')]=qs[_0x8386('0x33')](_0x55d7a7['query'][_0x8386('0x33')]);_0x5a7dca[_0x8386('0x34')]=qs[_0x8386('0x2d')](_[_0x8386('0x35')](_0x55d7a7[_0x8386('0x2b')],_0x13aa24[_0x8386('0x2d')]));if(_0x55d7a7[_0x8386('0x2b')][_0x8386('0x36')]){_0x5a7dca[_0x8386('0x34')]=_[_0x8386('0x37')](_0x5a7dca[_0x8386('0x34')],{'$or':_[_0x8386('0x2a')](_0x5a7dca['attributes'],function(_0x58bf3b){var _0x52a4a6={};_0x52a4a6[_0x58bf3b]={'$like':'%'+_0x55d7a7[_0x8386('0x2b')][_0x8386('0x36')]+'%'};return _0x52a4a6;})});}_0x5a7dca=_[_0x8386('0x37')]({},_0x5a7dca,_0x55d7a7['options']);return _0x70c9c6[_0x8386('0x45')](_0x5a7dca);}})[_0x8386('0x1e')](function(_0x18b3f0){if(_0x18b3f0){_0x1ea8dc=_0x18b3f0['length'];if(!_0x55d7a7['query'][_0x8386('0x49')](_0x8386('0x31'))){_0x5a7dca['limit']=qs['limit'](_0x55d7a7[_0x8386('0x2b')]['limit']);_0x5a7dca[_0x8386('0x15')]=qs['offset'](_0x55d7a7[_0x8386('0x2b')][_0x8386('0x15')]);}return _0x70c9c6['getFields'](_0x5a7dca);}})[_0x8386('0x1e')](function(_0x107b06){if(_0x107b06){return _0x107b06?{'count':_0x1ea8dc,'rows':_0x107b06}:null;}})['then'](respondWithResult(_0x31a19c,null))[_0x8386('0x3d')](handleError(_0x31a19c,null));};exports[_0x8386('0x4a')]=function(_0x4369fa,_0x50ee4b,_0x3dbd6b){var _0x1d3963={};var _0x377a31={};var _0x4e8d35;var _0xc958ef;return db[_0x8386('0x24')][_0x8386('0x46')]({'where':{'id':_0x4369fa[_0x8386('0x3f')]['id']}})[_0x8386('0x1e')](handleEntityNotFound(_0x50ee4b,null))[_0x8386('0x1e')](function(_0x469cb9){if(_0x469cb9){_0x4e8d35=_0x469cb9;_0x377a31[_0x8386('0x29')]=_[_0x8386('0x2c')](db[_0x8386('0x47')]['rawAttributes']);_0x377a31[_0x8386('0x2b')]=_['keys'](_0x4369fa[_0x8386('0x2b')]);_0x377a31[_0x8386('0x2d')]=_[_0x8386('0x2e')](_0x377a31[_0x8386('0x29')],_0x377a31['query']);_0x1d3963['attributes']=_[_0x8386('0x2e')](_0x377a31[_0x8386('0x29')],qs[_0x8386('0x30')](_0x4369fa[_0x8386('0x2b')][_0x8386('0x30')]));_0x1d3963['attributes']=_0x1d3963[_0x8386('0x2f')][_0x8386('0x48')]?_0x1d3963[_0x8386('0x2f')]:_0x377a31[_0x8386('0x29')];_0x1d3963[_0x8386('0x32')]=qs[_0x8386('0x33')](_0x4369fa[_0x8386('0x2b')]['sort']);_0x1d3963[_0x8386('0x34')]=qs[_0x8386('0x2d')](_[_0x8386('0x35')](_0x4369fa[_0x8386('0x2b')],_0x377a31[_0x8386('0x2d')]));if(_0x4369fa['query'][_0x8386('0x36')]){_0x1d3963[_0x8386('0x34')]=_[_0x8386('0x37')](_0x1d3963[_0x8386('0x34')],{'$or':_[_0x8386('0x2a')](_0x1d3963[_0x8386('0x2f')],function(_0x511a40){var _0x1d2c40={};_0x1d2c40[_0x511a40]={'$like':'%'+_0x4369fa[_0x8386('0x2b')][_0x8386('0x36')]+'%'};return _0x1d2c40;})});}_0x1d3963=_['merge']({},_0x1d3963,_0x4369fa[_0x8386('0x39')]);return _0x4e8d35[_0x8386('0x4a')](_0x1d3963);}})[_0x8386('0x1e')](function(_0x1a55b3){if(_0x1a55b3){_0xc958ef=_0x1a55b3['length'];if(!_0x4369fa['query'][_0x8386('0x49')]('nolimit')){_0x1d3963['limit']=qs['limit'](_0x4369fa[_0x8386('0x2b')][_0x8386('0x17')]);_0x1d3963[_0x8386('0x15')]=qs[_0x8386('0x15')](_0x4369fa['query'][_0x8386('0x15')]);}return _0x4e8d35[_0x8386('0x4a')](_0x1d3963);}})['then'](function(_0x53afea){if(_0x53afea){return _0x53afea?{'count':_0xc958ef,'rows':_0x53afea}:null;}})[_0x8386('0x1e')](respondWithResult(_0x50ee4b,null))[_0x8386('0x3d')](handleError(_0x50ee4b,null));};exports[_0x8386('0x4b')]=function(_0x2761a5,_0x209dcb,_0x2c763a){var _0x2a4d24={};var _0x262af6={};var _0x23c960;var _0x4504cd;return db['VtigerConfiguration'][_0x8386('0x46')]({'where':{'id':_0x2761a5[_0x8386('0x3f')]['id']}})[_0x8386('0x1e')](handleEntityNotFound(_0x209dcb,null))[_0x8386('0x1e')](function(_0x397123){if(_0x397123){_0x23c960=_0x397123;_0x262af6[_0x8386('0x29')]=_[_0x8386('0x2c')](db['VtigerField'][_0x8386('0x25')]);_0x262af6[_0x8386('0x2b')]=_[_0x8386('0x2c')](_0x2761a5[_0x8386('0x2b')]);_0x262af6[_0x8386('0x2d')]=_[_0x8386('0x2e')](_0x262af6[_0x8386('0x29')],_0x262af6[_0x8386('0x2b')]);_0x2a4d24[_0x8386('0x2f')]=_[_0x8386('0x2e')](_0x262af6['model'],qs[_0x8386('0x30')](_0x2761a5[_0x8386('0x2b')][_0x8386('0x30')]));_0x2a4d24['attributes']=_0x2a4d24[_0x8386('0x2f')]['length']?_0x2a4d24[_0x8386('0x2f')]:_0x262af6[_0x8386('0x29')];_0x2a4d24[_0x8386('0x32')]=qs[_0x8386('0x33')](_0x2761a5['query']['sort']);_0x2a4d24['where']=qs[_0x8386('0x2d')](_['pick'](_0x2761a5[_0x8386('0x2b')],_0x262af6['filters']));if(_0x2761a5[_0x8386('0x2b')][_0x8386('0x36')]){_0x2a4d24['where']=_['merge'](_0x2a4d24[_0x8386('0x34')],{'$or':_[_0x8386('0x2a')](_0x2a4d24[_0x8386('0x2f')],function(_0x39aad8){var _0x55394a={};_0x55394a[_0x39aad8]={'$like':'%'+_0x2761a5[_0x8386('0x2b')][_0x8386('0x36')]+'%'};return _0x55394a;})});}_0x2a4d24=_[_0x8386('0x37')]({},_0x2a4d24,_0x2761a5[_0x8386('0x39')]);return _0x23c960[_0x8386('0x4b')](_0x2a4d24);}})[_0x8386('0x1e')](function(_0x191a08){if(_0x191a08){_0x4504cd=_0x191a08[_0x8386('0x48')];if(!_0x2761a5[_0x8386('0x2b')][_0x8386('0x49')](_0x8386('0x31'))){_0x2a4d24[_0x8386('0x17')]=qs[_0x8386('0x17')](_0x2761a5[_0x8386('0x2b')][_0x8386('0x17')]);_0x2a4d24['offset']=qs[_0x8386('0x15')](_0x2761a5['query'][_0x8386('0x15')]);}return _0x23c960[_0x8386('0x4b')](_0x2a4d24);}})[_0x8386('0x1e')](function(_0x51d9c9){if(_0x51d9c9){return _0x51d9c9?{'count':_0x4504cd,'rows':_0x51d9c9}:null;}})[_0x8386('0x1e')](respondWithResult(_0x209dcb,null))['catch'](handleError(_0x209dcb,null));};
\ No newline at end of file
+var _0xa6e2=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerConfiguration','then','include','show','length','includeAll','catch','create','body','find','params','destroy','findOne','VtigerField','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash'];(function(_0x379f1d,_0x563af1){var _0x5bb9ab=function(_0x15190c){while(--_0x15190c){_0x379f1d['push'](_0x379f1d['shift']());}};_0x5bb9ab(++_0x563af1);}(_0xa6e2,0x132));var _0x2a6e=function(_0x5ec85e,_0x4de7c1){_0x5ec85e=_0x5ec85e-0x0;var _0xe0fbea=_0xa6e2[_0x5ec85e];return _0xe0fbea;};'use strict';var emlformat=require(_0x2a6e('0x0'));var rimraf=require(_0x2a6e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a6e('0x2'));var rp=require(_0x2a6e('0x3'));var moment=require(_0x2a6e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2a6e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2a6e('0x6'));var ejs=require(_0x2a6e('0x7'));var fs=require('fs');var fs_extra=require(_0x2a6e('0x8'));var _=require(_0x2a6e('0x9'));var squel=require('squel');var crypto=require(_0x2a6e('0xa'));var jsforce=require(_0x2a6e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2a6e('0x6'));var querystring=require(_0x2a6e('0xc'));var Papa=require(_0x2a6e('0xd'));var Redis=require(_0x2a6e('0xe'));var authService=require(_0x2a6e('0xf'));var qs=require(_0x2a6e('0x10'));var as=require(_0x2a6e('0x11'));var hardwareService=require(_0x2a6e('0x12'));var logger=require(_0x2a6e('0x13'))(_0x2a6e('0x14'));var utils=require('../../config/utils');var config=require(_0x2a6e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a6e('0x16'))['db'];function respondWithStatusCode(_0x8decba,_0x1bcb7e){_0x1bcb7e=_0x1bcb7e||0xcc;return function(_0x190157){if(_0x190157){return _0x8decba[_0x2a6e('0x17')](_0x1bcb7e);}return _0x8decba[_0x2a6e('0x18')](_0x1bcb7e)[_0x2a6e('0x19')]();};}function respondWithResult(_0x5b0e59,_0x2bef8c){_0x2bef8c=_0x2bef8c||0xc8;return function(_0x25ed8e){if(_0x25ed8e){return _0x5b0e59['status'](_0x2bef8c)[_0x2a6e('0x1a')](_0x25ed8e);}};}function respondWithFilteredResult(_0x1397d6,_0x4b1681){return function(_0x248231){if(_0x248231){var _0x52c67e=typeof _0x4b1681[_0x2a6e('0x1b')]===_0x2a6e('0x1c')&&typeof _0x4b1681[_0x2a6e('0x1d')]===_0x2a6e('0x1c');var _0x30613a=_0x248231['count'];var _0x144a14=_0x52c67e?0x0:_0x4b1681[_0x2a6e('0x1b')];var _0x37f5b5=_0x52c67e?_0x248231[_0x2a6e('0x1e')]:_0x4b1681[_0x2a6e('0x1b')]+_0x4b1681[_0x2a6e('0x1d')];var _0x547807;if(_0x37f5b5>=_0x30613a){_0x37f5b5=_0x30613a;_0x547807=0xc8;}else{_0x547807=0xce;}_0x1397d6[_0x2a6e('0x18')](_0x547807);return _0x1397d6[_0x2a6e('0x1f')](_0x2a6e('0x20'),_0x144a14+'-'+_0x37f5b5+'/'+_0x30613a)[_0x2a6e('0x1a')](_0x248231);}return null;};}function patchUpdates(_0x41202e){return function(_0x3d3b52){try{jsonpatch['apply'](_0x3d3b52,_0x41202e,!![]);}catch(_0x152c9c){return BPromise[_0x2a6e('0x21')](_0x152c9c);}return _0x3d3b52[_0x2a6e('0x22')]();};}function saveUpdates(_0x8d062c,_0x3dfb3b){return function(_0x4cf809){if(_0x4cf809){return _0x4cf809[_0x2a6e('0x23')](_0x8d062c)['then'](function(_0x2c7142){return _0x2c7142;});}return null;};}function removeEntity(_0x39c591,_0x58f841){return function(_0xbbaf17){if(_0xbbaf17){return _0xbbaf17['destroy']()['then'](function(){_0x39c591[_0x2a6e('0x18')](0xcc)[_0x2a6e('0x19')]();});}};}function handleEntityNotFound(_0x292c5a,_0x35ee65){return function(_0x14f995){if(!_0x14f995){_0x292c5a[_0x2a6e('0x17')](0x194);}return _0x14f995;};}function handleError(_0x188073,_0x51044d){_0x51044d=_0x51044d||0x1f4;return function(_0x3ce619){logger[_0x2a6e('0x24')](_0x3ce619[_0x2a6e('0x25')]);if(_0x3ce619[_0x2a6e('0x26')]){delete _0x3ce619[_0x2a6e('0x26')];}_0x188073[_0x2a6e('0x18')](_0x51044d)[_0x2a6e('0x27')](_0x3ce619);};}exports[_0x2a6e('0x28')]=function(_0x1de228,_0x903f2d){var _0x21cf26={},_0x226317={},_0x3895a4={'count':0x0,'rows':[]};var _0x4e9cfb=_['map'](db['VtigerConfiguration'][_0x2a6e('0x29')],function(_0x156c7a){return{'name':_0x156c7a[_0x2a6e('0x2a')],'type':_0x156c7a[_0x2a6e('0x2b')]['key']};});_0x226317[_0x2a6e('0x2c')]=_[_0x2a6e('0x2d')](_0x4e9cfb,_0x2a6e('0x26'));_0x226317[_0x2a6e('0x2e')]=_[_0x2a6e('0x2f')](_0x1de228[_0x2a6e('0x2e')]);_0x226317[_0x2a6e('0x30')]=_[_0x2a6e('0x31')](_0x226317['model'],_0x226317[_0x2a6e('0x2e')]);_0x21cf26['attributes']=_[_0x2a6e('0x31')](_0x226317[_0x2a6e('0x2c')],qs[_0x2a6e('0x32')](_0x1de228[_0x2a6e('0x2e')][_0x2a6e('0x32')]));_0x21cf26['attributes']=_0x21cf26[_0x2a6e('0x33')]['length']?_0x21cf26['attributes']:_0x226317[_0x2a6e('0x2c')];if(!_0x1de228[_0x2a6e('0x2e')][_0x2a6e('0x34')](_0x2a6e('0x35'))){_0x21cf26[_0x2a6e('0x1d')]=qs['limit'](_0x1de228[_0x2a6e('0x2e')]['limit']);_0x21cf26[_0x2a6e('0x1b')]=qs[_0x2a6e('0x1b')](_0x1de228['query'][_0x2a6e('0x1b')]);}_0x21cf26[_0x2a6e('0x36')]=qs[_0x2a6e('0x37')](_0x1de228[_0x2a6e('0x2e')]['sort']);_0x21cf26[_0x2a6e('0x38')]=qs['filters'](_[_0x2a6e('0x39')](_0x1de228['query'],_0x226317['filters']),_0x4e9cfb);if(_0x1de228[_0x2a6e('0x2e')][_0x2a6e('0x3a')]){_0x21cf26[_0x2a6e('0x38')]=_[_0x2a6e('0x3b')](_0x21cf26[_0x2a6e('0x38')],{'$or':_[_0x2a6e('0x2d')](_0x4e9cfb,function(_0x26ba6c){if(_0x26ba6c[_0x2a6e('0x2b')]!==_0x2a6e('0x3c')){var _0x817cf1={};_0x817cf1[_0x26ba6c[_0x2a6e('0x26')]]={'$like':'%'+_0x1de228[_0x2a6e('0x2e')]['filter']+'%'};return _0x817cf1;}})});}_0x21cf26=_[_0x2a6e('0x3b')]({},_0x21cf26,_0x1de228[_0x2a6e('0x3d')]);var _0x176732={'where':_0x21cf26[_0x2a6e('0x38')]};return db[_0x2a6e('0x3e')][_0x2a6e('0x1e')](_0x176732)[_0x2a6e('0x3f')](function(_0x3576eb){_0x3895a4[_0x2a6e('0x1e')]=_0x3576eb;if(_0x1de228[_0x2a6e('0x2e')]['includeAll']){_0x21cf26[_0x2a6e('0x40')]=[{'all':!![]}];}return db[_0x2a6e('0x3e')]['findAll'](_0x21cf26);})[_0x2a6e('0x3f')](function(_0x43b543){_0x3895a4['rows']=_0x43b543;return _0x3895a4;})[_0x2a6e('0x3f')](respondWithFilteredResult(_0x903f2d,_0x21cf26))['catch'](handleError(_0x903f2d,null));};exports[_0x2a6e('0x41')]=function(_0x3f4704,_0x1bc989){var _0xe50616={'raw':![],'where':{'id':_0x3f4704['params']['id']}},_0x5edb34={};_0x5edb34[_0x2a6e('0x2c')]=_[_0x2a6e('0x2f')](db['VtigerConfiguration'][_0x2a6e('0x29')]);_0x5edb34[_0x2a6e('0x2e')]=_[_0x2a6e('0x2f')](_0x3f4704[_0x2a6e('0x2e')]);_0x5edb34[_0x2a6e('0x30')]=_[_0x2a6e('0x31')](_0x5edb34[_0x2a6e('0x2c')],_0x5edb34[_0x2a6e('0x2e')]);_0xe50616['attributes']=_['intersection'](_0x5edb34[_0x2a6e('0x2c')],qs[_0x2a6e('0x32')](_0x3f4704[_0x2a6e('0x2e')][_0x2a6e('0x32')]));_0xe50616[_0x2a6e('0x33')]=_0xe50616[_0x2a6e('0x33')][_0x2a6e('0x42')]?_0xe50616[_0x2a6e('0x33')]:_0x5edb34[_0x2a6e('0x2c')];if(_0x3f4704[_0x2a6e('0x2e')][_0x2a6e('0x43')]){_0xe50616['include']=[{'all':!![]}];}_0xe50616=_[_0x2a6e('0x3b')]({},_0xe50616,_0x3f4704[_0x2a6e('0x3d')]);return db[_0x2a6e('0x3e')]['find'](_0xe50616)[_0x2a6e('0x3f')](handleEntityNotFound(_0x1bc989,null))[_0x2a6e('0x3f')](respondWithResult(_0x1bc989,null))[_0x2a6e('0x44')](handleError(_0x1bc989,null));};exports[_0x2a6e('0x45')]=function(_0x4a1f65,_0xe5dc20){return db[_0x2a6e('0x3e')][_0x2a6e('0x45')](_0x4a1f65[_0x2a6e('0x46')],{})[_0x2a6e('0x3f')](respondWithResult(_0xe5dc20,0xc9))[_0x2a6e('0x44')](handleError(_0xe5dc20,null));};exports['update']=function(_0x2d38c8,_0x3b9a30){if(_0x2d38c8[_0x2a6e('0x46')]['id']){delete _0x2d38c8[_0x2a6e('0x46')]['id'];}return db[_0x2a6e('0x3e')][_0x2a6e('0x47')]({'where':{'id':_0x2d38c8[_0x2a6e('0x48')]['id']}})[_0x2a6e('0x3f')](handleEntityNotFound(_0x3b9a30,null))[_0x2a6e('0x3f')](saveUpdates(_0x2d38c8['body'],null))[_0x2a6e('0x3f')](respondWithResult(_0x3b9a30,null))[_0x2a6e('0x44')](handleError(_0x3b9a30,null));};exports[_0x2a6e('0x49')]=function(_0x17ce94,_0x139e21){return db[_0x2a6e('0x3e')][_0x2a6e('0x47')]({'where':{'id':_0x17ce94[_0x2a6e('0x48')]['id']}})['then'](handleEntityNotFound(_0x139e21,null))[_0x2a6e('0x3f')](removeEntity(_0x139e21,null))[_0x2a6e('0x44')](handleError(_0x139e21,null));};exports['getFields']=function(_0x2ff1d8,_0x378705,_0x364599){var _0x235017={};var _0x567caa={};var _0x32d598;var _0x421d1f;return db[_0x2a6e('0x3e')][_0x2a6e('0x4a')]({'where':{'id':_0x2ff1d8['params']['id']}})[_0x2a6e('0x3f')](handleEntityNotFound(_0x378705,null))[_0x2a6e('0x3f')](function(_0x1430cb){if(_0x1430cb){_0x32d598=_0x1430cb;_0x567caa[_0x2a6e('0x2c')]=_[_0x2a6e('0x2f')](db[_0x2a6e('0x4b')]['rawAttributes']);_0x567caa[_0x2a6e('0x2e')]=_[_0x2a6e('0x2f')](_0x2ff1d8['query']);_0x567caa['filters']=_[_0x2a6e('0x31')](_0x567caa['model'],_0x567caa[_0x2a6e('0x2e')]);_0x235017['attributes']=_[_0x2a6e('0x31')](_0x567caa[_0x2a6e('0x2c')],qs[_0x2a6e('0x32')](_0x2ff1d8[_0x2a6e('0x2e')][_0x2a6e('0x32')]));_0x235017['attributes']=_0x235017[_0x2a6e('0x33')][_0x2a6e('0x42')]?_0x235017[_0x2a6e('0x33')]:_0x567caa[_0x2a6e('0x2c')];_0x235017[_0x2a6e('0x36')]=qs['sort'](_0x2ff1d8['query']['sort']);_0x235017[_0x2a6e('0x38')]=qs[_0x2a6e('0x30')](_['pick'](_0x2ff1d8['query'],_0x567caa[_0x2a6e('0x30')]));if(_0x2ff1d8[_0x2a6e('0x2e')][_0x2a6e('0x3a')]){_0x235017[_0x2a6e('0x38')]=_[_0x2a6e('0x3b')](_0x235017[_0x2a6e('0x38')],{'$or':_[_0x2a6e('0x2d')](_0x235017['attributes'],function(_0x3aa8c){var _0x15cc96={};_0x15cc96[_0x3aa8c]={'$like':'%'+_0x2ff1d8[_0x2a6e('0x2e')][_0x2a6e('0x3a')]+'%'};return _0x15cc96;})});}_0x235017=_[_0x2a6e('0x3b')]({},_0x235017,_0x2ff1d8[_0x2a6e('0x3d')]);return _0x32d598[_0x2a6e('0x4c')](_0x235017);}})[_0x2a6e('0x3f')](function(_0x5ec0a7){if(_0x5ec0a7){_0x421d1f=_0x5ec0a7['length'];if(!_0x2ff1d8[_0x2a6e('0x2e')][_0x2a6e('0x34')](_0x2a6e('0x35'))){_0x235017['limit']=qs['limit'](_0x2ff1d8[_0x2a6e('0x2e')][_0x2a6e('0x1d')]);_0x235017[_0x2a6e('0x1b')]=qs['offset'](_0x2ff1d8[_0x2a6e('0x2e')][_0x2a6e('0x1b')]);}return _0x32d598[_0x2a6e('0x4c')](_0x235017);}})[_0x2a6e('0x3f')](function(_0x4c6ec8){if(_0x4c6ec8){return _0x4c6ec8?{'count':_0x421d1f,'rows':_0x4c6ec8}:null;}})['then'](respondWithResult(_0x378705,null))[_0x2a6e('0x44')](handleError(_0x378705,null));};exports[_0x2a6e('0x4d')]=function(_0x158f2d,_0x311dfd,_0x22dae7){var _0x2ad25a={};var _0x5563a3={};var _0x27fd4e;var _0x553080;return db[_0x2a6e('0x3e')][_0x2a6e('0x4a')]({'where':{'id':_0x158f2d[_0x2a6e('0x48')]['id']}})[_0x2a6e('0x3f')](handleEntityNotFound(_0x311dfd,null))[_0x2a6e('0x3f')](function(_0x4b55a0){if(_0x4b55a0){_0x27fd4e=_0x4b55a0;_0x5563a3[_0x2a6e('0x2c')]=_[_0x2a6e('0x2f')](db[_0x2a6e('0x4b')]['rawAttributes']);_0x5563a3[_0x2a6e('0x2e')]=_[_0x2a6e('0x2f')](_0x158f2d[_0x2a6e('0x2e')]);_0x5563a3[_0x2a6e('0x30')]=_[_0x2a6e('0x31')](_0x5563a3[_0x2a6e('0x2c')],_0x5563a3[_0x2a6e('0x2e')]);_0x2ad25a['attributes']=_[_0x2a6e('0x31')](_0x5563a3[_0x2a6e('0x2c')],qs[_0x2a6e('0x32')](_0x158f2d[_0x2a6e('0x2e')][_0x2a6e('0x32')]));_0x2ad25a[_0x2a6e('0x33')]=_0x2ad25a[_0x2a6e('0x33')]['length']?_0x2ad25a[_0x2a6e('0x33')]:_0x5563a3[_0x2a6e('0x2c')];_0x2ad25a[_0x2a6e('0x36')]=qs['sort'](_0x158f2d[_0x2a6e('0x2e')]['sort']);_0x2ad25a[_0x2a6e('0x38')]=qs[_0x2a6e('0x30')](_['pick'](_0x158f2d[_0x2a6e('0x2e')],_0x5563a3[_0x2a6e('0x30')]));if(_0x158f2d[_0x2a6e('0x2e')][_0x2a6e('0x3a')]){_0x2ad25a[_0x2a6e('0x38')]=_[_0x2a6e('0x3b')](_0x2ad25a[_0x2a6e('0x38')],{'$or':_['map'](_0x2ad25a['attributes'],function(_0x26f4dd){var _0x160270={};_0x160270[_0x26f4dd]={'$like':'%'+_0x158f2d[_0x2a6e('0x2e')][_0x2a6e('0x3a')]+'%'};return _0x160270;})});}_0x2ad25a=_['merge']({},_0x2ad25a,_0x158f2d[_0x2a6e('0x3d')]);return _0x27fd4e[_0x2a6e('0x4d')](_0x2ad25a);}})[_0x2a6e('0x3f')](function(_0x1300a1){if(_0x1300a1){_0x553080=_0x1300a1[_0x2a6e('0x42')];if(!_0x158f2d['query'][_0x2a6e('0x34')](_0x2a6e('0x35'))){_0x2ad25a[_0x2a6e('0x1d')]=qs[_0x2a6e('0x1d')](_0x158f2d['query'][_0x2a6e('0x1d')]);_0x2ad25a[_0x2a6e('0x1b')]=qs[_0x2a6e('0x1b')](_0x158f2d['query'][_0x2a6e('0x1b')]);}return _0x27fd4e[_0x2a6e('0x4d')](_0x2ad25a);}})[_0x2a6e('0x3f')](function(_0x42f48e){if(_0x42f48e){return _0x42f48e?{'count':_0x553080,'rows':_0x42f48e}:null;}})[_0x2a6e('0x3f')](respondWithResult(_0x311dfd,null))['catch'](handleError(_0x311dfd,null));};exports[_0x2a6e('0x4e')]=function(_0xd0083f,_0x281504,_0x1e1be1){var _0x5c0117={};var _0xc17650={};var _0x573216;var _0x64db0a;return db['VtigerConfiguration'][_0x2a6e('0x4a')]({'where':{'id':_0xd0083f[_0x2a6e('0x48')]['id']}})[_0x2a6e('0x3f')](handleEntityNotFound(_0x281504,null))['then'](function(_0x322c2c){if(_0x322c2c){_0x573216=_0x322c2c;_0xc17650[_0x2a6e('0x2c')]=_['keys'](db[_0x2a6e('0x4b')][_0x2a6e('0x29')]);_0xc17650[_0x2a6e('0x2e')]=_['keys'](_0xd0083f[_0x2a6e('0x2e')]);_0xc17650['filters']=_[_0x2a6e('0x31')](_0xc17650[_0x2a6e('0x2c')],_0xc17650[_0x2a6e('0x2e')]);_0x5c0117[_0x2a6e('0x33')]=_[_0x2a6e('0x31')](_0xc17650['model'],qs[_0x2a6e('0x32')](_0xd0083f[_0x2a6e('0x2e')][_0x2a6e('0x32')]));_0x5c0117[_0x2a6e('0x33')]=_0x5c0117[_0x2a6e('0x33')][_0x2a6e('0x42')]?_0x5c0117[_0x2a6e('0x33')]:_0xc17650['model'];_0x5c0117[_0x2a6e('0x36')]=qs[_0x2a6e('0x37')](_0xd0083f['query']['sort']);_0x5c0117[_0x2a6e('0x38')]=qs['filters'](_[_0x2a6e('0x39')](_0xd0083f['query'],_0xc17650[_0x2a6e('0x30')]));if(_0xd0083f['query'][_0x2a6e('0x3a')]){_0x5c0117[_0x2a6e('0x38')]=_[_0x2a6e('0x3b')](_0x5c0117[_0x2a6e('0x38')],{'$or':_[_0x2a6e('0x2d')](_0x5c0117['attributes'],function(_0x374e23){var _0x5d0124={};_0x5d0124[_0x374e23]={'$like':'%'+_0xd0083f[_0x2a6e('0x2e')][_0x2a6e('0x3a')]+'%'};return _0x5d0124;})});}_0x5c0117=_[_0x2a6e('0x3b')]({},_0x5c0117,_0xd0083f[_0x2a6e('0x3d')]);return _0x573216[_0x2a6e('0x4e')](_0x5c0117);}})[_0x2a6e('0x3f')](function(_0x4a3672){if(_0x4a3672){_0x64db0a=_0x4a3672['length'];if(!_0xd0083f[_0x2a6e('0x2e')][_0x2a6e('0x34')]('nolimit')){_0x5c0117['limit']=qs['limit'](_0xd0083f[_0x2a6e('0x2e')][_0x2a6e('0x1d')]);_0x5c0117[_0x2a6e('0x1b')]=qs['offset'](_0xd0083f['query'][_0x2a6e('0x1b')]);}return _0x573216[_0x2a6e('0x4e')](_0x5c0117);}})[_0x2a6e('0x3f')](function(_0x36c835){if(_0x36c835){return _0x36c835?{'count':_0x64db0a,'rows':_0x36c835}:null;}})[_0x2a6e('0x3f')](respondWithResult(_0x281504,null))['catch'](handleError(_0x281504,null));};
\ No newline at end of file
index 7945527..ba6c48a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac85=['moment','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x230af5,_0x5cb0e6){var _0x24e019=function(_0x344208){while(--_0x344208){_0x230af5['push'](_0x230af5['shift']());}};_0x24e019(++_0x5cb0e6);}(_0xac85,0x13b));var _0x5ac8=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xac85[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x5ac8('0x0'));var util=require(_0x5ac8('0x1'));var logger=require(_0x5ac8('0x2'))(_0x5ac8('0x3'));var moment=require(_0x5ac8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5ac8('0x5'));var config=require(_0x5ac8('0x6'));var attributes=require(_0x5ac8('0x7'));module['exports']=function(_0x8ab8ad,_0x180750){return _0x8ab8ad[_0x5ac8('0x8')](_0x5ac8('0x9'),attributes,{'tableName':_0x5ac8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa6f0=['bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x496ab0,_0xa79900){var _0x3f5397=function(_0x40be2a){while(--_0x40be2a){_0x496ab0['push'](_0x496ab0['shift']());}};_0x3f5397(++_0xa79900);}(_0xa6f0,0x1ac));var _0x0a6f=function(_0x4bf11d,_0x2b6cd2){_0x4bf11d=_0x4bf11d-0x0;var _0x6552e6=_0xa6f0[_0x4bf11d];return _0x6552e6;};'use strict';var _=require(_0x0a6f('0x0'));var util=require(_0x0a6f('0x1'));var logger=require(_0x0a6f('0x2'))(_0x0a6f('0x3'));var moment=require('moment');var BPromise=require(_0x0a6f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a6f('0x5'));var rimraf=require(_0x0a6f('0x6'));var config=require(_0x0a6f('0x7'));var attributes=require(_0x0a6f('0x8'));module[_0x0a6f('0x9')]=function(_0x277f63,_0x14f048){return _0x277f63['define'](_0x0a6f('0xa'),attributes,{'tableName':_0x0a6f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d5810eb..b254fb8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4a06=['info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then'];(function(_0x212da9,_0x25cb05){var _0x1c6114=function(_0x5a94c3){while(--_0x5a94c3){_0x212da9['push'](_0x212da9['shift']());}};_0x1c6114(++_0x25cb05);}(_0x4a06,0x198));var _0x64a0=function(_0x2f3d9e,_0x3d0c2f){_0x2f3d9e=_0x2f3d9e-0x0;var _0x2d815d=_0x4a06[_0x2f3d9e];return _0x2d815d;};'use strict';var _=require('lodash');var util=require(_0x64a0('0x0'));var moment=require(_0x64a0('0x1'));var BPromise=require(_0x64a0('0x2'));var rs=require(_0x64a0('0x3'));var fs=require('fs');var Redis=require(_0x64a0('0x4'));var db=require(_0x64a0('0x5'))['db'];var utils=require(_0x64a0('0x6'));var logger=require(_0x64a0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x64a0('0x8'));var client=jayson['client'][_0x64a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf10557,_0x51db5a,_0x5caf78){return new BPromise(function(_0x277ec7,_0x3c0d63){return client[_0x64a0('0xa')](_0xf10557,_0x5caf78)[_0x64a0('0xb')](function(_0x16d987){logger[_0x64a0('0xc')](_0x64a0('0xd'),_0x51db5a,_0x64a0('0xe'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x51db5a,_0x64a0('0xe'),JSON[_0x64a0('0xf')](_0x16d987));if(_0x16d987[_0x64a0('0x10')]){if(_0x16d987[_0x64a0('0x10')][_0x64a0('0x11')]===0x1f4){logger[_0x64a0('0x10')](_0x64a0('0xd'),_0x51db5a,_0x16d987[_0x64a0('0x10')]['message']);return _0x3c0d63(_0x16d987[_0x64a0('0x10')][_0x64a0('0x12')]);}logger[_0x64a0('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x51db5a,_0x16d987[_0x64a0('0x10')][_0x64a0('0x12')]);return _0x277ec7(_0x16d987[_0x64a0('0x10')][_0x64a0('0x12')]);}else{logger[_0x64a0('0xc')](_0x64a0('0xd'),_0x51db5a,'request\x20sent');_0x277ec7(_0x16d987['result'][_0x64a0('0x12')]);}})[_0x64a0('0x13')](function(_0xb62294){logger['error'](_0x64a0('0xd'),_0x51db5a,_0xb62294);_0x3c0d63(_0xb62294);});});}
\ No newline at end of file
+var _0x31c3=['ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','message','VtigerConfiguration,\x20%s,\x20%s','lodash','moment','randomstring'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x31c3,0xc9));var _0x331c=function(_0xdf377,_0x4f5c7e){_0xdf377=_0xdf377-0x0;var _0x16a523=_0x31c3[_0xdf377];return _0x16a523;};'use strict';var _=require(_0x331c('0x0'));var util=require('util');var moment=require(_0x331c('0x1'));var BPromise=require('bluebird');var rs=require(_0x331c('0x2'));var fs=require('fs');var Redis=require(_0x331c('0x3'));var db=require(_0x331c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x331c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x331c('0x6'));var client=jayson[_0x331c('0x7')][_0x331c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21c0df,_0x10b613,_0x1c8e7d){return new BPromise(function(_0x5e51f1,_0xb74ff9){return client[_0x331c('0x9')](_0x21c0df,_0x1c8e7d)[_0x331c('0xa')](function(_0x4030ae){logger[_0x331c('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x10b613,_0x331c('0xc'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x10b613,_0x331c('0xc'),JSON[_0x331c('0xd')](_0x4030ae));if(_0x4030ae[_0x331c('0xe')]){if(_0x4030ae[_0x331c('0xe')]['code']===0x1f4){logger[_0x331c('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x10b613,_0x4030ae[_0x331c('0xe')][_0x331c('0xf')]);return _0xb74ff9(_0x4030ae[_0x331c('0xe')][_0x331c('0xf')]);}logger[_0x331c('0xe')](_0x331c('0x10'),_0x10b613,_0x4030ae['error']['message']);return _0x5e51f1(_0x4030ae[_0x331c('0xe')][_0x331c('0xf')]);}else{logger[_0x331c('0xb')](_0x331c('0x10'),_0x10b613,_0x331c('0xc'));_0x5e51f1(_0x4030ae['result']['message']);}})['catch'](function(_0x3e809e){logger[_0x331c('0xe')](_0x331c('0x10'),_0x10b613,_0x3e809e);_0xb74ff9(_0x3e809e);});});}
\ No newline at end of file
index b513ed1..4cec9e8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0120=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id','show','post','isAuthenticated','create','update','delete','exports','util','path','connect-timeout','express'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0120,0x1c8));var _0x0012=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0120[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x0012('0x0'));var path=require(_0x0012('0x1'));var timeout=require(_0x0012('0x2'));var express=require(_0x0012('0x3'));var router=express[_0x0012('0x4')]();var fs_extra=require(_0x0012('0x5'));var auth=require(_0x0012('0x6'));var interaction=require(_0x0012('0x7'));var config=require(_0x0012('0x8'));var controller=require(_0x0012('0x9'));router[_0x0012('0xa')]('/',auth['isAuthenticated'](),controller[_0x0012('0xb')]);router['get'](_0x0012('0xc'),auth['isAuthenticated'](),controller[_0x0012('0xd')]);router[_0x0012('0xe')]('/',auth[_0x0012('0xf')](),controller[_0x0012('0x10')]);router['put'](_0x0012('0xc'),auth[_0x0012('0xf')](),controller[_0x0012('0x11')]);router[_0x0012('0x12')](_0x0012('0xc'),auth[_0x0012('0xf')](),controller['destroy']);module[_0x0012('0x13')]=router;
\ No newline at end of file
+var _0x7576=['put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','/:id','show','create'];(function(_0x246426,_0x505c21){var _0x320fcf=function(_0x5f50dc){while(--_0x5f50dc){_0x246426['push'](_0x246426['shift']());}};_0x320fcf(++_0x505c21);}(_0x7576,0x6b));var _0x6757=function(_0x1e535e,_0xe523c7){_0x1e535e=_0x1e535e-0x0;var _0x249a0e=_0x7576[_0x1e535e];return _0x249a0e;};'use strict';var multer=require(_0x6757('0x0'));var util=require(_0x6757('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6757('0x2')]();var fs_extra=require(_0x6757('0x3'));var auth=require(_0x6757('0x4'));var interaction=require(_0x6757('0x5'));var config=require('../../config/environment');var controller=require(_0x6757('0x6'));router[_0x6757('0x7')]('/',auth[_0x6757('0x8')](),controller['index']);router[_0x6757('0x7')](_0x6757('0x9'),auth[_0x6757('0x8')](),controller[_0x6757('0xa')]);router['post']('/',auth[_0x6757('0x8')](),controller[_0x6757('0xb')]);router[_0x6757('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x6757('0xd')]);router[_0x6757('0xe')](_0x6757('0x9'),auth[_0x6757('0x8')](),controller[_0x6757('0xf')]);module[_0x6757('0x10')]=router;
\ No newline at end of file
index 3b726a6..3fe996b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8408=['BOOLEAN','string','variable','customVariable','picklist','STRING'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x8408,0x1bd));var _0x8840=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x8408[_0x256d6a];return _0x460058;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x8840('0x0'),_0x8840('0x1'),_0x8840('0x2'),'keyValue',_0x8840('0x3')),'defaultValue':_0x8840('0x0')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8840('0x4')]},'keyType':{'type':Sequelize['ENUM']('string',_0x8840('0x1'),_0x8840('0x2'))},'keyContent':{'type':Sequelize[_0x8840('0x4')]},'idField':{'type':Sequelize[_0x8840('0x4')]},'nameField':{'type':Sequelize[_0x8840('0x4')]},'customField':{'type':Sequelize[_0x8840('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8840('0x4')]}};
\ No newline at end of file
+var _0x72e6=['BOOLEAN','exports','variable','customVariable','keyValue','picklist','string','STRING','ENUM'];(function(_0x5aa163,_0x2ba3b5){var _0x155b5e=function(_0x29868b){while(--_0x29868b){_0x5aa163['push'](_0x5aa163['shift']());}};_0x155b5e(++_0x2ba3b5);}(_0x72e6,0xd9));var _0x672e=function(_0x1e7167,_0x87f4e8){_0x1e7167=_0x1e7167-0x0;var _0x129523=_0x72e6[_0x1e7167];return _0x129523;};'use strict';var Sequelize=require('sequelize');module[_0x672e('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x672e('0x1'),_0x672e('0x2'),_0x672e('0x3'),_0x672e('0x4')),'defaultValue':_0x672e('0x5')},'content':{'type':Sequelize[_0x672e('0x6')]},'key':{'type':Sequelize[_0x672e('0x6')]},'keyType':{'type':Sequelize[_0x672e('0x7')](_0x672e('0x5'),'variable',_0x672e('0x2'))},'keyContent':{'type':Sequelize[_0x672e('0x6')]},'idField':{'type':Sequelize[_0x672e('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x672e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
index d988a82..11929f8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6bc5=['Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','VtigerField','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','rawAttributes','include','find','create','catch','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count'];(function(_0x6f8376,_0x4fb305){var _0x4a148b=function(_0x5ed138){while(--_0x5ed138){_0x6f8376['push'](_0x6f8376['shift']());}};_0x4a148b(++_0x4fb305);}(_0x6bc5,0x19e));var _0x56bc=function(_0x4ad25e,_0x26a1d6){_0x4ad25e=_0x4ad25e-0x0;var _0x46c30c=_0x6bc5[_0x4ad25e];return _0x46c30c;};'use strict';var emlformat=require(_0x56bc('0x0'));var rimraf=require(_0x56bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x56bc('0x2'));var rp=require(_0x56bc('0x3'));var moment=require(_0x56bc('0x4'));var BPromise=require(_0x56bc('0x5'));var Mustache=require(_0x56bc('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x56bc('0x7'));var ejs=require(_0x56bc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x56bc('0x9'));var squel=require(_0x56bc('0xa'));var crypto=require(_0x56bc('0xb'));var jsforce=require(_0x56bc('0xc'));var deskjs=require(_0x56bc('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x56bc('0xe'));var Redis=require('ioredis');var authService=require(_0x56bc('0xf'));var qs=require(_0x56bc('0x10'));var as=require(_0x56bc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x56bc('0x12'))(_0x56bc('0x13'));var utils=require(_0x56bc('0x14'));var config=require(_0x56bc('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x56bc('0x16'))['db'];function respondWithStatusCode(_0x41ddff,_0x3617dd){_0x3617dd=_0x3617dd||0xcc;return function(_0x39a230){if(_0x39a230){return _0x41ddff[_0x56bc('0x17')](_0x3617dd);}return _0x41ddff['status'](_0x3617dd)['end']();};}function respondWithResult(_0x46da93,_0x123897){_0x123897=_0x123897||0xc8;return function(_0x1888f6){if(_0x1888f6){return _0x46da93[_0x56bc('0x18')](_0x123897)[_0x56bc('0x19')](_0x1888f6);}};}function respondWithFilteredResult(_0x3473ce,_0x3ca99f){return function(_0x50224e){if(_0x50224e){var _0x2760e2=typeof _0x3ca99f[_0x56bc('0x1a')]==='undefined'&&typeof _0x3ca99f[_0x56bc('0x1b')]===_0x56bc('0x1c');var _0x69c44f=_0x50224e[_0x56bc('0x1d')];var _0x42aa51=_0x2760e2?0x0:_0x3ca99f[_0x56bc('0x1a')];var _0x4d1436=_0x2760e2?_0x50224e[_0x56bc('0x1d')]:_0x3ca99f[_0x56bc('0x1a')]+_0x3ca99f['limit'];var _0xd1e106;if(_0x4d1436>=_0x69c44f){_0x4d1436=_0x69c44f;_0xd1e106=0xc8;}else{_0xd1e106=0xce;}_0x3473ce[_0x56bc('0x18')](_0xd1e106);return _0x3473ce['set'](_0x56bc('0x1e'),_0x42aa51+'-'+_0x4d1436+'/'+_0x69c44f)[_0x56bc('0x19')](_0x50224e);}return null;};}function patchUpdates(_0x50b463){return function(_0x6427c){try{jsonpatch[_0x56bc('0x1f')](_0x6427c,_0x50b463,!![]);}catch(_0x13e436){return BPromise[_0x56bc('0x20')](_0x13e436);}return _0x6427c[_0x56bc('0x21')]();};}function saveUpdates(_0x5645bf,_0x26f056){return function(_0x3eb4b5){if(_0x3eb4b5){return _0x3eb4b5['update'](_0x5645bf)[_0x56bc('0x22')](function(_0x113806){return _0x113806;});}return null;};}function removeEntity(_0x234546,_0x2f9108){return function(_0x8bd931){if(_0x8bd931){return _0x8bd931[_0x56bc('0x23')]()[_0x56bc('0x22')](function(){_0x234546[_0x56bc('0x18')](0xcc)[_0x56bc('0x24')]();});}};}function handleEntityNotFound(_0x5778c6,_0x2deda5){return function(_0x54e970){if(!_0x54e970){_0x5778c6[_0x56bc('0x17')](0x194);}return _0x54e970;};}function handleError(_0xfb86f6,_0xb461c1){_0xb461c1=_0xb461c1||0x1f4;return function(_0x5641da){logger[_0x56bc('0x25')](_0x5641da[_0x56bc('0x26')]);if(_0x5641da['name']){delete _0x5641da[_0x56bc('0x27')];}_0xfb86f6['status'](_0xb461c1)[_0x56bc('0x28')](_0x5641da);};}exports[_0x56bc('0x29')]=function(_0x4746c0,_0xbd42ba){var _0x5210d2={},_0x5454c2={},_0x119746={'count':0x0,'rows':[]};var _0x337b41=_[_0x56bc('0x2a')](db[_0x56bc('0x2b')]['rawAttributes'],function(_0x5786b4){return{'name':_0x5786b4['fieldName'],'type':_0x5786b4[_0x56bc('0x2c')][_0x56bc('0x2d')]};});_0x5454c2[_0x56bc('0x2e')]=_[_0x56bc('0x2a')](_0x337b41,_0x56bc('0x27'));_0x5454c2[_0x56bc('0x2f')]=_['keys'](_0x4746c0['query']);_0x5454c2['filters']=_[_0x56bc('0x30')](_0x5454c2[_0x56bc('0x2e')],_0x5454c2[_0x56bc('0x2f')]);_0x5210d2[_0x56bc('0x31')]=_[_0x56bc('0x30')](_0x5454c2['model'],qs[_0x56bc('0x32')](_0x4746c0['query'][_0x56bc('0x32')]));_0x5210d2[_0x56bc('0x31')]=_0x5210d2[_0x56bc('0x31')][_0x56bc('0x33')]?_0x5210d2['attributes']:_0x5454c2[_0x56bc('0x2e')];if(!_0x4746c0[_0x56bc('0x2f')][_0x56bc('0x34')]('nolimit')){_0x5210d2[_0x56bc('0x1b')]=qs['limit'](_0x4746c0[_0x56bc('0x2f')][_0x56bc('0x1b')]);_0x5210d2[_0x56bc('0x1a')]=qs['offset'](_0x4746c0[_0x56bc('0x2f')][_0x56bc('0x1a')]);}_0x5210d2[_0x56bc('0x35')]=qs[_0x56bc('0x36')](_0x4746c0[_0x56bc('0x2f')]['sort']);_0x5210d2[_0x56bc('0x37')]=qs[_0x56bc('0x38')](_[_0x56bc('0x39')](_0x4746c0[_0x56bc('0x2f')],_0x5454c2['filters']),_0x337b41);if(_0x4746c0[_0x56bc('0x2f')][_0x56bc('0x3a')]){_0x5210d2[_0x56bc('0x37')]=_[_0x56bc('0x3b')](_0x5210d2[_0x56bc('0x37')],{'$or':_[_0x56bc('0x2a')](_0x337b41,function(_0x4baf42){if(_0x4baf42[_0x56bc('0x2c')]!==_0x56bc('0x3c')){var _0x27659b={};_0x27659b[_0x4baf42['name']]={'$like':'%'+_0x4746c0[_0x56bc('0x2f')][_0x56bc('0x3a')]+'%'};return _0x27659b;}})});}_0x5210d2=_[_0x56bc('0x3b')]({},_0x5210d2,_0x4746c0[_0x56bc('0x3d')]);var _0x46ab3e={'where':_0x5210d2[_0x56bc('0x37')]};return db[_0x56bc('0x2b')]['count'](_0x46ab3e)[_0x56bc('0x22')](function(_0x4a023b){_0x119746['count']=_0x4a023b;if(_0x4746c0['query'][_0x56bc('0x3e')]){_0x5210d2['include']=[{'all':!![]}];}return db[_0x56bc('0x2b')][_0x56bc('0x3f')](_0x5210d2);})['then'](function(_0xb8d6d2){_0x119746[_0x56bc('0x40')]=_0xb8d6d2;return _0x119746;})[_0x56bc('0x22')](respondWithFilteredResult(_0xbd42ba,_0x5210d2))['catch'](handleError(_0xbd42ba,null));};exports['show']=function(_0x4ee1e0,_0x278764){var _0x45e3da={'raw':!![],'where':{'id':_0x4ee1e0[_0x56bc('0x41')]['id']}},_0x1df8b1={};_0x1df8b1[_0x56bc('0x2e')]=_[_0x56bc('0x42')](db[_0x56bc('0x2b')][_0x56bc('0x43')]);_0x1df8b1[_0x56bc('0x2f')]=_['keys'](_0x4ee1e0[_0x56bc('0x2f')]);_0x1df8b1[_0x56bc('0x38')]=_[_0x56bc('0x30')](_0x1df8b1[_0x56bc('0x2e')],_0x1df8b1[_0x56bc('0x2f')]);_0x45e3da['attributes']=_[_0x56bc('0x30')](_0x1df8b1[_0x56bc('0x2e')],qs[_0x56bc('0x32')](_0x4ee1e0[_0x56bc('0x2f')][_0x56bc('0x32')]));_0x45e3da[_0x56bc('0x31')]=_0x45e3da[_0x56bc('0x31')][_0x56bc('0x33')]?_0x45e3da[_0x56bc('0x31')]:_0x1df8b1[_0x56bc('0x2e')];if(_0x4ee1e0[_0x56bc('0x2f')][_0x56bc('0x3e')]){_0x45e3da[_0x56bc('0x44')]=[{'all':!![]}];}_0x45e3da=_[_0x56bc('0x3b')]({},_0x45e3da,_0x4ee1e0[_0x56bc('0x3d')]);return db[_0x56bc('0x2b')][_0x56bc('0x45')](_0x45e3da)['then'](handleEntityNotFound(_0x278764,null))[_0x56bc('0x22')](respondWithResult(_0x278764,null))['catch'](handleError(_0x278764,null));};exports['create']=function(_0x51daf1,_0x1b578e){return db[_0x56bc('0x2b')][_0x56bc('0x46')](_0x51daf1['body'],{})[_0x56bc('0x22')](respondWithResult(_0x1b578e,0xc9))[_0x56bc('0x47')](handleError(_0x1b578e,null));};exports[_0x56bc('0x48')]=function(_0x3d638e,_0x20fd41){if(_0x3d638e[_0x56bc('0x49')]['id']){delete _0x3d638e[_0x56bc('0x49')]['id'];}return db[_0x56bc('0x2b')][_0x56bc('0x45')]({'where':{'id':_0x3d638e['params']['id']}})[_0x56bc('0x22')](handleEntityNotFound(_0x20fd41,null))[_0x56bc('0x22')](saveUpdates(_0x3d638e[_0x56bc('0x49')],null))[_0x56bc('0x22')](respondWithResult(_0x20fd41,null))[_0x56bc('0x47')](handleError(_0x20fd41,null));};exports[_0x56bc('0x23')]=function(_0x243632,_0x230f51){return db[_0x56bc('0x2b')][_0x56bc('0x45')]({'where':{'id':_0x243632[_0x56bc('0x41')]['id']}})[_0x56bc('0x22')](handleEntityNotFound(_0x230f51,null))[_0x56bc('0x22')](removeEntity(_0x230f51,null))[_0x56bc('0x47')](handleError(_0x230f51,null));};
\ No newline at end of file
+var _0xa7ef=['fieldName','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','include','findAll','show','params','find','catch','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','VtigerField','rawAttributes'];(function(_0x2db4e0,_0x1a8dff){var _0x3636d9=function(_0x19ea38){while(--_0x19ea38){_0x2db4e0['push'](_0x2db4e0['shift']());}};_0x3636d9(++_0x1a8dff);}(_0xa7ef,0x1c5));var _0xfa7e=function(_0x3f3122,_0x10f5f1){_0x3f3122=_0x3f3122-0x0;var _0x32c27a=_0xa7ef[_0x3f3122];return _0x32c27a;};'use strict';var emlformat=require(_0xfa7e('0x0'));var rimraf=require(_0xfa7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa7e('0x2'));var rp=require(_0xfa7e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfa7e('0x4'));var util=require(_0xfa7e('0x5'));var path=require(_0xfa7e('0x6'));var sox=require(_0xfa7e('0x7'));var csv=require(_0xfa7e('0x8'));var ejs=require(_0xfa7e('0x9'));var fs=require('fs');var fs_extra=require(_0xfa7e('0xa'));var _=require(_0xfa7e('0xb'));var squel=require(_0xfa7e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfa7e('0xd'));var toCsv=require(_0xfa7e('0x8'));var querystring=require(_0xfa7e('0xe'));var Papa=require(_0xfa7e('0xf'));var Redis=require('ioredis');var authService=require(_0xfa7e('0x10'));var qs=require(_0xfa7e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa7e('0x12'));var logger=require(_0xfa7e('0x13'))('api');var utils=require(_0xfa7e('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfa7e('0x15'))['db'];function respondWithStatusCode(_0x417181,_0x22f057){_0x22f057=_0x22f057||0xcc;return function(_0x4d76ee){if(_0x4d76ee){return _0x417181[_0xfa7e('0x16')](_0x22f057);}return _0x417181['status'](_0x22f057)[_0xfa7e('0x17')]();};}function respondWithResult(_0x34ba4c,_0x295ecd){_0x295ecd=_0x295ecd||0xc8;return function(_0x489c69){if(_0x489c69){return _0x34ba4c[_0xfa7e('0x18')](_0x295ecd)[_0xfa7e('0x19')](_0x489c69);}};}function respondWithFilteredResult(_0x121e38,_0x245017){return function(_0x46256d){if(_0x46256d){var _0x59ad3a=typeof _0x245017[_0xfa7e('0x1a')]===_0xfa7e('0x1b')&&typeof _0x245017[_0xfa7e('0x1c')]===_0xfa7e('0x1b');var _0x363b16=_0x46256d[_0xfa7e('0x1d')];var _0x4d884e=_0x59ad3a?0x0:_0x245017['offset'];var _0x54e9d3=_0x59ad3a?_0x46256d[_0xfa7e('0x1d')]:_0x245017[_0xfa7e('0x1a')]+_0x245017[_0xfa7e('0x1c')];var _0x18ef57;if(_0x54e9d3>=_0x363b16){_0x54e9d3=_0x363b16;_0x18ef57=0xc8;}else{_0x18ef57=0xce;}_0x121e38[_0xfa7e('0x18')](_0x18ef57);return _0x121e38[_0xfa7e('0x1e')](_0xfa7e('0x1f'),_0x4d884e+'-'+_0x54e9d3+'/'+_0x363b16)[_0xfa7e('0x19')](_0x46256d);}return null;};}function patchUpdates(_0x3b8b6d){return function(_0x1c50d9){try{jsonpatch[_0xfa7e('0x20')](_0x1c50d9,_0x3b8b6d,!![]);}catch(_0x4b6165){return BPromise[_0xfa7e('0x21')](_0x4b6165);}return _0x1c50d9[_0xfa7e('0x22')]();};}function saveUpdates(_0x387d55,_0x24804c){return function(_0xfb8232){if(_0xfb8232){return _0xfb8232['update'](_0x387d55)[_0xfa7e('0x23')](function(_0xd70339){return _0xd70339;});}return null;};}function removeEntity(_0xead48d,_0x588b3e){return function(_0x52fe66){if(_0x52fe66){return _0x52fe66[_0xfa7e('0x24')]()[_0xfa7e('0x23')](function(){_0xead48d[_0xfa7e('0x18')](0xcc)[_0xfa7e('0x17')]();});}};}function handleEntityNotFound(_0x42410a,_0x255616){return function(_0x3c0a58){if(!_0x3c0a58){_0x42410a[_0xfa7e('0x16')](0x194);}return _0x3c0a58;};}function handleError(_0x37e94a,_0x40373e){_0x40373e=_0x40373e||0x1f4;return function(_0x441897){logger['error'](_0x441897[_0xfa7e('0x25')]);if(_0x441897[_0xfa7e('0x26')]){delete _0x441897[_0xfa7e('0x26')];}_0x37e94a[_0xfa7e('0x18')](_0x40373e)[_0xfa7e('0x27')](_0x441897);};}exports[_0xfa7e('0x28')]=function(_0x59d584,_0x2ee781){var _0x2c6576={},_0x477101={},_0x2f247f={'count':0x0,'rows':[]};var _0x4bddca=_[_0xfa7e('0x29')](db[_0xfa7e('0x2a')][_0xfa7e('0x2b')],function(_0x1afab7){return{'name':_0x1afab7[_0xfa7e('0x2c')],'type':_0x1afab7['type'][_0xfa7e('0x2d')]};});_0x477101['model']=_[_0xfa7e('0x29')](_0x4bddca,_0xfa7e('0x26'));_0x477101['query']=_[_0xfa7e('0x2e')](_0x59d584[_0xfa7e('0x2f')]);_0x477101['filters']=_['intersection'](_0x477101['model'],_0x477101['query']);_0x2c6576['attributes']=_[_0xfa7e('0x30')](_0x477101[_0xfa7e('0x31')],qs['fields'](_0x59d584[_0xfa7e('0x2f')][_0xfa7e('0x32')]));_0x2c6576[_0xfa7e('0x33')]=_0x2c6576[_0xfa7e('0x33')][_0xfa7e('0x34')]?_0x2c6576[_0xfa7e('0x33')]:_0x477101[_0xfa7e('0x31')];if(!_0x59d584[_0xfa7e('0x2f')][_0xfa7e('0x35')](_0xfa7e('0x36'))){_0x2c6576[_0xfa7e('0x1c')]=qs[_0xfa7e('0x1c')](_0x59d584[_0xfa7e('0x2f')][_0xfa7e('0x1c')]);_0x2c6576['offset']=qs['offset'](_0x59d584[_0xfa7e('0x2f')][_0xfa7e('0x1a')]);}_0x2c6576[_0xfa7e('0x37')]=qs[_0xfa7e('0x38')](_0x59d584[_0xfa7e('0x2f')][_0xfa7e('0x38')]);_0x2c6576[_0xfa7e('0x39')]=qs[_0xfa7e('0x3a')](_['pick'](_0x59d584[_0xfa7e('0x2f')],_0x477101[_0xfa7e('0x3a')]),_0x4bddca);if(_0x59d584['query'][_0xfa7e('0x3b')]){_0x2c6576[_0xfa7e('0x39')]=_[_0xfa7e('0x3c')](_0x2c6576[_0xfa7e('0x39')],{'$or':_[_0xfa7e('0x29')](_0x4bddca,function(_0x102512){if(_0x102512[_0xfa7e('0x3d')]!=='VIRTUAL'){var _0x38e951={};_0x38e951[_0x102512[_0xfa7e('0x26')]]={'$like':'%'+_0x59d584[_0xfa7e('0x2f')][_0xfa7e('0x3b')]+'%'};return _0x38e951;}})});}_0x2c6576=_[_0xfa7e('0x3c')]({},_0x2c6576,_0x59d584['options']);var _0x1bbf9b={'where':_0x2c6576[_0xfa7e('0x39')]};return db[_0xfa7e('0x2a')][_0xfa7e('0x1d')](_0x1bbf9b)[_0xfa7e('0x23')](function(_0x47a6ec){_0x2f247f[_0xfa7e('0x1d')]=_0x47a6ec;if(_0x59d584[_0xfa7e('0x2f')]['includeAll']){_0x2c6576[_0xfa7e('0x3e')]=[{'all':!![]}];}return db[_0xfa7e('0x2a')][_0xfa7e('0x3f')](_0x2c6576);})[_0xfa7e('0x23')](function(_0x17bf17){_0x2f247f['rows']=_0x17bf17;return _0x2f247f;})[_0xfa7e('0x23')](respondWithFilteredResult(_0x2ee781,_0x2c6576))['catch'](handleError(_0x2ee781,null));};exports[_0xfa7e('0x40')]=function(_0x5333ce,_0x3276f1){var _0x50613d={'raw':!![],'where':{'id':_0x5333ce[_0xfa7e('0x41')]['id']}},_0x179eb8={};_0x179eb8['model']=_[_0xfa7e('0x2e')](db[_0xfa7e('0x2a')][_0xfa7e('0x2b')]);_0x179eb8[_0xfa7e('0x2f')]=_[_0xfa7e('0x2e')](_0x5333ce[_0xfa7e('0x2f')]);_0x179eb8[_0xfa7e('0x3a')]=_[_0xfa7e('0x30')](_0x179eb8[_0xfa7e('0x31')],_0x179eb8[_0xfa7e('0x2f')]);_0x50613d[_0xfa7e('0x33')]=_[_0xfa7e('0x30')](_0x179eb8[_0xfa7e('0x31')],qs[_0xfa7e('0x32')](_0x5333ce[_0xfa7e('0x2f')][_0xfa7e('0x32')]));_0x50613d[_0xfa7e('0x33')]=_0x50613d['attributes']['length']?_0x50613d['attributes']:_0x179eb8[_0xfa7e('0x31')];if(_0x5333ce[_0xfa7e('0x2f')]['includeAll']){_0x50613d[_0xfa7e('0x3e')]=[{'all':!![]}];}_0x50613d=_[_0xfa7e('0x3c')]({},_0x50613d,_0x5333ce['options']);return db[_0xfa7e('0x2a')][_0xfa7e('0x42')](_0x50613d)[_0xfa7e('0x23')](handleEntityNotFound(_0x3276f1,null))[_0xfa7e('0x23')](respondWithResult(_0x3276f1,null))[_0xfa7e('0x43')](handleError(_0x3276f1,null));};exports[_0xfa7e('0x44')]=function(_0x512929,_0x141e04){return db['VtigerField'][_0xfa7e('0x44')](_0x512929[_0xfa7e('0x45')],{})[_0xfa7e('0x23')](respondWithResult(_0x141e04,0xc9))[_0xfa7e('0x43')](handleError(_0x141e04,null));};exports[_0xfa7e('0x46')]=function(_0x541d48,_0x58e370){if(_0x541d48[_0xfa7e('0x45')]['id']){delete _0x541d48['body']['id'];}return db[_0xfa7e('0x2a')][_0xfa7e('0x42')]({'where':{'id':_0x541d48[_0xfa7e('0x41')]['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x58e370,null))[_0xfa7e('0x23')](saveUpdates(_0x541d48[_0xfa7e('0x45')],null))[_0xfa7e('0x23')](respondWithResult(_0x58e370,null))[_0xfa7e('0x43')](handleError(_0x58e370,null));};exports[_0xfa7e('0x24')]=function(_0x5bba22,_0x21e801){return db[_0xfa7e('0x2a')]['find']({'where':{'id':_0x5bba22[_0xfa7e('0x41')]['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x21e801,null))['then'](removeEntity(_0x21e801,null))[_0xfa7e('0x43')](handleError(_0x21e801,null));};
\ No newline at end of file
index 6e2e2b9..e693e84 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfddb=['exports','define','VtigerField','int_vtiger_fields','idField','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xfddb,0x122));var _0xbfdd=function(_0x5af25f,_0x4aaaeb){_0x5af25f=_0x5af25f-0x0;var _0x29309c=_0xfddb[_0x5af25f];return _0x29309c;};'use strict';var _=require('lodash');var util=require(_0xbfdd('0x0'));var logger=require(_0xbfdd('0x1'))(_0xbfdd('0x2'));var moment=require(_0xbfdd('0x3'));var BPromise=require(_0xbfdd('0x4'));var rp=require(_0xbfdd('0x5'));var fs=require('fs');var path=require(_0xbfdd('0x6'));var rimraf=require(_0xbfdd('0x7'));var config=require(_0xbfdd('0x8'));var attributes=require(_0xbfdd('0x9'));module[_0xbfdd('0xa')]=function(_0x8b7280,_0x53a785){return _0x8b7280[_0xbfdd('0xb')](_0xbfdd('0xc'),attributes,{'tableName':_0xbfdd('0xd'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xbfdd('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x187a=['api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerField.attributes','define','VtigerField','vtiger_unique_index','idField','lodash','../../config/logger'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x187a,0x150));var _0xa187=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x187a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa187('0x0'));var util=require('util');var logger=require(_0xa187('0x1'))(_0xa187('0x2'));var moment=require(_0xa187('0x3'));var BPromise=require(_0xa187('0x4'));var rp=require(_0xa187('0x5'));var fs=require('fs');var path=require(_0xa187('0x6'));var rimraf=require('rimraf');var config=require(_0xa187('0x7'));var attributes=require(_0xa187('0x8'));module['exports']=function(_0x5cee8c,_0x4050a1){return _0x5cee8c[_0xa187('0x9')](_0xa187('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xa187('0xb'),'fields':[_0xa187('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index afae26c..c612d7f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b59=['http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x47f5f5,_0x150630){var _0x4cbd98=function(_0x172e6d){while(--_0x172e6d){_0x47f5f5['push'](_0x47f5f5['shift']());}};_0x4cbd98(++_0x150630);}(_0x0b59,0xae));var _0x90b5=function(_0x2a929d,_0x2c9990){_0x2a929d=_0x2a929d-0x0;var _0x5819c3=_0x0b59[_0x2a929d];return _0x5819c3;};'use strict';var _=require(_0x90b5('0x0'));var util=require(_0x90b5('0x1'));var moment=require(_0x90b5('0x2'));var BPromise=require(_0x90b5('0x3'));var rs=require(_0x90b5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90b5('0x5'));var logger=require(_0x90b5('0x6'))(_0x90b5('0x7'));var config=require(_0x90b5('0x8'));var jayson=require(_0x90b5('0x9'));var client=jayson['client'][_0x90b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19c133,_0x3f74d2,_0x4ae13f){return new BPromise(function(_0x542394,_0x1bd772){return client[_0x90b5('0xb')](_0x19c133,_0x4ae13f)[_0x90b5('0xc')](function(_0x4a59c7){logger[_0x90b5('0xd')](_0x90b5('0xe'),_0x3f74d2,_0x90b5('0xf'));logger[_0x90b5('0x10')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x3f74d2,_0x90b5('0xf'),JSON[_0x90b5('0x11')](_0x4a59c7));if(_0x4a59c7[_0x90b5('0x12')]){if(_0x4a59c7[_0x90b5('0x12')][_0x90b5('0x13')]===0x1f4){logger[_0x90b5('0x12')]('VtigerField,\x20%s,\x20%s',_0x3f74d2,_0x4a59c7[_0x90b5('0x12')][_0x90b5('0x14')]);return _0x1bd772(_0x4a59c7[_0x90b5('0x12')][_0x90b5('0x14')]);}logger['error'](_0x90b5('0xe'),_0x3f74d2,_0x4a59c7['error'][_0x90b5('0x14')]);return _0x542394(_0x4a59c7['error']['message']);}else{logger[_0x90b5('0xd')]('VtigerField,\x20%s,\x20%s',_0x3f74d2,_0x90b5('0xf'));_0x542394(_0x4a59c7[_0x90b5('0x15')][_0x90b5('0x14')]);}})[_0x90b5('0x16')](function(_0x50a740){logger['error'](_0x90b5('0xe'),_0x3f74d2,_0x50a740);_0x1bd772(_0x50a740);});});}
\ No newline at end of file
+var _0x6a6a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x4b4ce4,_0x4e65e3){var _0x560ee3=function(_0x237826){while(--_0x237826){_0x4b4ce4['push'](_0x4b4ce4['shift']());}};_0x560ee3(++_0x4e65e3);}(_0x6a6a,0xf9));var _0xa6a6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6a6a[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xa6a6('0x0'));var moment=require('moment');var BPromise=require(_0xa6a6('0x1'));var rs=require(_0xa6a6('0x2'));var fs=require('fs');var Redis=require(_0xa6a6('0x3'));var db=require(_0xa6a6('0x4'))['db'];var utils=require(_0xa6a6('0x5'));var logger=require(_0xa6a6('0x6'))(_0xa6a6('0x7'));var config=require(_0xa6a6('0x8'));var jayson=require(_0xa6a6('0x9'));var client=jayson[_0xa6a6('0xa')][_0xa6a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x597ca8,_0x2421e4,_0x476e57){return new BPromise(function(_0x10ac2e,_0x29772c){return client['request'](_0x597ca8,_0x476e57)[_0xa6a6('0xc')](function(_0x28df3f){logger[_0xa6a6('0xd')](_0xa6a6('0xe'),_0x2421e4,_0xa6a6('0xf'));logger[_0xa6a6('0x10')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x2421e4,'request\x20sent',JSON[_0xa6a6('0x11')](_0x28df3f));if(_0x28df3f[_0xa6a6('0x12')]){if(_0x28df3f[_0xa6a6('0x12')][_0xa6a6('0x13')]===0x1f4){logger['error'](_0xa6a6('0xe'),_0x2421e4,_0x28df3f[_0xa6a6('0x12')]['message']);return _0x29772c(_0x28df3f[_0xa6a6('0x12')]['message']);}logger[_0xa6a6('0x12')](_0xa6a6('0xe'),_0x2421e4,_0x28df3f[_0xa6a6('0x12')]['message']);return _0x10ac2e(_0x28df3f[_0xa6a6('0x12')][_0xa6a6('0x14')]);}else{logger[_0xa6a6('0xd')]('VtigerField,\x20%s,\x20%s',_0x2421e4,_0xa6a6('0xf'));_0x10ac2e(_0x28df3f[_0xa6a6('0x15')]['message']);}})[_0xa6a6('0x16')](function(_0x2a6052){logger[_0xa6a6('0x12')](_0xa6a6('0xe'),_0x2421e4,_0x2a6052);_0x29772c(_0x2a6052);});});}
\ No newline at end of file
index 84da81b..f764e0a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x59fd=['../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','isAuthenticated','/:id','show','get','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x867f95,_0x43d423){var _0x4cd98d=function(_0x85348e){while(--_0x85348e){_0x867f95['push'](_0x867f95['shift']());}};_0x4cd98d(++_0x43d423);}(_0x59fd,0x1f3));var _0xd59f=function(_0xdea771,_0x4636f3){_0xdea771=_0xdea771-0x0;var _0x5d8c0d=_0x59fd[_0xdea771];return _0x5d8c0d;};'use strict';var multer=require(_0xd59f('0x0'));var util=require(_0xd59f('0x1'));var path=require(_0xd59f('0x2'));var timeout=require(_0xd59f('0x3'));var express=require(_0xd59f('0x4'));var router=express[_0xd59f('0x5')]();var fs_extra=require(_0xd59f('0x6'));var auth=require(_0xd59f('0x7'));var interaction=require(_0xd59f('0x8'));var config=require('../../config/environment');var controller=require(_0xd59f('0x9'));router['get']('/',auth[_0xd59f('0xa')](),controller['index']);router['get'](_0xd59f('0xb'),auth[_0xd59f('0xa')](),controller[_0xd59f('0xc')]);router[_0xd59f('0xd')]('/:id/configurations',auth[_0xd59f('0xa')](),controller[_0xd59f('0xe')]);router[_0xd59f('0xd')](_0xd59f('0xf'),auth[_0xd59f('0xa')](),controller[_0xd59f('0x10')]);router['post']('/',auth[_0xd59f('0xa')](),controller[_0xd59f('0x11')]);router[_0xd59f('0x12')](_0xd59f('0x13'),auth[_0xd59f('0xa')](),controller['addConfiguration']);router[_0xd59f('0x14')](_0xd59f('0xb'),auth['isAuthenticated'](),controller[_0xd59f('0x15')]);router[_0xd59f('0x16')](_0xd59f('0xb'),auth[_0xd59f('0xa')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0xb1a2=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xb1a2,0x106));var _0x2b1a=function(_0xcf02bc,_0x59c5bc){_0xcf02bc=_0xcf02bc-0x0;var _0x4024f3=_0xb1a2[_0xcf02bc];return _0x4024f3;};'use strict';var multer=require('multer');var util=require(_0x2b1a('0x0'));var path=require(_0x2b1a('0x1'));var timeout=require('connect-timeout');var express=require(_0x2b1a('0x2'));var router=express[_0x2b1a('0x3')]();var fs_extra=require(_0x2b1a('0x4'));var auth=require(_0x2b1a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2b1a('0x6'));var controller=require('./intZendeskAccount.controller');router[_0x2b1a('0x7')]('/',auth[_0x2b1a('0x8')](),controller[_0x2b1a('0x9')]);router[_0x2b1a('0x7')](_0x2b1a('0xa'),auth[_0x2b1a('0x8')](),controller[_0x2b1a('0xb')]);router[_0x2b1a('0x7')](_0x2b1a('0xc'),auth[_0x2b1a('0x8')](),controller[_0x2b1a('0xd')]);router['get'](_0x2b1a('0xe'),auth[_0x2b1a('0x8')](),controller[_0x2b1a('0xf')]);router[_0x2b1a('0x10')]('/',auth[_0x2b1a('0x8')](),controller[_0x2b1a('0x11')]);router['post'](_0x2b1a('0xc'),auth['isAuthenticated'](),controller[_0x2b1a('0x12')]);router[_0x2b1a('0x13')](_0x2b1a('0xa'),auth['isAuthenticated'](),controller[_0x2b1a('0x14')]);router[_0x2b1a('0x15')](_0x2b1a('0xa'),auth[_0x2b1a('0x8')](),controller[_0x2b1a('0x16')]);module[_0x2b1a('0x17')]=router;
\ No newline at end of file
index e391a8c..b9d764d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa5c1=['ENUM','password','token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri'];(function(_0x443bdb,_0x5291ae){var _0x3bfb99=function(_0x21bb6c){while(--_0x21bb6c){_0x443bdb['push'](_0x443bdb['shift']());}};_0x3bfb99(++_0x5291ae);}(_0xa5c1,0x19f));var _0x1a5c=function(_0xa0c484,_0x47e3b1){_0xa0c484=_0xa0c484-0x0;var _0x123829=_0xa5c1[_0xa0c484];return _0x123829;};'use strict';var Sequelize=require(_0x1a5c('0x0'));module[_0x1a5c('0x1')]={'name':{'type':Sequelize[_0x1a5c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x1a5c('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x1a5c('0x2')]},'remoteUri':{'type':Sequelize[_0x1a5c('0x2')],'unique':_0x1a5c('0x4')},'authType':{'type':Sequelize[_0x1a5c('0x5')](_0x1a5c('0x6'),_0x1a5c('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x1a5c('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1a5c('0x8'),_0x1a5c('0x9')),'defaultValue':_0x1a5c('0x8')}};
\ No newline at end of file
+var _0x79a3=['newTab','integrationTab','sequelize','STRING','username','remoteUri','ENUM','password','token'];(function(_0x5209f3,_0x5ab7c6){var _0xd2473f=function(_0x1d1deb){while(--_0x1d1deb){_0x5209f3['push'](_0x5209f3['shift']());}};_0xd2473f(++_0x5ab7c6);}(_0x79a3,0x80));var _0x379a=function(_0x7d2e77,_0x561c88){_0x7d2e77=_0x7d2e77-0x0;var _0x12f3e9=_0x79a3[_0x7d2e77];return _0x12f3e9;};'use strict';var Sequelize=require(_0x379a('0x0'));module['exports']={'name':{'type':Sequelize[_0x379a('0x1')]},'description':{'type':Sequelize[_0x379a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x379a('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x379a('0x3')},'authType':{'type':Sequelize[_0x379a('0x4')](_0x379a('0x5'),_0x379a('0x6')),'defaultValue':_0x379a('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x379a('0x7')),'defaultValue':_0x379a('0x8')}};
\ No newline at end of file
index ae84ad9..89ce166 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x80ed=['rawAttributes','sort','pick','filter','addConfiguration','AccountId','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','authType','remoteUri','substring','lastIndexOf','GET','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s:%s','toString','%s/token:%s','token','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','includes','position','system_field_options','custom_field_options','test','statusCode','error','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','sendStatus','stack','name','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','options','ZendeskAccount','findAll','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne'];(function(_0x280c73,_0x447cf4){var _0x4aba76=function(_0x5505e7){while(--_0x5505e7){_0x280c73['push'](_0x280c73['shift']());}};_0x4aba76(++_0x447cf4);}(_0x80ed,0x11c));var _0xd80e=function(_0x489533,_0x5efdbe){_0x489533=_0x489533-0x0;var _0x44ec13=_0x80ed[_0x489533];return _0x44ec13;};'use strict';var emlformat=require(_0xd80e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd80e('0x1'));var jsonpatch=require(_0xd80e('0x2'));var rp=require(_0xd80e('0x3'));var moment=require('moment');var BPromise=require(_0xd80e('0x4'));var Mustache=require(_0xd80e('0x5'));var util=require(_0xd80e('0x6'));var path=require(_0xd80e('0x7'));var sox=require('sox');var csv=require(_0xd80e('0x8'));var ejs=require(_0xd80e('0x9'));var fs=require('fs');var fs_extra=require(_0xd80e('0xa'));var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x8'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var licenseUtil=require(_0xd80e('0x19'));var db=require(_0xd80e('0x1a'))['db'];var integrations=require(_0xd80e('0x1b'));function respondWithStatusCode(_0x1d3fcf,_0x4fb01c){_0x4fb01c=_0x4fb01c||0xcc;return function(_0x5691a1){if(_0x5691a1){return _0x1d3fcf['sendStatus'](_0x4fb01c);}return _0x1d3fcf['status'](_0x4fb01c)[_0xd80e('0x1c')]();};}function respondWithResult(_0x3d233b,_0x3096ae){_0x3096ae=_0x3096ae||0xc8;return function(_0x1e8b63){if(_0x1e8b63){return _0x3d233b[_0xd80e('0x1d')](_0x3096ae)['json'](_0x1e8b63);}};}function respondWithFilteredResult(_0x595683,_0x2c8c61){return function(_0x3124e8){if(_0x3124e8){var _0x3b48ae=typeof _0x2c8c61[_0xd80e('0x1e')]===_0xd80e('0x1f')&&typeof _0x2c8c61[_0xd80e('0x20')]===_0xd80e('0x1f');var _0x49e3e5=_0x3124e8[_0xd80e('0x21')];var _0x1cc576=_0x3b48ae?0x0:_0x2c8c61[_0xd80e('0x1e')];var _0x34e239=_0x3b48ae?_0x3124e8['count']:_0x2c8c61[_0xd80e('0x1e')]+_0x2c8c61[_0xd80e('0x20')];var _0xecfe74;if(_0x34e239>=_0x49e3e5){_0x34e239=_0x49e3e5;_0xecfe74=0xc8;}else{_0xecfe74=0xce;}_0x595683['status'](_0xecfe74);return _0x595683[_0xd80e('0x22')](_0xd80e('0x23'),_0x1cc576+'-'+_0x34e239+'/'+_0x49e3e5)[_0xd80e('0x24')](_0x3124e8);}return null;};}function patchUpdates(_0x147134){return function(_0x46b6eb){try{jsonpatch['apply'](_0x46b6eb,_0x147134,!![]);}catch(_0x4b6b8a){return BPromise[_0xd80e('0x25')](_0x4b6b8a);}return _0x46b6eb[_0xd80e('0x26')]();};}function saveUpdates(_0x3b39bf,_0x2d46e7){return function(_0x3eb3ca){if(_0x3eb3ca){return _0x3eb3ca[_0xd80e('0x27')](_0x3b39bf)[_0xd80e('0x28')](function(_0x5430b6){return _0x5430b6;});}return null;};}function removeEntity(_0x1fbf8a,_0x57d70){return function(_0x170109){if(_0x170109){return _0x170109['destroy']()[_0xd80e('0x28')](function(){_0x1fbf8a[_0xd80e('0x1d')](0xcc)[_0xd80e('0x1c')]();});}};}function handleEntityNotFound(_0x482779,_0x521aa4){return function(_0x5420e7){if(!_0x5420e7){_0x482779[_0xd80e('0x29')](0x194);}return _0x5420e7;};}function handleError(_0x4b8291,_0x9f9287){_0x9f9287=_0x9f9287||0x1f4;return function(_0x1044cc){logger['error'](_0x1044cc[_0xd80e('0x2a')]);if(_0x1044cc[_0xd80e('0x2b')]){delete _0x1044cc[_0xd80e('0x2b')];}_0x4b8291[_0xd80e('0x1d')](_0x9f9287)['send'](_0x1044cc);};}exports[_0xd80e('0x2c')]=function(_0x1ad3bc,_0x845451){var _0x39088b={},_0x2b1aaf={},_0x361946={'count':0x0,'rows':[]};var _0x289685=_[_0xd80e('0x2d')](db['ZendeskAccount']['rawAttributes'],function(_0x30f9bd){return{'name':_0x30f9bd[_0xd80e('0x2e')],'type':_0x30f9bd[_0xd80e('0x2f')][_0xd80e('0x30')]};});_0x2b1aaf[_0xd80e('0x31')]=_[_0xd80e('0x2d')](_0x289685,'name');_0x2b1aaf['query']=_[_0xd80e('0x32')](_0x1ad3bc[_0xd80e('0x33')]);_0x2b1aaf[_0xd80e('0x34')]=_[_0xd80e('0x35')](_0x2b1aaf[_0xd80e('0x31')],_0x2b1aaf[_0xd80e('0x33')]);_0x39088b[_0xd80e('0x36')]=_[_0xd80e('0x35')](_0x2b1aaf['model'],qs['fields'](_0x1ad3bc[_0xd80e('0x33')][_0xd80e('0x37')]));_0x39088b[_0xd80e('0x36')]=_0x39088b[_0xd80e('0x36')][_0xd80e('0x38')]?_0x39088b[_0xd80e('0x36')]:_0x2b1aaf[_0xd80e('0x31')];if(!_0x1ad3bc[_0xd80e('0x33')][_0xd80e('0x39')](_0xd80e('0x3a'))){_0x39088b['limit']=qs[_0xd80e('0x20')](_0x1ad3bc['query'][_0xd80e('0x20')]);_0x39088b[_0xd80e('0x1e')]=qs[_0xd80e('0x1e')](_0x1ad3bc[_0xd80e('0x33')]['offset']);}_0x39088b[_0xd80e('0x3b')]=qs['sort'](_0x1ad3bc[_0xd80e('0x33')]['sort']);_0x39088b[_0xd80e('0x3c')]=qs[_0xd80e('0x34')](_['pick'](_0x1ad3bc[_0xd80e('0x33')],_0x2b1aaf[_0xd80e('0x34')]),_0x289685);if(_0x1ad3bc[_0xd80e('0x33')]['filter']){_0x39088b[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x39088b[_0xd80e('0x3c')],{'$or':_[_0xd80e('0x2d')](_0x289685,function(_0x3c6f5f){if(_0x3c6f5f[_0xd80e('0x2f')]!==_0xd80e('0x3e')){var _0x137552={};_0x137552[_0x3c6f5f[_0xd80e('0x2b')]]={'$like':'%'+_0x1ad3bc['query']['filter']+'%'};return _0x137552;}})});}_0x39088b=_['merge']({},_0x39088b,_0x1ad3bc[_0xd80e('0x3f')]);var _0x3ff4b4={'where':_0x39088b['where']};return db[_0xd80e('0x40')]['count'](_0x3ff4b4)[_0xd80e('0x28')](function(_0x5ade19){_0x361946[_0xd80e('0x21')]=_0x5ade19;if(_0x1ad3bc[_0xd80e('0x33')]['includeAll']){_0x39088b['include']=[{'all':!![]}];}return db[_0xd80e('0x40')][_0xd80e('0x41')](_0x39088b);})[_0xd80e('0x28')](function(_0x3e65a7){_0x361946[_0xd80e('0x42')]=_0x3e65a7;return _0x361946;})[_0xd80e('0x28')](respondWithFilteredResult(_0x845451,_0x39088b))[_0xd80e('0x43')](handleError(_0x845451,null));};exports[_0xd80e('0x44')]=function(_0x91c6ed,_0x2da5f5){var _0x1bbb36={'raw':![],'where':{'id':_0x91c6ed[_0xd80e('0x45')]['id']}},_0x2e257e={};_0x2e257e[_0xd80e('0x31')]=_[_0xd80e('0x32')](db[_0xd80e('0x40')]['rawAttributes']);_0x2e257e['query']=_['keys'](_0x91c6ed[_0xd80e('0x33')]);_0x2e257e['filters']=_[_0xd80e('0x35')](_0x2e257e[_0xd80e('0x31')],_0x2e257e[_0xd80e('0x33')]);_0x1bbb36[_0xd80e('0x36')]=_[_0xd80e('0x35')](_0x2e257e[_0xd80e('0x31')],qs['fields'](_0x91c6ed['query']['fields']));_0x1bbb36[_0xd80e('0x36')]=_0x1bbb36['attributes'][_0xd80e('0x38')]?_0x1bbb36[_0xd80e('0x36')]:_0x2e257e[_0xd80e('0x31')];if(_0x91c6ed[_0xd80e('0x33')][_0xd80e('0x46')]){_0x1bbb36['include']=[{'all':!![]}];}_0x1bbb36=_[_0xd80e('0x3d')]({},_0x1bbb36,_0x91c6ed[_0xd80e('0x3f')]);return db[_0xd80e('0x40')]['find'](_0x1bbb36)[_0xd80e('0x28')](handleEntityNotFound(_0x2da5f5,null))[_0xd80e('0x28')](respondWithResult(_0x2da5f5,null))[_0xd80e('0x43')](handleError(_0x2da5f5,null));};exports['create']=function(_0x8d5cb8,_0x29aaa0){return db[_0xd80e('0x40')][_0xd80e('0x47')](_0x8d5cb8[_0xd80e('0x48')],{})[_0xd80e('0x28')](respondWithResult(_0x29aaa0,0xc9))['catch'](handleError(_0x29aaa0,null));};exports['update']=function(_0x275985,_0x27134e){if(_0x275985[_0xd80e('0x48')]['id']){delete _0x275985['body']['id'];}return db['ZendeskAccount'][_0xd80e('0x49')]({'where':{'id':_0x275985[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x27134e,null))[_0xd80e('0x28')](saveUpdates(_0x275985[_0xd80e('0x48')],null))['then'](respondWithResult(_0x27134e,null))[_0xd80e('0x43')](handleError(_0x27134e,null));};exports['destroy']=function(_0x46c781,_0x31107b){return db['ZendeskAccount'][_0xd80e('0x49')]({'where':{'id':_0x46c781[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x31107b,null))[_0xd80e('0x28')](removeEntity(_0x31107b,null))[_0xd80e('0x43')](handleError(_0x31107b,null));};exports[_0xd80e('0x4a')]=function(_0x18dbb0,_0x50be26,_0x178c51){var _0x377e68={};var _0x419df7={};var _0x4a66ca;var _0x52ab04;return db[_0xd80e('0x40')][_0xd80e('0x4b')]({'where':{'id':_0x18dbb0[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x50be26,null))[_0xd80e('0x28')](function(_0x8b7a70){if(_0x8b7a70){_0x4a66ca=_0x8b7a70;_0x419df7[_0xd80e('0x31')]=_[_0xd80e('0x32')](db['ZendeskConfiguration'][_0xd80e('0x4c')]);_0x419df7['query']=_[_0xd80e('0x32')](_0x18dbb0[_0xd80e('0x33')]);_0x419df7[_0xd80e('0x34')]=_[_0xd80e('0x35')](_0x419df7[_0xd80e('0x31')],_0x419df7[_0xd80e('0x33')]);_0x377e68['attributes']=_[_0xd80e('0x35')](_0x419df7['model'],qs[_0xd80e('0x37')](_0x18dbb0[_0xd80e('0x33')]['fields']));_0x377e68['attributes']=_0x377e68[_0xd80e('0x36')][_0xd80e('0x38')]?_0x377e68[_0xd80e('0x36')]:_0x419df7['model'];_0x377e68['order']=qs[_0xd80e('0x4d')](_0x18dbb0[_0xd80e('0x33')]['sort']);_0x377e68[_0xd80e('0x3c')]=qs[_0xd80e('0x34')](_[_0xd80e('0x4e')](_0x18dbb0['query'],_0x419df7[_0xd80e('0x34')]));if(_0x18dbb0['query'][_0xd80e('0x4f')]){_0x377e68[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x377e68[_0xd80e('0x3c')],{'$or':_['map'](_0x377e68[_0xd80e('0x36')],function(_0x564475){var _0x53b784={};_0x53b784[_0x564475]={'$like':'%'+_0x18dbb0['query'][_0xd80e('0x4f')]+'%'};return _0x53b784;})});}_0x377e68=_[_0xd80e('0x3d')]({},_0x377e68,_0x18dbb0[_0xd80e('0x3f')]);return _0x4a66ca[_0xd80e('0x4a')](_0x377e68);}})['then'](function(_0x1738ff){if(_0x1738ff){_0x52ab04=_0x1738ff[_0xd80e('0x38')];if(!_0x18dbb0['query'][_0xd80e('0x39')](_0xd80e('0x3a'))){_0x377e68[_0xd80e('0x20')]=qs[_0xd80e('0x20')](_0x18dbb0['query'][_0xd80e('0x20')]);_0x377e68[_0xd80e('0x1e')]=qs['offset'](_0x18dbb0[_0xd80e('0x33')][_0xd80e('0x1e')]);}return _0x4a66ca[_0xd80e('0x4a')](_0x377e68);}})['then'](function(_0x562ed7){if(_0x562ed7){return _0x562ed7?{'count':_0x52ab04,'rows':_0x562ed7}:null;}})['then'](respondWithResult(_0x50be26,null))['catch'](handleError(_0x50be26,null));};exports[_0xd80e('0x50')]=function(_0x4f283c,_0x3c8ad1,_0x1b0ad4){if(_0x4f283c[_0xd80e('0x48')]['id']){delete _0x4f283c['body']['id'];}return db[_0xd80e('0x40')][_0xd80e('0x4b')]({'where':{'id':_0x4f283c[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x3c8ad1,null))[_0xd80e('0x28')](function(_0x2a34cd){if(_0x2a34cd){_0x4f283c[_0xd80e('0x48')][_0xd80e('0x51')]=_0x2a34cd['id'];_0x4f283c[_0xd80e('0x48')]['Subjects']=integrations['getSubjects'](_0x4f283c[_0xd80e('0x48')][_0xd80e('0x52')],_0x4f283c[_0xd80e('0x48')][_0xd80e('0x2f')]);_0x4f283c['body'][_0xd80e('0x53')]=integrations[_0xd80e('0x54')](_0x4f283c[_0xd80e('0x48')][_0xd80e('0x52')],_0x4f283c[_0xd80e('0x48')]['type']);return db[_0xd80e('0x55')][_0xd80e('0x47')](_0x4f283c[_0xd80e('0x48')],{'include':[{'model':db[_0xd80e('0x56')],'as':'Subjects'},{'model':db[_0xd80e('0x56')],'as':_0xd80e('0x53')}]});}return null;})[_0xd80e('0x28')](respondWithResult(_0x3c8ad1,null))[_0xd80e('0x43')](handleError(_0x3c8ad1,null));};exports[_0xd80e('0x57')]=function(_0x1edcf4,_0x5cb11c,_0x3e3176){var _0x393fb6='';return db['ZendeskAccount'][_0xd80e('0x4b')]({'where':{'id':_0x1edcf4[_0xd80e('0x45')]['id']},'attributes':['id',_0xd80e('0x58'),_0xd80e('0x59'),'token',_0xd80e('0x5a'),'remoteUri']})[_0xd80e('0x28')](handleEntityNotFound(_0x5cb11c,null))[_0xd80e('0x28')](function(_0x194743){if(_0x194743){_0x393fb6=_0x194743[_0xd80e('0x5b')];var _0x4186bd=_0x393fb6['slice'](-0x1);if(_0x4186bd==='/'){_0x393fb6=_0x393fb6[_0xd80e('0x5c')](0x0,_0x393fb6[_0xd80e('0x5d')](_0x4186bd));}var _0x25e86d={'method':_0xd80e('0x5e'),'uri':util['format'](_0xd80e('0x5f'),_0x393fb6,_0xd80e('0x60')),'json':!![]};switch(_0x194743['authType']){case _0xd80e('0x59'):_0x25e86d[_0xd80e('0x61')]={'Authorization':util[_0xd80e('0x62')](_0xd80e('0x63'),new Buffer(util[_0xd80e('0x62')](_0xd80e('0x64'),_0x194743['username'],_0x194743['password']))[_0xd80e('0x65')]('base64'))};break;case'token':_0x25e86d[_0xd80e('0x61')]={'Authorization':util[_0xd80e('0x62')](_0xd80e('0x63'),new Buffer(util[_0xd80e('0x62')](_0xd80e('0x66'),_0x194743[_0xd80e('0x58')],_0x194743[_0xd80e('0x67')]))[_0xd80e('0x65')]('base64'))};break;default:throw new db[(_0xd80e('0x68'))][(_0xd80e('0x69'))](_0xd80e('0x6a'));}return rp(_0x25e86d);}})[_0xd80e('0x28')](function(_0x575bf6){if(_0x575bf6){var _0x192178=[_0xd80e('0x6b'),'description',_0xd80e('0x6c'),_0xd80e('0x6d')];_['remove'](_0x575bf6[_0xd80e('0x60')],function(_0x160dc4){return _0x192178[_0xd80e('0x6e')](_0x160dc4[_0xd80e('0x2f')]);});return{'count':_0x575bf6[_0xd80e('0x60')][_0xd80e('0x38')],'rows':_[_0xd80e('0x2d')](_0x575bf6[_0xd80e('0x60')],function(_0x392a8b){return{'id':_0x392a8b['id'],'name':_0x392a8b[_0xd80e('0x6f')]>0x7?_0x392a8b['title']:_0x392a8b[_0xd80e('0x2f')],'custom':_0x392a8b[_0xd80e('0x6f')]>0x7?!![]:![],'options':_0x392a8b['system_field_options']?_0x392a8b[_0xd80e('0x70')]:_0x392a8b[_0xd80e('0x71')]?_0x392a8b[_0xd80e('0x71')]:[]};})};}})['then'](respondWithResult(_0x5cb11c,null))[_0xd80e('0x43')](function(_0x5277a2){var _0x30fc66=_0x1edcf4[_0xd80e('0x33')][_0xd80e('0x72')]?0x1f4:_0x5277a2[_0xd80e('0x73')]||0x1f4;logger[_0xd80e('0x74')]('getFields,\x20%s,\x20%s,\x20%s',_0xd80e('0x57'),_0x30fc66,JSON[_0xd80e('0x75')](_0x5277a2));delete _0x5277a2[_0xd80e('0x2b')];if(_0x30fc66===0x191){_0x30fc66=0x190;}_0x5cb11c[_0xd80e('0x1d')](_0x30fc66)[_0xd80e('0x76')](_0x1edcf4[_0xd80e('0x33')][_0xd80e('0x72')]?{'message':_0xd80e('0x77'),'statusCode':_0x5277a2[_0xd80e('0x73')]}:_0x5277a2);});};
\ No newline at end of file
+var _0x7916=['hasOwnProperty','order','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','update','body','getConfigurations','ZendeskConfiguration','sort','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','findOne','password','token','remoteUri','slice','substring','GET','format','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','username','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','count','limit','status','set','apply','save','then','destroy','error','name','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes'];(function(_0x529cd5,_0x5d37ca){var _0x35dcd6=function(_0x466c66){while(--_0x466c66){_0x529cd5['push'](_0x529cd5['shift']());}};_0x35dcd6(++_0x5d37ca);}(_0x7916,0x128));var _0x6791=function(_0x37e7b5,_0x5d1240){_0x37e7b5=_0x37e7b5-0x0;var _0x490284=_0x7916[_0x37e7b5];return _0x490284;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];var integrations=require(_0x6791('0x17'));function respondWithStatusCode(_0x16c62b,_0x423e22){_0x423e22=_0x423e22||0xcc;return function(_0x11c730){if(_0x11c730){return _0x16c62b[_0x6791('0x18')](_0x423e22);}return _0x16c62b['status'](_0x423e22)['end']();};}function respondWithResult(_0x34b28d,_0x5122f9){_0x5122f9=_0x5122f9||0xc8;return function(_0x2a9151){if(_0x2a9151){return _0x34b28d['status'](_0x5122f9)[_0x6791('0x19')](_0x2a9151);}};}function respondWithFilteredResult(_0x163898,_0x517910){return function(_0x3e4792){if(_0x3e4792){var _0x4b80ed=typeof _0x517910[_0x6791('0x1a')]===_0x6791('0x1b')&&typeof _0x517910['limit']===_0x6791('0x1b');var _0x36d7a1=_0x3e4792['count'];var _0x1872f5=_0x4b80ed?0x0:_0x517910['offset'];var _0xe55dba=_0x4b80ed?_0x3e4792[_0x6791('0x1c')]:_0x517910[_0x6791('0x1a')]+_0x517910[_0x6791('0x1d')];var _0x25adbc;if(_0xe55dba>=_0x36d7a1){_0xe55dba=_0x36d7a1;_0x25adbc=0xc8;}else{_0x25adbc=0xce;}_0x163898[_0x6791('0x1e')](_0x25adbc);return _0x163898[_0x6791('0x1f')]('Content-Range',_0x1872f5+'-'+_0xe55dba+'/'+_0x36d7a1)[_0x6791('0x19')](_0x3e4792);}return null;};}function patchUpdates(_0x306acb){return function(_0x51368e){try{jsonpatch[_0x6791('0x20')](_0x51368e,_0x306acb,!![]);}catch(_0x3b57f0){return BPromise['reject'](_0x3b57f0);}return _0x51368e[_0x6791('0x21')]();};}function saveUpdates(_0x309610,_0x15b9ab){return function(_0x12d83b){if(_0x12d83b){return _0x12d83b['update'](_0x309610)[_0x6791('0x22')](function(_0x1b516d){return _0x1b516d;});}return null;};}function removeEntity(_0x4a8717,_0x53bb44){return function(_0x4b23bc){if(_0x4b23bc){return _0x4b23bc[_0x6791('0x23')]()['then'](function(){_0x4a8717[_0x6791('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a092,_0x496273){return function(_0x5cadc){if(!_0x5cadc){_0x54a092[_0x6791('0x18')](0x194);}return _0x5cadc;};}function handleError(_0xd49b84,_0x56a74e){_0x56a74e=_0x56a74e||0x1f4;return function(_0x3def2e){logger[_0x6791('0x24')](_0x3def2e['stack']);if(_0x3def2e[_0x6791('0x25')]){delete _0x3def2e['name'];}_0xd49b84[_0x6791('0x1e')](_0x56a74e)['send'](_0x3def2e);};}exports['index']=function(_0x270a1d,_0x551718){var _0x2f56a2={},_0x34b006={},_0x483d6c={'count':0x0,'rows':[]};var _0x240a9f=_[_0x6791('0x26')](db[_0x6791('0x27')][_0x6791('0x28')],function(_0x5d9d54){return{'name':_0x5d9d54['fieldName'],'type':_0x5d9d54[_0x6791('0x29')]['key']};});_0x34b006[_0x6791('0x2a')]=_[_0x6791('0x26')](_0x240a9f,_0x6791('0x25'));_0x34b006[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x270a1d[_0x6791('0x2b')]);_0x34b006[_0x6791('0x2d')]=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],_0x34b006[_0x6791('0x2b')]);_0x2f56a2['attributes']=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x2f')]));_0x2f56a2[_0x6791('0x30')]=_0x2f56a2['attributes']['length']?_0x2f56a2['attributes']:_0x34b006[_0x6791('0x2a')];if(!_0x270a1d[_0x6791('0x2b')][_0x6791('0x31')]('nolimit')){_0x2f56a2['limit']=qs[_0x6791('0x1d')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1d')]);_0x2f56a2[_0x6791('0x1a')]=qs['offset'](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1a')]);}_0x2f56a2[_0x6791('0x32')]=qs['sort'](_0x270a1d[_0x6791('0x2b')]['sort']);_0x2f56a2['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x270a1d['query'],_0x34b006[_0x6791('0x2d')]),_0x240a9f);if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x34')]){_0x2f56a2[_0x6791('0x35')]=_[_0x6791('0x36')](_0x2f56a2['where'],{'$or':_[_0x6791('0x26')](_0x240a9f,function(_0xc95516){if(_0xc95516[_0x6791('0x29')]!=='VIRTUAL'){var _0x3a6062={};_0x3a6062[_0xc95516[_0x6791('0x25')]]={'$like':'%'+_0x270a1d[_0x6791('0x2b')]['filter']+'%'};return _0x3a6062;}})});}_0x2f56a2=_[_0x6791('0x36')]({},_0x2f56a2,_0x270a1d[_0x6791('0x37')]);var _0x13be81={'where':_0x2f56a2[_0x6791('0x35')]};return db['ZendeskAccount'][_0x6791('0x1c')](_0x13be81)[_0x6791('0x22')](function(_0x3e95b6){_0x483d6c[_0x6791('0x1c')]=_0x3e95b6;if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x38')]){_0x2f56a2[_0x6791('0x39')]=[{'all':!![]}];}return db[_0x6791('0x27')][_0x6791('0x3a')](_0x2f56a2);})['then'](function(_0x52c03a){_0x483d6c[_0x6791('0x3b')]=_0x52c03a;return _0x483d6c;})[_0x6791('0x22')](respondWithFilteredResult(_0x551718,_0x2f56a2))['catch'](handleError(_0x551718,null));};exports[_0x6791('0x3c')]=function(_0x1c9913,_0x1c6803){var _0x3edb86={'raw':![],'where':{'id':_0x1c9913[_0x6791('0x3d')]['id']}},_0x1a922e={};_0x1a922e[_0x6791('0x2a')]=_['keys'](db[_0x6791('0x27')]['rawAttributes']);_0x1a922e[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x1c9913[_0x6791('0x2b')]);_0x1a922e[_0x6791('0x2d')]=_['intersection'](_0x1a922e[_0x6791('0x2a')],_0x1a922e[_0x6791('0x2b')]);_0x3edb86[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x1a922e[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x1c9913[_0x6791('0x2b')][_0x6791('0x2f')]));_0x3edb86['attributes']=_0x3edb86[_0x6791('0x30')][_0x6791('0x3e')]?_0x3edb86[_0x6791('0x30')]:_0x1a922e[_0x6791('0x2a')];if(_0x1c9913['query'][_0x6791('0x38')]){_0x3edb86[_0x6791('0x39')]=[{'all':!![]}];}_0x3edb86=_['merge']({},_0x3edb86,_0x1c9913[_0x6791('0x37')]);return db['ZendeskAccount'][_0x6791('0x3f')](_0x3edb86)[_0x6791('0x22')](handleEntityNotFound(_0x1c6803,null))[_0x6791('0x22')](respondWithResult(_0x1c6803,null))[_0x6791('0x40')](handleError(_0x1c6803,null));};exports[_0x6791('0x41')]=function(_0xb2a2,_0x4163f5){return db[_0x6791('0x27')][_0x6791('0x41')](_0xb2a2['body'],{})[_0x6791('0x22')](respondWithResult(_0x4163f5,0xc9))['catch'](handleError(_0x4163f5,null));};exports[_0x6791('0x42')]=function(_0x2bb86a,_0x276002){if(_0x2bb86a[_0x6791('0x43')]['id']){delete _0x2bb86a[_0x6791('0x43')]['id'];}return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x2bb86a[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x276002,null))[_0x6791('0x22')](saveUpdates(_0x2bb86a[_0x6791('0x43')],null))['then'](respondWithResult(_0x276002,null))[_0x6791('0x40')](handleError(_0x276002,null));};exports[_0x6791('0x23')]=function(_0x4ff9f4,_0x3df699){return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x4ff9f4[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x3df699,null))[_0x6791('0x22')](removeEntity(_0x3df699,null))['catch'](handleError(_0x3df699,null));};exports[_0x6791('0x44')]=function(_0x243faf,_0x5655c8,_0x189b22){var _0x4370ab={};var _0x3a895b={};var _0x5df56e;var _0x355e97;return db[_0x6791('0x27')]['findOne']({'where':{'id':_0x243faf[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5655c8,null))['then'](function(_0x169531){if(_0x169531){_0x5df56e=_0x169531;_0x3a895b[_0x6791('0x2a')]=_[_0x6791('0x2c')](db[_0x6791('0x45')]['rawAttributes']);_0x3a895b[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x243faf[_0x6791('0x2b')]);_0x3a895b['filters']=_['intersection'](_0x3a895b[_0x6791('0x2a')],_0x3a895b[_0x6791('0x2b')]);_0x4370ab[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x3a895b[_0x6791('0x2a')],qs['fields'](_0x243faf['query'][_0x6791('0x2f')]));_0x4370ab['attributes']=_0x4370ab['attributes'][_0x6791('0x3e')]?_0x4370ab[_0x6791('0x30')]:_0x3a895b[_0x6791('0x2a')];_0x4370ab[_0x6791('0x32')]=qs[_0x6791('0x46')](_0x243faf[_0x6791('0x2b')]['sort']);_0x4370ab['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x243faf['query'],_0x3a895b[_0x6791('0x2d')]));if(_0x243faf['query'][_0x6791('0x34')]){_0x4370ab[_0x6791('0x35')]=_['merge'](_0x4370ab[_0x6791('0x35')],{'$or':_[_0x6791('0x26')](_0x4370ab[_0x6791('0x30')],function(_0x49ed65){var _0x3ba679={};_0x3ba679[_0x49ed65]={'$like':'%'+_0x243faf[_0x6791('0x2b')][_0x6791('0x34')]+'%'};return _0x3ba679;})});}_0x4370ab=_[_0x6791('0x36')]({},_0x4370ab,_0x243faf[_0x6791('0x37')]);return _0x5df56e['getConfigurations'](_0x4370ab);}})['then'](function(_0x1a9acd){if(_0x1a9acd){_0x355e97=_0x1a9acd[_0x6791('0x3e')];if(!_0x243faf['query'][_0x6791('0x31')](_0x6791('0x47'))){_0x4370ab[_0x6791('0x1d')]=qs[_0x6791('0x1d')](_0x243faf[_0x6791('0x2b')][_0x6791('0x1d')]);_0x4370ab[_0x6791('0x1a')]=qs[_0x6791('0x1a')](_0x243faf['query'][_0x6791('0x1a')]);}return _0x5df56e[_0x6791('0x44')](_0x4370ab);}})[_0x6791('0x22')](function(_0x1a9a2e){if(_0x1a9a2e){return _0x1a9a2e?{'count':_0x355e97,'rows':_0x1a9a2e}:null;}})['then'](respondWithResult(_0x5655c8,null))[_0x6791('0x40')](handleError(_0x5655c8,null));};exports[_0x6791('0x48')]=function(_0xa8a8dd,_0x5ca809,_0x205320){if(_0xa8a8dd[_0x6791('0x43')]['id']){delete _0xa8a8dd[_0x6791('0x43')]['id'];}return db[_0x6791('0x27')]['findOne']({'where':{'id':_0xa8a8dd[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5ca809,null))['then'](function(_0x1114d4){if(_0x1114d4){_0xa8a8dd[_0x6791('0x43')][_0x6791('0x49')]=_0x1114d4['id'];_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4a')]=integrations[_0x6791('0x4b')](_0xa8a8dd['body'][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);_0xa8a8dd['body'][_0x6791('0x4d')]=integrations['getDescriptions'](_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);return db[_0x6791('0x45')]['create'](_0xa8a8dd[_0x6791('0x43')],{'include':[{'model':db[_0x6791('0x4e')],'as':_0x6791('0x4a')},{'model':db[_0x6791('0x4e')],'as':'Descriptions'}]});}return null;})[_0x6791('0x22')](respondWithResult(_0x5ca809,null))[_0x6791('0x40')](handleError(_0x5ca809,null));};exports['getFields']=function(_0x34691c,_0x1fa44a,_0x567302){var _0x201465='';return db[_0x6791('0x27')][_0x6791('0x4f')]({'where':{'id':_0x34691c[_0x6791('0x3d')]['id']},'attributes':['id','username',_0x6791('0x50'),_0x6791('0x51'),'authType',_0x6791('0x52')]})[_0x6791('0x22')](handleEntityNotFound(_0x1fa44a,null))[_0x6791('0x22')](function(_0x20c736){if(_0x20c736){_0x201465=_0x20c736[_0x6791('0x52')];var _0x4ecf62=_0x201465[_0x6791('0x53')](-0x1);if(_0x4ecf62==='/'){_0x201465=_0x201465[_0x6791('0x54')](0x0,_0x201465['lastIndexOf'](_0x4ecf62));}var _0x4463ef={'method':_0x6791('0x55'),'uri':util[_0x6791('0x56')]('%s/%s',_0x201465,_0x6791('0x57')),'json':!![]};switch(_0x20c736[_0x6791('0x58')]){case _0x6791('0x50'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')](_0x6791('0x5a'),new Buffer(util[_0x6791('0x56')](_0x6791('0x5b'),_0x20c736['username'],_0x20c736[_0x6791('0x50')]))[_0x6791('0x5c')]('base64'))};break;case _0x6791('0x51'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')]('Basic\x20%s',new Buffer(util[_0x6791('0x56')]('%s/token:%s',_0x20c736[_0x6791('0x5d')],_0x20c736[_0x6791('0x51')]))[_0x6791('0x5c')](_0x6791('0x5e')))};break;default:throw new db[(_0x6791('0x5f'))][(_0x6791('0x60'))](_0x6791('0x61'));}return rp(_0x4463ef);}})[_0x6791('0x22')](function(_0x23e0d3){if(_0x23e0d3){var _0x1fa853=[_0x6791('0x62'),_0x6791('0x63'),_0x6791('0x64'),_0x6791('0x65')];_[_0x6791('0x66')](_0x23e0d3[_0x6791('0x57')],function(_0x3b53b8){return _0x1fa853[_0x6791('0x67')](_0x3b53b8[_0x6791('0x29')]);});return{'count':_0x23e0d3['ticket_fields']['length'],'rows':_['map'](_0x23e0d3[_0x6791('0x57')],function(_0x31c1a8){return{'id':_0x31c1a8['id'],'name':_0x31c1a8[_0x6791('0x68')]>0x7?_0x31c1a8[_0x6791('0x69')]:_0x31c1a8[_0x6791('0x29')],'custom':_0x31c1a8[_0x6791('0x68')]>0x7?!![]:![],'options':_0x31c1a8[_0x6791('0x6a')]?_0x31c1a8[_0x6791('0x6a')]:_0x31c1a8[_0x6791('0x6b')]?_0x31c1a8[_0x6791('0x6b')]:[]};})};}})[_0x6791('0x22')](respondWithResult(_0x1fa44a,null))[_0x6791('0x40')](function(_0x44ec4d){var _0x4047b6=_0x34691c[_0x6791('0x2b')][_0x6791('0x6c')]?0x1f4:_0x44ec4d[_0x6791('0x6d')]||0x1f4;logger[_0x6791('0x24')](_0x6791('0x6e'),_0x6791('0x6f'),_0x4047b6,JSON[_0x6791('0x70')](_0x44ec4d));delete _0x44ec4d[_0x6791('0x25')];if(_0x4047b6===0x191){_0x4047b6=0x190;}_0x1fa44a[_0x6791('0x1e')](_0x4047b6)[_0x6791('0x71')](_0x34691c[_0x6791('0x2b')]['test']?{'message':_0x6791('0x72'),'statusCode':_0x44ec4d['statusCode']}:_0x44ec4d);});};
\ No newline at end of file
index 5b5fd97..ba634f8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8fc5=['../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','lodash','util','../../config/logger','api','request-promise','rimraf'];(function(_0x1590f8,_0x1aec1f){var _0x11f84e=function(_0x48cbb2){while(--_0x48cbb2){_0x1590f8['push'](_0x1590f8['shift']());}};_0x11f84e(++_0x1aec1f);}(_0x8fc5,0xc0));var _0x58fc=function(_0x26ab7e,_0x470770){_0x26ab7e=_0x26ab7e-0x0;var _0x37b9b2=_0x8fc5[_0x26ab7e];return _0x37b9b2;};'use strict';var _=require(_0x58fc('0x0'));var util=require(_0x58fc('0x1'));var logger=require(_0x58fc('0x2'))(_0x58fc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x58fc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58fc('0x5'));var config=require(_0x58fc('0x6'));var attributes=require(_0x58fc('0x7'));var integrations=require(_0x58fc('0x8'));module[_0x58fc('0x9')]=function(_0x3ca679,_0x37384b){return _0x3ca679['define'](_0x58fc('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x51b9=['request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','../../config/logger','api','moment'];(function(_0x29abfc,_0x5751ad){var _0xac81e0=function(_0x4b7224){while(--_0x4b7224){_0x29abfc['push'](_0x29abfc['shift']());}};_0xac81e0(++_0x5751ad);}(_0x51b9,0xc9));var _0x951b=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x51b9[_0x164af1];return _0x5d81a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x951b('0x0'))(_0x951b('0x1'));var moment=require(_0x951b('0x2'));var BPromise=require('bluebird');var rp=require(_0x951b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x951b('0x4'));var config=require(_0x951b('0x5'));var attributes=require(_0x951b('0x6'));var integrations=require(_0x951b('0x7'));module[_0x951b('0x8')]=function(_0xf3ed04,_0xe6a1f5){return _0xf3ed04[_0x951b('0x9')](_0x951b('0xa'),attributes,{'tableName':_0x951b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 000220e..c35786f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc858=['find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','limit','include','map','model','attributes','ShowZendeskAccount'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc858,0x6e));var _0x8c85=function(_0x5384d9,_0xebfd91){_0x5384d9=_0x5384d9-0x0;var _0x13be9e=_0xc858[_0x5384d9];return _0x13be9e;};'use strict';var _=require(_0x8c85('0x0'));var util=require(_0x8c85('0x1'));var moment=require(_0x8c85('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c85('0x3'));var fs=require('fs');var Redis=require(_0x8c85('0x4'));var db=require(_0x8c85('0x5'))['db'];var utils=require(_0x8c85('0x6'));var logger=require(_0x8c85('0x7'))('rpc');var config=require(_0x8c85('0x8'));var jayson=require(_0x8c85('0x9'));var client=jayson[_0x8c85('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55075a,_0x2cf5f5,_0x195580){return new BPromise(function(_0x4dea73,_0x3993af){return client[_0x8c85('0xb')](_0x55075a,_0x195580)[_0x8c85('0xc')](function(_0x460595){logger[_0x8c85('0xd')](_0x8c85('0xe'),_0x2cf5f5,_0x8c85('0xf'));logger[_0x8c85('0x10')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2cf5f5,_0x8c85('0xf'),JSON[_0x8c85('0x11')](_0x460595));if(_0x460595[_0x8c85('0x12')]){if(_0x460595[_0x8c85('0x12')][_0x8c85('0x13')]===0x1f4){logger[_0x8c85('0x12')](_0x8c85('0xe'),_0x2cf5f5,_0x460595[_0x8c85('0x12')]['message']);return _0x3993af(_0x460595[_0x8c85('0x12')][_0x8c85('0x14')]);}logger[_0x8c85('0x12')](_0x8c85('0xe'),_0x2cf5f5,_0x460595[_0x8c85('0x12')][_0x8c85('0x14')]);return _0x4dea73(_0x460595[_0x8c85('0x12')][_0x8c85('0x14')]);}else{logger[_0x8c85('0xd')](_0x8c85('0xe'),_0x2cf5f5,_0x8c85('0xf'));_0x4dea73(_0x460595[_0x8c85('0x15')][_0x8c85('0x14')]);}})[_0x8c85('0x16')](function(_0x49fa81){logger[_0x8c85('0x12')](_0x8c85('0xe'),_0x2cf5f5,_0x49fa81);_0x3993af(_0x49fa81);});});}exports[_0x8c85('0x17')]=function(_0xa862ee){var _0x3a1ca9=this;return new Promise(function(_0x33dc53,_0x5a0619){return db[_0x8c85('0x18')][_0x8c85('0x19')]({'raw':_0xa862ee['options']?_0xa862ee['options']['raw']===undefined?!![]:![]:!![],'where':_0xa862ee[_0x8c85('0x1a')]?_0xa862ee[_0x8c85('0x1a')][_0x8c85('0x1b')]||null:null,'attributes':_0xa862ee[_0x8c85('0x1a')]?_0xa862ee['options']['attributes']||null:null,'limit':_0xa862ee[_0x8c85('0x1a')]?_0xa862ee[_0x8c85('0x1a')][_0x8c85('0x1c')]||null:null,'include':_0xa862ee[_0x8c85('0x1a')]?_0xa862ee['options'][_0x8c85('0x1d')]?_[_0x8c85('0x1e')](_0xa862ee[_0x8c85('0x1a')][_0x8c85('0x1d')],function(_0x53dbbc){return{'model':db[_0x53dbbc[_0x8c85('0x1f')]],'as':_0x53dbbc['as'],'attributes':_0x53dbbc['attributes'],'include':_0x53dbbc[_0x8c85('0x1d')]?_[_0x8c85('0x1e')](_0x53dbbc['include'],function(_0x2ce327){return{'model':db[_0x2ce327[_0x8c85('0x1f')]],'as':_0x2ce327['as'],'attributes':_0x2ce327[_0x8c85('0x20')],'include':_0x2ce327[_0x8c85('0x1d')]?_[_0x8c85('0x1e')](_0x2ce327[_0x8c85('0x1d')],function(_0x2284a1){return{'model':db[_0x2284a1[_0x8c85('0x1f')]],'as':_0x2284a1['as'],'attributes':_0x2284a1[_0x8c85('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8c85('0xc')](function(_0x22488e){logger['info'](_0x8c85('0x17'),_0xa862ee);logger[_0x8c85('0x10')](_0x8c85('0x17'),_0xa862ee,JSON['stringify'](_0x22488e));_0x33dc53(_0x22488e);})[_0x8c85('0x16')](function(_0x4efcb3){logger[_0x8c85('0x12')](_0x8c85('0x17'),_0x4efcb3[_0x8c85('0x14')],_0xa862ee);_0x5a0619(_0x3a1ca9['error'](0x1f4,_0x4efcb3[_0x8c85('0x14')]));});});};exports[_0x8c85('0x21')]=function(_0x12bba7){var _0x103513=this;return new Promise(function(_0x470c35,_0x4d8bf2){return db['ZendeskAccount'][_0x8c85('0x22')]({'raw':_0x12bba7[_0x8c85('0x1a')]?_0x12bba7[_0x8c85('0x1a')][_0x8c85('0x23')]===undefined?!![]:![]:!![],'where':_0x12bba7[_0x8c85('0x1a')]?_0x12bba7['options'][_0x8c85('0x1b')]||null:null,'attributes':_0x12bba7[_0x8c85('0x1a')]?_0x12bba7[_0x8c85('0x1a')][_0x8c85('0x20')]||null:null,'include':_0x12bba7[_0x8c85('0x1a')]?_0x12bba7[_0x8c85('0x1a')][_0x8c85('0x1d')]?_[_0x8c85('0x1e')](_0x12bba7[_0x8c85('0x1a')][_0x8c85('0x1d')],function(_0x154186){return{'model':db[_0x154186[_0x8c85('0x1f')]],'as':_0x154186['as'],'attributes':_0x154186[_0x8c85('0x20')],'include':_0x154186[_0x8c85('0x1d')]?_[_0x8c85('0x1e')](_0x154186[_0x8c85('0x1d')],function(_0x3a9db1){return{'model':db[_0x3a9db1[_0x8c85('0x1f')]],'as':_0x3a9db1['as'],'attributes':_0x3a9db1[_0x8c85('0x20')],'include':_0x3a9db1[_0x8c85('0x1d')]?_[_0x8c85('0x1e')](_0x3a9db1['include'],function(_0xc5a3ee){return{'model':db[_0xc5a3ee[_0x8c85('0x1f')]],'as':_0xc5a3ee['as'],'attributes':_0xc5a3ee[_0x8c85('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8c85('0xc')](function(_0x40d339){logger[_0x8c85('0xd')]('ShowZendeskAccount',_0x12bba7);logger[_0x8c85('0x10')](_0x8c85('0x21'),_0x12bba7,JSON['stringify'](_0x40d339));_0x470c35(_0x40d339);})['catch'](function(_0x24a8fc){logger[_0x8c85('0x12')](_0x8c85('0x21'),_0x24a8fc[_0x8c85('0x14')],_0x12bba7);_0x4d8bf2(_0x103513['error'](0x1f4,_0x24a8fc['message']));});});};
\ No newline at end of file
+var _0xba18=['attributes','limit','include','map','model','then','ShowZendeskAccount','ZendeskAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','findAll','options','raw'];(function(_0x2bc778,_0x551220){var _0x17f236=function(_0x1861e0){while(--_0x1861e0){_0x2bc778['push'](_0x2bc778['shift']());}};_0x17f236(++_0x551220);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var util=require(_0x8ba1('0x1'));var moment=require(_0x8ba1('0x2'));var BPromise=require(_0x8ba1('0x3'));var rs=require(_0x8ba1('0x4'));var fs=require('fs');var Redis=require(_0x8ba1('0x5'));var db=require(_0x8ba1('0x6'))['db'];var utils=require(_0x8ba1('0x7'));var logger=require('../../config/logger')(_0x8ba1('0x8'));var config=require(_0x8ba1('0x9'));var jayson=require(_0x8ba1('0xa'));var client=jayson[_0x8ba1('0xb')][_0x8ba1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ffa15,_0x51a988,_0x3a87eb){return new BPromise(function(_0x3d1fe7,_0x4dc6c4){return client['request'](_0x2ffa15,_0x3a87eb)['then'](function(_0x4609ce){logger[_0x8ba1('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x51a988,_0x8ba1('0xe'));logger[_0x8ba1('0xf')](_0x8ba1('0x10'),_0x51a988,_0x8ba1('0xe'),JSON[_0x8ba1('0x11')](_0x4609ce));if(_0x4609ce['error']){if(_0x4609ce[_0x8ba1('0x12')][_0x8ba1('0x13')]===0x1f4){logger[_0x8ba1('0x12')](_0x8ba1('0x14'),_0x51a988,_0x4609ce[_0x8ba1('0x12')][_0x8ba1('0x15')]);return _0x4dc6c4(_0x4609ce['error'][_0x8ba1('0x15')]);}logger[_0x8ba1('0x12')](_0x8ba1('0x14'),_0x51a988,_0x4609ce[_0x8ba1('0x12')]['message']);return _0x3d1fe7(_0x4609ce['error']['message']);}else{logger[_0x8ba1('0xd')](_0x8ba1('0x14'),_0x51a988,_0x8ba1('0xe'));_0x3d1fe7(_0x4609ce[_0x8ba1('0x16')][_0x8ba1('0x15')]);}})[_0x8ba1('0x17')](function(_0x107846){logger[_0x8ba1('0x12')](_0x8ba1('0x14'),_0x51a988,_0x107846);_0x4dc6c4(_0x107846);});});}exports[_0x8ba1('0x18')]=function(_0x4d75fa){var _0x4c6325=this;return new Promise(function(_0x1a48fa,_0x360f00){return db['ZendeskAccount'][_0x8ba1('0x19')]({'raw':_0x4d75fa[_0x8ba1('0x1a')]?_0x4d75fa[_0x8ba1('0x1a')][_0x8ba1('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d75fa[_0x8ba1('0x1a')]?_0x4d75fa[_0x8ba1('0x1a')]['where']||null:null,'attributes':_0x4d75fa[_0x8ba1('0x1a')]?_0x4d75fa['options'][_0x8ba1('0x1c')]||null:null,'limit':_0x4d75fa[_0x8ba1('0x1a')]?_0x4d75fa[_0x8ba1('0x1a')][_0x8ba1('0x1d')]||null:null,'include':_0x4d75fa['options']?_0x4d75fa[_0x8ba1('0x1a')][_0x8ba1('0x1e')]?_[_0x8ba1('0x1f')](_0x4d75fa[_0x8ba1('0x1a')][_0x8ba1('0x1e')],function(_0x3b70ea){return{'model':db[_0x3b70ea[_0x8ba1('0x20')]],'as':_0x3b70ea['as'],'attributes':_0x3b70ea[_0x8ba1('0x1c')],'include':_0x3b70ea[_0x8ba1('0x1e')]?_[_0x8ba1('0x1f')](_0x3b70ea[_0x8ba1('0x1e')],function(_0x550d33){return{'model':db[_0x550d33['model']],'as':_0x550d33['as'],'attributes':_0x550d33[_0x8ba1('0x1c')],'include':_0x550d33[_0x8ba1('0x1e')]?_['map'](_0x550d33[_0x8ba1('0x1e')],function(_0xef508d){return{'model':db[_0xef508d[_0x8ba1('0x20')]],'as':_0xef508d['as'],'attributes':_0xef508d[_0x8ba1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8ba1('0x21')](function(_0x8d8220){logger[_0x8ba1('0xd')](_0x8ba1('0x18'),_0x4d75fa);logger[_0x8ba1('0xf')](_0x8ba1('0x18'),_0x4d75fa,JSON[_0x8ba1('0x11')](_0x8d8220));_0x1a48fa(_0x8d8220);})[_0x8ba1('0x17')](function(_0x32782a){logger[_0x8ba1('0x12')]('GetZendeskAccount',_0x32782a[_0x8ba1('0x15')],_0x4d75fa);_0x360f00(_0x4c6325[_0x8ba1('0x12')](0x1f4,_0x32782a[_0x8ba1('0x15')]));});});};exports[_0x8ba1('0x22')]=function(_0x243a0a){var _0x24bf95=this;return new Promise(function(_0x52b9c6,_0x35378e){return db[_0x8ba1('0x23')]['find']({'raw':_0x243a0a[_0x8ba1('0x1a')]?_0x243a0a['options'][_0x8ba1('0x1b')]===undefined?!![]:![]:!![],'where':_0x243a0a[_0x8ba1('0x1a')]?_0x243a0a['options'][_0x8ba1('0x24')]||null:null,'attributes':_0x243a0a[_0x8ba1('0x1a')]?_0x243a0a[_0x8ba1('0x1a')][_0x8ba1('0x1c')]||null:null,'include':_0x243a0a[_0x8ba1('0x1a')]?_0x243a0a['options'][_0x8ba1('0x1e')]?_[_0x8ba1('0x1f')](_0x243a0a[_0x8ba1('0x1a')][_0x8ba1('0x1e')],function(_0x2313e8){return{'model':db[_0x2313e8[_0x8ba1('0x20')]],'as':_0x2313e8['as'],'attributes':_0x2313e8[_0x8ba1('0x1c')],'include':_0x2313e8[_0x8ba1('0x1e')]?_['map'](_0x2313e8[_0x8ba1('0x1e')],function(_0x162bae){return{'model':db[_0x162bae[_0x8ba1('0x20')]],'as':_0x162bae['as'],'attributes':_0x162bae[_0x8ba1('0x1c')],'include':_0x162bae[_0x8ba1('0x1e')]?_[_0x8ba1('0x1f')](_0x162bae[_0x8ba1('0x1e')],function(_0x36c8c3){return{'model':db[_0x36c8c3[_0x8ba1('0x20')]],'as':_0x36c8c3['as'],'attributes':_0x36c8c3[_0x8ba1('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc79922){logger[_0x8ba1('0xd')](_0x8ba1('0x22'),_0x243a0a);logger[_0x8ba1('0xf')](_0x8ba1('0x22'),_0x243a0a,JSON[_0x8ba1('0x11')](_0xc79922));_0x52b9c6(_0xc79922);})[_0x8ba1('0x17')](function(_0x2db01a){logger[_0x8ba1('0x12')](_0x8ba1('0x22'),_0x2db01a['message'],_0x243a0a);_0x35378e(_0x24bf95['error'](0x1f4,_0x2db01a[_0x8ba1('0x15')]));});});};
\ No newline at end of file
index 1782b28..89eaf54 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x36ee=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','update','delete','destroy','exports','path','express'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x36ee,0xe8));var _0xe36e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x36ee[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x8')](_0xe36e('0x13'),auth[_0xe36e('0x9')](),controller['getTags']);router[_0xe36e('0x14')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x14')]('/:id/tags',auth[_0xe36e('0x9')](),controller['setTags']);router['put'](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x16')]);router[_0xe36e('0x17')](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x18')]);module[_0xe36e('0x19')]=router;
\ No newline at end of file
+var _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x295634,_0x2d57b4){var _0x3514d6=function(_0x359f66){while(--_0x359f66){_0x295634['push'](_0x295634['shift']());}};_0x3514d6(++_0x2d57b4);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e712f,_0x60d75f){_0x2e712f=_0x2e712f-0x0;var _0x2fb152=_0xb10b[_0x2e712f];return _0x2fb152;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router;
\ No newline at end of file
index 639e1c9..541169e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xecfa=['STRING','sequelize','exports'];(function(_0x5dec4c,_0x5ae5f9){var _0x131fb5=function(_0x58960d){while(--_0x58960d){_0x5dec4c['push'](_0x5dec4c['shift']());}};_0x131fb5(++_0x5ae5f9);}(_0xecfa,0x16c));var _0xaecf=function(_0x41e967,_0x366d3b){_0x41e967=_0x41e967-0x0;var _0x215576=_0xecfa[_0x41e967];return _0x215576;};'use strict';var Sequelize=require(_0xaecf('0x0'));module[_0xaecf('0x1')]={'name':{'type':Sequelize[_0xaecf('0x2')]},'description':{'type':Sequelize[_0xaecf('0x2')]}};
\ No newline at end of file
+var _0x885b=['exports','STRING','sequelize'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x885b,0xf2));var _0xb885=function(_0x1f5624,_0x3a9d3f){_0x1f5624=_0x1f5624-0x0;var _0xc535d0=_0x885b[_0x1f5624];return _0xc535d0;};'use strict';var Sequelize=require(_0xb885('0x0'));module[_0xb885('0x1')]={'name':{'type':Sequelize[_0xb885('0x2')]},'description':{'type':Sequelize[_0xb885('0x2')]}};
\ No newline at end of file
index 4565341..0aece02 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaf02=['save','update','then','destroy','end','sendStatus','error','stack','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','sort','filter','where','VIRTUAL','name','include','findAll','rows','catch','params','includeAll','merge','options','find','create','body','findOne','order','pick','getFields','getSubjects','hasOwnProperty','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','apply'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf02,0xe2));var _0x2af0=function(_0x5311e0,_0x21022c){_0x5311e0=_0x5311e0-0x0;var _0x9a859=_0xaf02[_0x5311e0];return _0x9a859;};'use strict';var emlformat=require(_0x2af0('0x0'));var rimraf=require(_0x2af0('0x1'));var zipdir=require(_0x2af0('0x2'));var jsonpatch=require(_0x2af0('0x3'));var rp=require(_0x2af0('0x4'));var moment=require(_0x2af0('0x5'));var BPromise=require(_0x2af0('0x6'));var Mustache=require(_0x2af0('0x7'));var util=require(_0x2af0('0x8'));var path=require(_0x2af0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2af0('0xa'));var fs=require('fs');var fs_extra=require(_0x2af0('0xb'));var _=require(_0x2af0('0xc'));var squel=require('squel');var crypto=require(_0x2af0('0xd'));var jsforce=require(_0x2af0('0xe'));var deskjs=require(_0x2af0('0xf'));var toCsv=require(_0x2af0('0x10'));var querystring=require(_0x2af0('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2af0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2af0('0x13'));var logger=require(_0x2af0('0x14'))(_0x2af0('0x15'));var utils=require(_0x2af0('0x16'));var config=require(_0x2af0('0x17'));var licenseUtil=require(_0x2af0('0x18'));var db=require(_0x2af0('0x19'))['db'];function respondWithStatusCode(_0x4586db,_0x511c6c){_0x511c6c=_0x511c6c||0xcc;return function(_0xc54f0f){if(_0xc54f0f){return _0x4586db['sendStatus'](_0x511c6c);}return _0x4586db[_0x2af0('0x1a')](_0x511c6c)['end']();};}function respondWithResult(_0x5746ef,_0x4b1328){_0x4b1328=_0x4b1328||0xc8;return function(_0x115e06){if(_0x115e06){return _0x5746ef[_0x2af0('0x1a')](_0x4b1328)[_0x2af0('0x1b')](_0x115e06);}};}function respondWithFilteredResult(_0x1b2a88,_0x5deb19){return function(_0x129eec){if(_0x129eec){var _0x2aa03f=typeof _0x5deb19['offset']===_0x2af0('0x1c')&&typeof _0x5deb19[_0x2af0('0x1d')]===_0x2af0('0x1c');var _0x3175fe=_0x129eec['count'];var _0x32ff7c=_0x2aa03f?0x0:_0x5deb19[_0x2af0('0x1e')];var _0x582b8b=_0x2aa03f?_0x129eec[_0x2af0('0x1f')]:_0x5deb19[_0x2af0('0x1e')]+_0x5deb19[_0x2af0('0x1d')];var _0x48eec7;if(_0x582b8b>=_0x3175fe){_0x582b8b=_0x3175fe;_0x48eec7=0xc8;}else{_0x48eec7=0xce;}_0x1b2a88['status'](_0x48eec7);return _0x1b2a88[_0x2af0('0x20')](_0x2af0('0x21'),_0x32ff7c+'-'+_0x582b8b+'/'+_0x3175fe)[_0x2af0('0x1b')](_0x129eec);}return null;};}function patchUpdates(_0x2b1e68){return function(_0x3e9d4f){try{jsonpatch[_0x2af0('0x22')](_0x3e9d4f,_0x2b1e68,!![]);}catch(_0x3f1069){return BPromise['reject'](_0x3f1069);}return _0x3e9d4f[_0x2af0('0x23')]();};}function saveUpdates(_0x4ff513,_0x3cb159){return function(_0x46fa57){if(_0x46fa57){return _0x46fa57[_0x2af0('0x24')](_0x4ff513)[_0x2af0('0x25')](function(_0x17ad92){return _0x17ad92;});}return null;};}function removeEntity(_0x3d4cc2,_0x598111){return function(_0x28ed1d){if(_0x28ed1d){return _0x28ed1d[_0x2af0('0x26')]()[_0x2af0('0x25')](function(){_0x3d4cc2[_0x2af0('0x1a')](0xcc)[_0x2af0('0x27')]();});}};}function handleEntityNotFound(_0x476959,_0x41e926){return function(_0x4fcd73){if(!_0x4fcd73){_0x476959[_0x2af0('0x28')](0x194);}return _0x4fcd73;};}function handleError(_0x41ab67,_0x14e7b8){_0x14e7b8=_0x14e7b8||0x1f4;return function(_0x59d083){logger[_0x2af0('0x29')](_0x59d083[_0x2af0('0x2a')]);if(_0x59d083['name']){delete _0x59d083['name'];}_0x41ab67['status'](_0x14e7b8)[_0x2af0('0x2b')](_0x59d083);};}exports['index']=function(_0x558d6d,_0x1574f2){var _0x18e2d8={},_0x1f37c7={},_0x58c178={'count':0x0,'rows':[]};var _0x5eb6de=_[_0x2af0('0x2c')](db[_0x2af0('0x2d')][_0x2af0('0x2e')],function(_0x9edeb9){return{'name':_0x9edeb9[_0x2af0('0x2f')],'type':_0x9edeb9[_0x2af0('0x30')][_0x2af0('0x31')]};});_0x1f37c7[_0x2af0('0x32')]=_[_0x2af0('0x2c')](_0x5eb6de,'name');_0x1f37c7['query']=_[_0x2af0('0x33')](_0x558d6d['query']);_0x1f37c7[_0x2af0('0x34')]=_[_0x2af0('0x35')](_0x1f37c7[_0x2af0('0x32')],_0x1f37c7[_0x2af0('0x36')]);_0x18e2d8[_0x2af0('0x37')]=_[_0x2af0('0x35')](_0x1f37c7[_0x2af0('0x32')],qs[_0x2af0('0x38')](_0x558d6d[_0x2af0('0x36')]['fields']));_0x18e2d8['attributes']=_0x18e2d8['attributes'][_0x2af0('0x39')]?_0x18e2d8[_0x2af0('0x37')]:_0x1f37c7[_0x2af0('0x32')];if(!_0x558d6d[_0x2af0('0x36')]['hasOwnProperty'](_0x2af0('0x3a'))){_0x18e2d8['limit']=qs['limit'](_0x558d6d['query'][_0x2af0('0x1d')]);_0x18e2d8['offset']=qs[_0x2af0('0x1e')](_0x558d6d[_0x2af0('0x36')][_0x2af0('0x1e')]);}_0x18e2d8['order']=qs[_0x2af0('0x3b')](_0x558d6d[_0x2af0('0x36')][_0x2af0('0x3b')]);_0x18e2d8['where']=qs[_0x2af0('0x34')](_['pick'](_0x558d6d[_0x2af0('0x36')],_0x1f37c7[_0x2af0('0x34')]),_0x5eb6de);if(_0x558d6d['query'][_0x2af0('0x3c')]){_0x18e2d8[_0x2af0('0x3d')]=_['merge'](_0x18e2d8[_0x2af0('0x3d')],{'$or':_[_0x2af0('0x2c')](_0x5eb6de,function(_0x418c06){if(_0x418c06[_0x2af0('0x30')]!==_0x2af0('0x3e')){var _0x183e42={};_0x183e42[_0x418c06[_0x2af0('0x3f')]]={'$like':'%'+_0x558d6d[_0x2af0('0x36')]['filter']+'%'};return _0x183e42;}})});}_0x18e2d8=_['merge']({},_0x18e2d8,_0x558d6d['options']);var _0x4bd07d={'where':_0x18e2d8[_0x2af0('0x3d')]};return db['ZendeskConfiguration']['count'](_0x4bd07d)[_0x2af0('0x25')](function(_0x34260a){_0x58c178[_0x2af0('0x1f')]=_0x34260a;if(_0x558d6d['query']['includeAll']){_0x18e2d8[_0x2af0('0x40')]=[{'all':!![]}];}return db[_0x2af0('0x2d')][_0x2af0('0x41')](_0x18e2d8);})[_0x2af0('0x25')](function(_0x4a7306){_0x58c178[_0x2af0('0x42')]=_0x4a7306;return _0x58c178;})[_0x2af0('0x25')](respondWithFilteredResult(_0x1574f2,_0x18e2d8))[_0x2af0('0x43')](handleError(_0x1574f2,null));};exports['show']=function(_0x4bca7d,_0x379fbf){var _0x4f13ae={'raw':![],'where':{'id':_0x4bca7d[_0x2af0('0x44')]['id']}},_0x441592={};_0x441592[_0x2af0('0x32')]=_[_0x2af0('0x33')](db['ZendeskConfiguration'][_0x2af0('0x2e')]);_0x441592['query']=_['keys'](_0x4bca7d['query']);_0x441592[_0x2af0('0x34')]=_['intersection'](_0x441592[_0x2af0('0x32')],_0x441592[_0x2af0('0x36')]);_0x4f13ae['attributes']=_[_0x2af0('0x35')](_0x441592['model'],qs[_0x2af0('0x38')](_0x4bca7d[_0x2af0('0x36')]['fields']));_0x4f13ae[_0x2af0('0x37')]=_0x4f13ae[_0x2af0('0x37')]['length']?_0x4f13ae[_0x2af0('0x37')]:_0x441592[_0x2af0('0x32')];if(_0x4bca7d[_0x2af0('0x36')][_0x2af0('0x45')]){_0x4f13ae['include']=[{'all':!![]}];}_0x4f13ae=_[_0x2af0('0x46')]({},_0x4f13ae,_0x4bca7d[_0x2af0('0x47')]);return db[_0x2af0('0x2d')][_0x2af0('0x48')](_0x4f13ae)[_0x2af0('0x25')](handleEntityNotFound(_0x379fbf,null))[_0x2af0('0x25')](respondWithResult(_0x379fbf,null))['catch'](handleError(_0x379fbf,null));};exports[_0x2af0('0x49')]=function(_0x3f3775,_0x29ccf9){return db[_0x2af0('0x2d')]['create'](_0x3f3775['body'],{})[_0x2af0('0x25')](respondWithResult(_0x29ccf9,0xc9))[_0x2af0('0x43')](handleError(_0x29ccf9,null));};exports[_0x2af0('0x24')]=function(_0xab57e9,_0xfc0525){if(_0xab57e9['body']['id']){delete _0xab57e9[_0x2af0('0x4a')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0xab57e9[_0x2af0('0x44')]['id']}})[_0x2af0('0x25')](handleEntityNotFound(_0xfc0525,null))[_0x2af0('0x25')](saveUpdates(_0xab57e9[_0x2af0('0x4a')],null))['then'](respondWithResult(_0xfc0525,null))[_0x2af0('0x43')](handleError(_0xfc0525,null));};exports[_0x2af0('0x26')]=function(_0x149af8,_0x467b59){return db[_0x2af0('0x2d')]['find']({'where':{'id':_0x149af8[_0x2af0('0x44')]['id']}})[_0x2af0('0x25')](handleEntityNotFound(_0x467b59,null))['then'](removeEntity(_0x467b59,null))['catch'](handleError(_0x467b59,null));};exports['getFields']=function(_0xa190aa,_0x47def8,_0x411c8e){var _0x71974b={};var _0x426b53={};var _0x296e12;var _0x834201;return db[_0x2af0('0x2d')][_0x2af0('0x4b')]({'where':{'id':_0xa190aa[_0x2af0('0x44')]['id']}})['then'](handleEntityNotFound(_0x47def8,null))[_0x2af0('0x25')](function(_0x27e0c2){if(_0x27e0c2){_0x296e12=_0x27e0c2;_0x426b53[_0x2af0('0x32')]=_[_0x2af0('0x33')](db['ZendeskField'][_0x2af0('0x2e')]);_0x426b53['query']=_['keys'](_0xa190aa['query']);_0x426b53[_0x2af0('0x34')]=_[_0x2af0('0x35')](_0x426b53['model'],_0x426b53[_0x2af0('0x36')]);_0x71974b['attributes']=_[_0x2af0('0x35')](_0x426b53[_0x2af0('0x32')],qs[_0x2af0('0x38')](_0xa190aa[_0x2af0('0x36')][_0x2af0('0x38')]));_0x71974b[_0x2af0('0x37')]=_0x71974b[_0x2af0('0x37')][_0x2af0('0x39')]?_0x71974b[_0x2af0('0x37')]:_0x426b53[_0x2af0('0x32')];_0x71974b[_0x2af0('0x4c')]=qs['sort'](_0xa190aa[_0x2af0('0x36')][_0x2af0('0x3b')]);_0x71974b['where']=qs[_0x2af0('0x34')](_[_0x2af0('0x4d')](_0xa190aa[_0x2af0('0x36')],_0x426b53[_0x2af0('0x34')]));if(_0xa190aa['query'][_0x2af0('0x3c')]){_0x71974b['where']=_[_0x2af0('0x46')](_0x71974b[_0x2af0('0x3d')],{'$or':_[_0x2af0('0x2c')](_0x71974b[_0x2af0('0x37')],function(_0x34a422){var _0x17b5be={};_0x17b5be[_0x34a422]={'$like':'%'+_0xa190aa[_0x2af0('0x36')]['filter']+'%'};return _0x17b5be;})});}_0x71974b=_[_0x2af0('0x46')]({},_0x71974b,_0xa190aa[_0x2af0('0x47')]);return _0x296e12[_0x2af0('0x4e')](_0x71974b);}})['then'](function(_0x31b0a3){if(_0x31b0a3){_0x834201=_0x31b0a3[_0x2af0('0x39')];if(!_0xa190aa[_0x2af0('0x36')]['hasOwnProperty']('nolimit')){_0x71974b[_0x2af0('0x1d')]=qs[_0x2af0('0x1d')](_0xa190aa[_0x2af0('0x36')][_0x2af0('0x1d')]);_0x71974b['offset']=qs[_0x2af0('0x1e')](_0xa190aa[_0x2af0('0x36')]['offset']);}return _0x296e12[_0x2af0('0x4e')](_0x71974b);}})['then'](function(_0x5f531c){if(_0x5f531c){return _0x5f531c?{'count':_0x834201,'rows':_0x5f531c}:null;}})[_0x2af0('0x25')](respondWithResult(_0x47def8,null))[_0x2af0('0x43')](handleError(_0x47def8,null));};exports[_0x2af0('0x4f')]=function(_0x4f7f0f,_0x47fb06,_0x593103){var _0x498349={};var _0x2a9642={};var _0x13617f;var _0x58a286;return db[_0x2af0('0x2d')][_0x2af0('0x4b')]({'where':{'id':_0x4f7f0f[_0x2af0('0x44')]['id']}})[_0x2af0('0x25')](handleEntityNotFound(_0x47fb06,null))[_0x2af0('0x25')](function(_0x56d8a6){if(_0x56d8a6){_0x13617f=_0x56d8a6;_0x2a9642[_0x2af0('0x32')]=_[_0x2af0('0x33')](db['ZendeskField'][_0x2af0('0x2e')]);_0x2a9642[_0x2af0('0x36')]=_[_0x2af0('0x33')](_0x4f7f0f[_0x2af0('0x36')]);_0x2a9642['filters']=_[_0x2af0('0x35')](_0x2a9642[_0x2af0('0x32')],_0x2a9642[_0x2af0('0x36')]);_0x498349[_0x2af0('0x37')]=_[_0x2af0('0x35')](_0x2a9642['model'],qs[_0x2af0('0x38')](_0x4f7f0f[_0x2af0('0x36')][_0x2af0('0x38')]));_0x498349[_0x2af0('0x37')]=_0x498349[_0x2af0('0x37')]['length']?_0x498349['attributes']:_0x2a9642[_0x2af0('0x32')];_0x498349[_0x2af0('0x4c')]=qs['sort'](_0x4f7f0f[_0x2af0('0x36')][_0x2af0('0x3b')]);_0x498349[_0x2af0('0x3d')]=qs[_0x2af0('0x34')](_['pick'](_0x4f7f0f[_0x2af0('0x36')],_0x2a9642[_0x2af0('0x34')]));if(_0x4f7f0f[_0x2af0('0x36')][_0x2af0('0x3c')]){_0x498349['where']=_[_0x2af0('0x46')](_0x498349[_0x2af0('0x3d')],{'$or':_[_0x2af0('0x2c')](_0x498349['attributes'],function(_0xb75858){var _0x3157e0={};_0x3157e0[_0xb75858]={'$like':'%'+_0x4f7f0f[_0x2af0('0x36')][_0x2af0('0x3c')]+'%'};return _0x3157e0;})});}_0x498349=_['merge']({},_0x498349,_0x4f7f0f[_0x2af0('0x47')]);return _0x13617f[_0x2af0('0x4f')](_0x498349);}})[_0x2af0('0x25')](function(_0x41e408){if(_0x41e408){_0x58a286=_0x41e408['length'];if(!_0x4f7f0f[_0x2af0('0x36')][_0x2af0('0x50')]('nolimit')){_0x498349[_0x2af0('0x1d')]=qs[_0x2af0('0x1d')](_0x4f7f0f[_0x2af0('0x36')][_0x2af0('0x1d')]);_0x498349['offset']=qs[_0x2af0('0x1e')](_0x4f7f0f['query'][_0x2af0('0x1e')]);}return _0x13617f[_0x2af0('0x4f')](_0x498349);}})[_0x2af0('0x25')](function(_0x5bced8){if(_0x5bced8){return _0x5bced8?{'count':_0x58a286,'rows':_0x5bced8}:null;}})[_0x2af0('0x25')](respondWithResult(_0x47fb06,null))[_0x2af0('0x43')](handleError(_0x47fb06,null));};exports['getDescriptions']=function(_0x1301fc,_0x2d971e,_0x40947b){var _0x431b17={};var _0x43546c={};var _0xffd581;var _0x325660;return db[_0x2af0('0x2d')][_0x2af0('0x4b')]({'where':{'id':_0x1301fc[_0x2af0('0x44')]['id']}})[_0x2af0('0x25')](handleEntityNotFound(_0x2d971e,null))[_0x2af0('0x25')](function(_0x28dffc){if(_0x28dffc){_0xffd581=_0x28dffc;_0x43546c[_0x2af0('0x32')]=_[_0x2af0('0x33')](db[_0x2af0('0x51')][_0x2af0('0x2e')]);_0x43546c[_0x2af0('0x36')]=_[_0x2af0('0x33')](_0x1301fc[_0x2af0('0x36')]);_0x43546c[_0x2af0('0x34')]=_['intersection'](_0x43546c[_0x2af0('0x32')],_0x43546c[_0x2af0('0x36')]);_0x431b17[_0x2af0('0x37')]=_['intersection'](_0x43546c[_0x2af0('0x32')],qs[_0x2af0('0x38')](_0x1301fc[_0x2af0('0x36')][_0x2af0('0x38')]));_0x431b17[_0x2af0('0x37')]=_0x431b17['attributes'][_0x2af0('0x39')]?_0x431b17[_0x2af0('0x37')]:_0x43546c[_0x2af0('0x32')];_0x431b17[_0x2af0('0x4c')]=qs['sort'](_0x1301fc['query'][_0x2af0('0x3b')]);_0x431b17[_0x2af0('0x3d')]=qs[_0x2af0('0x34')](_[_0x2af0('0x4d')](_0x1301fc['query'],_0x43546c[_0x2af0('0x34')]));if(_0x1301fc[_0x2af0('0x36')][_0x2af0('0x3c')]){_0x431b17[_0x2af0('0x3d')]=_[_0x2af0('0x46')](_0x431b17['where'],{'$or':_['map'](_0x431b17[_0x2af0('0x37')],function(_0x2b626b){var _0x260e61={};_0x260e61[_0x2b626b]={'$like':'%'+_0x1301fc[_0x2af0('0x36')][_0x2af0('0x3c')]+'%'};return _0x260e61;})});}_0x431b17=_[_0x2af0('0x46')]({},_0x431b17,_0x1301fc[_0x2af0('0x47')]);return _0xffd581[_0x2af0('0x52')](_0x431b17);}})[_0x2af0('0x25')](function(_0x4e8d4f){if(_0x4e8d4f){_0x325660=_0x4e8d4f[_0x2af0('0x39')];if(!_0x1301fc[_0x2af0('0x36')]['hasOwnProperty'](_0x2af0('0x3a'))){_0x431b17[_0x2af0('0x1d')]=qs[_0x2af0('0x1d')](_0x1301fc[_0x2af0('0x36')][_0x2af0('0x1d')]);_0x431b17[_0x2af0('0x1e')]=qs[_0x2af0('0x1e')](_0x1301fc[_0x2af0('0x36')]['offset']);}return _0xffd581[_0x2af0('0x52')](_0x431b17);}})[_0x2af0('0x25')](function(_0x23bd0a){if(_0x23bd0a){return _0x23bd0a?{'count':_0x325660,'rows':_0x23bd0a}:null;}})['then'](respondWithResult(_0x2d971e,null))[_0x2af0('0x43')](handleError(_0x2d971e,null));};exports[_0x2af0('0x53')]=function(_0x2ed409,_0x1eae94,_0x1ab53b){var _0xfd71f4={};var _0x17d747={};var _0x2eb3fc;var _0x1de6e2;return db[_0x2af0('0x2d')]['findOne']({'where':{'id':_0x2ed409[_0x2af0('0x44')]['id']}})['then'](handleEntityNotFound(_0x1eae94,null))['then'](function(_0x5a3731){if(_0x5a3731){_0x2eb3fc=_0x5a3731;_0x17d747[_0x2af0('0x32')]=_[_0x2af0('0x33')](db[_0x2af0('0x54')][_0x2af0('0x2e')]);_0x17d747['query']=_[_0x2af0('0x33')](_0x2ed409['query']);_0x17d747[_0x2af0('0x34')]=_[_0x2af0('0x35')](_0x17d747[_0x2af0('0x32')],_0x17d747[_0x2af0('0x36')]);_0xfd71f4[_0x2af0('0x37')]=_['intersection'](_0x17d747['model'],qs[_0x2af0('0x38')](_0x2ed409[_0x2af0('0x36')][_0x2af0('0x38')]));_0xfd71f4[_0x2af0('0x37')]=_0xfd71f4[_0x2af0('0x37')][_0x2af0('0x39')]?_0xfd71f4['attributes']:_0x17d747[_0x2af0('0x32')];_0xfd71f4[_0x2af0('0x4c')]=qs[_0x2af0('0x3b')](_0x2ed409[_0x2af0('0x36')][_0x2af0('0x3b')]);_0xfd71f4[_0x2af0('0x3d')]=qs['filters'](_['pick'](_0x2ed409[_0x2af0('0x36')],_0x17d747[_0x2af0('0x34')]));if(_0x2ed409[_0x2af0('0x36')][_0x2af0('0x3c')]){_0xfd71f4['where']=_[_0x2af0('0x46')](_0xfd71f4[_0x2af0('0x3d')],{'$or':_['map'](_0xfd71f4[_0x2af0('0x37')],function(_0x2d1479){var _0x5f3f84={};_0x5f3f84[_0x2d1479]={'$like':'%'+_0x2ed409[_0x2af0('0x36')][_0x2af0('0x3c')]+'%'};return _0x5f3f84;})});}_0xfd71f4=_[_0x2af0('0x46')]({},_0xfd71f4,_0x2ed409['options']);return _0x2eb3fc['getTags'](_0xfd71f4);}})[_0x2af0('0x25')](function(_0x4d71b0){if(_0x4d71b0){_0x1de6e2=_0x4d71b0[_0x2af0('0x39')];if(!_0x2ed409[_0x2af0('0x36')][_0x2af0('0x50')]('nolimit')){_0xfd71f4[_0x2af0('0x1d')]=qs[_0x2af0('0x1d')](_0x2ed409[_0x2af0('0x36')][_0x2af0('0x1d')]);_0xfd71f4[_0x2af0('0x1e')]=qs[_0x2af0('0x1e')](_0x2ed409[_0x2af0('0x36')]['offset']);}return _0x2eb3fc['getTags'](_0xfd71f4);}})[_0x2af0('0x25')](function(_0x3cedd6){if(_0x3cedd6){return _0x3cedd6?{'count':_0x1de6e2,'rows':_0x3cedd6}:null;}})[_0x2af0('0x25')](respondWithResult(_0x1eae94,null))['catch'](handleError(_0x1eae94,null));};exports[_0x2af0('0x55')]=function(_0x21dd9f,_0x3e43ee,_0x2add39){if(_0x21dd9f[_0x2af0('0x4a')]['id']){delete _0x21dd9f[_0x2af0('0x4a')]['id'];}return db[_0x2af0('0x2d')][_0x2af0('0x4b')]({'where':{'id':_0x21dd9f[_0x2af0('0x44')]['id']}})[_0x2af0('0x25')](handleEntityNotFound(_0x3e43ee,null))[_0x2af0('0x25')](function(_0x5a83f1){if(_0x5a83f1){return _0x5a83f1[_0x2af0('0x55')](_0x21dd9f[_0x2af0('0x4a')][_0x2af0('0x56')]||[]);}return null;})[_0x2af0('0x25')](respondWithResult(_0x3e43ee,null))[_0x2af0('0x43')](handleError(_0x3e43ee,null));};
\ No newline at end of file
+var _0xee63=['path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','length','create','body','catch','find','getFields','getSubjects','findOne','ZendeskField','order','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','request-promise','bluebird','util'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xee63,0x133));var _0x3ee6=function(_0x3daa8c,_0x388a87){_0x3daa8c=_0x3daa8c-0x0;var _0x2b1bd7=_0xee63[_0x3daa8c];return _0x2b1bd7;};'use strict';var emlformat=require(_0x3ee6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ee6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ee6('0x2'));var moment=require('moment');var BPromise=require(_0x3ee6('0x3'));var Mustache=require('mustache');var util=require(_0x3ee6('0x4'));var path=require(_0x3ee6('0x5'));var sox=require(_0x3ee6('0x6'));var csv=require(_0x3ee6('0x7'));var ejs=require(_0x3ee6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3ee6('0x9'));var crypto=require(_0x3ee6('0xa'));var jsforce=require(_0x3ee6('0xb'));var deskjs=require(_0x3ee6('0xc'));var toCsv=require(_0x3ee6('0x7'));var querystring=require(_0x3ee6('0xd'));var Papa=require('papaparse');var Redis=require(_0x3ee6('0xe'));var authService=require(_0x3ee6('0xf'));var qs=require(_0x3ee6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3ee6('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3ee6('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x114660,_0x49873d){_0x49873d=_0x49873d||0xcc;return function(_0x1b654c){if(_0x1b654c){return _0x114660[_0x3ee6('0x13')](_0x49873d);}return _0x114660[_0x3ee6('0x14')](_0x49873d)[_0x3ee6('0x15')]();};}function respondWithResult(_0x23924b,_0x4d53e4){_0x4d53e4=_0x4d53e4||0xc8;return function(_0x18fbc1){if(_0x18fbc1){return _0x23924b['status'](_0x4d53e4)[_0x3ee6('0x16')](_0x18fbc1);}};}function respondWithFilteredResult(_0x141d05,_0x20bb23){return function(_0x508854){if(_0x508854){var _0x529224=typeof _0x20bb23['offset']===_0x3ee6('0x17')&&typeof _0x20bb23[_0x3ee6('0x18')]===_0x3ee6('0x17');var _0x297491=_0x508854[_0x3ee6('0x19')];var _0x36e798=_0x529224?0x0:_0x20bb23['offset'];var _0x10f5bf=_0x529224?_0x508854[_0x3ee6('0x19')]:_0x20bb23[_0x3ee6('0x1a')]+_0x20bb23[_0x3ee6('0x18')];var _0x1f965f;if(_0x10f5bf>=_0x297491){_0x10f5bf=_0x297491;_0x1f965f=0xc8;}else{_0x1f965f=0xce;}_0x141d05[_0x3ee6('0x14')](_0x1f965f);return _0x141d05['set']('Content-Range',_0x36e798+'-'+_0x10f5bf+'/'+_0x297491)[_0x3ee6('0x16')](_0x508854);}return null;};}function patchUpdates(_0x40d82b){return function(_0x441446){try{jsonpatch[_0x3ee6('0x1b')](_0x441446,_0x40d82b,!![]);}catch(_0xae207a){return BPromise[_0x3ee6('0x1c')](_0xae207a);}return _0x441446[_0x3ee6('0x1d')]();};}function saveUpdates(_0x1d85a8,_0x1c6f8f){return function(_0x1c5038){if(_0x1c5038){return _0x1c5038[_0x3ee6('0x1e')](_0x1d85a8)[_0x3ee6('0x1f')](function(_0x21e56f){return _0x21e56f;});}return null;};}function removeEntity(_0x634a4b,_0x1b075f){return function(_0x586526){if(_0x586526){return _0x586526[_0x3ee6('0x20')]()[_0x3ee6('0x1f')](function(){_0x634a4b[_0x3ee6('0x14')](0xcc)[_0x3ee6('0x15')]();});}};}function handleEntityNotFound(_0xcccbc5,_0x121d2b){return function(_0x289b40){if(!_0x289b40){_0xcccbc5[_0x3ee6('0x13')](0x194);}return _0x289b40;};}function handleError(_0x32a4af,_0x23604b){_0x23604b=_0x23604b||0x1f4;return function(_0x2fc8bc){logger['error'](_0x2fc8bc['stack']);if(_0x2fc8bc[_0x3ee6('0x21')]){delete _0x2fc8bc[_0x3ee6('0x21')];}_0x32a4af['status'](_0x23604b)['send'](_0x2fc8bc);};}exports[_0x3ee6('0x22')]=function(_0x5512b3,_0x8e73b5){var _0xaf8822={},_0x740fe3={},_0x36dccf={'count':0x0,'rows':[]};var _0x413419=_[_0x3ee6('0x23')](db[_0x3ee6('0x24')][_0x3ee6('0x25')],function(_0x4ce6cc){return{'name':_0x4ce6cc[_0x3ee6('0x26')],'type':_0x4ce6cc[_0x3ee6('0x27')][_0x3ee6('0x28')]};});_0x740fe3['model']=_[_0x3ee6('0x23')](_0x413419,_0x3ee6('0x21'));_0x740fe3[_0x3ee6('0x29')]=_['keys'](_0x5512b3[_0x3ee6('0x29')]);_0x740fe3[_0x3ee6('0x2a')]=_[_0x3ee6('0x2b')](_0x740fe3[_0x3ee6('0x2c')],_0x740fe3[_0x3ee6('0x29')]);_0xaf8822[_0x3ee6('0x2d')]=_[_0x3ee6('0x2b')](_0x740fe3['model'],qs[_0x3ee6('0x2e')](_0x5512b3[_0x3ee6('0x29')]['fields']));_0xaf8822[_0x3ee6('0x2d')]=_0xaf8822['attributes']['length']?_0xaf8822[_0x3ee6('0x2d')]:_0x740fe3[_0x3ee6('0x2c')];if(!_0x5512b3[_0x3ee6('0x29')][_0x3ee6('0x2f')](_0x3ee6('0x30'))){_0xaf8822[_0x3ee6('0x18')]=qs[_0x3ee6('0x18')](_0x5512b3[_0x3ee6('0x29')][_0x3ee6('0x18')]);_0xaf8822['offset']=qs[_0x3ee6('0x1a')](_0x5512b3[_0x3ee6('0x29')][_0x3ee6('0x1a')]);}_0xaf8822['order']=qs[_0x3ee6('0x31')](_0x5512b3['query'][_0x3ee6('0x31')]);_0xaf8822[_0x3ee6('0x32')]=qs[_0x3ee6('0x2a')](_[_0x3ee6('0x33')](_0x5512b3['query'],_0x740fe3[_0x3ee6('0x2a')]),_0x413419);if(_0x5512b3[_0x3ee6('0x29')][_0x3ee6('0x34')]){_0xaf8822['where']=_['merge'](_0xaf8822['where'],{'$or':_[_0x3ee6('0x23')](_0x413419,function(_0xa9a41f){if(_0xa9a41f['type']!==_0x3ee6('0x35')){var _0x163da6={};_0x163da6[_0xa9a41f[_0x3ee6('0x21')]]={'$like':'%'+_0x5512b3[_0x3ee6('0x29')][_0x3ee6('0x34')]+'%'};return _0x163da6;}})});}_0xaf8822=_[_0x3ee6('0x36')]({},_0xaf8822,_0x5512b3[_0x3ee6('0x37')]);var _0x5bcbe9={'where':_0xaf8822['where']};return db[_0x3ee6('0x24')]['count'](_0x5bcbe9)[_0x3ee6('0x1f')](function(_0x1e798f){_0x36dccf[_0x3ee6('0x19')]=_0x1e798f;if(_0x5512b3['query'][_0x3ee6('0x38')]){_0xaf8822[_0x3ee6('0x39')]=[{'all':!![]}];}return db[_0x3ee6('0x24')][_0x3ee6('0x3a')](_0xaf8822);})['then'](function(_0x1149c9){_0x36dccf[_0x3ee6('0x3b')]=_0x1149c9;return _0x36dccf;})[_0x3ee6('0x1f')](respondWithFilteredResult(_0x8e73b5,_0xaf8822))['catch'](handleError(_0x8e73b5,null));};exports[_0x3ee6('0x3c')]=function(_0x2588a1,_0x555e68){var _0x1a5d92={'raw':![],'where':{'id':_0x2588a1[_0x3ee6('0x3d')]['id']}},_0x1f2b4a={};_0x1f2b4a[_0x3ee6('0x2c')]=_[_0x3ee6('0x3e')](db[_0x3ee6('0x24')][_0x3ee6('0x25')]);_0x1f2b4a[_0x3ee6('0x29')]=_[_0x3ee6('0x3e')](_0x2588a1[_0x3ee6('0x29')]);_0x1f2b4a[_0x3ee6('0x2a')]=_['intersection'](_0x1f2b4a[_0x3ee6('0x2c')],_0x1f2b4a[_0x3ee6('0x29')]);_0x1a5d92[_0x3ee6('0x2d')]=_['intersection'](_0x1f2b4a['model'],qs['fields'](_0x2588a1[_0x3ee6('0x29')]['fields']));_0x1a5d92[_0x3ee6('0x2d')]=_0x1a5d92['attributes'][_0x3ee6('0x3f')]?_0x1a5d92[_0x3ee6('0x2d')]:_0x1f2b4a[_0x3ee6('0x2c')];if(_0x2588a1[_0x3ee6('0x29')]['includeAll']){_0x1a5d92[_0x3ee6('0x39')]=[{'all':!![]}];}_0x1a5d92=_['merge']({},_0x1a5d92,_0x2588a1[_0x3ee6('0x37')]);return db['ZendeskConfiguration']['find'](_0x1a5d92)['then'](handleEntityNotFound(_0x555e68,null))['then'](respondWithResult(_0x555e68,null))['catch'](handleError(_0x555e68,null));};exports[_0x3ee6('0x40')]=function(_0x33706a,_0x14180b){return db[_0x3ee6('0x24')][_0x3ee6('0x40')](_0x33706a[_0x3ee6('0x41')],{})[_0x3ee6('0x1f')](respondWithResult(_0x14180b,0xc9))[_0x3ee6('0x42')](handleError(_0x14180b,null));};exports[_0x3ee6('0x1e')]=function(_0x40f7be,_0x17700c){if(_0x40f7be[_0x3ee6('0x41')]['id']){delete _0x40f7be[_0x3ee6('0x41')]['id'];}return db[_0x3ee6('0x24')][_0x3ee6('0x43')]({'where':{'id':_0x40f7be['params']['id']}})['then'](handleEntityNotFound(_0x17700c,null))['then'](saveUpdates(_0x40f7be['body'],null))[_0x3ee6('0x1f')](respondWithResult(_0x17700c,null))[_0x3ee6('0x42')](handleError(_0x17700c,null));};exports[_0x3ee6('0x20')]=function(_0x8d08be,_0x476f42){return db[_0x3ee6('0x24')]['find']({'where':{'id':_0x8d08be[_0x3ee6('0x3d')]['id']}})[_0x3ee6('0x1f')](handleEntityNotFound(_0x476f42,null))[_0x3ee6('0x1f')](removeEntity(_0x476f42,null))[_0x3ee6('0x42')](handleError(_0x476f42,null));};exports[_0x3ee6('0x44')]=function(_0x5ade33,_0x5dc8ac,_0x46825d){var _0x417bb8={};var _0x32a98d={};var _0x4187ec;var _0x25e410;return db[_0x3ee6('0x24')]['findOne']({'where':{'id':_0x5ade33[_0x3ee6('0x3d')]['id']}})[_0x3ee6('0x1f')](handleEntityNotFound(_0x5dc8ac,null))[_0x3ee6('0x1f')](function(_0x386c05){if(_0x386c05){_0x4187ec=_0x386c05;_0x32a98d['model']=_[_0x3ee6('0x3e')](db['ZendeskField'][_0x3ee6('0x25')]);_0x32a98d[_0x3ee6('0x29')]=_[_0x3ee6('0x3e')](_0x5ade33['query']);_0x32a98d[_0x3ee6('0x2a')]=_['intersection'](_0x32a98d[_0x3ee6('0x2c')],_0x32a98d['query']);_0x417bb8['attributes']=_[_0x3ee6('0x2b')](_0x32a98d[_0x3ee6('0x2c')],qs[_0x3ee6('0x2e')](_0x5ade33['query'][_0x3ee6('0x2e')]));_0x417bb8[_0x3ee6('0x2d')]=_0x417bb8[_0x3ee6('0x2d')][_0x3ee6('0x3f')]?_0x417bb8[_0x3ee6('0x2d')]:_0x32a98d[_0x3ee6('0x2c')];_0x417bb8['order']=qs[_0x3ee6('0x31')](_0x5ade33[_0x3ee6('0x29')][_0x3ee6('0x31')]);_0x417bb8[_0x3ee6('0x32')]=qs[_0x3ee6('0x2a')](_[_0x3ee6('0x33')](_0x5ade33[_0x3ee6('0x29')],_0x32a98d[_0x3ee6('0x2a')]));if(_0x5ade33[_0x3ee6('0x29')][_0x3ee6('0x34')]){_0x417bb8[_0x3ee6('0x32')]=_[_0x3ee6('0x36')](_0x417bb8[_0x3ee6('0x32')],{'$or':_['map'](_0x417bb8[_0x3ee6('0x2d')],function(_0x1d42a6){var _0x483fba={};_0x483fba[_0x1d42a6]={'$like':'%'+_0x5ade33[_0x3ee6('0x29')]['filter']+'%'};return _0x483fba;})});}_0x417bb8=_[_0x3ee6('0x36')]({},_0x417bb8,_0x5ade33[_0x3ee6('0x37')]);return _0x4187ec[_0x3ee6('0x44')](_0x417bb8);}})[_0x3ee6('0x1f')](function(_0x235764){if(_0x235764){_0x25e410=_0x235764[_0x3ee6('0x3f')];if(!_0x5ade33[_0x3ee6('0x29')][_0x3ee6('0x2f')]('nolimit')){_0x417bb8['limit']=qs[_0x3ee6('0x18')](_0x5ade33[_0x3ee6('0x29')][_0x3ee6('0x18')]);_0x417bb8['offset']=qs[_0x3ee6('0x1a')](_0x5ade33[_0x3ee6('0x29')][_0x3ee6('0x1a')]);}return _0x4187ec['getFields'](_0x417bb8);}})['then'](function(_0x5c117b){if(_0x5c117b){return _0x5c117b?{'count':_0x25e410,'rows':_0x5c117b}:null;}})[_0x3ee6('0x1f')](respondWithResult(_0x5dc8ac,null))['catch'](handleError(_0x5dc8ac,null));};exports[_0x3ee6('0x45')]=function(_0x549f71,_0x2a4e3e,_0xcb6ef9){var _0x183d86={};var _0x3f13c6={};var _0x287f80;var _0x4eb9d7;return db[_0x3ee6('0x24')][_0x3ee6('0x46')]({'where':{'id':_0x549f71[_0x3ee6('0x3d')]['id']}})[_0x3ee6('0x1f')](handleEntityNotFound(_0x2a4e3e,null))['then'](function(_0x4d3d02){if(_0x4d3d02){_0x287f80=_0x4d3d02;_0x3f13c6['model']=_['keys'](db[_0x3ee6('0x47')][_0x3ee6('0x25')]);_0x3f13c6[_0x3ee6('0x29')]=_[_0x3ee6('0x3e')](_0x549f71[_0x3ee6('0x29')]);_0x3f13c6[_0x3ee6('0x2a')]=_[_0x3ee6('0x2b')](_0x3f13c6[_0x3ee6('0x2c')],_0x3f13c6[_0x3ee6('0x29')]);_0x183d86[_0x3ee6('0x2d')]=_[_0x3ee6('0x2b')](_0x3f13c6[_0x3ee6('0x2c')],qs[_0x3ee6('0x2e')](_0x549f71[_0x3ee6('0x29')][_0x3ee6('0x2e')]));_0x183d86[_0x3ee6('0x2d')]=_0x183d86[_0x3ee6('0x2d')][_0x3ee6('0x3f')]?_0x183d86[_0x3ee6('0x2d')]:_0x3f13c6[_0x3ee6('0x2c')];_0x183d86[_0x3ee6('0x48')]=qs['sort'](_0x549f71[_0x3ee6('0x29')][_0x3ee6('0x31')]);_0x183d86[_0x3ee6('0x32')]=qs[_0x3ee6('0x2a')](_[_0x3ee6('0x33')](_0x549f71[_0x3ee6('0x29')],_0x3f13c6['filters']));if(_0x549f71[_0x3ee6('0x29')][_0x3ee6('0x34')]){_0x183d86[_0x3ee6('0x32')]=_['merge'](_0x183d86['where'],{'$or':_[_0x3ee6('0x23')](_0x183d86[_0x3ee6('0x2d')],function(_0x48a53a){var _0x7e01b1={};_0x7e01b1[_0x48a53a]={'$like':'%'+_0x549f71[_0x3ee6('0x29')][_0x3ee6('0x34')]+'%'};return _0x7e01b1;})});}_0x183d86=_[_0x3ee6('0x36')]({},_0x183d86,_0x549f71[_0x3ee6('0x37')]);return _0x287f80['getSubjects'](_0x183d86);}})['then'](function(_0xefee16){if(_0xefee16){_0x4eb9d7=_0xefee16[_0x3ee6('0x3f')];if(!_0x549f71['query'][_0x3ee6('0x2f')](_0x3ee6('0x30'))){_0x183d86['limit']=qs[_0x3ee6('0x18')](_0x549f71[_0x3ee6('0x29')][_0x3ee6('0x18')]);_0x183d86['offset']=qs[_0x3ee6('0x1a')](_0x549f71['query'][_0x3ee6('0x1a')]);}return _0x287f80[_0x3ee6('0x45')](_0x183d86);}})['then'](function(_0x367555){if(_0x367555){return _0x367555?{'count':_0x4eb9d7,'rows':_0x367555}:null;}})[_0x3ee6('0x1f')](respondWithResult(_0x2a4e3e,null))[_0x3ee6('0x42')](handleError(_0x2a4e3e,null));};exports[_0x3ee6('0x49')]=function(_0xc5c433,_0x4b6f2a,_0x4fe42d){var _0x3cbe56={};var _0x455937={};var _0x3dabc9;var _0x2eb0eb;return db[_0x3ee6('0x24')]['findOne']({'where':{'id':_0xc5c433['params']['id']}})[_0x3ee6('0x1f')](handleEntityNotFound(_0x4b6f2a,null))['then'](function(_0x5938f3){if(_0x5938f3){_0x3dabc9=_0x5938f3;_0x455937[_0x3ee6('0x2c')]=_[_0x3ee6('0x3e')](db['ZendeskField'][_0x3ee6('0x25')]);_0x455937[_0x3ee6('0x29')]=_[_0x3ee6('0x3e')](_0xc5c433[_0x3ee6('0x29')]);_0x455937['filters']=_[_0x3ee6('0x2b')](_0x455937[_0x3ee6('0x2c')],_0x455937[_0x3ee6('0x29')]);_0x3cbe56[_0x3ee6('0x2d')]=_[_0x3ee6('0x2b')](_0x455937[_0x3ee6('0x2c')],qs[_0x3ee6('0x2e')](_0xc5c433[_0x3ee6('0x29')][_0x3ee6('0x2e')]));_0x3cbe56['attributes']=_0x3cbe56['attributes'][_0x3ee6('0x3f')]?_0x3cbe56['attributes']:_0x455937[_0x3ee6('0x2c')];_0x3cbe56[_0x3ee6('0x48')]=qs[_0x3ee6('0x31')](_0xc5c433['query'][_0x3ee6('0x31')]);_0x3cbe56['where']=qs[_0x3ee6('0x2a')](_['pick'](_0xc5c433[_0x3ee6('0x29')],_0x455937[_0x3ee6('0x2a')]));if(_0xc5c433[_0x3ee6('0x29')][_0x3ee6('0x34')]){_0x3cbe56[_0x3ee6('0x32')]=_['merge'](_0x3cbe56['where'],{'$or':_[_0x3ee6('0x23')](_0x3cbe56[_0x3ee6('0x2d')],function(_0x29d27c){var _0x46d28a={};_0x46d28a[_0x29d27c]={'$like':'%'+_0xc5c433[_0x3ee6('0x29')][_0x3ee6('0x34')]+'%'};return _0x46d28a;})});}_0x3cbe56=_[_0x3ee6('0x36')]({},_0x3cbe56,_0xc5c433['options']);return _0x3dabc9[_0x3ee6('0x49')](_0x3cbe56);}})[_0x3ee6('0x1f')](function(_0x1d9bdb){if(_0x1d9bdb){_0x2eb0eb=_0x1d9bdb['length'];if(!_0xc5c433[_0x3ee6('0x29')][_0x3ee6('0x2f')](_0x3ee6('0x30'))){_0x3cbe56['limit']=qs[_0x3ee6('0x18')](_0xc5c433[_0x3ee6('0x29')][_0x3ee6('0x18')]);_0x3cbe56['offset']=qs[_0x3ee6('0x1a')](_0xc5c433[_0x3ee6('0x29')]['offset']);}return _0x3dabc9[_0x3ee6('0x49')](_0x3cbe56);}})[_0x3ee6('0x1f')](function(_0x53e0a7){if(_0x53e0a7){return _0x53e0a7?{'count':_0x2eb0eb,'rows':_0x53e0a7}:null;}})[_0x3ee6('0x1f')](respondWithResult(_0x4b6f2a,null))['catch'](handleError(_0x4b6f2a,null));};exports[_0x3ee6('0x4a')]=function(_0x2deaa2,_0x2a06bd,_0x115bc0){var _0x38ee94={};var _0x50da18={};var _0x5b86e0;var _0x3222d2;return db['ZendeskConfiguration'][_0x3ee6('0x46')]({'where':{'id':_0x2deaa2[_0x3ee6('0x3d')]['id']}})[_0x3ee6('0x1f')](handleEntityNotFound(_0x2a06bd,null))['then'](function(_0x51236f){if(_0x51236f){_0x5b86e0=_0x51236f;_0x50da18[_0x3ee6('0x2c')]=_[_0x3ee6('0x3e')](db[_0x3ee6('0x4b')]['rawAttributes']);_0x50da18[_0x3ee6('0x29')]=_[_0x3ee6('0x3e')](_0x2deaa2[_0x3ee6('0x29')]);_0x50da18[_0x3ee6('0x2a')]=_['intersection'](_0x50da18[_0x3ee6('0x2c')],_0x50da18['query']);_0x38ee94[_0x3ee6('0x2d')]=_['intersection'](_0x50da18[_0x3ee6('0x2c')],qs['fields'](_0x2deaa2[_0x3ee6('0x29')][_0x3ee6('0x2e')]));_0x38ee94[_0x3ee6('0x2d')]=_0x38ee94[_0x3ee6('0x2d')]['length']?_0x38ee94[_0x3ee6('0x2d')]:_0x50da18[_0x3ee6('0x2c')];_0x38ee94[_0x3ee6('0x48')]=qs[_0x3ee6('0x31')](_0x2deaa2[_0x3ee6('0x29')][_0x3ee6('0x31')]);_0x38ee94[_0x3ee6('0x32')]=qs[_0x3ee6('0x2a')](_[_0x3ee6('0x33')](_0x2deaa2[_0x3ee6('0x29')],_0x50da18[_0x3ee6('0x2a')]));if(_0x2deaa2['query'][_0x3ee6('0x34')]){_0x38ee94['where']=_[_0x3ee6('0x36')](_0x38ee94[_0x3ee6('0x32')],{'$or':_['map'](_0x38ee94[_0x3ee6('0x2d')],function(_0x3af73a){var _0x23ddd0={};_0x23ddd0[_0x3af73a]={'$like':'%'+_0x2deaa2[_0x3ee6('0x29')][_0x3ee6('0x34')]+'%'};return _0x23ddd0;})});}_0x38ee94=_['merge']({},_0x38ee94,_0x2deaa2[_0x3ee6('0x37')]);return _0x5b86e0[_0x3ee6('0x4a')](_0x38ee94);}})['then'](function(_0x1d6e40){if(_0x1d6e40){_0x3222d2=_0x1d6e40[_0x3ee6('0x3f')];if(!_0x2deaa2[_0x3ee6('0x29')][_0x3ee6('0x2f')](_0x3ee6('0x30'))){_0x38ee94['limit']=qs[_0x3ee6('0x18')](_0x2deaa2[_0x3ee6('0x29')][_0x3ee6('0x18')]);_0x38ee94[_0x3ee6('0x1a')]=qs[_0x3ee6('0x1a')](_0x2deaa2[_0x3ee6('0x29')][_0x3ee6('0x1a')]);}return _0x5b86e0[_0x3ee6('0x4a')](_0x38ee94);}})['then'](function(_0x359c1b){if(_0x359c1b){return _0x359c1b?{'count':_0x3222d2,'rows':_0x359c1b}:null;}})[_0x3ee6('0x1f')](respondWithResult(_0x2a06bd,null))[_0x3ee6('0x42')](handleError(_0x2a06bd,null));};exports[_0x3ee6('0x4c')]=function(_0x446fc0,_0x11add9,_0x304d45){if(_0x446fc0[_0x3ee6('0x41')]['id']){delete _0x446fc0['body']['id'];}return db['ZendeskConfiguration'][_0x3ee6('0x46')]({'where':{'id':_0x446fc0[_0x3ee6('0x3d')]['id']}})[_0x3ee6('0x1f')](handleEntityNotFound(_0x11add9,null))['then'](function(_0x15d37f){if(_0x15d37f){return _0x15d37f['setTags'](_0x446fc0[_0x3ee6('0x41')][_0x3ee6('0x4d')]||[]);}return null;})[_0x3ee6('0x1f')](respondWithResult(_0x11add9,null))[_0x3ee6('0x42')](handleError(_0x11add9,null));};
\ No newline at end of file
index f0b64b0..35f79aa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x32b6=['moment','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api'];(function(_0x2014e5,_0x617b7f){var _0x4a37f7=function(_0x763af1){while(--_0x763af1){_0x2014e5['push'](_0x2014e5['shift']());}};_0x4a37f7(++_0x617b7f);}(_0x32b6,0x1d1));var _0x632b=function(_0x21b2be,_0x3fc6e1){_0x21b2be=_0x21b2be-0x0;var _0x3bdb19=_0x32b6[_0x21b2be];return _0x3bdb19;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var logger=require('../../config/logger')(_0x632b('0x2'));var moment=require(_0x632b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x632b('0x4'));var rimraf=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var attributes=require(_0x632b('0x7'));module[_0x632b('0x8')]=function(_0x122768,_0x24ceab){return _0x122768[_0x632b('0x9')](_0x632b('0xa'),attributes,{'tableName':_0x632b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x056b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0xd227f7,_0x1691e4){var _0xc6486=function(_0x1e18f4){while(--_0x1e18f4){_0xd227f7['push'](_0xd227f7['shift']());}};_0xc6486(++_0x1691e4);}(_0x056b,0xb6));var _0xb056=function(_0x2e8e71,_0x2ced06){_0x2e8e71=_0x2e8e71-0x0;var _0x558afd=_0x056b[_0x2e8e71];return _0x558afd;};'use strict';var _=require('lodash');var util=require(_0xb056('0x0'));var logger=require(_0xb056('0x1'))(_0xb056('0x2'));var moment=require(_0xb056('0x3'));var BPromise=require(_0xb056('0x4'));var rp=require(_0xb056('0x5'));var fs=require('fs');var path=require(_0xb056('0x6'));var rimraf=require(_0xb056('0x7'));var config=require(_0xb056('0x8'));var attributes=require(_0xb056('0x9'));module[_0xb056('0xa')]=function(_0x515612,_0x2d5e4f){return _0x515612[_0xb056('0xb')](_0xb056('0xc'),attributes,{'tableName':_0xb056('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 07a9a3b..9c82e32 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc87f=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0xc87f,0x1b5));var _0xfc87=function(_0x1ddba9,_0x2ac403){_0x1ddba9=_0x1ddba9-0x0;var _0x399f1c=_0xc87f[_0x1ddba9];return _0x399f1c;};'use strict';var _=require(_0xfc87('0x0'));var util=require(_0xfc87('0x1'));var moment=require(_0xfc87('0x2'));var BPromise=require(_0xfc87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc87('0x4'))['db'];var utils=require(_0xfc87('0x5'));var logger=require(_0xfc87('0x6'))('rpc');var config=require(_0xfc87('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfc87('0x8')][_0xfc87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b0f3e,_0xe71d0a,_0x3f5dad){return new BPromise(function(_0xad8f18,_0x159140){return client[_0xfc87('0xa')](_0x4b0f3e,_0x3f5dad)[_0xfc87('0xb')](function(_0x3c7b30){logger[_0xfc87('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0xe71d0a,_0xfc87('0xd'));logger[_0xfc87('0xe')](_0xfc87('0xf'),_0xe71d0a,_0xfc87('0xd'),JSON['stringify'](_0x3c7b30));if(_0x3c7b30[_0xfc87('0x10')]){if(_0x3c7b30[_0xfc87('0x10')][_0xfc87('0x11')]===0x1f4){logger[_0xfc87('0x10')](_0xfc87('0x12'),_0xe71d0a,_0x3c7b30[_0xfc87('0x10')]['message']);return _0x159140(_0x3c7b30[_0xfc87('0x10')][_0xfc87('0x13')]);}logger[_0xfc87('0x10')](_0xfc87('0x12'),_0xe71d0a,_0x3c7b30[_0xfc87('0x10')]['message']);return _0xad8f18(_0x3c7b30[_0xfc87('0x10')]['message']);}else{logger[_0xfc87('0xc')](_0xfc87('0x12'),_0xe71d0a,'request\x20sent');_0xad8f18(_0x3c7b30['result']['message']);}})[_0xfc87('0x14')](function(_0x27f48c){logger[_0xfc87('0x10')](_0xfc87('0x12'),_0xe71d0a,_0x27f48c);_0x159140(_0x27f48c);});});}
\ No newline at end of file
+var _0xe633=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info'];(function(_0x38ecc7,_0x4bbf01){var _0x15d5ba=function(_0x3c81bc){while(--_0x3c81bc){_0x38ecc7['push'](_0x38ecc7['shift']());}};_0x15d5ba(++_0x4bbf01);}(_0xe633,0xb8));var _0x3e63=function(_0x27adcd,_0x508510){_0x27adcd=_0x27adcd-0x0;var _0x2ab5be=_0xe633[_0x27adcd];return _0x2ab5be;};'use strict';var _=require(_0x3e63('0x0'));var util=require(_0x3e63('0x1'));var moment=require(_0x3e63('0x2'));var BPromise=require(_0x3e63('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e63('0x4'));var db=require(_0x3e63('0x5'))['db'];var utils=require(_0x3e63('0x6'));var logger=require(_0x3e63('0x7'))(_0x3e63('0x8'));var config=require(_0x3e63('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3e63('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37e079,_0x5c3783,_0x17bae5){return new BPromise(function(_0x94460b,_0xf9b8bf){return client[_0x3e63('0xb')](_0x37e079,_0x17bae5)[_0x3e63('0xc')](function(_0x257426){logger[_0x3e63('0xd')](_0x3e63('0xe'),_0x5c3783,_0x3e63('0xf'));logger[_0x3e63('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5c3783,_0x3e63('0xf'),JSON[_0x3e63('0x11')](_0x257426));if(_0x257426[_0x3e63('0x12')]){if(_0x257426['error'][_0x3e63('0x13')]===0x1f4){logger[_0x3e63('0x12')](_0x3e63('0xe'),_0x5c3783,_0x257426[_0x3e63('0x12')][_0x3e63('0x14')]);return _0xf9b8bf(_0x257426[_0x3e63('0x12')][_0x3e63('0x14')]);}logger[_0x3e63('0x12')](_0x3e63('0xe'),_0x5c3783,_0x257426[_0x3e63('0x12')][_0x3e63('0x14')]);return _0x94460b(_0x257426[_0x3e63('0x12')][_0x3e63('0x14')]);}else{logger[_0x3e63('0xd')](_0x3e63('0xe'),_0x5c3783,_0x3e63('0xf'));_0x94460b(_0x257426[_0x3e63('0x15')][_0x3e63('0x14')]);}})['catch'](function(_0x1df70d){logger[_0x3e63('0x12')](_0x3e63('0xe'),_0x5c3783,_0x1df70d);_0xf9b8bf(_0x1df70d);});});}
\ No newline at end of file
index f7d44e6..4128b7b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6ae1=['delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x414495,_0x3091a2){var _0x4684a9=function(_0x3da3da){while(--_0x3da3da){_0x414495['push'](_0x414495['shift']());}};_0x4684a9(++_0x3091a2);}(_0x6ae1,0x1f1));var _0x16ae=function(_0x4196ed,_0x5a592e){_0x4196ed=_0x4196ed-0x0;var _0x3a0b50=_0x6ae1[_0x4196ed];return _0x3a0b50;};'use strict';var multer=require('multer');var util=require(_0x16ae('0x0'));var path=require(_0x16ae('0x1'));var timeout=require('connect-timeout');var express=require(_0x16ae('0x2'));var router=express[_0x16ae('0x3')]();var fs_extra=require(_0x16ae('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x16ae('0x5'));var config=require(_0x16ae('0x6'));var controller=require('./intZendeskField.controller');router[_0x16ae('0x7')]('/',auth[_0x16ae('0x8')](),controller[_0x16ae('0x9')]);router['get']('/:id',auth[_0x16ae('0x8')](),controller[_0x16ae('0xa')]);router[_0x16ae('0xb')]('/',auth[_0x16ae('0x8')](),controller[_0x16ae('0xc')]);router[_0x16ae('0xd')](_0x16ae('0xe'),auth['isAuthenticated'](),controller[_0x16ae('0xf')]);router[_0x16ae('0x10')](_0x16ae('0xe'),auth[_0x16ae('0x8')](),controller[_0x16ae('0x11')]);module[_0x16ae('0x12')]=router;
\ No newline at end of file
+var _0xdea7=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x29c57b,_0x5476d1){var _0x5d3757=function(_0x1e6c3e){while(--_0x1e6c3e){_0x29c57b['push'](_0x29c57b['shift']());}};_0x5d3757(++_0x5476d1);}(_0xdea7,0x18f));var _0x7dea=function(_0x2230a4,_0x499a58){_0x2230a4=_0x2230a4-0x0;var _0x542232=_0xdea7[_0x2230a4];return _0x542232;};'use strict';var multer=require(_0x7dea('0x0'));var util=require(_0x7dea('0x1'));var path=require(_0x7dea('0x2'));var timeout=require(_0x7dea('0x3'));var express=require(_0x7dea('0x4'));var router=express[_0x7dea('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7dea('0x6'));var interaction=require(_0x7dea('0x7'));var config=require(_0x7dea('0x8'));var controller=require('./intZendeskField.controller');router[_0x7dea('0x9')]('/',auth[_0x7dea('0xa')](),controller[_0x7dea('0xb')]);router[_0x7dea('0x9')](_0x7dea('0xc'),auth[_0x7dea('0xa')](),controller[_0x7dea('0xd')]);router[_0x7dea('0xe')]('/',auth['isAuthenticated'](),controller[_0x7dea('0xf')]);router['put'](_0x7dea('0xc'),auth[_0x7dea('0xa')](),controller[_0x7dea('0x10')]);router[_0x7dea('0x11')](_0x7dea('0xc'),auth[_0x7dea('0xa')](),controller[_0x7dea('0x12')]);module[_0x7dea('0x13')]=router;
\ No newline at end of file
index f562ad8..5ee9f24 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6aa3=['ENUM','sequelize','exports','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x4dccf2,_0x5cfcd7){var _0x12640e=function(_0x1fb2c7){while(--_0x1fb2c7){_0x4dccf2['push'](_0x4dccf2['shift']());}};_0x12640e(++_0x5cfcd7);}(_0x6aa3,0x14e));var _0x36aa=function(_0x57a5e5,_0x18b0d6){_0x57a5e5=_0x57a5e5-0x0;var _0x354012=_0x6aa3[_0x57a5e5];return _0x354012;};'use strict';var Sequelize=require(_0x36aa('0x0'));module[_0x36aa('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x36aa('0x2'),_0x36aa('0x3'),_0x36aa('0x4'),_0x36aa('0x5')),'defaultValue':_0x36aa('0x6')},'content':{'type':Sequelize[_0x36aa('0x7')]},'key':{'type':Sequelize[_0x36aa('0x7')]},'keyType':{'type':Sequelize[_0x36aa('0x8')](_0x36aa('0x6'),_0x36aa('0x2'),_0x36aa('0x3'))},'keyContent':{'type':Sequelize[_0x36aa('0x7')]},'idField':{'type':Sequelize[_0x36aa('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x36aa('0x7')]}};
\ No newline at end of file
+var _0xc490=['keyValue','picklist','STRING','string','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x10d34b,_0x46fe15){var _0x21e701=function(_0x57941e){while(--_0x57941e){_0x10d34b['push'](_0x10d34b['shift']());}};_0x21e701(++_0x46fe15);}(_0xc490,0x19f));var _0x0c49=function(_0xe2f04c,_0x1e6cce){_0xe2f04c=_0xe2f04c-0x0;var _0xf98a17=_0xc490[_0xe2f04c];return _0xf98a17;};'use strict';var Sequelize=require(_0x0c49('0x0'));module[_0x0c49('0x1')]={'type':{'type':Sequelize[_0x0c49('0x2')]('string',_0x0c49('0x3'),_0x0c49('0x4'),_0x0c49('0x5'),_0x0c49('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0c49('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0c49('0x2')](_0x0c49('0x8'),_0x0c49('0x3'),_0x0c49('0x4'))},'keyContent':{'type':Sequelize[_0x0c49('0x7')]},'idField':{'type':Sequelize[_0x0c49('0x7')]},'nameField':{'type':Sequelize[_0x0c49('0x7')]},'customField':{'type':Sequelize[_0x0c49('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0c49('0x7')]}};
\ No newline at end of file
index 9869113..9493843 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeea1=['hasOwnProperty','nolimit','sort','merge','where','VIRTUAL','filter','options','includeAll','rows','catch','params','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','Content-Range','json','apply','reject','update','then','sendStatus','error','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x222704,_0x253f5c){var _0x2a8235=function(_0xbff8ba){while(--_0xbff8ba){_0x222704['push'](_0x222704['shift']());}};_0x2a8235(++_0x253f5c);}(_0xeea1,0x1e5));var _0x1eea=function(_0x245450,_0x357213){_0x245450=_0x245450-0x0;var _0x1706e2=_0xeea1[_0x245450];return _0x1706e2;};'use strict';var emlformat=require(_0x1eea('0x0'));var rimraf=require(_0x1eea('0x1'));var zipdir=require(_0x1eea('0x2'));var jsonpatch=require(_0x1eea('0x3'));var rp=require(_0x1eea('0x4'));var moment=require(_0x1eea('0x5'));var BPromise=require(_0x1eea('0x6'));var Mustache=require(_0x1eea('0x7'));var util=require(_0x1eea('0x8'));var path=require(_0x1eea('0x9'));var sox=require(_0x1eea('0xa'));var csv=require(_0x1eea('0xb'));var ejs=require(_0x1eea('0xc'));var fs=require('fs');var fs_extra=require(_0x1eea('0xd'));var _=require(_0x1eea('0xe'));var squel=require(_0x1eea('0xf'));var crypto=require(_0x1eea('0x10'));var jsforce=require(_0x1eea('0x11'));var deskjs=require(_0x1eea('0x12'));var toCsv=require(_0x1eea('0xb'));var querystring=require(_0x1eea('0x13'));var Papa=require('papaparse');var Redis=require(_0x1eea('0x14'));var authService=require(_0x1eea('0x15'));var qs=require(_0x1eea('0x16'));var as=require(_0x1eea('0x17'));var hardwareService=require(_0x1eea('0x18'));var logger=require(_0x1eea('0x19'))(_0x1eea('0x1a'));var utils=require(_0x1eea('0x1b'));var config=require(_0x1eea('0x1c'));var licenseUtil=require(_0x1eea('0x1d'));var db=require(_0x1eea('0x1e'))['db'];function respondWithStatusCode(_0xbc8354,_0xff1ef3){_0xff1ef3=_0xff1ef3||0xcc;return function(_0x353666){if(_0x353666){return _0xbc8354['sendStatus'](_0xff1ef3);}return _0xbc8354['status'](_0xff1ef3)[_0x1eea('0x1f')]();};}function respondWithResult(_0x529a74,_0x2df5f7){_0x2df5f7=_0x2df5f7||0xc8;return function(_0x5c8b7c){if(_0x5c8b7c){return _0x529a74[_0x1eea('0x20')](_0x2df5f7)['json'](_0x5c8b7c);}};}function respondWithFilteredResult(_0x144cd0,_0x3d8890){return function(_0x323285){if(_0x323285){var _0x3f28e3=typeof _0x3d8890['offset']===_0x1eea('0x21')&&typeof _0x3d8890[_0x1eea('0x22')]==='undefined';var _0x224dbd=_0x323285[_0x1eea('0x23')];var _0x244810=_0x3f28e3?0x0:_0x3d8890['offset'];var _0x71740c=_0x3f28e3?_0x323285[_0x1eea('0x23')]:_0x3d8890[_0x1eea('0x24')]+_0x3d8890[_0x1eea('0x22')];var _0x3fcbe9;if(_0x71740c>=_0x224dbd){_0x71740c=_0x224dbd;_0x3fcbe9=0xc8;}else{_0x3fcbe9=0xce;}_0x144cd0[_0x1eea('0x20')](_0x3fcbe9);return _0x144cd0['set'](_0x1eea('0x25'),_0x244810+'-'+_0x71740c+'/'+_0x224dbd)[_0x1eea('0x26')](_0x323285);}return null;};}function patchUpdates(_0x1d7815){return function(_0x2f5b08){try{jsonpatch[_0x1eea('0x27')](_0x2f5b08,_0x1d7815,!![]);}catch(_0x20e280){return BPromise[_0x1eea('0x28')](_0x20e280);}return _0x2f5b08['save']();};}function saveUpdates(_0x7487,_0x1fbdac){return function(_0xf04691){if(_0xf04691){return _0xf04691[_0x1eea('0x29')](_0x7487)[_0x1eea('0x2a')](function(_0x3ec0aa){return _0x3ec0aa;});}return null;};}function removeEntity(_0x16ae37,_0x2620bb){return function(_0x1ff99d){if(_0x1ff99d){return _0x1ff99d['destroy']()[_0x1eea('0x2a')](function(){_0x16ae37[_0x1eea('0x20')](0xcc)[_0x1eea('0x1f')]();});}};}function handleEntityNotFound(_0x455071,_0x34b94d){return function(_0xd1d22e){if(!_0xd1d22e){_0x455071[_0x1eea('0x2b')](0x194);}return _0xd1d22e;};}function handleError(_0x4be91b,_0x2f367b){_0x2f367b=_0x2f367b||0x1f4;return function(_0x326492){logger[_0x1eea('0x2c')](_0x326492['stack']);if(_0x326492[_0x1eea('0x2d')]){delete _0x326492['name'];}_0x4be91b[_0x1eea('0x20')](_0x2f367b)['send'](_0x326492);};}exports[_0x1eea('0x2e')]=function(_0x4d9d8e,_0x2dfd14){var _0x41ee1c={},_0xdc42c5={},_0x5130b5={'count':0x0,'rows':[]};var _0x3ed8c2=_[_0x1eea('0x2f')](db[_0x1eea('0x30')][_0x1eea('0x31')],function(_0x37b2ac){return{'name':_0x37b2ac[_0x1eea('0x32')],'type':_0x37b2ac[_0x1eea('0x33')][_0x1eea('0x34')]};});_0xdc42c5[_0x1eea('0x35')]=_[_0x1eea('0x2f')](_0x3ed8c2,_0x1eea('0x2d'));_0xdc42c5[_0x1eea('0x36')]=_[_0x1eea('0x37')](_0x4d9d8e[_0x1eea('0x36')]);_0xdc42c5[_0x1eea('0x38')]=_[_0x1eea('0x39')](_0xdc42c5[_0x1eea('0x35')],_0xdc42c5[_0x1eea('0x36')]);_0x41ee1c[_0x1eea('0x3a')]=_['intersection'](_0xdc42c5['model'],qs[_0x1eea('0x3b')](_0x4d9d8e['query'][_0x1eea('0x3b')]));_0x41ee1c['attributes']=_0x41ee1c[_0x1eea('0x3a')][_0x1eea('0x3c')]?_0x41ee1c['attributes']:_0xdc42c5[_0x1eea('0x35')];if(!_0x4d9d8e['query'][_0x1eea('0x3d')](_0x1eea('0x3e'))){_0x41ee1c[_0x1eea('0x22')]=qs[_0x1eea('0x22')](_0x4d9d8e[_0x1eea('0x36')][_0x1eea('0x22')]);_0x41ee1c['offset']=qs[_0x1eea('0x24')](_0x4d9d8e[_0x1eea('0x36')][_0x1eea('0x24')]);}_0x41ee1c['order']=qs['sort'](_0x4d9d8e[_0x1eea('0x36')][_0x1eea('0x3f')]);_0x41ee1c['where']=qs['filters'](_['pick'](_0x4d9d8e['query'],_0xdc42c5[_0x1eea('0x38')]),_0x3ed8c2);if(_0x4d9d8e[_0x1eea('0x36')]['filter']){_0x41ee1c['where']=_[_0x1eea('0x40')](_0x41ee1c[_0x1eea('0x41')],{'$or':_['map'](_0x3ed8c2,function(_0x51fe61){if(_0x51fe61['type']!==_0x1eea('0x42')){var _0x38dbd7={};_0x38dbd7[_0x51fe61[_0x1eea('0x2d')]]={'$like':'%'+_0x4d9d8e[_0x1eea('0x36')][_0x1eea('0x43')]+'%'};return _0x38dbd7;}})});}_0x41ee1c=_[_0x1eea('0x40')]({},_0x41ee1c,_0x4d9d8e[_0x1eea('0x44')]);var _0x180c67={'where':_0x41ee1c['where']};return db[_0x1eea('0x30')][_0x1eea('0x23')](_0x180c67)['then'](function(_0x28526b){_0x5130b5[_0x1eea('0x23')]=_0x28526b;if(_0x4d9d8e[_0x1eea('0x36')][_0x1eea('0x45')]){_0x41ee1c['include']=[{'all':!![]}];}return db[_0x1eea('0x30')]['findAll'](_0x41ee1c);})[_0x1eea('0x2a')](function(_0xbcd6bb){_0x5130b5[_0x1eea('0x46')]=_0xbcd6bb;return _0x5130b5;})[_0x1eea('0x2a')](respondWithFilteredResult(_0x2dfd14,_0x41ee1c))[_0x1eea('0x47')](handleError(_0x2dfd14,null));};exports['show']=function(_0x452959,_0x349469){var _0x41b6fb={'raw':!![],'where':{'id':_0x452959[_0x1eea('0x48')]['id']}},_0x1e4a2b={};_0x1e4a2b[_0x1eea('0x35')]=_[_0x1eea('0x37')](db['ZendeskField']['rawAttributes']);_0x1e4a2b[_0x1eea('0x36')]=_['keys'](_0x452959['query']);_0x1e4a2b[_0x1eea('0x38')]=_[_0x1eea('0x39')](_0x1e4a2b['model'],_0x1e4a2b[_0x1eea('0x36')]);_0x41b6fb[_0x1eea('0x3a')]=_[_0x1eea('0x39')](_0x1e4a2b[_0x1eea('0x35')],qs['fields'](_0x452959[_0x1eea('0x36')]['fields']));_0x41b6fb[_0x1eea('0x3a')]=_0x41b6fb['attributes'][_0x1eea('0x3c')]?_0x41b6fb['attributes']:_0x1e4a2b[_0x1eea('0x35')];if(_0x452959[_0x1eea('0x36')][_0x1eea('0x45')]){_0x41b6fb[_0x1eea('0x49')]=[{'all':!![]}];}_0x41b6fb=_[_0x1eea('0x40')]({},_0x41b6fb,_0x452959['options']);return db[_0x1eea('0x30')][_0x1eea('0x4a')](_0x41b6fb)[_0x1eea('0x2a')](handleEntityNotFound(_0x349469,null))[_0x1eea('0x2a')](respondWithResult(_0x349469,null))[_0x1eea('0x47')](handleError(_0x349469,null));};exports[_0x1eea('0x4b')]=function(_0x393339,_0x17d702){return db[_0x1eea('0x30')][_0x1eea('0x4b')](_0x393339[_0x1eea('0x4c')],{})[_0x1eea('0x2a')](respondWithResult(_0x17d702,0xc9))[_0x1eea('0x47')](handleError(_0x17d702,null));};exports[_0x1eea('0x29')]=function(_0x5a3cd9,_0x4d3895){if(_0x5a3cd9['body']['id']){delete _0x5a3cd9[_0x1eea('0x4c')]['id'];}return db[_0x1eea('0x30')]['find']({'where':{'id':_0x5a3cd9[_0x1eea('0x48')]['id']}})[_0x1eea('0x2a')](handleEntityNotFound(_0x4d3895,null))[_0x1eea('0x2a')](saveUpdates(_0x5a3cd9[_0x1eea('0x4c')],null))['then'](respondWithResult(_0x4d3895,null))[_0x1eea('0x47')](handleError(_0x4d3895,null));};exports[_0x1eea('0x4d')]=function(_0x54de22,_0x756f21){return db['ZendeskField']['find']({'where':{'id':_0x54de22[_0x1eea('0x48')]['id']}})[_0x1eea('0x2a')](handleEntityNotFound(_0x756f21,null))[_0x1eea('0x2a')](removeEntity(_0x756f21,null))[_0x1eea('0x47')](handleError(_0x756f21,null));};
\ No newline at end of file
+var _0xc62c=['merge','VIRTUAL','options','includeAll','include','rows','show','create','body','catch','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','ZendeskField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where'];(function(_0x2452d3,_0x22cdcb){var _0x2bbd61=function(_0x11d3d5){while(--_0x11d3d5){_0x2452d3['push'](_0x2452d3['shift']());}};_0x2bbd61(++_0x22cdcb);}(_0xc62c,0x1c2));var _0xcc62=function(_0x3dbf56,_0x5b0987){_0x3dbf56=_0x3dbf56-0x0;var _0x18e8c1=_0xc62c[_0x3dbf56];return _0x18e8c1;};'use strict';var emlformat=require(_0xcc62('0x0'));var rimraf=require(_0xcc62('0x1'));var zipdir=require(_0xcc62('0x2'));var jsonpatch=require(_0xcc62('0x3'));var rp=require('request-promise');var moment=require(_0xcc62('0x4'));var BPromise=require(_0xcc62('0x5'));var Mustache=require(_0xcc62('0x6'));var util=require(_0xcc62('0x7'));var path=require(_0xcc62('0x8'));var sox=require(_0xcc62('0x9'));var csv=require(_0xcc62('0xa'));var ejs=require(_0xcc62('0xb'));var fs=require('fs');var fs_extra=require(_0xcc62('0xc'));var _=require('lodash');var squel=require(_0xcc62('0xd'));var crypto=require('crypto');var jsforce=require(_0xcc62('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcc62('0xa'));var querystring=require(_0xcc62('0xf'));var Papa=require(_0xcc62('0x10'));var Redis=require(_0xcc62('0x11'));var authService=require(_0xcc62('0x12'));var qs=require(_0xcc62('0x13'));var as=require(_0xcc62('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcc62('0x15'));var utils=require('../../config/utils');var config=require(_0xcc62('0x16'));var licenseUtil=require(_0xcc62('0x17'));var db=require(_0xcc62('0x18'))['db'];function respondWithStatusCode(_0xd8b6bc,_0x34f9fe){_0x34f9fe=_0x34f9fe||0xcc;return function(_0x353bbe){if(_0x353bbe){return _0xd8b6bc[_0xcc62('0x19')](_0x34f9fe);}return _0xd8b6bc[_0xcc62('0x1a')](_0x34f9fe)[_0xcc62('0x1b')]();};}function respondWithResult(_0x2e1b41,_0x1401d4){_0x1401d4=_0x1401d4||0xc8;return function(_0x379508){if(_0x379508){return _0x2e1b41['status'](_0x1401d4)[_0xcc62('0x1c')](_0x379508);}};}function respondWithFilteredResult(_0x376452,_0x4c31d4){return function(_0x1e452f){if(_0x1e452f){var _0x1dae87=typeof _0x4c31d4[_0xcc62('0x1d')]===_0xcc62('0x1e')&&typeof _0x4c31d4[_0xcc62('0x1f')]===_0xcc62('0x1e');var _0x22f7ec=_0x1e452f['count'];var _0x5ab8f3=_0x1dae87?0x0:_0x4c31d4[_0xcc62('0x1d')];var _0x4800e1=_0x1dae87?_0x1e452f[_0xcc62('0x20')]:_0x4c31d4['offset']+_0x4c31d4['limit'];var _0x299936;if(_0x4800e1>=_0x22f7ec){_0x4800e1=_0x22f7ec;_0x299936=0xc8;}else{_0x299936=0xce;}_0x376452[_0xcc62('0x1a')](_0x299936);return _0x376452['set'](_0xcc62('0x21'),_0x5ab8f3+'-'+_0x4800e1+'/'+_0x22f7ec)['json'](_0x1e452f);}return null;};}function patchUpdates(_0x368a00){return function(_0x152287){try{jsonpatch[_0xcc62('0x22')](_0x152287,_0x368a00,!![]);}catch(_0x59b015){return BPromise[_0xcc62('0x23')](_0x59b015);}return _0x152287['save']();};}function saveUpdates(_0x1de903,_0x185826){return function(_0x4cae7f){if(_0x4cae7f){return _0x4cae7f[_0xcc62('0x24')](_0x1de903)[_0xcc62('0x25')](function(_0xad9361){return _0xad9361;});}return null;};}function removeEntity(_0x5ec849,_0x5cd6ea){return function(_0x4d1dd1){if(_0x4d1dd1){return _0x4d1dd1[_0xcc62('0x26')]()['then'](function(){_0x5ec849['status'](0xcc)[_0xcc62('0x1b')]();});}};}function handleEntityNotFound(_0x30c182,_0xe8f37a){return function(_0x586834){if(!_0x586834){_0x30c182['sendStatus'](0x194);}return _0x586834;};}function handleError(_0x315762,_0x31aacd){_0x31aacd=_0x31aacd||0x1f4;return function(_0x33b11a){logger['error'](_0x33b11a[_0xcc62('0x27')]);if(_0x33b11a[_0xcc62('0x28')]){delete _0x33b11a[_0xcc62('0x28')];}_0x315762[_0xcc62('0x1a')](_0x31aacd)['send'](_0x33b11a);};}exports[_0xcc62('0x29')]=function(_0x4aa5a2,_0x325c80){var _0x4f5bd1={},_0x14d003={},_0x4893e8={'count':0x0,'rows':[]};var _0x1c5a51=_[_0xcc62('0x2a')](db[_0xcc62('0x2b')][_0xcc62('0x2c')],function(_0x48daf0){return{'name':_0x48daf0[_0xcc62('0x2d')],'type':_0x48daf0[_0xcc62('0x2e')]['key']};});_0x14d003['model']=_[_0xcc62('0x2a')](_0x1c5a51,_0xcc62('0x28'));_0x14d003[_0xcc62('0x2f')]=_[_0xcc62('0x30')](_0x4aa5a2['query']);_0x14d003[_0xcc62('0x31')]=_[_0xcc62('0x32')](_0x14d003[_0xcc62('0x33')],_0x14d003['query']);_0x4f5bd1[_0xcc62('0x34')]=_[_0xcc62('0x32')](_0x14d003['model'],qs[_0xcc62('0x35')](_0x4aa5a2[_0xcc62('0x2f')][_0xcc62('0x35')]));_0x4f5bd1[_0xcc62('0x34')]=_0x4f5bd1[_0xcc62('0x34')][_0xcc62('0x36')]?_0x4f5bd1[_0xcc62('0x34')]:_0x14d003['model'];if(!_0x4aa5a2[_0xcc62('0x2f')][_0xcc62('0x37')]('nolimit')){_0x4f5bd1['limit']=qs['limit'](_0x4aa5a2[_0xcc62('0x2f')][_0xcc62('0x1f')]);_0x4f5bd1[_0xcc62('0x1d')]=qs[_0xcc62('0x1d')](_0x4aa5a2[_0xcc62('0x2f')][_0xcc62('0x1d')]);}_0x4f5bd1[_0xcc62('0x38')]=qs[_0xcc62('0x39')](_0x4aa5a2[_0xcc62('0x2f')][_0xcc62('0x39')]);_0x4f5bd1['where']=qs[_0xcc62('0x31')](_[_0xcc62('0x3a')](_0x4aa5a2[_0xcc62('0x2f')],_0x14d003[_0xcc62('0x31')]),_0x1c5a51);if(_0x4aa5a2[_0xcc62('0x2f')][_0xcc62('0x3b')]){_0x4f5bd1[_0xcc62('0x3c')]=_[_0xcc62('0x3d')](_0x4f5bd1['where'],{'$or':_['map'](_0x1c5a51,function(_0x598d20){if(_0x598d20[_0xcc62('0x2e')]!==_0xcc62('0x3e')){var _0x435d33={};_0x435d33[_0x598d20[_0xcc62('0x28')]]={'$like':'%'+_0x4aa5a2[_0xcc62('0x2f')]['filter']+'%'};return _0x435d33;}})});}_0x4f5bd1=_['merge']({},_0x4f5bd1,_0x4aa5a2[_0xcc62('0x3f')]);var _0x555774={'where':_0x4f5bd1[_0xcc62('0x3c')]};return db[_0xcc62('0x2b')][_0xcc62('0x20')](_0x555774)[_0xcc62('0x25')](function(_0x2bd554){_0x4893e8[_0xcc62('0x20')]=_0x2bd554;if(_0x4aa5a2['query'][_0xcc62('0x40')]){_0x4f5bd1[_0xcc62('0x41')]=[{'all':!![]}];}return db[_0xcc62('0x2b')]['findAll'](_0x4f5bd1);})[_0xcc62('0x25')](function(_0x4c361b){_0x4893e8[_0xcc62('0x42')]=_0x4c361b;return _0x4893e8;})['then'](respondWithFilteredResult(_0x325c80,_0x4f5bd1))['catch'](handleError(_0x325c80,null));};exports[_0xcc62('0x43')]=function(_0x44ed4a,_0x92720c){var _0x55e6b1={'raw':!![],'where':{'id':_0x44ed4a['params']['id']}},_0x51e08d={};_0x51e08d[_0xcc62('0x33')]=_[_0xcc62('0x30')](db[_0xcc62('0x2b')]['rawAttributes']);_0x51e08d[_0xcc62('0x2f')]=_['keys'](_0x44ed4a[_0xcc62('0x2f')]);_0x51e08d[_0xcc62('0x31')]=_['intersection'](_0x51e08d['model'],_0x51e08d[_0xcc62('0x2f')]);_0x55e6b1['attributes']=_[_0xcc62('0x32')](_0x51e08d[_0xcc62('0x33')],qs[_0xcc62('0x35')](_0x44ed4a[_0xcc62('0x2f')]['fields']));_0x55e6b1[_0xcc62('0x34')]=_0x55e6b1[_0xcc62('0x34')][_0xcc62('0x36')]?_0x55e6b1[_0xcc62('0x34')]:_0x51e08d[_0xcc62('0x33')];if(_0x44ed4a[_0xcc62('0x2f')][_0xcc62('0x40')]){_0x55e6b1[_0xcc62('0x41')]=[{'all':!![]}];}_0x55e6b1=_[_0xcc62('0x3d')]({},_0x55e6b1,_0x44ed4a[_0xcc62('0x3f')]);return db[_0xcc62('0x2b')]['find'](_0x55e6b1)[_0xcc62('0x25')](handleEntityNotFound(_0x92720c,null))[_0xcc62('0x25')](respondWithResult(_0x92720c,null))['catch'](handleError(_0x92720c,null));};exports[_0xcc62('0x44')]=function(_0x2e4d1e,_0x37ca9d){return db['ZendeskField'][_0xcc62('0x44')](_0x2e4d1e[_0xcc62('0x45')],{})[_0xcc62('0x25')](respondWithResult(_0x37ca9d,0xc9))[_0xcc62('0x46')](handleError(_0x37ca9d,null));};exports[_0xcc62('0x24')]=function(_0x56bc4f,_0x885772){if(_0x56bc4f[_0xcc62('0x45')]['id']){delete _0x56bc4f[_0xcc62('0x45')]['id'];}return db[_0xcc62('0x2b')][_0xcc62('0x47')]({'where':{'id':_0x56bc4f[_0xcc62('0x48')]['id']}})[_0xcc62('0x25')](handleEntityNotFound(_0x885772,null))['then'](saveUpdates(_0x56bc4f['body'],null))['then'](respondWithResult(_0x885772,null))[_0xcc62('0x46')](handleError(_0x885772,null));};exports['destroy']=function(_0x284c6a,_0xcc55ad){return db[_0xcc62('0x2b')][_0xcc62('0x47')]({'where':{'id':_0x284c6a['params']['id']}})[_0xcc62('0x25')](handleEntityNotFound(_0xcc55ad,null))[_0xcc62('0x25')](removeEntity(_0xcc55ad,null))['catch'](handleError(_0xcc55ad,null));};
\ No newline at end of file
index b101e22..894c8f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x728c=['api','moment','bluebird','path','rimraf','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x41e81d,_0x2be61e){var _0x40292d=function(_0xbef560){while(--_0xbef560){_0x41e81d['push'](_0x41e81d['shift']());}};_0x40292d(++_0x2be61e);}(_0x728c,0x131));var _0xc728=function(_0x397771,_0x576694){_0x397771=_0x397771-0x0;var _0x345e04=_0x728c[_0x397771];return _0x345e04;};'use strict';var _=require(_0xc728('0x0'));var util=require(_0xc728('0x1'));var logger=require(_0xc728('0x2'))(_0xc728('0x3'));var moment=require(_0xc728('0x4'));var BPromise=require(_0xc728('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc728('0x6'));var rimraf=require(_0xc728('0x7'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x2095aa,_0x4861cb){return _0x2095aa[_0xc728('0x8')](_0xc728('0x9'),attributes,{'tableName':_0xc728('0xa'),'paranoid':![],'indexes':[{'name':_0xc728('0xb'),'fields':[_0xc728('0xc'),_0xc728('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x0e5f=['./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x385849,_0x51c9a8){var _0xb312c5=function(_0x2d3b0f){while(--_0x2d3b0f){_0x385849['push'](_0x385849['shift']());}};_0xb312c5(++_0x51c9a8);}(_0x0e5f,0xae));var _0xf0e5=function(_0x200896,_0x2ed78b){_0x200896=_0x200896-0x0;var _0x3334ec=_0x0e5f[_0x200896];return _0x3334ec;};'use strict';var _=require(_0xf0e5('0x0'));var util=require(_0xf0e5('0x1'));var logger=require('../../config/logger')(_0xf0e5('0x2'));var moment=require('moment');var BPromise=require(_0xf0e5('0x3'));var rp=require(_0xf0e5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0e5('0x5'));var config=require('../../config/environment');var attributes=require(_0xf0e5('0x6'));module[_0xf0e5('0x7')]=function(_0x23fe13,_0x3555f2){return _0x23fe13[_0xf0e5('0x8')]('ZendeskField',attributes,{'tableName':_0xf0e5('0x9'),'paranoid':![],'indexes':[{'name':_0xf0e5('0xa'),'fields':['idField',_0xf0e5('0xb')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 385d593..5018541 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2975=['error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5b4ce5,_0x20ee61){var _0x3c7cc6=function(_0x49818b){while(--_0x49818b){_0x5b4ce5['push'](_0x5b4ce5['shift']());}};_0x3c7cc6(++_0x20ee61);}(_0x2975,0x17c));var _0x5297=function(_0x3ead75,_0x408cd7){_0x3ead75=_0x3ead75-0x0;var _0x45561b=_0x2975[_0x3ead75];return _0x45561b;};'use strict';var _=require(_0x5297('0x0'));var util=require(_0x5297('0x1'));var moment=require(_0x5297('0x2'));var BPromise=require(_0x5297('0x3'));var rs=require(_0x5297('0x4'));var fs=require('fs');var Redis=require(_0x5297('0x5'));var db=require(_0x5297('0x6'))['db'];var utils=require(_0x5297('0x7'));var logger=require(_0x5297('0x8'))(_0x5297('0x9'));var config=require(_0x5297('0xa'));var jayson=require(_0x5297('0xb'));var client=jayson[_0x5297('0xc')][_0x5297('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5327d7,_0x27f648,_0x270cc2){return new BPromise(function(_0x422ffe,_0x3e7183){return client[_0x5297('0xe')](_0x5327d7,_0x270cc2)['then'](function(_0x21f3dd){logger['info'](_0x5297('0xf'),_0x27f648,'request\x20sent');logger[_0x5297('0x10')](_0x5297('0x11'),_0x27f648,_0x5297('0x12'),JSON[_0x5297('0x13')](_0x21f3dd));if(_0x21f3dd[_0x5297('0x14')]){if(_0x21f3dd[_0x5297('0x14')][_0x5297('0x15')]===0x1f4){logger[_0x5297('0x14')]('ZendeskField,\x20%s,\x20%s',_0x27f648,_0x21f3dd[_0x5297('0x14')][_0x5297('0x16')]);return _0x3e7183(_0x21f3dd[_0x5297('0x14')][_0x5297('0x16')]);}logger['error'](_0x5297('0xf'),_0x27f648,_0x21f3dd[_0x5297('0x14')][_0x5297('0x16')]);return _0x422ffe(_0x21f3dd['error'][_0x5297('0x16')]);}else{logger[_0x5297('0x17')](_0x5297('0xf'),_0x27f648,_0x5297('0x12'));_0x422ffe(_0x21f3dd['result'][_0x5297('0x16')]);}})[_0x5297('0x18')](function(_0x241842){logger[_0x5297('0x14')](_0x5297('0xf'),_0x27f648,_0x241842);_0x3e7183(_0x241842);});});}
\ No newline at end of file
+var _0x75d5=['stringify','code','message','error','ZendeskField,\x20%s,\x20%s','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','request\x20sent'];(function(_0x359cac,_0x4ca6b7){var _0x3f8144=function(_0x4f1d09){while(--_0x4f1d09){_0x359cac['push'](_0x359cac['shift']());}};_0x3f8144(++_0x4ca6b7);}(_0x75d5,0x126));var _0x575d=function(_0x42c33b,_0x3edcd3){_0x42c33b=_0x42c33b-0x0;var _0x1669f8=_0x75d5[_0x42c33b];return _0x1669f8;};'use strict';var _=require('lodash');var util=require(_0x575d('0x0'));var moment=require(_0x575d('0x1'));var BPromise=require(_0x575d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x575d('0x3'));var db=require(_0x575d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x575d('0x5'))(_0x575d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x575d('0x7')][_0x575d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31ab56,_0x168b20,_0x1d0818){return new BPromise(function(_0x5108e7,_0x1b183f){return client['request'](_0x31ab56,_0x1d0818)[_0x575d('0x9')](function(_0x42d0aa){logger[_0x575d('0xa')]('ZendeskField,\x20%s,\x20%s',_0x168b20,'request\x20sent');logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x168b20,_0x575d('0xb'),JSON[_0x575d('0xc')](_0x42d0aa));if(_0x42d0aa['error']){if(_0x42d0aa['error'][_0x575d('0xd')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x168b20,_0x42d0aa['error'][_0x575d('0xe')]);return _0x1b183f(_0x42d0aa['error'][_0x575d('0xe')]);}logger[_0x575d('0xf')](_0x575d('0x10'),_0x168b20,_0x42d0aa[_0x575d('0xf')]['message']);return _0x5108e7(_0x42d0aa[_0x575d('0xf')][_0x575d('0xe')]);}else{logger[_0x575d('0xa')](_0x575d('0x10'),_0x168b20,_0x575d('0xb'));_0x5108e7(_0x42d0aa['result'][_0x575d('0xe')]);}})['catch'](function(_0x3871ab){logger[_0x575d('0xf')](_0x575d('0x10'),_0x168b20,_0x3871ab);_0x1b183f(_0x3871ab);});});}
\ No newline at end of file
index f2eeb46..09bafd8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x64d0=['/:id','/:id/configurations','getFields','post','create','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x50aa83,_0x47b259){var _0x342030=function(_0xb9f361){while(--_0xb9f361){_0x50aa83['push'](_0x50aa83['shift']());}};_0x342030(++_0x47b259);}(_0x64d0,0x171));var _0x064d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64d0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x064d('0x0'));var util=require(_0x064d('0x1'));var path=require(_0x064d('0x2'));var timeout=require(_0x064d('0x3'));var express=require(_0x064d('0x4'));var router=express['Router']();var fs_extra=require(_0x064d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x064d('0x6'));var config=require(_0x064d('0x7'));var controller=require('./intZohoAccount.controller');router[_0x064d('0x8')]('/',auth[_0x064d('0x9')](),controller[_0x064d('0xa')]);router[_0x064d('0x8')](_0x064d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x064d('0x8')](_0x064d('0xc'),auth[_0x064d('0x9')](),controller['getConfigurations']);router[_0x064d('0x8')]('/:id/fields',auth[_0x064d('0x9')](),controller[_0x064d('0xd')]);router[_0x064d('0xe')]('/',auth['isAuthenticated'](),controller[_0x064d('0xf')]);router['post'](_0x064d('0xc'),auth['isAuthenticated'](),controller[_0x064d('0x10')]);router[_0x064d('0x11')](_0x064d('0xb'),auth[_0x064d('0x9')](),controller['update']);router[_0x064d('0x12')]('/:id',auth[_0x064d('0x9')](),controller['destroy']);module[_0x064d('0x13')]=router;
\ No newline at end of file
+var _0xcec0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','index','get','isAuthenticated','show','/:id/configurations','getFields','post','create','addConfiguration','/:id','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0xb459b4,_0xf36423){var _0x51921a=function(_0x489db7){while(--_0x489db7){_0xb459b4['push'](_0xb459b4['shift']());}};_0x51921a(++_0xf36423);}(_0xcec0,0x7f));var _0x0cec=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xcec0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0cec('0x0'));var util=require('util');var path=require(_0x0cec('0x1'));var timeout=require(_0x0cec('0x2'));var express=require(_0x0cec('0x3'));var router=express['Router']();var fs_extra=require(_0x0cec('0x4'));var auth=require(_0x0cec('0x5'));var interaction=require(_0x0cec('0x6'));var config=require(_0x0cec('0x7'));var controller=require(_0x0cec('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0cec('0x9')]);router[_0x0cec('0xa')]('/:id',auth[_0x0cec('0xb')](),controller[_0x0cec('0xc')]);router[_0x0cec('0xa')](_0x0cec('0xd'),auth[_0x0cec('0xb')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x0cec('0xb')](),controller[_0x0cec('0xe')]);router[_0x0cec('0xf')]('/',auth[_0x0cec('0xb')](),controller[_0x0cec('0x10')]);router[_0x0cec('0xf')](_0x0cec('0xd'),auth[_0x0cec('0xb')](),controller[_0x0cec('0x11')]);router['put'](_0x0cec('0x12'),auth[_0x0cec('0xb')](),controller['update']);router[_0x0cec('0x13')](_0x0cec('0x12'),auth[_0x0cec('0xb')](),controller[_0x0cec('0x14')]);module[_0x0cec('0x15')]=router;
\ No newline at end of file
index 5c74bc3..e7a8980 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb43b=['exports','STRING','sequelize'];(function(_0x246115,_0x398123){var _0x385878=function(_0x534a9c){while(--_0x534a9c){_0x246115['push'](_0x246115['shift']());}};_0x385878(++_0x398123);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5a423d,_0x362950){_0x5a423d=_0x5a423d-0x0;var _0x571d3b=_0xb43b[_0x5a423d];return _0x571d3b;};'use strict';var Sequelize=require(_0xbb43('0x0'));module[_0xbb43('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbb43('0x2')]},'host':{'type':Sequelize[_0xbb43('0x2')]},'zone':{'type':Sequelize[_0xbb43('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xbb43('0x2')]},'serverUrl':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xbb43('0x2')]},'refreshToken':{'type':Sequelize[_0xbb43('0x2')]}};
\ No newline at end of file
+var _0x9bde=['STRING','exports'];(function(_0x4c3ffe,_0x457374){var _0x28d3eb=function(_0x3ae2a3){while(--_0x3ae2a3){_0x4c3ffe['push'](_0x4c3ffe['shift']());}};_0x28d3eb(++_0x457374);}(_0x9bde,0xe1));var _0xe9bd=function(_0x465694,_0x17820e){_0x465694=_0x465694-0x0;var _0x3b4c6d=_0x9bde[_0x465694];return _0x3b4c6d;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe9bd('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xe9bd('0x1')]},'clientId':{'type':Sequelize[_0xe9bd('0x1')]},'clientSecret':{'type':Sequelize[_0xe9bd('0x1')]},'serverUrl':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xe9bd('0x1')]},'refreshToken':{'type':Sequelize[_0xe9bd('0x1')]}};
\ No newline at end of file
index ef1ec9e..42d3708 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4f9c=['status','end','json','offset','undefined','count','set','apply','reject','destroy','then','sendStatus','error','stack','name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','limit','sort','filters','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','merge','catch','create','body','find','getConfigurations','ZohoConfiguration','pick','hasOwnProperty','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','code','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Description','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','pick_list_values','test','statusCode','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x4e595c,_0x397f64){var _0x325ae3=function(_0x161391){while(--_0x161391){_0x4e595c['push'](_0x4e595c['shift']());}};_0x325ae3(++_0x397f64);}(_0x4f9c,0x69));var _0xc4f9=function(_0x273f77,_0xe5b0cb){_0x273f77=_0x273f77-0x0;var _0x71e147=_0x4f9c[_0x273f77];return _0x71e147;};'use strict';var emlformat=require(_0xc4f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc4f9('0x1'));var jsonpatch=require(_0xc4f9('0x2'));var rp=require(_0xc4f9('0x3'));var moment=require(_0xc4f9('0x4'));var BPromise=require(_0xc4f9('0x5'));var Mustache=require(_0xc4f9('0x6'));var util=require(_0xc4f9('0x7'));var path=require(_0xc4f9('0x8'));var sox=require('sox');var csv=require(_0xc4f9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc4f9('0xa'));var _=require(_0xc4f9('0xb'));var squel=require(_0xc4f9('0xc'));var crypto=require('crypto');var jsforce=require(_0xc4f9('0xd'));var deskjs=require(_0xc4f9('0xe'));var toCsv=require(_0xc4f9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc4f9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc4f9('0x10'));var as=require(_0xc4f9('0x11'));var hardwareService=require(_0xc4f9('0x12'));var logger=require(_0xc4f9('0x13'))(_0xc4f9('0x14'));var utils=require(_0xc4f9('0x15'));var config=require(_0xc4f9('0x16'));var licenseUtil=require(_0xc4f9('0x17'));var db=require(_0xc4f9('0x18'))['db'];var integrations=require(_0xc4f9('0x19'));function respondWithStatusCode(_0x3d746e,_0x3de871){_0x3de871=_0x3de871||0xcc;return function(_0x31cce7){if(_0x31cce7){return _0x3d746e['sendStatus'](_0x3de871);}return _0x3d746e[_0xc4f9('0x1a')](_0x3de871)[_0xc4f9('0x1b')]();};}function respondWithResult(_0x5cfcf6,_0x16a9cc){_0x16a9cc=_0x16a9cc||0xc8;return function(_0x3282cc){if(_0x3282cc){return _0x5cfcf6[_0xc4f9('0x1a')](_0x16a9cc)[_0xc4f9('0x1c')](_0x3282cc);}};}function respondWithFilteredResult(_0x10f9a0,_0x24d97b){return function(_0x2046e6){if(_0x2046e6){var _0xcf6c08=typeof _0x24d97b[_0xc4f9('0x1d')]===_0xc4f9('0x1e')&&typeof _0x24d97b['limit']===_0xc4f9('0x1e');var _0x1534f5=_0x2046e6[_0xc4f9('0x1f')];var _0x53709b=_0xcf6c08?0x0:_0x24d97b['offset'];var _0x5e77a4=_0xcf6c08?_0x2046e6[_0xc4f9('0x1f')]:_0x24d97b[_0xc4f9('0x1d')]+_0x24d97b['limit'];var _0x578df1;if(_0x5e77a4>=_0x1534f5){_0x5e77a4=_0x1534f5;_0x578df1=0xc8;}else{_0x578df1=0xce;}_0x10f9a0[_0xc4f9('0x1a')](_0x578df1);return _0x10f9a0[_0xc4f9('0x20')]('Content-Range',_0x53709b+'-'+_0x5e77a4+'/'+_0x1534f5)[_0xc4f9('0x1c')](_0x2046e6);}return null;};}function patchUpdates(_0x19cdb5){return function(_0xa6368c){try{jsonpatch[_0xc4f9('0x21')](_0xa6368c,_0x19cdb5,!![]);}catch(_0xcad21e){return BPromise[_0xc4f9('0x22')](_0xcad21e);}return _0xa6368c['save']();};}function saveUpdates(_0x23ac44,_0x177f35){return function(_0x1463a0){if(_0x1463a0){return _0x1463a0['update'](_0x23ac44)['then'](function(_0x33e1b0){return _0x33e1b0;});}return null;};}function removeEntity(_0x3d32a9,_0x5ef45a){return function(_0x5201a8){if(_0x5201a8){return _0x5201a8[_0xc4f9('0x23')]()[_0xc4f9('0x24')](function(){_0x3d32a9[_0xc4f9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc324c6,_0x8f0363){return function(_0x404160){if(!_0x404160){_0xc324c6[_0xc4f9('0x25')](0x194);}return _0x404160;};}function handleError(_0x28676c,_0x5f5cb9){_0x5f5cb9=_0x5f5cb9||0x1f4;return function(_0xd8c74f){logger[_0xc4f9('0x26')](_0xd8c74f[_0xc4f9('0x27')]);if(_0xd8c74f[_0xc4f9('0x28')]){delete _0xd8c74f[_0xc4f9('0x28')];}_0x28676c[_0xc4f9('0x1a')](_0x5f5cb9)[_0xc4f9('0x29')](_0xd8c74f);};}exports[_0xc4f9('0x2a')]=function(_0x1d364b,_0x3248e6){var _0x4090b1={},_0x1c5938={},_0x2b36e0={'count':0x0,'rows':[]};var _0x5bdd1e=_['map'](db[_0xc4f9('0x2b')][_0xc4f9('0x2c')],function(_0x5efbe4){return{'name':_0x5efbe4[_0xc4f9('0x2d')],'type':_0x5efbe4[_0xc4f9('0x2e')][_0xc4f9('0x2f')]};});_0x1c5938[_0xc4f9('0x30')]=_[_0xc4f9('0x31')](_0x5bdd1e,'name');_0x1c5938[_0xc4f9('0x32')]=_[_0xc4f9('0x33')](_0x1d364b['query']);_0x1c5938['filters']=_[_0xc4f9('0x34')](_0x1c5938[_0xc4f9('0x30')],_0x1c5938[_0xc4f9('0x32')]);_0x4090b1['attributes']=_[_0xc4f9('0x34')](_0x1c5938[_0xc4f9('0x30')],qs[_0xc4f9('0x35')](_0x1d364b['query'][_0xc4f9('0x35')]));_0x4090b1[_0xc4f9('0x36')]=_0x4090b1[_0xc4f9('0x36')][_0xc4f9('0x37')]?_0x4090b1['attributes']:_0x1c5938[_0xc4f9('0x30')];if(!_0x1d364b[_0xc4f9('0x32')]['hasOwnProperty'](_0xc4f9('0x38'))){_0x4090b1[_0xc4f9('0x39')]=qs[_0xc4f9('0x39')](_0x1d364b[_0xc4f9('0x32')][_0xc4f9('0x39')]);_0x4090b1[_0xc4f9('0x1d')]=qs[_0xc4f9('0x1d')](_0x1d364b[_0xc4f9('0x32')][_0xc4f9('0x1d')]);}_0x4090b1['order']=qs[_0xc4f9('0x3a')](_0x1d364b[_0xc4f9('0x32')][_0xc4f9('0x3a')]);_0x4090b1['where']=qs[_0xc4f9('0x3b')](_['pick'](_0x1d364b[_0xc4f9('0x32')],_0x1c5938[_0xc4f9('0x3b')]),_0x5bdd1e);if(_0x1d364b[_0xc4f9('0x32')]['filter']){_0x4090b1['where']=_['merge'](_0x4090b1[_0xc4f9('0x3c')],{'$or':_[_0xc4f9('0x31')](_0x5bdd1e,function(_0x178b88){if(_0x178b88['type']!==_0xc4f9('0x3d')){var _0x1ebbc8={};_0x1ebbc8[_0x178b88[_0xc4f9('0x28')]]={'$like':'%'+_0x1d364b[_0xc4f9('0x32')][_0xc4f9('0x3e')]+'%'};return _0x1ebbc8;}})});}_0x4090b1=_['merge']({},_0x4090b1,_0x1d364b[_0xc4f9('0x3f')]);var _0x2a4d68={'where':_0x4090b1[_0xc4f9('0x3c')]};return db['ZohoAccount'][_0xc4f9('0x1f')](_0x2a4d68)[_0xc4f9('0x24')](function(_0x589c77){_0x2b36e0[_0xc4f9('0x1f')]=_0x589c77;if(_0x1d364b[_0xc4f9('0x32')][_0xc4f9('0x40')]){_0x4090b1[_0xc4f9('0x41')]=[{'all':!![]}];}return db['ZohoAccount'][_0xc4f9('0x42')](_0x4090b1);})['then'](function(_0xd7f25){_0x2b36e0[_0xc4f9('0x43')]=_0xd7f25;return _0x2b36e0;})[_0xc4f9('0x24')](respondWithFilteredResult(_0x3248e6,_0x4090b1))['catch'](handleError(_0x3248e6,null));};exports[_0xc4f9('0x44')]=function(_0xd5d97b,_0x34370a){var _0x4a9707={'raw':![],'where':{'id':_0xd5d97b[_0xc4f9('0x45')]['id']}},_0x409310={};_0x409310['model']=_['keys'](db[_0xc4f9('0x2b')][_0xc4f9('0x2c')]);_0x409310[_0xc4f9('0x32')]=_['keys'](_0xd5d97b[_0xc4f9('0x32')]);_0x409310['filters']=_[_0xc4f9('0x34')](_0x409310['model'],_0x409310['query']);_0x4a9707['attributes']=_[_0xc4f9('0x34')](_0x409310['model'],qs[_0xc4f9('0x35')](_0xd5d97b['query'][_0xc4f9('0x35')]));_0x4a9707['attributes']=_0x4a9707[_0xc4f9('0x36')][_0xc4f9('0x37')]?_0x4a9707[_0xc4f9('0x36')]:_0x409310[_0xc4f9('0x30')];if(_0xd5d97b[_0xc4f9('0x32')][_0xc4f9('0x40')]){_0x4a9707[_0xc4f9('0x41')]=[{'all':!![]}];}_0x4a9707=_[_0xc4f9('0x46')]({},_0x4a9707,_0xd5d97b['options']);return db['ZohoAccount']['find'](_0x4a9707)[_0xc4f9('0x24')](handleEntityNotFound(_0x34370a,null))['then'](respondWithResult(_0x34370a,null))[_0xc4f9('0x47')](handleError(_0x34370a,null));};exports['create']=function(_0x1f60e5,_0x14a491){return db[_0xc4f9('0x2b')][_0xc4f9('0x48')](_0x1f60e5[_0xc4f9('0x49')],{})[_0xc4f9('0x24')](respondWithResult(_0x14a491,0xc9))['catch'](handleError(_0x14a491,null));};exports['update']=function(_0x2036cf,_0x4531e7){if(_0x2036cf[_0xc4f9('0x49')]['id']){delete _0x2036cf['body']['id'];}return db[_0xc4f9('0x2b')][_0xc4f9('0x4a')]({'where':{'id':_0x2036cf[_0xc4f9('0x45')]['id']}})[_0xc4f9('0x24')](handleEntityNotFound(_0x4531e7,null))[_0xc4f9('0x24')](saveUpdates(_0x2036cf['body'],null))['then'](respondWithResult(_0x4531e7,null))[_0xc4f9('0x47')](handleError(_0x4531e7,null));};exports[_0xc4f9('0x23')]=function(_0x5ea809,_0x1c381d){return db[_0xc4f9('0x2b')][_0xc4f9('0x4a')]({'where':{'id':_0x5ea809[_0xc4f9('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c381d,null))[_0xc4f9('0x24')](removeEntity(_0x1c381d,null))[_0xc4f9('0x47')](handleError(_0x1c381d,null));};exports[_0xc4f9('0x4b')]=function(_0x1a58ea,_0x53a70d,_0x3b44e9){var _0x52758c={};var _0x3239cd={};var _0xc50cae;var _0x3cc83a;return db[_0xc4f9('0x2b')]['findOne']({'where':{'id':_0x1a58ea[_0xc4f9('0x45')]['id']}})[_0xc4f9('0x24')](handleEntityNotFound(_0x53a70d,null))[_0xc4f9('0x24')](function(_0x110d7a){if(_0x110d7a){_0xc50cae=_0x110d7a;_0x3239cd[_0xc4f9('0x30')]=_[_0xc4f9('0x33')](db[_0xc4f9('0x4c')][_0xc4f9('0x2c')]);_0x3239cd['query']=_[_0xc4f9('0x33')](_0x1a58ea[_0xc4f9('0x32')]);_0x3239cd[_0xc4f9('0x3b')]=_[_0xc4f9('0x34')](_0x3239cd[_0xc4f9('0x30')],_0x3239cd[_0xc4f9('0x32')]);_0x52758c['attributes']=_[_0xc4f9('0x34')](_0x3239cd['model'],qs[_0xc4f9('0x35')](_0x1a58ea[_0xc4f9('0x32')][_0xc4f9('0x35')]));_0x52758c[_0xc4f9('0x36')]=_0x52758c[_0xc4f9('0x36')]['length']?_0x52758c[_0xc4f9('0x36')]:_0x3239cd[_0xc4f9('0x30')];_0x52758c['order']=qs['sort'](_0x1a58ea[_0xc4f9('0x32')][_0xc4f9('0x3a')]);_0x52758c[_0xc4f9('0x3c')]=qs['filters'](_[_0xc4f9('0x4d')](_0x1a58ea[_0xc4f9('0x32')],_0x3239cd[_0xc4f9('0x3b')]));if(_0x1a58ea[_0xc4f9('0x32')][_0xc4f9('0x3e')]){_0x52758c[_0xc4f9('0x3c')]=_[_0xc4f9('0x46')](_0x52758c[_0xc4f9('0x3c')],{'$or':_[_0xc4f9('0x31')](_0x52758c[_0xc4f9('0x36')],function(_0x2e6381){var _0x2a724c={};_0x2a724c[_0x2e6381]={'$like':'%'+_0x1a58ea['query'][_0xc4f9('0x3e')]+'%'};return _0x2a724c;})});}_0x52758c=_[_0xc4f9('0x46')]({},_0x52758c,_0x1a58ea[_0xc4f9('0x3f')]);return _0xc50cae['getConfigurations'](_0x52758c);}})[_0xc4f9('0x24')](function(_0x3d202e){if(_0x3d202e){_0x3cc83a=_0x3d202e[_0xc4f9('0x37')];if(!_0x1a58ea[_0xc4f9('0x32')][_0xc4f9('0x4e')](_0xc4f9('0x38'))){_0x52758c[_0xc4f9('0x39')]=qs[_0xc4f9('0x39')](_0x1a58ea[_0xc4f9('0x32')][_0xc4f9('0x39')]);_0x52758c['offset']=qs[_0xc4f9('0x1d')](_0x1a58ea[_0xc4f9('0x32')]['offset']);}return _0xc50cae[_0xc4f9('0x4b')](_0x52758c);}})[_0xc4f9('0x24')](function(_0x476ead){if(_0x476ead){return _0x476ead?{'count':_0x3cc83a,'rows':_0x476ead}:null;}})[_0xc4f9('0x24')](respondWithResult(_0x53a70d,null))[_0xc4f9('0x47')](handleError(_0x53a70d,null));};exports[_0xc4f9('0x4f')]=function(_0x53da1a,_0x227313,_0x703282){if(_0x53da1a[_0xc4f9('0x49')]['id']){delete _0x53da1a[_0xc4f9('0x49')]['id'];}return db[_0xc4f9('0x2b')][_0xc4f9('0x50')]({'where':{'id':_0x53da1a['params']['id']}})[_0xc4f9('0x24')](handleEntityNotFound(_0x227313,null))[_0xc4f9('0x24')](function(_0x3d81d8){if(_0x3d81d8){_0x53da1a[_0xc4f9('0x49')]['AccountId']=_0x3d81d8['id'];_0x53da1a['body'][_0xc4f9('0x51')]=integrations[_0xc4f9('0x52')](_0x53da1a[_0xc4f9('0x49')][_0xc4f9('0x53')],_0x53da1a[_0xc4f9('0x49')][_0xc4f9('0x2e')]);_0x53da1a['body'][_0xc4f9('0x54')]=integrations[_0xc4f9('0x55')](_0x53da1a[_0xc4f9('0x49')][_0xc4f9('0x53')],_0x53da1a[_0xc4f9('0x49')][_0xc4f9('0x2e')]);return db[_0xc4f9('0x4c')]['create'](_0x53da1a[_0xc4f9('0x49')],{'include':[{'model':db[_0xc4f9('0x56')],'as':_0xc4f9('0x51')},{'model':db[_0xc4f9('0x56')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x227313,null))[_0xc4f9('0x47')](handleError(_0x227313,null));};function getAccessToken(_0x27d340){return new Promise(function(_0x9e0b11,_0x4fe7c6){var _0x4d07e0;switch(_0x27d340[_0xc4f9('0x57')]){case'US':_0x4d07e0='https://accounts.zoho.com';break;case'AU':_0x4d07e0=_0xc4f9('0x58');break;case'EU':_0x4d07e0=_0xc4f9('0x59');break;case'IN':_0x4d07e0=_0xc4f9('0x5a');break;case'CN':_0x4d07e0=_0xc4f9('0x5b');break;default:_0x4d07e0='https://accounts.zoho.eu';break;}var _0x245a4f={'method':_0xc4f9('0x5c'),'uri':_0x4d07e0+_0xc4f9('0x5d'),'qs':{'refresh_token':_0x27d340[_0xc4f9('0x5e')],'client_id':_0x27d340['clientId'],'client_secret':_0x27d340[_0xc4f9('0x5f')],'grant_type':_0xc4f9('0x60')},'json':!![]};return rp(_0x245a4f)[_0xc4f9('0x24')](function(_0x279cfc){if(_0x279cfc['access_token']){_0x9e0b11(_0x279cfc[_0xc4f9('0x61')]);}else{_0x4fe7c6(_0xc4f9('0x62'));}})[_0xc4f9('0x47')](function(_0x26acea){_0x4fe7c6(_0x26acea);});});}exports[_0xc4f9('0x63')]=function(_0x4ee3f3,_0x44b25b,_0x3542dd){var _0x7470a2,_0x33d86a,_0xe4bce3,_0x55d5d7,_0x2318f7;return db[_0xc4f9('0x2b')][_0xc4f9('0x50')]({'where':{'id':_0x4ee3f3[_0xc4f9('0x45')]['id']},'attributes':['id',_0xc4f9('0x64'),_0xc4f9('0x57'),'clientId','clientSecret','serverUrl',_0xc4f9('0x65'),_0xc4f9('0x5e')]})[_0xc4f9('0x24')](handleEntityNotFound(_0x44b25b,null))[_0xc4f9('0x24')](function(_0x36b8c7){_0x2318f7=_0x36b8c7;_0x7470a2=_0x2318f7[_0xc4f9('0x64')];_0x33d86a=_0x7470a2===_0xc4f9('0x66')?'eu':_0xc4f9('0x67');_0xe4bce3=_0x2318f7[_0xc4f9('0x68')];var _0x4370be=_0xe4bce3[_0xc4f9('0x69')](-0x1);if(_0x4370be==='/'||_0x4370be==='\x5c'||_0x4370be===':'){_0xe4bce3=_0xe4bce3[_0xc4f9('0x6a')](0x0,_0xe4bce3[_0xc4f9('0x6b')](_0x4370be));}if(!_0x2318f7['refreshToken']){throw new Error(_0xc4f9('0x6c'));}return getAccessToken(_0x2318f7);})[_0xc4f9('0x24')](function(_0x8ce3cc){if(_0x8ce3cc){return rp({'method':'GET','uri':util[_0xc4f9('0x6d')](_0xc4f9('0x6e'),_0x33d86a),'qs':{'module':_0xc4f9('0x6f')},'headers':{'Authorization':_0xc4f9('0x70')+_0x8ce3cc},'json':!![]});}})['then'](function(_0x11d11a){if(_0x11d11a){if(_0x11d11a[_0xc4f9('0x71')]&&_0x11d11a['response'][_0xc4f9('0x26')]){throw new Error(_0x11d11a[_0xc4f9('0x71')][_0xc4f9('0x26')][_0xc4f9('0x72')]);}var _0x3c3b90=[];var _0x478c27=[];var _0x4bbfeb=[_0xc4f9('0x73'),'Subject',_0xc4f9('0x74'),'WhoId','Call_Duration',_0xc4f9('0x75'),'Call_Start_Time',_0xc4f9('0x76')];_0x478c27=_[_0xc4f9('0x77')](_0x11d11a[_0xc4f9('0x35')],function(_0x5b85ce){return _0x4bbfeb[_0xc4f9('0x78')](_0x5b85ce[_0xc4f9('0x79')]);});for(var _0xb4c0cc=0x0;_0xb4c0cc<_0x478c27[_0xc4f9('0x37')];_0xb4c0cc++){if(_0x478c27[_0xb4c0cc][_0xc4f9('0x7a')]===![]){_0x3c3b90[_0xc4f9('0x7b')]({'id':_0x478c27[_0xb4c0cc]['id'],'name':_0x478c27[_0xb4c0cc][_0xc4f9('0x7c')],'custom':_0x478c27[_0xb4c0cc][_0xc4f9('0x7d')],'options':_0x478c27[_0xb4c0cc]['data_type']==='picklist'&&_0x478c27[_0xb4c0cc][_0xc4f9('0x7e')][_0xc4f9('0x37')]>-0x1?_[_0xc4f9('0x31')](_0x478c27[_0xb4c0cc]['pick_list_values'],function(_0x4c414f){return{'name':_0x4c414f,'value':_0x4c414f};}):[]});}}return{'count':_0x3c3b90[_0xc4f9('0x37')],'rows':_0x3c3b90};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x44b25b,null))[_0xc4f9('0x47')](function(_0x576153){var _0x23bc43=_0x4ee3f3['query'][_0xc4f9('0x7f')]?0x1f4:_0x576153[_0xc4f9('0x80')]||0x1f4;logger[_0xc4f9('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xc4f9('0x63'),_0x23bc43,JSON[_0xc4f9('0x81')](_0x576153));delete _0x576153[_0xc4f9('0x28')];if(_0x23bc43===0x191){_0x23bc43=0x190;}_0x44b25b[_0xc4f9('0x1a')](_0x23bc43)[_0xc4f9('0x29')](_0x4ee3f3[_0xc4f9('0x32')][_0xc4f9('0x7f')]?{'message':_0xc4f9('0x82'),'statusCode':_0x576153[_0xc4f9('0x80')]}:_0x576153);});};
\ No newline at end of file
+var _0x7738=['host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','json','offset','undefined','limit','status','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','ZohoAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','count','includeAll','findAll','rows','catch','rawAttributes','include','options','find','create','body','params','findOne','ZohoConfiguration','order','getConfigurations','hasOwnProperty','Subjects','getSubjects','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields'];(function(_0x811786,_0x1ad82b){var _0x577f7c=function(_0x316f0e){while(--_0x316f0e){_0x811786['push'](_0x811786['shift']());}};_0x577f7c(++_0x1ad82b);}(_0x7738,0x116));var _0x8773=function(_0x4ef7e2,_0x257e37){_0x4ef7e2=_0x4ef7e2-0x0;var _0x84fa8=_0x7738[_0x4ef7e2];return _0x84fa8;};'use strict';var emlformat=require(_0x8773('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8773('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8773('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8773('0x3'));var util=require('util');var path=require(_0x8773('0x4'));var sox=require(_0x8773('0x5'));var csv=require(_0x8773('0x6'));var ejs=require(_0x8773('0x7'));var fs=require('fs');var fs_extra=require(_0x8773('0x8'));var _=require(_0x8773('0x9'));var squel=require('squel');var crypto=require(_0x8773('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8773('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8773('0xb'));var qs=require(_0x8773('0xc'));var as=require(_0x8773('0xd'));var hardwareService=require(_0x8773('0xe'));var logger=require(_0x8773('0xf'))('api');var utils=require(_0x8773('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x8773('0x11'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x39119f,_0x29f0c8){_0x29f0c8=_0x29f0c8||0xcc;return function(_0x43468c){if(_0x43468c){return _0x39119f['sendStatus'](_0x29f0c8);}return _0x39119f['status'](_0x29f0c8)[_0x8773('0x12')]();};}function respondWithResult(_0x8ef06d,_0x26bddd){_0x26bddd=_0x26bddd||0xc8;return function(_0x30b3de){if(_0x30b3de){return _0x8ef06d['status'](_0x26bddd)[_0x8773('0x13')](_0x30b3de);}};}function respondWithFilteredResult(_0x55d40a,_0x27c5f2){return function(_0x1b43c5){if(_0x1b43c5){var _0x528f9c=typeof _0x27c5f2[_0x8773('0x14')]===_0x8773('0x15')&&typeof _0x27c5f2['limit']===_0x8773('0x15');var _0x5b7605=_0x1b43c5['count'];var _0x346e22=_0x528f9c?0x0:_0x27c5f2[_0x8773('0x14')];var _0x4a47b5=_0x528f9c?_0x1b43c5['count']:_0x27c5f2[_0x8773('0x14')]+_0x27c5f2[_0x8773('0x16')];var _0x471148;if(_0x4a47b5>=_0x5b7605){_0x4a47b5=_0x5b7605;_0x471148=0xc8;}else{_0x471148=0xce;}_0x55d40a[_0x8773('0x17')](_0x471148);return _0x55d40a['set'](_0x8773('0x18'),_0x346e22+'-'+_0x4a47b5+'/'+_0x5b7605)[_0x8773('0x13')](_0x1b43c5);}return null;};}function patchUpdates(_0x3cddc5){return function(_0x1902c9){try{jsonpatch[_0x8773('0x19')](_0x1902c9,_0x3cddc5,!![]);}catch(_0x3b7b8c){return BPromise['reject'](_0x3b7b8c);}return _0x1902c9[_0x8773('0x1a')]();};}function saveUpdates(_0xd224b5,_0x24f975){return function(_0x15f46b){if(_0x15f46b){return _0x15f46b[_0x8773('0x1b')](_0xd224b5)[_0x8773('0x1c')](function(_0x5c5178){return _0x5c5178;});}return null;};}function removeEntity(_0x538155,_0x38f7e6){return function(_0x5f55dd){if(_0x5f55dd){return _0x5f55dd[_0x8773('0x1d')]()[_0x8773('0x1c')](function(){_0x538155[_0x8773('0x17')](0xcc)[_0x8773('0x12')]();});}};}function handleEntityNotFound(_0x2807ca,_0x2708aa){return function(_0x244b14){if(!_0x244b14){_0x2807ca[_0x8773('0x1e')](0x194);}return _0x244b14;};}function handleError(_0x400ce6,_0x16f01f){_0x16f01f=_0x16f01f||0x1f4;return function(_0x5d46ee){logger[_0x8773('0x1f')](_0x5d46ee[_0x8773('0x20')]);if(_0x5d46ee[_0x8773('0x21')]){delete _0x5d46ee[_0x8773('0x21')];}_0x400ce6[_0x8773('0x17')](_0x16f01f)[_0x8773('0x22')](_0x5d46ee);};}exports['index']=function(_0x2cf88c,_0x106dd9){var _0x5df28b={},_0x44e246={},_0x2d3b76={'count':0x0,'rows':[]};var _0x56907a=_[_0x8773('0x23')](db[_0x8773('0x24')]['rawAttributes'],function(_0x420d2f){return{'name':_0x420d2f[_0x8773('0x25')],'type':_0x420d2f[_0x8773('0x26')][_0x8773('0x27')]};});_0x44e246[_0x8773('0x28')]=_['map'](_0x56907a,_0x8773('0x21'));_0x44e246['query']=_[_0x8773('0x29')](_0x2cf88c[_0x8773('0x2a')]);_0x44e246[_0x8773('0x2b')]=_[_0x8773('0x2c')](_0x44e246[_0x8773('0x28')],_0x44e246[_0x8773('0x2a')]);_0x5df28b[_0x8773('0x2d')]=_['intersection'](_0x44e246['model'],qs['fields'](_0x2cf88c[_0x8773('0x2a')][_0x8773('0x2e')]));_0x5df28b[_0x8773('0x2d')]=_0x5df28b[_0x8773('0x2d')][_0x8773('0x2f')]?_0x5df28b[_0x8773('0x2d')]:_0x44e246[_0x8773('0x28')];if(!_0x2cf88c['query']['hasOwnProperty'](_0x8773('0x30'))){_0x5df28b[_0x8773('0x16')]=qs[_0x8773('0x16')](_0x2cf88c[_0x8773('0x2a')][_0x8773('0x16')]);_0x5df28b[_0x8773('0x14')]=qs[_0x8773('0x14')](_0x2cf88c['query']['offset']);}_0x5df28b['order']=qs[_0x8773('0x31')](_0x2cf88c[_0x8773('0x2a')][_0x8773('0x31')]);_0x5df28b[_0x8773('0x32')]=qs['filters'](_[_0x8773('0x33')](_0x2cf88c[_0x8773('0x2a')],_0x44e246[_0x8773('0x2b')]),_0x56907a);if(_0x2cf88c[_0x8773('0x2a')][_0x8773('0x34')]){_0x5df28b['where']=_['merge'](_0x5df28b[_0x8773('0x32')],{'$or':_['map'](_0x56907a,function(_0x2fc06a){if(_0x2fc06a[_0x8773('0x26')]!=='VIRTUAL'){var _0x192dbf={};_0x192dbf[_0x2fc06a['name']]={'$like':'%'+_0x2cf88c[_0x8773('0x2a')][_0x8773('0x34')]+'%'};return _0x192dbf;}})});}_0x5df28b=_[_0x8773('0x35')]({},_0x5df28b,_0x2cf88c['options']);var _0x401418={'where':_0x5df28b[_0x8773('0x32')]};return db[_0x8773('0x24')][_0x8773('0x36')](_0x401418)[_0x8773('0x1c')](function(_0x233ea3){_0x2d3b76[_0x8773('0x36')]=_0x233ea3;if(_0x2cf88c[_0x8773('0x2a')][_0x8773('0x37')]){_0x5df28b['include']=[{'all':!![]}];}return db[_0x8773('0x24')][_0x8773('0x38')](_0x5df28b);})[_0x8773('0x1c')](function(_0x44096c){_0x2d3b76[_0x8773('0x39')]=_0x44096c;return _0x2d3b76;})[_0x8773('0x1c')](respondWithFilteredResult(_0x106dd9,_0x5df28b))[_0x8773('0x3a')](handleError(_0x106dd9,null));};exports['show']=function(_0x21b421,_0x1fbb1a){var _0x337bc9={'raw':![],'where':{'id':_0x21b421['params']['id']}},_0x31f53f={};_0x31f53f[_0x8773('0x28')]=_[_0x8773('0x29')](db[_0x8773('0x24')][_0x8773('0x3b')]);_0x31f53f[_0x8773('0x2a')]=_[_0x8773('0x29')](_0x21b421['query']);_0x31f53f[_0x8773('0x2b')]=_[_0x8773('0x2c')](_0x31f53f[_0x8773('0x28')],_0x31f53f['query']);_0x337bc9[_0x8773('0x2d')]=_[_0x8773('0x2c')](_0x31f53f['model'],qs[_0x8773('0x2e')](_0x21b421[_0x8773('0x2a')][_0x8773('0x2e')]));_0x337bc9[_0x8773('0x2d')]=_0x337bc9[_0x8773('0x2d')][_0x8773('0x2f')]?_0x337bc9[_0x8773('0x2d')]:_0x31f53f[_0x8773('0x28')];if(_0x21b421[_0x8773('0x2a')][_0x8773('0x37')]){_0x337bc9[_0x8773('0x3c')]=[{'all':!![]}];}_0x337bc9=_[_0x8773('0x35')]({},_0x337bc9,_0x21b421[_0x8773('0x3d')]);return db[_0x8773('0x24')][_0x8773('0x3e')](_0x337bc9)['then'](handleEntityNotFound(_0x1fbb1a,null))[_0x8773('0x1c')](respondWithResult(_0x1fbb1a,null))[_0x8773('0x3a')](handleError(_0x1fbb1a,null));};exports['create']=function(_0x27aa2e,_0x3d0517){return db['ZohoAccount'][_0x8773('0x3f')](_0x27aa2e['body'],{})[_0x8773('0x1c')](respondWithResult(_0x3d0517,0xc9))[_0x8773('0x3a')](handleError(_0x3d0517,null));};exports[_0x8773('0x1b')]=function(_0x16af86,_0x53d235){if(_0x16af86[_0x8773('0x40')]['id']){delete _0x16af86[_0x8773('0x40')]['id'];}return db[_0x8773('0x24')][_0x8773('0x3e')]({'where':{'id':_0x16af86[_0x8773('0x41')]['id']}})[_0x8773('0x1c')](handleEntityNotFound(_0x53d235,null))['then'](saveUpdates(_0x16af86[_0x8773('0x40')],null))[_0x8773('0x1c')](respondWithResult(_0x53d235,null))['catch'](handleError(_0x53d235,null));};exports['destroy']=function(_0xd4b23f,_0x2665f5){return db[_0x8773('0x24')][_0x8773('0x3e')]({'where':{'id':_0xd4b23f[_0x8773('0x41')]['id']}})[_0x8773('0x1c')](handleEntityNotFound(_0x2665f5,null))[_0x8773('0x1c')](removeEntity(_0x2665f5,null))[_0x8773('0x3a')](handleError(_0x2665f5,null));};exports['getConfigurations']=function(_0x559c48,_0x41e43e,_0x4b9c3d){var _0x466185={};var _0x415f0f={};var _0x2f2dc9;var _0x5cdf58;return db['ZohoAccount'][_0x8773('0x42')]({'where':{'id':_0x559c48['params']['id']}})[_0x8773('0x1c')](handleEntityNotFound(_0x41e43e,null))[_0x8773('0x1c')](function(_0x1f21ee){if(_0x1f21ee){_0x2f2dc9=_0x1f21ee;_0x415f0f[_0x8773('0x28')]=_[_0x8773('0x29')](db[_0x8773('0x43')][_0x8773('0x3b')]);_0x415f0f[_0x8773('0x2a')]=_[_0x8773('0x29')](_0x559c48[_0x8773('0x2a')]);_0x415f0f['filters']=_[_0x8773('0x2c')](_0x415f0f[_0x8773('0x28')],_0x415f0f[_0x8773('0x2a')]);_0x466185[_0x8773('0x2d')]=_['intersection'](_0x415f0f[_0x8773('0x28')],qs[_0x8773('0x2e')](_0x559c48[_0x8773('0x2a')][_0x8773('0x2e')]));_0x466185[_0x8773('0x2d')]=_0x466185[_0x8773('0x2d')][_0x8773('0x2f')]?_0x466185[_0x8773('0x2d')]:_0x415f0f['model'];_0x466185[_0x8773('0x44')]=qs[_0x8773('0x31')](_0x559c48[_0x8773('0x2a')][_0x8773('0x31')]);_0x466185['where']=qs[_0x8773('0x2b')](_[_0x8773('0x33')](_0x559c48[_0x8773('0x2a')],_0x415f0f[_0x8773('0x2b')]));if(_0x559c48[_0x8773('0x2a')][_0x8773('0x34')]){_0x466185[_0x8773('0x32')]=_[_0x8773('0x35')](_0x466185[_0x8773('0x32')],{'$or':_[_0x8773('0x23')](_0x466185[_0x8773('0x2d')],function(_0x26a6bc){var _0x508ed6={};_0x508ed6[_0x26a6bc]={'$like':'%'+_0x559c48[_0x8773('0x2a')][_0x8773('0x34')]+'%'};return _0x508ed6;})});}_0x466185=_[_0x8773('0x35')]({},_0x466185,_0x559c48[_0x8773('0x3d')]);return _0x2f2dc9[_0x8773('0x45')](_0x466185);}})[_0x8773('0x1c')](function(_0x236472){if(_0x236472){_0x5cdf58=_0x236472[_0x8773('0x2f')];if(!_0x559c48[_0x8773('0x2a')][_0x8773('0x46')]('nolimit')){_0x466185['limit']=qs[_0x8773('0x16')](_0x559c48[_0x8773('0x2a')][_0x8773('0x16')]);_0x466185[_0x8773('0x14')]=qs[_0x8773('0x14')](_0x559c48[_0x8773('0x2a')]['offset']);}return _0x2f2dc9['getConfigurations'](_0x466185);}})[_0x8773('0x1c')](function(_0x25f40b){if(_0x25f40b){return _0x25f40b?{'count':_0x5cdf58,'rows':_0x25f40b}:null;}})['then'](respondWithResult(_0x41e43e,null))[_0x8773('0x3a')](handleError(_0x41e43e,null));};exports['addConfiguration']=function(_0xf27e6b,_0x10c174,_0x46afc6){if(_0xf27e6b['body']['id']){delete _0xf27e6b[_0x8773('0x40')]['id'];}return db['ZohoAccount'][_0x8773('0x42')]({'where':{'id':_0xf27e6b['params']['id']}})[_0x8773('0x1c')](handleEntityNotFound(_0x10c174,null))[_0x8773('0x1c')](function(_0x1e1f8c){if(_0x1e1f8c){_0xf27e6b['body']['AccountId']=_0x1e1f8c['id'];_0xf27e6b[_0x8773('0x40')][_0x8773('0x47')]=integrations[_0x8773('0x48')](_0xf27e6b[_0x8773('0x40')]['channel'],_0xf27e6b[_0x8773('0x40')][_0x8773('0x26')]);_0xf27e6b[_0x8773('0x40')]['Descriptions']=integrations[_0x8773('0x49')](_0xf27e6b[_0x8773('0x40')][_0x8773('0x4a')],_0xf27e6b[_0x8773('0x40')]['type']);return db[_0x8773('0x43')][_0x8773('0x3f')](_0xf27e6b[_0x8773('0x40')],{'include':[{'model':db[_0x8773('0x4b')],'as':_0x8773('0x47')},{'model':db[_0x8773('0x4b')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x10c174,null))[_0x8773('0x3a')](handleError(_0x10c174,null));};function getAccessToken(_0x4ad777){return new Promise(function(_0x39e714,_0x48e7fa){var _0x1fd463;switch(_0x4ad777[_0x8773('0x4c')]){case'US':_0x1fd463=_0x8773('0x4d');break;case'AU':_0x1fd463=_0x8773('0x4e');break;case'EU':_0x1fd463=_0x8773('0x4f');break;case'IN':_0x1fd463=_0x8773('0x50');break;case'CN':_0x1fd463='https://accounts.zoho.com.cn';break;default:_0x1fd463=_0x8773('0x4f');break;}var _0x5baf18={'method':'POST','uri':_0x1fd463+_0x8773('0x51'),'qs':{'refresh_token':_0x4ad777[_0x8773('0x52')],'client_id':_0x4ad777[_0x8773('0x53')],'client_secret':_0x4ad777[_0x8773('0x54')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5baf18)[_0x8773('0x1c')](function(_0x1a7fba){if(_0x1a7fba[_0x8773('0x55')]){_0x39e714(_0x1a7fba[_0x8773('0x55')]);}else{_0x48e7fa(_0x8773('0x56'));}})[_0x8773('0x3a')](function(_0x598133){_0x48e7fa(_0x598133);});});}exports[_0x8773('0x57')]=function(_0x2ddc0b,_0x2c7bc6,_0x147355){var _0x1c49f6,_0x14eea1,_0x146595,_0x91aa91,_0x2f7095;return db[_0x8773('0x24')][_0x8773('0x42')]({'where':{'id':_0x2ddc0b['params']['id']},'attributes':['id',_0x8773('0x58'),'zone',_0x8773('0x53'),_0x8773('0x54'),_0x8773('0x59'),_0x8773('0x5a'),_0x8773('0x52')]})[_0x8773('0x1c')](handleEntityNotFound(_0x2c7bc6,null))['then'](function(_0x399121){_0x2f7095=_0x399121;_0x1c49f6=_0x2f7095[_0x8773('0x58')];_0x14eea1=_0x1c49f6===_0x8773('0x5b')?'eu':_0x8773('0x5c');_0x146595=_0x2f7095['serverUrl'];var _0x57bd96=_0x146595[_0x8773('0x5d')](-0x1);if(_0x57bd96==='/'||_0x57bd96==='\x5c'||_0x57bd96===':'){_0x146595=_0x146595[_0x8773('0x5e')](0x0,_0x146595[_0x8773('0x5f')](_0x57bd96));}if(!_0x2f7095[_0x8773('0x52')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2f7095);})[_0x8773('0x1c')](function(_0x1f431e){if(_0x1f431e){return rp({'method':_0x8773('0x60'),'uri':util[_0x8773('0x61')](_0x8773('0x62'),_0x14eea1),'qs':{'module':_0x8773('0x63')},'headers':{'Authorization':_0x8773('0x64')+_0x1f431e},'json':!![]});}})[_0x8773('0x1c')](function(_0x290d40){if(_0x290d40){if(_0x290d40[_0x8773('0x65')]&&_0x290d40[_0x8773('0x65')]['error']){throw new Error(_0x290d40[_0x8773('0x65')][_0x8773('0x1f')][_0x8773('0x66')]);}var _0x228a23=[];var _0x1c7de0=[];var _0x539df0=['Owner',_0x8773('0x67'),_0x8773('0x68'),_0x8773('0x69'),_0x8773('0x6a'),_0x8773('0x6b'),_0x8773('0x6c'),_0x8773('0x6d')];_0x1c7de0=_[_0x8773('0x6e')](_0x290d40[_0x8773('0x2e')],function(_0x1677a2){return _0x539df0[_0x8773('0x6f')](_0x1677a2[_0x8773('0x70')]);});for(var _0x56c400=0x0;_0x56c400<_0x1c7de0[_0x8773('0x2f')];_0x56c400++){if(_0x1c7de0[_0x56c400][_0x8773('0x71')]===![]){_0x228a23[_0x8773('0x72')]({'id':_0x1c7de0[_0x56c400]['id'],'name':_0x1c7de0[_0x56c400][_0x8773('0x73')],'custom':_0x1c7de0[_0x56c400][_0x8773('0x74')],'options':_0x1c7de0[_0x56c400][_0x8773('0x75')]==='picklist'&&_0x1c7de0[_0x56c400]['pick_list_values'][_0x8773('0x2f')]>-0x1?_[_0x8773('0x23')](_0x1c7de0[_0x56c400]['pick_list_values'],function(_0x25223d){return{'name':_0x25223d,'value':_0x25223d};}):[]});}}return{'count':_0x228a23[_0x8773('0x2f')],'rows':_0x228a23};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x2c7bc6,null))['catch'](function(_0x5acfca){var _0x5999c6=_0x2ddc0b[_0x8773('0x2a')][_0x8773('0x76')]?0x1f4:_0x5acfca[_0x8773('0x77')]||0x1f4;logger[_0x8773('0x1f')](_0x8773('0x78'),_0x8773('0x57'),_0x5999c6,JSON[_0x8773('0x79')](_0x5acfca));delete _0x5acfca[_0x8773('0x21')];if(_0x5999c6===0x191){_0x5999c6=0x190;}_0x2c7bc6[_0x8773('0x17')](_0x5999c6)[_0x8773('0x22')](_0x2ddc0b[_0x8773('0x2a')][_0x8773('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x5acfca['statusCode']}:_0x5acfca);});};
\ No newline at end of file
index da7fea1..f6ad2b1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7264=['error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.eu','parse','refreshToken','util','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','authorization_code','clientSecret','code','application/x-www-form-urlencoded','then','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name'];(function(_0x3b082f,_0x19c674){var _0x3245c0=function(_0x534675){while(--_0x534675){_0x3b082f['push'](_0x3b082f['shift']());}};_0x3245c0(++_0x19c674);}(_0x7264,0x1b5));var _0x4726=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7264[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x4726('0x0'));var logger=require('../../config/logger')(_0x4726('0x1'));var moment=require(_0x4726('0x2'));var BPromise=require(_0x4726('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4726('0x4'));var rimraf=require(_0x4726('0x5'));var config=require(_0x4726('0x6'));var attributes=require(_0x4726('0x7'));var integrations=require(_0x4726('0x8'));module[_0x4726('0x9')]=function(_0x693ba8,_0x5a3a91){return _0x693ba8[_0x4726('0xa')](_0x4726('0xb'),attributes,{'tableName':_0x4726('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3355af,_0x175d2c,_0x4798eb){if(_0x3355af[_0x4726('0xd')](_0x4726('0xe'))||_0x3355af[_0x4726('0xd')](_0x4726('0xf'))||_0x3355af[_0x4726('0xd')](_0x4726('0x10'))||_0x3355af[_0x4726('0xd')]('clientSecret')||_0x3355af['changed']('code')||_0x3355af['changed'](_0x4726('0x11'))){var _0x58f593,_0x521aef;_0x58f593=_0x3355af[_0x4726('0xf')];var _0x26d16e=_0x58f593[_0x4726('0x12')](-0x1);if(_0x26d16e==='/'||_0x26d16e==='\x5c'||_0x26d16e===':'){_0x58f593=_0x58f593[_0x4726('0x13')](0x0,_0x58f593[_0x4726('0x14')](_0x26d16e));}switch(_0x3355af[_0x4726('0xe')]){case'US':_0x521aef=_0x4726('0x15');break;case'AU':_0x521aef=_0x4726('0x16');break;case'IN':_0x521aef=_0x4726('0x17');break;case'CN':_0x521aef=_0x4726('0x18');break;default:_0x521aef='https://accounts.zoho.eu';break;}var _0x152620={'method':_0x4726('0x19'),'uri':_0x521aef+'/oauth/v2/token','form':{'grant_type':_0x4726('0x1a'),'client_id':_0x3355af[_0x4726('0x10')],'client_secret':_0x3355af[_0x4726('0x1b')],'redirect_uri':_0x3355af[_0x4726('0xf')],'code':_0x3355af[_0x4726('0x1c')]},'headers':{'Content-Type':_0x4726('0x1d')}};return rp(_0x152620)[_0x4726('0x1e')](function(_0x53a382){var _0x1c6a57=JSON['parse'](_0x53a382);if(_0x1c6a57[_0x4726('0x1f')]){_0x3355af['refreshToken']=_0x1c6a57[_0x4726('0x1f')];logger[_0x4726('0x20')](util[_0x4726('0x21')](_0x4726('0x22'),_0x3355af[_0x4726('0x23')],_0x3355af['id']));}else{logger[_0x4726('0x24')](util[_0x4726('0x21')](_0x4726('0x25'),_0x3355af[_0x4726('0x23')],_0x3355af['id']),util[_0x4726('0x26')](_0x1c6a57,{'showHidden':![],'depth':null}));}return _0x4798eb(null,_0x175d2c);})[_0x4726('0x27')](function(_0x11a18a){logger[_0x4726('0x24')](util[_0x4726('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3355af[_0x4726('0x23')],_0x3355af['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4798eb(_0x11a18a);});}else{return _0x4798eb(null,_0x175d2c);}},'beforeUpdate':function(_0x2d7c74,_0x3b9029,_0x3a2edf){if(_0x2d7c74[_0x4726('0xd')](_0x4726('0xe'))||_0x2d7c74[_0x4726('0xd')](_0x4726('0xf'))||_0x2d7c74[_0x4726('0xd')](_0x4726('0x10'))||_0x2d7c74[_0x4726('0xd')]('clientSecret')||_0x2d7c74['changed']('code')||_0x2d7c74[_0x4726('0xd')]('host')){var _0x399603,_0x21af18;_0x399603=_0x2d7c74['serverUrl'];var _0x27e93a=_0x399603[_0x4726('0x12')](-0x1);if(_0x27e93a==='/'||_0x27e93a==='\x5c'||_0x27e93a===':'){_0x399603=_0x399603[_0x4726('0x13')](0x0,_0x399603[_0x4726('0x14')](_0x27e93a));}switch(_0x2d7c74[_0x4726('0xe')]){case'US':_0x21af18=_0x4726('0x15');break;case'AU':_0x21af18='https://accounts.zoho.com.au';break;case'IN':_0x21af18=_0x4726('0x17');break;case'CN':_0x21af18=_0x4726('0x18');break;default:_0x21af18=_0x4726('0x28');break;}var _0x1e6ea1={'method':_0x4726('0x19'),'uri':_0x21af18+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x2d7c74['clientId'],'client_secret':_0x2d7c74[_0x4726('0x1b')],'redirect_uri':_0x2d7c74[_0x4726('0xf')],'code':_0x2d7c74['code']},'headers':{'Content-Type':_0x4726('0x1d')}};return rp(_0x1e6ea1)[_0x4726('0x1e')](function(_0x55bdca){var _0x44c590=JSON[_0x4726('0x29')](_0x55bdca);if(_0x44c590[_0x4726('0x1f')]){_0x2d7c74[_0x4726('0x2a')]=_0x44c590['refresh_token'];logger[_0x4726('0x20')](util[_0x4726('0x21')](_0x4726('0x22'),_0x2d7c74[_0x4726('0x23')],_0x2d7c74['id']));}else{logger[_0x4726('0x24')](util[_0x4726('0x21')](_0x4726('0x25'),_0x2d7c74[_0x4726('0x23')],_0x2d7c74['id']),util[_0x4726('0x26')](_0x44c590,{'showHidden':![],'depth':null}));}return _0x3a2edf(null,_0x3b9029);})[_0x4726('0x27')](function(_0x1fc270){logger[_0x4726('0x24')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2d7c74[_0x4726('0x23')],_0x2d7c74['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x3a2edf(_0x1fc270);});}else{return _0x3a2edf(null,_0x3b9029);}}}});};
\ No newline at end of file
+var _0x1f2b=['substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com','authorization_code','application/x-www-form-urlencoded','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice'];(function(_0x318522,_0x2fdc29){var _0x139e0c=function(_0x2d721a){while(--_0x2d721a){_0x318522['push'](_0x318522['shift']());}};_0x139e0c(++_0x2fdc29);}(_0x1f2b,0x125));var _0xb1f2=function(_0x4092af,_0x7385a4){_0x4092af=_0x4092af-0x0;var _0x851b8a=_0x1f2b[_0x4092af];return _0x851b8a;};'use strict';var _=require(_0xb1f2('0x0'));var util=require(_0xb1f2('0x1'));var logger=require(_0xb1f2('0x2'))(_0xb1f2('0x3'));var moment=require(_0xb1f2('0x4'));var BPromise=require('bluebird');var rp=require(_0xb1f2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb1f2('0x6'));var config=require(_0xb1f2('0x7'));var attributes=require(_0xb1f2('0x8'));var integrations=require(_0xb1f2('0x9'));module[_0xb1f2('0xa')]=function(_0x435c78,_0x10e2c3){return _0x435c78[_0xb1f2('0xb')](_0xb1f2('0xc'),attributes,{'tableName':_0xb1f2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5cab1d,_0x333fb6,_0xb925d0){if(_0x5cab1d[_0xb1f2('0xe')](_0xb1f2('0xf'))||_0x5cab1d[_0xb1f2('0xe')](_0xb1f2('0x10'))||_0x5cab1d[_0xb1f2('0xe')](_0xb1f2('0x11'))||_0x5cab1d[_0xb1f2('0xe')](_0xb1f2('0x12'))||_0x5cab1d['changed'](_0xb1f2('0x13'))||_0x5cab1d['changed'](_0xb1f2('0x14'))){var _0x5a27e3,_0x19797e;_0x5a27e3=_0x5cab1d[_0xb1f2('0x10')];var _0x2ff495=_0x5a27e3[_0xb1f2('0x15')](-0x1);if(_0x2ff495==='/'||_0x2ff495==='\x5c'||_0x2ff495===':'){_0x5a27e3=_0x5a27e3[_0xb1f2('0x16')](0x0,_0x5a27e3[_0xb1f2('0x17')](_0x2ff495));}switch(_0x5cab1d[_0xb1f2('0xf')]){case'US':_0x19797e='https://accounts.zoho.com';break;case'AU':_0x19797e=_0xb1f2('0x18');break;case'IN':_0x19797e=_0xb1f2('0x19');break;case'CN':_0x19797e=_0xb1f2('0x1a');break;default:_0x19797e=_0xb1f2('0x1b');break;}var _0x31de6a={'method':_0xb1f2('0x1c'),'uri':_0x19797e+_0xb1f2('0x1d'),'form':{'grant_type':'authorization_code','client_id':_0x5cab1d[_0xb1f2('0x11')],'client_secret':_0x5cab1d[_0xb1f2('0x12')],'redirect_uri':_0x5cab1d[_0xb1f2('0x10')],'code':_0x5cab1d['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x31de6a)[_0xb1f2('0x1e')](function(_0x235e23){var _0x364859=JSON[_0xb1f2('0x1f')](_0x235e23);if(_0x364859[_0xb1f2('0x20')]){_0x5cab1d[_0xb1f2('0x21')]=_0x364859[_0xb1f2('0x20')];logger[_0xb1f2('0x22')](util[_0xb1f2('0x23')](_0xb1f2('0x24'),_0x5cab1d[_0xb1f2('0x25')],_0x5cab1d['id']));}else{logger[_0xb1f2('0x26')](util[_0xb1f2('0x23')](_0xb1f2('0x27'),_0x5cab1d[_0xb1f2('0x25')],_0x5cab1d['id']),util[_0xb1f2('0x28')](_0x364859,{'showHidden':![],'depth':null}));}return _0xb925d0(null,_0x333fb6);})[_0xb1f2('0x29')](function(_0x5d1874){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5cab1d[_0xb1f2('0x25')],_0x5cab1d['id']),util[_0xb1f2('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0xb925d0(_0x5d1874);});}else{return _0xb925d0(null,_0x333fb6);}},'beforeUpdate':function(_0x4f2505,_0x49d184,_0x13039f){if(_0x4f2505['changed']('zone')||_0x4f2505[_0xb1f2('0xe')](_0xb1f2('0x10'))||_0x4f2505['changed']('clientId')||_0x4f2505[_0xb1f2('0xe')]('clientSecret')||_0x4f2505[_0xb1f2('0xe')](_0xb1f2('0x13'))||_0x4f2505['changed']('host')){var _0x4c5b55,_0x53024a;_0x4c5b55=_0x4f2505[_0xb1f2('0x10')];var _0x227aad=_0x4c5b55[_0xb1f2('0x15')](-0x1);if(_0x227aad==='/'||_0x227aad==='\x5c'||_0x227aad===':'){_0x4c5b55=_0x4c5b55[_0xb1f2('0x16')](0x0,_0x4c5b55['lastIndexOf'](_0x227aad));}switch(_0x4f2505[_0xb1f2('0xf')]){case'US':_0x53024a=_0xb1f2('0x2a');break;case'AU':_0x53024a='https://accounts.zoho.com.au';break;case'IN':_0x53024a=_0xb1f2('0x19');break;case'CN':_0x53024a=_0xb1f2('0x1a');break;default:_0x53024a=_0xb1f2('0x1b');break;}var _0x59facc={'method':_0xb1f2('0x1c'),'uri':_0x53024a+_0xb1f2('0x1d'),'form':{'grant_type':_0xb1f2('0x2b'),'client_id':_0x4f2505[_0xb1f2('0x11')],'client_secret':_0x4f2505['clientSecret'],'redirect_uri':_0x4f2505['serverUrl'],'code':_0x4f2505[_0xb1f2('0x13')]},'headers':{'Content-Type':_0xb1f2('0x2c')}};return rp(_0x59facc)[_0xb1f2('0x1e')](function(_0xf4f1e){var _0xdcfc74=JSON['parse'](_0xf4f1e);if(_0xdcfc74[_0xb1f2('0x20')]){_0x4f2505[_0xb1f2('0x21')]=_0xdcfc74[_0xb1f2('0x20')];logger[_0xb1f2('0x22')](util[_0xb1f2('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4f2505[_0xb1f2('0x25')],_0x4f2505['id']));}else{logger[_0xb1f2('0x26')](util['format'](_0xb1f2('0x27'),_0x4f2505[_0xb1f2('0x25')],_0x4f2505['id']),util[_0xb1f2('0x28')](_0xdcfc74,{'showHidden':![],'depth':null}));}return _0x13039f(null,_0x49d184);})[_0xb1f2('0x29')](function(_0x3ae26c){logger[_0xb1f2('0x26')](util[_0xb1f2('0x23')](_0xb1f2('0x27'),_0x4f2505[_0xb1f2('0x25')],_0x4f2505['id']),util[_0xb1f2('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x13039f(_0x3ae26c);});}else{return _0x13039f(null,_0x49d184);}}}});};
\ No newline at end of file
index 740019b..5a4568a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfe39=['GetZohoAccount','findAll','options','where','attributes','limit','include','map','model','debug','stringify','ZohoAccount','find','raw','ShowZohoAccount','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0xc5a3be,_0x1ecbd8){var _0x12a926=function(_0x2b161b){while(--_0x2b161b){_0xc5a3be['push'](_0xc5a3be['shift']());}};_0x12a926(++_0x1ecbd8);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xfe39[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x9fe3('0x0'));var util=require(_0x9fe3('0x1'));var moment=require('moment');var BPromise=require(_0x9fe3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fe3('0x3'))['db'];var utils=require(_0x9fe3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9fe3('0x5'));var jayson=require(_0x9fe3('0x6'));var client=jayson[_0x9fe3('0x7')][_0x9fe3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc469b7,_0x4183ce,_0x25868f){return new BPromise(function(_0x5a3bd6,_0x211eb2){return client[_0x9fe3('0x9')](_0xc469b7,_0x25868f)[_0x9fe3('0xa')](function(_0x35c391){logger[_0x9fe3('0xb')](_0x9fe3('0xc'),_0x4183ce,'request\x20sent');logger['debug'](_0x9fe3('0xd'),_0x4183ce,_0x9fe3('0xe'),JSON['stringify'](_0x35c391));if(_0x35c391[_0x9fe3('0xf')]){if(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x10')]===0x1f4){logger[_0x9fe3('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x4183ce,_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);return _0x211eb2(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x4183ce,_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);return _0x5a3bd6(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);}else{logger[_0x9fe3('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x4183ce,'request\x20sent');_0x5a3bd6(_0x35c391[_0x9fe3('0x12')][_0x9fe3('0x11')]);}})[_0x9fe3('0x13')](function(_0x2d28d4){logger['error'](_0x9fe3('0xc'),_0x4183ce,_0x2d28d4);_0x211eb2(_0x2d28d4);});});}exports[_0x9fe3('0x14')]=function(_0x15fcaa){var _0x592b8b=this;return new Promise(function(_0x35bbaf,_0x43854c){return db['ZohoAccount'][_0x9fe3('0x15')]({'raw':_0x15fcaa['options']?_0x15fcaa[_0x9fe3('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x15fcaa[_0x9fe3('0x16')]?_0x15fcaa[_0x9fe3('0x16')][_0x9fe3('0x17')]||null:null,'attributes':_0x15fcaa['options']?_0x15fcaa['options'][_0x9fe3('0x18')]||null:null,'limit':_0x15fcaa[_0x9fe3('0x16')]?_0x15fcaa['options'][_0x9fe3('0x19')]||null:null,'include':_0x15fcaa[_0x9fe3('0x16')]?_0x15fcaa['options'][_0x9fe3('0x1a')]?_[_0x9fe3('0x1b')](_0x15fcaa['options'][_0x9fe3('0x1a')],function(_0x2fb7a9){return{'model':db[_0x2fb7a9[_0x9fe3('0x1c')]],'as':_0x2fb7a9['as'],'attributes':_0x2fb7a9[_0x9fe3('0x18')],'include':_0x2fb7a9[_0x9fe3('0x1a')]?_[_0x9fe3('0x1b')](_0x2fb7a9[_0x9fe3('0x1a')],function(_0x4c1a30){return{'model':db[_0x4c1a30[_0x9fe3('0x1c')]],'as':_0x4c1a30['as'],'attributes':_0x4c1a30[_0x9fe3('0x18')],'include':_0x4c1a30[_0x9fe3('0x1a')]?_[_0x9fe3('0x1b')](_0x4c1a30['include'],function(_0x1a4a43){return{'model':db[_0x1a4a43[_0x9fe3('0x1c')]],'as':_0x1a4a43['as'],'attributes':_0x1a4a43[_0x9fe3('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14ee5b){logger[_0x9fe3('0xb')](_0x9fe3('0x14'),_0x15fcaa);logger[_0x9fe3('0x1d')](_0x9fe3('0x14'),_0x15fcaa,JSON[_0x9fe3('0x1e')](_0x14ee5b));_0x35bbaf(_0x14ee5b);})['catch'](function(_0xa4d56e){logger[_0x9fe3('0xf')](_0x9fe3('0x14'),_0xa4d56e[_0x9fe3('0x11')],_0x15fcaa);_0x43854c(_0x592b8b[_0x9fe3('0xf')](0x1f4,_0xa4d56e[_0x9fe3('0x11')]));});});};exports['ShowZohoAccount']=function(_0x40a778){var _0x298318=this;return new Promise(function(_0x5e1620,_0x2a388d){return db[_0x9fe3('0x1f')][_0x9fe3('0x20')]({'raw':_0x40a778[_0x9fe3('0x16')]?_0x40a778[_0x9fe3('0x16')][_0x9fe3('0x21')]===undefined?!![]:![]:!![],'where':_0x40a778['options']?_0x40a778[_0x9fe3('0x16')][_0x9fe3('0x17')]||null:null,'attributes':_0x40a778[_0x9fe3('0x16')]?_0x40a778['options']['attributes']||null:null,'include':_0x40a778['options']?_0x40a778[_0x9fe3('0x16')]['include']?_[_0x9fe3('0x1b')](_0x40a778[_0x9fe3('0x16')][_0x9fe3('0x1a')],function(_0xa3f363){return{'model':db[_0xa3f363[_0x9fe3('0x1c')]],'as':_0xa3f363['as'],'attributes':_0xa3f363[_0x9fe3('0x18')],'include':_0xa3f363[_0x9fe3('0x1a')]?_[_0x9fe3('0x1b')](_0xa3f363[_0x9fe3('0x1a')],function(_0x49f95f){return{'model':db[_0x49f95f[_0x9fe3('0x1c')]],'as':_0x49f95f['as'],'attributes':_0x49f95f['attributes'],'include':_0x49f95f['include']?_[_0x9fe3('0x1b')](_0x49f95f[_0x9fe3('0x1a')],function(_0x12ae18){return{'model':db[_0x12ae18[_0x9fe3('0x1c')]],'as':_0x12ae18['as'],'attributes':_0x12ae18['attributes']};}):[]};}):[]};}):[]:[]})[_0x9fe3('0xa')](function(_0xa7aaf5){logger[_0x9fe3('0xb')]('ShowZohoAccount',_0x40a778);logger[_0x9fe3('0x1d')](_0x9fe3('0x22'),_0x40a778,JSON[_0x9fe3('0x1e')](_0xa7aaf5));_0x5e1620(_0xa7aaf5);})[_0x9fe3('0x13')](function(_0x52b828){logger[_0x9fe3('0xf')](_0x9fe3('0x22'),_0x52b828['message'],_0x40a778);_0x2a388d(_0x298318['error'](0x1f4,_0x52b828[_0x9fe3('0x11')]));});});};
\ No newline at end of file
+var _0xb96d=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','findAll','raw','options','where','include','map','attributes','model','debug','GetZohoAccount','ShowZohoAccount','util','moment'];(function(_0x1c568d,_0x39978d){var _0x4bc7b0=function(_0x1f1ec1){while(--_0x1f1ec1){_0x1c568d['push'](_0x1c568d['shift']());}};_0x4bc7b0(++_0x39978d);}(_0xb96d,0x9e));var _0xdb96=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xb96d[_0x5783f4];return _0x28e380;};'use strict';var _=require('lodash');var util=require(_0xdb96('0x0'));var moment=require(_0xdb96('0x1'));var BPromise=require(_0xdb96('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb96('0x3'));var db=require(_0xdb96('0x4'))['db'];var utils=require(_0xdb96('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xdb96('0x6'));var jayson=require(_0xdb96('0x7'));var client=jayson[_0xdb96('0x8')][_0xdb96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f5e6f,_0x294084,_0x571e0e){return new BPromise(function(_0x5e2e95,_0x3384b4){return client['request'](_0x4f5e6f,_0x571e0e)[_0xdb96('0xa')](function(_0xaea492){logger['info'](_0xdb96('0xb'),_0x294084,_0xdb96('0xc'));logger['debug'](_0xdb96('0xd'),_0x294084,_0xdb96('0xc'),JSON[_0xdb96('0xe')](_0xaea492));if(_0xaea492[_0xdb96('0xf')]){if(_0xaea492['error'][_0xdb96('0x10')]===0x1f4){logger[_0xdb96('0xf')](_0xdb96('0xb'),_0x294084,_0xaea492['error'][_0xdb96('0x11')]);return _0x3384b4(_0xaea492[_0xdb96('0xf')][_0xdb96('0x11')]);}logger[_0xdb96('0xf')](_0xdb96('0xb'),_0x294084,_0xaea492[_0xdb96('0xf')][_0xdb96('0x11')]);return _0x5e2e95(_0xaea492[_0xdb96('0xf')][_0xdb96('0x11')]);}else{logger[_0xdb96('0x12')](_0xdb96('0xb'),_0x294084,_0xdb96('0xc'));_0x5e2e95(_0xaea492[_0xdb96('0x13')]['message']);}})[_0xdb96('0x14')](function(_0x2a766e){logger[_0xdb96('0xf')](_0xdb96('0xb'),_0x294084,_0x2a766e);_0x3384b4(_0x2a766e);});});}exports['GetZohoAccount']=function(_0x27fa8e){var _0x33ec8f=this;return new Promise(function(_0x244f66,_0x5946d5){return db['ZohoAccount'][_0xdb96('0x15')]({'raw':_0x27fa8e['options']?_0x27fa8e['options'][_0xdb96('0x16')]===undefined?!![]:![]:!![],'where':_0x27fa8e[_0xdb96('0x17')]?_0x27fa8e[_0xdb96('0x17')][_0xdb96('0x18')]||null:null,'attributes':_0x27fa8e['options']?_0x27fa8e[_0xdb96('0x17')]['attributes']||null:null,'limit':_0x27fa8e[_0xdb96('0x17')]?_0x27fa8e[_0xdb96('0x17')]['limit']||null:null,'include':_0x27fa8e[_0xdb96('0x17')]?_0x27fa8e[_0xdb96('0x17')][_0xdb96('0x19')]?_[_0xdb96('0x1a')](_0x27fa8e[_0xdb96('0x17')][_0xdb96('0x19')],function(_0x25834a){return{'model':db[_0x25834a['model']],'as':_0x25834a['as'],'attributes':_0x25834a[_0xdb96('0x1b')],'include':_0x25834a[_0xdb96('0x19')]?_[_0xdb96('0x1a')](_0x25834a['include'],function(_0x302596){return{'model':db[_0x302596[_0xdb96('0x1c')]],'as':_0x302596['as'],'attributes':_0x302596[_0xdb96('0x1b')],'include':_0x302596[_0xdb96('0x19')]?_[_0xdb96('0x1a')](_0x302596[_0xdb96('0x19')],function(_0x1ef903){return{'model':db[_0x1ef903[_0xdb96('0x1c')]],'as':_0x1ef903['as'],'attributes':_0x1ef903[_0xdb96('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e9c4e){logger[_0xdb96('0x12')]('GetZohoAccount',_0x27fa8e);logger[_0xdb96('0x1d')](_0xdb96('0x1e'),_0x27fa8e,JSON['stringify'](_0x3e9c4e));_0x244f66(_0x3e9c4e);})[_0xdb96('0x14')](function(_0x118a43){logger[_0xdb96('0xf')](_0xdb96('0x1e'),_0x118a43[_0xdb96('0x11')],_0x27fa8e);_0x5946d5(_0x33ec8f[_0xdb96('0xf')](0x1f4,_0x118a43[_0xdb96('0x11')]));});});};exports['ShowZohoAccount']=function(_0x37c180){var _0xe1f111=this;return new Promise(function(_0x3d7704,_0x44ae9c){return db['ZohoAccount']['find']({'raw':_0x37c180[_0xdb96('0x17')]?_0x37c180[_0xdb96('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x37c180[_0xdb96('0x17')]?_0x37c180['options']['where']||null:null,'attributes':_0x37c180['options']?_0x37c180['options'][_0xdb96('0x1b')]||null:null,'include':_0x37c180['options']?_0x37c180['options'][_0xdb96('0x19')]?_[_0xdb96('0x1a')](_0x37c180[_0xdb96('0x17')][_0xdb96('0x19')],function(_0x4a5933){return{'model':db[_0x4a5933[_0xdb96('0x1c')]],'as':_0x4a5933['as'],'attributes':_0x4a5933[_0xdb96('0x1b')],'include':_0x4a5933[_0xdb96('0x19')]?_[_0xdb96('0x1a')](_0x4a5933[_0xdb96('0x19')],function(_0x5a07de){return{'model':db[_0x5a07de[_0xdb96('0x1c')]],'as':_0x5a07de['as'],'attributes':_0x5a07de[_0xdb96('0x1b')],'include':_0x5a07de[_0xdb96('0x19')]?_[_0xdb96('0x1a')](_0x5a07de[_0xdb96('0x19')],function(_0x5aad1f){return{'model':db[_0x5aad1f[_0xdb96('0x1c')]],'as':_0x5aad1f['as'],'attributes':_0x5aad1f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5dff49){logger[_0xdb96('0x12')](_0xdb96('0x1f'),_0x37c180);logger[_0xdb96('0x1d')](_0xdb96('0x1f'),_0x37c180,JSON['stringify'](_0x5dff49));_0x3d7704(_0x5dff49);})[_0xdb96('0x14')](function(_0x496dcf){logger['error'](_0xdb96('0x1f'),_0x496dcf[_0xdb96('0x11')],_0x37c180);_0x44ae9c(_0xe1f111[_0xdb96('0xf')](0x1f4,_0x496dcf[_0xdb96('0x11')]));});});};
\ No newline at end of file
index a883cf4..e7610c7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2c67=['post','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getDescriptions'];(function(_0x23607f,_0x51db51){var _0x5a5be0=function(_0x22223e){while(--_0x22223e){_0x23607f['push'](_0x23607f['shift']());}};_0x5a5be0(++_0x51db51);}(_0x2c67,0x109));var _0x72c6=function(_0x4f17a7,_0x11e429){_0x4f17a7=_0x4f17a7-0x0;var _0xf66de5=_0x2c67[_0x4f17a7];return _0xf66de5;};'use strict';var multer=require(_0x72c6('0x0'));var util=require(_0x72c6('0x1'));var path=require('path');var timeout=require(_0x72c6('0x2'));var express=require(_0x72c6('0x3'));var router=express['Router']();var fs_extra=require(_0x72c6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x72c6('0x5'));var config=require(_0x72c6('0x6'));var controller=require(_0x72c6('0x7'));router[_0x72c6('0x8')]('/',auth[_0x72c6('0x9')](),controller['index']);router['get'](_0x72c6('0xa'),auth[_0x72c6('0x9')](),controller[_0x72c6('0xb')]);router[_0x72c6('0x8')](_0x72c6('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x72c6('0x8')](_0x72c6('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x72c6('0x8')]('/:id/descriptions',auth[_0x72c6('0x9')](),controller[_0x72c6('0xe')]);router[_0x72c6('0xf')]('/',auth[_0x72c6('0x9')](),controller['create']);router[_0x72c6('0x10')](_0x72c6('0xa'),auth[_0x72c6('0x9')](),controller[_0x72c6('0x11')]);router[_0x72c6('0x12')]('/:id',auth[_0x72c6('0x9')](),controller[_0x72c6('0x13')]);module['exports']=router;
\ No newline at end of file
+var _0x7e75=['show','/:id/fields','getSubjects','getDescriptions','post','create','put','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x5ed32c,_0x956025){var _0x271ea3=function(_0x206a21){while(--_0x206a21){_0x5ed32c['push'](_0x5ed32c['shift']());}};_0x271ea3(++_0x956025);}(_0x7e75,0x88));var _0x57e7=function(_0x4a0324,_0x438fa1){_0x4a0324=_0x4a0324-0x0;var _0x3cd3e0=_0x7e75[_0x4a0324];return _0x3cd3e0;};'use strict';var multer=require(_0x57e7('0x0'));var util=require('util');var path=require(_0x57e7('0x1'));var timeout=require('connect-timeout');var express=require(_0x57e7('0x2'));var router=express[_0x57e7('0x3')]();var fs_extra=require(_0x57e7('0x4'));var auth=require(_0x57e7('0x5'));var interaction=require(_0x57e7('0x6'));var config=require(_0x57e7('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x57e7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x57e7('0x8')](_0x57e7('0x9'),auth[_0x57e7('0xa')](),controller[_0x57e7('0xb')]);router['get'](_0x57e7('0xc'),auth[_0x57e7('0xa')](),controller['getFields']);router[_0x57e7('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x57e7('0xd')]);router[_0x57e7('0x8')]('/:id/descriptions',auth[_0x57e7('0xa')](),controller[_0x57e7('0xe')]);router[_0x57e7('0xf')]('/',auth[_0x57e7('0xa')](),controller[_0x57e7('0x10')]);router[_0x57e7('0x11')](_0x57e7('0x9'),auth[_0x57e7('0xa')](),controller[_0x57e7('0x12')]);router[_0x57e7('0x13')](_0x57e7('0x9'),auth[_0x57e7('0xa')](),controller['destroy']);module[_0x57e7('0x14')]=router;
\ No newline at end of file
index a77188f..2107a75 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2937=['nothing','contact_lead','sequelize','exports','STRING','ENUM','lead','contact'];(function(_0x4211bb,_0x424082){var _0x36d8e8=function(_0x8665dc){while(--_0x8665dc){_0x4211bb['push'](_0x4211bb['shift']());}};_0x36d8e8(++_0x424082);}(_0x2937,0x1ba));var _0x7293=function(_0x3ae39f,_0x4b8e3a){_0x3ae39f=_0x3ae39f-0x0;var _0xb0edc8=_0x2937[_0x3ae39f];return _0xb0edc8;};'use strict';var Sequelize=require(_0x7293('0x0'));module[_0x7293('0x1')]={'name':{'type':Sequelize[_0x7293('0x2')]},'moduleCreate':{'type':Sequelize[_0x7293('0x3')](_0x7293('0x4'),_0x7293('0x5'),_0x7293('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x7293('0x3')](_0x7293('0x7'),'contact',_0x7293('0x4')),'defaultValue':_0x7293('0x7')},'description':{'type':Sequelize[_0x7293('0x2')]}};
\ No newline at end of file
+var _0x9ff0=['nothing','contact_lead','sequelize','exports','lead','contact'];(function(_0x4e7b22,_0x21ead6){var _0x55c213=function(_0xb6b627){while(--_0xb6b627){_0x4e7b22['push'](_0x4e7b22['shift']());}};_0x55c213(++_0x21ead6);}(_0x9ff0,0x15e));var _0x09ff=function(_0x4e2abb,_0xe97c0b){_0x4e2abb=_0x4e2abb-0x0;var _0xeb1c7f=_0x9ff0[_0x4e2abb];return _0xeb1c7f;};'use strict';var Sequelize=require(_0x09ff('0x0'));module[_0x09ff('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0x09ff('0x2'),_0x09ff('0x3'),_0x09ff('0x4')),'defaultValue':_0x09ff('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x09ff('0x5'),_0x09ff('0x3'),'lead'),'defaultValue':_0x09ff('0x5')},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index d69bb04..2b2158e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2cbb=['stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','findOne','getFields','nolimit','getSubjects','ZohoField','pick','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','count','status','Content-Range','apply','reject','save','update','destroy','then','error'];(function(_0x2d0b84,_0x34682d){var _0x8d0088=function(_0x25a584){while(--_0x25a584){_0x2d0b84['push'](_0x2d0b84['shift']());}};_0x8d0088(++_0x34682d);}(_0x2cbb,0x1c3));var _0xb2cb=function(_0x6dc241,_0x3d6db7){_0x6dc241=_0x6dc241-0x0;var _0xac50e7=_0x2cbb[_0x6dc241];return _0xac50e7;};'use strict';var emlformat=require(_0xb2cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb2cb('0x1'));var jsonpatch=require(_0xb2cb('0x2'));var rp=require(_0xb2cb('0x3'));var moment=require(_0xb2cb('0x4'));var BPromise=require(_0xb2cb('0x5'));var Mustache=require(_0xb2cb('0x6'));var util=require(_0xb2cb('0x7'));var path=require('path');var sox=require(_0xb2cb('0x8'));var csv=require(_0xb2cb('0x9'));var ejs=require(_0xb2cb('0xa'));var fs=require('fs');var fs_extra=require(_0xb2cb('0xb'));var _=require(_0xb2cb('0xc'));var squel=require('squel');var crypto=require(_0xb2cb('0xd'));var jsforce=require(_0xb2cb('0xe'));var deskjs=require(_0xb2cb('0xf'));var toCsv=require(_0xb2cb('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb2cb('0x10'));var authService=require(_0xb2cb('0x11'));var qs=require(_0xb2cb('0x12'));var as=require(_0xb2cb('0x13'));var hardwareService=require(_0xb2cb('0x14'));var logger=require(_0xb2cb('0x15'))(_0xb2cb('0x16'));var utils=require(_0xb2cb('0x17'));var config=require(_0xb2cb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb2cb('0x19'))['db'];function respondWithStatusCode(_0x54d3d3,_0x3c5bad){_0x3c5bad=_0x3c5bad||0xcc;return function(_0x5a466c){if(_0x5a466c){return _0x54d3d3[_0xb2cb('0x1a')](_0x3c5bad);}return _0x54d3d3['status'](_0x3c5bad)[_0xb2cb('0x1b')]();};}function respondWithResult(_0x5d4387,_0x7da0ef){_0x7da0ef=_0x7da0ef||0xc8;return function(_0xf2461b){if(_0xf2461b){return _0x5d4387['status'](_0x7da0ef)[_0xb2cb('0x1c')](_0xf2461b);}};}function respondWithFilteredResult(_0x2cdb81,_0x26e20f){return function(_0xad38c5){if(_0xad38c5){var _0x612ca9=typeof _0x26e20f[_0xb2cb('0x1d')]==='undefined'&&typeof _0x26e20f[_0xb2cb('0x1e')]==='undefined';var _0x3ca738=_0xad38c5[_0xb2cb('0x1f')];var _0x4a8a2e=_0x612ca9?0x0:_0x26e20f[_0xb2cb('0x1d')];var _0x2ee8f6=_0x612ca9?_0xad38c5[_0xb2cb('0x1f')]:_0x26e20f[_0xb2cb('0x1d')]+_0x26e20f[_0xb2cb('0x1e')];var _0x3b43dc;if(_0x2ee8f6>=_0x3ca738){_0x2ee8f6=_0x3ca738;_0x3b43dc=0xc8;}else{_0x3b43dc=0xce;}_0x2cdb81[_0xb2cb('0x20')](_0x3b43dc);return _0x2cdb81['set'](_0xb2cb('0x21'),_0x4a8a2e+'-'+_0x2ee8f6+'/'+_0x3ca738)[_0xb2cb('0x1c')](_0xad38c5);}return null;};}function patchUpdates(_0x4b1ab1){return function(_0x2b46e7){try{jsonpatch[_0xb2cb('0x22')](_0x2b46e7,_0x4b1ab1,!![]);}catch(_0x4081c1){return BPromise[_0xb2cb('0x23')](_0x4081c1);}return _0x2b46e7[_0xb2cb('0x24')]();};}function saveUpdates(_0x37aac6,_0x490437){return function(_0x537d7c){if(_0x537d7c){return _0x537d7c[_0xb2cb('0x25')](_0x37aac6)['then'](function(_0x116c5e){return _0x116c5e;});}return null;};}function removeEntity(_0x2e75ed,_0xe5dc73){return function(_0x14f2fa){if(_0x14f2fa){return _0x14f2fa[_0xb2cb('0x26')]()[_0xb2cb('0x27')](function(){_0x2e75ed[_0xb2cb('0x20')](0xcc)[_0xb2cb('0x1b')]();});}};}function handleEntityNotFound(_0x5b813a,_0x5997ac){return function(_0x40d714){if(!_0x40d714){_0x5b813a[_0xb2cb('0x1a')](0x194);}return _0x40d714;};}function handleError(_0x2fddfe,_0x4e9aa8){_0x4e9aa8=_0x4e9aa8||0x1f4;return function(_0x537e34){logger[_0xb2cb('0x28')](_0x537e34[_0xb2cb('0x29')]);if(_0x537e34[_0xb2cb('0x2a')]){delete _0x537e34[_0xb2cb('0x2a')];}_0x2fddfe[_0xb2cb('0x20')](_0x4e9aa8)[_0xb2cb('0x2b')](_0x537e34);};}exports[_0xb2cb('0x2c')]=function(_0x426d3,_0x3e6c4a){var _0x25b0d2={},_0x286acf={},_0x557534={'count':0x0,'rows':[]};var _0x2f7918=_[_0xb2cb('0x2d')](db[_0xb2cb('0x2e')][_0xb2cb('0x2f')],function(_0x1c3dbd){return{'name':_0x1c3dbd[_0xb2cb('0x30')],'type':_0x1c3dbd[_0xb2cb('0x31')][_0xb2cb('0x32')]};});_0x286acf[_0xb2cb('0x33')]=_['map'](_0x2f7918,_0xb2cb('0x2a'));_0x286acf['query']=_[_0xb2cb('0x34')](_0x426d3['query']);_0x286acf[_0xb2cb('0x35')]=_['intersection'](_0x286acf[_0xb2cb('0x33')],_0x286acf[_0xb2cb('0x36')]);_0x25b0d2[_0xb2cb('0x37')]=_[_0xb2cb('0x38')](_0x286acf[_0xb2cb('0x33')],qs[_0xb2cb('0x39')](_0x426d3[_0xb2cb('0x36')][_0xb2cb('0x39')]));_0x25b0d2[_0xb2cb('0x37')]=_0x25b0d2[_0xb2cb('0x37')][_0xb2cb('0x3a')]?_0x25b0d2[_0xb2cb('0x37')]:_0x286acf[_0xb2cb('0x33')];if(!_0x426d3[_0xb2cb('0x36')][_0xb2cb('0x3b')]('nolimit')){_0x25b0d2[_0xb2cb('0x1e')]=qs['limit'](_0x426d3['query'][_0xb2cb('0x1e')]);_0x25b0d2['offset']=qs[_0xb2cb('0x1d')](_0x426d3[_0xb2cb('0x36')]['offset']);}_0x25b0d2[_0xb2cb('0x3c')]=qs[_0xb2cb('0x3d')](_0x426d3['query'][_0xb2cb('0x3d')]);_0x25b0d2[_0xb2cb('0x3e')]=qs['filters'](_['pick'](_0x426d3['query'],_0x286acf[_0xb2cb('0x35')]),_0x2f7918);if(_0x426d3[_0xb2cb('0x36')][_0xb2cb('0x3f')]){_0x25b0d2[_0xb2cb('0x3e')]=_[_0xb2cb('0x40')](_0x25b0d2[_0xb2cb('0x3e')],{'$or':_[_0xb2cb('0x2d')](_0x2f7918,function(_0xc22739){if(_0xc22739[_0xb2cb('0x31')]!=='VIRTUAL'){var _0x1777ae={};_0x1777ae[_0xc22739['name']]={'$like':'%'+_0x426d3[_0xb2cb('0x36')][_0xb2cb('0x3f')]+'%'};return _0x1777ae;}})});}_0x25b0d2=_['merge']({},_0x25b0d2,_0x426d3[_0xb2cb('0x41')]);var _0x250bbf={'where':_0x25b0d2[_0xb2cb('0x3e')]};return db[_0xb2cb('0x2e')][_0xb2cb('0x1f')](_0x250bbf)[_0xb2cb('0x27')](function(_0x5b3f1b){_0x557534[_0xb2cb('0x1f')]=_0x5b3f1b;if(_0x426d3[_0xb2cb('0x36')][_0xb2cb('0x42')]){_0x25b0d2[_0xb2cb('0x43')]=[{'all':!![]}];}return db[_0xb2cb('0x2e')]['findAll'](_0x25b0d2);})[_0xb2cb('0x27')](function(_0x52514a){_0x557534[_0xb2cb('0x44')]=_0x52514a;return _0x557534;})[_0xb2cb('0x27')](respondWithFilteredResult(_0x3e6c4a,_0x25b0d2))[_0xb2cb('0x45')](handleError(_0x3e6c4a,null));};exports[_0xb2cb('0x46')]=function(_0x35203e,_0x15b923){var _0x5be15b={'raw':![],'where':{'id':_0x35203e[_0xb2cb('0x47')]['id']}},_0x4a397f={};_0x4a397f[_0xb2cb('0x33')]=_['keys'](db[_0xb2cb('0x2e')][_0xb2cb('0x2f')]);_0x4a397f['query']=_[_0xb2cb('0x34')](_0x35203e[_0xb2cb('0x36')]);_0x4a397f[_0xb2cb('0x35')]=_[_0xb2cb('0x38')](_0x4a397f[_0xb2cb('0x33')],_0x4a397f[_0xb2cb('0x36')]);_0x5be15b[_0xb2cb('0x37')]=_[_0xb2cb('0x38')](_0x4a397f['model'],qs['fields'](_0x35203e['query']['fields']));_0x5be15b[_0xb2cb('0x37')]=_0x5be15b[_0xb2cb('0x37')][_0xb2cb('0x3a')]?_0x5be15b[_0xb2cb('0x37')]:_0x4a397f[_0xb2cb('0x33')];if(_0x35203e[_0xb2cb('0x36')][_0xb2cb('0x42')]){_0x5be15b['include']=[{'all':!![]}];}_0x5be15b=_[_0xb2cb('0x40')]({},_0x5be15b,_0x35203e[_0xb2cb('0x41')]);return db[_0xb2cb('0x2e')][_0xb2cb('0x48')](_0x5be15b)[_0xb2cb('0x27')](handleEntityNotFound(_0x15b923,null))[_0xb2cb('0x27')](respondWithResult(_0x15b923,null))[_0xb2cb('0x45')](handleError(_0x15b923,null));};exports['create']=function(_0x1cc691,_0x46deb9){return db[_0xb2cb('0x2e')][_0xb2cb('0x49')](_0x1cc691[_0xb2cb('0x4a')],{})['then'](respondWithResult(_0x46deb9,0xc9))[_0xb2cb('0x45')](handleError(_0x46deb9,null));};exports['update']=function(_0x583a01,_0x30f56a){if(_0x583a01[_0xb2cb('0x4a')]['id']){delete _0x583a01['body']['id'];}return db[_0xb2cb('0x2e')][_0xb2cb('0x48')]({'where':{'id':_0x583a01[_0xb2cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x30f56a,null))[_0xb2cb('0x27')](saveUpdates(_0x583a01[_0xb2cb('0x4a')],null))['then'](respondWithResult(_0x30f56a,null))[_0xb2cb('0x45')](handleError(_0x30f56a,null));};exports[_0xb2cb('0x26')]=function(_0x55ed84,_0x516605){return db[_0xb2cb('0x2e')][_0xb2cb('0x48')]({'where':{'id':_0x55ed84['params']['id']}})[_0xb2cb('0x27')](handleEntityNotFound(_0x516605,null))[_0xb2cb('0x27')](removeEntity(_0x516605,null))[_0xb2cb('0x45')](handleError(_0x516605,null));};exports['getFields']=function(_0x353043,_0x44b4e0,_0x25aa96){var _0x3cf2d4={};var _0x1f2ea5={};var _0x28a7aa;var _0x468eff;return db[_0xb2cb('0x2e')][_0xb2cb('0x4b')]({'where':{'id':_0x353043['params']['id']}})[_0xb2cb('0x27')](handleEntityNotFound(_0x44b4e0,null))['then'](function(_0x23179b){if(_0x23179b){_0x28a7aa=_0x23179b;_0x1f2ea5[_0xb2cb('0x33')]=_[_0xb2cb('0x34')](db['ZohoField'][_0xb2cb('0x2f')]);_0x1f2ea5[_0xb2cb('0x36')]=_['keys'](_0x353043[_0xb2cb('0x36')]);_0x1f2ea5[_0xb2cb('0x35')]=_[_0xb2cb('0x38')](_0x1f2ea5[_0xb2cb('0x33')],_0x1f2ea5['query']);_0x3cf2d4[_0xb2cb('0x37')]=_[_0xb2cb('0x38')](_0x1f2ea5[_0xb2cb('0x33')],qs[_0xb2cb('0x39')](_0x353043[_0xb2cb('0x36')]['fields']));_0x3cf2d4[_0xb2cb('0x37')]=_0x3cf2d4[_0xb2cb('0x37')][_0xb2cb('0x3a')]?_0x3cf2d4[_0xb2cb('0x37')]:_0x1f2ea5[_0xb2cb('0x33')];_0x3cf2d4[_0xb2cb('0x3c')]=qs[_0xb2cb('0x3d')](_0x353043[_0xb2cb('0x36')]['sort']);_0x3cf2d4[_0xb2cb('0x3e')]=qs[_0xb2cb('0x35')](_['pick'](_0x353043[_0xb2cb('0x36')],_0x1f2ea5[_0xb2cb('0x35')]));if(_0x353043['query'][_0xb2cb('0x3f')]){_0x3cf2d4[_0xb2cb('0x3e')]=_[_0xb2cb('0x40')](_0x3cf2d4[_0xb2cb('0x3e')],{'$or':_[_0xb2cb('0x2d')](_0x3cf2d4[_0xb2cb('0x37')],function(_0x1896e0){var _0x207ac6={};_0x207ac6[_0x1896e0]={'$like':'%'+_0x353043[_0xb2cb('0x36')][_0xb2cb('0x3f')]+'%'};return _0x207ac6;})});}_0x3cf2d4=_['merge']({},_0x3cf2d4,_0x353043[_0xb2cb('0x41')]);return _0x28a7aa[_0xb2cb('0x4c')](_0x3cf2d4);}})[_0xb2cb('0x27')](function(_0x2f7924){if(_0x2f7924){_0x468eff=_0x2f7924[_0xb2cb('0x3a')];if(!_0x353043[_0xb2cb('0x36')][_0xb2cb('0x3b')](_0xb2cb('0x4d'))){_0x3cf2d4['limit']=qs[_0xb2cb('0x1e')](_0x353043[_0xb2cb('0x36')][_0xb2cb('0x1e')]);_0x3cf2d4[_0xb2cb('0x1d')]=qs['offset'](_0x353043[_0xb2cb('0x36')][_0xb2cb('0x1d')]);}return _0x28a7aa[_0xb2cb('0x4c')](_0x3cf2d4);}})[_0xb2cb('0x27')](function(_0x332995){if(_0x332995){return _0x332995?{'count':_0x468eff,'rows':_0x332995}:null;}})[_0xb2cb('0x27')](respondWithResult(_0x44b4e0,null))[_0xb2cb('0x45')](handleError(_0x44b4e0,null));};exports[_0xb2cb('0x4e')]=function(_0x4358ac,_0x1c6e74,_0x48189f){var _0x1cbd32={};var _0x254791={};var _0x3d2eb2;var _0x3dd986;return db['ZohoConfiguration'][_0xb2cb('0x4b')]({'where':{'id':_0x4358ac[_0xb2cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c6e74,null))[_0xb2cb('0x27')](function(_0x426044){if(_0x426044){_0x3d2eb2=_0x426044;_0x254791[_0xb2cb('0x33')]=_[_0xb2cb('0x34')](db[_0xb2cb('0x4f')][_0xb2cb('0x2f')]);_0x254791['query']=_[_0xb2cb('0x34')](_0x4358ac[_0xb2cb('0x36')]);_0x254791[_0xb2cb('0x35')]=_[_0xb2cb('0x38')](_0x254791[_0xb2cb('0x33')],_0x254791[_0xb2cb('0x36')]);_0x1cbd32['attributes']=_[_0xb2cb('0x38')](_0x254791[_0xb2cb('0x33')],qs[_0xb2cb('0x39')](_0x4358ac[_0xb2cb('0x36')]['fields']));_0x1cbd32[_0xb2cb('0x37')]=_0x1cbd32[_0xb2cb('0x37')][_0xb2cb('0x3a')]?_0x1cbd32['attributes']:_0x254791['model'];_0x1cbd32['order']=qs[_0xb2cb('0x3d')](_0x4358ac[_0xb2cb('0x36')]['sort']);_0x1cbd32[_0xb2cb('0x3e')]=qs[_0xb2cb('0x35')](_[_0xb2cb('0x50')](_0x4358ac[_0xb2cb('0x36')],_0x254791[_0xb2cb('0x35')]));if(_0x4358ac[_0xb2cb('0x36')][_0xb2cb('0x3f')]){_0x1cbd32[_0xb2cb('0x3e')]=_[_0xb2cb('0x40')](_0x1cbd32['where'],{'$or':_['map'](_0x1cbd32[_0xb2cb('0x37')],function(_0xaf8dbb){var _0x545cb9={};_0x545cb9[_0xaf8dbb]={'$like':'%'+_0x4358ac[_0xb2cb('0x36')][_0xb2cb('0x3f')]+'%'};return _0x545cb9;})});}_0x1cbd32=_[_0xb2cb('0x40')]({},_0x1cbd32,_0x4358ac[_0xb2cb('0x41')]);return _0x3d2eb2[_0xb2cb('0x4e')](_0x1cbd32);}})[_0xb2cb('0x27')](function(_0x4878b1){if(_0x4878b1){_0x3dd986=_0x4878b1[_0xb2cb('0x3a')];if(!_0x4358ac[_0xb2cb('0x36')][_0xb2cb('0x3b')]('nolimit')){_0x1cbd32['limit']=qs[_0xb2cb('0x1e')](_0x4358ac[_0xb2cb('0x36')][_0xb2cb('0x1e')]);_0x1cbd32['offset']=qs['offset'](_0x4358ac[_0xb2cb('0x36')][_0xb2cb('0x1d')]);}return _0x3d2eb2['getSubjects'](_0x1cbd32);}})['then'](function(_0x359bd2){if(_0x359bd2){return _0x359bd2?{'count':_0x3dd986,'rows':_0x359bd2}:null;}})[_0xb2cb('0x27')](respondWithResult(_0x1c6e74,null))['catch'](handleError(_0x1c6e74,null));};exports['getDescriptions']=function(_0x477924,_0x92dff1,_0xb0288){var _0x24b7ec={};var _0x604ca2={};var _0x3e6f4f;var _0x5d478f;return db[_0xb2cb('0x2e')][_0xb2cb('0x4b')]({'where':{'id':_0x477924[_0xb2cb('0x47')]['id']}})[_0xb2cb('0x27')](handleEntityNotFound(_0x92dff1,null))[_0xb2cb('0x27')](function(_0x5456f0){if(_0x5456f0){_0x3e6f4f=_0x5456f0;_0x604ca2[_0xb2cb('0x33')]=_[_0xb2cb('0x34')](db[_0xb2cb('0x4f')]['rawAttributes']);_0x604ca2[_0xb2cb('0x36')]=_[_0xb2cb('0x34')](_0x477924['query']);_0x604ca2[_0xb2cb('0x35')]=_[_0xb2cb('0x38')](_0x604ca2[_0xb2cb('0x33')],_0x604ca2[_0xb2cb('0x36')]);_0x24b7ec[_0xb2cb('0x37')]=_[_0xb2cb('0x38')](_0x604ca2['model'],qs[_0xb2cb('0x39')](_0x477924['query'][_0xb2cb('0x39')]));_0x24b7ec[_0xb2cb('0x37')]=_0x24b7ec[_0xb2cb('0x37')][_0xb2cb('0x3a')]?_0x24b7ec['attributes']:_0x604ca2[_0xb2cb('0x33')];_0x24b7ec[_0xb2cb('0x3c')]=qs[_0xb2cb('0x3d')](_0x477924['query'][_0xb2cb('0x3d')]);_0x24b7ec[_0xb2cb('0x3e')]=qs[_0xb2cb('0x35')](_[_0xb2cb('0x50')](_0x477924['query'],_0x604ca2[_0xb2cb('0x35')]));if(_0x477924['query'][_0xb2cb('0x3f')]){_0x24b7ec[_0xb2cb('0x3e')]=_['merge'](_0x24b7ec[_0xb2cb('0x3e')],{'$or':_['map'](_0x24b7ec[_0xb2cb('0x37')],function(_0x30cf04){var _0x2e6e80={};_0x2e6e80[_0x30cf04]={'$like':'%'+_0x477924[_0xb2cb('0x36')]['filter']+'%'};return _0x2e6e80;})});}_0x24b7ec=_[_0xb2cb('0x40')]({},_0x24b7ec,_0x477924[_0xb2cb('0x41')]);return _0x3e6f4f[_0xb2cb('0x51')](_0x24b7ec);}})['then'](function(_0x1b6719){if(_0x1b6719){_0x5d478f=_0x1b6719[_0xb2cb('0x3a')];if(!_0x477924[_0xb2cb('0x36')][_0xb2cb('0x3b')](_0xb2cb('0x4d'))){_0x24b7ec[_0xb2cb('0x1e')]=qs[_0xb2cb('0x1e')](_0x477924[_0xb2cb('0x36')]['limit']);_0x24b7ec[_0xb2cb('0x1d')]=qs[_0xb2cb('0x1d')](_0x477924[_0xb2cb('0x36')][_0xb2cb('0x1d')]);}return _0x3e6f4f[_0xb2cb('0x51')](_0x24b7ec);}})[_0xb2cb('0x27')](function(_0x1166b3){if(_0x1166b3){return _0x1166b3?{'count':_0x5d478f,'rows':_0x1166b3}:null;}})[_0xb2cb('0x27')](respondWithResult(_0x92dff1,null))['catch'](handleError(_0x92dff1,null));};
\ No newline at end of file
+var _0x02ad=['name','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','ZohoConfiguration','include','findAll','params','keys','includeAll','catch','create','body','find','destroy','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','error'];(function(_0x83aa1a,_0x54c5cb){var _0x162dcb=function(_0x4c8809){while(--_0x4c8809){_0x83aa1a['push'](_0x83aa1a['shift']());}};_0x162dcb(++_0x54c5cb);}(_0x02ad,0x73));var _0xd02a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x02ad[_0x3b0731];return _0x4204d7;};'use strict';var emlformat=require(_0xd02a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd02a('0x1'));var jsonpatch=require(_0xd02a('0x2'));var rp=require(_0xd02a('0x3'));var moment=require('moment');var BPromise=require(_0xd02a('0x4'));var Mustache=require(_0xd02a('0x5'));var util=require('util');var path=require(_0xd02a('0x6'));var sox=require(_0xd02a('0x7'));var csv=require('to-csv');var ejs=require(_0xd02a('0x8'));var fs=require('fs');var fs_extra=require(_0xd02a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd02a('0xa'));var jsforce=require(_0xd02a('0xb'));var deskjs=require(_0xd02a('0xc'));var toCsv=require(_0xd02a('0xd'));var querystring=require(_0xd02a('0xe'));var Papa=require('papaparse');var Redis=require(_0xd02a('0xf'));var authService=require(_0xd02a('0x10'));var qs=require(_0xd02a('0x11'));var as=require(_0xd02a('0x12'));var hardwareService=require(_0xd02a('0x13'));var logger=require(_0xd02a('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd02a('0x15'));var licenseUtil=require(_0xd02a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24bc1f,_0x197636){_0x197636=_0x197636||0xcc;return function(_0x2f6804){if(_0x2f6804){return _0x24bc1f[_0xd02a('0x17')](_0x197636);}return _0x24bc1f[_0xd02a('0x18')](_0x197636)[_0xd02a('0x19')]();};}function respondWithResult(_0x38e86d,_0x247ef8){_0x247ef8=_0x247ef8||0xc8;return function(_0x1f4885){if(_0x1f4885){return _0x38e86d[_0xd02a('0x18')](_0x247ef8)['json'](_0x1f4885);}};}function respondWithFilteredResult(_0x515d61,_0x21d454){return function(_0x4cd993){if(_0x4cd993){var _0x137632=typeof _0x21d454[_0xd02a('0x1a')]===_0xd02a('0x1b')&&typeof _0x21d454[_0xd02a('0x1c')]==='undefined';var _0x1ea5b5=_0x4cd993[_0xd02a('0x1d')];var _0x285f5e=_0x137632?0x0:_0x21d454[_0xd02a('0x1a')];var _0x2541fb=_0x137632?_0x4cd993[_0xd02a('0x1d')]:_0x21d454[_0xd02a('0x1a')]+_0x21d454[_0xd02a('0x1c')];var _0x38b0fc;if(_0x2541fb>=_0x1ea5b5){_0x2541fb=_0x1ea5b5;_0x38b0fc=0xc8;}else{_0x38b0fc=0xce;}_0x515d61[_0xd02a('0x18')](_0x38b0fc);return _0x515d61[_0xd02a('0x1e')]('Content-Range',_0x285f5e+'-'+_0x2541fb+'/'+_0x1ea5b5)[_0xd02a('0x1f')](_0x4cd993);}return null;};}function patchUpdates(_0x3bd558){return function(_0xa09824){try{jsonpatch[_0xd02a('0x20')](_0xa09824,_0x3bd558,!![]);}catch(_0x2e4d2e){return BPromise[_0xd02a('0x21')](_0x2e4d2e);}return _0xa09824['save']();};}function saveUpdates(_0x44f81b,_0x5d610f){return function(_0x133ac3){if(_0x133ac3){return _0x133ac3[_0xd02a('0x22')](_0x44f81b)[_0xd02a('0x23')](function(_0x102fa5){return _0x102fa5;});}return null;};}function removeEntity(_0x591c5d,_0x39df5a){return function(_0x10ffff){if(_0x10ffff){return _0x10ffff['destroy']()[_0xd02a('0x23')](function(){_0x591c5d[_0xd02a('0x18')](0xcc)[_0xd02a('0x19')]();});}};}function handleEntityNotFound(_0x456026,_0x27d87f){return function(_0x39d22e){if(!_0x39d22e){_0x456026[_0xd02a('0x17')](0x194);}return _0x39d22e;};}function handleError(_0x170c9b,_0x2836f9){_0x2836f9=_0x2836f9||0x1f4;return function(_0x47c586){logger[_0xd02a('0x24')](_0x47c586['stack']);if(_0x47c586[_0xd02a('0x25')]){delete _0x47c586[_0xd02a('0x25')];}_0x170c9b['status'](_0x2836f9)['send'](_0x47c586);};}exports['index']=function(_0x36173d,_0x44dbc6){var _0x26d568={},_0x25d5d4={},_0x1f3a85={'count':0x0,'rows':[]};var _0x280ac0=_[_0xd02a('0x26')](db['ZohoConfiguration'][_0xd02a('0x27')],function(_0x351718){return{'name':_0x351718[_0xd02a('0x28')],'type':_0x351718['type'][_0xd02a('0x29')]};});_0x25d5d4['model']=_[_0xd02a('0x26')](_0x280ac0,_0xd02a('0x25'));_0x25d5d4[_0xd02a('0x2a')]=_['keys'](_0x36173d[_0xd02a('0x2a')]);_0x25d5d4[_0xd02a('0x2b')]=_[_0xd02a('0x2c')](_0x25d5d4[_0xd02a('0x2d')],_0x25d5d4[_0xd02a('0x2a')]);_0x26d568[_0xd02a('0x2e')]=_[_0xd02a('0x2c')](_0x25d5d4[_0xd02a('0x2d')],qs[_0xd02a('0x2f')](_0x36173d[_0xd02a('0x2a')][_0xd02a('0x2f')]));_0x26d568[_0xd02a('0x2e')]=_0x26d568[_0xd02a('0x2e')][_0xd02a('0x30')]?_0x26d568['attributes']:_0x25d5d4[_0xd02a('0x2d')];if(!_0x36173d[_0xd02a('0x2a')][_0xd02a('0x31')](_0xd02a('0x32'))){_0x26d568[_0xd02a('0x1c')]=qs[_0xd02a('0x1c')](_0x36173d[_0xd02a('0x2a')][_0xd02a('0x1c')]);_0x26d568[_0xd02a('0x1a')]=qs[_0xd02a('0x1a')](_0x36173d[_0xd02a('0x2a')][_0xd02a('0x1a')]);}_0x26d568[_0xd02a('0x33')]=qs['sort'](_0x36173d[_0xd02a('0x2a')][_0xd02a('0x34')]);_0x26d568[_0xd02a('0x35')]=qs[_0xd02a('0x2b')](_['pick'](_0x36173d[_0xd02a('0x2a')],_0x25d5d4[_0xd02a('0x2b')]),_0x280ac0);if(_0x36173d[_0xd02a('0x2a')][_0xd02a('0x36')]){_0x26d568[_0xd02a('0x35')]=_[_0xd02a('0x37')](_0x26d568[_0xd02a('0x35')],{'$or':_[_0xd02a('0x26')](_0x280ac0,function(_0x217721){if(_0x217721[_0xd02a('0x38')]!==_0xd02a('0x39')){var _0x535b7b={};_0x535b7b[_0x217721[_0xd02a('0x25')]]={'$like':'%'+_0x36173d[_0xd02a('0x2a')][_0xd02a('0x36')]+'%'};return _0x535b7b;}})});}_0x26d568=_[_0xd02a('0x37')]({},_0x26d568,_0x36173d[_0xd02a('0x3a')]);var _0x527136={'where':_0x26d568['where']};return db[_0xd02a('0x3b')]['count'](_0x527136)[_0xd02a('0x23')](function(_0x44521c){_0x1f3a85[_0xd02a('0x1d')]=_0x44521c;if(_0x36173d[_0xd02a('0x2a')]['includeAll']){_0x26d568[_0xd02a('0x3c')]=[{'all':!![]}];}return db[_0xd02a('0x3b')][_0xd02a('0x3d')](_0x26d568);})[_0xd02a('0x23')](function(_0x42c58b){_0x1f3a85['rows']=_0x42c58b;return _0x1f3a85;})[_0xd02a('0x23')](respondWithFilteredResult(_0x44dbc6,_0x26d568))['catch'](handleError(_0x44dbc6,null));};exports['show']=function(_0x28712d,_0x462f35){var _0x41df3d={'raw':![],'where':{'id':_0x28712d[_0xd02a('0x3e')]['id']}},_0x499c51={};_0x499c51[_0xd02a('0x2d')]=_[_0xd02a('0x3f')](db[_0xd02a('0x3b')][_0xd02a('0x27')]);_0x499c51[_0xd02a('0x2a')]=_[_0xd02a('0x3f')](_0x28712d[_0xd02a('0x2a')]);_0x499c51[_0xd02a('0x2b')]=_[_0xd02a('0x2c')](_0x499c51['model'],_0x499c51['query']);_0x41df3d[_0xd02a('0x2e')]=_[_0xd02a('0x2c')](_0x499c51[_0xd02a('0x2d')],qs[_0xd02a('0x2f')](_0x28712d[_0xd02a('0x2a')][_0xd02a('0x2f')]));_0x41df3d[_0xd02a('0x2e')]=_0x41df3d[_0xd02a('0x2e')][_0xd02a('0x30')]?_0x41df3d[_0xd02a('0x2e')]:_0x499c51[_0xd02a('0x2d')];if(_0x28712d['query'][_0xd02a('0x40')]){_0x41df3d[_0xd02a('0x3c')]=[{'all':!![]}];}_0x41df3d=_[_0xd02a('0x37')]({},_0x41df3d,_0x28712d['options']);return db[_0xd02a('0x3b')]['find'](_0x41df3d)[_0xd02a('0x23')](handleEntityNotFound(_0x462f35,null))[_0xd02a('0x23')](respondWithResult(_0x462f35,null))[_0xd02a('0x41')](handleError(_0x462f35,null));};exports['create']=function(_0xc45b67,_0x22fe8e){return db[_0xd02a('0x3b')][_0xd02a('0x42')](_0xc45b67[_0xd02a('0x43')],{})[_0xd02a('0x23')](respondWithResult(_0x22fe8e,0xc9))[_0xd02a('0x41')](handleError(_0x22fe8e,null));};exports[_0xd02a('0x22')]=function(_0x1ea332,_0x5e0daa){if(_0x1ea332['body']['id']){delete _0x1ea332[_0xd02a('0x43')]['id'];}return db[_0xd02a('0x3b')][_0xd02a('0x44')]({'where':{'id':_0x1ea332['params']['id']}})[_0xd02a('0x23')](handleEntityNotFound(_0x5e0daa,null))[_0xd02a('0x23')](saveUpdates(_0x1ea332['body'],null))['then'](respondWithResult(_0x5e0daa,null))[_0xd02a('0x41')](handleError(_0x5e0daa,null));};exports[_0xd02a('0x45')]=function(_0x55c102,_0x243e66){return db[_0xd02a('0x3b')][_0xd02a('0x44')]({'where':{'id':_0x55c102[_0xd02a('0x3e')]['id']}})[_0xd02a('0x23')](handleEntityNotFound(_0x243e66,null))[_0xd02a('0x23')](removeEntity(_0x243e66,null))[_0xd02a('0x41')](handleError(_0x243e66,null));};exports[_0xd02a('0x46')]=function(_0x2aa2b0,_0x4d732b,_0x58d78c){var _0x10f4ec={};var _0x5373f5={};var _0x57549a;var _0x268edc;return db['ZohoConfiguration'][_0xd02a('0x47')]({'where':{'id':_0x2aa2b0[_0xd02a('0x3e')]['id']}})[_0xd02a('0x23')](handleEntityNotFound(_0x4d732b,null))[_0xd02a('0x23')](function(_0x926f3e){if(_0x926f3e){_0x57549a=_0x926f3e;_0x5373f5['model']=_['keys'](db[_0xd02a('0x48')][_0xd02a('0x27')]);_0x5373f5[_0xd02a('0x2a')]=_[_0xd02a('0x3f')](_0x2aa2b0[_0xd02a('0x2a')]);_0x5373f5['filters']=_[_0xd02a('0x2c')](_0x5373f5[_0xd02a('0x2d')],_0x5373f5['query']);_0x10f4ec['attributes']=_[_0xd02a('0x2c')](_0x5373f5[_0xd02a('0x2d')],qs[_0xd02a('0x2f')](_0x2aa2b0[_0xd02a('0x2a')][_0xd02a('0x2f')]));_0x10f4ec[_0xd02a('0x2e')]=_0x10f4ec['attributes'][_0xd02a('0x30')]?_0x10f4ec[_0xd02a('0x2e')]:_0x5373f5[_0xd02a('0x2d')];_0x10f4ec[_0xd02a('0x33')]=qs[_0xd02a('0x34')](_0x2aa2b0[_0xd02a('0x2a')][_0xd02a('0x34')]);_0x10f4ec[_0xd02a('0x35')]=qs[_0xd02a('0x2b')](_[_0xd02a('0x49')](_0x2aa2b0[_0xd02a('0x2a')],_0x5373f5[_0xd02a('0x2b')]));if(_0x2aa2b0[_0xd02a('0x2a')][_0xd02a('0x36')]){_0x10f4ec['where']=_[_0xd02a('0x37')](_0x10f4ec['where'],{'$or':_[_0xd02a('0x26')](_0x10f4ec[_0xd02a('0x2e')],function(_0x286436){var _0x4aac64={};_0x4aac64[_0x286436]={'$like':'%'+_0x2aa2b0['query'][_0xd02a('0x36')]+'%'};return _0x4aac64;})});}_0x10f4ec=_[_0xd02a('0x37')]({},_0x10f4ec,_0x2aa2b0[_0xd02a('0x3a')]);return _0x57549a[_0xd02a('0x46')](_0x10f4ec);}})[_0xd02a('0x23')](function(_0x5442e0){if(_0x5442e0){_0x268edc=_0x5442e0['length'];if(!_0x2aa2b0[_0xd02a('0x2a')][_0xd02a('0x31')](_0xd02a('0x32'))){_0x10f4ec[_0xd02a('0x1c')]=qs['limit'](_0x2aa2b0[_0xd02a('0x2a')][_0xd02a('0x1c')]);_0x10f4ec[_0xd02a('0x1a')]=qs[_0xd02a('0x1a')](_0x2aa2b0[_0xd02a('0x2a')]['offset']);}return _0x57549a[_0xd02a('0x46')](_0x10f4ec);}})[_0xd02a('0x23')](function(_0x178bb4){if(_0x178bb4){return _0x178bb4?{'count':_0x268edc,'rows':_0x178bb4}:null;}})[_0xd02a('0x23')](respondWithResult(_0x4d732b,null))['catch'](handleError(_0x4d732b,null));};exports[_0xd02a('0x4a')]=function(_0x3dbef8,_0x1fe7c5,_0x5d2ae3){var _0x48e850={};var _0x6535a0={};var _0x15c2ac;var _0x366c63;return db[_0xd02a('0x3b')][_0xd02a('0x47')]({'where':{'id':_0x3dbef8[_0xd02a('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1fe7c5,null))['then'](function(_0xf14e5e){if(_0xf14e5e){_0x15c2ac=_0xf14e5e;_0x6535a0[_0xd02a('0x2d')]=_[_0xd02a('0x3f')](db['ZohoField'][_0xd02a('0x27')]);_0x6535a0[_0xd02a('0x2a')]=_[_0xd02a('0x3f')](_0x3dbef8['query']);_0x6535a0[_0xd02a('0x2b')]=_[_0xd02a('0x2c')](_0x6535a0[_0xd02a('0x2d')],_0x6535a0[_0xd02a('0x2a')]);_0x48e850['attributes']=_['intersection'](_0x6535a0[_0xd02a('0x2d')],qs['fields'](_0x3dbef8['query'][_0xd02a('0x2f')]));_0x48e850[_0xd02a('0x2e')]=_0x48e850[_0xd02a('0x2e')]['length']?_0x48e850['attributes']:_0x6535a0[_0xd02a('0x2d')];_0x48e850[_0xd02a('0x33')]=qs[_0xd02a('0x34')](_0x3dbef8[_0xd02a('0x2a')]['sort']);_0x48e850[_0xd02a('0x35')]=qs[_0xd02a('0x2b')](_[_0xd02a('0x49')](_0x3dbef8['query'],_0x6535a0['filters']));if(_0x3dbef8['query']['filter']){_0x48e850['where']=_[_0xd02a('0x37')](_0x48e850['where'],{'$or':_[_0xd02a('0x26')](_0x48e850[_0xd02a('0x2e')],function(_0x98b055){var _0x28e6c7={};_0x28e6c7[_0x98b055]={'$like':'%'+_0x3dbef8[_0xd02a('0x2a')][_0xd02a('0x36')]+'%'};return _0x28e6c7;})});}_0x48e850=_[_0xd02a('0x37')]({},_0x48e850,_0x3dbef8[_0xd02a('0x3a')]);return _0x15c2ac[_0xd02a('0x4a')](_0x48e850);}})[_0xd02a('0x23')](function(_0x490756){if(_0x490756){_0x366c63=_0x490756[_0xd02a('0x30')];if(!_0x3dbef8[_0xd02a('0x2a')][_0xd02a('0x31')](_0xd02a('0x32'))){_0x48e850[_0xd02a('0x1c')]=qs['limit'](_0x3dbef8[_0xd02a('0x2a')][_0xd02a('0x1c')]);_0x48e850[_0xd02a('0x1a')]=qs[_0xd02a('0x1a')](_0x3dbef8[_0xd02a('0x2a')]['offset']);}return _0x15c2ac['getSubjects'](_0x48e850);}})['then'](function(_0x5b6e28){if(_0x5b6e28){return _0x5b6e28?{'count':_0x366c63,'rows':_0x5b6e28}:null;}})['then'](respondWithResult(_0x1fe7c5,null))['catch'](handleError(_0x1fe7c5,null));};exports[_0xd02a('0x4b')]=function(_0x5932b0,_0x52020a,_0x57e2ac){var _0x54a281={};var _0x55b11a={};var _0x144635;var _0x73d23c;return db[_0xd02a('0x3b')][_0xd02a('0x47')]({'where':{'id':_0x5932b0[_0xd02a('0x3e')]['id']}})[_0xd02a('0x23')](handleEntityNotFound(_0x52020a,null))['then'](function(_0x148391){if(_0x148391){_0x144635=_0x148391;_0x55b11a[_0xd02a('0x2d')]=_['keys'](db[_0xd02a('0x48')][_0xd02a('0x27')]);_0x55b11a['query']=_[_0xd02a('0x3f')](_0x5932b0[_0xd02a('0x2a')]);_0x55b11a[_0xd02a('0x2b')]=_[_0xd02a('0x2c')](_0x55b11a[_0xd02a('0x2d')],_0x55b11a[_0xd02a('0x2a')]);_0x54a281[_0xd02a('0x2e')]=_['intersection'](_0x55b11a[_0xd02a('0x2d')],qs[_0xd02a('0x2f')](_0x5932b0[_0xd02a('0x2a')]['fields']));_0x54a281['attributes']=_0x54a281[_0xd02a('0x2e')][_0xd02a('0x30')]?_0x54a281[_0xd02a('0x2e')]:_0x55b11a[_0xd02a('0x2d')];_0x54a281['order']=qs[_0xd02a('0x34')](_0x5932b0[_0xd02a('0x2a')][_0xd02a('0x34')]);_0x54a281['where']=qs['filters'](_[_0xd02a('0x49')](_0x5932b0[_0xd02a('0x2a')],_0x55b11a[_0xd02a('0x2b')]));if(_0x5932b0[_0xd02a('0x2a')][_0xd02a('0x36')]){_0x54a281[_0xd02a('0x35')]=_[_0xd02a('0x37')](_0x54a281['where'],{'$or':_[_0xd02a('0x26')](_0x54a281['attributes'],function(_0x5598f2){var _0x53f772={};_0x53f772[_0x5598f2]={'$like':'%'+_0x5932b0[_0xd02a('0x2a')][_0xd02a('0x36')]+'%'};return _0x53f772;})});}_0x54a281=_[_0xd02a('0x37')]({},_0x54a281,_0x5932b0[_0xd02a('0x3a')]);return _0x144635[_0xd02a('0x4b')](_0x54a281);}})['then'](function(_0x3b5a7d){if(_0x3b5a7d){_0x73d23c=_0x3b5a7d[_0xd02a('0x30')];if(!_0x5932b0[_0xd02a('0x2a')]['hasOwnProperty'](_0xd02a('0x32'))){_0x54a281[_0xd02a('0x1c')]=qs['limit'](_0x5932b0[_0xd02a('0x2a')]['limit']);_0x54a281[_0xd02a('0x1a')]=qs['offset'](_0x5932b0[_0xd02a('0x2a')][_0xd02a('0x1a')]);}return _0x144635[_0xd02a('0x4b')](_0x54a281);}})[_0xd02a('0x23')](function(_0xc8585e){if(_0xc8585e){return _0xc8585e?{'count':_0x73d23c,'rows':_0xc8585e}:null;}})['then'](respondWithResult(_0x52020a,null))['catch'](handleError(_0x52020a,null));};
\ No newline at end of file
index 5170cb4..ba346c6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbbea=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xbbea,0x1ad));var _0xabbe=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xbbea[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xabbe('0x0'));var util=require(_0xabbe('0x1'));var logger=require(_0xabbe('0x2'))(_0xabbe('0x3'));var moment=require(_0xabbe('0x4'));var BPromise=require(_0xabbe('0x5'));var rp=require(_0xabbe('0x6'));var fs=require('fs');var path=require(_0xabbe('0x7'));var rimraf=require(_0xabbe('0x8'));var config=require(_0xabbe('0x9'));var attributes=require(_0xabbe('0xa'));module[_0xabbe('0xb')]=function(_0x3dc911,_0x21754a){return _0x3dc911[_0xabbe('0xc')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9f37=['exports','ZohoConfiguration','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x5db0ae,_0x584213){var _0x2ac3db=function(_0x353155){while(--_0x353155){_0x5db0ae['push'](_0x5db0ae['shift']());}};_0x2ac3db(++_0x584213);}(_0x9f37,0xf2));var _0x79f3=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x9f37[_0x45783c];return _0x1161da;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var logger=require(_0x79f3('0x2'))('api');var moment=require(_0x79f3('0x3'));var BPromise=require(_0x79f3('0x4'));var rp=require(_0x79f3('0x5'));var fs=require('fs');var path=require(_0x79f3('0x6'));var rimraf=require(_0x79f3('0x7'));var config=require(_0x79f3('0x8'));var attributes=require(_0x79f3('0x9'));module[_0x79f3('0xa')]=function(_0xc6fbf5,_0x40ed68){return _0xc6fbf5['define'](_0x79f3('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d3b08fa..76a3995 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x188e=['../../config/environment','client','http','request','then','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x226455,_0x307cf5){var _0x3a4fc2=function(_0x40553a){while(--_0x40553a){_0x226455['push'](_0x226455['shift']());}};_0x3a4fc2(++_0x307cf5);}(_0x188e,0xc1));var _0xe188=function(_0x160843,_0x34f09c){_0x160843=_0x160843-0x0;var _0x35197b=_0x188e[_0x160843];return _0x35197b;};'use strict';var _=require(_0xe188('0x0'));var util=require(_0xe188('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe188('0x2'));var fs=require('fs');var Redis=require(_0xe188('0x3'));var db=require(_0xe188('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe188('0x5'))(_0xe188('0x6'));var config=require(_0xe188('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe188('0x8')][_0xe188('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5293db,_0x35c1dc,_0x1d5be4){return new BPromise(function(_0x1b4039,_0x12604c){return client[_0xe188('0xa')](_0x5293db,_0x1d5be4)[_0xe188('0xb')](function(_0x5f7143){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x35c1dc,_0xe188('0xc'));logger['debug'](_0xe188('0xd'),_0x35c1dc,'request\x20sent',JSON['stringify'](_0x5f7143));if(_0x5f7143['error']){if(_0x5f7143[_0xe188('0xe')][_0xe188('0xf')]===0x1f4){logger[_0xe188('0xe')](_0xe188('0x10'),_0x35c1dc,_0x5f7143[_0xe188('0xe')]['message']);return _0x12604c(_0x5f7143[_0xe188('0xe')][_0xe188('0x11')]);}logger[_0xe188('0xe')](_0xe188('0x10'),_0x35c1dc,_0x5f7143[_0xe188('0xe')][_0xe188('0x11')]);return _0x1b4039(_0x5f7143[_0xe188('0xe')][_0xe188('0x11')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x35c1dc,_0xe188('0xc'));_0x1b4039(_0x5f7143[_0xe188('0x12')][_0xe188('0x11')]);}})[_0xe188('0x13')](function(_0x57585b){logger[_0xe188('0xe')](_0xe188('0x10'),_0x35c1dc,_0x57585b);_0x12604c(_0x57585b);});});}
\ No newline at end of file
+var _0xe2d9=['rpc','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0xe2d9,0x167));var _0x9e2d=function(_0x22553c,_0x5d6e96){_0x22553c=_0x22553c-0x0;var _0xc5f9b4=_0xe2d9[_0x22553c];return _0xc5f9b4;};'use strict';var _=require(_0x9e2d('0x0'));var util=require(_0x9e2d('0x1'));var moment=require(_0x9e2d('0x2'));var BPromise=require(_0x9e2d('0x3'));var rs=require(_0x9e2d('0x4'));var fs=require('fs');var Redis=require(_0x9e2d('0x5'));var db=require(_0x9e2d('0x6'))['db'];var utils=require(_0x9e2d('0x7'));var logger=require(_0x9e2d('0x8'))(_0x9e2d('0x9'));var config=require('../../config/environment');var jayson=require(_0x9e2d('0xa'));var client=jayson[_0x9e2d('0xb')][_0x9e2d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x547457,_0x312512,_0x3ac0f0){return new BPromise(function(_0x11f47d,_0x3c8b87){return client[_0x9e2d('0xd')](_0x547457,_0x3ac0f0)[_0x9e2d('0xe')](function(_0x380654){logger[_0x9e2d('0xf')](_0x9e2d('0x10'),_0x312512,_0x9e2d('0x11'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x312512,_0x9e2d('0x11'),JSON[_0x9e2d('0x12')](_0x380654));if(_0x380654[_0x9e2d('0x13')]){if(_0x380654[_0x9e2d('0x13')][_0x9e2d('0x14')]===0x1f4){logger[_0x9e2d('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x312512,_0x380654[_0x9e2d('0x13')][_0x9e2d('0x15')]);return _0x3c8b87(_0x380654[_0x9e2d('0x13')][_0x9e2d('0x15')]);}logger[_0x9e2d('0x13')](_0x9e2d('0x10'),_0x312512,_0x380654[_0x9e2d('0x13')][_0x9e2d('0x15')]);return _0x11f47d(_0x380654[_0x9e2d('0x13')][_0x9e2d('0x15')]);}else{logger[_0x9e2d('0xf')](_0x9e2d('0x10'),_0x312512,_0x9e2d('0x11'));_0x11f47d(_0x380654['result'][_0x9e2d('0x15')]);}})[_0x9e2d('0x16')](function(_0x29f270){logger[_0x9e2d('0x13')](_0x9e2d('0x10'),_0x312512,_0x29f270);_0x3c8b87(_0x29f270);});});}
\ No newline at end of file
index ed90a9a..3eb639e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0636=['fs-extra','../../components/auth/service','./intZohoField.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0636,0x163));var _0x6063=function(_0x370540,_0x390a67){_0x370540=_0x370540-0x0;var _0x39c1e0=_0x0636[_0x370540];return _0x39c1e0;};'use strict';var multer=require(_0x6063('0x0'));var util=require(_0x6063('0x1'));var path=require(_0x6063('0x2'));var timeout=require('connect-timeout');var express=require(_0x6063('0x3'));var router=express[_0x6063('0x4')]();var fs_extra=require(_0x6063('0x5'));var auth=require(_0x6063('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6063('0x7'));router[_0x6063('0x8')]('/',auth['isAuthenticated'](),controller[_0x6063('0x9')]);router[_0x6063('0x8')](_0x6063('0xa'),auth[_0x6063('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x6063('0xc')]);router[_0x6063('0xd')](_0x6063('0xa'),auth[_0x6063('0xb')](),controller[_0x6063('0xe')]);router[_0x6063('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6063('0x10')]);module[_0x6063('0x11')]=router;
\ No newline at end of file
+var _0xde93=['show','post','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xde93,0x1a8));var _0x3de9=function(_0x15d72c,_0x2800e0){_0x15d72c=_0x15d72c-0x0;var _0x3dc073=_0xde93[_0x15d72c];return _0x3dc073;};'use strict';var multer=require('multer');var util=require(_0x3de9('0x0'));var path=require(_0x3de9('0x1'));var timeout=require(_0x3de9('0x2'));var express=require(_0x3de9('0x3'));var router=express[_0x3de9('0x4')]();var fs_extra=require(_0x3de9('0x5'));var auth=require(_0x3de9('0x6'));var interaction=require(_0x3de9('0x7'));var config=require('../../config/environment');var controller=require(_0x3de9('0x8'));router[_0x3de9('0x9')]('/',auth[_0x3de9('0xa')](),controller[_0x3de9('0xb')]);router['get'](_0x3de9('0xc'),auth[_0x3de9('0xa')](),controller[_0x3de9('0xd')]);router[_0x3de9('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3de9('0xf')](_0x3de9('0xc'),auth[_0x3de9('0xa')](),controller['update']);router[_0x3de9('0x10')](_0x3de9('0xc'),auth[_0x3de9('0xa')](),controller[_0x3de9('0x11')]);module[_0x3de9('0x12')]=router;
\ No newline at end of file
index beb7aac..852b3aa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6043=['picklist','ENUM','STRING','BOOLEAN','sequelize','exports','string','variable','keyValue'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x6043,0xee));var _0x3604=function(_0x41f745,_0x4b5c4a){_0x41f745=_0x41f745-0x0;var _0x2cbbcb=_0x6043[_0x41f745];return _0x2cbbcb;};'use strict';var Sequelize=require(_0x3604('0x0'));module[_0x3604('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3604('0x2'),_0x3604('0x3'),'customVariable',_0x3604('0x4'),_0x3604('0x5')),'defaultValue':_0x3604('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3604('0x6')](_0x3604('0x2'),_0x3604('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3604('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3604('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3604('0x7')]}};
\ No newline at end of file
+var _0xeec2=['exports','ENUM','customVariable','picklist','string','STRING','variable','BOOLEAN','sequelize'];(function(_0x5c3c09,_0x777ad5){var _0x283640=function(_0x21717d){while(--_0x21717d){_0x5c3c09['push'](_0x5c3c09['shift']());}};_0x283640(++_0x777ad5);}(_0xeec2,0x104));var _0x2eec=function(_0x24107e,_0x7ae835){_0x24107e=_0x24107e-0x0;var _0x171df6=_0xeec2[_0x24107e];return _0x171df6;};'use strict';var Sequelize=require(_0x2eec('0x0'));module[_0x2eec('0x1')]={'type':{'type':Sequelize[_0x2eec('0x2')]('string','variable',_0x2eec('0x3'),'keyValue',_0x2eec('0x4')),'defaultValue':_0x2eec('0x5')},'content':{'type':Sequelize[_0x2eec('0x6')]},'key':{'type':Sequelize[_0x2eec('0x6')]},'keyType':{'type':Sequelize[_0x2eec('0x2')](_0x2eec('0x5'),_0x2eec('0x7'),_0x2eec('0x3'))},'keyContent':{'type':Sequelize[_0x2eec('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2eec('0x6')]},'customField':{'type':Sequelize[_0x2eec('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2eec('0x6')]}};
\ No newline at end of file
index ad11bd6..1efa86a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0cdf=['merge','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','includeAll','include','rows','keys'];(function(_0x27b4b3,_0x354969){var _0x2ae4a9=function(_0x16bc3b){while(--_0x16bc3b){_0x27b4b3['push'](_0x27b4b3['shift']());}};_0x2ae4a9(++_0x354969);}(_0x0cdf,0xdc));var _0xf0cd=function(_0x54a154,_0x1e6a06){_0x54a154=_0x54a154-0x0;var _0x25d7ca=_0x0cdf[_0x54a154];return _0x25d7ca;};'use strict';var emlformat=require(_0xf0cd('0x0'));var rimraf=require(_0xf0cd('0x1'));var zipdir=require(_0xf0cd('0x2'));var jsonpatch=require(_0xf0cd('0x3'));var rp=require(_0xf0cd('0x4'));var moment=require(_0xf0cd('0x5'));var BPromise=require(_0xf0cd('0x6'));var Mustache=require(_0xf0cd('0x7'));var util=require(_0xf0cd('0x8'));var path=require('path');var sox=require(_0xf0cd('0x9'));var csv=require(_0xf0cd('0xa'));var ejs=require(_0xf0cd('0xb'));var fs=require('fs');var fs_extra=require(_0xf0cd('0xc'));var _=require('lodash');var squel=require(_0xf0cd('0xd'));var crypto=require(_0xf0cd('0xe'));var jsforce=require(_0xf0cd('0xf'));var deskjs=require(_0xf0cd('0x10'));var toCsv=require(_0xf0cd('0xa'));var querystring=require(_0xf0cd('0x11'));var Papa=require(_0xf0cd('0x12'));var Redis=require(_0xf0cd('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0cd('0x14'));var logger=require(_0xf0cd('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf0cd('0x16'));var licenseUtil=require(_0xf0cd('0x17'));var db=require(_0xf0cd('0x18'))['db'];function respondWithStatusCode(_0x23596b,_0xb5f097){_0xb5f097=_0xb5f097||0xcc;return function(_0xb9f4a1){if(_0xb9f4a1){return _0x23596b['sendStatus'](_0xb5f097);}return _0x23596b[_0xf0cd('0x19')](_0xb5f097)[_0xf0cd('0x1a')]();};}function respondWithResult(_0x3c8e54,_0x5e07b5){_0x5e07b5=_0x5e07b5||0xc8;return function(_0x1500f5){if(_0x1500f5){return _0x3c8e54[_0xf0cd('0x19')](_0x5e07b5)[_0xf0cd('0x1b')](_0x1500f5);}};}function respondWithFilteredResult(_0x5ad8d9,_0x5b3d37){return function(_0x2e21c1){if(_0x2e21c1){var _0x278b6f=typeof _0x5b3d37[_0xf0cd('0x1c')]==='undefined'&&typeof _0x5b3d37['limit']===_0xf0cd('0x1d');var _0x556e52=_0x2e21c1[_0xf0cd('0x1e')];var _0x52273c=_0x278b6f?0x0:_0x5b3d37[_0xf0cd('0x1c')];var _0x36fb95=_0x278b6f?_0x2e21c1[_0xf0cd('0x1e')]:_0x5b3d37[_0xf0cd('0x1c')]+_0x5b3d37[_0xf0cd('0x1f')];var _0x3eb619;if(_0x36fb95>=_0x556e52){_0x36fb95=_0x556e52;_0x3eb619=0xc8;}else{_0x3eb619=0xce;}_0x5ad8d9[_0xf0cd('0x19')](_0x3eb619);return _0x5ad8d9[_0xf0cd('0x20')](_0xf0cd('0x21'),_0x52273c+'-'+_0x36fb95+'/'+_0x556e52)[_0xf0cd('0x1b')](_0x2e21c1);}return null;};}function patchUpdates(_0x4b169d){return function(_0x516c8e){try{jsonpatch[_0xf0cd('0x22')](_0x516c8e,_0x4b169d,!![]);}catch(_0x1c0216){return BPromise[_0xf0cd('0x23')](_0x1c0216);}return _0x516c8e['save']();};}function saveUpdates(_0x221848,_0x244fe4){return function(_0x2bc346){if(_0x2bc346){return _0x2bc346[_0xf0cd('0x24')](_0x221848)[_0xf0cd('0x25')](function(_0x43078e){return _0x43078e;});}return null;};}function removeEntity(_0x5dc059,_0x123727){return function(_0x593bcb){if(_0x593bcb){return _0x593bcb[_0xf0cd('0x26')]()[_0xf0cd('0x25')](function(){_0x5dc059[_0xf0cd('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48cb96,_0x2c99f0){return function(_0x5d534b){if(!_0x5d534b){_0x48cb96['sendStatus'](0x194);}return _0x5d534b;};}function handleError(_0xc229e,_0x2279c5){_0x2279c5=_0x2279c5||0x1f4;return function(_0x3eef81){logger[_0xf0cd('0x27')](_0x3eef81[_0xf0cd('0x28')]);if(_0x3eef81[_0xf0cd('0x29')]){delete _0x3eef81[_0xf0cd('0x29')];}_0xc229e[_0xf0cd('0x19')](_0x2279c5)[_0xf0cd('0x2a')](_0x3eef81);};}exports['index']=function(_0x557056,_0x16a7ca){var _0x397eed={},_0x37ef57={},_0x2000ab={'count':0x0,'rows':[]};var _0x5aceaa=_[_0xf0cd('0x2b')](db[_0xf0cd('0x2c')][_0xf0cd('0x2d')],function(_0x1ea8a9){return{'name':_0x1ea8a9[_0xf0cd('0x2e')],'type':_0x1ea8a9[_0xf0cd('0x2f')]['key']};});_0x37ef57[_0xf0cd('0x30')]=_[_0xf0cd('0x2b')](_0x5aceaa,_0xf0cd('0x29'));_0x37ef57[_0xf0cd('0x31')]=_['keys'](_0x557056[_0xf0cd('0x31')]);_0x37ef57[_0xf0cd('0x32')]=_[_0xf0cd('0x33')](_0x37ef57[_0xf0cd('0x30')],_0x37ef57[_0xf0cd('0x31')]);_0x397eed[_0xf0cd('0x34')]=_[_0xf0cd('0x33')](_0x37ef57[_0xf0cd('0x30')],qs[_0xf0cd('0x35')](_0x557056[_0xf0cd('0x31')]['fields']));_0x397eed[_0xf0cd('0x34')]=_0x397eed[_0xf0cd('0x34')][_0xf0cd('0x36')]?_0x397eed[_0xf0cd('0x34')]:_0x37ef57[_0xf0cd('0x30')];if(!_0x557056[_0xf0cd('0x31')]['hasOwnProperty'](_0xf0cd('0x37'))){_0x397eed[_0xf0cd('0x1f')]=qs[_0xf0cd('0x1f')](_0x557056['query']['limit']);_0x397eed[_0xf0cd('0x1c')]=qs[_0xf0cd('0x1c')](_0x557056[_0xf0cd('0x31')][_0xf0cd('0x1c')]);}_0x397eed[_0xf0cd('0x38')]=qs[_0xf0cd('0x39')](_0x557056[_0xf0cd('0x31')][_0xf0cd('0x39')]);_0x397eed[_0xf0cd('0x3a')]=qs[_0xf0cd('0x32')](_['pick'](_0x557056[_0xf0cd('0x31')],_0x37ef57[_0xf0cd('0x32')]),_0x5aceaa);if(_0x557056[_0xf0cd('0x31')]['filter']){_0x397eed['where']=_['merge'](_0x397eed[_0xf0cd('0x3a')],{'$or':_[_0xf0cd('0x2b')](_0x5aceaa,function(_0x2db6cc){if(_0x2db6cc[_0xf0cd('0x2f')]!==_0xf0cd('0x3b')){var _0x3e3564={};_0x3e3564[_0x2db6cc[_0xf0cd('0x29')]]={'$like':'%'+_0x557056[_0xf0cd('0x31')]['filter']+'%'};return _0x3e3564;}})});}_0x397eed=_['merge']({},_0x397eed,_0x557056['options']);var _0x403fdb={'where':_0x397eed[_0xf0cd('0x3a')]};return db[_0xf0cd('0x2c')]['count'](_0x403fdb)[_0xf0cd('0x25')](function(_0x54f1b5){_0x2000ab[_0xf0cd('0x1e')]=_0x54f1b5;if(_0x557056[_0xf0cd('0x31')][_0xf0cd('0x3c')]){_0x397eed[_0xf0cd('0x3d')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x397eed);})[_0xf0cd('0x25')](function(_0x2f05b3){_0x2000ab[_0xf0cd('0x3e')]=_0x2f05b3;return _0x2000ab;})[_0xf0cd('0x25')](respondWithFilteredResult(_0x16a7ca,_0x397eed))['catch'](handleError(_0x16a7ca,null));};exports['show']=function(_0x72820b,_0x2cfe0f){var _0x212612={'raw':!![],'where':{'id':_0x72820b['params']['id']}},_0x2e7bc0={};_0x2e7bc0[_0xf0cd('0x30')]=_['keys'](db[_0xf0cd('0x2c')][_0xf0cd('0x2d')]);_0x2e7bc0['query']=_[_0xf0cd('0x3f')](_0x72820b['query']);_0x2e7bc0[_0xf0cd('0x32')]=_['intersection'](_0x2e7bc0[_0xf0cd('0x30')],_0x2e7bc0[_0xf0cd('0x31')]);_0x212612[_0xf0cd('0x34')]=_[_0xf0cd('0x33')](_0x2e7bc0[_0xf0cd('0x30')],qs[_0xf0cd('0x35')](_0x72820b['query'][_0xf0cd('0x35')]));_0x212612['attributes']=_0x212612['attributes']['length']?_0x212612[_0xf0cd('0x34')]:_0x2e7bc0[_0xf0cd('0x30')];if(_0x72820b['query'][_0xf0cd('0x3c')]){_0x212612[_0xf0cd('0x3d')]=[{'all':!![]}];}_0x212612=_[_0xf0cd('0x40')]({},_0x212612,_0x72820b[_0xf0cd('0x41')]);return db[_0xf0cd('0x2c')][_0xf0cd('0x42')](_0x212612)['then'](handleEntityNotFound(_0x2cfe0f,null))[_0xf0cd('0x25')](respondWithResult(_0x2cfe0f,null))[_0xf0cd('0x43')](handleError(_0x2cfe0f,null));};exports[_0xf0cd('0x44')]=function(_0x295bf4,_0x2169d9){return db['ZohoField'][_0xf0cd('0x44')](_0x295bf4[_0xf0cd('0x45')],{})[_0xf0cd('0x25')](respondWithResult(_0x2169d9,0xc9))[_0xf0cd('0x43')](handleError(_0x2169d9,null));};exports[_0xf0cd('0x24')]=function(_0x43c05d,_0x169679){if(_0x43c05d[_0xf0cd('0x45')]['id']){delete _0x43c05d[_0xf0cd('0x45')]['id'];}return db[_0xf0cd('0x2c')][_0xf0cd('0x42')]({'where':{'id':_0x43c05d[_0xf0cd('0x46')]['id']}})[_0xf0cd('0x25')](handleEntityNotFound(_0x169679,null))[_0xf0cd('0x25')](saveUpdates(_0x43c05d[_0xf0cd('0x45')],null))[_0xf0cd('0x25')](respondWithResult(_0x169679,null))[_0xf0cd('0x43')](handleError(_0x169679,null));};exports[_0xf0cd('0x26')]=function(_0x56c796,_0x210234){return db[_0xf0cd('0x2c')][_0xf0cd('0x42')]({'where':{'id':_0x56c796[_0xf0cd('0x46')]['id']}})[_0xf0cd('0x25')](handleEntityNotFound(_0x210234,null))[_0xf0cd('0x25')](removeEntity(_0x210234,null))[_0xf0cd('0x43')](handleError(_0x210234,null));};
\ No newline at end of file
+var _0x91ea=['map','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','ZohoField','findAll','rows','catch','show','params','filters','find','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','error','stack','name','send','index'];(function(_0x586d19,_0x56515c){var _0x5221d7=function(_0xae5589){while(--_0xae5589){_0x586d19['push'](_0x586d19['shift']());}};_0x5221d7(++_0x56515c);}(_0x91ea,0x1d1));var _0xa91e=function(_0x5d2131,_0x10a853){_0x5d2131=_0x5d2131-0x0;var _0x490f15=_0x91ea[_0x5d2131];return _0x490f15;};'use strict';var emlformat=require(_0xa91e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa91e('0x1'));var rp=require(_0xa91e('0x2'));var moment=require(_0xa91e('0x3'));var BPromise=require(_0xa91e('0x4'));var Mustache=require(_0xa91e('0x5'));var util=require(_0xa91e('0x6'));var path=require(_0xa91e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa91e('0x8'));var _=require('lodash');var squel=require(_0xa91e('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa91e('0xa'));var querystring=require(_0xa91e('0xb'));var Papa=require(_0xa91e('0xc'));var Redis=require('ioredis');var authService=require(_0xa91e('0xd'));var qs=require(_0xa91e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa91e('0xf'));var logger=require(_0xa91e('0x10'))(_0xa91e('0x11'));var utils=require('../../config/utils');var config=require(_0xa91e('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa91e('0x13'))['db'];function respondWithStatusCode(_0xcdff2b,_0x2df0a3){_0x2df0a3=_0x2df0a3||0xcc;return function(_0x53c131){if(_0x53c131){return _0xcdff2b[_0xa91e('0x14')](_0x2df0a3);}return _0xcdff2b[_0xa91e('0x15')](_0x2df0a3)[_0xa91e('0x16')]();};}function respondWithResult(_0x3d95dd,_0x502dcd){_0x502dcd=_0x502dcd||0xc8;return function(_0x237618){if(_0x237618){return _0x3d95dd[_0xa91e('0x15')](_0x502dcd)[_0xa91e('0x17')](_0x237618);}};}function respondWithFilteredResult(_0x4c6379,_0x38da63){return function(_0x37cd7e){if(_0x37cd7e){var _0x3f0a0c=typeof _0x38da63[_0xa91e('0x18')]===_0xa91e('0x19')&&typeof _0x38da63[_0xa91e('0x1a')]===_0xa91e('0x19');var _0x491973=_0x37cd7e[_0xa91e('0x1b')];var _0x2035cf=_0x3f0a0c?0x0:_0x38da63[_0xa91e('0x18')];var _0x5e851b=_0x3f0a0c?_0x37cd7e[_0xa91e('0x1b')]:_0x38da63['offset']+_0x38da63['limit'];var _0x25cc8c;if(_0x5e851b>=_0x491973){_0x5e851b=_0x491973;_0x25cc8c=0xc8;}else{_0x25cc8c=0xce;}_0x4c6379['status'](_0x25cc8c);return _0x4c6379[_0xa91e('0x1c')](_0xa91e('0x1d'),_0x2035cf+'-'+_0x5e851b+'/'+_0x491973)['json'](_0x37cd7e);}return null;};}function patchUpdates(_0x39282e){return function(_0x3a3124){try{jsonpatch[_0xa91e('0x1e')](_0x3a3124,_0x39282e,!![]);}catch(_0x1c4032){return BPromise['reject'](_0x1c4032);}return _0x3a3124[_0xa91e('0x1f')]();};}function saveUpdates(_0x60bb88,_0x9cbc62){return function(_0x2ecc8f){if(_0x2ecc8f){return _0x2ecc8f[_0xa91e('0x20')](_0x60bb88)['then'](function(_0x1b5283){return _0x1b5283;});}return null;};}function removeEntity(_0x1e372d,_0x3413c0){return function(_0x326d7f){if(_0x326d7f){return _0x326d7f[_0xa91e('0x21')]()['then'](function(){_0x1e372d[_0xa91e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x596ca6,_0x523b13){return function(_0x531e1b){if(!_0x531e1b){_0x596ca6[_0xa91e('0x14')](0x194);}return _0x531e1b;};}function handleError(_0x39a734,_0x21de88){_0x21de88=_0x21de88||0x1f4;return function(_0x4a1f56){logger[_0xa91e('0x22')](_0x4a1f56[_0xa91e('0x23')]);if(_0x4a1f56[_0xa91e('0x24')]){delete _0x4a1f56[_0xa91e('0x24')];}_0x39a734['status'](_0x21de88)[_0xa91e('0x25')](_0x4a1f56);};}exports[_0xa91e('0x26')]=function(_0x51bab7,_0x56a99f){var _0x5ca629={},_0x12f950={},_0x1eeb15={'count':0x0,'rows':[]};var _0xa4239b=_[_0xa91e('0x27')](db['ZohoField'][_0xa91e('0x28')],function(_0x74f469){return{'name':_0x74f469['fieldName'],'type':_0x74f469[_0xa91e('0x29')][_0xa91e('0x2a')]};});_0x12f950[_0xa91e('0x2b')]=_[_0xa91e('0x27')](_0xa4239b,_0xa91e('0x24'));_0x12f950[_0xa91e('0x2c')]=_[_0xa91e('0x2d')](_0x51bab7[_0xa91e('0x2c')]);_0x12f950['filters']=_['intersection'](_0x12f950[_0xa91e('0x2b')],_0x12f950[_0xa91e('0x2c')]);_0x5ca629[_0xa91e('0x2e')]=_[_0xa91e('0x2f')](_0x12f950[_0xa91e('0x2b')],qs['fields'](_0x51bab7[_0xa91e('0x2c')][_0xa91e('0x30')]));_0x5ca629[_0xa91e('0x2e')]=_0x5ca629[_0xa91e('0x2e')][_0xa91e('0x31')]?_0x5ca629[_0xa91e('0x2e')]:_0x12f950[_0xa91e('0x2b')];if(!_0x51bab7[_0xa91e('0x2c')][_0xa91e('0x32')](_0xa91e('0x33'))){_0x5ca629[_0xa91e('0x1a')]=qs[_0xa91e('0x1a')](_0x51bab7[_0xa91e('0x2c')]['limit']);_0x5ca629[_0xa91e('0x18')]=qs[_0xa91e('0x18')](_0x51bab7[_0xa91e('0x2c')]['offset']);}_0x5ca629[_0xa91e('0x34')]=qs[_0xa91e('0x35')](_0x51bab7[_0xa91e('0x2c')][_0xa91e('0x35')]);_0x5ca629[_0xa91e('0x36')]=qs['filters'](_[_0xa91e('0x37')](_0x51bab7['query'],_0x12f950['filters']),_0xa4239b);if(_0x51bab7[_0xa91e('0x2c')][_0xa91e('0x38')]){_0x5ca629['where']=_[_0xa91e('0x39')](_0x5ca629['where'],{'$or':_[_0xa91e('0x27')](_0xa4239b,function(_0x5b94d2){if(_0x5b94d2[_0xa91e('0x29')]!==_0xa91e('0x3a')){var _0x4e5a73={};_0x4e5a73[_0x5b94d2[_0xa91e('0x24')]]={'$like':'%'+_0x51bab7[_0xa91e('0x2c')][_0xa91e('0x38')]+'%'};return _0x4e5a73;}})});}_0x5ca629=_[_0xa91e('0x39')]({},_0x5ca629,_0x51bab7[_0xa91e('0x3b')]);var _0x215649={'where':_0x5ca629[_0xa91e('0x36')]};return db['ZohoField'][_0xa91e('0x1b')](_0x215649)[_0xa91e('0x3c')](function(_0x37b182){_0x1eeb15[_0xa91e('0x1b')]=_0x37b182;if(_0x51bab7[_0xa91e('0x2c')][_0xa91e('0x3d')]){_0x5ca629[_0xa91e('0x3e')]=[{'all':!![]}];}return db[_0xa91e('0x3f')][_0xa91e('0x40')](_0x5ca629);})['then'](function(_0x218d11){_0x1eeb15[_0xa91e('0x41')]=_0x218d11;return _0x1eeb15;})['then'](respondWithFilteredResult(_0x56a99f,_0x5ca629))[_0xa91e('0x42')](handleError(_0x56a99f,null));};exports[_0xa91e('0x43')]=function(_0x447ee7,_0x83c776){var _0x1516b2={'raw':!![],'where':{'id':_0x447ee7[_0xa91e('0x44')]['id']}},_0x335555={};_0x335555[_0xa91e('0x2b')]=_[_0xa91e('0x2d')](db['ZohoField'][_0xa91e('0x28')]);_0x335555[_0xa91e('0x2c')]=_[_0xa91e('0x2d')](_0x447ee7[_0xa91e('0x2c')]);_0x335555[_0xa91e('0x45')]=_[_0xa91e('0x2f')](_0x335555[_0xa91e('0x2b')],_0x335555[_0xa91e('0x2c')]);_0x1516b2[_0xa91e('0x2e')]=_['intersection'](_0x335555['model'],qs['fields'](_0x447ee7['query'][_0xa91e('0x30')]));_0x1516b2[_0xa91e('0x2e')]=_0x1516b2[_0xa91e('0x2e')]['length']?_0x1516b2[_0xa91e('0x2e')]:_0x335555['model'];if(_0x447ee7[_0xa91e('0x2c')][_0xa91e('0x3d')]){_0x1516b2[_0xa91e('0x3e')]=[{'all':!![]}];}_0x1516b2=_['merge']({},_0x1516b2,_0x447ee7[_0xa91e('0x3b')]);return db[_0xa91e('0x3f')][_0xa91e('0x46')](_0x1516b2)['then'](handleEntityNotFound(_0x83c776,null))[_0xa91e('0x3c')](respondWithResult(_0x83c776,null))[_0xa91e('0x42')](handleError(_0x83c776,null));};exports['create']=function(_0x292dba,_0x345f4b){return db[_0xa91e('0x3f')]['create'](_0x292dba['body'],{})[_0xa91e('0x3c')](respondWithResult(_0x345f4b,0xc9))[_0xa91e('0x42')](handleError(_0x345f4b,null));};exports[_0xa91e('0x20')]=function(_0x2f63de,_0xc750e8){if(_0x2f63de[_0xa91e('0x47')]['id']){delete _0x2f63de['body']['id'];}return db[_0xa91e('0x3f')]['find']({'where':{'id':_0x2f63de[_0xa91e('0x44')]['id']}})['then'](handleEntityNotFound(_0xc750e8,null))[_0xa91e('0x3c')](saveUpdates(_0x2f63de['body'],null))['then'](respondWithResult(_0xc750e8,null))[_0xa91e('0x42')](handleError(_0xc750e8,null));};exports[_0xa91e('0x21')]=function(_0x2bb72d,_0x10dd20){return db['ZohoField'][_0xa91e('0x46')]({'where':{'id':_0x2bb72d['params']['id']}})[_0xa91e('0x3c')](handleEntityNotFound(_0x10dd20,null))[_0xa91e('0x3c')](removeEntity(_0x10dd20,null))[_0xa91e('0x42')](handleError(_0x10dd20,null));};
\ No newline at end of file
index b4f08ad..92ddc17 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4325=['../../config/environment','./intZohoField.attributes','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','rimraf'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var logger=require('../../config/logger')(_0x5432('0x2'));var moment=require(_0x5432('0x3'));var BPromise=require(_0x5432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5432('0x5'));var config=require(_0x5432('0x6'));var attributes=require(_0x5432('0x7'));module['exports']=function(_0x209e2e,_0xbb0075){return _0x209e2e['define'](_0x5432('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x5432('0x9'),'fields':[_0x5432('0xa'),_0x5432('0xb')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x0424=['define','ZohoField','int_zoho_fields','FieldId','../../config/logger','api','moment','bluebird','path','./intZohoField.attributes','exports'];(function(_0xac1a3e,_0x21886a){var _0x268aae=function(_0x5be4f8){while(--_0x5be4f8){_0xac1a3e['push'](_0xac1a3e['shift']());}};_0x268aae(++_0x21886a);}(_0x0424,0x159));var _0x4042=function(_0x232cf2,_0x4ffb79){_0x232cf2=_0x232cf2-0x0;var _0x463cec=_0x0424[_0x232cf2];return _0x463cec;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));module[_0x4042('0x6')]=function(_0x472795,_0xc0fba0){return _0x472795[_0x4042('0x7')](_0x4042('0x8'),attributes,{'tableName':_0x4042('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x4042('0xa')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index ef926ee..01a8e32 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0744=['ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x0744,0xfa));var _0x4074=function(_0x478927,_0x137268){_0x478927=_0x478927-0x0;var _0x37223f=_0x0744[_0x478927];return _0x37223f;};'use strict';var _=require('lodash');var util=require(_0x4074('0x0'));var moment=require(_0x4074('0x1'));var BPromise=require(_0x4074('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4074('0x3'));var db=require(_0x4074('0x4'))['db'];var utils=require(_0x4074('0x5'));var logger=require(_0x4074('0x6'))(_0x4074('0x7'));var config=require(_0x4074('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4074('0x9')][_0x4074('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3207fc,_0xb25122,_0x580872){return new BPromise(function(_0xd01fa9,_0xccddf1){return client[_0x4074('0xb')](_0x3207fc,_0x580872)[_0x4074('0xc')](function(_0x375f80){logger[_0x4074('0xd')](_0x4074('0xe'),_0xb25122,_0x4074('0xf'));logger[_0x4074('0x10')](_0x4074('0x11'),_0xb25122,'request\x20sent',JSON[_0x4074('0x12')](_0x375f80));if(_0x375f80[_0x4074('0x13')]){if(_0x375f80[_0x4074('0x13')]['code']===0x1f4){logger[_0x4074('0x13')]('ZohoField,\x20%s,\x20%s',_0xb25122,_0x375f80['error'][_0x4074('0x14')]);return _0xccddf1(_0x375f80['error'][_0x4074('0x14')]);}logger[_0x4074('0x13')](_0x4074('0xe'),_0xb25122,_0x375f80[_0x4074('0x13')][_0x4074('0x14')]);return _0xd01fa9(_0x375f80[_0x4074('0x13')][_0x4074('0x14')]);}else{logger[_0x4074('0xd')](_0x4074('0xe'),_0xb25122,_0x4074('0xf'));_0xd01fa9(_0x375f80['result']['message']);}})[_0x4074('0x15')](function(_0x407a5a){logger[_0x4074('0x13')]('ZohoField,\x20%s,\x20%s',_0xb25122,_0x407a5a);_0xccddf1(_0x407a5a);});});}
\ No newline at end of file
+var _0x7676=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','ZohoField,\x20%s,\x20%s','message','catch'];(function(_0xb38494,_0x5f1620){var _0x2e24b5=function(_0x10acff){while(--_0x10acff){_0xb38494['push'](_0xb38494['shift']());}};_0x2e24b5(++_0x5f1620);}(_0x7676,0x111));var _0x6767=function(_0x4ba9bf,_0x1f0ee8){_0x4ba9bf=_0x4ba9bf-0x0;var _0x51348a=_0x7676[_0x4ba9bf];return _0x51348a;};'use strict';var _=require(_0x6767('0x0'));var util=require(_0x6767('0x1'));var moment=require(_0x6767('0x2'));var BPromise=require(_0x6767('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6767('0x4'))['db'];var utils=require(_0x6767('0x5'));var logger=require(_0x6767('0x6'))(_0x6767('0x7'));var config=require(_0x6767('0x8'));var jayson=require(_0x6767('0x9'));var client=jayson['client'][_0x6767('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36a9dd,_0x3ad0cd,_0x3e0338){return new BPromise(function(_0x357b18,_0xbbee03){return client[_0x6767('0xb')](_0x36a9dd,_0x3e0338)[_0x6767('0xc')](function(_0x47bac3){logger[_0x6767('0xd')]('ZohoField,\x20%s,\x20%s',_0x3ad0cd,_0x6767('0xe'));logger[_0x6767('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x3ad0cd,_0x6767('0xe'),JSON[_0x6767('0x10')](_0x47bac3));if(_0x47bac3[_0x6767('0x11')]){if(_0x47bac3[_0x6767('0x11')]['code']===0x1f4){logger[_0x6767('0x11')](_0x6767('0x12'),_0x3ad0cd,_0x47bac3[_0x6767('0x11')]['message']);return _0xbbee03(_0x47bac3['error'][_0x6767('0x13')]);}logger['error'](_0x6767('0x12'),_0x3ad0cd,_0x47bac3[_0x6767('0x11')][_0x6767('0x13')]);return _0x357b18(_0x47bac3[_0x6767('0x11')][_0x6767('0x13')]);}else{logger[_0x6767('0xd')]('ZohoField,\x20%s,\x20%s',_0x3ad0cd,_0x6767('0xe'));_0x357b18(_0x47bac3['result']['message']);}})[_0x6767('0x14')](function(_0x2fed52){logger['error'](_0x6767('0x12'),_0x3ad0cd,_0x2fed52);_0xbbee03(_0x2fed52);});});}
\ No newline at end of file
index 7c08d96..8d09052 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router;
\ No newline at end of file
+var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x18c4bf,_0x56dfe5){var _0x5c9674=function(_0x46c6e9){while(--_0x46c6e9){_0x18c4bf['push'](_0x18c4bf['shift']());}};_0x5c9674(++_0x56dfe5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router;
\ No newline at end of file
index d0ebac4..4c3a176 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa356=['unique_name_and_version','STRING','app.js','INTEGER','exports'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xa356,0xdb));var _0x6a35=function(_0x22677d,_0x428ddf){_0x22677d=_0x22677d-0x0;var _0x7767d3=_0xa356[_0x22677d];return _0x7767d3;};'use strict';var Sequelize=require('sequelize');module[_0x6a35('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6a35('0x1')},'version':{'type':Sequelize[_0x6a35('0x2')],'allowNull':![],'unique':_0x6a35('0x1')},'main':{'type':Sequelize[_0x6a35('0x2')],'defaultValue':_0x6a35('0x3')},'filename':{'type':Sequelize[_0x6a35('0x2')]},'path':{'type':Sequelize[_0x6a35('0x2')]},'type':{'type':Sequelize[_0x6a35('0x2')]},'size':{'type':Sequelize[_0x6a35('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x6a35('0x2')]},'logo':{'type':Sequelize[_0x6a35('0x2')]},'state':{'type':Sequelize[_0x6a35('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x6a35('0x2')]},'title':{'type':Sequelize[_0x6a35('0x2')]},'remoteUri':{'type':Sequelize[_0x6a35('0x2')]},'link':{'type':Sequelize[_0x6a35('0x2')],'defaultValue':'#'}};
\ No newline at end of file
+var _0xe659=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','app.js'];(function(_0x1a31ef,_0x868a30){var _0x21df47=function(_0x5e7306){while(--_0x5e7306){_0x1a31ef['push'](_0x1a31ef['shift']());}};_0x21df47(++_0x868a30);}(_0xe659,0x8f));var _0x9e65=function(_0x2bd1aa,_0x2077aa){_0x2bd1aa=_0x2bd1aa-0x0;var _0x4bf239=_0xe659[_0x2bd1aa];return _0x4bf239;};'use strict';var Sequelize=require(_0x9e65('0x0'));module[_0x9e65('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x9e65('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x9e65('0x2')],'defaultValue':_0x9e65('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x9e65('0x2')]},'type':{'type':Sequelize[_0x9e65('0x2')]},'size':{'type':Sequelize[_0x9e65('0x4')]},'active':{'type':Sequelize[_0x9e65('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x9e65('0x2')],'unique':_0x9e65('0x6')},'description':{'type':Sequelize[_0x9e65('0x2')]},'title':{'type':Sequelize[_0x9e65('0x2')]},'remoteUri':{'type':Sequelize[_0x9e65('0x2')]},'link':{'type':Sequelize[_0x9e65('0x2')],'defaultValue':'#'}};
\ No newline at end of file
index 26efb4c..b1bef1f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1883=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Integration','includeAll','include','findAll','params','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x134ae2,_0x3f189b){var _0x2a687a=function(_0x370e32){while(--_0x370e32){_0x134ae2['push'](_0x134ae2['shift']());}};_0x2a687a(++_0x3f189b);}(_0x1883,0xab));var _0x3188=function(_0xe2a197,_0x23d029){_0xe2a197=_0xe2a197-0x0;var _0x3ccabe=_0x1883[_0xe2a197];return _0x3ccabe;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['Integration'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['Integration'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')](_0xe4cbb0[_0x3188('0x48')],{})[_0x3188('0x23')](respondWithResult(_0x315524,0xc9))[_0x3188('0x46')](handleError(_0x315524,null));};exports['update']=function(_0x50fd56,_0x1b012d){if(_0x50fd56['body']['id']){delete _0x50fd56[_0x3188('0x48')]['id'];}return db[_0x3188('0x41')]['find']({'where':{'id':_0x50fd56[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x1b012d,null))[_0x3188('0x23')](saveUpdates(_0x50fd56[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x1b012d,null))[_0x3188('0x46')](handleError(_0x1b012d,null));};exports[_0x3188('0x24')]=function(_0x1e3592,_0x59a177){return db[_0x3188('0x41')][_0x3188('0x49')]({'where':{'id':_0x1e3592['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x59a177,null))['then'](removeEntity(_0x59a177,null))[_0x3188('0x46')](handleError(_0x59a177,null));};
\ No newline at end of file
+var _0x1623=['model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','Integration','findAll','rows','catch','show','params','length','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x1623,0xab));var _0x3162=function(_0x50b2e5,_0x1d56e9){_0x50b2e5=_0x50b2e5-0x0;var _0x40a359=_0x1623[_0x50b2e5];return _0x40a359;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['Integration'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));};
\ No newline at end of file
index 05f2d77..9e80d24 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8466=['Integration','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./integration.attributes','define'];(function(_0x330ad9,_0x509891){var _0x1cb9aa=function(_0x53bbdd){while(--_0x53bbdd){_0x330ad9['push'](_0x330ad9['shift']());}};_0x1cb9aa(++_0x509891);}(_0x8466,0x105));var _0x6846=function(_0x5bc70b,_0x4b9793){_0x5bc70b=_0x5bc70b-0x0;var _0x1aead9=_0x8466[_0x5bc70b];return _0x1aead9;};'use strict';var _=require(_0x6846('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6846('0x1'));var moment=require(_0x6846('0x2'));var BPromise=require(_0x6846('0x3'));var rp=require(_0x6846('0x4'));var fs=require('fs');var path=require(_0x6846('0x5'));var rimraf=require('rimraf');var config=require(_0x6846('0x6'));var attributes=require(_0x6846('0x7'));module['exports']=function(_0x175915,_0x5652dc){return _0x175915[_0x6846('0x8')](_0x6846('0x9'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x64ea=['rimraf','../../config/environment','exports','define','Integration','integrations','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x64ea,0x103));var _0xa64e=function(_0x16fe4a,_0x566bcd){_0x16fe4a=_0x16fe4a-0x0;var _0x26a2bd=_0x64ea[_0x16fe4a];return _0x26a2bd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa64e('0x0'))('api');var moment=require(_0xa64e('0x1'));var BPromise=require(_0xa64e('0x2'));var rp=require(_0xa64e('0x3'));var fs=require('fs');var path=require(_0xa64e('0x4'));var rimraf=require(_0xa64e('0x5'));var config=require(_0xa64e('0x6'));var attributes=require('./integration.attributes');module[_0xa64e('0x7')]=function(_0x6c6f3,_0x16a010){return _0x6c6f3[_0xa64e('0x8')](_0xa64e('0x9'),attributes,{'tableName':_0xa64e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 914f280..9c7f29c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f0e=['../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x3205c0,_0x36e6a0){var _0x38995f=function(_0x592eac){while(--_0x592eac){_0x3205c0['push'](_0x3205c0['shift']());}};_0x38995f(++_0x36e6a0);}(_0x9f0e,0x116));var _0xe9f0=function(_0x4d5df3,_0x1d9fb0){_0x4d5df3=_0x4d5df3-0x0;var _0x316c8f=_0x9f0e[_0x4d5df3];return _0x316c8f;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('Integration,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});}
\ No newline at end of file
+var _0x0295=['client','http','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','Integration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x469379,_0x178028){var _0xbd5837=function(_0x33df70){while(--_0x33df70){_0x469379['push'](_0x469379['shift']());}};_0xbd5837(++_0x178028);}(_0x0295,0x1f0));var _0x5029=function(_0xa4a9b3,_0x3b271c){_0xa4a9b3=_0xa4a9b3-0x0;var _0xb7a49e=_0x0295[_0xa4a9b3];return _0xb7a49e;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('Integration,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});}
\ No newline at end of file
index 34f463e..07e4af7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x32be53,_0x50860d){var _0x10d08e=function(_0xed77bb){while(--_0xed77bb){_0x32be53['push'](_0x32be53['shift']());}};_0x10d08e(++_0x50860d);}(_0x9f0e,0x116));var _0xe9f0=function(_0x5a6fa5,_0x4ccb82){_0x5a6fa5=_0x5a6fa5-0x0;var _0x4f2b6b=_0x9f0e[_0x5a6fa5];return _0x4f2b6b;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router;
\ No newline at end of file
+var _0xc2c7=['/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x3be3b1,_0x1f8857){var _0x5e55df=function(_0x5cd4fe){while(--_0x5cd4fe){_0x3be3b1['push'](_0x3be3b1['shift']());}};_0x5e55df(++_0x1f8857);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3a571d,_0x40a7aa){_0x3a571d=_0x3a571d-0x0;var _0x35e4f0=_0xc2c7[_0x3a571d];return _0x35e4f0;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['post']('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);router[_0x7c2c('0x11')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x12')]);module[_0x7c2c('0x13')]=router;
\ No newline at end of file
index a53f612..e01d7f4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf781=['SENDING','RECEIVED','FAILED','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x1cf606,_0x2b7f57){var _0x3234a0=function(_0x3f5200){while(--_0x3f5200){_0x1cf606['push'](_0x1cf606['shift']());}};_0x3234a0(++_0x2b7f57);}(_0xf781,0x99));var _0x1f78=function(_0x16baa2,_0x486cb0){_0x16baa2=_0x16baa2-0x0;var _0x489f8c=_0xf781[_0x16baa2];return _0x489f8c;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x1f78('0x0')]},'eventChannel':{'type':Sequelize[_0x1f78('0x0')]},'exitStatus':{'type':Sequelize[_0x1f78('0x0')]},'ticketId':{'type':Sequelize[_0x1f78('0x0')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x1f78('0x0')]},'uniqueid':{'type':Sequelize[_0x1f78('0x0')]},'calleridnum':{'type':Sequelize[_0x1f78('0x0')]},'calleridname':{'type':Sequelize[_0x1f78('0x0')]},'queue':{'type':Sequelize[_0x1f78('0x0')]},'interface':{'type':Sequelize[_0x1f78('0x0')]},'membername':{'type':Sequelize[_0x1f78('0x0')]},'agentcalledAt':{'type':Sequelize[_0x1f78('0x1')]},'agentconnectAt':{'type':Sequelize[_0x1f78('0x1')]},'holdtime':{'type':Sequelize[_0x1f78('0x2')]},'agentcomplete':{'type':Sequelize[_0x1f78('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1f78('0x1')]},'talktime':{'type':Sequelize[_0x1f78('0x2')]},'agentacw':{'type':Sequelize[_0x1f78('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1f78('0x2')]},'reason':{'type':Sequelize[_0x1f78('0x0')]},'agentringnoanswer':{'type':Sequelize[_0x1f78('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1f78('0x1')]},'agentdump':{'type':Sequelize[_0x1f78('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1f78('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1f78('0x0')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1f78('0x0')]},'connectedlinenum':{'type':Sequelize[_0x1f78('0x0')]},'connectedlinename':{'type':Sequelize[_0x1f78('0x0')]},'language':{'type':Sequelize[_0x1f78('0x0')]},'accountcode':{'type':Sequelize[_0x1f78('0x0')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1f78('0x0')]},'priority':{'type':Sequelize[_0x1f78('0x0')]},'destchannel':{'type':Sequelize[_0x1f78('0x0')]},'destchannelstate':{'type':Sequelize[_0x1f78('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x1f78('0x0')]},'destcalleridname':{'type':Sequelize[_0x1f78('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x1f78('0x0')]},'destpriority':{'type':Sequelize[_0x1f78('0x0')]},'destuniqueid':{'type':Sequelize[_0x1f78('0x0')]},'messageId':{'type':Sequelize[_0x1f78('0x0')]},'inReplyTo':{'type':Sequelize[_0x1f78('0x0')]},'subject':{'type':Sequelize[_0x1f78('0x0')]},'from':{'type':Sequelize[_0x1f78('0x0')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x1f78('0x0')]},'attachment':{'type':Sequelize[_0x1f78('0x4')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x1f78('0x4')]},'status':{'type':Sequelize[_0x1f78('0x5')](_0x1f78('0x6'),_0x1f78('0x7'),_0x1f78('0x8'),_0x1f78('0x9'))},'url':{'type':Sequelize[_0x1f78('0x0')]},'app':{'type':Sequelize[_0x1f78('0x0')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
+var _0x438c=['FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED'];(function(_0x4e4eaf,_0x5a6d47){var _0x52ad47=function(_0x59e967){while(--_0x59e967){_0x4e4eaf['push'](_0x4e4eaf['shift']());}};_0x52ad47(++_0x5a6d47);}(_0x438c,0x85));var _0xc438=function(_0x4ffab2,_0x4d2b44){_0x4ffab2=_0x4ffab2-0x0;var _0x3350ac=_0x438c[_0x4ffab2];return _0x3350ac;};'use strict';var Sequelize=require(_0xc438('0x0'));module[_0xc438('0x1')]={'integration':{'type':Sequelize[_0xc438('0x2')]},'eventChannel':{'type':Sequelize[_0xc438('0x2')]},'exitStatus':{'type':Sequelize[_0xc438('0x2')]},'ticketId':{'type':Sequelize[_0xc438('0x2')]},'integrationId':{'type':Sequelize[_0xc438('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc438('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xc438('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xc438('0x4')]},'agentconnectAt':{'type':Sequelize[_0xc438('0x4')]},'holdtime':{'type':Sequelize[_0xc438('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc438('0x4')]},'talktime':{'type':Sequelize[_0xc438('0x3')]},'agentacw':{'type':Sequelize[_0xc438('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xc438('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xc438('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xc438('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc438('0x4')]},'lastevent':{'type':Sequelize[_0xc438('0x2')]},'channel':{'type':Sequelize[_0xc438('0x2')]},'channelstate':{'type':Sequelize[_0xc438('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc438('0x2')]},'connectedlinename':{'type':Sequelize[_0xc438('0x2')]},'language':{'type':Sequelize[_0xc438('0x2')]},'accountcode':{'type':Sequelize[_0xc438('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc438('0x2')]},'priority':{'type':Sequelize[_0xc438('0x2')]},'destchannel':{'type':Sequelize[_0xc438('0x2')]},'destchannelstate':{'type':Sequelize[_0xc438('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xc438('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc438('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc438('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc438('0x2')]},'destlanguage':{'type':Sequelize[_0xc438('0x2')]},'destaccountcode':{'type':Sequelize[_0xc438('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xc438('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xc438('0x2')]},'messageId':{'type':Sequelize[_0xc438('0x2')]},'inReplyTo':{'type':Sequelize[_0xc438('0x2')]},'subject':{'type':Sequelize[_0xc438('0x2')]},'from':{'type':Sequelize[_0xc438('0x2')]},'to':{'type':Sequelize[_0xc438('0x2')]},'cc':{'type':Sequelize[_0xc438('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xc438('0x6')]},'text':{'type':Sequelize[_0xc438('0x6')]},'status':{'type':Sequelize[_0xc438('0x7')](_0xc438('0x8'),_0xc438('0x9'),_0xc438('0xa'),_0xc438('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xc438('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xc438('0x3')]}};
\ No newline at end of file
index bd386ef..e1ab9a6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x67ce=['sox','to-csv','ejs','fs-extra','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','sendStatus','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','options','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','util'];(function(_0x22408f,_0x4436b1){var _0x48d13d=function(_0x522ff3){while(--_0x522ff3){_0x22408f['push'](_0x22408f['shift']());}};_0x48d13d(++_0x4436b1);}(_0x67ce,0xc1));var _0xe67c=function(_0x248846,_0x359e00){_0x248846=_0x248846-0x0;var _0x4c3dca=_0x67ce[_0x248846];return _0x4c3dca;};'use strict';var emlformat=require(_0xe67c('0x0'));var rimraf=require(_0xe67c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe67c('0x2'));var rp=require(_0xe67c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe67c('0x4'));var path=require('path');var sox=require(_0xe67c('0x5'));var csv=require(_0xe67c('0x6'));var ejs=require(_0xe67c('0x7'));var fs=require('fs');var fs_extra=require(_0xe67c('0x8'));var _=require('lodash');var squel=require(_0xe67c('0x9'));var crypto=require('crypto');var jsforce=require(_0xe67c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xe67c('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe67c('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xe67c('0xc'));var as=require(_0xe67c('0xd'));var hardwareService=require(_0xe67c('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0xe67c('0xf'));var config=require(_0xe67c('0x10'));var licenseUtil=require(_0xe67c('0x11'));var db=require(_0xe67c('0x12'))['db'];function respondWithStatusCode(_0x1aae8d,_0x149446){_0x149446=_0x149446||0xcc;return function(_0x17a677){if(_0x17a677){return _0x1aae8d['sendStatus'](_0x149446);}return _0x1aae8d['status'](_0x149446)[_0xe67c('0x13')]();};}function respondWithResult(_0x29346a,_0x126841){_0x126841=_0x126841||0xc8;return function(_0x36c520){if(_0x36c520){return _0x29346a[_0xe67c('0x14')](_0x126841)['json'](_0x36c520);}};}function respondWithFilteredResult(_0x552288,_0x2fff19){return function(_0x536fed){if(_0x536fed){var _0x19a04f=typeof _0x2fff19[_0xe67c('0x15')]===_0xe67c('0x16')&&typeof _0x2fff19[_0xe67c('0x17')]==='undefined';var _0x1f4d7b=_0x536fed[_0xe67c('0x18')];var _0x28ae51=_0x19a04f?0x0:_0x2fff19['offset'];var _0xb8b3b0=_0x19a04f?_0x536fed[_0xe67c('0x18')]:_0x2fff19['offset']+_0x2fff19['limit'];var _0x53c23b;if(_0xb8b3b0>=_0x1f4d7b){_0xb8b3b0=_0x1f4d7b;_0x53c23b=0xc8;}else{_0x53c23b=0xce;}_0x552288['status'](_0x53c23b);return _0x552288[_0xe67c('0x19')]('Content-Range',_0x28ae51+'-'+_0xb8b3b0+'/'+_0x1f4d7b)[_0xe67c('0x1a')](_0x536fed);}return null;};}function patchUpdates(_0x23a140){return function(_0x182382){try{jsonpatch[_0xe67c('0x1b')](_0x182382,_0x23a140,!![]);}catch(_0x38929c){return BPromise['reject'](_0x38929c);}return _0x182382[_0xe67c('0x1c')]();};}function saveUpdates(_0xb1928f,_0x12cc8c){return function(_0x38469f){if(_0x38469f){return _0x38469f[_0xe67c('0x1d')](_0xb1928f)[_0xe67c('0x1e')](function(_0x4ca248){return _0x4ca248;});}return null;};}function removeEntity(_0x586cfd,_0x186618){return function(_0x102918){if(_0x102918){return _0x102918[_0xe67c('0x1f')]()[_0xe67c('0x1e')](function(){_0x586cfd[_0xe67c('0x14')](0xcc)[_0xe67c('0x13')]();});}};}function handleEntityNotFound(_0x3925c4,_0x550742){return function(_0x6c27a8){if(!_0x6c27a8){_0x3925c4[_0xe67c('0x20')](0x194);}return _0x6c27a8;};}function handleError(_0x2a7e89,_0x5c2d30){_0x5c2d30=_0x5c2d30||0x1f4;return function(_0x372842){logger['error'](_0x372842['stack']);if(_0x372842[_0xe67c('0x21')]){delete _0x372842[_0xe67c('0x21')];}_0x2a7e89[_0xe67c('0x14')](_0x5c2d30)[_0xe67c('0x22')](_0x372842);};}exports[_0xe67c('0x23')]=function(_0x3226cd,_0x37e588){var _0x597c58={},_0x533718={},_0x5a3006={'count':0x0,'rows':[]};var _0xbaba0=_[_0xe67c('0x24')](db[_0xe67c('0x25')][_0xe67c('0x26')],function(_0x1012b7){return{'name':_0x1012b7[_0xe67c('0x27')],'type':_0x1012b7[_0xe67c('0x28')]['key']};});_0x533718[_0xe67c('0x29')]=_['map'](_0xbaba0,_0xe67c('0x21'));_0x533718[_0xe67c('0x2a')]=_[_0xe67c('0x2b')](_0x3226cd['query']);_0x533718[_0xe67c('0x2c')]=_['intersection'](_0x533718[_0xe67c('0x29')],_0x533718[_0xe67c('0x2a')]);_0x597c58[_0xe67c('0x2d')]=_['intersection'](_0x533718[_0xe67c('0x29')],qs[_0xe67c('0x2e')](_0x3226cd[_0xe67c('0x2a')]['fields']));_0x597c58[_0xe67c('0x2d')]=_0x597c58[_0xe67c('0x2d')]['length']?_0x597c58['attributes']:_0x533718[_0xe67c('0x29')];if(!_0x3226cd[_0xe67c('0x2a')]['hasOwnProperty'](_0xe67c('0x2f'))){_0x597c58['limit']=qs[_0xe67c('0x17')](_0x3226cd[_0xe67c('0x2a')][_0xe67c('0x17')]);_0x597c58['offset']=qs['offset'](_0x3226cd[_0xe67c('0x2a')][_0xe67c('0x15')]);}_0x597c58[_0xe67c('0x30')]=qs['sort'](_0x3226cd[_0xe67c('0x2a')][_0xe67c('0x31')]);_0x597c58[_0xe67c('0x32')]=qs[_0xe67c('0x2c')](_[_0xe67c('0x33')](_0x3226cd[_0xe67c('0x2a')],_0x533718[_0xe67c('0x2c')]),_0xbaba0);if(_0x3226cd['query'][_0xe67c('0x34')]){_0x597c58['where']=_[_0xe67c('0x35')](_0x597c58[_0xe67c('0x32')],{'$or':_[_0xe67c('0x24')](_0xbaba0,function(_0x250b7e){if(_0x250b7e[_0xe67c('0x28')]!==_0xe67c('0x36')){var _0x506802={};_0x506802[_0x250b7e['name']]={'$like':'%'+_0x3226cd[_0xe67c('0x2a')][_0xe67c('0x34')]+'%'};return _0x506802;}})});}_0x597c58=_[_0xe67c('0x35')]({},_0x597c58,_0x3226cd['options']);var _0x1d8dd4={'where':_0x597c58[_0xe67c('0x32')]};return db['IntegrationReport'][_0xe67c('0x18')](_0x1d8dd4)[_0xe67c('0x1e')](function(_0x53c4d0){_0x5a3006[_0xe67c('0x18')]=_0x53c4d0;if(_0x3226cd['query'][_0xe67c('0x37')]){_0x597c58['include']=[{'all':!![]}];}return db[_0xe67c('0x25')][_0xe67c('0x38')](_0x597c58);})[_0xe67c('0x1e')](function(_0x539e9f){_0x5a3006[_0xe67c('0x39')]=_0x539e9f;return _0x5a3006;})['then'](respondWithFilteredResult(_0x37e588,_0x597c58))['catch'](handleError(_0x37e588,null));};exports[_0xe67c('0x3a')]=function(_0x192834,_0x120610){var _0x529a17={'raw':![],'where':{'id':_0x192834['params']['id']}},_0x8faef3={};_0x8faef3[_0xe67c('0x29')]=_['keys'](db['IntegrationReport'][_0xe67c('0x26')]);_0x8faef3['query']=_['keys'](_0x192834[_0xe67c('0x2a')]);_0x8faef3[_0xe67c('0x2c')]=_['intersection'](_0x8faef3[_0xe67c('0x29')],_0x8faef3[_0xe67c('0x2a')]);_0x529a17[_0xe67c('0x2d')]=_['intersection'](_0x8faef3[_0xe67c('0x29')],qs[_0xe67c('0x2e')](_0x192834[_0xe67c('0x2a')][_0xe67c('0x2e')]));_0x529a17[_0xe67c('0x2d')]=_0x529a17[_0xe67c('0x2d')]['length']?_0x529a17[_0xe67c('0x2d')]:_0x8faef3[_0xe67c('0x29')];if(_0x192834['query'][_0xe67c('0x37')]){_0x529a17['include']=[{'all':!![]}];}_0x529a17=_[_0xe67c('0x35')]({},_0x529a17,_0x192834[_0xe67c('0x3b')]);return db[_0xe67c('0x25')][_0xe67c('0x3c')](_0x529a17)[_0xe67c('0x1e')](handleEntityNotFound(_0x120610,null))[_0xe67c('0x1e')](respondWithResult(_0x120610,null))[_0xe67c('0x3d')](handleError(_0x120610,null));};exports[_0xe67c('0x3e')]=function(_0x2262e4,_0x41b27d){return db[_0xe67c('0x25')][_0xe67c('0x3e')](_0x2262e4[_0xe67c('0x3f')],{})['then'](respondWithResult(_0x41b27d,0xc9))['catch'](handleError(_0x41b27d,null));};exports[_0xe67c('0x1d')]=function(_0x5234dd,_0xe7bbb1){if(_0x5234dd[_0xe67c('0x3f')]['id']){delete _0x5234dd[_0xe67c('0x3f')]['id'];}return db[_0xe67c('0x25')]['find']({'where':{'id':_0x5234dd['params']['id']}})[_0xe67c('0x1e')](handleEntityNotFound(_0xe7bbb1,null))['then'](saveUpdates(_0x5234dd[_0xe67c('0x3f')],null))[_0xe67c('0x1e')](respondWithResult(_0xe7bbb1,null))[_0xe67c('0x3d')](handleError(_0xe7bbb1,null));};exports[_0xe67c('0x1f')]=function(_0x2e20ec,_0x5b8690){return db[_0xe67c('0x25')][_0xe67c('0x3c')]({'where':{'id':_0x2e20ec[_0xe67c('0x40')]['id']}})[_0xe67c('0x1e')](handleEntityNotFound(_0x5b8690,null))[_0xe67c('0x1e')](removeEntity(_0x5b8690,null))[_0xe67c('0x3d')](handleError(_0x5b8690,null));};exports[_0xe67c('0x41')]=function(_0xae2e1b,_0xdf6722){return db[_0xe67c('0x25')][_0xe67c('0x41')]()[_0xe67c('0x1e')](respondWithResult(_0xdf6722,null))[_0xe67c('0x3d')](handleError(_0xdf6722,null));};
\ No newline at end of file
+var _0x4ebb=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','IntegrationReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','show','include','find','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x11262c,_0x20d80b){var _0x23977b=function(_0x273f88){while(--_0x273f88){_0x11262c['push'](_0x11262c['shift']());}};_0x23977b(++_0x20d80b);}(_0x4ebb,0x99));var _0xb4eb=function(_0x402829,_0x38f9eb){_0x402829=_0x402829-0x0;var _0x3d36f8=_0x4ebb[_0x402829];return _0x3d36f8;};'use strict';var emlformat=require(_0xb4eb('0x0'));var rimraf=require(_0xb4eb('0x1'));var zipdir=require(_0xb4eb('0x2'));var jsonpatch=require(_0xb4eb('0x3'));var rp=require(_0xb4eb('0x4'));var moment=require(_0xb4eb('0x5'));var BPromise=require(_0xb4eb('0x6'));var Mustache=require(_0xb4eb('0x7'));var util=require(_0xb4eb('0x8'));var path=require(_0xb4eb('0x9'));var sox=require('sox');var csv=require(_0xb4eb('0xa'));var ejs=require(_0xb4eb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb4eb('0xc'));var crypto=require('crypto');var jsforce=require(_0xb4eb('0xd'));var deskjs=require(_0xb4eb('0xe'));var toCsv=require(_0xb4eb('0xa'));var querystring=require(_0xb4eb('0xf'));var Papa=require('papaparse');var Redis=require(_0xb4eb('0x10'));var authService=require(_0xb4eb('0x11'));var qs=require(_0xb4eb('0x12'));var as=require(_0xb4eb('0x13'));var hardwareService=require(_0xb4eb('0x14'));var logger=require(_0xb4eb('0x15'))(_0xb4eb('0x16'));var utils=require(_0xb4eb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb4eb('0x18'));var db=require(_0xb4eb('0x19'))['db'];function respondWithStatusCode(_0x59e84e,_0x50ce66){_0x50ce66=_0x50ce66||0xcc;return function(_0x4528ef){if(_0x4528ef){return _0x59e84e[_0xb4eb('0x1a')](_0x50ce66);}return _0x59e84e[_0xb4eb('0x1b')](_0x50ce66)[_0xb4eb('0x1c')]();};}function respondWithResult(_0x379aa3,_0x414554){_0x414554=_0x414554||0xc8;return function(_0x5e04c2){if(_0x5e04c2){return _0x379aa3[_0xb4eb('0x1b')](_0x414554)[_0xb4eb('0x1d')](_0x5e04c2);}};}function respondWithFilteredResult(_0x1e9cce,_0x3a0d31){return function(_0x5e3af9){if(_0x5e3af9){var _0xd44c70=typeof _0x3a0d31[_0xb4eb('0x1e')]===_0xb4eb('0x1f')&&typeof _0x3a0d31[_0xb4eb('0x20')]==='undefined';var _0x25e21d=_0x5e3af9[_0xb4eb('0x21')];var _0x2c2863=_0xd44c70?0x0:_0x3a0d31[_0xb4eb('0x1e')];var _0x9e7893=_0xd44c70?_0x5e3af9[_0xb4eb('0x21')]:_0x3a0d31[_0xb4eb('0x1e')]+_0x3a0d31['limit'];var _0x18b055;if(_0x9e7893>=_0x25e21d){_0x9e7893=_0x25e21d;_0x18b055=0xc8;}else{_0x18b055=0xce;}_0x1e9cce['status'](_0x18b055);return _0x1e9cce['set'](_0xb4eb('0x22'),_0x2c2863+'-'+_0x9e7893+'/'+_0x25e21d)[_0xb4eb('0x1d')](_0x5e3af9);}return null;};}function patchUpdates(_0x2ac360){return function(_0x2ab4e3){try{jsonpatch[_0xb4eb('0x23')](_0x2ab4e3,_0x2ac360,!![]);}catch(_0x49c052){return BPromise[_0xb4eb('0x24')](_0x49c052);}return _0x2ab4e3[_0xb4eb('0x25')]();};}function saveUpdates(_0x55272e,_0xb32b21){return function(_0x4758a9){if(_0x4758a9){return _0x4758a9[_0xb4eb('0x26')](_0x55272e)['then'](function(_0x334f90){return _0x334f90;});}return null;};}function removeEntity(_0x89046d,_0x4a3325){return function(_0x27b1e3){if(_0x27b1e3){return _0x27b1e3['destroy']()[_0xb4eb('0x27')](function(){_0x89046d['status'](0xcc)[_0xb4eb('0x1c')]();});}};}function handleEntityNotFound(_0x19925f,_0xbcfffb){return function(_0x53d923){if(!_0x53d923){_0x19925f[_0xb4eb('0x1a')](0x194);}return _0x53d923;};}function handleError(_0x407dd5,_0x553c46){_0x553c46=_0x553c46||0x1f4;return function(_0x37085e){logger[_0xb4eb('0x28')](_0x37085e[_0xb4eb('0x29')]);if(_0x37085e[_0xb4eb('0x2a')]){delete _0x37085e[_0xb4eb('0x2a')];}_0x407dd5[_0xb4eb('0x1b')](_0x553c46)[_0xb4eb('0x2b')](_0x37085e);};}exports[_0xb4eb('0x2c')]=function(_0x5158b4,_0x564d36){var _0x56137b={},_0x15e6b0={},_0xe0ea5f={'count':0x0,'rows':[]};var _0x3f8c74=_['map'](db[_0xb4eb('0x2d')][_0xb4eb('0x2e')],function(_0x5d5c64){return{'name':_0x5d5c64['fieldName'],'type':_0x5d5c64[_0xb4eb('0x2f')][_0xb4eb('0x30')]};});_0x15e6b0[_0xb4eb('0x31')]=_[_0xb4eb('0x32')](_0x3f8c74,_0xb4eb('0x2a'));_0x15e6b0[_0xb4eb('0x33')]=_[_0xb4eb('0x34')](_0x5158b4[_0xb4eb('0x33')]);_0x15e6b0[_0xb4eb('0x35')]=_[_0xb4eb('0x36')](_0x15e6b0[_0xb4eb('0x31')],_0x15e6b0[_0xb4eb('0x33')]);_0x56137b[_0xb4eb('0x37')]=_[_0xb4eb('0x36')](_0x15e6b0[_0xb4eb('0x31')],qs[_0xb4eb('0x38')](_0x5158b4[_0xb4eb('0x33')]['fields']));_0x56137b[_0xb4eb('0x37')]=_0x56137b[_0xb4eb('0x37')][_0xb4eb('0x39')]?_0x56137b[_0xb4eb('0x37')]:_0x15e6b0[_0xb4eb('0x31')];if(!_0x5158b4[_0xb4eb('0x33')][_0xb4eb('0x3a')](_0xb4eb('0x3b'))){_0x56137b['limit']=qs[_0xb4eb('0x20')](_0x5158b4[_0xb4eb('0x33')][_0xb4eb('0x20')]);_0x56137b[_0xb4eb('0x1e')]=qs[_0xb4eb('0x1e')](_0x5158b4[_0xb4eb('0x33')][_0xb4eb('0x1e')]);}_0x56137b[_0xb4eb('0x3c')]=qs['sort'](_0x5158b4[_0xb4eb('0x33')][_0xb4eb('0x3d')]);_0x56137b[_0xb4eb('0x3e')]=qs[_0xb4eb('0x35')](_[_0xb4eb('0x3f')](_0x5158b4[_0xb4eb('0x33')],_0x15e6b0[_0xb4eb('0x35')]),_0x3f8c74);if(_0x5158b4['query'][_0xb4eb('0x40')]){_0x56137b[_0xb4eb('0x3e')]=_[_0xb4eb('0x41')](_0x56137b[_0xb4eb('0x3e')],{'$or':_[_0xb4eb('0x32')](_0x3f8c74,function(_0x5b5177){if(_0x5b5177[_0xb4eb('0x2f')]!=='VIRTUAL'){var _0x20d20b={};_0x20d20b[_0x5b5177[_0xb4eb('0x2a')]]={'$like':'%'+_0x5158b4[_0xb4eb('0x33')][_0xb4eb('0x40')]+'%'};return _0x20d20b;}})});}_0x56137b=_[_0xb4eb('0x41')]({},_0x56137b,_0x5158b4[_0xb4eb('0x42')]);var _0x3e32fa={'where':_0x56137b[_0xb4eb('0x3e')]};return db[_0xb4eb('0x2d')][_0xb4eb('0x21')](_0x3e32fa)[_0xb4eb('0x27')](function(_0x329c80){_0xe0ea5f[_0xb4eb('0x21')]=_0x329c80;if(_0x5158b4['query'][_0xb4eb('0x43')]){_0x56137b['include']=[{'all':!![]}];}return db[_0xb4eb('0x2d')][_0xb4eb('0x44')](_0x56137b);})['then'](function(_0x1242f6){_0xe0ea5f['rows']=_0x1242f6;return _0xe0ea5f;})[_0xb4eb('0x27')](respondWithFilteredResult(_0x564d36,_0x56137b))['catch'](handleError(_0x564d36,null));};exports[_0xb4eb('0x45')]=function(_0x1093af,_0x2f31ab){var _0x2b8ded={'raw':![],'where':{'id':_0x1093af['params']['id']}},_0x1b8c1d={};_0x1b8c1d[_0xb4eb('0x31')]=_['keys'](db[_0xb4eb('0x2d')][_0xb4eb('0x2e')]);_0x1b8c1d[_0xb4eb('0x33')]=_['keys'](_0x1093af[_0xb4eb('0x33')]);_0x1b8c1d[_0xb4eb('0x35')]=_[_0xb4eb('0x36')](_0x1b8c1d[_0xb4eb('0x31')],_0x1b8c1d[_0xb4eb('0x33')]);_0x2b8ded[_0xb4eb('0x37')]=_[_0xb4eb('0x36')](_0x1b8c1d['model'],qs[_0xb4eb('0x38')](_0x1093af['query'][_0xb4eb('0x38')]));_0x2b8ded[_0xb4eb('0x37')]=_0x2b8ded['attributes']['length']?_0x2b8ded[_0xb4eb('0x37')]:_0x1b8c1d[_0xb4eb('0x31')];if(_0x1093af['query']['includeAll']){_0x2b8ded[_0xb4eb('0x46')]=[{'all':!![]}];}_0x2b8ded=_['merge']({},_0x2b8ded,_0x1093af['options']);return db[_0xb4eb('0x2d')][_0xb4eb('0x47')](_0x2b8ded)[_0xb4eb('0x27')](handleEntityNotFound(_0x2f31ab,null))[_0xb4eb('0x27')](respondWithResult(_0x2f31ab,null))[_0xb4eb('0x48')](handleError(_0x2f31ab,null));};exports[_0xb4eb('0x49')]=function(_0x91de0f,_0xe12497){return db[_0xb4eb('0x2d')][_0xb4eb('0x49')](_0x91de0f[_0xb4eb('0x4a')],{})['then'](respondWithResult(_0xe12497,0xc9))[_0xb4eb('0x48')](handleError(_0xe12497,null));};exports[_0xb4eb('0x26')]=function(_0x5d226d,_0x571ca0){if(_0x5d226d['body']['id']){delete _0x5d226d[_0xb4eb('0x4a')]['id'];}return db[_0xb4eb('0x2d')][_0xb4eb('0x47')]({'where':{'id':_0x5d226d[_0xb4eb('0x4b')]['id']}})[_0xb4eb('0x27')](handleEntityNotFound(_0x571ca0,null))[_0xb4eb('0x27')](saveUpdates(_0x5d226d[_0xb4eb('0x4a')],null))['then'](respondWithResult(_0x571ca0,null))[_0xb4eb('0x48')](handleError(_0x571ca0,null));};exports[_0xb4eb('0x4c')]=function(_0x5cf644,_0x29d2c8){return db[_0xb4eb('0x2d')][_0xb4eb('0x47')]({'where':{'id':_0x5cf644['params']['id']}})[_0xb4eb('0x27')](handleEntityNotFound(_0x29d2c8,null))[_0xb4eb('0x27')](removeEntity(_0x29d2c8,null))[_0xb4eb('0x48')](handleError(_0x29d2c8,null));};exports[_0xb4eb('0x4d')]=function(_0x4e3f49,_0x5ccca1){return db[_0xb4eb('0x2d')][_0xb4eb('0x4d')]()[_0xb4eb('0x27')](respondWithResult(_0x5ccca1,null))[_0xb4eb('0x48')](handleError(_0x5ccca1,null));};
\ No newline at end of file
index 1ec6ce2..d6294e7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc786=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','IntegrationReport','lodash','util'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc786,0x166));var _0x6c78=function(_0x3a7bac,_0x1681ad){_0x3a7bac=_0x3a7bac-0x0;var _0x3f74c5=_0xc786[_0x3a7bac];return _0x3f74c5;};'use strict';var _=require(_0x6c78('0x0'));var util=require(_0x6c78('0x1'));var logger=require(_0x6c78('0x2'))(_0x6c78('0x3'));var moment=require('moment');var BPromise=require(_0x6c78('0x4'));var rp=require(_0x6c78('0x5'));var fs=require('fs');var path=require(_0x6c78('0x6'));var rimraf=require(_0x6c78('0x7'));var config=require(_0x6c78('0x8'));var attributes=require('./integrationReport.attributes');module[_0x6c78('0x9')]=function(_0x399575,_0x1b37b4){return _0x399575[_0x6c78('0xa')](_0x6c78('0xb'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x993a=['IntegrationReport','report_integration','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x4ccad7,_0x2daf62){var _0x3a1bc0=function(_0x179659){while(--_0x179659){_0x4ccad7['push'](_0x4ccad7['shift']());}};_0x3a1bc0(++_0x2daf62);}(_0x993a,0x1ec));var _0xa993=function(_0x7befca,_0x4f0e7b){_0x7befca=_0x7befca-0x0;var _0x3f4080=_0x993a[_0x7befca];return _0x3f4080;};'use strict';var _=require(_0xa993('0x0'));var util=require(_0xa993('0x1'));var logger=require('../../config/logger')(_0xa993('0x2'));var moment=require('moment');var BPromise=require(_0xa993('0x3'));var rp=require(_0xa993('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa993('0x5'));var config=require(_0xa993('0x6'));var attributes=require(_0xa993('0x7'));module['exports']=function(_0x1b4a2c,_0x572f0e){return _0x1b4a2c['define'](_0xa993('0x8'),attributes,{'tableName':_0xa993('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index de93e88..685c34e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2fffff,_0x415518){_0x2fffff=_0x2fffff-0x0;var _0x4f2a2c=_0x3f8a[_0x2fffff];return _0x4f2a2c;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('IntegrationReport,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});}
\ No newline at end of file
+var _0x814b=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x814b,0x1a2));var _0xb814=function(_0x54fbff,_0x53470e){_0x54fbff=_0x54fbff-0x0;var _0x5cf619=_0x814b[_0x54fbff];return _0x5cf619;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}
\ No newline at end of file
index 0b1699c..51f07c1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc99e=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','update','exports','multer','util','path','connect-timeout','express'];(function(_0x3bcf9e,_0x148a5d){var _0x1bb37c=function(_0xcaf5da){while(--_0xcaf5da){_0x3bcf9e['push'](_0x3bcf9e['shift']());}};_0x1bb37c(++_0x148a5d);}(_0xc99e,0x6e));var _0xec99=function(_0x2dac3f,_0xbe0e3b){_0x2dac3f=_0x2dac3f-0x0;var _0x24e6e7=_0xc99e[_0x2dac3f];return _0x24e6e7;};'use strict';var multer=require(_0xec99('0x0'));var util=require(_0xec99('0x1'));var path=require(_0xec99('0x2'));var timeout=require(_0xec99('0x3'));var express=require(_0xec99('0x4'));var router=express[_0xec99('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xec99('0x6'));var interaction=require(_0xec99('0x7'));var config=require(_0xec99('0x8'));var controller=require(_0xec99('0x9'));router[_0xec99('0xa')]('/',auth[_0xec99('0xb')](),controller[_0xec99('0xc')]);router[_0xec99('0xa')]('/:id',auth[_0xec99('0xb')](),controller[_0xec99('0xd')]);router['get'](_0xec99('0xe'),auth[_0xec99('0xb')](),controller['getIntervals']);router['post']('/',auth[_0xec99('0xb')](),controller[_0xec99('0xf')]);router[_0xec99('0x10')]('/:id/sub_intervals',auth[_0xec99('0xb')](),controller[_0xec99('0x11')]);router[_0xec99('0x10')](_0xec99('0x12'),auth[_0xec99('0xb')](),controller[_0xec99('0x13')]);router['put'](_0xec99('0x14'),auth['isAuthenticated'](),controller[_0xec99('0x15')]);router['delete'](_0xec99('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0xec99('0x16')]=router;
\ No newline at end of file
+var _0x9ed7=['update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','show','/:id/sub_intervals','post','addInterval','addIntervals','put'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0x9ed7,0x1a6));var _0x79ed=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0x9ed7[_0x54a761];return _0x37d1da;};'use strict';var multer=require(_0x79ed('0x0'));var util=require(_0x79ed('0x1'));var path=require(_0x79ed('0x2'));var timeout=require('connect-timeout');var express=require(_0x79ed('0x3'));var router=express['Router']();var fs_extra=require(_0x79ed('0x4'));var auth=require(_0x79ed('0x5'));var interaction=require(_0x79ed('0x6'));var config=require(_0x79ed('0x7'));var controller=require(_0x79ed('0x8'));router[_0x79ed('0x9')]('/',auth[_0x79ed('0xa')](),controller['index']);router[_0x79ed('0x9')](_0x79ed('0xb'),auth[_0x79ed('0xa')](),controller[_0x79ed('0xc')]);router[_0x79ed('0x9')](_0x79ed('0xd'),auth[_0x79ed('0xa')](),controller['getIntervals']);router[_0x79ed('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x79ed('0xd'),auth[_0x79ed('0xa')](),controller[_0x79ed('0xf')]);router[_0x79ed('0xe')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x79ed('0x10')]);router[_0x79ed('0x11')](_0x79ed('0xb'),auth['isAuthenticated'](),controller[_0x79ed('0x12')]);router[_0x79ed('0x13')](_0x79ed('0xb'),auth[_0x79ed('0xa')](),controller[_0x79ed('0x14')]);module[_0x79ed('0x15')]=router;
\ No newline at end of file
index 0184a49..a4e862a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3c61=['exports','STRING','sequelize'];(function(_0x469a2d,_0x53bcbe){var _0x148147=function(_0xe46eea){while(--_0xe46eea){_0x469a2d['push'](_0x469a2d['shift']());}};_0x148147(++_0x53bcbe);}(_0x3c61,0xbc));var _0x13c6=function(_0x2009bd,_0x236841){_0x2009bd=_0x2009bd-0x0;var _0x2d591c=_0x3c61[_0x2009bd];return _0x2d591c;};'use strict';var Sequelize=require(_0x13c6('0x0'));module[_0x13c6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x13c6('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}};
\ No newline at end of file
+var _0x2640=['sequelize','exports','STRING'];(function(_0x5638f6,_0x5d4566){var _0x4cd63e=function(_0x4fa1f9){while(--_0x4fa1f9){_0x5638f6['push'](_0x5638f6['shift']());}};_0x4cd63e(++_0x5d4566);}(_0x2640,0x156));var _0x0264=function(_0x5cd1f1,_0x1458c1){_0x5cd1f1=_0x5cd1f1-0x0;var _0xe428af=_0x2640[_0x5cd1f1];return _0xe428af;};'use strict';var Sequelize=require(_0x0264('0x0'));module[_0x0264('0x1')]={'name':{'type':Sequelize[_0x0264('0x2')]},'description':{'type':Sequelize[_0x0264('0x2')]},'interval':{'type':Sequelize[_0x0264('0x2')],'allowNull':!![]}};
\ No newline at end of file
index e68dfe9..e7f5f4d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc537=['user','Intervals','UserProfileSection','UserProfileResource','body','addInterval','IntervalId','getIntervals','findOne','order','options','addIntervals','sequelize','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','offset','limit','count','set','reject','save','update','then','destroy','end','error','stack','name','Interval','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','merge','map','VIRTUAL','filter','include','findAll','catch','show','params','includeAll','find','create','get'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc537,0x19d));var _0x7c53=function(_0xdab462,_0x584c6d){_0xdab462=_0xdab462-0x0;var _0x35472d=_0xc537[_0xdab462];return _0x35472d;};'use strict';var emlformat=require(_0x7c53('0x0'));var rimraf=require(_0x7c53('0x1'));var zipdir=require(_0x7c53('0x2'));var jsonpatch=require(_0x7c53('0x3'));var rp=require(_0x7c53('0x4'));var moment=require(_0x7c53('0x5'));var BPromise=require(_0x7c53('0x6'));var Mustache=require(_0x7c53('0x7'));var util=require('util');var path=require(_0x7c53('0x8'));var sox=require('sox');var csv=require(_0x7c53('0x9'));var ejs=require(_0x7c53('0xa'));var fs=require('fs');var fs_extra=require(_0x7c53('0xb'));var _=require(_0x7c53('0xc'));var squel=require('squel');var crypto=require(_0x7c53('0xd'));var jsforce=require(_0x7c53('0xe'));var deskjs=require(_0x7c53('0xf'));var toCsv=require(_0x7c53('0x9'));var querystring=require(_0x7c53('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7c53('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7c53('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c53('0x13'))('api');var utils=require(_0x7c53('0x14'));var config=require(_0x7c53('0x15'));var licenseUtil=require(_0x7c53('0x16'));var db=require(_0x7c53('0x17'))['db'];var extensions=require(_0x7c53('0x18'));function respondWithStatusCode(_0x4e6116,_0x5442af){_0x5442af=_0x5442af||0xcc;return function(_0x2c8ad8){if(_0x2c8ad8){return _0x4e6116['sendStatus'](_0x5442af);}return _0x4e6116[_0x7c53('0x19')](_0x5442af)['end']();};}function respondWithResult(_0x31be1e,_0x4bf922){_0x4bf922=_0x4bf922||0xc8;return function(_0x578f25){if(_0x578f25){return _0x31be1e[_0x7c53('0x19')](_0x4bf922)[_0x7c53('0x1a')](_0x578f25);}};}function respondWithFilteredResult(_0x16fa01,_0x2dd968){return function(_0x33106f){if(_0x33106f){var _0x42cd23=typeof _0x2dd968[_0x7c53('0x1b')]==='undefined'&&typeof _0x2dd968[_0x7c53('0x1c')]==='undefined';var _0x4074ab=_0x33106f[_0x7c53('0x1d')];var _0x44fb53=_0x42cd23?0x0:_0x2dd968[_0x7c53('0x1b')];var _0x30339f=_0x42cd23?_0x33106f[_0x7c53('0x1d')]:_0x2dd968['offset']+_0x2dd968[_0x7c53('0x1c')];var _0xdc3043;if(_0x30339f>=_0x4074ab){_0x30339f=_0x4074ab;_0xdc3043=0xc8;}else{_0xdc3043=0xce;}_0x16fa01['status'](_0xdc3043);return _0x16fa01[_0x7c53('0x1e')]('Content-Range',_0x44fb53+'-'+_0x30339f+'/'+_0x4074ab)[_0x7c53('0x1a')](_0x33106f);}return null;};}function patchUpdates(_0x40bf1f){return function(_0x10bbc9){try{jsonpatch['apply'](_0x10bbc9,_0x40bf1f,!![]);}catch(_0x2b052b){return BPromise[_0x7c53('0x1f')](_0x2b052b);}return _0x10bbc9[_0x7c53('0x20')]();};}function saveUpdates(_0x407efd,_0xbefef1){return function(_0xc170b8){if(_0xc170b8){return _0xc170b8[_0x7c53('0x21')](_0x407efd)[_0x7c53('0x22')](function(_0x5d8a08){return _0x5d8a08;});}return null;};}function removeEntity(_0x1f0f1b,_0x5766fb){return function(_0x2eb1ac){if(_0x2eb1ac){return _0x2eb1ac[_0x7c53('0x23')]()[_0x7c53('0x22')](function(){var _0x3a6a53=_0x2eb1ac['get']({'plain':!![]});var _0x3924f6='Intervals';return db['UserProfileResource']['destroy']({'where':{'type':_0x3924f6,'resourceId':_0x3a6a53['id']}})[_0x7c53('0x22')](function(){return _0x2eb1ac;});})[_0x7c53('0x22')](function(){_0x1f0f1b[_0x7c53('0x19')](0xcc)[_0x7c53('0x24')]();});}};}function handleEntityNotFound(_0x237372,_0x25559a){return function(_0xbbde72){if(!_0xbbde72){_0x237372['sendStatus'](0x194);}return _0xbbde72;};}function handleError(_0x242bd8,_0x20ed8e){_0x20ed8e=_0x20ed8e||0x1f4;return function(_0x1af4ed){logger[_0x7c53('0x25')](_0x1af4ed[_0x7c53('0x26')]);if(_0x1af4ed[_0x7c53('0x27')]){delete _0x1af4ed[_0x7c53('0x27')];}_0x242bd8[_0x7c53('0x19')](_0x20ed8e)['send'](_0x1af4ed);};}exports['index']=function(_0xf4d926,_0x56670f){var _0x5b24b8={},_0x265869={},_0x1a9ed6={'count':0x0,'rows':[]};var _0x2d923d=_['map'](db[_0x7c53('0x28')][_0x7c53('0x29')],function(_0x1514ee){return{'name':_0x1514ee[_0x7c53('0x2a')],'type':_0x1514ee['type']['key']};});_0x265869[_0x7c53('0x2b')]=_['map'](_0x2d923d,_0x7c53('0x27'));_0x265869[_0x7c53('0x2c')]=_[_0x7c53('0x2d')](_0xf4d926['query']);_0x265869[_0x7c53('0x2e')]=_[_0x7c53('0x2f')](_0x265869[_0x7c53('0x2b')],_0x265869[_0x7c53('0x2c')]);_0x5b24b8['attributes']=_[_0x7c53('0x2f')](_0x265869[_0x7c53('0x2b')],qs[_0x7c53('0x30')](_0xf4d926[_0x7c53('0x2c')][_0x7c53('0x30')]));_0x5b24b8[_0x7c53('0x31')]=_0x5b24b8['attributes'][_0x7c53('0x32')]?_0x5b24b8[_0x7c53('0x31')]:_0x265869[_0x7c53('0x2b')];if(!_0xf4d926[_0x7c53('0x2c')][_0x7c53('0x33')]('nolimit')){_0x5b24b8[_0x7c53('0x1c')]=qs[_0x7c53('0x1c')](_0xf4d926['query'][_0x7c53('0x1c')]);_0x5b24b8[_0x7c53('0x1b')]=qs[_0x7c53('0x1b')](_0xf4d926[_0x7c53('0x2c')][_0x7c53('0x1b')]);}_0x5b24b8['order']=qs[_0x7c53('0x34')](_0xf4d926['query'][_0x7c53('0x34')]);_0x5b24b8[_0x7c53('0x35')]=qs[_0x7c53('0x2e')](_['pick'](_0xf4d926[_0x7c53('0x2c')],_0x265869['filters']),_0x2d923d);if(_0xf4d926[_0x7c53('0x2c')]['filter']){_0x5b24b8[_0x7c53('0x35')]=_[_0x7c53('0x36')](_0x5b24b8[_0x7c53('0x35')],{'$or':_[_0x7c53('0x37')](_0x2d923d,function(_0xc053c){if(_0xc053c['type']!==_0x7c53('0x38')){var _0x21ff00={};_0x21ff00[_0xc053c[_0x7c53('0x27')]]={'$like':'%'+_0xf4d926[_0x7c53('0x2c')][_0x7c53('0x39')]+'%'};return _0x21ff00;}})});}_0x5b24b8=_[_0x7c53('0x36')]({},_0x5b24b8,_0xf4d926['options']);var _0x55d062={'where':_0x5b24b8[_0x7c53('0x35')]};return db[_0x7c53('0x28')][_0x7c53('0x1d')](_0x55d062)[_0x7c53('0x22')](function(_0x4d22b7){_0x1a9ed6[_0x7c53('0x1d')]=_0x4d22b7;if(_0xf4d926[_0x7c53('0x2c')]['includeAll']){_0x5b24b8[_0x7c53('0x3a')]=[{'all':!![]}];}return db[_0x7c53('0x28')][_0x7c53('0x3b')](_0x5b24b8);})[_0x7c53('0x22')](function(_0x24612b){_0x1a9ed6['rows']=_0x24612b;return _0x1a9ed6;})[_0x7c53('0x22')](respondWithFilteredResult(_0x56670f,_0x5b24b8))[_0x7c53('0x3c')](handleError(_0x56670f,null));};exports[_0x7c53('0x3d')]=function(_0x385107,_0x3acbc5){var _0x5933d6={'raw':!![],'where':{'id':_0x385107[_0x7c53('0x3e')]['id']}},_0xcc1755={};_0xcc1755[_0x7c53('0x2b')]=_[_0x7c53('0x2d')](db[_0x7c53('0x28')]['rawAttributes']);_0xcc1755[_0x7c53('0x2c')]=_[_0x7c53('0x2d')](_0x385107[_0x7c53('0x2c')]);_0xcc1755[_0x7c53('0x2e')]=_[_0x7c53('0x2f')](_0xcc1755[_0x7c53('0x2b')],_0xcc1755['query']);_0x5933d6[_0x7c53('0x31')]=_['intersection'](_0xcc1755[_0x7c53('0x2b')],qs[_0x7c53('0x30')](_0x385107[_0x7c53('0x2c')][_0x7c53('0x30')]));_0x5933d6[_0x7c53('0x31')]=_0x5933d6['attributes'][_0x7c53('0x32')]?_0x5933d6['attributes']:_0xcc1755[_0x7c53('0x2b')];if(_0x385107[_0x7c53('0x2c')][_0x7c53('0x3f')]){_0x5933d6[_0x7c53('0x3a')]=[{'all':!![]}];}_0x5933d6=_[_0x7c53('0x36')]({},_0x5933d6,_0x385107['options']);return db['Interval'][_0x7c53('0x40')](_0x5933d6)['then'](handleEntityNotFound(_0x3acbc5,null))[_0x7c53('0x22')](respondWithResult(_0x3acbc5,null))['catch'](handleError(_0x3acbc5,null));};exports[_0x7c53('0x41')]=function(_0x4ad7b6,_0x4a8399){return db['Interval']['create'](_0x4ad7b6['body'],{})[_0x7c53('0x22')](function(_0xa52faf){var _0x40dfe3=_0x4ad7b6['user'][_0x7c53('0x42')]({'plain':!![]});if(!_0x40dfe3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40dfe3['role']===_0x7c53('0x43')){var _0x3d89cd=_0xa52faf[_0x7c53('0x42')]({'plain':!![]});var _0x5d175d=_0x7c53('0x44');return db[_0x7c53('0x45')][_0x7c53('0x40')]({'where':{'name':_0x5d175d,'userProfileId':_0x40dfe3['userProfileId']},'raw':!![]})['then'](function(_0x4bc211){if(_0x4bc211&&_0x4bc211['autoAssociation']===0x0){return db[_0x7c53('0x46')][_0x7c53('0x41')]({'name':_0x3d89cd[_0x7c53('0x27')],'resourceId':_0x3d89cd['id'],'type':_0x4bc211['name'],'sectionId':_0x4bc211['id']},{})['then'](function(){return _0xa52faf;});}else{return _0xa52faf;}})[_0x7c53('0x3c')](function(_0x2d2f13){logger[_0x7c53('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d2f13);throw _0x2d2f13;});}return _0xa52faf;})[_0x7c53('0x22')](respondWithResult(_0x4a8399,0xc9))['catch'](handleError(_0x4a8399,null));};exports[_0x7c53('0x21')]=function(_0x54c1c3,_0x1c559e){if(_0x54c1c3['body']['id']){delete _0x54c1c3[_0x7c53('0x47')]['id'];}return db[_0x7c53('0x28')][_0x7c53('0x40')]({'where':{'id':_0x54c1c3[_0x7c53('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1c559e,null))[_0x7c53('0x22')](saveUpdates(_0x54c1c3[_0x7c53('0x47')],null))[_0x7c53('0x22')](respondWithResult(_0x1c559e,null))['catch'](handleError(_0x1c559e,null));};exports[_0x7c53('0x23')]=function(_0x129bd8,_0x1fe5e0){return db[_0x7c53('0x28')]['find']({'where':{'id':_0x129bd8[_0x7c53('0x3e')]['id']}})[_0x7c53('0x22')](handleEntityNotFound(_0x1fe5e0,null))[_0x7c53('0x22')](removeEntity(_0x1fe5e0,null))['catch'](handleError(_0x1fe5e0,null));};exports[_0x7c53('0x48')]=function(_0x42ca42,_0x21aa0f,_0x22100f){if(_0x42ca42[_0x7c53('0x47')]['id']){delete _0x42ca42[_0x7c53('0x47')]['id'];}return db[_0x7c53('0x28')][_0x7c53('0x40')]({'where':{'id':_0x42ca42[_0x7c53('0x3e')]['id']}})[_0x7c53('0x22')](handleEntityNotFound(_0x21aa0f,null))[_0x7c53('0x22')](function(_0x38edea){if(_0x38edea){_0x42ca42['body'][_0x7c53('0x49')]=_0x38edea['id'];return db[_0x7c53('0x28')][_0x7c53('0x41')](_0x42ca42[_0x7c53('0x47')]);}})[_0x7c53('0x22')](respondWithResult(_0x21aa0f,null))[_0x7c53('0x3c')](handleError(_0x21aa0f,null));};exports[_0x7c53('0x4a')]=function(_0x4eee0b,_0x14b896,_0x4da552){var _0x3de175={};var _0x2e1734={};var _0x45d6da;var _0x1d0e87;return db[_0x7c53('0x28')][_0x7c53('0x4b')]({'where':{'id':_0x4eee0b[_0x7c53('0x3e')]['id']}})['then'](handleEntityNotFound(_0x14b896,null))[_0x7c53('0x22')](function(_0x35dc70){if(_0x35dc70){_0x45d6da=_0x35dc70;_0x2e1734['model']=_[_0x7c53('0x2d')](db[_0x7c53('0x28')][_0x7c53('0x29')]);_0x2e1734[_0x7c53('0x2c')]=_[_0x7c53('0x2d')](_0x4eee0b[_0x7c53('0x2c')]);_0x2e1734[_0x7c53('0x2e')]=_['intersection'](_0x2e1734[_0x7c53('0x2b')],_0x2e1734[_0x7c53('0x2c')]);_0x3de175[_0x7c53('0x31')]=_['intersection'](_0x2e1734[_0x7c53('0x2b')],qs[_0x7c53('0x30')](_0x4eee0b[_0x7c53('0x2c')][_0x7c53('0x30')]));_0x3de175[_0x7c53('0x31')]=_0x3de175['attributes'][_0x7c53('0x32')]?_0x3de175[_0x7c53('0x31')]:_0x2e1734[_0x7c53('0x2b')];_0x3de175[_0x7c53('0x4c')]=qs[_0x7c53('0x34')](_0x4eee0b[_0x7c53('0x2c')][_0x7c53('0x34')]);_0x3de175[_0x7c53('0x35')]=qs[_0x7c53('0x2e')](_['pick'](_0x4eee0b[_0x7c53('0x2c')],_0x2e1734[_0x7c53('0x2e')]));if(_0x4eee0b[_0x7c53('0x2c')][_0x7c53('0x39')]){_0x3de175[_0x7c53('0x35')]=_[_0x7c53('0x36')](_0x3de175[_0x7c53('0x35')],{'$or':_['map'](_0x3de175[_0x7c53('0x31')],function(_0x3d26ea){var _0x5d374a={};_0x5d374a[_0x3d26ea]={'$like':'%'+_0x4eee0b[_0x7c53('0x2c')][_0x7c53('0x39')]+'%'};return _0x5d374a;})});}_0x3de175=_[_0x7c53('0x36')]({},_0x3de175,_0x4eee0b[_0x7c53('0x4d')]);return _0x45d6da[_0x7c53('0x4a')](_0x3de175);}})['then'](function(_0x406e81){if(_0x406e81){_0x1d0e87=_0x406e81[_0x7c53('0x32')];if(!_0x4eee0b['query'][_0x7c53('0x33')]('nolimit')){_0x3de175['limit']=qs[_0x7c53('0x1c')](_0x4eee0b[_0x7c53('0x2c')]['limit']);_0x3de175['offset']=qs[_0x7c53('0x1b')](_0x4eee0b['query'][_0x7c53('0x1b')]);}return _0x45d6da['getIntervals'](_0x3de175);}})[_0x7c53('0x22')](function(_0x59c55f){if(_0x59c55f){return _0x59c55f?{'count':_0x1d0e87,'rows':_0x59c55f}:null;}})[_0x7c53('0x22')](respondWithResult(_0x14b896,null))[_0x7c53('0x3c')](handleError(_0x14b896,null));};exports[_0x7c53('0x4e')]=function(_0x5a191b,_0x352320,_0x215beb){return db['Interval'][_0x7c53('0x4b')]({'where':{'id':_0x5a191b[_0x7c53('0x3e')]['id']}})[_0x7c53('0x22')](handleEntityNotFound(_0x352320,null))['then'](function(_0x370c36){if(_0x370c36){return db[_0x7c53('0x4f')]['transaction'](function(_0x4897db){return db[_0x7c53('0x28')][_0x7c53('0x23')]({'where':{'IntervalId':_0x5a191b['params']['id']},'transaction':_0x4897db})[_0x7c53('0x22')](function(_0x51565c){var _0x2e02cb=_[_0x7c53('0x37')](_0x5a191b[_0x7c53('0x47')],function(_0x6dd0d2){delete _0x6dd0d2['id'];_0x6dd0d2[_0x7c53('0x49')]=_0x5a191b[_0x7c53('0x3e')]['id'];return _0x6dd0d2;});return db[_0x7c53('0x28')]['bulkCreate'](_0x2e02cb,{'transaction':_0x4897db});});})['then'](function(){return db[_0x7c53('0x28')][_0x7c53('0x3b')]({'where':{'IntervalId':_0x5a191b[_0x7c53('0x3e')]['id']}});});}})[_0x7c53('0x22')](respondWithResult(_0x352320,null))[_0x7c53('0x3c')](handleError(_0x352320,null));};
\ No newline at end of file
+var _0x2cdc=['json','apply','reject','save','then','UserProfileResource','destroy','stack','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','filter','options','include','rows','catch','params','keys','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','IntervalId','getIntervals','nolimit','addIntervals','findOne','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2cdc,0x97));var _0xc2cd=function(_0x28ba31,_0x324165){_0x28ba31=_0x28ba31-0x0;var _0x552262=_0x2cdc[_0x28ba31];return _0x552262;};'use strict';var emlformat=require(_0xc2cd('0x0'));var rimraf=require(_0xc2cd('0x1'));var zipdir=require(_0xc2cd('0x2'));var jsonpatch=require(_0xc2cd('0x3'));var rp=require(_0xc2cd('0x4'));var moment=require(_0xc2cd('0x5'));var BPromise=require(_0xc2cd('0x6'));var Mustache=require(_0xc2cd('0x7'));var util=require(_0xc2cd('0x8'));var path=require(_0xc2cd('0x9'));var sox=require(_0xc2cd('0xa'));var csv=require(_0xc2cd('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc2cd('0xc'));var _=require(_0xc2cd('0xd'));var squel=require('squel');var crypto=require(_0xc2cd('0xe'));var jsforce=require(_0xc2cd('0xf'));var deskjs=require(_0xc2cd('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc2cd('0x11'));var Papa=require('papaparse');var Redis=require(_0xc2cd('0x12'));var authService=require(_0xc2cd('0x13'));var qs=require(_0xc2cd('0x14'));var as=require(_0xc2cd('0x15'));var hardwareService=require(_0xc2cd('0x16'));var logger=require('../../config/logger')(_0xc2cd('0x17'));var utils=require(_0xc2cd('0x18'));var config=require(_0xc2cd('0x19'));var licenseUtil=require(_0xc2cd('0x1a'));var db=require('../../mysqldb')['db'];var extensions=require(_0xc2cd('0x1b'));function respondWithStatusCode(_0x1f1762,_0x3f0591){_0x3f0591=_0x3f0591||0xcc;return function(_0x377f54){if(_0x377f54){return _0x1f1762[_0xc2cd('0x1c')](_0x3f0591);}return _0x1f1762[_0xc2cd('0x1d')](_0x3f0591)[_0xc2cd('0x1e')]();};}function respondWithResult(_0x4017be,_0x4b8b86){_0x4b8b86=_0x4b8b86||0xc8;return function(_0xe70cef){if(_0xe70cef){return _0x4017be[_0xc2cd('0x1d')](_0x4b8b86)['json'](_0xe70cef);}};}function respondWithFilteredResult(_0x226026,_0x4317e7){return function(_0x3c42ee){if(_0x3c42ee){var _0x42ea02=typeof _0x4317e7[_0xc2cd('0x1f')]===_0xc2cd('0x20')&&typeof _0x4317e7[_0xc2cd('0x21')]==='undefined';var _0x55e4dd=_0x3c42ee[_0xc2cd('0x22')];var _0x3079d5=_0x42ea02?0x0:_0x4317e7[_0xc2cd('0x1f')];var _0x4288b7=_0x42ea02?_0x3c42ee[_0xc2cd('0x22')]:_0x4317e7[_0xc2cd('0x1f')]+_0x4317e7['limit'];var _0x1979b5;if(_0x4288b7>=_0x55e4dd){_0x4288b7=_0x55e4dd;_0x1979b5=0xc8;}else{_0x1979b5=0xce;}_0x226026[_0xc2cd('0x1d')](_0x1979b5);return _0x226026[_0xc2cd('0x23')](_0xc2cd('0x24'),_0x3079d5+'-'+_0x4288b7+'/'+_0x55e4dd)[_0xc2cd('0x25')](_0x3c42ee);}return null;};}function patchUpdates(_0x598179){return function(_0x5cf08f){try{jsonpatch[_0xc2cd('0x26')](_0x5cf08f,_0x598179,!![]);}catch(_0x378afa){return BPromise[_0xc2cd('0x27')](_0x378afa);}return _0x5cf08f[_0xc2cd('0x28')]();};}function saveUpdates(_0x77ff4e,_0x29c606){return function(_0x47d2c7){if(_0x47d2c7){return _0x47d2c7['update'](_0x77ff4e)[_0xc2cd('0x29')](function(_0x5d78ae){return _0x5d78ae;});}return null;};}function removeEntity(_0x4f67ad,_0x17cd98){return function(_0x3830b9){if(_0x3830b9){return _0x3830b9['destroy']()['then'](function(){var _0x4870ad=_0x3830b9['get']({'plain':!![]});var _0x1b3fc7='Intervals';return db[_0xc2cd('0x2a')][_0xc2cd('0x2b')]({'where':{'type':_0x1b3fc7,'resourceId':_0x4870ad['id']}})[_0xc2cd('0x29')](function(){return _0x3830b9;});})[_0xc2cd('0x29')](function(){_0x4f67ad['status'](0xcc)[_0xc2cd('0x1e')]();});}};}function handleEntityNotFound(_0x47601c,_0x35ee85){return function(_0x55bb45){if(!_0x55bb45){_0x47601c['sendStatus'](0x194);}return _0x55bb45;};}function handleError(_0x89c210,_0x408f8b){_0x408f8b=_0x408f8b||0x1f4;return function(_0x3b72d3){logger['error'](_0x3b72d3[_0xc2cd('0x2c')]);if(_0x3b72d3[_0xc2cd('0x2d')]){delete _0x3b72d3['name'];}_0x89c210[_0xc2cd('0x1d')](_0x408f8b)['send'](_0x3b72d3);};}exports[_0xc2cd('0x2e')]=function(_0x11533e,_0x36fba3){var _0x2b4427={},_0x2235c7={},_0x3bc0b1={'count':0x0,'rows':[]};var _0x276499=_[_0xc2cd('0x2f')](db[_0xc2cd('0x30')][_0xc2cd('0x31')],function(_0x3325f5){return{'name':_0x3325f5[_0xc2cd('0x32')],'type':_0x3325f5[_0xc2cd('0x33')][_0xc2cd('0x34')]};});_0x2235c7[_0xc2cd('0x35')]=_['map'](_0x276499,_0xc2cd('0x2d'));_0x2235c7[_0xc2cd('0x36')]=_['keys'](_0x11533e[_0xc2cd('0x36')]);_0x2235c7[_0xc2cd('0x37')]=_[_0xc2cd('0x38')](_0x2235c7['model'],_0x2235c7[_0xc2cd('0x36')]);_0x2b4427[_0xc2cd('0x39')]=_[_0xc2cd('0x38')](_0x2235c7[_0xc2cd('0x35')],qs[_0xc2cd('0x3a')](_0x11533e[_0xc2cd('0x36')]['fields']));_0x2b4427[_0xc2cd('0x39')]=_0x2b4427[_0xc2cd('0x39')]['length']?_0x2b4427[_0xc2cd('0x39')]:_0x2235c7[_0xc2cd('0x35')];if(!_0x11533e[_0xc2cd('0x36')][_0xc2cd('0x3b')]('nolimit')){_0x2b4427[_0xc2cd('0x21')]=qs[_0xc2cd('0x21')](_0x11533e['query'][_0xc2cd('0x21')]);_0x2b4427['offset']=qs['offset'](_0x11533e['query'][_0xc2cd('0x1f')]);}_0x2b4427[_0xc2cd('0x3c')]=qs[_0xc2cd('0x3d')](_0x11533e[_0xc2cd('0x36')][_0xc2cd('0x3d')]);_0x2b4427[_0xc2cd('0x3e')]=qs[_0xc2cd('0x37')](_['pick'](_0x11533e[_0xc2cd('0x36')],_0x2235c7[_0xc2cd('0x37')]),_0x276499);if(_0x11533e[_0xc2cd('0x36')]['filter']){_0x2b4427[_0xc2cd('0x3e')]=_[_0xc2cd('0x3f')](_0x2b4427[_0xc2cd('0x3e')],{'$or':_['map'](_0x276499,function(_0x331065){if(_0x331065[_0xc2cd('0x33')]!=='VIRTUAL'){var _0x17ce82={};_0x17ce82[_0x331065[_0xc2cd('0x2d')]]={'$like':'%'+_0x11533e[_0xc2cd('0x36')][_0xc2cd('0x40')]+'%'};return _0x17ce82;}})});}_0x2b4427=_['merge']({},_0x2b4427,_0x11533e[_0xc2cd('0x41')]);var _0x1e0da9={'where':_0x2b4427[_0xc2cd('0x3e')]};return db[_0xc2cd('0x30')][_0xc2cd('0x22')](_0x1e0da9)[_0xc2cd('0x29')](function(_0x5b7973){_0x3bc0b1[_0xc2cd('0x22')]=_0x5b7973;if(_0x11533e['query']['includeAll']){_0x2b4427[_0xc2cd('0x42')]=[{'all':!![]}];}return db[_0xc2cd('0x30')]['findAll'](_0x2b4427);})[_0xc2cd('0x29')](function(_0x576b3f){_0x3bc0b1[_0xc2cd('0x43')]=_0x576b3f;return _0x3bc0b1;})[_0xc2cd('0x29')](respondWithFilteredResult(_0x36fba3,_0x2b4427))[_0xc2cd('0x44')](handleError(_0x36fba3,null));};exports['show']=function(_0x44f496,_0x52c538){var _0x1563ab={'raw':!![],'where':{'id':_0x44f496[_0xc2cd('0x45')]['id']}},_0x167db4={};_0x167db4[_0xc2cd('0x35')]=_[_0xc2cd('0x46')](db[_0xc2cd('0x30')][_0xc2cd('0x31')]);_0x167db4[_0xc2cd('0x36')]=_['keys'](_0x44f496['query']);_0x167db4[_0xc2cd('0x37')]=_[_0xc2cd('0x38')](_0x167db4[_0xc2cd('0x35')],_0x167db4[_0xc2cd('0x36')]);_0x1563ab[_0xc2cd('0x39')]=_[_0xc2cd('0x38')](_0x167db4[_0xc2cd('0x35')],qs[_0xc2cd('0x3a')](_0x44f496['query'][_0xc2cd('0x3a')]));_0x1563ab[_0xc2cd('0x39')]=_0x1563ab[_0xc2cd('0x39')][_0xc2cd('0x47')]?_0x1563ab[_0xc2cd('0x39')]:_0x167db4[_0xc2cd('0x35')];if(_0x44f496['query'][_0xc2cd('0x48')]){_0x1563ab[_0xc2cd('0x42')]=[{'all':!![]}];}_0x1563ab=_['merge']({},_0x1563ab,_0x44f496[_0xc2cd('0x41')]);return db[_0xc2cd('0x30')][_0xc2cd('0x49')](_0x1563ab)[_0xc2cd('0x29')](handleEntityNotFound(_0x52c538,null))[_0xc2cd('0x29')](respondWithResult(_0x52c538,null))[_0xc2cd('0x44')](handleError(_0x52c538,null));};exports[_0xc2cd('0x4a')]=function(_0x1a14c7,_0x26ad70){return db[_0xc2cd('0x30')][_0xc2cd('0x4a')](_0x1a14c7[_0xc2cd('0x4b')],{})[_0xc2cd('0x29')](function(_0x2e5ddb){var _0x24731b=_0x1a14c7[_0xc2cd('0x4c')][_0xc2cd('0x4d')]({'plain':!![]});if(!_0x24731b)throw new Error(_0xc2cd('0x4e'));if(_0x24731b[_0xc2cd('0x4f')]==='user'){var _0x277471=_0x2e5ddb[_0xc2cd('0x4d')]({'plain':!![]});var _0x2b6313=_0xc2cd('0x50');return db[_0xc2cd('0x51')]['find']({'where':{'name':_0x2b6313,'userProfileId':_0x24731b[_0xc2cd('0x52')]},'raw':!![]})[_0xc2cd('0x29')](function(_0x4fdb1a){if(_0x4fdb1a&&_0x4fdb1a[_0xc2cd('0x53')]===0x0){return db[_0xc2cd('0x2a')][_0xc2cd('0x4a')]({'name':_0x277471[_0xc2cd('0x2d')],'resourceId':_0x277471['id'],'type':_0x4fdb1a[_0xc2cd('0x2d')],'sectionId':_0x4fdb1a['id']},{})[_0xc2cd('0x29')](function(){return _0x2e5ddb;});}else{return _0x2e5ddb;}})['catch'](function(_0x1a6670){logger['error'](_0xc2cd('0x54'),_0x1a6670);throw _0x1a6670;});}return _0x2e5ddb;})[_0xc2cd('0x29')](respondWithResult(_0x26ad70,0xc9))[_0xc2cd('0x44')](handleError(_0x26ad70,null));};exports[_0xc2cd('0x55')]=function(_0x318d03,_0x4fc396){if(_0x318d03['body']['id']){delete _0x318d03[_0xc2cd('0x4b')]['id'];}return db['Interval'][_0xc2cd('0x49')]({'where':{'id':_0x318d03[_0xc2cd('0x45')]['id']}})[_0xc2cd('0x29')](handleEntityNotFound(_0x4fc396,null))['then'](saveUpdates(_0x318d03[_0xc2cd('0x4b')],null))[_0xc2cd('0x29')](respondWithResult(_0x4fc396,null))[_0xc2cd('0x44')](handleError(_0x4fc396,null));};exports[_0xc2cd('0x2b')]=function(_0x58767b,_0x207317){return db['Interval'][_0xc2cd('0x49')]({'where':{'id':_0x58767b['params']['id']}})[_0xc2cd('0x29')](handleEntityNotFound(_0x207317,null))[_0xc2cd('0x29')](removeEntity(_0x207317,null))[_0xc2cd('0x44')](handleError(_0x207317,null));};exports['addInterval']=function(_0x43d8d0,_0x55a6a4,_0x15f30b){if(_0x43d8d0[_0xc2cd('0x4b')]['id']){delete _0x43d8d0[_0xc2cd('0x4b')]['id'];}return db[_0xc2cd('0x30')]['find']({'where':{'id':_0x43d8d0['params']['id']}})['then'](handleEntityNotFound(_0x55a6a4,null))[_0xc2cd('0x29')](function(_0x2bf1d5){if(_0x2bf1d5){_0x43d8d0[_0xc2cd('0x4b')][_0xc2cd('0x56')]=_0x2bf1d5['id'];return db[_0xc2cd('0x30')][_0xc2cd('0x4a')](_0x43d8d0[_0xc2cd('0x4b')]);}})[_0xc2cd('0x29')](respondWithResult(_0x55a6a4,null))[_0xc2cd('0x44')](handleError(_0x55a6a4,null));};exports[_0xc2cd('0x57')]=function(_0x243d7a,_0x1c86ac,_0x24d00e){var _0x4bc812={};var _0x5abd3b={};var _0x5aa370;var _0x56081b;return db[_0xc2cd('0x30')]['findOne']({'where':{'id':_0x243d7a[_0xc2cd('0x45')]['id']}})[_0xc2cd('0x29')](handleEntityNotFound(_0x1c86ac,null))[_0xc2cd('0x29')](function(_0x13d958){if(_0x13d958){_0x5aa370=_0x13d958;_0x5abd3b['model']=_[_0xc2cd('0x46')](db[_0xc2cd('0x30')]['rawAttributes']);_0x5abd3b[_0xc2cd('0x36')]=_[_0xc2cd('0x46')](_0x243d7a[_0xc2cd('0x36')]);_0x5abd3b[_0xc2cd('0x37')]=_[_0xc2cd('0x38')](_0x5abd3b['model'],_0x5abd3b[_0xc2cd('0x36')]);_0x4bc812[_0xc2cd('0x39')]=_[_0xc2cd('0x38')](_0x5abd3b[_0xc2cd('0x35')],qs['fields'](_0x243d7a[_0xc2cd('0x36')][_0xc2cd('0x3a')]));_0x4bc812[_0xc2cd('0x39')]=_0x4bc812[_0xc2cd('0x39')]['length']?_0x4bc812[_0xc2cd('0x39')]:_0x5abd3b[_0xc2cd('0x35')];_0x4bc812[_0xc2cd('0x3c')]=qs[_0xc2cd('0x3d')](_0x243d7a['query'][_0xc2cd('0x3d')]);_0x4bc812['where']=qs[_0xc2cd('0x37')](_['pick'](_0x243d7a[_0xc2cd('0x36')],_0x5abd3b['filters']));if(_0x243d7a['query'][_0xc2cd('0x40')]){_0x4bc812[_0xc2cd('0x3e')]=_[_0xc2cd('0x3f')](_0x4bc812['where'],{'$or':_[_0xc2cd('0x2f')](_0x4bc812['attributes'],function(_0x180741){var _0x2d91b6={};_0x2d91b6[_0x180741]={'$like':'%'+_0x243d7a['query'][_0xc2cd('0x40')]+'%'};return _0x2d91b6;})});}_0x4bc812=_[_0xc2cd('0x3f')]({},_0x4bc812,_0x243d7a['options']);return _0x5aa370[_0xc2cd('0x57')](_0x4bc812);}})[_0xc2cd('0x29')](function(_0x547f66){if(_0x547f66){_0x56081b=_0x547f66[_0xc2cd('0x47')];if(!_0x243d7a[_0xc2cd('0x36')][_0xc2cd('0x3b')](_0xc2cd('0x58'))){_0x4bc812['limit']=qs[_0xc2cd('0x21')](_0x243d7a[_0xc2cd('0x36')][_0xc2cd('0x21')]);_0x4bc812[_0xc2cd('0x1f')]=qs['offset'](_0x243d7a[_0xc2cd('0x36')]['offset']);}return _0x5aa370[_0xc2cd('0x57')](_0x4bc812);}})[_0xc2cd('0x29')](function(_0x4a8658){if(_0x4a8658){return _0x4a8658?{'count':_0x56081b,'rows':_0x4a8658}:null;}})['then'](respondWithResult(_0x1c86ac,null))['catch'](handleError(_0x1c86ac,null));};exports[_0xc2cd('0x59')]=function(_0x334ad3,_0x3f9d95,_0x32ac51){return db['Interval'][_0xc2cd('0x5a')]({'where':{'id':_0x334ad3[_0xc2cd('0x45')]['id']}})[_0xc2cd('0x29')](handleEntityNotFound(_0x3f9d95,null))[_0xc2cd('0x29')](function(_0x1356ac){if(_0x1356ac){return db['sequelize'][_0xc2cd('0x5b')](function(_0x587de0){return db[_0xc2cd('0x30')][_0xc2cd('0x2b')]({'where':{'IntervalId':_0x334ad3[_0xc2cd('0x45')]['id']},'transaction':_0x587de0})[_0xc2cd('0x29')](function(_0x4a945b){var _0x332213=_[_0xc2cd('0x2f')](_0x334ad3['body'],function(_0x37a206){delete _0x37a206['id'];_0x37a206[_0xc2cd('0x56')]=_0x334ad3[_0xc2cd('0x45')]['id'];return _0x37a206;});return db[_0xc2cd('0x30')][_0xc2cd('0x5c')](_0x332213,{'transaction':_0x587de0});});})['then'](function(){return db[_0xc2cd('0x30')][_0xc2cd('0x5d')]({'where':{'IntervalId':_0x334ad3[_0xc2cd('0x45')]['id']}});});}})[_0xc2cd('0x29')](respondWithResult(_0x3f9d95,null))[_0xc2cd('0x44')](handleError(_0x3f9d95,null));};
\ No newline at end of file
index 063f3cb..2268df7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaf97=['moment','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','exports','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api'];(function(_0x444b94,_0x579356){var _0x93f415=function(_0x1736ab){while(--_0x1736ab){_0x444b94['push'](_0x444b94['shift']());}};_0x93f415(++_0x579356);}(_0xaf97,0x15a));var _0x7af9=function(_0x451ada,_0x1c8dfe){_0x451ada=_0x451ada-0x0;var _0x2c640d=_0xaf97[_0x451ada];return _0x2c640d;};'use strict';var _=require(_0x7af9('0x0'));var util=require(_0x7af9('0x1'));var logger=require(_0x7af9('0x2'))(_0x7af9('0x3'));var moment=require(_0x7af9('0x4'));var BPromise=require('bluebird');var rp=require(_0x7af9('0x5'));var fs=require('fs');var path=require(_0x7af9('0x6'));var rimraf=require(_0x7af9('0x7'));var config=require(_0x7af9('0x8'));var attributes=require('./interval.attributes');var extensions=require(_0x7af9('0x9'));module[_0x7af9('0xa')]=function(_0xc92db6,_0x369746){return _0xc92db6['define'](_0x7af9('0xb'),attributes,{'tableName':_0x7af9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2963b7,_0x4220ff){extensions[_0x7af9('0xd')](_0xc92db6,_0x2963b7);},'afterBulkCreate':function(_0x44867d,_0x4c6058,_0x560371){_0x560371();extensions[_0x7af9('0xd')](_0xc92db6,_0x44867d[0x0]);},'afterUpdate':function(_0x27e05a,_0x225167){extensions['rewrite'](_0xc92db6,_0x27e05a);},'afterDestroy':function(_0x1bbcef,_0x210e41){extensions[_0x7af9('0xd')](_0xc92db6,_0x1bbcef);}}});};
\ No newline at end of file
+var _0xe174=['request-promise','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','util','../../config/logger','api','moment','bluebird'];(function(_0x2ad076,_0x352e9f){var _0x2c165a=function(_0x5cbb48){while(--_0x5cbb48){_0x2ad076['push'](_0x2ad076['shift']());}};_0x2c165a(++_0x352e9f);}(_0xe174,0x64));var _0x4e17=function(_0x2b91b9,_0x35c185){_0x2b91b9=_0x2b91b9-0x0;var _0x428e90=_0xe174[_0x2b91b9];return _0x428e90;};'use strict';var _=require('lodash');var util=require(_0x4e17('0x0'));var logger=require(_0x4e17('0x1'))(_0x4e17('0x2'));var moment=require(_0x4e17('0x3'));var BPromise=require(_0x4e17('0x4'));var rp=require(_0x4e17('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e17('0x6'));var config=require(_0x4e17('0x7'));var attributes=require(_0x4e17('0x8'));var extensions=require(_0x4e17('0x9'));module[_0x4e17('0xa')]=function(_0x374eb3,_0x5ca9b9){return _0x374eb3[_0x4e17('0xb')](_0x4e17('0xc'),attributes,{'tableName':_0x4e17('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3114b2,_0x1a213f){extensions[_0x4e17('0xe')](_0x374eb3,_0x3114b2);},'afterBulkCreate':function(_0x3edfd7,_0x453f92,_0x4dae82){_0x4dae82();extensions['rewrite'](_0x374eb3,_0x3edfd7[0x0]);},'afterUpdate':function(_0x30128a,_0x21c369){extensions[_0x4e17('0xe')](_0x374eb3,_0x30128a);},'afterDestroy':function(_0x28bf98,_0xfedf9c){extensions[_0x4e17('0xe')](_0x374eb3,_0x28bf98);}}});};
\ No newline at end of file
index 0aa7668..523a3ae 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});};
\ No newline at end of file
+var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});};
\ No newline at end of file
index e9559f8..ad3c581 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0x0b0e[_0x33ebf5];return _0x66957b;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router;
\ No newline at end of file
+var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x4656e4,_0x93cd99){var _0x580161=function(_0x4efc94){while(--_0x4efc94){_0x4656e4['push'](_0x4656e4['shift']());}};_0x580161(++_0x93cd99);}(_0xadb5,0xad));var _0x5adb=function(_0x307e2e,_0x3df008){_0x307e2e=_0x307e2e-0x0;var _0x31194c=_0xadb5[_0x307e2e];return _0x31194c;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router;
\ No newline at end of file
index fd9a545..9ad6071 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbec7=['api','support','summary','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','x-forwarded-for','connection','remoteAddress','bluebird','https','../../config/logger'];(function(_0x192af3,_0x28499b){var _0x3669cc=function(_0x57acf5){while(--_0x57acf5){_0x192af3['push'](_0x192af3['shift']());}};_0x3669cc(++_0x28499b);}(_0xbec7,0xde));var _0x7bec=function(_0x22a263,_0x2c54bf){_0x22a263=_0x22a263-0x0;var _0x4e54dc=_0xbec7[_0x22a263];return _0x4e54dc;};'use strict';var BPromise=require(_0x7bec('0x0'));var https=require(_0x7bec('0x1'));var logger=require(_0x7bec('0x2'))(_0x7bec('0x3'));var USERNAME=_0x7bec('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0xdb33b3,_0x45af15){var _0x41d7d8={'fields':{'project':{'key':_0xdb33b3['key']||'MOTGUI'},'summary':(_0xdb33b3[_0x7bec('0x5')]||_0x7bec('0x6'))+_0x7bec('0x7')+_0xdb33b3['ip'],'description':_0xdb33b3[_0x7bec('0x8')]||JSON['stringify'](_0xdb33b3),'issuetype':{'name':_0xdb33b3[_0x7bec('0x9')]||_0x7bec('0xa')}}};_0x41d7d8[_0x7bec('0xb')][_0x7bec('0xc')]=_0xdb33b3[_0x7bec('0xd')];_0x41d7d8[_0x7bec('0xb')]['customfield_11501']=_0xdb33b3[_0x7bec('0xe')];_0x41d7d8[_0x7bec('0xb')]['customfield_11502']=_0xdb33b3['newToken'];_0x41d7d8[_0x7bec('0xb')][_0x7bec('0xf')]=_0xdb33b3[_0x7bec('0x10')];_0x41d7d8['fields'][_0x7bec('0x11')]=_0xdb33b3[_0x7bec('0x12')];_0x41d7d8[_0x7bec('0xb')][_0x7bec('0x13')]=_0xdb33b3['ip'];var _0x1ad8dc={'host':_0x7bec('0x14'),'port':0x1bb,'path':_0x7bec('0x15'),'method':_0x7bec('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x7bec('0x17'),'Authorization':_0x7bec('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x7bec('0x19')](_0x7bec('0x1a'))}};var _0x1f0d3f=JSON['stringify'](_0x41d7d8);var _0x1540f1=https[_0x7bec('0x1b')](_0x1ad8dc,function(_0x8341b9){_0x8341b9[_0x7bec('0x1c')]('utf8');var _0x359576='';_0x8341b9['on'](_0x7bec('0x1d'),function(_0x4ebe7c){_0x359576+=_0x4ebe7c;});_0x8341b9['on'](_0x7bec('0x1e'),function(){if(_0x45af15){return _0x45af15[_0x7bec('0x1f')](_0x8341b9[_0x7bec('0x20')])[_0x7bec('0x21')](JSON[_0x7bec('0x22')](_0x359576));}});});_0x1540f1['on'](_0x7bec('0x23'),function(_0x1e3429){if(_0x45af15){return _0x45af15['status'](0x1f4)[_0x7bec('0x21')]({'errors':[{'message':_0x7bec('0x24'),'type':_0x7bec('0x25')}]});}});_0x1540f1[_0x7bec('0x26')](_0x1f0d3f);_0x1540f1[_0x7bec('0x1e')]();}exports[_0x7bec('0x27')]=openIssue;exports[_0x7bec('0x28')]=function(_0x4e3cf9,_0x4fa57f){_0x4e3cf9[_0x7bec('0x29')]['ip']=_0x4e3cf9['headers'][_0x7bec('0x2a')]||_0x4e3cf9['connection']['remoteAddress']||_0x4e3cf9['socket']['remoteAddress']||_0x4e3cf9[_0x7bec('0x2b')]['socket'][_0x7bec('0x2c')];return openIssue(_0x4e3cf9['body'],_0x4fa57f);};
\ No newline at end of file
+var _0x5330=['x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','key','MOTGUI','summary','\x20from\x20','description','Bug','fields','customfield_11500','customfield_11501','customfield_11502','newToken','customfield_11503','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','stringify','request','setEncoding','data','end','status','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers'];(function(_0x361931,_0x27574e){var _0x57984b=function(_0x568333){while(--_0x568333){_0x361931['push'](_0x361931['shift']());}};_0x57984b(++_0x27574e);}(_0x5330,0x85));var _0x0533=function(_0x23609b,_0x2b0bc5){_0x23609b=_0x23609b-0x0;var _0x450c6d=_0x5330[_0x23609b];return _0x450c6d;};'use strict';var BPromise=require(_0x0533('0x0'));var https=require(_0x0533('0x1'));var logger=require(_0x0533('0x2'))(_0x0533('0x3'));var USERNAME=_0x0533('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x23e338,_0x22f5d6){var _0x3340a4={'fields':{'project':{'key':_0x23e338[_0x0533('0x5')]||_0x0533('0x6')},'summary':(_0x23e338[_0x0533('0x7')]||'Report')+_0x0533('0x8')+_0x23e338['ip'],'description':_0x23e338[_0x0533('0x9')]||JSON['stringify'](_0x23e338),'issuetype':{'name':_0x23e338['issuetype']||_0x0533('0xa')}}};_0x3340a4[_0x0533('0xb')][_0x0533('0xc')]=_0x23e338['email'];_0x3340a4[_0x0533('0xb')][_0x0533('0xd')]=_0x23e338['oldToken'];_0x3340a4[_0x0533('0xb')][_0x0533('0xe')]=_0x23e338[_0x0533('0xf')];_0x3340a4[_0x0533('0xb')][_0x0533('0x10')]=_0x23e338['name'];_0x3340a4[_0x0533('0xb')][_0x0533('0x11')]=_0x23e338[_0x0533('0x12')];_0x3340a4[_0x0533('0xb')]['customfield_10102']=_0x23e338['ip'];var _0x4e25a9={'host':_0x0533('0x13'),'port':0x1bb,'path':_0x0533('0x14'),'method':_0x0533('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x0533('0x16'),'Authorization':_0x0533('0x17')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x178f42=JSON[_0x0533('0x18')](_0x3340a4);var _0x90db0f=https[_0x0533('0x19')](_0x4e25a9,function(_0x2e4dd8){_0x2e4dd8[_0x0533('0x1a')]('utf8');var _0x14231e='';_0x2e4dd8['on'](_0x0533('0x1b'),function(_0x15e7cb){_0x14231e+=_0x15e7cb;});_0x2e4dd8['on'](_0x0533('0x1c'),function(){if(_0x22f5d6){return _0x22f5d6[_0x0533('0x1d')](_0x2e4dd8['statusCode'])['json'](JSON[_0x0533('0x1e')](_0x14231e));}});});_0x90db0f['on'](_0x0533('0x1f'),function(_0x3844c2){if(_0x22f5d6){return _0x22f5d6[_0x0533('0x1d')](0x1f4)[_0x0533('0x20')]({'errors':[{'message':_0x0533('0x21'),'type':_0x0533('0x22')}]});}});_0x90db0f[_0x0533('0x23')](_0x178f42);_0x90db0f[_0x0533('0x1c')]();}exports[_0x0533('0x24')]=openIssue;exports['send']=function(_0x2f67b1,_0x2c94b2){_0x2f67b1[_0x0533('0x25')]['ip']=_0x2f67b1[_0x0533('0x26')][_0x0533('0x27')]||_0x2f67b1[_0x0533('0x28')][_0x0533('0x29')]||_0x2f67b1[_0x0533('0x2a')]['remoteAddress']||_0x2f67b1[_0x0533('0x28')]['socket']['remoteAddress'];return openIssue(_0x2f67b1[_0x0533('0x25')],_0x2c94b2);};
\ No newline at end of file
index 766871b..9433d20 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa75b=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x57c8bd,_0x15e7d1){var _0x5ce1ca=function(_0x199ab5){while(--_0x199ab5){_0x57c8bd['push'](_0x57c8bd['shift']());}};_0x5ce1ca(++_0x15e7d1);}(_0xa75b,0x170));var _0xba75=function(_0x266350,_0x35bf92){_0x266350=_0x266350-0x0;var _0x53d5c6=_0xa75b[_0x266350];return _0x53d5c6;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['post']('/',auth[_0xba75('0xa')](),controller[_0xba75('0xe')]);router[_0xba75('0xf')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x12')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);module[_0xba75('0x14')]=router;
\ No newline at end of file
+var _0xbec5=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated'];(function(_0x2ace55,_0x442132){var _0x438f2f=function(_0x39527e){while(--_0x39527e){_0x2ace55['push'](_0x2ace55['shift']());}};_0x438f2f(++_0x442132);}(_0xbec5,0xe5));var _0x5bec=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xbec5[_0xda464c];return _0x19e222;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0x9')](_0x5bec('0xe'),auth[_0x5bec('0xc')](),controller['show']);router[_0x5bec('0xf')]('/',auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);router[_0x5bec('0x13')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x14')]);module[_0x5bec('0x15')]=router;
\ No newline at end of file
index 3e2c179..e8d7a8b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x5c1a1d,_0x12fd19){_0x5c1a1d=_0x5c1a1d-0x0;var _0xd5f404=_0x7a54[_0x5c1a1d];return _0xd5f404;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}};
\ No newline at end of file
+var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7a54,0x106));var _0x47a5=function(_0x3d389e,_0x37123c){_0x3d389e=_0x3d389e-0x0;var _0x5ab7f9=_0x7a54[_0x3d389e];return _0x5ab7f9;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}};
\ No newline at end of file
index 8d633a2..884ec19 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa786=['rows','catch','show','params','keys','find','create','update','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','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','offset','undefined','count','set','Content-Range','json','save','destroy','then','stack','name','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x511f49,_0x1832ad){var _0x1cb271=function(_0x40f2da){while(--_0x40f2da){_0x511f49['push'](_0x511f49['shift']());}};_0x1cb271(++_0x1832ad);}(_0xa786,0x1d2));var _0x6a78=function(_0x45c771,_0x7edaf6){_0x45c771=_0x45c771-0x0;var _0x1cbe2d=_0xa786[_0x45c771];return _0x1cbe2d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6a78('0x0'));var jsonpatch=require(_0x6a78('0x1'));var rp=require(_0x6a78('0x2'));var moment=require(_0x6a78('0x3'));var BPromise=require(_0x6a78('0x4'));var Mustache=require(_0x6a78('0x5'));var util=require(_0x6a78('0x6'));var path=require('path');var sox=require(_0x6a78('0x7'));var csv=require(_0x6a78('0x8'));var ejs=require(_0x6a78('0x9'));var fs=require('fs');var fs_extra=require(_0x6a78('0xa'));var _=require(_0x6a78('0xb'));var squel=require(_0x6a78('0xc'));var crypto=require(_0x6a78('0xd'));var jsforce=require(_0x6a78('0xe'));var deskjs=require(_0x6a78('0xf'));var toCsv=require(_0x6a78('0x8'));var querystring=require(_0x6a78('0x10'));var Papa=require(_0x6a78('0x11'));var Redis=require(_0x6a78('0x12'));var authService=require(_0x6a78('0x13'));var qs=require(_0x6a78('0x14'));var as=require(_0x6a78('0x15'));var hardwareService=require(_0x6a78('0x16'));var logger=require(_0x6a78('0x17'))(_0x6a78('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6a78('0x19'));var db=require(_0x6a78('0x1a'))['db'];function respondWithStatusCode(_0x4f8b72,_0x20fd59){_0x20fd59=_0x20fd59||0xcc;return function(_0x35b334){if(_0x35b334){return _0x4f8b72[_0x6a78('0x1b')](_0x20fd59);}return _0x4f8b72[_0x6a78('0x1c')](_0x20fd59)[_0x6a78('0x1d')]();};}function respondWithResult(_0xfca4fe,_0x9df26e){_0x9df26e=_0x9df26e||0xc8;return function(_0x5ac964){if(_0x5ac964){return _0xfca4fe['status'](_0x9df26e)['json'](_0x5ac964);}};}function respondWithFilteredResult(_0x36114f,_0x2deaa9){return function(_0xe2cf95){if(_0xe2cf95){var _0x535dc8=typeof _0x2deaa9[_0x6a78('0x1e')]===_0x6a78('0x1f')&&typeof _0x2deaa9['limit']===_0x6a78('0x1f');var _0x136df2=_0xe2cf95[_0x6a78('0x20')];var _0x44f646=_0x535dc8?0x0:_0x2deaa9[_0x6a78('0x1e')];var _0xe0e5e6=_0x535dc8?_0xe2cf95[_0x6a78('0x20')]:_0x2deaa9[_0x6a78('0x1e')]+_0x2deaa9['limit'];var _0x2d6ef3;if(_0xe0e5e6>=_0x136df2){_0xe0e5e6=_0x136df2;_0x2d6ef3=0xc8;}else{_0x2d6ef3=0xce;}_0x36114f['status'](_0x2d6ef3);return _0x36114f[_0x6a78('0x21')](_0x6a78('0x22'),_0x44f646+'-'+_0xe0e5e6+'/'+_0x136df2)[_0x6a78('0x23')](_0xe2cf95);}return null;};}function patchUpdates(_0x5d135e){return function(_0x3e0dfc){try{jsonpatch['apply'](_0x3e0dfc,_0x5d135e,!![]);}catch(_0x184637){return BPromise['reject'](_0x184637);}return _0x3e0dfc[_0x6a78('0x24')]();};}function saveUpdates(_0x49eb18,_0x598cde){return function(_0x4fbf83){if(_0x4fbf83){return _0x4fbf83['update'](_0x49eb18)['then'](function(_0x3b7bea){return _0x3b7bea;});}return null;};}function removeEntity(_0x3d96a2,_0x677af6){return function(_0x590657){if(_0x590657){return _0x590657[_0x6a78('0x25')]()[_0x6a78('0x26')](function(){_0x3d96a2[_0x6a78('0x1c')](0xcc)[_0x6a78('0x1d')]();});}};}function handleEntityNotFound(_0x56b7c2,_0xa401cb){return function(_0x5ba74f){if(!_0x5ba74f){_0x56b7c2[_0x6a78('0x1b')](0x194);}return _0x5ba74f;};}function handleError(_0x14a3c6,_0x8e8513){_0x8e8513=_0x8e8513||0x1f4;return function(_0x20db54){logger['error'](_0x20db54[_0x6a78('0x27')]);if(_0x20db54[_0x6a78('0x28')]){delete _0x20db54['name'];}_0x14a3c6[_0x6a78('0x1c')](_0x8e8513)['send'](_0x20db54);};}exports[_0x6a78('0x29')]=function(_0x48c692,_0x20a593){var _0x195978={},_0x573903={},_0x31ca28={'count':0x0,'rows':[]};var _0x231f1a=_['map'](db[_0x6a78('0x2a')][_0x6a78('0x2b')],function(_0x5abf0b){return{'name':_0x5abf0b[_0x6a78('0x2c')],'type':_0x5abf0b[_0x6a78('0x2d')][_0x6a78('0x2e')]};});_0x573903[_0x6a78('0x2f')]=_[_0x6a78('0x30')](_0x231f1a,_0x6a78('0x28'));_0x573903[_0x6a78('0x31')]=_['keys'](_0x48c692[_0x6a78('0x31')]);_0x573903[_0x6a78('0x32')]=_['intersection'](_0x573903[_0x6a78('0x2f')],_0x573903['query']);_0x195978[_0x6a78('0x33')]=_[_0x6a78('0x34')](_0x573903['model'],qs[_0x6a78('0x35')](_0x48c692[_0x6a78('0x31')]['fields']));_0x195978[_0x6a78('0x33')]=_0x195978['attributes'][_0x6a78('0x36')]?_0x195978[_0x6a78('0x33')]:_0x573903['model'];if(!_0x48c692['query'][_0x6a78('0x37')](_0x6a78('0x38'))){_0x195978[_0x6a78('0x39')]=qs[_0x6a78('0x39')](_0x48c692['query']['limit']);_0x195978[_0x6a78('0x1e')]=qs['offset'](_0x48c692[_0x6a78('0x31')][_0x6a78('0x1e')]);}_0x195978['order']=qs[_0x6a78('0x3a')](_0x48c692['query'][_0x6a78('0x3a')]);_0x195978[_0x6a78('0x3b')]=qs['filters'](_[_0x6a78('0x3c')](_0x48c692['query'],_0x573903[_0x6a78('0x32')]),_0x231f1a);if(_0x48c692[_0x6a78('0x31')][_0x6a78('0x3d')]){_0x195978[_0x6a78('0x3b')]=_[_0x6a78('0x3e')](_0x195978[_0x6a78('0x3b')],{'$or':_[_0x6a78('0x30')](_0x231f1a,function(_0x24c9ac){if(_0x24c9ac[_0x6a78('0x2d')]!=='VIRTUAL'){var _0x2ede51={};_0x2ede51[_0x24c9ac[_0x6a78('0x28')]]={'$like':'%'+_0x48c692[_0x6a78('0x31')][_0x6a78('0x3d')]+'%'};return _0x2ede51;}})});}_0x195978=_[_0x6a78('0x3e')]({},_0x195978,_0x48c692[_0x6a78('0x3f')]);var _0x403a67={'where':_0x195978[_0x6a78('0x3b')]};return db[_0x6a78('0x2a')][_0x6a78('0x20')](_0x403a67)[_0x6a78('0x26')](function(_0x4d3ad7){_0x31ca28[_0x6a78('0x20')]=_0x4d3ad7;if(_0x48c692['query'][_0x6a78('0x40')]){_0x195978[_0x6a78('0x41')]=[{'all':!![]}];}return db[_0x6a78('0x2a')]['findAll'](_0x195978);})[_0x6a78('0x26')](function(_0x2ec0f9){_0x31ca28[_0x6a78('0x42')]=_0x2ec0f9;return _0x31ca28;})[_0x6a78('0x26')](respondWithFilteredResult(_0x20a593,_0x195978))[_0x6a78('0x43')](handleError(_0x20a593,null));};exports[_0x6a78('0x44')]=function(_0x1e6efd,_0x415481){var _0x3146f8={'raw':!![],'where':{'id':_0x1e6efd[_0x6a78('0x45')]['id']}},_0x27221d={};_0x27221d[_0x6a78('0x2f')]=_[_0x6a78('0x46')](db[_0x6a78('0x2a')][_0x6a78('0x2b')]);_0x27221d['query']=_[_0x6a78('0x46')](_0x1e6efd[_0x6a78('0x31')]);_0x27221d[_0x6a78('0x32')]=_[_0x6a78('0x34')](_0x27221d[_0x6a78('0x2f')],_0x27221d[_0x6a78('0x31')]);_0x3146f8[_0x6a78('0x33')]=_[_0x6a78('0x34')](_0x27221d[_0x6a78('0x2f')],qs['fields'](_0x1e6efd[_0x6a78('0x31')][_0x6a78('0x35')]));_0x3146f8['attributes']=_0x3146f8[_0x6a78('0x33')][_0x6a78('0x36')]?_0x3146f8[_0x6a78('0x33')]:_0x27221d[_0x6a78('0x2f')];if(_0x1e6efd[_0x6a78('0x31')]['includeAll']){_0x3146f8[_0x6a78('0x41')]=[{'all':!![]}];}_0x3146f8=_['merge']({},_0x3146f8,_0x1e6efd[_0x6a78('0x3f')]);return db[_0x6a78('0x2a')][_0x6a78('0x47')](_0x3146f8)[_0x6a78('0x26')](handleEntityNotFound(_0x415481,null))[_0x6a78('0x26')](respondWithResult(_0x415481,null))[_0x6a78('0x43')](handleError(_0x415481,null));};exports[_0x6a78('0x48')]=function(_0x1f35e0,_0xede538){return db[_0x6a78('0x2a')][_0x6a78('0x48')](_0x1f35e0['body'],{})[_0x6a78('0x26')](respondWithResult(_0xede538,0xc9))[_0x6a78('0x43')](handleError(_0xede538,null));};exports[_0x6a78('0x49')]=function(_0x5a64e0,_0x4400f1){if(_0x5a64e0[_0x6a78('0x4a')]['id']){delete _0x5a64e0[_0x6a78('0x4a')]['id'];}return db[_0x6a78('0x2a')][_0x6a78('0x47')]({'where':{'id':_0x5a64e0[_0x6a78('0x45')]['id']}})['then'](handleEntityNotFound(_0x4400f1,null))['then'](saveUpdates(_0x5a64e0['body'],null))[_0x6a78('0x26')](respondWithResult(_0x4400f1,null))[_0x6a78('0x43')](handleError(_0x4400f1,null));};exports[_0x6a78('0x25')]=function(_0x253376,_0x2bcb06){return db[_0x6a78('0x2a')][_0x6a78('0x47')]({'where':{'id':_0x253376[_0x6a78('0x45')]['id']}})[_0x6a78('0x26')](handleEntityNotFound(_0x2bcb06,null))[_0x6a78('0x26')](removeEntity(_0x2bcb06,null))[_0x6a78('0x43')](handleError(_0x2bcb06,null));};exports[_0x6a78('0x4b')]=function(_0x9b1b2,_0x326e59){return db[_0x6a78('0x2a')][_0x6a78('0x4b')]()[_0x6a78('0x26')](respondWithResult(_0x326e59,null))['catch'](handleError(_0x326e59,null));};
\ No newline at end of file
+var _0xf776=['describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','update','then','destroy','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','JscriptyAnswerReport','rows','catch','show','params','includeAll','find','create','body'];(function(_0x27f5fc,_0xb83bba){var _0x723d17=function(_0x669466){while(--_0x669466){_0x27f5fc['push'](_0x27f5fc['shift']());}};_0x723d17(++_0xb83bba);}(_0xf776,0x169));var _0x6f77=function(_0x74bf79,_0x11e397){_0x74bf79=_0x74bf79-0x0;var _0x4d422c=_0xf776[_0x74bf79];return _0x4d422c;};'use strict';var emlformat=require(_0x6f77('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f77('0x1'));var jsonpatch=require(_0x6f77('0x2'));var rp=require('request-promise');var moment=require(_0x6f77('0x3'));var BPromise=require(_0x6f77('0x4'));var Mustache=require(_0x6f77('0x5'));var util=require(_0x6f77('0x6'));var path=require('path');var sox=require(_0x6f77('0x7'));var csv=require('to-csv');var ejs=require(_0x6f77('0x8'));var fs=require('fs');var fs_extra=require(_0x6f77('0x9'));var _=require(_0x6f77('0xa'));var squel=require(_0x6f77('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f77('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6f77('0xd'));var querystring=require(_0x6f77('0xe'));var Papa=require(_0x6f77('0xf'));var Redis=require(_0x6f77('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6f77('0x11'));var as=require(_0x6f77('0x12'));var hardwareService=require(_0x6f77('0x13'));var logger=require(_0x6f77('0x14'))(_0x6f77('0x15'));var utils=require(_0x6f77('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6f77('0x17'));var db=require(_0x6f77('0x18'))['db'];function respondWithStatusCode(_0x150260,_0x17fda5){_0x17fda5=_0x17fda5||0xcc;return function(_0x413e19){if(_0x413e19){return _0x150260[_0x6f77('0x19')](_0x17fda5);}return _0x150260[_0x6f77('0x1a')](_0x17fda5)[_0x6f77('0x1b')]();};}function respondWithResult(_0x34547,_0x28e354){_0x28e354=_0x28e354||0xc8;return function(_0x386c51){if(_0x386c51){return _0x34547[_0x6f77('0x1a')](_0x28e354)['json'](_0x386c51);}};}function respondWithFilteredResult(_0x48c26c,_0x17c0a5){return function(_0x2b9b87){if(_0x2b9b87){var _0x5cf3b9=typeof _0x17c0a5[_0x6f77('0x1c')]==='undefined'&&typeof _0x17c0a5[_0x6f77('0x1d')]===_0x6f77('0x1e');var _0x531908=_0x2b9b87['count'];var _0x42f774=_0x5cf3b9?0x0:_0x17c0a5[_0x6f77('0x1c')];var _0x128e84=_0x5cf3b9?_0x2b9b87[_0x6f77('0x1f')]:_0x17c0a5[_0x6f77('0x1c')]+_0x17c0a5[_0x6f77('0x1d')];var _0x3f9943;if(_0x128e84>=_0x531908){_0x128e84=_0x531908;_0x3f9943=0xc8;}else{_0x3f9943=0xce;}_0x48c26c[_0x6f77('0x1a')](_0x3f9943);return _0x48c26c['set'](_0x6f77('0x20'),_0x42f774+'-'+_0x128e84+'/'+_0x531908)[_0x6f77('0x21')](_0x2b9b87);}return null;};}function patchUpdates(_0x3ce6ad){return function(_0x5298e2){try{jsonpatch['apply'](_0x5298e2,_0x3ce6ad,!![]);}catch(_0x499678){return BPromise[_0x6f77('0x22')](_0x499678);}return _0x5298e2['save']();};}function saveUpdates(_0x142416,_0x2d7970){return function(_0x494765){if(_0x494765){return _0x494765[_0x6f77('0x23')](_0x142416)[_0x6f77('0x24')](function(_0x2df95d){return _0x2df95d;});}return null;};}function removeEntity(_0x292ddc,_0x2c0cb2){return function(_0x5e09d6){if(_0x5e09d6){return _0x5e09d6[_0x6f77('0x25')]()[_0x6f77('0x24')](function(){_0x292ddc[_0x6f77('0x1a')](0xcc)[_0x6f77('0x1b')]();});}};}function handleEntityNotFound(_0x2a8a41,_0x12c392){return function(_0x2a907d){if(!_0x2a907d){_0x2a8a41['sendStatus'](0x194);}return _0x2a907d;};}function handleError(_0x4a35d0,_0x1f4af8){_0x1f4af8=_0x1f4af8||0x1f4;return function(_0x1e503c){logger[_0x6f77('0x26')](_0x1e503c[_0x6f77('0x27')]);if(_0x1e503c[_0x6f77('0x28')]){delete _0x1e503c[_0x6f77('0x28')];}_0x4a35d0['status'](_0x1f4af8)['send'](_0x1e503c);};}exports[_0x6f77('0x29')]=function(_0x3904f9,_0x1d08de){var _0x2f2b23={},_0x1381af={},_0x39afda={'count':0x0,'rows':[]};var _0x265bc2=_[_0x6f77('0x2a')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x36d9d8){return{'name':_0x36d9d8[_0x6f77('0x2b')],'type':_0x36d9d8[_0x6f77('0x2c')][_0x6f77('0x2d')]};});_0x1381af[_0x6f77('0x2e')]=_['map'](_0x265bc2,_0x6f77('0x28'));_0x1381af[_0x6f77('0x2f')]=_[_0x6f77('0x30')](_0x3904f9['query']);_0x1381af[_0x6f77('0x31')]=_['intersection'](_0x1381af['model'],_0x1381af[_0x6f77('0x2f')]);_0x2f2b23[_0x6f77('0x32')]=_[_0x6f77('0x33')](_0x1381af[_0x6f77('0x2e')],qs[_0x6f77('0x34')](_0x3904f9[_0x6f77('0x2f')][_0x6f77('0x34')]));_0x2f2b23[_0x6f77('0x32')]=_0x2f2b23[_0x6f77('0x32')]['length']?_0x2f2b23[_0x6f77('0x32')]:_0x1381af['model'];if(!_0x3904f9[_0x6f77('0x2f')]['hasOwnProperty'](_0x6f77('0x35'))){_0x2f2b23[_0x6f77('0x1d')]=qs['limit'](_0x3904f9[_0x6f77('0x2f')][_0x6f77('0x1d')]);_0x2f2b23[_0x6f77('0x1c')]=qs[_0x6f77('0x1c')](_0x3904f9[_0x6f77('0x2f')]['offset']);}_0x2f2b23[_0x6f77('0x36')]=qs[_0x6f77('0x37')](_0x3904f9[_0x6f77('0x2f')][_0x6f77('0x37')]);_0x2f2b23[_0x6f77('0x38')]=qs['filters'](_[_0x6f77('0x39')](_0x3904f9[_0x6f77('0x2f')],_0x1381af[_0x6f77('0x31')]),_0x265bc2);if(_0x3904f9[_0x6f77('0x2f')][_0x6f77('0x3a')]){_0x2f2b23['where']=_[_0x6f77('0x3b')](_0x2f2b23['where'],{'$or':_[_0x6f77('0x2a')](_0x265bc2,function(_0x21b4aa){if(_0x21b4aa[_0x6f77('0x2c')]!==_0x6f77('0x3c')){var _0x1a77a0={};_0x1a77a0[_0x21b4aa['name']]={'$like':'%'+_0x3904f9[_0x6f77('0x2f')][_0x6f77('0x3a')]+'%'};return _0x1a77a0;}})});}_0x2f2b23=_[_0x6f77('0x3b')]({},_0x2f2b23,_0x3904f9['options']);var _0x69930d={'where':_0x2f2b23[_0x6f77('0x38')]};return db['JscriptyAnswerReport'][_0x6f77('0x1f')](_0x69930d)[_0x6f77('0x24')](function(_0x444c18){_0x39afda[_0x6f77('0x1f')]=_0x444c18;if(_0x3904f9[_0x6f77('0x2f')]['includeAll']){_0x2f2b23[_0x6f77('0x3d')]=[{'all':!![]}];}return db[_0x6f77('0x3e')]['findAll'](_0x2f2b23);})[_0x6f77('0x24')](function(_0x54db2c){_0x39afda[_0x6f77('0x3f')]=_0x54db2c;return _0x39afda;})[_0x6f77('0x24')](respondWithFilteredResult(_0x1d08de,_0x2f2b23))[_0x6f77('0x40')](handleError(_0x1d08de,null));};exports[_0x6f77('0x41')]=function(_0x24cc1b,_0x13f1ef){var _0x24fde8={'raw':!![],'where':{'id':_0x24cc1b[_0x6f77('0x42')]['id']}},_0x46a735={};_0x46a735['model']=_[_0x6f77('0x30')](db[_0x6f77('0x3e')]['rawAttributes']);_0x46a735['query']=_[_0x6f77('0x30')](_0x24cc1b[_0x6f77('0x2f')]);_0x46a735['filters']=_[_0x6f77('0x33')](_0x46a735[_0x6f77('0x2e')],_0x46a735[_0x6f77('0x2f')]);_0x24fde8[_0x6f77('0x32')]=_[_0x6f77('0x33')](_0x46a735[_0x6f77('0x2e')],qs['fields'](_0x24cc1b['query'][_0x6f77('0x34')]));_0x24fde8[_0x6f77('0x32')]=_0x24fde8[_0x6f77('0x32')]['length']?_0x24fde8[_0x6f77('0x32')]:_0x46a735[_0x6f77('0x2e')];if(_0x24cc1b[_0x6f77('0x2f')][_0x6f77('0x43')]){_0x24fde8['include']=[{'all':!![]}];}_0x24fde8=_['merge']({},_0x24fde8,_0x24cc1b['options']);return db['JscriptyAnswerReport'][_0x6f77('0x44')](_0x24fde8)[_0x6f77('0x24')](handleEntityNotFound(_0x13f1ef,null))[_0x6f77('0x24')](respondWithResult(_0x13f1ef,null))['catch'](handleError(_0x13f1ef,null));};exports[_0x6f77('0x45')]=function(_0x5d0568,_0x2c5ddd){return db[_0x6f77('0x3e')][_0x6f77('0x45')](_0x5d0568[_0x6f77('0x46')],{})[_0x6f77('0x24')](respondWithResult(_0x2c5ddd,0xc9))['catch'](handleError(_0x2c5ddd,null));};exports[_0x6f77('0x23')]=function(_0x11aaa4,_0x5acdd0){if(_0x11aaa4[_0x6f77('0x46')]['id']){delete _0x11aaa4['body']['id'];}return db['JscriptyAnswerReport'][_0x6f77('0x44')]({'where':{'id':_0x11aaa4[_0x6f77('0x42')]['id']}})[_0x6f77('0x24')](handleEntityNotFound(_0x5acdd0,null))[_0x6f77('0x24')](saveUpdates(_0x11aaa4[_0x6f77('0x46')],null))[_0x6f77('0x24')](respondWithResult(_0x5acdd0,null))[_0x6f77('0x40')](handleError(_0x5acdd0,null));};exports[_0x6f77('0x25')]=function(_0x193282,_0x5543a4){return db['JscriptyAnswerReport'][_0x6f77('0x44')]({'where':{'id':_0x193282['params']['id']}})[_0x6f77('0x24')](handleEntityNotFound(_0x5543a4,null))[_0x6f77('0x24')](removeEntity(_0x5543a4,null))['catch'](handleError(_0x5543a4,null));};exports[_0x6f77('0x47')]=function(_0x2b34b2,_0x1c4e90){return db[_0x6f77('0x3e')][_0x6f77('0x47')]()[_0x6f77('0x24')](respondWithResult(_0x1c4e90,null))[_0x6f77('0x40')](handleError(_0x1c4e90,null));};
\ No newline at end of file
index a3c063f..74f758f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb855=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','moment','bluebird','../../config/environment','exports'];(function(_0x446619,_0x309726){var _0x20f039=function(_0x4a75d3){while(--_0x4a75d3){_0x446619['push'](_0x446619['shift']());}};_0x20f039(++_0x309726);}(_0xb855,0x102));var _0x5b85=function(_0x3e2e40,_0x5e42ed){_0x3e2e40=_0x3e2e40-0x0;var _0x3cdf0a=_0xb855[_0x3e2e40];return _0x3cdf0a;};'use strict';var _=require(_0x5b85('0x0'));var util=require(_0x5b85('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5b85('0x2'));var BPromise=require(_0x5b85('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5b85('0x4'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x5b85('0x5')]=function(_0x3a83fe,_0x431bcc){return _0x3a83fe['define'](_0x5b85('0x6'),attributes,{'tableName':_0x5b85('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x0b1b=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','JscriptyAnswerReport','lodash'];(function(_0x4faed6,_0x261245){var _0x135850=function(_0x1a2176){while(--_0x1a2176){_0x4faed6['push'](_0x4faed6['shift']());}};_0x135850(++_0x261245);}(_0x0b1b,0x121));var _0xb0b1=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x0b1b[_0x29d915];return _0x160f86;};'use strict';var _=require(_0xb0b1('0x0'));var util=require('util');var logger=require(_0xb0b1('0x1'))(_0xb0b1('0x2'));var moment=require(_0xb0b1('0x3'));var BPromise=require(_0xb0b1('0x4'));var rp=require(_0xb0b1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb0b1('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xb0b1('0x7')]=function(_0x2e4969,_0x8ba26e){return _0x2e4969[_0xb0b1('0x8')](_0xb0b1('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c88deb8..b381e7b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0e0c=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird'];(function(_0x3965a9,_0x40b6dc){var _0x4c0410=function(_0x55493e){while(--_0x55493e){_0x3965a9['push'](_0x3965a9['shift']());}};_0x4c0410(++_0x40b6dc);}(_0x0e0c,0x11c));var _0xc0e0=function(_0x5c09d6,_0x2db138){_0x5c09d6=_0x5c09d6-0x0;var _0x5d78ca=_0x0e0c[_0x5c09d6];return _0x5d78ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc0e0('0x0'));var BPromise=require(_0xc0e0('0x1'));var rs=require(_0xc0e0('0x2'));var fs=require('fs');var Redis=require(_0xc0e0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0e0('0x4'));var logger=require(_0xc0e0('0x5'))(_0xc0e0('0x6'));var config=require(_0xc0e0('0x7'));var jayson=require(_0xc0e0('0x8'));var client=jayson[_0xc0e0('0x9')][_0xc0e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f4051,_0x53c3fa,_0x58669b){return new BPromise(function(_0x34650b,_0x448780){return client[_0xc0e0('0xb')](_0x2f4051,_0x58669b)[_0xc0e0('0xc')](function(_0x33716e){logger[_0xc0e0('0xd')](_0xc0e0('0xe'),_0x53c3fa,_0xc0e0('0xf'));logger['debug'](_0xc0e0('0x10'),_0x53c3fa,_0xc0e0('0xf'),JSON['stringify'](_0x33716e));if(_0x33716e[_0xc0e0('0x11')]){if(_0x33716e[_0xc0e0('0x11')][_0xc0e0('0x12')]===0x1f4){logger[_0xc0e0('0x11')](_0xc0e0('0xe'),_0x53c3fa,_0x33716e[_0xc0e0('0x11')][_0xc0e0('0x13')]);return _0x448780(_0x33716e['error']['message']);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x53c3fa,_0x33716e[_0xc0e0('0x11')][_0xc0e0('0x13')]);return _0x34650b(_0x33716e['error']['message']);}else{logger[_0xc0e0('0xd')](_0xc0e0('0xe'),_0x53c3fa,_0xc0e0('0xf'));_0x34650b(_0x33716e[_0xc0e0('0x14')]['message']);}})[_0xc0e0('0x15')](function(_0x329df0){logger[_0xc0e0('0x11')](_0xc0e0('0xe'),_0x53c3fa,_0x329df0);_0x448780(_0x329df0);});});}
\ No newline at end of file
+var _0x7788=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x1d35b4,_0x1fee09){var _0x1e4f6d=function(_0x51a0d9){while(--_0x51a0d9){_0x1d35b4['push'](_0x1d35b4['shift']());}};_0x1e4f6d(++_0x1fee09);}(_0x7788,0x1a5));var _0x8778=function(_0x5ca0b3,_0x33f5ef){_0x5ca0b3=_0x5ca0b3-0x0;var _0x6ba806=_0x7788[_0x5ca0b3];return _0x6ba806;};'use strict';var _=require(_0x8778('0x0'));var util=require(_0x8778('0x1'));var moment=require(_0x8778('0x2'));var BPromise=require(_0x8778('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8778('0x4'));var db=require(_0x8778('0x5'))['db'];var utils=require(_0x8778('0x6'));var logger=require('../../config/logger')(_0x8778('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8778('0x8')][_0x8778('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cd8a3,_0x467037,_0x4f68ad){return new BPromise(function(_0x1744b7,_0x23a700){return client[_0x8778('0xa')](_0x4cd8a3,_0x4f68ad)[_0x8778('0xb')](function(_0x5b4223){logger['info'](_0x8778('0xc'),_0x467037,_0x8778('0xd'));logger[_0x8778('0xe')](_0x8778('0xf'),_0x467037,_0x8778('0xd'),JSON['stringify'](_0x5b4223));if(_0x5b4223[_0x8778('0x10')]){if(_0x5b4223[_0x8778('0x10')][_0x8778('0x11')]===0x1f4){logger[_0x8778('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x467037,_0x5b4223[_0x8778('0x10')][_0x8778('0x12')]);return _0x23a700(_0x5b4223[_0x8778('0x10')][_0x8778('0x12')]);}logger[_0x8778('0x10')](_0x8778('0xc'),_0x467037,_0x5b4223[_0x8778('0x10')][_0x8778('0x12')]);return _0x1744b7(_0x5b4223[_0x8778('0x10')][_0x8778('0x12')]);}else{logger[_0x8778('0x13')](_0x8778('0xc'),_0x467037,'request\x20sent');_0x1744b7(_0x5b4223[_0x8778('0x14')][_0x8778('0x12')]);}})['catch'](function(_0x2c960d){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x467037,_0x2c960d);_0x23a700(_0x2c960d);});});}
\ No newline at end of file
index 02e7bd3..28f38e3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfb28=['get','isAuthenticated','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller'];(function(_0x5d79c8,_0x5c690f){var _0x381ee2=function(_0x716683){while(--_0x716683){_0x5d79c8['push'](_0x5d79c8['shift']());}};_0x381ee2(++_0x5c690f);}(_0xfb28,0x161));var _0x8fb2=function(_0x2d0295,_0x5c7c98){_0x2d0295=_0x2d0295-0x0;var _0x53fba1=_0xfb28[_0x2d0295];return _0x53fba1;};'use strict';var multer=require(_0x8fb2('0x0'));var util=require(_0x8fb2('0x1'));var path=require(_0x8fb2('0x2'));var timeout=require(_0x8fb2('0x3'));var express=require(_0x8fb2('0x4'));var router=express[_0x8fb2('0x5')]();var fs_extra=require(_0x8fb2('0x6'));var auth=require(_0x8fb2('0x7'));var interaction=require(_0x8fb2('0x8'));var config=require(_0x8fb2('0x9'));var controller=require(_0x8fb2('0xa'));router[_0x8fb2('0xb')]('/',auth[_0x8fb2('0xc')](),controller['index']);router['get'](_0x8fb2('0xd'),auth[_0x8fb2('0xc')](),controller[_0x8fb2('0xe')]);router['get']('/:id/sessions',auth[_0x8fb2('0xc')](),controller[_0x8fb2('0xf')]);router[_0x8fb2('0xb')](_0x8fb2('0x10'),auth['isAuthenticated'](),controller[_0x8fb2('0x11')]);router[_0x8fb2('0xb')](_0x8fb2('0x12'),auth[_0x8fb2('0xc')](),timeout(_0x8fb2('0x13')),controller[_0x8fb2('0x14')]);router[_0x8fb2('0x15')]('/',auth[_0x8fb2('0xc')](),controller['create']);router[_0x8fb2('0x15')](_0x8fb2('0x16'),auth[_0x8fb2('0xc')](),controller[_0x8fb2('0x17')]);router[_0x8fb2('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x8fb2('0x19')]);router[_0x8fb2('0x1a')](_0x8fb2('0xd'),auth[_0x8fb2('0xc')](),controller['destroy']);module[_0x8fb2('0x1b')]=router;
\ No newline at end of file
+var _0x468d=['30s','getSummary','post','clone','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','index','get','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x468d,0x73));var _0xd468=function(_0x4aba89,_0x12e529){_0x4aba89=_0x4aba89-0x0;var _0x2e50b0=_0x468d[_0x4aba89];return _0x2e50b0;};'use strict';var multer=require(_0xd468('0x0'));var util=require(_0xd468('0x1'));var path=require(_0xd468('0x2'));var timeout=require(_0xd468('0x3'));var express=require(_0xd468('0x4'));var router=express[_0xd468('0x5')]();var fs_extra=require(_0xd468('0x6'));var auth=require(_0xd468('0x7'));var interaction=require(_0xd468('0x8'));var config=require(_0xd468('0x9'));var controller=require(_0xd468('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xd468('0xb')]);router[_0xd468('0xc')](_0xd468('0xd'),auth[_0xd468('0xe')](),controller[_0xd468('0xf')]);router[_0xd468('0xc')](_0xd468('0x10'),auth[_0xd468('0xe')](),controller[_0xd468('0x11')]);router[_0xd468('0xc')](_0xd468('0x12'),auth[_0xd468('0xe')](),controller[_0xd468('0x13')]);router['get']('/:id/summary',auth[_0xd468('0xe')](),timeout(_0xd468('0x14')),controller[_0xd468('0x15')]);router['post']('/',auth[_0xd468('0xe')](),controller['create']);router[_0xd468('0x16')]('/:id/clone',auth[_0xd468('0xe')](),controller[_0xd468('0x17')]);router[_0xd468('0x18')]('/:id',auth[_0xd468('0xe')](),controller[_0xd468('0x19')]);router[_0xd468('0x1a')](_0xd468('0xd'),auth[_0xd468('0xe')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index 8e98651..b7b112d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4c6f=['BOOLEAN','sequelize','lodash','util','exports','STRING','name','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x4a45df,_0x10ac16){var _0x5a1345=function(_0x55cb34){while(--_0x55cb34){_0x4a45df['push'](_0x4a45df['shift']());}};_0x5a1345(++_0x10ac16);}(_0x4c6f,0x89));var _0xf4c6=function(_0x441f7a,_0x576321){_0x441f7a=_0x441f7a-0x0;var _0x4821da=_0x4c6f[_0x441f7a];return _0x4821da;};'use strict';var Sequelize=require(_0xf4c6('0x0'));var _=require(_0xf4c6('0x1'));var util=require(_0xf4c6('0x2'));module[_0xf4c6('0x3')]={'name':{'type':Sequelize[_0xf4c6('0x4')],'unique':_0xf4c6('0x5')},'description':{'type':Sequelize[_0xf4c6('0x4')]},'formData':{'type':Sequelize['TEXT'](_0xf4c6('0x6')),'set':function(_0x1acfdd){if(_[_0xf4c6('0x7')](_0x1acfdd)){this[_0xf4c6('0x8')](_0xf4c6('0x9'),JSON[_0xf4c6('0xa')](_0x1acfdd));}else if(_[_0xf4c6('0xb')](_0x1acfdd)){this['setDataValue']('formData',_0x1acfdd);}else{this[_0xf4c6('0x8')]('formData',util[_0xf4c6('0xc')](_0xf4c6('0xd'),this[_0xf4c6('0xe')](_0xf4c6('0x5'))||'',this['getDataValue'](_0xf4c6('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf4c6('0x10')],'defaultValue':![]}};
\ No newline at end of file
+var _0xe000=['stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','exports','STRING','name','TEXT','isObjectLike','setDataValue','formData'];(function(_0x761b6d,_0x7c7fa8){var _0x3a1639=function(_0x33b90a){while(--_0x33b90a){_0x761b6d['push'](_0x761b6d['shift']());}};_0x3a1639(++_0x7c7fa8);}(_0xe000,0x1b8));var _0x0e00=function(_0x2c4831,_0x4f36f9){_0x2c4831=_0x2c4831-0x0;var _0x3dce74=_0xe000[_0x2c4831];return _0x3dce74;};'use strict';var Sequelize=require('sequelize');var _=require(_0x0e00('0x0'));var util=require('util');module[_0x0e00('0x1')]={'name':{'type':Sequelize[_0x0e00('0x2')],'unique':_0x0e00('0x3')},'description':{'type':Sequelize[_0x0e00('0x2')]},'formData':{'type':Sequelize[_0x0e00('0x4')]('long'),'set':function(_0x29adfd){if(_[_0x0e00('0x5')](_0x29adfd)){this[_0x0e00('0x6')](_0x0e00('0x7'),JSON[_0x0e00('0x8')](_0x29adfd));}else if(_[_0x0e00('0x9')](_0x29adfd)){this[_0x0e00('0x6')](_0x0e00('0x7'),_0x29adfd);}else{this[_0x0e00('0x6')](_0x0e00('0x7'),util['format'](_0x0e00('0xa'),this[_0x0e00('0xb')](_0x0e00('0x3'))||'',this['getDataValue'](_0x0e00('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x0e00('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x0e00('0xd')],'defaultValue':![]}};
\ No newline at end of file
index 96f7fb3..ec7a001 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd5e5=['Projects','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','body','getSessions','findOne','ProjectId','JscriptySessionReport','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','starttime','parse','startTime','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Content-type','text/csv','download','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','fieldName','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get'];(function(_0x4f517b,_0x2fe10e){var _0x1fadeb=function(_0x546304){while(--_0x546304){_0x4f517b['push'](_0x4f517b['shift']());}};_0x1fadeb(++_0x2fe10e);}(_0xd5e5,0x187));var _0x5d5e=function(_0x11a5f0,_0x279d5c){_0x11a5f0=_0x11a5f0-0x0;var _0x25fa99=_0xd5e5[_0x11a5f0];return _0x25fa99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d5e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d5e('0x1'));var rp=require('request-promise');var moment=require(_0x5d5e('0x2'));var BPromise=require(_0x5d5e('0x3'));var Mustache=require(_0x5d5e('0x4'));var util=require(_0x5d5e('0x5'));var path=require(_0x5d5e('0x6'));var sox=require(_0x5d5e('0x7'));var csv=require(_0x5d5e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d5e('0x9'));var _=require(_0x5d5e('0xa'));var squel=require(_0x5d5e('0xb'));var crypto=require(_0x5d5e('0xc'));var jsforce=require(_0x5d5e('0xd'));var deskjs=require(_0x5d5e('0xe'));var toCsv=require(_0x5d5e('0x8'));var querystring=require(_0x5d5e('0xf'));var Papa=require(_0x5d5e('0x10'));var Redis=require('ioredis');var authService=require(_0x5d5e('0x11'));var qs=require(_0x5d5e('0x12'));var as=require(_0x5d5e('0x13'));var hardwareService=require(_0x5d5e('0x14'));var logger=require(_0x5d5e('0x15'))(_0x5d5e('0x16'));var utils=require(_0x5d5e('0x17'));var config=require(_0x5d5e('0x18'));var licenseUtil=require(_0x5d5e('0x19'));var db=require(_0x5d5e('0x1a'))['db'];function respondWithStatusCode(_0x280081,_0x473342){_0x473342=_0x473342||0xcc;return function(_0x45708f){if(_0x45708f){return _0x280081[_0x5d5e('0x1b')](_0x473342);}return _0x280081[_0x5d5e('0x1c')](_0x473342)[_0x5d5e('0x1d')]();};}function respondWithResult(_0x1d5e7b,_0x1eb073){_0x1eb073=_0x1eb073||0xc8;return function(_0x3ddf9e){if(_0x3ddf9e){return _0x1d5e7b['status'](_0x1eb073)['json'](_0x3ddf9e);}};}function respondWithFilteredResult(_0x2e47f2,_0x549c2e){return function(_0x4f68e1){if(_0x4f68e1){var _0x248cad=typeof _0x549c2e['offset']==='undefined'&&typeof _0x549c2e[_0x5d5e('0x1e')]===_0x5d5e('0x1f');var _0x219d21=_0x4f68e1[_0x5d5e('0x20')];var _0x1746fe=_0x248cad?0x0:_0x549c2e[_0x5d5e('0x21')];var _0x4e9bbf=_0x248cad?_0x4f68e1[_0x5d5e('0x20')]:_0x549c2e[_0x5d5e('0x21')]+_0x549c2e[_0x5d5e('0x1e')];var _0x553c79;if(_0x4e9bbf>=_0x219d21){_0x4e9bbf=_0x219d21;_0x553c79=0xc8;}else{_0x553c79=0xce;}_0x2e47f2[_0x5d5e('0x1c')](_0x553c79);return _0x2e47f2[_0x5d5e('0x22')](_0x5d5e('0x23'),_0x1746fe+'-'+_0x4e9bbf+'/'+_0x219d21)[_0x5d5e('0x24')](_0x4f68e1);}return null;};}function patchUpdates(_0x439c11){return function(_0x362779){try{jsonpatch[_0x5d5e('0x25')](_0x362779,_0x439c11,!![]);}catch(_0x536cb0){return BPromise[_0x5d5e('0x26')](_0x536cb0);}return _0x362779[_0x5d5e('0x27')]();};}function saveUpdates(_0x36a383,_0x2261ae){return function(_0x2023f3){if(_0x2023f3){return _0x2023f3[_0x5d5e('0x28')](_0x36a383)[_0x5d5e('0x29')](function(_0x3df3d){return _0x3df3d;});}return null;};}function removeEntity(_0x4fd2bd,_0x523c1c){return function(_0x494258){if(_0x494258){return _0x494258[_0x5d5e('0x2a')]()[_0x5d5e('0x29')](function(){var _0x51fa72=_0x494258['get']({'plain':!![]});var _0x2798ec='Projects';return db[_0x5d5e('0x2b')][_0x5d5e('0x2a')]({'where':{'type':_0x2798ec,'resourceId':_0x51fa72['id']}})[_0x5d5e('0x29')](function(){return _0x494258;});})[_0x5d5e('0x29')](function(){_0x4fd2bd['status'](0xcc)[_0x5d5e('0x1d')]();});}};}function handleEntityNotFound(_0x33d730,_0x4561a7){return function(_0x2bd58f){if(!_0x2bd58f){_0x33d730[_0x5d5e('0x1b')](0x194);}return _0x2bd58f;};}function handleError(_0x11e96,_0x2b84ae){_0x2b84ae=_0x2b84ae||0x1f4;return function(_0x352487){logger[_0x5d5e('0x2c')](_0x352487[_0x5d5e('0x2d')]);if(_0x352487[_0x5d5e('0x2e')]){delete _0x352487[_0x5d5e('0x2e')];}_0x11e96[_0x5d5e('0x1c')](_0x2b84ae)[_0x5d5e('0x2f')](_0x352487);};}exports[_0x5d5e('0x30')]=function(_0x1d4066,_0x569427){var _0x1f0bd9={},_0x4f3af0={},_0x557ee4={'count':0x0,'rows':[]};var _0x192b07=_[_0x5d5e('0x31')](db[_0x5d5e('0x32')]['rawAttributes'],function(_0xaa58f8){return{'name':_0xaa58f8[_0x5d5e('0x33')],'type':_0xaa58f8[_0x5d5e('0x34')][_0x5d5e('0x35')]};});_0x4f3af0['model']=_[_0x5d5e('0x31')](_0x192b07,_0x5d5e('0x2e'));_0x4f3af0[_0x5d5e('0x36')]=_[_0x5d5e('0x37')](_0x1d4066[_0x5d5e('0x36')]);_0x4f3af0['filters']=_['intersection'](_0x4f3af0[_0x5d5e('0x38')],_0x4f3af0[_0x5d5e('0x36')]);_0x1f0bd9[_0x5d5e('0x39')]=_['intersection'](_0x4f3af0['model'],qs[_0x5d5e('0x3a')](_0x1d4066['query']['fields']));_0x1f0bd9[_0x5d5e('0x39')]=_0x1f0bd9[_0x5d5e('0x39')][_0x5d5e('0x3b')]?_0x1f0bd9[_0x5d5e('0x39')]:_0x4f3af0[_0x5d5e('0x38')];if(!_0x1d4066[_0x5d5e('0x36')][_0x5d5e('0x3c')](_0x5d5e('0x3d'))){_0x1f0bd9[_0x5d5e('0x1e')]=qs[_0x5d5e('0x1e')](_0x1d4066[_0x5d5e('0x36')][_0x5d5e('0x1e')]);_0x1f0bd9[_0x5d5e('0x21')]=qs[_0x5d5e('0x21')](_0x1d4066[_0x5d5e('0x36')][_0x5d5e('0x21')]);}_0x1f0bd9[_0x5d5e('0x3e')]=qs[_0x5d5e('0x3f')](_0x1d4066[_0x5d5e('0x36')][_0x5d5e('0x3f')]);_0x1f0bd9['where']=qs[_0x5d5e('0x40')](_[_0x5d5e('0x41')](_0x1d4066[_0x5d5e('0x36')],_0x4f3af0[_0x5d5e('0x40')]),_0x192b07);if(_0x1d4066[_0x5d5e('0x36')][_0x5d5e('0x42')]){_0x1f0bd9[_0x5d5e('0x43')]=_[_0x5d5e('0x44')](_0x1f0bd9['where'],{'$or':_[_0x5d5e('0x31')](_0x192b07,function(_0x5399be){if(_0x5399be[_0x5d5e('0x34')]!==_0x5d5e('0x45')){var _0x2e580b={};_0x2e580b[_0x5399be[_0x5d5e('0x2e')]]={'$like':'%'+_0x1d4066[_0x5d5e('0x36')]['filter']+'%'};return _0x2e580b;}})});}_0x1f0bd9=_[_0x5d5e('0x44')]({},_0x1f0bd9,_0x1d4066[_0x5d5e('0x46')]);var _0x37a0cc={'where':_0x1f0bd9[_0x5d5e('0x43')]};return db[_0x5d5e('0x32')]['count'](_0x37a0cc)['then'](function(_0x7aa9ea){_0x557ee4[_0x5d5e('0x20')]=_0x7aa9ea;if(_0x1d4066['query'][_0x5d5e('0x47')]){_0x1f0bd9[_0x5d5e('0x48')]=[{'all':!![]}];}return db['JscriptyProject'][_0x5d5e('0x49')](_0x1f0bd9);})['then'](function(_0x5d3f1a){_0x557ee4[_0x5d5e('0x4a')]=_0x5d3f1a;return _0x557ee4;})[_0x5d5e('0x29')](respondWithFilteredResult(_0x569427,_0x1f0bd9))[_0x5d5e('0x4b')](handleError(_0x569427,null));};exports[_0x5d5e('0x4c')]=function(_0x256fbb,_0x3c0081){var _0x48217e={'raw':![],'where':{'id':_0x256fbb[_0x5d5e('0x4d')]['id']}},_0x150710={};_0x150710[_0x5d5e('0x38')]=_['keys'](db[_0x5d5e('0x32')][_0x5d5e('0x4e')]);_0x150710[_0x5d5e('0x36')]=_[_0x5d5e('0x37')](_0x256fbb[_0x5d5e('0x36')]);_0x150710[_0x5d5e('0x40')]=_[_0x5d5e('0x4f')](_0x150710[_0x5d5e('0x38')],_0x150710[_0x5d5e('0x36')]);_0x48217e[_0x5d5e('0x39')]=_[_0x5d5e('0x4f')](_0x150710[_0x5d5e('0x38')],qs[_0x5d5e('0x3a')](_0x256fbb[_0x5d5e('0x36')][_0x5d5e('0x3a')]));_0x48217e['attributes']=_0x48217e[_0x5d5e('0x39')][_0x5d5e('0x3b')]?_0x48217e['attributes']:_0x150710['model'];if(_0x256fbb[_0x5d5e('0x36')][_0x5d5e('0x47')]){_0x48217e['include']=[{'all':!![]}];}_0x48217e=_[_0x5d5e('0x44')]({},_0x48217e,_0x256fbb[_0x5d5e('0x46')]);return db[_0x5d5e('0x32')]['find'](_0x48217e)[_0x5d5e('0x29')](handleEntityNotFound(_0x3c0081,null))[_0x5d5e('0x29')](respondWithResult(_0x3c0081,null))[_0x5d5e('0x4b')](handleError(_0x3c0081,null));};exports['create']=function(_0x5c339e,_0x400aac){return db[_0x5d5e('0x32')][_0x5d5e('0x50')](_0x5c339e['body'],{})[_0x5d5e('0x29')](function(_0x12d549){var _0x4bc940=_0x5c339e[_0x5d5e('0x51')]['get']({'plain':!![]});if(!_0x4bc940)throw new Error(_0x5d5e('0x52'));if(_0x4bc940[_0x5d5e('0x53')]===_0x5d5e('0x51')){var _0x4fc72c=_0x12d549[_0x5d5e('0x54')]({'plain':!![]});var _0x2cdc83=_0x5d5e('0x55');return db[_0x5d5e('0x56')][_0x5d5e('0x57')]({'where':{'name':_0x2cdc83,'userProfileId':_0x4bc940['userProfileId']},'raw':!![]})[_0x5d5e('0x29')](function(_0x339d58){if(_0x339d58&&_0x339d58[_0x5d5e('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x4fc72c[_0x5d5e('0x2e')],'resourceId':_0x4fc72c['id'],'type':_0x339d58['name'],'sectionId':_0x339d58['id']},{})['then'](function(){return _0x12d549;});}else{return _0x12d549;}})[_0x5d5e('0x4b')](function(_0x29e56a){logger[_0x5d5e('0x2c')](_0x5d5e('0x59'),_0x29e56a);throw _0x29e56a;});}return _0x12d549;})[_0x5d5e('0x29')](respondWithResult(_0x400aac,0xc9))[_0x5d5e('0x4b')](handleError(_0x400aac,null));};exports['clone']=function(_0x146862,_0x3f4df2){var _0x20ca89={'where':{'id':_0x146862[_0x5d5e('0x4d')]['id']}},_0x434f44={};_0x434f44[_0x5d5e('0x38')]=_[_0x5d5e('0x37')](db['JscriptyProject'][_0x5d5e('0x4e')]);_0x20ca89[_0x5d5e('0x39')]=_[_0x5d5e('0x4f')](_0x434f44[_0x5d5e('0x38')],qs[_0x5d5e('0x3a')](_0x146862[_0x5d5e('0x36')]['fields']));_0x20ca89['attributes']=_0x20ca89['attributes'][_0x5d5e('0x3b')]?_0x20ca89[_0x5d5e('0x39')]:_0x434f44[_0x5d5e('0x38')];if(_0x146862[_0x5d5e('0x36')][_0x5d5e('0x47')]){_0x20ca89[_0x5d5e('0x48')]=[{'all':!![]}];}_0x20ca89=_['merge']({},_0x20ca89,_0x146862[_0x5d5e('0x46')]);return db['JscriptyProject'][_0x5d5e('0x57')](_0x20ca89)[_0x5d5e('0x29')](handleEntityNotFound(_0x3f4df2,null))[_0x5d5e('0x29')](function(_0x4a933f){if(_0x4a933f){var _0x2c23f4=_0x4a933f[_0x5d5e('0x54')]({'plain':!![]});_0x2c23f4=qs['omit'](_0x2c23f4,['id',_0x5d5e('0x5a'),'updatedAt']);_0x146862[_0x5d5e('0x5b')]=_['omit'](_0x146862[_0x5d5e('0x5b')],['id',_0x5d5e('0x5a'),'updatedAt']);return db[_0x5d5e('0x32')]['create'](_[_0x5d5e('0x44')](_0x2c23f4,_0x146862[_0x5d5e('0x5b')]),{'include':_0x146862[_0x5d5e('0x36')][_0x5d5e('0x47')]?[{'all':!![]}]:undefined})[_0x5d5e('0x29')](function(_0x49004b){var _0x574942=_0x146862[_0x5d5e('0x51')][_0x5d5e('0x54')]({'plain':!![]});if(!_0x574942)throw new Error(_0x5d5e('0x52'));if(_0x574942['role']===_0x5d5e('0x51')){var _0x5d1e53=_0x49004b[_0x5d5e('0x54')]({'plain':!![]});var _0x181aea=_0x5d5e('0x55');return db[_0x5d5e('0x56')][_0x5d5e('0x57')]({'where':{'name':_0x181aea,'userProfileId':_0x574942['userProfileId']},'raw':!![]})[_0x5d5e('0x29')](function(_0x40503c){if(_0x40503c&&_0x40503c[_0x5d5e('0x58')]===0x0){return db[_0x5d5e('0x2b')][_0x5d5e('0x50')]({'name':_0x5d1e53['name'],'resourceId':_0x5d1e53['id'],'type':_0x40503c[_0x5d5e('0x2e')],'sectionId':_0x40503c['id']},{})[_0x5d5e('0x29')](function(){return _0x49004b;});}else{return _0x49004b;}})[_0x5d5e('0x4b')](function(_0x2fd0a8){logger[_0x5d5e('0x2c')](_0x5d5e('0x59'),_0x2fd0a8);throw _0x2fd0a8;});}return _0x49004b;});}})[_0x5d5e('0x29')](respondWithResult(_0x3f4df2,0xc9))['catch'](handleError(_0x3f4df2,null));};exports[_0x5d5e('0x28')]=function(_0x5cbe18,_0x467842){if(_0x5cbe18['body']['id']){delete _0x5cbe18[_0x5d5e('0x5b')]['id'];}return db[_0x5d5e('0x32')][_0x5d5e('0x57')]({'where':{'id':_0x5cbe18[_0x5d5e('0x4d')]['id']}})[_0x5d5e('0x29')](handleEntityNotFound(_0x467842,null))[_0x5d5e('0x29')](saveUpdates(_0x5cbe18['body'],null))[_0x5d5e('0x29')](respondWithResult(_0x467842,null))[_0x5d5e('0x4b')](handleError(_0x467842,null));};exports[_0x5d5e('0x2a')]=function(_0x10bb14,_0x3e3445){return db[_0x5d5e('0x32')][_0x5d5e('0x57')]({'where':{'id':_0x10bb14[_0x5d5e('0x4d')]['id']}})[_0x5d5e('0x29')](handleEntityNotFound(_0x3e3445,null))[_0x5d5e('0x29')](removeEntity(_0x3e3445,null))[_0x5d5e('0x4b')](handleError(_0x3e3445,null));};exports[_0x5d5e('0x5c')]=function(_0x300905,_0x5e0994,_0x4ff0a4){var _0x29130b={'raw':!![],'where':{}};var _0x5155c0={};var _0xfde3c6={'count':0x0,'rows':[]};return db[_0x5d5e('0x32')][_0x5d5e('0x5d')]({'where':{'id':_0x300905[_0x5d5e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5e0994,null))[_0x5d5e('0x29')](function(_0x1e47d5){if(_0x1e47d5){_0x5155c0[_0x5d5e('0x38')]=_[_0x5d5e('0x37')](db['JscriptySessionReport'][_0x5d5e('0x4e')]);_0x5155c0[_0x5d5e('0x36')]=_['keys'](_0x300905[_0x5d5e('0x36')]);_0x5155c0[_0x5d5e('0x40')]=_[_0x5d5e('0x4f')](_0x5155c0[_0x5d5e('0x38')],_0x5155c0[_0x5d5e('0x36')]);_0x29130b[_0x5d5e('0x39')]=_[_0x5d5e('0x4f')](_0x5155c0[_0x5d5e('0x38')],qs['fields'](_0x300905[_0x5d5e('0x36')][_0x5d5e('0x3a')]));_0x29130b[_0x5d5e('0x39')]=_0x29130b[_0x5d5e('0x39')][_0x5d5e('0x3b')]?_0x29130b[_0x5d5e('0x39')]:_0x5155c0['model'];if(!_0x300905[_0x5d5e('0x36')][_0x5d5e('0x3c')](_0x5d5e('0x3d'))){_0x29130b[_0x5d5e('0x1e')]=qs['limit'](_0x300905['query'][_0x5d5e('0x1e')]);_0x29130b['offset']=qs[_0x5d5e('0x21')](_0x300905[_0x5d5e('0x36')][_0x5d5e('0x21')]);}_0x29130b['order']=qs[_0x5d5e('0x3f')](_0x300905[_0x5d5e('0x36')]['sort']);_0x29130b[_0x5d5e('0x43')]=qs[_0x5d5e('0x40')](_[_0x5d5e('0x41')](_0x300905[_0x5d5e('0x36')],_0x5155c0[_0x5d5e('0x40')]));_0x29130b['where'][_0x5d5e('0x5e')]=_0x1e47d5['id'];if(_0x300905[_0x5d5e('0x36')][_0x5d5e('0x42')]){_0x29130b['where']=_[_0x5d5e('0x44')](_0x29130b[_0x5d5e('0x43')],{'$or':_[_0x5d5e('0x31')](_0x29130b['attributes'],function(_0x798473){var _0x229ac4={};_0x229ac4[_0x798473]={'$like':'%'+_0x300905[_0x5d5e('0x36')]['filter']+'%'};return _0x229ac4;})});}_0x29130b=_['merge']({},_0x29130b,_0x300905['options']);return db[_0x5d5e('0x5f')][_0x5d5e('0x20')]({'where':_0x29130b['where']})[_0x5d5e('0x29')](function(_0x26b5f3){_0xfde3c6['count']=_0x26b5f3;if(_0x300905[_0x5d5e('0x36')][_0x5d5e('0x47')]){_0x29130b[_0x5d5e('0x48')]=[{'all':!![]}];}return db[_0x5d5e('0x5f')]['findAll'](_0x29130b);})[_0x5d5e('0x29')](function(_0x362629){_0xfde3c6['rows']=_0x362629;return _0xfde3c6;});}})[_0x5d5e('0x29')](respondWithFilteredResult(_0x5e0994,_0x29130b))[_0x5d5e('0x4b')](handleError(_0x5e0994,null));};exports['getAnswers']=function(_0xe12603,_0x240f0e,_0x29ca99){var _0x2ebde0={'raw':!![],'where':{}};var _0x661e6f={};var _0x326b27={'count':0x0,'rows':[]};return db[_0x5d5e('0x32')][_0x5d5e('0x5d')]({'where':{'id':_0xe12603[_0x5d5e('0x4d')]['id']}})[_0x5d5e('0x29')](handleEntityNotFound(_0x240f0e,null))['then'](function(_0xfe401d){if(_0xfe401d){_0x661e6f[_0x5d5e('0x38')]=_['keys'](db[_0x5d5e('0x60')][_0x5d5e('0x4e')]);_0x661e6f[_0x5d5e('0x36')]=_[_0x5d5e('0x37')](_0xe12603[_0x5d5e('0x36')]);_0x661e6f[_0x5d5e('0x40')]=_[_0x5d5e('0x4f')](_0x661e6f[_0x5d5e('0x38')],_0x661e6f[_0x5d5e('0x36')]);_0x2ebde0[_0x5d5e('0x39')]=_[_0x5d5e('0x4f')](_0x661e6f[_0x5d5e('0x38')],qs[_0x5d5e('0x3a')](_0xe12603['query'][_0x5d5e('0x3a')]));_0x2ebde0[_0x5d5e('0x39')]=_0x2ebde0[_0x5d5e('0x39')][_0x5d5e('0x3b')]?_0x2ebde0[_0x5d5e('0x39')]:_0x661e6f['model'];if(!_0xe12603[_0x5d5e('0x36')][_0x5d5e('0x3c')]('nolimit')){_0x2ebde0[_0x5d5e('0x1e')]=qs['limit'](_0xe12603[_0x5d5e('0x36')][_0x5d5e('0x1e')]);_0x2ebde0['offset']=qs[_0x5d5e('0x21')](_0xe12603[_0x5d5e('0x36')]['offset']);}_0x2ebde0[_0x5d5e('0x3e')]=qs[_0x5d5e('0x3f')](_0xe12603[_0x5d5e('0x36')][_0x5d5e('0x3f')]);_0x2ebde0[_0x5d5e('0x43')]=qs[_0x5d5e('0x40')](_[_0x5d5e('0x41')](_0xe12603[_0x5d5e('0x36')],_0x661e6f[_0x5d5e('0x40')]));_0x2ebde0[_0x5d5e('0x43')][_0x5d5e('0x5e')]=_0xfe401d['id'];if(_0xe12603['query']['filter']){_0x2ebde0[_0x5d5e('0x43')]=_[_0x5d5e('0x44')](_0x2ebde0[_0x5d5e('0x43')],{'$or':_[_0x5d5e('0x31')](_0x2ebde0[_0x5d5e('0x39')],function(_0x5d0576){var _0xb8f95c={};_0xb8f95c[_0x5d0576]={'$like':'%'+_0xe12603['query'][_0x5d5e('0x42')]+'%'};return _0xb8f95c;})});}_0x2ebde0=_[_0x5d5e('0x44')]({},_0x2ebde0,_0xe12603[_0x5d5e('0x46')]);return db[_0x5d5e('0x60')]['count']({'where':_0x2ebde0[_0x5d5e('0x43')]})[_0x5d5e('0x29')](function(_0x50e888){_0x326b27[_0x5d5e('0x20')]=_0x50e888;if(_0xe12603[_0x5d5e('0x36')]['includeAll']){_0x2ebde0[_0x5d5e('0x48')]=[{'all':!![]}];}return db[_0x5d5e('0x60')][_0x5d5e('0x49')](_0x2ebde0);})[_0x5d5e('0x29')](function(_0x4f637a){_0x326b27[_0x5d5e('0x4a')]=_0x4f637a;return _0x326b27;});}})['then'](respondWithFilteredResult(_0x240f0e,_0x2ebde0))['catch'](handleError(_0x240f0e,null));};function char(_0x5d68fb){return _0x5d5e('0x61')===typeof _0x5d68fb?String['fromCharCode'][_0x5d5e('0x25')](null,arguments):_0x5d68fb;}function needsEncapsulation(_0x301333){return!!_0x301333&&(_0x301333[_0x5d5e('0x62')]()[_0x5d5e('0x63')](char(0xd))>=0x0||_0x301333['toString']()['indexOf'](char(0xa))>=0x0||_0x301333['toString']()[_0x5d5e('0x63')](char(0x2c))>=0x0||_0x301333[_0x5d5e('0x62')]()[_0x5d5e('0x63')](char(0x22))>=0x0);}function encapsulate(_0x6d1eb3){var _0x1e1be0=char(0x22),_0x22379b='\x5c'+char(0x22),_0x1bb0dd=_0x6d1eb3['toString']()[_0x5d5e('0x64')](new RegExp(_0x1e1be0,'g'),_0x22379b);return _0x1e1be0+_0x1bb0dd+_0x1e1be0;}exports[_0x5d5e('0x65')]=function(_0x3c0c04,_0x3643ab,_0x2bd069){var _0x4e1b4d,_0x28619f;var _0x5300f1={'where':{'ProjectId':_0x3c0c04[_0x5d5e('0x4d')]['id']}};if(_0x3c0c04['query']['startTime']){_0x5300f1[_0x5d5e('0x43')][_0x5d5e('0x66')]=JSON[_0x5d5e('0x67')](_0x3c0c04['query'][_0x5d5e('0x68')]);}return db[_0x5d5e('0x5f')][_0x5d5e('0x49')](_0x5300f1)[_0x5d5e('0x29')](handleEntityNotFound(_0x3643ab,null))['then'](function(_0x508872){if(_0x508872){_0x4e1b4d=_0x508872;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_['map'](_0x4e1b4d,'id')},'ProjectId':_0x3c0c04[_0x5d5e('0x4d')]['id']},'order':_0x5d5e('0x69')});}})[_0x5d5e('0x29')](handleEntityNotFound(_0x3643ab,null))['then'](function(_0x296986){if(_0x296986){_0x28619f=_0x296986;var _0x49d95e={};for(var _0x53856a=0x0,_0x37577e=_0x28619f['length'];_0x53856a<_0x37577e;_0x53856a++){if(!_0x49d95e[_0x5d5e('0x3c')](_0x28619f[_0x53856a]['questionId'])){_0x49d95e[_0x28619f[_0x53856a][_0x5d5e('0x6a')]]=needsEncapsulation(_0x28619f[_0x53856a][_0x5d5e('0x6b')])?encapsulate(_0x28619f[_0x53856a][_0x5d5e('0x6b')]):_0x28619f[_0x53856a][_0x5d5e('0x6b')];}}var _0x528aac=[],_0x178bd0={};for(var _0x11b679=0x0,_0x14fa6d=_0x4e1b4d[_0x5d5e('0x3b')];_0x11b679<_0x14fa6d;_0x11b679++){_0x178bd0={'ProjectId':_0x3c0c04[_0x5d5e('0x4d')]['id'],'SessionId':_0x4e1b4d[_0x11b679]['id'],'StartTime':moment(_0x4e1b4d[_0x11b679][_0x5d5e('0x66')])[_0x5d5e('0x6c')](_0x5d5e('0x6d'))};for(var _0x2b6d73=0x0,_0x4dd27d=_0x28619f[_0x5d5e('0x3b')];_0x2b6d73<_0x4dd27d;_0x2b6d73++){if(_0x28619f[_0x2b6d73]['SessionId']==_0x4e1b4d[_0x11b679]['id']&&_0x49d95e['hasOwnProperty'](_0x28619f[_0x2b6d73]['questionId'])){_0x178bd0[_0x49d95e[_0x28619f[_0x2b6d73]['questionId']]]=_0x28619f[_0x2b6d73][_0x5d5e('0x6e')];}}for(var _0x2c7eac in _0x49d95e){if(!_0x178bd0['hasOwnProperty'](_0x49d95e[_0x2c7eac])){_0x178bd0[_0x49d95e[_0x2c7eac]]=null;}}_0x528aac['push'](_0x178bd0);}return _0x528aac;}})[_0x5d5e('0x29')](function(_0x426f50){if(!_[_0x5d5e('0x6f')](_0x426f50)){var _0x2f2351=toCsv(_0x426f50);var _0x4a503a=Date[_0x5d5e('0x70')]();fs['writeFileSync'](util['format'](_0x5d5e('0x71'),_0x3c0c04[_0x5d5e('0x4d')]['id'],_0x4a503a),_0x2f2351);_0x3643ab[_0x5d5e('0x72')]('Content-disposition',_0x5d5e('0x73')+util[_0x5d5e('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x3c0c04[_0x5d5e('0x4d')]['id'],_0x4a503a));_0x3643ab['setHeader'](_0x5d5e('0x74'),_0x5d5e('0x75'));return _0x3643ab[_0x5d5e('0x76')](util[_0x5d5e('0x6c')](_0x5d5e('0x71'),_0x3c0c04[_0x5d5e('0x4d')]['id'],_0x4a503a));}else{return _0x3643ab[_0x5d5e('0x1b')](0xcc);}})[_0x5d5e('0x4b')](handleError(_0x3643ab,null));};
\ No newline at end of file
+var _0xccde=['createdAt','updatedAt','userProfileId','destroy','JscriptySessionReport','order','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','Content-type','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','save','then','get','Projects','UserProfileResource','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','show','params','merge','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xccde,0x1e1));var _0xeccd=function(_0x28b0a4,_0x2ea758){_0x28b0a4=_0x28b0a4-0x0;var _0x105ce6=_0xccde[_0x28b0a4];return _0x105ce6;};'use strict';var emlformat=require(_0xeccd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeccd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeccd('0x2'));var moment=require(_0xeccd('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeccd('0x4'));var path=require(_0xeccd('0x5'));var sox=require(_0xeccd('0x6'));var csv=require(_0xeccd('0x7'));var ejs=require(_0xeccd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeccd('0x9'));var squel=require(_0xeccd('0xa'));var crypto=require(_0xeccd('0xb'));var jsforce=require(_0xeccd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeccd('0x7'));var querystring=require(_0xeccd('0xd'));var Papa=require(_0xeccd('0xe'));var Redis=require(_0xeccd('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xeccd('0x10'))(_0xeccd('0x11'));var utils=require(_0xeccd('0x12'));var config=require(_0xeccd('0x13'));var licenseUtil=require(_0xeccd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x417bfc,_0x2d7e4c){_0x2d7e4c=_0x2d7e4c||0xcc;return function(_0x377cd7){if(_0x377cd7){return _0x417bfc[_0xeccd('0x15')](_0x2d7e4c);}return _0x417bfc[_0xeccd('0x16')](_0x2d7e4c)[_0xeccd('0x17')]();};}function respondWithResult(_0x4790b3,_0x57516f){_0x57516f=_0x57516f||0xc8;return function(_0x4073e0){if(_0x4073e0){return _0x4790b3[_0xeccd('0x16')](_0x57516f)[_0xeccd('0x18')](_0x4073e0);}};}function respondWithFilteredResult(_0xa03dcc,_0x5a68a6){return function(_0x2500e0){if(_0x2500e0){var _0x3dc35f=typeof _0x5a68a6['offset']==='undefined'&&typeof _0x5a68a6[_0xeccd('0x19')]===_0xeccd('0x1a');var _0x2e96f3=_0x2500e0[_0xeccd('0x1b')];var _0xb0fad7=_0x3dc35f?0x0:_0x5a68a6[_0xeccd('0x1c')];var _0x466d98=_0x3dc35f?_0x2500e0[_0xeccd('0x1b')]:_0x5a68a6['offset']+_0x5a68a6[_0xeccd('0x19')];var _0x61fe23;if(_0x466d98>=_0x2e96f3){_0x466d98=_0x2e96f3;_0x61fe23=0xc8;}else{_0x61fe23=0xce;}_0xa03dcc[_0xeccd('0x16')](_0x61fe23);return _0xa03dcc[_0xeccd('0x1d')](_0xeccd('0x1e'),_0xb0fad7+'-'+_0x466d98+'/'+_0x2e96f3)[_0xeccd('0x18')](_0x2500e0);}return null;};}function patchUpdates(_0x508439){return function(_0x4cced1){try{jsonpatch['apply'](_0x4cced1,_0x508439,!![]);}catch(_0x22976d){return BPromise['reject'](_0x22976d);}return _0x4cced1[_0xeccd('0x1f')]();};}function saveUpdates(_0x20e7b5,_0x54083d){return function(_0x1747af){if(_0x1747af){return _0x1747af['update'](_0x20e7b5)[_0xeccd('0x20')](function(_0x446168){return _0x446168;});}return null;};}function removeEntity(_0x41517f,_0x4537e1){return function(_0x16e97a){if(_0x16e97a){return _0x16e97a['destroy']()[_0xeccd('0x20')](function(){var _0x560659=_0x16e97a[_0xeccd('0x21')]({'plain':!![]});var _0x244d22=_0xeccd('0x22');return db[_0xeccd('0x23')]['destroy']({'where':{'type':_0x244d22,'resourceId':_0x560659['id']}})[_0xeccd('0x20')](function(){return _0x16e97a;});})[_0xeccd('0x20')](function(){_0x41517f[_0xeccd('0x16')](0xcc)[_0xeccd('0x17')]();});}};}function handleEntityNotFound(_0x4fbd3a,_0x71dda5){return function(_0x4240df){if(!_0x4240df){_0x4fbd3a[_0xeccd('0x15')](0x194);}return _0x4240df;};}function handleError(_0x2bf027,_0x49a503){_0x49a503=_0x49a503||0x1f4;return function(_0x1c0a3f){logger[_0xeccd('0x24')](_0x1c0a3f[_0xeccd('0x25')]);if(_0x1c0a3f[_0xeccd('0x26')]){delete _0x1c0a3f['name'];}_0x2bf027[_0xeccd('0x16')](_0x49a503)['send'](_0x1c0a3f);};}exports[_0xeccd('0x27')]=function(_0x1817b7,_0x400128){var _0x28d25a={},_0x330f8d={},_0x46dabd={'count':0x0,'rows':[]};var _0x49858a=_[_0xeccd('0x28')](db[_0xeccd('0x29')][_0xeccd('0x2a')],function(_0x27905b){return{'name':_0x27905b[_0xeccd('0x2b')],'type':_0x27905b[_0xeccd('0x2c')][_0xeccd('0x2d')]};});_0x330f8d['model']=_[_0xeccd('0x28')](_0x49858a,_0xeccd('0x26'));_0x330f8d['query']=_[_0xeccd('0x2e')](_0x1817b7[_0xeccd('0x2f')]);_0x330f8d['filters']=_[_0xeccd('0x30')](_0x330f8d[_0xeccd('0x31')],_0x330f8d[_0xeccd('0x2f')]);_0x28d25a[_0xeccd('0x32')]=_[_0xeccd('0x30')](_0x330f8d[_0xeccd('0x31')],qs[_0xeccd('0x33')](_0x1817b7[_0xeccd('0x2f')][_0xeccd('0x33')]));_0x28d25a['attributes']=_0x28d25a['attributes'][_0xeccd('0x34')]?_0x28d25a[_0xeccd('0x32')]:_0x330f8d[_0xeccd('0x31')];if(!_0x1817b7[_0xeccd('0x2f')][_0xeccd('0x35')](_0xeccd('0x36'))){_0x28d25a[_0xeccd('0x19')]=qs[_0xeccd('0x19')](_0x1817b7[_0xeccd('0x2f')][_0xeccd('0x19')]);_0x28d25a[_0xeccd('0x1c')]=qs[_0xeccd('0x1c')](_0x1817b7['query'][_0xeccd('0x1c')]);}_0x28d25a['order']=qs[_0xeccd('0x37')](_0x1817b7[_0xeccd('0x2f')][_0xeccd('0x37')]);_0x28d25a['where']=qs[_0xeccd('0x38')](_[_0xeccd('0x39')](_0x1817b7['query'],_0x330f8d['filters']),_0x49858a);if(_0x1817b7[_0xeccd('0x2f')][_0xeccd('0x3a')]){_0x28d25a[_0xeccd('0x3b')]=_['merge'](_0x28d25a[_0xeccd('0x3b')],{'$or':_['map'](_0x49858a,function(_0xef011f){if(_0xef011f['type']!==_0xeccd('0x3c')){var _0xbf48b5={};_0xbf48b5[_0xef011f[_0xeccd('0x26')]]={'$like':'%'+_0x1817b7[_0xeccd('0x2f')]['filter']+'%'};return _0xbf48b5;}})});}_0x28d25a=_['merge']({},_0x28d25a,_0x1817b7[_0xeccd('0x3d')]);var _0x572fb5={'where':_0x28d25a[_0xeccd('0x3b')]};return db[_0xeccd('0x29')]['count'](_0x572fb5)['then'](function(_0x1e8e20){_0x46dabd[_0xeccd('0x1b')]=_0x1e8e20;if(_0x1817b7['query'][_0xeccd('0x3e')]){_0x28d25a[_0xeccd('0x3f')]=[{'all':!![]}];}return db[_0xeccd('0x29')][_0xeccd('0x40')](_0x28d25a);})[_0xeccd('0x20')](function(_0x3d740d){_0x46dabd['rows']=_0x3d740d;return _0x46dabd;})[_0xeccd('0x20')](respondWithFilteredResult(_0x400128,_0x28d25a))['catch'](handleError(_0x400128,null));};exports[_0xeccd('0x41')]=function(_0x3ea63e,_0x5c754d){var _0x186dfc={'raw':![],'where':{'id':_0x3ea63e[_0xeccd('0x42')]['id']}},_0x47cc7a={};_0x47cc7a[_0xeccd('0x31')]=_[_0xeccd('0x2e')](db['JscriptyProject'][_0xeccd('0x2a')]);_0x47cc7a[_0xeccd('0x2f')]=_[_0xeccd('0x2e')](_0x3ea63e[_0xeccd('0x2f')]);_0x47cc7a['filters']=_['intersection'](_0x47cc7a[_0xeccd('0x31')],_0x47cc7a[_0xeccd('0x2f')]);_0x186dfc[_0xeccd('0x32')]=_[_0xeccd('0x30')](_0x47cc7a[_0xeccd('0x31')],qs[_0xeccd('0x33')](_0x3ea63e[_0xeccd('0x2f')][_0xeccd('0x33')]));_0x186dfc[_0xeccd('0x32')]=_0x186dfc['attributes']['length']?_0x186dfc[_0xeccd('0x32')]:_0x47cc7a[_0xeccd('0x31')];if(_0x3ea63e[_0xeccd('0x2f')][_0xeccd('0x3e')]){_0x186dfc[_0xeccd('0x3f')]=[{'all':!![]}];}_0x186dfc=_[_0xeccd('0x43')]({},_0x186dfc,_0x3ea63e[_0xeccd('0x3d')]);return db[_0xeccd('0x29')]['find'](_0x186dfc)['then'](handleEntityNotFound(_0x5c754d,null))['then'](respondWithResult(_0x5c754d,null))[_0xeccd('0x44')](handleError(_0x5c754d,null));};exports['create']=function(_0x30777a,_0x2fda76){return db['JscriptyProject'][_0xeccd('0x45')](_0x30777a[_0xeccd('0x46')],{})[_0xeccd('0x20')](function(_0x1cb12e){var _0x5cfd3d=_0x30777a[_0xeccd('0x47')]['get']({'plain':!![]});if(!_0x5cfd3d)throw new Error(_0xeccd('0x48'));if(_0x5cfd3d[_0xeccd('0x49')]===_0xeccd('0x47')){var _0x216881=_0x1cb12e[_0xeccd('0x21')]({'plain':!![]});var _0x4d6c9a=_0xeccd('0x22');return db[_0xeccd('0x4a')]['find']({'where':{'name':_0x4d6c9a,'userProfileId':_0x5cfd3d['userProfileId']},'raw':!![]})[_0xeccd('0x20')](function(_0x48ffda){if(_0x48ffda&&_0x48ffda[_0xeccd('0x4b')]===0x0){return db['UserProfileResource'][_0xeccd('0x45')]({'name':_0x216881[_0xeccd('0x26')],'resourceId':_0x216881['id'],'type':_0x48ffda[_0xeccd('0x26')],'sectionId':_0x48ffda['id']},{})['then'](function(){return _0x1cb12e;});}else{return _0x1cb12e;}})['catch'](function(_0x33c0dd){logger['error'](_0xeccd('0x4c'),_0x33c0dd);throw _0x33c0dd;});}return _0x1cb12e;})['then'](respondWithResult(_0x2fda76,0xc9))['catch'](handleError(_0x2fda76,null));};exports[_0xeccd('0x4d')]=function(_0x45c004,_0x1ba4cc){var _0x557966={'where':{'id':_0x45c004['params']['id']}},_0x37303f={};_0x37303f[_0xeccd('0x31')]=_['keys'](db[_0xeccd('0x29')][_0xeccd('0x2a')]);_0x557966['attributes']=_[_0xeccd('0x30')](_0x37303f[_0xeccd('0x31')],qs[_0xeccd('0x33')](_0x45c004[_0xeccd('0x2f')][_0xeccd('0x33')]));_0x557966[_0xeccd('0x32')]=_0x557966[_0xeccd('0x32')][_0xeccd('0x34')]?_0x557966[_0xeccd('0x32')]:_0x37303f[_0xeccd('0x31')];if(_0x45c004[_0xeccd('0x2f')][_0xeccd('0x3e')]){_0x557966[_0xeccd('0x3f')]=[{'all':!![]}];}_0x557966=_['merge']({},_0x557966,_0x45c004[_0xeccd('0x3d')]);return db[_0xeccd('0x29')][_0xeccd('0x4e')](_0x557966)[_0xeccd('0x20')](handleEntityNotFound(_0x1ba4cc,null))[_0xeccd('0x20')](function(_0x59e656){if(_0x59e656){var _0x20bdcc=_0x59e656[_0xeccd('0x21')]({'plain':!![]});_0x20bdcc=qs['omit'](_0x20bdcc,['id',_0xeccd('0x4f'),_0xeccd('0x50')]);_0x45c004[_0xeccd('0x46')]=_['omit'](_0x45c004[_0xeccd('0x46')],['id',_0xeccd('0x4f'),'updatedAt']);return db[_0xeccd('0x29')][_0xeccd('0x45')](_[_0xeccd('0x43')](_0x20bdcc,_0x45c004['body']),{'include':_0x45c004[_0xeccd('0x2f')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x45a86b){var _0x462f04=_0x45c004[_0xeccd('0x47')][_0xeccd('0x21')]({'plain':!![]});if(!_0x462f04)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x462f04[_0xeccd('0x49')]===_0xeccd('0x47')){var _0x3bb91c=_0x45a86b[_0xeccd('0x21')]({'plain':!![]});var _0x469c82=_0xeccd('0x22');return db[_0xeccd('0x4a')]['find']({'where':{'name':_0x469c82,'userProfileId':_0x462f04[_0xeccd('0x51')]},'raw':!![]})[_0xeccd('0x20')](function(_0x2a4be9){if(_0x2a4be9&&_0x2a4be9[_0xeccd('0x4b')]===0x0){return db[_0xeccd('0x23')][_0xeccd('0x45')]({'name':_0x3bb91c[_0xeccd('0x26')],'resourceId':_0x3bb91c['id'],'type':_0x2a4be9[_0xeccd('0x26')],'sectionId':_0x2a4be9['id']},{})[_0xeccd('0x20')](function(){return _0x45a86b;});}else{return _0x45a86b;}})['catch'](function(_0x25161d){logger[_0xeccd('0x24')](_0xeccd('0x4c'),_0x25161d);throw _0x25161d;});}return _0x45a86b;});}})[_0xeccd('0x20')](respondWithResult(_0x1ba4cc,0xc9))['catch'](handleError(_0x1ba4cc,null));};exports['update']=function(_0x15904a,_0x362fd7){if(_0x15904a[_0xeccd('0x46')]['id']){delete _0x15904a[_0xeccd('0x46')]['id'];}return db['JscriptyProject'][_0xeccd('0x4e')]({'where':{'id':_0x15904a[_0xeccd('0x42')]['id']}})[_0xeccd('0x20')](handleEntityNotFound(_0x362fd7,null))['then'](saveUpdates(_0x15904a[_0xeccd('0x46')],null))[_0xeccd('0x20')](respondWithResult(_0x362fd7,null))[_0xeccd('0x44')](handleError(_0x362fd7,null));};exports[_0xeccd('0x52')]=function(_0x1b5f60,_0x2d1812){return db[_0xeccd('0x29')][_0xeccd('0x4e')]({'where':{'id':_0x1b5f60[_0xeccd('0x42')]['id']}})[_0xeccd('0x20')](handleEntityNotFound(_0x2d1812,null))['then'](removeEntity(_0x2d1812,null))['catch'](handleError(_0x2d1812,null));};exports['getSessions']=function(_0x2c3a39,_0xb4d717,_0x5d9e9d){var _0x14e4d1={'raw':!![],'where':{}};var _0x3d0236={};var _0x111203={'count':0x0,'rows':[]};return db[_0xeccd('0x29')]['findOne']({'where':{'id':_0x2c3a39['params']['id']}})[_0xeccd('0x20')](handleEntityNotFound(_0xb4d717,null))['then'](function(_0x1dda6c){if(_0x1dda6c){_0x3d0236[_0xeccd('0x31')]=_[_0xeccd('0x2e')](db[_0xeccd('0x53')]['rawAttributes']);_0x3d0236[_0xeccd('0x2f')]=_[_0xeccd('0x2e')](_0x2c3a39['query']);_0x3d0236[_0xeccd('0x38')]=_[_0xeccd('0x30')](_0x3d0236[_0xeccd('0x31')],_0x3d0236[_0xeccd('0x2f')]);_0x14e4d1[_0xeccd('0x32')]=_[_0xeccd('0x30')](_0x3d0236[_0xeccd('0x31')],qs['fields'](_0x2c3a39[_0xeccd('0x2f')][_0xeccd('0x33')]));_0x14e4d1[_0xeccd('0x32')]=_0x14e4d1['attributes']['length']?_0x14e4d1['attributes']:_0x3d0236[_0xeccd('0x31')];if(!_0x2c3a39[_0xeccd('0x2f')]['hasOwnProperty'](_0xeccd('0x36'))){_0x14e4d1[_0xeccd('0x19')]=qs[_0xeccd('0x19')](_0x2c3a39[_0xeccd('0x2f')][_0xeccd('0x19')]);_0x14e4d1[_0xeccd('0x1c')]=qs['offset'](_0x2c3a39[_0xeccd('0x2f')][_0xeccd('0x1c')]);}_0x14e4d1[_0xeccd('0x54')]=qs['sort'](_0x2c3a39[_0xeccd('0x2f')][_0xeccd('0x37')]);_0x14e4d1[_0xeccd('0x3b')]=qs[_0xeccd('0x38')](_[_0xeccd('0x39')](_0x2c3a39[_0xeccd('0x2f')],_0x3d0236[_0xeccd('0x38')]));_0x14e4d1[_0xeccd('0x3b')][_0xeccd('0x55')]=_0x1dda6c['id'];if(_0x2c3a39['query'][_0xeccd('0x3a')]){_0x14e4d1['where']=_[_0xeccd('0x43')](_0x14e4d1[_0xeccd('0x3b')],{'$or':_['map'](_0x14e4d1['attributes'],function(_0x3305e0){var _0x4e5545={};_0x4e5545[_0x3305e0]={'$like':'%'+_0x2c3a39['query'][_0xeccd('0x3a')]+'%'};return _0x4e5545;})});}_0x14e4d1=_[_0xeccd('0x43')]({},_0x14e4d1,_0x2c3a39['options']);return db[_0xeccd('0x53')]['count']({'where':_0x14e4d1[_0xeccd('0x3b')]})['then'](function(_0x3e0a55){_0x111203[_0xeccd('0x1b')]=_0x3e0a55;if(_0x2c3a39[_0xeccd('0x2f')][_0xeccd('0x3e')]){_0x14e4d1['include']=[{'all':!![]}];}return db[_0xeccd('0x53')][_0xeccd('0x40')](_0x14e4d1);})[_0xeccd('0x20')](function(_0x380d43){_0x111203[_0xeccd('0x56')]=_0x380d43;return _0x111203;});}})[_0xeccd('0x20')](respondWithFilteredResult(_0xb4d717,_0x14e4d1))['catch'](handleError(_0xb4d717,null));};exports[_0xeccd('0x57')]=function(_0x573646,_0x90810b,_0x4108f5){var _0x5c981a={'raw':!![],'where':{}};var _0x4ca4da={};var _0x428262={'count':0x0,'rows':[]};return db[_0xeccd('0x29')]['findOne']({'where':{'id':_0x573646[_0xeccd('0x42')]['id']}})[_0xeccd('0x20')](handleEntityNotFound(_0x90810b,null))[_0xeccd('0x20')](function(_0x87c8e6){if(_0x87c8e6){_0x4ca4da[_0xeccd('0x31')]=_['keys'](db[_0xeccd('0x58')][_0xeccd('0x2a')]);_0x4ca4da[_0xeccd('0x2f')]=_[_0xeccd('0x2e')](_0x573646[_0xeccd('0x2f')]);_0x4ca4da['filters']=_[_0xeccd('0x30')](_0x4ca4da[_0xeccd('0x31')],_0x4ca4da[_0xeccd('0x2f')]);_0x5c981a['attributes']=_[_0xeccd('0x30')](_0x4ca4da[_0xeccd('0x31')],qs[_0xeccd('0x33')](_0x573646[_0xeccd('0x2f')][_0xeccd('0x33')]));_0x5c981a['attributes']=_0x5c981a[_0xeccd('0x32')][_0xeccd('0x34')]?_0x5c981a[_0xeccd('0x32')]:_0x4ca4da[_0xeccd('0x31')];if(!_0x573646['query'][_0xeccd('0x35')](_0xeccd('0x36'))){_0x5c981a['limit']=qs[_0xeccd('0x19')](_0x573646[_0xeccd('0x2f')][_0xeccd('0x19')]);_0x5c981a['offset']=qs[_0xeccd('0x1c')](_0x573646['query'][_0xeccd('0x1c')]);}_0x5c981a[_0xeccd('0x54')]=qs[_0xeccd('0x37')](_0x573646[_0xeccd('0x2f')]['sort']);_0x5c981a['where']=qs[_0xeccd('0x38')](_[_0xeccd('0x39')](_0x573646[_0xeccd('0x2f')],_0x4ca4da[_0xeccd('0x38')]));_0x5c981a['where'][_0xeccd('0x55')]=_0x87c8e6['id'];if(_0x573646['query']['filter']){_0x5c981a[_0xeccd('0x3b')]=_[_0xeccd('0x43')](_0x5c981a['where'],{'$or':_[_0xeccd('0x28')](_0x5c981a[_0xeccd('0x32')],function(_0x1f59ae){var _0x5d7938={};_0x5d7938[_0x1f59ae]={'$like':'%'+_0x573646['query'][_0xeccd('0x3a')]+'%'};return _0x5d7938;})});}_0x5c981a=_[_0xeccd('0x43')]({},_0x5c981a,_0x573646['options']);return db[_0xeccd('0x58')][_0xeccd('0x1b')]({'where':_0x5c981a[_0xeccd('0x3b')]})[_0xeccd('0x20')](function(_0x2ff021){_0x428262[_0xeccd('0x1b')]=_0x2ff021;if(_0x573646['query']['includeAll']){_0x5c981a[_0xeccd('0x3f')]=[{'all':!![]}];}return db[_0xeccd('0x58')][_0xeccd('0x40')](_0x5c981a);})[_0xeccd('0x20')](function(_0x74dabc){_0x428262[_0xeccd('0x56')]=_0x74dabc;return _0x428262;});}})[_0xeccd('0x20')](respondWithFilteredResult(_0x90810b,_0x5c981a))['catch'](handleError(_0x90810b,null));};function char(_0x48df41){return _0xeccd('0x59')===typeof _0x48df41?String[_0xeccd('0x5a')][_0xeccd('0x5b')](null,arguments):_0x48df41;}function needsEncapsulation(_0x3a023f){return!!_0x3a023f&&(_0x3a023f[_0xeccd('0x5c')]()[_0xeccd('0x5d')](char(0xd))>=0x0||_0x3a023f[_0xeccd('0x5c')]()[_0xeccd('0x5d')](char(0xa))>=0x0||_0x3a023f[_0xeccd('0x5c')]()[_0xeccd('0x5d')](char(0x2c))>=0x0||_0x3a023f[_0xeccd('0x5c')]()[_0xeccd('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x301b1c){var _0x459877=char(0x22),_0x125f64='\x5c'+char(0x22),_0x3e75e0=_0x301b1c['toString']()[_0xeccd('0x5e')](new RegExp(_0x459877,'g'),_0x125f64);return _0x459877+_0x3e75e0+_0x459877;}exports[_0xeccd('0x5f')]=function(_0x51d68b,_0x2dc470,_0x1d899a){var _0x45a18c,_0x558f75;var _0x3b8a03={'where':{'ProjectId':_0x51d68b[_0xeccd('0x42')]['id']}};if(_0x51d68b[_0xeccd('0x2f')][_0xeccd('0x60')]){_0x3b8a03[_0xeccd('0x3b')][_0xeccd('0x61')]=JSON[_0xeccd('0x62')](_0x51d68b[_0xeccd('0x2f')][_0xeccd('0x60')]);}return db[_0xeccd('0x53')][_0xeccd('0x40')](_0x3b8a03)[_0xeccd('0x20')](handleEntityNotFound(_0x2dc470,null))[_0xeccd('0x20')](function(_0x5a991f){if(_0x5a991f){_0x45a18c=_0x5a991f;return db[_0xeccd('0x63')][_0xeccd('0x40')]({'where':{'SessionId':{'$in':_[_0xeccd('0x28')](_0x45a18c,'id')},'ProjectId':_0x51d68b['params']['id']},'order':_0xeccd('0x64')});}})[_0xeccd('0x20')](handleEntityNotFound(_0x2dc470,null))[_0xeccd('0x20')](function(_0x26dda3){if(_0x26dda3){_0x558f75=_0x26dda3;var _0x345615={};for(var _0x5a63f5=0x0,_0x377fee=_0x558f75[_0xeccd('0x34')];_0x5a63f5<_0x377fee;_0x5a63f5++){if(!_0x345615[_0xeccd('0x35')](_0x558f75[_0x5a63f5][_0xeccd('0x65')])){_0x345615[_0x558f75[_0x5a63f5][_0xeccd('0x65')]]=needsEncapsulation(_0x558f75[_0x5a63f5][_0xeccd('0x66')])?encapsulate(_0x558f75[_0x5a63f5][_0xeccd('0x66')]):_0x558f75[_0x5a63f5][_0xeccd('0x66')];}}var _0x1ccc95=[],_0x2a2885={};for(var _0x49ccb4=0x0,_0x290836=_0x45a18c[_0xeccd('0x34')];_0x49ccb4<_0x290836;_0x49ccb4++){_0x2a2885={'ProjectId':_0x51d68b[_0xeccd('0x42')]['id'],'SessionId':_0x45a18c[_0x49ccb4]['id'],'StartTime':moment(_0x45a18c[_0x49ccb4]['starttime'])[_0xeccd('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x5f3749=0x0,_0x57964d=_0x558f75[_0xeccd('0x34')];_0x5f3749<_0x57964d;_0x5f3749++){if(_0x558f75[_0x5f3749][_0xeccd('0x68')]==_0x45a18c[_0x49ccb4]['id']&&_0x345615[_0xeccd('0x35')](_0x558f75[_0x5f3749]['questionId'])){_0x2a2885[_0x345615[_0x558f75[_0x5f3749][_0xeccd('0x65')]]]=_0x558f75[_0x5f3749][_0xeccd('0x69')];}}for(var _0x16a2d2 in _0x345615){if(!_0x2a2885[_0xeccd('0x35')](_0x345615[_0x16a2d2])){_0x2a2885[_0x345615[_0x16a2d2]]=null;}}_0x1ccc95[_0xeccd('0x6a')](_0x2a2885);}return _0x1ccc95;}})[_0xeccd('0x20')](function(_0x20017e){if(!_['isEmpty'](_0x20017e)){var _0x8b6425=toCsv(_0x20017e);var _0x1f893d=Date[_0xeccd('0x6b')]();fs[_0xeccd('0x6c')](util[_0xeccd('0x67')](_0xeccd('0x6d'),_0x51d68b[_0xeccd('0x42')]['id'],_0x1f893d),_0x8b6425);_0x2dc470['setHeader']('Content-disposition',_0xeccd('0x6e')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x51d68b[_0xeccd('0x42')]['id'],_0x1f893d));_0x2dc470['setHeader'](_0xeccd('0x6f'),'text/csv');return _0x2dc470['download'](util[_0xeccd('0x67')](_0xeccd('0x6d'),_0x51d68b[_0xeccd('0x42')]['id'],_0x1f893d));}else{return _0x2dc470[_0xeccd('0x15')](0xcc);}})['catch'](handleError(_0x2dc470,null));};
\ No newline at end of file
index ca78c6b..695b503 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9879=['request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger','moment'];(function(_0x1d3577,_0x17a32e){var _0x277d9a=function(_0x4b4144){while(--_0x4b4144){_0x1d3577['push'](_0x1d3577['shift']());}};_0x277d9a(++_0x17a32e);}(_0x9879,0x98));var _0x9987=function(_0x26a92c,_0x129e5e){_0x26a92c=_0x26a92c-0x0;var _0x58c5b5=_0x9879[_0x26a92c];return _0x58c5b5;};'use strict';var _=require(_0x9987('0x0'));var util=require(_0x9987('0x1'));var logger=require(_0x9987('0x2'))('api');var moment=require(_0x9987('0x3'));var BPromise=require('bluebird');var rp=require(_0x9987('0x4'));var fs=require('fs');var path=require(_0x9987('0x5'));var rimraf=require(_0x9987('0x6'));var config=require(_0x9987('0x7'));var attributes=require(_0x9987('0x8'));module[_0x9987('0x9')]=function(_0x4258df,_0x4d479d){return _0x4258df[_0x9987('0xa')]('JscriptyProject',attributes,{'tableName':_0x9987('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc23a=['exports','JscriptyProject','jscripty_projects','util','../../config/logger','api','bluebird','rimraf','./jscriptyProject.attributes'];(function(_0x5bdc46,_0x1c3877){var _0x2e6ef5=function(_0x3e9364){while(--_0x3e9364){_0x5bdc46['push'](_0x5bdc46['shift']());}};_0x2e6ef5(++_0x1c3877);}(_0xc23a,0xd2));var _0xac23=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xc23a[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require('lodash');var util=require(_0xac23('0x0'));var logger=require(_0xac23('0x1'))(_0xac23('0x2'));var moment=require('moment');var BPromise=require(_0xac23('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xac23('0x4'));var config=require('../../config/environment');var attributes=require(_0xac23('0x5'));module[_0xac23('0x6')]=function(_0xc71a6d,_0x4c1482){return _0xc71a6d['define'](_0xac23('0x7'),attributes,{'tableName':_0xac23('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index a462c3d..7b7590f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xd71718,_0x3816a8){var _0x34b62c=function(_0x33a98b){while(--_0x33a98b){_0xd71718['push'](_0xd71718['shift']());}};_0x34b62c(++_0x3816a8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}
\ No newline at end of file
+var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4b3edd,_0x415325){_0x4b3edd=_0x4b3edd-0x0;var _0x4baf90=_0xbdb7[_0x4b3edd];return _0x4baf90;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});}
\ No newline at end of file
index 0980cf7..eefab4a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x33ea=['isAuthenticated','/describe','describe','/:id','show','post','create','put','update','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get'];(function(_0x2c094f,_0xe5a1b0){var _0x2f7176=function(_0x28e5f5){while(--_0x28e5f5){_0x2c094f['push'](_0x2c094f['shift']());}};_0x2f7176(++_0xe5a1b0);}(_0x33ea,0x160));var _0xa33e=function(_0x4ad40a,_0x2b93ac){_0x4ad40a=_0x4ad40a-0x0;var _0x5bbbe=_0x33ea[_0x4ad40a];return _0x5bbbe;};'use strict';var multer=require('multer');var util=require(_0xa33e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa33e('0x1'));var router=express[_0xa33e('0x2')]();var fs_extra=require(_0xa33e('0x3'));var auth=require(_0xa33e('0x4'));var interaction=require(_0xa33e('0x5'));var config=require(_0xa33e('0x6'));var controller=require(_0xa33e('0x7'));router[_0xa33e('0x8')]('/',auth[_0xa33e('0x9')](),controller['index']);router[_0xa33e('0x8')](_0xa33e('0xa'),auth[_0xa33e('0x9')](),controller[_0xa33e('0xb')]);router[_0xa33e('0x8')](_0xa33e('0xc'),auth['isAuthenticated'](),controller[_0xa33e('0xd')]);router[_0xa33e('0xe')]('/',auth[_0xa33e('0x9')](),controller[_0xa33e('0xf')]);router[_0xa33e('0x10')](_0xa33e('0xc'),auth[_0xa33e('0x9')](),controller[_0xa33e('0x11')]);router['delete'](_0xa33e('0xc'),auth[_0xa33e('0x9')](),controller[_0xa33e('0x12')]);module['exports']=router;
\ No newline at end of file
+var _0x31a7=['update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','create','put'];(function(_0x10a863,_0x44f558){var _0x327dae=function(_0x5ec513){while(--_0x5ec513){_0x10a863['push'](_0x10a863['shift']());}};_0x327dae(++_0x44f558);}(_0x31a7,0x1df));var _0x731a=function(_0x3aca27,_0x2da266){_0x3aca27=_0x3aca27-0x0;var _0x5e9052=_0x31a7[_0x3aca27];return _0x5e9052;};'use strict';var multer=require(_0x731a('0x0'));var util=require(_0x731a('0x1'));var path=require(_0x731a('0x2'));var timeout=require(_0x731a('0x3'));var express=require(_0x731a('0x4'));var router=express[_0x731a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x731a('0x6'));var interaction=require(_0x731a('0x7'));var config=require('../../config/environment');var controller=require(_0x731a('0x8'));router[_0x731a('0x9')]('/',auth['isAuthenticated'](),controller[_0x731a('0xa')]);router[_0x731a('0x9')](_0x731a('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x731a('0x9')]('/:id',auth[_0x731a('0xc')](),controller['show']);router['post']('/',auth[_0x731a('0xc')](),controller[_0x731a('0xd')]);router[_0x731a('0xe')]('/:id',auth[_0x731a('0xc')](),controller[_0x731a('0xf')]);router[_0x731a('0x10')](_0x731a('0x11'),auth['isAuthenticated'](),controller[_0x731a('0x12')]);module['exports']=router;
\ No newline at end of file
index 8a9919e..6071bf9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x520487,_0x3620f1){_0x520487=_0x520487-0x0;var _0x4491c8=_0x7a54[_0x520487];return _0x4491c8;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}};
\ No newline at end of file
+var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x7a54,0x106));var _0x47a5=function(_0xfbdf96,_0x2604ba){_0xfbdf96=_0xfbdf96-0x0;var _0x3b5fe1=_0x7a54[_0xfbdf96];return _0x3b5fe1;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}};
\ No newline at end of file
index 0f6702a..58b52b0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdd76=['send','index','JscriptyQuestionReport','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name'];(function(_0x44dc4c,_0x357e6a){var _0x4e644e=function(_0x2f033e){while(--_0x2f033e){_0x44dc4c['push'](_0x44dc4c['shift']());}};_0x4e644e(++_0x357e6a);}(_0xdd76,0x1e4));var _0x6dd7=function(_0x4b1b73,_0x39f2c9){_0x4b1b73=_0x4b1b73-0x0;var _0x33e7bd=_0xdd76[_0x4b1b73];return _0x33e7bd;};'use strict';var emlformat=require(_0x6dd7('0x0'));var rimraf=require(_0x6dd7('0x1'));var zipdir=require(_0x6dd7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6dd7('0x3'));var moment=require(_0x6dd7('0x4'));var BPromise=require(_0x6dd7('0x5'));var Mustache=require(_0x6dd7('0x6'));var util=require(_0x6dd7('0x7'));var path=require('path');var sox=require(_0x6dd7('0x8'));var csv=require(_0x6dd7('0x9'));var ejs=require(_0x6dd7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6dd7('0xb'));var squel=require('squel');var crypto=require(_0x6dd7('0xc'));var jsforce=require(_0x6dd7('0xd'));var deskjs=require(_0x6dd7('0xe'));var toCsv=require(_0x6dd7('0x9'));var querystring=require('querystring');var Papa=require(_0x6dd7('0xf'));var Redis=require(_0x6dd7('0x10'));var authService=require(_0x6dd7('0x11'));var qs=require(_0x6dd7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6dd7('0x13'));var logger=require('../../config/logger')(_0x6dd7('0x14'));var utils=require(_0x6dd7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6dd7('0x16'));var db=require(_0x6dd7('0x17'))['db'];function respondWithStatusCode(_0x563b02,_0x45d2bc){_0x45d2bc=_0x45d2bc||0xcc;return function(_0x4c40e9){if(_0x4c40e9){return _0x563b02[_0x6dd7('0x18')](_0x45d2bc);}return _0x563b02[_0x6dd7('0x19')](_0x45d2bc)[_0x6dd7('0x1a')]();};}function respondWithResult(_0x573e66,_0x2ee8a7){_0x2ee8a7=_0x2ee8a7||0xc8;return function(_0x591a22){if(_0x591a22){return _0x573e66[_0x6dd7('0x19')](_0x2ee8a7)['json'](_0x591a22);}};}function respondWithFilteredResult(_0x40cb29,_0x509bb6){return function(_0x28a1a5){if(_0x28a1a5){var _0x13811a=typeof _0x509bb6[_0x6dd7('0x1b')]===_0x6dd7('0x1c')&&typeof _0x509bb6[_0x6dd7('0x1d')]===_0x6dd7('0x1c');var _0x399484=_0x28a1a5[_0x6dd7('0x1e')];var _0x5dc541=_0x13811a?0x0:_0x509bb6[_0x6dd7('0x1b')];var _0x29d7fb=_0x13811a?_0x28a1a5[_0x6dd7('0x1e')]:_0x509bb6[_0x6dd7('0x1b')]+_0x509bb6['limit'];var _0x34a7e0;if(_0x29d7fb>=_0x399484){_0x29d7fb=_0x399484;_0x34a7e0=0xc8;}else{_0x34a7e0=0xce;}_0x40cb29[_0x6dd7('0x19')](_0x34a7e0);return _0x40cb29[_0x6dd7('0x1f')](_0x6dd7('0x20'),_0x5dc541+'-'+_0x29d7fb+'/'+_0x399484)['json'](_0x28a1a5);}return null;};}function patchUpdates(_0x1ae6c3){return function(_0x132536){try{jsonpatch[_0x6dd7('0x21')](_0x132536,_0x1ae6c3,!![]);}catch(_0xf0b1cc){return BPromise[_0x6dd7('0x22')](_0xf0b1cc);}return _0x132536[_0x6dd7('0x23')]();};}function saveUpdates(_0x8d71e4,_0x4ea0f6){return function(_0x387309){if(_0x387309){return _0x387309[_0x6dd7('0x24')](_0x8d71e4)[_0x6dd7('0x25')](function(_0x14710b){return _0x14710b;});}return null;};}function removeEntity(_0x31106c,_0x9f3156){return function(_0x32b343){if(_0x32b343){return _0x32b343['destroy']()[_0x6dd7('0x25')](function(){_0x31106c[_0x6dd7('0x19')](0xcc)[_0x6dd7('0x1a')]();});}};}function handleEntityNotFound(_0x32ef58,_0x169204){return function(_0x4b0445){if(!_0x4b0445){_0x32ef58['sendStatus'](0x194);}return _0x4b0445;};}function handleError(_0xdc899a,_0x58640f){_0x58640f=_0x58640f||0x1f4;return function(_0x11a80a){logger[_0x6dd7('0x26')](_0x11a80a[_0x6dd7('0x27')]);if(_0x11a80a['name']){delete _0x11a80a[_0x6dd7('0x28')];}_0xdc899a[_0x6dd7('0x19')](_0x58640f)[_0x6dd7('0x29')](_0x11a80a);};}exports[_0x6dd7('0x2a')]=function(_0x2d7bb1,_0xe92d9b){var _0x1bc107={},_0x913075={},_0xf26d22={'count':0x0,'rows':[]};var _0x51d6c9=_['map'](db[_0x6dd7('0x2b')]['rawAttributes'],function(_0x3ac5d1){return{'name':_0x3ac5d1[_0x6dd7('0x2c')],'type':_0x3ac5d1[_0x6dd7('0x2d')][_0x6dd7('0x2e')]};});_0x913075['model']=_[_0x6dd7('0x2f')](_0x51d6c9,_0x6dd7('0x28'));_0x913075[_0x6dd7('0x30')]=_[_0x6dd7('0x31')](_0x2d7bb1[_0x6dd7('0x30')]);_0x913075[_0x6dd7('0x32')]=_[_0x6dd7('0x33')](_0x913075[_0x6dd7('0x34')],_0x913075[_0x6dd7('0x30')]);_0x1bc107[_0x6dd7('0x35')]=_[_0x6dd7('0x33')](_0x913075[_0x6dd7('0x34')],qs[_0x6dd7('0x36')](_0x2d7bb1[_0x6dd7('0x30')][_0x6dd7('0x36')]));_0x1bc107[_0x6dd7('0x35')]=_0x1bc107[_0x6dd7('0x35')][_0x6dd7('0x37')]?_0x1bc107[_0x6dd7('0x35')]:_0x913075['model'];if(!_0x2d7bb1[_0x6dd7('0x30')]['hasOwnProperty'](_0x6dd7('0x38'))){_0x1bc107[_0x6dd7('0x1d')]=qs['limit'](_0x2d7bb1[_0x6dd7('0x30')][_0x6dd7('0x1d')]);_0x1bc107[_0x6dd7('0x1b')]=qs['offset'](_0x2d7bb1[_0x6dd7('0x30')][_0x6dd7('0x1b')]);}_0x1bc107['order']=qs[_0x6dd7('0x39')](_0x2d7bb1['query'][_0x6dd7('0x39')]);_0x1bc107['where']=qs['filters'](_['pick'](_0x2d7bb1[_0x6dd7('0x30')],_0x913075[_0x6dd7('0x32')]),_0x51d6c9);if(_0x2d7bb1[_0x6dd7('0x30')][_0x6dd7('0x3a')]){_0x1bc107['where']=_[_0x6dd7('0x3b')](_0x1bc107[_0x6dd7('0x3c')],{'$or':_[_0x6dd7('0x2f')](_0x51d6c9,function(_0x4e4974){if(_0x4e4974[_0x6dd7('0x2d')]!==_0x6dd7('0x3d')){var _0x258830={};_0x258830[_0x4e4974[_0x6dd7('0x28')]]={'$like':'%'+_0x2d7bb1[_0x6dd7('0x30')][_0x6dd7('0x3a')]+'%'};return _0x258830;}})});}_0x1bc107=_[_0x6dd7('0x3b')]({},_0x1bc107,_0x2d7bb1[_0x6dd7('0x3e')]);var _0x313b54={'where':_0x1bc107['where']};return db[_0x6dd7('0x2b')][_0x6dd7('0x1e')](_0x313b54)['then'](function(_0x6bc143){_0xf26d22[_0x6dd7('0x1e')]=_0x6bc143;if(_0x2d7bb1[_0x6dd7('0x30')][_0x6dd7('0x3f')]){_0x1bc107[_0x6dd7('0x40')]=[{'all':!![]}];}return db[_0x6dd7('0x2b')][_0x6dd7('0x41')](_0x1bc107);})['then'](function(_0x19af85){_0xf26d22[_0x6dd7('0x42')]=_0x19af85;return _0xf26d22;})['then'](respondWithFilteredResult(_0xe92d9b,_0x1bc107))['catch'](handleError(_0xe92d9b,null));};exports[_0x6dd7('0x43')]=function(_0x29b3bd,_0x700dbf){var _0x4d6e8e={'raw':!![],'where':{'id':_0x29b3bd[_0x6dd7('0x44')]['id']}},_0x4341f6={};_0x4341f6['model']=_[_0x6dd7('0x31')](db[_0x6dd7('0x2b')]['rawAttributes']);_0x4341f6[_0x6dd7('0x30')]=_[_0x6dd7('0x31')](_0x29b3bd[_0x6dd7('0x30')]);_0x4341f6[_0x6dd7('0x32')]=_[_0x6dd7('0x33')](_0x4341f6[_0x6dd7('0x34')],_0x4341f6[_0x6dd7('0x30')]);_0x4d6e8e['attributes']=_['intersection'](_0x4341f6[_0x6dd7('0x34')],qs[_0x6dd7('0x36')](_0x29b3bd[_0x6dd7('0x30')][_0x6dd7('0x36')]));_0x4d6e8e[_0x6dd7('0x35')]=_0x4d6e8e[_0x6dd7('0x35')]['length']?_0x4d6e8e[_0x6dd7('0x35')]:_0x4341f6['model'];if(_0x29b3bd['query'][_0x6dd7('0x3f')]){_0x4d6e8e[_0x6dd7('0x40')]=[{'all':!![]}];}_0x4d6e8e=_[_0x6dd7('0x3b')]({},_0x4d6e8e,_0x29b3bd[_0x6dd7('0x3e')]);return db['JscriptyQuestionReport']['find'](_0x4d6e8e)['then'](handleEntityNotFound(_0x700dbf,null))[_0x6dd7('0x25')](respondWithResult(_0x700dbf,null))[_0x6dd7('0x45')](handleError(_0x700dbf,null));};exports[_0x6dd7('0x46')]=function(_0xee79ba,_0x3f715d){return db[_0x6dd7('0x2b')][_0x6dd7('0x46')](_0xee79ba[_0x6dd7('0x47')],{})[_0x6dd7('0x25')](respondWithResult(_0x3f715d,0xc9))['catch'](handleError(_0x3f715d,null));};exports['update']=function(_0x2e8d7f,_0x5a012a){if(_0x2e8d7f[_0x6dd7('0x47')]['id']){delete _0x2e8d7f[_0x6dd7('0x47')]['id'];}return db[_0x6dd7('0x2b')][_0x6dd7('0x48')]({'where':{'id':_0x2e8d7f['params']['id']}})[_0x6dd7('0x25')](handleEntityNotFound(_0x5a012a,null))[_0x6dd7('0x25')](saveUpdates(_0x2e8d7f[_0x6dd7('0x47')],null))[_0x6dd7('0x25')](respondWithResult(_0x5a012a,null))[_0x6dd7('0x45')](handleError(_0x5a012a,null));};exports[_0x6dd7('0x49')]=function(_0x1f0f2f,_0xa89618){return db[_0x6dd7('0x2b')][_0x6dd7('0x48')]({'where':{'id':_0x1f0f2f[_0x6dd7('0x44')]['id']}})[_0x6dd7('0x25')](handleEntityNotFound(_0xa89618,null))[_0x6dd7('0x25')](removeEntity(_0xa89618,null))[_0x6dd7('0x45')](handleError(_0xa89618,null));};exports[_0x6dd7('0x4a')]=function(_0x569e36,_0x50bf65){return db[_0x6dd7('0x2b')][_0x6dd7('0x4a')]()[_0x6dd7('0x25')](respondWithResult(_0x50bf65,null))[_0x6dd7('0x45')](handleError(_0x50bf65,null));};
\ No newline at end of file
+var _0x81fe=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','then','error','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','merge','filter','options','includeAll','JscriptyQuestionReport','findAll','rows','params','keys','include','find','catch','create','body','destroy','describe','zip-dir','request-promise','bluebird','mustache','util'];(function(_0x5ee409,_0x21fcdb){var _0x44060d=function(_0x10e186){while(--_0x10e186){_0x5ee409['push'](_0x5ee409['shift']());}};_0x44060d(++_0x21fcdb);}(_0x81fe,0xd0));var _0xe81f=function(_0x3d8ef0,_0x36b0cf){_0x3d8ef0=_0x3d8ef0-0x0;var _0x1ea6b7=_0x81fe[_0x3d8ef0];return _0x1ea6b7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe81f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe81f('0x1'));var moment=require('moment');var BPromise=require(_0xe81f('0x2'));var Mustache=require(_0xe81f('0x3'));var util=require(_0xe81f('0x4'));var path=require(_0xe81f('0x5'));var sox=require(_0xe81f('0x6'));var csv=require(_0xe81f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe81f('0x8'));var _=require(_0xe81f('0x9'));var squel=require(_0xe81f('0xa'));var crypto=require(_0xe81f('0xb'));var jsforce=require(_0xe81f('0xc'));var deskjs=require(_0xe81f('0xd'));var toCsv=require(_0xe81f('0x7'));var querystring=require(_0xe81f('0xe'));var Papa=require(_0xe81f('0xf'));var Redis=require(_0xe81f('0x10'));var authService=require(_0xe81f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe81f('0x12'));var hardwareService=require(_0xe81f('0x13'));var logger=require(_0xe81f('0x14'))('api');var utils=require(_0xe81f('0x15'));var config=require(_0xe81f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe81f('0x17'))['db'];function respondWithStatusCode(_0x202d94,_0x239f2b){_0x239f2b=_0x239f2b||0xcc;return function(_0x46dfa3){if(_0x46dfa3){return _0x202d94[_0xe81f('0x18')](_0x239f2b);}return _0x202d94[_0xe81f('0x19')](_0x239f2b)[_0xe81f('0x1a')]();};}function respondWithResult(_0x4b3b12,_0x3e5c34){_0x3e5c34=_0x3e5c34||0xc8;return function(_0x7614cb){if(_0x7614cb){return _0x4b3b12['status'](_0x3e5c34)['json'](_0x7614cb);}};}function respondWithFilteredResult(_0x4801e7,_0xa79acb){return function(_0x3ec1a6){if(_0x3ec1a6){var _0x39125f=typeof _0xa79acb[_0xe81f('0x1b')]===_0xe81f('0x1c')&&typeof _0xa79acb['limit']===_0xe81f('0x1c');var _0x3522ae=_0x3ec1a6[_0xe81f('0x1d')];var _0x51f354=_0x39125f?0x0:_0xa79acb['offset'];var _0x54fc8d=_0x39125f?_0x3ec1a6[_0xe81f('0x1d')]:_0xa79acb['offset']+_0xa79acb['limit'];var _0x376eda;if(_0x54fc8d>=_0x3522ae){_0x54fc8d=_0x3522ae;_0x376eda=0xc8;}else{_0x376eda=0xce;}_0x4801e7['status'](_0x376eda);return _0x4801e7['set'](_0xe81f('0x1e'),_0x51f354+'-'+_0x54fc8d+'/'+_0x3522ae)[_0xe81f('0x1f')](_0x3ec1a6);}return null;};}function patchUpdates(_0x532bf0){return function(_0x243c68){try{jsonpatch[_0xe81f('0x20')](_0x243c68,_0x532bf0,!![]);}catch(_0x3705d7){return BPromise[_0xe81f('0x21')](_0x3705d7);}return _0x243c68[_0xe81f('0x22')]();};}function saveUpdates(_0xde49ad,_0x59d659){return function(_0x318b29){if(_0x318b29){return _0x318b29['update'](_0xde49ad)[_0xe81f('0x23')](function(_0x17634e){return _0x17634e;});}return null;};}function removeEntity(_0x1e736e,_0x432362){return function(_0x42a6be){if(_0x42a6be){return _0x42a6be['destroy']()[_0xe81f('0x23')](function(){_0x1e736e[_0xe81f('0x19')](0xcc)[_0xe81f('0x1a')]();});}};}function handleEntityNotFound(_0x24860c,_0x33282f){return function(_0x39cf06){if(!_0x39cf06){_0x24860c[_0xe81f('0x18')](0x194);}return _0x39cf06;};}function handleError(_0x4ccb15,_0x28e49b){_0x28e49b=_0x28e49b||0x1f4;return function(_0x51dc1d){logger[_0xe81f('0x24')](_0x51dc1d['stack']);if(_0x51dc1d[_0xe81f('0x25')]){delete _0x51dc1d[_0xe81f('0x25')];}_0x4ccb15[_0xe81f('0x19')](_0x28e49b)[_0xe81f('0x26')](_0x51dc1d);};}exports['index']=function(_0xd8577d,_0x26cbad){var _0x44b875={},_0x521d4f={},_0x1ee6b4={'count':0x0,'rows':[]};var _0x3a65e4=_[_0xe81f('0x27')](db['JscriptyQuestionReport'][_0xe81f('0x28')],function(_0x32a850){return{'name':_0x32a850[_0xe81f('0x29')],'type':_0x32a850['type'][_0xe81f('0x2a')]};});_0x521d4f[_0xe81f('0x2b')]=_[_0xe81f('0x27')](_0x3a65e4,_0xe81f('0x25'));_0x521d4f[_0xe81f('0x2c')]=_['keys'](_0xd8577d[_0xe81f('0x2c')]);_0x521d4f[_0xe81f('0x2d')]=_[_0xe81f('0x2e')](_0x521d4f[_0xe81f('0x2b')],_0x521d4f[_0xe81f('0x2c')]);_0x44b875['attributes']=_[_0xe81f('0x2e')](_0x521d4f[_0xe81f('0x2b')],qs[_0xe81f('0x2f')](_0xd8577d[_0xe81f('0x2c')][_0xe81f('0x2f')]));_0x44b875[_0xe81f('0x30')]=_0x44b875[_0xe81f('0x30')][_0xe81f('0x31')]?_0x44b875[_0xe81f('0x30')]:_0x521d4f[_0xe81f('0x2b')];if(!_0xd8577d['query']['hasOwnProperty'](_0xe81f('0x32'))){_0x44b875[_0xe81f('0x33')]=qs[_0xe81f('0x33')](_0xd8577d['query'][_0xe81f('0x33')]);_0x44b875[_0xe81f('0x1b')]=qs[_0xe81f('0x1b')](_0xd8577d[_0xe81f('0x2c')][_0xe81f('0x1b')]);}_0x44b875[_0xe81f('0x34')]=qs[_0xe81f('0x35')](_0xd8577d[_0xe81f('0x2c')][_0xe81f('0x35')]);_0x44b875['where']=qs['filters'](_['pick'](_0xd8577d[_0xe81f('0x2c')],_0x521d4f[_0xe81f('0x2d')]),_0x3a65e4);if(_0xd8577d[_0xe81f('0x2c')]['filter']){_0x44b875[_0xe81f('0x36')]=_[_0xe81f('0x37')](_0x44b875[_0xe81f('0x36')],{'$or':_[_0xe81f('0x27')](_0x3a65e4,function(_0x37297d){if(_0x37297d['type']!=='VIRTUAL'){var _0x114854={};_0x114854[_0x37297d[_0xe81f('0x25')]]={'$like':'%'+_0xd8577d['query'][_0xe81f('0x38')]+'%'};return _0x114854;}})});}_0x44b875=_['merge']({},_0x44b875,_0xd8577d[_0xe81f('0x39')]);var _0x3e8227={'where':_0x44b875['where']};return db['JscriptyQuestionReport'][_0xe81f('0x1d')](_0x3e8227)[_0xe81f('0x23')](function(_0x383eca){_0x1ee6b4['count']=_0x383eca;if(_0xd8577d['query'][_0xe81f('0x3a')]){_0x44b875['include']=[{'all':!![]}];}return db[_0xe81f('0x3b')][_0xe81f('0x3c')](_0x44b875);})[_0xe81f('0x23')](function(_0x13d444){_0x1ee6b4[_0xe81f('0x3d')]=_0x13d444;return _0x1ee6b4;})[_0xe81f('0x23')](respondWithFilteredResult(_0x26cbad,_0x44b875))['catch'](handleError(_0x26cbad,null));};exports['show']=function(_0xa9cabc,_0x1d26fd){var _0x36ef7b={'raw':!![],'where':{'id':_0xa9cabc[_0xe81f('0x3e')]['id']}},_0x2a93dd={};_0x2a93dd[_0xe81f('0x2b')]=_[_0xe81f('0x3f')](db[_0xe81f('0x3b')][_0xe81f('0x28')]);_0x2a93dd[_0xe81f('0x2c')]=_[_0xe81f('0x3f')](_0xa9cabc[_0xe81f('0x2c')]);_0x2a93dd['filters']=_[_0xe81f('0x2e')](_0x2a93dd[_0xe81f('0x2b')],_0x2a93dd[_0xe81f('0x2c')]);_0x36ef7b[_0xe81f('0x30')]=_[_0xe81f('0x2e')](_0x2a93dd[_0xe81f('0x2b')],qs[_0xe81f('0x2f')](_0xa9cabc[_0xe81f('0x2c')]['fields']));_0x36ef7b[_0xe81f('0x30')]=_0x36ef7b[_0xe81f('0x30')]['length']?_0x36ef7b[_0xe81f('0x30')]:_0x2a93dd[_0xe81f('0x2b')];if(_0xa9cabc[_0xe81f('0x2c')][_0xe81f('0x3a')]){_0x36ef7b[_0xe81f('0x40')]=[{'all':!![]}];}_0x36ef7b=_[_0xe81f('0x37')]({},_0x36ef7b,_0xa9cabc['options']);return db[_0xe81f('0x3b')][_0xe81f('0x41')](_0x36ef7b)['then'](handleEntityNotFound(_0x1d26fd,null))[_0xe81f('0x23')](respondWithResult(_0x1d26fd,null))[_0xe81f('0x42')](handleError(_0x1d26fd,null));};exports[_0xe81f('0x43')]=function(_0x402195,_0x295740){return db[_0xe81f('0x3b')]['create'](_0x402195[_0xe81f('0x44')],{})['then'](respondWithResult(_0x295740,0xc9))['catch'](handleError(_0x295740,null));};exports['update']=function(_0x5524d5,_0x4f1ed9){if(_0x5524d5[_0xe81f('0x44')]['id']){delete _0x5524d5[_0xe81f('0x44')]['id'];}return db['JscriptyQuestionReport'][_0xe81f('0x41')]({'where':{'id':_0x5524d5['params']['id']}})[_0xe81f('0x23')](handleEntityNotFound(_0x4f1ed9,null))[_0xe81f('0x23')](saveUpdates(_0x5524d5[_0xe81f('0x44')],null))[_0xe81f('0x23')](respondWithResult(_0x4f1ed9,null))['catch'](handleError(_0x4f1ed9,null));};exports[_0xe81f('0x45')]=function(_0x48be42,_0x7b2a50){return db[_0xe81f('0x3b')]['find']({'where':{'id':_0x48be42[_0xe81f('0x3e')]['id']}})[_0xe81f('0x23')](handleEntityNotFound(_0x7b2a50,null))[_0xe81f('0x23')](removeEntity(_0x7b2a50,null))[_0xe81f('0x42')](handleError(_0x7b2a50,null));};exports[_0xe81f('0x46')]=function(_0x133eca,_0x2d0849){return db[_0xe81f('0x3b')][_0xe81f('0x46')]()[_0xe81f('0x23')](respondWithResult(_0x2d0849,null))[_0xe81f('0x42')](handleError(_0x2d0849,null));};
\ No newline at end of file
index 714e9bc..a205ed0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc9a8=['report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./jscriptyQuestionReport.attributes','define'];(function(_0xb1235,_0x30dca0){var _0xce6b9b=function(_0x15c0b3){while(--_0x15c0b3){_0xb1235['push'](_0xb1235['shift']());}};_0xce6b9b(++_0x30dca0);}(_0xc9a8,0x85));var _0x8c9a=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0xc9a8[_0x261b8a];return _0x3455e8;};'use strict';var _=require(_0x8c9a('0x0'));var util=require(_0x8c9a('0x1'));var logger=require(_0x8c9a('0x2'))(_0x8c9a('0x3'));var moment=require(_0x8c9a('0x4'));var BPromise=require(_0x8c9a('0x5'));var rp=require(_0x8c9a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c9a('0x7'));var config=require('../../config/environment');var attributes=require(_0x8c9a('0x8'));module['exports']=function(_0x3333c3,_0x4715ce){return _0x3333c3[_0x8c9a('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x8c9a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8cc1=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x480b03,_0x6edf99){var _0x4c3bcf=function(_0x3d0b68){while(--_0x3d0b68){_0x480b03['push'](_0x480b03['shift']());}};_0x4c3bcf(++_0x6edf99);}(_0x8cc1,0x1a2));var _0x18cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8cc1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x18cc('0x0'));var util=require(_0x18cc('0x1'));var logger=require(_0x18cc('0x2'))('api');var moment=require('moment');var BPromise=require(_0x18cc('0x3'));var rp=require(_0x18cc('0x4'));var fs=require('fs');var path=require(_0x18cc('0x5'));var rimraf=require(_0x18cc('0x6'));var config=require(_0x18cc('0x7'));var attributes=require(_0x18cc('0x8'));module[_0x18cc('0x9')]=function(_0x18b281,_0x19e9d2){return _0x18b281[_0x18cc('0xa')](_0x18cc('0xb'),attributes,{'tableName':_0x18cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index b1bc61a..2876e26 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe799=['request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x30d9aa,_0x31a3cd){var _0xf6bed1=function(_0x239a37){while(--_0x239a37){_0x30d9aa['push'](_0x30d9aa['shift']());}};_0xf6bed1(++_0x31a3cd);}(_0xe799,0xb8));var _0x9e79=function(_0x1f3940,_0x19549c){_0x1f3940=_0x1f3940-0x0;var _0x25ad49=_0xe799[_0x1f3940];return _0x25ad49;};'use strict';var _=require('lodash');var util=require(_0x9e79('0x0'));var moment=require(_0x9e79('0x1'));var BPromise=require(_0x9e79('0x2'));var rs=require(_0x9e79('0x3'));var fs=require('fs');var Redis=require(_0x9e79('0x4'));var db=require(_0x9e79('0x5'))['db'];var utils=require(_0x9e79('0x6'));var logger=require(_0x9e79('0x7'))('rpc');var config=require(_0x9e79('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9e79('0x9')][_0x9e79('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe17920,_0x4313e3,_0x475845){return new BPromise(function(_0x102cda,_0x59bc30){return client[_0x9e79('0xb')](_0xe17920,_0x475845)[_0x9e79('0xc')](function(_0x4997cb){logger['info'](_0x9e79('0xd'),_0x4313e3,_0x9e79('0xe'));logger['debug'](_0x9e79('0xf'),_0x4313e3,_0x9e79('0xe'),JSON[_0x9e79('0x10')](_0x4997cb));if(_0x4997cb[_0x9e79('0x11')]){if(_0x4997cb[_0x9e79('0x11')][_0x9e79('0x12')]===0x1f4){logger[_0x9e79('0x11')](_0x9e79('0xd'),_0x4313e3,_0x4997cb[_0x9e79('0x11')][_0x9e79('0x13')]);return _0x59bc30(_0x4997cb[_0x9e79('0x11')][_0x9e79('0x13')]);}logger[_0x9e79('0x11')](_0x9e79('0xd'),_0x4313e3,_0x4997cb[_0x9e79('0x11')][_0x9e79('0x13')]);return _0x102cda(_0x4997cb[_0x9e79('0x11')][_0x9e79('0x13')]);}else{logger[_0x9e79('0x14')](_0x9e79('0xd'),_0x4313e3,'request\x20sent');_0x102cda(_0x4997cb['result'][_0x9e79('0x13')]);}})[_0x9e79('0x15')](function(_0x368af0){logger[_0x9e79('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4313e3,_0x368af0);_0x59bc30(_0x368af0);});});}
\ No newline at end of file
+var _0xec8f=['then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0xec8f,0x1d3));var _0xfec8=function(_0x4ac716,_0x40243f){_0x4ac716=_0x4ac716-0x0;var _0x35f56b=_0xec8f[_0x4ac716];return _0x35f56b;};'use strict';var _=require(_0xfec8('0x0'));var util=require(_0xfec8('0x1'));var moment=require(_0xfec8('0x2'));var BPromise=require(_0xfec8('0x3'));var rs=require(_0xfec8('0x4'));var fs=require('fs');var Redis=require(_0xfec8('0x5'));var db=require(_0xfec8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfec8('0x7'))(_0xfec8('0x8'));var config=require(_0xfec8('0x9'));var jayson=require(_0xfec8('0xa'));var client=jayson['client'][_0xfec8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d496d,_0x2f82d3,_0x1782c0){return new BPromise(function(_0x340949,_0x5db667){return client[_0xfec8('0xc')](_0x3d496d,_0x1782c0)[_0xfec8('0xd')](function(_0x21ad35){logger[_0xfec8('0xe')](_0xfec8('0xf'),_0x2f82d3,_0xfec8('0x10'));logger['debug'](_0xfec8('0x11'),_0x2f82d3,_0xfec8('0x10'),JSON[_0xfec8('0x12')](_0x21ad35));if(_0x21ad35['error']){if(_0x21ad35[_0xfec8('0x13')][_0xfec8('0x14')]===0x1f4){logger[_0xfec8('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2f82d3,_0x21ad35['error'][_0xfec8('0x15')]);return _0x5db667(_0x21ad35[_0xfec8('0x13')]['message']);}logger[_0xfec8('0x13')](_0xfec8('0xf'),_0x2f82d3,_0x21ad35[_0xfec8('0x13')][_0xfec8('0x15')]);return _0x340949(_0x21ad35[_0xfec8('0x13')][_0xfec8('0x15')]);}else{logger['info'](_0xfec8('0xf'),_0x2f82d3,_0xfec8('0x10'));_0x340949(_0x21ad35[_0xfec8('0x16')][_0xfec8('0x15')]);}})[_0xfec8('0x17')](function(_0x5539c2){logger[_0xfec8('0x13')](_0xfec8('0xf'),_0x2f82d3,_0x5539c2);_0x5db667(_0x5539c2);});});}
\ No newline at end of file
index d763ca5..6df3afe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xffe8=['get','getQuestions','post','create','put','delete','/:id','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x5a5f47,_0x42ea38){var _0xb679af=function(_0x136ff4){while(--_0x136ff4){_0x5a5f47['push'](_0x5a5f47['shift']());}};_0xb679af(++_0x42ea38);}(_0xffe8,0xf2));var _0x8ffe=function(_0x34cc5f,_0x17f539){_0x34cc5f=_0x34cc5f-0x0;var _0xc63c0a=_0xffe8[_0x34cc5f];return _0xc63c0a;};'use strict';var multer=require(_0x8ffe('0x0'));var util=require(_0x8ffe('0x1'));var path=require(_0x8ffe('0x2'));var timeout=require('connect-timeout');var express=require(_0x8ffe('0x3'));var router=express[_0x8ffe('0x4')]();var fs_extra=require(_0x8ffe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8ffe('0x6'));var config=require(_0x8ffe('0x7'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x8ffe('0x8')](),controller[_0x8ffe('0x9')]);router[_0x8ffe('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x8ffe('0x8')](),controller['show']);router[_0x8ffe('0xa')]('/:id/questions',auth[_0x8ffe('0x8')](),controller[_0x8ffe('0xb')]);router[_0x8ffe('0xc')]('/',auth[_0x8ffe('0x8')](),controller[_0x8ffe('0xd')]);router[_0x8ffe('0xe')]('/:id',auth[_0x8ffe('0x8')](),controller['update']);router[_0x8ffe('0xf')](_0x8ffe('0x10'),auth[_0x8ffe('0x8')](),controller['destroy']);module[_0x8ffe('0x11')]=router;
\ No newline at end of file
+var _0x0096=['/:id','show','get','getQuestions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','index','/describe','isAuthenticated','describe'];(function(_0x5a20a4,_0x4bdcb8){var _0x483bd4=function(_0x34a3be){while(--_0x34a3be){_0x5a20a4['push'](_0x5a20a4['shift']());}};_0x483bd4(++_0x4bdcb8);}(_0x0096,0x150));var _0x6009=function(_0x333fed,_0x3d2122){_0x333fed=_0x333fed-0x0;var _0x12cac2=_0x0096[_0x333fed];return _0x12cac2;};'use strict';var multer=require(_0x6009('0x0'));var util=require(_0x6009('0x1'));var path=require('path');var timeout=require(_0x6009('0x2'));var express=require(_0x6009('0x3'));var router=express[_0x6009('0x4')]();var fs_extra=require(_0x6009('0x5'));var auth=require(_0x6009('0x6'));var interaction=require(_0x6009('0x7'));var config=require(_0x6009('0x8'));var controller=require(_0x6009('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6009('0xa')]);router['get'](_0x6009('0xb'),auth[_0x6009('0xc')](),controller[_0x6009('0xd')]);router['get'](_0x6009('0xe'),auth['isAuthenticated'](),controller[_0x6009('0xf')]);router[_0x6009('0x10')]('/:id/questions',auth[_0x6009('0xc')](),controller[_0x6009('0x11')]);router[_0x6009('0x12')]('/',auth[_0x6009('0xc')](),controller[_0x6009('0x13')]);router[_0x6009('0x14')](_0x6009('0xe'),auth[_0x6009('0xc')](),controller[_0x6009('0x15')]);router[_0x6009('0x16')](_0x6009('0xe'),auth[_0x6009('0xc')](),controller[_0x6009('0x17')]);module[_0x6009('0x18')]=router;
\ No newline at end of file
index 9676a58..55531a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd28e=['DATE','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0x2ebd33,_0x208b35){var _0x46d576=function(_0x31ea77){while(--_0x31ea77){_0x2ebd33['push'](_0x2ebd33['shift']());}};_0x46d576(++_0x208b35);}(_0xd28e,0x97));var _0xed28=function(_0x2aacda,_0x2107ad){_0x2aacda=_0x2aacda-0x0;var _0x10b48a=_0xd28e[_0x2aacda];return _0x10b48a;};'use strict';var moment=require(_0xed28('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0xed28('0x1')],'set':function(_0x420cd1){this['setDataValue'](_0xed28('0x2'),_0x420cd1);this['setDataValue'](_0xed28('0x3'),moment()[_0xed28('0x4')](_0xed28('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xed28('0x6')]},'projectname':{'type':Sequelize[_0xed28('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xed28('0x6')]},'calleridnum':{'type':Sequelize[_0xed28('0x6')]},'completed':{'type':Sequelize[_0xed28('0x7')],'defaultValue':![]}};
\ No newline at end of file
+var _0xa7cb=['sequelize','exports','DATE','setDataValue','format','STRING','BOOLEAN','moment'];(function(_0x1934b8,_0x41830f){var _0x586495=function(_0x1e3140){while(--_0x1e3140){_0x1934b8['push'](_0x1934b8['shift']());}};_0x586495(++_0x41830f);}(_0xa7cb,0xdf));var _0xba7c=function(_0x285d29,_0x52c639){_0x285d29=_0x285d29-0x0;var _0x202256=_0xa7cb[_0x285d29];return _0x202256;};'use strict';var moment=require(_0xba7c('0x0'));var Sequelize=require(_0xba7c('0x1'));module[_0xba7c('0x2')]={'starttime':{'type':Sequelize[_0xba7c('0x3')],'set':function(_0x270c83){this['setDataValue']('starttime',_0x270c83);this[_0xba7c('0x4')]('endtime',moment()[_0xba7c('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xba7c('0x3')]},'membername':{'type':Sequelize[_0xba7c('0x6')]},'projectname':{'type':Sequelize[_0xba7c('0x6')]},'queue':{'type':Sequelize[_0xba7c('0x6')]},'uniqueid':{'type':Sequelize[_0xba7c('0x6')]},'calleridname':{'type':Sequelize[_0xba7c('0x6')]},'calleridnum':{'type':Sequelize[_0xba7c('0x6')]},'completed':{'type':Sequelize[_0xba7c('0x7')],'defaultValue':![]}};
\ No newline at end of file
index 1dd71ae..af8b0c3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd127=['count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','JscriptySessionReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','include','findAll','rows','catch','length','find','create','body','params','describe','getQuestions','JscriptyQuestionReport','SessionId','includeAll','eml-format','rimraf','zip-dir','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xd127,0x125));var _0x7d12=function(_0x4416cd,_0x420495){_0x4416cd=_0x4416cd-0x0;var _0x1fe325=_0xd127[_0x4416cd];return _0x1fe325;};'use strict';var emlformat=require(_0x7d12('0x0'));var rimraf=require(_0x7d12('0x1'));var zipdir=require(_0x7d12('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7d12('0x3'));var Mustache=require('mustache');var util=require(_0x7d12('0x4'));var path=require(_0x7d12('0x5'));var sox=require(_0x7d12('0x6'));var csv=require(_0x7d12('0x7'));var ejs=require(_0x7d12('0x8'));var fs=require('fs');var fs_extra=require(_0x7d12('0x9'));var _=require(_0x7d12('0xa'));var squel=require(_0x7d12('0xb'));var crypto=require(_0x7d12('0xc'));var jsforce=require(_0x7d12('0xd'));var deskjs=require(_0x7d12('0xe'));var toCsv=require(_0x7d12('0x7'));var querystring=require(_0x7d12('0xf'));var Papa=require(_0x7d12('0x10'));var Redis=require('ioredis');var authService=require(_0x7d12('0x11'));var qs=require(_0x7d12('0x12'));var as=require(_0x7d12('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d12('0x14'))(_0x7d12('0x15'));var utils=require(_0x7d12('0x16'));var config=require(_0x7d12('0x17'));var licenseUtil=require(_0x7d12('0x18'));var db=require(_0x7d12('0x19'))['db'];function respondWithStatusCode(_0x1fde52,_0x29561e){_0x29561e=_0x29561e||0xcc;return function(_0x37e6e9){if(_0x37e6e9){return _0x1fde52[_0x7d12('0x1a')](_0x29561e);}return _0x1fde52[_0x7d12('0x1b')](_0x29561e)['end']();};}function respondWithResult(_0xc5ac70,_0x311c88){_0x311c88=_0x311c88||0xc8;return function(_0x260f32){if(_0x260f32){return _0xc5ac70['status'](_0x311c88)[_0x7d12('0x1c')](_0x260f32);}};}function respondWithFilteredResult(_0x3fcb9e,_0x32a62e){return function(_0x50c077){if(_0x50c077){var _0xd811e=typeof _0x32a62e[_0x7d12('0x1d')]===_0x7d12('0x1e')&&typeof _0x32a62e['limit']===_0x7d12('0x1e');var _0x554a4f=_0x50c077[_0x7d12('0x1f')];var _0xaf588f=_0xd811e?0x0:_0x32a62e[_0x7d12('0x1d')];var _0x41d585=_0xd811e?_0x50c077['count']:_0x32a62e[_0x7d12('0x1d')]+_0x32a62e[_0x7d12('0x20')];var _0x18d8f6;if(_0x41d585>=_0x554a4f){_0x41d585=_0x554a4f;_0x18d8f6=0xc8;}else{_0x18d8f6=0xce;}_0x3fcb9e[_0x7d12('0x1b')](_0x18d8f6);return _0x3fcb9e[_0x7d12('0x21')](_0x7d12('0x22'),_0xaf588f+'-'+_0x41d585+'/'+_0x554a4f)[_0x7d12('0x1c')](_0x50c077);}return null;};}function patchUpdates(_0x12aa28){return function(_0x828187){try{jsonpatch[_0x7d12('0x23')](_0x828187,_0x12aa28,!![]);}catch(_0x21d3e4){return BPromise[_0x7d12('0x24')](_0x21d3e4);}return _0x828187[_0x7d12('0x25')]();};}function saveUpdates(_0x3239d2,_0x34f4a4){return function(_0x5f4749){if(_0x5f4749){return _0x5f4749[_0x7d12('0x26')](_0x3239d2)[_0x7d12('0x27')](function(_0xf8f9f0){return _0xf8f9f0;});}return null;};}function removeEntity(_0x4093d6,_0x6e5dac){return function(_0x6de0d8){if(_0x6de0d8){return _0x6de0d8[_0x7d12('0x28')]()[_0x7d12('0x27')](function(){_0x4093d6[_0x7d12('0x1b')](0xcc)[_0x7d12('0x29')]();});}};}function handleEntityNotFound(_0x4ad777,_0x47c7ee){return function(_0x511cf7){if(!_0x511cf7){_0x4ad777[_0x7d12('0x1a')](0x194);}return _0x511cf7;};}function handleError(_0x3548d0,_0x2afd6b){_0x2afd6b=_0x2afd6b||0x1f4;return function(_0x176ba6){logger[_0x7d12('0x2a')](_0x176ba6[_0x7d12('0x2b')]);if(_0x176ba6['name']){delete _0x176ba6[_0x7d12('0x2c')];}_0x3548d0[_0x7d12('0x1b')](_0x2afd6b)[_0x7d12('0x2d')](_0x176ba6);};}exports['index']=function(_0x40e582,_0x250e6a){var _0x2caa15={},_0x4fef0d={},_0x48347b={'count':0x0,'rows':[]};var _0x3431db=_['map'](db[_0x7d12('0x2e')][_0x7d12('0x2f')],function(_0x13491a){return{'name':_0x13491a[_0x7d12('0x30')],'type':_0x13491a[_0x7d12('0x31')][_0x7d12('0x32')]};});_0x4fef0d['model']=_[_0x7d12('0x33')](_0x3431db,_0x7d12('0x2c'));_0x4fef0d[_0x7d12('0x34')]=_[_0x7d12('0x35')](_0x40e582[_0x7d12('0x34')]);_0x4fef0d[_0x7d12('0x36')]=_[_0x7d12('0x37')](_0x4fef0d[_0x7d12('0x38')],_0x4fef0d[_0x7d12('0x34')]);_0x2caa15[_0x7d12('0x39')]=_[_0x7d12('0x37')](_0x4fef0d[_0x7d12('0x38')],qs['fields'](_0x40e582['query'][_0x7d12('0x3a')]));_0x2caa15['attributes']=_0x2caa15[_0x7d12('0x39')]['length']?_0x2caa15[_0x7d12('0x39')]:_0x4fef0d['model'];if(!_0x40e582[_0x7d12('0x34')][_0x7d12('0x3b')](_0x7d12('0x3c'))){_0x2caa15[_0x7d12('0x20')]=qs[_0x7d12('0x20')](_0x40e582['query'][_0x7d12('0x20')]);_0x2caa15[_0x7d12('0x1d')]=qs['offset'](_0x40e582[_0x7d12('0x34')]['offset']);}_0x2caa15[_0x7d12('0x3d')]=qs['sort'](_0x40e582[_0x7d12('0x34')][_0x7d12('0x3e')]);_0x2caa15['where']=qs[_0x7d12('0x36')](_['pick'](_0x40e582[_0x7d12('0x34')],_0x4fef0d[_0x7d12('0x36')]),_0x3431db);if(_0x40e582['query'][_0x7d12('0x3f')]){_0x2caa15[_0x7d12('0x40')]=_[_0x7d12('0x41')](_0x2caa15[_0x7d12('0x40')],{'$or':_[_0x7d12('0x33')](_0x3431db,function(_0x2598ea){if(_0x2598ea['type']!=='VIRTUAL'){var _0x2bb72a={};_0x2bb72a[_0x2598ea[_0x7d12('0x2c')]]={'$like':'%'+_0x40e582[_0x7d12('0x34')][_0x7d12('0x3f')]+'%'};return _0x2bb72a;}})});}_0x2caa15=_['merge']({},_0x2caa15,_0x40e582[_0x7d12('0x42')]);var _0x45ee38={'where':_0x2caa15[_0x7d12('0x40')]};return db[_0x7d12('0x2e')][_0x7d12('0x1f')](_0x45ee38)['then'](function(_0xa4d8f1){_0x48347b[_0x7d12('0x1f')]=_0xa4d8f1;if(_0x40e582[_0x7d12('0x34')]['includeAll']){_0x2caa15[_0x7d12('0x43')]=[{'all':!![]}];}return db[_0x7d12('0x2e')][_0x7d12('0x44')](_0x2caa15);})[_0x7d12('0x27')](function(_0x3bc12a){_0x48347b[_0x7d12('0x45')]=_0x3bc12a;return _0x48347b;})[_0x7d12('0x27')](respondWithFilteredResult(_0x250e6a,_0x2caa15))[_0x7d12('0x46')](handleError(_0x250e6a,null));};exports['show']=function(_0x3bfe1d,_0x135bda){var _0x7fb0f6={'raw':!![],'where':{'id':_0x3bfe1d['params']['id']}},_0x3c0b1a={};_0x3c0b1a[_0x7d12('0x38')]=_['keys'](db[_0x7d12('0x2e')][_0x7d12('0x2f')]);_0x3c0b1a[_0x7d12('0x34')]=_[_0x7d12('0x35')](_0x3bfe1d[_0x7d12('0x34')]);_0x3c0b1a[_0x7d12('0x36')]=_[_0x7d12('0x37')](_0x3c0b1a['model'],_0x3c0b1a['query']);_0x7fb0f6[_0x7d12('0x39')]=_[_0x7d12('0x37')](_0x3c0b1a[_0x7d12('0x38')],qs[_0x7d12('0x3a')](_0x3bfe1d[_0x7d12('0x34')][_0x7d12('0x3a')]));_0x7fb0f6[_0x7d12('0x39')]=_0x7fb0f6[_0x7d12('0x39')][_0x7d12('0x47')]?_0x7fb0f6[_0x7d12('0x39')]:_0x3c0b1a[_0x7d12('0x38')];if(_0x3bfe1d[_0x7d12('0x34')]['includeAll']){_0x7fb0f6[_0x7d12('0x43')]=[{'all':!![]}];}_0x7fb0f6=_[_0x7d12('0x41')]({},_0x7fb0f6,_0x3bfe1d[_0x7d12('0x42')]);return db['JscriptySessionReport'][_0x7d12('0x48')](_0x7fb0f6)[_0x7d12('0x27')](handleEntityNotFound(_0x135bda,null))[_0x7d12('0x27')](respondWithResult(_0x135bda,null))[_0x7d12('0x46')](handleError(_0x135bda,null));};exports[_0x7d12('0x49')]=function(_0x83f400,_0xc7f3b){return db[_0x7d12('0x2e')][_0x7d12('0x49')](_0x83f400[_0x7d12('0x4a')],{})[_0x7d12('0x27')](respondWithResult(_0xc7f3b,0xc9))[_0x7d12('0x46')](handleError(_0xc7f3b,null));};exports[_0x7d12('0x26')]=function(_0x152287,_0x3223c5){if(_0x152287['body']['id']){delete _0x152287[_0x7d12('0x4a')]['id'];}return db['JscriptySessionReport'][_0x7d12('0x48')]({'where':{'id':_0x152287[_0x7d12('0x4b')]['id']}})[_0x7d12('0x27')](handleEntityNotFound(_0x3223c5,null))[_0x7d12('0x27')](saveUpdates(_0x152287[_0x7d12('0x4a')],null))[_0x7d12('0x27')](respondWithResult(_0x3223c5,null))['catch'](handleError(_0x3223c5,null));};exports[_0x7d12('0x28')]=function(_0x32378d,_0x25f3e7){return db['JscriptySessionReport'][_0x7d12('0x48')]({'where':{'id':_0x32378d[_0x7d12('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25f3e7,null))[_0x7d12('0x27')](removeEntity(_0x25f3e7,null))[_0x7d12('0x46')](handleError(_0x25f3e7,null));};exports[_0x7d12('0x4c')]=function(_0x2c3828,_0x18f0ea){return db[_0x7d12('0x2e')][_0x7d12('0x4c')]()[_0x7d12('0x27')](respondWithResult(_0x18f0ea,null))['catch'](handleError(_0x18f0ea,null));};exports[_0x7d12('0x4d')]=function(_0x1377a8,_0x58f818,_0x452638){var _0x486ec8={'raw':!![],'where':{}};var _0x89cce4={};var _0x542d0a={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x1377a8['params']['id']}})[_0x7d12('0x27')](handleEntityNotFound(_0x58f818,null))[_0x7d12('0x27')](function(_0x5aea24){if(_0x5aea24){_0x89cce4[_0x7d12('0x38')]=_[_0x7d12('0x35')](db[_0x7d12('0x4e')][_0x7d12('0x2f')]);_0x89cce4[_0x7d12('0x34')]=_[_0x7d12('0x35')](_0x1377a8[_0x7d12('0x34')]);_0x89cce4['filters']=_[_0x7d12('0x37')](_0x89cce4[_0x7d12('0x38')],_0x89cce4[_0x7d12('0x34')]);_0x486ec8[_0x7d12('0x39')]=_[_0x7d12('0x37')](_0x89cce4[_0x7d12('0x38')],qs['fields'](_0x1377a8['query']['fields']));_0x486ec8[_0x7d12('0x39')]=_0x486ec8[_0x7d12('0x39')][_0x7d12('0x47')]?_0x486ec8[_0x7d12('0x39')]:_0x89cce4[_0x7d12('0x38')];if(!_0x1377a8[_0x7d12('0x34')][_0x7d12('0x3b')](_0x7d12('0x3c'))){_0x486ec8[_0x7d12('0x20')]=qs[_0x7d12('0x20')](_0x1377a8['query'][_0x7d12('0x20')]);_0x486ec8['offset']=qs[_0x7d12('0x1d')](_0x1377a8[_0x7d12('0x34')]['offset']);}_0x486ec8[_0x7d12('0x3d')]=qs['sort'](_0x1377a8[_0x7d12('0x34')][_0x7d12('0x3e')]);_0x486ec8[_0x7d12('0x40')]=qs[_0x7d12('0x36')](_['pick'](_0x1377a8['query'],_0x89cce4[_0x7d12('0x36')]));_0x486ec8[_0x7d12('0x40')][_0x7d12('0x4f')]=_0x5aea24['id'];if(_0x1377a8[_0x7d12('0x34')][_0x7d12('0x3f')]){_0x486ec8[_0x7d12('0x40')]=_[_0x7d12('0x41')](_0x486ec8['where'],{'$or':_['map'](_0x486ec8[_0x7d12('0x39')],function(_0x4e6061){var _0xc15f6c={};_0xc15f6c[_0x4e6061]={'$like':'%'+_0x1377a8[_0x7d12('0x34')][_0x7d12('0x3f')]+'%'};return _0xc15f6c;})});}_0x486ec8=_['merge']({},_0x486ec8,_0x1377a8[_0x7d12('0x42')]);return db[_0x7d12('0x4e')][_0x7d12('0x1f')]({'where':_0x486ec8[_0x7d12('0x40')]})[_0x7d12('0x27')](function(_0x38da09){_0x542d0a[_0x7d12('0x1f')]=_0x38da09;if(_0x1377a8[_0x7d12('0x34')][_0x7d12('0x50')]){_0x486ec8['include']=[{'all':!![]}];}return db[_0x7d12('0x4e')][_0x7d12('0x44')](_0x486ec8);})[_0x7d12('0x27')](function(_0x6bf496){_0x542d0a[_0x7d12('0x45')]=_0x6bf496;return _0x542d0a;});}})[_0x7d12('0x27')](respondWithFilteredResult(_0x58f818,_0x486ec8))[_0x7d12('0x46')](handleError(_0x58f818,null));};
\ No newline at end of file
+var _0xbcfb=['JscriptySessionReport','type','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','destroy','describe','getQuestions','hasOwnProperty','SessionId','filter','JscriptyQuestionReport','rows','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','error','name','index','map'];(function(_0x4d51e9,_0x229b69){var _0x29a46b=function(_0x1d6584){while(--_0x1d6584){_0x4d51e9['push'](_0x4d51e9['shift']());}};_0x29a46b(++_0x229b69);}(_0xbcfb,0xbd));var _0xbbcf=function(_0x87506e,_0x5680ec){_0x87506e=_0x87506e-0x0;var _0x5496a4=_0xbcfb[_0x87506e];return _0x5496a4;};'use strict';var emlformat=require(_0xbbcf('0x0'));var rimraf=require(_0xbbcf('0x1'));var zipdir=require(_0xbbcf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbbcf('0x3'));var moment=require('moment');var BPromise=require(_0xbbcf('0x4'));var Mustache=require(_0xbbcf('0x5'));var util=require(_0xbbcf('0x6'));var path=require(_0xbbcf('0x7'));var sox=require(_0xbbcf('0x8'));var csv=require(_0xbbcf('0x9'));var ejs=require(_0xbbcf('0xa'));var fs=require('fs');var fs_extra=require(_0xbbcf('0xb'));var _=require('lodash');var squel=require(_0xbbcf('0xc'));var crypto=require(_0xbbcf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbbcf('0xe'));var toCsv=require(_0xbbcf('0x9'));var querystring=require('querystring');var Papa=require(_0xbbcf('0xf'));var Redis=require(_0xbbcf('0x10'));var authService=require(_0xbbcf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbbcf('0x12'));var hardwareService=require(_0xbbcf('0x13'));var logger=require(_0xbbcf('0x14'))(_0xbbcf('0x15'));var utils=require(_0xbbcf('0x16'));var config=require(_0xbbcf('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x165ff1,_0x54a3ca){_0x54a3ca=_0x54a3ca||0xcc;return function(_0x442d65){if(_0x442d65){return _0x165ff1['sendStatus'](_0x54a3ca);}return _0x165ff1['status'](_0x54a3ca)[_0xbbcf('0x18')]();};}function respondWithResult(_0x43ef99,_0x765ea){_0x765ea=_0x765ea||0xc8;return function(_0xe029fd){if(_0xe029fd){return _0x43ef99[_0xbbcf('0x19')](_0x765ea)[_0xbbcf('0x1a')](_0xe029fd);}};}function respondWithFilteredResult(_0x576921,_0x528171){return function(_0x1078ae){if(_0x1078ae){var _0x497136=typeof _0x528171[_0xbbcf('0x1b')]===_0xbbcf('0x1c')&&typeof _0x528171[_0xbbcf('0x1d')]===_0xbbcf('0x1c');var _0x1a684f=_0x1078ae[_0xbbcf('0x1e')];var _0x3324ee=_0x497136?0x0:_0x528171[_0xbbcf('0x1b')];var _0x4f2911=_0x497136?_0x1078ae[_0xbbcf('0x1e')]:_0x528171['offset']+_0x528171[_0xbbcf('0x1d')];var _0x113e50;if(_0x4f2911>=_0x1a684f){_0x4f2911=_0x1a684f;_0x113e50=0xc8;}else{_0x113e50=0xce;}_0x576921[_0xbbcf('0x19')](_0x113e50);return _0x576921[_0xbbcf('0x1f')]('Content-Range',_0x3324ee+'-'+_0x4f2911+'/'+_0x1a684f)[_0xbbcf('0x1a')](_0x1078ae);}return null;};}function patchUpdates(_0x388743){return function(_0x3271b9){try{jsonpatch[_0xbbcf('0x20')](_0x3271b9,_0x388743,!![]);}catch(_0x4d6b5a){return BPromise[_0xbbcf('0x21')](_0x4d6b5a);}return _0x3271b9[_0xbbcf('0x22')]();};}function saveUpdates(_0x13e3d6,_0x164042){return function(_0x467454){if(_0x467454){return _0x467454[_0xbbcf('0x23')](_0x13e3d6)[_0xbbcf('0x24')](function(_0x578b88){return _0x578b88;});}return null;};}function removeEntity(_0x596105,_0x6642b6){return function(_0x2be7d7){if(_0x2be7d7){return _0x2be7d7['destroy']()[_0xbbcf('0x24')](function(){_0x596105[_0xbbcf('0x19')](0xcc)[_0xbbcf('0x18')]();});}};}function handleEntityNotFound(_0x522d42,_0x3b13c9){return function(_0x26e67e){if(!_0x26e67e){_0x522d42[_0xbbcf('0x25')](0x194);}return _0x26e67e;};}function handleError(_0x4bbd3a,_0x837d37){_0x837d37=_0x837d37||0x1f4;return function(_0x47ece9){logger[_0xbbcf('0x26')](_0x47ece9['stack']);if(_0x47ece9['name']){delete _0x47ece9[_0xbbcf('0x27')];}_0x4bbd3a[_0xbbcf('0x19')](_0x837d37)['send'](_0x47ece9);};}exports[_0xbbcf('0x28')]=function(_0x3557f0,_0xd1cc4f){var _0x13e766={},_0xa40113={},_0x3338cb={'count':0x0,'rows':[]};var _0x32cc1e=_[_0xbbcf('0x29')](db[_0xbbcf('0x2a')]['rawAttributes'],function(_0x33e784){return{'name':_0x33e784['fieldName'],'type':_0x33e784[_0xbbcf('0x2b')]['key']};});_0xa40113[_0xbbcf('0x2c')]=_[_0xbbcf('0x29')](_0x32cc1e,_0xbbcf('0x27'));_0xa40113[_0xbbcf('0x2d')]=_[_0xbbcf('0x2e')](_0x3557f0[_0xbbcf('0x2d')]);_0xa40113['filters']=_[_0xbbcf('0x2f')](_0xa40113[_0xbbcf('0x2c')],_0xa40113[_0xbbcf('0x2d')]);_0x13e766[_0xbbcf('0x30')]=_[_0xbbcf('0x2f')](_0xa40113['model'],qs[_0xbbcf('0x31')](_0x3557f0[_0xbbcf('0x2d')][_0xbbcf('0x31')]));_0x13e766[_0xbbcf('0x30')]=_0x13e766['attributes'][_0xbbcf('0x32')]?_0x13e766[_0xbbcf('0x30')]:_0xa40113['model'];if(!_0x3557f0[_0xbbcf('0x2d')]['hasOwnProperty']('nolimit')){_0x13e766['limit']=qs['limit'](_0x3557f0[_0xbbcf('0x2d')][_0xbbcf('0x1d')]);_0x13e766['offset']=qs[_0xbbcf('0x1b')](_0x3557f0[_0xbbcf('0x2d')][_0xbbcf('0x1b')]);}_0x13e766[_0xbbcf('0x33')]=qs[_0xbbcf('0x34')](_0x3557f0[_0xbbcf('0x2d')][_0xbbcf('0x34')]);_0x13e766[_0xbbcf('0x35')]=qs[_0xbbcf('0x36')](_[_0xbbcf('0x37')](_0x3557f0['query'],_0xa40113[_0xbbcf('0x36')]),_0x32cc1e);if(_0x3557f0['query']['filter']){_0x13e766[_0xbbcf('0x35')]=_['merge'](_0x13e766[_0xbbcf('0x35')],{'$or':_[_0xbbcf('0x29')](_0x32cc1e,function(_0x541c9d){if(_0x541c9d[_0xbbcf('0x2b')]!==_0xbbcf('0x38')){var _0x59d83b={};_0x59d83b[_0x541c9d[_0xbbcf('0x27')]]={'$like':'%'+_0x3557f0[_0xbbcf('0x2d')]['filter']+'%'};return _0x59d83b;}})});}_0x13e766=_[_0xbbcf('0x39')]({},_0x13e766,_0x3557f0[_0xbbcf('0x3a')]);var _0x269658={'where':_0x13e766[_0xbbcf('0x35')]};return db[_0xbbcf('0x2a')][_0xbbcf('0x1e')](_0x269658)[_0xbbcf('0x24')](function(_0x11d23c){_0x3338cb[_0xbbcf('0x1e')]=_0x11d23c;if(_0x3557f0['query'][_0xbbcf('0x3b')]){_0x13e766[_0xbbcf('0x3c')]=[{'all':!![]}];}return db[_0xbbcf('0x2a')][_0xbbcf('0x3d')](_0x13e766);})[_0xbbcf('0x24')](function(_0x5cc81b){_0x3338cb['rows']=_0x5cc81b;return _0x3338cb;})[_0xbbcf('0x24')](respondWithFilteredResult(_0xd1cc4f,_0x13e766))['catch'](handleError(_0xd1cc4f,null));};exports[_0xbbcf('0x3e')]=function(_0x34fef7,_0x38c9ef){var _0x16a225={'raw':!![],'where':{'id':_0x34fef7[_0xbbcf('0x3f')]['id']}},_0x5715c5={};_0x5715c5['model']=_['keys'](db[_0xbbcf('0x2a')][_0xbbcf('0x40')]);_0x5715c5['query']=_[_0xbbcf('0x2e')](_0x34fef7[_0xbbcf('0x2d')]);_0x5715c5['filters']=_['intersection'](_0x5715c5[_0xbbcf('0x2c')],_0x5715c5[_0xbbcf('0x2d')]);_0x16a225[_0xbbcf('0x30')]=_[_0xbbcf('0x2f')](_0x5715c5[_0xbbcf('0x2c')],qs[_0xbbcf('0x31')](_0x34fef7[_0xbbcf('0x2d')]['fields']));_0x16a225['attributes']=_0x16a225[_0xbbcf('0x30')][_0xbbcf('0x32')]?_0x16a225['attributes']:_0x5715c5[_0xbbcf('0x2c')];if(_0x34fef7[_0xbbcf('0x2d')][_0xbbcf('0x3b')]){_0x16a225[_0xbbcf('0x3c')]=[{'all':!![]}];}_0x16a225=_['merge']({},_0x16a225,_0x34fef7['options']);return db[_0xbbcf('0x2a')][_0xbbcf('0x41')](_0x16a225)[_0xbbcf('0x24')](handleEntityNotFound(_0x38c9ef,null))['then'](respondWithResult(_0x38c9ef,null))[_0xbbcf('0x42')](handleError(_0x38c9ef,null));};exports[_0xbbcf('0x43')]=function(_0x1dd736,_0x13310d){return db[_0xbbcf('0x2a')][_0xbbcf('0x43')](_0x1dd736['body'],{})[_0xbbcf('0x24')](respondWithResult(_0x13310d,0xc9))['catch'](handleError(_0x13310d,null));};exports[_0xbbcf('0x23')]=function(_0x5b525f,_0x2dbbd5){if(_0x5b525f[_0xbbcf('0x44')]['id']){delete _0x5b525f['body']['id'];}return db[_0xbbcf('0x2a')]['find']({'where':{'id':_0x5b525f['params']['id']}})[_0xbbcf('0x24')](handleEntityNotFound(_0x2dbbd5,null))[_0xbbcf('0x24')](saveUpdates(_0x5b525f['body'],null))[_0xbbcf('0x24')](respondWithResult(_0x2dbbd5,null))[_0xbbcf('0x42')](handleError(_0x2dbbd5,null));};exports[_0xbbcf('0x45')]=function(_0x58ca92,_0x2e1105){return db[_0xbbcf('0x2a')][_0xbbcf('0x41')]({'where':{'id':_0x58ca92[_0xbbcf('0x3f')]['id']}})[_0xbbcf('0x24')](handleEntityNotFound(_0x2e1105,null))[_0xbbcf('0x24')](removeEntity(_0x2e1105,null))['catch'](handleError(_0x2e1105,null));};exports['describe']=function(_0x5a812d,_0x172d03){return db[_0xbbcf('0x2a')][_0xbbcf('0x46')]()['then'](respondWithResult(_0x172d03,null))[_0xbbcf('0x42')](handleError(_0x172d03,null));};exports[_0xbbcf('0x47')]=function(_0x1dfa5c,_0x6d416c,_0x472646){var _0x287b14={'raw':!![],'where':{}};var _0x3f81db={};var _0x35372d={'count':0x0,'rows':[]};return db[_0xbbcf('0x2a')]['findOne']({'where':{'id':_0x1dfa5c[_0xbbcf('0x3f')]['id']}})[_0xbbcf('0x24')](handleEntityNotFound(_0x6d416c,null))[_0xbbcf('0x24')](function(_0x357de2){if(_0x357de2){_0x3f81db[_0xbbcf('0x2c')]=_[_0xbbcf('0x2e')](db['JscriptyQuestionReport']['rawAttributes']);_0x3f81db['query']=_[_0xbbcf('0x2e')](_0x1dfa5c[_0xbbcf('0x2d')]);_0x3f81db[_0xbbcf('0x36')]=_['intersection'](_0x3f81db['model'],_0x3f81db[_0xbbcf('0x2d')]);_0x287b14[_0xbbcf('0x30')]=_[_0xbbcf('0x2f')](_0x3f81db[_0xbbcf('0x2c')],qs[_0xbbcf('0x31')](_0x1dfa5c[_0xbbcf('0x2d')][_0xbbcf('0x31')]));_0x287b14[_0xbbcf('0x30')]=_0x287b14['attributes'][_0xbbcf('0x32')]?_0x287b14[_0xbbcf('0x30')]:_0x3f81db[_0xbbcf('0x2c')];if(!_0x1dfa5c[_0xbbcf('0x2d')][_0xbbcf('0x48')]('nolimit')){_0x287b14[_0xbbcf('0x1d')]=qs[_0xbbcf('0x1d')](_0x1dfa5c['query'][_0xbbcf('0x1d')]);_0x287b14[_0xbbcf('0x1b')]=qs[_0xbbcf('0x1b')](_0x1dfa5c['query'][_0xbbcf('0x1b')]);}_0x287b14[_0xbbcf('0x33')]=qs[_0xbbcf('0x34')](_0x1dfa5c[_0xbbcf('0x2d')]['sort']);_0x287b14[_0xbbcf('0x35')]=qs[_0xbbcf('0x36')](_[_0xbbcf('0x37')](_0x1dfa5c[_0xbbcf('0x2d')],_0x3f81db[_0xbbcf('0x36')]));_0x287b14['where'][_0xbbcf('0x49')]=_0x357de2['id'];if(_0x1dfa5c[_0xbbcf('0x2d')][_0xbbcf('0x4a')]){_0x287b14[_0xbbcf('0x35')]=_['merge'](_0x287b14[_0xbbcf('0x35')],{'$or':_['map'](_0x287b14['attributes'],function(_0x199ad7){var _0x358e5d={};_0x358e5d[_0x199ad7]={'$like':'%'+_0x1dfa5c[_0xbbcf('0x2d')]['filter']+'%'};return _0x358e5d;})});}_0x287b14=_[_0xbbcf('0x39')]({},_0x287b14,_0x1dfa5c['options']);return db[_0xbbcf('0x4b')][_0xbbcf('0x1e')]({'where':_0x287b14[_0xbbcf('0x35')]})[_0xbbcf('0x24')](function(_0x3667aa){_0x35372d[_0xbbcf('0x1e')]=_0x3667aa;if(_0x1dfa5c[_0xbbcf('0x2d')][_0xbbcf('0x3b')]){_0x287b14[_0xbbcf('0x3c')]=[{'all':!![]}];}return db[_0xbbcf('0x4b')][_0xbbcf('0x3d')](_0x287b14);})['then'](function(_0x45ba48){_0x35372d[_0xbbcf('0x4c')]=_0x45ba48;return _0x35372d;});}})[_0xbbcf('0x24')](respondWithFilteredResult(_0x6d416c,_0x287b14))['catch'](handleError(_0x6d416c,null));};
\ No newline at end of file
index df00e3b..d0230aa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0309=['rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x0309,0x165));var _0x9030=function(_0x3ba009,_0x1fd242){_0x3ba009=_0x3ba009-0x0;var _0xda5bba=_0x0309[_0x3ba009];return _0xda5bba;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var logger=require(_0x9030('0x1'))('api');var moment=require(_0x9030('0x2'));var BPromise=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var fs=require('fs');var path=require(_0x9030('0x5'));var rimraf=require(_0x9030('0x6'));var config=require(_0x9030('0x7'));var attributes=require(_0x9030('0x8'));module['exports']=function(_0x5a3334,_0x1c9c7b){return _0x5a3334[_0x9030('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x9030('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','report_jscripty_sessions','lodash'];(function(_0xe37270,_0x18e3c4){var _0x52795e=function(_0x554c06){while(--_0x554c06){_0xe37270['push'](_0xe37270['shift']());}};_0x52795e(++_0x18e3c4);}(_0xabce,0x103));var _0xeabc=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xabce[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('JscriptySessionReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9cebdb8..4bb1e0d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2542=['info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x35d5a5,_0x1bdac6){var _0x29c588=function(_0x10e0dc){while(--_0x10e0dc){_0x35d5a5['push'](_0x35d5a5['shift']());}};_0x29c588(++_0x1bdac6);}(_0x2542,0x169));var _0x2254=function(_0x32a6d7,_0x1189e1){_0x32a6d7=_0x32a6d7-0x0;var _0x1654af=_0x2542[_0x32a6d7];return _0x1654af;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});}
\ No newline at end of file
+var _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x45cfc8,_0x349f07){var _0x150685=function(_0x8b7e3e){while(--_0x8b7e3e){_0x45cfc8['push'](_0x45cfc8['shift']());}};_0x150685(++_0x349f07);}(_0x5496,0x175));var _0x6549=function(_0x306cb7,_0x16a6c1){_0x306cb7=_0x306cb7-0x0;var _0x306511=_0x5496[_0x306cb7];return _0x306511;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});}
\ No newline at end of file
index 513c778..f650f2d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5a46=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index','put','/:id','isAuthenticated','update','get'];(function(_0x3661f3,_0x1d9792){var _0x1bd195=function(_0x5afc1a){while(--_0x5afc1a){_0x3661f3['push'](_0x3661f3['shift']());}};_0x1bd195(++_0x1d9792);}(_0x5a46,0x1b3));var _0x65a4=function(_0x2330d8,_0x2a5ab4){_0x2330d8=_0x2330d8-0x0;var _0x4e6f46=_0x5a46[_0x2330d8];return _0x4e6f46;};'use strict';var multer=require('multer');var util=require(_0x65a4('0x0'));var path=require(_0x65a4('0x1'));var timeout=require(_0x65a4('0x2'));var express=require('express');var router=express[_0x65a4('0x3')]();var fs_extra=require(_0x65a4('0x4'));var auth=require(_0x65a4('0x5'));var interaction=require(_0x65a4('0x6'));var config=require(_0x65a4('0x7'));var controller=require(_0x65a4('0x8'));router['get']('/',controller[_0x65a4('0x9')]);router[_0x65a4('0xa')](_0x65a4('0xb'),auth[_0x65a4('0xc')](),controller[_0x65a4('0xd')]);router[_0x65a4('0xe')]('/download_log_file',auth[_0x65a4('0xc')](),controller['downloadLogFile']);module['exports']=router;
\ No newline at end of file
+var _0xa99b=['put','/:id','/download_log_file','downloadLogFile','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get'];(function(_0x1bcc17,_0x5a6878){var _0x1981d5=function(_0x3f6519){while(--_0x3f6519){_0x1bcc17['push'](_0x1bcc17['shift']());}};_0x1981d5(++_0x5a6878);}(_0xa99b,0x1f3));var _0xba99=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xa99b[_0x4dc7b9];return _0x3ab114;};'use strict';var multer=require(_0xba99('0x0'));var util=require('util');var path=require(_0xba99('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xba99('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xba99('0x3'));var interaction=require(_0xba99('0x4'));var config=require(_0xba99('0x5'));var controller=require(_0xba99('0x6'));router[_0xba99('0x7')]('/',controller['index']);router[_0xba99('0x8')](_0xba99('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xba99('0x7')](_0xba99('0xa'),auth['isAuthenticated'](),controller[_0xba99('0xb')]);module[_0xba99('0xc')]=router;
\ No newline at end of file
index f83a597..980f427 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc942=['STRING','TEXT'];(function(_0x14788d,_0x7ba762){var _0x2ff72e=function(_0x38a4d6){while(--_0x38a4d6){_0x14788d['push'](_0x14788d['shift']());}};_0x2ff72e(++_0x7ba762);}(_0xc942,0x10d));var _0x2c94=function(_0x351077,_0x7ec40a){_0x351077=_0x351077-0x0;var _0x106b47=_0xc942[_0x351077];return _0x106b47;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0x2c94('0x0')]},'data1':{'type':Sequelize[_0x2c94('0x1')]},'data2':{'type':Sequelize[_0x2c94('0x1')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
+var _0x36e1=['STRING','INTEGER','sequelize','TEXT'];(function(_0xfebf03,_0x498455){var _0x92ec02=function(_0x2fda5e){while(--_0x2fda5e){_0xfebf03['push'](_0xfebf03['shift']());}};_0x92ec02(++_0x498455);}(_0x36e1,0x15a));var _0x136e=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0x36e1[_0x2d8434];return _0x26b9e4;};'use strict';var Sequelize=require(_0x136e('0x0'));module['exports']={'license':{'type':Sequelize[_0x136e('0x1')]},'data1':{'type':Sequelize[_0x136e('0x2')]},'data2':{'type':Sequelize[_0x136e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x136e('0x3')],'defaultValue':0x0}};
\ No newline at end of file
index 4e84791..9a9992b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x066f=['get','checkLicense','key','demo','downloadLogFile','license-info.log','join','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','../../config/license/util','index','model','keys','License','query','filters','intersection','fields','attributes','merge','options','getLicense','catch','body','find','params'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x066f,0x180));var _0xf066=function(_0x34992e,_0x4ef4e6){_0x34992e=_0x34992e-0x0;var _0x340418=_0x066f[_0x34992e];return _0x340418;};'use strict';var emlformat=require(_0xf066('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf066('0x1'));var jsonpatch=require(_0xf066('0x2'));var rp=require('request-promise');var moment=require(_0xf066('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf066('0x4'));var util=require(_0xf066('0x5'));var path=require(_0xf066('0x6'));var sox=require(_0xf066('0x7'));var csv=require(_0xf066('0x8'));var ejs=require(_0xf066('0x9'));var fs=require('fs');var fs_extra=require(_0xf066('0xa'));var _=require(_0xf066('0xb'));var squel=require(_0xf066('0xc'));var crypto=require(_0xf066('0xd'));var jsforce=require(_0xf066('0xe'));var deskjs=require(_0xf066('0xf'));var toCsv=require(_0xf066('0x8'));var querystring=require(_0xf066('0x10'));var Papa=require(_0xf066('0x11'));var Redis=require(_0xf066('0x12'));var authService=require(_0xf066('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf066('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf066('0x15'))(_0xf066('0x16'));var utils=require('../../config/utils');var config=require(_0xf066('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf066('0x18'))['db'];function respondWithStatusCode(_0x25ae87,_0x20fb8f){_0x20fb8f=_0x20fb8f||0xcc;return function(_0x4908b6){if(_0x4908b6){return _0x25ae87[_0xf066('0x19')](_0x20fb8f);}return _0x25ae87[_0xf066('0x1a')](_0x20fb8f)[_0xf066('0x1b')]();};}function respondWithResult(_0x136c1a,_0x55abb6){_0x55abb6=_0x55abb6||0xc8;return function(_0x3bd4a3){if(_0x3bd4a3){return _0x136c1a['status'](_0x55abb6)[_0xf066('0x1c')](_0x3bd4a3);}};}function respondWithFilteredResult(_0x4040a9,_0x2092ff){return function(_0x91c2a3){if(_0x91c2a3){var _0x1d84e3=typeof _0x2092ff[_0xf066('0x1d')]===_0xf066('0x1e')&&typeof _0x2092ff['limit']===_0xf066('0x1e');var _0x50d082=_0x91c2a3[_0xf066('0x1f')];var _0xd359c6=_0x1d84e3?0x0:_0x2092ff[_0xf066('0x1d')];var _0x2b93db=_0x1d84e3?_0x91c2a3[_0xf066('0x1f')]:_0x2092ff['offset']+_0x2092ff[_0xf066('0x20')];var _0x22e03d;if(_0x2b93db>=_0x50d082){_0x2b93db=_0x50d082;_0x22e03d=0xc8;}else{_0x22e03d=0xce;}_0x4040a9[_0xf066('0x1a')](_0x22e03d);return _0x4040a9[_0xf066('0x21')](_0xf066('0x22'),_0xd359c6+'-'+_0x2b93db+'/'+_0x50d082)[_0xf066('0x1c')](_0x91c2a3);}return null;};}function patchUpdates(_0x48035f){return function(_0xd9a5c3){try{jsonpatch[_0xf066('0x23')](_0xd9a5c3,_0x48035f,!![]);}catch(_0x4f44ac){return BPromise['reject'](_0x4f44ac);}return _0xd9a5c3[_0xf066('0x24')]();};}function saveUpdates(_0x1ea96c,_0x214ba7){return function(_0x5868bb){if(_0x5868bb){return _0x5868bb['update'](_0x1ea96c)[_0xf066('0x25')](function(_0x207f36){return _0x207f36;});}return null;};}function removeEntity(_0x154e9d,_0x477cc8){return function(_0x249514){if(_0x249514){return _0x249514[_0xf066('0x26')]()[_0xf066('0x25')](function(){_0x154e9d['status'](0xcc)[_0xf066('0x1b')]();});}};}function handleEntityNotFound(_0x283de3,_0x2b3dc3){return function(_0xb7f176){if(!_0xb7f176){_0x283de3[_0xf066('0x19')](0x194);}return _0xb7f176;};}function handleError(_0x327b52,_0x41d29d){_0x41d29d=_0x41d29d||0x1f4;return function(_0x11aa5a){logger[_0xf066('0x27')](_0x11aa5a[_0xf066('0x28')]);if(_0x11aa5a[_0xf066('0x29')]){delete _0x11aa5a[_0xf066('0x29')];}_0x327b52[_0xf066('0x1a')](_0x41d29d)[_0xf066('0x2a')](_0x11aa5a);};}var utilLicense=require(_0xf066('0x2b'));exports[_0xf066('0x2c')]=function(_0x5e7307,_0x4fbe0e){var _0x1f0a47={'raw':!![],'where':{'id':0x1}},_0x36c009={};_0x36c009[_0xf066('0x2d')]=_[_0xf066('0x2e')](db[_0xf066('0x2f')]['rawAttributes']);_0x36c009['query']=_[_0xf066('0x2e')](_0x5e7307[_0xf066('0x30')]);_0x36c009[_0xf066('0x31')]=_[_0xf066('0x32')](_0x36c009[_0xf066('0x2d')],_0x36c009[_0xf066('0x30')]);_0x1f0a47['attributes']=_['intersection'](_0x36c009['model'],qs[_0xf066('0x33')](_0x5e7307[_0xf066('0x30')][_0xf066('0x33')]));_0x1f0a47[_0xf066('0x34')]=_0x1f0a47['attributes']['length']?_0x1f0a47[_0xf066('0x34')]:_0x36c009[_0xf066('0x2d')];_0x1f0a47=_[_0xf066('0x35')]({},_0x1f0a47,_0x5e7307[_0xf066('0x36')]);return utilLicense[_0xf066('0x37')](_0x1f0a47)['then'](respondWithResult(_0x4fbe0e,null))[_0xf066('0x38')](handleError(_0x4fbe0e,null));};exports['update']=function(_0x4bd4ec,_0x57b019){if(_0x4bd4ec[_0xf066('0x39')]['id']){delete _0x4bd4ec[_0xf066('0x39')]['id'];}return db[_0xf066('0x2f')][_0xf066('0x3a')]({'where':{'id':_0x4bd4ec[_0xf066('0x3b')]['id']}})['then'](handleEntityNotFound(_0x57b019,null))[_0xf066('0x25')](function(_0x4451bd){var _0x391a0c=_0x4451bd[_0xf066('0x3c')]({'plain':!![]});return utilLicense[_0xf066('0x3d')](_0x391a0c,_0x4bd4ec[_0xf066('0x39')][_0xf066('0x3e')]);})['then'](function(_0x19cd45){if(!_0x19cd45[_0xf066('0x3f')]){return saveUpdates(_0x4bd4ec['body'],null);}return _0x19cd45;})['then'](respondWithResult(_0x57b019,null))[_0xf066('0x38')](handleError(_0x57b019,null));};exports[_0xf066('0x40')]=function(_0x2dffee,_0x1517a3){var _0x55b878=_0xf066('0x41');var _0x4c92b5=path[_0xf066('0x42')]('/var',_0xf066('0x43'),'xcally',_0x55b878);_0x1517a3[_0xf066('0x44')](_0xf066('0x45'),_0xf066('0x46')+_0x55b878);_0x1517a3[_0xf066('0x21')](_0xf066('0x47'),_0xf066('0x48'));_0x1517a3[_0xf066('0x49')](_0x4c92b5);};
\ No newline at end of file
+var _0x875a=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','stack','name','send','index','model','keys','License','query','filters','intersection','attributes','length','merge','options','getLicense','catch','body','find','params','get','demo','downloadLogFile','license-info.log','join','/var','xcally','Content-disposition','attachment;\x20filename=','set','Content-Type','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x875a,0x135));var _0xa875=function(_0x2160bc,_0x10913d){_0x2160bc=_0x2160bc-0x0;var _0x225b33=_0x875a[_0x2160bc];return _0x225b33;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa875('0x0'));var rp=require(_0xa875('0x1'));var moment=require(_0xa875('0x2'));var BPromise=require(_0xa875('0x3'));var Mustache=require(_0xa875('0x4'));var util=require(_0xa875('0x5'));var path=require(_0xa875('0x6'));var sox=require(_0xa875('0x7'));var csv=require(_0xa875('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa875('0x9'));var _=require(_0xa875('0xa'));var squel=require('squel');var crypto=require(_0xa875('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa875('0xc'));var toCsv=require(_0xa875('0x8'));var querystring=require(_0xa875('0xd'));var Papa=require('papaparse');var Redis=require(_0xa875('0xe'));var authService=require(_0xa875('0xf'));var qs=require(_0xa875('0x10'));var as=require(_0xa875('0x11'));var hardwareService=require(_0xa875('0x12'));var logger=require(_0xa875('0x13'))('api');var utils=require(_0xa875('0x14'));var config=require(_0xa875('0x15'));var licenseUtil=require(_0xa875('0x16'));var db=require(_0xa875('0x17'))['db'];function respondWithStatusCode(_0x6fece6,_0x5d85c7){_0x5d85c7=_0x5d85c7||0xcc;return function(_0x16686f){if(_0x16686f){return _0x6fece6['sendStatus'](_0x5d85c7);}return _0x6fece6[_0xa875('0x18')](_0x5d85c7)[_0xa875('0x19')]();};}function respondWithResult(_0x5f50f2,_0x1ed325){_0x1ed325=_0x1ed325||0xc8;return function(_0x5e697c){if(_0x5e697c){return _0x5f50f2[_0xa875('0x18')](_0x1ed325)[_0xa875('0x1a')](_0x5e697c);}};}function respondWithFilteredResult(_0x5d1fd7,_0x10d38c){return function(_0x106f03){if(_0x106f03){var _0x2d0af8=typeof _0x10d38c[_0xa875('0x1b')]===_0xa875('0x1c')&&typeof _0x10d38c['limit']==='undefined';var _0x5684fd=_0x106f03[_0xa875('0x1d')];var _0x513235=_0x2d0af8?0x0:_0x10d38c['offset'];var _0x5f1149=_0x2d0af8?_0x106f03['count']:_0x10d38c[_0xa875('0x1b')]+_0x10d38c[_0xa875('0x1e')];var _0x5381d9;if(_0x5f1149>=_0x5684fd){_0x5f1149=_0x5684fd;_0x5381d9=0xc8;}else{_0x5381d9=0xce;}_0x5d1fd7[_0xa875('0x18')](_0x5381d9);return _0x5d1fd7['set'](_0xa875('0x1f'),_0x513235+'-'+_0x5f1149+'/'+_0x5684fd)[_0xa875('0x1a')](_0x106f03);}return null;};}function patchUpdates(_0x16683a){return function(_0x5917f4){try{jsonpatch[_0xa875('0x20')](_0x5917f4,_0x16683a,!![]);}catch(_0x1e746c){return BPromise[_0xa875('0x21')](_0x1e746c);}return _0x5917f4['save']();};}function saveUpdates(_0x35c919,_0x55e730){return function(_0x20c1d4){if(_0x20c1d4){return _0x20c1d4[_0xa875('0x22')](_0x35c919)['then'](function(_0x5cce4d){return _0x5cce4d;});}return null;};}function removeEntity(_0x2ce7a3,_0x37e438){return function(_0x595613){if(_0x595613){return _0x595613['destroy']()[_0xa875('0x23')](function(){_0x2ce7a3[_0xa875('0x18')](0xcc)[_0xa875('0x19')]();});}};}function handleEntityNotFound(_0x5b68eb,_0x18b7bc){return function(_0x8ad799){if(!_0x8ad799){_0x5b68eb['sendStatus'](0x194);}return _0x8ad799;};}function handleError(_0x5f143f,_0x40c7ca){_0x40c7ca=_0x40c7ca||0x1f4;return function(_0x59ddcb){logger['error'](_0x59ddcb[_0xa875('0x24')]);if(_0x59ddcb[_0xa875('0x25')]){delete _0x59ddcb[_0xa875('0x25')];}_0x5f143f[_0xa875('0x18')](_0x40c7ca)[_0xa875('0x26')](_0x59ddcb);};}var utilLicense=require(_0xa875('0x16'));exports[_0xa875('0x27')]=function(_0x3b952f,_0x2ba258){var _0x5c5682={'raw':!![],'where':{'id':0x1}},_0x3a7dcb={};_0x3a7dcb[_0xa875('0x28')]=_[_0xa875('0x29')](db[_0xa875('0x2a')]['rawAttributes']);_0x3a7dcb['query']=_[_0xa875('0x29')](_0x3b952f[_0xa875('0x2b')]);_0x3a7dcb[_0xa875('0x2c')]=_[_0xa875('0x2d')](_0x3a7dcb[_0xa875('0x28')],_0x3a7dcb[_0xa875('0x2b')]);_0x5c5682[_0xa875('0x2e')]=_['intersection'](_0x3a7dcb[_0xa875('0x28')],qs['fields'](_0x3b952f['query']['fields']));_0x5c5682[_0xa875('0x2e')]=_0x5c5682[_0xa875('0x2e')][_0xa875('0x2f')]?_0x5c5682[_0xa875('0x2e')]:_0x3a7dcb[_0xa875('0x28')];_0x5c5682=_[_0xa875('0x30')]({},_0x5c5682,_0x3b952f[_0xa875('0x31')]);return utilLicense[_0xa875('0x32')](_0x5c5682)[_0xa875('0x23')](respondWithResult(_0x2ba258,null))[_0xa875('0x33')](handleError(_0x2ba258,null));};exports[_0xa875('0x22')]=function(_0x162bd7,_0x1041d3){if(_0x162bd7[_0xa875('0x34')]['id']){delete _0x162bd7[_0xa875('0x34')]['id'];}return db['License'][_0xa875('0x35')]({'where':{'id':_0x162bd7[_0xa875('0x36')]['id']}})['then'](handleEntityNotFound(_0x1041d3,null))[_0xa875('0x23')](function(_0x5b0741){var _0x3477ee=_0x5b0741[_0xa875('0x37')]({'plain':!![]});return utilLicense['checkLicense'](_0x3477ee,_0x162bd7[_0xa875('0x34')]['key']);})[_0xa875('0x23')](function(_0xfb4a14){if(!_0xfb4a14[_0xa875('0x38')]){return saveUpdates(_0x162bd7[_0xa875('0x34')],null);}return _0xfb4a14;})[_0xa875('0x23')](respondWithResult(_0x1041d3,null))['catch'](handleError(_0x1041d3,null));};exports[_0xa875('0x39')]=function(_0x14eb34,_0xbd0792){var _0x5b74f0=_0xa875('0x3a');var _0x2e140f=path[_0xa875('0x3b')](_0xa875('0x3c'),'log',_0xa875('0x3d'),_0x5b74f0);_0xbd0792['setHeader'](_0xa875('0x3e'),_0xa875('0x3f')+_0x5b74f0);_0xbd0792[_0xa875('0x40')](_0xa875('0x41'),'text/plain');_0xbd0792['download'](_0x2e140f);};
\ No newline at end of file
index c84017b..c691719 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd6ae=['rimraf','../../config/environment','./license.attributes','License','license','util','../../config/logger','api','moment','bluebird','path'];(function(_0x126f65,_0x31fc2c){var _0x18c323=function(_0x11fb24){while(--_0x11fb24){_0x126f65['push'](_0x126f65['shift']());}};_0x18c323(++_0x31fc2c);}(_0xd6ae,0xf7));var _0xed6a=function(_0x1133d8,_0x4e10b4){_0x1133d8=_0x1133d8-0x0;var _0x358f4b=_0xd6ae[_0x1133d8];return _0x358f4b;};'use strict';var _=require('lodash');var util=require(_0xed6a('0x0'));var logger=require(_0xed6a('0x1'))(_0xed6a('0x2'));var moment=require(_0xed6a('0x3'));var BPromise=require(_0xed6a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed6a('0x5'));var rimraf=require(_0xed6a('0x6'));var config=require(_0xed6a('0x7'));var attributes=require(_0xed6a('0x8'));module['exports']=function(_0x48ae34,_0x555641){return _0x48ae34['define'](_0xed6a('0x9'),attributes,{'tableName':_0xed6a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xb6c8=['../../config/logger','api','moment','bluebird','request-promise','./license.attributes','exports','define','License','license','lodash'];(function(_0x39dd3d,_0x43bf3b){var _0x368659=function(_0x2ae5f8){while(--_0x2ae5f8){_0x39dd3d['push'](_0x39dd3d['shift']());}};_0x368659(++_0x43bf3b);}(_0xb6c8,0x180));var _0x8b6c=function(_0x11cbef,_0x2ab1a8){_0x11cbef=_0x11cbef-0x0;var _0x42b02f=_0xb6c8[_0x11cbef];return _0x42b02f;};'use strict';var _=require(_0x8b6c('0x0'));var util=require('util');var logger=require(_0x8b6c('0x1'))(_0x8b6c('0x2'));var moment=require(_0x8b6c('0x3'));var BPromise=require(_0x8b6c('0x4'));var rp=require(_0x8b6c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8b6c('0x6'));module[_0x8b6c('0x7')]=function(_0x1d33b1,_0x349650){return _0x1d33b1[_0x8b6c('0x8')](_0x8b6c('0x9'),attributes,{'tableName':_0x8b6c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d5eaa55..47e7add 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1428=['../../config/utils','../../config/logger','rpc','jayson/promise','http','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x4a73b4,_0x587a3e){var _0x3d42b9=function(_0x1bfa44){while(--_0x1bfa44){_0x4a73b4['push'](_0x4a73b4['shift']());}};_0x3d42b9(++_0x587a3e);}(_0x1428,0x15f));var _0x8142=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x1428[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x8142('0x0'));var util=require(_0x8142('0x1'));var moment=require(_0x8142('0x2'));var BPromise=require(_0x8142('0x3'));var rs=require(_0x8142('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8142('0x5'))['db'];var utils=require(_0x8142('0x6'));var logger=require(_0x8142('0x7'))(_0x8142('0x8'));var config=require('../../config/environment');var jayson=require(_0x8142('0x9'));var client=jayson['client'][_0x8142('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x504972,_0x1e4418,_0x3ed344){return new BPromise(function(_0x1fcc38,_0x28f43a){return client['request'](_0x504972,_0x3ed344)['then'](function(_0x449a32){logger[_0x8142('0xb')](_0x8142('0xc'),_0x1e4418,_0x8142('0xd'));logger[_0x8142('0xe')](_0x8142('0xf'),_0x1e4418,_0x8142('0xd'),JSON[_0x8142('0x10')](_0x449a32));if(_0x449a32[_0x8142('0x11')]){if(_0x449a32[_0x8142('0x11')][_0x8142('0x12')]===0x1f4){logger['error'](_0x8142('0xc'),_0x1e4418,_0x449a32[_0x8142('0x11')][_0x8142('0x13')]);return _0x28f43a(_0x449a32[_0x8142('0x11')][_0x8142('0x13')]);}logger[_0x8142('0x11')](_0x8142('0xc'),_0x1e4418,_0x449a32[_0x8142('0x11')]['message']);return _0x1fcc38(_0x449a32[_0x8142('0x11')]['message']);}else{logger[_0x8142('0xb')](_0x8142('0xc'),_0x1e4418,'request\x20sent');_0x1fcc38(_0x449a32['result'][_0x8142('0x13')]);}})[_0x8142('0x14')](function(_0x507a7f){logger[_0x8142('0x11')](_0x8142('0xc'),_0x1e4418,_0x507a7f);_0x28f43a(_0x507a7f);});});}
\ No newline at end of file
+var _0x9278=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','util','randomstring','ioredis'];(function(_0x25dce4,_0xe2625a){var _0x48b2e8=function(_0x5db147){while(--_0x5db147){_0x25dce4['push'](_0x25dce4['shift']());}};_0x48b2e8(++_0xe2625a);}(_0x9278,0x1b6));var _0x8927=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x9278[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x8927('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8927('0x1'));var fs=require('fs');var Redis=require(_0x8927('0x2'));var db=require(_0x8927('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8927('0x4'))(_0x8927('0x5'));var config=require(_0x8927('0x6'));var jayson=require(_0x8927('0x7'));var client=jayson[_0x8927('0x8')][_0x8927('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27e33a,_0x3583c3,_0xdade79){return new BPromise(function(_0x5dcda7,_0x3733ad){return client[_0x8927('0xa')](_0x27e33a,_0xdade79)[_0x8927('0xb')](function(_0x2b86a1){logger[_0x8927('0xc')](_0x8927('0xd'),_0x3583c3,'request\x20sent');logger[_0x8927('0xe')]('License,\x20%s,\x20%s,\x20%s',_0x3583c3,_0x8927('0xf'),JSON[_0x8927('0x10')](_0x2b86a1));if(_0x2b86a1[_0x8927('0x11')]){if(_0x2b86a1['error']['code']===0x1f4){logger[_0x8927('0x11')](_0x8927('0xd'),_0x3583c3,_0x2b86a1['error']['message']);return _0x3733ad(_0x2b86a1[_0x8927('0x11')]['message']);}logger[_0x8927('0x11')](_0x8927('0xd'),_0x3583c3,_0x2b86a1[_0x8927('0x11')][_0x8927('0x12')]);return _0x5dcda7(_0x2b86a1[_0x8927('0x11')][_0x8927('0x12')]);}else{logger[_0x8927('0xc')](_0x8927('0xd'),_0x3583c3,_0x8927('0xf'));_0x5dcda7(_0x2b86a1[_0x8927('0x13')][_0x8927('0x12')]);}})[_0x8927('0x14')](function(_0x12e5b0){logger[_0x8927('0x11')](_0x8927('0xd'),_0x3583c3,_0x12e5b0);_0x3733ad(_0x12e5b0);});});}
\ No newline at end of file
index 598e5d0..39522a2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe808=['../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','verifySmtp','/:id/users','post','addDisposition','create','/:id/in_servers','addImap','addSmtp','addInteraction','addApplications','/:id/send','addAgents','removeDispositions','delete','removeImap','removeSmtp','destroy','removeAgents','multer','util','express','Router','../../components/auth/service'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xe808,0xcd));var _0x8e80=function(_0x1a2cc1,_0x6cae2d){_0x1a2cc1=_0x1a2cc1-0x0;var _0x1dec9d=_0xe808[_0x1a2cc1];return _0x1dec9d;};'use strict';var multer=require(_0x8e80('0x0'));var util=require(_0x8e80('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8e80('0x2'));var router=express[_0x8e80('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8e80('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8e80('0x5'));var controller=require(_0x8e80('0x6'));router[_0x8e80('0x7')]('/',auth[_0x8e80('0x8')](),controller[_0x8e80('0x9')]);router[_0x8e80('0x7')](_0x8e80('0xa'),auth[_0x8e80('0x8')](),controller[_0x8e80('0xb')]);router[_0x8e80('0x7')](_0x8e80('0xc'),auth[_0x8e80('0x8')](),controller[_0x8e80('0xd')]);router[_0x8e80('0x7')](_0x8e80('0xe'),auth[_0x8e80('0x8')](),controller[_0x8e80('0xf')]);router[_0x8e80('0x7')](_0x8e80('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router['get']('/:id/in_servers',auth[_0x8e80('0x8')](),controller['getImap']);router[_0x8e80('0x7')](_0x8e80('0x11'),auth[_0x8e80('0x8')](),controller[_0x8e80('0x12')]);router[_0x8e80('0x7')](_0x8e80('0x13'),auth['isAuthenticated'](),controller[_0x8e80('0x14')]);router['get'](_0x8e80('0x15'),auth[_0x8e80('0x8')](),controller[_0x8e80('0x16')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x8e80('0x17')]);router[_0x8e80('0x7')]('/:id/verify',auth[_0x8e80('0x8')](),controller[_0x8e80('0x18')]);router[_0x8e80('0x7')](_0x8e80('0x19'),auth[_0x8e80('0x8')](),controller['getAgents']);router[_0x8e80('0x1a')](_0x8e80('0xe'),auth[_0x8e80('0x8')](),controller[_0x8e80('0x1b')]);router[_0x8e80('0x1a')](_0x8e80('0x10'),auth[_0x8e80('0x8')](),controller['addAnswer']);router[_0x8e80('0x1a')]('/',auth[_0x8e80('0x8')](),controller[_0x8e80('0x1c')]);router[_0x8e80('0x1a')](_0x8e80('0x1d'),auth[_0x8e80('0x8')](),controller[_0x8e80('0x1e')]);router['post'](_0x8e80('0x11'),auth[_0x8e80('0x8')](),controller[_0x8e80('0x1f')]);router[_0x8e80('0x1a')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x8e80('0x20')]);router[_0x8e80('0x1a')](_0x8e80('0x15'),auth[_0x8e80('0x8')](),controller[_0x8e80('0x21')]);router['post'](_0x8e80('0x22'),auth[_0x8e80('0x8')](),controller['send']);router['post'](_0x8e80('0x19'),auth[_0x8e80('0x8')](),controller[_0x8e80('0x23')]);router['put'](_0x8e80('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x8e80('0xe'),auth[_0x8e80('0x8')](),controller[_0x8e80('0x24')]);router[_0x8e80('0x25')](_0x8e80('0x10'),auth[_0x8e80('0x8')](),controller['removeAnswers']);router[_0x8e80('0x25')](_0x8e80('0x1d'),auth[_0x8e80('0x8')](),controller[_0x8e80('0x26')]);router['delete'](_0x8e80('0x11'),auth['isAuthenticated'](),controller[_0x8e80('0x27')]);router['delete'](_0x8e80('0xc'),auth['isAuthenticated'](),controller[_0x8e80('0x28')]);router[_0x8e80('0x25')](_0x8e80('0x19'),auth[_0x8e80('0x8')](),controller[_0x8e80('0x29')]);module['exports']=router;
\ No newline at end of file
+var _0x8e43=['/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getInteractions','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addImap','/:id/out_servers','/:id/interactions','addInteraction','/:id/applications','addApplications','/:id/send','send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','/:id','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index'];(function(_0x340d75,_0x561cb0){var _0x3f1114=function(_0x2e2bcf){while(--_0x2e2bcf){_0x340d75['push'](_0x340d75['shift']());}};_0x3f1114(++_0x561cb0);}(_0x8e43,0x7f));var _0x38e4=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x8e43[_0x1c34e7];return _0x378cb1;};'use strict';var multer=require(_0x38e4('0x0'));var util=require(_0x38e4('0x1'));var path=require(_0x38e4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x38e4('0x3'));var auth=require(_0x38e4('0x4'));var interaction=require(_0x38e4('0x5'));var config=require(_0x38e4('0x6'));var controller=require(_0x38e4('0x7'));router[_0x38e4('0x8')]('/',auth[_0x38e4('0x9')](),controller[_0x38e4('0xa')]);router[_0x38e4('0x8')](_0x38e4('0xb'),auth[_0x38e4('0x9')](),controller[_0x38e4('0xc')]);router[_0x38e4('0x8')]('/:id',auth[_0x38e4('0x9')](),controller[_0x38e4('0xd')]);router['get'](_0x38e4('0xe'),auth[_0x38e4('0x9')](),controller[_0x38e4('0xf')]);router['get']('/:id/canned_answers',auth[_0x38e4('0x9')](),controller[_0x38e4('0x10')]);router[_0x38e4('0x8')](_0x38e4('0x11'),auth['isAuthenticated'](),controller['getImap']);router[_0x38e4('0x8')]('/:id/out_servers',auth['isAuthenticated'](),controller['getSmtp']);router[_0x38e4('0x8')]('/:id/interactions',auth[_0x38e4('0x9')](),controller[_0x38e4('0x12')]);router[_0x38e4('0x8')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['get'](_0x38e4('0x13'),auth['isAuthenticated'](),controller[_0x38e4('0x14')]);router[_0x38e4('0x8')]('/:id/verify',auth['isAuthenticated'](),controller[_0x38e4('0x15')]);router[_0x38e4('0x8')](_0x38e4('0x16'),auth[_0x38e4('0x9')](),controller[_0x38e4('0x17')]);router[_0x38e4('0x18')]('/:id/dispositions',auth[_0x38e4('0x9')](),controller[_0x38e4('0x19')]);router[_0x38e4('0x18')](_0x38e4('0x1a'),auth[_0x38e4('0x9')](),controller[_0x38e4('0x1b')]);router[_0x38e4('0x18')]('/',auth[_0x38e4('0x9')](),controller[_0x38e4('0x1c')]);router['post'](_0x38e4('0x11'),auth['isAuthenticated'](),controller[_0x38e4('0x1d')]);router['post'](_0x38e4('0x1e'),auth[_0x38e4('0x9')](),controller['addSmtp']);router[_0x38e4('0x18')](_0x38e4('0x1f'),auth[_0x38e4('0x9')](),controller[_0x38e4('0x20')]);router[_0x38e4('0x18')](_0x38e4('0x21'),auth[_0x38e4('0x9')](),controller[_0x38e4('0x22')]);router['post'](_0x38e4('0x23'),auth[_0x38e4('0x9')](),controller[_0x38e4('0x24')]);router[_0x38e4('0x18')](_0x38e4('0x16'),auth[_0x38e4('0x9')](),controller[_0x38e4('0x25')]);router[_0x38e4('0x26')]('/:id',auth[_0x38e4('0x9')](),controller['update']);router[_0x38e4('0x27')]('/:id/dispositions',auth[_0x38e4('0x9')](),controller[_0x38e4('0x28')]);router['delete'](_0x38e4('0x1a'),auth[_0x38e4('0x9')](),controller[_0x38e4('0x29')]);router[_0x38e4('0x27')](_0x38e4('0x11'),auth['isAuthenticated'](),controller[_0x38e4('0x2a')]);router[_0x38e4('0x27')](_0x38e4('0x1e'),auth['isAuthenticated'](),controller[_0x38e4('0x2b')]);router['delete'](_0x38e4('0x2c'),auth['isAuthenticated'](),controller[_0x38e4('0x2d')]);router[_0x38e4('0x27')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router;
\ No newline at end of file
index 0814764..ed0fc0a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcf5c=['TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}<br/>Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','yahoo','outlook365','custom','getDataValue','provider','sequelize','exports','STRING','BOOLEAN'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xcf5c,0x81));var _0xccf5=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xcf5c[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0xccf5('0x0'));module[_0xccf5('0x1')]={'description':{'type':Sequelize[_0xccf5('0x2')]},'name':{'type':Sequelize[_0xccf5('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xccf5('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xccf5('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xccf5('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xccf5('0x4')]},'markAsUnread':{'type':Sequelize[_0xccf5('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xccf5('0x2')],'allowNull':![],'defaultValue':_0xccf5('0x5')},'fontSize':{'type':Sequelize[_0xccf5('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xccf5('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xccf5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xccf5('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xccf5('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xccf5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xccf5('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xccf5('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xccf5('0x3')],'defaultValue':![],'comment':_0xccf5('0x9'),'set':function(_0x315318){if(!_0x315318)this['setDataValue'](_0xccf5('0xa'),null);this[_0xccf5('0xb')](_0xccf5('0xc'),_0x315318);}},'provider':{'type':Sequelize[_0xccf5('0xd')]('gmail','hotmail',_0xccf5('0xe'),_0xccf5('0xf')),'defaultValue':null,'get':function(){if(!this['getDataValue']('provider'))return _0xccf5('0x10');return this[_0xccf5('0x11')]('provider');},'set':function(_0xc032f6){if(_0xc032f6===_0xccf5('0x10'))_0xc032f6=null;return this[_0xccf5('0xb')](_0xccf5('0x12'),_0xc032f6);}}};
\ No newline at end of file
+var _0x1bc8=['provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','gmail','yahoo','getDataValue'];(function(_0x571d85,_0xda439c){var _0x3c2e07=function(_0x2d2144){while(--_0x2d2144){_0x571d85['push'](_0x571d85['shift']());}};_0x3c2e07(++_0xda439c);}(_0x1bc8,0x182));var _0x81bc=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0x1bc8[_0x30c2ae];return _0x1ee1cc;};'use strict';var Sequelize=require(_0x81bc('0x0'));module['exports']={'description':{'type':Sequelize[_0x81bc('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x81bc('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x81bc('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x81bc('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x81bc('0x3')]},'markAsUnread':{'type':Sequelize[_0x81bc('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x81bc('0x1')],'allowNull':![],'defaultValue':_0x81bc('0x4')},'fontSize':{'type':Sequelize[_0x81bc('0x5')](0x2)[_0x81bc('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x81bc('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}<br/>Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x81bc('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x81bc('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x81bc('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x81bc('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x81bc('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x81bc('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x81bc('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x81bc('0x2')],'defaultValue':![],'comment':_0x81bc('0x8'),'set':function(_0x5e76dd){if(!_0x5e76dd)this[_0x81bc('0x9')]('mandatoryDispositionPauseId',null);this[_0x81bc('0x9')](_0x81bc('0xa'),_0x5e76dd);}},'provider':{'type':Sequelize['ENUM'](_0x81bc('0xb'),'hotmail',_0x81bc('0xc'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x81bc('0xd')](_0x81bc('0xe')))return'custom';return this[_0x81bc('0xd')]('provider');},'set':function(_0x1a1a8c){if(_0x1a1a8c===_0x81bc('0xf'))_0x1a1a8c=null;return this[_0x81bc('0x9')]('provider',_0x1a1a8c);}}};
\ No newline at end of file
index c976fbb..47bfafb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa77a=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','MailAccount','includeAll','include','findAll','rows','params','length','find','update','body','provider','custom','Mail\x20Account\x20not\x20found','describe','Disposition','create','getDispositions','findOne','MailAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','key','email','ListId','isNil','active','description','get','UserProfileSection','MailAccounts','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','getSmtp','addSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','internal','Tag','color','tag','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','stack','getApplications','MailMessage','$gte','split','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','attachments','join','root','basename','getSmtpOptions','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','out','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','set','json','destroy','name','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0x5e7c56,_0x390a1c){var _0x52aab1=function(_0x45dca7){while(--_0x45dca7){_0x5e7c56['push'](_0x5e7c56['shift']());}};_0x52aab1(++_0x390a1c);}(_0xa77a,0x12b));var _0xaa77=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0xa77a[_0x4c98b9];return _0x3a257a;};'use strict';var moment=require(_0xaa77('0x0'));var BPromise=require(_0xaa77('0x1'));var util=require(_0xaa77('0x2'));var path=require(_0xaa77('0x3'));var _=require(_0xaa77('0x4'));var juice=require(_0xaa77('0x5'));var Redis=require(_0xaa77('0x6'));var qs=require(_0xaa77('0x7'));var logger=require(_0xaa77('0x8'))(_0xaa77('0x9'));var config=require('../../config/environment');var db=require(_0xaa77('0xa'))['db'];config[_0xaa77('0xb')]=_['defaults'](config[_0xaa77('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa77('0xc'))(new Redis(config['redis']));require(_0xaa77('0xd'))[_0xaa77('0xe')](socket);var jayson=require(_0xaa77('0xf'));var client=jayson[_0xaa77('0x10')][_0xaa77('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x36c088,_0x4e2a88,_0xed6501,_0x93057b){return new BPromise(function(_0x509e61,_0x4196d8){var _0x34f0e0=_0x93057b||client;return _0x34f0e0[_0xaa77('0x12')](_0x36c088,_0xed6501)[_0xaa77('0x13')](function(_0x47eff5){logger[_0xaa77('0x14')](_0xaa77('0x15'),_0x4e2a88,_0xaa77('0x16'));logger[_0xaa77('0x17')](_0xaa77('0x18'),_0x4e2a88,'request\x20sent',JSON['stringify'](_0x47eff5));if(_0x47eff5['error']){if(_0x47eff5[_0xaa77('0x19')][_0xaa77('0x1a')]===0x1f4){logger[_0xaa77('0x19')]('MailAccount,\x20%s,\x20%s',_0x4e2a88,_0x47eff5[_0xaa77('0x19')]['message']);return _0x4196d8(_0x47eff5[_0xaa77('0x19')][_0xaa77('0x1b')]);}logger[_0xaa77('0x19')](_0xaa77('0x15'),_0x4e2a88,_0x47eff5[_0xaa77('0x19')]['message']);return _0x509e61(_0x47eff5[_0xaa77('0x19')][_0xaa77('0x1b')]);}else{logger[_0xaa77('0x14')]('MailAccount,\x20%s,\x20%s',_0x4e2a88,'request\x20sent');_0x509e61(_0x47eff5[_0xaa77('0x1c')]['message']);}})[_0xaa77('0x1d')](function(_0x2e8aef){logger[_0xaa77('0x19')](_0xaa77('0x15'),_0x4e2a88,_0x2e8aef);_0x4196d8(_0x2e8aef);});});}function respondWithStatusCode(_0xb080c4,_0x142ddd){_0x142ddd=_0x142ddd||0xcc;return function(_0x31b530){if(_0x31b530){return _0xb080c4[_0xaa77('0x1e')](_0x142ddd);}return _0xb080c4['status'](_0x142ddd)[_0xaa77('0x1f')]();};}function respondWithResult(_0x1f2156,_0x1fca0f){_0x1fca0f=_0x1fca0f||0xc8;return function(_0x2e0fa1){if(_0x2e0fa1){return _0x1f2156[_0xaa77('0x20')](_0x1fca0f)['json'](_0x2e0fa1);}};}function respondWithFilteredResult(_0x1842e5,_0x4bdea0){return function(_0x1ebfd5){if(_0x1ebfd5){var _0x27ce92=typeof _0x4bdea0[_0xaa77('0x21')]===_0xaa77('0x22')&&typeof _0x4bdea0[_0xaa77('0x23')]===_0xaa77('0x22');var _0x4758a5=_0x1ebfd5[_0xaa77('0x24')];var _0x38abd1=_0x27ce92?0x0:_0x4bdea0['offset'];var _0x1269e1=_0x27ce92?_0x1ebfd5[_0xaa77('0x24')]:_0x4bdea0[_0xaa77('0x21')]+_0x4bdea0[_0xaa77('0x23')];var _0x3e315e;if(_0x1269e1>=_0x4758a5){_0x1269e1=_0x4758a5;_0x3e315e=0xc8;}else{_0x3e315e=0xce;}_0x1842e5[_0xaa77('0x20')](_0x3e315e);return _0x1842e5[_0xaa77('0x25')]('Content-Range',_0x38abd1+'-'+_0x1269e1+'/'+_0x4758a5)[_0xaa77('0x26')](_0x1ebfd5);}return null;};}function saveUpdates(_0x9657b0){return function(_0x504a7f){if(_0x504a7f){return _0x504a7f['update'](_0x9657b0)[_0xaa77('0x13')](function(_0x13e53e){return _0x13e53e;});}return null;};}function removeEntity(_0xf9c9dd){return function(_0x40ae7a){if(_0x40ae7a){return _0x40ae7a[_0xaa77('0x27')]()[_0xaa77('0x13')](function(){var _0x2f1886=_0x40ae7a['get']({'plain':!![]});var _0x5e373b='MailAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x5e373b,'resourceId':_0x2f1886['id']}})[_0xaa77('0x13')](function(){return _0x40ae7a;});})[_0xaa77('0x13')](function(){_0xf9c9dd[_0xaa77('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3019d6){return function(_0x495b9a){if(!_0x495b9a){_0x3019d6[_0xaa77('0x1e')](0x194);}return _0x495b9a;};}function handleError(_0x249260,_0x17f774){_0x17f774=_0x17f774||0x1f4;return function(_0x5626ae){logger['error'](_0x5626ae['stack']);if(_0x5626ae[_0xaa77('0x28')]){delete _0x5626ae[_0xaa77('0x28')];}_0x249260[_0xaa77('0x20')](_0x17f774)['send'](_0x5626ae);};}function getImapHost(_0x1bf000){switch(_0x1bf000){case _0xaa77('0x29'):return _0xaa77('0x2a');case _0xaa77('0x2b'):return'imap.mail.yahoo.com';case _0xaa77('0x2c'):return _0xaa77('0x2d');case _0xaa77('0x2e'):return _0xaa77('0x2f');}throw new Error(_0xaa77('0x30'),_0x1bf000);}function getSmtpHost(_0xf7cdee){switch(_0xf7cdee){case _0xaa77('0x29'):return _0xaa77('0x31');case _0xaa77('0x2b'):return _0xaa77('0x32');case _0xaa77('0x2c'):return _0xaa77('0x33');case'outlook365':return _0xaa77('0x34');}throw new Error(_0xaa77('0x30'),_0xf7cdee);}function getAuthenticationOptions(_0x2a2da5,_0xd4b318){var _0x4ed104={};var _0x2feef8={};if(_0x2a2da5){_0x4ed104[_0xaa77('0x35')]=_0x2feef8['user']=_0xd4b318[_0xaa77('0x36')];_0x4ed104[_0xaa77('0x37')]=_0x2feef8['pass']=_0xd4b318[_0xaa77('0x37')];if(_0xd4b318[_0xaa77('0x38')]){_0x4ed104[_0xaa77('0x38')]=_0x2feef8[_0xaa77('0x38')]=!![];_0x4ed104[_0xaa77('0x39')]=_0x2feef8['CloudProviderId']=_0xd4b318['CloudProviderId'];_0x4ed104['password']=_0x2feef8[_0xaa77('0x3a')]=null;}else{_0x4ed104[_0xaa77('0x39')]=_0x2feef8['CloudProviderId']=null;}_0x4ed104[_0xaa77('0x3b')]=getImapHost(_0x2a2da5);_0x4ed104[_0xaa77('0x3c')]=0x3e1;_0x2feef8['host']=getSmtpHost(_0x2a2da5);_0x2feef8[_0xaa77('0x3c')]=0x24b;_0x2feef8[_0xaa77('0x3d')]=![];_0x4ed104['service']=_0x2feef8[_0xaa77('0x3e')]=null;}else{if(_0xd4b318[_0xaa77('0x3f')]){_0x4ed104[_0xaa77('0x35')]=_0x2feef8['user']=_0xd4b318[_0xaa77('0x36')];_0x4ed104[_0xaa77('0x37')]=_0x2feef8[_0xaa77('0x3a')]=_0xd4b318[_0xaa77('0x37')];}else{_0x4ed104[_0xaa77('0x3f')]=_0x2feef8[_0xaa77('0x3f')]=![];_0x4ed104['user']=_0x2feef8[_0xaa77('0x35')]=null;_0x4ed104[_0xaa77('0x37')]=_0x2feef8[_0xaa77('0x3a')]=null;}_0x4ed104[_0xaa77('0x3b')]=_0xd4b318[_0xaa77('0x40')]['host'];_0x4ed104[_0xaa77('0x3c')]=_0xd4b318[_0xaa77('0x40')][_0xaa77('0x3c')];_0x2feef8[_0xaa77('0x3b')]=_0xd4b318[_0xaa77('0x41')][_0xaa77('0x3b')];_0x2feef8[_0xaa77('0x3c')]=_0xd4b318['Smtp'][_0xaa77('0x3c')];}return{'Imap':_0x4ed104,'Smtp':_0x2feef8};}exports[_0xaa77('0x42')]=function(_0x1da74a,_0x31e292){var _0x4de6fe={'include':[{'model':db[_0xaa77('0x43')],'as':_0xaa77('0x40')},{'model':db[_0xaa77('0x44')],'as':_0xaa77('0x41')},{'model':db[_0xaa77('0x45')],'as':_0xaa77('0x46')}]},_0x3f9999={},_0x26f946={'count':0x0,'rows':[]};var _0x54cd5c=_['map'](db['MailAccount'][_0xaa77('0x47')],function(_0x2df84c){return{'name':_0x2df84c[_0xaa77('0x48')],'type':_0x2df84c[_0xaa77('0x49')]['key']};});_0x3f9999[_0xaa77('0x4a')]=_['map'](_0x54cd5c,_0xaa77('0x28'));_0x3f9999[_0xaa77('0x4b')]=_[_0xaa77('0x4c')](_0x1da74a[_0xaa77('0x4b')]);_0x3f9999[_0xaa77('0x4d')]=_[_0xaa77('0x4e')](_0x3f9999[_0xaa77('0x4a')],_0x3f9999[_0xaa77('0x4b')]);_0x4de6fe[_0xaa77('0x4f')]=_[_0xaa77('0x4e')](_0x3f9999[_0xaa77('0x4a')],qs[_0xaa77('0x50')](_0x1da74a[_0xaa77('0x4b')][_0xaa77('0x50')]));_0x4de6fe[_0xaa77('0x4f')]=_0x4de6fe[_0xaa77('0x4f')]['length']?_0x4de6fe[_0xaa77('0x4f')]:_0x3f9999[_0xaa77('0x4a')];if(!_0x1da74a['query'][_0xaa77('0x51')](_0xaa77('0x52'))){_0x4de6fe[_0xaa77('0x23')]=qs[_0xaa77('0x23')](_0x1da74a['query']['limit']);_0x4de6fe[_0xaa77('0x21')]=qs['offset'](_0x1da74a['query']['offset']);}_0x4de6fe[_0xaa77('0x53')]=qs[_0xaa77('0x54')](_0x1da74a['query'][_0xaa77('0x54')]);_0x4de6fe[_0xaa77('0x55')]=qs[_0xaa77('0x4d')](_[_0xaa77('0x56')](_0x1da74a[_0xaa77('0x4b')],_0x3f9999[_0xaa77('0x4d')]),_0x54cd5c);if(_0x1da74a[_0xaa77('0x4b')][_0xaa77('0x57')]){_0x4de6fe['where']=_[_0xaa77('0x58')](_0x4de6fe[_0xaa77('0x55')],{'$or':_[_0xaa77('0x59')](_0x54cd5c,function(_0x1acbf1){if(_0x1acbf1[_0xaa77('0x49')]!==_0xaa77('0x5a')){var _0x18f66b={};_0x18f66b[_0x1acbf1[_0xaa77('0x28')]]={'$like':'%'+_0x1da74a[_0xaa77('0x4b')]['filter']+'%'};return _0x18f66b;}})});}_0x4de6fe=_[_0xaa77('0x58')]({},_0x4de6fe,_0x1da74a[_0xaa77('0x5b')]);var _0x3697fc={'where':_0x4de6fe[_0xaa77('0x55')]};return db[_0xaa77('0x5c')][_0xaa77('0x24')](_0x3697fc)[_0xaa77('0x13')](function(_0x45f4e1){_0x26f946[_0xaa77('0x24')]=_0x45f4e1;if(_0x1da74a['query'][_0xaa77('0x5d')]){_0x4de6fe[_0xaa77('0x5e')]=[{'all':!![]}];}return db['MailAccount'][_0xaa77('0x5f')](_0x4de6fe);})[_0xaa77('0x13')](function(_0x5d32d6){_0x26f946[_0xaa77('0x60')]=_0x5d32d6;return _0x26f946;})['then'](respondWithFilteredResult(_0x31e292,_0x4de6fe))[_0xaa77('0x1d')](handleError(_0x31e292,null));};exports['show']=function(_0x4d7f78,_0x56608c){var _0x2177e9={'raw':![],'where':{'id':_0x4d7f78[_0xaa77('0x61')]['id']},'include':[{'model':db[_0xaa77('0x43')],'as':_0xaa77('0x40')},{'model':db[_0xaa77('0x44')],'as':_0xaa77('0x41')},{'model':db[_0xaa77('0x45')],'as':_0xaa77('0x46')}]},_0x245225={};_0x245225['model']=_[_0xaa77('0x4c')](db[_0xaa77('0x5c')][_0xaa77('0x47')]);_0x245225[_0xaa77('0x4b')]=_[_0xaa77('0x4c')](_0x4d7f78[_0xaa77('0x4b')]);_0x245225[_0xaa77('0x4d')]=_['intersection'](_0x245225[_0xaa77('0x4a')],_0x245225[_0xaa77('0x4b')]);_0x2177e9[_0xaa77('0x4f')]=_[_0xaa77('0x4e')](_0x245225[_0xaa77('0x4a')],qs[_0xaa77('0x50')](_0x4d7f78[_0xaa77('0x4b')][_0xaa77('0x50')]));_0x2177e9[_0xaa77('0x4f')]=_0x2177e9['attributes'][_0xaa77('0x62')]?_0x2177e9[_0xaa77('0x4f')]:_0x245225[_0xaa77('0x4a')];if(_0x4d7f78[_0xaa77('0x4b')][_0xaa77('0x5d')]){_0x2177e9['include']=[{'all':!![]}];}_0x2177e9=_['merge']({},_0x2177e9,_0x4d7f78[_0xaa77('0x5b')]);return db['MailAccount'][_0xaa77('0x63')](_0x2177e9)[_0xaa77('0x13')](handleEntityNotFound(_0x56608c,null))[_0xaa77('0x13')](respondWithResult(_0x56608c,null))[_0xaa77('0x1d')](handleError(_0x56608c,null));};exports[_0xaa77('0x64')]=function(_0x42d206,_0x4c8a3f){if(_0x42d206[_0xaa77('0x65')]['id']){delete _0x42d206[_0xaa77('0x65')]['id'];}var _0x50c258=_0x42d206['body'][_0xaa77('0x66')]===_0xaa77('0x67')?null:_0x42d206[_0xaa77('0x65')][_0xaa77('0x66')];var _0x17c28b=_0x42d206[_0xaa77('0x65')][_0xaa77('0x40')]||{};var _0x2beebf=_0x42d206['body'][_0xaa77('0x41')]||{};if(_0x50c258){_0x17c28b['host']=getImapHost(_0x50c258);_0x17c28b[_0xaa77('0x3c')]=0x3e1;_0x2beebf[_0xaa77('0x3b')]=getSmtpHost(_0x50c258);_0x2beebf[_0xaa77('0x3c')]=0x24b;_0x2beebf[_0xaa77('0x3d')]=![];}if(_0x2beebf[_0xaa77('0x38')]){_0x2beebf[_0xaa77('0x3d')]=![];}else{_0x2beebf['CloudProviderId']=null;}if(!_0x17c28b['modernAuthentication'])_0x17c28b[_0xaa77('0x39')]=null;_0x42d206[_0xaa77('0x65')][_0xaa77('0x40')]=_0x17c28b;_0x42d206[_0xaa77('0x65')][_0xaa77('0x41')]=_0x2beebf;return db['MailAccount'][_0xaa77('0x63')]({'where':{'id':_0x42d206['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xaa77('0x40')},{'model':db[_0xaa77('0x44')],'as':_0xaa77('0x41')},{'model':db[_0xaa77('0x45')],'as':'mandatoryDispositionPause'}]})[_0xaa77('0x13')](handleEntityNotFound(_0x4c8a3f,null))[_0xaa77('0x13')](function(_0x31e3da){if(!_0x31e3da)throw new Error(_0xaa77('0x68'));if(_0x31e3da[_0xaa77('0x3e')])delete _0x42d206[_0xaa77('0x65')][_0xaa77('0x40')];return _0x31e3da;})['then'](saveUpdates(_0x42d206['body'],null))[_0xaa77('0x13')](function(_0x4bd79d){if(!_0x42d206['body'][_0xaa77('0x40')])return _0x4bd79d;return db[_0xaa77('0x43')][_0xaa77('0x64')](_0x42d206['body'][_0xaa77('0x40')],{'where':{'MailAccountId':_0x4bd79d['id']}})[_0xaa77('0x13')](function(){return _0x4bd79d;});})[_0xaa77('0x13')](function(_0x52d1c1){if(!_0x42d206[_0xaa77('0x65')]['Smtp'])return _0x52d1c1;return db['MailServerOut']['update'](_0x42d206[_0xaa77('0x65')]['Smtp'],{'where':{'MailAccountId':_0x52d1c1['id']}})[_0xaa77('0x13')](function(){return _0x52d1c1;});})['then'](respondWithResult(_0x4c8a3f,null))[_0xaa77('0x1d')](handleError(_0x4c8a3f,null));};exports[_0xaa77('0x69')]=function(_0x17f389,_0x98bdf9){return db[_0xaa77('0x5c')][_0xaa77('0x69')]()[_0xaa77('0x13')](respondWithResult(_0x98bdf9,null))['catch'](handleError(_0x98bdf9,null));};exports['addDisposition']=function(_0x326314,_0x40e485){if(_0x326314['body']['id']){delete _0x326314[_0xaa77('0x65')]['id'];}return db[_0xaa77('0x5c')][_0xaa77('0x63')]({'where':{'id':_0x326314[_0xaa77('0x61')]['id']}})[_0xaa77('0x13')](handleEntityNotFound(_0x40e485,null))[_0xaa77('0x13')](function(_0x2c6b7f){if(_0x2c6b7f){_0x326314[_0xaa77('0x65')]['MailAccountId']=_0x2c6b7f['id'];return db[_0xaa77('0x6a')][_0xaa77('0x6b')](_0x326314[_0xaa77('0x65')]);}})[_0xaa77('0x13')](respondWithResult(_0x40e485,null))[_0xaa77('0x1d')](handleError(_0x40e485,null));};exports[_0xaa77('0x6c')]=function(_0x45e799,_0x526e27){var _0x1ac9be={'raw':![],'where':{}};var _0x5f5ded={};var _0x3563db={'count':0x0,'rows':[]};return db[_0xaa77('0x5c')][_0xaa77('0x6d')]({'where':{'id':_0x45e799['params']['id']}})[_0xaa77('0x13')](handleEntityNotFound(_0x526e27,null))[_0xaa77('0x13')](function(_0x2fb00b){if(_0x2fb00b){_0x5f5ded['model']=_[_0xaa77('0x4c')](db[_0xaa77('0x6a')][_0xaa77('0x47')]);_0x5f5ded[_0xaa77('0x4b')]=_[_0xaa77('0x4c')](_0x45e799['query']);_0x5f5ded['filters']=_['intersection'](_0x5f5ded[_0xaa77('0x4a')],_0x5f5ded[_0xaa77('0x4b')]);_0x1ac9be[_0xaa77('0x4f')]=_['intersection'](_0x5f5ded[_0xaa77('0x4a')],qs[_0xaa77('0x50')](_0x45e799[_0xaa77('0x4b')][_0xaa77('0x50')]));_0x1ac9be['attributes']=_0x1ac9be['attributes'][_0xaa77('0x62')]?_0x1ac9be[_0xaa77('0x4f')]:_0x5f5ded[_0xaa77('0x4a')];if(!_0x45e799['query']['hasOwnProperty']('nolimit')){_0x1ac9be['limit']=qs[_0xaa77('0x23')](_0x45e799[_0xaa77('0x4b')][_0xaa77('0x23')]);_0x1ac9be['offset']=qs[_0xaa77('0x21')](_0x45e799['query'][_0xaa77('0x21')]);}_0x1ac9be['order']=qs['sort'](_0x45e799[_0xaa77('0x4b')][_0xaa77('0x54')]);_0x1ac9be[_0xaa77('0x55')]=qs[_0xaa77('0x4d')](_[_0xaa77('0x56')](_0x45e799[_0xaa77('0x4b')],_0x5f5ded['filters']));_0x1ac9be['where'][_0xaa77('0x6e')]=_0x2fb00b['id'];if(_0x45e799[_0xaa77('0x4b')][_0xaa77('0x57')]){_0x1ac9be[_0xaa77('0x55')]=_[_0xaa77('0x58')](_0x1ac9be['where'],{'$or':_[_0xaa77('0x59')](_0x1ac9be['attributes'],function(_0x5b7253){var _0x5603f4={};_0x5603f4[_0x5b7253]={'$like':'%'+_0x45e799[_0xaa77('0x4b')][_0xaa77('0x57')]+'%'};return _0x5603f4;})});}_0x1ac9be=_['merge']({},_0x1ac9be,_0x45e799[_0xaa77('0x5b')]);return db[_0xaa77('0x6a')]['count']({'where':_0x1ac9be[_0xaa77('0x55')]})['then'](function(_0x50d743){_0x3563db[_0xaa77('0x24')]=_0x50d743;if(_0x45e799[_0xaa77('0x4b')][_0xaa77('0x5d')]){_0x1ac9be[_0xaa77('0x5e')]=[{'all':!![]}];}return db[_0xaa77('0x6a')]['findAll'](_0x1ac9be);})[_0xaa77('0x13')](function(_0x556b6e){_0x3563db[_0xaa77('0x60')]=_0x556b6e;return _0x3563db;});}})[_0xaa77('0x13')](respondWithFilteredResult(_0x526e27,_0x1ac9be))['catch'](handleError(_0x526e27,null));};exports[_0xaa77('0x6f')]=function(_0x50811d,_0x77b3ad){return db[_0xaa77('0x5c')]['find']({'where':{'id':_0x50811d[_0xaa77('0x61')]['id']}})['then'](handleEntityNotFound(_0x77b3ad,null))[_0xaa77('0x13')](function(_0x5899aa){if(_0x5899aa){return _0x5899aa['removeDispositions'](_0x50811d[_0xaa77('0x4b')][_0xaa77('0x70')]);}})[_0xaa77('0x13')](respondWithStatusCode(_0x77b3ad,null))[_0xaa77('0x1d')](handleError(_0x77b3ad,null));};exports[_0xaa77('0x71')]=function(_0x41fdbb,_0xe88ce9){if(_0x41fdbb[_0xaa77('0x65')]['id']){delete _0x41fdbb[_0xaa77('0x65')]['id'];}return db['MailAccount'][_0xaa77('0x63')]({'where':{'id':_0x41fdbb[_0xaa77('0x61')]['id']}})[_0xaa77('0x13')](handleEntityNotFound(_0xe88ce9,null))[_0xaa77('0x13')](function(_0x510eb4){if(_0x510eb4){_0x41fdbb[_0xaa77('0x65')][_0xaa77('0x6e')]=_0x510eb4['id'];return db['CannedAnswer'][_0xaa77('0x6b')](_0x41fdbb[_0xaa77('0x65')]);}})[_0xaa77('0x13')](respondWithResult(_0xe88ce9,null))[_0xaa77('0x1d')](handleError(_0xe88ce9,null));};exports[_0xaa77('0x72')]=function(_0x16d7cb,_0x29dd7f){var _0x57efc5={'raw':![],'where':{}};var _0x49ae02={};var _0x56e559={'count':0x0,'rows':[]};return db[_0xaa77('0x5c')]['findOne']({'where':{'id':_0x16d7cb[_0xaa77('0x61')]['id']}})[_0xaa77('0x13')](handleEntityNotFound(_0x29dd7f,null))['then'](function(_0x4b4958){if(_0x4b4958){_0x49ae02[_0xaa77('0x4a')]=_[_0xaa77('0x4c')](db[_0xaa77('0x73')][_0xaa77('0x47')]);_0x49ae02[_0xaa77('0x4b')]=_[_0xaa77('0x4c')](_0x16d7cb[_0xaa77('0x4b')]);_0x49ae02[_0xaa77('0x4d')]=_[_0xaa77('0x4e')](_0x49ae02[_0xaa77('0x4a')],_0x49ae02['query']);_0x57efc5[_0xaa77('0x4f')]=_['intersection'](_0x49ae02[_0xaa77('0x4a')],qs[_0xaa77('0x50')](_0x16d7cb['query'][_0xaa77('0x50')]));_0x57efc5[_0xaa77('0x4f')]=_0x57efc5['attributes']['length']?_0x57efc5[_0xaa77('0x4f')]:_0x49ae02[_0xaa77('0x4a')];if(!_0x16d7cb[_0xaa77('0x4b')][_0xaa77('0x51')](_0xaa77('0x52'))){_0x57efc5[_0xaa77('0x23')]=qs[_0xaa77('0x23')](_0x16d7cb['query'][_0xaa77('0x23')]);_0x57efc5['offset']=qs['offset'](_0x16d7cb[_0xaa77('0x4b')]['offset']);}_0x57efc5[_0xaa77('0x53')]=qs[_0xaa77('0x54')](_0x16d7cb[_0xaa77('0x4b')][_0xaa77('0x54')]);_0x57efc5['where']=qs['filters'](_[_0xaa77('0x56')](_0x16d7cb[_0xaa77('0x4b')],_0x49ae02[_0xaa77('0x4d')]));_0x57efc5['where'][_0xaa77('0x6e')]=_0x4b4958['id'];if(_0x16d7cb[_0xaa77('0x4b')]['filter']){_0x57efc5[_0xaa77('0x55')]=_[_0xaa77('0x58')](_0x57efc5[_0xaa77('0x55')],{'$or':_[_0xaa77('0x59')](_0x57efc5[_0xaa77('0x4f')],function(_0x5d3bdc){var _0x99ce85={};_0x99ce85[_0x5d3bdc]={'$like':'%'+_0x16d7cb[_0xaa77('0x4b')]['filter']+'%'};return _0x99ce85;})});}_0x57efc5=_[_0xaa77('0x58')]({},_0x57efc5,_0x16d7cb[_0xaa77('0x5b')]);return db['CannedAnswer'][_0xaa77('0x24')]({'where':_0x57efc5[_0xaa77('0x55')]})['then'](function(_0x6fc291){_0x56e559[_0xaa77('0x24')]=_0x6fc291;if(_0x16d7cb['query'][_0xaa77('0x5d')]){_0x57efc5[_0xaa77('0x5e')]=[{'all':!![]}];}return db[_0xaa77('0x73')][_0xaa77('0x5f')](_0x57efc5);})['then'](function(_0x44e071){_0x56e559[_0xaa77('0x60')]=_0x44e071;return _0x56e559;});}})['then'](respondWithFilteredResult(_0x29dd7f,_0x57efc5))[_0xaa77('0x1d')](handleError(_0x29dd7f,null));};exports['removeAnswers']=function(_0x326c8f,_0x32fc8d){return db['MailAccount'][_0xaa77('0x63')]({'where':{'id':_0x326c8f['params']['id']}})[_0xaa77('0x13')](handleEntityNotFound(_0x32fc8d,null))[_0xaa77('0x13')](function(_0x48bb0f){if(_0x48bb0f){return _0x48bb0f[_0xaa77('0x74')](_0x326c8f[_0xaa77('0x4b')][_0xaa77('0x70')]);}})['then'](respondWithStatusCode(_0x32fc8d,null))[_0xaa77('0x1d')](handleError(_0x32fc8d,null));};exports[_0xaa77('0x6b')]=function(_0x4573d3,_0x33cae4){var _0x2073bf={'name':_0x4573d3[_0xaa77('0x65')]['name'],'key':_0x4573d3[_0xaa77('0x65')][_0xaa77('0x75')],'provider':_0x4573d3[_0xaa77('0x65')][_0xaa77('0x66')]==='custom'?null:_0x4573d3[_0xaa77('0x65')][_0xaa77('0x66')],'email':_0x4573d3['body'][_0xaa77('0x76')],'ListId':_0x4573d3[_0xaa77('0x65')][_0xaa77('0x77')],'active':!_[_0xaa77('0x78')](_0x4573d3[_0xaa77('0x65')]['active'])?_0x4573d3[_0xaa77('0x65')][_0xaa77('0x79')]:!![],'description':_0x4573d3[_0xaa77('0x65')][_0xaa77('0x7a')]||null};var _0x12661e=getAuthenticationOptions(_0x2073bf[_0xaa77('0x66')],_0x4573d3[_0xaa77('0x65')]);_0x2073bf[_0xaa77('0x40')]=_0x12661e['Imap'];_0x2073bf['Smtp']=_0x12661e['Smtp'];return db[_0xaa77('0x5c')][_0xaa77('0x6b')](_0x2073bf,{'include':[{'model':db[_0xaa77('0x44')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0xaa77('0x40')}]})[_0xaa77('0x13')](function(_0x39dc94){var _0x8f5780=_0x4573d3[_0xaa77('0x35')]['get']({'plain':!![]});if(!_0x8f5780)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8f5780['role']===_0xaa77('0x35')){var _0x1f6d45=_0x39dc94[_0xaa77('0x7b')]({'plain':!![]});return db[_0xaa77('0x7c')][_0xaa77('0x63')]({'where':{'name':_0xaa77('0x7d'),'userProfileId':_0x8f5780[_0xaa77('0x7e')]},'raw':!![]})[_0xaa77('0x13')](function(_0x302960){if(_0x302960&&_0x302960['autoAssociation']===0x0){return db[_0xaa77('0x7f')][_0xaa77('0x6b')]({'name':_0x1f6d45[_0xaa77('0x28')],'resourceId':_0x1f6d45['id'],'type':_0x302960['name'],'sectionId':_0x302960['id']},{})[_0xaa77('0x13')](function(){return _0x39dc94;});}else{return _0x39dc94;}})[_0xaa77('0x1d')](function(_0x349919){logger[_0xaa77('0x19')](_0xaa77('0x80'),_0x349919);throw _0x349919;});}return _0x39dc94;})[_0xaa77('0x13')](respondWithResult(_0x33cae4,0xc9))['catch'](handleError(_0x33cae4,null));};exports['getImap']=function(_0x9192b,_0x5c4119){return db[_0xaa77('0x5c')][_0xaa77('0x6d')]({'where':{'id':_0x9192b['params']['id']}})[_0xaa77('0x13')](handleEntityNotFound(_0x5c4119,null))['then'](function(_0x54381b){if(_0x54381b){return _0x54381b[_0xaa77('0x81')]();}return null;})[_0xaa77('0x13')](respondWithResult(_0x5c4119,null))[_0xaa77('0x1d')](handleError(_0x5c4119,null));};exports[_0xaa77('0x82')]=function(_0x3608cd,_0x45b22d){if(_0x3608cd[_0xaa77('0x65')]['id']){delete _0x3608cd[_0xaa77('0x65')]['id'];}return db[_0xaa77('0x5c')][_0xaa77('0x63')]({'where':{'id':_0x3608cd[_0xaa77('0x61')]['id']}})['then'](handleEntityNotFound(_0x45b22d,null))[_0xaa77('0x13')](function(_0xe4d33d){if(_0xe4d33d){_0x3608cd['body']['MailAccountId']=_0xe4d33d['id'];return db['MailServerIn'][_0xaa77('0x6b')](_0x3608cd['body']);}})[_0xaa77('0x13')](respondWithResult(_0x45b22d,null))['catch'](handleError(_0x45b22d,null));};exports['removeImap']=function(_0x2fa616,_0x2107b6){return db[_0xaa77('0x5c')][_0xaa77('0x6d')]({'where':{'id':_0x2fa616[_0xaa77('0x61')]['id']}})['then'](handleEntityNotFound(_0x2107b6,null))[_0xaa77('0x13')](function(_0x2d18fd){if(_0x2d18fd){return _0x2d18fd['setImap'](null);}return null;})[_0xaa77('0x13')](respondWithStatusCode(_0x2107b6,null))[_0xaa77('0x1d')](handleError(_0x2107b6,null));};exports[_0xaa77('0x83')]=function(_0x3e3cf4,_0x2642cc){return db[_0xaa77('0x5c')][_0xaa77('0x6d')]({'where':{'id':_0x3e3cf4[_0xaa77('0x61')]['id']}})['then'](handleEntityNotFound(_0x2642cc,null))[_0xaa77('0x13')](function(_0xd6bc9){if(_0xd6bc9){return _0xd6bc9['getSmtp']();}return null;})[_0xaa77('0x13')](respondWithResult(_0x2642cc,null))[_0xaa77('0x1d')](handleError(_0x2642cc,null));};exports[_0xaa77('0x84')]=function(_0x183111,_0x102294){if(_0x183111['body']['id']){delete _0x183111[_0xaa77('0x65')]['id'];}return db['MailAccount'][_0xaa77('0x63')]({'where':{'id':_0x183111[_0xaa77('0x61')]['id']}})['then'](handleEntityNotFound(_0x102294,null))[_0xaa77('0x13')](function(_0x315ced){if(_0x315ced){_0x183111['body']['MailAccountId']=_0x315ced['id'];return db[_0xaa77('0x44')][_0xaa77('0x6b')](_0x183111[_0xaa77('0x65')]);}})['then'](respondWithResult(_0x102294,null))[_0xaa77('0x1d')](handleError(_0x102294,null));};exports['removeSmtp']=function(_0x2a5005,_0x27ee2e){return db['MailAccount'][_0xaa77('0x6d')]({'where':{'id':_0x2a5005['params']['id']}})[_0xaa77('0x13')](handleEntityNotFound(_0x27ee2e,null))[_0xaa77('0x13')](function(_0x18de16){if(_0x18de16){return _0x18de16[_0xaa77('0x85')](null);}return null;})[_0xaa77('0x13')](respondWithStatusCode(_0x27ee2e,null))['catch'](handleError(_0x27ee2e,null));};exports['addInteraction']=function(_0x2cb322,_0x2bdf76){return db['MailInteraction']['find']({'where':{'id':_0x2cb322[_0xaa77('0x61')]['id']}})[_0xaa77('0x13')](handleEntityNotFound(_0x2bdf76,null))[_0xaa77('0x13')](function(_0x416c11){if(_0x416c11){return _0x416c11[_0xaa77('0x86')](_0x2cb322['body']['ids'],_[_0xaa77('0x87')](_0x2cb322[_0xaa77('0x65')],['ids','id'])||{});}})['then'](respondWithResult(_0x2bdf76,null))[_0xaa77('0x1d')](handleError(_0x2bdf76,null));};exports[_0xaa77('0x88')]=function(_0x1ff734,_0x4ff122){var _0xd283f2={'raw':![],'where':{}};var _0x255676={};var _0x22dac4={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1ff734[_0xaa77('0x61')]['id']}})[_0xaa77('0x13')](handleEntityNotFound(_0x4ff122,null))[_0xaa77('0x13')](function(_0x52c6b6){if(_0x52c6b6){_0x255676['model']=_[_0xaa77('0x4c')](db[_0xaa77('0x89')][_0xaa77('0x47')]);_0x255676[_0xaa77('0x4b')]=_[_0xaa77('0x4c')](_0x1ff734[_0xaa77('0x4b')]);_0x255676['filters']=_['intersection'](_0x255676[_0xaa77('0x4a')],_0x255676['query']);_0xd283f2['attributes']=_['intersection'](_0x255676[_0xaa77('0x4a')],qs['fields'](_0x1ff734[_0xaa77('0x4b')][_0xaa77('0x50')]));_0xd283f2[_0xaa77('0x4f')]=_0xd283f2[_0xaa77('0x4f')][_0xaa77('0x62')]?_0xd283f2[_0xaa77('0x4f')]:_0x255676[_0xaa77('0x4a')];if(!_0x1ff734[_0xaa77('0x4b')][_0xaa77('0x51')](_0xaa77('0x52'))){_0xd283f2[_0xaa77('0x23')]=qs[_0xaa77('0x23')](_0x1ff734[_0xaa77('0x4b')][_0xaa77('0x23')]);_0xd283f2[_0xaa77('0x21')]=qs[_0xaa77('0x21')](_0x1ff734[_0xaa77('0x4b')]['offset']);}_0xd283f2['order']=qs[_0xaa77('0x54')](_0x1ff734[_0xaa77('0x4b')]['sort']);_0xd283f2[_0xaa77('0x55')]=qs[_0xaa77('0x4d')](_[_0xaa77('0x56')](_0x1ff734['query'],_0x255676['filters']));_0xd283f2[_0xaa77('0x55')][_0xaa77('0x6e')]=_0x52c6b6['id'];if(_0x1ff734[_0xaa77('0x4b')]['filter']){_0xd283f2[_0xaa77('0x55')]=_[_0xaa77('0x58')](_0xd283f2[_0xaa77('0x55')],{'$or':_['map'](_0xd283f2['attributes'],function(_0x20b0b1){var _0x2538f7={};_0x2538f7[_0x20b0b1]={'$like':'%'+_0x1ff734[_0xaa77('0x4b')]['filter']+'%'};return _0x2538f7;})});}_0xd283f2=_[_0xaa77('0x58')]({},_0xd283f2,_0x1ff734[_0xaa77('0x5b')]);return db['MailInteraction']['count']({'where':_0xd283f2[_0xaa77('0x55')]})[_0xaa77('0x13')](function(_0x4e6e4f){_0x22dac4[_0xaa77('0x24')]=_0x4e6e4f;if(_0x1ff734[_0xaa77('0x4b')][_0xaa77('0x5d')]){_0xd283f2[_0xaa77('0x5e')]=[{'model':db[_0xaa77('0x8a')],'as':_0xaa77('0x8b'),'required':![]},{'model':db[_0xaa77('0x8c')],'as':_0xaa77('0x8d'),'attributes':[_0xaa77('0x28'),'fullname',_0xaa77('0x8e')],'required':![]},{'model':db[_0xaa77('0x8f')],'as':'Tags','attributes':['id',_0xaa77('0x28'),_0xaa77('0x90')],'where':_0x1ff734[_0xaa77('0x4b')][_0xaa77('0x91')]?{'id':_0x1ff734[_0xaa77('0x4b')]['tag']}:undefined,'required':_0x1ff734[_0xaa77('0x4b')]['tag']?!![]:![]}];}return db[_0xaa77('0x89')]['findAll'](_0xd283f2);})[_0xaa77('0x13')](function(_0x25626c){_0x22dac4[_0xaa77('0x60')]=_0x25626c;return _0x22dac4;});}})['then'](respondWithFilteredResult(_0x4ff122,_0xd283f2))['catch'](handleError(_0x4ff122,null));};exports['addApplications']=function addApplications(_0x4b975b,_0x535ea1){var _0x363471=_0x4b975b[_0xaa77('0x61')]['id'];var _0x279178=_0x4b975b[_0xaa77('0x65')];var _0x1b52f9=0xc8;var _0x1a045a=null;return db['sequelize'][_0xaa77('0x92')]({'isolationLevel':db[_0xaa77('0x93')][_0xaa77('0x94')][_0xaa77('0x95')][_0xaa77('0x96')]},function(_0x40eca6){return db[_0xaa77('0x5c')][_0xaa77('0x6d')]({'where':{'id':_0x363471},'transaction':_0x40eca6})[_0xaa77('0x13')](function(_0xe393e5){if(_0xe393e5){return db[_0xaa77('0x97')]['destroy']({'where':{'MailAccountId':_0x363471},'transaction':_0x40eca6})[_0xaa77('0x13')](function(){var _0x4c2f20=_[_0xaa77('0x59')](_0x279178,function(_0x44087a){_0x44087a['MailAccountId']=_0x363471;return _0x44087a;});return db['MailApplication']['bulkCreate'](_0x4c2f20,{'transaction':_0x40eca6});});}else{_0x1b52f9=0x194;_0x1a045a=[];}});})[_0xaa77('0x13')](function(){if(_0x1b52f9!==0x194){return db[_0xaa77('0x97')][_0xaa77('0x98')]({'where':{'MailAccountId':_0x363471},'order':'priority'})[_0xaa77('0x13')](function(_0x24f89f){_0x1a045a=_0x24f89f;});}})[_0xaa77('0x1d')](function(_0x2ac4a9){_0x1b52f9=0x1f4;logger[_0xaa77('0x19')](_0x2ac4a9[_0xaa77('0x99')]);if(_0x2ac4a9[_0xaa77('0x28')]){delete _0x2ac4a9[_0xaa77('0x28')];}_0x1a045a=_0x2ac4a9;})['finally'](function(){if(_0x1a045a===null){_0x535ea1['sendStatus'](_0x1b52f9);}else{if(_0x1b52f9===0x1f4){_0x535ea1[_0xaa77('0x20')](_0x1b52f9)['send'](_0x1a045a);}else{_0x535ea1['status'](_0x1b52f9)[_0xaa77('0x26')](_0x1a045a);}}});};exports[_0xaa77('0x9a')]=function(_0x1dfd25,_0x32885d){var _0x4ffdbb={};var _0x3e2c17={};var _0x5bd7ab;var _0x339c17;return db[_0xaa77('0x5c')]['findOne']({'where':{'id':_0x1dfd25[_0xaa77('0x61')]['id']}})[_0xaa77('0x13')](handleEntityNotFound(_0x32885d,null))[_0xaa77('0x13')](function(_0x39d0cf){if(_0x39d0cf){_0x5bd7ab=_0x39d0cf;_0x3e2c17[_0xaa77('0x4a')]=_[_0xaa77('0x4c')](db[_0xaa77('0x97')][_0xaa77('0x47')]);_0x3e2c17[_0xaa77('0x4b')]=_[_0xaa77('0x4c')](_0x1dfd25[_0xaa77('0x4b')]);_0x3e2c17[_0xaa77('0x4d')]=_[_0xaa77('0x4e')](_0x3e2c17[_0xaa77('0x4a')],_0x3e2c17[_0xaa77('0x4b')]);_0x4ffdbb[_0xaa77('0x4f')]=_[_0xaa77('0x4e')](_0x3e2c17['model'],qs[_0xaa77('0x50')](_0x1dfd25[_0xaa77('0x4b')][_0xaa77('0x50')]));_0x4ffdbb['attributes']=_0x4ffdbb['attributes'][_0xaa77('0x62')]?_0x4ffdbb['attributes']:_0x3e2c17['model'];_0x4ffdbb[_0xaa77('0x53')]=qs[_0xaa77('0x54')](_0x1dfd25[_0xaa77('0x4b')][_0xaa77('0x54')]);_0x4ffdbb[_0xaa77('0x55')]=qs[_0xaa77('0x4d')](_[_0xaa77('0x56')](_0x1dfd25[_0xaa77('0x4b')],_0x3e2c17[_0xaa77('0x4d')]));if(_0x1dfd25[_0xaa77('0x4b')][_0xaa77('0x57')]){_0x4ffdbb[_0xaa77('0x55')]=_['merge'](_0x4ffdbb[_0xaa77('0x55')],{'$or':_[_0xaa77('0x59')](_0x4ffdbb[_0xaa77('0x4f')],function(_0x2fccf5){var _0x5e5167={};_0x5e5167[_0x2fccf5]={'$like':'%'+_0x1dfd25[_0xaa77('0x4b')]['filter']+'%'};return _0x5e5167;})});}_0x4ffdbb=_[_0xaa77('0x58')]({},_0x4ffdbb,_0x1dfd25[_0xaa77('0x5b')]);return _0x5bd7ab[_0xaa77('0x9a')](_0x4ffdbb);}})[_0xaa77('0x13')](function(_0x37ff79){if(_0x37ff79){_0x339c17=_0x37ff79[_0xaa77('0x62')];if(!_0x1dfd25[_0xaa77('0x4b')][_0xaa77('0x51')]('nolimit')){_0x4ffdbb['limit']=qs['limit'](_0x1dfd25[_0xaa77('0x4b')][_0xaa77('0x23')]);_0x4ffdbb[_0xaa77('0x21')]=qs[_0xaa77('0x21')](_0x1dfd25['query'][_0xaa77('0x21')]);}return _0x5bd7ab['getApplications'](_0x4ffdbb);}})[_0xaa77('0x13')](function(_0x3a45c2){if(_0x3a45c2){return _0x3a45c2?{'count':_0x339c17,'rows':_0x3a45c2}:null;}})[_0xaa77('0x13')](respondWithResult(_0x32885d,null))['catch'](handleError(_0x32885d,null));};exports['getMessages']=function(_0x354af7,_0x38a191){var _0x2c6c8f={'raw':!![],'where':{}};var _0x4de8b0={};var _0x3a0278={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x354af7['params']['id']}})['then'](handleEntityNotFound(_0x38a191,null))['then'](function(_0x542459){if(_0x542459){_0x4de8b0[_0xaa77('0x4a')]=_['keys'](db[_0xaa77('0x9b')]['rawAttributes']);_0x4de8b0[_0xaa77('0x4b')]=_[_0xaa77('0x4c')](_0x354af7[_0xaa77('0x4b')]);_0x4de8b0[_0xaa77('0x4d')]=_[_0xaa77('0x4e')](_0x4de8b0[_0xaa77('0x4a')],_0x4de8b0[_0xaa77('0x4b')]);_0x2c6c8f[_0xaa77('0x4f')]=_['intersection'](_0x4de8b0[_0xaa77('0x4a')],qs[_0xaa77('0x50')](_0x354af7[_0xaa77('0x4b')]['fields']));_0x2c6c8f[_0xaa77('0x4f')]=_0x2c6c8f['attributes'][_0xaa77('0x62')]?_0x2c6c8f['attributes']:_0x4de8b0[_0xaa77('0x4a')];if(!_0x354af7[_0xaa77('0x4b')]['hasOwnProperty'](_0xaa77('0x52'))){_0x2c6c8f[_0xaa77('0x23')]=qs[_0xaa77('0x23')](_0x354af7['query']['limit']);_0x2c6c8f[_0xaa77('0x21')]=qs['offset'](_0x354af7['query'][_0xaa77('0x21')]);}_0x2c6c8f[_0xaa77('0x53')]=qs[_0xaa77('0x54')](_0x354af7['query'][_0xaa77('0x54')]);_0x2c6c8f[_0xaa77('0x55')]=qs[_0xaa77('0x4d')](_[_0xaa77('0x56')](_0x354af7[_0xaa77('0x4b')],_0x4de8b0[_0xaa77('0x4d')]));_0x2c6c8f['where']['MailAccountId']=_0x542459['id'];if(_0x354af7['query'][_0xaa77('0x57')]){_0x2c6c8f[_0xaa77('0x55')]=_[_0xaa77('0x58')](_0x2c6c8f[_0xaa77('0x55')],{'$or':_[_0xaa77('0x59')](_0x2c6c8f[_0xaa77('0x4f')],function(_0x493776){var _0x51a70f={};_0x51a70f[_0x493776]={'$like':'%'+_0x354af7['query'][_0xaa77('0x57')]+'%'};return _0x51a70f;})});}if(_0x354af7[_0xaa77('0x4b')]['$gte']){var _0x2329af=_0x354af7[_0xaa77('0x4b')][_0xaa77('0x9c')][_0xaa77('0x9d')](',');var _0x4b5671={};_0x4b5671[_0x2329af[0x0]]={'$gte':moment(_0x2329af[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2c6c8f[_0xaa77('0x55')]=_[_0xaa77('0x58')](_0x2c6c8f['where'],_0x4b5671);}_0x2c6c8f=_[_0xaa77('0x58')]({},_0x2c6c8f,_0x354af7[_0xaa77('0x5b')]);return db[_0xaa77('0x9b')]['count']({'where':_0x2c6c8f[_0xaa77('0x55')]})[_0xaa77('0x13')](function(_0x5b63c9){_0x3a0278[_0xaa77('0x24')]=_0x5b63c9;if(_0x354af7[_0xaa77('0x4b')][_0xaa77('0x5d')]){_0x2c6c8f['include']=[{'all':!![]}];}return db[_0xaa77('0x9b')][_0xaa77('0x5f')](_0x2c6c8f);})['then'](function(_0x4936b5){if(_0x354af7['query'][_0xaa77('0x9e')]===_0xaa77('0x9f')){for(var _0x3723eb=0x0;_0x3723eb<_0x4936b5[_0xaa77('0x62')];_0x3723eb++){_0x4936b5[_0x3723eb][_0xaa77('0x65')]=juice(_0x4936b5[_0x3723eb][_0xaa77('0x65')]);}}_0x3a0278['rows']=_0x4936b5;return _0x3a0278;});}})[_0xaa77('0x13')](respondWithFilteredResult(_0x38a191,_0x2c6c8f))[_0xaa77('0x1d')](handleError(_0x38a191,null));};exports['send']=function(_0x45cd5f,_0x4fc18d){var _0x2c2e73,_0x104efd={},_0x4c3412;if(_0x45cd5f[_0xaa77('0x65')]['to']){_0x4c3412=_0x45cd5f[_0xaa77('0x65')]['to'][_0xaa77('0x9d')](',')[0x0];}return db[_0xaa77('0x5c')][_0xaa77('0x63')]({'where':{'id':_0x45cd5f[_0xaa77('0x61')]['id']},'include':[{'model':db[_0xaa77('0xa0')],'as':_0xaa77('0xa1'),'include':[{'model':db[_0xaa77('0x8a')],'as':_0xaa77('0xa2'),'where':{'email':_0x4c3412},'limit':0x1,'order':[[_0xaa77('0xa3'),_0xaa77('0xa4')]]}]},{'model':db['MailServerOut'],'as':_0xaa77('0x41'),'raw':!![],'include':[{'model':db[_0xaa77('0xa5')],'as':_0xaa77('0xa5'),'raw':!![]}]}]})[_0xaa77('0x13')](handleEntityNotFound(_0x4fc18d,null))[_0xaa77('0x13')](function(_0x442a17){if(!_0x442a17)return;_0x2c2e73=_0x442a17;if(!_0x442a17[_0xaa77('0x41')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x45cd5f[_0xaa77('0x65')]['from'])){_0x45cd5f[_0xaa77('0x65')][_0xaa77('0xa6')]=util['format'](_0xaa77('0xa7'),_0x442a17['name'],_0x442a17['email']||_0x442a17[_0xaa77('0x41')][_0xaa77('0x35')]);}if(_0x45cd5f[_0xaa77('0x65')][_0xaa77('0xa8')]&&_0x45cd5f[_0xaa77('0x65')][_0xaa77('0xa8')]['length']){for(var _0x2cc226=0x0;_0x2cc226<_0x45cd5f['body']['attachments'][_0xaa77('0x62')];_0x2cc226+=0x1){_0x45cd5f[_0xaa77('0x65')][_0xaa77('0xa8')][_0x2cc226]={'filename':_0x45cd5f[_0xaa77('0x65')][_0xaa77('0xa8')][_0x2cc226][_0xaa77('0x28')],'path':path[_0xaa77('0xa9')](config[_0xaa77('0xaa')],'server/files/attachments',_0x45cd5f['body'][_0xaa77('0xa8')][_0x2cc226][_0xaa77('0xab')])};}}var _0x5766bc=_0x442a17[_0xaa77('0xac')]();return respondWithRpcPromise(_0xaa77('0xad'),_0xaa77('0xae'),{'account':_0x5766bc,'message':_0x45cd5f['body']});})[_0xaa77('0x13')](function(_0x286579){if(!_0x286579)return;_0x104efd=_0x286579;if(!_0x2c2e73[_0xaa77('0xa1')])throw new Error('List\x20not\x20found');if(_0x2c2e73[_0xaa77('0xa1')][_0xaa77('0xa2')]['length'])return _0x2c2e73[_0xaa77('0xa1')][_0xaa77('0xa2')][0x0];return db[_0xaa77('0x8a')][_0xaa77('0x6b')](_['defaults'](_0x45cd5f[_0xaa77('0x65')],{'firstName':_0x45cd5f[_0xaa77('0x65')]['to'],'email':_0x45cd5f[_0xaa77('0x65')]['to'],'phone':_0x45cd5f[_0xaa77('0x65')]['to'],'ListId':_0x2c2e73[_0xaa77('0x77')]}));})[_0xaa77('0x13')](function(_0x14fb20){if(!_0x14fb20)return;var _0x4ff43f={'UserId':_0x45cd5f[_0xaa77('0x35')]['id'],'ContactId':_0x14fb20['id'],'MailAccountId':_0x2c2e73['id'],'inReplyTo':_0x104efd[_0xaa77('0xaf')],'to':_0x45cd5f[_0xaa77('0x65')][_0xaa77('0xa6')],'cc':_0x45cd5f['body']['cc'],'subject':_0x45cd5f['body']['subject'],'attach':_0x45cd5f['body']['attach'],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0xaa77('0xb0')),'lastMsgDirection':_0xaa77('0xb1'),'Messages':[_[_0xaa77('0x58')](_0x45cd5f[_0xaa77('0x65')],{'messageId':_0x104efd[_0xaa77('0xaf')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x2c2e73['id'],'UserId':_0x45cd5f[_0xaa77('0x35')]['id'],'ContactId':_0x14fb20['id']})]};if(_0x45cd5f['body']['Interaction']){_0x4ff43f=_[_0xaa77('0x58')](_0x4ff43f,_0x45cd5f['body']['Interaction']);}return db['MailInteraction']['create'](_0x4ff43f,{'include':[{'model':db[_0xaa77('0x9b')],'as':_0xaa77('0xb2')}]});})[_0xaa77('0x13')](respondWithResult(_0x4fc18d,null))['catch'](handleError(_0x4fc18d,null));};exports[_0xaa77('0xb3')]=function(_0x44763b,_0x1b788d){return db[_0xaa77('0x5c')][_0xaa77('0x63')]({'where':{'id':_0x44763b[_0xaa77('0x61')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xaa77('0x41'),'raw':!![],'include':[{'model':db[_0xaa77('0xa5')],'as':_0xaa77('0xa5'),'raw':!![]}]}]})[_0xaa77('0x13')](handleEntityNotFound(_0x1b788d,null))[_0xaa77('0x13')](function(_0x55ec6b){if(!_0x55ec6b[_0xaa77('0x41')])return;var _0x7da491=_0x55ec6b[_0xaa77('0xac')]();return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x7da491});})[_0xaa77('0x13')](respondWithResult(_0x1b788d,null))['catch'](handleError(_0x1b788d,null));};exports[_0xaa77('0x27')]=function(_0x2c5772,_0x336f4d){return db['MailAccount'][_0xaa77('0x63')]({'where':{'id':_0x2c5772[_0xaa77('0x61')]['id']}})[_0xaa77('0x13')](handleEntityNotFound(_0x336f4d,null))[_0xaa77('0x13')](function(_0x1e5d3a){if(_0x1e5d3a&&_0x1e5d3a[_0xaa77('0x3e')]){throw new db[(_0xaa77('0xb4'))][(_0xaa77('0xb5'))](_0xaa77('0xb6'));}return _0x1e5d3a;})[_0xaa77('0x13')](removeEntity(_0x336f4d,null))[_0xaa77('0x1d')](handleError(_0x336f4d,null));};exports[_0xaa77('0xb7')]=function(_0x52f015,_0x4319b8){return db[_0xaa77('0x5c')][_0xaa77('0x63')]({'where':{'id':_0x52f015[_0xaa77('0x61')]['id']}})[_0xaa77('0x13')](handleEntityNotFound(_0x4319b8,null))[_0xaa77('0x13')](function(_0x309a70){if(_0x309a70){return _0x309a70[_0xaa77('0xb7')](_0x52f015[_0xaa77('0x65')][_0xaa77('0x70')],_[_0xaa77('0x87')](_0x52f015['body'],[_0xaa77('0x70'),'id'])||{})['spread'](function(_0x398ee3){for(var _0x227325=0x0;_0x227325<_0x52f015[_0xaa77('0x65')][_0xaa77('0x70')][_0xaa77('0x62')];_0x227325+=0x1){socket[_0xaa77('0xb8')](_0xaa77('0xb9'),{'UserId':Number(_0x52f015['body'][_0xaa77('0x70')][_0x227325]),'MailAccountId':Number(_0x52f015[_0xaa77('0x61')]['id'])});}return _0x398ee3;});}})[_0xaa77('0x13')](respondWithResult(_0x4319b8,null))[_0xaa77('0x1d')](handleError(_0x4319b8,null));};exports[_0xaa77('0xba')]=function(_0x838821,_0x475b55){return db[_0xaa77('0x5c')][_0xaa77('0x63')]({'where':{'id':_0x838821[_0xaa77('0x61')]['id']}})[_0xaa77('0x13')](handleEntityNotFound(_0x475b55,null))[_0xaa77('0x13')](function(_0x5ebab9){if(_0x5ebab9){return _0x5ebab9[_0xaa77('0xba')](_0x838821[_0xaa77('0x4b')][_0xaa77('0x70')])[_0xaa77('0x13')](function(){if(_['isArray'](_0x838821[_0xaa77('0x4b')][_0xaa77('0x70')])){for(var _0x3d7559=0x0;_0x3d7559<_0x838821[_0xaa77('0x4b')][_0xaa77('0x70')][_0xaa77('0x62')];_0x3d7559+=0x1){socket['emit'](_0xaa77('0xbb'),{'UserId':Number(_0x838821[_0xaa77('0x4b')]['ids'][_0x3d7559]),'MailAccountId':Number(_0x838821[_0xaa77('0x61')]['id'])});}}else{socket[_0xaa77('0xb8')](_0xaa77('0xbb'),{'UserId':Number(_0x838821[_0xaa77('0x4b')][_0xaa77('0x70')]),'MailAccountId':Number(_0x838821[_0xaa77('0x61')]['id'])});}});}})[_0xaa77('0x13')](respondWithStatusCode(_0x475b55,null))[_0xaa77('0x1d')](handleError(_0x475b55,null));};exports[_0xaa77('0xbc')]=function(_0x424af3,_0x2c9e83){var _0xe4b806={};var _0x968ee1={};var _0x368184;var _0x345efe;return db['MailAccount'][_0xaa77('0x6d')]({'where':{'id':_0x424af3['params']['id']}})[_0xaa77('0x13')](handleEntityNotFound(_0x2c9e83,null))[_0xaa77('0x13')](function(_0x24859b){if(_0x24859b){_0x368184=_0x24859b;_0x968ee1[_0xaa77('0x4a')]=_['keys'](db['User']['rawAttributes']);_0x968ee1[_0xaa77('0x4b')]=_[_0xaa77('0x4c')](_0x424af3[_0xaa77('0x4b')]);_0x968ee1[_0xaa77('0x4d')]=_['intersection'](_0x968ee1[_0xaa77('0x4a')],_0x968ee1['query']);_0xe4b806[_0xaa77('0x4f')]=_[_0xaa77('0x4e')](_0x968ee1[_0xaa77('0x4a')],qs[_0xaa77('0x50')](_0x424af3[_0xaa77('0x4b')][_0xaa77('0x50')]));_0xe4b806[_0xaa77('0x4f')]=_0xe4b806[_0xaa77('0x4f')][_0xaa77('0x62')]?_0xe4b806[_0xaa77('0x4f')]:_0x968ee1[_0xaa77('0x4a')];_0xe4b806[_0xaa77('0x53')]=qs[_0xaa77('0x54')](_0x424af3[_0xaa77('0x4b')][_0xaa77('0x54')]);_0xe4b806['where']=qs[_0xaa77('0x4d')](_[_0xaa77('0x56')](_0x424af3[_0xaa77('0x4b')],_0x968ee1[_0xaa77('0x4d')]));if(_0x424af3['query'][_0xaa77('0x57')]){_0xe4b806[_0xaa77('0x55')]=_[_0xaa77('0x58')](_0xe4b806[_0xaa77('0x55')],{'$or':_[_0xaa77('0x59')](_0xe4b806['attributes'],function(_0x2ff5a0){var _0x5510f0={};_0x5510f0[_0x2ff5a0]={'$like':'%'+_0x424af3['query']['filter']+'%'};return _0x5510f0;})});}_0xe4b806=_[_0xaa77('0x58')]({},_0xe4b806,_0x424af3[_0xaa77('0x5b')]);return _0x368184[_0xaa77('0xbc')](_0xe4b806);}})[_0xaa77('0x13')](function(_0x251784){if(_0x251784){_0x345efe=_0x251784['length'];if(!_0x424af3[_0xaa77('0x4b')][_0xaa77('0x51')]('nolimit')){_0xe4b806[_0xaa77('0x23')]=qs[_0xaa77('0x23')](_0x424af3[_0xaa77('0x4b')][_0xaa77('0x23')]);_0xe4b806[_0xaa77('0x21')]=qs[_0xaa77('0x21')](_0x424af3['query'][_0xaa77('0x21')]);}return _0x368184['getAgents'](_0xe4b806);}})[_0xaa77('0x13')](function(_0x95ec6b){if(_0x95ec6b){return _0x95ec6b?{'count':_0x345efe,'rows':_0x95ec6b}:null;}})['then'](respondWithResult(_0x2c9e83,null))[_0xaa77('0x1d')](handleError(_0x2c9e83,null));};
\ No newline at end of file
+var _0xfbba=['Unknown\x20email\x20service\x20provider','user','password','pass','modernAuthentication','CloudProviderId','port','host','service','authentication','username','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','body','provider','custom','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','ids','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','finally','getApplications','MailMessage','$gte','split','inlineCss','true','send','CmList','List','Contacts','updatedAt','DESC','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','getSmtpOptions','SendMail','messageId','subject','attach','out','format','YYYY-MM-DD\x20HH:mm:ss','Interaction','verifySmtp','CloudProvider','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','emit','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailAccount,\x20%s,\x20%s','result','catch','sendStatus','status','undefined','count','offset','set','json','update','destroy','get','MailAccounts','end','stack','name','gmail','imap.mail.yahoo.com','outlook365','outlook.office365.com','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','smtp.office365.com'];(function(_0x34e29e,_0x10abaa){var _0x2f2219=function(_0x3bf1b2){while(--_0x3bf1b2){_0x34e29e['push'](_0x34e29e['shift']());}};_0x2f2219(++_0x10abaa);}(_0xfbba,0x91));var _0xafbb=function(_0x30817c,_0x1edf13){_0x30817c=_0x30817c-0x0;var _0x35c365=_0xfbba[_0x30817c];return _0x35c365;};'use strict';var moment=require(_0xafbb('0x0'));var BPromise=require(_0xafbb('0x1'));var util=require('util');var path=require(_0xafbb('0x2'));var _=require(_0xafbb('0x3'));var juice=require(_0xafbb('0x4'));var Redis=require(_0xafbb('0x5'));var qs=require(_0xafbb('0x6'));var logger=require(_0xafbb('0x7'))('api');var config=require('../../config/environment');var db=require(_0xafbb('0x8'))['db'];config[_0xafbb('0x9')]=_['defaults'](config[_0xafbb('0x9')],{'host':_0xafbb('0xa'),'port':0x18eb});var socket=require(_0xafbb('0xb'))(new Redis(config[_0xafbb('0x9')]));require(_0xafbb('0xc'))['register'](socket);var jayson=require(_0xafbb('0xd'));var client=jayson[_0xafbb('0xe')][_0xafbb('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x2e8d07,_0x9939c0,_0x46d889,_0x5becae){return new BPromise(function(_0x3f14dc,_0xc7c938){var _0x17464e=_0x5becae||client;return _0x17464e[_0xafbb('0x10')](_0x2e8d07,_0x46d889)[_0xafbb('0x11')](function(_0x4f20d5){logger[_0xafbb('0x12')]('MailAccount,\x20%s,\x20%s',_0x9939c0,_0xafbb('0x13'));logger[_0xafbb('0x14')](_0xafbb('0x15'),_0x9939c0,'request\x20sent',JSON[_0xafbb('0x16')](_0x4f20d5));if(_0x4f20d5[_0xafbb('0x17')]){if(_0x4f20d5['error'][_0xafbb('0x18')]===0x1f4){logger[_0xafbb('0x17')]('MailAccount,\x20%s,\x20%s',_0x9939c0,_0x4f20d5[_0xafbb('0x17')][_0xafbb('0x19')]);return _0xc7c938(_0x4f20d5[_0xafbb('0x17')][_0xafbb('0x19')]);}logger['error'](_0xafbb('0x1a'),_0x9939c0,_0x4f20d5[_0xafbb('0x17')]['message']);return _0x3f14dc(_0x4f20d5[_0xafbb('0x17')][_0xafbb('0x19')]);}else{logger['info'](_0xafbb('0x1a'),_0x9939c0,_0xafbb('0x13'));_0x3f14dc(_0x4f20d5[_0xafbb('0x1b')][_0xafbb('0x19')]);}})[_0xafbb('0x1c')](function(_0x4364d9){logger[_0xafbb('0x17')](_0xafbb('0x1a'),_0x9939c0,_0x4364d9);_0xc7c938(_0x4364d9);});});}function respondWithStatusCode(_0x551899,_0x30983a){_0x30983a=_0x30983a||0xcc;return function(_0x36b9f3){if(_0x36b9f3){return _0x551899[_0xafbb('0x1d')](_0x30983a);}return _0x551899['status'](_0x30983a)['end']();};}function respondWithResult(_0x5512ee,_0x34601c){_0x34601c=_0x34601c||0xc8;return function(_0xfe9973){if(_0xfe9973){return _0x5512ee[_0xafbb('0x1e')](_0x34601c)['json'](_0xfe9973);}};}function respondWithFilteredResult(_0x20dfce,_0x5dda92){return function(_0xf6663c){if(_0xf6663c){var _0x10f19e=typeof _0x5dda92['offset']===_0xafbb('0x1f')&&typeof _0x5dda92['limit']==='undefined';var _0xf7479f=_0xf6663c[_0xafbb('0x20')];var _0x1004a4=_0x10f19e?0x0:_0x5dda92['offset'];var _0x51123b=_0x10f19e?_0xf6663c[_0xafbb('0x20')]:_0x5dda92[_0xafbb('0x21')]+_0x5dda92['limit'];var _0x2ed53e;if(_0x51123b>=_0xf7479f){_0x51123b=_0xf7479f;_0x2ed53e=0xc8;}else{_0x2ed53e=0xce;}_0x20dfce[_0xafbb('0x1e')](_0x2ed53e);return _0x20dfce[_0xafbb('0x22')]('Content-Range',_0x1004a4+'-'+_0x51123b+'/'+_0xf7479f)[_0xafbb('0x23')](_0xf6663c);}return null;};}function saveUpdates(_0x4fef6d){return function(_0x5a1da9){if(_0x5a1da9){return _0x5a1da9[_0xafbb('0x24')](_0x4fef6d)['then'](function(_0x318693){return _0x318693;});}return null;};}function removeEntity(_0x4e80c9){return function(_0x11466b){if(_0x11466b){return _0x11466b[_0xafbb('0x25')]()[_0xafbb('0x11')](function(){var _0x4c797f=_0x11466b[_0xafbb('0x26')]({'plain':!![]});var _0x4811f7=_0xafbb('0x27');return db['UserProfileResource'][_0xafbb('0x25')]({'where':{'type':_0x4811f7,'resourceId':_0x4c797f['id']}})['then'](function(){return _0x11466b;});})[_0xafbb('0x11')](function(){_0x4e80c9['status'](0xcc)[_0xafbb('0x28')]();});}};}function handleEntityNotFound(_0x4e7c68){return function(_0x495116){if(!_0x495116){_0x4e7c68['sendStatus'](0x194);}return _0x495116;};}function handleError(_0x53704b,_0x23e440){_0x23e440=_0x23e440||0x1f4;return function(_0x185a21){logger[_0xafbb('0x17')](_0x185a21[_0xafbb('0x29')]);if(_0x185a21[_0xafbb('0x2a')]){delete _0x185a21[_0xafbb('0x2a')];}_0x53704b[_0xafbb('0x1e')](_0x23e440)['send'](_0x185a21);};}function getImapHost(_0x339114){switch(_0x339114){case _0xafbb('0x2b'):return'imap.gmail.com';case'yahoo':return _0xafbb('0x2c');case'hotmail':return'imap-mail.outlook.com';case _0xafbb('0x2d'):return _0xafbb('0x2e');}throw new Error('Unknown\x20email\x20service\x20provider',_0x339114);}function getSmtpHost(_0x2bb4bf){switch(_0x2bb4bf){case _0xafbb('0x2b'):return _0xafbb('0x2f');case _0xafbb('0x30'):return _0xafbb('0x31');case _0xafbb('0x32'):return _0xafbb('0x33');case'outlook365':return _0xafbb('0x34');}throw new Error(_0xafbb('0x35'),_0x2bb4bf);}function getAuthenticationOptions(_0x1b248c,_0x28a4fc){var _0x432b7a={};var _0x200784={};if(_0x1b248c){_0x432b7a[_0xafbb('0x36')]=_0x200784[_0xafbb('0x36')]=_0x28a4fc['username'];_0x432b7a[_0xafbb('0x37')]=_0x200784[_0xafbb('0x38')]=_0x28a4fc['password'];if(_0x28a4fc['modernAuthentication']){_0x432b7a[_0xafbb('0x39')]=_0x200784['modernAuthentication']=!![];_0x432b7a[_0xafbb('0x3a')]=_0x200784['CloudProviderId']=_0x28a4fc[_0xafbb('0x3a')];_0x432b7a['password']=_0x200784[_0xafbb('0x38')]=null;}else{_0x432b7a[_0xafbb('0x3a')]=_0x200784[_0xafbb('0x3a')]=null;}_0x432b7a['host']=getImapHost(_0x1b248c);_0x432b7a[_0xafbb('0x3b')]=0x3e1;_0x200784[_0xafbb('0x3c')]=getSmtpHost(_0x1b248c);_0x200784['port']=0x24b;_0x200784['secure']=![];_0x432b7a[_0xafbb('0x3d')]=_0x200784[_0xafbb('0x3d')]=null;}else{if(_0x28a4fc[_0xafbb('0x3e')]){_0x432b7a[_0xafbb('0x36')]=_0x200784['user']=_0x28a4fc[_0xafbb('0x3f')];_0x432b7a[_0xafbb('0x37')]=_0x200784[_0xafbb('0x38')]=_0x28a4fc[_0xafbb('0x37')];}else{_0x432b7a['authentication']=_0x200784[_0xafbb('0x3e')]=![];_0x432b7a[_0xafbb('0x36')]=_0x200784['user']=null;_0x432b7a['password']=_0x200784[_0xafbb('0x38')]=null;}_0x432b7a[_0xafbb('0x3c')]=_0x28a4fc[_0xafbb('0x40')][_0xafbb('0x3c')];_0x432b7a[_0xafbb('0x3b')]=_0x28a4fc['Imap'][_0xafbb('0x3b')];_0x200784['host']=_0x28a4fc[_0xafbb('0x41')]['host'];_0x200784[_0xafbb('0x3b')]=_0x28a4fc[_0xafbb('0x41')][_0xafbb('0x3b')];}return{'Imap':_0x432b7a,'Smtp':_0x200784};}exports['index']=function(_0x5ae39a,_0x2f4a83){var _0x5bf80e={'include':[{'model':db[_0xafbb('0x42')],'as':_0xafbb('0x40')},{'model':db[_0xafbb('0x43')],'as':_0xafbb('0x41')},{'model':db[_0xafbb('0x44')],'as':_0xafbb('0x45')}]},_0x5919b8={},_0x133903={'count':0x0,'rows':[]};var _0x1fade5=_[_0xafbb('0x46')](db[_0xafbb('0x47')][_0xafbb('0x48')],function(_0x27661f){return{'name':_0x27661f[_0xafbb('0x49')],'type':_0x27661f[_0xafbb('0x4a')][_0xafbb('0x4b')]};});_0x5919b8[_0xafbb('0x4c')]=_[_0xafbb('0x46')](_0x1fade5,_0xafbb('0x2a'));_0x5919b8[_0xafbb('0x4d')]=_['keys'](_0x5ae39a[_0xafbb('0x4d')]);_0x5919b8[_0xafbb('0x4e')]=_[_0xafbb('0x4f')](_0x5919b8['model'],_0x5919b8[_0xafbb('0x4d')]);_0x5bf80e[_0xafbb('0x50')]=_[_0xafbb('0x4f')](_0x5919b8[_0xafbb('0x4c')],qs[_0xafbb('0x51')](_0x5ae39a[_0xafbb('0x4d')][_0xafbb('0x51')]));_0x5bf80e[_0xafbb('0x50')]=_0x5bf80e[_0xafbb('0x50')][_0xafbb('0x52')]?_0x5bf80e[_0xafbb('0x50')]:_0x5919b8[_0xafbb('0x4c')];if(!_0x5ae39a[_0xafbb('0x4d')]['hasOwnProperty']('nolimit')){_0x5bf80e['limit']=qs['limit'](_0x5ae39a[_0xafbb('0x4d')][_0xafbb('0x53')]);_0x5bf80e['offset']=qs['offset'](_0x5ae39a[_0xafbb('0x4d')]['offset']);}_0x5bf80e[_0xafbb('0x54')]=qs['sort'](_0x5ae39a[_0xafbb('0x4d')][_0xafbb('0x55')]);_0x5bf80e[_0xafbb('0x56')]=qs['filters'](_[_0xafbb('0x57')](_0x5ae39a[_0xafbb('0x4d')],_0x5919b8['filters']),_0x1fade5);if(_0x5ae39a[_0xafbb('0x4d')]['filter']){_0x5bf80e['where']=_['merge'](_0x5bf80e['where'],{'$or':_['map'](_0x1fade5,function(_0x4d0328){if(_0x4d0328[_0xafbb('0x4a')]!==_0xafbb('0x58')){var _0x933ebb={};_0x933ebb[_0x4d0328[_0xafbb('0x2a')]]={'$like':'%'+_0x5ae39a[_0xafbb('0x4d')][_0xafbb('0x59')]+'%'};return _0x933ebb;}})});}_0x5bf80e=_[_0xafbb('0x5a')]({},_0x5bf80e,_0x5ae39a[_0xafbb('0x5b')]);var _0x17edd0={'where':_0x5bf80e[_0xafbb('0x56')]};return db[_0xafbb('0x47')][_0xafbb('0x20')](_0x17edd0)[_0xafbb('0x11')](function(_0x1b592d){_0x133903[_0xafbb('0x20')]=_0x1b592d;if(_0x5ae39a['query'][_0xafbb('0x5c')]){_0x5bf80e[_0xafbb('0x5d')]=[{'all':!![]}];}return db[_0xafbb('0x47')][_0xafbb('0x5e')](_0x5bf80e);})['then'](function(_0x332211){_0x133903[_0xafbb('0x5f')]=_0x332211;return _0x133903;})[_0xafbb('0x11')](respondWithFilteredResult(_0x2f4a83,_0x5bf80e))['catch'](handleError(_0x2f4a83,null));};exports[_0xafbb('0x60')]=function(_0xb066a5,_0x11f325){var _0x99c2f={'raw':![],'where':{'id':_0xb066a5[_0xafbb('0x61')]['id']},'include':[{'model':db[_0xafbb('0x42')],'as':_0xafbb('0x40')},{'model':db[_0xafbb('0x43')],'as':'Smtp'},{'model':db['Pause'],'as':_0xafbb('0x45')}]},_0x4e2a26={};_0x4e2a26[_0xafbb('0x4c')]=_['keys'](db[_0xafbb('0x47')][_0xafbb('0x48')]);_0x4e2a26['query']=_[_0xafbb('0x62')](_0xb066a5['query']);_0x4e2a26[_0xafbb('0x4e')]=_[_0xafbb('0x4f')](_0x4e2a26[_0xafbb('0x4c')],_0x4e2a26['query']);_0x99c2f[_0xafbb('0x50')]=_[_0xafbb('0x4f')](_0x4e2a26['model'],qs[_0xafbb('0x51')](_0xb066a5[_0xafbb('0x4d')]['fields']));_0x99c2f[_0xafbb('0x50')]=_0x99c2f[_0xafbb('0x50')][_0xafbb('0x52')]?_0x99c2f['attributes']:_0x4e2a26[_0xafbb('0x4c')];if(_0xb066a5[_0xafbb('0x4d')]['includeAll']){_0x99c2f[_0xafbb('0x5d')]=[{'all':!![]}];}_0x99c2f=_[_0xafbb('0x5a')]({},_0x99c2f,_0xb066a5['options']);return db[_0xafbb('0x47')][_0xafbb('0x63')](_0x99c2f)['then'](handleEntityNotFound(_0x11f325,null))[_0xafbb('0x11')](respondWithResult(_0x11f325,null))['catch'](handleError(_0x11f325,null));};exports['update']=function(_0x271dc1,_0xccf9dc){if(_0x271dc1[_0xafbb('0x64')]['id']){delete _0x271dc1[_0xafbb('0x64')]['id'];}var _0x46a2af=_0x271dc1[_0xafbb('0x64')][_0xafbb('0x65')]===_0xafbb('0x66')?null:_0x271dc1[_0xafbb('0x64')][_0xafbb('0x65')];var _0x35ade8=_0x271dc1[_0xafbb('0x64')][_0xafbb('0x40')]||{};var _0x1395a4=_0x271dc1['body'][_0xafbb('0x41')]||{};if(_0x46a2af){_0x35ade8[_0xafbb('0x3c')]=getImapHost(_0x46a2af);_0x35ade8['port']=0x3e1;_0x1395a4[_0xafbb('0x3c')]=getSmtpHost(_0x46a2af);_0x1395a4['port']=0x24b;_0x1395a4[_0xafbb('0x67')]=![];}if(_0x1395a4[_0xafbb('0x39')]){_0x1395a4[_0xafbb('0x67')]=![];}else{_0x1395a4[_0xafbb('0x3a')]=null;}if(!_0x35ade8[_0xafbb('0x39')])_0x35ade8[_0xafbb('0x3a')]=null;_0x271dc1[_0xafbb('0x64')]['Imap']=_0x35ade8;_0x271dc1[_0xafbb('0x64')][_0xafbb('0x41')]=_0x1395a4;return db['MailAccount'][_0xafbb('0x63')]({'where':{'id':_0x271dc1[_0xafbb('0x61')]['id']},'include':[{'model':db[_0xafbb('0x42')],'as':_0xafbb('0x40')},{'model':db['MailServerOut'],'as':_0xafbb('0x41')},{'model':db[_0xafbb('0x44')],'as':'mandatoryDispositionPause'}]})[_0xafbb('0x11')](handleEntityNotFound(_0xccf9dc,null))[_0xafbb('0x11')](function(_0x44a45a){if(!_0x44a45a)throw new Error(_0xafbb('0x68'));if(_0x44a45a[_0xafbb('0x3d')])delete _0x271dc1[_0xafbb('0x64')][_0xafbb('0x40')];return _0x44a45a;})[_0xafbb('0x11')](saveUpdates(_0x271dc1[_0xafbb('0x64')],null))[_0xafbb('0x11')](function(_0x3793cb){if(!_0x271dc1[_0xafbb('0x64')][_0xafbb('0x40')])return _0x3793cb;return db[_0xafbb('0x42')][_0xafbb('0x24')](_0x271dc1[_0xafbb('0x64')][_0xafbb('0x40')],{'where':{'MailAccountId':_0x3793cb['id']}})['then'](function(){return _0x3793cb;});})[_0xafbb('0x11')](function(_0x166eaf){if(!_0x271dc1[_0xafbb('0x64')][_0xafbb('0x41')])return _0x166eaf;return db[_0xafbb('0x43')][_0xafbb('0x24')](_0x271dc1[_0xafbb('0x64')][_0xafbb('0x41')],{'where':{'MailAccountId':_0x166eaf['id']}})[_0xafbb('0x11')](function(){return _0x166eaf;});})[_0xafbb('0x11')](respondWithResult(_0xccf9dc,null))[_0xafbb('0x1c')](handleError(_0xccf9dc,null));};exports['describe']=function(_0x46d94d,_0x2e16e3){return db[_0xafbb('0x47')][_0xafbb('0x69')]()[_0xafbb('0x11')](respondWithResult(_0x2e16e3,null))[_0xafbb('0x1c')](handleError(_0x2e16e3,null));};exports[_0xafbb('0x6a')]=function(_0x1f4e2a,_0x20ee12){if(_0x1f4e2a['body']['id']){delete _0x1f4e2a['body']['id'];}return db[_0xafbb('0x47')][_0xafbb('0x63')]({'where':{'id':_0x1f4e2a[_0xafbb('0x61')]['id']}})['then'](handleEntityNotFound(_0x20ee12,null))[_0xafbb('0x11')](function(_0x2d5044){if(_0x2d5044){_0x1f4e2a[_0xafbb('0x64')][_0xafbb('0x6b')]=_0x2d5044['id'];return db[_0xafbb('0x6c')]['create'](_0x1f4e2a[_0xafbb('0x64')]);}})[_0xafbb('0x11')](respondWithResult(_0x20ee12,null))['catch'](handleError(_0x20ee12,null));};exports[_0xafbb('0x6d')]=function(_0x43e75d,_0x583030){var _0x42b122={'raw':![],'where':{}};var _0x35c0b6={};var _0x17dd60={'count':0x0,'rows':[]};return db[_0xafbb('0x47')][_0xafbb('0x6e')]({'where':{'id':_0x43e75d['params']['id']}})['then'](handleEntityNotFound(_0x583030,null))[_0xafbb('0x11')](function(_0xb3981b){if(_0xb3981b){_0x35c0b6[_0xafbb('0x4c')]=_[_0xafbb('0x62')](db['Disposition'][_0xafbb('0x48')]);_0x35c0b6['query']=_[_0xafbb('0x62')](_0x43e75d['query']);_0x35c0b6[_0xafbb('0x4e')]=_[_0xafbb('0x4f')](_0x35c0b6[_0xafbb('0x4c')],_0x35c0b6[_0xafbb('0x4d')]);_0x42b122[_0xafbb('0x50')]=_['intersection'](_0x35c0b6[_0xafbb('0x4c')],qs['fields'](_0x43e75d[_0xafbb('0x4d')]['fields']));_0x42b122[_0xafbb('0x50')]=_0x42b122[_0xafbb('0x50')][_0xafbb('0x52')]?_0x42b122['attributes']:_0x35c0b6[_0xafbb('0x4c')];if(!_0x43e75d[_0xafbb('0x4d')][_0xafbb('0x6f')](_0xafbb('0x70'))){_0x42b122[_0xafbb('0x53')]=qs[_0xafbb('0x53')](_0x43e75d[_0xafbb('0x4d')][_0xafbb('0x53')]);_0x42b122[_0xafbb('0x21')]=qs[_0xafbb('0x21')](_0x43e75d[_0xafbb('0x4d')]['offset']);}_0x42b122[_0xafbb('0x54')]=qs[_0xafbb('0x55')](_0x43e75d[_0xafbb('0x4d')][_0xafbb('0x55')]);_0x42b122['where']=qs[_0xafbb('0x4e')](_['pick'](_0x43e75d[_0xafbb('0x4d')],_0x35c0b6[_0xafbb('0x4e')]));_0x42b122[_0xafbb('0x56')][_0xafbb('0x6b')]=_0xb3981b['id'];if(_0x43e75d[_0xafbb('0x4d')][_0xafbb('0x59')]){_0x42b122['where']=_['merge'](_0x42b122[_0xafbb('0x56')],{'$or':_[_0xafbb('0x46')](_0x42b122['attributes'],function(_0x117c24){var _0x21911a={};_0x21911a[_0x117c24]={'$like':'%'+_0x43e75d['query']['filter']+'%'};return _0x21911a;})});}_0x42b122=_['merge']({},_0x42b122,_0x43e75d[_0xafbb('0x5b')]);return db[_0xafbb('0x6c')][_0xafbb('0x20')]({'where':_0x42b122['where']})[_0xafbb('0x11')](function(_0x4d9ef7){_0x17dd60[_0xafbb('0x20')]=_0x4d9ef7;if(_0x43e75d[_0xafbb('0x4d')][_0xafbb('0x5c')]){_0x42b122[_0xafbb('0x5d')]=[{'all':!![]}];}return db[_0xafbb('0x6c')][_0xafbb('0x5e')](_0x42b122);})[_0xafbb('0x11')](function(_0x328bb3){_0x17dd60[_0xafbb('0x5f')]=_0x328bb3;return _0x17dd60;});}})[_0xafbb('0x11')](respondWithFilteredResult(_0x583030,_0x42b122))[_0xafbb('0x1c')](handleError(_0x583030,null));};exports['removeDispositions']=function(_0x15ab4e,_0x5e1813){return db[_0xafbb('0x47')][_0xafbb('0x63')]({'where':{'id':_0x15ab4e['params']['id']}})[_0xafbb('0x11')](handleEntityNotFound(_0x5e1813,null))[_0xafbb('0x11')](function(_0x363dc5){if(_0x363dc5){return _0x363dc5['removeDispositions'](_0x15ab4e[_0xafbb('0x4d')]['ids']);}})[_0xafbb('0x11')](respondWithStatusCode(_0x5e1813,null))[_0xafbb('0x1c')](handleError(_0x5e1813,null));};exports[_0xafbb('0x71')]=function(_0x500d37,_0x1254b1){if(_0x500d37[_0xafbb('0x64')]['id']){delete _0x500d37[_0xafbb('0x64')]['id'];}return db['MailAccount'][_0xafbb('0x63')]({'where':{'id':_0x500d37[_0xafbb('0x61')]['id']}})[_0xafbb('0x11')](handleEntityNotFound(_0x1254b1,null))['then'](function(_0x4bfda2){if(_0x4bfda2){_0x500d37[_0xafbb('0x64')][_0xafbb('0x6b')]=_0x4bfda2['id'];return db[_0xafbb('0x72')][_0xafbb('0x73')](_0x500d37[_0xafbb('0x64')]);}})[_0xafbb('0x11')](respondWithResult(_0x1254b1,null))[_0xafbb('0x1c')](handleError(_0x1254b1,null));};exports[_0xafbb('0x74')]=function(_0x18d9c3,_0x464b27){var _0x3c4568={'raw':![],'where':{}};var _0x33a850={};var _0x5e9f6e={'count':0x0,'rows':[]};return db['MailAccount'][_0xafbb('0x6e')]({'where':{'id':_0x18d9c3['params']['id']}})['then'](handleEntityNotFound(_0x464b27,null))['then'](function(_0x4e7c5e){if(_0x4e7c5e){_0x33a850[_0xafbb('0x4c')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x33a850['query']=_[_0xafbb('0x62')](_0x18d9c3[_0xafbb('0x4d')]);_0x33a850[_0xafbb('0x4e')]=_[_0xafbb('0x4f')](_0x33a850[_0xafbb('0x4c')],_0x33a850[_0xafbb('0x4d')]);_0x3c4568[_0xafbb('0x50')]=_[_0xafbb('0x4f')](_0x33a850[_0xafbb('0x4c')],qs[_0xafbb('0x51')](_0x18d9c3[_0xafbb('0x4d')]['fields']));_0x3c4568['attributes']=_0x3c4568[_0xafbb('0x50')][_0xafbb('0x52')]?_0x3c4568[_0xafbb('0x50')]:_0x33a850['model'];if(!_0x18d9c3[_0xafbb('0x4d')][_0xafbb('0x6f')](_0xafbb('0x70'))){_0x3c4568[_0xafbb('0x53')]=qs[_0xafbb('0x53')](_0x18d9c3[_0xafbb('0x4d')]['limit']);_0x3c4568[_0xafbb('0x21')]=qs[_0xafbb('0x21')](_0x18d9c3[_0xafbb('0x4d')][_0xafbb('0x21')]);}_0x3c4568['order']=qs[_0xafbb('0x55')](_0x18d9c3[_0xafbb('0x4d')]['sort']);_0x3c4568['where']=qs[_0xafbb('0x4e')](_[_0xafbb('0x57')](_0x18d9c3['query'],_0x33a850[_0xafbb('0x4e')]));_0x3c4568[_0xafbb('0x56')][_0xafbb('0x6b')]=_0x4e7c5e['id'];if(_0x18d9c3[_0xafbb('0x4d')][_0xafbb('0x59')]){_0x3c4568['where']=_[_0xafbb('0x5a')](_0x3c4568[_0xafbb('0x56')],{'$or':_[_0xafbb('0x46')](_0x3c4568[_0xafbb('0x50')],function(_0x38bd01){var _0x11e8c2={};_0x11e8c2[_0x38bd01]={'$like':'%'+_0x18d9c3[_0xafbb('0x4d')][_0xafbb('0x59')]+'%'};return _0x11e8c2;})});}_0x3c4568=_['merge']({},_0x3c4568,_0x18d9c3[_0xafbb('0x5b')]);return db['CannedAnswer'][_0xafbb('0x20')]({'where':_0x3c4568[_0xafbb('0x56')]})[_0xafbb('0x11')](function(_0x277276){_0x5e9f6e[_0xafbb('0x20')]=_0x277276;if(_0x18d9c3[_0xafbb('0x4d')][_0xafbb('0x5c')]){_0x3c4568[_0xafbb('0x5d')]=[{'all':!![]}];}return db[_0xafbb('0x72')][_0xafbb('0x5e')](_0x3c4568);})[_0xafbb('0x11')](function(_0x374c61){_0x5e9f6e['rows']=_0x374c61;return _0x5e9f6e;});}})[_0xafbb('0x11')](respondWithFilteredResult(_0x464b27,_0x3c4568))[_0xafbb('0x1c')](handleError(_0x464b27,null));};exports[_0xafbb('0x75')]=function(_0x477446,_0x3bc8d6){return db['MailAccount'][_0xafbb('0x63')]({'where':{'id':_0x477446['params']['id']}})['then'](handleEntityNotFound(_0x3bc8d6,null))[_0xafbb('0x11')](function(_0x3325c7){if(_0x3325c7){return _0x3325c7[_0xafbb('0x75')](_0x477446[_0xafbb('0x4d')][_0xafbb('0x76')]);}})[_0xafbb('0x11')](respondWithStatusCode(_0x3bc8d6,null))[_0xafbb('0x1c')](handleError(_0x3bc8d6,null));};exports['create']=function(_0x247093,_0xa58191){var _0x5c4465={'name':_0x247093['body'][_0xafbb('0x2a')],'key':_0x247093[_0xafbb('0x64')][_0xafbb('0x4b')],'provider':_0x247093['body']['provider']==='custom'?null:_0x247093[_0xafbb('0x64')][_0xafbb('0x65')],'email':_0x247093[_0xafbb('0x64')][_0xafbb('0x77')],'ListId':_0x247093[_0xafbb('0x64')][_0xafbb('0x78')],'active':!_[_0xafbb('0x79')](_0x247093[_0xafbb('0x64')][_0xafbb('0x7a')])?_0x247093[_0xafbb('0x64')][_0xafbb('0x7a')]:!![],'description':_0x247093[_0xafbb('0x64')][_0xafbb('0x7b')]||null};var _0x55bcba=getAuthenticationOptions(_0x5c4465[_0xafbb('0x65')],_0x247093[_0xafbb('0x64')]);_0x5c4465[_0xafbb('0x40')]=_0x55bcba[_0xafbb('0x40')];_0x5c4465[_0xafbb('0x41')]=_0x55bcba[_0xafbb('0x41')];return db[_0xafbb('0x47')][_0xafbb('0x73')](_0x5c4465,{'include':[{'model':db['MailServerOut'],'as':_0xafbb('0x41')},{'model':db[_0xafbb('0x42')],'as':'Imap'}]})['then'](function(_0x55bf6a){var _0x419447=_0x247093[_0xafbb('0x36')][_0xafbb('0x26')]({'plain':!![]});if(!_0x419447)throw new Error(_0xafbb('0x7c'));if(_0x419447[_0xafbb('0x7d')]===_0xafbb('0x36')){var _0x1f0d02=_0x55bf6a[_0xafbb('0x26')]({'plain':!![]});return db[_0xafbb('0x7e')][_0xafbb('0x63')]({'where':{'name':_0xafbb('0x27'),'userProfileId':_0x419447[_0xafbb('0x7f')]},'raw':!![]})[_0xafbb('0x11')](function(_0xab6d6c){if(_0xab6d6c&&_0xab6d6c[_0xafbb('0x80')]===0x0){return db['UserProfileResource'][_0xafbb('0x73')]({'name':_0x1f0d02[_0xafbb('0x2a')],'resourceId':_0x1f0d02['id'],'type':_0xab6d6c['name'],'sectionId':_0xab6d6c['id']},{})[_0xafbb('0x11')](function(){return _0x55bf6a;});}else{return _0x55bf6a;}})[_0xafbb('0x1c')](function(_0x58ccb3){logger[_0xafbb('0x17')](_0xafbb('0x81'),_0x58ccb3);throw _0x58ccb3;});}return _0x55bf6a;})[_0xafbb('0x11')](respondWithResult(_0xa58191,0xc9))['catch'](handleError(_0xa58191,null));};exports[_0xafbb('0x82')]=function(_0x51648b,_0x25a018){return db[_0xafbb('0x47')]['findOne']({'where':{'id':_0x51648b[_0xafbb('0x61')]['id']}})[_0xafbb('0x11')](handleEntityNotFound(_0x25a018,null))[_0xafbb('0x11')](function(_0x3d9c55){if(_0x3d9c55){return _0x3d9c55[_0xafbb('0x82')]();}return null;})[_0xafbb('0x11')](respondWithResult(_0x25a018,null))[_0xafbb('0x1c')](handleError(_0x25a018,null));};exports[_0xafbb('0x83')]=function(_0xadb678,_0x586677){if(_0xadb678['body']['id']){delete _0xadb678[_0xafbb('0x64')]['id'];}return db['MailAccount'][_0xafbb('0x63')]({'where':{'id':_0xadb678[_0xafbb('0x61')]['id']}})[_0xafbb('0x11')](handleEntityNotFound(_0x586677,null))['then'](function(_0x160209){if(_0x160209){_0xadb678[_0xafbb('0x64')][_0xafbb('0x6b')]=_0x160209['id'];return db['MailServerIn'][_0xafbb('0x73')](_0xadb678['body']);}})['then'](respondWithResult(_0x586677,null))[_0xafbb('0x1c')](handleError(_0x586677,null));};exports['removeImap']=function(_0xd8d7e,_0x27832f){return db[_0xafbb('0x47')][_0xafbb('0x6e')]({'where':{'id':_0xd8d7e[_0xafbb('0x61')]['id']}})[_0xafbb('0x11')](handleEntityNotFound(_0x27832f,null))['then'](function(_0x109257){if(_0x109257){return _0x109257[_0xafbb('0x84')](null);}return null;})[_0xafbb('0x11')](respondWithStatusCode(_0x27832f,null))['catch'](handleError(_0x27832f,null));};exports['getSmtp']=function(_0x2b11d5,_0x4ddd90){return db['MailAccount']['findOne']({'where':{'id':_0x2b11d5[_0xafbb('0x61')]['id']}})[_0xafbb('0x11')](handleEntityNotFound(_0x4ddd90,null))[_0xafbb('0x11')](function(_0x511801){if(_0x511801){return _0x511801['getSmtp']();}return null;})[_0xafbb('0x11')](respondWithResult(_0x4ddd90,null))[_0xafbb('0x1c')](handleError(_0x4ddd90,null));};exports[_0xafbb('0x85')]=function(_0x9c9edf,_0x570c87){if(_0x9c9edf['body']['id']){delete _0x9c9edf['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x9c9edf[_0xafbb('0x61')]['id']}})['then'](handleEntityNotFound(_0x570c87,null))[_0xafbb('0x11')](function(_0x1bfe39){if(_0x1bfe39){_0x9c9edf[_0xafbb('0x64')][_0xafbb('0x6b')]=_0x1bfe39['id'];return db[_0xafbb('0x43')][_0xafbb('0x73')](_0x9c9edf[_0xafbb('0x64')]);}})[_0xafbb('0x11')](respondWithResult(_0x570c87,null))[_0xafbb('0x1c')](handleError(_0x570c87,null));};exports[_0xafbb('0x86')]=function(_0x9fa164,_0x36414d){return db[_0xafbb('0x47')][_0xafbb('0x6e')]({'where':{'id':_0x9fa164['params']['id']}})['then'](handleEntityNotFound(_0x36414d,null))[_0xafbb('0x11')](function(_0x261d51){if(_0x261d51){return _0x261d51[_0xafbb('0x87')](null);}return null;})[_0xafbb('0x11')](respondWithStatusCode(_0x36414d,null))[_0xafbb('0x1c')](handleError(_0x36414d,null));};exports['addInteraction']=function(_0x1af1a7,_0x1b8286){return db[_0xafbb('0x88')][_0xafbb('0x63')]({'where':{'id':_0x1af1a7[_0xafbb('0x61')]['id']}})[_0xafbb('0x11')](handleEntityNotFound(_0x1b8286,null))['then'](function(_0x2b0e2a){if(_0x2b0e2a){return _0x2b0e2a[_0xafbb('0x89')](_0x1af1a7[_0xafbb('0x64')]['ids'],_[_0xafbb('0x8a')](_0x1af1a7['body'],[_0xafbb('0x76'),'id'])||{});}})['then'](respondWithResult(_0x1b8286,null))[_0xafbb('0x1c')](handleError(_0x1b8286,null));};exports[_0xafbb('0x8b')]=function(_0xb55953,_0x267224){var _0x42dce1={'raw':![],'where':{}};var _0x18a9ae={};var _0x278cdb={'count':0x0,'rows':[]};return db[_0xafbb('0x47')][_0xafbb('0x6e')]({'where':{'id':_0xb55953[_0xafbb('0x61')]['id']}})[_0xafbb('0x11')](handleEntityNotFound(_0x267224,null))[_0xafbb('0x11')](function(_0xe85637){if(_0xe85637){_0x18a9ae[_0xafbb('0x4c')]=_[_0xafbb('0x62')](db[_0xafbb('0x88')][_0xafbb('0x48')]);_0x18a9ae[_0xafbb('0x4d')]=_[_0xafbb('0x62')](_0xb55953[_0xafbb('0x4d')]);_0x18a9ae['filters']=_['intersection'](_0x18a9ae[_0xafbb('0x4c')],_0x18a9ae[_0xafbb('0x4d')]);_0x42dce1[_0xafbb('0x50')]=_[_0xafbb('0x4f')](_0x18a9ae[_0xafbb('0x4c')],qs[_0xafbb('0x51')](_0xb55953[_0xafbb('0x4d')][_0xafbb('0x51')]));_0x42dce1[_0xafbb('0x50')]=_0x42dce1['attributes']['length']?_0x42dce1[_0xafbb('0x50')]:_0x18a9ae['model'];if(!_0xb55953[_0xafbb('0x4d')][_0xafbb('0x6f')](_0xafbb('0x70'))){_0x42dce1['limit']=qs[_0xafbb('0x53')](_0xb55953[_0xafbb('0x4d')][_0xafbb('0x53')]);_0x42dce1[_0xafbb('0x21')]=qs[_0xafbb('0x21')](_0xb55953[_0xafbb('0x4d')]['offset']);}_0x42dce1[_0xafbb('0x54')]=qs[_0xafbb('0x55')](_0xb55953['query']['sort']);_0x42dce1[_0xafbb('0x56')]=qs[_0xafbb('0x4e')](_[_0xafbb('0x57')](_0xb55953[_0xafbb('0x4d')],_0x18a9ae['filters']));_0x42dce1[_0xafbb('0x56')][_0xafbb('0x6b')]=_0xe85637['id'];if(_0xb55953[_0xafbb('0x4d')][_0xafbb('0x59')]){_0x42dce1[_0xafbb('0x56')]=_['merge'](_0x42dce1['where'],{'$or':_['map'](_0x42dce1[_0xafbb('0x50')],function(_0x1d3f92){var _0x1b99e3={};_0x1b99e3[_0x1d3f92]={'$like':'%'+_0xb55953['query'][_0xafbb('0x59')]+'%'};return _0x1b99e3;})});}_0x42dce1=_[_0xafbb('0x5a')]({},_0x42dce1,_0xb55953['options']);return db[_0xafbb('0x88')][_0xafbb('0x20')]({'where':_0x42dce1[_0xafbb('0x56')]})[_0xafbb('0x11')](function(_0x1fc5be){_0x278cdb[_0xafbb('0x20')]=_0x1fc5be;if(_0xb55953['query']['includeAll']){_0x42dce1[_0xafbb('0x5d')]=[{'model':db[_0xafbb('0x8c')],'as':'Contact','required':![]},{'model':db[_0xafbb('0x8d')],'as':_0xafbb('0x8e'),'attributes':[_0xafbb('0x2a'),_0xafbb('0x8f'),_0xafbb('0x90')],'required':![]},{'model':db[_0xafbb('0x91')],'as':_0xafbb('0x92'),'attributes':['id',_0xafbb('0x2a'),_0xafbb('0x93')],'where':_0xb55953[_0xafbb('0x4d')][_0xafbb('0x94')]?{'id':_0xb55953['query'][_0xafbb('0x94')]}:undefined,'required':_0xb55953[_0xafbb('0x4d')][_0xafbb('0x94')]?!![]:![]}];}return db[_0xafbb('0x88')][_0xafbb('0x5e')](_0x42dce1);})['then'](function(_0x4ef610){_0x278cdb[_0xafbb('0x5f')]=_0x4ef610;return _0x278cdb;});}})[_0xafbb('0x11')](respondWithFilteredResult(_0x267224,_0x42dce1))[_0xafbb('0x1c')](handleError(_0x267224,null));};exports[_0xafbb('0x95')]=function addApplications(_0x557684,_0x589a89){var _0x1c2ba1=_0x557684[_0xafbb('0x61')]['id'];var _0x3d9916=_0x557684[_0xafbb('0x64')];var _0xef31b=0xc8;var _0x306319=null;return db[_0xafbb('0x96')][_0xafbb('0x97')]({'isolationLevel':db[_0xafbb('0x96')][_0xafbb('0x98')][_0xafbb('0x99')][_0xafbb('0x9a')]},function(_0x24c037){return db[_0xafbb('0x47')][_0xafbb('0x6e')]({'where':{'id':_0x1c2ba1},'transaction':_0x24c037})[_0xafbb('0x11')](function(_0x40d7ea){if(_0x40d7ea){return db[_0xafbb('0x9b')][_0xafbb('0x25')]({'where':{'MailAccountId':_0x1c2ba1},'transaction':_0x24c037})[_0xafbb('0x11')](function(){var _0x198404=_[_0xafbb('0x46')](_0x3d9916,function(_0x373e44){_0x373e44['MailAccountId']=_0x1c2ba1;return _0x373e44;});return db[_0xafbb('0x9b')]['bulkCreate'](_0x198404,{'transaction':_0x24c037});});}else{_0xef31b=0x194;_0x306319=[];}});})[_0xafbb('0x11')](function(){if(_0xef31b!==0x194){return db[_0xafbb('0x9b')][_0xafbb('0x9c')]({'where':{'MailAccountId':_0x1c2ba1},'order':'priority'})[_0xafbb('0x11')](function(_0x470d68){_0x306319=_0x470d68;});}})[_0xafbb('0x1c')](function(_0x59929){_0xef31b=0x1f4;logger[_0xafbb('0x17')](_0x59929[_0xafbb('0x29')]);if(_0x59929[_0xafbb('0x2a')]){delete _0x59929[_0xafbb('0x2a')];}_0x306319=_0x59929;})[_0xafbb('0x9d')](function(){if(_0x306319===null){_0x589a89[_0xafbb('0x1d')](_0xef31b);}else{if(_0xef31b===0x1f4){_0x589a89[_0xafbb('0x1e')](_0xef31b)['send'](_0x306319);}else{_0x589a89[_0xafbb('0x1e')](_0xef31b)['json'](_0x306319);}}});};exports['getApplications']=function(_0x2c4912,_0x4155eb){var _0x508a2e={};var _0x5b6ab9={};var _0x2e7231;var _0x38002b;return db['MailAccount'][_0xafbb('0x6e')]({'where':{'id':_0x2c4912[_0xafbb('0x61')]['id']}})[_0xafbb('0x11')](handleEntityNotFound(_0x4155eb,null))[_0xafbb('0x11')](function(_0x5851b8){if(_0x5851b8){_0x2e7231=_0x5851b8;_0x5b6ab9['model']=_['keys'](db[_0xafbb('0x9b')][_0xafbb('0x48')]);_0x5b6ab9[_0xafbb('0x4d')]=_[_0xafbb('0x62')](_0x2c4912[_0xafbb('0x4d')]);_0x5b6ab9[_0xafbb('0x4e')]=_[_0xafbb('0x4f')](_0x5b6ab9[_0xafbb('0x4c')],_0x5b6ab9[_0xafbb('0x4d')]);_0x508a2e[_0xafbb('0x50')]=_[_0xafbb('0x4f')](_0x5b6ab9['model'],qs[_0xafbb('0x51')](_0x2c4912[_0xafbb('0x4d')][_0xafbb('0x51')]));_0x508a2e['attributes']=_0x508a2e[_0xafbb('0x50')][_0xafbb('0x52')]?_0x508a2e[_0xafbb('0x50')]:_0x5b6ab9[_0xafbb('0x4c')];_0x508a2e[_0xafbb('0x54')]=qs[_0xafbb('0x55')](_0x2c4912[_0xafbb('0x4d')][_0xafbb('0x55')]);_0x508a2e[_0xafbb('0x56')]=qs['filters'](_[_0xafbb('0x57')](_0x2c4912[_0xafbb('0x4d')],_0x5b6ab9['filters']));if(_0x2c4912[_0xafbb('0x4d')][_0xafbb('0x59')]){_0x508a2e['where']=_['merge'](_0x508a2e['where'],{'$or':_[_0xafbb('0x46')](_0x508a2e['attributes'],function(_0x25c624){var _0x24cf3d={};_0x24cf3d[_0x25c624]={'$like':'%'+_0x2c4912['query'][_0xafbb('0x59')]+'%'};return _0x24cf3d;})});}_0x508a2e=_[_0xafbb('0x5a')]({},_0x508a2e,_0x2c4912[_0xafbb('0x5b')]);return _0x2e7231[_0xafbb('0x9e')](_0x508a2e);}})[_0xafbb('0x11')](function(_0x540ab4){if(_0x540ab4){_0x38002b=_0x540ab4['length'];if(!_0x2c4912[_0xafbb('0x4d')][_0xafbb('0x6f')](_0xafbb('0x70'))){_0x508a2e['limit']=qs[_0xafbb('0x53')](_0x2c4912[_0xafbb('0x4d')][_0xafbb('0x53')]);_0x508a2e[_0xafbb('0x21')]=qs[_0xafbb('0x21')](_0x2c4912['query']['offset']);}return _0x2e7231[_0xafbb('0x9e')](_0x508a2e);}})[_0xafbb('0x11')](function(_0x2905f4){if(_0x2905f4){return _0x2905f4?{'count':_0x38002b,'rows':_0x2905f4}:null;}})[_0xafbb('0x11')](respondWithResult(_0x4155eb,null))['catch'](handleError(_0x4155eb,null));};exports['getMessages']=function(_0x338ddf,_0x4e731f){var _0x3755e1={'raw':!![],'where':{}};var _0x2fee0e={};var _0x58a10b={'count':0x0,'rows':[]};return db[_0xafbb('0x47')][_0xafbb('0x6e')]({'where':{'id':_0x338ddf[_0xafbb('0x61')]['id']}})[_0xafbb('0x11')](handleEntityNotFound(_0x4e731f,null))[_0xafbb('0x11')](function(_0x3501ae){if(_0x3501ae){_0x2fee0e[_0xafbb('0x4c')]=_[_0xafbb('0x62')](db[_0xafbb('0x9f')]['rawAttributes']);_0x2fee0e['query']=_[_0xafbb('0x62')](_0x338ddf[_0xafbb('0x4d')]);_0x2fee0e['filters']=_[_0xafbb('0x4f')](_0x2fee0e['model'],_0x2fee0e['query']);_0x3755e1['attributes']=_[_0xafbb('0x4f')](_0x2fee0e[_0xafbb('0x4c')],qs[_0xafbb('0x51')](_0x338ddf['query'][_0xafbb('0x51')]));_0x3755e1[_0xafbb('0x50')]=_0x3755e1[_0xafbb('0x50')][_0xafbb('0x52')]?_0x3755e1[_0xafbb('0x50')]:_0x2fee0e[_0xafbb('0x4c')];if(!_0x338ddf[_0xafbb('0x4d')]['hasOwnProperty']('nolimit')){_0x3755e1['limit']=qs['limit'](_0x338ddf[_0xafbb('0x4d')][_0xafbb('0x53')]);_0x3755e1[_0xafbb('0x21')]=qs['offset'](_0x338ddf[_0xafbb('0x4d')][_0xafbb('0x21')]);}_0x3755e1[_0xafbb('0x54')]=qs[_0xafbb('0x55')](_0x338ddf[_0xafbb('0x4d')]['sort']);_0x3755e1[_0xafbb('0x56')]=qs['filters'](_['pick'](_0x338ddf[_0xafbb('0x4d')],_0x2fee0e[_0xafbb('0x4e')]));_0x3755e1[_0xafbb('0x56')]['MailAccountId']=_0x3501ae['id'];if(_0x338ddf[_0xafbb('0x4d')][_0xafbb('0x59')]){_0x3755e1[_0xafbb('0x56')]=_['merge'](_0x3755e1[_0xafbb('0x56')],{'$or':_[_0xafbb('0x46')](_0x3755e1[_0xafbb('0x50')],function(_0x15c728){var _0x4afa54={};_0x4afa54[_0x15c728]={'$like':'%'+_0x338ddf['query']['filter']+'%'};return _0x4afa54;})});}if(_0x338ddf['query'][_0xafbb('0xa0')]){var _0x122a8c=_0x338ddf[_0xafbb('0x4d')][_0xafbb('0xa0')][_0xafbb('0xa1')](',');var _0x4a611e={};_0x4a611e[_0x122a8c[0x0]]={'$gte':moment(_0x122a8c[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3755e1[_0xafbb('0x56')]=_[_0xafbb('0x5a')](_0x3755e1[_0xafbb('0x56')],_0x4a611e);}_0x3755e1=_['merge']({},_0x3755e1,_0x338ddf[_0xafbb('0x5b')]);return db[_0xafbb('0x9f')][_0xafbb('0x20')]({'where':_0x3755e1[_0xafbb('0x56')]})[_0xafbb('0x11')](function(_0x37ce3b){_0x58a10b['count']=_0x37ce3b;if(_0x338ddf[_0xafbb('0x4d')][_0xafbb('0x5c')]){_0x3755e1[_0xafbb('0x5d')]=[{'all':!![]}];}return db[_0xafbb('0x9f')][_0xafbb('0x5e')](_0x3755e1);})['then'](function(_0x45055e){if(_0x338ddf[_0xafbb('0x4d')][_0xafbb('0xa2')]===_0xafbb('0xa3')){for(var _0x4f73b4=0x0;_0x4f73b4<_0x45055e[_0xafbb('0x52')];_0x4f73b4++){_0x45055e[_0x4f73b4][_0xafbb('0x64')]=juice(_0x45055e[_0x4f73b4]['body']);}}_0x58a10b[_0xafbb('0x5f')]=_0x45055e;return _0x58a10b;});}})[_0xafbb('0x11')](respondWithFilteredResult(_0x4e731f,_0x3755e1))['catch'](handleError(_0x4e731f,null));};exports[_0xafbb('0xa4')]=function(_0x15b4ec,_0x28f064){var _0x101377,_0x1f55dd={},_0x14122d;if(_0x15b4ec[_0xafbb('0x64')]['to']){_0x14122d=_0x15b4ec[_0xafbb('0x64')]['to']['split'](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x15b4ec['params']['id']},'include':[{'model':db[_0xafbb('0xa5')],'as':_0xafbb('0xa6'),'include':[{'model':db[_0xafbb('0x8c')],'as':_0xafbb('0xa7'),'where':{'email':_0x14122d},'limit':0x1,'order':[[_0xafbb('0xa8'),_0xafbb('0xa9')]]}]},{'model':db[_0xafbb('0x43')],'as':_0xafbb('0x41'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0xafbb('0x11')](handleEntityNotFound(_0x28f064,null))[_0xafbb('0x11')](function(_0x154419){if(!_0x154419)return;_0x101377=_0x154419;if(!_0x154419[_0xafbb('0x41')])throw new Error(_0xafbb('0xaa'));if(_[_0xafbb('0x79')](_0x15b4ec['body'][_0xafbb('0xab')])){_0x15b4ec[_0xafbb('0x64')][_0xafbb('0xab')]=util['format'](_0xafbb('0xac'),_0x154419[_0xafbb('0x2a')],_0x154419[_0xafbb('0x77')]||_0x154419[_0xafbb('0x41')]['user']);}if(_0x15b4ec[_0xafbb('0x64')]['attachments']&&_0x15b4ec[_0xafbb('0x64')][_0xafbb('0xad')]['length']){for(var _0x528100=0x0;_0x528100<_0x15b4ec[_0xafbb('0x64')][_0xafbb('0xad')][_0xafbb('0x52')];_0x528100+=0x1){_0x15b4ec[_0xafbb('0x64')][_0xafbb('0xad')][_0x528100]={'filename':_0x15b4ec[_0xafbb('0x64')][_0xafbb('0xad')][_0x528100]['name'],'path':path[_0xafbb('0xae')](config[_0xafbb('0xaf')],_0xafbb('0xb0'),_0x15b4ec[_0xafbb('0x64')][_0xafbb('0xad')][_0x528100]['basename'])};}}var _0x304ee4=_0x154419[_0xafbb('0xb1')]();return respondWithRpcPromise(_0xafbb('0xb2'),'sendMail',{'account':_0x304ee4,'message':_0x15b4ec['body']});})[_0xafbb('0x11')](function(_0x16ba49){if(!_0x16ba49)return;_0x1f55dd=_0x16ba49;if(!_0x101377[_0xafbb('0xa6')])throw new Error('List\x20not\x20found');if(_0x101377['List'][_0xafbb('0xa7')]['length'])return _0x101377[_0xafbb('0xa6')]['Contacts'][0x0];return db[_0xafbb('0x8c')][_0xafbb('0x73')](_['defaults'](_0x15b4ec[_0xafbb('0x64')],{'firstName':_0x15b4ec[_0xafbb('0x64')]['to'],'email':_0x15b4ec['body']['to'],'phone':_0x15b4ec[_0xafbb('0x64')]['to'],'ListId':_0x101377[_0xafbb('0x78')]}));})[_0xafbb('0x11')](function(_0x3f0264){if(!_0x3f0264)return;var _0x269473={'UserId':_0x15b4ec[_0xafbb('0x36')]['id'],'ContactId':_0x3f0264['id'],'MailAccountId':_0x101377['id'],'inReplyTo':_0x1f55dd[_0xafbb('0xb3')],'to':_0x15b4ec[_0xafbb('0x64')][_0xafbb('0xab')],'cc':_0x15b4ec['body']['cc'],'subject':_0x15b4ec[_0xafbb('0x64')][_0xafbb('0xb4')],'attach':_0x15b4ec[_0xafbb('0x64')][_0xafbb('0xb5')],'firstMsgDirection':_0xafbb('0xb6'),'lastMsgAt':moment()[_0xafbb('0xb7')](_0xafbb('0xb8')),'lastMsgDirection':_0xafbb('0xb6'),'Messages':[_[_0xafbb('0x5a')](_0x15b4ec['body'],{'messageId':_0x1f55dd['messageId'],'sentAt':moment()[_0xafbb('0xb7')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x101377['id'],'UserId':_0x15b4ec['user']['id'],'ContactId':_0x3f0264['id']})]};if(_0x15b4ec[_0xafbb('0x64')]['Interaction']){_0x269473=_[_0xafbb('0x5a')](_0x269473,_0x15b4ec[_0xafbb('0x64')][_0xafbb('0xb9')]);}return db['MailInteraction']['create'](_0x269473,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0xafbb('0x11')](respondWithResult(_0x28f064,null))['catch'](handleError(_0x28f064,null));};exports[_0xafbb('0xba')]=function(_0x406321,_0x4d43d8){return db[_0xafbb('0x47')]['find']({'where':{'id':_0x406321[_0xafbb('0x61')]['id']},'include':[{'model':db[_0xafbb('0x43')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xafbb('0xbb')],'as':_0xafbb('0xbb'),'raw':!![]}]}]})[_0xafbb('0x11')](handleEntityNotFound(_0x4d43d8,null))[_0xafbb('0x11')](function(_0x4cc44a){if(!_0x4cc44a[_0xafbb('0x41')])return;var _0x169365=_0x4cc44a[_0xafbb('0xb1')]();return respondWithRpcPromise('VerifySmtp',_0xafbb('0xba'),{'account':_0x169365});})['then'](respondWithResult(_0x4d43d8,null))['catch'](handleError(_0x4d43d8,null));};exports[_0xafbb('0x25')]=function(_0x15907e,_0x459175){return db['MailAccount']['find']({'where':{'id':_0x15907e['params']['id']}})[_0xafbb('0x11')](handleEntityNotFound(_0x459175,null))[_0xafbb('0x11')](function(_0x1e81ba){if(_0x1e81ba&&_0x1e81ba[_0xafbb('0x3d')]){throw new db[(_0xafbb('0xbc'))][(_0xafbb('0xbd'))](_0xafbb('0xbe'));}return _0x1e81ba;})[_0xafbb('0x11')](removeEntity(_0x459175,null))[_0xafbb('0x1c')](handleError(_0x459175,null));};exports[_0xafbb('0xbf')]=function(_0x5d586e,_0x24905e){return db['MailAccount'][_0xafbb('0x63')]({'where':{'id':_0x5d586e[_0xafbb('0x61')]['id']}})[_0xafbb('0x11')](handleEntityNotFound(_0x24905e,null))['then'](function(_0xc40400){if(_0xc40400){return _0xc40400[_0xafbb('0xbf')](_0x5d586e['body']['ids'],_['omit'](_0x5d586e[_0xafbb('0x64')],['ids','id'])||{})[_0xafbb('0xc0')](function(_0x5151c2){for(var _0x4b4008=0x0;_0x4b4008<_0x5d586e[_0xafbb('0x64')][_0xafbb('0x76')][_0xafbb('0x52')];_0x4b4008+=0x1){socket['emit'](_0xafbb('0xc1'),{'UserId':Number(_0x5d586e[_0xafbb('0x64')][_0xafbb('0x76')][_0x4b4008]),'MailAccountId':Number(_0x5d586e[_0xafbb('0x61')]['id'])});}return _0x5151c2;});}})[_0xafbb('0x11')](respondWithResult(_0x24905e,null))[_0xafbb('0x1c')](handleError(_0x24905e,null));};exports[_0xafbb('0xc2')]=function(_0x24657e,_0x19e68d){return db['MailAccount'][_0xafbb('0x63')]({'where':{'id':_0x24657e['params']['id']}})[_0xafbb('0x11')](handleEntityNotFound(_0x19e68d,null))['then'](function(_0x449b58){if(_0x449b58){return _0x449b58[_0xafbb('0xc2')](_0x24657e[_0xafbb('0x4d')][_0xafbb('0x76')])['then'](function(){if(_['isArray'](_0x24657e[_0xafbb('0x4d')][_0xafbb('0x76')])){for(var _0x5b4628=0x0;_0x5b4628<_0x24657e['query']['ids']['length'];_0x5b4628+=0x1){socket[_0xafbb('0xc3')](_0xafbb('0xc4'),{'UserId':Number(_0x24657e[_0xafbb('0x4d')][_0xafbb('0x76')][_0x5b4628]),'MailAccountId':Number(_0x24657e[_0xafbb('0x61')]['id'])});}}else{socket[_0xafbb('0xc3')](_0xafbb('0xc4'),{'UserId':Number(_0x24657e[_0xafbb('0x4d')][_0xafbb('0x76')]),'MailAccountId':Number(_0x24657e['params']['id'])});}});}})[_0xafbb('0x11')](respondWithStatusCode(_0x19e68d,null))[_0xafbb('0x1c')](handleError(_0x19e68d,null));};exports[_0xafbb('0xc5')]=function(_0x55f3fe,_0x267c8b){var _0x97ef08={};var _0x257f9f={};var _0x519748;var _0x125788;return db[_0xafbb('0x47')][_0xafbb('0x6e')]({'where':{'id':_0x55f3fe['params']['id']}})[_0xafbb('0x11')](handleEntityNotFound(_0x267c8b,null))[_0xafbb('0x11')](function(_0x2e315c){if(_0x2e315c){_0x519748=_0x2e315c;_0x257f9f[_0xafbb('0x4c')]=_['keys'](db[_0xafbb('0x8d')][_0xafbb('0x48')]);_0x257f9f[_0xafbb('0x4d')]=_['keys'](_0x55f3fe[_0xafbb('0x4d')]);_0x257f9f[_0xafbb('0x4e')]=_[_0xafbb('0x4f')](_0x257f9f[_0xafbb('0x4c')],_0x257f9f['query']);_0x97ef08[_0xafbb('0x50')]=_[_0xafbb('0x4f')](_0x257f9f['model'],qs[_0xafbb('0x51')](_0x55f3fe[_0xafbb('0x4d')][_0xafbb('0x51')]));_0x97ef08['attributes']=_0x97ef08[_0xafbb('0x50')][_0xafbb('0x52')]?_0x97ef08[_0xafbb('0x50')]:_0x257f9f[_0xafbb('0x4c')];_0x97ef08['order']=qs[_0xafbb('0x55')](_0x55f3fe[_0xafbb('0x4d')]['sort']);_0x97ef08['where']=qs[_0xafbb('0x4e')](_[_0xafbb('0x57')](_0x55f3fe[_0xafbb('0x4d')],_0x257f9f[_0xafbb('0x4e')]));if(_0x55f3fe['query'][_0xafbb('0x59')]){_0x97ef08['where']=_['merge'](_0x97ef08[_0xafbb('0x56')],{'$or':_[_0xafbb('0x46')](_0x97ef08[_0xafbb('0x50')],function(_0x167da8){var _0x2729cb={};_0x2729cb[_0x167da8]={'$like':'%'+_0x55f3fe[_0xafbb('0x4d')][_0xafbb('0x59')]+'%'};return _0x2729cb;})});}_0x97ef08=_['merge']({},_0x97ef08,_0x55f3fe['options']);return _0x519748[_0xafbb('0xc5')](_0x97ef08);}})['then'](function(_0x32ce77){if(_0x32ce77){_0x125788=_0x32ce77[_0xafbb('0x52')];if(!_0x55f3fe[_0xafbb('0x4d')][_0xafbb('0x6f')](_0xafbb('0x70'))){_0x97ef08[_0xafbb('0x53')]=qs['limit'](_0x55f3fe[_0xafbb('0x4d')]['limit']);_0x97ef08[_0xafbb('0x21')]=qs[_0xafbb('0x21')](_0x55f3fe[_0xafbb('0x4d')]['offset']);}return _0x519748[_0xafbb('0xc5')](_0x97ef08);}})[_0xafbb('0x11')](function(_0x111315){if(_0x111315){return _0x111315?{'count':_0x125788,'rows':_0x111315}:null;}})[_0xafbb('0x11')](respondWithResult(_0x267c8b,null))[_0xafbb('0x1c')](handleError(_0x267c8b,null));};
\ No newline at end of file
index fd0be9e..bfc33f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf9b7=['hasOwnProperty','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit'];(function(_0x8f8dcd,_0x249623){var _0x4041bd=function(_0x874abc){while(--_0x874abc){_0x8f8dcd['push'](_0x8f8dcd['shift']());}};_0x4041bd(++_0x249623);}(_0xf9b7,0x91));var _0x7f9b=function(_0x42266f,_0x2d5e10){_0x42266f=_0x42266f-0x0;var _0x32d4c9=_0xf9b7[_0x42266f];return _0x32d4c9;};'use strict';var EventEmitter=require(_0x7f9b('0x0'));var MailAccount=require(_0x7f9b('0x1'))['db'][_0x7f9b('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7f9b('0x3')](0x0);var events={'afterCreate':_0x7f9b('0x4'),'afterUpdate':_0x7f9b('0x5'),'afterDestroy':_0x7f9b('0x6')};function emitEvent(_0xbfe740){return function(_0x4fa181,_0x527476,_0x3666e1){MailAccountEvents['emit'](_0xbfe740+':'+_0x4fa181['id'],_0x4fa181);MailAccountEvents[_0x7f9b('0x7')](_0xbfe740,_0x4fa181);_0x3666e1(null);};}for(var e in events){if(events[_0x7f9b('0x8')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents;
\ No newline at end of file
+var _0x8b0e=['MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0x8b0e,0x166));var _0xe8b0=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0x8b0e[_0x2181b1];return _0x530548;};'use strict';var EventEmitter=require(_0xe8b0('0x0'));var MailAccount=require(_0xe8b0('0x1'))['db'][_0xe8b0('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe8b0('0x3')](0x0);var events={'afterCreate':_0xe8b0('0x4'),'afterUpdate':_0xe8b0('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2036fd){return function(_0x5ba48e,_0x34ccc7,_0x240513){MailAccountEvents[_0xe8b0('0x6')](_0x2036fd+':'+_0x5ba48e['id'],_0x5ba48e);MailAccountEvents[_0xe8b0('0x6')](_0x2036fd,_0x5ba48e);_0x240513(null);};}for(var e in events){if(events[_0xe8b0('0x7')](e)){var event=events[e];MailAccount[_0xe8b0('0x8')](e,emitEvent(event));}}module[_0xe8b0('0x9')]=MailAccountEvents;
\ No newline at end of file
index 67a7d6b..91a8cef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8aa4=['OAuth2','data5','user','exports','define','MailAccount','mail_accounts','provider','service','Smtp','host','port','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x2e2a63,_0x341f78){var _0xfc9dad=function(_0x1602e1){while(--_0x1602e1){_0x2e2a63['push'](_0x2e2a63['shift']());}};_0xfc9dad(++_0x341f78);}(_0x8aa4,0x18a));var _0x48aa=function(_0x105c72,_0x52c05a){_0x105c72=_0x105c72-0x0;var _0x367c23=_0x8aa4[_0x105c72];return _0x367c23;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x48aa('0x0')]=function(_0x123381){return _0x123381[_0x48aa('0x1')](_0x48aa('0x2'),attributes,{'tableName':_0x48aa('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x47b427=this;var _0x4a4ca8={'id':_0x47b427['id'],'tls':{'rejectUnauthorized':![]}};if(_0x47b427[_0x48aa('0x4')]!=='custom'){_0x4a4ca8[_0x48aa('0x5')]=_0x47b427['provider'];}else{_0x4a4ca8['host']=_0x47b427[_0x48aa('0x6')][_0x48aa('0x7')];_0x4a4ca8[_0x48aa('0x8')]=_0x47b427[_0x48aa('0x6')][_0x48aa('0x8')];_0x4a4ca8[_0x48aa('0x9')]=_0x47b427[_0x48aa('0x6')][_0x48aa('0x9')];}if(_0x47b427[_0x48aa('0x6')][_0x48aa('0xa')]){if(_0x47b427[_0x48aa('0x6')][_0x48aa('0xb')]){if(!_0x47b427['Smtp']['CloudProvider'])throw new Error(_0x48aa('0xc'));_0x4a4ca8[_0x48aa('0xd')]={'type':_0x48aa('0xe'),'user':_0x47b427[_0x48aa('0x6')]['user'],'accessToken':_0x47b427[_0x48aa('0x6')]['CloudProvider'][_0x48aa('0xf')]};}else{_0x4a4ca8[_0x48aa('0xd')]={'user':_0x47b427[_0x48aa('0x6')][_0x48aa('0x10')],'pass':_0x47b427[_0x48aa('0x6')]['pass']};}}return _0x4a4ca8;}}});};
\ No newline at end of file
+var _0x42ba=['secure','authentication','modernAuthentication','auth','OAuth2','exports','define','MailAccount','mail_accounts','provider','service','host','port','Smtp'];(function(_0x497a19,_0x3f60e8){var _0x1c9ae8=function(_0x19f808){while(--_0x19f808){_0x497a19['push'](_0x497a19['shift']());}};_0x1c9ae8(++_0x3f60e8);}(_0x42ba,0x1b7));var _0xa42b=function(_0x27d2f4,_0x4b3f6d){_0x27d2f4=_0x27d2f4-0x0;var _0x41ac9c=_0x42ba[_0x27d2f4];return _0x41ac9c;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xa42b('0x0')]=function(_0x5dd0ce){return _0x5dd0ce[_0xa42b('0x1')](_0xa42b('0x2'),attributes,{'tableName':_0xa42b('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x337386=this;var _0x3f28bd={'id':_0x337386['id'],'tls':{'rejectUnauthorized':![]}};if(_0x337386[_0xa42b('0x4')]!=='custom'){_0x3f28bd[_0xa42b('0x5')]=_0x337386[_0xa42b('0x4')];}else{_0x3f28bd[_0xa42b('0x6')]=_0x337386['Smtp'][_0xa42b('0x6')];_0x3f28bd[_0xa42b('0x7')]=_0x337386[_0xa42b('0x8')][_0xa42b('0x7')];_0x3f28bd[_0xa42b('0x9')]=_0x337386[_0xa42b('0x8')][_0xa42b('0x9')];}if(_0x337386['Smtp'][_0xa42b('0xa')]){if(_0x337386[_0xa42b('0x8')][_0xa42b('0xb')]){if(!_0x337386[_0xa42b('0x8')]['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x3f28bd[_0xa42b('0xc')]={'type':_0xa42b('0xd'),'user':_0x337386['Smtp']['user'],'accessToken':_0x337386[_0xa42b('0x8')]['CloudProvider']['data5']};}else{_0x3f28bd[_0xa42b('0xc')]={'user':_0x337386[_0xa42b('0x8')]['user'],'pass':_0x337386[_0xa42b('0x8')]['pass']};}}return _0x3f28bd;}}});};
\ No newline at end of file
index a51804b..d66ed23 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd943=['MailServerOut','Smtp','CloudProvider','get','account','omit','smtpOptions','applications','list','asc','autoclose','close','Contacts','length','defaults','ListId','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','create','spread','attach','interaction','created','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','MailAccount','findAll','options','where','attributes','limit','include','map','model','stringify','GetMailAccount','ShowMailAccount','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','updatedAt','CompanyId','isNil','from','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','DESC','MailApplication','Applications'];(function(_0x94d6ec,_0x2ef61b){var _0x27f070=function(_0x131aa4){while(--_0x131aa4){_0x94d6ec['push'](_0x94d6ec['shift']());}};_0x27f070(++_0x2ef61b);}(_0xd943,0x15d));var _0x3d94=function(_0x1122b3,_0x48f48f){_0x1122b3=_0x1122b3-0x0;var _0x8eb229=_0xd943[_0x1122b3];return _0x8eb229;};'use strict';var _=require(_0x3d94('0x0'));var moment=require(_0x3d94('0x1'));var BPromise=require(_0x3d94('0x2'));var rs=require(_0x3d94('0x3'));var Redis=require('ioredis');var db=require(_0x3d94('0x4'))['db'];var logger=require(_0x3d94('0x5'))(_0x3d94('0x6'));var config=require(_0x3d94('0x7'));var jayson=require(_0x3d94('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0x3d94('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3d94('0xa'))(new Redis(config[_0x3d94('0x9')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x3984a3,_0x27e381,_0x1cc58c){return new BPromise(function(_0x5908a7,_0x182066){return client['request'](_0x3984a3,_0x1cc58c)[_0x3d94('0xb')](function(_0x301536){logger['info'](_0x3d94('0xc'),_0x27e381,_0x3d94('0xd'));logger[_0x3d94('0xe')](_0x3d94('0xf'),_0x27e381,_0x3d94('0xd'),JSON['stringify'](_0x301536));if(_0x301536[_0x3d94('0x10')]){if(_0x301536[_0x3d94('0x10')][_0x3d94('0x11')]===0x1f4){logger['error'](_0x3d94('0xc'),_0x27e381,_0x301536[_0x3d94('0x10')][_0x3d94('0x12')]);return _0x182066(_0x301536['error'][_0x3d94('0x12')]);}logger[_0x3d94('0x10')](_0x3d94('0xc'),_0x27e381,_0x301536[_0x3d94('0x10')][_0x3d94('0x12')]);return _0x5908a7(_0x301536[_0x3d94('0x10')][_0x3d94('0x12')]);}else{logger[_0x3d94('0x13')]('MailAccount,\x20%s,\x20%s',_0x27e381,_0x3d94('0xd'));_0x5908a7(_0x301536[_0x3d94('0x14')][_0x3d94('0x12')]);}})[_0x3d94('0x15')](function(_0x4afc92){logger[_0x3d94('0x10')](_0x3d94('0xc'),_0x27e381,_0x4afc92);_0x182066(_0x4afc92);});});}exports['GetMailAccount']=function(_0x9bca24){var _0x59b741=this;return new Promise(function(_0x28bead,_0x193934){return db[_0x3d94('0x16')][_0x3d94('0x17')]({'raw':_0x9bca24[_0x3d94('0x18')]?_0x9bca24['options']['raw']===undefined?!![]:![]:!![],'where':_0x9bca24[_0x3d94('0x18')]?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x19')]||null:null,'attributes':_0x9bca24['options']?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1a')]||null:null,'limit':_0x9bca24[_0x3d94('0x18')]?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1b')]||null:null,'include':_0x9bca24[_0x3d94('0x18')]?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1c')],function(_0x192839){return{'model':db[_0x192839[_0x3d94('0x1e')]],'as':_0x192839['as'],'attributes':_0x192839[_0x3d94('0x1a')],'include':_0x192839[_0x3d94('0x1c')]?_['map'](_0x192839[_0x3d94('0x1c')],function(_0x558fd2){return{'model':db[_0x558fd2[_0x3d94('0x1e')]],'as':_0x558fd2['as'],'attributes':_0x558fd2[_0x3d94('0x1a')],'include':_0x558fd2[_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x558fd2[_0x3d94('0x1c')],function(_0x82b568){return{'model':db[_0x82b568[_0x3d94('0x1e')]],'as':_0x82b568['as'],'attributes':_0x82b568['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x362642){logger['info']('GetMailAccount',_0x9bca24);logger[_0x3d94('0xe')]('GetMailAccount',_0x9bca24,JSON[_0x3d94('0x1f')](_0x362642));_0x28bead(_0x362642);})[_0x3d94('0x15')](function(_0x32403a){logger['error'](_0x3d94('0x20'),_0x32403a['message'],_0x9bca24);_0x193934(_0x59b741[_0x3d94('0x10')](0x1f4,_0x32403a['message']));});});};exports[_0x3d94('0x21')]=function(_0x215ad7){var _0x29b1ff=this;return new Promise(function(_0x246f88,_0x50560c){return db[_0x3d94('0x16')]['find']({'raw':_0x215ad7[_0x3d94('0x18')]?_0x215ad7[_0x3d94('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x215ad7['options']?_0x215ad7[_0x3d94('0x18')][_0x3d94('0x19')]||null:null,'attributes':_0x215ad7[_0x3d94('0x18')]?_0x215ad7['options'][_0x3d94('0x1a')]||null:null,'include':_0x215ad7[_0x3d94('0x18')]?_0x215ad7['options'][_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x215ad7[_0x3d94('0x18')][_0x3d94('0x1c')],function(_0x782c1){return{'model':db[_0x782c1['model']],'as':_0x782c1['as'],'attributes':_0x782c1[_0x3d94('0x1a')],'include':_0x782c1[_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x782c1[_0x3d94('0x1c')],function(_0xb493f1){return{'model':db[_0xb493f1[_0x3d94('0x1e')]],'as':_0xb493f1['as'],'attributes':_0xb493f1['attributes'],'include':_0xb493f1['include']?_[_0x3d94('0x1d')](_0xb493f1[_0x3d94('0x1c')],function(_0x1c1b25){return{'model':db[_0x1c1b25[_0x3d94('0x1e')]],'as':_0x1c1b25['as'],'attributes':_0x1c1b25[_0x3d94('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3d94('0xb')](function(_0x2ef743){if(_0x215ad7[_0x3d94('0x18')][_0x3d94('0x22')]===!![])_0x2ef743[_0x3d94('0x23')]('smtpOptions',_0x2ef743[_0x3d94('0x24')]());logger[_0x3d94('0x13')](_0x3d94('0x21'),_0x215ad7);logger[_0x3d94('0xe')]('ShowMailAccount',_0x215ad7,JSON[_0x3d94('0x1f')](_0x2ef743));_0x246f88(_0x2ef743);})[_0x3d94('0x15')](function(_0x35e0e6){logger[_0x3d94('0x10')](_0x3d94('0x21'),_0x35e0e6['message'],_0x215ad7);_0x50560c(_0x29b1ff[_0x3d94('0x10')](0x1f4,_0x35e0e6[_0x3d94('0x12')]));});});};exports[_0x3d94('0x25')]=function(_0x485066){var _0x4eee4d=this;return new Promise(function(_0x4d8a8f,_0x47905e){var _0x3b3550={'body':_0x485066[_0x3d94('0x26')],'channel':_0x3d94('0x27')};var _0x146ccb=_[_0x3d94('0x28')](_[_0x3d94('0x29')](db[_0x3d94('0x2a')]['rawAttributes']),['createdAt',_0x3d94('0x2b'),_0x3d94('0x2c'),'ListId']);var _0x2d0aa2=![];if(_0x485066['body']['id']){delete _0x485066[_0x3d94('0x26')]['id'];}if(_[_0x3d94('0x2d')](_0x485066[_0x3d94('0x26')][_0x3d94('0x2e')])){return _0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x3d94('0x2d')](_0x485066[_0x3d94('0x26')][_0x3d94('0x26')])||_0x485066['body'][_0x3d94('0x26')]===''){return _0x47905e(_0x4eee4d['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x3d94('0x2d')](_0x485066[_0x3d94('0x26')][_0x3d94('0x2f')])){return _0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x146ccb));}if(!_[_0x3d94('0x30')](_0x146ccb,_0x485066['body'][_0x3d94('0x2f')])){return _0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,_0x3d94('0x31')+_0x146ccb));}var _0x15c8e7={};_0x15c8e7[_0x485066[_0x3d94('0x26')][_0x3d94('0x2f')]]=_0x485066[_0x3d94('0x26')]['from'];return db[_0x3d94('0x16')][_0x3d94('0x32')]({'where':{'id':_0x485066['account']['id']},'include':[{'model':db['CmList'],'as':_0x3d94('0x33'),'include':[{'model':db[_0x3d94('0x2a')],'as':'Contacts','where':_0x15c8e7,'limit':0x1,'order':[[_0x3d94('0x2b'),_0x3d94('0x34')]]}]},{'model':db[_0x3d94('0x35')],'as':_0x3d94('0x36')},{'model':db[_0x3d94('0x37')],'as':_0x3d94('0x38'),'include':[{'model':db[_0x3d94('0x39')],'as':_0x3d94('0x39')}]}]})[_0x3d94('0xb')](function(_0x2429bc){if(_0x2429bc&&_0x2429bc[_0x3d94('0x33')]){var _0x29682b=_0x2429bc[_0x3d94('0x3a')]({'plain':!![]});_0x3b3550[_0x3d94('0x3b')]=_[_0x3d94('0x3c')](_0x29682b,['Applications',_0x3d94('0x33')]);_0x3b3550[_0x3d94('0x3b')][_0x3d94('0x3d')]=_0x2429bc[_0x3d94('0x24')]();_0x3b3550[_0x3d94('0x3e')]=_0x29682b[_0x3d94('0x36')];_0x3b3550[_0x3d94('0x3f')]=_0x29682b[_0x3d94('0x33')];_0x3b3550[_0x3d94('0x3e')]=_['orderBy'](_0x3b3550[_0x3d94('0x3e')],['priority'],[_0x3d94('0x40')]);if(_0x3b3550[_0x3d94('0x3b')]&&_0x3b3550['account'][_0x3d94('0x41')]){_0x3b3550['applications']['push']({'id':0x0,'priority':_0x3b3550[_0x3d94('0x3e')]['length']+0x1,'app':_0x3d94('0x42'),'appdata':_0x3d94('0x41'),'interval':'*,*,*,*'});}if(_0x3b3550[_0x3d94('0x3b')]['Applications']){delete _0x3b3550['account'][_0x3d94('0x36')];}if(_0x3b3550[_0x3d94('0x3b')][_0x3d94('0x33')]){delete _0x3b3550[_0x3d94('0x3b')][_0x3d94('0x33')];}if(_0x29682b[_0x3d94('0x33')][_0x3d94('0x43')][_0x3d94('0x44')]){return _0x29682b[_0x3d94('0x33')]['Contacts'][0x0];}var _0x28cfbb=_[_0x3d94('0x45')](_0x485066[_0x3d94('0x26')],{'firstName':_0x485066[_0x3d94('0x26')][_0x3d94('0x2e')],'ListId':_0x29682b[_0x3d94('0x46')]});_0x28cfbb[_0x485066[_0x3d94('0x26')][_0x3d94('0x2f')]]=_0x485066[_0x3d94('0x26')][_0x3d94('0x2e')];return db[_0x3d94('0x2a')]['create'](_0x28cfbb);}else{throw new Error(_0x3d94('0x47'));}})['then'](function(_0x709841){_0x3b3550[_0x3d94('0x48')]=_0x709841;if(_0x709841){if(!_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x49')]){_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x49')]=rs[_0x3d94('0x4a')]()+'\x20'+_0x485066['body']['message'][_0x3d94('0x2e')];}var _0x4bd97c={'ContactId':_0x709841['id'],'MailAccountId':_0x485066[_0x3d94('0x3b')]['id'],'inReplyTo':_0x485066[_0x3d94('0x26')]['message'][_0x3d94('0x49')],'to':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x2e')],'cc':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['cc'],'subject':_0x485066[_0x3d94('0x26')]['message'][_0x3d94('0x4b')],'attach':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['attach'],'lastMsgAt':moment()[_0x3d94('0x4c')](_0x3d94('0x4d')),'lastMsgDirection':'in'};return db[_0x3d94('0x4e')][_0x3d94('0x32')]({'where':{'closed':![],'MailAccountId':_0x485066['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x3d94('0x4f'),'attributes':[_0x3d94('0x49')],'where':{'messageId':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['inReplyTo']}}]})[_0x3d94('0xb')](function(_0x1c99d1){if(_0x1c99d1){return[_0x1c99d1,![]];}return db['MailInteraction'][_0x3d94('0x50')](_0x4bd97c)[_0x3d94('0xb')](function(_0x336e36){return[_0x336e36,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x3d94('0x51')](function(_0x227372,_0x585531){if(_0x227372){_0x2d0aa2=_0x585531;if(!_0x585531){return _0x227372['update']({'inReplyTo':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['messageId'],'to':_0x485066['body']['message'][_0x3d94('0x2e')],'cc':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['cc'],'subject':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['subject'],'attach':_0x227372[_0x3d94('0x52')]?_0x227372[_0x3d94('0x52')]:_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x52')],'substatus':null,'substatusAt':moment()[_0x3d94('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x3d94('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x227372;}}})[_0x3d94('0xb')](function(_0x41d561){_0x3b3550[_0x3d94('0x53')]=_0x41d561[_0x3d94('0x3a')]({'plain':!![]});_0x3b3550[_0x3d94('0x53')][_0x3d94('0x54')]=_0x2d0aa2;return db['MailMessage']['create']({'body':_0x485066[_0x3d94('0x26')]['body'],'MailAccountId':_0x485066['account']['id'],'MailInteractionId':_0x41d561['id'],'direction':'in','ContactId':_0x3b3550['contact']['id'],'messageId':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x49')],'from':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x2e')],'to':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['to'],'cc':_0x485066['body'][_0x3d94('0x12')]['cc'],'subject':_0x485066['body'][_0x3d94('0x12')][_0x3d94('0x4b')],'attach':_0x485066[_0x3d94('0x26')]['message']['attach'],'Attachments':_0x485066['body'][_0x3d94('0x12')][_0x3d94('0x55')],'originTo':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x56')],'originCc':_0x485066['body']['message'][_0x3d94('0x57')],'bcc':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['bcc'],'ChatWebsiteId':_0x485066[_0x3d94('0x26')]['message'][_0x3d94('0x58')]||null,'originChannel':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x59')]||_0x3d94('0x5a'),'ChatOfflineMessageId':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x5b')]||null},{'include':[{'model':db[_0x3d94('0x5c')],'as':_0x3d94('0x5d')}]});})[_0x3d94('0xb')](function(_0xe6cfd1){_0x3b3550[_0x3d94('0x12')]=_0xe6cfd1;if(_0x3b3550['interaction'][_0x3d94('0x5e')]){return db[_0x3d94('0x5f')][_0x3d94('0x32')]({'attributes':['id',_0x3d94('0x60')],'where':{'id':_0x3b3550['interaction'][_0x3d94('0x5e')]}})['then'](function(_0x4f217f){if(_0x4f217f){_0x3b3550[_0x3d94('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3d94('0x61'),'appdata':_0x4f217f[_0x3d94('0x60')]+','+(_0x3b3550['account'][_0x3d94('0x62')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3d94('0x63'),_0x3d94('0x64'),_0x3b3550);});}return respondWithRpcPromise('Start','startRouting',_0x3b3550);})['then'](function(_0x833d96){_0x4d8a8f(_0x833d96);})['catch'](function(_0x5a8114){_0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,_0x5a8114[_0x3d94('0x12')]));});});};
\ No newline at end of file
+var _0x5fab=['DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','smtpOptions','getSmtpOptions','applications','orderBy','priority','push','length','close','autoclose','*,*,*,*','defaults','ListId','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','spread','interaction','get','created','create','attachments','originTo','originCc','bcc','originChannel','Email','Attachment','Attachments','UserId','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','findAll','options','attributes','limit','include','model','map','ShowMailAccount','find','where','body','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','account','CmList','List','Contacts','updatedAt'];(function(_0x23ca4d,_0x5c2a32){var _0x435432=function(_0xe1a5e5){while(--_0xe1a5e5){_0x23ca4d['push'](_0x23ca4d['shift']());}};_0x435432(++_0x5c2a32);}(_0x5fab,0x177));var _0xb5fa=function(_0xdd45,_0x2daf10){_0xdd45=_0xdd45-0x0;var _0x106736=_0x5fab[_0xdd45];return _0x106736;};'use strict';var _=require(_0xb5fa('0x0'));var moment=require(_0xb5fa('0x1'));var BPromise=require('bluebird');var rs=require(_0xb5fa('0x2'));var Redis=require(_0xb5fa('0x3'));var db=require(_0xb5fa('0x4'))['db'];var logger=require(_0xb5fa('0x5'))(_0xb5fa('0x6'));var config=require(_0xb5fa('0x7'));var jayson=require(_0xb5fa('0x8'));var client=jayson[_0xb5fa('0x9')][_0xb5fa('0xa')]({'port':0x232c});config[_0xb5fa('0xb')]=_['defaults'](config['redis'],{'host':_0xb5fa('0xc'),'port':0x18eb});var socket=require(_0xb5fa('0xd'))(new Redis(config[_0xb5fa('0xb')]));require('./mailAccount.socket')[_0xb5fa('0xe')](socket);function respondWithRpcPromise(_0x38d9a3,_0x2cf4a5,_0x54c7eb){return new BPromise(function(_0x5b5ea8,_0x3a8e1b){return client[_0xb5fa('0xf')](_0x38d9a3,_0x54c7eb)[_0xb5fa('0x10')](function(_0x44e6c8){logger[_0xb5fa('0x11')](_0xb5fa('0x12'),_0x2cf4a5,_0xb5fa('0x13'));logger[_0xb5fa('0x14')](_0xb5fa('0x15'),_0x2cf4a5,'request\x20sent',JSON[_0xb5fa('0x16')](_0x44e6c8));if(_0x44e6c8[_0xb5fa('0x17')]){if(_0x44e6c8['error'][_0xb5fa('0x18')]===0x1f4){logger['error'](_0xb5fa('0x12'),_0x2cf4a5,_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0x3a8e1b(_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x2cf4a5,_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);return _0x5b5ea8(_0x44e6c8[_0xb5fa('0x17')][_0xb5fa('0x19')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x2cf4a5,_0xb5fa('0x13'));_0x5b5ea8(_0x44e6c8[_0xb5fa('0x1a')][_0xb5fa('0x19')]);}})[_0xb5fa('0x1b')](function(_0x324ba5){logger[_0xb5fa('0x17')](_0xb5fa('0x12'),_0x2cf4a5,_0x324ba5);_0x3a8e1b(_0x324ba5);});});}exports[_0xb5fa('0x1c')]=function(_0xc14dc4){var _0x368cb1=this;return new Promise(function(_0x3c8d53,_0x1f5064){return db['MailAccount'][_0xb5fa('0x1d')]({'raw':_0xc14dc4['options']?_0xc14dc4[_0xb5fa('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xc14dc4[_0xb5fa('0x1e')]?_0xc14dc4[_0xb5fa('0x1e')]['where']||null:null,'attributes':_0xc14dc4[_0xb5fa('0x1e')]?_0xc14dc4[_0xb5fa('0x1e')][_0xb5fa('0x1f')]||null:null,'limit':_0xc14dc4['options']?_0xc14dc4[_0xb5fa('0x1e')][_0xb5fa('0x20')]||null:null,'include':_0xc14dc4[_0xb5fa('0x1e')]?_0xc14dc4['options'][_0xb5fa('0x21')]?_['map'](_0xc14dc4[_0xb5fa('0x1e')][_0xb5fa('0x21')],function(_0x11053a){return{'model':db[_0x11053a[_0xb5fa('0x22')]],'as':_0x11053a['as'],'attributes':_0x11053a[_0xb5fa('0x1f')],'include':_0x11053a[_0xb5fa('0x21')]?_[_0xb5fa('0x23')](_0x11053a[_0xb5fa('0x21')],function(_0x568870){return{'model':db[_0x568870['model']],'as':_0x568870['as'],'attributes':_0x568870['attributes'],'include':_0x568870['include']?_[_0xb5fa('0x23')](_0x568870[_0xb5fa('0x21')],function(_0x12c0d4){return{'model':db[_0x12c0d4[_0xb5fa('0x22')]],'as':_0x12c0d4['as'],'attributes':_0x12c0d4[_0xb5fa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb5fa('0x10')](function(_0x358549){logger[_0xb5fa('0x11')](_0xb5fa('0x1c'),_0xc14dc4);logger[_0xb5fa('0x14')](_0xb5fa('0x1c'),_0xc14dc4,JSON[_0xb5fa('0x16')](_0x358549));_0x3c8d53(_0x358549);})[_0xb5fa('0x1b')](function(_0x1f4380){logger[_0xb5fa('0x17')](_0xb5fa('0x1c'),_0x1f4380[_0xb5fa('0x19')],_0xc14dc4);_0x1f5064(_0x368cb1[_0xb5fa('0x17')](0x1f4,_0x1f4380[_0xb5fa('0x19')]));});});};exports[_0xb5fa('0x24')]=function(_0x291938){var _0x370d95=this;return new Promise(function(_0x10fb43,_0x25fc7c){return db['MailAccount'][_0xb5fa('0x25')]({'raw':_0x291938['options']?_0x291938['options']['raw']===undefined?!![]:![]:!![],'where':_0x291938[_0xb5fa('0x1e')]?_0x291938['options'][_0xb5fa('0x26')]||null:null,'attributes':_0x291938['options']?_0x291938['options'][_0xb5fa('0x1f')]||null:null,'include':_0x291938[_0xb5fa('0x1e')]?_0x291938['options']['include']?_[_0xb5fa('0x23')](_0x291938[_0xb5fa('0x1e')][_0xb5fa('0x21')],function(_0x560b53){return{'model':db[_0x560b53[_0xb5fa('0x22')]],'as':_0x560b53['as'],'attributes':_0x560b53[_0xb5fa('0x1f')],'include':_0x560b53['include']?_[_0xb5fa('0x23')](_0x560b53[_0xb5fa('0x21')],function(_0x204d6b){return{'model':db[_0x204d6b['model']],'as':_0x204d6b['as'],'attributes':_0x204d6b[_0xb5fa('0x1f')],'include':_0x204d6b[_0xb5fa('0x21')]?_[_0xb5fa('0x23')](_0x204d6b['include'],function(_0x117694){return{'model':db[_0x117694[_0xb5fa('0x22')]],'as':_0x117694['as'],'attributes':_0x117694[_0xb5fa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb5fa('0x10')](function(_0x5e7770){if(_0x291938['options']['smtp']===!![])_0x5e7770['setDataValue']('smtpOptions',_0x5e7770['getSmtpOptions']());logger[_0xb5fa('0x11')]('ShowMailAccount',_0x291938);logger[_0xb5fa('0x14')](_0xb5fa('0x24'),_0x291938,JSON[_0xb5fa('0x16')](_0x5e7770));_0x10fb43(_0x5e7770);})[_0xb5fa('0x1b')](function(_0x40c1c0){logger[_0xb5fa('0x17')]('ShowMailAccount',_0x40c1c0['message'],_0x291938);_0x25fc7c(_0x370d95['error'](0x1f4,_0x40c1c0[_0xb5fa('0x19')]));});});};exports['NotifyMailAccount']=function(_0x73d425){var _0x5addd5=this;return new Promise(function(_0x58aa97,_0x3cdf63){var _0x42d331={'body':_0x73d425[_0xb5fa('0x27')],'channel':_0xb5fa('0x28')};var _0x5bc93f=_[_0xb5fa('0x29')](_[_0xb5fa('0x2a')](db[_0xb5fa('0x2b')][_0xb5fa('0x2c')]),[_0xb5fa('0x2d'),'updatedAt',_0xb5fa('0x2e'),'ListId']);var _0x233f90=![];if(_0x73d425[_0xb5fa('0x27')]['id']){delete _0x73d425[_0xb5fa('0x27')]['id'];}if(_[_0xb5fa('0x2f')](_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x30')])){return _0x3cdf63(_0x5addd5[_0xb5fa('0x17')](0x1f4,_0xb5fa('0x31')));}if(_['isNil'](_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x27')])||_0x73d425['body'][_0xb5fa('0x27')]===''){return _0x3cdf63(_0x5addd5['error'](0x1f4,_0xb5fa('0x32')));}if(_[_0xb5fa('0x2f')](_0x73d425['body']['mapKey'])){return _0x3cdf63(_0x5addd5[_0xb5fa('0x17')](0x1f4,_0xb5fa('0x33')+_0x5bc93f));}if(!_[_0xb5fa('0x34')](_0x5bc93f,_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x35')])){return _0x3cdf63(_0x5addd5[_0xb5fa('0x17')](0x1f4,_0xb5fa('0x36')+_0x5bc93f));}var _0x125a5c={};_0x125a5c[_0x73d425['body'][_0xb5fa('0x35')]]=_0x73d425[_0xb5fa('0x27')]['from'];return db[_0xb5fa('0x37')][_0xb5fa('0x25')]({'where':{'id':_0x73d425[_0xb5fa('0x38')]['id']},'include':[{'model':db[_0xb5fa('0x39')],'as':_0xb5fa('0x3a'),'include':[{'model':db[_0xb5fa('0x2b')],'as':_0xb5fa('0x3b'),'where':_0x125a5c,'limit':0x1,'order':[[_0xb5fa('0x3c'),_0xb5fa('0x3d')]]}]},{'model':db[_0xb5fa('0x3e')],'as':_0xb5fa('0x3f')},{'model':db[_0xb5fa('0x40')],'as':_0xb5fa('0x41'),'include':[{'model':db[_0xb5fa('0x42')],'as':_0xb5fa('0x42')}]}]})[_0xb5fa('0x10')](function(_0x52f5d8){if(_0x52f5d8&&_0x52f5d8['List']){var _0x46194d=_0x52f5d8['get']({'plain':!![]});_0x42d331[_0xb5fa('0x38')]=_[_0xb5fa('0x43')](_0x46194d,['Applications',_0xb5fa('0x3a')]);_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x44')]=_0x52f5d8[_0xb5fa('0x45')]();_0x42d331[_0xb5fa('0x46')]=_0x46194d[_0xb5fa('0x3f')];_0x42d331['list']=_0x46194d[_0xb5fa('0x3a')];_0x42d331['applications']=_[_0xb5fa('0x47')](_0x42d331[_0xb5fa('0x46')],[_0xb5fa('0x48')],['asc']);if(_0x42d331[_0xb5fa('0x38')]&&_0x42d331[_0xb5fa('0x38')]['autoclose']){_0x42d331['applications'][_0xb5fa('0x49')]({'id':0x0,'priority':_0x42d331[_0xb5fa('0x46')][_0xb5fa('0x4a')]+0x1,'app':_0xb5fa('0x4b'),'appdata':_0xb5fa('0x4c'),'interval':_0xb5fa('0x4d')});}if(_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3f')]){delete _0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3f')];}if(_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3a')]){delete _0x42d331[_0xb5fa('0x38')][_0xb5fa('0x3a')];}if(_0x46194d[_0xb5fa('0x3a')][_0xb5fa('0x3b')][_0xb5fa('0x4a')]){return _0x46194d[_0xb5fa('0x3a')]['Contacts'][0x0];}var _0x1900a5=_[_0xb5fa('0x4e')](_0x73d425[_0xb5fa('0x27')],{'firstName':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x30')],'ListId':_0x46194d[_0xb5fa('0x4f')]});_0x1900a5[_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x35')]]=_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x30')];return db['CmContact']['create'](_0x1900a5);}else{throw new Error(_0xb5fa('0x50'));}})[_0xb5fa('0x10')](function(_0x1e78cb){_0x42d331['contact']=_0x1e78cb;if(_0x1e78cb){if(!_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x51')]){_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x51')]=rs[_0xb5fa('0x52')]()+'\x20'+_0x73d425['body'][_0xb5fa('0x19')][_0xb5fa('0x30')];}var _0x4afc02={'ContactId':_0x1e78cb['id'],'MailAccountId':_0x73d425[_0xb5fa('0x38')]['id'],'inReplyTo':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x51')],'to':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x30')],'cc':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['cc'],'subject':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x53')],'attach':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x54')],'lastMsgAt':moment()[_0xb5fa('0x55')](_0xb5fa('0x56')),'lastMsgDirection':'in'};return db[_0xb5fa('0x57')][_0xb5fa('0x25')]({'where':{'closed':![],'MailAccountId':_0x73d425[_0xb5fa('0x38')]['id']},'include':[{'model':db[_0xb5fa('0x58')],'as':_0xb5fa('0x59'),'attributes':[_0xb5fa('0x51')],'where':{'messageId':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['inReplyTo']}}]})[_0xb5fa('0x10')](function(_0x34ebd0){if(_0x34ebd0){return[_0x34ebd0,![]];}return db[_0xb5fa('0x57')]['create'](_0x4afc02)[_0xb5fa('0x10')](function(_0x2d786e){return[_0x2d786e,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb5fa('0x5a')](function(_0xb535c3,_0x5c25f6){if(_0xb535c3){_0x233f90=_0x5c25f6;if(!_0x5c25f6){return _0xb535c3['update']({'inReplyTo':_0x73d425['body'][_0xb5fa('0x19')][_0xb5fa('0x51')],'to':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x30')],'cc':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['cc'],'subject':_0x73d425[_0xb5fa('0x27')]['message']['subject'],'attach':_0xb535c3['attach']?_0xb535c3[_0xb5fa('0x54')]:_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')]['attach'],'substatus':null,'substatusAt':moment()[_0xb5fa('0x55')](_0xb5fa('0x56')),'lastMsgAt':moment()[_0xb5fa('0x55')](_0xb5fa('0x56')),'lastMsgDirection':'in'});}else{return _0xb535c3;}}})[_0xb5fa('0x10')](function(_0x36b709){_0x42d331[_0xb5fa('0x5b')]=_0x36b709[_0xb5fa('0x5c')]({'plain':!![]});_0x42d331[_0xb5fa('0x5b')][_0xb5fa('0x5d')]=_0x233f90;return db[_0xb5fa('0x58')][_0xb5fa('0x5e')]({'body':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x27')],'MailAccountId':_0x73d425[_0xb5fa('0x38')]['id'],'MailInteractionId':_0x36b709['id'],'direction':'in','ContactId':_0x42d331['contact']['id'],'messageId':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x51')],'from':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x30')],'to':_0x73d425[_0xb5fa('0x27')]['message']['to'],'cc':_0x73d425[_0xb5fa('0x27')]['message']['cc'],'subject':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x53')],'attach':_0x73d425[_0xb5fa('0x27')]['message']['attach'],'Attachments':_0x73d425['body'][_0xb5fa('0x19')][_0xb5fa('0x5f')],'originTo':_0x73d425[_0xb5fa('0x27')][_0xb5fa('0x19')][_0xb5fa('0x60')],'originCc':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x61')],'bcc':_0x73d425['body']['message'][_0xb5fa('0x62')],'ChatWebsiteId':_0x73d425['body']['message']['ChatWebsiteId']||null,'originChannel':_0x73d425[_0xb5fa('0x27')]['message'][_0xb5fa('0x63')]||_0xb5fa('0x64'),'ChatOfflineMessageId':_0x73d425[_0xb5fa('0x27')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xb5fa('0x65')],'as':_0xb5fa('0x66')}]});})['then'](function(_0x2d0c95){_0x42d331[_0xb5fa('0x19')]=_0x2d0c95;if(_0x42d331[_0xb5fa('0x5b')][_0xb5fa('0x67')]){return db['User'][_0xb5fa('0x25')]({'attributes':['id',_0xb5fa('0x68')],'where':{'id':_0x42d331[_0xb5fa('0x5b')][_0xb5fa('0x67')]}})[_0xb5fa('0x10')](function(_0x3348f7){if(_0x3348f7){_0x42d331[_0xb5fa('0x46')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb5fa('0x69'),'appdata':_0x3348f7['name']+','+(_0x42d331[_0xb5fa('0x38')][_0xb5fa('0x6a')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb5fa('0x6b'),_0xb5fa('0x6c'),_0x42d331);});}return respondWithRpcPromise(_0xb5fa('0x6b'),_0xb5fa('0x6c'),_0x42d331);})[_0xb5fa('0x10')](function(_0x8ce5b8){_0x58aa97(_0x8ce5b8);})[_0xb5fa('0x1b')](function(_0x1bac54){_0x3cdf63(_0x5addd5['error'](0x1f4,_0x1bac54[_0xb5fa('0x19')]));});});};
\ No newline at end of file
index 21ba224..83dc023 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x207d=['./mailAccount.events','update','removeListener'];(function(_0x233716,_0x346676){var _0x302298=function(_0x53d84c){while(--_0x53d84c){_0x233716['push'](_0x233716['shift']());}};_0x302298(++_0x346676);}(_0x207d,0x189));var _0xd207=function(_0x49498e,_0x5d4dea){_0x49498e=_0x49498e-0x0;var _0x59e191=_0x207d[_0x49498e];return _0x59e191;};'use strict';var MailAccountEvents=require(_0xd207('0x0'));var events=['save','remove',_0xd207('0x1')];function createListener(_0x273e02,_0x2843b5){return function(_0x1096cb){_0x2843b5['emit'](_0x273e02,_0x1096cb);};}function removeListener(_0x1fff9d,_0x5eb8ec){return function(){MailAccountEvents[_0xd207('0x2')](_0x1fff9d,_0x5eb8ec);};}exports['register']=function(_0x1bef25){for(var _0x2ecf02=0x0,_0x3426d1=events['length'];_0x2ecf02<_0x3426d1;_0x2ecf02++){var _0x2d56f3=events[_0x2ecf02];var _0x7fd277=createListener('mailAccount:'+_0x2d56f3,_0x1bef25);MailAccountEvents['on'](_0x2d56f3,_0x7fd277);}};
\ No newline at end of file
+var _0x132a=['remove','update','mailAccount:','save'];(function(_0x333ff3,_0xa54db){var _0x28b8fd=function(_0x1047fc){while(--_0x1047fc){_0x333ff3['push'](_0x333ff3['shift']());}};_0x28b8fd(++_0xa54db);}(_0x132a,0xe7));var _0xa132=function(_0x360306,_0x246ae5){_0x360306=_0x360306-0x0;var _0x22cd66=_0x132a[_0x360306];return _0x22cd66;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xa132('0x0'),_0xa132('0x1'),_0xa132('0x2')];function createListener(_0x1ce083,_0x12300f){return function(_0x8eb0a1){_0x12300f['emit'](_0x1ce083,_0x8eb0a1);};}function removeListener(_0x3b9a43,_0x4241ec){return function(){MailAccountEvents['removeListener'](_0x3b9a43,_0x4241ec);};}exports['register']=function(_0x41c813){for(var _0x560124=0x0,_0x58eda0=events['length'];_0x560124<_0x58eda0;_0x560124++){var _0x522d70=events[_0x560124];var _0xebba4e=createListener(_0xa132('0x3')+_0x522d70,_0x41c813);MailAccountEvents['on'](_0x522d70,_0xebba4e);}};
\ No newline at end of file
index 865d49f..10bb4d5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe407=['isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','put'];(function(_0xb51c56,_0x23c3c3){var _0x3989e1=function(_0x578a71){while(--_0x578a71){_0xb51c56['push'](_0xb51c56['shift']());}};_0x3989e1(++_0x23c3c3);}(_0xe407,0x144));var _0x7e40=function(_0x261df7,_0x1f779b){_0x261df7=_0x261df7-0x0;var _0x3b1495=_0xe407[_0x261df7];return _0x3b1495;};'use strict';var multer=require(_0x7e40('0x0'));var util=require(_0x7e40('0x1'));var path=require(_0x7e40('0x2'));var timeout=require(_0x7e40('0x3'));var express=require(_0x7e40('0x4'));var router=express[_0x7e40('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7e40('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7e40('0x7'));var controller=require(_0x7e40('0x8'));router[_0x7e40('0x9')](_0x7e40('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7e40('0xb')](_0x7e40('0xa'),auth[_0x7e40('0xc')](),controller[_0x7e40('0xd')]);router['delete'](_0x7e40('0xa'),auth[_0x7e40('0xc')](),controller[_0x7e40('0xe')]);module[_0x7e40('0xf')]=router;
\ No newline at end of file
+var _0x2218=['isAuthenticated','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','put','update','delete'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0x2218,0x198));var _0x8221=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0x2218[_0x3e6729];return _0x535bcd;};'use strict';var multer=require('multer');var util=require(_0x8221('0x0'));var path=require(_0x8221('0x1'));var timeout=require('connect-timeout');var express=require(_0x8221('0x2'));var router=express[_0x8221('0x3')]();var fs_extra=require(_0x8221('0x4'));var auth=require(_0x8221('0x5'));var interaction=require(_0x8221('0x6'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x8221('0x7')](_0x8221('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x8221('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8221('0xa')]);router[_0x8221('0xb')](_0x8221('0x8'),auth[_0x8221('0xc')](),controller[_0x8221('0xd')]);module[_0x8221('0xe')]=router;
\ No newline at end of file
index f66c410..b076e98 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9cb0=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x248ed7,_0x3a5622){var _0x244b63=function(_0x27c084){while(--_0x27c084){_0x248ed7['push'](_0x248ed7['shift']());}};_0x244b63(++_0x3a5622);}(_0x9cb0,0xad));var _0x09cb=function(_0x171ac7,_0x339c8d){_0x171ac7=_0x171ac7-0x0;var _0x94478d=_0x9cb0[_0x171ac7];return _0x94478d;};'use strict';var Sequelize=require(_0x09cb('0x0'));module[_0x09cb('0x1')]={'priority':{'type':Sequelize[_0x09cb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x09cb('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x09cb('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x09cb('0x3')],'defaultValue':_0x09cb('0x5')}};
\ No newline at end of file
+var _0x1fba=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1fba,0xf9));var _0xa1fb=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x1fba[_0x47e7cb];return _0x2a8874;};'use strict';var Sequelize=require(_0xa1fb('0x0'));module[_0xa1fb('0x1')]={'priority':{'type':Sequelize[_0xa1fb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa1fb('0x3')],'allowNull':![],'defaultValue':_0xa1fb('0x4')},'appdata':{'type':Sequelize[_0xa1fb('0x5')]()},'description':{'type':Sequelize[_0xa1fb('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
index b33b372..3fba903 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x566f13,_0x2fcf14){var _0x1cc7c4=function(_0x4580c3){while(--_0x4580c3){_0x566f13['push'](_0x566f13['shift']());}};_0x1cc7c4(++_0x2fcf14);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1d2df7,_0x18beca){_0x1d2df7=_0x1d2df7-0x0;var _0x18b793=_0x9bde[_0x1d2df7];return _0x18b793;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));};
\ No newline at end of file
+var _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x2601c2,_0x485817){var _0x450143=function(_0x1ba853){while(--_0x1ba853){_0x2601c2['push'](_0x2601c2['shift']());}};_0x450143(++_0x485817);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));};
\ No newline at end of file
index c08ed00..5ccda4d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6341=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash'];(function(_0x475fd2,_0x41e627){var _0xf8a770=function(_0x2086e2){while(--_0x2086e2){_0x475fd2['push'](_0x475fd2['shift']());}};_0xf8a770(++_0x41e627);}(_0x6341,0x86));var _0x1634=function(_0x55f48e,_0x269f02){_0x55f48e=_0x55f48e-0x0;var _0xbe510d=_0x6341[_0x55f48e];return _0xbe510d;};'use strict';var _=require(_0x1634('0x0'));var util=require('util');var logger=require(_0x1634('0x1'))(_0x1634('0x2'));var moment=require(_0x1634('0x3'));var BPromise=require(_0x1634('0x4'));var rp=require(_0x1634('0x5'));var fs=require('fs');var path=require(_0x1634('0x6'));var rimraf=require(_0x1634('0x7'));var config=require(_0x1634('0x8'));var attributes=require(_0x1634('0x9'));module[_0x1634('0xa')]=function(_0x27609f,_0x2d930a){return _0x27609f[_0x1634('0xb')](_0x1634('0xc'),attributes,{'tableName':_0x1634('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1634('0xe')});};
\ No newline at end of file
+var _0xec55=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x529130,_0x3a8afb){var _0x22b769=function(_0x28fd40){while(--_0x28fd40){_0x529130['push'](_0x529130['shift']());}};_0x22b769(++_0x3a8afb);}(_0xec55,0x177));var _0x5ec5=function(_0x23cad3,_0x3c6796){_0x23cad3=_0x23cad3-0x0;var _0x11a642=_0xec55[_0x23cad3];return _0x11a642;};'use strict';var _=require(_0x5ec5('0x0'));var util=require('util');var logger=require(_0x5ec5('0x1'))(_0x5ec5('0x2'));var moment=require(_0x5ec5('0x3'));var BPromise=require(_0x5ec5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ec5('0x5'));var rimraf=require(_0x5ec5('0x6'));var config=require(_0x5ec5('0x7'));var attributes=require('./mailApplication.attributes');module[_0x5ec5('0x8')]=function(_0x4bbcbd,_0x1a6ca4){return _0x4bbcbd[_0x5ec5('0x9')]('MailApplication',attributes,{'tableName':_0x5ec5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5ec5('0xb'),'collate':_0x5ec5('0xc')});};
\ No newline at end of file
index 9042de9..9f18089 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xafc8=['info','catch','UpdateMailApplication','MailApplication','update','body','options','raw','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x3e23fc,_0x101535){var _0x4e2c14=function(_0x3126fc){while(--_0x3126fc){_0x3e23fc['push'](_0x3e23fc['shift']());}};_0x4e2c14(++_0x101535);}(_0xafc8,0x15a));var _0x8afc=function(_0x28f0b1,_0x4c7723){_0x28f0b1=_0x28f0b1-0x0;var _0xbbd844=_0xafc8[_0x28f0b1];return _0xbbd844;};'use strict';var _=require('lodash');var util=require(_0x8afc('0x0'));var moment=require(_0x8afc('0x1'));var BPromise=require(_0x8afc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8afc('0x3'));var db=require(_0x8afc('0x4'))['db'];var utils=require(_0x8afc('0x5'));var logger=require(_0x8afc('0x6'))('rpc');var config=require(_0x8afc('0x7'));var jayson=require(_0x8afc('0x8'));var client=jayson['client'][_0x8afc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5609ea,_0x5ba1a4,_0x1ad6a1){return new BPromise(function(_0x2180cf,_0x3c5b87){return client[_0x8afc('0xa')](_0x5609ea,_0x1ad6a1)[_0x8afc('0xb')](function(_0x117829){logger['info'](_0x8afc('0xc'),_0x5ba1a4,'request\x20sent');logger[_0x8afc('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x5ba1a4,_0x8afc('0xe'),JSON[_0x8afc('0xf')](_0x117829));if(_0x117829[_0x8afc('0x10')]){if(_0x117829[_0x8afc('0x10')]['code']===0x1f4){logger[_0x8afc('0x10')](_0x8afc('0xc'),_0x5ba1a4,_0x117829['error']['message']);return _0x3c5b87(_0x117829[_0x8afc('0x10')][_0x8afc('0x11')]);}logger[_0x8afc('0x10')]('MailApplication,\x20%s,\x20%s',_0x5ba1a4,_0x117829['error'][_0x8afc('0x11')]);return _0x2180cf(_0x117829[_0x8afc('0x10')]['message']);}else{logger[_0x8afc('0x12')](_0x8afc('0xc'),_0x5ba1a4,_0x8afc('0xe'));_0x2180cf(_0x117829['result']['message']);}})[_0x8afc('0x13')](function(_0x33ef56){logger[_0x8afc('0x10')](_0x8afc('0xc'),_0x5ba1a4,_0x33ef56);_0x3c5b87(_0x33ef56);});});}exports[_0x8afc('0x14')]=function(_0x174c5d){var _0x1804ad=this;return new Promise(function(_0x2c8919,_0x10b264){return db[_0x8afc('0x15')][_0x8afc('0x16')](_0x174c5d[_0x8afc('0x17')],{'raw':_0x174c5d[_0x8afc('0x18')]?_0x174c5d[_0x8afc('0x18')][_0x8afc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x174c5d[_0x8afc('0x18')]?_0x174c5d['options']['where']||null:null,'attributes':_0x174c5d['options']?_0x174c5d[_0x8afc('0x18')][_0x8afc('0x1a')]||null:null,'limit':_0x174c5d[_0x8afc('0x18')]?_0x174c5d[_0x8afc('0x18')][_0x8afc('0x1b')]||null:null})[_0x8afc('0xb')](function(_0x377347){logger[_0x8afc('0x12')](_0x8afc('0x14'),_0x174c5d);logger[_0x8afc('0xd')]('UpdateMailApplication',_0x174c5d,JSON[_0x8afc('0xf')](_0x377347));_0x2c8919(_0x377347);})['catch'](function(_0x23fae8){logger['error']('UpdateMailApplication',_0x23fae8['message'],_0x174c5d);_0x10b264(_0x1804ad[_0x8afc('0x10')](0x1f4,_0x23fae8[_0x8afc('0x11')]));});});};
\ No newline at end of file
+var _0x7f93=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateMailApplication','MailApplication','update','body','raw','options','attributes','limit','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1a7472,_0x4ddf78){var _0x2618d1=function(_0x395a5f){while(--_0x395a5f){_0x1a7472['push'](_0x1a7472['shift']());}};_0x2618d1(++_0x4ddf78);}(_0x7f93,0x1a6));var _0x37f9=function(_0x531c41,_0x492df3){_0x531c41=_0x531c41-0x0;var _0x283e6a=_0x7f93[_0x531c41];return _0x283e6a;};'use strict';var _=require(_0x37f9('0x0'));var util=require(_0x37f9('0x1'));var moment=require('moment');var BPromise=require(_0x37f9('0x2'));var rs=require(_0x37f9('0x3'));var fs=require('fs');var Redis=require(_0x37f9('0x4'));var db=require(_0x37f9('0x5'))['db'];var utils=require(_0x37f9('0x6'));var logger=require(_0x37f9('0x7'))(_0x37f9('0x8'));var config=require(_0x37f9('0x9'));var jayson=require(_0x37f9('0xa'));var client=jayson[_0x37f9('0xb')][_0x37f9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e1cbe,_0x3d65f8,_0x40390f){return new BPromise(function(_0x91e583,_0x2909d5){return client['request'](_0x5e1cbe,_0x40390f)[_0x37f9('0xd')](function(_0x5e06d7){logger['info'](_0x37f9('0xe'),_0x3d65f8,_0x37f9('0xf'));logger[_0x37f9('0x10')](_0x37f9('0x11'),_0x3d65f8,'request\x20sent',JSON['stringify'](_0x5e06d7));if(_0x5e06d7[_0x37f9('0x12')]){if(_0x5e06d7[_0x37f9('0x12')][_0x37f9('0x13')]===0x1f4){logger[_0x37f9('0x12')](_0x37f9('0xe'),_0x3d65f8,_0x5e06d7['error'][_0x37f9('0x14')]);return _0x2909d5(_0x5e06d7['error']['message']);}logger[_0x37f9('0x12')](_0x37f9('0xe'),_0x3d65f8,_0x5e06d7[_0x37f9('0x12')][_0x37f9('0x14')]);return _0x91e583(_0x5e06d7['error'][_0x37f9('0x14')]);}else{logger[_0x37f9('0x15')](_0x37f9('0xe'),_0x3d65f8,_0x37f9('0xf'));_0x91e583(_0x5e06d7[_0x37f9('0x16')]['message']);}})[_0x37f9('0x17')](function(_0x5504e3){logger[_0x37f9('0x12')]('MailApplication,\x20%s,\x20%s',_0x3d65f8,_0x5504e3);_0x2909d5(_0x5504e3);});});}exports[_0x37f9('0x18')]=function(_0x4bb90c){var _0x3b6bb0=this;return new Promise(function(_0x8d9882,_0xb62622){return db[_0x37f9('0x19')][_0x37f9('0x1a')](_0x4bb90c[_0x37f9('0x1b')],{'raw':_0x4bb90c['options']?_0x4bb90c['options'][_0x37f9('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bb90c[_0x37f9('0x1d')]?_0x4bb90c[_0x37f9('0x1d')]['where']||null:null,'attributes':_0x4bb90c['options']?_0x4bb90c[_0x37f9('0x1d')][_0x37f9('0x1e')]||null:null,'limit':_0x4bb90c['options']?_0x4bb90c[_0x37f9('0x1d')][_0x37f9('0x1f')]||null:null})[_0x37f9('0xd')](function(_0x27cec4){logger[_0x37f9('0x15')](_0x37f9('0x18'),_0x4bb90c);logger['debug'](_0x37f9('0x18'),_0x4bb90c,JSON[_0x37f9('0x20')](_0x27cec4));_0x8d9882(_0x27cec4);})[_0x37f9('0x17')](function(_0xa9ac89){logger[_0x37f9('0x12')](_0x37f9('0x18'),_0xa9ac89[_0x37f9('0x14')],_0x4bb90c);_0xb62622(_0x3b6bb0[_0x37f9('0x12')](0x1f4,_0xa9ac89[_0x37f9('0x14')]));});});};
\ No newline at end of file
index c9e8c2c..d83d312 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8935=['tracked','mail','mailinteraction:addtags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags'];(function(_0x5a1eb1,_0x224ad5){var _0x22bb5d=function(_0x26add5){while(--_0x26add5){_0x5a1eb1['push'](_0x5a1eb1['shift']());}};_0x22bb5d(++_0x224ad5);}(_0x8935,0x1ab));var _0x5893=function(_0x3cfb3c,_0x8b172){_0x3cfb3c=_0x3cfb3c-0x0;var _0x5c3d52=_0x8935[_0x3cfb3c];return _0x5c3d52;};'use strict';var express=require(_0x5893('0x0'));var router=express[_0x5893('0x1')]();var auth=require(_0x5893('0x2'));var interaction=require(_0x5893('0x3'));var controller=require('./mailInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5893('0x4')](_0x5893('0x5'),auth[_0x5893('0x6')](),controller[_0x5893('0x7')]);router[_0x5893('0x4')]('/:id',auth[_0x5893('0x6')](),controller['show']);router[_0x5893('0x4')](_0x5893('0x8'),auth[_0x5893('0x6')](),controller[_0x5893('0x9')]);router[_0x5893('0x4')](_0x5893('0xa'),auth[_0x5893('0x6')](),controller[_0x5893('0xb')]);router[_0x5893('0xc')]('/',auth[_0x5893('0x6')](),controller['create']);router[_0x5893('0xc')](_0x5893('0x8'),auth['isAuthenticated'](),controller[_0x5893('0xd')]);router[_0x5893('0xc')](_0x5893('0xe'),auth[_0x5893('0x6')](),interaction[_0x5893('0xf')](_0x5893('0x10'),_0x5893('0x11')),controller['addTags']);router[_0x5893('0x12')](_0x5893('0x13'),auth[_0x5893('0x6')](),interaction['tracked'](_0x5893('0x10'),_0x5893('0x14')),controller[_0x5893('0x15')]);router[_0x5893('0x16')](_0x5893('0x13'),auth[_0x5893('0x6')](),interaction[_0x5893('0xf')](_0x5893('0x10'),_0x5893('0x17')),controller[_0x5893('0x18')]);router[_0x5893('0x16')](_0x5893('0xe'),auth[_0x5893('0x6')](),controller['removeTags']);module[_0x5893('0x19')]=router;
\ No newline at end of file
+var _0x2258=['Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','show','getMessages','/:id/download','create','post','/:id/messages','addMessage','/:id/tags','tracked','addTags','put','/:id','mail','mailinteraction:update','delete','mailinteraction:destroy','removeTags','exports','express'];(function(_0x201a04,_0x22560c){var _0x4248c3=function(_0x2edc79){while(--_0x2edc79){_0x201a04['push'](_0x201a04['shift']());}};_0x4248c3(++_0x22560c);}(_0x2258,0xbc));var _0x8225=function(_0xf9a28f,_0xd95402){_0xf9a28f=_0xf9a28f-0x0;var _0x8824dc=_0x2258[_0xf9a28f];return _0x8824dc;};'use strict';var express=require(_0x8225('0x0'));var router=express[_0x8225('0x1')]();var auth=require(_0x8225('0x2'));var interaction=require(_0x8225('0x3'));var controller=require(_0x8225('0x4'));router[_0x8225('0x5')]('/',auth['isAuthenticated'](),controller[_0x8225('0x6')]);router[_0x8225('0x5')](_0x8225('0x7'),auth[_0x8225('0x8')](),controller['describe']);router[_0x8225('0x5')]('/:id',auth[_0x8225('0x8')](),controller[_0x8225('0x9')]);router['get']('/:id/messages',auth[_0x8225('0x8')](),controller[_0x8225('0xa')]);router[_0x8225('0x5')](_0x8225('0xb'),auth[_0x8225('0x8')](),controller['download']);router['post']('/',auth[_0x8225('0x8')](),controller[_0x8225('0xc')]);router[_0x8225('0xd')](_0x8225('0xe'),auth[_0x8225('0x8')](),controller[_0x8225('0xf')]);router[_0x8225('0xd')](_0x8225('0x10'),auth[_0x8225('0x8')](),interaction[_0x8225('0x11')]('mail','mailinteraction:addtags'),controller[_0x8225('0x12')]);router[_0x8225('0x13')](_0x8225('0x14'),auth['isAuthenticated'](),interaction[_0x8225('0x11')](_0x8225('0x15'),_0x8225('0x16')),controller['update']);router[_0x8225('0x17')](_0x8225('0x14'),auth[_0x8225('0x8')](),interaction[_0x8225('0x11')]('mail',_0x8225('0x18')),controller['destroy']);router['delete'](_0x8225('0x10'),auth[_0x8225('0x8')](),controller[_0x8225('0x19')]);module[_0x8225('0x1a')]=router;
\ No newline at end of file
index d83aadf..73c54fd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdb9a=['BOOLEAN','DATE','STRING','TEXT','ENUM','out','iconv','exports'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xdb9a,0x106));var _0xadb9=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdb9a[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xadb9('0x0'));module[_0xadb9('0x1')]={'closed':{'type':Sequelize[_0xadb9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xadb9('0x3')]},'disposition':{'type':Sequelize[_0xadb9('0x4')]},'secondDisposition':{'type':Sequelize[_0xadb9('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xadb9('0x4')]},'inReplyTo':{'type':Sequelize[_0xadb9('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xadb9('0x5')]('long')},'subject':{'type':Sequelize[_0xadb9('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xadb9('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xadb9('0x6')]('in',_0xadb9('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xadb9('0x2')],'defaultValue':![]}};
\ No newline at end of file
+var _0x03d4=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize','iconv'];(function(_0x18f3a6,_0x4561f7){var _0x37b39c=function(_0x1c2172){while(--_0x1c2172){_0x18f3a6['push'](_0x18f3a6['shift']());}};_0x37b39c(++_0x4561f7);}(_0x03d4,0x18e));var _0x403d=function(_0x19b6e1,_0x124e7e){_0x19b6e1=_0x19b6e1-0x0;var _0x2b0a60=_0x03d4[_0x19b6e1];return _0x2b0a60;};'use strict';var Sequelize=require(_0x403d('0x0'));var iconv=require(_0x403d('0x1'));module[_0x403d('0x2')]={'closed':{'type':Sequelize[_0x403d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x403d('0x4')]},'secondDisposition':{'type':Sequelize[_0x403d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x403d('0x4')]},'note':{'type':Sequelize[_0x403d('0x4')]},'inReplyTo':{'type':Sequelize[_0x403d('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x403d('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x403d('0x5')]},'substatus':{'type':Sequelize[_0x403d('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x403d('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x403d('0x6')]('in',_0x403d('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x403d('0x6')]('in',_0x403d('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x403d('0x3')],'defaultValue':![]}};
\ No newline at end of file
index c624f76..fa89e68 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2609=['Attachments','existsSync','readFileSync','build','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','register','sendStatus','end','json','offset','undefined','count','set','Content-Range','update','then','destroy','status','error','stack','name','send','Users','map','fullname','TagIds','forEach','Tags','push','MailMessage','plainBody','trimStart','catch','answered','unmanaged','total','closed','UserId','waiting','talking','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','select','field','color','tools_tags','u.id','u.fullname','ui.MailInteractionId','from','user_has_mail_interactions','users','mail_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','expr','search','parseSearch','conditions','find','unreadMessages','value','having','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','text','some','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','MailInteraction','a.key','Account.key','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.to','i.ContactId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','findOne','enableEmailPreview','rows','show','params','includeAll','merge','options','create','body','describe','addMessage','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','ids','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','Attachment','Messages','subject','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc'];(function(_0xf7994e,_0x5a20a3){var _0x2e5824=function(_0x9d626d){while(--_0x9d626d){_0xf7994e['push'](_0xf7994e['shift']());}};_0x2e5824(++_0x5a20a3);}(_0x2609,0x1da));var _0x9260=function(_0x2a13fc,_0x44cab6){_0x2a13fc=_0x2a13fc-0x0;var _0x31e152=_0x2609[_0x2a13fc];return _0x31e152;};'use strict';var emlformat=require(_0x9260('0x0'));var rimraf=require(_0x9260('0x1'));var zipdir=require(_0x9260('0x2'));var moment=require(_0x9260('0x3'));var BPromise=require(_0x9260('0x4'));var util=require(_0x9260('0x5'));var path=require(_0x9260('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9260('0x7'));var juice=require(_0x9260('0x8'));var Redis=require(_0x9260('0x9'));var qs=require(_0x9260('0xa'));var as=require(_0x9260('0xb'));var logger=require('../../config/logger')(_0x9260('0xc'));var config=require(_0x9260('0xd'));var db=require(_0x9260('0xe'))['db'];var htmlEntities=require(_0x9260('0xf'));config[_0x9260('0x10')]=_[_0x9260('0x11')](config[_0x9260('0x10')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailInteraction.socket')[_0x9260('0x12')](socket);function respondWithStatusCode(_0x5196cc,_0x53d96c){_0x53d96c=_0x53d96c||0xcc;return function(_0x18cc8e){if(_0x18cc8e){return _0x5196cc[_0x9260('0x13')](_0x53d96c);}return _0x5196cc['status'](_0x53d96c)[_0x9260('0x14')]();};}function respondWithResult(_0x74b83e,_0x910796){_0x910796=_0x910796||0xc8;return function(_0x2d0e69){if(_0x2d0e69){return _0x74b83e['status'](_0x910796)[_0x9260('0x15')](_0x2d0e69);}};}function respondWithFilteredResult(_0x16a458,_0x244729){return function(_0x52c536){if(_0x52c536){var _0x306bd5=typeof _0x244729[_0x9260('0x16')]==='undefined'&&typeof _0x244729['limit']===_0x9260('0x17');var _0xf84b33=_0x52c536[_0x9260('0x18')];var _0x5ddc3f=_0x306bd5?0x0:_0x244729[_0x9260('0x16')];var _0x4755ce=_0x306bd5?_0x52c536[_0x9260('0x18')]:_0x244729[_0x9260('0x16')]+_0x244729['limit'];var _0x25b699;if(_0x4755ce>=_0xf84b33){_0x4755ce=_0xf84b33;_0x25b699=0xc8;}else{_0x25b699=0xce;}_0x16a458['status'](_0x25b699);return _0x16a458[_0x9260('0x19')](_0x9260('0x1a'),_0x5ddc3f+'-'+_0x4755ce+'/'+_0xf84b33)[_0x9260('0x15')](_0x52c536);}return null;};}function saveUpdates(_0x2954bf){return function(_0x5f0aff){if(_0x5f0aff){return _0x5f0aff[_0x9260('0x1b')](_0x2954bf)[_0x9260('0x1c')](function(_0xb4060a){return _0xb4060a;});}return null;};}function removeEntity(_0x248796){return function(_0xe6386c){if(_0xe6386c){return _0xe6386c[_0x9260('0x1d')]()[_0x9260('0x1c')](function(){_0x248796[_0x9260('0x1e')](0xcc)[_0x9260('0x14')]();});}};}function handleEntityNotFound(_0x509d99){return function(_0xc60fa4){if(!_0xc60fa4){_0x509d99[_0x9260('0x13')](0x194);}return _0xc60fa4;};}function handleError(_0xd1a8cb,_0x5e2456){_0x5e2456=_0x5e2456||0x1f4;return function(_0x5b0348){logger[_0x9260('0x1f')](_0x5b0348[_0x9260('0x20')]);if(_0x5b0348[_0x9260('0x21')]){delete _0x5b0348[_0x9260('0x21')];}_0xd1a8cb[_0x9260('0x1e')](_0x5e2456)[_0x9260('0x22')](_0x5b0348);};}function getInteractionUsers(_0x4336a0,_0x190c46){return new BPromise(function(_0x1c26b8,_0x233185){try{if(_0x190c46[_0x4336a0['id']]){_0x4336a0[_0x9260('0x23')]=_[_0x9260('0x24')](_0x190c46[_0x4336a0['id']],function(_0x4feae6){return{'id':_0x4feae6['id'],'fullname':_0x4feae6[_0x9260('0x25')]};});}}catch(_0x145524){_0x233185(_0x145524);}_0x1c26b8(_0x4336a0);});}function getInteractionTags(_0x54663f,_0x4b5055){return new BPromise(function(_0x2bbcf3,_0x40253f){try{if(_0x54663f[_0x9260('0x26')]){_0x54663f['Tags']=[];_0x54663f[_0x9260('0x26')]['split'](',')[_0x9260('0x27')](function(_0x52fc4b){_0x54663f[_0x9260('0x28')][_0x9260('0x29')](_0x4b5055[_0x52fc4b]);});}delete _0x54663f[_0x9260('0x26')];}catch(_0x548d9f){_0x40253f(_0x548d9f);}_0x2bbcf3(_0x54663f);});}function getLastMessageText(_0x15b829){return new BPromise(function(_0x442aa3,_0x1252f5){return db[_0x9260('0x2a')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x15b829['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x9260('0x2b')],'order':'-id','raw':!![]})[_0x9260('0x1c')](function(_0x2e1c62){if(_0x2e1c62&&_0x2e1c62[_0x9260('0x2b')]){_0x15b829['lastMsgText']=_[_0x9260('0x2c')](_0x2e1c62[_0x9260('0x2b')]);}_0x442aa3(_0x15b829);})[_0x9260('0x2d')](function(_0x14b825){_0x1252f5(_0x14b825);});});}function updateMailInteraction(_0x58b115,_0x4be61b,_0x5908e1,_0x187fa5){return new BPromise(function(_0x52eaff,_0x28cf8a){return getInteractionUsers(_0x58b115,_0x5908e1)['then'](function(_0x56b0f0){return getInteractionTags(_0x56b0f0,_0x4be61b);})[_0x9260('0x1c')](function(_0x30edef){return getStateInteraction(_0x30edef);})['then'](function(_0x4e3217){if(_0x187fa5){_0x52eaff(getLastMessageText(_0x4e3217));}else{_0x52eaff(_0x4e3217);}})[_0x9260('0x2d')](function(_0x5b15b2){_0x28cf8a(_0x5b15b2);});});}function getStateInteraction(_0x43e9b6){return new BPromise(function(_0xb61da2){_0x43e9b6['waiting']=0x0;_0x43e9b6['talking']=0x0;_0x43e9b6[_0x9260('0x2e')]=0x0;_0x43e9b6[_0x9260('0x2f')]=0x0;_0x43e9b6[_0x9260('0x30')]=0x0;if(!_0x43e9b6[_0x9260('0x31')]&&!_0x43e9b6[_0x9260('0x32')]){_0x43e9b6[_0x9260('0x33')]+=0x1;}if(!_0x43e9b6[_0x9260('0x31')]&&_0x43e9b6[_0x9260('0x32')]){_0x43e9b6['talking']+=0x1;if(_0x43e9b6[_0x9260('0x33')]){_0x43e9b6[_0x9260('0x33')]-=0x1;}}if(_0x43e9b6[_0x9260('0x31')]&&_0x43e9b6['UserId']){_0x43e9b6[_0x9260('0x2e')]+=0x1;if(_0x43e9b6[_0x9260('0x34')]){_0x43e9b6[_0x9260('0x34')]-=0x1;}}if(_0x43e9b6[_0x9260('0x31')]&&!_0x43e9b6['UserId']){_0x43e9b6['unmanaged']+=0x1;if(_0x43e9b6['waiting']){_0x43e9b6[_0x9260('0x33')]-=0x1;}}_0x43e9b6[_0x9260('0x30')]+=0x1;_0xb61da2(_0x43e9b6);});}exports[_0x9260('0x35')]=function(_0x2d9d4a,_0x2ebda7){var _0x51329b={},_0xcc9b95={},_0x5823f5={'count':0x0,'rows':[]};var _0xced517=_['map'](db['MailInteraction'][_0x9260('0x36')],function(_0x23956f){return{'name':_0x23956f[_0x9260('0x37')],'type':_0x23956f[_0x9260('0x38')][_0x9260('0x39')]};});_0xcc9b95[_0x9260('0x3a')]=_[_0x9260('0x24')](_0xced517,_0x9260('0x21'));_0xcc9b95[_0x9260('0x3b')]=_[_0x9260('0x3c')](_0x2d9d4a['query']);_0xcc9b95['filters']=_[_0x9260('0x3d')](_0xcc9b95[_0x9260('0x3a')],_0xcc9b95[_0x9260('0x3b')]);_0x51329b[_0x9260('0x3e')]=_[_0x9260('0x3d')](_0xcc9b95['model'],qs[_0x9260('0x3f')](_0x2d9d4a[_0x9260('0x3b')][_0x9260('0x3f')]));_0x51329b[_0x9260('0x3e')]=_0x51329b['attributes'][_0x9260('0x40')]?_0x51329b[_0x9260('0x3e')]:_0xcc9b95[_0x9260('0x3a')];if(!_0x2d9d4a[_0x9260('0x3b')][_0x9260('0x41')](_0x9260('0x42'))){_0x51329b[_0x9260('0x43')]=qs[_0x9260('0x43')](_0x2d9d4a[_0x9260('0x3b')][_0x9260('0x43')]);_0x51329b[_0x9260('0x16')]=qs[_0x9260('0x16')](_0x2d9d4a['query'][_0x9260('0x16')]);}_0x51329b[_0x9260('0x44')]=qs[_0x9260('0x45')](_0x2d9d4a[_0x9260('0x3b')][_0x9260('0x45')]);_0x51329b[_0x9260('0x46')]=qs[_0x9260('0x47')](_['pick'](_0x2d9d4a[_0x9260('0x3b')],_0xcc9b95[_0x9260('0x47')]),_0xced517);var _0x8212c4=[];var _0x45927d=squel[_0x9260('0x48')]()[_0x9260('0x49')]('id')[_0x9260('0x49')]('name')[_0x9260('0x49')](_0x9260('0x4a'))['from'](_0x9260('0x4b'));var _0x5c81f1=squel[_0x9260('0x48')]()[_0x9260('0x49')](_0x9260('0x4c'))[_0x9260('0x49')](_0x9260('0x4d'))[_0x9260('0x49')](_0x9260('0x4e'))[_0x9260('0x4f')](_0x9260('0x50'),'ui')['left_join'](_0x9260('0x51'),'u','u.id\x20=\x20ui.UserId');var _0x436d86=squel[_0x9260('0x48')]()[_0x9260('0x4f')](_0x9260('0x52'),'i')[_0x9260('0x53')]('cm_contacts','c',_0x9260('0x54'))[_0x9260('0x53')](_0x9260('0x51'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x9260('0x55'),'a','a.id\x20=\x20i.MailAccountId')['left_join'](_0x9260('0x56'),'me',_0x9260('0x57'))[_0x9260('0x53')](_0x9260('0x58'),'it','it.MailInteractionId\x20=\x20i.id')[_0x9260('0x53')](_0x9260('0x4b'),'t','t.id\x20=\x20it.TagId');var _0x467fbf=squel[_0x9260('0x59')]();var _0x1b598b=[];var _0x2b78cb=squel[_0x9260('0x59')]();var _0x313600;if(_0x2d9d4a[_0x9260('0x3b')][_0x9260('0x5a')]){_0x313600=as[_0x9260('0x5b')](_0x2d9d4a[_0x9260('0x3b')][_0x9260('0x5a')]);var _0x4bb865=_0x313600['sqlOperator'];for(var _0x26468d=0x0;_0x26468d<_0x313600[_0x9260('0x5c')][_0x9260('0x40')];_0x26468d++){var _0x33b283=_0x313600[_0x9260('0x5c')][_0x26468d];var _0x533a2f='i';var _0xb344be=_[_0x9260('0x5d')](_0xced517,[_0x9260('0x21'),_0x33b283['field']]);if(!_0xb344be){switch(_0x33b283[_0x9260('0x49')]){case _0x9260('0x5e'):if(_0x33b283[_0x9260('0x5f')]==0x1){_0x436d86[_0x9260('0x60')]('`'+_0x33b283[_0x9260('0x49')]+'`\x20=\x200');}else{_0x436d86['having']('`'+_0x33b283[_0x9260('0x49')]+'`\x20>\x200');}break;case _0x9260('0x61'):if(_0x33b283['operator']===_0x9260('0x62')){if(_0x33b283[_0x9260('0x5f')][_0x9260('0x63')]('\x20')[_0x9260('0x40')]>0x1){_0x467fbf[_0x4bb865](_0x9260('0x64'),qs[_0x9260('0x65')](_0x33b283[_0x9260('0x5f')]),null);}else{var _0x3924d9='%'+_0x33b283[_0x9260('0x5f')]+'%';_0x467fbf[_0x4bb865]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3924d9,_0x3924d9,_0x3924d9);}}else{_0xb344be=_[_0x9260('0x5d')](_0xced517,[_0x9260('0x21'),_0x9260('0x66')]);_0x33b283[_0x9260('0x49')]=_0x9260('0x66');_0x250623=as['buildExpression'](_0x533a2f,_0xb344be['type'],_0x33b283);_0x467fbf[_0x4bb865](_0x250623['text'],_0x250623[_0x9260('0x5f')][_0x9260('0x67')],_0x250623[_0x9260('0x5f')][_0x9260('0x14')]);}break;case _0x9260('0x68'):var _0x3db8ba=_0x33b283['value'][_0x9260('0x63')](',')[_0x9260('0x24')](function(_0x1412af){return Number(_0x1412af);});_0x3db8ba[_0x9260('0x27')](function(_0x56fceb){_0x2b78cb['or'](_0x9260('0x69'),'%,'+_0x56fceb+',%');});_0x1b598b=_[_0x9260('0x6a')](_0x1b598b,_0x3db8ba);break;case _0x9260('0x6b'):if(_0x33b283['operator']===_0x9260('0x62')){_0x467fbf[_0x4bb865](_0x9260('0x6c'),'%'+_0x33b283[_0x9260('0x5f')]+'%',null);}else{_0xb344be=_[_0x9260('0x5d')](_0xced517,['name','UserId']);_0x33b283[_0x9260('0x49')]=_0x9260('0x32');_0x250623=as[_0x9260('0x6d')](_0x533a2f,_0xb344be['type'],_0x33b283);_0x467fbf[_0x4bb865](_0x250623[_0x9260('0x6e')],_0x250623[_0x9260('0x5f')][_0x9260('0x67')],_0x250623[_0x9260('0x5f')][_0x9260('0x14')]);}break;case _0x9260('0x2b'):_0x250623=as[_0x9260('0x6d')]('me',null,_0x33b283);_0x467fbf[_0x4bb865](_0x250623[_0x9260('0x6e')],_0x250623['value'][_0x9260('0x67')],_0x250623[_0x9260('0x5f')][_0x9260('0x14')]);break;}}else{var _0x250623=as[_0x9260('0x6d')](_0x533a2f,_0xb344be[_0x9260('0x38')],_0x33b283);_0x467fbf[_0x4bb865](_0x250623[_0x9260('0x6e')],_0x250623['value'][_0x9260('0x67')],_0x250623['value'][_0x9260('0x14')]);}}}else{var _0xada01e=_(_0x2d9d4a['query'])[_0x9260('0x3c')]()[_0x9260('0x24')](function(_0x1ecf0f){return _[_0x9260('0x6f')](_0xced517,[_0x9260('0x21'),_0x1ecf0f])?_0x1ecf0f:undefined;})['compact']()[_0x9260('0x5f')]();if(!_[_0x9260('0x70')](_0xada01e)){_0xada01e[_0x9260('0x27')](function(_0x4e91b9){if(_0x4e91b9===_0x9260('0x71')){_0x436d86[_0x9260('0x46')](_0x9260('0x72'),[][_0x9260('0x73')](_0x2d9d4a[_0x9260('0x3b')][_0x4e91b9]));}else if(_0x4e91b9===_0x9260('0x74')){var _0x4d43cb=JSON[_0x9260('0x75')](_0x2d9d4a['query'][_0x4e91b9])[_0x9260('0x76')];var _0x592bbc=JSON['parse'](_0x2d9d4a['query'][_0x4e91b9])[_0x9260('0x77')];_0x436d86[_0x9260('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4d43cb,_0x592bbc);}else{if(_0x2d9d4a[_0x9260('0x3b')][_0x4e91b9]===_0x9260('0x78')){_0x436d86[_0x9260('0x46')]('i.'+_0x4e91b9+_0x9260('0x79'));}else{_0x436d86[_0x9260('0x46')]('i.'+_0x4e91b9+'\x20=\x20?',_0x2d9d4a['query'][_0x4e91b9]);}}});}if(_0x2d9d4a[_0x9260('0x3b')][_0x9260('0x7a')]){if(_0x2d9d4a[_0x9260('0x3b')]['read']==0x1){_0x436d86[_0x9260('0x60')]('`unreadMessages`\x20=\x200');}else{_0x436d86[_0x9260('0x60')](_0x9260('0x7b'));}}if(_0x2d9d4a[_0x9260('0x3b')][_0x9260('0x7c')]){_0x1b598b=_[_0x9260('0x7d')](_0x2d9d4a['query'][_0x9260('0x7c')])?_0x2d9d4a['query']['tag']:new Array(_0x2d9d4a[_0x9260('0x3b')][_0x9260('0x7c')]);_0x1b598b['forEach'](function(_0x1f0139){_0x2b78cb['or'](_0x9260('0x69'),'%,'+_0x1f0139+',%');});}if(_0x2d9d4a[_0x9260('0x3b')]['filter']){var _0xa3fd73=_0x2d9d4a[_0x9260('0x3b')][_0x9260('0x7e')][_0x9260('0x7f')]('\x5c','\x5c\x5c')[_0x9260('0x7f')](/'/g,'\x27\x27');if(qs[_0x9260('0x80')](_0xa3fd73)){_0x467fbf['or'](_0x9260('0x81'),_0xa3fd73+'%');}else if(qs['isEmail'](_0xa3fd73)){_0x467fbf['or'](_0x9260('0x82'),_0xa3fd73+'%');}else{_0x467fbf['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9260('0x65')](_0xa3fd73))['or'](_0x9260('0x83'),qs[_0x9260('0x65')](_0xa3fd73));}}}_0x436d86[_0x9260('0x46')](_0x467fbf);_0x436d86[_0x9260('0x84')](_0x9260('0x85'));var _0x3d21e5={'type':db[_0x9260('0x86')][_0x9260('0x87')][_0x9260('0x88')],'raw':!![]};var _0xb3a3c2=_0x436d86[_0x9260('0x89')]();_0xb3a3c2[_0x9260('0x49')](_0x9260('0x85'));_0xb3a3c2[_0x9260('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x51329b[_0x9260('0x44')]){_0x51329b[_0x9260('0x44')][_0x9260('0x27')](function(_0x5762b1){var _0x172f33=_0x5762b1[0x0]==='contactName'?_0x5762b1[0x0]:'i.'+_0x5762b1[0x0];_0x436d86[_0x9260('0x44')](_0x172f33,_0x5762b1[0x1]===_0x9260('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x1b598b)){_0x436d86[_0x9260('0x60')](_0x2b78cb);_0xb3a3c2[_0x9260('0x46')]('t.id\x20IN\x20?',_0x1b598b);}BPromise[_0x9260('0x8b')]()[_0x9260('0x1c')](function(){if(!_0x313600){if(_0x2d9d4a[_0x9260('0x3b')][_0x9260('0x71')])return;_0xb3a3c2[_0x9260('0x46')](_0x9260('0x8c'));_0x436d86[_0x9260('0x46')](_0x9260('0x8c'));return;}if(_0x2d9d4a['user'][_0x9260('0x8d')]!==_0x9260('0x8e'))return;return _0x2d9d4a[_0x9260('0x8f')][_0x9260('0x90')]({'attributes':['id'],'raw':!![]})[_0x9260('0x1c')](function(_0x1de780){if(_['isEmpty'](_0x1de780)){_0xb3a3c2[_0x9260('0x46')](_0x9260('0x91'));_0x436d86['where'](_0x9260('0x91'));}else{_0xb3a3c2[_0x9260('0x46')](_0x9260('0x72'),_['map'](_0x1de780,'id'));_0x436d86[_0x9260('0x46')](_0x9260('0x72'),_[_0x9260('0x24')](_0x1de780,'id'));}});})['then'](function(){if(_0x2d9d4a[_0x9260('0x8f')][_0x9260('0x8d')]===_0x9260('0x8e')&&!_0x313600&&!_0x2d9d4a[_0x9260('0x3b')][_0x9260('0x71')])return[];return db[_0x9260('0x92')][_0x9260('0x3b')](_0xb3a3c2[_0x9260('0x93')](),_0x3d21e5);})[_0x9260('0x1c')](function(_0x2d8fa1){_0x5823f5[_0x9260('0x18')]=_0x2d8fa1[_0x9260('0x40')];if(_0x5823f5[_0x9260('0x18')]===0x0)return[];return db[_0x9260('0x92')][_0x9260('0x3b')](_0x45927d['toString'](),_0x3d21e5)['then'](function(_0x2866b1){_0x8212c4=_[_0x9260('0x94')](_0x2866b1,'id');_0x3d21e5=_['merge'](_0x3d21e5,{'model':db[_0x9260('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d9d4a[_0x9260('0x3b')]['fields']){_0x51329b['attributes']['forEach'](function(_0x486fc3){_0x436d86['field']('i.'+_0x486fc3);});}else{_0x436d86[_0x9260('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9260('0x5e'));_0x436d86[_0x9260('0x49')](_0x9260('0x96'),_0x9260('0x97'));_0x436d86[_0x9260('0x49')]('a.mandatoryDisposition',_0x9260('0x98'));_0x436d86[_0x9260('0x49')](_0x9260('0x99'),_0x9260('0x9a'));_0x436d86[_0x9260('0x49')](_0x9260('0x9b'),'contactName');_0x436d86[_0x9260('0x49')]('i.id');_0x436d86[_0x9260('0x49')](_0x9260('0x9c'));_0x436d86[_0x9260('0x49')](_0x9260('0x9d'));_0x436d86[_0x9260('0x49')]('i.closed');_0x436d86['field'](_0x9260('0x9e'));_0x436d86[_0x9260('0x49')](_0x9260('0x9f'));_0x436d86[_0x9260('0x49')]('i.lastMsgAt');_0x436d86['field'](_0x9260('0xa0'));_0x436d86[_0x9260('0x49')](_0x9260('0xa1'));_0x436d86[_0x9260('0x49')](_0x9260('0xa2'));_0x436d86['field']('i.secondDisposition');_0x436d86[_0x9260('0x49')](_0x9260('0xa3'));_0x436d86[_0x9260('0x49')]('i.substatus');_0x436d86[_0x9260('0x49')](_0x9260('0xa4'));_0x436d86['field'](_0x9260('0xa5'));_0x436d86[_0x9260('0x49')]('i.MailAccountId');_0x436d86[_0x9260('0x49')](_0x9260('0xa6'));_0x436d86[_0x9260('0x49')](_0x9260('0xa7'),_0x9260('0xa8'));_0x436d86[_0x9260('0x49')](_0x9260('0xa9'),_0x9260('0xaa'));_0x436d86[_0x9260('0x49')](_0x9260('0xab'),_0x9260('0xac'));_0x436d86[_0x9260('0x49')](_0x9260('0xad'),_0x9260('0xae'));_0x436d86['field'](_0x9260('0xaf'),_0x9260('0xb0'));_0x436d86[_0x9260('0x49')](_0x9260('0xb1'),_0x9260('0xb2'));_0x436d86['field']('o.fullname',_0x9260('0xb3'));_0x436d86[_0x9260('0x49')](_0x9260('0xb4'),_0x9260('0xb5'));_0x436d86['field'](_0x9260('0xb6'),_0x9260('0x26'));}if(_0x51329b[_0x9260('0x43')])_0x436d86[_0x9260('0x43')](_0x51329b['limit']);if(_0x51329b[_0x9260('0x16')])_0x436d86[_0x9260('0x16')](_0x51329b[_0x9260('0x16')]);return db[_0x9260('0x92')][_0x9260('0x3b')](_0x436d86[_0x9260('0x93')](),_0x3d21e5);})[_0x9260('0x1c')](function(_0x17dc85){if(_0x17dc85[_0x9260('0x40')]>0x0)_0x5c81f1[_0x9260('0x46')](_0x9260('0xb7'),_[_0x9260('0x24')](_0x17dc85,'id'));return db['sequelize'][_0x9260('0x3b')](_0x5c81f1['toString'](),_0x3d21e5)[_0x9260('0x1c')](function(_0x111c8a){var _0x5347ad=_['groupBy'](_0x111c8a,_0x9260('0xb8'));var _0x2f2dc7=[];return db[_0x9260('0xb9')][_0x9260('0xba')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x9260('0x1c')](function(_0x2cbbd9){var _0x37881c=_0x2cbbd9[_0x9260('0xbb')];_0x17dc85[_0x9260('0x27')](function(_0x2552a9){_0x2f2dc7['push'](updateMailInteraction(_0x2552a9,_0x8212c4,_0x5347ad,_0x37881c));});return BPromise['all'](_0x2f2dc7);});});});})[_0x9260('0x1c')](function(_0x314c5c){_0x5823f5[_0x9260('0xbc')]=_0x314c5c;return _0x5823f5;})[_0x9260('0x1c')](respondWithFilteredResult(_0x2ebda7,_0x51329b))[_0x9260('0x2d')](handleError(_0x2ebda7,null));};exports[_0x9260('0xbd')]=function(_0x3eb6b0,_0x1efc57){var _0x3db51b={'raw':![],'where':{'id':_0x3eb6b0[_0x9260('0xbe')]['id']}},_0x4a1d83={};_0x4a1d83['model']=_['keys'](db['MailInteraction'][_0x9260('0x36')]);_0x4a1d83[_0x9260('0x3b')]=_[_0x9260('0x3c')](_0x3eb6b0[_0x9260('0x3b')]);_0x4a1d83['filters']=_['intersection'](_0x4a1d83[_0x9260('0x3a')],_0x4a1d83[_0x9260('0x3b')]);_0x3db51b['attributes']=_[_0x9260('0x3d')](_0x4a1d83['model'],qs[_0x9260('0x3f')](_0x3eb6b0[_0x9260('0x3b')][_0x9260('0x3f')]));_0x3db51b[_0x9260('0x3e')]=_0x3db51b[_0x9260('0x3e')][_0x9260('0x40')]?_0x3db51b[_0x9260('0x3e')]:_0x4a1d83[_0x9260('0x3a')];if(_0x3eb6b0['query'][_0x9260('0xbf')]){_0x3db51b['include']=[{'all':!![]}];}_0x3db51b=_[_0x9260('0xc0')]({},_0x3db51b,_0x3eb6b0[_0x9260('0xc1')]);return db[_0x9260('0x95')][_0x9260('0x5d')](_0x3db51b)[_0x9260('0x1c')](handleEntityNotFound(_0x1efc57,null))['then'](respondWithResult(_0x1efc57,null))[_0x9260('0x2d')](handleError(_0x1efc57,null));};exports['create']=function(_0x2dcde7,_0x4dce34){return db[_0x9260('0x95')][_0x9260('0xc2')](_0x2dcde7[_0x9260('0xc3')],{})[_0x9260('0x1c')](respondWithResult(_0x4dce34,0xc9))[_0x9260('0x2d')](handleError(_0x4dce34,null));};exports[_0x9260('0x1b')]=function(_0x1f7cab,_0x23a4b9){if(_0x1f7cab[_0x9260('0xc3')]['id']){delete _0x1f7cab[_0x9260('0xc3')]['id'];}return db[_0x9260('0x95')][_0x9260('0x5d')]({'where':{'id':_0x1f7cab[_0x9260('0xbe')]['id']}})[_0x9260('0x1c')](handleEntityNotFound(_0x23a4b9,null))[_0x9260('0x1c')](saveUpdates(_0x1f7cab[_0x9260('0xc3')],null))['then'](respondWithResult(_0x23a4b9,null))[_0x9260('0x2d')](handleError(_0x23a4b9,null));};exports['destroy']=function(_0x1d7aee,_0x1689ef){return db[_0x9260('0x95')][_0x9260('0x5d')]({'where':{'id':_0x1d7aee[_0x9260('0xbe')]['id']}})[_0x9260('0x1c')](handleEntityNotFound(_0x1689ef,null))['then'](removeEntity(_0x1689ef,null))[_0x9260('0x2d')](handleError(_0x1689ef,null));};exports['describe']=function(_0x417363,_0x2fe8e5){return db[_0x9260('0x95')][_0x9260('0xc4')]()[_0x9260('0x1c')](respondWithResult(_0x2fe8e5,null))[_0x9260('0x2d')](handleError(_0x2fe8e5,null));};exports[_0x9260('0xc5')]=function(_0x29c919,_0x53b5d8){return db[_0x9260('0x2a')][_0x9260('0x5d')]({'where':{'id':_0x29c919[_0x9260('0xbe')]['id']}})['then'](handleEntityNotFound(_0x53b5d8,null))[_0x9260('0x1c')](function(_0x2c9ca5){if(_0x2c9ca5){return _0x2c9ca5['addMessage'](_0x29c919[_0x9260('0xc3')]['ids'],_[_0x9260('0xc6')](_0x29c919['body'],['ids','id'])||{});}})[_0x9260('0x1c')](respondWithResult(_0x53b5d8,null))['catch'](handleError(_0x53b5d8,null));};exports[_0x9260('0xc7')]=function(_0x4d0a5e,_0x187c45){var _0x2e8584={'raw':![],'where':{}};var _0x491b8a={};var _0x2854e8={'count':0x0,'rows':[]};return db[_0x9260('0x95')][_0x9260('0xba')]({'where':{'id':_0x4d0a5e[_0x9260('0xbe')]['id']}})['then'](handleEntityNotFound(_0x187c45,null))[_0x9260('0x1c')](function(_0x2c53b5){if(_0x2c53b5){_0x491b8a[_0x9260('0x3a')]=_[_0x9260('0x3c')](db[_0x9260('0x2a')][_0x9260('0x36')]);_0x491b8a[_0x9260('0x3b')]=_[_0x9260('0x3c')](_0x4d0a5e[_0x9260('0x3b')]);_0x491b8a['filters']=_[_0x9260('0x3d')](_0x491b8a[_0x9260('0x3a')],_0x491b8a[_0x9260('0x3b')]);_0x2e8584[_0x9260('0x3e')]=_[_0x9260('0x3d')](_0x491b8a[_0x9260('0x3a')],qs['fields'](_0x4d0a5e[_0x9260('0x3b')][_0x9260('0x3f')]));_0x2e8584[_0x9260('0x3e')]=_0x2e8584['attributes']['length']?_0x2e8584[_0x9260('0x3e')]:_0x491b8a[_0x9260('0x3a')];if(!_0x4d0a5e[_0x9260('0x3b')][_0x9260('0x41')]('nolimit')){_0x2e8584[_0x9260('0x43')]=qs['limit'](_0x4d0a5e[_0x9260('0x3b')][_0x9260('0x43')]);_0x2e8584['offset']=qs[_0x9260('0x16')](_0x4d0a5e['query'][_0x9260('0x16')]);}_0x2e8584[_0x9260('0x44')]=qs['sort'](_0x4d0a5e[_0x9260('0x3b')]['sort']);_0x2e8584[_0x9260('0x46')]=qs['filters'](_['pick'](_0x4d0a5e['query'],_0x491b8a[_0x9260('0x47')]));_0x2e8584['where']['MailInteractionId']=_0x2c53b5['id'];if(_0x4d0a5e[_0x9260('0x3b')][_0x9260('0x7e')]){_0x2e8584[_0x9260('0x46')]=_['merge'](_0x2e8584['where'],{'$or':_[_0x9260('0x24')](_0x2e8584[_0x9260('0x3e')],function(_0x29c1bc){var _0x15aba5={};_0x15aba5[_0x29c1bc]={'$like':'%'+_0x4d0a5e[_0x9260('0x3b')][_0x9260('0x7e')]+'%'};return _0x15aba5;})});}if(_0x4d0a5e[_0x9260('0x3b')]['$gte']){var _0x5f4e85=_0x4d0a5e[_0x9260('0x3b')][_0x9260('0x76')][_0x9260('0x63')](',');var _0x2e2578={};_0x2e2578[_0x5f4e85[0x0]]={'$gte':moment(_0x5f4e85[0x1])[_0x9260('0xc8')](_0x9260('0xc9'))};_0x2e8584['where']=_['merge'](_0x2e8584['where'],_0x2e2578);}_0x2e8584=_[_0x9260('0xc0')]({},_0x2e8584,_0x4d0a5e[_0x9260('0xc1')]);return db[_0x9260('0x2a')][_0x9260('0x18')]({'where':_0x2e8584[_0x9260('0x46')]})[_0x9260('0x1c')](function(_0x2d278f){_0x2854e8[_0x9260('0x18')]=_0x2d278f;if(_0x4d0a5e[_0x9260('0x3b')][_0x9260('0xbf')]){_0x2e8584['include']=[{'all':!![]}];}return db[_0x9260('0x2a')][_0x9260('0xca')](_0x2e8584);})[_0x9260('0x1c')](function(_0x42e380){if(_0x4d0a5e[_0x9260('0x3b')][_0x9260('0xcb')]==='true'){for(var _0x411623=0x0;_0x411623<_0x42e380[_0x9260('0x40')];_0x411623++){_0x42e380[_0x411623][_0x9260('0xc3')]=juice(_0x42e380[_0x411623]['body']);}}_0x2854e8[_0x9260('0xbc')]=_0x42e380;return _0x2854e8;});}})['then'](respondWithFilteredResult(_0x187c45,_0x2e8584))[_0x9260('0x2d')](handleError(_0x187c45,null));};exports['addTags']=function(_0x5ca517,_0x1b2b80){return db[_0x9260('0x95')][_0x9260('0x5d')]({'where':{'id':_0x5ca517['params']['id']}})[_0x9260('0x1c')](handleEntityNotFound(_0x1b2b80,null))[_0x9260('0x1c')](function(_0x594c8c){if(_0x594c8c){return _0x594c8c['setTags'](_0x5ca517[_0x9260('0xc3')]['ids'],_['omit'](_0x5ca517['body'],[_0x9260('0xcc'),'id'])||{})[_0x9260('0xcd')](function(){return db[_0x9260('0x68')][_0x9260('0xca')]({'attributes':['id','name','color'],'where':{'id':_0x5ca517[_0x9260('0xc3')]['ids']}});})[_0x9260('0x1c')](function(_0x4fdd69){socket[_0x9260('0xce')](_0x9260('0xcf'),{'id':Number(_0x5ca517['params']['id']),'tags':_0x4fdd69||[]});return{'id':Number(_0x5ca517[_0x9260('0xbe')]['id']),'tags':_0x4fdd69||[]};});}})[_0x9260('0x1c')](respondWithResult(_0x1b2b80,null))[_0x9260('0x2d')](handleError(_0x1b2b80,null));};exports[_0x9260('0xd0')]=function(_0x9dacbb,_0x2f165a){return db[_0x9260('0x95')][_0x9260('0x5d')]({'where':{'id':_0x9dacbb['params']['id']}})[_0x9260('0x1c')](handleEntityNotFound(_0x2f165a,null))[_0x9260('0x1c')](function(_0x47a883){if(_0x47a883){return _0x47a883[_0x9260('0xd0')](_0x9dacbb[_0x9260('0x3b')]['ids']);}})[_0x9260('0x1c')](respondWithStatusCode(_0x2f165a,null))[_0x9260('0x2d')](handleError(_0x2f165a,null));};exports[_0x9260('0xd1')]=function(_0x228537,_0xf2b907){var _0x383318=moment()[_0x9260('0xd2')]()['toString']();var _0x1d9052=path[_0x9260('0xd3')](config[_0x9260('0xd4')],_0x9260('0xd5'),_0x9260('0xd6'),_0x9260('0xd7'));var _0x233ce3=path[_0x9260('0xd3')](config[_0x9260('0xd4')],'server','files','attachments');var _0x1864b2=path[_0x9260('0xd3')](_0x1d9052,_0x383318);var _0x207421=util['format']('transcript-%d-%s.zip',_0x228537[_0x9260('0xbe')]['id'],_0x383318);var _0x40b98c=path[_0x9260('0xd3')](_0x1d9052,_0x207421);var _0x2e58a5=[];if(_0x228537[_0x9260('0x3b')][_0x9260('0xd8')]){_0x2e58a5[_0x9260('0x29')]({'model':db[_0x9260('0xd9')],'as':'Attachments','raw':!![]});}var _0x2c2936=[{'model':db[_0x9260('0x2a')],'as':_0x9260('0xda'),'attributes':['id',_0x9260('0xc3'),'from','to','cc','bcc',_0x9260('0xdb'),_0x9260('0x74')],'where':{'secret':![]},'order':qs[_0x9260('0x45')]('id'),'include':_0x2e58a5}];return db[_0x9260('0x95')]['find']({'where':{'id':_0x228537[_0x9260('0xbe')]['id']},'include':_0x2c2936})[_0x9260('0x1c')](handleEntityNotFound(_0xf2b907,null))[_0x9260('0x1c')](function(_0x33cb61){if(_0x33cb61&&_0x33cb61[_0x9260('0xda')]){var _0x6a4736=_0x33cb61[_0x9260('0xdc')]({'plain':!![]});fs[_0x9260('0xdd')](_0x1864b2);return BPromise[_0x9260('0xde')](_0x6a4736[_0x9260('0xda')],function(_0x473ece,_0x597405){var _0x5d62b6={'from':_0x473ece[_0x9260('0x4f')],'to':_0x473ece['to'],'subject':_0x473ece[_0x9260('0xdb')],'html':htmlEntities[_0x9260('0xdf')](_0x473ece[_0x9260('0xc3')]),'headers':{'Date':moment(_0x473ece['createdAt'])['format'](_0x9260('0xe0'))},'attachments':[]};if(_0x473ece['cc']){_0x5d62b6[_0x9260('0xe1')]['Cc']=_0x473ece['cc'];}if(_0x473ece[_0x9260('0xe2')]){_0x5d62b6['headers'][_0x9260('0xe3')]=_0x473ece[_0x9260('0xe2')];}return new BPromise(function(_0x6d3b5b,_0x33cc0e){if(_0x473ece[_0x9260('0xe4')]){for(var _0x13e0e2=0x0;_0x13e0e2<_0x473ece[_0x9260('0xe4')][_0x9260('0x40')];_0x13e0e2++){var _0x5b7d86=_0x473ece['Attachments'][_0x13e0e2];var _0x15d220=path[_0x9260('0xd3')](_0x233ce3,_0x5b7d86['basename']);if(fs[_0x9260('0xe5')](_0x15d220)){_0x5d62b6[_0x9260('0xd8')]['push']({'name':_0x5b7d86[_0x9260('0x21')],'contentType':_0x5b7d86[_0x9260('0x38')],'data':fs[_0x9260('0xe6')](_0x15d220)});}}}emlformat[_0x9260('0xe7')](_0x5d62b6,function(_0x25e43e,_0x495d77){if(_0x25e43e)return _0x33cc0e(_0x25e43e);fs['writeFileSync'](path[_0x9260('0xd3')](_0x1864b2,util[_0x9260('0xc8')](_0x9260('0xe8'),_0x597405)),_0x495d77);return _0x6d3b5b(_0x495d77);});});})['then'](function(){return new BPromise(function(_0x4c41d7,_0x359547){zipdir(_0x1864b2,{'saveTo':_0x40b98c},function(_0x227cc6,_0x3c0df5){if(_0x227cc6)return _0x359547(_0x227cc6);return _0x4c41d7(_0x3c0df5);});})[_0x9260('0x1c')](function(){return new BPromise(function(_0x26a41b,_0x8f20e6){rimraf(_0x1864b2,function(_0x3607bc){if(_0x3607bc)_0x8f20e6(_0x3607bc);return _0x26a41b();});});})[_0x9260('0x1c')](function(){return _0xf2b907[_0x9260('0xd1')](_0x40b98c,_0x207421,function(_0x29f9cc){if(!_0x29f9cc)fs[_0x9260('0xe9')](_0x40b98c);});});});}else{return _0xf2b907['sendStatus'](0xc8);}})[_0x9260('0x2d')](handleError(_0xf2b907,null));};
\ No newline at end of file
+var _0x00a9=['u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','compact','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','a.email','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','findOne','enableEmailPreview','all','rows','show','params','keys','includeAll','merge','options','create','body','addMessage','ids','omit','getMessages','pick','$gte','format','include','addTags','setTags','spread','findAll','color','mailInteractionTags:save','removeTags','download','unix','server','files','tmp','root','attachments','transcript-%d-%s.zip','join','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','bluebird','path','lodash','squel','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','stack','name','Users','map','Tags','split','forEach','push','MailMessage','out','plainBody','-id','lastMsgText','catch','waiting','unmanaged','closed','talking','UserId','answered','total','MailInteraction','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','select','field','from','tools_tags','u.id'];(function(_0x252e70,_0x1b6bd2){var _0xdfe15b=function(_0xed06c8){while(--_0xed06c8){_0x252e70['push'](_0x252e70['shift']());}};_0xdfe15b(++_0x1b6bd2);}(_0x00a9,0x190));var _0x900a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x00a9[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x900a('0x0'));var rimraf=require(_0x900a('0x1'));var zipdir=require(_0x900a('0x2'));var moment=require('moment');var BPromise=require(_0x900a('0x3'));var util=require('util');var path=require(_0x900a('0x4'));var fs=require('fs');var _=require(_0x900a('0x5'));var squel=require(_0x900a('0x6'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0x900a('0x7'));var as=require(_0x900a('0x8'));var logger=require(_0x900a('0x9'))(_0x900a('0xa'));var config=require('../../config/environment');var db=require(_0x900a('0xb'))['db'];var htmlEntities=require(_0x900a('0xc'));config[_0x900a('0xd')]=_[_0x900a('0xe')](config[_0x900a('0xd')],{'host':_0x900a('0xf'),'port':0x18eb});var socket=require(_0x900a('0x10'))(new Redis(config[_0x900a('0xd')]));require('./mailInteraction.socket')[_0x900a('0x11')](socket);function respondWithStatusCode(_0x2d8253,_0x4f6d98){_0x4f6d98=_0x4f6d98||0xcc;return function(_0x15f023){if(_0x15f023){return _0x2d8253[_0x900a('0x12')](_0x4f6d98);}return _0x2d8253[_0x900a('0x13')](_0x4f6d98)[_0x900a('0x14')]();};}function respondWithResult(_0x2e1aed,_0x124954){_0x124954=_0x124954||0xc8;return function(_0x3d8cee){if(_0x3d8cee){return _0x2e1aed[_0x900a('0x13')](_0x124954)[_0x900a('0x15')](_0x3d8cee);}};}function respondWithFilteredResult(_0x42924d,_0x308f52){return function(_0x95f558){if(_0x95f558){var _0x3883f2=typeof _0x308f52[_0x900a('0x16')]===_0x900a('0x17')&&typeof _0x308f52[_0x900a('0x18')]==='undefined';var _0x4a22fd=_0x95f558[_0x900a('0x19')];var _0x5165ce=_0x3883f2?0x0:_0x308f52[_0x900a('0x16')];var _0x4210ed=_0x3883f2?_0x95f558['count']:_0x308f52[_0x900a('0x16')]+_0x308f52[_0x900a('0x18')];var _0x5c499f;if(_0x4210ed>=_0x4a22fd){_0x4210ed=_0x4a22fd;_0x5c499f=0xc8;}else{_0x5c499f=0xce;}_0x42924d[_0x900a('0x13')](_0x5c499f);return _0x42924d[_0x900a('0x1a')]('Content-Range',_0x5165ce+'-'+_0x4210ed+'/'+_0x4a22fd)[_0x900a('0x15')](_0x95f558);}return null;};}function saveUpdates(_0x240378){return function(_0x48e8f0){if(_0x48e8f0){return _0x48e8f0[_0x900a('0x1b')](_0x240378)[_0x900a('0x1c')](function(_0x51cb88){return _0x51cb88;});}return null;};}function removeEntity(_0x45ee35){return function(_0x104596){if(_0x104596){return _0x104596[_0x900a('0x1d')]()['then'](function(){_0x45ee35[_0x900a('0x13')](0xcc)[_0x900a('0x14')]();});}};}function handleEntityNotFound(_0x519344){return function(_0x112a11){if(!_0x112a11){_0x519344[_0x900a('0x12')](0x194);}return _0x112a11;};}function handleError(_0x3279bf,_0x3b9a8f){_0x3b9a8f=_0x3b9a8f||0x1f4;return function(_0x2171dc){logger['error'](_0x2171dc[_0x900a('0x1e')]);if(_0x2171dc[_0x900a('0x1f')]){delete _0x2171dc['name'];}_0x3279bf['status'](_0x3b9a8f)['send'](_0x2171dc);};}function getInteractionUsers(_0x199b0d,_0x1ffab5){return new BPromise(function(_0x3d7d97,_0x4a1af6){try{if(_0x1ffab5[_0x199b0d['id']]){_0x199b0d[_0x900a('0x20')]=_[_0x900a('0x21')](_0x1ffab5[_0x199b0d['id']],function(_0x4f01e1){return{'id':_0x4f01e1['id'],'fullname':_0x4f01e1['fullname']};});}}catch(_0x47b740){_0x4a1af6(_0x47b740);}_0x3d7d97(_0x199b0d);});}function getInteractionTags(_0x435b34,_0x3240c4){return new BPromise(function(_0x2bb357,_0x8ebeec){try{if(_0x435b34['TagIds']){_0x435b34[_0x900a('0x22')]=[];_0x435b34['TagIds'][_0x900a('0x23')](',')[_0x900a('0x24')](function(_0x2479ce){_0x435b34['Tags'][_0x900a('0x25')](_0x3240c4[_0x2479ce]);});}delete _0x435b34['TagIds'];}catch(_0x37a461){_0x8ebeec(_0x37a461);}_0x2bb357(_0x435b34);});}function getLastMessageText(_0x11086c){return new BPromise(function(_0x59f4c2,_0x48747a){return db[_0x900a('0x26')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x11086c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x900a('0x27')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x900a('0x28')],'order':_0x900a('0x29'),'raw':!![]})[_0x900a('0x1c')](function(_0x406cab){if(_0x406cab&&_0x406cab['plainBody']){_0x11086c[_0x900a('0x2a')]=_['trimStart'](_0x406cab['plainBody']);}_0x59f4c2(_0x11086c);})[_0x900a('0x2b')](function(_0x5d65cf){_0x48747a(_0x5d65cf);});});}function updateMailInteraction(_0x4ec254,_0x4b2245,_0x343490,_0x30c047){return new BPromise(function(_0x19316a,_0x50aedd){return getInteractionUsers(_0x4ec254,_0x343490)[_0x900a('0x1c')](function(_0xb74ab0){return getInteractionTags(_0xb74ab0,_0x4b2245);})['then'](function(_0x247542){return getStateInteraction(_0x247542);})['then'](function(_0x717362){if(_0x30c047){_0x19316a(getLastMessageText(_0x717362));}else{_0x19316a(_0x717362);}})['catch'](function(_0x1909d7){_0x50aedd(_0x1909d7);});});}function getStateInteraction(_0x24e650){return new BPromise(function(_0x3a7061){_0x24e650[_0x900a('0x2c')]=0x0;_0x24e650['talking']=0x0;_0x24e650['answered']=0x0;_0x24e650[_0x900a('0x2d')]=0x0;_0x24e650['total']=0x0;if(!_0x24e650[_0x900a('0x2e')]&&!_0x24e650['UserId']){_0x24e650[_0x900a('0x2c')]+=0x1;}if(!_0x24e650['closed']&&_0x24e650['UserId']){_0x24e650[_0x900a('0x2f')]+=0x1;if(_0x24e650['waiting']){_0x24e650[_0x900a('0x2c')]-=0x1;}}if(_0x24e650['closed']&&_0x24e650[_0x900a('0x30')]){_0x24e650[_0x900a('0x31')]+=0x1;if(_0x24e650[_0x900a('0x2f')]){_0x24e650[_0x900a('0x2f')]-=0x1;}}if(_0x24e650[_0x900a('0x2e')]&&!_0x24e650[_0x900a('0x30')]){_0x24e650[_0x900a('0x2d')]+=0x1;if(_0x24e650[_0x900a('0x2c')]){_0x24e650[_0x900a('0x2c')]-=0x1;}}_0x24e650[_0x900a('0x32')]+=0x1;_0x3a7061(_0x24e650);});}exports['index']=function(_0x54785d,_0x3d8555){var _0x2a0a00={},_0x42c136={},_0x5c4184={'count':0x0,'rows':[]};var _0x1a3bfc=_[_0x900a('0x21')](db[_0x900a('0x33')][_0x900a('0x34')],function(_0x4f3faa){return{'name':_0x4f3faa[_0x900a('0x35')],'type':_0x4f3faa[_0x900a('0x36')]['key']};});_0x42c136[_0x900a('0x37')]=_['map'](_0x1a3bfc,_0x900a('0x1f'));_0x42c136['query']=_['keys'](_0x54785d[_0x900a('0x38')]);_0x42c136[_0x900a('0x39')]=_[_0x900a('0x3a')](_0x42c136[_0x900a('0x37')],_0x42c136['query']);_0x2a0a00[_0x900a('0x3b')]=_[_0x900a('0x3a')](_0x42c136[_0x900a('0x37')],qs[_0x900a('0x3c')](_0x54785d[_0x900a('0x38')][_0x900a('0x3c')]));_0x2a0a00[_0x900a('0x3b')]=_0x2a0a00[_0x900a('0x3b')][_0x900a('0x3d')]?_0x2a0a00[_0x900a('0x3b')]:_0x42c136[_0x900a('0x37')];if(!_0x54785d[_0x900a('0x38')]['hasOwnProperty'](_0x900a('0x3e'))){_0x2a0a00[_0x900a('0x18')]=qs['limit'](_0x54785d[_0x900a('0x38')][_0x900a('0x18')]);_0x2a0a00[_0x900a('0x16')]=qs['offset'](_0x54785d[_0x900a('0x38')][_0x900a('0x16')]);}_0x2a0a00['order']=qs[_0x900a('0x3f')](_0x54785d['query'][_0x900a('0x3f')]);_0x2a0a00[_0x900a('0x40')]=qs['filters'](_['pick'](_0x54785d[_0x900a('0x38')],_0x42c136[_0x900a('0x39')]),_0x1a3bfc);var _0x4314bc=[];var _0x17e416=squel[_0x900a('0x41')]()[_0x900a('0x42')]('id')['field'](_0x900a('0x1f'))[_0x900a('0x42')]('color')[_0x900a('0x43')](_0x900a('0x44'));var _0x50afbb=squel[_0x900a('0x41')]()['field'](_0x900a('0x45'))[_0x900a('0x42')](_0x900a('0x46'))[_0x900a('0x42')](_0x900a('0x47'))[_0x900a('0x43')](_0x900a('0x48'),'ui')[_0x900a('0x49')]('users','u',_0x900a('0x4a'));var _0x3c125c=squel[_0x900a('0x41')]()['from'](_0x900a('0x4b'),'i')[_0x900a('0x49')](_0x900a('0x4c'),'c',_0x900a('0x4d'))[_0x900a('0x49')]('users','o','o.id\x20=\x20i.UserId')[_0x900a('0x49')]('mail_accounts','a',_0x900a('0x4e'))[_0x900a('0x49')](_0x900a('0x4f'),'me',_0x900a('0x50'))[_0x900a('0x49')](_0x900a('0x51'),'it','it.MailInteractionId\x20=\x20i.id')[_0x900a('0x49')]('tools_tags','t',_0x900a('0x52'));var _0x581fe8=squel[_0x900a('0x53')]();var _0x312905=[];var _0x2250d8=squel[_0x900a('0x53')]();var _0x1d543c;if(_0x54785d[_0x900a('0x38')][_0x900a('0x54')]){_0x1d543c=as[_0x900a('0x55')](_0x54785d[_0x900a('0x38')]['search']);var _0x42b956=_0x1d543c[_0x900a('0x56')];for(var _0x47ee85=0x0;_0x47ee85<_0x1d543c[_0x900a('0x57')][_0x900a('0x3d')];_0x47ee85++){var _0x146a5f=_0x1d543c[_0x900a('0x57')][_0x47ee85];var _0x22d8db='i';var _0x1d317c=_[_0x900a('0x58')](_0x1a3bfc,[_0x900a('0x1f'),_0x146a5f[_0x900a('0x42')]]);if(!_0x1d317c){switch(_0x146a5f[_0x900a('0x42')]){case'unreadMessages':if(_0x146a5f[_0x900a('0x59')]==0x1){_0x3c125c[_0x900a('0x5a')]('`'+_0x146a5f[_0x900a('0x42')]+'`\x20=\x200');}else{_0x3c125c['having']('`'+_0x146a5f[_0x900a('0x42')]+_0x900a('0x5b'));}break;case _0x900a('0x5c'):if(_0x146a5f[_0x900a('0x5d')]===_0x900a('0x5e')){if(_0x146a5f['value'][_0x900a('0x23')]('\x20')[_0x900a('0x3d')]>0x1){_0x581fe8[_0x42b956]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x900a('0x5f')](_0x146a5f[_0x900a('0x59')]),null);}else{var _0x23d0ad='%'+_0x146a5f[_0x900a('0x59')]+'%';_0x581fe8[_0x42b956](_0x900a('0x60'),_0x23d0ad,_0x23d0ad,_0x23d0ad);}}else{_0x1d317c=_[_0x900a('0x58')](_0x1a3bfc,[_0x900a('0x1f'),_0x900a('0x61')]);_0x146a5f[_0x900a('0x42')]=_0x900a('0x61');_0x3cf1ed=as[_0x900a('0x62')](_0x22d8db,_0x1d317c[_0x900a('0x36')],_0x146a5f);_0x581fe8[_0x42b956](_0x3cf1ed[_0x900a('0x63')],_0x3cf1ed['value'][_0x900a('0x64')],_0x3cf1ed[_0x900a('0x59')][_0x900a('0x14')]);}break;case _0x900a('0x65'):var _0x3989b4=_0x146a5f[_0x900a('0x59')][_0x900a('0x23')](',')['map'](function(_0x567ab9){return Number(_0x567ab9);});_0x3989b4[_0x900a('0x24')](function(_0x2c7246){_0x2250d8['or'](_0x900a('0x66'),'%,'+_0x2c7246+',%');});_0x312905=_[_0x900a('0x67')](_0x312905,_0x3989b4);break;case'User':if(_0x146a5f[_0x900a('0x5d')]==='$substring'){_0x581fe8[_0x42b956]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x146a5f[_0x900a('0x59')]+'%',null);}else{_0x1d317c=_['find'](_0x1a3bfc,[_0x900a('0x1f'),_0x900a('0x30')]);_0x146a5f['field']=_0x900a('0x30');_0x3cf1ed=as[_0x900a('0x62')](_0x22d8db,_0x1d317c[_0x900a('0x36')],_0x146a5f);_0x581fe8[_0x42b956](_0x3cf1ed[_0x900a('0x63')],_0x3cf1ed[_0x900a('0x59')][_0x900a('0x64')],_0x3cf1ed[_0x900a('0x59')][_0x900a('0x14')]);}break;case _0x900a('0x28'):_0x3cf1ed=as[_0x900a('0x62')]('me',null,_0x146a5f);_0x581fe8[_0x42b956](_0x3cf1ed[_0x900a('0x63')],_0x3cf1ed['value'][_0x900a('0x64')],_0x3cf1ed[_0x900a('0x59')][_0x900a('0x14')]);break;}}else{var _0x3cf1ed=as[_0x900a('0x62')](_0x22d8db,_0x1d317c[_0x900a('0x36')],_0x146a5f);_0x581fe8[_0x42b956](_0x3cf1ed[_0x900a('0x63')],_0x3cf1ed[_0x900a('0x59')]['start'],_0x3cf1ed['value'][_0x900a('0x14')]);}}}else{var _0x51665c=_(_0x54785d['query'])['keys']()['map'](function(_0x271388){return _['some'](_0x1a3bfc,[_0x900a('0x1f'),_0x271388])?_0x271388:undefined;})[_0x900a('0x68')]()['value']();if(!_['isEmpty'](_0x51665c)){_0x51665c[_0x900a('0x24')](function(_0x1f7339){if(_0x1f7339===_0x900a('0x69')){_0x3c125c['where'](_0x900a('0x6a'),[][_0x900a('0x6b')](_0x54785d['query'][_0x1f7339]));}else if(_0x1f7339===_0x900a('0x6c')){var _0x57bce3=JSON[_0x900a('0x6d')](_0x54785d[_0x900a('0x38')][_0x1f7339])['$gte'];var _0x37a903=JSON[_0x900a('0x6d')](_0x54785d[_0x900a('0x38')][_0x1f7339])[_0x900a('0x6e')];_0x3c125c[_0x900a('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x57bce3,_0x37a903);}else{if(_0x54785d[_0x900a('0x38')][_0x1f7339]==='null'){_0x3c125c[_0x900a('0x40')]('i.'+_0x1f7339+_0x900a('0x6f'));}else{_0x3c125c['where']('i.'+_0x1f7339+_0x900a('0x70'),_0x54785d[_0x900a('0x38')][_0x1f7339]);}}});}if(_0x54785d[_0x900a('0x38')][_0x900a('0x71')]){if(_0x54785d['query'][_0x900a('0x71')]==0x1){_0x3c125c['having'](_0x900a('0x72'));}else{_0x3c125c[_0x900a('0x5a')]('`unreadMessages`\x20>\x200');}}if(_0x54785d[_0x900a('0x38')][_0x900a('0x73')]){_0x312905=_[_0x900a('0x74')](_0x54785d[_0x900a('0x38')]['tag'])?_0x54785d[_0x900a('0x38')]['tag']:new Array(_0x54785d[_0x900a('0x38')][_0x900a('0x73')]);_0x312905['forEach'](function(_0x15f48c){_0x2250d8['or'](_0x900a('0x66'),'%,'+_0x15f48c+',%');});}if(_0x54785d['query']['filter']){var _0x2f1635=_0x54785d[_0x900a('0x38')][_0x900a('0x75')][_0x900a('0x76')]('\x5c','\x5c\x5c')[_0x900a('0x76')](/'/g,'\x27\x27');if(qs[_0x900a('0x77')](_0x2f1635)){_0x581fe8['or'](_0x900a('0x78'),_0x2f1635+'%');}else if(qs[_0x900a('0x79')](_0x2f1635)){_0x581fe8['or']('c.email\x20LIKE\x20?',_0x2f1635+'%');}else{_0x581fe8['or'](_0x900a('0x7a'),qs[_0x900a('0x5f')](_0x2f1635))['or'](_0x900a('0x7b'),qs[_0x900a('0x5f')](_0x2f1635));}}}_0x3c125c[_0x900a('0x40')](_0x581fe8);_0x3c125c[_0x900a('0x7c')](_0x900a('0x7d'));var _0x372b13={'type':db[_0x900a('0x7e')]['QueryTypes'][_0x900a('0x7f')],'raw':!![]};var _0xa8ae96=_0x3c125c[_0x900a('0x80')]();_0xa8ae96['field'](_0x900a('0x7d'));_0xa8ae96[_0x900a('0x42')](_0x900a('0x81'),_0x900a('0x82'));if(_0x2a0a00[_0x900a('0x83')]){_0x2a0a00[_0x900a('0x83')]['forEach'](function(_0x3c5c13){var _0x1a6a56=_0x3c5c13[0x0]==='contactName'?_0x3c5c13[0x0]:'i.'+_0x3c5c13[0x0];_0x3c125c['order'](_0x1a6a56,_0x3c5c13[0x1]===_0x900a('0x84')?![]:!![]);});}if(!_[_0x900a('0x85')](_0x312905)){_0x3c125c['having'](_0x2250d8);_0xa8ae96['where'](_0x900a('0x86'),_0x312905);}BPromise[_0x900a('0x87')]()[_0x900a('0x1c')](function(){if(!_0x1d543c){if(_0x54785d[_0x900a('0x38')]['MailAccountId'])return;_0xa8ae96[_0x900a('0x40')](_0x900a('0x88'));_0x3c125c[_0x900a('0x40')](_0x900a('0x88'));return;}if(_0x54785d['user'][_0x900a('0x89')]!==_0x900a('0x8a'))return;return _0x54785d[_0x900a('0x8b')][_0x900a('0x8c')]({'attributes':['id'],'raw':!![]})[_0x900a('0x1c')](function(_0x5278ec){if(_[_0x900a('0x85')](_0x5278ec)){_0xa8ae96[_0x900a('0x40')](_0x900a('0x8d'));_0x3c125c[_0x900a('0x40')](_0x900a('0x8d'));}else{_0xa8ae96[_0x900a('0x40')](_0x900a('0x6a'),_[_0x900a('0x21')](_0x5278ec,'id'));_0x3c125c[_0x900a('0x40')](_0x900a('0x6a'),_['map'](_0x5278ec,'id'));}});})[_0x900a('0x1c')](function(){if(_0x54785d[_0x900a('0x8b')][_0x900a('0x89')]==='agent'&&!_0x1d543c&&!_0x54785d['query'][_0x900a('0x69')])return[];return db[_0x900a('0x8e')]['query'](_0xa8ae96['toString'](),_0x372b13);})['then'](function(_0x5c2060){_0x5c4184[_0x900a('0x19')]=_0x5c2060[_0x900a('0x3d')];if(_0x5c4184[_0x900a('0x19')]===0x0)return[];return db[_0x900a('0x8e')][_0x900a('0x38')](_0x17e416[_0x900a('0x8f')](),_0x372b13)[_0x900a('0x1c')](function(_0x1b529c){_0x4314bc=_[_0x900a('0x90')](_0x1b529c,'id');_0x372b13=_['merge'](_0x372b13,{'model':db[_0x900a('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x54785d[_0x900a('0x38')][_0x900a('0x3c')]){_0x2a0a00[_0x900a('0x3b')]['forEach'](function(_0x1f4e88){_0x3c125c[_0x900a('0x42')]('i.'+_0x1f4e88);});}else{_0x3c125c[_0x900a('0x42')](_0x900a('0x81'),_0x900a('0x82'));_0x3c125c['field'](_0x900a('0x91'),_0x900a('0x92'));_0x3c125c['field'](_0x900a('0x93'),'Account.mandatoryDisposition');_0x3c125c[_0x900a('0x42')](_0x900a('0x94'),'Account.email');_0x3c125c['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x900a('0x95'));_0x3c125c[_0x900a('0x42')](_0x900a('0x7d'));_0x3c125c[_0x900a('0x42')](_0x900a('0x96'));_0x3c125c[_0x900a('0x42')](_0x900a('0x97'));_0x3c125c[_0x900a('0x42')](_0x900a('0x98'));_0x3c125c[_0x900a('0x42')](_0x900a('0x99'));_0x3c125c['field'](_0x900a('0x9a'));_0x3c125c[_0x900a('0x42')](_0x900a('0x9b'));_0x3c125c[_0x900a('0x42')](_0x900a('0x9c'));_0x3c125c[_0x900a('0x42')](_0x900a('0x9d'));_0x3c125c[_0x900a('0x42')](_0x900a('0x9e'));_0x3c125c[_0x900a('0x42')](_0x900a('0x9f'));_0x3c125c[_0x900a('0x42')](_0x900a('0xa0'));_0x3c125c[_0x900a('0x42')]('i.substatus');_0x3c125c['field'](_0x900a('0xa1'));_0x3c125c[_0x900a('0x42')](_0x900a('0xa2'));_0x3c125c['field'](_0x900a('0xa3'));_0x3c125c[_0x900a('0x42')](_0x900a('0xa4'));_0x3c125c[_0x900a('0x42')]('c.firstName',_0x900a('0xa5'));_0x3c125c[_0x900a('0x42')]('c.lastName',_0x900a('0xa6'));_0x3c125c['field'](_0x900a('0xa7'),_0x900a('0xa8'));_0x3c125c['field'](_0x900a('0xa9'),_0x900a('0xaa'));_0x3c125c[_0x900a('0x42')](_0x900a('0xab'),'Contact.mobile');_0x3c125c['field']('c.fax',_0x900a('0xac'));_0x3c125c['field'](_0x900a('0xad'),'Owner.fullname');_0x3c125c[_0x900a('0x42')](_0x900a('0xae'),_0x900a('0xaf'));_0x3c125c[_0x900a('0x42')](_0x900a('0xb0'),_0x900a('0xb1'));}if(_0x2a0a00[_0x900a('0x18')])_0x3c125c[_0x900a('0x18')](_0x2a0a00[_0x900a('0x18')]);if(_0x2a0a00[_0x900a('0x16')])_0x3c125c[_0x900a('0x16')](_0x2a0a00[_0x900a('0x16')]);return db[_0x900a('0x8e')]['query'](_0x3c125c['toString'](),_0x372b13);})[_0x900a('0x1c')](function(_0x34dc9e){if(_0x34dc9e[_0x900a('0x3d')]>0x0)_0x50afbb[_0x900a('0x40')](_0x900a('0xb2'),_[_0x900a('0x21')](_0x34dc9e,'id'));return db[_0x900a('0x8e')]['query'](_0x50afbb[_0x900a('0x8f')](),_0x372b13)[_0x900a('0x1c')](function(_0x532f41){var _0x5d72a4=_['groupBy'](_0x532f41,_0x900a('0xb3'));var _0x11adfb=[];return db[_0x900a('0xb4')][_0x900a('0xb5')]({'attributes':[_0x900a('0xb6')],'raw':!![]})[_0x900a('0x1c')](function(_0x3d4029){var _0x4bfc41=_0x3d4029[_0x900a('0xb6')];_0x34dc9e[_0x900a('0x24')](function(_0x4978fb){_0x11adfb['push'](updateMailInteraction(_0x4978fb,_0x4314bc,_0x5d72a4,_0x4bfc41));});return BPromise[_0x900a('0xb7')](_0x11adfb);});});});})[_0x900a('0x1c')](function(_0x110e2a){_0x5c4184[_0x900a('0xb8')]=_0x110e2a;return _0x5c4184;})[_0x900a('0x1c')](respondWithFilteredResult(_0x3d8555,_0x2a0a00))['catch'](handleError(_0x3d8555,null));};exports[_0x900a('0xb9')]=function(_0xa83781,_0x3703d0){var _0x11e728={'raw':![],'where':{'id':_0xa83781[_0x900a('0xba')]['id']}},_0x3254b4={};_0x3254b4[_0x900a('0x37')]=_[_0x900a('0xbb')](db[_0x900a('0x33')]['rawAttributes']);_0x3254b4['query']=_[_0x900a('0xbb')](_0xa83781[_0x900a('0x38')]);_0x3254b4['filters']=_[_0x900a('0x3a')](_0x3254b4[_0x900a('0x37')],_0x3254b4['query']);_0x11e728[_0x900a('0x3b')]=_['intersection'](_0x3254b4[_0x900a('0x37')],qs[_0x900a('0x3c')](_0xa83781[_0x900a('0x38')]['fields']));_0x11e728[_0x900a('0x3b')]=_0x11e728[_0x900a('0x3b')][_0x900a('0x3d')]?_0x11e728[_0x900a('0x3b')]:_0x3254b4[_0x900a('0x37')];if(_0xa83781[_0x900a('0x38')][_0x900a('0xbc')]){_0x11e728['include']=[{'all':!![]}];}_0x11e728=_[_0x900a('0xbd')]({},_0x11e728,_0xa83781[_0x900a('0xbe')]);return db[_0x900a('0x33')][_0x900a('0x58')](_0x11e728)['then'](handleEntityNotFound(_0x3703d0,null))[_0x900a('0x1c')](respondWithResult(_0x3703d0,null))['catch'](handleError(_0x3703d0,null));};exports[_0x900a('0xbf')]=function(_0x56f673,_0xe8780a){return db[_0x900a('0x33')][_0x900a('0xbf')](_0x56f673[_0x900a('0xc0')],{})[_0x900a('0x1c')](respondWithResult(_0xe8780a,0xc9))[_0x900a('0x2b')](handleError(_0xe8780a,null));};exports['update']=function(_0x7a7f06,_0x60a7d2){if(_0x7a7f06[_0x900a('0xc0')]['id']){delete _0x7a7f06[_0x900a('0xc0')]['id'];}return db[_0x900a('0x33')][_0x900a('0x58')]({'where':{'id':_0x7a7f06['params']['id']}})[_0x900a('0x1c')](handleEntityNotFound(_0x60a7d2,null))['then'](saveUpdates(_0x7a7f06[_0x900a('0xc0')],null))[_0x900a('0x1c')](respondWithResult(_0x60a7d2,null))[_0x900a('0x2b')](handleError(_0x60a7d2,null));};exports['destroy']=function(_0x2a1c48,_0x2dcf6e){return db[_0x900a('0x33')][_0x900a('0x58')]({'where':{'id':_0x2a1c48[_0x900a('0xba')]['id']}})[_0x900a('0x1c')](handleEntityNotFound(_0x2dcf6e,null))['then'](removeEntity(_0x2dcf6e,null))[_0x900a('0x2b')](handleError(_0x2dcf6e,null));};exports['describe']=function(_0xa183fa,_0x4ff9fe){return db[_0x900a('0x33')]['describe']()[_0x900a('0x1c')](respondWithResult(_0x4ff9fe,null))[_0x900a('0x2b')](handleError(_0x4ff9fe,null));};exports[_0x900a('0xc1')]=function(_0x2a0b62,_0x1a61a8){return db[_0x900a('0x26')][_0x900a('0x58')]({'where':{'id':_0x2a0b62[_0x900a('0xba')]['id']}})[_0x900a('0x1c')](handleEntityNotFound(_0x1a61a8,null))[_0x900a('0x1c')](function(_0x11d311){if(_0x11d311){return _0x11d311[_0x900a('0xc1')](_0x2a0b62[_0x900a('0xc0')][_0x900a('0xc2')],_[_0x900a('0xc3')](_0x2a0b62[_0x900a('0xc0')],['ids','id'])||{});}})[_0x900a('0x1c')](respondWithResult(_0x1a61a8,null))[_0x900a('0x2b')](handleError(_0x1a61a8,null));};exports[_0x900a('0xc4')]=function(_0x240214,_0x585978){var _0xdb978f={'raw':![],'where':{}};var _0x36cc18={};var _0x5cce17={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x240214[_0x900a('0xba')]['id']}})[_0x900a('0x1c')](handleEntityNotFound(_0x585978,null))[_0x900a('0x1c')](function(_0xda6fae){if(_0xda6fae){_0x36cc18[_0x900a('0x37')]=_[_0x900a('0xbb')](db[_0x900a('0x26')]['rawAttributes']);_0x36cc18[_0x900a('0x38')]=_['keys'](_0x240214[_0x900a('0x38')]);_0x36cc18[_0x900a('0x39')]=_[_0x900a('0x3a')](_0x36cc18[_0x900a('0x37')],_0x36cc18['query']);_0xdb978f[_0x900a('0x3b')]=_[_0x900a('0x3a')](_0x36cc18[_0x900a('0x37')],qs[_0x900a('0x3c')](_0x240214['query'][_0x900a('0x3c')]));_0xdb978f[_0x900a('0x3b')]=_0xdb978f[_0x900a('0x3b')][_0x900a('0x3d')]?_0xdb978f[_0x900a('0x3b')]:_0x36cc18[_0x900a('0x37')];if(!_0x240214[_0x900a('0x38')]['hasOwnProperty'](_0x900a('0x3e'))){_0xdb978f[_0x900a('0x18')]=qs[_0x900a('0x18')](_0x240214[_0x900a('0x38')]['limit']);_0xdb978f[_0x900a('0x16')]=qs['offset'](_0x240214[_0x900a('0x38')][_0x900a('0x16')]);}_0xdb978f[_0x900a('0x83')]=qs[_0x900a('0x3f')](_0x240214[_0x900a('0x38')][_0x900a('0x3f')]);_0xdb978f[_0x900a('0x40')]=qs[_0x900a('0x39')](_[_0x900a('0xc5')](_0x240214[_0x900a('0x38')],_0x36cc18['filters']));_0xdb978f[_0x900a('0x40')][_0x900a('0xb3')]=_0xda6fae['id'];if(_0x240214[_0x900a('0x38')][_0x900a('0x75')]){_0xdb978f[_0x900a('0x40')]=_[_0x900a('0xbd')](_0xdb978f[_0x900a('0x40')],{'$or':_['map'](_0xdb978f[_0x900a('0x3b')],function(_0x4a8bf8){var _0x85d375={};_0x85d375[_0x4a8bf8]={'$like':'%'+_0x240214[_0x900a('0x38')][_0x900a('0x75')]+'%'};return _0x85d375;})});}if(_0x240214[_0x900a('0x38')][_0x900a('0xc6')]){var _0x1b7b50=_0x240214[_0x900a('0x38')]['$gte'][_0x900a('0x23')](',');var _0x12152a={};_0x12152a[_0x1b7b50[0x0]]={'$gte':moment(_0x1b7b50[0x1])[_0x900a('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')};_0xdb978f[_0x900a('0x40')]=_[_0x900a('0xbd')](_0xdb978f[_0x900a('0x40')],_0x12152a);}_0xdb978f=_[_0x900a('0xbd')]({},_0xdb978f,_0x240214[_0x900a('0xbe')]);return db['MailMessage']['count']({'where':_0xdb978f[_0x900a('0x40')]})[_0x900a('0x1c')](function(_0x14f20b){_0x5cce17[_0x900a('0x19')]=_0x14f20b;if(_0x240214[_0x900a('0x38')][_0x900a('0xbc')]){_0xdb978f[_0x900a('0xc8')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0xdb978f);})[_0x900a('0x1c')](function(_0x2f7f4b){if(_0x240214[_0x900a('0x38')]['inlineCss']==='true'){for(var _0x19f6ce=0x0;_0x19f6ce<_0x2f7f4b['length'];_0x19f6ce++){_0x2f7f4b[_0x19f6ce][_0x900a('0xc0')]=juice(_0x2f7f4b[_0x19f6ce][_0x900a('0xc0')]);}}_0x5cce17[_0x900a('0xb8')]=_0x2f7f4b;return _0x5cce17;});}})[_0x900a('0x1c')](respondWithFilteredResult(_0x585978,_0xdb978f))['catch'](handleError(_0x585978,null));};exports[_0x900a('0xc9')]=function(_0x3780e4,_0x4e53ba){return db['MailInteraction'][_0x900a('0x58')]({'where':{'id':_0x3780e4[_0x900a('0xba')]['id']}})['then'](handleEntityNotFound(_0x4e53ba,null))[_0x900a('0x1c')](function(_0x276c64){if(_0x276c64){return _0x276c64[_0x900a('0xca')](_0x3780e4[_0x900a('0xc0')][_0x900a('0xc2')],_[_0x900a('0xc3')](_0x3780e4[_0x900a('0xc0')],[_0x900a('0xc2'),'id'])||{})[_0x900a('0xcb')](function(){return db[_0x900a('0x65')][_0x900a('0xcc')]({'attributes':['id',_0x900a('0x1f'),_0x900a('0xcd')],'where':{'id':_0x3780e4[_0x900a('0xc0')]['ids']}});})[_0x900a('0x1c')](function(_0x5a27bd){socket['emit'](_0x900a('0xce'),{'id':Number(_0x3780e4[_0x900a('0xba')]['id']),'tags':_0x5a27bd||[]});return{'id':Number(_0x3780e4[_0x900a('0xba')]['id']),'tags':_0x5a27bd||[]};});}})['then'](respondWithResult(_0x4e53ba,null))['catch'](handleError(_0x4e53ba,null));};exports[_0x900a('0xcf')]=function(_0x5acba9,_0x3eee2a){return db['MailInteraction'][_0x900a('0x58')]({'where':{'id':_0x5acba9[_0x900a('0xba')]['id']}})[_0x900a('0x1c')](handleEntityNotFound(_0x3eee2a,null))[_0x900a('0x1c')](function(_0x3ef976){if(_0x3ef976){return _0x3ef976[_0x900a('0xcf')](_0x5acba9[_0x900a('0x38')][_0x900a('0xc2')]);}})['then'](respondWithStatusCode(_0x3eee2a,null))[_0x900a('0x2b')](handleError(_0x3eee2a,null));};exports[_0x900a('0xd0')]=function(_0x94070f,_0x1cf2f2){var _0x20a0c8=moment()[_0x900a('0xd1')]()[_0x900a('0x8f')]();var _0x10cb7d=path['join'](config['root'],_0x900a('0xd2'),_0x900a('0xd3'),_0x900a('0xd4'));var _0x18793a=path['join'](config[_0x900a('0xd5')],'server','files',_0x900a('0xd6'));var _0x31c51c=path['join'](_0x10cb7d,_0x20a0c8);var _0x44aef8=util[_0x900a('0xc7')](_0x900a('0xd7'),_0x94070f[_0x900a('0xba')]['id'],_0x20a0c8);var _0x4a0f90=path[_0x900a('0xd8')](_0x10cb7d,_0x44aef8);var _0x4cfe87=[];if(_0x94070f['query'][_0x900a('0xd6')]){_0x4cfe87[_0x900a('0x25')]({'model':db[_0x900a('0xd9')],'as':_0x900a('0xda'),'raw':!![]});}var _0x33b44f=[{'model':db[_0x900a('0x26')],'as':_0x900a('0xdb'),'attributes':['id',_0x900a('0xc0'),_0x900a('0x43'),'to','cc',_0x900a('0xdc'),_0x900a('0xdd'),_0x900a('0x6c')],'where':{'secret':![]},'order':qs[_0x900a('0x3f')]('id'),'include':_0x4cfe87}];return db[_0x900a('0x33')][_0x900a('0x58')]({'where':{'id':_0x94070f[_0x900a('0xba')]['id']},'include':_0x33b44f})[_0x900a('0x1c')](handleEntityNotFound(_0x1cf2f2,null))['then'](function(_0xa51c90){if(_0xa51c90&&_0xa51c90[_0x900a('0xdb')]){var _0x259cbf=_0xa51c90[_0x900a('0xde')]({'plain':!![]});fs[_0x900a('0xdf')](_0x31c51c);return BPromise[_0x900a('0xe0')](_0x259cbf[_0x900a('0xdb')],function(_0x3487bc,_0x15d295){var _0x1e0cab={'from':_0x3487bc['from'],'to':_0x3487bc['to'],'subject':_0x3487bc[_0x900a('0xdd')],'html':htmlEntities[_0x900a('0xe1')](_0x3487bc[_0x900a('0xc0')]),'headers':{'Date':moment(_0x3487bc[_0x900a('0x6c')])[_0x900a('0xc7')](_0x900a('0xe2'))},'attachments':[]};if(_0x3487bc['cc']){_0x1e0cab[_0x900a('0xe3')]['Cc']=_0x3487bc['cc'];}if(_0x3487bc[_0x900a('0xdc')]){_0x1e0cab[_0x900a('0xe3')][_0x900a('0xe4')]=_0x3487bc[_0x900a('0xdc')];}return new BPromise(function(_0x42c8a1,_0x116165){if(_0x3487bc['Attachments']){for(var _0x177329=0x0;_0x177329<_0x3487bc[_0x900a('0xda')]['length'];_0x177329++){var _0x416ece=_0x3487bc['Attachments'][_0x177329];var _0x7f4bf2=path[_0x900a('0xd8')](_0x18793a,_0x416ece[_0x900a('0xe5')]);if(fs[_0x900a('0xe6')](_0x7f4bf2)){_0x1e0cab['attachments'][_0x900a('0x25')]({'name':_0x416ece[_0x900a('0x1f')],'contentType':_0x416ece[_0x900a('0x36')],'data':fs[_0x900a('0xe7')](_0x7f4bf2)});}}}emlformat['build'](_0x1e0cab,function(_0x5e438c,_0x32823a){if(_0x5e438c)return _0x116165(_0x5e438c);fs[_0x900a('0xe8')](path[_0x900a('0xd8')](_0x31c51c,util[_0x900a('0xc7')](_0x900a('0xe9'),_0x15d295)),_0x32823a);return _0x42c8a1(_0x32823a);});});})[_0x900a('0x1c')](function(){return new BPromise(function(_0x1a0777,_0x2fcd8b){zipdir(_0x31c51c,{'saveTo':_0x4a0f90},function(_0x31914,_0x2c05e9){if(_0x31914)return _0x2fcd8b(_0x31914);return _0x1a0777(_0x2c05e9);});})[_0x900a('0x1c')](function(){return new BPromise(function(_0x3e143f,_0x251d37){rimraf(_0x31c51c,function(_0x1c126c){if(_0x1c126c)_0x251d37(_0x1c126c);return _0x3e143f();});});})[_0x900a('0x1c')](function(){return _0x1cf2f2[_0x900a('0xd0')](_0x4a0f90,_0x44aef8,function(_0x4ba734){if(!_0x4ba734)fs[_0x900a('0xea')](_0x4a0f90);});});});}else{return _0x1cf2f2[_0x900a('0x12')](0xc8);}})[_0x900a('0x2b')](handleError(_0x1cf2f2,null));};
\ No newline at end of file
index 7055242..517a29d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x210d=['map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','save','getUsers','then','Users'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x210d,0x1e6));var _0xd210=function(_0x3be2e2,_0x5c166d){_0x3be2e2=_0x3be2e2-0x0;var _0x53b9c5=_0x210d[_0x3be2e2];return _0x53b9c5;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xd210('0x0'))['db'][_0xd210('0x1')];var MailMessage=require(_0xd210('0x0'))['db'][_0xd210('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd210('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x59560e){return function(_0xae467c,_0x5e19d1,_0x57d8db){_0xae467c[_0xd210('0x4')]({'attributes':['id'],'raw':!![]})[_0xd210('0x5')](function(_0x1a4d7f){_0xae467c['setDataValue'](_0xd210('0x6'),_0x1a4d7f[_0xd210('0x7')](function(_0x12860c){return{'id':_0x12860c['id']};}));return MailMessage[_0xd210('0x8')]({'where':{'MailInteractionId':_0xae467c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd210('0x5')](function(_0x2c3773){_0xae467c[_0xd210('0x9')](_0xd210('0xa'),_0x2c3773[_0xd210('0xb')]);MailInteractionEvents[_0xd210('0xc')](_0x59560e+':'+_0xae467c['id'],_0xae467c);MailInteractionEvents['emit'](_0x59560e,_0xae467c);_0x57d8db(null);})[_0xd210('0xd')](_0x57d8db(null));};}for(var e in events){if(events[_0xd210('0xe')](e)){var event=events[e];MailInteraction[_0xd210('0xf')](e,emitEvent(event));}}module[_0xd210('0x10')]=MailInteractionEvents;
\ No newline at end of file
+var _0x76f6=['hook','exports','../../mysqldb','MailInteraction','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','hasOwnProperty'];(function(_0x4d9965,_0x32aca7){var _0x243e98=function(_0x20b7c0){while(--_0x20b7c0){_0x4d9965['push'](_0x4d9965['shift']());}};_0x243e98(++_0x32aca7);}(_0x76f6,0xb2));var _0x676f=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x76f6[_0x307d86];return _0x361745;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x676f('0x0'))['db'][_0x676f('0x1')];var MailMessage=require(_0x676f('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x676f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x676f('0x3'),'afterDestroy':_0x676f('0x4')};function emitEvent(_0x53a0c4){return function(_0x2fb87c,_0x2b2833,_0x427f0a){_0x2fb87c[_0x676f('0x5')]({'attributes':['id'],'raw':!![]})[_0x676f('0x6')](function(_0x1b93dc){_0x2fb87c[_0x676f('0x7')](_0x676f('0x8'),_0x1b93dc[_0x676f('0x9')](function(_0x2304cf){return{'id':_0x2304cf['id']};}));return MailMessage[_0x676f('0xa')]({'where':{'MailInteractionId':_0x2fb87c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x375e5b){_0x2fb87c[_0x676f('0x7')]('unreadMessages',_0x375e5b[_0x676f('0xb')]);MailInteractionEvents[_0x676f('0xc')](_0x53a0c4+':'+_0x2fb87c['id'],_0x2fb87c);MailInteractionEvents[_0x676f('0xc')](_0x53a0c4,_0x2fb87c);_0x427f0a(null);})['catch'](_0x427f0a(null));};}for(var e in events){if(events[_0x676f('0xd')](e)){var event=events[e];MailInteraction[_0x676f('0xe')](e,emitEvent(event));}}module[_0x676f('0xf')]=MailInteractionEvents;
\ No newline at end of file
index 0532589..a2139fc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x42b4=['define','mail_interactions','fti_mail_interactions','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3a7505,_0x1c97b2){var _0x2dee4f=function(_0x562450){while(--_0x562450){_0x3a7505['push'](_0x3a7505['shift']());}};_0x2dee4f(++_0x1c97b2);}(_0x42b4,0x1cb));var _0x442b=function(_0x1b5c9a,_0x28ff06){_0x1b5c9a=_0x1b5c9a-0x0;var _0x2844ab=_0x42b4[_0x1b5c9a];return _0x2844ab;};'use strict';var _=require(_0x442b('0x0'));var util=require(_0x442b('0x1'));var logger=require(_0x442b('0x2'))(_0x442b('0x3'));var moment=require(_0x442b('0x4'));var BPromise=require(_0x442b('0x5'));var rp=require(_0x442b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x442b('0x7'));var config=require(_0x442b('0x8'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x53abf7,_0x35cd4a){return _0x53abf7[_0x442b('0x9')]('MailInteraction',attributes,{'tableName':_0x442b('0xa'),'paranoid':![],'indexes':[{'name':_0x442b('0xb'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f4905,_0x1b3ae6,_0x4ed18f){if(_0x3f4905[_0x442b('0xc')]){_0x3f4905[_0x442b('0xd')]=moment()[_0x442b('0xe')](_0x442b('0xf'));}if(_0x3f4905[_0x442b('0x10')]){_0x3f4905[_0x442b('0x11')]=moment()[_0x442b('0xe')](_0x442b('0xf'));}_0x4ed18f(null,_0x1b3ae6);},'beforeUpdate':function(_0x845b60,_0x1dcc0e,_0x446b00){if(_0x845b60['changed'](_0x442b('0xc'))){_0x845b60[_0x442b('0xd')]=_0x845b60[_0x442b('0xc')]?moment()[_0x442b('0xe')](_0x442b('0xf')):null;}if(_0x845b60[_0x442b('0x12')](_0x442b('0x10'))){_0x845b60[_0x442b('0x11')]=moment()[_0x442b('0xe')](_0x442b('0xf'));_0x845b60['substatus']=null;_0x845b60[_0x442b('0xd')]=null;}_0x446b00(null,_0x845b60);},'afterUpdate':function(_0x7a15c4,_0x2d0c99,_0x1bc47c){var _0x3b0c86=_0x53abf7[_0x442b('0x13')];var _0x3a4b3f=_0x7a15c4[_0x442b('0x14')]({'plain':!![]});if(_0x3a4b3f[_0x442b('0x10')]){return _0x3b0c86[_0x442b('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x3a4b3f['id']}})[_0x442b('0x16')](function(){_0x1bc47c();})[_0x442b('0x17')](function(_0x817ddd){_0x1bc47c(_0x817ddd);});}else{_0x1bc47c();}}},'charset':_0x442b('0x18'),'collate':_0x442b('0x19')});};
\ No newline at end of file
+var _0xf2e5=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','substatus','changed','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','substatusAt','closed'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0xf2e5,0x185));var _0x5f2e=function(_0x438e18,_0x52e2c5){_0x438e18=_0x438e18-0x0;var _0x50c6ea=_0xf2e5[_0x438e18];return _0x50c6ea;};'use strict';var _=require(_0x5f2e('0x0'));var util=require(_0x5f2e('0x1'));var logger=require(_0x5f2e('0x2'))('api');var moment=require(_0x5f2e('0x3'));var BPromise=require(_0x5f2e('0x4'));var rp=require(_0x5f2e('0x5'));var fs=require('fs');var path=require(_0x5f2e('0x6'));var rimraf=require(_0x5f2e('0x7'));var config=require(_0x5f2e('0x8'));var attributes=require(_0x5f2e('0x9'));module[_0x5f2e('0xa')]=function(_0x580b30,_0x32aea7){return _0x580b30[_0x5f2e('0xb')](_0x5f2e('0xc'),attributes,{'tableName':_0x5f2e('0xd'),'paranoid':![],'indexes':[{'name':_0x5f2e('0xe'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3c4474,_0x238e05,_0x5a0ea3){if(_0x3c4474['substatus']){_0x3c4474[_0x5f2e('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3c4474[_0x5f2e('0x10')]){_0x3c4474[_0x5f2e('0x11')]=moment()[_0x5f2e('0x12')](_0x5f2e('0x13'));}_0x5a0ea3(null,_0x238e05);},'beforeUpdate':function(_0x25a743,_0x4a7cec,_0x42f59e){if(_0x25a743['changed'](_0x5f2e('0x14'))){_0x25a743[_0x5f2e('0xf')]=_0x25a743['substatus']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x25a743[_0x5f2e('0x15')](_0x5f2e('0x10'))){_0x25a743['closedAt']=moment()[_0x5f2e('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x25a743['substatus']=null;_0x25a743[_0x5f2e('0xf')]=null;}_0x42f59e(null,_0x25a743);},'afterUpdate':function(_0x15bb2b,_0x18eab4,_0x350f6c){var _0x117ca4=_0x580b30['models'];var _0x2be436=_0x15bb2b[_0x5f2e('0x16')]({'plain':!![]});if(_0x2be436[_0x5f2e('0x10')]){return _0x117ca4[_0x5f2e('0x17')][_0x5f2e('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x2be436['id']}})[_0x5f2e('0x19')](function(){_0x350f6c();})[_0x5f2e('0x1a')](function(_0x271a49){_0x350f6c(_0x271a49);});}else{_0x350f6c();}}},'charset':_0x5f2e('0x1b'),'collate':_0x5f2e('0x1c')});};
\ No newline at end of file
index 0f98bed..877f00a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x32c3=['attributes','limit','AddTagsToMailInteraction','find','then','addTags','ids','body','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where'];(function(_0x52dc73,_0x149a7f){var _0x5315d2=function(_0x288771){while(--_0x288771){_0x52dc73['push'](_0x52dc73['shift']());}};_0x5315d2(++_0x149a7f);}(_0x32c3,0x1a8));var _0x332c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x32c3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x332c('0x0'));var util=require(_0x332c('0x1'));var moment=require(_0x332c('0x2'));var BPromise=require(_0x332c('0x3'));var rs=require(_0x332c('0x4'));var fs=require('fs');var Redis=require(_0x332c('0x5'));var db=require(_0x332c('0x6'))['db'];var utils=require(_0x332c('0x7'));var logger=require(_0x332c('0x8'))(_0x332c('0x9'));var config=require(_0x332c('0xa'));var jayson=require(_0x332c('0xb'));var client=jayson[_0x332c('0xc')][_0x332c('0xd')]({'port':0x232a});config[_0x332c('0xe')]=_['defaults'](config['redis'],{'host':_0x332c('0xf'),'port':0x18eb});var socket=require(_0x332c('0x10'))(new Redis(config[_0x332c('0xe')]));require(_0x332c('0x11'))[_0x332c('0x12')](socket);function respondWithRpcPromise(_0x9dda0,_0x71d6ba,_0x2d6212){return new BPromise(function(_0xab24ed,_0x1a6688){return client[_0x332c('0x13')](_0x9dda0,_0x2d6212)['then'](function(_0x3bf984){logger[_0x332c('0x14')]('MailInteraction,\x20%s,\x20%s',_0x71d6ba,_0x332c('0x15'));logger[_0x332c('0x16')](_0x332c('0x17'),_0x71d6ba,_0x332c('0x15'),JSON[_0x332c('0x18')](_0x3bf984));if(_0x3bf984[_0x332c('0x19')]){if(_0x3bf984[_0x332c('0x19')]['code']===0x1f4){logger[_0x332c('0x19')](_0x332c('0x1a'),_0x71d6ba,_0x3bf984[_0x332c('0x19')][_0x332c('0x1b')]);return _0x1a6688(_0x3bf984[_0x332c('0x19')]['message']);}logger[_0x332c('0x19')](_0x332c('0x1a'),_0x71d6ba,_0x3bf984[_0x332c('0x19')]['message']);return _0xab24ed(_0x3bf984['error'][_0x332c('0x1b')]);}else{logger[_0x332c('0x14')](_0x332c('0x1a'),_0x71d6ba,_0x332c('0x15'));_0xab24ed(_0x3bf984[_0x332c('0x1c')][_0x332c('0x1b')]);}})[_0x332c('0x1d')](function(_0x5365af){logger[_0x332c('0x19')](_0x332c('0x1a'),_0x71d6ba,_0x5365af);_0x1a6688(_0x5365af);});});}exports[_0x332c('0x1e')]=function(_0x384e42){var _0x5027be=this;return new Promise(function(_0x335bc3,_0x2db6f6){return db[_0x332c('0x1f')][_0x332c('0x20')](_0x384e42['body'],{'raw':_0x384e42[_0x332c('0x21')]?_0x384e42[_0x332c('0x21')][_0x332c('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x384e42[_0x332c('0x21')]?_0x384e42[_0x332c('0x21')][_0x332c('0x23')]||null:null,'attributes':_0x384e42[_0x332c('0x21')]?_0x384e42[_0x332c('0x21')][_0x332c('0x24')]||null:null,'limit':_0x384e42[_0x332c('0x21')]?_0x384e42['options'][_0x332c('0x25')]||null:null})['then'](function(_0x7f2a0d){logger[_0x332c('0x14')](_0x332c('0x1e'),_0x384e42);logger[_0x332c('0x16')]('UpdateMailInteraction',_0x384e42,JSON['stringify'](_0x7f2a0d));_0x335bc3(_0x7f2a0d);})[_0x332c('0x1d')](function(_0x36af75){logger['error'](_0x332c('0x1e'),_0x36af75[_0x332c('0x1b')],_0x384e42);_0x2db6f6(_0x5027be[_0x332c('0x19')](0x1f4,_0x36af75['message']));});});};exports[_0x332c('0x26')]=function(_0x55ab1f){return new Promise(function(_0x3bfd76,_0x272484){return db['MailInteraction'][_0x332c('0x27')]({'where':_0x55ab1f[_0x332c('0x21')]?_0x55ab1f[_0x332c('0x21')]['where']||null:null})[_0x332c('0x28')](function(_0x523195){if(_0x523195){return _0x523195[_0x332c('0x29')](_0x55ab1f['body'][_0x332c('0x2a')],_['omit'](_0x55ab1f[_0x332c('0x2b')],[_0x332c('0x2a'),'id'])||{});}})[_0x332c('0x2c')](function(_0xeccb32){logger['info'](_0x332c('0x2d'),_0x55ab1f);logger['debug']('AddTags',_0x55ab1f,JSON['stringify'](_0xeccb32));_0x3bfd76(_0xeccb32);})['catch'](function(_0x29385e){logger[_0x332c('0x19')](_0x332c('0x2d'),_0x29385e['message'],_0x55ab1f);_0x272484(_this[_0x332c('0x19')](0x1f4,_0x29385e[_0x332c('0x1b')]));});});};
\ No newline at end of file
+var _0x5549=['then','debug','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','limit'];(function(_0x24f925,_0x58e0cf){var _0x29547d=function(_0x333148){while(--_0x333148){_0x24f925['push'](_0x24f925['shift']());}};_0x29547d(++_0x58e0cf);}(_0x5549,0x1f4));var _0x9554=function(_0x51b055,_0x466c5e){_0x51b055=_0x51b055-0x0;var _0x1d054d=_0x5549[_0x51b055];return _0x1d054d;};'use strict';var _=require(_0x9554('0x0'));var util=require(_0x9554('0x1'));var moment=require(_0x9554('0x2'));var BPromise=require(_0x9554('0x3'));var rs=require(_0x9554('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9554('0x5'))['db'];var utils=require(_0x9554('0x6'));var logger=require(_0x9554('0x7'))(_0x9554('0x8'));var config=require(_0x9554('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9554('0xa')]['http']({'port':0x232a});config[_0x9554('0xb')]=_[_0x9554('0xc')](config[_0x9554('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9554('0xd'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x9554('0xe')](socket);function respondWithRpcPromise(_0x4d488d,_0x2d5751,_0x32923d){return new BPromise(function(_0x3fee11,_0x1aacd9){return client[_0x9554('0xf')](_0x4d488d,_0x32923d)['then'](function(_0x4adf50){logger[_0x9554('0x10')](_0x9554('0x11'),_0x2d5751,_0x9554('0x12'));logger['debug'](_0x9554('0x13'),_0x2d5751,_0x9554('0x12'),JSON[_0x9554('0x14')](_0x4adf50));if(_0x4adf50['error']){if(_0x4adf50[_0x9554('0x15')][_0x9554('0x16')]===0x1f4){logger['error'](_0x9554('0x11'),_0x2d5751,_0x4adf50[_0x9554('0x15')][_0x9554('0x17')]);return _0x1aacd9(_0x4adf50[_0x9554('0x15')]['message']);}logger[_0x9554('0x15')](_0x9554('0x11'),_0x2d5751,_0x4adf50[_0x9554('0x15')]['message']);return _0x3fee11(_0x4adf50[_0x9554('0x15')]['message']);}else{logger[_0x9554('0x10')](_0x9554('0x11'),_0x2d5751,'request\x20sent');_0x3fee11(_0x4adf50[_0x9554('0x18')][_0x9554('0x17')]);}})[_0x9554('0x19')](function(_0x2b386c){logger[_0x9554('0x15')](_0x9554('0x11'),_0x2d5751,_0x2b386c);_0x1aacd9(_0x2b386c);});});}exports[_0x9554('0x1a')]=function(_0x540285){var _0x526c19=this;return new Promise(function(_0x4221e8,_0x938c91){return db[_0x9554('0x1b')][_0x9554('0x1c')](_0x540285[_0x9554('0x1d')],{'raw':_0x540285[_0x9554('0x1e')]?_0x540285[_0x9554('0x1e')][_0x9554('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x540285['options']?_0x540285[_0x9554('0x1e')]['where']||null:null,'attributes':_0x540285[_0x9554('0x1e')]?_0x540285[_0x9554('0x1e')]['attributes']||null:null,'limit':_0x540285['options']?_0x540285[_0x9554('0x1e')][_0x9554('0x20')]||null:null})[_0x9554('0x21')](function(_0x394350){logger[_0x9554('0x10')](_0x9554('0x1a'),_0x540285);logger[_0x9554('0x22')](_0x9554('0x1a'),_0x540285,JSON[_0x9554('0x14')](_0x394350));_0x4221e8(_0x394350);})[_0x9554('0x19')](function(_0x5e94cd){logger[_0x9554('0x15')](_0x9554('0x1a'),_0x5e94cd[_0x9554('0x17')],_0x540285);_0x938c91(_0x526c19['error'](0x1f4,_0x5e94cd['message']));});});};exports['AddTagsToMailInteraction']=function(_0x4be9fd){return new Promise(function(_0x14ba0b,_0x497c13){return db[_0x9554('0x1b')][_0x9554('0x23')]({'where':_0x4be9fd[_0x9554('0x1e')]?_0x4be9fd[_0x9554('0x1e')]['where']||null:null})[_0x9554('0x21')](function(_0x2acbaf){if(_0x2acbaf){return _0x2acbaf[_0x9554('0x24')](_0x4be9fd[_0x9554('0x1d')][_0x9554('0x25')],_[_0x9554('0x26')](_0x4be9fd['body'],['ids','id'])||{});}})[_0x9554('0x27')](function(_0x38b683){logger[_0x9554('0x10')](_0x9554('0x28'),_0x4be9fd);logger[_0x9554('0x22')](_0x9554('0x28'),_0x4be9fd,JSON[_0x9554('0x14')](_0x38b683));_0x14ba0b(_0x38b683);})[_0x9554('0x19')](function(_0x4abc7b){logger[_0x9554('0x15')](_0x9554('0x28'),_0x4abc7b[_0x9554('0x17')],_0x4be9fd);_0x497c13(_this['error'](0x1f4,_0x4abc7b[_0x9554('0x17')]));});});};
\ No newline at end of file
index 4e92e27..9189d5b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf4de=['removeListener','register','length','mailInteraction:','./mailInteraction.events','save','update','emit'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0xf4de,0x18c));var _0xef4d=function(_0x5b002a,_0x138ae2){_0x5b002a=_0x5b002a-0x0;var _0x2cd787=_0xf4de[_0x5b002a];return _0x2cd787;};'use strict';var MailInteractionEvents=require(_0xef4d('0x0'));var events=[_0xef4d('0x1'),'remove',_0xef4d('0x2')];function createListener(_0x4edfa5,_0x498bc9){return function(_0x156ae3){_0x498bc9[_0xef4d('0x3')](_0x4edfa5,_0x156ae3);};}function removeListener(_0x4e5fc1,_0x2d0b38){return function(){MailInteractionEvents[_0xef4d('0x4')](_0x4e5fc1,_0x2d0b38);};}exports[_0xef4d('0x5')]=function(_0x30dd5e){for(var _0x2611f4=0x0,_0x1064a1=events[_0xef4d('0x6')];_0x2611f4<_0x1064a1;_0x2611f4++){var _0x1c9d9d=events[_0x2611f4];var _0x177747=createListener(_0xef4d('0x7')+_0x1c9d9d,_0x30dd5e);MailInteractionEvents['on'](_0x1c9d9d,_0x177747);}};
\ No newline at end of file
+var _0x9290=['length','mailInteraction:','./mailInteraction.events','remove','emit','removeListener','register'];(function(_0x32308c,_0x514c08){var _0x3a3929=function(_0x2bfec1){while(--_0x2bfec1){_0x32308c['push'](_0x32308c['shift']());}};_0x3a3929(++_0x514c08);}(_0x9290,0x1bb));var _0x0929=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0x9290[_0x27530d];return _0x59e561;};'use strict';var MailInteractionEvents=require(_0x0929('0x0'));var events=['save',_0x0929('0x1'),'update'];function createListener(_0x4679d4,_0xf2095f){return function(_0x2d1e74){_0xf2095f[_0x0929('0x2')](_0x4679d4,_0x2d1e74);};}function removeListener(_0x101ea8,_0x4c406b){return function(){MailInteractionEvents[_0x0929('0x3')](_0x101ea8,_0x4c406b);};}exports[_0x0929('0x4')]=function(_0x172d92){for(var _0x182b8c=0x0,_0x227d99=events[_0x0929('0x5')];_0x182b8c<_0x227d99;_0x182b8c++){var _0x5b6c2d=events[_0x182b8c];var _0x422d8c=createListener(_0x0929('0x6')+_0x5b6c2d,_0x172d92);MailInteractionEvents['on'](_0x5b6c2d,_0x422d8c);}};
\ No newline at end of file
index d124012..e4dca70 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xde56=['accept','/:id/reject','delete','/:id','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','isAuthenticated','describe','show','/:id/download','post','tracked','mail','create','put','update','/:id/accept'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xde56,0x144));var _0x6de5=function(_0x30f07a,_0x98341){_0x30f07a=_0x30f07a-0x0;var _0xb38461=_0xde56[_0x30f07a];return _0xb38461;};'use strict';var multer=require(_0x6de5('0x0'));var util=require('util');var path=require(_0x6de5('0x1'));var timeout=require(_0x6de5('0x2'));var express=require(_0x6de5('0x3'));var router=express[_0x6de5('0x4')]();var fs_extra=require(_0x6de5('0x5'));var auth=require(_0x6de5('0x6'));var interaction=require(_0x6de5('0x7'));var config=require(_0x6de5('0x8'));var controller=require(_0x6de5('0x9'));router[_0x6de5('0xa')]('/',auth['isAuthenticated'](),controller[_0x6de5('0xb')]);router[_0x6de5('0xa')](_0x6de5('0xc'),auth[_0x6de5('0xd')](),controller[_0x6de5('0xe')]);router[_0x6de5('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6de5('0xf')]);router[_0x6de5('0xa')](_0x6de5('0x10'),auth[_0x6de5('0xd')](),controller['download']);router[_0x6de5('0x11')]('/',auth[_0x6de5('0xd')](),interaction[_0x6de5('0x12')](_0x6de5('0x13'),'mailmessage:create'),controller[_0x6de5('0x14')]);router[_0x6de5('0x15')]('/:id',auth[_0x6de5('0xd')](),controller[_0x6de5('0x16')]);router[_0x6de5('0x15')](_0x6de5('0x17'),auth['isAuthenticated'](),controller[_0x6de5('0x18')]);router[_0x6de5('0x15')](_0x6de5('0x19'),auth[_0x6de5('0xd')](),controller['reject']);router[_0x6de5('0x1a')](_0x6de5('0x1b'),auth[_0x6de5('0xd')](),controller[_0x6de5('0x1c')]);module['exports']=router;
\ No newline at end of file
+var _0xf32e=['../../components/interaction/service','../../config/environment','./mailMessage.controller','/describe','isAuthenticated','describe','get','/:id','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path'];(function(_0xa4f636,_0xaca1b6){var _0x37e02a=function(_0x49bd47){while(--_0x49bd47){_0xa4f636['push'](_0xa4f636['shift']());}};_0x37e02a(++_0xaca1b6);}(_0xf32e,0x110));var _0xef32=function(_0x22f1c1,_0x494cab){_0x22f1c1=_0x22f1c1-0x0;var _0x41f70d=_0xf32e[_0x22f1c1];return _0x41f70d;};'use strict';var multer=require(_0xef32('0x0'));var util=require(_0xef32('0x1'));var path=require(_0xef32('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xef32('0x3'));var config=require(_0xef32('0x4'));var controller=require(_0xef32('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xef32('0x6'),auth[_0xef32('0x7')](),controller[_0xef32('0x8')]);router[_0xef32('0x9')](_0xef32('0xa'),auth[_0xef32('0x7')](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xef32('0xb')]);router[_0xef32('0xc')]('/',auth['isAuthenticated'](),interaction[_0xef32('0xd')](_0xef32('0xe'),_0xef32('0xf')),controller[_0xef32('0x10')]);router[_0xef32('0x11')](_0xef32('0xa'),auth[_0xef32('0x7')](),controller[_0xef32('0x12')]);router[_0xef32('0x11')](_0xef32('0x13'),auth['isAuthenticated'](),controller[_0xef32('0x14')]);router[_0xef32('0x11')](_0xef32('0x15'),auth['isAuthenticated'](),controller[_0xef32('0x16')]);router[_0xef32('0x17')]('/:id',auth[_0xef32('0x7')](),controller[_0xef32('0x18')]);module['exports']=router;
\ No newline at end of file
index 16769ea..6937806 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e68=['BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat','lodash','exports','TEXT','long','medium'];(function(_0x20d999,_0x50f8a8){var _0x35c115=function(_0x5c90e7){while(--_0x5c90e7){_0x20d999['push'](_0x20d999['shift']());}};_0x35c115(++_0x50f8a8);}(_0x8e68,0x15a));var _0x88e6=function(_0x5ac198,_0x5b7d2a){_0x5ac198=_0x5ac198-0x0;var _0x437b0d=_0x8e68[_0x5ac198];return _0x437b0d;};'use strict';var Sequelize=require('sequelize');var _=require(_0x88e6('0x0'));module[_0x88e6('0x1')]={'body':{'type':Sequelize[_0x88e6('0x2')](_0x88e6('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x88e6('0x2')](_0x88e6('0x4'))},'read':{'type':Sequelize[_0x88e6('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x88e6('0x6')]('in','out'),'defaultValue':_0x88e6('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x88e6('0x8')](0x1fe)},'from':{'type':Sequelize[_0x88e6('0x8')]},'to':{'type':Sequelize[_0x88e6('0x2')](_0x88e6('0x3'))},'cc':{'type':Sequelize['TEXT'](_0x88e6('0x3'))},'bcc':{'type':Sequelize[_0x88e6('0x2')](_0x88e6('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x88e6('0x9')]},'attach':{'type':Sequelize[_0x88e6('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x88e6('0x9')]},'originTo':{'type':Sequelize[_0x88e6('0x2')](_0x88e6('0x3'))},'originCc':{'type':Sequelize[_0x88e6('0x2')]('long')},'originChannel':{'type':Sequelize[_0x88e6('0x6')](_0x88e6('0xb'),_0x88e6('0xc')),'defaultValue':'Email','allowNull':![]}};
\ No newline at end of file
+var _0x9c32=['exports','long','BOOLEAN','ENUM','out','STRING','TEXT','INTEGER','DATE','Email','Chat','sequelize','lodash'];(function(_0x58f705,_0x3315f7){var _0x39395a=function(_0x3c30a6){while(--_0x3c30a6){_0x58f705['push'](_0x58f705['shift']());}};_0x39395a(++_0x3315f7);}(_0x9c32,0x15d));var _0x29c3=function(_0x1fbfa4,_0x3e8bc5){_0x1fbfa4=_0x1fbfa4-0x0;var _0x1e5bc8=_0x9c32[_0x1fbfa4];return _0x1e5bc8;};'use strict';var Sequelize=require(_0x29c3('0x0'));var _=require(_0x29c3('0x1'));module[_0x29c3('0x2')]={'body':{'type':Sequelize['TEXT'](_0x29c3('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0x29c3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x29c3('0x5')]('in','out'),'defaultValue':_0x29c3('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x29c3('0x7')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x29c3('0x8')](_0x29c3('0x3'))},'bcc':{'type':Sequelize[_0x29c3('0x8')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x29c3('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x29c3('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x29c3('0xa')]},'originTo':{'type':Sequelize[_0x29c3('0x8')](_0x29c3('0x3'))},'originCc':{'type':Sequelize[_0x29c3('0x8')](_0x29c3('0x3'))},'originChannel':{'type':Sequelize[_0x29c3('0x5')](_0x29c3('0xb'),_0x29c3('0xc')),'defaultValue':'Email','allowNull':![]}};
\ No newline at end of file
index d9acfa8..b7abc66 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xad1a=['info','result','catch','status','offset','limit','undefined','count','Content-Range','json','then','destroy','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','params','find','update','body','describe','create','direction','out','secret','MailAccount','CmList','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp','attachments','root','server/files/attachments','basename','List','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','UserId','user','get','MailInteraction','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','interface','SIP/%s','channel','motionChannel','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','format','event','rejectmessage','download','unix','join','server','tmp','files','from','subject','createdAt','Attachment','Attachments','decode','headers','bcc','existsSync','push','readFileSync','unlinkSync','eml-format','moment','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x310378,_0x1e671c){var _0x31a9dd=function(_0x55791b){while(--_0x55791b){_0x310378['push'](_0x310378['shift']());}};_0x31a9dd(++_0x1e671c);}(_0xad1a,0x7a));var _0xaad1=function(_0x2a88e2,_0x3c1d95){_0x2a88e2=_0x2a88e2-0x0;var _0x197ec8=_0xad1a[_0x2a88e2];return _0x197ec8;};'use strict';var emlformat=require(_0xaad1('0x0'));var moment=require(_0xaad1('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xaad1('0x2'));var fs=require('fs');var _=require(_0xaad1('0x3'));var Redis=require(_0xaad1('0x4'));var htmlToText=require(_0xaad1('0x5'));var qs=require(_0xaad1('0x6'));var logger=require(_0xaad1('0x7'))('api');var interaction_log=require(_0xaad1('0x7'))(_0xaad1('0x8'));var config=require(_0xaad1('0x9'));var db=require(_0xaad1('0xa'))['db'];config['redis']=_[_0xaad1('0xb')](config[_0xaad1('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xaad1('0xd'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0xaad1('0xe'))[_0xaad1('0xf')](socket);var jayson=require(_0xaad1('0x10'));var client=jayson[_0xaad1('0x11')][_0xaad1('0x12')]({'port':0x232c});var client9003=jayson[_0xaad1('0x11')][_0xaad1('0x12')]({'port':0x232b});var client9002=jayson[_0xaad1('0x11')][_0xaad1('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x32f8e7,_0x34cfd0,_0x4ef3ff,_0x2e316c){return new BPromise(function(_0x1d45f2,_0x2405a6){var _0x4b3174=_0x2e316c||client;return _0x4b3174['request'](_0x32f8e7,_0x4ef3ff)['then'](function(_0x3f623f){logger['info'](_0xaad1('0x13'),_0x34cfd0,_0xaad1('0x14'));logger[_0xaad1('0x15')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x34cfd0,'request\x20sent',JSON[_0xaad1('0x16')](_0x3f623f));if(_0x3f623f[_0xaad1('0x17')]){if(_0x3f623f[_0xaad1('0x17')][_0xaad1('0x18')]===0x1f4){logger['error'](_0xaad1('0x13'),_0x34cfd0,_0x3f623f[_0xaad1('0x17')][_0xaad1('0x19')]);return _0x2405a6(_0x3f623f[_0xaad1('0x17')]['message']);}logger[_0xaad1('0x17')](_0xaad1('0x13'),_0x34cfd0,_0x3f623f[_0xaad1('0x17')]['message']);return _0x1d45f2(_0x3f623f[_0xaad1('0x17')]['message']);}else{logger[_0xaad1('0x1a')]('MailMessage,\x20%s,\x20%s',_0x34cfd0,_0xaad1('0x14'));_0x1d45f2(_0x3f623f[_0xaad1('0x1b')][_0xaad1('0x19')]);}})[_0xaad1('0x1c')](function(_0x4d5342){logger[_0xaad1('0x17')]('MailMessage,\x20%s,\x20%s',_0x34cfd0,_0x4d5342);_0x2405a6(_0x4d5342);});});}function respondWithResult(_0x4ad25a,_0x548347){_0x548347=_0x548347||0xc8;return function(_0x53587f){if(_0x53587f){return _0x4ad25a[_0xaad1('0x1d')](_0x548347)['json'](_0x53587f);}};}function respondWithFilteredResult(_0x2014fd,_0x7eafce){return function(_0x3f3a0c){if(_0x3f3a0c){var _0x409113=typeof _0x7eafce[_0xaad1('0x1e')]==='undefined'&&typeof _0x7eafce[_0xaad1('0x1f')]===_0xaad1('0x20');var _0x49bb50=_0x3f3a0c[_0xaad1('0x21')];var _0x5485ce=_0x409113?0x0:_0x7eafce[_0xaad1('0x1e')];var _0x5e7da2=_0x409113?_0x3f3a0c['count']:_0x7eafce[_0xaad1('0x1e')]+_0x7eafce[_0xaad1('0x1f')];var _0x36849a;if(_0x5e7da2>=_0x49bb50){_0x5e7da2=_0x49bb50;_0x36849a=0xc8;}else{_0x36849a=0xce;}_0x2014fd['status'](_0x36849a);return _0x2014fd['set'](_0xaad1('0x22'),_0x5485ce+'-'+_0x5e7da2+'/'+_0x49bb50)[_0xaad1('0x23')](_0x3f3a0c);}return null;};}function saveUpdates(_0x3ff218){return function(_0x1f3bbb){if(_0x1f3bbb){return _0x1f3bbb['update'](_0x3ff218)[_0xaad1('0x24')](function(_0x48fd5d){return _0x48fd5d;});}return null;};}function removeEntity(_0x601a98){return function(_0x9dc512){if(_0x9dc512){return _0x9dc512[_0xaad1('0x25')]()['then'](function(){_0x601a98['status'](0xcc)[_0xaad1('0x26')]();});}};}function handleEntityNotFound(_0xd5a446){return function(_0x215f14){if(!_0x215f14){_0xd5a446[_0xaad1('0x27')](0x194);}return _0x215f14;};}function handleError(_0xa5c3f9,_0x16ede5){_0x16ede5=_0x16ede5||0x1f4;return function(_0x3cbd58){logger[_0xaad1('0x17')](_0x3cbd58['stack']);if(_0x3cbd58[_0xaad1('0x28')]){delete _0x3cbd58[_0xaad1('0x28')];}_0xa5c3f9['status'](_0x16ede5)[_0xaad1('0x29')](_0x3cbd58);};}exports[_0xaad1('0x2a')]=function(_0x164574,_0x303164){var _0x2cd525={},_0x41dc34={},_0x2c9992={'count':0x0,'rows':[]};var _0x2d6f6e=_[_0xaad1('0x2b')](db[_0xaad1('0x2c')][_0xaad1('0x2d')],function(_0x586465){return{'name':_0x586465[_0xaad1('0x2e')],'type':_0x586465['type']['key']};});_0x41dc34['model']=_[_0xaad1('0x2b')](_0x2d6f6e,'name');_0x41dc34['query']=_[_0xaad1('0x2f')](_0x164574[_0xaad1('0x30')]);_0x41dc34[_0xaad1('0x31')]=_[_0xaad1('0x32')](_0x41dc34[_0xaad1('0x33')],_0x41dc34[_0xaad1('0x30')]);_0x2cd525[_0xaad1('0x34')]=_[_0xaad1('0x32')](_0x41dc34['model'],qs[_0xaad1('0x35')](_0x164574['query'][_0xaad1('0x35')]));_0x2cd525[_0xaad1('0x34')]=_0x2cd525[_0xaad1('0x34')][_0xaad1('0x36')]?_0x2cd525[_0xaad1('0x34')]:_0x41dc34[_0xaad1('0x33')];if(!_0x164574[_0xaad1('0x30')][_0xaad1('0x37')](_0xaad1('0x38'))){_0x2cd525[_0xaad1('0x1f')]=qs[_0xaad1('0x1f')](_0x164574[_0xaad1('0x30')][_0xaad1('0x1f')]);_0x2cd525[_0xaad1('0x1e')]=qs[_0xaad1('0x1e')](_0x164574[_0xaad1('0x30')][_0xaad1('0x1e')]);}_0x2cd525['order']=qs[_0xaad1('0x39')](_0x164574[_0xaad1('0x30')]['sort']);_0x2cd525[_0xaad1('0x3a')]=qs[_0xaad1('0x31')](_[_0xaad1('0x3b')](_0x164574[_0xaad1('0x30')],_0x41dc34[_0xaad1('0x31')]),_0x2d6f6e);if(_0x164574[_0xaad1('0x30')][_0xaad1('0x3c')]){_0x2cd525['where']=_['merge'](_0x2cd525[_0xaad1('0x3a')],{'$or':_['map'](_0x2d6f6e,function(_0x3b4a57){if(_0x3b4a57[_0xaad1('0x3d')]!==_0xaad1('0x3e')){var _0x477aba={};_0x477aba[_0x3b4a57['name']]={'$like':'%'+_0x164574[_0xaad1('0x30')]['filter']+'%'};return _0x477aba;}})});}_0x2cd525=_[_0xaad1('0x3f')]({},_0x2cd525,_0x164574[_0xaad1('0x40')]);var _0x2a69d5={'where':_0x2cd525[_0xaad1('0x3a')]};return db[_0xaad1('0x2c')][_0xaad1('0x21')](_0x2a69d5)[_0xaad1('0x24')](function(_0x31ae4d){_0x2c9992[_0xaad1('0x21')]=_0x31ae4d;if(_0x164574[_0xaad1('0x30')][_0xaad1('0x41')]){_0x2cd525[_0xaad1('0x42')]=[{'all':!![]}];}return db[_0xaad1('0x2c')][_0xaad1('0x43')](_0x2cd525);})[_0xaad1('0x24')](function(_0x69cfd3){_0x2c9992['rows']=_0x69cfd3;return _0x2c9992;})['then'](respondWithFilteredResult(_0x303164,_0x2cd525))[_0xaad1('0x1c')](handleError(_0x303164,null));};exports['show']=function(_0x2cf033,_0x59cc65){var _0x3e39ec={'raw':!![],'where':{'id':_0x2cf033[_0xaad1('0x44')]['id']}},_0x77a89a={};_0x77a89a['model']=_['keys'](db[_0xaad1('0x2c')][_0xaad1('0x2d')]);_0x77a89a[_0xaad1('0x30')]=_['keys'](_0x2cf033[_0xaad1('0x30')]);_0x77a89a[_0xaad1('0x31')]=_[_0xaad1('0x32')](_0x77a89a[_0xaad1('0x33')],_0x77a89a[_0xaad1('0x30')]);_0x3e39ec[_0xaad1('0x34')]=_[_0xaad1('0x32')](_0x77a89a[_0xaad1('0x33')],qs[_0xaad1('0x35')](_0x2cf033[_0xaad1('0x30')]['fields']));_0x3e39ec[_0xaad1('0x34')]=_0x3e39ec[_0xaad1('0x34')][_0xaad1('0x36')]?_0x3e39ec[_0xaad1('0x34')]:_0x77a89a[_0xaad1('0x33')];if(_0x2cf033['query'][_0xaad1('0x41')]){_0x3e39ec[_0xaad1('0x42')]=[{'all':!![]}];}_0x3e39ec=_[_0xaad1('0x3f')]({},_0x3e39ec,_0x2cf033[_0xaad1('0x40')]);return db[_0xaad1('0x2c')][_0xaad1('0x45')](_0x3e39ec)[_0xaad1('0x24')](handleEntityNotFound(_0x59cc65,null))['then'](respondWithResult(_0x59cc65,null))[_0xaad1('0x1c')](handleError(_0x59cc65,null));};exports[_0xaad1('0x46')]=function(_0x31e8de,_0x440ae3){if(_0x31e8de[_0xaad1('0x47')]['id']){delete _0x31e8de['body']['id'];}return db['MailMessage'][_0xaad1('0x45')]({'where':{'id':_0x31e8de['params']['id']}})['then'](handleEntityNotFound(_0x440ae3,null))['then'](saveUpdates(_0x31e8de[_0xaad1('0x47')],null))[_0xaad1('0x24')](respondWithResult(_0x440ae3,null))[_0xaad1('0x1c')](handleError(_0x440ae3,null));};exports[_0xaad1('0x25')]=function(_0x279a9a,_0x11836f){return db[_0xaad1('0x2c')][_0xaad1('0x45')]({'where':{'id':_0x279a9a[_0xaad1('0x44')]['id']}})[_0xaad1('0x24')](handleEntityNotFound(_0x11836f,null))[_0xaad1('0x24')](removeEntity(_0x11836f,null))['catch'](handleError(_0x11836f,null));};exports[_0xaad1('0x48')]=function(_0x449dca,_0x213b86){return db[_0xaad1('0x2c')][_0xaad1('0x48')]()[_0xaad1('0x24')](respondWithResult(_0x213b86,null))['catch'](handleError(_0x213b86,null));};exports[_0xaad1('0x49')]=function(_0xeca5f4,_0x2eb0c0){return db[_0xaad1('0x2c')][_0xaad1('0x49')](_0xeca5f4[_0xaad1('0x47')])['then'](function(_0x2e1993){if(_0x2e1993){if(_0x2e1993[_0xaad1('0x4a')]===_0xaad1('0x4b')&&!_0x2e1993[_0xaad1('0x4c')]){var _0x571c04,_0x40ca34,_0x35291d;if(_0xeca5f4[_0xaad1('0x47')]['to']){_0x40ca34=_0xeca5f4[_0xaad1('0x47')]['to']['split'](',')[0x0];}return db[_0xaad1('0x4d')]['findOne']({'where':{'id':_0x2e1993['MailAccountId']},'include':[{'model':db[_0xaad1('0x4e')],'as':'List','include':[{'model':db[_0xaad1('0x4f')],'as':_0xaad1('0x50'),'where':{'email':_0x40ca34},'limit':0x1,'order':[[_0xaad1('0x51'),_0xaad1('0x52')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xaad1('0x53')],'as':'CloudProvider','raw':!![]}]}]})[_0xaad1('0x24')](function(_0x440a77){_0x571c04=_0x440a77;if(!_0x571c04||!_0x571c04[_0xaad1('0x54')])return;var _0x2c8d1a=_0x571c04['getSmtpOptions']();if(_0xeca5f4[_0xaad1('0x47')]['attachments']&&_0xeca5f4[_0xaad1('0x47')][_0xaad1('0x55')][_0xaad1('0x36')]){for(var _0x59ef9c=0x0;_0x59ef9c<_0xeca5f4[_0xaad1('0x47')][_0xaad1('0x55')][_0xaad1('0x36')];_0x59ef9c+=0x1){_0xeca5f4[_0xaad1('0x47')][_0xaad1('0x55')][_0x59ef9c]={'filename':_0xeca5f4[_0xaad1('0x47')]['attachments'][_0x59ef9c][_0xaad1('0x28')],'path':path['join'](config[_0xaad1('0x56')],_0xaad1('0x57'),_0xeca5f4[_0xaad1('0x47')][_0xaad1('0x55')][_0x59ef9c][_0xaad1('0x58')])};}}_0x35291d={'account':_0x2c8d1a,'message':_0xeca5f4[_0xaad1('0x47')]};return;})['then'](function(){if(_0x571c04[_0xaad1('0x59')]){if(_0x571c04['List'][_0xaad1('0x50')][_0xaad1('0x36')]){return _0x571c04[_0xaad1('0x59')]['Contacts'][0x0];}else{return db[_0xaad1('0x4f')][_0xaad1('0x49')](_[_0xaad1('0xb')](_0xeca5f4['body'],{'firstName':_0xeca5f4[_0xaad1('0x47')]['to'],'email':_0xeca5f4[_0xaad1('0x47')]['to'],'phone':_0xeca5f4[_0xaad1('0x47')]['to'],'ListId':_0x571c04['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0xaad1('0x24')](function(){if(_0x35291d){return respondWithRpcPromise('SendMail','sendMail',_0x35291d,client9003)[_0xaad1('0x24')](function(_0x2b0ab6){return _0x2e1993[_0xaad1('0x46')]({'read':!![],'messageId':_0x2b0ab6[_0xaad1('0x5a')],'sentAt':moment()['format'](_0xaad1('0x5b'))});})['catch'](function(_0x35727f){logger['error']('%s',JSON[_0xaad1('0x16')](_0x35727f));return _0x2e1993;});}return _0x2e1993;});}return _0x2e1993;}})[_0xaad1('0x24')](respondWithResult(_0x2eb0c0,0xc9))[_0xaad1('0x1c')](handleError(_0x2eb0c0,null));};exports[_0xaad1('0x5c')]=function(_0x29052f,_0x1fd196){var _0x48344d={'agent':{},'channel':_0xaad1('0x5d')};if(_0x29052f[_0xaad1('0x47')]['id']){delete _0x29052f[_0xaad1('0x47')]['id'];}_0x29052f[_0xaad1('0x47')]['read']=!![];_0x29052f[_0xaad1('0x47')][_0xaad1('0x5e')]=moment()['format'](_0xaad1('0x5b'));_0x29052f[_0xaad1('0x47')][_0xaad1('0x5f')]=_0x29052f['body'][_0xaad1('0x5f')]||_0x29052f[_0xaad1('0x60')]['id'];_0x48344d['agent']['id']=_0x29052f[_0xaad1('0x47')][_0xaad1('0x5f')];return db[_0xaad1('0x2c')][_0xaad1('0x45')]({'where':{'id':_0x29052f['params']['id'],'UserId':null}})[_0xaad1('0x24')](handleEntityNotFound(_0x1fd196,null))['then'](saveUpdates(_0x29052f[_0xaad1('0x47')],null))[_0xaad1('0x24')](function(_0x3f3d86){if(_0x3f3d86){_0x48344d[_0xaad1('0x19')]=_0x3f3d86[_0xaad1('0x61')]({'plain':!![]});return db[_0xaad1('0x62')]['find']({'where':{'id':_0x3f3d86['MailInteractionId']}});}return null;})[_0xaad1('0x24')](handleEntityNotFound(_0x1fd196,null))[_0xaad1('0x24')](function(_0x2b80fc){if(_0x2b80fc){return _0x2b80fc[_0xaad1('0x46')]({'UserId':_0x29052f[_0xaad1('0x47')][_0xaad1('0x5f')],'read1stAt':_[_0xaad1('0x63')](_0x2b80fc[_0xaad1('0x64')])?moment()['format'](_0xaad1('0x5b')):undefined});}return null;})[_0xaad1('0x24')](function(_0x548b4e){if(_0x548b4e){_0x48344d[_0xaad1('0x65')]=_0x548b4e[_0xaad1('0x61')]({'plain':!![]});interaction_log[_0xaad1('0x1a')](_0xaad1('0x66'),_0x29052f[_0xaad1('0x60')]['id'],_0x29052f[_0xaad1('0x60')][_0xaad1('0x28')],_0x29052f[_0xaad1('0x60')]['role'],_0x48344d[_0xaad1('0x65')]['id'],_0x29052f[_0xaad1('0x47')]?JSON[_0xaad1('0x16')](_0x29052f[_0xaad1('0x47')]):_0xaad1('0x67'));return respondWithRpcPromise(_0xaad1('0x68'),_0xaad1('0x69'),_0x48344d);}return null;})[_0xaad1('0x24')](function(_0x217f08){var _0x475265=_0xaad1('0x6a')+_0x217f08[_0xaad1('0x19')][_0xaad1('0x6b')];return db[_0xaad1('0x6c')]['query'](_0x475265,{'type':db['Sequelize'][_0xaad1('0x6d')][_0xaad1('0x6e')],'raw':!![]})[_0xaad1('0x24')](function(_0x2ac4b5){return _0x2ac4b5;});})['then'](function(_0x363876){if(_0x363876){_0x48344d['message'][_0xaad1('0x6f')]=_0x363876[0x0];if(!_0x29052f[_0xaad1('0x47')]['UserId'])return;return db[_0xaad1('0x70')][_0xaad1('0x45')]({'where':{'id':_0x29052f[_0xaad1('0x47')][_0xaad1('0x5f')],'role':_0xaad1('0x71')},'attributes':['id',_0xaad1('0x28'),_0xaad1('0x72'),_0xaad1('0x73'),'internal'],'raw':!![]});}return null;})[_0xaad1('0x24')](function(_0x43ca0f){if(!_0x43ca0f)return null;_0x48344d['message'][_0xaad1('0x71')]=_0x43ca0f;return _0x48344d;})[_0xaad1('0x24')](function(_0x4a670b){if(_0x4a670b){if(_0x29052f[_0xaad1('0x47')]['manual']){_0x48344d['message'][_0xaad1('0x74')]=util['format'](_0xaad1('0x75'),_0x29052f[_0xaad1('0x60')][_0xaad1('0x28')]);_0x48344d[_0xaad1('0x19')][_0xaad1('0x76')]=_0x48344d[_0xaad1('0x76')];_0x48344d[_0xaad1('0x19')][_0xaad1('0x77')]=_0x48344d[_0xaad1('0x76')];_0x48344d[_0xaad1('0x19')]['event']=_0xaad1('0x5c');_0x48344d[_0xaad1('0x19')]['body']=htmlToText[_0xaad1('0x78')](_0x48344d[_0xaad1('0x19')][_0xaad1('0x47')]);return respondWithRpcPromise(_0xaad1('0x79'),_0xaad1('0x79'),{'event':'acceptmessage','message':_0x48344d[_0xaad1('0x19')]},client9002)[_0xaad1('0x24')](function(){return _0x48344d;});}return _0x48344d;}return null;})['then'](respondWithResult(_0x1fd196,null))[_0xaad1('0x1c')](handleError(_0x1fd196,null));};exports[_0xaad1('0x7a')]=function(_0x3cc119,_0x5e58d9){var _0x477ba6={'agent':{},'channel':_0xaad1('0x5d')};if(_0x3cc119['body']['id']){delete _0x3cc119[_0xaad1('0x47')]['id'];}_0x3cc119[_0xaad1('0x47')]['UserId']=_0x3cc119[_0xaad1('0x47')][_0xaad1('0x5f')]||_0x3cc119[_0xaad1('0x60')]['id'];_0x477ba6[_0xaad1('0x71')]['id']=_0x3cc119[_0xaad1('0x47')][_0xaad1('0x5f')];return db[_0xaad1('0x2c')]['find']({'where':{'id':_0x3cc119['params']['id'],'UserId':null}})[_0xaad1('0x24')](handleEntityNotFound(_0x5e58d9,null))[_0xaad1('0x24')](function(_0x5f545b){if(_0x5f545b){_0x477ba6[_0xaad1('0x19')]=_0x5f545b[_0xaad1('0x61')]({'plain':!![]});return db[_0xaad1('0x62')]['find']({'where':{'id':_0x5f545b['MailInteractionId']}});}return null;})[_0xaad1('0x24')](handleEntityNotFound(_0x5e58d9,null))[_0xaad1('0x24')](function(_0xd3177){if(_0xd3177){_0x477ba6[_0xaad1('0x65')]=_0xd3177['get']({'plain':!![]});interaction_log[_0xaad1('0x1a')](_0xaad1('0x7b'),_0x3cc119['user']['id'],_0x3cc119[_0xaad1('0x60')][_0xaad1('0x28')],_0x3cc119[_0xaad1('0x60')][_0xaad1('0x7c')],_0x477ba6['interaction']['id'],_0x3cc119[_0xaad1('0x47')]?JSON[_0xaad1('0x16')](_0x3cc119['body']):'null');return respondWithRpcPromise(_0xaad1('0x7d'),_0xaad1('0x7e'),_0x477ba6);}return null;})['then'](function(_0x23c379){var _0x153d9b=_0xaad1('0x6a')+_0x23c379['message'][_0xaad1('0x6b')];return db[_0xaad1('0x6c')][_0xaad1('0x30')](_0x153d9b,{'type':db['Sequelize'][_0xaad1('0x6d')][_0xaad1('0x6e')],'raw':!![]})[_0xaad1('0x24')](function(_0x140e02){return _0x140e02;});})[_0xaad1('0x24')](function(_0x36ce76){if(_0x36ce76){_0x477ba6[_0xaad1('0x19')][_0xaad1('0x6f')]=_0x36ce76[0x0];if(!_0x3cc119['body'][_0xaad1('0x5f')])return;return db[_0xaad1('0x70')][_0xaad1('0x45')]({'where':{'id':_0x3cc119[_0xaad1('0x47')][_0xaad1('0x5f')],'role':_0xaad1('0x71')},'attributes':['id',_0xaad1('0x28'),_0xaad1('0x72'),_0xaad1('0x73'),'internal'],'raw':!![]});}return null;})[_0xaad1('0x24')](function(_0x30b70a){if(!_0x30b70a)return null;_0x477ba6[_0xaad1('0x19')][_0xaad1('0x71')]=_0x30b70a;return _0x477ba6;})[_0xaad1('0x24')](function(_0x34035a){if(_0x34035a){_0x34035a[_0xaad1('0x19')][_0xaad1('0x74')]=util[_0xaad1('0x7f')](_0xaad1('0x75'),_0x3cc119[_0xaad1('0x60')][_0xaad1('0x28')]);_0x34035a[_0xaad1('0x19')]['channel']=_0x477ba6[_0xaad1('0x76')];_0x34035a[_0xaad1('0x19')][_0xaad1('0x77')]=_0x477ba6[_0xaad1('0x76')];_0x34035a['message'][_0xaad1('0x80')]=_0xaad1('0x7a');_0x34035a['message']['body']=htmlToText[_0xaad1('0x78')](_0x477ba6[_0xaad1('0x19')][_0xaad1('0x47')]);respondWithRpcPromise(_0xaad1('0x79'),_0xaad1('0x79'),{'event':_0xaad1('0x81'),'message':_0x34035a[_0xaad1('0x19')]},client9002);return _0x477ba6;}return null;})[_0xaad1('0x24')](respondWithResult(_0x5e58d9,null))[_0xaad1('0x1c')](handleError(_0x5e58d9,null));};exports[_0xaad1('0x82')]=function(_0x44d360,_0x5605b9){var _0x32380f=moment()[_0xaad1('0x83')]()['toString']();var _0x47fb73=path[_0xaad1('0x84')](config[_0xaad1('0x56')],_0xaad1('0x85'),'files',_0xaad1('0x86'));var _0x3691c8=path[_0xaad1('0x84')](config[_0xaad1('0x56')],_0xaad1('0x85'),_0xaad1('0x87'),_0xaad1('0x55'));var _0x31627f=util[_0xaad1('0x7f')]('message-%s.eml',_0x32380f);return db['MailMessage']['find']({'where':{'id':_0x44d360['params']['id']},'attributes':['id',_0xaad1('0x47'),_0xaad1('0x88'),'to','cc','bcc',_0xaad1('0x89'),_0xaad1('0x8a')],'include':_0x44d360[_0xaad1('0x30')]['attachments']?[{'model':db[_0xaad1('0x8b')],'as':_0xaad1('0x8c')}]:undefined})[_0xaad1('0x24')](handleEntityNotFound(_0x5605b9,null))[_0xaad1('0x24')](function(_0x56b394){if(_0x56b394){var _0x1c1a64=_0x56b394;var _0x49b6bc={'from':_0x1c1a64['from'],'to':_0x1c1a64['to'],'subject':_0x1c1a64[_0xaad1('0x89')],'html':htmlEntities[_0xaad1('0x8d')](_0x1c1a64[_0xaad1('0x47')]),'headers':{'Date':moment(_0x1c1a64[_0xaad1('0x8a')])[_0xaad1('0x7f')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x56b394['cc']){_0x49b6bc[_0xaad1('0x8e')]['Cc']=_0x56b394['cc'];}if(_0x56b394['bcc']){_0x49b6bc[_0xaad1('0x8e')]['Bcc']=_0x56b394[_0xaad1('0x8f')];}return new BPromise(function(_0x1e5ebf,_0x36a4b8){if(_0x56b394['Attachments']){for(var _0x902a63=0x0;_0x902a63<_0x56b394['Attachments'][_0xaad1('0x36')];_0x902a63++){var _0x464b39=_0x56b394[_0xaad1('0x8c')][_0x902a63];var _0x19b308=path[_0xaad1('0x84')](_0x3691c8,_0x464b39['basename']);if(fs[_0xaad1('0x90')](_0x19b308)){_0x49b6bc[_0xaad1('0x55')][_0xaad1('0x91')]({'name':_0x464b39['name'],'contentType':_0x464b39[_0xaad1('0x3d')],'data':fs[_0xaad1('0x92')](_0x19b308)});}}}emlformat['build'](_0x49b6bc,function(_0x4aad4f,_0x4855e9){if(_0x4aad4f)return _0x36a4b8(_0x4aad4f);fs['writeFileSync'](path[_0xaad1('0x84')](_0x47fb73,_0x31627f),_0x4855e9);return _0x1e5ebf(_0x4855e9);});});}})[_0xaad1('0x24')](function(_0x598488){if(_0x598488){return _0x5605b9[_0xaad1('0x82')](path[_0xaad1('0x84')](_0x47fb73,_0x31627f),_0x31627f,function(_0x30293a){if(!_0x30293a)fs[_0xaad1('0x93')](path[_0xaad1('0x84')](_0x47fb73,_0x31627f));});}})[_0xaad1('0x1c')](handleError(_0x5605b9,null));};
\ No newline at end of file
+var _0xb965=['MailInteraction','isNil','interaction','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','SIP/%s','channel','event','accept','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','email','interface','motionChannel','rejectmessage','download','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','unlinkSync','eml-format','bluebird','path','lodash','html-to-text','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','client','http','request','then','info','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','find','params','body','describe','create','direction','out','secret','split','findOne','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','user','agent','get'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xb965,0x166));var _0x5b96=function(_0x57961a,_0x5c91dd){_0x57961a=_0x57961a-0x0;var _0x52fccf=_0xb965[_0x57961a];return _0x52fccf;};'use strict';var emlformat=require(_0x5b96('0x0'));var moment=require('moment');var BPromise=require(_0x5b96('0x1'));var util=require('util');var path=require(_0x5b96('0x2'));var fs=require('fs');var _=require(_0x5b96('0x3'));var Redis=require('ioredis');var htmlToText=require(_0x5b96('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x5b96('0x5'))('api');var interaction_log=require(_0x5b96('0x5'))(_0x5b96('0x6'));var config=require(_0x5b96('0x7'));var db=require(_0x5b96('0x8'))['db'];config['redis']=_[_0x5b96('0x9')](config['redis'],{'host':_0x5b96('0xa'),'port':0x18eb});var socket=require(_0x5b96('0xb'))(new Redis(config[_0x5b96('0xc')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0x5b96('0xd')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0x5b96('0xe')]['http']({'port':0x232b});var client9002=jayson['client'][_0x5b96('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x416883,_0x158a16,_0x371f32,_0x494532){return new BPromise(function(_0x3725a2,_0x11b9e8){var _0x25b914=_0x494532||client;return _0x25b914[_0x5b96('0x10')](_0x416883,_0x371f32)[_0x5b96('0x11')](function(_0x25deb2){logger[_0x5b96('0x12')]('MailMessage,\x20%s,\x20%s',_0x158a16,_0x5b96('0x13'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x158a16,_0x5b96('0x13'),JSON[_0x5b96('0x14')](_0x25deb2));if(_0x25deb2['error']){if(_0x25deb2[_0x5b96('0x15')][_0x5b96('0x16')]===0x1f4){logger[_0x5b96('0x15')](_0x5b96('0x17'),_0x158a16,_0x25deb2[_0x5b96('0x15')][_0x5b96('0x18')]);return _0x11b9e8(_0x25deb2[_0x5b96('0x15')][_0x5b96('0x18')]);}logger['error'](_0x5b96('0x17'),_0x158a16,_0x25deb2[_0x5b96('0x15')][_0x5b96('0x18')]);return _0x3725a2(_0x25deb2[_0x5b96('0x15')][_0x5b96('0x18')]);}else{logger['info'](_0x5b96('0x17'),_0x158a16,'request\x20sent');_0x3725a2(_0x25deb2[_0x5b96('0x19')][_0x5b96('0x18')]);}})[_0x5b96('0x1a')](function(_0x107906){logger[_0x5b96('0x15')]('MailMessage,\x20%s,\x20%s',_0x158a16,_0x107906);_0x11b9e8(_0x107906);});});}function respondWithResult(_0x2c0f64,_0x1a6168){_0x1a6168=_0x1a6168||0xc8;return function(_0x41d710){if(_0x41d710){return _0x2c0f64[_0x5b96('0x1b')](_0x1a6168)[_0x5b96('0x1c')](_0x41d710);}};}function respondWithFilteredResult(_0x2d60de,_0x412c37){return function(_0x41c168){if(_0x41c168){var _0x2c3d2b=typeof _0x412c37[_0x5b96('0x1d')]===_0x5b96('0x1e')&&typeof _0x412c37[_0x5b96('0x1f')]===_0x5b96('0x1e');var _0x1d5a2d=_0x41c168[_0x5b96('0x20')];var _0x18ec22=_0x2c3d2b?0x0:_0x412c37[_0x5b96('0x1d')];var _0x4c218f=_0x2c3d2b?_0x41c168[_0x5b96('0x20')]:_0x412c37[_0x5b96('0x1d')]+_0x412c37[_0x5b96('0x1f')];var _0x34c15e;if(_0x4c218f>=_0x1d5a2d){_0x4c218f=_0x1d5a2d;_0x34c15e=0xc8;}else{_0x34c15e=0xce;}_0x2d60de['status'](_0x34c15e);return _0x2d60de[_0x5b96('0x21')]('Content-Range',_0x18ec22+'-'+_0x4c218f+'/'+_0x1d5a2d)[_0x5b96('0x1c')](_0x41c168);}return null;};}function saveUpdates(_0x30e604){return function(_0x11e2f7){if(_0x11e2f7){return _0x11e2f7[_0x5b96('0x22')](_0x30e604)['then'](function(_0x4308a8){return _0x4308a8;});}return null;};}function removeEntity(_0x1973ba){return function(_0x4a6ea7){if(_0x4a6ea7){return _0x4a6ea7[_0x5b96('0x23')]()[_0x5b96('0x11')](function(){_0x1973ba['status'](0xcc)[_0x5b96('0x24')]();});}};}function handleEntityNotFound(_0x171ef6){return function(_0x3ec007){if(!_0x3ec007){_0x171ef6[_0x5b96('0x25')](0x194);}return _0x3ec007;};}function handleError(_0x5ad450,_0x508e08){_0x508e08=_0x508e08||0x1f4;return function(_0x23df42){logger['error'](_0x23df42[_0x5b96('0x26')]);if(_0x23df42[_0x5b96('0x27')]){delete _0x23df42[_0x5b96('0x27')];}_0x5ad450[_0x5b96('0x1b')](_0x508e08)[_0x5b96('0x28')](_0x23df42);};}exports[_0x5b96('0x29')]=function(_0xbd1c2d,_0x56f148){var _0x58f0db={},_0xa721fc={},_0x435603={'count':0x0,'rows':[]};var _0x387e8e=_[_0x5b96('0x2a')](db[_0x5b96('0x2b')][_0x5b96('0x2c')],function(_0x1486a4){return{'name':_0x1486a4[_0x5b96('0x2d')],'type':_0x1486a4['type'][_0x5b96('0x2e')]};});_0xa721fc[_0x5b96('0x2f')]=_[_0x5b96('0x2a')](_0x387e8e,_0x5b96('0x27'));_0xa721fc['query']=_[_0x5b96('0x30')](_0xbd1c2d[_0x5b96('0x31')]);_0xa721fc[_0x5b96('0x32')]=_['intersection'](_0xa721fc[_0x5b96('0x2f')],_0xa721fc[_0x5b96('0x31')]);_0x58f0db[_0x5b96('0x33')]=_[_0x5b96('0x34')](_0xa721fc['model'],qs[_0x5b96('0x35')](_0xbd1c2d[_0x5b96('0x31')][_0x5b96('0x35')]));_0x58f0db[_0x5b96('0x33')]=_0x58f0db[_0x5b96('0x33')][_0x5b96('0x36')]?_0x58f0db['attributes']:_0xa721fc[_0x5b96('0x2f')];if(!_0xbd1c2d[_0x5b96('0x31')]['hasOwnProperty'](_0x5b96('0x37'))){_0x58f0db[_0x5b96('0x1f')]=qs[_0x5b96('0x1f')](_0xbd1c2d['query'][_0x5b96('0x1f')]);_0x58f0db[_0x5b96('0x1d')]=qs['offset'](_0xbd1c2d[_0x5b96('0x31')][_0x5b96('0x1d')]);}_0x58f0db[_0x5b96('0x38')]=qs[_0x5b96('0x39')](_0xbd1c2d[_0x5b96('0x31')][_0x5b96('0x39')]);_0x58f0db[_0x5b96('0x3a')]=qs['filters'](_[_0x5b96('0x3b')](_0xbd1c2d[_0x5b96('0x31')],_0xa721fc[_0x5b96('0x32')]),_0x387e8e);if(_0xbd1c2d['query'][_0x5b96('0x3c')]){_0x58f0db[_0x5b96('0x3a')]=_[_0x5b96('0x3d')](_0x58f0db[_0x5b96('0x3a')],{'$or':_[_0x5b96('0x2a')](_0x387e8e,function(_0x2f8fe8){if(_0x2f8fe8[_0x5b96('0x3e')]!=='VIRTUAL'){var _0x332497={};_0x332497[_0x2f8fe8[_0x5b96('0x27')]]={'$like':'%'+_0xbd1c2d['query']['filter']+'%'};return _0x332497;}})});}_0x58f0db=_['merge']({},_0x58f0db,_0xbd1c2d['options']);var _0x3a98c1={'where':_0x58f0db[_0x5b96('0x3a')]};return db[_0x5b96('0x2b')][_0x5b96('0x20')](_0x3a98c1)[_0x5b96('0x11')](function(_0x41345d){_0x435603[_0x5b96('0x20')]=_0x41345d;if(_0xbd1c2d[_0x5b96('0x31')][_0x5b96('0x3f')]){_0x58f0db[_0x5b96('0x40')]=[{'all':!![]}];}return db[_0x5b96('0x2b')][_0x5b96('0x41')](_0x58f0db);})[_0x5b96('0x11')](function(_0x161f4e){_0x435603['rows']=_0x161f4e;return _0x435603;})[_0x5b96('0x11')](respondWithFilteredResult(_0x56f148,_0x58f0db))[_0x5b96('0x1a')](handleError(_0x56f148,null));};exports['show']=function(_0x9578d6,_0x399e07){var _0x5e2e12={'raw':!![],'where':{'id':_0x9578d6['params']['id']}},_0x4e5bde={};_0x4e5bde[_0x5b96('0x2f')]=_[_0x5b96('0x30')](db['MailMessage']['rawAttributes']);_0x4e5bde[_0x5b96('0x31')]=_[_0x5b96('0x30')](_0x9578d6['query']);_0x4e5bde[_0x5b96('0x32')]=_[_0x5b96('0x34')](_0x4e5bde[_0x5b96('0x2f')],_0x4e5bde[_0x5b96('0x31')]);_0x5e2e12['attributes']=_[_0x5b96('0x34')](_0x4e5bde[_0x5b96('0x2f')],qs[_0x5b96('0x35')](_0x9578d6[_0x5b96('0x31')][_0x5b96('0x35')]));_0x5e2e12[_0x5b96('0x33')]=_0x5e2e12[_0x5b96('0x33')][_0x5b96('0x36')]?_0x5e2e12[_0x5b96('0x33')]:_0x4e5bde[_0x5b96('0x2f')];if(_0x9578d6[_0x5b96('0x31')][_0x5b96('0x3f')]){_0x5e2e12[_0x5b96('0x40')]=[{'all':!![]}];}_0x5e2e12=_[_0x5b96('0x3d')]({},_0x5e2e12,_0x9578d6['options']);return db[_0x5b96('0x2b')][_0x5b96('0x42')](_0x5e2e12)[_0x5b96('0x11')](handleEntityNotFound(_0x399e07,null))[_0x5b96('0x11')](respondWithResult(_0x399e07,null))['catch'](handleError(_0x399e07,null));};exports['update']=function(_0xe16751,_0x356a12){if(_0xe16751['body']['id']){delete _0xe16751['body']['id'];}return db['MailMessage'][_0x5b96('0x42')]({'where':{'id':_0xe16751[_0x5b96('0x43')]['id']}})[_0x5b96('0x11')](handleEntityNotFound(_0x356a12,null))[_0x5b96('0x11')](saveUpdates(_0xe16751[_0x5b96('0x44')],null))[_0x5b96('0x11')](respondWithResult(_0x356a12,null))[_0x5b96('0x1a')](handleError(_0x356a12,null));};exports[_0x5b96('0x23')]=function(_0x2149a7,_0x224f84){return db[_0x5b96('0x2b')][_0x5b96('0x42')]({'where':{'id':_0x2149a7['params']['id']}})[_0x5b96('0x11')](handleEntityNotFound(_0x224f84,null))[_0x5b96('0x11')](removeEntity(_0x224f84,null))['catch'](handleError(_0x224f84,null));};exports[_0x5b96('0x45')]=function(_0x3274aa,_0x54b055){return db[_0x5b96('0x2b')][_0x5b96('0x45')]()[_0x5b96('0x11')](respondWithResult(_0x54b055,null))[_0x5b96('0x1a')](handleError(_0x54b055,null));};exports[_0x5b96('0x46')]=function(_0x66086b,_0x438b13){return db[_0x5b96('0x2b')][_0x5b96('0x46')](_0x66086b['body'])[_0x5b96('0x11')](function(_0x42c2d1){if(_0x42c2d1){if(_0x42c2d1[_0x5b96('0x47')]===_0x5b96('0x48')&&!_0x42c2d1[_0x5b96('0x49')]){var _0x3fd309,_0x16596f,_0x33cb72;if(_0x66086b['body']['to']){_0x16596f=_0x66086b['body']['to'][_0x5b96('0x4a')](',')[0x0];}return db['MailAccount'][_0x5b96('0x4b')]({'where':{'id':_0x42c2d1[_0x5b96('0x4c')]},'include':[{'model':db[_0x5b96('0x4d')],'as':_0x5b96('0x4e'),'include':[{'model':db['CmContact'],'as':_0x5b96('0x4f'),'where':{'email':_0x16596f},'limit':0x1,'order':[[_0x5b96('0x50'),_0x5b96('0x51')]]}]},{'model':db[_0x5b96('0x52')],'as':_0x5b96('0x53'),'raw':!![],'include':[{'model':db[_0x5b96('0x54')],'as':_0x5b96('0x54'),'raw':!![]}]}]})[_0x5b96('0x11')](function(_0x2fc533){_0x3fd309=_0x2fc533;if(!_0x3fd309||!_0x3fd309[_0x5b96('0x53')])return;var _0x1d81a6=_0x3fd309[_0x5b96('0x55')]();if(_0x66086b[_0x5b96('0x44')][_0x5b96('0x56')]&&_0x66086b[_0x5b96('0x44')][_0x5b96('0x56')][_0x5b96('0x36')]){for(var _0x1d75e2=0x0;_0x1d75e2<_0x66086b[_0x5b96('0x44')][_0x5b96('0x56')][_0x5b96('0x36')];_0x1d75e2+=0x1){_0x66086b[_0x5b96('0x44')][_0x5b96('0x56')][_0x1d75e2]={'filename':_0x66086b[_0x5b96('0x44')][_0x5b96('0x56')][_0x1d75e2]['name'],'path':path[_0x5b96('0x57')](config[_0x5b96('0x58')],_0x5b96('0x59'),_0x66086b[_0x5b96('0x44')][_0x5b96('0x56')][_0x1d75e2][_0x5b96('0x5a')])};}}_0x33cb72={'account':_0x1d81a6,'message':_0x66086b['body']};return;})[_0x5b96('0x11')](function(){if(_0x3fd309[_0x5b96('0x4e')]){if(_0x3fd309[_0x5b96('0x4e')][_0x5b96('0x4f')]['length']){return _0x3fd309['List']['Contacts'][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x66086b[_0x5b96('0x44')],{'firstName':_0x66086b[_0x5b96('0x44')]['to'],'email':_0x66086b['body']['to'],'phone':_0x66086b[_0x5b96('0x44')]['to'],'ListId':_0x3fd309[_0x5b96('0x5b')]}));}}else{throw new Error(_0x5b96('0x5c'));}})[_0x5b96('0x11')](function(){if(_0x33cb72){return respondWithRpcPromise(_0x5b96('0x5d'),_0x5b96('0x5e'),_0x33cb72,client9003)[_0x5b96('0x11')](function(_0x4eea8f){return _0x42c2d1[_0x5b96('0x22')]({'read':!![],'messageId':_0x4eea8f['messageId'],'sentAt':moment()[_0x5b96('0x5f')](_0x5b96('0x60'))});})[_0x5b96('0x1a')](function(_0x434563){logger[_0x5b96('0x15')]('%s',JSON[_0x5b96('0x14')](_0x434563));return _0x42c2d1;});}return _0x42c2d1;});}return _0x42c2d1;}})[_0x5b96('0x11')](respondWithResult(_0x438b13,0xc9))[_0x5b96('0x1a')](handleError(_0x438b13,null));};exports['accept']=function(_0x57d97e,_0x17a960){var _0x1e3a68={'agent':{},'channel':_0x5b96('0x61')};if(_0x57d97e['body']['id']){delete _0x57d97e[_0x5b96('0x44')]['id'];}_0x57d97e[_0x5b96('0x44')][_0x5b96('0x62')]=!![];_0x57d97e['body'][_0x5b96('0x63')]=moment()[_0x5b96('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x57d97e[_0x5b96('0x44')][_0x5b96('0x64')]=_0x57d97e[_0x5b96('0x44')]['UserId']||_0x57d97e[_0x5b96('0x65')]['id'];_0x1e3a68[_0x5b96('0x66')]['id']=_0x57d97e[_0x5b96('0x44')][_0x5b96('0x64')];return db[_0x5b96('0x2b')][_0x5b96('0x42')]({'where':{'id':_0x57d97e[_0x5b96('0x43')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x17a960,null))[_0x5b96('0x11')](saveUpdates(_0x57d97e[_0x5b96('0x44')],null))[_0x5b96('0x11')](function(_0x3ad70b){if(_0x3ad70b){_0x1e3a68[_0x5b96('0x18')]=_0x3ad70b[_0x5b96('0x67')]({'plain':!![]});return db[_0x5b96('0x68')][_0x5b96('0x42')]({'where':{'id':_0x3ad70b['MailInteractionId']}});}return null;})[_0x5b96('0x11')](handleEntityNotFound(_0x17a960,null))['then'](function(_0x406bd5){if(_0x406bd5){return _0x406bd5['update']({'UserId':_0x57d97e[_0x5b96('0x44')][_0x5b96('0x64')],'read1stAt':_[_0x5b96('0x69')](_0x406bd5['read1stAt'])?moment()[_0x5b96('0x5f')](_0x5b96('0x60')):undefined});}return null;})['then'](function(_0x7e8722){if(_0x7e8722){_0x1e3a68[_0x5b96('0x6a')]=_0x7e8722[_0x5b96('0x67')]({'plain':!![]});interaction_log[_0x5b96('0x12')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x57d97e['user']['id'],_0x57d97e['user'][_0x5b96('0x27')],_0x57d97e[_0x5b96('0x65')][_0x5b96('0x6b')],_0x1e3a68['interaction']['id'],_0x57d97e[_0x5b96('0x44')]?JSON['stringify'](_0x57d97e[_0x5b96('0x44')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x1e3a68);}return null;})['then'](function(_0x2c589e){var _0x2e9993=_0x5b96('0x6c')+_0x2c589e[_0x5b96('0x18')][_0x5b96('0x6d')];return db['sequelize']['query'](_0x2e9993,{'type':db[_0x5b96('0x6e')][_0x5b96('0x6f')][_0x5b96('0x70')],'raw':!![]})[_0x5b96('0x11')](function(_0x6ce33f){return _0x6ce33f;});})['then'](function(_0x2ae507){if(_0x2ae507){_0x1e3a68[_0x5b96('0x18')][_0x5b96('0x71')]=_0x2ae507[0x0];if(!_0x57d97e[_0x5b96('0x44')][_0x5b96('0x64')])return;return db[_0x5b96('0x72')][_0x5b96('0x42')]({'where':{'id':_0x57d97e[_0x5b96('0x44')][_0x5b96('0x64')],'role':_0x5b96('0x66')},'attributes':['id',_0x5b96('0x27'),_0x5b96('0x73'),'email',_0x5b96('0x74')],'raw':!![]});}return null;})[_0x5b96('0x11')](function(_0x5029a2){if(!_0x5029a2)return null;_0x1e3a68[_0x5b96('0x18')]['agent']=_0x5029a2;return _0x1e3a68;})['then'](function(_0x597082){if(_0x597082){if(_0x57d97e[_0x5b96('0x44')][_0x5b96('0x75')]){_0x1e3a68[_0x5b96('0x18')]['interface']=util[_0x5b96('0x5f')](_0x5b96('0x76'),_0x57d97e[_0x5b96('0x65')][_0x5b96('0x27')]);_0x1e3a68['message']['channel']=_0x1e3a68[_0x5b96('0x77')];_0x1e3a68[_0x5b96('0x18')]['motionChannel']=_0x1e3a68['channel'];_0x1e3a68['message'][_0x5b96('0x78')]=_0x5b96('0x79');_0x1e3a68['message'][_0x5b96('0x44')]=htmlToText[_0x5b96('0x7a')](_0x1e3a68[_0x5b96('0x18')][_0x5b96('0x44')]);return respondWithRpcPromise(_0x5b96('0x7b'),_0x5b96('0x7b'),{'event':_0x5b96('0x7c'),'message':_0x1e3a68[_0x5b96('0x18')]},client9002)[_0x5b96('0x11')](function(){return _0x1e3a68;});}return _0x1e3a68;}return null;})[_0x5b96('0x11')](respondWithResult(_0x17a960,null))[_0x5b96('0x1a')](handleError(_0x17a960,null));};exports[_0x5b96('0x7d')]=function(_0xe7bd4e,_0x280b8e){var _0x4dd4fe={'agent':{},'channel':'mail'};if(_0xe7bd4e[_0x5b96('0x44')]['id']){delete _0xe7bd4e['body']['id'];}_0xe7bd4e[_0x5b96('0x44')][_0x5b96('0x64')]=_0xe7bd4e[_0x5b96('0x44')][_0x5b96('0x64')]||_0xe7bd4e[_0x5b96('0x65')]['id'];_0x4dd4fe[_0x5b96('0x66')]['id']=_0xe7bd4e[_0x5b96('0x44')][_0x5b96('0x64')];return db[_0x5b96('0x2b')][_0x5b96('0x42')]({'where':{'id':_0xe7bd4e[_0x5b96('0x43')]['id'],'UserId':null}})[_0x5b96('0x11')](handleEntityNotFound(_0x280b8e,null))[_0x5b96('0x11')](function(_0x10d683){if(_0x10d683){_0x4dd4fe[_0x5b96('0x18')]=_0x10d683['get']({'plain':!![]});return db[_0x5b96('0x68')]['find']({'where':{'id':_0x10d683['MailInteractionId']}});}return null;})[_0x5b96('0x11')](handleEntityNotFound(_0x280b8e,null))[_0x5b96('0x11')](function(_0x5af5e5){if(_0x5af5e5){_0x4dd4fe[_0x5b96('0x6a')]=_0x5af5e5['get']({'plain':!![]});interaction_log[_0x5b96('0x12')](_0x5b96('0x7e'),_0xe7bd4e['user']['id'],_0xe7bd4e[_0x5b96('0x65')][_0x5b96('0x27')],_0xe7bd4e[_0x5b96('0x65')][_0x5b96('0x6b')],_0x4dd4fe[_0x5b96('0x6a')]['id'],_0xe7bd4e[_0x5b96('0x44')]?JSON[_0x5b96('0x14')](_0xe7bd4e[_0x5b96('0x44')]):'null');return respondWithRpcPromise(_0x5b96('0x7f'),_0x5b96('0x80'),_0x4dd4fe);}return null;})[_0x5b96('0x11')](function(_0xb61a96){var _0x395736=_0x5b96('0x6c')+_0xb61a96[_0x5b96('0x18')]['ContactId'];return db[_0x5b96('0x81')][_0x5b96('0x31')](_0x395736,{'type':db[_0x5b96('0x6e')][_0x5b96('0x6f')][_0x5b96('0x70')],'raw':!![]})['then'](function(_0x568f3f){return _0x568f3f;});})[_0x5b96('0x11')](function(_0xb7449a){if(_0xb7449a){_0x4dd4fe[_0x5b96('0x18')][_0x5b96('0x71')]=_0xb7449a[0x0];if(!_0xe7bd4e[_0x5b96('0x44')][_0x5b96('0x64')])return;return db['User'][_0x5b96('0x42')]({'where':{'id':_0xe7bd4e['body'][_0x5b96('0x64')],'role':_0x5b96('0x66')},'attributes':['id',_0x5b96('0x27'),_0x5b96('0x73'),_0x5b96('0x82'),_0x5b96('0x74')],'raw':!![]});}return null;})[_0x5b96('0x11')](function(_0x4078fe){if(!_0x4078fe)return null;_0x4dd4fe[_0x5b96('0x18')][_0x5b96('0x66')]=_0x4078fe;return _0x4dd4fe;})[_0x5b96('0x11')](function(_0x4116a2){if(_0x4116a2){_0x4116a2[_0x5b96('0x18')][_0x5b96('0x83')]=util[_0x5b96('0x5f')](_0x5b96('0x76'),_0xe7bd4e['user'][_0x5b96('0x27')]);_0x4116a2[_0x5b96('0x18')][_0x5b96('0x77')]=_0x4dd4fe[_0x5b96('0x77')];_0x4116a2[_0x5b96('0x18')][_0x5b96('0x84')]=_0x4dd4fe[_0x5b96('0x77')];_0x4116a2[_0x5b96('0x18')][_0x5b96('0x78')]=_0x5b96('0x7d');_0x4116a2[_0x5b96('0x18')][_0x5b96('0x44')]=htmlToText['fromString'](_0x4dd4fe[_0x5b96('0x18')][_0x5b96('0x44')]);respondWithRpcPromise(_0x5b96('0x7b'),_0x5b96('0x7b'),{'event':_0x5b96('0x85'),'message':_0x4116a2[_0x5b96('0x18')]},client9002);return _0x4dd4fe;}return null;})[_0x5b96('0x11')](respondWithResult(_0x280b8e,null))[_0x5b96('0x1a')](handleError(_0x280b8e,null));};exports[_0x5b96('0x86')]=function(_0x436c62,_0x144007){var _0xe83b42=moment()['unix']()['toString']();var _0x339b65=path[_0x5b96('0x57')](config['root'],_0x5b96('0x87'),_0x5b96('0x88'),_0x5b96('0x89'));var _0x558d6b=path['join'](config[_0x5b96('0x58')],_0x5b96('0x87'),_0x5b96('0x88'),_0x5b96('0x56'));var _0x1aead1=util[_0x5b96('0x5f')](_0x5b96('0x8a'),_0xe83b42);return db[_0x5b96('0x2b')][_0x5b96('0x42')]({'where':{'id':_0x436c62[_0x5b96('0x43')]['id']},'attributes':['id','body',_0x5b96('0x8b'),'to','cc',_0x5b96('0x8c'),_0x5b96('0x8d'),_0x5b96('0x8e')],'include':_0x436c62['query'][_0x5b96('0x56')]?[{'model':db[_0x5b96('0x8f')],'as':_0x5b96('0x90')}]:undefined})[_0x5b96('0x11')](handleEntityNotFound(_0x144007,null))[_0x5b96('0x11')](function(_0x257769){if(_0x257769){var _0x53ac5d=_0x257769;var _0x42942e={'from':_0x53ac5d[_0x5b96('0x8b')],'to':_0x53ac5d['to'],'subject':_0x53ac5d['subject'],'html':htmlEntities[_0x5b96('0x91')](_0x53ac5d['body']),'headers':{'Date':moment(_0x53ac5d[_0x5b96('0x8e')])[_0x5b96('0x5f')](_0x5b96('0x92'))},'attachments':[]};if(_0x257769['cc']){_0x42942e[_0x5b96('0x93')]['Cc']=_0x257769['cc'];}if(_0x257769[_0x5b96('0x8c')]){_0x42942e[_0x5b96('0x93')][_0x5b96('0x94')]=_0x257769['bcc'];}return new BPromise(function(_0x1a66d5,_0x38a611){if(_0x257769[_0x5b96('0x90')]){for(var _0x4b4aa7=0x0;_0x4b4aa7<_0x257769['Attachments'][_0x5b96('0x36')];_0x4b4aa7++){var _0x215704=_0x257769[_0x5b96('0x90')][_0x4b4aa7];var _0xd1579e=path[_0x5b96('0x57')](_0x558d6b,_0x215704['basename']);if(fs[_0x5b96('0x95')](_0xd1579e)){_0x42942e['attachments'][_0x5b96('0x96')]({'name':_0x215704['name'],'contentType':_0x215704[_0x5b96('0x3e')],'data':fs[_0x5b96('0x97')](_0xd1579e)});}}}emlformat[_0x5b96('0x98')](_0x42942e,function(_0x33d4b9,_0x389a4c){if(_0x33d4b9)return _0x38a611(_0x33d4b9);fs['writeFileSync'](path[_0x5b96('0x57')](_0x339b65,_0x1aead1),_0x389a4c);return _0x1a66d5(_0x389a4c);});});}})[_0x5b96('0x11')](function(_0x576370){if(_0x576370){return _0x144007[_0x5b96('0x86')](path[_0x5b96('0x57')](_0x339b65,_0x1aead1),_0x1aead1,function(_0xc9332d){if(!_0xc9332d)fs[_0x5b96('0x99')](path[_0x5b96('0x57')](_0x339b65,_0x1aead1));});}})['catch'](handleError(_0x144007,null));};
\ No newline at end of file
index d53bc9e..40096f8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xffdc=['MailMessage','setMaxListeners','remove','emit','hook','exports','events'];(function(_0x271c5b,_0x46d768){var _0x1d36eb=function(_0x3b46a8){while(--_0x3b46a8){_0x271c5b['push'](_0x271c5b['shift']());}};_0x1d36eb(++_0x46d768);}(_0xffdc,0xbc));var _0xcffd=function(_0x219d68,_0x1a3220){_0x219d68=_0x219d68-0x0;var _0x3fe502=_0xffdc[_0x219d68];return _0x3fe502;};'use strict';var EventEmitter=require(_0xcffd('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xcffd('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xcffd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcffd('0x3')};function emitEvent(_0x1ebe21){return function(_0x4890c6,_0x4bb821,_0x5b734d){MailMessageEvents[_0xcffd('0x4')](_0x1ebe21+':'+_0x4890c6['id'],_0x4890c6);MailMessageEvents[_0xcffd('0x4')](_0x1ebe21,_0x4890c6);_0x5b734d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xcffd('0x5')](e,emitEvent(event));}}module[_0xcffd('0x6')]=MailMessageEvents;
\ No newline at end of file
+var _0x8a04=['exports','events','MailMessage','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0xfff039,_0x18b801){var _0x44365f=function(_0x3d7f14){while(--_0x3d7f14){_0xfff039['push'](_0xfff039['shift']());}};_0x44365f(++_0x18b801);}(_0x8a04,0x1d1));var _0x48a0=function(_0x500652,_0x5dbac0){_0x500652=_0x500652-0x0;var _0x363e87=_0x8a04[_0x500652];return _0x363e87;};'use strict';var EventEmitter=require(_0x48a0('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x48a0('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x48a0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x48a0('0x3')};function emitEvent(_0x3d9752){return function(_0x5b59b5,_0x1edf0c,_0x1492b1){MailMessageEvents['emit'](_0x3d9752+':'+_0x5b59b5['id'],_0x5b59b5);MailMessageEvents[_0x48a0('0x4')](_0x3d9752,_0x5b59b5);_0x1492b1(null);};}for(var e in events){if(events[_0x48a0('0x5')](e)){var event=events[e];MailMessage[_0x48a0('0x6')](e,emitEvent(event));}}module[_0x48a0('0x7')]=MailMessageEvents;
\ No newline at end of file
index 0503943..4af5d9f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x757c=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','get','direction','toLowerCase','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','utf8mb4_unicode_ci','lodash','util'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x757c,0xb2));var _0xc757=function(_0x4658d7,_0x5c2924){_0x4658d7=_0x4658d7-0x0;var _0xa56a38=_0x757c[_0x4658d7];return _0xa56a38;};'use strict';var _=require(_0xc757('0x0'));var util=require(_0xc757('0x1'));var logger=require(_0xc757('0x2'))(_0xc757('0x3'));var moment=require(_0xc757('0x4'));var BPromise=require(_0xc757('0x5'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xc757('0x6'));var rimraf=require(_0xc757('0x7'));var config=require(_0xc757('0x8'));var attributes=require(_0xc757('0x9'));module[_0xc757('0xa')]=function(_0x3476ea,_0x161e0f){return _0x3476ea['define'](_0xc757('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xc757('0xc'),'fields':['messageId']},{'name':_0xc757('0xd'),'fields':[_0xc757('0xe'),_0xc757('0xf')],'type':_0xc757('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x33b48a,_0x430cb4,_0x5940a8){if(_0x33b48a[_0xc757('0x11')]){_0x33b48a[_0xc757('0xe')]=htmlToText[_0xc757('0x12')](_0x33b48a[_0xc757('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5940a8(null,_0x430cb4);},'afterCreate':function(_0x5de15d,_0x4fe6af,_0x13de67){var _0x591fea=_0x3476ea['models'];var _0x1199f2=_0x5de15d[_0xc757('0x13')]({'plain':!![]});if(_0x1199f2[_0xc757('0x14')][_0xc757('0x15')]()==='in'||_0x1199f2['direction']['toLowerCase']()==='out'&&!_0x1199f2['secret']&&!_[_0xc757('0x16')](_0x1199f2[_0xc757('0x17')])){_0x591fea['MailInteraction'][_0xc757('0x18')]({'where':{'id':_0x1199f2[_0xc757('0x19')]}})[_0xc757('0x1a')](function(_0x3f3999){if(_0x3f3999){_0x3f3999[_0xc757('0x1b')]({'lastMsgAt':_0x1199f2[_0xc757('0x1c')],'lastMsgDirection':_0x1199f2[_0xc757('0x14')][_0xc757('0x15')]()});}})['catch'](function(_0x479ef4){console['error'](_0x479ef4);});}_0x13de67();}},'charset':'utf8mb4','collate':_0xc757('0x1d')});};
\ No newline at end of file
+var _0xf4e9=['path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','body','fromString','models','get','direction','toLowerCase','secret','isNil','MailInteraction','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0xf4e9,0x88));var _0x9f4e=function(_0x5c327c,_0x96fb45){_0x5c327c=_0x5c327c-0x0;var _0xe11b63=_0xf4e9[_0x5c327c];return _0xe11b63;};'use strict';var _=require(_0x9f4e('0x0'));var util=require(_0x9f4e('0x1'));var logger=require(_0x9f4e('0x2'))(_0x9f4e('0x3'));var moment=require(_0x9f4e('0x4'));var BPromise=require(_0x9f4e('0x5'));var rp=require(_0x9f4e('0x6'));var htmlToText=require(_0x9f4e('0x7'));var fs=require('fs');var path=require(_0x9f4e('0x8'));var rimraf=require(_0x9f4e('0x9'));var config=require(_0x9f4e('0xa'));var attributes=require(_0x9f4e('0xb'));module[_0x9f4e('0xc')]=function(_0x3a2369,_0x15d9c8){return _0x3a2369[_0x9f4e('0xd')](_0x9f4e('0xe'),attributes,{'tableName':_0x9f4e('0xf'),'paranoid':![],'indexes':[{'name':_0x9f4e('0x10'),'fields':[_0x9f4e('0x10')]},{'name':'fti_mail_messages','fields':[_0x9f4e('0x11'),_0x9f4e('0x12')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xdeae67,_0x3f9aba,_0x177e6f){if(_0xdeae67[_0x9f4e('0x13')]){_0xdeae67[_0x9f4e('0x11')]=htmlToText[_0x9f4e('0x14')](_0xdeae67[_0x9f4e('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x177e6f(null,_0x3f9aba);},'afterCreate':function(_0x1bfe8b,_0x4249f0,_0x32d48a){var _0x361821=_0x3a2369[_0x9f4e('0x15')];var _0x1a0f22=_0x1bfe8b[_0x9f4e('0x16')]({'plain':!![]});if(_0x1a0f22[_0x9f4e('0x17')][_0x9f4e('0x18')]()==='in'||_0x1a0f22['direction']['toLowerCase']()==='out'&&!_0x1a0f22[_0x9f4e('0x19')]&&!_[_0x9f4e('0x1a')](_0x1a0f22['UserId'])){_0x361821[_0x9f4e('0x1b')][_0x9f4e('0x1c')]({'where':{'id':_0x1a0f22[_0x9f4e('0x1d')]}})[_0x9f4e('0x1e')](function(_0x5c1472){if(_0x5c1472){_0x5c1472['update']({'lastMsgAt':_0x1a0f22[_0x9f4e('0x1f')],'lastMsgDirection':_0x1a0f22['direction'][_0x9f4e('0x18')]()});}})[_0x9f4e('0x20')](function(_0x8a739d){console[_0x9f4e('0x21')](_0x8a739d);});}_0x32d48a();}},'charset':_0x9f4e('0x22'),'collate':_0x9f4e('0x23')});};
\ No newline at end of file
index 308e5fd..5f8c482 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf2e3=['info','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','body','options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then'];(function(_0x408e27,_0x5f0854){var _0x38f5f2=function(_0x4541cc){while(--_0x4541cc){_0x408e27['push'](_0x408e27['shift']());}};_0x38f5f2(++_0x5f0854);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xf2e3[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var moment=require(_0x3f2e('0x1'));var BPromise=require(_0x3f2e('0x2'));var rs=require(_0x3f2e('0x3'));var fs=require('fs');var Redis=require(_0x3f2e('0x4'));var db=require(_0x3f2e('0x5'))['db'];var utils=require(_0x3f2e('0x6'));var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));var config=require(_0x3f2e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f2e('0xa')][_0x3f2e('0xb')]({'port':0x232a});config[_0x3f2e('0xc')]=_[_0x3f2e('0xd')](config[_0x3f2e('0xc')],{'host':_0x3f2e('0xe'),'port':0x18eb});var socket=require(_0x3f2e('0xf'))(new Redis(config[_0x3f2e('0xc')]));require(_0x3f2e('0x10'))[_0x3f2e('0x11')](socket);function respondWithRpcPromise(_0x21f22b,_0x32902a,_0x1dd9d0){return new BPromise(function(_0x10a392,_0x1bb1dd){return client[_0x3f2e('0x12')](_0x21f22b,_0x1dd9d0)[_0x3f2e('0x13')](function(_0x475cd2){logger[_0x3f2e('0x14')]('MailMessage,\x20%s,\x20%s',_0x32902a,_0x3f2e('0x15'));logger[_0x3f2e('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x32902a,_0x3f2e('0x15'),JSON[_0x3f2e('0x17')](_0x475cd2));if(_0x475cd2[_0x3f2e('0x18')]){if(_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x19')]===0x1f4){logger['error'](_0x3f2e('0x1a'),_0x32902a,_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);return _0x1bb1dd(_0x475cd2['error'][_0x3f2e('0x1b')]);}logger[_0x3f2e('0x18')](_0x3f2e('0x1a'),_0x32902a,_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);return _0x10a392(_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);}else{logger[_0x3f2e('0x14')](_0x3f2e('0x1a'),_0x32902a,_0x3f2e('0x15'));_0x10a392(_0x475cd2[_0x3f2e('0x1c')]['message']);}})[_0x3f2e('0x1d')](function(_0x243822){logger[_0x3f2e('0x18')](_0x3f2e('0x1a'),_0x32902a,_0x243822);_0x1bb1dd(_0x243822);});});}exports[_0x3f2e('0x1e')]=function(_0x4eb1e7){var _0x4ba868=this;return new Promise(function(_0x904d94,_0x11f84c){return db[_0x3f2e('0x1f')][_0x3f2e('0x20')](_0x4eb1e7[_0x3f2e('0x21')],{'raw':_0x4eb1e7[_0x3f2e('0x22')]?_0x4eb1e7['options']['raw']===undefined?!![]:![]:!![]})[_0x3f2e('0x13')](function(_0x37dab2){logger['info']('CreateMailMessage',_0x4eb1e7);logger[_0x3f2e('0x16')]('CreateMailMessage',_0x4eb1e7,JSON[_0x3f2e('0x17')](_0x37dab2));_0x904d94(_0x37dab2);})[_0x3f2e('0x1d')](function(_0x515e32){logger['error']('CreateMailMessage',_0x515e32[_0x3f2e('0x1b')],_0x4eb1e7);_0x11f84c(_0x4ba868[_0x3f2e('0x18')](0x1f4,_0x515e32['message']));});});};
\ No newline at end of file
+var _0x5eb8=['client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','result','catch','options','raw','then','stringify','CreateMailMessage','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x50784a,_0x5c3b07){var _0x5eee74=function(_0x29bb70){while(--_0x29bb70){_0x50784a['push'](_0x50784a['shift']());}};_0x5eee74(++_0x5c3b07);}(_0x5eb8,0xb0));var _0x85eb=function(_0x28d391,_0x1357b3){_0x28d391=_0x28d391-0x0;var _0x3c8bf0=_0x5eb8[_0x28d391];return _0x3c8bf0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});config['redis']=_[_0x85eb('0xc')](config[_0x85eb('0xd')],{'host':_0x85eb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0xd')]));require('./mailMessage.socket')[_0x85eb('0xf')](socket);function respondWithRpcPromise(_0x40d6b6,_0x673228,_0x29030b){return new BPromise(function(_0x1dacf2,_0x73e6d0){return client[_0x85eb('0x10')](_0x40d6b6,_0x29030b)['then'](function(_0x163f32){logger[_0x85eb('0x11')]('MailMessage,\x20%s,\x20%s',_0x673228,_0x85eb('0x12'));logger[_0x85eb('0x13')](_0x85eb('0x14'),_0x673228,_0x85eb('0x12'),JSON['stringify'](_0x163f32));if(_0x163f32['error']){if(_0x163f32[_0x85eb('0x15')]['code']===0x1f4){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x73e6d0(_0x163f32[_0x85eb('0x15')]['message']);}logger[_0x85eb('0x15')]('MailMessage,\x20%s,\x20%s',_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x1dacf2(_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x673228,'request\x20sent');_0x1dacf2(_0x163f32[_0x85eb('0x18')][_0x85eb('0x17')]);}})[_0x85eb('0x19')](function(_0x2e986c){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x2e986c);_0x73e6d0(_0x2e986c);});});}exports['CreateMailMessage']=function(_0x24cf28){var _0x7244fc=this;return new Promise(function(_0xd9f06d,_0x4e8041){return db['MailMessage']['create'](_0x24cf28['body'],{'raw':_0x24cf28[_0x85eb('0x1a')]?_0x24cf28[_0x85eb('0x1a')][_0x85eb('0x1b')]===undefined?!![]:![]:!![]})[_0x85eb('0x1c')](function(_0x465c74){logger[_0x85eb('0x11')]('CreateMailMessage',_0x24cf28);logger['debug']('CreateMailMessage',_0x24cf28,JSON[_0x85eb('0x1d')](_0x465c74));_0xd9f06d(_0x465c74);})[_0x85eb('0x19')](function(_0x3f7a4d){logger[_0x85eb('0x15')](_0x85eb('0x1e'),_0x3f7a4d[_0x85eb('0x17')],_0x24cf28);_0x4e8041(_0x7244fc['error'](0x1f4,_0x3f7a4d[_0x85eb('0x17')]));});});};
\ No newline at end of file
index e50876e..98d1bec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeaa7=['length','mailMessage:','./mailMessage.events','save','remove','update','emit'];(function(_0x44058e,_0x451ec7){var _0x73edc8=function(_0x25a99b){while(--_0x25a99b){_0x44058e['push'](_0x44058e['shift']());}};_0x73edc8(++_0x451ec7);}(_0xeaa7,0x113));var _0x7eaa=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xeaa7[_0x32d457];return _0x338386;};'use strict';var MailMessageEvents=require(_0x7eaa('0x0'));var events=[_0x7eaa('0x1'),_0x7eaa('0x2'),_0x7eaa('0x3')];function createListener(_0x13d838,_0x5d21aa){return function(_0x20d4d0){_0x5d21aa[_0x7eaa('0x4')](_0x13d838,_0x20d4d0);};}function removeListener(_0x1ec578,_0x5c8736){return function(){MailMessageEvents['removeListener'](_0x1ec578,_0x5c8736);};}exports['register']=function(_0x5a67f7){for(var _0x5ec390=0x0,_0x3cdac4=events[_0x7eaa('0x5')];_0x5ec390<_0x3cdac4;_0x5ec390++){var _0x4a4801=events[_0x5ec390];var _0x3bf3cd=createListener(_0x7eaa('0x6')+_0x4a4801,_0x5a67f7);MailMessageEvents['on'](_0x4a4801,_0x3bf3cd);}};
\ No newline at end of file
+var _0xf675=['emit','removeListener','register','mailMessage:','remove','update'];(function(_0x5b3268,_0x299634){var _0x4964b7=function(_0x23103f){while(--_0x23103f){_0x5b3268['push'](_0x5b3268['shift']());}};_0x4964b7(++_0x299634);}(_0xf675,0x1ba));var _0x5f67=function(_0x12fcbd,_0x884804){_0x12fcbd=_0x12fcbd-0x0;var _0x28ec2a=_0xf675[_0x12fcbd];return _0x28ec2a;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x5f67('0x0'),_0x5f67('0x1')];function createListener(_0x1d4375,_0x20a611){return function(_0x14b38a){_0x20a611[_0x5f67('0x2')](_0x1d4375,_0x14b38a);};}function removeListener(_0x34cfdc,_0x1270ec){return function(){MailMessageEvents[_0x5f67('0x3')](_0x34cfdc,_0x1270ec);};}exports[_0x5f67('0x4')]=function(_0x3624fe){for(var _0x5fceff=0x0,_0x1c6424=events['length'];_0x5fceff<_0x1c6424;_0x5fceff++){var _0xa0f732=events[_0x5fceff];var _0x4a1b90=createListener(_0x5f67('0x5')+_0xa0f732,_0x3624fe);MailMessageEvents['on'](_0xa0f732,_0x4a1b90);}};
\ No newline at end of file
index 81310e4..e5aca14 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9fe2=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x1045d8,_0x25837a){var _0x16c1b9=function(_0xb4b52a){while(--_0xb4b52a){_0x1045d8['push'](_0x1045d8['shift']());}};_0x16c1b9(++_0x25837a);}(_0x9fe2,0xac));var _0x29fe=function(_0xf7576,_0x5cbe0c){_0xf7576=_0xf7576-0x0;var _0x5bc81f=_0x9fe2[_0xf7576];return _0x5bc81f;};'use strict';var multer=require(_0x29fe('0x0'));var util=require(_0x29fe('0x1'));var path=require(_0x29fe('0x2'));var timeout=require(_0x29fe('0x3'));var express=require(_0x29fe('0x4'));var router=express['Router']();var fs_extra=require(_0x29fe('0x5'));var auth=require(_0x29fe('0x6'));var interaction=require(_0x29fe('0x7'));var config=require(_0x29fe('0x8'));var controller=require(_0x29fe('0x9'));router[_0x29fe('0xa')]('/',auth[_0x29fe('0xb')](),controller[_0x29fe('0xc')]);router[_0x29fe('0xa')](_0x29fe('0xd'),auth[_0x29fe('0xb')](),controller[_0x29fe('0xe')]);router['get'](_0x29fe('0xf'),auth['isAuthenticated'](),controller[_0x29fe('0x10')]);router[_0x29fe('0xa')](_0x29fe('0x11'),auth[_0x29fe('0xb')](),controller[_0x29fe('0x12')]);router[_0x29fe('0xa')](_0x29fe('0x13'),auth['isAuthenticated'](),controller[_0x29fe('0x14')]);router['get'](_0x29fe('0x15'),auth['isAuthenticated'](),controller[_0x29fe('0x16')]);router['post']('/',auth[_0x29fe('0xb')](),controller[_0x29fe('0x17')]);router[_0x29fe('0x18')](_0x29fe('0x13'),auth[_0x29fe('0xb')](),controller[_0x29fe('0x19')]);router[_0x29fe('0x18')](_0x29fe('0x15'),auth[_0x29fe('0xb')](),controller[_0x29fe('0x1a')]);router[_0x29fe('0x1b')]('/:id',auth[_0x29fe('0xb')](),controller[_0x29fe('0x1c')]);router[_0x29fe('0x1d')](_0x29fe('0xf'),auth[_0x29fe('0xb')](),controller[_0x29fe('0x1e')]);router['delete'](_0x29fe('0x13'),auth[_0x29fe('0xb')](),controller['removeTeams']);router['delete'](_0x29fe('0x15'),auth[_0x29fe('0xb')](),controller['removeAgents']);module['exports']=router;
\ No newline at end of file
+var _0x8475=['destroy','delete','removeTeams','removeAgents','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update'];(function(_0x2383f7,_0x53e3ca){var _0x1432c6=function(_0x123766){while(--_0x123766){_0x2383f7['push'](_0x2383f7['shift']());}};_0x1432c6(++_0x53e3ca);}(_0x8475,0xdc));var _0x5847=function(_0x231f43,_0x3772e6){_0x231f43=_0x231f43-0x0;var _0x49ae92=_0x8475[_0x231f43];return _0x49ae92;};'use strict';var multer=require('multer');var util=require(_0x5847('0x0'));var path=require('path');var timeout=require(_0x5847('0x1'));var express=require(_0x5847('0x2'));var router=express['Router']();var fs_extra=require(_0x5847('0x3'));var auth=require(_0x5847('0x4'));var interaction=require(_0x5847('0x5'));var config=require(_0x5847('0x6'));var controller=require('./mailQueue.controller');router[_0x5847('0x7')]('/',auth[_0x5847('0x8')](),controller[_0x5847('0x9')]);router[_0x5847('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x5847('0xa')]);router[_0x5847('0x7')]('/:id',auth[_0x5847('0x8')](),controller['show']);router['get'](_0x5847('0xb'),auth[_0x5847('0x8')](),controller['getMembers']);router['get'](_0x5847('0xc'),auth['isAuthenticated'](),controller[_0x5847('0xd')]);router[_0x5847('0x7')](_0x5847('0xe'),auth['isAuthenticated'](),controller[_0x5847('0xf')]);router[_0x5847('0x10')]('/',auth[_0x5847('0x8')](),controller[_0x5847('0x11')]);router[_0x5847('0x10')](_0x5847('0xc'),auth[_0x5847('0x8')](),controller[_0x5847('0x12')]);router['post'](_0x5847('0xe'),auth[_0x5847('0x8')](),controller[_0x5847('0x13')]);router[_0x5847('0x14')](_0x5847('0x15'),auth[_0x5847('0x8')](),controller[_0x5847('0x16')]);router['delete'](_0x5847('0x15'),auth['isAuthenticated'](),controller[_0x5847('0x17')]);router[_0x5847('0x18')](_0x5847('0xc'),auth[_0x5847('0x8')](),controller[_0x5847('0x19')]);router['delete'](_0x5847('0xe'),auth['isAuthenticated'](),controller[_0x5847('0x1a')]);module['exports']=router;
\ No newline at end of file
index bf0bd4b..62445e8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x08f5=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x409f48,_0x485a54){var _0xb80d79=function(_0x17cfcc){while(--_0x17cfcc){_0x409f48['push'](_0x409f48['shift']());}};_0xb80d79(++_0x485a54);}(_0x08f5,0xed));var _0x508f=function(_0x10e653,_0x59f1cc){_0x10e653=_0x10e653-0x0;var _0x328dfd=_0x08f5[_0x10e653];return _0x328dfd;};'use strict';var Sequelize=require('sequelize');module[_0x508f('0x0')]={'name':{'type':Sequelize[_0x508f('0x1')],'unique':_0x508f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x508f('0x1')]},'timeout':{'type':Sequelize[_0x508f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x508f('0x4'),_0x508f('0x5'),_0x508f('0x6'))}};
\ No newline at end of file
+var _0xf166=['sequelize','STRING','name','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0xf166,0x1ab));var _0x6f16=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf166[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x6f16('0x0'));module['exports']={'name':{'type':Sequelize[_0x6f16('0x1')],'unique':_0x6f16('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6f16('0x1')]},'timeout':{'type':Sequelize[_0x6f16('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6f16('0x4'),_0x6f16('0x5'),_0x6f16('0x6'))}};
\ No newline at end of file
index e142b52..8cd7b5e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbbdc=['destroy','get','MailQueues','UserProfileResource','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','attributes','fields','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','MailQueue','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','order','MailQueueId','User','UserId','agent','mailPause','createdAt','format','SIP','updatedAt','getTeams','addTeams','ids','online','interface','flatMap','Agents','sequelize','each','findOrCreate','userMailQueue:save','Team','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId','union','compact','value','removeTeams','isEmpty','userMailQueue:remove','addAgents','omit','spread','emit','removeAgents','isArray','eml-format','rimraf','util','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','sendStatus','status','end','json','undefined','offset','count','set','Content-Range','reject','save','update','then'];(function(_0x4c4e00,_0xf2de53){var _0x5ba721=function(_0x506d26){while(--_0x506d26){_0x4c4e00['push'](_0x4c4e00['shift']());}};_0x5ba721(++_0xf2de53);}(_0xbbdc,0x1eb));var _0xcbbd=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0xbbdc[_0x4fe19c];return _0x952ac7;};'use strict';var emlformat=require(_0xcbbd('0x0'));var rimraf=require(_0xcbbd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcbbd('0x2'));var path=require('path');var sox=require(_0xcbbd('0x3'));var csv=require(_0xcbbd('0x4'));var ejs=require(_0xcbbd('0x5'));var fs=require('fs');var fs_extra=require(_0xcbbd('0x6'));var _=require(_0xcbbd('0x7'));var squel=require('squel');var crypto=require(_0xcbbd('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcbbd('0x9'));var Papa=require('papaparse');var Redis=require(_0xcbbd('0xa'));var authService=require('../../components/auth/service');var qs=require(_0xcbbd('0xb'));var as=require(_0xcbbd('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcbbd('0xd'));var utils=require(_0xcbbd('0xe'));var config=require(_0xcbbd('0xf'));var licenseUtil=require(_0xcbbd('0x10'));var db=require(_0xcbbd('0x11'))['db'];config[_0xcbbd('0x12')]=_[_0xcbbd('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcbbd('0x12')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x1407a2,_0x56c7a4){_0x56c7a4=_0x56c7a4||0xcc;return function(_0x537619){if(_0x537619){return _0x1407a2[_0xcbbd('0x14')](_0x56c7a4);}return _0x1407a2[_0xcbbd('0x15')](_0x56c7a4)[_0xcbbd('0x16')]();};}function respondWithResult(_0xbbf053,_0x437aa2){_0x437aa2=_0x437aa2||0xc8;return function(_0x25abae){if(_0x25abae){return _0xbbf053[_0xcbbd('0x15')](_0x437aa2)[_0xcbbd('0x17')](_0x25abae);}};}function respondWithFilteredResult(_0x4ae3f3,_0x50f6e2){return function(_0x547bb3){if(_0x547bb3){var _0x4e5f37=typeof _0x50f6e2['offset']===_0xcbbd('0x18')&&typeof _0x50f6e2['limit']===_0xcbbd('0x18');var _0x5aba54=_0x547bb3['count'];var _0xded7b=_0x4e5f37?0x0:_0x50f6e2[_0xcbbd('0x19')];var _0x17fb1c=_0x4e5f37?_0x547bb3[_0xcbbd('0x1a')]:_0x50f6e2['offset']+_0x50f6e2['limit'];var _0x2508c7;if(_0x17fb1c>=_0x5aba54){_0x17fb1c=_0x5aba54;_0x2508c7=0xc8;}else{_0x2508c7=0xce;}_0x4ae3f3['status'](_0x2508c7);return _0x4ae3f3[_0xcbbd('0x1b')](_0xcbbd('0x1c'),_0xded7b+'-'+_0x17fb1c+'/'+_0x5aba54)[_0xcbbd('0x17')](_0x547bb3);}return null;};}function patchUpdates(_0xae1809){return function(_0x33f7ef){try{jsonpatch['apply'](_0x33f7ef,_0xae1809,!![]);}catch(_0x48a887){return BPromise[_0xcbbd('0x1d')](_0x48a887);}return _0x33f7ef[_0xcbbd('0x1e')]();};}function saveUpdates(_0x2bc8fc,_0x53d4df){return function(_0x1b4960){if(_0x1b4960){return _0x1b4960[_0xcbbd('0x1f')](_0x2bc8fc)[_0xcbbd('0x20')](function(_0x117361){return _0x117361;});}return null;};}function removeEntity(_0x316c52,_0x2e1cb1){return function(_0x3bc2cc){if(_0x3bc2cc){return _0x3bc2cc[_0xcbbd('0x21')]()['then'](function(){var _0x557872=_0x3bc2cc[_0xcbbd('0x22')]({'plain':!![]});var _0x50760f=_0xcbbd('0x23');return db[_0xcbbd('0x24')][_0xcbbd('0x21')]({'where':{'type':_0x50760f,'resourceId':_0x557872['id']}})[_0xcbbd('0x20')](function(){return _0x3bc2cc;});})['then'](function(){_0x316c52[_0xcbbd('0x15')](0xcc)[_0xcbbd('0x16')]();});}};}function handleEntityNotFound(_0x3e4e69,_0x303e31){return function(_0x506bc0){if(!_0x506bc0){_0x3e4e69['sendStatus'](0x194);}return _0x506bc0;};}function handleError(_0x35dc2c,_0x1cad50){_0x1cad50=_0x1cad50||0x1f4;return function(_0xb21da1){logger[_0xcbbd('0x25')](_0xb21da1[_0xcbbd('0x26')]);if(_0xb21da1[_0xcbbd('0x27')]){delete _0xb21da1[_0xcbbd('0x27')];}_0x35dc2c[_0xcbbd('0x15')](_0x1cad50)[_0xcbbd('0x28')](_0xb21da1);};}exports['index']=function(_0x4803b3,_0x4b34e9){var _0xee151c={},_0x19c7ee={},_0x571f0d={'count':0x0,'rows':[]};var _0x21ea37=_[_0xcbbd('0x29')](db['MailQueue']['rawAttributes'],function(_0x4ef9e7){return{'name':_0x4ef9e7[_0xcbbd('0x2a')],'type':_0x4ef9e7[_0xcbbd('0x2b')][_0xcbbd('0x2c')]};});_0x19c7ee[_0xcbbd('0x2d')]=_['map'](_0x21ea37,'name');_0x19c7ee[_0xcbbd('0x2e')]=_[_0xcbbd('0x2f')](_0x4803b3[_0xcbbd('0x2e')]);_0x19c7ee[_0xcbbd('0x30')]=_['intersection'](_0x19c7ee[_0xcbbd('0x2d')],_0x19c7ee['query']);_0xee151c[_0xcbbd('0x31')]=_['intersection'](_0x19c7ee['model'],qs[_0xcbbd('0x32')](_0x4803b3[_0xcbbd('0x2e')][_0xcbbd('0x32')]));_0xee151c[_0xcbbd('0x31')]=_0xee151c[_0xcbbd('0x31')]['length']?_0xee151c[_0xcbbd('0x31')]:_0x19c7ee[_0xcbbd('0x2d')];if(!_0x4803b3['query']['hasOwnProperty'](_0xcbbd('0x33'))){_0xee151c[_0xcbbd('0x34')]=qs['limit'](_0x4803b3['query'][_0xcbbd('0x34')]);_0xee151c[_0xcbbd('0x19')]=qs['offset'](_0x4803b3[_0xcbbd('0x2e')][_0xcbbd('0x19')]);}_0xee151c['order']=qs[_0xcbbd('0x35')](_0x4803b3[_0xcbbd('0x2e')]['sort']);_0xee151c[_0xcbbd('0x36')]=qs['filters'](_[_0xcbbd('0x37')](_0x4803b3['query'],_0x19c7ee[_0xcbbd('0x30')]),_0x21ea37);if(_0x4803b3[_0xcbbd('0x2e')][_0xcbbd('0x38')]){_0xee151c[_0xcbbd('0x36')]=_[_0xcbbd('0x39')](_0xee151c[_0xcbbd('0x36')],{'$or':_[_0xcbbd('0x29')](_0x21ea37,function(_0x5611cb){if(_0x5611cb[_0xcbbd('0x2b')]!==_0xcbbd('0x3a')){var _0x5f0c7f={};_0x5f0c7f[_0x5611cb[_0xcbbd('0x27')]]={'$like':'%'+_0x4803b3[_0xcbbd('0x2e')][_0xcbbd('0x38')]+'%'};return _0x5f0c7f;}})});}_0xee151c=_[_0xcbbd('0x39')]({},_0xee151c,_0x4803b3[_0xcbbd('0x3b')]);var _0x4e4d74={'where':_0xee151c[_0xcbbd('0x36')]};return db[_0xcbbd('0x3c')][_0xcbbd('0x1a')](_0x4e4d74)['then'](function(_0x5f1f12){_0x571f0d[_0xcbbd('0x1a')]=_0x5f1f12;if(_0x4803b3[_0xcbbd('0x2e')][_0xcbbd('0x3d')]){_0xee151c[_0xcbbd('0x3e')]=[{'all':!![]}];}return db['MailQueue'][_0xcbbd('0x3f')](_0xee151c);})['then'](function(_0x4c5efc){_0x571f0d[_0xcbbd('0x40')]=_0x4c5efc;return _0x571f0d;})[_0xcbbd('0x20')](respondWithFilteredResult(_0x4b34e9,_0xee151c))[_0xcbbd('0x41')](handleError(_0x4b34e9,null));};exports[_0xcbbd('0x42')]=function(_0x2d7a40,_0x4addbf){var _0x57271b={'raw':!![],'where':{'id':_0x2d7a40[_0xcbbd('0x43')]['id']}},_0x5d10de={};_0x5d10de[_0xcbbd('0x2d')]=_[_0xcbbd('0x2f')](db[_0xcbbd('0x3c')][_0xcbbd('0x44')]);_0x5d10de[_0xcbbd('0x2e')]=_[_0xcbbd('0x2f')](_0x2d7a40[_0xcbbd('0x2e')]);_0x5d10de[_0xcbbd('0x30')]=_[_0xcbbd('0x45')](_0x5d10de['model'],_0x5d10de[_0xcbbd('0x2e')]);_0x57271b['attributes']=_[_0xcbbd('0x45')](_0x5d10de['model'],qs[_0xcbbd('0x32')](_0x2d7a40[_0xcbbd('0x2e')][_0xcbbd('0x32')]));_0x57271b['attributes']=_0x57271b[_0xcbbd('0x31')][_0xcbbd('0x46')]?_0x57271b['attributes']:_0x5d10de['model'];if(_0x2d7a40[_0xcbbd('0x2e')][_0xcbbd('0x3d')]){_0x57271b[_0xcbbd('0x3e')]=[{'all':!![]}];}_0x57271b=_[_0xcbbd('0x39')]({},_0x57271b,_0x2d7a40[_0xcbbd('0x3b')]);return db[_0xcbbd('0x3c')][_0xcbbd('0x47')](_0x57271b)[_0xcbbd('0x20')](handleEntityNotFound(_0x4addbf,null))[_0xcbbd('0x20')](respondWithResult(_0x4addbf,null))[_0xcbbd('0x41')](handleError(_0x4addbf,null));};exports[_0xcbbd('0x48')]=function(_0x5becfa,_0x49b767){return db[_0xcbbd('0x3c')][_0xcbbd('0x48')](_0x5becfa['body'],{})[_0xcbbd('0x20')](function(_0x1de744){var _0x3edd52=_0x5becfa[_0xcbbd('0x49')][_0xcbbd('0x22')]({'plain':!![]});if(!_0x3edd52)throw new Error(_0xcbbd('0x4a'));if(_0x3edd52[_0xcbbd('0x4b')]==='user'){var _0x80a2ef=_0x1de744['get']({'plain':!![]});var _0x97660='MailQueues';return db[_0xcbbd('0x4c')][_0xcbbd('0x47')]({'where':{'name':_0x97660,'userProfileId':_0x3edd52['userProfileId']},'raw':!![]})[_0xcbbd('0x20')](function(_0x346686){if(_0x346686&&_0x346686[_0xcbbd('0x4d')]===0x0){return db[_0xcbbd('0x24')][_0xcbbd('0x48')]({'name':_0x80a2ef['name'],'resourceId':_0x80a2ef['id'],'type':_0x346686[_0xcbbd('0x27')],'sectionId':_0x346686['id']},{})[_0xcbbd('0x20')](function(){return _0x1de744;});}else{return _0x1de744;}})[_0xcbbd('0x41')](function(_0x3a736b){logger[_0xcbbd('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a736b);throw _0x3a736b;});}return _0x1de744;})['then'](respondWithResult(_0x49b767,0xc9))[_0xcbbd('0x41')](handleError(_0x49b767,null));};exports[_0xcbbd('0x1f')]=function(_0x20be4c,_0x32ebb8){if(_0x20be4c[_0xcbbd('0x4e')]['id']){delete _0x20be4c[_0xcbbd('0x4e')]['id'];}return db['MailQueue'][_0xcbbd('0x47')]({'where':{'id':_0x20be4c['params']['id']}})['then'](handleEntityNotFound(_0x32ebb8,null))[_0xcbbd('0x20')](saveUpdates(_0x20be4c['body'],null))[_0xcbbd('0x20')](respondWithResult(_0x32ebb8,null))[_0xcbbd('0x41')](handleError(_0x32ebb8,null));};exports['destroy']=function(_0x2a2a29,_0x4bed15){return db['MailQueue'][_0xcbbd('0x47')]({'where':{'id':_0x2a2a29['params']['id']}})['then'](handleEntityNotFound(_0x4bed15,null))[_0xcbbd('0x20')](removeEntity(_0x4bed15,null))[_0xcbbd('0x41')](handleError(_0x4bed15,null));};exports['describe']=function(_0x2d24a5,_0xb1813){return db[_0xcbbd('0x3c')][_0xcbbd('0x4f')]()['then'](respondWithResult(_0xb1813,null))[_0xcbbd('0x41')](handleError(_0xb1813,null));};exports[_0xcbbd('0x50')]=function(_0x190b70,_0x7faf81,_0x215b17){var _0x28196c={'raw':!![],'where':{}},_0x2519a0={},_0x2b5715;return db[_0xcbbd('0x3c')][_0xcbbd('0x51')]({'where':{'id':_0x190b70['params']['id']}})[_0xcbbd('0x20')](handleEntityNotFound(_0x7faf81,null))[_0xcbbd('0x20')](function(_0x22c4f4){if(_0x22c4f4){_0x2b5715=_0x22c4f4['get']({'plain':!![]});_0x2519a0[_0xcbbd('0x2d')]=_['keys'](db[_0xcbbd('0x52')][_0xcbbd('0x44')]);_0x2519a0[_0xcbbd('0x2e')]=_[_0xcbbd('0x2f')](_0x190b70[_0xcbbd('0x2e')]);_0x2519a0[_0xcbbd('0x30')]=_[_0xcbbd('0x45')](_0x2519a0[_0xcbbd('0x2d')],_0x2519a0[_0xcbbd('0x2e')]);_0x28196c[_0xcbbd('0x31')]=_[_0xcbbd('0x45')](_0x2519a0[_0xcbbd('0x2d')],qs['fields'](_0x190b70[_0xcbbd('0x2e')][_0xcbbd('0x32')]));_0x28196c[_0xcbbd('0x31')]=_0x28196c[_0xcbbd('0x31')][_0xcbbd('0x46')]?_0x28196c[_0xcbbd('0x31')]:_0x2519a0['model'];if(!_0x190b70[_0xcbbd('0x2e')][_0xcbbd('0x53')](_0xcbbd('0x33'))){_0x28196c[_0xcbbd('0x34')]=qs['limit'](_0x190b70[_0xcbbd('0x2e')]['limit']);_0x28196c[_0xcbbd('0x19')]=qs[_0xcbbd('0x19')](_0x190b70['query'][_0xcbbd('0x19')]);}_0x28196c[_0xcbbd('0x54')]=qs[_0xcbbd('0x35')](_0x190b70['query'][_0xcbbd('0x35')]);_0x28196c['where']=qs['filters'](_[_0xcbbd('0x37')](_0x190b70[_0xcbbd('0x2e')],_0x2519a0[_0xcbbd('0x30')]));_0x28196c['where'][_0xcbbd('0x55')]=_0x22c4f4['id'];if(_0x190b70[_0xcbbd('0x2e')][_0xcbbd('0x38')]){_0x28196c['where']=_[_0xcbbd('0x39')](_0x28196c[_0xcbbd('0x36')],{'$or':_[_0xcbbd('0x29')](_0x28196c['attributes'],function(_0x38a361){var _0x3e7c62={};_0x3e7c62[_0x38a361]={'$like':'%'+_0x190b70[_0xcbbd('0x2e')]['filter']+'%'};return _0x3e7c62;})});}_0x28196c=_['merge']({},_0x28196c,_0x190b70['options']);return db[_0xcbbd('0x52')][_0xcbbd('0x3f')](_0x28196c);}})['then'](function(_0x5f2108){if(_0x5f2108){return db[_0xcbbd('0x56')]['findAndCountAll']({'where':{'id':_[_0xcbbd('0x29')](_0x5f2108,_0xcbbd('0x57')),'role':_0xcbbd('0x58')},'attributes':['id',_0xcbbd('0x27'),_0xcbbd('0x59'),'updatedAt',_0xcbbd('0x5a')]});}})[_0xcbbd('0x20')](function(_0x5daa03){if(_0x5daa03){return{'count':_0x5daa03['count'],'rows':_['map'](_0x5daa03['rows'],function(_0x3849b0){return{'membername':_0x3849b0[_0xcbbd('0x27')],'UserId':_0x3849b0['id'],'queue_name':_0x2b5715[_0xcbbd('0x27')],'MailQueueId':_0x2b5715['id'],'interface':util[_0xcbbd('0x5b')]('%s/%s',_0xcbbd('0x5c'),_0x3849b0[_0xcbbd('0x27')]),'penalty':0x0,'paused':_0x3849b0['mailPause'],'createdAt':_0x3849b0[_0xcbbd('0x5a')],'updatedAt':_0x3849b0[_0xcbbd('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x7faf81,_0x28196c))[_0xcbbd('0x41')](handleError(_0x7faf81,null));};exports[_0xcbbd('0x5e')]=function(_0x3093ae,_0x2c4a11,_0x229c3a){var _0xe6666a={};var _0x1269db={};var _0x4f94ce;var _0x135bea;return db[_0xcbbd('0x3c')][_0xcbbd('0x51')]({'where':{'id':_0x3093ae[_0xcbbd('0x43')]['id']}})[_0xcbbd('0x20')](handleEntityNotFound(_0x2c4a11,null))[_0xcbbd('0x20')](function(_0x3f0f4d){if(_0x3f0f4d){_0x4f94ce=_0x3f0f4d;_0x1269db[_0xcbbd('0x2d')]=_[_0xcbbd('0x2f')](db['Team'][_0xcbbd('0x44')]);_0x1269db['query']=_[_0xcbbd('0x2f')](_0x3093ae['query']);_0x1269db[_0xcbbd('0x30')]=_[_0xcbbd('0x45')](_0x1269db[_0xcbbd('0x2d')],_0x1269db[_0xcbbd('0x2e')]);_0xe6666a[_0xcbbd('0x31')]=_[_0xcbbd('0x45')](_0x1269db[_0xcbbd('0x2d')],qs[_0xcbbd('0x32')](_0x3093ae[_0xcbbd('0x2e')][_0xcbbd('0x32')]));_0xe6666a[_0xcbbd('0x31')]=_0xe6666a[_0xcbbd('0x31')][_0xcbbd('0x46')]?_0xe6666a[_0xcbbd('0x31')]:_0x1269db[_0xcbbd('0x2d')];_0xe6666a['order']=qs['sort'](_0x3093ae['query']['sort']);_0xe6666a[_0xcbbd('0x36')]=qs[_0xcbbd('0x30')](_[_0xcbbd('0x37')](_0x3093ae[_0xcbbd('0x2e')],_0x1269db['filters']));if(_0x3093ae[_0xcbbd('0x2e')]['filter']){_0xe6666a[_0xcbbd('0x36')]=_[_0xcbbd('0x39')](_0xe6666a[_0xcbbd('0x36')],{'$or':_['map'](_0xe6666a[_0xcbbd('0x31')],function(_0x5a2775){var _0x5f3a79={};_0x5f3a79[_0x5a2775]={'$like':'%'+_0x3093ae[_0xcbbd('0x2e')][_0xcbbd('0x38')]+'%'};return _0x5f3a79;})});}_0xe6666a=_['merge']({},_0xe6666a,_0x3093ae['options']);return _0x4f94ce['getTeams'](_0xe6666a);}})[_0xcbbd('0x20')](function(_0x5d1743){if(_0x5d1743){_0x135bea=_0x5d1743[_0xcbbd('0x46')];if(!_0x3093ae[_0xcbbd('0x2e')]['hasOwnProperty'](_0xcbbd('0x33'))){_0xe6666a[_0xcbbd('0x34')]=qs[_0xcbbd('0x34')](_0x3093ae[_0xcbbd('0x2e')][_0xcbbd('0x34')]);_0xe6666a['offset']=qs[_0xcbbd('0x19')](_0x3093ae[_0xcbbd('0x2e')][_0xcbbd('0x19')]);}return _0x4f94ce[_0xcbbd('0x5e')](_0xe6666a);}})[_0xcbbd('0x20')](function(_0x476bc4){if(_0x476bc4){return _0x476bc4?{'count':_0x135bea,'rows':_0x476bc4}:null;}})[_0xcbbd('0x20')](respondWithResult(_0x2c4a11,null))['catch'](handleError(_0x2c4a11,null));};exports[_0xcbbd('0x5f')]=function(_0x1ed947,_0x56f86c,_0x294cc3){var _0x368300=_0x1ed947['body'][_0xcbbd('0x60')];return db['Team'][_0xcbbd('0x3f')]({'where':{'id':_0x368300},'attributes':['id'],'include':[{'model':db[_0xcbbd('0x56')],'as':'Agents','attributes':['id',_0xcbbd('0x27'),_0xcbbd('0x61'),'voicePause',_0xcbbd('0x62')],'raw':!![]}]})[_0xcbbd('0x20')](function(_0x4043c3){if(_0x4043c3){var _0x443dd8=_[_0xcbbd('0x63')](_0x4043c3,function(_0x4dc8d0){var _0x5ad31b=_0x4dc8d0['get']({'plain':!![]});return _0x5ad31b[_0xcbbd('0x64')];});return db['MailQueue'][_0xcbbd('0x47')]({'where':{'id':_0x1ed947['params']['id']}})[_0xcbbd('0x20')](function(_0x2d1835){return db[_0xcbbd('0x65')]['transaction'](function(_0x3ccd6d){return _0x2d1835[_0xcbbd('0x5f')](_0x368300,{'transaction':_0x3ccd6d})[_0xcbbd('0x20')](function(){return BPromise[_0xcbbd('0x66')](_0x443dd8,function(_0x57a6d8){return db[_0xcbbd('0x52')][_0xcbbd('0x67')]({'where':{'UserId':_0x57a6d8['id'],'MailQueueId':_0x1ed947['params']['id']},'transaction':_0x3ccd6d});});})['then'](function(){_0x443dd8['forEach'](function(_0xe1baa2){socket['emit'](_0xcbbd('0x68'),{'UserId':_0xe1baa2['id'],'MailQueueId':_0x2d1835['id']});});});});});}})[_0xcbbd('0x20')](respondWithStatusCode(_0x56f86c,null))[_0xcbbd('0x41')](handleError(_0x56f86c,null));};exports['removeTeams']=function(_0x4c8367,_0x807c5e,_0x265842){return db[_0xcbbd('0x69')]['findAll']({'where':{'id':_0x4c8367[_0xcbbd('0x2e')][_0xcbbd('0x60')]},'attributes':['id'],'include':[{'model':db[_0xcbbd('0x56')],'as':_0xcbbd('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x807c5e,null))[_0xcbbd('0x20')](function(_0x1294d8){var _0x27cf41=_[_0xcbbd('0x29')](_0x1294d8,'id');var _0x552c75=[];var _0x122c3a=[];var _0x343c1e=squel[_0xcbbd('0x6a')]();_0x343c1e['field'](_0xcbbd('0x6b'))[_0xcbbd('0x6c')]('team_has_mail_queues','tq')[_0xcbbd('0x6d')](_0xcbbd('0x6e'),'ut',_0xcbbd('0x6f'))[_0xcbbd('0x36')](_0xcbbd('0x70'),_0x4c8367[_0xcbbd('0x43')]['id']);for(var _0x12d8a8=0x0;_0x12d8a8<_0x1294d8[_0xcbbd('0x46')];_0x12d8a8+=0x1){let _0x54e0bb=_0x1294d8[_0x12d8a8];for(var _0x1ef68c=0x0;_0x1ef68c<_0x54e0bb[_0xcbbd('0x64')]['length'];_0x1ef68c+=0x1){let _0x2f5b8d=_0x54e0bb[_0xcbbd('0x64')][_0x1ef68c];var _0x3701db=_0x343c1e[_0xcbbd('0x71')]();_0x3701db['where']('ut.UserId\x20=\x20?',_0x2f5b8d['id']);_0x122c3a[_0xcbbd('0x72')](db[_0xcbbd('0x65')][_0xcbbd('0x2e')](_0x3701db[_0xcbbd('0x73')](),{'type':db[_0xcbbd('0x65')]['QueryTypes'][_0xcbbd('0x74')]})['then'](function(_0x3f8d36){if(_0x3f8d36[_0xcbbd('0x46')]===0x1){return _0x2f5b8d['id'];}else{var _0x5dd85b=_[_0xcbbd('0x75')](_['map'](_0x3f8d36,_0xcbbd('0x76')),function(_0x3e6d16){return _['includes'](_0x27cf41,_0x3e6d16);});if(_0x5dd85b){return _0x2f5b8d['id'];}}}));}}return BPromise['all'](_0x122c3a)['then'](function(_0x55e5b3){_0x552c75=_(_0x552c75)[_0xcbbd('0x77')](_0x55e5b3)[_0xcbbd('0x78')]()[_0xcbbd('0x79')]();return db['MailQueue']['find']({'where':{'id':_0x4c8367['params']['id']}})['then'](function(_0x2df0f8){return db[_0xcbbd('0x65')]['transaction'](function(_0x31417a){return _0x2df0f8[_0xcbbd('0x7a')](_0x4c8367[_0xcbbd('0x2e')][_0xcbbd('0x60')],{'transaction':_0x31417a})[_0xcbbd('0x20')](function(){if(!_[_0xcbbd('0x7b')](_0x552c75)){return _0x2df0f8['removeAgents'](_0x552c75,{'transaction':_0x31417a});}})[_0xcbbd('0x20')](function(){_0x552c75['forEach'](function(_0x5047ab){socket['emit'](_0xcbbd('0x7c'),{'UserId':_0x5047ab,'MailQueueId':_0x2df0f8['id']});});});});});});})[_0xcbbd('0x20')](respondWithStatusCode(_0x807c5e,null))[_0xcbbd('0x41')](handleError(_0x807c5e,null));};exports[_0xcbbd('0x7d')]=function(_0x5862d8,_0x4a6b30,_0x5f1df7){return db['MailQueue'][_0xcbbd('0x47')]({'where':{'id':_0x5862d8[_0xcbbd('0x43')]['id']}})[_0xcbbd('0x20')](handleEntityNotFound(_0x4a6b30,null))['then'](function(_0x581ea7){if(_0x581ea7){return _0x581ea7[_0xcbbd('0x7d')](_0x5862d8[_0xcbbd('0x4e')][_0xcbbd('0x60')],_[_0xcbbd('0x7e')](_0x5862d8[_0xcbbd('0x4e')],[_0xcbbd('0x60'),'id'])||{})[_0xcbbd('0x7f')](function(_0x251f84){for(var _0xd03f1b=0x0;_0xd03f1b<_0x5862d8[_0xcbbd('0x4e')][_0xcbbd('0x60')][_0xcbbd('0x46')];_0xd03f1b+=0x1){socket[_0xcbbd('0x80')](_0xcbbd('0x68'),{'UserId':Number(_0x5862d8[_0xcbbd('0x4e')]['ids'][_0xd03f1b]),'MailQueueId':Number(_0x5862d8[_0xcbbd('0x43')]['id'])});}return _0x251f84;});}})['then'](respondWithResult(_0x4a6b30,null))['catch'](handleError(_0x4a6b30,null));};exports[_0xcbbd('0x81')]=function(_0x2b4c4d,_0x136ff2,_0x426b13){return db[_0xcbbd('0x3c')][_0xcbbd('0x47')]({'where':{'id':_0x2b4c4d[_0xcbbd('0x43')]['id']}})[_0xcbbd('0x20')](handleEntityNotFound(_0x136ff2,null))[_0xcbbd('0x20')](function(_0x356e56){if(_0x356e56){return _0x356e56[_0xcbbd('0x81')](_0x2b4c4d['query']['ids'])[_0xcbbd('0x20')](function(){if(_[_0xcbbd('0x82')](_0x2b4c4d[_0xcbbd('0x2e')][_0xcbbd('0x60')])){for(var _0x476532=0x0;_0x476532<_0x2b4c4d['query'][_0xcbbd('0x60')]['length'];_0x476532+=0x1){socket[_0xcbbd('0x80')](_0xcbbd('0x7c'),{'UserId':Number(_0x2b4c4d['query']['ids'][_0x476532]),'MailQueueId':Number(_0x2b4c4d[_0xcbbd('0x43')]['id'])});}}else{socket['emit'](_0xcbbd('0x7c'),{'UserId':Number(_0x2b4c4d[_0xcbbd('0x2e')][_0xcbbd('0x60')]),'MailQueueId':Number(_0x2b4c4d[_0xcbbd('0x43')]['id'])});}});}})[_0xcbbd('0x20')](respondWithStatusCode(_0x136ff2,null))['catch'](handleError(_0x136ff2,null));};exports['getAgents']=function(_0x2b7954,_0x2ef62e,_0x42ce40){var _0x2aa3b5={};var _0x46387b={};var _0x24fa47;var _0x581f55;return db['MailQueue'][_0xcbbd('0x51')]({'where':{'id':_0x2b7954['params']['id']}})[_0xcbbd('0x20')](handleEntityNotFound(_0x2ef62e,null))[_0xcbbd('0x20')](function(_0x295d49){if(_0x295d49){_0x24fa47=_0x295d49;_0x46387b[_0xcbbd('0x2d')]=_[_0xcbbd('0x2f')](db['User'][_0xcbbd('0x44')]);_0x46387b['query']=_[_0xcbbd('0x2f')](_0x2b7954[_0xcbbd('0x2e')]);_0x46387b[_0xcbbd('0x30')]=_['intersection'](_0x46387b[_0xcbbd('0x2d')],_0x46387b['query']);_0x2aa3b5[_0xcbbd('0x31')]=_[_0xcbbd('0x45')](_0x46387b[_0xcbbd('0x2d')],qs[_0xcbbd('0x32')](_0x2b7954['query'][_0xcbbd('0x32')]));_0x2aa3b5[_0xcbbd('0x31')]=_0x2aa3b5[_0xcbbd('0x31')][_0xcbbd('0x46')]?_0x2aa3b5[_0xcbbd('0x31')]:_0x46387b[_0xcbbd('0x2d')];_0x2aa3b5[_0xcbbd('0x54')]=qs[_0xcbbd('0x35')](_0x2b7954[_0xcbbd('0x2e')]['sort']);_0x2aa3b5['where']=qs[_0xcbbd('0x30')](_['pick'](_0x2b7954[_0xcbbd('0x2e')],_0x46387b[_0xcbbd('0x30')]));if(_0x2b7954[_0xcbbd('0x2e')][_0xcbbd('0x38')]){_0x2aa3b5[_0xcbbd('0x36')]=_[_0xcbbd('0x39')](_0x2aa3b5[_0xcbbd('0x36')],{'$or':_[_0xcbbd('0x29')](_0x2aa3b5[_0xcbbd('0x31')],function(_0x5eda96){var _0x16af15={};_0x16af15[_0x5eda96]={'$like':'%'+_0x2b7954['query'][_0xcbbd('0x38')]+'%'};return _0x16af15;})});}_0x2aa3b5=_[_0xcbbd('0x39')]({},_0x2aa3b5,_0x2b7954[_0xcbbd('0x3b')]);return _0x24fa47['getAgents'](_0x2aa3b5);}})[_0xcbbd('0x20')](function(_0xbf7fc0){if(_0xbf7fc0){_0x581f55=_0xbf7fc0[_0xcbbd('0x46')];if(!_0x2b7954[_0xcbbd('0x2e')]['hasOwnProperty'](_0xcbbd('0x33'))){_0x2aa3b5[_0xcbbd('0x34')]=qs[_0xcbbd('0x34')](_0x2b7954['query'][_0xcbbd('0x34')]);_0x2aa3b5[_0xcbbd('0x19')]=qs[_0xcbbd('0x19')](_0x2b7954[_0xcbbd('0x2e')]['offset']);}return _0x24fa47['getAgents'](_0x2aa3b5);}})[_0xcbbd('0x20')](function(_0x5206d3){if(_0x5206d3){return _0x5206d3?{'count':_0x581f55,'rows':_0x5206d3}:null;}})[_0xcbbd('0x20')](respondWithResult(_0x2ef62e,null))[_0xcbbd('0x41')](handleError(_0x2ef62e,null));};
\ No newline at end of file
+var _0x93f1=['spread','userMailQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','UserProfileResource','error','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','order','MailQueueId','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','voicePause','sequelize','findOrCreate','forEach','removeTeams','ids','select','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeAgents','emit','userMailQueue:remove','addAgents','omit'];(function(_0x3438e0,_0x140a7f){var _0x45cbba=function(_0x4a6205){while(--_0x4a6205){_0x3438e0['push'](_0x3438e0['shift']());}};_0x45cbba(++_0x140a7f);}(_0x93f1,0x1b1));var _0x193f=function(_0x5bd1ba,_0xade1cd){_0x5bd1ba=_0x5bd1ba-0x0;var _0xfcabf6=_0x93f1[_0x5bd1ba];return _0xfcabf6;};'use strict';var emlformat=require(_0x193f('0x0'));var rimraf=require(_0x193f('0x1'));var zipdir=require(_0x193f('0x2'));var jsonpatch=require(_0x193f('0x3'));var rp=require(_0x193f('0x4'));var moment=require(_0x193f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x193f('0x6'));var util=require('util');var path=require(_0x193f('0x7'));var sox=require('sox');var csv=require(_0x193f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x193f('0x9'));var _=require(_0x193f('0xa'));var squel=require(_0x193f('0xb'));var crypto=require(_0x193f('0xc'));var jsforce=require(_0x193f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x193f('0x8'));var querystring=require(_0x193f('0xe'));var Papa=require(_0x193f('0xf'));var Redis=require(_0x193f('0x10'));var authService=require(_0x193f('0x11'));var qs=require(_0x193f('0x12'));var as=require(_0x193f('0x13'));var hardwareService=require(_0x193f('0x14'));var logger=require(_0x193f('0x15'))(_0x193f('0x16'));var utils=require(_0x193f('0x17'));var config=require(_0x193f('0x18'));var licenseUtil=require(_0x193f('0x19'));var db=require(_0x193f('0x1a'))['db'];config[_0x193f('0x1b')]=_[_0x193f('0x1c')](config[_0x193f('0x1b')],{'host':_0x193f('0x1d'),'port':0x18eb});var socket=require(_0x193f('0x1e'))(new Redis(config[_0x193f('0x1b')]));require('./mailQueue.socket')[_0x193f('0x1f')](socket);function respondWithStatusCode(_0x35ede3,_0x49d492){_0x49d492=_0x49d492||0xcc;return function(_0x2f05dc){if(_0x2f05dc){return _0x35ede3[_0x193f('0x20')](_0x49d492);}return _0x35ede3[_0x193f('0x21')](_0x49d492)[_0x193f('0x22')]();};}function respondWithResult(_0xb0041c,_0x306a36){_0x306a36=_0x306a36||0xc8;return function(_0x3448d9){if(_0x3448d9){return _0xb0041c[_0x193f('0x21')](_0x306a36)[_0x193f('0x23')](_0x3448d9);}};}function respondWithFilteredResult(_0x23d33c,_0x5bc441){return function(_0x477cfb){if(_0x477cfb){var _0x39f103=typeof _0x5bc441[_0x193f('0x24')]===_0x193f('0x25')&&typeof _0x5bc441['limit']===_0x193f('0x25');var _0x4acd3f=_0x477cfb[_0x193f('0x26')];var _0xc15c17=_0x39f103?0x0:_0x5bc441['offset'];var _0x52f903=_0x39f103?_0x477cfb['count']:_0x5bc441[_0x193f('0x24')]+_0x5bc441['limit'];var _0x4ffab9;if(_0x52f903>=_0x4acd3f){_0x52f903=_0x4acd3f;_0x4ffab9=0xc8;}else{_0x4ffab9=0xce;}_0x23d33c[_0x193f('0x21')](_0x4ffab9);return _0x23d33c[_0x193f('0x27')](_0x193f('0x28'),_0xc15c17+'-'+_0x52f903+'/'+_0x4acd3f)['json'](_0x477cfb);}return null;};}function patchUpdates(_0x8da1d0){return function(_0x51cce7){try{jsonpatch[_0x193f('0x29')](_0x51cce7,_0x8da1d0,!![]);}catch(_0x364e05){return BPromise['reject'](_0x364e05);}return _0x51cce7['save']();};}function saveUpdates(_0x34ca1e,_0x3bf179){return function(_0x3e9360){if(_0x3e9360){return _0x3e9360[_0x193f('0x2a')](_0x34ca1e)[_0x193f('0x2b')](function(_0x5b73e7){return _0x5b73e7;});}return null;};}function removeEntity(_0x417abe,_0x546561){return function(_0x8caef0){if(_0x8caef0){return _0x8caef0[_0x193f('0x2c')]()[_0x193f('0x2b')](function(){var _0x4c5e67=_0x8caef0['get']({'plain':!![]});var _0x42fdc1='MailQueues';return db[_0x193f('0x2d')]['destroy']({'where':{'type':_0x42fdc1,'resourceId':_0x4c5e67['id']}})[_0x193f('0x2b')](function(){return _0x8caef0;});})[_0x193f('0x2b')](function(){_0x417abe['status'](0xcc)[_0x193f('0x22')]();});}};}function handleEntityNotFound(_0x9d65bb,_0x2d623d){return function(_0x1d02bf){if(!_0x1d02bf){_0x9d65bb[_0x193f('0x20')](0x194);}return _0x1d02bf;};}function handleError(_0x2190ec,_0x24b5ff){_0x24b5ff=_0x24b5ff||0x1f4;return function(_0x35ae08){logger[_0x193f('0x2e')](_0x35ae08['stack']);if(_0x35ae08[_0x193f('0x2f')]){delete _0x35ae08[_0x193f('0x2f')];}_0x2190ec[_0x193f('0x21')](_0x24b5ff)[_0x193f('0x30')](_0x35ae08);};}exports[_0x193f('0x31')]=function(_0x372063,_0x4484f0){var _0x535d29={},_0x20f7f4={},_0x19b2b7={'count':0x0,'rows':[]};var _0x46fbec=_[_0x193f('0x32')](db[_0x193f('0x33')][_0x193f('0x34')],function(_0x171eb5){return{'name':_0x171eb5[_0x193f('0x35')],'type':_0x171eb5[_0x193f('0x36')][_0x193f('0x37')]};});_0x20f7f4[_0x193f('0x38')]=_[_0x193f('0x32')](_0x46fbec,_0x193f('0x2f'));_0x20f7f4[_0x193f('0x39')]=_[_0x193f('0x3a')](_0x372063[_0x193f('0x39')]);_0x20f7f4['filters']=_[_0x193f('0x3b')](_0x20f7f4[_0x193f('0x38')],_0x20f7f4['query']);_0x535d29['attributes']=_[_0x193f('0x3b')](_0x20f7f4[_0x193f('0x38')],qs[_0x193f('0x3c')](_0x372063[_0x193f('0x39')][_0x193f('0x3c')]));_0x535d29[_0x193f('0x3d')]=_0x535d29[_0x193f('0x3d')][_0x193f('0x3e')]?_0x535d29['attributes']:_0x20f7f4[_0x193f('0x38')];if(!_0x372063[_0x193f('0x39')][_0x193f('0x3f')](_0x193f('0x40'))){_0x535d29[_0x193f('0x41')]=qs[_0x193f('0x41')](_0x372063[_0x193f('0x39')]['limit']);_0x535d29[_0x193f('0x24')]=qs[_0x193f('0x24')](_0x372063[_0x193f('0x39')][_0x193f('0x24')]);}_0x535d29['order']=qs[_0x193f('0x42')](_0x372063[_0x193f('0x39')][_0x193f('0x42')]);_0x535d29[_0x193f('0x43')]=qs['filters'](_[_0x193f('0x44')](_0x372063[_0x193f('0x39')],_0x20f7f4[_0x193f('0x45')]),_0x46fbec);if(_0x372063[_0x193f('0x39')]['filter']){_0x535d29['where']=_[_0x193f('0x46')](_0x535d29[_0x193f('0x43')],{'$or':_[_0x193f('0x32')](_0x46fbec,function(_0x4a8db0){if(_0x4a8db0[_0x193f('0x36')]!=='VIRTUAL'){var _0x5ab2a3={};_0x5ab2a3[_0x4a8db0['name']]={'$like':'%'+_0x372063[_0x193f('0x39')][_0x193f('0x47')]+'%'};return _0x5ab2a3;}})});}_0x535d29=_[_0x193f('0x46')]({},_0x535d29,_0x372063[_0x193f('0x48')]);var _0x3a7cb1={'where':_0x535d29[_0x193f('0x43')]};return db[_0x193f('0x33')][_0x193f('0x26')](_0x3a7cb1)['then'](function(_0x3126ca){_0x19b2b7[_0x193f('0x26')]=_0x3126ca;if(_0x372063['query'][_0x193f('0x49')]){_0x535d29[_0x193f('0x4a')]=[{'all':!![]}];}return db[_0x193f('0x33')][_0x193f('0x4b')](_0x535d29);})['then'](function(_0x52c53c){_0x19b2b7[_0x193f('0x4c')]=_0x52c53c;return _0x19b2b7;})[_0x193f('0x2b')](respondWithFilteredResult(_0x4484f0,_0x535d29))[_0x193f('0x4d')](handleError(_0x4484f0,null));};exports[_0x193f('0x4e')]=function(_0x2d8cf8,_0x14fc5d){var _0x2d50dc={'raw':!![],'where':{'id':_0x2d8cf8[_0x193f('0x4f')]['id']}},_0x5385b6={};_0x5385b6[_0x193f('0x38')]=_[_0x193f('0x3a')](db['MailQueue'][_0x193f('0x34')]);_0x5385b6[_0x193f('0x39')]=_[_0x193f('0x3a')](_0x2d8cf8[_0x193f('0x39')]);_0x5385b6['filters']=_['intersection'](_0x5385b6['model'],_0x5385b6['query']);_0x2d50dc['attributes']=_['intersection'](_0x5385b6['model'],qs[_0x193f('0x3c')](_0x2d8cf8['query'][_0x193f('0x3c')]));_0x2d50dc[_0x193f('0x3d')]=_0x2d50dc[_0x193f('0x3d')]['length']?_0x2d50dc[_0x193f('0x3d')]:_0x5385b6[_0x193f('0x38')];if(_0x2d8cf8[_0x193f('0x39')][_0x193f('0x49')]){_0x2d50dc[_0x193f('0x4a')]=[{'all':!![]}];}_0x2d50dc=_[_0x193f('0x46')]({},_0x2d50dc,_0x2d8cf8[_0x193f('0x48')]);return db[_0x193f('0x33')][_0x193f('0x50')](_0x2d50dc)[_0x193f('0x2b')](handleEntityNotFound(_0x14fc5d,null))['then'](respondWithResult(_0x14fc5d,null))['catch'](handleError(_0x14fc5d,null));};exports[_0x193f('0x51')]=function(_0x36015d,_0x1b75bd){return db['MailQueue'][_0x193f('0x51')](_0x36015d[_0x193f('0x52')],{})['then'](function(_0xf83089){var _0x15170c=_0x36015d[_0x193f('0x53')][_0x193f('0x54')]({'plain':!![]});if(!_0x15170c)throw new Error(_0x193f('0x55'));if(_0x15170c[_0x193f('0x56')]===_0x193f('0x53')){var _0x2bb453=_0xf83089[_0x193f('0x54')]({'plain':!![]});var _0x2f3cf8=_0x193f('0x57');return db[_0x193f('0x58')][_0x193f('0x50')]({'where':{'name':_0x2f3cf8,'userProfileId':_0x15170c[_0x193f('0x59')]},'raw':!![]})['then'](function(_0x5f5ac9){if(_0x5f5ac9&&_0x5f5ac9[_0x193f('0x5a')]===0x0){return db[_0x193f('0x2d')]['create']({'name':_0x2bb453[_0x193f('0x2f')],'resourceId':_0x2bb453['id'],'type':_0x5f5ac9[_0x193f('0x2f')],'sectionId':_0x5f5ac9['id']},{})[_0x193f('0x2b')](function(){return _0xf83089;});}else{return _0xf83089;}})[_0x193f('0x4d')](function(_0x705413){logger['error'](_0x193f('0x5b'),_0x705413);throw _0x705413;});}return _0xf83089;})[_0x193f('0x2b')](respondWithResult(_0x1b75bd,0xc9))[_0x193f('0x4d')](handleError(_0x1b75bd,null));};exports[_0x193f('0x2a')]=function(_0x1a541f,_0xd1541f){if(_0x1a541f['body']['id']){delete _0x1a541f['body']['id'];}return db[_0x193f('0x33')][_0x193f('0x50')]({'where':{'id':_0x1a541f[_0x193f('0x4f')]['id']}})[_0x193f('0x2b')](handleEntityNotFound(_0xd1541f,null))['then'](saveUpdates(_0x1a541f[_0x193f('0x52')],null))[_0x193f('0x2b')](respondWithResult(_0xd1541f,null))[_0x193f('0x4d')](handleError(_0xd1541f,null));};exports[_0x193f('0x2c')]=function(_0x21b40f,_0x22f151){return db['MailQueue'][_0x193f('0x50')]({'where':{'id':_0x21b40f[_0x193f('0x4f')]['id']}})[_0x193f('0x2b')](handleEntityNotFound(_0x22f151,null))[_0x193f('0x2b')](removeEntity(_0x22f151,null))[_0x193f('0x4d')](handleError(_0x22f151,null));};exports[_0x193f('0x5c')]=function(_0x321eb2,_0x36a989){return db[_0x193f('0x33')][_0x193f('0x5c')]()[_0x193f('0x2b')](respondWithResult(_0x36a989,null))[_0x193f('0x4d')](handleError(_0x36a989,null));};exports['getMembers']=function(_0x277a55,_0x4aa0b7,_0x26bc44){var _0x388736={'raw':!![],'where':{}},_0x36ea0b={},_0x449f3d;return db['MailQueue'][_0x193f('0x5d')]({'where':{'id':_0x277a55[_0x193f('0x4f')]['id']}})[_0x193f('0x2b')](handleEntityNotFound(_0x4aa0b7,null))[_0x193f('0x2b')](function(_0x3c2bf8){if(_0x3c2bf8){_0x449f3d=_0x3c2bf8[_0x193f('0x54')]({'plain':!![]});_0x36ea0b[_0x193f('0x38')]=_[_0x193f('0x3a')](db['UserMailQueue'][_0x193f('0x34')]);_0x36ea0b[_0x193f('0x39')]=_[_0x193f('0x3a')](_0x277a55[_0x193f('0x39')]);_0x36ea0b[_0x193f('0x45')]=_[_0x193f('0x3b')](_0x36ea0b['model'],_0x36ea0b[_0x193f('0x39')]);_0x388736['attributes']=_['intersection'](_0x36ea0b[_0x193f('0x38')],qs[_0x193f('0x3c')](_0x277a55[_0x193f('0x39')][_0x193f('0x3c')]));_0x388736[_0x193f('0x3d')]=_0x388736[_0x193f('0x3d')][_0x193f('0x3e')]?_0x388736['attributes']:_0x36ea0b['model'];if(!_0x277a55['query'][_0x193f('0x3f')]('nolimit')){_0x388736[_0x193f('0x41')]=qs[_0x193f('0x41')](_0x277a55[_0x193f('0x39')][_0x193f('0x41')]);_0x388736[_0x193f('0x24')]=qs[_0x193f('0x24')](_0x277a55[_0x193f('0x39')][_0x193f('0x24')]);}_0x388736[_0x193f('0x5e')]=qs[_0x193f('0x42')](_0x277a55[_0x193f('0x39')][_0x193f('0x42')]);_0x388736[_0x193f('0x43')]=qs[_0x193f('0x45')](_[_0x193f('0x44')](_0x277a55[_0x193f('0x39')],_0x36ea0b[_0x193f('0x45')]));_0x388736[_0x193f('0x43')][_0x193f('0x5f')]=_0x3c2bf8['id'];if(_0x277a55['query'][_0x193f('0x47')]){_0x388736[_0x193f('0x43')]=_[_0x193f('0x46')](_0x388736[_0x193f('0x43')],{'$or':_[_0x193f('0x32')](_0x388736[_0x193f('0x3d')],function(_0x1efbb8){var _0x4bf4fb={};_0x4bf4fb[_0x1efbb8]={'$like':'%'+_0x277a55[_0x193f('0x39')][_0x193f('0x47')]+'%'};return _0x4bf4fb;})});}_0x388736=_[_0x193f('0x46')]({},_0x388736,_0x277a55[_0x193f('0x48')]);return db[_0x193f('0x60')][_0x193f('0x4b')](_0x388736);}})[_0x193f('0x2b')](function(_0x5c332d){if(_0x5c332d){return db[_0x193f('0x61')][_0x193f('0x62')]({'where':{'id':_[_0x193f('0x32')](_0x5c332d,_0x193f('0x63')),'role':_0x193f('0x64')},'attributes':['id',_0x193f('0x2f'),_0x193f('0x65'),_0x193f('0x66'),_0x193f('0x67')]});}})[_0x193f('0x2b')](function(_0x2fcc0e){if(_0x2fcc0e){return{'count':_0x2fcc0e['count'],'rows':_[_0x193f('0x32')](_0x2fcc0e[_0x193f('0x4c')],function(_0x43da92){return{'membername':_0x43da92[_0x193f('0x2f')],'UserId':_0x43da92['id'],'queue_name':_0x449f3d[_0x193f('0x2f')],'MailQueueId':_0x449f3d['id'],'interface':util[_0x193f('0x68')](_0x193f('0x69'),_0x193f('0x6a'),_0x43da92[_0x193f('0x2f')]),'penalty':0x0,'paused':_0x43da92['mailPause'],'createdAt':_0x43da92['createdAt'],'updatedAt':_0x43da92[_0x193f('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x193f('0x2b')](respondWithFilteredResult(_0x4aa0b7,_0x388736))[_0x193f('0x4d')](handleError(_0x4aa0b7,null));};exports[_0x193f('0x6b')]=function(_0x3cf829,_0x1a6d6e,_0x56562b){var _0x66074a={};var _0x12fd8d={};var _0x2f5f72;var _0x7c8336;return db[_0x193f('0x33')][_0x193f('0x5d')]({'where':{'id':_0x3cf829['params']['id']}})['then'](handleEntityNotFound(_0x1a6d6e,null))[_0x193f('0x2b')](function(_0x569d56){if(_0x569d56){_0x2f5f72=_0x569d56;_0x12fd8d[_0x193f('0x38')]=_[_0x193f('0x3a')](db[_0x193f('0x6c')][_0x193f('0x34')]);_0x12fd8d[_0x193f('0x39')]=_['keys'](_0x3cf829[_0x193f('0x39')]);_0x12fd8d['filters']=_['intersection'](_0x12fd8d[_0x193f('0x38')],_0x12fd8d[_0x193f('0x39')]);_0x66074a[_0x193f('0x3d')]=_[_0x193f('0x3b')](_0x12fd8d[_0x193f('0x38')],qs[_0x193f('0x3c')](_0x3cf829[_0x193f('0x39')][_0x193f('0x3c')]));_0x66074a['attributes']=_0x66074a[_0x193f('0x3d')][_0x193f('0x3e')]?_0x66074a['attributes']:_0x12fd8d['model'];_0x66074a['order']=qs[_0x193f('0x42')](_0x3cf829[_0x193f('0x39')][_0x193f('0x42')]);_0x66074a[_0x193f('0x43')]=qs[_0x193f('0x45')](_[_0x193f('0x44')](_0x3cf829[_0x193f('0x39')],_0x12fd8d[_0x193f('0x45')]));if(_0x3cf829[_0x193f('0x39')][_0x193f('0x47')]){_0x66074a[_0x193f('0x43')]=_[_0x193f('0x46')](_0x66074a[_0x193f('0x43')],{'$or':_[_0x193f('0x32')](_0x66074a[_0x193f('0x3d')],function(_0x318d39){var _0x14a65c={};_0x14a65c[_0x318d39]={'$like':'%'+_0x3cf829['query'][_0x193f('0x47')]+'%'};return _0x14a65c;})});}_0x66074a=_[_0x193f('0x46')]({},_0x66074a,_0x3cf829[_0x193f('0x48')]);return _0x2f5f72[_0x193f('0x6b')](_0x66074a);}})[_0x193f('0x2b')](function(_0x146e71){if(_0x146e71){_0x7c8336=_0x146e71[_0x193f('0x3e')];if(!_0x3cf829['query'][_0x193f('0x3f')](_0x193f('0x40'))){_0x66074a[_0x193f('0x41')]=qs['limit'](_0x3cf829['query'][_0x193f('0x41')]);_0x66074a[_0x193f('0x24')]=qs[_0x193f('0x24')](_0x3cf829[_0x193f('0x39')][_0x193f('0x24')]);}return _0x2f5f72[_0x193f('0x6b')](_0x66074a);}})['then'](function(_0x3bc6cb){if(_0x3bc6cb){return _0x3bc6cb?{'count':_0x7c8336,'rows':_0x3bc6cb}:null;}})[_0x193f('0x2b')](respondWithResult(_0x1a6d6e,null))[_0x193f('0x4d')](handleError(_0x1a6d6e,null));};exports[_0x193f('0x6d')]=function(_0x45d571,_0x26347,_0x402660){var _0x45320e=_0x45d571['body']['ids'];return db['Team'][_0x193f('0x4b')]({'where':{'id':_0x45320e},'attributes':['id'],'include':[{'model':db['User'],'as':_0x193f('0x6e'),'attributes':['id','name',_0x193f('0x6f'),_0x193f('0x70'),'interface'],'raw':!![]}]})[_0x193f('0x2b')](function(_0xdd162f){if(_0xdd162f){var _0x35478e=_['flatMap'](_0xdd162f,function(_0x157f3e){var _0x47509b=_0x157f3e[_0x193f('0x54')]({'plain':!![]});return _0x47509b[_0x193f('0x6e')];});return db['MailQueue']['find']({'where':{'id':_0x45d571['params']['id']}})[_0x193f('0x2b')](function(_0x2ad604){return db[_0x193f('0x71')]['transaction'](function(_0x5f4541){return _0x2ad604[_0x193f('0x6d')](_0x45320e,{'transaction':_0x5f4541})[_0x193f('0x2b')](function(){return BPromise['each'](_0x35478e,function(_0x2ee2e7){return db['UserMailQueue'][_0x193f('0x72')]({'where':{'UserId':_0x2ee2e7['id'],'MailQueueId':_0x45d571[_0x193f('0x4f')]['id']},'transaction':_0x5f4541});});})['then'](function(){_0x35478e[_0x193f('0x73')](function(_0x165166){socket['emit']('userMailQueue:save',{'UserId':_0x165166['id'],'MailQueueId':_0x2ad604['id']});});});});});}})['then'](respondWithStatusCode(_0x26347,null))[_0x193f('0x4d')](handleError(_0x26347,null));};exports[_0x193f('0x74')]=function(_0x3d7662,_0x1b5ec3,_0x243f80){return db['Team']['findAll']({'where':{'id':_0x3d7662[_0x193f('0x39')][_0x193f('0x75')]},'attributes':['id'],'include':[{'model':db[_0x193f('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x193f('0x2b')](handleEntityNotFound(_0x1b5ec3,null))[_0x193f('0x2b')](function(_0xea7f63){var _0x14fbb0=_[_0x193f('0x32')](_0xea7f63,'id');var _0x40e72a=[];var _0xba374f=[];var _0x12099a=squel[_0x193f('0x76')]();_0x12099a['field'](_0x193f('0x77'))[_0x193f('0x78')](_0x193f('0x79'),'tq')[_0x193f('0x7a')]('user_has_teams','ut',_0x193f('0x7b'))[_0x193f('0x43')]('MailQueueId\x20=\x20?',_0x3d7662[_0x193f('0x4f')]['id']);for(var _0x48ca4b=0x0;_0x48ca4b<_0xea7f63['length'];_0x48ca4b+=0x1){let _0x3f939c=_0xea7f63[_0x48ca4b];for(var _0x37deec=0x0;_0x37deec<_0x3f939c['Agents'][_0x193f('0x3e')];_0x37deec+=0x1){let _0x5c3711=_0x3f939c[_0x193f('0x6e')][_0x37deec];var _0x547ed6=_0x12099a['clone']();_0x547ed6['where']('ut.UserId\x20=\x20?',_0x5c3711['id']);_0xba374f[_0x193f('0x7c')](db[_0x193f('0x71')]['query'](_0x547ed6[_0x193f('0x7d')](),{'type':db[_0x193f('0x71')][_0x193f('0x7e')][_0x193f('0x7f')]})[_0x193f('0x2b')](function(_0x515242){if(_0x515242[_0x193f('0x3e')]===0x1){return _0x5c3711['id'];}else{var _0x1a44db=_[_0x193f('0x80')](_['map'](_0x515242,_0x193f('0x81')),function(_0x7f812){return _[_0x193f('0x82')](_0x14fbb0,_0x7f812);});if(_0x1a44db){return _0x5c3711['id'];}}}));}}return BPromise[_0x193f('0x83')](_0xba374f)[_0x193f('0x2b')](function(_0x38c28e){_0x40e72a=_(_0x40e72a)['union'](_0x38c28e)[_0x193f('0x84')]()[_0x193f('0x85')]();return db[_0x193f('0x33')][_0x193f('0x50')]({'where':{'id':_0x3d7662[_0x193f('0x4f')]['id']}})['then'](function(_0x39ef48){return db[_0x193f('0x71')]['transaction'](function(_0x56b157){return _0x39ef48[_0x193f('0x74')](_0x3d7662[_0x193f('0x39')][_0x193f('0x75')],{'transaction':_0x56b157})[_0x193f('0x2b')](function(){if(!_['isEmpty'](_0x40e72a)){return _0x39ef48[_0x193f('0x86')](_0x40e72a,{'transaction':_0x56b157});}})['then'](function(){_0x40e72a[_0x193f('0x73')](function(_0x5a52f5){socket[_0x193f('0x87')](_0x193f('0x88'),{'UserId':_0x5a52f5,'MailQueueId':_0x39ef48['id']});});});});});});})['then'](respondWithStatusCode(_0x1b5ec3,null))[_0x193f('0x4d')](handleError(_0x1b5ec3,null));};exports[_0x193f('0x89')]=function(_0x5be67a,_0x2632e1,_0x1189b3){return db[_0x193f('0x33')]['find']({'where':{'id':_0x5be67a[_0x193f('0x4f')]['id']}})[_0x193f('0x2b')](handleEntityNotFound(_0x2632e1,null))[_0x193f('0x2b')](function(_0x1d550e){if(_0x1d550e){return _0x1d550e[_0x193f('0x89')](_0x5be67a[_0x193f('0x52')]['ids'],_[_0x193f('0x8a')](_0x5be67a[_0x193f('0x52')],[_0x193f('0x75'),'id'])||{})[_0x193f('0x8b')](function(_0x1af8ff){for(var _0x4edd93=0x0;_0x4edd93<_0x5be67a['body'][_0x193f('0x75')][_0x193f('0x3e')];_0x4edd93+=0x1){socket[_0x193f('0x87')](_0x193f('0x8c'),{'UserId':Number(_0x5be67a[_0x193f('0x52')]['ids'][_0x4edd93]),'MailQueueId':Number(_0x5be67a[_0x193f('0x4f')]['id'])});}return _0x1af8ff;});}})[_0x193f('0x2b')](respondWithResult(_0x2632e1,null))[_0x193f('0x4d')](handleError(_0x2632e1,null));};exports[_0x193f('0x86')]=function(_0xeef492,_0x20c609,_0x17739e){return db['MailQueue'][_0x193f('0x50')]({'where':{'id':_0xeef492[_0x193f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x20c609,null))[_0x193f('0x2b')](function(_0x2a4f3a){if(_0x2a4f3a){return _0x2a4f3a[_0x193f('0x86')](_0xeef492[_0x193f('0x39')]['ids'])[_0x193f('0x2b')](function(){if(_[_0x193f('0x8d')](_0xeef492[_0x193f('0x39')][_0x193f('0x75')])){for(var _0x3e1a78=0x0;_0x3e1a78<_0xeef492[_0x193f('0x39')][_0x193f('0x75')]['length'];_0x3e1a78+=0x1){socket[_0x193f('0x87')](_0x193f('0x88'),{'UserId':Number(_0xeef492[_0x193f('0x39')]['ids'][_0x3e1a78]),'MailQueueId':Number(_0xeef492[_0x193f('0x4f')]['id'])});}}else{socket[_0x193f('0x87')]('userMailQueue:remove',{'UserId':Number(_0xeef492['query'][_0x193f('0x75')]),'MailQueueId':Number(_0xeef492['params']['id'])});}});}})['then'](respondWithStatusCode(_0x20c609,null))['catch'](handleError(_0x20c609,null));};exports['getAgents']=function(_0x2d0708,_0x3ab67b,_0x4da45a){var _0x42f28={};var _0x463aaa={};var _0x3e7c64;var _0x117edf;return db[_0x193f('0x33')][_0x193f('0x5d')]({'where':{'id':_0x2d0708[_0x193f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3ab67b,null))[_0x193f('0x2b')](function(_0x21b6f9){if(_0x21b6f9){_0x3e7c64=_0x21b6f9;_0x463aaa['model']=_['keys'](db[_0x193f('0x61')][_0x193f('0x34')]);_0x463aaa[_0x193f('0x39')]=_[_0x193f('0x3a')](_0x2d0708['query']);_0x463aaa[_0x193f('0x45')]=_[_0x193f('0x3b')](_0x463aaa['model'],_0x463aaa[_0x193f('0x39')]);_0x42f28[_0x193f('0x3d')]=_['intersection'](_0x463aaa['model'],qs['fields'](_0x2d0708[_0x193f('0x39')][_0x193f('0x3c')]));_0x42f28['attributes']=_0x42f28[_0x193f('0x3d')][_0x193f('0x3e')]?_0x42f28[_0x193f('0x3d')]:_0x463aaa[_0x193f('0x38')];_0x42f28[_0x193f('0x5e')]=qs[_0x193f('0x42')](_0x2d0708[_0x193f('0x39')][_0x193f('0x42')]);_0x42f28[_0x193f('0x43')]=qs[_0x193f('0x45')](_['pick'](_0x2d0708[_0x193f('0x39')],_0x463aaa[_0x193f('0x45')]));if(_0x2d0708[_0x193f('0x39')][_0x193f('0x47')]){_0x42f28[_0x193f('0x43')]=_[_0x193f('0x46')](_0x42f28[_0x193f('0x43')],{'$or':_[_0x193f('0x32')](_0x42f28['attributes'],function(_0x1ebf44){var _0x1b5dc7={};_0x1b5dc7[_0x1ebf44]={'$like':'%'+_0x2d0708[_0x193f('0x39')]['filter']+'%'};return _0x1b5dc7;})});}_0x42f28=_[_0x193f('0x46')]({},_0x42f28,_0x2d0708[_0x193f('0x48')]);return _0x3e7c64[_0x193f('0x8e')](_0x42f28);}})[_0x193f('0x2b')](function(_0x5a0afb){if(_0x5a0afb){_0x117edf=_0x5a0afb[_0x193f('0x3e')];if(!_0x2d0708[_0x193f('0x39')][_0x193f('0x3f')](_0x193f('0x40'))){_0x42f28[_0x193f('0x41')]=qs[_0x193f('0x41')](_0x2d0708['query'][_0x193f('0x41')]);_0x42f28[_0x193f('0x24')]=qs[_0x193f('0x24')](_0x2d0708[_0x193f('0x39')]['offset']);}return _0x3e7c64[_0x193f('0x8e')](_0x42f28);}})[_0x193f('0x2b')](function(_0x11815a){if(_0x11815a){return _0x11815a?{'count':_0x117edf,'rows':_0x11815a}:null;}})[_0x193f('0x2b')](respondWithResult(_0x3ab67b,null))['catch'](handleError(_0x3ab67b,null));};
\ No newline at end of file
index 328b361..929e453 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4ffc=['MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2d418a,_0x1030b0){var _0x524548=function(_0x5e7ecb){while(--_0x5e7ecb){_0x2d418a['push'](_0x2d418a['shift']());}};_0x524548(++_0x1030b0);}(_0x4ffc,0x1b7));var _0xc4ff=function(_0x3520ba,_0xc58574){_0x3520ba=_0x3520ba-0x0;var _0x426c08=_0x4ffc[_0x3520ba];return _0x426c08;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xc4ff('0x0'))['db'][_0xc4ff('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xc4ff('0x2')](0x0);var events={'afterCreate':_0xc4ff('0x3'),'afterUpdate':_0xc4ff('0x4'),'afterDestroy':_0xc4ff('0x5')};function emitEvent(_0x10dc3a){return function(_0x312f6a,_0x78678b,_0x1763d4){MailQueueEvents[_0xc4ff('0x6')](_0x10dc3a+':'+_0x312f6a['id'],_0x312f6a);MailQueueEvents[_0xc4ff('0x6')](_0x10dc3a,_0x312f6a);_0x1763d4(null);};}for(var e in events){if(events[_0xc4ff('0x7')](e)){var event=events[e];MailQueue[_0xc4ff('0x8')](e,emitEvent(event));}}module[_0xc4ff('0x9')]=MailQueueEvents;
\ No newline at end of file
+var _0xfe1f=['emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue','setMaxListeners','update','remove'];(function(_0x108bda,_0x53f7ad){var _0x4ccd07=function(_0x5cf516){while(--_0x5cf516){_0x108bda['push'](_0x108bda['shift']());}};_0x4ccd07(++_0x53f7ad);}(_0xfe1f,0x8a));var _0xffe1=function(_0x4d05dd,_0x258cdd){_0x4d05dd=_0x4d05dd-0x0;var _0x1c5226=_0xfe1f[_0x4d05dd];return _0x1c5226;};'use strict';var EventEmitter=require(_0xffe1('0x0'));var MailQueue=require(_0xffe1('0x1'))['db'][_0xffe1('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xffe1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xffe1('0x4'),'afterDestroy':_0xffe1('0x5')};function emitEvent(_0x58f3a8){return function(_0x91a78,_0x3bcd78,_0x31f127){MailQueueEvents[_0xffe1('0x6')](_0x58f3a8+':'+_0x91a78['id'],_0x91a78);MailQueueEvents['emit'](_0x58f3a8,_0x91a78);_0x31f127(null);};}for(var e in events){if(events[_0xffe1('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xffe1('0x8')]=MailQueueEvents;
\ No newline at end of file
index ecc3820..4b3d379 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x378d=['define','mail_queues','lodash','api','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x378d,0x160));var _0xd378=function(_0x16d32b,_0x1e1e3e){_0x16d32b=_0x16d32b-0x0;var _0x4fa804=_0x378d[_0x16d32b];return _0x4fa804;};'use strict';var _=require(_0xd378('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd378('0x1'));var moment=require('moment');var BPromise=require(_0xd378('0x2'));var rp=require(_0xd378('0x3'));var fs=require('fs');var path=require(_0xd378('0x4'));var rimraf=require('rimraf');var config=require(_0xd378('0x5'));var attributes=require(_0xd378('0x6'));module[_0xd378('0x7')]=function(_0x5af975,_0x436aa3){return _0x5af975[_0xd378('0x8')]('MailQueue',attributes,{'tableName':_0xd378('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x1a7f=['./mailQueue.attributes','define','MailQueue','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x6685e2,_0x520076){var _0x3d0584=function(_0xa89569){while(--_0xa89569){_0x6685e2['push'](_0x6685e2['shift']());}};_0x3d0584(++_0x520076);}(_0x1a7f,0x12f));var _0xf1a7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1a7f[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf1a7('0x0'));var util=require(_0xf1a7('0x1'));var logger=require(_0xf1a7('0x2'))('api');var moment=require(_0xf1a7('0x3'));var BPromise=require(_0xf1a7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1a7('0x5'));var rimraf=require('rimraf');var config=require(_0xf1a7('0x6'));var attributes=require(_0xf1a7('0x7'));module['exports']=function(_0x3155bd,_0x563787){return _0x3155bd[_0xf1a7('0x8')](_0xf1a7('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2611117..34d07a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2179=['request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','map','model','ShowMailQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2179,0xc0));var _0x9217=function(_0x1ba19c,_0x3975e2){_0x1ba19c=_0x1ba19c-0x0;var _0x4e069b=_0x2179[_0x1ba19c];return _0x4e069b;};'use strict';var _=require(_0x9217('0x0'));var util=require(_0x9217('0x1'));var moment=require(_0x9217('0x2'));var BPromise=require(_0x9217('0x3'));var rs=require(_0x9217('0x4'));var fs=require('fs');var Redis=require(_0x9217('0x5'));var db=require(_0x9217('0x6'))['db'];var utils=require(_0x9217('0x7'));var logger=require(_0x9217('0x8'))(_0x9217('0x9'));var config=require(_0x9217('0xa'));var jayson=require(_0x9217('0xb'));var client=jayson[_0x9217('0xc')][_0x9217('0xd')]({'port':0x232a});config[_0x9217('0xe')]=_['defaults'](config[_0x9217('0xe')],{'host':_0x9217('0xf'),'port':0x18eb});var socket=require(_0x9217('0x10'))(new Redis(config[_0x9217('0xe')]));require(_0x9217('0x11'))['register'](socket);function respondWithRpcPromise(_0x496fb7,_0x25bd97,_0x4fe267){return new BPromise(function(_0x1baed8,_0x3304cb){return client[_0x9217('0x12')](_0x496fb7,_0x4fe267)['then'](function(_0x335c2d){logger[_0x9217('0x13')](_0x9217('0x14'),_0x25bd97,_0x9217('0x15'));logger[_0x9217('0x16')](_0x9217('0x17'),_0x25bd97,_0x9217('0x15'),JSON[_0x9217('0x18')](_0x335c2d));if(_0x335c2d['error']){if(_0x335c2d[_0x9217('0x19')]['code']===0x1f4){logger[_0x9217('0x19')](_0x9217('0x14'),_0x25bd97,_0x335c2d[_0x9217('0x19')][_0x9217('0x1a')]);return _0x3304cb(_0x335c2d[_0x9217('0x19')][_0x9217('0x1a')]);}logger[_0x9217('0x19')](_0x9217('0x14'),_0x25bd97,_0x335c2d[_0x9217('0x19')][_0x9217('0x1a')]);return _0x1baed8(_0x335c2d[_0x9217('0x19')][_0x9217('0x1a')]);}else{logger[_0x9217('0x13')](_0x9217('0x14'),_0x25bd97,_0x9217('0x15'));_0x1baed8(_0x335c2d[_0x9217('0x1b')][_0x9217('0x1a')]);}})[_0x9217('0x1c')](function(_0x2465c7){logger[_0x9217('0x19')](_0x9217('0x14'),_0x25bd97,_0x2465c7);_0x3304cb(_0x2465c7);});});}exports[_0x9217('0x1d')]=function(_0x10498c){var _0x1f5ca6=this;return new Promise(function(_0x3616e1,_0x3af8ab){return db[_0x9217('0x1e')][_0x9217('0x1f')]({'raw':_0x10498c[_0x9217('0x20')]?_0x10498c[_0x9217('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x10498c[_0x9217('0x20')]?_0x10498c[_0x9217('0x20')][_0x9217('0x21')]||null:null,'attributes':_0x10498c[_0x9217('0x20')]?_0x10498c[_0x9217('0x20')][_0x9217('0x22')]||null:null,'limit':_0x10498c['options']?_0x10498c[_0x9217('0x20')][_0x9217('0x23')]||null:null,'include':_0x10498c[_0x9217('0x20')]?_0x10498c['options'][_0x9217('0x24')]?_[_0x9217('0x25')](_0x10498c[_0x9217('0x20')][_0x9217('0x24')],function(_0x41b16c){return{'model':db[_0x41b16c[_0x9217('0x26')]],'as':_0x41b16c['as'],'attributes':_0x41b16c['attributes'],'include':_0x41b16c[_0x9217('0x24')]?_[_0x9217('0x25')](_0x41b16c['include'],function(_0x51bb40){return{'model':db[_0x51bb40['model']],'as':_0x51bb40['as'],'attributes':_0x51bb40[_0x9217('0x22')],'include':_0x51bb40[_0x9217('0x24')]?_[_0x9217('0x25')](_0x51bb40[_0x9217('0x24')],function(_0x52fbf4){return{'model':db[_0x52fbf4[_0x9217('0x26')]],'as':_0x52fbf4['as'],'attributes':_0x52fbf4[_0x9217('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ca793){logger[_0x9217('0x13')](_0x9217('0x1d'),_0x10498c);logger[_0x9217('0x16')](_0x9217('0x1d'),_0x10498c,JSON['stringify'](_0x4ca793));_0x3616e1(_0x4ca793);})['catch'](function(_0x36f752){logger['error'](_0x9217('0x1d'),_0x36f752[_0x9217('0x1a')],_0x10498c);_0x3af8ab(_0x1f5ca6[_0x9217('0x19')](0x1f4,_0x36f752[_0x9217('0x1a')]));});});};exports[_0x9217('0x27')]=function(_0x45175b){var _0x18b1cc=this;return new Promise(function(_0x5b18dd,_0x11e0fc){return db[_0x9217('0x1e')][_0x9217('0x28')]({'raw':_0x45175b['options']?_0x45175b[_0x9217('0x20')][_0x9217('0x29')]===undefined?!![]:![]:!![],'where':_0x45175b['options']?_0x45175b[_0x9217('0x20')]['where']||null:null,'attributes':_0x45175b['options']?_0x45175b[_0x9217('0x20')]['attributes']||null:null,'include':_0x45175b['options']?_0x45175b[_0x9217('0x20')]['include']?_[_0x9217('0x25')](_0x45175b[_0x9217('0x20')][_0x9217('0x24')],function(_0x59ec08){return{'model':db[_0x59ec08[_0x9217('0x26')]],'as':_0x59ec08['as'],'attributes':_0x59ec08[_0x9217('0x22')],'include':_0x59ec08[_0x9217('0x24')]?_['map'](_0x59ec08[_0x9217('0x24')],function(_0x51dfc9){return{'model':db[_0x51dfc9[_0x9217('0x26')]],'as':_0x51dfc9['as'],'attributes':_0x51dfc9[_0x9217('0x22')],'include':_0x51dfc9[_0x9217('0x24')]?_['map'](_0x51dfc9['include'],function(_0x3336a0){return{'model':db[_0x3336a0[_0x9217('0x26')]],'as':_0x3336a0['as'],'attributes':_0x3336a0[_0x9217('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1baa87){logger['info'](_0x9217('0x27'),_0x45175b);logger[_0x9217('0x16')]('ShowMailQueue',_0x45175b,JSON[_0x9217('0x18')](_0x1baa87));_0x5b18dd(_0x1baa87);})['catch'](function(_0x179f90){logger[_0x9217('0x19')](_0x9217('0x27'),_0x179f90['message'],_0x45175b);_0x11e0fc(_0x18b1cc[_0x9217('0x19')](0x1f4,_0x179f90[_0x9217('0x1a')]));});});};
\ No newline at end of file
+var _0x9434=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetMailQueue','ShowMailQueue','MailQueue','find','lodash','moment','randomstring','ioredis'];(function(_0x2ca9eb,_0x359799){var _0x374cad=function(_0xc2ddb7){while(--_0xc2ddb7){_0x2ca9eb['push'](_0x2ca9eb['shift']());}};_0x374cad(++_0x359799);}(_0x9434,0x74));var _0x4943=function(_0x30a8ff,_0x1b93c1){_0x30a8ff=_0x30a8ff-0x0;var _0x3b73e8=_0x9434[_0x30a8ff];return _0x3b73e8;};'use strict';var _=require(_0x4943('0x0'));var util=require('util');var moment=require(_0x4943('0x1'));var BPromise=require('bluebird');var rs=require(_0x4943('0x2'));var fs=require('fs');var Redis=require(_0x4943('0x3'));var db=require(_0x4943('0x4'))['db'];var utils=require(_0x4943('0x5'));var logger=require(_0x4943('0x6'))(_0x4943('0x7'));var config=require(_0x4943('0x8'));var jayson=require(_0x4943('0x9'));var client=jayson[_0x4943('0xa')][_0x4943('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4943('0xc')],{'host':_0x4943('0xd'),'port':0x18eb});var socket=require(_0x4943('0xe'))(new Redis(config[_0x4943('0xc')]));require(_0x4943('0xf'))[_0x4943('0x10')](socket);function respondWithRpcPromise(_0x21ca4e,_0x52d0a2,_0x25bb1b){return new BPromise(function(_0xd5834b,_0x1f3d6f){return client[_0x4943('0x11')](_0x21ca4e,_0x25bb1b)['then'](function(_0x20da55){logger[_0x4943('0x12')](_0x4943('0x13'),_0x52d0a2,_0x4943('0x14'));logger[_0x4943('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x52d0a2,_0x4943('0x14'),JSON[_0x4943('0x16')](_0x20da55));if(_0x20da55[_0x4943('0x17')]){if(_0x20da55['error']['code']===0x1f4){logger[_0x4943('0x17')]('MailQueue,\x20%s,\x20%s',_0x52d0a2,_0x20da55[_0x4943('0x17')]['message']);return _0x1f3d6f(_0x20da55[_0x4943('0x17')][_0x4943('0x18')]);}logger[_0x4943('0x17')](_0x4943('0x13'),_0x52d0a2,_0x20da55[_0x4943('0x17')][_0x4943('0x18')]);return _0xd5834b(_0x20da55[_0x4943('0x17')][_0x4943('0x18')]);}else{logger[_0x4943('0x12')](_0x4943('0x13'),_0x52d0a2,_0x4943('0x14'));_0xd5834b(_0x20da55['result'][_0x4943('0x18')]);}})[_0x4943('0x19')](function(_0x4446c7){logger['error'](_0x4943('0x13'),_0x52d0a2,_0x4446c7);_0x1f3d6f(_0x4446c7);});});}exports['GetMailQueue']=function(_0x34c8b6){var _0x4d0985=this;return new Promise(function(_0x28dec3,_0x199f76){return db['MailQueue'][_0x4943('0x1a')]({'raw':_0x34c8b6[_0x4943('0x1b')]?_0x34c8b6[_0x4943('0x1b')][_0x4943('0x1c')]===undefined?!![]:![]:!![],'where':_0x34c8b6[_0x4943('0x1b')]?_0x34c8b6[_0x4943('0x1b')][_0x4943('0x1d')]||null:null,'attributes':_0x34c8b6['options']?_0x34c8b6[_0x4943('0x1b')][_0x4943('0x1e')]||null:null,'limit':_0x34c8b6['options']?_0x34c8b6[_0x4943('0x1b')][_0x4943('0x1f')]||null:null,'include':_0x34c8b6[_0x4943('0x1b')]?_0x34c8b6[_0x4943('0x1b')][_0x4943('0x20')]?_[_0x4943('0x21')](_0x34c8b6[_0x4943('0x1b')][_0x4943('0x20')],function(_0x338c97){return{'model':db[_0x338c97[_0x4943('0x22')]],'as':_0x338c97['as'],'attributes':_0x338c97['attributes'],'include':_0x338c97[_0x4943('0x20')]?_[_0x4943('0x21')](_0x338c97[_0x4943('0x20')],function(_0x5c074f){return{'model':db[_0x5c074f['model']],'as':_0x5c074f['as'],'attributes':_0x5c074f['attributes'],'include':_0x5c074f[_0x4943('0x20')]?_[_0x4943('0x21')](_0x5c074f['include'],function(_0x2e4b1a){return{'model':db[_0x2e4b1a[_0x4943('0x22')]],'as':_0x2e4b1a['as'],'attributes':_0x2e4b1a[_0x4943('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4943('0x23')](function(_0x757991){logger['info'](_0x4943('0x24'),_0x34c8b6);logger[_0x4943('0x15')](_0x4943('0x24'),_0x34c8b6,JSON[_0x4943('0x16')](_0x757991));_0x28dec3(_0x757991);})['catch'](function(_0x5ac3c7){logger[_0x4943('0x17')](_0x4943('0x24'),_0x5ac3c7[_0x4943('0x18')],_0x34c8b6);_0x199f76(_0x4d0985[_0x4943('0x17')](0x1f4,_0x5ac3c7[_0x4943('0x18')]));});});};exports[_0x4943('0x25')]=function(_0x49c6df){var _0xc5ce59=this;return new Promise(function(_0x2acf69,_0x5702ad){return db[_0x4943('0x26')][_0x4943('0x27')]({'raw':_0x49c6df[_0x4943('0x1b')]?_0x49c6df['options'][_0x4943('0x1c')]===undefined?!![]:![]:!![],'where':_0x49c6df[_0x4943('0x1b')]?_0x49c6df[_0x4943('0x1b')][_0x4943('0x1d')]||null:null,'attributes':_0x49c6df[_0x4943('0x1b')]?_0x49c6df[_0x4943('0x1b')]['attributes']||null:null,'include':_0x49c6df[_0x4943('0x1b')]?_0x49c6df[_0x4943('0x1b')][_0x4943('0x20')]?_['map'](_0x49c6df['options'][_0x4943('0x20')],function(_0x64c93d){return{'model':db[_0x64c93d[_0x4943('0x22')]],'as':_0x64c93d['as'],'attributes':_0x64c93d[_0x4943('0x1e')],'include':_0x64c93d[_0x4943('0x20')]?_[_0x4943('0x21')](_0x64c93d['include'],function(_0x4dc970){return{'model':db[_0x4dc970[_0x4943('0x22')]],'as':_0x4dc970['as'],'attributes':_0x4dc970['attributes'],'include':_0x4dc970[_0x4943('0x20')]?_[_0x4943('0x21')](_0x4dc970['include'],function(_0x183f1c){return{'model':db[_0x183f1c[_0x4943('0x22')]],'as':_0x183f1c['as'],'attributes':_0x183f1c[_0x4943('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4943('0x23')](function(_0x1f9214){logger[_0x4943('0x12')](_0x4943('0x25'),_0x49c6df);logger[_0x4943('0x15')](_0x4943('0x25'),_0x49c6df,JSON['stringify'](_0x1f9214));_0x2acf69(_0x1f9214);})[_0x4943('0x19')](function(_0x45168c){logger[_0x4943('0x17')](_0x4943('0x25'),_0x45168c[_0x4943('0x18')],_0x49c6df);_0x5702ad(_0xc5ce59[_0x4943('0x17')](0x1f4,_0x45168c['message']));});});};
\ No newline at end of file
index e501695..1dd8cc0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x825f=['register','mailQueue:','save','update','emit','removeListener'];(function(_0x709c8,_0x3de725){var _0x497983=function(_0x42cb10){while(--_0x42cb10){_0x709c8['push'](_0x709c8['shift']());}};_0x497983(++_0x3de725);}(_0x825f,0xbc));var _0xf825=function(_0x239f59,_0x54e3fe){_0x239f59=_0x239f59-0x0;var _0x2bd7b8=_0x825f[_0x239f59];return _0x2bd7b8;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xf825('0x0'),'remove',_0xf825('0x1')];function createListener(_0x10015f,_0x202447){return function(_0x3d1503){_0x202447[_0xf825('0x2')](_0x10015f,_0x3d1503);};}function removeListener(_0x547c2c,_0x4aeafb){return function(){MailQueueEvents[_0xf825('0x3')](_0x547c2c,_0x4aeafb);};}exports[_0xf825('0x4')]=function(_0x365feb){for(var _0x5a87fa=0x0,_0x4a0eae=events['length'];_0x5a87fa<_0x4a0eae;_0x5a87fa++){var _0x3f561b=events[_0x5a87fa];var _0x2be424=createListener(_0xf825('0x5')+_0x3f561b,_0x365feb);MailQueueEvents['on'](_0x3f561b,_0x2be424);}};
\ No newline at end of file
+var _0x0e80=['removeListener','register','mailQueue:','remove','update','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0e80,0x1ad));var _0x00e8=function(_0x403caf,_0x5b31e4){_0x403caf=_0x403caf-0x0;var _0x4d6784=_0x0e80[_0x403caf];return _0x4d6784;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0x00e8('0x0'),_0x00e8('0x1')];function createListener(_0x3f5edc,_0x2f6a65){return function(_0x46158b){_0x2f6a65[_0x00e8('0x2')](_0x3f5edc,_0x46158b);};}function removeListener(_0x6b94cb,_0xdfa62d){return function(){MailQueueEvents[_0x00e8('0x3')](_0x6b94cb,_0xdfa62d);};}exports[_0x00e8('0x4')]=function(_0x256805){for(var _0x437a3c=0x0,_0x1f8e9d=events['length'];_0x437a3c<_0x1f8e9d;_0x437a3c++){var _0x3b90b4=events[_0x437a3c];var _0x118fc6=createListener(_0x00e8('0x5')+_0x3b90b4,_0x256805);MailQueueEvents['on'](_0x3b90b4,_0x118fc6);}};
\ No newline at end of file
index ea20e47..2e38a96 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc850=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./mailQueueReport.controller','index','isAuthenticated','describe','get','show','post','/:id','update','delete'];(function(_0x32f76e,_0x352b17){var _0x14f40e=function(_0x4129cc){while(--_0x4129cc){_0x32f76e['push'](_0x32f76e['shift']());}};_0x14f40e(++_0x352b17);}(_0xc850,0xde));var _0x0c85=function(_0x47745c,_0x2fcaef){_0x47745c=_0x47745c-0x0;var _0x5a3a6e=_0xc850[_0x47745c];return _0x5a3a6e;};'use strict';var multer=require(_0x0c85('0x0'));var util=require(_0x0c85('0x1'));var path=require(_0x0c85('0x2'));var timeout=require(_0x0c85('0x3'));var express=require(_0x0c85('0x4'));var router=express[_0x0c85('0x5')]();var fs_extra=require(_0x0c85('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0c85('0x7'));var controller=require(_0x0c85('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0c85('0x9')]);router['get']('/describe',auth[_0x0c85('0xa')](),controller[_0x0c85('0xb')]);router[_0x0c85('0xc')]('/:id',auth[_0x0c85('0xa')](),controller[_0x0c85('0xd')]);router[_0x0c85('0xe')]('/',auth[_0x0c85('0xa')](),controller['create']);router['put'](_0x0c85('0xf'),auth[_0x0c85('0xa')](),controller[_0x0c85('0x10')]);router[_0x0c85('0x11')]('/:id',auth[_0x0c85('0xa')](),controller[_0x0c85('0x12')]);module[_0x0c85('0x13')]=router;
\ No newline at end of file
+var _0x9341=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','get','describe','/:id','show','post','put','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra'];(function(_0x9bebd0,_0x446f84){var _0x4105e7=function(_0x36c8c4){while(--_0x36c8c4){_0x9bebd0['push'](_0x9bebd0['shift']());}};_0x4105e7(++_0x446f84);}(_0x9341,0xf2));var _0x1934=function(_0x24ae71,_0x5e2b3f){_0x24ae71=_0x24ae71-0x0;var _0x4a6dcd=_0x9341[_0x24ae71];return _0x4a6dcd;};'use strict';var multer=require(_0x1934('0x0'));var util=require('util');var path=require(_0x1934('0x1'));var timeout=require(_0x1934('0x2'));var express=require('express');var router=express[_0x1934('0x3')]();var fs_extra=require(_0x1934('0x4'));var auth=require(_0x1934('0x5'));var interaction=require(_0x1934('0x6'));var config=require(_0x1934('0x7'));var controller=require(_0x1934('0x8'));router['get']('/',auth[_0x1934('0x9')](),controller['index']);router[_0x1934('0xa')]('/describe',auth[_0x1934('0x9')](),controller[_0x1934('0xb')]);router[_0x1934('0xa')](_0x1934('0xc'),auth[_0x1934('0x9')](),controller[_0x1934('0xd')]);router[_0x1934('0xe')]('/',auth[_0x1934('0x9')](),controller['create']);router[_0x1934('0xf')](_0x1934('0xc'),auth[_0x1934('0x9')](),controller[_0x1934('0x10')]);router[_0x1934('0x11')](_0x1934('0xc'),auth['isAuthenticated'](),controller[_0x1934('0x12')]);module['exports']=router;
\ No newline at end of file
index 70c7b23..7bef63e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeb69=['STRING','DATE','moment','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb69,0xf7));var _0x9eb6=function(_0xcc63e3,_0x5789e6){_0xcc63e3=_0xcc63e3-0x0;var _0x392fb0=_0xeb69[_0xcc63e3];return _0x392fb0;};'use strict';var moment=require(_0x9eb6('0x0'));var Sequelize=require(_0x9eb6('0x1'));module[_0x9eb6('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9eb6('0x3')]},'joinAt':{'type':Sequelize[_0x9eb6('0x4')]},'leaveAt':{'type':Sequelize[_0x9eb6('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9eb6('0x4')]},'reason':{'type':Sequelize[_0x9eb6('0x3')]}};
\ No newline at end of file
+var _0x8dab=['sequelize','STRING','DATE','moment'];(function(_0x558f11,_0x1e3919){var _0x42d2c3=function(_0x7636d2){while(--_0x7636d2){_0x558f11['push'](_0x558f11['shift']());}};_0x42d2c3(++_0x1e3919);}(_0x8dab,0x1d7));var _0xb8da=function(_0x550db3,_0x208cfb){_0x550db3=_0x550db3-0x0;var _0x5828dd=_0x8dab[_0x550db3];return _0x5828dd;};'use strict';var moment=require(_0xb8da('0x0'));var Sequelize=require(_0xb8da('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xb8da('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb8da('0x2')]},'joinAt':{'type':Sequelize[_0xb8da('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb8da('0x3')]},'exitAt':{'type':Sequelize[_0xb8da('0x3')]},'reason':{'type':Sequelize[_0xb8da('0x2')]}};
\ No newline at end of file
index 605d31c..e47a97c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfcf0=['nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0xfcf0,0x138));var _0x0fcf=function(_0x47a12a,_0x70f591){_0x47a12a=_0x47a12a-0x0;var _0x30cd40=_0xfcf0[_0x47a12a];return _0x30cd40;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':!![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')](_0x1fb83d[_0x0fcf('0x47')],{})['then'](respondWithResult(_0x345188,0xc9))['catch'](handleError(_0x345188,null));};exports[_0x0fcf('0x23')]=function(_0x243699,_0x28d2f4){if(_0x243699[_0x0fcf('0x47')]['id']){delete _0x243699[_0x0fcf('0x47')]['id'];}return db[_0x0fcf('0x2b')]['find']({'where':{'id':_0x243699[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x28d2f4,null))['then'](saveUpdates(_0x243699[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x28d2f4,null))[_0x0fcf('0x42')](handleError(_0x28d2f4,null));};exports[_0x0fcf('0x25')]=function(_0x5435c0,_0xc514bf){return db[_0x0fcf('0x2b')][_0x0fcf('0x48')]({'where':{'id':_0x5435c0[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0xc514bf,null))[_0x0fcf('0x24')](removeEntity(_0xc514bf,null))[_0x0fcf('0x42')](handleError(_0xc514bf,null));};exports[_0x0fcf('0x49')]=function(_0x389d71,_0x3a473c){return db[_0x0fcf('0x2b')][_0x0fcf('0x49')]()[_0x0fcf('0x24')](respondWithResult(_0x3a473c,null))[_0x0fcf('0x42')](handleError(_0x3a473c,null));};
\ No newline at end of file
+var _0x627e=['limit','count','set','reject','save','then','destroy','error','stack','name','index','MailQueueReport','fieldName','key','map','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','rows','catch','params','fields','length','includeAll','include','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x2f3d3c,_0x4d429c){var _0x47aa28=function(_0x105b40){while(--_0x105b40){_0x2f3d3c['push'](_0x2f3d3c['shift']());}};_0x47aa28(++_0x4d429c);}(_0x627e,0x14a));var _0xe627=function(_0x22ea92,_0x3f9803){_0x22ea92=_0x22ea92-0x0;var _0x202c15=_0x627e[_0x22ea92];return _0x202c15;};'use strict';var emlformat=require(_0xe627('0x0'));var rimraf=require(_0xe627('0x1'));var zipdir=require(_0xe627('0x2'));var jsonpatch=require(_0xe627('0x3'));var rp=require(_0xe627('0x4'));var moment=require('moment');var BPromise=require(_0xe627('0x5'));var Mustache=require(_0xe627('0x6'));var util=require(_0xe627('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe627('0x8'));var fs=require('fs');var fs_extra=require(_0xe627('0x9'));var _=require(_0xe627('0xa'));var squel=require(_0xe627('0xb'));var crypto=require(_0xe627('0xc'));var jsforce=require(_0xe627('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe627('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe627('0xf'));var authService=require(_0xe627('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe627('0x11'));var logger=require(_0xe627('0x12'))(_0xe627('0x13'));var utils=require(_0xe627('0x14'));var config=require(_0xe627('0x15'));var licenseUtil=require(_0xe627('0x16'));var db=require(_0xe627('0x17'))['db'];function respondWithStatusCode(_0x3919be,_0x1922f5){_0x1922f5=_0x1922f5||0xcc;return function(_0x582190){if(_0x582190){return _0x3919be[_0xe627('0x18')](_0x1922f5);}return _0x3919be[_0xe627('0x19')](_0x1922f5)[_0xe627('0x1a')]();};}function respondWithResult(_0x4be370,_0x42dd1c){_0x42dd1c=_0x42dd1c||0xc8;return function(_0x1e2e62){if(_0x1e2e62){return _0x4be370[_0xe627('0x19')](_0x42dd1c)[_0xe627('0x1b')](_0x1e2e62);}};}function respondWithFilteredResult(_0x62896f,_0x6a9a15){return function(_0x271325){if(_0x271325){var _0x54720a=typeof _0x6a9a15[_0xe627('0x1c')]===_0xe627('0x1d')&&typeof _0x6a9a15[_0xe627('0x1e')]===_0xe627('0x1d');var _0x403982=_0x271325[_0xe627('0x1f')];var _0x56559b=_0x54720a?0x0:_0x6a9a15[_0xe627('0x1c')];var _0x538b22=_0x54720a?_0x271325[_0xe627('0x1f')]:_0x6a9a15['offset']+_0x6a9a15[_0xe627('0x1e')];var _0x565213;if(_0x538b22>=_0x403982){_0x538b22=_0x403982;_0x565213=0xc8;}else{_0x565213=0xce;}_0x62896f['status'](_0x565213);return _0x62896f[_0xe627('0x20')]('Content-Range',_0x56559b+'-'+_0x538b22+'/'+_0x403982)[_0xe627('0x1b')](_0x271325);}return null;};}function patchUpdates(_0x3391ce){return function(_0x4adde7){try{jsonpatch['apply'](_0x4adde7,_0x3391ce,!![]);}catch(_0x4ecfa6){return BPromise[_0xe627('0x21')](_0x4ecfa6);}return _0x4adde7[_0xe627('0x22')]();};}function saveUpdates(_0x4e3338,_0x708a8a){return function(_0x33cb27){if(_0x33cb27){return _0x33cb27['update'](_0x4e3338)[_0xe627('0x23')](function(_0x29221b){return _0x29221b;});}return null;};}function removeEntity(_0x52d492,_0x42f3d1){return function(_0x19adbc){if(_0x19adbc){return _0x19adbc[_0xe627('0x24')]()['then'](function(){_0x52d492[_0xe627('0x19')](0xcc)[_0xe627('0x1a')]();});}};}function handleEntityNotFound(_0x1a5081,_0x3ddd8d){return function(_0x4b9ff9){if(!_0x4b9ff9){_0x1a5081[_0xe627('0x18')](0x194);}return _0x4b9ff9;};}function handleError(_0x1fe192,_0x1635a0){_0x1635a0=_0x1635a0||0x1f4;return function(_0x29eb8e){logger[_0xe627('0x25')](_0x29eb8e[_0xe627('0x26')]);if(_0x29eb8e[_0xe627('0x27')]){delete _0x29eb8e[_0xe627('0x27')];}_0x1fe192[_0xe627('0x19')](_0x1635a0)['send'](_0x29eb8e);};}exports[_0xe627('0x28')]=function(_0x5aeba1,_0x5cd7c8){var _0x1e0bd7={},_0xdf63c8={},_0x5799a3={'count':0x0,'rows':[]};var _0x39c23f=_['map'](db[_0xe627('0x29')]['rawAttributes'],function(_0x262253){return{'name':_0x262253[_0xe627('0x2a')],'type':_0x262253['type'][_0xe627('0x2b')]};});_0xdf63c8['model']=_[_0xe627('0x2c')](_0x39c23f,_0xe627('0x27'));_0xdf63c8[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x5aeba1[_0xe627('0x2d')]);_0xdf63c8[_0xe627('0x2f')]=_[_0xe627('0x30')](_0xdf63c8[_0xe627('0x31')],_0xdf63c8[_0xe627('0x2d')]);_0x1e0bd7[_0xe627('0x32')]=_[_0xe627('0x30')](_0xdf63c8['model'],qs['fields'](_0x5aeba1[_0xe627('0x2d')]['fields']));_0x1e0bd7[_0xe627('0x32')]=_0x1e0bd7['attributes']['length']?_0x1e0bd7[_0xe627('0x32')]:_0xdf63c8['model'];if(!_0x5aeba1['query'][_0xe627('0x33')](_0xe627('0x34'))){_0x1e0bd7[_0xe627('0x1e')]=qs['limit'](_0x5aeba1['query']['limit']);_0x1e0bd7[_0xe627('0x1c')]=qs['offset'](_0x5aeba1[_0xe627('0x2d')][_0xe627('0x1c')]);}_0x1e0bd7['order']=qs[_0xe627('0x35')](_0x5aeba1[_0xe627('0x2d')]['sort']);_0x1e0bd7[_0xe627('0x36')]=qs[_0xe627('0x2f')](_[_0xe627('0x37')](_0x5aeba1[_0xe627('0x2d')],_0xdf63c8[_0xe627('0x2f')]),_0x39c23f);if(_0x5aeba1[_0xe627('0x2d')]['filter']){_0x1e0bd7[_0xe627('0x36')]=_['merge'](_0x1e0bd7[_0xe627('0x36')],{'$or':_['map'](_0x39c23f,function(_0xe90eda){if(_0xe90eda[_0xe627('0x38')]!==_0xe627('0x39')){var _0x21a533={};_0x21a533[_0xe90eda[_0xe627('0x27')]]={'$like':'%'+_0x5aeba1[_0xe627('0x2d')][_0xe627('0x3a')]+'%'};return _0x21a533;}})});}_0x1e0bd7=_[_0xe627('0x3b')]({},_0x1e0bd7,_0x5aeba1[_0xe627('0x3c')]);var _0x415a25={'where':_0x1e0bd7[_0xe627('0x36')]};return db[_0xe627('0x29')][_0xe627('0x1f')](_0x415a25)['then'](function(_0x4ddff5){_0x5799a3['count']=_0x4ddff5;if(_0x5aeba1['query']['includeAll']){_0x1e0bd7['include']=[{'all':!![]}];}return db[_0xe627('0x29')]['findAll'](_0x1e0bd7);})[_0xe627('0x23')](function(_0x59cd6a){_0x5799a3[_0xe627('0x3d')]=_0x59cd6a;return _0x5799a3;})[_0xe627('0x23')](respondWithFilteredResult(_0x5cd7c8,_0x1e0bd7))[_0xe627('0x3e')](handleError(_0x5cd7c8,null));};exports['show']=function(_0x58e110,_0x26064c){var _0x5f3374={'raw':!![],'where':{'id':_0x58e110[_0xe627('0x3f')]['id']}},_0x5e352e={};_0x5e352e['model']=_[_0xe627('0x2e')](db['MailQueueReport']['rawAttributes']);_0x5e352e[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x58e110[_0xe627('0x2d')]);_0x5e352e['filters']=_['intersection'](_0x5e352e[_0xe627('0x31')],_0x5e352e['query']);_0x5f3374['attributes']=_[_0xe627('0x30')](_0x5e352e[_0xe627('0x31')],qs[_0xe627('0x40')](_0x58e110[_0xe627('0x2d')][_0xe627('0x40')]));_0x5f3374[_0xe627('0x32')]=_0x5f3374['attributes'][_0xe627('0x41')]?_0x5f3374[_0xe627('0x32')]:_0x5e352e['model'];if(_0x58e110['query'][_0xe627('0x42')]){_0x5f3374[_0xe627('0x43')]=[{'all':!![]}];}_0x5f3374=_[_0xe627('0x3b')]({},_0x5f3374,_0x58e110[_0xe627('0x3c')]);return db[_0xe627('0x29')][_0xe627('0x44')](_0x5f3374)[_0xe627('0x23')](handleEntityNotFound(_0x26064c,null))['then'](respondWithResult(_0x26064c,null))[_0xe627('0x3e')](handleError(_0x26064c,null));};exports['create']=function(_0x648456,_0xcd19f5){return db[_0xe627('0x29')]['create'](_0x648456[_0xe627('0x45')],{})['then'](respondWithResult(_0xcd19f5,0xc9))[_0xe627('0x3e')](handleError(_0xcd19f5,null));};exports[_0xe627('0x46')]=function(_0x375e05,_0x30e057){if(_0x375e05[_0xe627('0x45')]['id']){delete _0x375e05['body']['id'];}return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x375e05[_0xe627('0x3f')]['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x30e057,null))[_0xe627('0x23')](saveUpdates(_0x375e05[_0xe627('0x45')],null))[_0xe627('0x23')](respondWithResult(_0x30e057,null))[_0xe627('0x3e')](handleError(_0x30e057,null));};exports[_0xe627('0x24')]=function(_0x3824da,_0x550b74){return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x3824da['params']['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x550b74,null))[_0xe627('0x23')](removeEntity(_0x550b74,null))['catch'](handleError(_0x550b74,null));};exports[_0xe627('0x47')]=function(_0x3a827e,_0x542a4c){return db[_0xe627('0x29')][_0xe627('0x47')]()['then'](respondWithResult(_0x542a4c,null))[_0xe627('0x3e')](handleError(_0x542a4c,null));};
\ No newline at end of file
index 3e19da7..baaaaeb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdb3a=['exports','define','MailQueueReport','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x59b9d3,_0x384472){var _0x171163=function(_0x251233){while(--_0x251233){_0x59b9d3['push'](_0x59b9d3['shift']());}};_0x171163(++_0x384472);}(_0xdb3a,0xb4));var _0xadb3=function(_0x4d6ac0,_0x201628){_0x4d6ac0=_0x4d6ac0-0x0;var _0x5296c4=_0xdb3a[_0x4d6ac0];return _0x5296c4;};'use strict';var _=require(_0xadb3('0x0'));var util=require('util');var logger=require(_0xadb3('0x1'))(_0xadb3('0x2'));var moment=require('moment');var BPromise=require(_0xadb3('0x3'));var rp=require(_0xadb3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xadb3('0x5'));var config=require(_0xadb3('0x6'));var attributes=require('./mailQueueReport.attributes');module[_0xadb3('0x7')]=function(_0x502c92,_0x450b7c){return _0x502c92[_0xadb3('0x8')](_0xadb3('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xadb3('0xa'),'fields':[_0xadb3('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x9f4d=['bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','moment'];(function(_0x3529b9,_0x4c4208){var _0x2f33be=function(_0x2139e8){while(--_0x2139e8){_0x3529b9['push'](_0x3529b9['shift']());}};_0x2f33be(++_0x4c4208);}(_0x9f4d,0x7f));var _0xd9f4=function(_0x193927,_0x545c88){_0x193927=_0x193927-0x0;var _0x1d21b1=_0x9f4d[_0x193927];return _0x1d21b1;};'use strict';var _=require('lodash');var util=require(_0xd9f4('0x0'));var logger=require(_0xd9f4('0x1'))('api');var moment=require(_0xd9f4('0x2'));var BPromise=require(_0xd9f4('0x3'));var rp=require(_0xd9f4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd9f4('0x5'));var config=require(_0xd9f4('0x6'));var attributes=require(_0xd9f4('0x7'));module[_0xd9f4('0x8')]=function(_0x49069f,_0x269dcc){return _0x49069f[_0xd9f4('0x9')](_0xd9f4('0xa'),attributes,{'tableName':_0xd9f4('0xb'),'paranoid':![],'indexes':[{'name':_0xd9f4('0xc'),'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
index ace38e7..363b395 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x2607bd,_0x5cd86e){var _0xbdae34=function(_0x2e4a6e){while(--_0x2e4a6e){_0x2607bd['push'](_0x2607bd['shift']());}};_0xbdae34(++_0x5cd86e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3eabd9,_0x136f4b){_0x3eabd9=_0x3eabd9-0x0;var _0x1ac257=_0x5f2f[_0x3eabd9];return _0x1ac257;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});};
\ No newline at end of file
+var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x4e6090,_0x50fa28){var _0x108ca1=function(_0x34939e){while(--_0x34939e){_0x4e6090['push'](_0x4e6090['shift']());}};_0x108ca1(++_0x50fa28);}(_0x2ef3,0xba));var _0x32ef=function(_0x1f9221,_0x2b960b){_0x1f9221=_0x1f9221-0x0;var _0x33ce08=_0x2ef3[_0x1f9221];return _0x33ce08;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});};
\ No newline at end of file
index fe583a0..d387f7b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2df537,_0x1359a8){var _0x288850=function(_0x2468a1){while(--_0x2468a1){_0x2df537['push'](_0x2df537['shift']());}};_0x288850(++_0x1359a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router;
\ No newline at end of file
+var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x307de2,_0x515c96){var _0x50c114=function(_0x4a0c78){while(--_0x4a0c78){_0x307de2['push'](_0x307de2['shift']());}};_0x50c114(++_0x515c96);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xcb91[_0x2d34d6];return _0x1d3d12;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router;
\ No newline at end of file
index a1daf08..e806757 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8178=['INTEGER','INBOX','sequelize','STRING','BOOLEAN'];(function(_0x4bcfcd,_0x5cf858){var _0x5e3bd8=function(_0x1730e2){while(--_0x1730e2){_0x4bcfcd['push'](_0x4bcfcd['shift']());}};_0x5e3bd8(++_0x5cf858);}(_0x8178,0x110));var _0x8817=function(_0x5ea81f,_0x465b4e){_0x5ea81f=_0x5ea81f-0x0;var _0x38fbcc=_0x8178[_0x5ea81f];return _0x38fbcc;};'use strict';var Sequelize=require(_0x8817('0x0'));module['exports']={'description':{'type':Sequelize[_0x8817('0x1')]},'host':{'type':Sequelize[_0x8817('0x1')]},'authentication':{'type':Sequelize[_0x8817('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x8817('0x1')]},'password':{'type':Sequelize[_0x8817('0x1')]},'port':{'type':Sequelize[_0x8817('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x8817('0x1')],'defaultValue':_0x8817('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x8817('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x8817('0x1')]},'modernAuthentication':{'type':Sequelize[_0x8817('0x2')],'defaultValue':![]}};
\ No newline at end of file
+var _0xf43e=['INBOX','INTEGER','STRING','BOOLEAN'];(function(_0x47ee78,_0x17a798){var _0xf39157=function(_0x1608c7){while(--_0x1608c7){_0x47ee78['push'](_0x47ee78['shift']());}};_0xf39157(++_0x17a798);}(_0xf43e,0x66));var _0xef43=function(_0x43e299,_0x4ce34e){_0x43e299=_0x43e299-0x0;var _0x373635=_0xf43e[_0x43e299];return _0x373635;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xef43('0x0')]},'host':{'type':Sequelize[_0xef43('0x0')]},'authentication':{'type':Sequelize[_0xef43('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0xef43('0x0')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xef43('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xef43('0x2')},'connTimeout':{'type':Sequelize[_0xef43('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xef43('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xef43('0x0')]},'modernAuthentication':{'type':Sequelize[_0xef43('0x1')],'defaultValue':![]}};
\ No newline at end of file
index 3e129d7..78a6643 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd27d=['moment','bluebird','request-promise','path','rimraf','exports','define','mail_servers_in','lodash','util','../../config/logger','api'];(function(_0xae4583,_0x22e6cf){var _0x39cee1=function(_0x431e3d){while(--_0x431e3d){_0xae4583['push'](_0xae4583['shift']());}};_0x39cee1(++_0x22e6cf);}(_0xd27d,0x1a0));var _0xdd27=function(_0x1c0283,_0x23dd3a){_0x1c0283=_0x1c0283-0x0;var _0x505ff7=_0xd27d[_0x1c0283];return _0x505ff7;};'use strict';var _=require(_0xdd27('0x0'));var util=require(_0xdd27('0x1'));var logger=require(_0xdd27('0x2'))(_0xdd27('0x3'));var moment=require(_0xdd27('0x4'));var BPromise=require(_0xdd27('0x5'));var rp=require(_0xdd27('0x6'));var fs=require('fs');var path=require(_0xdd27('0x7'));var rimraf=require(_0xdd27('0x8'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0xdd27('0x9')]=function(_0x146b54,_0xb84e6e){return _0x146b54[_0xdd27('0xa')]('MailServerIn',attributes,{'tableName':_0xdd27('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4630=['exports','define','mail_servers_in','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0x4630,0x179));var _0x0463=function(_0x2680b3,_0x3aba75){_0x2680b3=_0x2680b3-0x0;var _0x2b4383=_0x4630[_0x2680b3];return _0x2b4383;};'use strict';var _=require(_0x0463('0x0'));var util=require('util');var logger=require(_0x0463('0x1'))('api');var moment=require(_0x0463('0x2'));var BPromise=require('bluebird');var rp=require(_0x0463('0x3'));var fs=require('fs');var path=require(_0x0463('0x4'));var rimraf=require(_0x0463('0x5'));var config=require(_0x0463('0x6'));var attributes=require(_0x0463('0x7'));module[_0x0463('0x8')]=function(_0x2b7a2e,_0x476edc){return _0x2b7a2e[_0x0463('0x9')]('MailServerIn',attributes,{'tableName':_0x0463('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5f1aae2..bbfdd96 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaf5c=['limit','map','include','model','GetMailServerIn','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','findAll','options','where','attributes'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xaf5c,0x161));var _0xcaf5=function(_0x1b0d98,_0x18eb87){_0x1b0d98=_0x1b0d98-0x0;var _0x53c461=_0xaf5c[_0x1b0d98];return _0x53c461;};'use strict';var _=require('lodash');var util=require(_0xcaf5('0x0'));var moment=require(_0xcaf5('0x1'));var BPromise=require(_0xcaf5('0x2'));var rs=require(_0xcaf5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcaf5('0x4'))['db'];var utils=require(_0xcaf5('0x5'));var logger=require('../../config/logger')(_0xcaf5('0x6'));var config=require('../../config/environment');var jayson=require(_0xcaf5('0x7'));var client=jayson[_0xcaf5('0x8')][_0xcaf5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17c418,_0x3f18da,_0x1889f2){return new BPromise(function(_0x577980,_0x543b48){return client['request'](_0x17c418,_0x1889f2)['then'](function(_0x3d7b63){logger[_0xcaf5('0xa')](_0xcaf5('0xb'),_0x3f18da,'request\x20sent');logger[_0xcaf5('0xc')](_0xcaf5('0xd'),_0x3f18da,_0xcaf5('0xe'),JSON['stringify'](_0x3d7b63));if(_0x3d7b63['error']){if(_0x3d7b63['error'][_0xcaf5('0xf')]===0x1f4){logger[_0xcaf5('0x10')]('MailServerIn,\x20%s,\x20%s',_0x3f18da,_0x3d7b63[_0xcaf5('0x10')][_0xcaf5('0x11')]);return _0x543b48(_0x3d7b63[_0xcaf5('0x10')]['message']);}logger[_0xcaf5('0x10')]('MailServerIn,\x20%s,\x20%s',_0x3f18da,_0x3d7b63[_0xcaf5('0x10')][_0xcaf5('0x11')]);return _0x577980(_0x3d7b63[_0xcaf5('0x10')][_0xcaf5('0x11')]);}else{logger[_0xcaf5('0xa')](_0xcaf5('0xb'),_0x3f18da,_0xcaf5('0xe'));_0x577980(_0x3d7b63[_0xcaf5('0x12')][_0xcaf5('0x11')]);}})[_0xcaf5('0x13')](function(_0x223904){logger[_0xcaf5('0x10')]('MailServerIn,\x20%s,\x20%s',_0x3f18da,_0x223904);_0x543b48(_0x223904);});});}exports['GetMailServerIn']=function(_0xb1eae1){var _0x425966=this;return new Promise(function(_0x477952,_0x3e286){return db['MailServerIn'][_0xcaf5('0x14')]({'raw':_0xb1eae1[_0xcaf5('0x15')]?_0xb1eae1[_0xcaf5('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xb1eae1[_0xcaf5('0x15')]?_0xb1eae1[_0xcaf5('0x15')][_0xcaf5('0x16')]||null:null,'attributes':_0xb1eae1[_0xcaf5('0x15')]?_0xb1eae1[_0xcaf5('0x15')][_0xcaf5('0x17')]||null:null,'limit':_0xb1eae1[_0xcaf5('0x15')]?_0xb1eae1[_0xcaf5('0x15')][_0xcaf5('0x18')]||null:null,'include':_0xb1eae1[_0xcaf5('0x15')]?_0xb1eae1[_0xcaf5('0x15')]['include']?_[_0xcaf5('0x19')](_0xb1eae1[_0xcaf5('0x15')]['include'],function(_0x31debf){return{'model':db[_0x31debf['model']],'as':_0x31debf['as'],'attributes':_0x31debf[_0xcaf5('0x17')],'include':_0x31debf[_0xcaf5('0x1a')]?_['map'](_0x31debf[_0xcaf5('0x1a')],function(_0x59d28f){return{'model':db[_0x59d28f[_0xcaf5('0x1b')]],'as':_0x59d28f['as'],'attributes':_0x59d28f[_0xcaf5('0x17')],'include':_0x59d28f[_0xcaf5('0x1a')]?_[_0xcaf5('0x19')](_0x59d28f[_0xcaf5('0x1a')],function(_0x4ff4b8){return{'model':db[_0x4ff4b8[_0xcaf5('0x1b')]],'as':_0x4ff4b8['as'],'attributes':_0x4ff4b8[_0xcaf5('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e542d){logger[_0xcaf5('0xa')]('GetMailServerIn',_0xb1eae1);logger['debug']('GetMailServerIn',_0xb1eae1,JSON['stringify'](_0x1e542d));_0x477952(_0x1e542d);})[_0xcaf5('0x13')](function(_0x45fabd){logger[_0xcaf5('0x10')](_0xcaf5('0x1c'),_0x45fabd['message'],_0xb1eae1);_0x3e286(_0x425966[_0xcaf5('0x10')](0x1f4,_0x45fabd[_0xcaf5('0x11')]));});});};
\ No newline at end of file
+var _0xd232=['attributes','limit','include','map','model','GetMailServerIn','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailServerIn','options','raw','where'];(function(_0x8fc91f,_0x448e49){var _0x2ef559=function(_0x514ce9){while(--_0x514ce9){_0x8fc91f['push'](_0x8fc91f['shift']());}};_0x2ef559(++_0x448e49);}(_0xd232,0x1d7));var _0x2d23=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd232[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2d23('0x0'));var util=require(_0x2d23('0x1'));var moment=require('moment');var BPromise=require(_0x2d23('0x2'));var rs=require(_0x2d23('0x3'));var fs=require('fs');var Redis=require(_0x2d23('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2d23('0x5'))(_0x2d23('0x6'));var config=require(_0x2d23('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2d23('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f2d5c,_0x4965c8,_0x10a6b7){return new BPromise(function(_0x44bd5f,_0x47bdf3){return client[_0x2d23('0x9')](_0x3f2d5c,_0x10a6b7)[_0x2d23('0xa')](function(_0x9ef258){logger[_0x2d23('0xb')](_0x2d23('0xc'),_0x4965c8,_0x2d23('0xd'));logger[_0x2d23('0xe')](_0x2d23('0xf'),_0x4965c8,_0x2d23('0xd'),JSON[_0x2d23('0x10')](_0x9ef258));if(_0x9ef258[_0x2d23('0x11')]){if(_0x9ef258['error'][_0x2d23('0x12')]===0x1f4){logger['error'](_0x2d23('0xc'),_0x4965c8,_0x9ef258[_0x2d23('0x11')][_0x2d23('0x13')]);return _0x47bdf3(_0x9ef258[_0x2d23('0x11')]['message']);}logger[_0x2d23('0x11')](_0x2d23('0xc'),_0x4965c8,_0x9ef258['error'][_0x2d23('0x13')]);return _0x44bd5f(_0x9ef258[_0x2d23('0x11')][_0x2d23('0x13')]);}else{logger[_0x2d23('0xb')](_0x2d23('0xc'),_0x4965c8,'request\x20sent');_0x44bd5f(_0x9ef258['result'][_0x2d23('0x13')]);}})[_0x2d23('0x14')](function(_0x303a81){logger[_0x2d23('0x11')](_0x2d23('0xc'),_0x4965c8,_0x303a81);_0x47bdf3(_0x303a81);});});}exports['GetMailServerIn']=function(_0x4f2d28){var _0x76c4f2=this;return new Promise(function(_0x3ca8d6,_0x17ce76){return db[_0x2d23('0x15')]['findAll']({'raw':_0x4f2d28[_0x2d23('0x16')]?_0x4f2d28['options'][_0x2d23('0x17')]===undefined?!![]:![]:!![],'where':_0x4f2d28[_0x2d23('0x16')]?_0x4f2d28['options'][_0x2d23('0x18')]||null:null,'attributes':_0x4f2d28[_0x2d23('0x16')]?_0x4f2d28['options'][_0x2d23('0x19')]||null:null,'limit':_0x4f2d28[_0x2d23('0x16')]?_0x4f2d28[_0x2d23('0x16')][_0x2d23('0x1a')]||null:null,'include':_0x4f2d28[_0x2d23('0x16')]?_0x4f2d28['options'][_0x2d23('0x1b')]?_[_0x2d23('0x1c')](_0x4f2d28[_0x2d23('0x16')][_0x2d23('0x1b')],function(_0x34f4ba){return{'model':db[_0x34f4ba['model']],'as':_0x34f4ba['as'],'attributes':_0x34f4ba[_0x2d23('0x19')],'include':_0x34f4ba[_0x2d23('0x1b')]?_[_0x2d23('0x1c')](_0x34f4ba[_0x2d23('0x1b')],function(_0x164b3c){return{'model':db[_0x164b3c[_0x2d23('0x1d')]],'as':_0x164b3c['as'],'attributes':_0x164b3c[_0x2d23('0x19')],'include':_0x164b3c[_0x2d23('0x1b')]?_[_0x2d23('0x1c')](_0x164b3c[_0x2d23('0x1b')],function(_0x200358){return{'model':db[_0x200358['model']],'as':_0x200358['as'],'attributes':_0x200358['attributes']};}):[]};}):[]};}):[]:[]})[_0x2d23('0xa')](function(_0x2b7927){logger[_0x2d23('0xb')](_0x2d23('0x1e'),_0x4f2d28);logger['debug']('GetMailServerIn',_0x4f2d28,JSON[_0x2d23('0x10')](_0x2b7927));_0x3ca8d6(_0x2b7927);})[_0x2d23('0x14')](function(_0x3bc1e5){logger['error'](_0x2d23('0x1e'),_0x3bc1e5[_0x2d23('0x13')],_0x4f2d28);_0x17ce76(_0x76c4f2[_0x2d23('0x11')](0x1f4,_0x3bc1e5[_0x2d23('0x13')]));});});};
\ No newline at end of file
index fedb850..4939764 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router;
\ No newline at end of file
+var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7a54,0x106));var _0x47a5=function(_0x46cdc7,_0xbf35a2){_0x46cdc7=_0x46cdc7-0x0;var _0x37413d=_0x7a54[_0x46cdc7];return _0x37413d;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router;
\ No newline at end of file
index c7eab63..a3a65f9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0713=['BOOLEAN','STRING','INTEGER'];(function(_0x138050,_0x1132f4){var _0x447671=function(_0x19a42e){while(--_0x19a42e){_0x138050['push'](_0x138050['shift']());}};_0x447671(++_0x1132f4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x3071('0x0')]},'host':{'type':Sequelize[_0x3071('0x0')]},'user':{'type':Sequelize[_0x3071('0x0')]},'pass':{'type':Sequelize[_0x3071('0x0')]},'port':{'type':Sequelize[_0x3071('0x1')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x3071('0x0')]},'authentication':{'type':Sequelize[_0x3071('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3071('0x2')],'defaultValue':![]}};
\ No newline at end of file
+var _0x1d2d=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x33d60b,_0x49540f){var _0x55f78a=function(_0x3a0d01){while(--_0x3a0d01){_0x33d60b['push'](_0x33d60b['shift']());}};_0x55f78a(++_0x49540f);}(_0x1d2d,0xf0));var _0xd1d2=function(_0xf939c4,_0x3efc7b){_0xf939c4=_0xf939c4-0x0;var _0x20504d=_0x1d2d[_0xf939c4];return _0x20504d;};'use strict';var Sequelize=require(_0xd1d2('0x0'));module[_0xd1d2('0x1')]={'description':{'type':Sequelize[_0xd1d2('0x2')]},'host':{'type':Sequelize[_0xd1d2('0x2')]},'user':{'type':Sequelize[_0xd1d2('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd1d2('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xd1d2('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xd1d2('0x4')],'defaultValue':![]}};
\ No newline at end of file
index 3dee9ec..f44de6d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfe28=['destroy','error','stack','name','index','map','MailServerOut','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','options','includeAll','include','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','then'];(function(_0x3337cd,_0x4db6e5){var _0x1c8dee=function(_0x447221){while(--_0x447221){_0x3337cd['push'](_0x3337cd['shift']());}};_0x1c8dee(++_0x4db6e5);}(_0xfe28,0x120));var _0x8fe2=function(_0x2a057a,_0x23658e){_0x2a057a=_0x2a057a-0x0;var _0x307c68=_0xfe28[_0x2a057a];return _0x307c68;};'use strict';var emlformat=require(_0x8fe2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8fe2('0x1'));var jsonpatch=require(_0x8fe2('0x2'));var rp=require('request-promise');var moment=require(_0x8fe2('0x3'));var BPromise=require(_0x8fe2('0x4'));var Mustache=require(_0x8fe2('0x5'));var util=require(_0x8fe2('0x6'));var path=require(_0x8fe2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8fe2('0x8'));var _=require(_0x8fe2('0x9'));var squel=require('squel');var crypto=require(_0x8fe2('0xa'));var jsforce=require(_0x8fe2('0xb'));var deskjs=require(_0x8fe2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8fe2('0xd'));var Redis=require(_0x8fe2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8fe2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8fe2('0x10'));var logger=require(_0x8fe2('0x11'))(_0x8fe2('0x12'));var utils=require(_0x8fe2('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8fe2('0x14'))['db'];function respondWithStatusCode(_0x1cc89e,_0x2cc270){_0x2cc270=_0x2cc270||0xcc;return function(_0x4e2499){if(_0x4e2499){return _0x1cc89e[_0x8fe2('0x15')](_0x2cc270);}return _0x1cc89e[_0x8fe2('0x16')](_0x2cc270)['end']();};}function respondWithResult(_0x2ac826,_0x23d67e){_0x23d67e=_0x23d67e||0xc8;return function(_0x20a9ea){if(_0x20a9ea){return _0x2ac826[_0x8fe2('0x16')](_0x23d67e)[_0x8fe2('0x17')](_0x20a9ea);}};}function respondWithFilteredResult(_0x1e0945,_0x23de14){return function(_0x200455){if(_0x200455){var _0x34e828=typeof _0x23de14[_0x8fe2('0x18')]===_0x8fe2('0x19')&&typeof _0x23de14[_0x8fe2('0x1a')]===_0x8fe2('0x19');var _0x2be237=_0x200455[_0x8fe2('0x1b')];var _0x11b2ce=_0x34e828?0x0:_0x23de14[_0x8fe2('0x18')];var _0x344116=_0x34e828?_0x200455[_0x8fe2('0x1b')]:_0x23de14['offset']+_0x23de14[_0x8fe2('0x1a')];var _0x2095d2;if(_0x344116>=_0x2be237){_0x344116=_0x2be237;_0x2095d2=0xc8;}else{_0x2095d2=0xce;}_0x1e0945[_0x8fe2('0x16')](_0x2095d2);return _0x1e0945[_0x8fe2('0x1c')](_0x8fe2('0x1d'),_0x11b2ce+'-'+_0x344116+'/'+_0x2be237)[_0x8fe2('0x17')](_0x200455);}return null;};}function patchUpdates(_0x113477){return function(_0x22d115){try{jsonpatch[_0x8fe2('0x1e')](_0x22d115,_0x113477,!![]);}catch(_0x36ff75){return BPromise['reject'](_0x36ff75);}return _0x22d115['save']();};}function saveUpdates(_0x23224f,_0x1e3a00){return function(_0x548921){if(_0x548921){return _0x548921['update'](_0x23224f)[_0x8fe2('0x1f')](function(_0x14150d){return _0x14150d;});}return null;};}function removeEntity(_0x44532b,_0x12d0c7){return function(_0x4b747a){if(_0x4b747a){return _0x4b747a[_0x8fe2('0x20')]()['then'](function(){_0x44532b[_0x8fe2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x323122,_0x1de3fd){return function(_0x4f3321){if(!_0x4f3321){_0x323122[_0x8fe2('0x15')](0x194);}return _0x4f3321;};}function handleError(_0x57b3bf,_0x503748){_0x503748=_0x503748||0x1f4;return function(_0x18524f){logger[_0x8fe2('0x21')](_0x18524f[_0x8fe2('0x22')]);if(_0x18524f['name']){delete _0x18524f[_0x8fe2('0x23')];}_0x57b3bf['status'](_0x503748)['send'](_0x18524f);};}exports[_0x8fe2('0x24')]=function(_0x38b756,_0x547678){var _0xe96ae8={},_0x1e364e={},_0x2c1458={'count':0x0,'rows':[]};var _0x57b099=_[_0x8fe2('0x25')](db[_0x8fe2('0x26')][_0x8fe2('0x27')],function(_0x8d0830){return{'name':_0x8d0830['fieldName'],'type':_0x8d0830['type']['key']};});_0x1e364e[_0x8fe2('0x28')]=_[_0x8fe2('0x25')](_0x57b099,'name');_0x1e364e[_0x8fe2('0x29')]=_[_0x8fe2('0x2a')](_0x38b756[_0x8fe2('0x29')]);_0x1e364e[_0x8fe2('0x2b')]=_[_0x8fe2('0x2c')](_0x1e364e[_0x8fe2('0x28')],_0x1e364e[_0x8fe2('0x29')]);_0xe96ae8[_0x8fe2('0x2d')]=_[_0x8fe2('0x2c')](_0x1e364e[_0x8fe2('0x28')],qs[_0x8fe2('0x2e')](_0x38b756[_0x8fe2('0x29')][_0x8fe2('0x2e')]));_0xe96ae8[_0x8fe2('0x2d')]=_0xe96ae8[_0x8fe2('0x2d')][_0x8fe2('0x2f')]?_0xe96ae8['attributes']:_0x1e364e[_0x8fe2('0x28')];if(!_0x38b756['query'][_0x8fe2('0x30')](_0x8fe2('0x31'))){_0xe96ae8[_0x8fe2('0x1a')]=qs['limit'](_0x38b756[_0x8fe2('0x29')]['limit']);_0xe96ae8[_0x8fe2('0x18')]=qs['offset'](_0x38b756[_0x8fe2('0x29')][_0x8fe2('0x18')]);}_0xe96ae8['order']=qs[_0x8fe2('0x32')](_0x38b756[_0x8fe2('0x29')][_0x8fe2('0x32')]);_0xe96ae8[_0x8fe2('0x33')]=qs['filters'](_['pick'](_0x38b756[_0x8fe2('0x29')],_0x1e364e[_0x8fe2('0x2b')]),_0x57b099);if(_0x38b756[_0x8fe2('0x29')][_0x8fe2('0x34')]){_0xe96ae8[_0x8fe2('0x33')]=_[_0x8fe2('0x35')](_0xe96ae8['where'],{'$or':_[_0x8fe2('0x25')](_0x57b099,function(_0x23eb6c){if(_0x23eb6c[_0x8fe2('0x36')]!=='VIRTUAL'){var _0x2ead46={};_0x2ead46[_0x23eb6c[_0x8fe2('0x23')]]={'$like':'%'+_0x38b756['query']['filter']+'%'};return _0x2ead46;}})});}_0xe96ae8=_['merge']({},_0xe96ae8,_0x38b756[_0x8fe2('0x37')]);var _0x14bd30={'where':_0xe96ae8[_0x8fe2('0x33')]};return db[_0x8fe2('0x26')][_0x8fe2('0x1b')](_0x14bd30)[_0x8fe2('0x1f')](function(_0x50b83c){_0x2c1458['count']=_0x50b83c;if(_0x38b756[_0x8fe2('0x29')][_0x8fe2('0x38')]){_0xe96ae8[_0x8fe2('0x39')]=[{'all':!![]}];}return db[_0x8fe2('0x26')]['findAll'](_0xe96ae8);})[_0x8fe2('0x1f')](function(_0x238acd){_0x2c1458['rows']=_0x238acd;return _0x2c1458;})[_0x8fe2('0x1f')](respondWithFilteredResult(_0x547678,_0xe96ae8))[_0x8fe2('0x3a')](handleError(_0x547678,null));};exports[_0x8fe2('0x3b')]=function(_0xb3bbc9,_0x565bf5){var _0x4db223={'raw':!![],'where':{'id':_0xb3bbc9[_0x8fe2('0x3c')]['id']}},_0x4b7d97={};_0x4b7d97[_0x8fe2('0x28')]=_[_0x8fe2('0x2a')](db[_0x8fe2('0x26')]['rawAttributes']);_0x4b7d97[_0x8fe2('0x29')]=_[_0x8fe2('0x2a')](_0xb3bbc9[_0x8fe2('0x29')]);_0x4b7d97['filters']=_[_0x8fe2('0x2c')](_0x4b7d97['model'],_0x4b7d97['query']);_0x4db223[_0x8fe2('0x2d')]=_[_0x8fe2('0x2c')](_0x4b7d97[_0x8fe2('0x28')],qs[_0x8fe2('0x2e')](_0xb3bbc9[_0x8fe2('0x29')][_0x8fe2('0x2e')]));_0x4db223['attributes']=_0x4db223['attributes'][_0x8fe2('0x2f')]?_0x4db223[_0x8fe2('0x2d')]:_0x4b7d97[_0x8fe2('0x28')];if(_0xb3bbc9[_0x8fe2('0x29')][_0x8fe2('0x38')]){_0x4db223[_0x8fe2('0x39')]=[{'all':!![]}];}_0x4db223=_[_0x8fe2('0x35')]({},_0x4db223,_0xb3bbc9[_0x8fe2('0x37')]);return db[_0x8fe2('0x26')][_0x8fe2('0x3d')](_0x4db223)[_0x8fe2('0x1f')](handleEntityNotFound(_0x565bf5,null))[_0x8fe2('0x1f')](respondWithResult(_0x565bf5,null))[_0x8fe2('0x3a')](handleError(_0x565bf5,null));};exports[_0x8fe2('0x3e')]=function(_0x525827,_0x3a7178){return db[_0x8fe2('0x26')]['create'](_0x525827[_0x8fe2('0x3f')],{})[_0x8fe2('0x1f')](respondWithResult(_0x3a7178,0xc9))[_0x8fe2('0x3a')](handleError(_0x3a7178,null));};exports['update']=function(_0x593f2b,_0x4e561d){if(_0x593f2b['body']['id']){delete _0x593f2b[_0x8fe2('0x3f')]['id'];}return db[_0x8fe2('0x26')]['find']({'where':{'id':_0x593f2b[_0x8fe2('0x3c')]['id']}})[_0x8fe2('0x1f')](handleEntityNotFound(_0x4e561d,null))[_0x8fe2('0x1f')](saveUpdates(_0x593f2b[_0x8fe2('0x3f')],null))[_0x8fe2('0x1f')](respondWithResult(_0x4e561d,null))[_0x8fe2('0x3a')](handleError(_0x4e561d,null));};exports[_0x8fe2('0x20')]=function(_0x487356,_0x123190){return db[_0x8fe2('0x26')][_0x8fe2('0x3d')]({'where':{'id':_0x487356[_0x8fe2('0x3c')]['id']}})['then'](handleEntityNotFound(_0x123190,null))[_0x8fe2('0x1f')](removeEntity(_0x123190,null))[_0x8fe2('0x3a')](handleError(_0x123190,null));};
\ No newline at end of file
+var _0x6b94=['name','send','index','map','MailServerOut','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','options','create','body','destroy','eml-format','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','save','update','then','error'];(function(_0x3e3e86,_0x5a8a06){var _0xbb2109=function(_0x48cd2c){while(--_0x48cd2c){_0x3e3e86['push'](_0x3e3e86['shift']());}};_0xbb2109(++_0x5a8a06);}(_0x6b94,0xb7));var _0x46b9=function(_0x2bbf2d,_0x25959a){_0x2bbf2d=_0x2bbf2d-0x0;var _0x1e083a=_0x6b94[_0x2bbf2d];return _0x1e083a;};'use strict';var emlformat=require(_0x46b9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x46b9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x46b9('0x2'));var BPromise=require(_0x46b9('0x3'));var Mustache=require(_0x46b9('0x4'));var util=require('util');var path=require(_0x46b9('0x5'));var sox=require(_0x46b9('0x6'));var csv=require(_0x46b9('0x7'));var ejs=require(_0x46b9('0x8'));var fs=require('fs');var fs_extra=require(_0x46b9('0x9'));var _=require(_0x46b9('0xa'));var squel=require(_0x46b9('0xb'));var crypto=require(_0x46b9('0xc'));var jsforce=require(_0x46b9('0xd'));var deskjs=require(_0x46b9('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x46b9('0xf'));var Redis=require(_0x46b9('0x10'));var authService=require(_0x46b9('0x11'));var qs=require(_0x46b9('0x12'));var as=require(_0x46b9('0x13'));var hardwareService=require(_0x46b9('0x14'));var logger=require('../../config/logger')(_0x46b9('0x15'));var utils=require(_0x46b9('0x16'));var config=require(_0x46b9('0x17'));var licenseUtil=require(_0x46b9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x353fcc,_0x461ecf){_0x461ecf=_0x461ecf||0xcc;return function(_0x352f3c){if(_0x352f3c){return _0x353fcc[_0x46b9('0x19')](_0x461ecf);}return _0x353fcc['status'](_0x461ecf)[_0x46b9('0x1a')]();};}function respondWithResult(_0x1d40ea,_0x393948){_0x393948=_0x393948||0xc8;return function(_0x4a092c){if(_0x4a092c){return _0x1d40ea[_0x46b9('0x1b')](_0x393948)[_0x46b9('0x1c')](_0x4a092c);}};}function respondWithFilteredResult(_0x49fcba,_0x37b109){return function(_0x4f2c72){if(_0x4f2c72){var _0x2b352f=typeof _0x37b109['offset']===_0x46b9('0x1d')&&typeof _0x37b109[_0x46b9('0x1e')]===_0x46b9('0x1d');var _0x3903e7=_0x4f2c72['count'];var _0xdeb799=_0x2b352f?0x0:_0x37b109[_0x46b9('0x1f')];var _0x21d83a=_0x2b352f?_0x4f2c72[_0x46b9('0x20')]:_0x37b109[_0x46b9('0x1f')]+_0x37b109[_0x46b9('0x1e')];var _0x1f45a2;if(_0x21d83a>=_0x3903e7){_0x21d83a=_0x3903e7;_0x1f45a2=0xc8;}else{_0x1f45a2=0xce;}_0x49fcba[_0x46b9('0x1b')](_0x1f45a2);return _0x49fcba[_0x46b9('0x21')](_0x46b9('0x22'),_0xdeb799+'-'+_0x21d83a+'/'+_0x3903e7)[_0x46b9('0x1c')](_0x4f2c72);}return null;};}function patchUpdates(_0x3580d7){return function(_0xb54095){try{jsonpatch['apply'](_0xb54095,_0x3580d7,!![]);}catch(_0x195546){return BPromise['reject'](_0x195546);}return _0xb54095[_0x46b9('0x23')]();};}function saveUpdates(_0x2189b8,_0x3fc31c){return function(_0x429ad8){if(_0x429ad8){return _0x429ad8[_0x46b9('0x24')](_0x2189b8)['then'](function(_0x4a73f3){return _0x4a73f3;});}return null;};}function removeEntity(_0x275fdb,_0x1c295a){return function(_0x14f7ca){if(_0x14f7ca){return _0x14f7ca['destroy']()[_0x46b9('0x25')](function(){_0x275fdb[_0x46b9('0x1b')](0xcc)[_0x46b9('0x1a')]();});}};}function handleEntityNotFound(_0x4c7345,_0x1d5dc1){return function(_0x3f60f0){if(!_0x3f60f0){_0x4c7345[_0x46b9('0x19')](0x194);}return _0x3f60f0;};}function handleError(_0x443312,_0x3d1d65){_0x3d1d65=_0x3d1d65||0x1f4;return function(_0x453060){logger[_0x46b9('0x26')](_0x453060['stack']);if(_0x453060[_0x46b9('0x27')]){delete _0x453060[_0x46b9('0x27')];}_0x443312['status'](_0x3d1d65)[_0x46b9('0x28')](_0x453060);};}exports[_0x46b9('0x29')]=function(_0x468746,_0xa7f392){var _0x5065b2={},_0x16de70={},_0x11da5b={'count':0x0,'rows':[]};var _0x3b8646=_[_0x46b9('0x2a')](db[_0x46b9('0x2b')][_0x46b9('0x2c')],function(_0x564a55){return{'name':_0x564a55[_0x46b9('0x2d')],'type':_0x564a55['type'][_0x46b9('0x2e')]};});_0x16de70[_0x46b9('0x2f')]=_[_0x46b9('0x2a')](_0x3b8646,_0x46b9('0x27'));_0x16de70[_0x46b9('0x30')]=_['keys'](_0x468746['query']);_0x16de70[_0x46b9('0x31')]=_[_0x46b9('0x32')](_0x16de70['model'],_0x16de70[_0x46b9('0x30')]);_0x5065b2[_0x46b9('0x33')]=_[_0x46b9('0x32')](_0x16de70[_0x46b9('0x2f')],qs[_0x46b9('0x34')](_0x468746[_0x46b9('0x30')][_0x46b9('0x34')]));_0x5065b2[_0x46b9('0x33')]=_0x5065b2[_0x46b9('0x33')][_0x46b9('0x35')]?_0x5065b2['attributes']:_0x16de70[_0x46b9('0x2f')];if(!_0x468746[_0x46b9('0x30')][_0x46b9('0x36')](_0x46b9('0x37'))){_0x5065b2[_0x46b9('0x1e')]=qs[_0x46b9('0x1e')](_0x468746[_0x46b9('0x30')][_0x46b9('0x1e')]);_0x5065b2['offset']=qs['offset'](_0x468746[_0x46b9('0x30')][_0x46b9('0x1f')]);}_0x5065b2[_0x46b9('0x38')]=qs[_0x46b9('0x39')](_0x468746[_0x46b9('0x30')][_0x46b9('0x39')]);_0x5065b2[_0x46b9('0x3a')]=qs[_0x46b9('0x31')](_['pick'](_0x468746[_0x46b9('0x30')],_0x16de70[_0x46b9('0x31')]),_0x3b8646);if(_0x468746[_0x46b9('0x30')][_0x46b9('0x3b')]){_0x5065b2[_0x46b9('0x3a')]=_[_0x46b9('0x3c')](_0x5065b2['where'],{'$or':_['map'](_0x3b8646,function(_0x5a2dee){if(_0x5a2dee[_0x46b9('0x3d')]!==_0x46b9('0x3e')){var _0xeb920e={};_0xeb920e[_0x5a2dee[_0x46b9('0x27')]]={'$like':'%'+_0x468746[_0x46b9('0x30')][_0x46b9('0x3b')]+'%'};return _0xeb920e;}})});}_0x5065b2=_[_0x46b9('0x3c')]({},_0x5065b2,_0x468746['options']);var _0x221ab8={'where':_0x5065b2[_0x46b9('0x3a')]};return db['MailServerOut']['count'](_0x221ab8)[_0x46b9('0x25')](function(_0x5e63b5){_0x11da5b[_0x46b9('0x20')]=_0x5e63b5;if(_0x468746[_0x46b9('0x30')][_0x46b9('0x3f')]){_0x5065b2['include']=[{'all':!![]}];}return db[_0x46b9('0x2b')][_0x46b9('0x40')](_0x5065b2);})[_0x46b9('0x25')](function(_0x55fe0d){_0x11da5b[_0x46b9('0x41')]=_0x55fe0d;return _0x11da5b;})[_0x46b9('0x25')](respondWithFilteredResult(_0xa7f392,_0x5065b2))[_0x46b9('0x42')](handleError(_0xa7f392,null));};exports[_0x46b9('0x43')]=function(_0x116e08,_0xf94150){var _0xd888c5={'raw':!![],'where':{'id':_0x116e08[_0x46b9('0x44')]['id']}},_0x22b885={};_0x22b885['model']=_[_0x46b9('0x45')](db[_0x46b9('0x2b')]['rawAttributes']);_0x22b885['query']=_[_0x46b9('0x45')](_0x116e08['query']);_0x22b885['filters']=_[_0x46b9('0x32')](_0x22b885[_0x46b9('0x2f')],_0x22b885[_0x46b9('0x30')]);_0xd888c5['attributes']=_[_0x46b9('0x32')](_0x22b885['model'],qs[_0x46b9('0x34')](_0x116e08['query'][_0x46b9('0x34')]));_0xd888c5[_0x46b9('0x33')]=_0xd888c5[_0x46b9('0x33')][_0x46b9('0x35')]?_0xd888c5['attributes']:_0x22b885[_0x46b9('0x2f')];if(_0x116e08[_0x46b9('0x30')][_0x46b9('0x3f')]){_0xd888c5['include']=[{'all':!![]}];}_0xd888c5=_[_0x46b9('0x3c')]({},_0xd888c5,_0x116e08[_0x46b9('0x46')]);return db[_0x46b9('0x2b')]['find'](_0xd888c5)[_0x46b9('0x25')](handleEntityNotFound(_0xf94150,null))[_0x46b9('0x25')](respondWithResult(_0xf94150,null))[_0x46b9('0x42')](handleError(_0xf94150,null));};exports['create']=function(_0x38d90a,_0x13c0af){return db[_0x46b9('0x2b')][_0x46b9('0x47')](_0x38d90a[_0x46b9('0x48')],{})[_0x46b9('0x25')](respondWithResult(_0x13c0af,0xc9))['catch'](handleError(_0x13c0af,null));};exports['update']=function(_0x48565b,_0x311c2a){if(_0x48565b[_0x46b9('0x48')]['id']){delete _0x48565b[_0x46b9('0x48')]['id'];}return db[_0x46b9('0x2b')]['find']({'where':{'id':_0x48565b['params']['id']}})[_0x46b9('0x25')](handleEntityNotFound(_0x311c2a,null))[_0x46b9('0x25')](saveUpdates(_0x48565b[_0x46b9('0x48')],null))['then'](respondWithResult(_0x311c2a,null))[_0x46b9('0x42')](handleError(_0x311c2a,null));};exports[_0x46b9('0x49')]=function(_0x2b77cd,_0x1d1c30){return db[_0x46b9('0x2b')]['find']({'where':{'id':_0x2b77cd['params']['id']}})[_0x46b9('0x25')](handleEntityNotFound(_0x1d1c30,null))['then'](removeEntity(_0x1d1c30,null))[_0x46b9('0x42')](handleError(_0x1d1c30,null));};
\ No newline at end of file
index 46edb44..683a89c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2dd4=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment'];(function(_0x35f526,_0x19b256){var _0x2e817a=function(_0x2129b2){while(--_0x2129b2){_0x35f526['push'](_0x35f526['shift']());}};_0x2e817a(++_0x19b256);}(_0x2dd4,0x1e5));var _0x42dd=function(_0x504f1e,_0x1397e4){_0x504f1e=_0x504f1e-0x0;var _0x4009f6=_0x2dd4[_0x504f1e];return _0x4009f6;};'use strict';var _=require(_0x42dd('0x0'));var util=require(_0x42dd('0x1'));var logger=require(_0x42dd('0x2'))(_0x42dd('0x3'));var moment=require(_0x42dd('0x4'));var BPromise=require(_0x42dd('0x5'));var rp=require(_0x42dd('0x6'));var fs=require('fs');var path=require(_0x42dd('0x7'));var rimraf=require(_0x42dd('0x8'));var config=require(_0x42dd('0x9'));var attributes=require('./mailServerOut.attributes');module[_0x42dd('0xa')]=function(_0x2b8d75,_0x27b89c){return _0x2b8d75[_0x42dd('0xb')](_0x42dd('0xc'),attributes,{'tableName':_0x42dd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd950=['moment','bluebird','request-promise','../../config/environment','exports','define','MailServerOut','lodash','api'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0xd950,0x14b));var _0x0d95=function(_0x114060,_0x337ff3){_0x114060=_0x114060-0x0;var _0x3415d3=_0xd950[_0x114060];return _0x3415d3;};'use strict';var _=require(_0x0d95('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0d95('0x1'));var moment=require(_0x0d95('0x2'));var BPromise=require(_0x0d95('0x3'));var rp=require(_0x0d95('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0d95('0x5'));var attributes=require('./mailServerOut.attributes');module[_0x0d95('0x6')]=function(_0x416803,_0x37f568){return _0x416803[_0x0d95('0x7')](_0x0d95('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 82a133c..e317082 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x40482a,_0x301609){var _0x1d892b=function(_0x1b3931){while(--_0x1b3931){_0x40482a['push'](_0x40482a['shift']());}};_0x1d892b(++_0x301609);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc4aa[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}
\ No newline at end of file
+var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x4fab5e,_0x49f316){var _0x1a4b34=function(_0x449bc2){while(--_0x449bc2){_0x4fab5e['push'](_0x4fab5e['shift']());}};_0x1a4b34(++_0x49f316);}(_0xdb28,0x106));var _0x8db2=function(_0x49e253,_0x511a79){_0x49e253=_0x49e253-0x0;var _0x247d26=_0xdb28[_0x49e253];return _0x247d26;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}
\ No newline at end of file
index be29a76..45fc52c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd270=['express','Router','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x169052,_0x23b315){var _0x1798b4=function(_0x4e30e1){while(--_0x4e30e1){_0x169052['push'](_0x169052['shift']());}};_0x1798b4(++_0x23b315);}(_0xd270,0xb1));var _0x0d27=function(_0x38c20b,_0x2b832b){_0x38c20b=_0x38c20b-0x0;var _0x3f37b5=_0xd270[_0x38c20b];return _0x3f37b5;};'use strict';var multer=require('multer');var util=require(_0x0d27('0x0'));var path=require(_0x0d27('0x1'));var timeout=require(_0x0d27('0x2'));var express=require(_0x0d27('0x3'));var router=express[_0x0d27('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0d27('0x5'));var controller=require(_0x0d27('0x6'));router[_0x0d27('0x7')]('/',auth[_0x0d27('0x8')](),controller['index']);router[_0x0d27('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x0d27('0x9')]);router[_0x0d27('0x7')](_0x0d27('0xa'),auth[_0x0d27('0x8')](),controller[_0x0d27('0xb')]);router[_0x0d27('0xc')]('/',auth['isAuthenticated'](),controller[_0x0d27('0xd')]);router['put']('/:id',auth[_0x0d27('0x8')](),controller[_0x0d27('0xe')]);router[_0x0d27('0xf')]('/:id',auth[_0x0d27('0x8')](),controller[_0x0d27('0x10')]);module[_0x0d27('0x11')]=router;
\ No newline at end of file
+var _0x2447=['delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update'];(function(_0x1fb977,_0x1efdea){var _0x37fb64=function(_0x4830e7){while(--_0x4830e7){_0x1fb977['push'](_0x1fb977['shift']());}};_0x37fb64(++_0x1efdea);}(_0x2447,0xdf));var _0x7244=function(_0x2bb37a,_0x82e75b){_0x2bb37a=_0x2bb37a-0x0;var _0x4b0c99=_0x2447[_0x2bb37a];return _0x4b0c99;};'use strict';var multer=require(_0x7244('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7244('0x1'));var express=require('express');var router=express[_0x7244('0x2')]();var fs_extra=require(_0x7244('0x3'));var auth=require(_0x7244('0x4'));var interaction=require(_0x7244('0x5'));var config=require('../../config/environment');var controller=require(_0x7244('0x6'));router[_0x7244('0x7')]('/',auth[_0x7244('0x8')](),controller[_0x7244('0x9')]);router['get'](_0x7244('0xa'),auth['isAuthenticated'](),controller[_0x7244('0xb')]);router[_0x7244('0x7')](_0x7244('0xc'),auth[_0x7244('0x8')](),controller[_0x7244('0xd')]);router[_0x7244('0xe')]('/',auth[_0x7244('0x8')](),controller[_0x7244('0xf')]);router['put']('/:id',auth[_0x7244('0x8')](),controller[_0x7244('0x10')]);router[_0x7244('0x11')](_0x7244('0xc'),auth['isAuthenticated'](),controller[_0x7244('0x12')]);module[_0x7244('0x13')]=router;
\ No newline at end of file
index efb7783..7a8b06b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d9f=['sequelize','exports','STRING','name'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x5659f4,_0x3a072a){_0x5659f4=_0x5659f4-0x0;var _0x18e9a5=_0x7d9f[_0x5659f4];return _0x18e9a5;};'use strict';var Sequelize=require(_0xf7d9('0x0'));module[_0xf7d9('0x1')]={'name':{'type':Sequelize[_0xf7d9('0x2')],'unique':_0xf7d9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf7d9('0x2')]}};
\ No newline at end of file
+var _0xf767=['name','exports','STRING'];(function(_0x282e7a,_0x36d4ed){var _0x1395cc=function(_0x237653){while(--_0x237653){_0x282e7a['push'](_0x282e7a['shift']());}};_0x1395cc(++_0x36d4ed);}(_0xf767,0x76));var _0x7f76=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xf767[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require('sequelize');module[_0x7f76('0x0')]={'name':{'type':Sequelize[_0x7f76('0x1')],'unique':_0x7f76('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7f76('0x1')]}};
\ No newline at end of file
index 4354b68..3c243dc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0951=['Content-Range','reject','save','update','then','error','stack','name','send','map','MailSubstatus','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','params','rawAttributes','keys','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count'];(function(_0x579a0d,_0x1a8f8c){var _0x3c3791=function(_0x7adf8d){while(--_0x7adf8d){_0x579a0d['push'](_0x579a0d['shift']());}};_0x3c3791(++_0x1a8f8c);}(_0x0951,0x14c));var _0x1095=function(_0x2e2777,_0x461768){_0x2e2777=_0x2e2777-0x0;var _0xf899a5=_0x0951[_0x2e2777];return _0xf899a5;};'use strict';var emlformat=require(_0x1095('0x0'));var rimraf=require(_0x1095('0x1'));var zipdir=require(_0x1095('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1095('0x3'));var moment=require(_0x1095('0x4'));var BPromise=require(_0x1095('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1095('0x6'));var sox=require(_0x1095('0x7'));var csv=require(_0x1095('0x8'));var ejs=require(_0x1095('0x9'));var fs=require('fs');var fs_extra=require(_0x1095('0xa'));var _=require(_0x1095('0xb'));var squel=require(_0x1095('0xc'));var crypto=require(_0x1095('0xd'));var jsforce=require(_0x1095('0xe'));var deskjs=require(_0x1095('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1095('0x10'));var Papa=require(_0x1095('0x11'));var Redis=require(_0x1095('0x12'));var authService=require(_0x1095('0x13'));var qs=require(_0x1095('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1095('0x15'));var utils=require(_0x1095('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1095('0x17'));var db=require(_0x1095('0x18'))['db'];function respondWithStatusCode(_0x58eee8,_0x56ca8a){_0x56ca8a=_0x56ca8a||0xcc;return function(_0xf3d673){if(_0xf3d673){return _0x58eee8[_0x1095('0x19')](_0x56ca8a);}return _0x58eee8['status'](_0x56ca8a)[_0x1095('0x1a')]();};}function respondWithResult(_0x8e89f3,_0x54971e){_0x54971e=_0x54971e||0xc8;return function(_0x5dfeda){if(_0x5dfeda){return _0x8e89f3[_0x1095('0x1b')](_0x54971e)[_0x1095('0x1c')](_0x5dfeda);}};}function respondWithFilteredResult(_0x19d4f3,_0x10d849){return function(_0x2de891){if(_0x2de891){var _0x25d790=typeof _0x10d849[_0x1095('0x1d')]===_0x1095('0x1e')&&typeof _0x10d849[_0x1095('0x1f')]===_0x1095('0x1e');var _0x3e3ddd=_0x2de891[_0x1095('0x20')];var _0x4b144b=_0x25d790?0x0:_0x10d849['offset'];var _0x306f80=_0x25d790?_0x2de891[_0x1095('0x20')]:_0x10d849[_0x1095('0x1d')]+_0x10d849['limit'];var _0x2a1a68;if(_0x306f80>=_0x3e3ddd){_0x306f80=_0x3e3ddd;_0x2a1a68=0xc8;}else{_0x2a1a68=0xce;}_0x19d4f3[_0x1095('0x1b')](_0x2a1a68);return _0x19d4f3['set'](_0x1095('0x21'),_0x4b144b+'-'+_0x306f80+'/'+_0x3e3ddd)[_0x1095('0x1c')](_0x2de891);}return null;};}function patchUpdates(_0x39c85e){return function(_0x4d99c5){try{jsonpatch['apply'](_0x4d99c5,_0x39c85e,!![]);}catch(_0x11cc70){return BPromise[_0x1095('0x22')](_0x11cc70);}return _0x4d99c5[_0x1095('0x23')]();};}function saveUpdates(_0x3a82fd,_0x20876a){return function(_0x1cfdeb){if(_0x1cfdeb){return _0x1cfdeb[_0x1095('0x24')](_0x3a82fd)[_0x1095('0x25')](function(_0x5e08be){return _0x5e08be;});}return null;};}function removeEntity(_0x5b141d,_0x11f9d3){return function(_0x1a11e7){if(_0x1a11e7){return _0x1a11e7['destroy']()[_0x1095('0x25')](function(){_0x5b141d[_0x1095('0x1b')](0xcc)[_0x1095('0x1a')]();});}};}function handleEntityNotFound(_0x4fd102,_0xa04262){return function(_0x355a7b){if(!_0x355a7b){_0x4fd102[_0x1095('0x19')](0x194);}return _0x355a7b;};}function handleError(_0x4c5a03,_0x1f874f){_0x1f874f=_0x1f874f||0x1f4;return function(_0x52d143){logger[_0x1095('0x26')](_0x52d143[_0x1095('0x27')]);if(_0x52d143[_0x1095('0x28')]){delete _0x52d143[_0x1095('0x28')];}_0x4c5a03['status'](_0x1f874f)[_0x1095('0x29')](_0x52d143);};}exports['index']=function(_0x38dfcb,_0x5c1fb7){var _0x231150={},_0x872f0b={},_0x1133c0={'count':0x0,'rows':[]};var _0x6740b8=_[_0x1095('0x2a')](db[_0x1095('0x2b')]['rawAttributes'],function(_0x4cc850){return{'name':_0x4cc850['fieldName'],'type':_0x4cc850['type'][_0x1095('0x2c')]};});_0x872f0b['model']=_[_0x1095('0x2a')](_0x6740b8,'name');_0x872f0b[_0x1095('0x2d')]=_['keys'](_0x38dfcb[_0x1095('0x2d')]);_0x872f0b[_0x1095('0x2e')]=_['intersection'](_0x872f0b[_0x1095('0x2f')],_0x872f0b[_0x1095('0x2d')]);_0x231150['attributes']=_[_0x1095('0x30')](_0x872f0b[_0x1095('0x2f')],qs[_0x1095('0x31')](_0x38dfcb[_0x1095('0x2d')][_0x1095('0x31')]));_0x231150[_0x1095('0x32')]=_0x231150[_0x1095('0x32')][_0x1095('0x33')]?_0x231150[_0x1095('0x32')]:_0x872f0b['model'];if(!_0x38dfcb[_0x1095('0x2d')][_0x1095('0x34')]('nolimit')){_0x231150['limit']=qs[_0x1095('0x1f')](_0x38dfcb[_0x1095('0x2d')][_0x1095('0x1f')]);_0x231150[_0x1095('0x1d')]=qs['offset'](_0x38dfcb['query'][_0x1095('0x1d')]);}_0x231150['order']=qs['sort'](_0x38dfcb[_0x1095('0x2d')][_0x1095('0x35')]);_0x231150[_0x1095('0x36')]=qs[_0x1095('0x2e')](_[_0x1095('0x37')](_0x38dfcb[_0x1095('0x2d')],_0x872f0b[_0x1095('0x2e')]),_0x6740b8);if(_0x38dfcb[_0x1095('0x2d')][_0x1095('0x38')]){_0x231150[_0x1095('0x36')]=_[_0x1095('0x39')](_0x231150[_0x1095('0x36')],{'$or':_[_0x1095('0x2a')](_0x6740b8,function(_0x5620bd){if(_0x5620bd[_0x1095('0x3a')]!=='VIRTUAL'){var _0x5e69e6={};_0x5e69e6[_0x5620bd[_0x1095('0x28')]]={'$like':'%'+_0x38dfcb[_0x1095('0x2d')][_0x1095('0x38')]+'%'};return _0x5e69e6;}})});}_0x231150=_[_0x1095('0x39')]({},_0x231150,_0x38dfcb[_0x1095('0x3b')]);var _0x39710d={'where':_0x231150['where']};return db[_0x1095('0x2b')][_0x1095('0x20')](_0x39710d)[_0x1095('0x25')](function(_0x443adf){_0x1133c0['count']=_0x443adf;if(_0x38dfcb[_0x1095('0x2d')]['includeAll']){_0x231150[_0x1095('0x3c')]=[{'all':!![]}];}return db[_0x1095('0x2b')][_0x1095('0x3d')](_0x231150);})['then'](function(_0x5b3f24){_0x1133c0[_0x1095('0x3e')]=_0x5b3f24;return _0x1133c0;})[_0x1095('0x25')](respondWithFilteredResult(_0x5c1fb7,_0x231150))[_0x1095('0x3f')](handleError(_0x5c1fb7,null));};exports[_0x1095('0x40')]=function(_0x289ccd,_0x451dda){var _0x42f114={'raw':!![],'where':{'id':_0x289ccd[_0x1095('0x41')]['id']}},_0x235b9d={};_0x235b9d[_0x1095('0x2f')]=_['keys'](db['MailSubstatus'][_0x1095('0x42')]);_0x235b9d[_0x1095('0x2d')]=_[_0x1095('0x43')](_0x289ccd['query']);_0x235b9d[_0x1095('0x2e')]=_[_0x1095('0x30')](_0x235b9d[_0x1095('0x2f')],_0x235b9d[_0x1095('0x2d')]);_0x42f114['attributes']=_[_0x1095('0x30')](_0x235b9d[_0x1095('0x2f')],qs[_0x1095('0x31')](_0x289ccd[_0x1095('0x2d')][_0x1095('0x31')]));_0x42f114[_0x1095('0x32')]=_0x42f114[_0x1095('0x32')]['length']?_0x42f114['attributes']:_0x235b9d['model'];if(_0x289ccd['query'][_0x1095('0x44')]){_0x42f114[_0x1095('0x3c')]=[{'all':!![]}];}_0x42f114=_[_0x1095('0x39')]({},_0x42f114,_0x289ccd[_0x1095('0x3b')]);return db[_0x1095('0x2b')][_0x1095('0x45')](_0x42f114)[_0x1095('0x25')](handleEntityNotFound(_0x451dda,null))[_0x1095('0x25')](respondWithResult(_0x451dda,null))[_0x1095('0x3f')](handleError(_0x451dda,null));};exports[_0x1095('0x46')]=function(_0x298cb3,_0x3f60d3){return db['MailSubstatus'][_0x1095('0x46')](_0x298cb3[_0x1095('0x47')],{})['then'](respondWithResult(_0x3f60d3,0xc9))['catch'](handleError(_0x3f60d3,null));};exports[_0x1095('0x24')]=function(_0x5d00f4,_0x195c07){if(_0x5d00f4[_0x1095('0x47')]['id']){delete _0x5d00f4[_0x1095('0x47')]['id'];}return db[_0x1095('0x2b')][_0x1095('0x45')]({'where':{'id':_0x5d00f4[_0x1095('0x41')]['id']}})['then'](handleEntityNotFound(_0x195c07,null))[_0x1095('0x25')](saveUpdates(_0x5d00f4[_0x1095('0x47')],null))[_0x1095('0x25')](respondWithResult(_0x195c07,null))[_0x1095('0x3f')](handleError(_0x195c07,null));};exports['destroy']=function(_0x4b0782,_0x5ef4b5){return db[_0x1095('0x2b')][_0x1095('0x45')]({'where':{'id':_0x4b0782[_0x1095('0x41')]['id']}})[_0x1095('0x25')](handleEntityNotFound(_0x5ef4b5,null))[_0x1095('0x25')](removeEntity(_0x5ef4b5,null))['catch'](handleError(_0x5ef4b5,null));};exports[_0x1095('0x48')]=function(_0x313a57,_0x2354be){return db[_0x1095('0x2b')]['describe']()[_0x1095('0x25')](respondWithResult(_0x2354be,null))[_0x1095('0x3f')](handleError(_0x2354be,null));};
\ No newline at end of file
+var _0xf492=['model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','length','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','sendStatus','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','key'];(function(_0x5d5177,_0x24d3c8){var _0x195c11=function(_0x5e4f32){while(--_0x5e4f32){_0x5d5177['push'](_0x5d5177['shift']());}};_0x195c11(++_0x24d3c8);}(_0xf492,0xb2));var _0x2f49=function(_0xefe769,_0x5a3686){_0xefe769=_0xefe769-0x0;var _0x365b77=_0xf492[_0xefe769];return _0x365b77;};'use strict';var emlformat=require(_0x2f49('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2f49('0x1'));var jsonpatch=require(_0x2f49('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2f49('0x3'));var Mustache=require(_0x2f49('0x4'));var util=require(_0x2f49('0x5'));var path=require(_0x2f49('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f49('0x7'));var _=require('lodash');var squel=require(_0x2f49('0x8'));var crypto=require(_0x2f49('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x2f49('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2f49('0xb'));var Papa=require(_0x2f49('0xc'));var Redis=require('ioredis');var authService=require(_0x2f49('0xd'));var qs=require(_0x2f49('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f49('0xf'));var logger=require(_0x2f49('0x10'))(_0x2f49('0x11'));var utils=require(_0x2f49('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2f49('0x13'));var db=require(_0x2f49('0x14'))['db'];function respondWithStatusCode(_0x268291,_0x5ce73a){_0x5ce73a=_0x5ce73a||0xcc;return function(_0x5c71dc){if(_0x5c71dc){return _0x268291['sendStatus'](_0x5ce73a);}return _0x268291[_0x2f49('0x15')](_0x5ce73a)[_0x2f49('0x16')]();};}function respondWithResult(_0x38c784,_0x32e161){_0x32e161=_0x32e161||0xc8;return function(_0x21c21d){if(_0x21c21d){return _0x38c784[_0x2f49('0x15')](_0x32e161)[_0x2f49('0x17')](_0x21c21d);}};}function respondWithFilteredResult(_0x5195dd,_0x5cc8e1){return function(_0x15f86c){if(_0x15f86c){var _0x3c61d2=typeof _0x5cc8e1[_0x2f49('0x18')]==='undefined'&&typeof _0x5cc8e1['limit']===_0x2f49('0x19');var _0x29e1f0=_0x15f86c[_0x2f49('0x1a')];var _0x471313=_0x3c61d2?0x0:_0x5cc8e1['offset'];var _0x2f895a=_0x3c61d2?_0x15f86c[_0x2f49('0x1a')]:_0x5cc8e1[_0x2f49('0x18')]+_0x5cc8e1[_0x2f49('0x1b')];var _0x36c21c;if(_0x2f895a>=_0x29e1f0){_0x2f895a=_0x29e1f0;_0x36c21c=0xc8;}else{_0x36c21c=0xce;}_0x5195dd[_0x2f49('0x15')](_0x36c21c);return _0x5195dd[_0x2f49('0x1c')](_0x2f49('0x1d'),_0x471313+'-'+_0x2f895a+'/'+_0x29e1f0)[_0x2f49('0x17')](_0x15f86c);}return null;};}function patchUpdates(_0x2046ff){return function(_0x24871d){try{jsonpatch[_0x2f49('0x1e')](_0x24871d,_0x2046ff,!![]);}catch(_0x21bf67){return BPromise['reject'](_0x21bf67);}return _0x24871d[_0x2f49('0x1f')]();};}function saveUpdates(_0x38640a,_0x2087b8){return function(_0x5333a0){if(_0x5333a0){return _0x5333a0[_0x2f49('0x20')](_0x38640a)['then'](function(_0x3515d2){return _0x3515d2;});}return null;};}function removeEntity(_0xe88399,_0x2029b8){return function(_0x30b42f){if(_0x30b42f){return _0x30b42f['destroy']()['then'](function(){_0xe88399[_0x2f49('0x15')](0xcc)[_0x2f49('0x16')]();});}};}function handleEntityNotFound(_0x28e88a,_0x488c96){return function(_0x1d4c25){if(!_0x1d4c25){_0x28e88a[_0x2f49('0x21')](0x194);}return _0x1d4c25;};}function handleError(_0x1af2a4,_0x3576a8){_0x3576a8=_0x3576a8||0x1f4;return function(_0x435c43){logger[_0x2f49('0x22')](_0x435c43[_0x2f49('0x23')]);if(_0x435c43[_0x2f49('0x24')]){delete _0x435c43['name'];}_0x1af2a4['status'](_0x3576a8)[_0x2f49('0x25')](_0x435c43);};}exports[_0x2f49('0x26')]=function(_0x518678,_0x3e5ec9){var _0x22ca52={},_0xde49e3={},_0x1c4db1={'count':0x0,'rows':[]};var _0x44a54c=_[_0x2f49('0x27')](db[_0x2f49('0x28')][_0x2f49('0x29')],function(_0x14a1d5){return{'name':_0x14a1d5['fieldName'],'type':_0x14a1d5[_0x2f49('0x2a')][_0x2f49('0x2b')]};});_0xde49e3[_0x2f49('0x2c')]=_[_0x2f49('0x27')](_0x44a54c,_0x2f49('0x24'));_0xde49e3['query']=_[_0x2f49('0x2d')](_0x518678[_0x2f49('0x2e')]);_0xde49e3['filters']=_[_0x2f49('0x2f')](_0xde49e3[_0x2f49('0x2c')],_0xde49e3[_0x2f49('0x2e')]);_0x22ca52[_0x2f49('0x30')]=_[_0x2f49('0x2f')](_0xde49e3[_0x2f49('0x2c')],qs[_0x2f49('0x31')](_0x518678['query'][_0x2f49('0x31')]));_0x22ca52['attributes']=_0x22ca52[_0x2f49('0x30')]['length']?_0x22ca52[_0x2f49('0x30')]:_0xde49e3[_0x2f49('0x2c')];if(!_0x518678['query'][_0x2f49('0x32')](_0x2f49('0x33'))){_0x22ca52['limit']=qs[_0x2f49('0x1b')](_0x518678[_0x2f49('0x2e')][_0x2f49('0x1b')]);_0x22ca52['offset']=qs['offset'](_0x518678[_0x2f49('0x2e')][_0x2f49('0x18')]);}_0x22ca52['order']=qs[_0x2f49('0x34')](_0x518678[_0x2f49('0x2e')][_0x2f49('0x34')]);_0x22ca52[_0x2f49('0x35')]=qs[_0x2f49('0x36')](_[_0x2f49('0x37')](_0x518678['query'],_0xde49e3['filters']),_0x44a54c);if(_0x518678['query'][_0x2f49('0x38')]){_0x22ca52['where']=_[_0x2f49('0x39')](_0x22ca52[_0x2f49('0x35')],{'$or':_[_0x2f49('0x27')](_0x44a54c,function(_0x37fb09){if(_0x37fb09['type']!==_0x2f49('0x3a')){var _0xc70e98={};_0xc70e98[_0x37fb09['name']]={'$like':'%'+_0x518678[_0x2f49('0x2e')][_0x2f49('0x38')]+'%'};return _0xc70e98;}})});}_0x22ca52=_[_0x2f49('0x39')]({},_0x22ca52,_0x518678[_0x2f49('0x3b')]);var _0x5000a1={'where':_0x22ca52[_0x2f49('0x35')]};return db[_0x2f49('0x28')][_0x2f49('0x1a')](_0x5000a1)['then'](function(_0x20297f){_0x1c4db1[_0x2f49('0x1a')]=_0x20297f;if(_0x518678[_0x2f49('0x2e')][_0x2f49('0x3c')]){_0x22ca52[_0x2f49('0x3d')]=[{'all':!![]}];}return db[_0x2f49('0x28')][_0x2f49('0x3e')](_0x22ca52);})[_0x2f49('0x3f')](function(_0x39daeb){_0x1c4db1[_0x2f49('0x40')]=_0x39daeb;return _0x1c4db1;})[_0x2f49('0x3f')](respondWithFilteredResult(_0x3e5ec9,_0x22ca52))[_0x2f49('0x41')](handleError(_0x3e5ec9,null));};exports[_0x2f49('0x42')]=function(_0x474580,_0x9cc200){var _0x733311={'raw':!![],'where':{'id':_0x474580['params']['id']}},_0x3c0b31={};_0x3c0b31[_0x2f49('0x2c')]=_[_0x2f49('0x2d')](db[_0x2f49('0x28')][_0x2f49('0x29')]);_0x3c0b31[_0x2f49('0x2e')]=_[_0x2f49('0x2d')](_0x474580[_0x2f49('0x2e')]);_0x3c0b31['filters']=_[_0x2f49('0x2f')](_0x3c0b31['model'],_0x3c0b31[_0x2f49('0x2e')]);_0x733311[_0x2f49('0x30')]=_[_0x2f49('0x2f')](_0x3c0b31[_0x2f49('0x2c')],qs['fields'](_0x474580[_0x2f49('0x2e')][_0x2f49('0x31')]));_0x733311[_0x2f49('0x30')]=_0x733311[_0x2f49('0x30')][_0x2f49('0x43')]?_0x733311['attributes']:_0x3c0b31['model'];if(_0x474580['query'][_0x2f49('0x3c')]){_0x733311[_0x2f49('0x3d')]=[{'all':!![]}];}_0x733311=_['merge']({},_0x733311,_0x474580[_0x2f49('0x3b')]);return db['MailSubstatus'][_0x2f49('0x44')](_0x733311)['then'](handleEntityNotFound(_0x9cc200,null))[_0x2f49('0x3f')](respondWithResult(_0x9cc200,null))[_0x2f49('0x41')](handleError(_0x9cc200,null));};exports[_0x2f49('0x45')]=function(_0x5d48c7,_0x48f8e4){return db[_0x2f49('0x28')][_0x2f49('0x45')](_0x5d48c7['body'],{})[_0x2f49('0x3f')](respondWithResult(_0x48f8e4,0xc9))[_0x2f49('0x41')](handleError(_0x48f8e4,null));};exports[_0x2f49('0x20')]=function(_0x1198ae,_0x509ed3){if(_0x1198ae[_0x2f49('0x46')]['id']){delete _0x1198ae[_0x2f49('0x46')]['id'];}return db[_0x2f49('0x28')][_0x2f49('0x44')]({'where':{'id':_0x1198ae[_0x2f49('0x47')]['id']}})[_0x2f49('0x3f')](handleEntityNotFound(_0x509ed3,null))[_0x2f49('0x3f')](saveUpdates(_0x1198ae[_0x2f49('0x46')],null))[_0x2f49('0x3f')](respondWithResult(_0x509ed3,null))[_0x2f49('0x41')](handleError(_0x509ed3,null));};exports[_0x2f49('0x48')]=function(_0x1945ca,_0x43c061){return db[_0x2f49('0x28')]['find']({'where':{'id':_0x1945ca['params']['id']}})[_0x2f49('0x3f')](handleEntityNotFound(_0x43c061,null))[_0x2f49('0x3f')](removeEntity(_0x43c061,null))[_0x2f49('0x41')](handleError(_0x43c061,null));};exports['describe']=function(_0x55fb94,_0xcf5b94){return db['MailSubstatus'][_0x2f49('0x49')]()[_0x2f49('0x3f')](respondWithResult(_0xcf5b94,null))['catch'](handleError(_0xcf5b94,null));};
\ No newline at end of file
index b3e0ad0..4e4658e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ac4=['exports','events','setMaxListeners','update','emit','hook'];(function(_0x30b4dd,_0x1ab1e3){var _0x30d941=function(_0x1f00b0){while(--_0x1f00b0){_0x30b4dd['push'](_0x30b4dd['shift']());}};_0x30d941(++_0x1ab1e3);}(_0x1ac4,0x1bd));var _0x41ac=function(_0x17683e,_0x241e89){_0x17683e=_0x17683e-0x0;var _0x2ffd85=_0x1ac4[_0x17683e];return _0x2ffd85;};'use strict';var EventEmitter=require(_0x41ac('0x0'));var MailSubstatus=require('../../mysqldb')['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x41ac('0x1')](0x0);var events={'afterUpdate':_0x41ac('0x2')};function emitEvent(_0xa20b3f){return function(_0x14b40f,_0x158e44,_0x1085d7){MailSubstatusEvents[_0x41ac('0x3')](_0xa20b3f+':'+_0x14b40f['id'],_0x14b40f);MailSubstatusEvents[_0x41ac('0x3')](_0xa20b3f,_0x14b40f);_0x1085d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x41ac('0x4')](e,emitEvent(event));}}module[_0x41ac('0x5')]=MailSubstatusEvents;
\ No newline at end of file
+var _0x7b50=['hasOwnProperty','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','emit'];(function(_0x3a32e0,_0x69a2f1){var _0x43ae59=function(_0x234f2e){while(--_0x234f2e){_0x3a32e0['push'](_0x3a32e0['shift']());}};_0x43ae59(++_0x69a2f1);}(_0x7b50,0xb8));var _0x07b5=function(_0x542c8f,_0x381bf0){_0x542c8f=_0x542c8f-0x0;var _0x2c259c=_0x7b50[_0x542c8f];return _0x2c259c;};'use strict';var EventEmitter=require(_0x07b5('0x0'));var MailSubstatus=require(_0x07b5('0x1'))['db'][_0x07b5('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x07b5('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x29e048){return function(_0x1ac3e1,_0x50e1b1,_0x214506){MailSubstatusEvents[_0x07b5('0x4')](_0x29e048+':'+_0x1ac3e1['id'],_0x1ac3e1);MailSubstatusEvents[_0x07b5('0x4')](_0x29e048,_0x1ac3e1);_0x214506(null);};}for(var e in events){if(events[_0x07b5('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x07b5('0x6')]=MailSubstatusEvents;
\ No newline at end of file
index d53a200..8841a82 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd9b6=['name','mailSubstatus','_previousDataValues','./mailSubstatus.attributes','exports','models','MailSubstatus','Condition','update'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xd9b6,0x135));var _0x6d9b=function(_0x5eaa8a,_0x396d27){_0x5eaa8a=_0x5eaa8a-0x0;var _0x558bc8=_0xd9b6[_0x5eaa8a];return _0x558bc8;};'use strict';var attributes=require(_0x6d9b('0x0'));module[_0x6d9b('0x1')]=function(_0x3acdfd){var _0x1b8ed0=_0x3acdfd[_0x6d9b('0x2')];return _0x3acdfd['define'](_0x6d9b('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4e9ae2,_0x4d6808,_0x5fe4fb){return _0x1b8ed0[_0x6d9b('0x4')][_0x6d9b('0x5')]({'value':_0x4e9ae2[_0x6d9b('0x6')]},{'where':{'field':_0x6d9b('0x7'),'value':_0x4e9ae2[_0x6d9b('0x8')][_0x6d9b('0x6')]}})['then'](function(){_0x5fe4fb();})['catch'](function(_0x511171){_0x5fe4fb(_0x511171);});}}});};
\ No newline at end of file
+var _0x887b=['_previousDataValues','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','mailSubstatus'];(function(_0x2b6b4b,_0x2f8f34){var _0x30179b=function(_0x2a9eff){while(--_0x2a9eff){_0x2b6b4b['push'](_0x2b6b4b['shift']());}};_0x30179b(++_0x2f8f34);}(_0x887b,0x185));var _0xb887=function(_0x2f3344,_0x16be97){_0x2f3344=_0x2f3344-0x0;var _0x1b1c70=_0x887b[_0x2f3344];return _0x1b1c70;};'use strict';var attributes=require(_0xb887('0x0'));module[_0xb887('0x1')]=function(_0x2ee33d){var _0x1e203b=_0x2ee33d[_0xb887('0x2')];return _0x2ee33d[_0xb887('0x3')](_0xb887('0x4'),attributes,{'tableName':_0xb887('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1ada24,_0x4f521a,_0x165cac){return _0x1e203b['Condition']['update']({'value':_0x1ada24['name']},{'where':{'field':_0xb887('0x6'),'value':_0x1ada24[_0xb887('0x7')]['name']}})['then'](function(){_0x165cac();})[_0xb887('0x8')](function(_0x35019e){_0x165cac(_0x35019e);});}}});};
\ No newline at end of file
index 6c19215..23f06d2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x14ac=['then','info','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0xae4133,_0x53e5ee){var _0x16a17d=function(_0x3e67bf){while(--_0x3e67bf){_0xae4133['push'](_0xae4133['shift']());}};_0x16a17d(++_0x53e5ee);}(_0x14ac,0x9d));var _0xc14a=function(_0x8295d6,_0x263216){_0x8295d6=_0x8295d6-0x0;var _0x4fa9aa=_0x14ac[_0x8295d6];return _0x4fa9aa;};'use strict';var _=require(_0xc14a('0x0'));var util=require('util');var moment=require(_0xc14a('0x1'));var BPromise=require(_0xc14a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc14a('0x3'))['db'];var utils=require(_0xc14a('0x4'));var logger=require(_0xc14a('0x5'))(_0xc14a('0x6'));var config=require('../../config/environment');var jayson=require(_0xc14a('0x7'));var client=jayson[_0xc14a('0x8')][_0xc14a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27e917,_0x21836e,_0x5a4164){return new BPromise(function(_0x272427,_0x4d7aed){return client[_0xc14a('0xa')](_0x27e917,_0x5a4164)[_0xc14a('0xb')](function(_0x3595f5){logger[_0xc14a('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x21836e,_0xc14a('0xd'));logger['debug'](_0xc14a('0xe'),_0x21836e,'request\x20sent',JSON[_0xc14a('0xf')](_0x3595f5));if(_0x3595f5[_0xc14a('0x10')]){if(_0x3595f5[_0xc14a('0x10')]['code']===0x1f4){logger['error'](_0xc14a('0x11'),_0x21836e,_0x3595f5[_0xc14a('0x10')]['message']);return _0x4d7aed(_0x3595f5[_0xc14a('0x10')][_0xc14a('0x12')]);}logger[_0xc14a('0x10')](_0xc14a('0x11'),_0x21836e,_0x3595f5[_0xc14a('0x10')][_0xc14a('0x12')]);return _0x272427(_0x3595f5[_0xc14a('0x10')][_0xc14a('0x12')]);}else{logger[_0xc14a('0xc')](_0xc14a('0x11'),_0x21836e,_0xc14a('0xd'));_0x272427(_0x3595f5[_0xc14a('0x13')][_0xc14a('0x12')]);}})[_0xc14a('0x14')](function(_0x34f73c){logger['error'](_0xc14a('0x11'),_0x21836e,_0x34f73c);_0x4d7aed(_0x34f73c);});});}
\ No newline at end of file
+var _0xcd2a=['request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','MailSubstatus,\x20%s,\x20%s'];(function(_0x357a38,_0x3e905c){var _0x5327f9=function(_0x12b4a0){while(--_0x12b4a0){_0x357a38['push'](_0x357a38['shift']());}};_0x5327f9(++_0x3e905c);}(_0xcd2a,0x1d7));var _0xacd2=function(_0x5875ad,_0x3597b8){_0x5875ad=_0x5875ad-0x0;var _0x32a922=_0xcd2a[_0x5875ad];return _0x32a922;};'use strict';var _=require(_0xacd2('0x0'));var util=require('util');var moment=require(_0xacd2('0x1'));var BPromise=require('bluebird');var rs=require(_0xacd2('0x2'));var fs=require('fs');var Redis=require(_0xacd2('0x3'));var db=require(_0xacd2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xacd2('0x5'))(_0xacd2('0x6'));var config=require(_0xacd2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xacd2('0x8')][_0xacd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4294f7,_0x5cfa9b,_0x5ce9e2){return new BPromise(function(_0x35755d,_0x1b96db){return client['request'](_0x4294f7,_0x5ce9e2)[_0xacd2('0xa')](function(_0x1aad1a){logger['info'](_0xacd2('0xb'),_0x5cfa9b,_0xacd2('0xc'));logger[_0xacd2('0xd')](_0xacd2('0xe'),_0x5cfa9b,_0xacd2('0xc'),JSON[_0xacd2('0xf')](_0x1aad1a));if(_0x1aad1a['error']){if(_0x1aad1a[_0xacd2('0x10')][_0xacd2('0x11')]===0x1f4){logger[_0xacd2('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x5cfa9b,_0x1aad1a[_0xacd2('0x10')][_0xacd2('0x12')]);return _0x1b96db(_0x1aad1a[_0xacd2('0x10')][_0xacd2('0x12')]);}logger[_0xacd2('0x10')](_0xacd2('0xb'),_0x5cfa9b,_0x1aad1a['error'][_0xacd2('0x12')]);return _0x35755d(_0x1aad1a['error'][_0xacd2('0x12')]);}else{logger[_0xacd2('0x13')](_0xacd2('0xb'),_0x5cfa9b,_0xacd2('0xc'));_0x35755d(_0x1aad1a[_0xacd2('0x14')][_0xacd2('0x12')]);}})['catch'](function(_0x5e0206){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x5cfa9b,_0x5e0206);_0x1b96db(_0x5e0206);});});}
\ No newline at end of file
index 6073e8b..e068f67 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7543=['get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index'];(function(_0x8a87f9,_0x49bfe2){var _0x2136e0=function(_0x21211b){while(--_0x21211b){_0x8a87f9['push'](_0x8a87f9['shift']());}};_0x2136e0(++_0x49bfe2);}(_0x7543,0xab));var _0x3754=function(_0x381935,_0x593826){_0x381935=_0x381935-0x0;var _0x5231c9=_0x7543[_0x381935];return _0x5231c9;};'use strict';var multer=require(_0x3754('0x0'));var util=require('util');var path=require(_0x3754('0x1'));var timeout=require('connect-timeout');var express=require(_0x3754('0x2'));var router=express['Router']();var fs_extra=require(_0x3754('0x3'));var auth=require(_0x3754('0x4'));var interaction=require(_0x3754('0x5'));var config=require(_0x3754('0x6'));var controller=require(_0x3754('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3754('0x8')]);router[_0x3754('0x9')](_0x3754('0xa'),auth[_0x3754('0xb')](),controller[_0x3754('0xc')]);router[_0x3754('0x9')](_0x3754('0xd'),auth[_0x3754('0xb')](),controller[_0x3754('0xe')]);router[_0x3754('0xf')]('/',auth['isAuthenticated'](),controller[_0x3754('0x10')]);router[_0x3754('0x11')](_0x3754('0xd'),auth['isAuthenticated'](),controller[_0x3754('0x12')]);router['delete']('/:id',auth[_0x3754('0xb')](),controller['destroy']);module[_0x3754('0x13')]=router;
\ No newline at end of file
+var _0xb593=['/:id','update','delete','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','show','post','create','put'];(function(_0x59dccc,_0x184c1c){var _0xc97bcb=function(_0x1ddbcb){while(--_0x1ddbcb){_0x59dccc['push'](_0x59dccc['shift']());}};_0xc97bcb(++_0x184c1c);}(_0xb593,0x108));var _0x3b59=function(_0x35035e,_0x26bc1d){_0x35035e=_0x35035e-0x0;var _0x3a042f=_0xb593[_0x35035e];return _0x3a042f;};'use strict';var multer=require(_0x3b59('0x0'));var util=require(_0x3b59('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3b59('0x2'));var router=express['Router']();var fs_extra=require(_0x3b59('0x3'));var auth=require(_0x3b59('0x4'));var interaction=require(_0x3b59('0x5'));var config=require(_0x3b59('0x6'));var controller=require(_0x3b59('0x7'));router[_0x3b59('0x8')]('/',auth[_0x3b59('0x9')](),controller[_0x3b59('0xa')]);router[_0x3b59('0x8')]('/describe',auth[_0x3b59('0x9')](),controller[_0x3b59('0xb')]);router[_0x3b59('0x8')]('/:id',auth[_0x3b59('0x9')](),controller[_0x3b59('0xc')]);router[_0x3b59('0xd')]('/',auth[_0x3b59('0x9')](),controller[_0x3b59('0xe')]);router[_0x3b59('0xf')](_0x3b59('0x10'),auth['isAuthenticated'](),controller[_0x3b59('0x11')]);router[_0x3b59('0x12')](_0x3b59('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x3b59('0x13')]=router;
\ No newline at end of file
index 2fca039..1f14336 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x384c24,_0xc7388b){var _0x533876=function(_0x391966){while(--_0x391966){_0x384c24['push'](_0x384c24['shift']());}};_0x533876(++_0xc7388b);}(_0xe706,0xa3));var _0x6e70=function(_0x52a059,_0x46e42e){_0x52a059=_0x52a059-0x0;var _0x250df2=_0xe706[_0x52a059];return _0x250df2;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}};
\ No newline at end of file
+var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x911577,_0x4c2238){var _0x43f187=function(_0x4be87a){while(--_0x4be87a){_0x911577['push'](_0x911577['shift']());}};_0x43f187(++_0x4c2238);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0xcb91[_0x352e09];return _0x1b7094;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}};
\ No newline at end of file
index 770a91c..46e3687 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaf83=['mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','then','stack','name','send','map','MailTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4e3209,_0x4da52d){var _0x4b36d0=function(_0x2c1e81){while(--_0x2c1e81){_0x4e3209['push'](_0x4e3209['shift']());}};_0x4b36d0(++_0x4da52d);}(_0xaf83,0x1b6));var _0x3af8=function(_0x64fa65,_0x395060){_0x64fa65=_0x64fa65-0x0;var _0x4395ef=_0xaf83[_0x64fa65];return _0x4395ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3af8('0x0'));var zipdir=require(_0x3af8('0x1'));var jsonpatch=require(_0x3af8('0x2'));var rp=require(_0x3af8('0x3'));var moment=require(_0x3af8('0x4'));var BPromise=require(_0x3af8('0x5'));var Mustache=require(_0x3af8('0x6'));var util=require(_0x3af8('0x7'));var path=require(_0x3af8('0x8'));var sox=require(_0x3af8('0x9'));var csv=require('to-csv');var ejs=require(_0x3af8('0xa'));var fs=require('fs');var fs_extra=require(_0x3af8('0xb'));var _=require(_0x3af8('0xc'));var squel=require(_0x3af8('0xd'));var crypto=require(_0x3af8('0xe'));var jsforce=require(_0x3af8('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3af8('0x10'));var Redis=require('ioredis');var authService=require(_0x3af8('0x11'));var qs=require(_0x3af8('0x12'));var as=require(_0x3af8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3af8('0x14'))('api');var utils=require(_0x3af8('0x15'));var config=require(_0x3af8('0x16'));var licenseUtil=require(_0x3af8('0x17'));var db=require(_0x3af8('0x18'))['db'];function respondWithStatusCode(_0xdd3b6d,_0x3bd1fc){_0x3bd1fc=_0x3bd1fc||0xcc;return function(_0x3a71c4){if(_0x3a71c4){return _0xdd3b6d[_0x3af8('0x19')](_0x3bd1fc);}return _0xdd3b6d[_0x3af8('0x1a')](_0x3bd1fc)[_0x3af8('0x1b')]();};}function respondWithResult(_0x860e6d,_0x414d96){_0x414d96=_0x414d96||0xc8;return function(_0x4c595a){if(_0x4c595a){return _0x860e6d['status'](_0x414d96)[_0x3af8('0x1c')](_0x4c595a);}};}function respondWithFilteredResult(_0x4c77eb,_0x525f14){return function(_0x1f76c0){if(_0x1f76c0){var _0x373afe=typeof _0x525f14[_0x3af8('0x1d')]===_0x3af8('0x1e')&&typeof _0x525f14['limit']===_0x3af8('0x1e');var _0x3f8102=_0x1f76c0[_0x3af8('0x1f')];var _0x9dab19=_0x373afe?0x0:_0x525f14[_0x3af8('0x1d')];var _0x258aa6=_0x373afe?_0x1f76c0[_0x3af8('0x1f')]:_0x525f14[_0x3af8('0x1d')]+_0x525f14[_0x3af8('0x20')];var _0xeab920;if(_0x258aa6>=_0x3f8102){_0x258aa6=_0x3f8102;_0xeab920=0xc8;}else{_0xeab920=0xce;}_0x4c77eb['status'](_0xeab920);return _0x4c77eb['set'](_0x3af8('0x21'),_0x9dab19+'-'+_0x258aa6+'/'+_0x3f8102)['json'](_0x1f76c0);}return null;};}function patchUpdates(_0x1fe957){return function(_0xde13e1){try{jsonpatch[_0x3af8('0x22')](_0xde13e1,_0x1fe957,!![]);}catch(_0x2b065b){return BPromise['reject'](_0x2b065b);}return _0xde13e1[_0x3af8('0x23')]();};}function saveUpdates(_0x28a83c,_0x22e31d){return function(_0x3d4bf9){if(_0x3d4bf9){return _0x3d4bf9[_0x3af8('0x24')](_0x28a83c)['then'](function(_0x4c82bd){return _0x4c82bd;});}return null;};}function removeEntity(_0x3e05cb,_0x1e371c){return function(_0x470290){if(_0x470290){return _0x470290[_0x3af8('0x25')]()[_0x3af8('0x26')](function(){_0x3e05cb[_0x3af8('0x1a')](0xcc)[_0x3af8('0x1b')]();});}};}function handleEntityNotFound(_0x150111,_0x4cfd64){return function(_0x50011f){if(!_0x50011f){_0x150111[_0x3af8('0x19')](0x194);}return _0x50011f;};}function handleError(_0x1fdf7b,_0x52df5d){_0x52df5d=_0x52df5d||0x1f4;return function(_0x393913){logger['error'](_0x393913[_0x3af8('0x27')]);if(_0x393913[_0x3af8('0x28')]){delete _0x393913[_0x3af8('0x28')];}_0x1fdf7b[_0x3af8('0x1a')](_0x52df5d)[_0x3af8('0x29')](_0x393913);};}exports['index']=function(_0x31c3a2,_0x47f456){var _0x480ac3={},_0x3b15f0={},_0x3500fb={'count':0x0,'rows':[]};var _0x16cff9=_[_0x3af8('0x2a')](db[_0x3af8('0x2b')][_0x3af8('0x2c')],function(_0x43923a){return{'name':_0x43923a['fieldName'],'type':_0x43923a[_0x3af8('0x2d')][_0x3af8('0x2e')]};});_0x3b15f0['model']=_[_0x3af8('0x2a')](_0x16cff9,_0x3af8('0x28'));_0x3b15f0[_0x3af8('0x2f')]=_[_0x3af8('0x30')](_0x31c3a2[_0x3af8('0x2f')]);_0x3b15f0[_0x3af8('0x31')]=_[_0x3af8('0x32')](_0x3b15f0[_0x3af8('0x33')],_0x3b15f0[_0x3af8('0x2f')]);_0x480ac3[_0x3af8('0x34')]=_[_0x3af8('0x32')](_0x3b15f0[_0x3af8('0x33')],qs[_0x3af8('0x35')](_0x31c3a2['query'][_0x3af8('0x35')]));_0x480ac3[_0x3af8('0x34')]=_0x480ac3[_0x3af8('0x34')][_0x3af8('0x36')]?_0x480ac3['attributes']:_0x3b15f0['model'];if(!_0x31c3a2[_0x3af8('0x2f')]['hasOwnProperty']('nolimit')){_0x480ac3[_0x3af8('0x20')]=qs['limit'](_0x31c3a2[_0x3af8('0x2f')][_0x3af8('0x20')]);_0x480ac3[_0x3af8('0x1d')]=qs['offset'](_0x31c3a2['query'][_0x3af8('0x1d')]);}_0x480ac3[_0x3af8('0x37')]=qs[_0x3af8('0x38')](_0x31c3a2[_0x3af8('0x2f')][_0x3af8('0x38')]);_0x480ac3[_0x3af8('0x39')]=qs[_0x3af8('0x31')](_[_0x3af8('0x3a')](_0x31c3a2[_0x3af8('0x2f')],_0x3b15f0[_0x3af8('0x31')]),_0x16cff9);if(_0x31c3a2[_0x3af8('0x2f')][_0x3af8('0x3b')]){_0x480ac3[_0x3af8('0x39')]=_[_0x3af8('0x3c')](_0x480ac3['where'],{'$or':_[_0x3af8('0x2a')](_0x16cff9,function(_0x2bd603){if(_0x2bd603['type']!==_0x3af8('0x3d')){var _0x118a26={};_0x118a26[_0x2bd603[_0x3af8('0x28')]]={'$like':'%'+_0x31c3a2[_0x3af8('0x2f')][_0x3af8('0x3b')]+'%'};return _0x118a26;}})});}_0x480ac3=_[_0x3af8('0x3c')]({},_0x480ac3,_0x31c3a2[_0x3af8('0x3e')]);var _0x59b0ba={'where':_0x480ac3['where']};return db[_0x3af8('0x2b')][_0x3af8('0x1f')](_0x59b0ba)[_0x3af8('0x26')](function(_0x318079){_0x3500fb['count']=_0x318079;if(_0x31c3a2[_0x3af8('0x2f')]['includeAll']){_0x480ac3[_0x3af8('0x3f')]=[{'all':!![]}];}return db['MailTransferReport'][_0x3af8('0x40')](_0x480ac3);})['then'](function(_0x160e2f){_0x3500fb[_0x3af8('0x41')]=_0x160e2f;return _0x3500fb;})['then'](respondWithFilteredResult(_0x47f456,_0x480ac3))[_0x3af8('0x42')](handleError(_0x47f456,null));};exports[_0x3af8('0x43')]=function(_0x472e6c,_0x1ffa95){var _0x1e4cf0={'raw':!![],'where':{'id':_0x472e6c['params']['id']}},_0x828659={};_0x828659[_0x3af8('0x33')]=_[_0x3af8('0x30')](db[_0x3af8('0x2b')][_0x3af8('0x2c')]);_0x828659[_0x3af8('0x2f')]=_[_0x3af8('0x30')](_0x472e6c['query']);_0x828659[_0x3af8('0x31')]=_['intersection'](_0x828659[_0x3af8('0x33')],_0x828659[_0x3af8('0x2f')]);_0x1e4cf0[_0x3af8('0x34')]=_[_0x3af8('0x32')](_0x828659[_0x3af8('0x33')],qs['fields'](_0x472e6c['query'][_0x3af8('0x35')]));_0x1e4cf0[_0x3af8('0x34')]=_0x1e4cf0[_0x3af8('0x34')][_0x3af8('0x36')]?_0x1e4cf0[_0x3af8('0x34')]:_0x828659[_0x3af8('0x33')];if(_0x472e6c[_0x3af8('0x2f')][_0x3af8('0x44')]){_0x1e4cf0[_0x3af8('0x3f')]=[{'all':!![]}];}_0x1e4cf0=_[_0x3af8('0x3c')]({},_0x1e4cf0,_0x472e6c[_0x3af8('0x3e')]);return db[_0x3af8('0x2b')][_0x3af8('0x45')](_0x1e4cf0)[_0x3af8('0x26')](handleEntityNotFound(_0x1ffa95,null))[_0x3af8('0x26')](respondWithResult(_0x1ffa95,null))['catch'](handleError(_0x1ffa95,null));};exports[_0x3af8('0x46')]=function(_0x477955,_0x9269e9){return db[_0x3af8('0x2b')]['create'](_0x477955[_0x3af8('0x47')],{})[_0x3af8('0x26')](respondWithResult(_0x9269e9,0xc9))[_0x3af8('0x42')](handleError(_0x9269e9,null));};exports[_0x3af8('0x24')]=function(_0x4581b5,_0x2786be){if(_0x4581b5[_0x3af8('0x47')]['id']){delete _0x4581b5['body']['id'];}return db[_0x3af8('0x2b')][_0x3af8('0x45')]({'where':{'id':_0x4581b5[_0x3af8('0x48')]['id']}})['then'](handleEntityNotFound(_0x2786be,null))['then'](saveUpdates(_0x4581b5[_0x3af8('0x47')],null))[_0x3af8('0x26')](respondWithResult(_0x2786be,null))[_0x3af8('0x42')](handleError(_0x2786be,null));};exports['destroy']=function(_0x1a77f3,_0x445ca7){return db[_0x3af8('0x2b')][_0x3af8('0x45')]({'where':{'id':_0x1a77f3[_0x3af8('0x48')]['id']}})[_0x3af8('0x26')](handleEntityNotFound(_0x445ca7,null))[_0x3af8('0x26')](removeEntity(_0x445ca7,null))['catch'](handleError(_0x445ca7,null));};exports['describe']=function(_0x3e6fef,_0x92cf56){return db[_0x3af8('0x2b')][_0x3af8('0x49')]()[_0x3af8('0x26')](respondWithResult(_0x92cf56,null))['catch'](handleError(_0x92cf56,null));};
\ No newline at end of file
+var _0xa908=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','MailTransferReport','rawAttributes','map','query','keys','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','length','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel'];(function(_0x58bfa7,_0x5b17ce){var _0xb0c62d=function(_0x26941e){while(--_0x26941e){_0x58bfa7['push'](_0x58bfa7['shift']());}};_0xb0c62d(++_0x5b17ce);}(_0xa908,0x176));var _0x8a90=function(_0x139154,_0x1548cf){_0x139154=_0x139154-0x0;var _0x5c2447=_0xa908[_0x139154];return _0x5c2447;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a90('0x0'));var zipdir=require(_0x8a90('0x1'));var jsonpatch=require(_0x8a90('0x2'));var rp=require('request-promise');var moment=require(_0x8a90('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8a90('0x4'));var util=require(_0x8a90('0x5'));var path=require(_0x8a90('0x6'));var sox=require(_0x8a90('0x7'));var csv=require(_0x8a90('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a90('0x9'));var _=require('lodash');var squel=require(_0x8a90('0xa'));var crypto=require(_0x8a90('0xb'));var jsforce=require(_0x8a90('0xc'));var deskjs=require(_0x8a90('0xd'));var toCsv=require(_0x8a90('0x8'));var querystring=require(_0x8a90('0xe'));var Papa=require(_0x8a90('0xf'));var Redis=require(_0x8a90('0x10'));var authService=require(_0x8a90('0x11'));var qs=require(_0x8a90('0x12'));var as=require(_0x8a90('0x13'));var hardwareService=require(_0x8a90('0x14'));var logger=require(_0x8a90('0x15'))(_0x8a90('0x16'));var utils=require('../../config/utils');var config=require(_0x8a90('0x17'));var licenseUtil=require(_0x8a90('0x18'));var db=require(_0x8a90('0x19'))['db'];function respondWithStatusCode(_0x76b5c1,_0xdf167){_0xdf167=_0xdf167||0xcc;return function(_0x270ac0){if(_0x270ac0){return _0x76b5c1['sendStatus'](_0xdf167);}return _0x76b5c1[_0x8a90('0x1a')](_0xdf167)[_0x8a90('0x1b')]();};}function respondWithResult(_0x4553d3,_0x8bdfab){_0x8bdfab=_0x8bdfab||0xc8;return function(_0xca2b0b){if(_0xca2b0b){return _0x4553d3[_0x8a90('0x1a')](_0x8bdfab)[_0x8a90('0x1c')](_0xca2b0b);}};}function respondWithFilteredResult(_0x14af6e,_0xe56024){return function(_0x5c8f65){if(_0x5c8f65){var _0x413bb2=typeof _0xe56024[_0x8a90('0x1d')]==='undefined'&&typeof _0xe56024[_0x8a90('0x1e')]===_0x8a90('0x1f');var _0x41cf9a=_0x5c8f65[_0x8a90('0x20')];var _0x10744c=_0x413bb2?0x0:_0xe56024[_0x8a90('0x1d')];var _0x3c0d4b=_0x413bb2?_0x5c8f65['count']:_0xe56024['offset']+_0xe56024['limit'];var _0x22b58c;if(_0x3c0d4b>=_0x41cf9a){_0x3c0d4b=_0x41cf9a;_0x22b58c=0xc8;}else{_0x22b58c=0xce;}_0x14af6e[_0x8a90('0x1a')](_0x22b58c);return _0x14af6e[_0x8a90('0x21')](_0x8a90('0x22'),_0x10744c+'-'+_0x3c0d4b+'/'+_0x41cf9a)[_0x8a90('0x1c')](_0x5c8f65);}return null;};}function patchUpdates(_0x1bfacf){return function(_0x5f4e08){try{jsonpatch[_0x8a90('0x23')](_0x5f4e08,_0x1bfacf,!![]);}catch(_0x5be85c){return BPromise[_0x8a90('0x24')](_0x5be85c);}return _0x5f4e08[_0x8a90('0x25')]();};}function saveUpdates(_0x49358c,_0x1fdba5){return function(_0x28989b){if(_0x28989b){return _0x28989b[_0x8a90('0x26')](_0x49358c)[_0x8a90('0x27')](function(_0x22db2d){return _0x22db2d;});}return null;};}function removeEntity(_0x2c691b,_0x35c5fa){return function(_0x101565){if(_0x101565){return _0x101565[_0x8a90('0x28')]()[_0x8a90('0x27')](function(){_0x2c691b[_0x8a90('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25e6de,_0x54b4ee){return function(_0x4d66b9){if(!_0x4d66b9){_0x25e6de[_0x8a90('0x29')](0x194);}return _0x4d66b9;};}function handleError(_0x125b12,_0x20700c){_0x20700c=_0x20700c||0x1f4;return function(_0x31ae76){logger[_0x8a90('0x2a')](_0x31ae76[_0x8a90('0x2b')]);if(_0x31ae76[_0x8a90('0x2c')]){delete _0x31ae76[_0x8a90('0x2c')];}_0x125b12[_0x8a90('0x1a')](_0x20700c)[_0x8a90('0x2d')](_0x31ae76);};}exports[_0x8a90('0x2e')]=function(_0x3e8670,_0x381b6a){var _0x23b0e6={},_0x48bf0d={},_0x264036={'count':0x0,'rows':[]};var _0x157e8f=_['map'](db[_0x8a90('0x2f')][_0x8a90('0x30')],function(_0x454df3){return{'name':_0x454df3['fieldName'],'type':_0x454df3['type']['key']};});_0x48bf0d['model']=_[_0x8a90('0x31')](_0x157e8f,_0x8a90('0x2c'));_0x48bf0d[_0x8a90('0x32')]=_[_0x8a90('0x33')](_0x3e8670[_0x8a90('0x32')]);_0x48bf0d[_0x8a90('0x34')]=_[_0x8a90('0x35')](_0x48bf0d[_0x8a90('0x36')],_0x48bf0d[_0x8a90('0x32')]);_0x23b0e6[_0x8a90('0x37')]=_['intersection'](_0x48bf0d['model'],qs[_0x8a90('0x38')](_0x3e8670[_0x8a90('0x32')][_0x8a90('0x38')]));_0x23b0e6[_0x8a90('0x37')]=_0x23b0e6[_0x8a90('0x37')]['length']?_0x23b0e6[_0x8a90('0x37')]:_0x48bf0d[_0x8a90('0x36')];if(!_0x3e8670[_0x8a90('0x32')]['hasOwnProperty']('nolimit')){_0x23b0e6['limit']=qs['limit'](_0x3e8670[_0x8a90('0x32')][_0x8a90('0x1e')]);_0x23b0e6[_0x8a90('0x1d')]=qs[_0x8a90('0x1d')](_0x3e8670[_0x8a90('0x32')][_0x8a90('0x1d')]);}_0x23b0e6[_0x8a90('0x39')]=qs[_0x8a90('0x3a')](_0x3e8670[_0x8a90('0x32')][_0x8a90('0x3a')]);_0x23b0e6[_0x8a90('0x3b')]=qs['filters'](_[_0x8a90('0x3c')](_0x3e8670['query'],_0x48bf0d[_0x8a90('0x34')]),_0x157e8f);if(_0x3e8670[_0x8a90('0x32')][_0x8a90('0x3d')]){_0x23b0e6[_0x8a90('0x3b')]=_[_0x8a90('0x3e')](_0x23b0e6[_0x8a90('0x3b')],{'$or':_[_0x8a90('0x31')](_0x157e8f,function(_0x51ed2e){if(_0x51ed2e[_0x8a90('0x3f')]!==_0x8a90('0x40')){var _0x3d2709={};_0x3d2709[_0x51ed2e['name']]={'$like':'%'+_0x3e8670[_0x8a90('0x32')][_0x8a90('0x3d')]+'%'};return _0x3d2709;}})});}_0x23b0e6=_['merge']({},_0x23b0e6,_0x3e8670['options']);var _0x94155c={'where':_0x23b0e6['where']};return db['MailTransferReport'][_0x8a90('0x20')](_0x94155c)[_0x8a90('0x27')](function(_0x4ba36a){_0x264036[_0x8a90('0x20')]=_0x4ba36a;if(_0x3e8670[_0x8a90('0x32')][_0x8a90('0x41')]){_0x23b0e6[_0x8a90('0x42')]=[{'all':!![]}];}return db[_0x8a90('0x2f')]['findAll'](_0x23b0e6);})[_0x8a90('0x27')](function(_0x5ee383){_0x264036[_0x8a90('0x43')]=_0x5ee383;return _0x264036;})[_0x8a90('0x27')](respondWithFilteredResult(_0x381b6a,_0x23b0e6))[_0x8a90('0x44')](handleError(_0x381b6a,null));};exports[_0x8a90('0x45')]=function(_0x3e7368,_0x1299ee){var _0x100f7b={'raw':!![],'where':{'id':_0x3e7368[_0x8a90('0x46')]['id']}},_0xb54a55={};_0xb54a55[_0x8a90('0x36')]=_[_0x8a90('0x33')](db['MailTransferReport'][_0x8a90('0x30')]);_0xb54a55[_0x8a90('0x32')]=_[_0x8a90('0x33')](_0x3e7368[_0x8a90('0x32')]);_0xb54a55['filters']=_[_0x8a90('0x35')](_0xb54a55[_0x8a90('0x36')],_0xb54a55[_0x8a90('0x32')]);_0x100f7b['attributes']=_['intersection'](_0xb54a55['model'],qs[_0x8a90('0x38')](_0x3e7368[_0x8a90('0x32')][_0x8a90('0x38')]));_0x100f7b['attributes']=_0x100f7b[_0x8a90('0x37')][_0x8a90('0x47')]?_0x100f7b[_0x8a90('0x37')]:_0xb54a55[_0x8a90('0x36')];if(_0x3e7368[_0x8a90('0x32')][_0x8a90('0x41')]){_0x100f7b[_0x8a90('0x42')]=[{'all':!![]}];}_0x100f7b=_[_0x8a90('0x3e')]({},_0x100f7b,_0x3e7368[_0x8a90('0x48')]);return db[_0x8a90('0x2f')][_0x8a90('0x49')](_0x100f7b)['then'](handleEntityNotFound(_0x1299ee,null))[_0x8a90('0x27')](respondWithResult(_0x1299ee,null))[_0x8a90('0x44')](handleError(_0x1299ee,null));};exports[_0x8a90('0x4a')]=function(_0x5c4ce8,_0xdda600){return db[_0x8a90('0x2f')][_0x8a90('0x4a')](_0x5c4ce8[_0x8a90('0x4b')],{})[_0x8a90('0x27')](respondWithResult(_0xdda600,0xc9))[_0x8a90('0x44')](handleError(_0xdda600,null));};exports[_0x8a90('0x26')]=function(_0x130bca,_0x4f816a){if(_0x130bca['body']['id']){delete _0x130bca['body']['id'];}return db[_0x8a90('0x2f')]['find']({'where':{'id':_0x130bca['params']['id']}})[_0x8a90('0x27')](handleEntityNotFound(_0x4f816a,null))['then'](saveUpdates(_0x130bca[_0x8a90('0x4b')],null))[_0x8a90('0x27')](respondWithResult(_0x4f816a,null))['catch'](handleError(_0x4f816a,null));};exports[_0x8a90('0x28')]=function(_0x21029e,_0xf39283){return db[_0x8a90('0x2f')][_0x8a90('0x49')]({'where':{'id':_0x21029e[_0x8a90('0x46')]['id']}})[_0x8a90('0x27')](handleEntityNotFound(_0xf39283,null))[_0x8a90('0x27')](removeEntity(_0xf39283,null))[_0x8a90('0x44')](handleError(_0xf39283,null));};exports[_0x8a90('0x4c')]=function(_0x2b710a,_0x1ff448){return db['MailTransferReport']['describe']()[_0x8a90('0x27')](respondWithResult(_0x1ff448,null))[_0x8a90('0x44')](handleError(_0x1ff448,null));};
\ No newline at end of file
index bcece76..d638bff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcff4=['./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0xcff4,0x6d));var _0x4cff=function(_0x3d37b3,_0x252695){_0x3d37b3=_0x3d37b3-0x0;var _0x4c3538=_0xcff4[_0x3d37b3];return _0x4c3538;};'use strict';var _=require(_0x4cff('0x0'));var util=require(_0x4cff('0x1'));var logger=require(_0x4cff('0x2'))(_0x4cff('0x3'));var moment=require(_0x4cff('0x4'));var BPromise=require(_0x4cff('0x5'));var rp=require(_0x4cff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4cff('0x7'));var attributes=require(_0x4cff('0x8'));module[_0x4cff('0x9')]=function(_0x47776b,_0x1c0783){return _0x47776b[_0x4cff('0xa')]('MailTransferReport',attributes,{'tableName':_0x4cff('0xb'),'paranoid':![],'indexes':[{'name':_0x4cff('0xc'),'fields':[_0x4cff('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x55d2=['MailTransferReport','report_mail_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x59129d,_0x3b438a){var _0x358c75=function(_0x5963b8){while(--_0x5963b8){_0x59129d['push'](_0x59129d['shift']());}};_0x358c75(++_0x3b438a);}(_0x55d2,0x9f));var _0x255d=function(_0x4817f9,_0x4070d1){_0x4817f9=_0x4817f9-0x0;var _0x2dcfa6=_0x55d2[_0x4817f9];return _0x2dcfa6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x255d('0x0'))(_0x255d('0x1'));var moment=require(_0x255d('0x2'));var BPromise=require(_0x255d('0x3'));var rp=require(_0x255d('0x4'));var fs=require('fs');var path=require(_0x255d('0x5'));var rimraf=require('rimraf');var config=require(_0x255d('0x6'));var attributes=require(_0x255d('0x7'));module[_0x255d('0x8')]=function(_0x38017a,_0x58dae4){return _0x38017a['define'](_0x255d('0x9'),attributes,{'tableName':_0x255d('0xa'),'paranoid':![],'indexes':[{'name':_0x255d('0xb'),'fields':[_0x255d('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
index 6aa9632..61e12cb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd118=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','catch','lodash'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd118,0x13f));var _0x8d11=function(_0x2c6eb0,_0x28fef8){_0x2c6eb0=_0x2c6eb0-0x0;var _0x23226b=_0xd118[_0x2c6eb0];return _0x23226b;};'use strict';var _=require(_0x8d11('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8d11('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d11('0x2'));var db=require(_0x8d11('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d11('0x4'))(_0x8d11('0x5'));var config=require(_0x8d11('0x6'));var jayson=require(_0x8d11('0x7'));var client=jayson[_0x8d11('0x8')][_0x8d11('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4055eb,_0x510445,_0x20e413){return new BPromise(function(_0x52a28f,_0x25a5ca){return client[_0x8d11('0xa')](_0x4055eb,_0x20e413)[_0x8d11('0xb')](function(_0x30227c){logger[_0x8d11('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x510445,_0x8d11('0xd'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x510445,_0x8d11('0xd'),JSON[_0x8d11('0xe')](_0x30227c));if(_0x30227c['error']){if(_0x30227c[_0x8d11('0xf')][_0x8d11('0x10')]===0x1f4){logger[_0x8d11('0xf')](_0x8d11('0x11'),_0x510445,_0x30227c['error'][_0x8d11('0x12')]);return _0x25a5ca(_0x30227c[_0x8d11('0xf')][_0x8d11('0x12')]);}logger['error'](_0x8d11('0x11'),_0x510445,_0x30227c[_0x8d11('0xf')][_0x8d11('0x12')]);return _0x52a28f(_0x30227c[_0x8d11('0xf')]['message']);}else{logger[_0x8d11('0xc')](_0x8d11('0x11'),_0x510445,_0x8d11('0xd'));_0x52a28f(_0x30227c['result'][_0x8d11('0x12')]);}})[_0x8d11('0x13')](function(_0x1dea97){logger[_0x8d11('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x510445,_0x1dea97);_0x25a5ca(_0x1dea97);});});}
\ No newline at end of file
+var _0xc764=['stringify','code','error','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x1416b6,_0x342ed2){var _0x1753b4=function(_0x28881f){while(--_0x28881f){_0x1416b6['push'](_0x1416b6['shift']());}};_0x1753b4(++_0x342ed2);}(_0xc764,0x145));var _0x4c76=function(_0x4819c3,_0x36732d){_0x4819c3=_0x4819c3-0x0;var _0x3c6537=_0xc764[_0x4819c3];return _0x3c6537;};'use strict';var _=require(_0x4c76('0x0'));var util=require(_0x4c76('0x1'));var moment=require(_0x4c76('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c76('0x3'));var db=require(_0x4c76('0x4'))['db'];var utils=require(_0x4c76('0x5'));var logger=require('../../config/logger')(_0x4c76('0x6'));var config=require(_0x4c76('0x7'));var jayson=require(_0x4c76('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x341783,_0x5a2c4d,_0x2ad0f1){return new BPromise(function(_0x4b9f2b,_0x345fd8){return client[_0x4c76('0x9')](_0x341783,_0x2ad0f1)[_0x4c76('0xa')](function(_0x27e60a){logger['info'](_0x4c76('0xb'),_0x5a2c4d,_0x4c76('0xc'));logger[_0x4c76('0xd')](_0x4c76('0xe'),_0x5a2c4d,_0x4c76('0xc'),JSON[_0x4c76('0xf')](_0x27e60a));if(_0x27e60a['error']){if(_0x27e60a['error'][_0x4c76('0x10')]===0x1f4){logger[_0x4c76('0x11')](_0x4c76('0xb'),_0x5a2c4d,_0x27e60a[_0x4c76('0x11')]['message']);return _0x345fd8(_0x27e60a[_0x4c76('0x11')]['message']);}logger[_0x4c76('0x11')](_0x4c76('0xb'),_0x5a2c4d,_0x27e60a[_0x4c76('0x11')][_0x4c76('0x12')]);return _0x4b9f2b(_0x27e60a[_0x4c76('0x11')][_0x4c76('0x12')]);}else{logger['info'](_0x4c76('0xb'),_0x5a2c4d,_0x4c76('0xc'));_0x4b9f2b(_0x27e60a['result'][_0x4c76('0x12')]);}})[_0x4c76('0x13')](function(_0x24b917){logger[_0x4c76('0x11')](_0x4c76('0xb'),_0x5a2c4d,_0x24b917);_0x345fd8(_0x24b917);});});}
\ No newline at end of file
index dbcd05e..e13fe9e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x891e=['create','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0x891e,0x180));var _0xe891=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0x891e[_0x296897];return _0x2b44ab;};'use strict';var multer=require(_0xe891('0x0'));var util=require(_0xe891('0x1'));var path=require(_0xe891('0x2'));var timeout=require(_0xe891('0x3'));var express=require('express');var router=express[_0xe891('0x4')]();var fs_extra=require(_0xe891('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe891('0x6'));var controller=require(_0xe891('0x7'));router[_0xe891('0x8')]('/',auth[_0xe891('0x9')](),controller[_0xe891('0xa')]);router[_0xe891('0x8')](_0xe891('0xb'),auth[_0xe891('0x9')](),controller[_0xe891('0xc')]);router[_0xe891('0x8')](_0xe891('0xd'),auth[_0xe891('0x9')](),controller[_0xe891('0xe')]);router['post']('/',auth[_0xe891('0x9')](),controller[_0xe891('0xf')]);router[_0xe891('0x10')](_0xe891('0xd'),auth[_0xe891('0x9')](),controller['update']);router[_0xe891('0x11')](_0xe891('0xd'),auth[_0xe891('0x9')](),controller['destroy']);module[_0xe891('0x12')]=router;
\ No newline at end of file
+var _0x0c01=['index','/describe','describe','/:id','show','post','create','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2a96fe,_0x2d90f3){var _0x50c42b=function(_0x2d727a){while(--_0x2d727a){_0x2a96fe['push'](_0x2a96fe['shift']());}};_0x50c42b(++_0x2d90f3);}(_0x0c01,0x1b9));var _0x10c0=function(_0x4c012e,_0x2c8fdc){_0x4c012e=_0x4c012e-0x0;var _0x31f698=_0x0c01[_0x4c012e];return _0x31f698;};'use strict';var multer=require(_0x10c0('0x0'));var util=require(_0x10c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x10c0('0x2'));var router=express[_0x10c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x10c0('0x4'));var interaction=require(_0x10c0('0x5'));var config=require(_0x10c0('0x6'));var controller=require('./memberReport.controller');router[_0x10c0('0x7')]('/',auth[_0x10c0('0x8')](),controller[_0x10c0('0x9')]);router[_0x10c0('0x7')](_0x10c0('0xa'),auth['isAuthenticated'](),controller[_0x10c0('0xb')]);router[_0x10c0('0x7')](_0x10c0('0xc'),auth[_0x10c0('0x8')](),controller[_0x10c0('0xd')]);router[_0x10c0('0xe')]('/',auth[_0x10c0('0x8')](),controller[_0x10c0('0xf')]);router['put'](_0x10c0('0xc'),auth[_0x10c0('0x8')](),controller['update']);router[_0x10c0('0x10')](_0x10c0('0xc'),auth[_0x10c0('0x8')](),controller[_0x10c0('0x11')]);module['exports']=router;
\ No newline at end of file
index 3abeb70..2bcac8a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5b05=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports'];(function(_0x503654,_0x207ab4){var _0x1defc=function(_0x24f44e){while(--_0x24f44e){_0x503654['push'](_0x503654['shift']());}};_0x1defc(++_0x207ab4);}(_0x5b05,0x96));var _0x55b0=function(_0x23ac91,_0x13b3ed){_0x23ac91=_0x23ac91-0x0;var _0x4a5849=_0x5b05[_0x23ac91];return _0x4a5849;};'use strict';var Sequelize=require(_0x55b0('0x0'));var moment=require(_0x55b0('0x1'));module[_0x55b0('0x2')]={'channel':{'type':Sequelize[_0x55b0('0x3')]},'membername':{'type':Sequelize[_0x55b0('0x3')]},'interface':{'type':Sequelize[_0x55b0('0x3')]},'type':{'type':Sequelize[_0x55b0('0x3')],'defaultValue':_0x55b0('0x4'),'comment':_0x55b0('0x5')},'duration':{'type':Sequelize[_0x55b0('0x6')]},'enterAt':{'type':Sequelize[_0x55b0('0x7')]},'exitAt':{'type':Sequelize[_0x55b0('0x7')],'set':function(_0x3f8f4c){var _0x2ddec0=moment(_0x3f8f4c);var _0x4ebf53=moment(this[_0x55b0('0x8')](_0x55b0('0x9')));var _0x19e746=_0x2ddec0['diff'](_0x4ebf53,_0x55b0('0xa'));this[_0x55b0('0xb')]('exitAt',_0x3f8f4c);this['setDataValue'](_0x55b0('0xc'),_0x19e746>=0x0?_0x19e746:null);}},'data1':{'type':Sequelize[_0x55b0('0x3')],'comment':_0x55b0('0xd')},'data2':{'type':Sequelize[_0x55b0('0x3')],'comment':_0x55b0('0xe')},'data3':{'type':Sequelize[_0x55b0('0x3')],'comment':_0x55b0('0xf')},'data4':{'type':Sequelize[_0x55b0('0x3')],'comment':_0x55b0('0x10')},'data5':{'type':Sequelize[_0x55b0('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x55b0('0x3')]},'internal':{'type':Sequelize[_0x55b0('0x6')]},'uniqueid':{'type':Sequelize[_0x55b0('0x3')]}};
\ No newline at end of file
+var _0xfcfb=['setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','STRING','DATE','getDataValue','enterAt','diff','seconds'];(function(_0x1b338e,_0x25ac31){var _0x3ae2f4=function(_0x229fc5){while(--_0x229fc5){_0x1b338e['push'](_0x1b338e['shift']());}};_0x3ae2f4(++_0x25ac31);}(_0xfcfb,0x19d));var _0xbfcf=function(_0x52ab8a,_0xee034b){_0x52ab8a=_0x52ab8a-0x0;var _0x5d6ddc=_0xfcfb[_0x52ab8a];return _0x5d6ddc;};'use strict';var Sequelize=require(_0xbfcf('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0xbfcf('0x1')]},'membername':{'type':Sequelize[_0xbfcf('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbfcf('0x1')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xbfcf('0x2')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x2d8345){var _0x310197=moment(_0x2d8345);var _0x18d28c=moment(this[_0xbfcf('0x3')](_0xbfcf('0x4')));var _0xbe0a65=_0x310197[_0xbfcf('0x5')](_0x18d28c,_0xbfcf('0x6'));this[_0xbfcf('0x7')](_0xbfcf('0x8'),_0x2d8345);this['setDataValue'](_0xbfcf('0x9'),_0xbe0a65>=0x0?_0xbe0a65:null);}},'data1':{'type':Sequelize[_0xbfcf('0x1')],'comment':_0xbfcf('0xa')},'data2':{'type':Sequelize[_0xbfcf('0x1')],'comment':_0xbfcf('0xb')},'data3':{'type':Sequelize[_0xbfcf('0x1')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0xbfcf('0xc')},'data5':{'type':Sequelize['STRING'],'comment':_0xbfcf('0xd')},'role':{'type':Sequelize[_0xbfcf('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xbfcf('0x1')]}};
\ No newline at end of file
index be7ad3c..642b508 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x55ca,0x126));var _0xa55c=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x55ca[_0x122096];return _0x3d1966;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));};
\ No newline at end of file
+var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x3f8dfa,_0x4ca511){var _0x4fd797=function(_0x57eb4d){while(--_0x57eb4d){_0x3f8dfa['push'](_0x3f8dfa['shift']());}};_0x4fd797(++_0x4ca511);}(_0x3e74,0x175));var _0x43e7=function(_0xb82bf2,_0x5c3ff7){_0xb82bf2=_0xb82bf2-0x0;var _0x5718da=_0x3e74[_0xb82bf2];return _0x5718da;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));};
\ No newline at end of file
index 379d878..d9a39af 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb138=['interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./memberReport.attributes','MemberReport','report_member','membername_interface'];(function(_0x46a196,_0x4c4bb0){var _0x1507b1=function(_0x2c4991){while(--_0x2c4991){_0x46a196['push'](_0x46a196['shift']());}};_0x1507b1(++_0x4c4bb0);}(_0xb138,0x1dd));var _0x8b13=function(_0x5214b0,_0x546abd){_0x5214b0=_0x5214b0-0x0;var _0x58af72=_0xb138[_0x5214b0];return _0x58af72;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('0xb'),'paranoid':![],'indexes':[{'name':_0x8b13('0xc'),'fields':['membername',_0x8b13('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xa99d=['membername_interface','membername','interface','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','report_member'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xa99d,0xb3));var _0xda99=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0xa99d[_0x52085a];return _0x5afc1a;};'use strict';var _=require(_0xda99('0x0'));var util=require(_0xda99('0x1'));var logger=require(_0xda99('0x2'))(_0xda99('0x3'));var moment=require('moment');var BPromise=require(_0xda99('0x4'));var rp=require(_0xda99('0x5'));var fs=require('fs');var path=require(_0xda99('0x6'));var rimraf=require(_0xda99('0x7'));var config=require(_0xda99('0x8'));var attributes=require(_0xda99('0x9'));module[_0xda99('0xa')]=function(_0x417bc8,_0x5f1a30){return _0x417bc8[_0xda99('0xb')]('MemberReport',attributes,{'tableName':_0xda99('0xc'),'paranoid':![],'indexes':[{'name':_0xda99('0xd'),'fields':[_0xda99('0xe'),_0xda99('0xf')]}],'timestamps':!![]});};
\ No newline at end of file
index f8b32b6..a397ad9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf52f=['model','GetMemberReport','catch','CreateMemberReport','create','body','UpdateMemberReport','MemberReport','update','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','options','raw','where','attributes','limit','include','map'];(function(_0x1781d9,_0x479026){var _0x50c607=function(_0x1302e1){while(--_0x1302e1){_0x1781d9['push'](_0x1781d9['shift']());}};_0x50c607(++_0x479026);}(_0xf52f,0x113));var _0xff52=function(_0x4cbec2,_0x3e354f){_0x4cbec2=_0x4cbec2-0x0;var _0x207cd4=_0xf52f[_0x4cbec2];return _0x207cd4;};'use strict';var _=require(_0xff52('0x0'));var util=require(_0xff52('0x1'));var moment=require(_0xff52('0x2'));var BPromise=require('bluebird');var rs=require(_0xff52('0x3'));var fs=require('fs');var Redis=require(_0xff52('0x4'));var db=require(_0xff52('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xff52('0x6'))(_0xff52('0x7'));var config=require('../../config/environment');var jayson=require(_0xff52('0x8'));var client=jayson[_0xff52('0x9')][_0xff52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x328920,_0x64f10b,_0x17af4a){return new BPromise(function(_0x2e80a0,_0x10dcbe){return client[_0xff52('0xb')](_0x328920,_0x17af4a)[_0xff52('0xc')](function(_0x34f1f9){logger[_0xff52('0xd')](_0xff52('0xe'),_0x64f10b,_0xff52('0xf'));logger[_0xff52('0x10')](_0xff52('0x11'),_0x64f10b,_0xff52('0xf'),JSON[_0xff52('0x12')](_0x34f1f9));if(_0x34f1f9[_0xff52('0x13')]){if(_0x34f1f9['error']['code']===0x1f4){logger[_0xff52('0x13')]('MemberReport,\x20%s,\x20%s',_0x64f10b,_0x34f1f9[_0xff52('0x13')][_0xff52('0x14')]);return _0x10dcbe(_0x34f1f9[_0xff52('0x13')][_0xff52('0x14')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x64f10b,_0x34f1f9['error'][_0xff52('0x14')]);return _0x2e80a0(_0x34f1f9['error']['message']);}else{logger[_0xff52('0xd')](_0xff52('0xe'),_0x64f10b,_0xff52('0xf'));_0x2e80a0(_0x34f1f9[_0xff52('0x15')][_0xff52('0x14')]);}})['catch'](function(_0x853d6b){logger['error'](_0xff52('0xe'),_0x64f10b,_0x853d6b);_0x10dcbe(_0x853d6b);});});}exports['GetMemberReport']=function(_0x568cad){var _0x1de477=this;return new Promise(function(_0x28601f,_0x1929f7){return db['MemberReport']['findAll']({'raw':_0x568cad[_0xff52('0x16')]?_0x568cad[_0xff52('0x16')][_0xff52('0x17')]===undefined?!![]:![]:!![],'where':_0x568cad[_0xff52('0x16')]?_0x568cad['options'][_0xff52('0x18')]||null:null,'attributes':_0x568cad[_0xff52('0x16')]?_0x568cad[_0xff52('0x16')][_0xff52('0x19')]||null:null,'limit':_0x568cad[_0xff52('0x16')]?_0x568cad[_0xff52('0x16')][_0xff52('0x1a')]||null:null,'include':_0x568cad[_0xff52('0x16')]?_0x568cad['options'][_0xff52('0x1b')]?_[_0xff52('0x1c')](_0x568cad['options'][_0xff52('0x1b')],function(_0x3cf849){return{'model':db[_0x3cf849['model']],'as':_0x3cf849['as'],'attributes':_0x3cf849[_0xff52('0x19')],'include':_0x3cf849['include']?_['map'](_0x3cf849['include'],function(_0x363857){return{'model':db[_0x363857[_0xff52('0x1d')]],'as':_0x363857['as'],'attributes':_0x363857[_0xff52('0x19')],'include':_0x363857[_0xff52('0x1b')]?_[_0xff52('0x1c')](_0x363857[_0xff52('0x1b')],function(_0x25225b){return{'model':db[_0x25225b[_0xff52('0x1d')]],'as':_0x25225b['as'],'attributes':_0x25225b[_0xff52('0x19')]};}):[]};}):[]};}):[]:[]})[_0xff52('0xc')](function(_0x4a7697){logger[_0xff52('0xd')](_0xff52('0x1e'),_0x568cad);logger['debug'](_0xff52('0x1e'),_0x568cad,JSON[_0xff52('0x12')](_0x4a7697));_0x28601f(_0x4a7697);})[_0xff52('0x1f')](function(_0x1cb50f){logger[_0xff52('0x13')]('GetMemberReport',_0x1cb50f[_0xff52('0x14')],_0x568cad);_0x1929f7(_0x1de477['error'](0x1f4,_0x1cb50f[_0xff52('0x14')]));});});};exports[_0xff52('0x20')]=function(_0x45522a){var _0x4743d6=this;return new Promise(function(_0x94faa5,_0x50aaf2){return db['MemberReport'][_0xff52('0x21')](_0x45522a[_0xff52('0x22')],{'raw':_0x45522a[_0xff52('0x16')]?_0x45522a['options'][_0xff52('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x228473){logger[_0xff52('0xd')]('CreateMemberReport',_0x45522a);logger[_0xff52('0x10')](_0xff52('0x20'),_0x45522a,JSON[_0xff52('0x12')](_0x228473));_0x94faa5(_0x228473);})[_0xff52('0x1f')](function(_0x2064d9){logger[_0xff52('0x13')](_0xff52('0x20'),_0x2064d9[_0xff52('0x14')],_0x45522a);_0x50aaf2(_0x4743d6[_0xff52('0x13')](0x1f4,_0x2064d9[_0xff52('0x14')]));});});};exports[_0xff52('0x23')]=function(_0x48f7ee){var _0x1a9968=this;return new Promise(function(_0x20f7d6,_0x48167a){return db[_0xff52('0x24')][_0xff52('0x25')](_0x48f7ee[_0xff52('0x22')],{'raw':_0x48f7ee[_0xff52('0x16')]?_0x48f7ee[_0xff52('0x16')][_0xff52('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48f7ee[_0xff52('0x16')]?_0x48f7ee['options'][_0xff52('0x18')]||null:null,'attributes':_0x48f7ee['options']?_0x48f7ee['options'][_0xff52('0x19')]||null:null,'limit':_0x48f7ee[_0xff52('0x16')]?_0x48f7ee['options'][_0xff52('0x1a')]||null:null})[_0xff52('0xc')](function(_0x519d29){logger[_0xff52('0xd')](_0xff52('0x23'),_0x48f7ee);logger[_0xff52('0x10')](_0xff52('0x23'),_0x48f7ee,JSON[_0xff52('0x12')](_0x519d29));_0x20f7d6(_0x519d29);})[_0xff52('0x1f')](function(_0xb994f){logger['error'](_0xff52('0x23'),_0xb994f[_0xff52('0x14')],_0x48f7ee);_0x48167a(_0x1a9968[_0xff52('0x13')](0x1f4,_0xb994f[_0xff52('0x14')]));});});};
\ No newline at end of file
+var _0xfb15=['debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','model','map','CreateMemberReport','create','body','raw','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfb15,0x12f));var _0x5fb1=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xfb15[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x5fb1('0x0'));var util=require(_0x5fb1('0x1'));var moment=require(_0x5fb1('0x2'));var BPromise=require(_0x5fb1('0x3'));var rs=require(_0x5fb1('0x4'));var fs=require('fs');var Redis=require(_0x5fb1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5fb1('0x6'));var logger=require(_0x5fb1('0x7'))(_0x5fb1('0x8'));var config=require(_0x5fb1('0x9'));var jayson=require(_0x5fb1('0xa'));var client=jayson[_0x5fb1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e68c9,_0x500cd0,_0x55b282){return new BPromise(function(_0x267223,_0xb840f){return client[_0x5fb1('0xc')](_0x2e68c9,_0x55b282)[_0x5fb1('0xd')](function(_0x21b502){logger[_0x5fb1('0xe')](_0x5fb1('0xf'),_0x500cd0,_0x5fb1('0x10'));logger[_0x5fb1('0x11')](_0x5fb1('0x12'),_0x500cd0,_0x5fb1('0x10'),JSON[_0x5fb1('0x13')](_0x21b502));if(_0x21b502[_0x5fb1('0x14')]){if(_0x21b502['error'][_0x5fb1('0x15')]===0x1f4){logger[_0x5fb1('0x14')]('MemberReport,\x20%s,\x20%s',_0x500cd0,_0x21b502[_0x5fb1('0x14')][_0x5fb1('0x16')]);return _0xb840f(_0x21b502['error'][_0x5fb1('0x16')]);}logger[_0x5fb1('0x14')](_0x5fb1('0xf'),_0x500cd0,_0x21b502[_0x5fb1('0x14')][_0x5fb1('0x16')]);return _0x267223(_0x21b502[_0x5fb1('0x14')][_0x5fb1('0x16')]);}else{logger[_0x5fb1('0xe')]('MemberReport,\x20%s,\x20%s',_0x500cd0,'request\x20sent');_0x267223(_0x21b502['result'][_0x5fb1('0x16')]);}})[_0x5fb1('0x17')](function(_0xc4e4f8){logger[_0x5fb1('0x14')](_0x5fb1('0xf'),_0x500cd0,_0xc4e4f8);_0xb840f(_0xc4e4f8);});});}exports[_0x5fb1('0x18')]=function(_0x547a28){var _0x4188b3=this;return new Promise(function(_0x38a297,_0x3fbf6e){return db[_0x5fb1('0x19')][_0x5fb1('0x1a')]({'raw':_0x547a28[_0x5fb1('0x1b')]?_0x547a28['options']['raw']===undefined?!![]:![]:!![],'where':_0x547a28['options']?_0x547a28[_0x5fb1('0x1b')][_0x5fb1('0x1c')]||null:null,'attributes':_0x547a28['options']?_0x547a28[_0x5fb1('0x1b')][_0x5fb1('0x1d')]||null:null,'limit':_0x547a28[_0x5fb1('0x1b')]?_0x547a28[_0x5fb1('0x1b')][_0x5fb1('0x1e')]||null:null,'include':_0x547a28[_0x5fb1('0x1b')]?_0x547a28['options'][_0x5fb1('0x1f')]?_['map'](_0x547a28['options'][_0x5fb1('0x1f')],function(_0x29638a){return{'model':db[_0x29638a[_0x5fb1('0x20')]],'as':_0x29638a['as'],'attributes':_0x29638a[_0x5fb1('0x1d')],'include':_0x29638a[_0x5fb1('0x1f')]?_['map'](_0x29638a[_0x5fb1('0x1f')],function(_0x252e43){return{'model':db[_0x252e43['model']],'as':_0x252e43['as'],'attributes':_0x252e43[_0x5fb1('0x1d')],'include':_0x252e43[_0x5fb1('0x1f')]?_[_0x5fb1('0x21')](_0x252e43[_0x5fb1('0x1f')],function(_0x50c25d){return{'model':db[_0x50c25d[_0x5fb1('0x20')]],'as':_0x50c25d['as'],'attributes':_0x50c25d['attributes']};}):[]};}):[]};}):[]:[]})[_0x5fb1('0xd')](function(_0x1b3224){logger['info'](_0x5fb1('0x18'),_0x547a28);logger[_0x5fb1('0x11')](_0x5fb1('0x18'),_0x547a28,JSON['stringify'](_0x1b3224));_0x38a297(_0x1b3224);})[_0x5fb1('0x17')](function(_0x4fdf6b){logger['error'](_0x5fb1('0x18'),_0x4fdf6b[_0x5fb1('0x16')],_0x547a28);_0x3fbf6e(_0x4188b3[_0x5fb1('0x14')](0x1f4,_0x4fdf6b['message']));});});};exports[_0x5fb1('0x22')]=function(_0x50614c){var _0x5ee949=this;return new Promise(function(_0x27ebae,_0x4f5a80){return db[_0x5fb1('0x19')][_0x5fb1('0x23')](_0x50614c[_0x5fb1('0x24')],{'raw':_0x50614c['options']?_0x50614c['options'][_0x5fb1('0x25')]===undefined?!![]:![]:!![]})[_0x5fb1('0xd')](function(_0x53f315){logger[_0x5fb1('0xe')](_0x5fb1('0x22'),_0x50614c);logger[_0x5fb1('0x11')](_0x5fb1('0x22'),_0x50614c,JSON[_0x5fb1('0x13')](_0x53f315));_0x27ebae(_0x53f315);})[_0x5fb1('0x17')](function(_0x2d1c98){logger[_0x5fb1('0x14')](_0x5fb1('0x22'),_0x2d1c98['message'],_0x50614c);_0x4f5a80(_0x5ee949[_0x5fb1('0x14')](0x1f4,_0x2d1c98[_0x5fb1('0x16')]));});});};exports[_0x5fb1('0x26')]=function(_0x239385){var _0x1590a4=this;return new Promise(function(_0x55d45a,_0x2bc447){return db[_0x5fb1('0x19')][_0x5fb1('0x27')](_0x239385['body'],{'raw':_0x239385['options']?_0x239385['options'][_0x5fb1('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x239385[_0x5fb1('0x1b')]?_0x239385[_0x5fb1('0x1b')]['where']||null:null,'attributes':_0x239385[_0x5fb1('0x1b')]?_0x239385[_0x5fb1('0x1b')][_0x5fb1('0x1d')]||null:null,'limit':_0x239385[_0x5fb1('0x1b')]?_0x239385[_0x5fb1('0x1b')][_0x5fb1('0x1e')]||null:null})['then'](function(_0x2a292a){logger[_0x5fb1('0xe')](_0x5fb1('0x26'),_0x239385);logger[_0x5fb1('0x11')](_0x5fb1('0x26'),_0x239385,JSON[_0x5fb1('0x13')](_0x2a292a));_0x55d45a(_0x2a292a);})[_0x5fb1('0x17')](function(_0x24ccee){logger[_0x5fb1('0x14')](_0x5fb1('0x26'),_0x24ccee[_0x5fb1('0x16')],_0x239385);_0x2bc447(_0x1590a4[_0x5fb1('0x14')](0x1f4,_0x24ccee['message']));});});};
\ No newline at end of file
index a5cc10a..0cea23e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xea03=['index','exports','multer','path','connect-timeout','express','Router','fs-extra','./migration.controller','get'];(function(_0x24e90d,_0x32d4f8){var _0x90acca=function(_0x4cd533){while(--_0x4cd533){_0x24e90d['push'](_0x24e90d['shift']());}};_0x90acca(++_0x32d4f8);}(_0xea03,0x1ba));var _0x3ea0=function(_0x53955c,_0x1400fd){_0x53955c=_0x53955c-0x0;var _0x591b50=_0xea03[_0x53955c];return _0x591b50;};'use strict';var multer=require(_0x3ea0('0x0'));var util=require('util');var path=require(_0x3ea0('0x1'));var timeout=require(_0x3ea0('0x2'));var express=require(_0x3ea0('0x3'));var router=express[_0x3ea0('0x4')]();var fs_extra=require(_0x3ea0('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3ea0('0x6'));router[_0x3ea0('0x7')]('/',controller[_0x3ea0('0x8')]);module[_0x3ea0('0x9')]=router;
\ No newline at end of file
+var _0x4ad3=['express','Router','../../config/environment','get','index','exports','multer','util','path','connect-timeout'];(function(_0x9edf5c,_0x2bfcbe){var _0x405b3f=function(_0xaf5cf0){while(--_0xaf5cf0){_0x9edf5c['push'](_0x9edf5c['shift']());}};_0x405b3f(++_0x2bfcbe);}(_0x4ad3,0x150));var _0x34ad=function(_0x172660,_0x260d9b){_0x172660=_0x172660-0x0;var _0x83204f=_0x4ad3[_0x172660];return _0x83204f;};'use strict';var multer=require(_0x34ad('0x0'));var util=require(_0x34ad('0x1'));var path=require(_0x34ad('0x2'));var timeout=require(_0x34ad('0x3'));var express=require(_0x34ad('0x4'));var router=express[_0x34ad('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x34ad('0x6'));var controller=require('./migration.controller');router[_0x34ad('0x7')]('/',controller[_0x34ad('0x8')]);module[_0x34ad('0x9')]=router;
\ No newline at end of file
index d26ced8..5dde886 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9214=['exports','version'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0x9214,0x8c));var _0x4921=function(_0x2cc86e,_0x5e9be8){_0x2cc86e=_0x2cc86e-0x0;var _0x3c43e1=_0x9214[_0x2cc86e];return _0x3c43e1;};'use strict';var Sequelize=require('sequelize');module[_0x4921('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x4921('0x1')}};
\ No newline at end of file
+var _0x0731=['sequelize','exports','STRING'];(function(_0x513cd6,_0x26e69f){var _0x28a2f6=function(_0x3c4a7c){while(--_0x3c4a7c){_0x513cd6['push'](_0x513cd6['shift']());}};_0x28a2f6(++_0x26e69f);}(_0x0731,0x150));var _0x1073=function(_0x2f3c72,_0x386971){_0x2f3c72=_0x2f3c72-0x0;var _0x289970=_0x0731[_0x2f3c72];return _0x289970;};'use strict';var Sequelize=require(_0x1073('0x0'));module[_0x1073('0x1')]={'version':{'type':Sequelize[_0x1073('0x2')],'unique':'version'}};
\ No newline at end of file
index 1daf2ad..bf176ae 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa360=['stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','VIRTUAL','filter','options','Migration','includeAll','include','findAll','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error'];(function(_0x410ec4,_0x1b1589){var _0x24af73=function(_0x160683){while(--_0x160683){_0x410ec4['push'](_0x410ec4['shift']());}};_0x24af73(++_0x1b1589);}(_0xa360,0xb5));var _0x0a36=function(_0x550170,_0x134f62){_0x550170=_0x550170-0x0;var _0x12ed10=_0xa360[_0x550170];return _0x12ed10;};'use strict';var emlformat=require(_0x0a36('0x0'));var rimraf=require(_0x0a36('0x1'));var zipdir=require(_0x0a36('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a36('0x3'));var moment=require(_0x0a36('0x4'));var BPromise=require(_0x0a36('0x5'));var Mustache=require(_0x0a36('0x6'));var util=require(_0x0a36('0x7'));var path=require(_0x0a36('0x8'));var sox=require(_0x0a36('0x9'));var csv=require(_0x0a36('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a36('0xb'));var _=require(_0x0a36('0xc'));var squel=require(_0x0a36('0xd'));var crypto=require(_0x0a36('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0a36('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0a36('0x10'));var Papa=require(_0x0a36('0x11'));var Redis=require(_0x0a36('0x12'));var authService=require(_0x0a36('0x13'));var qs=require(_0x0a36('0x14'));var as=require(_0x0a36('0x15'));var hardwareService=require(_0x0a36('0x16'));var logger=require(_0x0a36('0x17'))(_0x0a36('0x18'));var utils=require(_0x0a36('0x19'));var config=require(_0x0a36('0x1a'));var licenseUtil=require(_0x0a36('0x1b'));var db=require(_0x0a36('0x1c'))['db'];function respondWithStatusCode(_0x4b2198,_0x415920){_0x415920=_0x415920||0xcc;return function(_0x270f9b){if(_0x270f9b){return _0x4b2198['sendStatus'](_0x415920);}return _0x4b2198[_0x0a36('0x1d')](_0x415920)[_0x0a36('0x1e')]();};}function respondWithResult(_0x1d469a,_0x1cfe3c){_0x1cfe3c=_0x1cfe3c||0xc8;return function(_0xb8680d){if(_0xb8680d){return _0x1d469a[_0x0a36('0x1d')](_0x1cfe3c)[_0x0a36('0x1f')](_0xb8680d);}};}function respondWithFilteredResult(_0x33cefd,_0x241e9f){return function(_0x4b10f7){if(_0x4b10f7){var _0x13724d=typeof _0x241e9f[_0x0a36('0x20')]==='undefined'&&typeof _0x241e9f[_0x0a36('0x21')]==='undefined';var _0x4296cb=_0x4b10f7[_0x0a36('0x22')];var _0x1cfbbf=_0x13724d?0x0:_0x241e9f[_0x0a36('0x20')];var _0x4eb296=_0x13724d?_0x4b10f7[_0x0a36('0x22')]:_0x241e9f[_0x0a36('0x20')]+_0x241e9f[_0x0a36('0x21')];var _0x47d03a;if(_0x4eb296>=_0x4296cb){_0x4eb296=_0x4296cb;_0x47d03a=0xc8;}else{_0x47d03a=0xce;}_0x33cefd['status'](_0x47d03a);return _0x33cefd[_0x0a36('0x23')](_0x0a36('0x24'),_0x1cfbbf+'-'+_0x4eb296+'/'+_0x4296cb)[_0x0a36('0x1f')](_0x4b10f7);}return null;};}function patchUpdates(_0x5a08e4){return function(_0x1ad466){try{jsonpatch['apply'](_0x1ad466,_0x5a08e4,!![]);}catch(_0x39ab76){return BPromise[_0x0a36('0x25')](_0x39ab76);}return _0x1ad466[_0x0a36('0x26')]();};}function saveUpdates(_0x377362,_0x5a8728){return function(_0x3f2a2f){if(_0x3f2a2f){return _0x3f2a2f[_0x0a36('0x27')](_0x377362)['then'](function(_0x5e9f5d){return _0x5e9f5d;});}return null;};}function removeEntity(_0x16f9b8,_0x4d73c7){return function(_0x44477e){if(_0x44477e){return _0x44477e[_0x0a36('0x28')]()[_0x0a36('0x29')](function(){_0x16f9b8[_0x0a36('0x1d')](0xcc)[_0x0a36('0x1e')]();});}};}function handleEntityNotFound(_0x1590df,_0x10edc5){return function(_0x21d03e){if(!_0x21d03e){_0x1590df[_0x0a36('0x2a')](0x194);}return _0x21d03e;};}function handleError(_0x35e6b5,_0x2c797d){_0x2c797d=_0x2c797d||0x1f4;return function(_0x2e469e){logger[_0x0a36('0x2b')](_0x2e469e[_0x0a36('0x2c')]);if(_0x2e469e['name']){delete _0x2e469e[_0x0a36('0x2d')];}_0x35e6b5[_0x0a36('0x1d')](_0x2c797d)[_0x0a36('0x2e')](_0x2e469e);};}exports[_0x0a36('0x2f')]=function(_0x2aa189,_0xaf57ed){var _0x353ece={},_0x5f2085={},_0x1db4e1={'count':0x0,'rows':[]};var _0x920b47=_['map'](db['Migration'][_0x0a36('0x30')],function(_0x3a5e32){return{'name':_0x3a5e32[_0x0a36('0x31')],'type':_0x3a5e32[_0x0a36('0x32')][_0x0a36('0x33')]};});_0x5f2085[_0x0a36('0x34')]=_['map'](_0x920b47,_0x0a36('0x2d'));_0x5f2085[_0x0a36('0x35')]=_[_0x0a36('0x36')](_0x2aa189[_0x0a36('0x35')]);_0x5f2085[_0x0a36('0x37')]=_[_0x0a36('0x38')](_0x5f2085[_0x0a36('0x34')],_0x5f2085[_0x0a36('0x35')]);_0x353ece[_0x0a36('0x39')]=_[_0x0a36('0x38')](_0x5f2085[_0x0a36('0x34')],qs['fields'](_0x2aa189['query'][_0x0a36('0x3a')]));_0x353ece[_0x0a36('0x39')]=_0x353ece[_0x0a36('0x39')][_0x0a36('0x3b')]?_0x353ece[_0x0a36('0x39')]:_0x5f2085['model'];if(!_0x2aa189['query'][_0x0a36('0x3c')](_0x0a36('0x3d'))){_0x353ece[_0x0a36('0x21')]=qs[_0x0a36('0x21')](_0x2aa189[_0x0a36('0x35')][_0x0a36('0x21')]);_0x353ece['offset']=qs[_0x0a36('0x20')](_0x2aa189[_0x0a36('0x35')]['offset']);}_0x353ece[_0x0a36('0x3e')]=qs['sort'](_0x2aa189[_0x0a36('0x35')][_0x0a36('0x3f')]);_0x353ece[_0x0a36('0x40')]=qs[_0x0a36('0x37')](_['pick'](_0x2aa189[_0x0a36('0x35')],_0x5f2085[_0x0a36('0x37')]),_0x920b47);if(_0x2aa189['query']['filter']){_0x353ece['where']=_[_0x0a36('0x41')](_0x353ece[_0x0a36('0x40')],{'$or':_[_0x0a36('0x42')](_0x920b47,function(_0x5f110f){if(_0x5f110f[_0x0a36('0x32')]!==_0x0a36('0x43')){var _0x13534c={};_0x13534c[_0x5f110f['name']]={'$like':'%'+_0x2aa189[_0x0a36('0x35')][_0x0a36('0x44')]+'%'};return _0x13534c;}})});}_0x353ece=_[_0x0a36('0x41')]({},_0x353ece,_0x2aa189[_0x0a36('0x45')]);var _0x51a4c5={'where':_0x353ece[_0x0a36('0x40')]};return db[_0x0a36('0x46')][_0x0a36('0x22')](_0x51a4c5)[_0x0a36('0x29')](function(_0x5cdd1f){_0x1db4e1[_0x0a36('0x22')]=_0x5cdd1f;if(_0x2aa189[_0x0a36('0x35')][_0x0a36('0x47')]){_0x353ece[_0x0a36('0x48')]=[{'all':!![]}];}return db['Migration'][_0x0a36('0x49')](_0x353ece);})[_0x0a36('0x29')](function(_0xf4bfcc){_0x1db4e1['rows']=_0xf4bfcc;return _0x1db4e1;})[_0x0a36('0x29')](respondWithFilteredResult(_0xaf57ed,_0x353ece))[_0x0a36('0x4a')](handleError(_0xaf57ed,null));};
\ No newline at end of file
+var _0x596c=['update','then','destroy','sendStatus','error','name','send','index','map','Migration','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','rows','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','reject','save'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x596c,0x167));var _0xc596=function(_0x4b4983,_0xa9ee1f){_0x4b4983=_0x4b4983-0x0;var _0x5ceab7=_0x596c[_0x4b4983];return _0x5ceab7;};'use strict';var emlformat=require(_0xc596('0x0'));var rimraf=require(_0xc596('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc596('0x2'));var rp=require(_0xc596('0x3'));var moment=require(_0xc596('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc596('0x5'));var util=require(_0xc596('0x6'));var path=require(_0xc596('0x7'));var sox=require(_0xc596('0x8'));var csv=require(_0xc596('0x9'));var ejs=require(_0xc596('0xa'));var fs=require('fs');var fs_extra=require(_0xc596('0xb'));var _=require(_0xc596('0xc'));var squel=require(_0xc596('0xd'));var crypto=require('crypto');var jsforce=require(_0xc596('0xe'));var deskjs=require(_0xc596('0xf'));var toCsv=require(_0xc596('0x9'));var querystring=require(_0xc596('0x10'));var Papa=require(_0xc596('0x11'));var Redis=require(_0xc596('0x12'));var authService=require(_0xc596('0x13'));var qs=require(_0xc596('0x14'));var as=require(_0xc596('0x15'));var hardwareService=require(_0xc596('0x16'));var logger=require(_0xc596('0x17'))('api');var utils=require(_0xc596('0x18'));var config=require(_0xc596('0x19'));var licenseUtil=require(_0xc596('0x1a'));var db=require(_0xc596('0x1b'))['db'];function respondWithStatusCode(_0x404927,_0x5029bb){_0x5029bb=_0x5029bb||0xcc;return function(_0x5dec80){if(_0x5dec80){return _0x404927['sendStatus'](_0x5029bb);}return _0x404927[_0xc596('0x1c')](_0x5029bb)[_0xc596('0x1d')]();};}function respondWithResult(_0x3fe8b4,_0x28e7f2){_0x28e7f2=_0x28e7f2||0xc8;return function(_0x5b19e8){if(_0x5b19e8){return _0x3fe8b4['status'](_0x28e7f2)[_0xc596('0x1e')](_0x5b19e8);}};}function respondWithFilteredResult(_0x29ee44,_0x49c37d){return function(_0x32bdde){if(_0x32bdde){var _0x59c755=typeof _0x49c37d[_0xc596('0x1f')]==='undefined'&&typeof _0x49c37d[_0xc596('0x20')]==='undefined';var _0x27dca6=_0x32bdde[_0xc596('0x21')];var _0x577c95=_0x59c755?0x0:_0x49c37d['offset'];var _0x4668e4=_0x59c755?_0x32bdde[_0xc596('0x21')]:_0x49c37d['offset']+_0x49c37d['limit'];var _0x337447;if(_0x4668e4>=_0x27dca6){_0x4668e4=_0x27dca6;_0x337447=0xc8;}else{_0x337447=0xce;}_0x29ee44[_0xc596('0x1c')](_0x337447);return _0x29ee44[_0xc596('0x22')]('Content-Range',_0x577c95+'-'+_0x4668e4+'/'+_0x27dca6)[_0xc596('0x1e')](_0x32bdde);}return null;};}function patchUpdates(_0xa37572){return function(_0x366d2c){try{jsonpatch['apply'](_0x366d2c,_0xa37572,!![]);}catch(_0x4463d4){return BPromise[_0xc596('0x23')](_0x4463d4);}return _0x366d2c[_0xc596('0x24')]();};}function saveUpdates(_0x5ebdcf,_0x30b163){return function(_0x1f1a7b){if(_0x1f1a7b){return _0x1f1a7b[_0xc596('0x25')](_0x5ebdcf)[_0xc596('0x26')](function(_0x42092a){return _0x42092a;});}return null;};}function removeEntity(_0x5904af,_0x1ccff8){return function(_0x513269){if(_0x513269){return _0x513269[_0xc596('0x27')]()[_0xc596('0x26')](function(){_0x5904af[_0xc596('0x1c')](0xcc)[_0xc596('0x1d')]();});}};}function handleEntityNotFound(_0x2cb02c,_0x2bb22e){return function(_0x148870){if(!_0x148870){_0x2cb02c[_0xc596('0x28')](0x194);}return _0x148870;};}function handleError(_0x525013,_0x289c47){_0x289c47=_0x289c47||0x1f4;return function(_0x1578cc){logger[_0xc596('0x29')](_0x1578cc['stack']);if(_0x1578cc[_0xc596('0x2a')]){delete _0x1578cc[_0xc596('0x2a')];}_0x525013[_0xc596('0x1c')](_0x289c47)[_0xc596('0x2b')](_0x1578cc);};}exports[_0xc596('0x2c')]=function(_0x5c807d,_0x5df2e7){var _0x4d7925={},_0x3c9a07={},_0x428338={'count':0x0,'rows':[]};var _0x3c7564=_[_0xc596('0x2d')](db[_0xc596('0x2e')][_0xc596('0x2f')],function(_0x45719c){return{'name':_0x45719c['fieldName'],'type':_0x45719c[_0xc596('0x30')][_0xc596('0x31')]};});_0x3c9a07[_0xc596('0x32')]=_[_0xc596('0x2d')](_0x3c7564,_0xc596('0x2a'));_0x3c9a07['query']=_[_0xc596('0x33')](_0x5c807d['query']);_0x3c9a07[_0xc596('0x34')]=_[_0xc596('0x35')](_0x3c9a07[_0xc596('0x32')],_0x3c9a07[_0xc596('0x36')]);_0x4d7925[_0xc596('0x37')]=_[_0xc596('0x35')](_0x3c9a07[_0xc596('0x32')],qs['fields'](_0x5c807d['query']['fields']));_0x4d7925['attributes']=_0x4d7925[_0xc596('0x37')]['length']?_0x4d7925[_0xc596('0x37')]:_0x3c9a07[_0xc596('0x32')];if(!_0x5c807d[_0xc596('0x36')][_0xc596('0x38')](_0xc596('0x39'))){_0x4d7925[_0xc596('0x20')]=qs['limit'](_0x5c807d[_0xc596('0x36')]['limit']);_0x4d7925[_0xc596('0x1f')]=qs[_0xc596('0x1f')](_0x5c807d[_0xc596('0x36')][_0xc596('0x1f')]);}_0x4d7925[_0xc596('0x3a')]=qs[_0xc596('0x3b')](_0x5c807d[_0xc596('0x36')][_0xc596('0x3b')]);_0x4d7925[_0xc596('0x3c')]=qs['filters'](_['pick'](_0x5c807d[_0xc596('0x36')],_0x3c9a07[_0xc596('0x34')]),_0x3c7564);if(_0x5c807d[_0xc596('0x36')][_0xc596('0x3d')]){_0x4d7925[_0xc596('0x3c')]=_[_0xc596('0x3e')](_0x4d7925[_0xc596('0x3c')],{'$or':_[_0xc596('0x2d')](_0x3c7564,function(_0x25e431){if(_0x25e431[_0xc596('0x30')]!=='VIRTUAL'){var _0x2a9267={};_0x2a9267[_0x25e431['name']]={'$like':'%'+_0x5c807d['query']['filter']+'%'};return _0x2a9267;}})});}_0x4d7925=_[_0xc596('0x3e')]({},_0x4d7925,_0x5c807d[_0xc596('0x3f')]);var _0x401c9a={'where':_0x4d7925[_0xc596('0x3c')]};return db['Migration'][_0xc596('0x21')](_0x401c9a)[_0xc596('0x26')](function(_0x30884e){_0x428338[_0xc596('0x21')]=_0x30884e;if(_0x5c807d['query']['includeAll']){_0x4d7925[_0xc596('0x40')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x4d7925);})[_0xc596('0x26')](function(_0xf79c9e){_0x428338[_0xc596('0x41')]=_0xf79c9e;return _0x428338;})[_0xc596('0x26')](respondWithFilteredResult(_0x5df2e7,_0x4d7925))['catch'](handleError(_0x5df2e7,null));};
\ No newline at end of file
index 6545136..468bb60 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9fb7=['bluebird','request-promise','rimraf','../../config/environment','exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment'];(function(_0x16515e,_0x3c0c54){var _0x560f05=function(_0x12a9bc){while(--_0x12a9bc){_0x16515e['push'](_0x16515e['shift']());}};_0x560f05(++_0x3c0c54);}(_0x9fb7,0x1e9));var _0x79fb=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x9fb7[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0x79fb('0x0'));var util=require(_0x79fb('0x1'));var logger=require(_0x79fb('0x2'))(_0x79fb('0x3'));var moment=require(_0x79fb('0x4'));var BPromise=require(_0x79fb('0x5'));var rp=require(_0x79fb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79fb('0x7'));var config=require(_0x79fb('0x8'));var attributes=require('./migration.attributes');module[_0x79fb('0x9')]=function(_0x191463,_0x2581b4){return _0x191463[_0x79fb('0xa')](_0x79fb('0xb'),attributes,{'tableName':_0x79fb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xec8b=['Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define'];(function(_0xcf4260,_0xe48af6){var _0x5ad781=function(_0x4ab8c9){while(--_0x4ab8c9){_0xcf4260['push'](_0xcf4260['shift']());}};_0x5ad781(++_0xe48af6);}(_0xec8b,0xa7));var _0xbec8=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xec8b[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xbec8('0x0'));var util=require(_0xbec8('0x1'));var logger=require(_0xbec8('0x2'))(_0xbec8('0x3'));var moment=require(_0xbec8('0x4'));var BPromise=require(_0xbec8('0x5'));var rp=require(_0xbec8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbec8('0x7'));var attributes=require('./migration.attributes');module['exports']=function(_0x5d60df,_0x1ec65a){return _0x5d60df[_0xbec8('0x8')](_0xbec8('0x9'),attributes,{'tableName':_0xbec8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 93c33a4..4391c51 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0e9f=['debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','catch','lodash','util','randomstring','../../config/utils','../../config/environment','jayson/promise','http','then','info','request\x20sent'];(function(_0x37eca7,_0x3e016e){var _0x222bce=function(_0xebd0b7){while(--_0xebd0b7){_0x37eca7['push'](_0x37eca7['shift']());}};_0x222bce(++_0x3e016e);}(_0x0e9f,0x116));var _0xf0e9=function(_0x560796,_0x374571){_0x560796=_0x560796-0x0;var _0x2c6691=_0x0e9f[_0x560796];return _0x2c6691;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf0e9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf0e9('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0e9('0x4'));var jayson=require(_0xf0e9('0x5'));var client=jayson['client'][_0xf0e9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4a35a3,_0x3f9792,_0x2fa08f){return new BPromise(function(_0x106ba0,_0x58edfe){return client['request'](_0x4a35a3,_0x2fa08f)[_0xf0e9('0x7')](function(_0x7b3146){logger[_0xf0e9('0x8')]('Migration,\x20%s,\x20%s',_0x3f9792,_0xf0e9('0x9'));logger[_0xf0e9('0xa')](_0xf0e9('0xb'),_0x3f9792,'request\x20sent',JSON[_0xf0e9('0xc')](_0x7b3146));if(_0x7b3146[_0xf0e9('0xd')]){if(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0xe')]===0x1f4){logger['error'](_0xf0e9('0xf'),_0x3f9792,_0x7b3146['error'][_0xf0e9('0x10')]);return _0x58edfe(_0x7b3146[_0xf0e9('0xd')]['message']);}logger[_0xf0e9('0xd')](_0xf0e9('0xf'),_0x3f9792,_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);return _0x106ba0(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);}else{logger['info'](_0xf0e9('0xf'),_0x3f9792,_0xf0e9('0x9'));_0x106ba0(_0x7b3146['result'][_0xf0e9('0x10')]);}})[_0xf0e9('0x11')](function(_0x3d0b4d){logger[_0xf0e9('0xd')]('Migration,\x20%s,\x20%s',_0x3f9792,_0x3d0b4d);_0x58edfe(_0x3d0b4d);});});}
\ No newline at end of file
+var _0x3750=['then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x21f70b,_0x47501e){var _0x153b64=function(_0x30694d){while(--_0x30694d){_0x21f70b['push'](_0x21f70b['shift']());}};_0x153b64(++_0x47501e);}(_0x3750,0xbb));var _0x0375=function(_0x21b254,_0x28c55b){_0x21b254=_0x21b254-0x0;var _0xa52d8c=_0x3750[_0x21b254];return _0xa52d8c;};'use strict';var _=require(_0x0375('0x0'));var util=require(_0x0375('0x1'));var moment=require(_0x0375('0x2'));var BPromise=require(_0x0375('0x3'));var rs=require(_0x0375('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0375('0x5'))['db'];var utils=require(_0x0375('0x6'));var logger=require('../../config/logger')(_0x0375('0x7'));var config=require(_0x0375('0x8'));var jayson=require(_0x0375('0x9'));var client=jayson[_0x0375('0xa')][_0x0375('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43ba53,_0x4ccebd,_0x2fe0f9){return new BPromise(function(_0x42c111,_0x698f18){return client[_0x0375('0xc')](_0x43ba53,_0x2fe0f9)[_0x0375('0xd')](function(_0x15fd3d){logger['info'](_0x0375('0xe'),_0x4ccebd,_0x0375('0xf'));logger[_0x0375('0x10')](_0x0375('0x11'),_0x4ccebd,_0x0375('0xf'),JSON[_0x0375('0x12')](_0x15fd3d));if(_0x15fd3d[_0x0375('0x13')]){if(_0x15fd3d[_0x0375('0x13')][_0x0375('0x14')]===0x1f4){logger[_0x0375('0x13')](_0x0375('0xe'),_0x4ccebd,_0x15fd3d[_0x0375('0x13')]['message']);return _0x698f18(_0x15fd3d[_0x0375('0x13')]['message']);}logger[_0x0375('0x13')]('Migration,\x20%s,\x20%s',_0x4ccebd,_0x15fd3d[_0x0375('0x13')]['message']);return _0x42c111(_0x15fd3d[_0x0375('0x13')][_0x0375('0x15')]);}else{logger[_0x0375('0x16')](_0x0375('0xe'),_0x4ccebd,_0x0375('0xf'));_0x42c111(_0x15fd3d[_0x0375('0x17')][_0x0375('0x15')]);}})[_0x0375('0x18')](function(_0x378022){logger['error']('Migration,\x20%s,\x20%s',_0x4ccebd,_0x378022);_0x698f18(_0x378022);});});}
\ No newline at end of file
index 48cb030..be4555f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d5d=['fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','create','update','destroy','exports','util','path','Router'];(function(_0x12d9b4,_0x41d4d1){var _0x757248=function(_0x1f86fb){while(--_0x1f86fb){_0x12d9b4['push'](_0x12d9b4['shift']());}};_0x757248(++_0x41d4d1);}(_0x7d5d,0x1dd));var _0xd7d5=function(_0x3cbca8,_0x5c2c23){_0x3cbca8=_0x3cbca8-0x0;var _0x449bd9=_0x7d5d[_0x3cbca8];return _0x449bd9;};'use strict';var multer=require('multer');var util=require(_0xd7d5('0x0'));var path=require(_0xd7d5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd7d5('0x2')]();var fs_extra=require(_0xd7d5('0x3'));var auth=require(_0xd7d5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd7d5('0x5'));var controller=require(_0xd7d5('0x6'));router[_0xd7d5('0x7')]('/',auth[_0xd7d5('0x8')](),controller[_0xd7d5('0x9')]);router['get'](_0xd7d5('0xa'),auth[_0xd7d5('0x8')](),controller[_0xd7d5('0xb')]);router['post']('/',auth[_0xd7d5('0x8')](),controller[_0xd7d5('0xc')]);router['put'](_0xd7d5('0xa'),auth[_0xd7d5('0x8')](),controller[_0xd7d5('0xd')]);router['delete'](_0xd7d5('0xa'),auth[_0xd7d5('0x8')](),controller[_0xd7d5('0xe')]);module[_0xd7d5('0xf')]=router;
\ No newline at end of file
+var _0xbd36=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','post','update','delete','destroy','multer'];(function(_0x3f70f3,_0x401758){var _0x1720f8=function(_0x299d01){while(--_0x299d01){_0x3f70f3['push'](_0x3f70f3['shift']());}};_0x1720f8(++_0x401758);}(_0xbd36,0x65));var _0x6bd3=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xbd36[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require(_0x6bd3('0x0'));var util=require(_0x6bd3('0x1'));var path=require(_0x6bd3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6bd3('0x3')]();var fs_extra=require(_0x6bd3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6bd3('0x5'));var config=require(_0x6bd3('0x6'));var controller=require(_0x6bd3('0x7'));router[_0x6bd3('0x8')]('/',auth['isAuthenticated'](),controller[_0x6bd3('0x9')]);router[_0x6bd3('0x8')](_0x6bd3('0xa'),auth[_0x6bd3('0xb')](),controller[_0x6bd3('0xc')]);router[_0x6bd3('0xd')]('/',auth[_0x6bd3('0xb')](),controller['create']);router['put'](_0x6bd3('0xa'),auth['isAuthenticated'](),controller[_0x6bd3('0xe')]);router[_0x6bd3('0xf')](_0x6bd3('0xa'),auth[_0x6bd3('0xb')](),controller[_0x6bd3('0x10')]);module['exports']=router;
\ No newline at end of file
index 7093cc8..678314d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6644=['localnet','stun','turn','STRING','sequelize','exports','ENUM'];(function(_0x546a1f,_0x141815){var _0x29d32d=function(_0x410b10){while(--_0x410b10){_0x546a1f['push'](_0x546a1f['shift']());}};_0x29d32d(++_0x141815);}(_0x6644,0x185));var _0x4664=function(_0x39cdd2,_0x46f3fb){_0x39cdd2=_0x39cdd2-0x0;var _0x48982f=_0x6644[_0x39cdd2];return _0x48982f;};'use strict';var Sequelize=require(_0x4664('0x0'));module[_0x4664('0x1')]={'type':{'type':Sequelize[_0x4664('0x2')](_0x4664('0x3'),'externip',_0x4664('0x4'),_0x4664('0x5'))},'value':{'type':Sequelize[_0x4664('0x6')]},'username':{'type':Sequelize[_0x4664('0x6')]},'password':{'type':Sequelize[_0x4664('0x6')]}};
\ No newline at end of file
+var _0x974f=['sequelize','ENUM','externip','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x974f,0x16c));var _0xf974=function(_0x53ce89,_0x2917a5){_0x53ce89=_0x53ce89-0x0;var _0x480f20=_0x974f[_0x53ce89];return _0x480f20;};'use strict';var Sequelize=require(_0xf974('0x0'));module['exports']={'type':{'type':Sequelize[_0xf974('0x1')]('localnet',_0xf974('0x2'),'stun','turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf974('0x3')]},'password':{'type':Sequelize[_0xf974('0x3')]}};
\ No newline at end of file
index 1d364a3..6bddab9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2a4f=['show','params','rawAttributes','fields','find','body','toUpperCase','STUN','readFileSync','join','root','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','create','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','format','toLowerCase','server/files/templates/stun_multiple.ejs','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','json','offset','undefined','limit','Content-Range','update','destroy','end','sendStatus','stack','name','index','map','Network','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows'];(function(_0xf75be5,_0x1066f5){var _0x1fd0e3=function(_0x5782e6){while(--_0x5782e6){_0xf75be5['push'](_0xf75be5['shift']());}};_0x1fd0e3(++_0x1066f5);}(_0x2a4f,0x1ce));var _0xf2a4=function(_0x3b4137,_0x46c8b5){_0x3b4137=_0x3b4137-0x0;var _0x578ed4=_0x2a4f[_0x3b4137];return _0x578ed4;};'use strict';var util=require(_0xf2a4('0x0'));var path=require(_0xf2a4('0x1'));var ejs=require(_0xf2a4('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0xf2a4('0x3'));var logger=require(_0xf2a4('0x4'))(_0xf2a4('0x5'));var config=require(_0xf2a4('0x6'));var db=require(_0xf2a4('0x7'))['db'];var jayson=require(_0xf2a4('0x8'));var client=jayson[_0xf2a4('0x9')][_0xf2a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31f602,_0x3ac3a2,_0xdd8f95,_0x3ea687){return new Promise(function(_0x2eaa97,_0x17afb1){var _0x54f740=_0x3ea687||client;return _0x54f740[_0xf2a4('0xb')](_0x31f602,_0xdd8f95)[_0xf2a4('0xc')](function(_0x2fd5d6){logger[_0xf2a4('0xd')](_0xf2a4('0xe'),_0x3ac3a2,_0xf2a4('0xf'));logger[_0xf2a4('0x10')]('Network,\x20%s,\x20%s,\x20%s',_0x3ac3a2,_0xf2a4('0xf'),JSON[_0xf2a4('0x11')](_0x2fd5d6));if(_0x2fd5d6['error']){if(_0x2fd5d6['error']['code']===0x1f4){logger[_0xf2a4('0x12')](_0xf2a4('0xe'),_0x3ac3a2,_0x2fd5d6[_0xf2a4('0x12')][_0xf2a4('0x13')]);return _0x17afb1(_0x2fd5d6[_0xf2a4('0x12')][_0xf2a4('0x13')]);}logger[_0xf2a4('0x12')]('Network,\x20%s,\x20%s',_0x3ac3a2,_0x2fd5d6[_0xf2a4('0x12')]['message']);return _0x2eaa97(_0x2fd5d6['error'][_0xf2a4('0x13')]);}else{logger[_0xf2a4('0xd')](_0xf2a4('0xe'),_0x3ac3a2,_0xf2a4('0xf'));_0x2eaa97(_0x2fd5d6[_0xf2a4('0x14')][_0xf2a4('0x13')]);}})[_0xf2a4('0x15')](function(_0x17cdc4){logger[_0xf2a4('0x12')](_0xf2a4('0xe'),_0x3ac3a2,_0x17cdc4);_0x17afb1(_0x17cdc4);});});}function respondWithResult(_0x4b7fa1,_0x2845c4){_0x2845c4=_0x2845c4||0xc8;return function(_0x2e7ecb){if(_0x2e7ecb){return _0x4b7fa1[_0xf2a4('0x16')](_0x2845c4)[_0xf2a4('0x17')](_0x2e7ecb);}};}function respondWithFilteredResult(_0x5b6edc,_0x1d575e){return function(_0x4ba0e2){if(_0x4ba0e2){var _0x479f54=typeof _0x1d575e[_0xf2a4('0x18')]===_0xf2a4('0x19')&&typeof _0x1d575e[_0xf2a4('0x1a')]==='undefined';var _0x32c77b=_0x4ba0e2['count'];var _0x2f6a10=_0x479f54?0x0:_0x1d575e[_0xf2a4('0x18')];var _0x30d0ee=_0x479f54?_0x4ba0e2['count']:_0x1d575e[_0xf2a4('0x18')]+_0x1d575e[_0xf2a4('0x1a')];var _0x5015b2;if(_0x30d0ee>=_0x32c77b){_0x30d0ee=_0x32c77b;_0x5015b2=0xc8;}else{_0x5015b2=0xce;}_0x5b6edc[_0xf2a4('0x16')](_0x5015b2);return _0x5b6edc['set'](_0xf2a4('0x1b'),_0x2f6a10+'-'+_0x30d0ee+'/'+_0x32c77b)[_0xf2a4('0x17')](_0x4ba0e2);}return null;};}function saveUpdates(_0x180609){return function(_0x5c7c29){if(_0x5c7c29){return _0x5c7c29[_0xf2a4('0x1c')](_0x180609)[_0xf2a4('0xc')](function(_0x26caa7){return _0x26caa7;});}return null;};}function removeEntity(_0x476bcf){return function(_0x1e6e65){if(_0x1e6e65){return _0x1e6e65[_0xf2a4('0x1d')]()['then'](function(){_0x476bcf[_0xf2a4('0x16')](0xcc)[_0xf2a4('0x1e')]();});}};}function handleEntityNotFound(_0x26f8d5){return function(_0x3f3303){if(!_0x3f3303){_0x26f8d5[_0xf2a4('0x1f')](0x194);}return _0x3f3303;};}function handleError(_0x162741,_0x35b05b){_0x35b05b=_0x35b05b||0x1f4;return function(_0x1b15a4){logger[_0xf2a4('0x12')](_0x1b15a4[_0xf2a4('0x20')]);if(_0x1b15a4['name']){delete _0x1b15a4[_0xf2a4('0x21')];}_0x162741[_0xf2a4('0x16')](_0x35b05b)['send'](_0x1b15a4);};}exports[_0xf2a4('0x22')]=function(_0x150e1d,_0xe4e997){var _0x32e282={},_0x38265b={},_0x227205={'count':0x0,'rows':[]};var _0x1a97ae=_[_0xf2a4('0x23')](db[_0xf2a4('0x24')]['rawAttributes'],function(_0x20733c){return{'name':_0x20733c['fieldName'],'type':_0x20733c[_0xf2a4('0x25')][_0xf2a4('0x26')]};});_0x38265b[_0xf2a4('0x27')]=_['map'](_0x1a97ae,_0xf2a4('0x21'));_0x38265b['query']=_[_0xf2a4('0x28')](_0x150e1d[_0xf2a4('0x29')]);_0x38265b[_0xf2a4('0x2a')]=_[_0xf2a4('0x2b')](_0x38265b[_0xf2a4('0x27')],_0x38265b[_0xf2a4('0x29')]);_0x32e282[_0xf2a4('0x2c')]=_[_0xf2a4('0x2b')](_0x38265b['model'],qs['fields'](_0x150e1d[_0xf2a4('0x29')]['fields']));_0x32e282[_0xf2a4('0x2c')]=_0x32e282['attributes'][_0xf2a4('0x2d')]?_0x32e282['attributes']:_0x38265b[_0xf2a4('0x27')];if(!_0x150e1d['query'][_0xf2a4('0x2e')](_0xf2a4('0x2f'))){_0x32e282[_0xf2a4('0x1a')]=qs['limit'](_0x150e1d['query'][_0xf2a4('0x1a')]);_0x32e282['offset']=qs['offset'](_0x150e1d[_0xf2a4('0x29')][_0xf2a4('0x18')]);}_0x32e282[_0xf2a4('0x30')]=qs[_0xf2a4('0x31')](_0x150e1d[_0xf2a4('0x29')][_0xf2a4('0x31')]);_0x32e282['where']=qs[_0xf2a4('0x2a')](_[_0xf2a4('0x32')](_0x150e1d[_0xf2a4('0x29')],_0x38265b[_0xf2a4('0x2a')]),_0x1a97ae);if(_0x150e1d[_0xf2a4('0x29')]['filter']){_0x32e282[_0xf2a4('0x33')]=_[_0xf2a4('0x34')](_0x32e282['where'],{'$or':_[_0xf2a4('0x23')](_0x1a97ae,function(_0x11d737){if(_0x11d737[_0xf2a4('0x25')]!==_0xf2a4('0x35')){var _0x5bb418={};_0x5bb418[_0x11d737[_0xf2a4('0x21')]]={'$like':'%'+_0x150e1d[_0xf2a4('0x29')]['filter']+'%'};return _0x5bb418;}})});}_0x32e282=_['merge']({},_0x32e282,_0x150e1d[_0xf2a4('0x36')]);var _0x304eda={'where':_0x32e282['where']};return db[_0xf2a4('0x24')][_0xf2a4('0x37')](_0x304eda)[_0xf2a4('0xc')](function(_0x12b988){_0x227205[_0xf2a4('0x37')]=_0x12b988;if(_0x150e1d[_0xf2a4('0x29')][_0xf2a4('0x38')]){_0x32e282[_0xf2a4('0x39')]=[{'all':!![]}];}return db['Network'][_0xf2a4('0x3a')](_0x32e282);})[_0xf2a4('0xc')](function(_0x274366){_0x227205[_0xf2a4('0x3b')]=_0x274366;return _0x227205;})['then'](respondWithFilteredResult(_0xe4e997,_0x32e282))[_0xf2a4('0x15')](handleError(_0xe4e997,null));};exports[_0xf2a4('0x3c')]=function(_0x32c86d,_0x18b936){var _0x3a5a44={'raw':!![],'where':{'id':_0x32c86d[_0xf2a4('0x3d')]['id']}},_0x370990={};_0x370990['model']=_[_0xf2a4('0x28')](db[_0xf2a4('0x24')][_0xf2a4('0x3e')]);_0x370990['query']=_[_0xf2a4('0x28')](_0x32c86d[_0xf2a4('0x29')]);_0x370990[_0xf2a4('0x2a')]=_[_0xf2a4('0x2b')](_0x370990['model'],_0x370990[_0xf2a4('0x29')]);_0x3a5a44[_0xf2a4('0x2c')]=_[_0xf2a4('0x2b')](_0x370990[_0xf2a4('0x27')],qs[_0xf2a4('0x3f')](_0x32c86d[_0xf2a4('0x29')][_0xf2a4('0x3f')]));_0x3a5a44['attributes']=_0x3a5a44[_0xf2a4('0x2c')][_0xf2a4('0x2d')]?_0x3a5a44['attributes']:_0x370990[_0xf2a4('0x27')];if(_0x32c86d[_0xf2a4('0x29')][_0xf2a4('0x38')]){_0x3a5a44[_0xf2a4('0x39')]=[{'all':!![]}];}_0x3a5a44=_['merge']({},_0x3a5a44,_0x32c86d['options']);return db[_0xf2a4('0x24')][_0xf2a4('0x40')](_0x3a5a44)[_0xf2a4('0xc')](handleEntityNotFound(_0x18b936,null))[_0xf2a4('0xc')](respondWithResult(_0x18b936,null))[_0xf2a4('0x15')](handleError(_0x18b936,null));};exports['create']=function(_0x14b3b6,_0x47d1d8){var _0x4c4bf3;return db[_0xf2a4('0x24')]['create'](_0x14b3b6[_0xf2a4('0x41')],{'raw':!![]})[_0xf2a4('0xc')](function(_0x4691cb){_0x4c4bf3=_0x4691cb;return db[_0xf2a4('0x24')][_0xf2a4('0x3a')]({'where':{'type':_0x14b3b6[_0xf2a4('0x41')][_0xf2a4('0x25')]},'raw':!![]});})[_0xf2a4('0xc')](function(_0x572579){if(_0x4c4bf3['type'][_0xf2a4('0x42')]()==_0xf2a4('0x43')){var _0x371937=fs[_0xf2a4('0x44')](path[_0xf2a4('0x45')](config[_0xf2a4('0x46')],'server/files/templates/stun_multiple.ejs'),_0xf2a4('0x47'));var _0x45bdfb=ejs[_0xf2a4('0x48')](_0x371937,{'networks':_0x572579||[]});fs['writeFileSync'](_0xf2a4('0x49'),_0x45bdfb);return respondWithRpcPromise(_0xf2a4('0x4a'),_0xf2a4('0x4b'),{'module':_0xf2a4('0x4c')});}else if(_0x4c4bf3[_0xf2a4('0x25')]['toUpperCase']()==_0xf2a4('0x4d')){var _0x352c79=fs[_0xf2a4('0x44')](path[_0xf2a4('0x45')](config[_0xf2a4('0x46')],_0xf2a4('0x4e')),_0xf2a4('0x47'));var _0x1cbbc4=ejs[_0xf2a4('0x48')](_0x352c79,{'networks':_0x572579||[]});fs[_0xf2a4('0x4f')](_0xf2a4('0x50'),_0x1cbbc4);return respondWithRpcPromise(_0xf2a4('0x4a'),'create',{'module':_0xf2a4('0x4c')});}else{var _0x22ea58=fs[_0xf2a4('0x44')](path['join'](config[_0xf2a4('0x46')],'server/files/templates/network.ejs'),_0xf2a4('0x47'));var _0x2bd6a4=ejs[_0xf2a4('0x48')](_0x22ea58,{'networks':_0x572579||[]});fs[_0xf2a4('0x4f')](util[_0xf2a4('0x51')]('/etc/asterisk/sip_xcally_%s.conf',_0x14b3b6[_0xf2a4('0x41')]['type'][_0xf2a4('0x52')]()),_0x2bd6a4);return respondWithRpcPromise(_0xf2a4('0x4a'),_0xf2a4('0x4b'),{'module':'chan_sip.so'});}})[_0xf2a4('0xc')](function(){return _0x4c4bf3;})[_0xf2a4('0xc')](respondWithResult(_0x47d1d8,0xc9))['catch'](handleError(_0x47d1d8,null));};exports[_0xf2a4('0x1c')]=function(_0x188f42,_0x18b256){var _0x4462ca;return db[_0xf2a4('0x24')][_0xf2a4('0x40')]({'where':{'id':_0x188f42[_0xf2a4('0x3d')]['id']}})[_0xf2a4('0xc')](handleEntityNotFound(_0x18b256,null))[_0xf2a4('0xc')](saveUpdates(_0x188f42['body'],null))['then'](function(_0x5cf5b6){if(_0x5cf5b6){_0x4462ca=_0x5cf5b6;return db[_0xf2a4('0x24')][_0xf2a4('0x3a')]({'where':{'type':_0x4462ca[_0xf2a4('0x25')]},'raw':!![]});}return null;})['then'](function(_0x370c67){if(_0x4462ca['type'][_0xf2a4('0x42')]()==_0xf2a4('0x43')){var _0x211aa2=fs[_0xf2a4('0x44')](path[_0xf2a4('0x45')](config[_0xf2a4('0x46')],_0xf2a4('0x53')),_0xf2a4('0x47'));var _0x4dac25=ejs[_0xf2a4('0x48')](_0x211aa2,{'networks':_0x370c67||[]});fs[_0xf2a4('0x4f')](_0xf2a4('0x49'),_0x4dac25);return respondWithRpcPromise(_0xf2a4('0x4a'),'update',{'module':_0xf2a4('0x4c')});}else if(_0x4462ca[_0xf2a4('0x25')][_0xf2a4('0x42')]()==_0xf2a4('0x4d')){var _0x1023b0=fs['readFileSync'](path[_0xf2a4('0x45')](config[_0xf2a4('0x46')],'server/files/templates/turn_multiple.ejs'),_0xf2a4('0x47'));var _0xdca181=ejs['render'](_0x1023b0,{'networks':_0x370c67||[]});fs[_0xf2a4('0x4f')]('/etc/asterisk/turn_xcally.conf',_0xdca181);return respondWithRpcPromise(_0xf2a4('0x4a'),_0xf2a4('0x1c'),{'module':_0xf2a4('0x4c')});}else{var _0x500577=fs[_0xf2a4('0x44')](path[_0xf2a4('0x45')](config[_0xf2a4('0x46')],_0xf2a4('0x54')),_0xf2a4('0x47'));var _0x10cdd8=ejs[_0xf2a4('0x48')](_0x500577,{'networks':_0x370c67||[]});fs[_0xf2a4('0x4f')](util[_0xf2a4('0x51')](_0xf2a4('0x55'),_0x188f42['body'][_0xf2a4('0x25')][_0xf2a4('0x52')]()),_0x10cdd8);return respondWithRpcPromise('Reload',_0xf2a4('0x1c'),{'module':_0xf2a4('0x56')});}})['then'](function(_0x40f520){if(_0x40f520){return _0x4462ca;}return null;})[_0xf2a4('0xc')](respondWithResult(_0x18b256,null))[_0xf2a4('0x15')](handleError(_0x18b256,null));};exports[_0xf2a4('0x1d')]=function(_0x3115dd,_0x143f65){var _0x154099;return db[_0xf2a4('0x24')][_0xf2a4('0x40')]({'where':{'id':_0x3115dd['params']['id']}})[_0xf2a4('0xc')](function(_0x54a6d4){_0x154099=_0x54a6d4;return _0x54a6d4;})[_0xf2a4('0xc')](handleEntityNotFound(_0x143f65,null))[_0xf2a4('0xc')](removeEntity(_0x143f65,null))[_0xf2a4('0xc')](function(){if(_0x154099){return db[_0xf2a4('0x24')]['findAll']({'where':{'type':_0x154099['type']},'raw':!![]});}})['then'](function(_0x12e9ea){if(_0x154099[_0xf2a4('0x25')][_0xf2a4('0x42')]()=='STUN'){var _0x1859e1=fs[_0xf2a4('0x44')](path[_0xf2a4('0x45')](config[_0xf2a4('0x46')],_0xf2a4('0x53')),_0xf2a4('0x47'));var _0xdf19af=ejs[_0xf2a4('0x48')](_0x1859e1,{'networks':_0x12e9ea||[]});fs['writeFileSync'](_0xf2a4('0x49'),_0xdf19af);return respondWithRpcPromise(_0xf2a4('0x4a'),_0xf2a4('0x1d'),{'module':_0xf2a4('0x4c')});}else if(_0x154099[_0xf2a4('0x25')]['toUpperCase']()==_0xf2a4('0x4d')){var _0xe0e684=fs['readFileSync'](path['join'](config[_0xf2a4('0x46')],_0xf2a4('0x4e')),_0xf2a4('0x47'));var _0x1f1bfe=ejs['render'](_0xe0e684,{'networks':_0x12e9ea||[]});fs[_0xf2a4('0x4f')](_0xf2a4('0x50'),_0x1f1bfe);return respondWithRpcPromise(_0xf2a4('0x4a'),_0xf2a4('0x1d'),{'module':_0xf2a4('0x4c')});}else{var _0x3abe3b=fs['readFileSync'](path[_0xf2a4('0x45')](config[_0xf2a4('0x46')],_0xf2a4('0x54')),_0xf2a4('0x47'));var _0x4c98ce=ejs['render'](_0x3abe3b,{'networks':_0x12e9ea||[]});fs[_0xf2a4('0x4f')](util[_0xf2a4('0x51')](_0xf2a4('0x55'),_0x154099[_0xf2a4('0x25')][_0xf2a4('0x52')]()),_0x4c98ce);return respondWithRpcPromise(_0xf2a4('0x4a'),_0xf2a4('0x1d'),{'module':_0xf2a4('0x56')});}})['catch'](handleError(_0x143f65,null));};
\ No newline at end of file
+var _0x9856=['findAll','rows','show','keys','fields','length','find','create','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','toUpperCase','TURN','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','Reload','server/files/templates/turn_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','destroy','format','util','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','client','request','then','info','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','status','json','offset','undefined','limit','count','set','update','sendStatus','stack','name','send','index','Network','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include'];(function(_0x1df9c4,_0x31ed6d){var _0x54a9fe=function(_0x540de8){while(--_0x540de8){_0x1df9c4['push'](_0x1df9c4['shift']());}};_0x54a9fe(++_0x31ed6d);}(_0x9856,0x117));var _0x6985=function(_0x340f9f,_0xd5fcea){_0x340f9f=_0x340f9f-0x0;var _0x1560b7=_0x9856[_0x340f9f];return _0x1560b7;};'use strict';var util=require(_0x6985('0x0'));var path=require('path');var ejs=require(_0x6985('0x1'));var fs=require('fs');var _=require(_0x6985('0x2'));var qs=require(_0x6985('0x3'));var logger=require(_0x6985('0x4'))(_0x6985('0x5'));var config=require(_0x6985('0x6'));var db=require(_0x6985('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x6985('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed8aa,_0x339d60,_0x19690d,_0x2f0a7e){return new Promise(function(_0x376941,_0x4a9eef){var _0x414ebf=_0x2f0a7e||client;return _0x414ebf[_0x6985('0x9')](_0x4ed8aa,_0x19690d)[_0x6985('0xa')](function(_0xa6bb73){logger[_0x6985('0xb')](_0x6985('0xc'),_0x339d60,'request\x20sent');logger[_0x6985('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x339d60,_0x6985('0xe'),JSON[_0x6985('0xf')](_0xa6bb73));if(_0xa6bb73[_0x6985('0x10')]){if(_0xa6bb73['error'][_0x6985('0x11')]===0x1f4){logger['error'](_0x6985('0xc'),_0x339d60,_0xa6bb73[_0x6985('0x10')][_0x6985('0x12')]);return _0x4a9eef(_0xa6bb73['error'][_0x6985('0x12')]);}logger['error'](_0x6985('0xc'),_0x339d60,_0xa6bb73[_0x6985('0x10')][_0x6985('0x12')]);return _0x376941(_0xa6bb73[_0x6985('0x10')][_0x6985('0x12')]);}else{logger[_0x6985('0xb')](_0x6985('0xc'),_0x339d60,_0x6985('0xe'));_0x376941(_0xa6bb73['result'][_0x6985('0x12')]);}})[_0x6985('0x13')](function(_0xf4bb54){logger[_0x6985('0x10')](_0x6985('0xc'),_0x339d60,_0xf4bb54);_0x4a9eef(_0xf4bb54);});});}function respondWithResult(_0xb0d349,_0x389437){_0x389437=_0x389437||0xc8;return function(_0x47767a){if(_0x47767a){return _0xb0d349[_0x6985('0x14')](_0x389437)[_0x6985('0x15')](_0x47767a);}};}function respondWithFilteredResult(_0x53d54a,_0x5c9dd3){return function(_0x23e3e4){if(_0x23e3e4){var _0x36b4ae=typeof _0x5c9dd3[_0x6985('0x16')]===_0x6985('0x17')&&typeof _0x5c9dd3[_0x6985('0x18')]===_0x6985('0x17');var _0x193ef0=_0x23e3e4[_0x6985('0x19')];var _0x5ccc5d=_0x36b4ae?0x0:_0x5c9dd3[_0x6985('0x16')];var _0x5c56ca=_0x36b4ae?_0x23e3e4['count']:_0x5c9dd3[_0x6985('0x16')]+_0x5c9dd3['limit'];var _0x37efda;if(_0x5c56ca>=_0x193ef0){_0x5c56ca=_0x193ef0;_0x37efda=0xc8;}else{_0x37efda=0xce;}_0x53d54a[_0x6985('0x14')](_0x37efda);return _0x53d54a[_0x6985('0x1a')]('Content-Range',_0x5ccc5d+'-'+_0x5c56ca+'/'+_0x193ef0)[_0x6985('0x15')](_0x23e3e4);}return null;};}function saveUpdates(_0x105006){return function(_0x4f9708){if(_0x4f9708){return _0x4f9708[_0x6985('0x1b')](_0x105006)[_0x6985('0xa')](function(_0x55834a){return _0x55834a;});}return null;};}function removeEntity(_0x4f5b04){return function(_0x121f39){if(_0x121f39){return _0x121f39['destroy']()[_0x6985('0xa')](function(){_0x4f5b04[_0x6985('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x976afb){return function(_0x131804){if(!_0x131804){_0x976afb[_0x6985('0x1c')](0x194);}return _0x131804;};}function handleError(_0x389094,_0x1b3c2e){_0x1b3c2e=_0x1b3c2e||0x1f4;return function(_0x5966bd){logger['error'](_0x5966bd[_0x6985('0x1d')]);if(_0x5966bd[_0x6985('0x1e')]){delete _0x5966bd[_0x6985('0x1e')];}_0x389094[_0x6985('0x14')](_0x1b3c2e)[_0x6985('0x1f')](_0x5966bd);};}exports[_0x6985('0x20')]=function(_0x5b1754,_0x22ccc8){var _0x4e9bcc={},_0x450618={},_0x2f0e29={'count':0x0,'rows':[]};var _0x53226b=_['map'](db[_0x6985('0x21')][_0x6985('0x22')],function(_0x534235){return{'name':_0x534235[_0x6985('0x23')],'type':_0x534235[_0x6985('0x24')]['key']};});_0x450618['model']=_[_0x6985('0x25')](_0x53226b,'name');_0x450618[_0x6985('0x26')]=_['keys'](_0x5b1754[_0x6985('0x26')]);_0x450618[_0x6985('0x27')]=_[_0x6985('0x28')](_0x450618[_0x6985('0x29')],_0x450618['query']);_0x4e9bcc[_0x6985('0x2a')]=_[_0x6985('0x28')](_0x450618[_0x6985('0x29')],qs['fields'](_0x5b1754[_0x6985('0x26')]['fields']));_0x4e9bcc[_0x6985('0x2a')]=_0x4e9bcc[_0x6985('0x2a')]['length']?_0x4e9bcc['attributes']:_0x450618[_0x6985('0x29')];if(!_0x5b1754[_0x6985('0x26')]['hasOwnProperty'](_0x6985('0x2b'))){_0x4e9bcc[_0x6985('0x18')]=qs[_0x6985('0x18')](_0x5b1754[_0x6985('0x26')][_0x6985('0x18')]);_0x4e9bcc[_0x6985('0x16')]=qs[_0x6985('0x16')](_0x5b1754[_0x6985('0x26')][_0x6985('0x16')]);}_0x4e9bcc[_0x6985('0x2c')]=qs[_0x6985('0x2d')](_0x5b1754[_0x6985('0x26')][_0x6985('0x2d')]);_0x4e9bcc[_0x6985('0x2e')]=qs[_0x6985('0x27')](_[_0x6985('0x2f')](_0x5b1754[_0x6985('0x26')],_0x450618[_0x6985('0x27')]),_0x53226b);if(_0x5b1754['query'][_0x6985('0x30')]){_0x4e9bcc[_0x6985('0x2e')]=_['merge'](_0x4e9bcc['where'],{'$or':_[_0x6985('0x25')](_0x53226b,function(_0x2fc606){if(_0x2fc606[_0x6985('0x24')]!==_0x6985('0x31')){var _0x2a8d66={};_0x2a8d66[_0x2fc606[_0x6985('0x1e')]]={'$like':'%'+_0x5b1754[_0x6985('0x26')]['filter']+'%'};return _0x2a8d66;}})});}_0x4e9bcc=_[_0x6985('0x32')]({},_0x4e9bcc,_0x5b1754['options']);var _0x3ab519={'where':_0x4e9bcc[_0x6985('0x2e')]};return db[_0x6985('0x21')]['count'](_0x3ab519)['then'](function(_0x539fa3){_0x2f0e29['count']=_0x539fa3;if(_0x5b1754['query'][_0x6985('0x33')]){_0x4e9bcc[_0x6985('0x34')]=[{'all':!![]}];}return db['Network'][_0x6985('0x35')](_0x4e9bcc);})[_0x6985('0xa')](function(_0x13ddc1){_0x2f0e29[_0x6985('0x36')]=_0x13ddc1;return _0x2f0e29;})[_0x6985('0xa')](respondWithFilteredResult(_0x22ccc8,_0x4e9bcc))[_0x6985('0x13')](handleError(_0x22ccc8,null));};exports[_0x6985('0x37')]=function(_0x15e6af,_0x118e23){var _0x3a4ddc={'raw':!![],'where':{'id':_0x15e6af['params']['id']}},_0xf55926={};_0xf55926[_0x6985('0x29')]=_[_0x6985('0x38')](db['Network'][_0x6985('0x22')]);_0xf55926['query']=_[_0x6985('0x38')](_0x15e6af[_0x6985('0x26')]);_0xf55926[_0x6985('0x27')]=_[_0x6985('0x28')](_0xf55926[_0x6985('0x29')],_0xf55926[_0x6985('0x26')]);_0x3a4ddc[_0x6985('0x2a')]=_[_0x6985('0x28')](_0xf55926['model'],qs[_0x6985('0x39')](_0x15e6af[_0x6985('0x26')][_0x6985('0x39')]));_0x3a4ddc['attributes']=_0x3a4ddc['attributes'][_0x6985('0x3a')]?_0x3a4ddc[_0x6985('0x2a')]:_0xf55926[_0x6985('0x29')];if(_0x15e6af[_0x6985('0x26')][_0x6985('0x33')]){_0x3a4ddc[_0x6985('0x34')]=[{'all':!![]}];}_0x3a4ddc=_[_0x6985('0x32')]({},_0x3a4ddc,_0x15e6af['options']);return db['Network'][_0x6985('0x3b')](_0x3a4ddc)[_0x6985('0xa')](handleEntityNotFound(_0x118e23,null))[_0x6985('0xa')](respondWithResult(_0x118e23,null))['catch'](handleError(_0x118e23,null));};exports[_0x6985('0x3c')]=function(_0xfac2b9,_0xb53fec){var _0x49b1f4;return db[_0x6985('0x21')]['create'](_0xfac2b9[_0x6985('0x3d')],{'raw':!![]})[_0x6985('0xa')](function(_0x5491d0){_0x49b1f4=_0x5491d0;return db[_0x6985('0x21')][_0x6985('0x35')]({'where':{'type':_0xfac2b9['body'][_0x6985('0x24')]},'raw':!![]});})[_0x6985('0xa')](function(_0x3c101a){if(_0x49b1f4['type']['toUpperCase']()==_0x6985('0x3e')){var _0x85a0d9=fs[_0x6985('0x3f')](path[_0x6985('0x40')](config[_0x6985('0x41')],_0x6985('0x42')),_0x6985('0x43'));var _0x30621c=ejs[_0x6985('0x44')](_0x85a0d9,{'networks':_0x3c101a||[]});fs[_0x6985('0x45')](_0x6985('0x46'),_0x30621c);return respondWithRpcPromise('Reload',_0x6985('0x3c'),{'module':'res_stun_monitor.so'});}else if(_0x49b1f4[_0x6985('0x24')][_0x6985('0x47')]()==_0x6985('0x48')){var _0x52fb1e=fs['readFileSync'](path['join'](config[_0x6985('0x41')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x11b698=ejs[_0x6985('0x44')](_0x52fb1e,{'networks':_0x3c101a||[]});fs[_0x6985('0x45')](_0x6985('0x49'),_0x11b698);return respondWithRpcPromise('Reload',_0x6985('0x3c'),{'module':_0x6985('0x4a')});}else{var _0x5afc07=fs[_0x6985('0x3f')](path[_0x6985('0x40')](config[_0x6985('0x41')],_0x6985('0x4b')),_0x6985('0x43'));var _0x12a39e=ejs['render'](_0x5afc07,{'networks':_0x3c101a||[]});fs[_0x6985('0x45')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0xfac2b9[_0x6985('0x3d')]['type']['toLowerCase']()),_0x12a39e);return respondWithRpcPromise('Reload',_0x6985('0x3c'),{'module':'chan_sip.so'});}})[_0x6985('0xa')](function(){return _0x49b1f4;})[_0x6985('0xa')](respondWithResult(_0xb53fec,0xc9))[_0x6985('0x13')](handleError(_0xb53fec,null));};exports[_0x6985('0x1b')]=function(_0x50b616,_0x2eb612){var _0x19f0eb;return db[_0x6985('0x21')][_0x6985('0x3b')]({'where':{'id':_0x50b616['params']['id']}})['then'](handleEntityNotFound(_0x2eb612,null))[_0x6985('0xa')](saveUpdates(_0x50b616[_0x6985('0x3d')],null))[_0x6985('0xa')](function(_0x496749){if(_0x496749){_0x19f0eb=_0x496749;return db['Network'][_0x6985('0x35')]({'where':{'type':_0x19f0eb[_0x6985('0x24')]},'raw':!![]});}return null;})[_0x6985('0xa')](function(_0x56cc5c){if(_0x19f0eb['type'][_0x6985('0x47')]()==_0x6985('0x3e')){var _0x4fd161=fs[_0x6985('0x3f')](path['join'](config[_0x6985('0x41')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x20f161=ejs[_0x6985('0x44')](_0x4fd161,{'networks':_0x56cc5c||[]});fs[_0x6985('0x45')]('/etc/asterisk/stun_xcally.conf',_0x20f161);return respondWithRpcPromise(_0x6985('0x4c'),_0x6985('0x1b'),{'module':_0x6985('0x4a')});}else if(_0x19f0eb[_0x6985('0x24')]['toUpperCase']()==_0x6985('0x48')){var _0x357bff=fs[_0x6985('0x3f')](path[_0x6985('0x40')](config['root'],_0x6985('0x4d')),_0x6985('0x43'));var _0x126fbc=ejs['render'](_0x357bff,{'networks':_0x56cc5c||[]});fs[_0x6985('0x45')]('/etc/asterisk/turn_xcally.conf',_0x126fbc);return respondWithRpcPromise('Reload',_0x6985('0x1b'),{'module':_0x6985('0x4a')});}else{var _0x1373f9=fs[_0x6985('0x3f')](path[_0x6985('0x40')](config[_0x6985('0x41')],'server/files/templates/network.ejs'),'utf8');var _0x410592=ejs['render'](_0x1373f9,{'networks':_0x56cc5c||[]});fs[_0x6985('0x45')](util['format'](_0x6985('0x4e'),_0x50b616[_0x6985('0x3d')][_0x6985('0x24')][_0x6985('0x4f')]()),_0x410592);return respondWithRpcPromise(_0x6985('0x4c'),_0x6985('0x1b'),{'module':_0x6985('0x50')});}})[_0x6985('0xa')](function(_0x2d3f3b){if(_0x2d3f3b){return _0x19f0eb;}return null;})[_0x6985('0xa')](respondWithResult(_0x2eb612,null))[_0x6985('0x13')](handleError(_0x2eb612,null));};exports[_0x6985('0x51')]=function(_0x463e21,_0x1134b8){var _0x3e07d8;return db[_0x6985('0x21')][_0x6985('0x3b')]({'where':{'id':_0x463e21['params']['id']}})[_0x6985('0xa')](function(_0x510396){_0x3e07d8=_0x510396;return _0x510396;})[_0x6985('0xa')](handleEntityNotFound(_0x1134b8,null))[_0x6985('0xa')](removeEntity(_0x1134b8,null))[_0x6985('0xa')](function(){if(_0x3e07d8){return db[_0x6985('0x21')][_0x6985('0x35')]({'where':{'type':_0x3e07d8[_0x6985('0x24')]},'raw':!![]});}})['then'](function(_0x34686f){if(_0x3e07d8[_0x6985('0x24')][_0x6985('0x47')]()==_0x6985('0x3e')){var _0x35d59b=fs[_0x6985('0x3f')](path[_0x6985('0x40')](config[_0x6985('0x41')],_0x6985('0x42')),_0x6985('0x43'));var _0x58da2a=ejs[_0x6985('0x44')](_0x35d59b,{'networks':_0x34686f||[]});fs[_0x6985('0x45')](_0x6985('0x46'),_0x58da2a);return respondWithRpcPromise('Reload',_0x6985('0x51'),{'module':_0x6985('0x4a')});}else if(_0x3e07d8[_0x6985('0x24')][_0x6985('0x47')]()=='TURN'){var _0x9bdfc3=fs[_0x6985('0x3f')](path[_0x6985('0x40')](config[_0x6985('0x41')],_0x6985('0x4d')),'utf8');var _0x121548=ejs[_0x6985('0x44')](_0x9bdfc3,{'networks':_0x34686f||[]});fs[_0x6985('0x45')](_0x6985('0x49'),_0x121548);return respondWithRpcPromise(_0x6985('0x4c'),'destroy',{'module':_0x6985('0x4a')});}else{var _0x518ab8=fs[_0x6985('0x3f')](path[_0x6985('0x40')](config[_0x6985('0x41')],_0x6985('0x4b')),_0x6985('0x43'));var _0x2768f0=ejs['render'](_0x518ab8,{'networks':_0x34686f||[]});fs[_0x6985('0x45')](util[_0x6985('0x52')]('/etc/asterisk/sip_xcally_%s.conf',_0x3e07d8[_0x6985('0x24')][_0x6985('0x4f')]()),_0x2768f0);return respondWithRpcPromise(_0x6985('0x4c'),'destroy',{'module':_0x6985('0x50')});}})['catch'](handleError(_0x1134b8,null));};
\ No newline at end of file
index f3b1b29..a27750d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6953=['../../config/environment','exports','define','Network','network','lodash','util','bluebird','path','rimraf'];(function(_0x4238c4,_0x366c1d){var _0xd0f5ef=function(_0xd726ba){while(--_0xd726ba){_0x4238c4['push'](_0x4238c4['shift']());}};_0xd0f5ef(++_0x366c1d);}(_0x6953,0x91));var _0x3695=function(_0x5f12f5,_0x3257e9){_0x5f12f5=_0x5f12f5-0x0;var _0x1f271d=_0x6953[_0x5f12f5];return _0x1f271d;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3695('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3695('0x3'));var rimraf=require(_0x3695('0x4'));var config=require(_0x3695('0x5'));var attributes=require('./network.attributes');module[_0x3695('0x6')]=function(_0x558026,_0x2d7d98){return _0x558026[_0x3695('0x7')](_0x3695('0x8'),attributes,{'tableName':_0x3695('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x0db9=['network','lodash','moment','bluebird','path','../../config/environment','./network.attributes','define','Network'];(function(_0x179f1f,_0x5e67d1){var _0x1aa92a=function(_0x1c6564){while(--_0x1c6564){_0x179f1f['push'](_0x179f1f['shift']());}};_0x1aa92a(++_0x5e67d1);}(_0x0db9,0xa3));var _0x90db=function(_0x35f83e,_0x30ec55){_0x35f83e=_0x35f83e-0x0;var _0x249b05=_0x0db9[_0x35f83e];return _0x249b05;};'use strict';var _=require(_0x90db('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x90db('0x1'));var BPromise=require(_0x90db('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90db('0x3'));var rimraf=require('rimraf');var config=require(_0x90db('0x4'));var attributes=require(_0x90db('0x5'));module['exports']=function(_0x2d02a1,_0x242774){return _0x2d02a1[_0x90db('0x6')](_0x90db('0x7'),attributes,{'tableName':_0x90db('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 14fcb85..c3c3d3a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x2fa13b,_0x4b5808){_0x2fa13b=_0x2fa13b-0x0;var _0x27a2e9=_0x7a54[_0x2fa13b];return _0x27a2e9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}
\ No newline at end of file
+var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x104d54,_0x35d72a){_0x104d54=_0x104d54-0x0;var _0x161601=_0x7a54[_0x104d54];return _0x161601;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}
\ No newline at end of file
index 01c3f75..cc009c6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9558=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','create','post','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x9558,0x1c0));var _0x8955=function(_0x3a89dc,_0x54bb1e){_0x3a89dc=_0x3a89dc-0x0;var _0x11c5c9=_0x9558[_0x3a89dc];return _0x11c5c9;};'use strict';var multer=require(_0x8955('0x0'));var util=require(_0x8955('0x1'));var path=require(_0x8955('0x2'));var timeout=require(_0x8955('0x3'));var express=require(_0x8955('0x4'));var router=express[_0x8955('0x5')]();var fs_extra=require(_0x8955('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8955('0x7'));var config=require(_0x8955('0x8'));var controller=require('./openchannelAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8955('0x9')]);router[_0x8955('0xa')](_0x8955('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x8955('0xa')]('/:id',auth[_0x8955('0xc')](),controller[_0x8955('0xd')]);router[_0x8955('0xa')](_0x8955('0xe'),auth[_0x8955('0xc')](),controller[_0x8955('0xf')]);router[_0x8955('0xa')](_0x8955('0x10'),auth[_0x8955('0xc')](),controller[_0x8955('0x11')]);router['get'](_0x8955('0x12'),auth[_0x8955('0xc')](),controller[_0x8955('0x13')]);router[_0x8955('0xa')](_0x8955('0x14'),auth[_0x8955('0xc')](),controller[_0x8955('0x15')]);router['get']('/:id/users',auth[_0x8955('0xc')](),controller[_0x8955('0x16')]);router['post']('/',auth[_0x8955('0xc')](),controller[_0x8955('0x17')]);router[_0x8955('0x18')](_0x8955('0xe'),auth[_0x8955('0xc')](),controller['addDisposition']);router[_0x8955('0x18')](_0x8955('0x10'),auth[_0x8955('0xc')](),controller[_0x8955('0x19')]);router[_0x8955('0x18')](_0x8955('0x1a'),controller[_0x8955('0x1b')]);router[_0x8955('0x18')](_0x8955('0x12'),auth[_0x8955('0xc')](),controller[_0x8955('0x1c')]);router['post'](_0x8955('0x1d'),auth['isAuthenticated'](),controller[_0x8955('0x1e')]);router[_0x8955('0x18')](_0x8955('0x1f'),auth[_0x8955('0xc')](),controller[_0x8955('0x20')]);router[_0x8955('0x21')](_0x8955('0x22'),auth[_0x8955('0xc')](),controller[_0x8955('0x23')]);router[_0x8955('0x24')](_0x8955('0x22'),auth['isAuthenticated'](),controller[_0x8955('0x25')]);router[_0x8955('0x24')](_0x8955('0xe'),auth[_0x8955('0xc')](),controller[_0x8955('0x26')]);router[_0x8955('0x24')](_0x8955('0x10'),auth[_0x8955('0xc')](),controller[_0x8955('0x27')]);router[_0x8955('0x24')](_0x8955('0x1d'),auth[_0x8955('0xc')](),controller[_0x8955('0x28')]);module['exports']=router;
\ No newline at end of file
+var _0xb336=['addApplications','/:id/users','addAgents','send','put','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','index','get','/describe','/:id','isAuthenticated','show','getDispositions','getAnswers','/:id/applications','getApplications','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify'];(function(_0xa847f6,_0x5cc01a){var _0x1c3f14=function(_0x1fe621){while(--_0x1fe621){_0xa847f6['push'](_0xa847f6['shift']());}};_0x1c3f14(++_0x5cc01a);}(_0xb336,0x12a));var _0x6b33=function(_0x12e4b7,_0x732556){_0x12e4b7=_0x12e4b7-0x0;var _0x3544d2=_0xb336[_0x12e4b7];return _0x3544d2;};'use strict';var multer=require(_0x6b33('0x0'));var util=require(_0x6b33('0x1'));var path=require(_0x6b33('0x2'));var timeout=require(_0x6b33('0x3'));var express=require('express');var router=express[_0x6b33('0x4')]();var fs_extra=require(_0x6b33('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6b33('0x6'));var config=require(_0x6b33('0x7'));var controller=require(_0x6b33('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6b33('0x9')]);router[_0x6b33('0xa')](_0x6b33('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6b33('0xa')](_0x6b33('0xc'),auth[_0x6b33('0xd')](),controller[_0x6b33('0xe')]);router[_0x6b33('0xa')]('/:id/dispositions',auth[_0x6b33('0xd')](),controller[_0x6b33('0xf')]);router[_0x6b33('0xa')]('/:id/canned_answers',auth[_0x6b33('0xd')](),controller[_0x6b33('0x10')]);router[_0x6b33('0xa')](_0x6b33('0x11'),auth[_0x6b33('0xd')](),controller[_0x6b33('0x12')]);router[_0x6b33('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0x6b33('0xa')]('/:id/users',auth[_0x6b33('0xd')](),controller['getAgents']);router[_0x6b33('0x13')]('/',auth[_0x6b33('0xd')](),controller['create']);router[_0x6b33('0x13')](_0x6b33('0x14'),auth[_0x6b33('0xd')](),controller[_0x6b33('0x15')]);router[_0x6b33('0x13')](_0x6b33('0x16'),auth[_0x6b33('0xd')](),controller[_0x6b33('0x17')]);router[_0x6b33('0x13')](_0x6b33('0x18'),controller[_0x6b33('0x19')]);router['post'](_0x6b33('0x11'),auth[_0x6b33('0xd')](),controller[_0x6b33('0x1a')]);router[_0x6b33('0x13')](_0x6b33('0x1b'),auth[_0x6b33('0xd')](),controller[_0x6b33('0x1c')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x6b33('0x1d')]);router[_0x6b33('0x1e')](_0x6b33('0xc'),auth[_0x6b33('0xd')](),controller[_0x6b33('0x1f')]);router[_0x6b33('0x20')](_0x6b33('0xc'),auth[_0x6b33('0xd')](),controller['destroy']);router[_0x6b33('0x20')](_0x6b33('0x14'),auth[_0x6b33('0xd')](),controller[_0x6b33('0x21')]);router[_0x6b33('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6b33('0x22')]);router[_0x6b33('0x20')](_0x6b33('0x1b'),auth[_0x6b33('0xd')](),controller[_0x6b33('0x23')]);module['exports']=router;
\ No newline at end of file
index dcc8721..52f352f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb75b=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0xb2987e,_0x4825c7){var _0x265aff=function(_0x13d6d5){while(--_0x13d6d5){_0xb2987e['push'](_0xb2987e['shift']());}};_0x265aff(++_0x4825c7);}(_0xb75b,0xfa));var _0xbb75=function(_0x8733be,_0x156a04){_0x8733be=_0x8733be-0x0;var _0x44c4bc=_0xb75b[_0x8733be];return _0x44c4bc;};'use strict';var Sequelize=require(_0xbb75('0x0'));var rs=require(_0xbb75('0x1'));module[_0xbb75('0x2')]={'name':{'type':Sequelize[_0xbb75('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xbb75('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xbb75('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbb75('0x4')],'defaultValue':function(){return _0xbb75('0x5');}},'notificationSound':{'type':Sequelize[_0xbb75('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbb75('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbb75('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xbb75('0x3')]},'queueTransfer':{'type':Sequelize[_0xbb75('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbb75('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbb75('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbb75('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbb75('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xbb75('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xbb75('0x6')],'defaultValue':![],'comment':_0xbb75('0x9'),'set':function(_0x3bf793){if(!_0x3bf793)this[_0xbb75('0xa')](_0xbb75('0xb'),null);this[_0xbb75('0xa')](_0xbb75('0xc'),_0x3bf793);}}};
\ No newline at end of file
+var _0x6282=['randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x6282,0x1b1));var _0x2628=function(_0x14d2ce,_0x55f131){_0x14d2ce=_0x14d2ce-0x0;var _0x54516d=_0x6282[_0x14d2ce];return _0x54516d;};'use strict';var Sequelize=require(_0x2628('0x0'));var rs=require(_0x2628('0x1'));module[_0x2628('0x2')]={'name':{'type':Sequelize[_0x2628('0x3')],'unique':_0x2628('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x2628('0x3')]},'token':{'type':Sequelize[_0x2628('0x3')],'defaultValue':function(){return rs[_0x2628('0x5')]();}},'replyUri':{'type':Sequelize[_0x2628('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2628('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2628('0x6')],'defaultValue':function(){return _0x2628('0x7');}},'notificationSound':{'type':Sequelize[_0x2628('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2628('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2628('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2628('0x3')]},'queueTransfer':{'type':Sequelize[_0x2628('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2628('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2628('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2628('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2628('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x2628('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2628('0xb'),'set':function(_0x2c296d){if(!_0x2c296d)this[_0x2628('0xc')](_0x2628('0xd'),null);this['setDataValue']('mandatoryDisposition',_0x2c296d);}}};
\ No newline at end of file
index b0156c4..71ca497 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe198=['name','filter','options','OpenchannelAccount','includeAll','include','findAll','rows','catch','show','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','difference','createdAt','updatedAt','ListId','from','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','fullname','Tag','Tags','color','tag','addAgents','omit','spread','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','Messages','dataValues','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','socket.io-emitter','redis','./openchannelAccount.socket','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','send','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL'];(function(_0x5f1c59,_0x3fff4c){var _0xbfb242=function(_0x2a64e2){while(--_0x2a64e2){_0x5f1c59['push'](_0x5f1c59['shift']());}};_0xbfb242(++_0x3fff4c);}(_0xe198,0x6f));var _0x8e19=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xe198[_0x3b0731];return _0x4204d7;};'use strict';var emlformat=require(_0x8e19('0x0'));var rimraf=require(_0x8e19('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8e19('0x2'));var moment=require(_0x8e19('0x3'));var BPromise=require(_0x8e19('0x4'));var Mustache=require(_0x8e19('0x5'));var util=require(_0x8e19('0x6'));var path=require('path');var sox=require(_0x8e19('0x7'));var csv=require(_0x8e19('0x8'));var ejs=require(_0x8e19('0x9'));var fs=require('fs');var fs_extra=require(_0x8e19('0xa'));var _=require(_0x8e19('0xb'));var squel=require(_0x8e19('0xc'));var crypto=require(_0x8e19('0xd'));var jsforce=require(_0x8e19('0xe'));var deskjs=require(_0x8e19('0xf'));var toCsv=require(_0x8e19('0x8'));var querystring=require(_0x8e19('0x10'));var Papa=require(_0x8e19('0x11'));var Redis=require(_0x8e19('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8e19('0x13'));var as=require(_0x8e19('0x14'));var hardwareService=require(_0x8e19('0x15'));var logger=require(_0x8e19('0x16'))(_0x8e19('0x17'));var utils=require(_0x8e19('0x18'));var config=require(_0x8e19('0x19'));var licenseUtil=require(_0x8e19('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8e19('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8e19('0x1c'))(new Redis(config[_0x8e19('0x1d')]));require(_0x8e19('0x1e'))[_0x8e19('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8e19('0x20')][_0x8e19('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x8e19('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x319971,_0x4b2c05,_0x325f54,_0x33c590){return new BPromise(function(_0x47680f,_0x19ba4b){var _0x368896=_0x33c590||client;return _0x368896[_0x8e19('0x22')](_0x319971,_0x325f54)[_0x8e19('0x23')](function(_0x1dde49){logger[_0x8e19('0x24')](_0x8e19('0x25'),_0x4b2c05,_0x8e19('0x26'));logger[_0x8e19('0x27')](_0x8e19('0x28'),_0x4b2c05,_0x8e19('0x26'),JSON['stringify'](_0x1dde49));if(_0x1dde49[_0x8e19('0x29')]){if(_0x1dde49[_0x8e19('0x29')][_0x8e19('0x2a')]===0x1f4){logger[_0x8e19('0x29')](_0x8e19('0x25'),_0x4b2c05,_0x1dde49[_0x8e19('0x29')][_0x8e19('0x2b')]);return _0x19ba4b(_0x1dde49[_0x8e19('0x29')][_0x8e19('0x2b')]);}logger[_0x8e19('0x29')](_0x8e19('0x25'),_0x4b2c05,_0x1dde49[_0x8e19('0x29')][_0x8e19('0x2b')]);return _0x47680f(_0x1dde49['error'][_0x8e19('0x2b')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4b2c05,_0x8e19('0x26'));_0x47680f(_0x1dde49[_0x8e19('0x2c')][_0x8e19('0x2b')]);}})['catch'](function(_0x146719){logger[_0x8e19('0x29')](_0x8e19('0x25'),_0x4b2c05,_0x146719);_0x19ba4b(_0x146719);});});}function respondWithStatusCode(_0x35e5a5,_0x16ad8d){_0x16ad8d=_0x16ad8d||0xcc;return function(_0x406d21){if(_0x406d21){return _0x35e5a5['sendStatus'](_0x16ad8d);}return _0x35e5a5[_0x8e19('0x2d')](_0x16ad8d)[_0x8e19('0x2e')]();};}function respondWithResult(_0x25dd6b,_0x2866cd){_0x2866cd=_0x2866cd||0xc8;return function(_0x551feb){if(_0x551feb){return _0x25dd6b[_0x8e19('0x2d')](_0x2866cd)[_0x8e19('0x2f')](_0x551feb);}};}function respondWithFilteredResult(_0x4f337f,_0x5e226e){return function(_0x329421){if(_0x329421){var _0x3d5cb1=typeof _0x5e226e[_0x8e19('0x30')]===_0x8e19('0x31')&&typeof _0x5e226e[_0x8e19('0x32')]===_0x8e19('0x31');var _0x53795c=_0x329421['count'];var _0x33c2b1=_0x3d5cb1?0x0:_0x5e226e['offset'];var _0xb99bbe=_0x3d5cb1?_0x329421[_0x8e19('0x33')]:_0x5e226e[_0x8e19('0x30')]+_0x5e226e[_0x8e19('0x32')];var _0x5693c1;if(_0xb99bbe>=_0x53795c){_0xb99bbe=_0x53795c;_0x5693c1=0xc8;}else{_0x5693c1=0xce;}_0x4f337f[_0x8e19('0x2d')](_0x5693c1);return _0x4f337f[_0x8e19('0x34')]('Content-Range',_0x33c2b1+'-'+_0xb99bbe+'/'+_0x53795c)['json'](_0x329421);}return null;};}function patchUpdates(_0x2f8036){return function(_0x2e37ac){try{jsonpatch[_0x8e19('0x35')](_0x2e37ac,_0x2f8036,!![]);}catch(_0x2b73f1){return BPromise[_0x8e19('0x36')](_0x2b73f1);}return _0x2e37ac[_0x8e19('0x37')]();};}function saveUpdates(_0x264a65,_0x11d6ac){return function(_0x4b0f3f){if(_0x4b0f3f){return _0x4b0f3f[_0x8e19('0x38')](_0x264a65)[_0x8e19('0x23')](function(_0x5e880a){return _0x5e880a;});}return null;};}function removeEntity(_0x13ead2,_0x749cee){return function(_0x165a64){if(_0x165a64){return _0x165a64[_0x8e19('0x39')]()[_0x8e19('0x23')](function(){var _0x14493c=_0x165a64[_0x8e19('0x3a')]({'plain':!![]});var _0x547368=_0x8e19('0x3b');return db[_0x8e19('0x3c')][_0x8e19('0x39')]({'where':{'type':_0x547368,'resourceId':_0x14493c['id']}})[_0x8e19('0x23')](function(){return _0x165a64;});})[_0x8e19('0x23')](function(){_0x13ead2[_0x8e19('0x2d')](0xcc)[_0x8e19('0x2e')]();});}};}function handleEntityNotFound(_0x12f464,_0x15e4e6){return function(_0x36efbd){if(!_0x36efbd){_0x12f464[_0x8e19('0x3d')](0x194);}return _0x36efbd;};}function handleError(_0x39405a,_0x518b89){_0x518b89=_0x518b89||0x1f4;return function(_0x841669){logger['error'](_0x841669['stack']);if(_0x841669['name']){delete _0x841669['name'];}_0x39405a[_0x8e19('0x2d')](_0x518b89)[_0x8e19('0x3e')](_0x841669);};}exports[_0x8e19('0x3f')]=function(_0xc15b5,_0x4ef552){var _0x350074={'include':[{'model':db[_0x8e19('0x40')],'as':_0x8e19('0x41')}]},_0x2742fd={},_0x1f2058={'count':0x0,'rows':[]};var _0x1aa40b=_['map'](db['OpenchannelAccount'][_0x8e19('0x42')],function(_0x1bd508){return{'name':_0x1bd508[_0x8e19('0x43')],'type':_0x1bd508[_0x8e19('0x44')]['key']};});_0x2742fd[_0x8e19('0x45')]=_[_0x8e19('0x46')](_0x1aa40b,'name');_0x2742fd[_0x8e19('0x47')]=_[_0x8e19('0x48')](_0xc15b5[_0x8e19('0x47')]);_0x2742fd['filters']=_['intersection'](_0x2742fd[_0x8e19('0x45')],_0x2742fd[_0x8e19('0x47')]);_0x350074[_0x8e19('0x49')]=_['intersection'](_0x2742fd[_0x8e19('0x45')],qs[_0x8e19('0x4a')](_0xc15b5[_0x8e19('0x47')][_0x8e19('0x4a')]));_0x350074['attributes']=_0x350074[_0x8e19('0x49')][_0x8e19('0x4b')]?_0x350074[_0x8e19('0x49')]:_0x2742fd[_0x8e19('0x45')];if(!_0xc15b5['query'][_0x8e19('0x4c')](_0x8e19('0x4d'))){_0x350074[_0x8e19('0x32')]=qs[_0x8e19('0x32')](_0xc15b5[_0x8e19('0x47')][_0x8e19('0x32')]);_0x350074[_0x8e19('0x30')]=qs[_0x8e19('0x30')](_0xc15b5[_0x8e19('0x47')]['offset']);}_0x350074[_0x8e19('0x4e')]=qs['sort'](_0xc15b5[_0x8e19('0x47')][_0x8e19('0x4f')]);_0x350074[_0x8e19('0x50')]=qs[_0x8e19('0x51')](_[_0x8e19('0x52')](_0xc15b5[_0x8e19('0x47')],_0x2742fd[_0x8e19('0x51')]),_0x1aa40b);if(_0xc15b5[_0x8e19('0x47')]['filter']){_0x350074[_0x8e19('0x50')]=_[_0x8e19('0x53')](_0x350074[_0x8e19('0x50')],{'$or':_[_0x8e19('0x46')](_0x1aa40b,function(_0x377411){if(_0x377411[_0x8e19('0x44')]!==_0x8e19('0x54')){var _0x3edb29={};_0x3edb29[_0x377411[_0x8e19('0x55')]]={'$like':'%'+_0xc15b5['query'][_0x8e19('0x56')]+'%'};return _0x3edb29;}})});}_0x350074=_[_0x8e19('0x53')]({},_0x350074,_0xc15b5[_0x8e19('0x57')]);var _0x19831c={'where':_0x350074[_0x8e19('0x50')]};return db[_0x8e19('0x58')][_0x8e19('0x33')](_0x19831c)['then'](function(_0x5697f1){_0x1f2058['count']=_0x5697f1;if(_0xc15b5[_0x8e19('0x47')][_0x8e19('0x59')]){_0x350074[_0x8e19('0x5a')]=[{'all':!![]}];}return db[_0x8e19('0x58')][_0x8e19('0x5b')](_0x350074);})['then'](function(_0x2aaf42){_0x1f2058[_0x8e19('0x5c')]=_0x2aaf42;return _0x1f2058;})[_0x8e19('0x23')](respondWithFilteredResult(_0x4ef552,_0x350074))[_0x8e19('0x5d')](handleError(_0x4ef552,null));};exports[_0x8e19('0x5e')]=function(_0x21a470,_0x19fe47){var _0x343cf8={'raw':![],'where':{'id':_0x21a470['params']['id']},'include':[{'model':db[_0x8e19('0x40')],'as':_0x8e19('0x41')}]},_0x534df7={};_0x534df7[_0x8e19('0x45')]=_[_0x8e19('0x48')](db[_0x8e19('0x58')][_0x8e19('0x42')]);_0x534df7[_0x8e19('0x47')]=_[_0x8e19('0x48')](_0x21a470[_0x8e19('0x47')]);_0x534df7[_0x8e19('0x51')]=_[_0x8e19('0x5f')](_0x534df7[_0x8e19('0x45')],_0x534df7[_0x8e19('0x47')]);_0x343cf8[_0x8e19('0x49')]=_[_0x8e19('0x5f')](_0x534df7[_0x8e19('0x45')],qs[_0x8e19('0x4a')](_0x21a470[_0x8e19('0x47')]['fields']));_0x343cf8['attributes']=_0x343cf8[_0x8e19('0x49')][_0x8e19('0x4b')]?_0x343cf8['attributes']:_0x534df7[_0x8e19('0x45')];if(_0x21a470['query'][_0x8e19('0x59')]){_0x343cf8['include']=[{'all':!![]}];}_0x343cf8=_[_0x8e19('0x53')]({},_0x343cf8,_0x21a470[_0x8e19('0x57')]);return db[_0x8e19('0x58')][_0x8e19('0x60')](_0x343cf8)[_0x8e19('0x23')](handleEntityNotFound(_0x19fe47,null))[_0x8e19('0x23')](respondWithResult(_0x19fe47,null))[_0x8e19('0x5d')](handleError(_0x19fe47,null));};exports[_0x8e19('0x61')]=function(_0x58632b,_0x1a95f0){return db[_0x8e19('0x58')][_0x8e19('0x61')](_0x58632b[_0x8e19('0x62')],{})[_0x8e19('0x23')](function(_0x4c30ac){var _0xcdc7b4=_0x58632b['user'][_0x8e19('0x3a')]({'plain':!![]});if(!_0xcdc7b4)throw new Error(_0x8e19('0x63'));if(_0xcdc7b4[_0x8e19('0x64')]===_0x8e19('0x65')){var _0x5a4b10=_0x4c30ac['get']({'plain':!![]});var _0x10125c='OpenchannelAccounts';return db[_0x8e19('0x66')][_0x8e19('0x60')]({'where':{'name':_0x10125c,'userProfileId':_0xcdc7b4[_0x8e19('0x67')]},'raw':!![]})[_0x8e19('0x23')](function(_0x237c9d){if(_0x237c9d&&_0x237c9d[_0x8e19('0x68')]===0x0){return db['UserProfileResource']['create']({'name':_0x5a4b10[_0x8e19('0x55')],'resourceId':_0x5a4b10['id'],'type':_0x237c9d[_0x8e19('0x55')],'sectionId':_0x237c9d['id']},{})[_0x8e19('0x23')](function(){return _0x4c30ac;});}else{return _0x4c30ac;}})[_0x8e19('0x5d')](function(_0x113ad8){logger[_0x8e19('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x113ad8);throw _0x113ad8;});}return _0x4c30ac;})['then'](respondWithResult(_0x1a95f0,0xc9))['catch'](handleError(_0x1a95f0,null));};exports['update']=function(_0x1db2a1,_0x38772e){if(_0x1db2a1['body']['id']){delete _0x1db2a1[_0x8e19('0x62')]['id'];}return db[_0x8e19('0x58')]['find']({'where':{'id':_0x1db2a1[_0x8e19('0x69')]['id']},'include':[{'model':db[_0x8e19('0x40')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x38772e,null))[_0x8e19('0x23')](saveUpdates(_0x1db2a1[_0x8e19('0x62')],null))[_0x8e19('0x23')](respondWithResult(_0x38772e,null))[_0x8e19('0x5d')](handleError(_0x38772e,null));};exports['destroy']=function(_0x4513a7,_0x53cda1){return db[_0x8e19('0x58')]['find']({'where':{'id':_0x4513a7['params']['id']}})[_0x8e19('0x23')](handleEntityNotFound(_0x53cda1,null))[_0x8e19('0x23')](removeEntity(_0x53cda1,null))['catch'](handleError(_0x53cda1,null));};exports[_0x8e19('0x6a')]=function(_0x45989e,_0x1dfec){return db[_0x8e19('0x58')][_0x8e19('0x6a')]()['then'](respondWithResult(_0x1dfec,null))['catch'](handleError(_0x1dfec,null));};exports[_0x8e19('0x6b')]=function(_0x4313b5,_0x3fdb62,_0x4e7daf){if(_0x4313b5['body']['id']){delete _0x4313b5[_0x8e19('0x62')]['id'];}return db['OpenchannelAccount'][_0x8e19('0x60')]({'where':{'id':_0x4313b5[_0x8e19('0x69')]['id']}})['then'](handleEntityNotFound(_0x3fdb62,null))[_0x8e19('0x23')](function(_0x54f96e){if(_0x54f96e){_0x4313b5['body'][_0x8e19('0x6c')]=_0x54f96e['id'];return db[_0x8e19('0x6d')]['create'](_0x4313b5[_0x8e19('0x62')]);}})['then'](respondWithResult(_0x3fdb62,null))[_0x8e19('0x5d')](handleError(_0x3fdb62,null));};exports[_0x8e19('0x6e')]=function(_0x44c020,_0x39afb0,_0x16f413){var _0x461ff4={'raw':![],'where':{}};var _0x42ba29={};var _0xd43ab9={'count':0x0,'rows':[]};return db[_0x8e19('0x58')][_0x8e19('0x6f')]({'where':{'id':_0x44c020['params']['id']}})[_0x8e19('0x23')](handleEntityNotFound(_0x39afb0,null))[_0x8e19('0x23')](function(_0x388c56){if(_0x388c56){_0x42ba29[_0x8e19('0x45')]=_[_0x8e19('0x48')](db[_0x8e19('0x6d')][_0x8e19('0x42')]);_0x42ba29[_0x8e19('0x47')]=_[_0x8e19('0x48')](_0x44c020['query']);_0x42ba29[_0x8e19('0x51')]=_[_0x8e19('0x5f')](_0x42ba29[_0x8e19('0x45')],_0x42ba29[_0x8e19('0x47')]);_0x461ff4[_0x8e19('0x49')]=_['intersection'](_0x42ba29[_0x8e19('0x45')],qs[_0x8e19('0x4a')](_0x44c020[_0x8e19('0x47')][_0x8e19('0x4a')]));_0x461ff4[_0x8e19('0x49')]=_0x461ff4[_0x8e19('0x49')]['length']?_0x461ff4[_0x8e19('0x49')]:_0x42ba29[_0x8e19('0x45')];if(!_0x44c020[_0x8e19('0x47')]['hasOwnProperty'](_0x8e19('0x4d'))){_0x461ff4[_0x8e19('0x32')]=qs[_0x8e19('0x32')](_0x44c020[_0x8e19('0x47')]['limit']);_0x461ff4['offset']=qs[_0x8e19('0x30')](_0x44c020[_0x8e19('0x47')]['offset']);}_0x461ff4[_0x8e19('0x4e')]=qs['sort'](_0x44c020[_0x8e19('0x47')][_0x8e19('0x4f')]);_0x461ff4[_0x8e19('0x50')]=qs[_0x8e19('0x51')](_[_0x8e19('0x52')](_0x44c020['query'],_0x42ba29[_0x8e19('0x51')]));_0x461ff4[_0x8e19('0x50')]['OpenchannelAccountId']=_0x388c56['id'];if(_0x44c020[_0x8e19('0x47')]['filter']){_0x461ff4[_0x8e19('0x50')]=_[_0x8e19('0x53')](_0x461ff4['where'],{'$or':_[_0x8e19('0x46')](_0x461ff4['attributes'],function(_0x247eb1){var _0x3ed86e={};_0x3ed86e[_0x247eb1]={'$like':'%'+_0x44c020[_0x8e19('0x47')]['filter']+'%'};return _0x3ed86e;})});}_0x461ff4=_[_0x8e19('0x53')]({},_0x461ff4,_0x44c020[_0x8e19('0x57')]);return db[_0x8e19('0x6d')][_0x8e19('0x33')]({'where':_0x461ff4['where']})[_0x8e19('0x23')](function(_0x3d01cd){_0xd43ab9[_0x8e19('0x33')]=_0x3d01cd;if(_0x44c020['query'][_0x8e19('0x59')]){_0x461ff4[_0x8e19('0x5a')]=[{'all':!![]}];}return db[_0x8e19('0x6d')][_0x8e19('0x5b')](_0x461ff4);})[_0x8e19('0x23')](function(_0x5b3020){_0xd43ab9[_0x8e19('0x5c')]=_0x5b3020;return _0xd43ab9;});}})[_0x8e19('0x23')](respondWithFilteredResult(_0x39afb0,_0x461ff4))[_0x8e19('0x5d')](handleError(_0x39afb0,null));};exports[_0x8e19('0x70')]=function(_0x4e13f0,_0x378ca4,_0x1e374d){return db[_0x8e19('0x58')][_0x8e19('0x60')]({'where':{'id':_0x4e13f0[_0x8e19('0x69')]['id']}})[_0x8e19('0x23')](handleEntityNotFound(_0x378ca4,null))['then'](function(_0x3eb633){if(_0x3eb633){return _0x3eb633['removeDispositions'](_0x4e13f0[_0x8e19('0x47')][_0x8e19('0x71')]);}})[_0x8e19('0x23')](respondWithStatusCode(_0x378ca4,null))['catch'](handleError(_0x378ca4,null));};exports[_0x8e19('0x72')]=function(_0x1833a8,_0xef217b,_0x45d292){if(_0x1833a8['body']['id']){delete _0x1833a8[_0x8e19('0x62')]['id'];}return db['OpenchannelAccount'][_0x8e19('0x60')]({'where':{'id':_0x1833a8[_0x8e19('0x69')]['id']}})[_0x8e19('0x23')](handleEntityNotFound(_0xef217b,null))[_0x8e19('0x23')](function(_0x41f29c){if(_0x41f29c){_0x1833a8['body'][_0x8e19('0x6c')]=_0x41f29c['id'];return db[_0x8e19('0x73')][_0x8e19('0x61')](_0x1833a8[_0x8e19('0x62')]);}})['then'](respondWithResult(_0xef217b,null))[_0x8e19('0x5d')](handleError(_0xef217b,null));};exports[_0x8e19('0x74')]=function(_0x597c45,_0x284368,_0x5c658f){var _0x1f7bd8={'raw':![],'where':{}};var _0x452c34={};var _0x4e082b={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x8e19('0x6f')]({'where':{'id':_0x597c45[_0x8e19('0x69')]['id']}})[_0x8e19('0x23')](handleEntityNotFound(_0x284368,null))[_0x8e19('0x23')](function(_0x5b7b81){if(_0x5b7b81){_0x452c34[_0x8e19('0x45')]=_[_0x8e19('0x48')](db[_0x8e19('0x73')][_0x8e19('0x42')]);_0x452c34[_0x8e19('0x47')]=_['keys'](_0x597c45[_0x8e19('0x47')]);_0x452c34[_0x8e19('0x51')]=_[_0x8e19('0x5f')](_0x452c34[_0x8e19('0x45')],_0x452c34[_0x8e19('0x47')]);_0x1f7bd8[_0x8e19('0x49')]=_['intersection'](_0x452c34['model'],qs[_0x8e19('0x4a')](_0x597c45[_0x8e19('0x47')][_0x8e19('0x4a')]));_0x1f7bd8['attributes']=_0x1f7bd8[_0x8e19('0x49')][_0x8e19('0x4b')]?_0x1f7bd8['attributes']:_0x452c34['model'];if(!_0x597c45[_0x8e19('0x47')][_0x8e19('0x4c')](_0x8e19('0x4d'))){_0x1f7bd8['limit']=qs['limit'](_0x597c45[_0x8e19('0x47')][_0x8e19('0x32')]);_0x1f7bd8[_0x8e19('0x30')]=qs[_0x8e19('0x30')](_0x597c45[_0x8e19('0x47')]['offset']);}_0x1f7bd8[_0x8e19('0x4e')]=qs['sort'](_0x597c45[_0x8e19('0x47')]['sort']);_0x1f7bd8[_0x8e19('0x50')]=qs[_0x8e19('0x51')](_['pick'](_0x597c45[_0x8e19('0x47')],_0x452c34['filters']));_0x1f7bd8[_0x8e19('0x50')]['OpenchannelAccountId']=_0x5b7b81['id'];if(_0x597c45[_0x8e19('0x47')][_0x8e19('0x56')]){_0x1f7bd8[_0x8e19('0x50')]=_['merge'](_0x1f7bd8['where'],{'$or':_['map'](_0x1f7bd8[_0x8e19('0x49')],function(_0x5dccf3){var _0x287923={};_0x287923[_0x5dccf3]={'$like':'%'+_0x597c45[_0x8e19('0x47')]['filter']+'%'};return _0x287923;})});}_0x1f7bd8=_[_0x8e19('0x53')]({},_0x1f7bd8,_0x597c45[_0x8e19('0x57')]);return db[_0x8e19('0x73')][_0x8e19('0x33')]({'where':_0x1f7bd8[_0x8e19('0x50')]})[_0x8e19('0x23')](function(_0x3c708d){_0x4e082b['count']=_0x3c708d;if(_0x597c45['query'][_0x8e19('0x59')]){_0x1f7bd8[_0x8e19('0x5a')]=[{'all':!![]}];}return db[_0x8e19('0x73')][_0x8e19('0x5b')](_0x1f7bd8);})[_0x8e19('0x23')](function(_0x33e58f){_0x4e082b['rows']=_0x33e58f;return _0x4e082b;});}})[_0x8e19('0x23')](respondWithFilteredResult(_0x284368,_0x1f7bd8))[_0x8e19('0x5d')](handleError(_0x284368,null));};exports[_0x8e19('0x75')]=function(_0x47b065,_0x9ece58,_0x9175e4){return db[_0x8e19('0x58')]['find']({'where':{'id':_0x47b065[_0x8e19('0x69')]['id']}})[_0x8e19('0x23')](handleEntityNotFound(_0x9ece58,null))['then'](function(_0x341750){if(_0x341750){return _0x341750[_0x8e19('0x75')](_0x47b065[_0x8e19('0x47')][_0x8e19('0x71')]);}})[_0x8e19('0x23')](respondWithStatusCode(_0x9ece58,null))[_0x8e19('0x5d')](handleError(_0x9ece58,null));};exports[_0x8e19('0x76')]=function(_0x39e880,_0x4f6b6a,_0x37d67a){var _0x4ce341={'body':_0x39e880['body'],'channel':_0x8e19('0x77')};var _0x9fab9=[];var _0x48adaa=[];var _0x55a880={};var _0x2ed8b0=![];return db[_0x8e19('0x78')]['describe']()[_0x8e19('0x23')](function(_0x1e3131){if(!_0x1e3131){throw new db[(_0x8e19('0x79'))]['ValidationError']('no\x20available\x20attributes');}_0x9fab9=_[_0x8e19('0x7a')](_[_0x8e19('0x48')](_0x1e3131),[_0x8e19('0x7b'),_0x8e19('0x7c')]);_0x48adaa=_[_0x8e19('0x7a')](_[_0x8e19('0x48')](_0x1e3131),['createdAt','updatedAt','CompanyId',_0x8e19('0x7d')]);if(_0x39e880[_0x8e19('0x62')]['id']){delete _0x39e880[_0x8e19('0x62')]['id'];}if(_['isNil'](_0x39e880[_0x8e19('0x62')][_0x8e19('0x7e')])){throw new db[(_0x8e19('0x79'))][(_0x8e19('0x7f'))](_0x8e19('0x80'));}if(_[_0x8e19('0x81')](_0x39e880[_0x8e19('0x62')][_0x8e19('0x62')])||_0x39e880[_0x8e19('0x62')][_0x8e19('0x62')]===''){throw new db['Sequelize'][(_0x8e19('0x7f'))](_0x8e19('0x82'));}if(_[_0x8e19('0x81')](_0x39e880[_0x8e19('0x62')][_0x8e19('0x83')])){throw new db['Sequelize'][(_0x8e19('0x7f'))](_0x8e19('0x84')+_0x48adaa);}if(!_[_0x8e19('0x85')](_0x48adaa,_0x39e880['body'][_0x8e19('0x83')])){throw new db[(_0x8e19('0x79'))][(_0x8e19('0x7f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x48adaa);}_0x55a880[_0x39e880[_0x8e19('0x62')][_0x8e19('0x83')]]=_0x39e880[_0x8e19('0x62')]['from'];})[_0x8e19('0x23')](function(){return db[_0x8e19('0x58')][_0x8e19('0x60')]({'where':{'id':_0x39e880[_0x8e19('0x69')]['id']},'include':[{'model':db[_0x8e19('0x86')],'as':_0x8e19('0x87'),'include':[{'model':db[_0x8e19('0x78')],'as':_0x8e19('0x88'),'where':_0x55a880,'limit':0x1,'order':[[_0x8e19('0x7c'),_0x8e19('0x89')]]}]},{'model':db[_0x8e19('0x8a')],'as':_0x8e19('0x8b')}]});})['then'](handleEntityNotFound(_0x4f6b6a,null))[_0x8e19('0x23')](function(_0x288eac){if(_0x288eac&&_0x288eac[_0x8e19('0x87')]){_0x4ce341[_0x8e19('0x8c')]=_0x288eac;_0x4ce341[_0x8e19('0x8d')]=_0x288eac[_0x8e19('0x8b')];_0x4ce341[_0x8e19('0x8e')]=_0x288eac[_0x8e19('0x87')];_0x4ce341[_0x8e19('0x8d')]=_[_0x8e19('0x8f')](_0x4ce341[_0x8e19('0x8d')],[_0x8e19('0x90')],[_0x8e19('0x91')]);if(_0x4ce341[_0x8e19('0x8c')][_0x8e19('0x8b')]){delete _0x4ce341[_0x8e19('0x8c')][_0x8e19('0x8b')];}if(_0x4ce341[_0x8e19('0x8c')][_0x8e19('0x87')]&&_0x4ce341[_0x8e19('0x8c')][_0x8e19('0x87')][_0x8e19('0x88')][_0x8e19('0x4b')]){return _0x4ce341[_0x8e19('0x8c')][_0x8e19('0x87')][_0x8e19('0x88')][0x0];}var _0x39350f=_[_0x8e19('0x1b')](_0x39e880['body'],{'firstName':_0x39e880[_0x8e19('0x62')][_0x8e19('0x7e')],'ListId':_0x288eac[_0x8e19('0x7d')]});_0x39350f[_0x39e880['body']['mapKey']]=_0x39e880[_0x8e19('0x62')][_0x8e19('0x7e')];return db['CmContact'][_0x8e19('0x61')](_0x39350f,{'fields':_0x9fab9,'raw':!![]});}})['then'](handleEntityNotFound(_0x4f6b6a,null))[_0x8e19('0x23')](function(_0x50a828){_0x4ce341[_0x8e19('0x92')]=_0x50a828;if(_0x50a828){var _0x431d47={'ContactId':_0x50a828['id'],'OpenchannelAccountId':_0x39e880[_0x8e19('0x69')]['id'],'from':(_0x50a828[_0x8e19('0x93')]||'')+'\x20'+(_0x50a828[_0x8e19('0x94')]||'')};var _0x1d368e={'OpenchannelAccountId':_0x39e880[_0x8e19('0x69')]['id'],'closed':![]};if(_0x39e880['body'][_0x8e19('0x95')]){_0x1d368e[_0x8e19('0x95')]=_0x39e880[_0x8e19('0x62')][_0x8e19('0x95')];return db['OpenchannelInteraction'][_0x8e19('0x60')]({'where':_0x1d368e})['then'](function(_0x2e6b6e){if(_0x2e6b6e){return[_0x2e6b6e,![]];}_0x431d47[_0x8e19('0x95')]=_0x39e880[_0x8e19('0x62')][_0x8e19('0x95')];_0x431d47[_0x8e19('0x96')]=_0x39e880[_0x8e19('0x62')]['externalUrl'];return db['OpenchannelInteraction'][_0x8e19('0x61')](_0x431d47)[_0x8e19('0x23')](function(_0x5c7a97){return[_0x5c7a97,!![]];});});}else{_0x1d368e[_0x8e19('0x95')]=null;}_0x1d368e['ContactId']=_0x50a828['id'];return db['OpenchannelInteraction']['find']({'where':_0x1d368e})[_0x8e19('0x23')](function(_0x1d90fd){if(_0x1d90fd){return[_0x1d90fd,![]];}return db[_0x8e19('0x97')]['create'](_0x431d47)[_0x8e19('0x23')](function(_0x1d6761){return[_0x1d6761,!![]];});});}})['spread'](function(_0x523f2a,_0x35d9b1){if(_0x523f2a){_0x2ed8b0=_0x35d9b1;if(!_0x35d9b1){var _0x234457={'from':(_0x4ce341[_0x8e19('0x92')]['firstName']||'')+'\x20'+(_0x4ce341[_0x8e19('0x92')][_0x8e19('0x94')]||'')};if(_0x39e880[_0x8e19('0x62')][_0x8e19('0x95')]&&_0x39e880[_0x8e19('0x62')]['messageId']&&_0x39e880[_0x8e19('0x62')][_0x8e19('0x95')]!=_0x39e880[_0x8e19('0x62')][_0x8e19('0x98')]){_0x234457[_0x8e19('0x95')]=_0x39e880[_0x8e19('0x62')][_0x8e19('0x98')];}return _0x523f2a[_0x8e19('0x38')](_0x234457);}else{return _0x523f2a;}}})[_0x8e19('0x23')](function(_0x4b59b0){_0x4ce341[_0x8e19('0x99')]=_0x4b59b0['get']({'plain':!![]});_0x4ce341['interaction'][_0x8e19('0x9a')]=_0x2ed8b0;if(_0x4ce341[_0x8e19('0x99')][_0x8e19('0x9a')]){if(_0x4ce341[_0x8e19('0x8c')][_0x8e19('0x9b')]){_0x4ce341[_0x8e19('0x8d')][_0x8e19('0x9c')]({'id':0x0,'priority':_0x4ce341['applications'][_0x8e19('0x4b')]+0x1,'app':_0x8e19('0x9d'),'appdata':'unmanaged','interval':_0x8e19('0x9e')});}}return db[_0x8e19('0x9f')][_0x8e19('0x61')]({'body':_0x39e880[_0x8e19('0x62')][_0x8e19('0x62')],'OpenchannelAccountId':_0x39e880['params']['id'],'OpenchannelInteractionId':_0x4b59b0['id'],'direction':'in','ContactId':_0x4ce341[_0x8e19('0x92')]['id'],'AttachmentId':_0x39e880[_0x8e19('0x62')][_0x8e19('0xa0')]});})[_0x8e19('0x23')](function(_0x18ab54){_0x4ce341[_0x8e19('0x2b')]=_0x18ab54;if(_0x4ce341['interaction'][_0x8e19('0xa1')]){return db[_0x8e19('0xa2')][_0x8e19('0x60')]({'attributes':['id',_0x8e19('0x55')],'where':{'id':_0x4ce341[_0x8e19('0x99')][_0x8e19('0xa1')]}})[_0x8e19('0x23')](function(_0x2df28f){if(_0x2df28f){_0x4ce341[_0x8e19('0x8d')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8e19('0xa3'),'appdata':_0x2df28f[_0x8e19('0x55')]+','+(_0x4ce341[_0x8e19('0x8c')][_0x8e19('0xa4')]||0xa),'interval':'*,*,*,*'});_0x4ce341[_0x8e19('0xa5')]=![];}return respondWithRpcPromise(_0x8e19('0xa6'),_0x8e19('0xa7'),_0x4ce341);});}return respondWithRpcPromise('Start',_0x8e19('0xa7'),_0x4ce341);})[_0x8e19('0x23')](function(_0x371443){respondWithRpcPromise('EventManager',_0x8e19('0xa8'),{'event':_0x8e19('0x76'),'message':_0x371443},client9002);return _0x371443;})[_0x8e19('0x23')](respondWithResult(_0x4f6b6a,null))[_0x8e19('0x5d')](handleError(_0x4f6b6a,null));};exports[_0x8e19('0xa9')]=function(_0x294d03,_0x44644d){var _0x235d34=_0x294d03[_0x8e19('0x69')]['id'];var _0x4d6069=_0x294d03['body'];var _0x1ea6de=0xc8;var _0xf68e3a=null;return db['sequelize'][_0x8e19('0xaa')]({'isolationLevel':db[_0x8e19('0xab')][_0x8e19('0xac')]['ISOLATION_LEVELS'][_0x8e19('0xad')]},function(_0x166fb5){return db[_0x8e19('0x58')][_0x8e19('0x6f')]({'where':{'id':_0x235d34},'transaction':_0x166fb5})['then'](function(_0x38d55d){if(_0x38d55d){return db[_0x8e19('0x8a')]['destroy']({'where':{'OpenchannelAccountId':_0x235d34},'transaction':_0x166fb5})[_0x8e19('0x23')](function(){var _0x3d692e=_[_0x8e19('0x46')](_0x4d6069,function(_0x564d23){_0x564d23['OpenchannelAccountId']=_0x235d34;return _0x564d23;});return db[_0x8e19('0x8a')][_0x8e19('0xae')](_0x3d692e,{'transaction':_0x166fb5});});}else{_0x1ea6de=0x194;_0xf68e3a=[];}});})[_0x8e19('0x23')](function(){if(_0x1ea6de!==0x194){return db['OpenchannelApplication'][_0x8e19('0xaf')]({'where':{'OpenchannelAccountId':_0x235d34},'order':_0x8e19('0x90')})[_0x8e19('0x23')](function(_0x2d1a7d){_0xf68e3a=_0x2d1a7d;});}})[_0x8e19('0x5d')](function(_0x5876d0){_0x1ea6de=0x1f4;logger['error'](_0x5876d0['stack']);if(_0x5876d0[_0x8e19('0x55')]){delete _0x5876d0['name'];}_0xf68e3a=_0x5876d0;})[_0x8e19('0xb0')](function(){if(_0xf68e3a===null){_0x44644d[_0x8e19('0x3d')](_0x1ea6de);}else{if(_0x1ea6de===0x1f4){_0x44644d[_0x8e19('0x2d')](_0x1ea6de)[_0x8e19('0x3e')](_0xf68e3a);}else{_0x44644d[_0x8e19('0x2d')](_0x1ea6de)['json'](_0xf68e3a);}}});};exports[_0x8e19('0xb1')]=function(_0x2e24c7,_0x191dd3,_0x3a698b){var _0x4ca4b5={};var _0x2093d1={};var _0x15ef63;var _0x86a2ac;return db[_0x8e19('0x58')][_0x8e19('0x6f')]({'where':{'id':_0x2e24c7['params']['id']}})['then'](handleEntityNotFound(_0x191dd3,null))['then'](function(_0x2be8d2){if(_0x2be8d2){_0x15ef63=_0x2be8d2;_0x2093d1[_0x8e19('0x45')]=_['keys'](db[_0x8e19('0x8a')]['rawAttributes']);_0x2093d1[_0x8e19('0x47')]=_[_0x8e19('0x48')](_0x2e24c7[_0x8e19('0x47')]);_0x2093d1['filters']=_[_0x8e19('0x5f')](_0x2093d1[_0x8e19('0x45')],_0x2093d1['query']);_0x4ca4b5['attributes']=_['intersection'](_0x2093d1[_0x8e19('0x45')],qs['fields'](_0x2e24c7[_0x8e19('0x47')]['fields']));_0x4ca4b5['attributes']=_0x4ca4b5[_0x8e19('0x49')][_0x8e19('0x4b')]?_0x4ca4b5[_0x8e19('0x49')]:_0x2093d1[_0x8e19('0x45')];_0x4ca4b5[_0x8e19('0x4e')]=qs['sort'](_0x2e24c7[_0x8e19('0x47')][_0x8e19('0x4f')]);_0x4ca4b5[_0x8e19('0x50')]=qs[_0x8e19('0x51')](_[_0x8e19('0x52')](_0x2e24c7[_0x8e19('0x47')],_0x2093d1[_0x8e19('0x51')]));if(_0x2e24c7[_0x8e19('0x47')][_0x8e19('0x56')]){_0x4ca4b5[_0x8e19('0x50')]=_[_0x8e19('0x53')](_0x4ca4b5[_0x8e19('0x50')],{'$or':_[_0x8e19('0x46')](_0x4ca4b5[_0x8e19('0x49')],function(_0x4c625){var _0x598efa={};_0x598efa[_0x4c625]={'$like':'%'+_0x2e24c7[_0x8e19('0x47')][_0x8e19('0x56')]+'%'};return _0x598efa;})});}_0x4ca4b5=_['merge']({},_0x4ca4b5,_0x2e24c7[_0x8e19('0x57')]);return _0x15ef63[_0x8e19('0xb1')](_0x4ca4b5);}})[_0x8e19('0x23')](function(_0x13e4de){if(_0x13e4de){_0x86a2ac=_0x13e4de[_0x8e19('0x4b')];if(!_0x2e24c7[_0x8e19('0x47')]['hasOwnProperty']('nolimit')){_0x4ca4b5[_0x8e19('0x32')]=qs['limit'](_0x2e24c7[_0x8e19('0x47')]['limit']);_0x4ca4b5[_0x8e19('0x30')]=qs[_0x8e19('0x30')](_0x2e24c7['query'][_0x8e19('0x30')]);}return _0x15ef63[_0x8e19('0xb1')](_0x4ca4b5);}})[_0x8e19('0x23')](function(_0x5e151d){if(_0x5e151d){return _0x5e151d?{'count':_0x86a2ac,'rows':_0x5e151d}:null;}})['then'](respondWithResult(_0x191dd3,null))[_0x8e19('0x5d')](handleError(_0x191dd3,null));};exports[_0x8e19('0xb2')]=function(_0x161fa4,_0x3f8872,_0xd0e1b7){var _0x494920={'raw':![],'where':{}};var _0x5a8117={};var _0x37cdef={'count':0x0,'rows':[]};return db[_0x8e19('0x58')][_0x8e19('0x6f')]({'where':{'id':_0x161fa4['params']['id']}})[_0x8e19('0x23')](handleEntityNotFound(_0x3f8872,null))[_0x8e19('0x23')](function(_0x20c5ae){if(_0x20c5ae){_0x5a8117[_0x8e19('0x45')]=_['keys'](db['OpenchannelInteraction'][_0x8e19('0x42')]);_0x5a8117[_0x8e19('0x47')]=_[_0x8e19('0x48')](_0x161fa4['query']);_0x5a8117[_0x8e19('0x51')]=_[_0x8e19('0x5f')](_0x5a8117[_0x8e19('0x45')],_0x5a8117[_0x8e19('0x47')]);_0x494920['attributes']=_[_0x8e19('0x5f')](_0x5a8117[_0x8e19('0x45')],qs[_0x8e19('0x4a')](_0x161fa4[_0x8e19('0x47')][_0x8e19('0x4a')]));_0x494920[_0x8e19('0x49')]=_0x494920[_0x8e19('0x49')][_0x8e19('0x4b')]?_0x494920[_0x8e19('0x49')]:_0x5a8117[_0x8e19('0x45')];if(!_0x161fa4[_0x8e19('0x47')][_0x8e19('0x4c')](_0x8e19('0x4d'))){_0x494920[_0x8e19('0x32')]=qs[_0x8e19('0x32')](_0x161fa4[_0x8e19('0x47')][_0x8e19('0x32')]);_0x494920[_0x8e19('0x30')]=qs['offset'](_0x161fa4['query'][_0x8e19('0x30')]);}_0x494920['order']=qs[_0x8e19('0x4f')](_0x161fa4[_0x8e19('0x47')][_0x8e19('0x4f')]);_0x494920[_0x8e19('0x50')]=qs['filters'](_[_0x8e19('0x52')](_0x161fa4[_0x8e19('0x47')],_0x5a8117[_0x8e19('0x51')]));_0x494920[_0x8e19('0x50')][_0x8e19('0x6c')]=_0x20c5ae['id'];if(_0x161fa4[_0x8e19('0x47')]['filter']){_0x494920['where']=_[_0x8e19('0x53')](_0x494920[_0x8e19('0x50')],{'$or':_[_0x8e19('0x46')](_0x494920['attributes'],function(_0x318642){var _0x4b582f={};_0x4b582f[_0x318642]={'$like':'%'+_0x161fa4[_0x8e19('0x47')][_0x8e19('0x56')]+'%'};return _0x4b582f;})});}_0x494920=_[_0x8e19('0x53')]({},_0x494920,_0x161fa4[_0x8e19('0x57')]);return db[_0x8e19('0x97')][_0x8e19('0x33')]({'where':_0x494920[_0x8e19('0x50')]})[_0x8e19('0x23')](function(_0x9f8d7e){_0x37cdef[_0x8e19('0x33')]=_0x9f8d7e;if(_0x161fa4[_0x8e19('0x47')][_0x8e19('0x59')]){_0x494920[_0x8e19('0x5a')]=[{'model':db[_0x8e19('0x78')],'as':_0x8e19('0xb3'),'required':![]},{'model':db[_0x8e19('0xa2')],'as':'Owner','attributes':[_0x8e19('0x55'),_0x8e19('0xb4'),'internal'],'required':![]},{'model':db[_0x8e19('0xb5')],'as':_0x8e19('0xb6'),'attributes':['id',_0x8e19('0x55'),_0x8e19('0xb7')],'where':_0x161fa4[_0x8e19('0x47')][_0x8e19('0xb8')]?{'id':_0x161fa4[_0x8e19('0x47')][_0x8e19('0xb8')]}:undefined,'required':_0x161fa4[_0x8e19('0x47')]['tag']?!![]:![]}];}return db[_0x8e19('0x97')][_0x8e19('0x5b')](_0x494920);})[_0x8e19('0x23')](function(_0x96035e){_0x37cdef['rows']=_0x96035e;return _0x37cdef;});}})['then'](respondWithFilteredResult(_0x3f8872,_0x494920))['catch'](handleError(_0x3f8872,null));};exports[_0x8e19('0xb9')]=function(_0x445102,_0x52e933,_0x369adf){return db[_0x8e19('0x58')][_0x8e19('0x60')]({'where':{'id':_0x445102[_0x8e19('0x69')]['id']}})['then'](handleEntityNotFound(_0x52e933,null))[_0x8e19('0x23')](function(_0x2a1616){if(_0x2a1616){return _0x2a1616[_0x8e19('0xb9')](_0x445102[_0x8e19('0x62')][_0x8e19('0x71')],_[_0x8e19('0xba')](_0x445102[_0x8e19('0x62')],[_0x8e19('0x71'),'id'])||{})[_0x8e19('0xbb')](function(_0x44c995){for(var _0x54fe68=0x0;_0x54fe68<_0x445102['body'][_0x8e19('0x71')][_0x8e19('0x4b')];_0x54fe68+=0x1){socket['emit'](_0x8e19('0xbc'),{'UserId':Number(_0x445102[_0x8e19('0x62')][_0x8e19('0x71')][_0x54fe68]),'OpenchannelAccountId':Number(_0x445102[_0x8e19('0x69')]['id'])});}return _0x44c995;});}})[_0x8e19('0x23')](respondWithResult(_0x52e933,null))[_0x8e19('0x5d')](handleError(_0x52e933,null));};exports[_0x8e19('0xbd')]=function(_0x18eee3,_0x43218e,_0x5efe4e){return db[_0x8e19('0x58')][_0x8e19('0x60')]({'where':{'id':_0x18eee3[_0x8e19('0x69')]['id']}})[_0x8e19('0x23')](handleEntityNotFound(_0x43218e,null))[_0x8e19('0x23')](function(_0x4fdade){if(_0x4fdade){return _0x4fdade[_0x8e19('0xbd')](_0x18eee3['query'][_0x8e19('0x71')])[_0x8e19('0x23')](function(){if(_[_0x8e19('0xbe')](_0x18eee3[_0x8e19('0x47')][_0x8e19('0x71')])){for(var _0x348afa=0x0;_0x348afa<_0x18eee3['query'][_0x8e19('0x71')][_0x8e19('0x4b')];_0x348afa+=0x1){socket[_0x8e19('0xbf')](_0x8e19('0xc0'),{'UserId':Number(_0x18eee3[_0x8e19('0x47')][_0x8e19('0x71')][_0x348afa]),'OpenchannelAccountId':Number(_0x18eee3[_0x8e19('0x69')]['id'])});}}else{socket[_0x8e19('0xbf')](_0x8e19('0xc0'),{'UserId':Number(_0x18eee3[_0x8e19('0x47')][_0x8e19('0x71')]),'OpenchannelAccountId':Number(_0x18eee3['params']['id'])});}});}})['then'](respondWithStatusCode(_0x43218e,null))[_0x8e19('0x5d')](handleError(_0x43218e,null));};exports[_0x8e19('0xc1')]=function(_0x33ea61,_0x364fe9,_0x4124a4){var _0x3961f3={};var _0x29f632={};var _0x45c28c;var _0xa817d1;return db[_0x8e19('0x58')][_0x8e19('0x6f')]({'where':{'id':_0x33ea61[_0x8e19('0x69')]['id']}})[_0x8e19('0x23')](handleEntityNotFound(_0x364fe9,null))[_0x8e19('0x23')](function(_0x8700c7){if(_0x8700c7){_0x45c28c=_0x8700c7;_0x29f632[_0x8e19('0x45')]=_['keys'](db['User'][_0x8e19('0x42')]);_0x29f632['query']=_['keys'](_0x33ea61[_0x8e19('0x47')]);_0x29f632[_0x8e19('0x51')]=_['intersection'](_0x29f632[_0x8e19('0x45')],_0x29f632['query']);_0x3961f3[_0x8e19('0x49')]=_['intersection'](_0x29f632[_0x8e19('0x45')],qs[_0x8e19('0x4a')](_0x33ea61[_0x8e19('0x47')]['fields']));_0x3961f3[_0x8e19('0x49')]=_0x3961f3['attributes']['length']?_0x3961f3[_0x8e19('0x49')]:_0x29f632[_0x8e19('0x45')];_0x3961f3[_0x8e19('0x4e')]=qs[_0x8e19('0x4f')](_0x33ea61[_0x8e19('0x47')][_0x8e19('0x4f')]);_0x3961f3['where']=qs['filters'](_['pick'](_0x33ea61[_0x8e19('0x47')],_0x29f632['filters']));if(_0x33ea61[_0x8e19('0x47')]['filter']){_0x3961f3[_0x8e19('0x50')]=_[_0x8e19('0x53')](_0x3961f3['where'],{'$or':_[_0x8e19('0x46')](_0x3961f3[_0x8e19('0x49')],function(_0x5c3afc){var _0x9b48a={};_0x9b48a[_0x5c3afc]={'$like':'%'+_0x33ea61[_0x8e19('0x47')][_0x8e19('0x56')]+'%'};return _0x9b48a;})});}_0x3961f3=_['merge']({},_0x3961f3,_0x33ea61[_0x8e19('0x57')]);return _0x45c28c[_0x8e19('0xc1')](_0x3961f3);}})[_0x8e19('0x23')](function(_0x24d6c3){if(_0x24d6c3){_0xa817d1=_0x24d6c3['length'];if(!_0x33ea61['query'][_0x8e19('0x4c')](_0x8e19('0x4d'))){_0x3961f3[_0x8e19('0x32')]=qs[_0x8e19('0x32')](_0x33ea61[_0x8e19('0x47')][_0x8e19('0x32')]);_0x3961f3[_0x8e19('0x30')]=qs[_0x8e19('0x30')](_0x33ea61[_0x8e19('0x47')]['offset']);}return _0x45c28c['getAgents'](_0x3961f3);}})[_0x8e19('0x23')](function(_0x4cf3da){if(_0x4cf3da){return _0x4cf3da?{'count':_0xa817d1,'rows':_0x4cf3da}:null;}})['then'](respondWithResult(_0x364fe9,null))[_0x8e19('0x5d')](handleError(_0x364fe9,null));};exports[_0x8e19('0x3e')]=function(_0x552ac9,_0x3f8879,_0x19e463){var _0x1f331a,_0x5bae45,_0x2beb9d;if(_[_0x8e19('0x81')](_0x552ac9[_0x8e19('0x62')]['body'])||_0x552ac9[_0x8e19('0x62')][_0x8e19('0x62')]===''){throw new db['Sequelize'][(_0x8e19('0x7f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8e19('0x81')](_0x552ac9[_0x8e19('0x62')]['to'])){}_0x1f331a=_0x552ac9[_0x8e19('0x62')]['to'];return db['OpenchannelAccount'][_0x8e19('0x6f')]({'where':{'id':_0x552ac9[_0x8e19('0x69')]['id']}})[_0x8e19('0x23')](handleEntityNotFound(_0x3f8879,null))[_0x8e19('0x23')](function(_0x174586){if(_0x174586){return db[_0x8e19('0x58')][_0x8e19('0x60')]({'where':{'id':_0x174586['id']},'include':[{'model':db[_0x8e19('0x86')],'as':_0x8e19('0x87'),'include':[{'model':db[_0x8e19('0x78')],'as':_0x8e19('0x88'),'where':{[_0x174586[_0x8e19('0x83')]]:_0x1f331a},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x3f8879,null))[_0x8e19('0x23')](function(_0x71b5e4){if(_0x71b5e4&&_0x71b5e4[_0x8e19('0x87')]){_0x5bae45=_0x71b5e4['get']({'plain':!![]});if(_0x5bae45['List']&&_0x5bae45[_0x8e19('0x87')]['Contacts']['length']){return _0x5bae45[_0x8e19('0x87')][_0x8e19('0x88')][0x0];}return db[_0x8e19('0x78')][_0x8e19('0x61')](_[_0x8e19('0x1b')](_0x552ac9[_0x8e19('0x62')],{'firstName':_0x1f331a,[_0x71b5e4[_0x8e19('0x83')]]:_0x1f331a,'phone':_0x1f331a,'ListId':_0x5bae45[_0x8e19('0x7d')]}));}})[_0x8e19('0x23')](handleEntityNotFound(_0x3f8879,null))[_0x8e19('0x23')](function(_0x1b32a6){if(_0x1b32a6){_0x2beb9d=_0x1b32a6;return db[_0x8e19('0x97')][_0x8e19('0x60')]({'where':{'ContactId':_0x2beb9d['id'],'closed':![],'OpenchannelAccountId':_0x5bae45['id']}})[_0x8e19('0x23')](function(_0x255db0){if(_0x255db0){return[_0x255db0,![]];}return db['OpenchannelInteraction'][_0x8e19('0x61')]({'UserId':_0x552ac9[_0x8e19('0x65')]['id'],'ContactId':_0x2beb9d['id'],'OpenchannelAccountId':_0x5bae45['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_[_0x8e19('0x53')](_0x552ac9[_0x8e19('0x62')],{'read':![],'body':_0x552ac9[_0x8e19('0x62')][_0x8e19('0x62')],'OpenchannelAccountId':_0x5bae45['id'],'UserId':_0x552ac9[_0x8e19('0x65')]['id'],'ContactId':_0x2beb9d['id']})]},{'include':[{'model':db[_0x8e19('0x9f')],'as':_0x8e19('0xc2')}]})['then'](function(_0xc4ead8){return[_0xc4ead8,!![]];});});}})[_0x8e19('0xbb')](function(_0x1546a6,_0x573f54){if(_0x573f54){return _0x1546a6;}return db[_0x8e19('0x9f')]['create'](_[_0x8e19('0x53')](_0x552ac9[_0x8e19('0x62')],{'read':![],'body':_0x552ac9[_0x8e19('0x62')][_0x8e19('0x62')],'OpenchannelAccountId':_0x5bae45['id'],'OpenchannelInteractionId':_0x1546a6['id'],'UserId':_0x552ac9[_0x8e19('0x65')]['id'],'ContactId':_0x2beb9d['id']}))[_0x8e19('0x23')](function(_0x3e1c03){_0x1546a6[_0x8e19('0xc3')][_0x8e19('0xc2')]=[];_0x1546a6[_0x8e19('0xc3')][_0x8e19('0xc2')][_0x8e19('0x9c')](_0x3e1c03[_0x8e19('0xc3')]);return _0x1546a6;});});}})[_0x8e19('0x23')](respondWithResult(_0x3f8879,null))[_0x8e19('0x5d')](handleError(_0x3f8879,null));};
\ No newline at end of file
+var _0xfbf0=['Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','OpenchannelAccount','includeAll','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','nolimit','Disposition','findAll','removeDispositions','ids','CannedAnswer','order','rows','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','OpenchannelApplication','Applications','applications','list','priority','account','Contacts','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','dataValues','Messages','push','rimraf','zip-dir','moment','bluebird','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','status','name','send','index'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0xfbf0,0x141));var _0x0fbf=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xfbf0[_0x1573ea];return _0x51c0e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fbf('0x0'));var zipdir=require(_0x0fbf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0fbf('0x2'));var BPromise=require(_0x0fbf('0x3'));var Mustache=require('mustache');var util=require(_0x0fbf('0x4'));var path=require('path');var sox=require(_0x0fbf('0x5'));var csv=require('to-csv');var ejs=require(_0x0fbf('0x6'));var fs=require('fs');var fs_extra=require(_0x0fbf('0x7'));var _=require('lodash');var squel=require(_0x0fbf('0x8'));var crypto=require(_0x0fbf('0x9'));var jsforce=require(_0x0fbf('0xa'));var deskjs=require(_0x0fbf('0xb'));var toCsv=require(_0x0fbf('0xc'));var querystring=require(_0x0fbf('0xd'));var Papa=require(_0x0fbf('0xe'));var Redis=require(_0x0fbf('0xf'));var authService=require(_0x0fbf('0x10'));var qs=require(_0x0fbf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fbf('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0fbf('0x13'));var config=require(_0x0fbf('0x14'));var licenseUtil=require(_0x0fbf('0x15'));var db=require(_0x0fbf('0x16'))['db'];config['redis']=_[_0x0fbf('0x17')](config[_0x0fbf('0x18')],{'host':_0x0fbf('0x19'),'port':0x18eb});var socket=require(_0x0fbf('0x1a'))(new Redis(config[_0x0fbf('0x18')]));require(_0x0fbf('0x1b'))[_0x0fbf('0x1c')](socket);var jayson=require(_0x0fbf('0x1d'));var client=jayson[_0x0fbf('0x1e')][_0x0fbf('0x1f')]({'port':0x232c});var client9002=jayson[_0x0fbf('0x1e')][_0x0fbf('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x174188,_0x1f18c9,_0x33e2de,_0x3f9913){return new BPromise(function(_0x1289ff,_0x259ee6){var _0x490e7a=_0x3f9913||client;return _0x490e7a['request'](_0x174188,_0x33e2de)['then'](function(_0x35478d){logger[_0x0fbf('0x20')](_0x0fbf('0x21'),_0x1f18c9,_0x0fbf('0x22'));logger[_0x0fbf('0x23')](_0x0fbf('0x24'),_0x1f18c9,'request\x20sent',JSON[_0x0fbf('0x25')](_0x35478d));if(_0x35478d['error']){if(_0x35478d[_0x0fbf('0x26')]['code']===0x1f4){logger[_0x0fbf('0x26')](_0x0fbf('0x21'),_0x1f18c9,_0x35478d['error'][_0x0fbf('0x27')]);return _0x259ee6(_0x35478d[_0x0fbf('0x26')][_0x0fbf('0x27')]);}logger[_0x0fbf('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x1f18c9,_0x35478d['error'][_0x0fbf('0x27')]);return _0x1289ff(_0x35478d['error'][_0x0fbf('0x27')]);}else{logger['info'](_0x0fbf('0x21'),_0x1f18c9,_0x0fbf('0x22'));_0x1289ff(_0x35478d[_0x0fbf('0x28')][_0x0fbf('0x27')]);}})['catch'](function(_0x3f4321){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x1f18c9,_0x3f4321);_0x259ee6(_0x3f4321);});});}function respondWithStatusCode(_0x516d5c,_0x2c5b0f){_0x2c5b0f=_0x2c5b0f||0xcc;return function(_0x3bacd1){if(_0x3bacd1){return _0x516d5c[_0x0fbf('0x29')](_0x2c5b0f);}return _0x516d5c['status'](_0x2c5b0f)['end']();};}function respondWithResult(_0x29f700,_0x4ada58){_0x4ada58=_0x4ada58||0xc8;return function(_0xa9c1ca){if(_0xa9c1ca){return _0x29f700['status'](_0x4ada58)['json'](_0xa9c1ca);}};}function respondWithFilteredResult(_0x3ad5e9,_0x4bbe08){return function(_0x4b068b){if(_0x4b068b){var _0x2e05d8=typeof _0x4bbe08['offset']===_0x0fbf('0x2a')&&typeof _0x4bbe08['limit']===_0x0fbf('0x2a');var _0x16c394=_0x4b068b[_0x0fbf('0x2b')];var _0x56113a=_0x2e05d8?0x0:_0x4bbe08[_0x0fbf('0x2c')];var _0x11204b=_0x2e05d8?_0x4b068b['count']:_0x4bbe08[_0x0fbf('0x2c')]+_0x4bbe08[_0x0fbf('0x2d')];var _0x49721c;if(_0x11204b>=_0x16c394){_0x11204b=_0x16c394;_0x49721c=0xc8;}else{_0x49721c=0xce;}_0x3ad5e9['status'](_0x49721c);return _0x3ad5e9[_0x0fbf('0x2e')](_0x0fbf('0x2f'),_0x56113a+'-'+_0x11204b+'/'+_0x16c394)['json'](_0x4b068b);}return null;};}function patchUpdates(_0x5d3b40){return function(_0x45d3f4){try{jsonpatch[_0x0fbf('0x30')](_0x45d3f4,_0x5d3b40,!![]);}catch(_0x424661){return BPromise[_0x0fbf('0x31')](_0x424661);}return _0x45d3f4[_0x0fbf('0x32')]();};}function saveUpdates(_0x59b218,_0x4dd328){return function(_0x3420db){if(_0x3420db){return _0x3420db[_0x0fbf('0x33')](_0x59b218)[_0x0fbf('0x34')](function(_0x25e731){return _0x25e731;});}return null;};}function removeEntity(_0x17c904,_0x1601b6){return function(_0x5f0f99){if(_0x5f0f99){return _0x5f0f99[_0x0fbf('0x35')]()['then'](function(){var _0x55622e=_0x5f0f99[_0x0fbf('0x36')]({'plain':!![]});var _0x2ad038=_0x0fbf('0x37');return db[_0x0fbf('0x38')][_0x0fbf('0x35')]({'where':{'type':_0x2ad038,'resourceId':_0x55622e['id']}})[_0x0fbf('0x34')](function(){return _0x5f0f99;});})[_0x0fbf('0x34')](function(){_0x17c904[_0x0fbf('0x39')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb8e6,_0x6183ff){return function(_0x3541b2){if(!_0x3541b2){_0x2bb8e6[_0x0fbf('0x29')](0x194);}return _0x3541b2;};}function handleError(_0x2da97e,_0x198d43){_0x198d43=_0x198d43||0x1f4;return function(_0x383ae5){logger[_0x0fbf('0x26')](_0x383ae5['stack']);if(_0x383ae5[_0x0fbf('0x3a')]){delete _0x383ae5[_0x0fbf('0x3a')];}_0x2da97e['status'](_0x198d43)[_0x0fbf('0x3b')](_0x383ae5);};}exports[_0x0fbf('0x3c')]=function(_0x5e84dd,_0x2621c2){var _0x2e764e={'include':[{'model':db[_0x0fbf('0x3d')],'as':_0x0fbf('0x3e')}]},_0x395bcf={},_0x48fa2a={'count':0x0,'rows':[]};var _0x48c865=_[_0x0fbf('0x3f')](db['OpenchannelAccount'][_0x0fbf('0x40')],function(_0x15093e){return{'name':_0x15093e[_0x0fbf('0x41')],'type':_0x15093e[_0x0fbf('0x42')][_0x0fbf('0x43')]};});_0x395bcf['model']=_['map'](_0x48c865,_0x0fbf('0x3a'));_0x395bcf[_0x0fbf('0x44')]=_[_0x0fbf('0x45')](_0x5e84dd['query']);_0x395bcf[_0x0fbf('0x46')]=_[_0x0fbf('0x47')](_0x395bcf[_0x0fbf('0x48')],_0x395bcf['query']);_0x2e764e[_0x0fbf('0x49')]=_[_0x0fbf('0x47')](_0x395bcf['model'],qs[_0x0fbf('0x4a')](_0x5e84dd[_0x0fbf('0x44')][_0x0fbf('0x4a')]));_0x2e764e['attributes']=_0x2e764e[_0x0fbf('0x49')][_0x0fbf('0x4b')]?_0x2e764e[_0x0fbf('0x49')]:_0x395bcf[_0x0fbf('0x48')];if(!_0x5e84dd[_0x0fbf('0x44')][_0x0fbf('0x4c')]('nolimit')){_0x2e764e['limit']=qs[_0x0fbf('0x2d')](_0x5e84dd[_0x0fbf('0x44')][_0x0fbf('0x2d')]);_0x2e764e[_0x0fbf('0x2c')]=qs['offset'](_0x5e84dd[_0x0fbf('0x44')][_0x0fbf('0x2c')]);}_0x2e764e['order']=qs[_0x0fbf('0x4d')](_0x5e84dd[_0x0fbf('0x44')][_0x0fbf('0x4d')]);_0x2e764e[_0x0fbf('0x4e')]=qs[_0x0fbf('0x46')](_[_0x0fbf('0x4f')](_0x5e84dd[_0x0fbf('0x44')],_0x395bcf[_0x0fbf('0x46')]),_0x48c865);if(_0x5e84dd[_0x0fbf('0x44')][_0x0fbf('0x50')]){_0x2e764e[_0x0fbf('0x4e')]=_[_0x0fbf('0x51')](_0x2e764e['where'],{'$or':_[_0x0fbf('0x3f')](_0x48c865,function(_0xabdb5b){if(_0xabdb5b['type']!=='VIRTUAL'){var _0xe935dd={};_0xe935dd[_0xabdb5b[_0x0fbf('0x3a')]]={'$like':'%'+_0x5e84dd['query'][_0x0fbf('0x50')]+'%'};return _0xe935dd;}})});}_0x2e764e=_[_0x0fbf('0x51')]({},_0x2e764e,_0x5e84dd[_0x0fbf('0x52')]);var _0x4f804f={'where':_0x2e764e['where']};return db[_0x0fbf('0x53')][_0x0fbf('0x2b')](_0x4f804f)[_0x0fbf('0x34')](function(_0x5fe3d6){_0x48fa2a[_0x0fbf('0x2b')]=_0x5fe3d6;if(_0x5e84dd['query'][_0x0fbf('0x54')]){_0x2e764e['include']=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x2e764e);})[_0x0fbf('0x34')](function(_0x53a7ad){_0x48fa2a['rows']=_0x53a7ad;return _0x48fa2a;})['then'](respondWithFilteredResult(_0x2621c2,_0x2e764e))['catch'](handleError(_0x2621c2,null));};exports['show']=function(_0x149a4c,_0x45e203){var _0x5e83aa={'raw':![],'where':{'id':_0x149a4c[_0x0fbf('0x55')]['id']},'include':[{'model':db[_0x0fbf('0x3d')],'as':_0x0fbf('0x3e')}]},_0xd8ec74={};_0xd8ec74['model']=_[_0x0fbf('0x45')](db['OpenchannelAccount']['rawAttributes']);_0xd8ec74[_0x0fbf('0x44')]=_[_0x0fbf('0x45')](_0x149a4c[_0x0fbf('0x44')]);_0xd8ec74[_0x0fbf('0x46')]=_[_0x0fbf('0x47')](_0xd8ec74[_0x0fbf('0x48')],_0xd8ec74['query']);_0x5e83aa[_0x0fbf('0x49')]=_[_0x0fbf('0x47')](_0xd8ec74[_0x0fbf('0x48')],qs[_0x0fbf('0x4a')](_0x149a4c[_0x0fbf('0x44')][_0x0fbf('0x4a')]));_0x5e83aa[_0x0fbf('0x49')]=_0x5e83aa['attributes'][_0x0fbf('0x4b')]?_0x5e83aa[_0x0fbf('0x49')]:_0xd8ec74['model'];if(_0x149a4c[_0x0fbf('0x44')]['includeAll']){_0x5e83aa[_0x0fbf('0x56')]=[{'all':!![]}];}_0x5e83aa=_[_0x0fbf('0x51')]({},_0x5e83aa,_0x149a4c['options']);return db[_0x0fbf('0x53')][_0x0fbf('0x57')](_0x5e83aa)[_0x0fbf('0x34')](handleEntityNotFound(_0x45e203,null))[_0x0fbf('0x34')](respondWithResult(_0x45e203,null))[_0x0fbf('0x58')](handleError(_0x45e203,null));};exports[_0x0fbf('0x59')]=function(_0x3e783d,_0x2c3339){return db[_0x0fbf('0x53')][_0x0fbf('0x59')](_0x3e783d[_0x0fbf('0x5a')],{})[_0x0fbf('0x34')](function(_0x5e46c5){var _0x127253=_0x3e783d[_0x0fbf('0x5b')][_0x0fbf('0x36')]({'plain':!![]});if(!_0x127253)throw new Error(_0x0fbf('0x5c'));if(_0x127253[_0x0fbf('0x5d')]==='user'){var _0x152dc1=_0x5e46c5[_0x0fbf('0x36')]({'plain':!![]});var _0x47280f='OpenchannelAccounts';return db[_0x0fbf('0x5e')][_0x0fbf('0x57')]({'where':{'name':_0x47280f,'userProfileId':_0x127253[_0x0fbf('0x5f')]},'raw':!![]})['then'](function(_0x557425){if(_0x557425&&_0x557425[_0x0fbf('0x60')]===0x0){return db[_0x0fbf('0x38')][_0x0fbf('0x59')]({'name':_0x152dc1[_0x0fbf('0x3a')],'resourceId':_0x152dc1['id'],'type':_0x557425[_0x0fbf('0x3a')],'sectionId':_0x557425['id']},{})[_0x0fbf('0x34')](function(){return _0x5e46c5;});}else{return _0x5e46c5;}})[_0x0fbf('0x58')](function(_0x507c51){logger[_0x0fbf('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x507c51);throw _0x507c51;});}return _0x5e46c5;})[_0x0fbf('0x34')](respondWithResult(_0x2c3339,0xc9))[_0x0fbf('0x58')](handleError(_0x2c3339,null));};exports[_0x0fbf('0x33')]=function(_0x5a54d2,_0x1a4c06){if(_0x5a54d2[_0x0fbf('0x5a')]['id']){delete _0x5a54d2[_0x0fbf('0x5a')]['id'];}return db[_0x0fbf('0x53')][_0x0fbf('0x57')]({'where':{'id':_0x5a54d2['params']['id']},'include':[{'model':db[_0x0fbf('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x0fbf('0x34')](handleEntityNotFound(_0x1a4c06,null))[_0x0fbf('0x34')](saveUpdates(_0x5a54d2['body'],null))[_0x0fbf('0x34')](respondWithResult(_0x1a4c06,null))['catch'](handleError(_0x1a4c06,null));};exports[_0x0fbf('0x35')]=function(_0x40c2c0,_0x540599){return db[_0x0fbf('0x53')][_0x0fbf('0x57')]({'where':{'id':_0x40c2c0['params']['id']}})[_0x0fbf('0x34')](handleEntityNotFound(_0x540599,null))['then'](removeEntity(_0x540599,null))[_0x0fbf('0x58')](handleError(_0x540599,null));};exports[_0x0fbf('0x61')]=function(_0x5b0028,_0x2a2f7c){return db[_0x0fbf('0x53')][_0x0fbf('0x61')]()[_0x0fbf('0x34')](respondWithResult(_0x2a2f7c,null))[_0x0fbf('0x58')](handleError(_0x2a2f7c,null));};exports[_0x0fbf('0x62')]=function(_0x57f3cf,_0x16c399,_0x4741fd){if(_0x57f3cf[_0x0fbf('0x5a')]['id']){delete _0x57f3cf[_0x0fbf('0x5a')]['id'];}return db[_0x0fbf('0x53')][_0x0fbf('0x57')]({'where':{'id':_0x57f3cf['params']['id']}})[_0x0fbf('0x34')](handleEntityNotFound(_0x16c399,null))[_0x0fbf('0x34')](function(_0x3f9761){if(_0x3f9761){_0x57f3cf[_0x0fbf('0x5a')][_0x0fbf('0x63')]=_0x3f9761['id'];return db['Disposition'][_0x0fbf('0x59')](_0x57f3cf[_0x0fbf('0x5a')]);}})[_0x0fbf('0x34')](respondWithResult(_0x16c399,null))[_0x0fbf('0x58')](handleError(_0x16c399,null));};exports[_0x0fbf('0x64')]=function(_0x3d4b28,_0x21f330,_0x54b9ce){var _0x567087={'raw':![],'where':{}};var _0x4ddc90={};var _0x1d03ab={'count':0x0,'rows':[]};return db[_0x0fbf('0x53')][_0x0fbf('0x65')]({'where':{'id':_0x3d4b28[_0x0fbf('0x55')]['id']}})[_0x0fbf('0x34')](handleEntityNotFound(_0x21f330,null))[_0x0fbf('0x34')](function(_0x5b0b75){if(_0x5b0b75){_0x4ddc90[_0x0fbf('0x48')]=_[_0x0fbf('0x45')](db['Disposition'][_0x0fbf('0x40')]);_0x4ddc90[_0x0fbf('0x44')]=_[_0x0fbf('0x45')](_0x3d4b28['query']);_0x4ddc90[_0x0fbf('0x46')]=_[_0x0fbf('0x47')](_0x4ddc90[_0x0fbf('0x48')],_0x4ddc90['query']);_0x567087[_0x0fbf('0x49')]=_['intersection'](_0x4ddc90['model'],qs['fields'](_0x3d4b28[_0x0fbf('0x44')]['fields']));_0x567087[_0x0fbf('0x49')]=_0x567087[_0x0fbf('0x49')]['length']?_0x567087[_0x0fbf('0x49')]:_0x4ddc90[_0x0fbf('0x48')];if(!_0x3d4b28[_0x0fbf('0x44')][_0x0fbf('0x4c')](_0x0fbf('0x66'))){_0x567087['limit']=qs[_0x0fbf('0x2d')](_0x3d4b28[_0x0fbf('0x44')]['limit']);_0x567087[_0x0fbf('0x2c')]=qs['offset'](_0x3d4b28['query'][_0x0fbf('0x2c')]);}_0x567087['order']=qs[_0x0fbf('0x4d')](_0x3d4b28['query']['sort']);_0x567087[_0x0fbf('0x4e')]=qs['filters'](_[_0x0fbf('0x4f')](_0x3d4b28['query'],_0x4ddc90[_0x0fbf('0x46')]));_0x567087['where']['OpenchannelAccountId']=_0x5b0b75['id'];if(_0x3d4b28[_0x0fbf('0x44')][_0x0fbf('0x50')]){_0x567087[_0x0fbf('0x4e')]=_[_0x0fbf('0x51')](_0x567087[_0x0fbf('0x4e')],{'$or':_[_0x0fbf('0x3f')](_0x567087[_0x0fbf('0x49')],function(_0x542644){var _0xd437f1={};_0xd437f1[_0x542644]={'$like':'%'+_0x3d4b28[_0x0fbf('0x44')]['filter']+'%'};return _0xd437f1;})});}_0x567087=_[_0x0fbf('0x51')]({},_0x567087,_0x3d4b28[_0x0fbf('0x52')]);return db[_0x0fbf('0x67')][_0x0fbf('0x2b')]({'where':_0x567087[_0x0fbf('0x4e')]})[_0x0fbf('0x34')](function(_0x5d83fa){_0x1d03ab[_0x0fbf('0x2b')]=_0x5d83fa;if(_0x3d4b28[_0x0fbf('0x44')][_0x0fbf('0x54')]){_0x567087[_0x0fbf('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x0fbf('0x68')](_0x567087);})['then'](function(_0x4741ab){_0x1d03ab['rows']=_0x4741ab;return _0x1d03ab;});}})['then'](respondWithFilteredResult(_0x21f330,_0x567087))['catch'](handleError(_0x21f330,null));};exports[_0x0fbf('0x69')]=function(_0x3fbedd,_0x46b307,_0x3fa649){return db[_0x0fbf('0x53')]['find']({'where':{'id':_0x3fbedd[_0x0fbf('0x55')]['id']}})['then'](handleEntityNotFound(_0x46b307,null))[_0x0fbf('0x34')](function(_0x10b902){if(_0x10b902){return _0x10b902[_0x0fbf('0x69')](_0x3fbedd[_0x0fbf('0x44')][_0x0fbf('0x6a')]);}})['then'](respondWithStatusCode(_0x46b307,null))['catch'](handleError(_0x46b307,null));};exports['addAnswer']=function(_0x75764e,_0x1580e9,_0x397609){if(_0x75764e[_0x0fbf('0x5a')]['id']){delete _0x75764e['body']['id'];}return db['OpenchannelAccount'][_0x0fbf('0x57')]({'where':{'id':_0x75764e[_0x0fbf('0x55')]['id']}})['then'](handleEntityNotFound(_0x1580e9,null))['then'](function(_0x14af74){if(_0x14af74){_0x75764e[_0x0fbf('0x5a')][_0x0fbf('0x63')]=_0x14af74['id'];return db['CannedAnswer']['create'](_0x75764e[_0x0fbf('0x5a')]);}})[_0x0fbf('0x34')](respondWithResult(_0x1580e9,null))['catch'](handleError(_0x1580e9,null));};exports['getAnswers']=function(_0x35a857,_0x51b528,_0x4ebaef){var _0x27977f={'raw':![],'where':{}};var _0x39756e={};var _0x2fee97={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0fbf('0x65')]({'where':{'id':_0x35a857[_0x0fbf('0x55')]['id']}})[_0x0fbf('0x34')](handleEntityNotFound(_0x51b528,null))[_0x0fbf('0x34')](function(_0x5e5767){if(_0x5e5767){_0x39756e[_0x0fbf('0x48')]=_['keys'](db[_0x0fbf('0x6b')][_0x0fbf('0x40')]);_0x39756e[_0x0fbf('0x44')]=_[_0x0fbf('0x45')](_0x35a857[_0x0fbf('0x44')]);_0x39756e[_0x0fbf('0x46')]=_['intersection'](_0x39756e[_0x0fbf('0x48')],_0x39756e[_0x0fbf('0x44')]);_0x27977f[_0x0fbf('0x49')]=_[_0x0fbf('0x47')](_0x39756e[_0x0fbf('0x48')],qs[_0x0fbf('0x4a')](_0x35a857[_0x0fbf('0x44')][_0x0fbf('0x4a')]));_0x27977f[_0x0fbf('0x49')]=_0x27977f[_0x0fbf('0x49')]['length']?_0x27977f[_0x0fbf('0x49')]:_0x39756e['model'];if(!_0x35a857[_0x0fbf('0x44')][_0x0fbf('0x4c')]('nolimit')){_0x27977f[_0x0fbf('0x2d')]=qs['limit'](_0x35a857[_0x0fbf('0x44')][_0x0fbf('0x2d')]);_0x27977f[_0x0fbf('0x2c')]=qs[_0x0fbf('0x2c')](_0x35a857['query'][_0x0fbf('0x2c')]);}_0x27977f[_0x0fbf('0x6c')]=qs['sort'](_0x35a857[_0x0fbf('0x44')]['sort']);_0x27977f[_0x0fbf('0x4e')]=qs['filters'](_[_0x0fbf('0x4f')](_0x35a857[_0x0fbf('0x44')],_0x39756e[_0x0fbf('0x46')]));_0x27977f[_0x0fbf('0x4e')][_0x0fbf('0x63')]=_0x5e5767['id'];if(_0x35a857[_0x0fbf('0x44')][_0x0fbf('0x50')]){_0x27977f[_0x0fbf('0x4e')]=_['merge'](_0x27977f[_0x0fbf('0x4e')],{'$or':_[_0x0fbf('0x3f')](_0x27977f[_0x0fbf('0x49')],function(_0x32e4d8){var _0x4acdc1={};_0x4acdc1[_0x32e4d8]={'$like':'%'+_0x35a857[_0x0fbf('0x44')][_0x0fbf('0x50')]+'%'};return _0x4acdc1;})});}_0x27977f=_[_0x0fbf('0x51')]({},_0x27977f,_0x35a857[_0x0fbf('0x52')]);return db[_0x0fbf('0x6b')][_0x0fbf('0x2b')]({'where':_0x27977f['where']})[_0x0fbf('0x34')](function(_0x163a66){_0x2fee97[_0x0fbf('0x2b')]=_0x163a66;if(_0x35a857[_0x0fbf('0x44')][_0x0fbf('0x54')]){_0x27977f['include']=[{'all':!![]}];}return db[_0x0fbf('0x6b')][_0x0fbf('0x68')](_0x27977f);})['then'](function(_0x871d7d){_0x2fee97[_0x0fbf('0x6d')]=_0x871d7d;return _0x2fee97;});}})[_0x0fbf('0x34')](respondWithFilteredResult(_0x51b528,_0x27977f))[_0x0fbf('0x58')](handleError(_0x51b528,null));};exports['removeAnswers']=function(_0x216376,_0x5a7388,_0x580d69){return db[_0x0fbf('0x53')]['find']({'where':{'id':_0x216376[_0x0fbf('0x55')]['id']}})[_0x0fbf('0x34')](handleEntityNotFound(_0x5a7388,null))[_0x0fbf('0x34')](function(_0x58a4d1){if(_0x58a4d1){return _0x58a4d1['removeAnswers'](_0x216376['query'][_0x0fbf('0x6a')]);}})['then'](respondWithStatusCode(_0x5a7388,null))[_0x0fbf('0x58')](handleError(_0x5a7388,null));};exports['notify']=function(_0x4d61e8,_0x2939d3,_0x3d126e){var _0x22c3fe={'body':_0x4d61e8['body'],'channel':_0x0fbf('0x6e')};var _0x559721=[];var _0x5a52bd=[];var _0x5c96c8={};var _0x5db6b6=![];return db[_0x0fbf('0x6f')]['describe']()['then'](function(_0x298b34){if(!_0x298b34){throw new db[(_0x0fbf('0x70'))][(_0x0fbf('0x71'))](_0x0fbf('0x72'));}_0x559721=_[_0x0fbf('0x73')](_[_0x0fbf('0x45')](_0x298b34),[_0x0fbf('0x74'),_0x0fbf('0x75')]);_0x5a52bd=_['difference'](_[_0x0fbf('0x45')](_0x298b34),['createdAt','updatedAt','CompanyId','ListId']);if(_0x4d61e8['body']['id']){delete _0x4d61e8[_0x0fbf('0x5a')]['id'];}if(_[_0x0fbf('0x76')](_0x4d61e8[_0x0fbf('0x5a')][_0x0fbf('0x77')])){throw new db[(_0x0fbf('0x70'))][(_0x0fbf('0x71'))](_0x0fbf('0x78'));}if(_[_0x0fbf('0x76')](_0x4d61e8[_0x0fbf('0x5a')][_0x0fbf('0x5a')])||_0x4d61e8[_0x0fbf('0x5a')][_0x0fbf('0x5a')]===''){throw new db[(_0x0fbf('0x70'))][(_0x0fbf('0x71'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0fbf('0x76')](_0x4d61e8['body']['mapKey'])){throw new db[(_0x0fbf('0x70'))]['ValidationError'](_0x0fbf('0x79')+_0x5a52bd);}if(!_[_0x0fbf('0x7a')](_0x5a52bd,_0x4d61e8['body'][_0x0fbf('0x7b')])){throw new db[(_0x0fbf('0x70'))][(_0x0fbf('0x71'))](_0x0fbf('0x7c')+_0x5a52bd);}_0x5c96c8[_0x4d61e8[_0x0fbf('0x5a')]['mapKey']]=_0x4d61e8['body'][_0x0fbf('0x77')];})[_0x0fbf('0x34')](function(){return db[_0x0fbf('0x53')]['find']({'where':{'id':_0x4d61e8[_0x0fbf('0x55')]['id']},'include':[{'model':db[_0x0fbf('0x7d')],'as':_0x0fbf('0x7e'),'include':[{'model':db[_0x0fbf('0x6f')],'as':'Contacts','where':_0x5c96c8,'limit':0x1,'order':[[_0x0fbf('0x75'),_0x0fbf('0x7f')]]}]},{'model':db[_0x0fbf('0x80')],'as':_0x0fbf('0x81')}]});})[_0x0fbf('0x34')](handleEntityNotFound(_0x2939d3,null))[_0x0fbf('0x34')](function(_0x374929){if(_0x374929&&_0x374929[_0x0fbf('0x7e')]){_0x22c3fe['account']=_0x374929;_0x22c3fe[_0x0fbf('0x82')]=_0x374929['Applications'];_0x22c3fe[_0x0fbf('0x83')]=_0x374929['List'];_0x22c3fe['applications']=_['orderBy'](_0x22c3fe[_0x0fbf('0x82')],[_0x0fbf('0x84')],['asc']);if(_0x22c3fe[_0x0fbf('0x85')]['Applications']){delete _0x22c3fe[_0x0fbf('0x85')]['Applications'];}if(_0x22c3fe['account'][_0x0fbf('0x7e')]&&_0x22c3fe[_0x0fbf('0x85')]['List'][_0x0fbf('0x86')][_0x0fbf('0x4b')]){return _0x22c3fe['account'][_0x0fbf('0x7e')][_0x0fbf('0x86')][0x0];}var _0x46ab19=_[_0x0fbf('0x17')](_0x4d61e8[_0x0fbf('0x5a')],{'firstName':_0x4d61e8[_0x0fbf('0x5a')][_0x0fbf('0x77')],'ListId':_0x374929[_0x0fbf('0x87')]});_0x46ab19[_0x4d61e8['body'][_0x0fbf('0x7b')]]=_0x4d61e8[_0x0fbf('0x5a')][_0x0fbf('0x77')];return db[_0x0fbf('0x6f')][_0x0fbf('0x59')](_0x46ab19,{'fields':_0x559721,'raw':!![]});}})[_0x0fbf('0x34')](handleEntityNotFound(_0x2939d3,null))[_0x0fbf('0x34')](function(_0x51bf9f){_0x22c3fe[_0x0fbf('0x88')]=_0x51bf9f;if(_0x51bf9f){var _0x3b3628={'ContactId':_0x51bf9f['id'],'OpenchannelAccountId':_0x4d61e8['params']['id'],'from':(_0x51bf9f[_0x0fbf('0x89')]||'')+'\x20'+(_0x51bf9f[_0x0fbf('0x8a')]||'')};var _0x1f471a={'OpenchannelAccountId':_0x4d61e8[_0x0fbf('0x55')]['id'],'closed':![]};if(_0x4d61e8[_0x0fbf('0x5a')][_0x0fbf('0x8b')]){_0x1f471a[_0x0fbf('0x8b')]=_0x4d61e8[_0x0fbf('0x5a')][_0x0fbf('0x8b')];return db[_0x0fbf('0x8c')]['find']({'where':_0x1f471a})[_0x0fbf('0x34')](function(_0x4f5057){if(_0x4f5057){return[_0x4f5057,![]];}_0x3b3628[_0x0fbf('0x8b')]=_0x4d61e8['body'][_0x0fbf('0x8b')];_0x3b3628[_0x0fbf('0x8d')]=_0x4d61e8[_0x0fbf('0x5a')][_0x0fbf('0x8d')];return db[_0x0fbf('0x8c')][_0x0fbf('0x59')](_0x3b3628)[_0x0fbf('0x34')](function(_0x1e971b){return[_0x1e971b,!![]];});});}else{_0x1f471a[_0x0fbf('0x8b')]=null;}_0x1f471a[_0x0fbf('0x8e')]=_0x51bf9f['id'];return db['OpenchannelInteraction']['find']({'where':_0x1f471a})[_0x0fbf('0x34')](function(_0x28e380){if(_0x28e380){return[_0x28e380,![]];}return db[_0x0fbf('0x8c')]['create'](_0x3b3628)[_0x0fbf('0x34')](function(_0x3beb9d){return[_0x3beb9d,!![]];});});}})[_0x0fbf('0x8f')](function(_0x2f7cc4,_0x1a8167){if(_0x2f7cc4){_0x5db6b6=_0x1a8167;if(!_0x1a8167){var _0x2cdf0f={'from':(_0x22c3fe[_0x0fbf('0x88')][_0x0fbf('0x89')]||'')+'\x20'+(_0x22c3fe[_0x0fbf('0x88')][_0x0fbf('0x8a')]||'')};if(_0x4d61e8[_0x0fbf('0x5a')][_0x0fbf('0x8b')]&&_0x4d61e8[_0x0fbf('0x5a')]['messageId']&&_0x4d61e8['body'][_0x0fbf('0x8b')]!=_0x4d61e8[_0x0fbf('0x5a')]['messageId']){_0x2cdf0f[_0x0fbf('0x8b')]=_0x4d61e8[_0x0fbf('0x5a')][_0x0fbf('0x90')];}return _0x2f7cc4[_0x0fbf('0x33')](_0x2cdf0f);}else{return _0x2f7cc4;}}})['then'](function(_0x462e88){_0x22c3fe['interaction']=_0x462e88[_0x0fbf('0x36')]({'plain':!![]});_0x22c3fe[_0x0fbf('0x91')]['created']=_0x5db6b6;if(_0x22c3fe[_0x0fbf('0x91')][_0x0fbf('0x92')]){if(_0x22c3fe['account'][_0x0fbf('0x93')]){_0x22c3fe['applications']['push']({'id':0x0,'priority':_0x22c3fe[_0x0fbf('0x82')]['length']+0x1,'app':'close','appdata':_0x0fbf('0x94'),'interval':_0x0fbf('0x95')});}}return db[_0x0fbf('0x96')]['create']({'body':_0x4d61e8[_0x0fbf('0x5a')][_0x0fbf('0x5a')],'OpenchannelAccountId':_0x4d61e8[_0x0fbf('0x55')]['id'],'OpenchannelInteractionId':_0x462e88['id'],'direction':'in','ContactId':_0x22c3fe[_0x0fbf('0x88')]['id'],'AttachmentId':_0x4d61e8[_0x0fbf('0x5a')][_0x0fbf('0x97')]});})['then'](function(_0x3c2896){_0x22c3fe[_0x0fbf('0x27')]=_0x3c2896;if(_0x22c3fe[_0x0fbf('0x91')]['UserId']){return db[_0x0fbf('0x98')][_0x0fbf('0x57')]({'attributes':['id',_0x0fbf('0x3a')],'where':{'id':_0x22c3fe['interaction'][_0x0fbf('0x99')]}})[_0x0fbf('0x34')](function(_0x5d5978){if(_0x5d5978){_0x22c3fe['applications'][_0x0fbf('0x9a')]({'id':0x0,'priority':0x0,'app':_0x0fbf('0x9b'),'appdata':_0x5d5978[_0x0fbf('0x3a')]+','+(_0x22c3fe[_0x0fbf('0x85')][_0x0fbf('0x9c')]||0xa),'interval':_0x0fbf('0x95')});_0x22c3fe[_0x0fbf('0x9d')]=![];}return respondWithRpcPromise(_0x0fbf('0x9e'),'startRouting',_0x22c3fe);});}return respondWithRpcPromise(_0x0fbf('0x9e'),_0x0fbf('0x9f'),_0x22c3fe);})[_0x0fbf('0x34')](function(_0xb0f6cd){respondWithRpcPromise('EventManager',_0x0fbf('0xa0'),{'event':_0x0fbf('0xa1'),'message':_0xb0f6cd},client9002);return _0xb0f6cd;})[_0x0fbf('0x34')](respondWithResult(_0x2939d3,null))['catch'](handleError(_0x2939d3,null));};exports[_0x0fbf('0xa2')]=function(_0x525693,_0x214be8){var _0x504773=_0x525693[_0x0fbf('0x55')]['id'];var _0x3df245=_0x525693[_0x0fbf('0x5a')];var _0x2d2ccd=0xc8;var _0xdfb0dd=null;return db[_0x0fbf('0xa3')]['transaction']({'isolationLevel':db['sequelize'][_0x0fbf('0xa4')][_0x0fbf('0xa5')][_0x0fbf('0xa6')]},function(_0x193da6){return db[_0x0fbf('0x53')]['findOne']({'where':{'id':_0x504773},'transaction':_0x193da6})[_0x0fbf('0x34')](function(_0x48592b){if(_0x48592b){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x504773},'transaction':_0x193da6})[_0x0fbf('0x34')](function(){var _0xe7e4db=_[_0x0fbf('0x3f')](_0x3df245,function(_0x37d669){_0x37d669[_0x0fbf('0x63')]=_0x504773;return _0x37d669;});return db['OpenchannelApplication'][_0x0fbf('0xa7')](_0xe7e4db,{'transaction':_0x193da6});});}else{_0x2d2ccd=0x194;_0xdfb0dd=[];}});})[_0x0fbf('0x34')](function(){if(_0x2d2ccd!==0x194){return db[_0x0fbf('0x80')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x504773},'order':_0x0fbf('0x84')})[_0x0fbf('0x34')](function(_0x1a02a0){_0xdfb0dd=_0x1a02a0;});}})[_0x0fbf('0x58')](function(_0x451bdc){_0x2d2ccd=0x1f4;logger[_0x0fbf('0x26')](_0x451bdc[_0x0fbf('0xa8')]);if(_0x451bdc[_0x0fbf('0x3a')]){delete _0x451bdc[_0x0fbf('0x3a')];}_0xdfb0dd=_0x451bdc;})[_0x0fbf('0xa9')](function(){if(_0xdfb0dd===null){_0x214be8[_0x0fbf('0x29')](_0x2d2ccd);}else{if(_0x2d2ccd===0x1f4){_0x214be8['status'](_0x2d2ccd)[_0x0fbf('0x3b')](_0xdfb0dd);}else{_0x214be8['status'](_0x2d2ccd)['json'](_0xdfb0dd);}}});};exports['getApplications']=function(_0x39567e,_0x3c7b21,_0x4ca921){var _0x2377a3={};var _0x1fa370={};var _0x58c816;var _0x517d30;return db[_0x0fbf('0x53')]['findOne']({'where':{'id':_0x39567e[_0x0fbf('0x55')]['id']}})['then'](handleEntityNotFound(_0x3c7b21,null))['then'](function(_0xe19aa1){if(_0xe19aa1){_0x58c816=_0xe19aa1;_0x1fa370[_0x0fbf('0x48')]=_[_0x0fbf('0x45')](db['OpenchannelApplication'][_0x0fbf('0x40')]);_0x1fa370[_0x0fbf('0x44')]=_['keys'](_0x39567e[_0x0fbf('0x44')]);_0x1fa370['filters']=_[_0x0fbf('0x47')](_0x1fa370[_0x0fbf('0x48')],_0x1fa370[_0x0fbf('0x44')]);_0x2377a3[_0x0fbf('0x49')]=_[_0x0fbf('0x47')](_0x1fa370[_0x0fbf('0x48')],qs[_0x0fbf('0x4a')](_0x39567e['query'][_0x0fbf('0x4a')]));_0x2377a3[_0x0fbf('0x49')]=_0x2377a3[_0x0fbf('0x49')]['length']?_0x2377a3[_0x0fbf('0x49')]:_0x1fa370[_0x0fbf('0x48')];_0x2377a3[_0x0fbf('0x6c')]=qs['sort'](_0x39567e[_0x0fbf('0x44')]['sort']);_0x2377a3[_0x0fbf('0x4e')]=qs[_0x0fbf('0x46')](_[_0x0fbf('0x4f')](_0x39567e[_0x0fbf('0x44')],_0x1fa370[_0x0fbf('0x46')]));if(_0x39567e[_0x0fbf('0x44')][_0x0fbf('0x50')]){_0x2377a3[_0x0fbf('0x4e')]=_[_0x0fbf('0x51')](_0x2377a3['where'],{'$or':_[_0x0fbf('0x3f')](_0x2377a3[_0x0fbf('0x49')],function(_0x5101fb){var _0x37c4a1={};_0x37c4a1[_0x5101fb]={'$like':'%'+_0x39567e[_0x0fbf('0x44')]['filter']+'%'};return _0x37c4a1;})});}_0x2377a3=_[_0x0fbf('0x51')]({},_0x2377a3,_0x39567e[_0x0fbf('0x52')]);return _0x58c816[_0x0fbf('0xaa')](_0x2377a3);}})[_0x0fbf('0x34')](function(_0xdca34){if(_0xdca34){_0x517d30=_0xdca34['length'];if(!_0x39567e[_0x0fbf('0x44')]['hasOwnProperty'](_0x0fbf('0x66'))){_0x2377a3[_0x0fbf('0x2d')]=qs[_0x0fbf('0x2d')](_0x39567e[_0x0fbf('0x44')][_0x0fbf('0x2d')]);_0x2377a3[_0x0fbf('0x2c')]=qs[_0x0fbf('0x2c')](_0x39567e['query']['offset']);}return _0x58c816[_0x0fbf('0xaa')](_0x2377a3);}})[_0x0fbf('0x34')](function(_0xf59ec3){if(_0xf59ec3){return _0xf59ec3?{'count':_0x517d30,'rows':_0xf59ec3}:null;}})['then'](respondWithResult(_0x3c7b21,null))[_0x0fbf('0x58')](handleError(_0x3c7b21,null));};exports[_0x0fbf('0xab')]=function(_0x1cba8d,_0xd38dd7,_0x3ab8f2){var _0x585d4c={'raw':![],'where':{}};var _0x3a0460={};var _0x149af0={'count':0x0,'rows':[]};return db[_0x0fbf('0x53')][_0x0fbf('0x65')]({'where':{'id':_0x1cba8d[_0x0fbf('0x55')]['id']}})[_0x0fbf('0x34')](handleEntityNotFound(_0xd38dd7,null))[_0x0fbf('0x34')](function(_0x5cc60f){if(_0x5cc60f){_0x3a0460[_0x0fbf('0x48')]=_[_0x0fbf('0x45')](db['OpenchannelInteraction'][_0x0fbf('0x40')]);_0x3a0460[_0x0fbf('0x44')]=_['keys'](_0x1cba8d[_0x0fbf('0x44')]);_0x3a0460[_0x0fbf('0x46')]=_[_0x0fbf('0x47')](_0x3a0460[_0x0fbf('0x48')],_0x3a0460['query']);_0x585d4c[_0x0fbf('0x49')]=_[_0x0fbf('0x47')](_0x3a0460[_0x0fbf('0x48')],qs[_0x0fbf('0x4a')](_0x1cba8d[_0x0fbf('0x44')][_0x0fbf('0x4a')]));_0x585d4c[_0x0fbf('0x49')]=_0x585d4c['attributes'][_0x0fbf('0x4b')]?_0x585d4c[_0x0fbf('0x49')]:_0x3a0460[_0x0fbf('0x48')];if(!_0x1cba8d[_0x0fbf('0x44')][_0x0fbf('0x4c')](_0x0fbf('0x66'))){_0x585d4c[_0x0fbf('0x2d')]=qs[_0x0fbf('0x2d')](_0x1cba8d[_0x0fbf('0x44')][_0x0fbf('0x2d')]);_0x585d4c[_0x0fbf('0x2c')]=qs[_0x0fbf('0x2c')](_0x1cba8d[_0x0fbf('0x44')][_0x0fbf('0x2c')]);}_0x585d4c[_0x0fbf('0x6c')]=qs[_0x0fbf('0x4d')](_0x1cba8d['query'][_0x0fbf('0x4d')]);_0x585d4c['where']=qs[_0x0fbf('0x46')](_[_0x0fbf('0x4f')](_0x1cba8d[_0x0fbf('0x44')],_0x3a0460[_0x0fbf('0x46')]));_0x585d4c['where'][_0x0fbf('0x63')]=_0x5cc60f['id'];if(_0x1cba8d['query']['filter']){_0x585d4c[_0x0fbf('0x4e')]=_[_0x0fbf('0x51')](_0x585d4c[_0x0fbf('0x4e')],{'$or':_['map'](_0x585d4c[_0x0fbf('0x49')],function(_0x6c65a9){var _0x5eab54={};_0x5eab54[_0x6c65a9]={'$like':'%'+_0x1cba8d['query'][_0x0fbf('0x50')]+'%'};return _0x5eab54;})});}_0x585d4c=_[_0x0fbf('0x51')]({},_0x585d4c,_0x1cba8d['options']);return db[_0x0fbf('0x8c')][_0x0fbf('0x2b')]({'where':_0x585d4c[_0x0fbf('0x4e')]})[_0x0fbf('0x34')](function(_0x18d604){_0x149af0['count']=_0x18d604;if(_0x1cba8d[_0x0fbf('0x44')][_0x0fbf('0x54')]){_0x585d4c[_0x0fbf('0x56')]=[{'model':db[_0x0fbf('0x6f')],'as':_0x0fbf('0xac'),'required':![]},{'model':db['User'],'as':_0x0fbf('0xad'),'attributes':[_0x0fbf('0x3a'),_0x0fbf('0xae'),_0x0fbf('0xaf')],'required':![]},{'model':db[_0x0fbf('0xb0')],'as':'Tags','attributes':['id','name',_0x0fbf('0xb1')],'where':_0x1cba8d[_0x0fbf('0x44')]['tag']?{'id':_0x1cba8d[_0x0fbf('0x44')][_0x0fbf('0xb2')]}:undefined,'required':_0x1cba8d['query'][_0x0fbf('0xb2')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x0fbf('0x68')](_0x585d4c);})['then'](function(_0x5ce76f){_0x149af0['rows']=_0x5ce76f;return _0x149af0;});}})[_0x0fbf('0x34')](respondWithFilteredResult(_0xd38dd7,_0x585d4c))['catch'](handleError(_0xd38dd7,null));};exports['addAgents']=function(_0x2553e7,_0x1e98f5,_0x3d9f00){return db['OpenchannelAccount']['find']({'where':{'id':_0x2553e7[_0x0fbf('0x55')]['id']}})[_0x0fbf('0x34')](handleEntityNotFound(_0x1e98f5,null))[_0x0fbf('0x34')](function(_0x42887c){if(_0x42887c){return _0x42887c[_0x0fbf('0xb3')](_0x2553e7[_0x0fbf('0x5a')][_0x0fbf('0x6a')],_[_0x0fbf('0xb4')](_0x2553e7[_0x0fbf('0x5a')],[_0x0fbf('0x6a'),'id'])||{})[_0x0fbf('0x8f')](function(_0x1a2cf0){for(var _0x5141c2=0x0;_0x5141c2<_0x2553e7[_0x0fbf('0x5a')]['ids'][_0x0fbf('0x4b')];_0x5141c2+=0x1){socket[_0x0fbf('0xb5')](_0x0fbf('0xb6'),{'UserId':Number(_0x2553e7['body'][_0x0fbf('0x6a')][_0x5141c2]),'OpenchannelAccountId':Number(_0x2553e7[_0x0fbf('0x55')]['id'])});}return _0x1a2cf0;});}})[_0x0fbf('0x34')](respondWithResult(_0x1e98f5,null))['catch'](handleError(_0x1e98f5,null));};exports[_0x0fbf('0xb7')]=function(_0x321461,_0x185f86,_0x56a31e){return db[_0x0fbf('0x53')][_0x0fbf('0x57')]({'where':{'id':_0x321461[_0x0fbf('0x55')]['id']}})[_0x0fbf('0x34')](handleEntityNotFound(_0x185f86,null))['then'](function(_0x3b8ef2){if(_0x3b8ef2){return _0x3b8ef2[_0x0fbf('0xb7')](_0x321461['query'][_0x0fbf('0x6a')])[_0x0fbf('0x34')](function(){if(_[_0x0fbf('0xb8')](_0x321461['query'][_0x0fbf('0x6a')])){for(var _0x21dad6=0x0;_0x21dad6<_0x321461[_0x0fbf('0x44')][_0x0fbf('0x6a')]['length'];_0x21dad6+=0x1){socket['emit'](_0x0fbf('0xb9'),{'UserId':Number(_0x321461[_0x0fbf('0x44')]['ids'][_0x21dad6]),'OpenchannelAccountId':Number(_0x321461[_0x0fbf('0x55')]['id'])});}}else{socket[_0x0fbf('0xb5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x321461['query'][_0x0fbf('0x6a')]),'OpenchannelAccountId':Number(_0x321461[_0x0fbf('0x55')]['id'])});}});}})[_0x0fbf('0x34')](respondWithStatusCode(_0x185f86,null))[_0x0fbf('0x58')](handleError(_0x185f86,null));};exports[_0x0fbf('0xba')]=function(_0x30bde6,_0x4bdd05,_0x3fb242){var _0x3f8c97={};var _0x396e45={};var _0x573e74;var _0x497035;return db[_0x0fbf('0x53')][_0x0fbf('0x65')]({'where':{'id':_0x30bde6['params']['id']}})['then'](handleEntityNotFound(_0x4bdd05,null))[_0x0fbf('0x34')](function(_0x1b464c){if(_0x1b464c){_0x573e74=_0x1b464c;_0x396e45[_0x0fbf('0x48')]=_[_0x0fbf('0x45')](db[_0x0fbf('0x98')]['rawAttributes']);_0x396e45[_0x0fbf('0x44')]=_[_0x0fbf('0x45')](_0x30bde6['query']);_0x396e45[_0x0fbf('0x46')]=_[_0x0fbf('0x47')](_0x396e45[_0x0fbf('0x48')],_0x396e45[_0x0fbf('0x44')]);_0x3f8c97[_0x0fbf('0x49')]=_['intersection'](_0x396e45[_0x0fbf('0x48')],qs[_0x0fbf('0x4a')](_0x30bde6[_0x0fbf('0x44')][_0x0fbf('0x4a')]));_0x3f8c97[_0x0fbf('0x49')]=_0x3f8c97[_0x0fbf('0x49')][_0x0fbf('0x4b')]?_0x3f8c97[_0x0fbf('0x49')]:_0x396e45['model'];_0x3f8c97[_0x0fbf('0x6c')]=qs[_0x0fbf('0x4d')](_0x30bde6[_0x0fbf('0x44')][_0x0fbf('0x4d')]);_0x3f8c97[_0x0fbf('0x4e')]=qs[_0x0fbf('0x46')](_['pick'](_0x30bde6[_0x0fbf('0x44')],_0x396e45['filters']));if(_0x30bde6[_0x0fbf('0x44')]['filter']){_0x3f8c97[_0x0fbf('0x4e')]=_['merge'](_0x3f8c97[_0x0fbf('0x4e')],{'$or':_[_0x0fbf('0x3f')](_0x3f8c97[_0x0fbf('0x49')],function(_0x357d90){var _0x460077={};_0x460077[_0x357d90]={'$like':'%'+_0x30bde6['query']['filter']+'%'};return _0x460077;})});}_0x3f8c97=_['merge']({},_0x3f8c97,_0x30bde6[_0x0fbf('0x52')]);return _0x573e74['getAgents'](_0x3f8c97);}})['then'](function(_0xdfdfed){if(_0xdfdfed){_0x497035=_0xdfdfed[_0x0fbf('0x4b')];if(!_0x30bde6[_0x0fbf('0x44')][_0x0fbf('0x4c')]('nolimit')){_0x3f8c97['limit']=qs[_0x0fbf('0x2d')](_0x30bde6[_0x0fbf('0x44')][_0x0fbf('0x2d')]);_0x3f8c97['offset']=qs[_0x0fbf('0x2c')](_0x30bde6[_0x0fbf('0x44')]['offset']);}return _0x573e74[_0x0fbf('0xba')](_0x3f8c97);}})[_0x0fbf('0x34')](function(_0x5ad890){if(_0x5ad890){return _0x5ad890?{'count':_0x497035,'rows':_0x5ad890}:null;}})[_0x0fbf('0x34')](respondWithResult(_0x4bdd05,null))['catch'](handleError(_0x4bdd05,null));};exports['send']=function(_0x5e73a8,_0x4c19c4,_0x549ec3){var _0xe295ec,_0x17dc13,_0x2bfe60;if(_[_0x0fbf('0x76')](_0x5e73a8[_0x0fbf('0x5a')][_0x0fbf('0x5a')])||_0x5e73a8[_0x0fbf('0x5a')][_0x0fbf('0x5a')]===''){throw new db['Sequelize'][(_0x0fbf('0x71'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x5e73a8[_0x0fbf('0x5a')]['to'])){}_0xe295ec=_0x5e73a8['body']['to'];return db[_0x0fbf('0x53')][_0x0fbf('0x65')]({'where':{'id':_0x5e73a8[_0x0fbf('0x55')]['id']}})[_0x0fbf('0x34')](handleEntityNotFound(_0x4c19c4,null))[_0x0fbf('0x34')](function(_0x32986b){if(_0x32986b){return db[_0x0fbf('0x53')]['find']({'where':{'id':_0x32986b['id']},'include':[{'model':db[_0x0fbf('0x7d')],'as':_0x0fbf('0x7e'),'include':[{'model':db[_0x0fbf('0x6f')],'as':_0x0fbf('0x86'),'where':{[_0x32986b[_0x0fbf('0x7b')]]:_0xe295ec},'limit':0x1,'order':[[_0x0fbf('0x75'),_0x0fbf('0x7f')]]}]}]})['then'](handleEntityNotFound(_0x4c19c4,null))[_0x0fbf('0x34')](function(_0x53a0f4){if(_0x53a0f4&&_0x53a0f4[_0x0fbf('0x7e')]){_0x17dc13=_0x53a0f4['get']({'plain':!![]});if(_0x17dc13['List']&&_0x17dc13[_0x0fbf('0x7e')][_0x0fbf('0x86')][_0x0fbf('0x4b')]){return _0x17dc13[_0x0fbf('0x7e')]['Contacts'][0x0];}return db['CmContact'][_0x0fbf('0x59')](_['defaults'](_0x5e73a8[_0x0fbf('0x5a')],{'firstName':_0xe295ec,[_0x53a0f4[_0x0fbf('0x7b')]]:_0xe295ec,'phone':_0xe295ec,'ListId':_0x17dc13[_0x0fbf('0x87')]}));}})[_0x0fbf('0x34')](handleEntityNotFound(_0x4c19c4,null))[_0x0fbf('0x34')](function(_0x538170){if(_0x538170){_0x2bfe60=_0x538170;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x2bfe60['id'],'closed':![],'OpenchannelAccountId':_0x17dc13['id']}})[_0x0fbf('0x34')](function(_0x4d95a3){if(_0x4d95a3){return[_0x4d95a3,![]];}return db[_0x0fbf('0x8c')][_0x0fbf('0x59')]({'UserId':_0x5e73a8[_0x0fbf('0x5b')]['id'],'ContactId':_0x2bfe60['id'],'OpenchannelAccountId':_0x17dc13['id'],'lastMsgDirection':_0x0fbf('0xbb'),'firstMsgDirection':_0x0fbf('0xbb'),'Messages':[_['merge'](_0x5e73a8[_0x0fbf('0x5a')],{'read':![],'body':_0x5e73a8[_0x0fbf('0x5a')]['body'],'OpenchannelAccountId':_0x17dc13['id'],'UserId':_0x5e73a8['user']['id'],'ContactId':_0x2bfe60['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x0fbf('0x34')](function(_0x2f1902){return[_0x2f1902,!![]];});});}})[_0x0fbf('0x8f')](function(_0x5a418d,_0x5c486c){if(_0x5c486c){return _0x5a418d;}return db['OpenchannelMessage'][_0x0fbf('0x59')](_[_0x0fbf('0x51')](_0x5e73a8[_0x0fbf('0x5a')],{'read':![],'body':_0x5e73a8[_0x0fbf('0x5a')]['body'],'OpenchannelAccountId':_0x17dc13['id'],'OpenchannelInteractionId':_0x5a418d['id'],'UserId':_0x5e73a8['user']['id'],'ContactId':_0x2bfe60['id']}))[_0x0fbf('0x34')](function(_0x382068){_0x5a418d[_0x0fbf('0xbc')][_0x0fbf('0xbd')]=[];_0x5a418d['dataValues'][_0x0fbf('0xbd')][_0x0fbf('0xbe')](_0x382068[_0x0fbf('0xbc')]);return _0x5a418d;});});}})['then'](respondWithResult(_0x4c19c4,null))['catch'](handleError(_0x4c19c4,null));};
\ No newline at end of file
index 020f091..e8aa338 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x54ef=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update'];(function(_0x374af5,_0x3c7026){var _0x5daed6=function(_0x2587d9){while(--_0x2587d9){_0x374af5['push'](_0x374af5['shift']());}};_0x5daed6(++_0x3c7026);}(_0x54ef,0x112));var _0xf54e=function(_0x3ba239,_0x105eb8){_0x3ba239=_0x3ba239-0x0;var _0x207f3d=_0x54ef[_0x3ba239];return _0x207f3d;};'use strict';var EventEmitter=require(_0xf54e('0x0'));var OpenchannelAccount=require(_0xf54e('0x1'))['db'][_0xf54e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf54e('0x3'),'afterUpdate':_0xf54e('0x4'),'afterDestroy':_0xf54e('0x5')};function emitEvent(_0x42b9b2){return function(_0x8b6bb6,_0x431e36,_0x12d43f){OpenchannelAccountEvents['emit'](_0x42b9b2+':'+_0x8b6bb6['id'],_0x8b6bb6);OpenchannelAccountEvents['emit'](_0x42b9b2,_0x8b6bb6);_0x12d43f(null);};}for(var e in events){if(events[_0xf54e('0x6')](e)){var event=events[e];OpenchannelAccount[_0xf54e('0x7')](e,emitEvent(event));}}module[_0xf54e('0x8')]=OpenchannelAccountEvents;
\ No newline at end of file
+var _0xb821=['OpenchannelAccount','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x54df60,_0x120d1c){var _0x46b49d=function(_0x1b72f4){while(--_0x1b72f4){_0x54df60['push'](_0x54df60['shift']());}};_0x46b49d(++_0x120d1c);}(_0xb821,0xa7));var _0x1b82=function(_0x4f981f,_0x1cd340){_0x4f981f=_0x4f981f-0x0;var _0x104576=_0xb821[_0x4f981f];return _0x104576;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x1b82('0x0'))['db'][_0x1b82('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1b82('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4b1809){return function(_0x3b1d14,_0x1403ab,_0x3fadf0){OpenchannelAccountEvents[_0x1b82('0x3')](_0x4b1809+':'+_0x3b1d14['id'],_0x3b1d14);OpenchannelAccountEvents['emit'](_0x4b1809,_0x3b1d14);_0x3fadf0(null);};}for(var e in events){if(events[_0x1b82('0x4')](e)){var event=events[e];OpenchannelAccount[_0x1b82('0x5')](e,emitEvent(event));}}module[_0x1b82('0x6')]=OpenchannelAccountEvents;
\ No newline at end of file
index cff015f..1b149e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x17778d,_0x444c5f){var _0x20f0b0=function(_0x585fc0){while(--_0x585fc0){_0x17778d['push'](_0x17778d['shift']());}};_0x20f0b0(++_0x444c5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4c648e,_0x44a4b1){var _0x2adc98=function(_0x3106f2){while(--_0x3106f2){_0x4c648e['push'](_0x4c648e['shift']());}};_0x2adc98(++_0x44a4b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 0111d45..d8ad5f4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9b87=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./openchannelAccount.socket','register','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x9b87,0x8e));var _0x79b8=function(_0x45f780,_0x38af18){_0x45f780=_0x45f780-0x0;var _0x274a95=_0x9b87[_0x45f780];return _0x274a95;};'use strict';var _=require(_0x79b8('0x0'));var util=require(_0x79b8('0x1'));var moment=require(_0x79b8('0x2'));var BPromise=require(_0x79b8('0x3'));var rs=require(_0x79b8('0x4'));var fs=require('fs');var Redis=require(_0x79b8('0x5'));var db=require(_0x79b8('0x6'))['db'];var utils=require(_0x79b8('0x7'));var logger=require(_0x79b8('0x8'))(_0x79b8('0x9'));var config=require(_0x79b8('0xa'));var jayson=require(_0x79b8('0xb'));var client=jayson[_0x79b8('0xc')][_0x79b8('0xd')]({'port':0x232a});config[_0x79b8('0xe')]=_[_0x79b8('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x79b8('0x10'))[_0x79b8('0x11')](socket);function respondWithRpcPromise(_0x2f3453,_0x4bc41f,_0x28434){return new BPromise(function(_0x2fdb05,_0xdf585a){return client['request'](_0x2f3453,_0x28434)['then'](function(_0x46c0ce){logger[_0x79b8('0x12')](_0x79b8('0x13'),_0x4bc41f,_0x79b8('0x14'));logger[_0x79b8('0x15')](_0x79b8('0x16'),_0x4bc41f,_0x79b8('0x14'),JSON[_0x79b8('0x17')](_0x46c0ce));if(_0x46c0ce[_0x79b8('0x18')]){if(_0x46c0ce[_0x79b8('0x18')][_0x79b8('0x19')]===0x1f4){logger['error'](_0x79b8('0x13'),_0x4bc41f,_0x46c0ce['error']['message']);return _0xdf585a(_0x46c0ce[_0x79b8('0x18')][_0x79b8('0x1a')]);}logger[_0x79b8('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x4bc41f,_0x46c0ce[_0x79b8('0x18')]['message']);return _0x2fdb05(_0x46c0ce['error'][_0x79b8('0x1a')]);}else{logger[_0x79b8('0x12')](_0x79b8('0x13'),_0x4bc41f,_0x79b8('0x14'));_0x2fdb05(_0x46c0ce[_0x79b8('0x1b')][_0x79b8('0x1a')]);}})['catch'](function(_0x6a0de5){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4bc41f,_0x6a0de5);_0xdf585a(_0x6a0de5);});});}
\ No newline at end of file
+var _0x6582=['code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','./openchannelAccount.socket','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x45ecbb,_0x47de20){var _0x50b05b=function(_0x353a9d){while(--_0x353a9d){_0x45ecbb['push'](_0x45ecbb['shift']());}};_0x50b05b(++_0x47de20);}(_0x6582,0x108));var _0x2658=function(_0x1331b2,_0x3df22b){_0x1331b2=_0x1331b2-0x0;var _0x10f741=_0x6582[_0x1331b2];return _0x10f741;};'use strict';var _=require(_0x2658('0x0'));var util=require(_0x2658('0x1'));var moment=require(_0x2658('0x2'));var BPromise=require(_0x2658('0x3'));var rs=require(_0x2658('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2658('0x5'))['db'];var utils=require(_0x2658('0x6'));var logger=require(_0x2658('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2658('0x8')][_0x2658('0x9')]({'port':0x232a});config[_0x2658('0xa')]=_[_0x2658('0xb')](config[_0x2658('0xa')],{'host':_0x2658('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2658('0xa')]));require(_0x2658('0xd'))[_0x2658('0xe')](socket);function respondWithRpcPromise(_0x99b9db,_0x455ff9,_0x2b2561){return new BPromise(function(_0x3f22a5,_0x1aaaac){return client[_0x2658('0xf')](_0x99b9db,_0x2b2561)['then'](function(_0x20fe6d){logger['info'](_0x2658('0x10'),_0x455ff9,_0x2658('0x11'));logger[_0x2658('0x12')](_0x2658('0x13'),_0x455ff9,_0x2658('0x11'),JSON[_0x2658('0x14')](_0x20fe6d));if(_0x20fe6d[_0x2658('0x15')]){if(_0x20fe6d['error'][_0x2658('0x16')]===0x1f4){logger[_0x2658('0x15')](_0x2658('0x10'),_0x455ff9,_0x20fe6d[_0x2658('0x15')][_0x2658('0x17')]);return _0x1aaaac(_0x20fe6d['error'][_0x2658('0x17')]);}logger[_0x2658('0x15')](_0x2658('0x10'),_0x455ff9,_0x20fe6d['error'][_0x2658('0x17')]);return _0x3f22a5(_0x20fe6d[_0x2658('0x15')][_0x2658('0x17')]);}else{logger[_0x2658('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x455ff9,_0x2658('0x11'));_0x3f22a5(_0x20fe6d['result'][_0x2658('0x17')]);}})[_0x2658('0x19')](function(_0x307220){logger[_0x2658('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x455ff9,_0x307220);_0x1aaaac(_0x307220);});});}
\ No newline at end of file
index 13ffc6b..c10577c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc252=['./openchannelAccount.events','save','remove','update','emit','removeListener','length','openchannelAccount:'];(function(_0x2a9d28,_0x488eff){var _0x49b9e6=function(_0x584c1c){while(--_0x584c1c){_0x2a9d28['push'](_0x2a9d28['shift']());}};_0x49b9e6(++_0x488eff);}(_0xc252,0x118));var _0x2c25=function(_0x1faba0,_0x28a69e){_0x1faba0=_0x1faba0-0x0;var _0x24da89=_0xc252[_0x1faba0];return _0x24da89;};'use strict';var OpenchannelAccountEvents=require(_0x2c25('0x0'));var events=[_0x2c25('0x1'),_0x2c25('0x2'),_0x2c25('0x3')];function createListener(_0x8c4cec,_0x953602){return function(_0x43e76d){_0x953602[_0x2c25('0x4')](_0x8c4cec,_0x43e76d);};}function removeListener(_0x5815ad,_0x5e2a2a){return function(){OpenchannelAccountEvents[_0x2c25('0x5')](_0x5815ad,_0x5e2a2a);};}exports['register']=function(_0x184693){for(var _0x3cd0c0=0x0,_0x39972f=events[_0x2c25('0x6')];_0x3cd0c0<_0x39972f;_0x3cd0c0++){var _0x5f1278=events[_0x3cd0c0];var _0x491314=createListener(_0x2c25('0x7')+_0x5f1278,_0x184693);OpenchannelAccountEvents['on'](_0x5f1278,_0x491314);}};
\ No newline at end of file
+var _0x7846=['update','removeListener','register','openchannelAccount:','save','remove'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x7846,0xf4));var _0x6784=function(_0x45d5ef,_0x10c29b){_0x45d5ef=_0x45d5ef-0x0;var _0x474d19=_0x7846[_0x45d5ef];return _0x474d19;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x6784('0x0'),_0x6784('0x1'),_0x6784('0x2')];function createListener(_0xebf76a,_0x3c868d){return function(_0x7653ef){_0x3c868d['emit'](_0xebf76a,_0x7653ef);};}function removeListener(_0x13ba3e,_0x24c16b){return function(){OpenchannelAccountEvents[_0x6784('0x3')](_0x13ba3e,_0x24c16b);};}exports[_0x6784('0x4')]=function(_0x327e26){for(var _0x409fe1=0x0,_0x43df2a=events['length'];_0x409fe1<_0x43df2a;_0x409fe1++){var _0x560e3f=events[_0x409fe1];var _0x289ae9=createListener(_0x6784('0x5')+_0x560e3f,_0x327e26);OpenchannelAccountEvents['on'](_0x560e3f,_0x289ae9);}};
\ No newline at end of file
index c6a632e..e9dbcfc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2841=['get','isAuthenticated','index','/:id','show','put','update','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x2a4353,_0x151a95){var _0x350bce=function(_0x31d8ff){while(--_0x31d8ff){_0x2a4353['push'](_0x2a4353['shift']());}};_0x350bce(++_0x151a95);}(_0x2841,0xf9));var _0x1284=function(_0x461886,_0x4fc171){_0x461886=_0x461886-0x0;var _0x295e0a=_0x2841[_0x461886];return _0x295e0a;};'use strict';var multer=require(_0x1284('0x0'));var util=require(_0x1284('0x1'));var path=require(_0x1284('0x2'));var timeout=require('connect-timeout');var express=require(_0x1284('0x3'));var router=express[_0x1284('0x4')]();var fs_extra=require(_0x1284('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x1284('0x6')]('/',auth[_0x1284('0x7')](),controller[_0x1284('0x8')]);router['get'](_0x1284('0x9'),auth[_0x1284('0x7')](),controller[_0x1284('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1284('0xb')](_0x1284('0x9'),auth[_0x1284('0x7')](),controller[_0x1284('0xc')]);router['delete'](_0x1284('0x9'),auth[_0x1284('0x7')](),controller[_0x1284('0xd')]);module[_0x1284('0xe')]=router;
\ No newline at end of file
+var _0x2984=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x2293d9,_0x1f264b){var _0x4a6243=function(_0x3b722d){while(--_0x3b722d){_0x2293d9['push'](_0x2293d9['shift']());}};_0x4a6243(++_0x1f264b);}(_0x2984,0xe3));var _0x4298=function(_0x1d7300,_0x17f109){_0x1d7300=_0x1d7300-0x0;var _0x46ee98=_0x2984[_0x1d7300];return _0x46ee98;};'use strict';var multer=require(_0x4298('0x0'));var util=require(_0x4298('0x1'));var path=require(_0x4298('0x2'));var timeout=require(_0x4298('0x3'));var express=require('express');var router=express[_0x4298('0x4')]();var fs_extra=require(_0x4298('0x5'));var auth=require(_0x4298('0x6'));var interaction=require(_0x4298('0x7'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x4298('0x8')]('/',auth[_0x4298('0x9')](),controller[_0x4298('0xa')]);router[_0x4298('0x8')](_0x4298('0xb'),auth[_0x4298('0x9')](),controller[_0x4298('0xc')]);router[_0x4298('0xd')]('/',auth[_0x4298('0x9')](),controller['create']);router[_0x4298('0xe')](_0x4298('0xb'),auth[_0x4298('0x9')](),controller[_0x4298('0xf')]);router[_0x4298('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x4298('0x11')]);module[_0x4298('0x12')]=router;
\ No newline at end of file
index 96d082f..8514669 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa11f=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x428774,_0x383962){var _0x53a01c=function(_0x2d62da){while(--_0x2d62da){_0x428774['push'](_0x428774['shift']());}};_0x53a01c(++_0x383962);}(_0xa11f,0x10c));var _0xfa11=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0xa11f[_0x438fe1];return _0x3c8e1b;};'use strict';var Sequelize=require(_0xfa11('0x0'));module[_0xfa11('0x1')]={'priority':{'type':Sequelize[_0xfa11('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfa11('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xfa11('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfa11('0x3')],'defaultValue':_0xfa11('0x5')}};
\ No newline at end of file
+var _0x2837=['TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x2c083a,_0x30aa05){var _0x547ed9=function(_0xd271a6){while(--_0xd271a6){_0x2c083a['push'](_0x2c083a['shift']());}};_0x547ed9(++_0x30aa05);}(_0x2837,0xb1));var _0x7283=function(_0x5e26bb,_0x531299){_0x5e26bb=_0x5e26bb-0x0;var _0x4d10e3=_0x2837[_0x5e26bb];return _0x4d10e3;};'use strict';var Sequelize=require(_0x7283('0x0'));module[_0x7283('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7283('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7283('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7283('0x2')],'defaultValue':_0x7283('0x4')}};
\ No newline at end of file
index aca9771..027bb49 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70c7=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','catch','show','params','OpenchannelApplication','includeAll','include','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4bd658,_0xb4d970){var _0x575486=function(_0x12ed2c){while(--_0x12ed2c){_0x4bd658['push'](_0x4bd658['shift']());}};_0x575486(++_0xb4d970);}(_0x70c7,0x1a7));var _0x770c=function(_0x29845e,_0x4e9909){_0x29845e=_0x29845e-0x0;var _0x8cef91=_0x70c7[_0x29845e];return _0x8cef91;};'use strict';var emlformat=require(_0x770c('0x0'));var rimraf=require(_0x770c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x770c('0x2'));var rp=require(_0x770c('0x3'));var moment=require(_0x770c('0x4'));var BPromise=require(_0x770c('0x5'));var Mustache=require(_0x770c('0x6'));var util=require(_0x770c('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x770c('0x8'));var fs=require('fs');var fs_extra=require(_0x770c('0x9'));var _=require(_0x770c('0xa'));var squel=require(_0x770c('0xb'));var crypto=require(_0x770c('0xc'));var jsforce=require(_0x770c('0xd'));var deskjs=require(_0x770c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x770c('0xf'));var Papa=require(_0x770c('0x10'));var Redis=require(_0x770c('0x11'));var authService=require(_0x770c('0x12'));var qs=require(_0x770c('0x13'));var as=require(_0x770c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x770c('0x15'))('api');var utils=require(_0x770c('0x16'));var config=require(_0x770c('0x17'));var licenseUtil=require(_0x770c('0x18'));var db=require(_0x770c('0x19'))['db'];function respondWithStatusCode(_0x372b1c,_0xdfa6df){_0xdfa6df=_0xdfa6df||0xcc;return function(_0x1d57b0){if(_0x1d57b0){return _0x372b1c[_0x770c('0x1a')](_0xdfa6df);}return _0x372b1c[_0x770c('0x1b')](_0xdfa6df)[_0x770c('0x1c')]();};}function respondWithResult(_0x2ceec5,_0x5da1e1){_0x5da1e1=_0x5da1e1||0xc8;return function(_0x29451f){if(_0x29451f){return _0x2ceec5[_0x770c('0x1b')](_0x5da1e1)[_0x770c('0x1d')](_0x29451f);}};}function respondWithFilteredResult(_0x4ba025,_0x3dd4a9){return function(_0x24f5a4){if(_0x24f5a4){var _0x4b77ad=typeof _0x3dd4a9[_0x770c('0x1e')]===_0x770c('0x1f')&&typeof _0x3dd4a9[_0x770c('0x20')]==='undefined';var _0x2964ef=_0x24f5a4['count'];var _0x21652a=_0x4b77ad?0x0:_0x3dd4a9[_0x770c('0x1e')];var _0x12e8c4=_0x4b77ad?_0x24f5a4[_0x770c('0x21')]:_0x3dd4a9[_0x770c('0x1e')]+_0x3dd4a9[_0x770c('0x20')];var _0x329875;if(_0x12e8c4>=_0x2964ef){_0x12e8c4=_0x2964ef;_0x329875=0xc8;}else{_0x329875=0xce;}_0x4ba025[_0x770c('0x1b')](_0x329875);return _0x4ba025[_0x770c('0x22')](_0x770c('0x23'),_0x21652a+'-'+_0x12e8c4+'/'+_0x2964ef)[_0x770c('0x1d')](_0x24f5a4);}return null;};}function patchUpdates(_0x562a9c){return function(_0x5709c9){try{jsonpatch[_0x770c('0x24')](_0x5709c9,_0x562a9c,!![]);}catch(_0x1d81a3){return BPromise[_0x770c('0x25')](_0x1d81a3);}return _0x5709c9['save']();};}function saveUpdates(_0x3b24b0,_0x4dd0be){return function(_0x447878){if(_0x447878){return _0x447878[_0x770c('0x26')](_0x3b24b0)[_0x770c('0x27')](function(_0x7d7287){return _0x7d7287;});}return null;};}function removeEntity(_0x3002ba,_0x57b903){return function(_0x3068da){if(_0x3068da){return _0x3068da[_0x770c('0x28')]()[_0x770c('0x27')](function(){_0x3002ba[_0x770c('0x1b')](0xcc)[_0x770c('0x1c')]();});}};}function handleEntityNotFound(_0x5013fb,_0x5b3ae9){return function(_0x5ab90c){if(!_0x5ab90c){_0x5013fb[_0x770c('0x1a')](0x194);}return _0x5ab90c;};}function handleError(_0xb1c7bc,_0x3fd1b6){_0x3fd1b6=_0x3fd1b6||0x1f4;return function(_0x5a0915){logger[_0x770c('0x29')](_0x5a0915[_0x770c('0x2a')]);if(_0x5a0915[_0x770c('0x2b')]){delete _0x5a0915['name'];}_0xb1c7bc[_0x770c('0x1b')](_0x3fd1b6)[_0x770c('0x2c')](_0x5a0915);};}exports[_0x770c('0x2d')]=function(_0x501022,_0x372329){var _0x28f8de={},_0x334fc1={},_0x2a93ae={'count':0x0,'rows':[]};var _0xb42c52=_['map'](db['OpenchannelApplication'][_0x770c('0x2e')],function(_0x516a42){return{'name':_0x516a42[_0x770c('0x2f')],'type':_0x516a42[_0x770c('0x30')][_0x770c('0x31')]};});_0x334fc1['model']=_[_0x770c('0x32')](_0xb42c52,_0x770c('0x2b'));_0x334fc1[_0x770c('0x33')]=_[_0x770c('0x34')](_0x501022[_0x770c('0x33')]);_0x334fc1['filters']=_[_0x770c('0x35')](_0x334fc1['model'],_0x334fc1[_0x770c('0x33')]);_0x28f8de[_0x770c('0x36')]=_['intersection'](_0x334fc1[_0x770c('0x37')],qs[_0x770c('0x38')](_0x501022[_0x770c('0x33')][_0x770c('0x38')]));_0x28f8de[_0x770c('0x36')]=_0x28f8de['attributes'][_0x770c('0x39')]?_0x28f8de['attributes']:_0x334fc1['model'];if(!_0x501022[_0x770c('0x33')][_0x770c('0x3a')]('nolimit')){_0x28f8de[_0x770c('0x20')]=qs[_0x770c('0x20')](_0x501022[_0x770c('0x33')]['limit']);_0x28f8de['offset']=qs[_0x770c('0x1e')](_0x501022[_0x770c('0x33')][_0x770c('0x1e')]);}_0x28f8de['order']=qs[_0x770c('0x3b')](_0x501022[_0x770c('0x33')]['sort']);_0x28f8de[_0x770c('0x3c')]=qs[_0x770c('0x3d')](_['pick'](_0x501022['query'],_0x334fc1[_0x770c('0x3d')]),_0xb42c52);if(_0x501022[_0x770c('0x33')][_0x770c('0x3e')]){_0x28f8de[_0x770c('0x3c')]=_[_0x770c('0x3f')](_0x28f8de[_0x770c('0x3c')],{'$or':_['map'](_0xb42c52,function(_0x2a02f4){if(_0x2a02f4[_0x770c('0x30')]!==_0x770c('0x40')){var _0x1116d6={};_0x1116d6[_0x2a02f4['name']]={'$like':'%'+_0x501022[_0x770c('0x33')][_0x770c('0x3e')]+'%'};return _0x1116d6;}})});}_0x28f8de=_[_0x770c('0x3f')]({},_0x28f8de,_0x501022['options']);var _0x5bf5dd={'where':_0x28f8de[_0x770c('0x3c')]};return db['OpenchannelApplication'][_0x770c('0x21')](_0x5bf5dd)['then'](function(_0x4f4642){_0x2a93ae[_0x770c('0x21')]=_0x4f4642;if(_0x501022[_0x770c('0x33')]['includeAll']){_0x28f8de['include']=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x28f8de);})[_0x770c('0x27')](function(_0x1be362){_0x2a93ae['rows']=_0x1be362;return _0x2a93ae;})[_0x770c('0x27')](respondWithFilteredResult(_0x372329,_0x28f8de))[_0x770c('0x41')](handleError(_0x372329,null));};exports[_0x770c('0x42')]=function(_0x3eb359,_0x332933){var _0x10e8e6={'raw':!![],'where':{'id':_0x3eb359[_0x770c('0x43')]['id']}},_0x28a328={};_0x28a328[_0x770c('0x37')]=_[_0x770c('0x34')](db[_0x770c('0x44')][_0x770c('0x2e')]);_0x28a328[_0x770c('0x33')]=_[_0x770c('0x34')](_0x3eb359['query']);_0x28a328[_0x770c('0x3d')]=_[_0x770c('0x35')](_0x28a328['model'],_0x28a328[_0x770c('0x33')]);_0x10e8e6[_0x770c('0x36')]=_[_0x770c('0x35')](_0x28a328[_0x770c('0x37')],qs[_0x770c('0x38')](_0x3eb359['query'][_0x770c('0x38')]));_0x10e8e6[_0x770c('0x36')]=_0x10e8e6[_0x770c('0x36')][_0x770c('0x39')]?_0x10e8e6[_0x770c('0x36')]:_0x28a328[_0x770c('0x37')];if(_0x3eb359[_0x770c('0x33')][_0x770c('0x45')]){_0x10e8e6[_0x770c('0x46')]=[{'all':!![]}];}_0x10e8e6=_['merge']({},_0x10e8e6,_0x3eb359[_0x770c('0x47')]);return db[_0x770c('0x44')]['find'](_0x10e8e6)[_0x770c('0x27')](handleEntityNotFound(_0x332933,null))[_0x770c('0x27')](respondWithResult(_0x332933,null))[_0x770c('0x41')](handleError(_0x332933,null));};exports[_0x770c('0x48')]=function(_0x1aca56,_0x5be35f){return db[_0x770c('0x44')][_0x770c('0x48')](_0x1aca56[_0x770c('0x49')],{})[_0x770c('0x27')](respondWithResult(_0x5be35f,0xc9))[_0x770c('0x41')](handleError(_0x5be35f,null));};exports[_0x770c('0x26')]=function(_0x847ea1,_0x53a5ea){if(_0x847ea1[_0x770c('0x49')]['id']){delete _0x847ea1['body']['id'];}return db[_0x770c('0x44')][_0x770c('0x4a')]({'where':{'id':_0x847ea1[_0x770c('0x43')]['id']}})[_0x770c('0x27')](handleEntityNotFound(_0x53a5ea,null))[_0x770c('0x27')](saveUpdates(_0x847ea1['body'],null))[_0x770c('0x27')](respondWithResult(_0x53a5ea,null))[_0x770c('0x41')](handleError(_0x53a5ea,null));};exports[_0x770c('0x28')]=function(_0x54806f,_0x4ee23b){return db[_0x770c('0x44')][_0x770c('0x4a')]({'where':{'id':_0x54806f[_0x770c('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ee23b,null))[_0x770c('0x27')](removeEntity(_0x4ee23b,null))['catch'](handleError(_0x4ee23b,null));};
\ No newline at end of file
+var _0x50b1=['catch','params','keys','rawAttributes','create','body','find','destroy','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','index','OpenchannelApplication','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x17262f,_0x3c7ef2){var _0x28d050=function(_0x211f88){while(--_0x211f88){_0x17262f['push'](_0x17262f['shift']());}};_0x28d050(++_0x3c7ef2);}(_0x50b1,0x1b8));var _0x150b=function(_0x40c6d8,_0x1627f4){_0x40c6d8=_0x40c6d8-0x0;var _0x48e3c5=_0x50b1[_0x40c6d8];return _0x48e3c5;};'use strict';var emlformat=require(_0x150b('0x0'));var rimraf=require(_0x150b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x150b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x150b('0x3'));var Mustache=require(_0x150b('0x4'));var util=require(_0x150b('0x5'));var path=require(_0x150b('0x6'));var sox=require(_0x150b('0x7'));var csv=require(_0x150b('0x8'));var ejs=require(_0x150b('0x9'));var fs=require('fs');var fs_extra=require(_0x150b('0xa'));var _=require(_0x150b('0xb'));var squel=require(_0x150b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x150b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x150b('0xe'));var Papa=require(_0x150b('0xf'));var Redis=require(_0x150b('0x10'));var authService=require(_0x150b('0x11'));var qs=require(_0x150b('0x12'));var as=require(_0x150b('0x13'));var hardwareService=require(_0x150b('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x150b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x150b('0x16'))['db'];function respondWithStatusCode(_0xec45,_0x33f90e){_0x33f90e=_0x33f90e||0xcc;return function(_0x3a046a){if(_0x3a046a){return _0xec45['sendStatus'](_0x33f90e);}return _0xec45['status'](_0x33f90e)[_0x150b('0x17')]();};}function respondWithResult(_0x568c06,_0x78b2d5){_0x78b2d5=_0x78b2d5||0xc8;return function(_0x208878){if(_0x208878){return _0x568c06[_0x150b('0x18')](_0x78b2d5)[_0x150b('0x19')](_0x208878);}};}function respondWithFilteredResult(_0x46d7b7,_0x437801){return function(_0x47fe71){if(_0x47fe71){var _0x5d0c92=typeof _0x437801['offset']==='undefined'&&typeof _0x437801[_0x150b('0x1a')]===_0x150b('0x1b');var _0x30066b=_0x47fe71[_0x150b('0x1c')];var _0x31a58f=_0x5d0c92?0x0:_0x437801[_0x150b('0x1d')];var _0x33c03f=_0x5d0c92?_0x47fe71[_0x150b('0x1c')]:_0x437801[_0x150b('0x1d')]+_0x437801[_0x150b('0x1a')];var _0xb12a43;if(_0x33c03f>=_0x30066b){_0x33c03f=_0x30066b;_0xb12a43=0xc8;}else{_0xb12a43=0xce;}_0x46d7b7['status'](_0xb12a43);return _0x46d7b7[_0x150b('0x1e')](_0x150b('0x1f'),_0x31a58f+'-'+_0x33c03f+'/'+_0x30066b)[_0x150b('0x19')](_0x47fe71);}return null;};}function patchUpdates(_0x334079){return function(_0x5e9fea){try{jsonpatch[_0x150b('0x20')](_0x5e9fea,_0x334079,!![]);}catch(_0x34bca9){return BPromise[_0x150b('0x21')](_0x34bca9);}return _0x5e9fea[_0x150b('0x22')]();};}function saveUpdates(_0x409b1d,_0xda8229){return function(_0x1d6bd5){if(_0x1d6bd5){return _0x1d6bd5[_0x150b('0x23')](_0x409b1d)[_0x150b('0x24')](function(_0x3576f7){return _0x3576f7;});}return null;};}function removeEntity(_0x38dfbc,_0x3f0be1){return function(_0x170da1){if(_0x170da1){return _0x170da1['destroy']()[_0x150b('0x24')](function(){_0x38dfbc[_0x150b('0x18')](0xcc)[_0x150b('0x17')]();});}};}function handleEntityNotFound(_0x8929,_0x417a42){return function(_0x61fb07){if(!_0x61fb07){_0x8929[_0x150b('0x25')](0x194);}return _0x61fb07;};}function handleError(_0x59bca3,_0x3d1ea7){_0x3d1ea7=_0x3d1ea7||0x1f4;return function(_0x5af59e){logger[_0x150b('0x26')](_0x5af59e['stack']);if(_0x5af59e[_0x150b('0x27')]){delete _0x5af59e[_0x150b('0x27')];}_0x59bca3[_0x150b('0x18')](_0x3d1ea7)['send'](_0x5af59e);};}exports[_0x150b('0x28')]=function(_0x499379,_0x55566e){var _0x5dcc39={},_0x4243ab={},_0x5bc434={'count':0x0,'rows':[]};var _0x2a7f09=_['map'](db[_0x150b('0x29')]['rawAttributes'],function(_0x571f5e){return{'name':_0x571f5e[_0x150b('0x2a')],'type':_0x571f5e[_0x150b('0x2b')][_0x150b('0x2c')]};});_0x4243ab[_0x150b('0x2d')]=_[_0x150b('0x2e')](_0x2a7f09,'name');_0x4243ab['query']=_['keys'](_0x499379[_0x150b('0x2f')]);_0x4243ab[_0x150b('0x30')]=_[_0x150b('0x31')](_0x4243ab[_0x150b('0x2d')],_0x4243ab[_0x150b('0x2f')]);_0x5dcc39[_0x150b('0x32')]=_[_0x150b('0x31')](_0x4243ab[_0x150b('0x2d')],qs[_0x150b('0x33')](_0x499379[_0x150b('0x2f')][_0x150b('0x33')]));_0x5dcc39['attributes']=_0x5dcc39[_0x150b('0x32')]['length']?_0x5dcc39[_0x150b('0x32')]:_0x4243ab[_0x150b('0x2d')];if(!_0x499379['query'][_0x150b('0x34')](_0x150b('0x35'))){_0x5dcc39[_0x150b('0x1a')]=qs[_0x150b('0x1a')](_0x499379['query'][_0x150b('0x1a')]);_0x5dcc39[_0x150b('0x1d')]=qs[_0x150b('0x1d')](_0x499379['query'][_0x150b('0x1d')]);}_0x5dcc39[_0x150b('0x36')]=qs[_0x150b('0x37')](_0x499379[_0x150b('0x2f')][_0x150b('0x37')]);_0x5dcc39['where']=qs[_0x150b('0x30')](_[_0x150b('0x38')](_0x499379[_0x150b('0x2f')],_0x4243ab[_0x150b('0x30')]),_0x2a7f09);if(_0x499379[_0x150b('0x2f')][_0x150b('0x39')]){_0x5dcc39[_0x150b('0x3a')]=_[_0x150b('0x3b')](_0x5dcc39[_0x150b('0x3a')],{'$or':_[_0x150b('0x2e')](_0x2a7f09,function(_0x4251d4){if(_0x4251d4[_0x150b('0x2b')]!==_0x150b('0x3c')){var _0x50831c={};_0x50831c[_0x4251d4[_0x150b('0x27')]]={'$like':'%'+_0x499379[_0x150b('0x2f')][_0x150b('0x39')]+'%'};return _0x50831c;}})});}_0x5dcc39=_['merge']({},_0x5dcc39,_0x499379[_0x150b('0x3d')]);var _0x49f8e6={'where':_0x5dcc39['where']};return db[_0x150b('0x29')][_0x150b('0x1c')](_0x49f8e6)[_0x150b('0x24')](function(_0x438f1a){_0x5bc434[_0x150b('0x1c')]=_0x438f1a;if(_0x499379[_0x150b('0x2f')][_0x150b('0x3e')]){_0x5dcc39[_0x150b('0x3f')]=[{'all':!![]}];}return db[_0x150b('0x29')]['findAll'](_0x5dcc39);})[_0x150b('0x24')](function(_0xd33bb2){_0x5bc434['rows']=_0xd33bb2;return _0x5bc434;})[_0x150b('0x24')](respondWithFilteredResult(_0x55566e,_0x5dcc39))[_0x150b('0x40')](handleError(_0x55566e,null));};exports['show']=function(_0x15b032,_0x552b4b){var _0x19fca8={'raw':!![],'where':{'id':_0x15b032[_0x150b('0x41')]['id']}},_0x6db4cb={};_0x6db4cb[_0x150b('0x2d')]=_[_0x150b('0x42')](db[_0x150b('0x29')][_0x150b('0x43')]);_0x6db4cb[_0x150b('0x2f')]=_['keys'](_0x15b032[_0x150b('0x2f')]);_0x6db4cb[_0x150b('0x30')]=_[_0x150b('0x31')](_0x6db4cb['model'],_0x6db4cb[_0x150b('0x2f')]);_0x19fca8[_0x150b('0x32')]=_[_0x150b('0x31')](_0x6db4cb['model'],qs[_0x150b('0x33')](_0x15b032[_0x150b('0x2f')][_0x150b('0x33')]));_0x19fca8[_0x150b('0x32')]=_0x19fca8[_0x150b('0x32')]['length']?_0x19fca8[_0x150b('0x32')]:_0x6db4cb['model'];if(_0x15b032[_0x150b('0x2f')][_0x150b('0x3e')]){_0x19fca8[_0x150b('0x3f')]=[{'all':!![]}];}_0x19fca8=_['merge']({},_0x19fca8,_0x15b032[_0x150b('0x3d')]);return db['OpenchannelApplication']['find'](_0x19fca8)['then'](handleEntityNotFound(_0x552b4b,null))[_0x150b('0x24')](respondWithResult(_0x552b4b,null))[_0x150b('0x40')](handleError(_0x552b4b,null));};exports['create']=function(_0x2a7c9e,_0x2ba487){return db[_0x150b('0x29')][_0x150b('0x44')](_0x2a7c9e['body'],{})[_0x150b('0x24')](respondWithResult(_0x2ba487,0xc9))[_0x150b('0x40')](handleError(_0x2ba487,null));};exports[_0x150b('0x23')]=function(_0x322c24,_0x15f24f){if(_0x322c24[_0x150b('0x45')]['id']){delete _0x322c24['body']['id'];}return db['OpenchannelApplication'][_0x150b('0x46')]({'where':{'id':_0x322c24[_0x150b('0x41')]['id']}})[_0x150b('0x24')](handleEntityNotFound(_0x15f24f,null))[_0x150b('0x24')](saveUpdates(_0x322c24[_0x150b('0x45')],null))[_0x150b('0x24')](respondWithResult(_0x15f24f,null))[_0x150b('0x40')](handleError(_0x15f24f,null));};exports[_0x150b('0x47')]=function(_0xb00040,_0x552f3d){return db[_0x150b('0x29')][_0x150b('0x46')]({'where':{'id':_0xb00040[_0x150b('0x41')]['id']}})[_0x150b('0x24')](handleEntityNotFound(_0x552f3d,null))['then'](removeEntity(_0x552f3d,null))['catch'](handleError(_0x552f3d,null));};
\ No newline at end of file
index fb278fc..c3fa68b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b34=['../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x3da110,_0x52336e){var _0x19e7a6=function(_0x2d178a){while(--_0x2d178a){_0x3da110['push'](_0x3da110['shift']());}};_0x19e7a6(++_0x52336e);}(_0x0b34,0x104));var _0x40b3=function(_0xd49889,_0x47b0ac){_0xd49889=_0xd49889-0x0;var _0x49b946=_0x0b34[_0xd49889];return _0x49b946;};'use strict';var _=require('lodash');var util=require(_0x40b3('0x0'));var logger=require('../../config/logger')(_0x40b3('0x1'));var moment=require(_0x40b3('0x2'));var BPromise=require(_0x40b3('0x3'));var rp=require(_0x40b3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x40b3('0x5'));var config=require(_0x40b3('0x6'));var attributes=require(_0x40b3('0x7'));module[_0x40b3('0x8')]=function(_0x32b5ce,_0x1c80d1){return _0x32b5ce[_0x40b3('0x9')](_0x40b3('0xa'),attributes,{'tableName':_0x40b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x40b3('0xc'),'collate':_0x40b3('0xd')});};
\ No newline at end of file
+var _0x4e21=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','./openchannelApplication.attributes','exports','OpenchannelApplication'];(function(_0x2de7ff,_0x38dc16){var _0xc38ffd=function(_0x282793){while(--_0x282793){_0x2de7ff['push'](_0x2de7ff['shift']());}};_0xc38ffd(++_0x38dc16);}(_0x4e21,0x121));var _0x14e2=function(_0x1fbd96,_0x1ee9ff){_0x1fbd96=_0x1fbd96-0x0;var _0x1041d7=_0x4e21[_0x1fbd96];return _0x1041d7;};'use strict';var _=require(_0x14e2('0x0'));var util=require(_0x14e2('0x1'));var logger=require(_0x14e2('0x2'))('api');var moment=require(_0x14e2('0x3'));var BPromise=require(_0x14e2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x14e2('0x5'));module[_0x14e2('0x6')]=function(_0x2fea44,_0x2f0ae9){return _0x2fea44['define'](_0x14e2('0x7'),attributes,{'tableName':_0x14e2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x14e2('0x9'),'collate':_0x14e2('0xa')});};
\ No newline at end of file
index 8d44411..cc0b128 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x023b=['ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','limit','debug','lodash','util','moment','bluebird','randomstring'];(function(_0x4ef106,_0x183509){var _0xe5e33e=function(_0x17299f){while(--_0x17299f){_0x4ef106['push'](_0x4ef106['shift']());}};_0xe5e33e(++_0x183509);}(_0x023b,0x1db));var _0xb023=function(_0x526912,_0x3c2c39){_0x526912=_0x526912-0x0;var _0x28c6cc=_0x023b[_0x526912];return _0x28c6cc;};'use strict';var _=require(_0xb023('0x0'));var util=require(_0xb023('0x1'));var moment=require(_0xb023('0x2'));var BPromise=require(_0xb023('0x3'));var rs=require(_0xb023('0x4'));var fs=require('fs');var Redis=require(_0xb023('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb023('0x6'))(_0xb023('0x7'));var config=require(_0xb023('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb023('0x9')][_0xb023('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc2e393,_0x4f9275,_0xc780ce){return new BPromise(function(_0x6d07c6,_0x213a06){return client[_0xb023('0xb')](_0xc2e393,_0xc780ce)[_0xb023('0xc')](function(_0x46b365){logger[_0xb023('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x4f9275,_0xb023('0xe'));logger['debug'](_0xb023('0xf'),_0x4f9275,'request\x20sent',JSON[_0xb023('0x10')](_0x46b365));if(_0x46b365[_0xb023('0x11')]){if(_0x46b365[_0xb023('0x11')][_0xb023('0x12')]===0x1f4){logger[_0xb023('0x11')](_0xb023('0x13'),_0x4f9275,_0x46b365[_0xb023('0x11')][_0xb023('0x14')]);return _0x213a06(_0x46b365[_0xb023('0x11')][_0xb023('0x14')]);}logger['error'](_0xb023('0x13'),_0x4f9275,_0x46b365[_0xb023('0x11')]['message']);return _0x6d07c6(_0x46b365[_0xb023('0x11')]['message']);}else{logger[_0xb023('0xd')](_0xb023('0x13'),_0x4f9275,_0xb023('0xe'));_0x6d07c6(_0x46b365[_0xb023('0x15')][_0xb023('0x14')]);}})[_0xb023('0x16')](function(_0x867b07){logger[_0xb023('0x11')](_0xb023('0x13'),_0x4f9275,_0x867b07);_0x213a06(_0x867b07);});});}exports[_0xb023('0x17')]=function(_0x4069cd){var _0x383aaa=this;return new Promise(function(_0x1ff343,_0x4ee3b1){return db[_0xb023('0x18')][_0xb023('0x19')](_0x4069cd[_0xb023('0x1a')],{'raw':_0x4069cd[_0xb023('0x1b')]?_0x4069cd['options'][_0xb023('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4069cd['options']?_0x4069cd[_0xb023('0x1b')]['where']||null:null,'attributes':_0x4069cd[_0xb023('0x1b')]?_0x4069cd[_0xb023('0x1b')][_0xb023('0x1d')]||null:null,'limit':_0x4069cd[_0xb023('0x1b')]?_0x4069cd[_0xb023('0x1b')][_0xb023('0x1e')]||null:null})[_0xb023('0xc')](function(_0x266557){logger['info'](_0xb023('0x17'),_0x4069cd);logger[_0xb023('0x1f')](_0xb023('0x17'),_0x4069cd,JSON[_0xb023('0x10')](_0x266557));_0x1ff343(_0x266557);})[_0xb023('0x16')](function(_0x1eaa9f){logger[_0xb023('0x11')](_0xb023('0x17'),_0x1eaa9f[_0xb023('0x14')],_0x4069cd);_0x4ee3b1(_0x383aaa[_0xb023('0x11')](0x1f4,_0x1eaa9f[_0xb023('0x14')]));});});};
\ No newline at end of file
+var _0xde4e=['limit','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes'];(function(_0x34a0a3,_0x12ffc6){var _0x35565f=function(_0x2426f2){while(--_0x2426f2){_0x34a0a3['push'](_0x34a0a3['shift']());}};_0x35565f(++_0x12ffc6);}(_0xde4e,0x195));var _0xede4=function(_0x3f4ae0,_0x78bd2a){_0x3f4ae0=_0x3f4ae0-0x0;var _0x296ae1=_0xde4e[_0x3f4ae0];return _0x296ae1;};'use strict';var _=require(_0xede4('0x0'));var util=require('util');var moment=require(_0xede4('0x1'));var BPromise=require(_0xede4('0x2'));var rs=require(_0xede4('0x3'));var fs=require('fs');var Redis=require(_0xede4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xede4('0x5'));var logger=require('../../config/logger')(_0xede4('0x6'));var config=require('../../config/environment');var jayson=require(_0xede4('0x7'));var client=jayson[_0xede4('0x8')][_0xede4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x464f9d,_0x4918b1,_0x38eae6){return new BPromise(function(_0x342f94,_0x2f7740){return client['request'](_0x464f9d,_0x38eae6)[_0xede4('0xa')](function(_0x1dc6cd){logger[_0xede4('0xb')](_0xede4('0xc'),_0x4918b1,'request\x20sent');logger[_0xede4('0xd')](_0xede4('0xe'),_0x4918b1,'request\x20sent',JSON[_0xede4('0xf')](_0x1dc6cd));if(_0x1dc6cd[_0xede4('0x10')]){if(_0x1dc6cd[_0xede4('0x10')][_0xede4('0x11')]===0x1f4){logger['error'](_0xede4('0xc'),_0x4918b1,_0x1dc6cd[_0xede4('0x10')]['message']);return _0x2f7740(_0x1dc6cd['error'][_0xede4('0x12')]);}logger[_0xede4('0x10')](_0xede4('0xc'),_0x4918b1,_0x1dc6cd['error'][_0xede4('0x12')]);return _0x342f94(_0x1dc6cd[_0xede4('0x10')]['message']);}else{logger['info'](_0xede4('0xc'),_0x4918b1,_0xede4('0x13'));_0x342f94(_0x1dc6cd[_0xede4('0x14')][_0xede4('0x12')]);}})['catch'](function(_0x59c32e){logger[_0xede4('0x10')](_0xede4('0xc'),_0x4918b1,_0x59c32e);_0x2f7740(_0x59c32e);});});}exports[_0xede4('0x15')]=function(_0x1f1788){var _0x5f1310=this;return new Promise(function(_0x4c845b,_0x3bf42d){return db[_0xede4('0x16')][_0xede4('0x17')](_0x1f1788[_0xede4('0x18')],{'raw':_0x1f1788[_0xede4('0x19')]?_0x1f1788['options'][_0xede4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f1788[_0xede4('0x19')]?_0x1f1788[_0xede4('0x19')][_0xede4('0x1b')]||null:null,'attributes':_0x1f1788[_0xede4('0x19')]?_0x1f1788[_0xede4('0x19')][_0xede4('0x1c')]||null:null,'limit':_0x1f1788[_0xede4('0x19')]?_0x1f1788[_0xede4('0x19')][_0xede4('0x1d')]||null:null})['then'](function(_0x4c9a44){logger[_0xede4('0xb')](_0xede4('0x15'),_0x1f1788);logger[_0xede4('0xd')](_0xede4('0x15'),_0x1f1788,JSON[_0xede4('0xf')](_0x4c9a44));_0x4c845b(_0x4c9a44);})[_0xede4('0x1e')](function(_0x3ddff1){logger[_0xede4('0x10')](_0xede4('0x15'),_0x3ddff1[_0xede4('0x12')],_0x1f1788);_0x3bf42d(_0x5f1310[_0xede4('0x10')](0x1f4,_0x3ddff1[_0xede4('0x12')]));});});};
\ No newline at end of file
index 77e4c7b..a777819 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4463=['openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0x4463,0x8c));var _0x3446=function(_0x27cd97,_0x55fa81){_0x27cd97=_0x27cd97-0x0;var _0x5ef916=_0x4463[_0x27cd97];return _0x5ef916;};'use strict';var multer=require(_0x3446('0x0'));var util=require(_0x3446('0x1'));var path=require(_0x3446('0x2'));var timeout=require(_0x3446('0x3'));var express=require(_0x3446('0x4'));var router=express['Router']();var fs_extra=require(_0x3446('0x5'));var auth=require(_0x3446('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3446('0x7'));var controller=require(_0x3446('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3446('0x9')]);router[_0x3446('0xa')](_0x3446('0xb'),auth['isAuthenticated'](),controller[_0x3446('0xc')]);router[_0x3446('0xa')](_0x3446('0xd'),auth[_0x3446('0xe')](),controller[_0x3446('0xf')]);router[_0x3446('0xa')](_0x3446('0x10'),auth['isAuthenticated'](),controller[_0x3446('0x11')]);router[_0x3446('0xa')](_0x3446('0x12'),auth[_0x3446('0xe')](),controller['download']);router[_0x3446('0x13')]('/',auth[_0x3446('0xe')](),controller[_0x3446('0x14')]);router[_0x3446('0x13')](_0x3446('0x10'),auth[_0x3446('0xe')](),controller[_0x3446('0x15')]);router[_0x3446('0x13')](_0x3446('0x16'),auth[_0x3446('0xe')](),interaction[_0x3446('0x17')](_0x3446('0x18'),_0x3446('0x19')),controller['addTags']);router[_0x3446('0x1a')](_0x3446('0xd'),auth[_0x3446('0xe')](),interaction[_0x3446('0x17')](_0x3446('0x18'),_0x3446('0x1b')),controller[_0x3446('0x1c')]);router[_0x3446('0x1d')](_0x3446('0xd'),auth[_0x3446('0xe')](),interaction[_0x3446('0x17')](_0x3446('0x18'),_0x3446('0x1e')),controller[_0x3446('0x1f')]);router[_0x3446('0x1d')](_0x3446('0x16'),auth['isAuthenticated'](),controller[_0x3446('0x20')]);module[_0x3446('0x21')]=router;
\ No newline at end of file
+var _0x8677=['./openchannelInteraction.controller','get','index','/describe','/:id','show','/:id/messages','isAuthenticated','/:id/download','download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x28ab2c,_0x4b8e37){var _0x203d40=function(_0x122d51){while(--_0x122d51){_0x28ab2c['push'](_0x28ab2c['shift']());}};_0x203d40(++_0x4b8e37);}(_0x8677,0x1a4));var _0x7867=function(_0x504d03,_0x487713){_0x504d03=_0x504d03-0x0;var _0x74f092=_0x8677[_0x504d03];return _0x74f092;};'use strict';var multer=require(_0x7867('0x0'));var util=require(_0x7867('0x1'));var path=require(_0x7867('0x2'));var timeout=require(_0x7867('0x3'));var express=require('express');var router=express[_0x7867('0x4')]();var fs_extra=require(_0x7867('0x5'));var auth=require(_0x7867('0x6'));var interaction=require(_0x7867('0x7'));var config=require(_0x7867('0x8'));var controller=require(_0x7867('0x9'));router[_0x7867('0xa')]('/',auth['isAuthenticated'](),controller[_0x7867('0xb')]);router[_0x7867('0xa')](_0x7867('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x7867('0xa')](_0x7867('0xd'),auth['isAuthenticated'](),controller[_0x7867('0xe')]);router[_0x7867('0xa')](_0x7867('0xf'),auth[_0x7867('0x10')](),controller['getMessages']);router[_0x7867('0xa')](_0x7867('0x11'),auth[_0x7867('0x10')](),controller[_0x7867('0x12')]);router[_0x7867('0x13')]('/',auth['isAuthenticated'](),controller[_0x7867('0x14')]);router[_0x7867('0x13')](_0x7867('0xf'),auth['isAuthenticated'](),controller['addMessage']);router[_0x7867('0x13')](_0x7867('0x15'),auth[_0x7867('0x10')](),interaction[_0x7867('0x16')](_0x7867('0x17'),_0x7867('0x18')),controller[_0x7867('0x19')]);router[_0x7867('0x1a')](_0x7867('0xd'),auth[_0x7867('0x10')](),interaction[_0x7867('0x16')](_0x7867('0x17'),_0x7867('0x1b')),controller['update']);router[_0x7867('0x1c')](_0x7867('0xd'),auth[_0x7867('0x10')](),interaction[_0x7867('0x16')](_0x7867('0x17'),_0x7867('0x1d')),controller[_0x7867('0x1e')]);router[_0x7867('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7867('0x1f')]);module[_0x7867('0x20')]=router;
\ No newline at end of file
index 3f29db2..d7627da 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc997=['ENUM','out','exports','BOOLEAN','DATE','STRING'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0xc997,0x1ac));var _0x7c99=function(_0x10c81b,_0x3b7d25){_0x10c81b=_0x10c81b-0x0;var _0x13a8f4=_0xc997[_0x10c81b];return _0x13a8f4;};'use strict';var Sequelize=require('sequelize');module[_0x7c99('0x0')]={'closed':{'type':Sequelize[_0x7c99('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7c99('0x2')]},'disposition':{'type':Sequelize[_0x7c99('0x3')]},'secondDisposition':{'type':Sequelize[_0x7c99('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7c99('0x3')]},'read1stAt':{'type':Sequelize[_0x7c99('0x2')]},'threadId':{'type':Sequelize[_0x7c99('0x3')]},'externalUrl':{'type':Sequelize[_0x7c99('0x3')]},'lastMsgAt':{'type':Sequelize[_0x7c99('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x7c99('0x4')]('in',_0x7c99('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x7c99('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7c99('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x7c99('0x1')],'defaultValue':![]}};
\ No newline at end of file
+var _0x0a34=['DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x0a34,0x12a));var _0x40a3=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x0a34[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x40a3('0x0'));module[_0x40a3('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x40a3('0x2')]},'disposition':{'type':Sequelize[_0x40a3('0x3')]},'secondDisposition':{'type':Sequelize[_0x40a3('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x40a3('0x3')]},'read1stAt':{'type':Sequelize[_0x40a3('0x2')]},'threadId':{'type':Sequelize[_0x40a3('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x40a3('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x40a3('0x4')]('in',_0x40a3('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x40a3('0x4')]('in',_0x40a3('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x40a3('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
index 3e0d5b8..829461e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc02a=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','talking','unmanaged','total','closed','UserId','waiting','answered','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','length','attributes','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','left_join','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','start','some','compact','isEmpty','where','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','fields','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','params','includeAll','options','create','destroy','describe','addMessage','OpenchannelMessage','omit','ids','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','setTags','spread','emit','removeTags','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Attachment','Messages','direction','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','secret','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','rimraf'];(function(_0x4870fe,_0x1f95f4){var _0x2413df=function(_0x249273){while(--_0x249273){_0x4870fe['push'](_0x4870fe['shift']());}};_0x2413df(++_0x1f95f4);}(_0xc02a,0x1e8));var _0xac02=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xc02a[_0x2db12b];return _0x20990b;};'use strict';var emlformat=require(_0xac02('0x0'));var rimraf=require(_0xac02('0x1'));var zipdir=require(_0xac02('0x2'));var jsonpatch=require(_0xac02('0x3'));var rp=require(_0xac02('0x4'));var moment=require(_0xac02('0x5'));var BPromise=require(_0xac02('0x6'));var Mustache=require(_0xac02('0x7'));var util=require(_0xac02('0x8'));var path=require(_0xac02('0x9'));var sox=require(_0xac02('0xa'));var csv=require(_0xac02('0xb'));var ejs=require(_0xac02('0xc'));var fs=require('fs');var fs_extra=require(_0xac02('0xd'));var _=require(_0xac02('0xe'));var squel=require(_0xac02('0xf'));var crypto=require(_0xac02('0x10'));var jsforce=require(_0xac02('0x11'));var deskjs=require(_0xac02('0x12'));var toCsv=require(_0xac02('0xb'));var querystring=require(_0xac02('0x13'));var Papa=require(_0xac02('0x14'));var Redis=require('ioredis');var authService=require(_0xac02('0x15'));var qs=require(_0xac02('0x16'));var as=require(_0xac02('0x17'));var pdf=require(_0xac02('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac02('0x19'))(_0xac02('0x1a'));var utils=require('../../config/utils');var config=require(_0xac02('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xac02('0x1c')]=_[_0xac02('0x1d')](config['redis'],{'host':_0xac02('0x1e'),'port':0x18eb});var socket=require(_0xac02('0x1f'))(new Redis(config[_0xac02('0x1c')]));require(_0xac02('0x20'))['register'](socket);function respondWithStatusCode(_0x505ccf,_0x392e80){_0x392e80=_0x392e80||0xcc;return function(_0x171448){if(_0x171448){return _0x505ccf[_0xac02('0x21')](_0x392e80);}return _0x505ccf[_0xac02('0x22')](_0x392e80)[_0xac02('0x23')]();};}function respondWithResult(_0x5d989d,_0x59f755){_0x59f755=_0x59f755||0xc8;return function(_0x22c0ee){if(_0x22c0ee){return _0x5d989d[_0xac02('0x22')](_0x59f755)[_0xac02('0x24')](_0x22c0ee);}};}function respondWithFilteredResult(_0x4b34bb,_0x2a7891){return function(_0x357bcc){if(_0x357bcc){var _0x1233cf=typeof _0x2a7891[_0xac02('0x25')]===_0xac02('0x26')&&typeof _0x2a7891[_0xac02('0x27')]===_0xac02('0x26');var _0xe879e4=_0x357bcc[_0xac02('0x28')];var _0x43df40=_0x1233cf?0x0:_0x2a7891[_0xac02('0x25')];var _0x304f88=_0x1233cf?_0x357bcc[_0xac02('0x28')]:_0x2a7891[_0xac02('0x25')]+_0x2a7891[_0xac02('0x27')];var _0x13f1f4;if(_0x304f88>=_0xe879e4){_0x304f88=_0xe879e4;_0x13f1f4=0xc8;}else{_0x13f1f4=0xce;}_0x4b34bb[_0xac02('0x22')](_0x13f1f4);return _0x4b34bb[_0xac02('0x29')](_0xac02('0x2a'),_0x43df40+'-'+_0x304f88+'/'+_0xe879e4)[_0xac02('0x24')](_0x357bcc);}return null;};}function patchUpdates(_0x3770a4){return function(_0x4dd5f6){try{jsonpatch[_0xac02('0x2b')](_0x4dd5f6,_0x3770a4,!![]);}catch(_0x1a4cd0){return BPromise['reject'](_0x1a4cd0);}return _0x4dd5f6['save']();};}function saveUpdates(_0x2bbd36,_0x1c17ec){return function(_0x3889aa){if(_0x3889aa){return _0x3889aa[_0xac02('0x2c')](_0x2bbd36)[_0xac02('0x2d')](function(_0x1beac0){return _0x1beac0;});}return null;};}function removeEntity(_0x3c861c,_0x3862ce){return function(_0xb46b28){if(_0xb46b28){return _0xb46b28['destroy']()[_0xac02('0x2d')](function(){_0x3c861c[_0xac02('0x22')](0xcc)[_0xac02('0x23')]();});}};}function handleEntityNotFound(_0x35abbc,_0x577207){return function(_0x2768d7){if(!_0x2768d7){_0x35abbc[_0xac02('0x21')](0x194);}return _0x2768d7;};}function handleError(_0x25678f,_0x16a7d7){_0x16a7d7=_0x16a7d7||0x1f4;return function(_0x3d8bf0){logger[_0xac02('0x2e')](_0x3d8bf0['stack']);if(_0x3d8bf0[_0xac02('0x2f')]){delete _0x3d8bf0[_0xac02('0x2f')];}_0x25678f[_0xac02('0x22')](_0x16a7d7)['send'](_0x3d8bf0);};}function getInteractionUsers(_0x32ee42,_0x599c80){return new BPromise(function(_0x43bfef,_0x5287f7){try{if(_0x599c80[_0x32ee42['id']]){_0x32ee42[_0xac02('0x30')]=_[_0xac02('0x31')](_0x599c80[_0x32ee42['id']],function(_0x17ff1a){return{'id':_0x17ff1a['id'],'fullname':_0x17ff1a[_0xac02('0x32')]};});}}catch(_0x5442c0){_0x5287f7(_0x5442c0);}_0x43bfef(_0x32ee42);});}function getInteractionTags(_0x3ad487,_0x199fbc){return new BPromise(function(_0x19ccb0,_0x368604){try{if(_0x3ad487[_0xac02('0x33')]){_0x3ad487[_0xac02('0x34')]=[];_0x3ad487[_0xac02('0x33')][_0xac02('0x35')](',')[_0xac02('0x36')](function(_0x46dca8){_0x3ad487[_0xac02('0x34')][_0xac02('0x37')](_0x199fbc[_0x46dca8]);});}delete _0x3ad487[_0xac02('0x33')];}catch(_0x504d91){_0x368604(_0x504d91);}_0x19ccb0(_0x3ad487);});}function updateOpenchannelInteraction(_0x1b1807,_0x37acc1,_0x30cefe){return new BPromise(function(_0x3d6960,_0x3c6f38){return getInteractionUsers(_0x1b1807,_0x30cefe)['then'](function(_0x475fe0){return getInteractionTags(_0x475fe0,_0x37acc1);})[_0xac02('0x2d')](function(_0x1600ff){return getStateInteraction(_0x1600ff);})[_0xac02('0x2d')](function(_0x4f709d){_0x3d6960(_0x4f709d);})[_0xac02('0x38')](function(_0x35e8f8){_0x3c6f38(_0x35e8f8);});});}function getStateInteraction(_0x3e3fd2){return new BPromise(function(_0x2f9e55){_0x3e3fd2['waiting']=0x0;_0x3e3fd2[_0xac02('0x39')]=0x0;_0x3e3fd2['answered']=0x0;_0x3e3fd2[_0xac02('0x3a')]=0x0;_0x3e3fd2[_0xac02('0x3b')]=0x0;if(!_0x3e3fd2[_0xac02('0x3c')]&&!_0x3e3fd2[_0xac02('0x3d')]){_0x3e3fd2['waiting']+=0x1;}if(!_0x3e3fd2[_0xac02('0x3c')]&&_0x3e3fd2[_0xac02('0x3d')]){_0x3e3fd2[_0xac02('0x39')]+=0x1;if(_0x3e3fd2[_0xac02('0x3e')]){_0x3e3fd2[_0xac02('0x3e')]-=0x1;}}if(_0x3e3fd2[_0xac02('0x3c')]&&_0x3e3fd2[_0xac02('0x3d')]){_0x3e3fd2[_0xac02('0x3f')]+=0x1;if(_0x3e3fd2[_0xac02('0x39')]){_0x3e3fd2[_0xac02('0x39')]-=0x1;}}if(_0x3e3fd2[_0xac02('0x3c')]&&!_0x3e3fd2[_0xac02('0x3d')]){_0x3e3fd2[_0xac02('0x3a')]+=0x1;if(_0x3e3fd2[_0xac02('0x3e')]){_0x3e3fd2['waiting']-=0x1;}}_0x3e3fd2['total']+=0x1;_0x2f9e55(_0x3e3fd2);});}exports[_0xac02('0x40')]=function(_0x258478,_0x3e9929){var _0x5cbf78={},_0x15fb79={},_0x588065={'count':0x0,'rows':[]};var _0x3c4e88=_[_0xac02('0x31')](db[_0xac02('0x41')][_0xac02('0x42')],function(_0x490985){return{'name':_0x490985[_0xac02('0x43')],'type':_0x490985[_0xac02('0x44')][_0xac02('0x45')]};});_0x15fb79[_0xac02('0x46')]=_['map'](_0x3c4e88,_0xac02('0x2f'));_0x15fb79[_0xac02('0x47')]=_[_0xac02('0x48')](_0x258478[_0xac02('0x47')]);_0x15fb79[_0xac02('0x49')]=_[_0xac02('0x4a')](_0x15fb79['model'],_0x15fb79['query']);_0x5cbf78['attributes']=_[_0xac02('0x4a')](_0x15fb79[_0xac02('0x46')],qs['fields'](_0x258478[_0xac02('0x47')]['fields']));_0x5cbf78['attributes']=_0x5cbf78['attributes'][_0xac02('0x4b')]?_0x5cbf78[_0xac02('0x4c')]:_0x15fb79[_0xac02('0x46')];if(!_0x258478['query'][_0xac02('0x4d')](_0xac02('0x4e'))){_0x5cbf78[_0xac02('0x27')]=qs[_0xac02('0x27')](_0x258478[_0xac02('0x47')][_0xac02('0x27')]);_0x5cbf78[_0xac02('0x25')]=qs[_0xac02('0x25')](_0x258478[_0xac02('0x47')][_0xac02('0x25')]);}_0x5cbf78[_0xac02('0x4f')]=qs[_0xac02('0x50')](_0x258478[_0xac02('0x47')][_0xac02('0x50')]);_0x5cbf78['where']=qs[_0xac02('0x49')](_[_0xac02('0x51')](_0x258478[_0xac02('0x47')],_0x15fb79['filters']),_0x3c4e88);var _0x5e8818=[];var _0x2c2689=squel[_0xac02('0x52')]()[_0xac02('0x53')]('id')['field'](_0xac02('0x2f'))[_0xac02('0x53')](_0xac02('0x54'))[_0xac02('0x55')](_0xac02('0x56'));var _0x36e072=squel['select']()[_0xac02('0x53')](_0xac02('0x57'))[_0xac02('0x53')](_0xac02('0x58'))[_0xac02('0x53')]('ui.OpenchannelInteractionId')[_0xac02('0x55')](_0xac02('0x59'),'ui')['left_join'](_0xac02('0x5a'),'u',_0xac02('0x5b'));var _0x524b5a=squel[_0xac02('0x52')]()['from']('openchannel_interactions','i')[_0xac02('0x5c')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xac02('0x5c')](_0xac02('0x5a'),'o',_0xac02('0x5d'))[_0xac02('0x5c')](_0xac02('0x5e'),'a',_0xac02('0x5f'))[_0xac02('0x5c')](_0xac02('0x60'),'me',_0xac02('0x61'))[_0xac02('0x5c')](_0xac02('0x62'),'it',_0xac02('0x63'))[_0xac02('0x5c')](_0xac02('0x56'),'t',_0xac02('0x64'));var _0x369221=squel[_0xac02('0x65')]();var _0x3567d7=[];var _0x494e06=squel[_0xac02('0x65')]();var _0x4e67a7;if(_0x258478['query'][_0xac02('0x66')]){_0x4e67a7=as[_0xac02('0x67')](_0x258478[_0xac02('0x47')][_0xac02('0x66')]);var _0x5e8f97=_0x4e67a7['sqlOperator'];for(var _0x48eb43=0x0;_0x48eb43<_0x4e67a7[_0xac02('0x68')][_0xac02('0x4b')];_0x48eb43++){var _0x584c38=_0x4e67a7[_0xac02('0x68')][_0x48eb43];var _0x215fed='i';var _0x4ba99e=_[_0xac02('0x69')](_0x3c4e88,[_0xac02('0x2f'),_0x584c38[_0xac02('0x53')]]);if(!_0x4ba99e){switch(_0x584c38['field']){case _0xac02('0x6a'):if(_0x584c38[_0xac02('0x6b')]==0x1){_0x524b5a[_0xac02('0x6c')]('`'+_0x584c38['field']+'`\x20=\x200');}else{_0x524b5a[_0xac02('0x6c')]('`'+_0x584c38[_0xac02('0x53')]+_0xac02('0x6d'));}break;case _0xac02('0x6e'):if(_0x584c38[_0xac02('0x6f')]==='$substring'){if(_0x584c38['value'][_0xac02('0x35')]('\x20')[_0xac02('0x4b')]>0x1){_0x369221[_0x5e8f97](_0xac02('0x70'),qs[_0xac02('0x71')](_0x584c38[_0xac02('0x6b')]),null);}else{var _0x2f73af='%'+_0x584c38[_0xac02('0x6b')]+'%';_0x369221[_0x5e8f97](_0xac02('0x72'),_0x2f73af,_0x2f73af,_0x2f73af);}}else{_0x4ba99e=_['find'](_0x3c4e88,['name',_0xac02('0x73')]);_0x584c38[_0xac02('0x53')]=_0xac02('0x73');_0x457ba7=as[_0xac02('0x74')](_0x215fed,_0x4ba99e['type'],_0x584c38);_0x369221[_0x5e8f97](_0x457ba7[_0xac02('0x75')],_0x457ba7[_0xac02('0x6b')]['start'],_0x457ba7[_0xac02('0x6b')][_0xac02('0x23')]);}break;case _0xac02('0x76'):var _0x2c96b1=_0x584c38[_0xac02('0x6b')]['split'](',')[_0xac02('0x31')](function(_0x4fee0d){return Number(_0x4fee0d);});_0x2c96b1['forEach'](function(_0x38ab4e){_0x494e06['or'](_0xac02('0x77'),'%,'+_0x38ab4e+',%');});_0x3567d7=_[_0xac02('0x78')](_0x3567d7,_0x2c96b1);break;case'User':if(_0x584c38[_0xac02('0x6f')]===_0xac02('0x79')){_0x369221[_0x5e8f97](_0xac02('0x7a'),'%'+_0x584c38[_0xac02('0x6b')]+'%',null);}else{_0x4ba99e=_[_0xac02('0x69')](_0x3c4e88,[_0xac02('0x2f'),_0xac02('0x3d')]);_0x584c38[_0xac02('0x53')]=_0xac02('0x3d');_0x457ba7=as['buildExpression'](_0x215fed,_0x4ba99e[_0xac02('0x44')],_0x584c38);_0x369221[_0x5e8f97](_0x457ba7[_0xac02('0x75')],_0x457ba7['value']['start'],_0x457ba7['value'][_0xac02('0x23')]);}break;case _0xac02('0x7b'):_0x457ba7=as[_0xac02('0x74')]('me',null,_0x584c38);_0x369221[_0x5e8f97](_0x457ba7[_0xac02('0x75')],_0x457ba7['value']['start'],_0x457ba7[_0xac02('0x6b')]['end']);break;}}else{var _0x457ba7=as['buildExpression'](_0x215fed,_0x4ba99e[_0xac02('0x44')],_0x584c38);_0x369221[_0x5e8f97](_0x457ba7['text'],_0x457ba7[_0xac02('0x6b')][_0xac02('0x7c')],_0x457ba7[_0xac02('0x6b')]['end']);}}}else{var _0x2e163b=_(_0x258478[_0xac02('0x47')])[_0xac02('0x48')]()[_0xac02('0x31')](function(_0x1c1d40){return _[_0xac02('0x7d')](_0x3c4e88,[_0xac02('0x2f'),_0x1c1d40])?_0x1c1d40:undefined;})[_0xac02('0x7e')]()['value']();if(!_[_0xac02('0x7f')](_0x2e163b)){_0x2e163b[_0xac02('0x36')](function(_0x568342){if(_0x568342==='OpenchannelAccountId'){_0x524b5a[_0xac02('0x80')](_0xac02('0x81'),[]['concat'](_0x258478['query'][_0x568342]));}else if(_0x568342===_0xac02('0x82')){var _0xcb8c60=JSON[_0xac02('0x83')](_0x258478[_0xac02('0x47')][_0x568342])[_0xac02('0x84')];var _0x20852d=JSON[_0xac02('0x83')](_0x258478['query'][_0x568342])[_0xac02('0x85')];_0x524b5a[_0xac02('0x80')](_0xac02('0x86'),_0xcb8c60,_0x20852d);}else{if(_0x258478[_0xac02('0x47')][_0x568342]===_0xac02('0x87')){_0x524b5a[_0xac02('0x80')]('i.'+_0x568342+'\x20IS\x20NULL');}else{_0x524b5a[_0xac02('0x80')]('i.'+_0x568342+_0xac02('0x88'),_0x258478['query'][_0x568342]);}}});}if(_0x258478['query']['read']){if(_0x258478[_0xac02('0x47')][_0xac02('0x89')]==0x1){_0x524b5a['having'](_0xac02('0x8a'));}else{_0x524b5a[_0xac02('0x6c')](_0xac02('0x8b'));}}if(_0x258478[_0xac02('0x47')][_0xac02('0x8c')]){_0x3567d7=_['isArray'](_0x258478['query'][_0xac02('0x8c')])?_0x258478[_0xac02('0x47')][_0xac02('0x8c')]:new Array(_0x258478[_0xac02('0x47')]['tag']);_0x3567d7['forEach'](function(_0x5520ab){_0x494e06['or'](_0xac02('0x77'),'%,'+_0x5520ab+',%');});}if(_0x258478['query'][_0xac02('0x8d')]){var _0x362b9f=_0x258478[_0xac02('0x47')][_0xac02('0x8d')]['replace']('\x5c','\x5c\x5c')[_0xac02('0x8e')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x362b9f)){_0x369221['or']('i.id\x20LIKE\x20?',_0x362b9f+'%');}else{_0x369221['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac02('0x71')](_0x362b9f))['or'](_0xac02('0x8f'),_0x362b9f+'%')['or'](_0xac02('0x90'),_0x362b9f+'%');}}}_0x524b5a[_0xac02('0x80')](_0x369221);_0x524b5a[_0xac02('0x91')]('i.id');var _0x2f4e5e={'type':db['Sequelize'][_0xac02('0x92')][_0xac02('0x93')],'raw':!![]};var _0x48eee9=_0x524b5a[_0xac02('0x94')]();_0x48eee9['field'](_0xac02('0x95'));_0x48eee9[_0xac02('0x53')](_0xac02('0x96'),'unreadMessages');if(_0x5cbf78[_0xac02('0x4f')]){_0x5cbf78[_0xac02('0x4f')]['forEach'](function(_0x14b462){var _0x5c835e=_0x14b462[0x0]===_0xac02('0x97')?_0x14b462[0x0]:'i.'+_0x14b462[0x0];_0x524b5a['order'](_0x5c835e,_0x14b462[0x1]===_0xac02('0x98')?![]:!![]);});}if(!_[_0xac02('0x7f')](_0x3567d7)){_0x524b5a['having'](_0x494e06);_0x48eee9['where']('t.id\x20IN\x20?',_0x3567d7);}BPromise['resolve']()[_0xac02('0x2d')](function(){if(!_0x4e67a7){if(_0x258478[_0xac02('0x47')][_0xac02('0x99')])return;_0x48eee9[_0xac02('0x80')](_0xac02('0x9a'));_0x524b5a['where'](_0xac02('0x9a'));return;}if(_0x258478[_0xac02('0x9b')][_0xac02('0x9c')]!==_0xac02('0x9d'))return;return _0x258478[_0xac02('0x9b')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x5b835d){if(_[_0xac02('0x7f')](_0x5b835d)){_0x48eee9[_0xac02('0x80')](_0xac02('0x9e'));_0x524b5a[_0xac02('0x80')](_0xac02('0x9e'));}else{_0x48eee9[_0xac02('0x80')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xac02('0x31')](_0x5b835d,'id'));_0x524b5a[_0xac02('0x80')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xac02('0x31')](_0x5b835d,'id'));}});})['then'](function(){if(_0x258478['user'][_0xac02('0x9c')]===_0xac02('0x9d')&&!_0x4e67a7&&!_0x258478[_0xac02('0x47')][_0xac02('0x99')])return[];return db[_0xac02('0x9f')][_0xac02('0x47')](_0x48eee9['toString'](),_0x2f4e5e);})['then'](function(_0x57e088){_0x588065[_0xac02('0x28')]=_0x57e088['length'];if(_0x588065[_0xac02('0x28')]===0x0)return[];return db[_0xac02('0x9f')][_0xac02('0x47')](_0x2c2689[_0xac02('0xa0')](),_0x2f4e5e)[_0xac02('0x2d')](function(_0x4a4175){_0x5e8818=_[_0xac02('0xa1')](_0x4a4175,'id');_0x2f4e5e=_[_0xac02('0xa2')](_0x2f4e5e,{'model':db[_0xac02('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x258478['query'][_0xac02('0xa3')]){_0x5cbf78[_0xac02('0x4c')]['forEach'](function(_0x4b4e5c){_0x524b5a['field']('i.'+_0x4b4e5c);});}else{_0x524b5a[_0xac02('0x53')](_0xac02('0x96'),_0xac02('0x6a'));_0x524b5a[_0xac02('0x53')]('a.key',_0xac02('0xa4'));_0x524b5a['field'](_0xac02('0xa5'),_0xac02('0xa6'));_0x524b5a['field']('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xac02('0x97'));_0x524b5a[_0xac02('0x53')](_0xac02('0xa7'));_0x524b5a['field'](_0xac02('0xa8'),_0xac02('0xa9'));_0x524b5a[_0xac02('0x53')](_0xac02('0xaa'),'Contact.lastName');_0x524b5a[_0xac02('0x53')](_0xac02('0xab'),'Contact.email');_0x524b5a[_0xac02('0x53')](_0xac02('0xac'),_0xac02('0xad'));_0x524b5a[_0xac02('0x53')](_0xac02('0xae'),_0xac02('0xaf'));_0x524b5a[_0xac02('0x53')]('c.fax',_0xac02('0xb0'));_0x524b5a[_0xac02('0x53')]('o.fullname',_0xac02('0xb1'));_0x524b5a[_0xac02('0x53')](_0xac02('0xb2'),_0xac02('0xb3'));_0x524b5a['field'](_0xac02('0xb4'),_0xac02('0x33'));}if(_0x5cbf78['limit'])_0x524b5a[_0xac02('0x27')](_0x5cbf78[_0xac02('0x27')]);if(_0x5cbf78[_0xac02('0x25')])_0x524b5a[_0xac02('0x25')](_0x5cbf78[_0xac02('0x25')]);return db[_0xac02('0x9f')][_0xac02('0x47')](_0x524b5a[_0xac02('0xa0')](),_0x2f4e5e);})[_0xac02('0x2d')](function(_0x5932d1){if(_0x5932d1[_0xac02('0x4b')]>0x0)_0x36e072[_0xac02('0x80')](_0xac02('0xb5'),_[_0xac02('0x31')](_0x5932d1,'id'));return db['sequelize'][_0xac02('0x47')](_0x36e072[_0xac02('0xa0')](),_0x2f4e5e)[_0xac02('0x2d')](function(_0x26b8fc){var _0x5d8227=_[_0xac02('0xb6')](_0x26b8fc,_0xac02('0xb7'));var _0x53df05=[];_0x5932d1[_0xac02('0x36')](function(_0x3c4b8c){_0x53df05[_0xac02('0x37')](updateOpenchannelInteraction(_0x3c4b8c,_0x5e8818,_0x5d8227));});return BPromise[_0xac02('0xb8')](_0x53df05);});});})[_0xac02('0x2d')](function(_0x27ec27){_0x588065[_0xac02('0xb9')]=_0x27ec27;return _0x588065;})[_0xac02('0x2d')](respondWithFilteredResult(_0x3e9929,_0x5cbf78))[_0xac02('0x38')](handleError(_0x3e9929,null));};exports['show']=function(_0x5c739e,_0x549f04){var _0xc10870={};if(_0x5c739e['query'][_0xac02('0x44')]&&_0x5c739e[_0xac02('0x47')][_0xac02('0x44')]===_0xac02('0x55')){_0xc10870['from']=_0x5c739e[_0xac02('0xba')]['id'];}else{_0xc10870['id']=_0x5c739e['params']['id'];}var _0x2ca60f={'raw':![],'where':_0xc10870},_0x28fa4a={};_0x28fa4a['model']=_[_0xac02('0x48')](db[_0xac02('0x41')][_0xac02('0x42')]);_0x28fa4a['query']=_['keys'](_0x5c739e['query']);_0x28fa4a['filters']=_[_0xac02('0x4a')](_0x28fa4a['model'],_0x28fa4a[_0xac02('0x47')]);_0x2ca60f[_0xac02('0x4c')]=_[_0xac02('0x4a')](_0x28fa4a[_0xac02('0x46')],qs[_0xac02('0xa3')](_0x5c739e[_0xac02('0x47')][_0xac02('0xa3')]));_0x2ca60f[_0xac02('0x4c')]=_0x2ca60f[_0xac02('0x4c')][_0xac02('0x4b')]?_0x2ca60f[_0xac02('0x4c')]:_0x28fa4a[_0xac02('0x46')];if(_0x5c739e['query'][_0xac02('0xbb')]){_0x2ca60f['include']=[{'all':!![]}];}_0x2ca60f=_[_0xac02('0xa2')]({},_0x2ca60f,_0x5c739e[_0xac02('0xbc')]);return db[_0xac02('0x41')][_0xac02('0x69')](_0x2ca60f)[_0xac02('0x2d')](handleEntityNotFound(_0x549f04,null))['then'](respondWithResult(_0x549f04,null))[_0xac02('0x38')](handleError(_0x549f04,null));};exports[_0xac02('0xbd')]=function(_0x468299,_0x731836){return db[_0xac02('0x41')][_0xac02('0xbd')](_0x468299[_0xac02('0x7b')],{})['then'](respondWithResult(_0x731836,0xc9))[_0xac02('0x38')](handleError(_0x731836,null));};exports[_0xac02('0x2c')]=function(_0x5444d7,_0x3f784d){if(_0x5444d7[_0xac02('0x7b')]['id']){delete _0x5444d7[_0xac02('0x7b')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x5444d7['params']['id']}})['then'](handleEntityNotFound(_0x3f784d,null))[_0xac02('0x2d')](saveUpdates(_0x5444d7[_0xac02('0x7b')],null))['then'](respondWithResult(_0x3f784d,null))[_0xac02('0x38')](handleError(_0x3f784d,null));};exports[_0xac02('0xbe')]=function(_0x2bbccd,_0x36e4b6){return db['OpenchannelInteraction'][_0xac02('0x69')]({'where':{'id':_0x2bbccd[_0xac02('0xba')]['id']}})[_0xac02('0x2d')](handleEntityNotFound(_0x36e4b6,null))['then'](removeEntity(_0x36e4b6,null))['catch'](handleError(_0x36e4b6,null));};exports[_0xac02('0xbf')]=function(_0x2811d2,_0x55918a){return db[_0xac02('0x41')][_0xac02('0xbf')]()['then'](respondWithResult(_0x55918a,null))['catch'](handleError(_0x55918a,null));};exports[_0xac02('0xc0')]=function(_0x2f0ebc,_0x404b1b,_0x2a5879){return db[_0xac02('0xc1')][_0xac02('0x69')]({'where':{'id':_0x2f0ebc[_0xac02('0xba')]['id']}})['then'](handleEntityNotFound(_0x404b1b,null))['then'](function(_0x147905){if(_0x147905){return _0x147905['addMessage'](_0x2f0ebc['body']['ids'],_[_0xac02('0xc2')](_0x2f0ebc[_0xac02('0x7b')],[_0xac02('0xc3'),'id'])||{});}})[_0xac02('0x2d')](respondWithResult(_0x404b1b,null))[_0xac02('0x38')](handleError(_0x404b1b,null));};exports['getMessages']=function(_0x10fdad,_0x2896a7,_0x36e0a6){var _0x2adf8d={'raw':![],'where':{}};var _0x3b1afa={};var _0x423f31={'count':0x0,'rows':[]};return db[_0xac02('0x41')]['findOne']({'where':{'id':_0x10fdad[_0xac02('0xba')]['id']}})[_0xac02('0x2d')](handleEntityNotFound(_0x2896a7,null))['then'](function(_0x5236b8){if(_0x5236b8){_0x3b1afa[_0xac02('0x46')]=_['keys'](db[_0xac02('0xc1')]['rawAttributes']);_0x3b1afa[_0xac02('0x47')]=_[_0xac02('0x48')](_0x10fdad[_0xac02('0x47')]);_0x3b1afa[_0xac02('0x49')]=_['intersection'](_0x3b1afa[_0xac02('0x46')],_0x3b1afa[_0xac02('0x47')]);_0x2adf8d[_0xac02('0x4c')]=_['intersection'](_0x3b1afa[_0xac02('0x46')],qs['fields'](_0x10fdad[_0xac02('0x47')]['fields']));_0x2adf8d[_0xac02('0x4c')]=_0x2adf8d['attributes'][_0xac02('0x4b')]?_0x2adf8d['attributes']:_0x3b1afa[_0xac02('0x46')];if(!_0x10fdad[_0xac02('0x47')][_0xac02('0x4d')](_0xac02('0x4e'))){_0x2adf8d[_0xac02('0x27')]=qs[_0xac02('0x27')](_0x10fdad['query'][_0xac02('0x27')]);_0x2adf8d[_0xac02('0x25')]=qs[_0xac02('0x25')](_0x10fdad[_0xac02('0x47')][_0xac02('0x25')]);}_0x2adf8d['order']=qs['sort'](_0x10fdad[_0xac02('0x47')][_0xac02('0x50')]);_0x2adf8d[_0xac02('0x80')]=qs[_0xac02('0x49')](_[_0xac02('0x51')](_0x10fdad[_0xac02('0x47')],_0x3b1afa['filters']));_0x2adf8d['where']['OpenchannelInteractionId']=_0x5236b8['id'];if(_0x10fdad['query'][_0xac02('0x8d')]){_0x2adf8d[_0xac02('0x80')]=_[_0xac02('0xa2')](_0x2adf8d[_0xac02('0x80')],{'$or':_[_0xac02('0x31')](_0x2adf8d[_0xac02('0x4c')],function(_0x3cb5d6){var _0x5a3f7a={};_0x5a3f7a[_0x3cb5d6]={'$like':'%'+_0x10fdad[_0xac02('0x47')][_0xac02('0x8d')]+'%'};return _0x5a3f7a;})});}if(_0x10fdad[_0xac02('0x47')]['$gte']){var _0x8ad575=_0x10fdad[_0xac02('0x47')]['$gte']['split'](',');var _0x34630b={};_0x34630b[_0x8ad575[0x0]]={'$gte':moment(_0x8ad575[0x1])[_0xac02('0xc4')](_0xac02('0xc5'))};_0x2adf8d[_0xac02('0x80')]=_['merge'](_0x2adf8d[_0xac02('0x80')],_0x34630b);}_0x2adf8d=_[_0xac02('0xa2')]({},_0x2adf8d,_0x10fdad[_0xac02('0xbc')]);return db[_0xac02('0xc1')][_0xac02('0x28')]({'where':_0x2adf8d[_0xac02('0x80')]})[_0xac02('0x2d')](function(_0x4ac0f7){_0x423f31[_0xac02('0x28')]=_0x4ac0f7;if(_0x10fdad['query'][_0xac02('0xbb')]){_0x2adf8d[_0xac02('0xc6')]=[{'all':!![]}];}return db[_0xac02('0xc1')][_0xac02('0xc7')](_0x2adf8d);})[_0xac02('0x2d')](function(_0x3d5395){_0x423f31[_0xac02('0xb9')]=_0x3d5395;return _0x423f31;});}})['then'](respondWithFilteredResult(_0x2896a7,_0x2adf8d))['catch'](handleError(_0x2896a7,null));};exports['addTags']=function(_0x472567,_0x915100,_0x1919b3){return db[_0xac02('0x41')][_0xac02('0x69')]({'where':{'id':_0x472567[_0xac02('0xba')]['id']}})[_0xac02('0x2d')](handleEntityNotFound(_0x915100,null))[_0xac02('0x2d')](function(_0x232690){if(_0x232690){return _0x232690[_0xac02('0xc8')](_0x472567[_0xac02('0x7b')][_0xac02('0xc3')],_[_0xac02('0xc2')](_0x472567[_0xac02('0x7b')],['ids','id'])||{})[_0xac02('0xc9')](function(){return db['Tag'][_0xac02('0xc7')]({'attributes':['id',_0xac02('0x2f'),_0xac02('0x54')],'where':{'id':_0x472567[_0xac02('0x7b')][_0xac02('0xc3')]}});})[_0xac02('0x2d')](function(_0x3ee6d1){socket[_0xac02('0xca')]('openchannelInteractionTags:save',{'id':Number(_0x472567[_0xac02('0xba')]['id']),'tags':_0x3ee6d1||[]});return{'id':Number(_0x472567['params']['id']),'tags':_0x3ee6d1||[]};});}})[_0xac02('0x2d')](respondWithResult(_0x915100,null))[_0xac02('0x38')](handleError(_0x915100,null));};exports[_0xac02('0xcb')]=function(_0x431c3a,_0xb7c8f8,_0xe5dba){return db[_0xac02('0x41')][_0xac02('0x69')]({'where':{'id':_0x431c3a[_0xac02('0xba')]['id']}})[_0xac02('0x2d')](handleEntityNotFound(_0xb7c8f8,null))[_0xac02('0x2d')](function(_0x19d35a){if(_0x19d35a){return _0x19d35a['removeTags'](_0x431c3a['query'][_0xac02('0xc3')]);}})[_0xac02('0x2d')](respondWithStatusCode(_0xb7c8f8,null))['catch'](handleError(_0xb7c8f8,null));};exports[_0xac02('0xcc')]=function(_0x4ccffb,_0x5cac2e){var _0x5295a2=moment()[_0xac02('0xcd')]()[_0xac02('0xa0')]();var _0x28d814=path[_0xac02('0xce')](config[_0xac02('0xcf')],'server',_0xac02('0xd0'),_0xac02('0xd1'));var _0x278148=path['join'](config[_0xac02('0xcf')],_0xac02('0xd2'),_0xac02('0xd0'),_0xac02('0xd3'));var _0x471121=path[_0xac02('0xce')](_0x28d814,_0x5295a2);var _0x31066a=util['format'](_0xac02('0xd4'),_0x4ccffb[_0xac02('0xba')]['id'],_0x5295a2);var _0x124b3d=path[_0xac02('0xce')](_0x28d814,_0x31066a);var _0x181977=[];_0x181977[_0xac02('0x37')]({'model':db[_0xac02('0xd5')],'as':_0xac02('0xd5'),'attributes':['id',_0xac02('0x32')],'raw':!![]});_0x181977[_0xac02('0x37')]({'model':db[_0xac02('0xd6')],'as':_0xac02('0x6e'),'attributes':['id',_0xac02('0xd7'),_0xac02('0xd8')],'raw':!![]});if(_0x4ccffb['query']['attachments']){_0x181977[_0xac02('0x37')]({'model':db[_0xac02('0xd9')],'as':'Attachment','raw':!![]});}var _0x4d3fbf=[{'model':db[_0xac02('0xc1')],'as':_0xac02('0xda'),'attributes':['id','body','createdAt',_0xac02('0xdb'),'secret','read'],'include':_0x181977}];_0x4d3fbf[_0xac02('0x37')]({'model':db['OpenchannelAccount'],'as':_0xac02('0xdc'),'attributes':['id',_0xac02('0x2f')]});_0x4d3fbf[_0xac02('0x37')]({'model':db[_0xac02('0xd5')],'as':_0xac02('0xdd'),'attributes':['id',_0xac02('0x32')]});return db[_0xac02('0x41')][_0xac02('0x69')]({'where':{'id':_0x4ccffb[_0xac02('0xba')]['id']},'include':_0x4d3fbf})['then'](handleEntityNotFound(_0x5cac2e,null))[_0xac02('0x2d')](function(_0x5dff0e){if(_0x5dff0e){var _0x5668f0=_0x5dff0e[_0xac02('0xde')]({'plain':!![]});fs[_0xac02('0xdf')](_0x471121);var _0x5d553a={'channel':_0xac02('0xe0'),'account':_0x5668f0[_0xac02('0xdc')][_0xac02('0x2f')],'agent':_0x5668f0[_0xac02('0xdd')]?_0x5668f0[_0xac02('0xdd')][_0xac02('0x32')]:_0xac02('0xe1'),'createdAt':moment(_0x5668f0[_0xac02('0x82')])[_0xac02('0xc4')](_0xac02('0xc5'))[_0xac02('0xa0')](),'closedAt':_0x5668f0[_0xac02('0x3c')]?moment(_0x5668f0[_0xac02('0xe2')])[_0xac02('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')[_0xac02('0xa0')]():'','disposition':_0x5668f0[_0xac02('0xe3')],'visibility':_0x5668f0[_0xac02('0xe4')]?_0xac02('0xe5'):'Private','messages':_(_0x5668f0[_0xac02('0xda')])[_0xac02('0x8d')]({'secret':![]})[_0xac02('0x31')](function(_0x46bb88){if(_0x46bb88['Attachment']){var _0x3a17cb=path[_0xac02('0xce')](_0x278148,_0x46bb88[_0xac02('0xd9')][_0xac02('0xe6')]);if(fs[_0xac02('0xe7')](_0x3a17cb)){fs[_0xac02('0xe8')](_0x3a17cb)[_0xac02('0xe9')](fs[_0xac02('0xea')](path[_0xac02('0xce')](_0x471121,_0x46bb88[_0xac02('0xd9')][_0xac02('0xe6')])));}}return{'date':moment(_0x46bb88[_0xac02('0x82')])['format'](_0xac02('0xc5'))['toString'](),'sender':_0x46bb88[_0xac02('0xdb')]===_0xac02('0xeb')?_0x46bb88[_0xac02('0xd5')]?_0x46bb88[_0xac02('0xd5')][_0xac02('0x32')]:_0xac02('0xec'):_0x46bb88[_0xac02('0x6e')]['firstName']+(_0x46bb88['Contact'][_0xac02('0xd8')]?'\x20'+_0x46bb88[_0xac02('0x6e')][_0xac02('0xd8')]:''),'body':_0x46bb88[_0xac02('0xd9')]?_0x46bb88[_0xac02('0xd9')][_0xac02('0xe6')]:_0x46bb88['body'],'direction':_0x46bb88['direction']===_0xac02('0xeb')?'A':'C','secret':_0x46bb88[_0xac02('0xed')],'read':_0x46bb88['read'],'attachment':_0x46bb88[_0xac02('0xd9')]};})[_0xac02('0x6b')]()};return ejs[_0xac02('0xee')](path['join'](config['root'],_0xac02('0xd2'),_0xac02('0xef'),'downloadInteraction.ejs'),{'interaction':_0x5d553a})[_0xac02('0x2d')](function(_0x4a5270){var _0x3530a8=path['join'](_0x471121,_0xac02('0xf0')+_0x5668f0['id']+'-'+_0x5295a2+_0xac02('0xf1'));var _0x16da6d={'path':_0x3530a8,'channel':_0xac02('0xe0'),'interactionId':_0x5668f0['id']};return pdf[_0xac02('0xf2')](_0x4a5270,_0x16da6d);})['then'](function(){return new BPromise(function(_0xe1ea76,_0x1ffec4){zipdir(_0x471121,{'saveTo':_0x124b3d},function(_0xf999f3,_0x2a7584){if(_0xf999f3)return _0x1ffec4(_0xf999f3);return _0xe1ea76(_0x2a7584);});})[_0xac02('0x2d')](function(){return new BPromise(function(_0x2e401e,_0x5b14f7){rimraf(_0x471121,function(_0x3366b9){if(_0x3366b9)_0x5b14f7(_0x3366b9);return _0x2e401e();});});})[_0xac02('0x2d')](function(){return _0x5cac2e['download'](_0x124b3d,_0x31066a,function(_0x5eb39f){if(_0x5eb39f){console[_0xac02('0xf3')]('err',_0x5eb39f);}else{fs[_0xac02('0xf4')](_0x124b3d);}});});});}else{return _0x5cac2e['sendStatus'](0xc8);}})[_0xac02('0x38')](handleError(_0x5cac2e,null));};
\ No newline at end of file
+var _0x4b5a=['downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','offset','undefined','limit','set','json','apply','save','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','talking','answered','unmanaged','total','closed','UserId','waiting','index','OpenchannelInteraction','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','users','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','getFullTextValue','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','start','body','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','isArray','tag','forEach','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','Sequelize','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','count','sequelize','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','params','include','create','update','destroy','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','options','includeAll','findAll','addTags','setTags','spread','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','createWriteStream','out','renderFile','views'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b5a,0x1f4));var _0xa4b5=function(_0x57a472,_0x50cb76){_0x57a472=_0x57a472-0x0;var _0x2a5ec6=_0x4b5a[_0x57a472];return _0x2a5ec6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa4b5('0x0'));var zipdir=require(_0xa4b5('0x1'));var jsonpatch=require(_0xa4b5('0x2'));var rp=require(_0xa4b5('0x3'));var moment=require(_0xa4b5('0x4'));var BPromise=require(_0xa4b5('0x5'));var Mustache=require(_0xa4b5('0x6'));var util=require(_0xa4b5('0x7'));var path=require(_0xa4b5('0x8'));var sox=require(_0xa4b5('0x9'));var csv=require(_0xa4b5('0xa'));var ejs=require(_0xa4b5('0xb'));var fs=require('fs');var fs_extra=require(_0xa4b5('0xc'));var _=require(_0xa4b5('0xd'));var squel=require(_0xa4b5('0xe'));var crypto=require(_0xa4b5('0xf'));var jsforce=require(_0xa4b5('0x10'));var deskjs=require(_0xa4b5('0x11'));var toCsv=require(_0xa4b5('0xa'));var querystring=require(_0xa4b5('0x12'));var Papa=require(_0xa4b5('0x13'));var Redis=require('ioredis');var authService=require(_0xa4b5('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0xa4b5('0x15'));var logger=require(_0xa4b5('0x16'))('api');var utils=require(_0xa4b5('0x17'));var config=require(_0xa4b5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa4b5('0x19'))['db'];config[_0xa4b5('0x1a')]=_['defaults'](config['redis'],{'host':_0xa4b5('0x1b'),'port':0x18eb});var socket=require(_0xa4b5('0x1c'))(new Redis(config[_0xa4b5('0x1a')]));require(_0xa4b5('0x1d'))['register'](socket);function respondWithStatusCode(_0x221071,_0x163d13){_0x163d13=_0x163d13||0xcc;return function(_0x53884b){if(_0x53884b){return _0x221071[_0xa4b5('0x1e')](_0x163d13);}return _0x221071[_0xa4b5('0x1f')](_0x163d13)[_0xa4b5('0x20')]();};}function respondWithResult(_0x596a1e,_0x2f66b6){_0x2f66b6=_0x2f66b6||0xc8;return function(_0x5e3ad8){if(_0x5e3ad8){return _0x596a1e['status'](_0x2f66b6)['json'](_0x5e3ad8);}};}function respondWithFilteredResult(_0x328277,_0x5c8fa8){return function(_0x16e965){if(_0x16e965){var _0x820bf7=typeof _0x5c8fa8[_0xa4b5('0x21')]===_0xa4b5('0x22')&&typeof _0x5c8fa8[_0xa4b5('0x23')]===_0xa4b5('0x22');var _0x308860=_0x16e965['count'];var _0x25e884=_0x820bf7?0x0:_0x5c8fa8[_0xa4b5('0x21')];var _0x3d4171=_0x820bf7?_0x16e965['count']:_0x5c8fa8[_0xa4b5('0x21')]+_0x5c8fa8[_0xa4b5('0x23')];var _0x5f525a;if(_0x3d4171>=_0x308860){_0x3d4171=_0x308860;_0x5f525a=0xc8;}else{_0x5f525a=0xce;}_0x328277[_0xa4b5('0x1f')](_0x5f525a);return _0x328277[_0xa4b5('0x24')]('Content-Range',_0x25e884+'-'+_0x3d4171+'/'+_0x308860)[_0xa4b5('0x25')](_0x16e965);}return null;};}function patchUpdates(_0x50537f){return function(_0x14dd6c){try{jsonpatch[_0xa4b5('0x26')](_0x14dd6c,_0x50537f,!![]);}catch(_0x3486b6){return BPromise['reject'](_0x3486b6);}return _0x14dd6c[_0xa4b5('0x27')]();};}function saveUpdates(_0x2b667a,_0x69781e){return function(_0x40d78b){if(_0x40d78b){return _0x40d78b['update'](_0x2b667a)[_0xa4b5('0x28')](function(_0x319314){return _0x319314;});}return null;};}function removeEntity(_0x33b9d7,_0x2e48c7){return function(_0x29d175){if(_0x29d175){return _0x29d175['destroy']()[_0xa4b5('0x28')](function(){_0x33b9d7[_0xa4b5('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2de4dc,_0x1d63c3){return function(_0x1e1a7b){if(!_0x1e1a7b){_0x2de4dc[_0xa4b5('0x1e')](0x194);}return _0x1e1a7b;};}function handleError(_0x154b0f,_0x1c7d45){_0x1c7d45=_0x1c7d45||0x1f4;return function(_0x876fda){logger[_0xa4b5('0x29')](_0x876fda[_0xa4b5('0x2a')]);if(_0x876fda['name']){delete _0x876fda[_0xa4b5('0x2b')];}_0x154b0f['status'](_0x1c7d45)[_0xa4b5('0x2c')](_0x876fda);};}function getInteractionUsers(_0x1d5715,_0x37c0ba){return new BPromise(function(_0x549920,_0xa7cd49){try{if(_0x37c0ba[_0x1d5715['id']]){_0x1d5715[_0xa4b5('0x2d')]=_[_0xa4b5('0x2e')](_0x37c0ba[_0x1d5715['id']],function(_0x317fd0){return{'id':_0x317fd0['id'],'fullname':_0x317fd0[_0xa4b5('0x2f')]};});}}catch(_0x3df10b){_0xa7cd49(_0x3df10b);}_0x549920(_0x1d5715);});}function getInteractionTags(_0x38eb55,_0x352419){return new BPromise(function(_0x3c7d06,_0x3a8627){try{if(_0x38eb55[_0xa4b5('0x30')]){_0x38eb55[_0xa4b5('0x31')]=[];_0x38eb55[_0xa4b5('0x30')][_0xa4b5('0x32')](',')['forEach'](function(_0xd2188e){_0x38eb55[_0xa4b5('0x31')][_0xa4b5('0x33')](_0x352419[_0xd2188e]);});}delete _0x38eb55['TagIds'];}catch(_0x4a2dbe){_0x3a8627(_0x4a2dbe);}_0x3c7d06(_0x38eb55);});}function updateOpenchannelInteraction(_0x37cf16,_0x429ee5,_0x1a08b5){return new BPromise(function(_0x26b5b3,_0x717631){return getInteractionUsers(_0x37cf16,_0x1a08b5)['then'](function(_0x188c14){return getInteractionTags(_0x188c14,_0x429ee5);})[_0xa4b5('0x28')](function(_0x33793d){return getStateInteraction(_0x33793d);})[_0xa4b5('0x28')](function(_0x3d3c3b){_0x26b5b3(_0x3d3c3b);})[_0xa4b5('0x34')](function(_0x32692e){_0x717631(_0x32692e);});});}function getStateInteraction(_0x1e0fe2){return new BPromise(function(_0x6f56d4){_0x1e0fe2['waiting']=0x0;_0x1e0fe2[_0xa4b5('0x35')]=0x0;_0x1e0fe2[_0xa4b5('0x36')]=0x0;_0x1e0fe2[_0xa4b5('0x37')]=0x0;_0x1e0fe2[_0xa4b5('0x38')]=0x0;if(!_0x1e0fe2[_0xa4b5('0x39')]&&!_0x1e0fe2[_0xa4b5('0x3a')]){_0x1e0fe2[_0xa4b5('0x3b')]+=0x1;}if(!_0x1e0fe2[_0xa4b5('0x39')]&&_0x1e0fe2[_0xa4b5('0x3a')]){_0x1e0fe2[_0xa4b5('0x35')]+=0x1;if(_0x1e0fe2[_0xa4b5('0x3b')]){_0x1e0fe2[_0xa4b5('0x3b')]-=0x1;}}if(_0x1e0fe2['closed']&&_0x1e0fe2[_0xa4b5('0x3a')]){_0x1e0fe2[_0xa4b5('0x36')]+=0x1;if(_0x1e0fe2['talking']){_0x1e0fe2[_0xa4b5('0x35')]-=0x1;}}if(_0x1e0fe2[_0xa4b5('0x39')]&&!_0x1e0fe2['UserId']){_0x1e0fe2[_0xa4b5('0x37')]+=0x1;if(_0x1e0fe2[_0xa4b5('0x3b')]){_0x1e0fe2[_0xa4b5('0x3b')]-=0x1;}}_0x1e0fe2['total']+=0x1;_0x6f56d4(_0x1e0fe2);});}exports[_0xa4b5('0x3c')]=function(_0x36aaea,_0x223b5e){var _0xb2af81={},_0x530f01={},_0x18a837={'count':0x0,'rows':[]};var _0x1f862d=_[_0xa4b5('0x2e')](db[_0xa4b5('0x3d')][_0xa4b5('0x3e')],function(_0x2bf704){return{'name':_0x2bf704['fieldName'],'type':_0x2bf704[_0xa4b5('0x3f')][_0xa4b5('0x40')]};});_0x530f01[_0xa4b5('0x41')]=_[_0xa4b5('0x2e')](_0x1f862d,_0xa4b5('0x2b'));_0x530f01[_0xa4b5('0x42')]=_[_0xa4b5('0x43')](_0x36aaea[_0xa4b5('0x42')]);_0x530f01[_0xa4b5('0x44')]=_['intersection'](_0x530f01[_0xa4b5('0x41')],_0x530f01[_0xa4b5('0x42')]);_0xb2af81[_0xa4b5('0x45')]=_[_0xa4b5('0x46')](_0x530f01[_0xa4b5('0x41')],qs['fields'](_0x36aaea[_0xa4b5('0x42')][_0xa4b5('0x47')]));_0xb2af81['attributes']=_0xb2af81[_0xa4b5('0x45')][_0xa4b5('0x48')]?_0xb2af81[_0xa4b5('0x45')]:_0x530f01[_0xa4b5('0x41')];if(!_0x36aaea[_0xa4b5('0x42')][_0xa4b5('0x49')](_0xa4b5('0x4a'))){_0xb2af81[_0xa4b5('0x23')]=qs[_0xa4b5('0x23')](_0x36aaea[_0xa4b5('0x42')][_0xa4b5('0x23')]);_0xb2af81[_0xa4b5('0x21')]=qs[_0xa4b5('0x21')](_0x36aaea[_0xa4b5('0x42')]['offset']);}_0xb2af81[_0xa4b5('0x4b')]=qs[_0xa4b5('0x4c')](_0x36aaea[_0xa4b5('0x42')]['sort']);_0xb2af81['where']=qs[_0xa4b5('0x44')](_[_0xa4b5('0x4d')](_0x36aaea[_0xa4b5('0x42')],_0x530f01[_0xa4b5('0x44')]),_0x1f862d);var _0x2fd4a8=[];var _0x5a150a=squel['select']()[_0xa4b5('0x4e')]('id')[_0xa4b5('0x4e')]('name')[_0xa4b5('0x4e')](_0xa4b5('0x4f'))[_0xa4b5('0x50')](_0xa4b5('0x51'));var _0x228a43=squel[_0xa4b5('0x52')]()[_0xa4b5('0x4e')](_0xa4b5('0x53'))[_0xa4b5('0x4e')](_0xa4b5('0x54'))[_0xa4b5('0x4e')](_0xa4b5('0x55'))[_0xa4b5('0x50')]('user_has_openchannel_interactions','ui')[_0xa4b5('0x56')](_0xa4b5('0x57'),'u','u.id\x20=\x20ui.UserId');var _0x314ad8=squel['select']()[_0xa4b5('0x50')](_0xa4b5('0x58'),'i')[_0xa4b5('0x56')](_0xa4b5('0x59'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa4b5('0x56')](_0xa4b5('0x57'),'o',_0xa4b5('0x5a'))['left_join']('openchannel_accounts','a',_0xa4b5('0x5b'))['left_join'](_0xa4b5('0x5c'),'me',_0xa4b5('0x5d'))[_0xa4b5('0x56')](_0xa4b5('0x5e'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xa4b5('0x56')](_0xa4b5('0x51'),'t','t.id\x20=\x20it.TagId');var _0x242356=squel['expr']();var _0x242575=[];var _0x3b96f2=squel['expr']();var _0x13337a;if(_0x36aaea[_0xa4b5('0x42')]['search']){_0x13337a=as[_0xa4b5('0x5f')](_0x36aaea[_0xa4b5('0x42')]['search']);var _0x61f97a=_0x13337a[_0xa4b5('0x60')];for(var _0x1c7b15=0x0;_0x1c7b15<_0x13337a[_0xa4b5('0x61')][_0xa4b5('0x48')];_0x1c7b15++){var _0x2e330e=_0x13337a[_0xa4b5('0x61')][_0x1c7b15];var _0x4566bf='i';var _0x2c74d6=_[_0xa4b5('0x62')](_0x1f862d,[_0xa4b5('0x2b'),_0x2e330e['field']]);if(!_0x2c74d6){switch(_0x2e330e['field']){case _0xa4b5('0x63'):if(_0x2e330e[_0xa4b5('0x64')]==0x1){_0x314ad8[_0xa4b5('0x65')]('`'+_0x2e330e[_0xa4b5('0x4e')]+_0xa4b5('0x66'));}else{_0x314ad8['having']('`'+_0x2e330e['field']+_0xa4b5('0x67'));}break;case _0xa4b5('0x68'):if(_0x2e330e['operator']===_0xa4b5('0x69')){if(_0x2e330e[_0xa4b5('0x64')][_0xa4b5('0x32')]('\x20')['length']>0x1){_0x242356[_0x61f97a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa4b5('0x6a')](_0x2e330e[_0xa4b5('0x64')]),null);}else{var _0x49e296='%'+_0x2e330e['value']+'%';_0x242356[_0x61f97a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x49e296,_0x49e296,_0x49e296);}}else{_0x2c74d6=_[_0xa4b5('0x62')](_0x1f862d,[_0xa4b5('0x2b'),_0xa4b5('0x6b')]);_0x2e330e[_0xa4b5('0x4e')]=_0xa4b5('0x6b');_0x1fd4c5=as[_0xa4b5('0x6c')](_0x4566bf,_0x2c74d6[_0xa4b5('0x3f')],_0x2e330e);_0x242356[_0x61f97a](_0x1fd4c5['text'],_0x1fd4c5[_0xa4b5('0x64')]['start'],_0x1fd4c5[_0xa4b5('0x64')][_0xa4b5('0x20')]);}break;case _0xa4b5('0x6d'):var _0x197129=_0x2e330e[_0xa4b5('0x64')][_0xa4b5('0x32')](',')[_0xa4b5('0x2e')](function(_0x717249){return Number(_0x717249);});_0x197129['forEach'](function(_0x5cfecb){_0x3b96f2['or'](_0xa4b5('0x6e'),'%,'+_0x5cfecb+',%');});_0x242575=_[_0xa4b5('0x6f')](_0x242575,_0x197129);break;case _0xa4b5('0x70'):if(_0x2e330e[_0xa4b5('0x71')]===_0xa4b5('0x69')){_0x242356[_0x61f97a](_0xa4b5('0x72'),'%'+_0x2e330e[_0xa4b5('0x64')]+'%',null);}else{_0x2c74d6=_[_0xa4b5('0x62')](_0x1f862d,['name','UserId']);_0x2e330e[_0xa4b5('0x4e')]=_0xa4b5('0x3a');_0x1fd4c5=as['buildExpression'](_0x4566bf,_0x2c74d6['type'],_0x2e330e);_0x242356[_0x61f97a](_0x1fd4c5[_0xa4b5('0x73')],_0x1fd4c5[_0xa4b5('0x64')][_0xa4b5('0x74')],_0x1fd4c5[_0xa4b5('0x64')][_0xa4b5('0x20')]);}break;case _0xa4b5('0x75'):_0x1fd4c5=as[_0xa4b5('0x6c')]('me',null,_0x2e330e);_0x242356[_0x61f97a](_0x1fd4c5[_0xa4b5('0x73')],_0x1fd4c5['value'][_0xa4b5('0x74')],_0x1fd4c5[_0xa4b5('0x64')][_0xa4b5('0x20')]);break;}}else{var _0x1fd4c5=as[_0xa4b5('0x6c')](_0x4566bf,_0x2c74d6[_0xa4b5('0x3f')],_0x2e330e);_0x242356[_0x61f97a](_0x1fd4c5['text'],_0x1fd4c5[_0xa4b5('0x64')][_0xa4b5('0x74')],_0x1fd4c5['value']['end']);}}}else{var _0x3928fb=_(_0x36aaea[_0xa4b5('0x42')])[_0xa4b5('0x43')]()[_0xa4b5('0x2e')](function(_0x2fe5dd){return _[_0xa4b5('0x76')](_0x1f862d,[_0xa4b5('0x2b'),_0x2fe5dd])?_0x2fe5dd:undefined;})[_0xa4b5('0x77')]()[_0xa4b5('0x64')]();if(!_[_0xa4b5('0x78')](_0x3928fb)){_0x3928fb['forEach'](function(_0x407680){if(_0x407680===_0xa4b5('0x79')){_0x314ad8[_0xa4b5('0x7a')](_0xa4b5('0x7b'),[]['concat'](_0x36aaea[_0xa4b5('0x42')][_0x407680]));}else if(_0x407680===_0xa4b5('0x7c')){var _0x5b28c9=JSON[_0xa4b5('0x7d')](_0x36aaea['query'][_0x407680])[_0xa4b5('0x7e')];var _0x229aed=JSON['parse'](_0x36aaea['query'][_0x407680])[_0xa4b5('0x7f')];_0x314ad8[_0xa4b5('0x7a')](_0xa4b5('0x80'),_0x5b28c9,_0x229aed);}else{if(_0x36aaea[_0xa4b5('0x42')][_0x407680]===_0xa4b5('0x81')){_0x314ad8[_0xa4b5('0x7a')]('i.'+_0x407680+_0xa4b5('0x82'));}else{_0x314ad8[_0xa4b5('0x7a')]('i.'+_0x407680+'\x20=\x20?',_0x36aaea[_0xa4b5('0x42')][_0x407680]);}}});}if(_0x36aaea[_0xa4b5('0x42')][_0xa4b5('0x83')]){if(_0x36aaea['query'][_0xa4b5('0x83')]==0x1){_0x314ad8['having'](_0xa4b5('0x84'));}else{_0x314ad8[_0xa4b5('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x36aaea[_0xa4b5('0x42')]['tag']){_0x242575=_[_0xa4b5('0x85')](_0x36aaea['query'][_0xa4b5('0x86')])?_0x36aaea[_0xa4b5('0x42')][_0xa4b5('0x86')]:new Array(_0x36aaea['query'][_0xa4b5('0x86')]);_0x242575[_0xa4b5('0x87')](function(_0x1d5225){_0x3b96f2['or'](_0xa4b5('0x6e'),'%,'+_0x1d5225+',%');});}if(_0x36aaea[_0xa4b5('0x42')][_0xa4b5('0x88')]){var _0x1d5426=_0x36aaea[_0xa4b5('0x42')][_0xa4b5('0x88')][_0xa4b5('0x89')]('\x5c','\x5c\x5c')[_0xa4b5('0x89')](/'/g,'\x27\x27');if(qs[_0xa4b5('0x8a')](_0x1d5426)){_0x242356['or'](_0xa4b5('0x8b'),_0x1d5426+'%');}else{_0x242356['or'](_0xa4b5('0x8c'),qs[_0xa4b5('0x6a')](_0x1d5426))['or'](_0xa4b5('0x8d'),_0x1d5426+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1d5426+'%');}}}_0x314ad8[_0xa4b5('0x7a')](_0x242356);_0x314ad8[_0xa4b5('0x8e')]('i.id');var _0x131954={'type':db[_0xa4b5('0x8f')]['QueryTypes'][_0xa4b5('0x90')],'raw':!![]};var _0x6b12bb=_0x314ad8[_0xa4b5('0x91')]();_0x6b12bb[_0xa4b5('0x4e')](_0xa4b5('0x92'));_0x6b12bb['field'](_0xa4b5('0x93'),_0xa4b5('0x63'));if(_0xb2af81[_0xa4b5('0x4b')]){_0xb2af81[_0xa4b5('0x4b')][_0xa4b5('0x87')](function(_0x23b760){var _0x3ae106=_0x23b760[0x0]===_0xa4b5('0x94')?_0x23b760[0x0]:'i.'+_0x23b760[0x0];_0x314ad8[_0xa4b5('0x4b')](_0x3ae106,_0x23b760[0x1]===_0xa4b5('0x95')?![]:!![]);});}if(!_[_0xa4b5('0x78')](_0x242575)){_0x314ad8['having'](_0x3b96f2);_0x6b12bb['where']('t.id\x20IN\x20?',_0x242575);}BPromise[_0xa4b5('0x96')]()['then'](function(){if(!_0x13337a){if(_0x36aaea[_0xa4b5('0x42')]['OpenchannelAccountId'])return;_0x6b12bb[_0xa4b5('0x7a')](_0xa4b5('0x97'));_0x314ad8[_0xa4b5('0x7a')](_0xa4b5('0x97'));return;}if(_0x36aaea[_0xa4b5('0x98')][_0xa4b5('0x99')]!==_0xa4b5('0x9a'))return;return _0x36aaea[_0xa4b5('0x98')][_0xa4b5('0x9b')]({'attributes':['id'],'raw':!![]})[_0xa4b5('0x28')](function(_0x5c6975){if(_[_0xa4b5('0x78')](_0x5c6975)){_0x6b12bb[_0xa4b5('0x7a')](_0xa4b5('0x9c'));_0x314ad8[_0xa4b5('0x7a')](_0xa4b5('0x9c'));}else{_0x6b12bb[_0xa4b5('0x7a')](_0xa4b5('0x7b'),_[_0xa4b5('0x2e')](_0x5c6975,'id'));_0x314ad8[_0xa4b5('0x7a')](_0xa4b5('0x7b'),_[_0xa4b5('0x2e')](_0x5c6975,'id'));}});})[_0xa4b5('0x28')](function(){if(_0x36aaea[_0xa4b5('0x98')][_0xa4b5('0x99')]==='agent'&&!_0x13337a&&!_0x36aaea[_0xa4b5('0x42')][_0xa4b5('0x79')])return[];return db['sequelize'][_0xa4b5('0x42')](_0x6b12bb[_0xa4b5('0x9d')](),_0x131954);})[_0xa4b5('0x28')](function(_0x3294f6){_0x18a837['count']=_0x3294f6[_0xa4b5('0x48')];if(_0x18a837[_0xa4b5('0x9e')]===0x0)return[];return db[_0xa4b5('0x9f')][_0xa4b5('0x42')](_0x5a150a[_0xa4b5('0x9d')](),_0x131954)[_0xa4b5('0x28')](function(_0x600f97){_0x2fd4a8=_['keyBy'](_0x600f97,'id');_0x131954=_[_0xa4b5('0xa0')](_0x131954,{'model':db[_0xa4b5('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x36aaea[_0xa4b5('0x42')][_0xa4b5('0x47')]){_0xb2af81['attributes'][_0xa4b5('0x87')](function(_0x4b344b){_0x314ad8[_0xa4b5('0x4e')]('i.'+_0x4b344b);});}else{_0x314ad8[_0xa4b5('0x4e')](_0xa4b5('0x93'),_0xa4b5('0x63'));_0x314ad8[_0xa4b5('0x4e')](_0xa4b5('0xa1'),_0xa4b5('0xa2'));_0x314ad8[_0xa4b5('0x4e')](_0xa4b5('0xa3'),_0xa4b5('0xa4'));_0x314ad8[_0xa4b5('0x4e')](_0xa4b5('0xa5'),_0xa4b5('0x94'));_0x314ad8['field'](_0xa4b5('0xa6'));_0x314ad8[_0xa4b5('0x4e')]('c.firstName',_0xa4b5('0xa7'));_0x314ad8['field'](_0xa4b5('0xa8'),_0xa4b5('0xa9'));_0x314ad8[_0xa4b5('0x4e')](_0xa4b5('0xaa'),_0xa4b5('0xab'));_0x314ad8[_0xa4b5('0x4e')]('c.phone',_0xa4b5('0xac'));_0x314ad8[_0xa4b5('0x4e')](_0xa4b5('0xad'),_0xa4b5('0xae'));_0x314ad8[_0xa4b5('0x4e')]('c.fax',_0xa4b5('0xaf'));_0x314ad8[_0xa4b5('0x4e')]('o.fullname',_0xa4b5('0xb0'));_0x314ad8[_0xa4b5('0x4e')](_0xa4b5('0xb1'),_0xa4b5('0xb2'));_0x314ad8[_0xa4b5('0x4e')](_0xa4b5('0xb3'),_0xa4b5('0x30'));}if(_0xb2af81['limit'])_0x314ad8['limit'](_0xb2af81[_0xa4b5('0x23')]);if(_0xb2af81[_0xa4b5('0x21')])_0x314ad8[_0xa4b5('0x21')](_0xb2af81[_0xa4b5('0x21')]);return db['sequelize']['query'](_0x314ad8[_0xa4b5('0x9d')](),_0x131954);})[_0xa4b5('0x28')](function(_0x3dbfad){if(_0x3dbfad[_0xa4b5('0x48')]>0x0)_0x228a43[_0xa4b5('0x7a')](_0xa4b5('0xb4'),_[_0xa4b5('0x2e')](_0x3dbfad,'id'));return db[_0xa4b5('0x9f')][_0xa4b5('0x42')](_0x228a43[_0xa4b5('0x9d')](),_0x131954)[_0xa4b5('0x28')](function(_0x4d3212){var _0x51d39e=_[_0xa4b5('0xb5')](_0x4d3212,_0xa4b5('0xb6'));var _0x129aa8=[];_0x3dbfad['forEach'](function(_0x2709ab){_0x129aa8[_0xa4b5('0x33')](updateOpenchannelInteraction(_0x2709ab,_0x2fd4a8,_0x51d39e));});return BPromise[_0xa4b5('0xb7')](_0x129aa8);});});})[_0xa4b5('0x28')](function(_0x58a375){_0x18a837[_0xa4b5('0xb8')]=_0x58a375;return _0x18a837;})[_0xa4b5('0x28')](respondWithFilteredResult(_0x223b5e,_0xb2af81))[_0xa4b5('0x34')](handleError(_0x223b5e,null));};exports['show']=function(_0x13fd31,_0x23d039){var _0x50606b={};if(_0x13fd31[_0xa4b5('0x42')][_0xa4b5('0x3f')]&&_0x13fd31[_0xa4b5('0x42')][_0xa4b5('0x3f')]===_0xa4b5('0x50')){_0x50606b['from']=_0x13fd31[_0xa4b5('0xb9')]['id'];}else{_0x50606b['id']=_0x13fd31[_0xa4b5('0xb9')]['id'];}var _0x57bf2c={'raw':![],'where':_0x50606b},_0x325678={};_0x325678[_0xa4b5('0x41')]=_['keys'](db[_0xa4b5('0x3d')]['rawAttributes']);_0x325678[_0xa4b5('0x42')]=_['keys'](_0x13fd31['query']);_0x325678[_0xa4b5('0x44')]=_['intersection'](_0x325678[_0xa4b5('0x41')],_0x325678['query']);_0x57bf2c[_0xa4b5('0x45')]=_[_0xa4b5('0x46')](_0x325678[_0xa4b5('0x41')],qs['fields'](_0x13fd31['query'][_0xa4b5('0x47')]));_0x57bf2c[_0xa4b5('0x45')]=_0x57bf2c[_0xa4b5('0x45')][_0xa4b5('0x48')]?_0x57bf2c[_0xa4b5('0x45')]:_0x325678[_0xa4b5('0x41')];if(_0x13fd31[_0xa4b5('0x42')]['includeAll']){_0x57bf2c[_0xa4b5('0xba')]=[{'all':!![]}];}_0x57bf2c=_[_0xa4b5('0xa0')]({},_0x57bf2c,_0x13fd31['options']);return db[_0xa4b5('0x3d')][_0xa4b5('0x62')](_0x57bf2c)[_0xa4b5('0x28')](handleEntityNotFound(_0x23d039,null))[_0xa4b5('0x28')](respondWithResult(_0x23d039,null))[_0xa4b5('0x34')](handleError(_0x23d039,null));};exports[_0xa4b5('0xbb')]=function(_0x1d1113,_0x3db76d){return db[_0xa4b5('0x3d')][_0xa4b5('0xbb')](_0x1d1113[_0xa4b5('0x75')],{})[_0xa4b5('0x28')](respondWithResult(_0x3db76d,0xc9))[_0xa4b5('0x34')](handleError(_0x3db76d,null));};exports[_0xa4b5('0xbc')]=function(_0x562471,_0x4c8369){if(_0x562471[_0xa4b5('0x75')]['id']){delete _0x562471[_0xa4b5('0x75')]['id'];}return db[_0xa4b5('0x3d')]['find']({'where':{'id':_0x562471[_0xa4b5('0xb9')]['id']}})['then'](handleEntityNotFound(_0x4c8369,null))['then'](saveUpdates(_0x562471[_0xa4b5('0x75')],null))[_0xa4b5('0x28')](respondWithResult(_0x4c8369,null))['catch'](handleError(_0x4c8369,null));};exports[_0xa4b5('0xbd')]=function(_0x1a736c,_0x5796ac){return db['OpenchannelInteraction'][_0xa4b5('0x62')]({'where':{'id':_0x1a736c[_0xa4b5('0xb9')]['id']}})[_0xa4b5('0x28')](handleEntityNotFound(_0x5796ac,null))[_0xa4b5('0x28')](removeEntity(_0x5796ac,null))[_0xa4b5('0x34')](handleError(_0x5796ac,null));};exports['describe']=function(_0x421fee,_0x483be8){return db[_0xa4b5('0x3d')]['describe']()[_0xa4b5('0x28')](respondWithResult(_0x483be8,null))[_0xa4b5('0x34')](handleError(_0x483be8,null));};exports[_0xa4b5('0xbe')]=function(_0x2ee918,_0x4969c8,_0x3b9ce1){return db[_0xa4b5('0xbf')]['find']({'where':{'id':_0x2ee918[_0xa4b5('0xb9')]['id']}})['then'](handleEntityNotFound(_0x4969c8,null))['then'](function(_0x12687a){if(_0x12687a){return _0x12687a[_0xa4b5('0xbe')](_0x2ee918['body'][_0xa4b5('0xc0')],_[_0xa4b5('0xc1')](_0x2ee918['body'],['ids','id'])||{});}})[_0xa4b5('0x28')](respondWithResult(_0x4969c8,null))[_0xa4b5('0x34')](handleError(_0x4969c8,null));};exports[_0xa4b5('0xc2')]=function(_0x1775f9,_0x55125c,_0x3f8782){var _0x176a54={'raw':![],'where':{}};var _0x420651={};var _0x317659={'count':0x0,'rows':[]};return db[_0xa4b5('0x3d')][_0xa4b5('0xc3')]({'where':{'id':_0x1775f9[_0xa4b5('0xb9')]['id']}})[_0xa4b5('0x28')](handleEntityNotFound(_0x55125c,null))[_0xa4b5('0x28')](function(_0x12b6f7){if(_0x12b6f7){_0x420651[_0xa4b5('0x41')]=_[_0xa4b5('0x43')](db[_0xa4b5('0xbf')][_0xa4b5('0x3e')]);_0x420651['query']=_[_0xa4b5('0x43')](_0x1775f9['query']);_0x420651[_0xa4b5('0x44')]=_[_0xa4b5('0x46')](_0x420651[_0xa4b5('0x41')],_0x420651[_0xa4b5('0x42')]);_0x176a54[_0xa4b5('0x45')]=_['intersection'](_0x420651['model'],qs[_0xa4b5('0x47')](_0x1775f9[_0xa4b5('0x42')]['fields']));_0x176a54[_0xa4b5('0x45')]=_0x176a54['attributes'][_0xa4b5('0x48')]?_0x176a54[_0xa4b5('0x45')]:_0x420651[_0xa4b5('0x41')];if(!_0x1775f9[_0xa4b5('0x42')][_0xa4b5('0x49')](_0xa4b5('0x4a'))){_0x176a54['limit']=qs['limit'](_0x1775f9['query'][_0xa4b5('0x23')]);_0x176a54[_0xa4b5('0x21')]=qs['offset'](_0x1775f9['query'][_0xa4b5('0x21')]);}_0x176a54[_0xa4b5('0x4b')]=qs[_0xa4b5('0x4c')](_0x1775f9[_0xa4b5('0x42')][_0xa4b5('0x4c')]);_0x176a54[_0xa4b5('0x7a')]=qs['filters'](_['pick'](_0x1775f9[_0xa4b5('0x42')],_0x420651[_0xa4b5('0x44')]));_0x176a54[_0xa4b5('0x7a')][_0xa4b5('0xb6')]=_0x12b6f7['id'];if(_0x1775f9[_0xa4b5('0x42')][_0xa4b5('0x88')]){_0x176a54[_0xa4b5('0x7a')]=_[_0xa4b5('0xa0')](_0x176a54[_0xa4b5('0x7a')],{'$or':_[_0xa4b5('0x2e')](_0x176a54[_0xa4b5('0x45')],function(_0x3ab72d){var _0x515e5a={};_0x515e5a[_0x3ab72d]={'$like':'%'+_0x1775f9[_0xa4b5('0x42')][_0xa4b5('0x88')]+'%'};return _0x515e5a;})});}if(_0x1775f9[_0xa4b5('0x42')]['$gte']){var _0x20f8aa=_0x1775f9[_0xa4b5('0x42')][_0xa4b5('0x7e')][_0xa4b5('0x32')](',');var _0x514c9f={};_0x514c9f[_0x20f8aa[0x0]]={'$gte':moment(_0x20f8aa[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x176a54[_0xa4b5('0x7a')]=_[_0xa4b5('0xa0')](_0x176a54[_0xa4b5('0x7a')],_0x514c9f);}_0x176a54=_[_0xa4b5('0xa0')]({},_0x176a54,_0x1775f9[_0xa4b5('0xc4')]);return db[_0xa4b5('0xbf')][_0xa4b5('0x9e')]({'where':_0x176a54[_0xa4b5('0x7a')]})['then'](function(_0x4549fe){_0x317659[_0xa4b5('0x9e')]=_0x4549fe;if(_0x1775f9[_0xa4b5('0x42')][_0xa4b5('0xc5')]){_0x176a54[_0xa4b5('0xba')]=[{'all':!![]}];}return db[_0xa4b5('0xbf')][_0xa4b5('0xc6')](_0x176a54);})[_0xa4b5('0x28')](function(_0x9936bb){_0x317659[_0xa4b5('0xb8')]=_0x9936bb;return _0x317659;});}})[_0xa4b5('0x28')](respondWithFilteredResult(_0x55125c,_0x176a54))[_0xa4b5('0x34')](handleError(_0x55125c,null));};exports[_0xa4b5('0xc7')]=function(_0x18286b,_0x29ba34,_0x378a49){return db['OpenchannelInteraction']['find']({'where':{'id':_0x18286b[_0xa4b5('0xb9')]['id']}})[_0xa4b5('0x28')](handleEntityNotFound(_0x29ba34,null))[_0xa4b5('0x28')](function(_0x2961e4){if(_0x2961e4){return _0x2961e4[_0xa4b5('0xc8')](_0x18286b['body'][_0xa4b5('0xc0')],_[_0xa4b5('0xc1')](_0x18286b[_0xa4b5('0x75')],['ids','id'])||{})[_0xa4b5('0xc9')](function(){return db[_0xa4b5('0x6d')][_0xa4b5('0xc6')]({'attributes':['id',_0xa4b5('0x2b'),_0xa4b5('0x4f')],'where':{'id':_0x18286b[_0xa4b5('0x75')][_0xa4b5('0xc0')]}});})[_0xa4b5('0x28')](function(_0x3000e5){socket[_0xa4b5('0xca')]('openchannelInteractionTags:save',{'id':Number(_0x18286b[_0xa4b5('0xb9')]['id']),'tags':_0x3000e5||[]});return{'id':Number(_0x18286b[_0xa4b5('0xb9')]['id']),'tags':_0x3000e5||[]};});}})['then'](respondWithResult(_0x29ba34,null))[_0xa4b5('0x34')](handleError(_0x29ba34,null));};exports[_0xa4b5('0xcb')]=function(_0x5ebb0c,_0x4c6966,_0x4eb843){return db[_0xa4b5('0x3d')][_0xa4b5('0x62')]({'where':{'id':_0x5ebb0c['params']['id']}})[_0xa4b5('0x28')](handleEntityNotFound(_0x4c6966,null))[_0xa4b5('0x28')](function(_0x23e980){if(_0x23e980){return _0x23e980[_0xa4b5('0xcb')](_0x5ebb0c[_0xa4b5('0x42')][_0xa4b5('0xc0')]);}})[_0xa4b5('0x28')](respondWithStatusCode(_0x4c6966,null))['catch'](handleError(_0x4c6966,null));};exports[_0xa4b5('0xcc')]=function(_0x4323f7,_0xd0a70b){var _0x553f89=moment()[_0xa4b5('0xcd')]()['toString']();var _0x4a119d=path[_0xa4b5('0xce')](config[_0xa4b5('0xcf')],_0xa4b5('0xd0'),_0xa4b5('0xd1'),_0xa4b5('0xd2'));var _0x2c1f21=path[_0xa4b5('0xce')](config[_0xa4b5('0xcf')],_0xa4b5('0xd0'),_0xa4b5('0xd1'),_0xa4b5('0xd3'));var _0xde440f=path[_0xa4b5('0xce')](_0x4a119d,_0x553f89);var _0x135d26=util[_0xa4b5('0xd4')](_0xa4b5('0xd5'),_0x4323f7[_0xa4b5('0xb9')]['id'],_0x553f89);var _0x20e9d5=path[_0xa4b5('0xce')](_0x4a119d,_0x135d26);var _0xfc42bd=[];_0xfc42bd[_0xa4b5('0x33')]({'model':db['User'],'as':_0xa4b5('0x70'),'attributes':['id',_0xa4b5('0x2f')],'raw':!![]});_0xfc42bd[_0xa4b5('0x33')]({'model':db[_0xa4b5('0xd6')],'as':_0xa4b5('0x68'),'attributes':['id',_0xa4b5('0xd7'),_0xa4b5('0xd8')],'raw':!![]});if(_0x4323f7[_0xa4b5('0x42')][_0xa4b5('0xd3')]){_0xfc42bd[_0xa4b5('0x33')]({'model':db[_0xa4b5('0xd9')],'as':'Attachment','raw':!![]});}var _0x4ea37c=[{'model':db['OpenchannelMessage'],'as':_0xa4b5('0xda'),'attributes':['id',_0xa4b5('0x75'),'createdAt',_0xa4b5('0xdb'),_0xa4b5('0xdc'),_0xa4b5('0x83')],'include':_0xfc42bd}];_0x4ea37c[_0xa4b5('0x33')]({'model':db[_0xa4b5('0xdd')],'as':_0xa4b5('0xde'),'attributes':['id','name']});_0x4ea37c[_0xa4b5('0x33')]({'model':db[_0xa4b5('0x70')],'as':_0xa4b5('0xdf'),'attributes':['id','fullname']});return db[_0xa4b5('0x3d')][_0xa4b5('0x62')]({'where':{'id':_0x4323f7[_0xa4b5('0xb9')]['id']},'include':_0x4ea37c})[_0xa4b5('0x28')](handleEntityNotFound(_0xd0a70b,null))[_0xa4b5('0x28')](function(_0x5739cf){if(_0x5739cf){var _0x11a777=_0x5739cf[_0xa4b5('0xe0')]({'plain':!![]});fs[_0xa4b5('0xe1')](_0xde440f);var _0x33b06d={'channel':_0xa4b5('0xe2'),'account':_0x11a777[_0xa4b5('0xde')][_0xa4b5('0x2b')],'agent':_0x11a777['Owner']?_0x11a777[_0xa4b5('0xdf')]['fullname']:_0xa4b5('0xe3'),'createdAt':moment(_0x11a777['createdAt'])[_0xa4b5('0xd4')](_0xa4b5('0xe4'))[_0xa4b5('0x9d')](),'closedAt':_0x11a777[_0xa4b5('0x39')]?moment(_0x11a777[_0xa4b5('0xe5')])[_0xa4b5('0xd4')](_0xa4b5('0xe4'))[_0xa4b5('0x9d')]():'','disposition':_0x11a777[_0xa4b5('0xe6')],'visibility':_0x11a777[_0xa4b5('0xe7')]?_0xa4b5('0xe8'):_0xa4b5('0xe9'),'messages':_(_0x11a777[_0xa4b5('0xda')])[_0xa4b5('0x88')]({'secret':![]})[_0xa4b5('0x2e')](function(_0x1aa697){if(_0x1aa697[_0xa4b5('0xd9')]){var _0x39eeba=path['join'](_0x2c1f21,_0x1aa697['Attachment'][_0xa4b5('0xea')]);if(fs[_0xa4b5('0xeb')](_0x39eeba)){fs[_0xa4b5('0xec')](_0x39eeba)['pipe'](fs[_0xa4b5('0xed')](path['join'](_0xde440f,_0x1aa697[_0xa4b5('0xd9')][_0xa4b5('0xea')])));}}return{'date':moment(_0x1aa697[_0xa4b5('0x7c')])['format'](_0xa4b5('0xe4'))['toString'](),'sender':_0x1aa697['direction']===_0xa4b5('0xee')?_0x1aa697[_0xa4b5('0x70')]?_0x1aa697['User'][_0xa4b5('0x2f')]:'System':_0x1aa697[_0xa4b5('0x68')][_0xa4b5('0xd7')]+(_0x1aa697['Contact'][_0xa4b5('0xd8')]?'\x20'+_0x1aa697['Contact'][_0xa4b5('0xd8')]:''),'body':_0x1aa697[_0xa4b5('0xd9')]?_0x1aa697[_0xa4b5('0xd9')][_0xa4b5('0xea')]:_0x1aa697[_0xa4b5('0x75')],'direction':_0x1aa697[_0xa4b5('0xdb')]===_0xa4b5('0xee')?'A':'C','secret':_0x1aa697[_0xa4b5('0xdc')],'read':_0x1aa697[_0xa4b5('0x83')],'attachment':_0x1aa697['Attachment']};})[_0xa4b5('0x64')]()};return ejs[_0xa4b5('0xef')](path[_0xa4b5('0xce')](config[_0xa4b5('0xcf')],'server',_0xa4b5('0xf0'),_0xa4b5('0xf1')),{'interaction':_0x33b06d})[_0xa4b5('0x28')](function(_0xa2257e){var _0x7c75a=path['join'](_0xde440f,_0xa4b5('0xf2')+_0x11a777['id']+'-'+_0x553f89+_0xa4b5('0xf3'));var _0x518580={'path':_0x7c75a,'channel':_0xa4b5('0xe2'),'interactionId':_0x11a777['id']};return pdf[_0xa4b5('0xf4')](_0xa2257e,_0x518580);})[_0xa4b5('0x28')](function(){return new BPromise(function(_0x405d83,_0x103b91){zipdir(_0xde440f,{'saveTo':_0x20e9d5},function(_0x528993,_0x267787){if(_0x528993)return _0x103b91(_0x528993);return _0x405d83(_0x267787);});})[_0xa4b5('0x28')](function(){return new BPromise(function(_0x311df9,_0xca7663){rimraf(_0xde440f,function(_0x3a7e2b){if(_0x3a7e2b)_0xca7663(_0x3a7e2b);return _0x311df9();});});})[_0xa4b5('0x28')](function(){return _0xd0a70b[_0xa4b5('0xcc')](_0x20e9d5,_0x135d26,function(_0x184b33){if(_0x184b33){console[_0xa4b5('0xf5')]('err',_0x184b33);}else{fs[_0xa4b5('0xf6')](_0x20e9d5);}});});});}else{return _0xd0a70b[_0xa4b5('0x1e')](0xc8);}})[_0xa4b5('0x34')](handleError(_0xd0a70b,null));};
\ No newline at end of file
index fd37713..83928b8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9261=['emit','catch','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x2d42d4,_0x536806){var _0x33c8db=function(_0x1c6a41){while(--_0x1c6a41){_0x2d42d4['push'](_0x2d42d4['shift']());}};_0x33c8db(++_0x536806);}(_0x9261,0x134));var _0x1926=function(_0x5d0207,_0x4000c4){_0x5d0207=_0x5d0207-0x0;var _0xf3e249=_0x9261[_0x5d0207];return _0xf3e249;};'use strict';var EventEmitter=require(_0x1926('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x1926('0x1')];var OpenchannelMessage=require(_0x1926('0x2'))['db'][_0x1926('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x1926('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1926('0x5'),'afterDestroy':_0x1926('0x6')};function emitEvent(_0x41183a){return function(_0x3175e6,_0x3794b0,_0x20cbbb){_0x3175e6[_0x1926('0x7')]({'attributes':['id'],'raw':!![]})[_0x1926('0x8')](function(_0x56cca6){_0x3175e6[_0x1926('0x9')](_0x1926('0xa'),_0x56cca6[_0x1926('0xb')](function(_0x4f5718){return{'id':_0x4f5718['id']};}));return OpenchannelMessage[_0x1926('0xc')]({'where':{'OpenchannelInteractionId':_0x3175e6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1926('0x8')](function(_0x1c84dd){_0x3175e6['setDataValue'](_0x1926('0xd'),_0x1c84dd[_0x1926('0xe')]);OpenchannelInteractionEvents[_0x1926('0xf')](_0x41183a+':'+_0x3175e6['id'],_0x3175e6);OpenchannelInteractionEvents['emit'](_0x41183a,_0x3175e6);_0x20cbbb(null);})[_0x1926('0x10')](_0x20cbbb(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x1926('0x11')](e,emitEvent(event));}}module[_0x1926('0x12')]=OpenchannelInteractionEvents;
\ No newline at end of file
+var _0x8b68=['hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','save','update','getUsers','then','setDataValue','Users','map','length','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b68,0x102));var _0x88b6=function(_0xa81a03,_0xca4390){_0xa81a03=_0xa81a03-0x0;var _0x4b8788=_0x8b68[_0xa81a03];return _0x4b8788;};'use strict';var EventEmitter=require(_0x88b6('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x88b6('0x1')];var OpenchannelMessage=require(_0x88b6('0x2'))['db'][_0x88b6('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x88b6('0x4'),'afterUpdate':_0x88b6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x89ace1){return function(_0x3b192d,_0x3d5251,_0xdc0012){_0x3b192d[_0x88b6('0x6')]({'attributes':['id'],'raw':!![]})[_0x88b6('0x7')](function(_0x322c67){_0x3b192d[_0x88b6('0x8')](_0x88b6('0x9'),_0x322c67[_0x88b6('0xa')](function(_0x2d61aa){return{'id':_0x2d61aa['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x3b192d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x88b6('0x7')](function(_0x28bbb1){_0x3b192d[_0x88b6('0x8')]('unreadMessages',_0x28bbb1[_0x88b6('0xb')]);OpenchannelInteractionEvents[_0x88b6('0xc')](_0x89ace1+':'+_0x3b192d['id'],_0x3b192d);OpenchannelInteractionEvents['emit'](_0x89ace1,_0x3b192d);_0xdc0012(null);})['catch'](_0xdc0012(null));};}for(var e in events){if(events[_0x88b6('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x88b6('0xe')](e,emitEvent(event));}}module[_0x88b6('0xf')]=OpenchannelInteractionEvents;
\ No newline at end of file
index 2dd3b95..23b53bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5bf4=['request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird'];(function(_0x38fede,_0x1da1ef){var _0x54f650=function(_0x264e03){while(--_0x264e03){_0x38fede['push'](_0x38fede['shift']());}};_0x54f650(++_0x1da1ef);}(_0x5bf4,0x6c));var _0x45bf=function(_0x51832d,_0xf53ce3){_0x51832d=_0x51832d-0x0;var _0x5ca17f=_0x5bf4[_0x51832d];return _0x5ca17f;};'use strict';var _=require(_0x45bf('0x0'));var util=require('util');var logger=require(_0x45bf('0x1'))('api');var moment=require(_0x45bf('0x2'));var BPromise=require(_0x45bf('0x3'));var rp=require(_0x45bf('0x4'));var fs=require('fs');var path=require(_0x45bf('0x5'));var rimraf=require(_0x45bf('0x6'));var config=require('../../config/environment');var attributes=require(_0x45bf('0x7'));module[_0x45bf('0x8')]=function(_0x3bb36e,_0x4887ab){return _0x3bb36e[_0x45bf('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x45bf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x45bf('0xb'),'hooks':{'beforeUpdate':function(_0x1fd4a2,_0x5e4e91,_0x45c2a0){if(_0x1fd4a2[_0x45bf('0xc')](_0x45bf('0xd'))){_0x1fd4a2[_0x45bf('0xe')]=moment()['format'](_0x45bf('0xf'));}_0x45c2a0(null,_0x1fd4a2);}}});};
\ No newline at end of file
+var _0xb247=['../../config/environment','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x19c43d,_0x2ebc9a){var _0x25cdc9=function(_0x46ba6c){while(--_0x46ba6c){_0x19c43d['push'](_0x19c43d['shift']());}};_0x25cdc9(++_0x2ebc9a);}(_0xb247,0x98));var _0x7b24=function(_0x4b2a8f,_0x5277ac){_0x4b2a8f=_0x4b2a8f-0x0;var _0x311556=_0xb247[_0x4b2a8f];return _0x311556;};'use strict';var _=require(_0x7b24('0x0'));var util=require(_0x7b24('0x1'));var logger=require(_0x7b24('0x2'))(_0x7b24('0x3'));var moment=require(_0x7b24('0x4'));var BPromise=require(_0x7b24('0x5'));var rp=require(_0x7b24('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b24('0x7'));var config=require(_0x7b24('0x8'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x46ab15,_0x4b5626){return _0x46ab15[_0x7b24('0x9')](_0x7b24('0xa'),attributes,{'tableName':_0x7b24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b24('0xc'),'collate':_0x7b24('0xd'),'hooks':{'beforeUpdate':function(_0x11b62c,_0x33894b,_0x1f2932){if(_0x11b62c['changed'](_0x7b24('0xe'))){_0x11b62c['closedAt']=moment()[_0x7b24('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1f2932(null,_0x11b62c);}}});};
\ No newline at end of file
index e67d450..ebb80e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa7b2=['localhost','socket.io-emitter','./openchannelInteraction.socket','register','info','OpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','where','attributes','then','AddTagsToOpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa7b2,0x69));var _0x2a7b=function(_0x3babca,_0x4a2446){_0x3babca=_0x3babca-0x0;var _0x29ad52=_0xa7b2[_0x3babca];return _0x29ad52;};'use strict';var _=require(_0x2a7b('0x0'));var util=require(_0x2a7b('0x1'));var moment=require('moment');var BPromise=require(_0x2a7b('0x2'));var rs=require(_0x2a7b('0x3'));var fs=require('fs');var Redis=require(_0x2a7b('0x4'));var db=require(_0x2a7b('0x5'))['db'];var utils=require(_0x2a7b('0x6'));var logger=require(_0x2a7b('0x7'))(_0x2a7b('0x8'));var config=require('../../config/environment');var jayson=require(_0x2a7b('0x9'));var client=jayson[_0x2a7b('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x2a7b('0xb')],{'host':_0x2a7b('0xc'),'port':0x18eb});var socket=require(_0x2a7b('0xd'))(new Redis(config[_0x2a7b('0xb')]));require(_0x2a7b('0xe'))[_0x2a7b('0xf')](socket);function respondWithRpcPromise(_0x2c2d4d,_0x487117,_0x59647f){return new BPromise(function(_0x322940,_0x269aed){return client['request'](_0x2c2d4d,_0x59647f)['then'](function(_0x15f014){logger[_0x2a7b('0x10')](_0x2a7b('0x11'),_0x487117,'request\x20sent');logger[_0x2a7b('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x487117,_0x2a7b('0x13'),JSON[_0x2a7b('0x14')](_0x15f014));if(_0x15f014['error']){if(_0x15f014[_0x2a7b('0x15')][_0x2a7b('0x16')]===0x1f4){logger[_0x2a7b('0x15')](_0x2a7b('0x11'),_0x487117,_0x15f014['error'][_0x2a7b('0x17')]);return _0x269aed(_0x15f014[_0x2a7b('0x15')]['message']);}logger['error'](_0x2a7b('0x11'),_0x487117,_0x15f014[_0x2a7b('0x15')]['message']);return _0x322940(_0x15f014[_0x2a7b('0x15')][_0x2a7b('0x17')]);}else{logger[_0x2a7b('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x487117,_0x2a7b('0x13'));_0x322940(_0x15f014[_0x2a7b('0x18')][_0x2a7b('0x17')]);}})[_0x2a7b('0x19')](function(_0x2b3029){logger[_0x2a7b('0x15')](_0x2a7b('0x11'),_0x487117,_0x2b3029);_0x269aed(_0x2b3029);});});}exports[_0x2a7b('0x1a')]=function(_0x2625f3){var _0x136760=this;return new Promise(function(_0x5362e1,_0x491bcf){return db[_0x2a7b('0x1b')]['update'](_0x2625f3[_0x2a7b('0x1c')],{'raw':_0x2625f3[_0x2a7b('0x1d')]?_0x2625f3[_0x2a7b('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2625f3[_0x2a7b('0x1d')]?_0x2625f3['options'][_0x2a7b('0x1e')]||null:null,'attributes':_0x2625f3[_0x2a7b('0x1d')]?_0x2625f3[_0x2a7b('0x1d')][_0x2a7b('0x1f')]||null:null,'limit':_0x2625f3[_0x2a7b('0x1d')]?_0x2625f3[_0x2a7b('0x1d')]['limit']||null:null})[_0x2a7b('0x20')](function(_0x151d74){logger[_0x2a7b('0x10')](_0x2a7b('0x1a'),_0x2625f3);logger[_0x2a7b('0x12')]('UpdateOpenchannelInteraction',_0x2625f3,JSON[_0x2a7b('0x14')](_0x151d74));_0x5362e1(_0x151d74);})[_0x2a7b('0x19')](function(_0x57c0d7){logger[_0x2a7b('0x15')]('UpdateOpenchannelInteraction',_0x57c0d7[_0x2a7b('0x17')],_0x2625f3);_0x491bcf(_0x136760[_0x2a7b('0x15')](0x1f4,_0x57c0d7['message']));});});};exports[_0x2a7b('0x21')]=function(_0x483205){return new Promise(function(_0x351ae5,_0x2c5273){return db[_0x2a7b('0x1b')][_0x2a7b('0x22')]({'where':_0x483205[_0x2a7b('0x1d')]?_0x483205['options'][_0x2a7b('0x1e')]||null:null})[_0x2a7b('0x20')](function(_0x33b08c){if(_0x33b08c){return _0x33b08c[_0x2a7b('0x23')](_0x483205[_0x2a7b('0x1c')][_0x2a7b('0x24')],_['omit'](_0x483205[_0x2a7b('0x1c')],[_0x2a7b('0x24'),'id'])||{});}})[_0x2a7b('0x25')](function(_0x181c11){logger[_0x2a7b('0x10')](_0x2a7b('0x26'),_0x483205);logger[_0x2a7b('0x12')](_0x2a7b('0x26'),_0x483205,JSON[_0x2a7b('0x14')](_0x181c11));_0x351ae5(_0x181c11);})[_0x2a7b('0x19')](function(_0x452a51){logger[_0x2a7b('0x15')](_0x2a7b('0x26'),_0x452a51[_0x2a7b('0x17')],_0x483205);_0x2c5273(_this[_0x2a7b('0x15')](0x1f4,_0x452a51[_0x2a7b('0x17')]));});});};
\ No newline at end of file
+var _0x95b1=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','./openchannelInteraction.socket','register','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','limit','debug','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0x95b1,0x1a7));var _0x195b=function(_0x52fa4c,_0x24e597){_0x52fa4c=_0x52fa4c-0x0;var _0x6cb9c8=_0x95b1[_0x52fa4c];return _0x6cb9c8;};'use strict';var _=require(_0x195b('0x0'));var util=require(_0x195b('0x1'));var moment=require(_0x195b('0x2'));var BPromise=require(_0x195b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x195b('0x4'));var db=require(_0x195b('0x5'))['db'];var utils=require(_0x195b('0x6'));var logger=require(_0x195b('0x7'))('rpc');var config=require(_0x195b('0x8'));var jayson=require(_0x195b('0x9'));var client=jayson[_0x195b('0xa')]['http']({'port':0x232a});config[_0x195b('0xb')]=_[_0x195b('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x195b('0xb')]));require(_0x195b('0xd'))[_0x195b('0xe')](socket);function respondWithRpcPromise(_0x3975e4,_0x403abd,_0x41e6c8){return new BPromise(function(_0x292d26,_0x5f5b85){return client['request'](_0x3975e4,_0x41e6c8)[_0x195b('0xf')](function(_0x2620f7){logger['info'](_0x195b('0x10'),_0x403abd,_0x195b('0x11'));logger['debug'](_0x195b('0x12'),_0x403abd,_0x195b('0x11'),JSON[_0x195b('0x13')](_0x2620f7));if(_0x2620f7['error']){if(_0x2620f7[_0x195b('0x14')][_0x195b('0x15')]===0x1f4){logger[_0x195b('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x403abd,_0x2620f7[_0x195b('0x14')][_0x195b('0x16')]);return _0x5f5b85(_0x2620f7[_0x195b('0x14')][_0x195b('0x16')]);}logger[_0x195b('0x14')](_0x195b('0x10'),_0x403abd,_0x2620f7[_0x195b('0x14')][_0x195b('0x16')]);return _0x292d26(_0x2620f7['error'][_0x195b('0x16')]);}else{logger[_0x195b('0x17')](_0x195b('0x10'),_0x403abd,'request\x20sent');_0x292d26(_0x2620f7['result'][_0x195b('0x16')]);}})[_0x195b('0x18')](function(_0x57cc38){logger[_0x195b('0x14')](_0x195b('0x10'),_0x403abd,_0x57cc38);_0x5f5b85(_0x57cc38);});});}exports[_0x195b('0x19')]=function(_0x244814){var _0x59c18a=this;return new Promise(function(_0x4850b6,_0x5d1f33){return db[_0x195b('0x1a')]['update'](_0x244814[_0x195b('0x1b')],{'raw':_0x244814[_0x195b('0x1c')]?_0x244814['options'][_0x195b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x244814[_0x195b('0x1c')]?_0x244814[_0x195b('0x1c')][_0x195b('0x1e')]||null:null,'attributes':_0x244814[_0x195b('0x1c')]?_0x244814['options'][_0x195b('0x1f')]||null:null,'limit':_0x244814[_0x195b('0x1c')]?_0x244814[_0x195b('0x1c')][_0x195b('0x20')]||null:null})['then'](function(_0x376224){logger['info'](_0x195b('0x19'),_0x244814);logger[_0x195b('0x21')]('UpdateOpenchannelInteraction',_0x244814,JSON[_0x195b('0x13')](_0x376224));_0x4850b6(_0x376224);})[_0x195b('0x18')](function(_0x43cfc6){logger[_0x195b('0x14')](_0x195b('0x19'),_0x43cfc6['message'],_0x244814);_0x5d1f33(_0x59c18a[_0x195b('0x14')](0x1f4,_0x43cfc6[_0x195b('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x33f71e){return new Promise(function(_0x31ea6a,_0x50b416){return db[_0x195b('0x1a')]['find']({'where':_0x33f71e[_0x195b('0x1c')]?_0x33f71e['options'][_0x195b('0x1e')]||null:null})[_0x195b('0xf')](function(_0x9bff8e){if(_0x9bff8e){return _0x9bff8e[_0x195b('0x22')](_0x33f71e[_0x195b('0x1b')][_0x195b('0x23')],_[_0x195b('0x24')](_0x33f71e[_0x195b('0x1b')],[_0x195b('0x23'),'id'])||{});}})[_0x195b('0x25')](function(_0x490fd6){logger['info'](_0x195b('0x26'),_0x33f71e);logger[_0x195b('0x21')](_0x195b('0x26'),_0x33f71e,JSON[_0x195b('0x13')](_0x490fd6));_0x31ea6a(_0x490fd6);})[_0x195b('0x18')](function(_0x1df0c0){logger[_0x195b('0x14')](_0x195b('0x26'),_0x1df0c0['message'],_0x33f71e);_0x50b416(_this[_0x195b('0x14')](0x1f4,_0x1df0c0[_0x195b('0x16')]));});});};
\ No newline at end of file
index 31a5cc7..06d7e7b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa6fe=['./openchannelInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0xb6fbd0,_0x5b9daf){var _0x200618=function(_0x1afc8e){while(--_0x1afc8e){_0xb6fbd0['push'](_0xb6fbd0['shift']());}};_0x200618(++_0x5b9daf);}(_0xa6fe,0x180));var _0xea6f=function(_0x221a3b,_0x26965f){_0x221a3b=_0x221a3b-0x0;var _0x100363=_0xa6fe[_0x221a3b];return _0x100363;};'use strict';var OpenchannelInteractionEvents=require(_0xea6f('0x0'));var events=[_0xea6f('0x1'),_0xea6f('0x2'),_0xea6f('0x3')];function createListener(_0x29a8d0,_0x4f511a){return function(_0x30b986){_0x4f511a[_0xea6f('0x4')](_0x29a8d0,_0x30b986);};}function removeListener(_0xfd9f21,_0x3591b7){return function(){OpenchannelInteractionEvents[_0xea6f('0x5')](_0xfd9f21,_0x3591b7);};}exports[_0xea6f('0x6')]=function(_0x41fd69){for(var _0x45e0a8=0x0,_0x1ea1d7=events[_0xea6f('0x7')];_0x45e0a8<_0x1ea1d7;_0x45e0a8++){var _0x11a5eb=events[_0x45e0a8];var _0x1d6d06=createListener('openchannelInteraction:'+_0x11a5eb,_0x41fd69);OpenchannelInteractionEvents['on'](_0x11a5eb,_0x1d6d06);}};
\ No newline at end of file
+var _0x4201=['remove','update','emit','removeListener','register','length','openchannelInteraction:','save'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0x4201,0x167));var _0x1420=function(_0x1b591b,_0x6d2e2b){_0x1b591b=_0x1b591b-0x0;var _0x3c24f0=_0x4201[_0x1b591b];return _0x3c24f0;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x1420('0x0'),_0x1420('0x1'),_0x1420('0x2')];function createListener(_0x468fea,_0x1d0f80){return function(_0x572244){_0x1d0f80[_0x1420('0x3')](_0x468fea,_0x572244);};}function removeListener(_0x54be74,_0x244b59){return function(){OpenchannelInteractionEvents[_0x1420('0x4')](_0x54be74,_0x244b59);};}exports[_0x1420('0x5')]=function(_0x4d5342){for(var _0x39ce5f=0x0,_0xee4a0c=events[_0x1420('0x6')];_0x39ce5f<_0xee4a0c;_0x39ce5f++){var _0xdd971e=events[_0x39ce5f];var _0x5d8374=createListener(_0x1420('0x7')+_0xdd971e,_0x4d5342);OpenchannelInteractionEvents['on'](_0xdd971e,_0x5d8374);}};
\ No newline at end of file
index 4f56359..c789fb8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x1fe0a0,_0x320365){_0x1fe0a0=_0x1fe0a0-0x0;var _0x5ce56d=_0x70e0[_0x1fe0a0];return _0x5ce56d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router;
\ No newline at end of file
+var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router;
\ No newline at end of file
index 01de1ba..a8d6736 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9ccd=['TEXT','medium','ENUM','out','DATE','STRING','sequelize'];(function(_0x2fe1ac,_0x189e72){var _0x24f481=function(_0x1456fc){while(--_0x1456fc){_0x2fe1ac['push'](_0x2fe1ac['shift']());}};_0x24f481(++_0x189e72);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xd9cc('0x0'));module['exports']={'body':{'type':Sequelize[_0xd9cc('0x1')](_0xd9cc('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd9cc('0x3')]('in','out'),'defaultValue':_0xd9cc('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd9cc('0x5')]},'providerName':{'type':Sequelize[_0xd9cc('0x6')]},'providerResponse':{'type':Sequelize[_0xd9cc('0x1')]}};
\ No newline at end of file
+var _0x6146=['BOOLEAN','ENUM','out','STRING','sequelize','TEXT','medium'];(function(_0x20b035,_0x33e530){var _0x26d5ec=function(_0x34fafa){while(--_0x34fafa){_0x20b035['push'](_0x20b035['shift']());}};_0x26d5ec(++_0x33e530);}(_0x6146,0xba));var _0x6614=function(_0x7718fd,_0x361de3){_0x7718fd=_0x7718fd-0x0;var _0x206bca=_0x6146[_0x7718fd];return _0x206bca;};'use strict';var Sequelize=require(_0x6614('0x0'));module['exports']={'body':{'type':Sequelize[_0x6614('0x1')](_0x6614('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6614('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6614('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6614('0x4')]('in',_0x6614('0x5')),'defaultValue':_0x6614('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x6614('0x6')]},'providerResponse':{'type':Sequelize[_0x6614('0x1')]}};
\ No newline at end of file
index 3e52c6c..2180b7b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x21d6=['[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','interface','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','OpenchannelMessage','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','agent','fullname','internal','manual','SIP/%s','channel','event','EventManager'];(function(_0x47a656,_0x1b104a){var _0x4dc55f=function(_0x23ccb9){while(--_0x23ccb9){_0x47a656['push'](_0x47a656['shift']());}};_0x4dc55f(++_0x1b104a);}(_0x21d6,0x188));var _0x621d=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x21d6[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0x621d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x621d('0x1'));var rp=require(_0x621d('0x2'));var moment=require(_0x621d('0x3'));var BPromise=require(_0x621d('0x4'));var Mustache=require(_0x621d('0x5'));var util=require(_0x621d('0x6'));var path=require(_0x621d('0x7'));var sox=require(_0x621d('0x8'));var csv=require(_0x621d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x621d('0xa'));var _=require(_0x621d('0xb'));var squel=require('squel');var crypto=require(_0x621d('0xc'));var jsforce=require(_0x621d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x621d('0xe'));var Papa=require(_0x621d('0xf'));var Redis=require(_0x621d('0x10'));var authService=require(_0x621d('0x11'));var qs=require(_0x621d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x621d('0x13'));var logger=require(_0x621d('0x14'))(_0x621d('0x15'));var utils=require(_0x621d('0x16'));var config=require(_0x621d('0x17'));var licenseUtil=require(_0x621d('0x18'));var db=require(_0x621d('0x19'))['db'];config['redis']=_['defaults'](config[_0x621d('0x1a')],{'host':_0x621d('0x1b'),'port':0x18eb});var socket=require(_0x621d('0x1c'))(new Redis(config[_0x621d('0x1a')]));require(_0x621d('0x1d'))[_0x621d('0x1e')](socket);var jayson=require(_0x621d('0x1f'));var client=jayson[_0x621d('0x20')][_0x621d('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x42c33,_0x52a04c,_0x294e8a,_0x29f91f){return new BPromise(function(_0x19c44a,_0x469977){var _0x48933e=_0x29f91f||client;return _0x48933e[_0x621d('0x22')](_0x42c33,_0x294e8a)['then'](function(_0x422cec){logger[_0x621d('0x23')](_0x621d('0x24'),_0x52a04c,_0x621d('0x25'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x52a04c,_0x621d('0x25'),JSON[_0x621d('0x26')](_0x422cec));if(_0x422cec['error']){if(_0x422cec['error'][_0x621d('0x27')]===0x1f4){logger[_0x621d('0x28')](_0x621d('0x24'),_0x52a04c,_0x422cec['error']['message']);return _0x469977(_0x422cec[_0x621d('0x28')][_0x621d('0x29')]);}logger[_0x621d('0x28')](_0x621d('0x24'),_0x52a04c,_0x422cec[_0x621d('0x28')][_0x621d('0x29')]);return _0x19c44a(_0x422cec[_0x621d('0x28')]['message']);}else{logger[_0x621d('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x52a04c,_0x621d('0x25'));_0x19c44a(_0x422cec[_0x621d('0x2a')][_0x621d('0x29')]);}})['catch'](function(_0x101e18){logger['error'](_0x621d('0x24'),_0x52a04c,_0x101e18);_0x469977(_0x101e18);});});}function respondWithStatusCode(_0x5108ab,_0x1a52e6){_0x1a52e6=_0x1a52e6||0xcc;return function(_0x15e0d7){if(_0x15e0d7){return _0x5108ab['sendStatus'](_0x1a52e6);}return _0x5108ab[_0x621d('0x2b')](_0x1a52e6)[_0x621d('0x2c')]();};}function respondWithResult(_0x53ffd6,_0x141c6b){_0x141c6b=_0x141c6b||0xc8;return function(_0x359d4f){if(_0x359d4f){return _0x53ffd6['status'](_0x141c6b)['json'](_0x359d4f);}};}function respondWithFilteredResult(_0x415e98,_0x27f18e){return function(_0x3dc37b){if(_0x3dc37b){var _0x39a81c=typeof _0x27f18e['offset']===_0x621d('0x2d')&&typeof _0x27f18e['limit']===_0x621d('0x2d');var _0x3a102a=_0x3dc37b[_0x621d('0x2e')];var _0x29d191=_0x39a81c?0x0:_0x27f18e[_0x621d('0x2f')];var _0x52fa5d=_0x39a81c?_0x3dc37b[_0x621d('0x2e')]:_0x27f18e[_0x621d('0x2f')]+_0x27f18e[_0x621d('0x30')];var _0x29ed1d;if(_0x52fa5d>=_0x3a102a){_0x52fa5d=_0x3a102a;_0x29ed1d=0xc8;}else{_0x29ed1d=0xce;}_0x415e98[_0x621d('0x2b')](_0x29ed1d);return _0x415e98['set'](_0x621d('0x31'),_0x29d191+'-'+_0x52fa5d+'/'+_0x3a102a)[_0x621d('0x32')](_0x3dc37b);}return null;};}function patchUpdates(_0xe45f63){return function(_0x4a7b71){try{jsonpatch[_0x621d('0x33')](_0x4a7b71,_0xe45f63,!![]);}catch(_0x298422){return BPromise[_0x621d('0x34')](_0x298422);}return _0x4a7b71[_0x621d('0x35')]();};}function saveUpdates(_0x4b2f2f,_0x2070fd){return function(_0x78bd1a){if(_0x78bd1a){return _0x78bd1a[_0x621d('0x36')](_0x4b2f2f)[_0x621d('0x37')](function(_0x4aa500){return _0x4aa500;});}return null;};}function removeEntity(_0x1c4f70,_0x42a0e7){return function(_0x4a4723){if(_0x4a4723){return _0x4a4723[_0x621d('0x38')]()[_0x621d('0x37')](function(){_0x1c4f70[_0x621d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26ceb9,_0xcc29eb){return function(_0x22e616){if(!_0x22e616){_0x26ceb9[_0x621d('0x39')](0x194);}return _0x22e616;};}function handleError(_0x23a7a3,_0x3a8ea9){_0x3a8ea9=_0x3a8ea9||0x1f4;return function(_0x3c195c){logger[_0x621d('0x28')](_0x3c195c[_0x621d('0x3a')]);if(_0x3c195c[_0x621d('0x3b')]){delete _0x3c195c[_0x621d('0x3b')];}_0x23a7a3[_0x621d('0x2b')](_0x3a8ea9)[_0x621d('0x3c')](_0x3c195c);};}exports[_0x621d('0x3d')]=function(_0x2d5d10,_0xc3b2b0){var _0x50eadd={},_0xc04056={},_0x40ca31={'count':0x0,'rows':[]};var _0x352332=_[_0x621d('0x3e')](db[_0x621d('0x3f')]['rawAttributes'],function(_0x58083d){return{'name':_0x58083d['fieldName'],'type':_0x58083d['type']['key']};});_0xc04056[_0x621d('0x40')]=_[_0x621d('0x3e')](_0x352332,_0x621d('0x3b'));_0xc04056[_0x621d('0x41')]=_['keys'](_0x2d5d10['query']);_0xc04056[_0x621d('0x42')]=_[_0x621d('0x43')](_0xc04056[_0x621d('0x40')],_0xc04056[_0x621d('0x41')]);_0x50eadd[_0x621d('0x44')]=_[_0x621d('0x43')](_0xc04056[_0x621d('0x40')],qs[_0x621d('0x45')](_0x2d5d10[_0x621d('0x41')][_0x621d('0x45')]));_0x50eadd[_0x621d('0x44')]=_0x50eadd[_0x621d('0x44')][_0x621d('0x46')]?_0x50eadd[_0x621d('0x44')]:_0xc04056['model'];if(!_0x2d5d10['query'][_0x621d('0x47')](_0x621d('0x48'))){_0x50eadd[_0x621d('0x30')]=qs[_0x621d('0x30')](_0x2d5d10[_0x621d('0x41')][_0x621d('0x30')]);_0x50eadd[_0x621d('0x2f')]=qs['offset'](_0x2d5d10[_0x621d('0x41')][_0x621d('0x2f')]);}_0x50eadd[_0x621d('0x49')]=qs[_0x621d('0x4a')](_0x2d5d10[_0x621d('0x41')]['sort']);_0x50eadd[_0x621d('0x4b')]=qs[_0x621d('0x42')](_[_0x621d('0x4c')](_0x2d5d10[_0x621d('0x41')],_0xc04056['filters']),_0x352332);if(_0x2d5d10['query'][_0x621d('0x4d')]){_0x50eadd[_0x621d('0x4b')]=_[_0x621d('0x4e')](_0x50eadd[_0x621d('0x4b')],{'$or':_[_0x621d('0x3e')](_0x352332,function(_0x4c8f5f){if(_0x4c8f5f['type']!==_0x621d('0x4f')){var _0x2327b3={};_0x2327b3[_0x4c8f5f[_0x621d('0x3b')]]={'$like':'%'+_0x2d5d10[_0x621d('0x41')][_0x621d('0x4d')]+'%'};return _0x2327b3;}})});}_0x50eadd=_[_0x621d('0x4e')]({},_0x50eadd,_0x2d5d10[_0x621d('0x50')]);var _0x2823ef={'where':_0x50eadd[_0x621d('0x4b')]};return db[_0x621d('0x3f')][_0x621d('0x2e')](_0x2823ef)[_0x621d('0x37')](function(_0x33c07a){_0x40ca31['count']=_0x33c07a;if(_0x2d5d10[_0x621d('0x41')][_0x621d('0x51')]){_0x50eadd[_0x621d('0x52')]=[{'all':!![]}];}return db[_0x621d('0x3f')]['findAll'](_0x50eadd);})[_0x621d('0x37')](function(_0x2349a3){_0x40ca31[_0x621d('0x53')]=_0x2349a3;return _0x40ca31;})[_0x621d('0x37')](respondWithFilteredResult(_0xc3b2b0,_0x50eadd))[_0x621d('0x54')](handleError(_0xc3b2b0,null));};exports[_0x621d('0x55')]=function(_0x36edbb,_0x2993dc){var _0x5a61a0={'raw':!![],'where':{'id':_0x36edbb[_0x621d('0x56')]['id']}},_0x259021={};_0x259021[_0x621d('0x40')]=_[_0x621d('0x57')](db[_0x621d('0x3f')]['rawAttributes']);_0x259021['query']=_['keys'](_0x36edbb[_0x621d('0x41')]);_0x259021[_0x621d('0x42')]=_[_0x621d('0x43')](_0x259021[_0x621d('0x40')],_0x259021['query']);_0x5a61a0[_0x621d('0x44')]=_['intersection'](_0x259021[_0x621d('0x40')],qs[_0x621d('0x45')](_0x36edbb[_0x621d('0x41')][_0x621d('0x45')]));_0x5a61a0[_0x621d('0x44')]=_0x5a61a0[_0x621d('0x44')][_0x621d('0x46')]?_0x5a61a0[_0x621d('0x44')]:_0x259021[_0x621d('0x40')];if(_0x36edbb[_0x621d('0x41')][_0x621d('0x51')]){_0x5a61a0[_0x621d('0x52')]=[{'all':!![]}];}_0x5a61a0=_['merge']({},_0x5a61a0,_0x36edbb[_0x621d('0x50')]);return db['OpenchannelMessage'][_0x621d('0x58')](_0x5a61a0)['then'](handleEntityNotFound(_0x2993dc,null))[_0x621d('0x37')](respondWithResult(_0x2993dc,null))[_0x621d('0x54')](handleError(_0x2993dc,null));};exports[_0x621d('0x59')]=function(_0x31aa80,_0x4f8602){return db[_0x621d('0x3f')][_0x621d('0x59')](_0x31aa80[_0x621d('0x5a')],{})[_0x621d('0x37')](respondWithResult(_0x4f8602,0xc9))[_0x621d('0x54')](handleError(_0x4f8602,null));};exports[_0x621d('0x36')]=function(_0x46e329,_0x11fef4){if(_0x46e329[_0x621d('0x5a')]['id']){delete _0x46e329[_0x621d('0x5a')]['id'];}return db[_0x621d('0x3f')][_0x621d('0x58')]({'where':{'id':_0x46e329['params']['id']}})[_0x621d('0x37')](handleEntityNotFound(_0x11fef4,null))[_0x621d('0x37')](saveUpdates(_0x46e329[_0x621d('0x5a')],null))[_0x621d('0x37')](respondWithResult(_0x11fef4,null))[_0x621d('0x54')](handleError(_0x11fef4,null));};exports['destroy']=function(_0x4fb9f1,_0x4d8364){return db['OpenchannelMessage']['find']({'where':{'id':_0x4fb9f1[_0x621d('0x56')]['id']}})[_0x621d('0x37')](handleEntityNotFound(_0x4d8364,null))['then'](removeEntity(_0x4d8364,null))[_0x621d('0x54')](handleError(_0x4d8364,null));};exports[_0x621d('0x5b')]=function(_0x525e4c,_0x4f3b43){return db[_0x621d('0x3f')]['describe']()[_0x621d('0x37')](respondWithResult(_0x4f3b43,null))[_0x621d('0x54')](handleError(_0x4f3b43,null));};var interaction_log=require(_0x621d('0x14'))(_0x621d('0x5c'));exports[_0x621d('0x5d')]=function(_0x323fa3,_0x5a0dd3,_0x1bb260){var _0x58e854={'agent':{},'channel':_0x621d('0x5e')};if(_0x323fa3['body']['id']){delete _0x323fa3['body']['id'];}_0x323fa3[_0x621d('0x5a')][_0x621d('0x5f')]=!![];_0x323fa3[_0x621d('0x5a')][_0x621d('0x60')]=moment()['format'](_0x621d('0x61'));_0x323fa3[_0x621d('0x5a')]['UserId']=_0x323fa3[_0x621d('0x5a')][_0x621d('0x62')]||_0x323fa3[_0x621d('0x63')]['id'];_0x58e854['agent']['id']=_0x323fa3[_0x621d('0x5a')][_0x621d('0x62')];return db[_0x621d('0x3f')][_0x621d('0x58')]({'where':{'id':_0x323fa3[_0x621d('0x56')]['id'],'UserId':null}})[_0x621d('0x37')](handleEntityNotFound(_0x5a0dd3,null))[_0x621d('0x37')](saveUpdates(_0x323fa3[_0x621d('0x5a')],null))[_0x621d('0x37')](function(_0x282bca){if(_0x282bca){_0x58e854[_0x621d('0x29')]=_0x282bca[_0x621d('0x64')]({'plain':!![]});return db[_0x621d('0x65')]['find']({'where':{'id':_0x282bca[_0x621d('0x66')]}});}return null;})[_0x621d('0x37')](handleEntityNotFound(_0x5a0dd3,null))[_0x621d('0x37')](function(_0x1761b2){if(_0x1761b2){return _0x1761b2[_0x621d('0x36')]({'UserId':_0x323fa3[_0x621d('0x5a')][_0x621d('0x62')],'read1stAt':_[_0x621d('0x67')](_0x1761b2[_0x621d('0x68')])?moment()[_0x621d('0x69')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x621d('0x37')](function(_0x249206){if(_0x249206){_0x58e854['interaction']=_0x249206['get']({'plain':!![]});interaction_log[_0x621d('0x23')](_0x621d('0x6a'),_0x323fa3[_0x621d('0x63')]['id'],_0x323fa3[_0x621d('0x63')][_0x621d('0x3b')],_0x323fa3['user'][_0x621d('0x6b')],_0x58e854[_0x621d('0x6c')]['id'],_0x323fa3[_0x621d('0x5a')]?JSON[_0x621d('0x26')](_0x323fa3['body']):_0x621d('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x621d('0x6e'),_0x58e854);}return null;})[_0x621d('0x37')](function(_0x374fb6){var _0x3199e2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x374fb6[_0x621d('0x29')][_0x621d('0x6f')];return db[_0x621d('0x70')][_0x621d('0x41')](_0x3199e2,{'type':db['Sequelize'][_0x621d('0x71')][_0x621d('0x72')],'raw':!![]})[_0x621d('0x37')](function(_0x2a9a22){return _0x2a9a22;});})[_0x621d('0x37')](function(_0x2ed5fe){if(_0x2ed5fe){_0x58e854['message'][_0x621d('0x73')]=_0x2ed5fe[0x0];if(!_0x323fa3[_0x621d('0x5a')]['UserId'])return;return db['User'][_0x621d('0x58')]({'where':{'id':_0x323fa3[_0x621d('0x5a')][_0x621d('0x62')],'role':_0x621d('0x74')},'attributes':['id','name',_0x621d('0x75'),'email',_0x621d('0x76')],'raw':!![]});}return null;})[_0x621d('0x37')](function(_0x40b698){if(!_0x40b698)return null;_0x58e854['message'][_0x621d('0x74')]=_0x40b698;return _0x58e854;})['then'](function(_0x4237b2){if(_0x4237b2){if(_0x323fa3[_0x621d('0x5a')][_0x621d('0x77')]){_0x58e854[_0x621d('0x29')]['interface']=util['format'](_0x621d('0x78'),_0x323fa3['user'][_0x621d('0x3b')]);_0x58e854[_0x621d('0x29')][_0x621d('0x79')]=_0x58e854[_0x621d('0x79')];_0x58e854[_0x621d('0x29')]['motionChannel']=_0x58e854[_0x621d('0x79')];_0x58e854[_0x621d('0x29')][_0x621d('0x7a')]=_0x621d('0x5d');return respondWithRpcPromise(_0x621d('0x7b'),'EventManager',{'event':'acceptmessage','message':_0x58e854['message']},client9002)[_0x621d('0x37')](function(){return _0x58e854;});}return _0x58e854;}return null;})[_0x621d('0x37')](respondWithResult(_0x5a0dd3,null))[_0x621d('0x54')](handleError(_0x5a0dd3,null));};var interaction_log=require(_0x621d('0x14'))(_0x621d('0x5c'));exports[_0x621d('0x34')]=function(_0xa43894,_0x577db2,_0xd2625e){var _0x384ab8={'agent':{},'channel':_0x621d('0x5e')};if(_0xa43894[_0x621d('0x5a')]['id']){delete _0xa43894[_0x621d('0x5a')]['id'];}_0xa43894[_0x621d('0x5a')]['UserId']=_0xa43894[_0x621d('0x5a')][_0x621d('0x62')]||_0xa43894[_0x621d('0x63')]['id'];_0x384ab8[_0x621d('0x74')]['id']=_0xa43894[_0x621d('0x5a')][_0x621d('0x62')];return db[_0x621d('0x3f')][_0x621d('0x58')]({'where':{'id':_0xa43894[_0x621d('0x56')]['id'],'UserId':null}})[_0x621d('0x37')](handleEntityNotFound(_0x577db2,null))[_0x621d('0x37')](function(_0x2c346f){if(_0x2c346f){_0x384ab8[_0x621d('0x29')]=_0x2c346f[_0x621d('0x64')]({'plain':!![]});return db['OpenchannelInteraction'][_0x621d('0x58')]({'where':{'id':_0x2c346f[_0x621d('0x66')]}});}return null;})[_0x621d('0x37')](handleEntityNotFound(_0x577db2,null))[_0x621d('0x37')](function(_0x537292){if(_0x537292){_0x384ab8[_0x621d('0x6c')]=_0x537292[_0x621d('0x64')]({'plain':!![]});interaction_log[_0x621d('0x23')](_0x621d('0x7c'),_0xa43894['user']['id'],_0xa43894[_0x621d('0x63')][_0x621d('0x3b')],_0xa43894[_0x621d('0x63')][_0x621d('0x6b')],_0x384ab8[_0x621d('0x6c')]['id'],_0xa43894[_0x621d('0x5a')]?JSON['stringify'](_0xa43894[_0x621d('0x5a')]):_0x621d('0x6d'));return respondWithRpcPromise(_0x621d('0x7d'),'rejectMessage',_0x384ab8);}return null;})['then'](function(_0x29d42a){var _0x28f5b1=_0x621d('0x7e')+_0x29d42a['message'][_0x621d('0x6f')];return db['sequelize'][_0x621d('0x41')](_0x28f5b1,{'type':db['Sequelize'][_0x621d('0x71')][_0x621d('0x72')],'raw':!![]})[_0x621d('0x37')](function(_0x1361fd){return _0x1361fd;});})[_0x621d('0x37')](function(_0x34b68c){if(_0x34b68c){_0x384ab8['message']['contact']=_0x34b68c[0x0];if(!_0xa43894[_0x621d('0x5a')][_0x621d('0x62')])return;return db['User'][_0x621d('0x58')]({'where':{'id':_0xa43894[_0x621d('0x5a')][_0x621d('0x62')],'role':_0x621d('0x74')},'attributes':['id',_0x621d('0x3b'),_0x621d('0x75'),_0x621d('0x7f'),'internal'],'raw':!![]});}return null;})[_0x621d('0x37')](function(_0x1f4349){if(!_0x1f4349)return null;_0x384ab8[_0x621d('0x29')][_0x621d('0x74')]=_0x1f4349;return _0x384ab8;})[_0x621d('0x37')](function(_0x1be3d4){if(_0x1be3d4){_0x1be3d4[_0x621d('0x29')][_0x621d('0x80')]=util[_0x621d('0x69')](_0x621d('0x78'),_0xa43894[_0x621d('0x63')][_0x621d('0x3b')]);_0x1be3d4[_0x621d('0x29')][_0x621d('0x79')]=_0x384ab8['channel'];_0x1be3d4[_0x621d('0x29')]['motionChannel']=_0x384ab8[_0x621d('0x79')];_0x1be3d4['message'][_0x621d('0x7a')]=_0x621d('0x34');respondWithRpcPromise(_0x621d('0x7b'),_0x621d('0x7b'),{'event':'rejectmessage','message':_0x1be3d4['message']},client9002);return _0x384ab8;}return null;})['then'](respondWithResult(_0x577db2,null))[_0x621d('0x54')](handleError(_0x577db2,null));};
\ No newline at end of file
+var _0x67bc=['offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','end','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','update','params','describe','openchannel-interactions','accept','openchannel','readAt','format','UserId','agent','get','OpenchannelInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','user','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','fullname','eml-format','request-promise','moment','bluebird','util','sox','ejs','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','json'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x67bc,0x1d7));var _0xc67b=function(_0x1bb812,_0x23eacc){_0x1bb812=_0x1bb812-0x0;var _0x372adb=_0x67bc[_0x1bb812];return _0x372adb;};'use strict';var emlformat=require(_0xc67b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc67b('0x1'));var moment=require(_0xc67b('0x2'));var BPromise=require(_0xc67b('0x3'));var Mustache=require('mustache');var util=require(_0xc67b('0x4'));var path=require('path');var sox=require(_0xc67b('0x5'));var csv=require('to-csv');var ejs=require(_0xc67b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc67b('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc67b('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xc67b('0x9'));var querystring=require(_0xc67b('0xa'));var Papa=require(_0xc67b('0xb'));var Redis=require(_0xc67b('0xc'));var authService=require(_0xc67b('0xd'));var qs=require(_0xc67b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc67b('0xf'));var logger=require(_0xc67b('0x10'))('api');var utils=require(_0xc67b('0x11'));var config=require(_0xc67b('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc67b('0x13')]=_['defaults'](config[_0xc67b('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0xc67b('0x14'))(new Redis(config[_0xc67b('0x13')]));require(_0xc67b('0x15'))[_0xc67b('0x16')](socket);var jayson=require(_0xc67b('0x17'));var client=jayson['client'][_0xc67b('0x18')]({'port':0x232c});var client9002=jayson[_0xc67b('0x19')][_0xc67b('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4c51db,_0x237921,_0x57549a,_0x4d444c){return new BPromise(function(_0x387003,_0x1556aa){var _0x1537e2=_0x4d444c||client;return _0x1537e2[_0xc67b('0x1a')](_0x4c51db,_0x57549a)[_0xc67b('0x1b')](function(_0x254712){logger['info'](_0xc67b('0x1c'),_0x237921,_0xc67b('0x1d'));logger[_0xc67b('0x1e')](_0xc67b('0x1f'),_0x237921,'request\x20sent',JSON[_0xc67b('0x20')](_0x254712));if(_0x254712[_0xc67b('0x21')]){if(_0x254712[_0xc67b('0x21')]['code']===0x1f4){logger['error'](_0xc67b('0x1c'),_0x237921,_0x254712[_0xc67b('0x21')]['message']);return _0x1556aa(_0x254712[_0xc67b('0x21')][_0xc67b('0x22')]);}logger[_0xc67b('0x21')](_0xc67b('0x1c'),_0x237921,_0x254712[_0xc67b('0x21')][_0xc67b('0x22')]);return _0x387003(_0x254712[_0xc67b('0x21')][_0xc67b('0x22')]);}else{logger[_0xc67b('0x23')](_0xc67b('0x1c'),_0x237921,'request\x20sent');_0x387003(_0x254712[_0xc67b('0x24')][_0xc67b('0x22')]);}})[_0xc67b('0x25')](function(_0x225629){logger[_0xc67b('0x21')](_0xc67b('0x1c'),_0x237921,_0x225629);_0x1556aa(_0x225629);});});}function respondWithStatusCode(_0x38642c,_0x4b6c55){_0x4b6c55=_0x4b6c55||0xcc;return function(_0x217826){if(_0x217826){return _0x38642c[_0xc67b('0x26')](_0x4b6c55);}return _0x38642c[_0xc67b('0x27')](_0x4b6c55)['end']();};}function respondWithResult(_0x16f3cd,_0x4cc9e5){_0x4cc9e5=_0x4cc9e5||0xc8;return function(_0x3022bf){if(_0x3022bf){return _0x16f3cd[_0xc67b('0x27')](_0x4cc9e5)[_0xc67b('0x28')](_0x3022bf);}};}function respondWithFilteredResult(_0x3309ca,_0x1c2afb){return function(_0x2ea5dc){if(_0x2ea5dc){var _0x5c57fd=typeof _0x1c2afb[_0xc67b('0x29')]===_0xc67b('0x2a')&&typeof _0x1c2afb[_0xc67b('0x2b')]===_0xc67b('0x2a');var _0x3cfa2d=_0x2ea5dc[_0xc67b('0x2c')];var _0x30ea8d=_0x5c57fd?0x0:_0x1c2afb['offset'];var _0x4b20f1=_0x5c57fd?_0x2ea5dc[_0xc67b('0x2c')]:_0x1c2afb[_0xc67b('0x29')]+_0x1c2afb[_0xc67b('0x2b')];var _0x4b3990;if(_0x4b20f1>=_0x3cfa2d){_0x4b20f1=_0x3cfa2d;_0x4b3990=0xc8;}else{_0x4b3990=0xce;}_0x3309ca[_0xc67b('0x27')](_0x4b3990);return _0x3309ca['set'](_0xc67b('0x2d'),_0x30ea8d+'-'+_0x4b20f1+'/'+_0x3cfa2d)[_0xc67b('0x28')](_0x2ea5dc);}return null;};}function patchUpdates(_0x4a358c){return function(_0x5d5611){try{jsonpatch[_0xc67b('0x2e')](_0x5d5611,_0x4a358c,!![]);}catch(_0x32c3ac){return BPromise[_0xc67b('0x2f')](_0x32c3ac);}return _0x5d5611[_0xc67b('0x30')]();};}function saveUpdates(_0x158c1e,_0x5d383e){return function(_0x5cd402){if(_0x5cd402){return _0x5cd402['update'](_0x158c1e)[_0xc67b('0x1b')](function(_0x4dbf33){return _0x4dbf33;});}return null;};}function removeEntity(_0x2a55be,_0x3093ef){return function(_0x20d54e){if(_0x20d54e){return _0x20d54e[_0xc67b('0x31')]()[_0xc67b('0x1b')](function(){_0x2a55be[_0xc67b('0x27')](0xcc)[_0xc67b('0x32')]();});}};}function handleEntityNotFound(_0x16a09f,_0x462b78){return function(_0x38aed4){if(!_0x38aed4){_0x16a09f[_0xc67b('0x26')](0x194);}return _0x38aed4;};}function handleError(_0x1a617a,_0x4ae665){_0x4ae665=_0x4ae665||0x1f4;return function(_0x57ec22){logger[_0xc67b('0x21')](_0x57ec22[_0xc67b('0x33')]);if(_0x57ec22[_0xc67b('0x34')]){delete _0x57ec22[_0xc67b('0x34')];}_0x1a617a[_0xc67b('0x27')](_0x4ae665)[_0xc67b('0x35')](_0x57ec22);};}exports[_0xc67b('0x36')]=function(_0x40450f,_0x555151){var _0x5ed109={},_0x8bde34={},_0x4aec5a={'count':0x0,'rows':[]};var _0x3cea40=_[_0xc67b('0x37')](db[_0xc67b('0x38')][_0xc67b('0x39')],function(_0x505f16){return{'name':_0x505f16[_0xc67b('0x3a')],'type':_0x505f16['type'][_0xc67b('0x3b')]};});_0x8bde34[_0xc67b('0x3c')]=_[_0xc67b('0x37')](_0x3cea40,_0xc67b('0x34'));_0x8bde34[_0xc67b('0x3d')]=_[_0xc67b('0x3e')](_0x40450f[_0xc67b('0x3d')]);_0x8bde34[_0xc67b('0x3f')]=_[_0xc67b('0x40')](_0x8bde34[_0xc67b('0x3c')],_0x8bde34[_0xc67b('0x3d')]);_0x5ed109[_0xc67b('0x41')]=_['intersection'](_0x8bde34[_0xc67b('0x3c')],qs[_0xc67b('0x42')](_0x40450f[_0xc67b('0x3d')][_0xc67b('0x42')]));_0x5ed109[_0xc67b('0x41')]=_0x5ed109[_0xc67b('0x41')][_0xc67b('0x43')]?_0x5ed109['attributes']:_0x8bde34['model'];if(!_0x40450f[_0xc67b('0x3d')][_0xc67b('0x44')](_0xc67b('0x45'))){_0x5ed109['limit']=qs['limit'](_0x40450f[_0xc67b('0x3d')]['limit']);_0x5ed109[_0xc67b('0x29')]=qs[_0xc67b('0x29')](_0x40450f[_0xc67b('0x3d')][_0xc67b('0x29')]);}_0x5ed109['order']=qs[_0xc67b('0x46')](_0x40450f[_0xc67b('0x3d')][_0xc67b('0x46')]);_0x5ed109[_0xc67b('0x47')]=qs[_0xc67b('0x3f')](_[_0xc67b('0x48')](_0x40450f[_0xc67b('0x3d')],_0x8bde34['filters']),_0x3cea40);if(_0x40450f[_0xc67b('0x3d')][_0xc67b('0x49')]){_0x5ed109[_0xc67b('0x47')]=_[_0xc67b('0x4a')](_0x5ed109['where'],{'$or':_['map'](_0x3cea40,function(_0x420c24){if(_0x420c24[_0xc67b('0x4b')]!==_0xc67b('0x4c')){var _0x3bcf45={};_0x3bcf45[_0x420c24[_0xc67b('0x34')]]={'$like':'%'+_0x40450f[_0xc67b('0x3d')][_0xc67b('0x49')]+'%'};return _0x3bcf45;}})});}_0x5ed109=_[_0xc67b('0x4a')]({},_0x5ed109,_0x40450f[_0xc67b('0x4d')]);var _0x3149c3={'where':_0x5ed109[_0xc67b('0x47')]};return db[_0xc67b('0x38')][_0xc67b('0x2c')](_0x3149c3)['then'](function(_0x16e845){_0x4aec5a['count']=_0x16e845;if(_0x40450f['query'][_0xc67b('0x4e')]){_0x5ed109[_0xc67b('0x4f')]=[{'all':!![]}];}return db[_0xc67b('0x38')][_0xc67b('0x50')](_0x5ed109);})['then'](function(_0x1c808e){_0x4aec5a[_0xc67b('0x51')]=_0x1c808e;return _0x4aec5a;})[_0xc67b('0x1b')](respondWithFilteredResult(_0x555151,_0x5ed109))[_0xc67b('0x25')](handleError(_0x555151,null));};exports[_0xc67b('0x52')]=function(_0x742ba4,_0x54b496){var _0x50df53={'raw':!![],'where':{'id':_0x742ba4['params']['id']}},_0x3eb2ac={};_0x3eb2ac['model']=_[_0xc67b('0x3e')](db['OpenchannelMessage'][_0xc67b('0x39')]);_0x3eb2ac[_0xc67b('0x3d')]=_[_0xc67b('0x3e')](_0x742ba4[_0xc67b('0x3d')]);_0x3eb2ac[_0xc67b('0x3f')]=_['intersection'](_0x3eb2ac[_0xc67b('0x3c')],_0x3eb2ac[_0xc67b('0x3d')]);_0x50df53[_0xc67b('0x41')]=_[_0xc67b('0x40')](_0x3eb2ac[_0xc67b('0x3c')],qs[_0xc67b('0x42')](_0x742ba4[_0xc67b('0x3d')][_0xc67b('0x42')]));_0x50df53[_0xc67b('0x41')]=_0x50df53[_0xc67b('0x41')]['length']?_0x50df53[_0xc67b('0x41')]:_0x3eb2ac[_0xc67b('0x3c')];if(_0x742ba4[_0xc67b('0x3d')]['includeAll']){_0x50df53[_0xc67b('0x4f')]=[{'all':!![]}];}_0x50df53=_[_0xc67b('0x4a')]({},_0x50df53,_0x742ba4[_0xc67b('0x4d')]);return db[_0xc67b('0x38')][_0xc67b('0x53')](_0x50df53)[_0xc67b('0x1b')](handleEntityNotFound(_0x54b496,null))[_0xc67b('0x1b')](respondWithResult(_0x54b496,null))[_0xc67b('0x25')](handleError(_0x54b496,null));};exports['create']=function(_0x5294f5,_0x5ae080){return db['OpenchannelMessage'][_0xc67b('0x54')](_0x5294f5[_0xc67b('0x55')],{})[_0xc67b('0x1b')](respondWithResult(_0x5ae080,0xc9))[_0xc67b('0x25')](handleError(_0x5ae080,null));};exports[_0xc67b('0x56')]=function(_0xad5f73,_0x2cfe98){if(_0xad5f73[_0xc67b('0x55')]['id']){delete _0xad5f73[_0xc67b('0x55')]['id'];}return db[_0xc67b('0x38')][_0xc67b('0x53')]({'where':{'id':_0xad5f73['params']['id']}})['then'](handleEntityNotFound(_0x2cfe98,null))[_0xc67b('0x1b')](saveUpdates(_0xad5f73[_0xc67b('0x55')],null))[_0xc67b('0x1b')](respondWithResult(_0x2cfe98,null))[_0xc67b('0x25')](handleError(_0x2cfe98,null));};exports[_0xc67b('0x31')]=function(_0x313744,_0x52e8be){return db[_0xc67b('0x38')][_0xc67b('0x53')]({'where':{'id':_0x313744[_0xc67b('0x57')]['id']}})['then'](handleEntityNotFound(_0x52e8be,null))[_0xc67b('0x1b')](removeEntity(_0x52e8be,null))['catch'](handleError(_0x52e8be,null));};exports[_0xc67b('0x58')]=function(_0x4b3f0c,_0x401129){return db[_0xc67b('0x38')]['describe']()['then'](respondWithResult(_0x401129,null))['catch'](handleError(_0x401129,null));};var interaction_log=require(_0xc67b('0x10'))(_0xc67b('0x59'));exports[_0xc67b('0x5a')]=function(_0x371dd0,_0x50fd63,_0x2bc821){var _0x6e6b39={'agent':{},'channel':_0xc67b('0x5b')};if(_0x371dd0['body']['id']){delete _0x371dd0[_0xc67b('0x55')]['id'];}_0x371dd0[_0xc67b('0x55')]['read']=!![];_0x371dd0['body'][_0xc67b('0x5c')]=moment()[_0xc67b('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x371dd0[_0xc67b('0x55')][_0xc67b('0x5e')]=_0x371dd0['body'][_0xc67b('0x5e')]||_0x371dd0['user']['id'];_0x6e6b39[_0xc67b('0x5f')]['id']=_0x371dd0['body']['UserId'];return db[_0xc67b('0x38')]['find']({'where':{'id':_0x371dd0['params']['id'],'UserId':null}})[_0xc67b('0x1b')](handleEntityNotFound(_0x50fd63,null))[_0xc67b('0x1b')](saveUpdates(_0x371dd0[_0xc67b('0x55')],null))[_0xc67b('0x1b')](function(_0x59ac05){if(_0x59ac05){_0x6e6b39['message']=_0x59ac05[_0xc67b('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0xc67b('0x53')]({'where':{'id':_0x59ac05[_0xc67b('0x61')]}});}return null;})[_0xc67b('0x1b')](handleEntityNotFound(_0x50fd63,null))['then'](function(_0x47c458){if(_0x47c458){return _0x47c458['update']({'UserId':_0x371dd0['body'][_0xc67b('0x5e')],'read1stAt':_['isNil'](_0x47c458[_0xc67b('0x62')])?moment()['format'](_0xc67b('0x63')):undefined});}return null;})[_0xc67b('0x1b')](function(_0x3975f2){if(_0x3975f2){_0x6e6b39[_0xc67b('0x64')]=_0x3975f2[_0xc67b('0x60')]({'plain':!![]});interaction_log[_0xc67b('0x23')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x371dd0[_0xc67b('0x65')]['id'],_0x371dd0['user']['name'],_0x371dd0[_0xc67b('0x65')][_0xc67b('0x66')],_0x6e6b39['interaction']['id'],_0x371dd0[_0xc67b('0x55')]?JSON['stringify'](_0x371dd0[_0xc67b('0x55')]):_0xc67b('0x67'));return respondWithRpcPromise(_0xc67b('0x68'),_0xc67b('0x69'),_0x6e6b39);}return null;})[_0xc67b('0x1b')](function(_0x31dba8){var _0x44d188='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x31dba8['message'][_0xc67b('0x6a')];return db[_0xc67b('0x6b')]['query'](_0x44d188,{'type':db[_0xc67b('0x6c')][_0xc67b('0x6d')][_0xc67b('0x6e')],'raw':!![]})[_0xc67b('0x1b')](function(_0x57da05){return _0x57da05;});})[_0xc67b('0x1b')](function(_0x2f12c7){if(_0x2f12c7){_0x6e6b39['message']['contact']=_0x2f12c7[0x0];if(!_0x371dd0[_0xc67b('0x55')]['UserId'])return;return db[_0xc67b('0x6f')][_0xc67b('0x53')]({'where':{'id':_0x371dd0[_0xc67b('0x55')][_0xc67b('0x5e')],'role':_0xc67b('0x5f')},'attributes':['id','name','fullname',_0xc67b('0x70'),_0xc67b('0x71')],'raw':!![]});}return null;})['then'](function(_0xc249d2){if(!_0xc249d2)return null;_0x6e6b39['message'][_0xc67b('0x5f')]=_0xc249d2;return _0x6e6b39;})[_0xc67b('0x1b')](function(_0x4cefeb){if(_0x4cefeb){if(_0x371dd0[_0xc67b('0x55')][_0xc67b('0x72')]){_0x6e6b39['message'][_0xc67b('0x73')]=util[_0xc67b('0x5d')](_0xc67b('0x74'),_0x371dd0[_0xc67b('0x65')]['name']);_0x6e6b39[_0xc67b('0x22')][_0xc67b('0x75')]=_0x6e6b39[_0xc67b('0x75')];_0x6e6b39[_0xc67b('0x22')][_0xc67b('0x76')]=_0x6e6b39[_0xc67b('0x75')];_0x6e6b39[_0xc67b('0x22')][_0xc67b('0x77')]='accept';return respondWithRpcPromise(_0xc67b('0x78'),_0xc67b('0x78'),{'event':_0xc67b('0x79'),'message':_0x6e6b39[_0xc67b('0x22')]},client9002)[_0xc67b('0x1b')](function(){return _0x6e6b39;});}return _0x6e6b39;}return null;})[_0xc67b('0x1b')](respondWithResult(_0x50fd63,null))['catch'](handleError(_0x50fd63,null));};var interaction_log=require(_0xc67b('0x10'))('openchannel-interactions');exports[_0xc67b('0x2f')]=function(_0x2267ff,_0x4a451,_0x2a0b88){var _0x1dc8e8={'agent':{},'channel':'openchannel'};if(_0x2267ff[_0xc67b('0x55')]['id']){delete _0x2267ff[_0xc67b('0x55')]['id'];}_0x2267ff[_0xc67b('0x55')][_0xc67b('0x5e')]=_0x2267ff[_0xc67b('0x55')][_0xc67b('0x5e')]||_0x2267ff['user']['id'];_0x1dc8e8['agent']['id']=_0x2267ff[_0xc67b('0x55')][_0xc67b('0x5e')];return db[_0xc67b('0x38')]['find']({'where':{'id':_0x2267ff[_0xc67b('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4a451,null))['then'](function(_0x3ee56d){if(_0x3ee56d){_0x1dc8e8[_0xc67b('0x22')]=_0x3ee56d[_0xc67b('0x60')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x3ee56d[_0xc67b('0x61')]}});}return null;})[_0xc67b('0x1b')](handleEntityNotFound(_0x4a451,null))[_0xc67b('0x1b')](function(_0x545d48){if(_0x545d48){_0x1dc8e8[_0xc67b('0x64')]=_0x545d48['get']({'plain':!![]});interaction_log['info'](_0xc67b('0x7a'),_0x2267ff[_0xc67b('0x65')]['id'],_0x2267ff['user'][_0xc67b('0x34')],_0x2267ff[_0xc67b('0x65')][_0xc67b('0x66')],_0x1dc8e8[_0xc67b('0x64')]['id'],_0x2267ff[_0xc67b('0x55')]?JSON[_0xc67b('0x20')](_0x2267ff['body']):'null');return respondWithRpcPromise(_0xc67b('0x7b'),_0xc67b('0x7c'),_0x1dc8e8);}return null;})['then'](function(_0x1f4f6c){var _0x449a96=_0xc67b('0x7d')+_0x1f4f6c['message'][_0xc67b('0x6a')];return db[_0xc67b('0x6b')][_0xc67b('0x3d')](_0x449a96,{'type':db[_0xc67b('0x6c')][_0xc67b('0x6d')][_0xc67b('0x6e')],'raw':!![]})[_0xc67b('0x1b')](function(_0xa2de0c){return _0xa2de0c;});})[_0xc67b('0x1b')](function(_0x1eec74){if(_0x1eec74){_0x1dc8e8[_0xc67b('0x22')][_0xc67b('0x7e')]=_0x1eec74[0x0];if(!_0x2267ff[_0xc67b('0x55')][_0xc67b('0x5e')])return;return db[_0xc67b('0x6f')][_0xc67b('0x53')]({'where':{'id':_0x2267ff[_0xc67b('0x55')][_0xc67b('0x5e')],'role':_0xc67b('0x5f')},'attributes':['id',_0xc67b('0x34'),_0xc67b('0x7f'),_0xc67b('0x70'),_0xc67b('0x71')],'raw':!![]});}return null;})['then'](function(_0x3e2e3c){if(!_0x3e2e3c)return null;_0x1dc8e8[_0xc67b('0x22')][_0xc67b('0x5f')]=_0x3e2e3c;return _0x1dc8e8;})[_0xc67b('0x1b')](function(_0x5c1301){if(_0x5c1301){_0x5c1301[_0xc67b('0x22')][_0xc67b('0x73')]=util['format']('SIP/%s',_0x2267ff[_0xc67b('0x65')][_0xc67b('0x34')]);_0x5c1301[_0xc67b('0x22')][_0xc67b('0x75')]=_0x1dc8e8['channel'];_0x5c1301[_0xc67b('0x22')][_0xc67b('0x76')]=_0x1dc8e8[_0xc67b('0x75')];_0x5c1301[_0xc67b('0x22')][_0xc67b('0x77')]=_0xc67b('0x2f');respondWithRpcPromise(_0xc67b('0x78'),'EventManager',{'event':'rejectmessage','message':_0x5c1301[_0xc67b('0x22')]},client9002);return _0x1dc8e8;}return null;})['then'](respondWithResult(_0x4a451,null))[_0xc67b('0x25')](handleError(_0x4a451,null));};
\ No newline at end of file
index d9ec8bc..5c50a4d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9bf=['save','update','remove','emit','hook','events','OpenchannelMessage','setMaxListeners'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xa9bf,0x165));var _0xfa9b=function(_0x52c651,_0x4c1f4e){_0x52c651=_0x52c651-0x0;var _0x525ceb=_0xa9bf[_0x52c651];return _0x525ceb;};'use strict';var EventEmitter=require(_0xfa9b('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xfa9b('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xfa9b('0x2')](0x0);var events={'afterCreate':_0xfa9b('0x3'),'afterUpdate':_0xfa9b('0x4'),'afterDestroy':_0xfa9b('0x5')};function emitEvent(_0x548dab){return function(_0xfe026a,_0x51b20a,_0x4da342){OpenchannelMessageEvents[_0xfa9b('0x6')](_0x548dab+':'+_0xfe026a['id'],_0xfe026a);OpenchannelMessageEvents['emit'](_0x548dab,_0xfe026a);_0x4da342(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xfa9b('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents;
\ No newline at end of file
+var _0xb3ba=['emit','hasOwnProperty','hook','events','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x4439c0,_0x1cff99){var _0x192f2b=function(_0x54cd0e){while(--_0x54cd0e){_0x4439c0['push'](_0x4439c0['shift']());}};_0x192f2b(++_0x1cff99);}(_0xb3ba,0x1b3));var _0xab3b=function(_0x470a16,_0x4da8f5){_0x470a16=_0x470a16-0x0;var _0x3a5ec2=_0xb3ba[_0x470a16];return _0x3a5ec2;};'use strict';var EventEmitter=require(_0xab3b('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xab3b('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xab3b('0x2')](0x0);var events={'afterCreate':_0xab3b('0x3'),'afterUpdate':_0xab3b('0x4'),'afterDestroy':_0xab3b('0x5')};function emitEvent(_0x2dc469){return function(_0x2eb3e3,_0x3f5b38,_0x885a49){OpenchannelMessageEvents[_0xab3b('0x6')](_0x2dc469+':'+_0x2eb3e3['id'],_0x2eb3e3);OpenchannelMessageEvents[_0xab3b('0x6')](_0x2dc469,_0x2eb3e3);_0x885a49(null);};}for(var e in events){if(events[_0xab3b('0x7')](e)){var event=events[e];OpenchannelMessage[_0xab3b('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents;
\ No newline at end of file
index 78d2e2d..0890aa3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4308=['./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','models','get','direction','toLowerCase','out','secret','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','error','CmContact','describe','OpenchannelAccount','find','Interactions','Contact','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','method','GET','POST','body','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','catch','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','bluebird','path','rimraf','../../config/environment'];(function(_0x155b72,_0x513f99){var _0x2d8567=function(_0x38d0ce){while(--_0x38d0ce){_0x155b72['push'](_0x155b72['shift']());}};_0x2d8567(++_0x513f99);}(_0x4308,0x152));var _0x8430=function(_0x405f04,_0x24b4b8){_0x405f04=_0x405f04-0x0;var _0x36e0cb=_0x4308[_0x405f04];return _0x36e0cb;};'use strict';var _=require('lodash');var util=require(_0x8430('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8430('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8430('0x2'));var rimraf=require(_0x8430('0x3'));var config=require(_0x8430('0x4'));var attributes=require(_0x8430('0x5'));module[_0x8430('0x6')]=function(_0x2c16f2,_0x4cecf7){return _0x2c16f2[_0x8430('0x7')]('OpenchannelMessage',attributes,{'tableName':_0x8430('0x8'),'paranoid':![],'indexes':[{'name':_0x8430('0x9'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x21dfe7,_0x8cae79,_0x199475){var _0x4f516d=_0x2c16f2[_0x8430('0xa')];var _0x3bf930=_0x21dfe7[_0x8430('0xb')]({'plain':!![]});if(_0x3bf930[_0x8430('0xc')][_0x8430('0xd')]()==='in'||_0x3bf930[_0x8430('0xc')]['toLowerCase']()===_0x8430('0xe')&&!_0x3bf930[_0x8430('0xf')]&&!_['isNil'](_0x3bf930['UserId'])){_0x4f516d[_0x8430('0x10')][_0x8430('0x11')]({'where':{'id':_0x3bf930[_0x8430('0x12')]}})[_0x8430('0x13')](function(_0x33c6b3){if(_0x33c6b3){_0x33c6b3[_0x8430('0x14')]({'lastMsgAt':_0x3bf930[_0x8430('0x15')],'lastMsgDirection':_0x3bf930[_0x8430('0xc')][_0x8430('0xd')]()});}})['catch'](function(_0x34feea){console[_0x8430('0x16')](_0x34feea);});}if(_0x3bf930[_0x8430('0xc')]===_0x8430('0xe')&&!_0x3bf930[_0x8430('0xf')]){var _0x1e775c;_0x4f516d[_0x8430('0x17')][_0x8430('0x18')]()[_0x8430('0x13')](function(_0x2c1fae){return _0x4f516d[_0x8430('0x19')][_0x8430('0x1a')]({'where':{'id':_0x3bf930['OpenchannelAccountId']},'include':[{'model':_0x4f516d[_0x8430('0x10')],'as':_0x8430('0x1b'),'where':{'id':_0x3bf930[_0x8430('0x12')]},'limit':0x1,'include':[{'model':_0x4f516d[_0x8430('0x17')],'as':_0x8430('0x1c'),'attributes':_['keys'](_0x2c1fae)}]}]});})[_0x8430('0x13')](function(_0x57ecdc){_0x1e775c=_0x57ecdc[_0x8430('0xb')]({'plain':!![]});if(_0x1e775c&&_0x1e775c[_0x8430('0x1d')]){logger[_0x8430('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x8430('0x1f'),util[_0x8430('0x20')](_0x8430('0x21'),_0x3bf930['id'],_0x1e775c[_0x8430('0x1d')]));if(_0x1e775c[_0x8430('0x1b')]&&_0x1e775c['Interactions'][_0x8430('0x22')]){_0x3bf930['Interaction']=_[_0x8430('0x23')](_0x1e775c['Interactions'][0x0],_0x8430('0x1c'));_0x3bf930['Contact']=_0x1e775c[_0x8430('0x1b')][0x0][_0x8430('0x1c')];}var _0x8cae79={'method':'POST','uri':encodeURI(_0x1e775c[_0x8430('0x1d')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x8cae79[_0x8430('0x24')]){case _0x8430('0x25'):_0x8cae79['qs']=_0x3bf930;break;case _0x8430('0x26'):_0x8cae79[_0x8430('0x27')]=_0x3bf930;break;}return rp(_0x8cae79)[_0x8430('0x13')](function(_0x4ba0f2){logger['info'](_0x8430('0x28'),_0x8430('0x1f'),util[_0x8430('0x20')](_0x8430('0x29'),_0x3bf930['id'],_0x1e775c[_0x8430('0x1d')]));if(_0x4ba0f2['body'][_0x8430('0x2a')]&&_0x4ba0f2[_0x8430('0x27')]['threadId']!=_0x3bf930[_0x8430('0x2b')][_0x8430('0x2a')]){return _0x4f516d[_0x8430('0x10')][_0x8430('0x14')]({'threadId':_0x4ba0f2['body'][_0x8430('0x2a')]},{'where':{'id':_0x3bf930[_0x8430('0x2b')]['id']}});}else{return;}})[_0x8430('0x13')](function(){return _0x21dfe7['update']({'read':!![]});})[_0x8430('0x2c')](function(_0x4b5a23){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x8430('0x1f'),util[_0x8430('0x2d')](_0x4b5a23,{'showHidden':![],'depth':null}));_0x199475();});}else{_0x199475();}})[_0x8430('0x2e')](function(){_0x199475();});}else{_0x199475();}}},'charset':_0x8430('0x2f'),'collate':_0x8430('0x30')});};
\ No newline at end of file
+var _0xf01f=['Interactions','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Interaction','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','findOne','OpenchannelInteractionId','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction'];(function(_0x124dce,_0x191ed2){var _0x1e80df=function(_0x17d1da){while(--_0x17d1da){_0x124dce['push'](_0x124dce['shift']());}};_0x1e80df(++_0x191ed2);}(_0xf01f,0x169));var _0xff01=function(_0x499479,_0x8e0b72){_0x499479=_0x499479-0x0;var _0x5bf084=_0xf01f[_0x499479];return _0x5bf084;};'use strict';var _=require('lodash');var util=require(_0xff01('0x0'));var logger=require(_0xff01('0x1'))(_0xff01('0x2'));var moment=require(_0xff01('0x3'));var BPromise=require(_0xff01('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff01('0x5'));var rimraf=require('rimraf');var config=require(_0xff01('0x6'));var attributes=require(_0xff01('0x7'));module['exports']=function(_0x4dc9bd,_0x38b7b4){return _0x4dc9bd['define'](_0xff01('0x8'),attributes,{'tableName':_0xff01('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xff01('0xa')],'type':_0xff01('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40f01b,_0x29af4b,_0x4443da){var _0x75aa71=_0x4dc9bd[_0xff01('0xc')];var _0x3068f3=_0x40f01b[_0xff01('0xd')]({'plain':!![]});if(_0x3068f3['direction'][_0xff01('0xe')]()==='in'||_0x3068f3[_0xff01('0xf')][_0xff01('0xe')]()===_0xff01('0x10')&&!_0x3068f3[_0xff01('0x11')]&&!_[_0xff01('0x12')](_0x3068f3['UserId'])){_0x75aa71['OpenchannelInteraction'][_0xff01('0x13')]({'where':{'id':_0x3068f3[_0xff01('0x14')]}})['then'](function(_0xa822bc){if(_0xa822bc){_0xa822bc['update']({'lastMsgAt':_0x3068f3[_0xff01('0x15')],'lastMsgDirection':_0x3068f3['direction'][_0xff01('0xe')]()});}})[_0xff01('0x16')](function(_0x1486da){console[_0xff01('0x17')](_0x1486da);});}if(_0x3068f3['direction']==='out'&&!_0x3068f3[_0xff01('0x11')]){var _0x17726e;_0x75aa71[_0xff01('0x18')][_0xff01('0x19')]()[_0xff01('0x1a')](function(_0xdc14ca){return _0x75aa71[_0xff01('0x1b')][_0xff01('0x1c')]({'where':{'id':_0x3068f3[_0xff01('0x1d')]},'include':[{'model':_0x75aa71[_0xff01('0x1e')],'as':_0xff01('0x1f'),'where':{'id':_0x3068f3[_0xff01('0x14')]},'limit':0x1,'include':[{'model':_0x75aa71[_0xff01('0x18')],'as':_0xff01('0x20'),'attributes':_[_0xff01('0x21')](_0xdc14ca)}]}]});})[_0xff01('0x1a')](function(_0x217cbc){_0x17726e=_0x217cbc['get']({'plain':!![]});if(_0x17726e&&_0x17726e[_0xff01('0x22')]){logger['info'](_0xff01('0x23'),_0xff01('0x24'),util[_0xff01('0x25')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x3068f3['id'],_0x17726e[_0xff01('0x22')]));if(_0x17726e[_0xff01('0x1f')]&&_0x17726e[_0xff01('0x1f')]['length']){_0x3068f3[_0xff01('0x26')]=_['omit'](_0x17726e['Interactions'][0x0],_0xff01('0x20'));_0x3068f3[_0xff01('0x20')]=_0x17726e[_0xff01('0x1f')][0x0][_0xff01('0x20')];}var _0x29af4b={'method':_0xff01('0x27'),'uri':encodeURI(_0x17726e[_0xff01('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x29af4b[_0xff01('0x28')]){case _0xff01('0x29'):_0x29af4b['qs']=_0x3068f3;break;case'POST':_0x29af4b[_0xff01('0xa')]=_0x3068f3;break;}return rp(_0x29af4b)[_0xff01('0x1a')](function(_0x57a966){logger[_0xff01('0x2a')](_0xff01('0x23'),_0xff01('0x24'),util[_0xff01('0x25')](_0xff01('0x2b'),_0x3068f3['id'],_0x17726e[_0xff01('0x22')]));if(_0x57a966[_0xff01('0xa')][_0xff01('0x2c')]&&_0x57a966['body'][_0xff01('0x2c')]!=_0x3068f3[_0xff01('0x26')][_0xff01('0x2c')]){return _0x75aa71[_0xff01('0x1e')]['update']({'threadId':_0x57a966[_0xff01('0xa')]['threadId']},{'where':{'id':_0x3068f3[_0xff01('0x26')]['id']}});}else{return;}})[_0xff01('0x1a')](function(){return _0x40f01b[_0xff01('0x2d')]({'read':!![]});})[_0xff01('0x16')](function(_0x4b3cea){logger[_0xff01('0x17')](_0xff01('0x23'),_0xff01('0x24'),util['inspect'](_0x4b3cea,{'showHidden':![],'depth':null}));_0x4443da();});}else{_0x4443da();}})[_0xff01('0x2e')](function(){_0x4443da();});}else{_0x4443da();}}},'charset':_0xff01('0x2f'),'collate':_0xff01('0x30')});};
\ No newline at end of file
index f928c0f..425870b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x4769fa,_0x425ab4){var _0x390786=function(_0x5a5312){while(--_0x5a5312){_0x4769fa['push'](_0x4769fa['shift']());}};_0x390786(++_0x425ab4);}(_0x2ef3,0xba));var _0x32ef=function(_0xe05647,_0x220998){_0xe05647=_0xe05647-0x0;var _0x1b21da=_0x2ef3[_0xe05647];return _0x1b21da;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});};
\ No newline at end of file
+var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x27c673,_0x3913a4){var _0x44a6d9=function(_0x381c19){while(--_0x381c19){_0x27c673['push'](_0x27c673['shift']());}};_0x44a6d9(++_0x3913a4);}(_0x7a54,0x106));var _0x47a5=function(_0x1dac5b,_0xd76fcf){_0x1dac5b=_0x1dac5b-0x0;var _0x3c04ba=_0x7a54[_0x1dac5b];return _0x3c04ba;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});};
\ No newline at end of file
index 4811bc8..3fef380 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7dfd=['./openchannelMessage.events','save','remove','update','emit','removeListener','register','length','openchannelMessage:'];(function(_0x199eed,_0x553b44){var _0x7cba1e=function(_0x2de10a){while(--_0x2de10a){_0x199eed['push'](_0x199eed['shift']());}};_0x7cba1e(++_0x553b44);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require(_0xd7df('0x0'));var events=[_0xd7df('0x1'),_0xd7df('0x2'),_0xd7df('0x3')];function createListener(_0x346f5f,_0x28c3c9){return function(_0x176418){_0x28c3c9[_0xd7df('0x4')](_0x346f5f,_0x176418);};}function removeListener(_0x3ef231,_0x3d8c5a){return function(){OpenchannelMessageEvents[_0xd7df('0x5')](_0x3ef231,_0x3d8c5a);};}exports[_0xd7df('0x6')]=function(_0x36cf0f){for(var _0x39ce98=0x0,_0x354ea7=events[_0xd7df('0x7')];_0x39ce98<_0x354ea7;_0x39ce98++){var _0x2c48a4=events[_0x39ce98];var _0x5c220a=createListener(_0xd7df('0x8')+_0x2c48a4,_0x36cf0f);OpenchannelMessageEvents['on'](_0x2c48a4,_0x5c220a);}};
\ No newline at end of file
+var _0x8f6b=['removeListener','./openchannelMessage.events','save','remove','emit'];(function(_0x16e1b3,_0x4f62d6){var _0x5bf961=function(_0x3f0488){while(--_0x3f0488){_0x16e1b3['push'](_0x16e1b3['shift']());}};_0x5bf961(++_0x4f62d6);}(_0x8f6b,0x146));var _0xb8f6=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x8f6b[_0x47e7cb];return _0x2a8874;};'use strict';var OpenchannelMessageEvents=require(_0xb8f6('0x0'));var events=[_0xb8f6('0x1'),_0xb8f6('0x2'),'update'];function createListener(_0x2b45ba,_0x170b3e){return function(_0x5e99f1){_0x170b3e[_0xb8f6('0x3')](_0x2b45ba,_0x5e99f1);};}function removeListener(_0x456df3,_0x49693f){return function(){OpenchannelMessageEvents[_0xb8f6('0x4')](_0x456df3,_0x49693f);};}exports['register']=function(_0x332ce0){for(var _0x4c73ad=0x0,_0x207add=events['length'];_0x4c73ad<_0x207add;_0x4c73ad++){var _0x1426d1=events[_0x4c73ad];var _0x11b65b=createListener('openchannelMessage:'+_0x1426d1,_0x332ce0);OpenchannelMessageEvents['on'](_0x1426d1,_0x11b65b);}};
\ No newline at end of file
index 8f7cc39..b5698f3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7ba9=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x124a70,_0x43eea0){var _0x1429df=function(_0x5eca53){while(--_0x5eca53){_0x124a70['push'](_0x124a70['shift']());}};_0x1429df(++_0x43eea0);}(_0x7ba9,0xc2));var _0x97ba=function(_0x192772,_0x100b16){_0x192772=_0x192772-0x0;var _0x2b50bd=_0x7ba9[_0x192772];return _0x2b50bd;};'use strict';var multer=require(_0x97ba('0x0'));var util=require(_0x97ba('0x1'));var path=require(_0x97ba('0x2'));var timeout=require(_0x97ba('0x3'));var express=require(_0x97ba('0x4'));var router=express['Router']();var fs_extra=require(_0x97ba('0x5'));var auth=require(_0x97ba('0x6'));var interaction=require(_0x97ba('0x7'));var config=require(_0x97ba('0x8'));var controller=require('./openchannelQueue.controller');router[_0x97ba('0x9')]('/',auth[_0x97ba('0xa')](),controller[_0x97ba('0xb')]);router[_0x97ba('0x9')](_0x97ba('0xc'),auth[_0x97ba('0xa')](),controller[_0x97ba('0xd')]);router['get'](_0x97ba('0xe'),auth['isAuthenticated'](),controller[_0x97ba('0xf')]);router[_0x97ba('0x9')](_0x97ba('0x10'),auth[_0x97ba('0xa')](),controller[_0x97ba('0x11')]);router[_0x97ba('0x9')](_0x97ba('0x12'),auth['isAuthenticated'](),controller[_0x97ba('0x13')]);router['get'](_0x97ba('0x14'),auth[_0x97ba('0xa')](),controller[_0x97ba('0x15')]);router[_0x97ba('0x16')]('/',auth[_0x97ba('0xa')](),controller[_0x97ba('0x17')]);router['post'](_0x97ba('0x12'),auth[_0x97ba('0xa')](),controller[_0x97ba('0x18')]);router[_0x97ba('0x16')](_0x97ba('0x14'),auth[_0x97ba('0xa')](),controller[_0x97ba('0x19')]);router[_0x97ba('0x1a')](_0x97ba('0xe'),auth[_0x97ba('0xa')](),controller[_0x97ba('0x1b')]);router['delete'](_0x97ba('0xe'),auth[_0x97ba('0xa')](),controller[_0x97ba('0x1c')]);router[_0x97ba('0x1d')](_0x97ba('0x12'),auth['isAuthenticated'](),controller[_0x97ba('0x1e')]);router[_0x97ba('0x1d')](_0x97ba('0x14'),auth['isAuthenticated'](),controller[_0x97ba('0x1f')]);module[_0x97ba('0x20')]=router;
\ No newline at end of file
+var _0x157a=['/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./openchannelQueue.controller','get','isAuthenticated','/:id'];(function(_0x44b533,_0x221c8d){var _0x42325b=function(_0x309350){while(--_0x309350){_0x44b533['push'](_0x44b533['shift']());}};_0x42325b(++_0x221c8d);}(_0x157a,0x1ed));var _0xa157=function(_0x212b03,_0x1f1b50){_0x212b03=_0x212b03-0x0;var _0x423115=_0x157a[_0x212b03];return _0x423115;};'use strict';var multer=require(_0xa157('0x0'));var util=require(_0xa157('0x1'));var path=require(_0xa157('0x2'));var timeout=require('connect-timeout');var express=require(_0xa157('0x3'));var router=express[_0xa157('0x4')]();var fs_extra=require(_0xa157('0x5'));var auth=require(_0xa157('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa157('0x7'));router[_0xa157('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa157('0x8')]('/describe',auth[_0xa157('0x9')](),controller['describe']);router['get'](_0xa157('0xa'),auth[_0xa157('0x9')](),controller['show']);router['get'](_0xa157('0xb'),auth['isAuthenticated'](),controller[_0xa157('0xc')]);router[_0xa157('0x8')]('/:id/teams',auth[_0xa157('0x9')](),controller[_0xa157('0xd')]);router[_0xa157('0x8')](_0xa157('0xe'),auth[_0xa157('0x9')](),controller[_0xa157('0xf')]);router[_0xa157('0x10')]('/',auth[_0xa157('0x9')](),controller[_0xa157('0x11')]);router[_0xa157('0x10')](_0xa157('0x12'),auth[_0xa157('0x9')](),controller[_0xa157('0x13')]);router['post'](_0xa157('0xe'),auth[_0xa157('0x9')](),controller[_0xa157('0x14')]);router[_0xa157('0x15')](_0xa157('0xa'),auth[_0xa157('0x9')](),controller[_0xa157('0x16')]);router['delete']('/:id',auth[_0xa157('0x9')](),controller[_0xa157('0x17')]);router[_0xa157('0x18')](_0xa157('0x12'),auth[_0xa157('0x9')](),controller[_0xa157('0x19')]);router[_0xa157('0x18')](_0xa157('0xe'),auth[_0xa157('0x9')](),controller[_0xa157('0x1a')]);module[_0xa157('0x1b')]=router;
\ No newline at end of file
index 5b6139f..1518799 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe4b6=['rrmemory','roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0xe4b6,0x136));var _0x6e4b=function(_0x459fb4,_0x1659a3){_0x459fb4=_0x459fb4-0x0;var _0x10dd67=_0xe4b6[_0x459fb4];return _0x10dd67;};'use strict';var Sequelize=require(_0x6e4b('0x0'));module[_0x6e4b('0x1')]={'name':{'type':Sequelize[_0x6e4b('0x2')],'unique':_0x6e4b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6e4b('0x4')](_0x6e4b('0x5'),'beepall',_0x6e4b('0x6'))}};
\ No newline at end of file
+var _0x6dc6=['STRING','name','INTEGER','rrmemory','beepall','sequelize'];(function(_0x242b6a,_0x2fc54a){var _0xab0bd0=function(_0x4f9dda){while(--_0x4f9dda){_0x242b6a['push'](_0x242b6a['shift']());}};_0xab0bd0(++_0x2fc54a);}(_0x6dc6,0xb9));var _0x66dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6dc6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x66dc('0x0'));module['exports']={'name':{'type':Sequelize[_0x66dc('0x1')],'unique':_0x66dc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x66dc('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x66dc('0x4'),_0x66dc('0x5'),'roundrobin')}};
\ No newline at end of file
index b1c0834..31252f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2d0f=['options','includeAll','findAll','rows','catch','show','params','filters','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','getMembers','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','online','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','join','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelQueue.socket','register','status','end','offset','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x8c453,_0x57ffe1){var _0xc76889=function(_0x3bb84b){while(--_0x3bb84b){_0x8c453['push'](_0x8c453['shift']());}};_0xc76889(++_0x57ffe1);}(_0x2d0f,0x1e5));var _0xf2d0=function(_0x4fa238,_0x6d7df8){_0x4fa238=_0x4fa238-0x0;var _0x20d576=_0x2d0f[_0x4fa238];return _0x20d576;};'use strict';var emlformat=require(_0xf2d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf2d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2d0('0x2'));var moment=require(_0xf2d0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf2d0('0x4'));var util=require(_0xf2d0('0x5'));var path=require('path');var sox=require(_0xf2d0('0x6'));var csv=require(_0xf2d0('0x7'));var ejs=require(_0xf2d0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf2d0('0x9'));var crypto=require(_0xf2d0('0xa'));var jsforce=require(_0xf2d0('0xb'));var deskjs=require(_0xf2d0('0xc'));var toCsv=require(_0xf2d0('0x7'));var querystring=require(_0xf2d0('0xd'));var Papa=require(_0xf2d0('0xe'));var Redis=require('ioredis');var authService=require(_0xf2d0('0xf'));var qs=require(_0xf2d0('0x10'));var as=require(_0xf2d0('0x11'));var hardwareService=require(_0xf2d0('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xf2d0('0x13'));var config=require(_0xf2d0('0x14'));var licenseUtil=require(_0xf2d0('0x15'));var db=require(_0xf2d0('0x16'))['db'];config['redis']=_['defaults'](config[_0xf2d0('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xf2d0('0x18'))(new Redis(config[_0xf2d0('0x17')]));require(_0xf2d0('0x19'))[_0xf2d0('0x1a')](socket);function respondWithStatusCode(_0x53d34c,_0x3e72b0){_0x3e72b0=_0x3e72b0||0xcc;return function(_0x2d639f){if(_0x2d639f){return _0x53d34c['sendStatus'](_0x3e72b0);}return _0x53d34c[_0xf2d0('0x1b')](_0x3e72b0)[_0xf2d0('0x1c')]();};}function respondWithResult(_0x235a04,_0x5e3c7a){_0x5e3c7a=_0x5e3c7a||0xc8;return function(_0x406979){if(_0x406979){return _0x235a04[_0xf2d0('0x1b')](_0x5e3c7a)['json'](_0x406979);}};}function respondWithFilteredResult(_0x4f813a,_0x1fd208){return function(_0xf5b232){if(_0xf5b232){var _0x3e3451=typeof _0x1fd208[_0xf2d0('0x1d')]==='undefined'&&typeof _0x1fd208['limit']===_0xf2d0('0x1e');var _0x4dcec8=_0xf5b232[_0xf2d0('0x1f')];var _0x2668c6=_0x3e3451?0x0:_0x1fd208['offset'];var _0x10deee=_0x3e3451?_0xf5b232[_0xf2d0('0x1f')]:_0x1fd208[_0xf2d0('0x1d')]+_0x1fd208['limit'];var _0x54b956;if(_0x10deee>=_0x4dcec8){_0x10deee=_0x4dcec8;_0x54b956=0xc8;}else{_0x54b956=0xce;}_0x4f813a[_0xf2d0('0x1b')](_0x54b956);return _0x4f813a[_0xf2d0('0x20')](_0xf2d0('0x21'),_0x2668c6+'-'+_0x10deee+'/'+_0x4dcec8)[_0xf2d0('0x22')](_0xf5b232);}return null;};}function patchUpdates(_0x27faad){return function(_0x46e251){try{jsonpatch[_0xf2d0('0x23')](_0x46e251,_0x27faad,!![]);}catch(_0x211e74){return BPromise['reject'](_0x211e74);}return _0x46e251[_0xf2d0('0x24')]();};}function saveUpdates(_0x275cad,_0x722283){return function(_0x5a282a){if(_0x5a282a){return _0x5a282a[_0xf2d0('0x25')](_0x275cad)[_0xf2d0('0x26')](function(_0x509305){return _0x509305;});}return null;};}function removeEntity(_0x4b9890,_0x48e188){return function(_0xc3e5b5){if(_0xc3e5b5){return _0xc3e5b5[_0xf2d0('0x27')]()[_0xf2d0('0x26')](function(){var _0x4f19e3=_0xc3e5b5['get']({'plain':!![]});var _0x40f231=_0xf2d0('0x28');return db[_0xf2d0('0x29')]['destroy']({'where':{'type':_0x40f231,'resourceId':_0x4f19e3['id']}})[_0xf2d0('0x26')](function(){return _0xc3e5b5;});})[_0xf2d0('0x26')](function(){_0x4b9890['status'](0xcc)[_0xf2d0('0x1c')]();});}};}function handleEntityNotFound(_0x9f3e5c,_0xdaf1c5){return function(_0x418dcd){if(!_0x418dcd){_0x9f3e5c[_0xf2d0('0x2a')](0x194);}return _0x418dcd;};}function handleError(_0x18fdd2,_0x137bac){_0x137bac=_0x137bac||0x1f4;return function(_0x37e927){logger[_0xf2d0('0x2b')](_0x37e927[_0xf2d0('0x2c')]);if(_0x37e927[_0xf2d0('0x2d')]){delete _0x37e927['name'];}_0x18fdd2[_0xf2d0('0x1b')](_0x137bac)[_0xf2d0('0x2e')](_0x37e927);};}exports[_0xf2d0('0x2f')]=function(_0x307c84,_0x2ec562){var _0x121789={},_0x17712e={},_0x42bee1={'count':0x0,'rows':[]};var _0x3f4c7a=_['map'](db[_0xf2d0('0x30')][_0xf2d0('0x31')],function(_0x3cabba){return{'name':_0x3cabba[_0xf2d0('0x32')],'type':_0x3cabba[_0xf2d0('0x33')][_0xf2d0('0x34')]};});_0x17712e[_0xf2d0('0x35')]=_[_0xf2d0('0x36')](_0x3f4c7a,'name');_0x17712e[_0xf2d0('0x37')]=_[_0xf2d0('0x38')](_0x307c84[_0xf2d0('0x37')]);_0x17712e['filters']=_['intersection'](_0x17712e[_0xf2d0('0x35')],_0x17712e[_0xf2d0('0x37')]);_0x121789[_0xf2d0('0x39')]=_[_0xf2d0('0x3a')](_0x17712e[_0xf2d0('0x35')],qs[_0xf2d0('0x3b')](_0x307c84['query'][_0xf2d0('0x3b')]));_0x121789['attributes']=_0x121789[_0xf2d0('0x39')][_0xf2d0('0x3c')]?_0x121789[_0xf2d0('0x39')]:_0x17712e[_0xf2d0('0x35')];if(!_0x307c84[_0xf2d0('0x37')][_0xf2d0('0x3d')](_0xf2d0('0x3e'))){_0x121789[_0xf2d0('0x3f')]=qs['limit'](_0x307c84[_0xf2d0('0x37')][_0xf2d0('0x3f')]);_0x121789[_0xf2d0('0x1d')]=qs['offset'](_0x307c84[_0xf2d0('0x37')][_0xf2d0('0x1d')]);}_0x121789[_0xf2d0('0x40')]=qs[_0xf2d0('0x41')](_0x307c84[_0xf2d0('0x37')]['sort']);_0x121789['where']=qs['filters'](_[_0xf2d0('0x42')](_0x307c84['query'],_0x17712e['filters']),_0x3f4c7a);if(_0x307c84['query'][_0xf2d0('0x43')]){_0x121789[_0xf2d0('0x44')]=_[_0xf2d0('0x45')](_0x121789['where'],{'$or':_[_0xf2d0('0x36')](_0x3f4c7a,function(_0x49c7db){if(_0x49c7db['type']!==_0xf2d0('0x46')){var _0x305b4c={};_0x305b4c[_0x49c7db['name']]={'$like':'%'+_0x307c84[_0xf2d0('0x37')][_0xf2d0('0x43')]+'%'};return _0x305b4c;}})});}_0x121789=_['merge']({},_0x121789,_0x307c84[_0xf2d0('0x47')]);var _0x1162c1={'where':_0x121789['where']};return db['OpenchannelQueue'][_0xf2d0('0x1f')](_0x1162c1)[_0xf2d0('0x26')](function(_0x9043ed){_0x42bee1['count']=_0x9043ed;if(_0x307c84['query'][_0xf2d0('0x48')]){_0x121789['include']=[{'all':!![]}];}return db[_0xf2d0('0x30')][_0xf2d0('0x49')](_0x121789);})[_0xf2d0('0x26')](function(_0x10ed74){_0x42bee1[_0xf2d0('0x4a')]=_0x10ed74;return _0x42bee1;})['then'](respondWithFilteredResult(_0x2ec562,_0x121789))[_0xf2d0('0x4b')](handleError(_0x2ec562,null));};exports[_0xf2d0('0x4c')]=function(_0x16f41d,_0xffc4ec){var _0x246407={'raw':!![],'where':{'id':_0x16f41d[_0xf2d0('0x4d')]['id']}},_0x5ca51b={};_0x5ca51b[_0xf2d0('0x35')]=_['keys'](db['OpenchannelQueue'][_0xf2d0('0x31')]);_0x5ca51b[_0xf2d0('0x37')]=_['keys'](_0x16f41d[_0xf2d0('0x37')]);_0x5ca51b[_0xf2d0('0x4e')]=_[_0xf2d0('0x3a')](_0x5ca51b['model'],_0x5ca51b[_0xf2d0('0x37')]);_0x246407[_0xf2d0('0x39')]=_['intersection'](_0x5ca51b['model'],qs[_0xf2d0('0x3b')](_0x16f41d[_0xf2d0('0x37')]['fields']));_0x246407['attributes']=_0x246407['attributes'][_0xf2d0('0x3c')]?_0x246407['attributes']:_0x5ca51b[_0xf2d0('0x35')];if(_0x16f41d['query']['includeAll']){_0x246407['include']=[{'all':!![]}];}_0x246407=_[_0xf2d0('0x45')]({},_0x246407,_0x16f41d[_0xf2d0('0x47')]);return db[_0xf2d0('0x30')]['find'](_0x246407)[_0xf2d0('0x26')](handleEntityNotFound(_0xffc4ec,null))['then'](respondWithResult(_0xffc4ec,null))[_0xf2d0('0x4b')](handleError(_0xffc4ec,null));};exports[_0xf2d0('0x4f')]=function(_0x2f64f1,_0x58df23){return db[_0xf2d0('0x30')][_0xf2d0('0x4f')](_0x2f64f1['body'],{})[_0xf2d0('0x26')](function(_0x479b8e){var _0x3a474b=_0x2f64f1[_0xf2d0('0x50')][_0xf2d0('0x51')]({'plain':!![]});if(!_0x3a474b)throw new Error(_0xf2d0('0x52'));if(_0x3a474b[_0xf2d0('0x53')]===_0xf2d0('0x50')){var _0x4f0811=_0x479b8e[_0xf2d0('0x51')]({'plain':!![]});var _0x341923=_0xf2d0('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x341923,'userProfileId':_0x3a474b['userProfileId']},'raw':!![]})['then'](function(_0x36684d){if(_0x36684d&&_0x36684d[_0xf2d0('0x54')]===0x0){return db[_0xf2d0('0x29')][_0xf2d0('0x4f')]({'name':_0x4f0811['name'],'resourceId':_0x4f0811['id'],'type':_0x36684d[_0xf2d0('0x2d')],'sectionId':_0x36684d['id']},{})[_0xf2d0('0x26')](function(){return _0x479b8e;});}else{return _0x479b8e;}})[_0xf2d0('0x4b')](function(_0x50abd6){logger[_0xf2d0('0x2b')](_0xf2d0('0x55'),_0x50abd6);throw _0x50abd6;});}return _0x479b8e;})['then'](respondWithResult(_0x58df23,0xc9))[_0xf2d0('0x4b')](handleError(_0x58df23,null));};exports[_0xf2d0('0x25')]=function(_0x53e4c4,_0x2b3187){if(_0x53e4c4['body']['id']){delete _0x53e4c4[_0xf2d0('0x56')]['id'];}return db[_0xf2d0('0x30')]['find']({'where':{'id':_0x53e4c4[_0xf2d0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2b3187,null))[_0xf2d0('0x26')](saveUpdates(_0x53e4c4[_0xf2d0('0x56')],null))[_0xf2d0('0x26')](respondWithResult(_0x2b3187,null))[_0xf2d0('0x4b')](handleError(_0x2b3187,null));};exports[_0xf2d0('0x27')]=function(_0x1f114b,_0x2d5b14){return db[_0xf2d0('0x30')][_0xf2d0('0x57')]({'where':{'id':_0x1f114b[_0xf2d0('0x4d')]['id']}})[_0xf2d0('0x26')](handleEntityNotFound(_0x2d5b14,null))['then'](removeEntity(_0x2d5b14,null))['catch'](handleError(_0x2d5b14,null));};exports[_0xf2d0('0x58')]=function(_0x5f252e,_0x175f7a){return db[_0xf2d0('0x30')][_0xf2d0('0x58')]()['then'](respondWithResult(_0x175f7a,null))[_0xf2d0('0x4b')](handleError(_0x175f7a,null));};exports[_0xf2d0('0x59')]=function(_0x7c3479,_0x42f3fd,_0x294819){var _0x4b4ffa={'raw':!![],'where':{}},_0x3eda9d={},_0x111fcb;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x7c3479[_0xf2d0('0x4d')]['id']}})[_0xf2d0('0x26')](handleEntityNotFound(_0x42f3fd,null))[_0xf2d0('0x26')](function(_0x5bbdff){if(_0x5bbdff){_0x111fcb=_0x5bbdff[_0xf2d0('0x51')]({'plain':!![]});_0x3eda9d[_0xf2d0('0x35')]=_[_0xf2d0('0x38')](db[_0xf2d0('0x5a')][_0xf2d0('0x31')]);_0x3eda9d[_0xf2d0('0x37')]=_['keys'](_0x7c3479[_0xf2d0('0x37')]);_0x3eda9d[_0xf2d0('0x4e')]=_[_0xf2d0('0x3a')](_0x3eda9d['model'],_0x3eda9d[_0xf2d0('0x37')]);_0x4b4ffa[_0xf2d0('0x39')]=_[_0xf2d0('0x3a')](_0x3eda9d['model'],qs[_0xf2d0('0x3b')](_0x7c3479[_0xf2d0('0x37')]['fields']));_0x4b4ffa[_0xf2d0('0x39')]=_0x4b4ffa[_0xf2d0('0x39')]['length']?_0x4b4ffa['attributes']:_0x3eda9d[_0xf2d0('0x35')];if(!_0x7c3479[_0xf2d0('0x37')]['hasOwnProperty'](_0xf2d0('0x3e'))){_0x4b4ffa[_0xf2d0('0x3f')]=qs['limit'](_0x7c3479[_0xf2d0('0x37')][_0xf2d0('0x3f')]);_0x4b4ffa[_0xf2d0('0x1d')]=qs[_0xf2d0('0x1d')](_0x7c3479[_0xf2d0('0x37')]['offset']);}_0x4b4ffa[_0xf2d0('0x40')]=qs[_0xf2d0('0x41')](_0x7c3479[_0xf2d0('0x37')][_0xf2d0('0x41')]);_0x4b4ffa['where']=qs['filters'](_[_0xf2d0('0x42')](_0x7c3479['query'],_0x3eda9d[_0xf2d0('0x4e')]));_0x4b4ffa[_0xf2d0('0x44')][_0xf2d0('0x5b')]=_0x5bbdff['id'];if(_0x7c3479[_0xf2d0('0x37')][_0xf2d0('0x43')]){_0x4b4ffa[_0xf2d0('0x44')]=_['merge'](_0x4b4ffa[_0xf2d0('0x44')],{'$or':_['map'](_0x4b4ffa[_0xf2d0('0x39')],function(_0x26461d){var _0x476003={};_0x476003[_0x26461d]={'$like':'%'+_0x7c3479[_0xf2d0('0x37')]['filter']+'%'};return _0x476003;})});}_0x4b4ffa=_[_0xf2d0('0x45')]({},_0x4b4ffa,_0x7c3479[_0xf2d0('0x47')]);return db[_0xf2d0('0x5a')][_0xf2d0('0x49')](_0x4b4ffa);}})[_0xf2d0('0x26')](function(_0xe94e1){if(_0xe94e1){return db[_0xf2d0('0x5c')][_0xf2d0('0x5d')]({'where':{'id':_['map'](_0xe94e1,_0xf2d0('0x5e')),'role':_0xf2d0('0x5f')},'attributes':['id',_0xf2d0('0x2d'),_0xf2d0('0x60'),_0xf2d0('0x61'),_0xf2d0('0x62')]});}})[_0xf2d0('0x26')](function(_0x160215){if(_0x160215){return{'count':_0x160215[_0xf2d0('0x1f')],'rows':_['map'](_0x160215[_0xf2d0('0x4a')],function(_0x346be4){return{'membername':_0x346be4[_0xf2d0('0x2d')],'UserId':_0x346be4['id'],'queue_name':_0x111fcb[_0xf2d0('0x2d')],'OpenchannelQueueId':_0x111fcb['id'],'interface':util[_0xf2d0('0x63')](_0xf2d0('0x64'),_0xf2d0('0x65'),_0x346be4['name']),'penalty':0x0,'paused':_0x346be4['openchannelPause'],'createdAt':_0x346be4[_0xf2d0('0x62')],'updatedAt':_0x346be4[_0xf2d0('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf2d0('0x26')](respondWithFilteredResult(_0x42f3fd,_0x4b4ffa))['catch'](handleError(_0x42f3fd,null));};exports[_0xf2d0('0x66')]=function(_0x38913a,_0x2c3741,_0x1feea1){var _0x4b7e27={};var _0x3dda96={};var _0x82ee3f;var _0x125286;return db[_0xf2d0('0x30')][_0xf2d0('0x67')]({'where':{'id':_0x38913a[_0xf2d0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2c3741,null))[_0xf2d0('0x26')](function(_0x4de4ee){if(_0x4de4ee){_0x82ee3f=_0x4de4ee;_0x3dda96['model']=_['keys'](db[_0xf2d0('0x68')][_0xf2d0('0x31')]);_0x3dda96[_0xf2d0('0x37')]=_[_0xf2d0('0x38')](_0x38913a['query']);_0x3dda96['filters']=_[_0xf2d0('0x3a')](_0x3dda96['model'],_0x3dda96[_0xf2d0('0x37')]);_0x4b7e27[_0xf2d0('0x39')]=_[_0xf2d0('0x3a')](_0x3dda96['model'],qs[_0xf2d0('0x3b')](_0x38913a[_0xf2d0('0x37')]['fields']));_0x4b7e27[_0xf2d0('0x39')]=_0x4b7e27['attributes'][_0xf2d0('0x3c')]?_0x4b7e27[_0xf2d0('0x39')]:_0x3dda96[_0xf2d0('0x35')];_0x4b7e27[_0xf2d0('0x40')]=qs[_0xf2d0('0x41')](_0x38913a[_0xf2d0('0x37')][_0xf2d0('0x41')]);_0x4b7e27[_0xf2d0('0x44')]=qs['filters'](_[_0xf2d0('0x42')](_0x38913a['query'],_0x3dda96[_0xf2d0('0x4e')]));if(_0x38913a[_0xf2d0('0x37')]['filter']){_0x4b7e27[_0xf2d0('0x44')]=_[_0xf2d0('0x45')](_0x4b7e27['where'],{'$or':_[_0xf2d0('0x36')](_0x4b7e27[_0xf2d0('0x39')],function(_0x567430){var _0x5e432e={};_0x5e432e[_0x567430]={'$like':'%'+_0x38913a[_0xf2d0('0x37')][_0xf2d0('0x43')]+'%'};return _0x5e432e;})});}_0x4b7e27=_[_0xf2d0('0x45')]({},_0x4b7e27,_0x38913a['options']);return _0x82ee3f[_0xf2d0('0x66')](_0x4b7e27);}})['then'](function(_0x59d5aa){if(_0x59d5aa){_0x125286=_0x59d5aa[_0xf2d0('0x3c')];if(!_0x38913a['query']['hasOwnProperty'](_0xf2d0('0x3e'))){_0x4b7e27[_0xf2d0('0x3f')]=qs[_0xf2d0('0x3f')](_0x38913a[_0xf2d0('0x37')][_0xf2d0('0x3f')]);_0x4b7e27['offset']=qs[_0xf2d0('0x1d')](_0x38913a['query'][_0xf2d0('0x1d')]);}return _0x82ee3f[_0xf2d0('0x66')](_0x4b7e27);}})[_0xf2d0('0x26')](function(_0x1c0c05){if(_0x1c0c05){return _0x1c0c05?{'count':_0x125286,'rows':_0x1c0c05}:null;}})[_0xf2d0('0x26')](respondWithResult(_0x2c3741,null))['catch'](handleError(_0x2c3741,null));};exports[_0xf2d0('0x69')]=function(_0x15b2a7,_0x4462e0,_0x220434){var _0x4426e3=_0x15b2a7[_0xf2d0('0x56')][_0xf2d0('0x6a')];return db[_0xf2d0('0x68')]['findAll']({'where':{'id':_0x4426e3},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xf2d0('0x2d'),_0xf2d0('0x6b'),'voicePause',_0xf2d0('0x6c')],'raw':!![]}]})[_0xf2d0('0x26')](function(_0x198f55){if(_0x198f55){var _0x1ac43f=_[_0xf2d0('0x6d')](_0x198f55,function(_0x2702fa){var _0x936b93=_0x2702fa['get']({'plain':!![]});return _0x936b93[_0xf2d0('0x6e')];});return db[_0xf2d0('0x30')][_0xf2d0('0x57')]({'where':{'id':_0x15b2a7[_0xf2d0('0x4d')]['id']}})['then'](function(_0x154966){return db[_0xf2d0('0x6f')]['transaction'](function(_0x183326){return _0x154966[_0xf2d0('0x69')](_0x4426e3,{'transaction':_0x183326})[_0xf2d0('0x26')](function(){return BPromise[_0xf2d0('0x70')](_0x1ac43f,function(_0x53f89f){return db['UserOpenchannelQueue'][_0xf2d0('0x71')]({'where':{'UserId':_0x53f89f['id'],'OpenchannelQueueId':_0x15b2a7[_0xf2d0('0x4d')]['id']},'transaction':_0x183326});});})['then'](function(){_0x1ac43f[_0xf2d0('0x72')](function(_0x221f76){socket[_0xf2d0('0x73')](_0xf2d0('0x74'),{'UserId':_0x221f76['id'],'OpenchannelQueueId':_0x154966['id']});});});});});}})[_0xf2d0('0x26')](respondWithStatusCode(_0x4462e0,null))[_0xf2d0('0x4b')](handleError(_0x4462e0,null));};exports[_0xf2d0('0x75')]=function(_0x2a559f,_0x2fdc57,_0x18a69d){return db[_0xf2d0('0x68')][_0xf2d0('0x49')]({'where':{'id':_0x2a559f[_0xf2d0('0x37')][_0xf2d0('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xf2d0('0x5c')],'as':_0xf2d0('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2fdc57,null))['then'](function(_0x1523f1){var _0x37a8df=_[_0xf2d0('0x36')](_0x1523f1,'id');var _0x47f108=[];var _0x407569=[];var _0xaa9b54=squel[_0xf2d0('0x76')]();_0xaa9b54[_0xf2d0('0x77')](_0xf2d0('0x78'))[_0xf2d0('0x79')]('team_has_openchannel_queues','tq')[_0xf2d0('0x7a')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf2d0('0x44')](_0xf2d0('0x7b'),_0x2a559f[_0xf2d0('0x4d')]['id']);for(var _0x2d288d=0x0;_0x2d288d<_0x1523f1['length'];_0x2d288d+=0x1){let _0x33afec=_0x1523f1[_0x2d288d];for(var _0x3009d1=0x0;_0x3009d1<_0x33afec[_0xf2d0('0x6e')]['length'];_0x3009d1+=0x1){let _0x2e96c6=_0x33afec['Agents'][_0x3009d1];var _0x49f92a=_0xaa9b54[_0xf2d0('0x7c')]();_0x49f92a['where'](_0xf2d0('0x7d'),_0x2e96c6['id']);_0x407569['push'](db[_0xf2d0('0x6f')]['query'](_0x49f92a[_0xf2d0('0x7e')](),{'type':db[_0xf2d0('0x6f')]['QueryTypes'][_0xf2d0('0x7f')]})[_0xf2d0('0x26')](function(_0x292b57){if(_0x292b57[_0xf2d0('0x3c')]===0x1){return _0x2e96c6['id'];}else{var _0x4340bf=_[_0xf2d0('0x80')](_[_0xf2d0('0x36')](_0x292b57,_0xf2d0('0x81')),function(_0x5d03cd){return _[_0xf2d0('0x82')](_0x37a8df,_0x5d03cd);});if(_0x4340bf){return _0x2e96c6['id'];}}}));}}return BPromise['all'](_0x407569)[_0xf2d0('0x26')](function(_0x7e8e9b){_0x47f108=_(_0x47f108)['union'](_0x7e8e9b)['compact']()['value']();return db[_0xf2d0('0x30')][_0xf2d0('0x57')]({'where':{'id':_0x2a559f['params']['id']}})[_0xf2d0('0x26')](function(_0x5909fa){return db[_0xf2d0('0x6f')][_0xf2d0('0x83')](function(_0x4b2946){return _0x5909fa['removeTeams'](_0x2a559f['query'][_0xf2d0('0x6a')],{'transaction':_0x4b2946})[_0xf2d0('0x26')](function(){if(!_[_0xf2d0('0x84')](_0x47f108)){return _0x5909fa[_0xf2d0('0x85')](_0x47f108,{'transaction':_0x4b2946});}})[_0xf2d0('0x26')](function(){_0x47f108[_0xf2d0('0x72')](function(_0x3af087){socket['emit'](_0xf2d0('0x86'),{'UserId':_0x3af087,'OpenchannelQueueId':_0x5909fa['id']});});});});});});})[_0xf2d0('0x26')](respondWithStatusCode(_0x2fdc57,null))[_0xf2d0('0x4b')](handleError(_0x2fdc57,null));};exports['addAgents']=function(_0x291ec5,_0x5573ec,_0x376bd8){return db[_0xf2d0('0x30')][_0xf2d0('0x57')]({'where':{'id':_0x291ec5[_0xf2d0('0x4d')]['id']}})[_0xf2d0('0x26')](handleEntityNotFound(_0x5573ec,null))['then'](function(_0x5c83ef){if(_0x5c83ef){return _0x5c83ef[_0xf2d0('0x87')](_0x291ec5[_0xf2d0('0x56')][_0xf2d0('0x6a')],_['omit'](_0x291ec5[_0xf2d0('0x56')],[_0xf2d0('0x6a'),'id'])||{})[_0xf2d0('0x88')](function(_0x487bfe){for(var _0x56673a=0x0;_0x56673a<_0x291ec5['body'][_0xf2d0('0x6a')][_0xf2d0('0x3c')];_0x56673a+=0x1){socket[_0xf2d0('0x73')](_0xf2d0('0x74'),{'UserId':Number(_0x291ec5[_0xf2d0('0x56')][_0xf2d0('0x6a')][_0x56673a]),'OpenchannelQueueId':Number(_0x291ec5[_0xf2d0('0x4d')]['id'])});}return _0x487bfe;});}})[_0xf2d0('0x26')](respondWithResult(_0x5573ec,null))[_0xf2d0('0x4b')](handleError(_0x5573ec,null));};exports[_0xf2d0('0x85')]=function(_0x4faf19,_0xc1a2d4,_0x2520ff){return db[_0xf2d0('0x30')][_0xf2d0('0x57')]({'where':{'id':_0x4faf19[_0xf2d0('0x4d')]['id']}})[_0xf2d0('0x26')](handleEntityNotFound(_0xc1a2d4,null))[_0xf2d0('0x26')](function(_0x1e6836){if(_0x1e6836){return _0x1e6836[_0xf2d0('0x85')](_0x4faf19[_0xf2d0('0x37')][_0xf2d0('0x6a')])['then'](function(){if(_[_0xf2d0('0x89')](_0x4faf19[_0xf2d0('0x37')]['ids'])){for(var _0x3f0987=0x0;_0x3f0987<_0x4faf19[_0xf2d0('0x37')]['ids'][_0xf2d0('0x3c')];_0x3f0987+=0x1){socket['emit'](_0xf2d0('0x86'),{'UserId':Number(_0x4faf19[_0xf2d0('0x37')][_0xf2d0('0x6a')][_0x3f0987]),'OpenchannelQueueId':Number(_0x4faf19['params']['id'])});}}else{socket[_0xf2d0('0x73')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4faf19[_0xf2d0('0x37')][_0xf2d0('0x6a')]),'OpenchannelQueueId':Number(_0x4faf19['params']['id'])});}});}})[_0xf2d0('0x26')](respondWithStatusCode(_0xc1a2d4,null))[_0xf2d0('0x4b')](handleError(_0xc1a2d4,null));};exports[_0xf2d0('0x8a')]=function(_0x197563,_0x38a644,_0x36929e){var _0xc836f0={};var _0x51a33a={};var _0x39b5d2;var _0x20f3cb;return db[_0xf2d0('0x30')][_0xf2d0('0x67')]({'where':{'id':_0x197563[_0xf2d0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x38a644,null))[_0xf2d0('0x26')](function(_0x354f68){if(_0x354f68){_0x39b5d2=_0x354f68;_0x51a33a[_0xf2d0('0x35')]=_[_0xf2d0('0x38')](db['User'][_0xf2d0('0x31')]);_0x51a33a[_0xf2d0('0x37')]=_[_0xf2d0('0x38')](_0x197563[_0xf2d0('0x37')]);_0x51a33a[_0xf2d0('0x4e')]=_[_0xf2d0('0x3a')](_0x51a33a[_0xf2d0('0x35')],_0x51a33a[_0xf2d0('0x37')]);_0xc836f0[_0xf2d0('0x39')]=_['intersection'](_0x51a33a[_0xf2d0('0x35')],qs[_0xf2d0('0x3b')](_0x197563[_0xf2d0('0x37')][_0xf2d0('0x3b')]));_0xc836f0[_0xf2d0('0x39')]=_0xc836f0[_0xf2d0('0x39')][_0xf2d0('0x3c')]?_0xc836f0[_0xf2d0('0x39')]:_0x51a33a[_0xf2d0('0x35')];_0xc836f0['order']=qs[_0xf2d0('0x41')](_0x197563['query'][_0xf2d0('0x41')]);_0xc836f0[_0xf2d0('0x44')]=qs[_0xf2d0('0x4e')](_[_0xf2d0('0x42')](_0x197563[_0xf2d0('0x37')],_0x51a33a['filters']));if(_0x197563[_0xf2d0('0x37')][_0xf2d0('0x43')]){_0xc836f0[_0xf2d0('0x44')]=_[_0xf2d0('0x45')](_0xc836f0['where'],{'$or':_[_0xf2d0('0x36')](_0xc836f0['attributes'],function(_0x385756){var _0x1be06f={};_0x1be06f[_0x385756]={'$like':'%'+_0x197563[_0xf2d0('0x37')][_0xf2d0('0x43')]+'%'};return _0x1be06f;})});}_0xc836f0=_[_0xf2d0('0x45')]({},_0xc836f0,_0x197563['options']);return _0x39b5d2[_0xf2d0('0x8a')](_0xc836f0);}})[_0xf2d0('0x26')](function(_0x3bb7c9){if(_0x3bb7c9){_0x20f3cb=_0x3bb7c9[_0xf2d0('0x3c')];if(!_0x197563['query'][_0xf2d0('0x3d')]('nolimit')){_0xc836f0['limit']=qs['limit'](_0x197563[_0xf2d0('0x37')][_0xf2d0('0x3f')]);_0xc836f0[_0xf2d0('0x1d')]=qs[_0xf2d0('0x1d')](_0x197563[_0xf2d0('0x37')][_0xf2d0('0x1d')]);}return _0x39b5d2[_0xf2d0('0x8a')](_0xc836f0);}})[_0xf2d0('0x26')](function(_0x444622){if(_0x444622){return _0x444622?{'count':_0x20f3cb,'rows':_0x444622}:null;}})[_0xf2d0('0x26')](respondWithResult(_0x38a644,null))['catch'](handleError(_0x38a644,null));};
\ No newline at end of file
+var _0xb7de=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','then','get','OpenchannelQueues','stack','name','send','OpenchannelQueue','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','pick','User','openchannelPause','createdAt','format','SIP','updatedAt','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','includes','all','compact','value','removeTeams','isEmpty','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x7f6f38,_0x16b0b5){var _0x596e68=function(_0x43fbae){while(--_0x43fbae){_0x7f6f38['push'](_0x7f6f38['shift']());}};_0x596e68(++_0x16b0b5);}(_0xb7de,0x193));var _0xeb7d=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xb7de[_0x1e7b16];return _0x37fadc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb7d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb7d('0x1'));var rp=require(_0xeb7d('0x2'));var moment=require(_0xeb7d('0x3'));var BPromise=require(_0xeb7d('0x4'));var Mustache=require(_0xeb7d('0x5'));var util=require('util');var path=require(_0xeb7d('0x6'));var sox=require(_0xeb7d('0x7'));var csv=require(_0xeb7d('0x8'));var ejs=require(_0xeb7d('0x9'));var fs=require('fs');var fs_extra=require(_0xeb7d('0xa'));var _=require(_0xeb7d('0xb'));var squel=require(_0xeb7d('0xc'));var crypto=require(_0xeb7d('0xd'));var jsforce=require(_0xeb7d('0xe'));var deskjs=require(_0xeb7d('0xf'));var toCsv=require(_0xeb7d('0x8'));var querystring=require('querystring');var Papa=require(_0xeb7d('0x10'));var Redis=require(_0xeb7d('0x11'));var authService=require(_0xeb7d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xeb7d('0x13'));var hardwareService=require(_0xeb7d('0x14'));var logger=require(_0xeb7d('0x15'))(_0xeb7d('0x16'));var utils=require('../../config/utils');var config=require(_0xeb7d('0x17'));var licenseUtil=require(_0xeb7d('0x18'));var db=require(_0xeb7d('0x19'))['db'];config[_0xeb7d('0x1a')]=_[_0xeb7d('0x1b')](config[_0xeb7d('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb7d('0x1c'))(new Redis(config[_0xeb7d('0x1a')]));require(_0xeb7d('0x1d'))['register'](socket);function respondWithStatusCode(_0x47e1a2,_0x3828e7){_0x3828e7=_0x3828e7||0xcc;return function(_0x4157d4){if(_0x4157d4){return _0x47e1a2[_0xeb7d('0x1e')](_0x3828e7);}return _0x47e1a2[_0xeb7d('0x1f')](_0x3828e7)[_0xeb7d('0x20')]();};}function respondWithResult(_0x232a12,_0x191d24){_0x191d24=_0x191d24||0xc8;return function(_0x5467ea){if(_0x5467ea){return _0x232a12[_0xeb7d('0x1f')](_0x191d24)[_0xeb7d('0x21')](_0x5467ea);}};}function respondWithFilteredResult(_0x586c85,_0x327e58){return function(_0x10cb22){if(_0x10cb22){var _0x164d23=typeof _0x327e58['offset']===_0xeb7d('0x22')&&typeof _0x327e58[_0xeb7d('0x23')]===_0xeb7d('0x22');var _0x431c2a=_0x10cb22[_0xeb7d('0x24')];var _0x55c225=_0x164d23?0x0:_0x327e58[_0xeb7d('0x25')];var _0x1d6c2a=_0x164d23?_0x10cb22['count']:_0x327e58['offset']+_0x327e58[_0xeb7d('0x23')];var _0x40c2bf;if(_0x1d6c2a>=_0x431c2a){_0x1d6c2a=_0x431c2a;_0x40c2bf=0xc8;}else{_0x40c2bf=0xce;}_0x586c85[_0xeb7d('0x1f')](_0x40c2bf);return _0x586c85[_0xeb7d('0x26')](_0xeb7d('0x27'),_0x55c225+'-'+_0x1d6c2a+'/'+_0x431c2a)['json'](_0x10cb22);}return null;};}function patchUpdates(_0x1b2bbd){return function(_0x1a8353){try{jsonpatch[_0xeb7d('0x28')](_0x1a8353,_0x1b2bbd,!![]);}catch(_0x906c6a){return BPromise['reject'](_0x906c6a);}return _0x1a8353['save']();};}function saveUpdates(_0x57eef9,_0x1dc447){return function(_0x555c33){if(_0x555c33){return _0x555c33[_0xeb7d('0x29')](_0x57eef9)['then'](function(_0x2bdafd){return _0x2bdafd;});}return null;};}function removeEntity(_0x3b2d09,_0x3500a5){return function(_0x6b33ca){if(_0x6b33ca){return _0x6b33ca[_0xeb7d('0x2a')]()[_0xeb7d('0x2b')](function(){var _0x1584d3=_0x6b33ca[_0xeb7d('0x2c')]({'plain':!![]});var _0x359972=_0xeb7d('0x2d');return db['UserProfileResource'][_0xeb7d('0x2a')]({'where':{'type':_0x359972,'resourceId':_0x1584d3['id']}})[_0xeb7d('0x2b')](function(){return _0x6b33ca;});})[_0xeb7d('0x2b')](function(){_0x3b2d09['status'](0xcc)[_0xeb7d('0x20')]();});}};}function handleEntityNotFound(_0x5bbb25,_0xaec61c){return function(_0x213bcc){if(!_0x213bcc){_0x5bbb25[_0xeb7d('0x1e')](0x194);}return _0x213bcc;};}function handleError(_0x4a0a8d,_0x53e3a8){_0x53e3a8=_0x53e3a8||0x1f4;return function(_0x3328aa){logger['error'](_0x3328aa[_0xeb7d('0x2e')]);if(_0x3328aa['name']){delete _0x3328aa[_0xeb7d('0x2f')];}_0x4a0a8d[_0xeb7d('0x1f')](_0x53e3a8)[_0xeb7d('0x30')](_0x3328aa);};}exports['index']=function(_0xb7968,_0x11f159){var _0xf6144={},_0x5d2d28={},_0x1b857c={'count':0x0,'rows':[]};var _0x17e1f6=_['map'](db[_0xeb7d('0x31')][_0xeb7d('0x32')],function(_0x2b3d80){return{'name':_0x2b3d80['fieldName'],'type':_0x2b3d80[_0xeb7d('0x33')][_0xeb7d('0x34')]};});_0x5d2d28[_0xeb7d('0x35')]=_[_0xeb7d('0x36')](_0x17e1f6,_0xeb7d('0x2f'));_0x5d2d28[_0xeb7d('0x37')]=_['keys'](_0xb7968[_0xeb7d('0x37')]);_0x5d2d28['filters']=_[_0xeb7d('0x38')](_0x5d2d28[_0xeb7d('0x35')],_0x5d2d28[_0xeb7d('0x37')]);_0xf6144[_0xeb7d('0x39')]=_['intersection'](_0x5d2d28[_0xeb7d('0x35')],qs[_0xeb7d('0x3a')](_0xb7968[_0xeb7d('0x37')][_0xeb7d('0x3a')]));_0xf6144[_0xeb7d('0x39')]=_0xf6144[_0xeb7d('0x39')][_0xeb7d('0x3b')]?_0xf6144['attributes']:_0x5d2d28[_0xeb7d('0x35')];if(!_0xb7968[_0xeb7d('0x37')]['hasOwnProperty'](_0xeb7d('0x3c'))){_0xf6144['limit']=qs[_0xeb7d('0x23')](_0xb7968[_0xeb7d('0x37')][_0xeb7d('0x23')]);_0xf6144[_0xeb7d('0x25')]=qs[_0xeb7d('0x25')](_0xb7968[_0xeb7d('0x37')][_0xeb7d('0x25')]);}_0xf6144[_0xeb7d('0x3d')]=qs['sort'](_0xb7968['query'][_0xeb7d('0x3e')]);_0xf6144['where']=qs[_0xeb7d('0x3f')](_['pick'](_0xb7968[_0xeb7d('0x37')],_0x5d2d28[_0xeb7d('0x3f')]),_0x17e1f6);if(_0xb7968[_0xeb7d('0x37')][_0xeb7d('0x40')]){_0xf6144[_0xeb7d('0x41')]=_[_0xeb7d('0x42')](_0xf6144['where'],{'$or':_[_0xeb7d('0x36')](_0x17e1f6,function(_0x3cdee5){if(_0x3cdee5[_0xeb7d('0x33')]!==_0xeb7d('0x43')){var _0x448224={};_0x448224[_0x3cdee5['name']]={'$like':'%'+_0xb7968[_0xeb7d('0x37')][_0xeb7d('0x40')]+'%'};return _0x448224;}})});}_0xf6144=_[_0xeb7d('0x42')]({},_0xf6144,_0xb7968['options']);var _0x30badd={'where':_0xf6144[_0xeb7d('0x41')]};return db[_0xeb7d('0x31')][_0xeb7d('0x24')](_0x30badd)[_0xeb7d('0x2b')](function(_0x1bcebb){_0x1b857c[_0xeb7d('0x24')]=_0x1bcebb;if(_0xb7968['query'][_0xeb7d('0x44')]){_0xf6144[_0xeb7d('0x45')]=[{'all':!![]}];}return db[_0xeb7d('0x31')][_0xeb7d('0x46')](_0xf6144);})[_0xeb7d('0x2b')](function(_0x3004a4){_0x1b857c[_0xeb7d('0x47')]=_0x3004a4;return _0x1b857c;})[_0xeb7d('0x2b')](respondWithFilteredResult(_0x11f159,_0xf6144))[_0xeb7d('0x48')](handleError(_0x11f159,null));};exports[_0xeb7d('0x49')]=function(_0x9f519a,_0x5e6b67){var _0x527771={'raw':!![],'where':{'id':_0x9f519a[_0xeb7d('0x4a')]['id']}},_0x58d306={};_0x58d306[_0xeb7d('0x35')]=_[_0xeb7d('0x4b')](db[_0xeb7d('0x31')][_0xeb7d('0x32')]);_0x58d306[_0xeb7d('0x37')]=_['keys'](_0x9f519a['query']);_0x58d306[_0xeb7d('0x3f')]=_['intersection'](_0x58d306[_0xeb7d('0x35')],_0x58d306[_0xeb7d('0x37')]);_0x527771[_0xeb7d('0x39')]=_[_0xeb7d('0x38')](_0x58d306[_0xeb7d('0x35')],qs[_0xeb7d('0x3a')](_0x9f519a[_0xeb7d('0x37')][_0xeb7d('0x3a')]));_0x527771[_0xeb7d('0x39')]=_0x527771[_0xeb7d('0x39')][_0xeb7d('0x3b')]?_0x527771[_0xeb7d('0x39')]:_0x58d306['model'];if(_0x9f519a[_0xeb7d('0x37')][_0xeb7d('0x44')]){_0x527771[_0xeb7d('0x45')]=[{'all':!![]}];}_0x527771=_['merge']({},_0x527771,_0x9f519a[_0xeb7d('0x4c')]);return db['OpenchannelQueue'][_0xeb7d('0x4d')](_0x527771)[_0xeb7d('0x2b')](handleEntityNotFound(_0x5e6b67,null))['then'](respondWithResult(_0x5e6b67,null))[_0xeb7d('0x48')](handleError(_0x5e6b67,null));};exports['create']=function(_0x2e0033,_0x13e457){return db[_0xeb7d('0x31')][_0xeb7d('0x4e')](_0x2e0033[_0xeb7d('0x4f')],{})[_0xeb7d('0x2b')](function(_0x46e31d){var _0x209805=_0x2e0033[_0xeb7d('0x50')][_0xeb7d('0x2c')]({'plain':!![]});if(!_0x209805)throw new Error(_0xeb7d('0x51'));if(_0x209805[_0xeb7d('0x52')]===_0xeb7d('0x50')){var _0x311377=_0x46e31d['get']({'plain':!![]});var _0x276f2a=_0xeb7d('0x2d');return db[_0xeb7d('0x53')][_0xeb7d('0x4d')]({'where':{'name':_0x276f2a,'userProfileId':_0x209805['userProfileId']},'raw':!![]})['then'](function(_0x351e04){if(_0x351e04&&_0x351e04[_0xeb7d('0x54')]===0x0){return db[_0xeb7d('0x55')][_0xeb7d('0x4e')]({'name':_0x311377['name'],'resourceId':_0x311377['id'],'type':_0x351e04[_0xeb7d('0x2f')],'sectionId':_0x351e04['id']},{})[_0xeb7d('0x2b')](function(){return _0x46e31d;});}else{return _0x46e31d;}})[_0xeb7d('0x48')](function(_0x4a01c1){logger[_0xeb7d('0x56')](_0xeb7d('0x57'),_0x4a01c1);throw _0x4a01c1;});}return _0x46e31d;})[_0xeb7d('0x2b')](respondWithResult(_0x13e457,0xc9))[_0xeb7d('0x48')](handleError(_0x13e457,null));};exports['update']=function(_0x3cb5e0,_0xbdff4b){if(_0x3cb5e0[_0xeb7d('0x4f')]['id']){delete _0x3cb5e0[_0xeb7d('0x4f')]['id'];}return db[_0xeb7d('0x31')][_0xeb7d('0x4d')]({'where':{'id':_0x3cb5e0[_0xeb7d('0x4a')]['id']}})[_0xeb7d('0x2b')](handleEntityNotFound(_0xbdff4b,null))[_0xeb7d('0x2b')](saveUpdates(_0x3cb5e0[_0xeb7d('0x4f')],null))[_0xeb7d('0x2b')](respondWithResult(_0xbdff4b,null))[_0xeb7d('0x48')](handleError(_0xbdff4b,null));};exports[_0xeb7d('0x2a')]=function(_0x243797,_0x1ff682){return db[_0xeb7d('0x31')]['find']({'where':{'id':_0x243797[_0xeb7d('0x4a')]['id']}})[_0xeb7d('0x2b')](handleEntityNotFound(_0x1ff682,null))[_0xeb7d('0x2b')](removeEntity(_0x1ff682,null))['catch'](handleError(_0x1ff682,null));};exports[_0xeb7d('0x58')]=function(_0x37d8b3,_0x34d5ff){return db['OpenchannelQueue'][_0xeb7d('0x58')]()[_0xeb7d('0x2b')](respondWithResult(_0x34d5ff,null))['catch'](handleError(_0x34d5ff,null));};exports[_0xeb7d('0x59')]=function(_0x1c2d13,_0x22b1cf,_0x618359){var _0x5ed10e={'raw':!![],'where':{}},_0x58f266={},_0xddc576;return db['OpenchannelQueue'][_0xeb7d('0x5a')]({'where':{'id':_0x1c2d13[_0xeb7d('0x4a')]['id']}})[_0xeb7d('0x2b')](handleEntityNotFound(_0x22b1cf,null))[_0xeb7d('0x2b')](function(_0x27069d){if(_0x27069d){_0xddc576=_0x27069d[_0xeb7d('0x2c')]({'plain':!![]});_0x58f266[_0xeb7d('0x35')]=_[_0xeb7d('0x4b')](db[_0xeb7d('0x5b')]['rawAttributes']);_0x58f266[_0xeb7d('0x37')]=_[_0xeb7d('0x4b')](_0x1c2d13[_0xeb7d('0x37')]);_0x58f266[_0xeb7d('0x3f')]=_[_0xeb7d('0x38')](_0x58f266['model'],_0x58f266[_0xeb7d('0x37')]);_0x5ed10e[_0xeb7d('0x39')]=_[_0xeb7d('0x38')](_0x58f266[_0xeb7d('0x35')],qs[_0xeb7d('0x3a')](_0x1c2d13['query'][_0xeb7d('0x3a')]));_0x5ed10e[_0xeb7d('0x39')]=_0x5ed10e[_0xeb7d('0x39')]['length']?_0x5ed10e[_0xeb7d('0x39')]:_0x58f266[_0xeb7d('0x35')];if(!_0x1c2d13[_0xeb7d('0x37')][_0xeb7d('0x5c')](_0xeb7d('0x3c'))){_0x5ed10e[_0xeb7d('0x23')]=qs[_0xeb7d('0x23')](_0x1c2d13['query'][_0xeb7d('0x23')]);_0x5ed10e[_0xeb7d('0x25')]=qs[_0xeb7d('0x25')](_0x1c2d13[_0xeb7d('0x37')][_0xeb7d('0x25')]);}_0x5ed10e[_0xeb7d('0x3d')]=qs[_0xeb7d('0x3e')](_0x1c2d13[_0xeb7d('0x37')][_0xeb7d('0x3e')]);_0x5ed10e[_0xeb7d('0x41')]=qs[_0xeb7d('0x3f')](_[_0xeb7d('0x5d')](_0x1c2d13[_0xeb7d('0x37')],_0x58f266[_0xeb7d('0x3f')]));_0x5ed10e['where']['OpenchannelQueueId']=_0x27069d['id'];if(_0x1c2d13['query']['filter']){_0x5ed10e[_0xeb7d('0x41')]=_[_0xeb7d('0x42')](_0x5ed10e[_0xeb7d('0x41')],{'$or':_[_0xeb7d('0x36')](_0x5ed10e['attributes'],function(_0x5c45ae){var _0x23d210={};_0x23d210[_0x5c45ae]={'$like':'%'+_0x1c2d13[_0xeb7d('0x37')][_0xeb7d('0x40')]+'%'};return _0x23d210;})});}_0x5ed10e=_['merge']({},_0x5ed10e,_0x1c2d13[_0xeb7d('0x4c')]);return db[_0xeb7d('0x5b')][_0xeb7d('0x46')](_0x5ed10e);}})[_0xeb7d('0x2b')](function(_0x1fe920){if(_0x1fe920){return db[_0xeb7d('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x1fe920,'UserId'),'role':'agent'},'attributes':['id','name',_0xeb7d('0x5f'),'updatedAt',_0xeb7d('0x60')]});}})[_0xeb7d('0x2b')](function(_0x3ef86d){if(_0x3ef86d){return{'count':_0x3ef86d['count'],'rows':_[_0xeb7d('0x36')](_0x3ef86d['rows'],function(_0x1e8548){return{'membername':_0x1e8548[_0xeb7d('0x2f')],'UserId':_0x1e8548['id'],'queue_name':_0xddc576['name'],'OpenchannelQueueId':_0xddc576['id'],'interface':util[_0xeb7d('0x61')]('%s/%s',_0xeb7d('0x62'),_0x1e8548[_0xeb7d('0x2f')]),'penalty':0x0,'paused':_0x1e8548[_0xeb7d('0x5f')],'createdAt':_0x1e8548[_0xeb7d('0x60')],'updatedAt':_0x1e8548[_0xeb7d('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xeb7d('0x2b')](respondWithFilteredResult(_0x22b1cf,_0x5ed10e))[_0xeb7d('0x48')](handleError(_0x22b1cf,null));};exports[_0xeb7d('0x64')]=function(_0x1fd7f4,_0x16cdcc,_0x3cb3c1){var _0x5021de={};var _0xab9ec5={};var _0x4a5b63;var _0x1732c7;return db[_0xeb7d('0x31')][_0xeb7d('0x5a')]({'where':{'id':_0x1fd7f4[_0xeb7d('0x4a')]['id']}})[_0xeb7d('0x2b')](handleEntityNotFound(_0x16cdcc,null))[_0xeb7d('0x2b')](function(_0x43cfaa){if(_0x43cfaa){_0x4a5b63=_0x43cfaa;_0xab9ec5['model']=_[_0xeb7d('0x4b')](db['Team'][_0xeb7d('0x32')]);_0xab9ec5[_0xeb7d('0x37')]=_[_0xeb7d('0x4b')](_0x1fd7f4[_0xeb7d('0x37')]);_0xab9ec5[_0xeb7d('0x3f')]=_[_0xeb7d('0x38')](_0xab9ec5['model'],_0xab9ec5['query']);_0x5021de['attributes']=_['intersection'](_0xab9ec5[_0xeb7d('0x35')],qs[_0xeb7d('0x3a')](_0x1fd7f4['query'][_0xeb7d('0x3a')]));_0x5021de[_0xeb7d('0x39')]=_0x5021de[_0xeb7d('0x39')][_0xeb7d('0x3b')]?_0x5021de[_0xeb7d('0x39')]:_0xab9ec5[_0xeb7d('0x35')];_0x5021de['order']=qs[_0xeb7d('0x3e')](_0x1fd7f4['query'][_0xeb7d('0x3e')]);_0x5021de['where']=qs[_0xeb7d('0x3f')](_[_0xeb7d('0x5d')](_0x1fd7f4[_0xeb7d('0x37')],_0xab9ec5[_0xeb7d('0x3f')]));if(_0x1fd7f4['query']['filter']){_0x5021de[_0xeb7d('0x41')]=_[_0xeb7d('0x42')](_0x5021de['where'],{'$or':_[_0xeb7d('0x36')](_0x5021de[_0xeb7d('0x39')],function(_0x83ed15){var _0x1c8d25={};_0x1c8d25[_0x83ed15]={'$like':'%'+_0x1fd7f4[_0xeb7d('0x37')][_0xeb7d('0x40')]+'%'};return _0x1c8d25;})});}_0x5021de=_[_0xeb7d('0x42')]({},_0x5021de,_0x1fd7f4[_0xeb7d('0x4c')]);return _0x4a5b63['getTeams'](_0x5021de);}})[_0xeb7d('0x2b')](function(_0x1a9478){if(_0x1a9478){_0x1732c7=_0x1a9478[_0xeb7d('0x3b')];if(!_0x1fd7f4['query'][_0xeb7d('0x5c')](_0xeb7d('0x3c'))){_0x5021de['limit']=qs['limit'](_0x1fd7f4[_0xeb7d('0x37')][_0xeb7d('0x23')]);_0x5021de[_0xeb7d('0x25')]=qs[_0xeb7d('0x25')](_0x1fd7f4[_0xeb7d('0x37')][_0xeb7d('0x25')]);}return _0x4a5b63[_0xeb7d('0x64')](_0x5021de);}})[_0xeb7d('0x2b')](function(_0xc2ad3a){if(_0xc2ad3a){return _0xc2ad3a?{'count':_0x1732c7,'rows':_0xc2ad3a}:null;}})['then'](respondWithResult(_0x16cdcc,null))['catch'](handleError(_0x16cdcc,null));};exports[_0xeb7d('0x65')]=function(_0x9deb71,_0x4c1fa8,_0x370cce){var _0x17961a=_0x9deb71[_0xeb7d('0x4f')][_0xeb7d('0x66')];return db['Team']['findAll']({'where':{'id':_0x17961a},'attributes':['id'],'include':[{'model':db[_0xeb7d('0x5e')],'as':_0xeb7d('0x67'),'attributes':['id',_0xeb7d('0x2f'),_0xeb7d('0x68'),_0xeb7d('0x69'),_0xeb7d('0x6a')],'raw':!![]}]})[_0xeb7d('0x2b')](function(_0xe3319a){if(_0xe3319a){var _0x24519d=_[_0xeb7d('0x6b')](_0xe3319a,function(_0x26c5fc){var _0x2a935a=_0x26c5fc[_0xeb7d('0x2c')]({'plain':!![]});return _0x2a935a[_0xeb7d('0x67')];});return db[_0xeb7d('0x31')][_0xeb7d('0x4d')]({'where':{'id':_0x9deb71[_0xeb7d('0x4a')]['id']}})[_0xeb7d('0x2b')](function(_0x1b175a){return db[_0xeb7d('0x6c')][_0xeb7d('0x6d')](function(_0x2b96c2){return _0x1b175a[_0xeb7d('0x65')](_0x17961a,{'transaction':_0x2b96c2})['then'](function(){return BPromise[_0xeb7d('0x6e')](_0x24519d,function(_0x427f19){return db[_0xeb7d('0x5b')][_0xeb7d('0x6f')]({'where':{'UserId':_0x427f19['id'],'OpenchannelQueueId':_0x9deb71[_0xeb7d('0x4a')]['id']},'transaction':_0x2b96c2});});})[_0xeb7d('0x2b')](function(){_0x24519d['forEach'](function(_0x54aabb){socket[_0xeb7d('0x70')](_0xeb7d('0x71'),{'UserId':_0x54aabb['id'],'OpenchannelQueueId':_0x1b175a['id']});});});});});}})[_0xeb7d('0x2b')](respondWithStatusCode(_0x4c1fa8,null))[_0xeb7d('0x48')](handleError(_0x4c1fa8,null));};exports['removeTeams']=function(_0x1fdddc,_0x2fbbcc,_0x49719c){return db['Team'][_0xeb7d('0x46')]({'where':{'id':_0x1fdddc[_0xeb7d('0x37')][_0xeb7d('0x66')]},'attributes':['id'],'include':[{'model':db[_0xeb7d('0x5e')],'as':_0xeb7d('0x67'),'attributes':['id'],'raw':!![]}]})[_0xeb7d('0x2b')](handleEntityNotFound(_0x2fbbcc,null))[_0xeb7d('0x2b')](function(_0x35061f){var _0x39d316=_[_0xeb7d('0x36')](_0x35061f,'id');var _0x20d926=[];var _0x459954=[];var _0x244e45=squel[_0xeb7d('0x72')]();_0x244e45['field'](_0xeb7d('0x73'))[_0xeb7d('0x74')](_0xeb7d('0x75'),'tq')[_0xeb7d('0x76')](_0xeb7d('0x77'),'ut',_0xeb7d('0x78'))[_0xeb7d('0x41')](_0xeb7d('0x79'),_0x1fdddc[_0xeb7d('0x4a')]['id']);for(var _0x347245=0x0;_0x347245<_0x35061f[_0xeb7d('0x3b')];_0x347245+=0x1){let _0x4da764=_0x35061f[_0x347245];for(var _0x858112=0x0;_0x858112<_0x4da764['Agents'][_0xeb7d('0x3b')];_0x858112+=0x1){let _0x1be5dc=_0x4da764[_0xeb7d('0x67')][_0x858112];var _0x5cc243=_0x244e45[_0xeb7d('0x7a')]();_0x5cc243[_0xeb7d('0x41')](_0xeb7d('0x7b'),_0x1be5dc['id']);_0x459954['push'](db['sequelize'][_0xeb7d('0x37')](_0x5cc243['toString'](),{'type':db[_0xeb7d('0x6c')][_0xeb7d('0x7c')]['SELECT']})[_0xeb7d('0x2b')](function(_0xca59c8){if(_0xca59c8['length']===0x1){return _0x1be5dc['id'];}else{var _0x10ac47=_[_0xeb7d('0x7d')](_[_0xeb7d('0x36')](_0xca59c8,_0xeb7d('0x7e')),function(_0x41808c){return _[_0xeb7d('0x7f')](_0x39d316,_0x41808c);});if(_0x10ac47){return _0x1be5dc['id'];}}}));}}return BPromise[_0xeb7d('0x80')](_0x459954)[_0xeb7d('0x2b')](function(_0x4bf559){_0x20d926=_(_0x20d926)['union'](_0x4bf559)[_0xeb7d('0x81')]()[_0xeb7d('0x82')]();return db[_0xeb7d('0x31')][_0xeb7d('0x4d')]({'where':{'id':_0x1fdddc[_0xeb7d('0x4a')]['id']}})['then'](function(_0x43ccda){return db[_0xeb7d('0x6c')][_0xeb7d('0x6d')](function(_0x2848e0){return _0x43ccda[_0xeb7d('0x83')](_0x1fdddc[_0xeb7d('0x37')]['ids'],{'transaction':_0x2848e0})[_0xeb7d('0x2b')](function(){if(!_[_0xeb7d('0x84')](_0x20d926)){return _0x43ccda['removeAgents'](_0x20d926,{'transaction':_0x2848e0});}})[_0xeb7d('0x2b')](function(){_0x20d926[_0xeb7d('0x85')](function(_0x3456ad){socket[_0xeb7d('0x70')](_0xeb7d('0x86'),{'UserId':_0x3456ad,'OpenchannelQueueId':_0x43ccda['id']});});});});});});})[_0xeb7d('0x2b')](respondWithStatusCode(_0x2fbbcc,null))[_0xeb7d('0x48')](handleError(_0x2fbbcc,null));};exports[_0xeb7d('0x87')]=function(_0x16731e,_0x413ea8,_0x5c5c38){return db['OpenchannelQueue'][_0xeb7d('0x4d')]({'where':{'id':_0x16731e[_0xeb7d('0x4a')]['id']}})[_0xeb7d('0x2b')](handleEntityNotFound(_0x413ea8,null))[_0xeb7d('0x2b')](function(_0x5dcef3){if(_0x5dcef3){return _0x5dcef3[_0xeb7d('0x87')](_0x16731e['body'][_0xeb7d('0x66')],_[_0xeb7d('0x88')](_0x16731e[_0xeb7d('0x4f')],['ids','id'])||{})[_0xeb7d('0x89')](function(_0x46de4d){for(var _0x54f768=0x0;_0x54f768<_0x16731e['body']['ids'][_0xeb7d('0x3b')];_0x54f768+=0x1){socket['emit'](_0xeb7d('0x71'),{'UserId':Number(_0x16731e[_0xeb7d('0x4f')][_0xeb7d('0x66')][_0x54f768]),'OpenchannelQueueId':Number(_0x16731e['params']['id'])});}return _0x46de4d;});}})[_0xeb7d('0x2b')](respondWithResult(_0x413ea8,null))[_0xeb7d('0x48')](handleError(_0x413ea8,null));};exports[_0xeb7d('0x8a')]=function(_0x5c9f71,_0x3449e3,_0x23a255){return db[_0xeb7d('0x31')][_0xeb7d('0x4d')]({'where':{'id':_0x5c9f71[_0xeb7d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3449e3,null))[_0xeb7d('0x2b')](function(_0x31a725){if(_0x31a725){return _0x31a725['removeAgents'](_0x5c9f71[_0xeb7d('0x37')]['ids'])[_0xeb7d('0x2b')](function(){if(_[_0xeb7d('0x8b')](_0x5c9f71[_0xeb7d('0x37')][_0xeb7d('0x66')])){for(var _0x1bc983=0x0;_0x1bc983<_0x5c9f71[_0xeb7d('0x37')][_0xeb7d('0x66')]['length'];_0x1bc983+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x5c9f71[_0xeb7d('0x37')][_0xeb7d('0x66')][_0x1bc983]),'OpenchannelQueueId':Number(_0x5c9f71[_0xeb7d('0x4a')]['id'])});}}else{socket[_0xeb7d('0x70')]('userOpenchannelQueue:remove',{'UserId':Number(_0x5c9f71[_0xeb7d('0x37')][_0xeb7d('0x66')]),'OpenchannelQueueId':Number(_0x5c9f71[_0xeb7d('0x4a')]['id'])});}});}})[_0xeb7d('0x2b')](respondWithStatusCode(_0x3449e3,null))[_0xeb7d('0x48')](handleError(_0x3449e3,null));};exports[_0xeb7d('0x8c')]=function(_0x3a40ed,_0x4ecfe3,_0x4ee176){var _0x4f73e5={};var _0x259c7f={};var _0x335dcb;var _0x3a1a06;return db[_0xeb7d('0x31')][_0xeb7d('0x5a')]({'where':{'id':_0x3a40ed['params']['id']}})[_0xeb7d('0x2b')](handleEntityNotFound(_0x4ecfe3,null))[_0xeb7d('0x2b')](function(_0x1c5dfb){if(_0x1c5dfb){_0x335dcb=_0x1c5dfb;_0x259c7f[_0xeb7d('0x35')]=_[_0xeb7d('0x4b')](db['User'][_0xeb7d('0x32')]);_0x259c7f['query']=_[_0xeb7d('0x4b')](_0x3a40ed[_0xeb7d('0x37')]);_0x259c7f[_0xeb7d('0x3f')]=_[_0xeb7d('0x38')](_0x259c7f[_0xeb7d('0x35')],_0x259c7f[_0xeb7d('0x37')]);_0x4f73e5[_0xeb7d('0x39')]=_[_0xeb7d('0x38')](_0x259c7f[_0xeb7d('0x35')],qs[_0xeb7d('0x3a')](_0x3a40ed[_0xeb7d('0x37')]['fields']));_0x4f73e5[_0xeb7d('0x39')]=_0x4f73e5['attributes'][_0xeb7d('0x3b')]?_0x4f73e5[_0xeb7d('0x39')]:_0x259c7f[_0xeb7d('0x35')];_0x4f73e5['order']=qs[_0xeb7d('0x3e')](_0x3a40ed[_0xeb7d('0x37')]['sort']);_0x4f73e5[_0xeb7d('0x41')]=qs['filters'](_[_0xeb7d('0x5d')](_0x3a40ed[_0xeb7d('0x37')],_0x259c7f[_0xeb7d('0x3f')]));if(_0x3a40ed[_0xeb7d('0x37')][_0xeb7d('0x40')]){_0x4f73e5['where']=_[_0xeb7d('0x42')](_0x4f73e5['where'],{'$or':_['map'](_0x4f73e5['attributes'],function(_0x129077){var _0x128644={};_0x128644[_0x129077]={'$like':'%'+_0x3a40ed[_0xeb7d('0x37')][_0xeb7d('0x40')]+'%'};return _0x128644;})});}_0x4f73e5=_['merge']({},_0x4f73e5,_0x3a40ed['options']);return _0x335dcb[_0xeb7d('0x8c')](_0x4f73e5);}})['then'](function(_0x1cf679){if(_0x1cf679){_0x3a1a06=_0x1cf679['length'];if(!_0x3a40ed['query'][_0xeb7d('0x5c')](_0xeb7d('0x3c'))){_0x4f73e5[_0xeb7d('0x23')]=qs[_0xeb7d('0x23')](_0x3a40ed[_0xeb7d('0x37')]['limit']);_0x4f73e5['offset']=qs[_0xeb7d('0x25')](_0x3a40ed['query']['offset']);}return _0x335dcb['getAgents'](_0x4f73e5);}})[_0xeb7d('0x2b')](function(_0x474456){if(_0x474456){return _0x474456?{'count':_0x3a1a06,'rows':_0x474456}:null;}})[_0xeb7d('0x2b')](respondWithResult(_0x4ecfe3,null))[_0xeb7d('0x48')](handleError(_0x4ecfe3,null));};
\ No newline at end of file
index bbd4406..7753ea5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa4a=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xf7118,_0x4a5d17){var _0x2a481c=function(_0x408639){while(--_0x408639){_0xf7118['push'](_0xf7118['shift']());}};_0x2a481c(++_0x4a5d17);}(_0xaa4a,0x9b));var _0xaaa4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xaa4a[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0xaaa4('0x0'));var OpenchannelQueue=require(_0xaaa4('0x1'))['db'][_0xaaa4('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xaaa4('0x3')](0x0);var events={'afterCreate':_0xaaa4('0x4'),'afterUpdate':_0xaaa4('0x5'),'afterDestroy':_0xaaa4('0x6')};function emitEvent(_0x5d8071){return function(_0x2c36d1,_0x469c2c,_0x2fb481){OpenchannelQueueEvents['emit'](_0x5d8071+':'+_0x2c36d1['id'],_0x2c36d1);OpenchannelQueueEvents[_0xaaa4('0x7')](_0x5d8071,_0x2c36d1);_0x2fb481(null);};}for(var e in events){if(events[_0xaaa4('0x8')](e)){var event=events[e];OpenchannelQueue[_0xaaa4('0x9')](e,emitEvent(event));}}module[_0xaaa4('0xa')]=OpenchannelQueueEvents;
\ No newline at end of file
+var _0x866d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x42639d,_0x2d1f80){var _0x390dff=function(_0x1c742f){while(--_0x1c742f){_0x42639d['push'](_0x42639d['shift']());}};_0x390dff(++_0x2d1f80);}(_0x866d,0x110));var _0xd866=function(_0x17e653,_0x4c21e9){_0x17e653=_0x17e653-0x0;var _0x4341a1=_0x866d[_0x17e653];return _0x4341a1;};'use strict';var EventEmitter=require(_0xd866('0x0'));var OpenchannelQueue=require(_0xd866('0x1'))['db'][_0xd866('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd866('0x3')](0x0);var events={'afterCreate':_0xd866('0x4'),'afterUpdate':_0xd866('0x5'),'afterDestroy':_0xd866('0x6')};function emitEvent(_0x3312bd){return function(_0x5ac8e8,_0x3f4bfc,_0x77469b){OpenchannelQueueEvents[_0xd866('0x7')](_0x3312bd+':'+_0x5ac8e8['id'],_0x5ac8e8);OpenchannelQueueEvents[_0xd866('0x7')](_0x3312bd,_0x5ac8e8);_0x77469b(null);};}for(var e in events){if(events[_0xd866('0x8')](e)){var event=events[e];OpenchannelQueue[_0xd866('0x9')](e,emitEvent(event));}}module[_0xd866('0xa')]=OpenchannelQueueEvents;
\ No newline at end of file
index 729037d..09d2506 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3597=['define','OpenchannelQueue','openchannel_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0x3597,0x8f));var _0x7359=function(_0x36f3cd,_0x37c8c8){_0x36f3cd=_0x36f3cd-0x0;var _0x4e64d8=_0x3597[_0x36f3cd];return _0x4e64d8;};'use strict';var _=require(_0x7359('0x0'));var util=require(_0x7359('0x1'));var logger=require('../../config/logger')(_0x7359('0x2'));var moment=require(_0x7359('0x3'));var BPromise=require(_0x7359('0x4'));var rp=require(_0x7359('0x5'));var fs=require('fs');var path=require(_0x7359('0x6'));var rimraf=require(_0x7359('0x7'));var config=require(_0x7359('0x8'));var attributes=require(_0x7359('0x9'));module[_0x7359('0xa')]=function(_0x2fd3ea,_0x280fec){return _0x2fd3ea[_0x7359('0xb')](_0x7359('0xc'),attributes,{'tableName':_0x7359('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8a75=['bluebird','path','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x8a75,0x14d));var _0x58a7=function(_0x488f43,_0xd66a5e){_0x488f43=_0x488f43-0x0;var _0x242eb9=_0x8a75[_0x488f43];return _0x242eb9;};'use strict';var _=require(_0x58a7('0x0'));var util=require(_0x58a7('0x1'));var logger=require(_0x58a7('0x2'))(_0x58a7('0x3'));var moment=require(_0x58a7('0x4'));var BPromise=require(_0x58a7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x58a7('0x6'));var rimraf=require('rimraf');var config=require(_0x58a7('0x7'));var attributes=require(_0x58a7('0x8'));module[_0x58a7('0x9')]=function(_0x45e008,_0x3ce76e){return _0x45e008[_0x58a7('0xa')](_0x58a7('0xb'),attributes,{'tableName':_0x58a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4b2ce2c..ac6b13b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x39e5=['message','result','catch','OpenchannelQueue','findAll','options','raw','where','limit','include','map','model','attributes','GetOpenchannelQueue','debug','ShowOpenchannelQueue','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39e5,0xdd));var _0x539e=function(_0x5c06be,_0x5a2b3d){_0x5c06be=_0x5c06be-0x0;var _0x258f20=_0x39e5[_0x5c06be];return _0x258f20;};'use strict';var _=require(_0x539e('0x0'));var util=require('util');var moment=require(_0x539e('0x1'));var BPromise=require(_0x539e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x539e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x539e('0x4'));var logger=require('../../config/logger')(_0x539e('0x5'));var config=require(_0x539e('0x6'));var jayson=require(_0x539e('0x7'));var client=jayson[_0x539e('0x8')][_0x539e('0x9')]({'port':0x232a});config[_0x539e('0xa')]=_[_0x539e('0xb')](config[_0x539e('0xa')],{'host':_0x539e('0xc'),'port':0x18eb});var socket=require(_0x539e('0xd'))(new Redis(config[_0x539e('0xa')]));require(_0x539e('0xe'))[_0x539e('0xf')](socket);function respondWithRpcPromise(_0x1c599a,_0x48386a,_0x92cd6e){return new BPromise(function(_0x100385,_0x1580e3){return client[_0x539e('0x10')](_0x1c599a,_0x92cd6e)[_0x539e('0x11')](function(_0x2d9975){logger[_0x539e('0x12')](_0x539e('0x13'),_0x48386a,_0x539e('0x14'));logger['debug'](_0x539e('0x15'),_0x48386a,_0x539e('0x14'),JSON[_0x539e('0x16')](_0x2d9975));if(_0x2d9975[_0x539e('0x17')]){if(_0x2d9975['error'][_0x539e('0x18')]===0x1f4){logger[_0x539e('0x17')](_0x539e('0x13'),_0x48386a,_0x2d9975[_0x539e('0x17')]['message']);return _0x1580e3(_0x2d9975['error'][_0x539e('0x19')]);}logger[_0x539e('0x17')](_0x539e('0x13'),_0x48386a,_0x2d9975[_0x539e('0x17')][_0x539e('0x19')]);return _0x100385(_0x2d9975[_0x539e('0x17')][_0x539e('0x19')]);}else{logger['info'](_0x539e('0x13'),_0x48386a,_0x539e('0x14'));_0x100385(_0x2d9975[_0x539e('0x1a')]['message']);}})[_0x539e('0x1b')](function(_0x3b7f5c){logger[_0x539e('0x17')](_0x539e('0x13'),_0x48386a,_0x3b7f5c);_0x1580e3(_0x3b7f5c);});});}exports['GetOpenchannelQueue']=function(_0x528be1){var _0x258018=this;return new Promise(function(_0x1b1356,_0x46fe1c){return db[_0x539e('0x1c')][_0x539e('0x1d')]({'raw':_0x528be1[_0x539e('0x1e')]?_0x528be1['options'][_0x539e('0x1f')]===undefined?!![]:![]:!![],'where':_0x528be1[_0x539e('0x1e')]?_0x528be1[_0x539e('0x1e')][_0x539e('0x20')]||null:null,'attributes':_0x528be1[_0x539e('0x1e')]?_0x528be1[_0x539e('0x1e')]['attributes']||null:null,'limit':_0x528be1[_0x539e('0x1e')]?_0x528be1[_0x539e('0x1e')][_0x539e('0x21')]||null:null,'include':_0x528be1[_0x539e('0x1e')]?_0x528be1[_0x539e('0x1e')][_0x539e('0x22')]?_[_0x539e('0x23')](_0x528be1[_0x539e('0x1e')][_0x539e('0x22')],function(_0x12e561){return{'model':db[_0x12e561[_0x539e('0x24')]],'as':_0x12e561['as'],'attributes':_0x12e561['attributes'],'include':_0x12e561[_0x539e('0x22')]?_['map'](_0x12e561[_0x539e('0x22')],function(_0x952518){return{'model':db[_0x952518['model']],'as':_0x952518['as'],'attributes':_0x952518[_0x539e('0x25')],'include':_0x952518['include']?_[_0x539e('0x23')](_0x952518[_0x539e('0x22')],function(_0x1f9966){return{'model':db[_0x1f9966[_0x539e('0x24')]],'as':_0x1f9966['as'],'attributes':_0x1f9966[_0x539e('0x25')]};}):[]};}):[]};}):[]:[]})[_0x539e('0x11')](function(_0x2ff0fb){logger[_0x539e('0x12')](_0x539e('0x26'),_0x528be1);logger[_0x539e('0x27')](_0x539e('0x26'),_0x528be1,JSON[_0x539e('0x16')](_0x2ff0fb));_0x1b1356(_0x2ff0fb);})[_0x539e('0x1b')](function(_0x574ddf){logger[_0x539e('0x17')]('GetOpenchannelQueue',_0x574ddf['message'],_0x528be1);_0x46fe1c(_0x258018['error'](0x1f4,_0x574ddf[_0x539e('0x19')]));});});};exports[_0x539e('0x28')]=function(_0x125f99){var _0x1697b0=this;return new Promise(function(_0x1f4ae5,_0x13aea2){return db[_0x539e('0x1c')]['find']({'raw':_0x125f99[_0x539e('0x1e')]?_0x125f99[_0x539e('0x1e')][_0x539e('0x1f')]===undefined?!![]:![]:!![],'where':_0x125f99['options']?_0x125f99[_0x539e('0x1e')]['where']||null:null,'attributes':_0x125f99[_0x539e('0x1e')]?_0x125f99[_0x539e('0x1e')]['attributes']||null:null,'include':_0x125f99[_0x539e('0x1e')]?_0x125f99['options'][_0x539e('0x22')]?_[_0x539e('0x23')](_0x125f99[_0x539e('0x1e')]['include'],function(_0x705236){return{'model':db[_0x705236[_0x539e('0x24')]],'as':_0x705236['as'],'attributes':_0x705236['attributes'],'include':_0x705236[_0x539e('0x22')]?_[_0x539e('0x23')](_0x705236[_0x539e('0x22')],function(_0x33da70){return{'model':db[_0x33da70[_0x539e('0x24')]],'as':_0x33da70['as'],'attributes':_0x33da70['attributes'],'include':_0x33da70[_0x539e('0x22')]?_[_0x539e('0x23')](_0x33da70[_0x539e('0x22')],function(_0x3ca830){return{'model':db[_0x3ca830['model']],'as':_0x3ca830['as'],'attributes':_0x3ca830[_0x539e('0x25')]};}):[]};}):[]};}):[]:[]})[_0x539e('0x11')](function(_0x51519c){logger['info']('ShowOpenchannelQueue',_0x125f99);logger[_0x539e('0x27')](_0x539e('0x28'),_0x125f99,JSON[_0x539e('0x16')](_0x51519c));_0x1f4ae5(_0x51519c);})[_0x539e('0x1b')](function(_0xce4a43){logger['error'](_0x539e('0x28'),_0xce4a43[_0x539e('0x19')],_0x125f99);_0x13aea2(_0x1697b0[_0x539e('0x17')](0x1f4,_0xce4a43[_0x539e('0x19')]));});});};
\ No newline at end of file
+var _0xa68a=['ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','limit','include','map','model','attributes'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xa68a,0x7d));var _0xaa68=function(_0x54298d,_0x18ce66){_0x54298d=_0x54298d-0x0;var _0x340b39=_0xa68a[_0x54298d];return _0x340b39;};'use strict';var _=require(_0xaa68('0x0'));var util=require(_0xaa68('0x1'));var moment=require(_0xaa68('0x2'));var BPromise=require(_0xaa68('0x3'));var rs=require(_0xaa68('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa68('0x5'))['db'];var utils=require(_0xaa68('0x6'));var logger=require('../../config/logger')(_0xaa68('0x7'));var config=require(_0xaa68('0x8'));var jayson=require(_0xaa68('0x9'));var client=jayson[_0xaa68('0xa')][_0xaa68('0xb')]({'port':0x232a});config[_0xaa68('0xc')]=_[_0xaa68('0xd')](config[_0xaa68('0xc')],{'host':_0xaa68('0xe'),'port':0x18eb});var socket=require(_0xaa68('0xf'))(new Redis(config['redis']));require(_0xaa68('0x10'))[_0xaa68('0x11')](socket);function respondWithRpcPromise(_0x205e05,_0x251d8f,_0x2e4187){return new BPromise(function(_0x431055,_0x7f902){return client[_0xaa68('0x12')](_0x205e05,_0x2e4187)[_0xaa68('0x13')](function(_0x5b454b){logger[_0xaa68('0x14')](_0xaa68('0x15'),_0x251d8f,'request\x20sent');logger[_0xaa68('0x16')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x251d8f,'request\x20sent',JSON[_0xaa68('0x17')](_0x5b454b));if(_0x5b454b[_0xaa68('0x18')]){if(_0x5b454b[_0xaa68('0x18')]['code']===0x1f4){logger[_0xaa68('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x251d8f,_0x5b454b[_0xaa68('0x18')][_0xaa68('0x19')]);return _0x7f902(_0x5b454b['error'][_0xaa68('0x19')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x251d8f,_0x5b454b[_0xaa68('0x18')]['message']);return _0x431055(_0x5b454b[_0xaa68('0x18')][_0xaa68('0x19')]);}else{logger[_0xaa68('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x251d8f,_0xaa68('0x1a'));_0x431055(_0x5b454b[_0xaa68('0x1b')][_0xaa68('0x19')]);}})[_0xaa68('0x1c')](function(_0x5bb84a){logger[_0xaa68('0x18')](_0xaa68('0x15'),_0x251d8f,_0x5bb84a);_0x7f902(_0x5bb84a);});});}exports[_0xaa68('0x1d')]=function(_0x249fab){var _0x562ba8=this;return new Promise(function(_0x30253f,_0x21f756){return db[_0xaa68('0x1e')]['findAll']({'raw':_0x249fab[_0xaa68('0x1f')]?_0x249fab['options'][_0xaa68('0x20')]===undefined?!![]:![]:!![],'where':_0x249fab[_0xaa68('0x1f')]?_0x249fab[_0xaa68('0x1f')][_0xaa68('0x21')]||null:null,'attributes':_0x249fab[_0xaa68('0x1f')]?_0x249fab[_0xaa68('0x1f')]['attributes']||null:null,'limit':_0x249fab[_0xaa68('0x1f')]?_0x249fab['options'][_0xaa68('0x22')]||null:null,'include':_0x249fab[_0xaa68('0x1f')]?_0x249fab['options'][_0xaa68('0x23')]?_[_0xaa68('0x24')](_0x249fab[_0xaa68('0x1f')][_0xaa68('0x23')],function(_0x18daaf){return{'model':db[_0x18daaf[_0xaa68('0x25')]],'as':_0x18daaf['as'],'attributes':_0x18daaf[_0xaa68('0x26')],'include':_0x18daaf['include']?_[_0xaa68('0x24')](_0x18daaf[_0xaa68('0x23')],function(_0x3ebedb){return{'model':db[_0x3ebedb[_0xaa68('0x25')]],'as':_0x3ebedb['as'],'attributes':_0x3ebedb[_0xaa68('0x26')],'include':_0x3ebedb['include']?_['map'](_0x3ebedb[_0xaa68('0x23')],function(_0xda09b2){return{'model':db[_0xda09b2[_0xaa68('0x25')]],'as':_0xda09b2['as'],'attributes':_0xda09b2[_0xaa68('0x26')]};}):[]};}):[]};}):[]:[]})[_0xaa68('0x13')](function(_0x24ba62){logger['info'](_0xaa68('0x1d'),_0x249fab);logger[_0xaa68('0x16')](_0xaa68('0x1d'),_0x249fab,JSON['stringify'](_0x24ba62));_0x30253f(_0x24ba62);})[_0xaa68('0x1c')](function(_0x48ecd8){logger[_0xaa68('0x18')](_0xaa68('0x1d'),_0x48ecd8[_0xaa68('0x19')],_0x249fab);_0x21f756(_0x562ba8[_0xaa68('0x18')](0x1f4,_0x48ecd8[_0xaa68('0x19')]));});});};exports[_0xaa68('0x27')]=function(_0x1b98d9){var _0xf40e97=this;return new Promise(function(_0x944d99,_0x3c0e2e){return db['OpenchannelQueue'][_0xaa68('0x28')]({'raw':_0x1b98d9[_0xaa68('0x1f')]?_0x1b98d9[_0xaa68('0x1f')][_0xaa68('0x20')]===undefined?!![]:![]:!![],'where':_0x1b98d9[_0xaa68('0x1f')]?_0x1b98d9[_0xaa68('0x1f')][_0xaa68('0x21')]||null:null,'attributes':_0x1b98d9['options']?_0x1b98d9['options'][_0xaa68('0x26')]||null:null,'include':_0x1b98d9[_0xaa68('0x1f')]?_0x1b98d9[_0xaa68('0x1f')]['include']?_['map'](_0x1b98d9['options'][_0xaa68('0x23')],function(_0x386565){return{'model':db[_0x386565[_0xaa68('0x25')]],'as':_0x386565['as'],'attributes':_0x386565[_0xaa68('0x26')],'include':_0x386565['include']?_[_0xaa68('0x24')](_0x386565[_0xaa68('0x23')],function(_0x390dc7){return{'model':db[_0x390dc7[_0xaa68('0x25')]],'as':_0x390dc7['as'],'attributes':_0x390dc7[_0xaa68('0x26')],'include':_0x390dc7[_0xaa68('0x23')]?_[_0xaa68('0x24')](_0x390dc7['include'],function(_0x4c362c){return{'model':db[_0x4c362c[_0xaa68('0x25')]],'as':_0x4c362c['as'],'attributes':_0x4c362c[_0xaa68('0x26')]};}):[]};}):[]};}):[]:[]})[_0xaa68('0x13')](function(_0x2a22ac){logger['info']('ShowOpenchannelQueue',_0x1b98d9);logger[_0xaa68('0x16')]('ShowOpenchannelQueue',_0x1b98d9,JSON[_0xaa68('0x17')](_0x2a22ac));_0x944d99(_0x2a22ac);})['catch'](function(_0x2bc485){logger['error']('ShowOpenchannelQueue',_0x2bc485['message'],_0x1b98d9);_0x3c0e2e(_0xf40e97['error'](0x1f4,_0x2bc485[_0xaa68('0x19')]));});});};
\ No newline at end of file
index 8ddff28..4b8ca00 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3cdb=['removeListener','register','openchannelQueue:','./openchannelQueue.events','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3cdb,0xf3));var _0xb3cd=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0x3cdb[_0xd1b4d7];return _0x3002ec;};'use strict';var OpenchannelQueueEvents=require(_0xb3cd('0x0'));var events=['save',_0xb3cd('0x1'),_0xb3cd('0x2')];function createListener(_0x5c7d8c,_0x38192b){return function(_0x2331c0){_0x38192b['emit'](_0x5c7d8c,_0x2331c0);};}function removeListener(_0x4017c5,_0x249a76){return function(){OpenchannelQueueEvents[_0xb3cd('0x3')](_0x4017c5,_0x249a76);};}exports[_0xb3cd('0x4')]=function(_0x1a6b98){for(var _0x40d530=0x0,_0x3a7c7a=events['length'];_0x40d530<_0x3a7c7a;_0x40d530++){var _0x4d4976=events[_0x40d530];var _0x57f3cc=createListener(_0xb3cd('0x5')+_0x4d4976,_0x1a6b98);OpenchannelQueueEvents['on'](_0x4d4976,_0x57f3cc);}};
\ No newline at end of file
+var _0xf2cd=['save','remove','update','emit','removeListener','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x15bb4e,_0x3cfaf4){var _0x43acbd=function(_0xc9c46d){while(--_0xc9c46d){_0x15bb4e['push'](_0x15bb4e['shift']());}};_0x43acbd(++_0x3cfaf4);}(_0xf2cd,0x127));var _0xdf2c=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0xf2cd[_0x5f5cce];return _0x705ecf;};'use strict';var OpenchannelQueueEvents=require(_0xdf2c('0x0'));var events=[_0xdf2c('0x1'),_0xdf2c('0x2'),_0xdf2c('0x3')];function createListener(_0x402cbb,_0xeceb31){return function(_0x2305fc){_0xeceb31[_0xdf2c('0x4')](_0x402cbb,_0x2305fc);};}function removeListener(_0x29766f,_0x75642e){return function(){OpenchannelQueueEvents[_0xdf2c('0x5')](_0x29766f,_0x75642e);};}exports['register']=function(_0x50140f){for(var _0x414178=0x0,_0x3193dc=events[_0xdf2c('0x6')];_0x414178<_0x3193dc;_0x414178++){var _0x5461e3=events[_0x414178];var _0x27d14a=createListener(_0xdf2c('0x7')+_0x5461e3,_0x50140f);OpenchannelQueueEvents['on'](_0x5461e3,_0x27d14a);}};
\ No newline at end of file
index dafd217..f206972 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x40fa=['./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xe674f4,_0x5aa3bd){var _0x42aaf6=function(_0x28639e){while(--_0x28639e){_0xe674f4['push'](_0xe674f4['shift']());}};_0x42aaf6(++_0x5aa3bd);}(_0x40fa,0x64));var _0xa40f=function(_0x44ac59,_0x4b354b){_0x44ac59=_0x44ac59-0x0;var _0x47cc65=_0x40fa[_0x44ac59];return _0x47cc65;};'use strict';var multer=require(_0xa40f('0x0'));var util=require(_0xa40f('0x1'));var path=require(_0xa40f('0x2'));var timeout=require(_0xa40f('0x3'));var express=require(_0xa40f('0x4'));var router=express[_0xa40f('0x5')]();var fs_extra=require(_0xa40f('0x6'));var auth=require(_0xa40f('0x7'));var interaction=require(_0xa40f('0x8'));var config=require(_0xa40f('0x9'));var controller=require(_0xa40f('0xa'));router[_0xa40f('0xb')]('/',auth[_0xa40f('0xc')](),controller['index']);router[_0xa40f('0xb')](_0xa40f('0xd'),auth['isAuthenticated'](),controller[_0xa40f('0xe')]);router[_0xa40f('0xb')]('/:id',auth[_0xa40f('0xc')](),controller[_0xa40f('0xf')]);router[_0xa40f('0x10')]('/',auth[_0xa40f('0xc')](),controller[_0xa40f('0x11')]);router[_0xa40f('0x12')](_0xa40f('0x13'),auth[_0xa40f('0xc')](),controller['update']);router[_0xa40f('0x14')](_0xa40f('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0xa40f('0x15')]=router;
\ No newline at end of file
+var _0x589a=['isAuthenticated','index','/describe','show','create','put','/:id','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get'];(function(_0x70ea71,_0xff9c0a){var _0x380d58=function(_0x167421){while(--_0x167421){_0x70ea71['push'](_0x70ea71['shift']());}};_0x380d58(++_0xff9c0a);}(_0x589a,0xf6));var _0xa589=function(_0x5162ae,_0x5d23ee){_0x5162ae=_0x5162ae-0x0;var _0x19b097=_0x589a[_0x5162ae];return _0x19b097;};'use strict';var multer=require(_0xa589('0x0'));var util=require(_0xa589('0x1'));var path=require(_0xa589('0x2'));var timeout=require('connect-timeout');var express=require(_0xa589('0x3'));var router=express[_0xa589('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa589('0x5'));var interaction=require(_0xa589('0x6'));var config=require('../../config/environment');var controller=require(_0xa589('0x7'));router[_0xa589('0x8')]('/',auth[_0xa589('0x9')](),controller[_0xa589('0xa')]);router[_0xa589('0x8')](_0xa589('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xa589('0x8')]('/:id',auth[_0xa589('0x9')](),controller[_0xa589('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa589('0xd')]);router[_0xa589('0xe')](_0xa589('0xf'),auth[_0xa589('0x9')](),controller['update']);router['delete'](_0xa589('0xf'),auth[_0xa589('0x9')](),controller[_0xa589('0x10')]);module['exports']=router;
\ No newline at end of file
index bd4d9f3..9fcf489 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc298=['DATE','moment','sequelize','exports','STRING'];(function(_0x4095ae,_0x33935f){var _0x533298=function(_0x51791d){while(--_0x51791d){_0x4095ae['push'](_0x4095ae['shift']());}};_0x533298(++_0x33935f);}(_0xc298,0x1c3));var _0x8c29=function(_0x433323,_0x382943){_0x433323=_0x433323-0x0;var _0x2e36bf=_0xc298[_0x433323];return _0x2e36bf;};'use strict';var moment=require(_0x8c29('0x0'));var Sequelize=require(_0x8c29('0x1'));module[_0x8c29('0x2')]={'uniqueid':{'type':Sequelize[_0x8c29('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8c29('0x3')]},'joinAt':{'type':Sequelize[_0x8c29('0x4')]},'leaveAt':{'type':Sequelize[_0x8c29('0x4')]},'acceptAt':{'type':Sequelize[_0x8c29('0x4')]},'exitAt':{'type':Sequelize[_0x8c29('0x4')]},'reason':{'type':Sequelize[_0x8c29('0x3')]}};
\ No newline at end of file
+var _0x1f27=['STRING','DATE','moment','sequelize','exports'];(function(_0x57a016,_0x2e467d){var _0x59acbc=function(_0x23f38b){while(--_0x23f38b){_0x57a016['push'](_0x57a016['shift']());}};_0x59acbc(++_0x2e467d);}(_0x1f27,0x13d));var _0x71f2=function(_0x3645ab,_0x33547b){_0x3645ab=_0x3645ab-0x0;var _0x3649d2=_0x1f27[_0x3645ab];return _0x3649d2;};'use strict';var moment=require(_0x71f2('0x0'));var Sequelize=require(_0x71f2('0x1'));module[_0x71f2('0x2')]={'uniqueid':{'type':Sequelize[_0x71f2('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x71f2('0x3')]},'joinAt':{'type':Sequelize[_0x71f2('0x4')]},'leaveAt':{'type':Sequelize[_0x71f2('0x4')]},'acceptAt':{'type':Sequelize[_0x71f2('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 86b62ea..733f5d5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf4ad=['create','body','find','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','findAll','rows','catch','show','params','keys','includeAll'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xf4ad,0x1ae));var _0xdf4a=function(_0xf2d1bf,_0x19c53a){_0xf2d1bf=_0xf2d1bf-0x0;var _0x388d2c=_0xf4ad[_0xf2d1bf];return _0x388d2c;};'use strict';var emlformat=require(_0xdf4a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf4a('0x1'));var jsonpatch=require(_0xdf4a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdf4a('0x3'));var Mustache=require(_0xdf4a('0x4'));var util=require(_0xdf4a('0x5'));var path=require('path');var sox=require(_0xdf4a('0x6'));var csv=require(_0xdf4a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf4a('0x8'));var _=require(_0xdf4a('0x9'));var squel=require(_0xdf4a('0xa'));var crypto=require('crypto');var jsforce=require(_0xdf4a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdf4a('0xc'));var Papa=require(_0xdf4a('0xd'));var Redis=require(_0xdf4a('0xe'));var authService=require(_0xdf4a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf4a('0x10'));var logger=require(_0xdf4a('0x11'))(_0xdf4a('0x12'));var utils=require('../../config/utils');var config=require(_0xdf4a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf4a('0x14'))['db'];function respondWithStatusCode(_0x5a3956,_0x17defd){_0x17defd=_0x17defd||0xcc;return function(_0x96dac6){if(_0x96dac6){return _0x5a3956[_0xdf4a('0x15')](_0x17defd);}return _0x5a3956[_0xdf4a('0x16')](_0x17defd)[_0xdf4a('0x17')]();};}function respondWithResult(_0xf925cf,_0x58701d){_0x58701d=_0x58701d||0xc8;return function(_0x200d35){if(_0x200d35){return _0xf925cf['status'](_0x58701d)[_0xdf4a('0x18')](_0x200d35);}};}function respondWithFilteredResult(_0x574c77,_0xb170df){return function(_0x3458f2){if(_0x3458f2){var _0x2043c7=typeof _0xb170df[_0xdf4a('0x19')]==='undefined'&&typeof _0xb170df[_0xdf4a('0x1a')]===_0xdf4a('0x1b');var _0x8e78cd=_0x3458f2['count'];var _0xcb5c10=_0x2043c7?0x0:_0xb170df[_0xdf4a('0x19')];var _0x27e5d3=_0x2043c7?_0x3458f2[_0xdf4a('0x1c')]:_0xb170df[_0xdf4a('0x19')]+_0xb170df[_0xdf4a('0x1a')];var _0x325c26;if(_0x27e5d3>=_0x8e78cd){_0x27e5d3=_0x8e78cd;_0x325c26=0xc8;}else{_0x325c26=0xce;}_0x574c77[_0xdf4a('0x16')](_0x325c26);return _0x574c77[_0xdf4a('0x1d')]('Content-Range',_0xcb5c10+'-'+_0x27e5d3+'/'+_0x8e78cd)[_0xdf4a('0x18')](_0x3458f2);}return null;};}function patchUpdates(_0x448a37){return function(_0x49eb8b){try{jsonpatch[_0xdf4a('0x1e')](_0x49eb8b,_0x448a37,!![]);}catch(_0x27dff9){return BPromise['reject'](_0x27dff9);}return _0x49eb8b[_0xdf4a('0x1f')]();};}function saveUpdates(_0x2d5f08,_0x2d05be){return function(_0x292002){if(_0x292002){return _0x292002[_0xdf4a('0x20')](_0x2d5f08)[_0xdf4a('0x21')](function(_0x4f891b){return _0x4f891b;});}return null;};}function removeEntity(_0x22a7bc,_0x39745b){return function(_0x44147a){if(_0x44147a){return _0x44147a[_0xdf4a('0x22')]()['then'](function(){_0x22a7bc[_0xdf4a('0x16')](0xcc)[_0xdf4a('0x17')]();});}};}function handleEntityNotFound(_0x4081c2,_0x55c3f2){return function(_0x55c277){if(!_0x55c277){_0x4081c2['sendStatus'](0x194);}return _0x55c277;};}function handleError(_0x272d7f,_0x2317c8){_0x2317c8=_0x2317c8||0x1f4;return function(_0x80830f){logger[_0xdf4a('0x23')](_0x80830f[_0xdf4a('0x24')]);if(_0x80830f['name']){delete _0x80830f[_0xdf4a('0x25')];}_0x272d7f['status'](_0x2317c8)['send'](_0x80830f);};}exports[_0xdf4a('0x26')]=function(_0x21b9c6,_0x37af04){var _0x41fa87={},_0x219a80={},_0x1d2366={'count':0x0,'rows':[]};var _0xe0cba0=_[_0xdf4a('0x27')](db[_0xdf4a('0x28')][_0xdf4a('0x29')],function(_0x4425b9){return{'name':_0x4425b9[_0xdf4a('0x2a')],'type':_0x4425b9['type']['key']};});_0x219a80['model']=_['map'](_0xe0cba0,_0xdf4a('0x25'));_0x219a80[_0xdf4a('0x2b')]=_['keys'](_0x21b9c6[_0xdf4a('0x2b')]);_0x219a80[_0xdf4a('0x2c')]=_[_0xdf4a('0x2d')](_0x219a80[_0xdf4a('0x2e')],_0x219a80[_0xdf4a('0x2b')]);_0x41fa87[_0xdf4a('0x2f')]=_[_0xdf4a('0x2d')](_0x219a80[_0xdf4a('0x2e')],qs[_0xdf4a('0x30')](_0x21b9c6['query'][_0xdf4a('0x30')]));_0x41fa87[_0xdf4a('0x2f')]=_0x41fa87['attributes'][_0xdf4a('0x31')]?_0x41fa87['attributes']:_0x219a80[_0xdf4a('0x2e')];if(!_0x21b9c6[_0xdf4a('0x2b')][_0xdf4a('0x32')](_0xdf4a('0x33'))){_0x41fa87['limit']=qs[_0xdf4a('0x1a')](_0x21b9c6[_0xdf4a('0x2b')]['limit']);_0x41fa87[_0xdf4a('0x19')]=qs[_0xdf4a('0x19')](_0x21b9c6[_0xdf4a('0x2b')][_0xdf4a('0x19')]);}_0x41fa87[_0xdf4a('0x34')]=qs['sort'](_0x21b9c6[_0xdf4a('0x2b')][_0xdf4a('0x35')]);_0x41fa87[_0xdf4a('0x36')]=qs[_0xdf4a('0x2c')](_[_0xdf4a('0x37')](_0x21b9c6['query'],_0x219a80[_0xdf4a('0x2c')]),_0xe0cba0);if(_0x21b9c6[_0xdf4a('0x2b')][_0xdf4a('0x38')]){_0x41fa87[_0xdf4a('0x36')]=_['merge'](_0x41fa87['where'],{'$or':_[_0xdf4a('0x27')](_0xe0cba0,function(_0x4d4227){if(_0x4d4227[_0xdf4a('0x39')]!=='VIRTUAL'){var _0x41e92d={};_0x41e92d[_0x4d4227[_0xdf4a('0x25')]]={'$like':'%'+_0x21b9c6[_0xdf4a('0x2b')][_0xdf4a('0x38')]+'%'};return _0x41e92d;}})});}_0x41fa87=_[_0xdf4a('0x3a')]({},_0x41fa87,_0x21b9c6[_0xdf4a('0x3b')]);var _0x3ee657={'where':_0x41fa87[_0xdf4a('0x36')]};return db[_0xdf4a('0x28')][_0xdf4a('0x1c')](_0x3ee657)[_0xdf4a('0x21')](function(_0x2f268b){_0x1d2366[_0xdf4a('0x1c')]=_0x2f268b;if(_0x21b9c6[_0xdf4a('0x2b')]['includeAll']){_0x41fa87['include']=[{'all':!![]}];}return db[_0xdf4a('0x28')][_0xdf4a('0x3c')](_0x41fa87);})[_0xdf4a('0x21')](function(_0x33c298){_0x1d2366[_0xdf4a('0x3d')]=_0x33c298;return _0x1d2366;})[_0xdf4a('0x21')](respondWithFilteredResult(_0x37af04,_0x41fa87))[_0xdf4a('0x3e')](handleError(_0x37af04,null));};exports[_0xdf4a('0x3f')]=function(_0x4828b3,_0xf303e6){var _0x1346f7={'raw':!![],'where':{'id':_0x4828b3[_0xdf4a('0x40')]['id']}},_0x1d2619={};_0x1d2619[_0xdf4a('0x2e')]=_[_0xdf4a('0x41')](db['OpenchannelQueueReport'][_0xdf4a('0x29')]);_0x1d2619['query']=_['keys'](_0x4828b3[_0xdf4a('0x2b')]);_0x1d2619[_0xdf4a('0x2c')]=_[_0xdf4a('0x2d')](_0x1d2619[_0xdf4a('0x2e')],_0x1d2619[_0xdf4a('0x2b')]);_0x1346f7[_0xdf4a('0x2f')]=_['intersection'](_0x1d2619[_0xdf4a('0x2e')],qs['fields'](_0x4828b3['query'][_0xdf4a('0x30')]));_0x1346f7['attributes']=_0x1346f7[_0xdf4a('0x2f')][_0xdf4a('0x31')]?_0x1346f7['attributes']:_0x1d2619[_0xdf4a('0x2e')];if(_0x4828b3[_0xdf4a('0x2b')][_0xdf4a('0x42')]){_0x1346f7['include']=[{'all':!![]}];}_0x1346f7=_['merge']({},_0x1346f7,_0x4828b3[_0xdf4a('0x3b')]);return db[_0xdf4a('0x28')]['find'](_0x1346f7)[_0xdf4a('0x21')](handleEntityNotFound(_0xf303e6,null))['then'](respondWithResult(_0xf303e6,null))[_0xdf4a('0x3e')](handleError(_0xf303e6,null));};exports[_0xdf4a('0x43')]=function(_0x196f3e,_0x48bb88){return db[_0xdf4a('0x28')][_0xdf4a('0x43')](_0x196f3e['body'],{})[_0xdf4a('0x21')](respondWithResult(_0x48bb88,0xc9))['catch'](handleError(_0x48bb88,null));};exports[_0xdf4a('0x20')]=function(_0x12d5e1,_0x52c0e5){if(_0x12d5e1[_0xdf4a('0x44')]['id']){delete _0x12d5e1['body']['id'];}return db[_0xdf4a('0x28')][_0xdf4a('0x45')]({'where':{'id':_0x12d5e1['params']['id']}})['then'](handleEntityNotFound(_0x52c0e5,null))[_0xdf4a('0x21')](saveUpdates(_0x12d5e1['body'],null))[_0xdf4a('0x21')](respondWithResult(_0x52c0e5,null))['catch'](handleError(_0x52c0e5,null));};exports['destroy']=function(_0x3a9b2e,_0x28da97){return db[_0xdf4a('0x28')][_0xdf4a('0x45')]({'where':{'id':_0x3a9b2e[_0xdf4a('0x40')]['id']}})[_0xdf4a('0x21')](handleEntityNotFound(_0x28da97,null))[_0xdf4a('0x21')](removeEntity(_0x28da97,null))[_0xdf4a('0x3e')](handleError(_0x28da97,null));};exports[_0xdf4a('0x46')]=function(_0x2be37c,_0x152a25){return db[_0xdf4a('0x28')][_0xdf4a('0x46')]()['then'](respondWithResult(_0x152a25,null))[_0xdf4a('0x3e')](handleError(_0x152a25,null));};
\ No newline at end of file
+var _0x81b6=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','keys','query','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','length','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4841f7,_0xf3c022){var _0x13ce7c=function(_0x27540f){while(--_0x27540f){_0x4841f7['push'](_0x4841f7['shift']());}};_0x13ce7c(++_0xf3c022);}(_0x81b6,0x16e));var _0x681b=function(_0x198495,_0x21e960){_0x198495=_0x198495-0x0;var _0x317101=_0x81b6[_0x198495];return _0x317101;};'use strict';var emlformat=require(_0x681b('0x0'));var rimraf=require(_0x681b('0x1'));var zipdir=require(_0x681b('0x2'));var jsonpatch=require(_0x681b('0x3'));var rp=require(_0x681b('0x4'));var moment=require(_0x681b('0x5'));var BPromise=require(_0x681b('0x6'));var Mustache=require(_0x681b('0x7'));var util=require(_0x681b('0x8'));var path=require(_0x681b('0x9'));var sox=require(_0x681b('0xa'));var csv=require(_0x681b('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x681b('0xc'));var _=require('lodash');var squel=require(_0x681b('0xd'));var crypto=require(_0x681b('0xe'));var jsforce=require(_0x681b('0xf'));var deskjs=require(_0x681b('0x10'));var toCsv=require(_0x681b('0xb'));var querystring=require(_0x681b('0x11'));var Papa=require(_0x681b('0x12'));var Redis=require(_0x681b('0x13'));var authService=require(_0x681b('0x14'));var qs=require(_0x681b('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x681b('0x16'));var logger=require(_0x681b('0x17'))(_0x681b('0x18'));var utils=require(_0x681b('0x19'));var config=require(_0x681b('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x681b('0x1b'))['db'];function respondWithStatusCode(_0x45e2e3,_0x611ba7){_0x611ba7=_0x611ba7||0xcc;return function(_0x10f1e2){if(_0x10f1e2){return _0x45e2e3['sendStatus'](_0x611ba7);}return _0x45e2e3[_0x681b('0x1c')](_0x611ba7)['end']();};}function respondWithResult(_0x5c7020,_0x12b700){_0x12b700=_0x12b700||0xc8;return function(_0x48cdc7){if(_0x48cdc7){return _0x5c7020[_0x681b('0x1c')](_0x12b700)[_0x681b('0x1d')](_0x48cdc7);}};}function respondWithFilteredResult(_0x4309bb,_0x55f9cf){return function(_0x49b9ca){if(_0x49b9ca){var _0x5e0ff2=typeof _0x55f9cf[_0x681b('0x1e')]===_0x681b('0x1f')&&typeof _0x55f9cf[_0x681b('0x20')]===_0x681b('0x1f');var _0x32d7f6=_0x49b9ca['count'];var _0x3226c8=_0x5e0ff2?0x0:_0x55f9cf[_0x681b('0x1e')];var _0x281278=_0x5e0ff2?_0x49b9ca[_0x681b('0x21')]:_0x55f9cf[_0x681b('0x1e')]+_0x55f9cf[_0x681b('0x20')];var _0x4afb4e;if(_0x281278>=_0x32d7f6){_0x281278=_0x32d7f6;_0x4afb4e=0xc8;}else{_0x4afb4e=0xce;}_0x4309bb[_0x681b('0x1c')](_0x4afb4e);return _0x4309bb['set']('Content-Range',_0x3226c8+'-'+_0x281278+'/'+_0x32d7f6)[_0x681b('0x1d')](_0x49b9ca);}return null;};}function patchUpdates(_0x8828dc){return function(_0x520bbc){try{jsonpatch[_0x681b('0x22')](_0x520bbc,_0x8828dc,!![]);}catch(_0x4f24e7){return BPromise[_0x681b('0x23')](_0x4f24e7);}return _0x520bbc[_0x681b('0x24')]();};}function saveUpdates(_0x1af293,_0x527777){return function(_0xf7b92c){if(_0xf7b92c){return _0xf7b92c[_0x681b('0x25')](_0x1af293)[_0x681b('0x26')](function(_0x35befb){return _0x35befb;});}return null;};}function removeEntity(_0x3bb90e,_0x28f8e1){return function(_0x179289){if(_0x179289){return _0x179289['destroy']()[_0x681b('0x26')](function(){_0x3bb90e[_0x681b('0x1c')](0xcc)[_0x681b('0x27')]();});}};}function handleEntityNotFound(_0x11af0b,_0x24e615){return function(_0x2cf5be){if(!_0x2cf5be){_0x11af0b[_0x681b('0x28')](0x194);}return _0x2cf5be;};}function handleError(_0x122ac6,_0x2e77d4){_0x2e77d4=_0x2e77d4||0x1f4;return function(_0x122089){logger[_0x681b('0x29')](_0x122089[_0x681b('0x2a')]);if(_0x122089[_0x681b('0x2b')]){delete _0x122089[_0x681b('0x2b')];}_0x122ac6[_0x681b('0x1c')](_0x2e77d4)[_0x681b('0x2c')](_0x122089);};}exports[_0x681b('0x2d')]=function(_0x475607,_0x300f24){var _0xbb7fae={},_0x3e8ace={},_0x391bd9={'count':0x0,'rows':[]};var _0x29c7fb=_[_0x681b('0x2e')](db[_0x681b('0x2f')][_0x681b('0x30')],function(_0x3253ed){return{'name':_0x3253ed[_0x681b('0x31')],'type':_0x3253ed['type'][_0x681b('0x32')]};});_0x3e8ace['model']=_[_0x681b('0x2e')](_0x29c7fb,_0x681b('0x2b'));_0x3e8ace['query']=_[_0x681b('0x33')](_0x475607[_0x681b('0x34')]);_0x3e8ace[_0x681b('0x35')]=_['intersection'](_0x3e8ace[_0x681b('0x36')],_0x3e8ace[_0x681b('0x34')]);_0xbb7fae[_0x681b('0x37')]=_[_0x681b('0x38')](_0x3e8ace['model'],qs[_0x681b('0x39')](_0x475607[_0x681b('0x34')]['fields']));_0xbb7fae['attributes']=_0xbb7fae['attributes']['length']?_0xbb7fae[_0x681b('0x37')]:_0x3e8ace[_0x681b('0x36')];if(!_0x475607[_0x681b('0x34')]['hasOwnProperty'](_0x681b('0x3a'))){_0xbb7fae[_0x681b('0x20')]=qs[_0x681b('0x20')](_0x475607[_0x681b('0x34')][_0x681b('0x20')]);_0xbb7fae[_0x681b('0x1e')]=qs[_0x681b('0x1e')](_0x475607[_0x681b('0x34')]['offset']);}_0xbb7fae[_0x681b('0x3b')]=qs[_0x681b('0x3c')](_0x475607['query']['sort']);_0xbb7fae[_0x681b('0x3d')]=qs[_0x681b('0x35')](_[_0x681b('0x3e')](_0x475607[_0x681b('0x34')],_0x3e8ace[_0x681b('0x35')]),_0x29c7fb);if(_0x475607[_0x681b('0x34')][_0x681b('0x3f')]){_0xbb7fae[_0x681b('0x3d')]=_['merge'](_0xbb7fae[_0x681b('0x3d')],{'$or':_[_0x681b('0x2e')](_0x29c7fb,function(_0x297658){if(_0x297658['type']!=='VIRTUAL'){var _0x103018={};_0x103018[_0x297658[_0x681b('0x2b')]]={'$like':'%'+_0x475607['query'][_0x681b('0x3f')]+'%'};return _0x103018;}})});}_0xbb7fae=_[_0x681b('0x40')]({},_0xbb7fae,_0x475607[_0x681b('0x41')]);var _0x236ea8={'where':_0xbb7fae[_0x681b('0x3d')]};return db[_0x681b('0x2f')][_0x681b('0x21')](_0x236ea8)[_0x681b('0x26')](function(_0x2d1244){_0x391bd9[_0x681b('0x21')]=_0x2d1244;if(_0x475607[_0x681b('0x34')][_0x681b('0x42')]){_0xbb7fae[_0x681b('0x43')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x681b('0x44')](_0xbb7fae);})[_0x681b('0x26')](function(_0x1de210){_0x391bd9['rows']=_0x1de210;return _0x391bd9;})[_0x681b('0x26')](respondWithFilteredResult(_0x300f24,_0xbb7fae))[_0x681b('0x45')](handleError(_0x300f24,null));};exports['show']=function(_0x4afce1,_0x5aa1bd){var _0x1a1836={'raw':!![],'where':{'id':_0x4afce1['params']['id']}},_0x25ad92={};_0x25ad92[_0x681b('0x36')]=_[_0x681b('0x33')](db[_0x681b('0x2f')]['rawAttributes']);_0x25ad92[_0x681b('0x34')]=_[_0x681b('0x33')](_0x4afce1[_0x681b('0x34')]);_0x25ad92['filters']=_[_0x681b('0x38')](_0x25ad92[_0x681b('0x36')],_0x25ad92[_0x681b('0x34')]);_0x1a1836[_0x681b('0x37')]=_[_0x681b('0x38')](_0x25ad92['model'],qs[_0x681b('0x39')](_0x4afce1[_0x681b('0x34')][_0x681b('0x39')]));_0x1a1836[_0x681b('0x37')]=_0x1a1836[_0x681b('0x37')][_0x681b('0x46')]?_0x1a1836[_0x681b('0x37')]:_0x25ad92['model'];if(_0x4afce1[_0x681b('0x34')][_0x681b('0x42')]){_0x1a1836[_0x681b('0x43')]=[{'all':!![]}];}_0x1a1836=_[_0x681b('0x40')]({},_0x1a1836,_0x4afce1[_0x681b('0x41')]);return db[_0x681b('0x2f')][_0x681b('0x47')](_0x1a1836)[_0x681b('0x26')](handleEntityNotFound(_0x5aa1bd,null))['then'](respondWithResult(_0x5aa1bd,null))[_0x681b('0x45')](handleError(_0x5aa1bd,null));};exports['create']=function(_0x48dda8,_0x10c912){return db[_0x681b('0x2f')][_0x681b('0x48')](_0x48dda8[_0x681b('0x49')],{})[_0x681b('0x26')](respondWithResult(_0x10c912,0xc9))['catch'](handleError(_0x10c912,null));};exports['update']=function(_0x13032c,_0x5d48c6){if(_0x13032c[_0x681b('0x49')]['id']){delete _0x13032c[_0x681b('0x49')]['id'];}return db['OpenchannelQueueReport'][_0x681b('0x47')]({'where':{'id':_0x13032c[_0x681b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d48c6,null))[_0x681b('0x26')](saveUpdates(_0x13032c[_0x681b('0x49')],null))[_0x681b('0x26')](respondWithResult(_0x5d48c6,null))[_0x681b('0x45')](handleError(_0x5d48c6,null));};exports[_0x681b('0x4b')]=function(_0x26168b,_0x2c50b9){return db['OpenchannelQueueReport'][_0x681b('0x47')]({'where':{'id':_0x26168b[_0x681b('0x4a')]['id']}})[_0x681b('0x26')](handleEntityNotFound(_0x2c50b9,null))[_0x681b('0x26')](removeEntity(_0x2c50b9,null))['catch'](handleError(_0x2c50b9,null));};exports[_0x681b('0x4c')]=function(_0x6f8a7d,_0x27b5c8){return db['OpenchannelQueueReport'][_0x681b('0x4c')]()[_0x681b('0x26')](respondWithResult(_0x27b5c8,null))[_0x681b('0x45')](handleError(_0x27b5c8,null));};
\ No newline at end of file
index f62db40..8b998b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x25e35a,_0x2b13fd){var _0x34204f=function(_0x1214b6){while(--_0x1214b6){_0x25e35a['push'](_0x25e35a['shift']());}};_0x34204f(++_0x2b13fd);}(_0x1261,0x144));var _0x1126=function(_0xb5a041,_0x394f01){_0xb5a041=_0xb5a041-0x0;var _0x187974=_0x1261[_0xb5a041];return _0x187974;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0x814b,0x1a2));var _0xb814=function(_0x5a2299,_0x3e2922){_0x5a2299=_0x5a2299-0x0;var _0xedff0f=_0x814b[_0x5a2299];return _0xedff0f;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
index b234b05..ac7feb7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x69d3=['options','raw','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','OpenchannelQueueReport','body'];(function(_0x7ef032,_0xb4f0b8){var _0x15ad25=function(_0x487bcb){while(--_0x487bcb){_0x7ef032['push'](_0x7ef032['shift']());}};_0x15ad25(++_0xb4f0b8);}(_0x69d3,0xda));var _0x369d=function(_0x129d38,_0x33eb62){_0x129d38=_0x129d38-0x0;var _0x1e7227=_0x69d3[_0x129d38];return _0x1e7227;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var moment=require(_0x369d('0x2'));var BPromise=require('bluebird');var rs=require(_0x369d('0x3'));var fs=require('fs');var Redis=require(_0x369d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x369d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x369d('0x6'));var client=jayson[_0x369d('0x7')][_0x369d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x424d8c,_0x1bd94c,_0x186302){return new BPromise(function(_0x3adb26,_0x2ac0ec){return client[_0x369d('0x9')](_0x424d8c,_0x186302)['then'](function(_0x5d2ded){logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,_0x369d('0xc'));logger[_0x369d('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x1bd94c,'request\x20sent',JSON[_0x369d('0xe')](_0x5d2ded));if(_0x5d2ded[_0x369d('0xf')]){if(_0x5d2ded[_0x369d('0xf')][_0x369d('0x10')]===0x1f4){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error'][_0x369d('0x11')]);return _0x2ac0ec(_0x5d2ded[_0x369d('0xf')][_0x369d('0x11')]);}logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error']['message']);return _0x3adb26(_0x5d2ded['error'][_0x369d('0x11')]);}else{logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,'request\x20sent');_0x3adb26(_0x5d2ded[_0x369d('0x12')][_0x369d('0x11')]);}})[_0x369d('0x13')](function(_0x4e234e){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x4e234e);_0x2ac0ec(_0x4e234e);});});}exports['CreateOpenchannelQueueReport']=function(_0x572513){var _0x597b67=this;return new Promise(function(_0x2946be,_0x4494b3){return db[_0x369d('0x14')]['create'](_0x572513[_0x369d('0x15')],{'raw':_0x572513[_0x369d('0x16')]?_0x572513[_0x369d('0x16')][_0x369d('0x17')]===undefined?!![]:![]:!![]})[_0x369d('0x18')](function(_0x538ca4){logger[_0x369d('0xa')](_0x369d('0x19'),_0x572513);logger[_0x369d('0xd')](_0x369d('0x19'),_0x572513,JSON[_0x369d('0xe')](_0x538ca4));_0x2946be(_0x538ca4);})[_0x369d('0x13')](function(_0x15fbef){logger[_0x369d('0xf')]('CreateOpenchannelQueueReport',_0x15fbef['message'],_0x572513);_0x4494b3(_0x597b67[_0x369d('0xf')](0x1f4,_0x15fbef[_0x369d('0x11')]));});});};exports[_0x369d('0x1a')]=function(_0xcae58){var _0x30e7c5=this;return new Promise(function(_0x38f0b8,_0x36cf04){return db['OpenchannelQueueReport']['update'](_0xcae58[_0x369d('0x15')],{'raw':_0xcae58[_0x369d('0x16')]?_0xcae58[_0x369d('0x16')][_0x369d('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcae58[_0x369d('0x16')]?_0xcae58[_0x369d('0x16')][_0x369d('0x1b')]||null:null,'attributes':_0xcae58['options']?_0xcae58[_0x369d('0x16')][_0x369d('0x1c')]||null:null,'limit':_0xcae58[_0x369d('0x16')]?_0xcae58[_0x369d('0x16')][_0x369d('0x1d')]||null:null})[_0x369d('0x18')](function(_0x3d1ce0){logger['info'](_0x369d('0x1a'),_0xcae58);logger['debug']('UpdateOpenchannelQueueReport',_0xcae58,JSON[_0x369d('0xe')](_0x3d1ce0));_0x38f0b8(_0x3d1ce0);})[_0x369d('0x13')](function(_0x5844c7){logger[_0x369d('0xf')]('UpdateOpenchannelQueueReport',_0x5844c7[_0x369d('0x11')],_0xcae58);_0x36cf04(_0x30e7c5[_0x369d('0xf')](0x1f4,_0x5844c7[_0x369d('0x11')]));});});};
\ No newline at end of file
+var _0x174b=['body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','attributes','limit','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','create'];(function(_0x2acb5b,_0x50a9b8){var _0x37f76f=function(_0x5cf218){while(--_0x5cf218){_0x2acb5b['push'](_0x2acb5b['shift']());}};_0x37f76f(++_0x50a9b8);}(_0x174b,0x19d));var _0xb174=function(_0x57e60d,_0x4ba8b6){_0x57e60d=_0x57e60d-0x0;var _0x3cc539=_0x174b[_0x57e60d];return _0x3cc539;};'use strict';var _=require(_0xb174('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb174('0x1'));var rs=require(_0xb174('0x2'));var fs=require('fs');var Redis=require(_0xb174('0x3'));var db=require(_0xb174('0x4'))['db'];var utils=require(_0xb174('0x5'));var logger=require(_0xb174('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb174('0x7'));var client=jayson[_0xb174('0x8')][_0xb174('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e7a36,_0xa073f6,_0x1e3e13){return new BPromise(function(_0x465cd6,_0x149942){return client[_0xb174('0xa')](_0x3e7a36,_0x1e3e13)[_0xb174('0xb')](function(_0x4c3cea){logger[_0xb174('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xa073f6,_0xb174('0xd'));logger[_0xb174('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0xa073f6,_0xb174('0xd'),JSON['stringify'](_0x4c3cea));if(_0x4c3cea[_0xb174('0xf')]){if(_0x4c3cea[_0xb174('0xf')]['code']===0x1f4){logger[_0xb174('0xf')](_0xb174('0x10'),_0xa073f6,_0x4c3cea[_0xb174('0xf')][_0xb174('0x11')]);return _0x149942(_0x4c3cea['error'][_0xb174('0x11')]);}logger['error'](_0xb174('0x10'),_0xa073f6,_0x4c3cea[_0xb174('0xf')][_0xb174('0x11')]);return _0x465cd6(_0x4c3cea[_0xb174('0xf')]['message']);}else{logger[_0xb174('0xc')](_0xb174('0x10'),_0xa073f6,_0xb174('0xd'));_0x465cd6(_0x4c3cea[_0xb174('0x12')][_0xb174('0x11')]);}})[_0xb174('0x13')](function(_0x5d31ac){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xa073f6,_0x5d31ac);_0x149942(_0x5d31ac);});});}exports['CreateOpenchannelQueueReport']=function(_0x2ab4dc){var _0x4fb4eb=this;return new Promise(function(_0xaf80a9,_0x1a6f40){return db['OpenchannelQueueReport'][_0xb174('0x14')](_0x2ab4dc[_0xb174('0x15')],{'raw':_0x2ab4dc[_0xb174('0x16')]?_0x2ab4dc[_0xb174('0x16')][_0xb174('0x17')]===undefined?!![]:![]:!![]})[_0xb174('0xb')](function(_0xcc8d9a){logger['info'](_0xb174('0x18'),_0x2ab4dc);logger[_0xb174('0xe')]('CreateOpenchannelQueueReport',_0x2ab4dc,JSON['stringify'](_0xcc8d9a));_0xaf80a9(_0xcc8d9a);})['catch'](function(_0x338dc4){logger[_0xb174('0xf')](_0xb174('0x18'),_0x338dc4['message'],_0x2ab4dc);_0x1a6f40(_0x4fb4eb[_0xb174('0xf')](0x1f4,_0x338dc4[_0xb174('0x11')]));});});};exports[_0xb174('0x19')]=function(_0x5a3fbd){var _0x19473b=this;return new Promise(function(_0x410411,_0x3b5abf){return db[_0xb174('0x1a')][_0xb174('0x1b')](_0x5a3fbd['body'],{'raw':_0x5a3fbd[_0xb174('0x16')]?_0x5a3fbd['options'][_0xb174('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a3fbd[_0xb174('0x16')]?_0x5a3fbd[_0xb174('0x16')]['where']||null:null,'attributes':_0x5a3fbd['options']?_0x5a3fbd[_0xb174('0x16')][_0xb174('0x1c')]||null:null,'limit':_0x5a3fbd['options']?_0x5a3fbd['options'][_0xb174('0x1d')]||null:null})['then'](function(_0x291d6c){logger[_0xb174('0xc')](_0xb174('0x19'),_0x5a3fbd);logger[_0xb174('0xe')](_0xb174('0x19'),_0x5a3fbd,JSON[_0xb174('0x1e')](_0x291d6c));_0x410411(_0x291d6c);})[_0xb174('0x13')](function(_0x530167){logger['error'](_0xb174('0x19'),_0x530167[_0xb174('0x11')],_0x5a3fbd);_0x3b5abf(_0x19473b[_0xb174('0xf')](0x1f4,_0x530167[_0xb174('0x11')]));});});};
\ No newline at end of file
index 306b397..a390d9e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x87d1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x87d1,0x1cc));var _0x187d=function(_0x366a0d,_0x52f94b){_0x366a0d=_0x366a0d-0x0;var _0x4eafeb=_0x87d1[_0x366a0d];return _0x4eafeb;};'use strict';var multer=require(_0x187d('0x0'));var util=require('util');var path=require(_0x187d('0x1'));var timeout=require(_0x187d('0x2'));var express=require(_0x187d('0x3'));var router=express[_0x187d('0x4')]();var fs_extra=require(_0x187d('0x5'));var auth=require(_0x187d('0x6'));var interaction=require(_0x187d('0x7'));var config=require('../../config/environment');var controller=require(_0x187d('0x8'));router[_0x187d('0x9')]('/',auth[_0x187d('0xa')](),controller[_0x187d('0xb')]);router[_0x187d('0x9')](_0x187d('0xc'),auth[_0x187d('0xa')](),controller[_0x187d('0xd')]);router[_0x187d('0x9')](_0x187d('0xe'),auth['isAuthenticated'](),controller[_0x187d('0xf')]);router[_0x187d('0x10')]('/',auth['isAuthenticated'](),controller[_0x187d('0x11')]);router[_0x187d('0x12')](_0x187d('0xe'),auth[_0x187d('0xa')](),controller[_0x187d('0x13')]);router['delete']('/:id',auth[_0x187d('0xa')](),controller[_0x187d('0x14')]);module[_0x187d('0x15')]=router;
\ No newline at end of file
+var _0x5246=['show','post','create','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5246,0x109));var _0x6524=function(_0x27044d,_0x309674){_0x27044d=_0x27044d-0x0;var _0x564a8e=_0x5246[_0x27044d];return _0x564a8e;};'use strict';var multer=require(_0x6524('0x0'));var util=require(_0x6524('0x1'));var path=require(_0x6524('0x2'));var timeout=require(_0x6524('0x3'));var express=require(_0x6524('0x4'));var router=express[_0x6524('0x5')]();var fs_extra=require(_0x6524('0x6'));var auth=require(_0x6524('0x7'));var interaction=require(_0x6524('0x8'));var config=require('../../config/environment');var controller=require(_0x6524('0x9'));router[_0x6524('0xa')]('/',auth[_0x6524('0xb')](),controller[_0x6524('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6524('0xd')]);router[_0x6524('0xa')](_0x6524('0xe'),auth[_0x6524('0xb')](),controller[_0x6524('0xf')]);router[_0x6524('0x10')]('/',auth[_0x6524('0xb')](),controller[_0x6524('0x11')]);router[_0x6524('0x12')](_0x6524('0xe'),auth[_0x6524('0xb')](),controller['update']);router['delete'](_0x6524('0xe'),auth[_0x6524('0xb')](),controller['destroy']);module[_0x6524('0x13')]=router;
\ No newline at end of file
index e307fd8..299080e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5e9d0e,_0x3fedc0){_0x5e9d0e=_0x5e9d0e-0x0;var _0x4e2b5c=_0xb43b[_0x5e9d0e];return _0x4e2b5c;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}};
\ No newline at end of file
+var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0xff095b,_0x4df7c8){var _0x9e309b=function(_0xec4696){while(--_0xec4696){_0xff095b['push'](_0xff095b['shift']());}};_0x9e309b(++_0x4df7c8);}(_0xaa88,0x137));var _0x8aa8=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xaa88[_0x5d4607];return _0x5e4a86;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}};
\ No newline at end of file
index cb81618..3a479e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x32dc=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','OpenchannelTransferReport','fieldName','key','map','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','params','rawAttributes','find','create','catch','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x14b767,_0x577e84){var _0x22267a=function(_0xa87ebc){while(--_0xa87ebc){_0x14b767['push'](_0x14b767['shift']());}};_0x22267a(++_0x577e84);}(_0x32dc,0x12e));var _0xc32d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x32dc[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xc32d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc32d('0x1'));var jsonpatch=require(_0xc32d('0x2'));var rp=require(_0xc32d('0x3'));var moment=require('moment');var BPromise=require(_0xc32d('0x4'));var Mustache=require(_0xc32d('0x5'));var util=require(_0xc32d('0x6'));var path=require(_0xc32d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc32d('0x8'));var fs=require('fs');var fs_extra=require(_0xc32d('0x9'));var _=require(_0xc32d('0xa'));var squel=require(_0xc32d('0xb'));var crypto=require('crypto');var jsforce=require(_0xc32d('0xc'));var deskjs=require(_0xc32d('0xd'));var toCsv=require(_0xc32d('0xe'));var querystring=require(_0xc32d('0xf'));var Papa=require(_0xc32d('0x10'));var Redis=require(_0xc32d('0x11'));var authService=require(_0xc32d('0x12'));var qs=require(_0xc32d('0x13'));var as=require(_0xc32d('0x14'));var hardwareService=require(_0xc32d('0x15'));var logger=require(_0xc32d('0x16'))(_0xc32d('0x17'));var utils=require(_0xc32d('0x18'));var config=require(_0xc32d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc32d('0x1a'))['db'];function respondWithStatusCode(_0x189248,_0x3b5f90){_0x3b5f90=_0x3b5f90||0xcc;return function(_0x3264f6){if(_0x3264f6){return _0x189248[_0xc32d('0x1b')](_0x3b5f90);}return _0x189248[_0xc32d('0x1c')](_0x3b5f90)[_0xc32d('0x1d')]();};}function respondWithResult(_0x153967,_0x5a3705){_0x5a3705=_0x5a3705||0xc8;return function(_0x5904ae){if(_0x5904ae){return _0x153967[_0xc32d('0x1c')](_0x5a3705)['json'](_0x5904ae);}};}function respondWithFilteredResult(_0x28af6b,_0x2dda8e){return function(_0x55cea5){if(_0x55cea5){var _0x1bc297=typeof _0x2dda8e[_0xc32d('0x1e')]===_0xc32d('0x1f')&&typeof _0x2dda8e[_0xc32d('0x20')]===_0xc32d('0x1f');var _0x161f16=_0x55cea5['count'];var _0x3a0b4b=_0x1bc297?0x0:_0x2dda8e[_0xc32d('0x1e')];var _0x207303=_0x1bc297?_0x55cea5[_0xc32d('0x21')]:_0x2dda8e[_0xc32d('0x1e')]+_0x2dda8e[_0xc32d('0x20')];var _0x211e17;if(_0x207303>=_0x161f16){_0x207303=_0x161f16;_0x211e17=0xc8;}else{_0x211e17=0xce;}_0x28af6b[_0xc32d('0x1c')](_0x211e17);return _0x28af6b[_0xc32d('0x22')](_0xc32d('0x23'),_0x3a0b4b+'-'+_0x207303+'/'+_0x161f16)[_0xc32d('0x24')](_0x55cea5);}return null;};}function patchUpdates(_0x519dca){return function(_0x17417e){try{jsonpatch[_0xc32d('0x25')](_0x17417e,_0x519dca,!![]);}catch(_0x120147){return BPromise[_0xc32d('0x26')](_0x120147);}return _0x17417e[_0xc32d('0x27')]();};}function saveUpdates(_0x4f7a92,_0x378bf7){return function(_0x217928){if(_0x217928){return _0x217928[_0xc32d('0x28')](_0x4f7a92)[_0xc32d('0x29')](function(_0x450cd9){return _0x450cd9;});}return null;};}function removeEntity(_0x3360e7,_0x5028f6){return function(_0x53577f){if(_0x53577f){return _0x53577f[_0xc32d('0x2a')]()[_0xc32d('0x29')](function(){_0x3360e7[_0xc32d('0x1c')](0xcc)[_0xc32d('0x1d')]();});}};}function handleEntityNotFound(_0x1ecefd,_0x2fc06){return function(_0xb7f243){if(!_0xb7f243){_0x1ecefd[_0xc32d('0x1b')](0x194);}return _0xb7f243;};}function handleError(_0xe8eac4,_0x4095e4){_0x4095e4=_0x4095e4||0x1f4;return function(_0x7938ec){logger[_0xc32d('0x2b')](_0x7938ec['stack']);if(_0x7938ec['name']){delete _0x7938ec[_0xc32d('0x2c')];}_0xe8eac4[_0xc32d('0x1c')](_0x4095e4)[_0xc32d('0x2d')](_0x7938ec);};}exports[_0xc32d('0x2e')]=function(_0x5edbc8,_0x53b7d0){var _0x1ac96f={},_0x228df5={},_0x6eba39={'count':0x0,'rows':[]};var _0x1bd759=_['map'](db[_0xc32d('0x2f')]['rawAttributes'],function(_0x563d0a){return{'name':_0x563d0a[_0xc32d('0x30')],'type':_0x563d0a['type'][_0xc32d('0x31')]};});_0x228df5['model']=_[_0xc32d('0x32')](_0x1bd759,_0xc32d('0x2c'));_0x228df5[_0xc32d('0x33')]=_[_0xc32d('0x34')](_0x5edbc8[_0xc32d('0x33')]);_0x228df5['filters']=_[_0xc32d('0x35')](_0x228df5[_0xc32d('0x36')],_0x228df5['query']);_0x1ac96f['attributes']=_[_0xc32d('0x35')](_0x228df5[_0xc32d('0x36')],qs[_0xc32d('0x37')](_0x5edbc8['query'][_0xc32d('0x37')]));_0x1ac96f['attributes']=_0x1ac96f[_0xc32d('0x38')][_0xc32d('0x39')]?_0x1ac96f[_0xc32d('0x38')]:_0x228df5['model'];if(!_0x5edbc8[_0xc32d('0x33')]['hasOwnProperty'](_0xc32d('0x3a'))){_0x1ac96f[_0xc32d('0x20')]=qs[_0xc32d('0x20')](_0x5edbc8[_0xc32d('0x33')][_0xc32d('0x20')]);_0x1ac96f[_0xc32d('0x1e')]=qs['offset'](_0x5edbc8[_0xc32d('0x33')][_0xc32d('0x1e')]);}_0x1ac96f[_0xc32d('0x3b')]=qs['sort'](_0x5edbc8[_0xc32d('0x33')][_0xc32d('0x3c')]);_0x1ac96f[_0xc32d('0x3d')]=qs[_0xc32d('0x3e')](_[_0xc32d('0x3f')](_0x5edbc8[_0xc32d('0x33')],_0x228df5[_0xc32d('0x3e')]),_0x1bd759);if(_0x5edbc8[_0xc32d('0x33')][_0xc32d('0x40')]){_0x1ac96f[_0xc32d('0x3d')]=_[_0xc32d('0x41')](_0x1ac96f[_0xc32d('0x3d')],{'$or':_[_0xc32d('0x32')](_0x1bd759,function(_0x5ed220){if(_0x5ed220[_0xc32d('0x42')]!==_0xc32d('0x43')){var _0x15767c={};_0x15767c[_0x5ed220[_0xc32d('0x2c')]]={'$like':'%'+_0x5edbc8[_0xc32d('0x33')][_0xc32d('0x40')]+'%'};return _0x15767c;}})});}_0x1ac96f=_[_0xc32d('0x41')]({},_0x1ac96f,_0x5edbc8[_0xc32d('0x44')]);var _0x566d14={'where':_0x1ac96f[_0xc32d('0x3d')]};return db[_0xc32d('0x2f')]['count'](_0x566d14)[_0xc32d('0x29')](function(_0x25c09b){_0x6eba39[_0xc32d('0x21')]=_0x25c09b;if(_0x5edbc8['query'][_0xc32d('0x45')]){_0x1ac96f[_0xc32d('0x46')]=[{'all':!![]}];}return db[_0xc32d('0x2f')][_0xc32d('0x47')](_0x1ac96f);})['then'](function(_0x23c60e){_0x6eba39['rows']=_0x23c60e;return _0x6eba39;})['then'](respondWithFilteredResult(_0x53b7d0,_0x1ac96f))['catch'](handleError(_0x53b7d0,null));};exports['show']=function(_0x3317a9,_0x283cf1){var _0x473892={'raw':!![],'where':{'id':_0x3317a9[_0xc32d('0x48')]['id']}},_0x15c57a={};_0x15c57a['model']=_[_0xc32d('0x34')](db['OpenchannelTransferReport'][_0xc32d('0x49')]);_0x15c57a[_0xc32d('0x33')]=_[_0xc32d('0x34')](_0x3317a9[_0xc32d('0x33')]);_0x15c57a['filters']=_[_0xc32d('0x35')](_0x15c57a['model'],_0x15c57a[_0xc32d('0x33')]);_0x473892[_0xc32d('0x38')]=_[_0xc32d('0x35')](_0x15c57a[_0xc32d('0x36')],qs[_0xc32d('0x37')](_0x3317a9[_0xc32d('0x33')][_0xc32d('0x37')]));_0x473892[_0xc32d('0x38')]=_0x473892[_0xc32d('0x38')][_0xc32d('0x39')]?_0x473892[_0xc32d('0x38')]:_0x15c57a[_0xc32d('0x36')];if(_0x3317a9['query'][_0xc32d('0x45')]){_0x473892['include']=[{'all':!![]}];}_0x473892=_[_0xc32d('0x41')]({},_0x473892,_0x3317a9['options']);return db[_0xc32d('0x2f')][_0xc32d('0x4a')](_0x473892)[_0xc32d('0x29')](handleEntityNotFound(_0x283cf1,null))[_0xc32d('0x29')](respondWithResult(_0x283cf1,null))['catch'](handleError(_0x283cf1,null));};exports[_0xc32d('0x4b')]=function(_0x15c17a,_0xb3b555){return db[_0xc32d('0x2f')][_0xc32d('0x4b')](_0x15c17a['body'],{})['then'](respondWithResult(_0xb3b555,0xc9))[_0xc32d('0x4c')](handleError(_0xb3b555,null));};exports[_0xc32d('0x28')]=function(_0x23d9b5,_0x763862){if(_0x23d9b5['body']['id']){delete _0x23d9b5[_0xc32d('0x4d')]['id'];}return db[_0xc32d('0x2f')]['find']({'where':{'id':_0x23d9b5['params']['id']}})[_0xc32d('0x29')](handleEntityNotFound(_0x763862,null))['then'](saveUpdates(_0x23d9b5[_0xc32d('0x4d')],null))[_0xc32d('0x29')](respondWithResult(_0x763862,null))[_0xc32d('0x4c')](handleError(_0x763862,null));};exports['destroy']=function(_0x2d980b,_0x5b7743){return db[_0xc32d('0x2f')][_0xc32d('0x4a')]({'where':{'id':_0x2d980b[_0xc32d('0x48')]['id']}})[_0xc32d('0x29')](handleEntityNotFound(_0x5b7743,null))['then'](removeEntity(_0x5b7743,null))['catch'](handleError(_0x5b7743,null));};exports[_0xc32d('0x4e')]=function(_0x26e04b,_0x45894c){return db[_0xc32d('0x2f')][_0xc32d('0x4e')]()[_0xc32d('0x29')](respondWithResult(_0x45894c,null))['catch'](handleError(_0x45894c,null));};
\ No newline at end of file
+var _0x7d3e=['fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','OpenchannelTransferReport','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes'];(function(_0x449fb0,_0xf691a2){var _0x10bb91=function(_0x86e613){while(--_0x86e613){_0x449fb0['push'](_0x449fb0['shift']());}};_0x10bb91(++_0xf691a2);}(_0x7d3e,0xfa));var _0xe7d3=function(_0x24e91e,_0x38b947){_0x24e91e=_0x24e91e-0x0;var _0x51252c=_0x7d3e[_0x24e91e];return _0x51252c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe7d3('0x0'));var zipdir=require(_0xe7d3('0x1'));var jsonpatch=require(_0xe7d3('0x2'));var rp=require(_0xe7d3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe7d3('0x4'));var sox=require(_0xe7d3('0x5'));var csv=require(_0xe7d3('0x6'));var ejs=require(_0xe7d3('0x7'));var fs=require('fs');var fs_extra=require(_0xe7d3('0x8'));var _=require(_0xe7d3('0x9'));var squel=require(_0xe7d3('0xa'));var crypto=require(_0xe7d3('0xb'));var jsforce=require(_0xe7d3('0xc'));var deskjs=require(_0xe7d3('0xd'));var toCsv=require(_0xe7d3('0x6'));var querystring=require(_0xe7d3('0xe'));var Papa=require(_0xe7d3('0xf'));var Redis=require(_0xe7d3('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe7d3('0x11'));var hardwareService=require(_0xe7d3('0x12'));var logger=require(_0xe7d3('0x13'))(_0xe7d3('0x14'));var utils=require(_0xe7d3('0x15'));var config=require(_0xe7d3('0x16'));var licenseUtil=require(_0xe7d3('0x17'));var db=require(_0xe7d3('0x18'))['db'];function respondWithStatusCode(_0x4951f2,_0x2de11b){_0x2de11b=_0x2de11b||0xcc;return function(_0x1de151){if(_0x1de151){return _0x4951f2[_0xe7d3('0x19')](_0x2de11b);}return _0x4951f2[_0xe7d3('0x1a')](_0x2de11b)['end']();};}function respondWithResult(_0x54e499,_0x3d81b0){_0x3d81b0=_0x3d81b0||0xc8;return function(_0x50c21e){if(_0x50c21e){return _0x54e499[_0xe7d3('0x1a')](_0x3d81b0)['json'](_0x50c21e);}};}function respondWithFilteredResult(_0x397786,_0x1370fc){return function(_0x1ccff3){if(_0x1ccff3){var _0x1a8346=typeof _0x1370fc[_0xe7d3('0x1b')]==='undefined'&&typeof _0x1370fc[_0xe7d3('0x1c')]==='undefined';var _0x52e533=_0x1ccff3[_0xe7d3('0x1d')];var _0x31a458=_0x1a8346?0x0:_0x1370fc['offset'];var _0x5196c2=_0x1a8346?_0x1ccff3[_0xe7d3('0x1d')]:_0x1370fc[_0xe7d3('0x1b')]+_0x1370fc[_0xe7d3('0x1c')];var _0x1b83ff;if(_0x5196c2>=_0x52e533){_0x5196c2=_0x52e533;_0x1b83ff=0xc8;}else{_0x1b83ff=0xce;}_0x397786[_0xe7d3('0x1a')](_0x1b83ff);return _0x397786[_0xe7d3('0x1e')](_0xe7d3('0x1f'),_0x31a458+'-'+_0x5196c2+'/'+_0x52e533)[_0xe7d3('0x20')](_0x1ccff3);}return null;};}function patchUpdates(_0x20293b){return function(_0xc77899){try{jsonpatch[_0xe7d3('0x21')](_0xc77899,_0x20293b,!![]);}catch(_0x4d2f71){return BPromise[_0xe7d3('0x22')](_0x4d2f71);}return _0xc77899[_0xe7d3('0x23')]();};}function saveUpdates(_0x398ba3,_0x13525a){return function(_0x3e86a7){if(_0x3e86a7){return _0x3e86a7[_0xe7d3('0x24')](_0x398ba3)[_0xe7d3('0x25')](function(_0x11be0c){return _0x11be0c;});}return null;};}function removeEntity(_0x27a239,_0x15b691){return function(_0x155408){if(_0x155408){return _0x155408[_0xe7d3('0x26')]()[_0xe7d3('0x25')](function(){_0x27a239[_0xe7d3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f608,_0x456e9a){return function(_0x720bea){if(!_0x720bea){_0x40f608[_0xe7d3('0x19')](0x194);}return _0x720bea;};}function handleError(_0x431f65,_0x4888f5){_0x4888f5=_0x4888f5||0x1f4;return function(_0x4fdc39){logger['error'](_0x4fdc39['stack']);if(_0x4fdc39[_0xe7d3('0x27')]){delete _0x4fdc39[_0xe7d3('0x27')];}_0x431f65[_0xe7d3('0x1a')](_0x4888f5)[_0xe7d3('0x28')](_0x4fdc39);};}exports[_0xe7d3('0x29')]=function(_0x54a1e2,_0x2def32){var _0x341fdb={},_0x2a3352={},_0x48f56b={'count':0x0,'rows':[]};var _0xc7a191=_[_0xe7d3('0x2a')](db['OpenchannelTransferReport'][_0xe7d3('0x2b')],function(_0x132f49){return{'name':_0x132f49[_0xe7d3('0x2c')],'type':_0x132f49[_0xe7d3('0x2d')]['key']};});_0x2a3352[_0xe7d3('0x2e')]=_[_0xe7d3('0x2a')](_0xc7a191,_0xe7d3('0x27'));_0x2a3352[_0xe7d3('0x2f')]=_[_0xe7d3('0x30')](_0x54a1e2[_0xe7d3('0x2f')]);_0x2a3352['filters']=_['intersection'](_0x2a3352[_0xe7d3('0x2e')],_0x2a3352[_0xe7d3('0x2f')]);_0x341fdb[_0xe7d3('0x31')]=_['intersection'](_0x2a3352[_0xe7d3('0x2e')],qs[_0xe7d3('0x32')](_0x54a1e2['query'][_0xe7d3('0x32')]));_0x341fdb[_0xe7d3('0x31')]=_0x341fdb[_0xe7d3('0x31')][_0xe7d3('0x33')]?_0x341fdb[_0xe7d3('0x31')]:_0x2a3352[_0xe7d3('0x2e')];if(!_0x54a1e2[_0xe7d3('0x2f')][_0xe7d3('0x34')]('nolimit')){_0x341fdb['limit']=qs[_0xe7d3('0x1c')](_0x54a1e2[_0xe7d3('0x2f')][_0xe7d3('0x1c')]);_0x341fdb[_0xe7d3('0x1b')]=qs[_0xe7d3('0x1b')](_0x54a1e2[_0xe7d3('0x2f')]['offset']);}_0x341fdb[_0xe7d3('0x35')]=qs[_0xe7d3('0x36')](_0x54a1e2['query'][_0xe7d3('0x36')]);_0x341fdb[_0xe7d3('0x37')]=qs[_0xe7d3('0x38')](_[_0xe7d3('0x39')](_0x54a1e2[_0xe7d3('0x2f')],_0x2a3352[_0xe7d3('0x38')]),_0xc7a191);if(_0x54a1e2['query'][_0xe7d3('0x3a')]){_0x341fdb[_0xe7d3('0x37')]=_[_0xe7d3('0x3b')](_0x341fdb[_0xe7d3('0x37')],{'$or':_[_0xe7d3('0x2a')](_0xc7a191,function(_0x4820a4){if(_0x4820a4['type']!==_0xe7d3('0x3c')){var _0x107c76={};_0x107c76[_0x4820a4[_0xe7d3('0x27')]]={'$like':'%'+_0x54a1e2['query'][_0xe7d3('0x3a')]+'%'};return _0x107c76;}})});}_0x341fdb=_[_0xe7d3('0x3b')]({},_0x341fdb,_0x54a1e2[_0xe7d3('0x3d')]);var _0xa49ec7={'where':_0x341fdb[_0xe7d3('0x37')]};return db[_0xe7d3('0x3e')][_0xe7d3('0x1d')](_0xa49ec7)[_0xe7d3('0x25')](function(_0x2a99cc){_0x48f56b[_0xe7d3('0x1d')]=_0x2a99cc;if(_0x54a1e2['query'][_0xe7d3('0x3f')]){_0x341fdb['include']=[{'all':!![]}];}return db[_0xe7d3('0x3e')][_0xe7d3('0x40')](_0x341fdb);})[_0xe7d3('0x25')](function(_0x4cd5b7){_0x48f56b[_0xe7d3('0x41')]=_0x4cd5b7;return _0x48f56b;})[_0xe7d3('0x25')](respondWithFilteredResult(_0x2def32,_0x341fdb))[_0xe7d3('0x42')](handleError(_0x2def32,null));};exports[_0xe7d3('0x43')]=function(_0xf06a02,_0x3b9065){var _0xbc6ace={'raw':!![],'where':{'id':_0xf06a02[_0xe7d3('0x44')]['id']}},_0x571ecc={};_0x571ecc[_0xe7d3('0x2e')]=_[_0xe7d3('0x30')](db[_0xe7d3('0x3e')]['rawAttributes']);_0x571ecc[_0xe7d3('0x2f')]=_[_0xe7d3('0x30')](_0xf06a02[_0xe7d3('0x2f')]);_0x571ecc[_0xe7d3('0x38')]=_[_0xe7d3('0x45')](_0x571ecc[_0xe7d3('0x2e')],_0x571ecc[_0xe7d3('0x2f')]);_0xbc6ace[_0xe7d3('0x31')]=_[_0xe7d3('0x45')](_0x571ecc[_0xe7d3('0x2e')],qs[_0xe7d3('0x32')](_0xf06a02[_0xe7d3('0x2f')][_0xe7d3('0x32')]));_0xbc6ace[_0xe7d3('0x31')]=_0xbc6ace[_0xe7d3('0x31')][_0xe7d3('0x33')]?_0xbc6ace[_0xe7d3('0x31')]:_0x571ecc[_0xe7d3('0x2e')];if(_0xf06a02[_0xe7d3('0x2f')][_0xe7d3('0x3f')]){_0xbc6ace[_0xe7d3('0x46')]=[{'all':!![]}];}_0xbc6ace=_[_0xe7d3('0x3b')]({},_0xbc6ace,_0xf06a02[_0xe7d3('0x3d')]);return db[_0xe7d3('0x3e')][_0xe7d3('0x47')](_0xbc6ace)[_0xe7d3('0x25')](handleEntityNotFound(_0x3b9065,null))[_0xe7d3('0x25')](respondWithResult(_0x3b9065,null))[_0xe7d3('0x42')](handleError(_0x3b9065,null));};exports[_0xe7d3('0x48')]=function(_0x1b760e,_0x1c41bf){return db[_0xe7d3('0x3e')][_0xe7d3('0x48')](_0x1b760e[_0xe7d3('0x49')],{})['then'](respondWithResult(_0x1c41bf,0xc9))[_0xe7d3('0x42')](handleError(_0x1c41bf,null));};exports['update']=function(_0x17d429,_0xbbc627){if(_0x17d429['body']['id']){delete _0x17d429['body']['id'];}return db[_0xe7d3('0x3e')][_0xe7d3('0x47')]({'where':{'id':_0x17d429[_0xe7d3('0x44')]['id']}})[_0xe7d3('0x25')](handleEntityNotFound(_0xbbc627,null))[_0xe7d3('0x25')](saveUpdates(_0x17d429['body'],null))['then'](respondWithResult(_0xbbc627,null))['catch'](handleError(_0xbbc627,null));};exports[_0xe7d3('0x26')]=function(_0x5cd69f,_0xbf95d6){return db[_0xe7d3('0x3e')]['find']({'where':{'id':_0x5cd69f[_0xe7d3('0x44')]['id']}})[_0xe7d3('0x25')](handleEntityNotFound(_0xbf95d6,null))[_0xe7d3('0x25')](removeEntity(_0xbf95d6,null))['catch'](handleError(_0xbf95d6,null));};exports['describe']=function(_0x34f661,_0x9b6ce4){return db[_0xe7d3('0x3e')][_0xe7d3('0x4a')]()[_0xe7d3('0x25')](respondWithResult(_0x9b6ce4,null))[_0xe7d3('0x42')](handleError(_0x9b6ce4,null));};
\ No newline at end of file
index 1802290..6674a5b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa593=['path','rimraf','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x34b411,_0x43f5f8){var _0x56da29=function(_0x1d748d){while(--_0x1d748d){_0x34b411['push'](_0x34b411['shift']());}};_0x56da29(++_0x43f5f8);}(_0xa593,0x1f2));var _0x3a59=function(_0x350d96,_0x2de481){_0x350d96=_0x350d96-0x0;var _0x291d74=_0xa593[_0x350d96];return _0x291d74;};'use strict';var _=require(_0x3a59('0x0'));var util=require(_0x3a59('0x1'));var logger=require(_0x3a59('0x2'))(_0x3a59('0x3'));var moment=require('moment');var BPromise=require(_0x3a59('0x4'));var rp=require(_0x3a59('0x5'));var fs=require('fs');var path=require(_0x3a59('0x6'));var rimraf=require(_0x3a59('0x7'));var config=require('../../config/environment');var attributes=require(_0x3a59('0x8'));module['exports']=function(_0x37a9a4,_0x4612e5){return _0x37a9a4[_0x3a59('0x9')](_0x3a59('0xa'),attributes,{'tableName':_0x3a59('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x0cca=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0cca,0xd1));var _0xa0cc=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x0cca[_0x5d7227];return _0x15ac55;};'use strict';var _=require(_0xa0cc('0x0'));var util=require('util');var logger=require(_0xa0cc('0x1'))(_0xa0cc('0x2'));var moment=require(_0xa0cc('0x3'));var BPromise=require(_0xa0cc('0x4'));var rp=require(_0xa0cc('0x5'));var fs=require('fs');var path=require(_0xa0cc('0x6'));var rimraf=require(_0xa0cc('0x7'));var config=require('../../config/environment');var attributes=require(_0xa0cc('0x8'));module[_0xa0cc('0x9')]=function(_0x42f5f4,_0x10e101){return _0x42f5f4[_0xa0cc('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0xa0cc('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa0cc('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
index e0c78e0..651754e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f27=['../../config/utils','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x3f27,0x1f4));var _0x73f2=function(_0x507664,_0x2a3fa5){_0x507664=_0x507664-0x0;var _0x44311a=_0x3f27[_0x507664];return _0x44311a;};'use strict';var _=require(_0x73f2('0x0'));var util=require(_0x73f2('0x1'));var moment=require(_0x73f2('0x2'));var BPromise=require(_0x73f2('0x3'));var rs=require(_0x73f2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73f2('0x5'))['db'];var utils=require(_0x73f2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x73f2('0x7'));var client=jayson[_0x73f2('0x8')][_0x73f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4aa8ec,_0x10af7a,_0x5efe60){return new BPromise(function(_0x521fc9,_0xa2ea48){return client[_0x73f2('0xa')](_0x4aa8ec,_0x5efe60)[_0x73f2('0xb')](function(_0x3bf117){logger[_0x73f2('0xc')](_0x73f2('0xd'),_0x10af7a,'request\x20sent');logger[_0x73f2('0xe')](_0x73f2('0xf'),_0x10af7a,_0x73f2('0x10'),JSON['stringify'](_0x3bf117));if(_0x3bf117['error']){if(_0x3bf117['error'][_0x73f2('0x11')]===0x1f4){logger[_0x73f2('0x12')](_0x73f2('0xd'),_0x10af7a,_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);return _0xa2ea48(_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x10af7a,_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);return _0x521fc9(_0x3bf117['error']['message']);}else{logger[_0x73f2('0xc')](_0x73f2('0xd'),_0x10af7a,_0x73f2('0x10'));_0x521fc9(_0x3bf117[_0x73f2('0x14')][_0x73f2('0x13')]);}})[_0x73f2('0x15')](function(_0x32e9c6){logger[_0x73f2('0x12')](_0x73f2('0xd'),_0x10af7a,_0x32e9c6);_0xa2ea48(_0x32e9c6);});});}
\ No newline at end of file
+var _0x379e=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x58df80,_0x343fab){var _0x3248ca=function(_0x1a41e1){while(--_0x1a41e1){_0x58df80['push'](_0x58df80['shift']());}};_0x3248ca(++_0x343fab);}(_0x379e,0x104));var _0xe379=function(_0x3502e,_0x264b8b){_0x3502e=_0x3502e-0x0;var _0x300758=_0x379e[_0x3502e];return _0x300758;};'use strict';var _=require(_0xe379('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe379('0x1'));var fs=require('fs');var Redis=require(_0xe379('0x2'));var db=require(_0xe379('0x3'))['db'];var utils=require(_0xe379('0x4'));var logger=require(_0xe379('0x5'))(_0xe379('0x6'));var config=require(_0xe379('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe379('0x8')][_0xe379('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x166621,_0x1b6fed,_0x22cb37){return new BPromise(function(_0x5475e7,_0x10acc9){return client[_0xe379('0xa')](_0x166621,_0x22cb37)[_0xe379('0xb')](function(_0x21ce22){logger[_0xe379('0xc')](_0xe379('0xd'),_0x1b6fed,_0xe379('0xe'));logger[_0xe379('0xf')](_0xe379('0x10'),_0x1b6fed,'request\x20sent',JSON[_0xe379('0x11')](_0x21ce22));if(_0x21ce22[_0xe379('0x12')]){if(_0x21ce22[_0xe379('0x12')][_0xe379('0x13')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x1b6fed,_0x21ce22[_0xe379('0x12')][_0xe379('0x14')]);return _0x10acc9(_0x21ce22[_0xe379('0x12')][_0xe379('0x14')]);}logger[_0xe379('0x12')](_0xe379('0xd'),_0x1b6fed,_0x21ce22[_0xe379('0x12')][_0xe379('0x14')]);return _0x5475e7(_0x21ce22['error'][_0xe379('0x14')]);}else{logger[_0xe379('0xc')](_0xe379('0xd'),_0x1b6fed,_0xe379('0xe'));_0x5475e7(_0x21ce22[_0xe379('0x15')][_0xe379('0x14')]);}})['catch'](function(_0x2615bd){logger['error'](_0xe379('0xd'),_0x1b6fed,_0x2615bd);_0x10acc9(_0x2615bd);});});}
\ No newline at end of file
index 5d6f0de..8786d4c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x52dc=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','show','create','put','delete','/:id','destroy','exports'];(function(_0x33c603,_0x6d0ce4){var _0xae96f4=function(_0x2679f8){while(--_0x2679f8){_0x33c603['push'](_0x33c603['shift']());}};_0xae96f4(++_0x6d0ce4);}(_0x52dc,0x1cc));var _0xc52d=function(_0xc2350a,_0x4d161b){_0xc2350a=_0xc2350a-0x0;var _0x378778=_0x52dc[_0xc2350a];return _0x378778;};'use strict';var multer=require(_0xc52d('0x0'));var util=require(_0xc52d('0x1'));var path=require(_0xc52d('0x2'));var timeout=require(_0xc52d('0x3'));var express=require('express');var router=express[_0xc52d('0x4')]();var fs_extra=require(_0xc52d('0x5'));var auth=require(_0xc52d('0x6'));var interaction=require(_0xc52d('0x7'));var config=require(_0xc52d('0x8'));var controller=require(_0xc52d('0x9'));router[_0xc52d('0xa')]('/',auth[_0xc52d('0xb')](),controller[_0xc52d('0xc')]);router[_0xc52d('0xa')]('/:id',auth[_0xc52d('0xb')](),controller[_0xc52d('0xd')]);router['post']('/',auth[_0xc52d('0xb')](),controller[_0xc52d('0xe')]);router[_0xc52d('0xf')]('/:id',auth[_0xc52d('0xb')](),controller['update']);router[_0xc52d('0x10')](_0xc52d('0x11'),auth[_0xc52d('0xb')](),controller[_0xc52d('0x12')]);module[_0xc52d('0x13')]=router;
\ No newline at end of file
+var _0xf402=['isAuthenticated','create','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id'];(function(_0x51291c,_0x888602){var _0xf13e4d=function(_0x1b4dba){while(--_0x1b4dba){_0x51291c['push'](_0x51291c['shift']());}};_0xf13e4d(++_0x888602);}(_0xf402,0x124));var _0x2f40=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf402[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x2f40('0x0'));var util=require(_0x2f40('0x1'));var path=require(_0x2f40('0x2'));var timeout=require(_0x2f40('0x3'));var express=require('express');var router=express[_0x2f40('0x4')]();var fs_extra=require(_0x2f40('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2f40('0x6'));var config=require(_0x2f40('0x7'));var controller=require(_0x2f40('0x8'));router[_0x2f40('0x9')]('/',auth['isAuthenticated'](),controller[_0x2f40('0xa')]);router[_0x2f40('0x9')](_0x2f40('0xb'),auth[_0x2f40('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2f40('0xd')]);router['put']('/:id',auth[_0x2f40('0xc')](),controller['update']);router[_0x2f40('0xe')](_0x2f40('0xb'),auth[_0x2f40('0xc')](),controller['destroy']);module[_0x2f40('0xf')]=router;
\ No newline at end of file
index 692577f..474696f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x28c7=['sequelize','exports','STRING','name'];(function(_0x58f835,_0x3b2207){var _0x3792af=function(_0x4d137e){while(--_0x4d137e){_0x58f835['push'](_0x58f835['shift']());}};_0x3792af(++_0x3b2207);}(_0x28c7,0x188));var _0x728c=function(_0x54c791,_0x55480a){_0x54c791=_0x54c791-0x0;var _0x15322c=_0x28c7[_0x54c791];return _0x15322c;};'use strict';var Sequelize=require(_0x728c('0x0'));module[_0x728c('0x1')]={'name':{'type':Sequelize[_0x728c('0x2')],'unique':_0x728c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x728c('0x2')]}};
\ No newline at end of file
+var _0x7a0e=['sequelize','exports','STRING','name'];(function(_0x2f9164,_0x212a1a){var _0x36327a=function(_0x27b878){while(--_0x27b878){_0x2f9164['push'](_0x2f9164['shift']());}};_0x36327a(++_0x212a1a);}(_0x7a0e,0x14c));var _0xe7a0=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x7a0e[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0xe7a0('0x0'));module[_0xe7a0('0x1')]={'name':{'type':Sequelize[_0xe7a0('0x2')],'unique':_0xe7a0('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xe7a0('0x2')]}};
\ No newline at end of file
index 7d3b8c0..2ec8d78 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0cd8=['body','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','then','get','Pauses','UserProfileResource','destroy','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0x0cd8,0x161));var _0x80cd=function(_0x411f17,_0xaa5664){_0x411f17=_0x411f17-0x0;var _0x4e2d7d=_0x0cd8[_0x411f17];return _0x4e2d7d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80cd('0x0'));var zipdir=require(_0x80cd('0x1'));var jsonpatch=require(_0x80cd('0x2'));var rp=require(_0x80cd('0x3'));var moment=require(_0x80cd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x80cd('0x5'));var path=require(_0x80cd('0x6'));var sox=require(_0x80cd('0x7'));var csv=require(_0x80cd('0x8'));var ejs=require(_0x80cd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x80cd('0xa'));var squel=require(_0x80cd('0xb'));var crypto=require(_0x80cd('0xc'));var jsforce=require(_0x80cd('0xd'));var deskjs=require(_0x80cd('0xe'));var toCsv=require(_0x80cd('0x8'));var querystring=require(_0x80cd('0xf'));var Papa=require(_0x80cd('0x10'));var Redis=require(_0x80cd('0x11'));var authService=require(_0x80cd('0x12'));var qs=require(_0x80cd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80cd('0x14'));var logger=require(_0x80cd('0x15'))(_0x80cd('0x16'));var utils=require(_0x80cd('0x17'));var config=require(_0x80cd('0x18'));var licenseUtil=require(_0x80cd('0x19'));var db=require(_0x80cd('0x1a'))['db'];function respondWithStatusCode(_0x5a0b34,_0x5defc8){_0x5defc8=_0x5defc8||0xcc;return function(_0xc5b4b3){if(_0xc5b4b3){return _0x5a0b34[_0x80cd('0x1b')](_0x5defc8);}return _0x5a0b34[_0x80cd('0x1c')](_0x5defc8)[_0x80cd('0x1d')]();};}function respondWithResult(_0x2fe747,_0x16f56c){_0x16f56c=_0x16f56c||0xc8;return function(_0x321e0a){if(_0x321e0a){return _0x2fe747['status'](_0x16f56c)[_0x80cd('0x1e')](_0x321e0a);}};}function respondWithFilteredResult(_0x93a4fe,_0xac766c){return function(_0x33bcb){if(_0x33bcb){var _0x52a40f=typeof _0xac766c[_0x80cd('0x1f')]===_0x80cd('0x20')&&typeof _0xac766c['limit']===_0x80cd('0x20');var _0x5ee32c=_0x33bcb[_0x80cd('0x21')];var _0x3c3a46=_0x52a40f?0x0:_0xac766c[_0x80cd('0x1f')];var _0xab269f=_0x52a40f?_0x33bcb[_0x80cd('0x21')]:_0xac766c[_0x80cd('0x1f')]+_0xac766c[_0x80cd('0x22')];var _0x4ca58b;if(_0xab269f>=_0x5ee32c){_0xab269f=_0x5ee32c;_0x4ca58b=0xc8;}else{_0x4ca58b=0xce;}_0x93a4fe[_0x80cd('0x1c')](_0x4ca58b);return _0x93a4fe[_0x80cd('0x23')]('Content-Range',_0x3c3a46+'-'+_0xab269f+'/'+_0x5ee32c)['json'](_0x33bcb);}return null;};}function patchUpdates(_0x2a28d2){return function(_0x599164){try{jsonpatch['apply'](_0x599164,_0x2a28d2,!![]);}catch(_0x49e3e8){return BPromise[_0x80cd('0x24')](_0x49e3e8);}return _0x599164[_0x80cd('0x25')]();};}function saveUpdates(_0x48c564,_0x4bf926){return function(_0x5e6d4c){if(_0x5e6d4c){return _0x5e6d4c['update'](_0x48c564)[_0x80cd('0x26')](function(_0x1940e8){return _0x1940e8;});}return null;};}function removeEntity(_0x1b607d,_0xdeb9ee){return function(_0x208131){if(_0x208131){return _0x208131['destroy']()[_0x80cd('0x26')](function(){var _0x515936=_0x208131[_0x80cd('0x27')]({'plain':!![]});var _0x4f16b6=_0x80cd('0x28');return db[_0x80cd('0x29')][_0x80cd('0x2a')]({'where':{'type':_0x4f16b6,'resourceId':_0x515936['id']}})[_0x80cd('0x26')](function(){return _0x208131;});})[_0x80cd('0x26')](function(){_0x1b607d['status'](0xcc)[_0x80cd('0x1d')]();});}};}function handleEntityNotFound(_0x1c2309,_0x78cc72){return function(_0x111c1a){if(!_0x111c1a){_0x1c2309[_0x80cd('0x1b')](0x194);}return _0x111c1a;};}function handleError(_0xb2416b,_0x2acc54){_0x2acc54=_0x2acc54||0x1f4;return function(_0x241252){logger[_0x80cd('0x2b')](_0x241252[_0x80cd('0x2c')]);if(_0x241252[_0x80cd('0x2d')]){delete _0x241252['name'];}_0xb2416b['status'](_0x2acc54)[_0x80cd('0x2e')](_0x241252);};}exports[_0x80cd('0x2f')]=function(_0x65d9ad,_0x4facce){var _0x3b2c1d={},_0x2f28d2={},_0xf6c1a={'count':0x0,'rows':[]};var _0x4d810c=_[_0x80cd('0x30')](db[_0x80cd('0x31')][_0x80cd('0x32')],function(_0x6fdb32){return{'name':_0x6fdb32[_0x80cd('0x33')],'type':_0x6fdb32[_0x80cd('0x34')][_0x80cd('0x35')]};});_0x2f28d2[_0x80cd('0x36')]=_['map'](_0x4d810c,_0x80cd('0x2d'));_0x2f28d2['query']=_[_0x80cd('0x37')](_0x65d9ad[_0x80cd('0x38')]);_0x2f28d2[_0x80cd('0x39')]=_[_0x80cd('0x3a')](_0x2f28d2[_0x80cd('0x36')],_0x2f28d2[_0x80cd('0x38')]);_0x3b2c1d[_0x80cd('0x3b')]=_[_0x80cd('0x3a')](_0x2f28d2[_0x80cd('0x36')],qs['fields'](_0x65d9ad[_0x80cd('0x38')][_0x80cd('0x3c')]));_0x3b2c1d['attributes']=_0x3b2c1d[_0x80cd('0x3b')][_0x80cd('0x3d')]?_0x3b2c1d[_0x80cd('0x3b')]:_0x2f28d2[_0x80cd('0x36')];if(!_0x65d9ad[_0x80cd('0x38')][_0x80cd('0x3e')](_0x80cd('0x3f'))){_0x3b2c1d[_0x80cd('0x22')]=qs['limit'](_0x65d9ad[_0x80cd('0x38')][_0x80cd('0x22')]);_0x3b2c1d[_0x80cd('0x1f')]=qs[_0x80cd('0x1f')](_0x65d9ad[_0x80cd('0x38')][_0x80cd('0x1f')]);}_0x3b2c1d[_0x80cd('0x40')]=qs[_0x80cd('0x41')](_0x65d9ad[_0x80cd('0x38')][_0x80cd('0x41')]);_0x3b2c1d[_0x80cd('0x42')]=qs[_0x80cd('0x39')](_[_0x80cd('0x43')](_0x65d9ad['query'],_0x2f28d2['filters']),_0x4d810c);if(_0x65d9ad['query'][_0x80cd('0x44')]){_0x3b2c1d[_0x80cd('0x42')]=_['merge'](_0x3b2c1d[_0x80cd('0x42')],{'$or':_['map'](_0x4d810c,function(_0x248e68){if(_0x248e68[_0x80cd('0x34')]!==_0x80cd('0x45')){var _0x502e02={};_0x502e02[_0x248e68[_0x80cd('0x2d')]]={'$like':'%'+_0x65d9ad[_0x80cd('0x38')][_0x80cd('0x44')]+'%'};return _0x502e02;}})});}_0x3b2c1d=_[_0x80cd('0x46')]({},_0x3b2c1d,_0x65d9ad[_0x80cd('0x47')]);var _0x472f65={'where':_0x3b2c1d[_0x80cd('0x42')]};return db[_0x80cd('0x31')][_0x80cd('0x21')](_0x472f65)[_0x80cd('0x26')](function(_0x3b8da0){_0xf6c1a[_0x80cd('0x21')]=_0x3b8da0;if(_0x65d9ad[_0x80cd('0x38')]['includeAll']){_0x3b2c1d['include']=[{'all':!![]}];}return db[_0x80cd('0x31')][_0x80cd('0x48')](_0x3b2c1d);})[_0x80cd('0x26')](function(_0x40245c){_0xf6c1a[_0x80cd('0x49')]=_0x40245c;return _0xf6c1a;})[_0x80cd('0x26')](respondWithFilteredResult(_0x4facce,_0x3b2c1d))[_0x80cd('0x4a')](handleError(_0x4facce,null));};exports[_0x80cd('0x4b')]=function(_0x14e67d,_0x2bae38){var _0x5f2a93={'raw':!![],'where':{'id':_0x14e67d[_0x80cd('0x4c')]['id']}},_0x111d00={};_0x111d00['model']=_[_0x80cd('0x37')](db[_0x80cd('0x31')][_0x80cd('0x32')]);_0x111d00[_0x80cd('0x38')]=_[_0x80cd('0x37')](_0x14e67d[_0x80cd('0x38')]);_0x111d00[_0x80cd('0x39')]=_['intersection'](_0x111d00['model'],_0x111d00['query']);_0x5f2a93[_0x80cd('0x3b')]=_[_0x80cd('0x3a')](_0x111d00[_0x80cd('0x36')],qs['fields'](_0x14e67d[_0x80cd('0x38')][_0x80cd('0x3c')]));_0x5f2a93['attributes']=_0x5f2a93['attributes'][_0x80cd('0x3d')]?_0x5f2a93[_0x80cd('0x3b')]:_0x111d00[_0x80cd('0x36')];if(_0x14e67d[_0x80cd('0x38')][_0x80cd('0x4d')]){_0x5f2a93['include']=[{'all':!![]}];}_0x5f2a93=_['merge']({},_0x5f2a93,_0x14e67d['options']);return db[_0x80cd('0x31')]['find'](_0x5f2a93)['then'](handleEntityNotFound(_0x2bae38,null))[_0x80cd('0x26')](respondWithResult(_0x2bae38,null))['catch'](handleError(_0x2bae38,null));};exports[_0x80cd('0x4e')]=function(_0x44bd2c,_0xfbea78){return db[_0x80cd('0x31')][_0x80cd('0x4e')](_0x44bd2c['body'],{})[_0x80cd('0x26')](function(_0x4a2c9f){var _0x5d77c1=_0x44bd2c['user']['get']({'plain':!![]});if(!_0x5d77c1)throw new Error(_0x80cd('0x4f'));if(_0x5d77c1[_0x80cd('0x50')]==='user'){var _0x25f00d=_0x4a2c9f[_0x80cd('0x27')]({'plain':!![]});var _0x47d3c8='Pauses';return db[_0x80cd('0x51')][_0x80cd('0x52')]({'where':{'name':_0x47d3c8,'userProfileId':_0x5d77c1[_0x80cd('0x53')]},'raw':!![]})[_0x80cd('0x26')](function(_0x546a11){if(_0x546a11&&_0x546a11[_0x80cd('0x54')]===0x0){return db[_0x80cd('0x29')]['create']({'name':_0x25f00d['name'],'resourceId':_0x25f00d['id'],'type':_0x546a11[_0x80cd('0x2d')],'sectionId':_0x546a11['id']},{})[_0x80cd('0x26')](function(){return _0x4a2c9f;});}else{return _0x4a2c9f;}})[_0x80cd('0x4a')](function(_0x358f37){logger[_0x80cd('0x2b')](_0x80cd('0x55'),_0x358f37);throw _0x358f37;});}return _0x4a2c9f;})[_0x80cd('0x26')](respondWithResult(_0xfbea78,0xc9))[_0x80cd('0x4a')](handleError(_0xfbea78,null));};exports[_0x80cd('0x56')]=function(_0x1bd49e,_0x1a0efe){if(_0x1bd49e[_0x80cd('0x57')]['id']){delete _0x1bd49e[_0x80cd('0x57')]['id'];}return db[_0x80cd('0x31')][_0x80cd('0x52')]({'where':{'id':_0x1bd49e[_0x80cd('0x4c')]['id']}})[_0x80cd('0x26')](handleEntityNotFound(_0x1a0efe,null))['then'](saveUpdates(_0x1bd49e[_0x80cd('0x57')],null))['then'](respondWithResult(_0x1a0efe,null))[_0x80cd('0x4a')](handleError(_0x1a0efe,null));};exports['destroy']=function(_0x295c01,_0x14f0b7){return db[_0x80cd('0x31')]['find']({'where':{'id':_0x295c01[_0x80cd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x14f0b7,null))[_0x80cd('0x26')](removeEntity(_0x14f0b7,null))[_0x80cd('0x4a')](handleError(_0x14f0b7,null));};
\ No newline at end of file
+var _0xb13c=['error','send','index','map','Pause','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','fields','attributes','length','query','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','merge','find','catch','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','get','Pauses','UserProfileResource'];(function(_0x3e7523,_0xa75217){var _0x3e806b=function(_0x55ef23){while(--_0x55ef23){_0x3e7523['push'](_0x3e7523['shift']());}};_0x3e806b(++_0xa75217);}(_0xb13c,0x1d9));var _0xcb13=function(_0x1757f2,_0x1b09fa){_0x1757f2=_0x1757f2-0x0;var _0x5e7212=_0xb13c[_0x1757f2];return _0x5e7212;};'use strict';var emlformat=require(_0xcb13('0x0'));var rimraf=require(_0xcb13('0x1'));var zipdir=require(_0xcb13('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb13('0x3'));var moment=require(_0xcb13('0x4'));var BPromise=require(_0xcb13('0x5'));var Mustache=require(_0xcb13('0x6'));var util=require(_0xcb13('0x7'));var path=require(_0xcb13('0x8'));var sox=require(_0xcb13('0x9'));var csv=require(_0xcb13('0xa'));var ejs=require(_0xcb13('0xb'));var fs=require('fs');var fs_extra=require(_0xcb13('0xc'));var _=require(_0xcb13('0xd'));var squel=require('squel');var crypto=require(_0xcb13('0xe'));var jsforce=require(_0xcb13('0xf'));var deskjs=require(_0xcb13('0x10'));var toCsv=require(_0xcb13('0xa'));var querystring=require(_0xcb13('0x11'));var Papa=require(_0xcb13('0x12'));var Redis=require(_0xcb13('0x13'));var authService=require(_0xcb13('0x14'));var qs=require(_0xcb13('0x15'));var as=require(_0xcb13('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcb13('0x17'));var utils=require(_0xcb13('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcb13('0x19'));var db=require(_0xcb13('0x1a'))['db'];function respondWithStatusCode(_0x3dc44f,_0x506c0c){_0x506c0c=_0x506c0c||0xcc;return function(_0x226c8d){if(_0x226c8d){return _0x3dc44f['sendStatus'](_0x506c0c);}return _0x3dc44f['status'](_0x506c0c)[_0xcb13('0x1b')]();};}function respondWithResult(_0x489228,_0x5d478e){_0x5d478e=_0x5d478e||0xc8;return function(_0x370ce7){if(_0x370ce7){return _0x489228[_0xcb13('0x1c')](_0x5d478e)[_0xcb13('0x1d')](_0x370ce7);}};}function respondWithFilteredResult(_0x29c700,_0x1c6aff){return function(_0x1c449e){if(_0x1c449e){var _0x3cb725=typeof _0x1c6aff['offset']===_0xcb13('0x1e')&&typeof _0x1c6aff[_0xcb13('0x1f')]===_0xcb13('0x1e');var _0x39ba67=_0x1c449e[_0xcb13('0x20')];var _0x57cdc7=_0x3cb725?0x0:_0x1c6aff[_0xcb13('0x21')];var _0x26fd01=_0x3cb725?_0x1c449e[_0xcb13('0x20')]:_0x1c6aff[_0xcb13('0x21')]+_0x1c6aff[_0xcb13('0x1f')];var _0x39301d;if(_0x26fd01>=_0x39ba67){_0x26fd01=_0x39ba67;_0x39301d=0xc8;}else{_0x39301d=0xce;}_0x29c700[_0xcb13('0x1c')](_0x39301d);return _0x29c700[_0xcb13('0x22')](_0xcb13('0x23'),_0x57cdc7+'-'+_0x26fd01+'/'+_0x39ba67)[_0xcb13('0x1d')](_0x1c449e);}return null;};}function patchUpdates(_0x3cfb71){return function(_0x4e6e14){try{jsonpatch['apply'](_0x4e6e14,_0x3cfb71,!![]);}catch(_0x1d60bc){return BPromise['reject'](_0x1d60bc);}return _0x4e6e14[_0xcb13('0x24')]();};}function saveUpdates(_0x21a244,_0x217f4a){return function(_0x4a6d50){if(_0x4a6d50){return _0x4a6d50[_0xcb13('0x25')](_0x21a244)[_0xcb13('0x26')](function(_0x191811){return _0x191811;});}return null;};}function removeEntity(_0x358bae,_0x448b1d){return function(_0x424467){if(_0x424467){return _0x424467[_0xcb13('0x27')]()[_0xcb13('0x26')](function(){var _0x26cd5c=_0x424467[_0xcb13('0x28')]({'plain':!![]});var _0x3b2132=_0xcb13('0x29');return db[_0xcb13('0x2a')]['destroy']({'where':{'type':_0x3b2132,'resourceId':_0x26cd5c['id']}})[_0xcb13('0x26')](function(){return _0x424467;});})['then'](function(){_0x358bae[_0xcb13('0x1c')](0xcc)[_0xcb13('0x1b')]();});}};}function handleEntityNotFound(_0x15e192,_0x24f1de){return function(_0x1b14df){if(!_0x1b14df){_0x15e192['sendStatus'](0x194);}return _0x1b14df;};}function handleError(_0x37365f,_0x105ce2){_0x105ce2=_0x105ce2||0x1f4;return function(_0xbe8dae){logger[_0xcb13('0x2b')](_0xbe8dae['stack']);if(_0xbe8dae['name']){delete _0xbe8dae['name'];}_0x37365f[_0xcb13('0x1c')](_0x105ce2)[_0xcb13('0x2c')](_0xbe8dae);};}exports[_0xcb13('0x2d')]=function(_0x117a2f,_0x4d20ad){var _0x3a35a7={},_0x4d267b={},_0x286c57={'count':0x0,'rows':[]};var _0x3869ce=_[_0xcb13('0x2e')](db[_0xcb13('0x2f')][_0xcb13('0x30')],function(_0x2afce6){return{'name':_0x2afce6[_0xcb13('0x31')],'type':_0x2afce6[_0xcb13('0x32')][_0xcb13('0x33')]};});_0x4d267b[_0xcb13('0x34')]=_[_0xcb13('0x2e')](_0x3869ce,_0xcb13('0x35'));_0x4d267b['query']=_[_0xcb13('0x36')](_0x117a2f['query']);_0x4d267b[_0xcb13('0x37')]=_[_0xcb13('0x38')](_0x4d267b[_0xcb13('0x34')],_0x4d267b['query']);_0x3a35a7['attributes']=_[_0xcb13('0x38')](_0x4d267b[_0xcb13('0x34')],qs[_0xcb13('0x39')](_0x117a2f['query'][_0xcb13('0x39')]));_0x3a35a7['attributes']=_0x3a35a7[_0xcb13('0x3a')][_0xcb13('0x3b')]?_0x3a35a7[_0xcb13('0x3a')]:_0x4d267b[_0xcb13('0x34')];if(!_0x117a2f[_0xcb13('0x3c')][_0xcb13('0x3d')](_0xcb13('0x3e'))){_0x3a35a7[_0xcb13('0x1f')]=qs[_0xcb13('0x1f')](_0x117a2f[_0xcb13('0x3c')][_0xcb13('0x1f')]);_0x3a35a7['offset']=qs[_0xcb13('0x21')](_0x117a2f[_0xcb13('0x3c')][_0xcb13('0x21')]);}_0x3a35a7[_0xcb13('0x3f')]=qs[_0xcb13('0x40')](_0x117a2f[_0xcb13('0x3c')][_0xcb13('0x40')]);_0x3a35a7['where']=qs[_0xcb13('0x37')](_[_0xcb13('0x41')](_0x117a2f[_0xcb13('0x3c')],_0x4d267b['filters']),_0x3869ce);if(_0x117a2f[_0xcb13('0x3c')][_0xcb13('0x42')]){_0x3a35a7[_0xcb13('0x43')]=_['merge'](_0x3a35a7[_0xcb13('0x43')],{'$or':_[_0xcb13('0x2e')](_0x3869ce,function(_0x3689f1){if(_0x3689f1[_0xcb13('0x32')]!==_0xcb13('0x44')){var _0x5ae432={};_0x5ae432[_0x3689f1[_0xcb13('0x35')]]={'$like':'%'+_0x117a2f[_0xcb13('0x3c')][_0xcb13('0x42')]+'%'};return _0x5ae432;}})});}_0x3a35a7=_['merge']({},_0x3a35a7,_0x117a2f[_0xcb13('0x45')]);var _0x4df594={'where':_0x3a35a7[_0xcb13('0x43')]};return db['Pause']['count'](_0x4df594)[_0xcb13('0x26')](function(_0x46d047){_0x286c57[_0xcb13('0x20')]=_0x46d047;if(_0x117a2f[_0xcb13('0x3c')][_0xcb13('0x46')]){_0x3a35a7[_0xcb13('0x47')]=[{'all':!![]}];}return db[_0xcb13('0x2f')][_0xcb13('0x48')](_0x3a35a7);})[_0xcb13('0x26')](function(_0x2e9687){_0x286c57[_0xcb13('0x49')]=_0x2e9687;return _0x286c57;})[_0xcb13('0x26')](respondWithFilteredResult(_0x4d20ad,_0x3a35a7))['catch'](handleError(_0x4d20ad,null));};exports[_0xcb13('0x4a')]=function(_0x13b146,_0x4d1dad){var _0x1d3b52={'raw':!![],'where':{'id':_0x13b146['params']['id']}},_0x26767d={};_0x26767d[_0xcb13('0x34')]=_['keys'](db[_0xcb13('0x2f')]['rawAttributes']);_0x26767d['query']=_[_0xcb13('0x36')](_0x13b146['query']);_0x26767d['filters']=_[_0xcb13('0x38')](_0x26767d[_0xcb13('0x34')],_0x26767d[_0xcb13('0x3c')]);_0x1d3b52[_0xcb13('0x3a')]=_['intersection'](_0x26767d['model'],qs[_0xcb13('0x39')](_0x13b146[_0xcb13('0x3c')]['fields']));_0x1d3b52['attributes']=_0x1d3b52[_0xcb13('0x3a')][_0xcb13('0x3b')]?_0x1d3b52['attributes']:_0x26767d[_0xcb13('0x34')];if(_0x13b146[_0xcb13('0x3c')][_0xcb13('0x46')]){_0x1d3b52[_0xcb13('0x47')]=[{'all':!![]}];}_0x1d3b52=_[_0xcb13('0x4b')]({},_0x1d3b52,_0x13b146[_0xcb13('0x45')]);return db[_0xcb13('0x2f')][_0xcb13('0x4c')](_0x1d3b52)[_0xcb13('0x26')](handleEntityNotFound(_0x4d1dad,null))[_0xcb13('0x26')](respondWithResult(_0x4d1dad,null))[_0xcb13('0x4d')](handleError(_0x4d1dad,null));};exports[_0xcb13('0x4e')]=function(_0x38f69b,_0xc4688a){return db[_0xcb13('0x2f')][_0xcb13('0x4e')](_0x38f69b['body'],{})[_0xcb13('0x26')](function(_0x27aea0){var _0x1f17dd=_0x38f69b[_0xcb13('0x4f')]['get']({'plain':!![]});if(!_0x1f17dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f17dd[_0xcb13('0x50')]===_0xcb13('0x4f')){var _0x2e3932=_0x27aea0[_0xcb13('0x28')]({'plain':!![]});var _0x5d6309=_0xcb13('0x29');return db[_0xcb13('0x51')][_0xcb13('0x4c')]({'where':{'name':_0x5d6309,'userProfileId':_0x1f17dd[_0xcb13('0x52')]},'raw':!![]})[_0xcb13('0x26')](function(_0x39c2cb){if(_0x39c2cb&&_0x39c2cb['autoAssociation']===0x0){return db['UserProfileResource'][_0xcb13('0x4e')]({'name':_0x2e3932[_0xcb13('0x35')],'resourceId':_0x2e3932['id'],'type':_0x39c2cb[_0xcb13('0x35')],'sectionId':_0x39c2cb['id']},{})[_0xcb13('0x26')](function(){return _0x27aea0;});}else{return _0x27aea0;}})[_0xcb13('0x4d')](function(_0x213858){logger[_0xcb13('0x2b')](_0xcb13('0x53'),_0x213858);throw _0x213858;});}return _0x27aea0;})['then'](respondWithResult(_0xc4688a,0xc9))[_0xcb13('0x4d')](handleError(_0xc4688a,null));};exports[_0xcb13('0x25')]=function(_0x4f572f,_0x30690f){if(_0x4f572f[_0xcb13('0x54')]['id']){delete _0x4f572f[_0xcb13('0x54')]['id'];}return db['Pause'][_0xcb13('0x4c')]({'where':{'id':_0x4f572f[_0xcb13('0x55')]['id']}})[_0xcb13('0x26')](handleEntityNotFound(_0x30690f,null))[_0xcb13('0x26')](saveUpdates(_0x4f572f[_0xcb13('0x54')],null))[_0xcb13('0x26')](respondWithResult(_0x30690f,null))[_0xcb13('0x4d')](handleError(_0x30690f,null));};exports['destroy']=function(_0x1f16ec,_0xb2a928){return db[_0xcb13('0x2f')]['find']({'where':{'id':_0x1f16ec[_0xcb13('0x55')]['id']}})[_0xcb13('0x26')](handleEntityNotFound(_0xb2a928,null))[_0xcb13('0x26')](removeEntity(_0xb2a928,null))[_0xcb13('0x4d')](handleError(_0xb2a928,null));};
\ No newline at end of file
index dc34bd0..437d2c2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x1a7a25,_0x5b9fae){var _0x339cb3=function(_0x37e00a){while(--_0x37e00a){_0x1a7a25['push'](_0x1a7a25['shift']());}};_0x339cb3(++_0x5b9fae);}(_0xabce,0x103));var _0xeabc=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xabce[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x424c00,_0x5bc350){var _0x3f703a=function(_0x268c38){while(--_0x268c38){_0x424c00['push'](_0x424c00['shift']());}};_0x3f703a(++_0x5bc350);}(_0x5fc3,0xa8));var _0x35fc=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0x5fc3[_0x8ae98b];return _0xc30bd4;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index b3aa364..af36c71 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x213a1c,_0x4f20c1){var _0x354f02=function(_0x37856a){while(--_0x37856a){_0x213a1c['push'](_0x213a1c['shift']());}};_0x354f02(++_0x4f20c1);}(_0x7a54,0x106));var _0x47a5=function(_0x455a6f,_0x294cac){_0x455a6f=_0x455a6f-0x0;var _0x4b9da9=_0x7a54[_0x455a6f];return _0x4b9da9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});};
\ No newline at end of file
+var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0xe4e4b4,_0x1efdc6){var _0x3e5272=function(_0x1595e4){while(--_0x1595e4){_0xe4e4b4['push'](_0xe4e4b4['shift']());}};_0x3e5272(++_0x1efdc6);}(_0x7a54,0x106));var _0x47a5=function(_0x2fb9a4,_0x45b21f){_0x2fb9a4=_0x2fb9a4-0x0;var _0x5177d3=_0x7a54[_0x2fb9a4];return _0x5177d3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});};
\ No newline at end of file
index af8a580..50a31c9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa41a=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','webhookGet','get','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','extname','now','post','file','upload','/webhook','webhookPost','put','/:id','update','delete','exports','multer'];(function(_0x5f5cce,_0x138cc5){var _0x705ecf=function(_0x28bc5d){while(--_0x28bc5d){_0x5f5cce['push'](_0x5f5cce['shift']());}};_0x705ecf(++_0x138cc5);}(_0xa41a,0x6b));var _0xaa41=function(_0x7316d7,_0x2063b4){_0x7316d7=_0x7316d7-0x0;var _0x4b0364=_0xa41a[_0x7316d7];return _0x4b0364;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var fs_extra=require(_0xaa41('0x5'));var auth=require(_0xaa41('0x6'));var interaction=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var controller=require(_0xaa41('0x9'));router['get']('/',auth[_0xaa41('0xa')](),controller[_0xaa41('0xb')]);router['get']('/webhook',controller[_0xaa41('0xc')]);router[_0xaa41('0xd')]('/:id',auth[_0xaa41('0xa')](),controller[_0xaa41('0xe')]);router[_0xaa41('0xd')](_0xaa41('0xf'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x10')]);var upload=multer({'storage':multer[_0xaa41('0x11')]({'destination':function(_0x423a19,_0x1c291e,_0x5c9fc7){_0x5c9fc7(null,path[_0xaa41('0x12')](config[_0xaa41('0x13')],'server/files/plugins'));},'filename':function(_0x54827c,_0x1d0a54,_0x518b5b){_0x1d0a54[_0xaa41('0x14')]=_0x1d0a54[_0xaa41('0x14')][_0xaa41('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x518b5b(null,util[_0xaa41('0x16')](_0xaa41('0x17'),path['basename'](_0x1d0a54[_0xaa41('0x14')],path[_0xaa41('0x18')](_0x1d0a54[_0xaa41('0x14')])),Date[_0xaa41('0x19')](),path[_0xaa41('0x18')](_0x1d0a54[_0xaa41('0x14')])));}})});router[_0xaa41('0x1a')]('/',upload['single'](_0xaa41('0x1b')),controller[_0xaa41('0x1c')]);router[_0xaa41('0x1a')](_0xaa41('0x1d'),controller[_0xaa41('0x1e')]);router[_0xaa41('0x1f')](_0xaa41('0x20'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x21')]);router['delete']('/:id',auth[_0xaa41('0xa')](),controller[_0xaa41('0x22')]);module[_0xaa41('0x23')]=router;
\ No newline at end of file
+var _0x3e74=['originalname','format','%s-%s%s','basename','now','extname','file','upload','post','put','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','download','diskStorage','join','root'];(function(_0x209c2e,_0x5dd8d5){var _0x316dac=function(_0x3fa009){while(--_0x3fa009){_0x209c2e['push'](_0x209c2e['shift']());}};_0x316dac(++_0x5dd8d5);}(_0x3e74,0x175));var _0x43e7=function(_0x98ffb,_0x1f4495){_0x98ffb=_0x98ffb-0x0;var _0x3b81a0=_0x3e74[_0x98ffb];return _0x3b81a0;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['show']);router[_0x43e7('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x43e7('0xd')]);var upload=multer({'storage':multer[_0x43e7('0xe')]({'destination':function(_0x5c34f4,_0x2803d9,_0x513707){_0x513707(null,path[_0x43e7('0xf')](config[_0x43e7('0x10')],'server/files/plugins'));},'filename':function(_0x3eb206,_0xc960ea,_0x2718d3){_0xc960ea[_0x43e7('0x11')]=_0xc960ea['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2718d3(null,util[_0x43e7('0x12')](_0x43e7('0x13'),path[_0x43e7('0x14')](_0xc960ea['originalname'],path['extname'](_0xc960ea[_0x43e7('0x11')])),Date[_0x43e7('0x15')](),path[_0x43e7('0x16')](_0xc960ea[_0x43e7('0x11')])));}})});router['post']('/',upload['single'](_0x43e7('0x17')),controller[_0x43e7('0x18')]);router[_0x43e7('0x19')]('/webhook',controller['webhookPost']);router[_0x43e7('0x1a')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x1b')]);router[_0x43e7('0x1c')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x1c')]);module[_0x43e7('0x1d')]=router;
\ No newline at end of file
index 07b79c4..3c531eb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf6fd=['exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0xa601a2,_0x47718e){var _0x54af8a=function(_0x20521c){while(--_0x20521c){_0xa601a2['push'](_0xa601a2['shift']());}};_0x54af8a(++_0x47718e);}(_0xf6fd,0x1ef));var _0xdf6f=function(_0x502d22,_0x5a19ef){_0x502d22=_0x502d22-0x0;var _0xe0d8da=_0xf6fd[_0x502d22];return _0xe0d8da;};'use strict';var Sequelize=require('sequelize');module[_0xdf6f('0x0')]={'name':{'type':Sequelize[_0xdf6f('0x1')]},'type':{'type':Sequelize[_0xdf6f('0x2')](_0xdf6f('0x3'),'script')},'description':{'type':Sequelize[_0xdf6f('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xdf6f('0x1')],'comment':_0xdf6f('0x5')},'active':{'type':Sequelize[_0xdf6f('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xdf6f('0x2')](_0xdf6f('0x7'),'agentOnly','always','never'),'defaultValue':'always','comment':_0xdf6f('0x8')},'icon':{'type':Sequelize[_0xdf6f('0x1')]},'adminUrl':{'type':Sequelize[_0xdf6f('0x1')]},'agentUrl':{'type':Sequelize[_0xdf6f('0x1')]},'scriptName':{'type':Sequelize[_0xdf6f('0x1')]},'scriptPath':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xcd69=['ENUM','adminOnly','agentOnly','always','never','STRING','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x4aa21e,_0x2c62c8){var _0x4ac58e=function(_0x1d03a1){while(--_0x1d03a1){_0x4aa21e['push'](_0x4aa21e['shift']());}};_0x4ac58e(++_0x2c62c8);}(_0xcd69,0x1c8));var _0x9cd6=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xcd69[_0x9dfc10];return _0x4f938a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9cd6('0x0')]},'type':{'type':Sequelize['ENUM'](_0x9cd6('0x1'),_0x9cd6('0x2'))},'description':{'type':Sequelize[_0x9cd6('0x3')]},'version':{'type':Sequelize[_0x9cd6('0x3')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x9cd6('0x4')],'defaultValue':0x0,'comment':_0x9cd6('0x5')},'sidebar':{'type':Sequelize[_0x9cd6('0x6')](_0x9cd6('0x7'),_0x9cd6('0x8'),_0x9cd6('0x9'),_0x9cd6('0xa')),'defaultValue':_0x9cd6('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x9cd6('0x0')]},'adminUrl':{'type':Sequelize[_0x9cd6('0x0')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x9cd6('0x0')]}};
\ No newline at end of file
index 99f0724..c57484e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfd4e=['undefined','count','offset','set','Content-Range','apply','save','update','then','Plugins','UserProfileResource','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Plugin','findAll','rows','catch','show','params','keys','includeAll','include','find','download','server/files/plugins','%s.zip','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','join','root','dirname','basename','finalize','close','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','admin','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','method','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','squel','crypto','querystring','papaparse','extract-zip','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','json','limit'];(function(_0x66c2a0,_0x1e61f5){var _0x18019b=function(_0x5634fe){while(--_0x5634fe){_0x66c2a0['push'](_0x66c2a0['shift']());}};_0x18019b(++_0x1e61f5);}(_0xfd4e,0x131));var _0xefd4=function(_0x3e9f83,_0xc8edea){_0x3e9f83=_0x3e9f83-0x0;var _0x4902f6=_0xfd4e[_0x3e9f83];return _0x4902f6;};'use strict';var emlformat=require(_0xefd4('0x0'));var rimraf=require(_0xefd4('0x1'));var zipdir=require(_0xefd4('0x2'));var jsonpatch=require(_0xefd4('0x3'));var rp=require(_0xefd4('0x4'));var moment=require('moment');var BPromise=require(_0xefd4('0x5'));var Mustache=require('mustache');var util=require(_0xefd4('0x6'));var path=require(_0xefd4('0x7'));var sox=require(_0xefd4('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xefd4('0x9'));var _=require('lodash');var squel=require(_0xefd4('0xa'));var crypto=require(_0xefd4('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xefd4('0xc'));var Papa=require(_0xefd4('0xd'));var extract=require(_0xefd4('0xe'));var rimraf=require(_0xefd4('0x1'));var archiver=require('archiver');var Redis=require(_0xefd4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xefd4('0x10'));var as=require(_0xefd4('0x11'));var hardwareService=require(_0xefd4('0x12'));var logger=require(_0xefd4('0x13'))(_0xefd4('0x14'));var utils=require(_0xefd4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xefd4('0x16'));var db=require(_0xefd4('0x17'))['db'];config[_0xefd4('0x18')]=_['defaults'](config[_0xefd4('0x18')],{'host':_0xefd4('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')[_0xefd4('0x1a')](socket);function respondWithStatusCode(_0x469c4b,_0x3cca16){_0x3cca16=_0x3cca16||0xcc;return function(_0x445c7e){if(_0x445c7e){return _0x469c4b[_0xefd4('0x1b')](_0x3cca16);}return _0x469c4b[_0xefd4('0x1c')](_0x3cca16)['end']();};}function respondWithResult(_0x1d18ec,_0x416633){_0x416633=_0x416633||0xc8;return function(_0x479e61){if(_0x479e61){return _0x1d18ec[_0xefd4('0x1c')](_0x416633)[_0xefd4('0x1d')](_0x479e61);}};}function respondWithFilteredResult(_0x4803c7,_0xac6897){return function(_0x3eada7){if(_0x3eada7){var _0x1f5beb=typeof _0xac6897['offset']==='undefined'&&typeof _0xac6897[_0xefd4('0x1e')]===_0xefd4('0x1f');var _0x332657=_0x3eada7[_0xefd4('0x20')];var _0x343981=_0x1f5beb?0x0:_0xac6897[_0xefd4('0x21')];var _0x5ae7ca=_0x1f5beb?_0x3eada7['count']:_0xac6897['offset']+_0xac6897[_0xefd4('0x1e')];var _0x405926;if(_0x5ae7ca>=_0x332657){_0x5ae7ca=_0x332657;_0x405926=0xc8;}else{_0x405926=0xce;}_0x4803c7['status'](_0x405926);return _0x4803c7[_0xefd4('0x22')](_0xefd4('0x23'),_0x343981+'-'+_0x5ae7ca+'/'+_0x332657)[_0xefd4('0x1d')](_0x3eada7);}return null;};}function patchUpdates(_0x1ee6f3){return function(_0x70155d){try{jsonpatch[_0xefd4('0x24')](_0x70155d,_0x1ee6f3,!![]);}catch(_0x39c1a3){return BPromise['reject'](_0x39c1a3);}return _0x70155d[_0xefd4('0x25')]();};}function saveUpdates(_0x331ab7,_0x3a4795){return function(_0x1e5e16){if(_0x1e5e16){return _0x1e5e16[_0xefd4('0x26')](_0x331ab7)[_0xefd4('0x27')](function(_0x3480e5){return _0x3480e5;});}return null;};}function removeEntity(_0x34a81d,_0x2046bb){return function(_0x3d6e42){if(_0x3d6e42){return _0x3d6e42['destroy']()[_0xefd4('0x27')](function(){var _0x26a02e=_0x3d6e42['get']({'plain':!![]});var _0x37429e=_0xefd4('0x28');return db[_0xefd4('0x29')][_0xefd4('0x2a')]({'where':{'type':_0x37429e,'resourceId':_0x26a02e['id']}})[_0xefd4('0x27')](function(){return _0x3d6e42;});})[_0xefd4('0x27')](function(){_0x34a81d[_0xefd4('0x1c')](0xcc)[_0xefd4('0x2b')]();});}};}function handleEntityNotFound(_0xcf3b6e,_0x3ee813){return function(_0x468d11){if(!_0x468d11){_0xcf3b6e[_0xefd4('0x1b')](0x194);}return _0x468d11;};}function handleError(_0xd1ab59,_0xd32fa7){_0xd32fa7=_0xd32fa7||0x1f4;return function(_0x256073){logger[_0xefd4('0x2c')](_0x256073['stack']);if(_0x256073['name']){delete _0x256073[_0xefd4('0x2d')];}_0xd1ab59['status'](_0xd32fa7)[_0xefd4('0x2e')](_0x256073);};}exports[_0xefd4('0x2f')]=function(_0x1a594f,_0x123674){var _0x592b0b={},_0x58f558={},_0x426145={'count':0x0,'rows':[]};var _0x3ac984=_[_0xefd4('0x30')](db['Plugin'][_0xefd4('0x31')],function(_0x22a16b){return{'name':_0x22a16b[_0xefd4('0x32')],'type':_0x22a16b[_0xefd4('0x33')][_0xefd4('0x34')]};});_0x58f558[_0xefd4('0x35')]=_['map'](_0x3ac984,_0xefd4('0x2d'));_0x58f558[_0xefd4('0x36')]=_['keys'](_0x1a594f[_0xefd4('0x36')]);_0x58f558[_0xefd4('0x37')]=_[_0xefd4('0x38')](_0x58f558[_0xefd4('0x35')],_0x58f558['query']);_0x592b0b[_0xefd4('0x39')]=_['intersection'](_0x58f558[_0xefd4('0x35')],qs['fields'](_0x1a594f[_0xefd4('0x36')][_0xefd4('0x3a')]));_0x592b0b['attributes']=_0x592b0b[_0xefd4('0x39')][_0xefd4('0x3b')]?_0x592b0b[_0xefd4('0x39')]:_0x58f558[_0xefd4('0x35')];if(!_0x1a594f['query'][_0xefd4('0x3c')](_0xefd4('0x3d'))){_0x592b0b['limit']=qs[_0xefd4('0x1e')](_0x1a594f['query'][_0xefd4('0x1e')]);_0x592b0b[_0xefd4('0x21')]=qs[_0xefd4('0x21')](_0x1a594f[_0xefd4('0x36')][_0xefd4('0x21')]);}_0x592b0b[_0xefd4('0x3e')]=qs[_0xefd4('0x3f')](_0x1a594f[_0xefd4('0x36')][_0xefd4('0x3f')]);_0x592b0b[_0xefd4('0x40')]=qs[_0xefd4('0x37')](_[_0xefd4('0x41')](_0x1a594f[_0xefd4('0x36')],_0x58f558[_0xefd4('0x37')]),_0x3ac984);if(_0x1a594f[_0xefd4('0x36')][_0xefd4('0x42')]){_0x592b0b[_0xefd4('0x40')]=_[_0xefd4('0x43')](_0x592b0b['where'],{'$or':_[_0xefd4('0x30')](_0x3ac984,function(_0x52d8a3){if(_0x52d8a3['type']!==_0xefd4('0x44')){var _0x4c272e={};_0x4c272e[_0x52d8a3[_0xefd4('0x2d')]]={'$like':'%'+_0x1a594f[_0xefd4('0x36')][_0xefd4('0x42')]+'%'};return _0x4c272e;}})});}_0x592b0b=_['merge']({},_0x592b0b,_0x1a594f[_0xefd4('0x45')]);var _0x15af3f={'where':_0x592b0b[_0xefd4('0x40')]};return db[_0xefd4('0x46')][_0xefd4('0x20')](_0x15af3f)[_0xefd4('0x27')](function(_0x54e69c){_0x426145['count']=_0x54e69c;if(_0x1a594f[_0xefd4('0x36')]['includeAll']){_0x592b0b['include']=[{'all':!![]}];}return db['Plugin'][_0xefd4('0x47')](_0x592b0b);})[_0xefd4('0x27')](function(_0x14d688){_0x426145[_0xefd4('0x48')]=_0x14d688;return _0x426145;})['then'](respondWithFilteredResult(_0x123674,_0x592b0b))[_0xefd4('0x49')](handleError(_0x123674,null));};exports[_0xefd4('0x4a')]=function(_0x4e8420,_0x268ff7){var _0x278122={'raw':!![],'where':{'id':_0x4e8420[_0xefd4('0x4b')]['id']}},_0x4c7e97={};_0x4c7e97['model']=_[_0xefd4('0x4c')](db[_0xefd4('0x46')]['rawAttributes']);_0x4c7e97[_0xefd4('0x36')]=_[_0xefd4('0x4c')](_0x4e8420[_0xefd4('0x36')]);_0x4c7e97[_0xefd4('0x37')]=_[_0xefd4('0x38')](_0x4c7e97[_0xefd4('0x35')],_0x4c7e97[_0xefd4('0x36')]);_0x278122['attributes']=_[_0xefd4('0x38')](_0x4c7e97[_0xefd4('0x35')],qs['fields'](_0x4e8420[_0xefd4('0x36')][_0xefd4('0x3a')]));_0x278122['attributes']=_0x278122['attributes'][_0xefd4('0x3b')]?_0x278122[_0xefd4('0x39')]:_0x4c7e97['model'];if(_0x4e8420[_0xefd4('0x36')][_0xefd4('0x4d')]){_0x278122[_0xefd4('0x4e')]=[{'all':!![]}];}_0x278122=_['merge']({},_0x278122,_0x4e8420[_0xefd4('0x45')]);return db['Plugin'][_0xefd4('0x4f')](_0x278122)[_0xefd4('0x27')](handleEntityNotFound(_0x268ff7,null))['then'](respondWithResult(_0x268ff7,null))[_0xefd4('0x49')](handleError(_0x268ff7,null));};exports[_0xefd4('0x50')]=function(_0x3b1a25,_0x3faa93,_0x169c5f){return db['Plugin'][_0xefd4('0x4f')]({'where':{'id':_0x3b1a25[_0xefd4('0x4b')]['id']},'attributes':['name','path'],'raw':!![]})['then'](handleEntityNotFound(_0x3faa93,null))[_0xefd4('0x27')](function(_0x1fbded){if(_0x1fbded){var _0x3dca6f=path['join'](config['root'],_0xefd4('0x51'),util['format'](_0xefd4('0x52'),path['basename'](_0x1fbded[_0xefd4('0x7')])));var _0x217f38=fs[_0xefd4('0x53')](_0x3dca6f);var _0x590601=archiver(_0xefd4('0x54'),{'zlib':{'level':0x9}});_0x590601['on'](_0xefd4('0x55'),function(_0x378f2a){if(_0x378f2a['code']===_0xefd4('0x56')){logger['error'](_0x378f2a);}else{throw new db[(_0xefd4('0x57'))][(_0xefd4('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x590601['on'](_0xefd4('0x2c'),function(_0x5d3c13){throw new db[(_0xefd4('0x57'))][(_0xefd4('0x58'))](_0xefd4('0x59'));});_0x590601[_0xefd4('0x5a')](_0x217f38);_0x590601['glob'](_0xefd4('0x5b'),{'cwd':path[_0xefd4('0x5c')](config[_0xefd4('0x5d')],_0xefd4('0x51'),path[_0xefd4('0x5e')](_0x1fbded[_0xefd4('0x7')])),'ignore':[path[_0xefd4('0x5c')](path[_0xefd4('0x5f')](_0x1fbded[_0xefd4('0x7')]),'node_modules/**/*'),path['join'](path['basename'](_0x1fbded[_0xefd4('0x7')]),'attachments/**/*')],'nodir':!![]})[_0xefd4('0x60')]();_0x217f38['on'](_0xefd4('0x61'),function(){if(!fs['existsSync'](_0x3dca6f)){throw new db['Sequelize'][(_0xefd4('0x58'))](_0xefd4('0x62'));}return _0x3faa93[_0xefd4('0x50')](_0x3dca6f,util[_0xefd4('0x63')](_0xefd4('0x52'),path[_0xefd4('0x5f')](_0x1fbded[_0xefd4('0x7')])),function(_0x5a2053){if(_0x5a2053){throw new db[(_0xefd4('0x57'))]['Error'](_0xefd4('0x64'));}fs[_0xefd4('0x65')](_0x3dca6f);logger[_0xefd4('0x66')]('Download\x20completed');logger[_0xefd4('0x66')]('Temporary\x20file\x20removed');});});}return null;})[_0xefd4('0x49')](handleError(_0x3faa93,null));};exports[_0xefd4('0x67')]=function(_0x47288b,_0x258211,_0x8fa381){var _0x5069d7=path[_0xefd4('0x5f')](_0x47288b[_0xefd4('0x68')][_0xefd4('0x69')],path[_0xefd4('0x6a')](_0x47288b[_0xefd4('0x68')][_0xefd4('0x69')]));var _0x1a214d=path[_0xefd4('0x5c')](config[_0xefd4('0x5d')],_0xefd4('0x51'),_0x47288b[_0xefd4('0x68')]['filename']);var _0x38d473=path[_0xefd4('0x5c')](config[_0xefd4('0x5d')],_0xefd4('0x51'),_0x5069d7);logger[_0xefd4('0x66')](_0xefd4('0x6b'),_0x1a214d);logger[_0xefd4('0x66')](_0xefd4('0x6c'),_0x38d473);try{fs[_0xefd4('0x6d')](_0x1a214d,parseInt(_0xefd4('0x6e'),0x8));extract(_0x1a214d,{'dir':_0x38d473},function(_0x99ae7f){if(_0x99ae7f){logger[_0xefd4('0x2c')](_0x99ae7f);handleError(_0x99ae7f,!![]);};var _0x1f188c=fs[_0xefd4('0x6f')](_0x38d473);if(_0x1f188c['length']>0x1){removeReferences(_0x1a214d,_0x38d473);logger[_0xefd4('0x2c')](_0xefd4('0x70'));return _0x8fa381(new Error(_0xefd4('0x70')));}var _0x347ae1=fs[_0xefd4('0x71')](path[_0xefd4('0x5c')](_0x38d473,_0x1f188c[0x0]));if(_0x347ae1[_0xefd4('0x72')]()){removeReferences(_0x1a214d,_0x38d473);logger[_0xefd4('0x2c')](_0xefd4('0x70'));return _0x8fa381(new Error(_0xefd4('0x70')));}if(_0x347ae1[_0xefd4('0x73')]()){var _0x2cc54e=fs[_0xefd4('0x6f')](path[_0xefd4('0x5c')](_0x38d473,_0x1f188c[0x0]));if(_0x2cc54e['length']===0x0){removeReferences(_0x1a214d,_0x38d473);logger[_0xefd4('0x2c')](_0xefd4('0x70'));return _0x8fa381(new Error(_0xefd4('0x70')));}var _0xed4e74=_0x2cc54e[_0xefd4('0x74')](function(_0x54c93e){return _0x54c93e===_0xefd4('0x75');});if(!_0xed4e74){return _0x8fa381(new Error(_0xefd4('0x76')));}var _0x243350=fs[_0xefd4('0x77')](path[_0xefd4('0x5c')](_0x38d473,_0x1f188c[0x0],_0xefd4('0x75')));var _0x5f2bbd=JSON[_0xefd4('0x78')](_0x243350);if('undefined'==typeof _0x5f2bbd['name']){return _0x8fa381(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xefd4('0x1f')==typeof _0x5f2bbd['type']){return _0x8fa381(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xefd4('0x1f')==typeof _0x5f2bbd['version']){return _0x8fa381(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xefd4('0x1f')==typeof _0x5f2bbd[_0xefd4('0x79')]){return _0x8fa381(new Error(_0xefd4('0x7a')));}if(_0x5f2bbd[_0xefd4('0x33')]===_0xefd4('0x7b')){if(_0xefd4('0x1f')==typeof _0x5f2bbd[_0xefd4('0x79')][_0xefd4('0x7c')]){return _0x8fa381(new Error(_0xefd4('0x7d')));}if('undefined'==typeof _0x5f2bbd[_0xefd4('0x79')][_0xefd4('0x7c')]['admin']&&'undefined'==typeof _0x5f2bbd[_0xefd4('0x79')][_0xefd4('0x7c')][_0xefd4('0x7e')]){return _0x8fa381(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x5f2bbd[_0xefd4('0x33')]===_0xefd4('0x7f')){if('undefined'==typeof _0x5f2bbd[_0xefd4('0x79')][_0xefd4('0x80')]){return _0x8fa381(new Error(_0xefd4('0x81')));}if('undefined'==typeof _0x5f2bbd[_0xefd4('0x79')][_0xefd4('0x82')]){return _0x8fa381(new Error(_0xefd4('0x83')));}}else{return _0x8fa381(new Error(_0xefd4('0x84')));}var _0xe4572=_0x5f2bbd[_0xefd4('0x2d')];var _0x53e639=_0x5f2bbd['description'];var _0x222206=_0x5f2bbd[_0xefd4('0x33')];var _0x1a532c=_0x5f2bbd['sidebar']?_0x5f2bbd[_0xefd4('0x85')]:_0xefd4('0x86');var _0x14b72f=_0x5f2bbd[_0xefd4('0x87')]?_0x5f2bbd['icon']:'icon-apps';var _0x388931='';var _0x598d68='';var _0x53f772='';var _0x11bb4b='';var _0x7600ed=_0x5f2bbd['version'];if(_0x222206==='html'){if(_0xefd4('0x1f')!=typeof _0x5f2bbd[_0xefd4('0x79')][_0xefd4('0x7c')]['admin']){var _0x561313=_0x5f2bbd[_0xefd4('0x79')][_0xefd4('0x7c')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xefd4('0x88')](_0x561313)){_0x388931=path['join'](_0xefd4('0x89'),_0x5069d7,_0x1f188c[0x0],_0x561313);}else{_0x388931=_0x561313;}}else{logger[_0xefd4('0x66')](_0xefd4('0x8a'));}if(_0xefd4('0x1f')!=typeof _0x5f2bbd[_0xefd4('0x79')][_0xefd4('0x7c')][_0xefd4('0x7e')]){var _0x2e9a3f=_0x5f2bbd[_0xefd4('0x79')][_0xefd4('0x7c')][_0xefd4('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xefd4('0x88')](_0x2e9a3f)){_0x598d68=path[_0xefd4('0x5c')](_0xefd4('0x89'),_0x5069d7,_0x1f188c[0x0],_0x2e9a3f);}else{_0x598d68=_0x2e9a3f;}}else{logger['info'](_0xefd4('0x8b'));}}else if(_0x222206===_0xefd4('0x7f')){_0x53f772=_0x5f2bbd[_0xefd4('0x79')]['scriptName'];_0x11bb4b=_0x5f2bbd['parameters'][_0xefd4('0x82')];if(_0xefd4('0x1f')!=typeof _0x5f2bbd[_0xefd4('0x79')][_0xefd4('0x7c')]){if(_0xefd4('0x1f')!=typeof _0x5f2bbd[_0xefd4('0x79')][_0xefd4('0x7c')][_0xefd4('0x8c')]){var _0x561313=_0x5f2bbd[_0xefd4('0x79')]['views'][_0xefd4('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0xefd4('0x88')](_0x561313)){_0x388931=path[_0xefd4('0x5c')]('plugins',_0x5069d7,_0x1f188c[0x0],_0x561313);}else{_0x388931=_0x561313;}}if(_0xefd4('0x1f')!=typeof _0x5f2bbd[_0xefd4('0x79')][_0xefd4('0x7c')][_0xefd4('0x7e')]){var _0x2e9a3f=_0x5f2bbd['parameters'][_0xefd4('0x7c')][_0xefd4('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xefd4('0x88')](_0x2e9a3f)){_0x598d68=path[_0xefd4('0x5c')](_0xefd4('0x89'),_0x5069d7,_0x1f188c[0x0],_0x2e9a3f);}else{_0x598d68=_0x2e9a3f;}}}}var _0xa02c8a={'name':_0xe4572,'description':_0x53e639,'path':path[_0xefd4('0x5c')](_0x5069d7,_0x1f188c[0x0]),'type':_0x222206,'sidebar':_0x1a532c,'icon':_0x14b72f,'adminUrl':_0x388931,'agentUrl':_0x598d68,'scriptName':_0x53f772,'scriptPath':_0x11bb4b,'version':_0x7600ed};removeReferences(_0x1a214d,null);return db[_0xefd4('0x46')][_0xefd4('0x8d')](_0xa02c8a)['then'](function(_0x15058d){var _0x3410fd={'role':_0x47288b[_0xefd4('0x8e')][_0xefd4('0x8f')],'userProfileId':_0x47288b[_0xefd4('0x8e')][_0xefd4('0x90')]};if(!_0x3410fd)throw new Error(_0xefd4('0x91'));if(_0x3410fd[_0xefd4('0x8f')]==='user'){var _0x564d1c=_0x15058d['get']({'plain':!![]});return db[_0xefd4('0x92')][_0xefd4('0x4f')]({'where':{'name':_0xefd4('0x28'),'userProfileId':_0x3410fd[_0xefd4('0x90')]},'raw':!![]})['then'](function(_0x36646f){if(_0x36646f&&_0x36646f[_0xefd4('0x93')]===0x0){return db[_0xefd4('0x29')][_0xefd4('0x8d')]({'name':_0x564d1c[_0xefd4('0x2d')],'resourceId':_0x564d1c['id'],'type':_0x36646f[_0xefd4('0x2d')],'sectionId':_0x36646f['id']},{})[_0xefd4('0x27')](function(){return _0x15058d;});}else{return _0x15058d;}})[_0xefd4('0x49')](function(_0x276eff){logger['error'](_0xefd4('0x94'),_0x276eff);throw _0x276eff;});}return _0x15058d;})[_0xefd4('0x27')](respondWithResult(_0x258211,null))['catch'](handleError(_0x258211,null));}});}catch(_0x1b9d31){_0x258211[_0xefd4('0x1c')](0x1f4)[_0xefd4('0x2e')](_0x1b9d31);}};function removeReferences(_0x4362c6,_0x5bda4c){try{if(_0x4362c6){fs[_0xefd4('0x65')](_0x4362c6);logger[_0xefd4('0x66')](_0xefd4('0x95'));}if(_0x5bda4c){rimraf(_0x5bda4c,function(){});logger['info'](_0xefd4('0x96'));}}catch(_0x84c94b){logger['error'](_0x84c94b);}}exports[_0xefd4('0x26')]=function(_0x2e72f5,_0x4e2b80,_0x61333e){return db[_0xefd4('0x46')][_0xefd4('0x4f')]({'where':{'id':_0x2e72f5[_0xefd4('0x4b')]['id']}})[_0xefd4('0x27')](handleEntityNotFound(_0x4e2b80,null))[_0xefd4('0x27')](saveUpdates(_0x2e72f5[_0xefd4('0x8e')],null))[_0xefd4('0x27')](respondWithResult(_0x4e2b80,null))[_0xefd4('0x49')](handleError(_0x4e2b80,null));};exports[_0xefd4('0x97')]=function(_0x488bcc,_0xec4d5f,_0x2cac79){return db['Plugin'][_0xefd4('0x4f')]({'where':{'id':_0x488bcc['params']['id']}})[_0xefd4('0x27')](function(_0x4c6919){if(_0x4c6919){return _0x4c6919[_0xefd4('0x2a')]();}})[_0xefd4('0x27')](function(_0x2b0e96){rimraf(path['join'](config[_0xefd4('0x5d')],_0xefd4('0x51'),path[_0xefd4('0x5e')](_0x2b0e96[_0xefd4('0x7')])),function(){});return _0x2b0e96;})[_0xefd4('0x27')](handleEntityNotFound(_0xec4d5f,null))['then'](respondWithStatusCode(_0xec4d5f,null))[_0xefd4('0x49')](handleError(_0xec4d5f,null));};exports[_0xefd4('0x98')]=function(_0x560df6,_0x196f69,_0x548790){return BPromise[_0xefd4('0x99')]()['then'](function(){if(!_0x560df6[_0xefd4('0x36')][_0xefd4('0x7')]){throw new Error(_0xefd4('0x9a'));}if(!_0x560df6['query']['port']){throw new Error(_0xefd4('0x9b'));}var _0x18af70=_0x560df6[_0xefd4('0x36')]['hostname']?_0x560df6[_0xefd4('0x36')][_0xefd4('0x9c')]+':'+_0x560df6[_0xefd4('0x36')]['port']:'http://localhost:'+_0x560df6[_0xefd4('0x36')][_0xefd4('0x9d')];var _0x351577=_0x560df6['query']['json']?_0x560df6[_0xefd4('0x36')]['json']:!![];var _0x3aef80=_0x560df6[_0xefd4('0x36')][_0xefd4('0x9e')]?_0x560df6[_0xefd4('0x36')][_0xefd4('0x9e')]:null;var _0x420d1f={'method':_0x560df6['method'],'uri':util[_0xefd4('0x63')]('%s%s',_0x18af70,_0x560df6[_0xefd4('0x36')][_0xefd4('0x7')]),'json':_0x351577,'resolveWithFullResponse':!![],'encoding':_0x3aef80,'qs':_0x560df6[_0xefd4('0x36')]};if(_0x560df6[_0xefd4('0x9f')]){_0x420d1f[_0xefd4('0x9f')]=_0x560df6[_0xefd4('0x9f')];if(_0x420d1f['headers'][_0xefd4('0xa0')]){delete _0x420d1f['headers'][_0xefd4('0xa0')];}}if(_0x420d1f['headers'][_0xefd4('0xa1')]){delete _0x420d1f[_0xefd4('0x9f')][_0xefd4('0xa1')];}return rp(_0x420d1f);})['then'](function(_0x3dd1ba){if(_0x3dd1ba){_0x196f69[_0xefd4('0x22')](_0x3dd1ba[_0xefd4('0x9f')]);logger[_0xefd4('0x66')](_0x3dd1ba['body']);if(_[_0xefd4('0xa2')](_0x560df6[_0xefd4('0x36')][_0xefd4('0x7')],'download')&&_0x3dd1ba['statusCode']==0x1f4){return _0x196f69[_0xefd4('0x1b')](_0x3dd1ba[_0xefd4('0xa3')]);}else{return _0x196f69[_0xefd4('0x1c')](_0x3dd1ba[_0xefd4('0xa3')])[_0xefd4('0x2e')](_0x3dd1ba['body']);}}else{return _0x196f69[_0xefd4('0x1b')](0xc8);}})[_0xefd4('0x49')](handleError(_0x196f69,null));};exports[_0xefd4('0xa4')]=function(_0x269dbd,_0x818bb3,_0x56bd44){return BPromise[_0xefd4('0x99')]()[_0xefd4('0x27')](function(){if(!_0x269dbd[_0xefd4('0x36')][_0xefd4('0x7')]){throw new Error(_0xefd4('0x9a'));}if(!_0x269dbd[_0xefd4('0x36')][_0xefd4('0x9d')]){throw new Error(_0xefd4('0x9b'));}var _0x4157da=_0x269dbd[_0xefd4('0x36')]['hostname']?_0x269dbd[_0xefd4('0x36')]['hostname']+':'+_0x269dbd[_0xefd4('0x36')]['port']:_0xefd4('0xa5')+_0x269dbd[_0xefd4('0x36')][_0xefd4('0x9d')];var _0x3ded4e=_0x269dbd['query'][_0xefd4('0x1d')]?_0x269dbd[_0xefd4('0x36')]['json']:!![];var _0x1476c5=_0x269dbd[_0xefd4('0x36')][_0xefd4('0x9e')]?_0x269dbd[_0xefd4('0x36')][_0xefd4('0x9e')]:null;var _0x53fa8f={'method':_0x269dbd[_0xefd4('0xa6')],'uri':util[_0xefd4('0x63')](_0xefd4('0xa7'),_0x4157da,_0x269dbd[_0xefd4('0x36')][_0xefd4('0x7')]),'json':_0x3ded4e,'resolveWithFullResponse':!![],'encoding':_0x1476c5,'body':_0x269dbd[_0xefd4('0x8e')]};if(_0x269dbd[_0xefd4('0x9f')]){_0x53fa8f[_0xefd4('0x9f')]=_0x269dbd[_0xefd4('0x9f')];if(_0x53fa8f[_0xefd4('0x9f')][_0xefd4('0xa0')]){delete _0x53fa8f[_0xefd4('0x9f')][_0xefd4('0xa0')];}}if(_0x53fa8f[_0xefd4('0x9f')][_0xefd4('0xa1')]){delete _0x53fa8f[_0xefd4('0x9f')]['content-type'];}return rp(_0x53fa8f);})[_0xefd4('0x27')](function(_0x195015){if(_0x195015){_0x818bb3[_0xefd4('0x22')](_0x195015[_0xefd4('0x9f')]);logger[_0xefd4('0x66')](_0x195015[_0xefd4('0x8e')]);return _0x818bb3['status'](_0x195015[_0xefd4('0xa3')])[_0xefd4('0x2e')](_0x195015[_0xefd4('0x8e')]);}else{return _0x818bb3[_0xefd4('0x1b')](0xc8);}})[_0xefd4('0x49')](handleError(_0x818bb3,null));};
\ No newline at end of file
+var _0x370a=['stack','name','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','download','join','root','format','createWriteStream','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','server/files/plugins','dirname','basename','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readFileSync','manifest.json','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','role','body','userProfileId','user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','./plugin.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','get','Plugins','UserProfileResource','sendStatus','error'];(function(_0xec2253,_0x239eea){var _0x5aa03e=function(_0x531c31){while(--_0x531c31){_0xec2253['push'](_0xec2253['shift']());}};_0x5aa03e(++_0x239eea);}(_0x370a,0x1c7));var _0xa370=function(_0x550224,_0x4610e0){_0x550224=_0x550224-0x0;var _0x582237=_0x370a[_0x550224];return _0x582237;};'use strict';var emlformat=require(_0xa370('0x0'));var rimraf=require(_0xa370('0x1'));var zipdir=require(_0xa370('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa370('0x3'));var moment=require('moment');var BPromise=require(_0xa370('0x4'));var Mustache=require(_0xa370('0x5'));var util=require('util');var path=require(_0xa370('0x6'));var sox=require(_0xa370('0x7'));var csv=require(_0xa370('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa370('0x9'));var squel=require(_0xa370('0xa'));var crypto=require(_0xa370('0xb'));var jsforce=require(_0xa370('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa370('0x8'));var querystring=require(_0xa370('0xd'));var Papa=require(_0xa370('0xe'));var extract=require(_0xa370('0xf'));var rimraf=require(_0xa370('0x1'));var archiver=require(_0xa370('0x10'));var Redis=require(_0xa370('0x11'));var authService=require(_0xa370('0x12'));var qs=require(_0xa370('0x13'));var as=require(_0xa370('0x14'));var hardwareService=require(_0xa370('0x15'));var logger=require(_0xa370('0x16'))('api');var utils=require(_0xa370('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa370('0x18'))['db'];config[_0xa370('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa370('0x19')]));require(_0xa370('0x1a'))[_0xa370('0x1b')](socket);function respondWithStatusCode(_0x19cacb,_0x3f7056){_0x3f7056=_0x3f7056||0xcc;return function(_0x4541e0){if(_0x4541e0){return _0x19cacb['sendStatus'](_0x3f7056);}return _0x19cacb[_0xa370('0x1c')](_0x3f7056)[_0xa370('0x1d')]();};}function respondWithResult(_0x4ad4d8,_0x3edd5b){_0x3edd5b=_0x3edd5b||0xc8;return function(_0x1a4e16){if(_0x1a4e16){return _0x4ad4d8['status'](_0x3edd5b)[_0xa370('0x1e')](_0x1a4e16);}};}function respondWithFilteredResult(_0x464c29,_0x5c84e0){return function(_0x4ac3ce){if(_0x4ac3ce){var _0x5da7ab=typeof _0x5c84e0[_0xa370('0x1f')]===_0xa370('0x20')&&typeof _0x5c84e0['limit']===_0xa370('0x20');var _0x43613b=_0x4ac3ce[_0xa370('0x21')];var _0x43e3fb=_0x5da7ab?0x0:_0x5c84e0[_0xa370('0x1f')];var _0xb145c9=_0x5da7ab?_0x4ac3ce['count']:_0x5c84e0['offset']+_0x5c84e0[_0xa370('0x22')];var _0x3a6b08;if(_0xb145c9>=_0x43613b){_0xb145c9=_0x43613b;_0x3a6b08=0xc8;}else{_0x3a6b08=0xce;}_0x464c29[_0xa370('0x1c')](_0x3a6b08);return _0x464c29[_0xa370('0x23')](_0xa370('0x24'),_0x43e3fb+'-'+_0xb145c9+'/'+_0x43613b)['json'](_0x4ac3ce);}return null;};}function patchUpdates(_0x48113b){return function(_0x276147){try{jsonpatch[_0xa370('0x25')](_0x276147,_0x48113b,!![]);}catch(_0x5bfb66){return BPromise['reject'](_0x5bfb66);}return _0x276147['save']();};}function saveUpdates(_0x4d2342,_0xfbb46c){return function(_0x17b4de){if(_0x17b4de){return _0x17b4de[_0xa370('0x26')](_0x4d2342)[_0xa370('0x27')](function(_0x49cc50){return _0x49cc50;});}return null;};}function removeEntity(_0x23ded3,_0x5f0708){return function(_0x186d25){if(_0x186d25){return _0x186d25[_0xa370('0x28')]()[_0xa370('0x27')](function(){var _0x1da797=_0x186d25[_0xa370('0x29')]({'plain':!![]});var _0x11350f=_0xa370('0x2a');return db[_0xa370('0x2b')][_0xa370('0x28')]({'where':{'type':_0x11350f,'resourceId':_0x1da797['id']}})[_0xa370('0x27')](function(){return _0x186d25;});})['then'](function(){_0x23ded3['status'](0xcc)[_0xa370('0x1d')]();});}};}function handleEntityNotFound(_0x15d1c7,_0xcece55){return function(_0x84ccf0){if(!_0x84ccf0){_0x15d1c7[_0xa370('0x2c')](0x194);}return _0x84ccf0;};}function handleError(_0x543d56,_0x38b21e){_0x38b21e=_0x38b21e||0x1f4;return function(_0x3882cf){logger[_0xa370('0x2d')](_0x3882cf[_0xa370('0x2e')]);if(_0x3882cf[_0xa370('0x2f')]){delete _0x3882cf[_0xa370('0x2f')];}_0x543d56[_0xa370('0x1c')](_0x38b21e)['send'](_0x3882cf);};}exports[_0xa370('0x30')]=function(_0x15e96a,_0x977c3e){var _0x2451c9={},_0x18ae3c={},_0x461d8b={'count':0x0,'rows':[]};var _0x467e9e=_[_0xa370('0x31')](db[_0xa370('0x32')][_0xa370('0x33')],function(_0x32ebe0){return{'name':_0x32ebe0[_0xa370('0x34')],'type':_0x32ebe0[_0xa370('0x35')][_0xa370('0x36')]};});_0x18ae3c[_0xa370('0x37')]=_[_0xa370('0x31')](_0x467e9e,'name');_0x18ae3c[_0xa370('0x38')]=_['keys'](_0x15e96a[_0xa370('0x38')]);_0x18ae3c[_0xa370('0x39')]=_['intersection'](_0x18ae3c['model'],_0x18ae3c[_0xa370('0x38')]);_0x2451c9[_0xa370('0x3a')]=_[_0xa370('0x3b')](_0x18ae3c[_0xa370('0x37')],qs[_0xa370('0x3c')](_0x15e96a[_0xa370('0x38')][_0xa370('0x3c')]));_0x2451c9[_0xa370('0x3a')]=_0x2451c9[_0xa370('0x3a')][_0xa370('0x3d')]?_0x2451c9[_0xa370('0x3a')]:_0x18ae3c['model'];if(!_0x15e96a[_0xa370('0x38')]['hasOwnProperty'](_0xa370('0x3e'))){_0x2451c9['limit']=qs[_0xa370('0x22')](_0x15e96a[_0xa370('0x38')][_0xa370('0x22')]);_0x2451c9[_0xa370('0x1f')]=qs['offset'](_0x15e96a[_0xa370('0x38')][_0xa370('0x1f')]);}_0x2451c9[_0xa370('0x3f')]=qs['sort'](_0x15e96a[_0xa370('0x38')]['sort']);_0x2451c9[_0xa370('0x40')]=qs[_0xa370('0x39')](_[_0xa370('0x41')](_0x15e96a[_0xa370('0x38')],_0x18ae3c[_0xa370('0x39')]),_0x467e9e);if(_0x15e96a[_0xa370('0x38')][_0xa370('0x42')]){_0x2451c9[_0xa370('0x40')]=_[_0xa370('0x43')](_0x2451c9[_0xa370('0x40')],{'$or':_['map'](_0x467e9e,function(_0x46e118){if(_0x46e118[_0xa370('0x35')]!==_0xa370('0x44')){var _0x381bd5={};_0x381bd5[_0x46e118[_0xa370('0x2f')]]={'$like':'%'+_0x15e96a[_0xa370('0x38')]['filter']+'%'};return _0x381bd5;}})});}_0x2451c9=_['merge']({},_0x2451c9,_0x15e96a[_0xa370('0x45')]);var _0x5eff9e={'where':_0x2451c9['where']};return db[_0xa370('0x32')][_0xa370('0x21')](_0x5eff9e)[_0xa370('0x27')](function(_0xb504be){_0x461d8b[_0xa370('0x21')]=_0xb504be;if(_0x15e96a[_0xa370('0x38')][_0xa370('0x46')]){_0x2451c9[_0xa370('0x47')]=[{'all':!![]}];}return db[_0xa370('0x32')][_0xa370('0x48')](_0x2451c9);})['then'](function(_0x34c67e){_0x461d8b[_0xa370('0x49')]=_0x34c67e;return _0x461d8b;})['then'](respondWithFilteredResult(_0x977c3e,_0x2451c9))['catch'](handleError(_0x977c3e,null));};exports[_0xa370('0x4a')]=function(_0x2875bd,_0x238454){var _0x2b24ce={'raw':!![],'where':{'id':_0x2875bd[_0xa370('0x4b')]['id']}},_0xcafad3={};_0xcafad3['model']=_[_0xa370('0x4c')](db['Plugin'][_0xa370('0x33')]);_0xcafad3['query']=_['keys'](_0x2875bd[_0xa370('0x38')]);_0xcafad3[_0xa370('0x39')]=_[_0xa370('0x3b')](_0xcafad3[_0xa370('0x37')],_0xcafad3[_0xa370('0x38')]);_0x2b24ce[_0xa370('0x3a')]=_[_0xa370('0x3b')](_0xcafad3[_0xa370('0x37')],qs[_0xa370('0x3c')](_0x2875bd[_0xa370('0x38')]['fields']));_0x2b24ce[_0xa370('0x3a')]=_0x2b24ce[_0xa370('0x3a')][_0xa370('0x3d')]?_0x2b24ce[_0xa370('0x3a')]:_0xcafad3[_0xa370('0x37')];if(_0x2875bd[_0xa370('0x38')][_0xa370('0x46')]){_0x2b24ce[_0xa370('0x47')]=[{'all':!![]}];}_0x2b24ce=_['merge']({},_0x2b24ce,_0x2875bd['options']);return db[_0xa370('0x32')][_0xa370('0x4d')](_0x2b24ce)[_0xa370('0x27')](handleEntityNotFound(_0x238454,null))[_0xa370('0x27')](respondWithResult(_0x238454,null))[_0xa370('0x4e')](handleError(_0x238454,null));};exports[_0xa370('0x4f')]=function(_0x3dd14c,_0x1b556b,_0xb626ab){return db['Plugin'][_0xa370('0x4d')]({'where':{'id':_0x3dd14c[_0xa370('0x4b')]['id']},'attributes':[_0xa370('0x2f'),_0xa370('0x6')],'raw':!![]})['then'](handleEntityNotFound(_0x1b556b,null))['then'](function(_0x61505e){if(_0x61505e){var _0x56c590=path[_0xa370('0x50')](config[_0xa370('0x51')],'server/files/plugins',util[_0xa370('0x52')]('%s.zip',path['basename'](_0x61505e[_0xa370('0x6')])));var _0x544af6=fs[_0xa370('0x53')](_0x56c590);var _0x179fd5=archiver('zip',{'zlib':{'level':0x9}});_0x179fd5['on']('warning',function(_0x59c1e1){if(_0x59c1e1[_0xa370('0x54')]===_0xa370('0x55')){logger[_0xa370('0x2d')](_0x59c1e1);}else{throw new db[(_0xa370('0x56'))][(_0xa370('0x57'))](_0xa370('0x58'));}});_0x179fd5['on'](_0xa370('0x2d'),function(_0x13329b){throw new db[(_0xa370('0x56'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x179fd5['pipe'](_0x544af6);_0x179fd5['glob'](_0xa370('0x59'),{'cwd':path[_0xa370('0x50')](config['root'],_0xa370('0x5a'),path[_0xa370('0x5b')](_0x61505e[_0xa370('0x6')])),'ignore':[path[_0xa370('0x50')](path[_0xa370('0x5c')](_0x61505e[_0xa370('0x6')]),_0xa370('0x5d')),path[_0xa370('0x50')](path[_0xa370('0x5c')](_0x61505e['path']),_0xa370('0x5e'))],'nodir':!![]})[_0xa370('0x5f')]();_0x544af6['on']('close',function(){if(!fs[_0xa370('0x60')](_0x56c590)){throw new db[(_0xa370('0x56'))][(_0xa370('0x57'))](_0xa370('0x61'));}return _0x1b556b['download'](_0x56c590,util[_0xa370('0x52')](_0xa370('0x62'),path[_0xa370('0x5c')](_0x61505e[_0xa370('0x6')])),function(_0x479ade){if(_0x479ade){throw new db[(_0xa370('0x56'))]['Error'](_0xa370('0x63'));}fs[_0xa370('0x64')](_0x56c590);logger[_0xa370('0x65')](_0xa370('0x66'));logger['info'](_0xa370('0x67'));});});}return null;})[_0xa370('0x4e')](handleError(_0x1b556b,null));};exports['upload']=function(_0x2b9940,_0x28cd0c,_0x1be970){var _0x4688fd=path['basename'](_0x2b9940['file'][_0xa370('0x68')],path[_0xa370('0x69')](_0x2b9940['file'][_0xa370('0x68')]));var _0x3e4e19=path[_0xa370('0x50')](config[_0xa370('0x51')],_0xa370('0x5a'),_0x2b9940[_0xa370('0x6a')][_0xa370('0x68')]);var _0x194058=path[_0xa370('0x50')](config[_0xa370('0x51')],_0xa370('0x5a'),_0x4688fd);logger[_0xa370('0x65')](_0xa370('0x6b'),_0x3e4e19);logger[_0xa370('0x65')](_0xa370('0x6c'),_0x194058);try{fs[_0xa370('0x6d')](_0x3e4e19,parseInt('0777',0x8));extract(_0x3e4e19,{'dir':_0x194058},function(_0x61cf3){if(_0x61cf3){logger[_0xa370('0x2d')](_0x61cf3);handleError(_0x61cf3,!![]);};var _0x20ca94=fs[_0xa370('0x6e')](_0x194058);if(_0x20ca94[_0xa370('0x3d')]>0x1){removeReferences(_0x3e4e19,_0x194058);logger[_0xa370('0x2d')](_0xa370('0x6f'));return _0x1be970(new Error('Invalid\x20plugin\x20structure'));}var _0x2b9aca=fs[_0xa370('0x70')](path[_0xa370('0x50')](_0x194058,_0x20ca94[0x0]));if(_0x2b9aca[_0xa370('0x71')]()){removeReferences(_0x3e4e19,_0x194058);logger[_0xa370('0x2d')](_0xa370('0x6f'));return _0x1be970(new Error(_0xa370('0x6f')));}if(_0x2b9aca[_0xa370('0x72')]()){var _0x5cf1fc=fs[_0xa370('0x6e')](path[_0xa370('0x50')](_0x194058,_0x20ca94[0x0]));if(_0x5cf1fc[_0xa370('0x3d')]===0x0){removeReferences(_0x3e4e19,_0x194058);logger['error'](_0xa370('0x6f'));return _0x1be970(new Error(_0xa370('0x6f')));}var _0x21fcc1=_0x5cf1fc['some'](function(_0x48ca7c){return _0x48ca7c==='manifest.json';});if(!_0x21fcc1){return _0x1be970(new Error('Plugin\x20manifest\x20missing'));}var _0x2ce46c=fs[_0xa370('0x73')](path[_0xa370('0x50')](_0x194058,_0x20ca94[0x0],_0xa370('0x74')));var _0x22ee7e=JSON['parse'](_0x2ce46c);if(_0xa370('0x20')==typeof _0x22ee7e[_0xa370('0x2f')]){return _0x1be970(new Error(_0xa370('0x75')));}if('undefined'==typeof _0x22ee7e['type']){return _0x1be970(new Error(_0xa370('0x76')));}if(_0xa370('0x20')==typeof _0x22ee7e[_0xa370('0x77')]){return _0x1be970(new Error(_0xa370('0x78')));}if(_0xa370('0x20')==typeof _0x22ee7e['parameters']){return _0x1be970(new Error(_0xa370('0x79')));}if(_0x22ee7e[_0xa370('0x35')]===_0xa370('0x7a')){if('undefined'==typeof _0x22ee7e[_0xa370('0x7b')]['views']){return _0x1be970(new Error(_0xa370('0x7c')));}if(_0xa370('0x20')==typeof _0x22ee7e[_0xa370('0x7b')][_0xa370('0x7d')][_0xa370('0x7e')]&&_0xa370('0x20')==typeof _0x22ee7e[_0xa370('0x7b')]['views'][_0xa370('0x7f')]){return _0x1be970(new Error(_0xa370('0x80')));}}else if(_0x22ee7e[_0xa370('0x35')]===_0xa370('0x81')){if('undefined'==typeof _0x22ee7e[_0xa370('0x7b')][_0xa370('0x82')]){return _0x1be970(new Error(_0xa370('0x83')));}if(_0xa370('0x20')==typeof _0x22ee7e[_0xa370('0x7b')]['scriptPath']){return _0x1be970(new Error(_0xa370('0x84')));}}else{return _0x1be970(new Error(_0xa370('0x85')));}var _0x2b28cc=_0x22ee7e[_0xa370('0x2f')];var _0x433f5b=_0x22ee7e['description'];var _0x2c398b=_0x22ee7e[_0xa370('0x35')];var _0x4831e6=_0x22ee7e['sidebar']?_0x22ee7e[_0xa370('0x86')]:_0xa370('0x87');var _0x3c81ee=_0x22ee7e['icon']?_0x22ee7e[_0xa370('0x88')]:'icon-apps';var _0x454970='';var _0x33c36b='';var _0x73666b='';var _0xec948b='';var _0x160049=_0x22ee7e[_0xa370('0x77')];if(_0x2c398b===_0xa370('0x7a')){if(_0xa370('0x20')!=typeof _0x22ee7e[_0xa370('0x7b')][_0xa370('0x7d')][_0xa370('0x7e')]){var _0x1d069e=_0x22ee7e[_0xa370('0x7b')][_0xa370('0x7d')][_0xa370('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xa370('0x89')](_0x1d069e)){_0x454970=path[_0xa370('0x50')](_0xa370('0x8a'),_0x4688fd,_0x20ca94[0x0],_0x1d069e);}else{_0x454970=_0x1d069e;}}else{logger[_0xa370('0x65')](_0xa370('0x8b'));}if(_0xa370('0x20')!=typeof _0x22ee7e[_0xa370('0x7b')][_0xa370('0x7d')]['agent']){var _0x58f22d=_0x22ee7e[_0xa370('0x7b')][_0xa370('0x7d')][_0xa370('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x58f22d)){_0x33c36b=path[_0xa370('0x50')](_0xa370('0x8a'),_0x4688fd,_0x20ca94[0x0],_0x58f22d);}else{_0x33c36b=_0x58f22d;}}else{logger['info'](_0xa370('0x8c'));}}else if(_0x2c398b===_0xa370('0x81')){_0x73666b=_0x22ee7e[_0xa370('0x7b')][_0xa370('0x82')];_0xec948b=_0x22ee7e[_0xa370('0x7b')][_0xa370('0x8d')];if(_0xa370('0x20')!=typeof _0x22ee7e['parameters'][_0xa370('0x7d')]){if('undefined'!=typeof _0x22ee7e['parameters'][_0xa370('0x7d')][_0xa370('0x7e')]){var _0x1d069e=_0x22ee7e[_0xa370('0x7b')][_0xa370('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xa370('0x89')](_0x1d069e)){_0x454970=path['join'](_0xa370('0x8a'),_0x4688fd,_0x20ca94[0x0],_0x1d069e);}else{_0x454970=_0x1d069e;}}if(_0xa370('0x20')!=typeof _0x22ee7e[_0xa370('0x7b')][_0xa370('0x7d')][_0xa370('0x7f')]){var _0x58f22d=_0x22ee7e[_0xa370('0x7b')][_0xa370('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xa370('0x89')](_0x58f22d)){_0x33c36b=path[_0xa370('0x50')](_0xa370('0x8a'),_0x4688fd,_0x20ca94[0x0],_0x58f22d);}else{_0x33c36b=_0x58f22d;}}}}var _0x18f253={'name':_0x2b28cc,'description':_0x433f5b,'path':path[_0xa370('0x50')](_0x4688fd,_0x20ca94[0x0]),'type':_0x2c398b,'sidebar':_0x4831e6,'icon':_0x3c81ee,'adminUrl':_0x454970,'agentUrl':_0x33c36b,'scriptName':_0x73666b,'scriptPath':_0xec948b,'version':_0x160049};removeReferences(_0x3e4e19,null);return db['Plugin']['create'](_0x18f253)[_0xa370('0x27')](function(_0x4711ed){var _0x4b0dd1={'role':_0x2b9940['body'][_0xa370('0x8e')],'userProfileId':_0x2b9940[_0xa370('0x8f')][_0xa370('0x90')]};if(!_0x4b0dd1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b0dd1[_0xa370('0x8e')]===_0xa370('0x91')){var _0x574732=_0x4711ed[_0xa370('0x29')]({'plain':!![]});return db['UserProfileSection'][_0xa370('0x4d')]({'where':{'name':'Plugins','userProfileId':_0x4b0dd1[_0xa370('0x90')]},'raw':!![]})['then'](function(_0xcecf8a){if(_0xcecf8a&&_0xcecf8a[_0xa370('0x92')]===0x0){return db[_0xa370('0x2b')][_0xa370('0x93')]({'name':_0x574732[_0xa370('0x2f')],'resourceId':_0x574732['id'],'type':_0xcecf8a[_0xa370('0x2f')],'sectionId':_0xcecf8a['id']},{})[_0xa370('0x27')](function(){return _0x4711ed;});}else{return _0x4711ed;}})[_0xa370('0x4e')](function(_0x4442cd){logger['error'](_0xa370('0x94'),_0x4442cd);throw _0x4442cd;});}return _0x4711ed;})[_0xa370('0x27')](respondWithResult(_0x28cd0c,null))[_0xa370('0x4e')](handleError(_0x28cd0c,null));}});}catch(_0x1cc302){_0x28cd0c['status'](0x1f4)[_0xa370('0x95')](_0x1cc302);}};function removeReferences(_0x28a847,_0x4cb53c){try{if(_0x28a847){fs[_0xa370('0x64')](_0x28a847);logger[_0xa370('0x65')](_0xa370('0x96'));}if(_0x4cb53c){rimraf(_0x4cb53c,function(){});logger[_0xa370('0x65')](_0xa370('0x97'));}}catch(_0x4f012d){logger['error'](_0x4f012d);}}exports[_0xa370('0x26')]=function(_0x17ff81,_0xe21648,_0x1b3c5a){return db[_0xa370('0x32')][_0xa370('0x4d')]({'where':{'id':_0x17ff81[_0xa370('0x4b')]['id']}})[_0xa370('0x27')](handleEntityNotFound(_0xe21648,null))[_0xa370('0x27')](saveUpdates(_0x17ff81[_0xa370('0x8f')],null))[_0xa370('0x27')](respondWithResult(_0xe21648,null))['catch'](handleError(_0xe21648,null));};exports[_0xa370('0x98')]=function(_0x20d1d0,_0x397e45,_0x3f3346){return db[_0xa370('0x32')][_0xa370('0x4d')]({'where':{'id':_0x20d1d0[_0xa370('0x4b')]['id']}})[_0xa370('0x27')](function(_0x36a515){if(_0x36a515){return _0x36a515[_0xa370('0x28')]();}})[_0xa370('0x27')](function(_0x57d043){rimraf(path['join'](config[_0xa370('0x51')],'server/files/plugins',path[_0xa370('0x5b')](_0x57d043[_0xa370('0x6')])),function(){});return _0x57d043;})[_0xa370('0x27')](handleEntityNotFound(_0x397e45,null))['then'](respondWithStatusCode(_0x397e45,null))['catch'](handleError(_0x397e45,null));};exports['webhookGet']=function(_0x4b4a20,_0x467348,_0x1ab36b){return BPromise[_0xa370('0x99')]()[_0xa370('0x27')](function(){if(!_0x4b4a20[_0xa370('0x38')][_0xa370('0x6')]){throw new Error(_0xa370('0x9a'));}if(!_0x4b4a20[_0xa370('0x38')][_0xa370('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x37790d=_0x4b4a20[_0xa370('0x38')]['hostname']?_0x4b4a20[_0xa370('0x38')]['hostname']+':'+_0x4b4a20[_0xa370('0x38')][_0xa370('0x9b')]:_0xa370('0x9c')+_0x4b4a20[_0xa370('0x38')][_0xa370('0x9b')];var _0x16af91=_0x4b4a20[_0xa370('0x38')]['json']?_0x4b4a20[_0xa370('0x38')][_0xa370('0x1e')]:!![];var _0x2de0a7=_0x4b4a20[_0xa370('0x38')][_0xa370('0x9d')]?_0x4b4a20[_0xa370('0x38')][_0xa370('0x9d')]:null;var _0x4f09ab={'method':_0x4b4a20[_0xa370('0x9e')],'uri':util[_0xa370('0x52')](_0xa370('0x9f'),_0x37790d,_0x4b4a20[_0xa370('0x38')][_0xa370('0x6')]),'json':_0x16af91,'resolveWithFullResponse':!![],'encoding':_0x2de0a7,'qs':_0x4b4a20[_0xa370('0x38')]};if(_0x4b4a20['headers']){_0x4f09ab[_0xa370('0xa0')]=_0x4b4a20[_0xa370('0xa0')];if(_0x4f09ab['headers'][_0xa370('0xa1')]){delete _0x4f09ab[_0xa370('0xa0')][_0xa370('0xa1')];}}if(_0x4f09ab['headers'][_0xa370('0xa2')]){delete _0x4f09ab[_0xa370('0xa0')]['content-type'];}return rp(_0x4f09ab);})[_0xa370('0x27')](function(_0x1ef97c){if(_0x1ef97c){_0x467348[_0xa370('0x23')](_0x1ef97c[_0xa370('0xa0')]);logger['info'](_0x1ef97c['body']);if(_[_0xa370('0xa3')](_0x4b4a20[_0xa370('0x38')][_0xa370('0x6')],'download')&&_0x1ef97c[_0xa370('0xa4')]==0x1f4){return _0x467348[_0xa370('0x2c')](_0x1ef97c['statusCode']);}else{return _0x467348[_0xa370('0x1c')](_0x1ef97c[_0xa370('0xa4')])[_0xa370('0x95')](_0x1ef97c[_0xa370('0x8f')]);}}else{return _0x467348['sendStatus'](0xc8);}})['catch'](handleError(_0x467348,null));};exports[_0xa370('0xa5')]=function(_0x46f2a3,_0x4e18f3,_0x65d013){return BPromise[_0xa370('0x99')]()[_0xa370('0x27')](function(){if(!_0x46f2a3[_0xa370('0x38')][_0xa370('0x6')]){throw new Error(_0xa370('0x9a'));}if(!_0x46f2a3[_0xa370('0x38')][_0xa370('0x9b')]){throw new Error(_0xa370('0xa6'));}var _0x59eef1=_0x46f2a3[_0xa370('0x38')]['hostname']?_0x46f2a3[_0xa370('0x38')]['hostname']+':'+_0x46f2a3[_0xa370('0x38')][_0xa370('0x9b')]:_0xa370('0x9c')+_0x46f2a3['query'][_0xa370('0x9b')];var _0xa9097a=_0x46f2a3[_0xa370('0x38')][_0xa370('0x1e')]?_0x46f2a3[_0xa370('0x38')][_0xa370('0x1e')]:!![];var _0x25b2b6=_0x46f2a3[_0xa370('0x38')]['encoding']?_0x46f2a3[_0xa370('0x38')]['encoding']:null;var _0x3b5cbc={'method':_0x46f2a3[_0xa370('0x9e')],'uri':util[_0xa370('0x52')](_0xa370('0x9f'),_0x59eef1,_0x46f2a3['query'][_0xa370('0x6')]),'json':_0xa9097a,'resolveWithFullResponse':!![],'encoding':_0x25b2b6,'body':_0x46f2a3[_0xa370('0x8f')]};if(_0x46f2a3[_0xa370('0xa0')]){_0x3b5cbc[_0xa370('0xa0')]=_0x46f2a3[_0xa370('0xa0')];if(_0x3b5cbc[_0xa370('0xa0')]['content-length']){delete _0x3b5cbc['headers'][_0xa370('0xa1')];}}if(_0x3b5cbc[_0xa370('0xa0')][_0xa370('0xa2')]){delete _0x3b5cbc['headers'][_0xa370('0xa2')];}return rp(_0x3b5cbc);})['then'](function(_0xd6e673){if(_0xd6e673){_0x4e18f3[_0xa370('0x23')](_0xd6e673[_0xa370('0xa0')]);logger[_0xa370('0x65')](_0xd6e673[_0xa370('0x8f')]);return _0x4e18f3['status'](_0xd6e673[_0xa370('0xa4')])[_0xa370('0x95')](_0xd6e673[_0xa370('0x8f')]);}else{return _0x4e18f3[_0xa370('0x2c')](0xc8);}})[_0xa370('0x4e')](handleError(_0x4e18f3,null));};
\ No newline at end of file
index 9de1a38..b347eab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf569=['exports','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2086e4,_0x286f2f){var _0x46faa2=function(_0xb52934){while(--_0xb52934){_0x2086e4['push'](_0x2086e4['shift']());}};_0x46faa2(++_0x286f2f);}(_0xf569,0xd0));var _0x9f56=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xf569[_0x44bcb0];return _0xfaf881;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x9f56('0x0'))['db'][_0x9f56('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x9f56('0x2')](0x0);var events={'afterCreate':_0x9f56('0x3'),'afterUpdate':_0x9f56('0x4'),'afterDestroy':_0x9f56('0x5')};function emitEvent(_0x4506a1){return function(_0x6d506b,_0x5bc3e8,_0x314ee2){PluginEvents['emit'](_0x4506a1+':'+_0x6d506b['id'],_0x6d506b);PluginEvents[_0x9f56('0x6')](_0x4506a1,_0x6d506b);_0x314ee2(null);};}for(var e in events){if(events[_0x9f56('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x9f56('0x8')]=PluginEvents;
\ No newline at end of file
+var _0x103f=['../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3ecf78,_0x2c70ce){var _0x19285d=function(_0x6305ff){while(--_0x6305ff){_0x3ecf78['push'](_0x3ecf78['shift']());}};_0x19285d(++_0x2c70ce);}(_0x103f,0x13e));var _0xf103=function(_0xc1ed57,_0x529c92){_0xc1ed57=_0xc1ed57-0x0;var _0x137220=_0x103f[_0xc1ed57];return _0x137220;};'use strict';var EventEmitter=require(_0xf103('0x0'));var Plugin=require(_0xf103('0x1'))['db'][_0xf103('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xf103('0x3')](0x0);var events={'afterCreate':_0xf103('0x4'),'afterUpdate':_0xf103('0x5'),'afterDestroy':_0xf103('0x6')};function emitEvent(_0x13898d){return function(_0x2db927,_0x2e15c9,_0x5a617c){PluginEvents[_0xf103('0x7')](_0x13898d+':'+_0x2db927['id'],_0x2db927);PluginEvents[_0xf103('0x7')](_0x13898d,_0x2db927);_0x5a617c(null);};}for(var e in events){if(events[_0xf103('0x8')](e)){var event=events[e];Plugin[_0xf103('0x9')](e,emitEvent(event));}}module[_0xf103('0xa')]=PluginEvents;
\ No newline at end of file
index b401582..28794a3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3676=['../../config/environment','define','Plugin','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x439aff,_0x529360){var _0x485be6=function(_0x33ad30){while(--_0x33ad30){_0x439aff['push'](_0x439aff['shift']());}};_0x485be6(++_0x529360);}(_0x3676,0x11b));var _0x6367=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x3676[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var util=require(_0x6367('0x0'));var logger=require(_0x6367('0x1'))(_0x6367('0x2'));var moment=require(_0x6367('0x3'));var BPromise=require(_0x6367('0x4'));var rp=require(_0x6367('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6367('0x6'));var config=require(_0x6367('0x7'));var attributes=require('./plugin.attributes');module['exports']=function(_0x321e5a,_0x1cc861){return _0x321e5a[_0x6367('0x8')](_0x6367('0x9'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x2942=['util','../../config/logger','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin','plugins','lodash'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2942,0x15f));var _0x2294=function(_0x35f30a,_0x6ef31f){_0x35f30a=_0x35f30a-0x0;var _0x2c50da=_0x2942[_0x35f30a];return _0x2c50da;};'use strict';var _=require(_0x2294('0x0'));var util=require(_0x2294('0x1'));var logger=require(_0x2294('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2294('0x3'));var fs=require('fs');var path=require(_0x2294('0x4'));var rimraf=require(_0x2294('0x5'));var config=require(_0x2294('0x6'));var attributes=require(_0x2294('0x7'));module[_0x2294('0x8')]=function(_0x288a12,_0x4896e2){return _0x288a12['define'](_0x2294('0x9'),attributes,{'tableName':_0x2294('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index abcb46d..243cea7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf21d=['info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','defaults','redis','socket.io-emitter','register','request','then'];(function(_0x4bbac3,_0x4e7d19){var _0x5e1e62=function(_0x1e998d){while(--_0x1e998d){_0x4bbac3['push'](_0x4bbac3['shift']());}};_0x5e1e62(++_0x4e7d19);}(_0xf21d,0x8c));var _0xdf21=function(_0x297cdd,_0x476afa){_0x297cdd=_0x297cdd-0x0;var _0x2a25cf=_0xf21d[_0x297cdd];return _0x2a25cf;};'use strict';var _=require(_0xdf21('0x0'));var util=require(_0xdf21('0x1'));var moment=require('moment');var BPromise=require(_0xdf21('0x2'));var rs=require(_0xdf21('0x3'));var fs=require('fs');var Redis=require(_0xdf21('0x4'));var db=require(_0xdf21('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdf21('0x6'));var config=require(_0xdf21('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdf21('0x8')]['http']({'port':0x232a});config['redis']=_[_0xdf21('0x9')](config[_0xdf21('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf21('0xb'))(new Redis(config[_0xdf21('0xa')]));require('./plugin.socket')[_0xdf21('0xc')](socket);function respondWithRpcPromise(_0x5735af,_0x4b00d2,_0x2b78f4){return new BPromise(function(_0x4a729e,_0x5e5fcb){return client[_0xdf21('0xd')](_0x5735af,_0x2b78f4)[_0xdf21('0xe')](function(_0x1c54ee){logger[_0xdf21('0xf')](_0xdf21('0x10'),_0x4b00d2,_0xdf21('0x11'));logger[_0xdf21('0x12')](_0xdf21('0x13'),_0x4b00d2,_0xdf21('0x11'),JSON[_0xdf21('0x14')](_0x1c54ee));if(_0x1c54ee[_0xdf21('0x15')]){if(_0x1c54ee['error'][_0xdf21('0x16')]===0x1f4){logger[_0xdf21('0x15')](_0xdf21('0x10'),_0x4b00d2,_0x1c54ee[_0xdf21('0x15')][_0xdf21('0x17')]);return _0x5e5fcb(_0x1c54ee['error'][_0xdf21('0x17')]);}logger[_0xdf21('0x15')](_0xdf21('0x10'),_0x4b00d2,_0x1c54ee[_0xdf21('0x15')][_0xdf21('0x17')]);return _0x4a729e(_0x1c54ee[_0xdf21('0x15')]['message']);}else{logger['info'](_0xdf21('0x10'),_0x4b00d2,_0xdf21('0x11'));_0x4a729e(_0x1c54ee[_0xdf21('0x18')][_0xdf21('0x17')]);}})[_0xdf21('0x19')](function(_0x3dfbbe){logger['error']('Plugin,\x20%s,\x20%s',_0x4b00d2,_0x3dfbbe);_0x5e5fcb(_0x3dfbbe);});});}exports[_0xdf21('0x1a')]=function(_0x55d344){var _0x4be8df=this;return new Promise(function(_0xf1af4f,_0x23a8ee){return db[_0xdf21('0x1b')][_0xdf21('0x1c')](_0x55d344['body'],{'raw':_0x55d344['options']?_0x55d344[_0xdf21('0x1d')][_0xdf21('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x139fb4){logger[_0xdf21('0xf')](_0xdf21('0x1a'),_0x55d344);logger['debug'](_0xdf21('0x1a'),_0x55d344,JSON[_0xdf21('0x14')](_0x139fb4));_0xf1af4f(_0x139fb4);})[_0xdf21('0x19')](function(_0x5f54d3){logger['error']('CreatePlugin',_0x5f54d3[_0xdf21('0x17')],_0x55d344);_0x23a8ee(_0x4be8df[_0xdf21('0x15')](0x1f4,_0x5f54d3[_0xdf21('0x17')]));});});};
\ No newline at end of file
+var _0xd934=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','options','raw','then','lodash'];(function(_0x242419,_0x185937){var _0x4a8792=function(_0x1c8e9f){while(--_0x1c8e9f){_0x242419['push'](_0x242419['shift']());}};_0x4a8792(++_0x185937);}(_0xd934,0x15d));var _0x4d93=function(_0x1a4b0e,_0xe70c){_0x1a4b0e=_0x1a4b0e-0x0;var _0x1d42cd=_0xd934[_0x1a4b0e];return _0x1d42cd;};'use strict';var _=require(_0x4d93('0x0'));var util=require(_0x4d93('0x1'));var moment=require(_0x4d93('0x2'));var BPromise=require(_0x4d93('0x3'));var rs=require(_0x4d93('0x4'));var fs=require('fs');var Redis=require(_0x4d93('0x5'));var db=require(_0x4d93('0x6'))['db'];var utils=require(_0x4d93('0x7'));var logger=require(_0x4d93('0x8'))(_0x4d93('0x9'));var config=require(_0x4d93('0xa'));var jayson=require(_0x4d93('0xb'));var client=jayson['client'][_0x4d93('0xc')]({'port':0x232a});config[_0x4d93('0xd')]=_['defaults'](config[_0x4d93('0xd')],{'host':_0x4d93('0xe'),'port':0x18eb});var socket=require(_0x4d93('0xf'))(new Redis(config[_0x4d93('0xd')]));require(_0x4d93('0x10'))[_0x4d93('0x11')](socket);function respondWithRpcPromise(_0xec477b,_0xb5792f,_0x9ec5b0){return new BPromise(function(_0x5e9925,_0x4d259c){return client[_0x4d93('0x12')](_0xec477b,_0x9ec5b0)['then'](function(_0x379739){logger[_0x4d93('0x13')](_0x4d93('0x14'),_0xb5792f,_0x4d93('0x15'));logger[_0x4d93('0x16')]('Plugin,\x20%s,\x20%s,\x20%s',_0xb5792f,_0x4d93('0x15'),JSON[_0x4d93('0x17')](_0x379739));if(_0x379739[_0x4d93('0x18')]){if(_0x379739[_0x4d93('0x18')][_0x4d93('0x19')]===0x1f4){logger[_0x4d93('0x18')](_0x4d93('0x14'),_0xb5792f,_0x379739['error'][_0x4d93('0x1a')]);return _0x4d259c(_0x379739[_0x4d93('0x18')]['message']);}logger[_0x4d93('0x18')](_0x4d93('0x14'),_0xb5792f,_0x379739[_0x4d93('0x18')]['message']);return _0x5e9925(_0x379739['error'][_0x4d93('0x1a')]);}else{logger[_0x4d93('0x13')]('Plugin,\x20%s,\x20%s',_0xb5792f,'request\x20sent');_0x5e9925(_0x379739[_0x4d93('0x1b')][_0x4d93('0x1a')]);}})[_0x4d93('0x1c')](function(_0x5bc823){logger[_0x4d93('0x18')]('Plugin,\x20%s,\x20%s',_0xb5792f,_0x5bc823);_0x4d259c(_0x5bc823);});});}exports[_0x4d93('0x1d')]=function(_0x3aa4bf){var _0xe62364=this;return new Promise(function(_0x31fe3e,_0x32ec2b){return db[_0x4d93('0x1e')][_0x4d93('0x1f')](_0x3aa4bf['body'],{'raw':_0x3aa4bf[_0x4d93('0x20')]?_0x3aa4bf[_0x4d93('0x20')][_0x4d93('0x21')]===undefined?!![]:![]:!![]})[_0x4d93('0x22')](function(_0x5c68b9){logger[_0x4d93('0x13')](_0x4d93('0x1d'),_0x3aa4bf);logger[_0x4d93('0x16')](_0x4d93('0x1d'),_0x3aa4bf,JSON['stringify'](_0x5c68b9));_0x31fe3e(_0x5c68b9);})[_0x4d93('0x1c')](function(_0x15f170){logger[_0x4d93('0x18')](_0x4d93('0x1d'),_0x15f170['message'],_0x3aa4bf);_0x32ec2b(_0xe62364['error'](0x1f4,_0x15f170[_0x4d93('0x1a')]));});});};
\ No newline at end of file
index 967aae0..3b97e35 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3543=['emit','register','./plugin.events','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3543,0xb2));var _0x3354=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x3543[_0x2bf141];return _0x48277b;};'use strict';var PluginEvents=require(_0x3354('0x0'));var events=['save','remove',_0x3354('0x1')];function createListener(_0x5dddc8,_0x36268b){return function(_0x3ca1d2){_0x36268b[_0x3354('0x2')](_0x5dddc8,_0x3ca1d2);};}function removeListener(_0xf6b573,_0x3a61d1){return function(){PluginEvents['removeListener'](_0xf6b573,_0x3a61d1);};}exports[_0x3354('0x3')]=function(_0x54dae7){for(var _0x36278c=0x0,_0x400dcc=events['length'];_0x36278c<_0x400dcc;_0x36278c++){var _0x9f37e9=events[_0x36278c];var _0x226cd7=createListener('plugin:'+_0x9f37e9,_0x54dae7);PluginEvents['on'](_0x9f37e9,_0x226cd7);}};
\ No newline at end of file
+var _0x64a1=['removeListener','./plugin.events','save','update','emit'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0x64a1,0x1a5));var _0x164a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x64a1[_0x82129b];return _0x2ae5dc;};'use strict';var PluginEvents=require(_0x164a('0x0'));var events=[_0x164a('0x1'),'remove',_0x164a('0x2')];function createListener(_0x39e3a7,_0x35c948){return function(_0x3e75e0){_0x35c948[_0x164a('0x3')](_0x39e3a7,_0x3e75e0);};}function removeListener(_0x579318,_0x4d507d){return function(){PluginEvents[_0x164a('0x4')](_0x579318,_0x4d507d);};}exports['register']=function(_0x34cf75){for(var _0x48061d=0x0,_0x3ad6ab=events['length'];_0x48061d<_0x3ad6ab;_0x48061d++){var _0x3e92d0=events[_0x48061d];var _0x49087d=createListener('plugin:'+_0x3e92d0,_0x34cf75);PluginEvents['on'](_0x3e92d0,_0x49087d);}};
\ No newline at end of file
index 5349230..c3bd005 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x4d6e8c,_0x510798){var _0x582629=function(_0x270d4a){while(--_0x270d4a){_0x4d6e8c['push'](_0x4d6e8c['shift']());}};_0x582629(++_0x510798);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router;
\ No newline at end of file
+var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x4b41ec,_0x2d0908){var _0x276860=function(_0x48c673){while(--_0x48c673){_0x4b41ec['push'](_0x4b41ec['shift']());}};_0x276860(++_0x2d0908);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router;
\ No newline at end of file
index 2bb13d4..349b941 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb469=['motion2','show','create','body','join','../../files/plugins','chdir','dirname','start','dump','catch','status','update','restart','hasOwnProperty','params','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','error','stack','name','send','info','index','list','then','reject','express'];(function(_0xb2880e,_0x1d9a09){var _0x2c48a5=function(_0xba3b55){while(--_0xba3b55){_0xb2880e['push'](_0xb2880e['shift']());}};_0x2c48a5(++_0x1d9a09);}(_0xb469,0x13b));var _0x9b46=function(_0x4b6b86,_0x2e8db1){_0x4b6b86=_0x4b6b86-0x0;var _0x21f453=_0xb469[_0x4b6b86];return _0x21f453;};'use strict';var _=require(_0x9b46('0x0'));var pm2=require(_0x9b46('0x1'));var logger=require(_0x9b46('0x2'))(_0x9b46('0x3'));var path=require(_0x9b46('0x4'));var exec=require(_0x9b46('0x5'))[_0x9b46('0x6')];var BPromise=require('bluebird');function handleEntityNotFound(_0x31f853,_0x45322f){return function(_0x538fc4){if(!_0x538fc4){_0x31f853[_0x9b46('0x7')](0x194);;}return _0x538fc4;};}function respondWithResult(_0x405d1c,_0x50b49e){_0x50b49e=_0x50b49e||0xc8;return function(_0x1b2dd3){if(_0x1b2dd3){return _0x405d1c['status'](_0x50b49e)['json'](_0x1b2dd3);}return null;};}function handleError(_0x34c0de,_0x545b6c){_0x545b6c=_0x545b6c||0x1f4;return function(_0x402595){logger[_0x9b46('0x8')](_0x402595[_0x9b46('0x9')]);if(_0x402595['name']){delete _0x402595[_0x9b46('0xa')];}_0x34c0de['status'](_0x545b6c)[_0x9b46('0xb')](_0x402595);};}function execChildProcess(){return new BPromise(function(_0x568d9a,_0x2c29a7){exec('npm\x20install',function(_0x672157,_0x233b6b,_0x563de4){logger[_0x9b46('0xc')](_0x233b6b);logger[_0x9b46('0xc')](_0x563de4);if(_0x672157){logger['error'](_0x672157);return _0x2c29a7(_0x672157);}return _0x568d9a(_0x233b6b);});});}exports[_0x9b46('0xd')]=function(_0x2cfb35,_0x3d9618){return pm2[_0x9b46('0xe')]()[_0x9b46('0xf')](function(_0x35c5c1){if(_0x35c5c1){var _0x2136bc=_[_0x9b46('0x10')](_0x35c5c1,function(_0x3f2b28){return _0x3f2b28[_0x9b46('0xa')]===_0x9b46('0x11')||_0x3f2b28[_0x9b46('0xa')]===_0x9b46('0x12');});return{'rows':_0x2136bc,'count':_0x2136bc['length']};}return null;})['then'](respondWithResult(_0x3d9618,null))['catch'](handleError(_0x3d9618,null));};exports[_0x9b46('0x13')]=function(_0x5a380c,_0x29fec9){return pm2['describe'](_0x5a380c['params']['id'])[_0x9b46('0xf')](respondWithResult(_0x29fec9,null))['then'](handleEntityNotFound(_0x29fec9,null))['catch'](handleError(_0x29fec9,null));};exports[_0x9b46('0x14')]=function(_0x3a15cc,_0x5a0d25){if(_0x3a15cc[_0x9b46('0x15')][_0x9b46('0xa')]&&_0x3a15cc['body']['script']){var _0xbec2ea=path[_0x9b46('0x16')](__dirname,_0x9b46('0x17'),_0x3a15cc['body']['script']);var _0x2b3440=process['cwd']();process[_0x9b46('0x18')](path[_0x9b46('0x19')](_0xbec2ea));return execChildProcess()['then'](function(_0xadff19){process['chdir'](_0x2b3440);return pm2[_0x9b46('0x1a')]({'name':_0x3a15cc[_0x9b46('0x15')]['name'],'script':_0xbec2ea});})[_0x9b46('0xf')](function(_0x31ca63){pm2[_0x9b46('0x1b')]();return _0x31ca63[0x0];})[_0x9b46('0xf')](respondWithResult(_0x5a0d25,0xc9))[_0x9b46('0x1c')](handleError(_0x5a0d25,null));}else{return _0x5a0d25[_0x9b46('0x1d')](0x1f4)[_0x9b46('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x9b46('0x1e')]=function(_0x3ac37e,_0x478105){if(_0x3ac37e[_0x9b46('0x15')]['id']){delete _0x3ac37e[_0x9b46('0x15')]['id'];}var _0x2a79a5={'online':_0x9b46('0x1f'),'stopped':'stop'};if(_0x2a79a5[_0x9b46('0x20')](_0x3ac37e[_0x9b46('0x15')][_0x9b46('0x1d')])){return pm2[_0x2a79a5[_0x3ac37e[_0x9b46('0x15')][_0x9b46('0x1d')]]](_0x3ac37e[_0x9b46('0x21')]['id'])[_0x9b46('0xf')](respondWithResult(_0x478105,0xc8))[_0x9b46('0x1c')](handleError(_0x478105,null));}else{return _0x478105[_0x9b46('0x1d')](0x1f4)[_0x9b46('0xb')]({'message':_0x9b46('0x22')});}};exports['destroy']=function(_0x1f722d,_0x27f326){if(_0x1f722d[_0x9b46('0x15')]['id']){delete _0x1f722d[_0x9b46('0x15')]['id'];}if(_0x1f722d[_0x9b46('0x21')]['id']){return pm2[_0x9b46('0x23')](_0x1f722d[_0x9b46('0x21')]['id'])[_0x9b46('0xf')](function(_0x3ab49a){pm2[_0x9b46('0x1b')]();return _0x3ab49a[0x0];})[_0x9b46('0xf')](respondWithResult(_0x27f326,null))['catch'](handleError(_0x27f326,null));}else{return _0x27f326[_0x9b46('0x1d')](0x1f4)['send']({'message':_0x9b46('0x24')});}};
\ No newline at end of file
+var _0x16d2=['cwd','chdir','start','dump','update','stop','send','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','list','express','motion2','length','then','catch','show','params','create','body','script','join'];(function(_0x6e8723,_0x731d2c){var _0x5ffca8=function(_0x244c01){while(--_0x244c01){_0x6e8723['push'](_0x6e8723['shift']());}};_0x5ffca8(++_0x731d2c);}(_0x16d2,0x123));var _0x216d=function(_0x1e0902,_0x2d386e){_0x1e0902=_0x1e0902-0x0;var _0x54f607=_0x16d2[_0x1e0902];return _0x54f607;};'use strict';var _=require(_0x216d('0x0'));var pm2=require(_0x216d('0x1'));var logger=require(_0x216d('0x2'))(_0x216d('0x3'));var path=require(_0x216d('0x4'));var exec=require(_0x216d('0x5'))[_0x216d('0x6')];var BPromise=require(_0x216d('0x7'));function handleEntityNotFound(_0xfd7306,_0x593bb0){return function(_0x2c662d){if(!_0x2c662d){_0xfd7306[_0x216d('0x8')](0x194);;}return _0x2c662d;};}function respondWithResult(_0xef687c,_0x205101){_0x205101=_0x205101||0xc8;return function(_0x1dd8e2){if(_0x1dd8e2){return _0xef687c[_0x216d('0x9')](_0x205101)[_0x216d('0xa')](_0x1dd8e2);}return null;};}function handleError(_0x28da14,_0x57accc){_0x57accc=_0x57accc||0x1f4;return function(_0x22c7b3){logger[_0x216d('0xb')](_0x22c7b3[_0x216d('0xc')]);if(_0x22c7b3[_0x216d('0xd')]){delete _0x22c7b3[_0x216d('0xd')];}_0x28da14[_0x216d('0x9')](_0x57accc)['send'](_0x22c7b3);};}function execChildProcess(){return new BPromise(function(_0x7ca9c9,_0x50db30){exec(_0x216d('0xe'),function(_0x2e02ce,_0x332e30,_0x398970){logger[_0x216d('0xf')](_0x332e30);logger[_0x216d('0xf')](_0x398970);if(_0x2e02ce){logger['error'](_0x2e02ce);return _0x50db30(_0x2e02ce);}return _0x7ca9c9(_0x332e30);});});}exports[_0x216d('0x10')]=function(_0x4c07d0,_0x271bb1){return pm2[_0x216d('0x11')]()['then'](function(_0x165c19){if(_0x165c19){var _0x322e4b=_['reject'](_0x165c19,function(_0x1b3215){return _0x1b3215['name']===_0x216d('0x12')||_0x1b3215[_0x216d('0xd')]===_0x216d('0x13');});return{'rows':_0x322e4b,'count':_0x322e4b[_0x216d('0x14')]};}return null;})[_0x216d('0x15')](respondWithResult(_0x271bb1,null))[_0x216d('0x16')](handleError(_0x271bb1,null));};exports[_0x216d('0x17')]=function(_0x1496fe,_0x19fdac){return pm2['describe'](_0x1496fe[_0x216d('0x18')]['id'])['then'](respondWithResult(_0x19fdac,null))['then'](handleEntityNotFound(_0x19fdac,null))[_0x216d('0x16')](handleError(_0x19fdac,null));};exports[_0x216d('0x19')]=function(_0x574758,_0x3f32e0){if(_0x574758[_0x216d('0x1a')]['name']&&_0x574758[_0x216d('0x1a')][_0x216d('0x1b')]){var _0x430e81=path[_0x216d('0x1c')](__dirname,'../../files/plugins',_0x574758[_0x216d('0x1a')][_0x216d('0x1b')]);var _0x10f299=process[_0x216d('0x1d')]();process[_0x216d('0x1e')](path['dirname'](_0x430e81));return execChildProcess()[_0x216d('0x15')](function(_0x1bd4db){process[_0x216d('0x1e')](_0x10f299);return pm2[_0x216d('0x1f')]({'name':_0x574758[_0x216d('0x1a')]['name'],'script':_0x430e81});})[_0x216d('0x15')](function(_0xab672){pm2[_0x216d('0x20')]();return _0xab672[0x0];})['then'](respondWithResult(_0x3f32e0,0xc9))['catch'](handleError(_0x3f32e0,null));}else{return _0x3f32e0['status'](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x216d('0x21')]=function(_0x470d8a,_0x189413){if(_0x470d8a[_0x216d('0x1a')]['id']){delete _0x470d8a[_0x216d('0x1a')]['id'];}var _0x47fa6d={'online':'restart','stopped':_0x216d('0x22')};if(_0x47fa6d['hasOwnProperty'](_0x470d8a[_0x216d('0x1a')][_0x216d('0x9')])){return pm2[_0x47fa6d[_0x470d8a[_0x216d('0x1a')][_0x216d('0x9')]]](_0x470d8a[_0x216d('0x18')]['id'])[_0x216d('0x15')](respondWithResult(_0x189413,0xc8))[_0x216d('0x16')](handleError(_0x189413,null));}else{return _0x189413[_0x216d('0x9')](0x1f4)[_0x216d('0x23')]({'message':_0x216d('0x24')});}};exports[_0x216d('0x25')]=function(_0x260134,_0x4537fd){if(_0x260134['body']['id']){delete _0x260134[_0x216d('0x1a')]['id'];}if(_0x260134[_0x216d('0x18')]['id']){return pm2[_0x216d('0x26')](_0x260134['params']['id'])[_0x216d('0x15')](function(_0x1743ee){pm2[_0x216d('0x20')]();return _0x1743ee[0x0];})[_0x216d('0x15')](respondWithResult(_0x4537fd,null))['catch'](handleError(_0x4537fd,null));}else{return _0x4537fd[_0x216d('0x9')](0x1f4)[_0x216d('0x23')]({'message':_0x216d('0x27')});}};
\ No newline at end of file
index e63b317..0438235 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc59a=['/queues','exports','express','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x83ea5e,_0x282312){var _0x3701bc=function(_0x46881a){while(--_0x46881a){_0x83ea5e['push'](_0x83ea5e['shift']());}};_0x3701bc(++_0x282312);}(_0xc59a,0xfe));var _0xac59=function(_0x3365f8,_0x1a8ab0){_0x3365f8=_0x3365f8-0x0;var _0x3bc52f=_0xc59a[_0x3365f8];return _0x3bc52f;};'use strict';var express=require(_0xac59('0x0'));var router=express['Router']();var auth=require(_0xac59('0x1'));var controller=require(_0xac59('0x2'));router[_0xac59('0x3')](_0xac59('0x4'),auth[_0xac59('0x5')](),controller[_0xac59('0x6')]);router[_0xac59('0x3')](_0xac59('0x7'),auth['isAuthenticated'](),controller['getQueues']);module[_0xac59('0x8')]=router;
\ No newline at end of file
+var _0xadcb=['express','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','/queues','getQueues','exports'];(function(_0x303b5e,_0x3e57e0){var _0x37f15d=function(_0x502485){while(--_0x502485){_0x303b5e['push'](_0x303b5e['shift']());}};_0x37f15d(++_0x3e57e0);}(_0xadcb,0x7e));var _0xbadc=function(_0x7aa030,_0xbd2609){_0x7aa030=_0x7aa030-0x0;var _0x64da18=_0xadcb[_0x7aa030];return _0x64da18;};'use strict';var express=require(_0xbadc('0x0'));var router=express['Router']();var auth=require(_0xbadc('0x1'));var controller=require(_0xbadc('0x2'));router[_0xbadc('0x3')](_0xbadc('0x4'),auth[_0xbadc('0x5')](),controller['getAgents']);router[_0xbadc('0x3')](_0xbadc('0x6'),auth[_0xbadc('0x5')](),controller[_0xbadc('0x7')]);module[_0xbadc('0x8')]=router;
\ No newline at end of file
index 9405ba2..c45d50d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfd00=['userProfileId','nolimit','extraQueryConditions','UserProfile','getResources','Status','QueueCampaigns','Queues','findAndCountAll','util','lodash','jayson/promise','../../components/parsers/qs','../../config/utils','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','json','stack','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','voice','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','outbound','pTalking','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','map','get','loggedInDb','busy','originated','find','merge','pick','filter','queue','length','some','internal','toString','getMembers','UserId','accountcode','online','voiceStatus','agents','push','User','Pause','findAll','startCase','QueueId','chatPause','faxPause','openchannelPause','voicePause','whatsappPause','every','unknown','ringing','isNil','idle','chatStatus','faxStatus','mailStatus','*pause','getChannels','toLowerCase','Invalid\x20channel','Queue','all','flatten','uniq','value','includes','resolve','name','fullname','mailPause','smsPause','globalStatus','split','fields','startsWith','DESC','substring','sort','pause','pauseType','userpic','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','faxCurrentCapacity','openchannelStatus','smsStatus','whatsappStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','getAgents','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','channel','join','order','rows','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','FIELD(id,','forEach','where','user'];(function(_0x2fb19b,_0x19acbd){var _0x3f6666=function(_0x47bde0){while(--_0x47bde0){_0x2fb19b['push'](_0x2fb19b['shift']());}};_0x3f6666(++_0x19acbd);}(_0xfd00,0x15f));var _0x0fd0=function(_0x37be14,_0x3d78de){_0x37be14=_0x37be14-0x0;var _0x4a089e=_0xfd00[_0x37be14];return _0x4a089e;};'use strict';var util=require(_0x0fd0('0x0'));var _=require(_0x0fd0('0x1'));var jayson=require(_0x0fd0('0x2'));var qs=require(_0x0fd0('0x3'));var utils=require(_0x0fd0('0x4'));var logger=require('../../config/logger')('api');var db=require(_0x0fd0('0x5'))['db'];var amiClient=jayson[_0x0fd0('0x6')][_0x0fd0('0x7')]({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithFilteredResult(_0x119517,_0x9f3601){return function(_0x367502){if(_0x367502){var _0x3a6997=typeof _0x9f3601[_0x0fd0('0x8')]===_0x0fd0('0x9')&&typeof _0x9f3601[_0x0fd0('0xa')]===_0x0fd0('0x9');var _0x228a73=_0x367502[_0x0fd0('0xb')];var _0x32438b=_0x3a6997?0x0:_0x9f3601[_0x0fd0('0x8')];var _0x30bf94=_0x3a6997?_0x367502['count']:_0x9f3601['offset']+_0x9f3601['limit'];var _0x398461;if(_0x30bf94>=_0x228a73){_0x30bf94=_0x228a73;_0x398461=0xc8;}else{_0x398461=0xce;}_0x119517[_0x0fd0('0xc')](_0x398461);return _0x119517[_0x0fd0('0xd')](_0x0fd0('0xe'),_0x32438b+'-'+_0x30bf94+'/'+_0x228a73)[_0x0fd0('0xf')](_0x367502);}return null;};}function handleError(_0x49cd17,_0x1e29f7){_0x1e29f7=_0x1e29f7||0x1f4;return function(_0x1b58e9){logger['error'](_0x1b58e9[_0x0fd0('0x10')]);if(_0x1b58e9['name']){delete _0x1b58e9['name'];}_0x49cd17['status'](_0x1e29f7)['send'](_0x1b58e9);};}function getRealtimeAgents(){return amiClient[_0x0fd0('0x11')](_0x0fd0('0x12'),{})[_0x0fd0('0x13')](function(_0x70cae3){if(_0x70cae3['error']){throw new Error(_0x0fd0('0x14'));}var _0x5129c2=_0x70cae3[_0x0fd0('0x15')];return routingClient[_0x0fd0('0x11')](_0x0fd0('0x12'),{})[_0x0fd0('0x13')](function(_0x49dc34){if(_0x49dc34[_0x0fd0('0x16')]){throw new Error(_0x0fd0('0x17'));}var _0x521b43=_0x49dc34[_0x0fd0('0x15')];return _['merge']({},_0x5129c2,_0x521b43);});})[_0x0fd0('0x18')](function(_0x56e19b){throw _0x56e19b;});}function getRealtimeQueues(_0x47d739,_0x56dc6b){return new Promise(function(_0x583c16,_0x4bb6ca){var _0x4ceb4=_0x56dc6b===_0x0fd0('0x19')?amiClient:routingClient;return _0x4ceb4[_0x0fd0('0x11')](_['startCase'](_0x56dc6b)+'Queues',_0x47d739)['then'](function(_0x205227){if(_0x205227[_0x0fd0('0x16')])throw new Error(util['format'](_0x0fd0('0x1a'),_0x56dc6b));return _0x583c16(_0x205227[_0x0fd0('0x15')]);})['catch'](function(_0x3068f3){_0x4bb6ca(_0x3068f3);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x42bdbc,_0x4b4346){return amiClient['request'](_0x0fd0('0x1b'),{})[_0x0fd0('0x13')](function(_0x48fbd4){if(_0x48fbd4[_0x0fd0('0x16')])throw new Error(_0x0fd0('0x1c'));return _0x42bdbc(_0x48fbd4['result']);})[_0x0fd0('0x18')](function(_0x48dd55){_0x4b4346(_0x48dd55);});});}function initializeQueues(_0x5dc0d9,_0x311109,_0x3474e5,_0x4bdc36){var _0x13be58=[_0x0fd0('0x1d'),_0x0fd0('0x1e'),_0x0fd0('0x1f'),_0x0fd0('0x20'),_0x0fd0('0x21')];if(_0x3474e5===_0x0fd0('0x19')&&_0x4bdc36===_0x0fd0('0x22')){_0x13be58['push'](_0x0fd0('0x23'),'originated',_0x0fd0('0x24'),_0x0fd0('0x25'),_0x0fd0('0x26'),_0x0fd0('0x27'),_0x0fd0('0x28'),_0x0fd0('0x29'),_0x0fd0('0x2a'),_0x0fd0('0x2b'),_0x0fd0('0x2c'),_0x0fd0('0x2d'),_0x0fd0('0x2e'),_0x0fd0('0x2f'),_0x0fd0('0x30'),_0x0fd0('0x31'),'predictiveIntervalTotalCalls',_0x0fd0('0x32'),_0x0fd0('0x33'),_0x0fd0('0x34'),'predictiveIntervalAvgHoldtime',_0x0fd0('0x35'));}return _0x5dc0d9[_0x0fd0('0x36')](function(_0x728fb4){var _0x24dc9a=_0x728fb4[_0x0fd0('0x37')]({'plain':!![]});_0x24dc9a['agents']=[];_0x24dc9a[_0x0fd0('0x21')]=0x0;_0x24dc9a[_0x0fd0('0x38')]=0x0;_0x24dc9a['loggedIn']=0x0;_0x24dc9a['available']=0x0;_0x24dc9a[_0x0fd0('0x1f')]=0x0;if(_0x3474e5===_0x0fd0('0x19')){_0x24dc9a['talking']=0x0;_0x24dc9a[_0x0fd0('0x39')]=0x0;if(_0x4bdc36===_0x0fd0('0x22')){_0x24dc9a['pTalking']=0x0;_0x24dc9a[_0x0fd0('0x3a')]=0x0;}}var _0xdbab4f=_[_0x0fd0('0x3b')](_0x311109,['id',_0x24dc9a['id']]);if(_0xdbab4f)_[_0x0fd0('0x3c')](_0x24dc9a,_[_0x0fd0('0x3d')](_0xdbab4f,_0x13be58));return _0x24dc9a;});}function updateAgentVoiceStatus(_0x223c58,_0x5d38d5,_0x4a4b58){var _0x4e76f1=_[_0x0fd0('0x3e')](_0x4a4b58,[_0x0fd0('0x3f'),_0x5d38d5['name']]);if(_0x4e76f1[_0x0fd0('0x40')]===0x0)return _0x223c58[_0x0fd0('0x39')]=!![];if(_[_0x0fd0('0x41')](_0x4e76f1,['connectedlinenum',_0x223c58[_0x0fd0('0x42')][_0x0fd0('0x43')]()]))return _0x223c58[_0x0fd0('0x20')]=!![];if(!_0x223c58[_0x0fd0('0x20')])return _0x223c58['busy']=!![];}function getVoiceQueueAgents(_0x5432c8,_0x770c32,_0x221334,_0x59076c){var _0x3e8e34=_['find'](_0x770c32,['id',_0x5432c8['id']]);if(!_0x3e8e34)return _0x5432c8;return _0x3e8e34[_0x0fd0('0x44')]({'raw':!![]})[_0x0fd0('0x13')](function(_0x16e180){for(var _0x5a8d64=0x0;_0x5a8d64<_0x16e180[_0x0fd0('0x40')];_0x5a8d64++){var _0x2fd719=_['find'](_0x221334,['id',_0x16e180[_0x5a8d64][_0x0fd0('0x45')]]);if(!_0x2fd719){_0x2fd719={'id':_0x16e180[_0x5a8d64][_0x0fd0('0x45')],'name':_0x16e180[_0x5a8d64][_0x0fd0('0x45')],'accountcode':'','online':![]};}var _0x1e1da0={'id':_0x2fd719['id'],'name':_0x2fd719['name'],'internal':_0x2fd719[_0x0fd0('0x46')],'online':Boolean(_0x2fd719[_0x0fd0('0x47')]),'paused':Boolean(_0x16e180[_0x5a8d64][_0x0fd0('0x21')])};if(_0x2fd719[_0x0fd0('0x48')]===_0x0fd0('0x20'))updateAgentVoiceStatus(_0x1e1da0,_0x5432c8,_0x59076c);if(_0x1e1da0[_0x0fd0('0x47')])_0x5432c8['loggedInDb']++;if(_0x1e1da0[_0x0fd0('0x39')])_0x5432c8[_0x0fd0('0x39')]++;if(_0x1e1da0[_0x0fd0('0x21')]&&!_0x1e1da0[_0x0fd0('0x39')]&&!_0x1e1da0[_0x0fd0('0x20')])_0x5432c8[_0x0fd0('0x21')]++;_0x5432c8[_0x0fd0('0x49')][_0x0fd0('0x4a')](_0x1e1da0);}return _0x5432c8;});}function getQueueAgents(_0x2d5105,_0x34bbf8,_0x24cd66){var _0x4a6fbf=_0x0fd0('0x4b')+_['startCase'](_0x24cd66)+'Queue';var _0x2e7e60=_0x24cd66+_0x0fd0('0x4c');return db[_0x4a6fbf][_0x0fd0('0x4d')]({'where':{[_[_0x0fd0('0x4e')](_0x24cd66)+_0x0fd0('0x4f')]:_0x2d5105['id']},'raw':!![]})['then'](function(_0x51e0bf){for(var _0x4708a1=0x0;_0x4708a1<_0x51e0bf['length'];_0x4708a1++){var _0x2b5b1c=_[_0x0fd0('0x3b')](_0x34bbf8,['id',_0x51e0bf[_0x4708a1][_0x0fd0('0x45')]]);if(!_0x2b5b1c){_0x2b5b1c={'id':_0x51e0bf[_0x4708a1][_0x0fd0('0x45')],'name':_0x51e0bf[_0x4708a1][_0x0fd0('0x45')],'online':![],['pauseField']:![]};}var _0x49fb0e={'id':_0x2b5b1c['id'],'name':_0x2b5b1c['name'],'online':Boolean(_0x2b5b1c[_0x0fd0('0x47')]),'paused':Boolean(_0x2b5b1c[_0x2e7e60])};if(_0x49fb0e[_0x0fd0('0x47')])_0x2d5105[_0x0fd0('0x38')]++;_0x2d5105[_0x0fd0('0x49')][_0x0fd0('0x4a')](_0x49fb0e);}return _0x2d5105;});}function isAgentPaused(_0x21388a,_0x4484de){var _0x331c86=[_0x21388a[_0x0fd0('0x50')],_0x21388a[_0x0fd0('0x51')],_0x21388a['mailPause'],_0x21388a[_0x0fd0('0x52')],_0x21388a['smsPause'],_0x21388a[_0x0fd0('0x53')],_0x21388a[_0x0fd0('0x54')]];if(!_0x4484de)return _[_0x0fd0('0x55')](_0x331c86);var _0x42e399=_[_0x0fd0('0x3e')](_0x331c86);return _0x42e399[_0x0fd0('0x40')]>0x0&&_0x42e399[_0x0fd0('0x40')]<_0x331c86[_0x0fd0('0x40')]?!![]:![];}function isIdle(_0x47babc){return _0x47babc==='idle'||_0x47babc===_0x0fd0('0x56')||_0x47babc==='unavailable'||_0x47babc===_0x0fd0('0x57')||_[_0x0fd0('0x58')](_0x47babc);}function isAgentIdle(_0x2ef156){if(_0x2ef156[_0x0fd0('0x48')]!==_0x0fd0('0x59')&&_0x2ef156[_0x0fd0('0x53')]){_0x2ef156[_0x0fd0('0x48')]='pause';return![];}return _[_0x0fd0('0x55')]([_0x2ef156[_0x0fd0('0x5a')],_0x2ef156[_0x0fd0('0x5b')],_0x2ef156[_0x0fd0('0x5c')],_0x2ef156['openchannelStatus'],_0x2ef156['smsStatus'],_0x2ef156[_0x0fd0('0x48')],_0x2ef156['whatsappStatus']],isIdle);}function getAgentStatus(_0x2833f4){var _0x257389='unknown';if(isAgentPaused(_0x2833f4))_0x257389='pause';else if(isAgentPaused(_0x2833f4,!![]))_0x257389=_0x0fd0('0x5d');else if(isAgentIdle(_0x2833f4))_0x257389='idle';else _0x257389=_0x0fd0('0x39');return _0x257389;}function validateChannel(_0x55be02){var _0x4ae2a4=utils[_0x0fd0('0x5e')]();if(!_['includes'](_0x4ae2a4,_0x55be02[_0x0fd0('0x5f')]()))throw new Error(_0x0fd0('0x60'));return _0x55be02[_0x0fd0('0x5f')]();}function getAgentIdsByQueues(_0xe50d11,_0x5c6f2c){var _0x5d4824=_['isArray'](_0xe50d11)?_0xe50d11:[_0xe50d11];var _0x1de114=_[_0x0fd0('0x4e')](_0x5c6f2c)+_0x0fd0('0x61');var _0x2242ee=_[_0x0fd0('0x36')](_0x5d4824,function(_0x166c08){return db[_0x1de114]['findOne']({'where':{'id':_0x166c08}})[_0x0fd0('0x13')](function(_0x4946ae){if(!_0x4946ae)return[];return _0x4946ae['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x0fd0('0x62')](_0x2242ee)['then'](function(_0x766039){var _0x11d37c=_(_0x766039)[_0x0fd0('0x63')]()['map']('id')[_0x0fd0('0x64')]()[_0x0fd0('0x65')]();return _0x11d37c;});}function getAgentIdsByStatus(_0x191f4b,_0x50b4ee,_0x417043){try{if(_0x50b4ee[_0x0fd0('0x40')]>0x0){_0x191f4b=_0x191f4b['filter'](function(_0x41b2bf){return _0x50b4ee[_0x0fd0('0x66')](_0x41b2bf['id']);});}var _0x34824a=_0x191f4b['filter'](function(_0x1a0cb4){var _0x5a5542=_0x0fd0('0x39');if(isAgentIdle(_0x1a0cb4)){_0x5a5542='idle';}return _0x5a5542===_0x417043;});return _[_0x0fd0('0x36')](_0x34824a,'id');}catch(_0x2e151f){throw _0x2e151f;}}function getSortedAgentsIdsByStatus(_0x19c339,_0x1c544c,_0x5557ac){return Promise[_0x0fd0('0x67')]()['then'](function(){if(_0x1c544c['length']>0x0){_0x19c339=_0x19c339[_0x0fd0('0x3e')](function(_0x12c867){return _0x1c544c[_0x0fd0('0x66')](_0x12c867['id']);});}return _0x19c339;})[_0x0fd0('0x13')](function(){return db[_0x0fd0('0x4b')]['findAll']({'attributes':['id',_0x0fd0('0x68'),_0x0fd0('0x69'),'chatPause',_0x0fd0('0x51'),_0x0fd0('0x6a'),_0x0fd0('0x52'),_0x0fd0('0x6b'),_0x0fd0('0x53'),_0x0fd0('0x54'),'pauseType'],'where':{'id':{'$in':_['map'](_0x19c339,'id')}},'raw':!![]});})[_0x0fd0('0x13')](function(_0x4f7a59){return _0x4f7a59[_0x0fd0('0x36')](function(_0xa4afd){var _0xdd929b=_[_0x0fd0('0x3b')](_0x19c339,['id',_0xa4afd['id']]);var _0x45b466=filterAgentAttributes(_0xdd929b);_[_0x0fd0('0x3c')](_0xa4afd,_0x45b466);_0xa4afd[_0x0fd0('0x6c')]=getAgentStatus(_0xa4afd);return _0xa4afd;});})['then'](function(_0x4f2a43){var _0x195559=sortAgentsByStatus(_0x4f2a43,_0x5557ac);return _[_0x0fd0('0x36')](_0x195559,'id');})[_0x0fd0('0x18')](function(_0x366f19){throw _0x366f19;});}function getUpdatedSortOptions(_0x451bdb){var _0x447417={'fields':[],'order':null};var _0x5a66d8=_0x451bdb[_0x0fd0('0x6d')](',');_0x447417[_0x0fd0('0x6e')]=_[_0x0fd0('0x3e')](_0x5a66d8,function(_0x42168c){if(!_0x42168c[_0x0fd0('0x66')](_0x0fd0('0x6c'))){return!![];}_0x447417['order']=_[_0x0fd0('0x6f')](_0x42168c,'-')?_0x0fd0('0x70'):'ASC';return![];});return _0x447417;}function validateSortParameter(_0x2ee7cb){if(_0x2ee7cb[_0x0fd0('0x66')](_0x0fd0('0x69'))&&!_0x2ee7cb[_0x0fd0('0x66')](_0x0fd0('0x42'))){var _0x2062c8=_0x2ee7cb[_0x0fd0('0x71')](0x0,_0x2ee7cb['indexOf']('fullname'));_0x2ee7cb+=','+_0x2062c8+'internal';}return _0x2ee7cb;}function sortAgentsByStatus(_0x10b891,_0x10047f){var _0x365893=_0x10b891[_0x0fd0('0x72')](function(_0x42481c,_0x513798){if(_0x42481c[_0x0fd0('0x6c')]===_0x513798[_0x0fd0('0x6c')]){if(_0x42481c[_0x0fd0('0x6c')]===_0x0fd0('0x73')){if(_0x10047f===_0x0fd0('0x70')){return(_0x42481c[_0x0fd0('0x74')]||'')<(_0x513798['pauseType']||'')||_0x42481c[_0x0fd0('0x69')][_0x0fd0('0x5f')]()>_0x513798[_0x0fd0('0x69')]['toLowerCase']()?0x1:-0x1;}else{return(_0x42481c[_0x0fd0('0x74')]||'')<(_0x513798[_0x0fd0('0x74')]||'')||_0x42481c[_0x0fd0('0x69')][_0x0fd0('0x5f')]()>_0x513798[_0x0fd0('0x69')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x10047f==='DESC'){return _0x42481c[_0x0fd0('0x69')][_0x0fd0('0x5f')]()<_0x513798[_0x0fd0('0x69')][_0x0fd0('0x5f')]()?0x1:-0x1;}else{return _0x42481c[_0x0fd0('0x69')][_0x0fd0('0x5f')]()<_0x513798[_0x0fd0('0x69')][_0x0fd0('0x5f')]()?-0x1:0x1;}}}else{if(_0x10047f===_0x0fd0('0x70')){return _0x42481c['globalStatus']<_0x513798[_0x0fd0('0x6c')]?0x1:-0x1;}else{return _0x42481c[_0x0fd0('0x6c')]<_0x513798[_0x0fd0('0x6c')]?-0x1:0x1;}}});return _0x365893;}function filterAgentAttributes(_0x4e98a5){var _0x13641d=[_0x0fd0('0x75'),_0x0fd0('0x47'),'lastLoginAt','lastPauseAt',_0x0fd0('0x74'),_0x0fd0('0x76'),_0x0fd0('0x42'),_0x0fd0('0x77'),_0x0fd0('0x50'),_0x0fd0('0x52'),_0x0fd0('0x6a'),_0x0fd0('0x6b'),_0x0fd0('0x54'),_0x0fd0('0x51'),_0x0fd0('0x53'),_0x0fd0('0x78'),_0x0fd0('0x79'),_0x0fd0('0x7a'),'smsCapacity',_0x0fd0('0x7b'),_0x0fd0('0x7c'),_0x0fd0('0x7d'),'openchannelCurrentCapacity',_0x0fd0('0x7e'),'smsCurrentCapacity','whatsappCurrentCapacity',_0x0fd0('0x7f'),_0x0fd0('0x5a'),_0x0fd0('0x80'),_0x0fd0('0x5c'),_0x0fd0('0x81'),_0x0fd0('0x82'),_0x0fd0('0x5b'),_0x0fd0('0x48'),_0x0fd0('0x83'),'openchannelStatusTime',_0x0fd0('0x84'),_0x0fd0('0x85'),_0x0fd0('0x86'),_0x0fd0('0x87'),_0x0fd0('0x88'),_0x0fd0('0x3f'),'destconnectedlinenum',_0x0fd0('0x89'),_0x0fd0('0x8a'),_0x0fd0('0x8b'),_0x0fd0('0x8c')];var _0x55f5bf=[_0x0fd0('0x50'),_0x0fd0('0x52'),'mailPause',_0x0fd0('0x6b'),_0x0fd0('0x54'),'faxPause',_0x0fd0('0x53'),_0x0fd0('0x47')];var _0x441053=_(_0x4e98a5)['omit'](_0x55f5bf)[_0x0fd0('0x3d')](_0x13641d)['value']();return _0x441053;}exports[_0x0fd0('0x8d')]=function(_0x33d44b,_0x5ddc9d){var _0x24391f={'count':0x0,'rows':[]};var _0x12d366={};var _0x7f9648;var _0x14e48c;var _0xc3aa97;var _0x356832;var _0x41e52c=utils['getChannels']();var _0x59be66=_0x33d44b[_0x0fd0('0x8e')][_0x0fd0('0x8f')];var _0x584ef7=_0x33d44b[_0x0fd0('0x8e')][_0x0fd0('0x90')];var _0x1c6d1e=_0x33d44b[_0x0fd0('0x8e')][_0x0fd0('0x91')];var _0x54ca91=_0x584ef7==='pause'||_0x584ef7===_0x0fd0('0x5d')?!![]:![];var _0x55393b=[];var _0x13e672;Promise[_0x0fd0('0x67')]()[_0x0fd0('0x13')](function(){if(_0x33d44b[_0x0fd0('0x8e')][_0x0fd0('0x92')])_0x7f9648=validateChannel(_0x33d44b['query'][_0x0fd0('0x92')]);if(!_0x33d44b['query'][_0x0fd0('0x72')]||!_0x33d44b[_0x0fd0('0x8e')][_0x0fd0('0x72')][_0x0fd0('0x66')](_0x0fd0('0x6c'))){_0x33d44b[_0x0fd0('0x8e')][_0x0fd0('0x72')]=validateSortParameter(_0x33d44b[_0x0fd0('0x8e')][_0x0fd0('0x72')]);return;}var _0x46fe08=getUpdatedSortOptions(_0x33d44b[_0x0fd0('0x8e')][_0x0fd0('0x72')]);_0x33d44b[_0x0fd0('0x8e')]['sort']=_0x46fe08['fields'][_0x0fd0('0x93')](',');_0x14e48c=_0x46fe08[_0x0fd0('0x94')];})[_0x0fd0('0x13')](function(){if(!_0x59be66){return[];}return getAgentIdsByQueues(_0x59be66,_0x7f9648);})[_0x0fd0('0x13')](function(_0xc4fdb3){_0x55393b=_0xc4fdb3;return getRealtimeAgents();})[_0x0fd0('0x13')](function(_0x54cc3e){_0x356832=_0x54cc3e[_0x0fd0('0x95')];if((!_0x584ef7||_0x54ca91)&&!_0x14e48c){return _0x55393b;}if(_0x14e48c&&!_0x584ef7){return getSortedAgentsIdsByStatus(_0x356832,_0x55393b,_0x14e48c);}else{return getAgentIdsByStatus(_0x356832,_0x55393b,_0x584ef7);}})[_0x0fd0('0x13')](function(_0x50762f){_0x55393b=_0x50762f;var _0x220728=![];if(_0x55393b[_0x0fd0('0x40')]===0x0){if(_0x59be66||_0x584ef7){_0x220728=!![];}if(_0x54ca91){_0x220728=![];}}if(_0x220728){return _0x24391f;}var _0x59c4f9=_[_0x0fd0('0x36')](db[_0x0fd0('0x4b')][_0x0fd0('0x96')],function(_0x57d39e){return{'name':_0x57d39e[_0x0fd0('0x97')],'type':_0x57d39e[_0x0fd0('0x98')][_0x0fd0('0x99')]};});_0x33d44b[_0x0fd0('0x8e')][_0x0fd0('0x9a')]=_0x0fd0('0x9b');_0x33d44b[_0x0fd0('0x8e')][_0x0fd0('0x47')]=!![];_0x12d366=qs[_0x0fd0('0x9c')](_0x59c4f9,_0x33d44b);_0x12d366[_0x0fd0('0x9d')]=!![];var _0x52ea91=[];if(_0x55393b['length']>0x0){_0x52ea91[_0x0fd0('0x4a')]({'id':{'$in':_0x55393b}});if(_0x14e48c&&!_0x584ef7){_0x13e672=[db['sequelize']['literal'](_0x0fd0('0x9e')+_0x55393b+')')];_0x12d366[_0x0fd0('0x94')]=_0x13e672;}}if(_0x54ca91){_0x41e52c[_0x0fd0('0x9f')](function(_0x45d93a){var _0x61771c=!![];if(_0x584ef7==='*pause'&&_0x7f9648!==_0x45d93a){_0x61771c=![];}_0x52ea91[_0x0fd0('0x4a')]({[_0x45d93a+_0x0fd0('0x4c')]:_0x61771c});});if(_0x1c6d1e){_0x52ea91['push']({'pauseType':_0x1c6d1e});}}else if(_0x584ef7){_0x41e52c['forEach'](function(_0x32474e){_0x52ea91[_0x0fd0('0x4a')]({[_0x32474e+_0x0fd0('0x4c')]:![]});});}_0x12d366[_0x0fd0('0xa0')]=_[_0x0fd0('0x3c')](_0x12d366[_0x0fd0('0xa0')],{'$and':_0x52ea91});if(_0x33d44b['user'][_0x0fd0('0x9a')]===_0x0fd0('0xa1')){var _0x4ddf98={'params':{'id':_0x33d44b[_0x0fd0('0xa1')][_0x0fd0('0xa2')]},'query':{'section':'Agents','role':_0x0fd0('0x9b'),'online':!![],'nolimit':_0x33d44b['query'][_0x0fd0('0xa3')],'sort':_0x33d44b['query'][_0x0fd0('0x72')],'filter':_0x33d44b[_0x0fd0('0x8e')][_0x0fd0('0x3e')],'raw':!![],'ids':_0x55393b,'customSorting':_0x13e672}};if(_0x54ca91){_0x4ddf98[_0x0fd0('0x8e')][_0x0fd0('0xa4')]=_0x52ea91;}return db[_0x0fd0('0xa5')][_0x0fd0('0xa6')](_0x4ddf98);}return db[_0x0fd0('0x4b')]['findAndCountAll'](_0x12d366);})['then'](function(_0x4e7ebf){_0x24391f['count']=_0x4e7ebf[_0x0fd0('0xb')];_0xc3aa97=_0x4e7ebf['rows'];return _0xc3aa97['map'](function(_0x1bdb76){var _0x178d84=_['find'](_0x356832,['id',_0x1bdb76['id']]);if(_0x178d84){var _0x28dd17=filterAgentAttributes(_0x178d84);_[_0x0fd0('0x3c')](_0x1bdb76,_0x28dd17);}_0x1bdb76['globalStatus']=getAgentStatus(_0x1bdb76);if(_0x1bdb76[_0x0fd0('0x6c')][_0x0fd0('0x66')](_0x0fd0('0x73'))){_0x41e52c[_0x0fd0('0x9f')](function(_0x261b86){if(_0x1bdb76[_0x261b86+_0x0fd0('0x4c')]){_0x1bdb76[_0x261b86+_0x0fd0('0xa7')]=_0x0fd0('0x73');}});}return _0x1bdb76;});})[_0x0fd0('0x13')](function(_0x583d54){if(!_0x14e48c||_0x13e672){return _0x583d54;}return sortAgentsByStatus(_0x583d54,_0x14e48c);})[_0x0fd0('0x13')](function(_0x15f1e0){_0x24391f[_0x0fd0('0x95')]=_0x15f1e0;return _0x24391f;})[_0x0fd0('0x13')](respondWithFilteredResult(_0x5ddc9d,_0x12d366))[_0x0fd0('0x18')](handleError(_0x5ddc9d,null));};exports['getQueues']=function(_0x41dcb3,_0x22677f){var _0xde95c6={'count':0x0,'rows':[]},_0x5931ef={},_0x4c3b6f,_0x3ec470,_0x273fa9,_0x7b7ad0,_0x32f368;Promise[_0x0fd0('0x67')]()[_0x0fd0('0x13')](function(){if(_0x41dcb3[_0x0fd0('0x8e')][_0x0fd0('0x92')])_0x4c3b6f=validateChannel(_0x41dcb3['query'][_0x0fd0('0x92')]);var _0x35d158=_[_0x0fd0('0x4e')](_0x4c3b6f)+_0x0fd0('0x61');var _0x22e6b9=_[_0x0fd0('0x36')](db[_0x35d158][_0x0fd0('0x96')],function(_0x5e6a69){return{'name':_0x5e6a69[_0x0fd0('0x97')],'type':_0x5e6a69[_0x0fd0('0x98')][_0x0fd0('0x99')]};});_0x5931ef=qs[_0x0fd0('0x9c')](_0x22e6b9,_0x41dcb3);if(_0x41dcb3['user'][_0x0fd0('0x9a')]===_0x0fd0('0xa1')){var _0x5041e3={'params':{'id':_0x41dcb3[_0x0fd0('0xa1')]['userProfileId']},'query':{'section':_0x4c3b6f===_0x0fd0('0x19')&&_0x41dcb3[_0x0fd0('0x8e')][_0x0fd0('0x98')]==='outbound'?_0x0fd0('0xa8'):_[_0x0fd0('0x4e')](_0x4c3b6f)+_0x0fd0('0xa9'),'type':_0x41dcb3[_0x0fd0('0x8e')][_0x0fd0('0x98')],'nolimit':!![],'sort':_0x0fd0('0x68'),'filter':_0x41dcb3[_0x0fd0('0x8e')][_0x0fd0('0x3e')]}};return db[_0x0fd0('0xa5')][_0x0fd0('0xa6')](_0x5041e3);}return db[_0x35d158][_0x0fd0('0xaa')](_0x5931ef);})[_0x0fd0('0x13')](function(_0x1f3dcc){_0xde95c6['count']=_0x1f3dcc[_0x0fd0('0xb')];_0x3ec470=_0x1f3dcc['rows'];return getRealtimeQueues(_0x41dcb3,_0x4c3b6f);})[_0x0fd0('0x13')](function(_0x5cf777){_0x7b7ad0=_0x5cf777[_0x0fd0('0x95')];return getRealtimeAgents();})[_0x0fd0('0x13')](function(_0x20f4c4){_0x273fa9=_0x20f4c4[_0x0fd0('0x95')];if(_0x4c3b6f!='voice')return;return getRealtimeVoiceQueueChannels();})[_0x0fd0('0x13')](function(_0x29e6ed){_0x32f368=_0x29e6ed?_0x29e6ed['rows']:[];return initializeQueues(_0x3ec470,_0x7b7ad0,_0x4c3b6f,_0x41dcb3['query'][_0x0fd0('0x98')]);})[_0x0fd0('0x13')](function(_0x197119){var _0x14bd75=_0x197119[_0x0fd0('0x36')](function(_0x167d16){if(_0x4c3b6f===_0x0fd0('0x19'))return getVoiceQueueAgents(_0x167d16,_0x3ec470,_0x273fa9,_0x32f368);else return getQueueAgents(_0x167d16,_0x273fa9,_0x4c3b6f);});return Promise[_0x0fd0('0x62')](_0x14bd75);})[_0x0fd0('0x13')](function(_0x3e1d87){_0xde95c6[_0x0fd0('0x95')]=_0x3e1d87;return _0xde95c6;})['then'](respondWithFilteredResult(_0x22677f,_0x5931ef))[_0x0fd0('0x18')](handleError(_0x22677f,null));};
\ No newline at end of file
+var _0x91cf=['address','mailPause','whatsappPause','chatCapacity','openchannelCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','mailStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','query','channel','join','User','fieldName','type','key','agent','raw','isEmpty','where','globalQueueFilter','user','role','UserProfile','getResources','findAndCountAll','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','rawAttributes','getOptions','userProfileId','QueueCampaigns','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','../../mysqldb','client','http','offset','undefined','count','status','Content-Range','error','name','send','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','talking','paused','voice','outbound','push','originated','message','dialActive','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','available','waiting','busy','find','pick','filter','queue','length','some','connectedlinenum','getMembers','UserId','accountcode','online','Queue','Pause','findAll','idle','unknown','unavailable','ringing','isNil','faxPause','openchannelPause','smsPause','voicePause','every','voiceStatus','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','pause','*pause','mail','chat','openchannel','fax','whatsapp','includes','Invalid\x20channel','toLowerCase','isArray','findOne','getAgents','all','flatten','uniq','value','split','fields','globalStatus','order','startsWith','ASC','sort','DESC','pauseType','userpic','lastLoginAt','lastPauseAt','internal'];(function(_0x5d3805,_0x3631b3){var _0x1cc8bf=function(_0x14de26){while(--_0x14de26){_0x5d3805['push'](_0x5d3805['shift']());}};_0x1cc8bf(++_0x3631b3);}(_0x91cf,0x17d));var _0xf91c=function(_0x1d1da3,_0x387863){_0x1d1da3=_0x1d1da3-0x0;var _0x4ea3b1=_0x91cf[_0x1d1da3];return _0x4ea3b1;};'use strict';var util=require(_0xf91c('0x0'));var _=require(_0xf91c('0x1'));var jayson=require(_0xf91c('0x2'));var qs=require(_0xf91c('0x3'));var logger=require(_0xf91c('0x4'))('api');var db=require(_0xf91c('0x5'))['db'];var amiClient=jayson[_0xf91c('0x6')][_0xf91c('0x7')]({'port':0x232a});var routingClient=jayson[_0xf91c('0x6')][_0xf91c('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x11bf32,_0x2e2f16){return function(_0x26bd12){if(_0x26bd12){var _0x261eb5=typeof _0x2e2f16[_0xf91c('0x8')]===_0xf91c('0x9')&&typeof _0x2e2f16['limit']===_0xf91c('0x9');var _0xbd921e=_0x26bd12['count'];var _0xd473da=_0x261eb5?0x0:_0x2e2f16[_0xf91c('0x8')];var _0x118545=_0x261eb5?_0x26bd12[_0xf91c('0xa')]:_0x2e2f16[_0xf91c('0x8')]+_0x2e2f16['limit'];var _0x2ec028;if(_0x118545>=_0xbd921e){_0x118545=_0xbd921e;_0x2ec028=0xc8;}else{_0x2ec028=0xce;}_0x11bf32[_0xf91c('0xb')](_0x2ec028);return _0x11bf32['set'](_0xf91c('0xc'),_0xd473da+'-'+_0x118545+'/'+_0xbd921e)['json'](_0x26bd12);}return null;};}function handleError(_0xe539ad,_0x45b529){_0x45b529=_0x45b529||0x1f4;return function(_0x4371cc){logger[_0xf91c('0xd')](_0x4371cc['stack']);if(_0x4371cc[_0xf91c('0xe')]){delete _0x4371cc[_0xf91c('0xe')];}_0xe539ad[_0xf91c('0xb')](_0x45b529)[_0xf91c('0xf')](_0x4371cc);};}function getRealtimeAgents(){return new Promise(function(_0x44405a,_0x2fab95){return amiClient[_0xf91c('0x10')]('Agents',{})[_0xf91c('0x11')](function(_0x545ea1){if(_0x545ea1[_0xf91c('0xd')])throw new Error(_0xf91c('0x12'));var _0x304fa5=_0x545ea1['result'];return routingClient[_0xf91c('0x10')](_0xf91c('0x13'),{})[_0xf91c('0x11')](function(_0x896b51){if(_0x896b51[_0xf91c('0xd')])throw new Error(_0xf91c('0x14'));var _0xf877d8=_0x896b51[_0xf91c('0x15')];return _0x44405a(_[_0xf91c('0x16')]({},_0x304fa5,_0xf877d8));});})[_0xf91c('0x17')](function(_0x5fbb97){_0x2fab95(_0x5fbb97);});});}function getRealtimeQueues(_0x50659d,_0x25ce86){return new Promise(function(_0x188204,_0x392ab8){var _0x5882f2=_0x25ce86==='voice'?amiClient:routingClient;return _0x5882f2['request'](_[_0xf91c('0x18')](_0x25ce86)+_0xf91c('0x19'),_0x50659d)['then'](function(_0x1c8d8e){if(_0x1c8d8e[_0xf91c('0xd')])throw new Error(util[_0xf91c('0x1a')](_0xf91c('0x1b'),_0x25ce86));return _0x188204(_0x1c8d8e[_0xf91c('0x15')]);})[_0xf91c('0x17')](function(_0xb9332){_0x392ab8(_0xb9332);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x4871ab,_0x3ed158){return amiClient[_0xf91c('0x10')](_0xf91c('0x1c'),{})[_0xf91c('0x11')](function(_0x11edc8){if(_0x11edc8[_0xf91c('0xd')])throw new Error(_0xf91c('0x1d'));return _0x4871ab(_0x11edc8['result']);})[_0xf91c('0x17')](function(_0x4e0495){_0x3ed158(_0x4e0495);});});}function initializeQueues(_0x59a65d,_0x2871ec,_0x4b5ca4,_0x541fe5){var _0x4f96f0=[_0xf91c('0x1e'),'available','waiting',_0xf91c('0x1f'),_0xf91c('0x20')];if(_0x4b5ca4===_0xf91c('0x21')&&_0x541fe5===_0xf91c('0x22')){_0x4f96f0[_0xf91c('0x23')]('pTalking',_0xf91c('0x24'),_0xf91c('0x25'),_0xf91c('0x26'),'dialMethod',_0xf91c('0x27'),'startPredictive',_0xf91c('0x28'),_0xf91c('0x29'),_0xf91c('0x2a'),_0xf91c('0x2b'),_0xf91c('0x2c'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0xf91c('0x2d'),'predictiveIntervalTotalCalls',_0xf91c('0x2e'),_0xf91c('0x2f'),_0xf91c('0x30'),'predictiveIntervalAvgHoldtime',_0xf91c('0x31'));}return _0x59a65d[_0xf91c('0x32')](function(_0x13a18c){var _0x50b034=_0x13a18c[_0xf91c('0x33')]({'plain':!![]});_0x50b034[_0xf91c('0x34')]=[];_0x50b034[_0xf91c('0x20')]=0x0;_0x50b034[_0xf91c('0x35')]=0x0;_0x50b034['loggedIn']=0x0;_0x50b034[_0xf91c('0x36')]=0x0;_0x50b034[_0xf91c('0x37')]=0x0;if(_0x4b5ca4===_0xf91c('0x21')){_0x50b034['talking']=0x0;_0x50b034[_0xf91c('0x38')]=0x0;if(_0x541fe5===_0xf91c('0x22')){_0x50b034['pTalking']=0x0;_0x50b034['originated']=0x0;}}var _0x1438dc=_[_0xf91c('0x39')](_0x2871ec,['id',_0x50b034['id']]);if(_0x1438dc)_['merge'](_0x50b034,_[_0xf91c('0x3a')](_0x1438dc,_0x4f96f0));return _0x50b034;});}function updateAgentVoiceStatus(_0x14d37e,_0x2f6f51,_0x32ce57){var _0xa7187=_[_0xf91c('0x3b')](_0x32ce57,[_0xf91c('0x3c'),_0x2f6f51[_0xf91c('0xe')]]);if(_0xa7187[_0xf91c('0x3d')]===0x0)return _0x14d37e[_0xf91c('0x38')]=!![];if(_[_0xf91c('0x3e')](_0xa7187,[_0xf91c('0x3f'),_0x14d37e['internal']['toString']()]))return _0x14d37e[_0xf91c('0x1f')]=!![];if(!_0x14d37e[_0xf91c('0x1f')])return _0x14d37e[_0xf91c('0x38')]=!![];}function getVoiceQueueAgents(_0x321ac7,_0x2c481e,_0x6b9296,_0x36cde2){var _0x1141ab=_[_0xf91c('0x39')](_0x2c481e,['id',_0x321ac7['id']]);if(!_0x1141ab)return _0x321ac7;return _0x1141ab[_0xf91c('0x40')]({'raw':!![]})[_0xf91c('0x11')](function(_0x29ce75){for(var _0x4240c8=0x0;_0x4240c8<_0x29ce75[_0xf91c('0x3d')];_0x4240c8++){var _0x51518d=_[_0xf91c('0x39')](_0x6b9296,['id',_0x29ce75[_0x4240c8][_0xf91c('0x41')]]);if(!_0x51518d){_0x51518d={'id':_0x29ce75[_0x4240c8]['UserId'],'name':_0x29ce75[_0x4240c8][_0xf91c('0x41')],'accountcode':'','online':![]};}var _0xac7809={'id':_0x51518d['id'],'name':_0x51518d[_0xf91c('0xe')],'internal':_0x51518d[_0xf91c('0x42')],'online':Boolean(_0x51518d[_0xf91c('0x43')]),'paused':Boolean(_0x29ce75[_0x4240c8]['paused'])};if(_0x51518d['voiceStatus']===_0xf91c('0x1f'))updateAgentVoiceStatus(_0xac7809,_0x321ac7,_0x36cde2);if(_0xac7809['online'])_0x321ac7[_0xf91c('0x35')]++;if(_0xac7809[_0xf91c('0x38')])_0x321ac7[_0xf91c('0x38')]++;if(_0xac7809[_0xf91c('0x20')]&&!_0xac7809[_0xf91c('0x38')]&&!_0xac7809[_0xf91c('0x1f')])_0x321ac7[_0xf91c('0x20')]++;_0x321ac7[_0xf91c('0x34')][_0xf91c('0x23')](_0xac7809);}return _0x321ac7;});}function getQueueAgents(_0x5e8b27,_0x460a08,_0x10068b){var _0x254181='User'+_[_0xf91c('0x18')](_0x10068b)+_0xf91c('0x44');var _0x24d96c=_0x10068b+_0xf91c('0x45');return db[_0x254181][_0xf91c('0x46')]({'where':{[_[_0xf91c('0x18')](_0x10068b)+'QueueId']:_0x5e8b27['id']},'raw':!![]})['then'](function(_0xfaecd5){for(var _0x46b3ba=0x0;_0x46b3ba<_0xfaecd5[_0xf91c('0x3d')];_0x46b3ba++){var _0x37377c=_[_0xf91c('0x39')](_0x460a08,['id',_0xfaecd5[_0x46b3ba][_0xf91c('0x41')]]);if(!_0x37377c){_0x37377c={'id':_0xfaecd5[_0x46b3ba]['UserId'],'name':_0xfaecd5[_0x46b3ba][_0xf91c('0x41')],'online':![],['pauseField']:![]};}var _0x94f279={'id':_0x37377c['id'],'name':_0x37377c[_0xf91c('0xe')],'online':Boolean(_0x37377c['online']),'paused':Boolean(_0x37377c[_0x24d96c])};if(_0x94f279[_0xf91c('0x43')])_0x5e8b27[_0xf91c('0x35')]++;_0x5e8b27['agents'][_0xf91c('0x23')](_0x94f279);}return _0x5e8b27;});}function isIdle(_0x152fa1){return _0x152fa1===_0xf91c('0x47')||_0x152fa1===_0xf91c('0x48')||_0x152fa1===_0xf91c('0x49')||_0x152fa1===_0xf91c('0x4a')||_[_0xf91c('0x4b')](_0x152fa1);}function isAgentPaused(_0x5150c3,_0x52b37d){var _0x1c23e4=[_0x5150c3['chatPause'],_0x5150c3[_0xf91c('0x4c')],_0x5150c3['mailPause'],_0x5150c3[_0xf91c('0x4d')],_0x5150c3[_0xf91c('0x4e')],_0x5150c3[_0xf91c('0x4f')],_0x5150c3['whatsappPause']];if(!_0x52b37d)return _[_0xf91c('0x50')](_0x1c23e4);var _0x5f130d=_['filter'](_0x1c23e4);return _0x5f130d[_0xf91c('0x3d')]>0x0&&_0x5f130d[_0xf91c('0x3d')]<_0x1c23e4[_0xf91c('0x3d')]?!![]:![];}function isAgentIdle(_0x9c5e4e){if(_0x9c5e4e[_0xf91c('0x51')]!==_0xf91c('0x47')&&_0x9c5e4e[_0xf91c('0x4f')]){_0x9c5e4e[_0xf91c('0x51')]='pause';return![];}return _[_0xf91c('0x50')]([_0x9c5e4e[_0xf91c('0x52')],_0x9c5e4e[_0xf91c('0x53')],_0x9c5e4e['mailStatus'],_0x9c5e4e[_0xf91c('0x54')],_0x9c5e4e[_0xf91c('0x55')],_0x9c5e4e['voiceStatus'],_0x9c5e4e[_0xf91c('0x56')]],isIdle);}function getAgentStatus(_0x3d387d){var _0x215c95=_0xf91c('0x48');if(isAgentPaused(_0x3d387d))_0x215c95=_0xf91c('0x57');else if(isAgentPaused(_0x3d387d,!![]))_0x215c95=_0xf91c('0x58');else if(isAgentIdle(_0x3d387d))_0x215c95=_0xf91c('0x47');else _0x215c95='busy';return _0x215c95;}function validateChannel(_0x5673aa){var _0x5364a8=[_0xf91c('0x59'),_0xf91c('0x5a'),'sms',_0xf91c('0x5b'),_0xf91c('0x5c'),_0xf91c('0x5d'),_0xf91c('0x21')];if(!_[_0xf91c('0x5e')](_0x5364a8,_0x5673aa['toLowerCase']()))throw new Error(_0xf91c('0x5f'));return _0x5673aa[_0xf91c('0x60')]();}function getFilteredAgentIds(_0x4cc162,_0x2db5af){var _0x5a9c60=_[_0xf91c('0x61')](_0x4cc162)?_0x4cc162:[_0x4cc162];var _0x144d3b=_[_0xf91c('0x32')](_0x5a9c60,function(_0x4e273e){return db[_0x2db5af][_0xf91c('0x62')]({'where':{'name':_0x4e273e}})[_0xf91c('0x11')](function(_0x1b86e5){if(!_0x1b86e5)return[];return _0x1b86e5[_0xf91c('0x63')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xf91c('0x64')](_0x144d3b)[_0xf91c('0x11')](function(_0x2adb7b){var _0x52fa8c=_(_0x2adb7b)[_0xf91c('0x65')]()[_0xf91c('0x32')]('id')[_0xf91c('0x66')]()[_0xf91c('0x67')]();return _0x52fa8c;});}function getUpdatedSortOptions(_0x5a1305){var _0x21c2f4={'fields':[],'order':null};var _0x44cabb=_0x5a1305[_0xf91c('0x68')](',');_0x21c2f4[_0xf91c('0x69')]=_['filter'](_0x44cabb,function(_0x45a8fb){if(!_0x45a8fb[_0xf91c('0x5e')](_0xf91c('0x6a')))return!![];_0x21c2f4[_0xf91c('0x6b')]=_[_0xf91c('0x6c')](_0x45a8fb,'-')?'DESC':_0xf91c('0x6d');return![];});return _0x21c2f4;}function orderAgentsByStatus(_0x2ae75d,_0x3d3d33){return _0x2ae75d[_0xf91c('0x6e')](function(_0x3bdf4a,_0x4642a3){if(_0x3bdf4a[_0xf91c('0x6a')]===_0x4642a3[_0xf91c('0x6a')]&&_0x3bdf4a['globalStatus']===_0xf91c('0x57')){if(_0x3d3d33===_0xf91c('0x6f'))return(_0x3bdf4a[_0xf91c('0x70')]||'')<(_0x4642a3[_0xf91c('0x70')]||'')?0x1:-0x1;return _0x3bdf4a['pauseType']<_0x4642a3[_0xf91c('0x70')]?-0x1:0x1;}else{if(_0x3d3d33===_0xf91c('0x6f'))return _0x3bdf4a[_0xf91c('0x6a')]<_0x4642a3[_0xf91c('0x6a')]?0x1:-0x1;return _0x3bdf4a[_0xf91c('0x6a')]<_0x4642a3[_0xf91c('0x6a')]?-0x1:0x1;}});}exports[_0xf91c('0x63')]=function(_0x5c7c1a,_0x120940){var _0x54d416={'count':0x0,'rows':[]},_0xcb9649={},_0x51c29e,_0x3ab8af,_0x17340c,_0x494b62,_0x49d21f=[_0xf91c('0x71'),_0xf91c('0x43'),_0xf91c('0x72'),_0xf91c('0x73'),_0xf91c('0x70'),_0xf91c('0x73'),_0xf91c('0x74'),_0xf91c('0x75'),'chatPause',_0xf91c('0x4d'),_0xf91c('0x76'),_0xf91c('0x4e'),_0xf91c('0x77'),'faxPause',_0xf91c('0x4f'),_0xf91c('0x78'),_0xf91c('0x79'),'mailCapacity',_0xf91c('0x7a'),'whatsappCapacity',_0xf91c('0x7b'),_0xf91c('0x7c'),_0xf91c('0x7d'),'mailCurrentCapacity',_0xf91c('0x7e'),_0xf91c('0x7f'),'faxCurrentCapacity',_0xf91c('0x52'),_0xf91c('0x54'),_0xf91c('0x80'),_0xf91c('0x55'),_0xf91c('0x56'),'faxStatus',_0xf91c('0x51'),_0xf91c('0x81'),'openchannelStatusTime',_0xf91c('0x82'),_0xf91c('0x83'),_0xf91c('0x84'),_0xf91c('0x85'),'voiceStatusTime',_0xf91c('0x3c'),_0xf91c('0x86'),_0xf91c('0x87'),_0xf91c('0x88'),_0xf91c('0x89'),_0xf91c('0x8a')],_0x349bd7=['chatPause','openchannelPause',_0xf91c('0x76'),_0xf91c('0x4e'),_0xf91c('0x77'),_0xf91c('0x4c'),_0xf91c('0x4f'),_0xf91c('0x43')];Promise[_0xf91c('0x8b')]()['then'](function(){if(_0x5c7c1a[_0xf91c('0x8c')][_0xf91c('0x8d')])_0x51c29e=validateChannel(_0x5c7c1a[_0xf91c('0x8c')]['channel']);if(!_0x5c7c1a[_0xf91c('0x8c')][_0xf91c('0x6e')]||!_0x5c7c1a['query'][_0xf91c('0x6e')][_0xf91c('0x5e')](_0xf91c('0x6a')))return;var _0x144e2b=getUpdatedSortOptions(_0x5c7c1a['query'][_0xf91c('0x6e')]);_0x5c7c1a[_0xf91c('0x8c')][_0xf91c('0x6e')]=_0x144e2b[_0xf91c('0x69')][_0xf91c('0x8e')](',');_0x3ab8af=_0x144e2b['order'];})['then'](function(){if(!_0x5c7c1a['query']['globalQueueFilter'])return[];var _0x49d3d2=_[_0xf91c('0x18')](_0x51c29e)+_0xf91c('0x44');return getFilteredAgentIds(_0x5c7c1a[_0xf91c('0x8c')]['globalQueueFilter'],_0x49d3d2);})[_0xf91c('0x11')](function(_0x4455b6){var _0x135805=_['map'](db[_0xf91c('0x8f')]['rawAttributes'],function(_0x544c2c){return{'name':_0x544c2c[_0xf91c('0x90')],'type':_0x544c2c[_0xf91c('0x91')][_0xf91c('0x92')]};});_0x5c7c1a[_0xf91c('0x8c')]['role']=_0xf91c('0x93');_0x5c7c1a[_0xf91c('0x8c')]['online']=!![];_0xcb9649=qs['getOptions'](_0x135805,_0x5c7c1a);_0xcb9649[_0xf91c('0x94')]=!![];if(!_[_0xf91c('0x95')](_0x4455b6)){_0xcb9649[_0xf91c('0x96')]=_['merge'](_0xcb9649[_0xf91c('0x96')],{'$and':[{'id':{'$in':_0x4455b6}}]});}else if(!_[_0xf91c('0x95')](_0x5c7c1a[_0xf91c('0x8c')][_0xf91c('0x97')])){return _0x54d416;}if(_0x5c7c1a[_0xf91c('0x98')][_0xf91c('0x99')]===_0xf91c('0x98')){var _0xed48f3={'params':{'id':_0x5c7c1a[_0xf91c('0x98')]['userProfileId']},'query':{'section':_0xf91c('0x13'),'role':'agent','online':!![],'nolimit':_0x5c7c1a[_0xf91c('0x8c')]['nolimit'],'sort':_0x5c7c1a[_0xf91c('0x8c')][_0xf91c('0x6e')],'filter':_0x5c7c1a['query']['filter'],'raw':!![],'ids':_0x4455b6}};return db[_0xf91c('0x9a')][_0xf91c('0x9b')](_0xed48f3);}return db[_0xf91c('0x8f')][_0xf91c('0x9c')](_0xcb9649);})[_0xf91c('0x11')](function(_0x35fc7a){_0x54d416['count']=_0x35fc7a[_0xf91c('0xa')];_0x17340c=_0x35fc7a['rows'];return getRealtimeAgents();})['then'](function(_0x143de2){_0x494b62=_0x143de2[_0xf91c('0x9d')];return _0x17340c[_0xf91c('0x32')](function(_0x485f48){var _0x17f6ad=_[_0xf91c('0x39')](_0x494b62,['id',_0x485f48['id']]);if(_0x17f6ad)_['merge'](_0x485f48,_[_0xf91c('0x3a')](_[_0xf91c('0x9e')](_0x17f6ad,_0x349bd7),_0x49d21f));_0x485f48[_0xf91c('0x6a')]=getAgentStatus(_0x485f48);return _0x485f48;});})[_0xf91c('0x11')](function(_0x1cfb26){var _0x101484;if(_0x5c7c1a[_0xf91c('0x8c')][_0xf91c('0x9f')]){_0x101484=_['filter'](_0x1cfb26,['globalStatus',_0x5c7c1a[_0xf91c('0x8c')][_0xf91c('0x9f')]]);if(_0x5c7c1a[_0xf91c('0x8c')][_0xf91c('0xa0')]){_0x101484=_[_0xf91c('0x3b')](_0x101484,[_0xf91c('0x70'),_0x5c7c1a[_0xf91c('0x8c')][_0xf91c('0xa0')]]);}}if(_0x101484)_0x1cfb26=_0x101484;if(!_0x3ab8af)return _0x1cfb26;return orderAgentsByStatus(_0x1cfb26,_0x3ab8af);})[_0xf91c('0x11')](function(_0x2fc3ac){_0x54d416['rows']=_0x2fc3ac;return _0x54d416;})[_0xf91c('0x11')](respondWithFilteredResult(_0x120940,_0xcb9649))[_0xf91c('0x17')](handleError(_0x120940,null));};exports[_0xf91c('0xa1')]=function(_0x4324fa,_0x29609b){var _0x1fc9b8={'count':0x0,'rows':[]},_0x5cebd5={},_0x274798,_0x54af7e,_0x3d0249,_0x31ced2,_0x4ebe70;Promise[_0xf91c('0x8b')]()['then'](function(){if(_0x4324fa[_0xf91c('0x8c')][_0xf91c('0x8d')])_0x274798=validateChannel(_0x4324fa['query']['channel']);var _0x22f81f=_[_0xf91c('0x18')](_0x274798)+'Queue';var _0x172fe7=_[_0xf91c('0x32')](db[_0x22f81f][_0xf91c('0xa2')],function(_0x5c5b95){return{'name':_0x5c5b95[_0xf91c('0x90')],'type':_0x5c5b95[_0xf91c('0x91')][_0xf91c('0x92')]};});_0x5cebd5=qs[_0xf91c('0xa3')](_0x172fe7,_0x4324fa);if(_0x4324fa[_0xf91c('0x98')]['role']===_0xf91c('0x98')){var _0x83886e={'params':{'id':_0x4324fa[_0xf91c('0x98')][_0xf91c('0xa4')]},'query':{'section':_0x274798===_0xf91c('0x21')&&_0x4324fa['query'][_0xf91c('0x91')]==='outbound'?_0xf91c('0xa5'):_[_0xf91c('0x18')](_0x274798)+_0xf91c('0x19'),'type':_0x4324fa[_0xf91c('0x8c')]['type'],'nolimit':!![],'sort':_0xf91c('0xe'),'filter':_0x4324fa['query'][_0xf91c('0x3b')]}};return db[_0xf91c('0x9a')][_0xf91c('0x9b')](_0x83886e);}return db[_0x22f81f][_0xf91c('0x9c')](_0x5cebd5);})[_0xf91c('0x11')](function(_0x438134){_0x1fc9b8[_0xf91c('0xa')]=_0x438134[_0xf91c('0xa')];_0x54af7e=_0x438134[_0xf91c('0x9d')];return getRealtimeQueues(_0x4324fa,_0x274798);})[_0xf91c('0x11')](function(_0x11e7c0){_0x31ced2=_0x11e7c0[_0xf91c('0x9d')];return getRealtimeAgents();})[_0xf91c('0x11')](function(_0x3b218e){_0x3d0249=_0x3b218e[_0xf91c('0x9d')];if(_0x274798!=_0xf91c('0x21'))return;return getRealtimeVoiceQueueChannels();})[_0xf91c('0x11')](function(_0x57bce6){_0x4ebe70=_0x57bce6?_0x57bce6[_0xf91c('0x9d')]:[];return initializeQueues(_0x54af7e,_0x31ced2,_0x274798,_0x4324fa[_0xf91c('0x8c')]['type']);})[_0xf91c('0x11')](function(_0x16d9b7){var _0x337978=_0x16d9b7[_0xf91c('0x32')](function(_0x3d1d48){if(_0x274798===_0xf91c('0x21'))return getVoiceQueueAgents(_0x3d1d48,_0x54af7e,_0x3d0249,_0x4ebe70);else return getQueueAgents(_0x3d1d48,_0x3d0249,_0x274798);});return Promise[_0xf91c('0x64')](_0x337978);})[_0xf91c('0x11')](function(_0x3a50df){_0x1fc9b8[_0xf91c('0x9d')]=_0x3a50df;return _0x1fc9b8;})[_0xf91c('0x11')](respondWithFilteredResult(_0x29609b,_0x5cebd5))['catch'](handleError(_0x29609b,null));};
\ No newline at end of file
index 9b54c1a..27f92f8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1109eb,_0x68f359){var _0x120d4e=function(_0x570cff){while(--_0x570cff){_0x1109eb['push'](_0x1109eb['shift']());}};_0x120d4e(++_0x68f359);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router;
\ No newline at end of file
+var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3705ed,_0x2e0b22){var _0x306f6d=function(_0x406ccb){while(--_0x406ccb){_0x3705ed['push'](_0x3705ed['shift']());}};_0x306f6d(++_0x2e0b22);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router;
\ No newline at end of file
index 87b80cf..7b61813 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x423b=['STRING','exports'];(function(_0x3cf2d6,_0x305557){var _0x454a9a=function(_0x232fc8){while(--_0x232fc8){_0x3cf2d6['push'](_0x3cf2d6['shift']());}};_0x454a9a(++_0x305557);}(_0x423b,0x12b));var _0xb423=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x423b[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require('sequelize');module[_0xb423('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb423('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xb423('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xb423('0x1')]},'campaigntype':{'type':Sequelize[_0xb423('0x1')]},'membername':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xc051=['STRING','sequelize','exports','DATE'];(function(_0x331a2c,_0xc59b3e){var _0x508e83=function(_0x5e8d02){while(--_0x5e8d02){_0x331a2c['push'](_0x331a2c['shift']());}};_0x508e83(++_0xc59b3e);}(_0xc051,0xb5));var _0x1c05=function(_0x1b8fcb,_0x595318){_0x1b8fcb=_0x1b8fcb-0x0;var _0x4b1a3f=_0xc051[_0x1b8fcb];return _0x4b1a3f;};'use strict';var Sequelize=require(_0x1c05('0x0'));module[_0x1c05('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1c05('0x2')]},'uniqueid':{'type':Sequelize[_0x1c05('0x3')]},'starttime':{'type':Sequelize[_0x1c05('0x2')]},'responsetime':{'type':Sequelize[_0x1c05('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1c05('0x3')]},'campaigntype':{'type':Sequelize[_0x1c05('0x3')]},'membername':{'type':Sequelize[_0x1c05('0x3')]}};
\ No newline at end of file
index 10dff3b..8b38121 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe64c=['request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','util','../../config/logger','moment','bluebird'];(function(_0x5ca13c,_0x4f4bf3){var _0x57024a=function(_0x28dafb){while(--_0x28dafb){_0x5ca13c['push'](_0x5ca13c['shift']());}};_0x57024a(++_0x4f4bf3);}(_0xe64c,0xa4));var _0xce64=function(_0x41f4fc,_0x4e12a7){_0x41f4fc=_0x41f4fc-0x0;var _0x525c0d=_0xe64c[_0x41f4fc];return _0x525c0d;};'use strict';var _=require('lodash');var util=require(_0xce64('0x0'));var logger=require(_0xce64('0x1'))('api');var moment=require(_0xce64('0x2'));var BPromise=require(_0xce64('0x3'));var rp=require(_0xce64('0x4'));var fs=require('fs');var path=require(_0xce64('0x5'));var rimraf=require(_0xce64('0x6'));var config=require(_0xce64('0x7'));var attributes=require(_0xce64('0x8'));module[_0xce64('0x9')]=function(_0x5a07fb,_0x3b6635){return _0x5a07fb[_0xce64('0xa')](_0xce64('0xb'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8037=['path','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','api','moment','bluebird','request-promise'];(function(_0xbaf7d7,_0x5ef011){var _0x5bb3d6=function(_0x2e32a2){while(--_0x2e32a2){_0xbaf7d7['push'](_0xbaf7d7['shift']());}};_0x5bb3d6(++_0x5ef011);}(_0x8037,0x16e));var _0x7803=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8037[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7803('0x0'));var moment=require(_0x7803('0x1'));var BPromise=require(_0x7803('0x2'));var rp=require(_0x7803('0x3'));var fs=require('fs');var path=require(_0x7803('0x4'));var rimraf=require('rimraf');var config=require(_0x7803('0x5'));var attributes=require(_0x7803('0x6'));module[_0x7803('0x7')]=function(_0x2740cc,_0x423fc4){return _0x2740cc[_0x7803('0x8')](_0x7803('0x9'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 437b225..ed87baf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb8ef=['message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x17aaa9,_0x5c8bf5){var _0x1e4fb5=function(_0x37abbb){while(--_0x37abbb){_0x17aaa9['push'](_0x17aaa9['shift']());}};_0x1e4fb5(++_0x5c8bf5);}(_0xb8ef,0x64));var _0xfb8e=function(_0xc9254b,_0x211fd3){_0xc9254b=_0xc9254b-0x0;var _0x415aca=_0xb8ef[_0xc9254b];return _0x415aca;};'use strict';var _=require(_0xfb8e('0x0'));var util=require('util');var moment=require(_0xfb8e('0x1'));var BPromise=require(_0xfb8e('0x2'));var rs=require(_0xfb8e('0x3'));var fs=require('fs');var Redis=require(_0xfb8e('0x4'));var db=require(_0xfb8e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb8e('0x6'))(_0xfb8e('0x7'));var config=require(_0xfb8e('0x8'));var jayson=require(_0xfb8e('0x9'));var client=jayson[_0xfb8e('0xa')][_0xfb8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14f886,_0x1d83a1,_0x4f7b86){return new BPromise(function(_0x1969d0,_0x2fa876){return client[_0xfb8e('0xc')](_0x14f886,_0x4f7b86)[_0xfb8e('0xd')](function(_0x202b76){logger['info'](_0xfb8e('0xe'),_0x1d83a1,_0xfb8e('0xf'));logger[_0xfb8e('0x10')](_0xfb8e('0x11'),_0x1d83a1,_0xfb8e('0xf'),JSON['stringify'](_0x202b76));if(_0x202b76[_0xfb8e('0x12')]){if(_0x202b76[_0xfb8e('0x12')][_0xfb8e('0x13')]===0x1f4){logger[_0xfb8e('0x12')](_0xfb8e('0xe'),_0x1d83a1,_0x202b76['error']['message']);return _0x2fa876(_0x202b76[_0xfb8e('0x12')][_0xfb8e('0x14')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x1d83a1,_0x202b76[_0xfb8e('0x12')]['message']);return _0x1969d0(_0x202b76['error']['message']);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x1d83a1,'request\x20sent');_0x1969d0(_0x202b76[_0xfb8e('0x15')][_0xfb8e('0x14')]);}})[_0xfb8e('0x16')](function(_0x2c9d74){logger[_0xfb8e('0x12')](_0xfb8e('0xe'),_0x1d83a1,_0x2c9d74);_0x2fa876(_0x2c9d74);});});}exports[_0xfb8e('0x17')]=function(_0xbbb7fd){var _0x447476=this;return new Promise(function(_0x143512,_0x583f09){return db[_0xfb8e('0x18')][_0xfb8e('0x19')](_0xbbb7fd[_0xfb8e('0x1a')],{'raw':_0xbbb7fd[_0xfb8e('0x1b')]?_0xbbb7fd['options'][_0xfb8e('0x1c')]===undefined?!![]:![]:!![]})[_0xfb8e('0xd')](function(_0x235199){logger['info'](_0xfb8e('0x17'),_0xbbb7fd);logger[_0xfb8e('0x10')](_0xfb8e('0x17'),_0xbbb7fd,JSON[_0xfb8e('0x1d')](_0x235199));_0x143512(_0x235199);})[_0xfb8e('0x16')](function(_0x296b18){logger[_0xfb8e('0x12')](_0xfb8e('0x17'),_0x296b18[_0xfb8e('0x14')],_0xbbb7fd);_0x583f09(_0x447476[_0xfb8e('0x12')](0x1f4,_0x296b18[_0xfb8e('0x14')]));});});};
\ No newline at end of file
+var _0xb8dc=['ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x488fb7,_0x87af1d){var _0x22c0fd=function(_0x310437){while(--_0x310437){_0x488fb7['push'](_0x488fb7['shift']());}};_0x22c0fd(++_0x87af1d);}(_0xb8dc,0x16b));var _0xcb8d=function(_0x289bd4,_0x58f33a){_0x289bd4=_0x289bd4-0x0;var _0x5e4230=_0xb8dc[_0x289bd4];return _0x5e4230;};'use strict';var _=require(_0xcb8d('0x0'));var util=require(_0xcb8d('0x1'));var moment=require('moment');var BPromise=require(_0xcb8d('0x2'));var rs=require(_0xcb8d('0x3'));var fs=require('fs');var Redis=require(_0xcb8d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb8d('0x5'));var logger=require(_0xcb8d('0x6'))(_0xcb8d('0x7'));var config=require(_0xcb8d('0x8'));var jayson=require(_0xcb8d('0x9'));var client=jayson[_0xcb8d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b3453,_0x1efcf8,_0x1f0907){return new BPromise(function(_0x1c29c8,_0x52a620){return client[_0xcb8d('0xb')](_0x4b3453,_0x1f0907)[_0xcb8d('0xc')](function(_0x1c75b0){logger[_0xcb8d('0xd')](_0xcb8d('0xe'),_0x1efcf8,_0xcb8d('0xf'));logger['debug'](_0xcb8d('0x10'),_0x1efcf8,_0xcb8d('0xf'),JSON[_0xcb8d('0x11')](_0x1c75b0));if(_0x1c75b0[_0xcb8d('0x12')]){if(_0x1c75b0['error'][_0xcb8d('0x13')]===0x1f4){logger[_0xcb8d('0x12')](_0xcb8d('0xe'),_0x1efcf8,_0x1c75b0['error'][_0xcb8d('0x14')]);return _0x52a620(_0x1c75b0[_0xcb8d('0x12')][_0xcb8d('0x14')]);}logger['error'](_0xcb8d('0xe'),_0x1efcf8,_0x1c75b0[_0xcb8d('0x12')][_0xcb8d('0x14')]);return _0x1c29c8(_0x1c75b0['error']['message']);}else{logger['info'](_0xcb8d('0xe'),_0x1efcf8,'request\x20sent');_0x1c29c8(_0x1c75b0[_0xcb8d('0x15')][_0xcb8d('0x14')]);}})['catch'](function(_0x398d4a){logger['error'](_0xcb8d('0xe'),_0x1efcf8,_0x398d4a);_0x52a620(_0x398d4a);});});}exports[_0xcb8d('0x16')]=function(_0x191054){var _0x2e6c7d=this;return new Promise(function(_0x4b1c8c,_0xbcc59a){return db[_0xcb8d('0x17')][_0xcb8d('0x18')](_0x191054[_0xcb8d('0x19')],{'raw':_0x191054[_0xcb8d('0x1a')]?_0x191054[_0xcb8d('0x1a')][_0xcb8d('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x12b2d1){logger[_0xcb8d('0xd')](_0xcb8d('0x16'),_0x191054);logger[_0xcb8d('0x1c')](_0xcb8d('0x16'),_0x191054,JSON[_0xcb8d('0x11')](_0x12b2d1));_0x4b1c8c(_0x12b2d1);})['catch'](function(_0x9275b0){logger[_0xcb8d('0x12')](_0xcb8d('0x16'),_0x9275b0[_0xcb8d('0x14')],_0x191054);_0xbcc59a(_0x2e6c7d[_0xcb8d('0x12')](0x1f4,_0x9275b0[_0xcb8d('0x14')]));});});};
\ No newline at end of file
index 6e69919..d21c0b0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd7a0=['whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/trunks','trunks','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/whatsapp/queues'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xd7a0,0x163));var _0x0d7a=function(_0x3da2ea,_0x3a7e71){_0x3da2ea=_0x3da2ea-0x0;var _0x4fa19b=_0xd7a0[_0x3da2ea];return _0x4fa19b;};'use strict';var multer=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var path=require('path');var express=require(_0x0d7a('0x2'));var router=express['Router']();var auth=require(_0x0d7a('0x3'));var controller=require(_0x0d7a('0x4'));router[_0x0d7a('0x5')](_0x0d7a('0x6'),auth[_0x0d7a('0x7')](),controller['voiceChannels']);router[_0x0d7a('0x5')](_0x0d7a('0x8'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x9')]);router[_0x0d7a('0x5')](_0x0d7a('0xa'),auth[_0x0d7a('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0x0d7a('0x5')](_0x0d7a('0xb'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0xc')]);router['get'](_0x0d7a('0xd'),auth[_0x0d7a('0x7')](),controller['chatQueues']);router[_0x0d7a('0x5')](_0x0d7a('0xe'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0xf')]);router[_0x0d7a('0x5')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x0d7a('0x10')]);router[_0x0d7a('0x5')](_0x0d7a('0x11'),auth['isAuthenticated'](),controller[_0x0d7a('0x12')]);router['get']('/sms/queues',auth[_0x0d7a('0x7')](),controller['smsQueues']);router[_0x0d7a('0x5')](_0x0d7a('0x13'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x14')]);router['get'](_0x0d7a('0x15'),auth[_0x0d7a('0x7')](),controller['faxQueues']);router[_0x0d7a('0x5')](_0x0d7a('0x16'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x17')]);router['get'](_0x0d7a('0x18'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router['get']('/voice/queues/channels/:uniqueid',auth[_0x0d7a('0x7')](),controller['voiceQueuesChannel']);router[_0x0d7a('0x5')](_0x0d7a('0x19'),auth['isAuthenticated'](),controller[_0x0d7a('0x1a')]);router[_0x0d7a('0x5')](_0x0d7a('0x1b'),auth[_0x0d7a('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x0d7a('0x5')](_0x0d7a('0x1c'),auth[_0x0d7a('0x7')](),controller['showVoiceQueues']);router['put'](_0x0d7a('0x1c'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x1d')]);router[_0x0d7a('0x5')](_0x0d7a('0x1e'),auth['isAuthenticated'](),controller[_0x0d7a('0x1f')]);router[_0x0d7a('0x5')](_0x0d7a('0x20'),auth[_0x0d7a('0x7')](),controller['outboundChannels']);router['get'](_0x0d7a('0x21'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x22')]);router[_0x0d7a('0x23')](_0x0d7a('0x24'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x25')]);router[_0x0d7a('0x5')]('/telephones',auth[_0x0d7a('0x7')](),controller['telephones']);router[_0x0d7a('0x5')](_0x0d7a('0x26'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x27')]);router[_0x0d7a('0x5')]('/campaigns',auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x28')]);router[_0x0d7a('0x5')]('/fax/accounts',auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x29')]);router['get'](_0x0d7a('0x2a'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x2b')]);router['get'](_0x0d7a('0x2c'),auth['isAuthenticated'](),controller[_0x0d7a('0x2d')]);router[_0x0d7a('0x5')]('/openchannel/queues/waitinginteractions',auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x2e')]);router[_0x0d7a('0x5')](_0x0d7a('0x2f'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x30')]);router[_0x0d7a('0x5')]('/sms/queues/waitinginteractions',auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x31')]);router['get'](_0x0d7a('0x32'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0x0d7a('0x5')](_0x0d7a('0x33'),auth[_0x0d7a('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0x0d7a('0x34')](_0x0d7a('0x35'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x36')](_0x0d7a('0x37')));router[_0x0d7a('0x5')](_0x0d7a('0x38'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x39')]);router[_0x0d7a('0x34')](_0x0d7a('0x3a'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x36')]('chat'));router['get'](_0x0d7a('0x3b'),auth[_0x0d7a('0x7')](),controller['showChatQueues']);router[_0x0d7a('0x34')](_0x0d7a('0x3c'),auth['isAuthenticated'](),controller[_0x0d7a('0x36')](_0x0d7a('0x3d')));router['get'](_0x0d7a('0x3e'),auth['isAuthenticated'](),controller[_0x0d7a('0x3f')]);router['post']('/openchannel/queues/:id/notify',auth[_0x0d7a('0x7')](),controller['queueNotify']('openchannel'));router[_0x0d7a('0x5')](_0x0d7a('0x40'),auth[_0x0d7a('0x7')](),controller['showOpenchannelQueues']);router[_0x0d7a('0x34')](_0x0d7a('0x41'),auth[_0x0d7a('0x7')](),controller['queueNotify'](_0x0d7a('0x42')));router[_0x0d7a('0x34')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x0d7a('0x36')](_0x0d7a('0x43')));router['get'](_0x0d7a('0x44'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x45')]);router[_0x0d7a('0x5')](_0x0d7a('0x46'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x47')]);router[_0x0d7a('0x34')](_0x0d7a('0x48'),auth[_0x0d7a('0x7')](),controller[_0x0d7a('0x49')]);module[_0x0d7a('0x4a')]=router;
\ No newline at end of file
+var _0x8220=['/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','queueNotify','chat','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','express','../../components/auth/service','get','/voice/channels','voiceChannels'];(function(_0x3eb221,_0x39f3ab){var _0x2bdf1e=function(_0x3308ce){while(--_0x3308ce){_0x3eb221['push'](_0x3eb221['shift']());}};_0x2bdf1e(++_0x39f3ab);}(_0x8220,0x93));var _0x0822=function(_0x437663,_0x4b1832){_0x437663=_0x437663-0x0;var _0x1f3d51=_0x8220[_0x437663];return _0x1f3d51;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0x0822('0x0'));var router=express['Router']();var auth=require(_0x0822('0x1'));var controller=require('./rpc.controller');router[_0x0822('0x2')](_0x0822('0x3'),auth['isAuthenticated'](),controller[_0x0822('0x4')]);router['get'](_0x0822('0x5'),auth['isAuthenticated'](),controller[_0x0822('0x6')]);router['get'](_0x0822('0x7'),auth[_0x0822('0x8')](),controller[_0x0822('0x9')]);router[_0x0822('0x2')](_0x0822('0xa'),auth[_0x0822('0x8')](),controller[_0x0822('0xb')]);router[_0x0822('0x2')](_0x0822('0xc'),auth[_0x0822('0x8')](),controller[_0x0822('0xd')]);router[_0x0822('0x2')]('/mail/queues',auth[_0x0822('0x8')](),controller[_0x0822('0xe')]);router[_0x0822('0x2')](_0x0822('0xf'),auth[_0x0822('0x8')](),controller[_0x0822('0x10')]);router[_0x0822('0x2')](_0x0822('0x11'),auth['isAuthenticated'](),controller[_0x0822('0x12')]);router['get'](_0x0822('0x13'),auth['isAuthenticated'](),controller['smsQueues']);router[_0x0822('0x2')](_0x0822('0x14'),auth[_0x0822('0x8')](),controller[_0x0822('0x15')]);router[_0x0822('0x2')]('/fax/queues',auth[_0x0822('0x8')](),controller[_0x0822('0x16')]);router['get'](_0x0822('0x17'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router['get'](_0x0822('0x18'),auth[_0x0822('0x8')](),controller[_0x0822('0x19')]);router[_0x0822('0x2')](_0x0822('0x1a'),auth['isAuthenticated'](),controller[_0x0822('0x1b')]);router[_0x0822('0x2')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x0822('0x1c')]);router[_0x0822('0x2')](_0x0822('0x1d'),auth[_0x0822('0x8')](),controller[_0x0822('0x1e')]);router[_0x0822('0x2')](_0x0822('0x1f'),auth[_0x0822('0x8')](),controller[_0x0822('0x20')]);router[_0x0822('0x21')]('/voice/queues/:id',auth[_0x0822('0x8')](),controller[_0x0822('0x22')]);router['get'](_0x0822('0x23'),auth[_0x0822('0x8')](),controller[_0x0822('0x24')]);router['get'](_0x0822('0x25'),auth['isAuthenticated'](),controller['outboundChannels']);router['get'](_0x0822('0x26'),auth[_0x0822('0x8')](),controller[_0x0822('0x27')]);router['put'](_0x0822('0x28'),auth['isAuthenticated'](),controller[_0x0822('0x29')]);router[_0x0822('0x2')]('/telephones',auth['isAuthenticated'](),controller[_0x0822('0x2a')]);router['get'](_0x0822('0x2b'),auth['isAuthenticated'](),controller[_0x0822('0x2c')]);router['get'](_0x0822('0x2d'),auth['isAuthenticated'](),controller['campaigns']);router['get'](_0x0822('0x2e'),auth[_0x0822('0x8')](),controller['faxAccounts']);router[_0x0822('0x2')](_0x0822('0x2f'),auth[_0x0822('0x8')](),controller[_0x0822('0x30')]);router[_0x0822('0x2')](_0x0822('0x31'),auth['isAuthenticated'](),controller[_0x0822('0x32')]);router['get']('/openchannel/queues/waitinginteractions',auth[_0x0822('0x8')](),controller[_0x0822('0x33')]);router[_0x0822('0x2')](_0x0822('0x34'),auth[_0x0822('0x8')](),controller[_0x0822('0x35')]);router['get']('/sms/queues/waitinginteractions',auth[_0x0822('0x8')](),controller[_0x0822('0x36')]);router[_0x0822('0x2')](_0x0822('0x37'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0x0822('0x2')](_0x0822('0x38'),auth['isAuthenticated'](),controller[_0x0822('0x39')]);router[_0x0822('0x3a')](_0x0822('0x3b'),auth[_0x0822('0x8')](),controller['queueNotify'](_0x0822('0x3c')));router[_0x0822('0x2')](_0x0822('0x3d'),auth[_0x0822('0x8')](),controller[_0x0822('0x3e')]);router[_0x0822('0x3a')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x0822('0x3f')](_0x0822('0x40')));router[_0x0822('0x2')]('/chat/queues/:id',auth['isAuthenticated'](),controller['showChatQueues']);router[_0x0822('0x3a')]('/fax/queues/:id/notify',auth[_0x0822('0x8')](),controller[_0x0822('0x3f')]('fax'));router[_0x0822('0x2')](_0x0822('0x41'),auth['isAuthenticated'](),controller[_0x0822('0x42')]);router[_0x0822('0x3a')](_0x0822('0x43'),auth[_0x0822('0x8')](),controller['queueNotify']('openchannel'));router[_0x0822('0x2')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0x0822('0x44')]);router['post'](_0x0822('0x45'),auth[_0x0822('0x8')](),controller[_0x0822('0x3f')](_0x0822('0x46')));router['post']('/whatsapp/queues/:id/notify',auth[_0x0822('0x8')](),controller['queueNotify']('whatsapp'));router[_0x0822('0x2')](_0x0822('0x47'),auth[_0x0822('0x8')](),controller[_0x0822('0x48')]);router[_0x0822('0x2')](_0x0822('0x49'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router['post'](_0x0822('0x4a'),auth[_0x0822('0x8')](),controller[_0x0822('0x4b')]);module['exports']=router;
\ No newline at end of file
index c5a5f1f..5927c41 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8958=['faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','TransferReport','create','agentNotify','channel','Agent\x20not\x20found','Message','Start','agentTransferTimeout','*,*,*,*','moment','api','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','interaction','MemberReport','findAll','user','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions'];(function(_0x20d1f1,_0xd21ec8){var _0x5bc8b8=function(_0x2ef7d1){while(--_0x2ef7d1){_0x20d1f1['push'](_0x20d1f1['shift']());}};_0x5bc8b8(++_0xd21ec8);}(_0x8958,0x93));var _0x8895=function(_0x15edd6,_0x5834bc){_0x15edd6=_0x15edd6-0x0;var _0x50a0f2=_0x8958[_0x15edd6];return _0x50a0f2;};'use strict';var BPromise=require('bluebird');var moment=require(_0x8895('0x0'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x8895('0x1'));var jayson=require('jayson/promise');var amiClient=jayson[_0x8895('0x2')][_0x8895('0x3')]({'port':0x232a});var mailClient=jayson[_0x8895('0x2')]['http']({'port':0x232b});var routingClient=jayson[_0x8895('0x2')][_0x8895('0x3')]({'port':0x232c});function respondWithRpcPromise(_0x124e1e,_0x40cec6,_0x33013a){return new BPromise(function(_0x51376b,_0xe018b8){var _0xc2be9f=_0x33013a?_0x33013a:amiClient;return _0xc2be9f[_0x8895('0x4')](_0x124e1e,_0x40cec6)[_0x8895('0x5')](function(_0x6eab1e){if(_0x6eab1e[_0x8895('0x6')]){if(_0x6eab1e[_0x8895('0x6')][_0x8895('0x7')]===0x1f4){return _0xe018b8(_0x6eab1e[_0x8895('0x6')][_0x8895('0x8')]);}return _0x51376b(_0x6eab1e['error'][_0x8895('0x8')]);}else{_0x51376b(_0x6eab1e[_0x8895('0x9')]);}})[_0x8895('0xa')](function(_0x301bec){_0xe018b8(_0x301bec);});});}function respondWithResult(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xc8;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0xb')](_0xaf93bc)[_0x8895('0xc')](_0x5af0ef);}return _0x446e1a[_0x8895('0xd')](0x194);};}function handleError(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0x1f4;return function(_0x9191b8){logger['error'](_0x9191b8[_0x8895('0xe')]);if(_0x9191b8[_0x8895('0xf')]){delete _0x9191b8[_0x8895('0xf')];}_0x57d40a[_0x8895('0xb')](_0x47b9fe)[_0x8895('0x10')](_0x9191b8);};}function findById(_0x5b4c2e){return function(_0x4128e2){if(!_[_0x8895('0x11')](_0x5b4c2e)&&!_[_0x8895('0x11')](_0x4128e2)&&!_[_0x8895('0x11')](_0x4128e2[_0x8895('0x12')])){return _[_0x8895('0x13')](_0x4128e2[_0x8895('0x12')],function(_0x26cee0){return _0x26cee0['id']==_0x5b4c2e;});}return null;};}exports[_0x8895('0x14')]=function(_0x2da618,_0x24fef0){return respondWithRpcPromise(_0x8895('0x15'),_0x2da618[_0x8895('0x16')])['then'](respondWithResult(_0x24fef0,null))['catch'](handleError(_0x24fef0,null));};exports['voiceChannelMixMonitor']=function(_0x3daf43,_0x456282){return respondWithRpcPromise(_0x8895('0x17'),_[_0x8895('0x18')](_0x3daf43[_0x8895('0x16')],_0x3daf43[_0x8895('0x19')]))[_0x8895('0x5')](respondWithResult(_0x456282,null))[_0x8895('0xa')](handleError(_0x456282,null));};exports['voiceChannelStopMixMonitor']=function(_0x1a4c5b,_0x5db3a0){return respondWithRpcPromise(_0x8895('0x1a'),_[_0x8895('0x18')](_0x1a4c5b[_0x8895('0x16')],_0x1a4c5b['params']))['then'](respondWithResult(_0x5db3a0,null))[_0x8895('0xa')](handleError(_0x5db3a0,null));};exports[_0x8895('0x1b')]=function(_0x38f7ad,_0x24a376){return respondWithRpcPromise('VoiceQueues',_0x38f7ad[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x24a376,null))[_0x8895('0xa')](handleError(_0x24a376,null));};exports['showVoiceQueues']=function(_0x4aee03,_0x78b57){return respondWithRpcPromise('VoiceQueues',_0x4aee03[_0x8895('0x16')])[_0x8895('0x5')](findById(_0x4aee03[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x78b57,null))[_0x8895('0xa')](handleError(_0x78b57,null));};exports['updateVoiceQueue']=function(_0x4d567a,_0x6e449d){return respondWithRpcPromise(_0x8895('0x1c'),_[_0x8895('0x18')](_0x4d567a[_0x8895('0x1d')],_0x4d567a[_0x8895('0x19')]))['then'](respondWithResult(_0x6e449d,null))['catch'](handleError(_0x6e449d,null));};exports[_0x8895('0x1e')]=function(_0x848a11,_0x1c16f6){return respondWithRpcPromise(_0x8895('0x1f'),_[_0x8895('0x18')](_0x848a11['query'],_0x848a11[_0x8895('0x19')]))['then'](respondWithResult(_0x1c16f6,null))[_0x8895('0xa')](handleError(_0x1c16f6,null));};exports['voiceQueuesChannels']=function(_0x40ba14,_0x1a3fe5){return respondWithRpcPromise(_0x8895('0x20'),_0x40ba14[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x1a3fe5,null))['catch'](handleError(_0x1a3fe5,null));};exports[_0x8895('0x21')]=function(_0xcba076,_0x1b5359){return respondWithRpcPromise(_0x8895('0x22'),_[_0x8895('0x18')](_0xcba076['query'],_0xcba076[_0x8895('0x19')]))['then'](respondWithResult(_0x1b5359,null))[_0x8895('0xa')](handleError(_0x1b5359,null));};exports['voiceQueuesChannelHangup']=function(_0x21c22b,_0x15a865){return respondWithRpcPromise(_0x8895('0x23'),_[_0x8895('0x18')](_0x21c22b[_0x8895('0x16')],_0x21c22b['params']))[_0x8895('0x5')](respondWithResult(_0x15a865,null))['catch'](handleError(_0x15a865,null));};exports[_0x8895('0x24')]=function(_0xcc735f,_0x36e13b){return respondWithRpcPromise(_0x8895('0x25'),_[_0x8895('0x18')](_0xcc735f[_0x8895('0x16')],_0xcc735f['params']))[_0x8895('0x5')](respondWithResult(_0x36e13b,null))[_0x8895('0xa')](handleError(_0x36e13b,null));};exports['outbound']=function(_0x2557fc,_0x54ca09){return respondWithRpcPromise(_0x8895('0x26'),_0x2557fc[_0x8895('0x16')])['then'](respondWithResult(_0x54ca09,null))[_0x8895('0xa')](handleError(_0x54ca09,null));};exports[_0x8895('0x27')]=function(_0x5b7204,_0x58751a){return respondWithRpcPromise(_0x8895('0x28'),_0x5b7204[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x58751a,null))[_0x8895('0xa')](handleError(_0x58751a,null));};exports[_0x8895('0x29')]=function(_0x4917d1,_0x42ed1f){var _0x25c854;return respondWithRpcPromise(_0x8895('0x2a'),_0x4917d1[_0x8895('0x16')])[_0x8895('0x5')](function(_0x534876){_0x25c854=_0x534876;return respondWithRpcPromise('Agents',_0x4917d1[_0x8895('0x16')],routingClient);})['then'](function(_0x20a521){return _[_0x8895('0x18')]({},_0x20a521,_0x25c854);})['then'](respondWithResult(_0x42ed1f,null))[_0x8895('0xa')](handleError(_0x42ed1f,null));};exports['agentCapacity']=function(_0x1e6395,_0x5e6413){if(_0x1e6395['body']&&_0x1e6395['body']['interaction']&&_0x1e6395['user']&&_0x1e6395['user'][_0x8895('0xf')]){for(var _0x206f57 in _0x1e6395['body']['interaction']){if(_0x1e6395[_0x8895('0x1d')][_0x8895('0x2b')]['hasOwnProperty'](_0x206f57)){db[_0x8895('0x2c')][_0x8895('0x2d')]({'where':{'channel':_0x206f57,'membername':_0x1e6395[_0x8895('0x2e')][_0x8895('0xf')],'type':_0x8895('0x2f'),'exitAt':null,'uniqueid':_0x1e6395['body']['interaction'][_0x206f57]&&_0x1e6395['body'][_0x8895('0x2b')][_0x206f57]['length']?{'$notIn':_0x1e6395[_0x8895('0x1d')][_0x8895('0x2b')][_0x206f57]}:{'$ne':null}}})[_0x8895('0x5')](function(_0x28aaa9){var _0x587ccb=moment()[_0x8895('0x30')](_0x8895('0x31'));for(var _0x3413cd=0x0,_0x167302=_0x28aaa9[_0x8895('0x32')];_0x3413cd<_0x167302;_0x3413cd+=0x1){_0x28aaa9[_0x3413cd][_0x8895('0x33')]({'exitAt':_0x587ccb});}});for(var _0x14295a=0x0;_0x14295a<_0x1e6395[_0x8895('0x1d')]['interaction'][_0x206f57][_0x8895('0x32')];_0x14295a+=0x1){db[_0x8895('0x2c')]['findOrCreate']({'where':{'channel':_0x206f57,'membername':_0x1e6395[_0x8895('0x2e')]['name'],'type':'INTERACTION','uniqueid':_0x1e6395[_0x8895('0x1d')][_0x8895('0x2b')][_0x206f57][_0x14295a],'exitAt':null},'defaults':{'channel':_0x206f57,'membername':_0x1e6395[_0x8895('0x2e')]['name'],'interface':_[_0x8895('0x11')](_0x1e6395['user'][_0x8895('0x34')])?util[_0x8895('0x30')](_0x8895('0x35'),_0x1e6395[_0x8895('0x2e')][_0x8895('0xf')]):_0x1e6395[_0x8895('0x2e')][_0x8895('0x34')],'type':'INTERACTION','enterAt':moment()['format'](_0x8895('0x31')),'role':_0x8895('0x36'),'internal':_0x1e6395['user'][_0x8895('0x37')],'uniqueid':_0x1e6395['body']['interaction'][_0x206f57][_0x14295a]}});}}}}return respondWithRpcPromise(_0x8895('0x38'),{'id':_0x1e6395['params']['id'],'capacity':_0x1e6395[_0x8895('0x1d')][_0x8895('0x39')]},routingClient)[_0x8895('0x5')](respondWithResult(_0x5e6413,null))[_0x8895('0xa')](handleError(_0x5e6413,null));};exports[_0x8895('0x3a')]=function(_0x39a1d9,_0x306481){return respondWithRpcPromise(_0x8895('0x3b'),_0x39a1d9['query'])[_0x8895('0x5')](respondWithResult(_0x306481,null))[_0x8895('0xa')](handleError(_0x306481,null));};exports[_0x8895('0x3c')]=function(_0x5a5bc6,_0x1935aa){return respondWithRpcPromise(_0x8895('0x3d'),_0x5a5bc6[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x1935aa,null))[_0x8895('0xa')](handleError(_0x1935aa,null));};exports[_0x8895('0x3e')]=function(_0x434ab8,_0x216e6e){return respondWithRpcPromise(_0x8895('0x3f'),_0x434ab8[_0x8895('0x16')])['then'](respondWithResult(_0x216e6e,null))[_0x8895('0xa')](handleError(_0x216e6e,null));};exports[_0x8895('0x40')]=function(_0xb3d1ab,_0x10560a){return respondWithRpcPromise(_0x8895('0x41'),_0xb3d1ab['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x10560a,null))[_0x8895('0xa')](handleError(_0x10560a,null));};exports[_0x8895('0x42')]=function(_0x3d17bd,_0x37a7b4){return respondWithRpcPromise('ChatQueues',_0x3d17bd[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x3d17bd[_0x8895('0x19')]['id']))['then'](respondWithResult(_0x37a7b4,null))[_0x8895('0xa')](handleError(_0x37a7b4,null));};exports[_0x8895('0x43')]=function(_0x2c777b,_0x4ec8eb){return respondWithRpcPromise(_0x8895('0x44'),_0x2c777b[_0x8895('0x16')],routingClient)['then'](respondWithResult(_0x4ec8eb,null))[_0x8895('0xa')](handleError(_0x4ec8eb,null));};exports[_0x8895('0x45')]=function(_0x5198f8,_0x2f990a){return respondWithRpcPromise(_0x8895('0x44'),_0x5198f8[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x5198f8['params']['id']))['then'](respondWithResult(_0x2f990a,null))[_0x8895('0xa')](handleError(_0x2f990a,null));};exports[_0x8895('0x46')]=function(_0x49877,_0x51eb9c){return respondWithRpcPromise(_0x8895('0x47'),_0x49877[_0x8895('0x16')],mailClient)['then'](respondWithResult(_0x51eb9c,null))[_0x8895('0xa')](handleError(_0x51eb9c,null));};exports['openchannelQueues']=function(_0x435e36,_0x2bd955){return respondWithRpcPromise(_0x8895('0x48'),_0x435e36[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x2bd955,null))['catch'](handleError(_0x2bd955,null));};exports['showOpenchannelQueues']=function(_0x239401,_0x216abb){return respondWithRpcPromise('OpenchannelQueues',_0x239401[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x239401[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x216abb,null))['catch'](handleError(_0x216abb,null));};exports[_0x8895('0x49')]=function(_0x2d2bf9,_0x1b1bc0){return respondWithRpcPromise(_0x8895('0x4a'),_0x2d2bf9[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x1b1bc0,null))[_0x8895('0xa')](handleError(_0x1b1bc0,null));};exports[_0x8895('0x4b')]=function(_0x2bffd7,_0x21c7bb){return respondWithRpcPromise(_0x8895('0x4a'),_0x2bffd7[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x2bffd7[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x21c7bb,null))['catch'](handleError(_0x21c7bb,null));};exports['whatsappQueues']=function(_0x5b96fe,_0x13b143){return respondWithRpcPromise(_0x8895('0x4c'),_0x5b96fe[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x13b143,null))[_0x8895('0xa')](handleError(_0x13b143,null));};exports['showWhatsappQueues']=function(_0x816803,_0xc6af80){return respondWithRpcPromise('WhatsappQueues',_0x816803[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x816803[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0xc6af80,null))[_0x8895('0xa')](handleError(_0xc6af80,null));};exports['faxQueues']=function(_0x6440ea,_0x3c318c){return respondWithRpcPromise(_0x8895('0x4d'),_0x6440ea[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x3c318c,null))[_0x8895('0xa')](handleError(_0x3c318c,null));};exports[_0x8895('0x4e')]=function(_0x5e7048,_0x10d395){return respondWithRpcPromise(_0x8895('0x4d'),_0x5e7048['query'],routingClient)[_0x8895('0x5')](findById(_0x5e7048[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x10d395,null))[_0x8895('0xa')](handleError(_0x10d395,null));};exports[_0x8895('0x4f')]=function(_0x560381,_0x16cd17){return respondWithRpcPromise('FaxAccounts',_0x560381[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x16cd17,null))['catch'](handleError(_0x16cd17,null));};exports[_0x8895('0x50')]=function(_0x24f1c5,_0x140b2a){return respondWithRpcPromise(_0x8895('0x51'),_0x24f1c5['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x140b2a,null))['catch'](handleError(_0x140b2a,null));};exports['mailQueuesWaitingInteractions']=function(_0x1a198d,_0x185351){return respondWithRpcPromise(_0x8895('0x52'),_0x1a198d['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x185351,null))['catch'](handleError(_0x185351,null));};exports[_0x8895('0x53')]=function(_0x930a13,_0x3893fb){return respondWithRpcPromise(_0x8895('0x54'),_0x930a13[_0x8895('0x16')],routingClient)['then'](respondWithResult(_0x3893fb,null))['catch'](handleError(_0x3893fb,null));};exports[_0x8895('0x55')]=function(_0x5517a2,_0x3707a6){return respondWithRpcPromise(_0x8895('0x54'),_0x5517a2['query'],routingClient)[_0x8895('0x5')](function(_0xd9637a){if(_0x5517a2[_0x8895('0x16')][_0x8895('0x56')]!==undefined){var _0x166e9a=_(_0xd9637a['rows'])[_0x8895('0x57')]([_0x5517a2['query']['type'],_0x5517a2[_0x8895('0x19')]['id']])['map'](_0x8895('0x58'))[_0x8895('0x59')]()[_0x8895('0x5a')]();return _0xd9637a[_0x8895('0x12')]['filter'](function(_0x4d802e){return _0x166e9a['indexOf'](_0x4d802e[_0x8895('0x58')])>-0x1;});}else{return _0xd9637a[_0x8895('0x12')][_0x8895('0x57')](function(_0x14fd1f){return _0x14fd1f[_0x8895('0x58')]===parseInt(_0x5517a2[_0x8895('0x19')]['id']);});}})['then'](respondWithResult(_0x3707a6,null))[_0x8895('0xa')](handleError(_0x3707a6,null));};exports[_0x8895('0x5b')]=function(_0x4deccc,_0x584a1f){return respondWithRpcPromise(_0x8895('0x5c'),_0x4deccc['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x584a1f,null))['catch'](handleError(_0x584a1f,null));};exports[_0x8895('0x5d')]=function(_0x452756,_0x553437){return respondWithRpcPromise(_0x8895('0x5e'),_0x452756[_0x8895('0x16')],routingClient)['then'](respondWithResult(_0x553437,null))[_0x8895('0xa')](handleError(_0x553437,null));};exports[_0x8895('0x5f')]=function(_0x2af98f,_0xef59db){return respondWithRpcPromise(_0x8895('0x60'),_0x2af98f[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0xef59db,null))['catch'](handleError(_0xef59db,null));};exports[_0x8895('0x61')]=function(_0x5ada19){return function(_0x330506,_0x1f583a){var _0x32d52c,_0x325597;var _0x4e6691=_[_0x8895('0x62')](_0x5ada19);var _0x1d50f6=_0x5ada19===_0x8895('0x63')?_0x8895('0x64'):_0x8895('0x65');return db[_0x4e6691+_0x8895('0x66')][_0x8895('0x67')]({'raw':!![],'where':{'id':_0x330506[_0x8895('0x19')]['id']}})['then'](function(_0x3b4092){if(_[_0x8895('0x11')](_0x3b4092)){throw new Error(_0x4e6691+'\x20Queue\x20not\x20found');}_0x32d52c=_0x3b4092;return db[_0x4e6691+'Message'][_0x8895('0x67')]({'where':{'id':_0x330506[_0x8895('0x1d')][_0x8895('0x68')]},'include':[{'model':db[_0x4e6691+_0x8895('0x69')],'as':'Interaction'},{'model':db[_0x4e6691+_0x1d50f6],'as':'Account'}]});})[_0x8895('0x5')](function(_0x42ebe2){if(_[_0x8895('0x11')](_0x42ebe2)){throw new Error(_0x4e6691+_0x8895('0x6a'));}_0x325597=_0x42ebe2;return _0x42ebe2[_0x8895('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2cd8b0={'uniqueid':_0x5ada19+'.'+_0x325597['id']+'.'+_0x325597[_0x8895('0x69')]['id'],'FromUserId':_0x330506['user']['id'],'type':_0x8895('0x6c')};_0x2cd8b0[_0x4e6691+_0x8895('0x6d')]=_0x325597['id'];_0x2cd8b0[_0x4e6691+_0x8895('0x6e')]=_0x325597[_0x8895('0x69')]['id'];_0x2cd8b0[_0x8895('0x6f')+_0x4e6691+_0x1d50f6+'Id']=_0x325597[_0x8895('0x65')]['id'];_0x2cd8b0['To'+_0x4e6691+'QueueId']=_0x32d52c['id'];return db[_0x4e6691+_0x8895('0x70')][_0x8895('0x71')](_0x2cd8b0);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x5ada19,'interaction':_0x325597['Interaction'],'message':_0x325597,'account':_0x325597[_0x8895('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8895('0x6c'),'appdata':_0x32d52c['name']+','+(_0x325597[_0x8895('0x65')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x1f583a,null))[_0x8895('0xa')](handleError(_0x1f583a,null));};};exports[_0x8895('0x72')]=function(_0x28d7ab,_0x20b607){var _0x605f47,_0x54cf18;if(_[_0x8895('0x11')](_0x28d7ab[_0x8895('0x1d')][_0x8895('0x73')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x4a4d4b=_0x28d7ab['body'][_0x8895('0x73')];var _0x1d796a=_[_0x8895('0x62')](_0x4a4d4b);var _0x2084b1=_0x4a4d4b===_0x8895('0x63')?_0x8895('0x64'):_0x8895('0x65');return db['User'][_0x8895('0x67')]({'raw':!![],'where':{'id':_0x28d7ab['params']['id'],'role':_0x8895('0x36')}})['then'](function(_0x2f2908){if(_[_0x8895('0x11')](_0x2f2908)){throw new Error(_0x8895('0x74'));}_0x605f47=_0x2f2908;return db[_0x1d796a+_0x8895('0x75')][_0x8895('0x67')]({'where':{'id':_0x28d7ab[_0x8895('0x1d')][_0x8895('0x68')]},'include':[{'model':db[_0x1d796a+'Interaction'],'as':_0x8895('0x69')},{'model':db[_0x1d796a+_0x2084b1],'as':_0x8895('0x65')}]});})[_0x8895('0x5')](function(_0x3ce240){if(_[_0x8895('0x11')](_0x3ce240)){throw new Error(_0x1d796a+'\x20Message\x20not\x20found');}_0x54cf18=_0x3ce240;return _0x3ce240[_0x8895('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x20f574={'uniqueid':_0x4a4d4b+'.'+_0x54cf18['id']+'.'+_0x54cf18[_0x8895('0x69')]['id'],'FromUserId':_0x28d7ab[_0x8895('0x2e')]['id'],'type':_0x8895('0x6c'),'ToUserId':_0x605f47['id']};_0x20f574[_0x1d796a+_0x8895('0x6d')]=_0x54cf18['id'];_0x20f574[_0x1d796a+_0x8895('0x6e')]=_0x54cf18[_0x8895('0x69')]['id'];_0x20f574[_0x8895('0x6f')+_0x1d796a+_0x2084b1+'Id']=_0x54cf18[_0x8895('0x65')]['id'];return db[_0x1d796a+'TransferReport'][_0x8895('0x71')](_0x20f574);})['then'](function(){return respondWithRpcPromise(_0x8895('0x76'),{'channel':_0x4a4d4b,'interaction':_0x54cf18[_0x8895('0x69')],'message':_0x54cf18,'account':_0x54cf18[_0x8895('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x605f47[_0x8895('0xf')]+','+(_0x54cf18['Account'][_0x8895('0x77')]||0x12c),'interval':_0x8895('0x78')}]},routingClient);})[_0x8895('0x5')](respondWithResult(_0x20b607,null))[_0x8895('0xa')](handleError(_0x20b607,null));};
\ No newline at end of file
+var _0xe14b=['MessageId','InteractionId','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','chat','Website','User','agent','Agent\x20not\x20found','Message','update','From','bluebird','moment','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','message','result','catch','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','interface','internal','AgentCapacity','capacity','telephones','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found'];(function(_0x26d3ff,_0x3e9432){var _0x371ea1=function(_0x532653){while(--_0x532653){_0x26d3ff['push'](_0x26d3ff['shift']());}};_0x371ea1(++_0x3e9432);}(_0xe14b,0x93));var _0xbe14=function(_0x1c515d,_0x14c895){_0x1c515d=_0x1c515d-0x0;var _0x4fa567=_0xe14b[_0x1c515d];return _0x4fa567;};'use strict';var BPromise=require(_0xbe14('0x0'));var moment=require(_0xbe14('0x1'));var _=require('lodash');var util=require('util');var db=require(_0xbe14('0x2'))['db'];var logger=require(_0xbe14('0x3'))('api');var jayson=require(_0xbe14('0x4'));var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0xbe14('0x5')][_0xbe14('0x6')]({'port':0x232b});var routingClient=jayson[_0xbe14('0x5')][_0xbe14('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){var _0x496063=_0x196fca?_0x196fca:amiClient;return _0x496063[_0xbe14('0x7')](_0x1d9ade,_0x39387e)[_0xbe14('0x8')](function(_0xd68cd7){if(_0xd68cd7[_0xbe14('0x9')]){if(_0xd68cd7['error']['code']===0x1f4){return _0x50f909(_0xd68cd7[_0xbe14('0x9')][_0xbe14('0xa')]);}return _0x566ae7(_0xd68cd7['error'][_0xbe14('0xa')]);}else{_0x566ae7(_0xd68cd7[_0xbe14('0xb')]);}})[_0xbe14('0xc')](function(_0x3d38c2){_0x50f909(_0x3d38c2);});});}function respondWithResult(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xc8;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0xd')](_0x3b898d)[_0xbe14('0xe')](_0x23a730);}return _0x27792f[_0xbe14('0xf')](0x194);};}function handleError(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0x1f4;return function(_0x813399){logger['error'](_0x813399['stack']);if(_0x813399[_0xbe14('0x10')]){delete _0x813399[_0xbe14('0x10')];}_0x1e4826[_0xbe14('0xd')](_0x33fd54)[_0xbe14('0x11')](_0x813399);};}function findById(_0x4e8f34){return function(_0x21c789){if(!_[_0xbe14('0x12')](_0x4e8f34)&&!_[_0xbe14('0x12')](_0x21c789)&&!_[_0xbe14('0x12')](_0x21c789[_0xbe14('0x13')])){return _[_0xbe14('0x14')](_0x21c789[_0xbe14('0x13')],function(_0x5ea1f8){return _0x5ea1f8['id']==_0x4e8f34;});}return null;};}exports[_0xbe14('0x15')]=function(_0x456ca8,_0x329588){return respondWithRpcPromise(_0xbe14('0x16'),_0x456ca8[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x329588,null))['catch'](handleError(_0x329588,null));};exports[_0xbe14('0x18')]=function(_0x4a1bbd,_0x417c8d){return respondWithRpcPromise(_0xbe14('0x19'),_[_0xbe14('0x1a')](_0x4a1bbd['query'],_0x4a1bbd[_0xbe14('0x1b')]))['then'](respondWithResult(_0x417c8d,null))[_0xbe14('0xc')](handleError(_0x417c8d,null));};exports['voiceChannelStopMixMonitor']=function(_0x32e8eb,_0x4a25fa){return respondWithRpcPromise(_0xbe14('0x1c'),_[_0xbe14('0x1a')](_0x32e8eb['query'],_0x32e8eb[_0xbe14('0x1b')]))['then'](respondWithResult(_0x4a25fa,null))[_0xbe14('0xc')](handleError(_0x4a25fa,null));};exports['voiceQueues']=function(_0x36a21e,_0x5fa043){return respondWithRpcPromise(_0xbe14('0x1d'),_0x36a21e[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x5fa043,null))[_0xbe14('0xc')](handleError(_0x5fa043,null));};exports['showVoiceQueues']=function(_0x1822e0,_0x1ba46a){return respondWithRpcPromise(_0xbe14('0x1d'),_0x1822e0[_0xbe14('0x17')])['then'](findById(_0x1822e0[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x1ba46a,null))['catch'](handleError(_0x1ba46a,null));};exports[_0xbe14('0x1e')]=function(_0x3b3e84,_0x1c7cc7){return respondWithRpcPromise(_0xbe14('0x1f'),_[_0xbe14('0x1a')](_0x3b3e84[_0xbe14('0x20')],_0x3b3e84[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x1c7cc7,null))[_0xbe14('0xc')](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x21')]=function(_0x40538f,_0x3bf43c){return respondWithRpcPromise(_0xbe14('0x22'),_[_0xbe14('0x1a')](_0x40538f[_0xbe14('0x17')],_0x40538f[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x3bf43c,null))[_0xbe14('0xc')](handleError(_0x3bf43c,null));};exports[_0xbe14('0x23')]=function(_0x14e7c4,_0x581e86){return respondWithRpcPromise(_0xbe14('0x24'),_0x14e7c4['query'])['then'](respondWithResult(_0x581e86,null))[_0xbe14('0xc')](handleError(_0x581e86,null));};exports['voiceQueuesChannel']=function(_0x243524,_0x345b0){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x243524['query'],_0x243524[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x345b0,null))['catch'](handleError(_0x345b0,null));};exports[_0xbe14('0x25')]=function(_0x1faf3e,_0x452635){return respondWithRpcPromise(_0xbe14('0x26'),_[_0xbe14('0x1a')](_0x1faf3e['query'],_0x1faf3e['params']))[_0xbe14('0x8')](respondWithResult(_0x452635,null))['catch'](handleError(_0x452635,null));};exports['voiceQueuesChannelRedirect']=function(_0x5c5e9f,_0x163ef7){return respondWithRpcPromise(_0xbe14('0x27'),_[_0xbe14('0x1a')](_0x5c5e9f[_0xbe14('0x17')],_0x5c5e9f[_0xbe14('0x1b')]))[_0xbe14('0x8')](respondWithResult(_0x163ef7,null))[_0xbe14('0xc')](handleError(_0x163ef7,null));};exports[_0xbe14('0x28')]=function(_0x2d9c12,_0x2dfd5a){return respondWithRpcPromise(_0xbe14('0x29'),_0x2d9c12[_0xbe14('0x17')])['then'](respondWithResult(_0x2dfd5a,null))['catch'](handleError(_0x2dfd5a,null));};exports[_0xbe14('0x2a')]=function(_0x2951e1,_0x13bfcf){return respondWithRpcPromise('OutboundChannels',_0x2951e1[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x13bfcf,null))[_0xbe14('0xc')](handleError(_0x13bfcf,null));};exports[_0xbe14('0x2b')]=function(_0x3bd454,_0x25ee1f){var _0x19fa30;return respondWithRpcPromise(_0xbe14('0x2c'),_0x3bd454[_0xbe14('0x17')])['then'](function(_0xe51424){_0x19fa30=_0xe51424;return respondWithRpcPromise(_0xbe14('0x2c'),_0x3bd454[_0xbe14('0x17')],routingClient);})[_0xbe14('0x8')](function(_0x3287b9){return _[_0xbe14('0x1a')]({},_0x3287b9,_0x19fa30);})['then'](respondWithResult(_0x25ee1f,null))[_0xbe14('0xc')](handleError(_0x25ee1f,null));};exports[_0xbe14('0x2d')]=function(_0x1220c9,_0x36263c){if(_0x1220c9['body']&&_0x1220c9['body'][_0xbe14('0x2e')]&&_0x1220c9[_0xbe14('0x2f')]&&_0x1220c9[_0xbe14('0x2f')]['name']){for(var _0x5d5318 in _0x1220c9[_0xbe14('0x20')]['interaction']){if(_0x1220c9['body'][_0xbe14('0x2e')][_0xbe14('0x30')](_0x5d5318)){db[_0xbe14('0x31')]['findAll']({'where':{'channel':_0x5d5318,'membername':_0x1220c9['user']['name'],'type':_0xbe14('0x32'),'exitAt':null,'uniqueid':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318]&&_0x1220c9['body'][_0xbe14('0x2e')][_0x5d5318][_0xbe14('0x33')]?{'$notIn':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318]}:{'$ne':null}}})['then'](function(_0x4a1a4b){var _0x3e2fd3=moment()[_0xbe14('0x34')](_0xbe14('0x35'));for(var _0xb2b285=0x0,_0x2550dc=_0x4a1a4b['length'];_0xb2b285<_0x2550dc;_0xb2b285+=0x1){_0x4a1a4b[_0xb2b285]['updateAttributes']({'exitAt':_0x3e2fd3});}});for(var _0x46af81=0x0;_0x46af81<_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318][_0xbe14('0x33')];_0x46af81+=0x1){db['MemberReport'][_0xbe14('0x36')]({'where':{'channel':_0x5d5318,'membername':_0x1220c9[_0xbe14('0x2f')]['name'],'type':_0xbe14('0x32'),'uniqueid':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318][_0x46af81],'exitAt':null},'defaults':{'channel':_0x5d5318,'membername':_0x1220c9[_0xbe14('0x2f')]['name'],'interface':_['isNil'](_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x37')])?util['format']('SIP/%s',_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x10')]):_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x37')],'type':_0xbe14('0x32'),'enterAt':moment()[_0xbe14('0x34')](_0xbe14('0x35')),'role':'agent','internal':_0x1220c9[_0xbe14('0x2f')][_0xbe14('0x38')],'uniqueid':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x2e')][_0x5d5318][_0x46af81]}});}}}}return respondWithRpcPromise(_0xbe14('0x39'),{'id':_0x1220c9['params']['id'],'capacity':_0x1220c9[_0xbe14('0x20')][_0xbe14('0x3a')]},routingClient)[_0xbe14('0x8')](respondWithResult(_0x36263c,null))[_0xbe14('0xc')](handleError(_0x36263c,null));};exports[_0xbe14('0x3b')]=function(_0x2dbeb1,_0x505829){return respondWithRpcPromise('Telephones',_0x2dbeb1[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x505829,null))[_0xbe14('0xc')](handleError(_0x505829,null));};exports['trunks']=function(_0x497b00,_0x44fe0d){return respondWithRpcPromise(_0xbe14('0x3c'),_0x497b00['query'])[_0xbe14('0x8')](respondWithResult(_0x44fe0d,null))[_0xbe14('0xc')](handleError(_0x44fe0d,null));};exports['campaigns']=function(_0x28f995,_0x4a40d2){return respondWithRpcPromise(_0xbe14('0x3d'),_0x28f995[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x4a40d2,null))['catch'](handleError(_0x4a40d2,null));};exports[_0xbe14('0x3e')]=function(_0x404212,_0x5dc78a){return respondWithRpcPromise(_0xbe14('0x3f'),_0x404212[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x5dc78a,null))[_0xbe14('0xc')](handleError(_0x5dc78a,null));};exports[_0xbe14('0x40')]=function(_0x4f06a3,_0x42a346){return respondWithRpcPromise(_0xbe14('0x3f'),_0x4f06a3[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](findById(_0x4f06a3[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x42a346,null))[_0xbe14('0xc')](handleError(_0x42a346,null));};exports['mailQueues']=function(_0x72c875,_0x1b47a4){return respondWithRpcPromise(_0xbe14('0x41'),_0x72c875[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x1b47a4,null))[_0xbe14('0xc')](handleError(_0x1b47a4,null));};exports[_0xbe14('0x42')]=function(_0x32df3c,_0x285b6e){return respondWithRpcPromise(_0xbe14('0x41'),_0x32df3c[_0xbe14('0x17')],routingClient)['then'](findById(_0x32df3c['params']['id']))['then'](respondWithResult(_0x285b6e,null))[_0xbe14('0xc')](handleError(_0x285b6e,null));};exports[_0xbe14('0x43')]=function(_0x2f4e52,_0xf79b21){return respondWithRpcPromise(_0xbe14('0x44'),_0x2f4e52[_0xbe14('0x17')],mailClient)[_0xbe14('0x8')](respondWithResult(_0xf79b21,null))[_0xbe14('0xc')](handleError(_0xf79b21,null));};exports[_0xbe14('0x45')]=function(_0x451b0b,_0x603816){return respondWithRpcPromise(_0xbe14('0x46'),_0x451b0b[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x603816,null))[_0xbe14('0xc')](handleError(_0x603816,null));};exports[_0xbe14('0x47')]=function(_0x179077,_0x2225d9){return respondWithRpcPromise(_0xbe14('0x46'),_0x179077[_0xbe14('0x17')],routingClient)['then'](findById(_0x179077[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x2225d9,null))[_0xbe14('0xc')](handleError(_0x2225d9,null));};exports[_0xbe14('0x48')]=function(_0x3ee6b7,_0x222944){return respondWithRpcPromise(_0xbe14('0x49'),_0x3ee6b7[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x222944,null))[_0xbe14('0xc')](handleError(_0x222944,null));};exports['showSmsQueues']=function(_0x18be56,_0x442ec4){return respondWithRpcPromise(_0xbe14('0x49'),_0x18be56[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](findById(_0x18be56['params']['id']))[_0xbe14('0x8')](respondWithResult(_0x442ec4,null))[_0xbe14('0xc')](handleError(_0x442ec4,null));};exports[_0xbe14('0x4a')]=function(_0xd4e1c7,_0x46ac9c){return respondWithRpcPromise('WhatsappQueues',_0xd4e1c7[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x46ac9c,null))[_0xbe14('0xc')](handleError(_0x46ac9c,null));};exports[_0xbe14('0x4b')]=function(_0xaebce8,_0x289c4d){return respondWithRpcPromise(_0xbe14('0x4c'),_0xaebce8[_0xbe14('0x17')],routingClient)['then'](findById(_0xaebce8[_0xbe14('0x1b')]['id']))[_0xbe14('0x8')](respondWithResult(_0x289c4d,null))[_0xbe14('0xc')](handleError(_0x289c4d,null));};exports[_0xbe14('0x4d')]=function(_0x5982b7,_0xa4b2a3){return respondWithRpcPromise(_0xbe14('0x4e'),_0x5982b7['query'],routingClient)['then'](respondWithResult(_0xa4b2a3,null))[_0xbe14('0xc')](handleError(_0xa4b2a3,null));};exports[_0xbe14('0x4f')]=function(_0x2d2643,_0x2510a0){return respondWithRpcPromise(_0xbe14('0x4e'),_0x2d2643[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](findById(_0x2d2643[_0xbe14('0x1b')]['id']))['then'](respondWithResult(_0x2510a0,null))['catch'](handleError(_0x2510a0,null));};exports[_0xbe14('0x50')]=function(_0x1c18b6,_0x29aa52){return respondWithRpcPromise('FaxAccounts',_0x1c18b6[_0xbe14('0x17')])[_0xbe14('0x8')](respondWithResult(_0x29aa52,null))[_0xbe14('0xc')](handleError(_0x29aa52,null));};exports[_0xbe14('0x51')]=function(_0x468e9f,_0x1ef09b){return respondWithRpcPromise(_0xbe14('0x52'),_0x468e9f['query'],routingClient)[_0xbe14('0x8')](respondWithResult(_0x1ef09b,null))[_0xbe14('0xc')](handleError(_0x1ef09b,null));};exports[_0xbe14('0x53')]=function(_0x3afc5a,_0x469555){return respondWithRpcPromise(_0xbe14('0x54'),_0x3afc5a[_0xbe14('0x17')],routingClient)['then'](respondWithResult(_0x469555,null))[_0xbe14('0xc')](handleError(_0x469555,null));};exports[_0xbe14('0x55')]=function(_0x3cd17e,_0x1c0932){return respondWithRpcPromise(_0xbe14('0x56'),_0x3cd17e[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x1c0932,null))[_0xbe14('0xc')](handleError(_0x1c0932,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x1e5ce1,_0x401968){return respondWithRpcPromise(_0xbe14('0x56'),_0x1e5ce1[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](function(_0x17576b){if(_0x1e5ce1['query'][_0xbe14('0x57')]!==undefined){var _0x175213=_(_0x17576b[_0xbe14('0x13')])[_0xbe14('0x58')]([_0x1e5ce1['query'][_0xbe14('0x57')],_0x1e5ce1[_0xbe14('0x1b')]['id']])[_0xbe14('0x59')](_0xbe14('0x5a'))[_0xbe14('0x5b')]()[_0xbe14('0x5c')]();return _0x17576b[_0xbe14('0x13')]['filter'](function(_0x70ed08){return _0x175213['indexOf'](_0x70ed08[_0xbe14('0x5a')])>-0x1;});}else{return _0x17576b['rows'][_0xbe14('0x58')](function(_0x21837c){return _0x21837c[_0xbe14('0x5a')]===parseInt(_0x1e5ce1['params']['id']);});}})[_0xbe14('0x8')](respondWithResult(_0x401968,null))[_0xbe14('0xc')](handleError(_0x401968,null));};exports[_0xbe14('0x5d')]=function(_0x546f22,_0x41a896){return respondWithRpcPromise(_0xbe14('0x5e'),_0x546f22[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x41a896,null))['catch'](handleError(_0x41a896,null));};exports[_0xbe14('0x5f')]=function(_0x39bc54,_0x34f90b){return respondWithRpcPromise(_0xbe14('0x60'),_0x39bc54[_0xbe14('0x17')],routingClient)[_0xbe14('0x8')](respondWithResult(_0x34f90b,null))[_0xbe14('0xc')](handleError(_0x34f90b,null));};exports['faxQueuesWaitingInteractions']=function(_0x2ff94c,_0x123f4f){return respondWithRpcPromise(_0xbe14('0x61'),_0x2ff94c['query'],routingClient)[_0xbe14('0x8')](respondWithResult(_0x123f4f,null))[_0xbe14('0xc')](handleError(_0x123f4f,null));};exports[_0xbe14('0x62')]=function(_0x5bc52b){return function(_0xa53262,_0x1205d1){var _0x47d7bb,_0x2be969;var _0x49990b=_[_0xbe14('0x63')](_0x5bc52b);var _0x337073=_0x5bc52b==='chat'?'Website':_0xbe14('0x64');return db[_0x49990b+_0xbe14('0x65')][_0xbe14('0x66')]({'raw':!![],'where':{'id':_0xa53262['params']['id']}})[_0xbe14('0x8')](function(_0x30c03b){if(_[_0xbe14('0x12')](_0x30c03b)){throw new Error(_0x49990b+_0xbe14('0x67'));}_0x47d7bb=_0x30c03b;return db[_0x49990b+'Message']['findOne']({'where':{'id':_0xa53262[_0xbe14('0x20')][_0xbe14('0x68')]},'include':[{'model':db[_0x49990b+_0xbe14('0x69')],'as':_0xbe14('0x69')},{'model':db[_0x49990b+_0x337073],'as':_0xbe14('0x64')}]});})[_0xbe14('0x8')](function(_0x139aab){if(_['isNil'](_0x139aab)){throw new Error(_0x49990b+_0xbe14('0x6a'));}_0x2be969=_0x139aab;return _0x139aab['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xbe14('0x8')](function(){var _0x3a01bb={'uniqueid':_0x5bc52b+'.'+_0x2be969['id']+'.'+_0x2be969[_0xbe14('0x69')]['id'],'FromUserId':_0xa53262[_0xbe14('0x2f')]['id'],'type':'queue'};_0x3a01bb[_0x49990b+_0xbe14('0x6b')]=_0x2be969['id'];_0x3a01bb[_0x49990b+_0xbe14('0x6c')]=_0x2be969[_0xbe14('0x69')]['id'];_0x3a01bb['From'+_0x49990b+_0x337073+'Id']=_0x2be969[_0xbe14('0x64')]['id'];_0x3a01bb['To'+_0x49990b+_0xbe14('0x6d')]=_0x47d7bb['id'];return db[_0x49990b+_0xbe14('0x6e')][_0xbe14('0x6f')](_0x3a01bb);})[_0xbe14('0x8')](function(){return respondWithRpcPromise(_0xbe14('0x70'),{'channel':_0x5bc52b,'interaction':_0x2be969[_0xbe14('0x69')],'message':_0x2be969,'account':_0x2be969[_0xbe14('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbe14('0x71'),'appdata':_0x47d7bb[_0xbe14('0x10')]+','+(_0x2be969[_0xbe14('0x64')][_0xbe14('0x72')]||0x12c),'interval':_0xbe14('0x73')}]},routingClient);})[_0xbe14('0x8')](respondWithResult(_0x1205d1,null))[_0xbe14('0xc')](handleError(_0x1205d1,null));};};exports[_0xbe14('0x74')]=function(_0x1de70d,_0x30be9e){var _0x1679bd,_0x2ca6e6;if(_['isNil'](_0x1de70d[_0xbe14('0x20')]['channel'])){throw new Error(_0xbe14('0x75'));}var _0x1b8733=_0x1de70d[_0xbe14('0x20')][_0xbe14('0x76')];var _0x1d7b08=_['capitalize'](_0x1b8733);var _0x5868d7=_0x1b8733===_0xbe14('0x77')?_0xbe14('0x78'):_0xbe14('0x64');return db[_0xbe14('0x79')]['findOne']({'raw':!![],'where':{'id':_0x1de70d[_0xbe14('0x1b')]['id'],'role':_0xbe14('0x7a')}})['then'](function(_0x186225){if(_[_0xbe14('0x12')](_0x186225)){throw new Error(_0xbe14('0x7b'));}_0x1679bd=_0x186225;return db[_0x1d7b08+_0xbe14('0x7c')]['findOne']({'where':{'id':_0x1de70d[_0xbe14('0x20')]['messageId']},'include':[{'model':db[_0x1d7b08+'Interaction'],'as':_0xbe14('0x69')},{'model':db[_0x1d7b08+_0x5868d7],'as':_0xbe14('0x64')}]});})[_0xbe14('0x8')](function(_0x3d890b){if(_[_0xbe14('0x12')](_0x3d890b)){throw new Error(_0x1d7b08+'\x20Message\x20not\x20found');}_0x2ca6e6=_0x3d890b;return _0x3d890b[_0xbe14('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbe14('0x8')](function(){var _0x5dc793={'uniqueid':_0x1b8733+'.'+_0x2ca6e6['id']+'.'+_0x2ca6e6['Interaction']['id'],'FromUserId':_0x1de70d[_0xbe14('0x2f')]['id'],'type':_0xbe14('0x71'),'ToUserId':_0x1679bd['id']};_0x5dc793[_0x1d7b08+'MessageId']=_0x2ca6e6['id'];_0x5dc793[_0x1d7b08+_0xbe14('0x6c')]=_0x2ca6e6['Interaction']['id'];_0x5dc793[_0xbe14('0x7e')+_0x1d7b08+_0x5868d7+'Id']=_0x2ca6e6['Account']['id'];return db[_0x1d7b08+_0xbe14('0x6e')]['create'](_0x5dc793);})[_0xbe14('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1b8733,'interaction':_0x2ca6e6[_0xbe14('0x69')],'message':_0x2ca6e6,'account':_0x2ca6e6[_0xbe14('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x1679bd['name']+','+(_0x2ca6e6[_0xbe14('0x64')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xbe14('0x8')](respondWithResult(_0x30be9e,null))[_0xbe14('0xc')](handleError(_0x30be9e,null));};
\ No newline at end of file
index 61eebfe..792200e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x37b2=['express','Router','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','run','post','create','put','update','delete','exports','util','path','connect-timeout'];(function(_0x4e4e2e,_0x383975){var _0x5eb19e=function(_0xa5839d){while(--_0xa5839d){_0x4e4e2e['push'](_0x4e4e2e['shift']());}};_0x5eb19e(++_0x383975);}(_0x37b2,0x1a1));var _0x237b=function(_0x5887c8,_0x4b2ac9){_0x5887c8=_0x5887c8-0x0;var _0x2f9bef=_0x37b2[_0x5887c8];return _0x2f9bef;};'use strict';var multer=require('multer');var util=require(_0x237b('0x0'));var path=require(_0x237b('0x1'));var timeout=require(_0x237b('0x2'));var express=require(_0x237b('0x3'));var router=express[_0x237b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x237b('0x5'));var config=require(_0x237b('0x6'));var controller=require(_0x237b('0x7'));router['get']('/',auth[_0x237b('0x8')](),controller[_0x237b('0x9')]);router[_0x237b('0xa')](_0x237b('0xb'),auth[_0x237b('0x8')](),controller[_0x237b('0xc')]);router[_0x237b('0xa')]('/:id/run',auth['isAuthenticated'](),controller[_0x237b('0xd')]);router[_0x237b('0xe')]('/',auth[_0x237b('0x8')](),controller[_0x237b('0xf')]);router[_0x237b('0x10')](_0x237b('0xb'),auth[_0x237b('0x8')](),controller[_0x237b('0x11')]);router[_0x237b('0x12')](_0x237b('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x237b('0x13')]=router;
\ No newline at end of file
+var _0x0964=['create','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','/:id','run'];(function(_0xd4502f,_0x3d022d){var _0x2e722b=function(_0x1cbdd8){while(--_0x1cbdd8){_0xd4502f['push'](_0xd4502f['shift']());}};_0x2e722b(++_0x3d022d);}(_0x0964,0x7c));var _0x4096=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x0964[_0x2080a3];return _0x8d7d17;};'use strict';var multer=require(_0x4096('0x0'));var util=require(_0x4096('0x1'));var path=require('path');var timeout=require(_0x4096('0x2'));var express=require(_0x4096('0x3'));var router=express[_0x4096('0x4')]();var fs_extra=require(_0x4096('0x5'));var auth=require(_0x4096('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4096('0x7'));var controller=require('./schedule.controller');router['get']('/',auth[_0x4096('0x8')](),controller['index']);router['get'](_0x4096('0x9'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/run',auth[_0x4096('0x8')](),controller[_0x4096('0xa')]);router['post']('/',auth[_0x4096('0x8')](),controller[_0x4096('0xb')]);router['put'](_0x4096('0x9'),auth[_0x4096('0x8')](),controller[_0x4096('0xc')]);router[_0x4096('0xd')](_0x4096('0x9'),auth[_0x4096('0x8')](),controller['destroy']);module[_0x4096('0xe')]=router;
\ No newline at end of file
index 35d71b7..99cb167 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x23da=['default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','minutes','csv','custom'];(function(_0x425ecd,_0x1e1bed){var _0xddc406=function(_0x179638){while(--_0x179638){_0x425ecd['push'](_0x425ecd['shift']());}};_0xddc406(++_0x1e1bed);}(_0x23da,0x1ec));var _0xa23d=function(_0x4479f9,_0x6f8e58){_0x4479f9=_0x4479f9-0x0;var _0x5c965d=_0x23da[_0x4479f9];return _0x5c965d;};'use strict';var Sequelize=require('sequelize');module[_0xa23d('0x0')]={'name':{'type':Sequelize[_0xa23d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa23d('0x1')]},'active':{'type':Sequelize[_0xa23d('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa23d('0x3')},'startAt':{'type':Sequelize[_0xa23d('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xa23d('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa23d('0x6')](_0xa23d('0x7'),_0xa23d('0x8'),'months','weeks','days','hours',_0xa23d('0x9')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM']('csv','pdf','xlsx'),'allowNull':![],'defaultValue':_0xa23d('0xa')},'type':{'type':Sequelize[_0xa23d('0x6')](_0xa23d('0xb'),_0xa23d('0xc')),'allowNull':![],'defaultValue':_0xa23d('0xb')},'sendMail':{'type':Sequelize[_0xa23d('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xa23d('0xd')]},'bcc':{'type':Sequelize[_0xa23d('0xd')]},'sendIfEmpty':{'type':Sequelize[_0xa23d('0x2')],'defaultValue':!![]}};
\ No newline at end of file
+var _0xc658=['xlsx','custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','months','weeks','hours','minutes','days','csv'];(function(_0xa6efeb,_0x11ace7){var _0x214453=function(_0x133f58){while(--_0x133f58){_0xa6efeb['push'](_0xa6efeb['shift']());}};_0x214453(++_0x11ace7);}(_0xc658,0x70));var _0x8c65=function(_0x2de570,_0x59b16){_0x2de570=_0x2de570-0x0;var _0x54059f=_0xc658[_0x2de570];return _0x54059f;};'use strict';var Sequelize=require(_0x8c65('0x0'));module['exports']={'name':{'type':Sequelize[_0x8c65('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x8c65('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8c65('0x1')],'allowNull':![],'defaultValue':_0x8c65('0x3')},'startAt':{'type':Sequelize[_0x8c65('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8c65('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8c65('0x5')](_0x8c65('0x6'),_0x8c65('0x7'),_0x8c65('0x8'),_0x8c65('0x9'),'days',_0x8c65('0xa'),_0x8c65('0xb')),'allowNull':![],'defaultValue':_0x8c65('0xc')},'output':{'type':Sequelize['ENUM'](_0x8c65('0xd'),'pdf',_0x8c65('0xe')),'allowNull':![],'defaultValue':_0x8c65('0xd')},'type':{'type':Sequelize[_0x8c65('0x5')](_0x8c65('0xf'),_0x8c65('0x10')),'allowNull':![],'defaultValue':_0x8c65('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x8c65('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x8c65('0x2')],'defaultValue':!![]}};
\ No newline at end of file
index 2a147a7..b50cafb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd423=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','json','offset','undefined','count','set','apply','reject','save','update','destroy','Scheduler','then','end','sendStatus','error','name','send','index','Schedule','rawAttributes','type','model','map','keys','filters','intersection','attributes','fields','query','length','nolimit','limit','order','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','run','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','desk.js','querystring'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0xd423,0xe5));var _0x3d42=function(_0x20a7ac,_0x4d91fe){_0x20a7ac=_0x20a7ac-0x0;var _0xd65727=_0xd423[_0x20a7ac];return _0xd65727;};'use strict';var emlformat=require(_0x3d42('0x0'));var rimraf=require(_0x3d42('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d42('0x2'));var rp=require(_0x3d42('0x3'));var moment=require(_0x3d42('0x4'));var BPromise=require(_0x3d42('0x5'));var Mustache=require(_0x3d42('0x6'));var util=require(_0x3d42('0x7'));var path=require('path');var sox=require(_0x3d42('0x8'));var csv=require(_0x3d42('0x9'));var ejs=require(_0x3d42('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d42('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3d42('0xc'));var toCsv=require(_0x3d42('0x9'));var querystring=require(_0x3d42('0xd'));var Papa=require('papaparse');var Redis=require(_0x3d42('0xe'));var authService=require(_0x3d42('0xf'));var qs=require(_0x3d42('0x10'));var as=require(_0x3d42('0x11'));var hardwareService=require(_0x3d42('0x12'));var logger=require(_0x3d42('0x13'))(_0x3d42('0x14'));var utils=require(_0x3d42('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e6748,_0x2e6a0b){_0x2e6a0b=_0x2e6a0b||0xcc;return function(_0x218b20){if(_0x218b20){return _0x1e6748['sendStatus'](_0x2e6a0b);}return _0x1e6748['status'](_0x2e6a0b)['end']();};}function respondWithResult(_0x1cdb11,_0xb12cd4){_0xb12cd4=_0xb12cd4||0xc8;return function(_0x416c3e){if(_0x416c3e){return _0x1cdb11[_0x3d42('0x16')](_0xb12cd4)[_0x3d42('0x17')](_0x416c3e);}};}function respondWithFilteredResult(_0x554311,_0xb460a9){return function(_0x2b8375){if(_0x2b8375){var _0x553f2c=typeof _0xb460a9[_0x3d42('0x18')]===_0x3d42('0x19')&&typeof _0xb460a9['limit']===_0x3d42('0x19');var _0x46bbe0=_0x2b8375['count'];var _0xe3af3=_0x553f2c?0x0:_0xb460a9[_0x3d42('0x18')];var _0x312903=_0x553f2c?_0x2b8375[_0x3d42('0x1a')]:_0xb460a9[_0x3d42('0x18')]+_0xb460a9['limit'];var _0xb61961;if(_0x312903>=_0x46bbe0){_0x312903=_0x46bbe0;_0xb61961=0xc8;}else{_0xb61961=0xce;}_0x554311['status'](_0xb61961);return _0x554311[_0x3d42('0x1b')]('Content-Range',_0xe3af3+'-'+_0x312903+'/'+_0x46bbe0)[_0x3d42('0x17')](_0x2b8375);}return null;};}function patchUpdates(_0x27c89a){return function(_0x21f149){try{jsonpatch[_0x3d42('0x1c')](_0x21f149,_0x27c89a,!![]);}catch(_0x6c2566){return BPromise[_0x3d42('0x1d')](_0x6c2566);}return _0x21f149[_0x3d42('0x1e')]();};}function saveUpdates(_0x226a69,_0x17d3d5){return function(_0x421629){if(_0x421629){return _0x421629[_0x3d42('0x1f')](_0x226a69)['then'](function(_0x1905bb){return _0x1905bb;});}return null;};}function removeEntity(_0x157f47,_0x40c045){return function(_0x20e40b){if(_0x20e40b){return _0x20e40b[_0x3d42('0x20')]()['then'](function(){var _0x4a25c1=_0x20e40b['get']({'plain':!![]});var _0x462b8c=_0x3d42('0x21');return db['UserProfileResource'][_0x3d42('0x20')]({'where':{'type':_0x462b8c,'resourceId':_0x4a25c1['id']}})[_0x3d42('0x22')](function(){return _0x20e40b;});})[_0x3d42('0x22')](function(){_0x157f47[_0x3d42('0x16')](0xcc)[_0x3d42('0x23')]();});}};}function handleEntityNotFound(_0x46da31,_0x3bccfe){return function(_0x4842f0){if(!_0x4842f0){_0x46da31[_0x3d42('0x24')](0x194);}return _0x4842f0;};}function handleError(_0x52c6c2,_0x1ca763){_0x1ca763=_0x1ca763||0x1f4;return function(_0x327c0c){logger[_0x3d42('0x25')](_0x327c0c['stack']);if(_0x327c0c['name']){delete _0x327c0c[_0x3d42('0x26')];}_0x52c6c2[_0x3d42('0x16')](_0x1ca763)[_0x3d42('0x27')](_0x327c0c);};}exports[_0x3d42('0x28')]=function(_0x5d7b61,_0x383745){var _0x3e3afb={},_0x599868={},_0x181f38={'count':0x0,'rows':[]};var _0x4773e7=_['map'](db[_0x3d42('0x29')][_0x3d42('0x2a')],function(_0xdd5168){return{'name':_0xdd5168['fieldName'],'type':_0xdd5168[_0x3d42('0x2b')]['key']};});_0x599868[_0x3d42('0x2c')]=_[_0x3d42('0x2d')](_0x4773e7,_0x3d42('0x26'));_0x599868['query']=_[_0x3d42('0x2e')](_0x5d7b61['query']);_0x599868[_0x3d42('0x2f')]=_[_0x3d42('0x30')](_0x599868[_0x3d42('0x2c')],_0x599868['query']);_0x3e3afb[_0x3d42('0x31')]=_[_0x3d42('0x30')](_0x599868['model'],qs[_0x3d42('0x32')](_0x5d7b61[_0x3d42('0x33')]['fields']));_0x3e3afb['attributes']=_0x3e3afb[_0x3d42('0x31')][_0x3d42('0x34')]?_0x3e3afb[_0x3d42('0x31')]:_0x599868[_0x3d42('0x2c')];if(!_0x5d7b61[_0x3d42('0x33')]['hasOwnProperty'](_0x3d42('0x35'))){_0x3e3afb[_0x3d42('0x36')]=qs[_0x3d42('0x36')](_0x5d7b61[_0x3d42('0x33')]['limit']);_0x3e3afb[_0x3d42('0x18')]=qs[_0x3d42('0x18')](_0x5d7b61['query'][_0x3d42('0x18')]);}_0x3e3afb[_0x3d42('0x37')]=qs['sort'](_0x5d7b61[_0x3d42('0x33')]['sort']);_0x3e3afb['where']=qs['filters'](_[_0x3d42('0x38')](_0x5d7b61[_0x3d42('0x33')],_0x599868[_0x3d42('0x2f')]),_0x4773e7);if(_0x5d7b61[_0x3d42('0x33')]['filter']){_0x3e3afb['where']=_[_0x3d42('0x39')](_0x3e3afb[_0x3d42('0x3a')],{'$or':_[_0x3d42('0x2d')](_0x4773e7,function(_0x1167f9){if(_0x1167f9['type']!==_0x3d42('0x3b')){var _0x2d6601={};_0x2d6601[_0x1167f9[_0x3d42('0x26')]]={'$like':'%'+_0x5d7b61[_0x3d42('0x33')][_0x3d42('0x3c')]+'%'};return _0x2d6601;}})});}_0x3e3afb=_['merge']({},_0x3e3afb,_0x5d7b61[_0x3d42('0x3d')]);var _0x32b038={'where':_0x3e3afb['where']};return db[_0x3d42('0x29')]['count'](_0x32b038)[_0x3d42('0x22')](function(_0x1508fa){_0x181f38[_0x3d42('0x1a')]=_0x1508fa;if(_0x5d7b61[_0x3d42('0x33')][_0x3d42('0x3e')]){_0x3e3afb[_0x3d42('0x3f')]=[{'all':!![]}];}return db[_0x3d42('0x29')][_0x3d42('0x40')](_0x3e3afb);})[_0x3d42('0x22')](function(_0x3da112){_0x181f38[_0x3d42('0x41')]=_0x3da112;return _0x181f38;})[_0x3d42('0x22')](respondWithFilteredResult(_0x383745,_0x3e3afb))[_0x3d42('0x42')](handleError(_0x383745,null));};exports[_0x3d42('0x43')]=function(_0x656b0f,_0x40bb2f){var _0x439269={'raw':![],'where':{'id':_0x656b0f['params']['id']}},_0x4de4a6={};_0x4de4a6[_0x3d42('0x2c')]=_[_0x3d42('0x2e')](db[_0x3d42('0x29')][_0x3d42('0x2a')]);_0x4de4a6[_0x3d42('0x33')]=_[_0x3d42('0x2e')](_0x656b0f[_0x3d42('0x33')]);_0x4de4a6[_0x3d42('0x2f')]=_[_0x3d42('0x30')](_0x4de4a6[_0x3d42('0x2c')],_0x4de4a6[_0x3d42('0x33')]);_0x439269[_0x3d42('0x31')]=_['intersection'](_0x4de4a6[_0x3d42('0x2c')],qs[_0x3d42('0x32')](_0x656b0f[_0x3d42('0x33')]['fields']));_0x439269[_0x3d42('0x31')]=_0x439269[_0x3d42('0x31')]['length']?_0x439269[_0x3d42('0x31')]:_0x4de4a6[_0x3d42('0x2c')];if(_0x656b0f['query'][_0x3d42('0x3e')]){_0x439269[_0x3d42('0x3f')]=[{'all':!![]}];}_0x439269=_[_0x3d42('0x39')]({},_0x439269,_0x656b0f[_0x3d42('0x3d')]);return db[_0x3d42('0x29')]['find'](_0x439269)['then'](handleEntityNotFound(_0x40bb2f,null))[_0x3d42('0x22')](respondWithResult(_0x40bb2f,null))['catch'](handleError(_0x40bb2f,null));};exports['create']=function(_0x28a3b5,_0x333453){return db['Schedule'][_0x3d42('0x44')](_0x28a3b5[_0x3d42('0x45')],{})[_0x3d42('0x22')](function(_0xece9e2){var _0x48fa11=_0x28a3b5['user'][_0x3d42('0x46')]({'plain':!![]});if(!_0x48fa11)throw new Error(_0x3d42('0x47'));if(_0x48fa11[_0x3d42('0x48')]===_0x3d42('0x49')){var _0x331284=_0xece9e2[_0x3d42('0x46')]({'plain':!![]});var _0x26ad45=_0x3d42('0x21');return db['UserProfileSection']['find']({'where':{'name':_0x26ad45,'userProfileId':_0x48fa11[_0x3d42('0x4a')]},'raw':!![]})['then'](function(_0x7fe45c){if(_0x7fe45c&&_0x7fe45c[_0x3d42('0x4b')]===0x0){return db[_0x3d42('0x4c')][_0x3d42('0x44')]({'name':_0x331284['name'],'resourceId':_0x331284['id'],'type':_0x7fe45c[_0x3d42('0x26')],'sectionId':_0x7fe45c['id']},{})[_0x3d42('0x22')](function(){return _0xece9e2;});}else{return _0xece9e2;}})[_0x3d42('0x42')](function(_0x2be0ab){logger[_0x3d42('0x25')](_0x3d42('0x4d'),_0x2be0ab);throw _0x2be0ab;});}return _0xece9e2;})[_0x3d42('0x22')](respondWithResult(_0x333453,0xc9))[_0x3d42('0x42')](handleError(_0x333453,null));};exports[_0x3d42('0x1f')]=function(_0x26c8b1,_0x3683f8){if(_0x26c8b1[_0x3d42('0x45')]['id']){delete _0x26c8b1['body']['id'];}return db['Schedule'][_0x3d42('0x4e')]({'where':{'id':_0x26c8b1[_0x3d42('0x4f')]['id']}})[_0x3d42('0x22')](handleEntityNotFound(_0x3683f8,null))[_0x3d42('0x22')](saveUpdates(_0x26c8b1[_0x3d42('0x45')],null))[_0x3d42('0x22')](respondWithResult(_0x3683f8,null))[_0x3d42('0x42')](handleError(_0x3683f8,null));};exports['destroy']=function(_0x54df32,_0x385cfd){return db[_0x3d42('0x29')][_0x3d42('0x4e')]({'where':{'id':_0x54df32[_0x3d42('0x4f')]['id']}})['then'](handleEntityNotFound(_0x385cfd,null))[_0x3d42('0x22')](removeEntity(_0x385cfd,null))['catch'](handleError(_0x385cfd,null));};exports[_0x3d42('0x50')]=function(_0x4def0c,_0x1c4269,_0x324b3c){var _0x5e4d76=require('../../config/schedule');return db[_0x3d42('0x29')][_0x3d42('0x4e')]({'where':{'id':_0x4def0c[_0x3d42('0x4f')]['id']},'raw':!![]})[_0x3d42('0x22')](handleEntityNotFound(_0x1c4269,null))[_0x3d42('0x22')](function(){_0x5e4d76['run'](_0x4def0c[_0x3d42('0x4f')]['id']);})[_0x3d42('0x22')](respondWithStatusCode(_0x1c4269,null))[_0x3d42('0x42')](handleError(_0x1c4269,null));};
\ No newline at end of file
+var _0x7466=['where','filter','VIRTUAL','includeAll','include','rows','catch','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','params','run','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x5ec453,_0x30b0ba){var _0x25548f=function(_0x387b62){while(--_0x387b62){_0x5ec453['push'](_0x5ec453['shift']());}};_0x25548f(++_0x30b0ba);}(_0x7466,0x1bd));var _0x6746=function(_0x2e13c0,_0xe38aff){_0x2e13c0=_0x2e13c0-0x0;var _0x3fb2d6=_0x7466[_0x2e13c0];return _0x3fb2d6;};'use strict';var emlformat=require(_0x6746('0x0'));var rimraf=require(_0x6746('0x1'));var zipdir=require(_0x6746('0x2'));var jsonpatch=require(_0x6746('0x3'));var rp=require('request-promise');var moment=require(_0x6746('0x4'));var BPromise=require(_0x6746('0x5'));var Mustache=require(_0x6746('0x6'));var util=require(_0x6746('0x7'));var path=require(_0x6746('0x8'));var sox=require(_0x6746('0x9'));var csv=require(_0x6746('0xa'));var ejs=require(_0x6746('0xb'));var fs=require('fs');var fs_extra=require(_0x6746('0xc'));var _=require(_0x6746('0xd'));var squel=require(_0x6746('0xe'));var crypto=require(_0x6746('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x6746('0x10'));var toCsv=require(_0x6746('0xa'));var querystring=require(_0x6746('0x11'));var Papa=require(_0x6746('0x12'));var Redis=require(_0x6746('0x13'));var authService=require(_0x6746('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x6746('0x15'));var hardwareService=require(_0x6746('0x16'));var logger=require('../../config/logger')(_0x6746('0x17'));var utils=require('../../config/utils');var config=require(_0x6746('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6746('0x19'))['db'];function respondWithStatusCode(_0x1914bf,_0x4519cb){_0x4519cb=_0x4519cb||0xcc;return function(_0x5d9286){if(_0x5d9286){return _0x1914bf[_0x6746('0x1a')](_0x4519cb);}return _0x1914bf['status'](_0x4519cb)[_0x6746('0x1b')]();};}function respondWithResult(_0xd01bbf,_0x3b7be2){_0x3b7be2=_0x3b7be2||0xc8;return function(_0x466006){if(_0x466006){return _0xd01bbf[_0x6746('0x1c')](_0x3b7be2)[_0x6746('0x1d')](_0x466006);}};}function respondWithFilteredResult(_0x51e55d,_0x568143){return function(_0x2d3e6e){if(_0x2d3e6e){var _0x4ac824=typeof _0x568143[_0x6746('0x1e')]===_0x6746('0x1f')&&typeof _0x568143['limit']===_0x6746('0x1f');var _0x358072=_0x2d3e6e['count'];var _0x5dadf2=_0x4ac824?0x0:_0x568143[_0x6746('0x1e')];var _0x4ec127=_0x4ac824?_0x2d3e6e[_0x6746('0x20')]:_0x568143['offset']+_0x568143[_0x6746('0x21')];var _0x41d038;if(_0x4ec127>=_0x358072){_0x4ec127=_0x358072;_0x41d038=0xc8;}else{_0x41d038=0xce;}_0x51e55d[_0x6746('0x1c')](_0x41d038);return _0x51e55d[_0x6746('0x22')](_0x6746('0x23'),_0x5dadf2+'-'+_0x4ec127+'/'+_0x358072)['json'](_0x2d3e6e);}return null;};}function patchUpdates(_0x30fd19){return function(_0xd7fa40){try{jsonpatch[_0x6746('0x24')](_0xd7fa40,_0x30fd19,!![]);}catch(_0x24f808){return BPromise[_0x6746('0x25')](_0x24f808);}return _0xd7fa40[_0x6746('0x26')]();};}function saveUpdates(_0x3027c2,_0x244c79){return function(_0x1b956c){if(_0x1b956c){return _0x1b956c[_0x6746('0x27')](_0x3027c2)[_0x6746('0x28')](function(_0x29d140){return _0x29d140;});}return null;};}function removeEntity(_0x1368bd,_0x4b38f4){return function(_0x517be0){if(_0x517be0){return _0x517be0[_0x6746('0x29')]()[_0x6746('0x28')](function(){var _0x5b1637=_0x517be0[_0x6746('0x2a')]({'plain':!![]});var _0x4d4e9f=_0x6746('0x2b');return db[_0x6746('0x2c')][_0x6746('0x29')]({'where':{'type':_0x4d4e9f,'resourceId':_0x5b1637['id']}})[_0x6746('0x28')](function(){return _0x517be0;});})['then'](function(){_0x1368bd['status'](0xcc)[_0x6746('0x1b')]();});}};}function handleEntityNotFound(_0x5964e9,_0x4714aa){return function(_0x2940f2){if(!_0x2940f2){_0x5964e9[_0x6746('0x1a')](0x194);}return _0x2940f2;};}function handleError(_0x3f05ba,_0x1e339e){_0x1e339e=_0x1e339e||0x1f4;return function(_0x144765){logger['error'](_0x144765[_0x6746('0x2d')]);if(_0x144765[_0x6746('0x2e')]){delete _0x144765[_0x6746('0x2e')];}_0x3f05ba[_0x6746('0x1c')](_0x1e339e)[_0x6746('0x2f')](_0x144765);};}exports[_0x6746('0x30')]=function(_0x1f5157,_0x17ba96){var _0x595e4f={},_0x5ef62e={},_0x8a706f={'count':0x0,'rows':[]};var _0x53b6cb=_[_0x6746('0x31')](db[_0x6746('0x32')][_0x6746('0x33')],function(_0x429de0){return{'name':_0x429de0[_0x6746('0x34')],'type':_0x429de0[_0x6746('0x35')][_0x6746('0x36')]};});_0x5ef62e[_0x6746('0x37')]=_[_0x6746('0x31')](_0x53b6cb,'name');_0x5ef62e[_0x6746('0x38')]=_[_0x6746('0x39')](_0x1f5157['query']);_0x5ef62e[_0x6746('0x3a')]=_['intersection'](_0x5ef62e[_0x6746('0x37')],_0x5ef62e[_0x6746('0x38')]);_0x595e4f[_0x6746('0x3b')]=_['intersection'](_0x5ef62e['model'],qs[_0x6746('0x3c')](_0x1f5157['query'][_0x6746('0x3c')]));_0x595e4f[_0x6746('0x3b')]=_0x595e4f[_0x6746('0x3b')][_0x6746('0x3d')]?_0x595e4f['attributes']:_0x5ef62e[_0x6746('0x37')];if(!_0x1f5157['query'][_0x6746('0x3e')]('nolimit')){_0x595e4f['limit']=qs[_0x6746('0x21')](_0x1f5157[_0x6746('0x38')][_0x6746('0x21')]);_0x595e4f[_0x6746('0x1e')]=qs[_0x6746('0x1e')](_0x1f5157['query']['offset']);}_0x595e4f[_0x6746('0x3f')]=qs[_0x6746('0x40')](_0x1f5157[_0x6746('0x38')][_0x6746('0x40')]);_0x595e4f[_0x6746('0x41')]=qs['filters'](_['pick'](_0x1f5157[_0x6746('0x38')],_0x5ef62e[_0x6746('0x3a')]),_0x53b6cb);if(_0x1f5157[_0x6746('0x38')][_0x6746('0x42')]){_0x595e4f[_0x6746('0x41')]=_['merge'](_0x595e4f['where'],{'$or':_[_0x6746('0x31')](_0x53b6cb,function(_0x42fb32){if(_0x42fb32[_0x6746('0x35')]!==_0x6746('0x43')){var _0x3a2563={};_0x3a2563[_0x42fb32['name']]={'$like':'%'+_0x1f5157['query'][_0x6746('0x42')]+'%'};return _0x3a2563;}})});}_0x595e4f=_['merge']({},_0x595e4f,_0x1f5157['options']);var _0x56ca12={'where':_0x595e4f[_0x6746('0x41')]};return db[_0x6746('0x32')][_0x6746('0x20')](_0x56ca12)[_0x6746('0x28')](function(_0x203883){_0x8a706f['count']=_0x203883;if(_0x1f5157[_0x6746('0x38')][_0x6746('0x44')]){_0x595e4f[_0x6746('0x45')]=[{'all':!![]}];}return db[_0x6746('0x32')]['findAll'](_0x595e4f);})[_0x6746('0x28')](function(_0x291908){_0x8a706f[_0x6746('0x46')]=_0x291908;return _0x8a706f;})[_0x6746('0x28')](respondWithFilteredResult(_0x17ba96,_0x595e4f))[_0x6746('0x47')](handleError(_0x17ba96,null));};exports['show']=function(_0x142db9,_0x4afaba){var _0x138f4d={'raw':![],'where':{'id':_0x142db9['params']['id']}},_0x4c372e={};_0x4c372e[_0x6746('0x37')]=_['keys'](db[_0x6746('0x32')][_0x6746('0x33')]);_0x4c372e[_0x6746('0x38')]=_[_0x6746('0x39')](_0x142db9[_0x6746('0x38')]);_0x4c372e[_0x6746('0x3a')]=_[_0x6746('0x48')](_0x4c372e[_0x6746('0x37')],_0x4c372e[_0x6746('0x38')]);_0x138f4d['attributes']=_[_0x6746('0x48')](_0x4c372e['model'],qs[_0x6746('0x3c')](_0x142db9[_0x6746('0x38')][_0x6746('0x3c')]));_0x138f4d[_0x6746('0x3b')]=_0x138f4d[_0x6746('0x3b')][_0x6746('0x3d')]?_0x138f4d[_0x6746('0x3b')]:_0x4c372e[_0x6746('0x37')];if(_0x142db9[_0x6746('0x38')][_0x6746('0x44')]){_0x138f4d[_0x6746('0x45')]=[{'all':!![]}];}_0x138f4d=_['merge']({},_0x138f4d,_0x142db9[_0x6746('0x49')]);return db[_0x6746('0x32')][_0x6746('0x4a')](_0x138f4d)[_0x6746('0x28')](handleEntityNotFound(_0x4afaba,null))['then'](respondWithResult(_0x4afaba,null))['catch'](handleError(_0x4afaba,null));};exports[_0x6746('0x4b')]=function(_0x19880f,_0x58df55){return db['Schedule'][_0x6746('0x4b')](_0x19880f[_0x6746('0x4c')],{})[_0x6746('0x28')](function(_0x2d6ca2){var _0xa5bbc1=_0x19880f[_0x6746('0x4d')][_0x6746('0x2a')]({'plain':!![]});if(!_0xa5bbc1)throw new Error(_0x6746('0x4e'));if(_0xa5bbc1['role']===_0x6746('0x4d')){var _0x135095=_0x2d6ca2[_0x6746('0x2a')]({'plain':!![]});var _0x34b29c=_0x6746('0x2b');return db[_0x6746('0x4f')]['find']({'where':{'name':_0x34b29c,'userProfileId':_0xa5bbc1[_0x6746('0x50')]},'raw':!![]})[_0x6746('0x28')](function(_0x19c66f){if(_0x19c66f&&_0x19c66f[_0x6746('0x51')]===0x0){return db[_0x6746('0x2c')]['create']({'name':_0x135095[_0x6746('0x2e')],'resourceId':_0x135095['id'],'type':_0x19c66f[_0x6746('0x2e')],'sectionId':_0x19c66f['id']},{})[_0x6746('0x28')](function(){return _0x2d6ca2;});}else{return _0x2d6ca2;}})[_0x6746('0x47')](function(_0x59fc3a){logger[_0x6746('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59fc3a);throw _0x59fc3a;});}return _0x2d6ca2;})['then'](respondWithResult(_0x58df55,0xc9))['catch'](handleError(_0x58df55,null));};exports[_0x6746('0x27')]=function(_0x3105e2,_0x41a485){if(_0x3105e2[_0x6746('0x4c')]['id']){delete _0x3105e2['body']['id'];}return db[_0x6746('0x32')][_0x6746('0x4a')]({'where':{'id':_0x3105e2[_0x6746('0x53')]['id']}})[_0x6746('0x28')](handleEntityNotFound(_0x41a485,null))[_0x6746('0x28')](saveUpdates(_0x3105e2[_0x6746('0x4c')],null))[_0x6746('0x28')](respondWithResult(_0x41a485,null))[_0x6746('0x47')](handleError(_0x41a485,null));};exports[_0x6746('0x29')]=function(_0x328d10,_0x346473){return db['Schedule'][_0x6746('0x4a')]({'where':{'id':_0x328d10[_0x6746('0x53')]['id']}})[_0x6746('0x28')](handleEntityNotFound(_0x346473,null))[_0x6746('0x28')](removeEntity(_0x346473,null))[_0x6746('0x47')](handleError(_0x346473,null));};exports[_0x6746('0x54')]=function(_0x323154,_0x58f6fb,_0x106ca4){var _0x38f9de=require('../../config/schedule');return db['Schedule'][_0x6746('0x4a')]({'where':{'id':_0x323154[_0x6746('0x53')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x58f6fb,null))[_0x6746('0x28')](function(){_0x38f9de[_0x6746('0x54')](_0x323154[_0x6746('0x53')]['id']);})['then'](respondWithStatusCode(_0x58f6fb,null))[_0x6746('0x47')](handleError(_0x58f6fb,null));};
\ No newline at end of file
index 34c865d..60bd0e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x77c5=['./schedule.attributes','exports','Schedule','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x130719,_0x2a7018){var _0x159865=function(_0x3a4d06){while(--_0x3a4d06){_0x130719['push'](_0x130719['shift']());}};_0x159865(++_0x2a7018);}(_0x77c5,0x116));var _0x577c=function(_0x4dbbfa,_0x41560f){_0x4dbbfa=_0x4dbbfa-0x0;var _0x1fef6e=_0x77c5[_0x4dbbfa];return _0x1fef6e;};'use strict';var _=require(_0x577c('0x0'));var util=require(_0x577c('0x1'));var logger=require(_0x577c('0x2'))(_0x577c('0x3'));var moment=require(_0x577c('0x4'));var BPromise=require(_0x577c('0x5'));var rp=require(_0x577c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x577c('0x7'));var config=require('../../config/environment');var attributes=require(_0x577c('0x8'));module[_0x577c('0x9')]=function(_0x5bc6fc,_0x5c2bcd){return _0x5bc6fc['define'](_0x577c('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x66be=['path','rimraf','./schedule.attributes','exports','define','Schedule','lodash','util','api','moment'];(function(_0x59c0e4,_0x3def38){var _0x1fa13e=function(_0x1b28fc){while(--_0x1b28fc){_0x59c0e4['push'](_0x59c0e4['shift']());}};_0x1fa13e(++_0x3def38);}(_0x66be,0x16e));var _0xe66b=function(_0x4b5a28,_0x40b0df){_0x4b5a28=_0x4b5a28-0x0;var _0x287ee6=_0x66be[_0x4b5a28];return _0x287ee6;};'use strict';var _=require(_0xe66b('0x0'));var util=require(_0xe66b('0x1'));var logger=require('../../config/logger')(_0xe66b('0x2'));var moment=require(_0xe66b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe66b('0x4'));var rimraf=require(_0xe66b('0x5'));var config=require('../../config/environment');var attributes=require(_0xe66b('0x6'));module[_0xe66b('0x7')]=function(_0x4925e1,_0x322af6){return _0x4925e1[_0xe66b('0x8')](_0xe66b('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 084a6b3..5b4ad00 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x552e=['then','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4bdeb0,_0x4189a0){var _0x2fb02f=function(_0x1e6a02){while(--_0x1e6a02){_0x4bdeb0['push'](_0x4bdeb0['shift']());}};_0x2fb02f(++_0x4189a0);}(_0x552e,0x159));var _0xe552=function(_0x5e7b5a,_0x2434ef){_0x5e7b5a=_0x5e7b5a-0x0;var _0x435b63=_0x552e[_0x5e7b5a];return _0x435b63;};'use strict';var _=require(_0xe552('0x0'));var util=require(_0xe552('0x1'));var moment=require(_0xe552('0x2'));var BPromise=require('bluebird');var rs=require(_0xe552('0x3'));var fs=require('fs');var Redis=require(_0xe552('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe552('0x5'));var logger=require('../../config/logger')(_0xe552('0x6'));var config=require(_0xe552('0x7'));var jayson=require(_0xe552('0x8'));var client=jayson[_0xe552('0x9')][_0xe552('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c23fb,_0x22bc3a,_0x3eaab2){return new BPromise(function(_0x14b2cc,_0x54fb23){return client[_0xe552('0xb')](_0x2c23fb,_0x3eaab2)[_0xe552('0xc')](function(_0xe787b3){logger[_0xe552('0xd')](_0xe552('0xe'),_0x22bc3a,'request\x20sent');logger['debug'](_0xe552('0xf'),_0x22bc3a,'request\x20sent',JSON[_0xe552('0x10')](_0xe787b3));if(_0xe787b3[_0xe552('0x11')]){if(_0xe787b3[_0xe552('0x11')]['code']===0x1f4){logger[_0xe552('0x11')]('Schedule,\x20%s,\x20%s',_0x22bc3a,_0xe787b3[_0xe552('0x11')][_0xe552('0x12')]);return _0x54fb23(_0xe787b3[_0xe552('0x11')][_0xe552('0x12')]);}logger['error'](_0xe552('0xe'),_0x22bc3a,_0xe787b3[_0xe552('0x11')][_0xe552('0x12')]);return _0x14b2cc(_0xe787b3['error'][_0xe552('0x12')]);}else{logger[_0xe552('0xd')]('Schedule,\x20%s,\x20%s',_0x22bc3a,'request\x20sent');_0x14b2cc(_0xe787b3[_0xe552('0x13')]['message']);}})[_0xe552('0x14')](function(_0x2e0428){logger[_0xe552('0x11')]('Schedule,\x20%s,\x20%s',_0x22bc3a,_0x2e0428);_0x54fb23(_0x2e0428);});});}
\ No newline at end of file
+var _0x4eff=['request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x346e6b,_0x1f4479){var _0x15f973=function(_0x576d2e){while(--_0x576d2e){_0x346e6b['push'](_0x346e6b['shift']());}};_0x15f973(++_0x1f4479);}(_0x4eff,0x14a));var _0xf4ef=function(_0x47c4bd,_0x51def0){_0x47c4bd=_0x47c4bd-0x0;var _0x1c23d5=_0x4eff[_0x47c4bd];return _0x1c23d5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf4ef('0x0'));var BPromise=require(_0xf4ef('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4ef('0x2'));var db=require(_0xf4ef('0x3'))['db'];var utils=require(_0xf4ef('0x4'));var logger=require('../../config/logger')(_0xf4ef('0x5'));var config=require(_0xf4ef('0x6'));var jayson=require(_0xf4ef('0x7'));var client=jayson[_0xf4ef('0x8')][_0xf4ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x336768,_0x363983,_0x2d7557){return new BPromise(function(_0x2b2b02,_0x5a01b1){return client[_0xf4ef('0xa')](_0x336768,_0x2d7557)[_0xf4ef('0xb')](function(_0x7890ee){logger[_0xf4ef('0xc')](_0xf4ef('0xd'),_0x363983,'request\x20sent');logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x363983,_0xf4ef('0xe'),JSON['stringify'](_0x7890ee));if(_0x7890ee[_0xf4ef('0xf')]){if(_0x7890ee[_0xf4ef('0xf')][_0xf4ef('0x10')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x363983,_0x7890ee[_0xf4ef('0xf')][_0xf4ef('0x11')]);return _0x5a01b1(_0x7890ee['error']['message']);}logger['error']('Schedule,\x20%s,\x20%s',_0x363983,_0x7890ee[_0xf4ef('0xf')][_0xf4ef('0x11')]);return _0x2b2b02(_0x7890ee[_0xf4ef('0xf')][_0xf4ef('0x11')]);}else{logger['info'](_0xf4ef('0xd'),_0x363983,_0xf4ef('0xe'));_0x2b2b02(_0x7890ee[_0xf4ef('0x12')][_0xf4ef('0x11')]);}})[_0xf4ef('0x13')](function(_0x54fe91){logger['error'](_0xf4ef('0xd'),_0x363983,_0x54fe91);_0x5a01b1(_0x54fe91);});});}
\ No newline at end of file
index 96c24f9..c76db34 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xecd6=['get','isAuthenticated','index','/describe','describe','/:id','/:id/download','post','create','put','update','delete','destroy','path','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3c0fa7,_0x34a2eb){var _0xac3e17=function(_0xbd3554){while(--_0xbd3554){_0x3c0fa7['push'](_0x3c0fa7['shift']());}};_0xac3e17(++_0x34a2eb);}(_0xecd6,0xc1));var _0x6ecd=function(_0x334c71,_0x10ef95){_0x334c71=_0x334c71-0x0;var _0x1b3b5c=_0xecd6[_0x334c71];return _0x1b3b5c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6ecd('0x0'));var timeout=require('connect-timeout');var express=require(_0x6ecd('0x1'));var router=express['Router']();var fs_extra=require(_0x6ecd('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x6ecd('0x3'));var config=require(_0x6ecd('0x4'));var controller=require('./screenRecording.controller');router[_0x6ecd('0x5')]('/',auth[_0x6ecd('0x6')](),controller[_0x6ecd('0x7')]);router[_0x6ecd('0x5')](_0x6ecd('0x8'),auth[_0x6ecd('0x6')](),controller[_0x6ecd('0x9')]);router[_0x6ecd('0x5')](_0x6ecd('0xa'),auth[_0x6ecd('0x6')](),controller['show']);router[_0x6ecd('0x5')](_0x6ecd('0xb'),auth[_0x6ecd('0x6')](),controller['download']);router[_0x6ecd('0xc')]('/',auth[_0x6ecd('0x6')](),controller[_0x6ecd('0xd')]);router[_0x6ecd('0xe')](_0x6ecd('0xa'),auth[_0x6ecd('0x6')](),controller[_0x6ecd('0xf')]);router[_0x6ecd('0x10')](_0x6ecd('0xa'),auth['isAuthenticated'](),controller[_0x6ecd('0x11')]);module['exports']=router;
\ No newline at end of file
+var _0xd12d=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','/:id/download','download','post','create','put','/:id','update','delete'];(function(_0x333fc8,_0x2b292c){var _0x432439=function(_0x5501b6){while(--_0x5501b6){_0x333fc8['push'](_0x333fc8['shift']());}};_0x432439(++_0x2b292c);}(_0xd12d,0x122));var _0xdd12=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xd12d[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require(_0xdd12('0x0'));var util=require('util');var path=require(_0xdd12('0x1'));var timeout=require('connect-timeout');var express=require(_0xdd12('0x2'));var router=express[_0xdd12('0x3')]();var fs_extra=require(_0xdd12('0x4'));var auth=require(_0xdd12('0x5'));var interaction=require(_0xdd12('0x6'));var config=require(_0xdd12('0x7'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0xdd12('0x8')](),controller[_0xdd12('0x9')]);router[_0xdd12('0xa')](_0xdd12('0xb'),auth['isAuthenticated'](),controller[_0xdd12('0xc')]);router[_0xdd12('0xa')]('/:id',auth[_0xdd12('0x8')](),controller[_0xdd12('0xd')]);router['get'](_0xdd12('0xe'),auth[_0xdd12('0x8')](),controller[_0xdd12('0xf')]);router[_0xdd12('0x10')]('/',auth[_0xdd12('0x8')](),controller[_0xdd12('0x11')]);router[_0xdd12('0x12')](_0xdd12('0x13'),auth[_0xdd12('0x8')](),controller[_0xdd12('0x14')]);router[_0xdd12('0x15')]('/:id',auth[_0xdd12('0x8')](),controller[_0xdd12('0x16')]);module[_0xdd12('0x17')]=router;
\ No newline at end of file
index aabd1b5..0a235f8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d8a=['exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','DATE','createdAt','updatedAt','sequelize','moment','path','../../config/environment'];(function(_0x3a73bc,_0x550aef){var _0x32891b=function(_0x20b4cb){while(--_0x20b4cb){_0x3a73bc['push'](_0x3a73bc['shift']());}};_0x32891b(++_0x550aef);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0x7d8a[_0x1db251];return _0x56685a;};'use strict';var Sequelize=require(_0xa7d8('0x0'));var moment=require(_0xa7d8('0x1'));var path=require(_0xa7d8('0x2'));var config=require(_0xa7d8('0x3'));module[_0xa7d8('0x4')]={'format':{'type':Sequelize[_0xa7d8('0x5')],'get':function(){return this[_0xa7d8('0x6')](_0xa7d8('0x7'))?path[_0xa7d8('0x8')](this[_0xa7d8('0x6')](_0xa7d8('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xa7d8('0x9')]},'channel':{'type':Sequelize[_0xa7d8('0x9')]},'value':{'type':Sequelize[_0xa7d8('0x9')],'set':function(_0x55bb66){var _0x410b09=_0x55bb66[_0xa7d8('0xa')](/\\/g,'/');this[_0xa7d8('0xb')](_0xa7d8('0x7'),_0x410b09);}},'rating':{'type':Sequelize[_0xa7d8('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x40f419){this['setDataValue'](_0xa7d8('0xd'),moment()['subtract'](_0x40f419,'ms'));this[_0xa7d8('0xb')]('closedAt',moment());this[_0xa7d8('0xb')](_0xa7d8('0xe'),_0x40f419);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa7d8('0x6')]('startedAt'))[_0xa7d8('0xf')](_0xa7d8('0x10'))[_0xa7d8('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa7d8('0x6')](_0xa7d8('0x12')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0xa7d8('0x13')],'get':function(){return moment(this[_0xa7d8('0x6')](_0xa7d8('0x14')))[_0xa7d8('0xf')](_0xa7d8('0x10'))[_0xa7d8('0x11')]();}},'updatedAt':{'type':Sequelize[_0xa7d8('0x13')],'get':function(){return moment(this[_0xa7d8('0x6')](_0xa7d8('0x15')))[_0xa7d8('0xf')](_0xa7d8('0x10'))[_0xa7d8('0x11')]();}}};
\ No newline at end of file
+var _0xe1c4=['replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','toString','createdAt','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','path','VIRTUAL','value','extname','getDataValue','STRING'];(function(_0x32b598,_0x1e3254){var _0x35fc8e=function(_0x391344){while(--_0x391344){_0x32b598['push'](_0x32b598['shift']());}};_0x35fc8e(++_0x1e3254);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0x10c74e,_0x4182c1){_0x10c74e=_0x10c74e-0x0;var _0x5048a5=_0xe1c4[_0x10c74e];return _0x5048a5;};'use strict';var Sequelize=require(_0x4e1c('0x0'));var moment=require(_0x4e1c('0x1'));var path=require(_0x4e1c('0x2'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x4e1c('0x3')],'get':function(){return this['getDataValue'](_0x4e1c('0x4'))?path[_0x4e1c('0x5')](this[_0x4e1c('0x6')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4e1c('0x7')]},'value':{'type':Sequelize[_0x4e1c('0x7')],'set':function(_0x44db21){var _0x1c7e52=_0x44db21[_0x4e1c('0x8')](/\\/g,'/');this[_0x4e1c('0x9')](_0x4e1c('0x4'),_0x1c7e52);}},'rating':{'type':Sequelize[_0x4e1c('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x4e1c('0xa')],'set':function(_0x60e98c){this[_0x4e1c('0x9')](_0x4e1c('0xb'),moment()[_0x4e1c('0xc')](_0x60e98c,'ms'));this['setDataValue'](_0x4e1c('0xd'),moment());this[_0x4e1c('0x9')]('duration',_0x60e98c);}},'startedAt':{'type':Sequelize[_0x4e1c('0xe')],'get':function(){return moment(this[_0x4e1c('0x6')](_0x4e1c('0xb')))[_0x4e1c('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x4e1c('0x10')]();}},'closedAt':{'type':Sequelize[_0x4e1c('0xe')],'get':function(){return moment(this[_0x4e1c('0x6')](_0x4e1c('0xd')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x4e1c('0xe')],'get':function(){return moment(this[_0x4e1c('0x6')](_0x4e1c('0x11')))[_0x4e1c('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x4e1c('0x10')]();}},'updatedAt':{'type':Sequelize[_0x4e1c('0xe')],'get':function(){return moment(this[_0x4e1c('0x6')](_0x4e1c('0x12')))[_0x4e1c('0xf')](_0x4e1c('0x13'))['toString']();}}};
\ No newline at end of file
index d24c3e7..2b62a4f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd6d6=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','catch','find','create','body','duration','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4194f1,_0x4f2fec){var _0x175623=function(_0x5c7627){while(--_0x5c7627){_0x4194f1['push'](_0x4194f1['shift']());}};_0x175623(++_0x4f2fec);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x4f11b8,_0x4d769b){_0x4f11b8=_0x4f11b8-0x0;var _0x75486a=_0xd6d6[_0x4f11b8];return _0x75486a;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0xf0df7f,_0x12fab2){return function(_0x554f8e){if(!_0x554f8e){_0xf0df7f[_0x6d6d('0x19')](0x194);}return _0x554f8e;};}function handleError(_0x2b5e31,_0x235451){_0x235451=_0x235451||0x1f4;return function(_0x126ac8){logger[_0x6d6d('0x29')](_0x126ac8[_0x6d6d('0x2a')]);if(_0x126ac8[_0x6d6d('0x2b')]){delete _0x126ac8['name'];}_0x2b5e31[_0x6d6d('0x1a')](_0x235451)[_0x6d6d('0x2c')](_0x126ac8);};}exports['index']=function(_0x553645,_0x3edcce){var _0x5273cd={},_0x8a9a84={},_0x57341f={'count':0x0,'rows':[]};var _0xde3272=_[_0x6d6d('0x2d')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')],function(_0x64d1f7){return{'name':_0x64d1f7[_0x6d6d('0x30')],'type':_0x64d1f7[_0x6d6d('0x31')][_0x6d6d('0x32')]};});_0x8a9a84[_0x6d6d('0x33')]=_[_0x6d6d('0x34')](_['map'](_0xde3272,_0x6d6d('0x2b')),['format']);_0x8a9a84[_0x6d6d('0x35')]=_[_0x6d6d('0x36')](_0x553645[_0x6d6d('0x35')]);_0x8a9a84[_0x6d6d('0x37')]=_['intersection'](_0x8a9a84[_0x6d6d('0x33')],_0x8a9a84['query']);_0x5273cd[_0x6d6d('0x38')]=_[_0x6d6d('0x39')](_0x8a9a84['model'],qs[_0x6d6d('0x3a')](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3a')]));_0x5273cd[_0x6d6d('0x38')]=_0x5273cd[_0x6d6d('0x38')][_0x6d6d('0x3b')]?_0x5273cd[_0x6d6d('0x38')]:_0x8a9a84[_0x6d6d('0x33')];if(!_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3c')](_0x6d6d('0x3d'))){_0x5273cd[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x553645[_0x6d6d('0x35')]['limit']);_0x5273cd[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x1f')]);}_0x5273cd['order']=qs['sort'](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3e')]);_0x5273cd[_0x6d6d('0x3f')]=qs['filters'](_[_0x6d6d('0x40')](_0x553645[_0x6d6d('0x35')],_0x8a9a84[_0x6d6d('0x37')]),_0xde3272);if(_0x553645[_0x6d6d('0x35')]['filter']){_0x5273cd['where']=_['merge'](_0x5273cd[_0x6d6d('0x3f')],{'$or':_[_0x6d6d('0x2d')](_0xde3272,function(_0x33c8f2){if(_0x33c8f2[_0x6d6d('0x31')]!=='VIRTUAL'){var _0x253416={};_0x253416[_0x33c8f2[_0x6d6d('0x2b')]]={'$like':'%'+_0x553645[_0x6d6d('0x35')][_0x6d6d('0x41')]+'%'};return _0x253416;}})});}_0x5273cd=_[_0x6d6d('0x42')]({},_0x5273cd,_0x553645[_0x6d6d('0x43')]);var _0x4b457d={'where':_0x5273cd[_0x6d6d('0x3f')]};return db[_0x6d6d('0x2e')][_0x6d6d('0x20')](_0x4b457d)[_0x6d6d('0x27')](function(_0x32275b){_0x57341f[_0x6d6d('0x20')]=_0x32275b;if(_0x553645[_0x6d6d('0x35')]['includeAll']){_0x5273cd[_0x6d6d('0x44')]=[{'all':!![]}];}return db[_0x6d6d('0x2e')][_0x6d6d('0x45')](_0x5273cd);})[_0x6d6d('0x27')](function(_0xe1aa77){_0x57341f['rows']=_0xe1aa77;return _0x57341f;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x3edcce,_0x5273cd))[_0x6d6d('0x46')](handleError(_0x3edcce,null));};exports['show']=function(_0x452de2,_0x50dc17){var _0x15bf62={'raw':![],'where':{'id':_0x452de2['params']['id']}},_0x43c03c={};_0x43c03c[_0x6d6d('0x33')]=_[_0x6d6d('0x36')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')]);_0x43c03c[_0x6d6d('0x35')]=_['keys'](_0x452de2['query']);_0x43c03c[_0x6d6d('0x37')]=_['intersection'](_0x43c03c['model'],_0x43c03c[_0x6d6d('0x35')]);_0x15bf62[_0x6d6d('0x38')]=_[_0x6d6d('0x39')](_0x43c03c['model'],qs[_0x6d6d('0x3a')](_0x452de2['query'][_0x6d6d('0x3a')]));_0x15bf62[_0x6d6d('0x38')]=_0x15bf62[_0x6d6d('0x38')][_0x6d6d('0x3b')]?_0x15bf62[_0x6d6d('0x38')]:_0x43c03c[_0x6d6d('0x33')];if(_0x452de2[_0x6d6d('0x35')]['includeAll']){_0x15bf62[_0x6d6d('0x44')]=[{'all':!![]}];}_0x15bf62=_[_0x6d6d('0x42')]({},_0x15bf62,_0x452de2[_0x6d6d('0x43')]);return db[_0x6d6d('0x2e')][_0x6d6d('0x47')](_0x15bf62)[_0x6d6d('0x27')](handleEntityNotFound(_0x50dc17,null))[_0x6d6d('0x27')](respondWithResult(_0x50dc17,null))[_0x6d6d('0x46')](handleError(_0x50dc17,null));};exports[_0x6d6d('0x48')]=function(_0x5e4c04,_0x4d78bb){return db[_0x6d6d('0x2e')][_0x6d6d('0x48')](_0x5e4c04[_0x6d6d('0x49')],{})[_0x6d6d('0x27')](respondWithResult(_0x4d78bb,0xc9))[_0x6d6d('0x46')](handleError(_0x4d78bb,null));};exports['update']=function(_0x47170d,_0x27b396){if(_0x47170d[_0x6d6d('0x49')]['id']){delete _0x47170d[_0x6d6d('0x49')]['id'];}delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4a')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4b')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4c')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4d')];return db['ScreenRecording'][_0x6d6d('0x47')]({'where':{'id':_0x47170d[_0x6d6d('0x4e')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x27b396,null))[_0x6d6d('0x27')](saveUpdates(_0x47170d[_0x6d6d('0x49')],null))['then'](respondWithResult(_0x27b396,null))[_0x6d6d('0x46')](handleError(_0x27b396,null));};exports[_0x6d6d('0x4f')]=function(_0x45340b,_0x4e4c3e){return db['ScreenRecording'][_0x6d6d('0x4f')]()['then'](respondWithResult(_0x4e4c3e,null))[_0x6d6d('0x46')](handleError(_0x4e4c3e,null));};exports[_0x6d6d('0x50')]=function(_0x32aaae,_0x268361,_0x4777a5){var _0x18e2de=require(_0x6d6d('0x51'));var _0x26c23a=![];var _0x1a8f33={};if(_0x32aaae[_0x6d6d('0x35')]['type']&&_0x32aaae[_0x6d6d('0x35')][_0x6d6d('0x31')]===_0x6d6d('0x52')){_0x1a8f33[_0x6d6d('0x52')]=_0x32aaae[_0x6d6d('0x4e')]['id'];}else{_0x1a8f33['id']=_0x32aaae[_0x6d6d('0x4e')]['id'];}return db[_0x6d6d('0x2e')]['find']({'where':_0x1a8f33,'attributes':['id','value'],'raw':!![]})[_0x6d6d('0x27')](handleEntityNotFound(_0x268361,null))[_0x6d6d('0x27')](function(_0x5cc644){if(_0x5cc644){var _0x3e98a0=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],_0x6d6d('0x55'),_0x5cc644[_0x6d6d('0x4d')]);var _0xc6b96e=util[_0x6d6d('0x56')](_0x6d6d('0x57'),_0x3e98a0);if(fs[_0x6d6d('0x58')](_0xc6b96e)){_0x26c23a=!![];return _0x18e2de[_0x6d6d('0x59')](_0xc6b96e,_0x3e98a0,config[_0x6d6d('0x5a')][_0x6d6d('0x5b')])[_0x6d6d('0x27')](function(){return _0x5cc644;});}return _0x5cc644;}})[_0x6d6d('0x27')](function(_0x3065ea){if(_0x3065ea){var _0x50d8dd=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],'server/files/screen_recordings',_0x3065ea[_0x6d6d('0x4d')]);if(!fs[_0x6d6d('0x58')](_0x50d8dd)){throw new db[(_0x6d6d('0x5c'))][(_0x6d6d('0x5d'))](_0x6d6d('0x5e'));}if(_0x3065ea[_0x6d6d('0x5f')]){return _0x268361[_0x6d6d('0x50')](_0x50d8dd,_0x3065ea[_0x6d6d('0x5f')]+path[_0x6d6d('0x60')](_0x50d8dd),function(){if(_0x26c23a){fs['unlink'](_0x50d8dd);}});}else{return _0x268361['download'](_0x50d8dd,function(_0x22c3a1){if(_0x26c23a){fs[_0x6d6d('0x61')](_0x50d8dd);}});}}})[_0x6d6d('0x46')](function(_0x5de33f){if(_0x5de33f['message']===_0x6d6d('0x5e')){_0x268361['status'](0x194)[_0x6d6d('0x2c')]('Not\x20found');}else{return handleError(_0x268361,null);}});};exports[_0x6d6d('0x28')]=function(_0x367a6f,_0x21f14c){return db[_0x6d6d('0x2e')][_0x6d6d('0x47')]({'where':{'id':_0x367a6f[_0x6d6d('0x4e')]['id']}})['then'](function(_0x41e576){if(_['isNil'](_0x41e576)){throw new ReferenceError(_0x6d6d('0x62'));}return _0x41e576;})['then'](function(_0x2a21d8){var _0x3e48f7=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],_0x6d6d('0x55'),_0x2a21d8[_0x6d6d('0x4d')]);logger[_0x6d6d('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x3e48f7);if(!_['isNil'](_0x2a21d8[_0x6d6d('0x4d')])&&fs['existsSync'](_0x3e48f7)){logger[_0x6d6d('0x63')]('File:\x20\x22'+_0x3e48f7+_0x6d6d('0x64'));fs[_0x6d6d('0x65')](_0x3e48f7);}_0x3e48f7=_0x3e48f7+_0x6d6d('0x66');if(!_[_0x6d6d('0x67')](_0x2a21d8[_0x6d6d('0x4d')])&&fs[_0x6d6d('0x58')](_0x3e48f7)){logger['info'](_0x6d6d('0x68')+_0x3e48f7+_0x6d6d('0x64'));fs[_0x6d6d('0x65')](_0x3e48f7);}return _0x2a21d8;})[_0x6d6d('0x27')](function(_0x1ba731){if(!_0x1ba731)throw new InternalError();return _0x1ba731[_0x6d6d('0x28')]();})[_0x6d6d('0x27')](function(){_0x21f14c['status'](0xcc)[_0x6d6d('0x1b')]();})[_0x6d6d('0x46')](handleError(_0x21f14c,null));};
\ No newline at end of file
+var _0xac9d=['extname','unlink','send','Not\x20found','isNil','Entity\x20not\x20found','root','info','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','closedAt','value','describe','download','../../components/encryptor','uniqueid','params','join','server/files/screen_recordings','%s.cypher','existsSync','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename'];(function(_0x32f814,_0x430362){var _0x3ab9be=function(_0x5b909f){while(--_0x5b909f){_0x32f814['push'](_0x32f814['shift']());}};_0x3ab9be(++_0x430362);}(_0xac9d,0x14d));var _0xdac9=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0xac9d[_0x289a67];return _0x572b49;};'use strict';var emlformat=require(_0xdac9('0x0'));var rimraf=require(_0xdac9('0x1'));var zipdir=require(_0xdac9('0x2'));var jsonpatch=require(_0xdac9('0x3'));var rp=require(_0xdac9('0x4'));var moment=require(_0xdac9('0x5'));var BPromise=require(_0xdac9('0x6'));var Mustache=require(_0xdac9('0x7'));var util=require('util');var path=require(_0xdac9('0x8'));var sox=require('sox');var csv=require(_0xdac9('0x9'));var ejs=require(_0xdac9('0xa'));var fs=require('fs');var fs_extra=require(_0xdac9('0xb'));var _=require(_0xdac9('0xc'));var squel=require(_0xdac9('0xd'));var crypto=require(_0xdac9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdac9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdac9('0x10'));var Papa=require(_0xdac9('0x11'));var Redis=require(_0xdac9('0x12'));var authService=require(_0xdac9('0x13'));var qs=require(_0xdac9('0x14'));var as=require(_0xdac9('0x15'));var hardwareService=require(_0xdac9('0x16'));var logger=require(_0xdac9('0x17'))(_0xdac9('0x18'));var utils=require('../../config/utils');var config=require(_0xdac9('0x19'));var licenseUtil=require(_0xdac9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d8e97,_0xeddbc1){_0xeddbc1=_0xeddbc1||0xcc;return function(_0xbfe6d8){if(_0xbfe6d8){return _0x3d8e97['sendStatus'](_0xeddbc1);}return _0x3d8e97[_0xdac9('0x1b')](_0xeddbc1)[_0xdac9('0x1c')]();};}function respondWithResult(_0x9e1bf6,_0x5f0bbd){_0x5f0bbd=_0x5f0bbd||0xc8;return function(_0x5dd536){if(_0x5dd536){return _0x9e1bf6[_0xdac9('0x1b')](_0x5f0bbd)[_0xdac9('0x1d')](_0x5dd536);}};}function respondWithFilteredResult(_0x50f9fe,_0x76af7a){return function(_0x36cbe4){if(_0x36cbe4){var _0x152ea5=typeof _0x76af7a[_0xdac9('0x1e')]===_0xdac9('0x1f')&&typeof _0x76af7a[_0xdac9('0x20')]===_0xdac9('0x1f');var _0xec1016=_0x36cbe4['count'];var _0x283343=_0x152ea5?0x0:_0x76af7a[_0xdac9('0x1e')];var _0x571e07=_0x152ea5?_0x36cbe4[_0xdac9('0x21')]:_0x76af7a[_0xdac9('0x1e')]+_0x76af7a[_0xdac9('0x20')];var _0x181d11;if(_0x571e07>=_0xec1016){_0x571e07=_0xec1016;_0x181d11=0xc8;}else{_0x181d11=0xce;}_0x50f9fe['status'](_0x181d11);return _0x50f9fe['set'](_0xdac9('0x22'),_0x283343+'-'+_0x571e07+'/'+_0xec1016)[_0xdac9('0x1d')](_0x36cbe4);}return null;};}function patchUpdates(_0x2b9d91){return function(_0x395ec7){try{jsonpatch['apply'](_0x395ec7,_0x2b9d91,!![]);}catch(_0x23ee5e){return BPromise[_0xdac9('0x23')](_0x23ee5e);}return _0x395ec7[_0xdac9('0x24')]();};}function saveUpdates(_0xae680a,_0xe7bd10){return function(_0x42317c){if(_0x42317c){return _0x42317c[_0xdac9('0x25')](_0xae680a)[_0xdac9('0x26')](function(_0x419f0c){return _0x419f0c;});}return null;};}function removeEntity(_0x33de5c,_0x5a0fa2){return function(_0x2943f5){if(_0x2943f5){return _0x2943f5[_0xdac9('0x27')]()[_0xdac9('0x26')](function(){_0x33de5c[_0xdac9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e631a,_0x5686db){return function(_0x3ce475){if(!_0x3ce475){_0x1e631a[_0xdac9('0x28')](0x194);}return _0x3ce475;};}function handleError(_0x566d8c,_0x433be9){_0x433be9=_0x433be9||0x1f4;return function(_0x5105f1){logger[_0xdac9('0x29')](_0x5105f1[_0xdac9('0x2a')]);if(_0x5105f1[_0xdac9('0x2b')]){delete _0x5105f1[_0xdac9('0x2b')];}_0x566d8c['status'](_0x433be9)['send'](_0x5105f1);};}exports[_0xdac9('0x2c')]=function(_0x170afd,_0x4fe3bd){var _0x4c4e21={},_0x3eed7a={},_0x3505c5={'count':0x0,'rows':[]};var _0x13efba=_[_0xdac9('0x2d')](db[_0xdac9('0x2e')][_0xdac9('0x2f')],function(_0xed99f9){return{'name':_0xed99f9[_0xdac9('0x30')],'type':_0xed99f9[_0xdac9('0x31')][_0xdac9('0x32')]};});_0x3eed7a[_0xdac9('0x33')]=_[_0xdac9('0x34')](_[_0xdac9('0x2d')](_0x13efba,_0xdac9('0x2b')),[_0xdac9('0x35')]);_0x3eed7a[_0xdac9('0x36')]=_[_0xdac9('0x37')](_0x170afd[_0xdac9('0x36')]);_0x3eed7a[_0xdac9('0x38')]=_[_0xdac9('0x39')](_0x3eed7a[_0xdac9('0x33')],_0x3eed7a['query']);_0x4c4e21['attributes']=_[_0xdac9('0x39')](_0x3eed7a[_0xdac9('0x33')],qs[_0xdac9('0x3a')](_0x170afd[_0xdac9('0x36')][_0xdac9('0x3a')]));_0x4c4e21['attributes']=_0x4c4e21[_0xdac9('0x3b')]['length']?_0x4c4e21[_0xdac9('0x3b')]:_0x3eed7a[_0xdac9('0x33')];if(!_0x170afd['query'][_0xdac9('0x3c')]('nolimit')){_0x4c4e21['limit']=qs[_0xdac9('0x20')](_0x170afd[_0xdac9('0x36')][_0xdac9('0x20')]);_0x4c4e21[_0xdac9('0x1e')]=qs[_0xdac9('0x1e')](_0x170afd[_0xdac9('0x36')]['offset']);}_0x4c4e21[_0xdac9('0x3d')]=qs[_0xdac9('0x3e')](_0x170afd['query'][_0xdac9('0x3e')]);_0x4c4e21[_0xdac9('0x3f')]=qs[_0xdac9('0x38')](_[_0xdac9('0x40')](_0x170afd[_0xdac9('0x36')],_0x3eed7a[_0xdac9('0x38')]),_0x13efba);if(_0x170afd[_0xdac9('0x36')]['filter']){_0x4c4e21[_0xdac9('0x3f')]=_[_0xdac9('0x41')](_0x4c4e21[_0xdac9('0x3f')],{'$or':_['map'](_0x13efba,function(_0x9c732e){if(_0x9c732e[_0xdac9('0x31')]!==_0xdac9('0x42')){var _0x1d6f88={};_0x1d6f88[_0x9c732e['name']]={'$like':'%'+_0x170afd['query'][_0xdac9('0x43')]+'%'};return _0x1d6f88;}})});}_0x4c4e21=_[_0xdac9('0x41')]({},_0x4c4e21,_0x170afd[_0xdac9('0x44')]);var _0x260f0e={'where':_0x4c4e21[_0xdac9('0x3f')]};return db['ScreenRecording'][_0xdac9('0x21')](_0x260f0e)['then'](function(_0xd74baf){_0x3505c5[_0xdac9('0x21')]=_0xd74baf;if(_0x170afd[_0xdac9('0x36')][_0xdac9('0x45')]){_0x4c4e21[_0xdac9('0x46')]=[{'all':!![]}];}return db[_0xdac9('0x2e')][_0xdac9('0x47')](_0x4c4e21);})[_0xdac9('0x26')](function(_0x11362d){_0x3505c5[_0xdac9('0x48')]=_0x11362d;return _0x3505c5;})[_0xdac9('0x26')](respondWithFilteredResult(_0x4fe3bd,_0x4c4e21))[_0xdac9('0x49')](handleError(_0x4fe3bd,null));};exports[_0xdac9('0x4a')]=function(_0x441676,_0x5335ae){var _0x3857cf={'raw':![],'where':{'id':_0x441676['params']['id']}},_0x272b52={};_0x272b52[_0xdac9('0x33')]=_[_0xdac9('0x37')](db[_0xdac9('0x2e')][_0xdac9('0x2f')]);_0x272b52[_0xdac9('0x36')]=_[_0xdac9('0x37')](_0x441676['query']);_0x272b52[_0xdac9('0x38')]=_['intersection'](_0x272b52[_0xdac9('0x33')],_0x272b52[_0xdac9('0x36')]);_0x3857cf[_0xdac9('0x3b')]=_[_0xdac9('0x39')](_0x272b52['model'],qs['fields'](_0x441676['query'][_0xdac9('0x3a')]));_0x3857cf['attributes']=_0x3857cf['attributes'][_0xdac9('0x4b')]?_0x3857cf[_0xdac9('0x3b')]:_0x272b52['model'];if(_0x441676['query'][_0xdac9('0x45')]){_0x3857cf[_0xdac9('0x46')]=[{'all':!![]}];}_0x3857cf=_[_0xdac9('0x41')]({},_0x3857cf,_0x441676[_0xdac9('0x44')]);return db[_0xdac9('0x2e')][_0xdac9('0x4c')](_0x3857cf)[_0xdac9('0x26')](handleEntityNotFound(_0x5335ae,null))[_0xdac9('0x26')](respondWithResult(_0x5335ae,null))['catch'](handleError(_0x5335ae,null));};exports[_0xdac9('0x4d')]=function(_0x3bd946,_0xfa104f){return db[_0xdac9('0x2e')][_0xdac9('0x4d')](_0x3bd946[_0xdac9('0x4e')],{})[_0xdac9('0x26')](respondWithResult(_0xfa104f,0xc9))[_0xdac9('0x49')](handleError(_0xfa104f,null));};exports[_0xdac9('0x25')]=function(_0x242c24,_0x257e48){if(_0x242c24[_0xdac9('0x4e')]['id']){delete _0x242c24[_0xdac9('0x4e')]['id'];}delete _0x242c24[_0xdac9('0x4e')]['duration'];delete _0x242c24['body']['createdAt'];delete _0x242c24[_0xdac9('0x4e')][_0xdac9('0x4f')];delete _0x242c24['body'][_0xdac9('0x50')];return db[_0xdac9('0x2e')][_0xdac9('0x4c')]({'where':{'id':_0x242c24['params']['id']}})[_0xdac9('0x26')](handleEntityNotFound(_0x257e48,null))[_0xdac9('0x26')](saveUpdates(_0x242c24['body'],null))['then'](respondWithResult(_0x257e48,null))[_0xdac9('0x49')](handleError(_0x257e48,null));};exports[_0xdac9('0x51')]=function(_0x222de9,_0x370532){return db[_0xdac9('0x2e')][_0xdac9('0x51')]()[_0xdac9('0x26')](respondWithResult(_0x370532,null))[_0xdac9('0x49')](handleError(_0x370532,null));};exports[_0xdac9('0x52')]=function(_0x41579a,_0x10a2cc,_0x32b5f5){var _0xecb50a=require(_0xdac9('0x53'));var _0x35a378=![];var _0x5d0b43={};if(_0x41579a[_0xdac9('0x36')][_0xdac9('0x31')]&&_0x41579a[_0xdac9('0x36')][_0xdac9('0x31')]===_0xdac9('0x54')){_0x5d0b43[_0xdac9('0x54')]=_0x41579a['params']['id'];}else{_0x5d0b43['id']=_0x41579a[_0xdac9('0x55')]['id'];}return db[_0xdac9('0x2e')][_0xdac9('0x4c')]({'where':_0x5d0b43,'attributes':['id',_0xdac9('0x50')],'raw':!![]})[_0xdac9('0x26')](handleEntityNotFound(_0x10a2cc,null))[_0xdac9('0x26')](function(_0x1eec39){if(_0x1eec39){var _0x243862=path[_0xdac9('0x56')](config['root'],_0xdac9('0x57'),_0x1eec39[_0xdac9('0x50')]);var _0x3cab26=util[_0xdac9('0x35')](_0xdac9('0x58'),_0x243862);if(fs[_0xdac9('0x59')](_0x3cab26)){_0x35a378=!![];return _0xecb50a['decryptFile'](_0x3cab26,_0x243862,config['secrets'][_0xdac9('0x5a')])[_0xdac9('0x26')](function(){return _0x1eec39;});}return _0x1eec39;}})[_0xdac9('0x26')](function(_0x46017d){if(_0x46017d){var _0x1c1f5f=path[_0xdac9('0x56')](config['root'],'server/files/screen_recordings',_0x46017d['value']);if(!fs[_0xdac9('0x59')](_0x1c1f5f)){throw new db[(_0xdac9('0x5b'))][(_0xdac9('0x5c'))](_0xdac9('0x5d'));}if(_0x46017d['filename']){return _0x10a2cc[_0xdac9('0x52')](_0x1c1f5f,_0x46017d[_0xdac9('0x5e')]+path[_0xdac9('0x5f')](_0x1c1f5f),function(){if(_0x35a378){fs[_0xdac9('0x60')](_0x1c1f5f);}});}else{return _0x10a2cc[_0xdac9('0x52')](_0x1c1f5f,function(_0x496d9c){if(_0x35a378){fs[_0xdac9('0x60')](_0x1c1f5f);}});}}})['catch'](function(_0x60b64e){if(_0x60b64e['message']===_0xdac9('0x5d')){_0x10a2cc[_0xdac9('0x1b')](0x194)[_0xdac9('0x61')](_0xdac9('0x62'));}else{return handleError(_0x10a2cc,null);}});};exports[_0xdac9('0x27')]=function(_0x40dec7,_0x232440){return db['ScreenRecording']['find']({'where':{'id':_0x40dec7['params']['id']}})[_0xdac9('0x26')](function(_0x42ba53){if(_[_0xdac9('0x63')](_0x42ba53)){throw new ReferenceError(_0xdac9('0x64'));}return _0x42ba53;})[_0xdac9('0x26')](function(_0x29df1d){var _0x288e7e=path['join'](config[_0xdac9('0x65')],'server/files/screen_recordings',_0x29df1d['value']);logger[_0xdac9('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0x288e7e);if(!_['isNil'](_0x29df1d[_0xdac9('0x50')])&&fs[_0xdac9('0x59')](_0x288e7e)){logger[_0xdac9('0x66')]('File:\x20\x22'+_0x288e7e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xdac9('0x67')](_0x288e7e);}_0x288e7e=_0x288e7e+_0xdac9('0x68');if(!_['isNil'](_0x29df1d[_0xdac9('0x50')])&&fs[_0xdac9('0x59')](_0x288e7e)){logger[_0xdac9('0x66')](_0xdac9('0x69')+_0x288e7e+_0xdac9('0x6a'));fs[_0xdac9('0x67')](_0x288e7e);}return _0x29df1d;})[_0xdac9('0x26')](function(_0xef4531){if(!_0xef4531)throw new InternalError();return _0xef4531[_0xdac9('0x27')]();})[_0xdac9('0x26')](function(){_0x232440[_0xdac9('0x1b')](0xcc)[_0xdac9('0x1c')]();})['catch'](handleError(_0x232440,null));};
\ No newline at end of file
index 02ee9ed..968db91 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7349=['moment','request-promise','path','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','lodash','../../config/logger','api'];(function(_0x5b6cf1,_0x32fdcd){var _0x46278c=function(_0x53fd9b){while(--_0x53fd9b){_0x5b6cf1['push'](_0x5b6cf1['shift']());}};_0x46278c(++_0x32fdcd);}(_0x7349,0x195));var _0x9734=function(_0x4845dc,_0x47eaf6){_0x4845dc=_0x4845dc-0x0;var _0x284d2b=_0x7349[_0x4845dc];return _0x284d2b;};'use strict';var _=require(_0x9734('0x0'));var util=require('util');var logger=require(_0x9734('0x1'))(_0x9734('0x2'));var moment=require(_0x9734('0x3'));var BPromise=require('bluebird');var rp=require(_0x9734('0x4'));var fs=require('fs');var path=require(_0x9734('0x5'));var rimraf=require('rimraf');var config=require(_0x9734('0x6'));var attributes=require(_0x9734('0x7'));module[_0x9734('0x8')]=function(_0x19d9c6,_0xe92942){return _0x19d9c6[_0x9734('0x9')](_0x9734('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x9734('0xb'),'fields':['interactionid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x8e0c=['path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','api','bluebird','request-promise'];(function(_0xcab0a,_0x1e2789){var _0x5bfa6c=function(_0x5f1687){while(--_0x5f1687){_0xcab0a['push'](_0xcab0a['shift']());}};_0x5bfa6c(++_0x1e2789);}(_0x8e0c,0x70));var _0xc8e0=function(_0x3fd078,_0x42a360){_0x3fd078=_0x3fd078-0x0;var _0x4c9c6e=_0x8e0c[_0x3fd078];return _0x4c9c6e;};'use strict';var _=require(_0xc8e0('0x0'));var util=require(_0xc8e0('0x1'));var logger=require('../../config/logger')(_0xc8e0('0x2'));var moment=require('moment');var BPromise=require(_0xc8e0('0x3'));var rp=require(_0xc8e0('0x4'));var fs=require('fs');var path=require(_0xc8e0('0x5'));var rimraf=require(_0xc8e0('0x6'));var config=require(_0xc8e0('0x7'));var attributes=require(_0xc8e0('0x8'));module[_0xc8e0('0x9')]=function(_0x4fe18b,_0x1e9e55){return _0x4fe18b[_0xc8e0('0xa')]('ScreenRecording',attributes,{'tableName':_0xc8e0('0xb'),'paranoid':![],'indexes':[{'name':_0xc8e0('0xc'),'fields':[_0xc8e0('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
index 80173e4..781f5aa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4948=['then','info','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x526fea,_0x5b8219){var _0x50d1cf=function(_0x395d87){while(--_0x395d87){_0x526fea['push'](_0x526fea['shift']());}};_0x50d1cf(++_0x5b8219);}(_0x4948,0x1ed));var _0x8494=function(_0x4404d5,_0x4827e9){_0x4404d5=_0x4404d5-0x0;var _0x347175=_0x4948[_0x4404d5];return _0x347175;};'use strict';var _=require(_0x8494('0x0'));var util=require(_0x8494('0x1'));var moment=require('moment');var BPromise=require(_0x8494('0x2'));var rs=require(_0x8494('0x3'));var fs=require('fs');var Redis=require(_0x8494('0x4'));var db=require(_0x8494('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8494('0x6'))('rpc');var config=require(_0x8494('0x7'));var jayson=require(_0x8494('0x8'));var client=jayson['client'][_0x8494('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x565994,_0x26b47e,_0x49ee85){return new BPromise(function(_0x8b9248,_0x167b4c){return client[_0x8494('0xa')](_0x565994,_0x49ee85)[_0x8494('0xb')](function(_0x48238e){logger[_0x8494('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x26b47e,_0x8494('0xd'));logger['debug'](_0x8494('0xe'),_0x26b47e,'request\x20sent',JSON[_0x8494('0xf')](_0x48238e));if(_0x48238e[_0x8494('0x10')]){if(_0x48238e[_0x8494('0x10')]['code']===0x1f4){logger['error'](_0x8494('0x11'),_0x26b47e,_0x48238e[_0x8494('0x10')][_0x8494('0x12')]);return _0x167b4c(_0x48238e[_0x8494('0x10')][_0x8494('0x12')]);}logger[_0x8494('0x10')](_0x8494('0x11'),_0x26b47e,_0x48238e['error'][_0x8494('0x12')]);return _0x8b9248(_0x48238e[_0x8494('0x10')][_0x8494('0x12')]);}else{logger[_0x8494('0xc')](_0x8494('0x11'),_0x26b47e,_0x8494('0xd'));_0x8b9248(_0x48238e[_0x8494('0x13')][_0x8494('0x12')]);}})[_0x8494('0x14')](function(_0x4eba44){logger[_0x8494('0x10')](_0x8494('0x11'),_0x26b47e,_0x4eba44);_0x167b4c(_0x4eba44);});});}
\ No newline at end of file
+var _0x8622=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x223ffb,_0x2bd2ac){var _0x4bab7e=function(_0x5055ab){while(--_0x5055ab){_0x223ffb['push'](_0x223ffb['shift']());}};_0x4bab7e(++_0x2bd2ac);}(_0x8622,0x1a2));var _0x2862=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8622[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x2862('0x0'));var moment=require(_0x2862('0x1'));var BPromise=require(_0x2862('0x2'));var rs=require(_0x2862('0x3'));var fs=require('fs');var Redis=require(_0x2862('0x4'));var db=require(_0x2862('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2862('0x6'))(_0x2862('0x7'));var config=require(_0x2862('0x8'));var jayson=require(_0x2862('0x9'));var client=jayson['client'][_0x2862('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4369bf,_0x34b6fa,_0x2ec6be){return new BPromise(function(_0x3e032d,_0x5d2aa6){return client[_0x2862('0xb')](_0x4369bf,_0x2ec6be)['then'](function(_0x334f4f){logger[_0x2862('0xc')](_0x2862('0xd'),_0x34b6fa,_0x2862('0xe'));logger[_0x2862('0xf')](_0x2862('0x10'),_0x34b6fa,_0x2862('0xe'),JSON[_0x2862('0x11')](_0x334f4f));if(_0x334f4f[_0x2862('0x12')]){if(_0x334f4f[_0x2862('0x12')][_0x2862('0x13')]===0x1f4){logger[_0x2862('0x12')](_0x2862('0xd'),_0x34b6fa,_0x334f4f[_0x2862('0x12')][_0x2862('0x14')]);return _0x5d2aa6(_0x334f4f[_0x2862('0x12')][_0x2862('0x14')]);}logger[_0x2862('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x34b6fa,_0x334f4f['error'][_0x2862('0x14')]);return _0x3e032d(_0x334f4f['error'][_0x2862('0x14')]);}else{logger[_0x2862('0xc')](_0x2862('0xd'),_0x34b6fa,_0x2862('0xe'));_0x3e032d(_0x334f4f[_0x2862('0x15')][_0x2862('0x14')]);}})['catch'](function(_0x5b2801){logger[_0x2862('0x12')](_0x2862('0xd'),_0x34b6fa,_0x5b2801);_0x5d2aa6(_0x5b2801);});});}
\ No newline at end of file
index 3daf861..4957a10 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x167f=['/:id/favicon','diskStorage','root','format','%s%s','extname','originalname','post','single','file','addLogo','join','server/files/images/logos/','logologin','preferred','addPreferred','addFavicon','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','getDate','/:id','show','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred'];(function(_0x1eb7d8,_0x81d19b){var _0x464687=function(_0x4df0a7){while(--_0x4df0a7){_0x1eb7d8['push'](_0x1eb7d8['shift']());}};_0x464687(++_0x81d19b);}(_0x167f,0x1bf));var _0xf167=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0x167f[_0x11946c];return _0x383935;};'use strict';var multer=require('multer');var util=require(_0xf167('0x0'));var path=require(_0xf167('0x1'));var timeout=require(_0xf167('0x2'));var express=require(_0xf167('0x3'));var router=express[_0xf167('0x4')]();var fs_extra=require(_0xf167('0x5'));var auth=require(_0xf167('0x6'));var interaction=require(_0xf167('0x7'));var config=require(_0xf167('0x8'));var controller=require(_0xf167('0x9'));router[_0xf167('0xa')]('/',auth['isAuthenticated'](),controller[_0xf167('0xb')]);router['get'](_0xf167('0xc'),controller[_0xf167('0xd')]);router[_0xf167('0xa')](_0xf167('0xe'),controller[_0xf167('0xf')]);router[_0xf167('0xa')]('/:id/logo',controller[_0xf167('0x10')]);router['get'](_0xf167('0x11'),controller['getLogoLogin']);router['get'](_0xf167('0x12'),controller[_0xf167('0x13')]);router[_0xf167('0xa')](_0xf167('0x14'),controller['getPreferred']);router['get'](_0xf167('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0xf167('0x16')]({'destination':function(_0x17ccfd,_0x41a78b,_0x5c9f9c){_0x5c9f9c(null,path['join'](config[_0xf167('0x17')],'server/files/images/logos/'));},'filename':function(_0x10b54c,_0x4e86ac,_0x48502c){_0x48502c(null,util[_0xf167('0x18')](_0xf167('0x19'),'logo',path[_0xf167('0x1a')](_0x4e86ac[_0xf167('0x1b')])));}})});router[_0xf167('0x1c')]('/:id/logo',upload[_0xf167('0x1d')](_0xf167('0x1e')),controller[_0xf167('0x1f')]);var upload=multer({'storage':multer[_0xf167('0x16')]({'destination':function(_0xd1e322,_0x5a86fd,_0x3603af){_0x3603af(null,path[_0xf167('0x20')](config[_0xf167('0x17')],_0xf167('0x21')));},'filename':function(_0x394a00,_0x2aaf67,_0x2e7a8c){_0x2e7a8c(null,util[_0xf167('0x18')]('%s%s',_0xf167('0x22'),path[_0xf167('0x1a')](_0x2aaf67['originalname'])));}})});router['post'](_0xf167('0x11'),upload['single'](_0xf167('0x1e')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xf167('0x16')]({'destination':function(_0x50cd8a,_0x5e3a5c,_0x16536d){_0x16536d(null,path[_0xf167('0x20')](config[_0xf167('0x17')],_0xf167('0x21')));},'filename':function(_0x515233,_0x5ac4be,_0x173fee){_0x173fee(null,util[_0xf167('0x18')](_0xf167('0x19'),_0xf167('0x23'),path[_0xf167('0x1a')](_0x5ac4be[_0xf167('0x1b')])));}})});router[_0xf167('0x1c')](_0xf167('0x14'),upload[_0xf167('0x1d')](_0xf167('0x1e')),controller[_0xf167('0x24')]);var upload=multer({'storage':multer[_0xf167('0x16')]({'destination':function(_0xa944ef,_0x4a7641,_0xff514a){_0xff514a(null,path[_0xf167('0x20')](config['root'],_0xf167('0x21')));},'filename':function(_0xf3e059,_0x27cee0,_0x4f64df){_0x4f64df(null,util[_0xf167('0x18')](_0xf167('0x19'),'favicon',path[_0xf167('0x1a')](_0x27cee0['originalname'])));}})});router[_0xf167('0x1c')](_0xf167('0x15'),upload[_0xf167('0x1d')](_0xf167('0x1e')),controller[_0xf167('0x25')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf167('0x26')]);module['exports']=router;
\ No newline at end of file
+var _0xbaf0=['/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getFavicon','diskStorage','root','format','logo','extname','originalname','single','file','join','server/files/images/logos/','%s%s','post','addLogoLogin','addPreferred','favicon','addFavicon','put','isAuthenticated','update','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./setting.controller','get','getDate','/:id'];(function(_0x58df3c,_0x46e5d5){var _0xf67c7a=function(_0x11bba1){while(--_0x11bba1){_0x58df3c['push'](_0x58df3c['shift']());}};_0xf67c7a(++_0x46e5d5);}(_0xbaf0,0xff));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x5'));var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/now',controller[_0x0baf('0x9')]);router['get'](_0x0baf('0xa'),controller['show']);router[_0x0baf('0x8')](_0x0baf('0xb'),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),controller['getLogoLogin']);router[_0x0baf('0x8')](_0x0baf('0xe'),controller[_0x0baf('0xf')]);router[_0x0baf('0x8')](_0x0baf('0x10'),controller['getPreferred']);router['get']('/:id/favicon',controller[_0x0baf('0x11')]);var upload=multer({'storage':multer[_0x0baf('0x12')]({'destination':function(_0x3f3b09,_0x56c42e,_0x2c95f1){_0x2c95f1(null,path['join'](config[_0x0baf('0x13')],'server/files/images/logos/'));},'filename':function(_0x4845b3,_0x342629,_0x442358){_0x442358(null,util[_0x0baf('0x14')]('%s%s',_0x0baf('0x15'),path[_0x0baf('0x16')](_0x342629[_0x0baf('0x17')])));}})});router['post'](_0x0baf('0xb'),upload[_0x0baf('0x18')](_0x0baf('0x19')),controller['addLogo']);var upload=multer({'storage':multer[_0x0baf('0x12')]({'destination':function(_0x157cdb,_0x526e98,_0x340e43){_0x340e43(null,path[_0x0baf('0x1a')](config[_0x0baf('0x13')],_0x0baf('0x1b')));},'filename':function(_0x38fcf9,_0x2bcefb,_0x3c7382){_0x3c7382(null,util[_0x0baf('0x14')](_0x0baf('0x1c'),'logologin',path[_0x0baf('0x16')](_0x2bcefb[_0x0baf('0x17')])));}})});router[_0x0baf('0x1d')](_0x0baf('0xd'),upload[_0x0baf('0x18')]('file'),controller[_0x0baf('0x1e')]);var upload=multer({'storage':multer[_0x0baf('0x12')]({'destination':function(_0x28bc8e,_0x4e9d71,_0x3d00d6){_0x3d00d6(null,path['join'](config[_0x0baf('0x13')],_0x0baf('0x1b')));},'filename':function(_0x2c346f,_0x30c9b9,_0x8e31f9){_0x8e31f9(null,util[_0x0baf('0x14')](_0x0baf('0x1c'),'preferred',path[_0x0baf('0x16')](_0x30c9b9[_0x0baf('0x17')])));}})});router[_0x0baf('0x1d')]('/:id/preferred',upload[_0x0baf('0x18')](_0x0baf('0x19')),controller[_0x0baf('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5b0052,_0x58110c,_0x36f472){_0x36f472(null,path[_0x0baf('0x1a')](config['root'],_0x0baf('0x1b')));},'filename':function(_0x5392c7,_0x5340f5,_0x491db8){_0x491db8(null,util[_0x0baf('0x14')](_0x0baf('0x1c'),_0x0baf('0x20'),path[_0x0baf('0x16')](_0x5340f5[_0x0baf('0x17')])));}})});router[_0x0baf('0x1d')]('/:id/favicon',upload['single'](_0x0baf('0x19')),controller[_0x0baf('0x21')]);router[_0x0baf('0x22')](_0x0baf('0xa'),auth[_0x0baf('0x23')](),controller[_0x0baf('0x24')]);module[_0x0baf('0x25')]=router;
\ No newline at end of file
index 7c5e5d9..2538410 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x41a037,_0x4274d4){var _0x5a274e=function(_0x24c1a1){while(--_0x24c1a1){_0x41a037['push'](_0x41a037['shift']());}};_0x5a274e(++_0x4274d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}};
\ No newline at end of file
+var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3e1277,_0x1b74ea){var _0x2991dc=function(_0x1dca7c){while(--_0x1dca7c){_0x3e1277['push'](_0x3e1277['shift']());}};_0x2991dc(++_0x1b74ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}};
\ No newline at end of file
index 6c9e539..0ab2873 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2b37=['where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLicense','favicon','defaultLogo','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','server/files/images/logos','preferred','defaultLoginLogo','defaultPreferred','defaultFavicon','default_loginLogo.svg','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','catch','end','status','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','sendStatus','stack','name','send','map','Setting','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x2d25a1,_0x187449){var _0x38f2bf=function(_0x592b40){while(--_0x592b40){_0x2d25a1['push'](_0x2d25a1['shift']());}};_0x38f2bf(++_0x187449);}(_0x2b37,0x12b));var _0x72b3=function(_0x67754c,_0x4ee2c1){_0x67754c=_0x67754c-0x0;var _0x1f09ec=_0x2b37[_0x67754c];return _0x1f09ec;};'use strict';var emlformat=require(_0x72b3('0x0'));var rimraf=require(_0x72b3('0x1'));var zipdir=require(_0x72b3('0x2'));var jsonpatch=require(_0x72b3('0x3'));var rp=require(_0x72b3('0x4'));var moment=require(_0x72b3('0x5'));var BPromise=require(_0x72b3('0x6'));var Mustache=require(_0x72b3('0x7'));var util=require(_0x72b3('0x8'));var path=require(_0x72b3('0x9'));var sox=require('sox');var csv=require(_0x72b3('0xa'));var ejs=require(_0x72b3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x72b3('0xc'));var squel=require(_0x72b3('0xd'));var crypto=require(_0x72b3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x72b3('0xf'));var toCsv=require(_0x72b3('0xa'));var querystring=require(_0x72b3('0x10'));var Papa=require('papaparse');var Redis=require(_0x72b3('0x11'));var authService=require(_0x72b3('0x12'));var qs=require(_0x72b3('0x13'));var as=require(_0x72b3('0x14'));var hardwareService=require(_0x72b3('0x15'));var logger=require(_0x72b3('0x16'))(_0x72b3('0x17'));var utils=require('../../config/utils');var config=require(_0x72b3('0x18'));var licenseUtil=require(_0x72b3('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x72b3('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d4b28,_0x44ae11,_0x1b111a,_0xbf084f){return new BPromise(function(_0xa8f49d,_0x2e6e53){var _0x2e6893=_0xbf084f||client;return _0x2e6893[_0x72b3('0x1b')](_0x2d4b28,_0x1b111a)[_0x72b3('0x1c')](function(_0x27b991){logger[_0x72b3('0x1d')]('Setting,\x20%s,\x20%s',_0x44ae11,_0x72b3('0x1e'));logger[_0x72b3('0x1f')](_0x72b3('0x20'),_0x44ae11,_0x72b3('0x1e'),JSON[_0x72b3('0x21')](_0x27b991));if(_0x27b991[_0x72b3('0x22')]){if(_0x27b991[_0x72b3('0x22')]['code']===0x1f4){logger[_0x72b3('0x22')](_0x72b3('0x23'),_0x44ae11,_0x27b991[_0x72b3('0x22')][_0x72b3('0x24')]);return _0x2e6e53(_0x27b991[_0x72b3('0x22')][_0x72b3('0x24')]);}logger['error'](_0x72b3('0x23'),_0x44ae11,_0x27b991['error'][_0x72b3('0x24')]);return _0xa8f49d(_0x27b991[_0x72b3('0x22')][_0x72b3('0x24')]);}else{logger[_0x72b3('0x1d')](_0x72b3('0x23'),_0x44ae11,'request\x20sent');_0xa8f49d(_0x27b991['result'][_0x72b3('0x24')]);}})[_0x72b3('0x25')](function(_0x438443){logger[_0x72b3('0x22')](_0x72b3('0x23'),_0x44ae11,_0x438443);_0x2e6e53(_0x438443);});});}function respondWithStatusCode(_0x2e82a4,_0x105a74){_0x105a74=_0x105a74||0xcc;return function(_0x277cee){if(_0x277cee){return _0x2e82a4['sendStatus'](_0x105a74);}return _0x2e82a4['status'](_0x105a74)[_0x72b3('0x26')]();};}function respondWithResult(_0x249bf8,_0x1ce783){_0x1ce783=_0x1ce783||0xc8;return function(_0x46e584){if(_0x46e584){return _0x249bf8[_0x72b3('0x27')](_0x1ce783)['json'](_0x46e584);}};}function respondWithFilteredResult(_0x31553b,_0x274434){return function(_0x5836e1){if(_0x5836e1){var _0x177352=typeof _0x274434[_0x72b3('0x28')]===_0x72b3('0x29')&&typeof _0x274434['limit']===_0x72b3('0x29');var _0x40e781=_0x5836e1[_0x72b3('0x2a')];var _0x546dfd=_0x177352?0x0:_0x274434[_0x72b3('0x28')];var _0x19afed=_0x177352?_0x5836e1[_0x72b3('0x2a')]:_0x274434[_0x72b3('0x28')]+_0x274434[_0x72b3('0x2b')];var _0x1f2ec9;if(_0x19afed>=_0x40e781){_0x19afed=_0x40e781;_0x1f2ec9=0xc8;}else{_0x1f2ec9=0xce;}_0x31553b[_0x72b3('0x27')](_0x1f2ec9);return _0x31553b[_0x72b3('0x2c')](_0x72b3('0x2d'),_0x546dfd+'-'+_0x19afed+'/'+_0x40e781)['json'](_0x5836e1);}return null;};}function patchUpdates(_0x1602af){return function(_0x45a787){try{jsonpatch[_0x72b3('0x2e')](_0x45a787,_0x1602af,!![]);}catch(_0x51d1fa){return BPromise['reject'](_0x51d1fa);}return _0x45a787[_0x72b3('0x2f')]();};}function saveUpdates(_0x273739,_0x2cfaaf){return function(_0x5c743f){if(_0x5c743f){return _0x5c743f['update'](_0x273739)[_0x72b3('0x1c')](function(_0x40a62a){return _0x40a62a;});}return null;};}function removeEntity(_0x835061,_0x132761){return function(_0x23ce77){if(_0x23ce77){return _0x23ce77[_0x72b3('0x30')]()[_0x72b3('0x1c')](function(){_0x835061[_0x72b3('0x27')](0xcc)[_0x72b3('0x26')]();});}};}function handleEntityNotFound(_0x1bd8d4,_0xde1fc1){return function(_0x489afa){if(!_0x489afa){_0x1bd8d4[_0x72b3('0x31')](0x194);}return _0x489afa;};}function handleError(_0x408061,_0x4533d5){_0x4533d5=_0x4533d5||0x1f4;return function(_0xdd3047){logger[_0x72b3('0x22')](_0xdd3047[_0x72b3('0x32')]);if(_0xdd3047[_0x72b3('0x33')]){delete _0xdd3047['name'];}_0x408061[_0x72b3('0x27')](_0x4533d5)[_0x72b3('0x34')](_0xdd3047);};}exports['index']=function(_0x40d4b0,_0x57200c){var _0x3c5257={},_0x354c1e={},_0x27bf6c={'count':0x0,'rows':[]};var _0x4fee62=_[_0x72b3('0x35')](db[_0x72b3('0x36')][_0x72b3('0x37')],function(_0x265941){return{'name':_0x265941['fieldName'],'type':_0x265941[_0x72b3('0x38')]['key']};});_0x354c1e[_0x72b3('0x39')]=_[_0x72b3('0x35')](_0x4fee62,_0x72b3('0x33'));_0x354c1e[_0x72b3('0x3a')]=_[_0x72b3('0x3b')](_0x40d4b0['query']);_0x354c1e[_0x72b3('0x3c')]=_['intersection'](_0x354c1e['model'],_0x354c1e[_0x72b3('0x3a')]);_0x3c5257[_0x72b3('0x3d')]=_[_0x72b3('0x3e')](_0x354c1e[_0x72b3('0x39')],qs[_0x72b3('0x3f')](_0x40d4b0['query'][_0x72b3('0x3f')]));_0x3c5257['attributes']=_0x3c5257[_0x72b3('0x3d')]['length']?_0x3c5257[_0x72b3('0x3d')]:_0x354c1e['model'];if(!_0x40d4b0['query'][_0x72b3('0x40')](_0x72b3('0x41'))){_0x3c5257[_0x72b3('0x2b')]=qs[_0x72b3('0x2b')](_0x40d4b0[_0x72b3('0x3a')][_0x72b3('0x2b')]);_0x3c5257[_0x72b3('0x28')]=qs[_0x72b3('0x28')](_0x40d4b0[_0x72b3('0x3a')][_0x72b3('0x28')]);}_0x3c5257[_0x72b3('0x42')]=qs[_0x72b3('0x43')](_0x40d4b0[_0x72b3('0x3a')][_0x72b3('0x43')]);_0x3c5257['where']=qs['filters'](_[_0x72b3('0x44')](_0x40d4b0[_0x72b3('0x3a')],_0x354c1e['filters']),_0x4fee62);if(_0x40d4b0[_0x72b3('0x3a')][_0x72b3('0x45')]){_0x3c5257[_0x72b3('0x46')]=_[_0x72b3('0x47')](_0x3c5257[_0x72b3('0x46')],{'$or':_['map'](_0x4fee62,function(_0x251554){if(_0x251554[_0x72b3('0x38')]!==_0x72b3('0x48')){var _0x420054={};_0x420054[_0x251554[_0x72b3('0x33')]]={'$like':'%'+_0x40d4b0[_0x72b3('0x3a')][_0x72b3('0x45')]+'%'};return _0x420054;}})});}_0x3c5257=_[_0x72b3('0x47')]({},_0x3c5257,_0x40d4b0[_0x72b3('0x49')]);var _0x1e6364={'where':_0x3c5257['where']};return db['Setting'][_0x72b3('0x2a')](_0x1e6364)['then'](function(_0x1ece50){_0x27bf6c['count']=_0x1ece50;if(_0x40d4b0[_0x72b3('0x3a')][_0x72b3('0x4a')]){_0x3c5257[_0x72b3('0x4b')]=[{'all':!![]}];}return db[_0x72b3('0x36')][_0x72b3('0x4c')](_0x3c5257);})[_0x72b3('0x1c')](function(_0x2179b7){_0x27bf6c[_0x72b3('0x4d')]=_0x2179b7;return _0x27bf6c;})[_0x72b3('0x1c')](respondWithFilteredResult(_0x57200c,_0x3c5257))[_0x72b3('0x25')](handleError(_0x57200c,null));};exports[_0x72b3('0x4e')]=function(_0x707049,_0xb0e925){var _0x373b61={'raw':![],'where':{'id':_0x707049[_0x72b3('0x4f')]['id']}},_0x350385={};_0x350385[_0x72b3('0x39')]=_[_0x72b3('0x3b')](db['Setting'][_0x72b3('0x37')]);_0x350385['query']=_['keys'](_0x707049[_0x72b3('0x3a')]);_0x350385[_0x72b3('0x3c')]=_[_0x72b3('0x3e')](_0x350385[_0x72b3('0x39')],_0x350385['query']);_0x373b61[_0x72b3('0x3d')]=_[_0x72b3('0x3e')](_0x350385[_0x72b3('0x39')],qs[_0x72b3('0x3f')](_0x707049[_0x72b3('0x3a')][_0x72b3('0x3f')]));_0x373b61[_0x72b3('0x3d')]=_0x373b61[_0x72b3('0x3d')][_0x72b3('0x50')]?_0x373b61[_0x72b3('0x3d')]:_0x350385[_0x72b3('0x39')];if(_0x707049[_0x72b3('0x3a')]['includeAll']){_0x373b61[_0x72b3('0x4b')]=[{'all':!![]}];}_0x373b61=_['merge']({},_0x373b61,_0x707049[_0x72b3('0x49')]);return db[_0x72b3('0x36')][_0x72b3('0x51')](_0x373b61)[_0x72b3('0x1c')](handleEntityNotFound(_0xb0e925,null))['then'](respondWithResult(_0xb0e925,null))[_0x72b3('0x25')](handleError(_0xb0e925,null));};exports[_0x72b3('0x52')]=function(_0xe72e4d,_0x1068f8){if(_0xe72e4d['body']['id']){delete _0xe72e4d[_0x72b3('0x53')]['id'];}return db[_0x72b3('0x36')][_0x72b3('0x51')]({'where':{'id':_0xe72e4d[_0x72b3('0x4f')]['id']}})[_0x72b3('0x1c')](handleEntityNotFound(_0x1068f8,null))['then'](saveUpdates(_0xe72e4d[_0x72b3('0x53')],null))[_0x72b3('0x1c')](respondWithResult(_0x1068f8,null))[_0x72b3('0x25')](handleError(_0x1068f8,null));};exports[_0x72b3('0x54')]=function(_0x56dc9a,_0xef72ca,_0x5d09a1){if(_0x56dc9a[_0x72b3('0x55')]&&_0x56dc9a[_0x72b3('0x55')][_0x72b3('0x56')]){_0x56dc9a[_0x72b3('0x53')][_0x72b3('0x57')]=_0x56dc9a[_0x72b3('0x55')][_0x72b3('0x56')];}return db[_0x72b3('0x36')][_0x72b3('0x51')]({'where':{'id':_0x56dc9a['params']['id']}})[_0x72b3('0x1c')](handleEntityNotFound(_0xef72ca,null))[_0x72b3('0x1c')](saveUpdates(_0x56dc9a['body'],null))[_0x72b3('0x1c')](respondWithResult(_0xef72ca,null))[_0x72b3('0x25')](handleError(_0xef72ca,null));};exports[_0x72b3('0x58')]=function(_0x29e953,_0x40eeb3,_0x593b6a){if(_0x29e953[_0x72b3('0x55')]&&_0x29e953[_0x72b3('0x55')]['filename']){_0x29e953['body'][_0x72b3('0x59')]=_0x29e953[_0x72b3('0x55')][_0x72b3('0x56')];}return db[_0x72b3('0x36')][_0x72b3('0x51')]({'where':{'id':_0x29e953[_0x72b3('0x4f')]['id']}})[_0x72b3('0x1c')](handleEntityNotFound(_0x40eeb3,null))['then'](saveUpdates(_0x29e953[_0x72b3('0x53')],null))[_0x72b3('0x1c')](respondWithResult(_0x40eeb3,null))[_0x72b3('0x25')](handleError(_0x40eeb3,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x432532,_0x4bb5d8,_0x235a8d){var _0x1cbe31='server/files/images/logos';var _0x46de67={'custom':![]};return utilLicense[_0x72b3('0x5a')]()[_0x72b3('0x1c')](function(_0x4fc40b){if(_0x4fc40b){_0x46de67=_0x4fc40b;}return db[_0x72b3('0x36')]['find']({'where':{'id':_0x432532[_0x72b3('0x4f')]['id']},'attributes':[_0x72b3('0x57'),_0x72b3('0x59'),'preferred',_0x72b3('0x5b'),_0x72b3('0x5c'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x72b3('0x1c')](handleEntityNotFound(_0x4bb5d8,null))[_0x72b3('0x1c')](function(_0x2e42cd){if(_0x2e42cd){var _0x3dc9c8=_0x2e42cd['logo']&&fs[_0x72b3('0x5d')](path['join'](config[_0x72b3('0x5e')],_0x1cbe31,_[_0x72b3('0x5f')](_0x2e42cd[_0x72b3('0x57')])))?path[_0x72b3('0x60')](config[_0x72b3('0x5e')],_0x1cbe31,_[_0x72b3('0x5f')](_0x2e42cd['logo'])):path[_0x72b3('0x60')](config[_0x72b3('0x5e')],_0x1cbe31,_['toLower'](_0x72b3('0x61')));var _0x21caa7=_0x72b3('0x62')+_[_0x72b3('0x63')]('logo');if(_0x2e42cd[_0x21caa7]||!_0x46de67[_0x72b3('0x64')]){_0x3dc9c8=path[_0x72b3('0x60')](config[_0x72b3('0x5e')],_0x1cbe31,_[_0x72b3('0x5f')]('default_logo.svg'));}if(!fs['existsSync'](_0x3dc9c8)){throw new db[(_0x72b3('0x65'))][(_0x72b3('0x66'))](_[_0x72b3('0x63')](_0x72b3('0x57'))+_0x72b3('0x67'));}return _0x4bb5d8[_0x72b3('0x68')](_0x3dc9c8);}})['catch'](handleError(_0x4bb5d8,null));};var utilLicense=require(_0x72b3('0x19'));exports['getLogoLogin']=function(_0x463de4,_0x531ce1,_0x4c10c9){var _0x298e60=_0x72b3('0x69');var _0x44d1df={'custom':![]};return utilLicense[_0x72b3('0x5a')]()[_0x72b3('0x1c')](function(_0x201223){if(_0x201223){_0x44d1df=_0x201223;}return db['Setting'][_0x72b3('0x51')]({'where':{'id':_0x463de4[_0x72b3('0x4f')]['id']},'attributes':['logo','loginLogo',_0x72b3('0x6a'),'favicon',_0x72b3('0x5c'),_0x72b3('0x6b'),_0x72b3('0x6c'),_0x72b3('0x6d')],'raw':!![]});})[_0x72b3('0x1c')](handleEntityNotFound(_0x531ce1,null))[_0x72b3('0x1c')](function(_0x2fe1b7){if(_0x2fe1b7){var _0x11e8cd=_0x2fe1b7[_0x72b3('0x59')]&&fs[_0x72b3('0x5d')](path[_0x72b3('0x60')](config[_0x72b3('0x5e')],_0x298e60,_[_0x72b3('0x5f')](_0x2fe1b7[_0x72b3('0x59')])))?path[_0x72b3('0x60')](config[_0x72b3('0x5e')],_0x298e60,_[_0x72b3('0x5f')](_0x2fe1b7[_0x72b3('0x59')])):path[_0x72b3('0x60')](config[_0x72b3('0x5e')],_0x298e60,_[_0x72b3('0x5f')](_0x72b3('0x6e')));var _0x59345e=_0x72b3('0x62')+_[_0x72b3('0x63')]('loginLogo');if(_0x2fe1b7[_0x59345e]||!_0x44d1df[_0x72b3('0x64')]){_0x11e8cd=path[_0x72b3('0x60')](config[_0x72b3('0x5e')],_0x298e60,_['toLower'](_0x72b3('0x6e')));}if(!fs[_0x72b3('0x5d')](_0x11e8cd)){throw new db[(_0x72b3('0x65'))]['ValidationError'](_['upperFirst'](_0x72b3('0x59'))+_0x72b3('0x67'));}return _0x531ce1[_0x72b3('0x68')](_0x11e8cd);}})['catch'](handleError(_0x531ce1,null));};exports[_0x72b3('0x6f')]=function(_0x497acc,_0x350452){return db[_0x72b3('0x36')][_0x72b3('0x51')]({'where':{'id':_0x497acc[_0x72b3('0x4f')]['id']},'attributes':['securePassword']})[_0x72b3('0x1c')](respondWithResult(_0x350452,null))[_0x72b3('0x25')](handleError(_0x350452,null));};exports[_0x72b3('0x70')]=function(_0x439195,_0x1ec8b7,_0x60781b){if(_0x439195[_0x72b3('0x55')]&&_0x439195[_0x72b3('0x55')][_0x72b3('0x56')]){_0x439195[_0x72b3('0x53')][_0x72b3('0x6a')]=_0x439195[_0x72b3('0x55')][_0x72b3('0x56')];}return db['Setting']['find']({'where':{'id':_0x439195[_0x72b3('0x4f')]['id']}})[_0x72b3('0x1c')](handleEntityNotFound(_0x1ec8b7,null))['then'](saveUpdates(_0x439195[_0x72b3('0x53')],null))[_0x72b3('0x1c')](respondWithResult(_0x1ec8b7,null))[_0x72b3('0x25')](handleError(_0x1ec8b7,null));};var utilLicense=require(_0x72b3('0x19'));exports[_0x72b3('0x71')]=function(_0x586a91,_0x5934c9,_0x3d16f7){var _0x3b634e=_0x72b3('0x69');var _0xefb001={'custom':![]};return utilLicense[_0x72b3('0x5a')]()[_0x72b3('0x1c')](function(_0x2a11c2){if(_0x2a11c2){_0xefb001=_0x2a11c2;}return db[_0x72b3('0x36')]['find']({'where':{'id':_0x586a91[_0x72b3('0x4f')]['id']},'attributes':[_0x72b3('0x57'),'loginLogo',_0x72b3('0x6a'),_0x72b3('0x5b'),_0x72b3('0x5c'),_0x72b3('0x6b'),_0x72b3('0x6c'),_0x72b3('0x6d')],'raw':!![]});})[_0x72b3('0x1c')](handleEntityNotFound(_0x5934c9,null))[_0x72b3('0x1c')](function(_0x324c56){if(_0x324c56){var _0x12e288=_0x324c56[_0x72b3('0x6a')]&&fs[_0x72b3('0x5d')](path[_0x72b3('0x60')](config[_0x72b3('0x5e')],_0x3b634e,_[_0x72b3('0x5f')](_0x324c56[_0x72b3('0x6a')])))?path[_0x72b3('0x60')](config[_0x72b3('0x5e')],_0x3b634e,_['toLower'](_0x324c56[_0x72b3('0x6a')])):path['join'](config['root'],_0x3b634e,_[_0x72b3('0x5f')](_0x72b3('0x72')));var _0xe6a531=_0x72b3('0x62')+_[_0x72b3('0x63')](_0x72b3('0x6a'));if(_0x324c56[_0xe6a531]||!_0xefb001[_0x72b3('0x64')]||!_0xefb001[_0x72b3('0x6a')]){_0x12e288=path[_0x72b3('0x60')](config[_0x72b3('0x5e')],_0x3b634e,_[_0x72b3('0x5f')](_0x72b3('0x72')));}if(!fs[_0x72b3('0x5d')](_0x12e288)){throw new db['Sequelize'][(_0x72b3('0x66'))](_['upperFirst'](_0x72b3('0x6a'))+'\x20not\x20found');}return _0x5934c9['download'](_0x12e288);}})[_0x72b3('0x25')](handleError(_0x5934c9,null));};exports[_0x72b3('0x73')]=function(_0x243536,_0x203e0b,_0x2f83d2){if(_0x243536[_0x72b3('0x55')]&&_0x243536['file']['filename']){_0x243536['body'][_0x72b3('0x5b')]=_0x243536[_0x72b3('0x55')]['filename'];}return db[_0x72b3('0x36')][_0x72b3('0x51')]({'where':{'id':_0x243536[_0x72b3('0x4f')]['id']}})['then'](handleEntityNotFound(_0x203e0b,null))[_0x72b3('0x1c')](saveUpdates(_0x243536['body'],null))[_0x72b3('0x1c')](respondWithResult(_0x203e0b,null))[_0x72b3('0x25')](handleError(_0x203e0b,null));};var utilLicense=require(_0x72b3('0x19'));exports[_0x72b3('0x74')]=function(_0x485138,_0xea7125,_0x46734c){var _0x3f13d4=_0x72b3('0x69');var _0x16f77e={'custom':![]};return utilLicense[_0x72b3('0x5a')]()[_0x72b3('0x1c')](function(_0x9da86c){if(_0x9da86c){_0x16f77e=_0x9da86c;}return db[_0x72b3('0x36')][_0x72b3('0x51')]({'where':{'id':_0x485138[_0x72b3('0x4f')]['id']},'attributes':[_0x72b3('0x57'),_0x72b3('0x59'),'preferred',_0x72b3('0x5b'),_0x72b3('0x5c'),_0x72b3('0x6b'),_0x72b3('0x6c'),_0x72b3('0x6d')],'raw':!![]});})[_0x72b3('0x1c')](handleEntityNotFound(_0xea7125,null))['then'](function(_0x31c79f){if(_0x31c79f){var _0x5c6cb9=_0x31c79f[_0x72b3('0x5b')]&&fs['existsSync'](path[_0x72b3('0x60')](config['root'],_0x3f13d4,_[_0x72b3('0x5f')](_0x31c79f[_0x72b3('0x5b')])))?path[_0x72b3('0x60')](config[_0x72b3('0x5e')],_0x3f13d4,_[_0x72b3('0x5f')](_0x31c79f[_0x72b3('0x5b')])):path[_0x72b3('0x60')](config[_0x72b3('0x5e')],_0x3f13d4,_[_0x72b3('0x5f')](_0x72b3('0x75')));var _0x9846db='default'+_[_0x72b3('0x63')](_0x72b3('0x5b'));if(_0x31c79f[_0x9846db]||!_0x16f77e[_0x72b3('0x64')]){_0x5c6cb9=path['join'](config[_0x72b3('0x5e')],_0x3f13d4,_[_0x72b3('0x5f')]('default_favicon.ico'));}if(!fs[_0x72b3('0x5d')](_0x5c6cb9)){throw new db[(_0x72b3('0x65'))][(_0x72b3('0x66'))](_[_0x72b3('0x63')](_0x72b3('0x5b'))+_0x72b3('0x67'));}return _0xea7125[_0x72b3('0x68')](_0x5c6cb9);}})['catch'](handleError(_0xea7125,null));};exports[_0x72b3('0x76')]=function(_0x294e96,_0x498def){var _0x320f9f={'offset':moment()[_0x72b3('0x77')]()};_0x320f9f[_0x72b3('0x78')]=moment()[_0x72b3('0x77')](_0x320f9f[_0x72b3('0x28')])[_0x72b3('0x79')](_0x72b3('0x7a'));return _0x498def[_0x72b3('0x27')](0xc8)['send'](_0x320f9f);};
\ No newline at end of file
+var _0xb7cf=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','body','find','addLogo','file','filename','addLogoLogin','getLogo','server/files/images/logos','getLicense','logo','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','join','root','toLower','default_logo.svg','default','upperFirst','existsSync','ValidationError','\x20not\x20found','getLogoLogin','defaultFavicon','default_loginLogo.svg','custom','Sequelize','download','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','Setting','fieldName','key','model','map','query'];(function(_0xac74f1,_0x1a8d9f){var _0x2c4e31=function(_0x19a1d3){while(--_0x19a1d3){_0xac74f1['push'](_0xac74f1['shift']());}};_0x2c4e31(++_0x1a8d9f);}(_0xb7cf,0xca));var _0xfb7c=function(_0x15c5b8,_0x3b670f){_0x15c5b8=_0x15c5b8-0x0;var _0xd45fe6=_0xb7cf[_0x15c5b8];return _0xd45fe6;};'use strict';var emlformat=require(_0xfb7c('0x0'));var rimraf=require(_0xfb7c('0x1'));var zipdir=require(_0xfb7c('0x2'));var jsonpatch=require(_0xfb7c('0x3'));var rp=require(_0xfb7c('0x4'));var moment=require('moment');var BPromise=require(_0xfb7c('0x5'));var Mustache=require(_0xfb7c('0x6'));var util=require(_0xfb7c('0x7'));var path=require(_0xfb7c('0x8'));var sox=require(_0xfb7c('0x9'));var csv=require(_0xfb7c('0xa'));var ejs=require(_0xfb7c('0xb'));var fs=require('fs');var fs_extra=require(_0xfb7c('0xc'));var _=require(_0xfb7c('0xd'));var squel=require(_0xfb7c('0xe'));var crypto=require(_0xfb7c('0xf'));var jsforce=require(_0xfb7c('0x10'));var deskjs=require(_0xfb7c('0x11'));var toCsv=require(_0xfb7c('0xa'));var querystring=require('querystring');var Papa=require(_0xfb7c('0x12'));var Redis=require(_0xfb7c('0x13'));var authService=require(_0xfb7c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfb7c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfb7c('0x16'));var utils=require(_0xfb7c('0x17'));var config=require(_0xfb7c('0x18'));var licenseUtil=require(_0xfb7c('0x19'));var db=require(_0xfb7c('0x1a'))['db'];var jayson=require(_0xfb7c('0x1b'));var client=jayson[_0xfb7c('0x1c')][_0xfb7c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x53e892,_0x279efe,_0x2517c4,_0x592b36){return new BPromise(function(_0x26eb80,_0x270660){var _0x1d0311=_0x592b36||client;return _0x1d0311[_0xfb7c('0x1e')](_0x53e892,_0x2517c4)[_0xfb7c('0x1f')](function(_0x10f26f){logger['info']('Setting,\x20%s,\x20%s',_0x279efe,_0xfb7c('0x20'));logger['debug'](_0xfb7c('0x21'),_0x279efe,_0xfb7c('0x20'),JSON[_0xfb7c('0x22')](_0x10f26f));if(_0x10f26f[_0xfb7c('0x23')]){if(_0x10f26f['error'][_0xfb7c('0x24')]===0x1f4){logger['error'](_0xfb7c('0x25'),_0x279efe,_0x10f26f[_0xfb7c('0x23')][_0xfb7c('0x26')]);return _0x270660(_0x10f26f[_0xfb7c('0x23')][_0xfb7c('0x26')]);}logger[_0xfb7c('0x23')](_0xfb7c('0x25'),_0x279efe,_0x10f26f['error'][_0xfb7c('0x26')]);return _0x26eb80(_0x10f26f['error'][_0xfb7c('0x26')]);}else{logger[_0xfb7c('0x27')](_0xfb7c('0x25'),_0x279efe,_0xfb7c('0x20'));_0x26eb80(_0x10f26f[_0xfb7c('0x28')][_0xfb7c('0x26')]);}})[_0xfb7c('0x29')](function(_0x4875b8){logger[_0xfb7c('0x23')]('Setting,\x20%s,\x20%s',_0x279efe,_0x4875b8);_0x270660(_0x4875b8);});});}function respondWithStatusCode(_0x391233,_0x4b1598){_0x4b1598=_0x4b1598||0xcc;return function(_0x4d4a07){if(_0x4d4a07){return _0x391233[_0xfb7c('0x2a')](_0x4b1598);}return _0x391233[_0xfb7c('0x2b')](_0x4b1598)['end']();};}function respondWithResult(_0x2e12c9,_0x4fcb72){_0x4fcb72=_0x4fcb72||0xc8;return function(_0x52f80d){if(_0x52f80d){return _0x2e12c9[_0xfb7c('0x2b')](_0x4fcb72)[_0xfb7c('0x2c')](_0x52f80d);}};}function respondWithFilteredResult(_0x340680,_0x33b5db){return function(_0x7a795){if(_0x7a795){var _0x39dbc7=typeof _0x33b5db[_0xfb7c('0x2d')]===_0xfb7c('0x2e')&&typeof _0x33b5db['limit']===_0xfb7c('0x2e');var _0x249418=_0x7a795[_0xfb7c('0x2f')];var _0x57d4a2=_0x39dbc7?0x0:_0x33b5db['offset'];var _0x39e3b3=_0x39dbc7?_0x7a795['count']:_0x33b5db['offset']+_0x33b5db['limit'];var _0x10e338;if(_0x39e3b3>=_0x249418){_0x39e3b3=_0x249418;_0x10e338=0xc8;}else{_0x10e338=0xce;}_0x340680[_0xfb7c('0x2b')](_0x10e338);return _0x340680[_0xfb7c('0x30')](_0xfb7c('0x31'),_0x57d4a2+'-'+_0x39e3b3+'/'+_0x249418)[_0xfb7c('0x2c')](_0x7a795);}return null;};}function patchUpdates(_0x3cd560){return function(_0x31c7bc){try{jsonpatch[_0xfb7c('0x32')](_0x31c7bc,_0x3cd560,!![]);}catch(_0x29a21e){return BPromise[_0xfb7c('0x33')](_0x29a21e);}return _0x31c7bc[_0xfb7c('0x34')]();};}function saveUpdates(_0x153839,_0xda68a0){return function(_0x4cd807){if(_0x4cd807){return _0x4cd807[_0xfb7c('0x35')](_0x153839)[_0xfb7c('0x1f')](function(_0x212c3c){return _0x212c3c;});}return null;};}function removeEntity(_0x169083,_0x139f15){return function(_0x4f1a80){if(_0x4f1a80){return _0x4f1a80[_0xfb7c('0x36')]()[_0xfb7c('0x1f')](function(){_0x169083['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x598a95,_0x5b9e17){return function(_0xc48e75){if(!_0xc48e75){_0x598a95[_0xfb7c('0x2a')](0x194);}return _0xc48e75;};}function handleError(_0x34bc3b,_0x46572e){_0x46572e=_0x46572e||0x1f4;return function(_0xd0e7cd){logger[_0xfb7c('0x23')](_0xd0e7cd[_0xfb7c('0x37')]);if(_0xd0e7cd['name']){delete _0xd0e7cd[_0xfb7c('0x38')];}_0x34bc3b[_0xfb7c('0x2b')](_0x46572e)['send'](_0xd0e7cd);};}exports[_0xfb7c('0x39')]=function(_0x44be9c,_0x527628){var _0xdec932={},_0x28c92d={},_0x3e124a={'count':0x0,'rows':[]};var _0x16bf39=_['map'](db[_0xfb7c('0x3a')]['rawAttributes'],function(_0x2fd6f1){return{'name':_0x2fd6f1[_0xfb7c('0x3b')],'type':_0x2fd6f1['type'][_0xfb7c('0x3c')]};});_0x28c92d[_0xfb7c('0x3d')]=_[_0xfb7c('0x3e')](_0x16bf39,'name');_0x28c92d[_0xfb7c('0x3f')]=_[_0xfb7c('0x40')](_0x44be9c[_0xfb7c('0x3f')]);_0x28c92d[_0xfb7c('0x41')]=_[_0xfb7c('0x42')](_0x28c92d[_0xfb7c('0x3d')],_0x28c92d[_0xfb7c('0x3f')]);_0xdec932['attributes']=_[_0xfb7c('0x42')](_0x28c92d[_0xfb7c('0x3d')],qs['fields'](_0x44be9c['query'][_0xfb7c('0x43')]));_0xdec932[_0xfb7c('0x44')]=_0xdec932[_0xfb7c('0x44')]['length']?_0xdec932[_0xfb7c('0x44')]:_0x28c92d['model'];if(!_0x44be9c[_0xfb7c('0x3f')][_0xfb7c('0x45')](_0xfb7c('0x46'))){_0xdec932[_0xfb7c('0x47')]=qs['limit'](_0x44be9c[_0xfb7c('0x3f')][_0xfb7c('0x47')]);_0xdec932['offset']=qs[_0xfb7c('0x2d')](_0x44be9c[_0xfb7c('0x3f')][_0xfb7c('0x2d')]);}_0xdec932[_0xfb7c('0x48')]=qs[_0xfb7c('0x49')](_0x44be9c['query'][_0xfb7c('0x49')]);_0xdec932['where']=qs[_0xfb7c('0x41')](_[_0xfb7c('0x4a')](_0x44be9c[_0xfb7c('0x3f')],_0x28c92d['filters']),_0x16bf39);if(_0x44be9c['query'][_0xfb7c('0x4b')]){_0xdec932['where']=_[_0xfb7c('0x4c')](_0xdec932[_0xfb7c('0x4d')],{'$or':_[_0xfb7c('0x3e')](_0x16bf39,function(_0x46eef5){if(_0x46eef5[_0xfb7c('0x4e')]!==_0xfb7c('0x4f')){var _0x555e62={};_0x555e62[_0x46eef5[_0xfb7c('0x38')]]={'$like':'%'+_0x44be9c[_0xfb7c('0x3f')][_0xfb7c('0x4b')]+'%'};return _0x555e62;}})});}_0xdec932=_[_0xfb7c('0x4c')]({},_0xdec932,_0x44be9c[_0xfb7c('0x50')]);var _0x5c4475={'where':_0xdec932[_0xfb7c('0x4d')]};return db[_0xfb7c('0x3a')][_0xfb7c('0x2f')](_0x5c4475)[_0xfb7c('0x1f')](function(_0x5ebf4c){_0x3e124a[_0xfb7c('0x2f')]=_0x5ebf4c;if(_0x44be9c[_0xfb7c('0x3f')][_0xfb7c('0x51')]){_0xdec932[_0xfb7c('0x52')]=[{'all':!![]}];}return db[_0xfb7c('0x3a')][_0xfb7c('0x53')](_0xdec932);})[_0xfb7c('0x1f')](function(_0x499099){_0x3e124a[_0xfb7c('0x54')]=_0x499099;return _0x3e124a;})[_0xfb7c('0x1f')](respondWithFilteredResult(_0x527628,_0xdec932))['catch'](handleError(_0x527628,null));};exports[_0xfb7c('0x55')]=function(_0x7ba57c,_0xf06ea8){var _0x468231={'raw':![],'where':{'id':_0x7ba57c[_0xfb7c('0x56')]['id']}},_0x29098f={};_0x29098f[_0xfb7c('0x3d')]=_[_0xfb7c('0x40')](db['Setting'][_0xfb7c('0x57')]);_0x29098f[_0xfb7c('0x3f')]=_[_0xfb7c('0x40')](_0x7ba57c[_0xfb7c('0x3f')]);_0x29098f[_0xfb7c('0x41')]=_[_0xfb7c('0x42')](_0x29098f[_0xfb7c('0x3d')],_0x29098f[_0xfb7c('0x3f')]);_0x468231[_0xfb7c('0x44')]=_[_0xfb7c('0x42')](_0x29098f[_0xfb7c('0x3d')],qs[_0xfb7c('0x43')](_0x7ba57c['query']['fields']));_0x468231['attributes']=_0x468231[_0xfb7c('0x44')][_0xfb7c('0x58')]?_0x468231[_0xfb7c('0x44')]:_0x29098f[_0xfb7c('0x3d')];if(_0x7ba57c[_0xfb7c('0x3f')][_0xfb7c('0x51')]){_0x468231[_0xfb7c('0x52')]=[{'all':!![]}];}_0x468231=_[_0xfb7c('0x4c')]({},_0x468231,_0x7ba57c[_0xfb7c('0x50')]);return db['Setting']['find'](_0x468231)[_0xfb7c('0x1f')](handleEntityNotFound(_0xf06ea8,null))[_0xfb7c('0x1f')](respondWithResult(_0xf06ea8,null))['catch'](handleError(_0xf06ea8,null));};exports[_0xfb7c('0x35')]=function(_0x2be87a,_0x37e20f){if(_0x2be87a[_0xfb7c('0x59')]['id']){delete _0x2be87a[_0xfb7c('0x59')]['id'];}return db[_0xfb7c('0x3a')][_0xfb7c('0x5a')]({'where':{'id':_0x2be87a[_0xfb7c('0x56')]['id']}})[_0xfb7c('0x1f')](handleEntityNotFound(_0x37e20f,null))[_0xfb7c('0x1f')](saveUpdates(_0x2be87a[_0xfb7c('0x59')],null))[_0xfb7c('0x1f')](respondWithResult(_0x37e20f,null))[_0xfb7c('0x29')](handleError(_0x37e20f,null));};exports[_0xfb7c('0x5b')]=function(_0x44c3e3,_0x3feb1c,_0x592284){if(_0x44c3e3[_0xfb7c('0x5c')]&&_0x44c3e3['file'][_0xfb7c('0x5d')]){_0x44c3e3[_0xfb7c('0x59')]['logo']=_0x44c3e3[_0xfb7c('0x5c')][_0xfb7c('0x5d')];}return db[_0xfb7c('0x3a')]['find']({'where':{'id':_0x44c3e3['params']['id']}})[_0xfb7c('0x1f')](handleEntityNotFound(_0x3feb1c,null))[_0xfb7c('0x1f')](saveUpdates(_0x44c3e3['body'],null))[_0xfb7c('0x1f')](respondWithResult(_0x3feb1c,null))[_0xfb7c('0x29')](handleError(_0x3feb1c,null));};exports[_0xfb7c('0x5e')]=function(_0x1d871a,_0x304fa5,_0x2c1b73){if(_0x1d871a[_0xfb7c('0x5c')]&&_0x1d871a['file'][_0xfb7c('0x5d')]){_0x1d871a[_0xfb7c('0x59')]['loginLogo']=_0x1d871a['file'][_0xfb7c('0x5d')];}return db[_0xfb7c('0x3a')]['find']({'where':{'id':_0x1d871a['params']['id']}})[_0xfb7c('0x1f')](handleEntityNotFound(_0x304fa5,null))[_0xfb7c('0x1f')](saveUpdates(_0x1d871a[_0xfb7c('0x59')],null))[_0xfb7c('0x1f')](respondWithResult(_0x304fa5,null))[_0xfb7c('0x29')](handleError(_0x304fa5,null));};var utilLicense=require(_0xfb7c('0x19'));exports[_0xfb7c('0x5f')]=function(_0xe9ea98,_0x3a4d23,_0x41009d){var _0x23ba74=_0xfb7c('0x60');var _0x504efc={'custom':![]};return utilLicense[_0xfb7c('0x61')]()['then'](function(_0x58911e){if(_0x58911e){_0x504efc=_0x58911e;}return db[_0xfb7c('0x3a')][_0xfb7c('0x5a')]({'where':{'id':_0xe9ea98[_0xfb7c('0x56')]['id']},'attributes':[_0xfb7c('0x62'),_0xfb7c('0x63'),_0xfb7c('0x64'),_0xfb7c('0x65'),_0xfb7c('0x66'),_0xfb7c('0x67'),_0xfb7c('0x68'),'defaultFavicon'],'raw':!![]});})[_0xfb7c('0x1f')](handleEntityNotFound(_0x3a4d23,null))[_0xfb7c('0x1f')](function(_0x486f24){if(_0x486f24){var _0x49845c=_0x486f24[_0xfb7c('0x62')]&&fs['existsSync'](path[_0xfb7c('0x69')](config[_0xfb7c('0x6a')],_0x23ba74,_[_0xfb7c('0x6b')](_0x486f24[_0xfb7c('0x62')])))?path['join'](config[_0xfb7c('0x6a')],_0x23ba74,_[_0xfb7c('0x6b')](_0x486f24[_0xfb7c('0x62')])):path['join'](config[_0xfb7c('0x6a')],_0x23ba74,_[_0xfb7c('0x6b')](_0xfb7c('0x6c')));var _0x54dc31=_0xfb7c('0x6d')+_[_0xfb7c('0x6e')](_0xfb7c('0x62'));if(_0x486f24[_0x54dc31]||!_0x504efc['custom']){_0x49845c=path['join'](config['root'],_0x23ba74,_[_0xfb7c('0x6b')](_0xfb7c('0x6c')));}if(!fs[_0xfb7c('0x6f')](_0x49845c)){throw new db['Sequelize'][(_0xfb7c('0x70'))](_['upperFirst'](_0xfb7c('0x62'))+_0xfb7c('0x71'));}return _0x3a4d23['download'](_0x49845c);}})[_0xfb7c('0x29')](handleError(_0x3a4d23,null));};var utilLicense=require(_0xfb7c('0x19'));exports[_0xfb7c('0x72')]=function(_0x21f85d,_0x46b395,_0x47dd28){var _0x520326=_0xfb7c('0x60');var _0xd3743c={'custom':![]};return utilLicense[_0xfb7c('0x61')]()['then'](function(_0x471342){if(_0x471342){_0xd3743c=_0x471342;}return db['Setting']['find']({'where':{'id':_0x21f85d['params']['id']},'attributes':[_0xfb7c('0x62'),_0xfb7c('0x63'),_0xfb7c('0x64'),'favicon',_0xfb7c('0x66'),_0xfb7c('0x67'),_0xfb7c('0x68'),_0xfb7c('0x73')],'raw':!![]});})['then'](handleEntityNotFound(_0x46b395,null))[_0xfb7c('0x1f')](function(_0x51a7c7){if(_0x51a7c7){var _0x590ab0=_0x51a7c7[_0xfb7c('0x63')]&&fs[_0xfb7c('0x6f')](path[_0xfb7c('0x69')](config[_0xfb7c('0x6a')],_0x520326,_['toLower'](_0x51a7c7[_0xfb7c('0x63')])))?path['join'](config[_0xfb7c('0x6a')],_0x520326,_[_0xfb7c('0x6b')](_0x51a7c7['loginLogo'])):path[_0xfb7c('0x69')](config[_0xfb7c('0x6a')],_0x520326,_['toLower'](_0xfb7c('0x74')));var _0x4b7673='default'+_[_0xfb7c('0x6e')]('loginLogo');if(_0x51a7c7[_0x4b7673]||!_0xd3743c[_0xfb7c('0x75')]){_0x590ab0=path[_0xfb7c('0x69')](config[_0xfb7c('0x6a')],_0x520326,_['toLower'](_0xfb7c('0x74')));}if(!fs['existsSync'](_0x590ab0)){throw new db[(_0xfb7c('0x76'))][(_0xfb7c('0x70'))](_[_0xfb7c('0x6e')](_0xfb7c('0x63'))+'\x20not\x20found');}return _0x46b395[_0xfb7c('0x77')](_0x590ab0);}})['catch'](handleError(_0x46b395,null));};exports['gdpr']=function(_0x3dde2b,_0xc86bd8){return db['Setting'][_0xfb7c('0x5a')]({'where':{'id':_0x3dde2b[_0xfb7c('0x56')]['id']},'attributes':[_0xfb7c('0x78')]})[_0xfb7c('0x1f')](respondWithResult(_0xc86bd8,null))[_0xfb7c('0x29')](handleError(_0xc86bd8,null));};exports[_0xfb7c('0x79')]=function(_0x2c3d36,_0x2734ed,_0x13f3d8){if(_0x2c3d36[_0xfb7c('0x5c')]&&_0x2c3d36[_0xfb7c('0x5c')][_0xfb7c('0x5d')]){_0x2c3d36[_0xfb7c('0x59')][_0xfb7c('0x64')]=_0x2c3d36['file'][_0xfb7c('0x5d')];}return db[_0xfb7c('0x3a')][_0xfb7c('0x5a')]({'where':{'id':_0x2c3d36['params']['id']}})[_0xfb7c('0x1f')](handleEntityNotFound(_0x2734ed,null))[_0xfb7c('0x1f')](saveUpdates(_0x2c3d36[_0xfb7c('0x59')],null))[_0xfb7c('0x1f')](respondWithResult(_0x2734ed,null))[_0xfb7c('0x29')](handleError(_0x2734ed,null));};var utilLicense=require(_0xfb7c('0x19'));exports[_0xfb7c('0x7a')]=function(_0x5764df,_0x5da343,_0x38f2bb){var _0x484734='server/files/images/logos';var _0x4b6e51={'custom':![]};return utilLicense[_0xfb7c('0x61')]()['then'](function(_0x14c4f0){if(_0x14c4f0){_0x4b6e51=_0x14c4f0;}return db[_0xfb7c('0x3a')][_0xfb7c('0x5a')]({'where':{'id':_0x5764df[_0xfb7c('0x56')]['id']},'attributes':[_0xfb7c('0x62'),_0xfb7c('0x63'),'preferred',_0xfb7c('0x65'),'defaultLogo',_0xfb7c('0x67'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x5da343,null))[_0xfb7c('0x1f')](function(_0x84eb7){if(_0x84eb7){var _0x3c94b4=_0x84eb7['preferred']&&fs[_0xfb7c('0x6f')](path[_0xfb7c('0x69')](config[_0xfb7c('0x6a')],_0x484734,_['toLower'](_0x84eb7['preferred'])))?path['join'](config[_0xfb7c('0x6a')],_0x484734,_[_0xfb7c('0x6b')](_0x84eb7[_0xfb7c('0x64')])):path[_0xfb7c('0x69')](config[_0xfb7c('0x6a')],_0x484734,_[_0xfb7c('0x6b')](_0xfb7c('0x7b')));var _0x40c263=_0xfb7c('0x6d')+_[_0xfb7c('0x6e')](_0xfb7c('0x64'));if(_0x84eb7[_0x40c263]||!_0x4b6e51['custom']||!_0x4b6e51[_0xfb7c('0x64')]){_0x3c94b4=path['join'](config[_0xfb7c('0x6a')],_0x484734,_[_0xfb7c('0x6b')](_0xfb7c('0x7b')));}if(!fs['existsSync'](_0x3c94b4)){throw new db['Sequelize']['ValidationError'](_[_0xfb7c('0x6e')]('preferred')+_0xfb7c('0x71'));}return _0x5da343[_0xfb7c('0x77')](_0x3c94b4);}})[_0xfb7c('0x29')](handleError(_0x5da343,null));};exports[_0xfb7c('0x7c')]=function(_0x142033,_0x2ecf6b,_0x1267a0){if(_0x142033[_0xfb7c('0x5c')]&&_0x142033[_0xfb7c('0x5c')][_0xfb7c('0x5d')]){_0x142033['body'][_0xfb7c('0x65')]=_0x142033['file']['filename'];}return db['Setting']['find']({'where':{'id':_0x142033[_0xfb7c('0x56')]['id']}})['then'](handleEntityNotFound(_0x2ecf6b,null))['then'](saveUpdates(_0x142033[_0xfb7c('0x59')],null))['then'](respondWithResult(_0x2ecf6b,null))['catch'](handleError(_0x2ecf6b,null));};var utilLicense=require('../../config/license/util');exports[_0xfb7c('0x7d')]=function(_0x2905e4,_0x1c8456,_0x2c7299){var _0x382034=_0xfb7c('0x60');var _0x4ecec9={'custom':![]};return utilLicense[_0xfb7c('0x61')]()[_0xfb7c('0x1f')](function(_0x3bd4fc){if(_0x3bd4fc){_0x4ecec9=_0x3bd4fc;}return db['Setting']['find']({'where':{'id':_0x2905e4[_0xfb7c('0x56')]['id']},'attributes':[_0xfb7c('0x62'),'loginLogo',_0xfb7c('0x64'),_0xfb7c('0x65'),_0xfb7c('0x66'),_0xfb7c('0x67'),_0xfb7c('0x68'),'defaultFavicon'],'raw':!![]});})[_0xfb7c('0x1f')](handleEntityNotFound(_0x1c8456,null))[_0xfb7c('0x1f')](function(_0x5c896e){if(_0x5c896e){var _0x41cf65=_0x5c896e[_0xfb7c('0x65')]&&fs[_0xfb7c('0x6f')](path[_0xfb7c('0x69')](config[_0xfb7c('0x6a')],_0x382034,_[_0xfb7c('0x6b')](_0x5c896e[_0xfb7c('0x65')])))?path[_0xfb7c('0x69')](config['root'],_0x382034,_['toLower'](_0x5c896e['favicon'])):path[_0xfb7c('0x69')](config[_0xfb7c('0x6a')],_0x382034,_[_0xfb7c('0x6b')](_0xfb7c('0x7e')));var _0xef8760=_0xfb7c('0x6d')+_['upperFirst'](_0xfb7c('0x65'));if(_0x5c896e[_0xef8760]||!_0x4ecec9['custom']){_0x41cf65=path[_0xfb7c('0x69')](config[_0xfb7c('0x6a')],_0x382034,_['toLower']('default_favicon.ico'));}if(!fs[_0xfb7c('0x6f')](_0x41cf65)){throw new db[(_0xfb7c('0x76'))]['ValidationError'](_[_0xfb7c('0x6e')](_0xfb7c('0x65'))+_0xfb7c('0x71'));}return _0x1c8456['download'](_0x41cf65);}})[_0xfb7c('0x29')](handleError(_0x1c8456,null));};exports[_0xfb7c('0x7f')]=function(_0x5e4223,_0x39a013){var _0x3cab56={'offset':moment()[_0xfb7c('0x80')]()};_0x3cab56[_0xfb7c('0x81')]=moment()[_0xfb7c('0x80')](_0x3cab56['offset'])[_0xfb7c('0x82')](_0xfb7c('0x83'));return _0x39a013[_0xfb7c('0x2b')](0xc8)[_0xfb7c('0x84')](_0x3cab56);};
\ No newline at end of file
index a770f42..baeead7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x5a1943,_0x15587){var _0x7ef8ad=function(_0x3cb8ad){while(--_0x3cb8ad){_0x5a1943['push'](_0x5a1943['shift']());}};_0x7ef8ad(++_0x15587);}(_0xedd9,0xfc));var _0x9edd=function(_0x37a8b6,_0x91de27){_0x37a8b6=_0x37a8b6-0x0;var _0x4c3f6c=_0xedd9[_0x37a8b6];return _0x4c3f6c;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0xb80cdf,_0x5de5ee){var _0x506b29=function(_0x38e2ba){while(--_0x38e2ba){_0xb80cdf['push'](_0xb80cdf['shift']());}};_0x506b29(++_0x5de5ee);}(_0xedd9,0xfc));var _0x9edd=function(_0x2bd59b,_0x5abd10){_0x2bd59b=_0x2bd59b-0x0;var _0x4ef8bb=_0xedd9[_0x2bd59b];return _0x4ef8bb;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4f7ae3c..c83339f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xae96=['request\x20sent','stringify','error','message','info','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','map','include','model','then','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Setting,\x20%s,\x20%s','debug'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xae96,0xcc));var _0x6ae9=function(_0x56120c,_0x267d17){_0x56120c=_0x56120c-0x0;var _0x1452e1=_0xae96[_0x56120c];return _0x1452e1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6ae9('0x0'));var rs=require(_0x6ae9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ae9('0x2'))['db'];var utils=require(_0x6ae9('0x3'));var logger=require(_0x6ae9('0x4'))(_0x6ae9('0x5'));var config=require(_0x6ae9('0x6'));var jayson=require(_0x6ae9('0x7'));var client=jayson[_0x6ae9('0x8')][_0x6ae9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x451a3c,_0x4589e7,_0x247453){return new BPromise(function(_0x3b0880,_0x136619){return client[_0x6ae9('0xa')](_0x451a3c,_0x247453)['then'](function(_0x476550){logger['info'](_0x6ae9('0xb'),_0x4589e7,'request\x20sent');logger[_0x6ae9('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0x4589e7,_0x6ae9('0xd'),JSON[_0x6ae9('0xe')](_0x476550));if(_0x476550[_0x6ae9('0xf')]){if(_0x476550[_0x6ae9('0xf')]['code']===0x1f4){logger[_0x6ae9('0xf')](_0x6ae9('0xb'),_0x4589e7,_0x476550['error'][_0x6ae9('0x10')]);return _0x136619(_0x476550[_0x6ae9('0xf')]['message']);}logger[_0x6ae9('0xf')](_0x6ae9('0xb'),_0x4589e7,_0x476550[_0x6ae9('0xf')][_0x6ae9('0x10')]);return _0x3b0880(_0x476550[_0x6ae9('0xf')][_0x6ae9('0x10')]);}else{logger[_0x6ae9('0x11')](_0x6ae9('0xb'),_0x4589e7,_0x6ae9('0xd'));_0x3b0880(_0x476550[_0x6ae9('0x12')][_0x6ae9('0x10')]);}})[_0x6ae9('0x13')](function(_0x23c0a2){logger['error'](_0x6ae9('0xb'),_0x4589e7,_0x23c0a2);_0x136619(_0x23c0a2);});});}exports[_0x6ae9('0x14')]=function(_0x463c51){var _0x11bf55=this;return new Promise(function(_0x3970a1,_0x51e7a9){return db[_0x6ae9('0x15')][_0x6ae9('0x16')]({'raw':_0x463c51[_0x6ae9('0x17')]?_0x463c51['options'][_0x6ae9('0x18')]===undefined?!![]:![]:!![],'where':_0x463c51[_0x6ae9('0x17')]?_0x463c51['options'][_0x6ae9('0x19')]||null:null,'attributes':_0x463c51['options']?_0x463c51['options'][_0x6ae9('0x1a')]||null:null,'include':_0x463c51[_0x6ae9('0x17')]?_0x463c51['options']['include']?_[_0x6ae9('0x1b')](_0x463c51[_0x6ae9('0x17')][_0x6ae9('0x1c')],function(_0xd4f145){return{'model':db[_0xd4f145[_0x6ae9('0x1d')]],'as':_0xd4f145['as'],'attributes':_0xd4f145['attributes'],'include':_0xd4f145['include']?_[_0x6ae9('0x1b')](_0xd4f145[_0x6ae9('0x1c')],function(_0x5caaab){return{'model':db[_0x5caaab['model']],'as':_0x5caaab['as'],'attributes':_0x5caaab[_0x6ae9('0x1a')],'include':_0x5caaab[_0x6ae9('0x1c')]?_[_0x6ae9('0x1b')](_0x5caaab[_0x6ae9('0x1c')],function(_0x1fe761){return{'model':db[_0x1fe761[_0x6ae9('0x1d')]],'as':_0x1fe761['as'],'attributes':_0x1fe761[_0x6ae9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6ae9('0x1e')](function(_0x19bbd4){logger[_0x6ae9('0x11')](_0x6ae9('0x14'),_0x463c51);logger['debug']('ShowSetting',_0x463c51,JSON[_0x6ae9('0xe')](_0x19bbd4));_0x3970a1(_0x19bbd4);})[_0x6ae9('0x13')](function(_0x31ceb5){logger['error'](_0x6ae9('0x14'),_0x31ceb5['message'],_0x463c51);_0x51e7a9(_0x11bf55[_0x6ae9('0xf')](0x1f4,_0x31ceb5[_0x6ae9('0x10')]));});});};
\ No newline at end of file
+var _0x1124=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','Setting,\x20%s,\x20%s','result','catch','Setting','options','raw','attributes','include','map','model','stringify','ShowSetting','lodash'];(function(_0x20c25b,_0xbda317){var _0x59f74e=function(_0x297885){while(--_0x297885){_0x20c25b['push'](_0x20c25b['shift']());}};_0x59f74e(++_0xbda317);}(_0x1124,0x173));var _0x4112=function(_0x2b90e9,_0x384b78){_0x2b90e9=_0x2b90e9-0x0;var _0x3c6a5b=_0x1124[_0x2b90e9];return _0x3c6a5b;};'use strict';var _=require(_0x4112('0x0'));var util=require('util');var moment=require(_0x4112('0x1'));var BPromise=require('bluebird');var rs=require(_0x4112('0x2'));var fs=require('fs');var Redis=require(_0x4112('0x3'));var db=require(_0x4112('0x4'))['db'];var utils=require(_0x4112('0x5'));var logger=require(_0x4112('0x6'))('rpc');var config=require(_0x4112('0x7'));var jayson=require(_0x4112('0x8'));var client=jayson[_0x4112('0x9')][_0x4112('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22493f,_0x3be04c,_0x710042){return new BPromise(function(_0x39f5b8,_0x1bd317){return client['request'](_0x22493f,_0x710042)[_0x4112('0xb')](function(_0x5f318c){logger[_0x4112('0xc')]('Setting,\x20%s,\x20%s',_0x3be04c,'request\x20sent');logger[_0x4112('0xd')](_0x4112('0xe'),_0x3be04c,_0x4112('0xf'),JSON['stringify'](_0x5f318c));if(_0x5f318c[_0x4112('0x10')]){if(_0x5f318c[_0x4112('0x10')][_0x4112('0x11')]===0x1f4){logger[_0x4112('0x10')]('Setting,\x20%s,\x20%s',_0x3be04c,_0x5f318c[_0x4112('0x10')][_0x4112('0x12')]);return _0x1bd317(_0x5f318c[_0x4112('0x10')][_0x4112('0x12')]);}logger['error'](_0x4112('0x13'),_0x3be04c,_0x5f318c[_0x4112('0x10')][_0x4112('0x12')]);return _0x39f5b8(_0x5f318c[_0x4112('0x10')][_0x4112('0x12')]);}else{logger[_0x4112('0xc')]('Setting,\x20%s,\x20%s',_0x3be04c,_0x4112('0xf'));_0x39f5b8(_0x5f318c[_0x4112('0x14')][_0x4112('0x12')]);}})[_0x4112('0x15')](function(_0xbf0d0a){logger[_0x4112('0x10')]('Setting,\x20%s,\x20%s',_0x3be04c,_0xbf0d0a);_0x1bd317(_0xbf0d0a);});});}exports['ShowSetting']=function(_0x442271){var _0x2cbce0=this;return new Promise(function(_0x2a19f9,_0x27c44f){return db[_0x4112('0x16')]['find']({'raw':_0x442271[_0x4112('0x17')]?_0x442271[_0x4112('0x17')][_0x4112('0x18')]===undefined?!![]:![]:!![],'where':_0x442271[_0x4112('0x17')]?_0x442271[_0x4112('0x17')]['where']||null:null,'attributes':_0x442271[_0x4112('0x17')]?_0x442271[_0x4112('0x17')][_0x4112('0x19')]||null:null,'include':_0x442271[_0x4112('0x17')]?_0x442271[_0x4112('0x17')][_0x4112('0x1a')]?_[_0x4112('0x1b')](_0x442271[_0x4112('0x17')]['include'],function(_0x384de8){return{'model':db[_0x384de8[_0x4112('0x1c')]],'as':_0x384de8['as'],'attributes':_0x384de8[_0x4112('0x19')],'include':_0x384de8[_0x4112('0x1a')]?_['map'](_0x384de8[_0x4112('0x1a')],function(_0x4a5386){return{'model':db[_0x4a5386[_0x4112('0x1c')]],'as':_0x4a5386['as'],'attributes':_0x4a5386[_0x4112('0x19')],'include':_0x4a5386[_0x4112('0x1a')]?_['map'](_0x4a5386[_0x4112('0x1a')],function(_0x655d9){return{'model':db[_0x655d9['model']],'as':_0x655d9['as'],'attributes':_0x655d9[_0x4112('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b4f91){logger[_0x4112('0xc')]('ShowSetting',_0x442271);logger['debug']('ShowSetting',_0x442271,JSON[_0x4112('0x1d')](_0x1b4f91));_0x2a19f9(_0x1b4f91);})['catch'](function(_0x30f534){logger['error'](_0x4112('0x1e'),_0x30f534[_0x4112('0x12')],_0x442271);_0x27c44f(_0x2cbce0[_0x4112('0x10')](0x1f4,_0x30f534[_0x4112('0x12')]));});});};
\ No newline at end of file
index 8c0a347..e279c22 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8ef6=['addApplications','/:id/send','send','status','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify'];(function(_0x348805,_0x1cd21d){var _0xde788=function(_0x38d79b){while(--_0x38d79b){_0x348805['push'](_0x348805['shift']());}};_0xde788(++_0x1cd21d);}(_0x8ef6,0xf2));var _0x68ef=function(_0x563a26,_0x15a152){_0x563a26=_0x563a26-0x0;var _0x5e8781=_0x8ef6[_0x563a26];return _0x5e8781;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xa')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0xa')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router['get'](_0x68ef('0x13'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);router[_0x68ef('0xa')](_0x68ef('0x15'),auth[_0x68ef('0xc')](),controller['getInteractions']);router[_0x68ef('0xa')](_0x68ef('0x16'),controller[_0x68ef('0x17')]);router['get'](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x19')]);router['post']('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xf'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);router['post']('/:id/canned_answers',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1d')]);router['post']('/:id/notify',controller[_0x68ef('0x1e')]);router[_0x68ef('0x1b')](_0x68ef('0x13'),auth['isAuthenticated'](),controller[_0x68ef('0x1f')]);router[_0x68ef('0x1b')](_0x68ef('0x20'),auth['isAuthenticated'](),controller[_0x68ef('0x21')]);router[_0x68ef('0x1b')]('/:id/status',controller[_0x68ef('0x22')]);router[_0x68ef('0x1b')](_0x68ef('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x23')]);router[_0x68ef('0x24')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x25')]);router[_0x68ef('0x24')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller['removeDispositions']);router[_0x68ef('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x68ef('0x24')](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x26')]);module['exports']=router;
\ No newline at end of file
+var _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x5797c5,_0x2ff10e){var _0x19c6ca=function(_0x52eca2){while(--_0x52eca2){_0x5797c5['push'](_0x5797c5['shift']());}};_0x19c6ca(++_0x2ff10e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router;
\ No newline at end of file
index 6d5a9af..aaf7f66 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5827=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','STRING','name','generate','ENUM','twilio','skebby','clicksend','clickatell','bandwidth','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x3f30d6,_0x33349f){var _0x517d4d=function(_0x8d23e5){while(--_0x8d23e5){_0x3f30d6['push'](_0x3f30d6['shift']());}};_0x517d4d(++_0x33349f);}(_0x5827,0x9c));var _0x7582=function(_0x425405,_0x50cd08){_0x425405=_0x425405-0x0;var _0x2c21a3=_0x5827[_0x425405];return _0x2c21a3;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x7582('0x0'));module['exports']={'name':{'type':Sequelize[_0x7582('0x1')],'unique':_0x7582('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x7582('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x7582('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x7582('0x1')],'defaultValue':function(){return rs[_0x7582('0x3')]();}},'phone':{'type':Sequelize[_0x7582('0x1')]},'type':{'type':Sequelize[_0x7582('0x4')](_0x7582('0x5'),_0x7582('0x6'),'connectel',_0x7582('0x7'),'plivo',_0x7582('0x8'),_0x7582('0x9'),'csc',_0x7582('0xa'),_0x7582('0xb'))},'accountSid':{'type':Sequelize[_0x7582('0x1')]},'authId':{'type':Sequelize[_0x7582('0x1')]},'authToken':{'type':Sequelize[_0x7582('0x1')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x7582('0x1')]},'password':{'type':Sequelize[_0x7582('0x1')]},'apiKey':{'type':Sequelize[_0x7582('0x1')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x7582('0x1')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x7582('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x7582('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7582('0xd');}},'notificationSound':{'type':Sequelize[_0x7582('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7582('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7582('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7582('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7582('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x7582('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7582('0xe')],'comment':_0x7582('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x7582('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x377cdb){if(!_0x377cdb)this['setDataValue'](_0x7582('0x10'),null);this[_0x7582('0x11')](_0x7582('0x12'),_0x377cdb);}}};
\ No newline at end of file
+var _0xfaa7=['plivo','clickatell','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','skebby','connectel','clicksend'];(function(_0x507a18,_0x1323ee){var _0x1e9de4=function(_0x3b0cc2){while(--_0x3b0cc2){_0x507a18['push'](_0x507a18['shift']());}};_0x1e9de4(++_0x1323ee);}(_0xfaa7,0x1c6));var _0x7faa=function(_0x3266c9,_0x198dca){_0x3266c9=_0x3266c9-0x0;var _0xe37009=_0xfaa7[_0x3266c9];return _0xe37009;};'use strict';var Sequelize=require(_0x7faa('0x0'));var rs=require(_0x7faa('0x1'));module['exports']={'name':{'type':Sequelize[_0x7faa('0x2')],'unique':_0x7faa('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x7faa('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7faa('0x4')]();}},'phone':{'type':Sequelize[_0x7faa('0x2')]},'type':{'type':Sequelize['ENUM']('twilio',_0x7faa('0x5'),_0x7faa('0x6'),_0x7faa('0x7'),_0x7faa('0x8'),_0x7faa('0x9'),'bandwidth',_0x7faa('0xa'),_0x7faa('0xb'),_0x7faa('0xc'))},'accountSid':{'type':Sequelize[_0x7faa('0x2')]},'authId':{'type':Sequelize[_0x7faa('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x7faa('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x7faa('0x2')]},'applicationId':{'type':Sequelize[_0x7faa('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x7faa('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x7faa('0xd')],'defaultValue':function(){return _0x7faa('0xe');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7faa('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7faa('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7faa('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7faa('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x7faa('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7faa('0xf')],'comment':_0x7faa('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x7faa('0x10')],'defaultValue':![],'comment':_0x7faa('0x12'),'set':function(_0x5b1569){if(!_0x5b1569)this['setDataValue'](_0x7faa('0x13'),null);this[_0x7faa('0x14')](_0x7faa('0x15'),_0x5b1569);}}};
\ No newline at end of file
index da2ab2f..b574266 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe1e5=['emit','removeAgents','isArray','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','json','undefined','count','status','set','Content-Range','reject','save','update','get','SmsAccounts','UserProfileResource','end','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','offset','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','params','model','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','pick','rows','ids','addAnswer','CannedAnswer','findAll','removeAnswers','notify','SmsApplication','account','applications','orderBy','Applications','priority','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','messageId','skebby','sender','text','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','refid','isNil','Sequelize','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','SmsInteraction','interaction','created','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','defaults','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','intelepeer','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents'];(function(_0x3c04d7,_0x472801){var _0x2fb24=function(_0x335b91){while(--_0x335b91){_0x3c04d7['push'](_0x3c04d7['shift']());}};_0x2fb24(++_0x472801);}(_0xe1e5,0xe8));var _0x5e1e=function(_0x1389ae,_0x1caf91){_0x1389ae=_0x1389ae-0x0;var _0x1514d4=_0xe1e5[_0x1389ae];return _0x1514d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e1e('0x0'));var zipdir=require(_0x5e1e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e1e('0x2'));var moment=require(_0x5e1e('0x3'));var BPromise=require(_0x5e1e('0x4'));var Mustache=require(_0x5e1e('0x5'));var util=require(_0x5e1e('0x6'));var path=require(_0x5e1e('0x7'));var sox=require(_0x5e1e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5e1e('0x9'));var _=require(_0x5e1e('0xa'));var squel=require(_0x5e1e('0xb'));var crypto=require(_0x5e1e('0xc'));var jsforce=require(_0x5e1e('0xd'));var deskjs=require(_0x5e1e('0xe'));var toCsv=require(_0x5e1e('0xf'));var querystring=require('querystring');var Papa=require(_0x5e1e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5e1e('0x11'));var hardwareService=require(_0x5e1e('0x12'));var logger=require(_0x5e1e('0x13'))(_0x5e1e('0x14'));var utils=require(_0x5e1e('0x15'));var config=require(_0x5e1e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e1e('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x5e1e('0x18'),'port':0x18eb});var socket=require(_0x5e1e('0x19'))(new Redis(config['redis']));require(_0x5e1e('0x1a'))[_0x5e1e('0x1b')](socket);var jayson=require(_0x5e1e('0x1c'));var client=jayson[_0x5e1e('0x1d')][_0x5e1e('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x325a89,_0x49e994,_0x11c059,_0x3b2592){return new BPromise(function(_0x496503,_0x7d9a95){var _0x33fc98=_0x3b2592||client;return _0x33fc98[_0x5e1e('0x1f')](_0x325a89,_0x11c059)[_0x5e1e('0x20')](function(_0x2fe793){logger[_0x5e1e('0x21')](_0x5e1e('0x22'),_0x49e994,_0x5e1e('0x23'));logger[_0x5e1e('0x24')](_0x5e1e('0x25'),_0x49e994,_0x5e1e('0x23'),JSON[_0x5e1e('0x26')](_0x2fe793));if(_0x2fe793[_0x5e1e('0x27')]){if(_0x2fe793['error']['code']===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x49e994,_0x2fe793['error'][_0x5e1e('0x28')]);return _0x7d9a95(_0x2fe793[_0x5e1e('0x27')][_0x5e1e('0x28')]);}logger[_0x5e1e('0x27')](_0x5e1e('0x22'),_0x49e994,_0x2fe793['error'][_0x5e1e('0x28')]);return _0x496503(_0x2fe793[_0x5e1e('0x27')]['message']);}else{logger[_0x5e1e('0x21')](_0x5e1e('0x22'),_0x49e994,_0x5e1e('0x23'));_0x496503(_0x2fe793[_0x5e1e('0x29')][_0x5e1e('0x28')]);}})[_0x5e1e('0x2a')](function(_0x57980e){logger[_0x5e1e('0x27')]('SmsAccount,\x20%s,\x20%s',_0x49e994,_0x57980e);_0x7d9a95(_0x57980e);});});}function respondWithStatusCode(_0x35e1e1,_0x3b8dd1){_0x3b8dd1=_0x3b8dd1||0xcc;return function(_0x31cbdb){if(_0x31cbdb){return _0x35e1e1['sendStatus'](_0x3b8dd1);}return _0x35e1e1['status'](_0x3b8dd1)['end']();};}function respondWithResult(_0x5d0b0d,_0x51fd19){_0x51fd19=_0x51fd19||0xc8;return function(_0x332ffd){if(_0x332ffd){return _0x5d0b0d['status'](_0x51fd19)[_0x5e1e('0x2b')](_0x332ffd);}};}function respondWithFilteredResult(_0x2b348b,_0x493c9a){return function(_0x264262){if(_0x264262){var _0x4b618f=typeof _0x493c9a['offset']==='undefined'&&typeof _0x493c9a['limit']===_0x5e1e('0x2c');var _0x2cb299=_0x264262[_0x5e1e('0x2d')];var _0x31e9e6=_0x4b618f?0x0:_0x493c9a['offset'];var _0x47c04f=_0x4b618f?_0x264262[_0x5e1e('0x2d')]:_0x493c9a['offset']+_0x493c9a['limit'];var _0xb4d919;if(_0x47c04f>=_0x2cb299){_0x47c04f=_0x2cb299;_0xb4d919=0xc8;}else{_0xb4d919=0xce;}_0x2b348b[_0x5e1e('0x2e')](_0xb4d919);return _0x2b348b[_0x5e1e('0x2f')](_0x5e1e('0x30'),_0x31e9e6+'-'+_0x47c04f+'/'+_0x2cb299)[_0x5e1e('0x2b')](_0x264262);}return null;};}function patchUpdates(_0x50cd9e){return function(_0x90786d){try{jsonpatch['apply'](_0x90786d,_0x50cd9e,!![]);}catch(_0x4e1ca6){return BPromise[_0x5e1e('0x31')](_0x4e1ca6);}return _0x90786d[_0x5e1e('0x32')]();};}function saveUpdates(_0x52a9b8,_0x390f3b){return function(_0x464b8d){if(_0x464b8d){return _0x464b8d[_0x5e1e('0x33')](_0x52a9b8)[_0x5e1e('0x20')](function(_0x4cb146){return _0x4cb146;});}return null;};}function removeEntity(_0x4ba21c,_0x457ca9){return function(_0x425ac2){if(_0x425ac2){return _0x425ac2['destroy']()[_0x5e1e('0x20')](function(){var _0x11a9e4=_0x425ac2[_0x5e1e('0x34')]({'plain':!![]});var _0x2d269c=_0x5e1e('0x35');return db[_0x5e1e('0x36')]['destroy']({'where':{'type':_0x2d269c,'resourceId':_0x11a9e4['id']}})['then'](function(){return _0x425ac2;});})[_0x5e1e('0x20')](function(){_0x4ba21c[_0x5e1e('0x2e')](0xcc)[_0x5e1e('0x37')]();});}};}function handleEntityNotFound(_0x1e192a,_0x4210c1){return function(_0x5924c4){if(!_0x5924c4){_0x1e192a[_0x5e1e('0x38')](0x194);}return _0x5924c4;};}function handleError(_0x551587,_0x51e36e){_0x51e36e=_0x51e36e||0x1f4;return function(_0x234d52){logger['error'](_0x234d52['stack']);if(_0x234d52[_0x5e1e('0x39')]){delete _0x234d52['name'];}_0x551587['status'](_0x51e36e)[_0x5e1e('0x3a')](_0x234d52);};}exports[_0x5e1e('0x3b')]=function(_0x1bc2d4,_0x5b2107){var _0x4bb13a={'include':[{'model':db[_0x5e1e('0x3c')],'as':_0x5e1e('0x3d')}]},_0x23a751={},_0x36b3a1={'count':0x0,'rows':[]};var _0x1c66aa=_[_0x5e1e('0x3e')](db[_0x5e1e('0x3f')][_0x5e1e('0x40')],function(_0x281442){return{'name':_0x281442[_0x5e1e('0x41')],'type':_0x281442[_0x5e1e('0x42')][_0x5e1e('0x43')]};});_0x23a751['model']=_[_0x5e1e('0x3e')](_0x1c66aa,_0x5e1e('0x39'));_0x23a751[_0x5e1e('0x44')]=_[_0x5e1e('0x45')](_0x1bc2d4['query']);_0x23a751[_0x5e1e('0x46')]=_['intersection'](_0x23a751['model'],_0x23a751[_0x5e1e('0x44')]);_0x4bb13a['attributes']=_[_0x5e1e('0x47')](_0x23a751['model'],qs[_0x5e1e('0x48')](_0x1bc2d4['query'][_0x5e1e('0x48')]));_0x4bb13a[_0x5e1e('0x49')]=_0x4bb13a[_0x5e1e('0x49')][_0x5e1e('0x4a')]?_0x4bb13a[_0x5e1e('0x49')]:_0x23a751['model'];if(!_0x1bc2d4[_0x5e1e('0x44')]['hasOwnProperty'](_0x5e1e('0x4b'))){_0x4bb13a[_0x5e1e('0x4c')]=qs[_0x5e1e('0x4c')](_0x1bc2d4['query'][_0x5e1e('0x4c')]);_0x4bb13a['offset']=qs[_0x5e1e('0x4d')](_0x1bc2d4[_0x5e1e('0x44')][_0x5e1e('0x4d')]);}_0x4bb13a[_0x5e1e('0x4e')]=qs[_0x5e1e('0x4f')](_0x1bc2d4[_0x5e1e('0x44')]['sort']);_0x4bb13a['where']=qs[_0x5e1e('0x46')](_['pick'](_0x1bc2d4[_0x5e1e('0x44')],_0x23a751[_0x5e1e('0x46')]),_0x1c66aa);if(_0x1bc2d4[_0x5e1e('0x44')]['filter']){_0x4bb13a[_0x5e1e('0x50')]=_[_0x5e1e('0x51')](_0x4bb13a[_0x5e1e('0x50')],{'$or':_[_0x5e1e('0x3e')](_0x1c66aa,function(_0x24a740){if(_0x24a740[_0x5e1e('0x42')]!==_0x5e1e('0x52')){var _0x8caeba={};_0x8caeba[_0x24a740[_0x5e1e('0x39')]]={'$like':'%'+_0x1bc2d4[_0x5e1e('0x44')][_0x5e1e('0x53')]+'%'};return _0x8caeba;}})});}_0x4bb13a=_['merge']({},_0x4bb13a,_0x1bc2d4[_0x5e1e('0x54')]);var _0x1ba276={'where':_0x4bb13a[_0x5e1e('0x50')]};return db[_0x5e1e('0x3f')][_0x5e1e('0x2d')](_0x1ba276)['then'](function(_0x2a7488){_0x36b3a1[_0x5e1e('0x2d')]=_0x2a7488;if(_0x1bc2d4[_0x5e1e('0x44')][_0x5e1e('0x55')]){_0x4bb13a[_0x5e1e('0x56')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x4bb13a);})[_0x5e1e('0x20')](function(_0x2b6faa){_0x36b3a1['rows']=_0x2b6faa;return _0x36b3a1;})[_0x5e1e('0x20')](respondWithFilteredResult(_0x5b2107,_0x4bb13a))[_0x5e1e('0x2a')](handleError(_0x5b2107,null));};exports['show']=function(_0x196f0d,_0x196daa){var _0x25e94f={'raw':![],'where':{'id':_0x196f0d[_0x5e1e('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xf83135={};_0xf83135[_0x5e1e('0x58')]=_[_0x5e1e('0x45')](db['SmsAccount'][_0x5e1e('0x40')]);_0xf83135[_0x5e1e('0x44')]=_[_0x5e1e('0x45')](_0x196f0d[_0x5e1e('0x44')]);_0xf83135[_0x5e1e('0x46')]=_['intersection'](_0xf83135[_0x5e1e('0x58')],_0xf83135[_0x5e1e('0x44')]);_0x25e94f['attributes']=_[_0x5e1e('0x47')](_0xf83135[_0x5e1e('0x58')],qs[_0x5e1e('0x48')](_0x196f0d[_0x5e1e('0x44')][_0x5e1e('0x48')]));_0x25e94f[_0x5e1e('0x49')]=_0x25e94f[_0x5e1e('0x49')][_0x5e1e('0x4a')]?_0x25e94f[_0x5e1e('0x49')]:_0xf83135[_0x5e1e('0x58')];if(_0x196f0d[_0x5e1e('0x44')]['includeAll']){_0x25e94f[_0x5e1e('0x56')]=[{'all':!![]}];}_0x25e94f=_[_0x5e1e('0x51')]({},_0x25e94f,_0x196f0d['options']);return db['SmsAccount'][_0x5e1e('0x59')](_0x25e94f)[_0x5e1e('0x20')](handleEntityNotFound(_0x196daa,null))[_0x5e1e('0x20')](respondWithResult(_0x196daa,null))[_0x5e1e('0x2a')](handleError(_0x196daa,null));};exports[_0x5e1e('0x5a')]=function(_0x84a6d2,_0x10699d){return db[_0x5e1e('0x3f')][_0x5e1e('0x5a')](_0x84a6d2[_0x5e1e('0x5b')],{})[_0x5e1e('0x20')](function(_0x585ae4){var _0x26d2c7=_0x84a6d2[_0x5e1e('0x5c')]['get']({'plain':!![]});if(!_0x26d2c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26d2c7[_0x5e1e('0x5d')]===_0x5e1e('0x5c')){var _0x25a07a=_0x585ae4[_0x5e1e('0x34')]({'plain':!![]});var _0x1acbf5=_0x5e1e('0x35');return db[_0x5e1e('0x5e')][_0x5e1e('0x59')]({'where':{'name':_0x1acbf5,'userProfileId':_0x26d2c7[_0x5e1e('0x5f')]},'raw':!![]})['then'](function(_0x39bb31){if(_0x39bb31&&_0x39bb31['autoAssociation']===0x0){return db[_0x5e1e('0x36')][_0x5e1e('0x5a')]({'name':_0x25a07a[_0x5e1e('0x39')],'resourceId':_0x25a07a['id'],'type':_0x39bb31[_0x5e1e('0x39')],'sectionId':_0x39bb31['id']},{})[_0x5e1e('0x20')](function(){return _0x585ae4;});}else{return _0x585ae4;}})[_0x5e1e('0x2a')](function(_0x2b605a){logger[_0x5e1e('0x27')](_0x5e1e('0x60'),_0x2b605a);throw _0x2b605a;});}return _0x585ae4;})[_0x5e1e('0x20')](respondWithResult(_0x10699d,0xc9))[_0x5e1e('0x2a')](handleError(_0x10699d,null));};exports[_0x5e1e('0x33')]=function(_0x15a9b2,_0x4f208f){if(_0x15a9b2[_0x5e1e('0x5b')]['id']){delete _0x15a9b2[_0x5e1e('0x5b')]['id'];}return db[_0x5e1e('0x3f')]['find']({'where':{'id':_0x15a9b2[_0x5e1e('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x5e1e('0x3d')}]})[_0x5e1e('0x20')](handleEntityNotFound(_0x4f208f,null))[_0x5e1e('0x20')](saveUpdates(_0x15a9b2[_0x5e1e('0x5b')],null))['then'](respondWithResult(_0x4f208f,null))[_0x5e1e('0x2a')](handleError(_0x4f208f,null));};exports[_0x5e1e('0x61')]=function(_0x479db4,_0x2308d7){return db['SmsAccount'][_0x5e1e('0x59')]({'where':{'id':_0x479db4[_0x5e1e('0x57')]['id']}})[_0x5e1e('0x20')](handleEntityNotFound(_0x2308d7,null))['then'](removeEntity(_0x2308d7,null))[_0x5e1e('0x2a')](handleError(_0x2308d7,null));};exports[_0x5e1e('0x62')]=function(_0x2cd45d,_0x5e732f){return db['SmsAccount'][_0x5e1e('0x62')]()[_0x5e1e('0x20')](respondWithResult(_0x5e732f,null))['catch'](handleError(_0x5e732f,null));};exports[_0x5e1e('0x63')]=function(_0x2acce7,_0x2043c8,_0x19f44f){if(_0x2acce7[_0x5e1e('0x5b')]['id']){delete _0x2acce7[_0x5e1e('0x5b')]['id'];}return db[_0x5e1e('0x3f')][_0x5e1e('0x59')]({'where':{'id':_0x2acce7[_0x5e1e('0x57')]['id']}})['then'](handleEntityNotFound(_0x2043c8,null))[_0x5e1e('0x20')](function(_0x2eb951){if(_0x2eb951){_0x2acce7[_0x5e1e('0x5b')][_0x5e1e('0x64')]=_0x2eb951['id'];return db[_0x5e1e('0x65')]['create'](_0x2acce7[_0x5e1e('0x5b')]);}})[_0x5e1e('0x20')](respondWithResult(_0x2043c8,null))[_0x5e1e('0x2a')](handleError(_0x2043c8,null));};exports[_0x5e1e('0x66')]=function(_0x5977d6,_0x195530,_0x53cdca){var _0x276b49={'raw':![],'where':{}};var _0x3987e2={};var _0x4de71b={'count':0x0,'rows':[]};return db[_0x5e1e('0x3f')][_0x5e1e('0x67')]({'where':{'id':_0x5977d6[_0x5e1e('0x57')]['id']}})[_0x5e1e('0x20')](handleEntityNotFound(_0x195530,null))['then'](function(_0x50ec3e){if(_0x50ec3e){_0x3987e2[_0x5e1e('0x58')]=_['keys'](db[_0x5e1e('0x65')][_0x5e1e('0x40')]);_0x3987e2['query']=_[_0x5e1e('0x45')](_0x5977d6[_0x5e1e('0x44')]);_0x3987e2['filters']=_[_0x5e1e('0x47')](_0x3987e2[_0x5e1e('0x58')],_0x3987e2[_0x5e1e('0x44')]);_0x276b49['attributes']=_[_0x5e1e('0x47')](_0x3987e2[_0x5e1e('0x58')],qs[_0x5e1e('0x48')](_0x5977d6[_0x5e1e('0x44')][_0x5e1e('0x48')]));_0x276b49['attributes']=_0x276b49[_0x5e1e('0x49')][_0x5e1e('0x4a')]?_0x276b49['attributes']:_0x3987e2[_0x5e1e('0x58')];if(!_0x5977d6[_0x5e1e('0x44')][_0x5e1e('0x68')](_0x5e1e('0x4b'))){_0x276b49[_0x5e1e('0x4c')]=qs['limit'](_0x5977d6['query'][_0x5e1e('0x4c')]);_0x276b49[_0x5e1e('0x4d')]=qs['offset'](_0x5977d6['query']['offset']);}_0x276b49[_0x5e1e('0x4e')]=qs[_0x5e1e('0x4f')](_0x5977d6[_0x5e1e('0x44')][_0x5e1e('0x4f')]);_0x276b49[_0x5e1e('0x50')]=qs[_0x5e1e('0x46')](_[_0x5e1e('0x69')](_0x5977d6[_0x5e1e('0x44')],_0x3987e2[_0x5e1e('0x46')]));_0x276b49[_0x5e1e('0x50')][_0x5e1e('0x64')]=_0x50ec3e['id'];if(_0x5977d6[_0x5e1e('0x44')][_0x5e1e('0x53')]){_0x276b49[_0x5e1e('0x50')]=_[_0x5e1e('0x51')](_0x276b49[_0x5e1e('0x50')],{'$or':_[_0x5e1e('0x3e')](_0x276b49[_0x5e1e('0x49')],function(_0x2813a6){var _0x5f4611={};_0x5f4611[_0x2813a6]={'$like':'%'+_0x5977d6[_0x5e1e('0x44')][_0x5e1e('0x53')]+'%'};return _0x5f4611;})});}_0x276b49=_[_0x5e1e('0x51')]({},_0x276b49,_0x5977d6['options']);return db['Disposition'][_0x5e1e('0x2d')]({'where':_0x276b49[_0x5e1e('0x50')]})[_0x5e1e('0x20')](function(_0x11e41a){_0x4de71b['count']=_0x11e41a;if(_0x5977d6[_0x5e1e('0x44')]['includeAll']){_0x276b49[_0x5e1e('0x56')]=[{'all':!![]}];}return db[_0x5e1e('0x65')]['findAll'](_0x276b49);})[_0x5e1e('0x20')](function(_0x595326){_0x4de71b[_0x5e1e('0x6a')]=_0x595326;return _0x4de71b;});}})[_0x5e1e('0x20')](respondWithFilteredResult(_0x195530,_0x276b49))[_0x5e1e('0x2a')](handleError(_0x195530,null));};exports['removeDispositions']=function(_0x43219e,_0x5c2d84,_0x437c24){return db[_0x5e1e('0x3f')]['find']({'where':{'id':_0x43219e[_0x5e1e('0x57')]['id']}})['then'](handleEntityNotFound(_0x5c2d84,null))[_0x5e1e('0x20')](function(_0x54016d){if(_0x54016d){return _0x54016d['removeDispositions'](_0x43219e[_0x5e1e('0x44')][_0x5e1e('0x6b')]);}})[_0x5e1e('0x20')](respondWithStatusCode(_0x5c2d84,null))['catch'](handleError(_0x5c2d84,null));};exports[_0x5e1e('0x6c')]=function(_0x250695,_0x494d9f,_0x2a88f5){if(_0x250695['body']['id']){delete _0x250695[_0x5e1e('0x5b')]['id'];}return db[_0x5e1e('0x3f')][_0x5e1e('0x59')]({'where':{'id':_0x250695[_0x5e1e('0x57')]['id']}})[_0x5e1e('0x20')](handleEntityNotFound(_0x494d9f,null))[_0x5e1e('0x20')](function(_0x19c333){if(_0x19c333){_0x250695[_0x5e1e('0x5b')][_0x5e1e('0x64')]=_0x19c333['id'];return db[_0x5e1e('0x6d')][_0x5e1e('0x5a')](_0x250695[_0x5e1e('0x5b')]);}})['then'](respondWithResult(_0x494d9f,null))[_0x5e1e('0x2a')](handleError(_0x494d9f,null));};exports['getAnswers']=function(_0x4ef9a4,_0x35d0ea,_0x489292){var _0x1ba222={'raw':![],'where':{}};var _0x570942={};var _0x3d3f10={'count':0x0,'rows':[]};return db[_0x5e1e('0x3f')][_0x5e1e('0x67')]({'where':{'id':_0x4ef9a4['params']['id']}})[_0x5e1e('0x20')](handleEntityNotFound(_0x35d0ea,null))[_0x5e1e('0x20')](function(_0x184c64){if(_0x184c64){_0x570942[_0x5e1e('0x58')]=_[_0x5e1e('0x45')](db['CannedAnswer'][_0x5e1e('0x40')]);_0x570942[_0x5e1e('0x44')]=_['keys'](_0x4ef9a4[_0x5e1e('0x44')]);_0x570942[_0x5e1e('0x46')]=_[_0x5e1e('0x47')](_0x570942[_0x5e1e('0x58')],_0x570942['query']);_0x1ba222['attributes']=_['intersection'](_0x570942[_0x5e1e('0x58')],qs[_0x5e1e('0x48')](_0x4ef9a4[_0x5e1e('0x44')][_0x5e1e('0x48')]));_0x1ba222[_0x5e1e('0x49')]=_0x1ba222['attributes'][_0x5e1e('0x4a')]?_0x1ba222[_0x5e1e('0x49')]:_0x570942[_0x5e1e('0x58')];if(!_0x4ef9a4[_0x5e1e('0x44')]['hasOwnProperty'](_0x5e1e('0x4b'))){_0x1ba222[_0x5e1e('0x4c')]=qs[_0x5e1e('0x4c')](_0x4ef9a4[_0x5e1e('0x44')][_0x5e1e('0x4c')]);_0x1ba222[_0x5e1e('0x4d')]=qs[_0x5e1e('0x4d')](_0x4ef9a4[_0x5e1e('0x44')][_0x5e1e('0x4d')]);}_0x1ba222[_0x5e1e('0x4e')]=qs[_0x5e1e('0x4f')](_0x4ef9a4[_0x5e1e('0x44')][_0x5e1e('0x4f')]);_0x1ba222[_0x5e1e('0x50')]=qs[_0x5e1e('0x46')](_[_0x5e1e('0x69')](_0x4ef9a4[_0x5e1e('0x44')],_0x570942[_0x5e1e('0x46')]));_0x1ba222[_0x5e1e('0x50')]['SmsAccountId']=_0x184c64['id'];if(_0x4ef9a4[_0x5e1e('0x44')][_0x5e1e('0x53')]){_0x1ba222[_0x5e1e('0x50')]=_[_0x5e1e('0x51')](_0x1ba222[_0x5e1e('0x50')],{'$or':_[_0x5e1e('0x3e')](_0x1ba222[_0x5e1e('0x49')],function(_0xab3312){var _0x15aa09={};_0x15aa09[_0xab3312]={'$like':'%'+_0x4ef9a4[_0x5e1e('0x44')][_0x5e1e('0x53')]+'%'};return _0x15aa09;})});}_0x1ba222=_[_0x5e1e('0x51')]({},_0x1ba222,_0x4ef9a4['options']);return db['CannedAnswer']['count']({'where':_0x1ba222['where']})[_0x5e1e('0x20')](function(_0x50c5ad){_0x3d3f10[_0x5e1e('0x2d')]=_0x50c5ad;if(_0x4ef9a4['query'][_0x5e1e('0x55')]){_0x1ba222['include']=[{'all':!![]}];}return db[_0x5e1e('0x6d')][_0x5e1e('0x6e')](_0x1ba222);})[_0x5e1e('0x20')](function(_0x17fb2d){_0x3d3f10[_0x5e1e('0x6a')]=_0x17fb2d;return _0x3d3f10;});}})[_0x5e1e('0x20')](respondWithFilteredResult(_0x35d0ea,_0x1ba222))[_0x5e1e('0x2a')](handleError(_0x35d0ea,null));};exports[_0x5e1e('0x6f')]=function(_0x55f7e3,_0x53d68f,_0x16218d){return db[_0x5e1e('0x3f')]['find']({'where':{'id':_0x55f7e3['params']['id']}})['then'](handleEntityNotFound(_0x53d68f,null))['then'](function(_0xabc978){if(_0xabc978){return _0xabc978['removeAnswers'](_0x55f7e3[_0x5e1e('0x44')][_0x5e1e('0x6b')]);}})[_0x5e1e('0x20')](respondWithStatusCode(_0x53d68f,null))[_0x5e1e('0x2a')](handleError(_0x53d68f,null));};exports[_0x5e1e('0x70')]=function(_0x2fd430,_0x3976f0,_0x2f51ee){var _0x322535={'channel':'sms'};var _0xee8e03=[];var _0x2e5591=[];var _0x3d50c9={};return db['SmsAccount']['find']({'where':{'id':_0x2fd430['params']['id']},'include':[{'model':db[_0x5e1e('0x71')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x3976f0,null))[_0x5e1e('0x20')](function(_0x1ee8fc){_0x322535[_0x5e1e('0x72')]=_0x1ee8fc;_0x322535[_0x5e1e('0x73')]=_[_0x5e1e('0x74')](_0x1ee8fc[_0x5e1e('0x75')],[_0x5e1e('0x76')],[_0x5e1e('0x77')]);if(_0x322535[_0x5e1e('0x72')][_0x5e1e('0x75')]){delete _0x322535[_0x5e1e('0x72')]['Applications'];}return db[_0x5e1e('0x78')][_0x5e1e('0x62')]();})[_0x5e1e('0x20')](function(_0xd23e22){if(!_0xd23e22){throw new db['Sequelize']['ValidationError'](_0x5e1e('0x79'));}_0xee8e03=_[_0x5e1e('0x7a')](_['keys'](_0xd23e22),[_0x5e1e('0x7b'),_0x5e1e('0x7c')]);_0x2e5591=_[_0x5e1e('0x7a')](_[_0x5e1e('0x45')](_0xd23e22),[_0x5e1e('0x7b'),_0x5e1e('0x7c'),_0x5e1e('0x7d'),_0x5e1e('0x7e')]);_0x322535['body']={'mapKey':_0x5e1e('0x7f')};if(_0x322535[_0x5e1e('0x72')][_0x5e1e('0x42')]){switch(_0x322535['account'][_0x5e1e('0x42')]){case _0x5e1e('0x80'):_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x81')]=_0x2fd430[_0x5e1e('0x5b')][_0x5e1e('0x82')];_0x322535[_0x5e1e('0x5b')]['body']=_0x2fd430[_0x5e1e('0x5b')]['Body'];_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x83')]=_0x2fd430[_0x5e1e('0x5b')]['MessageSid'];break;case _0x5e1e('0x84'):_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x81')]='+'+_0x2fd430[_0x5e1e('0x5b')][_0x5e1e('0x85')];_0x322535[_0x5e1e('0x5b')]['body']=_0x2fd430[_0x5e1e('0x5b')][_0x5e1e('0x86')];break;case'connectel':_0x322535[_0x5e1e('0x5b')]['from']=_0x2fd430[_0x5e1e('0x5b')][_0x5e1e('0x81')];_0x322535['body'][_0x5e1e('0x5b')]=_0x2fd430[_0x5e1e('0x5b')][_0x5e1e('0x28')];break;case _0x5e1e('0x87'):_0x322535[_0x5e1e('0x5b')]['from']=_0x2fd430[_0x5e1e('0x5b')][_0x5e1e('0x81')];_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x5b')]=_0x2fd430[_0x5e1e('0x5b')]['body'];_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x83')]=_0x2fd430[_0x5e1e('0x5b')][_0x5e1e('0x88')];break;case _0x5e1e('0x89'):_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x81')]=_0x2fd430['body'][_0x5e1e('0x82')];_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x5b')]=_0x2fd430[_0x5e1e('0x5b')][_0x5e1e('0x8a')];_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x83')]=_0x2fd430[_0x5e1e('0x5b')][_0x5e1e('0x8b')];break;case _0x5e1e('0x8c'):_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x81')]='+'+_0x2fd430['body'][_0x5e1e('0x8d')][0x0][_0x5e1e('0x81')];_0x322535['body']['body']=_0x2fd430['body'][_0x5e1e('0x8d')][0x0][_0x5e1e('0x86')];_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x83')]=_0x2fd430[_0x5e1e('0x5b')][_0x5e1e('0x8d')][0x0][_0x5e1e('0x83')];break;case _0x5e1e('0x8e'):_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x81')]=_0x2fd430['body'][_0x5e1e('0x8f')];_0x322535['body']['body']=_0x2fd430[_0x5e1e('0x5b')]['segmentedMessage'][_0x5e1e('0x28')];break;case _0x5e1e('0x90'):_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x81')]=_0x2fd430['body'][_0x5e1e('0x91')];_0x322535[_0x5e1e('0x5b')]['body']=_0x2fd430[_0x5e1e('0x5b')][_0x5e1e('0x86')];_0x322535['body'][_0x5e1e('0x83')]=_0x2fd430[_0x5e1e('0x5b')][_0x5e1e('0x92')];break;case _0x5e1e('0x93'):_0x322535['body'][_0x5e1e('0x83')]=_0x2fd430['body'][0x0][_0x5e1e('0x28')]['id'];_0x322535[_0x5e1e('0x5b')]['from']=_0x2fd430[_0x5e1e('0x5b')][0x0][_0x5e1e('0x28')][_0x5e1e('0x81')];_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x5b')]=_0x2fd430[_0x5e1e('0x5b')][0x0]['message'][_0x5e1e('0x86')];break;case'intelepeer':_0x322535['body']['from']=_0x2fd430[_0x5e1e('0x5b')][_0x5e1e('0x81')];_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x5b')]=_0x2fd430['body'][_0x5e1e('0x28')];_0x322535[_0x5e1e('0x5b')]['messageId']=_0x2fd430[_0x5e1e('0x5b')][_0x5e1e('0x94')];break;}}if(_0x322535['body']['id']){delete _0x322535[_0x5e1e('0x5b')]['id'];}if(_[_0x5e1e('0x95')](_0x322535['body'][_0x5e1e('0x81')])){throw new db[(_0x5e1e('0x96'))]['ValidationError'](_0x5e1e('0x97'));}if(_[_0x5e1e('0x95')](_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x5b')])||_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x5b')]===''){throw new db[(_0x5e1e('0x96'))][(_0x5e1e('0x98'))](_0x5e1e('0x99'));}if(_['isNil'](_0x322535['body'][_0x5e1e('0x9a')])){throw new db['Sequelize']['ValidationError'](_0x5e1e('0x9b')+_0x2e5591);}if(!_['includes'](_0x2e5591,_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x9a')])){throw new db[(_0x5e1e('0x96'))][(_0x5e1e('0x98'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2e5591);}_0x3d50c9[_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x9a')]]=_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x81')];return db[_0x5e1e('0x9c')][_0x5e1e('0x59')]({'where':{'id':_0x322535[_0x5e1e('0x72')][_0x5e1e('0x7e')]},'include':[{'model':db[_0x5e1e('0x78')],'as':_0x5e1e('0x9d'),'where':_0x3d50c9,'limit':0x1,'order':[[_0x5e1e('0x7c'),_0x5e1e('0x9e')]]}]});})[_0x5e1e('0x20')](handleEntityNotFound(_0x3976f0,null))['then'](function(_0x15689b){if(_0x15689b){_0x322535[_0x5e1e('0x9f')]=_[_0x5e1e('0xa0')](_0x15689b,['Contacts']);if(_0x15689b[_0x5e1e('0x9d')][_0x5e1e('0x4a')]){return _0x15689b[_0x5e1e('0x9d')][0x0];}var _0xeaf49c=_['defaults'](_0x322535[_0x5e1e('0x5b')],{'firstName':_0x322535['body'][_0x5e1e('0x81')],'ListId':_0x15689b['id']});_0xeaf49c[_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x9a')]]=_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x81')];return db[_0x5e1e('0x78')][_0x5e1e('0x5a')](_0xeaf49c,{'fields':_0xee8e03,'raw':!![]});}})[_0x5e1e('0x20')](handleEntityNotFound(_0x3976f0,null))[_0x5e1e('0x20')](function(_0x3ca552){if(_0x3ca552){_0x322535['contact']=_0x3ca552;var _0x7d0435={'ContactId':_0x3ca552['id'],'phone':_0x322535['body'][_0x5e1e('0x81')],'SmsAccountId':_0x2fd430[_0x5e1e('0x57')]['id']};var _0x4a4d88={'ContactId':_0x3ca552['id'],'SmsAccountId':_0x2fd430[_0x5e1e('0x57')]['id'],'closed':![]};return db[_0x5e1e('0xa1')][_0x5e1e('0x59')]({'where':_0x4a4d88})[_0x5e1e('0x20')](function(_0x4e8322){if(_0x4e8322){return[_0x4e8322,![]];}return db[_0x5e1e('0xa1')][_0x5e1e('0x5a')](_0x7d0435)['then'](function(_0x4ef792){return[_0x4ef792,!![]];});});}})['spread'](function(_0x4f7ebd,_0x3865fa){_0x322535[_0x5e1e('0xa2')]=_0x4f7ebd[_0x5e1e('0x34')]({'plain':!![]});_0x322535['interaction'][_0x5e1e('0xa3')]=![];if(_0x3865fa){if(_0x322535[_0x5e1e('0x72')]['autoclose']){_0x322535[_0x5e1e('0x73')][_0x5e1e('0xa4')]({'id':0x0,'priority':_0x322535['applications']['length']+0x1,'app':'close','appdata':_0x5e1e('0xa5'),'interval':_0x5e1e('0xa6')});}_0x322535[_0x5e1e('0xa2')][_0x5e1e('0xa3')]=!![];}return db['SmsMessage'][_0x5e1e('0x5a')]({'phone':_0x322535[_0x5e1e('0x5b')]['from'],'messageId':_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x83')],'body':_0x322535[_0x5e1e('0x5b')][_0x5e1e('0x5b')],'SmsAccountId':_0x2fd430[_0x5e1e('0x57')]['id'],'SmsInteractionId':_0x4f7ebd['id'],'direction':'in','ContactId':_0x4f7ebd[_0x5e1e('0xa7')],'AttachmentId':_0x322535[_0x5e1e('0x5b')][_0x5e1e('0xa8')]});})[_0x5e1e('0x20')](function(_0x2eb14d){_0x322535['message']=_0x2eb14d;if(_0x322535[_0x5e1e('0xa2')]['UserId']){return db['User'][_0x5e1e('0x59')]({'attributes':['id',_0x5e1e('0x39')],'where':{'id':_0x322535[_0x5e1e('0xa2')][_0x5e1e('0xa9')]}})[_0x5e1e('0x20')](function(_0x21ee37){if(_0x21ee37){_0x322535['applications'][_0x5e1e('0xaa')]({'id':0x0,'priority':0x0,'app':_0x5e1e('0xab'),'appdata':_0x21ee37[_0x5e1e('0x39')]+','+(_0x322535[_0x5e1e('0x72')][_0x5e1e('0xac')]||0xa),'interval':_0x5e1e('0xa6')});}return respondWithRpcPromise(_0x5e1e('0xad'),_0x5e1e('0xae'),_0x322535);});}return respondWithRpcPromise(_0x5e1e('0xad'),_0x5e1e('0xae'),_0x322535);})[_0x5e1e('0x20')](function(_0x20a88b){if(_0x20a88b){var _0x1c0988=0xc8;var _0x43e34e=_0x5e1e('0xaf');logger[_0x5e1e('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x43e34e,_0x1c0988,'entity\x20found');logger[_0x5e1e('0x24')](_0x5e1e('0xb0'),_0x43e34e,_0x1c0988,_0x5e1e('0xb1'),JSON['stringify'](_0x20a88b));if(_0x322535['account']['type']===_0x5e1e('0x80')){return _0x3976f0['status'](_0x1c0988)[_0x5e1e('0x2f')]('Content-Type','text/xml')[_0x5e1e('0x3a')]('<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<Response></Response>');}else{return _0x3976f0[_0x5e1e('0x2e')](_0x1c0988)[_0x5e1e('0x2b')](_0x20a88b);}}})[_0x5e1e('0x2a')](handleError(_0x3976f0,null));};exports['addApplications']=function(_0x239d46,_0x2bf0da){var _0x156b1b=_0x239d46[_0x5e1e('0x57')]['id'];var _0x1c96cc=_0x239d46['body'];var _0x254c33=0xc8;var _0x1db686=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x5e1e('0xb2')][_0x5e1e('0xb3')][_0x5e1e('0xb4')]['READ_COMMITTED']},function(_0x2354f3){return db[_0x5e1e('0x3f')][_0x5e1e('0x67')]({'where':{'id':_0x156b1b},'transaction':_0x2354f3})[_0x5e1e('0x20')](function(_0x19dd84){if(_0x19dd84){return db[_0x5e1e('0x71')][_0x5e1e('0x61')]({'where':{'SmsAccountId':_0x156b1b},'transaction':_0x2354f3})[_0x5e1e('0x20')](function(){var _0x218c43=_['map'](_0x1c96cc,function(_0x2ff5b9){_0x2ff5b9['SmsAccountId']=_0x156b1b;return _0x2ff5b9;});return db[_0x5e1e('0x71')][_0x5e1e('0xb5')](_0x218c43,{'transaction':_0x2354f3});});}else{_0x254c33=0x194;_0x1db686=[];}});})[_0x5e1e('0x20')](function(){if(_0x254c33!==0x194){return db['SmsApplication'][_0x5e1e('0xb6')]({'where':{'SmsAccountId':_0x156b1b},'order':_0x5e1e('0x76')})[_0x5e1e('0x20')](function(_0x2d3db0){_0x1db686=_0x2d3db0;});}})[_0x5e1e('0x2a')](function(_0x4a05c3){_0x254c33=0x1f4;logger[_0x5e1e('0x27')](_0x4a05c3[_0x5e1e('0xb7')]);if(_0x4a05c3['name']){delete _0x4a05c3[_0x5e1e('0x39')];}_0x1db686=_0x4a05c3;})[_0x5e1e('0xb8')](function(){if(_0x1db686===null){_0x2bf0da[_0x5e1e('0x38')](_0x254c33);}else{if(_0x254c33===0x1f4){_0x2bf0da[_0x5e1e('0x2e')](_0x254c33)['send'](_0x1db686);}else{_0x2bf0da['status'](_0x254c33)['json'](_0x1db686);}}});};exports[_0x5e1e('0xb9')]=function(_0x1a8dd0,_0x6267dc,_0x2986d3){var _0x263125={};var _0x346c1f={};var _0x2f3de1;var _0x3dde44;return db[_0x5e1e('0x3f')]['findOne']({'where':{'id':_0x1a8dd0['params']['id']}})[_0x5e1e('0x20')](handleEntityNotFound(_0x6267dc,null))['then'](function(_0x448c94){if(_0x448c94){_0x2f3de1=_0x448c94;_0x346c1f['model']=_[_0x5e1e('0x45')](db[_0x5e1e('0x71')][_0x5e1e('0x40')]);_0x346c1f['query']=_[_0x5e1e('0x45')](_0x1a8dd0[_0x5e1e('0x44')]);_0x346c1f['filters']=_['intersection'](_0x346c1f[_0x5e1e('0x58')],_0x346c1f[_0x5e1e('0x44')]);_0x263125['attributes']=_[_0x5e1e('0x47')](_0x346c1f[_0x5e1e('0x58')],qs[_0x5e1e('0x48')](_0x1a8dd0[_0x5e1e('0x44')][_0x5e1e('0x48')]));_0x263125['attributes']=_0x263125[_0x5e1e('0x49')]['length']?_0x263125[_0x5e1e('0x49')]:_0x346c1f[_0x5e1e('0x58')];_0x263125[_0x5e1e('0x4e')]=qs[_0x5e1e('0x4f')](_0x1a8dd0[_0x5e1e('0x44')][_0x5e1e('0x4f')]);_0x263125[_0x5e1e('0x50')]=qs[_0x5e1e('0x46')](_[_0x5e1e('0x69')](_0x1a8dd0[_0x5e1e('0x44')],_0x346c1f[_0x5e1e('0x46')]));if(_0x1a8dd0[_0x5e1e('0x44')][_0x5e1e('0x53')]){_0x263125['where']=_['merge'](_0x263125[_0x5e1e('0x50')],{'$or':_[_0x5e1e('0x3e')](_0x263125['attributes'],function(_0x1cad49){var _0x1a9002={};_0x1a9002[_0x1cad49]={'$like':'%'+_0x1a8dd0[_0x5e1e('0x44')]['filter']+'%'};return _0x1a9002;})});}_0x263125=_[_0x5e1e('0x51')]({},_0x263125,_0x1a8dd0['options']);return _0x2f3de1['getApplications'](_0x263125);}})[_0x5e1e('0x20')](function(_0x14432f){if(_0x14432f){_0x3dde44=_0x14432f[_0x5e1e('0x4a')];if(!_0x1a8dd0['query'][_0x5e1e('0x68')]('nolimit')){_0x263125['limit']=qs[_0x5e1e('0x4c')](_0x1a8dd0[_0x5e1e('0x44')]['limit']);_0x263125[_0x5e1e('0x4d')]=qs[_0x5e1e('0x4d')](_0x1a8dd0['query']['offset']);}return _0x2f3de1[_0x5e1e('0xb9')](_0x263125);}})[_0x5e1e('0x20')](function(_0x5a779d){if(_0x5a779d){return _0x5a779d?{'count':_0x3dde44,'rows':_0x5a779d}:null;}})[_0x5e1e('0x20')](respondWithResult(_0x6267dc,null))[_0x5e1e('0x2a')](handleError(_0x6267dc,null));};exports[_0x5e1e('0xba')]=function(_0x3ca423,_0x2ed526,_0x36bfb3){var _0xe8cd34={'raw':![],'where':{}};var _0x2257d8={};var _0x125a03={'count':0x0,'rows':[]};return db[_0x5e1e('0x3f')][_0x5e1e('0x67')]({'where':{'id':_0x3ca423[_0x5e1e('0x57')]['id']}})[_0x5e1e('0x20')](handleEntityNotFound(_0x2ed526,null))['then'](function(_0x512e80){if(_0x512e80){_0x2257d8[_0x5e1e('0x58')]=_[_0x5e1e('0x45')](db['SmsInteraction'][_0x5e1e('0x40')]);_0x2257d8[_0x5e1e('0x44')]=_['keys'](_0x3ca423['query']);_0x2257d8['filters']=_[_0x5e1e('0x47')](_0x2257d8[_0x5e1e('0x58')],_0x2257d8[_0x5e1e('0x44')]);_0xe8cd34[_0x5e1e('0x49')]=_[_0x5e1e('0x47')](_0x2257d8[_0x5e1e('0x58')],qs[_0x5e1e('0x48')](_0x3ca423[_0x5e1e('0x44')][_0x5e1e('0x48')]));_0xe8cd34[_0x5e1e('0x49')]=_0xe8cd34[_0x5e1e('0x49')]['length']?_0xe8cd34[_0x5e1e('0x49')]:_0x2257d8['model'];if(!_0x3ca423[_0x5e1e('0x44')][_0x5e1e('0x68')](_0x5e1e('0x4b'))){_0xe8cd34[_0x5e1e('0x4c')]=qs[_0x5e1e('0x4c')](_0x3ca423[_0x5e1e('0x44')]['limit']);_0xe8cd34[_0x5e1e('0x4d')]=qs[_0x5e1e('0x4d')](_0x3ca423[_0x5e1e('0x44')][_0x5e1e('0x4d')]);}_0xe8cd34[_0x5e1e('0x4e')]=qs[_0x5e1e('0x4f')](_0x3ca423[_0x5e1e('0x44')]['sort']);_0xe8cd34[_0x5e1e('0x50')]=qs[_0x5e1e('0x46')](_['pick'](_0x3ca423[_0x5e1e('0x44')],_0x2257d8[_0x5e1e('0x46')]));_0xe8cd34[_0x5e1e('0x50')][_0x5e1e('0x64')]=_0x512e80['id'];if(_0x3ca423[_0x5e1e('0x44')][_0x5e1e('0x53')]){_0xe8cd34[_0x5e1e('0x50')]=_[_0x5e1e('0x51')](_0xe8cd34['where'],{'$or':_[_0x5e1e('0x3e')](_0xe8cd34['attributes'],function(_0x3e259e){var _0x29a177={};_0x29a177[_0x3e259e]={'$like':'%'+_0x3ca423[_0x5e1e('0x44')][_0x5e1e('0x53')]+'%'};return _0x29a177;})});}_0xe8cd34=_['merge']({},_0xe8cd34,_0x3ca423[_0x5e1e('0x54')]);return db['SmsInteraction'][_0x5e1e('0x2d')]({'where':_0xe8cd34[_0x5e1e('0x50')]})[_0x5e1e('0x20')](function(_0x4d1d59){_0x125a03['count']=_0x4d1d59;if(_0x3ca423['query']['includeAll']){_0xe8cd34[_0x5e1e('0x56')]=[{'model':db[_0x5e1e('0x78')],'as':_0x5e1e('0xbb'),'required':![]},{'model':db[_0x5e1e('0xbc')],'as':_0x5e1e('0xbd'),'attributes':[_0x5e1e('0x39'),_0x5e1e('0xbe'),_0x5e1e('0xbf')],'required':![]},{'model':db[_0x5e1e('0xc0')],'as':_0x5e1e('0xc1'),'attributes':['id',_0x5e1e('0x39'),_0x5e1e('0xc2')],'where':_0x3ca423[_0x5e1e('0x44')][_0x5e1e('0xc3')]?{'id':_0x3ca423[_0x5e1e('0x44')]['tag']}:undefined,'required':_0x3ca423[_0x5e1e('0x44')][_0x5e1e('0xc3')]?!![]:![]}];}return db[_0x5e1e('0xa1')][_0x5e1e('0x6e')](_0xe8cd34);})[_0x5e1e('0x20')](function(_0x917028){_0x125a03['rows']=_0x917028;return _0x125a03;});}})['then'](respondWithFilteredResult(_0x2ed526,_0xe8cd34))[_0x5e1e('0x2a')](handleError(_0x2ed526,null));};exports['send']=function(_0x43f104,_0x4618fc,_0x3a76ca){var _0x5ed7a1,_0x1fc4fb,_0xa472a5;if(_[_0x5e1e('0x95')](_0x43f104['body'][_0x5e1e('0x5b')])||_0x43f104[_0x5e1e('0x5b')][_0x5e1e('0x5b')]===''){throw new db[(_0x5e1e('0x96'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5e1e('0x95')](_0x43f104[_0x5e1e('0x5b')]['to'])){throw new db[(_0x5e1e('0x96'))][(_0x5e1e('0x98'))](_0x5e1e('0xc4'));}_0x5ed7a1=_0x43f104['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0x43f104['params']['id']},'include':[{'model':db['CmList'],'as':_0x5e1e('0xc5'),'include':[{'model':db[_0x5e1e('0x78')],'as':_0x5e1e('0x9d'),'where':{'mobile':_0x5ed7a1},'limit':0x1,'order':[[_0x5e1e('0x7c'),'DESC']]}]}]})[_0x5e1e('0x20')](handleEntityNotFound(_0x4618fc,null))['then'](function(_0x3ad925){if(_0x3ad925&&_0x3ad925['List']){_0x1fc4fb=_0x3ad925['get']({'plain':!![]});if(_0x1fc4fb['List']&&_0x1fc4fb[_0x5e1e('0xc5')][_0x5e1e('0x9d')][_0x5e1e('0x4a')]){return _0x1fc4fb[_0x5e1e('0xc5')]['Contacts'][0x0];}return db['CmContact'][_0x5e1e('0x5a')](_[_0x5e1e('0xc6')](_0x43f104[_0x5e1e('0x5b')],{'firstName':_0x5ed7a1,'mobile':_0x5ed7a1,'phone':_0x5ed7a1,'ListId':_0x1fc4fb[_0x5e1e('0x7e')]}));}})['then'](handleEntityNotFound(_0x4618fc,null))[_0x5e1e('0x20')](function(_0x1c5fdb){if(_0x1c5fdb){_0xa472a5=_0x1c5fdb;return db[_0x5e1e('0xa1')][_0x5e1e('0x59')]({'where':{'ContactId':_0xa472a5['id'],'closed':![],'SmsAccountId':_0x1fc4fb['id']}})[_0x5e1e('0x20')](function(_0x4eae10){if(_0x4eae10){return[_0x4eae10,![]];}return db[_0x5e1e('0xa1')][_0x5e1e('0x5a')]({'UserId':_0x43f104['user']['id'],'ContactId':_0xa472a5['id'],'SmsAccountId':_0x1fc4fb['id'],'phone':_0x5ed7a1,'firstMsgDirection':_0x5e1e('0xc7'),'Messages':[_['merge'](_0x43f104['body'],{'read':![],'body':_0x43f104[_0x5e1e('0x5b')][_0x5e1e('0x5b')],'phone':_0x5ed7a1,'SmsAccountId':_0x1fc4fb['id'],'UserId':_0x43f104[_0x5e1e('0x5c')]['id'],'ContactId':_0xa472a5['id']})]},{'include':[{'model':db[_0x5e1e('0xc8')],'as':_0x5e1e('0xc9')}]})[_0x5e1e('0x20')](function(_0x492008){return[_0x492008,!![]];});});}})['spread'](function(_0x286dc7,_0x324b33){if(_0x324b33){return _0x286dc7;}return db['SmsMessage'][_0x5e1e('0x5a')](_[_0x5e1e('0x51')](_0x43f104[_0x5e1e('0x5b')],{'read':![],'body':_0x43f104[_0x5e1e('0x5b')][_0x5e1e('0x5b')],'phone':_0x5ed7a1,'SmsAccountId':_0x1fc4fb['id'],'SmsInteractionId':_0x286dc7['id'],'UserId':_0x43f104[_0x5e1e('0x5c')]['id'],'ContactId':_0xa472a5['id']}))[_0x5e1e('0x20')](function(_0x1a8c8f){_0x286dc7[_0x5e1e('0xca')][_0x5e1e('0xc9')]=[];_0x286dc7[_0x5e1e('0xca')][_0x5e1e('0xc9')][_0x5e1e('0xa4')](_0x1a8c8f[_0x5e1e('0xca')]);return _0x286dc7;});})[_0x5e1e('0x20')](respondWithResult(_0x4618fc,null))[_0x5e1e('0x2a')](handleError(_0x4618fc,null));};exports[_0x5e1e('0x2e')]=function(_0x52bffd,_0x2e2250,_0x23c866){if(_0x52bffd[_0x5e1e('0x5b')]['id']){delete _0x52bffd[_0x5e1e('0x5b')]['id'];}var _0x11264e,_0x9ee9f5,_0x2d52cc;return db[_0x5e1e('0x3f')][_0x5e1e('0x59')]({'where':{'id':_0x52bffd[_0x5e1e('0x57')]['id']}})[_0x5e1e('0x20')](handleEntityNotFound(_0x2e2250,null))['then'](function(_0x54a2fb){if(_0x54a2fb){_0x2d52cc=_0x54a2fb;logger[_0x5e1e('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5e1e('0x2e'),_0x5e1e('0xcb'),_0x54a2fb[_0x5e1e('0x42')],util[_0x5e1e('0xcc')](_0x52bffd['body'],{'showHidden':![],'depth':null}));switch(_0x54a2fb['type']){case'skebby':if(_0x52bffd[_0x5e1e('0x5b')][_0x5e1e('0xcd')]&&_0x52bffd['body'][_0x5e1e('0x2e')]){_0x9ee9f5=_0x52bffd['body']['status'];return db[_0x5e1e('0xc8')][_0x5e1e('0x59')]({'where':{'messageId':_0x52bffd[_0x5e1e('0x5b')][_0x5e1e('0xcd')]}});}break;case _0x5e1e('0xce'):if(_0x52bffd[_0x5e1e('0x5b')][_0x5e1e('0xcf')]&&_0x52bffd['body'][_0x5e1e('0xd0')]){_0x9ee9f5=_0x52bffd[_0x5e1e('0x5b')][_0x5e1e('0xd0')];return db[_0x5e1e('0xc8')][_0x5e1e('0x59')]({'where':{'messageId':_0x52bffd[_0x5e1e('0x5b')]['requestid']}});}break;case'clicksend':if(_0x52bffd['body']['message_id']&&_0x52bffd[_0x5e1e('0x5b')][_0x5e1e('0xd1')]){_0x9ee9f5=_0x52bffd[_0x5e1e('0x5b')]['status_code'];return db['SmsMessage'][_0x5e1e('0x59')]({'where':{'messageId':_0x52bffd[_0x5e1e('0x5b')][_0x5e1e('0x88')]}});}break;case _0x5e1e('0x8c'):var _0x483242=_0x52bffd['body']['results'][0x0];if(_0x483242[_0x5e1e('0x83')]&&_0x483242[_0x5e1e('0x2e')][_0x5e1e('0xd2')]===_0x5e1e('0xd3')){_0x9ee9f5=_0x483242['status'][_0x5e1e('0xd2')];return db['SmsMessage']['find']({'where':{'messageId':_0x483242[_0x5e1e('0x83')]}});}break;case _0x5e1e('0x90'):if(_0x52bffd[_0x5e1e('0x5b')][_0x5e1e('0x83')]&&_0x52bffd[_0x5e1e('0x5b')][_0x5e1e('0x2e')]){_0x9ee9f5=_0x52bffd[_0x5e1e('0x5b')][_0x5e1e('0x2e')];return db[_0x5e1e('0xc8')][_0x5e1e('0x59')]({'where':{'messageId':_0x52bffd[_0x5e1e('0x5b')][_0x5e1e('0x83')]}});}break;case _0x5e1e('0x93'):if(_0x52bffd[_0x5e1e('0x5b')][0x0][_0x5e1e('0x28')]['id']){_0x9ee9f5=_0x52bffd[_0x5e1e('0x5b')][0x0]['type'];return db[_0x5e1e('0xc8')]['find']({'where':{'messageId':_0x52bffd[_0x5e1e('0x5b')][0x0][_0x5e1e('0x28')]['id']}});}break;case'intelepeer':if(_0x52bffd[_0x5e1e('0x5b')]['redif']&&_0x52bffd[_0x5e1e('0x5b')]['status']){_0x9ee9f5=_0x52bffd[_0x5e1e('0x5b')][_0x5e1e('0x2e')];return db['SmsMessage']['find']({'where':{'messageId':_0x52bffd[_0x5e1e('0x5b')][_0x5e1e('0xd4')]}});}break;}}})['then'](handleEntityNotFound(_0x2e2250,null))[_0x5e1e('0x20')](function(_0x7a831b){if(_0x7a831b){_0x11264e=_0x7a831b;switch(_0x2d52cc[_0x5e1e('0x42')]){case _0x5e1e('0x84'):if(_0x9ee9f5===_0x5e1e('0xd3')){return _0x11264e[_0x5e1e('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5e1e('0x2e'),_0x5e1e('0x84'),util[_0x5e1e('0xcc')](_0x52bffd[_0x5e1e('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x5e1e('0xce'):if(_0x9ee9f5==='1'){return _0x11264e['update']({'read':!![]});}else{logger['error'](_0x5e1e('0x25'),'status',_0x5e1e('0x84'),util['inspect'](_0x52bffd[_0x5e1e('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x5e1e('0x87'):if(!_0x52bffd[_0x5e1e('0x5b')][_0x5e1e('0xd5')]&&_0x9ee9f5>=0xc8&&_0x9ee9f5<=0xce){return _0x11264e[_0x5e1e('0x33')]({'read':!![]});}else{logger[_0x5e1e('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x5e1e('0x87'),util[_0x5e1e('0xcc')](_0x52bffd[_0x5e1e('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x5e1e('0x8c'):var _0x2fc19a=_0x52bffd[_0x5e1e('0x5b')][_0x5e1e('0x8d')][0x0];if(_0x2fc19a[_0x5e1e('0x2e')][_0x5e1e('0xd2')]===_0x5e1e('0xd3')){return _0x11264e[_0x5e1e('0x33')]({'read':!![]});}else{logger[_0x5e1e('0x27')](_0x5e1e('0x25'),_0x5e1e('0x2e'),_0x5e1e('0x8c'),util[_0x5e1e('0xcc')](_0x52bffd[_0x5e1e('0x5b')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x9ee9f5==_0x5e1e('0xd6')||_0x9ee9f5==_0x5e1e('0xd7')){return _0x11264e[_0x5e1e('0x33')]({'read':!![]});}else{logger[_0x5e1e('0x27')](_0x5e1e('0x25'),_0x5e1e('0x2e'),_0x5e1e('0x90'),util[_0x5e1e('0xcc')](_0x52bffd['body'],{'showHidden':![],'depth':null}));}break;case _0x5e1e('0x93'):if(_0x9ee9f5==_0x5e1e('0xd8')){return _0x11264e[_0x5e1e('0x33')]({'read':!![]});}else{logger[_0x5e1e('0x27')](_0x5e1e('0x25'),_0x5e1e('0x2e'),'bandwidth',util[_0x5e1e('0xcc')](_0x52bffd[_0x5e1e('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x5e1e('0xd9'):if(_0x9ee9f5===_0x5e1e('0xda')||_0x9ee9f5===_0x5e1e('0xdb')){return _0x11264e[_0x5e1e('0x33')]({'read':!![]});}else{logger['error'](_0x5e1e('0x25'),_0x5e1e('0x2e'),_0x5e1e('0xd9'),util['inspect'](_0x52bffd[_0x5e1e('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x11264e;}})[_0x5e1e('0x20')](respondWithResult(_0x2e2250,null))[_0x5e1e('0x2a')](handleError(_0x2e2250,null));};exports[_0x5e1e('0xdc')]=function(_0x1b94ef,_0x123479,_0x9f25af){var _0x8c6712,_0x445954,_0x4115e1;return db[_0x5e1e('0x3f')][_0x5e1e('0x59')]({'where':{'id':_0x1b94ef[_0x5e1e('0x57')]['id']}})[_0x5e1e('0x20')](handleEntityNotFound(_0x123479,null))['then'](function(_0xa225c7){if(_0xa225c7){_0x4115e1=_0xa225c7;logger[_0x5e1e('0x24')](_0x5e1e('0x25'),_0x5e1e('0x2e'),_0x5e1e('0xcb'),_0xa225c7[_0x5e1e('0x42')],util[_0x5e1e('0xcc')](_0x1b94ef[_0x5e1e('0x44')],{'showHidden':![],'depth':null}));switch(_0xa225c7[_0x5e1e('0x42')]){case _0x5e1e('0x8e'):if(_0x1b94ef[_0x5e1e('0x44')][_0x5e1e('0xdd')]&&_0x1b94ef['query']['state']){_0x445954=_0x1b94ef['query'][_0x5e1e('0xde')];return db[_0x5e1e('0xc8')][_0x5e1e('0x59')]({'where':{'messageId':_0x1b94ef[_0x5e1e('0x44')][_0x5e1e('0xdd')]}});}break;}}})[_0x5e1e('0x20')](handleEntityNotFound(_0x123479,null))[_0x5e1e('0x20')](function(_0x368340){if(_0x368340){_0x8c6712=_0x368340;switch(_0x4115e1['type']){case _0x5e1e('0x8e'):if(_0x445954==='2'||_0x445954==='6'){return _0x8c6712[_0x5e1e('0x33')]({'read':!![]});}else{logger[_0x5e1e('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x5e1e('0x8e'),util[_0x5e1e('0xcc')](_0x1b94ef[_0x5e1e('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x8c6712;}})['then'](respondWithResult(_0x123479,null))[_0x5e1e('0x2a')](handleError(_0x123479,null));};exports[_0x5e1e('0xdf')]=function(_0x4ce2b8,_0x34ce33,_0x273895){return db[_0x5e1e('0x3f')]['find']({'where':{'id':_0x4ce2b8[_0x5e1e('0x57')]['id']}})[_0x5e1e('0x20')](handleEntityNotFound(_0x34ce33,null))[_0x5e1e('0x20')](function(_0x5c411d){if(_0x5c411d){return _0x5c411d[_0x5e1e('0xdf')](_0x4ce2b8['body'][_0x5e1e('0x6b')],_[_0x5e1e('0xa0')](_0x4ce2b8[_0x5e1e('0x5b')],[_0x5e1e('0x6b'),'id'])||{})['spread'](function(_0x167a08){for(var _0x247948=0x0;_0x247948<_0x4ce2b8[_0x5e1e('0x5b')]['ids'][_0x5e1e('0x4a')];_0x247948+=0x1){socket[_0x5e1e('0xe0')]('userSmsAccount:save',{'UserId':Number(_0x4ce2b8[_0x5e1e('0x5b')][_0x5e1e('0x6b')][_0x247948]),'SmsAccountId':Number(_0x4ce2b8[_0x5e1e('0x57')]['id'])});}return _0x167a08;});}})[_0x5e1e('0x20')](respondWithResult(_0x34ce33,null))[_0x5e1e('0x2a')](handleError(_0x34ce33,null));};exports[_0x5e1e('0xe1')]=function(_0x2ec04a,_0x41db3a,_0x56f466){return db[_0x5e1e('0x3f')]['find']({'where':{'id':_0x2ec04a[_0x5e1e('0x57')]['id']}})[_0x5e1e('0x20')](handleEntityNotFound(_0x41db3a,null))[_0x5e1e('0x20')](function(_0x4bf776){if(_0x4bf776){return _0x4bf776['removeAgents'](_0x2ec04a[_0x5e1e('0x44')][_0x5e1e('0x6b')])[_0x5e1e('0x20')](function(){if(_[_0x5e1e('0xe2')](_0x2ec04a[_0x5e1e('0x44')]['ids'])){for(var _0x299bcb=0x0;_0x299bcb<_0x2ec04a[_0x5e1e('0x44')]['ids'][_0x5e1e('0x4a')];_0x299bcb+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x2ec04a[_0x5e1e('0x44')]['ids'][_0x299bcb]),'SmsAccountId':Number(_0x2ec04a[_0x5e1e('0x57')]['id'])});}}else{socket[_0x5e1e('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x2ec04a[_0x5e1e('0x44')][_0x5e1e('0x6b')]),'SmsAccountId':Number(_0x2ec04a[_0x5e1e('0x57')]['id'])});}});}})[_0x5e1e('0x20')](respondWithStatusCode(_0x41db3a,null))[_0x5e1e('0x2a')](handleError(_0x41db3a,null));};exports['getAgents']=function(_0x198d52,_0x5a1d2d,_0x2dafe5){var _0x418a7e={};var _0x5ab23f={};var _0x53e29d;var _0x2c9caa;return db[_0x5e1e('0x3f')]['findOne']({'where':{'id':_0x198d52[_0x5e1e('0x57')]['id']}})['then'](handleEntityNotFound(_0x5a1d2d,null))[_0x5e1e('0x20')](function(_0x50cc9b){if(_0x50cc9b){_0x53e29d=_0x50cc9b;_0x5ab23f[_0x5e1e('0x58')]=_['keys'](db['User'][_0x5e1e('0x40')]);_0x5ab23f[_0x5e1e('0x44')]=_['keys'](_0x198d52[_0x5e1e('0x44')]);_0x5ab23f[_0x5e1e('0x46')]=_[_0x5e1e('0x47')](_0x5ab23f[_0x5e1e('0x58')],_0x5ab23f['query']);_0x418a7e[_0x5e1e('0x49')]=_[_0x5e1e('0x47')](_0x5ab23f['model'],qs[_0x5e1e('0x48')](_0x198d52[_0x5e1e('0x44')][_0x5e1e('0x48')]));_0x418a7e[_0x5e1e('0x49')]=_0x418a7e[_0x5e1e('0x49')][_0x5e1e('0x4a')]?_0x418a7e[_0x5e1e('0x49')]:_0x5ab23f[_0x5e1e('0x58')];_0x418a7e[_0x5e1e('0x4e')]=qs[_0x5e1e('0x4f')](_0x198d52['query'][_0x5e1e('0x4f')]);_0x418a7e[_0x5e1e('0x50')]=qs[_0x5e1e('0x46')](_[_0x5e1e('0x69')](_0x198d52[_0x5e1e('0x44')],_0x5ab23f[_0x5e1e('0x46')]));if(_0x198d52['query'][_0x5e1e('0x53')]){_0x418a7e[_0x5e1e('0x50')]=_['merge'](_0x418a7e[_0x5e1e('0x50')],{'$or':_['map'](_0x418a7e[_0x5e1e('0x49')],function(_0x156de5){var _0x15e15c={};_0x15e15c[_0x156de5]={'$like':'%'+_0x198d52[_0x5e1e('0x44')][_0x5e1e('0x53')]+'%'};return _0x15e15c;})});}_0x418a7e=_[_0x5e1e('0x51')]({},_0x418a7e,_0x198d52[_0x5e1e('0x54')]);return _0x53e29d[_0x5e1e('0xe3')](_0x418a7e);}})[_0x5e1e('0x20')](function(_0x1eb058){if(_0x1eb058){_0x2c9caa=_0x1eb058['length'];if(!_0x198d52[_0x5e1e('0x44')]['hasOwnProperty'](_0x5e1e('0x4b'))){_0x418a7e[_0x5e1e('0x4c')]=qs[_0x5e1e('0x4c')](_0x198d52[_0x5e1e('0x44')]['limit']);_0x418a7e[_0x5e1e('0x4d')]=qs[_0x5e1e('0x4d')](_0x198d52[_0x5e1e('0x44')]['offset']);}return _0x53e29d[_0x5e1e('0xe3')](_0x418a7e);}})['then'](function(_0x13083d){if(_0x13083d){return _0x13083d?{'count':_0x2c9caa,'rows':_0x13083d}:null;}})[_0x5e1e('0x20')](respondWithResult(_0x5a1d2d,null))[_0x5e1e('0x2a')](handleError(_0x5a1d2d,null));};
\ No newline at end of file
+var _0x7c08=['get','UserProfileResource','end','name','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','role','SmsAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','findOne','find','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','asc','ValidationError','no\x20available\x20attributes','difference','CompanyId','ListId','twilio','from','MessageSid','skebby','sender','text','connectel','clicksend','messageId','message_id','From','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','updatedAt','DESC','list','Contacts','contact','SmsInteraction','spread','interaction','created','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<Response></Response>','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','getApplications','nolimit','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','user','Messages','dataValues','push','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','received\x20delivery\x20report\x20from','csc','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy'];(function(_0x28d7b5,_0x1305a4){var _0x1ed035=function(_0x57e1f6){while(--_0x57e1f6){_0x28d7b5['push'](_0x28d7b5['shift']());}};_0x1ed035(++_0x1305a4);}(_0x7c08,0x194));var _0x87c0=function(_0x1e088e,_0x536f4f){_0x1e088e=_0x1e088e-0x0;var _0x38189f=_0x7c08[_0x1e088e];return _0x38189f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x87c0('0x0'));var zipdir=require(_0x87c0('0x1'));var jsonpatch=require(_0x87c0('0x2'));var rp=require(_0x87c0('0x3'));var moment=require(_0x87c0('0x4'));var BPromise=require(_0x87c0('0x5'));var Mustache=require(_0x87c0('0x6'));var util=require(_0x87c0('0x7'));var path=require(_0x87c0('0x8'));var sox=require(_0x87c0('0x9'));var csv=require(_0x87c0('0xa'));var ejs=require(_0x87c0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x87c0('0xc'));var crypto=require('crypto');var jsforce=require(_0x87c0('0xd'));var deskjs=require(_0x87c0('0xe'));var toCsv=require(_0x87c0('0xa'));var querystring=require('querystring');var Papa=require(_0x87c0('0xf'));var Redis=require(_0x87c0('0x10'));var authService=require(_0x87c0('0x11'));var qs=require(_0x87c0('0x12'));var as=require(_0x87c0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x87c0('0x14'))(_0x87c0('0x15'));var utils=require(_0x87c0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x87c0('0x17'));var db=require(_0x87c0('0x18'))['db'];config['redis']=_[_0x87c0('0x19')](config[_0x87c0('0x1a')],{'host':_0x87c0('0x1b'),'port':0x18eb});var socket=require(_0x87c0('0x1c'))(new Redis(config[_0x87c0('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x87c0('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1d5f3e,_0x198d6d,_0x11f696,_0x5b3127){return new BPromise(function(_0x4c590e,_0x3184cf){var _0x57232d=_0x5b3127||client;return _0x57232d[_0x87c0('0x1e')](_0x1d5f3e,_0x11f696)[_0x87c0('0x1f')](function(_0x418902){logger[_0x87c0('0x20')](_0x87c0('0x21'),_0x198d6d,_0x87c0('0x22'));logger[_0x87c0('0x23')](_0x87c0('0x24'),_0x198d6d,'request\x20sent',JSON[_0x87c0('0x25')](_0x418902));if(_0x418902[_0x87c0('0x26')]){if(_0x418902[_0x87c0('0x26')][_0x87c0('0x27')]===0x1f4){logger['error'](_0x87c0('0x21'),_0x198d6d,_0x418902[_0x87c0('0x26')][_0x87c0('0x28')]);return _0x3184cf(_0x418902[_0x87c0('0x26')][_0x87c0('0x28')]);}logger['error'](_0x87c0('0x21'),_0x198d6d,_0x418902[_0x87c0('0x26')][_0x87c0('0x28')]);return _0x4c590e(_0x418902[_0x87c0('0x26')]['message']);}else{logger['info'](_0x87c0('0x21'),_0x198d6d,_0x87c0('0x22'));_0x4c590e(_0x418902['result'][_0x87c0('0x28')]);}})['catch'](function(_0x33b07b){logger[_0x87c0('0x26')](_0x87c0('0x21'),_0x198d6d,_0x33b07b);_0x3184cf(_0x33b07b);});});}function respondWithStatusCode(_0x11bb23,_0x188f08){_0x188f08=_0x188f08||0xcc;return function(_0x10f256){if(_0x10f256){return _0x11bb23[_0x87c0('0x29')](_0x188f08);}return _0x11bb23[_0x87c0('0x2a')](_0x188f08)['end']();};}function respondWithResult(_0x4772f6,_0x3e6946){_0x3e6946=_0x3e6946||0xc8;return function(_0x3dc7ec){if(_0x3dc7ec){return _0x4772f6['status'](_0x3e6946)[_0x87c0('0x2b')](_0x3dc7ec);}};}function respondWithFilteredResult(_0x40c925,_0x4e107b){return function(_0x190762){if(_0x190762){var _0xaf83ca=typeof _0x4e107b[_0x87c0('0x2c')]===_0x87c0('0x2d')&&typeof _0x4e107b['limit']==='undefined';var _0xe66c7d=_0x190762[_0x87c0('0x2e')];var _0x2936b4=_0xaf83ca?0x0:_0x4e107b[_0x87c0('0x2c')];var _0x417e72=_0xaf83ca?_0x190762[_0x87c0('0x2e')]:_0x4e107b[_0x87c0('0x2c')]+_0x4e107b[_0x87c0('0x2f')];var _0x2015b2;if(_0x417e72>=_0xe66c7d){_0x417e72=_0xe66c7d;_0x2015b2=0xc8;}else{_0x2015b2=0xce;}_0x40c925['status'](_0x2015b2);return _0x40c925[_0x87c0('0x30')](_0x87c0('0x31'),_0x2936b4+'-'+_0x417e72+'/'+_0xe66c7d)[_0x87c0('0x2b')](_0x190762);}return null;};}function patchUpdates(_0x4f6227){return function(_0x3bc9a2){try{jsonpatch[_0x87c0('0x32')](_0x3bc9a2,_0x4f6227,!![]);}catch(_0x402e90){return BPromise['reject'](_0x402e90);}return _0x3bc9a2[_0x87c0('0x33')]();};}function saveUpdates(_0x13fede,_0x1b92a8){return function(_0x2a35f3){if(_0x2a35f3){return _0x2a35f3[_0x87c0('0x34')](_0x13fede)[_0x87c0('0x1f')](function(_0x412b39){return _0x412b39;});}return null;};}function removeEntity(_0x3d853e,_0xc92283){return function(_0x5e8e01){if(_0x5e8e01){return _0x5e8e01[_0x87c0('0x35')]()['then'](function(){var _0x3cd5c0=_0x5e8e01[_0x87c0('0x36')]({'plain':!![]});var _0x37f03f='SmsAccounts';return db[_0x87c0('0x37')][_0x87c0('0x35')]({'where':{'type':_0x37f03f,'resourceId':_0x3cd5c0['id']}})['then'](function(){return _0x5e8e01;});})[_0x87c0('0x1f')](function(){_0x3d853e[_0x87c0('0x2a')](0xcc)[_0x87c0('0x38')]();});}};}function handleEntityNotFound(_0x46babf,_0x4d60ab){return function(_0x2f4592){if(!_0x2f4592){_0x46babf['sendStatus'](0x194);}return _0x2f4592;};}function handleError(_0x489313,_0x2be610){_0x2be610=_0x2be610||0x1f4;return function(_0x4e8417){logger[_0x87c0('0x26')](_0x4e8417['stack']);if(_0x4e8417[_0x87c0('0x39')]){delete _0x4e8417[_0x87c0('0x39')];}_0x489313[_0x87c0('0x2a')](_0x2be610)[_0x87c0('0x3a')](_0x4e8417);};}exports['index']=function(_0x48e289,_0x5deba9){var _0x1e9eeb={'include':[{'model':db[_0x87c0('0x3b')],'as':_0x87c0('0x3c')}]},_0x22df27={},_0x30f509={'count':0x0,'rows':[]};var _0x4857b0=_['map'](db[_0x87c0('0x3d')][_0x87c0('0x3e')],function(_0x2eaa62){return{'name':_0x2eaa62[_0x87c0('0x3f')],'type':_0x2eaa62[_0x87c0('0x40')][_0x87c0('0x41')]};});_0x22df27[_0x87c0('0x42')]=_[_0x87c0('0x43')](_0x4857b0,_0x87c0('0x39'));_0x22df27[_0x87c0('0x44')]=_[_0x87c0('0x45')](_0x48e289[_0x87c0('0x44')]);_0x22df27[_0x87c0('0x46')]=_[_0x87c0('0x47')](_0x22df27['model'],_0x22df27[_0x87c0('0x44')]);_0x1e9eeb[_0x87c0('0x48')]=_[_0x87c0('0x47')](_0x22df27[_0x87c0('0x42')],qs[_0x87c0('0x49')](_0x48e289[_0x87c0('0x44')][_0x87c0('0x49')]));_0x1e9eeb['attributes']=_0x1e9eeb['attributes'][_0x87c0('0x4a')]?_0x1e9eeb[_0x87c0('0x48')]:_0x22df27[_0x87c0('0x42')];if(!_0x48e289['query'][_0x87c0('0x4b')]('nolimit')){_0x1e9eeb[_0x87c0('0x2f')]=qs[_0x87c0('0x2f')](_0x48e289['query'][_0x87c0('0x2f')]);_0x1e9eeb[_0x87c0('0x2c')]=qs[_0x87c0('0x2c')](_0x48e289[_0x87c0('0x44')][_0x87c0('0x2c')]);}_0x1e9eeb[_0x87c0('0x4c')]=qs[_0x87c0('0x4d')](_0x48e289['query'][_0x87c0('0x4d')]);_0x1e9eeb[_0x87c0('0x4e')]=qs[_0x87c0('0x46')](_[_0x87c0('0x4f')](_0x48e289['query'],_0x22df27[_0x87c0('0x46')]),_0x4857b0);if(_0x48e289['query'][_0x87c0('0x50')]){_0x1e9eeb[_0x87c0('0x4e')]=_['merge'](_0x1e9eeb[_0x87c0('0x4e')],{'$or':_[_0x87c0('0x43')](_0x4857b0,function(_0x354e8c){if(_0x354e8c[_0x87c0('0x40')]!==_0x87c0('0x51')){var _0x45fb93={};_0x45fb93[_0x354e8c[_0x87c0('0x39')]]={'$like':'%'+_0x48e289[_0x87c0('0x44')][_0x87c0('0x50')]+'%'};return _0x45fb93;}})});}_0x1e9eeb=_['merge']({},_0x1e9eeb,_0x48e289[_0x87c0('0x52')]);var _0x5d5249={'where':_0x1e9eeb[_0x87c0('0x4e')]};return db[_0x87c0('0x3d')][_0x87c0('0x2e')](_0x5d5249)[_0x87c0('0x1f')](function(_0x2c07e4){_0x30f509['count']=_0x2c07e4;if(_0x48e289[_0x87c0('0x44')][_0x87c0('0x53')]){_0x1e9eeb[_0x87c0('0x54')]=[{'all':!![]}];}return db[_0x87c0('0x3d')][_0x87c0('0x55')](_0x1e9eeb);})[_0x87c0('0x1f')](function(_0x4b4fef){_0x30f509[_0x87c0('0x56')]=_0x4b4fef;return _0x30f509;})[_0x87c0('0x1f')](respondWithFilteredResult(_0x5deba9,_0x1e9eeb))[_0x87c0('0x57')](handleError(_0x5deba9,null));};exports[_0x87c0('0x58')]=function(_0xbb1ae8,_0x16bbb9){var _0x43bf7a={'raw':![],'where':{'id':_0xbb1ae8[_0x87c0('0x59')]['id']},'include':[{'model':db[_0x87c0('0x3b')],'as':_0x87c0('0x3c')}]},_0x24025f={};_0x24025f[_0x87c0('0x42')]=_[_0x87c0('0x45')](db[_0x87c0('0x3d')]['rawAttributes']);_0x24025f[_0x87c0('0x44')]=_[_0x87c0('0x45')](_0xbb1ae8['query']);_0x24025f[_0x87c0('0x46')]=_[_0x87c0('0x47')](_0x24025f[_0x87c0('0x42')],_0x24025f[_0x87c0('0x44')]);_0x43bf7a['attributes']=_['intersection'](_0x24025f[_0x87c0('0x42')],qs[_0x87c0('0x49')](_0xbb1ae8[_0x87c0('0x44')][_0x87c0('0x49')]));_0x43bf7a[_0x87c0('0x48')]=_0x43bf7a['attributes']['length']?_0x43bf7a[_0x87c0('0x48')]:_0x24025f[_0x87c0('0x42')];if(_0xbb1ae8[_0x87c0('0x44')][_0x87c0('0x53')]){_0x43bf7a[_0x87c0('0x54')]=[{'all':!![]}];}_0x43bf7a=_[_0x87c0('0x5a')]({},_0x43bf7a,_0xbb1ae8[_0x87c0('0x52')]);return db['SmsAccount']['find'](_0x43bf7a)['then'](handleEntityNotFound(_0x16bbb9,null))[_0x87c0('0x1f')](respondWithResult(_0x16bbb9,null))['catch'](handleError(_0x16bbb9,null));};exports[_0x87c0('0x5b')]=function(_0x2ac8b1,_0x55a31f){return db[_0x87c0('0x3d')]['create'](_0x2ac8b1[_0x87c0('0x5c')],{})[_0x87c0('0x1f')](function(_0x44c1f9){var _0x3d3acd=_0x2ac8b1['user'][_0x87c0('0x36')]({'plain':!![]});if(!_0x3d3acd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d3acd[_0x87c0('0x5d')]==='user'){var _0x5618cc=_0x44c1f9[_0x87c0('0x36')]({'plain':!![]});var _0x188210=_0x87c0('0x5e');return db[_0x87c0('0x5f')]['find']({'where':{'name':_0x188210,'userProfileId':_0x3d3acd['userProfileId']},'raw':!![]})[_0x87c0('0x1f')](function(_0x11edf0){if(_0x11edf0&&_0x11edf0[_0x87c0('0x60')]===0x0){return db[_0x87c0('0x37')]['create']({'name':_0x5618cc[_0x87c0('0x39')],'resourceId':_0x5618cc['id'],'type':_0x11edf0['name'],'sectionId':_0x11edf0['id']},{})[_0x87c0('0x1f')](function(){return _0x44c1f9;});}else{return _0x44c1f9;}})[_0x87c0('0x57')](function(_0x3a2feb){logger['error'](_0x87c0('0x61'),_0x3a2feb);throw _0x3a2feb;});}return _0x44c1f9;})[_0x87c0('0x1f')](respondWithResult(_0x55a31f,0xc9))[_0x87c0('0x57')](handleError(_0x55a31f,null));};exports[_0x87c0('0x34')]=function(_0x251f40,_0x46989c){if(_0x251f40['body']['id']){delete _0x251f40[_0x87c0('0x5c')]['id'];}return db[_0x87c0('0x3d')]['find']({'where':{'id':_0x251f40[_0x87c0('0x59')]['id']},'include':[{'model':db[_0x87c0('0x3b')],'as':_0x87c0('0x3c')}]})[_0x87c0('0x1f')](handleEntityNotFound(_0x46989c,null))[_0x87c0('0x1f')](saveUpdates(_0x251f40[_0x87c0('0x5c')],null))['then'](respondWithResult(_0x46989c,null))[_0x87c0('0x57')](handleError(_0x46989c,null));};exports[_0x87c0('0x35')]=function(_0x24d45d,_0x2335df){return db['SmsAccount']['find']({'where':{'id':_0x24d45d[_0x87c0('0x59')]['id']}})[_0x87c0('0x1f')](handleEntityNotFound(_0x2335df,null))[_0x87c0('0x1f')](removeEntity(_0x2335df,null))[_0x87c0('0x57')](handleError(_0x2335df,null));};exports[_0x87c0('0x62')]=function(_0x1b5dbb,_0x58a232){return db[_0x87c0('0x3d')]['describe']()[_0x87c0('0x1f')](respondWithResult(_0x58a232,null))[_0x87c0('0x57')](handleError(_0x58a232,null));};exports[_0x87c0('0x63')]=function(_0xd2b910,_0x786fea,_0x3f43a3){if(_0xd2b910[_0x87c0('0x5c')]['id']){delete _0xd2b910[_0x87c0('0x5c')]['id'];}return db[_0x87c0('0x3d')]['find']({'where':{'id':_0xd2b910[_0x87c0('0x59')]['id']}})[_0x87c0('0x1f')](handleEntityNotFound(_0x786fea,null))['then'](function(_0x5dfa3c){if(_0x5dfa3c){_0xd2b910[_0x87c0('0x5c')][_0x87c0('0x64')]=_0x5dfa3c['id'];return db[_0x87c0('0x65')]['create'](_0xd2b910['body']);}})[_0x87c0('0x1f')](respondWithResult(_0x786fea,null))['catch'](handleError(_0x786fea,null));};exports['getDispositions']=function(_0x5ae82e,_0x3a79df,_0xc50200){var _0x39bb4f={'raw':![],'where':{}};var _0x1d03ac={};var _0x544dd8={'count':0x0,'rows':[]};return db[_0x87c0('0x3d')][_0x87c0('0x66')]({'where':{'id':_0x5ae82e['params']['id']}})['then'](handleEntityNotFound(_0x3a79df,null))[_0x87c0('0x1f')](function(_0x3d8a72){if(_0x3d8a72){_0x1d03ac['model']=_['keys'](db[_0x87c0('0x65')][_0x87c0('0x3e')]);_0x1d03ac[_0x87c0('0x44')]=_[_0x87c0('0x45')](_0x5ae82e['query']);_0x1d03ac[_0x87c0('0x46')]=_[_0x87c0('0x47')](_0x1d03ac[_0x87c0('0x42')],_0x1d03ac[_0x87c0('0x44')]);_0x39bb4f[_0x87c0('0x48')]=_['intersection'](_0x1d03ac[_0x87c0('0x42')],qs['fields'](_0x5ae82e[_0x87c0('0x44')][_0x87c0('0x49')]));_0x39bb4f['attributes']=_0x39bb4f[_0x87c0('0x48')][_0x87c0('0x4a')]?_0x39bb4f[_0x87c0('0x48')]:_0x1d03ac[_0x87c0('0x42')];if(!_0x5ae82e[_0x87c0('0x44')][_0x87c0('0x4b')]('nolimit')){_0x39bb4f['limit']=qs[_0x87c0('0x2f')](_0x5ae82e[_0x87c0('0x44')][_0x87c0('0x2f')]);_0x39bb4f['offset']=qs[_0x87c0('0x2c')](_0x5ae82e[_0x87c0('0x44')][_0x87c0('0x2c')]);}_0x39bb4f[_0x87c0('0x4c')]=qs[_0x87c0('0x4d')](_0x5ae82e['query'][_0x87c0('0x4d')]);_0x39bb4f['where']=qs[_0x87c0('0x46')](_[_0x87c0('0x4f')](_0x5ae82e[_0x87c0('0x44')],_0x1d03ac[_0x87c0('0x46')]));_0x39bb4f[_0x87c0('0x4e')][_0x87c0('0x64')]=_0x3d8a72['id'];if(_0x5ae82e['query'][_0x87c0('0x50')]){_0x39bb4f['where']=_[_0x87c0('0x5a')](_0x39bb4f[_0x87c0('0x4e')],{'$or':_['map'](_0x39bb4f[_0x87c0('0x48')],function(_0x48cb4b){var _0x3d08c1={};_0x3d08c1[_0x48cb4b]={'$like':'%'+_0x5ae82e[_0x87c0('0x44')]['filter']+'%'};return _0x3d08c1;})});}_0x39bb4f=_[_0x87c0('0x5a')]({},_0x39bb4f,_0x5ae82e[_0x87c0('0x52')]);return db[_0x87c0('0x65')]['count']({'where':_0x39bb4f[_0x87c0('0x4e')]})[_0x87c0('0x1f')](function(_0x25b70a){_0x544dd8[_0x87c0('0x2e')]=_0x25b70a;if(_0x5ae82e['query']['includeAll']){_0x39bb4f[_0x87c0('0x54')]=[{'all':!![]}];}return db[_0x87c0('0x65')][_0x87c0('0x55')](_0x39bb4f);})[_0x87c0('0x1f')](function(_0x5c4577){_0x544dd8['rows']=_0x5c4577;return _0x544dd8;});}})[_0x87c0('0x1f')](respondWithFilteredResult(_0x3a79df,_0x39bb4f))['catch'](handleError(_0x3a79df,null));};exports['removeDispositions']=function(_0x1b6658,_0x3e3fc7,_0x3e2a61){return db[_0x87c0('0x3d')][_0x87c0('0x67')]({'where':{'id':_0x1b6658[_0x87c0('0x59')]['id']}})[_0x87c0('0x1f')](handleEntityNotFound(_0x3e3fc7,null))[_0x87c0('0x1f')](function(_0x18489a){if(_0x18489a){return _0x18489a[_0x87c0('0x68')](_0x1b6658[_0x87c0('0x44')][_0x87c0('0x69')]);}})['then'](respondWithStatusCode(_0x3e3fc7,null))['catch'](handleError(_0x3e3fc7,null));};exports[_0x87c0('0x6a')]=function(_0x3aa02c,_0x3b9710,_0x58ff6f){if(_0x3aa02c[_0x87c0('0x5c')]['id']){delete _0x3aa02c['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x3aa02c[_0x87c0('0x59')]['id']}})[_0x87c0('0x1f')](handleEntityNotFound(_0x3b9710,null))['then'](function(_0x4030aa){if(_0x4030aa){_0x3aa02c[_0x87c0('0x5c')][_0x87c0('0x64')]=_0x4030aa['id'];return db[_0x87c0('0x6b')]['create'](_0x3aa02c[_0x87c0('0x5c')]);}})[_0x87c0('0x1f')](respondWithResult(_0x3b9710,null))[_0x87c0('0x57')](handleError(_0x3b9710,null));};exports[_0x87c0('0x6c')]=function(_0x2a92ea,_0xf6ade0,_0x47069e){var _0x5a5189={'raw':![],'where':{}};var _0x2375a4={};var _0x2628cc={'count':0x0,'rows':[]};return db[_0x87c0('0x3d')]['findOne']({'where':{'id':_0x2a92ea[_0x87c0('0x59')]['id']}})['then'](handleEntityNotFound(_0xf6ade0,null))[_0x87c0('0x1f')](function(_0x70ea9b){if(_0x70ea9b){_0x2375a4[_0x87c0('0x42')]=_[_0x87c0('0x45')](db['CannedAnswer'][_0x87c0('0x3e')]);_0x2375a4[_0x87c0('0x44')]=_[_0x87c0('0x45')](_0x2a92ea[_0x87c0('0x44')]);_0x2375a4[_0x87c0('0x46')]=_['intersection'](_0x2375a4['model'],_0x2375a4[_0x87c0('0x44')]);_0x5a5189[_0x87c0('0x48')]=_[_0x87c0('0x47')](_0x2375a4[_0x87c0('0x42')],qs[_0x87c0('0x49')](_0x2a92ea[_0x87c0('0x44')][_0x87c0('0x49')]));_0x5a5189[_0x87c0('0x48')]=_0x5a5189['attributes']['length']?_0x5a5189['attributes']:_0x2375a4[_0x87c0('0x42')];if(!_0x2a92ea[_0x87c0('0x44')][_0x87c0('0x4b')]('nolimit')){_0x5a5189[_0x87c0('0x2f')]=qs[_0x87c0('0x2f')](_0x2a92ea[_0x87c0('0x44')][_0x87c0('0x2f')]);_0x5a5189[_0x87c0('0x2c')]=qs[_0x87c0('0x2c')](_0x2a92ea['query'][_0x87c0('0x2c')]);}_0x5a5189['order']=qs[_0x87c0('0x4d')](_0x2a92ea[_0x87c0('0x44')][_0x87c0('0x4d')]);_0x5a5189['where']=qs[_0x87c0('0x46')](_[_0x87c0('0x4f')](_0x2a92ea['query'],_0x2375a4[_0x87c0('0x46')]));_0x5a5189[_0x87c0('0x4e')][_0x87c0('0x64')]=_0x70ea9b['id'];if(_0x2a92ea[_0x87c0('0x44')][_0x87c0('0x50')]){_0x5a5189[_0x87c0('0x4e')]=_['merge'](_0x5a5189['where'],{'$or':_['map'](_0x5a5189[_0x87c0('0x48')],function(_0x1a114c){var _0x5a6108={};_0x5a6108[_0x1a114c]={'$like':'%'+_0x2a92ea[_0x87c0('0x44')][_0x87c0('0x50')]+'%'};return _0x5a6108;})});}_0x5a5189=_['merge']({},_0x5a5189,_0x2a92ea[_0x87c0('0x52')]);return db[_0x87c0('0x6b')][_0x87c0('0x2e')]({'where':_0x5a5189[_0x87c0('0x4e')]})['then'](function(_0x3254f7){_0x2628cc[_0x87c0('0x2e')]=_0x3254f7;if(_0x2a92ea[_0x87c0('0x44')][_0x87c0('0x53')]){_0x5a5189['include']=[{'all':!![]}];}return db[_0x87c0('0x6b')]['findAll'](_0x5a5189);})['then'](function(_0x31bacd){_0x2628cc[_0x87c0('0x56')]=_0x31bacd;return _0x2628cc;});}})[_0x87c0('0x1f')](respondWithFilteredResult(_0xf6ade0,_0x5a5189))[_0x87c0('0x57')](handleError(_0xf6ade0,null));};exports['removeAnswers']=function(_0x277a68,_0x6c610a,_0xbd4214){return db['SmsAccount']['find']({'where':{'id':_0x277a68[_0x87c0('0x59')]['id']}})[_0x87c0('0x1f')](handleEntityNotFound(_0x6c610a,null))[_0x87c0('0x1f')](function(_0x21da51){if(_0x21da51){return _0x21da51[_0x87c0('0x6d')](_0x277a68['query'][_0x87c0('0x69')]);}})['then'](respondWithStatusCode(_0x6c610a,null))[_0x87c0('0x57')](handleError(_0x6c610a,null));};exports[_0x87c0('0x6e')]=function(_0x2901f5,_0x17aa77,_0x476575){var _0x31e082={'channel':_0x87c0('0x6f')};var _0x1b7165=[];var _0x1feaee=[];var _0x19f514={};return db['SmsAccount']['find']({'where':{'id':_0x2901f5['params']['id']},'include':[{'model':db[_0x87c0('0x70')],'as':'Applications'}]})[_0x87c0('0x1f')](handleEntityNotFound(_0x17aa77,null))[_0x87c0('0x1f')](function(_0x4a2389){_0x31e082[_0x87c0('0x71')]=_0x4a2389;_0x31e082[_0x87c0('0x72')]=_[_0x87c0('0x73')](_0x4a2389[_0x87c0('0x74')],['priority'],[_0x87c0('0x75')]);if(_0x31e082[_0x87c0('0x71')][_0x87c0('0x74')]){delete _0x31e082['account'][_0x87c0('0x74')];}return db['CmContact'][_0x87c0('0x62')]();})['then'](function(_0x2f6fed){if(!_0x2f6fed){throw new db['Sequelize'][(_0x87c0('0x76'))](_0x87c0('0x77'));}_0x1b7165=_[_0x87c0('0x78')](_[_0x87c0('0x45')](_0x2f6fed),['createdAt','updatedAt']);_0x1feaee=_[_0x87c0('0x78')](_['keys'](_0x2f6fed),['createdAt','updatedAt',_0x87c0('0x79'),_0x87c0('0x7a')]);_0x31e082[_0x87c0('0x5c')]={'mapKey':'mobile'};if(_0x31e082[_0x87c0('0x71')][_0x87c0('0x40')]){switch(_0x31e082[_0x87c0('0x71')]['type']){case _0x87c0('0x7b'):_0x31e082[_0x87c0('0x5c')][_0x87c0('0x7c')]=_0x2901f5[_0x87c0('0x5c')]['From'];_0x31e082[_0x87c0('0x5c')][_0x87c0('0x5c')]=_0x2901f5['body']['Body'];_0x31e082[_0x87c0('0x5c')]['messageId']=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x7d')];break;case _0x87c0('0x7e'):_0x31e082['body'][_0x87c0('0x7c')]='+'+_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x7f')];_0x31e082[_0x87c0('0x5c')]['body']=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x80')];break;case _0x87c0('0x81'):_0x31e082[_0x87c0('0x5c')][_0x87c0('0x7c')]=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x7c')];_0x31e082['body'][_0x87c0('0x5c')]=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x28')];break;case _0x87c0('0x82'):_0x31e082[_0x87c0('0x5c')][_0x87c0('0x7c')]=_0x2901f5['body'][_0x87c0('0x7c')];_0x31e082[_0x87c0('0x5c')][_0x87c0('0x5c')]=_0x2901f5[_0x87c0('0x5c')]['body'];_0x31e082[_0x87c0('0x5c')][_0x87c0('0x83')]=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x84')];break;case'plivo':_0x31e082[_0x87c0('0x5c')]['from']=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x85')];_0x31e082['body'][_0x87c0('0x5c')]=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x86')];_0x31e082['body']['messageId']=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x87')];break;case _0x87c0('0x88'):_0x31e082[_0x87c0('0x5c')]['from']='+'+_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x89')][0x0][_0x87c0('0x7c')];_0x31e082[_0x87c0('0x5c')][_0x87c0('0x5c')]=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x89')][0x0][_0x87c0('0x80')];_0x31e082[_0x87c0('0x5c')]['messageId']=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x89')][0x0][_0x87c0('0x83')];break;case'csc':_0x31e082[_0x87c0('0x5c')][_0x87c0('0x7c')]=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x8a')];_0x31e082[_0x87c0('0x5c')][_0x87c0('0x5c')]=_0x2901f5['body'][_0x87c0('0x8b')]['message'];break;case _0x87c0('0x8c'):_0x31e082[_0x87c0('0x5c')][_0x87c0('0x7c')]=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x8d')];_0x31e082['body'][_0x87c0('0x5c')]=_0x2901f5['body'][_0x87c0('0x80')];_0x31e082['body'][_0x87c0('0x83')]=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x8e')];break;case _0x87c0('0x8f'):_0x31e082[_0x87c0('0x5c')][_0x87c0('0x83')]=_0x2901f5['body'][0x0]['message']['id'];_0x31e082[_0x87c0('0x5c')][_0x87c0('0x7c')]=_0x2901f5[_0x87c0('0x5c')][0x0][_0x87c0('0x28')][_0x87c0('0x7c')];_0x31e082[_0x87c0('0x5c')]['body']=_0x2901f5[_0x87c0('0x5c')][0x0][_0x87c0('0x28')]['text'];break;case _0x87c0('0x90'):_0x31e082[_0x87c0('0x5c')][_0x87c0('0x7c')]=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x7c')];_0x31e082[_0x87c0('0x5c')][_0x87c0('0x5c')]=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x28')];_0x31e082['body'][_0x87c0('0x83')]=_0x2901f5[_0x87c0('0x5c')][_0x87c0('0x91')];break;}}if(_0x31e082[_0x87c0('0x5c')]['id']){delete _0x31e082[_0x87c0('0x5c')]['id'];}if(_[_0x87c0('0x92')](_0x31e082[_0x87c0('0x5c')][_0x87c0('0x7c')])){throw new db[(_0x87c0('0x93'))][(_0x87c0('0x76'))](_0x87c0('0x94'));}if(_[_0x87c0('0x92')](_0x31e082['body'][_0x87c0('0x5c')])||_0x31e082[_0x87c0('0x5c')][_0x87c0('0x5c')]===''){throw new db[(_0x87c0('0x93'))][(_0x87c0('0x76'))](_0x87c0('0x95'));}if(_[_0x87c0('0x92')](_0x31e082[_0x87c0('0x5c')][_0x87c0('0x96')])){throw new db[(_0x87c0('0x93'))]['ValidationError'](_0x87c0('0x97')+_0x1feaee);}if(!_[_0x87c0('0x98')](_0x1feaee,_0x31e082['body']['mapKey'])){throw new db[(_0x87c0('0x93'))]['ValidationError'](_0x87c0('0x99')+_0x1feaee);}_0x19f514[_0x31e082[_0x87c0('0x5c')][_0x87c0('0x96')]]=_0x31e082[_0x87c0('0x5c')]['from'];return db[_0x87c0('0x9a')][_0x87c0('0x67')]({'where':{'id':_0x31e082['account'][_0x87c0('0x7a')]},'include':[{'model':db[_0x87c0('0x9b')],'as':'Contacts','where':_0x19f514,'limit':0x1,'order':[[_0x87c0('0x9c'),_0x87c0('0x9d')]]}]});})[_0x87c0('0x1f')](handleEntityNotFound(_0x17aa77,null))['then'](function(_0x11724b){if(_0x11724b){_0x31e082[_0x87c0('0x9e')]=_['omit'](_0x11724b,[_0x87c0('0x9f')]);if(_0x11724b[_0x87c0('0x9f')][_0x87c0('0x4a')]){return _0x11724b[_0x87c0('0x9f')][0x0];}var _0xcef1eb=_[_0x87c0('0x19')](_0x31e082[_0x87c0('0x5c')],{'firstName':_0x31e082[_0x87c0('0x5c')][_0x87c0('0x7c')],'ListId':_0x11724b['id']});_0xcef1eb[_0x31e082[_0x87c0('0x5c')][_0x87c0('0x96')]]=_0x31e082['body'][_0x87c0('0x7c')];return db[_0x87c0('0x9b')][_0x87c0('0x5b')](_0xcef1eb,{'fields':_0x1b7165,'raw':!![]});}})['then'](handleEntityNotFound(_0x17aa77,null))[_0x87c0('0x1f')](function(_0x5e5a5c){if(_0x5e5a5c){_0x31e082[_0x87c0('0xa0')]=_0x5e5a5c;var _0x3a11bc={'ContactId':_0x5e5a5c['id'],'phone':_0x31e082['body'][_0x87c0('0x7c')],'SmsAccountId':_0x2901f5[_0x87c0('0x59')]['id']};var _0xf8cd90={'ContactId':_0x5e5a5c['id'],'SmsAccountId':_0x2901f5[_0x87c0('0x59')]['id'],'closed':![]};return db[_0x87c0('0xa1')][_0x87c0('0x67')]({'where':_0xf8cd90})[_0x87c0('0x1f')](function(_0x4206c4){if(_0x4206c4){return[_0x4206c4,![]];}return db[_0x87c0('0xa1')][_0x87c0('0x5b')](_0x3a11bc)['then'](function(_0xd9fb39){return[_0xd9fb39,!![]];});});}})[_0x87c0('0xa2')](function(_0xd0ba05,_0x5440a8){_0x31e082[_0x87c0('0xa3')]=_0xd0ba05[_0x87c0('0x36')]({'plain':!![]});_0x31e082['interaction'][_0x87c0('0xa4')]=![];if(_0x5440a8){if(_0x31e082['account']['autoclose']){_0x31e082['applications']['push']({'id':0x0,'priority':_0x31e082[_0x87c0('0x72')][_0x87c0('0x4a')]+0x1,'app':_0x87c0('0xa5'),'appdata':_0x87c0('0xa6'),'interval':_0x87c0('0xa7')});}_0x31e082[_0x87c0('0xa3')][_0x87c0('0xa4')]=!![];}return db[_0x87c0('0xa8')][_0x87c0('0x5b')]({'phone':_0x31e082[_0x87c0('0x5c')][_0x87c0('0x7c')],'messageId':_0x31e082[_0x87c0('0x5c')][_0x87c0('0x83')],'body':_0x31e082[_0x87c0('0x5c')][_0x87c0('0x5c')],'SmsAccountId':_0x2901f5[_0x87c0('0x59')]['id'],'SmsInteractionId':_0xd0ba05['id'],'direction':'in','ContactId':_0xd0ba05[_0x87c0('0xa9')],'AttachmentId':_0x31e082[_0x87c0('0x5c')][_0x87c0('0xaa')]});})['then'](function(_0x3d53b7){_0x31e082[_0x87c0('0x28')]=_0x3d53b7;if(_0x31e082[_0x87c0('0xa3')]['UserId']){return db[_0x87c0('0xab')][_0x87c0('0x67')]({'attributes':['id',_0x87c0('0x39')],'where':{'id':_0x31e082['interaction'][_0x87c0('0xac')]}})[_0x87c0('0x1f')](function(_0x1b3c8c){if(_0x1b3c8c){_0x31e082['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x87c0('0xad'),'appdata':_0x1b3c8c['name']+','+(_0x31e082[_0x87c0('0x71')][_0x87c0('0xae')]||0xa),'interval':_0x87c0('0xa7')});}return respondWithRpcPromise(_0x87c0('0xaf'),'startRouting',_0x31e082);});}return respondWithRpcPromise(_0x87c0('0xaf'),_0x87c0('0xb0'),_0x31e082);})['then'](function(_0x16837f){if(_0x16837f){var _0x2de556=0xc8;var _0x524a4b=_0x87c0('0xb1');logger[_0x87c0('0x20')](_0x87c0('0x24'),_0x524a4b,_0x2de556,_0x87c0('0xb2'));logger[_0x87c0('0x23')](_0x87c0('0xb3'),_0x524a4b,_0x2de556,_0x87c0('0xb2'),JSON[_0x87c0('0x25')](_0x16837f));if(_0x31e082['account'][_0x87c0('0x40')]==='twilio'){return _0x17aa77[_0x87c0('0x2a')](_0x2de556)[_0x87c0('0x30')](_0x87c0('0xb4'),_0x87c0('0xb5'))[_0x87c0('0x3a')](_0x87c0('0xb6'));}else{return _0x17aa77['status'](_0x2de556)[_0x87c0('0x2b')](_0x16837f);}}})[_0x87c0('0x57')](handleError(_0x17aa77,null));};exports['addApplications']=function(_0x3ff01b,_0x4a2765){var _0x51a055=_0x3ff01b[_0x87c0('0x59')]['id'];var _0x8feac6=_0x3ff01b[_0x87c0('0x5c')];var _0x5da59f=0xc8;var _0x376757=null;return db[_0x87c0('0xb7')][_0x87c0('0xb8')]({'isolationLevel':db[_0x87c0('0xb7')][_0x87c0('0xb9')][_0x87c0('0xba')][_0x87c0('0xbb')]},function(_0x527107){return db[_0x87c0('0x3d')][_0x87c0('0x66')]({'where':{'id':_0x51a055},'transaction':_0x527107})[_0x87c0('0x1f')](function(_0x1d2591){if(_0x1d2591){return db[_0x87c0('0x70')][_0x87c0('0x35')]({'where':{'SmsAccountId':_0x51a055},'transaction':_0x527107})['then'](function(){var _0x32de3a=_['map'](_0x8feac6,function(_0x366708){_0x366708[_0x87c0('0x64')]=_0x51a055;return _0x366708;});return db[_0x87c0('0x70')]['bulkCreate'](_0x32de3a,{'transaction':_0x527107});});}else{_0x5da59f=0x194;_0x376757=[];}});})[_0x87c0('0x1f')](function(){if(_0x5da59f!==0x194){return db[_0x87c0('0x70')][_0x87c0('0xbc')]({'where':{'SmsAccountId':_0x51a055},'order':'priority'})[_0x87c0('0x1f')](function(_0x1100f5){_0x376757=_0x1100f5;});}})[_0x87c0('0x57')](function(_0x1add2c){_0x5da59f=0x1f4;logger['error'](_0x1add2c[_0x87c0('0xbd')]);if(_0x1add2c[_0x87c0('0x39')]){delete _0x1add2c['name'];}_0x376757=_0x1add2c;})['finally'](function(){if(_0x376757===null){_0x4a2765[_0x87c0('0x29')](_0x5da59f);}else{if(_0x5da59f===0x1f4){_0x4a2765[_0x87c0('0x2a')](_0x5da59f)[_0x87c0('0x3a')](_0x376757);}else{_0x4a2765[_0x87c0('0x2a')](_0x5da59f)[_0x87c0('0x2b')](_0x376757);}}});};exports[_0x87c0('0xbe')]=function(_0x5ba4c2,_0x584128,_0x543a74){var _0x4e622f={};var _0x1292ce={};var _0x355df2;var _0x31de75;return db['SmsAccount']['findOne']({'where':{'id':_0x5ba4c2['params']['id']}})[_0x87c0('0x1f')](handleEntityNotFound(_0x584128,null))[_0x87c0('0x1f')](function(_0x3cd4a9){if(_0x3cd4a9){_0x355df2=_0x3cd4a9;_0x1292ce[_0x87c0('0x42')]=_[_0x87c0('0x45')](db[_0x87c0('0x70')]['rawAttributes']);_0x1292ce[_0x87c0('0x44')]=_['keys'](_0x5ba4c2[_0x87c0('0x44')]);_0x1292ce['filters']=_['intersection'](_0x1292ce[_0x87c0('0x42')],_0x1292ce[_0x87c0('0x44')]);_0x4e622f['attributes']=_[_0x87c0('0x47')](_0x1292ce[_0x87c0('0x42')],qs[_0x87c0('0x49')](_0x5ba4c2[_0x87c0('0x44')][_0x87c0('0x49')]));_0x4e622f[_0x87c0('0x48')]=_0x4e622f[_0x87c0('0x48')]['length']?_0x4e622f[_0x87c0('0x48')]:_0x1292ce['model'];_0x4e622f[_0x87c0('0x4c')]=qs[_0x87c0('0x4d')](_0x5ba4c2[_0x87c0('0x44')][_0x87c0('0x4d')]);_0x4e622f[_0x87c0('0x4e')]=qs[_0x87c0('0x46')](_[_0x87c0('0x4f')](_0x5ba4c2[_0x87c0('0x44')],_0x1292ce['filters']));if(_0x5ba4c2['query'][_0x87c0('0x50')]){_0x4e622f['where']=_['merge'](_0x4e622f[_0x87c0('0x4e')],{'$or':_[_0x87c0('0x43')](_0x4e622f['attributes'],function(_0x2d213b){var _0x265e73={};_0x265e73[_0x2d213b]={'$like':'%'+_0x5ba4c2[_0x87c0('0x44')][_0x87c0('0x50')]+'%'};return _0x265e73;})});}_0x4e622f=_[_0x87c0('0x5a')]({},_0x4e622f,_0x5ba4c2[_0x87c0('0x52')]);return _0x355df2['getApplications'](_0x4e622f);}})[_0x87c0('0x1f')](function(_0x5cc728){if(_0x5cc728){_0x31de75=_0x5cc728[_0x87c0('0x4a')];if(!_0x5ba4c2['query']['hasOwnProperty'](_0x87c0('0xbf'))){_0x4e622f[_0x87c0('0x2f')]=qs['limit'](_0x5ba4c2['query'][_0x87c0('0x2f')]);_0x4e622f[_0x87c0('0x2c')]=qs[_0x87c0('0x2c')](_0x5ba4c2[_0x87c0('0x44')]['offset']);}return _0x355df2['getApplications'](_0x4e622f);}})[_0x87c0('0x1f')](function(_0xb11b0a){if(_0xb11b0a){return _0xb11b0a?{'count':_0x31de75,'rows':_0xb11b0a}:null;}})[_0x87c0('0x1f')](respondWithResult(_0x584128,null))[_0x87c0('0x57')](handleError(_0x584128,null));};exports[_0x87c0('0xc0')]=function(_0x1627ad,_0x441184,_0xadf4b5){var _0x5f44a7={'raw':![],'where':{}};var _0x2716bd={};var _0x295a2e={'count':0x0,'rows':[]};return db[_0x87c0('0x3d')]['findOne']({'where':{'id':_0x1627ad['params']['id']}})[_0x87c0('0x1f')](handleEntityNotFound(_0x441184,null))[_0x87c0('0x1f')](function(_0xe2662e){if(_0xe2662e){_0x2716bd[_0x87c0('0x42')]=_['keys'](db[_0x87c0('0xa1')][_0x87c0('0x3e')]);_0x2716bd[_0x87c0('0x44')]=_['keys'](_0x1627ad[_0x87c0('0x44')]);_0x2716bd[_0x87c0('0x46')]=_[_0x87c0('0x47')](_0x2716bd['model'],_0x2716bd[_0x87c0('0x44')]);_0x5f44a7['attributes']=_[_0x87c0('0x47')](_0x2716bd[_0x87c0('0x42')],qs[_0x87c0('0x49')](_0x1627ad['query'][_0x87c0('0x49')]));_0x5f44a7[_0x87c0('0x48')]=_0x5f44a7[_0x87c0('0x48')]['length']?_0x5f44a7[_0x87c0('0x48')]:_0x2716bd[_0x87c0('0x42')];if(!_0x1627ad[_0x87c0('0x44')]['hasOwnProperty'](_0x87c0('0xbf'))){_0x5f44a7[_0x87c0('0x2f')]=qs[_0x87c0('0x2f')](_0x1627ad[_0x87c0('0x44')][_0x87c0('0x2f')]);_0x5f44a7[_0x87c0('0x2c')]=qs['offset'](_0x1627ad['query'][_0x87c0('0x2c')]);}_0x5f44a7['order']=qs['sort'](_0x1627ad[_0x87c0('0x44')][_0x87c0('0x4d')]);_0x5f44a7[_0x87c0('0x4e')]=qs[_0x87c0('0x46')](_[_0x87c0('0x4f')](_0x1627ad[_0x87c0('0x44')],_0x2716bd[_0x87c0('0x46')]));_0x5f44a7[_0x87c0('0x4e')][_0x87c0('0x64')]=_0xe2662e['id'];if(_0x1627ad[_0x87c0('0x44')]['filter']){_0x5f44a7[_0x87c0('0x4e')]=_[_0x87c0('0x5a')](_0x5f44a7[_0x87c0('0x4e')],{'$or':_[_0x87c0('0x43')](_0x5f44a7[_0x87c0('0x48')],function(_0x342da8){var _0x2138aa={};_0x2138aa[_0x342da8]={'$like':'%'+_0x1627ad[_0x87c0('0x44')][_0x87c0('0x50')]+'%'};return _0x2138aa;})});}_0x5f44a7=_['merge']({},_0x5f44a7,_0x1627ad[_0x87c0('0x52')]);return db[_0x87c0('0xa1')][_0x87c0('0x2e')]({'where':_0x5f44a7[_0x87c0('0x4e')]})['then'](function(_0x374e08){_0x295a2e[_0x87c0('0x2e')]=_0x374e08;if(_0x1627ad[_0x87c0('0x44')][_0x87c0('0x53')]){_0x5f44a7[_0x87c0('0x54')]=[{'model':db[_0x87c0('0x9b')],'as':_0x87c0('0xc1'),'required':![]},{'model':db[_0x87c0('0xab')],'as':_0x87c0('0xc2'),'attributes':['name',_0x87c0('0xc3'),'internal'],'required':![]},{'model':db[_0x87c0('0xc4')],'as':_0x87c0('0xc5'),'attributes':['id',_0x87c0('0x39'),_0x87c0('0xc6')],'where':_0x1627ad[_0x87c0('0x44')][_0x87c0('0xc7')]?{'id':_0x1627ad[_0x87c0('0x44')][_0x87c0('0xc7')]}:undefined,'required':_0x1627ad['query']['tag']?!![]:![]}];}return db[_0x87c0('0xa1')]['findAll'](_0x5f44a7);})[_0x87c0('0x1f')](function(_0x2e03b3){_0x295a2e[_0x87c0('0x56')]=_0x2e03b3;return _0x295a2e;});}})[_0x87c0('0x1f')](respondWithFilteredResult(_0x441184,_0x5f44a7))[_0x87c0('0x57')](handleError(_0x441184,null));};exports[_0x87c0('0x3a')]=function(_0x289dbf,_0xf4a98b,_0x27990b){var _0x281930,_0x166a2f,_0x306cef;if(_[_0x87c0('0x92')](_0x289dbf[_0x87c0('0x5c')][_0x87c0('0x5c')])||_0x289dbf[_0x87c0('0x5c')][_0x87c0('0x5c')]===''){throw new db[(_0x87c0('0x93'))][(_0x87c0('0x76'))](_0x87c0('0x95'));}if(_[_0x87c0('0x92')](_0x289dbf[_0x87c0('0x5c')]['to'])){throw new db[(_0x87c0('0x93'))][(_0x87c0('0x76'))](_0x87c0('0xc8'));}_0x281930=_0x289dbf[_0x87c0('0x5c')]['to'];return db[_0x87c0('0x3d')][_0x87c0('0x67')]({'where':{'id':_0x289dbf['params']['id']},'include':[{'model':db['CmList'],'as':_0x87c0('0xc9'),'include':[{'model':db['CmContact'],'as':_0x87c0('0x9f'),'where':{'mobile':_0x281930},'limit':0x1,'order':[[_0x87c0('0x9c'),'DESC']]}]}]})[_0x87c0('0x1f')](handleEntityNotFound(_0xf4a98b,null))[_0x87c0('0x1f')](function(_0x4536ee){if(_0x4536ee&&_0x4536ee[_0x87c0('0xc9')]){_0x166a2f=_0x4536ee['get']({'plain':!![]});if(_0x166a2f[_0x87c0('0xc9')]&&_0x166a2f[_0x87c0('0xc9')]['Contacts']['length']){return _0x166a2f['List'][_0x87c0('0x9f')][0x0];}return db[_0x87c0('0x9b')][_0x87c0('0x5b')](_[_0x87c0('0x19')](_0x289dbf[_0x87c0('0x5c')],{'firstName':_0x281930,'mobile':_0x281930,'phone':_0x281930,'ListId':_0x166a2f[_0x87c0('0x7a')]}));}})[_0x87c0('0x1f')](handleEntityNotFound(_0xf4a98b,null))['then'](function(_0x3c1669){if(_0x3c1669){_0x306cef=_0x3c1669;return db[_0x87c0('0xa1')][_0x87c0('0x67')]({'where':{'ContactId':_0x306cef['id'],'closed':![],'SmsAccountId':_0x166a2f['id']}})[_0x87c0('0x1f')](function(_0x11a53b){if(_0x11a53b){return[_0x11a53b,![]];}return db[_0x87c0('0xa1')][_0x87c0('0x5b')]({'UserId':_0x289dbf[_0x87c0('0xca')]['id'],'ContactId':_0x306cef['id'],'SmsAccountId':_0x166a2f['id'],'phone':_0x281930,'firstMsgDirection':'out','Messages':[_['merge'](_0x289dbf['body'],{'read':![],'body':_0x289dbf[_0x87c0('0x5c')]['body'],'phone':_0x281930,'SmsAccountId':_0x166a2f['id'],'UserId':_0x289dbf['user']['id'],'ContactId':_0x306cef['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x87c0('0xcb')}]})['then'](function(_0x5ac1e7){return[_0x5ac1e7,!![]];});});}})[_0x87c0('0xa2')](function(_0x465a65,_0x3f2e1c){if(_0x3f2e1c){return _0x465a65;}return db[_0x87c0('0xa8')][_0x87c0('0x5b')](_[_0x87c0('0x5a')](_0x289dbf[_0x87c0('0x5c')],{'read':![],'body':_0x289dbf[_0x87c0('0x5c')][_0x87c0('0x5c')],'phone':_0x281930,'SmsAccountId':_0x166a2f['id'],'SmsInteractionId':_0x465a65['id'],'UserId':_0x289dbf[_0x87c0('0xca')]['id'],'ContactId':_0x306cef['id']}))['then'](function(_0x23f593){_0x465a65[_0x87c0('0xcc')][_0x87c0('0xcb')]=[];_0x465a65[_0x87c0('0xcc')][_0x87c0('0xcb')][_0x87c0('0xcd')](_0x23f593[_0x87c0('0xcc')]);return _0x465a65;});})[_0x87c0('0x1f')](respondWithResult(_0xf4a98b,null))[_0x87c0('0x57')](handleError(_0xf4a98b,null));};exports[_0x87c0('0x2a')]=function(_0x1969c0,_0x5e5bb6,_0x397d6e){if(_0x1969c0[_0x87c0('0x5c')]['id']){delete _0x1969c0['body']['id'];}var _0x32f2a3,_0x376218,_0x3ff091;return db[_0x87c0('0x3d')][_0x87c0('0x67')]({'where':{'id':_0x1969c0[_0x87c0('0x59')]['id']}})[_0x87c0('0x1f')](handleEntityNotFound(_0x5e5bb6,null))[_0x87c0('0x1f')](function(_0x2512d0){if(_0x2512d0){_0x3ff091=_0x2512d0;logger[_0x87c0('0x23')](_0x87c0('0x24'),_0x87c0('0x2a'),'received\x20delivery\x20report\x20from',_0x2512d0['type'],util[_0x87c0('0xce')](_0x1969c0[_0x87c0('0x5c')],{'showHidden':![],'depth':null}));switch(_0x2512d0[_0x87c0('0x40')]){case _0x87c0('0x7e'):if(_0x1969c0[_0x87c0('0x5c')][_0x87c0('0xcf')]&&_0x1969c0[_0x87c0('0x5c')]['status']){_0x376218=_0x1969c0[_0x87c0('0x5c')]['status'];return db['SmsMessage'][_0x87c0('0x67')]({'where':{'messageId':_0x1969c0[_0x87c0('0x5c')]['skebby_dispatch_id']}});}break;case _0x87c0('0x81'):if(_0x1969c0[_0x87c0('0x5c')][_0x87c0('0xd0')]&&_0x1969c0[_0x87c0('0x5c')][_0x87c0('0xd1')]){_0x376218=_0x1969c0['body'][_0x87c0('0xd1')];return db['SmsMessage'][_0x87c0('0x67')]({'where':{'messageId':_0x1969c0[_0x87c0('0x5c')][_0x87c0('0xd0')]}});}break;case _0x87c0('0x82'):if(_0x1969c0[_0x87c0('0x5c')][_0x87c0('0x84')]&&_0x1969c0[_0x87c0('0x5c')][_0x87c0('0xd2')]){_0x376218=_0x1969c0['body']['status_code'];return db[_0x87c0('0xa8')][_0x87c0('0x67')]({'where':{'messageId':_0x1969c0['body'][_0x87c0('0x84')]}});}break;case _0x87c0('0x88'):var _0x22914a=_0x1969c0[_0x87c0('0x5c')][_0x87c0('0x89')][0x0];if(_0x22914a[_0x87c0('0x83')]&&_0x22914a['status'][_0x87c0('0xd3')]===_0x87c0('0xd4')){_0x376218=_0x22914a[_0x87c0('0x2a')]['groupName'];return db['SmsMessage'][_0x87c0('0x67')]({'where':{'messageId':_0x22914a['messageId']}});}break;case _0x87c0('0x8c'):if(_0x1969c0[_0x87c0('0x5c')]['messageId']&&_0x1969c0[_0x87c0('0x5c')][_0x87c0('0x2a')]){_0x376218=_0x1969c0[_0x87c0('0x5c')][_0x87c0('0x2a')];return db[_0x87c0('0xa8')][_0x87c0('0x67')]({'where':{'messageId':_0x1969c0['body']['messageId']}});}break;case _0x87c0('0x8f'):if(_0x1969c0[_0x87c0('0x5c')][0x0][_0x87c0('0x28')]['id']){_0x376218=_0x1969c0[_0x87c0('0x5c')][0x0][_0x87c0('0x40')];return db[_0x87c0('0xa8')]['find']({'where':{'messageId':_0x1969c0[_0x87c0('0x5c')][0x0][_0x87c0('0x28')]['id']}});}break;case'intelepeer':if(_0x1969c0[_0x87c0('0x5c')][_0x87c0('0xd5')]&&_0x1969c0[_0x87c0('0x5c')]['status']){_0x376218=_0x1969c0[_0x87c0('0x5c')][_0x87c0('0x2a')];return db[_0x87c0('0xa8')][_0x87c0('0x67')]({'where':{'messageId':_0x1969c0[_0x87c0('0x5c')][_0x87c0('0xd5')]}});}break;}}})[_0x87c0('0x1f')](handleEntityNotFound(_0x5e5bb6,null))[_0x87c0('0x1f')](function(_0x1819f6){if(_0x1819f6){_0x32f2a3=_0x1819f6;switch(_0x3ff091['type']){case'skebby':if(_0x376218===_0x87c0('0xd4')){return _0x32f2a3[_0x87c0('0x34')]({'read':!![]});}else{logger['error'](_0x87c0('0x24'),_0x87c0('0x2a'),_0x87c0('0x7e'),util[_0x87c0('0xce')](_0x1969c0[_0x87c0('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x87c0('0x81'):if(_0x376218==='1'){return _0x32f2a3[_0x87c0('0x34')]({'read':!![]});}else{logger[_0x87c0('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x87c0('0x2a'),_0x87c0('0x7e'),util[_0x87c0('0xce')](_0x1969c0[_0x87c0('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x87c0('0x82'):if(!_0x1969c0['body'][_0x87c0('0xd6')]&&_0x376218>=0xc8&&_0x376218<=0xce){return _0x32f2a3[_0x87c0('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x87c0('0x2a'),_0x87c0('0x82'),util[_0x87c0('0xce')](_0x1969c0[_0x87c0('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x87c0('0x88'):var _0x2a536c=_0x1969c0['body'][_0x87c0('0x89')][0x0];if(_0x2a536c['status']['groupName']==='DELIVERED'){return _0x32f2a3[_0x87c0('0x34')]({'read':!![]});}else{logger[_0x87c0('0x26')](_0x87c0('0x24'),_0x87c0('0x2a'),_0x87c0('0x88'),util[_0x87c0('0xce')](_0x1969c0[_0x87c0('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x87c0('0x8c'):if(_0x376218=='DELIVERED_TO_GATEWAY'||_0x376218==_0x87c0('0xd7')){return _0x32f2a3[_0x87c0('0x34')]({'read':!![]});}else{logger[_0x87c0('0x26')](_0x87c0('0x24'),_0x87c0('0x2a'),_0x87c0('0x8c'),util['inspect'](_0x1969c0[_0x87c0('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x87c0('0x8f'):if(_0x376218==_0x87c0('0xd8')){return _0x32f2a3[_0x87c0('0x34')]({'read':!![]});}else{logger[_0x87c0('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x87c0('0x8f'),util['inspect'](_0x1969c0[_0x87c0('0x5c')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x376218==='DELIVRD'||_0x376218===_0x87c0('0xd9')){return _0x32f2a3[_0x87c0('0x34')]({'read':!![]});}else{logger[_0x87c0('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x87c0('0x2a'),'intelepeer',util[_0x87c0('0xce')](_0x1969c0['body'],{'showHidden':![],'depth':null}));}break;}return _0x32f2a3;}})[_0x87c0('0x1f')](respondWithResult(_0x5e5bb6,null))['catch'](handleError(_0x5e5bb6,null));};exports['statusGet']=function(_0x3cf4de,_0x34d8f3,_0x597807){var _0x1eed1d,_0x1e89a3,_0x38ca41;return db[_0x87c0('0x3d')][_0x87c0('0x67')]({'where':{'id':_0x3cf4de['params']['id']}})[_0x87c0('0x1f')](handleEntityNotFound(_0x34d8f3,null))[_0x87c0('0x1f')](function(_0x1b4f09){if(_0x1b4f09){_0x38ca41=_0x1b4f09;logger[_0x87c0('0x23')](_0x87c0('0x24'),_0x87c0('0x2a'),_0x87c0('0xda'),_0x1b4f09['type'],util[_0x87c0('0xce')](_0x3cf4de[_0x87c0('0x44')],{'showHidden':![],'depth':null}));switch(_0x1b4f09[_0x87c0('0x40')]){case _0x87c0('0xdb'):if(_0x3cf4de[_0x87c0('0x44')][_0x87c0('0xdc')]&&_0x3cf4de[_0x87c0('0x44')][_0x87c0('0xdd')]){_0x1e89a3=_0x3cf4de['query'][_0x87c0('0xdd')];return db['SmsMessage'][_0x87c0('0x67')]({'where':{'messageId':_0x3cf4de[_0x87c0('0x44')][_0x87c0('0xdc')]}});}break;}}})[_0x87c0('0x1f')](handleEntityNotFound(_0x34d8f3,null))['then'](function(_0x1ab5c9){if(_0x1ab5c9){_0x1eed1d=_0x1ab5c9;switch(_0x38ca41[_0x87c0('0x40')]){case _0x87c0('0xdb'):if(_0x1e89a3==='2'||_0x1e89a3==='6'){return _0x1eed1d[_0x87c0('0x34')]({'read':!![]});}else{logger[_0x87c0('0x26')](_0x87c0('0x24'),_0x87c0('0x2a'),'csc',util[_0x87c0('0xce')](_0x3cf4de[_0x87c0('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x1eed1d;}})['then'](respondWithResult(_0x34d8f3,null))[_0x87c0('0x57')](handleError(_0x34d8f3,null));};exports[_0x87c0('0xde')]=function(_0x37882c,_0x513789,_0x26fa9e){return db['SmsAccount'][_0x87c0('0x67')]({'where':{'id':_0x37882c['params']['id']}})[_0x87c0('0x1f')](handleEntityNotFound(_0x513789,null))['then'](function(_0x1e4d99){if(_0x1e4d99){return _0x1e4d99[_0x87c0('0xde')](_0x37882c[_0x87c0('0x5c')][_0x87c0('0x69')],_[_0x87c0('0xdf')](_0x37882c[_0x87c0('0x5c')],[_0x87c0('0x69'),'id'])||{})[_0x87c0('0xa2')](function(_0x53890f){for(var _0x3bc173=0x0;_0x3bc173<_0x37882c[_0x87c0('0x5c')]['ids'][_0x87c0('0x4a')];_0x3bc173+=0x1){socket[_0x87c0('0xe0')](_0x87c0('0xe1'),{'UserId':Number(_0x37882c[_0x87c0('0x5c')][_0x87c0('0x69')][_0x3bc173]),'SmsAccountId':Number(_0x37882c[_0x87c0('0x59')]['id'])});}return _0x53890f;});}})[_0x87c0('0x1f')](respondWithResult(_0x513789,null))[_0x87c0('0x57')](handleError(_0x513789,null));};exports[_0x87c0('0xe2')]=function(_0x2f41ff,_0x61a463,_0x145bd8){return db[_0x87c0('0x3d')][_0x87c0('0x67')]({'where':{'id':_0x2f41ff[_0x87c0('0x59')]['id']}})['then'](handleEntityNotFound(_0x61a463,null))['then'](function(_0x81c05e){if(_0x81c05e){return _0x81c05e[_0x87c0('0xe2')](_0x2f41ff[_0x87c0('0x44')][_0x87c0('0x69')])[_0x87c0('0x1f')](function(){if(_['isArray'](_0x2f41ff[_0x87c0('0x44')][_0x87c0('0x69')])){for(var _0x2cd673=0x0;_0x2cd673<_0x2f41ff['query']['ids']['length'];_0x2cd673+=0x1){socket[_0x87c0('0xe0')](_0x87c0('0xe3'),{'UserId':Number(_0x2f41ff[_0x87c0('0x44')][_0x87c0('0x69')][_0x2cd673]),'SmsAccountId':Number(_0x2f41ff[_0x87c0('0x59')]['id'])});}}else{socket[_0x87c0('0xe0')](_0x87c0('0xe3'),{'UserId':Number(_0x2f41ff[_0x87c0('0x44')][_0x87c0('0x69')]),'SmsAccountId':Number(_0x2f41ff[_0x87c0('0x59')]['id'])});}});}})[_0x87c0('0x1f')](respondWithStatusCode(_0x61a463,null))[_0x87c0('0x57')](handleError(_0x61a463,null));};exports[_0x87c0('0xe4')]=function(_0x5aa7b5,_0x5e3067,_0x18fff2){var _0x2da05d={};var _0x3fbb3b={};var _0xe53681;var _0x2c933c;return db[_0x87c0('0x3d')][_0x87c0('0x66')]({'where':{'id':_0x5aa7b5['params']['id']}})[_0x87c0('0x1f')](handleEntityNotFound(_0x5e3067,null))[_0x87c0('0x1f')](function(_0x112a4b){if(_0x112a4b){_0xe53681=_0x112a4b;_0x3fbb3b['model']=_[_0x87c0('0x45')](db[_0x87c0('0xab')][_0x87c0('0x3e')]);_0x3fbb3b['query']=_[_0x87c0('0x45')](_0x5aa7b5[_0x87c0('0x44')]);_0x3fbb3b[_0x87c0('0x46')]=_[_0x87c0('0x47')](_0x3fbb3b[_0x87c0('0x42')],_0x3fbb3b[_0x87c0('0x44')]);_0x2da05d['attributes']=_['intersection'](_0x3fbb3b[_0x87c0('0x42')],qs[_0x87c0('0x49')](_0x5aa7b5[_0x87c0('0x44')][_0x87c0('0x49')]));_0x2da05d[_0x87c0('0x48')]=_0x2da05d['attributes'][_0x87c0('0x4a')]?_0x2da05d[_0x87c0('0x48')]:_0x3fbb3b[_0x87c0('0x42')];_0x2da05d['order']=qs[_0x87c0('0x4d')](_0x5aa7b5[_0x87c0('0x44')][_0x87c0('0x4d')]);_0x2da05d[_0x87c0('0x4e')]=qs[_0x87c0('0x46')](_[_0x87c0('0x4f')](_0x5aa7b5['query'],_0x3fbb3b[_0x87c0('0x46')]));if(_0x5aa7b5[_0x87c0('0x44')][_0x87c0('0x50')]){_0x2da05d[_0x87c0('0x4e')]=_[_0x87c0('0x5a')](_0x2da05d[_0x87c0('0x4e')],{'$or':_[_0x87c0('0x43')](_0x2da05d[_0x87c0('0x48')],function(_0x1653c2){var _0x3fd9f2={};_0x3fd9f2[_0x1653c2]={'$like':'%'+_0x5aa7b5[_0x87c0('0x44')][_0x87c0('0x50')]+'%'};return _0x3fd9f2;})});}_0x2da05d=_['merge']({},_0x2da05d,_0x5aa7b5['options']);return _0xe53681['getAgents'](_0x2da05d);}})[_0x87c0('0x1f')](function(_0x483e87){if(_0x483e87){_0x2c933c=_0x483e87['length'];if(!_0x5aa7b5[_0x87c0('0x44')][_0x87c0('0x4b')](_0x87c0('0xbf'))){_0x2da05d[_0x87c0('0x2f')]=qs['limit'](_0x5aa7b5[_0x87c0('0x44')][_0x87c0('0x2f')]);_0x2da05d[_0x87c0('0x2c')]=qs['offset'](_0x5aa7b5[_0x87c0('0x44')][_0x87c0('0x2c')]);}return _0xe53681[_0x87c0('0xe4')](_0x2da05d);}})[_0x87c0('0x1f')](function(_0x10e353){if(_0x10e353){return _0x10e353?{'count':_0x2c933c,'rows':_0x10e353}:null;}})[_0x87c0('0x1f')](respondWithResult(_0x5e3067,null))['catch'](handleError(_0x5e3067,null));};
\ No newline at end of file
index 54df545..3e965ae 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd280=['exports','events','SmsAccount','save','update','remove','emit','hasOwnProperty'];(function(_0x4572c7,_0x49785c){var _0x573aa1=function(_0x35c846){while(--_0x35c846){_0x4572c7['push'](_0x4572c7['shift']());}};_0x573aa1(++_0x49785c);}(_0xd280,0x1c1));var _0x0d28=function(_0x448ed7,_0x2a4344){_0x448ed7=_0x448ed7-0x0;var _0x5f05e6=_0xd280[_0x448ed7];return _0x5f05e6;};'use strict';var EventEmitter=require(_0x0d28('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x0d28('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0d28('0x2'),'afterUpdate':_0x0d28('0x3'),'afterDestroy':_0x0d28('0x4')};function emitEvent(_0x38f1e8){return function(_0x154759,_0x1a393c,_0x5a5b39){SmsAccountEvents[_0x0d28('0x5')](_0x38f1e8+':'+_0x154759['id'],_0x154759);SmsAccountEvents['emit'](_0x38f1e8,_0x154759);_0x5a5b39(null);};}for(var e in events){if(events[_0x0d28('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x0d28('0x7')]=SmsAccountEvents;
\ No newline at end of file
+var _0x2a8f=['emit','hook','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x5f3a18,_0x438539){var _0x42e3f6=function(_0x5d520d){while(--_0x5d520d){_0x5f3a18['push'](_0x5f3a18['shift']());}};_0x42e3f6(++_0x438539);}(_0x2a8f,0x1ee));var _0xf2a8=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2a8f[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xf2a8('0x0'))['db'][_0xf2a8('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xf2a8('0x2')](0x0);var events={'afterCreate':_0xf2a8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x16cfab){return function(_0xdf4350,_0x58faa9,_0x2475c1){SmsAccountEvents[_0xf2a8('0x4')](_0x16cfab+':'+_0xdf4350['id'],_0xdf4350);SmsAccountEvents[_0xf2a8('0x4')](_0x16cfab,_0xdf4350);_0x2475c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xf2a8('0x5')](e,emitEvent(event));}}module['exports']=SmsAccountEvents;
\ No newline at end of file
index 4bd8bf5..1da12fd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0839=['./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x414d99,_0xcbf488){var _0x3d60e3=function(_0x27b7de){while(--_0x27b7de){_0x414d99['push'](_0x414d99['shift']());}};_0x3d60e3(++_0xcbf488);}(_0x0839,0x100));var _0x9083=function(_0x4d2585,_0x2d4dad){_0x4d2585=_0x4d2585-0x0;var _0x1bbfef=_0x0839[_0x4d2585];return _0x1bbfef;};'use strict';var _=require(_0x9083('0x0'));var util=require(_0x9083('0x1'));var logger=require(_0x9083('0x2'))(_0x9083('0x3'));var moment=require(_0x9083('0x4'));var BPromise=require(_0x9083('0x5'));var rp=require(_0x9083('0x6'));var fs=require('fs');var path=require(_0x9083('0x7'));var rimraf=require(_0x9083('0x8'));var config=require(_0x9083('0x9'));var attributes=require(_0x9083('0xa'));module[_0x9083('0xb')]=function(_0x3282b5,_0x2c9212){return _0x3282b5['define'](_0x9083('0xc'),attributes,{'tableName':_0x9083('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xfbc0=['define','sms_accounts','lodash','util','api','moment','request-promise','path','./smsAccount.attributes','exports'];(function(_0x3819e9,_0x3dadd9){var _0x49c381=function(_0x8147f){while(--_0x8147f){_0x3819e9['push'](_0x3819e9['shift']());}};_0x49c381(++_0x3dadd9);}(_0xfbc0,0xa2));var _0x0fbc=function(_0x4711f2,_0x1598e2){_0x4711f2=_0x4711f2-0x0;var _0xe18765=_0xfbc0[_0x4711f2];return _0xe18765;};'use strict';var _=require(_0x0fbc('0x0'));var util=require(_0x0fbc('0x1'));var logger=require('../../config/logger')(_0x0fbc('0x2'));var moment=require(_0x0fbc('0x3'));var BPromise=require('bluebird');var rp=require(_0x0fbc('0x4'));var fs=require('fs');var path=require(_0x0fbc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0fbc('0x6'));module[_0x0fbc('0x7')]=function(_0x23913b,_0x1667fd){return _0x23913b[_0x0fbc('0x8')]('SmsAccount',attributes,{'tableName':_0x0fbc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index de7cb2c..d487309 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c8c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./smsAccount.socket','register','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ShowSmsAccount','find','options','raw','where','attributes','include','map','model','then','debug','stringify','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3f80e1,_0x30864c){var _0x2c471d=function(_0x433510){while(--_0x433510){_0x3f80e1['push'](_0x3f80e1['shift']());}};_0x2c471d(++_0x30864c);}(_0x6c8c,0xd9));var _0xc6c8=function(_0x585a44,_0x110e8f){_0x585a44=_0x585a44-0x0;var _0x4a7aae=_0x6c8c[_0x585a44];return _0x4a7aae;};'use strict';var _=require(_0xc6c8('0x0'));var util=require(_0xc6c8('0x1'));var moment=require(_0xc6c8('0x2'));var BPromise=require(_0xc6c8('0x3'));var rs=require(_0xc6c8('0x4'));var fs=require('fs');var Redis=require(_0xc6c8('0x5'));var db=require(_0xc6c8('0x6'))['db'];var utils=require(_0xc6c8('0x7'));var logger=require(_0xc6c8('0x8'))(_0xc6c8('0x9'));var config=require(_0xc6c8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc6c8('0xb')][_0xc6c8('0xc')]({'port':0x232a});config[_0xc6c8('0xd')]=_['defaults'](config[_0xc6c8('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc6c8('0xe'))(new Redis(config[_0xc6c8('0xd')]));require(_0xc6c8('0xf'))[_0xc6c8('0x10')](socket);function respondWithRpcPromise(_0x4ac476,_0x1eaefb,_0x142ac0){return new BPromise(function(_0x48ef4c,_0x110dbf){return client['request'](_0x4ac476,_0x142ac0)['then'](function(_0x266e38){logger[_0xc6c8('0x11')](_0xc6c8('0x12'),_0x1eaefb,'request\x20sent');logger['debug'](_0xc6c8('0x13'),_0x1eaefb,_0xc6c8('0x14'),JSON['stringify'](_0x266e38));if(_0x266e38[_0xc6c8('0x15')]){if(_0x266e38[_0xc6c8('0x15')][_0xc6c8('0x16')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x1eaefb,_0x266e38[_0xc6c8('0x15')][_0xc6c8('0x17')]);return _0x110dbf(_0x266e38['error'][_0xc6c8('0x17')]);}logger[_0xc6c8('0x15')](_0xc6c8('0x12'),_0x1eaefb,_0x266e38[_0xc6c8('0x15')][_0xc6c8('0x17')]);return _0x48ef4c(_0x266e38[_0xc6c8('0x15')]['message']);}else{logger['info'](_0xc6c8('0x12'),_0x1eaefb,_0xc6c8('0x14'));_0x48ef4c(_0x266e38['result']['message']);}})['catch'](function(_0x12fa2f){logger[_0xc6c8('0x15')](_0xc6c8('0x12'),_0x1eaefb,_0x12fa2f);_0x110dbf(_0x12fa2f);});});}exports[_0xc6c8('0x18')]=function(_0x122fde){var _0x1abd0d=this;return new Promise(function(_0x5120b9,_0x2b083c){return db['SmsAccount'][_0xc6c8('0x19')]({'raw':_0x122fde[_0xc6c8('0x1a')]?_0x122fde[_0xc6c8('0x1a')][_0xc6c8('0x1b')]===undefined?!![]:![]:!![],'where':_0x122fde[_0xc6c8('0x1a')]?_0x122fde[_0xc6c8('0x1a')][_0xc6c8('0x1c')]||null:null,'attributes':_0x122fde[_0xc6c8('0x1a')]?_0x122fde['options'][_0xc6c8('0x1d')]||null:null,'include':_0x122fde[_0xc6c8('0x1a')]?_0x122fde['options'][_0xc6c8('0x1e')]?_[_0xc6c8('0x1f')](_0x122fde['options']['include'],function(_0x38a138){return{'model':db[_0x38a138[_0xc6c8('0x20')]],'as':_0x38a138['as'],'attributes':_0x38a138[_0xc6c8('0x1d')],'include':_0x38a138[_0xc6c8('0x1e')]?_[_0xc6c8('0x1f')](_0x38a138['include'],function(_0x2a9f7e){return{'model':db[_0x2a9f7e['model']],'as':_0x2a9f7e['as'],'attributes':_0x2a9f7e['attributes'],'include':_0x2a9f7e[_0xc6c8('0x1e')]?_[_0xc6c8('0x1f')](_0x2a9f7e['include'],function(_0x53a8c1){return{'model':db[_0x53a8c1[_0xc6c8('0x20')]],'as':_0x53a8c1['as'],'attributes':_0x53a8c1['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6c8('0x21')](function(_0x233b52){logger[_0xc6c8('0x11')]('ShowSmsAccount',_0x122fde);logger[_0xc6c8('0x22')](_0xc6c8('0x18'),_0x122fde,JSON[_0xc6c8('0x23')](_0x233b52));_0x5120b9(_0x233b52);})[_0xc6c8('0x24')](function(_0x223c13){logger[_0xc6c8('0x15')](_0xc6c8('0x18'),_0x223c13[_0xc6c8('0x17')],_0x122fde);_0x2b083c(_0x1abd0d[_0xc6c8('0x15')](0x1f4,_0x223c13[_0xc6c8('0x17')]));});});};
\ No newline at end of file
+var _0x906a=['raw','where','attributes','map','include','model','catch','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSmsAccount','SmsAccount','find','options'];(function(_0x3624e7,_0x109d46){var _0x49f48d=function(_0xca8189){while(--_0xca8189){_0x3624e7['push'](_0x3624e7['shift']());}};_0x49f48d(++_0x109d46);}(_0x906a,0x151));var _0xa906=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x906a[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa906('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa906('0x1'))['db'];var utils=require(_0xa906('0x2'));var logger=require(_0xa906('0x3'))(_0xa906('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa906('0x5')]({'port':0x232a});config[_0xa906('0x6')]=_[_0xa906('0x7')](config[_0xa906('0x6')],{'host':_0xa906('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa906('0x9'))[_0xa906('0xa')](socket);function respondWithRpcPromise(_0x35746c,_0xb03276,_0x32619d){return new BPromise(function(_0x54a333,_0x262af4){return client[_0xa906('0xb')](_0x35746c,_0x32619d)[_0xa906('0xc')](function(_0x5db4a5){logger[_0xa906('0xd')](_0xa906('0xe'),_0xb03276,_0xa906('0xf'));logger[_0xa906('0x10')](_0xa906('0x11'),_0xb03276,_0xa906('0xf'),JSON[_0xa906('0x12')](_0x5db4a5));if(_0x5db4a5['error']){if(_0x5db4a5[_0xa906('0x13')]['code']===0x1f4){logger[_0xa906('0x13')](_0xa906('0xe'),_0xb03276,_0x5db4a5['error']['message']);return _0x262af4(_0x5db4a5[_0xa906('0x13')][_0xa906('0x14')]);}logger[_0xa906('0x13')](_0xa906('0xe'),_0xb03276,_0x5db4a5['error'][_0xa906('0x14')]);return _0x54a333(_0x5db4a5[_0xa906('0x13')][_0xa906('0x14')]);}else{logger[_0xa906('0xd')](_0xa906('0xe'),_0xb03276,_0xa906('0xf'));_0x54a333(_0x5db4a5[_0xa906('0x15')]['message']);}})['catch'](function(_0x575baa){logger[_0xa906('0x13')]('SmsAccount,\x20%s,\x20%s',_0xb03276,_0x575baa);_0x262af4(_0x575baa);});});}exports[_0xa906('0x16')]=function(_0x3a8da0){var _0x392484=this;return new Promise(function(_0x213f07,_0x3dcd93){return db[_0xa906('0x17')][_0xa906('0x18')]({'raw':_0x3a8da0[_0xa906('0x19')]?_0x3a8da0[_0xa906('0x19')][_0xa906('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a8da0['options']?_0x3a8da0['options'][_0xa906('0x1b')]||null:null,'attributes':_0x3a8da0[_0xa906('0x19')]?_0x3a8da0['options'][_0xa906('0x1c')]||null:null,'include':_0x3a8da0[_0xa906('0x19')]?_0x3a8da0[_0xa906('0x19')]['include']?_[_0xa906('0x1d')](_0x3a8da0['options'][_0xa906('0x1e')],function(_0x1ce137){return{'model':db[_0x1ce137[_0xa906('0x1f')]],'as':_0x1ce137['as'],'attributes':_0x1ce137[_0xa906('0x1c')],'include':_0x1ce137[_0xa906('0x1e')]?_[_0xa906('0x1d')](_0x1ce137[_0xa906('0x1e')],function(_0x23bcc2){return{'model':db[_0x23bcc2['model']],'as':_0x23bcc2['as'],'attributes':_0x23bcc2[_0xa906('0x1c')],'include':_0x23bcc2[_0xa906('0x1e')]?_[_0xa906('0x1d')](_0x23bcc2[_0xa906('0x1e')],function(_0x151d9a){return{'model':db[_0x151d9a[_0xa906('0x1f')]],'as':_0x151d9a['as'],'attributes':_0x151d9a[_0xa906('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa906('0xc')](function(_0x9d5cea){logger[_0xa906('0xd')](_0xa906('0x16'),_0x3a8da0);logger[_0xa906('0x10')]('ShowSmsAccount',_0x3a8da0,JSON['stringify'](_0x9d5cea));_0x213f07(_0x9d5cea);})[_0xa906('0x20')](function(_0x50e345){logger['error'](_0xa906('0x16'),_0x50e345[_0xa906('0x14')],_0x3a8da0);_0x3dcd93(_0x392484[_0xa906('0x13')](0x1f4,_0x50e345[_0xa906('0x14')]));});});};
\ No newline at end of file
index dc05997..b9fa456 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
+var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
index fefe657..1a61277 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x4073e5,_0x352b75){var _0x250eb6=function(_0x336ded){while(--_0x336ded){_0x4073e5['push'](_0x4073e5['shift']());}};_0x250eb6(++_0x352b75);}(_0xe14b,0x93));var _0xbe14=function(_0x52ac43,_0x33cddd){_0x52ac43=_0x52ac43-0x0;var _0x2cb1c5=_0xe14b[_0x52ac43];return _0x2cb1c5;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=router;
\ No newline at end of file
+var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router;
\ No newline at end of file
index 897d9f8..0e503d8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7e47=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT','STRING'];(function(_0x112468,_0x145fb6){var _0x980347=function(_0x120087){while(--_0x120087){_0x112468['push'](_0x112468['shift']());}};_0x980347(++_0x145fb6);}(_0x7e47,0x78));var _0x77e4=function(_0x20316a,_0x1e7d7b){_0x20316a=_0x20316a-0x0;var _0xb381fa=_0x7e47[_0x20316a];return _0xb381fa;};'use strict';var Sequelize=require(_0x77e4('0x0'));module[_0x77e4('0x1')]={'priority':{'type':Sequelize[_0x77e4('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x77e4('0x3')},'appdata':{'type':Sequelize[_0x77e4('0x4')]()},'description':{'type':Sequelize[_0x77e4('0x5')]},'interval':{'type':Sequelize[_0x77e4('0x5')],'defaultValue':_0x77e4('0x6')}};
\ No newline at end of file
+var _0x0381=['STRING','noop','TEXT','sequelize','INTEGER'];(function(_0xeebde1,_0x2be316){var _0x51f691=function(_0x55f307){while(--_0x55f307){_0xeebde1['push'](_0xeebde1['shift']());}};_0x51f691(++_0x2be316);}(_0x0381,0x13e));var _0x1038=function(_0x1c8c30,_0x3b5530){_0x1c8c30=_0x1c8c30-0x0;var _0x70b806=_0x0381[_0x1c8c30];return _0x70b806;};'use strict';var Sequelize=require(_0x1038('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1038('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1038('0x2')],'allowNull':![],'defaultValue':_0x1038('0x3')},'appdata':{'type':Sequelize[_0x1038('0x4')]()},'description':{'type':Sequelize[_0x1038('0x2')]},'interval':{'type':Sequelize[_0x1038('0x2')],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
index 3893207..b1bdbe9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd7e9=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','SmsApplication','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1c80ff,_0xfa46fe){var _0xcf4075=function(_0x4cf379){while(--_0x4cf379){_0x1c80ff['push'](_0x1c80ff['shift']());}};_0xcf4075(++_0xfa46fe);}(_0xd7e9,0x1bc));var _0x9d7e=function(_0x2222fe,_0xe5a69f){_0x2222fe=_0x2222fe-0x0;var _0x149699=_0xd7e9[_0x2222fe];return _0x149699;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d7e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d7e('0x1'));var rp=require(_0x9d7e('0x2'));var moment=require(_0x9d7e('0x3'));var BPromise=require(_0x9d7e('0x4'));var Mustache=require(_0x9d7e('0x5'));var util=require('util');var path=require(_0x9d7e('0x6'));var sox=require(_0x9d7e('0x7'));var csv=require(_0x9d7e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d7e('0x9'));var _=require(_0x9d7e('0xa'));var squel=require(_0x9d7e('0xb'));var crypto=require(_0x9d7e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9d7e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9d7e('0xe'));var Papa=require('papaparse');var Redis=require(_0x9d7e('0xf'));var authService=require(_0x9d7e('0x10'));var qs=require(_0x9d7e('0x11'));var as=require(_0x9d7e('0x12'));var hardwareService=require(_0x9d7e('0x13'));var logger=require('../../config/logger')(_0x9d7e('0x14'));var utils=require(_0x9d7e('0x15'));var config=require(_0x9d7e('0x16'));var licenseUtil=require(_0x9d7e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x459921,_0x2a1367){_0x2a1367=_0x2a1367||0xcc;return function(_0x107fea){if(_0x107fea){return _0x459921[_0x9d7e('0x18')](_0x2a1367);}return _0x459921[_0x9d7e('0x19')](_0x2a1367)[_0x9d7e('0x1a')]();};}function respondWithResult(_0x1760c1,_0x2b9721){_0x2b9721=_0x2b9721||0xc8;return function(_0x13b6c8){if(_0x13b6c8){return _0x1760c1[_0x9d7e('0x19')](_0x2b9721)[_0x9d7e('0x1b')](_0x13b6c8);}};}function respondWithFilteredResult(_0x193215,_0x47c9bb){return function(_0x45e7d6){if(_0x45e7d6){var _0xa61ee8=typeof _0x47c9bb[_0x9d7e('0x1c')]===_0x9d7e('0x1d')&&typeof _0x47c9bb['limit']==='undefined';var _0x4293bb=_0x45e7d6[_0x9d7e('0x1e')];var _0x1b7a50=_0xa61ee8?0x0:_0x47c9bb['offset'];var _0x1cccf7=_0xa61ee8?_0x45e7d6[_0x9d7e('0x1e')]:_0x47c9bb['offset']+_0x47c9bb[_0x9d7e('0x1f')];var _0x5572de;if(_0x1cccf7>=_0x4293bb){_0x1cccf7=_0x4293bb;_0x5572de=0xc8;}else{_0x5572de=0xce;}_0x193215['status'](_0x5572de);return _0x193215[_0x9d7e('0x20')](_0x9d7e('0x21'),_0x1b7a50+'-'+_0x1cccf7+'/'+_0x4293bb)[_0x9d7e('0x1b')](_0x45e7d6);}return null;};}function patchUpdates(_0x3b82ee){return function(_0x15630f){try{jsonpatch[_0x9d7e('0x22')](_0x15630f,_0x3b82ee,!![]);}catch(_0x5331ab){return BPromise[_0x9d7e('0x23')](_0x5331ab);}return _0x15630f[_0x9d7e('0x24')]();};}function saveUpdates(_0x5a8468,_0x48c50e){return function(_0x4c7edf){if(_0x4c7edf){return _0x4c7edf[_0x9d7e('0x25')](_0x5a8468)['then'](function(_0x46634d){return _0x46634d;});}return null;};}function removeEntity(_0x8efc8e,_0x1e5c04){return function(_0x28e151){if(_0x28e151){return _0x28e151[_0x9d7e('0x26')]()[_0x9d7e('0x27')](function(){_0x8efc8e[_0x9d7e('0x19')](0xcc)[_0x9d7e('0x1a')]();});}};}function handleEntityNotFound(_0x23400a,_0xeb7edd){return function(_0x2f254e){if(!_0x2f254e){_0x23400a[_0x9d7e('0x18')](0x194);}return _0x2f254e;};}function handleError(_0x3a43d0,_0x5506c4){_0x5506c4=_0x5506c4||0x1f4;return function(_0x830927){logger[_0x9d7e('0x28')](_0x830927[_0x9d7e('0x29')]);if(_0x830927['name']){delete _0x830927[_0x9d7e('0x2a')];}_0x3a43d0['status'](_0x5506c4)[_0x9d7e('0x2b')](_0x830927);};}exports['index']=function(_0x31ac98,_0x1133bf){var _0x1bd3bd={},_0x55557a={},_0x5e1cd5={'count':0x0,'rows':[]};var _0x402d54=_[_0x9d7e('0x2c')](db['SmsApplication']['rawAttributes'],function(_0x479fbb){return{'name':_0x479fbb['fieldName'],'type':_0x479fbb[_0x9d7e('0x2d')][_0x9d7e('0x2e')]};});_0x55557a[_0x9d7e('0x2f')]=_['map'](_0x402d54,_0x9d7e('0x2a'));_0x55557a[_0x9d7e('0x30')]=_[_0x9d7e('0x31')](_0x31ac98[_0x9d7e('0x30')]);_0x55557a['filters']=_[_0x9d7e('0x32')](_0x55557a[_0x9d7e('0x2f')],_0x55557a['query']);_0x1bd3bd[_0x9d7e('0x33')]=_[_0x9d7e('0x32')](_0x55557a[_0x9d7e('0x2f')],qs[_0x9d7e('0x34')](_0x31ac98[_0x9d7e('0x30')]['fields']));_0x1bd3bd['attributes']=_0x1bd3bd[_0x9d7e('0x33')][_0x9d7e('0x35')]?_0x1bd3bd['attributes']:_0x55557a[_0x9d7e('0x2f')];if(!_0x31ac98[_0x9d7e('0x30')][_0x9d7e('0x36')](_0x9d7e('0x37'))){_0x1bd3bd[_0x9d7e('0x1f')]=qs[_0x9d7e('0x1f')](_0x31ac98[_0x9d7e('0x30')][_0x9d7e('0x1f')]);_0x1bd3bd['offset']=qs[_0x9d7e('0x1c')](_0x31ac98['query'][_0x9d7e('0x1c')]);}_0x1bd3bd[_0x9d7e('0x38')]=qs['sort'](_0x31ac98[_0x9d7e('0x30')][_0x9d7e('0x39')]);_0x1bd3bd[_0x9d7e('0x3a')]=qs[_0x9d7e('0x3b')](_[_0x9d7e('0x3c')](_0x31ac98[_0x9d7e('0x30')],_0x55557a[_0x9d7e('0x3b')]),_0x402d54);if(_0x31ac98[_0x9d7e('0x30')][_0x9d7e('0x3d')]){_0x1bd3bd[_0x9d7e('0x3a')]=_['merge'](_0x1bd3bd['where'],{'$or':_[_0x9d7e('0x2c')](_0x402d54,function(_0x47afe1){if(_0x47afe1[_0x9d7e('0x2d')]!==_0x9d7e('0x3e')){var _0x234bb3={};_0x234bb3[_0x47afe1[_0x9d7e('0x2a')]]={'$like':'%'+_0x31ac98['query'][_0x9d7e('0x3d')]+'%'};return _0x234bb3;}})});}_0x1bd3bd=_[_0x9d7e('0x3f')]({},_0x1bd3bd,_0x31ac98[_0x9d7e('0x40')]);var _0x385d8b={'where':_0x1bd3bd[_0x9d7e('0x3a')]};return db[_0x9d7e('0x41')]['count'](_0x385d8b)[_0x9d7e('0x27')](function(_0x2257a5){_0x5e1cd5[_0x9d7e('0x1e')]=_0x2257a5;if(_0x31ac98[_0x9d7e('0x30')][_0x9d7e('0x42')]){_0x1bd3bd[_0x9d7e('0x43')]=[{'all':!![]}];}return db[_0x9d7e('0x41')][_0x9d7e('0x44')](_0x1bd3bd);})[_0x9d7e('0x27')](function(_0x3b509f){_0x5e1cd5[_0x9d7e('0x45')]=_0x3b509f;return _0x5e1cd5;})[_0x9d7e('0x27')](respondWithFilteredResult(_0x1133bf,_0x1bd3bd))[_0x9d7e('0x46')](handleError(_0x1133bf,null));};exports[_0x9d7e('0x47')]=function(_0x4bcb54,_0x3ff0d5){var _0x2d7353={'raw':!![],'where':{'id':_0x4bcb54[_0x9d7e('0x48')]['id']}},_0x384a5c={};_0x384a5c['model']=_[_0x9d7e('0x31')](db['SmsApplication'][_0x9d7e('0x49')]);_0x384a5c[_0x9d7e('0x30')]=_['keys'](_0x4bcb54[_0x9d7e('0x30')]);_0x384a5c[_0x9d7e('0x3b')]=_[_0x9d7e('0x32')](_0x384a5c['model'],_0x384a5c[_0x9d7e('0x30')]);_0x2d7353[_0x9d7e('0x33')]=_[_0x9d7e('0x32')](_0x384a5c[_0x9d7e('0x2f')],qs['fields'](_0x4bcb54[_0x9d7e('0x30')][_0x9d7e('0x34')]));_0x2d7353['attributes']=_0x2d7353[_0x9d7e('0x33')][_0x9d7e('0x35')]?_0x2d7353[_0x9d7e('0x33')]:_0x384a5c[_0x9d7e('0x2f')];if(_0x4bcb54['query'][_0x9d7e('0x42')]){_0x2d7353[_0x9d7e('0x43')]=[{'all':!![]}];}_0x2d7353=_[_0x9d7e('0x3f')]({},_0x2d7353,_0x4bcb54[_0x9d7e('0x40')]);return db['SmsApplication'][_0x9d7e('0x4a')](_0x2d7353)[_0x9d7e('0x27')](handleEntityNotFound(_0x3ff0d5,null))[_0x9d7e('0x27')](respondWithResult(_0x3ff0d5,null))[_0x9d7e('0x46')](handleError(_0x3ff0d5,null));};exports[_0x9d7e('0x4b')]=function(_0x2619e8,_0x3690cc){return db[_0x9d7e('0x41')][_0x9d7e('0x4b')](_0x2619e8[_0x9d7e('0x4c')],{})[_0x9d7e('0x27')](respondWithResult(_0x3690cc,0xc9))[_0x9d7e('0x46')](handleError(_0x3690cc,null));};exports[_0x9d7e('0x25')]=function(_0x51778b,_0x49a751){if(_0x51778b[_0x9d7e('0x4c')]['id']){delete _0x51778b['body']['id'];}return db['SmsApplication'][_0x9d7e('0x4a')]({'where':{'id':_0x51778b[_0x9d7e('0x48')]['id']}})[_0x9d7e('0x27')](handleEntityNotFound(_0x49a751,null))[_0x9d7e('0x27')](saveUpdates(_0x51778b['body'],null))[_0x9d7e('0x27')](respondWithResult(_0x49a751,null))[_0x9d7e('0x46')](handleError(_0x49a751,null));};exports[_0x9d7e('0x26')]=function(_0x5cdc72,_0x148303){return db['SmsApplication']['find']({'where':{'id':_0x5cdc72[_0x9d7e('0x48')]['id']}})[_0x9d7e('0x27')](handleEntityNotFound(_0x148303,null))[_0x9d7e('0x27')](removeEntity(_0x148303,null))[_0x9d7e('0x46')](handleError(_0x148303,null));};
\ No newline at end of file
+var _0x8347=['type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SmsApplication','includeAll','findAll','rows','show','fields','include','catch','create','body','find','params','zip-dir','request-promise','path','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8347,0x181));var _0x7834=function(_0x30ab3a,_0x157468){_0x30ab3a=_0x30ab3a-0x0;var _0x342a31=_0x8347[_0x30ab3a];return _0x342a31;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7834('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7834('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7834('0x2'));var sox=require('sox');var csv=require(_0x7834('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7834('0x4'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7834('0x5'));var deskjs=require(_0x7834('0x6'));var toCsv=require('to-csv');var querystring=require(_0x7834('0x7'));var Papa=require(_0x7834('0x8'));var Redis=require(_0x7834('0x9'));var authService=require(_0x7834('0xa'));var qs=require(_0x7834('0xb'));var as=require(_0x7834('0xc'));var hardwareService=require(_0x7834('0xd'));var logger=require(_0x7834('0xe'))(_0x7834('0xf'));var utils=require(_0x7834('0x10'));var config=require(_0x7834('0x11'));var licenseUtil=require(_0x7834('0x12'));var db=require(_0x7834('0x13'))['db'];function respondWithStatusCode(_0x604a52,_0x1f6424){_0x1f6424=_0x1f6424||0xcc;return function(_0x352fa9){if(_0x352fa9){return _0x604a52[_0x7834('0x14')](_0x1f6424);}return _0x604a52[_0x7834('0x15')](_0x1f6424)[_0x7834('0x16')]();};}function respondWithResult(_0x410db4,_0x91dcac){_0x91dcac=_0x91dcac||0xc8;return function(_0x4e442c){if(_0x4e442c){return _0x410db4[_0x7834('0x15')](_0x91dcac)[_0x7834('0x17')](_0x4e442c);}};}function respondWithFilteredResult(_0x261324,_0x3a7fb7){return function(_0x2fc7af){if(_0x2fc7af){var _0x3c6a11=typeof _0x3a7fb7['offset']===_0x7834('0x18')&&typeof _0x3a7fb7[_0x7834('0x19')]===_0x7834('0x18');var _0x39007d=_0x2fc7af[_0x7834('0x1a')];var _0x4fcc01=_0x3c6a11?0x0:_0x3a7fb7[_0x7834('0x1b')];var _0x3478b8=_0x3c6a11?_0x2fc7af[_0x7834('0x1a')]:_0x3a7fb7[_0x7834('0x1b')]+_0x3a7fb7[_0x7834('0x19')];var _0xcc2332;if(_0x3478b8>=_0x39007d){_0x3478b8=_0x39007d;_0xcc2332=0xc8;}else{_0xcc2332=0xce;}_0x261324[_0x7834('0x15')](_0xcc2332);return _0x261324[_0x7834('0x1c')](_0x7834('0x1d'),_0x4fcc01+'-'+_0x3478b8+'/'+_0x39007d)[_0x7834('0x17')](_0x2fc7af);}return null;};}function patchUpdates(_0x2c8593){return function(_0x23f1fe){try{jsonpatch['apply'](_0x23f1fe,_0x2c8593,!![]);}catch(_0x1129cd){return BPromise[_0x7834('0x1e')](_0x1129cd);}return _0x23f1fe['save']();};}function saveUpdates(_0x3fd0d3,_0x5bc10a){return function(_0x11558b){if(_0x11558b){return _0x11558b[_0x7834('0x1f')](_0x3fd0d3)[_0x7834('0x20')](function(_0x30b50b){return _0x30b50b;});}return null;};}function removeEntity(_0x334869,_0x2cab23){return function(_0x42ac33){if(_0x42ac33){return _0x42ac33[_0x7834('0x21')]()[_0x7834('0x20')](function(){_0x334869[_0x7834('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfe7244,_0x4256a7){return function(_0x3e15a9){if(!_0x3e15a9){_0xfe7244[_0x7834('0x14')](0x194);}return _0x3e15a9;};}function handleError(_0x4b1185,_0xc9051c){_0xc9051c=_0xc9051c||0x1f4;return function(_0xd95ff3){logger[_0x7834('0x22')](_0xd95ff3[_0x7834('0x23')]);if(_0xd95ff3[_0x7834('0x24')]){delete _0xd95ff3['name'];}_0x4b1185[_0x7834('0x15')](_0xc9051c)['send'](_0xd95ff3);};}exports[_0x7834('0x25')]=function(_0xe16f5a,_0x31a875){var _0x3558f1={},_0x126689={},_0xa90854={'count':0x0,'rows':[]};var _0x5dd77f=_[_0x7834('0x26')](db['SmsApplication'][_0x7834('0x27')],function(_0x35e5ee){return{'name':_0x35e5ee[_0x7834('0x28')],'type':_0x35e5ee[_0x7834('0x29')][_0x7834('0x2a')]};});_0x126689['model']=_['map'](_0x5dd77f,'name');_0x126689[_0x7834('0x2b')]=_[_0x7834('0x2c')](_0xe16f5a[_0x7834('0x2b')]);_0x126689[_0x7834('0x2d')]=_[_0x7834('0x2e')](_0x126689[_0x7834('0x2f')],_0x126689[_0x7834('0x2b')]);_0x3558f1['attributes']=_['intersection'](_0x126689[_0x7834('0x2f')],qs['fields'](_0xe16f5a[_0x7834('0x2b')]['fields']));_0x3558f1['attributes']=_0x3558f1[_0x7834('0x30')][_0x7834('0x31')]?_0x3558f1[_0x7834('0x30')]:_0x126689[_0x7834('0x2f')];if(!_0xe16f5a[_0x7834('0x2b')][_0x7834('0x32')](_0x7834('0x33'))){_0x3558f1[_0x7834('0x19')]=qs['limit'](_0xe16f5a['query'][_0x7834('0x19')]);_0x3558f1['offset']=qs['offset'](_0xe16f5a[_0x7834('0x2b')][_0x7834('0x1b')]);}_0x3558f1['order']=qs[_0x7834('0x34')](_0xe16f5a[_0x7834('0x2b')][_0x7834('0x34')]);_0x3558f1[_0x7834('0x35')]=qs[_0x7834('0x2d')](_[_0x7834('0x36')](_0xe16f5a[_0x7834('0x2b')],_0x126689[_0x7834('0x2d')]),_0x5dd77f);if(_0xe16f5a[_0x7834('0x2b')][_0x7834('0x37')]){_0x3558f1[_0x7834('0x35')]=_[_0x7834('0x38')](_0x3558f1[_0x7834('0x35')],{'$or':_['map'](_0x5dd77f,function(_0x3234c8){if(_0x3234c8[_0x7834('0x29')]!==_0x7834('0x39')){var _0x1cbc2a={};_0x1cbc2a[_0x3234c8['name']]={'$like':'%'+_0xe16f5a[_0x7834('0x2b')][_0x7834('0x37')]+'%'};return _0x1cbc2a;}})});}_0x3558f1=_[_0x7834('0x38')]({},_0x3558f1,_0xe16f5a[_0x7834('0x3a')]);var _0xfb5330={'where':_0x3558f1[_0x7834('0x35')]};return db[_0x7834('0x3b')][_0x7834('0x1a')](_0xfb5330)[_0x7834('0x20')](function(_0x1db570){_0xa90854[_0x7834('0x1a')]=_0x1db570;if(_0xe16f5a[_0x7834('0x2b')][_0x7834('0x3c')]){_0x3558f1['include']=[{'all':!![]}];}return db['SmsApplication'][_0x7834('0x3d')](_0x3558f1);})['then'](function(_0x309ca9){_0xa90854[_0x7834('0x3e')]=_0x309ca9;return _0xa90854;})[_0x7834('0x20')](respondWithFilteredResult(_0x31a875,_0x3558f1))['catch'](handleError(_0x31a875,null));};exports[_0x7834('0x3f')]=function(_0x27572f,_0x1ff926){var _0x9c6c25={'raw':!![],'where':{'id':_0x27572f['params']['id']}},_0x1e36d5={};_0x1e36d5[_0x7834('0x2f')]=_['keys'](db[_0x7834('0x3b')][_0x7834('0x27')]);_0x1e36d5[_0x7834('0x2b')]=_['keys'](_0x27572f[_0x7834('0x2b')]);_0x1e36d5[_0x7834('0x2d')]=_[_0x7834('0x2e')](_0x1e36d5[_0x7834('0x2f')],_0x1e36d5[_0x7834('0x2b')]);_0x9c6c25['attributes']=_[_0x7834('0x2e')](_0x1e36d5[_0x7834('0x2f')],qs[_0x7834('0x40')](_0x27572f[_0x7834('0x2b')][_0x7834('0x40')]));_0x9c6c25[_0x7834('0x30')]=_0x9c6c25[_0x7834('0x30')][_0x7834('0x31')]?_0x9c6c25[_0x7834('0x30')]:_0x1e36d5[_0x7834('0x2f')];if(_0x27572f[_0x7834('0x2b')][_0x7834('0x3c')]){_0x9c6c25[_0x7834('0x41')]=[{'all':!![]}];}_0x9c6c25=_[_0x7834('0x38')]({},_0x9c6c25,_0x27572f[_0x7834('0x3a')]);return db['SmsApplication']['find'](_0x9c6c25)['then'](handleEntityNotFound(_0x1ff926,null))[_0x7834('0x20')](respondWithResult(_0x1ff926,null))[_0x7834('0x42')](handleError(_0x1ff926,null));};exports[_0x7834('0x43')]=function(_0x38c2eb,_0x47da93){return db[_0x7834('0x3b')][_0x7834('0x43')](_0x38c2eb['body'],{})['then'](respondWithResult(_0x47da93,0xc9))[_0x7834('0x42')](handleError(_0x47da93,null));};exports[_0x7834('0x1f')]=function(_0x19618f,_0x4035cb){if(_0x19618f[_0x7834('0x44')]['id']){delete _0x19618f['body']['id'];}return db['SmsApplication'][_0x7834('0x45')]({'where':{'id':_0x19618f[_0x7834('0x46')]['id']}})['then'](handleEntityNotFound(_0x4035cb,null))[_0x7834('0x20')](saveUpdates(_0x19618f[_0x7834('0x44')],null))['then'](respondWithResult(_0x4035cb,null))['catch'](handleError(_0x4035cb,null));};exports['destroy']=function(_0x2f84d3,_0x30d7de){return db[_0x7834('0x3b')][_0x7834('0x45')]({'where':{'id':_0x2f84d3['params']['id']}})['then'](handleEntityNotFound(_0x30d7de,null))['then'](removeEntity(_0x30d7de,null))['catch'](handleError(_0x30d7de,null));};
\ No newline at end of file
index b0a1a69..e5c3371 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x544f=['request-promise','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','api','moment','bluebird'];(function(_0x141405,_0x163915){var _0x1f7622=function(_0x51b7b0){while(--_0x51b7b0){_0x141405['push'](_0x141405['shift']());}};_0x1f7622(++_0x163915);}(_0x544f,0x14c));var _0xf544=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x544f[_0x580647];return _0x5f0792;};'use strict';var _=require(_0xf544('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf544('0x1'));var moment=require(_0xf544('0x2'));var BPromise=require(_0xf544('0x3'));var rp=require(_0xf544('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf544('0x5'));var config=require(_0xf544('0x6'));var attributes=require('./smsApplication.attributes');module[_0xf544('0x7')]=function(_0x44eeec,_0x48029d){return _0x44eeec[_0xf544('0x8')](_0xf544('0x9'),attributes,{'tableName':_0xf544('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf544('0xb')});};
\ No newline at end of file
+var _0xbb1c=['rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0xe480f0,_0x4c0dc1){var _0x57b198=function(_0x4d8304){while(--_0x4d8304){_0xe480f0['push'](_0xe480f0['shift']());}};_0x57b198(++_0x4c0dc1);}(_0xbb1c,0x199));var _0xcbb1=function(_0x48fd93,_0x44c6d0){_0x48fd93=_0x48fd93-0x0;var _0x17077c=_0xbb1c[_0x48fd93];return _0x17077c;};'use strict';var _=require(_0xcbb1('0x0'));var util=require(_0xcbb1('0x1'));var logger=require(_0xcbb1('0x2'))(_0xcbb1('0x3'));var moment=require(_0xcbb1('0x4'));var BPromise=require('bluebird');var rp=require(_0xcbb1('0x5'));var fs=require('fs');var path=require(_0xcbb1('0x6'));var rimraf=require(_0xcbb1('0x7'));var config=require(_0xcbb1('0x8'));var attributes=require(_0xcbb1('0x9'));module[_0xcbb1('0xa')]=function(_0x230d01,_0x596cfe){return _0x230d01[_0xcbb1('0xb')](_0xcbb1('0xc'),attributes,{'tableName':_0xcbb1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcbb1('0xe'),'collate':_0xcbb1('0xf')});};
\ No newline at end of file
index 068b03a..b20748a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2a07=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x317e67,_0x3ed7e1){var _0x218af5=function(_0x4feab7){while(--_0x4feab7){_0x317e67['push'](_0x317e67['shift']());}};_0x218af5(++_0x3ed7e1);}(_0x2a07,0x74));var _0x72a0=function(_0xd32fba,_0xa2dc58){_0xd32fba=_0xd32fba-0x0;var _0x343833=_0x2a07[_0xd32fba];return _0x343833;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193e3b,_0x287b06,_0x21c819){return new BPromise(function(_0x2c04eb,_0x22270e){return client[_0x72a0('0xd')](_0x193e3b,_0x21c819)[_0x72a0('0xe')](function(_0x2bc45b){logger['info'](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));logger['debug'](_0x72a0('0x11'),_0x287b06,_0x72a0('0x10'),JSON[_0x72a0('0x12')](_0x2bc45b));if(_0x2bc45b[_0x72a0('0x13')]){if(_0x2bc45b[_0x72a0('0x13')]['code']===0x1f4){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);return _0x22270e(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}logger[_0x72a0('0x13')]('SmsApplication,\x20%s,\x20%s',_0x287b06,_0x2bc45b['error'][_0x72a0('0x14')]);return _0x2c04eb(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}else{logger[_0x72a0('0x15')](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));_0x2c04eb(_0x2bc45b['result'][_0x72a0('0x14')]);}})[_0x72a0('0x16')](function(_0x16ac70){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x16ac70);_0x22270e(_0x16ac70);});});}
\ No newline at end of file
+var _0xbb61=['stringify','error','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x5f1219,_0x48c529){var _0x46d473=function(_0x22355e){while(--_0x22355e){_0x5f1219['push'](_0x5f1219['shift']());}};_0x46d473(++_0x48c529);}(_0xbb61,0x131));var _0x1bb6=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0xbb61[_0x2f5a22];return _0x326b70;};'use strict';var _=require(_0x1bb6('0x0'));var util=require('util');var moment=require(_0x1bb6('0x1'));var BPromise=require(_0x1bb6('0x2'));var rs=require(_0x1bb6('0x3'));var fs=require('fs');var Redis=require(_0x1bb6('0x4'));var db=require(_0x1bb6('0x5'))['db'];var utils=require(_0x1bb6('0x6'));var logger=require(_0x1bb6('0x7'))('rpc');var config=require(_0x1bb6('0x8'));var jayson=require(_0x1bb6('0x9'));var client=jayson[_0x1bb6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x362383,_0x4629d0,_0x24d6b9){return new BPromise(function(_0x59a152,_0x13e2da){return client[_0x1bb6('0xb')](_0x362383,_0x24d6b9)[_0x1bb6('0xc')](function(_0xe56199){logger[_0x1bb6('0xd')](_0x1bb6('0xe'),_0x4629d0,'request\x20sent');logger[_0x1bb6('0xf')](_0x1bb6('0x10'),_0x4629d0,'request\x20sent',JSON[_0x1bb6('0x11')](_0xe56199));if(_0xe56199['error']){if(_0xe56199['error']['code']===0x1f4){logger['error'](_0x1bb6('0xe'),_0x4629d0,_0xe56199[_0x1bb6('0x12')]['message']);return _0x13e2da(_0xe56199['error'][_0x1bb6('0x13')]);}logger[_0x1bb6('0x12')](_0x1bb6('0xe'),_0x4629d0,_0xe56199[_0x1bb6('0x12')][_0x1bb6('0x13')]);return _0x59a152(_0xe56199[_0x1bb6('0x12')][_0x1bb6('0x13')]);}else{logger[_0x1bb6('0xd')]('SmsApplication,\x20%s,\x20%s',_0x4629d0,_0x1bb6('0x14'));_0x59a152(_0xe56199[_0x1bb6('0x15')][_0x1bb6('0x13')]);}})[_0x1bb6('0x16')](function(_0x583711){logger['error'](_0x1bb6('0xe'),_0x4629d0,_0x583711);_0x13e2da(_0x583711);});});}
\ No newline at end of file
index 1dca925..ba8df15 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x13f6=['isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller'];(function(_0x3a5999,_0x4ee95c){var _0x1027ac=function(_0x333beb){while(--_0x333beb){_0x3a5999['push'](_0x3a5999['shift']());}};_0x1027ac(++_0x4ee95c);}(_0x13f6,0x124));var _0x613f=function(_0x5f18cd,_0x4b6ce0){_0x5f18cd=_0x5f18cd-0x0;var _0xe0b2a7=_0x13f6[_0x5f18cd];return _0xe0b2a7;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x613f('0xa')](_0x613f('0xb'),auth[_0x613f('0x8')](),controller[_0x613f('0xc')]);router['get'](_0x613f('0xd'),auth[_0x613f('0x8')](),controller[_0x613f('0xe')]);router['get'](_0x613f('0xf'),auth[_0x613f('0x8')](),controller[_0x613f('0x10')]);router['post']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x11')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x613f('0x12')]);router[_0x613f('0x13')](_0x613f('0x14'),auth[_0x613f('0x8')](),interaction[_0x613f('0x15')](_0x613f('0x16'),_0x613f('0x17')),controller[_0x613f('0x18')]);router[_0x613f('0x19')](_0x613f('0xb'),auth['isAuthenticated'](),interaction[_0x613f('0x15')]('sms','smsinteraction:update'),controller[_0x613f('0x1a')]);router[_0x613f('0x1b')]('/:id',auth[_0x613f('0x8')](),interaction['tracked'](_0x613f('0x16'),_0x613f('0x1c')),controller[_0x613f('0x1d')]);router[_0x613f('0x1b')](_0x613f('0x14'),auth[_0x613f('0x8')](),controller['removeTags']);module['exports']=router;
\ No newline at end of file
+var _0x4213=['download','post','create','/:id/messages','addMessage','/:id/tags','tracked','smsinteraction:addtags','put','smsinteraction:update','update','sms','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4213,0x77));var _0x3421=function(_0x4f752c,_0x4922f8){_0x4f752c=_0x4f752c-0x0;var _0x18031d=_0x4213[_0x4f752c];return _0x18031d;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var fs_extra=require(_0x3421('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3421('0x7'));var config=require('../../config/environment');var controller=require(_0x3421('0x8'));router[_0x3421('0x9')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0xb')]);router['get'](_0x3421('0xc'),auth[_0x3421('0xa')](),controller[_0x3421('0xd')]);router[_0x3421('0x9')](_0x3421('0xe'),auth['isAuthenticated'](),controller[_0x3421('0xf')]);router['get']('/:id/messages',auth[_0x3421('0xa')](),controller['getMessages']);router[_0x3421('0x9')](_0x3421('0x10'),auth[_0x3421('0xa')](),controller[_0x3421('0x11')]);router[_0x3421('0x12')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0x13')]);router['post'](_0x3421('0x14'),auth[_0x3421('0xa')](),controller[_0x3421('0x15')]);router[_0x3421('0x12')](_0x3421('0x16'),auth[_0x3421('0xa')](),interaction[_0x3421('0x17')]('sms',_0x3421('0x18')),controller['addTags']);router[_0x3421('0x19')](_0x3421('0xe'),auth['isAuthenticated'](),interaction[_0x3421('0x17')]('sms',_0x3421('0x1a')),controller[_0x3421('0x1b')]);router['delete'](_0x3421('0xe'),auth[_0x3421('0xa')](),interaction[_0x3421('0x17')](_0x3421('0x1c'),_0x3421('0x1d')),controller[_0x3421('0x1e')]);router[_0x3421('0x1f')](_0x3421('0x16'),auth[_0x3421('0xa')](),controller[_0x3421('0x20')]);module[_0x3421('0x21')]=router;
\ No newline at end of file
index 052153a..2088ec7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x92e0=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x364a36,_0x1e2677){var _0x5cd6fa=function(_0x58d692){while(--_0x58d692){_0x364a36['push'](_0x364a36['shift']());}};_0x5cd6fa(++_0x1e2677);}(_0x92e0,0x154));var _0x092e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92e0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x092e('0x0'));var moment=require('moment');module[_0x092e('0x1')]={'closed':{'type':Sequelize[_0x092e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x092e('0x3')]},'disposition':{'type':Sequelize[_0x092e('0x4')]},'secondDisposition':{'type':Sequelize[_0x092e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x092e('0x4')]},'note':{'type':Sequelize[_0x092e('0x4')]},'phone':{'type':Sequelize[_0x092e('0x4')]},'read1stAt':{'type':Sequelize[_0x092e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x092e('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x092e('0x5')]('in',_0x092e('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x092e('0x2')],'defaultValue':![]}};
\ No newline at end of file
+var _0xd8fb=['out','sequelize','moment','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x380f9a,_0x131c81){var _0x2a2f30=function(_0x1ba61b){while(--_0x1ba61b){_0x380f9a['push'](_0x380f9a['shift']());}};_0x2a2f30(++_0x131c81);}(_0xd8fb,0x99));var _0xbd8f=function(_0xf3c525,_0x412fb0){_0xf3c525=_0xf3c525-0x0;var _0x9afcdc=_0xd8fb[_0xf3c525];return _0x9afcdc;};'use strict';var Sequelize=require(_0xbd8f('0x0'));var moment=require(_0xbd8f('0x1'));module[_0xbd8f('0x2')]={'closed':{'type':Sequelize[_0xbd8f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xbd8f('0x4')]},'note':{'type':Sequelize[_0xbd8f('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xbd8f('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xbd8f('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbd8f('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbd8f('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
index 78eaf52..632c837 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc045=['forEach','push','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','SmsInteraction','rawAttributes','key','query','keys','model','intersection','fields','attributes','length','nolimit','order','sort','where','filters','field','color','tools_tags','u.fullname','ui.SmsInteractionId','from','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','operator','$substring','value','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','text','start','body','compact','isEmpty','i.SmsAccountId\x20IN\x20?','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','keyBy','merge','unreadMessages','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','toString','ui.SmsInteractionId\x20IN\x20?','groupBy','all','rows','show','params','include','options','create','describe','addMessage','SmsMessage','findOne','pick','SmsInteractionId','filter','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','omit','ids','spread','Tag','smsInteractionTags:save','removeTags','download','unix','join','server','tmp','root','transcript-%d-%s.zip','firstName','lastName','Messages','direction','secret','Account','Owner','get','mkdirSync','N.A.','disposition','out','System','Contact','renderFile','views','transcript-','Sms','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./smsInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xc045,0x19a));var _0x5c04=function(_0x5b71cb,_0x5d3de5){_0x5b71cb=_0x5b71cb-0x0;var _0x7b0184=_0xc045[_0x5b71cb];return _0x7b0184;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c04('0x0'));var zipdir=require(_0x5c04('0x1'));var jsonpatch=require(_0x5c04('0x2'));var rp=require(_0x5c04('0x3'));var moment=require(_0x5c04('0x4'));var BPromise=require(_0x5c04('0x5'));var Mustache=require(_0x5c04('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5c04('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c04('0x8'));var _=require(_0x5c04('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5c04('0xa'));var toCsv=require(_0x5c04('0xb'));var querystring=require(_0x5c04('0xc'));var Papa=require(_0x5c04('0xd'));var Redis=require(_0x5c04('0xe'));var authService=require(_0x5c04('0xf'));var qs=require(_0x5c04('0x10'));var as=require(_0x5c04('0x11'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x5c04('0x12'));var logger=require('../../config/logger')(_0x5c04('0x13'));var utils=require(_0x5c04('0x14'));var config=require(_0x5c04('0x15'));var licenseUtil=require(_0x5c04('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x5c04('0x17')],{'host':_0x5c04('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5c04('0x19'))[_0x5c04('0x1a')](socket);function respondWithStatusCode(_0x439891,_0x1279fb){_0x1279fb=_0x1279fb||0xcc;return function(_0x6f2d77){if(_0x6f2d77){return _0x439891[_0x5c04('0x1b')](_0x1279fb);}return _0x439891['status'](_0x1279fb)[_0x5c04('0x1c')]();};}function respondWithResult(_0x1c18de,_0x1e4c1a){_0x1e4c1a=_0x1e4c1a||0xc8;return function(_0x2d5476){if(_0x2d5476){return _0x1c18de[_0x5c04('0x1d')](_0x1e4c1a)[_0x5c04('0x1e')](_0x2d5476);}};}function respondWithFilteredResult(_0x19d67e,_0x4c1572){return function(_0x569dca){if(_0x569dca){var _0x561fc1=typeof _0x4c1572[_0x5c04('0x1f')]===_0x5c04('0x20')&&typeof _0x4c1572[_0x5c04('0x21')]===_0x5c04('0x20');var _0x38e865=_0x569dca[_0x5c04('0x22')];var _0x3bf053=_0x561fc1?0x0:_0x4c1572[_0x5c04('0x1f')];var _0x1b6859=_0x561fc1?_0x569dca[_0x5c04('0x22')]:_0x4c1572[_0x5c04('0x1f')]+_0x4c1572[_0x5c04('0x21')];var _0xaddf6;if(_0x1b6859>=_0x38e865){_0x1b6859=_0x38e865;_0xaddf6=0xc8;}else{_0xaddf6=0xce;}_0x19d67e['status'](_0xaddf6);return _0x19d67e[_0x5c04('0x23')](_0x5c04('0x24'),_0x3bf053+'-'+_0x1b6859+'/'+_0x38e865)[_0x5c04('0x1e')](_0x569dca);}return null;};}function patchUpdates(_0x40fd60){return function(_0x365aa3){try{jsonpatch[_0x5c04('0x25')](_0x365aa3,_0x40fd60,!![]);}catch(_0x2317d2){return BPromise[_0x5c04('0x26')](_0x2317d2);}return _0x365aa3['save']();};}function saveUpdates(_0x3f1712,_0x159295){return function(_0xbe3799){if(_0xbe3799){return _0xbe3799[_0x5c04('0x27')](_0x3f1712)[_0x5c04('0x28')](function(_0x2fa43f){return _0x2fa43f;});}return null;};}function removeEntity(_0x5a6c61,_0x5286fb){return function(_0x602a0){if(_0x602a0){return _0x602a0[_0x5c04('0x29')]()[_0x5c04('0x28')](function(){_0x5a6c61['status'](0xcc)[_0x5c04('0x1c')]();});}};}function handleEntityNotFound(_0x1787df,_0x3351e8){return function(_0x46e387){if(!_0x46e387){_0x1787df[_0x5c04('0x1b')](0x194);}return _0x46e387;};}function handleError(_0x68b3e9,_0x49a51a){_0x49a51a=_0x49a51a||0x1f4;return function(_0x487853){logger['error'](_0x487853[_0x5c04('0x2a')]);if(_0x487853[_0x5c04('0x2b')]){delete _0x487853['name'];}_0x68b3e9['status'](_0x49a51a)[_0x5c04('0x2c')](_0x487853);};}function getInteractionUsers(_0x5d3e1d,_0xfc7850){return new BPromise(function(_0x40a104,_0x5698d0){try{if(_0xfc7850[_0x5d3e1d['id']]){_0x5d3e1d[_0x5c04('0x2d')]=_[_0x5c04('0x2e')](_0xfc7850[_0x5d3e1d['id']],function(_0x2e1992){return{'id':_0x2e1992['id'],'fullname':_0x2e1992[_0x5c04('0x2f')]};});}}catch(_0x5e73ce){_0x5698d0(_0x5e73ce);}_0x40a104(_0x5d3e1d);});}function getInteractionTags(_0x27353a,_0x1b25db){return new BPromise(function(_0x4b574a,_0x42b5aa){try{if(_0x27353a[_0x5c04('0x30')]){_0x27353a[_0x5c04('0x31')]=[];_0x27353a[_0x5c04('0x30')]['split'](',')[_0x5c04('0x32')](function(_0x3d6696){_0x27353a[_0x5c04('0x31')][_0x5c04('0x33')](_0x1b25db[_0x3d6696]);});}delete _0x27353a['TagIds'];}catch(_0x29b68f){_0x42b5aa(_0x29b68f);}_0x4b574a(_0x27353a);});}function updateSmsInteraction(_0xff5fa6,_0x3fcd17,_0x3b0c2f){return new BPromise(function(_0x2382a4,_0xa25bf7){return getInteractionUsers(_0xff5fa6,_0x3b0c2f)[_0x5c04('0x28')](function(_0x15d375){return getInteractionTags(_0x15d375,_0x3fcd17);})[_0x5c04('0x28')](function(_0x16ee70){return getStateInteraction(_0x16ee70);})[_0x5c04('0x28')](function(_0x2a471a){_0x2382a4(_0x2a471a);})[_0x5c04('0x34')](function(_0x2c69d2){_0xa25bf7(_0x2c69d2);});});}function getStateInteraction(_0x93913f){return new BPromise(function(_0x494d0a){_0x93913f[_0x5c04('0x35')]=0x0;_0x93913f[_0x5c04('0x36')]=0x0;_0x93913f[_0x5c04('0x37')]=0x0;_0x93913f['unmanaged']=0x0;_0x93913f[_0x5c04('0x38')]=0x0;if(!_0x93913f[_0x5c04('0x39')]&&!_0x93913f[_0x5c04('0x3a')]){_0x93913f[_0x5c04('0x35')]+=0x1;}if(!_0x93913f[_0x5c04('0x39')]&&_0x93913f[_0x5c04('0x3a')]){_0x93913f[_0x5c04('0x36')]+=0x1;if(_0x93913f['waiting']){_0x93913f['waiting']-=0x1;}}if(_0x93913f[_0x5c04('0x39')]&&_0x93913f[_0x5c04('0x3a')]){_0x93913f[_0x5c04('0x37')]+=0x1;if(_0x93913f[_0x5c04('0x36')]){_0x93913f[_0x5c04('0x36')]-=0x1;}}if(_0x93913f[_0x5c04('0x39')]&&!_0x93913f[_0x5c04('0x3a')]){_0x93913f[_0x5c04('0x3b')]+=0x1;if(_0x93913f['waiting']){_0x93913f['waiting']-=0x1;}}_0x93913f['total']+=0x1;_0x494d0a(_0x93913f);});}exports[_0x5c04('0x3c')]=function(_0x16ffcd,_0x5800a1){var _0x512f04={},_0x4e7cef={},_0x2df70c={'count':0x0,'rows':[]};var _0x36aebf=_['map'](db[_0x5c04('0x3d')][_0x5c04('0x3e')],function(_0xbbdfbe){return{'name':_0xbbdfbe['fieldName'],'type':_0xbbdfbe['type'][_0x5c04('0x3f')]};});_0x4e7cef['model']=_[_0x5c04('0x2e')](_0x36aebf,'name');_0x4e7cef[_0x5c04('0x40')]=_[_0x5c04('0x41')](_0x16ffcd[_0x5c04('0x40')]);_0x4e7cef['filters']=_['intersection'](_0x4e7cef[_0x5c04('0x42')],_0x4e7cef[_0x5c04('0x40')]);_0x512f04['attributes']=_[_0x5c04('0x43')](_0x4e7cef[_0x5c04('0x42')],qs[_0x5c04('0x44')](_0x16ffcd[_0x5c04('0x40')]['fields']));_0x512f04[_0x5c04('0x45')]=_0x512f04['attributes'][_0x5c04('0x46')]?_0x512f04[_0x5c04('0x45')]:_0x4e7cef[_0x5c04('0x42')];if(!_0x16ffcd[_0x5c04('0x40')]['hasOwnProperty'](_0x5c04('0x47'))){_0x512f04[_0x5c04('0x21')]=qs[_0x5c04('0x21')](_0x16ffcd['query'][_0x5c04('0x21')]);_0x512f04[_0x5c04('0x1f')]=qs[_0x5c04('0x1f')](_0x16ffcd['query'][_0x5c04('0x1f')]);}_0x512f04[_0x5c04('0x48')]=qs[_0x5c04('0x49')](_0x16ffcd[_0x5c04('0x40')][_0x5c04('0x49')]);_0x512f04[_0x5c04('0x4a')]=qs[_0x5c04('0x4b')](_['pick'](_0x16ffcd[_0x5c04('0x40')],_0x4e7cef['filters']),_0x36aebf);var _0x47d3b3=[];var _0x4df88e=squel['select']()['field']('id')[_0x5c04('0x4c')](_0x5c04('0x2b'))[_0x5c04('0x4c')](_0x5c04('0x4d'))['from'](_0x5c04('0x4e'));var _0x5d8d98=squel['select']()[_0x5c04('0x4c')]('u.id')[_0x5c04('0x4c')](_0x5c04('0x4f'))['field'](_0x5c04('0x50'))[_0x5c04('0x51')]('user_has_sms_interactions','ui')[_0x5c04('0x52')](_0x5c04('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x48765e=squel['select']()[_0x5c04('0x51')](_0x5c04('0x54'),'i')[_0x5c04('0x52')](_0x5c04('0x55'),'c',_0x5c04('0x56'))[_0x5c04('0x52')]('users','o',_0x5c04('0x57'))[_0x5c04('0x52')]('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0x5c04('0x52')]('sms_messages','me',_0x5c04('0x58'))[_0x5c04('0x52')](_0x5c04('0x59'),'it',_0x5c04('0x5a'))['left_join']('tools_tags','t',_0x5c04('0x5b'));var _0x3984de=squel[_0x5c04('0x5c')]();var _0x580187=[];var _0x4af229=squel[_0x5c04('0x5c')]();var _0x1096e1;if(_0x16ffcd[_0x5c04('0x40')][_0x5c04('0x5d')]){_0x1096e1=as[_0x5c04('0x5e')](_0x16ffcd[_0x5c04('0x40')]['search']);var _0x17c6f3=_0x1096e1[_0x5c04('0x5f')];for(var _0x5b18de=0x0;_0x5b18de<_0x1096e1[_0x5c04('0x60')]['length'];_0x5b18de++){var _0x1523be=_0x1096e1[_0x5c04('0x60')][_0x5b18de];var _0x47fb16='i';var _0x229bca=_[_0x5c04('0x61')](_0x36aebf,[_0x5c04('0x2b'),_0x1523be[_0x5c04('0x4c')]]);if(!_0x229bca){switch(_0x1523be['field']){case'unreadMessages':if(_0x1523be['value']==0x1){_0x48765e[_0x5c04('0x62')]('`'+_0x1523be[_0x5c04('0x4c')]+_0x5c04('0x63'));}else{_0x48765e[_0x5c04('0x62')]('`'+_0x1523be[_0x5c04('0x4c')]+_0x5c04('0x64'));}break;case'Contact':if(_0x1523be[_0x5c04('0x65')]===_0x5c04('0x66')){if(_0x1523be[_0x5c04('0x67')][_0x5c04('0x68')]('\x20')['length']>0x1){_0x3984de[_0x17c6f3]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1523be['value']),null);}else{var _0x15b0e4='%'+_0x1523be[_0x5c04('0x67')]+'%';_0x3984de[_0x17c6f3](_0x5c04('0x69'),_0x15b0e4,_0x15b0e4,_0x15b0e4);}}else{_0x229bca=_[_0x5c04('0x61')](_0x36aebf,['name','ContactId']);_0x1523be[_0x5c04('0x4c')]=_0x5c04('0x6a');_0x185026=as[_0x5c04('0x6b')](_0x47fb16,_0x229bca['type'],_0x1523be);_0x3984de[_0x17c6f3](_0x185026['text'],_0x185026[_0x5c04('0x67')]['start'],_0x185026[_0x5c04('0x67')][_0x5c04('0x1c')]);}break;case'Tag':var _0x96b4b3=_0x1523be[_0x5c04('0x67')][_0x5c04('0x68')](',')[_0x5c04('0x2e')](function(_0x1e2598){return Number(_0x1e2598);});_0x96b4b3[_0x5c04('0x32')](function(_0x1fc8bf){_0x4af229['or'](_0x5c04('0x6c'),'%,'+_0x1fc8bf+',%');});_0x580187=_[_0x5c04('0x6d')](_0x580187,_0x96b4b3);break;case _0x5c04('0x6e'):if(_0x1523be[_0x5c04('0x65')]===_0x5c04('0x66')){_0x3984de[_0x17c6f3](_0x5c04('0x6f'),'%'+_0x1523be[_0x5c04('0x67')]+'%',null);}else{_0x229bca=_[_0x5c04('0x61')](_0x36aebf,[_0x5c04('0x2b'),_0x5c04('0x3a')]);_0x1523be[_0x5c04('0x4c')]=_0x5c04('0x3a');_0x185026=as[_0x5c04('0x6b')](_0x47fb16,_0x229bca[_0x5c04('0x70')],_0x1523be);_0x3984de[_0x17c6f3](_0x185026[_0x5c04('0x71')],_0x185026[_0x5c04('0x67')][_0x5c04('0x72')],_0x185026[_0x5c04('0x67')]['end']);}break;case _0x5c04('0x73'):_0x185026=as[_0x5c04('0x6b')]('me',null,_0x1523be);_0x3984de[_0x17c6f3](_0x185026['text'],_0x185026[_0x5c04('0x67')][_0x5c04('0x72')],_0x185026[_0x5c04('0x67')][_0x5c04('0x1c')]);break;}}else{var _0x185026=as['buildExpression'](_0x47fb16,_0x229bca['type'],_0x1523be);_0x3984de[_0x17c6f3](_0x185026['text'],_0x185026[_0x5c04('0x67')][_0x5c04('0x72')],_0x185026[_0x5c04('0x67')][_0x5c04('0x1c')]);}}}else{var _0x4d0e17=_(_0x16ffcd[_0x5c04('0x40')])[_0x5c04('0x41')]()[_0x5c04('0x2e')](function(_0x489a0e){return _['some'](_0x36aebf,[_0x5c04('0x2b'),_0x489a0e])?_0x489a0e:undefined;})[_0x5c04('0x74')]()[_0x5c04('0x67')]();if(!_[_0x5c04('0x75')](_0x4d0e17)){_0x4d0e17['forEach'](function(_0x35b0da){if(_0x35b0da==='SmsAccountId'){_0x48765e[_0x5c04('0x4a')](_0x5c04('0x76'),[]['concat'](_0x16ffcd['query'][_0x35b0da]));}else if(_0x35b0da===_0x5c04('0x77')){var _0x5f324a=JSON['parse'](_0x16ffcd[_0x5c04('0x40')][_0x35b0da])[_0x5c04('0x78')];var _0x552073=JSON[_0x5c04('0x79')](_0x16ffcd[_0x5c04('0x40')][_0x35b0da])[_0x5c04('0x7a')];_0x48765e[_0x5c04('0x4a')](_0x5c04('0x7b'),_0x5f324a,_0x552073);}else{if(_0x16ffcd['query'][_0x35b0da]===_0x5c04('0x7c')){_0x48765e[_0x5c04('0x4a')]('i.'+_0x35b0da+_0x5c04('0x7d'));}else{_0x48765e['where']('i.'+_0x35b0da+_0x5c04('0x7e'),_0x16ffcd['query'][_0x35b0da]);}}});}if(_0x16ffcd[_0x5c04('0x40')][_0x5c04('0x7f')]){if(_0x16ffcd[_0x5c04('0x40')][_0x5c04('0x7f')]==0x1){_0x48765e[_0x5c04('0x62')](_0x5c04('0x80'));}else{_0x48765e[_0x5c04('0x62')]('`unreadMessages`\x20>\x200');}}if(_0x16ffcd['query'][_0x5c04('0x81')]){_0x580187=_[_0x5c04('0x82')](_0x16ffcd[_0x5c04('0x40')][_0x5c04('0x81')])?_0x16ffcd[_0x5c04('0x40')][_0x5c04('0x81')]:new Array(_0x16ffcd[_0x5c04('0x40')][_0x5c04('0x81')]);_0x580187[_0x5c04('0x32')](function(_0x300400){_0x4af229['or'](_0x5c04('0x6c'),'%,'+_0x300400+',%');});}if(_0x16ffcd[_0x5c04('0x40')]['filter']){var _0x2d4957=_0x16ffcd[_0x5c04('0x40')]['filter'][_0x5c04('0x83')]('\x5c','\x5c\x5c')[_0x5c04('0x83')](/'/g,'\x27\x27');if(qs[_0x5c04('0x84')](_0x2d4957)){_0x3984de['or'](_0x5c04('0x85'),_0x2d4957+'%')['or']('i.phone\x20LIKE\x20?',_0x2d4957+'%');}else{_0x3984de['or'](_0x5c04('0x86'),qs[_0x5c04('0x87')](_0x2d4957))['or'](_0x5c04('0x88'),_0x2d4957+'%');}}}_0x48765e[_0x5c04('0x4a')](_0x3984de);_0x48765e[_0x5c04('0x89')](_0x5c04('0x8a'));var _0x28a161={'type':db[_0x5c04('0x8b')][_0x5c04('0x8c')][_0x5c04('0x8d')],'raw':!![]};var _0x593737=_0x48765e[_0x5c04('0x8e')]();_0x593737[_0x5c04('0x4c')](_0x5c04('0x8a'));_0x593737[_0x5c04('0x4c')](_0x5c04('0x8f'),'unreadMessages');if(_0x512f04[_0x5c04('0x48')]){_0x512f04['order'][_0x5c04('0x32')](function(_0x53f9f8){var _0x311f44=_0x53f9f8[0x0]===_0x5c04('0x90')?_0x53f9f8[0x0]:'i.'+_0x53f9f8[0x0];_0x48765e[_0x5c04('0x48')](_0x311f44,_0x53f9f8[0x1]===_0x5c04('0x91')?![]:!![]);});}if(!_[_0x5c04('0x75')](_0x580187)){_0x48765e['having'](_0x4af229);_0x593737[_0x5c04('0x4a')](_0x5c04('0x92'),_0x580187);}BPromise['resolve']()[_0x5c04('0x28')](function(){if(!_0x1096e1){if(_0x16ffcd[_0x5c04('0x40')][_0x5c04('0x93')])return;_0x593737['where'](_0x5c04('0x94'));_0x48765e[_0x5c04('0x4a')](_0x5c04('0x94'));return;}if(_0x16ffcd[_0x5c04('0x95')][_0x5c04('0x96')]!==_0x5c04('0x97'))return;return _0x16ffcd['user'][_0x5c04('0x98')]({'attributes':['id'],'raw':!![]})[_0x5c04('0x28')](function(_0x12ec6d){if(_['isEmpty'](_0x12ec6d)){_0x593737[_0x5c04('0x4a')](_0x5c04('0x99'));_0x48765e[_0x5c04('0x4a')](_0x5c04('0x99'));}else{_0x593737[_0x5c04('0x4a')](_0x5c04('0x76'),_['map'](_0x12ec6d,'id'));_0x48765e[_0x5c04('0x4a')]('i.SmsAccountId\x20IN\x20?',_[_0x5c04('0x2e')](_0x12ec6d,'id'));}});})[_0x5c04('0x28')](function(){if(_0x16ffcd[_0x5c04('0x95')][_0x5c04('0x96')]===_0x5c04('0x97')&&!_0x1096e1&&!_0x16ffcd[_0x5c04('0x40')][_0x5c04('0x93')])return[];return db['sequelize']['query'](_0x593737['toString'](),_0x28a161);})[_0x5c04('0x28')](function(_0x2d3850){_0x2df70c[_0x5c04('0x22')]=_0x2d3850[_0x5c04('0x46')];if(_0x2df70c[_0x5c04('0x22')]===0x0)return[];return db['sequelize']['query'](_0x4df88e['toString'](),_0x28a161)[_0x5c04('0x28')](function(_0x3c0771){_0x47d3b3=_[_0x5c04('0x9a')](_0x3c0771,'id');_0x28a161=_[_0x5c04('0x9b')](_0x28a161,{'model':db[_0x5c04('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x16ffcd['query']['fields']){_0x512f04[_0x5c04('0x45')][_0x5c04('0x32')](function(_0x1014e8){_0x48765e[_0x5c04('0x4c')]('i.'+_0x1014e8);});}else{_0x48765e[_0x5c04('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5c04('0x9c'));_0x48765e[_0x5c04('0x4c')]('a.key',_0x5c04('0x9d'));_0x48765e[_0x5c04('0x4c')](_0x5c04('0x9e'),_0x5c04('0x9f'));_0x48765e['field'](_0x5c04('0xa0'),_0x5c04('0x90'));_0x48765e[_0x5c04('0x4c')](_0x5c04('0xa1'));_0x48765e[_0x5c04('0x4c')]('c.firstName','Contact.firstName');_0x48765e['field'](_0x5c04('0xa2'),_0x5c04('0xa3'));_0x48765e[_0x5c04('0x4c')]('c.email',_0x5c04('0xa4'));_0x48765e[_0x5c04('0x4c')](_0x5c04('0xa5'),_0x5c04('0xa6'));_0x48765e[_0x5c04('0x4c')](_0x5c04('0xa7'),'Contact.mobile');_0x48765e['field']('c.fax',_0x5c04('0xa8'));_0x48765e[_0x5c04('0x4c')]('o.fullname',_0x5c04('0xa9'));_0x48765e[_0x5c04('0x4c')](_0x5c04('0xaa'),'Owner.internal');_0x48765e[_0x5c04('0x4c')](_0x5c04('0xab'),_0x5c04('0x30'));}if(_0x512f04[_0x5c04('0x21')])_0x48765e['limit'](_0x512f04[_0x5c04('0x21')]);if(_0x512f04[_0x5c04('0x1f')])_0x48765e[_0x5c04('0x1f')](_0x512f04[_0x5c04('0x1f')]);return db[_0x5c04('0xac')]['query'](_0x48765e[_0x5c04('0xad')](),_0x28a161);})[_0x5c04('0x28')](function(_0x200be6){if(_0x200be6[_0x5c04('0x46')]>0x0)_0x5d8d98['where'](_0x5c04('0xae'),_[_0x5c04('0x2e')](_0x200be6,'id'));return db[_0x5c04('0xac')][_0x5c04('0x40')](_0x5d8d98[_0x5c04('0xad')](),_0x28a161)['then'](function(_0x25227e){var _0x2a0386=_[_0x5c04('0xaf')](_0x25227e,'SmsInteractionId');var _0x5dec33=[];_0x200be6['forEach'](function(_0x1bbc2a){_0x5dec33[_0x5c04('0x33')](updateSmsInteraction(_0x1bbc2a,_0x47d3b3,_0x2a0386));});return BPromise[_0x5c04('0xb0')](_0x5dec33);});});})[_0x5c04('0x28')](function(_0x3a4247){_0x2df70c[_0x5c04('0xb1')]=_0x3a4247;return _0x2df70c;})[_0x5c04('0x28')](respondWithFilteredResult(_0x5800a1,_0x512f04))[_0x5c04('0x34')](handleError(_0x5800a1,null));};exports[_0x5c04('0xb2')]=function(_0x19f1e1,_0x16d0ca){var _0x80cfac={'raw':![],'where':{'id':_0x19f1e1[_0x5c04('0xb3')]['id']}},_0x512828={};_0x512828[_0x5c04('0x42')]=_[_0x5c04('0x41')](db[_0x5c04('0x3d')][_0x5c04('0x3e')]);_0x512828[_0x5c04('0x40')]=_[_0x5c04('0x41')](_0x19f1e1[_0x5c04('0x40')]);_0x512828['filters']=_[_0x5c04('0x43')](_0x512828[_0x5c04('0x42')],_0x512828[_0x5c04('0x40')]);_0x80cfac[_0x5c04('0x45')]=_[_0x5c04('0x43')](_0x512828[_0x5c04('0x42')],qs[_0x5c04('0x44')](_0x19f1e1['query'][_0x5c04('0x44')]));_0x80cfac[_0x5c04('0x45')]=_0x80cfac[_0x5c04('0x45')][_0x5c04('0x46')]?_0x80cfac[_0x5c04('0x45')]:_0x512828['model'];if(_0x19f1e1['query']['includeAll']){_0x80cfac[_0x5c04('0xb4')]=[{'all':!![]}];}_0x80cfac=_['merge']({},_0x80cfac,_0x19f1e1[_0x5c04('0xb5')]);return db[_0x5c04('0x3d')]['find'](_0x80cfac)['then'](handleEntityNotFound(_0x16d0ca,null))[_0x5c04('0x28')](respondWithResult(_0x16d0ca,null))['catch'](handleError(_0x16d0ca,null));};exports['create']=function(_0x478677,_0x1ece4c){return db[_0x5c04('0x3d')][_0x5c04('0xb6')](_0x478677[_0x5c04('0x73')],{})[_0x5c04('0x28')](respondWithResult(_0x1ece4c,0xc9))['catch'](handleError(_0x1ece4c,null));};exports[_0x5c04('0x27')]=function(_0xc36c2c,_0x31b550){if(_0xc36c2c[_0x5c04('0x73')]['id']){delete _0xc36c2c[_0x5c04('0x73')]['id'];}return db[_0x5c04('0x3d')][_0x5c04('0x61')]({'where':{'id':_0xc36c2c[_0x5c04('0xb3')]['id']}})[_0x5c04('0x28')](handleEntityNotFound(_0x31b550,null))['then'](saveUpdates(_0xc36c2c[_0x5c04('0x73')],null))[_0x5c04('0x28')](respondWithResult(_0x31b550,null))[_0x5c04('0x34')](handleError(_0x31b550,null));};exports[_0x5c04('0x29')]=function(_0x4d0ec8,_0x3a696d){return db[_0x5c04('0x3d')][_0x5c04('0x61')]({'where':{'id':_0x4d0ec8[_0x5c04('0xb3')]['id']}})['then'](handleEntityNotFound(_0x3a696d,null))['then'](removeEntity(_0x3a696d,null))[_0x5c04('0x34')](handleError(_0x3a696d,null));};exports['describe']=function(_0x1f12c8,_0x4a823c){return db[_0x5c04('0x3d')][_0x5c04('0xb7')]()[_0x5c04('0x28')](respondWithResult(_0x4a823c,null))[_0x5c04('0x34')](handleError(_0x4a823c,null));};exports[_0x5c04('0xb8')]=function(_0x359b6d,_0x3e136d,_0x87c089){return db[_0x5c04('0xb9')][_0x5c04('0x61')]({'where':{'id':_0x359b6d[_0x5c04('0xb3')]['id']}})[_0x5c04('0x28')](handleEntityNotFound(_0x3e136d,null))[_0x5c04('0x28')](function(_0x5cc900){if(_0x5cc900){return _0x5cc900[_0x5c04('0xb8')](_0x359b6d[_0x5c04('0x73')]['ids'],_['omit'](_0x359b6d[_0x5c04('0x73')],['ids','id'])||{});}})['then'](respondWithResult(_0x3e136d,null))[_0x5c04('0x34')](handleError(_0x3e136d,null));};exports['getMessages']=function(_0x422ee5,_0x3e294d,_0x133326){var _0x353692={'raw':![],'where':{}};var _0x297d69={};var _0xf513ae={'count':0x0,'rows':[]};return db[_0x5c04('0x3d')][_0x5c04('0xba')]({'where':{'id':_0x422ee5[_0x5c04('0xb3')]['id']}})[_0x5c04('0x28')](handleEntityNotFound(_0x3e294d,null))[_0x5c04('0x28')](function(_0x48f942){if(_0x48f942){_0x297d69['model']=_[_0x5c04('0x41')](db[_0x5c04('0xb9')][_0x5c04('0x3e')]);_0x297d69[_0x5c04('0x40')]=_[_0x5c04('0x41')](_0x422ee5[_0x5c04('0x40')]);_0x297d69[_0x5c04('0x4b')]=_['intersection'](_0x297d69[_0x5c04('0x42')],_0x297d69[_0x5c04('0x40')]);_0x353692[_0x5c04('0x45')]=_['intersection'](_0x297d69[_0x5c04('0x42')],qs[_0x5c04('0x44')](_0x422ee5['query'][_0x5c04('0x44')]));_0x353692[_0x5c04('0x45')]=_0x353692[_0x5c04('0x45')][_0x5c04('0x46')]?_0x353692[_0x5c04('0x45')]:_0x297d69[_0x5c04('0x42')];if(!_0x422ee5[_0x5c04('0x40')]['hasOwnProperty'](_0x5c04('0x47'))){_0x353692[_0x5c04('0x21')]=qs[_0x5c04('0x21')](_0x422ee5['query'][_0x5c04('0x21')]);_0x353692[_0x5c04('0x1f')]=qs[_0x5c04('0x1f')](_0x422ee5[_0x5c04('0x40')]['offset']);}_0x353692[_0x5c04('0x48')]=qs[_0x5c04('0x49')](_0x422ee5[_0x5c04('0x40')][_0x5c04('0x49')]);_0x353692['where']=qs[_0x5c04('0x4b')](_[_0x5c04('0xbb')](_0x422ee5[_0x5c04('0x40')],_0x297d69[_0x5c04('0x4b')]));_0x353692[_0x5c04('0x4a')][_0x5c04('0xbc')]=_0x48f942['id'];if(_0x422ee5[_0x5c04('0x40')]['filter']){_0x353692[_0x5c04('0x4a')]=_[_0x5c04('0x9b')](_0x353692[_0x5c04('0x4a')],{'$or':_[_0x5c04('0x2e')](_0x353692[_0x5c04('0x45')],function(_0x43e71f){var _0x282789={};_0x282789[_0x43e71f]={'$like':'%'+_0x422ee5[_0x5c04('0x40')][_0x5c04('0xbd')]+'%'};return _0x282789;})});}if(_0x422ee5[_0x5c04('0x40')]['$gte']){var _0x3a1a89=_0x422ee5[_0x5c04('0x40')][_0x5c04('0x78')][_0x5c04('0x68')](',');var _0x2e1f54={};_0x2e1f54[_0x3a1a89[0x0]]={'$gte':moment(_0x3a1a89[0x1])[_0x5c04('0xbe')](_0x5c04('0xbf'))};_0x353692[_0x5c04('0x4a')]=_[_0x5c04('0x9b')](_0x353692[_0x5c04('0x4a')],_0x2e1f54);}_0x353692=_[_0x5c04('0x9b')]({},_0x353692,_0x422ee5[_0x5c04('0xb5')]);return db[_0x5c04('0xb9')][_0x5c04('0x22')]({'where':_0x353692['where']})[_0x5c04('0x28')](function(_0x17ddab){_0xf513ae['count']=_0x17ddab;if(_0x422ee5[_0x5c04('0x40')][_0x5c04('0xc0')]){_0x353692[_0x5c04('0xb4')]=[{'all':!![]}];}return db[_0x5c04('0xb9')][_0x5c04('0xc1')](_0x353692);})[_0x5c04('0x28')](function(_0x4127d5){_0xf513ae['rows']=_0x4127d5;return _0xf513ae;});}})['then'](respondWithFilteredResult(_0x3e294d,_0x353692))[_0x5c04('0x34')](handleError(_0x3e294d,null));};exports[_0x5c04('0xc2')]=function(_0x16434e,_0x5f20c6,_0x78c1e6){return db['SmsInteraction'][_0x5c04('0x61')]({'where':{'id':_0x16434e['params']['id']}})['then'](handleEntityNotFound(_0x5f20c6,null))[_0x5c04('0x28')](function(_0x4c781e){if(_0x4c781e){return _0x4c781e[_0x5c04('0xc3')](_0x16434e['body']['ids'],_[_0x5c04('0xc4')](_0x16434e[_0x5c04('0x73')],[_0x5c04('0xc5'),'id'])||{})[_0x5c04('0xc6')](function(){return db[_0x5c04('0xc7')][_0x5c04('0xc1')]({'attributes':['id',_0x5c04('0x2b'),_0x5c04('0x4d')],'where':{'id':_0x16434e['body'][_0x5c04('0xc5')]}});})[_0x5c04('0x28')](function(_0x466155){socket['emit'](_0x5c04('0xc8'),{'id':Number(_0x16434e['params']['id']),'tags':_0x466155||[]});return{'id':Number(_0x16434e['params']['id']),'tags':_0x466155||[]};});}})['then'](respondWithResult(_0x5f20c6,null))['catch'](handleError(_0x5f20c6,null));};exports['removeTags']=function(_0x215a33,_0x18e8f8,_0x3c4cc8){return db['SmsInteraction'][_0x5c04('0x61')]({'where':{'id':_0x215a33['params']['id']}})[_0x5c04('0x28')](handleEntityNotFound(_0x18e8f8,null))['then'](function(_0x4bc065){if(_0x4bc065){return _0x4bc065[_0x5c04('0xc9')](_0x215a33['query']['ids']);}})[_0x5c04('0x28')](respondWithStatusCode(_0x18e8f8,null))[_0x5c04('0x34')](handleError(_0x18e8f8,null));};exports[_0x5c04('0xca')]=function(_0x43ad34,_0x1538ea){var _0x429592=moment()[_0x5c04('0xcb')]()['toString']();var _0x435271=path[_0x5c04('0xcc')](config['root'],_0x5c04('0xcd'),'files',_0x5c04('0xce'));var _0x242948=path[_0x5c04('0xcc')](config[_0x5c04('0xcf')],_0x5c04('0xcd'),'files','attachments');var _0x1adf42=path[_0x5c04('0xcc')](_0x435271,_0x429592);var _0x238eef=util[_0x5c04('0xbe')](_0x5c04('0xd0'),_0x43ad34[_0x5c04('0xb3')]['id'],_0x429592);var _0x1a3071=path[_0x5c04('0xcc')](_0x435271,_0x238eef);var _0x563a9a=[];_0x563a9a[_0x5c04('0x33')]({'model':db[_0x5c04('0x6e')],'as':_0x5c04('0x6e'),'attributes':['id',_0x5c04('0x2f')],'raw':!![]});_0x563a9a[_0x5c04('0x33')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x5c04('0xd1'),_0x5c04('0xd2')],'raw':!![]});var _0x51e1f1=[{'model':db[_0x5c04('0xb9')],'as':_0x5c04('0xd3'),'attributes':['id',_0x5c04('0x73'),'createdAt',_0x5c04('0xd4'),_0x5c04('0xd5'),_0x5c04('0x7f')],'include':_0x563a9a}];_0x51e1f1[_0x5c04('0x33')]({'model':db['SmsAccount'],'as':_0x5c04('0xd6'),'attributes':['id','name']});_0x51e1f1[_0x5c04('0x33')]({'model':db[_0x5c04('0x6e')],'as':_0x5c04('0xd7'),'attributes':['id','fullname']});return db[_0x5c04('0x3d')][_0x5c04('0x61')]({'where':{'id':_0x43ad34[_0x5c04('0xb3')]['id']},'include':_0x51e1f1})['then'](handleEntityNotFound(_0x1538ea,null))[_0x5c04('0x28')](function(_0x547d8d){if(_0x547d8d){var _0x39e4ba=_0x547d8d[_0x5c04('0xd8')]({'plain':!![]});fs[_0x5c04('0xd9')](_0x1adf42);var _0x46f8f3={'channel':'Sms','account':_0x39e4ba['Account'][_0x5c04('0x2b')],'agent':_0x39e4ba[_0x5c04('0xd7')]?_0x39e4ba['Owner']['fullname']:_0x5c04('0xda'),'createdAt':moment(_0x39e4ba[_0x5c04('0x77')])[_0x5c04('0xbe')](_0x5c04('0xbf'))[_0x5c04('0xad')](),'closedAt':_0x39e4ba['closed']?moment(_0x39e4ba['closedAt'])['format'](_0x5c04('0xbf'))[_0x5c04('0xad')]():'','disposition':_0x39e4ba[_0x5c04('0xdb')],'messages':_(_0x39e4ba['Messages'])[_0x5c04('0xbd')]({'secret':![]})['map'](function(_0x58b30e){return{'date':moment(_0x58b30e[_0x5c04('0x77')])[_0x5c04('0xbe')](_0x5c04('0xbf'))['toString'](),'sender':_0x58b30e[_0x5c04('0xd4')]===_0x5c04('0xdc')?_0x58b30e[_0x5c04('0x6e')]?_0x58b30e['User'][_0x5c04('0x2f')]:_0x5c04('0xdd'):_0x58b30e[_0x5c04('0xde')][_0x5c04('0xd1')]+(_0x58b30e[_0x5c04('0xde')][_0x5c04('0xd2')]?'\x20'+_0x58b30e[_0x5c04('0xde')][_0x5c04('0xd2')]:''),'body':_0x58b30e[_0x5c04('0x73')],'direction':_0x58b30e[_0x5c04('0xd4')]===_0x5c04('0xdc')?'A':'C','secret':_0x58b30e[_0x5c04('0xd5')],'read':_0x58b30e[_0x5c04('0x7f')]};})[_0x5c04('0x67')]()};return ejs[_0x5c04('0xdf')](path[_0x5c04('0xcc')](config['root'],_0x5c04('0xcd'),_0x5c04('0xe0'),'downloadInteraction.ejs'),{'interaction':_0x46f8f3})[_0x5c04('0x28')](function(_0x38298f){var _0x58dc6d=path[_0x5c04('0xcc')](_0x1adf42,_0x5c04('0xe1')+_0x39e4ba['id']+'-'+_0x429592+'.pdf');var _0x2d3898={'path':_0x58dc6d,'channel':_0x5c04('0xe2'),'interactionId':_0x39e4ba['id']};return pdf[_0x5c04('0xe3')](_0x38298f,_0x2d3898);})[_0x5c04('0x28')](function(){return new BPromise(function(_0x238a7c,_0x14a849){zipdir(_0x1adf42,{'saveTo':_0x1a3071},function(_0x20bcfe,_0x189252){if(_0x20bcfe)return _0x14a849(_0x20bcfe);return _0x238a7c(_0x189252);});})[_0x5c04('0x28')](function(){return new BPromise(function(_0xe08124,_0x2614e5){rimraf(_0x1adf42,function(_0x440592){if(_0x440592)_0x2614e5(_0x440592);return _0xe08124();});});})[_0x5c04('0x28')](function(){return _0x1538ea[_0x5c04('0xca')](_0x1a3071,_0x238eef,function(_0x4643c8){if(_0x4643c8){console['log'](_0x5c04('0xe4'),_0x4643c8);}else{fs[_0x5c04('0xe5')](_0x1a3071);}});});});}else{return _0x1538ea[_0x5c04('0x1b')](0xc8);}})[_0x5c04('0x34')](handleError(_0x1538ea,null));};
\ No newline at end of file
+var _0xbc46=['from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','it.SmsInteractionId\x20=\x20i.id','expr','parseSearch','search','sqlOperator','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','push','all','rows','show','SmsInteraction','includeAll','include','options','create','body','update','params','describe','addMessage','SmsMessage','ids','omit','getMessages','rawAttributes','hasOwnProperty','nolimit','format','findAll','addTags','spread','emit','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','firstName','direction','secret','SmsAccount','Account','mkdirSync','Sms','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','catch','talking','answered','unmanaged','total','closed','waiting','UserId','index','fieldName','key','model','keys','intersection','query','attributes','fields','length','order','sort','where','filters','pick','select','field','color'];(function(_0x5d8f84,_0x444981){var _0x5e8d10=function(_0x4fd4c9){while(--_0x4fd4c9){_0x5d8f84['push'](_0x5d8f84['shift']());}};_0x5e8d10(++_0x444981);}(_0xbc46,0x9f));var _0x6bc4=function(_0x201e12,_0x3ed124){_0x201e12=_0x201e12-0x0;var _0x1b7aed=_0xbc46[_0x201e12];return _0x1b7aed;};'use strict';var emlformat=require(_0x6bc4('0x0'));var rimraf=require(_0x6bc4('0x1'));var zipdir=require(_0x6bc4('0x2'));var jsonpatch=require(_0x6bc4('0x3'));var rp=require(_0x6bc4('0x4'));var moment=require(_0x6bc4('0x5'));var BPromise=require(_0x6bc4('0x6'));var Mustache=require(_0x6bc4('0x7'));var util=require(_0x6bc4('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6bc4('0x9'));var ejs=require(_0x6bc4('0xa'));var fs=require('fs');var fs_extra=require(_0x6bc4('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6bc4('0xc'));var jsforce=require(_0x6bc4('0xd'));var deskjs=require(_0x6bc4('0xe'));var toCsv=require(_0x6bc4('0x9'));var querystring=require(_0x6bc4('0xf'));var Papa=require('papaparse');var Redis=require(_0x6bc4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6bc4('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x6bc4('0x12'));var hardwareService=require(_0x6bc4('0x13'));var logger=require(_0x6bc4('0x14'))(_0x6bc4('0x15'));var utils=require(_0x6bc4('0x16'));var config=require(_0x6bc4('0x17'));var licenseUtil=require(_0x6bc4('0x18'));var db=require(_0x6bc4('0x19'))['db'];config[_0x6bc4('0x1a')]=_[_0x6bc4('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')[_0x6bc4('0x1c')](socket);function respondWithStatusCode(_0xbb1e,_0x38113a){_0x38113a=_0x38113a||0xcc;return function(_0x30208f){if(_0x30208f){return _0xbb1e[_0x6bc4('0x1d')](_0x38113a);}return _0xbb1e[_0x6bc4('0x1e')](_0x38113a)[_0x6bc4('0x1f')]();};}function respondWithResult(_0x41bc2a,_0x5a9b1c){_0x5a9b1c=_0x5a9b1c||0xc8;return function(_0x188325){if(_0x188325){return _0x41bc2a['status'](_0x5a9b1c)[_0x6bc4('0x20')](_0x188325);}};}function respondWithFilteredResult(_0x157ff3,_0x288075){return function(_0x33a788){if(_0x33a788){var _0x4dabfe=typeof _0x288075['offset']===_0x6bc4('0x21')&&typeof _0x288075['limit']===_0x6bc4('0x21');var _0x32bb44=_0x33a788[_0x6bc4('0x22')];var _0x4667e0=_0x4dabfe?0x0:_0x288075[_0x6bc4('0x23')];var _0x490f5d=_0x4dabfe?_0x33a788['count']:_0x288075[_0x6bc4('0x23')]+_0x288075[_0x6bc4('0x24')];var _0x457755;if(_0x490f5d>=_0x32bb44){_0x490f5d=_0x32bb44;_0x457755=0xc8;}else{_0x457755=0xce;}_0x157ff3[_0x6bc4('0x1e')](_0x457755);return _0x157ff3[_0x6bc4('0x25')](_0x6bc4('0x26'),_0x4667e0+'-'+_0x490f5d+'/'+_0x32bb44)[_0x6bc4('0x20')](_0x33a788);}return null;};}function patchUpdates(_0x2ca3f1){return function(_0x166cfa){try{jsonpatch[_0x6bc4('0x27')](_0x166cfa,_0x2ca3f1,!![]);}catch(_0x2d0615){return BPromise[_0x6bc4('0x28')](_0x2d0615);}return _0x166cfa[_0x6bc4('0x29')]();};}function saveUpdates(_0x5269c7,_0x2ef414){return function(_0x45e5ca){if(_0x45e5ca){return _0x45e5ca['update'](_0x5269c7)[_0x6bc4('0x2a')](function(_0xc91909){return _0xc91909;});}return null;};}function removeEntity(_0x4fe0ab,_0x56a8bb){return function(_0x522264){if(_0x522264){return _0x522264[_0x6bc4('0x2b')]()[_0x6bc4('0x2a')](function(){_0x4fe0ab[_0x6bc4('0x1e')](0xcc)[_0x6bc4('0x1f')]();});}};}function handleEntityNotFound(_0x2a35db,_0x1c2787){return function(_0x3894d8){if(!_0x3894d8){_0x2a35db[_0x6bc4('0x1d')](0x194);}return _0x3894d8;};}function handleError(_0x1daba4,_0xae262c){_0xae262c=_0xae262c||0x1f4;return function(_0x3206cd){logger[_0x6bc4('0x2c')](_0x3206cd[_0x6bc4('0x2d')]);if(_0x3206cd['name']){delete _0x3206cd[_0x6bc4('0x2e')];}_0x1daba4[_0x6bc4('0x1e')](_0xae262c)[_0x6bc4('0x2f')](_0x3206cd);};}function getInteractionUsers(_0x3dd8e0,_0x1f8445){return new BPromise(function(_0x492d67,_0x5c32e8){try{if(_0x1f8445[_0x3dd8e0['id']]){_0x3dd8e0[_0x6bc4('0x30')]=_[_0x6bc4('0x31')](_0x1f8445[_0x3dd8e0['id']],function(_0x49bd4f){return{'id':_0x49bd4f['id'],'fullname':_0x49bd4f[_0x6bc4('0x32')]};});}}catch(_0x359290){_0x5c32e8(_0x359290);}_0x492d67(_0x3dd8e0);});}function getInteractionTags(_0x45e62e,_0x2398db){return new BPromise(function(_0x1c8290,_0xa02475){try{if(_0x45e62e[_0x6bc4('0x33')]){_0x45e62e['Tags']=[];_0x45e62e['TagIds'][_0x6bc4('0x34')](',')[_0x6bc4('0x35')](function(_0x3126da){_0x45e62e[_0x6bc4('0x36')]['push'](_0x2398db[_0x3126da]);});}delete _0x45e62e[_0x6bc4('0x33')];}catch(_0x59cdbc){_0xa02475(_0x59cdbc);}_0x1c8290(_0x45e62e);});}function updateSmsInteraction(_0x34f9e9,_0x4459bc,_0x746d1c){return new BPromise(function(_0x500561,_0x39f212){return getInteractionUsers(_0x34f9e9,_0x746d1c)['then'](function(_0x153c4b){return getInteractionTags(_0x153c4b,_0x4459bc);})[_0x6bc4('0x2a')](function(_0x1b20a7){return getStateInteraction(_0x1b20a7);})[_0x6bc4('0x2a')](function(_0x36f46f){_0x500561(_0x36f46f);})[_0x6bc4('0x37')](function(_0x3912d7){_0x39f212(_0x3912d7);});});}function getStateInteraction(_0x15ed24){return new BPromise(function(_0x76f124){_0x15ed24['waiting']=0x0;_0x15ed24[_0x6bc4('0x38')]=0x0;_0x15ed24[_0x6bc4('0x39')]=0x0;_0x15ed24[_0x6bc4('0x3a')]=0x0;_0x15ed24[_0x6bc4('0x3b')]=0x0;if(!_0x15ed24[_0x6bc4('0x3c')]&&!_0x15ed24['UserId']){_0x15ed24[_0x6bc4('0x3d')]+=0x1;}if(!_0x15ed24[_0x6bc4('0x3c')]&&_0x15ed24[_0x6bc4('0x3e')]){_0x15ed24[_0x6bc4('0x38')]+=0x1;if(_0x15ed24[_0x6bc4('0x3d')]){_0x15ed24[_0x6bc4('0x3d')]-=0x1;}}if(_0x15ed24[_0x6bc4('0x3c')]&&_0x15ed24[_0x6bc4('0x3e')]){_0x15ed24['answered']+=0x1;if(_0x15ed24[_0x6bc4('0x38')]){_0x15ed24[_0x6bc4('0x38')]-=0x1;}}if(_0x15ed24['closed']&&!_0x15ed24[_0x6bc4('0x3e')]){_0x15ed24[_0x6bc4('0x3a')]+=0x1;if(_0x15ed24[_0x6bc4('0x3d')]){_0x15ed24[_0x6bc4('0x3d')]-=0x1;}}_0x15ed24[_0x6bc4('0x3b')]+=0x1;_0x76f124(_0x15ed24);});}exports[_0x6bc4('0x3f')]=function(_0xf32c56,_0x1c289f){var _0x54a516={},_0x2ae960={},_0x579460={'count':0x0,'rows':[]};var _0x319a16=_[_0x6bc4('0x31')](db['SmsInteraction']['rawAttributes'],function(_0x332e13){return{'name':_0x332e13[_0x6bc4('0x40')],'type':_0x332e13['type'][_0x6bc4('0x41')]};});_0x2ae960[_0x6bc4('0x42')]=_[_0x6bc4('0x31')](_0x319a16,_0x6bc4('0x2e'));_0x2ae960['query']=_[_0x6bc4('0x43')](_0xf32c56['query']);_0x2ae960['filters']=_[_0x6bc4('0x44')](_0x2ae960[_0x6bc4('0x42')],_0x2ae960[_0x6bc4('0x45')]);_0x54a516[_0x6bc4('0x46')]=_[_0x6bc4('0x44')](_0x2ae960[_0x6bc4('0x42')],qs[_0x6bc4('0x47')](_0xf32c56['query'][_0x6bc4('0x47')]));_0x54a516[_0x6bc4('0x46')]=_0x54a516[_0x6bc4('0x46')][_0x6bc4('0x48')]?_0x54a516[_0x6bc4('0x46')]:_0x2ae960[_0x6bc4('0x42')];if(!_0xf32c56[_0x6bc4('0x45')]['hasOwnProperty']('nolimit')){_0x54a516[_0x6bc4('0x24')]=qs[_0x6bc4('0x24')](_0xf32c56[_0x6bc4('0x45')][_0x6bc4('0x24')]);_0x54a516[_0x6bc4('0x23')]=qs[_0x6bc4('0x23')](_0xf32c56[_0x6bc4('0x45')][_0x6bc4('0x23')]);}_0x54a516[_0x6bc4('0x49')]=qs['sort'](_0xf32c56['query'][_0x6bc4('0x4a')]);_0x54a516[_0x6bc4('0x4b')]=qs[_0x6bc4('0x4c')](_[_0x6bc4('0x4d')](_0xf32c56[_0x6bc4('0x45')],_0x2ae960[_0x6bc4('0x4c')]),_0x319a16);var _0x423605=[];var _0xe36dd7=squel[_0x6bc4('0x4e')]()['field']('id')[_0x6bc4('0x4f')]('name')['field'](_0x6bc4('0x50'))[_0x6bc4('0x51')](_0x6bc4('0x52'));var _0x237e1f=squel['select']()[_0x6bc4('0x4f')](_0x6bc4('0x53'))[_0x6bc4('0x4f')](_0x6bc4('0x54'))['field'](_0x6bc4('0x55'))[_0x6bc4('0x51')](_0x6bc4('0x56'),'ui')[_0x6bc4('0x57')]('users','u',_0x6bc4('0x58'));var _0x47722c=squel[_0x6bc4('0x4e')]()[_0x6bc4('0x51')](_0x6bc4('0x59'),'i')[_0x6bc4('0x57')](_0x6bc4('0x5a'),'c',_0x6bc4('0x5b'))['left_join'](_0x6bc4('0x5c'),'o',_0x6bc4('0x5d'))[_0x6bc4('0x57')]('sms_accounts','a',_0x6bc4('0x5e'))[_0x6bc4('0x57')]('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')['left_join']('sms_interaction_has_tags','it',_0x6bc4('0x5f'))[_0x6bc4('0x57')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x5e421c=squel['expr']();var _0x568d8b=[];var _0x4be6da=squel[_0x6bc4('0x60')]();var _0x29ba7e;if(_0xf32c56[_0x6bc4('0x45')]['search']){_0x29ba7e=as[_0x6bc4('0x61')](_0xf32c56[_0x6bc4('0x45')][_0x6bc4('0x62')]);var _0x365c31=_0x29ba7e[_0x6bc4('0x63')];for(var _0x36db41=0x0;_0x36db41<_0x29ba7e['conditions'][_0x6bc4('0x48')];_0x36db41++){var _0x13349f=_0x29ba7e['conditions'][_0x36db41];var _0x5f17df='i';var _0x56f724=_[_0x6bc4('0x64')](_0x319a16,[_0x6bc4('0x2e'),_0x13349f[_0x6bc4('0x4f')]]);if(!_0x56f724){switch(_0x13349f[_0x6bc4('0x4f')]){case'unreadMessages':if(_0x13349f[_0x6bc4('0x65')]==0x1){_0x47722c[_0x6bc4('0x66')]('`'+_0x13349f[_0x6bc4('0x4f')]+_0x6bc4('0x67'));}else{_0x47722c[_0x6bc4('0x66')]('`'+_0x13349f['field']+_0x6bc4('0x68'));}break;case _0x6bc4('0x69'):if(_0x13349f[_0x6bc4('0x6a')]===_0x6bc4('0x6b')){if(_0x13349f['value']['split']('\x20')['length']>0x1){_0x5e421c[_0x365c31]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6bc4('0x6c')](_0x13349f[_0x6bc4('0x65')]),null);}else{var _0x23af1f='%'+_0x13349f['value']+'%';_0x5e421c[_0x365c31](_0x6bc4('0x6d'),_0x23af1f,_0x23af1f,_0x23af1f);}}else{_0x56f724=_[_0x6bc4('0x64')](_0x319a16,['name',_0x6bc4('0x6e')]);_0x13349f[_0x6bc4('0x4f')]='ContactId';_0x361a1d=as[_0x6bc4('0x6f')](_0x5f17df,_0x56f724[_0x6bc4('0x70')],_0x13349f);_0x5e421c[_0x365c31](_0x361a1d[_0x6bc4('0x71')],_0x361a1d['value'][_0x6bc4('0x72')],_0x361a1d['value'][_0x6bc4('0x1f')]);}break;case _0x6bc4('0x73'):var _0x1863fc=_0x13349f[_0x6bc4('0x65')]['split'](',')[_0x6bc4('0x31')](function(_0x2c0975){return Number(_0x2c0975);});_0x1863fc['forEach'](function(_0x27f95e){_0x4be6da['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x27f95e+',%');});_0x568d8b=_[_0x6bc4('0x74')](_0x568d8b,_0x1863fc);break;case _0x6bc4('0x75'):if(_0x13349f[_0x6bc4('0x6a')]===_0x6bc4('0x6b')){_0x5e421c[_0x365c31](_0x6bc4('0x76'),'%'+_0x13349f[_0x6bc4('0x65')]+'%',null);}else{_0x56f724=_[_0x6bc4('0x64')](_0x319a16,[_0x6bc4('0x2e'),_0x6bc4('0x3e')]);_0x13349f[_0x6bc4('0x4f')]=_0x6bc4('0x3e');_0x361a1d=as[_0x6bc4('0x6f')](_0x5f17df,_0x56f724[_0x6bc4('0x70')],_0x13349f);_0x5e421c[_0x365c31](_0x361a1d[_0x6bc4('0x71')],_0x361a1d['value'][_0x6bc4('0x72')],_0x361a1d[_0x6bc4('0x65')]['end']);}break;case'body':_0x361a1d=as[_0x6bc4('0x6f')]('me',null,_0x13349f);_0x5e421c[_0x365c31](_0x361a1d['text'],_0x361a1d[_0x6bc4('0x65')][_0x6bc4('0x72')],_0x361a1d[_0x6bc4('0x65')]['end']);break;}}else{var _0x361a1d=as[_0x6bc4('0x6f')](_0x5f17df,_0x56f724[_0x6bc4('0x70')],_0x13349f);_0x5e421c[_0x365c31](_0x361a1d[_0x6bc4('0x71')],_0x361a1d['value'][_0x6bc4('0x72')],_0x361a1d[_0x6bc4('0x65')][_0x6bc4('0x1f')]);}}}else{var _0x4c569b=_(_0xf32c56[_0x6bc4('0x45')])[_0x6bc4('0x43')]()['map'](function(_0x57ee47){return _[_0x6bc4('0x77')](_0x319a16,[_0x6bc4('0x2e'),_0x57ee47])?_0x57ee47:undefined;})[_0x6bc4('0x78')]()['value']();if(!_[_0x6bc4('0x79')](_0x4c569b)){_0x4c569b['forEach'](function(_0x1a14d0){if(_0x1a14d0===_0x6bc4('0x7a')){_0x47722c[_0x6bc4('0x4b')](_0x6bc4('0x7b'),[][_0x6bc4('0x7c')](_0xf32c56['query'][_0x1a14d0]));}else if(_0x1a14d0===_0x6bc4('0x7d')){var _0x3b5c18=JSON[_0x6bc4('0x7e')](_0xf32c56['query'][_0x1a14d0])[_0x6bc4('0x7f')];var _0x254871=JSON[_0x6bc4('0x7e')](_0xf32c56[_0x6bc4('0x45')][_0x1a14d0])[_0x6bc4('0x80')];_0x47722c['where'](_0x6bc4('0x81'),_0x3b5c18,_0x254871);}else{if(_0xf32c56[_0x6bc4('0x45')][_0x1a14d0]===_0x6bc4('0x82')){_0x47722c[_0x6bc4('0x4b')]('i.'+_0x1a14d0+'\x20IS\x20NULL');}else{_0x47722c[_0x6bc4('0x4b')]('i.'+_0x1a14d0+_0x6bc4('0x83'),_0xf32c56[_0x6bc4('0x45')][_0x1a14d0]);}}});}if(_0xf32c56[_0x6bc4('0x45')]['read']){if(_0xf32c56['query'][_0x6bc4('0x84')]==0x1){_0x47722c[_0x6bc4('0x66')]('`unreadMessages`\x20=\x200');}else{_0x47722c[_0x6bc4('0x66')](_0x6bc4('0x85'));}}if(_0xf32c56[_0x6bc4('0x45')][_0x6bc4('0x86')]){_0x568d8b=_['isArray'](_0xf32c56[_0x6bc4('0x45')][_0x6bc4('0x86')])?_0xf32c56[_0x6bc4('0x45')]['tag']:new Array(_0xf32c56[_0x6bc4('0x45')][_0x6bc4('0x86')]);_0x568d8b['forEach'](function(_0x3cb2b5){_0x4be6da['or'](_0x6bc4('0x87'),'%,'+_0x3cb2b5+',%');});}if(_0xf32c56[_0x6bc4('0x45')][_0x6bc4('0x88')]){var _0x5f1f22=_0xf32c56['query'][_0x6bc4('0x88')]['replace']('\x5c','\x5c\x5c')[_0x6bc4('0x89')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5f1f22)){_0x5e421c['or'](_0x6bc4('0x8a'),_0x5f1f22+'%')['or']('i.phone\x20LIKE\x20?',_0x5f1f22+'%');}else{_0x5e421c['or'](_0x6bc4('0x8b'),qs[_0x6bc4('0x6c')](_0x5f1f22))['or'](_0x6bc4('0x8c'),_0x5f1f22+'%');}}}_0x47722c[_0x6bc4('0x4b')](_0x5e421c);_0x47722c[_0x6bc4('0x8d')](_0x6bc4('0x8e'));var _0x2ad564={'type':db[_0x6bc4('0x8f')][_0x6bc4('0x90')][_0x6bc4('0x91')],'raw':!![]};var _0x38adb0=_0x47722c[_0x6bc4('0x92')]();_0x38adb0[_0x6bc4('0x4f')]('i.id');_0x38adb0['field'](_0x6bc4('0x93'),_0x6bc4('0x94'));if(_0x54a516[_0x6bc4('0x49')]){_0x54a516[_0x6bc4('0x49')][_0x6bc4('0x35')](function(_0x3d9eff){var _0x52ca08=_0x3d9eff[0x0]===_0x6bc4('0x95')?_0x3d9eff[0x0]:'i.'+_0x3d9eff[0x0];_0x47722c[_0x6bc4('0x49')](_0x52ca08,_0x3d9eff[0x1]===_0x6bc4('0x96')?![]:!![]);});}if(!_[_0x6bc4('0x79')](_0x568d8b)){_0x47722c['having'](_0x4be6da);_0x38adb0[_0x6bc4('0x4b')]('t.id\x20IN\x20?',_0x568d8b);}BPromise[_0x6bc4('0x97')]()[_0x6bc4('0x2a')](function(){if(!_0x29ba7e){if(_0xf32c56[_0x6bc4('0x45')][_0x6bc4('0x7a')])return;_0x38adb0[_0x6bc4('0x4b')](_0x6bc4('0x98'));_0x47722c[_0x6bc4('0x4b')](_0x6bc4('0x98'));return;}if(_0xf32c56[_0x6bc4('0x99')][_0x6bc4('0x9a')]!==_0x6bc4('0x9b'))return;return _0xf32c56['user'][_0x6bc4('0x9c')]({'attributes':['id'],'raw':!![]})[_0x6bc4('0x2a')](function(_0x408d4f){if(_[_0x6bc4('0x79')](_0x408d4f)){_0x38adb0[_0x6bc4('0x4b')]('i.SmsAccountId\x20IS\x20NULL');_0x47722c[_0x6bc4('0x4b')](_0x6bc4('0x9d'));}else{_0x38adb0[_0x6bc4('0x4b')](_0x6bc4('0x7b'),_['map'](_0x408d4f,'id'));_0x47722c[_0x6bc4('0x4b')](_0x6bc4('0x7b'),_[_0x6bc4('0x31')](_0x408d4f,'id'));}});})[_0x6bc4('0x2a')](function(){if(_0xf32c56['user'][_0x6bc4('0x9a')]==='agent'&&!_0x29ba7e&&!_0xf32c56['query']['SmsAccountId'])return[];return db['sequelize'][_0x6bc4('0x45')](_0x38adb0[_0x6bc4('0x9e')](),_0x2ad564);})[_0x6bc4('0x2a')](function(_0x12bdd3){_0x579460[_0x6bc4('0x22')]=_0x12bdd3[_0x6bc4('0x48')];if(_0x579460['count']===0x0)return[];return db[_0x6bc4('0x9f')][_0x6bc4('0x45')](_0xe36dd7[_0x6bc4('0x9e')](),_0x2ad564)[_0x6bc4('0x2a')](function(_0x479df7){_0x423605=_[_0x6bc4('0xa0')](_0x479df7,'id');_0x2ad564=_[_0x6bc4('0xa1')](_0x2ad564,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xf32c56['query'][_0x6bc4('0x47')]){_0x54a516[_0x6bc4('0x46')][_0x6bc4('0x35')](function(_0xcb676c){_0x47722c[_0x6bc4('0x4f')]('i.'+_0xcb676c);});}else{_0x47722c[_0x6bc4('0x4f')](_0x6bc4('0x93'),'unreadMessages');_0x47722c['field'](_0x6bc4('0xa2'),_0x6bc4('0xa3'));_0x47722c['field'](_0x6bc4('0xa4'),_0x6bc4('0xa5'));_0x47722c[_0x6bc4('0x4f')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x6bc4('0x95'));_0x47722c[_0x6bc4('0x4f')](_0x6bc4('0xa6'));_0x47722c[_0x6bc4('0x4f')]('c.firstName',_0x6bc4('0xa7'));_0x47722c['field'](_0x6bc4('0xa8'),_0x6bc4('0xa9'));_0x47722c[_0x6bc4('0x4f')](_0x6bc4('0xaa'),_0x6bc4('0xab'));_0x47722c[_0x6bc4('0x4f')](_0x6bc4('0xac'),_0x6bc4('0xad'));_0x47722c[_0x6bc4('0x4f')](_0x6bc4('0xae'),_0x6bc4('0xaf'));_0x47722c[_0x6bc4('0x4f')](_0x6bc4('0xb0'),_0x6bc4('0xb1'));_0x47722c[_0x6bc4('0x4f')](_0x6bc4('0xb2'),'Owner.fullname');_0x47722c[_0x6bc4('0x4f')](_0x6bc4('0xb3'),'Owner.internal');_0x47722c[_0x6bc4('0x4f')](_0x6bc4('0xb4'),_0x6bc4('0x33'));}if(_0x54a516[_0x6bc4('0x24')])_0x47722c[_0x6bc4('0x24')](_0x54a516[_0x6bc4('0x24')]);if(_0x54a516[_0x6bc4('0x23')])_0x47722c[_0x6bc4('0x23')](_0x54a516[_0x6bc4('0x23')]);return db['sequelize'][_0x6bc4('0x45')](_0x47722c[_0x6bc4('0x9e')](),_0x2ad564);})[_0x6bc4('0x2a')](function(_0x34046b){if(_0x34046b['length']>0x0)_0x237e1f[_0x6bc4('0x4b')]('ui.SmsInteractionId\x20IN\x20?',_[_0x6bc4('0x31')](_0x34046b,'id'));return db[_0x6bc4('0x9f')][_0x6bc4('0x45')](_0x237e1f['toString'](),_0x2ad564)[_0x6bc4('0x2a')](function(_0x548263){var _0x28f238=_[_0x6bc4('0xb5')](_0x548263,_0x6bc4('0xb6'));var _0x54d874=[];_0x34046b['forEach'](function(_0x30cbae){_0x54d874[_0x6bc4('0xb7')](updateSmsInteraction(_0x30cbae,_0x423605,_0x28f238));});return BPromise[_0x6bc4('0xb8')](_0x54d874);});});})[_0x6bc4('0x2a')](function(_0x5eeb3b){_0x579460[_0x6bc4('0xb9')]=_0x5eeb3b;return _0x579460;})[_0x6bc4('0x2a')](respondWithFilteredResult(_0x1c289f,_0x54a516))[_0x6bc4('0x37')](handleError(_0x1c289f,null));};exports[_0x6bc4('0xba')]=function(_0x1b861e,_0x33c819){var _0x3011b1={'raw':![],'where':{'id':_0x1b861e['params']['id']}},_0x2f97bf={};_0x2f97bf[_0x6bc4('0x42')]=_[_0x6bc4('0x43')](db[_0x6bc4('0xbb')]['rawAttributes']);_0x2f97bf['query']=_[_0x6bc4('0x43')](_0x1b861e[_0x6bc4('0x45')]);_0x2f97bf[_0x6bc4('0x4c')]=_['intersection'](_0x2f97bf[_0x6bc4('0x42')],_0x2f97bf['query']);_0x3011b1[_0x6bc4('0x46')]=_['intersection'](_0x2f97bf[_0x6bc4('0x42')],qs[_0x6bc4('0x47')](_0x1b861e[_0x6bc4('0x45')][_0x6bc4('0x47')]));_0x3011b1[_0x6bc4('0x46')]=_0x3011b1['attributes'][_0x6bc4('0x48')]?_0x3011b1[_0x6bc4('0x46')]:_0x2f97bf['model'];if(_0x1b861e[_0x6bc4('0x45')][_0x6bc4('0xbc')]){_0x3011b1[_0x6bc4('0xbd')]=[{'all':!![]}];}_0x3011b1=_[_0x6bc4('0xa1')]({},_0x3011b1,_0x1b861e[_0x6bc4('0xbe')]);return db[_0x6bc4('0xbb')][_0x6bc4('0x64')](_0x3011b1)[_0x6bc4('0x2a')](handleEntityNotFound(_0x33c819,null))['then'](respondWithResult(_0x33c819,null))[_0x6bc4('0x37')](handleError(_0x33c819,null));};exports[_0x6bc4('0xbf')]=function(_0x5c0496,_0x477f3b){return db[_0x6bc4('0xbb')][_0x6bc4('0xbf')](_0x5c0496[_0x6bc4('0xc0')],{})['then'](respondWithResult(_0x477f3b,0xc9))[_0x6bc4('0x37')](handleError(_0x477f3b,null));};exports[_0x6bc4('0xc1')]=function(_0x5db240,_0x382cef){if(_0x5db240['body']['id']){delete _0x5db240['body']['id'];}return db[_0x6bc4('0xbb')]['find']({'where':{'id':_0x5db240[_0x6bc4('0xc2')]['id']}})[_0x6bc4('0x2a')](handleEntityNotFound(_0x382cef,null))['then'](saveUpdates(_0x5db240[_0x6bc4('0xc0')],null))['then'](respondWithResult(_0x382cef,null))[_0x6bc4('0x37')](handleError(_0x382cef,null));};exports[_0x6bc4('0x2b')]=function(_0x3fe396,_0x4b9b53){return db[_0x6bc4('0xbb')][_0x6bc4('0x64')]({'where':{'id':_0x3fe396[_0x6bc4('0xc2')]['id']}})[_0x6bc4('0x2a')](handleEntityNotFound(_0x4b9b53,null))[_0x6bc4('0x2a')](removeEntity(_0x4b9b53,null))[_0x6bc4('0x37')](handleError(_0x4b9b53,null));};exports[_0x6bc4('0xc3')]=function(_0x2cf497,_0x2c3dd5){return db[_0x6bc4('0xbb')][_0x6bc4('0xc3')]()[_0x6bc4('0x2a')](respondWithResult(_0x2c3dd5,null))[_0x6bc4('0x37')](handleError(_0x2c3dd5,null));};exports[_0x6bc4('0xc4')]=function(_0x1ed63c,_0x3ed8a3,_0x1b3cce){return db[_0x6bc4('0xc5')][_0x6bc4('0x64')]({'where':{'id':_0x1ed63c['params']['id']}})[_0x6bc4('0x2a')](handleEntityNotFound(_0x3ed8a3,null))[_0x6bc4('0x2a')](function(_0x3c26cc){if(_0x3c26cc){return _0x3c26cc[_0x6bc4('0xc4')](_0x1ed63c[_0x6bc4('0xc0')][_0x6bc4('0xc6')],_[_0x6bc4('0xc7')](_0x1ed63c[_0x6bc4('0xc0')],['ids','id'])||{});}})['then'](respondWithResult(_0x3ed8a3,null))[_0x6bc4('0x37')](handleError(_0x3ed8a3,null));};exports[_0x6bc4('0xc8')]=function(_0x163b87,_0xa680c,_0x1bfdea){var _0x4b6c66={'raw':![],'where':{}};var _0x14be3c={};var _0x17227f={'count':0x0,'rows':[]};return db[_0x6bc4('0xbb')]['findOne']({'where':{'id':_0x163b87[_0x6bc4('0xc2')]['id']}})[_0x6bc4('0x2a')](handleEntityNotFound(_0xa680c,null))[_0x6bc4('0x2a')](function(_0x4b057f){if(_0x4b057f){_0x14be3c[_0x6bc4('0x42')]=_[_0x6bc4('0x43')](db['SmsMessage'][_0x6bc4('0xc9')]);_0x14be3c['query']=_[_0x6bc4('0x43')](_0x163b87[_0x6bc4('0x45')]);_0x14be3c[_0x6bc4('0x4c')]=_[_0x6bc4('0x44')](_0x14be3c[_0x6bc4('0x42')],_0x14be3c[_0x6bc4('0x45')]);_0x4b6c66[_0x6bc4('0x46')]=_[_0x6bc4('0x44')](_0x14be3c[_0x6bc4('0x42')],qs['fields'](_0x163b87[_0x6bc4('0x45')][_0x6bc4('0x47')]));_0x4b6c66[_0x6bc4('0x46')]=_0x4b6c66[_0x6bc4('0x46')]['length']?_0x4b6c66[_0x6bc4('0x46')]:_0x14be3c[_0x6bc4('0x42')];if(!_0x163b87[_0x6bc4('0x45')][_0x6bc4('0xca')](_0x6bc4('0xcb'))){_0x4b6c66['limit']=qs[_0x6bc4('0x24')](_0x163b87['query'][_0x6bc4('0x24')]);_0x4b6c66[_0x6bc4('0x23')]=qs[_0x6bc4('0x23')](_0x163b87[_0x6bc4('0x45')]['offset']);}_0x4b6c66[_0x6bc4('0x49')]=qs[_0x6bc4('0x4a')](_0x163b87['query'][_0x6bc4('0x4a')]);_0x4b6c66[_0x6bc4('0x4b')]=qs[_0x6bc4('0x4c')](_['pick'](_0x163b87['query'],_0x14be3c['filters']));_0x4b6c66[_0x6bc4('0x4b')][_0x6bc4('0xb6')]=_0x4b057f['id'];if(_0x163b87[_0x6bc4('0x45')]['filter']){_0x4b6c66[_0x6bc4('0x4b')]=_[_0x6bc4('0xa1')](_0x4b6c66['where'],{'$or':_[_0x6bc4('0x31')](_0x4b6c66['attributes'],function(_0x4bf586){var _0x1ffa8b={};_0x1ffa8b[_0x4bf586]={'$like':'%'+_0x163b87[_0x6bc4('0x45')][_0x6bc4('0x88')]+'%'};return _0x1ffa8b;})});}if(_0x163b87[_0x6bc4('0x45')][_0x6bc4('0x7f')]){var _0x255fd1=_0x163b87[_0x6bc4('0x45')][_0x6bc4('0x7f')][_0x6bc4('0x34')](',');var _0x261dc6={};_0x261dc6[_0x255fd1[0x0]]={'$gte':moment(_0x255fd1[0x1])[_0x6bc4('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4b6c66[_0x6bc4('0x4b')]=_[_0x6bc4('0xa1')](_0x4b6c66[_0x6bc4('0x4b')],_0x261dc6);}_0x4b6c66=_['merge']({},_0x4b6c66,_0x163b87[_0x6bc4('0xbe')]);return db[_0x6bc4('0xc5')][_0x6bc4('0x22')]({'where':_0x4b6c66[_0x6bc4('0x4b')]})[_0x6bc4('0x2a')](function(_0x2dd040){_0x17227f['count']=_0x2dd040;if(_0x163b87[_0x6bc4('0x45')][_0x6bc4('0xbc')]){_0x4b6c66['include']=[{'all':!![]}];}return db[_0x6bc4('0xc5')][_0x6bc4('0xcd')](_0x4b6c66);})['then'](function(_0x1f606e){_0x17227f[_0x6bc4('0xb9')]=_0x1f606e;return _0x17227f;});}})['then'](respondWithFilteredResult(_0xa680c,_0x4b6c66))[_0x6bc4('0x37')](handleError(_0xa680c,null));};exports[_0x6bc4('0xce')]=function(_0x342ead,_0x1aff2d,_0x2259d6){return db[_0x6bc4('0xbb')][_0x6bc4('0x64')]({'where':{'id':_0x342ead[_0x6bc4('0xc2')]['id']}})['then'](handleEntityNotFound(_0x1aff2d,null))[_0x6bc4('0x2a')](function(_0x3f1339){if(_0x3f1339){return _0x3f1339['setTags'](_0x342ead[_0x6bc4('0xc0')]['ids'],_['omit'](_0x342ead[_0x6bc4('0xc0')],[_0x6bc4('0xc6'),'id'])||{})[_0x6bc4('0xcf')](function(){return db[_0x6bc4('0x73')][_0x6bc4('0xcd')]({'attributes':['id',_0x6bc4('0x2e'),'color'],'where':{'id':_0x342ead['body'][_0x6bc4('0xc6')]}});})[_0x6bc4('0x2a')](function(_0xb817c5){socket[_0x6bc4('0xd0')]('smsInteractionTags:save',{'id':Number(_0x342ead[_0x6bc4('0xc2')]['id']),'tags':_0xb817c5||[]});return{'id':Number(_0x342ead['params']['id']),'tags':_0xb817c5||[]};});}})['then'](respondWithResult(_0x1aff2d,null))[_0x6bc4('0x37')](handleError(_0x1aff2d,null));};exports['removeTags']=function(_0x529902,_0x13b874,_0x4ae521){return db[_0x6bc4('0xbb')][_0x6bc4('0x64')]({'where':{'id':_0x529902['params']['id']}})[_0x6bc4('0x2a')](handleEntityNotFound(_0x13b874,null))[_0x6bc4('0x2a')](function(_0x2405da){if(_0x2405da){return _0x2405da[_0x6bc4('0xd1')](_0x529902[_0x6bc4('0x45')][_0x6bc4('0xc6')]);}})[_0x6bc4('0x2a')](respondWithStatusCode(_0x13b874,null))[_0x6bc4('0x37')](handleError(_0x13b874,null));};exports[_0x6bc4('0xd2')]=function(_0xc19597,_0x109fd2){var _0x292819=moment()['unix']()[_0x6bc4('0x9e')]();var _0x2080a6=path[_0x6bc4('0xd3')](config[_0x6bc4('0xd4')],_0x6bc4('0xd5'),_0x6bc4('0xd6'),'tmp');var _0xe83850=path['join'](config[_0x6bc4('0xd4')],'server',_0x6bc4('0xd6'),_0x6bc4('0xd7'));var _0x53d389=path[_0x6bc4('0xd3')](_0x2080a6,_0x292819);var _0x2bdb7e=util[_0x6bc4('0xcc')](_0x6bc4('0xd8'),_0xc19597[_0x6bc4('0xc2')]['id'],_0x292819);var _0x546f96=path[_0x6bc4('0xd3')](_0x2080a6,_0x2bdb7e);var _0x3ce5e7=[];_0x3ce5e7[_0x6bc4('0xb7')]({'model':db[_0x6bc4('0x75')],'as':_0x6bc4('0x75'),'attributes':['id','fullname'],'raw':!![]});_0x3ce5e7[_0x6bc4('0xb7')]({'model':db['CmContact'],'as':_0x6bc4('0x69'),'attributes':['id',_0x6bc4('0xd9'),'lastName'],'raw':!![]});var _0x3953a3=[{'model':db[_0x6bc4('0xc5')],'as':'Messages','attributes':['id','body',_0x6bc4('0x7d'),_0x6bc4('0xda'),_0x6bc4('0xdb'),'read'],'include':_0x3ce5e7}];_0x3953a3[_0x6bc4('0xb7')]({'model':db[_0x6bc4('0xdc')],'as':_0x6bc4('0xdd'),'attributes':['id','name']});_0x3953a3[_0x6bc4('0xb7')]({'model':db[_0x6bc4('0x75')],'as':'Owner','attributes':['id',_0x6bc4('0x32')]});return db[_0x6bc4('0xbb')][_0x6bc4('0x64')]({'where':{'id':_0xc19597[_0x6bc4('0xc2')]['id']},'include':_0x3953a3})[_0x6bc4('0x2a')](handleEntityNotFound(_0x109fd2,null))[_0x6bc4('0x2a')](function(_0x234ffe){if(_0x234ffe){var _0x4862fb=_0x234ffe['get']({'plain':!![]});fs[_0x6bc4('0xde')](_0x53d389);var _0x1231cc={'channel':_0x6bc4('0xdf'),'account':_0x4862fb['Account'][_0x6bc4('0x2e')],'agent':_0x4862fb[_0x6bc4('0xe0')]?_0x4862fb['Owner']['fullname']:_0x6bc4('0xe1'),'createdAt':moment(_0x4862fb[_0x6bc4('0x7d')])['format'](_0x6bc4('0xe2'))[_0x6bc4('0x9e')](),'closedAt':_0x4862fb[_0x6bc4('0x3c')]?moment(_0x4862fb[_0x6bc4('0xe3')])[_0x6bc4('0xcc')](_0x6bc4('0xe2'))[_0x6bc4('0x9e')]():'','disposition':_0x4862fb[_0x6bc4('0xe4')],'messages':_(_0x4862fb['Messages'])[_0x6bc4('0x88')]({'secret':![]})[_0x6bc4('0x31')](function(_0x3abc3c){return{'date':moment(_0x3abc3c['createdAt'])[_0x6bc4('0xcc')](_0x6bc4('0xe2'))[_0x6bc4('0x9e')](),'sender':_0x3abc3c[_0x6bc4('0xda')]==='out'?_0x3abc3c[_0x6bc4('0x75')]?_0x3abc3c[_0x6bc4('0x75')][_0x6bc4('0x32')]:_0x6bc4('0xe5'):_0x3abc3c[_0x6bc4('0x69')][_0x6bc4('0xd9')]+(_0x3abc3c['Contact'][_0x6bc4('0xe6')]?'\x20'+_0x3abc3c['Contact'][_0x6bc4('0xe6')]:''),'body':_0x3abc3c['body'],'direction':_0x3abc3c['direction']==='out'?'A':'C','secret':_0x3abc3c['secret'],'read':_0x3abc3c[_0x6bc4('0x84')]};})['value']()};return ejs[_0x6bc4('0xe7')](path[_0x6bc4('0xd3')](config['root'],_0x6bc4('0xd5'),_0x6bc4('0xe8'),_0x6bc4('0xe9')),{'interaction':_0x1231cc})[_0x6bc4('0x2a')](function(_0x48a9a2){var _0x391316=path[_0x6bc4('0xd3')](_0x53d389,_0x6bc4('0xea')+_0x4862fb['id']+'-'+_0x292819+_0x6bc4('0xeb'));var _0x595a92={'path':_0x391316,'channel':_0x6bc4('0xdf'),'interactionId':_0x4862fb['id']};return pdf[_0x6bc4('0xec')](_0x48a9a2,_0x595a92);})['then'](function(){return new BPromise(function(_0x3153b5,_0x54bbc1){zipdir(_0x53d389,{'saveTo':_0x546f96},function(_0x5713fa,_0xa04101){if(_0x5713fa)return _0x54bbc1(_0x5713fa);return _0x3153b5(_0xa04101);});})[_0x6bc4('0x2a')](function(){return new BPromise(function(_0x40e00f,_0x5c7e69){rimraf(_0x53d389,function(_0x261809){if(_0x261809)_0x5c7e69(_0x261809);return _0x40e00f();});});})[_0x6bc4('0x2a')](function(){return _0x109fd2[_0x6bc4('0xd2')](_0x546f96,_0x2bdb7e,function(_0x39cd1d){if(_0x39cd1d){console[_0x6bc4('0xed')](_0x6bc4('0xee'),_0x39cd1d);}else{fs[_0x6bc4('0xef')](_0x546f96);}});});});}else{return _0x109fd2[_0x6bc4('0x1d')](0xc8);}})[_0x6bc4('0x37')](handleError(_0x109fd2,null));};
\ No newline at end of file
index 5de2bc4..d24b06c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b0e=['update','remove','getUsers','then','Users','map','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','SmsMessage','setMaxListeners','save'];(function(_0x1e8ac9,_0x1bd0fe){var _0x4c895c=function(_0x3cc2f5){while(--_0x3cc2f5){_0x1e8ac9['push'](_0x1e8ac9['shift']());}};_0x4c895c(++_0x1bd0fe);}(_0x0b0e,0x187));var _0xe0b0=function(_0x239eaf,_0x1968b4){_0x239eaf=_0x239eaf-0x0;var _0x8863f7=_0x0b0e[_0x239eaf];return _0x8863f7;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xe0b0('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0xe0b0('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xe0b0('0x3')](0x0);var events={'afterCreate':_0xe0b0('0x4'),'afterUpdate':_0xe0b0('0x5'),'afterDestroy':_0xe0b0('0x6')};function emitEvent(_0x38a058){return function(_0x399e67,_0x185efa,_0x30e20d){_0x399e67[_0xe0b0('0x7')]({'attributes':['id'],'raw':!![]})[_0xe0b0('0x8')](function(_0x5cf9cc){_0x399e67['setDataValue'](_0xe0b0('0x9'),_0x5cf9cc[_0xe0b0('0xa')](function(_0xc4a085){return{'id':_0xc4a085['id']};}));return SmsMessage[_0xe0b0('0xb')]({'where':{'SmsInteractionId':_0x399e67['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x338e7c){_0x399e67[_0xe0b0('0xc')]('unreadMessages',_0x338e7c[_0xe0b0('0xd')]);SmsInteractionEvents[_0xe0b0('0xe')](_0x38a058+':'+_0x399e67['id'],_0x399e67);SmsInteractionEvents['emit'](_0x38a058,_0x399e67);_0x30e20d(null);})[_0xe0b0('0xf')](_0x30e20d(null));};}for(var e in events){if(events[_0xe0b0('0x10')](e)){var event=events[e];SmsInteraction[_0xe0b0('0x11')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents;
\ No newline at end of file
+var _0x1eba=['remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','SmsInteraction','SmsMessage','update'];(function(_0x599b83,_0xee62a4){var _0x4b5714=function(_0x19319f){while(--_0x19319f){_0x599b83['push'](_0x599b83['shift']());}};_0x4b5714(++_0xee62a4);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0x1eba[_0x15dbca];return _0x326533;};'use strict';var EventEmitter=require(_0xa1eb('0x0'));var SmsInteraction=require(_0xa1eb('0x1'))['db'][_0xa1eb('0x2')];var SmsMessage=require(_0xa1eb('0x1'))['db'][_0xa1eb('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa1eb('0x4'),'afterDestroy':_0xa1eb('0x5')};function emitEvent(_0x16a13a){return function(_0xf9d704,_0x138789,_0x2933d0){_0xf9d704[_0xa1eb('0x6')]({'attributes':['id'],'raw':!![]})[_0xa1eb('0x7')](function(_0x39a5a3){_0xf9d704[_0xa1eb('0x8')](_0xa1eb('0x9'),_0x39a5a3[_0xa1eb('0xa')](function(_0x54d235){return{'id':_0x54d235['id']};}));return SmsMessage[_0xa1eb('0xb')]({'where':{'SmsInteractionId':_0xf9d704['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x219802){_0xf9d704['setDataValue'](_0xa1eb('0xc'),_0x219802['length']);SmsInteractionEvents[_0xa1eb('0xd')](_0x16a13a+':'+_0xf9d704['id'],_0xf9d704);SmsInteractionEvents['emit'](_0x16a13a,_0xf9d704);_0x2933d0(null);})[_0xa1eb('0xe')](_0x2933d0(null));};}for(var e in events){if(events[_0xa1eb('0xf')](e)){var event=events[e];SmsInteraction[_0xa1eb('0x10')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents;
\ No newline at end of file
index 55f506d..972de7b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xca59=['./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xca59,0x1e9));var _0x9ca5=function(_0x34b0ae,_0x1e4b3b){_0x34b0ae=_0x34b0ae-0x0;var _0x405660=_0xca59[_0x34b0ae];return _0x405660;};'use strict';var _=require(_0x9ca5('0x0'));var util=require('util');var logger=require(_0x9ca5('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9ca5('0x2'));var fs=require('fs');var path=require(_0x9ca5('0x3'));var rimraf=require(_0x9ca5('0x4'));var config=require(_0x9ca5('0x5'));var attributes=require(_0x9ca5('0x6'));module[_0x9ca5('0x7')]=function(_0x37eda5,_0x4e4a0d){return _0x37eda5[_0x9ca5('0x8')](_0x9ca5('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bdaf0,_0x7a77ca,_0x24ee91){if(_0x1bdaf0[_0x9ca5('0xa')](_0x9ca5('0xb'))){_0x1bdaf0[_0x9ca5('0xc')]=moment()[_0x9ca5('0xd')](_0x9ca5('0xe'));}_0x24ee91(null,_0x1bdaf0);}}});};
\ No newline at end of file
+var _0xdc23=['./smsInteraction.attributes','exports','SmsInteraction','changed','closed','closedAt','format','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x565606,_0x2b3dc2){var _0x10a0b2=function(_0x43814){while(--_0x43814){_0x565606['push'](_0x565606['shift']());}};_0x10a0b2(++_0x2b3dc2);}(_0xdc23,0xca));var _0x3dc2=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0xdc23[_0x5d0609];return _0xaa3fd1;};'use strict';var _=require(_0x3dc2('0x0'));var util=require('util');var logger=require(_0x3dc2('0x1'))(_0x3dc2('0x2'));var moment=require(_0x3dc2('0x3'));var BPromise=require(_0x3dc2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3dc2('0x5'));var rimraf=require(_0x3dc2('0x6'));var config=require(_0x3dc2('0x7'));var attributes=require(_0x3dc2('0x8'));module[_0x3dc2('0x9')]=function(_0x497bc9,_0x4a24cd){return _0x497bc9['define'](_0x3dc2('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27a6bf,_0x525428,_0x212fe7){if(_0x27a6bf[_0x3dc2('0xb')](_0x3dc2('0xc'))){_0x27a6bf[_0x3dc2('0xd')]=moment()[_0x3dc2('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x212fe7(null,_0x27a6bf);}}});};
\ No newline at end of file
index 90059d3..f4ac8dc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6298=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','ids','omit','body','AddTags','lodash','util','bluebird'];(function(_0x50d0a5,_0x3ece14){var _0x16a49c=function(_0x5857fb){while(--_0x5857fb){_0x50d0a5['push'](_0x50d0a5['shift']());}};_0x16a49c(++_0x3ece14);}(_0x6298,0x12a));var _0x8629=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6298[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8629('0x0'));var util=require(_0x8629('0x1'));var moment=require('moment');var BPromise=require(_0x8629('0x2'));var rs=require(_0x8629('0x3'));var fs=require('fs');var Redis=require(_0x8629('0x4'));var db=require(_0x8629('0x5'))['db'];var utils=require(_0x8629('0x6'));var logger=require('../../config/logger')(_0x8629('0x7'));var config=require(_0x8629('0x8'));var jayson=require(_0x8629('0x9'));var client=jayson[_0x8629('0xa')][_0x8629('0xb')]({'port':0x232a});config['redis']=_[_0x8629('0xc')](config[_0x8629('0xd')],{'host':_0x8629('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8629('0xd')]));require(_0x8629('0xf'))[_0x8629('0x10')](socket);function respondWithRpcPromise(_0x34124e,_0xece6fc,_0x28d2ea){return new BPromise(function(_0x1d8653,_0x405792){return client['request'](_0x34124e,_0x28d2ea)[_0x8629('0x11')](function(_0x4cfa35){logger[_0x8629('0x12')](_0x8629('0x13'),_0xece6fc,_0x8629('0x14'));logger[_0x8629('0x15')](_0x8629('0x16'),_0xece6fc,_0x8629('0x14'),JSON[_0x8629('0x17')](_0x4cfa35));if(_0x4cfa35['error']){if(_0x4cfa35[_0x8629('0x18')][_0x8629('0x19')]===0x1f4){logger[_0x8629('0x18')]('SmsInteraction,\x20%s,\x20%s',_0xece6fc,_0x4cfa35[_0x8629('0x18')][_0x8629('0x1a')]);return _0x405792(_0x4cfa35[_0x8629('0x18')][_0x8629('0x1a')]);}logger['error'](_0x8629('0x13'),_0xece6fc,_0x4cfa35[_0x8629('0x18')][_0x8629('0x1a')]);return _0x1d8653(_0x4cfa35[_0x8629('0x18')][_0x8629('0x1a')]);}else{logger[_0x8629('0x12')]('SmsInteraction,\x20%s,\x20%s',_0xece6fc,_0x8629('0x14'));_0x1d8653(_0x4cfa35[_0x8629('0x1b')][_0x8629('0x1a')]);}})[_0x8629('0x1c')](function(_0x4121ff){logger[_0x8629('0x18')](_0x8629('0x13'),_0xece6fc,_0x4121ff);_0x405792(_0x4121ff);});});}exports[_0x8629('0x1d')]=function(_0x14454a){var _0x28720c=this;return new Promise(function(_0x456b8f,_0x2acdb0){return db[_0x8629('0x1e')][_0x8629('0x1f')](_0x14454a['body'],{'raw':_0x14454a[_0x8629('0x20')]?_0x14454a[_0x8629('0x20')][_0x8629('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14454a[_0x8629('0x20')]?_0x14454a[_0x8629('0x20')][_0x8629('0x22')]||null:null,'attributes':_0x14454a[_0x8629('0x20')]?_0x14454a[_0x8629('0x20')][_0x8629('0x23')]||null:null,'limit':_0x14454a[_0x8629('0x20')]?_0x14454a[_0x8629('0x20')][_0x8629('0x24')]||null:null})[_0x8629('0x11')](function(_0x2820ee){logger['info'](_0x8629('0x1d'),_0x14454a);logger[_0x8629('0x15')]('UpdateSmsInteraction',_0x14454a,JSON['stringify'](_0x2820ee));_0x456b8f(_0x2820ee);})[_0x8629('0x1c')](function(_0x231762){logger['error'](_0x8629('0x1d'),_0x231762[_0x8629('0x1a')],_0x14454a);_0x2acdb0(_0x28720c[_0x8629('0x18')](0x1f4,_0x231762[_0x8629('0x1a')]));});});};exports[_0x8629('0x25')]=function(_0x1b778f){return new Promise(function(_0x772ee5,_0x361d7a){return db[_0x8629('0x1e')][_0x8629('0x26')]({'where':_0x1b778f[_0x8629('0x20')]?_0x1b778f['options'][_0x8629('0x22')]||null:null})[_0x8629('0x11')](function(_0x398b93){if(_0x398b93){return _0x398b93['addTags'](_0x1b778f['body'][_0x8629('0x27')],_[_0x8629('0x28')](_0x1b778f[_0x8629('0x29')],[_0x8629('0x27'),'id'])||{});}})['spread'](function(_0x239a82){logger[_0x8629('0x12')](_0x8629('0x2a'),_0x1b778f);logger[_0x8629('0x15')](_0x8629('0x2a'),_0x1b778f,JSON['stringify'](_0x239a82));_0x772ee5(_0x239a82);})[_0x8629('0x1c')](function(_0x581730){logger[_0x8629('0x18')]('AddTags',_0x581730[_0x8629('0x1a')],_0x1b778f);_0x361d7a(_this[_0x8629('0x18')](0x1f4,_0x581730['message']));});});};
\ No newline at end of file
+var _0x3d01=['body','ids','omit','AddTags','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','attributes','limit','debug','AddTagsToSmsInteraction','find','where','addTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d01,0x14c));var _0x13d0=function(_0x66921d,_0x415b2a){_0x66921d=_0x66921d-0x0;var _0x5866f5=_0x3d01[_0x66921d];return _0x5866f5;};'use strict';var _=require('lodash');var util=require(_0x13d0('0x0'));var moment=require(_0x13d0('0x1'));var BPromise=require(_0x13d0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x13d0('0x3'))['db'];var utils=require(_0x13d0('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x13d0('0x5'));var jayson=require(_0x13d0('0x6'));var client=jayson[_0x13d0('0x7')][_0x13d0('0x8')]({'port':0x232a});config[_0x13d0('0x9')]=_[_0x13d0('0xa')](config[_0x13d0('0x9')],{'host':_0x13d0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x13d0('0x9')]));require(_0x13d0('0xc'))['register'](socket);function respondWithRpcPromise(_0x133e68,_0x5ac5e5,_0x30a5ed){return new BPromise(function(_0x104d1a,_0x4b1f3a){return client[_0x13d0('0xd')](_0x133e68,_0x30a5ed)[_0x13d0('0xe')](function(_0xb6635f){logger[_0x13d0('0xf')](_0x13d0('0x10'),_0x5ac5e5,_0x13d0('0x11'));logger['debug'](_0x13d0('0x12'),_0x5ac5e5,_0x13d0('0x11'),JSON[_0x13d0('0x13')](_0xb6635f));if(_0xb6635f[_0x13d0('0x14')]){if(_0xb6635f[_0x13d0('0x14')][_0x13d0('0x15')]===0x1f4){logger[_0x13d0('0x14')](_0x13d0('0x10'),_0x5ac5e5,_0xb6635f[_0x13d0('0x14')][_0x13d0('0x16')]);return _0x4b1f3a(_0xb6635f['error']['message']);}logger['error'](_0x13d0('0x10'),_0x5ac5e5,_0xb6635f[_0x13d0('0x14')]['message']);return _0x104d1a(_0xb6635f[_0x13d0('0x14')]['message']);}else{logger[_0x13d0('0xf')](_0x13d0('0x10'),_0x5ac5e5,_0x13d0('0x11'));_0x104d1a(_0xb6635f[_0x13d0('0x17')][_0x13d0('0x16')]);}})[_0x13d0('0x18')](function(_0x29bf84){logger['error'](_0x13d0('0x10'),_0x5ac5e5,_0x29bf84);_0x4b1f3a(_0x29bf84);});});}exports[_0x13d0('0x19')]=function(_0x19dfd9){var _0x21cd25=this;return new Promise(function(_0x1abde9,_0x1f0071){return db[_0x13d0('0x1a')][_0x13d0('0x1b')](_0x19dfd9['body'],{'raw':_0x19dfd9[_0x13d0('0x1c')]?_0x19dfd9[_0x13d0('0x1c')][_0x13d0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19dfd9[_0x13d0('0x1c')]?_0x19dfd9[_0x13d0('0x1c')]['where']||null:null,'attributes':_0x19dfd9[_0x13d0('0x1c')]?_0x19dfd9[_0x13d0('0x1c')][_0x13d0('0x1e')]||null:null,'limit':_0x19dfd9[_0x13d0('0x1c')]?_0x19dfd9[_0x13d0('0x1c')][_0x13d0('0x1f')]||null:null})[_0x13d0('0xe')](function(_0x216cce){logger['info'](_0x13d0('0x19'),_0x19dfd9);logger[_0x13d0('0x20')](_0x13d0('0x19'),_0x19dfd9,JSON['stringify'](_0x216cce));_0x1abde9(_0x216cce);})['catch'](function(_0x5bfb80){logger['error'](_0x13d0('0x19'),_0x5bfb80['message'],_0x19dfd9);_0x1f0071(_0x21cd25[_0x13d0('0x14')](0x1f4,_0x5bfb80[_0x13d0('0x16')]));});});};exports[_0x13d0('0x21')]=function(_0x49e435){return new Promise(function(_0x494e91,_0x49deae){return db[_0x13d0('0x1a')][_0x13d0('0x22')]({'where':_0x49e435[_0x13d0('0x1c')]?_0x49e435['options'][_0x13d0('0x23')]||null:null})['then'](function(_0x941c4){if(_0x941c4){return _0x941c4[_0x13d0('0x24')](_0x49e435[_0x13d0('0x25')][_0x13d0('0x26')],_[_0x13d0('0x27')](_0x49e435[_0x13d0('0x25')],[_0x13d0('0x26'),'id'])||{});}})['spread'](function(_0x5ac707){logger['info'](_0x13d0('0x28'),_0x49e435);logger['debug'](_0x13d0('0x28'),_0x49e435,JSON[_0x13d0('0x13')](_0x5ac707));_0x494e91(_0x5ac707);})[_0x13d0('0x18')](function(_0x2b5541){logger[_0x13d0('0x14')](_0x13d0('0x28'),_0x2b5541[_0x13d0('0x16')],_0x49e435);_0x49deae(_this[_0x13d0('0x14')](0x1f4,_0x2b5541[_0x13d0('0x16')]));});});};
\ No newline at end of file
index c622114..b1286e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x98e1=['removeListener','register','length','smsInteraction:','save','remove'];(function(_0x1bd586,_0x37d004){var _0x157380=function(_0x48e2af){while(--_0x48e2af){_0x1bd586['push'](_0x1bd586['shift']());}};_0x157380(++_0x37d004);}(_0x98e1,0x88));var _0x198e=function(_0x549df8,_0x3dd238){_0x549df8=_0x549df8-0x0;var _0x18ca1b=_0x98e1[_0x549df8];return _0x18ca1b;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x198e('0x0'),_0x198e('0x1'),'update'];function createListener(_0x23f4a6,_0x28e7f5){return function(_0x1b75fd){_0x28e7f5['emit'](_0x23f4a6,_0x1b75fd);};}function removeListener(_0x4f03a6,_0x13f79e){return function(){SmsInteractionEvents[_0x198e('0x2')](_0x4f03a6,_0x13f79e);};}exports[_0x198e('0x3')]=function(_0x20f2ac){for(var _0x5f4cc7=0x0,_0x461ddd=events[_0x198e('0x4')];_0x5f4cc7<_0x461ddd;_0x5f4cc7++){var _0x12e632=events[_0x5f4cc7];var _0x4724ec=createListener(_0x198e('0x5')+_0x12e632,_0x20f2ac);SmsInteractionEvents['on'](_0x12e632,_0x4724ec);}};
\ No newline at end of file
+var _0x6942=['remove','update','register','length','save'];(function(_0x359e67,_0x1fcfcb){var _0x5ab505=function(_0x4797a5){while(--_0x4797a5){_0x359e67['push'](_0x359e67['shift']());}};_0x5ab505(++_0x1fcfcb);}(_0x6942,0x149));var _0x2694=function(_0x326d76,_0x5d83a8){_0x326d76=_0x326d76-0x0;var _0x3fc606=_0x6942[_0x326d76];return _0x3fc606;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2694('0x0'),_0x2694('0x1'),_0x2694('0x2')];function createListener(_0x8b5239,_0x20087c){return function(_0x1acd35){_0x20087c['emit'](_0x8b5239,_0x1acd35);};}function removeListener(_0x5ef0f3,_0x3ac290){return function(){SmsInteractionEvents['removeListener'](_0x5ef0f3,_0x3ac290);};}exports[_0x2694('0x3')]=function(_0x465126){for(var _0x4ca411=0x0,_0x1b72c7=events[_0x2694('0x4')];_0x4ca411<_0x1b72c7;_0x4ca411++){var _0x343ffb=events[_0x4ca411];var _0x3e91ed=createListener('smsInteraction:'+_0x343ffb,_0x465126);SmsInteractionEvents['on'](_0x343ffb,_0x3e91ed);}};
\ No newline at end of file
index 04c5e4c..ab9cb5a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa7be=['post','tracked','smsmessage:create','/:id/status','status','update','put','accept','/:id/reject','reject','/:id','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','/describe','isAuthenticated','show'];(function(_0x3ae8f4,_0x2920f4){var _0x367312=function(_0x4dffbf){while(--_0x4dffbf){_0x3ae8f4['push'](_0x3ae8f4['shift']());}};_0x367312(++_0x2920f4);}(_0xa7be,0xfc));var _0xea7b=function(_0x30d99f,_0xddd46a){_0x30d99f=_0x30d99f-0x0;var _0xc832ee=_0xa7be[_0x30d99f];return _0xc832ee;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xea7b('0x0'));var express=require(_0xea7b('0x1'));var router=express[_0xea7b('0x2')]();var fs_extra=require(_0xea7b('0x3'));var auth=require(_0xea7b('0x4'));var interaction=require(_0xea7b('0x5'));var config=require(_0xea7b('0x6'));var controller=require(_0xea7b('0x7'));router[_0xea7b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xea7b('0x8')](_0xea7b('0x9'),auth[_0xea7b('0xa')](),controller['describe']);router[_0xea7b('0x8')]('/:id',auth[_0xea7b('0xa')](),controller[_0xea7b('0xb')]);router[_0xea7b('0xc')]('/',auth[_0xea7b('0xa')](),interaction[_0xea7b('0xd')]('sms',_0xea7b('0xe')),controller['create']);router['post'](_0xea7b('0xf'),controller[_0xea7b('0x10')]);router['put']('/:id',auth[_0xea7b('0xa')](),controller[_0xea7b('0x11')]);router[_0xea7b('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0xea7b('0x13')]);router[_0xea7b('0x12')](_0xea7b('0x14'),auth[_0xea7b('0xa')](),controller[_0xea7b('0x15')]);router['delete'](_0xea7b('0x16'),auth[_0xea7b('0xa')](),controller['destroy']);module[_0xea7b('0x17')]=router;
\ No newline at end of file
+var _0x8dae=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','smsmessage:create','create','/:id/status','status','update','/:id/reject','reject','destroy','exports','multer'];(function(_0xa9b393,_0x47b9bb){var _0x54fe27=function(_0xa04eeb){while(--_0xa04eeb){_0xa9b393['push'](_0xa9b393['shift']());}};_0x54fe27(++_0x47b9bb);}(_0x8dae,0xa7));var _0xe8da=function(_0x3bb46a,_0x4d3a51){_0x3bb46a=_0x3bb46a-0x0;var _0xf30f8f=_0x8dae[_0x3bb46a];return _0xf30f8f;};'use strict';var multer=require(_0xe8da('0x0'));var util=require('util');var path=require(_0xe8da('0x1'));var timeout=require(_0xe8da('0x2'));var express=require(_0xe8da('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe8da('0x4'));var interaction=require(_0xe8da('0x5'));var config=require(_0xe8da('0x6'));var controller=require('./smsMessage.controller');router[_0xe8da('0x7')]('/',auth[_0xe8da('0x8')](),controller[_0xe8da('0x9')]);router[_0xe8da('0x7')](_0xe8da('0xa'),auth[_0xe8da('0x8')](),controller[_0xe8da('0xb')]);router['get'](_0xe8da('0xc'),auth['isAuthenticated'](),controller[_0xe8da('0xd')]);router[_0xe8da('0xe')]('/',auth[_0xe8da('0x8')](),interaction['tracked']('sms',_0xe8da('0xf')),controller[_0xe8da('0x10')]);router[_0xe8da('0xe')](_0xe8da('0x11'),controller[_0xe8da('0x12')]);router['put']('/:id',auth[_0xe8da('0x8')](),controller[_0xe8da('0x13')]);router['put']('/:id/accept',auth[_0xe8da('0x8')](),controller['accept']);router['put'](_0xe8da('0x14'),auth['isAuthenticated'](),controller[_0xe8da('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe8da('0x16')]);module[_0xe8da('0x17')]=router;
\ No newline at end of file
index 123ba19..d27e3d5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc910=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xc910,0x109));var _0x0c91=function(_0x36303b,_0x127fed){_0x36303b=_0x36303b-0x0;var _0x2d4556=_0xc910[_0x36303b];return _0x2d4556;};'use strict';var Sequelize=require(_0x0c91('0x0'));module[_0x0c91('0x1')]={'body':{'type':Sequelize[_0x0c91('0x2')](_0x0c91('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0c91('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0c91('0x5')]('in',_0x0c91('0x6')),'defaultValue':_0x0c91('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0c91('0x7')](0xbe)},'phone':{'type':Sequelize[_0x0c91('0x7')]},'readAt':{'type':Sequelize[_0x0c91('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0c91('0x7')]},'providerResponse':{'type':Sequelize[_0x0c91('0x2')]}};
\ No newline at end of file
+var _0x2873=['STRING','BOOLEAN','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x2873,0x1f2));var _0x3287=function(_0x1c360a,_0x3c8412){_0x1c360a=_0x1c360a-0x0;var _0xebe775=_0x2873[_0x1c360a];return _0xebe775;};'use strict';var Sequelize=require(_0x3287('0x0'));module[_0x3287('0x1')]={'body':{'type':Sequelize[_0x3287('0x2')](_0x3287('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3287('0x4')]('in',_0x3287('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x3287('0x6')](0xbe)},'phone':{'type':Sequelize[_0x3287('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x3287('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3287('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}};
\ No newline at end of file
index 2d785f0..fe45fca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1b64=['socket.io-emitter','./smsMessage.socket','register','client','http','request','then','debug','request\x20sent','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','params','include','options','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','rejectmessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','Status','results','groupName','DELIVERED','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x183a70,_0x215eaa){var _0x2fa7ed=function(_0x2be344){while(--_0x2be344){_0x183a70['push'](_0x183a70['shift']());}};_0x2fa7ed(++_0x215eaa);}(_0x1b64,0x76));var _0x41b6=function(_0x4472d4,_0xc66225){_0x4472d4=_0x4472d4-0x0;var _0x3dafa8=_0x1b64[_0x4472d4];return _0x3dafa8;};'use strict';var emlformat=require(_0x41b6('0x0'));var rimraf=require(_0x41b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41b6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x41b6('0x3'));var util=require(_0x41b6('0x4'));var path=require(_0x41b6('0x5'));var sox=require(_0x41b6('0x6'));var csv=require('to-csv');var ejs=require(_0x41b6('0x7'));var fs=require('fs');var fs_extra=require(_0x41b6('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x41b6('0x9'));var deskjs=require(_0x41b6('0xa'));var toCsv=require(_0x41b6('0xb'));var querystring=require(_0x41b6('0xc'));var Papa=require(_0x41b6('0xd'));var Redis=require(_0x41b6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x41b6('0xf'));var as=require(_0x41b6('0x10'));var hardwareService=require(_0x41b6('0x11'));var logger=require(_0x41b6('0x12'))(_0x41b6('0x13'));var utils=require(_0x41b6('0x14'));var config=require(_0x41b6('0x15'));var licenseUtil=require(_0x41b6('0x16'));var db=require(_0x41b6('0x17'))['db'];config[_0x41b6('0x18')]=_[_0x41b6('0x19')](config[_0x41b6('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x41b6('0x1a'))(new Redis(config[_0x41b6('0x18')]));require(_0x41b6('0x1b'))[_0x41b6('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x41b6('0x1d')][_0x41b6('0x1e')]({'port':0x232c});var client9002=jayson[_0x41b6('0x1d')][_0x41b6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1d4441,_0x1bd0b0,_0x30f076,_0x4805de){return new BPromise(function(_0x13ce57,_0xf0d6ae){var _0x1b2500=_0x4805de||client;return _0x1b2500[_0x41b6('0x1f')](_0x1d4441,_0x30f076)[_0x41b6('0x20')](function(_0x47feb9){logger['info']('SmsMessage,\x20%s,\x20%s',_0x1bd0b0,'request\x20sent');logger[_0x41b6('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1bd0b0,_0x41b6('0x22'),JSON[_0x41b6('0x23')](_0x47feb9));if(_0x47feb9[_0x41b6('0x24')]){if(_0x47feb9[_0x41b6('0x24')][_0x41b6('0x25')]===0x1f4){logger[_0x41b6('0x24')]('SmsMessage,\x20%s,\x20%s',_0x1bd0b0,_0x47feb9['error'][_0x41b6('0x26')]);return _0xf0d6ae(_0x47feb9['error'][_0x41b6('0x26')]);}logger[_0x41b6('0x24')](_0x41b6('0x27'),_0x1bd0b0,_0x47feb9[_0x41b6('0x24')][_0x41b6('0x26')]);return _0x13ce57(_0x47feb9[_0x41b6('0x24')][_0x41b6('0x26')]);}else{logger[_0x41b6('0x28')](_0x41b6('0x27'),_0x1bd0b0,_0x41b6('0x22'));_0x13ce57(_0x47feb9[_0x41b6('0x29')]['message']);}})[_0x41b6('0x2a')](function(_0x2c1290){logger['error'](_0x41b6('0x27'),_0x1bd0b0,_0x2c1290);_0xf0d6ae(_0x2c1290);});});}function respondWithStatusCode(_0x358872,_0x4f98de){_0x4f98de=_0x4f98de||0xcc;return function(_0x22d399){if(_0x22d399){return _0x358872[_0x41b6('0x2b')](_0x4f98de);}return _0x358872[_0x41b6('0x2c')](_0x4f98de)['end']();};}function respondWithResult(_0x40a466,_0x5e431d){_0x5e431d=_0x5e431d||0xc8;return function(_0x49142b){if(_0x49142b){return _0x40a466['status'](_0x5e431d)[_0x41b6('0x2d')](_0x49142b);}};}function respondWithFilteredResult(_0x425c16,_0x5b5ca7){return function(_0x2dee1f){if(_0x2dee1f){var _0x45f9e2=typeof _0x5b5ca7[_0x41b6('0x2e')]===_0x41b6('0x2f')&&typeof _0x5b5ca7[_0x41b6('0x30')]==='undefined';var _0x5a0554=_0x2dee1f[_0x41b6('0x31')];var _0x37bd7a=_0x45f9e2?0x0:_0x5b5ca7[_0x41b6('0x2e')];var _0x56b365=_0x45f9e2?_0x2dee1f[_0x41b6('0x31')]:_0x5b5ca7[_0x41b6('0x2e')]+_0x5b5ca7['limit'];var _0x27a737;if(_0x56b365>=_0x5a0554){_0x56b365=_0x5a0554;_0x27a737=0xc8;}else{_0x27a737=0xce;}_0x425c16[_0x41b6('0x2c')](_0x27a737);return _0x425c16[_0x41b6('0x32')](_0x41b6('0x33'),_0x37bd7a+'-'+_0x56b365+'/'+_0x5a0554)[_0x41b6('0x2d')](_0x2dee1f);}return null;};}function patchUpdates(_0x2ac3a7){return function(_0x1c47b1){try{jsonpatch['apply'](_0x1c47b1,_0x2ac3a7,!![]);}catch(_0x13562f){return BPromise['reject'](_0x13562f);}return _0x1c47b1['save']();};}function saveUpdates(_0x2235fd,_0x4cf4d5){return function(_0x207412){if(_0x207412){return _0x207412[_0x41b6('0x34')](_0x2235fd)[_0x41b6('0x20')](function(_0x435639){return _0x435639;});}return null;};}function removeEntity(_0xc97805,_0x3c5141){return function(_0x420e40){if(_0x420e40){return _0x420e40[_0x41b6('0x35')]()['then'](function(){_0xc97805[_0x41b6('0x2c')](0xcc)[_0x41b6('0x36')]();});}};}function handleEntityNotFound(_0x326e10,_0x459186){return function(_0x13f0ad){if(!_0x13f0ad){_0x326e10[_0x41b6('0x2b')](0x194);}return _0x13f0ad;};}function handleError(_0x462340,_0x58112e){_0x58112e=_0x58112e||0x1f4;return function(_0x69277a){logger['error'](_0x69277a['stack']);if(_0x69277a[_0x41b6('0x37')]){delete _0x69277a[_0x41b6('0x37')];}_0x462340[_0x41b6('0x2c')](_0x58112e)[_0x41b6('0x38')](_0x69277a);};}exports[_0x41b6('0x39')]=function(_0x2291ba,_0x5b7e9d){var _0x19a73e={},_0x4313a5={},_0x2c3f43={'count':0x0,'rows':[]};var _0x442ec7=_[_0x41b6('0x3a')](db[_0x41b6('0x3b')][_0x41b6('0x3c')],function(_0x565ff8){return{'name':_0x565ff8[_0x41b6('0x3d')],'type':_0x565ff8[_0x41b6('0x3e')][_0x41b6('0x3f')]};});_0x4313a5[_0x41b6('0x40')]=_[_0x41b6('0x3a')](_0x442ec7,_0x41b6('0x37'));_0x4313a5[_0x41b6('0x41')]=_[_0x41b6('0x42')](_0x2291ba[_0x41b6('0x41')]);_0x4313a5[_0x41b6('0x43')]=_[_0x41b6('0x44')](_0x4313a5[_0x41b6('0x40')],_0x4313a5['query']);_0x19a73e[_0x41b6('0x45')]=_[_0x41b6('0x44')](_0x4313a5[_0x41b6('0x40')],qs[_0x41b6('0x46')](_0x2291ba[_0x41b6('0x41')][_0x41b6('0x46')]));_0x19a73e['attributes']=_0x19a73e['attributes'][_0x41b6('0x47')]?_0x19a73e[_0x41b6('0x45')]:_0x4313a5['model'];if(!_0x2291ba['query'][_0x41b6('0x48')](_0x41b6('0x49'))){_0x19a73e[_0x41b6('0x30')]=qs['limit'](_0x2291ba['query'][_0x41b6('0x30')]);_0x19a73e['offset']=qs[_0x41b6('0x2e')](_0x2291ba[_0x41b6('0x41')][_0x41b6('0x2e')]);}_0x19a73e[_0x41b6('0x4a')]=qs[_0x41b6('0x4b')](_0x2291ba['query'][_0x41b6('0x4b')]);_0x19a73e[_0x41b6('0x4c')]=qs[_0x41b6('0x43')](_[_0x41b6('0x4d')](_0x2291ba['query'],_0x4313a5[_0x41b6('0x43')]),_0x442ec7);if(_0x2291ba[_0x41b6('0x41')][_0x41b6('0x4e')]){_0x19a73e[_0x41b6('0x4c')]=_[_0x41b6('0x4f')](_0x19a73e[_0x41b6('0x4c')],{'$or':_[_0x41b6('0x3a')](_0x442ec7,function(_0x575e7f){if(_0x575e7f[_0x41b6('0x3e')]!=='VIRTUAL'){var _0x2e2764={};_0x2e2764[_0x575e7f[_0x41b6('0x37')]]={'$like':'%'+_0x2291ba['query'][_0x41b6('0x4e')]+'%'};return _0x2e2764;}})});}_0x19a73e=_[_0x41b6('0x4f')]({},_0x19a73e,_0x2291ba['options']);var _0x11c8b5={'where':_0x19a73e[_0x41b6('0x4c')]};return db[_0x41b6('0x3b')][_0x41b6('0x31')](_0x11c8b5)[_0x41b6('0x20')](function(_0x5ac0b2){_0x2c3f43[_0x41b6('0x31')]=_0x5ac0b2;if(_0x2291ba[_0x41b6('0x41')][_0x41b6('0x50')]){_0x19a73e['include']=[{'all':!![]}];}return db[_0x41b6('0x3b')][_0x41b6('0x51')](_0x19a73e);})[_0x41b6('0x20')](function(_0xdc4286){_0x2c3f43[_0x41b6('0x52')]=_0xdc4286;return _0x2c3f43;})[_0x41b6('0x20')](respondWithFilteredResult(_0x5b7e9d,_0x19a73e))[_0x41b6('0x2a')](handleError(_0x5b7e9d,null));};exports['show']=function(_0x565d5d,_0x2384bb){var _0x4eca3a={'raw':!![],'where':{'id':_0x565d5d[_0x41b6('0x53')]['id']}},_0x489186={};_0x489186[_0x41b6('0x40')]=_[_0x41b6('0x42')](db[_0x41b6('0x3b')][_0x41b6('0x3c')]);_0x489186[_0x41b6('0x41')]=_['keys'](_0x565d5d[_0x41b6('0x41')]);_0x489186['filters']=_[_0x41b6('0x44')](_0x489186['model'],_0x489186[_0x41b6('0x41')]);_0x4eca3a[_0x41b6('0x45')]=_['intersection'](_0x489186[_0x41b6('0x40')],qs[_0x41b6('0x46')](_0x565d5d[_0x41b6('0x41')][_0x41b6('0x46')]));_0x4eca3a[_0x41b6('0x45')]=_0x4eca3a[_0x41b6('0x45')][_0x41b6('0x47')]?_0x4eca3a[_0x41b6('0x45')]:_0x489186[_0x41b6('0x40')];if(_0x565d5d[_0x41b6('0x41')][_0x41b6('0x50')]){_0x4eca3a[_0x41b6('0x54')]=[{'all':!![]}];}_0x4eca3a=_[_0x41b6('0x4f')]({},_0x4eca3a,_0x565d5d[_0x41b6('0x55')]);return db[_0x41b6('0x3b')][_0x41b6('0x56')](_0x4eca3a)['then'](handleEntityNotFound(_0x2384bb,null))['then'](respondWithResult(_0x2384bb,null))['catch'](handleError(_0x2384bb,null));};exports[_0x41b6('0x57')]=function(_0x208dd9,_0x1d5dad){return db[_0x41b6('0x3b')][_0x41b6('0x57')](_0x208dd9[_0x41b6('0x58')],{})[_0x41b6('0x20')](respondWithResult(_0x1d5dad,0xc9))[_0x41b6('0x2a')](handleError(_0x1d5dad,null));};exports[_0x41b6('0x34')]=function(_0x1b69e3,_0x4f918c){if(_0x1b69e3['body']['id']){delete _0x1b69e3[_0x41b6('0x58')]['id'];}return db[_0x41b6('0x3b')][_0x41b6('0x56')]({'where':{'id':_0x1b69e3[_0x41b6('0x53')]['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0x4f918c,null))[_0x41b6('0x20')](saveUpdates(_0x1b69e3[_0x41b6('0x58')],null))[_0x41b6('0x20')](respondWithResult(_0x4f918c,null))[_0x41b6('0x2a')](handleError(_0x4f918c,null));};exports[_0x41b6('0x35')]=function(_0x2a5185,_0xea54ab){return db['SmsMessage'][_0x41b6('0x56')]({'where':{'id':_0x2a5185[_0x41b6('0x53')]['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0xea54ab,null))[_0x41b6('0x20')](removeEntity(_0xea54ab,null))['catch'](handleError(_0xea54ab,null));};exports['describe']=function(_0x1e8ddb,_0x575806){return db['SmsMessage'][_0x41b6('0x59')]()[_0x41b6('0x20')](respondWithResult(_0x575806,null))[_0x41b6('0x2a')](handleError(_0x575806,null));};var interaction_log=require(_0x41b6('0x12'))(_0x41b6('0x5a'));exports[_0x41b6('0x5b')]=function(_0x5f033b,_0x2a00b7,_0x3b6854){var _0x4f52fe={'agent':{},'channel':_0x41b6('0x5c')};if(_0x5f033b[_0x41b6('0x58')]['id']){delete _0x5f033b['body']['id'];}_0x5f033b[_0x41b6('0x58')][_0x41b6('0x5d')]=!![];_0x5f033b[_0x41b6('0x58')][_0x41b6('0x5e')]=moment()[_0x41b6('0x5f')](_0x41b6('0x60'));_0x5f033b[_0x41b6('0x58')][_0x41b6('0x61')]=_0x5f033b[_0x41b6('0x58')][_0x41b6('0x61')]||_0x5f033b['user']['id'];_0x4f52fe[_0x41b6('0x62')]['id']=_0x5f033b[_0x41b6('0x58')][_0x41b6('0x61')];return db[_0x41b6('0x3b')][_0x41b6('0x56')]({'where':{'id':_0x5f033b[_0x41b6('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2a00b7,null))[_0x41b6('0x20')](saveUpdates(_0x5f033b[_0x41b6('0x58')],null))[_0x41b6('0x20')](function(_0x5bf8d5){if(_0x5bf8d5){_0x4f52fe['message']=_0x5bf8d5[_0x41b6('0x63')]({'plain':!![]});return db[_0x41b6('0x64')]['find']({'where':{'id':_0x5bf8d5['SmsInteractionId']}});}return null;})[_0x41b6('0x20')](handleEntityNotFound(_0x2a00b7,null))['then'](function(_0x32fa3f){if(_0x32fa3f){return _0x32fa3f[_0x41b6('0x34')]({'UserId':_0x5f033b[_0x41b6('0x58')]['UserId'],'read1stAt':_[_0x41b6('0x65')](_0x32fa3f[_0x41b6('0x66')])?moment()['format'](_0x41b6('0x60')):undefined});}return null;})['then'](function(_0x29863e){if(_0x29863e){_0x4f52fe[_0x41b6('0x67')]=_0x29863e[_0x41b6('0x63')]({'plain':!![]});interaction_log[_0x41b6('0x28')](_0x41b6('0x68'),_0x5f033b[_0x41b6('0x69')]['id'],_0x5f033b['user']['name'],_0x5f033b[_0x41b6('0x69')]['role'],_0x4f52fe[_0x41b6('0x67')]['id'],_0x5f033b[_0x41b6('0x58')]?JSON[_0x41b6('0x23')](_0x5f033b[_0x41b6('0x58')]):'null');return respondWithRpcPromise('AcceptMessage',_0x41b6('0x6a'),_0x4f52fe);}return null;})[_0x41b6('0x20')](function(_0x5c5941){var _0x3c175c=_0x41b6('0x6b')+_0x5c5941['message'][_0x41b6('0x6c')];return db[_0x41b6('0x6d')][_0x41b6('0x41')](_0x3c175c,{'type':db[_0x41b6('0x6e')][_0x41b6('0x6f')][_0x41b6('0x70')],'raw':!![]})[_0x41b6('0x20')](function(_0x4cd1e1){return _0x4cd1e1;});})[_0x41b6('0x20')](function(_0x2f21b5){if(_0x2f21b5){_0x4f52fe[_0x41b6('0x26')][_0x41b6('0x71')]=_0x2f21b5[0x0];if(!_0x5f033b[_0x41b6('0x58')]['UserId'])return;return db[_0x41b6('0x72')][_0x41b6('0x56')]({'where':{'id':_0x5f033b[_0x41b6('0x58')][_0x41b6('0x61')],'role':_0x41b6('0x62')},'attributes':['id',_0x41b6('0x37'),_0x41b6('0x73'),_0x41b6('0x74'),_0x41b6('0x75')],'raw':!![]});}return null;})[_0x41b6('0x20')](function(_0x139c80){if(!_0x139c80)return null;_0x4f52fe[_0x41b6('0x26')][_0x41b6('0x62')]=_0x139c80;return _0x4f52fe;})[_0x41b6('0x20')](function(_0x58bec3){if(_0x58bec3){if(_0x5f033b[_0x41b6('0x58')][_0x41b6('0x76')]){_0x4f52fe['message'][_0x41b6('0x77')]=util[_0x41b6('0x5f')](_0x41b6('0x78'),_0x5f033b['user'][_0x41b6('0x37')]);_0x4f52fe['message'][_0x41b6('0x79')]=_0x4f52fe['channel'];_0x4f52fe[_0x41b6('0x26')][_0x41b6('0x7a')]=_0x4f52fe[_0x41b6('0x79')];_0x4f52fe['message'][_0x41b6('0x7b')]='accept';return respondWithRpcPromise(_0x41b6('0x7c'),_0x41b6('0x7c'),{'event':'acceptmessage','message':_0x4f52fe[_0x41b6('0x26')]},client9002)[_0x41b6('0x20')](function(){return _0x4f52fe;});}return _0x4f52fe;}return null;})[_0x41b6('0x20')](respondWithResult(_0x2a00b7,null))[_0x41b6('0x2a')](handleError(_0x2a00b7,null));};var interaction_log=require(_0x41b6('0x12'))(_0x41b6('0x5a'));exports['reject']=function(_0x4fd1ca,_0xa6a559,_0x5ad34e){var _0x4c866f={'agent':{},'channel':_0x41b6('0x5c')};if(_0x4fd1ca[_0x41b6('0x58')]['id']){delete _0x4fd1ca['body']['id'];}_0x4fd1ca[_0x41b6('0x58')][_0x41b6('0x61')]=_0x4fd1ca[_0x41b6('0x58')][_0x41b6('0x61')]||_0x4fd1ca[_0x41b6('0x69')]['id'];_0x4c866f['agent']['id']=_0x4fd1ca['body'][_0x41b6('0x61')];return db[_0x41b6('0x3b')][_0x41b6('0x56')]({'where':{'id':_0x4fd1ca[_0x41b6('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xa6a559,null))['then'](function(_0x17405a){if(_0x17405a){_0x4c866f[_0x41b6('0x26')]=_0x17405a[_0x41b6('0x63')]({'plain':!![]});return db[_0x41b6('0x64')]['find']({'where':{'id':_0x17405a['SmsInteractionId']}});}return null;})[_0x41b6('0x20')](handleEntityNotFound(_0xa6a559,null))[_0x41b6('0x20')](function(_0x442eaa){if(_0x442eaa){_0x4c866f[_0x41b6('0x67')]=_0x442eaa[_0x41b6('0x63')]({'plain':!![]});interaction_log['info'](_0x41b6('0x7d'),_0x4fd1ca['user']['id'],_0x4fd1ca[_0x41b6('0x69')][_0x41b6('0x37')],_0x4fd1ca[_0x41b6('0x69')]['role'],_0x4c866f['interaction']['id'],_0x4fd1ca[_0x41b6('0x58')]?JSON['stringify'](_0x4fd1ca[_0x41b6('0x58')]):_0x41b6('0x7e'));return respondWithRpcPromise('RejectMessage',_0x41b6('0x7f'),_0x4c866f);}return null;})[_0x41b6('0x20')](function(_0x2919b2){var _0x5d1f05='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2919b2[_0x41b6('0x26')][_0x41b6('0x6c')];return db[_0x41b6('0x6d')][_0x41b6('0x41')](_0x5d1f05,{'type':db[_0x41b6('0x6e')][_0x41b6('0x6f')][_0x41b6('0x70')],'raw':!![]})['then'](function(_0x104edd){return _0x104edd;});})[_0x41b6('0x20')](function(_0x6afdc3){if(_0x6afdc3){_0x4c866f['message'][_0x41b6('0x71')]=_0x6afdc3[0x0];if(!_0x4fd1ca['body'][_0x41b6('0x61')])return;return db[_0x41b6('0x72')][_0x41b6('0x56')]({'where':{'id':_0x4fd1ca['body']['UserId'],'role':_0x41b6('0x62')},'attributes':['id','name',_0x41b6('0x73'),_0x41b6('0x74'),_0x41b6('0x75')],'raw':!![]});}return null;})['then'](function(_0x5851ab){if(!_0x5851ab)return null;_0x4c866f[_0x41b6('0x26')]['agent']=_0x5851ab;return _0x4c866f;})[_0x41b6('0x20')](function(_0x206e03){if(_0x206e03){_0x206e03[_0x41b6('0x26')]['interface']=util[_0x41b6('0x5f')]('SIP/%s',_0x4fd1ca[_0x41b6('0x69')][_0x41b6('0x37')]);_0x206e03[_0x41b6('0x26')][_0x41b6('0x79')]=_0x4c866f['channel'];_0x206e03[_0x41b6('0x26')][_0x41b6('0x7a')]=_0x4c866f[_0x41b6('0x79')];_0x206e03[_0x41b6('0x26')][_0x41b6('0x7b')]='reject';respondWithRpcPromise(_0x41b6('0x7c'),'EventManager',{'event':_0x41b6('0x80'),'message':_0x206e03[_0x41b6('0x26')]},client9002);return _0x4c866f;}return null;})[_0x41b6('0x20')](respondWithResult(_0xa6a559,null))[_0x41b6('0x2a')](handleError(_0xa6a559,null));};exports['status']=function(_0x460e5b,_0x4ae731,_0x2d24c0){if(_0x460e5b[_0x41b6('0x58')]['id']){delete _0x460e5b['body']['id'];}var _0x2cec77;return db[_0x41b6('0x3b')][_0x41b6('0x56')]({'where':{'id':_0x460e5b[_0x41b6('0x53')]['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0x4ae731,null))[_0x41b6('0x20')](function(_0x1687ce){if(_0x1687ce){_0x2cec77=_0x1687ce;return db['SmsAccount'][_0x41b6('0x56')]({'where':{'id':_0x1687ce[_0x41b6('0x81')]}});}})[_0x41b6('0x20')](handleEntityNotFound(_0x4ae731,null))[_0x41b6('0x20')](function(_0x1675f8){if(_0x1675f8){logger['debug'](_0x41b6('0x82'),_0x41b6('0x2c'),_0x41b6('0x83'),_0x1675f8[_0x41b6('0x3e')],util[_0x41b6('0x84')](_0x460e5b[_0x41b6('0x58')],{'showHidden':![],'depth':null}));switch(_0x1675f8[_0x41b6('0x3e')]){case _0x41b6('0x85'):if(_0x460e5b[_0x41b6('0x58')][_0x41b6('0x86')]&&_0x460e5b[_0x41b6('0x58')][_0x41b6('0x86')]===_0x2cec77['messageId']){return _0x2cec77['update']({'read':!![]});}else{logger[_0x41b6('0x24')](_0x41b6('0x87'),_0x41b6('0x2c'),'twilio',util[_0x41b6('0x84')](_0x460e5b[_0x41b6('0x58')],{'showHidden':![],'depth':null}));}break;case _0x41b6('0x88'):if(_0x460e5b[_0x41b6('0x58')]['MessageUUID']&&_0x460e5b[_0x41b6('0x58')][_0x41b6('0x89')]===_0x2cec77[_0x41b6('0x8a')]&&_[_0x41b6('0x8b')](['sent','delivered'],_0x460e5b[_0x41b6('0x58')][_0x41b6('0x8c')])>=0x0){return _0x2cec77['update']({'read':!![]});}else{logger[_0x41b6('0x24')](_0x41b6('0x87'),_0x41b6('0x2c'),'plivio',util[_0x41b6('0x84')](_0x460e5b[_0x41b6('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2691ce=_0x460e5b['body'][_0x41b6('0x8d')][0x0];if(_0x2691ce[_0x41b6('0x2c')][_0x41b6('0x8e')]===_0x41b6('0x8f')){return _0x2cec77['update']({'read':!![]});}else{logger['error'](_0x41b6('0x87'),'status','infobip',util['inspect'](_0x460e5b[_0x41b6('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x2cec77;}})[_0x41b6('0x20')](respondWithResult(_0x4ae731,null))[_0x41b6('0x2a')](handleError(_0x4ae731,null));};
\ No newline at end of file
+var _0xb2af=['describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','role','RejectMessage','rejectMessage','rejectmessage','SmsAccount','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','create','body'];(function(_0x481c09,_0x3d524e){var _0x356803=function(_0x56d780){while(--_0x56d780){_0x481c09['push'](_0x481c09['shift']());}};_0x356803(++_0x3d524e);}(_0xb2af,0xd2));var _0xfb2a=function(_0x19d2b4,_0x380628){_0x19d2b4=_0x19d2b4-0x0;var _0x122fbe=_0xb2af[_0x19d2b4];return _0x122fbe;};'use strict';var emlformat=require(_0xfb2a('0x0'));var rimraf=require(_0xfb2a('0x1'));var zipdir=require(_0xfb2a('0x2'));var jsonpatch=require(_0xfb2a('0x3'));var rp=require('request-promise');var moment=require(_0xfb2a('0x4'));var BPromise=require(_0xfb2a('0x5'));var Mustache=require(_0xfb2a('0x6'));var util=require(_0xfb2a('0x7'));var path=require(_0xfb2a('0x8'));var sox=require('sox');var csv=require(_0xfb2a('0x9'));var ejs=require(_0xfb2a('0xa'));var fs=require('fs');var fs_extra=require(_0xfb2a('0xb'));var _=require('lodash');var squel=require(_0xfb2a('0xc'));var crypto=require(_0xfb2a('0xd'));var jsforce=require(_0xfb2a('0xe'));var deskjs=require(_0xfb2a('0xf'));var toCsv=require(_0xfb2a('0x9'));var querystring=require(_0xfb2a('0x10'));var Papa=require(_0xfb2a('0x11'));var Redis=require(_0xfb2a('0x12'));var authService=require(_0xfb2a('0x13'));var qs=require(_0xfb2a('0x14'));var as=require(_0xfb2a('0x15'));var hardwareService=require(_0xfb2a('0x16'));var logger=require(_0xfb2a('0x17'))(_0xfb2a('0x18'));var utils=require(_0xfb2a('0x19'));var config=require(_0xfb2a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xfb2a('0x1b')](config[_0xfb2a('0x1c')],{'host':_0xfb2a('0x1d'),'port':0x18eb});var socket=require(_0xfb2a('0x1e'))(new Redis(config['redis']));require(_0xfb2a('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xfb2a('0x20')]['http']({'port':0x232c});var client9002=jayson['client'][_0xfb2a('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x18febb,_0x49ecbd,_0x193af1,_0x2e5c81){return new BPromise(function(_0xc85abf,_0x30c000){var _0x214051=_0x2e5c81||client;return _0x214051[_0xfb2a('0x22')](_0x18febb,_0x193af1)['then'](function(_0x1cdaa7){logger[_0xfb2a('0x23')](_0xfb2a('0x24'),_0x49ecbd,_0xfb2a('0x25'));logger['debug'](_0xfb2a('0x26'),_0x49ecbd,'request\x20sent',JSON[_0xfb2a('0x27')](_0x1cdaa7));if(_0x1cdaa7[_0xfb2a('0x28')]){if(_0x1cdaa7[_0xfb2a('0x28')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x49ecbd,_0x1cdaa7['error'][_0xfb2a('0x29')]);return _0x30c000(_0x1cdaa7[_0xfb2a('0x28')][_0xfb2a('0x29')]);}logger[_0xfb2a('0x28')](_0xfb2a('0x24'),_0x49ecbd,_0x1cdaa7[_0xfb2a('0x28')][_0xfb2a('0x29')]);return _0xc85abf(_0x1cdaa7[_0xfb2a('0x28')][_0xfb2a('0x29')]);}else{logger[_0xfb2a('0x23')]('SmsMessage,\x20%s,\x20%s',_0x49ecbd,_0xfb2a('0x25'));_0xc85abf(_0x1cdaa7['result'][_0xfb2a('0x29')]);}})[_0xfb2a('0x2a')](function(_0x5726b3){logger[_0xfb2a('0x28')](_0xfb2a('0x24'),_0x49ecbd,_0x5726b3);_0x30c000(_0x5726b3);});});}function respondWithStatusCode(_0x4eb16e,_0x446dfa){_0x446dfa=_0x446dfa||0xcc;return function(_0x388bfe){if(_0x388bfe){return _0x4eb16e['sendStatus'](_0x446dfa);}return _0x4eb16e[_0xfb2a('0x2b')](_0x446dfa)[_0xfb2a('0x2c')]();};}function respondWithResult(_0x1988ca,_0x38a7fa){_0x38a7fa=_0x38a7fa||0xc8;return function(_0x3f9190){if(_0x3f9190){return _0x1988ca[_0xfb2a('0x2b')](_0x38a7fa)[_0xfb2a('0x2d')](_0x3f9190);}};}function respondWithFilteredResult(_0x3f3da3,_0x111c67){return function(_0x3d6768){if(_0x3d6768){var _0x4b79e5=typeof _0x111c67[_0xfb2a('0x2e')]===_0xfb2a('0x2f')&&typeof _0x111c67[_0xfb2a('0x30')]===_0xfb2a('0x2f');var _0x34d2b3=_0x3d6768[_0xfb2a('0x31')];var _0x2cecb=_0x4b79e5?0x0:_0x111c67[_0xfb2a('0x2e')];var _0x5dcbff=_0x4b79e5?_0x3d6768[_0xfb2a('0x31')]:_0x111c67['offset']+_0x111c67['limit'];var _0x1c3551;if(_0x5dcbff>=_0x34d2b3){_0x5dcbff=_0x34d2b3;_0x1c3551=0xc8;}else{_0x1c3551=0xce;}_0x3f3da3[_0xfb2a('0x2b')](_0x1c3551);return _0x3f3da3[_0xfb2a('0x32')]('Content-Range',_0x2cecb+'-'+_0x5dcbff+'/'+_0x34d2b3)[_0xfb2a('0x2d')](_0x3d6768);}return null;};}function patchUpdates(_0x4ee3b9){return function(_0xf08fc8){try{jsonpatch[_0xfb2a('0x33')](_0xf08fc8,_0x4ee3b9,!![]);}catch(_0x127ece){return BPromise[_0xfb2a('0x34')](_0x127ece);}return _0xf08fc8[_0xfb2a('0x35')]();};}function saveUpdates(_0x153a5b,_0x5e6369){return function(_0x4966b3){if(_0x4966b3){return _0x4966b3[_0xfb2a('0x36')](_0x153a5b)[_0xfb2a('0x37')](function(_0x51a4f3){return _0x51a4f3;});}return null;};}function removeEntity(_0x4b6e4d,_0x149df0){return function(_0x239576){if(_0x239576){return _0x239576[_0xfb2a('0x38')]()[_0xfb2a('0x37')](function(){_0x4b6e4d[_0xfb2a('0x2b')](0xcc)[_0xfb2a('0x2c')]();});}};}function handleEntityNotFound(_0x50826d,_0x1e715c){return function(_0xd3af4b){if(!_0xd3af4b){_0x50826d[_0xfb2a('0x39')](0x194);}return _0xd3af4b;};}function handleError(_0x237d07,_0x2a4588){_0x2a4588=_0x2a4588||0x1f4;return function(_0x35d6b5){logger[_0xfb2a('0x28')](_0x35d6b5[_0xfb2a('0x3a')]);if(_0x35d6b5[_0xfb2a('0x3b')]){delete _0x35d6b5[_0xfb2a('0x3b')];}_0x237d07[_0xfb2a('0x2b')](_0x2a4588)[_0xfb2a('0x3c')](_0x35d6b5);};}exports[_0xfb2a('0x3d')]=function(_0x17bb29,_0xee9d74){var _0x2d336c={},_0x319f14={},_0x30fa14={'count':0x0,'rows':[]};var _0x318e84=_[_0xfb2a('0x3e')](db[_0xfb2a('0x3f')][_0xfb2a('0x40')],function(_0x455b7e){return{'name':_0x455b7e[_0xfb2a('0x41')],'type':_0x455b7e[_0xfb2a('0x42')][_0xfb2a('0x43')]};});_0x319f14[_0xfb2a('0x44')]=_[_0xfb2a('0x3e')](_0x318e84,_0xfb2a('0x3b'));_0x319f14['query']=_[_0xfb2a('0x45')](_0x17bb29[_0xfb2a('0x46')]);_0x319f14[_0xfb2a('0x47')]=_[_0xfb2a('0x48')](_0x319f14[_0xfb2a('0x44')],_0x319f14[_0xfb2a('0x46')]);_0x2d336c['attributes']=_[_0xfb2a('0x48')](_0x319f14[_0xfb2a('0x44')],qs[_0xfb2a('0x49')](_0x17bb29['query'][_0xfb2a('0x49')]));_0x2d336c[_0xfb2a('0x4a')]=_0x2d336c[_0xfb2a('0x4a')][_0xfb2a('0x4b')]?_0x2d336c['attributes']:_0x319f14[_0xfb2a('0x44')];if(!_0x17bb29[_0xfb2a('0x46')][_0xfb2a('0x4c')](_0xfb2a('0x4d'))){_0x2d336c[_0xfb2a('0x30')]=qs[_0xfb2a('0x30')](_0x17bb29[_0xfb2a('0x46')][_0xfb2a('0x30')]);_0x2d336c[_0xfb2a('0x2e')]=qs['offset'](_0x17bb29['query']['offset']);}_0x2d336c[_0xfb2a('0x4e')]=qs[_0xfb2a('0x4f')](_0x17bb29['query']['sort']);_0x2d336c['where']=qs[_0xfb2a('0x47')](_[_0xfb2a('0x50')](_0x17bb29[_0xfb2a('0x46')],_0x319f14[_0xfb2a('0x47')]),_0x318e84);if(_0x17bb29['query'][_0xfb2a('0x51')]){_0x2d336c[_0xfb2a('0x52')]=_[_0xfb2a('0x53')](_0x2d336c['where'],{'$or':_['map'](_0x318e84,function(_0x5613c1){if(_0x5613c1[_0xfb2a('0x42')]!==_0xfb2a('0x54')){var _0x29ccd1={};_0x29ccd1[_0x5613c1[_0xfb2a('0x3b')]]={'$like':'%'+_0x17bb29[_0xfb2a('0x46')][_0xfb2a('0x51')]+'%'};return _0x29ccd1;}})});}_0x2d336c=_[_0xfb2a('0x53')]({},_0x2d336c,_0x17bb29[_0xfb2a('0x55')]);var _0x13673f={'where':_0x2d336c['where']};return db['SmsMessage']['count'](_0x13673f)[_0xfb2a('0x37')](function(_0x493c8b){_0x30fa14[_0xfb2a('0x31')]=_0x493c8b;if(_0x17bb29['query']['includeAll']){_0x2d336c[_0xfb2a('0x56')]=[{'all':!![]}];}return db[_0xfb2a('0x3f')]['findAll'](_0x2d336c);})[_0xfb2a('0x37')](function(_0x4a411d){_0x30fa14[_0xfb2a('0x57')]=_0x4a411d;return _0x30fa14;})['then'](respondWithFilteredResult(_0xee9d74,_0x2d336c))[_0xfb2a('0x2a')](handleError(_0xee9d74,null));};exports[_0xfb2a('0x58')]=function(_0x5d7901,_0x5008a9){var _0x1cc576={'raw':!![],'where':{'id':_0x5d7901[_0xfb2a('0x59')]['id']}},_0x120a2f={};_0x120a2f['model']=_[_0xfb2a('0x45')](db[_0xfb2a('0x3f')][_0xfb2a('0x40')]);_0x120a2f['query']=_[_0xfb2a('0x45')](_0x5d7901['query']);_0x120a2f['filters']=_[_0xfb2a('0x48')](_0x120a2f[_0xfb2a('0x44')],_0x120a2f['query']);_0x1cc576[_0xfb2a('0x4a')]=_[_0xfb2a('0x48')](_0x120a2f[_0xfb2a('0x44')],qs[_0xfb2a('0x49')](_0x5d7901[_0xfb2a('0x46')][_0xfb2a('0x49')]));_0x1cc576[_0xfb2a('0x4a')]=_0x1cc576[_0xfb2a('0x4a')][_0xfb2a('0x4b')]?_0x1cc576[_0xfb2a('0x4a')]:_0x120a2f[_0xfb2a('0x44')];if(_0x5d7901[_0xfb2a('0x46')][_0xfb2a('0x5a')]){_0x1cc576['include']=[{'all':!![]}];}_0x1cc576=_[_0xfb2a('0x53')]({},_0x1cc576,_0x5d7901[_0xfb2a('0x55')]);return db[_0xfb2a('0x3f')][_0xfb2a('0x5b')](_0x1cc576)[_0xfb2a('0x37')](handleEntityNotFound(_0x5008a9,null))[_0xfb2a('0x37')](respondWithResult(_0x5008a9,null))['catch'](handleError(_0x5008a9,null));};exports[_0xfb2a('0x5c')]=function(_0x27afc7,_0x21fad5){return db[_0xfb2a('0x3f')]['create'](_0x27afc7['body'],{})['then'](respondWithResult(_0x21fad5,0xc9))[_0xfb2a('0x2a')](handleError(_0x21fad5,null));};exports[_0xfb2a('0x36')]=function(_0x4ff545,_0x5a44ac){if(_0x4ff545['body']['id']){delete _0x4ff545[_0xfb2a('0x5d')]['id'];}return db[_0xfb2a('0x3f')]['find']({'where':{'id':_0x4ff545[_0xfb2a('0x59')]['id']}})[_0xfb2a('0x37')](handleEntityNotFound(_0x5a44ac,null))[_0xfb2a('0x37')](saveUpdates(_0x4ff545['body'],null))[_0xfb2a('0x37')](respondWithResult(_0x5a44ac,null))['catch'](handleError(_0x5a44ac,null));};exports['destroy']=function(_0x5c3256,_0x5a619a){return db['SmsMessage'][_0xfb2a('0x5b')]({'where':{'id':_0x5c3256[_0xfb2a('0x59')]['id']}})[_0xfb2a('0x37')](handleEntityNotFound(_0x5a619a,null))['then'](removeEntity(_0x5a619a,null))[_0xfb2a('0x2a')](handleError(_0x5a619a,null));};exports['describe']=function(_0xf09f7b,_0x24eb80){return db[_0xfb2a('0x3f')][_0xfb2a('0x5e')]()[_0xfb2a('0x37')](respondWithResult(_0x24eb80,null))[_0xfb2a('0x2a')](handleError(_0x24eb80,null));};var interaction_log=require(_0xfb2a('0x17'))('sms-interactions');exports[_0xfb2a('0x5f')]=function(_0x3dcd63,_0x128589,_0x52073a){var _0x57c434={'agent':{},'channel':_0xfb2a('0x60')};if(_0x3dcd63[_0xfb2a('0x5d')]['id']){delete _0x3dcd63[_0xfb2a('0x5d')]['id'];}_0x3dcd63['body'][_0xfb2a('0x61')]=!![];_0x3dcd63[_0xfb2a('0x5d')][_0xfb2a('0x62')]=moment()[_0xfb2a('0x63')](_0xfb2a('0x64'));_0x3dcd63[_0xfb2a('0x5d')][_0xfb2a('0x65')]=_0x3dcd63[_0xfb2a('0x5d')]['UserId']||_0x3dcd63['user']['id'];_0x57c434[_0xfb2a('0x66')]['id']=_0x3dcd63['body']['UserId'];return db[_0xfb2a('0x3f')]['find']({'where':{'id':_0x3dcd63[_0xfb2a('0x59')]['id'],'UserId':null}})[_0xfb2a('0x37')](handleEntityNotFound(_0x128589,null))[_0xfb2a('0x37')](saveUpdates(_0x3dcd63[_0xfb2a('0x5d')],null))[_0xfb2a('0x37')](function(_0x51dee3){if(_0x51dee3){_0x57c434['message']=_0x51dee3[_0xfb2a('0x67')]({'plain':!![]});return db['SmsInteraction'][_0xfb2a('0x5b')]({'where':{'id':_0x51dee3[_0xfb2a('0x68')]}});}return null;})[_0xfb2a('0x37')](handleEntityNotFound(_0x128589,null))[_0xfb2a('0x37')](function(_0x523c71){if(_0x523c71){return _0x523c71['update']({'UserId':_0x3dcd63['body'][_0xfb2a('0x65')],'read1stAt':_[_0xfb2a('0x69')](_0x523c71[_0xfb2a('0x6a')])?moment()['format'](_0xfb2a('0x64')):undefined});}return null;})[_0xfb2a('0x37')](function(_0x28a55b){if(_0x28a55b){_0x57c434[_0xfb2a('0x6b')]=_0x28a55b['get']({'plain':!![]});interaction_log[_0xfb2a('0x23')](_0xfb2a('0x6c'),_0x3dcd63[_0xfb2a('0x6d')]['id'],_0x3dcd63[_0xfb2a('0x6d')][_0xfb2a('0x3b')],_0x3dcd63[_0xfb2a('0x6d')]['role'],_0x57c434[_0xfb2a('0x6b')]['id'],_0x3dcd63[_0xfb2a('0x5d')]?JSON[_0xfb2a('0x27')](_0x3dcd63[_0xfb2a('0x5d')]):_0xfb2a('0x6e'));return respondWithRpcPromise(_0xfb2a('0x6f'),_0xfb2a('0x70'),_0x57c434);}return null;})[_0xfb2a('0x37')](function(_0x33f42c){var _0x2c1b41=_0xfb2a('0x71')+_0x33f42c[_0xfb2a('0x29')]['ContactId'];return db[_0xfb2a('0x72')][_0xfb2a('0x46')](_0x2c1b41,{'type':db[_0xfb2a('0x73')][_0xfb2a('0x74')][_0xfb2a('0x75')],'raw':!![]})[_0xfb2a('0x37')](function(_0x15f706){return _0x15f706;});})['then'](function(_0x1f8147){if(_0x1f8147){_0x57c434[_0xfb2a('0x29')][_0xfb2a('0x76')]=_0x1f8147[0x0];if(!_0x3dcd63['body'][_0xfb2a('0x65')])return;return db[_0xfb2a('0x77')][_0xfb2a('0x5b')]({'where':{'id':_0x3dcd63[_0xfb2a('0x5d')][_0xfb2a('0x65')],'role':_0xfb2a('0x66')},'attributes':['id',_0xfb2a('0x3b'),_0xfb2a('0x78'),'email',_0xfb2a('0x79')],'raw':!![]});}return null;})[_0xfb2a('0x37')](function(_0x5a08b5){if(!_0x5a08b5)return null;_0x57c434['message']['agent']=_0x5a08b5;return _0x57c434;})['then'](function(_0x405bdf){if(_0x405bdf){if(_0x3dcd63['body'][_0xfb2a('0x7a')]){_0x57c434[_0xfb2a('0x29')][_0xfb2a('0x7b')]=util['format'](_0xfb2a('0x7c'),_0x3dcd63['user'][_0xfb2a('0x3b')]);_0x57c434['message']['channel']=_0x57c434[_0xfb2a('0x7d')];_0x57c434[_0xfb2a('0x29')][_0xfb2a('0x7e')]=_0x57c434[_0xfb2a('0x7d')];_0x57c434[_0xfb2a('0x29')][_0xfb2a('0x7f')]=_0xfb2a('0x5f');return respondWithRpcPromise(_0xfb2a('0x80'),_0xfb2a('0x80'),{'event':_0xfb2a('0x81'),'message':_0x57c434[_0xfb2a('0x29')]},client9002)[_0xfb2a('0x37')](function(){return _0x57c434;});}return _0x57c434;}return null;})[_0xfb2a('0x37')](respondWithResult(_0x128589,null))['catch'](handleError(_0x128589,null));};var interaction_log=require(_0xfb2a('0x17'))(_0xfb2a('0x82'));exports[_0xfb2a('0x34')]=function(_0x2acc25,_0x31b310,_0x3cea35){var _0x8cfb6c={'agent':{},'channel':'sms'};if(_0x2acc25[_0xfb2a('0x5d')]['id']){delete _0x2acc25[_0xfb2a('0x5d')]['id'];}_0x2acc25[_0xfb2a('0x5d')][_0xfb2a('0x65')]=_0x2acc25[_0xfb2a('0x5d')][_0xfb2a('0x65')]||_0x2acc25[_0xfb2a('0x6d')]['id'];_0x8cfb6c[_0xfb2a('0x66')]['id']=_0x2acc25[_0xfb2a('0x5d')][_0xfb2a('0x65')];return db[_0xfb2a('0x3f')][_0xfb2a('0x5b')]({'where':{'id':_0x2acc25[_0xfb2a('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x31b310,null))[_0xfb2a('0x37')](function(_0x4d359d){if(_0x4d359d){_0x8cfb6c[_0xfb2a('0x29')]=_0x4d359d[_0xfb2a('0x67')]({'plain':!![]});return db['SmsInteraction'][_0xfb2a('0x5b')]({'where':{'id':_0x4d359d[_0xfb2a('0x68')]}});}return null;})[_0xfb2a('0x37')](handleEntityNotFound(_0x31b310,null))[_0xfb2a('0x37')](function(_0x1786fe){if(_0x1786fe){_0x8cfb6c[_0xfb2a('0x6b')]=_0x1786fe[_0xfb2a('0x67')]({'plain':!![]});interaction_log[_0xfb2a('0x23')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2acc25[_0xfb2a('0x6d')]['id'],_0x2acc25[_0xfb2a('0x6d')]['name'],_0x2acc25[_0xfb2a('0x6d')][_0xfb2a('0x83')],_0x8cfb6c[_0xfb2a('0x6b')]['id'],_0x2acc25['body']?JSON[_0xfb2a('0x27')](_0x2acc25['body']):_0xfb2a('0x6e'));return respondWithRpcPromise(_0xfb2a('0x84'),_0xfb2a('0x85'),_0x8cfb6c);}return null;})['then'](function(_0x558e78){var _0x11f8e4=_0xfb2a('0x71')+_0x558e78[_0xfb2a('0x29')]['ContactId'];return db[_0xfb2a('0x72')][_0xfb2a('0x46')](_0x11f8e4,{'type':db['Sequelize'][_0xfb2a('0x74')]['SELECT'],'raw':!![]})[_0xfb2a('0x37')](function(_0x16447){return _0x16447;});})[_0xfb2a('0x37')](function(_0x40b0f3){if(_0x40b0f3){_0x8cfb6c['message'][_0xfb2a('0x76')]=_0x40b0f3[0x0];if(!_0x2acc25[_0xfb2a('0x5d')][_0xfb2a('0x65')])return;return db['User'][_0xfb2a('0x5b')]({'where':{'id':_0x2acc25[_0xfb2a('0x5d')][_0xfb2a('0x65')],'role':_0xfb2a('0x66')},'attributes':['id',_0xfb2a('0x3b'),_0xfb2a('0x78'),'email',_0xfb2a('0x79')],'raw':!![]});}return null;})[_0xfb2a('0x37')](function(_0x3754e5){if(!_0x3754e5)return null;_0x8cfb6c[_0xfb2a('0x29')][_0xfb2a('0x66')]=_0x3754e5;return _0x8cfb6c;})[_0xfb2a('0x37')](function(_0x1cd7d1){if(_0x1cd7d1){_0x1cd7d1[_0xfb2a('0x29')][_0xfb2a('0x7b')]=util[_0xfb2a('0x63')](_0xfb2a('0x7c'),_0x2acc25[_0xfb2a('0x6d')][_0xfb2a('0x3b')]);_0x1cd7d1[_0xfb2a('0x29')][_0xfb2a('0x7d')]=_0x8cfb6c['channel'];_0x1cd7d1['message'][_0xfb2a('0x7e')]=_0x8cfb6c[_0xfb2a('0x7d')];_0x1cd7d1[_0xfb2a('0x29')][_0xfb2a('0x7f')]=_0xfb2a('0x34');respondWithRpcPromise('EventManager',_0xfb2a('0x80'),{'event':_0xfb2a('0x86'),'message':_0x1cd7d1[_0xfb2a('0x29')]},client9002);return _0x8cfb6c;}return null;})[_0xfb2a('0x37')](respondWithResult(_0x31b310,null))['catch'](handleError(_0x31b310,null));};exports[_0xfb2a('0x2b')]=function(_0x13d3ef,_0x445db1,_0x264e03){if(_0x13d3ef[_0xfb2a('0x5d')]['id']){delete _0x13d3ef[_0xfb2a('0x5d')]['id'];}var _0x32eeb2;return db[_0xfb2a('0x3f')][_0xfb2a('0x5b')]({'where':{'id':_0x13d3ef[_0xfb2a('0x59')]['id']}})[_0xfb2a('0x37')](handleEntityNotFound(_0x445db1,null))[_0xfb2a('0x37')](function(_0x1ac5a9){if(_0x1ac5a9){_0x32eeb2=_0x1ac5a9;return db[_0xfb2a('0x87')][_0xfb2a('0x5b')]({'where':{'id':_0x1ac5a9['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x445db1,null))['then'](function(_0x555bf2){if(_0x555bf2){logger[_0xfb2a('0x88')](_0xfb2a('0x26'),_0xfb2a('0x2b'),_0xfb2a('0x89'),_0x555bf2[_0xfb2a('0x42')],util[_0xfb2a('0x8a')](_0x13d3ef[_0xfb2a('0x5d')],{'showHidden':![],'depth':null}));switch(_0x555bf2[_0xfb2a('0x42')]){case _0xfb2a('0x8b'):if(_0x13d3ef[_0xfb2a('0x5d')][_0xfb2a('0x8c')]&&_0x13d3ef[_0xfb2a('0x5d')][_0xfb2a('0x8c')]===_0x32eeb2[_0xfb2a('0x8d')]){return _0x32eeb2[_0xfb2a('0x36')]({'read':!![]});}else{logger[_0xfb2a('0x28')](_0xfb2a('0x8e'),'status',_0xfb2a('0x8b'),util['inspect'](_0x13d3ef['body'],{'showHidden':![],'depth':null}));}break;case _0xfb2a('0x8f'):if(_0x13d3ef[_0xfb2a('0x5d')][_0xfb2a('0x90')]&&_0x13d3ef[_0xfb2a('0x5d')][_0xfb2a('0x90')]===_0x32eeb2['messageId']&&_[_0xfb2a('0x91')]([_0xfb2a('0x92'),_0xfb2a('0x93')],_0x13d3ef[_0xfb2a('0x5d')][_0xfb2a('0x94')])>=0x0){return _0x32eeb2[_0xfb2a('0x36')]({'read':!![]});}else{logger[_0xfb2a('0x28')](_0xfb2a('0x8e'),'status',_0xfb2a('0x95'),util[_0xfb2a('0x8a')](_0x13d3ef[_0xfb2a('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xfb2a('0x96'):var _0x373b10=_0x13d3ef[_0xfb2a('0x5d')]['results'][0x0];if(_0x373b10['status']['groupName']===_0xfb2a('0x97')){return _0x32eeb2[_0xfb2a('0x36')]({'read':!![]});}else{logger[_0xfb2a('0x28')](_0xfb2a('0x8e'),_0xfb2a('0x2b'),'infobip',util['inspect'](_0x13d3ef[_0xfb2a('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x32eeb2;}})[_0xfb2a('0x37')](respondWithResult(_0x445db1,null))[_0xfb2a('0x2a')](handleError(_0x445db1,null));};
\ No newline at end of file
index 2628286..7e2f7e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x186d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x186d,0x1f3));var _0xd186=function(_0x51b1a5,_0x285a4f){_0x51b1a5=_0x51b1a5-0x0;var _0x15c738=_0x186d[_0x51b1a5];return _0x15c738;};'use strict';var EventEmitter=require(_0xd186('0x0'));var SmsMessage=require(_0xd186('0x1'))['db'][_0xd186('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd186('0x3')](0x0);var events={'afterCreate':_0xd186('0x4'),'afterUpdate':_0xd186('0x5'),'afterDestroy':_0xd186('0x6')};function emitEvent(_0x3c892a){return function(_0x1caabd,_0x52227f,_0x549ed1){SmsMessageEvents['emit'](_0x3c892a+':'+_0x1caabd['id'],_0x1caabd);SmsMessageEvents[_0xd186('0x7')](_0x3c892a,_0x1caabd);_0x549ed1(null);};}for(var e in events){if(events[_0xd186('0x8')](e)){var event=events[e];SmsMessage[_0xd186('0x9')](e,emitEvent(event));}}module[_0xd186('0xa')]=SmsMessageEvents;
\ No newline at end of file
+var _0x455c=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0x455c,0x67));var _0xc455=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0x455c[_0x406e46];return _0x4a3742;};'use strict';var EventEmitter=require(_0xc455('0x0'));var SmsMessage=require(_0xc455('0x1'))['db'][_0xc455('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc455('0x3')](0x0);var events={'afterCreate':_0xc455('0x4'),'afterUpdate':_0xc455('0x5'),'afterDestroy':_0xc455('0x6')};function emitEvent(_0x53d1ce){return function(_0x171f58,_0x50bad4,_0x1d63c9){SmsMessageEvents[_0xc455('0x7')](_0x53d1ce+':'+_0x171f58['id'],_0x171f58);SmsMessageEvents[_0xc455('0x7')](_0x53d1ce,_0x171f58);_0x1d63c9(null);};}for(var e in events){if(events[_0xc455('0x8')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xc455('0x9')]=SmsMessageEvents;
\ No newline at end of file
index 38014db..1d80d1f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x437a=['xCALLY\x20Motion','format','%s:%s','Basic\x20%s','toString','base64','http_code','queued_count','head','data','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','csc','crypto','apiKey','sender','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','Missing\x20parameters:\x20apiKey','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsMessage.attributes','exports','define','SmsMessage','messageId','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','skebby','afterCreate','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend'];(function(_0x21fccf,_0x5e80b6){var _0x2f990d=function(_0x3f3c29){while(--_0x3f3c29){_0x21fccf['push'](_0x21fccf['shift']());}};_0x2f990d(++_0x5e80b6);}(_0x437a,0x12d));var _0xa437=function(_0x3ab52f,_0x195d89){_0x3ab52f=_0x3ab52f-0x0;var _0x5ee3ca=_0x437a[_0x3ab52f];return _0x5ee3ca;};'use strict';var _=require('lodash');var util=require(_0xa437('0x0'));var logger=require(_0xa437('0x1'))(_0xa437('0x2'));var moment=require(_0xa437('0x3'));var BPromise=require(_0xa437('0x4'));var rp=require(_0xa437('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa437('0x6'));var config=require('../../config/environment');var attributes=require(_0xa437('0x7'));module[_0xa437('0x8')]=function(_0x35db40,_0x5c5f1d){return _0x35db40[_0xa437('0x9')](_0xa437('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xa437('0xb'),'fields':[_0xa437('0xb')]},{'name':'fti_sms_messages','fields':[_0xa437('0xc')],'type':_0xa437('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1825eb,_0x313550,_0x120cf1){var _0x384386=_0x35db40['models'];var _0xebbd01=_0x1825eb[_0xa437('0xe')]({'plain':!![]});if(_0xebbd01[_0xa437('0xf')][_0xa437('0x10')]()==='in'||_0xebbd01[_0xa437('0xf')]['toLowerCase']()===_0xa437('0x11')&&!_0xebbd01[_0xa437('0x12')]&&!_[_0xa437('0x13')](_0xebbd01[_0xa437('0x14')])&&!_['isNil'](_0xebbd01['SmsInteractionId'])){_0x384386[_0xa437('0x15')]['findOne']({'where':{'id':_0xebbd01[_0xa437('0x16')]}})[_0xa437('0x17')](function(_0x2ac9cf){if(_0x2ac9cf){_0x2ac9cf[_0xa437('0x18')]({'lastMsgAt':_0xebbd01[_0xa437('0x19')],'lastMsgDirection':_0xebbd01[_0xa437('0xf')][_0xa437('0x10')]()});}})[_0xa437('0x1a')](function(_0x6a0271){console[_0xa437('0x1b')](_0x6a0271);});}if(_0xebbd01[_0xa437('0xf')]===_0xa437('0x11')&&!_0xebbd01[_0xa437('0x12')]){var _0x2a94a7;_0x384386[_0xa437('0x1c')][_0xa437('0x1d')]({'where':{'id':_0xebbd01[_0xa437('0x1e')]},'raw':!![]})[_0xa437('0x17')](function(_0x4d2643){_0x2a94a7=_0x4d2643;if(_0x2a94a7&&_0x2a94a7[_0xa437('0x1f')]){switch(_0x2a94a7[_0xa437('0x1f')]){case _0xa437('0x20'):var _0x3ae868=require(_0xa437('0x20'));if(_0x2a94a7[_0xa437('0x21')]&&_0x2a94a7['authToken']&&_0x2a94a7[_0xa437('0x22')]){var _0x940d93=new _0x3ae868(_0x2a94a7[_0xa437('0x21')],_0x2a94a7[_0xa437('0x23')]);_0x940d93[_0xa437('0x24')][_0xa437('0x25')]({'body':_0xebbd01[_0xa437('0xc')],'to':_0xebbd01[_0xa437('0x22')],'from':_0x2a94a7[_0xa437('0x22')],'statusCallback':_0x2a94a7[_0xa437('0x26')]+_0xa437('0x27')+_0xebbd01['id']+_0xa437('0x28')+_0x2a94a7[_0xa437('0x29')]})[_0xa437('0x17')](function(_0x490047){if(_0x490047[_0xa437('0x2a')]){return _0x1825eb[_0xa437('0x18')]({'messageId':_0x490047['sid']});}})[_0xa437('0x1a')](function(_0x2354a6){logger[_0xa437('0x1b')](_0xa437('0x2b'),'afterCreate',_0xa437('0x20'),util[_0xa437('0x2c')](_0x2354a6,{'showHidden':![],'depth':null}));});}else{logger[_0xa437('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa437('0x20'),_0xa437('0x2d'));}break;case'skebby':var _0x33b3f0=_0xa437('0x2e');if(_0x2a94a7[_0xa437('0x2f')]&&_0x2a94a7[_0xa437('0x30')]){var _0x198cb1={'recipient':[_0xebbd01['phone']],'message':_0xebbd01[_0xa437('0xc')],'message_type':_0x2a94a7['smsMethod']};if(_0x2a94a7[_0xa437('0x31')]&&_0x2a94a7[_0xa437('0x31')]!=='SI'){_0x198cb1['sender']=_0x2a94a7[_0xa437('0x22')];}var _0x4a28a7={'url':_0x33b3f0+_0xa437('0x32')+_0x2a94a7[_0xa437('0x2f')]+_0xa437('0x33')+_0x2a94a7[_0xa437('0x30')],'method':'GET'};rp(_0x4a28a7)[_0xa437('0x17')](function(_0x31d38a){var _0x6a7bbd=_0x31d38a[_0xa437('0x34')](';');var _0x1d534f={'user_key':_0x6a7bbd[0x0],'session_key':_0x6a7bbd[0x1]};_0x4a28a7={'url':_0x33b3f0+_0xa437('0x35'),'method':_0xa437('0x36'),'headers':{'user_key':_0x1d534f[_0xa437('0x37')],'Session_key':_0x1d534f[_0xa437('0x38')]},'json':!![],'body':_0x198cb1};return rp(_0x4a28a7);})[_0xa437('0x17')](function(_0x50945e){if(_0x50945e[_0xa437('0x39')]>=0x1){var _0x2e9ffa={'messageId':_0x50945e['internal_order_id']};if(_0x2a94a7['smsMethod']!=='GP'||!_0x2a94a7[_0xa437('0x3a')]){_0x2e9ffa[_0xa437('0x3b')]=!![];}return _0x1825eb[_0xa437('0x18')](_0x2e9ffa);}else{return logger[_0xa437('0x1b')](_0xa437('0x2b'),'afterCreate',_0xa437('0x3c'),util['inspect'](_0x50945e,{'showHidden':![],'depth':null}));}})[_0xa437('0x1a')](function(_0x8acd80){return logger[_0xa437('0x1b')](_0xa437('0x2b'),_0xa437('0x3d'),_0xa437('0x3c'),util[_0xa437('0x2c')](_0x8acd80,{'showHidden':![],'depth':null}));});}else{logger[_0xa437('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa437('0x3c'),_0xa437('0x3e'));}break;case _0xa437('0x3f'):if(_0x2a94a7[_0xa437('0x23')]){var _0x308a51={'recipient':_0xebbd01[_0xa437('0x22')],'message':_0xebbd01[_0xa437('0xc')],'sender':_0x2a94a7[_0xa437('0x40')]||_0x2a94a7['phone'],'authorization':_0x2a94a7['authToken']};var _0x313550={'method':_0xa437('0x36'),'uri':_0xa437('0x41'),'body':_0x308a51,'json':!![]};rp(_0x313550)[_0xa437('0x17')](function(_0x1885d4){var _0x37d418={'messageId':_0x1885d4[_0xa437('0x42')]};if(!_0x2a94a7[_0xa437('0x3a')]){_0x37d418[_0xa437('0x3b')]=!![];}return _0x1825eb[_0xa437('0x18')](_0x37d418);})[_0xa437('0x1a')](function(_0x39dfbc){logger[_0xa437('0x1b')](_0xa437('0x2b'),'afterCreate',_0xa437('0x3f'),util[_0xa437('0x2c')](_0x39dfbc,{'showHidden':![],'depth':null}));});}else{logger[_0xa437('0x1b')](_0xa437('0x2b'),_0xa437('0x3d'),_0xa437('0x3f'),'Missing\x20parameters:\x20authToken');}break;case _0xa437('0x43'):if(_0x2a94a7[_0xa437('0x2f')]&&_0x2a94a7[_0xa437('0x30')]){var _0x308a51={'messages':[{'source':_0xa437('0x44'),'to':_0xebbd01[_0xa437('0x22')],'body':_0xebbd01[_0xa437('0xc')],'from':_0x2a94a7['senderString']||_0x2a94a7[_0xa437('0x22')]}]};var _0x1b9c43=util[_0xa437('0x45')](_0xa437('0x46'),_0x2a94a7[_0xa437('0x2f')],_0x2a94a7[_0xa437('0x30')]);var _0x313550={'method':_0xa437('0x36'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x308a51,'headers':{'Authorization':util[_0xa437('0x45')](_0xa437('0x47'),new Buffer(_0x1b9c43)[_0xa437('0x48')](_0xa437('0x49')))},'json':!![]};rp(_0x313550)['then'](function(_0x4c9a32){if(_0x4c9a32[_0xa437('0x4a')]>=0xc8&&_0x4c9a32[_0xa437('0x4a')]<=0xce){if(_0x4c9a32['data']&&_0x4c9a32['data'][_0xa437('0x4b')]>0x0){var _0x28a9ad=_[_0xa437('0x4c')](_0x4c9a32[_0xa437('0x4d')][_0xa437('0x24')]);var _0x565886={'messageId':_0x28a9ad[_0xa437('0x4e')]};if(!_0x2a94a7[_0xa437('0x3a')]){_0x565886[_0xa437('0x3b')]=!![];}return _0x1825eb[_0xa437('0x18')](_0x565886);}else{logger['error'](_0xa437('0x2b'),_0xa437('0x3d'),'clickSend',util[_0xa437('0x2c')](_0x4c9a32,{'showHidden':![],'depth':null}));}}else{logger[_0xa437('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa437('0x3d'),_0xa437('0x4f'),util['inspect'](_0x4c9a32,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1e8e96){logger['error'](_0xa437('0x2b'),_0xa437('0x3d'),_0xa437('0x4f'),util[_0xa437('0x2c')](_0x1e8e96,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa437('0x2b'),_0xa437('0x3d'),_0xa437('0x4f'),_0xa437('0x3e'));}break;case _0xa437('0x50'):if(_0x2a94a7[_0xa437('0x51')]&&_0x2a94a7[_0xa437('0x23')]){var _0x308a51={'dst':_0xebbd01[_0xa437('0x22')],'text':_0xebbd01['body'],'src':_0x2a94a7[_0xa437('0x40')]||_0x2a94a7[_0xa437('0x22')],'url':_0x2a94a7[_0xa437('0x26')]+_0xa437('0x27')+_0xebbd01['id']+_0xa437('0x28')+_0x2a94a7[_0xa437('0x29')]};var _0x1b9c43=util['format'](_0xa437('0x46'),_0x2a94a7[_0xa437('0x51')],_0x2a94a7[_0xa437('0x23')]);var _0x313550={'method':'POST','uri':util[_0xa437('0x45')](_0xa437('0x52'),_0x2a94a7['authId']),'body':_0x308a51,'headers':{'Authorization':util[_0xa437('0x45')](_0xa437('0x47'),new Buffer(_0x1b9c43)[_0xa437('0x48')]('base64'))},'json':!![]};rp(_0x313550)[_0xa437('0x17')](function(_0x54baf6){var _0x356bfc={'messageId':_0x54baf6[_0xa437('0x53')][0x0]};return _0x1825eb[_0xa437('0x18')](_0x356bfc);})[_0xa437('0x1a')](function(_0x2bc4e7){logger['error'](_0xa437('0x2b'),_0xa437('0x3d'),_0xa437('0x50'),util[_0xa437('0x2c')](_0x2bc4e7,{'showHidden':![],'depth':null}));});}else{logger[_0xa437('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa437('0x3d'),_0xa437('0x50'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xa437('0x54'):if(_0x2a94a7[_0xa437('0x2f')]&&_0x2a94a7[_0xa437('0x30')]){if(_0x2a94a7[_0xa437('0x55')]){var _0x13e14f={'method':_0xa437('0x36'),'uri':_0x2a94a7[_0xa437('0x55')]+_0xa437('0x56'),'body':{'username':_0x2a94a7[_0xa437('0x2f')],'password':_0x2a94a7[_0xa437('0x30')]},'json':!![]};return rp(_0x13e14f)[_0xa437('0x17')](function(_0x4e451f){var _0x5db511={'method':_0xa437('0x36'),'uri':_0x2a94a7[_0xa437('0x55')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x2a94a7[_0xa437('0x22')],'destinations':[{'to':_0xebbd01['phone']}],'text':_0xebbd01[_0xa437('0xc')],'notifyUrl':_0x2a94a7['remote']+_0xa437('0x27')+_0xebbd01['id']+'/status?token='+_0x2a94a7[_0xa437('0x29')],'notifyContentType':_0xa437('0x57'),'callbackData':_0x2a94a7['phone']+';'+_0xebbd01[_0xa437('0xc')]}]},'headers':{'Authorization':_0xa437('0x58')+_0x4e451f[_0xa437('0x29')]},'json':!![]};return rp(_0x5db511)[_0xa437('0x17')](function(_0x4e7b63){if(_0x4e7b63[_0xa437('0x24')]){var _0x448e57={'messageId':_0x4e7b63['messages'][0x0][_0xa437('0xb')]};if(!_0x2a94a7[_0xa437('0x3a')]){_0x448e57[_0xa437('0x3b')]=!![];}return _0x1825eb['update'](_0x448e57);}else{return logger[_0xa437('0x1b')](_0xa437('0x2b'),_0xa437('0x3d'),_0xa437('0x54'),util['inspect'](_0x4e7b63,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x103a00){return logger['error'](_0xa437('0x2b'),_0xa437('0x3d'),'infobip',util[_0xa437('0x2c')](_0x103a00,{'showHidden':![],'depth':null}));});}else{logger[_0xa437('0x1b')](_0xa437('0x2b'),_0xa437('0x3d'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0xa437('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa437('0x54'),_0xa437('0x3e'));}break;case _0xa437('0x59'):var _0x13ebb2=require(_0xa437('0x5a'));if(_0x2a94a7[_0xa437('0x5b')]){var _0x284aa3={};_0x284aa3['login']=_0x2a94a7[_0xa437('0x2f')];_0x284aa3[_0xa437('0x22')]=_0xebbd01[_0xa437('0x22')];_0x284aa3[_0xa437('0x5c')]=_0x2a94a7[_0xa437('0x22')];_0x284aa3['text']=_0xebbd01[_0xa437('0xc')];_0x284aa3[_0xa437('0x5d')]=+new Date();var _0x280453='';var _0x482389='';var _0x462259=Object[_0xa437('0x5e')](_0x284aa3);_0x462259[_0xa437('0x5f')]();for(var _0x135ed6=0x0;_0x135ed6<_0x462259[_0xa437('0x60')];_0x135ed6++){if(_0x280453!=''){_0x280453+='&';}_0x280453+=_0x462259[_0x135ed6]+'='+encodeURIComponent(_0x284aa3[_0x462259[_0x135ed6]]);_0x482389+=_0x284aa3[_0x462259[_0x135ed6]];}_0x482389+=_0x2a94a7[_0xa437('0x5b')];_0x482389=_0x13ebb2[_0xa437('0x61')](_0xa437('0x62'))['update'](_0x482389)[_0xa437('0x63')](_0xa437('0x64'));if(_0x280453!==''){_0x280453+='&';}_0x280453+=_0xa437('0x65')+_0x482389;var _0x4a28a7={'method':'GET','uri':_0x2a94a7[_0xa437('0x55')]+'/external/get/send.php?'+_0x280453,'json':!![]};return rp(_0x4a28a7)[_0xa437('0x17')](function(_0x41908f){var _0x4bcdfb=Object[_0xa437('0x5e')](_0x41908f);if(_0x41908f[_0x4bcdfb[0x0]]['error']&&parseInt(_0x41908f[_0x4bcdfb[0x0]][_0xa437('0x1b')])===0x0){var _0x458f5d={'messageId':_0x41908f[_0x4bcdfb[0x0]][_0xa437('0x66')]};if(!_0x2a94a7[_0xa437('0x3a')]){_0x458f5d[_0xa437('0x3b')]=!![];}return _0x1825eb[_0xa437('0x18')](_0x458f5d);}else{return logger[_0xa437('0x1b')](_0xa437('0x2b'),_0xa437('0x3d'),_0xa437('0x59'),util[_0xa437('0x2c')](_0x41908f[_0xa437('0x1b')],{'showHidden':![],'depth':null}));}})[_0xa437('0x1a')](function(_0x44a10d){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa437('0x3d'),_0xa437('0x59'),util[_0xa437('0x2c')](_0x44a10d,{'showHidden':![],'depth':null}));});}else{logger[_0xa437('0x1b')](_0xa437('0x2b'),_0xa437('0x3d'),_0xa437('0x59'),'Missing\x20parameters:\x20apiKey');}break;case _0xa437('0x67'):if(_0x2a94a7['apiKey']){var _0x3f2ca3={'method':_0xa437('0x36'),'uri':_0xa437('0x68'),'headers':{'Authorization':_0x2a94a7[_0xa437('0x5b')]},'body':{'content':_0xebbd01[_0xa437('0xc')],'to':[_0xebbd01['phone']],'from':_0x2a94a7[_0xa437('0x22')],'binary':![],'clientMessageId':_0xa437('0x69'),'charset':'UTF-8'},'json':!![]};rp(_0x3f2ca3)[_0xa437('0x17')](function(_0x2742d3){if(!_0x2742d3[_0xa437('0x1b')]){var _0x5999df={'messageId':_0x2742d3[_0xa437('0x24')][0x0][_0xa437('0x6a')]};if(!_0x2a94a7[_0xa437('0x3a')]){_0x5999df['read']=!![];}return _0x1825eb['update'](_0x5999df);}else{return logger[_0xa437('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa437('0x67'),util[_0xa437('0x2c')](_0x2742d3[_0xa437('0x1b')],{'showHidden':![],'depth':null}));}})[_0xa437('0x1a')](function(_0x527fc2){return logger[_0xa437('0x1b')](_0xa437('0x2b'),'afterCreate',_0xa437('0x67'),util[_0xa437('0x2c')](_0x527fc2,{'showHidden':![],'depth':null}));});}else{logger[_0xa437('0x1b')](_0xa437('0x2b'),_0xa437('0x3d'),_0xa437('0x67'),_0xa437('0x6b'));}break;case'bandwidth':if(_0x2a94a7[_0xa437('0x2f')]&&_0x2a94a7['password']){var _0x1b9c43=util[_0xa437('0x45')]('%s:%s',_0x2a94a7[_0xa437('0x2f')],_0x2a94a7[_0xa437('0x30')]);var _0x313550={'method':_0xa437('0x36'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x2a94a7[_0xa437('0x6c')]+_0xa437('0x6d'),'body':{'to':[_0xebbd01[_0xa437('0x22')]],'text':_0xebbd01[_0xa437('0xc')],'from':_0x2a94a7[_0xa437('0x22')],'applicationId':_0x2a94a7[_0xa437('0x6e')]},'headers':{'Authorization':util[_0xa437('0x45')](_0xa437('0x47'),new Buffer(_0x1b9c43)[_0xa437('0x48')](_0xa437('0x49')))},'json':!![]};rp(_0x313550)['then'](function(_0x1969bb){if(_0x1969bb['id']){var _0x2838db={'messageId':_0x1969bb['id']};return _0x1825eb[_0xa437('0x18')](_0x2838db);}else{logger[_0xa437('0x1b')](_0xa437('0x2b'),_0xa437('0x3d'),'bandwidth',util[_0xa437('0x2c')](_0x1969bb,{'showHidden':![],'depth':null}));}})[_0xa437('0x1a')](function(_0x1fb487){logger[_0xa437('0x1b')](_0xa437('0x2b'),'afterCreate','bandwidth',util['inspect'](_0x1fb487,{'showHidden':![],'depth':null}));});}else{logger[_0xa437('0x1b')](_0xa437('0x2b'),'afterCreate',_0xa437('0x6f'),_0xa437('0x3e'));}break;case _0xa437('0x70'):if(_0x2a94a7[_0xa437('0x5b')]){var _0x4c06dc={};var _0x4a28a7={'method':_0xa437('0x36'),'uri':_0xa437('0x71'),'headers':{'Authorization':_0xa437('0x72')+_0x2a94a7[_0xa437('0x5b')],'Content-Type':'application/json'},'body':{'from':_0x2a94a7['phone'],'to':_0xebbd01[_0xa437('0x22')],'text':_0xebbd01[_0xa437('0xc')]},'json':!![]};return rp(_0x4a28a7)[_0xa437('0x17')](function(_0x4f79b6){if(_0x4f79b6['code']==0xca){_0x4c06dc[_0xa437('0x73')]=_0x4f79b6;var _0x798b96={'method':_0xa437('0x36'),'uri':_0xa437('0x74'),'headers':{'Authorization':_0xa437('0x72')+_0x2a94a7[_0xa437('0x5b')],'Content-Type':_0xa437('0x57')},'body':{'refid':_0x4c06dc[_0xa437('0x73')][_0xa437('0x75')]},'json':!![]};return rp(_0x798b96)[_0xa437('0x17')](function(_0x2fb2b6){_0x4c06dc[_0xa437('0x76')]=_0x2fb2b6;var _0x384060={'messageId':_0x4c06dc[_0xa437('0x73')][_0xa437('0x75')],'read':!![]};return _0x1825eb[_0xa437('0x18')](_0x384060);});}else{return logger[_0xa437('0x1b')](_0xa437('0x2b'),_0xa437('0x3d'),_0xa437('0x70'),util[_0xa437('0x2c')](_0x4f79b6,{'showHidden':![],'depth':null}));}})['catch'](function(_0x50a39f){return logger[_0xa437('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa437('0x3d'),_0xa437('0x70'),util['inspect'](_0x50a39f,{'showHidden':![],'depth':null}));});}else{return logger[_0xa437('0x1b')](_0xa437('0x2b'),_0xa437('0x3d'),_0xa437('0x70'),_0xa437('0x77'));}break;}}})[_0xa437('0x78')](function(){_0x120cf1();});}else{_0x120cf1();}}},'charset':_0xa437('0x79'),'collate':_0xa437('0x7a')});};
\ No newline at end of file
+var _0x89f4=['SmsAccountId','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','token','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','GET','split','sms','POST','session_key','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','head','message_id','clickSend','authId','/status?token=','%s:%s','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','csc','crypto','login','sender','text','timestamp','length','apiKey','createHash','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','https://platform.clickatell.com/messages','clickatell','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','applicationId','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','message','refid','Token\x20not\x20received','finally','api','moment','bluebird','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','secret','find'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x89f4,0x1a8));var _0x489f=function(_0x1aeb43,_0x97b8fc){_0x1aeb43=_0x1aeb43-0x0;var _0x4923d4=_0x89f4[_0x1aeb43];return _0x4923d4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x489f('0x0'));var moment=require(_0x489f('0x1'));var BPromise=require(_0x489f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x489f('0x3'));var config=require(_0x489f('0x4'));var attributes=require(_0x489f('0x5'));module['exports']=function(_0x5e390a,_0x1fe11c){return _0x5e390a[_0x489f('0x6')](_0x489f('0x7'),attributes,{'tableName':_0x489f('0x8'),'paranoid':![],'indexes':[{'name':_0x489f('0x9'),'fields':[_0x489f('0x9')]},{'name':'fti_sms_messages','fields':[_0x489f('0xa')],'type':_0x489f('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xaf5446,_0x32b457,_0x320f9d){var _0x1d1eff=_0x5e390a[_0x489f('0xc')];var _0x116bf0=_0xaf5446[_0x489f('0xd')]({'plain':!![]});if(_0x116bf0[_0x489f('0xe')][_0x489f('0xf')]()==='in'||_0x116bf0['direction'][_0x489f('0xf')]()===_0x489f('0x10')&&!_0x116bf0['secret']&&!_[_0x489f('0x11')](_0x116bf0['UserId'])&&!_[_0x489f('0x11')](_0x116bf0[_0x489f('0x12')])){_0x1d1eff[_0x489f('0x13')][_0x489f('0x14')]({'where':{'id':_0x116bf0[_0x489f('0x12')]}})[_0x489f('0x15')](function(_0x1da768){if(_0x1da768){_0x1da768[_0x489f('0x16')]({'lastMsgAt':_0x116bf0[_0x489f('0x17')],'lastMsgDirection':_0x116bf0[_0x489f('0xe')][_0x489f('0xf')]()});}})[_0x489f('0x18')](function(_0x268019){console[_0x489f('0x19')](_0x268019);});}if(_0x116bf0['direction']==='out'&&!_0x116bf0[_0x489f('0x1a')]){var _0x2668ef;_0x1d1eff['SmsAccount'][_0x489f('0x1b')]({'where':{'id':_0x116bf0[_0x489f('0x1c')]},'raw':!![]})[_0x489f('0x15')](function(_0x47aa41){_0x2668ef=_0x47aa41;if(_0x2668ef&&_0x2668ef['type']){switch(_0x2668ef['type']){case _0x489f('0x1d'):var _0x57e925=require(_0x489f('0x1d'));if(_0x2668ef[_0x489f('0x1e')]&&_0x2668ef[_0x489f('0x1f')]&&_0x2668ef[_0x489f('0x20')]){var _0x1a4249=new _0x57e925(_0x2668ef[_0x489f('0x1e')],_0x2668ef['authToken']);_0x1a4249[_0x489f('0x21')]['create']({'body':_0x116bf0['body'],'to':_0x116bf0[_0x489f('0x20')],'from':_0x2668ef['phone'],'statusCallback':_0x2668ef[_0x489f('0x22')]+_0x489f('0x23')+_0x116bf0['id']+'/status?token='+_0x2668ef[_0x489f('0x24')]})[_0x489f('0x15')](function(_0x29ffb5){if(_0x29ffb5['sid']){return _0xaf5446['update']({'messageId':_0x29ffb5[_0x489f('0x25')]});}})[_0x489f('0x18')](function(_0x275b59){logger[_0x489f('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x489f('0x26'),_0x489f('0x1d'),util[_0x489f('0x27')](_0x275b59,{'showHidden':![],'depth':null}));});}else{logger[_0x489f('0x19')](_0x489f('0x28'),_0x489f('0x26'),'twilio',_0x489f('0x29'));}break;case'skebby':var _0x1e2e00=_0x489f('0x2a');if(_0x2668ef[_0x489f('0x2b')]&&_0x2668ef[_0x489f('0x2c')]){var _0x4e04fa={'recipient':[_0x116bf0[_0x489f('0x20')]],'message':_0x116bf0[_0x489f('0xa')],'message_type':_0x2668ef['smsMethod']};if(_0x2668ef[_0x489f('0x2d')]&&_0x2668ef['smsMethod']!=='SI'){_0x4e04fa['sender']=_0x2668ef['phone'];}var _0x31caad={'url':_0x1e2e00+_0x489f('0x2e')+_0x2668ef[_0x489f('0x2b')]+'&password='+_0x2668ef[_0x489f('0x2c')],'method':_0x489f('0x2f')};rp(_0x31caad)[_0x489f('0x15')](function(_0x2fe66b){var _0x5eb8f9=_0x2fe66b[_0x489f('0x30')](';');var _0x5c0f76={'user_key':_0x5eb8f9[0x0],'session_key':_0x5eb8f9[0x1]};_0x31caad={'url':_0x1e2e00+_0x489f('0x31'),'method':_0x489f('0x32'),'headers':{'user_key':_0x5c0f76['user_key'],'Session_key':_0x5c0f76[_0x489f('0x33')]},'json':!![],'body':_0x4e04fa};return rp(_0x31caad);})['then'](function(_0x3605f5){if(_0x3605f5['total_sent']>=0x1){var _0xf7d41c={'messageId':_0x3605f5['internal_order_id']};if(_0x2668ef['smsMethod']!=='GP'||!_0x2668ef[_0x489f('0x34')]){_0xf7d41c[_0x489f('0x35')]=!![];}return _0xaf5446[_0x489f('0x16')](_0xf7d41c);}else{return logger[_0x489f('0x19')](_0x489f('0x28'),_0x489f('0x26'),'skebby',util['inspect'](_0x3605f5,{'showHidden':![],'depth':null}));}})[_0x489f('0x18')](function(_0x4a331b){return logger[_0x489f('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x489f('0x36'),util[_0x489f('0x27')](_0x4a331b,{'showHidden':![],'depth':null}));});}else{logger[_0x489f('0x19')](_0x489f('0x28'),'afterCreate',_0x489f('0x36'),_0x489f('0x37'));}break;case _0x489f('0x38'):if(_0x2668ef['authToken']){var _0x41f35d={'recipient':_0x116bf0[_0x489f('0x20')],'message':_0x116bf0[_0x489f('0xa')],'sender':_0x2668ef[_0x489f('0x39')]||_0x2668ef[_0x489f('0x20')],'authorization':_0x2668ef[_0x489f('0x1f')]};var _0x32b457={'method':'POST','uri':_0x489f('0x3a'),'body':_0x41f35d,'json':!![]};rp(_0x32b457)[_0x489f('0x15')](function(_0x126297){var _0xeaa14f={'messageId':_0x126297[_0x489f('0x3b')]};if(!_0x2668ef[_0x489f('0x34')]){_0xeaa14f['read']=!![];}return _0xaf5446['update'](_0xeaa14f);})[_0x489f('0x18')](function(_0x52dc0e){logger['error'](_0x489f('0x28'),'afterCreate','connectel',util[_0x489f('0x27')](_0x52dc0e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x489f('0x28'),_0x489f('0x26'),_0x489f('0x38'),_0x489f('0x3c'));}break;case _0x489f('0x3d'):if(_0x2668ef['username']&&_0x2668ef[_0x489f('0x2c')]){var _0x41f35d={'messages':[{'source':_0x489f('0x3e'),'to':_0x116bf0[_0x489f('0x20')],'body':_0x116bf0[_0x489f('0xa')],'from':_0x2668ef['senderString']||_0x2668ef['phone']}]};var _0x1d41e8=util[_0x489f('0x3f')]('%s:%s',_0x2668ef[_0x489f('0x2b')],_0x2668ef['password']);var _0x32b457={'method':'POST','uri':_0x489f('0x40'),'body':_0x41f35d,'headers':{'Authorization':util[_0x489f('0x3f')]('Basic\x20%s',new Buffer(_0x1d41e8)[_0x489f('0x41')](_0x489f('0x42')))},'json':!![]};rp(_0x32b457)[_0x489f('0x15')](function(_0x47255f){if(_0x47255f[_0x489f('0x43')]>=0xc8&&_0x47255f[_0x489f('0x43')]<=0xce){if(_0x47255f[_0x489f('0x44')]&&_0x47255f[_0x489f('0x44')][_0x489f('0x45')]>0x0){var _0x2347f7=_[_0x489f('0x46')](_0x47255f[_0x489f('0x44')][_0x489f('0x21')]);var _0x222204={'messageId':_0x2347f7[_0x489f('0x47')]};if(!_0x2668ef['deliveryReport']){_0x222204[_0x489f('0x35')]=!![];}return _0xaf5446[_0x489f('0x16')](_0x222204);}else{logger[_0x489f('0x19')](_0x489f('0x28'),_0x489f('0x26'),'clickSend',util[_0x489f('0x27')](_0x47255f,{'showHidden':![],'depth':null}));}}else{logger[_0x489f('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x489f('0x48'),util[_0x489f('0x27')](_0x47255f,{'showHidden':![],'depth':null}));}})[_0x489f('0x18')](function(_0x39de77){logger['error'](_0x489f('0x28'),'afterCreate',_0x489f('0x48'),util[_0x489f('0x27')](_0x39de77,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x489f('0x28'),_0x489f('0x26'),'clickSend',_0x489f('0x37'));}break;case'plivo':if(_0x2668ef[_0x489f('0x49')]&&_0x2668ef['authToken']){var _0x41f35d={'dst':_0x116bf0['phone'],'text':_0x116bf0[_0x489f('0xa')],'src':_0x2668ef[_0x489f('0x39')]||_0x2668ef[_0x489f('0x20')],'url':_0x2668ef[_0x489f('0x22')]+_0x489f('0x23')+_0x116bf0['id']+_0x489f('0x4a')+_0x2668ef[_0x489f('0x24')]};var _0x1d41e8=util[_0x489f('0x3f')](_0x489f('0x4b'),_0x2668ef['authId'],_0x2668ef[_0x489f('0x1f')]);var _0x32b457={'method':_0x489f('0x32'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x2668ef[_0x489f('0x49')]),'body':_0x41f35d,'headers':{'Authorization':util[_0x489f('0x3f')](_0x489f('0x4c'),new Buffer(_0x1d41e8)[_0x489f('0x41')](_0x489f('0x42')))},'json':!![]};rp(_0x32b457)[_0x489f('0x15')](function(_0x193edc){var _0x13af79={'messageId':_0x193edc[_0x489f('0x4d')][0x0]};return _0xaf5446[_0x489f('0x16')](_0x13af79);})[_0x489f('0x18')](function(_0x10342d){logger[_0x489f('0x19')](_0x489f('0x28'),'afterCreate','plivo',util['inspect'](_0x10342d,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x489f('0x26'),'plivo',_0x489f('0x4e'));}break;case'infobip':if(_0x2668ef[_0x489f('0x2b')]&&_0x2668ef[_0x489f('0x2c')]){if(_0x2668ef[_0x489f('0x4f')]){var _0x191678={'method':_0x489f('0x32'),'uri':_0x2668ef['baseUrl']+'/auth/1/session','body':{'username':_0x2668ef[_0x489f('0x2b')],'password':_0x2668ef[_0x489f('0x2c')]},'json':!![]};return rp(_0x191678)['then'](function(_0x5cf179){var _0x165cf8={'method':_0x489f('0x32'),'uri':_0x2668ef[_0x489f('0x4f')]+_0x489f('0x50'),'body':{'messages':[{'from':_0x2668ef[_0x489f('0x20')],'destinations':[{'to':_0x116bf0['phone']}],'text':_0x116bf0[_0x489f('0xa')],'notifyUrl':_0x2668ef[_0x489f('0x22')]+_0x489f('0x23')+_0x116bf0['id']+_0x489f('0x4a')+_0x2668ef['token'],'notifyContentType':_0x489f('0x51'),'callbackData':_0x2668ef[_0x489f('0x20')]+';'+_0x116bf0[_0x489f('0xa')]}]},'headers':{'Authorization':_0x489f('0x52')+_0x5cf179[_0x489f('0x24')]},'json':!![]};return rp(_0x165cf8)[_0x489f('0x15')](function(_0x546163){if(_0x546163[_0x489f('0x21')]){var _0xf0b9b6={'messageId':_0x546163[_0x489f('0x21')][0x0][_0x489f('0x9')]};if(!_0x2668ef['deliveryReport']){_0xf0b9b6[_0x489f('0x35')]=!![];}return _0xaf5446[_0x489f('0x16')](_0xf0b9b6);}else{return logger[_0x489f('0x19')](_0x489f('0x28'),'afterCreate','infobip',util[_0x489f('0x27')](_0x546163,{'showHidden':![],'depth':null}));}});})[_0x489f('0x18')](function(_0x5c1631){return logger[_0x489f('0x19')](_0x489f('0x28'),_0x489f('0x26'),_0x489f('0x53'),util['inspect'](_0x5c1631,{'showHidden':![],'depth':null}));});}else{logger[_0x489f('0x19')](_0x489f('0x28'),_0x489f('0x26'),_0x489f('0x53'),'Missing\x20parameters:\x20base_url');}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x489f('0x53'),_0x489f('0x37'));}break;case _0x489f('0x54'):var _0x261064=require(_0x489f('0x55'));if(_0x2668ef['apiKey']){var _0x1f3a07={};_0x1f3a07[_0x489f('0x56')]=_0x2668ef[_0x489f('0x2b')];_0x1f3a07[_0x489f('0x20')]=_0x116bf0['phone'];_0x1f3a07[_0x489f('0x57')]=_0x2668ef[_0x489f('0x20')];_0x1f3a07[_0x489f('0x58')]=_0x116bf0[_0x489f('0xa')];_0x1f3a07[_0x489f('0x59')]=+new Date();var _0x5610f6='';var _0xe5331f='';var _0x539337=Object['keys'](_0x1f3a07);_0x539337['sort']();for(var _0x52efdc=0x0;_0x52efdc<_0x539337[_0x489f('0x5a')];_0x52efdc++){if(_0x5610f6!=''){_0x5610f6+='&';}_0x5610f6+=_0x539337[_0x52efdc]+'='+encodeURIComponent(_0x1f3a07[_0x539337[_0x52efdc]]);_0xe5331f+=_0x1f3a07[_0x539337[_0x52efdc]];}_0xe5331f+=_0x2668ef[_0x489f('0x5b')];_0xe5331f=_0x261064[_0x489f('0x5c')](_0x489f('0x5d'))[_0x489f('0x16')](_0xe5331f)[_0x489f('0x5e')](_0x489f('0x5f'));if(_0x5610f6!==''){_0x5610f6+='&';}_0x5610f6+=_0x489f('0x60')+_0xe5331f;var _0x31caad={'method':_0x489f('0x2f'),'uri':_0x2668ef[_0x489f('0x4f')]+_0x489f('0x61')+_0x5610f6,'json':!![]};return rp(_0x31caad)[_0x489f('0x15')](function(_0x434cc6){var _0x49c798=Object[_0x489f('0x62')](_0x434cc6);if(_0x434cc6[_0x49c798[0x0]][_0x489f('0x19')]&&parseInt(_0x434cc6[_0x49c798[0x0]][_0x489f('0x19')])===0x0){var _0x2695d6={'messageId':_0x434cc6[_0x49c798[0x0]][_0x489f('0x63')]};if(!_0x2668ef[_0x489f('0x34')]){_0x2695d6[_0x489f('0x35')]=!![];}return _0xaf5446[_0x489f('0x16')](_0x2695d6);}else{return logger[_0x489f('0x19')](_0x489f('0x28'),_0x489f('0x26'),_0x489f('0x54'),util['inspect'](_0x434cc6[_0x489f('0x19')],{'showHidden':![],'depth':null}));}})[_0x489f('0x18')](function(_0x22aea6){return logger[_0x489f('0x19')](_0x489f('0x28'),_0x489f('0x26'),_0x489f('0x54'),util['inspect'](_0x22aea6,{'showHidden':![],'depth':null}));});}else{logger[_0x489f('0x19')](_0x489f('0x28'),_0x489f('0x26'),_0x489f('0x54'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x2668ef['apiKey']){var _0x50667d={'method':_0x489f('0x32'),'uri':_0x489f('0x64'),'headers':{'Authorization':_0x2668ef[_0x489f('0x5b')]},'body':{'content':_0x116bf0[_0x489f('0xa')],'to':[_0x116bf0['phone']],'from':_0x2668ef['phone'],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x50667d)[_0x489f('0x15')](function(_0xaf4dbc){if(!_0xaf4dbc['error']){var _0x452e50={'messageId':_0xaf4dbc[_0x489f('0x21')][0x0]['apiMessageId']};if(!_0x2668ef[_0x489f('0x34')]){_0x452e50[_0x489f('0x35')]=!![];}return _0xaf5446[_0x489f('0x16')](_0x452e50);}else{return logger[_0x489f('0x19')](_0x489f('0x28'),'afterCreate',_0x489f('0x65'),util[_0x489f('0x27')](_0xaf4dbc['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0xb8a5e){return logger[_0x489f('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x489f('0x26'),_0x489f('0x65'),util[_0x489f('0x27')](_0xb8a5e,{'showHidden':![],'depth':null}));});}else{logger[_0x489f('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x489f('0x26'),_0x489f('0x65'),_0x489f('0x66'));}break;case _0x489f('0x67'):if(_0x2668ef[_0x489f('0x2b')]&&_0x2668ef[_0x489f('0x2c')]){var _0x1d41e8=util['format'](_0x489f('0x4b'),_0x2668ef[_0x489f('0x2b')],_0x2668ef['password']);var _0x32b457={'method':_0x489f('0x32'),'uri':_0x489f('0x68')+_0x2668ef['accountId']+'/messages','body':{'to':[_0x116bf0[_0x489f('0x20')]],'text':_0x116bf0[_0x489f('0xa')],'from':_0x2668ef[_0x489f('0x20')],'applicationId':_0x2668ef[_0x489f('0x69')]},'headers':{'Authorization':util[_0x489f('0x3f')](_0x489f('0x4c'),new Buffer(_0x1d41e8)[_0x489f('0x41')](_0x489f('0x42')))},'json':!![]};rp(_0x32b457)[_0x489f('0x15')](function(_0x352d60){if(_0x352d60['id']){var _0x3bb2a7={'messageId':_0x352d60['id']};return _0xaf5446[_0x489f('0x16')](_0x3bb2a7);}else{logger[_0x489f('0x19')](_0x489f('0x28'),_0x489f('0x26'),_0x489f('0x67'),util[_0x489f('0x27')](_0x352d60,{'showHidden':![],'depth':null}));}})[_0x489f('0x18')](function(_0x4292a9){logger[_0x489f('0x19')](_0x489f('0x28'),_0x489f('0x26'),_0x489f('0x67'),util[_0x489f('0x27')](_0x4292a9,{'showHidden':![],'depth':null}));});}else{logger[_0x489f('0x19')](_0x489f('0x28'),_0x489f('0x26'),_0x489f('0x67'),_0x489f('0x37'));}break;case'intelepeer':if(_0x2668ef[_0x489f('0x5b')]){var _0x1f8fb2={};var _0x31caad={'method':_0x489f('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x2668ef[_0x489f('0x5b')],'Content-Type':_0x489f('0x51')},'body':{'from':_0x2668ef[_0x489f('0x20')],'to':_0x116bf0['phone'],'text':_0x116bf0[_0x489f('0xa')]},'json':!![]};return rp(_0x31caad)['then'](function(_0xc64f3b){if(_0xc64f3b[_0x489f('0x6a')]==0xca){_0x1f8fb2['message']=_0xc64f3b;var _0x411d47={'method':_0x489f('0x32'),'uri':_0x489f('0x6b'),'headers':{'Authorization':_0x489f('0x6c')+_0x2668ef[_0x489f('0x5b')],'Content-Type':_0x489f('0x51')},'body':{'refid':_0x1f8fb2[_0x489f('0x6d')][_0x489f('0x6e')]},'json':!![]};return rp(_0x411d47)[_0x489f('0x15')](function(_0x5497b6){_0x1f8fb2['status']=_0x5497b6;var _0xaf629b={'messageId':_0x1f8fb2['message'][_0x489f('0x6e')],'read':!![]};return _0xaf5446[_0x489f('0x16')](_0xaf629b);});}else{return logger[_0x489f('0x19')](_0x489f('0x28'),_0x489f('0x26'),'intelepeer',util[_0x489f('0x27')](_0xc64f3b,{'showHidden':![],'depth':null}));}})['catch'](function(_0xb58717){return logger[_0x489f('0x19')](_0x489f('0x28'),_0x489f('0x26'),'intelepeer',util['inspect'](_0xb58717,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x489f('0x28'),_0x489f('0x26'),'intelepeer',_0x489f('0x6f'));}break;}}})[_0x489f('0x70')](function(){_0x320f9d();});}else{_0x320f9d();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
index e8f4b88..51ce301 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc1c5=['stringify','error','code','message','result','catch','SmsMessage','create','body','options','CreateSmsMessage','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x416265,_0x28953c){var _0x940c48=function(_0x57725d){while(--_0x57725d){_0x416265['push'](_0x416265['shift']());}};_0x940c48(++_0x28953c);}(_0xc1c5,0x16b));var _0x5c1c=function(_0x546f19,_0x5a233a){_0x546f19=_0x546f19-0x0;var _0x44ad9a=_0xc1c5[_0x546f19];return _0x44ad9a;};'use strict';var _=require(_0x5c1c('0x0'));var util=require(_0x5c1c('0x1'));var moment=require('moment');var BPromise=require(_0x5c1c('0x2'));var rs=require(_0x5c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c1c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c1c('0x5'))(_0x5c1c('0x6'));var config=require(_0x5c1c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5c1c('0x8')][_0x5c1c('0x9')]({'port':0x232a});config['redis']=_[_0x5c1c('0xa')](config[_0x5c1c('0xb')],{'host':_0x5c1c('0xc'),'port':0x18eb});var socket=require(_0x5c1c('0xd'))(new Redis(config[_0x5c1c('0xb')]));require(_0x5c1c('0xe'))['register'](socket);function respondWithRpcPromise(_0x208f61,_0x439661,_0x5cea8e){return new BPromise(function(_0x4e3b46,_0x2c7b61){return client[_0x5c1c('0xf')](_0x208f61,_0x5cea8e)[_0x5c1c('0x10')](function(_0x385a03){logger[_0x5c1c('0x11')](_0x5c1c('0x12'),_0x439661,'request\x20sent');logger[_0x5c1c('0x13')](_0x5c1c('0x14'),_0x439661,'request\x20sent',JSON[_0x5c1c('0x15')](_0x385a03));if(_0x385a03['error']){if(_0x385a03[_0x5c1c('0x16')][_0x5c1c('0x17')]===0x1f4){logger[_0x5c1c('0x16')](_0x5c1c('0x12'),_0x439661,_0x385a03['error'][_0x5c1c('0x18')]);return _0x2c7b61(_0x385a03[_0x5c1c('0x16')][_0x5c1c('0x18')]);}logger[_0x5c1c('0x16')]('SmsMessage,\x20%s,\x20%s',_0x439661,_0x385a03[_0x5c1c('0x16')]['message']);return _0x4e3b46(_0x385a03[_0x5c1c('0x16')][_0x5c1c('0x18')]);}else{logger[_0x5c1c('0x11')](_0x5c1c('0x12'),_0x439661,'request\x20sent');_0x4e3b46(_0x385a03[_0x5c1c('0x19')][_0x5c1c('0x18')]);}})[_0x5c1c('0x1a')](function(_0x366747){logger['error'](_0x5c1c('0x12'),_0x439661,_0x366747);_0x2c7b61(_0x366747);});});}exports['CreateSmsMessage']=function(_0x4d01e4){var _0x242c9b=this;return new Promise(function(_0x49f897,_0x2dc604){return db[_0x5c1c('0x1b')][_0x5c1c('0x1c')](_0x4d01e4[_0x5c1c('0x1d')],{'raw':_0x4d01e4['options']?_0x4d01e4[_0x5c1c('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x5c1c('0x10')](function(_0x1c456b){logger[_0x5c1c('0x11')]('CreateSmsMessage',_0x4d01e4);logger['debug'](_0x5c1c('0x1f'),_0x4d01e4,JSON[_0x5c1c('0x15')](_0x1c456b));_0x49f897(_0x1c456b);})[_0x5c1c('0x1a')](function(_0x5500ff){logger[_0x5c1c('0x16')](_0x5c1c('0x1f'),_0x5500ff[_0x5c1c('0x18')],_0x4d01e4);_0x2dc604(_0x242c9b[_0x5c1c('0x16')](0x1f4,_0x5500ff[_0x5c1c('0x18')]));});});};
\ No newline at end of file
+var _0x4c6f=['request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./smsMessage.socket','register'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4c6f,0x193));var _0xf4c6=function(_0x4334af,_0x21e066){_0x4334af=_0x4334af-0x0;var _0xec5be0=_0x4c6f[_0x4334af];return _0xec5be0;};'use strict';var _=require(_0xf4c6('0x0'));var util=require(_0xf4c6('0x1'));var moment=require(_0xf4c6('0x2'));var BPromise=require(_0xf4c6('0x3'));var rs=require(_0xf4c6('0x4'));var fs=require('fs');var Redis=require(_0xf4c6('0x5'));var db=require(_0xf4c6('0x6'))['db'];var utils=require(_0xf4c6('0x7'));var logger=require(_0xf4c6('0x8'))('rpc');var config=require(_0xf4c6('0x9'));var jayson=require(_0xf4c6('0xa'));var client=jayson[_0xf4c6('0xb')][_0xf4c6('0xc')]({'port':0x232a});config[_0xf4c6('0xd')]=_[_0xf4c6('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf4c6('0xf'))[_0xf4c6('0x10')](socket);function respondWithRpcPromise(_0x58c8fa,_0x503d68,_0x4dc241){return new BPromise(function(_0x1e65fa,_0x1a5613){return client[_0xf4c6('0x11')](_0x58c8fa,_0x4dc241)[_0xf4c6('0x12')](function(_0x9f8f46){logger[_0xf4c6('0x13')](_0xf4c6('0x14'),_0x503d68,_0xf4c6('0x15'));logger[_0xf4c6('0x16')](_0xf4c6('0x17'),_0x503d68,_0xf4c6('0x15'),JSON['stringify'](_0x9f8f46));if(_0x9f8f46[_0xf4c6('0x18')]){if(_0x9f8f46[_0xf4c6('0x18')]['code']===0x1f4){logger[_0xf4c6('0x18')](_0xf4c6('0x14'),_0x503d68,_0x9f8f46[_0xf4c6('0x18')][_0xf4c6('0x19')]);return _0x1a5613(_0x9f8f46[_0xf4c6('0x18')][_0xf4c6('0x19')]);}logger[_0xf4c6('0x18')](_0xf4c6('0x14'),_0x503d68,_0x9f8f46['error'][_0xf4c6('0x19')]);return _0x1e65fa(_0x9f8f46[_0xf4c6('0x18')][_0xf4c6('0x19')]);}else{logger[_0xf4c6('0x13')](_0xf4c6('0x14'),_0x503d68,_0xf4c6('0x15'));_0x1e65fa(_0x9f8f46[_0xf4c6('0x1a')][_0xf4c6('0x19')]);}})[_0xf4c6('0x1b')](function(_0x203ebd){logger[_0xf4c6('0x18')](_0xf4c6('0x14'),_0x503d68,_0x203ebd);_0x1a5613(_0x203ebd);});});}exports[_0xf4c6('0x1c')]=function(_0x118424){var _0x37db23=this;return new Promise(function(_0x3c0fa7,_0x568ec7){return db[_0xf4c6('0x1d')][_0xf4c6('0x1e')](_0x118424[_0xf4c6('0x1f')],{'raw':_0x118424[_0xf4c6('0x20')]?_0x118424[_0xf4c6('0x20')][_0xf4c6('0x21')]===undefined?!![]:![]:!![]})[_0xf4c6('0x12')](function(_0x41cac6){logger[_0xf4c6('0x13')](_0xf4c6('0x1c'),_0x118424);logger[_0xf4c6('0x16')]('CreateSmsMessage',_0x118424,JSON[_0xf4c6('0x22')](_0x41cac6));_0x3c0fa7(_0x41cac6);})['catch'](function(_0x42516a){logger[_0xf4c6('0x18')]('CreateSmsMessage',_0x42516a[_0xf4c6('0x19')],_0x118424);_0x568ec7(_0x37db23[_0xf4c6('0x18')](0x1f4,_0x42516a[_0xf4c6('0x19')]));});});};
\ No newline at end of file
index 27518dd..ab96e88 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3187=['length','smsMessage:','./smsMessage.events','save','remove','emit'];(function(_0x27da4e,_0x39ce30){var _0x3b2fd4=function(_0x110c2c){while(--_0x110c2c){_0x27da4e['push'](_0x27da4e['shift']());}};_0x3b2fd4(++_0x39ce30);}(_0x3187,0x92));var _0x7318=function(_0xc0ba7a,_0x10a26f){_0xc0ba7a=_0xc0ba7a-0x0;var _0x4f31c4=_0x3187[_0xc0ba7a];return _0x4f31c4;};'use strict';var SmsMessageEvents=require(_0x7318('0x0'));var events=[_0x7318('0x1'),_0x7318('0x2'),'update'];function createListener(_0x2fb577,_0x53c9fc){return function(_0x5679bb){_0x53c9fc[_0x7318('0x3')](_0x2fb577,_0x5679bb);};}function removeListener(_0x46f693,_0x2930ba){return function(){SmsMessageEvents['removeListener'](_0x46f693,_0x2930ba);};}exports['register']=function(_0x484542){for(var _0x27b2d5=0x0,_0xe990a6=events[_0x7318('0x4')];_0x27b2d5<_0xe990a6;_0x27b2d5++){var _0x5c21f6=events[_0x27b2d5];var _0x24691b=createListener(_0x7318('0x5')+_0x5c21f6,_0x484542);SmsMessageEvents['on'](_0x5c21f6,_0x24691b);}};
\ No newline at end of file
+var _0x7c99=['length','smsMessage:','./smsMessage.events','remove','update','emit','removeListener','register'];(function(_0x3a852a,_0xf3f1d3){var _0x48c902=function(_0x22cdd1){while(--_0x22cdd1){_0x3a852a['push'](_0x3a852a['shift']());}};_0x48c902(++_0xf3f1d3);}(_0x7c99,0x102));var _0x97c9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7c99[_0x432682];return _0x463d05;};'use strict';var SmsMessageEvents=require(_0x97c9('0x0'));var events=['save',_0x97c9('0x1'),_0x97c9('0x2')];function createListener(_0x2b40b6,_0x314aa1){return function(_0x6250ae){_0x314aa1[_0x97c9('0x3')](_0x2b40b6,_0x6250ae);};}function removeListener(_0x280526,_0x97e3f5){return function(){SmsMessageEvents[_0x97c9('0x4')](_0x280526,_0x97e3f5);};}exports[_0x97c9('0x5')]=function(_0x301ac2){for(var _0xf25e24=0x0,_0x57bc49=events[_0x97c9('0x6')];_0xf25e24<_0x57bc49;_0xf25e24++){var _0x69192c=events[_0xf25e24];var _0x130878=createListener(_0x97c9('0x7')+_0x69192c,_0x301ac2);SmsMessageEvents['on'](_0x69192c,_0x130878);}};
\ No newline at end of file
index 6da581d..d9d89d8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1d47=['delete','removeTeams','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','/:id','update','destroy'];(function(_0x2c3a47,_0x170687){var _0x1c04de=function(_0x367deb){while(--_0x367deb){_0x2c3a47['push'](_0x2c3a47['shift']());}};_0x1c04de(++_0x170687);}(_0x1d47,0x1f1));var _0x71d4=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x1d47[_0x4b2436];return _0x4f5ab2;};'use strict';var multer=require(_0x71d4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x71d4('0x1'));var express=require('express');var router=express[_0x71d4('0x2')]();var fs_extra=require(_0x71d4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x71d4('0x4'));var config=require(_0x71d4('0x5'));var controller=require(_0x71d4('0x6'));router[_0x71d4('0x7')]('/',auth[_0x71d4('0x8')](),controller[_0x71d4('0x9')]);router[_0x71d4('0x7')]('/describe',auth[_0x71d4('0x8')](),controller[_0x71d4('0xa')]);router[_0x71d4('0x7')]('/:id',auth[_0x71d4('0x8')](),controller['show']);router['get'](_0x71d4('0xb'),auth['isAuthenticated'](),controller[_0x71d4('0xc')]);router['get'](_0x71d4('0xd'),auth[_0x71d4('0x8')](),controller[_0x71d4('0xe')]);router[_0x71d4('0x7')](_0x71d4('0xf'),auth['isAuthenticated'](),controller[_0x71d4('0x10')]);router[_0x71d4('0x11')]('/',auth[_0x71d4('0x8')](),controller[_0x71d4('0x12')]);router['post'](_0x71d4('0xd'),auth[_0x71d4('0x8')](),controller[_0x71d4('0x13')]);router[_0x71d4('0x11')](_0x71d4('0xf'),auth[_0x71d4('0x8')](),controller['addAgents']);router['put'](_0x71d4('0x14'),auth[_0x71d4('0x8')](),controller[_0x71d4('0x15')]);router['delete'](_0x71d4('0x14'),auth[_0x71d4('0x8')](),controller[_0x71d4('0x16')]);router[_0x71d4('0x17')](_0x71d4('0xd'),auth[_0x71d4('0x8')](),controller[_0x71d4('0x18')]);router['delete']('/:id/users',auth[_0x71d4('0x8')](),controller['removeAgents']);module[_0x71d4('0x19')]=router;
\ No newline at end of file
+var _0x027b=['getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','update','delete','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/members'];(function(_0xf2a472,_0x2e3b9f){var _0x47e866=function(_0x42e6fa){while(--_0x42e6fa){_0xf2a472['push'](_0xf2a472['shift']());}};_0x47e866(++_0x2e3b9f);}(_0x027b,0xdd));var _0xb027=function(_0x28fe67,_0x1edde2){_0x28fe67=_0x28fe67-0x0;var _0xb27f14=_0x027b[_0x28fe67];return _0xb27f14;};'use strict';var multer=require(_0xb027('0x0'));var util=require('util');var path=require(_0xb027('0x1'));var timeout=require(_0xb027('0x2'));var express=require(_0xb027('0x3'));var router=express[_0xb027('0x4')]();var fs_extra=require(_0xb027('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb027('0x6'));var config=require(_0xb027('0x7'));var controller=require('./smsQueue.controller');router[_0xb027('0x8')]('/',auth[_0xb027('0x9')](),controller[_0xb027('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xb027('0x8')](_0xb027('0xb'),auth[_0xb027('0x9')](),controller['show']);router[_0xb027('0x8')](_0xb027('0xc'),auth['isAuthenticated'](),controller[_0xb027('0xd')]);router[_0xb027('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb027('0xe')]);router[_0xb027('0x8')](_0xb027('0xf'),auth[_0xb027('0x9')](),controller[_0xb027('0x10')]);router[_0xb027('0x11')]('/',auth['isAuthenticated'](),controller[_0xb027('0x12')]);router['post'](_0xb027('0x13'),auth[_0xb027('0x9')](),controller[_0xb027('0x14')]);router[_0xb027('0x11')](_0xb027('0xf'),auth[_0xb027('0x9')](),controller[_0xb027('0x15')]);router['put'](_0xb027('0xb'),auth[_0xb027('0x9')](),controller[_0xb027('0x16')]);router[_0xb027('0x17')](_0xb027('0xb'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xb027('0x13'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xb027('0x17')]('/:id/users',auth[_0xb027('0x9')](),controller[_0xb027('0x18')]);module[_0xb027('0x19')]=router;
\ No newline at end of file
index 3eb26ea..d1549a3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x29c9=['roundrobin','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x29c9,0x1db));var _0x929c=function(_0x315b43,_0x3e7793){_0x315b43=_0x315b43-0x0;var _0x4743c4=_0x29c9[_0x315b43];return _0x4743c4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x929c('0x0')],'unique':_0x929c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x929c('0x0')]},'timeout':{'type':Sequelize[_0x929c('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x929c('0x3')](_0x929c('0x4'),'beepall',_0x929c('0x5'))}};
\ No newline at end of file
+var _0xd667=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x56922c,_0x347c88){var _0xf896d7=function(_0x214e47){while(--_0x214e47){_0x56922c['push'](_0x56922c['shift']());}};_0xf896d7(++_0x347c88);}(_0xd667,0x1cf));var _0x7d66=function(_0x2c64ca,_0x444a5d){_0x2c64ca=_0x2c64ca-0x0;var _0x4672de=_0xd667[_0x2c64ca];return _0x4672de;};'use strict';var Sequelize=require(_0x7d66('0x0'));module[_0x7d66('0x1')]={'name':{'type':Sequelize[_0x7d66('0x2')],'unique':_0x7d66('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7d66('0x2')]},'timeout':{'type':Sequelize[_0x7d66('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7d66('0x5')](_0x7d66('0x6'),_0x7d66('0x7'),_0x7d66('0x8'))}};
\ No newline at end of file
index 1a30c84..0c01d30 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1e39=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','pick','SmsQueueId','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','Team','Agents','voicePause','interface','flatMap','sequelize','forEach','emit','userSmsQueue:save','removeTeams','ids','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','every','TeamId','includes','compact','value','transaction','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','sendStatus','json','offset','undefined','limit','count','status','Content-Range','reject','update','destroy','then','get','UserProfileResource','end','error','name','send','map','SmsQueue','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body'];(function(_0x707cd8,_0x5d3b56){var _0x5b9449=function(_0xd6e403){while(--_0xd6e403){_0x707cd8['push'](_0x707cd8['shift']());}};_0x5b9449(++_0x5d3b56);}(_0x1e39,0xc2));var _0x91e3=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x1e39[_0x481bf7];return _0x461787;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x91e3('0x0'));var zipdir=require(_0x91e3('0x1'));var jsonpatch=require(_0x91e3('0x2'));var rp=require(_0x91e3('0x3'));var moment=require('moment');var BPromise=require(_0x91e3('0x4'));var Mustache=require(_0x91e3('0x5'));var util=require(_0x91e3('0x6'));var path=require('path');var sox=require(_0x91e3('0x7'));var csv=require(_0x91e3('0x8'));var ejs=require(_0x91e3('0x9'));var fs=require('fs');var fs_extra=require(_0x91e3('0xa'));var _=require(_0x91e3('0xb'));var squel=require(_0x91e3('0xc'));var crypto=require(_0x91e3('0xd'));var jsforce=require(_0x91e3('0xe'));var deskjs=require(_0x91e3('0xf'));var toCsv=require(_0x91e3('0x8'));var querystring=require(_0x91e3('0x10'));var Papa=require(_0x91e3('0x11'));var Redis=require(_0x91e3('0x12'));var authService=require(_0x91e3('0x13'));var qs=require(_0x91e3('0x14'));var as=require(_0x91e3('0x15'));var hardwareService=require(_0x91e3('0x16'));var logger=require(_0x91e3('0x17'))(_0x91e3('0x18'));var utils=require(_0x91e3('0x19'));var config=require(_0x91e3('0x1a'));var licenseUtil=require(_0x91e3('0x1b'));var db=require(_0x91e3('0x1c'))['db'];config[_0x91e3('0x1d')]=_[_0x91e3('0x1e')](config[_0x91e3('0x1d')],{'host':_0x91e3('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithStatusCode(_0x339428,_0x1e64a8){_0x1e64a8=_0x1e64a8||0xcc;return function(_0x3508ae){if(_0x3508ae){return _0x339428[_0x91e3('0x20')](_0x1e64a8);}return _0x339428['status'](_0x1e64a8)['end']();};}function respondWithResult(_0x5d23b4,_0x1fa640){_0x1fa640=_0x1fa640||0xc8;return function(_0x329165){if(_0x329165){return _0x5d23b4['status'](_0x1fa640)[_0x91e3('0x21')](_0x329165);}};}function respondWithFilteredResult(_0x140f32,_0xbee685){return function(_0x5bb189){if(_0x5bb189){var _0x4ee5de=typeof _0xbee685[_0x91e3('0x22')]===_0x91e3('0x23')&&typeof _0xbee685[_0x91e3('0x24')]===_0x91e3('0x23');var _0x33fd7f=_0x5bb189[_0x91e3('0x25')];var _0x39230d=_0x4ee5de?0x0:_0xbee685[_0x91e3('0x22')];var _0x111f0f=_0x4ee5de?_0x5bb189['count']:_0xbee685[_0x91e3('0x22')]+_0xbee685[_0x91e3('0x24')];var _0x4b8e91;if(_0x111f0f>=_0x33fd7f){_0x111f0f=_0x33fd7f;_0x4b8e91=0xc8;}else{_0x4b8e91=0xce;}_0x140f32[_0x91e3('0x26')](_0x4b8e91);return _0x140f32['set'](_0x91e3('0x27'),_0x39230d+'-'+_0x111f0f+'/'+_0x33fd7f)[_0x91e3('0x21')](_0x5bb189);}return null;};}function patchUpdates(_0x433c71){return function(_0xe9a9c7){try{jsonpatch['apply'](_0xe9a9c7,_0x433c71,!![]);}catch(_0x326457){return BPromise[_0x91e3('0x28')](_0x326457);}return _0xe9a9c7['save']();};}function saveUpdates(_0x5468f5,_0x24624e){return function(_0x40a755){if(_0x40a755){return _0x40a755[_0x91e3('0x29')](_0x5468f5)['then'](function(_0x1558cc){return _0x1558cc;});}return null;};}function removeEntity(_0x1c8f0c,_0x16592d){return function(_0x51e48f){if(_0x51e48f){return _0x51e48f[_0x91e3('0x2a')]()[_0x91e3('0x2b')](function(){var _0x3d24ba=_0x51e48f[_0x91e3('0x2c')]({'plain':!![]});var _0x114589='SmsQueues';return db[_0x91e3('0x2d')][_0x91e3('0x2a')]({'where':{'type':_0x114589,'resourceId':_0x3d24ba['id']}})['then'](function(){return _0x51e48f;});})['then'](function(){_0x1c8f0c['status'](0xcc)[_0x91e3('0x2e')]();});}};}function handleEntityNotFound(_0x2aa3df,_0x2a54f0){return function(_0x21b153){if(!_0x21b153){_0x2aa3df['sendStatus'](0x194);}return _0x21b153;};}function handleError(_0x393110,_0x3ff452){_0x3ff452=_0x3ff452||0x1f4;return function(_0x2500ee){logger[_0x91e3('0x2f')](_0x2500ee['stack']);if(_0x2500ee[_0x91e3('0x30')]){delete _0x2500ee[_0x91e3('0x30')];}_0x393110[_0x91e3('0x26')](_0x3ff452)[_0x91e3('0x31')](_0x2500ee);};}exports['index']=function(_0x4afd35,_0x59e90d){var _0x27cace={},_0x155b34={},_0x87b213={'count':0x0,'rows':[]};var _0x308aa6=_[_0x91e3('0x32')](db[_0x91e3('0x33')]['rawAttributes'],function(_0x2c64e0){return{'name':_0x2c64e0[_0x91e3('0x34')],'type':_0x2c64e0[_0x91e3('0x35')][_0x91e3('0x36')]};});_0x155b34[_0x91e3('0x37')]=_[_0x91e3('0x32')](_0x308aa6,_0x91e3('0x30'));_0x155b34['query']=_[_0x91e3('0x38')](_0x4afd35['query']);_0x155b34['filters']=_[_0x91e3('0x39')](_0x155b34[_0x91e3('0x37')],_0x155b34['query']);_0x27cace['attributes']=_['intersection'](_0x155b34[_0x91e3('0x37')],qs['fields'](_0x4afd35[_0x91e3('0x3a')][_0x91e3('0x3b')]));_0x27cace[_0x91e3('0x3c')]=_0x27cace[_0x91e3('0x3c')][_0x91e3('0x3d')]?_0x27cace[_0x91e3('0x3c')]:_0x155b34[_0x91e3('0x37')];if(!_0x4afd35[_0x91e3('0x3a')][_0x91e3('0x3e')](_0x91e3('0x3f'))){_0x27cace[_0x91e3('0x24')]=qs[_0x91e3('0x24')](_0x4afd35['query'][_0x91e3('0x24')]);_0x27cace[_0x91e3('0x22')]=qs[_0x91e3('0x22')](_0x4afd35[_0x91e3('0x3a')][_0x91e3('0x22')]);}_0x27cace[_0x91e3('0x40')]=qs['sort'](_0x4afd35[_0x91e3('0x3a')][_0x91e3('0x41')]);_0x27cace[_0x91e3('0x42')]=qs[_0x91e3('0x43')](_['pick'](_0x4afd35['query'],_0x155b34[_0x91e3('0x43')]),_0x308aa6);if(_0x4afd35[_0x91e3('0x3a')]['filter']){_0x27cace[_0x91e3('0x42')]=_[_0x91e3('0x44')](_0x27cace[_0x91e3('0x42')],{'$or':_[_0x91e3('0x32')](_0x308aa6,function(_0x4bcf6f){if(_0x4bcf6f['type']!==_0x91e3('0x45')){var _0x5b1927={};_0x5b1927[_0x4bcf6f[_0x91e3('0x30')]]={'$like':'%'+_0x4afd35['query'][_0x91e3('0x46')]+'%'};return _0x5b1927;}})});}_0x27cace=_[_0x91e3('0x44')]({},_0x27cace,_0x4afd35[_0x91e3('0x47')]);var _0x44690e={'where':_0x27cace[_0x91e3('0x42')]};return db[_0x91e3('0x33')][_0x91e3('0x25')](_0x44690e)[_0x91e3('0x2b')](function(_0x17427d){_0x87b213[_0x91e3('0x25')]=_0x17427d;if(_0x4afd35[_0x91e3('0x3a')][_0x91e3('0x48')]){_0x27cace['include']=[{'all':!![]}];}return db['SmsQueue'][_0x91e3('0x49')](_0x27cace);})['then'](function(_0x4f6c6a){_0x87b213[_0x91e3('0x4a')]=_0x4f6c6a;return _0x87b213;})['then'](respondWithFilteredResult(_0x59e90d,_0x27cace))[_0x91e3('0x4b')](handleError(_0x59e90d,null));};exports[_0x91e3('0x4c')]=function(_0x2f2baa,_0xf61b2d){var _0x5c38d0={'raw':!![],'where':{'id':_0x2f2baa[_0x91e3('0x4d')]['id']}},_0x285824={};_0x285824[_0x91e3('0x37')]=_['keys'](db[_0x91e3('0x33')][_0x91e3('0x4e')]);_0x285824[_0x91e3('0x3a')]=_['keys'](_0x2f2baa[_0x91e3('0x3a')]);_0x285824[_0x91e3('0x43')]=_[_0x91e3('0x39')](_0x285824[_0x91e3('0x37')],_0x285824[_0x91e3('0x3a')]);_0x5c38d0[_0x91e3('0x3c')]=_[_0x91e3('0x39')](_0x285824['model'],qs[_0x91e3('0x3b')](_0x2f2baa['query'][_0x91e3('0x3b')]));_0x5c38d0[_0x91e3('0x3c')]=_0x5c38d0[_0x91e3('0x3c')][_0x91e3('0x3d')]?_0x5c38d0[_0x91e3('0x3c')]:_0x285824[_0x91e3('0x37')];if(_0x2f2baa['query'][_0x91e3('0x48')]){_0x5c38d0['include']=[{'all':!![]}];}_0x5c38d0=_[_0x91e3('0x44')]({},_0x5c38d0,_0x2f2baa[_0x91e3('0x47')]);return db[_0x91e3('0x33')][_0x91e3('0x4f')](_0x5c38d0)['then'](handleEntityNotFound(_0xf61b2d,null))[_0x91e3('0x2b')](respondWithResult(_0xf61b2d,null))[_0x91e3('0x4b')](handleError(_0xf61b2d,null));};exports[_0x91e3('0x50')]=function(_0x3bce14,_0x50b9ef){return db[_0x91e3('0x33')][_0x91e3('0x50')](_0x3bce14[_0x91e3('0x51')],{})[_0x91e3('0x2b')](function(_0x40f0d0){var _0x1210ba=_0x3bce14[_0x91e3('0x52')][_0x91e3('0x2c')]({'plain':!![]});if(!_0x1210ba)throw new Error(_0x91e3('0x53'));if(_0x1210ba['role']==='user'){var _0x13355a=_0x40f0d0[_0x91e3('0x2c')]({'plain':!![]});var _0x1155ce='SmsQueues';return db[_0x91e3('0x54')][_0x91e3('0x4f')]({'where':{'name':_0x1155ce,'userProfileId':_0x1210ba[_0x91e3('0x55')]},'raw':!![]})['then'](function(_0x30aecb){if(_0x30aecb&&_0x30aecb[_0x91e3('0x56')]===0x0){return db[_0x91e3('0x2d')][_0x91e3('0x50')]({'name':_0x13355a[_0x91e3('0x30')],'resourceId':_0x13355a['id'],'type':_0x30aecb['name'],'sectionId':_0x30aecb['id']},{})['then'](function(){return _0x40f0d0;});}else{return _0x40f0d0;}})[_0x91e3('0x4b')](function(_0x4ddf91){logger[_0x91e3('0x2f')](_0x91e3('0x57'),_0x4ddf91);throw _0x4ddf91;});}return _0x40f0d0;})[_0x91e3('0x2b')](respondWithResult(_0x50b9ef,0xc9))[_0x91e3('0x4b')](handleError(_0x50b9ef,null));};exports[_0x91e3('0x29')]=function(_0x2a757d,_0x55b980){if(_0x2a757d['body']['id']){delete _0x2a757d['body']['id'];}return db[_0x91e3('0x33')][_0x91e3('0x4f')]({'where':{'id':_0x2a757d[_0x91e3('0x4d')]['id']}})[_0x91e3('0x2b')](handleEntityNotFound(_0x55b980,null))[_0x91e3('0x2b')](saveUpdates(_0x2a757d[_0x91e3('0x51')],null))[_0x91e3('0x2b')](respondWithResult(_0x55b980,null))[_0x91e3('0x4b')](handleError(_0x55b980,null));};exports[_0x91e3('0x2a')]=function(_0x5768a0,_0x488ee1){return db[_0x91e3('0x33')]['find']({'where':{'id':_0x5768a0[_0x91e3('0x4d')]['id']}})[_0x91e3('0x2b')](handleEntityNotFound(_0x488ee1,null))['then'](removeEntity(_0x488ee1,null))[_0x91e3('0x4b')](handleError(_0x488ee1,null));};exports[_0x91e3('0x58')]=function(_0x2928f6,_0x753d46){return db[_0x91e3('0x33')][_0x91e3('0x58')]()[_0x91e3('0x2b')](respondWithResult(_0x753d46,null))['catch'](handleError(_0x753d46,null));};exports[_0x91e3('0x59')]=function(_0x4d69dc,_0x40ebf2,_0x3c6d32){var _0x666266={'raw':!![],'where':{}},_0x1873f0={},_0x535ff7;return db[_0x91e3('0x33')][_0x91e3('0x5a')]({'where':{'id':_0x4d69dc[_0x91e3('0x4d')]['id']}})[_0x91e3('0x2b')](handleEntityNotFound(_0x40ebf2,null))[_0x91e3('0x2b')](function(_0x2fe2c1){if(_0x2fe2c1){_0x535ff7=_0x2fe2c1[_0x91e3('0x2c')]({'plain':!![]});_0x1873f0[_0x91e3('0x37')]=_[_0x91e3('0x38')](db['UserSmsQueue'][_0x91e3('0x4e')]);_0x1873f0[_0x91e3('0x3a')]=_[_0x91e3('0x38')](_0x4d69dc['query']);_0x1873f0['filters']=_[_0x91e3('0x39')](_0x1873f0[_0x91e3('0x37')],_0x1873f0[_0x91e3('0x3a')]);_0x666266[_0x91e3('0x3c')]=_[_0x91e3('0x39')](_0x1873f0[_0x91e3('0x37')],qs[_0x91e3('0x3b')](_0x4d69dc[_0x91e3('0x3a')][_0x91e3('0x3b')]));_0x666266['attributes']=_0x666266['attributes']['length']?_0x666266['attributes']:_0x1873f0[_0x91e3('0x37')];if(!_0x4d69dc[_0x91e3('0x3a')]['hasOwnProperty'](_0x91e3('0x3f'))){_0x666266['limit']=qs[_0x91e3('0x24')](_0x4d69dc[_0x91e3('0x3a')][_0x91e3('0x24')]);_0x666266['offset']=qs[_0x91e3('0x22')](_0x4d69dc[_0x91e3('0x3a')][_0x91e3('0x22')]);}_0x666266['order']=qs[_0x91e3('0x41')](_0x4d69dc[_0x91e3('0x3a')]['sort']);_0x666266['where']=qs[_0x91e3('0x43')](_[_0x91e3('0x5b')](_0x4d69dc[_0x91e3('0x3a')],_0x1873f0['filters']));_0x666266[_0x91e3('0x42')][_0x91e3('0x5c')]=_0x2fe2c1['id'];if(_0x4d69dc['query'][_0x91e3('0x46')]){_0x666266[_0x91e3('0x42')]=_[_0x91e3('0x44')](_0x666266['where'],{'$or':_[_0x91e3('0x32')](_0x666266['attributes'],function(_0x54373e){var _0x3aae25={};_0x3aae25[_0x54373e]={'$like':'%'+_0x4d69dc[_0x91e3('0x3a')][_0x91e3('0x46')]+'%'};return _0x3aae25;})});}_0x666266=_[_0x91e3('0x44')]({},_0x666266,_0x4d69dc[_0x91e3('0x47')]);return db[_0x91e3('0x5d')]['findAll'](_0x666266);}})[_0x91e3('0x2b')](function(_0x4efd4d){if(_0x4efd4d){return db[_0x91e3('0x5e')][_0x91e3('0x5f')]({'where':{'id':_[_0x91e3('0x32')](_0x4efd4d,_0x91e3('0x60')),'role':_0x91e3('0x61')},'attributes':['id',_0x91e3('0x30'),_0x91e3('0x62'),_0x91e3('0x63'),_0x91e3('0x64')]});}})[_0x91e3('0x2b')](function(_0x14eb8e){if(_0x14eb8e){return{'count':_0x14eb8e[_0x91e3('0x25')],'rows':_['map'](_0x14eb8e['rows'],function(_0x4bf659){return{'membername':_0x4bf659[_0x91e3('0x30')],'UserId':_0x4bf659['id'],'queue_name':_0x535ff7[_0x91e3('0x30')],'SmsQueueId':_0x535ff7['id'],'interface':util[_0x91e3('0x65')]('%s/%s',_0x91e3('0x66'),_0x4bf659[_0x91e3('0x30')]),'penalty':0x0,'paused':_0x4bf659['smsPause'],'createdAt':_0x4bf659['createdAt'],'updatedAt':_0x4bf659[_0x91e3('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x91e3('0x2b')](respondWithFilteredResult(_0x40ebf2,_0x666266))['catch'](handleError(_0x40ebf2,null));};exports[_0x91e3('0x67')]=function(_0x183649,_0x19ef95,_0x3c8278){var _0x16cb1a={};var _0x2e3565={};var _0x1a5ffa;var _0x481d11;return db[_0x91e3('0x33')][_0x91e3('0x5a')]({'where':{'id':_0x183649['params']['id']}})['then'](handleEntityNotFound(_0x19ef95,null))[_0x91e3('0x2b')](function(_0x157e35){if(_0x157e35){_0x1a5ffa=_0x157e35;_0x2e3565['model']=_['keys'](db['Team'][_0x91e3('0x4e')]);_0x2e3565['query']=_[_0x91e3('0x38')](_0x183649[_0x91e3('0x3a')]);_0x2e3565[_0x91e3('0x43')]=_[_0x91e3('0x39')](_0x2e3565[_0x91e3('0x37')],_0x2e3565[_0x91e3('0x3a')]);_0x16cb1a[_0x91e3('0x3c')]=_[_0x91e3('0x39')](_0x2e3565[_0x91e3('0x37')],qs[_0x91e3('0x3b')](_0x183649['query']['fields']));_0x16cb1a['attributes']=_0x16cb1a[_0x91e3('0x3c')]['length']?_0x16cb1a[_0x91e3('0x3c')]:_0x2e3565[_0x91e3('0x37')];_0x16cb1a[_0x91e3('0x40')]=qs[_0x91e3('0x41')](_0x183649[_0x91e3('0x3a')][_0x91e3('0x41')]);_0x16cb1a['where']=qs['filters'](_[_0x91e3('0x5b')](_0x183649[_0x91e3('0x3a')],_0x2e3565['filters']));if(_0x183649[_0x91e3('0x3a')][_0x91e3('0x46')]){_0x16cb1a[_0x91e3('0x42')]=_[_0x91e3('0x44')](_0x16cb1a[_0x91e3('0x42')],{'$or':_['map'](_0x16cb1a[_0x91e3('0x3c')],function(_0x1dffdb){var _0x4ab4bd={};_0x4ab4bd[_0x1dffdb]={'$like':'%'+_0x183649[_0x91e3('0x3a')]['filter']+'%'};return _0x4ab4bd;})});}_0x16cb1a=_[_0x91e3('0x44')]({},_0x16cb1a,_0x183649[_0x91e3('0x47')]);return _0x1a5ffa[_0x91e3('0x67')](_0x16cb1a);}})['then'](function(_0x33890a){if(_0x33890a){_0x481d11=_0x33890a[_0x91e3('0x3d')];if(!_0x183649[_0x91e3('0x3a')][_0x91e3('0x3e')](_0x91e3('0x3f'))){_0x16cb1a[_0x91e3('0x24')]=qs[_0x91e3('0x24')](_0x183649[_0x91e3('0x3a')][_0x91e3('0x24')]);_0x16cb1a[_0x91e3('0x22')]=qs[_0x91e3('0x22')](_0x183649['query'][_0x91e3('0x22')]);}return _0x1a5ffa[_0x91e3('0x67')](_0x16cb1a);}})[_0x91e3('0x2b')](function(_0x430e09){if(_0x430e09){return _0x430e09?{'count':_0x481d11,'rows':_0x430e09}:null;}})[_0x91e3('0x2b')](respondWithResult(_0x19ef95,null))[_0x91e3('0x4b')](handleError(_0x19ef95,null));};exports[_0x91e3('0x68')]=function(_0x4ad3dc,_0x546b4e,_0x2be248){var _0x535b6b=_0x4ad3dc[_0x91e3('0x51')]['ids'];return db[_0x91e3('0x69')][_0x91e3('0x49')]({'where':{'id':_0x535b6b},'attributes':['id'],'include':[{'model':db[_0x91e3('0x5e')],'as':_0x91e3('0x6a'),'attributes':['id','name','online',_0x91e3('0x6b'),_0x91e3('0x6c')],'raw':!![]}]})['then'](function(_0x49b8a7){if(_0x49b8a7){var _0x1f3f43=_[_0x91e3('0x6d')](_0x49b8a7,function(_0x222368){var _0x4add0c=_0x222368['get']({'plain':!![]});return _0x4add0c[_0x91e3('0x6a')];});return db[_0x91e3('0x33')][_0x91e3('0x4f')]({'where':{'id':_0x4ad3dc[_0x91e3('0x4d')]['id']}})[_0x91e3('0x2b')](function(_0xbfc801){return db[_0x91e3('0x6e')]['transaction'](function(_0x7bf99d){return _0xbfc801[_0x91e3('0x68')](_0x535b6b,{'transaction':_0x7bf99d})[_0x91e3('0x2b')](function(){return BPromise['each'](_0x1f3f43,function(_0x5a2be3){return db[_0x91e3('0x5d')]['findOrCreate']({'where':{'UserId':_0x5a2be3['id'],'SmsQueueId':_0x4ad3dc['params']['id']},'transaction':_0x7bf99d});});})[_0x91e3('0x2b')](function(){_0x1f3f43[_0x91e3('0x6f')](function(_0x4296c2){socket[_0x91e3('0x70')](_0x91e3('0x71'),{'UserId':_0x4296c2['id'],'SmsQueueId':_0xbfc801['id']});});});});});}})['then'](respondWithStatusCode(_0x546b4e,null))[_0x91e3('0x4b')](handleError(_0x546b4e,null));};exports[_0x91e3('0x72')]=function(_0x36516f,_0x236a83,_0x1d7ea0){return db[_0x91e3('0x69')][_0x91e3('0x49')]({'where':{'id':_0x36516f[_0x91e3('0x3a')][_0x91e3('0x73')]},'attributes':['id'],'include':[{'model':db[_0x91e3('0x5e')],'as':_0x91e3('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x236a83,null))[_0x91e3('0x2b')](function(_0x52bbf1){var _0x3ce8e1=_[_0x91e3('0x32')](_0x52bbf1,'id');var _0x1eb3b7=[];var _0x2c88a2=[];var _0x5d1bd4=squel[_0x91e3('0x74')]();_0x5d1bd4[_0x91e3('0x75')]('tq.TeamId')[_0x91e3('0x76')](_0x91e3('0x77'),'tq')[_0x91e3('0x78')](_0x91e3('0x79'),'ut',_0x91e3('0x7a'))[_0x91e3('0x42')]('SmsQueueId\x20=\x20?',_0x36516f[_0x91e3('0x4d')]['id']);for(var _0x504c23=0x0;_0x504c23<_0x52bbf1['length'];_0x504c23+=0x1){let _0xa5b8e6=_0x52bbf1[_0x504c23];for(var _0xb7ed0f=0x0;_0xb7ed0f<_0xa5b8e6[_0x91e3('0x6a')]['length'];_0xb7ed0f+=0x1){let _0x599340=_0xa5b8e6[_0x91e3('0x6a')][_0xb7ed0f];var _0x403ef3=_0x5d1bd4[_0x91e3('0x7b')]();_0x403ef3[_0x91e3('0x42')]('ut.UserId\x20=\x20?',_0x599340['id']);_0x2c88a2[_0x91e3('0x7c')](db[_0x91e3('0x6e')][_0x91e3('0x3a')](_0x403ef3['toString'](),{'type':db[_0x91e3('0x6e')]['QueryTypes']['SELECT']})[_0x91e3('0x2b')](function(_0x286aeb){if(_0x286aeb['length']===0x1){return _0x599340['id'];}else{var _0xd3ea58=_[_0x91e3('0x7d')](_[_0x91e3('0x32')](_0x286aeb,_0x91e3('0x7e')),function(_0x5895d3){return _[_0x91e3('0x7f')](_0x3ce8e1,_0x5895d3);});if(_0xd3ea58){return _0x599340['id'];}}}));}}return BPromise['all'](_0x2c88a2)['then'](function(_0x585b82){_0x1eb3b7=_(_0x1eb3b7)['union'](_0x585b82)[_0x91e3('0x80')]()[_0x91e3('0x81')]();return db['SmsQueue']['find']({'where':{'id':_0x36516f['params']['id']}})[_0x91e3('0x2b')](function(_0x583a6b){return db[_0x91e3('0x6e')][_0x91e3('0x82')](function(_0x222114){return _0x583a6b[_0x91e3('0x72')](_0x36516f['query'][_0x91e3('0x73')],{'transaction':_0x222114})[_0x91e3('0x2b')](function(){if(!_['isEmpty'](_0x1eb3b7)){return _0x583a6b[_0x91e3('0x83')](_0x1eb3b7,{'transaction':_0x222114});}})[_0x91e3('0x2b')](function(){_0x1eb3b7[_0x91e3('0x6f')](function(_0x3a9310){socket['emit'](_0x91e3('0x84'),{'UserId':_0x3a9310,'SmsQueueId':_0x583a6b['id']});});});});});});})[_0x91e3('0x2b')](respondWithStatusCode(_0x236a83,null))[_0x91e3('0x4b')](handleError(_0x236a83,null));};exports[_0x91e3('0x85')]=function(_0x3a55a9,_0x1513d1,_0x11d994){return db[_0x91e3('0x33')][_0x91e3('0x4f')]({'where':{'id':_0x3a55a9[_0x91e3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1513d1,null))['then'](function(_0x147fe3){if(_0x147fe3){return _0x147fe3[_0x91e3('0x85')](_0x3a55a9[_0x91e3('0x51')][_0x91e3('0x73')],_[_0x91e3('0x86')](_0x3a55a9['body'],['ids','id'])||{})[_0x91e3('0x87')](function(_0x3c12ba){for(var _0x3e359d=0x0;_0x3e359d<_0x3a55a9[_0x91e3('0x51')][_0x91e3('0x73')][_0x91e3('0x3d')];_0x3e359d+=0x1){socket[_0x91e3('0x70')](_0x91e3('0x71'),{'UserId':Number(_0x3a55a9[_0x91e3('0x51')][_0x91e3('0x73')][_0x3e359d]),'SmsQueueId':Number(_0x3a55a9[_0x91e3('0x4d')]['id'])});}return _0x3c12ba;});}})[_0x91e3('0x2b')](respondWithResult(_0x1513d1,null))[_0x91e3('0x4b')](handleError(_0x1513d1,null));};exports['removeAgents']=function(_0x24fbd6,_0x50a3b2,_0x3dacb7){return db[_0x91e3('0x33')][_0x91e3('0x4f')]({'where':{'id':_0x24fbd6[_0x91e3('0x4d')]['id']}})[_0x91e3('0x2b')](handleEntityNotFound(_0x50a3b2,null))[_0x91e3('0x2b')](function(_0x310c7e){if(_0x310c7e){return _0x310c7e[_0x91e3('0x83')](_0x24fbd6[_0x91e3('0x3a')][_0x91e3('0x73')])[_0x91e3('0x2b')](function(){if(_[_0x91e3('0x88')](_0x24fbd6[_0x91e3('0x3a')][_0x91e3('0x73')])){for(var _0x2776d6=0x0;_0x2776d6<_0x24fbd6[_0x91e3('0x3a')][_0x91e3('0x73')][_0x91e3('0x3d')];_0x2776d6+=0x1){socket[_0x91e3('0x70')]('userSmsQueue:remove',{'UserId':Number(_0x24fbd6[_0x91e3('0x3a')][_0x91e3('0x73')][_0x2776d6]),'SmsQueueId':Number(_0x24fbd6[_0x91e3('0x4d')]['id'])});}}else{socket[_0x91e3('0x70')](_0x91e3('0x84'),{'UserId':Number(_0x24fbd6[_0x91e3('0x3a')][_0x91e3('0x73')]),'SmsQueueId':Number(_0x24fbd6[_0x91e3('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x50a3b2,null))[_0x91e3('0x4b')](handleError(_0x50a3b2,null));};exports['getAgents']=function(_0x562865,_0x31f498,_0x10ef53){var _0x3220c0={};var _0x337472={};var _0x138ae1;var _0x1a922f;return db[_0x91e3('0x33')][_0x91e3('0x5a')]({'where':{'id':_0x562865['params']['id']}})[_0x91e3('0x2b')](handleEntityNotFound(_0x31f498,null))['then'](function(_0x3d3d5f){if(_0x3d3d5f){_0x138ae1=_0x3d3d5f;_0x337472[_0x91e3('0x37')]=_['keys'](db[_0x91e3('0x5e')][_0x91e3('0x4e')]);_0x337472[_0x91e3('0x3a')]=_[_0x91e3('0x38')](_0x562865[_0x91e3('0x3a')]);_0x337472[_0x91e3('0x43')]=_['intersection'](_0x337472[_0x91e3('0x37')],_0x337472[_0x91e3('0x3a')]);_0x3220c0[_0x91e3('0x3c')]=_['intersection'](_0x337472[_0x91e3('0x37')],qs[_0x91e3('0x3b')](_0x562865[_0x91e3('0x3a')][_0x91e3('0x3b')]));_0x3220c0[_0x91e3('0x3c')]=_0x3220c0[_0x91e3('0x3c')]['length']?_0x3220c0[_0x91e3('0x3c')]:_0x337472[_0x91e3('0x37')];_0x3220c0['order']=qs[_0x91e3('0x41')](_0x562865[_0x91e3('0x3a')][_0x91e3('0x41')]);_0x3220c0['where']=qs[_0x91e3('0x43')](_[_0x91e3('0x5b')](_0x562865[_0x91e3('0x3a')],_0x337472[_0x91e3('0x43')]));if(_0x562865['query']['filter']){_0x3220c0[_0x91e3('0x42')]=_[_0x91e3('0x44')](_0x3220c0['where'],{'$or':_['map'](_0x3220c0[_0x91e3('0x3c')],function(_0x586489){var _0x38f2a8={};_0x38f2a8[_0x586489]={'$like':'%'+_0x562865[_0x91e3('0x3a')][_0x91e3('0x46')]+'%'};return _0x38f2a8;})});}_0x3220c0=_['merge']({},_0x3220c0,_0x562865[_0x91e3('0x47')]);return _0x138ae1['getAgents'](_0x3220c0);}})[_0x91e3('0x2b')](function(_0x595c5d){if(_0x595c5d){_0x1a922f=_0x595c5d[_0x91e3('0x3d')];if(!_0x562865[_0x91e3('0x3a')][_0x91e3('0x3e')](_0x91e3('0x3f'))){_0x3220c0['limit']=qs[_0x91e3('0x24')](_0x562865['query'][_0x91e3('0x24')]);_0x3220c0['offset']=qs[_0x91e3('0x22')](_0x562865[_0x91e3('0x3a')][_0x91e3('0x22')]);}return _0x138ae1[_0x91e3('0x89')](_0x3220c0);}})[_0x91e3('0x2b')](function(_0x20549f){if(_0x20549f){return _0x20549f?{'count':_0x1a922f,'rows':_0x20549f}:null;}})[_0x91e3('0x2b')](respondWithResult(_0x31f498,null))[_0x91e3('0x4b')](handleError(_0x31f498,null));};
\ No newline at end of file
+var _0xcdf6=['findAndCountAll','UserId','updatedAt','createdAt','SIP','smsPause','Team','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','forEach','emit','userSmsQueue:save','removeTeams','User','select','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','union','compact','value','transaction','isEmpty','removeAgents','addAgents','spread','isArray','userSmsQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','SmsQueues','UserProfileResource','then','error','stack','name','send','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','intersection','length','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','body','find','describe','getMembers','findOne','UserSmsQueue','SmsQueueId'];(function(_0x34954b,_0x525aec){var _0x245230=function(_0x143cb3){while(--_0x143cb3){_0x34954b['push'](_0x34954b['shift']());}};_0x245230(++_0x525aec);}(_0xcdf6,0xb3));var _0x6cdf=function(_0x2ee4b8,_0x3e60e7){_0x2ee4b8=_0x2ee4b8-0x0;var _0x53690b=_0xcdf6[_0x2ee4b8];return _0x53690b;};'use strict';var emlformat=require(_0x6cdf('0x0'));var rimraf=require(_0x6cdf('0x1'));var zipdir=require(_0x6cdf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cdf('0x3'));var moment=require(_0x6cdf('0x4'));var BPromise=require(_0x6cdf('0x5'));var Mustache=require(_0x6cdf('0x6'));var util=require(_0x6cdf('0x7'));var path=require(_0x6cdf('0x8'));var sox=require(_0x6cdf('0x9'));var csv=require(_0x6cdf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6cdf('0xb'));var _=require(_0x6cdf('0xc'));var squel=require(_0x6cdf('0xd'));var crypto=require('crypto');var jsforce=require(_0x6cdf('0xe'));var deskjs=require(_0x6cdf('0xf'));var toCsv=require(_0x6cdf('0xa'));var querystring=require('querystring');var Papa=require(_0x6cdf('0x10'));var Redis=require(_0x6cdf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6cdf('0x12'));var as=require(_0x6cdf('0x13'));var hardwareService=require(_0x6cdf('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6cdf('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6cdf('0x16'));var db=require(_0x6cdf('0x17'))['db'];config[_0x6cdf('0x18')]=_[_0x6cdf('0x19')](config[_0x6cdf('0x18')],{'host':_0x6cdf('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6cdf('0x18')]));require(_0x6cdf('0x1b'))[_0x6cdf('0x1c')](socket);function respondWithStatusCode(_0x35d617,_0x5e2f0b){_0x5e2f0b=_0x5e2f0b||0xcc;return function(_0x202426){if(_0x202426){return _0x35d617[_0x6cdf('0x1d')](_0x5e2f0b);}return _0x35d617['status'](_0x5e2f0b)[_0x6cdf('0x1e')]();};}function respondWithResult(_0x25f04c,_0x5da5fa){_0x5da5fa=_0x5da5fa||0xc8;return function(_0x2ce47d){if(_0x2ce47d){return _0x25f04c[_0x6cdf('0x1f')](_0x5da5fa)[_0x6cdf('0x20')](_0x2ce47d);}};}function respondWithFilteredResult(_0x3e3c4c,_0x38e2ea){return function(_0x2383e4){if(_0x2383e4){var _0x2227f9=typeof _0x38e2ea[_0x6cdf('0x21')]===_0x6cdf('0x22')&&typeof _0x38e2ea[_0x6cdf('0x23')]==='undefined';var _0x343ea4=_0x2383e4[_0x6cdf('0x24')];var _0x119952=_0x2227f9?0x0:_0x38e2ea[_0x6cdf('0x21')];var _0x349fe6=_0x2227f9?_0x2383e4[_0x6cdf('0x24')]:_0x38e2ea['offset']+_0x38e2ea[_0x6cdf('0x23')];var _0x341b62;if(_0x349fe6>=_0x343ea4){_0x349fe6=_0x343ea4;_0x341b62=0xc8;}else{_0x341b62=0xce;}_0x3e3c4c[_0x6cdf('0x1f')](_0x341b62);return _0x3e3c4c[_0x6cdf('0x25')](_0x6cdf('0x26'),_0x119952+'-'+_0x349fe6+'/'+_0x343ea4)['json'](_0x2383e4);}return null;};}function patchUpdates(_0x2991e7){return function(_0x49768e){try{jsonpatch[_0x6cdf('0x27')](_0x49768e,_0x2991e7,!![]);}catch(_0x1ea9c5){return BPromise['reject'](_0x1ea9c5);}return _0x49768e[_0x6cdf('0x28')]();};}function saveUpdates(_0x4d7ab7,_0x5f21ca){return function(_0x2e5b41){if(_0x2e5b41){return _0x2e5b41[_0x6cdf('0x29')](_0x4d7ab7)['then'](function(_0x5e1421){return _0x5e1421;});}return null;};}function removeEntity(_0x41e8ef,_0x1aa315){return function(_0x3b5f9f){if(_0x3b5f9f){return _0x3b5f9f[_0x6cdf('0x2a')]()['then'](function(){var _0x5a6451=_0x3b5f9f[_0x6cdf('0x2b')]({'plain':!![]});var _0x5c3189=_0x6cdf('0x2c');return db[_0x6cdf('0x2d')][_0x6cdf('0x2a')]({'where':{'type':_0x5c3189,'resourceId':_0x5a6451['id']}})[_0x6cdf('0x2e')](function(){return _0x3b5f9f;});})[_0x6cdf('0x2e')](function(){_0x41e8ef[_0x6cdf('0x1f')](0xcc)[_0x6cdf('0x1e')]();});}};}function handleEntityNotFound(_0x1b7a14,_0x726db6){return function(_0x42aa74){if(!_0x42aa74){_0x1b7a14[_0x6cdf('0x1d')](0x194);}return _0x42aa74;};}function handleError(_0x41a498,_0x409dde){_0x409dde=_0x409dde||0x1f4;return function(_0x386b81){logger[_0x6cdf('0x2f')](_0x386b81[_0x6cdf('0x30')]);if(_0x386b81['name']){delete _0x386b81[_0x6cdf('0x31')];}_0x41a498[_0x6cdf('0x1f')](_0x409dde)[_0x6cdf('0x32')](_0x386b81);};}exports['index']=function(_0x39dde2,_0x720fca){var _0x267664={},_0x2a4e4b={},_0x48271d={'count':0x0,'rows':[]};var _0x1e0f75=_[_0x6cdf('0x33')](db[_0x6cdf('0x34')][_0x6cdf('0x35')],function(_0x209106){return{'name':_0x209106[_0x6cdf('0x36')],'type':_0x209106[_0x6cdf('0x37')][_0x6cdf('0x38')]};});_0x2a4e4b[_0x6cdf('0x39')]=_[_0x6cdf('0x33')](_0x1e0f75,'name');_0x2a4e4b[_0x6cdf('0x3a')]=_[_0x6cdf('0x3b')](_0x39dde2[_0x6cdf('0x3a')]);_0x2a4e4b[_0x6cdf('0x3c')]=_['intersection'](_0x2a4e4b[_0x6cdf('0x39')],_0x2a4e4b['query']);_0x267664[_0x6cdf('0x3d')]=_['intersection'](_0x2a4e4b[_0x6cdf('0x39')],qs[_0x6cdf('0x3e')](_0x39dde2[_0x6cdf('0x3a')]['fields']));_0x267664['attributes']=_0x267664['attributes']['length']?_0x267664['attributes']:_0x2a4e4b[_0x6cdf('0x39')];if(!_0x39dde2[_0x6cdf('0x3a')][_0x6cdf('0x3f')](_0x6cdf('0x40'))){_0x267664[_0x6cdf('0x23')]=qs['limit'](_0x39dde2[_0x6cdf('0x3a')][_0x6cdf('0x23')]);_0x267664[_0x6cdf('0x21')]=qs[_0x6cdf('0x21')](_0x39dde2[_0x6cdf('0x3a')][_0x6cdf('0x21')]);}_0x267664[_0x6cdf('0x41')]=qs[_0x6cdf('0x42')](_0x39dde2[_0x6cdf('0x3a')][_0x6cdf('0x42')]);_0x267664[_0x6cdf('0x43')]=qs['filters'](_[_0x6cdf('0x44')](_0x39dde2[_0x6cdf('0x3a')],_0x2a4e4b[_0x6cdf('0x3c')]),_0x1e0f75);if(_0x39dde2[_0x6cdf('0x3a')]['filter']){_0x267664[_0x6cdf('0x43')]=_[_0x6cdf('0x45')](_0x267664[_0x6cdf('0x43')],{'$or':_[_0x6cdf('0x33')](_0x1e0f75,function(_0x2f04c8){if(_0x2f04c8[_0x6cdf('0x37')]!==_0x6cdf('0x46')){var _0x23d038={};_0x23d038[_0x2f04c8[_0x6cdf('0x31')]]={'$like':'%'+_0x39dde2[_0x6cdf('0x3a')][_0x6cdf('0x47')]+'%'};return _0x23d038;}})});}_0x267664=_[_0x6cdf('0x45')]({},_0x267664,_0x39dde2[_0x6cdf('0x48')]);var _0x21045e={'where':_0x267664['where']};return db[_0x6cdf('0x34')][_0x6cdf('0x24')](_0x21045e)[_0x6cdf('0x2e')](function(_0x3b26bc){_0x48271d[_0x6cdf('0x24')]=_0x3b26bc;if(_0x39dde2[_0x6cdf('0x3a')]['includeAll']){_0x267664[_0x6cdf('0x49')]=[{'all':!![]}];}return db[_0x6cdf('0x34')][_0x6cdf('0x4a')](_0x267664);})['then'](function(_0x3499a8){_0x48271d[_0x6cdf('0x4b')]=_0x3499a8;return _0x48271d;})[_0x6cdf('0x2e')](respondWithFilteredResult(_0x720fca,_0x267664))[_0x6cdf('0x4c')](handleError(_0x720fca,null));};exports[_0x6cdf('0x4d')]=function(_0x2efb4e,_0x390584){var _0x1a4f82={'raw':!![],'where':{'id':_0x2efb4e['params']['id']}},_0x3055ce={};_0x3055ce[_0x6cdf('0x39')]=_['keys'](db[_0x6cdf('0x34')]['rawAttributes']);_0x3055ce['query']=_[_0x6cdf('0x3b')](_0x2efb4e['query']);_0x3055ce['filters']=_['intersection'](_0x3055ce[_0x6cdf('0x39')],_0x3055ce[_0x6cdf('0x3a')]);_0x1a4f82[_0x6cdf('0x3d')]=_[_0x6cdf('0x4e')](_0x3055ce['model'],qs['fields'](_0x2efb4e[_0x6cdf('0x3a')][_0x6cdf('0x3e')]));_0x1a4f82[_0x6cdf('0x3d')]=_0x1a4f82[_0x6cdf('0x3d')][_0x6cdf('0x4f')]?_0x1a4f82[_0x6cdf('0x3d')]:_0x3055ce[_0x6cdf('0x39')];if(_0x2efb4e[_0x6cdf('0x3a')][_0x6cdf('0x50')]){_0x1a4f82[_0x6cdf('0x49')]=[{'all':!![]}];}_0x1a4f82=_[_0x6cdf('0x45')]({},_0x1a4f82,_0x2efb4e['options']);return db[_0x6cdf('0x34')]['find'](_0x1a4f82)[_0x6cdf('0x2e')](handleEntityNotFound(_0x390584,null))[_0x6cdf('0x2e')](respondWithResult(_0x390584,null))[_0x6cdf('0x4c')](handleError(_0x390584,null));};exports[_0x6cdf('0x51')]=function(_0x30f4dd,_0x11adf8){return db[_0x6cdf('0x34')]['create'](_0x30f4dd['body'],{})[_0x6cdf('0x2e')](function(_0x1d22f3){var _0x59d290=_0x30f4dd[_0x6cdf('0x52')][_0x6cdf('0x2b')]({'plain':!![]});if(!_0x59d290)throw new Error(_0x6cdf('0x53'));if(_0x59d290[_0x6cdf('0x54')]==='user'){var _0x23c3eb=_0x1d22f3[_0x6cdf('0x2b')]({'plain':!![]});var _0x1d6d4c=_0x6cdf('0x2c');return db[_0x6cdf('0x55')]['find']({'where':{'name':_0x1d6d4c,'userProfileId':_0x59d290['userProfileId']},'raw':!![]})['then'](function(_0xbb2b8){if(_0xbb2b8&&_0xbb2b8[_0x6cdf('0x56')]===0x0){return db[_0x6cdf('0x2d')][_0x6cdf('0x51')]({'name':_0x23c3eb[_0x6cdf('0x31')],'resourceId':_0x23c3eb['id'],'type':_0xbb2b8['name'],'sectionId':_0xbb2b8['id']},{})[_0x6cdf('0x2e')](function(){return _0x1d22f3;});}else{return _0x1d22f3;}})[_0x6cdf('0x4c')](function(_0xd39228){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd39228);throw _0xd39228;});}return _0x1d22f3;})[_0x6cdf('0x2e')](respondWithResult(_0x11adf8,0xc9))[_0x6cdf('0x4c')](handleError(_0x11adf8,null));};exports[_0x6cdf('0x29')]=function(_0x45eadf,_0x337fa7){if(_0x45eadf['body']['id']){delete _0x45eadf['body']['id'];}return db[_0x6cdf('0x34')]['find']({'where':{'id':_0x45eadf[_0x6cdf('0x57')]['id']}})[_0x6cdf('0x2e')](handleEntityNotFound(_0x337fa7,null))['then'](saveUpdates(_0x45eadf[_0x6cdf('0x58')],null))[_0x6cdf('0x2e')](respondWithResult(_0x337fa7,null))[_0x6cdf('0x4c')](handleError(_0x337fa7,null));};exports[_0x6cdf('0x2a')]=function(_0x5338a3,_0x353013){return db[_0x6cdf('0x34')][_0x6cdf('0x59')]({'where':{'id':_0x5338a3[_0x6cdf('0x57')]['id']}})[_0x6cdf('0x2e')](handleEntityNotFound(_0x353013,null))[_0x6cdf('0x2e')](removeEntity(_0x353013,null))[_0x6cdf('0x4c')](handleError(_0x353013,null));};exports[_0x6cdf('0x5a')]=function(_0x1dbdc9,_0x2cfb01){return db[_0x6cdf('0x34')][_0x6cdf('0x5a')]()[_0x6cdf('0x2e')](respondWithResult(_0x2cfb01,null))['catch'](handleError(_0x2cfb01,null));};exports[_0x6cdf('0x5b')]=function(_0x11ea4c,_0x1c744b,_0x44e927){var _0x604fec={'raw':!![],'where':{}},_0x223c14={},_0x1d2aa0;return db[_0x6cdf('0x34')][_0x6cdf('0x5c')]({'where':{'id':_0x11ea4c[_0x6cdf('0x57')]['id']}})[_0x6cdf('0x2e')](handleEntityNotFound(_0x1c744b,null))[_0x6cdf('0x2e')](function(_0x293031){if(_0x293031){_0x1d2aa0=_0x293031['get']({'plain':!![]});_0x223c14[_0x6cdf('0x39')]=_['keys'](db[_0x6cdf('0x5d')][_0x6cdf('0x35')]);_0x223c14['query']=_['keys'](_0x11ea4c[_0x6cdf('0x3a')]);_0x223c14[_0x6cdf('0x3c')]=_[_0x6cdf('0x4e')](_0x223c14[_0x6cdf('0x39')],_0x223c14[_0x6cdf('0x3a')]);_0x604fec[_0x6cdf('0x3d')]=_[_0x6cdf('0x4e')](_0x223c14['model'],qs['fields'](_0x11ea4c['query'][_0x6cdf('0x3e')]));_0x604fec['attributes']=_0x604fec[_0x6cdf('0x3d')]['length']?_0x604fec['attributes']:_0x223c14[_0x6cdf('0x39')];if(!_0x11ea4c[_0x6cdf('0x3a')]['hasOwnProperty']('nolimit')){_0x604fec[_0x6cdf('0x23')]=qs['limit'](_0x11ea4c[_0x6cdf('0x3a')][_0x6cdf('0x23')]);_0x604fec[_0x6cdf('0x21')]=qs[_0x6cdf('0x21')](_0x11ea4c[_0x6cdf('0x3a')]['offset']);}_0x604fec[_0x6cdf('0x41')]=qs[_0x6cdf('0x42')](_0x11ea4c[_0x6cdf('0x3a')][_0x6cdf('0x42')]);_0x604fec[_0x6cdf('0x43')]=qs[_0x6cdf('0x3c')](_[_0x6cdf('0x44')](_0x11ea4c['query'],_0x223c14[_0x6cdf('0x3c')]));_0x604fec[_0x6cdf('0x43')][_0x6cdf('0x5e')]=_0x293031['id'];if(_0x11ea4c[_0x6cdf('0x3a')][_0x6cdf('0x47')]){_0x604fec[_0x6cdf('0x43')]=_[_0x6cdf('0x45')](_0x604fec[_0x6cdf('0x43')],{'$or':_[_0x6cdf('0x33')](_0x604fec[_0x6cdf('0x3d')],function(_0x3b8a0d){var _0x2b4624={};_0x2b4624[_0x3b8a0d]={'$like':'%'+_0x11ea4c[_0x6cdf('0x3a')]['filter']+'%'};return _0x2b4624;})});}_0x604fec=_[_0x6cdf('0x45')]({},_0x604fec,_0x11ea4c['options']);return db[_0x6cdf('0x5d')]['findAll'](_0x604fec);}})[_0x6cdf('0x2e')](function(_0x55880e){if(_0x55880e){return db['User'][_0x6cdf('0x5f')]({'where':{'id':_['map'](_0x55880e,_0x6cdf('0x60')),'role':'agent'},'attributes':['id',_0x6cdf('0x31'),'smsPause',_0x6cdf('0x61'),_0x6cdf('0x62')]});}})[_0x6cdf('0x2e')](function(_0x491e4f){if(_0x491e4f){return{'count':_0x491e4f[_0x6cdf('0x24')],'rows':_[_0x6cdf('0x33')](_0x491e4f[_0x6cdf('0x4b')],function(_0x401b5a){return{'membername':_0x401b5a[_0x6cdf('0x31')],'UserId':_0x401b5a['id'],'queue_name':_0x1d2aa0[_0x6cdf('0x31')],'SmsQueueId':_0x1d2aa0['id'],'interface':util['format']('%s/%s',_0x6cdf('0x63'),_0x401b5a['name']),'penalty':0x0,'paused':_0x401b5a[_0x6cdf('0x64')],'createdAt':_0x401b5a[_0x6cdf('0x62')],'updatedAt':_0x401b5a[_0x6cdf('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1c744b,_0x604fec))[_0x6cdf('0x4c')](handleError(_0x1c744b,null));};exports['getTeams']=function(_0x197d41,_0xcd2ec2,_0x116232){var _0x2b1145={};var _0x38c917={};var _0x594c06;var _0x44148e;return db['SmsQueue'][_0x6cdf('0x5c')]({'where':{'id':_0x197d41['params']['id']}})[_0x6cdf('0x2e')](handleEntityNotFound(_0xcd2ec2,null))[_0x6cdf('0x2e')](function(_0x51abac){if(_0x51abac){_0x594c06=_0x51abac;_0x38c917[_0x6cdf('0x39')]=_[_0x6cdf('0x3b')](db[_0x6cdf('0x65')][_0x6cdf('0x35')]);_0x38c917[_0x6cdf('0x3a')]=_[_0x6cdf('0x3b')](_0x197d41[_0x6cdf('0x3a')]);_0x38c917[_0x6cdf('0x3c')]=_[_0x6cdf('0x4e')](_0x38c917['model'],_0x38c917[_0x6cdf('0x3a')]);_0x2b1145[_0x6cdf('0x3d')]=_[_0x6cdf('0x4e')](_0x38c917[_0x6cdf('0x39')],qs[_0x6cdf('0x3e')](_0x197d41[_0x6cdf('0x3a')][_0x6cdf('0x3e')]));_0x2b1145[_0x6cdf('0x3d')]=_0x2b1145[_0x6cdf('0x3d')][_0x6cdf('0x4f')]?_0x2b1145[_0x6cdf('0x3d')]:_0x38c917[_0x6cdf('0x39')];_0x2b1145[_0x6cdf('0x41')]=qs['sort'](_0x197d41[_0x6cdf('0x3a')][_0x6cdf('0x42')]);_0x2b1145['where']=qs['filters'](_['pick'](_0x197d41[_0x6cdf('0x3a')],_0x38c917['filters']));if(_0x197d41[_0x6cdf('0x3a')]['filter']){_0x2b1145[_0x6cdf('0x43')]=_['merge'](_0x2b1145['where'],{'$or':_[_0x6cdf('0x33')](_0x2b1145['attributes'],function(_0x203afc){var _0xaf7845={};_0xaf7845[_0x203afc]={'$like':'%'+_0x197d41[_0x6cdf('0x3a')][_0x6cdf('0x47')]+'%'};return _0xaf7845;})});}_0x2b1145=_[_0x6cdf('0x45')]({},_0x2b1145,_0x197d41[_0x6cdf('0x48')]);return _0x594c06['getTeams'](_0x2b1145);}})[_0x6cdf('0x2e')](function(_0x3cae9d){if(_0x3cae9d){_0x44148e=_0x3cae9d[_0x6cdf('0x4f')];if(!_0x197d41[_0x6cdf('0x3a')][_0x6cdf('0x3f')](_0x6cdf('0x40'))){_0x2b1145[_0x6cdf('0x23')]=qs[_0x6cdf('0x23')](_0x197d41[_0x6cdf('0x3a')][_0x6cdf('0x23')]);_0x2b1145[_0x6cdf('0x21')]=qs['offset'](_0x197d41['query'][_0x6cdf('0x21')]);}return _0x594c06[_0x6cdf('0x66')](_0x2b1145);}})[_0x6cdf('0x2e')](function(_0x77c949){if(_0x77c949){return _0x77c949?{'count':_0x44148e,'rows':_0x77c949}:null;}})[_0x6cdf('0x2e')](respondWithResult(_0xcd2ec2,null))[_0x6cdf('0x4c')](handleError(_0xcd2ec2,null));};exports[_0x6cdf('0x67')]=function(_0x57d09c,_0x288178,_0x44a6ad){var _0x7d2551=_0x57d09c[_0x6cdf('0x58')][_0x6cdf('0x68')];return db[_0x6cdf('0x65')]['findAll']({'where':{'id':_0x7d2551},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6cdf('0x69'),'attributes':['id','name',_0x6cdf('0x6a'),_0x6cdf('0x6b'),'interface'],'raw':!![]}]})[_0x6cdf('0x2e')](function(_0x2704fa){if(_0x2704fa){var _0x24237=_[_0x6cdf('0x6c')](_0x2704fa,function(_0x3df03e){var _0x292c62=_0x3df03e['get']({'plain':!![]});return _0x292c62[_0x6cdf('0x69')];});return db['SmsQueue'][_0x6cdf('0x59')]({'where':{'id':_0x57d09c[_0x6cdf('0x57')]['id']}})[_0x6cdf('0x2e')](function(_0x9629f3){return db[_0x6cdf('0x6d')]['transaction'](function(_0xb29bd8){return _0x9629f3['addTeams'](_0x7d2551,{'transaction':_0xb29bd8})[_0x6cdf('0x2e')](function(){return BPromise['each'](_0x24237,function(_0x13c476){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x13c476['id'],'SmsQueueId':_0x57d09c[_0x6cdf('0x57')]['id']},'transaction':_0xb29bd8});});})[_0x6cdf('0x2e')](function(){_0x24237[_0x6cdf('0x6e')](function(_0x462bf0){socket[_0x6cdf('0x6f')](_0x6cdf('0x70'),{'UserId':_0x462bf0['id'],'SmsQueueId':_0x9629f3['id']});});});});});}})['then'](respondWithStatusCode(_0x288178,null))[_0x6cdf('0x4c')](handleError(_0x288178,null));};exports[_0x6cdf('0x71')]=function(_0x2694f2,_0x4f9d6d,_0x4465ea){return db['Team'][_0x6cdf('0x4a')]({'where':{'id':_0x2694f2['query'][_0x6cdf('0x68')]},'attributes':['id'],'include':[{'model':db[_0x6cdf('0x72')],'as':_0x6cdf('0x69'),'attributes':['id'],'raw':!![]}]})[_0x6cdf('0x2e')](handleEntityNotFound(_0x4f9d6d,null))[_0x6cdf('0x2e')](function(_0xb07c73){var _0x1c578b=_[_0x6cdf('0x33')](_0xb07c73,'id');var _0x3bdb5a=[];var _0x3bd201=[];var _0x2e9057=squel[_0x6cdf('0x73')]();_0x2e9057['field']('tq.TeamId')[_0x6cdf('0x74')](_0x6cdf('0x75'),'tq')[_0x6cdf('0x76')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x6cdf('0x77'),_0x2694f2[_0x6cdf('0x57')]['id']);for(var _0x3d355c=0x0;_0x3d355c<_0xb07c73['length'];_0x3d355c+=0x1){let _0x5617d4=_0xb07c73[_0x3d355c];for(var _0x473755=0x0;_0x473755<_0x5617d4[_0x6cdf('0x69')][_0x6cdf('0x4f')];_0x473755+=0x1){let _0x5c584e=_0x5617d4[_0x6cdf('0x69')][_0x473755];var _0x157140=_0x2e9057['clone']();_0x157140[_0x6cdf('0x43')](_0x6cdf('0x78'),_0x5c584e['id']);_0x3bd201[_0x6cdf('0x79')](db[_0x6cdf('0x6d')][_0x6cdf('0x3a')](_0x157140['toString'](),{'type':db[_0x6cdf('0x6d')][_0x6cdf('0x7a')][_0x6cdf('0x7b')]})['then'](function(_0x19fa68){if(_0x19fa68[_0x6cdf('0x4f')]===0x1){return _0x5c584e['id'];}else{var _0x40a574=_[_0x6cdf('0x7c')](_['map'](_0x19fa68,_0x6cdf('0x7d')),function(_0x5ce75e){return _['includes'](_0x1c578b,_0x5ce75e);});if(_0x40a574){return _0x5c584e['id'];}}}));}}return BPromise['all'](_0x3bd201)['then'](function(_0x333b04){_0x3bdb5a=_(_0x3bdb5a)[_0x6cdf('0x7e')](_0x333b04)[_0x6cdf('0x7f')]()[_0x6cdf('0x80')]();return db['SmsQueue'][_0x6cdf('0x59')]({'where':{'id':_0x2694f2[_0x6cdf('0x57')]['id']}})[_0x6cdf('0x2e')](function(_0x6bf463){return db[_0x6cdf('0x6d')][_0x6cdf('0x81')](function(_0xca950c){return _0x6bf463[_0x6cdf('0x71')](_0x2694f2[_0x6cdf('0x3a')][_0x6cdf('0x68')],{'transaction':_0xca950c})[_0x6cdf('0x2e')](function(){if(!_[_0x6cdf('0x82')](_0x3bdb5a)){return _0x6bf463[_0x6cdf('0x83')](_0x3bdb5a,{'transaction':_0xca950c});}})['then'](function(){_0x3bdb5a[_0x6cdf('0x6e')](function(_0x21a378){socket[_0x6cdf('0x6f')]('userSmsQueue:remove',{'UserId':_0x21a378,'SmsQueueId':_0x6bf463['id']});});});});});});})['then'](respondWithStatusCode(_0x4f9d6d,null))[_0x6cdf('0x4c')](handleError(_0x4f9d6d,null));};exports[_0x6cdf('0x84')]=function(_0x1f8af6,_0x2f76dd,_0x2147b8){return db[_0x6cdf('0x34')][_0x6cdf('0x59')]({'where':{'id':_0x1f8af6[_0x6cdf('0x57')]['id']}})[_0x6cdf('0x2e')](handleEntityNotFound(_0x2f76dd,null))[_0x6cdf('0x2e')](function(_0x35f2a4){if(_0x35f2a4){return _0x35f2a4[_0x6cdf('0x84')](_0x1f8af6[_0x6cdf('0x58')][_0x6cdf('0x68')],_['omit'](_0x1f8af6[_0x6cdf('0x58')],['ids','id'])||{})[_0x6cdf('0x85')](function(_0x270ec0){for(var _0x373ea7=0x0;_0x373ea7<_0x1f8af6[_0x6cdf('0x58')][_0x6cdf('0x68')]['length'];_0x373ea7+=0x1){socket[_0x6cdf('0x6f')](_0x6cdf('0x70'),{'UserId':Number(_0x1f8af6['body'][_0x6cdf('0x68')][_0x373ea7]),'SmsQueueId':Number(_0x1f8af6['params']['id'])});}return _0x270ec0;});}})[_0x6cdf('0x2e')](respondWithResult(_0x2f76dd,null))[_0x6cdf('0x4c')](handleError(_0x2f76dd,null));};exports[_0x6cdf('0x83')]=function(_0x30c5ed,_0x488714,_0x13515d){return db[_0x6cdf('0x34')][_0x6cdf('0x59')]({'where':{'id':_0x30c5ed[_0x6cdf('0x57')]['id']}})[_0x6cdf('0x2e')](handleEntityNotFound(_0x488714,null))[_0x6cdf('0x2e')](function(_0x3a3206){if(_0x3a3206){return _0x3a3206[_0x6cdf('0x83')](_0x30c5ed[_0x6cdf('0x3a')][_0x6cdf('0x68')])['then'](function(){if(_[_0x6cdf('0x86')](_0x30c5ed['query'][_0x6cdf('0x68')])){for(var _0x14011a=0x0;_0x14011a<_0x30c5ed['query'][_0x6cdf('0x68')][_0x6cdf('0x4f')];_0x14011a+=0x1){socket[_0x6cdf('0x6f')](_0x6cdf('0x87'),{'UserId':Number(_0x30c5ed[_0x6cdf('0x3a')][_0x6cdf('0x68')][_0x14011a]),'SmsQueueId':Number(_0x30c5ed[_0x6cdf('0x57')]['id'])});}}else{socket[_0x6cdf('0x6f')](_0x6cdf('0x87'),{'UserId':Number(_0x30c5ed[_0x6cdf('0x3a')]['ids']),'SmsQueueId':Number(_0x30c5ed[_0x6cdf('0x57')]['id'])});}});}})[_0x6cdf('0x2e')](respondWithStatusCode(_0x488714,null))[_0x6cdf('0x4c')](handleError(_0x488714,null));};exports[_0x6cdf('0x88')]=function(_0x1452c8,_0x2a102f,_0x530e64){var _0x294fc1={};var _0xb08598={};var _0x31d078;var _0x24ee86;return db[_0x6cdf('0x34')]['findOne']({'where':{'id':_0x1452c8[_0x6cdf('0x57')]['id']}})[_0x6cdf('0x2e')](handleEntityNotFound(_0x2a102f,null))[_0x6cdf('0x2e')](function(_0x171ca1){if(_0x171ca1){_0x31d078=_0x171ca1;_0xb08598[_0x6cdf('0x39')]=_[_0x6cdf('0x3b')](db[_0x6cdf('0x72')][_0x6cdf('0x35')]);_0xb08598[_0x6cdf('0x3a')]=_[_0x6cdf('0x3b')](_0x1452c8[_0x6cdf('0x3a')]);_0xb08598['filters']=_['intersection'](_0xb08598[_0x6cdf('0x39')],_0xb08598[_0x6cdf('0x3a')]);_0x294fc1[_0x6cdf('0x3d')]=_[_0x6cdf('0x4e')](_0xb08598['model'],qs[_0x6cdf('0x3e')](_0x1452c8[_0x6cdf('0x3a')][_0x6cdf('0x3e')]));_0x294fc1['attributes']=_0x294fc1['attributes'][_0x6cdf('0x4f')]?_0x294fc1[_0x6cdf('0x3d')]:_0xb08598['model'];_0x294fc1['order']=qs[_0x6cdf('0x42')](_0x1452c8[_0x6cdf('0x3a')]['sort']);_0x294fc1[_0x6cdf('0x43')]=qs[_0x6cdf('0x3c')](_[_0x6cdf('0x44')](_0x1452c8[_0x6cdf('0x3a')],_0xb08598['filters']));if(_0x1452c8[_0x6cdf('0x3a')][_0x6cdf('0x47')]){_0x294fc1[_0x6cdf('0x43')]=_[_0x6cdf('0x45')](_0x294fc1[_0x6cdf('0x43')],{'$or':_['map'](_0x294fc1[_0x6cdf('0x3d')],function(_0x3edbd5){var _0x21912d={};_0x21912d[_0x3edbd5]={'$like':'%'+_0x1452c8[_0x6cdf('0x3a')][_0x6cdf('0x47')]+'%'};return _0x21912d;})});}_0x294fc1=_[_0x6cdf('0x45')]({},_0x294fc1,_0x1452c8[_0x6cdf('0x48')]);return _0x31d078[_0x6cdf('0x88')](_0x294fc1);}})['then'](function(_0x134564){if(_0x134564){_0x24ee86=_0x134564[_0x6cdf('0x4f')];if(!_0x1452c8[_0x6cdf('0x3a')][_0x6cdf('0x3f')]('nolimit')){_0x294fc1[_0x6cdf('0x23')]=qs['limit'](_0x1452c8[_0x6cdf('0x3a')][_0x6cdf('0x23')]);_0x294fc1[_0x6cdf('0x21')]=qs[_0x6cdf('0x21')](_0x1452c8[_0x6cdf('0x3a')][_0x6cdf('0x21')]);}return _0x31d078['getAgents'](_0x294fc1);}})['then'](function(_0x551505){if(_0x551505){return _0x551505?{'count':_0x24ee86,'rows':_0x551505}:null;}})[_0x6cdf('0x2e')](respondWithResult(_0x2a102f,null))[_0x6cdf('0x4c')](handleError(_0x2a102f,null));};
\ No newline at end of file
index b0c0135..9fb6a8d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaad1=['remove','emit','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','update'];(function(_0x2c508c,_0x2a365b){var _0x5af45a=function(_0x2ac397){while(--_0x2ac397){_0x2c508c['push'](_0x2c508c['shift']());}};_0x5af45a(++_0x2a365b);}(_0xaad1,0x79));var _0x1aad=function(_0x3256ca,_0x91efb0){_0x3256ca=_0x3256ca-0x0;var _0x1c0f7e=_0xaad1[_0x3256ca];return _0x1c0f7e;};'use strict';var EventEmitter=require(_0x1aad('0x0'));var SmsQueue=require(_0x1aad('0x1'))['db'][_0x1aad('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1aad('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1aad('0x4'),'afterDestroy':_0x1aad('0x5')};function emitEvent(_0x4eb205){return function(_0x14396b,_0x37541c,_0x4fd67d){SmsQueueEvents[_0x1aad('0x6')](_0x4eb205+':'+_0x14396b['id'],_0x14396b);SmsQueueEvents[_0x1aad('0x6')](_0x4eb205,_0x14396b);_0x4fd67d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x1aad('0x7')](e,emitEvent(event));}}module[_0x1aad('0x8')]=SmsQueueEvents;
\ No newline at end of file
+var _0xbe67=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xbe67,0x15f));var _0x7be6=function(_0x23d681,_0xf96d9){_0x23d681=_0x23d681-0x0;var _0x3448b7=_0xbe67[_0x23d681];return _0x3448b7;};'use strict';var EventEmitter=require(_0x7be6('0x0'));var SmsQueue=require(_0x7be6('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x7be6('0x2')](0x0);var events={'afterCreate':_0x7be6('0x3'),'afterUpdate':'update','afterDestroy':_0x7be6('0x4')};function emitEvent(_0x4cd1ff){return function(_0x4b3368,_0x43010d,_0x11a2c3){SmsQueueEvents[_0x7be6('0x5')](_0x4cd1ff+':'+_0x4b3368['id'],_0x4b3368);SmsQueueEvents[_0x7be6('0x5')](_0x4cd1ff,_0x4b3368);_0x11a2c3(null);};}for(var e in events){if(events[_0x7be6('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x7be6('0x7')]=SmsQueueEvents;
\ No newline at end of file
index efd0019..c2d7933 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1e55=['moment','bluebird','path','rimraf','../../config/environment','exports','define','SmsQueue','lodash','util','../../config/logger'];(function(_0xdf586c,_0x2caf84){var _0x285fb7=function(_0x2fb335){while(--_0x2fb335){_0xdf586c['push'](_0xdf586c['shift']());}};_0x285fb7(++_0x2caf84);}(_0x1e55,0x105));var _0x51e5=function(_0x11aa41,_0x217b80){_0x11aa41=_0x11aa41-0x0;var _0x479594=_0x1e55[_0x11aa41];return _0x479594;};'use strict';var _=require(_0x51e5('0x0'));var util=require(_0x51e5('0x1'));var logger=require(_0x51e5('0x2'))('api');var moment=require(_0x51e5('0x3'));var BPromise=require(_0x51e5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x51e5('0x5'));var rimraf=require(_0x51e5('0x6'));var config=require(_0x51e5('0x7'));var attributes=require('./smsQueue.attributes');module[_0x51e5('0x8')]=function(_0x231542,_0x1d8b00){return _0x231542[_0x51e5('0x9')](_0x51e5('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xb402=['SmsQueue','api','request-promise','path','./smsQueue.attributes','exports','define'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0xb402,0x6a));var _0x2b40=function(_0x5c768b,_0x5e88a6){_0x5c768b=_0x5c768b-0x0;var _0x335af8=_0xb402[_0x5c768b];return _0x335af8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2b40('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2b40('0x1'));var fs=require('fs');var path=require(_0x2b40('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2b40('0x3'));module[_0x2b40('0x4')]=function(_0x499cd2,_0x3e1ad6){return _0x499cd2[_0x2b40('0x5')](_0x2b40('0x6'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 00a6b6c..13e182c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xba62=['http','defaults','redis','socket.io-emitter','./smsQueue.socket','request','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','options','raw','where','limit','include','model','attributes','map','then','GetSmsQueue','SmsQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xba62,0x1f1));var _0x2ba6=function(_0x3ab46c,_0x4d26cc){_0x3ab46c=_0x3ab46c-0x0;var _0x2c7e90=_0xba62[_0x3ab46c];return _0x2c7e90;};'use strict';var _=require(_0x2ba6('0x0'));var util=require('util');var moment=require(_0x2ba6('0x1'));var BPromise=require(_0x2ba6('0x2'));var rs=require(_0x2ba6('0x3'));var fs=require('fs');var Redis=require(_0x2ba6('0x4'));var db=require(_0x2ba6('0x5'))['db'];var utils=require(_0x2ba6('0x6'));var logger=require('../../config/logger')(_0x2ba6('0x7'));var config=require(_0x2ba6('0x8'));var jayson=require(_0x2ba6('0x9'));var client=jayson['client'][_0x2ba6('0xa')]({'port':0x232a});config['redis']=_[_0x2ba6('0xb')](config[_0x2ba6('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ba6('0xd'))(new Redis(config[_0x2ba6('0xc')]));require(_0x2ba6('0xe'))['register'](socket);function respondWithRpcPromise(_0x3b3c91,_0x2cddde,_0x15afa3){return new BPromise(function(_0x15079e,_0x31d166){return client[_0x2ba6('0xf')](_0x3b3c91,_0x15afa3)['then'](function(_0x2f7a30){logger[_0x2ba6('0x10')]('SmsQueue,\x20%s,\x20%s',_0x2cddde,'request\x20sent');logger[_0x2ba6('0x11')](_0x2ba6('0x12'),_0x2cddde,_0x2ba6('0x13'),JSON[_0x2ba6('0x14')](_0x2f7a30));if(_0x2f7a30['error']){if(_0x2f7a30[_0x2ba6('0x15')][_0x2ba6('0x16')]===0x1f4){logger[_0x2ba6('0x15')](_0x2ba6('0x17'),_0x2cddde,_0x2f7a30[_0x2ba6('0x15')][_0x2ba6('0x18')]);return _0x31d166(_0x2f7a30['error'][_0x2ba6('0x18')]);}logger[_0x2ba6('0x15')]('SmsQueue,\x20%s,\x20%s',_0x2cddde,_0x2f7a30[_0x2ba6('0x15')][_0x2ba6('0x18')]);return _0x15079e(_0x2f7a30[_0x2ba6('0x15')][_0x2ba6('0x18')]);}else{logger[_0x2ba6('0x10')](_0x2ba6('0x17'),_0x2cddde,'request\x20sent');_0x15079e(_0x2f7a30[_0x2ba6('0x19')][_0x2ba6('0x18')]);}})[_0x2ba6('0x1a')](function(_0x219a41){logger[_0x2ba6('0x15')]('SmsQueue,\x20%s,\x20%s',_0x2cddde,_0x219a41);_0x31d166(_0x219a41);});});}exports['GetSmsQueue']=function(_0x75f450){var _0xf005a7=this;return new Promise(function(_0x42ea83,_0x73bc6a){return db['SmsQueue']['findAll']({'raw':_0x75f450[_0x2ba6('0x1b')]?_0x75f450[_0x2ba6('0x1b')][_0x2ba6('0x1c')]===undefined?!![]:![]:!![],'where':_0x75f450[_0x2ba6('0x1b')]?_0x75f450['options'][_0x2ba6('0x1d')]||null:null,'attributes':_0x75f450['options']?_0x75f450[_0x2ba6('0x1b')]['attributes']||null:null,'limit':_0x75f450[_0x2ba6('0x1b')]?_0x75f450['options'][_0x2ba6('0x1e')]||null:null,'include':_0x75f450[_0x2ba6('0x1b')]?_0x75f450[_0x2ba6('0x1b')][_0x2ba6('0x1f')]?_['map'](_0x75f450['options'][_0x2ba6('0x1f')],function(_0xcaf087){return{'model':db[_0xcaf087[_0x2ba6('0x20')]],'as':_0xcaf087['as'],'attributes':_0xcaf087[_0x2ba6('0x21')],'include':_0xcaf087[_0x2ba6('0x1f')]?_['map'](_0xcaf087[_0x2ba6('0x1f')],function(_0x1805d9){return{'model':db[_0x1805d9[_0x2ba6('0x20')]],'as':_0x1805d9['as'],'attributes':_0x1805d9[_0x2ba6('0x21')],'include':_0x1805d9[_0x2ba6('0x1f')]?_[_0x2ba6('0x22')](_0x1805d9[_0x2ba6('0x1f')],function(_0x392ce6){return{'model':db[_0x392ce6['model']],'as':_0x392ce6['as'],'attributes':_0x392ce6[_0x2ba6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2ba6('0x23')](function(_0x50a7d0){logger[_0x2ba6('0x10')](_0x2ba6('0x24'),_0x75f450);logger['debug']('GetSmsQueue',_0x75f450,JSON['stringify'](_0x50a7d0));_0x42ea83(_0x50a7d0);})['catch'](function(_0xd4ac56){logger['error'](_0x2ba6('0x24'),_0xd4ac56[_0x2ba6('0x18')],_0x75f450);_0x73bc6a(_0xf005a7[_0x2ba6('0x15')](0x1f4,_0xd4ac56[_0x2ba6('0x18')]));});});};exports['ShowSmsQueue']=function(_0x1241ad){var _0x382f2e=this;return new Promise(function(_0x40c6dc,_0x2c4cc5){return db[_0x2ba6('0x25')][_0x2ba6('0x26')]({'raw':_0x1241ad[_0x2ba6('0x1b')]?_0x1241ad[_0x2ba6('0x1b')][_0x2ba6('0x1c')]===undefined?!![]:![]:!![],'where':_0x1241ad[_0x2ba6('0x1b')]?_0x1241ad[_0x2ba6('0x1b')]['where']||null:null,'attributes':_0x1241ad['options']?_0x1241ad[_0x2ba6('0x1b')][_0x2ba6('0x21')]||null:null,'include':_0x1241ad[_0x2ba6('0x1b')]?_0x1241ad[_0x2ba6('0x1b')][_0x2ba6('0x1f')]?_['map'](_0x1241ad['options']['include'],function(_0x48e38c){return{'model':db[_0x48e38c[_0x2ba6('0x20')]],'as':_0x48e38c['as'],'attributes':_0x48e38c[_0x2ba6('0x21')],'include':_0x48e38c[_0x2ba6('0x1f')]?_[_0x2ba6('0x22')](_0x48e38c[_0x2ba6('0x1f')],function(_0x31b158){return{'model':db[_0x31b158[_0x2ba6('0x20')]],'as':_0x31b158['as'],'attributes':_0x31b158[_0x2ba6('0x21')],'include':_0x31b158['include']?_[_0x2ba6('0x22')](_0x31b158[_0x2ba6('0x1f')],function(_0x324c53){return{'model':db[_0x324c53['model']],'as':_0x324c53['as'],'attributes':_0x324c53[_0x2ba6('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15b269){logger['info']('ShowSmsQueue',_0x1241ad);logger[_0x2ba6('0x11')]('ShowSmsQueue',_0x1241ad,JSON[_0x2ba6('0x14')](_0x15b269));_0x40c6dc(_0x15b269);})['catch'](function(_0xa4c479){logger[_0x2ba6('0x15')]('ShowSmsQueue',_0xa4c479[_0x2ba6('0x18')],_0x1241ad);_0x2c4cc5(_0x382f2e[_0x2ba6('0x15')](0x1f4,_0xa4c479['message']));});});};
\ No newline at end of file
+var _0xdbac=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','SmsQueue','findAll','options','where','limit','include','map','model','attributes','GetSmsQueue','debug','stringify','ShowSmsQueue','find'];(function(_0x3278e,_0x4226f0){var _0x32fc55=function(_0x2284af){while(--_0x2284af){_0x3278e['push'](_0x3278e['shift']());}};_0x32fc55(++_0x4226f0);}(_0xdbac,0x19a));var _0xcdba=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xdbac[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xcdba('0x0'));var util=require(_0xcdba('0x1'));var moment=require(_0xcdba('0x2'));var BPromise=require(_0xcdba('0x3'));var rs=require(_0xcdba('0x4'));var fs=require('fs');var Redis=require(_0xcdba('0x5'));var db=require(_0xcdba('0x6'))['db'];var utils=require(_0xcdba('0x7'));var logger=require('../../config/logger')(_0xcdba('0x8'));var config=require(_0xcdba('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcdba('0xa')][_0xcdba('0xb')]({'port':0x232a});config[_0xcdba('0xc')]=_[_0xcdba('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcdba('0xe'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xcdba('0xf')](socket);function respondWithRpcPromise(_0x28e165,_0x2c63e3,_0x248aac){return new BPromise(function(_0xda7ec8,_0x102e4e){return client[_0xcdba('0x10')](_0x28e165,_0x248aac)[_0xcdba('0x11')](function(_0x50386e){logger[_0xcdba('0x12')](_0xcdba('0x13'),_0x2c63e3,_0xcdba('0x14'));logger['debug'](_0xcdba('0x15'),_0x2c63e3,_0xcdba('0x14'),JSON['stringify'](_0x50386e));if(_0x50386e['error']){if(_0x50386e['error'][_0xcdba('0x16')]===0x1f4){logger[_0xcdba('0x17')](_0xcdba('0x13'),_0x2c63e3,_0x50386e[_0xcdba('0x17')]['message']);return _0x102e4e(_0x50386e['error'][_0xcdba('0x18')]);}logger[_0xcdba('0x17')](_0xcdba('0x13'),_0x2c63e3,_0x50386e[_0xcdba('0x17')][_0xcdba('0x18')]);return _0xda7ec8(_0x50386e['error'][_0xcdba('0x18')]);}else{logger[_0xcdba('0x12')](_0xcdba('0x13'),_0x2c63e3,_0xcdba('0x14'));_0xda7ec8(_0x50386e[_0xcdba('0x19')][_0xcdba('0x18')]);}})[_0xcdba('0x1a')](function(_0x311918){logger[_0xcdba('0x17')](_0xcdba('0x13'),_0x2c63e3,_0x311918);_0x102e4e(_0x311918);});});}exports['GetSmsQueue']=function(_0x4265d9){var _0x33e5ed=this;return new Promise(function(_0x451263,_0x2126cc){return db[_0xcdba('0x1b')][_0xcdba('0x1c')]({'raw':_0x4265d9[_0xcdba('0x1d')]?_0x4265d9['options']['raw']===undefined?!![]:![]:!![],'where':_0x4265d9[_0xcdba('0x1d')]?_0x4265d9[_0xcdba('0x1d')][_0xcdba('0x1e')]||null:null,'attributes':_0x4265d9[_0xcdba('0x1d')]?_0x4265d9[_0xcdba('0x1d')]['attributes']||null:null,'limit':_0x4265d9['options']?_0x4265d9[_0xcdba('0x1d')][_0xcdba('0x1f')]||null:null,'include':_0x4265d9[_0xcdba('0x1d')]?_0x4265d9[_0xcdba('0x1d')][_0xcdba('0x20')]?_[_0xcdba('0x21')](_0x4265d9['options']['include'],function(_0x3f6729){return{'model':db[_0x3f6729[_0xcdba('0x22')]],'as':_0x3f6729['as'],'attributes':_0x3f6729[_0xcdba('0x23')],'include':_0x3f6729[_0xcdba('0x20')]?_[_0xcdba('0x21')](_0x3f6729[_0xcdba('0x20')],function(_0x202ff1){return{'model':db[_0x202ff1[_0xcdba('0x22')]],'as':_0x202ff1['as'],'attributes':_0x202ff1[_0xcdba('0x23')],'include':_0x202ff1[_0xcdba('0x20')]?_[_0xcdba('0x21')](_0x202ff1[_0xcdba('0x20')],function(_0x82e585){return{'model':db[_0x82e585[_0xcdba('0x22')]],'as':_0x82e585['as'],'attributes':_0x82e585[_0xcdba('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x499c0f){logger['info'](_0xcdba('0x24'),_0x4265d9);logger[_0xcdba('0x25')]('GetSmsQueue',_0x4265d9,JSON[_0xcdba('0x26')](_0x499c0f));_0x451263(_0x499c0f);})['catch'](function(_0x4bcc15){logger[_0xcdba('0x17')]('GetSmsQueue',_0x4bcc15[_0xcdba('0x18')],_0x4265d9);_0x2126cc(_0x33e5ed['error'](0x1f4,_0x4bcc15[_0xcdba('0x18')]));});});};exports[_0xcdba('0x27')]=function(_0x4f22b7){var _0x431bfe=this;return new Promise(function(_0x29979f,_0x41633a){return db[_0xcdba('0x1b')][_0xcdba('0x28')]({'raw':_0x4f22b7[_0xcdba('0x1d')]?_0x4f22b7[_0xcdba('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4f22b7[_0xcdba('0x1d')]?_0x4f22b7[_0xcdba('0x1d')][_0xcdba('0x1e')]||null:null,'attributes':_0x4f22b7['options']?_0x4f22b7[_0xcdba('0x1d')][_0xcdba('0x23')]||null:null,'include':_0x4f22b7[_0xcdba('0x1d')]?_0x4f22b7[_0xcdba('0x1d')][_0xcdba('0x20')]?_[_0xcdba('0x21')](_0x4f22b7[_0xcdba('0x1d')][_0xcdba('0x20')],function(_0x11f479){return{'model':db[_0x11f479['model']],'as':_0x11f479['as'],'attributes':_0x11f479[_0xcdba('0x23')],'include':_0x11f479[_0xcdba('0x20')]?_[_0xcdba('0x21')](_0x11f479[_0xcdba('0x20')],function(_0x18da61){return{'model':db[_0x18da61[_0xcdba('0x22')]],'as':_0x18da61['as'],'attributes':_0x18da61[_0xcdba('0x23')],'include':_0x18da61[_0xcdba('0x20')]?_[_0xcdba('0x21')](_0x18da61[_0xcdba('0x20')],function(_0x5f3245){return{'model':db[_0x5f3245[_0xcdba('0x22')]],'as':_0x5f3245['as'],'attributes':_0x5f3245[_0xcdba('0x23')]};}):[]};}):[]};}):[]:[]})[_0xcdba('0x11')](function(_0x594835){logger['info'](_0xcdba('0x27'),_0x4f22b7);logger[_0xcdba('0x25')]('ShowSmsQueue',_0x4f22b7,JSON[_0xcdba('0x26')](_0x594835));_0x29979f(_0x594835);})['catch'](function(_0x352f20){logger['error'](_0xcdba('0x27'),_0x352f20[_0xcdba('0x18')],_0x4f22b7);_0x41633a(_0x431bfe[_0xcdba('0x17')](0x1f4,_0x352f20[_0xcdba('0x18')]));});});};
\ No newline at end of file
index c0d8368..6f7db8a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc430=['remove','update','emit','removeListener','register','length','./smsQueue.events','save'];(function(_0x643a5f,_0x4aa1cd){var _0x39ffd3=function(_0x50956a){while(--_0x50956a){_0x643a5f['push'](_0x643a5f['shift']());}};_0x39ffd3(++_0x4aa1cd);}(_0xc430,0x156));var _0x0c43=function(_0x1e35e8,_0x59a52a){_0x1e35e8=_0x1e35e8-0x0;var _0x1c0e3f=_0xc430[_0x1e35e8];return _0x1c0e3f;};'use strict';var SmsQueueEvents=require(_0x0c43('0x0'));var events=[_0x0c43('0x1'),_0x0c43('0x2'),_0x0c43('0x3')];function createListener(_0x8c856d,_0x54a721){return function(_0x3d11e8){_0x54a721[_0x0c43('0x4')](_0x8c856d,_0x3d11e8);};}function removeListener(_0x2d93ea,_0x2d420c){return function(){SmsQueueEvents[_0x0c43('0x5')](_0x2d93ea,_0x2d420c);};}exports[_0x0c43('0x6')]=function(_0x3a4a25){for(var _0x462c24=0x0,_0x25dcc8=events[_0x0c43('0x7')];_0x462c24<_0x25dcc8;_0x462c24++){var _0x40ffe8=events[_0x462c24];var _0x352e88=createListener('smsQueue:'+_0x40ffe8,_0x3a4a25);SmsQueueEvents['on'](_0x40ffe8,_0x352e88);}};
\ No newline at end of file
+var _0xa4f5=['remove','update','register','smsQueue:','./smsQueue.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4f5,0x1cc));var _0x5a4f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa4f5[_0x59ee6f];return _0x4c0979;};'use strict';var SmsQueueEvents=require(_0x5a4f('0x0'));var events=[_0x5a4f('0x1'),_0x5a4f('0x2'),_0x5a4f('0x3')];function createListener(_0x17a19e,_0x3d417c){return function(_0x5468de){_0x3d417c['emit'](_0x17a19e,_0x5468de);};}function removeListener(_0x3b22d2,_0x3ef655){return function(){SmsQueueEvents['removeListener'](_0x3b22d2,_0x3ef655);};}exports[_0x5a4f('0x4')]=function(_0x86f4dc){for(var _0x40a613=0x0,_0x319a03=events['length'];_0x40a613<_0x319a03;_0x40a613++){var _0x1f27e3=events[_0x40a613];var _0x4bb6d5=createListener(_0x5a4f('0x5')+_0x1f27e3,_0x86f4dc);SmsQueueEvents['on'](_0x1f27e3,_0x4bb6d5);}};
\ No newline at end of file
index 9da10a5..6a2852a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8d98=['/:id','show','post','isAuthenticated','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','describe'];(function(_0x5d4ad8,_0xf67419){var _0x39e53e=function(_0x87c538){while(--_0x87c538){_0x5d4ad8['push'](_0x5d4ad8['shift']());}};_0x39e53e(++_0xf67419);}(_0x8d98,0x1a7));var _0x88d9=function(_0x1bc6af,_0x4fbcc4){_0x1bc6af=_0x1bc6af-0x0;var _0x35e765=_0x8d98[_0x1bc6af];return _0x35e765;};'use strict';var multer=require(_0x88d9('0x0'));var util=require(_0x88d9('0x1'));var path=require(_0x88d9('0x2'));var timeout=require(_0x88d9('0x3'));var express=require('express');var router=express[_0x88d9('0x4')]();var fs_extra=require(_0x88d9('0x5'));var auth=require(_0x88d9('0x6'));var interaction=require(_0x88d9('0x7'));var config=require(_0x88d9('0x8'));var controller=require(_0x88d9('0x9'));router[_0x88d9('0xa')]('/',auth['isAuthenticated'](),controller[_0x88d9('0xb')]);router[_0x88d9('0xa')](_0x88d9('0xc'),auth['isAuthenticated'](),controller[_0x88d9('0xd')]);router[_0x88d9('0xa')](_0x88d9('0xe'),auth['isAuthenticated'](),controller[_0x88d9('0xf')]);router[_0x88d9('0x10')]('/',auth[_0x88d9('0x11')](),controller[_0x88d9('0x12')]);router[_0x88d9('0x13')](_0x88d9('0xe'),auth[_0x88d9('0x11')](),controller[_0x88d9('0x14')]);router['delete'](_0x88d9('0xe'),auth[_0x88d9('0x11')](),controller[_0x88d9('0x15')]);module[_0x88d9('0x16')]=router;
\ No newline at end of file
+var _0x315c=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x19b1eb,_0x3f743d){var _0x42180f=function(_0x1f71ac){while(--_0x1f71ac){_0x19b1eb['push'](_0x19b1eb['shift']());}};_0x42180f(++_0x3f743d);}(_0x315c,0xe1));var _0xc315=function(_0x22e2c2,_0x11b415){_0x22e2c2=_0x22e2c2-0x0;var _0x274c93=_0x315c[_0x22e2c2];return _0x274c93;};'use strict';var multer=require(_0xc315('0x0'));var util=require(_0xc315('0x1'));var path=require('path');var timeout=require(_0xc315('0x2'));var express=require('express');var router=express[_0xc315('0x3')]();var fs_extra=require(_0xc315('0x4'));var auth=require(_0xc315('0x5'));var interaction=require(_0xc315('0x6'));var config=require(_0xc315('0x7'));var controller=require(_0xc315('0x8'));router[_0xc315('0x9')]('/',auth[_0xc315('0xa')](),controller[_0xc315('0xb')]);router[_0xc315('0x9')](_0xc315('0xc'),auth[_0xc315('0xa')](),controller[_0xc315('0xd')]);router[_0xc315('0x9')](_0xc315('0xe'),auth['isAuthenticated'](),controller[_0xc315('0xf')]);router[_0xc315('0x10')]('/',auth[_0xc315('0xa')](),controller['create']);router[_0xc315('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc315('0x12')]);router[_0xc315('0x13')]('/:id',auth[_0xc315('0xa')](),controller['destroy']);module[_0xc315('0x14')]=router;
\ No newline at end of file
index 8d7d7ce..a3188dd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3da2=['STRING','DATE','moment','sequelize','exports'];(function(_0x18705c,_0x4bb8ad){var _0x19ad8d=function(_0x52d7b2){while(--_0x52d7b2){_0x18705c['push'](_0x18705c['shift']());}};_0x19ad8d(++_0x4bb8ad);}(_0x3da2,0x1b5));var _0x23da=function(_0x4af8f6,_0x597deb){_0x4af8f6=_0x4af8f6-0x0;var _0x5b4e37=_0x3da2[_0x4af8f6];return _0x5b4e37;};'use strict';var moment=require(_0x23da('0x0'));var Sequelize=require(_0x23da('0x1'));module[_0x23da('0x2')]={'uniqueid':{'type':Sequelize[_0x23da('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x23da('0x3')]},'joinAt':{'type':Sequelize[_0x23da('0x4')]},'leaveAt':{'type':Sequelize[_0x23da('0x4')]},'acceptAt':{'type':Sequelize[_0x23da('0x4')]},'exitAt':{'type':Sequelize[_0x23da('0x4')]},'reason':{'type':Sequelize[_0x23da('0x3')]}};
\ No newline at end of file
+var _0x3792=['exports','STRING','DATE'];(function(_0x554685,_0x4f672d){var _0x363fc9=function(_0x5a9239){while(--_0x5a9239){_0x554685['push'](_0x554685['shift']());}};_0x363fc9(++_0x4f672d);}(_0x3792,0x9f));var _0x2379=function(_0x11f71a,_0x54d610){_0x11f71a=_0x11f71a-0x0;var _0x271621=_0x3792[_0x11f71a];return _0x271621;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x2379('0x0')]={'uniqueid':{'type':Sequelize[_0x2379('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x2379('0x1')]},'joinAt':{'type':Sequelize[_0x2379('0x2')]},'leaveAt':{'type':Sequelize[_0x2379('0x2')]},'acceptAt':{'type':Sequelize[_0x2379('0x2')]},'exitAt':{'type':Sequelize[_0x2379('0x2')]},'reason':{'type':Sequelize[_0x2379('0x1')]}};
\ No newline at end of file
index 59f874e..7d64c6c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4ffe=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','SmsQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x4ffe,0xa9));var _0xe4ff=function(_0x48b00c,_0x16690b){_0x48b00c=_0x48b00c-0x0;var _0x55d181=_0x4ffe[_0x48b00c];return _0x55d181;};'use strict';var emlformat=require(_0xe4ff('0x0'));var rimraf=require(_0xe4ff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe4ff('0x2'));var rp=require(_0xe4ff('0x3'));var moment=require(_0xe4ff('0x4'));var BPromise=require(_0xe4ff('0x5'));var Mustache=require(_0xe4ff('0x6'));var util=require(_0xe4ff('0x7'));var path=require('path');var sox=require(_0xe4ff('0x8'));var csv=require(_0xe4ff('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4ff('0xa'));var squel=require('squel');var crypto=require(_0xe4ff('0xb'));var jsforce=require(_0xe4ff('0xc'));var deskjs=require(_0xe4ff('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe4ff('0xe'));var Redis=require('ioredis');var authService=require(_0xe4ff('0xf'));var qs=require(_0xe4ff('0x10'));var as=require(_0xe4ff('0x11'));var hardwareService=require(_0xe4ff('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe4ff('0x13'));var config=require(_0xe4ff('0x14'));var licenseUtil=require(_0xe4ff('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1186e2,_0xcfc07f){_0xcfc07f=_0xcfc07f||0xcc;return function(_0x413492){if(_0x413492){return _0x1186e2[_0xe4ff('0x16')](_0xcfc07f);}return _0x1186e2[_0xe4ff('0x17')](_0xcfc07f)['end']();};}function respondWithResult(_0x1648fa,_0xb568a7){_0xb568a7=_0xb568a7||0xc8;return function(_0x444c41){if(_0x444c41){return _0x1648fa[_0xe4ff('0x17')](_0xb568a7)[_0xe4ff('0x18')](_0x444c41);}};}function respondWithFilteredResult(_0x2d945f,_0x44d29a){return function(_0x3fb5a1){if(_0x3fb5a1){var _0x38ab8b=typeof _0x44d29a[_0xe4ff('0x19')]===_0xe4ff('0x1a')&&typeof _0x44d29a[_0xe4ff('0x1b')]===_0xe4ff('0x1a');var _0xef508e=_0x3fb5a1[_0xe4ff('0x1c')];var _0x297a87=_0x38ab8b?0x0:_0x44d29a['offset'];var _0x132b55=_0x38ab8b?_0x3fb5a1[_0xe4ff('0x1c')]:_0x44d29a['offset']+_0x44d29a[_0xe4ff('0x1b')];var _0x1ba736;if(_0x132b55>=_0xef508e){_0x132b55=_0xef508e;_0x1ba736=0xc8;}else{_0x1ba736=0xce;}_0x2d945f[_0xe4ff('0x17')](_0x1ba736);return _0x2d945f[_0xe4ff('0x1d')](_0xe4ff('0x1e'),_0x297a87+'-'+_0x132b55+'/'+_0xef508e)[_0xe4ff('0x18')](_0x3fb5a1);}return null;};}function patchUpdates(_0x46a274){return function(_0x279182){try{jsonpatch[_0xe4ff('0x1f')](_0x279182,_0x46a274,!![]);}catch(_0x11d944){return BPromise[_0xe4ff('0x20')](_0x11d944);}return _0x279182[_0xe4ff('0x21')]();};}function saveUpdates(_0x2d2693,_0x56f0b0){return function(_0x2bb2cf){if(_0x2bb2cf){return _0x2bb2cf[_0xe4ff('0x22')](_0x2d2693)[_0xe4ff('0x23')](function(_0x5128c7){return _0x5128c7;});}return null;};}function removeEntity(_0x9c0280,_0x1a9769){return function(_0x3d43c3){if(_0x3d43c3){return _0x3d43c3[_0xe4ff('0x24')]()[_0xe4ff('0x23')](function(){_0x9c0280[_0xe4ff('0x17')](0xcc)[_0xe4ff('0x25')]();});}};}function handleEntityNotFound(_0x150c8b,_0x2bd648){return function(_0x5eff61){if(!_0x5eff61){_0x150c8b[_0xe4ff('0x16')](0x194);}return _0x5eff61;};}function handleError(_0x3885f5,_0x1b9c7e){_0x1b9c7e=_0x1b9c7e||0x1f4;return function(_0x441e8d){logger[_0xe4ff('0x26')](_0x441e8d[_0xe4ff('0x27')]);if(_0x441e8d[_0xe4ff('0x28')]){delete _0x441e8d['name'];}_0x3885f5[_0xe4ff('0x17')](_0x1b9c7e)[_0xe4ff('0x29')](_0x441e8d);};}exports['index']=function(_0x31f877,_0x383070){var _0x251816={},_0x5d2175={},_0x413fc7={'count':0x0,'rows':[]};var _0x11c43d=_[_0xe4ff('0x2a')](db[_0xe4ff('0x2b')][_0xe4ff('0x2c')],function(_0x47a106){return{'name':_0x47a106[_0xe4ff('0x2d')],'type':_0x47a106[_0xe4ff('0x2e')][_0xe4ff('0x2f')]};});_0x5d2175['model']=_['map'](_0x11c43d,_0xe4ff('0x28'));_0x5d2175['query']=_[_0xe4ff('0x30')](_0x31f877[_0xe4ff('0x31')]);_0x5d2175[_0xe4ff('0x32')]=_[_0xe4ff('0x33')](_0x5d2175['model'],_0x5d2175[_0xe4ff('0x31')]);_0x251816[_0xe4ff('0x34')]=_[_0xe4ff('0x33')](_0x5d2175[_0xe4ff('0x35')],qs['fields'](_0x31f877[_0xe4ff('0x31')][_0xe4ff('0x36')]));_0x251816[_0xe4ff('0x34')]=_0x251816[_0xe4ff('0x34')]['length']?_0x251816['attributes']:_0x5d2175[_0xe4ff('0x35')];if(!_0x31f877['query'][_0xe4ff('0x37')](_0xe4ff('0x38'))){_0x251816[_0xe4ff('0x1b')]=qs['limit'](_0x31f877[_0xe4ff('0x31')]['limit']);_0x251816[_0xe4ff('0x19')]=qs[_0xe4ff('0x19')](_0x31f877['query']['offset']);}_0x251816['order']=qs[_0xe4ff('0x39')](_0x31f877['query'][_0xe4ff('0x39')]);_0x251816[_0xe4ff('0x3a')]=qs['filters'](_[_0xe4ff('0x3b')](_0x31f877[_0xe4ff('0x31')],_0x5d2175[_0xe4ff('0x32')]),_0x11c43d);if(_0x31f877[_0xe4ff('0x31')][_0xe4ff('0x3c')]){_0x251816[_0xe4ff('0x3a')]=_[_0xe4ff('0x3d')](_0x251816[_0xe4ff('0x3a')],{'$or':_['map'](_0x11c43d,function(_0x2029e2){if(_0x2029e2['type']!==_0xe4ff('0x3e')){var _0x3b55b8={};_0x3b55b8[_0x2029e2[_0xe4ff('0x28')]]={'$like':'%'+_0x31f877[_0xe4ff('0x31')][_0xe4ff('0x3c')]+'%'};return _0x3b55b8;}})});}_0x251816=_[_0xe4ff('0x3d')]({},_0x251816,_0x31f877[_0xe4ff('0x3f')]);var _0x2d39ee={'where':_0x251816[_0xe4ff('0x3a')]};return db[_0xe4ff('0x2b')]['count'](_0x2d39ee)[_0xe4ff('0x23')](function(_0x4ec4de){_0x413fc7[_0xe4ff('0x1c')]=_0x4ec4de;if(_0x31f877[_0xe4ff('0x31')][_0xe4ff('0x40')]){_0x251816[_0xe4ff('0x41')]=[{'all':!![]}];}return db[_0xe4ff('0x2b')][_0xe4ff('0x42')](_0x251816);})[_0xe4ff('0x23')](function(_0x45840f){_0x413fc7[_0xe4ff('0x43')]=_0x45840f;return _0x413fc7;})[_0xe4ff('0x23')](respondWithFilteredResult(_0x383070,_0x251816))[_0xe4ff('0x44')](handleError(_0x383070,null));};exports[_0xe4ff('0x45')]=function(_0x4101c7,_0x802fd7){var _0x11686d={'raw':!![],'where':{'id':_0x4101c7['params']['id']}},_0x2672d5={};_0x2672d5[_0xe4ff('0x35')]=_[_0xe4ff('0x30')](db['SmsQueueReport'][_0xe4ff('0x2c')]);_0x2672d5[_0xe4ff('0x31')]=_[_0xe4ff('0x30')](_0x4101c7[_0xe4ff('0x31')]);_0x2672d5[_0xe4ff('0x32')]=_[_0xe4ff('0x33')](_0x2672d5['model'],_0x2672d5[_0xe4ff('0x31')]);_0x11686d[_0xe4ff('0x34')]=_[_0xe4ff('0x33')](_0x2672d5[_0xe4ff('0x35')],qs['fields'](_0x4101c7[_0xe4ff('0x31')][_0xe4ff('0x36')]));_0x11686d[_0xe4ff('0x34')]=_0x11686d['attributes'][_0xe4ff('0x46')]?_0x11686d['attributes']:_0x2672d5['model'];if(_0x4101c7['query'][_0xe4ff('0x40')]){_0x11686d[_0xe4ff('0x41')]=[{'all':!![]}];}_0x11686d=_[_0xe4ff('0x3d')]({},_0x11686d,_0x4101c7[_0xe4ff('0x3f')]);return db[_0xe4ff('0x2b')][_0xe4ff('0x47')](_0x11686d)['then'](handleEntityNotFound(_0x802fd7,null))[_0xe4ff('0x23')](respondWithResult(_0x802fd7,null))[_0xe4ff('0x44')](handleError(_0x802fd7,null));};exports['create']=function(_0x109206,_0x2073d8){return db[_0xe4ff('0x2b')][_0xe4ff('0x48')](_0x109206['body'],{})[_0xe4ff('0x23')](respondWithResult(_0x2073d8,0xc9))[_0xe4ff('0x44')](handleError(_0x2073d8,null));};exports[_0xe4ff('0x22')]=function(_0x50c02b,_0x298d8b){if(_0x50c02b['body']['id']){delete _0x50c02b['body']['id'];}return db[_0xe4ff('0x2b')][_0xe4ff('0x47')]({'where':{'id':_0x50c02b['params']['id']}})[_0xe4ff('0x23')](handleEntityNotFound(_0x298d8b,null))[_0xe4ff('0x23')](saveUpdates(_0x50c02b[_0xe4ff('0x49')],null))[_0xe4ff('0x23')](respondWithResult(_0x298d8b,null))[_0xe4ff('0x44')](handleError(_0x298d8b,null));};exports['destroy']=function(_0x3c978f,_0x361905){return db[_0xe4ff('0x2b')][_0xe4ff('0x47')]({'where':{'id':_0x3c978f[_0xe4ff('0x4a')]['id']}})[_0xe4ff('0x23')](handleEntityNotFound(_0x361905,null))['then'](removeEntity(_0x361905,null))[_0xe4ff('0x44')](handleError(_0x361905,null));};exports[_0xe4ff('0x4b')]=function(_0x58414e,_0x173ae9){return db['SmsQueueReport'][_0xe4ff('0x4b')]()[_0xe4ff('0x23')](respondWithResult(_0x173ae9,null))[_0xe4ff('0x44')](handleError(_0x173ae9,null));};
\ No newline at end of file
+var _0x930e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','key','query','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','options','SmsQueueReport','includeAll','include','rows','show','keys','fields','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x2610ca,_0x257512){var _0x410385=function(_0x5996ed){while(--_0x5996ed){_0x2610ca['push'](_0x2610ca['shift']());}};_0x410385(++_0x257512);}(_0x930e,0x178));var _0xe930=function(_0x598094,_0x5ced13){_0x598094=_0x598094-0x0;var _0x195519=_0x930e[_0x598094];return _0x195519;};'use strict';var emlformat=require(_0xe930('0x0'));var rimraf=require(_0xe930('0x1'));var zipdir=require(_0xe930('0x2'));var jsonpatch=require(_0xe930('0x3'));var rp=require(_0xe930('0x4'));var moment=require(_0xe930('0x5'));var BPromise=require(_0xe930('0x6'));var Mustache=require('mustache');var util=require(_0xe930('0x7'));var path=require(_0xe930('0x8'));var sox=require(_0xe930('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe930('0xa'));var _=require(_0xe930('0xb'));var squel=require(_0xe930('0xc'));var crypto=require('crypto');var jsforce=require(_0xe930('0xd'));var deskjs=require(_0xe930('0xe'));var toCsv=require(_0xe930('0xf'));var querystring=require(_0xe930('0x10'));var Papa=require(_0xe930('0x11'));var Redis=require(_0xe930('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe930('0x13'));var as=require(_0xe930('0x14'));var hardwareService=require(_0xe930('0x15'));var logger=require(_0xe930('0x16'))(_0xe930('0x17'));var utils=require('../../config/utils');var config=require(_0xe930('0x18'));var licenseUtil=require(_0xe930('0x19'));var db=require(_0xe930('0x1a'))['db'];function respondWithStatusCode(_0x567d2b,_0x21f7ad){_0x21f7ad=_0x21f7ad||0xcc;return function(_0x4d26a1){if(_0x4d26a1){return _0x567d2b[_0xe930('0x1b')](_0x21f7ad);}return _0x567d2b['status'](_0x21f7ad)[_0xe930('0x1c')]();};}function respondWithResult(_0x3f498b,_0x5d622a){_0x5d622a=_0x5d622a||0xc8;return function(_0x4e693b){if(_0x4e693b){return _0x3f498b[_0xe930('0x1d')](_0x5d622a)[_0xe930('0x1e')](_0x4e693b);}};}function respondWithFilteredResult(_0x4c144a,_0x4fdd72){return function(_0x1d6a98){if(_0x1d6a98){var _0x4f8379=typeof _0x4fdd72[_0xe930('0x1f')]===_0xe930('0x20')&&typeof _0x4fdd72[_0xe930('0x21')]===_0xe930('0x20');var _0x1c7eb1=_0x1d6a98[_0xe930('0x22')];var _0x19fa82=_0x4f8379?0x0:_0x4fdd72[_0xe930('0x1f')];var _0x1141cd=_0x4f8379?_0x1d6a98['count']:_0x4fdd72['offset']+_0x4fdd72['limit'];var _0x159929;if(_0x1141cd>=_0x1c7eb1){_0x1141cd=_0x1c7eb1;_0x159929=0xc8;}else{_0x159929=0xce;}_0x4c144a[_0xe930('0x1d')](_0x159929);return _0x4c144a[_0xe930('0x23')](_0xe930('0x24'),_0x19fa82+'-'+_0x1141cd+'/'+_0x1c7eb1)['json'](_0x1d6a98);}return null;};}function patchUpdates(_0x35cc17){return function(_0x12e714){try{jsonpatch[_0xe930('0x25')](_0x12e714,_0x35cc17,!![]);}catch(_0x48dc0f){return BPromise[_0xe930('0x26')](_0x48dc0f);}return _0x12e714['save']();};}function saveUpdates(_0x3511fa,_0x5091ef){return function(_0x16b232){if(_0x16b232){return _0x16b232[_0xe930('0x27')](_0x3511fa)['then'](function(_0x5b9fa8){return _0x5b9fa8;});}return null;};}function removeEntity(_0x3cebbe,_0x17a943){return function(_0x11fa61){if(_0x11fa61){return _0x11fa61[_0xe930('0x28')]()[_0xe930('0x29')](function(){_0x3cebbe['status'](0xcc)[_0xe930('0x1c')]();});}};}function handleEntityNotFound(_0x38c2e0,_0x8794dc){return function(_0x297795){if(!_0x297795){_0x38c2e0[_0xe930('0x1b')](0x194);}return _0x297795;};}function handleError(_0x368d74,_0x409ac1){_0x409ac1=_0x409ac1||0x1f4;return function(_0x41a7c9){logger[_0xe930('0x2a')](_0x41a7c9['stack']);if(_0x41a7c9[_0xe930('0x2b')]){delete _0x41a7c9['name'];}_0x368d74[_0xe930('0x1d')](_0x409ac1)[_0xe930('0x2c')](_0x41a7c9);};}exports[_0xe930('0x2d')]=function(_0x491540,_0x2f7dd7){var _0x1ccec3={},_0x1c5d47={},_0x5ceb3b={'count':0x0,'rows':[]};var _0x28afb4=_[_0xe930('0x2e')](db['SmsQueueReport'][_0xe930('0x2f')],function(_0x3bbd0a){return{'name':_0x3bbd0a[_0xe930('0x30')],'type':_0x3bbd0a['type'][_0xe930('0x31')]};});_0x1c5d47['model']=_['map'](_0x28afb4,_0xe930('0x2b'));_0x1c5d47[_0xe930('0x32')]=_['keys'](_0x491540[_0xe930('0x32')]);_0x1c5d47['filters']=_[_0xe930('0x33')](_0x1c5d47['model'],_0x1c5d47[_0xe930('0x32')]);_0x1ccec3[_0xe930('0x34')]=_['intersection'](_0x1c5d47[_0xe930('0x35')],qs['fields'](_0x491540[_0xe930('0x32')]['fields']));_0x1ccec3[_0xe930('0x34')]=_0x1ccec3[_0xe930('0x34')][_0xe930('0x36')]?_0x1ccec3[_0xe930('0x34')]:_0x1c5d47[_0xe930('0x35')];if(!_0x491540[_0xe930('0x32')][_0xe930('0x37')](_0xe930('0x38'))){_0x1ccec3['limit']=qs[_0xe930('0x21')](_0x491540[_0xe930('0x32')]['limit']);_0x1ccec3[_0xe930('0x1f')]=qs['offset'](_0x491540['query']['offset']);}_0x1ccec3[_0xe930('0x39')]=qs[_0xe930('0x3a')](_0x491540['query'][_0xe930('0x3a')]);_0x1ccec3['where']=qs['filters'](_[_0xe930('0x3b')](_0x491540[_0xe930('0x32')],_0x1c5d47[_0xe930('0x3c')]),_0x28afb4);if(_0x491540['query'][_0xe930('0x3d')]){_0x1ccec3[_0xe930('0x3e')]=_[_0xe930('0x3f')](_0x1ccec3[_0xe930('0x3e')],{'$or':_['map'](_0x28afb4,function(_0x238aeb){if(_0x238aeb[_0xe930('0x40')]!=='VIRTUAL'){var _0x3c1c9d={};_0x3c1c9d[_0x238aeb[_0xe930('0x2b')]]={'$like':'%'+_0x491540['query']['filter']+'%'};return _0x3c1c9d;}})});}_0x1ccec3=_[_0xe930('0x3f')]({},_0x1ccec3,_0x491540[_0xe930('0x41')]);var _0x466b9a={'where':_0x1ccec3[_0xe930('0x3e')]};return db[_0xe930('0x42')][_0xe930('0x22')](_0x466b9a)['then'](function(_0x59a3ad){_0x5ceb3b[_0xe930('0x22')]=_0x59a3ad;if(_0x491540['query'][_0xe930('0x43')]){_0x1ccec3[_0xe930('0x44')]=[{'all':!![]}];}return db[_0xe930('0x42')]['findAll'](_0x1ccec3);})[_0xe930('0x29')](function(_0x48bff0){_0x5ceb3b[_0xe930('0x45')]=_0x48bff0;return _0x5ceb3b;})[_0xe930('0x29')](respondWithFilteredResult(_0x2f7dd7,_0x1ccec3))['catch'](handleError(_0x2f7dd7,null));};exports[_0xe930('0x46')]=function(_0x57094d,_0x585350){var _0x35e758={'raw':!![],'where':{'id':_0x57094d['params']['id']}},_0x312457={};_0x312457[_0xe930('0x35')]=_['keys'](db[_0xe930('0x42')]['rawAttributes']);_0x312457['query']=_[_0xe930('0x47')](_0x57094d[_0xe930('0x32')]);_0x312457['filters']=_[_0xe930('0x33')](_0x312457[_0xe930('0x35')],_0x312457[_0xe930('0x32')]);_0x35e758['attributes']=_[_0xe930('0x33')](_0x312457['model'],qs[_0xe930('0x48')](_0x57094d[_0xe930('0x32')][_0xe930('0x48')]));_0x35e758[_0xe930('0x34')]=_0x35e758[_0xe930('0x34')]['length']?_0x35e758[_0xe930('0x34')]:_0x312457['model'];if(_0x57094d[_0xe930('0x32')][_0xe930('0x43')]){_0x35e758[_0xe930('0x44')]=[{'all':!![]}];}_0x35e758=_[_0xe930('0x3f')]({},_0x35e758,_0x57094d['options']);return db[_0xe930('0x42')][_0xe930('0x49')](_0x35e758)[_0xe930('0x29')](handleEntityNotFound(_0x585350,null))[_0xe930('0x29')](respondWithResult(_0x585350,null))[_0xe930('0x4a')](handleError(_0x585350,null));};exports[_0xe930('0x4b')]=function(_0x27d11b,_0x46e72b){return db[_0xe930('0x42')][_0xe930('0x4b')](_0x27d11b[_0xe930('0x4c')],{})[_0xe930('0x29')](respondWithResult(_0x46e72b,0xc9))['catch'](handleError(_0x46e72b,null));};exports[_0xe930('0x27')]=function(_0x3cdcc8,_0x5c38aa){if(_0x3cdcc8[_0xe930('0x4c')]['id']){delete _0x3cdcc8[_0xe930('0x4c')]['id'];}return db['SmsQueueReport'][_0xe930('0x49')]({'where':{'id':_0x3cdcc8[_0xe930('0x4d')]['id']}})[_0xe930('0x29')](handleEntityNotFound(_0x5c38aa,null))['then'](saveUpdates(_0x3cdcc8['body'],null))[_0xe930('0x29')](respondWithResult(_0x5c38aa,null))[_0xe930('0x4a')](handleError(_0x5c38aa,null));};exports[_0xe930('0x28')]=function(_0x5addfb,_0x2342ad){return db[_0xe930('0x42')][_0xe930('0x49')]({'where':{'id':_0x5addfb[_0xe930('0x4d')]['id']}})[_0xe930('0x29')](handleEntityNotFound(_0x2342ad,null))['then'](removeEntity(_0x2342ad,null))[_0xe930('0x4a')](handleError(_0x2342ad,null));};exports[_0xe930('0x4e')]=function(_0x4f9489,_0x383641){return db[_0xe930('0x42')]['describe']()[_0xe930('0x29')](respondWithResult(_0x383641,null))[_0xe930('0x4a')](handleError(_0x383641,null));};
\ No newline at end of file
index 4ce58c1..3f0da19 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3ea925,_0x9509aa){var _0x2f3373=function(_0x2fba86){while(--_0x2fba86){_0x3ea925['push'](_0x3ea925['shift']());}};_0x2f3373(++_0x9509aa);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x57474e,_0x4178b8){var _0xfaae8c=function(_0x2e34d1){while(--_0x2e34d1){_0x57474e['push'](_0x57474e['shift']());}};_0xfaae8c(++_0x4178b8);}(_0xe706,0xa3));var _0x6e70=function(_0x128607,_0x242e5f){_0x128607=_0x128607-0x0;var _0x4ba37b=_0xe706[_0x128607];return _0x4ba37b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
index 7093fa0..09fceb3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9e04=['body','options','raw','debug','stringify','catch','UpdateSmsQueueReport','update','where','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','error','SmsQueueReport,\x20%s,\x20%s','message','CreateSmsQueueReport','SmsQueueReport','create'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9e04,0x17e));var _0x49e0=function(_0x4d5d01,_0x525238){_0x4d5d01=_0x4d5d01-0x0;var _0x35dd2c=_0x9e04[_0x4d5d01];return _0x35dd2c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49e0('0x0'));var BPromise=require(_0x49e0('0x1'));var rs=require(_0x49e0('0x2'));var fs=require('fs');var Redis=require(_0x49e0('0x3'));var db=require(_0x49e0('0x4'))['db'];var utils=require(_0x49e0('0x5'));var logger=require(_0x49e0('0x6'))(_0x49e0('0x7'));var config=require(_0x49e0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x49e0('0x9')][_0x49e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2843a3,_0x2038fe,_0x5cdd5f){return new BPromise(function(_0x540d9f,_0x4cc17d){return client[_0x49e0('0xb')](_0x2843a3,_0x5cdd5f)[_0x49e0('0xc')](function(_0x2a7a67){logger[_0x49e0('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x2038fe,_0x49e0('0xe'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x2038fe,'request\x20sent',JSON['stringify'](_0x2a7a67));if(_0x2a7a67[_0x49e0('0xf')]){if(_0x2a7a67[_0x49e0('0xf')]['code']===0x1f4){logger[_0x49e0('0xf')](_0x49e0('0x10'),_0x2038fe,_0x2a7a67[_0x49e0('0xf')][_0x49e0('0x11')]);return _0x4cc17d(_0x2a7a67[_0x49e0('0xf')]['message']);}logger[_0x49e0('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x2038fe,_0x2a7a67[_0x49e0('0xf')][_0x49e0('0x11')]);return _0x540d9f(_0x2a7a67[_0x49e0('0xf')][_0x49e0('0x11')]);}else{logger[_0x49e0('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x2038fe,_0x49e0('0xe'));_0x540d9f(_0x2a7a67['result']['message']);}})['catch'](function(_0x199ba7){logger[_0x49e0('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x2038fe,_0x199ba7);_0x4cc17d(_0x199ba7);});});}exports[_0x49e0('0x12')]=function(_0x366130){var _0x38466f=this;return new Promise(function(_0x938218,_0x1f3170){return db[_0x49e0('0x13')][_0x49e0('0x14')](_0x366130[_0x49e0('0x15')],{'raw':_0x366130['options']?_0x366130[_0x49e0('0x16')][_0x49e0('0x17')]===undefined?!![]:![]:!![]})[_0x49e0('0xc')](function(_0x443a77){logger[_0x49e0('0xd')](_0x49e0('0x12'),_0x366130);logger[_0x49e0('0x18')](_0x49e0('0x12'),_0x366130,JSON[_0x49e0('0x19')](_0x443a77));_0x938218(_0x443a77);})[_0x49e0('0x1a')](function(_0xc3874){logger[_0x49e0('0xf')](_0x49e0('0x12'),_0xc3874[_0x49e0('0x11')],_0x366130);_0x1f3170(_0x38466f['error'](0x1f4,_0xc3874[_0x49e0('0x11')]));});});};exports[_0x49e0('0x1b')]=function(_0x35ac4d){var _0x1ca3d8=this;return new Promise(function(_0x2c9903,_0x16ae92){return db['SmsQueueReport'][_0x49e0('0x1c')](_0x35ac4d[_0x49e0('0x15')],{'raw':_0x35ac4d[_0x49e0('0x16')]?_0x35ac4d[_0x49e0('0x16')][_0x49e0('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35ac4d[_0x49e0('0x16')]?_0x35ac4d[_0x49e0('0x16')][_0x49e0('0x1d')]||null:null,'attributes':_0x35ac4d[_0x49e0('0x16')]?_0x35ac4d['options']['attributes']||null:null,'limit':_0x35ac4d['options']?_0x35ac4d[_0x49e0('0x16')][_0x49e0('0x1e')]||null:null})[_0x49e0('0xc')](function(_0x51060e){logger['info']('UpdateSmsQueueReport',_0x35ac4d);logger[_0x49e0('0x18')](_0x49e0('0x1b'),_0x35ac4d,JSON[_0x49e0('0x19')](_0x51060e));_0x2c9903(_0x51060e);})[_0x49e0('0x1a')](function(_0x127a27){logger[_0x49e0('0xf')]('UpdateSmsQueueReport',_0x127a27[_0x49e0('0x11')],_0x35ac4d);_0x16ae92(_0x1ca3d8[_0x49e0('0xf')](0x1f4,_0x127a27[_0x49e0('0x11')]));});});};
\ No newline at end of file
+var _0xa4cf=['attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','options','raw','UpdateSmsQueueReport','update','body'];(function(_0x328534,_0x33b41e){var _0x2796c0=function(_0x1ba8ad){while(--_0x1ba8ad){_0x328534['push'](_0x328534['shift']());}};_0x2796c0(++_0x33b41e);}(_0xa4cf,0xc2));var _0xfa4c=function(_0x3cabf1,_0x5612b3){_0x3cabf1=_0x3cabf1-0x0;var _0xf4f75c=_0xa4cf[_0x3cabf1];return _0xf4f75c;};'use strict';var _=require(_0xfa4c('0x0'));var util=require('util');var moment=require(_0xfa4c('0x1'));var BPromise=require(_0xfa4c('0x2'));var rs=require(_0xfa4c('0x3'));var fs=require('fs');var Redis=require(_0xfa4c('0x4'));var db=require(_0xfa4c('0x5'))['db'];var utils=require(_0xfa4c('0x6'));var logger=require('../../config/logger')(_0xfa4c('0x7'));var config=require(_0xfa4c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfa4c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc29208,_0x5ea852,_0x3a827f){return new BPromise(function(_0x920a01,_0x496960){return client[_0xfa4c('0xa')](_0xc29208,_0x3a827f)[_0xfa4c('0xb')](function(_0x582b0a){logger[_0xfa4c('0xc')](_0xfa4c('0xd'),_0x5ea852,_0xfa4c('0xe'));logger[_0xfa4c('0xf')](_0xfa4c('0x10'),_0x5ea852,_0xfa4c('0xe'),JSON[_0xfa4c('0x11')](_0x582b0a));if(_0x582b0a[_0xfa4c('0x12')]){if(_0x582b0a[_0xfa4c('0x12')][_0xfa4c('0x13')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x5ea852,_0x582b0a[_0xfa4c('0x12')][_0xfa4c('0x14')]);return _0x496960(_0x582b0a[_0xfa4c('0x12')][_0xfa4c('0x14')]);}logger[_0xfa4c('0x12')](_0xfa4c('0xd'),_0x5ea852,_0x582b0a[_0xfa4c('0x12')][_0xfa4c('0x14')]);return _0x920a01(_0x582b0a['error'][_0xfa4c('0x14')]);}else{logger[_0xfa4c('0xc')](_0xfa4c('0xd'),_0x5ea852,_0xfa4c('0xe'));_0x920a01(_0x582b0a[_0xfa4c('0x15')][_0xfa4c('0x14')]);}})[_0xfa4c('0x16')](function(_0x328e3f){logger[_0xfa4c('0x12')](_0xfa4c('0xd'),_0x5ea852,_0x328e3f);_0x496960(_0x328e3f);});});}exports[_0xfa4c('0x17')]=function(_0xb14f26){var _0x50c2a1=this;return new Promise(function(_0x509255,_0x43e4da){return db[_0xfa4c('0x18')]['create'](_0xb14f26['body'],{'raw':_0xb14f26['options']?_0xb14f26[_0xfa4c('0x19')][_0xfa4c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5348a1){logger['info']('CreateSmsQueueReport',_0xb14f26);logger[_0xfa4c('0xf')](_0xfa4c('0x17'),_0xb14f26,JSON[_0xfa4c('0x11')](_0x5348a1));_0x509255(_0x5348a1);})['catch'](function(_0x5e003e){logger[_0xfa4c('0x12')](_0xfa4c('0x17'),_0x5e003e[_0xfa4c('0x14')],_0xb14f26);_0x43e4da(_0x50c2a1[_0xfa4c('0x12')](0x1f4,_0x5e003e['message']));});});};exports[_0xfa4c('0x1b')]=function(_0x48ab81){var _0x18f38b=this;return new Promise(function(_0x11b0af,_0x473ec5){return db[_0xfa4c('0x18')][_0xfa4c('0x1c')](_0x48ab81[_0xfa4c('0x1d')],{'raw':_0x48ab81['options']?_0x48ab81[_0xfa4c('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48ab81[_0xfa4c('0x19')]?_0x48ab81[_0xfa4c('0x19')]['where']||null:null,'attributes':_0x48ab81['options']?_0x48ab81['options'][_0xfa4c('0x1e')]||null:null,'limit':_0x48ab81[_0xfa4c('0x19')]?_0x48ab81[_0xfa4c('0x19')][_0xfa4c('0x1f')]||null:null})[_0xfa4c('0xb')](function(_0x3a1ac2){logger[_0xfa4c('0xc')](_0xfa4c('0x1b'),_0x48ab81);logger[_0xfa4c('0xf')]('UpdateSmsQueueReport',_0x48ab81,JSON[_0xfa4c('0x11')](_0x3a1ac2));_0x11b0af(_0x3a1ac2);})[_0xfa4c('0x16')](function(_0x788186){logger[_0xfa4c('0x12')](_0xfa4c('0x1b'),_0x788186[_0xfa4c('0x14')],_0x48ab81);_0x473ec5(_0x18f38b[_0xfa4c('0x12')](0x1f4,_0x788186[_0xfa4c('0x14')]));});});};
\ No newline at end of file
index 9aeac14..3ea744c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5ad3=['isAuthenticated','index','describe','create','/:id','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get'];(function(_0x1e0361,_0x339749){var _0x21caa0=function(_0x130d8f){while(--_0x130d8f){_0x1e0361['push'](_0x1e0361['shift']());}};_0x21caa0(++_0x339749);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0x5ad3[_0x725a4c];return _0x37b2cc;};'use strict';var multer=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var path=require(_0x35ad('0x2'));var timeout=require(_0x35ad('0x3'));var express=require('express');var router=express[_0x35ad('0x4')]();var fs_extra=require(_0x35ad('0x5'));var auth=require(_0x35ad('0x6'));var interaction=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var controller=require(_0x35ad('0x9'));router[_0x35ad('0xa')]('/',auth[_0x35ad('0xb')](),controller[_0x35ad('0xc')]);router[_0x35ad('0xa')]('/describe',auth[_0x35ad('0xb')](),controller[_0x35ad('0xd')]);router[_0x35ad('0xa')]('/:id',auth[_0x35ad('0xb')](),controller['show']);router['post']('/',auth[_0x35ad('0xb')](),controller[_0x35ad('0xe')]);router['put'](_0x35ad('0xf'),auth[_0x35ad('0xb')](),controller['update']);router['delete'](_0x35ad('0xf'),auth[_0x35ad('0xb')](),controller['destroy']);module[_0x35ad('0x10')]=router;
\ No newline at end of file
+var _0xbacd=['get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0xbacd,0x1c5));var _0xdbac=function(_0x57fda0,_0x38d98a){_0x57fda0=_0x57fda0-0x0;var _0x2b6939=_0xbacd[_0x57fda0];return _0x2b6939;};'use strict';var multer=require(_0xdbac('0x0'));var util=require(_0xdbac('0x1'));var path=require('path');var timeout=require(_0xdbac('0x2'));var express=require(_0xdbac('0x3'));var router=express[_0xdbac('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdbac('0x5'));var interaction=require(_0xdbac('0x6'));var config=require(_0xdbac('0x7'));var controller=require(_0xdbac('0x8'));router[_0xdbac('0x9')]('/',auth[_0xdbac('0xa')](),controller[_0xdbac('0xb')]);router[_0xdbac('0x9')](_0xdbac('0xc'),auth[_0xdbac('0xa')](),controller[_0xdbac('0xd')]);router[_0xdbac('0x9')](_0xdbac('0xe'),auth[_0xdbac('0xa')](),controller[_0xdbac('0xf')]);router['post']('/',auth[_0xdbac('0xa')](),controller[_0xdbac('0x10')]);router['put'](_0xdbac('0xe'),auth['isAuthenticated'](),controller[_0xdbac('0x11')]);router[_0xdbac('0x12')](_0xdbac('0xe'),auth[_0xdbac('0xa')](),controller[_0xdbac('0x13')]);module[_0xdbac('0x14')]=router;
\ No newline at end of file
index 4252b57..067bbfc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x4a2adc,_0x1f9495){var _0xd69381=function(_0x275198){while(--_0x275198){_0x4a2adc['push'](_0x4a2adc['shift']());}};_0xd69381(++_0x1f9495);}(_0xf4eb,0xec));var _0xbf4e=function(_0x25fc2f,_0x15c713){_0x25fc2f=_0x25fc2f-0x0;var _0x1e19a6=_0xf4eb[_0x25fc2f];return _0x1e19a6;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}};
\ No newline at end of file
+var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x3c7d25,_0x55ef7c){var _0x4d5b54=function(_0x552eac){while(--_0x552eac){_0x3c7d25['push'](_0x3c7d25['shift']());}};_0x4d5b54(++_0x55ef7c);}(_0x00bb,0x1d8));var _0xb00b=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x00bb[_0xc6be3a];return _0x56a310;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}};
\ No newline at end of file
index 3a0f3fe..17c75d1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc423=['nolimit','order','where','pick','filters','VIRTUAL','filter','merge','options','SmsTransferReport','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x4b4925,_0x36b1ab){var _0x3aa5e9=function(_0x247406){while(--_0x247406){_0x4b4925['push'](_0x4b4925['shift']());}};_0x3aa5e9(++_0x36b1ab);}(_0xc423,0xaa));var _0x3c42=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc423[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x3c42('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c42('0x1'));var jsonpatch=require(_0x3c42('0x2'));var rp=require('request-promise');var moment=require(_0x3c42('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3c42('0x4'));var util=require(_0x3c42('0x5'));var path=require(_0x3c42('0x6'));var sox=require('sox');var csv=require(_0x3c42('0x7'));var ejs=require(_0x3c42('0x8'));var fs=require('fs');var fs_extra=require(_0x3c42('0x9'));var _=require(_0x3c42('0xa'));var squel=require(_0x3c42('0xb'));var crypto=require(_0x3c42('0xc'));var jsforce=require(_0x3c42('0xd'));var deskjs=require(_0x3c42('0xe'));var toCsv=require(_0x3c42('0x7'));var querystring=require(_0x3c42('0xf'));var Papa=require(_0x3c42('0x10'));var Redis=require('ioredis');var authService=require(_0x3c42('0x11'));var qs=require(_0x3c42('0x12'));var as=require(_0x3c42('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c42('0x14'))(_0x3c42('0x15'));var utils=require(_0x3c42('0x16'));var config=require(_0x3c42('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x217e94,_0x28c440){_0x28c440=_0x28c440||0xcc;return function(_0x2d49b7){if(_0x2d49b7){return _0x217e94[_0x3c42('0x18')](_0x28c440);}return _0x217e94['status'](_0x28c440)[_0x3c42('0x19')]();};}function respondWithResult(_0xa04328,_0x41bf3d){_0x41bf3d=_0x41bf3d||0xc8;return function(_0x352fa4){if(_0x352fa4){return _0xa04328[_0x3c42('0x1a')](_0x41bf3d)[_0x3c42('0x1b')](_0x352fa4);}};}function respondWithFilteredResult(_0x463cb8,_0x1b5a70){return function(_0x1302c4){if(_0x1302c4){var _0x46cfa3=typeof _0x1b5a70[_0x3c42('0x1c')]===_0x3c42('0x1d')&&typeof _0x1b5a70[_0x3c42('0x1e')]===_0x3c42('0x1d');var _0xa99d5b=_0x1302c4[_0x3c42('0x1f')];var _0x1c3c62=_0x46cfa3?0x0:_0x1b5a70[_0x3c42('0x1c')];var _0x3b1d26=_0x46cfa3?_0x1302c4['count']:_0x1b5a70[_0x3c42('0x1c')]+_0x1b5a70['limit'];var _0x224764;if(_0x3b1d26>=_0xa99d5b){_0x3b1d26=_0xa99d5b;_0x224764=0xc8;}else{_0x224764=0xce;}_0x463cb8[_0x3c42('0x1a')](_0x224764);return _0x463cb8[_0x3c42('0x20')](_0x3c42('0x21'),_0x1c3c62+'-'+_0x3b1d26+'/'+_0xa99d5b)['json'](_0x1302c4);}return null;};}function patchUpdates(_0x3ec81b){return function(_0x1dc0fb){try{jsonpatch[_0x3c42('0x22')](_0x1dc0fb,_0x3ec81b,!![]);}catch(_0xc1fc9c){return BPromise[_0x3c42('0x23')](_0xc1fc9c);}return _0x1dc0fb[_0x3c42('0x24')]();};}function saveUpdates(_0xcfa291,_0x4ecfdc){return function(_0xeedb13){if(_0xeedb13){return _0xeedb13[_0x3c42('0x25')](_0xcfa291)[_0x3c42('0x26')](function(_0xc9324a){return _0xc9324a;});}return null;};}function removeEntity(_0x299838,_0x1c8a12){return function(_0x10b685){if(_0x10b685){return _0x10b685[_0x3c42('0x27')]()[_0x3c42('0x26')](function(){_0x299838['status'](0xcc)[_0x3c42('0x19')]();});}};}function handleEntityNotFound(_0x277553,_0x281e17){return function(_0x286f84){if(!_0x286f84){_0x277553[_0x3c42('0x18')](0x194);}return _0x286f84;};}function handleError(_0x19f818,_0x137b86){_0x137b86=_0x137b86||0x1f4;return function(_0x18f1f4){logger[_0x3c42('0x28')](_0x18f1f4['stack']);if(_0x18f1f4[_0x3c42('0x29')]){delete _0x18f1f4['name'];}_0x19f818['status'](_0x137b86)['send'](_0x18f1f4);};}exports[_0x3c42('0x2a')]=function(_0x4069af,_0x5bbd93){var _0x961b8d={},_0x807bfa={},_0x16ce1d={'count':0x0,'rows':[]};var _0xa4822a=_[_0x3c42('0x2b')](db['SmsTransferReport'][_0x3c42('0x2c')],function(_0x5d0cf7){return{'name':_0x5d0cf7[_0x3c42('0x2d')],'type':_0x5d0cf7[_0x3c42('0x2e')]['key']};});_0x807bfa[_0x3c42('0x2f')]=_[_0x3c42('0x2b')](_0xa4822a,_0x3c42('0x29'));_0x807bfa['query']=_[_0x3c42('0x30')](_0x4069af[_0x3c42('0x31')]);_0x807bfa['filters']=_['intersection'](_0x807bfa[_0x3c42('0x2f')],_0x807bfa['query']);_0x961b8d['attributes']=_[_0x3c42('0x32')](_0x807bfa[_0x3c42('0x2f')],qs[_0x3c42('0x33')](_0x4069af[_0x3c42('0x31')][_0x3c42('0x33')]));_0x961b8d['attributes']=_0x961b8d[_0x3c42('0x34')][_0x3c42('0x35')]?_0x961b8d[_0x3c42('0x34')]:_0x807bfa['model'];if(!_0x4069af[_0x3c42('0x31')][_0x3c42('0x36')](_0x3c42('0x37'))){_0x961b8d[_0x3c42('0x1e')]=qs[_0x3c42('0x1e')](_0x4069af[_0x3c42('0x31')][_0x3c42('0x1e')]);_0x961b8d[_0x3c42('0x1c')]=qs[_0x3c42('0x1c')](_0x4069af[_0x3c42('0x31')][_0x3c42('0x1c')]);}_0x961b8d[_0x3c42('0x38')]=qs['sort'](_0x4069af[_0x3c42('0x31')]['sort']);_0x961b8d[_0x3c42('0x39')]=qs['filters'](_[_0x3c42('0x3a')](_0x4069af['query'],_0x807bfa[_0x3c42('0x3b')]),_0xa4822a);if(_0x4069af[_0x3c42('0x31')]['filter']){_0x961b8d[_0x3c42('0x39')]=_['merge'](_0x961b8d[_0x3c42('0x39')],{'$or':_[_0x3c42('0x2b')](_0xa4822a,function(_0xd6d9c5){if(_0xd6d9c5['type']!==_0x3c42('0x3c')){var _0x30daa8={};_0x30daa8[_0xd6d9c5[_0x3c42('0x29')]]={'$like':'%'+_0x4069af[_0x3c42('0x31')][_0x3c42('0x3d')]+'%'};return _0x30daa8;}})});}_0x961b8d=_[_0x3c42('0x3e')]({},_0x961b8d,_0x4069af[_0x3c42('0x3f')]);var _0x394e95={'where':_0x961b8d['where']};return db[_0x3c42('0x40')][_0x3c42('0x1f')](_0x394e95)[_0x3c42('0x26')](function(_0x13971c){_0x16ce1d[_0x3c42('0x1f')]=_0x13971c;if(_0x4069af['query'][_0x3c42('0x41')]){_0x961b8d[_0x3c42('0x42')]=[{'all':!![]}];}return db[_0x3c42('0x40')][_0x3c42('0x43')](_0x961b8d);})[_0x3c42('0x26')](function(_0x5e54a0){_0x16ce1d['rows']=_0x5e54a0;return _0x16ce1d;})['then'](respondWithFilteredResult(_0x5bbd93,_0x961b8d))[_0x3c42('0x44')](handleError(_0x5bbd93,null));};exports[_0x3c42('0x45')]=function(_0x512933,_0x4f11dd){var _0x4c3a35={'raw':!![],'where':{'id':_0x512933[_0x3c42('0x46')]['id']}},_0x223846={};_0x223846['model']=_[_0x3c42('0x30')](db[_0x3c42('0x40')][_0x3c42('0x2c')]);_0x223846['query']=_[_0x3c42('0x30')](_0x512933[_0x3c42('0x31')]);_0x223846[_0x3c42('0x3b')]=_['intersection'](_0x223846['model'],_0x223846['query']);_0x4c3a35[_0x3c42('0x34')]=_[_0x3c42('0x32')](_0x223846['model'],qs[_0x3c42('0x33')](_0x512933[_0x3c42('0x31')]['fields']));_0x4c3a35[_0x3c42('0x34')]=_0x4c3a35[_0x3c42('0x34')][_0x3c42('0x35')]?_0x4c3a35[_0x3c42('0x34')]:_0x223846[_0x3c42('0x2f')];if(_0x512933[_0x3c42('0x31')][_0x3c42('0x41')]){_0x4c3a35[_0x3c42('0x42')]=[{'all':!![]}];}_0x4c3a35=_[_0x3c42('0x3e')]({},_0x4c3a35,_0x512933[_0x3c42('0x3f')]);return db['SmsTransferReport'][_0x3c42('0x47')](_0x4c3a35)[_0x3c42('0x26')](handleEntityNotFound(_0x4f11dd,null))[_0x3c42('0x26')](respondWithResult(_0x4f11dd,null))['catch'](handleError(_0x4f11dd,null));};exports[_0x3c42('0x48')]=function(_0x436251,_0x3a8de){return db[_0x3c42('0x40')]['create'](_0x436251[_0x3c42('0x49')],{})[_0x3c42('0x26')](respondWithResult(_0x3a8de,0xc9))[_0x3c42('0x44')](handleError(_0x3a8de,null));};exports[_0x3c42('0x25')]=function(_0x4fdbc8,_0x251d2f){if(_0x4fdbc8[_0x3c42('0x49')]['id']){delete _0x4fdbc8[_0x3c42('0x49')]['id'];}return db[_0x3c42('0x40')][_0x3c42('0x47')]({'where':{'id':_0x4fdbc8[_0x3c42('0x46')]['id']}})[_0x3c42('0x26')](handleEntityNotFound(_0x251d2f,null))['then'](saveUpdates(_0x4fdbc8[_0x3c42('0x49')],null))[_0x3c42('0x26')](respondWithResult(_0x251d2f,null))['catch'](handleError(_0x251d2f,null));};exports[_0x3c42('0x27')]=function(_0x21512d,_0xd3d5a6){return db[_0x3c42('0x40')][_0x3c42('0x47')]({'where':{'id':_0x21512d[_0x3c42('0x46')]['id']}})[_0x3c42('0x26')](handleEntityNotFound(_0xd3d5a6,null))['then'](removeEntity(_0xd3d5a6,null))[_0x3c42('0x44')](handleError(_0xd3d5a6,null));};exports[_0x3c42('0x4a')]=function(_0x54048e,_0x46aa0b){return db[_0x3c42('0x40')][_0x3c42('0x4a')]()[_0x3c42('0x26')](respondWithResult(_0x46aa0b,null))['catch'](handleError(_0x46aa0b,null));};
\ No newline at end of file
+var _0xb82a=['model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','type','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','destroy','then','end','error','name','send','index','map','SmsTransferReport','rawAttributes'];(function(_0x36ee10,_0x3e4e4b){var _0x1ae7e8=function(_0x138916){while(--_0x138916){_0x36ee10['push'](_0x36ee10['shift']());}};_0x1ae7e8(++_0x3e4e4b);}(_0xb82a,0x187));var _0xab82=function(_0x1621cd,_0x313475){_0x1621cd=_0x1621cd-0x0;var _0x5785c2=_0xb82a[_0x1621cd];return _0x5785c2;};'use strict';var emlformat=require(_0xab82('0x0'));var rimraf=require(_0xab82('0x1'));var zipdir=require(_0xab82('0x2'));var jsonpatch=require(_0xab82('0x3'));var rp=require(_0xab82('0x4'));var moment=require(_0xab82('0x5'));var BPromise=require(_0xab82('0x6'));var Mustache=require(_0xab82('0x7'));var util=require('util');var path=require(_0xab82('0x8'));var sox=require(_0xab82('0x9'));var csv=require('to-csv');var ejs=require(_0xab82('0xa'));var fs=require('fs');var fs_extra=require(_0xab82('0xb'));var _=require(_0xab82('0xc'));var squel=require(_0xab82('0xd'));var crypto=require('crypto');var jsforce=require(_0xab82('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xab82('0xf'));var querystring=require(_0xab82('0x10'));var Papa=require('papaparse');var Redis=require(_0xab82('0x11'));var authService=require(_0xab82('0x12'));var qs=require(_0xab82('0x13'));var as=require(_0xab82('0x14'));var hardwareService=require(_0xab82('0x15'));var logger=require(_0xab82('0x16'))('api');var utils=require(_0xab82('0x17'));var config=require(_0xab82('0x18'));var licenseUtil=require(_0xab82('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f720f,_0x2c5d1c){_0x2c5d1c=_0x2c5d1c||0xcc;return function(_0x59889d){if(_0x59889d){return _0x1f720f[_0xab82('0x1a')](_0x2c5d1c);}return _0x1f720f[_0xab82('0x1b')](_0x2c5d1c)['end']();};}function respondWithResult(_0x5b4fd0,_0x50e5bb){_0x50e5bb=_0x50e5bb||0xc8;return function(_0x22bb19){if(_0x22bb19){return _0x5b4fd0[_0xab82('0x1b')](_0x50e5bb)[_0xab82('0x1c')](_0x22bb19);}};}function respondWithFilteredResult(_0x5154ad,_0x567273){return function(_0x15d291){if(_0x15d291){var _0x504ebc=typeof _0x567273[_0xab82('0x1d')]==='undefined'&&typeof _0x567273[_0xab82('0x1e')]===_0xab82('0x1f');var _0x46177f=_0x15d291[_0xab82('0x20')];var _0x397796=_0x504ebc?0x0:_0x567273['offset'];var _0x14a886=_0x504ebc?_0x15d291[_0xab82('0x20')]:_0x567273[_0xab82('0x1d')]+_0x567273[_0xab82('0x1e')];var _0x1308a7;if(_0x14a886>=_0x46177f){_0x14a886=_0x46177f;_0x1308a7=0xc8;}else{_0x1308a7=0xce;}_0x5154ad[_0xab82('0x1b')](_0x1308a7);return _0x5154ad['set'](_0xab82('0x21'),_0x397796+'-'+_0x14a886+'/'+_0x46177f)[_0xab82('0x1c')](_0x15d291);}return null;};}function patchUpdates(_0x133b64){return function(_0x3d8df4){try{jsonpatch['apply'](_0x3d8df4,_0x133b64,!![]);}catch(_0x414156){return BPromise[_0xab82('0x22')](_0x414156);}return _0x3d8df4[_0xab82('0x23')]();};}function saveUpdates(_0x5b5fcc,_0x5649ef){return function(_0x129705){if(_0x129705){return _0x129705[_0xab82('0x24')](_0x5b5fcc)['then'](function(_0x98ed80){return _0x98ed80;});}return null;};}function removeEntity(_0x4d57b1,_0x48590a){return function(_0x4d50a9){if(_0x4d50a9){return _0x4d50a9[_0xab82('0x25')]()[_0xab82('0x26')](function(){_0x4d57b1[_0xab82('0x1b')](0xcc)[_0xab82('0x27')]();});}};}function handleEntityNotFound(_0x2f7909,_0x5635e4){return function(_0x272bc0){if(!_0x272bc0){_0x2f7909[_0xab82('0x1a')](0x194);}return _0x272bc0;};}function handleError(_0x24c602,_0xa32741){_0xa32741=_0xa32741||0x1f4;return function(_0x465431){logger[_0xab82('0x28')](_0x465431['stack']);if(_0x465431[_0xab82('0x29')]){delete _0x465431[_0xab82('0x29')];}_0x24c602[_0xab82('0x1b')](_0xa32741)[_0xab82('0x2a')](_0x465431);};}exports[_0xab82('0x2b')]=function(_0x56fba6,_0x11f47b){var _0x2ea881={},_0x38cabf={},_0x389f2a={'count':0x0,'rows':[]};var _0x162408=_[_0xab82('0x2c')](db[_0xab82('0x2d')][_0xab82('0x2e')],function(_0x5a7f27){return{'name':_0x5a7f27['fieldName'],'type':_0x5a7f27['type']['key']};});_0x38cabf[_0xab82('0x2f')]=_[_0xab82('0x2c')](_0x162408,_0xab82('0x29'));_0x38cabf[_0xab82('0x30')]=_[_0xab82('0x31')](_0x56fba6[_0xab82('0x30')]);_0x38cabf[_0xab82('0x32')]=_[_0xab82('0x33')](_0x38cabf[_0xab82('0x2f')],_0x38cabf[_0xab82('0x30')]);_0x2ea881['attributes']=_[_0xab82('0x33')](_0x38cabf['model'],qs[_0xab82('0x34')](_0x56fba6[_0xab82('0x30')][_0xab82('0x34')]));_0x2ea881[_0xab82('0x35')]=_0x2ea881[_0xab82('0x35')]['length']?_0x2ea881[_0xab82('0x35')]:_0x38cabf['model'];if(!_0x56fba6[_0xab82('0x30')][_0xab82('0x36')](_0xab82('0x37'))){_0x2ea881[_0xab82('0x1e')]=qs[_0xab82('0x1e')](_0x56fba6[_0xab82('0x30')][_0xab82('0x1e')]);_0x2ea881[_0xab82('0x1d')]=qs[_0xab82('0x1d')](_0x56fba6[_0xab82('0x30')]['offset']);}_0x2ea881['order']=qs[_0xab82('0x38')](_0x56fba6[_0xab82('0x30')][_0xab82('0x38')]);_0x2ea881[_0xab82('0x39')]=qs[_0xab82('0x32')](_['pick'](_0x56fba6[_0xab82('0x30')],_0x38cabf[_0xab82('0x32')]),_0x162408);if(_0x56fba6['query'][_0xab82('0x3a')]){_0x2ea881[_0xab82('0x39')]=_['merge'](_0x2ea881['where'],{'$or':_['map'](_0x162408,function(_0x419996){if(_0x419996[_0xab82('0x3b')]!=='VIRTUAL'){var _0x116913={};_0x116913[_0x419996[_0xab82('0x29')]]={'$like':'%'+_0x56fba6[_0xab82('0x30')][_0xab82('0x3a')]+'%'};return _0x116913;}})});}_0x2ea881=_['merge']({},_0x2ea881,_0x56fba6[_0xab82('0x3c')]);var _0x18be51={'where':_0x2ea881[_0xab82('0x39')]};return db['SmsTransferReport'][_0xab82('0x20')](_0x18be51)[_0xab82('0x26')](function(_0x5b0873){_0x389f2a[_0xab82('0x20')]=_0x5b0873;if(_0x56fba6['query'][_0xab82('0x3d')]){_0x2ea881[_0xab82('0x3e')]=[{'all':!![]}];}return db[_0xab82('0x2d')][_0xab82('0x3f')](_0x2ea881);})[_0xab82('0x26')](function(_0x528aeb){_0x389f2a[_0xab82('0x40')]=_0x528aeb;return _0x389f2a;})['then'](respondWithFilteredResult(_0x11f47b,_0x2ea881))[_0xab82('0x41')](handleError(_0x11f47b,null));};exports[_0xab82('0x42')]=function(_0x3c085e,_0x158c3a){var _0x287456={'raw':!![],'where':{'id':_0x3c085e[_0xab82('0x43')]['id']}},_0x399fe6={};_0x399fe6[_0xab82('0x2f')]=_[_0xab82('0x31')](db[_0xab82('0x2d')][_0xab82('0x2e')]);_0x399fe6['query']=_[_0xab82('0x31')](_0x3c085e[_0xab82('0x30')]);_0x399fe6[_0xab82('0x32')]=_['intersection'](_0x399fe6['model'],_0x399fe6[_0xab82('0x30')]);_0x287456[_0xab82('0x35')]=_['intersection'](_0x399fe6[_0xab82('0x2f')],qs[_0xab82('0x34')](_0x3c085e[_0xab82('0x30')][_0xab82('0x34')]));_0x287456['attributes']=_0x287456['attributes']['length']?_0x287456[_0xab82('0x35')]:_0x399fe6['model'];if(_0x3c085e[_0xab82('0x30')][_0xab82('0x3d')]){_0x287456[_0xab82('0x3e')]=[{'all':!![]}];}_0x287456=_[_0xab82('0x44')]({},_0x287456,_0x3c085e[_0xab82('0x3c')]);return db[_0xab82('0x2d')][_0xab82('0x45')](_0x287456)['then'](handleEntityNotFound(_0x158c3a,null))[_0xab82('0x26')](respondWithResult(_0x158c3a,null))['catch'](handleError(_0x158c3a,null));};exports[_0xab82('0x46')]=function(_0x1d5ab2,_0x494c0e){return db[_0xab82('0x2d')][_0xab82('0x46')](_0x1d5ab2[_0xab82('0x47')],{})[_0xab82('0x26')](respondWithResult(_0x494c0e,0xc9))['catch'](handleError(_0x494c0e,null));};exports[_0xab82('0x24')]=function(_0x1f22fe,_0x5cae03){if(_0x1f22fe[_0xab82('0x47')]['id']){delete _0x1f22fe[_0xab82('0x47')]['id'];}return db[_0xab82('0x2d')]['find']({'where':{'id':_0x1f22fe[_0xab82('0x43')]['id']}})['then'](handleEntityNotFound(_0x5cae03,null))[_0xab82('0x26')](saveUpdates(_0x1f22fe[_0xab82('0x47')],null))['then'](respondWithResult(_0x5cae03,null))[_0xab82('0x41')](handleError(_0x5cae03,null));};exports[_0xab82('0x25')]=function(_0x36863c,_0x143c44){return db[_0xab82('0x2d')][_0xab82('0x45')]({'where':{'id':_0x36863c[_0xab82('0x43')]['id']}})['then'](handleEntityNotFound(_0x143c44,null))[_0xab82('0x26')](removeEntity(_0x143c44,null))['catch'](handleError(_0x143c44,null));};exports[_0xab82('0x48')]=function(_0x57276d,_0x3d9e55){return db[_0xab82('0x2d')][_0xab82('0x48')]()[_0xab82('0x26')](respondWithResult(_0x3d9e55,null))[_0xab82('0x41')](handleError(_0x3d9e55,null));};
\ No newline at end of file
index de9f8b8..61db678 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5900=['../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x5a965f,_0x22d15f){var _0x188f8a=function(_0x12e616){while(--_0x12e616){_0x5a965f['push'](_0x5a965f['shift']());}};_0x188f8a(++_0x22d15f);}(_0x5900,0xd2));var _0x0590=function(_0x4bfc64,_0x25976d){_0x4bfc64=_0x4bfc64-0x0;var _0x5d8f2a=_0x5900[_0x4bfc64];return _0x5d8f2a;};'use strict';var _=require('lodash');var util=require(_0x0590('0x0'));var logger=require(_0x0590('0x1'))('api');var moment=require(_0x0590('0x2'));var BPromise=require(_0x0590('0x3'));var rp=require(_0x0590('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0590('0x5'));var config=require(_0x0590('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x0590('0x7')]=function(_0x1d9927,_0x494b17){return _0x1d9927[_0x0590('0x8')](_0x0590('0x9'),attributes,{'tableName':_0x0590('0xa'),'paranoid':![],'indexes':[{'name':_0x0590('0xb'),'fields':[_0x0590('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x2141=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x368587,_0x1b6554){var _0x42d33c=function(_0xfdccf){while(--_0xfdccf){_0x368587['push'](_0x368587['shift']());}};_0x42d33c(++_0x1b6554);}(_0x2141,0x1ba));var _0x1214=function(_0x184513,_0x3aa313){_0x184513=_0x184513-0x0;var _0x169d0b=_0x2141[_0x184513];return _0x169d0b;};'use strict';var _=require(_0x1214('0x0'));var util=require(_0x1214('0x1'));var logger=require(_0x1214('0x2'))(_0x1214('0x3'));var moment=require(_0x1214('0x4'));var BPromise=require(_0x1214('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1214('0x6'));var config=require(_0x1214('0x7'));var attributes=require(_0x1214('0x8'));module[_0x1214('0x9')]=function(_0xf2eb34,_0x2c8a69){return _0xf2eb34[_0x1214('0xa')](_0x1214('0xb'),attributes,{'tableName':_0x1214('0xc'),'paranoid':![],'indexes':[{'name':_0x1214('0xd'),'fields':[_0x1214('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
index d1a3d49..b3eeb19 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x27c9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xdacb21,_0x515919){var _0xf60b4a=function(_0x534006){while(--_0x534006){_0xdacb21['push'](_0xdacb21['shift']());}};_0xf60b4a(++_0x515919);}(_0x27c9,0x1af));var _0x927c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x27c9[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x927c('0x0'));var util=require(_0x927c('0x1'));var moment=require(_0x927c('0x2'));var BPromise=require(_0x927c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x927c('0x4'));var db=require(_0x927c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x927c('0x6'))(_0x927c('0x7'));var config=require(_0x927c('0x8'));var jayson=require(_0x927c('0x9'));var client=jayson[_0x927c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1622e3,_0x2a7c45,_0x44d8ab){return new BPromise(function(_0x5250ee,_0x40050f){return client[_0x927c('0xb')](_0x1622e3,_0x44d8ab)[_0x927c('0xc')](function(_0x59f13d){logger[_0x927c('0xd')](_0x927c('0xe'),_0x2a7c45,_0x927c('0xf'));logger[_0x927c('0x10')](_0x927c('0x11'),_0x2a7c45,_0x927c('0xf'),JSON[_0x927c('0x12')](_0x59f13d));if(_0x59f13d[_0x927c('0x13')]){if(_0x59f13d['error']['code']===0x1f4){logger[_0x927c('0x13')](_0x927c('0xe'),_0x2a7c45,_0x59f13d[_0x927c('0x13')][_0x927c('0x14')]);return _0x40050f(_0x59f13d['error'][_0x927c('0x14')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x2a7c45,_0x59f13d[_0x927c('0x13')][_0x927c('0x14')]);return _0x5250ee(_0x59f13d[_0x927c('0x13')][_0x927c('0x14')]);}else{logger[_0x927c('0xd')](_0x927c('0xe'),_0x2a7c45,_0x927c('0xf'));_0x5250ee(_0x59f13d[_0x927c('0x15')][_0x927c('0x14')]);}})[_0x927c('0x16')](function(_0x44633b){logger[_0x927c('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x2a7c45,_0x44633b);_0x40050f(_0x44633b);});});}
\ No newline at end of file
+var _0x972c=['../../config/environment','jayson/promise','http','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x5638dc,_0x1bbb77){var _0x549320=function(_0x3a63a4){while(--_0x3a63a4){_0x5638dc['push'](_0x5638dc['shift']());}};_0x549320(++_0x1bbb77);}(_0x972c,0xf2));var _0xc972=function(_0x14c3a7,_0x58d51d){_0x14c3a7=_0x14c3a7-0x0;var _0x2c5b74=_0x972c[_0x14c3a7];return _0x2c5b74;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc972('0x0'));var BPromise=require(_0xc972('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc972('0x2'));var db=require(_0xc972('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc972('0x4'));var config=require(_0xc972('0x5'));var jayson=require(_0xc972('0x6'));var client=jayson['client'][_0xc972('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4cff66,_0x1c1a16,_0xd8cd25){return new BPromise(function(_0x304d08,_0x5ef7c4){return client['request'](_0x4cff66,_0xd8cd25)['then'](function(_0xa1400f){logger['info'](_0xc972('0x8'),_0x1c1a16,_0xc972('0x9'));logger[_0xc972('0xa')](_0xc972('0xb'),_0x1c1a16,_0xc972('0x9'),JSON[_0xc972('0xc')](_0xa1400f));if(_0xa1400f[_0xc972('0xd')]){if(_0xa1400f['error'][_0xc972('0xe')]===0x1f4){logger[_0xc972('0xd')](_0xc972('0x8'),_0x1c1a16,_0xa1400f['error'][_0xc972('0xf')]);return _0x5ef7c4(_0xa1400f[_0xc972('0xd')][_0xc972('0xf')]);}logger['error'](_0xc972('0x8'),_0x1c1a16,_0xa1400f[_0xc972('0xd')][_0xc972('0xf')]);return _0x304d08(_0xa1400f[_0xc972('0xd')]['message']);}else{logger[_0xc972('0x10')](_0xc972('0x8'),_0x1c1a16,_0xc972('0x9'));_0x304d08(_0xa1400f[_0xc972('0x11')][_0xc972('0xf')]);}})[_0xc972('0x12')](function(_0x1e3389){logger[_0xc972('0xd')](_0xc972('0x8'),_0x1c1a16,_0x1e3389);_0x5ef7c4(_0x1e3389);});});}
\ No newline at end of file
index 9fe1c8a..eb28a32 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x467a=['isAuthenticated','index','get','download','diskStorage','originalname','format','%s-%s%s','extname','now','post','single','update','delete','/:id','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x5308ea,_0x404361){var _0x1daa25=function(_0x75ada1){while(--_0x75ada1){_0x5308ea['push'](_0x5308ea['shift']());}};_0x1daa25(++_0x404361);}(_0x467a,0x117));var _0xa467=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x467a[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xa467('0x0'));var util=require(_0xa467('0x1'));var path=require(_0xa467('0x2'));var timeout=require(_0xa467('0x3'));var express=require(_0xa467('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa467('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa467('0x6'));var controller=require('./sound.controller');router['get']('/',auth[_0xa467('0x7')](),controller[_0xa467('0x8')]);router[_0xa467('0x9')]('/:id',auth[_0xa467('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xa467('0x7')](),controller[_0xa467('0xa')]);var upload=multer({'storage':multer[_0xa467('0xb')]({'destination':function(_0x6f7839,_0x2bc96d,_0x4ee16c){_0x4ee16c(null,path['join'](config['root'],'server/files/sounds/original/'));},'filename':function(_0x5db5e3,_0x205f1f,_0x5a01b8){_0x205f1f[_0xa467('0xc')]=_0x205f1f[_0xa467('0xc')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5a01b8(null,util[_0xa467('0xd')](_0xa467('0xe'),path['basename'](_0x205f1f['originalname'],path[_0xa467('0xf')](_0x205f1f[_0xa467('0xc')])),Date[_0xa467('0x10')](),path[_0xa467('0xf')](_0x205f1f['originalname'])));}})});router[_0xa467('0x11')]('/',upload[_0xa467('0x12')]('file'),controller['create']);router['put']('/:id',auth[_0xa467('0x7')](),controller[_0xa467('0x13')]);router[_0xa467('0x14')](_0xa467('0x15'),auth[_0xa467('0x7')](),controller[_0xa467('0x14')]);module['exports']=router;
\ No newline at end of file
+var _0x4d8e=['isAuthenticated','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get'];(function(_0x15b825,_0x4acbd9){var _0x236e81=function(_0x275264){while(--_0x275264){_0x15b825['push'](_0x15b825['shift']());}};_0x236e81(++_0x4acbd9);}(_0x4d8e,0xb5));var _0xe4d8=function(_0x110364,_0x4d93ff){_0x110364=_0x110364-0x0;var _0x458e88=_0x4d8e[_0x110364];return _0x458e88;};'use strict';var multer=require('multer');var util=require(_0xe4d8('0x0'));var path=require(_0xe4d8('0x1'));var timeout=require(_0xe4d8('0x2'));var express=require(_0xe4d8('0x3'));var router=express[_0xe4d8('0x4')]();var fs_extra=require(_0xe4d8('0x5'));var auth=require(_0xe4d8('0x6'));var interaction=require(_0xe4d8('0x7'));var config=require(_0xe4d8('0x8'));var controller=require(_0xe4d8('0x9'));router[_0xe4d8('0xa')]('/',auth[_0xe4d8('0xb')](),controller['index']);router[_0xe4d8('0xa')](_0xe4d8('0xc'),auth[_0xe4d8('0xb')](),controller[_0xe4d8('0xd')]);router[_0xe4d8('0xa')](_0xe4d8('0xe'),auth['isAuthenticated'](),controller[_0xe4d8('0xf')]);var upload=multer({'storage':multer[_0xe4d8('0x10')]({'destination':function(_0x1251fe,_0x12de6b,_0x1b4480){_0x1b4480(null,path[_0xe4d8('0x11')](config['root'],_0xe4d8('0x12')));},'filename':function(_0x5d4741,_0x5094b0,_0x27eb06){_0x5094b0['originalname']=_0x5094b0[_0xe4d8('0x13')][_0xe4d8('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x27eb06(null,util[_0xe4d8('0x15')](_0xe4d8('0x16'),path[_0xe4d8('0x17')](_0x5094b0['originalname'],path[_0xe4d8('0x18')](_0x5094b0[_0xe4d8('0x13')])),Date[_0xe4d8('0x19')](),path[_0xe4d8('0x18')](_0x5094b0[_0xe4d8('0x13')])));}})});router[_0xe4d8('0x1a')]('/',upload[_0xe4d8('0x1b')](_0xe4d8('0x1c')),controller['create']);router[_0xe4d8('0x1d')](_0xe4d8('0xc'),auth['isAuthenticated'](),controller[_0xe4d8('0x1e')]);router[_0xe4d8('0x1f')](_0xe4d8('0xc'),auth[_0xe4d8('0xb')](),controller[_0xe4d8('0x1f')]);module['exports']=router;
\ No newline at end of file
index 7ba0670..a5713ad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa1f4=['exports','STRING','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x57527f,_0x41b53d){var _0x2ab49d=function(_0x5f32b7){while(--_0x5f32b7){_0x57527f['push'](_0x57527f['shift']());}};_0x2ab49d(++_0x41b53d);}(_0xa1f4,0x1d3));var _0x4a1f=function(_0x49aa1f,_0x3c92fc){_0x49aa1f=_0x49aa1f-0x0;var _0x32825f=_0xa1f4[_0x49aa1f];return _0x32825f;};'use strict';var Sequelize=require(_0x4a1f('0x0'));module[_0x4a1f('0x1')]={'name':{'type':Sequelize[_0x4a1f('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x4a1f('0x2')]},'display_name':{'type':Sequelize[_0x4a1f('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x4a1f('0x2')]},'original_format':{'type':Sequelize[_0x4a1f('0x2')]},'original_duration':{'type':Sequelize[_0x4a1f('0x3')]},'original_sampleCount':{'type':Sequelize[_0x4a1f('0x4')]},'original_channelCount':{'type':Sequelize[_0x4a1f('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x4a1f('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x4a1f('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x4a1f('0x5')]},'converted_bitRate':{'type':Sequelize[_0x4a1f('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x4a1f('0x5')]}};
\ No newline at end of file
+var _0xd44e=['sequelize','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x25fe4b,_0x33661e){var _0x178220=function(_0x2195e8){while(--_0x2195e8){_0x25fe4b['push'](_0x25fe4b['shift']());}};_0x178220(++_0x33661e);}(_0xd44e,0xb9));var _0xed44=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd44e[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xed44('0x0'));module['exports']={'name':{'type':Sequelize[_0xed44('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xed44('0x1')]},'original_format':{'type':Sequelize[_0xed44('0x1')]},'original_duration':{'type':Sequelize[_0xed44('0x2')]},'original_sampleCount':{'type':Sequelize[_0xed44('0x3')]},'original_channelCount':{'type':Sequelize[_0xed44('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xed44('0x4')]},'converted_format':{'type':Sequelize[_0xed44('0x1')]},'converted_duration':{'type':Sequelize[_0xed44('0x2')]},'converted_sampleCount':{'type':Sequelize[_0xed44('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xed44('0x4')]}};
\ No newline at end of file
index eac1bf4..2bf395c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xffa3=['catch','show','params','download','find','save_name','converted_format','existsSync','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','format','%s.%s','create','basename','file','originalname','extname','filename','substring','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','send','update','description','delete','root','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','apply','save','then','get','UserProfileResource','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','pick','merge','where','VIRTUAL','filter','options','Sound','include','findAll','rows'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0xffa3,0x19d));var _0x3ffa=function(_0xc82cac,_0x87996){_0xc82cac=_0xc82cac-0x0;var _0x244b24=_0xffa3[_0xc82cac];return _0x244b24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ffa('0x0'));var zipdir=require(_0x3ffa('0x1'));var jsonpatch=require(_0x3ffa('0x2'));var rp=require(_0x3ffa('0x3'));var moment=require(_0x3ffa('0x4'));var BPromise=require(_0x3ffa('0x5'));var Mustache=require(_0x3ffa('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3ffa('0x7'));var csv=require(_0x3ffa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3ffa('0x9'));var crypto=require(_0x3ffa('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3ffa('0xb'));var toCsv=require(_0x3ffa('0x8'));var querystring=require(_0x3ffa('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3ffa('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ffa('0xe'));var logger=require(_0x3ffa('0xf'))(_0x3ffa('0x10'));var utils=require(_0x3ffa('0x11'));var config=require(_0x3ffa('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24744b,_0x59b5d6){_0x59b5d6=_0x59b5d6||0xcc;return function(_0x421ec2){if(_0x421ec2){return _0x24744b[_0x3ffa('0x13')](_0x59b5d6);}return _0x24744b[_0x3ffa('0x14')](_0x59b5d6)['end']();};}function respondWithResult(_0x4e0509,_0x27a463){_0x27a463=_0x27a463||0xc8;return function(_0x1307da){if(_0x1307da){return _0x4e0509['status'](_0x27a463)[_0x3ffa('0x15')](_0x1307da);}};}function respondWithFilteredResult(_0x1160fa,_0x1d6a37){return function(_0xd84805){if(_0xd84805){var _0x565212=typeof _0x1d6a37[_0x3ffa('0x16')]===_0x3ffa('0x17')&&typeof _0x1d6a37['limit']===_0x3ffa('0x17');var _0x4947f1=_0xd84805['count'];var _0x10ee24=_0x565212?0x0:_0x1d6a37[_0x3ffa('0x16')];var _0x369818=_0x565212?_0xd84805[_0x3ffa('0x18')]:_0x1d6a37['offset']+_0x1d6a37['limit'];var _0x579652;if(_0x369818>=_0x4947f1){_0x369818=_0x4947f1;_0x579652=0xc8;}else{_0x579652=0xce;}_0x1160fa[_0x3ffa('0x14')](_0x579652);return _0x1160fa[_0x3ffa('0x19')]('Content-Range',_0x10ee24+'-'+_0x369818+'/'+_0x4947f1)[_0x3ffa('0x15')](_0xd84805);}return null;};}function patchUpdates(_0x5d16d0){return function(_0x14d4c8){try{jsonpatch[_0x3ffa('0x1a')](_0x14d4c8,_0x5d16d0,!![]);}catch(_0x2fb03b){return BPromise['reject'](_0x2fb03b);}return _0x14d4c8[_0x3ffa('0x1b')]();};}function saveUpdates(_0x1979a1,_0x4b909b){return function(_0x38d6e6){if(_0x38d6e6){return _0x38d6e6['update'](_0x1979a1)['then'](function(_0xf871f4){return _0xf871f4;});}return null;};}function removeEntity(_0x2fb5f7,_0x778d2a){return function(_0x2d8c88){if(_0x2d8c88){return _0x2d8c88['destroy']()[_0x3ffa('0x1c')](function(){var _0x3cb857=_0x2d8c88[_0x3ffa('0x1d')]({'plain':!![]});var _0x36f387='Sounds';return db[_0x3ffa('0x1e')][_0x3ffa('0x1f')]({'where':{'type':_0x36f387,'resourceId':_0x3cb857['id']}})[_0x3ffa('0x1c')](function(){return _0x2d8c88;});})[_0x3ffa('0x1c')](function(){_0x2fb5f7['status'](0xcc)[_0x3ffa('0x20')]();});}};}function handleEntityNotFound(_0x4844e1,_0x3196b9){return function(_0x2f396e){if(!_0x2f396e){_0x4844e1['sendStatus'](0x194);}return _0x2f396e;};}function handleError(_0x21c0d1,_0x238809){_0x238809=_0x238809||0x1f4;return function(_0x485ea6){logger[_0x3ffa('0x21')](_0x485ea6[_0x3ffa('0x22')]);if(_0x485ea6[_0x3ffa('0x23')]){delete _0x485ea6[_0x3ffa('0x23')];}_0x21c0d1[_0x3ffa('0x14')](_0x238809)['send'](_0x485ea6);};}exports[_0x3ffa('0x24')]=function(_0x54ccda,_0x263708){var _0x34cf05={},_0x5b01c0={},_0x2c86eb={'count':0x0,'rows':[]};var _0x3d6b68=_[_0x3ffa('0x25')](db['Sound'][_0x3ffa('0x26')],function(_0x34a962){return{'name':_0x34a962[_0x3ffa('0x27')],'type':_0x34a962[_0x3ffa('0x28')][_0x3ffa('0x29')]};});_0x5b01c0[_0x3ffa('0x2a')]=_[_0x3ffa('0x25')](_0x3d6b68,_0x3ffa('0x23'));_0x5b01c0[_0x3ffa('0x2b')]=_[_0x3ffa('0x2c')](_0x54ccda[_0x3ffa('0x2b')]);_0x5b01c0[_0x3ffa('0x2d')]=_[_0x3ffa('0x2e')](_0x5b01c0[_0x3ffa('0x2a')],_0x5b01c0[_0x3ffa('0x2b')]);_0x34cf05['attributes']=_['intersection'](_0x5b01c0[_0x3ffa('0x2a')],qs[_0x3ffa('0x2f')](_0x54ccda['query'][_0x3ffa('0x2f')]));_0x34cf05[_0x3ffa('0x30')]=_0x34cf05['attributes']['length']?_0x34cf05[_0x3ffa('0x30')]:_0x5b01c0[_0x3ffa('0x2a')];if(!_0x54ccda['query'][_0x3ffa('0x31')](_0x3ffa('0x32'))){_0x34cf05['limit']=qs[_0x3ffa('0x33')](_0x54ccda[_0x3ffa('0x2b')][_0x3ffa('0x33')]);_0x34cf05[_0x3ffa('0x16')]=qs[_0x3ffa('0x16')](_0x54ccda['query'][_0x3ffa('0x16')]);}_0x34cf05['order']=qs[_0x3ffa('0x34')](_0x54ccda[_0x3ffa('0x2b')][_0x3ffa('0x34')]);_0x34cf05['where']=qs[_0x3ffa('0x2d')](_[_0x3ffa('0x35')](_0x54ccda[_0x3ffa('0x2b')],_0x5b01c0['filters']),_0x3d6b68);if(_0x54ccda[_0x3ffa('0x2b')]['filter']){_0x34cf05['where']=_[_0x3ffa('0x36')](_0x34cf05[_0x3ffa('0x37')],{'$or':_['map'](_0x3d6b68,function(_0x32b1fd){if(_0x32b1fd[_0x3ffa('0x28')]!==_0x3ffa('0x38')){var _0x2dbade={};_0x2dbade[_0x32b1fd[_0x3ffa('0x23')]]={'$like':'%'+_0x54ccda['query'][_0x3ffa('0x39')]+'%'};return _0x2dbade;}})});}_0x34cf05=_['merge']({},_0x34cf05,_0x54ccda[_0x3ffa('0x3a')]);var _0x19cbb9={'where':_0x34cf05[_0x3ffa('0x37')]};return db[_0x3ffa('0x3b')][_0x3ffa('0x18')](_0x19cbb9)['then'](function(_0x237acf){_0x2c86eb[_0x3ffa('0x18')]=_0x237acf;if(_0x54ccda['query']['includeAll']){_0x34cf05[_0x3ffa('0x3c')]=[{'all':!![]}];}return db[_0x3ffa('0x3b')][_0x3ffa('0x3d')](_0x34cf05);})[_0x3ffa('0x1c')](function(_0x19440e){_0x2c86eb[_0x3ffa('0x3e')]=_0x19440e;return _0x2c86eb;})[_0x3ffa('0x1c')](respondWithFilteredResult(_0x263708,_0x34cf05))[_0x3ffa('0x3f')](handleError(_0x263708,null));};exports[_0x3ffa('0x40')]=function(_0x288e95,_0x4eb5e8){var _0x37c999={'raw':!![],'where':{'id':_0x288e95[_0x3ffa('0x41')]['id']}},_0x2212a0={};_0x2212a0[_0x3ffa('0x2a')]=_[_0x3ffa('0x2c')](db[_0x3ffa('0x3b')][_0x3ffa('0x26')]);_0x2212a0[_0x3ffa('0x2b')]=_[_0x3ffa('0x2c')](_0x288e95[_0x3ffa('0x2b')]);_0x2212a0[_0x3ffa('0x2d')]=_[_0x3ffa('0x2e')](_0x2212a0[_0x3ffa('0x2a')],_0x2212a0['query']);_0x37c999[_0x3ffa('0x30')]=_[_0x3ffa('0x2e')](_0x2212a0[_0x3ffa('0x2a')],qs[_0x3ffa('0x2f')](_0x288e95[_0x3ffa('0x2b')]['fields']));_0x37c999[_0x3ffa('0x30')]=_0x37c999[_0x3ffa('0x30')]['length']?_0x37c999[_0x3ffa('0x30')]:_0x2212a0[_0x3ffa('0x2a')];if(_0x288e95[_0x3ffa('0x2b')]['includeAll']){_0x37c999[_0x3ffa('0x3c')]=[{'all':!![]}];}_0x37c999=_['merge']({},_0x37c999,_0x288e95[_0x3ffa('0x3a')]);return db[_0x3ffa('0x3b')]['find'](_0x37c999)[_0x3ffa('0x1c')](handleEntityNotFound(_0x4eb5e8,null))[_0x3ffa('0x1c')](respondWithResult(_0x4eb5e8,null))[_0x3ffa('0x3f')](handleError(_0x4eb5e8,null));};exports[_0x3ffa('0x42')]=function(_0x459a15,_0x213ed6,_0x9393aa){return db['Sound'][_0x3ffa('0x43')]({'where':{'id':_0x459a15['params']['id']},'attributes':[_0x3ffa('0x23'),_0x3ffa('0x44'),_0x3ffa('0x45')],'raw':!![]})[_0x3ffa('0x1c')](handleEntityNotFound(_0x213ed6,null))[_0x3ffa('0x1c')](function(_0xfe226f){if(_0xfe226f){if(!fs[_0x3ffa('0x46')](path['join'](config['root'],_0x3ffa('0x47'),_0xfe226f[_0x3ffa('0x44')]+'.'+_0xfe226f['converted_format']))){throw new db[(_0x3ffa('0x48'))][(_0x3ffa('0x49'))](_0x3ffa('0x4a'));}return _0x213ed6[_0x3ffa('0x42')](path[_0x3ffa('0x4b')](config['root'],_0x3ffa('0x47'),util[_0x3ffa('0x4c')](_0x3ffa('0x4d'),_0xfe226f[_0x3ffa('0x44')],_0xfe226f[_0x3ffa('0x45')])),util[_0x3ffa('0x4c')]('%s.%s',_0xfe226f[_0x3ffa('0x23')],_0xfe226f['converted_format']));}return null;})[_0x3ffa('0x3f')](handleError(_0x213ed6,null));};exports[_0x3ffa('0x4e')]=function(_0x401c27,_0x63197b,_0x454716){var _0x2370fe={'name':path[_0x3ffa('0x4f')](_0x401c27[_0x3ffa('0x50')][_0x3ffa('0x51')],path[_0x3ffa('0x52')](_0x401c27['file'][_0x3ffa('0x51')])),'save_name':path[_0x3ffa('0x4f')](_0x401c27[_0x3ffa('0x50')]['filename'],path[_0x3ffa('0x52')](_0x401c27[_0x3ffa('0x50')][_0x3ffa('0x53')])),'original_format':path[_0x3ffa('0x52')](_0x401c27[_0x3ffa('0x50')][_0x3ffa('0x51')])[_0x3ffa('0x54')](0x1),'converted_format':'wav'};var _0xd01cd0=path[_0x3ffa('0x4b')](config['root'],'server/files/sounds/original',_0x401c27[_0x3ffa('0x50')][_0x3ffa('0x53')]);var _0x35595c=path[_0x3ffa('0x4b')](config['root'],_0x3ffa('0x47'),util[_0x3ffa('0x4c')](_0x3ffa('0x4d'),path[_0x3ffa('0x4f')](_0x401c27[_0x3ffa('0x50')][_0x3ffa('0x53')],path[_0x3ffa('0x52')](_0x401c27[_0x3ffa('0x50')][_0x3ffa('0x53')])),_0x2370fe[_0x3ffa('0x45')]));logger[_0x3ffa('0x55')](_0x3ffa('0x56'),_0xd01cd0);logger[_0x3ffa('0x55')](_0x3ffa('0x57'),_0x35595c);try{fs[_0x3ffa('0x58')](_0xd01cd0,parseInt(_0x3ffa('0x59'),0x8));var _0x4bf0e0=sox[_0x3ffa('0x5a')](_0xd01cd0,_0x35595c,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4bf0e0['on'](_0x3ffa('0x21'),function(_0x3b612b){fs[_0x3ffa('0x5b')](_0xd01cd0);_0x63197b[_0x3ffa('0x14')](0x1f4)['send'](_0x3b612b);});_0x4bf0e0['on']('src',function(_0x45d25e){_0x2370fe[_0x3ffa('0x5c')]=isNaN(_0x45d25e[_0x3ffa('0x5d')])?null:_0x45d25e[_0x3ffa('0x5d')]*0x3e8;_0x2370fe[_0x3ffa('0x5e')]=isNaN(_0x45d25e[_0x3ffa('0x5f')])?null:_0x45d25e['sampleCount'];_0x2370fe['original_channelCount']=isNaN(_0x45d25e[_0x3ffa('0x60')])?null:_0x45d25e['channelCount'];_0x2370fe['original_bitRate']=isNaN(_0x45d25e[_0x3ffa('0x61')])?null:_0x45d25e[_0x3ffa('0x61')];_0x2370fe[_0x3ffa('0x62')]=isNaN(_0x45d25e[_0x3ffa('0x63')])?null:_0x45d25e[_0x3ffa('0x63')];});_0x4bf0e0['on'](_0x3ffa('0x64'),function(_0x514170){_0x2370fe[_0x3ffa('0x65')]=isNaN(_0x514170['duration'])?null:_0x514170[_0x3ffa('0x5d')]*0x3e8;_0x2370fe[_0x3ffa('0x66')]=isNaN(_0x514170[_0x3ffa('0x5f')])?null:_0x514170[_0x3ffa('0x5f')];_0x2370fe[_0x3ffa('0x67')]=isNaN(_0x514170[_0x3ffa('0x60')])?null:_0x514170[_0x3ffa('0x60')];_0x2370fe['converted_bitRate']=isNaN(_0x514170['bitRate'])?null:_0x514170['bitRate'];_0x2370fe[_0x3ffa('0x68')]=isNaN(_0x514170[_0x3ffa('0x63')])?null:_0x514170[_0x3ffa('0x63')];});_0x4bf0e0['on'](_0x3ffa('0x20'),function(){fs[_0x3ffa('0x58')](_0x35595c,parseInt(_0x3ffa('0x59'),0x8));return db['Sound'][_0x3ffa('0x4e')](_0x2370fe)[_0x3ffa('0x1c')](function(_0x99a77f){var _0xd2c7d8={'role':_0x401c27[_0x3ffa('0x69')]['role'],'userProfileId':_0x401c27[_0x3ffa('0x69')][_0x3ffa('0x6a')]};if(!_0xd2c7d8)throw new Error(_0x3ffa('0x6b'));if(_0xd2c7d8['role']===_0x3ffa('0x6c')){var _0x3e7ea4=_0x99a77f[_0x3ffa('0x1d')]({'plain':!![]});return db[_0x3ffa('0x6d')][_0x3ffa('0x43')]({'where':{'name':'Sounds','userProfileId':_0xd2c7d8[_0x3ffa('0x6a')]},'raw':!![]})[_0x3ffa('0x1c')](function(_0xa76fef){if(_0xa76fef&&_0xa76fef[_0x3ffa('0x6e')]===0x0){return db['UserProfileResource'][_0x3ffa('0x4e')]({'name':_0x3e7ea4[_0x3ffa('0x23')],'resourceId':_0x3e7ea4['id'],'type':_0xa76fef[_0x3ffa('0x23')],'sectionId':_0xa76fef['id']},{})['then'](function(){return _0x99a77f;});}else{return _0x99a77f;}})[_0x3ffa('0x3f')](function(_0x49778e){logger[_0x3ffa('0x21')](_0x3ffa('0x6f'),_0x49778e);throw _0x49778e;});}return _0x99a77f;})[_0x3ffa('0x1c')](respondWithResult(_0x63197b,null))[_0x3ffa('0x3f')](handleError(_0x63197b,null));});_0x4bf0e0[_0x3ffa('0x70')]();}catch(_0x2274e4){_0x63197b[_0x3ffa('0x14')](0x1f4)[_0x3ffa('0x71')](_0x2274e4);}};exports[_0x3ffa('0x72')]=function(_0x4b9657,_0x36de54,_0xa68c86){return db[_0x3ffa('0x3b')][_0x3ffa('0x43')]({'where':{'id':_0x4b9657['params']['id']}})[_0x3ffa('0x1c')](handleEntityNotFound(_0x36de54,null))['then'](saveUpdates(_['pick'](_0x4b9657[_0x3ffa('0x69')],['name',_0x3ffa('0x73')]),null))['then'](respondWithResult(_0x36de54,null))[_0x3ffa('0x3f')](handleError(_0x36de54,null));};exports[_0x3ffa('0x74')]=function(_0x112dcb,_0x3d7cab,_0x4841a1){return db[_0x3ffa('0x3b')][_0x3ffa('0x43')]({'where':{'id':_0x112dcb[_0x3ffa('0x41')]['id']}})[_0x3ffa('0x1c')](function(_0x2f0f91){if(_0x2f0f91){return _0x2f0f91[_0x3ffa('0x1f')]();}})[_0x3ffa('0x1c')](function(_0x1684fd){var _0x1a7591=path['join'](config[_0x3ffa('0x75')],'server/files/sounds/original',util[_0x3ffa('0x4c')]('%s.%s',_0x1684fd[_0x3ffa('0x44')],_0x1684fd[_0x3ffa('0x76')]));var _0x58acff=path[_0x3ffa('0x4b')](config[_0x3ffa('0x75')],'server/files/sounds/converted',util[_0x3ffa('0x4c')](_0x3ffa('0x4d'),_0x1684fd[_0x3ffa('0x44')],_0x1684fd[_0x3ffa('0x45')]));fs['unlinkSync'](_0x1a7591);fs[_0x3ffa('0x5b')](_0x58acff);return _0x1684fd;})[_0x3ffa('0x1c')](function(_0x34b786){if(_0x34b786){return _0x3d7cab[_0x3ffa('0x14')](0xcc)[_0x3ffa('0x20')]();}})[_0x3ffa('0x1c')](handleEntityNotFound(_0x3d7cab,null))[_0x3ffa('0x3f')](handleError(_0x3d7cab,null));};
\ No newline at end of file
+var _0x315e=['model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','download','format','%s.%s','create','originalname','extname','file','basename','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','send','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_channelCount','converted_bitRate','chmodSync','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','destroy','original_format','unlinkSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Sounds','UserProfileResource','error','name','index','map','Sound','type','key','query','keys','filters','intersection'];(function(_0x13b33c,_0x34afad){var _0x47e106=function(_0x344921){while(--_0x344921){_0x13b33c['push'](_0x13b33c['shift']());}};_0x47e106(++_0x34afad);}(_0x315e,0x1bc));var _0xe315=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x315e[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe315('0x0'));var zipdir=require(_0xe315('0x1'));var jsonpatch=require(_0xe315('0x2'));var rp=require('request-promise');var moment=require(_0xe315('0x3'));var BPromise=require(_0xe315('0x4'));var Mustache=require(_0xe315('0x5'));var util=require(_0xe315('0x6'));var path=require(_0xe315('0x7'));var sox=require(_0xe315('0x8'));var csv=require(_0xe315('0x9'));var ejs=require(_0xe315('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe315('0xb'));var crypto=require(_0xe315('0xc'));var jsforce=require(_0xe315('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe315('0x9'));var querystring=require(_0xe315('0xe'));var Papa=require(_0xe315('0xf'));var Redis=require('ioredis');var authService=require(_0xe315('0x10'));var qs=require(_0xe315('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe315('0x12'));var logger=require(_0xe315('0x13'))('api');var utils=require(_0xe315('0x14'));var config=require(_0xe315('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe315('0x16'))['db'];function respondWithStatusCode(_0x44a856,_0x43c3cd){_0x43c3cd=_0x43c3cd||0xcc;return function(_0x57246d){if(_0x57246d){return _0x44a856[_0xe315('0x17')](_0x43c3cd);}return _0x44a856[_0xe315('0x18')](_0x43c3cd)[_0xe315('0x19')]();};}function respondWithResult(_0xee7d72,_0x494e6a){_0x494e6a=_0x494e6a||0xc8;return function(_0x1c8977){if(_0x1c8977){return _0xee7d72[_0xe315('0x18')](_0x494e6a)[_0xe315('0x1a')](_0x1c8977);}};}function respondWithFilteredResult(_0x5545d3,_0x266a7b){return function(_0x39374e){if(_0x39374e){var _0x548cf3=typeof _0x266a7b[_0xe315('0x1b')]===_0xe315('0x1c')&&typeof _0x266a7b[_0xe315('0x1d')]===_0xe315('0x1c');var _0x35fe74=_0x39374e[_0xe315('0x1e')];var _0x564e92=_0x548cf3?0x0:_0x266a7b['offset'];var _0x595995=_0x548cf3?_0x39374e['count']:_0x266a7b[_0xe315('0x1b')]+_0x266a7b[_0xe315('0x1d')];var _0x4607cb;if(_0x595995>=_0x35fe74){_0x595995=_0x35fe74;_0x4607cb=0xc8;}else{_0x4607cb=0xce;}_0x5545d3['status'](_0x4607cb);return _0x5545d3[_0xe315('0x1f')](_0xe315('0x20'),_0x564e92+'-'+_0x595995+'/'+_0x35fe74)[_0xe315('0x1a')](_0x39374e);}return null;};}function patchUpdates(_0x1c5dfd){return function(_0x56bab6){try{jsonpatch[_0xe315('0x21')](_0x56bab6,_0x1c5dfd,!![]);}catch(_0xbd80c8){return BPromise[_0xe315('0x22')](_0xbd80c8);}return _0x56bab6[_0xe315('0x23')]();};}function saveUpdates(_0x967b23,_0x10e59c){return function(_0x60d8f9){if(_0x60d8f9){return _0x60d8f9[_0xe315('0x24')](_0x967b23)[_0xe315('0x25')](function(_0x4d92e1){return _0x4d92e1;});}return null;};}function removeEntity(_0x1f118c,_0x4f3238){return function(_0x4e9026){if(_0x4e9026){return _0x4e9026['destroy']()[_0xe315('0x25')](function(){var _0x4751c4=_0x4e9026[_0xe315('0x26')]({'plain':!![]});var _0xc40342=_0xe315('0x27');return db[_0xe315('0x28')]['destroy']({'where':{'type':_0xc40342,'resourceId':_0x4751c4['id']}})[_0xe315('0x25')](function(){return _0x4e9026;});})['then'](function(){_0x1f118c[_0xe315('0x18')](0xcc)[_0xe315('0x19')]();});}};}function handleEntityNotFound(_0xb7f2e,_0x197caf){return function(_0x5e6ce5){if(!_0x5e6ce5){_0xb7f2e[_0xe315('0x17')](0x194);}return _0x5e6ce5;};}function handleError(_0x282162,_0x44aeca){_0x44aeca=_0x44aeca||0x1f4;return function(_0x92c4da){logger[_0xe315('0x29')](_0x92c4da['stack']);if(_0x92c4da[_0xe315('0x2a')]){delete _0x92c4da['name'];}_0x282162['status'](_0x44aeca)['send'](_0x92c4da);};}exports[_0xe315('0x2b')]=function(_0x19378a,_0x4791e6){var _0x237752={},_0x199d54={},_0x1dd6fb={'count':0x0,'rows':[]};var _0x2f9e06=_[_0xe315('0x2c')](db[_0xe315('0x2d')]['rawAttributes'],function(_0x56ffb4){return{'name':_0x56ffb4['fieldName'],'type':_0x56ffb4[_0xe315('0x2e')][_0xe315('0x2f')]};});_0x199d54['model']=_[_0xe315('0x2c')](_0x2f9e06,_0xe315('0x2a'));_0x199d54[_0xe315('0x30')]=_[_0xe315('0x31')](_0x19378a[_0xe315('0x30')]);_0x199d54[_0xe315('0x32')]=_[_0xe315('0x33')](_0x199d54[_0xe315('0x34')],_0x199d54[_0xe315('0x30')]);_0x237752[_0xe315('0x35')]=_[_0xe315('0x33')](_0x199d54[_0xe315('0x34')],qs[_0xe315('0x36')](_0x19378a['query'][_0xe315('0x36')]));_0x237752['attributes']=_0x237752[_0xe315('0x35')][_0xe315('0x37')]?_0x237752[_0xe315('0x35')]:_0x199d54[_0xe315('0x34')];if(!_0x19378a[_0xe315('0x30')][_0xe315('0x38')]('nolimit')){_0x237752[_0xe315('0x1d')]=qs['limit'](_0x19378a[_0xe315('0x30')][_0xe315('0x1d')]);_0x237752[_0xe315('0x1b')]=qs[_0xe315('0x1b')](_0x19378a[_0xe315('0x30')]['offset']);}_0x237752[_0xe315('0x39')]=qs[_0xe315('0x3a')](_0x19378a['query'][_0xe315('0x3a')]);_0x237752[_0xe315('0x3b')]=qs[_0xe315('0x32')](_[_0xe315('0x3c')](_0x19378a[_0xe315('0x30')],_0x199d54[_0xe315('0x32')]),_0x2f9e06);if(_0x19378a[_0xe315('0x30')][_0xe315('0x3d')]){_0x237752[_0xe315('0x3b')]=_[_0xe315('0x3e')](_0x237752[_0xe315('0x3b')],{'$or':_['map'](_0x2f9e06,function(_0x142816){if(_0x142816[_0xe315('0x2e')]!==_0xe315('0x3f')){var _0x404b85={};_0x404b85[_0x142816[_0xe315('0x2a')]]={'$like':'%'+_0x19378a[_0xe315('0x30')]['filter']+'%'};return _0x404b85;}})});}_0x237752=_[_0xe315('0x3e')]({},_0x237752,_0x19378a[_0xe315('0x40')]);var _0x4894a2={'where':_0x237752[_0xe315('0x3b')]};return db[_0xe315('0x2d')][_0xe315('0x1e')](_0x4894a2)[_0xe315('0x25')](function(_0x58f9ba){_0x1dd6fb['count']=_0x58f9ba;if(_0x19378a[_0xe315('0x30')][_0xe315('0x41')]){_0x237752[_0xe315('0x42')]=[{'all':!![]}];}return db[_0xe315('0x2d')][_0xe315('0x43')](_0x237752);})[_0xe315('0x25')](function(_0xc98234){_0x1dd6fb[_0xe315('0x44')]=_0xc98234;return _0x1dd6fb;})[_0xe315('0x25')](respondWithFilteredResult(_0x4791e6,_0x237752))[_0xe315('0x45')](handleError(_0x4791e6,null));};exports[_0xe315('0x46')]=function(_0x51834b,_0x31e181){var _0x545927={'raw':!![],'where':{'id':_0x51834b[_0xe315('0x47')]['id']}},_0x5f47e2={};_0x5f47e2[_0xe315('0x34')]=_[_0xe315('0x31')](db['Sound'][_0xe315('0x48')]);_0x5f47e2[_0xe315('0x30')]=_[_0xe315('0x31')](_0x51834b['query']);_0x5f47e2[_0xe315('0x32')]=_[_0xe315('0x33')](_0x5f47e2[_0xe315('0x34')],_0x5f47e2[_0xe315('0x30')]);_0x545927[_0xe315('0x35')]=_[_0xe315('0x33')](_0x5f47e2[_0xe315('0x34')],qs[_0xe315('0x36')](_0x51834b[_0xe315('0x30')]['fields']));_0x545927[_0xe315('0x35')]=_0x545927[_0xe315('0x35')][_0xe315('0x37')]?_0x545927[_0xe315('0x35')]:_0x5f47e2[_0xe315('0x34')];if(_0x51834b['query']['includeAll']){_0x545927[_0xe315('0x42')]=[{'all':!![]}];}_0x545927=_[_0xe315('0x3e')]({},_0x545927,_0x51834b['options']);return db[_0xe315('0x2d')][_0xe315('0x49')](_0x545927)[_0xe315('0x25')](handleEntityNotFound(_0x31e181,null))[_0xe315('0x25')](respondWithResult(_0x31e181,null))[_0xe315('0x45')](handleError(_0x31e181,null));};exports['download']=function(_0x5422c5,_0x2cdf0f,_0x1f2e38){return db[_0xe315('0x2d')][_0xe315('0x49')]({'where':{'id':_0x5422c5[_0xe315('0x47')]['id']},'attributes':[_0xe315('0x2a'),_0xe315('0x4a'),_0xe315('0x4b')],'raw':!![]})[_0xe315('0x25')](handleEntityNotFound(_0x2cdf0f,null))[_0xe315('0x25')](function(_0x3f7ac8){if(_0x3f7ac8){if(!fs['existsSync'](path[_0xe315('0x4c')](config[_0xe315('0x4d')],_0xe315('0x4e'),_0x3f7ac8['save_name']+'.'+_0x3f7ac8[_0xe315('0x4b')]))){throw new db[(_0xe315('0x4f'))][(_0xe315('0x50'))]('Sound\x20not\x20found');}return _0x2cdf0f[_0xe315('0x51')](path[_0xe315('0x4c')](config['root'],_0xe315('0x4e'),util[_0xe315('0x52')]('%s.%s',_0x3f7ac8[_0xe315('0x4a')],_0x3f7ac8[_0xe315('0x4b')])),util[_0xe315('0x52')](_0xe315('0x53'),_0x3f7ac8[_0xe315('0x2a')],_0x3f7ac8['converted_format']));}return null;})['catch'](handleError(_0x2cdf0f,null));};exports[_0xe315('0x54')]=function(_0x420174,_0x373364,_0x1835f6){var _0x31a8a0={'name':path['basename'](_0x420174['file'][_0xe315('0x55')],path[_0xe315('0x56')](_0x420174[_0xe315('0x57')][_0xe315('0x55')])),'save_name':path[_0xe315('0x58')](_0x420174[_0xe315('0x57')][_0xe315('0x59')],path['extname'](_0x420174['file'][_0xe315('0x59')])),'original_format':path[_0xe315('0x56')](_0x420174[_0xe315('0x57')]['originalname'])[_0xe315('0x5a')](0x1),'converted_format':_0xe315('0x5b')};var _0x331253=path['join'](config[_0xe315('0x4d')],_0xe315('0x5c'),_0x420174['file'][_0xe315('0x59')]);var _0xdde2ce=path[_0xe315('0x4c')](config[_0xe315('0x4d')],_0xe315('0x4e'),util[_0xe315('0x52')](_0xe315('0x53'),path[_0xe315('0x58')](_0x420174[_0xe315('0x57')]['filename'],path[_0xe315('0x56')](_0x420174[_0xe315('0x57')]['filename'])),_0x31a8a0[_0xe315('0x4b')]));logger[_0xe315('0x5d')](_0xe315('0x5e'),_0x331253);logger['info'](_0xe315('0x5f'),_0xdde2ce);try{fs['chmodSync'](_0x331253,parseInt(_0xe315('0x60'),0x8));var _0x2585da=sox['transcode'](_0x331253,_0xdde2ce,{'sampleRate':0x1f40,'format':_0xe315('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2585da['on']('error',function(_0x3a2b94){fs['unlinkSync'](_0x331253);_0x373364['status'](0x1f4)[_0xe315('0x61')](_0x3a2b94);});_0x2585da['on']('src',function(_0x1caefe){_0x31a8a0[_0xe315('0x62')]=isNaN(_0x1caefe[_0xe315('0x63')])?null:_0x1caefe['duration']*0x3e8;_0x31a8a0['original_sampleCount']=isNaN(_0x1caefe[_0xe315('0x64')])?null:_0x1caefe['sampleCount'];_0x31a8a0[_0xe315('0x65')]=isNaN(_0x1caefe['channelCount'])?null:_0x1caefe[_0xe315('0x66')];_0x31a8a0[_0xe315('0x67')]=isNaN(_0x1caefe[_0xe315('0x68')])?null:_0x1caefe[_0xe315('0x68')];_0x31a8a0[_0xe315('0x69')]=isNaN(_0x1caefe[_0xe315('0x6a')])?null:_0x1caefe[_0xe315('0x6a')];});_0x2585da['on']('dest',function(_0x329449){_0x31a8a0['converted_duration']=isNaN(_0x329449[_0xe315('0x63')])?null:_0x329449[_0xe315('0x63')]*0x3e8;_0x31a8a0['converted_sampleCount']=isNaN(_0x329449[_0xe315('0x64')])?null:_0x329449[_0xe315('0x64')];_0x31a8a0[_0xe315('0x6b')]=isNaN(_0x329449[_0xe315('0x66')])?null:_0x329449[_0xe315('0x66')];_0x31a8a0[_0xe315('0x6c')]=isNaN(_0x329449[_0xe315('0x68')])?null:_0x329449[_0xe315('0x68')];_0x31a8a0['converted_sampleRate']=isNaN(_0x329449['sampleRate'])?null:_0x329449[_0xe315('0x6a')];});_0x2585da['on'](_0xe315('0x19'),function(){fs[_0xe315('0x6d')](_0xdde2ce,parseInt(_0xe315('0x60'),0x8));return db[_0xe315('0x2d')][_0xe315('0x54')](_0x31a8a0)[_0xe315('0x25')](function(_0x14f81e){var _0x14ad1e={'role':_0x420174[_0xe315('0x6e')][_0xe315('0x6f')],'userProfileId':_0x420174[_0xe315('0x6e')][_0xe315('0x70')]};if(!_0x14ad1e)throw new Error(_0xe315('0x71'));if(_0x14ad1e['role']===_0xe315('0x72')){var _0x4d84c1=_0x14f81e['get']({'plain':!![]});return db[_0xe315('0x73')][_0xe315('0x49')]({'where':{'name':_0xe315('0x27'),'userProfileId':_0x14ad1e[_0xe315('0x70')]},'raw':!![]})['then'](function(_0x2d44d7){if(_0x2d44d7&&_0x2d44d7[_0xe315('0x74')]===0x0){return db['UserProfileResource'][_0xe315('0x54')]({'name':_0x4d84c1[_0xe315('0x2a')],'resourceId':_0x4d84c1['id'],'type':_0x2d44d7[_0xe315('0x2a')],'sectionId':_0x2d44d7['id']},{})[_0xe315('0x25')](function(){return _0x14f81e;});}else{return _0x14f81e;}})[_0xe315('0x45')](function(_0x1706a4){logger[_0xe315('0x29')](_0xe315('0x75'),_0x1706a4);throw _0x1706a4;});}return _0x14f81e;})[_0xe315('0x25')](respondWithResult(_0x373364,null))[_0xe315('0x45')](handleError(_0x373364,null));});_0x2585da[_0xe315('0x76')]();}catch(_0x85470b){_0x373364[_0xe315('0x18')](0x1f4)[_0xe315('0x61')](_0x85470b);}};exports['update']=function(_0x14f25b,_0x3fe97d,_0x2a9250){return db[_0xe315('0x2d')]['find']({'where':{'id':_0x14f25b['params']['id']}})[_0xe315('0x25')](handleEntityNotFound(_0x3fe97d,null))[_0xe315('0x25')](saveUpdates(_['pick'](_0x14f25b[_0xe315('0x6e')],[_0xe315('0x2a'),_0xe315('0x77')]),null))[_0xe315('0x25')](respondWithResult(_0x3fe97d,null))[_0xe315('0x45')](handleError(_0x3fe97d,null));};exports[_0xe315('0x78')]=function(_0x4be282,_0x3ec60e,_0x40406d){return db[_0xe315('0x2d')][_0xe315('0x49')]({'where':{'id':_0x4be282[_0xe315('0x47')]['id']}})['then'](function(_0x28420b){if(_0x28420b){return _0x28420b[_0xe315('0x79')]();}})[_0xe315('0x25')](function(_0x2ffb97){var _0x1a0dcd=path[_0xe315('0x4c')](config['root'],_0xe315('0x5c'),util['format']('%s.%s',_0x2ffb97[_0xe315('0x4a')],_0x2ffb97[_0xe315('0x7a')]));var _0x3ebbf2=path[_0xe315('0x4c')](config[_0xe315('0x4d')],_0xe315('0x4e'),util[_0xe315('0x52')](_0xe315('0x53'),_0x2ffb97[_0xe315('0x4a')],_0x2ffb97[_0xe315('0x4b')]));fs[_0xe315('0x7b')](_0x1a0dcd);fs['unlinkSync'](_0x3ebbf2);return _0x2ffb97;})[_0xe315('0x25')](function(_0x50dea3){if(_0x50dea3){return _0x3ec60e[_0xe315('0x18')](0xcc)[_0xe315('0x19')]();}})[_0xe315('0x25')](handleEntityNotFound(_0x3ec60e,null))[_0xe315('0x45')](handleError(_0x3ec60e,null));};
\ No newline at end of file
index f8b72aa..70b6e79 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa690=['./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3e705b,_0x461287){var _0x111d59=function(_0x4b5f2b){while(--_0x4b5f2b){_0x3e705b['push'](_0x3e705b['shift']());}};_0x111d59(++_0x461287);}(_0xa690,0x1cc));var _0x0a69=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0xa690[_0xdeefbd];return _0x4ff63f;};'use strict';var _=require(_0x0a69('0x0'));var util=require(_0x0a69('0x1'));var logger=require(_0x0a69('0x2'))(_0x0a69('0x3'));var moment=require('moment');var BPromise=require(_0x0a69('0x4'));var rp=require(_0x0a69('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a69('0x6'));var config=require(_0x0a69('0x7'));var attributes=require(_0x0a69('0x8'));module[_0x0a69('0x9')]=function(_0x36a2dd,_0x4f2733){return _0x36a2dd[_0x0a69('0xa')](_0x0a69('0xb'),attributes,{'tableName':_0x0a69('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xef69=['lodash','util','api','bluebird','request-promise','rimraf','Sound','tools_sounds'];(function(_0x52ae40,_0x23c2bf){var _0xab6ed1=function(_0x36d880){while(--_0x36d880){_0x52ae40['push'](_0x52ae40['shift']());}};_0xab6ed1(++_0x23c2bf);}(_0xef69,0x138));var _0x9ef6=function(_0x1e5c49,_0x5a2135){_0x1e5c49=_0x1e5c49-0x0;var _0x11a8cd=_0xef69[_0x1e5c49];return _0x11a8cd;};'use strict';var _=require(_0x9ef6('0x0'));var util=require(_0x9ef6('0x1'));var logger=require('../../config/logger')(_0x9ef6('0x2'));var moment=require('moment');var BPromise=require(_0x9ef6('0x3'));var rp=require(_0x9ef6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ef6('0x5'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module['exports']=function(_0x579e29,_0x42696d){return _0x579e29['define'](_0x9ef6('0x6'),attributes,{'tableName':_0x9ef6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 99d62a6..065b8b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3b2c=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','ShowSound','find','options','raw','where','attributes','include','map','model','lodash','bluebird','ioredis','../../mysqldb'];(function(_0x420e65,_0x2f88cc){var _0x45dad7=function(_0x26f24d){while(--_0x26f24d){_0x420e65['push'](_0x420e65['shift']());}};_0x45dad7(++_0x2f88cc);}(_0x3b2c,0xb0));var _0xc3b2=function(_0x72d51c,_0x5d817d){_0x72d51c=_0x72d51c-0x0;var _0x5bf3e0=_0x3b2c[_0x72d51c];return _0x5bf3e0;};'use strict';var _=require(_0xc3b2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc3b2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3b2('0x2'));var db=require(_0xc3b2('0x3'))['db'];var utils=require(_0xc3b2('0x4'));var logger=require(_0xc3b2('0x5'))(_0xc3b2('0x6'));var config=require(_0xc3b2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc3b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf694d8,_0x48e6e2,_0x379994){return new BPromise(function(_0x10002b,_0x32a8a2){return client[_0xc3b2('0x9')](_0xf694d8,_0x379994)[_0xc3b2('0xa')](function(_0x53993c){logger['info'](_0xc3b2('0xb'),_0x48e6e2,'request\x20sent');logger[_0xc3b2('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x48e6e2,_0xc3b2('0xd'),JSON[_0xc3b2('0xe')](_0x53993c));if(_0x53993c[_0xc3b2('0xf')]){if(_0x53993c[_0xc3b2('0xf')][_0xc3b2('0x10')]===0x1f4){logger[_0xc3b2('0xf')](_0xc3b2('0xb'),_0x48e6e2,_0x53993c[_0xc3b2('0xf')]['message']);return _0x32a8a2(_0x53993c['error'][_0xc3b2('0x11')]);}logger['error'](_0xc3b2('0xb'),_0x48e6e2,_0x53993c[_0xc3b2('0xf')]['message']);return _0x10002b(_0x53993c[_0xc3b2('0xf')][_0xc3b2('0x11')]);}else{logger[_0xc3b2('0x12')]('Sound,\x20%s,\x20%s',_0x48e6e2,_0xc3b2('0xd'));_0x10002b(_0x53993c[_0xc3b2('0x13')][_0xc3b2('0x11')]);}})[_0xc3b2('0x14')](function(_0x5ebc34){logger[_0xc3b2('0xf')]('Sound,\x20%s,\x20%s',_0x48e6e2,_0x5ebc34);_0x32a8a2(_0x5ebc34);});});}exports[_0xc3b2('0x15')]=function(_0x256ae8){var _0x4416a5=this;return new Promise(function(_0x4f078f,_0x5a3f96){return db['Sound'][_0xc3b2('0x16')]({'raw':_0x256ae8[_0xc3b2('0x17')]?_0x256ae8[_0xc3b2('0x17')][_0xc3b2('0x18')]===undefined?!![]:![]:!![],'where':_0x256ae8['options']?_0x256ae8[_0xc3b2('0x17')][_0xc3b2('0x19')]||null:null,'attributes':_0x256ae8[_0xc3b2('0x17')]?_0x256ae8[_0xc3b2('0x17')][_0xc3b2('0x1a')]||null:null,'include':_0x256ae8['options']?_0x256ae8[_0xc3b2('0x17')][_0xc3b2('0x1b')]?_[_0xc3b2('0x1c')](_0x256ae8[_0xc3b2('0x17')][_0xc3b2('0x1b')],function(_0x249f4f){return{'model':db[_0x249f4f[_0xc3b2('0x1d')]],'as':_0x249f4f['as'],'attributes':_0x249f4f[_0xc3b2('0x1a')],'include':_0x249f4f['include']?_[_0xc3b2('0x1c')](_0x249f4f['include'],function(_0xda8116){return{'model':db[_0xda8116['model']],'as':_0xda8116['as'],'attributes':_0xda8116[_0xc3b2('0x1a')],'include':_0xda8116[_0xc3b2('0x1b')]?_[_0xc3b2('0x1c')](_0xda8116[_0xc3b2('0x1b')],function(_0xf2a7e3){return{'model':db[_0xf2a7e3[_0xc3b2('0x1d')]],'as':_0xf2a7e3['as'],'attributes':_0xf2a7e3[_0xc3b2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc3b2('0xa')](function(_0x431d33){logger['info'](_0xc3b2('0x15'),_0x256ae8);logger['debug']('ShowSound',_0x256ae8,JSON[_0xc3b2('0xe')](_0x431d33));_0x4f078f(_0x431d33);})[_0xc3b2('0x14')](function(_0x3d632c){logger['error'](_0xc3b2('0x15'),_0x3d632c['message'],_0x256ae8);_0x5a3f96(_0x4416a5[_0xc3b2('0xf')](0x1f4,_0x3d632c[_0xc3b2('0x11')]));});});};
\ No newline at end of file
+var _0xac99=['model','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ShowSound','find','options','attributes','include','map'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xac99,0x140));var _0x9ac9=function(_0x598b78,_0xf4ee7e){_0x598b78=_0x598b78-0x0;var _0x6392fa=_0xac99[_0x598b78];return _0x6392fa;};'use strict';var _=require(_0x9ac9('0x0'));var util=require(_0x9ac9('0x1'));var moment=require('moment');var BPromise=require(_0x9ac9('0x2'));var rs=require(_0x9ac9('0x3'));var fs=require('fs');var Redis=require(_0x9ac9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ac9('0x5'));var logger=require(_0x9ac9('0x6'))('rpc');var config=require(_0x9ac9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9ac9('0x8')][_0x9ac9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a1eb1,_0x1049a3,_0xc6123){return new BPromise(function(_0x394659,_0x3c5ce1){return client[_0x9ac9('0xa')](_0x3a1eb1,_0xc6123)[_0x9ac9('0xb')](function(_0x712c8f){logger['info'](_0x9ac9('0xc'),_0x1049a3,_0x9ac9('0xd'));logger[_0x9ac9('0xe')](_0x9ac9('0xf'),_0x1049a3,_0x9ac9('0xd'),JSON[_0x9ac9('0x10')](_0x712c8f));if(_0x712c8f['error']){if(_0x712c8f[_0x9ac9('0x11')][_0x9ac9('0x12')]===0x1f4){logger[_0x9ac9('0x11')]('Sound,\x20%s,\x20%s',_0x1049a3,_0x712c8f['error'][_0x9ac9('0x13')]);return _0x3c5ce1(_0x712c8f[_0x9ac9('0x11')]['message']);}logger[_0x9ac9('0x11')](_0x9ac9('0xc'),_0x1049a3,_0x712c8f[_0x9ac9('0x11')][_0x9ac9('0x13')]);return _0x394659(_0x712c8f[_0x9ac9('0x11')]['message']);}else{logger[_0x9ac9('0x14')](_0x9ac9('0xc'),_0x1049a3,_0x9ac9('0xd'));_0x394659(_0x712c8f['result']['message']);}})[_0x9ac9('0x15')](function(_0x156468){logger[_0x9ac9('0x11')](_0x9ac9('0xc'),_0x1049a3,_0x156468);_0x3c5ce1(_0x156468);});});}exports[_0x9ac9('0x16')]=function(_0x5604ee){var _0x31ff32=this;return new Promise(function(_0x5000fd,_0x18d236){return db['Sound'][_0x9ac9('0x17')]({'raw':_0x5604ee['options']?_0x5604ee[_0x9ac9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5604ee[_0x9ac9('0x18')]?_0x5604ee[_0x9ac9('0x18')]['where']||null:null,'attributes':_0x5604ee[_0x9ac9('0x18')]?_0x5604ee[_0x9ac9('0x18')][_0x9ac9('0x19')]||null:null,'include':_0x5604ee['options']?_0x5604ee[_0x9ac9('0x18')][_0x9ac9('0x1a')]?_[_0x9ac9('0x1b')](_0x5604ee['options'][_0x9ac9('0x1a')],function(_0x2838b4){return{'model':db[_0x2838b4['model']],'as':_0x2838b4['as'],'attributes':_0x2838b4[_0x9ac9('0x19')],'include':_0x2838b4[_0x9ac9('0x1a')]?_[_0x9ac9('0x1b')](_0x2838b4[_0x9ac9('0x1a')],function(_0x1903ab){return{'model':db[_0x1903ab[_0x9ac9('0x1c')]],'as':_0x1903ab['as'],'attributes':_0x1903ab[_0x9ac9('0x19')],'include':_0x1903ab[_0x9ac9('0x1a')]?_['map'](_0x1903ab[_0x9ac9('0x1a')],function(_0x46298d){return{'model':db[_0x46298d['model']],'as':_0x46298d['as'],'attributes':_0x46298d[_0x9ac9('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46b7df){logger['info'](_0x9ac9('0x16'),_0x5604ee);logger[_0x9ac9('0xe')](_0x9ac9('0x16'),_0x5604ee,JSON[_0x9ac9('0x10')](_0x46b7df));_0x5000fd(_0x46b7df);})[_0x9ac9('0x15')](function(_0x1448d9){logger[_0x9ac9('0x11')](_0x9ac9('0x16'),_0x1448d9[_0x9ac9('0x13')],_0x5604ee);_0x18d236(_0x31ff32[_0x9ac9('0x11')](0x1f4,_0x1448d9[_0x9ac9('0x13')]));});});};
\ No newline at end of file
index bba9b82..4a28dce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2f504c,_0x5b45cd){var _0x2416f6=function(_0x3900fc){while(--_0x3900fc){_0x2f504c['push'](_0x2f504c['shift']());}};_0x2416f6(++_0x5b45cd);}(_0xb10b,0x12a));var _0xbb10=function(_0x11fb3e,_0x56d153){_0x11fb3e=_0x11fb3e-0x0;var _0x50ebf6=_0xb10b[_0x11fb3e];return _0x50ebf6;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router;
\ No newline at end of file
+var _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x422be7,_0x794f8e){var _0x51955b=function(_0x3b388e){while(--_0x3b388e){_0x422be7['push'](_0x422be7['shift']());}};_0x51955b(++_0x794f8e);}(_0xac4a,0x13f));var _0xaac4=function(_0x162a13,_0x2a4b4){_0x162a13=_0x162a13-0x0;var _0x4bf0c7=_0xac4a[_0x162a13];return _0x4bf0c7;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router;
\ No newline at end of file
index 4a4ea8d..a16c33f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4556=['TEXT','medium','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4556,0x168));var _0x6455=function(_0x3cf315,_0x576839){_0x3cf315=_0x3cf315-0x0;var _0x3f751d=_0x4556[_0x3cf315];return _0x3f751d;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x6455('0x0')](_0x6455('0x1')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6455('0x2')),'defaultValue':_0x6455('0x2'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6455('0x0')]}};
\ No newline at end of file
+var _0xfdd3=['sequelize','exports','STRING','TEXT','medium','ENUM','out'];(function(_0xfc2be1,_0x356d36){var _0x594eb9=function(_0x12887b){while(--_0x12887b){_0xfc2be1['push'](_0xfc2be1['shift']());}};_0x594eb9(++_0x356d36);}(_0xfdd3,0x196));var _0x3fdd=function(_0x581cc7,_0x30ec57){_0x581cc7=_0x581cc7-0x0;var _0x4867c7=_0xfdd3[_0x581cc7];return _0x4867c7;};'use strict';var Sequelize=require(_0x3fdd('0x0'));module[_0x3fdd('0x1')]={'uniqueid':{'type':Sequelize[_0x3fdd('0x2')]},'body':{'type':Sequelize[_0x3fdd('0x3')](_0x3fdd('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x3fdd('0x5')]('in',_0x3fdd('0x6')),'defaultValue':_0x3fdd('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x3fdd('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}};
\ No newline at end of file
index 49802eb..41e948a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4ff=['limit','count','set','Content-Range','json','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','SquareMessage','includeAll','include','findAll','rows','show','options','create','catch','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined'];(function(_0x5bb17b,_0x131109){var _0x558f09=function(_0x524e9b){while(--_0x524e9b){_0x5bb17b['push'](_0x5bb17b['shift']());}};_0x558f09(++_0x131109);}(_0xc4ff,0x111));var _0xfc4f=function(_0x3748dd,_0x8c08eb){_0x3748dd=_0x3748dd-0x0;var _0x4b4a37=_0xc4ff[_0x3748dd];return _0x4b4a37;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc4f('0x0'));var zipdir=require(_0xfc4f('0x1'));var jsonpatch=require(_0xfc4f('0x2'));var rp=require(_0xfc4f('0x3'));var moment=require(_0xfc4f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfc4f('0x5'));var util=require(_0xfc4f('0x6'));var path=require(_0xfc4f('0x7'));var sox=require(_0xfc4f('0x8'));var csv=require(_0xfc4f('0x9'));var ejs=require(_0xfc4f('0xa'));var fs=require('fs');var fs_extra=require(_0xfc4f('0xb'));var _=require(_0xfc4f('0xc'));var squel=require(_0xfc4f('0xd'));var crypto=require(_0xfc4f('0xe'));var jsforce=require(_0xfc4f('0xf'));var deskjs=require(_0xfc4f('0x10'));var toCsv=require(_0xfc4f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfc4f('0x11'));var authService=require(_0xfc4f('0x12'));var qs=require(_0xfc4f('0x13'));var as=require(_0xfc4f('0x14'));var hardwareService=require(_0xfc4f('0x15'));var logger=require(_0xfc4f('0x16'))('api');var utils=require(_0xfc4f('0x17'));var config=require(_0xfc4f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfc4f('0x19'))['db'];function respondWithStatusCode(_0x19037f,_0x17efbd){_0x17efbd=_0x17efbd||0xcc;return function(_0x4aa36b){if(_0x4aa36b){return _0x19037f[_0xfc4f('0x1a')](_0x17efbd);}return _0x19037f['status'](_0x17efbd)[_0xfc4f('0x1b')]();};}function respondWithResult(_0x27c7c1,_0x4830b6){_0x4830b6=_0x4830b6||0xc8;return function(_0x140f88){if(_0x140f88){return _0x27c7c1[_0xfc4f('0x1c')](_0x4830b6)['json'](_0x140f88);}};}function respondWithFilteredResult(_0x2bef8c,_0x2912e9){return function(_0x3ab5c6){if(_0x3ab5c6){var _0x3ebc1f=typeof _0x2912e9[_0xfc4f('0x1d')]===_0xfc4f('0x1e')&&typeof _0x2912e9[_0xfc4f('0x1f')]===_0xfc4f('0x1e');var _0x4b3bd5=_0x3ab5c6[_0xfc4f('0x20')];var _0x1323f7=_0x3ebc1f?0x0:_0x2912e9[_0xfc4f('0x1d')];var _0x3b0917=_0x3ebc1f?_0x3ab5c6['count']:_0x2912e9[_0xfc4f('0x1d')]+_0x2912e9[_0xfc4f('0x1f')];var _0x59e257;if(_0x3b0917>=_0x4b3bd5){_0x3b0917=_0x4b3bd5;_0x59e257=0xc8;}else{_0x59e257=0xce;}_0x2bef8c[_0xfc4f('0x1c')](_0x59e257);return _0x2bef8c[_0xfc4f('0x21')](_0xfc4f('0x22'),_0x1323f7+'-'+_0x3b0917+'/'+_0x4b3bd5)[_0xfc4f('0x23')](_0x3ab5c6);}return null;};}function patchUpdates(_0x372bd1){return function(_0x49365d){try{jsonpatch['apply'](_0x49365d,_0x372bd1,!![]);}catch(_0x2f01bd){return BPromise['reject'](_0x2f01bd);}return _0x49365d[_0xfc4f('0x24')]();};}function saveUpdates(_0x56426a,_0x8532f2){return function(_0x1d343f){if(_0x1d343f){return _0x1d343f[_0xfc4f('0x25')](_0x56426a)[_0xfc4f('0x26')](function(_0x366b03){return _0x366b03;});}return null;};}function removeEntity(_0x42cabb,_0x3d70ad){return function(_0x49db71){if(_0x49db71){return _0x49db71[_0xfc4f('0x27')]()['then'](function(){_0x42cabb['status'](0xcc)[_0xfc4f('0x1b')]();});}};}function handleEntityNotFound(_0x37e78c,_0x43ea16){return function(_0x59dd29){if(!_0x59dd29){_0x37e78c[_0xfc4f('0x1a')](0x194);}return _0x59dd29;};}function handleError(_0x9dec4c,_0x1c849c){_0x1c849c=_0x1c849c||0x1f4;return function(_0xdb45e){logger['error'](_0xdb45e[_0xfc4f('0x28')]);if(_0xdb45e[_0xfc4f('0x29')]){delete _0xdb45e[_0xfc4f('0x29')];}_0x9dec4c[_0xfc4f('0x1c')](_0x1c849c)[_0xfc4f('0x2a')](_0xdb45e);};}exports[_0xfc4f('0x2b')]=function(_0x20b905,_0x24a8e1){var _0x4e96d9={},_0x20b0e9={},_0x3a4fc5={'count':0x0,'rows':[]};var _0x16f191=_[_0xfc4f('0x2c')](db['SquareMessage'][_0xfc4f('0x2d')],function(_0x59a9d7){return{'name':_0x59a9d7[_0xfc4f('0x2e')],'type':_0x59a9d7[_0xfc4f('0x2f')]['key']};});_0x20b0e9['model']=_[_0xfc4f('0x2c')](_0x16f191,'name');_0x20b0e9[_0xfc4f('0x30')]=_[_0xfc4f('0x31')](_0x20b905['query']);_0x20b0e9['filters']=_[_0xfc4f('0x32')](_0x20b0e9[_0xfc4f('0x33')],_0x20b0e9['query']);_0x4e96d9[_0xfc4f('0x34')]=_[_0xfc4f('0x32')](_0x20b0e9[_0xfc4f('0x33')],qs[_0xfc4f('0x35')](_0x20b905['query'][_0xfc4f('0x35')]));_0x4e96d9[_0xfc4f('0x34')]=_0x4e96d9[_0xfc4f('0x34')][_0xfc4f('0x36')]?_0x4e96d9['attributes']:_0x20b0e9[_0xfc4f('0x33')];if(!_0x20b905[_0xfc4f('0x30')][_0xfc4f('0x37')](_0xfc4f('0x38'))){_0x4e96d9[_0xfc4f('0x1f')]=qs['limit'](_0x20b905[_0xfc4f('0x30')]['limit']);_0x4e96d9[_0xfc4f('0x1d')]=qs[_0xfc4f('0x1d')](_0x20b905[_0xfc4f('0x30')]['offset']);}_0x4e96d9[_0xfc4f('0x39')]=qs[_0xfc4f('0x3a')](_0x20b905[_0xfc4f('0x30')][_0xfc4f('0x3a')]);_0x4e96d9[_0xfc4f('0x3b')]=qs[_0xfc4f('0x3c')](_[_0xfc4f('0x3d')](_0x20b905[_0xfc4f('0x30')],_0x20b0e9['filters']),_0x16f191);if(_0x20b905[_0xfc4f('0x30')][_0xfc4f('0x3e')]){_0x4e96d9[_0xfc4f('0x3b')]=_[_0xfc4f('0x3f')](_0x4e96d9[_0xfc4f('0x3b')],{'$or':_[_0xfc4f('0x2c')](_0x16f191,function(_0x4a1342){if(_0x4a1342[_0xfc4f('0x2f')]!==_0xfc4f('0x40')){var _0x1135c3={};_0x1135c3[_0x4a1342[_0xfc4f('0x29')]]={'$like':'%'+_0x20b905[_0xfc4f('0x30')][_0xfc4f('0x3e')]+'%'};return _0x1135c3;}})});}_0x4e96d9=_['merge']({},_0x4e96d9,_0x20b905['options']);var _0x4699aa={'where':_0x4e96d9[_0xfc4f('0x3b')]};return db[_0xfc4f('0x41')]['count'](_0x4699aa)[_0xfc4f('0x26')](function(_0x17c1ed){_0x3a4fc5[_0xfc4f('0x20')]=_0x17c1ed;if(_0x20b905[_0xfc4f('0x30')][_0xfc4f('0x42')]){_0x4e96d9[_0xfc4f('0x43')]=[{'all':!![]}];}return db['SquareMessage'][_0xfc4f('0x44')](_0x4e96d9);})['then'](function(_0x1fbc97){_0x3a4fc5[_0xfc4f('0x45')]=_0x1fbc97;return _0x3a4fc5;})[_0xfc4f('0x26')](respondWithFilteredResult(_0x24a8e1,_0x4e96d9))['catch'](handleError(_0x24a8e1,null));};exports[_0xfc4f('0x46')]=function(_0x59aa50,_0x1d4d40){var _0x12beba={'raw':!![],'where':{'id':_0x59aa50['params']['id']}},_0x8dda66={};_0x8dda66[_0xfc4f('0x33')]=_[_0xfc4f('0x31')](db[_0xfc4f('0x41')][_0xfc4f('0x2d')]);_0x8dda66['query']=_['keys'](_0x59aa50[_0xfc4f('0x30')]);_0x8dda66[_0xfc4f('0x3c')]=_[_0xfc4f('0x32')](_0x8dda66['model'],_0x8dda66[_0xfc4f('0x30')]);_0x12beba[_0xfc4f('0x34')]=_[_0xfc4f('0x32')](_0x8dda66[_0xfc4f('0x33')],qs[_0xfc4f('0x35')](_0x59aa50[_0xfc4f('0x30')][_0xfc4f('0x35')]));_0x12beba[_0xfc4f('0x34')]=_0x12beba[_0xfc4f('0x34')][_0xfc4f('0x36')]?_0x12beba[_0xfc4f('0x34')]:_0x8dda66[_0xfc4f('0x33')];if(_0x59aa50[_0xfc4f('0x30')][_0xfc4f('0x42')]){_0x12beba[_0xfc4f('0x43')]=[{'all':!![]}];}_0x12beba=_[_0xfc4f('0x3f')]({},_0x12beba,_0x59aa50[_0xfc4f('0x47')]);return db[_0xfc4f('0x41')]['find'](_0x12beba)[_0xfc4f('0x26')](handleEntityNotFound(_0x1d4d40,null))['then'](respondWithResult(_0x1d4d40,null))['catch'](handleError(_0x1d4d40,null));};exports[_0xfc4f('0x48')]=function(_0x5c7909,_0x770b6e){return db[_0xfc4f('0x41')][_0xfc4f('0x48')](_0x5c7909['body'],{})[_0xfc4f('0x26')](respondWithResult(_0x770b6e,0xc9))[_0xfc4f('0x49')](handleError(_0x770b6e,null));};exports['update']=function(_0x425be8,_0x4288e8){if(_0x425be8['body']['id']){delete _0x425be8['body']['id'];}return db[_0xfc4f('0x41')][_0xfc4f('0x4a')]({'where':{'id':_0x425be8[_0xfc4f('0x4b')]['id']}})[_0xfc4f('0x26')](handleEntityNotFound(_0x4288e8,null))[_0xfc4f('0x26')](saveUpdates(_0x425be8['body'],null))[_0xfc4f('0x26')](respondWithResult(_0x4288e8,null))['catch'](handleError(_0x4288e8,null));};exports[_0xfc4f('0x27')]=function(_0x2ae72c,_0x21c97b){return db['SquareMessage'][_0xfc4f('0x4a')]({'where':{'id':_0x2ae72c['params']['id']}})[_0xfc4f('0x26')](handleEntityNotFound(_0x21c97b,null))['then'](removeEntity(_0x21c97b,null))[_0xfc4f('0x49')](handleError(_0x21c97b,null));};
\ No newline at end of file
+var _0xa521=['where','pick','filter','type','merge','includeAll','rows','show','params','keys','include','options','create','catch','body','find','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','SquareMessage','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa521,0xeb));var _0x1a52=function(_0x133bd1,_0x36e116){_0x133bd1=_0x133bd1-0x0;var _0x250be1=_0xa521[_0x133bd1];return _0x250be1;};'use strict';var emlformat=require(_0x1a52('0x0'));var rimraf=require(_0x1a52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1a52('0x2'));var moment=require(_0x1a52('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1a52('0x4'));var util=require(_0x1a52('0x5'));var path=require(_0x1a52('0x6'));var sox=require(_0x1a52('0x7'));var csv=require(_0x1a52('0x8'));var ejs=require(_0x1a52('0x9'));var fs=require('fs');var fs_extra=require(_0x1a52('0xa'));var _=require(_0x1a52('0xb'));var squel=require(_0x1a52('0xc'));var crypto=require(_0x1a52('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a52('0xe'));var Redis=require('ioredis');var authService=require(_0x1a52('0xf'));var qs=require(_0x1a52('0x10'));var as=require(_0x1a52('0x11'));var hardwareService=require(_0x1a52('0x12'));var logger=require('../../config/logger')(_0x1a52('0x13'));var utils=require('../../config/utils');var config=require(_0x1a52('0x14'));var licenseUtil=require(_0x1a52('0x15'));var db=require(_0x1a52('0x16'))['db'];function respondWithStatusCode(_0xbc8a53,_0x51d510){_0x51d510=_0x51d510||0xcc;return function(_0x179372){if(_0x179372){return _0xbc8a53[_0x1a52('0x17')](_0x51d510);}return _0xbc8a53[_0x1a52('0x18')](_0x51d510)[_0x1a52('0x19')]();};}function respondWithResult(_0x20e56e,_0x4fb67f){_0x4fb67f=_0x4fb67f||0xc8;return function(_0x50c17a){if(_0x50c17a){return _0x20e56e['status'](_0x4fb67f)['json'](_0x50c17a);}};}function respondWithFilteredResult(_0x1f7fca,_0x438ac5){return function(_0x428a94){if(_0x428a94){var _0x280bb2=typeof _0x438ac5['offset']===_0x1a52('0x1a')&&typeof _0x438ac5[_0x1a52('0x1b')]===_0x1a52('0x1a');var _0x1ac9bc=_0x428a94[_0x1a52('0x1c')];var _0x3194aa=_0x280bb2?0x0:_0x438ac5[_0x1a52('0x1d')];var _0x1236e9=_0x280bb2?_0x428a94[_0x1a52('0x1c')]:_0x438ac5[_0x1a52('0x1d')]+_0x438ac5[_0x1a52('0x1b')];var _0x5cd356;if(_0x1236e9>=_0x1ac9bc){_0x1236e9=_0x1ac9bc;_0x5cd356=0xc8;}else{_0x5cd356=0xce;}_0x1f7fca['status'](_0x5cd356);return _0x1f7fca[_0x1a52('0x1e')](_0x1a52('0x1f'),_0x3194aa+'-'+_0x1236e9+'/'+_0x1ac9bc)[_0x1a52('0x20')](_0x428a94);}return null;};}function patchUpdates(_0x59db0a){return function(_0x5b771e){try{jsonpatch[_0x1a52('0x21')](_0x5b771e,_0x59db0a,!![]);}catch(_0x30ee55){return BPromise[_0x1a52('0x22')](_0x30ee55);}return _0x5b771e['save']();};}function saveUpdates(_0x5835f8,_0x224b8d){return function(_0x4e117f){if(_0x4e117f){return _0x4e117f[_0x1a52('0x23')](_0x5835f8)[_0x1a52('0x24')](function(_0x111d97){return _0x111d97;});}return null;};}function removeEntity(_0x20d574,_0xdffd26){return function(_0x250f43){if(_0x250f43){return _0x250f43[_0x1a52('0x25')]()['then'](function(){_0x20d574[_0x1a52('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27ce04,_0xcfe472){return function(_0x499a0){if(!_0x499a0){_0x27ce04[_0x1a52('0x17')](0x194);}return _0x499a0;};}function handleError(_0x3cfe8e,_0x37f70a){_0x37f70a=_0x37f70a||0x1f4;return function(_0x5bac57){logger[_0x1a52('0x26')](_0x5bac57[_0x1a52('0x27')]);if(_0x5bac57[_0x1a52('0x28')]){delete _0x5bac57[_0x1a52('0x28')];}_0x3cfe8e['status'](_0x37f70a)[_0x1a52('0x29')](_0x5bac57);};}exports[_0x1a52('0x2a')]=function(_0x2ea2ff,_0x4fd599){var _0x378ad8={},_0x48fe17={},_0x4c28e6={'count':0x0,'rows':[]};var _0x5c2c90=_[_0x1a52('0x2b')](db[_0x1a52('0x2c')]['rawAttributes'],function(_0x49f116){return{'name':_0x49f116[_0x1a52('0x2d')],'type':_0x49f116['type'][_0x1a52('0x2e')]};});_0x48fe17[_0x1a52('0x2f')]=_[_0x1a52('0x2b')](_0x5c2c90,_0x1a52('0x28'));_0x48fe17[_0x1a52('0x30')]=_['keys'](_0x2ea2ff[_0x1a52('0x30')]);_0x48fe17[_0x1a52('0x31')]=_[_0x1a52('0x32')](_0x48fe17[_0x1a52('0x2f')],_0x48fe17['query']);_0x378ad8[_0x1a52('0x33')]=_[_0x1a52('0x32')](_0x48fe17['model'],qs['fields'](_0x2ea2ff[_0x1a52('0x30')][_0x1a52('0x34')]));_0x378ad8[_0x1a52('0x33')]=_0x378ad8[_0x1a52('0x33')][_0x1a52('0x35')]?_0x378ad8[_0x1a52('0x33')]:_0x48fe17[_0x1a52('0x2f')];if(!_0x2ea2ff[_0x1a52('0x30')][_0x1a52('0x36')](_0x1a52('0x37'))){_0x378ad8['limit']=qs[_0x1a52('0x1b')](_0x2ea2ff[_0x1a52('0x30')]['limit']);_0x378ad8[_0x1a52('0x1d')]=qs[_0x1a52('0x1d')](_0x2ea2ff['query']['offset']);}_0x378ad8['order']=qs[_0x1a52('0x38')](_0x2ea2ff[_0x1a52('0x30')]['sort']);_0x378ad8[_0x1a52('0x39')]=qs[_0x1a52('0x31')](_[_0x1a52('0x3a')](_0x2ea2ff[_0x1a52('0x30')],_0x48fe17[_0x1a52('0x31')]),_0x5c2c90);if(_0x2ea2ff['query'][_0x1a52('0x3b')]){_0x378ad8[_0x1a52('0x39')]=_['merge'](_0x378ad8[_0x1a52('0x39')],{'$or':_[_0x1a52('0x2b')](_0x5c2c90,function(_0x14d7cc){if(_0x14d7cc[_0x1a52('0x3c')]!=='VIRTUAL'){var _0x18e39a={};_0x18e39a[_0x14d7cc[_0x1a52('0x28')]]={'$like':'%'+_0x2ea2ff[_0x1a52('0x30')][_0x1a52('0x3b')]+'%'};return _0x18e39a;}})});}_0x378ad8=_[_0x1a52('0x3d')]({},_0x378ad8,_0x2ea2ff['options']);var _0x2df2f5={'where':_0x378ad8[_0x1a52('0x39')]};return db[_0x1a52('0x2c')][_0x1a52('0x1c')](_0x2df2f5)['then'](function(_0x3bb968){_0x4c28e6[_0x1a52('0x1c')]=_0x3bb968;if(_0x2ea2ff[_0x1a52('0x30')][_0x1a52('0x3e')]){_0x378ad8['include']=[{'all':!![]}];}return db[_0x1a52('0x2c')]['findAll'](_0x378ad8);})['then'](function(_0xd4fd80){_0x4c28e6[_0x1a52('0x3f')]=_0xd4fd80;return _0x4c28e6;})['then'](respondWithFilteredResult(_0x4fd599,_0x378ad8))['catch'](handleError(_0x4fd599,null));};exports[_0x1a52('0x40')]=function(_0x3487f9,_0x490d7b){var _0x8e011d={'raw':!![],'where':{'id':_0x3487f9[_0x1a52('0x41')]['id']}},_0x5a4acb={};_0x5a4acb[_0x1a52('0x2f')]=_[_0x1a52('0x42')](db[_0x1a52('0x2c')]['rawAttributes']);_0x5a4acb['query']=_[_0x1a52('0x42')](_0x3487f9[_0x1a52('0x30')]);_0x5a4acb[_0x1a52('0x31')]=_['intersection'](_0x5a4acb['model'],_0x5a4acb[_0x1a52('0x30')]);_0x8e011d[_0x1a52('0x33')]=_[_0x1a52('0x32')](_0x5a4acb[_0x1a52('0x2f')],qs[_0x1a52('0x34')](_0x3487f9[_0x1a52('0x30')][_0x1a52('0x34')]));_0x8e011d[_0x1a52('0x33')]=_0x8e011d[_0x1a52('0x33')][_0x1a52('0x35')]?_0x8e011d[_0x1a52('0x33')]:_0x5a4acb[_0x1a52('0x2f')];if(_0x3487f9[_0x1a52('0x30')]['includeAll']){_0x8e011d[_0x1a52('0x43')]=[{'all':!![]}];}_0x8e011d=_[_0x1a52('0x3d')]({},_0x8e011d,_0x3487f9[_0x1a52('0x44')]);return db[_0x1a52('0x2c')]['find'](_0x8e011d)['then'](handleEntityNotFound(_0x490d7b,null))[_0x1a52('0x24')](respondWithResult(_0x490d7b,null))['catch'](handleError(_0x490d7b,null));};exports[_0x1a52('0x45')]=function(_0x4c3751,_0x42e52f){return db[_0x1a52('0x2c')][_0x1a52('0x45')](_0x4c3751['body'],{})[_0x1a52('0x24')](respondWithResult(_0x42e52f,0xc9))[_0x1a52('0x46')](handleError(_0x42e52f,null));};exports[_0x1a52('0x23')]=function(_0x509f39,_0x51c6ae){if(_0x509f39['body']['id']){delete _0x509f39[_0x1a52('0x47')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x509f39[_0x1a52('0x41')]['id']}})['then'](handleEntityNotFound(_0x51c6ae,null))[_0x1a52('0x24')](saveUpdates(_0x509f39[_0x1a52('0x47')],null))[_0x1a52('0x24')](respondWithResult(_0x51c6ae,null))[_0x1a52('0x46')](handleError(_0x51c6ae,null));};exports[_0x1a52('0x25')]=function(_0x14419c,_0x138319){return db['SquareMessage'][_0x1a52('0x48')]({'where':{'id':_0x14419c[_0x1a52('0x41')]['id']}})[_0x1a52('0x24')](handleEntityNotFound(_0x138319,null))[_0x1a52('0x24')](removeEntity(_0x138319,null))[_0x1a52('0x46')](handleError(_0x138319,null));};
\ No newline at end of file
index b007870..e3f0374 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x615c=['exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes'];(function(_0x21a9cf,_0x51f954){var _0x5d4ba7=function(_0x18d186){while(--_0x18d186){_0x21a9cf['push'](_0x21a9cf['shift']());}};_0x5d4ba7(++_0x51f954);}(_0x615c,0x1b6));var _0xc615=function(_0x1b9d41,_0xd4009d){_0x1b9d41=_0x1b9d41-0x0;var _0x38ec46=_0x615c[_0x1b9d41];return _0x38ec46;};'use strict';var _=require(_0xc615('0x0'));var util=require(_0xc615('0x1'));var logger=require(_0xc615('0x2'))(_0xc615('0x3'));var moment=require(_0xc615('0x4'));var BPromise=require('bluebird');var rp=require(_0xc615('0x5'));var fs=require('fs');var path=require(_0xc615('0x6'));var rimraf=require(_0xc615('0x7'));var config=require(_0xc615('0x8'));var attributes=require(_0xc615('0x9'));module[_0xc615('0xa')]=function(_0x460fed,_0xee7aad){return _0x460fed[_0xc615('0xb')](_0xc615('0xc'),attributes,{'tableName':_0xc615('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x595c=['define','SquareMessage','square_messages','api','moment','bluebird','path','../../config/environment','./squareMessage.attributes','exports'];(function(_0x1551bc,_0x334b59){var _0x228deb=function(_0x15551d){while(--_0x15551d){_0x1551bc['push'](_0x1551bc['shift']());}};_0x228deb(++_0x334b59);}(_0x595c,0x1e3));var _0xc595=function(_0x20929f,_0x586539){_0x20929f=_0x20929f-0x0;var _0x53f802=_0x595c[_0x20929f];return _0x53f802;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc595('0x0'));var moment=require(_0xc595('0x1'));var BPromise=require(_0xc595('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc595('0x3'));var rimraf=require('rimraf');var config=require(_0xc595('0x4'));var attributes=require(_0xc595('0x5'));module[_0xc595('0x6')]=function(_0x3d4b5b,_0x1390a7){return _0x3d4b5b[_0xc595('0x7')](_0xc595('0x8'),attributes,{'tableName':_0xc595('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index e275748..9a49011 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb37d=['catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb37d,0x1b0));var _0xdb37=function(_0x3c8e23,_0x24ff4a){_0x3c8e23=_0x3c8e23-0x0;var _0xe4dfca=_0xb37d[_0x3c8e23];return _0xe4dfca;};'use strict';var _=require(_0xdb37('0x0'));var util=require(_0xdb37('0x1'));var moment=require('moment');var BPromise=require(_0xdb37('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb37('0x3'))['db'];var utils=require(_0xdb37('0x4'));var logger=require('../../config/logger')(_0xdb37('0x5'));var config=require(_0xdb37('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdb37('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43caae,_0xcc98fb,_0x25bf08){return new BPromise(function(_0x47da9a,_0x1e13bf){return client[_0xdb37('0x8')](_0x43caae,_0x25bf08)[_0xdb37('0x9')](function(_0x1a8a15){logger['info'](_0xdb37('0xa'),_0xcc98fb,_0xdb37('0xb'));logger[_0xdb37('0xc')](_0xdb37('0xd'),_0xcc98fb,_0xdb37('0xb'),JSON[_0xdb37('0xe')](_0x1a8a15));if(_0x1a8a15[_0xdb37('0xf')]){if(_0x1a8a15['error']['code']===0x1f4){logger[_0xdb37('0xf')](_0xdb37('0xa'),_0xcc98fb,_0x1a8a15[_0xdb37('0xf')][_0xdb37('0x10')]);return _0x1e13bf(_0x1a8a15['error'][_0xdb37('0x10')]);}logger[_0xdb37('0xf')](_0xdb37('0xa'),_0xcc98fb,_0x1a8a15[_0xdb37('0xf')][_0xdb37('0x10')]);return _0x47da9a(_0x1a8a15[_0xdb37('0xf')][_0xdb37('0x10')]);}else{logger[_0xdb37('0x11')]('SquareMessage,\x20%s,\x20%s',_0xcc98fb,_0xdb37('0xb'));_0x47da9a(_0x1a8a15['result'][_0xdb37('0x10')]);}})[_0xdb37('0x12')](function(_0xe2f6dc){logger['error'](_0xdb37('0xa'),_0xcc98fb,_0xe2f6dc);_0x1e13bf(_0xe2f6dc);});});}exports[_0xdb37('0x13')]=function(_0x34beb4){var _0x2343f8=this;return new Promise(function(_0xb6e4ea,_0xdb9d5e){return db[_0xdb37('0x14')][_0xdb37('0x15')](_0x34beb4[_0xdb37('0x16')],{'raw':_0x34beb4[_0xdb37('0x17')]?_0x34beb4[_0xdb37('0x17')][_0xdb37('0x18')]===undefined?!![]:![]:!![]})[_0xdb37('0x9')](function(_0x58573a){logger['info'](_0xdb37('0x13'),_0x34beb4);logger['debug'](_0xdb37('0x13'),_0x34beb4,JSON[_0xdb37('0xe')](_0x58573a));_0xb6e4ea(_0x58573a);})[_0xdb37('0x12')](function(_0x4d633e){logger[_0xdb37('0xf')](_0xdb37('0x13'),_0x4d633e[_0xdb37('0x10')],_0x34beb4);_0xdb9d5e(_0x2343f8[_0xdb37('0xf')](0x1f4,_0x4d633e[_0xdb37('0x10')]));});});};
\ No newline at end of file
+var _0xb5a0=['bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareMessage','body','options','raw','debug','lodash','util','moment'];(function(_0x2a513d,_0x5a5c02){var _0x21d13d=function(_0xb95817){while(--_0xb95817){_0x2a513d['push'](_0x2a513d['shift']());}};_0x21d13d(++_0x5a5c02);}(_0xb5a0,0x17d));var _0x0b5a=function(_0x610f42,_0x1d06ac){_0x610f42=_0x610f42-0x0;var _0x458e75=_0xb5a0[_0x610f42];return _0x458e75;};'use strict';var _=require(_0x0b5a('0x0'));var util=require(_0x0b5a('0x1'));var moment=require(_0x0b5a('0x2'));var BPromise=require(_0x0b5a('0x3'));var rs=require(_0x0b5a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0b5a('0x5'));var logger=require('../../config/logger')(_0x0b5a('0x6'));var config=require(_0x0b5a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0b5a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5589bd,_0x27d7d3,_0xb9fd6e){return new BPromise(function(_0x27d471,_0x56b6a4){return client[_0x0b5a('0x9')](_0x5589bd,_0xb9fd6e)[_0x0b5a('0xa')](function(_0x30a48a){logger[_0x0b5a('0xb')](_0x0b5a('0xc'),_0x27d7d3,_0x0b5a('0xd'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x27d7d3,'request\x20sent',JSON[_0x0b5a('0xe')](_0x30a48a));if(_0x30a48a[_0x0b5a('0xf')]){if(_0x30a48a[_0x0b5a('0xf')]['code']===0x1f4){logger[_0x0b5a('0xf')](_0x0b5a('0xc'),_0x27d7d3,_0x30a48a['error'][_0x0b5a('0x10')]);return _0x56b6a4(_0x30a48a[_0x0b5a('0xf')][_0x0b5a('0x10')]);}logger[_0x0b5a('0xf')]('SquareMessage,\x20%s,\x20%s',_0x27d7d3,_0x30a48a[_0x0b5a('0xf')][_0x0b5a('0x10')]);return _0x27d471(_0x30a48a[_0x0b5a('0xf')][_0x0b5a('0x10')]);}else{logger[_0x0b5a('0xb')](_0x0b5a('0xc'),_0x27d7d3,_0x0b5a('0xd'));_0x27d471(_0x30a48a[_0x0b5a('0x11')]['message']);}})[_0x0b5a('0x12')](function(_0x23d82f){logger[_0x0b5a('0xf')](_0x0b5a('0xc'),_0x27d7d3,_0x23d82f);_0x56b6a4(_0x23d82f);});});}exports[_0x0b5a('0x13')]=function(_0x2f8fed){var _0x2c5640=this;return new Promise(function(_0xc2c754,_0x4ebcb5){return db['SquareMessage']['create'](_0x2f8fed[_0x0b5a('0x14')],{'raw':_0x2f8fed['options']?_0x2f8fed[_0x0b5a('0x15')][_0x0b5a('0x16')]===undefined?!![]:![]:!![]})[_0x0b5a('0xa')](function(_0x293eb9){logger['info'](_0x0b5a('0x13'),_0x2f8fed);logger[_0x0b5a('0x17')](_0x0b5a('0x13'),_0x2f8fed,JSON[_0x0b5a('0xe')](_0x293eb9));_0xc2c754(_0x293eb9);})['catch'](function(_0x59370a){logger[_0x0b5a('0xf')]('CreateSquareMessage',_0x59370a['message'],_0x2f8fed);_0x4ebcb5(_0x2c5640[_0x0b5a('0xf')](0x1f4,_0x59370a[_0x0b5a('0x10')]));});});};
\ No newline at end of file
index 14db0c2..f00dbf8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x13cb=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','exports','multer','util','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x13cb,0x18d));var _0xb13c=function(_0x5c049a,_0x2c1263){_0x5c049a=_0x5c049a-0x0;var _0x168e70=_0x13cb[_0x5c049a];return _0x168e70;};'use strict';var multer=require(_0xb13c('0x0'));var util=require(_0xb13c('0x1'));var path=require(_0xb13c('0x2'));var timeout=require(_0xb13c('0x3'));var express=require(_0xb13c('0x4'));var router=express['Router']();var fs_extra=require(_0xb13c('0x5'));var auth=require(_0xb13c('0x6'));var interaction=require(_0xb13c('0x7'));var config=require('../../config/environment');var controller=require(_0xb13c('0x8'));router[_0xb13c('0x9')]('/',auth[_0xb13c('0xa')](),controller[_0xb13c('0xb')]);router[_0xb13c('0x9')](_0xb13c('0xc'),auth[_0xb13c('0xa')](),controller[_0xb13c('0xd')]);router['get'](_0xb13c('0xe'),auth[_0xb13c('0xa')](),timeout(_0xb13c('0xf')),controller[_0xb13c('0x10')]);router[_0xb13c('0x11')]('/',auth[_0xb13c('0xa')](),controller[_0xb13c('0x12')]);router['put']('/:id',auth[_0xb13c('0xa')](),controller['update']);router['delete'](_0xb13c('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xb13c('0x13')]=router;
\ No newline at end of file
+var _0xded1=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','15s','test','post','put','update','delete','destroy'];(function(_0x111aad,_0x52eb18){var _0x21cd47=function(_0x188f42){while(--_0x188f42){_0x111aad['push'](_0x111aad['shift']());}};_0x21cd47(++_0x52eb18);}(_0xded1,0x150));var _0x1ded=function(_0x237d67,_0x4ff2db){_0x237d67=_0x237d67-0x0;var _0x292dfb=_0xded1[_0x237d67];return _0x292dfb;};'use strict';var multer=require(_0x1ded('0x0'));var util=require('util');var path=require(_0x1ded('0x1'));var timeout=require('connect-timeout');var express=require(_0x1ded('0x2'));var router=express[_0x1ded('0x3')]();var fs_extra=require(_0x1ded('0x4'));var auth=require(_0x1ded('0x5'));var interaction=require(_0x1ded('0x6'));var config=require(_0x1ded('0x7'));var controller=require(_0x1ded('0x8'));router[_0x1ded('0x9')]('/',auth['isAuthenticated'](),controller[_0x1ded('0xa')]);router[_0x1ded('0x9')](_0x1ded('0xb'),auth[_0x1ded('0xc')](),controller[_0x1ded('0xd')]);router[_0x1ded('0x9')]('/:id/test',auth['isAuthenticated'](),timeout(_0x1ded('0xe')),controller[_0x1ded('0xf')]);router[_0x1ded('0x10')]('/',auth[_0x1ded('0xc')](),controller['create']);router[_0x1ded('0x11')](_0x1ded('0xb'),auth['isAuthenticated'](),controller[_0x1ded('0x12')]);router[_0x1ded('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x1ded('0x14')]);module['exports']=router;
\ No newline at end of file
index 15446dc..ef0ccdb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa374=['sequelize','STRING'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0xa374,0x6a));var _0x4a37=function(_0x5ec6be,_0x27986e){_0x5ec6be=_0x5ec6be-0x0;var _0x351a13=_0xa374[_0x5ec6be];return _0x351a13;};'use strict';var Sequelize=require(_0x4a37('0x0'));module['exports']={'name':{'type':Sequelize[_0x4a37('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x4a37('0x1')]},'description':{'type':Sequelize[_0x4a37('0x1')]}};
\ No newline at end of file
+var _0xae3e=['STRING','name'];(function(_0x303101,_0xb59700){var _0x4fe35b=function(_0x303084){while(--_0x303084){_0x303101['push'](_0x303101['shift']());}};_0x4fe35b(++_0xb59700);}(_0xae3e,0xa4));var _0xeae3=function(_0x5f3f60,_0x5623b3){_0x5f3f60=_0x5f3f60-0x0;var _0x3f0e96=_0xae3e[_0x5f3f60];return _0x3f0e96;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xeae3('0x0')],'unique':_0xeae3('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xeae3('0x0')]},'description':{'type':Sequelize[_0xeae3('0x0')]}};
\ No newline at end of file
index 8a66ef5..5799d3b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0fa4=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','ODBC','error','name','send','index','map','SquareOdbc','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','odbc','openSync','dsn','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0xff9cb,_0x1b45d7){var _0x455a53=function(_0x50cd1b){while(--_0x50cd1b){_0xff9cb['push'](_0xff9cb['shift']());}};_0x455a53(++_0x1b45d7);}(_0x0fa4,0xb5));var _0x40fa=function(_0x3daa3f,_0x1b8535){_0x3daa3f=_0x3daa3f-0x0;var _0xd021d5=_0x0fa4[_0x3daa3f];return _0xd021d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40fa('0x0'));var zipdir=require(_0x40fa('0x1'));var jsonpatch=require(_0x40fa('0x2'));var rp=require(_0x40fa('0x3'));var moment=require(_0x40fa('0x4'));var BPromise=require(_0x40fa('0x5'));var Mustache=require(_0x40fa('0x6'));var util=require(_0x40fa('0x7'));var path=require(_0x40fa('0x8'));var sox=require(_0x40fa('0x9'));var csv=require(_0x40fa('0xa'));var ejs=require(_0x40fa('0xb'));var fs=require('fs');var fs_extra=require(_0x40fa('0xc'));var _=require(_0x40fa('0xd'));var squel=require(_0x40fa('0xe'));var crypto=require(_0x40fa('0xf'));var jsforce=require(_0x40fa('0x10'));var deskjs=require(_0x40fa('0x11'));var toCsv=require(_0x40fa('0xa'));var querystring=require(_0x40fa('0x12'));var Papa=require(_0x40fa('0x13'));var Redis=require(_0x40fa('0x14'));var authService=require(_0x40fa('0x15'));var qs=require(_0x40fa('0x16'));var as=require(_0x40fa('0x17'));var hardwareService=require(_0x40fa('0x18'));var logger=require(_0x40fa('0x19'))(_0x40fa('0x1a'));var utils=require(_0x40fa('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x40fa('0x1c'));var db=require(_0x40fa('0x1d'))['db'];function respondWithStatusCode(_0xdf390f,_0x60e741){_0x60e741=_0x60e741||0xcc;return function(_0x35d07b){if(_0x35d07b){return _0xdf390f[_0x40fa('0x1e')](_0x60e741);}return _0xdf390f[_0x40fa('0x1f')](_0x60e741)[_0x40fa('0x20')]();};}function respondWithResult(_0x5b20a8,_0x4b6a62){_0x4b6a62=_0x4b6a62||0xc8;return function(_0x39c166){if(_0x39c166){return _0x5b20a8[_0x40fa('0x1f')](_0x4b6a62)['json'](_0x39c166);}};}function respondWithFilteredResult(_0x412c4e,_0x5936e1){return function(_0x53d3fa){if(_0x53d3fa){var _0x39ee1a=typeof _0x5936e1[_0x40fa('0x21')]===_0x40fa('0x22')&&typeof _0x5936e1[_0x40fa('0x23')]==='undefined';var _0x13bf59=_0x53d3fa[_0x40fa('0x24')];var _0x58fb60=_0x39ee1a?0x0:_0x5936e1[_0x40fa('0x21')];var _0xa238e3=_0x39ee1a?_0x53d3fa['count']:_0x5936e1[_0x40fa('0x21')]+_0x5936e1[_0x40fa('0x23')];var _0x5b4127;if(_0xa238e3>=_0x13bf59){_0xa238e3=_0x13bf59;_0x5b4127=0xc8;}else{_0x5b4127=0xce;}_0x412c4e['status'](_0x5b4127);return _0x412c4e[_0x40fa('0x25')](_0x40fa('0x26'),_0x58fb60+'-'+_0xa238e3+'/'+_0x13bf59)[_0x40fa('0x27')](_0x53d3fa);}return null;};}function patchUpdates(_0x20f7f0){return function(_0x17aa58){try{jsonpatch[_0x40fa('0x28')](_0x17aa58,_0x20f7f0,!![]);}catch(_0x451ee3){return BPromise[_0x40fa('0x29')](_0x451ee3);}return _0x17aa58['save']();};}function saveUpdates(_0x81e43c,_0x18a425){return function(_0x46404c){if(_0x46404c){return _0x46404c[_0x40fa('0x2a')](_0x81e43c)['then'](function(_0x28b681){return _0x28b681;});}return null;};}function removeEntity(_0x2eaaf2,_0x275070){return function(_0x444c5d){if(_0x444c5d){return _0x444c5d['destroy']()[_0x40fa('0x2b')](function(){var _0x2a7454=_0x444c5d['get']({'plain':!![]});var _0x524148=_0x40fa('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x524148,'resourceId':_0x2a7454['id']}})[_0x40fa('0x2b')](function(){return _0x444c5d;});})[_0x40fa('0x2b')](function(){_0x2eaaf2[_0x40fa('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e6de1,_0x854b14){return function(_0xe9d705){if(!_0xe9d705){_0x2e6de1[_0x40fa('0x1e')](0x194);}return _0xe9d705;};}function handleError(_0x38b160,_0x38bf72){_0x38bf72=_0x38bf72||0x1f4;return function(_0x3d7885){logger[_0x40fa('0x2d')](_0x3d7885['stack']);if(_0x3d7885[_0x40fa('0x2e')]){delete _0x3d7885[_0x40fa('0x2e')];}_0x38b160['status'](_0x38bf72)[_0x40fa('0x2f')](_0x3d7885);};}exports[_0x40fa('0x30')]=function(_0x5340de,_0x35268f){var _0x340fa8={},_0x122116={},_0x8430b3={'count':0x0,'rows':[]};var _0x3f6b11=_[_0x40fa('0x31')](db[_0x40fa('0x32')]['rawAttributes'],function(_0x16e007){return{'name':_0x16e007[_0x40fa('0x33')],'type':_0x16e007['type'][_0x40fa('0x34')]};});_0x122116[_0x40fa('0x35')]=_[_0x40fa('0x31')](_0x3f6b11,'name');_0x122116[_0x40fa('0x36')]=_['keys'](_0x5340de['query']);_0x122116[_0x40fa('0x37')]=_[_0x40fa('0x38')](_0x122116[_0x40fa('0x35')],_0x122116[_0x40fa('0x36')]);_0x340fa8[_0x40fa('0x39')]=_['intersection'](_0x122116[_0x40fa('0x35')],qs[_0x40fa('0x3a')](_0x5340de[_0x40fa('0x36')]['fields']));_0x340fa8[_0x40fa('0x39')]=_0x340fa8['attributes'][_0x40fa('0x3b')]?_0x340fa8[_0x40fa('0x39')]:_0x122116[_0x40fa('0x35')];if(!_0x5340de[_0x40fa('0x36')][_0x40fa('0x3c')](_0x40fa('0x3d'))){_0x340fa8[_0x40fa('0x23')]=qs[_0x40fa('0x23')](_0x5340de['query'][_0x40fa('0x23')]);_0x340fa8[_0x40fa('0x21')]=qs[_0x40fa('0x21')](_0x5340de[_0x40fa('0x36')][_0x40fa('0x21')]);}_0x340fa8[_0x40fa('0x3e')]=qs['sort'](_0x5340de[_0x40fa('0x36')][_0x40fa('0x3f')]);_0x340fa8[_0x40fa('0x40')]=qs[_0x40fa('0x37')](_[_0x40fa('0x41')](_0x5340de[_0x40fa('0x36')],_0x122116[_0x40fa('0x37')]),_0x3f6b11);if(_0x5340de[_0x40fa('0x36')][_0x40fa('0x42')]){_0x340fa8[_0x40fa('0x40')]=_[_0x40fa('0x43')](_0x340fa8[_0x40fa('0x40')],{'$or':_[_0x40fa('0x31')](_0x3f6b11,function(_0xcd9fb3){if(_0xcd9fb3[_0x40fa('0x44')]!==_0x40fa('0x45')){var _0x437fdc={};_0x437fdc[_0xcd9fb3[_0x40fa('0x2e')]]={'$like':'%'+_0x5340de['query'][_0x40fa('0x42')]+'%'};return _0x437fdc;}})});}_0x340fa8=_[_0x40fa('0x43')]({},_0x340fa8,_0x5340de[_0x40fa('0x46')]);var _0x49b841={'where':_0x340fa8[_0x40fa('0x40')]};return db[_0x40fa('0x32')][_0x40fa('0x24')](_0x49b841)[_0x40fa('0x2b')](function(_0x51e072){_0x8430b3[_0x40fa('0x24')]=_0x51e072;if(_0x5340de[_0x40fa('0x36')][_0x40fa('0x47')]){_0x340fa8['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x40fa('0x48')](_0x340fa8);})[_0x40fa('0x2b')](function(_0x5d3227){_0x8430b3[_0x40fa('0x49')]=_0x5d3227;return _0x8430b3;})[_0x40fa('0x2b')](respondWithFilteredResult(_0x35268f,_0x340fa8))[_0x40fa('0x4a')](handleError(_0x35268f,null));};exports[_0x40fa('0x4b')]=function(_0x2b6831,_0x2bb9d2){var _0x599abb={'raw':!![],'where':{'id':_0x2b6831[_0x40fa('0x4c')]['id']}},_0x3eb2d3={};_0x3eb2d3['model']=_[_0x40fa('0x4d')](db[_0x40fa('0x32')][_0x40fa('0x4e')]);_0x3eb2d3[_0x40fa('0x36')]=_[_0x40fa('0x4d')](_0x2b6831[_0x40fa('0x36')]);_0x3eb2d3[_0x40fa('0x37')]=_[_0x40fa('0x38')](_0x3eb2d3[_0x40fa('0x35')],_0x3eb2d3[_0x40fa('0x36')]);_0x599abb['attributes']=_[_0x40fa('0x38')](_0x3eb2d3[_0x40fa('0x35')],qs[_0x40fa('0x3a')](_0x2b6831[_0x40fa('0x36')][_0x40fa('0x3a')]));_0x599abb['attributes']=_0x599abb[_0x40fa('0x39')][_0x40fa('0x3b')]?_0x599abb['attributes']:_0x3eb2d3[_0x40fa('0x35')];if(_0x2b6831['query'][_0x40fa('0x47')]){_0x599abb[_0x40fa('0x4f')]=[{'all':!![]}];}_0x599abb=_[_0x40fa('0x43')]({},_0x599abb,_0x2b6831[_0x40fa('0x46')]);return db[_0x40fa('0x32')][_0x40fa('0x50')](_0x599abb)['then'](handleEntityNotFound(_0x2bb9d2,null))['then'](respondWithResult(_0x2bb9d2,null))[_0x40fa('0x4a')](handleError(_0x2bb9d2,null));};exports[_0x40fa('0x51')]=function(_0x2bed0b,_0x312398){return db[_0x40fa('0x32')]['create'](_0x2bed0b[_0x40fa('0x52')],{})[_0x40fa('0x2b')](function(_0xb43ba5){var _0x564b7f=_0x2bed0b['user'][_0x40fa('0x53')]({'plain':!![]});if(!_0x564b7f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x564b7f[_0x40fa('0x54')]===_0x40fa('0x55')){var _0x180e60=_0xb43ba5[_0x40fa('0x53')]({'plain':!![]});var _0x552c5e=_0x40fa('0x2c');return db[_0x40fa('0x56')][_0x40fa('0x50')]({'where':{'name':_0x552c5e,'userProfileId':_0x564b7f[_0x40fa('0x57')]},'raw':!![]})['then'](function(_0x2556c9){if(_0x2556c9&&_0x2556c9[_0x40fa('0x58')]===0x0){return db['UserProfileResource'][_0x40fa('0x51')]({'name':_0x180e60['name'],'resourceId':_0x180e60['id'],'type':_0x2556c9['name'],'sectionId':_0x2556c9['id']},{})['then'](function(){return _0xb43ba5;});}else{return _0xb43ba5;}})[_0x40fa('0x4a')](function(_0x4fbbcb){logger[_0x40fa('0x2d')](_0x40fa('0x59'),_0x4fbbcb);throw _0x4fbbcb;});}return _0xb43ba5;})[_0x40fa('0x2b')](respondWithResult(_0x312398,0xc9))[_0x40fa('0x4a')](handleError(_0x312398,null));};exports[_0x40fa('0x2a')]=function(_0x3de627,_0x4f2d51){if(_0x3de627[_0x40fa('0x52')]['id']){delete _0x3de627[_0x40fa('0x52')]['id'];}return db[_0x40fa('0x32')][_0x40fa('0x50')]({'where':{'id':_0x3de627[_0x40fa('0x4c')]['id']}})[_0x40fa('0x2b')](handleEntityNotFound(_0x4f2d51,null))['then'](saveUpdates(_0x3de627[_0x40fa('0x52')],null))[_0x40fa('0x2b')](respondWithResult(_0x4f2d51,null))['catch'](handleError(_0x4f2d51,null));};exports['destroy']=function(_0x24ee1d,_0x49a461){return db[_0x40fa('0x32')][_0x40fa('0x50')]({'where':{'id':_0x24ee1d[_0x40fa('0x4c')]['id']}})[_0x40fa('0x2b')](handleEntityNotFound(_0x49a461,null))['then'](removeEntity(_0x49a461,null))['catch'](handleError(_0x49a461,null));};exports['test']=function(_0x1f69eb,_0x2bb44f,_0x4c2b95){var _0x7da3ac;return db['SquareOdbc']['find']({'where':{'id':_0x1f69eb['params']['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x2bb44f,null))[_0x40fa('0x2b')](function(_0x4e98f3){if(_0x4e98f3){var _0x3cf205=require(_0x40fa('0x5a'))();_0x3cf205[_0x40fa('0x5b')](_0x4e98f3[_0x40fa('0x5c')]);_0x3cf205['closeSync']();return _0x4e98f3;}})[_0x40fa('0x2b')](respondWithResult(_0x2bb44f,null))['catch'](handleError(_0x2bb44f,null));};
\ No newline at end of file
+var _0x5141=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','index','SquareOdbc','rawAttributes','key','map','name','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','fields','include','find','create','body','user','role','ODBC','UserProfileSection','userProfileId'];(function(_0x4e1177,_0x634ad0){var _0x252a12=function(_0x4e0c33){while(--_0x4e0c33){_0x4e1177['push'](_0x4e1177['shift']());}};_0x252a12(++_0x634ad0);}(_0x5141,0xb3));var _0x1514=function(_0x2022af,_0x5cf8ab){_0x2022af=_0x2022af-0x0;var _0x3c8c2d=_0x5141[_0x2022af];return _0x3c8c2d;};'use strict';var emlformat=require(_0x1514('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1514('0x1'));var jsonpatch=require(_0x1514('0x2'));var rp=require(_0x1514('0x3'));var moment=require('moment');var BPromise=require(_0x1514('0x4'));var Mustache=require('mustache');var util=require(_0x1514('0x5'));var path=require(_0x1514('0x6'));var sox=require(_0x1514('0x7'));var csv=require('to-csv');var ejs=require(_0x1514('0x8'));var fs=require('fs');var fs_extra=require(_0x1514('0x9'));var _=require(_0x1514('0xa'));var squel=require('squel');var crypto=require(_0x1514('0xb'));var jsforce=require(_0x1514('0xc'));var deskjs=require(_0x1514('0xd'));var toCsv=require(_0x1514('0xe'));var querystring=require(_0x1514('0xf'));var Papa=require(_0x1514('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1514('0x11'));var as=require(_0x1514('0x12'));var hardwareService=require(_0x1514('0x13'));var logger=require('../../config/logger')(_0x1514('0x14'));var utils=require(_0x1514('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1514('0x16'));var db=require(_0x1514('0x17'))['db'];function respondWithStatusCode(_0x2a20aa,_0x144f7e){_0x144f7e=_0x144f7e||0xcc;return function(_0x5d27b1){if(_0x5d27b1){return _0x2a20aa[_0x1514('0x18')](_0x144f7e);}return _0x2a20aa[_0x1514('0x19')](_0x144f7e)[_0x1514('0x1a')]();};}function respondWithResult(_0x56f0a8,_0x476cd0){_0x476cd0=_0x476cd0||0xc8;return function(_0x326bf4){if(_0x326bf4){return _0x56f0a8['status'](_0x476cd0)[_0x1514('0x1b')](_0x326bf4);}};}function respondWithFilteredResult(_0x4f6077,_0x5e436d){return function(_0xa660a6){if(_0xa660a6){var _0x403dd2=typeof _0x5e436d['offset']==='undefined'&&typeof _0x5e436d[_0x1514('0x1c')]===_0x1514('0x1d');var _0x2e399a=_0xa660a6[_0x1514('0x1e')];var _0x415a3b=_0x403dd2?0x0:_0x5e436d[_0x1514('0x1f')];var _0x2f4dac=_0x403dd2?_0xa660a6[_0x1514('0x1e')]:_0x5e436d['offset']+_0x5e436d[_0x1514('0x1c')];var _0x2446c4;if(_0x2f4dac>=_0x2e399a){_0x2f4dac=_0x2e399a;_0x2446c4=0xc8;}else{_0x2446c4=0xce;}_0x4f6077['status'](_0x2446c4);return _0x4f6077[_0x1514('0x20')](_0x1514('0x21'),_0x415a3b+'-'+_0x2f4dac+'/'+_0x2e399a)[_0x1514('0x1b')](_0xa660a6);}return null;};}function patchUpdates(_0x292754){return function(_0x209d3b){try{jsonpatch[_0x1514('0x22')](_0x209d3b,_0x292754,!![]);}catch(_0x2f1556){return BPromise['reject'](_0x2f1556);}return _0x209d3b[_0x1514('0x23')]();};}function saveUpdates(_0x1958dd,_0x14147e){return function(_0x5a6995){if(_0x5a6995){return _0x5a6995[_0x1514('0x24')](_0x1958dd)[_0x1514('0x25')](function(_0x44d19d){return _0x44d19d;});}return null;};}function removeEntity(_0x450f87,_0x52dc0a){return function(_0x57c3dd){if(_0x57c3dd){return _0x57c3dd[_0x1514('0x26')]()['then'](function(){var _0x2f2bdc=_0x57c3dd[_0x1514('0x27')]({'plain':!![]});var _0x258e03='ODBC';return db[_0x1514('0x28')][_0x1514('0x26')]({'where':{'type':_0x258e03,'resourceId':_0x2f2bdc['id']}})[_0x1514('0x25')](function(){return _0x57c3dd;});})[_0x1514('0x25')](function(){_0x450f87[_0x1514('0x19')](0xcc)[_0x1514('0x1a')]();});}};}function handleEntityNotFound(_0x4a42f2,_0x2199fe){return function(_0x3f9fd0){if(!_0x3f9fd0){_0x4a42f2[_0x1514('0x18')](0x194);}return _0x3f9fd0;};}function handleError(_0x1c144f,_0x4b7d45){_0x4b7d45=_0x4b7d45||0x1f4;return function(_0x514c1e){logger[_0x1514('0x29')](_0x514c1e[_0x1514('0x2a')]);if(_0x514c1e['name']){delete _0x514c1e['name'];}_0x1c144f['status'](_0x4b7d45)['send'](_0x514c1e);};}exports[_0x1514('0x2b')]=function(_0x4c12c5,_0x3aacd4){var _0x50b07e={},_0x2c0fd3={},_0x303b97={'count':0x0,'rows':[]};var _0x510e67=_['map'](db[_0x1514('0x2c')][_0x1514('0x2d')],function(_0x5cdbc6){return{'name':_0x5cdbc6['fieldName'],'type':_0x5cdbc6['type'][_0x1514('0x2e')]};});_0x2c0fd3['model']=_[_0x1514('0x2f')](_0x510e67,_0x1514('0x30'));_0x2c0fd3[_0x1514('0x31')]=_[_0x1514('0x32')](_0x4c12c5[_0x1514('0x31')]);_0x2c0fd3[_0x1514('0x33')]=_[_0x1514('0x34')](_0x2c0fd3[_0x1514('0x35')],_0x2c0fd3['query']);_0x50b07e[_0x1514('0x36')]=_['intersection'](_0x2c0fd3['model'],qs['fields'](_0x4c12c5[_0x1514('0x31')]['fields']));_0x50b07e[_0x1514('0x36')]=_0x50b07e[_0x1514('0x36')][_0x1514('0x37')]?_0x50b07e[_0x1514('0x36')]:_0x2c0fd3[_0x1514('0x35')];if(!_0x4c12c5['query']['hasOwnProperty'](_0x1514('0x38'))){_0x50b07e[_0x1514('0x1c')]=qs['limit'](_0x4c12c5['query'][_0x1514('0x1c')]);_0x50b07e[_0x1514('0x1f')]=qs[_0x1514('0x1f')](_0x4c12c5[_0x1514('0x31')]['offset']);}_0x50b07e[_0x1514('0x39')]=qs[_0x1514('0x3a')](_0x4c12c5[_0x1514('0x31')][_0x1514('0x3a')]);_0x50b07e[_0x1514('0x3b')]=qs[_0x1514('0x33')](_['pick'](_0x4c12c5['query'],_0x2c0fd3['filters']),_0x510e67);if(_0x4c12c5[_0x1514('0x31')][_0x1514('0x3c')]){_0x50b07e[_0x1514('0x3b')]=_[_0x1514('0x3d')](_0x50b07e['where'],{'$or':_[_0x1514('0x2f')](_0x510e67,function(_0x51ca10){if(_0x51ca10['type']!==_0x1514('0x3e')){var _0x1979db={};_0x1979db[_0x51ca10[_0x1514('0x30')]]={'$like':'%'+_0x4c12c5[_0x1514('0x31')][_0x1514('0x3c')]+'%'};return _0x1979db;}})});}_0x50b07e=_['merge']({},_0x50b07e,_0x4c12c5[_0x1514('0x3f')]);var _0x51a8d4={'where':_0x50b07e[_0x1514('0x3b')]};return db[_0x1514('0x2c')][_0x1514('0x1e')](_0x51a8d4)[_0x1514('0x25')](function(_0x2512a1){_0x303b97[_0x1514('0x1e')]=_0x2512a1;if(_0x4c12c5[_0x1514('0x31')][_0x1514('0x40')]){_0x50b07e['include']=[{'all':!![]}];}return db[_0x1514('0x2c')][_0x1514('0x41')](_0x50b07e);})[_0x1514('0x25')](function(_0x5980c9){_0x303b97[_0x1514('0x42')]=_0x5980c9;return _0x303b97;})[_0x1514('0x25')](respondWithFilteredResult(_0x3aacd4,_0x50b07e))[_0x1514('0x43')](handleError(_0x3aacd4,null));};exports[_0x1514('0x44')]=function(_0x239b56,_0x2c5264){var _0x29b6a6={'raw':!![],'where':{'id':_0x239b56['params']['id']}},_0x40e0ec={};_0x40e0ec[_0x1514('0x35')]=_[_0x1514('0x32')](db['SquareOdbc'][_0x1514('0x2d')]);_0x40e0ec[_0x1514('0x31')]=_[_0x1514('0x32')](_0x239b56[_0x1514('0x31')]);_0x40e0ec['filters']=_[_0x1514('0x34')](_0x40e0ec[_0x1514('0x35')],_0x40e0ec[_0x1514('0x31')]);_0x29b6a6['attributes']=_[_0x1514('0x34')](_0x40e0ec[_0x1514('0x35')],qs[_0x1514('0x45')](_0x239b56[_0x1514('0x31')][_0x1514('0x45')]));_0x29b6a6[_0x1514('0x36')]=_0x29b6a6['attributes'][_0x1514('0x37')]?_0x29b6a6[_0x1514('0x36')]:_0x40e0ec[_0x1514('0x35')];if(_0x239b56['query']['includeAll']){_0x29b6a6[_0x1514('0x46')]=[{'all':!![]}];}_0x29b6a6=_['merge']({},_0x29b6a6,_0x239b56[_0x1514('0x3f')]);return db[_0x1514('0x2c')][_0x1514('0x47')](_0x29b6a6)[_0x1514('0x25')](handleEntityNotFound(_0x2c5264,null))[_0x1514('0x25')](respondWithResult(_0x2c5264,null))[_0x1514('0x43')](handleError(_0x2c5264,null));};exports[_0x1514('0x48')]=function(_0x4d8e71,_0x1a82cf){return db[_0x1514('0x2c')]['create'](_0x4d8e71[_0x1514('0x49')],{})[_0x1514('0x25')](function(_0x3e3a85){var _0xa48280=_0x4d8e71[_0x1514('0x4a')]['get']({'plain':!![]});if(!_0xa48280)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa48280[_0x1514('0x4b')]===_0x1514('0x4a')){var _0x602e5=_0x3e3a85[_0x1514('0x27')]({'plain':!![]});var _0x9bd08=_0x1514('0x4c');return db[_0x1514('0x4d')][_0x1514('0x47')]({'where':{'name':_0x9bd08,'userProfileId':_0xa48280[_0x1514('0x4e')]},'raw':!![]})[_0x1514('0x25')](function(_0x447d97){if(_0x447d97&&_0x447d97[_0x1514('0x4f')]===0x0){return db['UserProfileResource'][_0x1514('0x48')]({'name':_0x602e5['name'],'resourceId':_0x602e5['id'],'type':_0x447d97[_0x1514('0x30')],'sectionId':_0x447d97['id']},{})[_0x1514('0x25')](function(){return _0x3e3a85;});}else{return _0x3e3a85;}})['catch'](function(_0x289a9b){logger['error'](_0x1514('0x50'),_0x289a9b);throw _0x289a9b;});}return _0x3e3a85;})[_0x1514('0x25')](respondWithResult(_0x1a82cf,0xc9))['catch'](handleError(_0x1a82cf,null));};exports[_0x1514('0x24')]=function(_0x5e830b,_0x39fa65){if(_0x5e830b[_0x1514('0x49')]['id']){delete _0x5e830b[_0x1514('0x49')]['id'];}return db[_0x1514('0x2c')]['find']({'where':{'id':_0x5e830b[_0x1514('0x51')]['id']}})[_0x1514('0x25')](handleEntityNotFound(_0x39fa65,null))[_0x1514('0x25')](saveUpdates(_0x5e830b[_0x1514('0x49')],null))[_0x1514('0x25')](respondWithResult(_0x39fa65,null))['catch'](handleError(_0x39fa65,null));};exports[_0x1514('0x26')]=function(_0x17c0ea,_0x17f0a2){return db['SquareOdbc'][_0x1514('0x47')]({'where':{'id':_0x17c0ea['params']['id']}})[_0x1514('0x25')](handleEntityNotFound(_0x17f0a2,null))['then'](removeEntity(_0x17f0a2,null))[_0x1514('0x43')](handleError(_0x17f0a2,null));};exports[_0x1514('0x52')]=function(_0x2a967c,_0x7aece1,_0x27e8e0){var _0x1e1cd3;return db['SquareOdbc'][_0x1514('0x47')]({'where':{'id':_0x2a967c[_0x1514('0x51')]['id']},'attributes':['id',_0x1514('0x53')]})['then'](handleEntityNotFound(_0x7aece1,null))[_0x1514('0x25')](function(_0xc86003){if(_0xc86003){var _0x449b26=require(_0x1514('0x54'))();_0x449b26['openSync'](_0xc86003[_0x1514('0x53')]);_0x449b26[_0x1514('0x55')]();return _0xc86003;}})[_0x1514('0x25')](respondWithResult(_0x7aece1,null))[_0x1514('0x43')](handleError(_0x7aece1,null));};
\ No newline at end of file
index 3e25ffb..99a920a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0738=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','square_odbc','lodash','util','../../config/logger'];(function(_0x1d91f0,_0x1d3111){var _0x5cc1a7=function(_0x2f6ddc){while(--_0x2f6ddc){_0x1d91f0['push'](_0x1d91f0['shift']());}};_0x5cc1a7(++_0x1d3111);}(_0x0738,0x15d));var _0x8073=function(_0x317e30,_0x32ad66){_0x317e30=_0x317e30-0x0;var _0x203788=_0x0738[_0x317e30];return _0x203788;};'use strict';var _=require(_0x8073('0x0'));var util=require(_0x8073('0x1'));var logger=require(_0x8073('0x2'))('api');var moment=require(_0x8073('0x3'));var BPromise=require(_0x8073('0x4'));var rp=require(_0x8073('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8073('0x6'));var config=require(_0x8073('0x7'));var attributes=require('./squareOdbc.attributes');module[_0x8073('0x8')]=function(_0x1e8168,_0x13208e){return _0x1e8168[_0x8073('0x9')]('SquareOdbc',attributes,{'tableName':_0x8073('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xea8b=['./squareOdbc.attributes','exports','define','square_odbc','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1e5de7,_0x43cf47){var _0x1fcccc=function(_0x5c0c42){while(--_0x5c0c42){_0x1e5de7['push'](_0x1e5de7['shift']());}};_0x1fcccc(++_0x43cf47);}(_0xea8b,0x79));var _0xbea8=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xea8b[_0x24f31b];return _0x488401;};'use strict';var _=require(_0xbea8('0x0'));var util=require(_0xbea8('0x1'));var logger=require(_0xbea8('0x2'))('api');var moment=require(_0xbea8('0x3'));var BPromise=require(_0xbea8('0x4'));var rp=require(_0xbea8('0x5'));var fs=require('fs');var path=require(_0xbea8('0x6'));var rimraf=require(_0xbea8('0x7'));var config=require(_0xbea8('0x8'));var attributes=require(_0xbea8('0x9'));module[_0xbea8('0xa')]=function(_0x2f297b,_0x5bd3ec){return _0x2f297b[_0xbea8('0xb')]('SquareOdbc',attributes,{'tableName':_0xbea8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 566abd5..4cbde4f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xae98=['request\x20sent','debug','error','code','message','catch','ShowSquareOdbc','SquareOdbc','options','attributes','include','map','model','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SquareOdbc,\x20%s,\x20%s'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xae98,0x142));var _0x8ae9=function(_0x476c0d,_0x52fd8e){_0x476c0d=_0x476c0d-0x0;var _0x5ccff3=_0xae98[_0x476c0d];return _0x5ccff3;};'use strict';var _=require(_0x8ae9('0x0'));var util=require('util');var moment=require(_0x8ae9('0x1'));var BPromise=require(_0x8ae9('0x2'));var rs=require(_0x8ae9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ae9('0x4'))['db'];var utils=require(_0x8ae9('0x5'));var logger=require(_0x8ae9('0x6'))(_0x8ae9('0x7'));var config=require(_0x8ae9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8ae9('0x9')][_0x8ae9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12ed0b,_0x556154,_0x7c032b){return new BPromise(function(_0x3d9fac,_0x4d3943){return client['request'](_0x12ed0b,_0x7c032b)[_0x8ae9('0xb')](function(_0x15d572){logger[_0x8ae9('0xc')](_0x8ae9('0xd'),_0x556154,_0x8ae9('0xe'));logger[_0x8ae9('0xf')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x556154,_0x8ae9('0xe'),JSON['stringify'](_0x15d572));if(_0x15d572[_0x8ae9('0x10')]){if(_0x15d572[_0x8ae9('0x10')][_0x8ae9('0x11')]===0x1f4){logger[_0x8ae9('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x556154,_0x15d572[_0x8ae9('0x10')][_0x8ae9('0x12')]);return _0x4d3943(_0x15d572[_0x8ae9('0x10')][_0x8ae9('0x12')]);}logger['error'](_0x8ae9('0xd'),_0x556154,_0x15d572[_0x8ae9('0x10')][_0x8ae9('0x12')]);return _0x3d9fac(_0x15d572['error'][_0x8ae9('0x12')]);}else{logger[_0x8ae9('0xc')](_0x8ae9('0xd'),_0x556154,_0x8ae9('0xe'));_0x3d9fac(_0x15d572['result'][_0x8ae9('0x12')]);}})[_0x8ae9('0x13')](function(_0x2fefe2){logger['error'](_0x8ae9('0xd'),_0x556154,_0x2fefe2);_0x4d3943(_0x2fefe2);});});}exports[_0x8ae9('0x14')]=function(_0x12881b){var _0x5d879c=this;return new Promise(function(_0x4a7444,_0x2b6f6b){return db[_0x8ae9('0x15')]['find']({'raw':_0x12881b['options']?_0x12881b[_0x8ae9('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x12881b[_0x8ae9('0x16')]?_0x12881b[_0x8ae9('0x16')]['where']||null:null,'attributes':_0x12881b['options']?_0x12881b[_0x8ae9('0x16')][_0x8ae9('0x17')]||null:null,'include':_0x12881b[_0x8ae9('0x16')]?_0x12881b[_0x8ae9('0x16')][_0x8ae9('0x18')]?_[_0x8ae9('0x19')](_0x12881b[_0x8ae9('0x16')][_0x8ae9('0x18')],function(_0x41c8be){return{'model':db[_0x41c8be['model']],'as':_0x41c8be['as'],'attributes':_0x41c8be[_0x8ae9('0x17')],'include':_0x41c8be[_0x8ae9('0x18')]?_[_0x8ae9('0x19')](_0x41c8be[_0x8ae9('0x18')],function(_0x438528){return{'model':db[_0x438528['model']],'as':_0x438528['as'],'attributes':_0x438528['attributes'],'include':_0x438528[_0x8ae9('0x18')]?_[_0x8ae9('0x19')](_0x438528[_0x8ae9('0x18')],function(_0x4fcd10){return{'model':db[_0x4fcd10[_0x8ae9('0x1a')]],'as':_0x4fcd10['as'],'attributes':_0x4fcd10[_0x8ae9('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8ae9('0xb')](function(_0x185cad){logger[_0x8ae9('0xc')]('ShowSquareOdbc',_0x12881b);logger['debug'](_0x8ae9('0x14'),_0x12881b,JSON[_0x8ae9('0x1b')](_0x185cad));_0x4a7444(_0x185cad);})[_0x8ae9('0x13')](function(_0x24aa0f){logger[_0x8ae9('0x10')](_0x8ae9('0x14'),_0x24aa0f['message'],_0x12881b);_0x2b6f6b(_0x5d879c[_0x8ae9('0x10')](0x1f4,_0x24aa0f[_0x8ae9('0x12')]));});});};
\ No newline at end of file
+var _0xf125=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','error','SquareOdbc,\x20%s,\x20%s','message','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','debug','lodash','util'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xf125,0x1b0));var _0x5f12=function(_0x4acbbf,_0x1a5559){_0x4acbbf=_0x4acbbf-0x0;var _0x2548a3=_0xf125[_0x4acbbf];return _0x2548a3;};'use strict';var _=require(_0x5f12('0x0'));var util=require(_0x5f12('0x1'));var moment=require(_0x5f12('0x2'));var BPromise=require(_0x5f12('0x3'));var rs=require(_0x5f12('0x4'));var fs=require('fs');var Redis=require(_0x5f12('0x5'));var db=require(_0x5f12('0x6'))['db'];var utils=require(_0x5f12('0x7'));var logger=require('../../config/logger')(_0x5f12('0x8'));var config=require('../../config/environment');var jayson=require(_0x5f12('0x9'));var client=jayson['client'][_0x5f12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b37ff,_0x5d1330,_0x70a478){return new BPromise(function(_0x33e093,_0x4f2c86){return client[_0x5f12('0xb')](_0x4b37ff,_0x70a478)[_0x5f12('0xc')](function(_0x232fc0){logger[_0x5f12('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x5d1330,_0x5f12('0xe'));logger['debug'](_0x5f12('0xf'),_0x5d1330,'request\x20sent',JSON['stringify'](_0x232fc0));if(_0x232fc0[_0x5f12('0x10')]){if(_0x232fc0[_0x5f12('0x10')]['code']===0x1f4){logger[_0x5f12('0x10')](_0x5f12('0x11'),_0x5d1330,_0x232fc0['error'][_0x5f12('0x12')]);return _0x4f2c86(_0x232fc0['error'][_0x5f12('0x12')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x5d1330,_0x232fc0['error'][_0x5f12('0x12')]);return _0x33e093(_0x232fc0[_0x5f12('0x10')]['message']);}else{logger[_0x5f12('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x5d1330,_0x5f12('0xe'));_0x33e093(_0x232fc0['result']['message']);}})[_0x5f12('0x13')](function(_0x330c8b){logger[_0x5f12('0x10')](_0x5f12('0x11'),_0x5d1330,_0x330c8b);_0x4f2c86(_0x330c8b);});});}exports[_0x5f12('0x14')]=function(_0x2e8f6c){var _0x40d495=this;return new Promise(function(_0x566aef,_0x1db14f){return db[_0x5f12('0x15')][_0x5f12('0x16')]({'raw':_0x2e8f6c[_0x5f12('0x17')]?_0x2e8f6c[_0x5f12('0x17')][_0x5f12('0x18')]===undefined?!![]:![]:!![],'where':_0x2e8f6c['options']?_0x2e8f6c['options'][_0x5f12('0x19')]||null:null,'attributes':_0x2e8f6c[_0x5f12('0x17')]?_0x2e8f6c[_0x5f12('0x17')][_0x5f12('0x1a')]||null:null,'include':_0x2e8f6c[_0x5f12('0x17')]?_0x2e8f6c[_0x5f12('0x17')][_0x5f12('0x1b')]?_[_0x5f12('0x1c')](_0x2e8f6c['options'][_0x5f12('0x1b')],function(_0x1228a8){return{'model':db[_0x1228a8[_0x5f12('0x1d')]],'as':_0x1228a8['as'],'attributes':_0x1228a8[_0x5f12('0x1a')],'include':_0x1228a8['include']?_[_0x5f12('0x1c')](_0x1228a8[_0x5f12('0x1b')],function(_0x392052){return{'model':db[_0x392052[_0x5f12('0x1d')]],'as':_0x392052['as'],'attributes':_0x392052['attributes'],'include':_0x392052['include']?_[_0x5f12('0x1c')](_0x392052['include'],function(_0x20ea96){return{'model':db[_0x20ea96[_0x5f12('0x1d')]],'as':_0x20ea96['as'],'attributes':_0x20ea96['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3975b2){logger['info'](_0x5f12('0x14'),_0x2e8f6c);logger[_0x5f12('0x1e')](_0x5f12('0x14'),_0x2e8f6c,JSON['stringify'](_0x3975b2));_0x566aef(_0x3975b2);})['catch'](function(_0x137c7d){logger[_0x5f12('0x10')](_0x5f12('0x14'),_0x137c7d[_0x5f12('0x12')],_0x2e8f6c);_0x1db14f(_0x40d495[_0x5f12('0x10')](0x1f4,_0x137c7d[_0x5f12('0x12')]));});});};
\ No newline at end of file
index f9eec72..7fc930e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2fc9=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','/:id','isAuthenticated','show','/:id/users','getUsers','create','post','addUsers','put','update','delete'];(function(_0x6be832,_0x45bf02){var _0x332822=function(_0x5454ab){while(--_0x5454ab){_0x6be832['push'](_0x6be832['shift']());}};_0x332822(++_0x45bf02);}(_0x2fc9,0xc2));var _0x92fc=function(_0x2730da,_0x1098bd){_0x2730da=_0x2730da-0x0;var _0xfe9991=_0x2fc9[_0x2730da];return _0xfe9991;};'use strict';var multer=require('multer');var util=require(_0x92fc('0x0'));var path=require(_0x92fc('0x1'));var timeout=require(_0x92fc('0x2'));var express=require(_0x92fc('0x3'));var router=express[_0x92fc('0x4')]();var fs_extra=require(_0x92fc('0x5'));var auth=require(_0x92fc('0x6'));var interaction=require(_0x92fc('0x7'));var config=require(_0x92fc('0x8'));var controller=require(_0x92fc('0x9'));router[_0x92fc('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x92fc('0xb'),auth[_0x92fc('0xc')](),controller[_0x92fc('0xd')]);router[_0x92fc('0xa')](_0x92fc('0xe'),auth[_0x92fc('0xc')](),controller[_0x92fc('0xf')]);router['post']('/',auth[_0x92fc('0xc')](),controller[_0x92fc('0x10')]);router[_0x92fc('0x11')]('/:id/users',auth[_0x92fc('0xc')](),controller[_0x92fc('0x12')]);router[_0x92fc('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x92fc('0x14')]);router[_0x92fc('0x15')]('/:id',auth[_0x92fc('0xc')](),controller[_0x92fc('0x16')]);router[_0x92fc('0x15')](_0x92fc('0xe'),auth[_0x92fc('0xc')](),controller['removeUsers']);module[_0x92fc('0x17')]=router;
\ No newline at end of file
+var _0x56fd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show','/:id/users','getUsers','create','post','addUsers','put','update','destroy','delete','multer'];(function(_0x506191,_0xcfd0c){var _0x506ea7=function(_0x9c9885){while(--_0x9c9885){_0x506191['push'](_0x506191['shift']());}};_0x506ea7(++_0xcfd0c);}(_0x56fd,0x15f));var _0xd56f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x56fd[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xd56f('0x0'));var util=require(_0xd56f('0x1'));var path=require(_0xd56f('0x2'));var timeout=require('connect-timeout');var express=require(_0xd56f('0x3'));var router=express[_0xd56f('0x4')]();var fs_extra=require(_0xd56f('0x5'));var auth=require(_0xd56f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd56f('0x7'));var controller=require(_0xd56f('0x8'));router[_0xd56f('0x9')]('/',auth[_0xd56f('0xa')](),controller['index']);router['get'](_0xd56f('0xb'),auth[_0xd56f('0xa')](),controller[_0xd56f('0xc')]);router['get'](_0xd56f('0xd'),auth[_0xd56f('0xa')](),controller[_0xd56f('0xe')]);router['post']('/',auth[_0xd56f('0xa')](),controller[_0xd56f('0xf')]);router[_0xd56f('0x10')]('/:id/users',auth[_0xd56f('0xa')](),controller[_0xd56f('0x11')]);router[_0xd56f('0x12')](_0xd56f('0xb'),auth[_0xd56f('0xa')](),controller[_0xd56f('0x13')]);router['delete']('/:id',auth[_0xd56f('0xa')](),controller[_0xd56f('0x14')]);router[_0xd56f('0x15')](_0xd56f('0xd'),auth[_0xd56f('0xa')](),controller['removeUsers']);module['exports']=router;
\ No newline at end of file
index b37238f..a0f9089 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2e13=['STRING','BLOB','long','preproduction','getDataValue','toString','utf8','production','DATE','sequelize'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x2e13,0x1b7));var _0x32e1=function(_0x232c03,_0x313924){_0x232c03=_0x232c03-0x0;var _0x4f7479=_0x2e13[_0x232c03];return _0x4f7479;};'use strict';var Sequelize=require(_0x32e1('0x0'));module['exports']={'name':{'type':Sequelize[_0x32e1('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x32e1('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x32e1('0x2')](_0x32e1('0x3')),'get':function(){if(this['getDataValue'](_0x32e1('0x4'))){return this[_0x32e1('0x5')](_0x32e1('0x4'))[_0x32e1('0x6')](_0x32e1('0x7'));}}},'production':{'type':Sequelize[_0x32e1('0x2')](_0x32e1('0x3')),'get':function(){if(this[_0x32e1('0x5')](_0x32e1('0x8'))){return this[_0x32e1('0x5')](_0x32e1('0x8'))[_0x32e1('0x6')](_0x32e1('0x7'));}}},'savedAt':{'type':Sequelize[_0x32e1('0x9')]},'publishedAt':{'type':Sequelize[_0x32e1('0x9')]}};
\ No newline at end of file
+var _0x6500=['BLOB','long','getDataValue','preproduction','toString','production','DATE','exports','STRING','name','TEXT'];(function(_0x14dcc5,_0x163ab7){var _0x35d6cc=function(_0x2de1ae){while(--_0x2de1ae){_0x14dcc5['push'](_0x14dcc5['shift']());}};_0x35d6cc(++_0x163ab7);}(_0x6500,0x13b));var _0x0650=function(_0x29aa90,_0x5014a4){_0x29aa90=_0x29aa90-0x0;var _0x5aa6ad=_0x6500[_0x29aa90];return _0x5aa6ad;};'use strict';var Sequelize=require('sequelize');module[_0x0650('0x0')]={'name':{'type':Sequelize[_0x0650('0x1')],'unique':_0x0650('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x0650('0x3')]},'preproduction':{'type':Sequelize[_0x0650('0x4')](_0x0650('0x5')),'get':function(){if(this[_0x0650('0x6')](_0x0650('0x7'))){return this['getDataValue'](_0x0650('0x7'))[_0x0650('0x8')]('utf8');}}},'production':{'type':Sequelize[_0x0650('0x4')](_0x0650('0x5')),'get':function(){if(this[_0x0650('0x6')](_0x0650('0x9'))){return this[_0x0650('0x6')]('production')[_0x0650('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0x0650('0xa')]},'publishedAt':{'type':Sequelize[_0x0650('0xa')]}};
\ No newline at end of file
index a30fea7..8b1bd16 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xafc4=['VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','production','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','nolimit','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','undefined','limit','count','offset','json','update','then','destroy','get','UserProfileResource','publish','agi','stringify','error','stack','name','send','index','SquareProject','rawAttributes','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type'];(function(_0x12130b,_0x1e5d98){var _0x398370=function(_0x2d01d4){while(--_0x2d01d4){_0x12130b['push'](_0x12130b['shift']());}};_0x398370(++_0x1e5d98);}(_0xafc4,0x69));var _0x4afc=function(_0x1710f9,_0x590b40){_0x1710f9=_0x1710f9-0x0;var _0x374daf=_0xafc4[_0x1710f9];return _0x374daf;};'use strict';var _=require(_0x4afc('0x0'));var Redis=require('ioredis');var qs=require(_0x4afc('0x1'));var logger=require('../../config/logger')(_0x4afc('0x2'));var config=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];config[_0x4afc('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4afc('0x6'))(new Redis(config[_0x4afc('0x5')]));require(_0x4afc('0x7'))[_0x4afc('0x8')](socket);function respondWithStatusCode(_0xc828d9,_0xaf053d){_0xaf053d=_0xaf053d||0xcc;return function(_0x5e1e29){if(_0x5e1e29){return _0xc828d9[_0x4afc('0x9')](_0xaf053d);}return _0xc828d9[_0x4afc('0xa')](_0xaf053d)[_0x4afc('0xb')]();};}function respondWithResult(_0x1e6bf5,_0x1b8981){_0x1b8981=_0x1b8981||0xc8;return function(_0x458fde){if(_0x458fde){return _0x1e6bf5['status'](_0x1b8981)['json'](_0x458fde);}};}function respondWithFilteredResult(_0x7f127f,_0x49222e){return function(_0x281230){if(_0x281230){var _0x225793=typeof _0x49222e['offset']===_0x4afc('0xc')&&typeof _0x49222e[_0x4afc('0xd')]===_0x4afc('0xc');var _0x2768bf=_0x281230[_0x4afc('0xe')];var _0x2f1c59=_0x225793?0x0:_0x49222e[_0x4afc('0xf')];var _0x23b03e=_0x225793?_0x281230['count']:_0x49222e[_0x4afc('0xf')]+_0x49222e[_0x4afc('0xd')];var _0x2c636b;if(_0x23b03e>=_0x2768bf){_0x23b03e=_0x2768bf;_0x2c636b=0xc8;}else{_0x2c636b=0xce;}_0x7f127f[_0x4afc('0xa')](_0x2c636b);return _0x7f127f['set']('Content-Range',_0x2f1c59+'-'+_0x23b03e+'/'+_0x2768bf)[_0x4afc('0x10')](_0x281230);}return null;};}function saveUpdates(_0x4f3127){return function(_0x23ae30){if(_0x23ae30){return _0x23ae30[_0x4afc('0x11')](_0x4f3127)[_0x4afc('0x12')](function(_0x31eec4){return _0x31eec4;});}return null;};}function removeEntity(_0x3a306f){return function(_0x3ebdc8){if(_0x3ebdc8){return _0x3ebdc8[_0x4afc('0x13')]()[_0x4afc('0x12')](function(){var _0x16365f=_0x3ebdc8[_0x4afc('0x14')]({'plain':!![]});var _0x178229='SquareProjects';return db[_0x4afc('0x15')][_0x4afc('0x13')]({'where':{'type':_0x178229,'resourceId':_0x16365f['id']}})[_0x4afc('0x12')](function(){return _0x3ebdc8;});})[_0x4afc('0x12')](function(){var _0x557a7e=new Redis(config[_0x4afc('0x5')]);_0x557a7e[_0x4afc('0x16')](_0x4afc('0x17'),JSON[_0x4afc('0x18')]({'id':_0x3ebdc8['id'],'deleted':!![]}));})[_0x4afc('0x12')](function(){_0x3a306f[_0x4afc('0xa')](0xcc)[_0x4afc('0xb')]();});}};}function handleEntityNotFound(_0x573a75){return function(_0x5403e4){if(!_0x5403e4){_0x573a75[_0x4afc('0x9')](0x194);}return _0x5403e4;};}function handleError(_0x57f37c,_0x37debf){_0x37debf=_0x37debf||0x1f4;return function(_0x4e9a48){logger[_0x4afc('0x19')](_0x4e9a48[_0x4afc('0x1a')]);if(_0x4e9a48[_0x4afc('0x1b')]){delete _0x4e9a48[_0x4afc('0x1b')];}_0x57f37c[_0x4afc('0xa')](_0x37debf)[_0x4afc('0x1c')](_0x4e9a48);};}exports[_0x4afc('0x1d')]=function(_0x383a71,_0x2bb837){var _0x100220={},_0x4e8273={},_0x359c07={'count':0x0,'rows':[]};var _0x35f5b3=_['map'](db[_0x4afc('0x1e')][_0x4afc('0x1f')],function(_0x2d6112){return{'name':_0x2d6112['fieldName'],'type':_0x2d6112['type']['key']};});_0x4e8273[_0x4afc('0x20')]=_[_0x4afc('0x21')](_0x35f5b3,'name');_0x4e8273[_0x4afc('0x22')]=_[_0x4afc('0x23')](_0x383a71['query']);_0x4e8273['filters']=_['intersection'](_0x4e8273[_0x4afc('0x20')],_0x4e8273[_0x4afc('0x22')]);_0x100220[_0x4afc('0x24')]=_[_0x4afc('0x25')](_0x4e8273[_0x4afc('0x20')],qs[_0x4afc('0x26')](_0x383a71['query'][_0x4afc('0x26')]));_0x100220[_0x4afc('0x24')]=_0x100220[_0x4afc('0x24')][_0x4afc('0x27')]?_0x100220[_0x4afc('0x24')]:_0x4e8273[_0x4afc('0x20')];if(!_0x383a71[_0x4afc('0x22')][_0x4afc('0x28')]('nolimit')){_0x100220[_0x4afc('0xd')]=qs['limit'](_0x383a71['query'][_0x4afc('0xd')]);_0x100220[_0x4afc('0xf')]=qs[_0x4afc('0xf')](_0x383a71[_0x4afc('0x22')][_0x4afc('0xf')]);}_0x100220[_0x4afc('0x29')]=qs['sort'](_0x383a71[_0x4afc('0x22')][_0x4afc('0x2a')]);_0x100220[_0x4afc('0x2b')]=qs[_0x4afc('0x2c')](_[_0x4afc('0x2d')](_0x383a71[_0x4afc('0x22')],_0x4e8273['filters']),_0x35f5b3);if(_0x383a71[_0x4afc('0x22')][_0x4afc('0x2e')]){_0x100220[_0x4afc('0x2b')]=_[_0x4afc('0x2f')](_0x100220['where'],{'$or':_['map'](_0x35f5b3,function(_0x43c341){if(_0x43c341[_0x4afc('0x30')]!==_0x4afc('0x31')){var _0x5edfe1={};_0x5edfe1[_0x43c341['name']]={'$like':'%'+_0x383a71[_0x4afc('0x22')]['filter']+'%'};return _0x5edfe1;}})});}_0x100220=_['merge']({},_0x100220,_0x383a71[_0x4afc('0x32')]);var _0x1dc853={'where':_0x100220[_0x4afc('0x2b')]};return db[_0x4afc('0x1e')][_0x4afc('0xe')](_0x1dc853)[_0x4afc('0x12')](function(_0x453e12){_0x359c07[_0x4afc('0xe')]=_0x453e12;if(_0x383a71[_0x4afc('0x22')][_0x4afc('0x33')]){_0x100220[_0x4afc('0x34')]=[{'all':!![]}];}return db[_0x4afc('0x1e')][_0x4afc('0x35')](_0x100220);})[_0x4afc('0x12')](function(_0x46dd2a){_0x359c07['rows']=_0x46dd2a;return _0x359c07;})[_0x4afc('0x12')](respondWithFilteredResult(_0x2bb837,_0x100220))[_0x4afc('0x36')](handleError(_0x2bb837,null));};exports[_0x4afc('0x37')]=function(_0xe6db12,_0x12db1d){var _0x260b06={'raw':![],'where':{'id':_0xe6db12['params']['id']}},_0x3e87f0={};_0x3e87f0['model']=_['keys'](db[_0x4afc('0x1e')][_0x4afc('0x1f')]);_0x3e87f0['query']=_[_0x4afc('0x23')](_0xe6db12[_0x4afc('0x22')]);_0x3e87f0[_0x4afc('0x2c')]=_[_0x4afc('0x25')](_0x3e87f0['model'],_0x3e87f0[_0x4afc('0x22')]);_0x260b06[_0x4afc('0x24')]=_[_0x4afc('0x25')](_0x3e87f0[_0x4afc('0x20')],qs[_0x4afc('0x26')](_0xe6db12[_0x4afc('0x22')]['fields']));_0x260b06[_0x4afc('0x24')]=_0x260b06['attributes'][_0x4afc('0x27')]?_0x260b06[_0x4afc('0x24')]:_0x3e87f0[_0x4afc('0x20')];if(_0xe6db12['query']['includeAll']){_0x260b06[_0x4afc('0x34')]=[{'all':!![]}];}_0x260b06=_[_0x4afc('0x2f')]({},_0x260b06,_0xe6db12[_0x4afc('0x32')]);return db[_0x4afc('0x1e')][_0x4afc('0x38')](_0x260b06)[_0x4afc('0x12')](handleEntityNotFound(_0x12db1d,null))[_0x4afc('0x12')](respondWithResult(_0x12db1d,null))[_0x4afc('0x36')](handleError(_0x12db1d,null));};exports['create']=function(_0x658c5b,_0xb1e91e){return db['SquareProject'][_0x4afc('0x39')](_0x658c5b['body'],{})[_0x4afc('0x12')](function(_0x24a731){var _0x16c6c4=_0x658c5b['user'][_0x4afc('0x14')]({'plain':!![]});if(!_0x16c6c4)throw new Error(_0x4afc('0x3a'));if(_0x16c6c4[_0x4afc('0x3b')]===_0x4afc('0x3c')){var _0x4772db=_0x24a731[_0x4afc('0x14')]({'plain':!![]});var _0x5d9d90='SquareProjects';return db['UserProfileSection'][_0x4afc('0x38')]({'where':{'name':_0x5d9d90,'userProfileId':_0x16c6c4[_0x4afc('0x3d')]},'raw':!![]})[_0x4afc('0x12')](function(_0x269c24){if(_0x269c24&&_0x269c24[_0x4afc('0x3e')]===0x0){return db[_0x4afc('0x15')][_0x4afc('0x39')]({'name':_0x4772db[_0x4afc('0x1b')],'resourceId':_0x4772db['id'],'type':_0x269c24[_0x4afc('0x1b')],'sectionId':_0x269c24['id']},{})[_0x4afc('0x12')](function(){return _0x24a731;});}else{return _0x24a731;}})['catch'](function(_0x40bb3b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40bb3b);throw _0x40bb3b;});}return _0x24a731;})[_0x4afc('0x12')](respondWithResult(_0xb1e91e,0xc9))['catch'](handleError(_0xb1e91e,null));};exports[_0x4afc('0x11')]=function(_0x355198,_0x2fe2ae){if(_0x355198[_0x4afc('0x3f')]['id']){delete _0x355198['body']['id'];}return db[_0x4afc('0x1e')]['find']({'where':{'id':_0x355198[_0x4afc('0x40')]['id']}})[_0x4afc('0x12')](handleEntityNotFound(_0x2fe2ae,null))[_0x4afc('0x12')](saveUpdates(_0x355198[_0x4afc('0x3f')],null))[_0x4afc('0x12')](function(_0xd46c35){if(!_0xd46c35)return;var _0x3d965d=_0xd46c35[_0x4afc('0x14')]({'plain':!![]});return _0x3d965d;})[_0x4afc('0x12')](function(_0x824900){var _0x322eb8=new Redis(config[_0x4afc('0x5')]);_0x322eb8['publish'](_0x4afc('0x17'),JSON[_0x4afc('0x18')](_[_0x4afc('0x2d')](_0x824900,['id',_0x4afc('0x1b'),_0x4afc('0x41')])));return _0x824900;})[_0x4afc('0x12')](respondWithResult(_0x2fe2ae,null))[_0x4afc('0x36')](handleError(_0x2fe2ae,null));};exports[_0x4afc('0x13')]=function(_0x369f01,_0x3df333){return db[_0x4afc('0x1e')][_0x4afc('0x38')]({'where':{'id':_0x369f01[_0x4afc('0x40')]['id']}})['then'](handleEntityNotFound(_0x3df333,null))[_0x4afc('0x12')](removeEntity(_0x3df333,null))['catch'](handleError(_0x3df333,null));};exports[_0x4afc('0x42')]=function(_0x2abc1b,_0x427122){return db[_0x4afc('0x1e')]['find']({'where':{'id':_0x2abc1b['params']['id']}})[_0x4afc('0x12')](handleEntityNotFound(_0x427122,null))[_0x4afc('0x12')](function(_0x5f16cb){if(_0x5f16cb){return _0x5f16cb[_0x4afc('0x42')](_0x2abc1b[_0x4afc('0x3f')][_0x4afc('0x43')],_[_0x4afc('0x44')](_0x2abc1b[_0x4afc('0x3f')],[_0x4afc('0x43'),'id'])||{});}})[_0x4afc('0x12')](respondWithResult(_0x427122,null))[_0x4afc('0x36')](handleError(_0x427122,null));};exports[_0x4afc('0x45')]=function(_0x3369a8,_0x4295a5){return db[_0x4afc('0x1e')][_0x4afc('0x38')]({'where':{'id':_0x3369a8[_0x4afc('0x40')]['id']}})['then'](handleEntityNotFound(_0x4295a5,null))[_0x4afc('0x12')](function(_0x59fb43){if(_0x59fb43){return _0x59fb43[_0x4afc('0x45')](_0x3369a8[_0x4afc('0x22')][_0x4afc('0x43')])[_0x4afc('0x12')](function(){if(_[_0x4afc('0x46')](_0x3369a8['query'][_0x4afc('0x43')])){for(var _0x323c65=0x0;_0x323c65<_0x3369a8['query']['ids'][_0x4afc('0x27')];_0x323c65+=0x1){socket[_0x4afc('0x47')](_0x4afc('0x48'),{'UserId':Number(_0x3369a8[_0x4afc('0x22')][_0x4afc('0x43')][_0x323c65]),'SquareProjectId':Number(_0x3369a8[_0x4afc('0x40')]['id'])});}}else{socket[_0x4afc('0x47')](_0x4afc('0x48'),{'UserId':Number(_0x3369a8[_0x4afc('0x22')][_0x4afc('0x43')]),'SquareProjectId':Number(_0x3369a8['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4295a5,null))[_0x4afc('0x36')](handleError(_0x4295a5,null));};exports[_0x4afc('0x49')]=function(_0x5884f2,_0x38971b){var _0x25e470={};var _0x5be1a7={};var _0x56573a;var _0x1b49cd;return db[_0x4afc('0x1e')][_0x4afc('0x4a')]({'where':{'id':_0x5884f2['params']['id']}})[_0x4afc('0x12')](handleEntityNotFound(_0x38971b,null))['then'](function(_0x5a2be2){if(_0x5a2be2){_0x56573a=_0x5a2be2;_0x5be1a7[_0x4afc('0x20')]=_[_0x4afc('0x23')](db[_0x4afc('0x4b')][_0x4afc('0x1f')]);_0x5be1a7[_0x4afc('0x22')]=_[_0x4afc('0x23')](_0x5884f2[_0x4afc('0x22')]);_0x5be1a7[_0x4afc('0x2c')]=_[_0x4afc('0x25')](_0x5be1a7['model'],_0x5be1a7[_0x4afc('0x22')]);_0x25e470[_0x4afc('0x24')]=_[_0x4afc('0x25')](_0x5be1a7['model'],qs['fields'](_0x5884f2['query'][_0x4afc('0x26')]));_0x25e470[_0x4afc('0x24')]=_0x25e470[_0x4afc('0x24')]['length']?_0x25e470[_0x4afc('0x24')]:_0x5be1a7['model'];_0x25e470['order']=qs['sort'](_0x5884f2[_0x4afc('0x22')][_0x4afc('0x2a')]);_0x25e470[_0x4afc('0x2b')]=qs['filters'](_[_0x4afc('0x2d')](_0x5884f2[_0x4afc('0x22')],_0x5be1a7[_0x4afc('0x2c')]));if(_0x5884f2['query'][_0x4afc('0x2e')]){_0x25e470[_0x4afc('0x2b')]=_[_0x4afc('0x2f')](_0x25e470[_0x4afc('0x2b')],{'$or':_[_0x4afc('0x21')](_0x25e470['attributes'],function(_0x549e31){var _0x367224={};_0x367224[_0x549e31]={'$like':'%'+_0x5884f2[_0x4afc('0x22')][_0x4afc('0x2e')]+'%'};return _0x367224;})});}_0x25e470=_['merge']({},_0x25e470,_0x5884f2[_0x4afc('0x32')]);return _0x56573a[_0x4afc('0x49')](_0x25e470);}})[_0x4afc('0x12')](function(_0x306a45){if(_0x306a45){_0x1b49cd=_0x306a45[_0x4afc('0x27')];if(!_0x5884f2['query'][_0x4afc('0x28')](_0x4afc('0x4c'))){_0x25e470['limit']=qs[_0x4afc('0xd')](_0x5884f2[_0x4afc('0x22')][_0x4afc('0xd')]);_0x25e470['offset']=qs[_0x4afc('0xf')](_0x5884f2[_0x4afc('0x22')][_0x4afc('0xf')]);}return _0x56573a[_0x4afc('0x49')](_0x25e470);}})[_0x4afc('0x12')](function(_0x3c0339){if(_0x3c0339){return _0x3c0339?{'count':_0x1b49cd,'rows':_0x3c0339}:null;}})[_0x4afc('0x12')](respondWithResult(_0x38971b,null))[_0x4afc('0x36')](handleError(_0x38971b,null));};
\ No newline at end of file
+var _0x5fab=['get','SquareProjects','UserProfileResource','agi','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','VIRTUAL','includeAll','include','SquareProject','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','stringify','production','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','order','merge','hasOwnProperty','nolimit','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','update','destroy','then'];(function(_0xf493e5,_0x50eeb9){var _0x24649a=function(_0x4e735e){while(--_0x4e735e){_0xf493e5['push'](_0xf493e5['shift']());}};_0x24649a(++_0x50eeb9);}(_0x5fab,0x177));var _0xb5fa=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5fab[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xb5fa('0x0'));var Redis=require(_0xb5fa('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xb5fa('0x2'))(_0xb5fa('0x3'));var config=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];config[_0xb5fa('0x6')]=_[_0xb5fa('0x7')](config[_0xb5fa('0x6')],{'host':_0xb5fa('0x8'),'port':0x18eb});var socket=require(_0xb5fa('0x9'))(new Redis(config[_0xb5fa('0x6')]));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x2e3804,_0x1aec3e){_0x1aec3e=_0x1aec3e||0xcc;return function(_0x9c7bce){if(_0x9c7bce){return _0x2e3804['sendStatus'](_0x1aec3e);}return _0x2e3804[_0xb5fa('0xa')](_0x1aec3e)[_0xb5fa('0xb')]();};}function respondWithResult(_0x2cf4a5,_0x54c7eb){_0x54c7eb=_0x54c7eb||0xc8;return function(_0x5b5ea8){if(_0x5b5ea8){return _0x2cf4a5[_0xb5fa('0xa')](_0x54c7eb)[_0xb5fa('0xc')](_0x5b5ea8);}};}function respondWithFilteredResult(_0xe46b26,_0x44e6c8){return function(_0x35ad13){if(_0x35ad13){var _0xadef41=typeof _0x44e6c8[_0xb5fa('0xd')]===_0xb5fa('0xe')&&typeof _0x44e6c8[_0xb5fa('0xf')]==='undefined';var _0x2ad830=_0x35ad13[_0xb5fa('0x10')];var _0x56e8b0=_0xadef41?0x0:_0x44e6c8[_0xb5fa('0xd')];var _0x577af0=_0xadef41?_0x35ad13[_0xb5fa('0x10')]:_0x44e6c8[_0xb5fa('0xd')]+_0x44e6c8[_0xb5fa('0xf')];var _0xca8d82;if(_0x577af0>=_0x2ad830){_0x577af0=_0x2ad830;_0xca8d82=0xc8;}else{_0xca8d82=0xce;}_0xe46b26[_0xb5fa('0xa')](_0xca8d82);return _0xe46b26['set']('Content-Range',_0x56e8b0+'-'+_0x577af0+'/'+_0x2ad830)[_0xb5fa('0xc')](_0x35ad13);}return null;};}function saveUpdates(_0x587043){return function(_0x31f252){if(_0x31f252){return _0x31f252[_0xb5fa('0x11')](_0x587043)['then'](function(_0x4fabcc){return _0x4fabcc;});}return null;};}function removeEntity(_0x451a55){return function(_0x1f7f05){if(_0x1f7f05){return _0x1f7f05[_0xb5fa('0x12')]()[_0xb5fa('0x13')](function(){var _0x324ba5=_0x1f7f05[_0xb5fa('0x14')]({'plain':!![]});var _0x3b0f69=_0xb5fa('0x15');return db[_0xb5fa('0x16')][_0xb5fa('0x12')]({'where':{'type':_0x3b0f69,'resourceId':_0x324ba5['id']}})[_0xb5fa('0x13')](function(){return _0x1f7f05;});})[_0xb5fa('0x13')](function(){var _0x5cd822=new Redis(config[_0xb5fa('0x6')]);_0x5cd822['publish'](_0xb5fa('0x17'),JSON['stringify']({'id':_0x1f7f05['id'],'deleted':!![]}));})[_0xb5fa('0x13')](function(){_0x451a55[_0xb5fa('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40dfdf){return function(_0x3a2ab9){if(!_0x3a2ab9){_0x40dfdf[_0xb5fa('0x18')](0x194);}return _0x3a2ab9;};}function handleError(_0x47f71a,_0x32a85c){_0x32a85c=_0x32a85c||0x1f4;return function(_0xec108f){logger[_0xb5fa('0x19')](_0xec108f['stack']);if(_0xec108f[_0xb5fa('0x1a')]){delete _0xec108f['name'];}_0x47f71a[_0xb5fa('0xa')](_0x32a85c)[_0xb5fa('0x1b')](_0xec108f);};}exports[_0xb5fa('0x1c')]=function(_0x543edf,_0x2dbd22){var _0x3f61cd={},_0x6a455c={},_0x20d649={'count':0x0,'rows':[]};var _0x568870=_['map'](db['SquareProject']['rawAttributes'],function(_0x28a350){return{'name':_0x28a350[_0xb5fa('0x1d')],'type':_0x28a350[_0xb5fa('0x1e')][_0xb5fa('0x1f')]};});_0x6a455c[_0xb5fa('0x20')]=_[_0xb5fa('0x21')](_0x568870,_0xb5fa('0x1a'));_0x6a455c[_0xb5fa('0x22')]=_[_0xb5fa('0x23')](_0x543edf[_0xb5fa('0x22')]);_0x6a455c[_0xb5fa('0x24')]=_[_0xb5fa('0x25')](_0x6a455c[_0xb5fa('0x20')],_0x6a455c[_0xb5fa('0x22')]);_0x3f61cd[_0xb5fa('0x26')]=_[_0xb5fa('0x25')](_0x6a455c[_0xb5fa('0x20')],qs[_0xb5fa('0x27')](_0x543edf[_0xb5fa('0x22')][_0xb5fa('0x27')]));_0x3f61cd[_0xb5fa('0x26')]=_0x3f61cd[_0xb5fa('0x26')][_0xb5fa('0x28')]?_0x3f61cd[_0xb5fa('0x26')]:_0x6a455c['model'];if(!_0x543edf[_0xb5fa('0x22')]['hasOwnProperty']('nolimit')){_0x3f61cd['limit']=qs[_0xb5fa('0xf')](_0x543edf['query'][_0xb5fa('0xf')]);_0x3f61cd['offset']=qs['offset'](_0x543edf[_0xb5fa('0x22')][_0xb5fa('0xd')]);}_0x3f61cd['order']=qs['sort'](_0x543edf[_0xb5fa('0x22')][_0xb5fa('0x29')]);_0x3f61cd[_0xb5fa('0x2a')]=qs['filters'](_[_0xb5fa('0x2b')](_0x543edf[_0xb5fa('0x22')],_0x6a455c['filters']),_0x568870);if(_0x543edf[_0xb5fa('0x22')][_0xb5fa('0x2c')]){_0x3f61cd[_0xb5fa('0x2a')]=_['merge'](_0x3f61cd[_0xb5fa('0x2a')],{'$or':_[_0xb5fa('0x21')](_0x568870,function(_0x24ef11){if(_0x24ef11['type']!==_0xb5fa('0x2d')){var _0x1c818f={};_0x1c818f[_0x24ef11[_0xb5fa('0x1a')]]={'$like':'%'+_0x543edf[_0xb5fa('0x22')]['filter']+'%'};return _0x1c818f;}})});}_0x3f61cd=_['merge']({},_0x3f61cd,_0x543edf['options']);var _0x49e786={'where':_0x3f61cd['where']};return db['SquareProject'][_0xb5fa('0x10')](_0x49e786)['then'](function(_0x43de71){_0x20d649[_0xb5fa('0x10')]=_0x43de71;if(_0x543edf[_0xb5fa('0x22')][_0xb5fa('0x2e')]){_0x3f61cd[_0xb5fa('0x2f')]=[{'all':!![]}];}return db[_0xb5fa('0x30')]['findAll'](_0x3f61cd);})['then'](function(_0x4c4bf0){_0x20d649[_0xb5fa('0x31')]=_0x4c4bf0;return _0x20d649;})['then'](respondWithFilteredResult(_0x2dbd22,_0x3f61cd))[_0xb5fa('0x32')](handleError(_0x2dbd22,null));};exports['show']=function(_0x58aa97,_0x3cdf63){var _0x42d331={'raw':![],'where':{'id':_0x58aa97[_0xb5fa('0x33')]['id']}},_0x2e056e={};_0x2e056e[_0xb5fa('0x20')]=_[_0xb5fa('0x23')](db[_0xb5fa('0x30')][_0xb5fa('0x34')]);_0x2e056e[_0xb5fa('0x22')]=_[_0xb5fa('0x23')](_0x58aa97['query']);_0x2e056e[_0xb5fa('0x24')]=_['intersection'](_0x2e056e[_0xb5fa('0x20')],_0x2e056e[_0xb5fa('0x22')]);_0x42d331[_0xb5fa('0x26')]=_[_0xb5fa('0x25')](_0x2e056e[_0xb5fa('0x20')],qs[_0xb5fa('0x27')](_0x58aa97[_0xb5fa('0x22')][_0xb5fa('0x27')]));_0x42d331['attributes']=_0x42d331[_0xb5fa('0x26')][_0xb5fa('0x28')]?_0x42d331['attributes']:_0x2e056e[_0xb5fa('0x20')];if(_0x58aa97['query'][_0xb5fa('0x2e')]){_0x42d331[_0xb5fa('0x2f')]=[{'all':!![]}];}_0x42d331=_['merge']({},_0x42d331,_0x58aa97['options']);return db[_0xb5fa('0x30')][_0xb5fa('0x35')](_0x42d331)[_0xb5fa('0x13')](handleEntityNotFound(_0x3cdf63,null))[_0xb5fa('0x13')](respondWithResult(_0x3cdf63,null))[_0xb5fa('0x32')](handleError(_0x3cdf63,null));};exports[_0xb5fa('0x36')]=function(_0x10f354,_0x125a5c){return db['SquareProject'][_0xb5fa('0x36')](_0x10f354[_0xb5fa('0x37')],{})['then'](function(_0xee6baa){var _0x2c378a=_0x10f354[_0xb5fa('0x38')][_0xb5fa('0x14')]({'plain':!![]});if(!_0x2c378a)throw new Error(_0xb5fa('0x39'));if(_0x2c378a[_0xb5fa('0x3a')]===_0xb5fa('0x38')){var _0x33eb2c=_0xee6baa[_0xb5fa('0x14')]({'plain':!![]});var _0x464e36=_0xb5fa('0x15');return db[_0xb5fa('0x3b')][_0xb5fa('0x35')]({'where':{'name':_0x464e36,'userProfileId':_0x2c378a[_0xb5fa('0x3c')]},'raw':!![]})[_0xb5fa('0x13')](function(_0x3a39f2){if(_0x3a39f2&&_0x3a39f2['autoAssociation']===0x0){return db['UserProfileResource'][_0xb5fa('0x36')]({'name':_0x33eb2c['name'],'resourceId':_0x33eb2c['id'],'type':_0x3a39f2[_0xb5fa('0x1a')],'sectionId':_0x3a39f2['id']},{})[_0xb5fa('0x13')](function(){return _0xee6baa;});}else{return _0xee6baa;}})['catch'](function(_0x4ef1d0){logger[_0xb5fa('0x19')](_0xb5fa('0x3d'),_0x4ef1d0);throw _0x4ef1d0;});}return _0xee6baa;})[_0xb5fa('0x13')](respondWithResult(_0x125a5c,0xc9))[_0xb5fa('0x32')](handleError(_0x125a5c,null));};exports[_0xb5fa('0x11')]=function(_0x51d5f7,_0x27a651){if(_0x51d5f7['body']['id']){delete _0x51d5f7[_0xb5fa('0x37')]['id'];}return db[_0xb5fa('0x30')][_0xb5fa('0x35')]({'where':{'id':_0x51d5f7['params']['id']}})[_0xb5fa('0x13')](handleEntityNotFound(_0x27a651,null))[_0xb5fa('0x13')](saveUpdates(_0x51d5f7['body'],null))['then'](function(_0x3f19ee){if(!_0x3f19ee)return;var _0x9ec8c0=_0x3f19ee[_0xb5fa('0x14')]({'plain':!![]});return _0x9ec8c0;})[_0xb5fa('0x13')](function(_0x353fed){var _0x7775b4=new Redis(config[_0xb5fa('0x6')]);_0x7775b4[_0xb5fa('0x3e')](_0xb5fa('0x17'),JSON[_0xb5fa('0x3f')](_[_0xb5fa('0x2b')](_0x353fed,['id',_0xb5fa('0x1a'),_0xb5fa('0x40')])));return _0x353fed;})[_0xb5fa('0x13')](respondWithResult(_0x27a651,null))[_0xb5fa('0x32')](handleError(_0x27a651,null));};exports[_0xb5fa('0x12')]=function(_0x10830a,_0x24acea){return db['SquareProject'][_0xb5fa('0x35')]({'where':{'id':_0x10830a[_0xb5fa('0x33')]['id']}})[_0xb5fa('0x13')](handleEntityNotFound(_0x24acea,null))[_0xb5fa('0x13')](removeEntity(_0x24acea,null))[_0xb5fa('0x32')](handleError(_0x24acea,null));};exports[_0xb5fa('0x41')]=function(_0x4224cf,_0x24117e){return db[_0xb5fa('0x30')][_0xb5fa('0x35')]({'where':{'id':_0x4224cf['params']['id']}})['then'](handleEntityNotFound(_0x24117e,null))[_0xb5fa('0x13')](function(_0x264732){if(_0x264732){return _0x264732[_0xb5fa('0x41')](_0x4224cf['body'][_0xb5fa('0x42')],_[_0xb5fa('0x43')](_0x4224cf[_0xb5fa('0x37')],[_0xb5fa('0x42'),'id'])||{});}})[_0xb5fa('0x13')](respondWithResult(_0x24117e,null))[_0xb5fa('0x32')](handleError(_0x24117e,null));};exports[_0xb5fa('0x44')]=function(_0x4f82f0,_0x7bcd09){return db[_0xb5fa('0x30')]['find']({'where':{'id':_0x4f82f0[_0xb5fa('0x33')]['id']}})[_0xb5fa('0x13')](handleEntityNotFound(_0x7bcd09,null))['then'](function(_0xd94224){if(_0xd94224){return _0xd94224[_0xb5fa('0x44')](_0x4f82f0[_0xb5fa('0x22')][_0xb5fa('0x42')])[_0xb5fa('0x13')](function(){if(_[_0xb5fa('0x45')](_0x4f82f0[_0xb5fa('0x22')][_0xb5fa('0x42')])){for(var _0xd2ba4e=0x0;_0xd2ba4e<_0x4f82f0[_0xb5fa('0x22')][_0xb5fa('0x42')][_0xb5fa('0x28')];_0xd2ba4e+=0x1){socket[_0xb5fa('0x46')](_0xb5fa('0x47'),{'UserId':Number(_0x4f82f0[_0xb5fa('0x22')][_0xb5fa('0x42')][_0xd2ba4e]),'SquareProjectId':Number(_0x4f82f0[_0xb5fa('0x33')]['id'])});}}else{socket[_0xb5fa('0x46')](_0xb5fa('0x47'),{'UserId':Number(_0x4f82f0[_0xb5fa('0x22')][_0xb5fa('0x42')]),'SquareProjectId':Number(_0x4f82f0[_0xb5fa('0x33')]['id'])});}});}})['then'](respondWithStatusCode(_0x7bcd09,null))[_0xb5fa('0x32')](handleError(_0x7bcd09,null));};exports[_0xb5fa('0x48')]=function(_0x43692b,_0x580d1a){var _0x32ab33={};var _0x2d786e={};var _0x58d394;var _0x44fd4a;return db[_0xb5fa('0x30')][_0xb5fa('0x49')]({'where':{'id':_0x43692b['params']['id']}})['then'](handleEntityNotFound(_0x580d1a,null))[_0xb5fa('0x13')](function(_0x2b518d){if(_0x2b518d){_0x58d394=_0x2b518d;_0x2d786e[_0xb5fa('0x20')]=_['keys'](db[_0xb5fa('0x4a')][_0xb5fa('0x34')]);_0x2d786e[_0xb5fa('0x22')]=_[_0xb5fa('0x23')](_0x43692b['query']);_0x2d786e['filters']=_['intersection'](_0x2d786e[_0xb5fa('0x20')],_0x2d786e[_0xb5fa('0x22')]);_0x32ab33[_0xb5fa('0x26')]=_['intersection'](_0x2d786e[_0xb5fa('0x20')],qs[_0xb5fa('0x27')](_0x43692b[_0xb5fa('0x22')][_0xb5fa('0x27')]));_0x32ab33[_0xb5fa('0x26')]=_0x32ab33[_0xb5fa('0x26')][_0xb5fa('0x28')]?_0x32ab33[_0xb5fa('0x26')]:_0x2d786e[_0xb5fa('0x20')];_0x32ab33[_0xb5fa('0x4b')]=qs[_0xb5fa('0x29')](_0x43692b[_0xb5fa('0x22')][_0xb5fa('0x29')]);_0x32ab33[_0xb5fa('0x2a')]=qs[_0xb5fa('0x24')](_['pick'](_0x43692b[_0xb5fa('0x22')],_0x2d786e['filters']));if(_0x43692b[_0xb5fa('0x22')][_0xb5fa('0x2c')]){_0x32ab33[_0xb5fa('0x2a')]=_[_0xb5fa('0x4c')](_0x32ab33[_0xb5fa('0x2a')],{'$or':_['map'](_0x32ab33[_0xb5fa('0x26')],function(_0x589c29){var _0x77a831={};_0x77a831[_0x589c29]={'$like':'%'+_0x43692b[_0xb5fa('0x22')][_0xb5fa('0x2c')]+'%'};return _0x77a831;})});}_0x32ab33=_[_0xb5fa('0x4c')]({},_0x32ab33,_0x43692b['options']);return _0x58d394['getUsers'](_0x32ab33);}})['then'](function(_0x78a34c){if(_0x78a34c){_0x44fd4a=_0x78a34c[_0xb5fa('0x28')];if(!_0x43692b[_0xb5fa('0x22')][_0xb5fa('0x4d')](_0xb5fa('0x4e'))){_0x32ab33[_0xb5fa('0xf')]=qs['limit'](_0x43692b[_0xb5fa('0x22')]['limit']);_0x32ab33['offset']=qs[_0xb5fa('0xd')](_0x43692b['query']['offset']);}return _0x58d394['getUsers'](_0x32ab33);}})[_0xb5fa('0x13')](function(_0x5cbd84){if(_0x5cbd84){return _0x5cbd84?{'count':_0x44fd4a,'rows':_0x5cbd84}:null;}})[_0xb5fa('0x13')](respondWithResult(_0x580d1a,null))[_0xb5fa('0x32')](handleError(_0x580d1a,null));};
\ No newline at end of file
index 937ced2..c1a4499 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x159d=['save','remove','emit','hasOwnProperty','hook','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x2afaf3,_0x4ebf7a){var _0xf45003=function(_0x1db360){while(--_0x1db360){_0x2afaf3['push'](_0x2afaf3['shift']());}};_0xf45003(++_0x4ebf7a);}(_0x159d,0x1cd));var _0xd159=function(_0x28f2de,_0xd9915a){_0x28f2de=_0x28f2de-0x0;var _0x32428e=_0x159d[_0x28f2de];return _0x32428e;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xd159('0x0'))['db'][_0xd159('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd159('0x2')](0x0);var events={'afterCreate':_0xd159('0x3'),'afterUpdate':'update','afterDestroy':_0xd159('0x4')};function emitEvent(_0x1770f7){return function(_0x50dad0,_0x390e00,_0x1aa44d){SquareProjectEvents[_0xd159('0x5')](_0x1770f7+':'+_0x50dad0['id'],_0x50dad0);SquareProjectEvents[_0xd159('0x5')](_0x1770f7,_0x50dad0);_0x1aa44d(null);};}for(var e in events){if(events[_0xd159('0x6')](e)){var event=events[e];SquareProject[_0xd159('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents;
\ No newline at end of file
+var _0xb358=['emit','hasOwnProperty','exports','SquareProject','setMaxListeners','save','update','remove'];(function(_0x4d2e9d,_0x22f768){var _0x1b6581=function(_0x12e967){while(--_0x12e967){_0x4d2e9d['push'](_0x4d2e9d['shift']());}};_0x1b6581(++_0x22f768);}(_0xb358,0xb3));var _0x8b35=function(_0x52fe17,_0x2af32a){_0x52fe17=_0x52fe17-0x0;var _0x5af586=_0xb358[_0x52fe17];return _0x5af586;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x8b35('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8b35('0x1')](0x0);var events={'afterCreate':_0x8b35('0x2'),'afterUpdate':_0x8b35('0x3'),'afterDestroy':_0x8b35('0x4')};function emitEvent(_0x148cb2){return function(_0x3c7491,_0x312526,_0x10bdbc){SquareProjectEvents[_0x8b35('0x5')](_0x148cb2+':'+_0x3c7491['id'],_0x3c7491);SquareProjectEvents[_0x8b35('0x5')](_0x148cb2,_0x3c7491);_0x10bdbc(null);};}for(var e in events){if(events[_0x8b35('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x8b35('0x7')]=SquareProjectEvents;
\ No newline at end of file
index b95050d..2448ae0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2a8b=['path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','production','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2df1c0,_0x50b30f){var _0x26abb=function(_0x2183c5){while(--_0x2183c5){_0x2df1c0['push'](_0x2df1c0['shift']());}};_0x26abb(++_0x50b30f);}(_0x2a8b,0xcb));var _0xb2a8=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x2a8b[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xb2a8('0x0'));var util=require(_0xb2a8('0x1'));var logger=require(_0xb2a8('0x2'))(_0xb2a8('0x3'));var moment=require(_0xb2a8('0x4'));var BPromise=require(_0xb2a8('0x5'));var rp=require(_0xb2a8('0x6'));var fs=require('fs');var path=require(_0xb2a8('0x7'));var rimraf=require(_0xb2a8('0x8'));var config=require(_0xb2a8('0x9'));var attributes=require(_0xb2a8('0xa'));module[_0xb2a8('0xb')]=function(_0x1dff13,_0x2eb3ad){return _0x1dff13[_0xb2a8('0xc')](_0xb2a8('0xd'),attributes,{'tableName':_0xb2a8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x457197,_0x54fae4,_0x1fbe39){if(_0x457197[_0xb2a8('0xf')](_0xb2a8('0x10'))){_0x457197[_0xb2a8('0x11')]=moment()[_0xb2a8('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x457197[_0xb2a8('0xf')](_0xb2a8('0x13'))){_0x457197['publishedAt']=moment()['format'](_0xb2a8('0x14'));}_0x1fbe39(null,_0x457197);}}});};
\ No newline at end of file
+var _0xdf20=['path','../../config/environment','exports','define','SquareProject','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x385c76,_0xb97335){var _0x5c8367=function(_0xdfcd3){while(--_0xdfcd3){_0x385c76['push'](_0x385c76['shift']());}};_0x5c8367(++_0xb97335);}(_0xdf20,0x13d));var _0x0df2=function(_0x1af631,_0x3a286d){_0x1af631=_0x1af631-0x0;var _0x54cc7e=_0xdf20[_0x1af631];return _0x54cc7e;};'use strict';var _=require('lodash');var util=require(_0x0df2('0x0'));var logger=require(_0x0df2('0x1'))(_0x0df2('0x2'));var moment=require(_0x0df2('0x3'));var BPromise=require(_0x0df2('0x4'));var rp=require(_0x0df2('0x5'));var fs=require('fs');var path=require(_0x0df2('0x6'));var rimraf=require('rimraf');var config=require(_0x0df2('0x7'));var attributes=require('./squareProject.attributes');module[_0x0df2('0x8')]=function(_0x5c45ad,_0x514436){return _0x5c45ad[_0x0df2('0x9')](_0x0df2('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15c940,_0x28fe9d,_0x2db653){if(_0x15c940['changed'](_0x0df2('0xb'))){_0x15c940[_0x0df2('0xc')]=moment()[_0x0df2('0xd')](_0x0df2('0xe'));}if(_0x15c940[_0x0df2('0xf')](_0x0df2('0x10'))){_0x15c940['publishedAt']=moment()['format'](_0x0df2('0xe'));}_0x2db653(null,_0x15c940);}}});};
\ No newline at end of file
index 6926497..213f6b7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0899=['ShowSquareProject','lodash','ioredis','../../config/logger','rpc','../../config/environment','redis','defaults','./squareProject.socket','register','SquareProject','findAll','options','where','attributes','limit','include','model','map','then','info','GetSquareProjects','debug','stringify','catch','error','message','find','raw'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0x0899,0xcc));var _0x9089=function(_0x2c3135,_0x38e21f){_0x2c3135=_0x2c3135-0x0;var _0x333704=_0x0899[_0x2c3135];return _0x333704;};'use strict';var _=require(_0x9089('0x0'));var Redis=require(_0x9089('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x9089('0x2'))(_0x9089('0x3'));var config=require(_0x9089('0x4'));config[_0x9089('0x5')]=_[_0x9089('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9089('0x5')]));require(_0x9089('0x7'))[_0x9089('0x8')](socket);exports['GetSquareProjects']=function(_0x3b2615){var _0x4c0333=this;return new Promise(function(_0x4d1e55,_0x5125e9){return db[_0x9089('0x9')][_0x9089('0xa')]({'raw':_0x3b2615[_0x9089('0xb')]?_0x3b2615[_0x9089('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x3b2615[_0x9089('0xb')]?_0x3b2615[_0x9089('0xb')][_0x9089('0xc')]||null:null,'attributes':_0x3b2615[_0x9089('0xb')]?_0x3b2615['options'][_0x9089('0xd')]||null:null,'limit':_0x3b2615[_0x9089('0xb')]?_0x3b2615['options'][_0x9089('0xe')]||null:null,'include':_0x3b2615[_0x9089('0xb')]?_0x3b2615['options'][_0x9089('0xf')]?_['map'](_0x3b2615[_0x9089('0xb')][_0x9089('0xf')],function(_0x252ce6){return{'model':db[_0x252ce6[_0x9089('0x10')]],'as':_0x252ce6['as'],'attributes':_0x252ce6['attributes'],'include':_0x252ce6['include']?_[_0x9089('0x11')](_0x252ce6[_0x9089('0xf')],function(_0xeada37){return{'model':db[_0xeada37[_0x9089('0x10')]],'as':_0xeada37['as'],'attributes':_0xeada37[_0x9089('0xd')],'include':_0xeada37[_0x9089('0xf')]?_[_0x9089('0x11')](_0xeada37[_0x9089('0xf')],function(_0x306260){return{'model':db[_0x306260[_0x9089('0x10')]],'as':_0x306260['as'],'attributes':_0x306260[_0x9089('0xd')]};}):[]};}):[]};}):[]:[]})[_0x9089('0x12')](function(_0x57adaf){logger[_0x9089('0x13')](_0x9089('0x14'),_0x3b2615);logger[_0x9089('0x15')](_0x9089('0x14'),_0x3b2615,JSON[_0x9089('0x16')](_0x57adaf));_0x4d1e55(_0x57adaf);})[_0x9089('0x17')](function(_0xbc3652){logger[_0x9089('0x18')](_0x9089('0x14'),_0xbc3652[_0x9089('0x19')],_0x3b2615);_0x5125e9(_0x4c0333[_0x9089('0x18')](0x1f4,_0xbc3652['message']));});});};exports['ShowSquareProject']=function(_0x531fca){var _0x38b215=this;return new Promise(function(_0x6124f3,_0x326a49){return db[_0x9089('0x9')][_0x9089('0x1a')]({'raw':_0x531fca[_0x9089('0xb')]?_0x531fca[_0x9089('0xb')][_0x9089('0x1b')]===undefined?!![]:![]:!![],'where':_0x531fca[_0x9089('0xb')]?_0x531fca[_0x9089('0xb')]['where']||null:null,'attributes':_0x531fca[_0x9089('0xb')]?_0x531fca['options'][_0x9089('0xd')]||null:null,'include':_0x531fca[_0x9089('0xb')]?_0x531fca[_0x9089('0xb')][_0x9089('0xf')]?_[_0x9089('0x11')](_0x531fca['options'][_0x9089('0xf')],function(_0x3748fe){return{'model':db[_0x3748fe[_0x9089('0x10')]],'as':_0x3748fe['as'],'attributes':_0x3748fe[_0x9089('0xd')],'include':_0x3748fe['include']?_[_0x9089('0x11')](_0x3748fe[_0x9089('0xf')],function(_0x10cfd4){return{'model':db[_0x10cfd4[_0x9089('0x10')]],'as':_0x10cfd4['as'],'attributes':_0x10cfd4[_0x9089('0xd')],'include':_0x10cfd4[_0x9089('0xf')]?_[_0x9089('0x11')](_0x10cfd4['include'],function(_0x37a8a2){return{'model':db[_0x37a8a2[_0x9089('0x10')]],'as':_0x37a8a2['as'],'attributes':_0x37a8a2[_0x9089('0xd')]};}):[]};}):[]};}):[]:[]})[_0x9089('0x12')](function(_0x189e5f){logger[_0x9089('0x13')](_0x9089('0x1c'),_0x531fca);logger[_0x9089('0x15')]('ShowSquareProject',_0x531fca,JSON[_0x9089('0x16')](_0x189e5f));_0x6124f3(_0x189e5f);})[_0x9089('0x17')](function(_0x26ccfb){logger[_0x9089('0x18')](_0x9089('0x1c'),_0x26ccfb['message'],_0x531fca);_0x326a49(_0x38b215[_0x9089('0x18')](0x1f4,_0x26ccfb[_0x9089('0x19')]));});});};
\ No newline at end of file
+var _0x6d79=['./squareProject.socket','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then','info','GetSquareProjects','debug','stringify','catch','message','error','ShowSquareProject','find','lodash','ioredis','../../mysqldb','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x5cdfb8,_0x41f1bf){var _0x563778=function(_0x428471){while(--_0x428471){_0x5cdfb8['push'](_0x5cdfb8['shift']());}};_0x563778(++_0x41f1bf);}(_0x6d79,0x1b9));var _0x96d7=function(_0x542233,_0x1cf901){_0x542233=_0x542233-0x0;var _0x3ea9f6=_0x6d79[_0x542233];return _0x3ea9f6;};'use strict';var _=require(_0x96d7('0x0'));var Redis=require(_0x96d7('0x1'));var db=require(_0x96d7('0x2'))['db'];var logger=require('../../config/logger')(_0x96d7('0x3'));var config=require(_0x96d7('0x4'));config[_0x96d7('0x5')]=_[_0x96d7('0x6')](config['redis'],{'host':_0x96d7('0x7'),'port':0x18eb});var socket=require(_0x96d7('0x8'))(new Redis(config[_0x96d7('0x5')]));require(_0x96d7('0x9'))['register'](socket);exports['GetSquareProjects']=function(_0x428fcd){var _0x608838=this;return new Promise(function(_0x3b5ef8,_0x3e2af4){return db[_0x96d7('0xa')][_0x96d7('0xb')]({'raw':_0x428fcd[_0x96d7('0xc')]?_0x428fcd[_0x96d7('0xc')][_0x96d7('0xd')]===undefined?!![]:![]:!![],'where':_0x428fcd[_0x96d7('0xc')]?_0x428fcd['options'][_0x96d7('0xe')]||null:null,'attributes':_0x428fcd[_0x96d7('0xc')]?_0x428fcd['options'][_0x96d7('0xf')]||null:null,'limit':_0x428fcd[_0x96d7('0xc')]?_0x428fcd['options'][_0x96d7('0x10')]||null:null,'include':_0x428fcd[_0x96d7('0xc')]?_0x428fcd[_0x96d7('0xc')][_0x96d7('0x11')]?_[_0x96d7('0x12')](_0x428fcd[_0x96d7('0xc')][_0x96d7('0x11')],function(_0x433d71){return{'model':db[_0x433d71['model']],'as':_0x433d71['as'],'attributes':_0x433d71[_0x96d7('0xf')],'include':_0x433d71[_0x96d7('0x11')]?_[_0x96d7('0x12')](_0x433d71['include'],function(_0x368512){return{'model':db[_0x368512[_0x96d7('0x13')]],'as':_0x368512['as'],'attributes':_0x368512[_0x96d7('0xf')],'include':_0x368512[_0x96d7('0x11')]?_[_0x96d7('0x12')](_0x368512[_0x96d7('0x11')],function(_0x28c3dd){return{'model':db[_0x28c3dd['model']],'as':_0x28c3dd['as'],'attributes':_0x28c3dd[_0x96d7('0xf')]};}):[]};}):[]};}):[]:[]})[_0x96d7('0x14')](function(_0x1ac588){logger[_0x96d7('0x15')](_0x96d7('0x16'),_0x428fcd);logger[_0x96d7('0x17')](_0x96d7('0x16'),_0x428fcd,JSON[_0x96d7('0x18')](_0x1ac588));_0x3b5ef8(_0x1ac588);})[_0x96d7('0x19')](function(_0x2148ac){logger['error'](_0x96d7('0x16'),_0x2148ac[_0x96d7('0x1a')],_0x428fcd);_0x3e2af4(_0x608838[_0x96d7('0x1b')](0x1f4,_0x2148ac[_0x96d7('0x1a')]));});});};exports[_0x96d7('0x1c')]=function(_0x1ce9bf){var _0xad4a1c=this;return new Promise(function(_0x2759b8,_0xf57ec9){return db['SquareProject'][_0x96d7('0x1d')]({'raw':_0x1ce9bf[_0x96d7('0xc')]?_0x1ce9bf[_0x96d7('0xc')][_0x96d7('0xd')]===undefined?!![]:![]:!![],'where':_0x1ce9bf[_0x96d7('0xc')]?_0x1ce9bf[_0x96d7('0xc')]['where']||null:null,'attributes':_0x1ce9bf[_0x96d7('0xc')]?_0x1ce9bf[_0x96d7('0xc')][_0x96d7('0xf')]||null:null,'include':_0x1ce9bf[_0x96d7('0xc')]?_0x1ce9bf[_0x96d7('0xc')][_0x96d7('0x11')]?_[_0x96d7('0x12')](_0x1ce9bf[_0x96d7('0xc')][_0x96d7('0x11')],function(_0x4bfea5){return{'model':db[_0x4bfea5['model']],'as':_0x4bfea5['as'],'attributes':_0x4bfea5[_0x96d7('0xf')],'include':_0x4bfea5[_0x96d7('0x11')]?_[_0x96d7('0x12')](_0x4bfea5[_0x96d7('0x11')],function(_0x2a2ded){return{'model':db[_0x2a2ded[_0x96d7('0x13')]],'as':_0x2a2ded['as'],'attributes':_0x2a2ded[_0x96d7('0xf')],'include':_0x2a2ded[_0x96d7('0x11')]?_[_0x96d7('0x12')](_0x2a2ded[_0x96d7('0x11')],function(_0x1d9bbb){return{'model':db[_0x1d9bbb[_0x96d7('0x13')]],'as':_0x1d9bbb['as'],'attributes':_0x1d9bbb[_0x96d7('0xf')]};}):[]};}):[]};}):[]:[]})[_0x96d7('0x14')](function(_0x9e86ff){logger[_0x96d7('0x15')]('ShowSquareProject',_0x1ce9bf);logger[_0x96d7('0x17')](_0x96d7('0x1c'),_0x1ce9bf,JSON[_0x96d7('0x18')](_0x9e86ff));_0x2759b8(_0x9e86ff);})['catch'](function(_0x4e5155){logger[_0x96d7('0x1b')](_0x96d7('0x1c'),_0x4e5155[_0x96d7('0x1a')],_0x1ce9bf);_0xf57ec9(_0xad4a1c[_0x96d7('0x1b')](0x1f4,_0x4e5155[_0x96d7('0x1a')]));});});};
\ No newline at end of file
index 01d5484..7f81fae 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9308=['./squareProject.events','save','remove','update','emit','removeListener','register','length','squareProject:'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x9308,0xf3));var _0x8930=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9308[_0x3bf83f];return _0x22c4a9;};'use strict';var SquareProjectEvents=require(_0x8930('0x0'));var events=[_0x8930('0x1'),_0x8930('0x2'),_0x8930('0x3')];function createListener(_0x48ef32,_0x453088){return function(_0x1c6b32){_0x453088[_0x8930('0x4')](_0x48ef32,_0x1c6b32);};}function removeListener(_0x257a77,_0xed8ca2){return function(){SquareProjectEvents[_0x8930('0x5')](_0x257a77,_0xed8ca2);};}exports[_0x8930('0x6')]=function(_0x583750){for(var _0x1425b0=0x0,_0x15e2fe=events[_0x8930('0x7')];_0x1425b0<_0x15e2fe;_0x1425b0++){var _0x2fb048=events[_0x1425b0];var _0x558e62=createListener(_0x8930('0x8')+_0x2fb048,_0x583750);SquareProjectEvents['on'](_0x2fb048,_0x558e62);}};
\ No newline at end of file
+var _0xc338=['save','remove','emit','removeListener','length','squareProject:'];(function(_0x207628,_0x20b427){var _0x4466e5=function(_0x5b7059){while(--_0x5b7059){_0x207628['push'](_0x207628['shift']());}};_0x4466e5(++_0x20b427);}(_0xc338,0x138));var _0x8c33=function(_0x35a39a,_0xba4f77){_0x35a39a=_0x35a39a-0x0;var _0x45a3ba=_0xc338[_0x35a39a];return _0x45a3ba;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x8c33('0x0'),_0x8c33('0x1'),'update'];function createListener(_0x5567b0,_0x3ad84b){return function(_0x381f3a){_0x3ad84b[_0x8c33('0x2')](_0x5567b0,_0x381f3a);};}function removeListener(_0x1cd745,_0x4b6974){return function(){SquareProjectEvents[_0x8c33('0x3')](_0x1cd745,_0x4b6974);};}exports['register']=function(_0x300555){for(var _0x4da35a=0x0,_0x133245=events[_0x8c33('0x4')];_0x4da35a<_0x133245;_0x4da35a++){var _0x10b1f3=events[_0x4da35a];var _0x3a6fef=createListener(_0x8c33('0x5')+_0x10b1f3,_0x300555);SquareProjectEvents['on'](_0x10b1f3,_0x3a6fef);}};
\ No newline at end of file
index 9f81ab8..6554826 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x431c9e,_0x311a07){var _0x1cd76d=function(_0x4ee038){while(--_0x4ee038){_0x431c9e['push'](_0x431c9e['shift']());}};_0x1cd76d(++_0x311a07);}(_0xf494,0x1c6));var _0x4f49=function(_0x1b72d6,_0x2e78ea){_0x1b72d6=_0x1b72d6-0x0;var _0x3be058=_0xf494[_0x1b72d6];return _0x3be058;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router;
\ No newline at end of file
+var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x53ffb5,_0x368af2){var _0x1c39a7=function(_0x5312ad){while(--_0x5312ad){_0x53ffb5['push'](_0x53ffb5['shift']());}};_0x1c39a7(++_0x368af2);}(_0x814b,0x1a2));var _0xb814=function(_0xb98d8d,_0x481423){_0xb98d8d=_0xb98d8d-0x0;var _0x489b15=_0x814b[_0xb98d8d];return _0x489b15;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router;
\ No newline at end of file
index 06ff14f..e6bee1e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7c09=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x5244df,_0x1b2ce5){var _0x1e009b=function(_0x566bf3){while(--_0x566bf3){_0x5244df['push'](_0x5244df['shift']());}};_0x1e009b(++_0x1b2ce5);}(_0x7c09,0x102));var _0x97c0=function(_0xc75055,_0x396e87){_0xc75055=_0xc75055-0x0;var _0x541a2f=_0x7c09[_0xc75055];return _0x541a2f;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'uniqueid':{'type':Sequelize[_0x97c0('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97c0('0x1')]},'context':{'type':Sequelize[_0x97c0('0x1')]},'extension':{'type':Sequelize[_0x97c0('0x1')]},'priority':{'type':Sequelize[_0x97c0('0x1')]},'accountcode':{'type':Sequelize[_0x97c0('0x1')]},'dnid':{'type':Sequelize[_0x97c0('0x1')]},'projectName':{'type':Sequelize[_0x97c0('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x97c0('0x2')],'get':function(){var _0x42c6c7='';var _0x2c19fa=this[_0x97c0('0x3')](_0x97c0('0x4'));if(_0x2c19fa){_0x42c6c7=_0x2c19fa['substring'](_0x2c19fa[_0x97c0('0x5')]('.'));}return _0x42c6c7;}}};
\ No newline at end of file
+var _0xeec6=['sequelize','exports','STRING','getDataValue','savePath','lastIndexOf'];(function(_0x1dbeb9,_0x317cbe){var _0x3be217=function(_0x101ff1){while(--_0x101ff1){_0x1dbeb9['push'](_0x1dbeb9['shift']());}};_0x3be217(++_0x317cbe);}(_0xeec6,0x1c2));var _0x6eec=function(_0x1e4f2f,_0x35edfa){_0x1e4f2f=_0x1e4f2f-0x0;var _0xccea89=_0xeec6[_0x1e4f2f];return _0xccea89;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'uniqueid':{'type':Sequelize[_0x6eec('0x2')]},'callerid':{'type':Sequelize[_0x6eec('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6eec('0x2')]},'extension':{'type':Sequelize[_0x6eec('0x2')]},'priority':{'type':Sequelize[_0x6eec('0x2')]},'accountcode':{'type':Sequelize[_0x6eec('0x2')]},'dnid':{'type':Sequelize[_0x6eec('0x2')]},'projectName':{'type':Sequelize[_0x6eec('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x6eec('0x2')]},'savePath':{'type':Sequelize[_0x6eec('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x5a5e47='';var _0x1c810e=this[_0x6eec('0x3')](_0x6eec('0x4'));if(_0x1c810e){_0x5a5e47=_0x1c810e['substring'](_0x1c810e[_0x6eec('0x5')]('.'));}return _0x5a5e47;}}};
\ No newline at end of file
index 4fdee61..500b22a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8462=['rawAttributes','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','decryptFile','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','existsSync','File:\x20\x22','unlinkSync','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','SquareRecording'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x8462,0x1a3));var _0x2846=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x8462[_0x4b174a];return _0x3cd7bf;};'use strict';var emlformat=require(_0x2846('0x0'));var rimraf=require(_0x2846('0x1'));var zipdir=require(_0x2846('0x2'));var jsonpatch=require(_0x2846('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2846('0x4'));var Mustache=require('mustache');var util=require(_0x2846('0x5'));var path=require(_0x2846('0x6'));var sox=require(_0x2846('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2846('0x8'));var _=require(_0x2846('0x9'));var squel=require(_0x2846('0xa'));var crypto=require(_0x2846('0xb'));var jsforce=require(_0x2846('0xc'));var deskjs=require(_0x2846('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2846('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2846('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2846('0x10'))('api');var utils=require(_0x2846('0x11'));var config=require(_0x2846('0x12'));var licenseUtil=require(_0x2846('0x13'));var db=require(_0x2846('0x14'))['db'];function respondWithStatusCode(_0x16f760,_0x28d827){_0x28d827=_0x28d827||0xcc;return function(_0x5baa71){if(_0x5baa71){return _0x16f760['sendStatus'](_0x28d827);}return _0x16f760[_0x2846('0x15')](_0x28d827)[_0x2846('0x16')]();};}function respondWithResult(_0x53497d,_0x5c0db8){_0x5c0db8=_0x5c0db8||0xc8;return function(_0x41f06a){if(_0x41f06a){return _0x53497d[_0x2846('0x15')](_0x5c0db8)[_0x2846('0x17')](_0x41f06a);}};}function respondWithFilteredResult(_0x4f5709,_0x5d65ce){return function(_0x67cc62){if(_0x67cc62){var _0x243c09=typeof _0x5d65ce[_0x2846('0x18')]===_0x2846('0x19')&&typeof _0x5d65ce[_0x2846('0x1a')]===_0x2846('0x19');var _0x38c70d=_0x67cc62[_0x2846('0x1b')];var _0x27f169=_0x243c09?0x0:_0x5d65ce[_0x2846('0x18')];var _0x261b25=_0x243c09?_0x67cc62['count']:_0x5d65ce['offset']+_0x5d65ce[_0x2846('0x1a')];var _0x550a28;if(_0x261b25>=_0x38c70d){_0x261b25=_0x38c70d;_0x550a28=0xc8;}else{_0x550a28=0xce;}_0x4f5709[_0x2846('0x15')](_0x550a28);return _0x4f5709[_0x2846('0x1c')](_0x2846('0x1d'),_0x27f169+'-'+_0x261b25+'/'+_0x38c70d)['json'](_0x67cc62);}return null;};}function patchUpdates(_0x49240a){return function(_0x97b5a6){try{jsonpatch['apply'](_0x97b5a6,_0x49240a,!![]);}catch(_0x18ec7c){return BPromise[_0x2846('0x1e')](_0x18ec7c);}return _0x97b5a6[_0x2846('0x1f')]();};}function saveUpdates(_0x39d739,_0x5b4af2){return function(_0x16113f){if(_0x16113f){return _0x16113f[_0x2846('0x20')](_0x39d739)[_0x2846('0x21')](function(_0x597924){return _0x597924;});}return null;};}function removeEntity(_0x427fc3,_0x43c830){return function(_0x2f8ceb){if(_0x2f8ceb){return _0x2f8ceb[_0x2846('0x22')]()[_0x2846('0x21')](function(){_0x427fc3[_0x2846('0x15')](0xcc)[_0x2846('0x16')]();});}};}function handleEntityNotFound(_0x36cd4e,_0x1557ba){return function(_0x225093){if(!_0x225093){_0x36cd4e['sendStatus'](0x194);}return _0x225093;};}function handleError(_0x50259e,_0x25794e){_0x25794e=_0x25794e||0x1f4;return function(_0x21c141){logger[_0x2846('0x23')](_0x21c141[_0x2846('0x24')]);if(_0x21c141[_0x2846('0x25')]){delete _0x21c141[_0x2846('0x25')];}_0x50259e[_0x2846('0x15')](_0x25794e)['send'](_0x21c141);};}exports[_0x2846('0x26')]=function(_0x26bcdf,_0x3a65b8){var _0x5ab80c={},_0xdf33a9={},_0x1aa0cb={'count':0x0,'rows':[]};var _0x56b9a3=_[_0x2846('0x27')](db[_0x2846('0x28')][_0x2846('0x29')],function(_0x315f5f){return{'name':_0x315f5f['fieldName'],'type':_0x315f5f[_0x2846('0x2a')][_0x2846('0x2b')]};});_0xdf33a9['model']=_['map'](_0x56b9a3,_0x2846('0x25'));_0xdf33a9['query']=_[_0x2846('0x2c')](_0x26bcdf['query']);_0xdf33a9[_0x2846('0x2d')]=_[_0x2846('0x2e')](_0xdf33a9[_0x2846('0x2f')],_0xdf33a9[_0x2846('0x30')]);_0x5ab80c[_0x2846('0x31')]=_[_0x2846('0x2e')](_0xdf33a9['model'],qs['fields'](_0x26bcdf[_0x2846('0x30')][_0x2846('0x32')]));_0x5ab80c[_0x2846('0x31')]=_0x5ab80c[_0x2846('0x31')][_0x2846('0x33')]?_0x5ab80c[_0x2846('0x31')]:_0xdf33a9[_0x2846('0x2f')];if(!_0x26bcdf[_0x2846('0x30')][_0x2846('0x34')](_0x2846('0x35'))){_0x5ab80c[_0x2846('0x1a')]=qs[_0x2846('0x1a')](_0x26bcdf[_0x2846('0x30')][_0x2846('0x1a')]);_0x5ab80c['offset']=qs[_0x2846('0x18')](_0x26bcdf[_0x2846('0x30')]['offset']);}_0x5ab80c[_0x2846('0x36')]=qs['sort'](_0x26bcdf[_0x2846('0x30')]['sort']);_0x5ab80c[_0x2846('0x37')]=qs[_0x2846('0x2d')](_[_0x2846('0x38')](_0x26bcdf[_0x2846('0x30')],_0xdf33a9[_0x2846('0x2d')]),_0x56b9a3);if(_0x26bcdf[_0x2846('0x30')][_0x2846('0x39')]){_0x5ab80c[_0x2846('0x37')]=_[_0x2846('0x3a')](_0x5ab80c[_0x2846('0x37')],{'$or':_[_0x2846('0x27')](_0x56b9a3,function(_0x31e629){if(_0x31e629[_0x2846('0x2a')]!==_0x2846('0x3b')){var _0x20f6f9={};_0x20f6f9[_0x31e629['name']]={'$like':'%'+_0x26bcdf[_0x2846('0x30')][_0x2846('0x39')]+'%'};return _0x20f6f9;}})});}_0x5ab80c=_[_0x2846('0x3a')]({},_0x5ab80c,_0x26bcdf[_0x2846('0x3c')]);var _0x5a57cc={'where':_0x5ab80c[_0x2846('0x37')]};return db[_0x2846('0x28')]['count'](_0x5a57cc)[_0x2846('0x21')](function(_0x16653b){_0x1aa0cb[_0x2846('0x1b')]=_0x16653b;if(_0x26bcdf[_0x2846('0x30')]['includeAll']){_0x5ab80c[_0x2846('0x3d')]=[{'all':!![]}];}return db[_0x2846('0x28')][_0x2846('0x3e')](_0x5ab80c);})[_0x2846('0x21')](function(_0x25d2c5){_0x1aa0cb[_0x2846('0x3f')]=_0x25d2c5;return _0x1aa0cb;})[_0x2846('0x21')](respondWithFilteredResult(_0x3a65b8,_0x5ab80c))[_0x2846('0x40')](handleError(_0x3a65b8,null));};exports[_0x2846('0x41')]=function(_0x2e886f,_0x104b21){var _0x4881f1={'raw':!![],'where':{'id':_0x2e886f[_0x2846('0x42')]['id']}},_0x1c9073={};_0x1c9073['model']=_[_0x2846('0x2c')](db['SquareRecording'][_0x2846('0x29')]);_0x1c9073[_0x2846('0x30')]=_[_0x2846('0x2c')](_0x2e886f[_0x2846('0x30')]);_0x1c9073['filters']=_[_0x2846('0x2e')](_0x1c9073['model'],_0x1c9073[_0x2846('0x30')]);_0x4881f1[_0x2846('0x31')]=_[_0x2846('0x2e')](_0x1c9073[_0x2846('0x2f')],qs[_0x2846('0x32')](_0x2e886f[_0x2846('0x30')][_0x2846('0x32')]));_0x4881f1[_0x2846('0x31')]=_0x4881f1[_0x2846('0x31')][_0x2846('0x33')]?_0x4881f1['attributes']:_0x1c9073[_0x2846('0x2f')];if(_0x2e886f['query'][_0x2846('0x43')]){_0x4881f1[_0x2846('0x3d')]=[{'all':!![]}];}_0x4881f1=_[_0x2846('0x3a')]({},_0x4881f1,_0x2e886f[_0x2846('0x3c')]);return db[_0x2846('0x28')][_0x2846('0x44')](_0x4881f1)[_0x2846('0x21')](handleEntityNotFound(_0x104b21,null))[_0x2846('0x21')](respondWithResult(_0x104b21,null))[_0x2846('0x40')](handleError(_0x104b21,null));};exports[_0x2846('0x45')]=function(_0x5133a9,_0x244fc3){return db[_0x2846('0x28')]['create'](_0x5133a9[_0x2846('0x46')],{})['then'](respondWithResult(_0x244fc3,0xc9))[_0x2846('0x40')](handleError(_0x244fc3,null));};exports['update']=function(_0xe430dd,_0x2b3959){if(_0xe430dd[_0x2846('0x46')]['id']){delete _0xe430dd[_0x2846('0x46')]['id'];}return db[_0x2846('0x28')][_0x2846('0x44')]({'where':{'id':_0xe430dd[_0x2846('0x42')]['id']}})[_0x2846('0x21')](handleEntityNotFound(_0x2b3959,null))[_0x2846('0x21')](saveUpdates(_0xe430dd['body'],null))[_0x2846('0x21')](respondWithResult(_0x2b3959,null))[_0x2846('0x40')](handleError(_0x2b3959,null));};exports['download']=function(_0x54c3fb,_0x39f6ea,_0x5d32c5){var _0x295b88=require(_0x2846('0x47'));var _0x2e8852=![];var _0x11d62c={};if(_0x54c3fb[_0x2846('0x30')][_0x2846('0x2a')]&&_0x54c3fb[_0x2846('0x30')][_0x2846('0x2a')]==='uniqueid'){_0x11d62c[_0x2846('0x48')]=_0x54c3fb[_0x2846('0x42')]['id'];}else{_0x11d62c['id']=_0x54c3fb[_0x2846('0x42')]['id'];}return db[_0x2846('0x28')][_0x2846('0x44')]({'where':_0x11d62c,'attributes':['id',_0x2846('0x49'),_0x2846('0x4a')],'raw':!![]})[_0x2846('0x21')](handleEntityNotFound(_0x39f6ea,null))['then'](function(_0x3c7123){if(_0x3c7123){var _0x3a995a=_0x3c7123[_0x2846('0x49')];var _0x134fde=util[_0x2846('0x4b')](_0x2846('0x4c'),_0x3a995a);if(fs['existsSync'](_0x134fde)){_0x2e8852=!![];return _0x295b88[_0x2846('0x4d')](_0x134fde,_0x3a995a,config['secrets']['recording'])['then'](function(){return _0x3c7123;});}return _0x3c7123;}})[_0x2846('0x21')](function(_0x31fa43){if(_0x31fa43){var _0xb5d805=_0x31fa43[_0x2846('0x49')];if(!fs['existsSync'](_0xb5d805)){throw new db[(_0x2846('0x4e'))][(_0x2846('0x4f'))](_0x2846('0x50'));}if(_0x31fa43['filename']){return _0x39f6ea[_0x2846('0x51')](_0xb5d805,_0x31fa43[_0x2846('0x4a')]+path[_0x2846('0x52')](_0xb5d805),function(){if(_0x2e8852){fs['unlink'](_0xb5d805);}});}else{return _0x39f6ea[_0x2846('0x51')](_0xb5d805,function(_0x23959a){if(_0x2e8852){fs[_0x2846('0x53')](_0xb5d805);}});}}})[_0x2846('0x40')](function(_0x4ff9d1){if(_0x4ff9d1['message']==='SquareRecording\x20not\x20found'){_0x39f6ea['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x39f6ea,null);}});};exports[_0x2846('0x22')]=function(_0x2c3e70,_0x2fff50){return db[_0x2846('0x28')][_0x2846('0x44')]({'where':{'id':_0x2c3e70[_0x2846('0x42')]['id']}})[_0x2846('0x21')](function(_0x3791e3){if(_['isNil'](_0x3791e3)){throw new ReferenceError(_0x2846('0x54'));}return _0x3791e3;})['then'](function(_0x561dde){var _0x46919b=_0x561dde[_0x2846('0x49')];logger[_0x2846('0x55')](_0x2846('0x56'),_0x46919b);if(!_['isNil'](_0x561dde[_0x2846('0x49')])&&fs[_0x2846('0x57')](_0x46919b)){logger[_0x2846('0x55')](_0x2846('0x58')+_0x46919b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x2846('0x59')](_0x46919b);}_0x46919b=_0x46919b+'.cypher';if(!_[_0x2846('0x5a')](_0x561dde[_0x2846('0x49')])&&fs[_0x2846('0x57')](_0x46919b)){logger['info'](_0x2846('0x58')+_0x46919b+_0x2846('0x5b'));fs[_0x2846('0x59')](_0x46919b);}return _0x561dde;})[_0x2846('0x21')](function(_0xe189f9){if(!_0xe189f9)throw new InternalError();return _0xe189f9[_0x2846('0x22')]();})['then'](function(){_0x2fff50['status'](0xcc)[_0x2846('0x16')]();})['catch'](handleError(_0x2fff50,null));};
\ No newline at end of file
+var _0x14b9=['order','sort','where','pick','filter','VIRTUAL','merge','options','include','catch','show','length','find','create','body','params','download','uniqueid','savePath','filename','%s.cypher','existsSync','extname','unlink','message','SquareRecording\x20not\x20found','destroy','info','isNil','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x51e149,_0x3e8491){var _0x2a10d3=function(_0x14662f){while(--_0x14662f){_0x51e149['push'](_0x51e149['shift']());}};_0x2a10d3(++_0x3e8491);}(_0x14b9,0x76));var _0x914b=function(_0x222883,_0x3e9ddb){_0x222883=_0x222883-0x0;var _0x38b6fe=_0x14b9[_0x222883];return _0x38b6fe;};'use strict';var emlformat=require(_0x914b('0x0'));var rimraf=require(_0x914b('0x1'));var zipdir=require(_0x914b('0x2'));var jsonpatch=require(_0x914b('0x3'));var rp=require(_0x914b('0x4'));var moment=require(_0x914b('0x5'));var BPromise=require(_0x914b('0x6'));var Mustache=require(_0x914b('0x7'));var util=require(_0x914b('0x8'));var path=require(_0x914b('0x9'));var sox=require(_0x914b('0xa'));var csv=require('to-csv');var ejs=require(_0x914b('0xb'));var fs=require('fs');var fs_extra=require(_0x914b('0xc'));var _=require(_0x914b('0xd'));var squel=require('squel');var crypto=require(_0x914b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x914b('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x914b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x914b('0x11'));var as=require(_0x914b('0x12'));var hardwareService=require(_0x914b('0x13'));var logger=require(_0x914b('0x14'))(_0x914b('0x15'));var utils=require(_0x914b('0x16'));var config=require(_0x914b('0x17'));var licenseUtil=require(_0x914b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33dea5,_0x98199b){_0x98199b=_0x98199b||0xcc;return function(_0x261167){if(_0x261167){return _0x33dea5['sendStatus'](_0x98199b);}return _0x33dea5['status'](_0x98199b)[_0x914b('0x19')]();};}function respondWithResult(_0x206985,_0x873631){_0x873631=_0x873631||0xc8;return function(_0x8ba3fa){if(_0x8ba3fa){return _0x206985[_0x914b('0x1a')](_0x873631)[_0x914b('0x1b')](_0x8ba3fa);}};}function respondWithFilteredResult(_0x4ce8ee,_0x417440){return function(_0x5245c2){if(_0x5245c2){var _0x48f41b=typeof _0x417440['offset']==='undefined'&&typeof _0x417440[_0x914b('0x1c')]==='undefined';var _0x2857fb=_0x5245c2[_0x914b('0x1d')];var _0x2dc9d4=_0x48f41b?0x0:_0x417440[_0x914b('0x1e')];var _0x21b37c=_0x48f41b?_0x5245c2['count']:_0x417440['offset']+_0x417440['limit'];var _0x3a83cf;if(_0x21b37c>=_0x2857fb){_0x21b37c=_0x2857fb;_0x3a83cf=0xc8;}else{_0x3a83cf=0xce;}_0x4ce8ee[_0x914b('0x1a')](_0x3a83cf);return _0x4ce8ee[_0x914b('0x1f')](_0x914b('0x20'),_0x2dc9d4+'-'+_0x21b37c+'/'+_0x2857fb)[_0x914b('0x1b')](_0x5245c2);}return null;};}function patchUpdates(_0x41e217){return function(_0x287011){try{jsonpatch[_0x914b('0x21')](_0x287011,_0x41e217,!![]);}catch(_0x1657ce){return BPromise[_0x914b('0x22')](_0x1657ce);}return _0x287011[_0x914b('0x23')]();};}function saveUpdates(_0x84872f,_0x2116de){return function(_0x599673){if(_0x599673){return _0x599673[_0x914b('0x24')](_0x84872f)['then'](function(_0x13f51a){return _0x13f51a;});}return null;};}function removeEntity(_0x3f840a,_0x3fcdeb){return function(_0x57b65f){if(_0x57b65f){return _0x57b65f['destroy']()[_0x914b('0x25')](function(){_0x3f840a['status'](0xcc)[_0x914b('0x19')]();});}};}function handleEntityNotFound(_0x3da27a,_0x144c01){return function(_0x7b080){if(!_0x7b080){_0x3da27a['sendStatus'](0x194);}return _0x7b080;};}function handleError(_0xf8beb3,_0x492756){_0x492756=_0x492756||0x1f4;return function(_0x26d508){logger[_0x914b('0x26')](_0x26d508[_0x914b('0x27')]);if(_0x26d508[_0x914b('0x28')]){delete _0x26d508[_0x914b('0x28')];}_0xf8beb3['status'](_0x492756)[_0x914b('0x29')](_0x26d508);};}exports[_0x914b('0x2a')]=function(_0x44fd2c,_0x317385){var _0x30817d={},_0x1121fd={},_0x161b9d={'count':0x0,'rows':[]};var _0x62fca=_[_0x914b('0x2b')](db[_0x914b('0x2c')][_0x914b('0x2d')],function(_0x418c00){return{'name':_0x418c00[_0x914b('0x2e')],'type':_0x418c00[_0x914b('0x2f')][_0x914b('0x30')]};});_0x1121fd[_0x914b('0x31')]=_[_0x914b('0x2b')](_0x62fca,_0x914b('0x28'));_0x1121fd['query']=_[_0x914b('0x32')](_0x44fd2c[_0x914b('0x33')]);_0x1121fd[_0x914b('0x34')]=_[_0x914b('0x35')](_0x1121fd['model'],_0x1121fd['query']);_0x30817d[_0x914b('0x36')]=_[_0x914b('0x35')](_0x1121fd[_0x914b('0x31')],qs[_0x914b('0x37')](_0x44fd2c['query']['fields']));_0x30817d[_0x914b('0x36')]=_0x30817d[_0x914b('0x36')]['length']?_0x30817d[_0x914b('0x36')]:_0x1121fd['model'];if(!_0x44fd2c[_0x914b('0x33')][_0x914b('0x38')](_0x914b('0x39'))){_0x30817d[_0x914b('0x1c')]=qs[_0x914b('0x1c')](_0x44fd2c[_0x914b('0x33')][_0x914b('0x1c')]);_0x30817d[_0x914b('0x1e')]=qs[_0x914b('0x1e')](_0x44fd2c[_0x914b('0x33')][_0x914b('0x1e')]);}_0x30817d[_0x914b('0x3a')]=qs[_0x914b('0x3b')](_0x44fd2c['query']['sort']);_0x30817d[_0x914b('0x3c')]=qs['filters'](_[_0x914b('0x3d')](_0x44fd2c[_0x914b('0x33')],_0x1121fd[_0x914b('0x34')]),_0x62fca);if(_0x44fd2c[_0x914b('0x33')][_0x914b('0x3e')]){_0x30817d[_0x914b('0x3c')]=_['merge'](_0x30817d[_0x914b('0x3c')],{'$or':_[_0x914b('0x2b')](_0x62fca,function(_0x5d6378){if(_0x5d6378[_0x914b('0x2f')]!==_0x914b('0x3f')){var _0x459f20={};_0x459f20[_0x5d6378[_0x914b('0x28')]]={'$like':'%'+_0x44fd2c[_0x914b('0x33')][_0x914b('0x3e')]+'%'};return _0x459f20;}})});}_0x30817d=_[_0x914b('0x40')]({},_0x30817d,_0x44fd2c[_0x914b('0x41')]);var _0x19e510={'where':_0x30817d[_0x914b('0x3c')]};return db[_0x914b('0x2c')][_0x914b('0x1d')](_0x19e510)[_0x914b('0x25')](function(_0x85c50e){_0x161b9d[_0x914b('0x1d')]=_0x85c50e;if(_0x44fd2c[_0x914b('0x33')]['includeAll']){_0x30817d[_0x914b('0x42')]=[{'all':!![]}];}return db[_0x914b('0x2c')]['findAll'](_0x30817d);})[_0x914b('0x25')](function(_0x1449ce){_0x161b9d['rows']=_0x1449ce;return _0x161b9d;})[_0x914b('0x25')](respondWithFilteredResult(_0x317385,_0x30817d))[_0x914b('0x43')](handleError(_0x317385,null));};exports[_0x914b('0x44')]=function(_0x116137,_0x3d29ec){var _0x18e60e={'raw':!![],'where':{'id':_0x116137['params']['id']}},_0x34f772={};_0x34f772['model']=_[_0x914b('0x32')](db[_0x914b('0x2c')]['rawAttributes']);_0x34f772[_0x914b('0x33')]=_[_0x914b('0x32')](_0x116137[_0x914b('0x33')]);_0x34f772[_0x914b('0x34')]=_['intersection'](_0x34f772[_0x914b('0x31')],_0x34f772[_0x914b('0x33')]);_0x18e60e[_0x914b('0x36')]=_['intersection'](_0x34f772['model'],qs[_0x914b('0x37')](_0x116137[_0x914b('0x33')][_0x914b('0x37')]));_0x18e60e[_0x914b('0x36')]=_0x18e60e['attributes'][_0x914b('0x45')]?_0x18e60e[_0x914b('0x36')]:_0x34f772['model'];if(_0x116137['query']['includeAll']){_0x18e60e[_0x914b('0x42')]=[{'all':!![]}];}_0x18e60e=_[_0x914b('0x40')]({},_0x18e60e,_0x116137[_0x914b('0x41')]);return db[_0x914b('0x2c')][_0x914b('0x46')](_0x18e60e)['then'](handleEntityNotFound(_0x3d29ec,null))['then'](respondWithResult(_0x3d29ec,null))[_0x914b('0x43')](handleError(_0x3d29ec,null));};exports[_0x914b('0x47')]=function(_0x4831ed,_0x4c486e){return db['SquareRecording'][_0x914b('0x47')](_0x4831ed[_0x914b('0x48')],{})[_0x914b('0x25')](respondWithResult(_0x4c486e,0xc9))[_0x914b('0x43')](handleError(_0x4c486e,null));};exports['update']=function(_0x311433,_0x2eb757){if(_0x311433[_0x914b('0x48')]['id']){delete _0x311433['body']['id'];}return db[_0x914b('0x2c')]['find']({'where':{'id':_0x311433[_0x914b('0x49')]['id']}})[_0x914b('0x25')](handleEntityNotFound(_0x2eb757,null))['then'](saveUpdates(_0x311433[_0x914b('0x48')],null))[_0x914b('0x25')](respondWithResult(_0x2eb757,null))[_0x914b('0x43')](handleError(_0x2eb757,null));};exports[_0x914b('0x4a')]=function(_0x3e4306,_0x34c325,_0x18c2f5){var _0x89c8de=require('../../components/encryptor');var _0x4d161d=![];var _0x492315={};if(_0x3e4306[_0x914b('0x33')][_0x914b('0x2f')]&&_0x3e4306[_0x914b('0x33')]['type']==='uniqueid'){_0x492315[_0x914b('0x4b')]=_0x3e4306[_0x914b('0x49')]['id'];}else{_0x492315['id']=_0x3e4306['params']['id'];}return db['SquareRecording'][_0x914b('0x46')]({'where':_0x492315,'attributes':['id',_0x914b('0x4c'),_0x914b('0x4d')],'raw':!![]})[_0x914b('0x25')](handleEntityNotFound(_0x34c325,null))[_0x914b('0x25')](function(_0x179875){if(_0x179875){var _0x5ee281=_0x179875[_0x914b('0x4c')];var _0x4c11eb=util['format'](_0x914b('0x4e'),_0x5ee281);if(fs[_0x914b('0x4f')](_0x4c11eb)){_0x4d161d=!![];return _0x89c8de['decryptFile'](_0x4c11eb,_0x5ee281,config['secrets']['recording'])[_0x914b('0x25')](function(){return _0x179875;});}return _0x179875;}})[_0x914b('0x25')](function(_0x2e1454){if(_0x2e1454){var _0x3dcf8b=_0x2e1454[_0x914b('0x4c')];if(!fs[_0x914b('0x4f')](_0x3dcf8b)){throw new db['Sequelize']['ValidationError']('SquareRecording\x20not\x20found');}if(_0x2e1454['filename']){return _0x34c325['download'](_0x3dcf8b,_0x2e1454[_0x914b('0x4d')]+path[_0x914b('0x50')](_0x3dcf8b),function(){if(_0x4d161d){fs[_0x914b('0x51')](_0x3dcf8b);}});}else{return _0x34c325['download'](_0x3dcf8b,function(_0x8f5d15){if(_0x4d161d){fs[_0x914b('0x51')](_0x3dcf8b);}});}}})[_0x914b('0x43')](function(_0xd8abc7){if(_0xd8abc7[_0x914b('0x52')]===_0x914b('0x53')){_0x34c325[_0x914b('0x1a')](0x194)[_0x914b('0x29')]('Not\x20found');}else{return handleError(_0x34c325,null);}});};exports[_0x914b('0x54')]=function(_0x1454c5,_0x43857a){return db['SquareRecording'][_0x914b('0x46')]({'where':{'id':_0x1454c5['params']['id']}})[_0x914b('0x25')](function(_0x429bc3){if(_['isNil'](_0x429bc3)){throw new ReferenceError('Entity\x20not\x20found');}return _0x429bc3;})[_0x914b('0x25')](function(_0x52df7f){var _0x344c2c=_0x52df7f[_0x914b('0x4c')];logger[_0x914b('0x55')]('cancellazione\x20fisica\x20documento\x20%s',_0x344c2c);if(!_[_0x914b('0x56')](_0x52df7f['savePath'])&&fs[_0x914b('0x4f')](_0x344c2c)){logger['info'](_0x914b('0x57')+_0x344c2c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x344c2c);}_0x344c2c=_0x344c2c+'.cypher';if(!_['isNil'](_0x52df7f[_0x914b('0x4c')])&&fs[_0x914b('0x4f')](_0x344c2c)){logger[_0x914b('0x55')]('File:\x20\x22'+_0x344c2c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x344c2c);}return _0x52df7f;})['then'](function(_0x565ae2){if(!_0x565ae2)throw new InternalError();return _0x565ae2[_0x914b('0x54')]();})['then'](function(){_0x43857a[_0x914b('0x1a')](0xcc)[_0x914b('0x19')]();})[_0x914b('0x43')](handleError(_0x43857a,null));};
\ No newline at end of file
index 8a73b41..e87bdee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7046=['path','../../config/environment','./squareRecording.attributes','exports','SquareRecording','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x28e94b,_0x5c7052){var _0x1f134b=function(_0x277ca8){while(--_0x277ca8){_0x28e94b['push'](_0x28e94b['shift']());}};_0x1f134b(++_0x5c7052);}(_0x7046,0x144));var _0x6704=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7046[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x896e=['request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1c217e,_0x470ca8){var _0x523793=function(_0x12db0b){while(--_0x12db0b){_0x1c217e['push'](_0x1c217e['shift']());}};_0x523793(++_0x470ca8);}(_0x896e,0x1e9));var _0xe896=function(_0x5df7b0,_0x26ad6c){_0x5df7b0=_0x5df7b0-0x0;var _0x2cad77=_0x896e[_0x5df7b0];return _0x2cad77;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var logger=require(_0xe896('0x2'))(_0xe896('0x3'));var moment=require(_0xe896('0x4'));var BPromise=require(_0xe896('0x5'));var rp=require(_0xe896('0x6'));var fs=require('fs');var path=require(_0xe896('0x7'));var rimraf=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var attributes=require(_0xe896('0xa'));module[_0xe896('0xb')]=function(_0x52ac80,_0x24c430){return _0x52ac80[_0xe896('0xc')](_0xe896('0xd'),attributes,{'tableName':_0xe896('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4e4d357..f1bf87d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x56b0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SquareRecording','body','options','CreateSquareRecording','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x464015,_0x5786cf){var _0x4fe871=function(_0x3fd5c7){while(--_0x3fd5c7){_0x464015['push'](_0x464015['shift']());}};_0x4fe871(++_0x5786cf);}(_0x56b0,0x113));var _0x056b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56b0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x056b('0x0'));var util=require('util');var moment=require(_0x056b('0x1'));var BPromise=require(_0x056b('0x2'));var rs=require(_0x056b('0x3'));var fs=require('fs');var Redis=require(_0x056b('0x4'));var db=require(_0x056b('0x5'))['db'];var utils=require(_0x056b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x056b('0x7'));var jayson=require(_0x056b('0x8'));var client=jayson[_0x056b('0x9')][_0x056b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x195301,_0x3691f6,_0x5cd422){return new BPromise(function(_0x48e3da,_0x507851){return client[_0x056b('0xb')](_0x195301,_0x5cd422)[_0x056b('0xc')](function(_0x1c18bc){logger['info'](_0x056b('0xd'),_0x3691f6,_0x056b('0xe'));logger[_0x056b('0xf')](_0x056b('0x10'),_0x3691f6,_0x056b('0xe'),JSON[_0x056b('0x11')](_0x1c18bc));if(_0x1c18bc[_0x056b('0x12')]){if(_0x1c18bc[_0x056b('0x12')][_0x056b('0x13')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x3691f6,_0x1c18bc[_0x056b('0x12')]['message']);return _0x507851(_0x1c18bc['error'][_0x056b('0x14')]);}logger[_0x056b('0x12')](_0x056b('0xd'),_0x3691f6,_0x1c18bc[_0x056b('0x12')]['message']);return _0x48e3da(_0x1c18bc[_0x056b('0x12')]['message']);}else{logger[_0x056b('0x15')](_0x056b('0xd'),_0x3691f6,_0x056b('0xe'));_0x48e3da(_0x1c18bc[_0x056b('0x16')][_0x056b('0x14')]);}})[_0x056b('0x17')](function(_0x1cec05){logger['error'](_0x056b('0xd'),_0x3691f6,_0x1cec05);_0x507851(_0x1cec05);});});}exports['CreateSquareRecording']=function(_0x1657a2){var _0x4fea0a=this;return new Promise(function(_0xc4b57,_0x3a916c){return db[_0x056b('0x18')]['create'](_0x1657a2[_0x056b('0x19')],{'raw':_0x1657a2[_0x056b('0x1a')]?_0x1657a2[_0x056b('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x056b('0xc')](function(_0x35bba6){logger[_0x056b('0x15')]('CreateSquareRecording',_0x1657a2);logger['debug']('CreateSquareRecording',_0x1657a2,JSON['stringify'](_0x35bba6));_0xc4b57(_0x35bba6);})['catch'](function(_0x13144f){logger[_0x056b('0x12')](_0x056b('0x1b'),_0x13144f[_0x056b('0x14')],_0x1657a2);_0x3a916c(_0x4fea0a[_0x056b('0x12')](0x1f4,_0x13144f[_0x056b('0x14')]));});});};
\ No newline at end of file
+var _0x6cb4=['moment','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','SquareRecording,\x20%s,\x20%s','result','catch','CreateSquareRecording','SquareRecording','create','options','stringify'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x6cb4,0x170));var _0x46cb=function(_0x239e53,_0x31aeb2){_0x239e53=_0x239e53-0x0;var _0x8f165=_0x6cb4[_0x239e53];return _0x8f165;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x46cb('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46cb('0x1'));var db=require(_0x46cb('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x46cb('0x3'));var jayson=require(_0x46cb('0x4'));var client=jayson[_0x46cb('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23386c,_0x49ad35,_0x3770c3){return new BPromise(function(_0x5d6aef,_0x51b96f){return client[_0x46cb('0x6')](_0x23386c,_0x3770c3)[_0x46cb('0x7')](function(_0x469fee){logger[_0x46cb('0x8')]('SquareRecording,\x20%s,\x20%s',_0x49ad35,_0x46cb('0x9'));logger[_0x46cb('0xa')](_0x46cb('0xb'),_0x49ad35,_0x46cb('0x9'),JSON['stringify'](_0x469fee));if(_0x469fee[_0x46cb('0xc')]){if(_0x469fee[_0x46cb('0xc')][_0x46cb('0xd')]===0x1f4){logger[_0x46cb('0xc')]('SquareRecording,\x20%s,\x20%s',_0x49ad35,_0x469fee[_0x46cb('0xc')][_0x46cb('0xe')]);return _0x51b96f(_0x469fee[_0x46cb('0xc')][_0x46cb('0xe')]);}logger[_0x46cb('0xc')](_0x46cb('0xf'),_0x49ad35,_0x469fee['error']['message']);return _0x5d6aef(_0x469fee[_0x46cb('0xc')]['message']);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x49ad35,'request\x20sent');_0x5d6aef(_0x469fee[_0x46cb('0x10')]['message']);}})[_0x46cb('0x11')](function(_0x4eb13d){logger['error'](_0x46cb('0xf'),_0x49ad35,_0x4eb13d);_0x51b96f(_0x4eb13d);});});}exports[_0x46cb('0x12')]=function(_0x4b3a07){var _0x2423a2=this;return new Promise(function(_0x30a5df,_0x4dfbd0){return db[_0x46cb('0x13')][_0x46cb('0x14')](_0x4b3a07['body'],{'raw':_0x4b3a07[_0x46cb('0x15')]?_0x4b3a07[_0x46cb('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x46cb('0x7')](function(_0x34c4a6){logger['info'](_0x46cb('0x12'),_0x4b3a07);logger[_0x46cb('0xa')](_0x46cb('0x12'),_0x4b3a07,JSON[_0x46cb('0x16')](_0x34c4a6));_0x30a5df(_0x34c4a6);})[_0x46cb('0x11')](function(_0x32c553){logger[_0x46cb('0xc')](_0x46cb('0x12'),_0x32c553[_0x46cb('0xe')],_0x4b3a07);_0x4dfbd0(_0x2423a2['error'](0x1f4,_0x32c553[_0x46cb('0xe')]));});});};
\ No newline at end of file
index 9ea604f..a644acf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x47d408,_0x581ad4){var _0x700cd2=function(_0x17c587){while(--_0x17c587){_0x47d408['push'](_0x47d408['shift']());}};_0x700cd2(++_0x581ad4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router;
\ No newline at end of file
+var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x1c15e4,_0x2b79bf){var _0x50ab0d=function(_0x5a8cb0){while(--_0x5a8cb0){_0x1c15e4['push'](_0x1c15e4['shift']());}};_0x50ab0d(++_0x2b79bf);}(_0xe706,0xa3));var _0x6e70=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0xe706[_0x32b993];return _0x482780;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router;
\ No newline at end of file
index 1a797d3..21de14c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3ce8=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x3f4027,_0x221cbb){var _0x4aea2e=function(_0x29bcbb){while(--_0x29bcbb){_0x3f4027['push'](_0x3f4027['shift']());}};_0x4aea2e(++_0x221cbb);}(_0x3ce8,0xdb));var _0x83ce=function(_0x2b66e8,_0x206f4e){_0x2b66e8=_0x2b66e8-0x0;var _0x44150f=_0x3ce8[_0x2b66e8];return _0x44150f;};'use strict';var Sequelize=require(_0x83ce('0x0'));module[_0x83ce('0x1')]={'network':{'type':Sequelize[_0x83ce('0x2')]},'network_script':{'type':Sequelize[_0x83ce('0x2')]},'request':{'type':Sequelize[_0x83ce('0x2')]},'channel':{'type':Sequelize[_0x83ce('0x2')]},'language':{'type':Sequelize[_0x83ce('0x2')]},'type':{'type':Sequelize[_0x83ce('0x2')]},'uniqueid':{'type':Sequelize[_0x83ce('0x2')]},'version':{'type':Sequelize[_0x83ce('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x83ce('0x2')]},'callingpres':{'type':Sequelize[_0x83ce('0x2')]},'callingani2':{'type':Sequelize[_0x83ce('0x2')]},'callington':{'type':Sequelize[_0x83ce('0x2')]},'callingtns':{'type':Sequelize[_0x83ce('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x83ce('0x2')]},'context':{'type':Sequelize[_0x83ce('0x2')]},'extension':{'type':Sequelize[_0x83ce('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x83ce('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x83ce('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x83ce('0x3')]},'bot':{'type':Sequelize[_0x83ce('0x4')],'defaultValue':![]}};
\ No newline at end of file
+var _0x7a1a=['BOOLEAN','exports','STRING','DATE'];(function(_0x4e3400,_0x27d948){var _0x106807=function(_0x461665){while(--_0x461665){_0x4e3400['push'](_0x4e3400['shift']());}};_0x106807(++_0x27d948);}(_0x7a1a,0x15d));var _0xa7a1=function(_0x331222,_0x519faa){_0x331222=_0x331222-0x0;var _0x4a188d=_0x7a1a[_0x331222];return _0x4a188d;};'use strict';var Sequelize=require('sequelize');module[_0xa7a1('0x0')]={'network':{'type':Sequelize[_0xa7a1('0x1')]},'network_script':{'type':Sequelize[_0xa7a1('0x1')]},'request':{'type':Sequelize[_0xa7a1('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa7a1('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa7a1('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xa7a1('0x1')]},'callingani2':{'type':Sequelize[_0xa7a1('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xa7a1('0x1')]},'dnid':{'type':Sequelize[_0xa7a1('0x1')]},'rdnis':{'type':Sequelize[_0xa7a1('0x1')]},'context':{'type':Sequelize[_0xa7a1('0x1')]},'extension':{'type':Sequelize[_0xa7a1('0x1')]},'priority':{'type':Sequelize[_0xa7a1('0x1')]},'enhanced':{'type':Sequelize[_0xa7a1('0x1')]},'accountcode':{'type':Sequelize[_0xa7a1('0x1')]},'threadid':{'type':Sequelize[_0xa7a1('0x1')]},'project_name':{'type':Sequelize[_0xa7a1('0x1')]},'joinAt':{'type':Sequelize[_0xa7a1('0x2')]},'leaveAt':{'type':Sequelize[_0xa7a1('0x2')]},'bot':{'type':Sequelize[_0xa7a1('0x3')],'defaultValue':![]}};
\ No newline at end of file
index 17fd023..9608af4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7963=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','undefined','limit','count','offset','apply','update','then','destroy','error','name','send','index','map','SquareReport','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0xd36ecf,_0xbc090b){var _0x15847a=function(_0x345247){while(--_0x345247){_0xd36ecf['push'](_0xd36ecf['shift']());}};_0x15847a(++_0xbc090b);}(_0x7963,0x1ee));var _0x3796=function(_0x117821,_0xaa1933){_0x117821=_0x117821-0x0;var _0x4ae9ff=_0x7963[_0x117821];return _0x4ae9ff;};'use strict';var emlformat=require(_0x3796('0x0'));var rimraf=require(_0x3796('0x1'));var zipdir=require(_0x3796('0x2'));var jsonpatch=require(_0x3796('0x3'));var rp=require(_0x3796('0x4'));var moment=require(_0x3796('0x5'));var BPromise=require(_0x3796('0x6'));var Mustache=require(_0x3796('0x7'));var util=require(_0x3796('0x8'));var path=require(_0x3796('0x9'));var sox=require(_0x3796('0xa'));var csv=require('to-csv');var ejs=require(_0x3796('0xb'));var fs=require('fs');var fs_extra=require(_0x3796('0xc'));var _=require(_0x3796('0xd'));var squel=require(_0x3796('0xe'));var crypto=require(_0x3796('0xf'));var jsforce=require(_0x3796('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3796('0x11'));var qs=require(_0x3796('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3796('0x13'));var logger=require(_0x3796('0x14'))(_0x3796('0x15'));var utils=require('../../config/utils');var config=require(_0x3796('0x16'));var licenseUtil=require(_0x3796('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc5ae80,_0xa9ed9c){_0xa9ed9c=_0xa9ed9c||0xcc;return function(_0x545fa3){if(_0x545fa3){return _0xc5ae80['sendStatus'](_0xa9ed9c);}return _0xc5ae80[_0x3796('0x18')](_0xa9ed9c)['end']();};}function respondWithResult(_0x2149b3,_0x3b9c07){_0x3b9c07=_0x3b9c07||0xc8;return function(_0xe5dd11){if(_0xe5dd11){return _0x2149b3['status'](_0x3b9c07)[_0x3796('0x19')](_0xe5dd11);}};}function respondWithFilteredResult(_0x1ff726,_0x28a7b1){return function(_0x19db50){if(_0x19db50){var _0x1451e3=typeof _0x28a7b1['offset']===_0x3796('0x1a')&&typeof _0x28a7b1[_0x3796('0x1b')]===_0x3796('0x1a');var _0x18c482=_0x19db50[_0x3796('0x1c')];var _0x52f0fa=_0x1451e3?0x0:_0x28a7b1['offset'];var _0x10a5f6=_0x1451e3?_0x19db50['count']:_0x28a7b1[_0x3796('0x1d')]+_0x28a7b1[_0x3796('0x1b')];var _0x4db314;if(_0x10a5f6>=_0x18c482){_0x10a5f6=_0x18c482;_0x4db314=0xc8;}else{_0x4db314=0xce;}_0x1ff726[_0x3796('0x18')](_0x4db314);return _0x1ff726['set']('Content-Range',_0x52f0fa+'-'+_0x10a5f6+'/'+_0x18c482)[_0x3796('0x19')](_0x19db50);}return null;};}function patchUpdates(_0x21fff1){return function(_0x3fe611){try{jsonpatch[_0x3796('0x1e')](_0x3fe611,_0x21fff1,!![]);}catch(_0x12ea40){return BPromise['reject'](_0x12ea40);}return _0x3fe611['save']();};}function saveUpdates(_0x146bcd,_0x498b2a){return function(_0x25da53){if(_0x25da53){return _0x25da53[_0x3796('0x1f')](_0x146bcd)[_0x3796('0x20')](function(_0x30dc17){return _0x30dc17;});}return null;};}function removeEntity(_0x475e5c,_0x1005fa){return function(_0x368d42){if(_0x368d42){return _0x368d42[_0x3796('0x21')]()['then'](function(){_0x475e5c[_0x3796('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xde26d2,_0x13eac4){return function(_0x37b00c){if(!_0x37b00c){_0xde26d2['sendStatus'](0x194);}return _0x37b00c;};}function handleError(_0xc73b1c,_0x38ff26){_0x38ff26=_0x38ff26||0x1f4;return function(_0x405755){logger[_0x3796('0x22')](_0x405755['stack']);if(_0x405755[_0x3796('0x23')]){delete _0x405755['name'];}_0xc73b1c[_0x3796('0x18')](_0x38ff26)[_0x3796('0x24')](_0x405755);};}exports[_0x3796('0x25')]=function(_0xa5a09b,_0x5d4e9a){var _0x5d53ff={},_0x16cec5={},_0x137848={'count':0x0,'rows':[]};var _0xf1817f=_[_0x3796('0x26')](db[_0x3796('0x27')][_0x3796('0x28')],function(_0x2f1d87){return{'name':_0x2f1d87['fieldName'],'type':_0x2f1d87[_0x3796('0x29')]['key']};});_0x16cec5[_0x3796('0x2a')]=_[_0x3796('0x26')](_0xf1817f,'name');_0x16cec5[_0x3796('0x2b')]=_['keys'](_0xa5a09b[_0x3796('0x2b')]);_0x16cec5[_0x3796('0x2c')]=_[_0x3796('0x2d')](_0x16cec5[_0x3796('0x2a')],_0x16cec5[_0x3796('0x2b')]);_0x5d53ff['attributes']=_[_0x3796('0x2d')](_0x16cec5[_0x3796('0x2a')],qs[_0x3796('0x2e')](_0xa5a09b[_0x3796('0x2b')][_0x3796('0x2e')]));_0x5d53ff[_0x3796('0x2f')]=_0x5d53ff[_0x3796('0x2f')][_0x3796('0x30')]?_0x5d53ff[_0x3796('0x2f')]:_0x16cec5[_0x3796('0x2a')];if(!_0xa5a09b[_0x3796('0x2b')][_0x3796('0x31')](_0x3796('0x32'))){_0x5d53ff[_0x3796('0x1b')]=qs[_0x3796('0x1b')](_0xa5a09b[_0x3796('0x2b')][_0x3796('0x1b')]);_0x5d53ff['offset']=qs[_0x3796('0x1d')](_0xa5a09b[_0x3796('0x2b')]['offset']);}_0x5d53ff[_0x3796('0x33')]=qs[_0x3796('0x34')](_0xa5a09b['query'][_0x3796('0x34')]);_0x5d53ff[_0x3796('0x35')]=qs['filters'](_[_0x3796('0x36')](_0xa5a09b[_0x3796('0x2b')],_0x16cec5[_0x3796('0x2c')]),_0xf1817f);if(_0xa5a09b[_0x3796('0x2b')]['filter']){_0x5d53ff[_0x3796('0x35')]=_[_0x3796('0x37')](_0x5d53ff[_0x3796('0x35')],{'$or':_[_0x3796('0x26')](_0xf1817f,function(_0x269f7a){if(_0x269f7a[_0x3796('0x29')]!==_0x3796('0x38')){var _0x988a29={};_0x988a29[_0x269f7a['name']]={'$like':'%'+_0xa5a09b[_0x3796('0x2b')][_0x3796('0x39')]+'%'};return _0x988a29;}})});}_0x5d53ff=_[_0x3796('0x37')]({},_0x5d53ff,_0xa5a09b[_0x3796('0x3a')]);var _0x17a63e={'where':_0x5d53ff['where']};return db[_0x3796('0x27')][_0x3796('0x1c')](_0x17a63e)[_0x3796('0x20')](function(_0x34cd43){_0x137848['count']=_0x34cd43;if(_0xa5a09b[_0x3796('0x2b')][_0x3796('0x3b')]){_0x5d53ff[_0x3796('0x3c')]=[{'all':!![]}];}return db['SquareReport'][_0x3796('0x3d')](_0x5d53ff);})['then'](function(_0x9b8779){_0x137848[_0x3796('0x3e')]=_0x9b8779;return _0x137848;})[_0x3796('0x20')](respondWithFilteredResult(_0x5d4e9a,_0x5d53ff))[_0x3796('0x3f')](handleError(_0x5d4e9a,null));};exports[_0x3796('0x40')]=function(_0x4e5ba0,_0x1e04af){var _0x5db063={'raw':!![],'where':{'id':_0x4e5ba0[_0x3796('0x41')]['id']}},_0x226375={};_0x226375[_0x3796('0x2a')]=_[_0x3796('0x42')](db[_0x3796('0x27')][_0x3796('0x28')]);_0x226375[_0x3796('0x2b')]=_[_0x3796('0x42')](_0x4e5ba0['query']);_0x226375[_0x3796('0x2c')]=_[_0x3796('0x2d')](_0x226375[_0x3796('0x2a')],_0x226375[_0x3796('0x2b')]);_0x5db063[_0x3796('0x2f')]=_['intersection'](_0x226375['model'],qs[_0x3796('0x2e')](_0x4e5ba0[_0x3796('0x2b')][_0x3796('0x2e')]));_0x5db063['attributes']=_0x5db063[_0x3796('0x2f')][_0x3796('0x30')]?_0x5db063[_0x3796('0x2f')]:_0x226375[_0x3796('0x2a')];if(_0x4e5ba0[_0x3796('0x2b')][_0x3796('0x3b')]){_0x5db063[_0x3796('0x3c')]=[{'all':!![]}];}_0x5db063=_[_0x3796('0x37')]({},_0x5db063,_0x4e5ba0['options']);return db['SquareReport'][_0x3796('0x43')](_0x5db063)[_0x3796('0x20')](handleEntityNotFound(_0x1e04af,null))[_0x3796('0x20')](respondWithResult(_0x1e04af,null))[_0x3796('0x3f')](handleError(_0x1e04af,null));};exports[_0x3796('0x44')]=function(_0x580e6f,_0x16677f){return db[_0x3796('0x27')][_0x3796('0x44')](_0x580e6f[_0x3796('0x45')],{})['then'](respondWithResult(_0x16677f,0xc9))[_0x3796('0x3f')](handleError(_0x16677f,null));};exports['update']=function(_0x19399d,_0x786940){if(_0x19399d['body']['id']){delete _0x19399d[_0x3796('0x45')]['id'];}return db['SquareReport'][_0x3796('0x43')]({'where':{'id':_0x19399d[_0x3796('0x41')]['id']}})[_0x3796('0x20')](handleEntityNotFound(_0x786940,null))['then'](saveUpdates(_0x19399d[_0x3796('0x45')],null))[_0x3796('0x20')](respondWithResult(_0x786940,null))[_0x3796('0x3f')](handleError(_0x786940,null));};exports[_0x3796('0x21')]=function(_0x26830b,_0x4b35c1){return db[_0x3796('0x27')]['find']({'where':{'id':_0x26830b[_0x3796('0x41')]['id']}})['then'](handleEntityNotFound(_0x4b35c1,null))[_0x3796('0x20')](removeEntity(_0x4b35c1,null))[_0x3796('0x3f')](handleError(_0x4b35c1,null));};exports[_0x3796('0x46')]=function(_0x5b96f6,_0x50a477){return db[_0x3796('0x27')][_0x3796('0x46')]()[_0x3796('0x20')](respondWithResult(_0x50a477,null))[_0x3796('0x3f')](handleError(_0x50a477,null));};
\ No newline at end of file
+var _0xabcb=['../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','SquareReport','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0xb24b6d,_0x49f15e){var _0xc88ebd=function(_0x310bd5){while(--_0x310bd5){_0xb24b6d['push'](_0xb24b6d['shift']());}};_0xc88ebd(++_0x49f15e);}(_0xabcb,0x1a7));var _0xbabc=function(_0x47c701,_0x4ce981){_0x47c701=_0x47c701-0x0;var _0x2605f8=_0xabcb[_0x47c701];return _0x2605f8;};'use strict';var emlformat=require(_0xbabc('0x0'));var rimraf=require(_0xbabc('0x1'));var zipdir=require(_0xbabc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbabc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbabc('0x4'));var util=require('util');var path=require(_0xbabc('0x5'));var sox=require(_0xbabc('0x6'));var csv=require(_0xbabc('0x7'));var ejs=require(_0xbabc('0x8'));var fs=require('fs');var fs_extra=require(_0xbabc('0x9'));var _=require(_0xbabc('0xa'));var squel=require('squel');var crypto=require(_0xbabc('0xb'));var jsforce=require(_0xbabc('0xc'));var deskjs=require(_0xbabc('0xd'));var toCsv=require(_0xbabc('0x7'));var querystring=require(_0xbabc('0xe'));var Papa=require('papaparse');var Redis=require(_0xbabc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbabc('0x10'));var as=require(_0xbabc('0x11'));var hardwareService=require(_0xbabc('0x12'));var logger=require(_0xbabc('0x13'))(_0xbabc('0x14'));var utils=require(_0xbabc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbabc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x89303,_0x4515ab){_0x4515ab=_0x4515ab||0xcc;return function(_0x572ee0){if(_0x572ee0){return _0x89303[_0xbabc('0x17')](_0x4515ab);}return _0x89303[_0xbabc('0x18')](_0x4515ab)[_0xbabc('0x19')]();};}function respondWithResult(_0x24d03c,_0x582aed){_0x582aed=_0x582aed||0xc8;return function(_0x74b72d){if(_0x74b72d){return _0x24d03c['status'](_0x582aed)[_0xbabc('0x1a')](_0x74b72d);}};}function respondWithFilteredResult(_0x4ed285,_0x2c4e9e){return function(_0x249d49){if(_0x249d49){var _0x5df959=typeof _0x2c4e9e[_0xbabc('0x1b')]==='undefined'&&typeof _0x2c4e9e[_0xbabc('0x1c')]===_0xbabc('0x1d');var _0x20595e=_0x249d49[_0xbabc('0x1e')];var _0xa53fd1=_0x5df959?0x0:_0x2c4e9e['offset'];var _0x3038e0=_0x5df959?_0x249d49['count']:_0x2c4e9e[_0xbabc('0x1b')]+_0x2c4e9e[_0xbabc('0x1c')];var _0x2d2654;if(_0x3038e0>=_0x20595e){_0x3038e0=_0x20595e;_0x2d2654=0xc8;}else{_0x2d2654=0xce;}_0x4ed285['status'](_0x2d2654);return _0x4ed285[_0xbabc('0x1f')]('Content-Range',_0xa53fd1+'-'+_0x3038e0+'/'+_0x20595e)['json'](_0x249d49);}return null;};}function patchUpdates(_0x3e1663){return function(_0x495272){try{jsonpatch['apply'](_0x495272,_0x3e1663,!![]);}catch(_0x317646){return BPromise[_0xbabc('0x20')](_0x317646);}return _0x495272[_0xbabc('0x21')]();};}function saveUpdates(_0x148d6e,_0x2f6c01){return function(_0x3b1135){if(_0x3b1135){return _0x3b1135[_0xbabc('0x22')](_0x148d6e)['then'](function(_0x4a1b05){return _0x4a1b05;});}return null;};}function removeEntity(_0x44dec4,_0x2fca63){return function(_0x18d08f){if(_0x18d08f){return _0x18d08f['destroy']()[_0xbabc('0x23')](function(){_0x44dec4[_0xbabc('0x18')](0xcc)[_0xbabc('0x19')]();});}};}function handleEntityNotFound(_0x5a26f7,_0xb74807){return function(_0x1584c2){if(!_0x1584c2){_0x5a26f7['sendStatus'](0x194);}return _0x1584c2;};}function handleError(_0x255388,_0x3818d5){_0x3818d5=_0x3818d5||0x1f4;return function(_0x2deb97){logger['error'](_0x2deb97[_0xbabc('0x24')]);if(_0x2deb97[_0xbabc('0x25')]){delete _0x2deb97[_0xbabc('0x25')];}_0x255388['status'](_0x3818d5)[_0xbabc('0x26')](_0x2deb97);};}exports[_0xbabc('0x27')]=function(_0x3b50ad,_0x4c0299){var _0x289180={},_0x162a59={},_0x2a2420={'count':0x0,'rows':[]};var _0x3df85e=_[_0xbabc('0x28')](db['SquareReport'][_0xbabc('0x29')],function(_0x55669d){return{'name':_0x55669d[_0xbabc('0x2a')],'type':_0x55669d[_0xbabc('0x2b')][_0xbabc('0x2c')]};});_0x162a59[_0xbabc('0x2d')]=_[_0xbabc('0x28')](_0x3df85e,_0xbabc('0x25'));_0x162a59[_0xbabc('0x2e')]=_[_0xbabc('0x2f')](_0x3b50ad['query']);_0x162a59[_0xbabc('0x30')]=_[_0xbabc('0x31')](_0x162a59[_0xbabc('0x2d')],_0x162a59[_0xbabc('0x2e')]);_0x289180[_0xbabc('0x32')]=_['intersection'](_0x162a59[_0xbabc('0x2d')],qs['fields'](_0x3b50ad[_0xbabc('0x2e')]['fields']));_0x289180['attributes']=_0x289180[_0xbabc('0x32')][_0xbabc('0x33')]?_0x289180['attributes']:_0x162a59[_0xbabc('0x2d')];if(!_0x3b50ad[_0xbabc('0x2e')][_0xbabc('0x34')]('nolimit')){_0x289180['limit']=qs[_0xbabc('0x1c')](_0x3b50ad['query'][_0xbabc('0x1c')]);_0x289180[_0xbabc('0x1b')]=qs[_0xbabc('0x1b')](_0x3b50ad[_0xbabc('0x2e')][_0xbabc('0x1b')]);}_0x289180[_0xbabc('0x35')]=qs[_0xbabc('0x36')](_0x3b50ad[_0xbabc('0x2e')][_0xbabc('0x36')]);_0x289180[_0xbabc('0x37')]=qs[_0xbabc('0x30')](_['pick'](_0x3b50ad[_0xbabc('0x2e')],_0x162a59['filters']),_0x3df85e);if(_0x3b50ad[_0xbabc('0x2e')]['filter']){_0x289180[_0xbabc('0x37')]=_[_0xbabc('0x38')](_0x289180['where'],{'$or':_[_0xbabc('0x28')](_0x3df85e,function(_0x530417){if(_0x530417[_0xbabc('0x2b')]!==_0xbabc('0x39')){var _0x416f6b={};_0x416f6b[_0x530417['name']]={'$like':'%'+_0x3b50ad[_0xbabc('0x2e')][_0xbabc('0x3a')]+'%'};return _0x416f6b;}})});}_0x289180=_['merge']({},_0x289180,_0x3b50ad[_0xbabc('0x3b')]);var _0x2b359f={'where':_0x289180['where']};return db[_0xbabc('0x3c')][_0xbabc('0x1e')](_0x2b359f)['then'](function(_0x52eff5){_0x2a2420[_0xbabc('0x1e')]=_0x52eff5;if(_0x3b50ad[_0xbabc('0x2e')][_0xbabc('0x3d')]){_0x289180['include']=[{'all':!![]}];}return db[_0xbabc('0x3c')][_0xbabc('0x3e')](_0x289180);})[_0xbabc('0x23')](function(_0x2440e9){_0x2a2420[_0xbabc('0x3f')]=_0x2440e9;return _0x2a2420;})['then'](respondWithFilteredResult(_0x4c0299,_0x289180))[_0xbabc('0x40')](handleError(_0x4c0299,null));};exports[_0xbabc('0x41')]=function(_0x260ee5,_0x567ab3){var _0x4ddfe5={'raw':!![],'where':{'id':_0x260ee5[_0xbabc('0x42')]['id']}},_0x52925d={};_0x52925d[_0xbabc('0x2d')]=_['keys'](db[_0xbabc('0x3c')][_0xbabc('0x29')]);_0x52925d[_0xbabc('0x2e')]=_['keys'](_0x260ee5[_0xbabc('0x2e')]);_0x52925d[_0xbabc('0x30')]=_[_0xbabc('0x31')](_0x52925d[_0xbabc('0x2d')],_0x52925d[_0xbabc('0x2e')]);_0x4ddfe5[_0xbabc('0x32')]=_[_0xbabc('0x31')](_0x52925d[_0xbabc('0x2d')],qs[_0xbabc('0x43')](_0x260ee5[_0xbabc('0x2e')][_0xbabc('0x43')]));_0x4ddfe5[_0xbabc('0x32')]=_0x4ddfe5[_0xbabc('0x32')][_0xbabc('0x33')]?_0x4ddfe5[_0xbabc('0x32')]:_0x52925d[_0xbabc('0x2d')];if(_0x260ee5[_0xbabc('0x2e')][_0xbabc('0x3d')]){_0x4ddfe5[_0xbabc('0x44')]=[{'all':!![]}];}_0x4ddfe5=_[_0xbabc('0x38')]({},_0x4ddfe5,_0x260ee5[_0xbabc('0x3b')]);return db[_0xbabc('0x3c')][_0xbabc('0x45')](_0x4ddfe5)[_0xbabc('0x23')](handleEntityNotFound(_0x567ab3,null))['then'](respondWithResult(_0x567ab3,null))['catch'](handleError(_0x567ab3,null));};exports[_0xbabc('0x46')]=function(_0x18ba06,_0x4cc44d){return db[_0xbabc('0x3c')]['create'](_0x18ba06[_0xbabc('0x47')],{})['then'](respondWithResult(_0x4cc44d,0xc9))['catch'](handleError(_0x4cc44d,null));};exports[_0xbabc('0x22')]=function(_0x5c4a96,_0x2b567d){if(_0x5c4a96[_0xbabc('0x47')]['id']){delete _0x5c4a96['body']['id'];}return db[_0xbabc('0x3c')][_0xbabc('0x45')]({'where':{'id':_0x5c4a96['params']['id']}})[_0xbabc('0x23')](handleEntityNotFound(_0x2b567d,null))[_0xbabc('0x23')](saveUpdates(_0x5c4a96[_0xbabc('0x47')],null))[_0xbabc('0x23')](respondWithResult(_0x2b567d,null))['catch'](handleError(_0x2b567d,null));};exports[_0xbabc('0x48')]=function(_0x5c1b3f,_0x568540){return db[_0xbabc('0x3c')]['find']({'where':{'id':_0x5c1b3f[_0xbabc('0x42')]['id']}})['then'](handleEntityNotFound(_0x568540,null))[_0xbabc('0x23')](removeEntity(_0x568540,null))[_0xbabc('0x40')](handleError(_0x568540,null));};exports[_0xbabc('0x49')]=function(_0x1acff8,_0x3f4009){return db['SquareReport']['describe']()['then'](respondWithResult(_0x3f4009,null))[_0xbabc('0x40')](handleError(_0x3f4009,null));};
\ No newline at end of file
index 02e7507..4c3153e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2558=['request-promise','path','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','bluebird'];(function(_0x42e98c,_0x1c6bb9){var _0x59803e=function(_0x3a587e){while(--_0x3a587e){_0x42e98c['push'](_0x42e98c['shift']());}};_0x59803e(++_0x1c6bb9);}(_0x2558,0xc1));var _0x8255=function(_0x22f76e,_0xba6d84){_0x22f76e=_0x22f76e-0x0;var _0xf91dbc=_0x2558[_0x22f76e];return _0xf91dbc;};'use strict';var _=require(_0x8255('0x0'));var util=require(_0x8255('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8255('0x2'));var rp=require(_0x8255('0x3'));var fs=require('fs');var path=require(_0x8255('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8255('0x5'));module[_0x8255('0x6')]=function(_0x434288,_0x4a40c3){return _0x434288[_0x8255('0x7')](_0x8255('0x8'),attributes,{'tableName':_0x8255('0x9'),'paranoid':![],'indexes':[{'name':_0x8255('0xa'),'fields':[_0x8255('0xb'),_0x8255('0xc')]},{'name':'leaveAt','fields':[_0x8255('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x96ea=['uid_pname','uniqueid','project_name','leaveAt','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SquareReport','report_square'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x96ea,0x174));var _0xa96e=function(_0x5e9689,_0x48e034){_0x5e9689=_0x5e9689-0x0;var _0x2fac94=_0x96ea[_0x5e9689];return _0x2fac94;};'use strict';var _=require('lodash');var util=require(_0xa96e('0x0'));var logger=require(_0xa96e('0x1'))(_0xa96e('0x2'));var moment=require(_0xa96e('0x3'));var BPromise=require(_0xa96e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa96e('0x5'));var rimraf=require(_0xa96e('0x6'));var config=require(_0xa96e('0x7'));var attributes=require('./squareReport.attributes');module[_0xa96e('0x8')]=function(_0x1fdf1b,_0x3ed995){return _0x1fdf1b[_0xa96e('0x9')](_0xa96e('0xa'),attributes,{'tableName':_0xa96e('0xb'),'paranoid':![],'indexes':[{'name':_0xa96e('0xc'),'fields':[_0xa96e('0xd'),_0xa96e('0xe')]},{'name':_0xa96e('0xf'),'fields':[_0xa96e('0xf')]}],'timestamps':!![]});};
\ No newline at end of file
index e4b458f..cc4dc92 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9898=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','body','options','debug','stringify','UpdateSquareReport','update','where','attributes','limit','lodash','util','moment'];(function(_0x2871ee,_0x7b21ed){var _0x4d9e56=function(_0x34508d){while(--_0x34508d){_0x2871ee['push'](_0x2871ee['shift']());}};_0x4d9e56(++_0x7b21ed);}(_0x9898,0x1aa));var _0x8989=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0x9898[_0x2984d0];return _0x2885f2;};'use strict';var _=require(_0x8989('0x0'));var util=require(_0x8989('0x1'));var moment=require(_0x8989('0x2'));var BPromise=require(_0x8989('0x3'));var rs=require(_0x8989('0x4'));var fs=require('fs');var Redis=require(_0x8989('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8989('0x6'));var logger=require(_0x8989('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8989('0x8'));var client=jayson[_0x8989('0x9')][_0x8989('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x525e46,_0xf20318,_0x4ea157){return new BPromise(function(_0x10e3de,_0x296aea){return client[_0x8989('0xb')](_0x525e46,_0x4ea157)[_0x8989('0xc')](function(_0x2f3f87){logger[_0x8989('0xd')]('SquareReport,\x20%s,\x20%s',_0xf20318,_0x8989('0xe'));logger['debug'](_0x8989('0xf'),_0xf20318,_0x8989('0xe'),JSON['stringify'](_0x2f3f87));if(_0x2f3f87[_0x8989('0x10')]){if(_0x2f3f87[_0x8989('0x10')][_0x8989('0x11')]===0x1f4){logger[_0x8989('0x10')](_0x8989('0x12'),_0xf20318,_0x2f3f87[_0x8989('0x10')][_0x8989('0x13')]);return _0x296aea(_0x2f3f87[_0x8989('0x10')]['message']);}logger[_0x8989('0x10')](_0x8989('0x12'),_0xf20318,_0x2f3f87[_0x8989('0x10')]['message']);return _0x10e3de(_0x2f3f87[_0x8989('0x10')][_0x8989('0x13')]);}else{logger[_0x8989('0xd')]('SquareReport,\x20%s,\x20%s',_0xf20318,_0x8989('0xe'));_0x10e3de(_0x2f3f87[_0x8989('0x14')]['message']);}})[_0x8989('0x15')](function(_0x2a08d5){logger[_0x8989('0x10')]('SquareReport,\x20%s,\x20%s',_0xf20318,_0x2a08d5);_0x296aea(_0x2a08d5);});});}exports[_0x8989('0x16')]=function(_0x12d58f){var _0x2020e2=this;return new Promise(function(_0x3a771c,_0x2ab169){return db[_0x8989('0x17')]['create'](_0x12d58f[_0x8989('0x18')],{'raw':_0x12d58f[_0x8989('0x19')]?_0x12d58f['options']['raw']===undefined?!![]:![]:!![]})[_0x8989('0xc')](function(_0x337c57){logger['info']('CreateSquareReport',_0x12d58f);logger[_0x8989('0x1a')]('CreateSquareReport',_0x12d58f,JSON[_0x8989('0x1b')](_0x337c57));_0x3a771c(_0x337c57);})[_0x8989('0x15')](function(_0x15003c){logger[_0x8989('0x10')](_0x8989('0x16'),_0x15003c[_0x8989('0x13')],_0x12d58f);_0x2ab169(_0x2020e2[_0x8989('0x10')](0x1f4,_0x15003c[_0x8989('0x13')]));});});};exports[_0x8989('0x1c')]=function(_0x3a5729){var _0x5c7292=this;return new Promise(function(_0x25c5af,_0x33b8f9){return db[_0x8989('0x17')][_0x8989('0x1d')](_0x3a5729[_0x8989('0x18')],{'raw':_0x3a5729[_0x8989('0x19')]?_0x3a5729[_0x8989('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a5729[_0x8989('0x19')]?_0x3a5729[_0x8989('0x19')][_0x8989('0x1e')]||null:null,'attributes':_0x3a5729[_0x8989('0x19')]?_0x3a5729[_0x8989('0x19')][_0x8989('0x1f')]||null:null,'limit':_0x3a5729[_0x8989('0x19')]?_0x3a5729[_0x8989('0x19')][_0x8989('0x20')]||null:null})['then'](function(_0x117ed6){logger[_0x8989('0xd')](_0x8989('0x1c'),_0x3a5729);logger[_0x8989('0x1a')](_0x8989('0x1c'),_0x3a5729,JSON[_0x8989('0x1b')](_0x117ed6));_0x25c5af(_0x117ed6);})[_0x8989('0x15')](function(_0x2c480b){logger['error'](_0x8989('0x1c'),_0x2c480b[_0x8989('0x13')],_0x3a5729);_0x33b8f9(_0x5c7292[_0x8989('0x10')](0x1f4,_0x2c480b[_0x8989('0x13')]));});});};
\ No newline at end of file
+var _0xc54c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','raw','where','then','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc54c,0x1d0));var _0xcc54=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc54c[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xcc54('0x0'));var util=require(_0xcc54('0x1'));var moment=require(_0xcc54('0x2'));var BPromise=require(_0xcc54('0x3'));var rs=require(_0xcc54('0x4'));var fs=require('fs');var Redis=require(_0xcc54('0x5'));var db=require(_0xcc54('0x6'))['db'];var utils=require(_0xcc54('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xcc54('0x8'));var jayson=require(_0xcc54('0x9'));var client=jayson['client'][_0xcc54('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x544c1a,_0x24cb7d,_0x41758f){return new BPromise(function(_0x358f25,_0x28d162){return client['request'](_0x544c1a,_0x41758f)['then'](function(_0x185b48){logger[_0xcc54('0xb')]('SquareReport,\x20%s,\x20%s',_0x24cb7d,_0xcc54('0xc'));logger[_0xcc54('0xd')](_0xcc54('0xe'),_0x24cb7d,_0xcc54('0xc'),JSON[_0xcc54('0xf')](_0x185b48));if(_0x185b48[_0xcc54('0x10')]){if(_0x185b48[_0xcc54('0x10')][_0xcc54('0x11')]===0x1f4){logger['error'](_0xcc54('0x12'),_0x24cb7d,_0x185b48[_0xcc54('0x10')]['message']);return _0x28d162(_0x185b48[_0xcc54('0x10')]['message']);}logger[_0xcc54('0x10')]('SquareReport,\x20%s,\x20%s',_0x24cb7d,_0x185b48[_0xcc54('0x10')][_0xcc54('0x13')]);return _0x358f25(_0x185b48['error'][_0xcc54('0x13')]);}else{logger[_0xcc54('0xb')]('SquareReport,\x20%s,\x20%s',_0x24cb7d,_0xcc54('0xc'));_0x358f25(_0x185b48[_0xcc54('0x14')][_0xcc54('0x13')]);}})[_0xcc54('0x15')](function(_0x5ad4ff){logger['error'](_0xcc54('0x12'),_0x24cb7d,_0x5ad4ff);_0x28d162(_0x5ad4ff);});});}exports[_0xcc54('0x16')]=function(_0x190d47){var _0x33639f=this;return new Promise(function(_0x59c05b,_0xf2dc35){return db[_0xcc54('0x17')][_0xcc54('0x18')](_0x190d47[_0xcc54('0x19')],{'raw':_0x190d47[_0xcc54('0x1a')]?_0x190d47[_0xcc54('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x358450){logger[_0xcc54('0xb')](_0xcc54('0x16'),_0x190d47);logger[_0xcc54('0xd')]('CreateSquareReport',_0x190d47,JSON[_0xcc54('0xf')](_0x358450));_0x59c05b(_0x358450);})['catch'](function(_0x53b26d){logger[_0xcc54('0x10')](_0xcc54('0x16'),_0x53b26d[_0xcc54('0x13')],_0x190d47);_0xf2dc35(_0x33639f[_0xcc54('0x10')](0x1f4,_0x53b26d['message']));});});};exports[_0xcc54('0x1b')]=function(_0x3f9d85){var _0x3f5c23=this;return new Promise(function(_0x260fb8,_0xfbe39d){return db['SquareReport']['update'](_0x3f9d85[_0xcc54('0x19')],{'raw':_0x3f9d85['options']?_0x3f9d85[_0xcc54('0x1a')][_0xcc54('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f9d85['options']?_0x3f9d85[_0xcc54('0x1a')][_0xcc54('0x1d')]||null:null,'attributes':_0x3f9d85[_0xcc54('0x1a')]?_0x3f9d85[_0xcc54('0x1a')]['attributes']||null:null,'limit':_0x3f9d85[_0xcc54('0x1a')]?_0x3f9d85['options']['limit']||null:null})[_0xcc54('0x1e')](function(_0x235207){logger[_0xcc54('0xb')](_0xcc54('0x1b'),_0x3f9d85);logger[_0xcc54('0xd')]('UpdateSquareReport',_0x3f9d85,JSON[_0xcc54('0xf')](_0x235207));_0x260fb8(_0x235207);})['catch'](function(_0x647b26){logger['error'](_0xcc54('0x1b'),_0x647b26[_0xcc54('0x13')],_0x3f9d85);_0xfbe39d(_0x3f5c23[_0xcc54('0x10')](0x1f4,_0x647b26[_0xcc54('0x13')]));});});};
\ No newline at end of file
index ab22758..12ac703 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0ff4=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x49765f,_0x3c8100){var _0x51f186=function(_0x25723d){while(--_0x25723d){_0x49765f['push'](_0x49765f['shift']());}};_0x51f186(++_0x3c8100);}(_0x0ff4,0x187));var _0x40ff=function(_0x59710f,_0x44c7f0){_0x59710f=_0x59710f-0x0;var _0xaae66a=_0x0ff4[_0x59710f];return _0xaae66a;};'use strict';var multer=require('multer');var util=require(_0x40ff('0x0'));var path=require('path');var timeout=require(_0x40ff('0x1'));var express=require(_0x40ff('0x2'));var router=express[_0x40ff('0x3')]();var fs_extra=require(_0x40ff('0x4'));var auth=require(_0x40ff('0x5'));var interaction=require(_0x40ff('0x6'));var config=require(_0x40ff('0x7'));var controller=require(_0x40ff('0x8'));router['get']('/',auth[_0x40ff('0x9')](),controller[_0x40ff('0xa')]);router[_0x40ff('0xb')](_0x40ff('0xc'),auth[_0x40ff('0x9')](),controller[_0x40ff('0xd')]);router[_0x40ff('0xb')](_0x40ff('0xe'),auth[_0x40ff('0x9')](),controller[_0x40ff('0xf')]);router[_0x40ff('0x10')]('/',auth[_0x40ff('0x9')](),controller[_0x40ff('0x11')]);router[_0x40ff('0x12')](_0x40ff('0xe'),auth[_0x40ff('0x9')](),controller[_0x40ff('0x13')]);router[_0x40ff('0x14')]('/:id',auth[_0x40ff('0x9')](),controller[_0x40ff('0x15')]);module[_0x40ff('0x16')]=router;
\ No newline at end of file
+var _0x7a8f=['../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x213aff,_0x225d78){var _0x366840=function(_0x4abf58){while(--_0x4abf58){_0x213aff['push'](_0x213aff['shift']());}};_0x366840(++_0x225d78);}(_0x7a8f,0x15b));var _0xf7a8=function(_0x4eb623,_0x1977b9){_0x4eb623=_0x4eb623-0x0;var _0x5490be=_0x7a8f[_0x4eb623];return _0x5490be;};'use strict';var multer=require('multer');var util=require(_0xf7a8('0x0'));var path=require(_0xf7a8('0x1'));var timeout=require(_0xf7a8('0x2'));var express=require(_0xf7a8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf7a8('0x4'));var config=require(_0xf7a8('0x5'));var controller=require(_0xf7a8('0x6'));router[_0xf7a8('0x7')]('/',auth[_0xf7a8('0x8')](),controller[_0xf7a8('0x9')]);router[_0xf7a8('0x7')]('/describe',auth[_0xf7a8('0x8')](),controller[_0xf7a8('0xa')]);router[_0xf7a8('0x7')](_0xf7a8('0xb'),auth[_0xf7a8('0x8')](),controller['show']);router['post']('/',auth[_0xf7a8('0x8')](),controller['create']);router['put'](_0xf7a8('0xb'),auth['isAuthenticated'](),controller[_0xf7a8('0xc')]);router[_0xf7a8('0xd')](_0xf7a8('0xb'),auth['isAuthenticated'](),controller[_0xf7a8('0xe')]);module[_0xf7a8('0xf')]=router;
\ No newline at end of file
index b68bfe3..99c0320 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5d87=['TEXT','sequelize','exports','STRING'];(function(_0xbc4cf2,_0x37ed42){var _0x126452=function(_0x46c696){while(--_0x46c696){_0xbc4cf2['push'](_0xbc4cf2['shift']());}};_0x126452(++_0x37ed42);}(_0x5d87,0x6d));var _0x75d8=function(_0x23a7a6,_0x322f16){_0x23a7a6=_0x23a7a6-0x0;var _0x4f3b59=_0x5d87[_0x23a7a6];return _0x4f3b59;};'use strict';var Sequelize=require(_0x75d8('0x0'));module[_0x75d8('0x1')]={'uniqueid':{'type':Sequelize[_0x75d8('0x2')]},'node':{'type':Sequelize[_0x75d8('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x75d8('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x75d8('0x2')]}};
\ No newline at end of file
+var _0xf860=['exports','STRING','sequelize'];(function(_0x240b02,_0x12da08){var _0x3188cf=function(_0x5e30ff){while(--_0x5e30ff){_0x240b02['push'](_0x240b02['shift']());}};_0x3188cf(++_0x12da08);}(_0xf860,0x1a3));var _0x0f86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf860[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0f86('0x0'));module[_0x0f86('0x1')]={'uniqueid':{'type':Sequelize[_0x0f86('0x2')]},'node':{'type':Sequelize[_0x0f86('0x2')]},'application':{'type':Sequelize[_0x0f86('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x0f86('0x2')]},'callerid':{'type':Sequelize[_0x0f86('0x2')]}};
\ No newline at end of file
index adff82e..6c0adaf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0113=['end','undefined','limit','count','offset','Content-Range','reject','update','then','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','rows','show','params','include','find','catch','create','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x289842,_0x2d9db4){var _0x16155a=function(_0x1d0510){while(--_0x1d0510){_0x289842['push'](_0x289842['shift']());}};_0x16155a(++_0x2d9db4);}(_0x0113,0x185));var _0x3011=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0113[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x3011('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3011('0x1'));var jsonpatch=require(_0x3011('0x2'));var rp=require(_0x3011('0x3'));var moment=require(_0x3011('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3011('0x5'));var util=require(_0x3011('0x6'));var path=require(_0x3011('0x7'));var sox=require(_0x3011('0x8'));var csv=require('to-csv');var ejs=require(_0x3011('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3011('0xa'));var squel=require(_0x3011('0xb'));var crypto=require('crypto');var jsforce=require(_0x3011('0xc'));var deskjs=require(_0x3011('0xd'));var toCsv=require(_0x3011('0xe'));var querystring=require('querystring');var Papa=require(_0x3011('0xf'));var Redis=require(_0x3011('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3011('0x11'));var hardwareService=require(_0x3011('0x12'));var logger=require(_0x3011('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3011('0x14'));var licenseUtil=require(_0x3011('0x15'));var db=require(_0x3011('0x16'))['db'];function respondWithStatusCode(_0x4328b9,_0x24c881){_0x24c881=_0x24c881||0xcc;return function(_0x512321){if(_0x512321){return _0x4328b9[_0x3011('0x17')](_0x24c881);}return _0x4328b9[_0x3011('0x18')](_0x24c881)[_0x3011('0x19')]();};}function respondWithResult(_0x6a595c,_0x1efc86){_0x1efc86=_0x1efc86||0xc8;return function(_0x376174){if(_0x376174){return _0x6a595c['status'](_0x1efc86)['json'](_0x376174);}};}function respondWithFilteredResult(_0x42c189,_0x46a2bc){return function(_0x4c73e7){if(_0x4c73e7){var _0x56b6bd=typeof _0x46a2bc['offset']===_0x3011('0x1a')&&typeof _0x46a2bc[_0x3011('0x1b')]===_0x3011('0x1a');var _0x4bb382=_0x4c73e7[_0x3011('0x1c')];var _0x5594fe=_0x56b6bd?0x0:_0x46a2bc[_0x3011('0x1d')];var _0x15c24c=_0x56b6bd?_0x4c73e7[_0x3011('0x1c')]:_0x46a2bc['offset']+_0x46a2bc[_0x3011('0x1b')];var _0x4c9f5c;if(_0x15c24c>=_0x4bb382){_0x15c24c=_0x4bb382;_0x4c9f5c=0xc8;}else{_0x4c9f5c=0xce;}_0x42c189['status'](_0x4c9f5c);return _0x42c189['set'](_0x3011('0x1e'),_0x5594fe+'-'+_0x15c24c+'/'+_0x4bb382)['json'](_0x4c73e7);}return null;};}function patchUpdates(_0x40c20e){return function(_0xee9e2c){try{jsonpatch['apply'](_0xee9e2c,_0x40c20e,!![]);}catch(_0x2d4463){return BPromise[_0x3011('0x1f')](_0x2d4463);}return _0xee9e2c['save']();};}function saveUpdates(_0x5cb247,_0x1a3b67){return function(_0x5720ec){if(_0x5720ec){return _0x5720ec[_0x3011('0x20')](_0x5cb247)[_0x3011('0x21')](function(_0x4bef1e){return _0x4bef1e;});}return null;};}function removeEntity(_0x13869c,_0x17f43f){return function(_0x2a300e){if(_0x2a300e){return _0x2a300e['destroy']()[_0x3011('0x21')](function(){_0x13869c[_0x3011('0x18')](0xcc)[_0x3011('0x19')]();});}};}function handleEntityNotFound(_0x46bbc4,_0x4c8433){return function(_0x4a9d72){if(!_0x4a9d72){_0x46bbc4[_0x3011('0x17')](0x194);}return _0x4a9d72;};}function handleError(_0x4031f1,_0x32814a){_0x32814a=_0x32814a||0x1f4;return function(_0x1e449b){logger[_0x3011('0x22')](_0x1e449b[_0x3011('0x23')]);if(_0x1e449b[_0x3011('0x24')]){delete _0x1e449b[_0x3011('0x24')];}_0x4031f1['status'](_0x32814a)[_0x3011('0x25')](_0x1e449b);};}exports[_0x3011('0x26')]=function(_0x3c5220,_0x3c43e4){var _0xebe8dc={},_0x342f2d={},_0x4f9a84={'count':0x0,'rows':[]};var _0x623a89=_[_0x3011('0x27')](db[_0x3011('0x28')][_0x3011('0x29')],function(_0x211785){return{'name':_0x211785[_0x3011('0x2a')],'type':_0x211785['type'][_0x3011('0x2b')]};});_0x342f2d[_0x3011('0x2c')]=_['map'](_0x623a89,_0x3011('0x24'));_0x342f2d[_0x3011('0x2d')]=_[_0x3011('0x2e')](_0x3c5220[_0x3011('0x2d')]);_0x342f2d[_0x3011('0x2f')]=_[_0x3011('0x30')](_0x342f2d['model'],_0x342f2d[_0x3011('0x2d')]);_0xebe8dc[_0x3011('0x31')]=_[_0x3011('0x30')](_0x342f2d[_0x3011('0x2c')],qs[_0x3011('0x32')](_0x3c5220[_0x3011('0x2d')][_0x3011('0x32')]));_0xebe8dc['attributes']=_0xebe8dc[_0x3011('0x31')]['length']?_0xebe8dc[_0x3011('0x31')]:_0x342f2d[_0x3011('0x2c')];if(!_0x3c5220[_0x3011('0x2d')][_0x3011('0x33')]('nolimit')){_0xebe8dc['limit']=qs[_0x3011('0x1b')](_0x3c5220[_0x3011('0x2d')][_0x3011('0x1b')]);_0xebe8dc[_0x3011('0x1d')]=qs['offset'](_0x3c5220['query'][_0x3011('0x1d')]);}_0xebe8dc[_0x3011('0x34')]=qs[_0x3011('0x35')](_0x3c5220[_0x3011('0x2d')][_0x3011('0x35')]);_0xebe8dc[_0x3011('0x36')]=qs[_0x3011('0x2f')](_[_0x3011('0x37')](_0x3c5220[_0x3011('0x2d')],_0x342f2d[_0x3011('0x2f')]),_0x623a89);if(_0x3c5220[_0x3011('0x2d')]['filter']){_0xebe8dc[_0x3011('0x36')]=_[_0x3011('0x38')](_0xebe8dc[_0x3011('0x36')],{'$or':_[_0x3011('0x27')](_0x623a89,function(_0x51afab){if(_0x51afab['type']!==_0x3011('0x39')){var _0x53244d={};_0x53244d[_0x51afab['name']]={'$like':'%'+_0x3c5220[_0x3011('0x2d')]['filter']+'%'};return _0x53244d;}})});}_0xebe8dc=_[_0x3011('0x38')]({},_0xebe8dc,_0x3c5220[_0x3011('0x3a')]);var _0x45698c={'where':_0xebe8dc[_0x3011('0x36')]};return db[_0x3011('0x28')]['count'](_0x45698c)[_0x3011('0x21')](function(_0x3bbb84){_0x4f9a84[_0x3011('0x1c')]=_0x3bbb84;if(_0x3c5220[_0x3011('0x2d')][_0x3011('0x3b')]){_0xebe8dc['include']=[{'all':!![]}];}return db[_0x3011('0x28')]['findAll'](_0xebe8dc);})[_0x3011('0x21')](function(_0x43da85){_0x4f9a84[_0x3011('0x3c')]=_0x43da85;return _0x4f9a84;})['then'](respondWithFilteredResult(_0x3c43e4,_0xebe8dc))['catch'](handleError(_0x3c43e4,null));};exports[_0x3011('0x3d')]=function(_0x54217f,_0x1e32c2){var _0x36e3c0={'raw':!![],'where':{'id':_0x54217f[_0x3011('0x3e')]['id']}},_0x3377ab={};_0x3377ab[_0x3011('0x2c')]=_['keys'](db['SquareDetailsReport'][_0x3011('0x29')]);_0x3377ab['query']=_[_0x3011('0x2e')](_0x54217f[_0x3011('0x2d')]);_0x3377ab['filters']=_[_0x3011('0x30')](_0x3377ab[_0x3011('0x2c')],_0x3377ab[_0x3011('0x2d')]);_0x36e3c0[_0x3011('0x31')]=_[_0x3011('0x30')](_0x3377ab['model'],qs[_0x3011('0x32')](_0x54217f['query'][_0x3011('0x32')]));_0x36e3c0[_0x3011('0x31')]=_0x36e3c0['attributes']['length']?_0x36e3c0[_0x3011('0x31')]:_0x3377ab['model'];if(_0x54217f[_0x3011('0x2d')][_0x3011('0x3b')]){_0x36e3c0[_0x3011('0x3f')]=[{'all':!![]}];}_0x36e3c0=_[_0x3011('0x38')]({},_0x36e3c0,_0x54217f['options']);return db[_0x3011('0x28')][_0x3011('0x40')](_0x36e3c0)['then'](handleEntityNotFound(_0x1e32c2,null))['then'](respondWithResult(_0x1e32c2,null))[_0x3011('0x41')](handleError(_0x1e32c2,null));};exports[_0x3011('0x42')]=function(_0x1988ee,_0x1c1765){return db['SquareDetailsReport'][_0x3011('0x42')](_0x1988ee['body'],{})[_0x3011('0x21')](respondWithResult(_0x1c1765,0xc9))[_0x3011('0x41')](handleError(_0x1c1765,null));};exports['update']=function(_0x4feecf,_0x3632ea){if(_0x4feecf['body']['id']){delete _0x4feecf['body']['id'];}return db[_0x3011('0x28')][_0x3011('0x40')]({'where':{'id':_0x4feecf[_0x3011('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3632ea,null))['then'](saveUpdates(_0x4feecf['body'],null))['then'](respondWithResult(_0x3632ea,null))['catch'](handleError(_0x3632ea,null));};exports[_0x3011('0x43')]=function(_0x37616a,_0x3e420a){return db[_0x3011('0x28')][_0x3011('0x40')]({'where':{'id':_0x37616a[_0x3011('0x3e')]['id']}})[_0x3011('0x21')](handleEntityNotFound(_0x3e420a,null))[_0x3011('0x21')](removeEntity(_0x3e420a,null))[_0x3011('0x41')](handleError(_0x3e420a,null));};exports['describe']=function(_0x47fec5,_0x2ba208){return db[_0x3011('0x28')][_0x3011('0x44')]()[_0x3011('0x21')](respondWithResult(_0x2ba208,null))[_0x3011('0x41')](handleError(_0x2ba208,null));};
\ No newline at end of file
+var _0xb046=['destroy','end','error','stack','name','index','map','SquareDetailsReport','rawAttributes','type','key','query','filters','model','intersection','fields','attributes','hasOwnProperty','sort','where','pick','merge','filter','includeAll','rows','show','params','keys','length','include','options','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','reject','update','then'];(function(_0x397eec,_0x22289b){var _0x11f3dd=function(_0x181a93){while(--_0x181a93){_0x397eec['push'](_0x397eec['shift']());}};_0x11f3dd(++_0x22289b);}(_0xb046,0x102));var _0x6b04=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0xb046[_0x2bddf9];return _0x3f3ae9;};'use strict';var emlformat=require(_0x6b04('0x0'));var rimraf=require(_0x6b04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b04('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6b04('0x3'));var Mustache=require(_0x6b04('0x4'));var util=require(_0x6b04('0x5'));var path=require(_0x6b04('0x6'));var sox=require(_0x6b04('0x7'));var csv=require(_0x6b04('0x8'));var ejs=require(_0x6b04('0x9'));var fs=require('fs');var fs_extra=require(_0x6b04('0xa'));var _=require(_0x6b04('0xb'));var squel=require(_0x6b04('0xc'));var crypto=require(_0x6b04('0xd'));var jsforce=require(_0x6b04('0xe'));var deskjs=require(_0x6b04('0xf'));var toCsv=require(_0x6b04('0x8'));var querystring=require(_0x6b04('0x10'));var Papa=require(_0x6b04('0x11'));var Redis=require(_0x6b04('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6b04('0x13'));var as=require(_0x6b04('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b04('0x15'))(_0x6b04('0x16'));var utils=require(_0x6b04('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6b04('0x18'));var db=require(_0x6b04('0x19'))['db'];function respondWithStatusCode(_0x14fe8a,_0x1b8160){_0x1b8160=_0x1b8160||0xcc;return function(_0x233f88){if(_0x233f88){return _0x14fe8a[_0x6b04('0x1a')](_0x1b8160);}return _0x14fe8a[_0x6b04('0x1b')](_0x1b8160)['end']();};}function respondWithResult(_0x4f7964,_0x513b85){_0x513b85=_0x513b85||0xc8;return function(_0x56e224){if(_0x56e224){return _0x4f7964[_0x6b04('0x1b')](_0x513b85)['json'](_0x56e224);}};}function respondWithFilteredResult(_0x1f1944,_0x910a7d){return function(_0x5386d7){if(_0x5386d7){var _0x5ef5ef=typeof _0x910a7d[_0x6b04('0x1c')]==='undefined'&&typeof _0x910a7d['limit']===_0x6b04('0x1d');var _0x1f2ad8=_0x5386d7[_0x6b04('0x1e')];var _0x4ce2c2=_0x5ef5ef?0x0:_0x910a7d[_0x6b04('0x1c')];var _0x42e5ee=_0x5ef5ef?_0x5386d7[_0x6b04('0x1e')]:_0x910a7d['offset']+_0x910a7d[_0x6b04('0x1f')];var _0x2b9cfd;if(_0x42e5ee>=_0x1f2ad8){_0x42e5ee=_0x1f2ad8;_0x2b9cfd=0xc8;}else{_0x2b9cfd=0xce;}_0x1f1944[_0x6b04('0x1b')](_0x2b9cfd);return _0x1f1944['set'](_0x6b04('0x20'),_0x4ce2c2+'-'+_0x42e5ee+'/'+_0x1f2ad8)[_0x6b04('0x21')](_0x5386d7);}return null;};}function patchUpdates(_0x236118){return function(_0x902f90){try{jsonpatch[_0x6b04('0x22')](_0x902f90,_0x236118,!![]);}catch(_0x52e1c6){return BPromise[_0x6b04('0x23')](_0x52e1c6);}return _0x902f90['save']();};}function saveUpdates(_0x467252,_0x50ccd0){return function(_0x2152b4){if(_0x2152b4){return _0x2152b4[_0x6b04('0x24')](_0x467252)[_0x6b04('0x25')](function(_0x3340ba){return _0x3340ba;});}return null;};}function removeEntity(_0x10b3d8,_0x45f89a){return function(_0x3d4ebe){if(_0x3d4ebe){return _0x3d4ebe[_0x6b04('0x26')]()[_0x6b04('0x25')](function(){_0x10b3d8[_0x6b04('0x1b')](0xcc)[_0x6b04('0x27')]();});}};}function handleEntityNotFound(_0x3dd5ce,_0x444e4e){return function(_0x4ab5c8){if(!_0x4ab5c8){_0x3dd5ce[_0x6b04('0x1a')](0x194);}return _0x4ab5c8;};}function handleError(_0x3589e6,_0x2a7dca){_0x2a7dca=_0x2a7dca||0x1f4;return function(_0x1b90e1){logger[_0x6b04('0x28')](_0x1b90e1[_0x6b04('0x29')]);if(_0x1b90e1[_0x6b04('0x2a')]){delete _0x1b90e1[_0x6b04('0x2a')];}_0x3589e6['status'](_0x2a7dca)['send'](_0x1b90e1);};}exports[_0x6b04('0x2b')]=function(_0x594ba6,_0x47ea02){var _0x2852b2={},_0x219230={},_0x326666={'count':0x0,'rows':[]};var _0x260170=_[_0x6b04('0x2c')](db[_0x6b04('0x2d')][_0x6b04('0x2e')],function(_0x3090d8){return{'name':_0x3090d8['fieldName'],'type':_0x3090d8[_0x6b04('0x2f')][_0x6b04('0x30')]};});_0x219230['model']=_[_0x6b04('0x2c')](_0x260170,_0x6b04('0x2a'));_0x219230[_0x6b04('0x31')]=_['keys'](_0x594ba6['query']);_0x219230[_0x6b04('0x32')]=_['intersection'](_0x219230[_0x6b04('0x33')],_0x219230[_0x6b04('0x31')]);_0x2852b2['attributes']=_[_0x6b04('0x34')](_0x219230['model'],qs[_0x6b04('0x35')](_0x594ba6['query'][_0x6b04('0x35')]));_0x2852b2[_0x6b04('0x36')]=_0x2852b2[_0x6b04('0x36')]['length']?_0x2852b2[_0x6b04('0x36')]:_0x219230[_0x6b04('0x33')];if(!_0x594ba6[_0x6b04('0x31')][_0x6b04('0x37')]('nolimit')){_0x2852b2['limit']=qs['limit'](_0x594ba6[_0x6b04('0x31')][_0x6b04('0x1f')]);_0x2852b2[_0x6b04('0x1c')]=qs['offset'](_0x594ba6[_0x6b04('0x31')][_0x6b04('0x1c')]);}_0x2852b2['order']=qs[_0x6b04('0x38')](_0x594ba6[_0x6b04('0x31')][_0x6b04('0x38')]);_0x2852b2[_0x6b04('0x39')]=qs['filters'](_[_0x6b04('0x3a')](_0x594ba6[_0x6b04('0x31')],_0x219230['filters']),_0x260170);if(_0x594ba6[_0x6b04('0x31')]['filter']){_0x2852b2[_0x6b04('0x39')]=_[_0x6b04('0x3b')](_0x2852b2[_0x6b04('0x39')],{'$or':_[_0x6b04('0x2c')](_0x260170,function(_0x505528){if(_0x505528[_0x6b04('0x2f')]!=='VIRTUAL'){var _0x509575={};_0x509575[_0x505528[_0x6b04('0x2a')]]={'$like':'%'+_0x594ba6['query'][_0x6b04('0x3c')]+'%'};return _0x509575;}})});}_0x2852b2=_['merge']({},_0x2852b2,_0x594ba6['options']);var _0x143dcc={'where':_0x2852b2['where']};return db[_0x6b04('0x2d')]['count'](_0x143dcc)['then'](function(_0x166fc4){_0x326666['count']=_0x166fc4;if(_0x594ba6[_0x6b04('0x31')][_0x6b04('0x3d')]){_0x2852b2['include']=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x2852b2);})[_0x6b04('0x25')](function(_0x5c6a9f){_0x326666[_0x6b04('0x3e')]=_0x5c6a9f;return _0x326666;})[_0x6b04('0x25')](respondWithFilteredResult(_0x47ea02,_0x2852b2))['catch'](handleError(_0x47ea02,null));};exports[_0x6b04('0x3f')]=function(_0xb6e6,_0x1d4a6e){var _0x3db51b={'raw':!![],'where':{'id':_0xb6e6[_0x6b04('0x40')]['id']}},_0x223710={};_0x223710[_0x6b04('0x33')]=_[_0x6b04('0x41')](db['SquareDetailsReport'][_0x6b04('0x2e')]);_0x223710[_0x6b04('0x31')]=_[_0x6b04('0x41')](_0xb6e6[_0x6b04('0x31')]);_0x223710['filters']=_['intersection'](_0x223710[_0x6b04('0x33')],_0x223710[_0x6b04('0x31')]);_0x3db51b[_0x6b04('0x36')]=_[_0x6b04('0x34')](_0x223710[_0x6b04('0x33')],qs['fields'](_0xb6e6[_0x6b04('0x31')]['fields']));_0x3db51b[_0x6b04('0x36')]=_0x3db51b['attributes'][_0x6b04('0x42')]?_0x3db51b[_0x6b04('0x36')]:_0x223710[_0x6b04('0x33')];if(_0xb6e6[_0x6b04('0x31')]['includeAll']){_0x3db51b[_0x6b04('0x43')]=[{'all':!![]}];}_0x3db51b=_['merge']({},_0x3db51b,_0xb6e6[_0x6b04('0x44')]);return db['SquareDetailsReport']['find'](_0x3db51b)[_0x6b04('0x25')](handleEntityNotFound(_0x1d4a6e,null))[_0x6b04('0x25')](respondWithResult(_0x1d4a6e,null))[_0x6b04('0x45')](handleError(_0x1d4a6e,null));};exports[_0x6b04('0x46')]=function(_0x5d7228,_0x5cedf3){return db[_0x6b04('0x2d')][_0x6b04('0x46')](_0x5d7228[_0x6b04('0x47')],{})[_0x6b04('0x25')](respondWithResult(_0x5cedf3,0xc9))[_0x6b04('0x45')](handleError(_0x5cedf3,null));};exports[_0x6b04('0x24')]=function(_0x5f3184,_0x1931b9){if(_0x5f3184[_0x6b04('0x47')]['id']){delete _0x5f3184[_0x6b04('0x47')]['id'];}return db['SquareDetailsReport'][_0x6b04('0x48')]({'where':{'id':_0x5f3184['params']['id']}})[_0x6b04('0x25')](handleEntityNotFound(_0x1931b9,null))[_0x6b04('0x25')](saveUpdates(_0x5f3184['body'],null))[_0x6b04('0x25')](respondWithResult(_0x1931b9,null))[_0x6b04('0x45')](handleError(_0x1931b9,null));};exports[_0x6b04('0x26')]=function(_0x9f6e00,_0x73db7a){return db[_0x6b04('0x2d')][_0x6b04('0x48')]({'where':{'id':_0x9f6e00['params']['id']}})[_0x6b04('0x25')](handleEntityNotFound(_0x73db7a,null))[_0x6b04('0x25')](removeEntity(_0x73db7a,null))[_0x6b04('0x45')](handleError(_0x73db7a,null));};exports[_0x6b04('0x49')]=function(_0x5af4b9,_0x425982){return db[_0x6b04('0x2d')][_0x6b04('0x49')]()['then'](respondWithResult(_0x425982,null))['catch'](handleError(_0x425982,null));};
\ No newline at end of file
index 32fe6c4..0e8e2f7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2e8c=['path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','api','moment','bluebird','request-promise'];(function(_0x1d12ea,_0x33a222){var _0x48ef19=function(_0x5be11d){while(--_0x5be11d){_0x1d12ea['push'](_0x1d12ea['shift']());}};_0x48ef19(++_0x33a222);}(_0x2e8c,0xd8));var _0xc2e8=function(_0x21005a,_0x241344){_0x21005a=_0x21005a-0x0;var _0x245de4=_0x2e8c[_0x21005a];return _0x245de4;};'use strict';var _=require(_0xc2e8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc2e8('0x1'));var moment=require(_0xc2e8('0x2'));var BPromise=require(_0xc2e8('0x3'));var rp=require(_0xc2e8('0x4'));var fs=require('fs');var path=require(_0xc2e8('0x5'));var rimraf=require(_0xc2e8('0x6'));var config=require(_0xc2e8('0x7'));var attributes=require(_0xc2e8('0x8'));module[_0xc2e8('0x9')]=function(_0x11681e,_0x284ae0){return _0x11681e[_0xc2e8('0xa')](_0xc2e8('0xb'),attributes,{'tableName':_0xc2e8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc6ef=['util','api','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','define','report_square_details','lodash'];(function(_0x43ac38,_0xc4321a){var _0x2eb7f4=function(_0x4a0628){while(--_0x4a0628){_0x43ac38['push'](_0x43ac38['shift']());}};_0x2eb7f4(++_0xc4321a);}(_0xc6ef,0x199));var _0xfc6e=function(_0x5b0adb,_0x4f1c27){_0x5b0adb=_0x5b0adb-0x0;var _0x490a9b=_0xc6ef[_0x5b0adb];return _0x490a9b;};'use strict';var _=require(_0xfc6e('0x0'));var util=require(_0xfc6e('0x1'));var logger=require('../../config/logger')(_0xfc6e('0x2'));var moment=require('moment');var BPromise=require(_0xfc6e('0x3'));var rp=require(_0xfc6e('0x4'));var fs=require('fs');var path=require(_0xfc6e('0x5'));var rimraf=require(_0xfc6e('0x6'));var config=require('../../config/environment');var attributes=require(_0xfc6e('0x7'));module['exports']=function(_0xacfc5,_0xcca240){return _0xacfc5[_0xfc6e('0x8')]('SquareDetailsReport',attributes,{'tableName':_0xfc6e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 8f87f22..1105de4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x14a0=['error','code','SquareDetailsReport,\x20%s,\x20%s','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x14a0,0x8e));var _0x014a=function(_0x37eb6d,_0x344c94){_0x37eb6d=_0x37eb6d-0x0;var _0x468549=_0x14a0[_0x37eb6d];return _0x468549;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')](_0x12d339[_0x014a('0x18')],{'raw':_0x12d339[_0x014a('0x19')]?_0x12d339[_0x014a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x014a('0xa')](function(_0x109a9c){logger[_0x014a('0x12')](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')](_0x014a('0x15'),_0x12d339,JSON[_0x014a('0xd')](_0x109a9c));_0x263b07(_0x109a9c);})[_0x014a('0x14')](function(_0x290b86){logger['error'](_0x014a('0x15'),_0x290b86['message'],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x290b86[_0x014a('0x11')]));});});};
\ No newline at end of file
+var _0xde9f=['../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareDetailsReport','options','raw','CreateSquareDetailsReport','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x572657,_0xd9d3e){var _0x3e2ed0=function(_0x54699e){while(--_0x54699e){_0x572657['push'](_0x572657['shift']());}};_0x3e2ed0(++_0xd9d3e);}(_0xde9f,0x118));var _0xfde9=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xde9f[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0xfde9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfde9('0x1'));var rs=require(_0xfde9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfde9('0x3'))['db'];var utils=require(_0xfde9('0x4'));var logger=require('../../config/logger')(_0xfde9('0x5'));var config=require(_0xfde9('0x6'));var jayson=require(_0xfde9('0x7'));var client=jayson[_0xfde9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3e01,_0x179ee0,_0x18a202){return new BPromise(function(_0x5569c2,_0x19a337){return client[_0xfde9('0x9')](_0x4c3e01,_0x18a202)[_0xfde9('0xa')](function(_0x3b775d){logger[_0xfde9('0xb')](_0xfde9('0xc'),_0x179ee0,_0xfde9('0xd'));logger[_0xfde9('0xe')](_0xfde9('0xf'),_0x179ee0,_0xfde9('0xd'),JSON[_0xfde9('0x10')](_0x3b775d));if(_0x3b775d[_0xfde9('0x11')]){if(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x12')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x19a337(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x5569c2(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}else{logger[_0xfde9('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x179ee0,_0xfde9('0xd'));_0x5569c2(_0x3b775d[_0xfde9('0x14')][_0xfde9('0x13')]);}})['catch'](function(_0x31b1c7){logger[_0xfde9('0x11')](_0xfde9('0xc'),_0x179ee0,_0x31b1c7);_0x19a337(_0x31b1c7);});});}exports['CreateSquareDetailsReport']=function(_0x4c9f24){var _0x5eb89e=this;return new Promise(function(_0x544f19,_0x166f1c){return db[_0xfde9('0x15')]['create'](_0x4c9f24['body'],{'raw':_0x4c9f24[_0xfde9('0x16')]?_0x4c9f24[_0xfde9('0x16')][_0xfde9('0x17')]===undefined?!![]:![]:!![]})[_0xfde9('0xa')](function(_0x162b07){logger[_0xfde9('0xb')](_0xfde9('0x18'),_0x4c9f24);logger[_0xfde9('0xe')](_0xfde9('0x18'),_0x4c9f24,JSON[_0xfde9('0x10')](_0x162b07));_0x544f19(_0x162b07);})[_0xfde9('0x19')](function(_0x28d189){logger['error'](_0xfde9('0x18'),_0x28d189['message'],_0x4c9f24);_0x166f1c(_0x5eb89e[_0xfde9('0x11')](0x1f4,_0x28d189[_0xfde9('0x13')]));});});};
\ No newline at end of file
index aafbc61..2cb5f4f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x760c=['exports','Router','../../components/auth/service','./system.controller','index','isAuthenticated','killProcess'];(function(_0x30b891,_0x3d90cc){var _0x53e089=function(_0x45670e){while(--_0x45670e){_0x30b891['push'](_0x30b891['shift']());}};_0x53e089(++_0x3d90cc);}(_0x760c,0x10b));var _0xc760=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x760c[_0x40a045];return _0x1a687c;};'use strict';var express=require('express');var router=express[_0xc760('0x0')]();var auth=require(_0xc760('0x1'));var controller=require(_0xc760('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0xc760('0x3')]);router['get']('/process/:pid/kill',auth[_0xc760('0x4')](),controller[_0xc760('0x5')]);module[_0xc760('0x6')]=router;
\ No newline at end of file
+var _0xe870=['../../components/auth/service','./system.controller','isAuthenticated','index','get','/process/:pid/kill','killProcess','exports','Router'];(function(_0x2ea7c3,_0x4a8cbc){var _0x171712=function(_0x3c3b14){while(--_0x3c3b14){_0x2ea7c3['push'](_0x2ea7c3['shift']());}};_0x171712(++_0x4a8cbc);}(_0xe870,0xfb));var _0x0e87=function(_0x221705,_0x3bedca){_0x221705=_0x221705-0x0;var _0x1a087c=_0xe870[_0x221705];return _0x1a087c;};'use strict';var express=require('express');var router=express[_0x0e87('0x0')]();var auth=require(_0x0e87('0x1'));var controller=require(_0x0e87('0x2'));router['get']('/',auth[_0x0e87('0x3')](),controller[_0x0e87('0x4')]);router[_0x0e87('0x5')](_0x0e87('0x6'),auth[_0x0e87('0x3')](),controller[_0x0e87('0x7')]);module[_0x0e87('0x8')]=router;
\ No newline at end of file
index 22235bd..e8ecda7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a5d=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','getAllData','json','catch','killProcess','components/import/cm','format'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7a5d,0xf8));var _0xd7a5=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7a5d[_0x1035c1];return _0x308d67;};'use strict';var info=require('systeminformation');var exec=require(_0xd7a5('0x0'))[_0xd7a5('0x1')];var logger=require(_0xd7a5('0x2'))(_0xd7a5('0x3'));var util=require(_0xd7a5('0x4'));var BPromise=require('bluebird');var _=require(_0xd7a5('0x5'));function handleError(_0x36a834,_0x7f4acb,_0x37df47){_0x7f4acb=_0x7f4acb||0x1f4;return function(_0x57b2c9){logger['error'](_0xd7a5('0x6'),_0x37df47,_0x7f4acb,util['inspect'](_0x57b2c9,{'showHidden':![],'depth':null}));delete _0x57b2c9[_0xd7a5('0x7')];_0x36a834[_0xd7a5('0x8')](_0x7f4acb)[_0xd7a5('0x9')](_0x57b2c9);};}exports['index']=function(_0x53eb72,_0x1452eb){return info[_0xd7a5('0xa')]()['then'](function(_0x295ec3){return _0x1452eb[_0xd7a5('0x8')](0xc8)[_0xd7a5('0xb')](_0x295ec3);})[_0xd7a5('0xc')](function(_0x55435b){return _0x1452eb[_0xd7a5('0x8')](0x1f4)[_0xd7a5('0xb')](_0x55435b);});};exports[_0xd7a5('0xd')]=function(_0x9eb800,_0x273778){var _0x2c1e44=[_0xd7a5('0xe')];return new BPromise(function(_0x48fdfb,_0x2dd7bd){return exec(util[_0xd7a5('0xf')](_0xd7a5('0x10'),_0x9eb800['params'][_0xd7a5('0x11')]),function(_0x4e7337,_0x1394d5,_0xc69643){if(_0x4e7337){return _0x2dd7bd(_0x4e7337);}return _0x48fdfb(_0x1394d5);});})['then'](function(_0x4d530f){var _0x5635c4=![];var _0xf3f25b=_0x4d530f[_0xd7a5('0x12')](/\n/);for(var _0x515f98=0x0,_0x516977=_0x2c1e44[_0xd7a5('0x13')];_0x515f98<_0x516977,_0x5635c4===![];_0x515f98+=0x1){if(_0x4d530f['indexOf'](_0x2c1e44[_0x515f98])>=0x0){_0x5635c4=!![];}}if(!_0x5635c4){throw new Error(util[_0xd7a5('0xf')](_0xd7a5('0x14'),_0x9eb800[_0xd7a5('0x15')]['pid']));}process['kill'](_0x9eb800[_0xd7a5('0x15')][_0xd7a5('0x11')],_0xd7a5('0x16'));return _0x273778[_0xd7a5('0x8')](0xc8)[_0xd7a5('0xb')]({'message':util[_0xd7a5('0xf')](_0xd7a5('0x17'),_0x9eb800[_0xd7a5('0x15')][_0xd7a5('0x11')])});})[_0xd7a5('0xc')](handleError(_0x273778,null,_0xd7a5('0xd')));};
\ No newline at end of file
+var _0x3086=['killProcess','components/import/cm','format','split','length','indexOf','params','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','../../config/logger','api','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','getAllData','then','json','catch'];(function(_0x9553a2,_0x5424d9){var _0x3e398c=function(_0x5e0e68){while(--_0x5e0e68){_0x9553a2['push'](_0x9553a2['shift']());}};_0x3e398c(++_0x5424d9);}(_0x3086,0xf1));var _0x6308=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x3086[_0x243b59];return _0x3e1676;};'use strict';var info=require('systeminformation');var exec=require(_0x6308('0x0'))['exec'];var logger=require(_0x6308('0x1'))(_0x6308('0x2'));var util=require('util');var BPromise=require(_0x6308('0x3'));var _=require(_0x6308('0x4'));function handleError(_0x3938b4,_0x10e76e,_0x6aa66f){_0x10e76e=_0x10e76e||0x1f4;return function(_0x2026d1){logger['error'](_0x6308('0x5'),_0x6aa66f,_0x10e76e,util['inspect'](_0x2026d1,{'showHidden':![],'depth':null}));delete _0x2026d1['name'];_0x3938b4[_0x6308('0x6')](_0x10e76e)[_0x6308('0x7')](_0x2026d1);};}exports['index']=function(_0x4c9d05,_0x375a13){return info[_0x6308('0x8')]()[_0x6308('0x9')](function(_0x49c1cb){return _0x375a13[_0x6308('0x6')](0xc8)[_0x6308('0xa')](_0x49c1cb);})[_0x6308('0xb')](function(_0x3ef623){return _0x375a13[_0x6308('0x6')](0x1f4)['json'](_0x3ef623);});};exports[_0x6308('0xc')]=function(_0x351ae5,_0x41bbb7){var _0x527a2a=[_0x6308('0xd')];return new BPromise(function(_0x31acab,_0xcf78a9){return exec(util[_0x6308('0xe')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x351ae5['params']['pid']),function(_0x4e9ec9,_0x41fd11,_0x10b33a){if(_0x4e9ec9){return _0xcf78a9(_0x4e9ec9);}return _0x31acab(_0x41fd11);});})[_0x6308('0x9')](function(_0x11889f){var _0x424ec9=![];var _0xdc4728=_0x11889f[_0x6308('0xf')](/\n/);for(var _0x365625=0x0,_0x535e36=_0x527a2a[_0x6308('0x10')];_0x365625<_0x535e36,_0x424ec9===![];_0x365625+=0x1){if(_0x11889f[_0x6308('0x11')](_0x527a2a[_0x365625])>=0x0){_0x424ec9=!![];}}if(!_0x424ec9){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x351ae5[_0x6308('0x12')][_0x6308('0x13')]));}process[_0x6308('0x14')](_0x351ae5[_0x6308('0x12')][_0x6308('0x13')],_0x6308('0x15'));return _0x41bbb7[_0x6308('0x6')](0xc8)[_0x6308('0xa')]({'message':util[_0x6308('0xe')](_0x6308('0x16'),_0x351ae5[_0x6308('0x12')][_0x6308('0x13')])});})[_0x6308('0xb')](handleError(_0x41bbb7,null,_0x6308('0xc')));};
\ No newline at end of file
index 361f0b5..cae20ee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x353f=['/:id','create','put','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated'];(function(_0xee18e4,_0x1835eb){var _0x5993a8=function(_0x1af87c){while(--_0x1af87c){_0xee18e4['push'](_0xee18e4['shift']());}};_0x5993a8(++_0x1835eb);}(_0x353f,0x1d7));var _0xf353=function(_0x5760dd,_0x8f96ca){_0x5760dd=_0x5760dd-0x0;var _0x38157e=_0x353f[_0x5760dd];return _0x38157e;};'use strict';var multer=require('multer');var util=require(_0xf353('0x0'));var path=require('path');var timeout=require(_0xf353('0x1'));var express=require(_0xf353('0x2'));var router=express['Router']();var fs_extra=require(_0xf353('0x3'));var auth=require(_0xf353('0x4'));var interaction=require(_0xf353('0x5'));var config=require('../../config/environment');var controller=require(_0xf353('0x6'));router[_0xf353('0x7')]('/',auth[_0xf353('0x8')](),controller['index']);router['get'](_0xf353('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf353('0x8')](),controller[_0xf353('0xa')]);router[_0xf353('0xb')](_0xf353('0x9'),auth[_0xf353('0x8')](),controller['update']);router[_0xf353('0xc')](_0xf353('0x9'),auth['isAuthenticated'](),controller[_0xf353('0xd')]);module[_0xf353('0xe')]=router;
\ No newline at end of file
+var _0x1295=['put','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x20a1c3,_0x4019cb){var _0x20ff3b=function(_0x1d0c9f){while(--_0x1d0c9f){_0x20a1c3['push'](_0x20a1c3['shift']());}};_0x20ff3b(++_0x4019cb);}(_0x1295,0x191));var _0x5129=function(_0x2bbb13,_0x370195){_0x2bbb13=_0x2bbb13-0x0;var _0xccaff9=_0x1295[_0x2bbb13];return _0xccaff9;};'use strict';var multer=require(_0x5129('0x0'));var util=require('util');var path=require(_0x5129('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5129('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5129('0x3'));var interaction=require(_0x5129('0x4'));var config=require(_0x5129('0x5'));var controller=require(_0x5129('0x6'));router[_0x5129('0x7')]('/',auth[_0x5129('0x8')](),controller[_0x5129('0x9')]);router[_0x5129('0x7')](_0x5129('0xa'),auth[_0x5129('0x8')](),controller[_0x5129('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5129('0xc')]);router[_0x5129('0xd')](_0x5129('0xa'),auth['isAuthenticated'](),controller[_0x5129('0xe')]);router[_0x5129('0xf')]('/:id',auth[_0x5129('0x8')](),controller[_0x5129('0x10')]);module[_0x5129('0x11')]=router;
\ No newline at end of file
index 183e286..4867228 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c00=['sequelize','exports','STRING','#0091EA'];(function(_0x33155c,_0x3fdde1){var _0x5becf7=function(_0x2f7a2f){while(--_0x2f7a2f){_0x33155c['push'](_0x33155c['shift']());}};_0x5becf7(++_0x3fdde1);}(_0x9c00,0x1a0));var _0x09c0=function(_0x5207d3,_0x1b67d4){_0x5207d3=_0x5207d3-0x0;var _0x36785c=_0x9c00[_0x5207d3];return _0x36785c;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x09c0('0x2')],'defaultValue':_0x09c0('0x3')},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x7916=['sequelize','STRING','name','#0091EA'];(function(_0x155719,_0x123b9d){var _0x41e840=function(_0x36498c){while(--_0x36498c){_0x155719['push'](_0x155719['shift']());}};_0x41e840(++_0x123b9d);}(_0x7916,0x128));var _0x6791=function(_0x3fbd48,_0x389edb){_0x3fbd48=_0x3fbd48-0x0;var _0x2989b4=_0x7916[_0x3fbd48];return _0x2989b4;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x6791('0x3')},'description':{'type':Sequelize[_0x6791('0x1')]}};
\ No newline at end of file
index 99a4d9c..08e2986 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x32ef=['lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','Tags','UserProfileResource','sendStatus','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x43660e,_0x3ae6d5){var _0x5d7694=function(_0x520edb){while(--_0x520edb){_0x43660e['push'](_0x43660e['shift']());}};_0x5d7694(++_0x3ae6d5);}(_0x32ef,0xf9));var _0xf32e=function(_0x51be15,_0x5f03db){_0x51be15=_0x51be15-0x0;var _0x21dc82=_0x32ef[_0x51be15];return _0x21dc82;};'use strict';var emlformat=require(_0xf32e('0x0'));var rimraf=require(_0xf32e('0x1'));var zipdir=require(_0xf32e('0x2'));var jsonpatch=require(_0xf32e('0x3'));var rp=require(_0xf32e('0x4'));var moment=require(_0xf32e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf32e('0x6'));var util=require(_0xf32e('0x7'));var path=require('path');var sox=require(_0xf32e('0x8'));var csv=require(_0xf32e('0x9'));var ejs=require(_0xf32e('0xa'));var fs=require('fs');var fs_extra=require(_0xf32e('0xb'));var _=require(_0xf32e('0xc'));var squel=require(_0xf32e('0xd'));var crypto=require('crypto');var jsforce=require(_0xf32e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf32e('0x9'));var querystring=require(_0xf32e('0xf'));var Papa=require(_0xf32e('0x10'));var Redis=require(_0xf32e('0x11'));var authService=require(_0xf32e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf32e('0x13'));var hardwareService=require(_0xf32e('0x14'));var logger=require(_0xf32e('0x15'))(_0xf32e('0x16'));var utils=require(_0xf32e('0x17'));var config=require(_0xf32e('0x18'));var licenseUtil=require(_0xf32e('0x19'));var db=require(_0xf32e('0x1a'))['db'];function respondWithStatusCode(_0x319616,_0x1c1f52){_0x1c1f52=_0x1c1f52||0xcc;return function(_0xf7dc32){if(_0xf7dc32){return _0x319616['sendStatus'](_0x1c1f52);}return _0x319616[_0xf32e('0x1b')](_0x1c1f52)[_0xf32e('0x1c')]();};}function respondWithResult(_0x543072,_0x336e26){_0x336e26=_0x336e26||0xc8;return function(_0x35988d){if(_0x35988d){return _0x543072[_0xf32e('0x1b')](_0x336e26)['json'](_0x35988d);}};}function respondWithFilteredResult(_0xe324ad,_0x299efa){return function(_0x1dd008){if(_0x1dd008){var _0x400d25=typeof _0x299efa[_0xf32e('0x1d')]===_0xf32e('0x1e')&&typeof _0x299efa[_0xf32e('0x1f')]===_0xf32e('0x1e');var _0x21aa73=_0x1dd008['count'];var _0x3510ec=_0x400d25?0x0:_0x299efa[_0xf32e('0x1d')];var _0xb828b8=_0x400d25?_0x1dd008[_0xf32e('0x20')]:_0x299efa[_0xf32e('0x1d')]+_0x299efa[_0xf32e('0x1f')];var _0x2f909b;if(_0xb828b8>=_0x21aa73){_0xb828b8=_0x21aa73;_0x2f909b=0xc8;}else{_0x2f909b=0xce;}_0xe324ad[_0xf32e('0x1b')](_0x2f909b);return _0xe324ad[_0xf32e('0x21')](_0xf32e('0x22'),_0x3510ec+'-'+_0xb828b8+'/'+_0x21aa73)[_0xf32e('0x23')](_0x1dd008);}return null;};}function patchUpdates(_0x1b169e){return function(_0x3202e1){try{jsonpatch[_0xf32e('0x24')](_0x3202e1,_0x1b169e,!![]);}catch(_0x5f2e99){return BPromise['reject'](_0x5f2e99);}return _0x3202e1[_0xf32e('0x25')]();};}function saveUpdates(_0x57a8cb,_0x27b92c){return function(_0x2aaabf){if(_0x2aaabf){return _0x2aaabf[_0xf32e('0x26')](_0x57a8cb)[_0xf32e('0x27')](function(_0x35e34c){return _0x35e34c;});}return null;};}function removeEntity(_0x5409b4,_0x227405){return function(_0x4407f8){if(_0x4407f8){return _0x4407f8[_0xf32e('0x28')]()[_0xf32e('0x27')](function(){var _0x5e62eb=_0x4407f8[_0xf32e('0x29')]({'plain':!![]});var _0x1eb413=_0xf32e('0x2a');return db[_0xf32e('0x2b')][_0xf32e('0x28')]({'where':{'type':_0x1eb413,'resourceId':_0x5e62eb['id']}})[_0xf32e('0x27')](function(){return _0x4407f8;});})[_0xf32e('0x27')](function(){_0x5409b4[_0xf32e('0x1b')](0xcc)[_0xf32e('0x1c')]();});}};}function handleEntityNotFound(_0x29be62,_0x488489){return function(_0x3e6e6f){if(!_0x3e6e6f){_0x29be62[_0xf32e('0x2c')](0x194);}return _0x3e6e6f;};}function handleError(_0x3b906c,_0x4a873c){_0x4a873c=_0x4a873c||0x1f4;return function(_0x419d13){logger['error'](_0x419d13[_0xf32e('0x2d')]);if(_0x419d13['name']){delete _0x419d13[_0xf32e('0x2e')];}_0x3b906c[_0xf32e('0x1b')](_0x4a873c)[_0xf32e('0x2f')](_0x419d13);};}exports[_0xf32e('0x30')]=function(_0x32a74b,_0x4e64d4){var _0x2e2ea4={},_0x1d3c7a={},_0x175096={'count':0x0,'rows':[]};var _0x498c9c=_[_0xf32e('0x31')](db[_0xf32e('0x32')][_0xf32e('0x33')],function(_0x3b87d3){return{'name':_0x3b87d3[_0xf32e('0x34')],'type':_0x3b87d3[_0xf32e('0x35')][_0xf32e('0x36')]};});_0x1d3c7a[_0xf32e('0x37')]=_[_0xf32e('0x31')](_0x498c9c,_0xf32e('0x2e'));_0x1d3c7a[_0xf32e('0x38')]=_[_0xf32e('0x39')](_0x32a74b[_0xf32e('0x38')]);_0x1d3c7a['filters']=_[_0xf32e('0x3a')](_0x1d3c7a['model'],_0x1d3c7a[_0xf32e('0x38')]);_0x2e2ea4['attributes']=_['intersection'](_0x1d3c7a[_0xf32e('0x37')],qs[_0xf32e('0x3b')](_0x32a74b[_0xf32e('0x38')][_0xf32e('0x3b')]));_0x2e2ea4[_0xf32e('0x3c')]=_0x2e2ea4['attributes'][_0xf32e('0x3d')]?_0x2e2ea4[_0xf32e('0x3c')]:_0x1d3c7a[_0xf32e('0x37')];if(!_0x32a74b[_0xf32e('0x38')]['hasOwnProperty'](_0xf32e('0x3e'))){_0x2e2ea4[_0xf32e('0x1f')]=qs[_0xf32e('0x1f')](_0x32a74b[_0xf32e('0x38')][_0xf32e('0x1f')]);_0x2e2ea4['offset']=qs[_0xf32e('0x1d')](_0x32a74b[_0xf32e('0x38')][_0xf32e('0x1d')]);}_0x2e2ea4['order']=qs[_0xf32e('0x3f')](_0x32a74b['query'][_0xf32e('0x3f')]);_0x2e2ea4[_0xf32e('0x40')]=qs[_0xf32e('0x41')](_['pick'](_0x32a74b[_0xf32e('0x38')],_0x1d3c7a[_0xf32e('0x41')]),_0x498c9c);if(_0x32a74b[_0xf32e('0x38')][_0xf32e('0x42')]){_0x2e2ea4[_0xf32e('0x40')]=_[_0xf32e('0x43')](_0x2e2ea4['where'],{'$or':_[_0xf32e('0x31')](_0x498c9c,function(_0x26ef18){if(_0x26ef18[_0xf32e('0x35')]!==_0xf32e('0x44')){var _0x28fb71={};_0x28fb71[_0x26ef18[_0xf32e('0x2e')]]={'$like':'%'+_0x32a74b[_0xf32e('0x38')]['filter']+'%'};return _0x28fb71;}})});}_0x2e2ea4=_[_0xf32e('0x43')]({},_0x2e2ea4,_0x32a74b[_0xf32e('0x45')]);var _0x41fbb1={'where':_0x2e2ea4[_0xf32e('0x40')]};return db[_0xf32e('0x32')][_0xf32e('0x20')](_0x41fbb1)[_0xf32e('0x27')](function(_0x546b80){_0x175096[_0xf32e('0x20')]=_0x546b80;if(_0x32a74b[_0xf32e('0x38')][_0xf32e('0x46')]){_0x2e2ea4[_0xf32e('0x47')]=[{'all':!![]}];}return db[_0xf32e('0x32')][_0xf32e('0x48')](_0x2e2ea4);})[_0xf32e('0x27')](function(_0x3ce422){_0x175096[_0xf32e('0x49')]=_0x3ce422;return _0x175096;})[_0xf32e('0x27')](respondWithFilteredResult(_0x4e64d4,_0x2e2ea4))['catch'](handleError(_0x4e64d4,null));};exports[_0xf32e('0x4a')]=function(_0x1f07a6,_0xbd0442){var _0x2146e8={'raw':!![],'where':{'id':_0x1f07a6[_0xf32e('0x4b')]['id']}},_0x159dfd={};_0x159dfd['model']=_[_0xf32e('0x39')](db[_0xf32e('0x32')][_0xf32e('0x33')]);_0x159dfd[_0xf32e('0x38')]=_[_0xf32e('0x39')](_0x1f07a6['query']);_0x159dfd[_0xf32e('0x41')]=_['intersection'](_0x159dfd[_0xf32e('0x37')],_0x159dfd[_0xf32e('0x38')]);_0x2146e8['attributes']=_[_0xf32e('0x3a')](_0x159dfd['model'],qs['fields'](_0x1f07a6['query'][_0xf32e('0x3b')]));_0x2146e8[_0xf32e('0x3c')]=_0x2146e8[_0xf32e('0x3c')][_0xf32e('0x3d')]?_0x2146e8[_0xf32e('0x3c')]:_0x159dfd[_0xf32e('0x37')];if(_0x1f07a6[_0xf32e('0x38')][_0xf32e('0x46')]){_0x2146e8[_0xf32e('0x47')]=[{'all':!![]}];}_0x2146e8=_[_0xf32e('0x43')]({},_0x2146e8,_0x1f07a6[_0xf32e('0x45')]);return db[_0xf32e('0x32')][_0xf32e('0x4c')](_0x2146e8)[_0xf32e('0x27')](handleEntityNotFound(_0xbd0442,null))['then'](respondWithResult(_0xbd0442,null))[_0xf32e('0x4d')](handleError(_0xbd0442,null));};exports[_0xf32e('0x4e')]=function(_0xc83c9f,_0x4b15be){return db['Tag']['create'](_0xc83c9f[_0xf32e('0x4f')],{})[_0xf32e('0x27')](function(_0x5194e8){var _0x436b8a=_0xc83c9f[_0xf32e('0x50')]['get']({'plain':!![]});if(!_0x436b8a)throw new Error(_0xf32e('0x51'));if(_0x436b8a[_0xf32e('0x52')]===_0xf32e('0x50')){var _0x36015b=_0x5194e8[_0xf32e('0x29')]({'plain':!![]});var _0x12f8e2='Tags';return db[_0xf32e('0x53')][_0xf32e('0x4c')]({'where':{'name':_0x12f8e2,'userProfileId':_0x436b8a[_0xf32e('0x54')]},'raw':!![]})['then'](function(_0x15017b){if(_0x15017b&&_0x15017b[_0xf32e('0x55')]===0x0){return db[_0xf32e('0x2b')]['create']({'name':_0x36015b['name'],'resourceId':_0x36015b['id'],'type':_0x15017b['name'],'sectionId':_0x15017b['id']},{})[_0xf32e('0x27')](function(){return _0x5194e8;});}else{return _0x5194e8;}})[_0xf32e('0x4d')](function(_0x36b32a){logger[_0xf32e('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36b32a);throw _0x36b32a;});}return _0x5194e8;})[_0xf32e('0x27')](respondWithResult(_0x4b15be,0xc9))[_0xf32e('0x4d')](handleError(_0x4b15be,null));};exports[_0xf32e('0x26')]=function(_0x787572,_0x10f4d3){if(_0x787572['body']['id']){delete _0x787572[_0xf32e('0x4f')]['id'];}return db[_0xf32e('0x32')][_0xf32e('0x4c')]({'where':{'id':_0x787572[_0xf32e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x10f4d3,null))[_0xf32e('0x27')](saveUpdates(_0x787572['body'],null))['then'](respondWithResult(_0x10f4d3,null))[_0xf32e('0x4d')](handleError(_0x10f4d3,null));};exports[_0xf32e('0x28')]=function(_0x1a485b,_0x391cbc){return db[_0xf32e('0x32')][_0xf32e('0x4c')]({'where':{'id':_0x1a485b[_0xf32e('0x4b')]['id']}})[_0xf32e('0x27')](handleEntityNotFound(_0x391cbc,null))[_0xf32e('0x27')](removeEntity(_0x391cbc,null))[_0xf32e('0x4d')](handleError(_0x391cbc,null));};
\ No newline at end of file
+var _0x6b19=['UserProfileResource','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','sendStatus','error','stack','name','send','map','Tag','fieldName','type','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','findAll','rows','params','rawAttributes','includeAll','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6b19,0xe8));var _0x96b1=function(_0x2bf8bb,_0x5c8a3a){_0x2bf8bb=_0x2bf8bb-0x0;var _0x40084e=_0x6b19[_0x2bf8bb];return _0x40084e;};'use strict';var emlformat=require(_0x96b1('0x0'));var rimraf=require(_0x96b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x96b1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x96b1('0x3'));var Mustache=require(_0x96b1('0x4'));var util=require(_0x96b1('0x5'));var path=require(_0x96b1('0x6'));var sox=require(_0x96b1('0x7'));var csv=require('to-csv');var ejs=require(_0x96b1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96b1('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x96b1('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x96b1('0xb'));var querystring=require('querystring');var Papa=require(_0x96b1('0xc'));var Redis=require(_0x96b1('0xd'));var authService=require(_0x96b1('0xe'));var qs=require(_0x96b1('0xf'));var as=require(_0x96b1('0x10'));var hardwareService=require(_0x96b1('0x11'));var logger=require(_0x96b1('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x96b1('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1abd7b,_0x18c9a0){_0x18c9a0=_0x18c9a0||0xcc;return function(_0x13e6c1){if(_0x13e6c1){return _0x1abd7b['sendStatus'](_0x18c9a0);}return _0x1abd7b[_0x96b1('0x14')](_0x18c9a0)[_0x96b1('0x15')]();};}function respondWithResult(_0x25b1f4,_0x2119b1){_0x2119b1=_0x2119b1||0xc8;return function(_0x46b2bb){if(_0x46b2bb){return _0x25b1f4['status'](_0x2119b1)[_0x96b1('0x16')](_0x46b2bb);}};}function respondWithFilteredResult(_0x375781,_0x23ce63){return function(_0x12233d){if(_0x12233d){var _0x2cd1f5=typeof _0x23ce63[_0x96b1('0x17')]===_0x96b1('0x18')&&typeof _0x23ce63[_0x96b1('0x19')]===_0x96b1('0x18');var _0x1b1f8e=_0x12233d[_0x96b1('0x1a')];var _0x38478c=_0x2cd1f5?0x0:_0x23ce63[_0x96b1('0x17')];var _0x19972b=_0x2cd1f5?_0x12233d[_0x96b1('0x1a')]:_0x23ce63['offset']+_0x23ce63[_0x96b1('0x19')];var _0x5dab57;if(_0x19972b>=_0x1b1f8e){_0x19972b=_0x1b1f8e;_0x5dab57=0xc8;}else{_0x5dab57=0xce;}_0x375781[_0x96b1('0x14')](_0x5dab57);return _0x375781[_0x96b1('0x1b')](_0x96b1('0x1c'),_0x38478c+'-'+_0x19972b+'/'+_0x1b1f8e)['json'](_0x12233d);}return null;};}function patchUpdates(_0xc5dc95){return function(_0x428fe2){try{jsonpatch[_0x96b1('0x1d')](_0x428fe2,_0xc5dc95,!![]);}catch(_0x4b3894){return BPromise[_0x96b1('0x1e')](_0x4b3894);}return _0x428fe2[_0x96b1('0x1f')]();};}function saveUpdates(_0x35db4a,_0x18594b){return function(_0x555185){if(_0x555185){return _0x555185[_0x96b1('0x20')](_0x35db4a)[_0x96b1('0x21')](function(_0xde249b){return _0xde249b;});}return null;};}function removeEntity(_0x54699d,_0x2b4f8e){return function(_0x370f15){if(_0x370f15){return _0x370f15[_0x96b1('0x22')]()[_0x96b1('0x21')](function(){var _0x55a572=_0x370f15[_0x96b1('0x23')]({'plain':!![]});var _0x548bae=_0x96b1('0x24');return db['UserProfileResource'][_0x96b1('0x22')]({'where':{'type':_0x548bae,'resourceId':_0x55a572['id']}})[_0x96b1('0x21')](function(){return _0x370f15;});})['then'](function(){_0x54699d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f24bc,_0x2e4420){return function(_0x18e56a){if(!_0x18e56a){_0x3f24bc[_0x96b1('0x25')](0x194);}return _0x18e56a;};}function handleError(_0x2a9229,_0x58272c){_0x58272c=_0x58272c||0x1f4;return function(_0x21a63f){logger[_0x96b1('0x26')](_0x21a63f[_0x96b1('0x27')]);if(_0x21a63f[_0x96b1('0x28')]){delete _0x21a63f['name'];}_0x2a9229[_0x96b1('0x14')](_0x58272c)[_0x96b1('0x29')](_0x21a63f);};}exports['index']=function(_0x59cf9b,_0x3666f8){var _0x53a198={},_0x436605={},_0x1f046d={'count':0x0,'rows':[]};var _0x5cc56d=_[_0x96b1('0x2a')](db[_0x96b1('0x2b')]['rawAttributes'],function(_0x36e049){return{'name':_0x36e049[_0x96b1('0x2c')],'type':_0x36e049[_0x96b1('0x2d')]['key']};});_0x436605[_0x96b1('0x2e')]=_[_0x96b1('0x2a')](_0x5cc56d,_0x96b1('0x28'));_0x436605[_0x96b1('0x2f')]=_[_0x96b1('0x30')](_0x59cf9b[_0x96b1('0x2f')]);_0x436605['filters']=_[_0x96b1('0x31')](_0x436605[_0x96b1('0x2e')],_0x436605['query']);_0x53a198['attributes']=_[_0x96b1('0x31')](_0x436605[_0x96b1('0x2e')],qs[_0x96b1('0x32')](_0x59cf9b['query']['fields']));_0x53a198[_0x96b1('0x33')]=_0x53a198[_0x96b1('0x33')][_0x96b1('0x34')]?_0x53a198[_0x96b1('0x33')]:_0x436605['model'];if(!_0x59cf9b[_0x96b1('0x2f')]['hasOwnProperty'](_0x96b1('0x35'))){_0x53a198[_0x96b1('0x19')]=qs[_0x96b1('0x19')](_0x59cf9b['query'][_0x96b1('0x19')]);_0x53a198[_0x96b1('0x17')]=qs[_0x96b1('0x17')](_0x59cf9b[_0x96b1('0x2f')][_0x96b1('0x17')]);}_0x53a198[_0x96b1('0x36')]=qs['sort'](_0x59cf9b[_0x96b1('0x2f')][_0x96b1('0x37')]);_0x53a198['where']=qs[_0x96b1('0x38')](_['pick'](_0x59cf9b[_0x96b1('0x2f')],_0x436605[_0x96b1('0x38')]),_0x5cc56d);if(_0x59cf9b[_0x96b1('0x2f')][_0x96b1('0x39')]){_0x53a198[_0x96b1('0x3a')]=_[_0x96b1('0x3b')](_0x53a198[_0x96b1('0x3a')],{'$or':_[_0x96b1('0x2a')](_0x5cc56d,function(_0x33b39f){if(_0x33b39f['type']!==_0x96b1('0x3c')){var _0x4d3c9f={};_0x4d3c9f[_0x33b39f[_0x96b1('0x28')]]={'$like':'%'+_0x59cf9b[_0x96b1('0x2f')][_0x96b1('0x39')]+'%'};return _0x4d3c9f;}})});}_0x53a198=_[_0x96b1('0x3b')]({},_0x53a198,_0x59cf9b[_0x96b1('0x3d')]);var _0x29d134={'where':_0x53a198[_0x96b1('0x3a')]};return db[_0x96b1('0x2b')][_0x96b1('0x1a')](_0x29d134)[_0x96b1('0x21')](function(_0x3020f6){_0x1f046d[_0x96b1('0x1a')]=_0x3020f6;if(_0x59cf9b[_0x96b1('0x2f')]['includeAll']){_0x53a198['include']=[{'all':!![]}];}return db[_0x96b1('0x2b')][_0x96b1('0x3e')](_0x53a198);})['then'](function(_0x2d0e9b){_0x1f046d[_0x96b1('0x3f')]=_0x2d0e9b;return _0x1f046d;})['then'](respondWithFilteredResult(_0x3666f8,_0x53a198))['catch'](handleError(_0x3666f8,null));};exports['show']=function(_0x3f8220,_0x307645){var _0x96c0f6={'raw':!![],'where':{'id':_0x3f8220[_0x96b1('0x40')]['id']}},_0x458fd9={};_0x458fd9[_0x96b1('0x2e')]=_[_0x96b1('0x30')](db[_0x96b1('0x2b')][_0x96b1('0x41')]);_0x458fd9[_0x96b1('0x2f')]=_['keys'](_0x3f8220[_0x96b1('0x2f')]);_0x458fd9['filters']=_[_0x96b1('0x31')](_0x458fd9['model'],_0x458fd9[_0x96b1('0x2f')]);_0x96c0f6['attributes']=_[_0x96b1('0x31')](_0x458fd9[_0x96b1('0x2e')],qs[_0x96b1('0x32')](_0x3f8220[_0x96b1('0x2f')][_0x96b1('0x32')]));_0x96c0f6['attributes']=_0x96c0f6[_0x96b1('0x33')][_0x96b1('0x34')]?_0x96c0f6[_0x96b1('0x33')]:_0x458fd9['model'];if(_0x3f8220[_0x96b1('0x2f')][_0x96b1('0x42')]){_0x96c0f6[_0x96b1('0x43')]=[{'all':!![]}];}_0x96c0f6=_[_0x96b1('0x3b')]({},_0x96c0f6,_0x3f8220['options']);return db[_0x96b1('0x2b')][_0x96b1('0x44')](_0x96c0f6)['then'](handleEntityNotFound(_0x307645,null))[_0x96b1('0x21')](respondWithResult(_0x307645,null))[_0x96b1('0x45')](handleError(_0x307645,null));};exports[_0x96b1('0x46')]=function(_0xc7b84b,_0x2d6446){return db[_0x96b1('0x2b')]['create'](_0xc7b84b[_0x96b1('0x47')],{})['then'](function(_0x451f53){var _0x23a1a4=_0xc7b84b['user'][_0x96b1('0x23')]({'plain':!![]});if(!_0x23a1a4)throw new Error(_0x96b1('0x48'));if(_0x23a1a4['role']===_0x96b1('0x49')){var _0xa66f17=_0x451f53[_0x96b1('0x23')]({'plain':!![]});var _0x3a7301=_0x96b1('0x24');return db[_0x96b1('0x4a')][_0x96b1('0x44')]({'where':{'name':_0x3a7301,'userProfileId':_0x23a1a4[_0x96b1('0x4b')]},'raw':!![]})[_0x96b1('0x21')](function(_0xfeeadf){if(_0xfeeadf&&_0xfeeadf['autoAssociation']===0x0){return db[_0x96b1('0x4c')][_0x96b1('0x46')]({'name':_0xa66f17[_0x96b1('0x28')],'resourceId':_0xa66f17['id'],'type':_0xfeeadf[_0x96b1('0x28')],'sectionId':_0xfeeadf['id']},{})[_0x96b1('0x21')](function(){return _0x451f53;});}else{return _0x451f53;}})[_0x96b1('0x45')](function(_0x420d36){logger[_0x96b1('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x420d36);throw _0x420d36;});}return _0x451f53;})['then'](respondWithResult(_0x2d6446,0xc9))[_0x96b1('0x45')](handleError(_0x2d6446,null));};exports[_0x96b1('0x20')]=function(_0x594d3c,_0x1f8719){if(_0x594d3c[_0x96b1('0x47')]['id']){delete _0x594d3c[_0x96b1('0x47')]['id'];}return db['Tag'][_0x96b1('0x44')]({'where':{'id':_0x594d3c[_0x96b1('0x40')]['id']}})['then'](handleEntityNotFound(_0x1f8719,null))['then'](saveUpdates(_0x594d3c[_0x96b1('0x47')],null))[_0x96b1('0x21')](respondWithResult(_0x1f8719,null))[_0x96b1('0x45')](handleError(_0x1f8719,null));};exports[_0x96b1('0x22')]=function(_0x22aa61,_0x3dc040){return db[_0x96b1('0x2b')][_0x96b1('0x44')]({'where':{'id':_0x22aa61[_0x96b1('0x40')]['id']}})[_0x96b1('0x21')](handleEntityNotFound(_0x3dc040,null))[_0x96b1('0x21')](removeEntity(_0x3dc040,null))[_0x96b1('0x45')](handleError(_0x3dc040,null));};
\ No newline at end of file
index b316326..09104fa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xccda=['path','../../config/environment','exports','Tag','tools_tags','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x298de3,_0x43e88d){var _0x2bcf0a=function(_0x4ac970){while(--_0x4ac970){_0x298de3['push'](_0x298de3['shift']());}};_0x2bcf0a(++_0x43e88d);}(_0xccda,0x14f));var _0xaccd=function(_0x385b70,_0x52974f){_0x385b70=_0x385b70-0x0;var _0x33e2ef=_0xccda[_0x385b70];return _0x33e2ef;};'use strict';var _=require(_0xaccd('0x0'));var util=require('util');var logger=require(_0xaccd('0x1'))(_0xaccd('0x2'));var moment=require(_0xaccd('0x3'));var BPromise=require(_0xaccd('0x4'));var rp=require(_0xaccd('0x5'));var fs=require('fs');var path=require(_0xaccd('0x6'));var rimraf=require('rimraf');var config=require(_0xaccd('0x7'));var attributes=require('./tag.attributes');module[_0xaccd('0x8')]=function(_0x5d1104,_0x186f5b){return _0x5d1104['define'](_0xaccd('0x9'),attributes,{'tableName':_0xaccd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x0807=['path','../../config/environment','exports','define','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2ba1a3,_0x51c6c2){var _0x3f70f7=function(_0x3abb74){while(--_0x3abb74){_0x2ba1a3['push'](_0x2ba1a3['shift']());}};_0x3f70f7(++_0x51c6c2);}(_0x0807,0x1b5));var _0x7080=function(_0x431a55,_0x3f3d47){_0x431a55=_0x431a55-0x0;var _0x21bed5=_0x0807[_0x431a55];return _0x21bed5;};'use strict';var _=require(_0x7080('0x0'));var util=require(_0x7080('0x1'));var logger=require(_0x7080('0x2'))(_0x7080('0x3'));var moment=require(_0x7080('0x4'));var BPromise=require(_0x7080('0x5'));var rp=require(_0x7080('0x6'));var fs=require('fs');var path=require(_0x7080('0x7'));var rimraf=require('rimraf');var config=require(_0x7080('0x8'));var attributes=require('./tag.attributes');module[_0x7080('0x9')]=function(_0x36ee8b,_0x54847c){return _0x36ee8b[_0x7080('0xa')]('Tag',attributes,{'tableName':_0x7080('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 252709e..32e60a2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xed1f=['request','then','info','Tag,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2949c7,_0x39acbd){var _0x23fe7c=function(_0x44564d){while(--_0x44564d){_0x2949c7['push'](_0x2949c7['shift']());}};_0x23fe7c(++_0x39acbd);}(_0xed1f,0x6a));var _0xfed1=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xed1f[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('Tag,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('Tag,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('Tag,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('Tag,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});}
\ No newline at end of file
+var _0x89c3=['jayson/promise','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x89c3,0xff));var _0x389c=function(_0x23e2eb,_0x1e7380){_0x23e2eb=_0x23e2eb-0x0;var _0x4b82a6=_0x89c3[_0x23e2eb];return _0x4b82a6;};'use strict';var _=require(_0x389c('0x0'));var util=require(_0x389c('0x1'));var moment=require(_0x389c('0x2'));var BPromise=require(_0x389c('0x3'));var rs=require(_0x389c('0x4'));var fs=require('fs');var Redis=require(_0x389c('0x5'));var db=require(_0x389c('0x6'))['db'];var utils=require(_0x389c('0x7'));var logger=require('../../config/logger')(_0x389c('0x8'));var config=require('../../config/environment');var jayson=require(_0x389c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3e3f,_0x4a83ab,_0x58bf11){return new BPromise(function(_0x33cb72,_0x41b63b){return client[_0x389c('0xa')](_0x2f3e3f,_0x58bf11)[_0x389c('0xb')](function(_0x41c92b){logger[_0x389c('0xc')](_0x389c('0xd'),_0x4a83ab,_0x389c('0xe'));logger[_0x389c('0xf')]('Tag,\x20%s,\x20%s,\x20%s',_0x4a83ab,_0x389c('0xe'),JSON[_0x389c('0x10')](_0x41c92b));if(_0x41c92b[_0x389c('0x11')]){if(_0x41c92b[_0x389c('0x11')][_0x389c('0x12')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x4a83ab,_0x41c92b[_0x389c('0x11')][_0x389c('0x13')]);return _0x41b63b(_0x41c92b[_0x389c('0x11')]['message']);}logger[_0x389c('0x11')]('Tag,\x20%s,\x20%s',_0x4a83ab,_0x41c92b[_0x389c('0x11')][_0x389c('0x13')]);return _0x33cb72(_0x41c92b['error'][_0x389c('0x13')]);}else{logger[_0x389c('0xc')](_0x389c('0xd'),_0x4a83ab,'request\x20sent');_0x33cb72(_0x41c92b[_0x389c('0x14')][_0x389c('0x13')]);}})[_0x389c('0x15')](function(_0x3d6099){logger[_0x389c('0x11')]('Tag,\x20%s,\x20%s',_0x4a83ab,_0x3d6099);_0x41b63b(_0x3d6099);});});}
\ No newline at end of file
index c894230..e017299 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router;
\ No newline at end of file
+var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router;
\ No newline at end of file
index cd3b7c0..1989eae 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x757a=['exports','STRING'];(function(_0x2387c5,_0xfcc74c){var _0x2c414c=function(_0x3d1881){while(--_0x3d1881){_0x2387c5['push'](_0x2387c5['shift']());}};_0x2c414c(++_0xfcc74c);}(_0x757a,0xde));var _0xa757=function(_0x1aabfa,_0x593a18){_0x1aabfa=_0x1aabfa-0x0;var _0x4aaa35=_0x757a[_0x1aabfa];return _0x4aaa35;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xbaf0=['name','exports','STRING'];(function(_0x131585,_0x1abd33){var _0x1fcca2=function(_0x8f165b){while(--_0x8f165b){_0x131585['push'](_0x131585['shift']());}};_0x1fcca2(++_0x1abd33);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}};
\ No newline at end of file
index 4cfa84d..fd88891 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe702=['upsert','interface','format','SIP/%s','all','spread','removeAgents','Fax','emit','getAgents','filter','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','map','Team','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','create','user','get','role','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','FaxQueueId','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','channel','Unknown\x20channel','capitalize','toLowerCase','order','Queues','addQueues','findOne','isValidChannel','add','ids','ValidationError','remove','isArray','Chat','Mail','Sms','Openchannel','Whatsapp','Voice','penalty','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','Queue:save','online','voicePause','UserVoiceQueueRt'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe702,0xa3));var _0x2e70=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xe702[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require(_0x2e70('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e70('0x1'));var jsonpatch=require(_0x2e70('0x2'));var rp=require('request-promise');var moment=require(_0x2e70('0x3'));var BPromise=require(_0x2e70('0x4'));var Mustache=require(_0x2e70('0x5'));var util=require(_0x2e70('0x6'));var path=require(_0x2e70('0x7'));var sox=require('sox');var csv=require(_0x2e70('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e70('0x9'));var _=require(_0x2e70('0xa'));var squel=require(_0x2e70('0xb'));var crypto=require('crypto');var jsforce=require(_0x2e70('0xc'));var deskjs=require(_0x2e70('0xd'));var toCsv=require(_0x2e70('0x8'));var querystring=require(_0x2e70('0xe'));var Papa=require('papaparse');var Redis=require(_0x2e70('0xf'));var authService=require(_0x2e70('0x10'));var qs=require(_0x2e70('0x11'));var as=require(_0x2e70('0x12'));var hardwareService=require(_0x2e70('0x13'));var logger=require(_0x2e70('0x14'))(_0x2e70('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2e70('0x16'));var db=require(_0x2e70('0x17'))['db'];config['redis']=_[_0x2e70('0x18')](config[_0x2e70('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x2e70('0x1a'))(new Redis(config[_0x2e70('0x19')]));require(_0x2e70('0x1b'))[_0x2e70('0x1c')](socket);function respondWithStatusCode(_0x3f1b01,_0x366008){_0x366008=_0x366008||0xcc;return function(_0x19085f){if(_0x19085f){return _0x3f1b01[_0x2e70('0x1d')](_0x366008);}return _0x3f1b01[_0x2e70('0x1e')](_0x366008)[_0x2e70('0x1f')]();};}function respondWithResult(_0x524a7a,_0x5aa6b1){_0x5aa6b1=_0x5aa6b1||0xc8;return function(_0x42e6f9){if(_0x42e6f9){return _0x524a7a[_0x2e70('0x1e')](_0x5aa6b1)[_0x2e70('0x20')](_0x42e6f9);}};}function respondWithFilteredResult(_0x13ec19,_0x2ca17c){return function(_0x479ed2){if(_0x479ed2){var _0xa8e849=typeof _0x2ca17c['offset']===_0x2e70('0x21')&&typeof _0x2ca17c[_0x2e70('0x22')]===_0x2e70('0x21');var _0x3993d0=_0x479ed2[_0x2e70('0x23')];var _0x559ea1=_0xa8e849?0x0:_0x2ca17c[_0x2e70('0x24')];var _0x5e47c6=_0xa8e849?_0x479ed2[_0x2e70('0x23')]:_0x2ca17c[_0x2e70('0x24')]+_0x2ca17c[_0x2e70('0x22')];var _0x4070a0;if(_0x5e47c6>=_0x3993d0){_0x5e47c6=_0x3993d0;_0x4070a0=0xc8;}else{_0x4070a0=0xce;}_0x13ec19[_0x2e70('0x1e')](_0x4070a0);return _0x13ec19[_0x2e70('0x25')](_0x2e70('0x26'),_0x559ea1+'-'+_0x5e47c6+'/'+_0x3993d0)[_0x2e70('0x20')](_0x479ed2);}return null;};}function patchUpdates(_0x18c482){return function(_0x409939){try{jsonpatch['apply'](_0x409939,_0x18c482,!![]);}catch(_0x59a72e){return BPromise[_0x2e70('0x27')](_0x59a72e);}return _0x409939[_0x2e70('0x28')]();};}function saveUpdates(_0x4cc025,_0x55fd4a){return function(_0x9981cd){if(_0x9981cd){return _0x9981cd[_0x2e70('0x29')](_0x4cc025)[_0x2e70('0x2a')](function(_0x2968bc){return _0x2968bc;});}return null;};}function handleEntityNotFound(_0x5b60d4,_0x5eb4b0){return function(_0x49d277){if(!_0x49d277){_0x5b60d4[_0x2e70('0x1d')](0x194);}return _0x49d277;};}function handleError(_0x10c58f,_0x5c4865){_0x5c4865=_0x5c4865||0x1f4;return function(_0x40d0ef){logger[_0x2e70('0x2b')](_0x40d0ef[_0x2e70('0x2c')]);if(_0x40d0ef[_0x2e70('0x2d')]){delete _0x40d0ef['name'];}_0x10c58f[_0x2e70('0x1e')](_0x5c4865)[_0x2e70('0x2e')](_0x40d0ef);};}exports['index']=function(_0x49c412,_0x59a1d6){var _0x129ccb={},_0x1a0b5e={},_0x43f793={'count':0x0,'rows':[]};var _0x3b520e=_[_0x2e70('0x2f')](db[_0x2e70('0x30')][_0x2e70('0x31')],function(_0x4a5aee){return{'name':_0x4a5aee[_0x2e70('0x32')],'type':_0x4a5aee['type'][_0x2e70('0x33')]};});_0x1a0b5e[_0x2e70('0x34')]=_['map'](_0x3b520e,_0x2e70('0x2d'));_0x1a0b5e[_0x2e70('0x35')]=_[_0x2e70('0x36')](_0x49c412[_0x2e70('0x35')]);_0x1a0b5e[_0x2e70('0x37')]=_[_0x2e70('0x38')](_0x1a0b5e[_0x2e70('0x34')],_0x1a0b5e[_0x2e70('0x35')]);_0x129ccb[_0x2e70('0x39')]=_[_0x2e70('0x38')](_0x1a0b5e[_0x2e70('0x34')],qs[_0x2e70('0x3a')](_0x49c412[_0x2e70('0x35')][_0x2e70('0x3a')]));_0x129ccb[_0x2e70('0x39')]=_0x129ccb[_0x2e70('0x39')]['length']?_0x129ccb[_0x2e70('0x39')]:_0x1a0b5e[_0x2e70('0x34')];if(!_0x49c412[_0x2e70('0x35')][_0x2e70('0x3b')](_0x2e70('0x3c'))){_0x129ccb[_0x2e70('0x22')]=qs[_0x2e70('0x22')](_0x49c412['query'][_0x2e70('0x22')]);_0x129ccb[_0x2e70('0x24')]=qs[_0x2e70('0x24')](_0x49c412[_0x2e70('0x35')][_0x2e70('0x24')]);}_0x129ccb['order']=qs[_0x2e70('0x3d')](_0x49c412[_0x2e70('0x35')][_0x2e70('0x3d')]);_0x129ccb['where']=qs['filters'](_[_0x2e70('0x3e')](_0x49c412[_0x2e70('0x35')],_0x1a0b5e['filters']),_0x3b520e);if(_0x49c412[_0x2e70('0x35')]['filter']){_0x129ccb[_0x2e70('0x3f')]=_[_0x2e70('0x40')](_0x129ccb[_0x2e70('0x3f')],{'$or':_['map'](_0x3b520e,function(_0x1bee8f){if(_0x1bee8f[_0x2e70('0x41')]!==_0x2e70('0x42')){var _0x503453={};_0x503453[_0x1bee8f[_0x2e70('0x2d')]]={'$like':'%'+_0x49c412[_0x2e70('0x35')]['filter']+'%'};return _0x503453;}})});}_0x129ccb=_[_0x2e70('0x40')]({},_0x129ccb,_0x49c412['options']);var _0x4c7d17={'where':_0x129ccb[_0x2e70('0x3f')]};return db[_0x2e70('0x30')][_0x2e70('0x23')](_0x4c7d17)['then'](function(_0x94bf07){_0x43f793['count']=_0x94bf07;if(_0x49c412[_0x2e70('0x35')][_0x2e70('0x43')]){_0x129ccb[_0x2e70('0x44')]=[{'all':!![]}];}return db[_0x2e70('0x30')][_0x2e70('0x45')](_0x129ccb);})['then'](function(_0x4c87d3){_0x43f793[_0x2e70('0x46')]=_0x4c87d3;return _0x43f793;})[_0x2e70('0x2a')](respondWithFilteredResult(_0x59a1d6,_0x129ccb))[_0x2e70('0x47')](handleError(_0x59a1d6,null));};exports[_0x2e70('0x48')]=function(_0x545249,_0x588672){var _0x505973={'raw':![],'where':{'id':_0x545249['params']['id']}},_0x9e07ab={};_0x9e07ab[_0x2e70('0x34')]=_['keys'](db[_0x2e70('0x30')][_0x2e70('0x31')]);_0x9e07ab['query']=_[_0x2e70('0x36')](_0x545249[_0x2e70('0x35')]);_0x9e07ab['filters']=_['intersection'](_0x9e07ab[_0x2e70('0x34')],_0x9e07ab['query']);_0x505973['attributes']=_['intersection'](_0x9e07ab[_0x2e70('0x34')],qs[_0x2e70('0x3a')](_0x545249[_0x2e70('0x35')][_0x2e70('0x3a')]));_0x505973['attributes']=_0x505973[_0x2e70('0x39')][_0x2e70('0x49')]?_0x505973[_0x2e70('0x39')]:_0x9e07ab[_0x2e70('0x34')];if(_0x545249['query'][_0x2e70('0x43')]){_0x505973[_0x2e70('0x44')]=[{'all':!![]}];}_0x505973=_[_0x2e70('0x40')]({},_0x505973,_0x545249[_0x2e70('0x4a')]);return db[_0x2e70('0x30')]['find'](_0x505973)[_0x2e70('0x2a')](handleEntityNotFound(_0x588672,null))[_0x2e70('0x2a')](respondWithResult(_0x588672,null))[_0x2e70('0x47')](handleError(_0x588672,null));};exports[_0x2e70('0x4b')]=function(_0x4d6a8d,_0xa4eacb){return db[_0x2e70('0x30')][_0x2e70('0x4b')](_0x4d6a8d['body'],{})['then'](function(_0x135c22){var _0x21f83a=_0x4d6a8d[_0x2e70('0x4c')][_0x2e70('0x4d')]({'plain':!![]});if(!_0x21f83a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21f83a[_0x2e70('0x4e')]===_0x2e70('0x4c')){var _0x6a49f4=_0x135c22['get']({'plain':!![]});var _0x239642=_0x2e70('0x4f');return db[_0x2e70('0x50')][_0x2e70('0x51')]({'where':{'name':_0x239642,'userProfileId':_0x21f83a[_0x2e70('0x52')]},'raw':!![]})[_0x2e70('0x2a')](function(_0xbe0950){if(_0xbe0950&&_0xbe0950[_0x2e70('0x53')]===0x0){return db[_0x2e70('0x54')][_0x2e70('0x4b')]({'name':_0x6a49f4['name'],'resourceId':_0x6a49f4['id'],'type':_0xbe0950[_0x2e70('0x2d')],'sectionId':_0xbe0950['id']},{})[_0x2e70('0x2a')](function(){return _0x135c22;});}else{return _0x135c22;}})[_0x2e70('0x47')](function(_0x22186d){logger[_0x2e70('0x2b')](_0x2e70('0x55'),_0x22186d);throw _0x22186d;});}return _0x135c22;})['then'](respondWithResult(_0xa4eacb,0xc9))[_0x2e70('0x47')](handleError(_0xa4eacb,null));};exports[_0x2e70('0x29')]=function(_0x1311f5,_0x51f84d){if(_0x1311f5[_0x2e70('0x56')]['id']){delete _0x1311f5['body']['id'];}return db[_0x2e70('0x30')]['find']({'where':{'id':_0x1311f5[_0x2e70('0x57')]['id']}})[_0x2e70('0x2a')](handleEntityNotFound(_0x51f84d,null))[_0x2e70('0x2a')](saveUpdates(_0x1311f5[_0x2e70('0x56')],null))[_0x2e70('0x2a')](respondWithResult(_0x51f84d,null))['catch'](handleError(_0x51f84d,null));};exports[_0x2e70('0x58')]=function(_0x1a5474,_0x4aba35){var _0x534546=_0x1a5474[_0x2e70('0x57')]['id'];var _0x5cefe0=[];return db[_0x2e70('0x59')][_0x2e70('0x5a')](function(_0x44c4a1){var _0x388896=_0x2e70('0x5b')+_0x534546;return db[_0x2e70('0x59')][_0x2e70('0x35')](_0x388896,{'type':db[_0x2e70('0x5c')][_0x2e70('0x5d')][_0x2e70('0x5e')],'raw':!![],'transaction':_0x44c4a1})[_0x2e70('0x2a')](function(_0x17f92d){_0x5cefe0=_['map'](_0x17f92d,function(_0x6b4046){return Number(_0x6b4046['UserId']);});})[_0x2e70('0x2a')](function(){var _0x1f1a36=_0x2e70('0x5f')+_0x534546;return db['sequelize']['query'](_0x1f1a36,{'type':db[_0x2e70('0x5c')][_0x2e70('0x5d')][_0x2e70('0x5e')],'raw':!![],'transaction':_0x44c4a1});})[_0x2e70('0x2a')](function(_0x396d6f){var _0x4cd57d=_[_0x2e70('0x2f')](_0x396d6f,function(_0x276379){return Number(_0x276379['VoiceQueueId']);});return db['UserVoiceQueue'][_0x2e70('0x58')]({'where':{'UserId':{'$in':_0x5cefe0},'VoiceQueueId':{'$in':_0x4cd57d}},'transaction':_0x44c4a1});})['then'](function(){var _0x179f3a='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x534546;return db['sequelize'][_0x2e70('0x35')](_0x179f3a,{'type':db[_0x2e70('0x5c')][_0x2e70('0x5d')][_0x2e70('0x5e')],'raw':!![],'transaction':_0x44c4a1});})[_0x2e70('0x2a')](function(_0x53ce2d){var _0xd912b3=_[_0x2e70('0x2f')](_0x53ce2d,function(_0x404d98){return Number(_0x404d98[_0x2e70('0x60')]);});return db[_0x2e70('0x61')][_0x2e70('0x58')]({'where':{'UserId':{'$in':_0x5cefe0},'MailQueueId':{'$in':_0xd912b3}},'transaction':_0x44c4a1});})['then'](function(){var _0x1e9428=_0x2e70('0x62')+_0x534546;return db['sequelize']['query'](_0x1e9428,{'type':db[_0x2e70('0x5c')][_0x2e70('0x5d')]['SELECT'],'raw':!![],'transaction':_0x44c4a1});})['then'](function(_0x1cbf06){var _0x589fbe=_[_0x2e70('0x2f')](_0x1cbf06,function(_0x1a57f1){return Number(_0x1a57f1[_0x2e70('0x63')]);});return db['UserSmsQueue'][_0x2e70('0x58')]({'where':{'UserId':{'$in':_0x5cefe0},'SmsQueueId':{'$in':_0x589fbe}},'transaction':_0x44c4a1});})[_0x2e70('0x2a')](function(){var _0x53c766=_0x2e70('0x64')+_0x534546;return db[_0x2e70('0x59')][_0x2e70('0x35')](_0x53c766,{'type':db['Sequelize'][_0x2e70('0x5d')]['SELECT'],'raw':!![],'transaction':_0x44c4a1});})[_0x2e70('0x2a')](function(_0x26250e){var _0x4de497=_[_0x2e70('0x2f')](_0x26250e,function(_0x275efc){return Number(_0x275efc['ChatQueueId']);});return db[_0x2e70('0x65')][_0x2e70('0x58')]({'where':{'UserId':{'$in':_0x5cefe0},'ChatQueueId':{'$in':_0x4de497}},'transaction':_0x44c4a1});})[_0x2e70('0x2a')](function(){var _0x126cce='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x534546;return db[_0x2e70('0x59')]['query'](_0x126cce,{'type':db[_0x2e70('0x5c')][_0x2e70('0x5d')]['SELECT'],'raw':!![],'transaction':_0x44c4a1});})[_0x2e70('0x2a')](function(_0x166808){var _0x49cacf=_[_0x2e70('0x2f')](_0x166808,function(_0x35c05f){return Number(_0x35c05f[_0x2e70('0x66')]);});return db[_0x2e70('0x67')]['destroy']({'where':{'UserId':{'$in':_0x5cefe0},'FaxQueueId':{'$in':_0x49cacf}},'transaction':_0x44c4a1});})[_0x2e70('0x2a')](function(){var _0x18064a='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x534546;return db[_0x2e70('0x59')][_0x2e70('0x35')](_0x18064a,{'type':db[_0x2e70('0x5c')][_0x2e70('0x5d')][_0x2e70('0x5e')],'raw':!![],'transaction':_0x44c4a1});})['then'](function(_0x5019e8){var _0x1495e0=_[_0x2e70('0x2f')](_0x5019e8,function(_0x509c9e){return Number(_0x509c9e[_0x2e70('0x68')]);});return db[_0x2e70('0x69')][_0x2e70('0x58')]({'where':{'UserId':{'$in':_0x5cefe0},'OpenchannelQueueId':{'$in':_0x1495e0}},'transaction':_0x44c4a1});})[_0x2e70('0x2a')](function(){var _0x25db22=_0x2e70('0x6a')+_0x534546;return db[_0x2e70('0x59')]['query'](_0x25db22,{'type':db[_0x2e70('0x5c')][_0x2e70('0x5d')]['SELECT'],'raw':!![],'transaction':_0x44c4a1});})[_0x2e70('0x2a')](function(_0x10672d){var _0x192e4f=_[_0x2e70('0x2f')](_0x10672d,function(_0x539d8a){return Number(_0x539d8a['WhatsappQueueId']);});return db[_0x2e70('0x6b')][_0x2e70('0x58')]({'where':{'UserId':{'$in':_0x5cefe0},'WhatsappQueueId':{'$in':_0x192e4f}},'transaction':_0x44c4a1});})[_0x2e70('0x2a')](function(){return db[_0x2e70('0x6c')][_0x2e70('0x51')]({'where':{'TeamId':_0x534546}});})[_0x2e70('0x2a')](function(_0x361d16){if(_0x361d16===null){return;}return db[_0x2e70('0x6d')][_0x2e70('0x58')]({'where':{'UserId':{'$in':_0x5cefe0},'VoicePrefixId':_0x361d16[_0x2e70('0x6e')]},'transaction':_0x44c4a1});})['then'](function(){return db[_0x2e70('0x30')]['destroy']({'where':{'id':_0x534546},'cascade':!![],'transaction':_0x44c4a1});})[_0x2e70('0x2a')](function(_0x2bf857){if(_0x2bf857===0x0){_0x4aba35[_0x2e70('0x1d')](0x194);}else{return db[_0x2e70('0x54')][_0x2e70('0x58')]({'where':{'type':_0x2e70('0x4f'),'resourceId':_0x534546},'cascade':!![],'transaction':_0x44c4a1})[_0x2e70('0x2a')](function(){_0x4aba35['status'](0xcc)[_0x2e70('0x1f')]();});}})[_0x2e70('0x47')](function(_0x424f50){_0x4aba35[_0x2e70('0x1e')](0x1f4)['send'](_0x424f50);});});};exports['getQueues']=function(_0x802b12,_0x333cbb,_0x49f859){return db[_0x2e70('0x30')]['findOne']({'where':{'id':_0x802b12['params']['id']}})[_0x2e70('0x2a')](handleEntityNotFound(_0x333cbb,null))['then'](function(_0x4eeb79){if(!_0x802b12[_0x2e70('0x35')][_0x2e70('0x6f')]||!utils['isValidChannel'](_0x802b12[_0x2e70('0x35')]['channel'])){throw new db[(_0x2e70('0x5c'))]['ValidationError'](_0x2e70('0x70'));}var _0x59419e={};var _0x4e3be1={};_0x4e3be1['model']=_[_0x2e70('0x36')](db[_[_0x2e70('0x71')](_0x802b12['query'][_0x2e70('0x6f')][_0x2e70('0x72')]())+'Queue'][_0x2e70('0x31')]);_0x4e3be1[_0x2e70('0x35')]=_['keys'](_0x802b12[_0x2e70('0x35')]);_0x4e3be1[_0x2e70('0x37')]=_[_0x2e70('0x38')](_0x4e3be1[_0x2e70('0x34')],_0x4e3be1[_0x2e70('0x35')]);_0x59419e[_0x2e70('0x39')]=_['intersection'](_0x4e3be1[_0x2e70('0x34')],qs[_0x2e70('0x3a')](_0x802b12['query'][_0x2e70('0x3a')]));_0x59419e[_0x2e70('0x39')]=_0x59419e[_0x2e70('0x39')][_0x2e70('0x49')]?_0x59419e[_0x2e70('0x39')]:_0x4e3be1['model'];_0x59419e['limit']=qs[_0x2e70('0x22')](_0x802b12[_0x2e70('0x35')]['limit']);_0x59419e[_0x2e70('0x24')]=qs[_0x2e70('0x24')](_0x802b12[_0x2e70('0x35')]['offset']);_0x59419e[_0x2e70('0x73')]=qs[_0x2e70('0x3d')](_0x802b12[_0x2e70('0x35')][_0x2e70('0x3d')]);_0x59419e[_0x2e70('0x3f')]=qs[_0x2e70('0x37')](_[_0x2e70('0x3e')](_0x802b12[_0x2e70('0x35')],_0x4e3be1[_0x2e70('0x37')]));_0x59419e=_[_0x2e70('0x40')]({},_0x59419e,_0x802b12[_0x2e70('0x4a')]);return _0x4eeb79[_0x2e70('0x4d')+_[_0x2e70('0x71')](_0x802b12[_0x2e70('0x35')]['channel'][_0x2e70('0x72')]())+_0x2e70('0x74')](_0x59419e);})[_0x2e70('0x2a')](respondWithResult(_0x333cbb,null))[_0x2e70('0x47')](handleError(_0x333cbb,null));};exports[_0x2e70('0x75')]=function(_0x121420,_0x5428fb,_0x3c95b5){return db[_0x2e70('0x30')][_0x2e70('0x76')]({'where':{'id':_0x121420['params']['id']}})[_0x2e70('0x2a')](function(_0x1b0854){if(_0x1b0854){if(!_0x121420['body'][_0x2e70('0x6f')]||!utils[_0x2e70('0x77')](_0x121420[_0x2e70('0x56')][_0x2e70('0x6f')])){throw new db[(_0x2e70('0x5c'))]['ValidationError'](_0x2e70('0x70'));}return _0x1b0854[_0x2e70('0x78')+_[_0x2e70('0x71')](_0x121420[_0x2e70('0x56')][_0x2e70('0x6f')]['toLowerCase']())+_0x2e70('0x74')](_0x121420[_0x2e70('0x56')][_0x2e70('0x79')]);}return null;})[_0x2e70('0x2a')](handleEntityNotFound(_0x5428fb,null))['then'](respondWithStatusCode(_0x5428fb,null))[_0x2e70('0x47')](handleError(_0x5428fb,null));};exports['removeQueues']=function(_0x4b26b6,_0x4b5238,_0x4c1647){return db[_0x2e70('0x30')][_0x2e70('0x76')]({'where':{'id':_0x4b26b6['params']['id']}})['then'](function(_0x135645){if(_0x135645){if(!_0x4b26b6['query']['channel']||!utils[_0x2e70('0x77')](_0x4b26b6[_0x2e70('0x35')][_0x2e70('0x6f')])){throw new db[(_0x2e70('0x5c'))][(_0x2e70('0x7a'))](_0x2e70('0x70'));}return _0x135645[_0x2e70('0x7b')+_[_0x2e70('0x71')](_0x4b26b6['query']['channel']['toLowerCase']())+_0x2e70('0x74')](_0x4b26b6['query']['ids']);}return null;})[_0x2e70('0x2a')](handleEntityNotFound(_0x4b5238,null))['then'](respondWithStatusCode(_0x4b5238,null))[_0x2e70('0x47')](handleError(_0x4b5238,null));};exports['addAgents']=function(_0x557c07,_0x3cff4a){var _0x6ba737=_[_0x2e70('0x7c')](_0x557c07[_0x2e70('0x56')][_0x2e70('0x79')])?_0x557c07[_0x2e70('0x56')][_0x2e70('0x79')]:[_0x557c07[_0x2e70('0x56')][_0x2e70('0x79')]];var _0x94f070=_0x557c07[_0x2e70('0x57')]['id'];return db[_0x2e70('0x30')]['find']({'where':{'id':_0x94f070}})[_0x2e70('0x2a')](handleEntityNotFound(_0x3cff4a,null))[_0x2e70('0x2a')](function(_0x393e77){if(_0x393e77){var _0x3f500b=['Voice',_0x2e70('0x7d'),_0x2e70('0x7e'),_0x2e70('0x7f'),'Fax',_0x2e70('0x80'),_0x2e70('0x81')];return db[_0x2e70('0x59')][_0x2e70('0x5a')](function(_0x28af86){var _0x352474=_[_0x2e70('0x2f')](_0x3f500b,function(_0x2ecde3){var _0x45ac47={'attributes':['id',_0x2e70('0x2d')]};if(_0x2ecde3===_0x2e70('0x82')){_0x45ac47['through']={'attributes':[_0x2e70('0x83')]};}return _0x393e77['get'+_0x2ecde3+_0x2e70('0x74')](_0x45ac47)[_0x2e70('0x2a')](function(_0x32f408){var _0x35f2b0=_[_0x2e70('0x2f')](_0x32f408,function(_0x524409){var _0x1b0491=_[_0x2e70('0x2f')](_0x6ba737,function(_0x1a7814){var _0x4a187b={'where':{'UserId':_0x1a7814,[_0x2ecde3+_0x2e70('0x84')]:_0x524409['id']},'transaction':_0x28af86};if(_0x2ecde3==='Voice'){_0x4a187b[_0x2e70('0x18')]={'penalty':_0x524409[_0x2e70('0x85')][_0x2e70('0x83')]};}return db[_0x2e70('0x86')+_0x2ecde3+_0x2e70('0x87')][_0x2e70('0x88')](_0x4a187b)['then'](function(){socket['emit'](_0x2e70('0x4c')+_0x2ecde3+_0x2e70('0x89'),{'UserId':_0x1a7814,[_0x2ecde3+_0x2e70('0x84')]:_0x524409['id']});if(_0x2ecde3!=='Voice'){return;}return db[_0x2e70('0x86')]['findAll']({'where':{'id':_0x6ba737,'online':0x1},'attributes':['id','name',_0x2e70('0x8a'),_0x2e70('0x8b'),'interface'],'raw':!![]})['then'](function(_0x59fd9b){var _0x546b1d=_[_0x2e70('0x2f')](_0x59fd9b,function(_0x4862ab){return db[_0x2e70('0x8c')][_0x2e70('0x8d')]({'membername':_0x4862ab[_0x2e70('0x2d')],'UserId':_0x4862ab['id'],'queue_name':_0x524409[_0x2e70('0x2d')],'VoiceQueueId':_0x524409['id'],'interface':_['isNil'](_0x4862ab[_0x2e70('0x8e')])?util[_0x2e70('0x8f')](_0x2e70('0x90'),_0x4862ab[_0x2e70('0x2d')]):_0x4862ab['interface'],'paused':_0x4862ab['voicePause']||![],'penalty':_0x524409['TeamVoiceQueue']['penalty']},{'transaction':_0x28af86});});return Promise['all'](_0x546b1d);});});});return Promise['all'](_0x1b0491);});return Promise[_0x2e70('0x91')](_0x35f2b0);})[_0x2e70('0x2a')](function(){return db[_0x2e70('0x6c')][_0x2e70('0x76')]({'where':{'teamId':_0x94f070}})[_0x2e70('0x2a')](function(_0x7af3b7){if(_0x7af3b7){var _0x10d2a7=_[_0x2e70('0x2f')](_0x6ba737,function(_0x6fdf50){db[_0x2e70('0x6d')]['upsert']({'UserId':_0x6fdf50,'VoicePrefixId':_0x7af3b7['VoicePrefixId']});});return Promise[_0x2e70('0x91')](_0x10d2a7);}});});});return Promise['all'](_0x352474)['then'](function(){return _0x393e77['addAgents'](_0x6ba737,{'transaction':_0x28af86})[_0x2e70('0x92')](function(_0x51126b){return _0x51126b;});});});}})['then'](respondWithResult(_0x3cff4a,null))[_0x2e70('0x47')](handleError(_0x3cff4a,null));};exports[_0x2e70('0x93')]=function(_0x3829ad,_0x5b4002){var _0x11f665=_['isArray'](_0x3829ad[_0x2e70('0x35')][_0x2e70('0x79')])?_0x3829ad['query'][_0x2e70('0x79')]:[_0x3829ad['query'][_0x2e70('0x79')]];var _0x10c0e5=_0x3829ad[_0x2e70('0x57')]['id'];return db['Team'][_0x2e70('0x51')]({'where':{'id':_0x10c0e5}})['then'](handleEntityNotFound(_0x5b4002,null))[_0x2e70('0x2a')](function(_0x480494){if(_0x480494){var _0x2b0f62=[_0x2e70('0x82'),'Chat','Mail',_0x2e70('0x7f'),_0x2e70('0x94'),'Openchannel',_0x2e70('0x81')];return db['sequelize'][_0x2e70('0x5a')](function(_0x27ba2a){var _0x3498ca=_['map'](_0x2b0f62,function(_0x5457bd){var _0x4d5b82={'attributes':['id',_0x2e70('0x2d')]};return _0x480494[_0x2e70('0x4d')+_0x5457bd+_0x2e70('0x74')](_0x4d5b82)[_0x2e70('0x2a')](function(_0x3a734a){var _0x420ffb=_[_0x2e70('0x2f')](_0x3a734a,function(_0x65ae92){return _0x65ae92[_0x2e70('0x93')](_0x11f665,{'transaction':_0x27ba2a})[_0x2e70('0x2a')](function(){var _0x463eb0=_[_0x2e70('0x2f')](_0x11f665,function(_0x5c2280){socket[_0x2e70('0x95')](_0x2e70('0x4c')+_0x5457bd+'Queue:remove',{'UserId':Number(_0x5c2280),[_0x5457bd+_0x2e70('0x84')]:_0x65ae92['id']});if(_0x5457bd!=='Voice'){return;}return db[_0x2e70('0x8c')]['destroy']({'where':{'VoiceQueueId':_0x65ae92['id'],'UserId':_0x5c2280},'transaction':_0x27ba2a});});return Promise['all'](_0x463eb0);});});return Promise[_0x2e70('0x91')](_0x420ffb);});});return Promise[_0x2e70('0x91')](_0x3498ca)[_0x2e70('0x2a')](function(){return _0x480494[_0x2e70('0x93')](_0x11f665,{'transaction':_0x27ba2a});})[_0x2e70('0x2a')](function(){return db[_0x2e70('0x6c')][_0x2e70('0x76')]({'where':{'teamId':_0x10c0e5}})[_0x2e70('0x2a')](function(_0x565bf6){if(_0x565bf6){var _0x37f057=_[_0x2e70('0x2f')](_0x11f665,function(_0x4698e0){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x4698e0,'VoicePrefixId':_0x565bf6[_0x2e70('0x6e')]}});});return Promise[_0x2e70('0x91')](_0x37f057);}});});});}})[_0x2e70('0x2a')](respondWithStatusCode(_0x5b4002,null))[_0x2e70('0x47')](handleError(_0x5b4002,null));};exports[_0x2e70('0x96')]=function(_0x4527f6,_0x3d6c38,_0x5e4238){var _0x4158d5={};var _0x1cabde={};var _0x125129;var _0x1ca0f6;return db['Team'][_0x2e70('0x76')]({'where':{'id':_0x4527f6[_0x2e70('0x57')]['id']}})[_0x2e70('0x2a')](handleEntityNotFound(_0x3d6c38,null))['then'](function(_0x2e00ee){if(_0x2e00ee){_0x125129=_0x2e00ee;_0x1cabde['model']=_[_0x2e70('0x36')](db[_0x2e70('0x86')][_0x2e70('0x31')]);_0x1cabde[_0x2e70('0x35')]=_[_0x2e70('0x36')](_0x4527f6['query']);_0x1cabde[_0x2e70('0x37')]=_['intersection'](_0x1cabde['model'],_0x1cabde[_0x2e70('0x35')]);_0x4158d5['attributes']=_['intersection'](_0x1cabde[_0x2e70('0x34')],qs[_0x2e70('0x3a')](_0x4527f6['query'][_0x2e70('0x3a')]));_0x4158d5[_0x2e70('0x39')]=_0x4158d5[_0x2e70('0x39')][_0x2e70('0x49')]?_0x4158d5[_0x2e70('0x39')]:_0x1cabde[_0x2e70('0x34')];_0x4158d5[_0x2e70('0x73')]=qs[_0x2e70('0x3d')](_0x4527f6[_0x2e70('0x35')][_0x2e70('0x3d')]);_0x4158d5[_0x2e70('0x3f')]=qs[_0x2e70('0x37')](_[_0x2e70('0x3e')](_0x4527f6[_0x2e70('0x35')],_0x1cabde['filters']));if(_0x4527f6[_0x2e70('0x35')][_0x2e70('0x97')]){_0x4158d5['where']=_['merge'](_0x4158d5['where'],{'$or':_[_0x2e70('0x2f')](_0x4158d5[_0x2e70('0x39')],function(_0x35b034){var _0x23669d={};_0x23669d[_0x35b034]={'$like':'%'+_0x4527f6[_0x2e70('0x35')][_0x2e70('0x97')]+'%'};return _0x23669d;})});}_0x4158d5=_[_0x2e70('0x40')]({},_0x4158d5,_0x4527f6[_0x2e70('0x4a')]);return _0x125129[_0x2e70('0x96')](_0x4158d5);}})[_0x2e70('0x2a')](function(_0x438f40){if(_0x438f40){_0x1ca0f6=_0x438f40[_0x2e70('0x49')];if(!_0x4527f6[_0x2e70('0x35')][_0x2e70('0x3b')]('nolimit')){_0x4158d5['limit']=qs[_0x2e70('0x22')](_0x4527f6['query']['limit']);_0x4158d5[_0x2e70('0x24')]=qs[_0x2e70('0x24')](_0x4527f6[_0x2e70('0x35')][_0x2e70('0x24')]);}return _0x125129['getAgents'](_0x4158d5);}})[_0x2e70('0x2a')](function(_0x41da1f){if(_0x41da1f){return _0x41da1f?{'count':_0x1ca0f6,'rows':_0x41da1f}:null;}})['then'](respondWithResult(_0x3d6c38,null))[_0x2e70('0x47')](handleError(_0x3d6c38,null));};
\ No newline at end of file
+var _0xf3e0=['removeQueues','remove','ids','isArray','Voice','Sms','Fax','Openchannel','Whatsapp','transaction','through','penalty','QueueId','TeamVoiceQueue','User','emit','online','voicePause','interface','upsert','isNil','format','SIP/%s','all','addAgents','spread','removeAgents','Mail','Queue:remove','filter','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','error','stack','name','index','map','Team','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','UserProfileResource','update','destroy','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','OpenchannelQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','send','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','fields','addQueues','add','Queues'];(function(_0x200ae9,_0x4c8a30){var _0x45381c=function(_0x3da4db){while(--_0x3da4db){_0x200ae9['push'](_0x200ae9['shift']());}};_0x45381c(++_0x4c8a30);}(_0xf3e0,0x1eb));var _0x0f3e=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xf3e0[_0x59d89e];return _0x554e93;};'use strict';var emlformat=require(_0x0f3e('0x0'));var rimraf=require(_0x0f3e('0x1'));var zipdir=require(_0x0f3e('0x2'));var jsonpatch=require(_0x0f3e('0x3'));var rp=require(_0x0f3e('0x4'));var moment=require(_0x0f3e('0x5'));var BPromise=require(_0x0f3e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0f3e('0x7'));var csv=require(_0x0f3e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0f3e('0x9'));var squel=require(_0x0f3e('0xa'));var crypto=require(_0x0f3e('0xb'));var jsforce=require(_0x0f3e('0xc'));var deskjs=require(_0x0f3e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0f3e('0xe'));var Papa=require(_0x0f3e('0xf'));var Redis=require(_0x0f3e('0x10'));var authService=require(_0x0f3e('0x11'));var qs=require(_0x0f3e('0x12'));var as=require(_0x0f3e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f3e('0x14'))('api');var utils=require(_0x0f3e('0x15'));var config=require(_0x0f3e('0x16'));var licenseUtil=require(_0x0f3e('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0f3e('0x18')](config['redis'],{'host':_0x0f3e('0x19'),'port':0x18eb});var socket=require(_0x0f3e('0x1a'))(new Redis(config[_0x0f3e('0x1b')]));require(_0x0f3e('0x1c'))[_0x0f3e('0x1d')](socket);function respondWithStatusCode(_0x15eacf,_0x5a2bf7){_0x5a2bf7=_0x5a2bf7||0xcc;return function(_0x2dca0d){if(_0x2dca0d){return _0x15eacf[_0x0f3e('0x1e')](_0x5a2bf7);}return _0x15eacf[_0x0f3e('0x1f')](_0x5a2bf7)[_0x0f3e('0x20')]();};}function respondWithResult(_0x4ba065,_0xfb3383){_0xfb3383=_0xfb3383||0xc8;return function(_0x49e3cf){if(_0x49e3cf){return _0x4ba065[_0x0f3e('0x1f')](_0xfb3383)[_0x0f3e('0x21')](_0x49e3cf);}};}function respondWithFilteredResult(_0x3684e4,_0x10ee6b){return function(_0xe56d40){if(_0xe56d40){var _0x55a295=typeof _0x10ee6b[_0x0f3e('0x22')]===_0x0f3e('0x23')&&typeof _0x10ee6b[_0x0f3e('0x24')]===_0x0f3e('0x23');var _0x28d10c=_0xe56d40['count'];var _0x12d3b9=_0x55a295?0x0:_0x10ee6b[_0x0f3e('0x22')];var _0x318c0a=_0x55a295?_0xe56d40[_0x0f3e('0x25')]:_0x10ee6b[_0x0f3e('0x22')]+_0x10ee6b[_0x0f3e('0x24')];var _0x19248d;if(_0x318c0a>=_0x28d10c){_0x318c0a=_0x28d10c;_0x19248d=0xc8;}else{_0x19248d=0xce;}_0x3684e4[_0x0f3e('0x1f')](_0x19248d);return _0x3684e4[_0x0f3e('0x26')](_0x0f3e('0x27'),_0x12d3b9+'-'+_0x318c0a+'/'+_0x28d10c)['json'](_0xe56d40);}return null;};}function patchUpdates(_0x494e32){return function(_0x581ed9){try{jsonpatch['apply'](_0x581ed9,_0x494e32,!![]);}catch(_0x4103e2){return BPromise[_0x0f3e('0x28')](_0x4103e2);}return _0x581ed9['save']();};}function saveUpdates(_0x38be6a,_0x5e1f29){return function(_0x3b6a43){if(_0x3b6a43){return _0x3b6a43['update'](_0x38be6a)[_0x0f3e('0x29')](function(_0x261a30){return _0x261a30;});}return null;};}function handleEntityNotFound(_0x53fbe6,_0x49f413){return function(_0x2d7c7d){if(!_0x2d7c7d){_0x53fbe6[_0x0f3e('0x1e')](0x194);}return _0x2d7c7d;};}function handleError(_0x329aa0,_0x554012){_0x554012=_0x554012||0x1f4;return function(_0x53da10){logger[_0x0f3e('0x2a')](_0x53da10[_0x0f3e('0x2b')]);if(_0x53da10[_0x0f3e('0x2c')]){delete _0x53da10['name'];}_0x329aa0[_0x0f3e('0x1f')](_0x554012)['send'](_0x53da10);};}exports[_0x0f3e('0x2d')]=function(_0x9aebb5,_0x1a753b){var _0x341bed={},_0x1a540b={},_0x4bb3eb={'count':0x0,'rows':[]};var _0x3f81e7=_[_0x0f3e('0x2e')](db[_0x0f3e('0x2f')][_0x0f3e('0x30')],function(_0x40b55a){return{'name':_0x40b55a[_0x0f3e('0x31')],'type':_0x40b55a['type'][_0x0f3e('0x32')]};});_0x1a540b[_0x0f3e('0x33')]=_[_0x0f3e('0x2e')](_0x3f81e7,_0x0f3e('0x2c'));_0x1a540b[_0x0f3e('0x34')]=_[_0x0f3e('0x35')](_0x9aebb5[_0x0f3e('0x34')]);_0x1a540b[_0x0f3e('0x36')]=_[_0x0f3e('0x37')](_0x1a540b[_0x0f3e('0x33')],_0x1a540b[_0x0f3e('0x34')]);_0x341bed[_0x0f3e('0x38')]=_['intersection'](_0x1a540b[_0x0f3e('0x33')],qs['fields'](_0x9aebb5[_0x0f3e('0x34')]['fields']));_0x341bed[_0x0f3e('0x38')]=_0x341bed[_0x0f3e('0x38')][_0x0f3e('0x39')]?_0x341bed[_0x0f3e('0x38')]:_0x1a540b['model'];if(!_0x9aebb5[_0x0f3e('0x34')]['hasOwnProperty']('nolimit')){_0x341bed[_0x0f3e('0x24')]=qs['limit'](_0x9aebb5[_0x0f3e('0x34')]['limit']);_0x341bed[_0x0f3e('0x22')]=qs['offset'](_0x9aebb5['query']['offset']);}_0x341bed[_0x0f3e('0x3a')]=qs[_0x0f3e('0x3b')](_0x9aebb5[_0x0f3e('0x34')][_0x0f3e('0x3b')]);_0x341bed[_0x0f3e('0x3c')]=qs['filters'](_[_0x0f3e('0x3d')](_0x9aebb5[_0x0f3e('0x34')],_0x1a540b[_0x0f3e('0x36')]),_0x3f81e7);if(_0x9aebb5['query']['filter']){_0x341bed['where']=_[_0x0f3e('0x3e')](_0x341bed['where'],{'$or':_[_0x0f3e('0x2e')](_0x3f81e7,function(_0x5252db){if(_0x5252db['type']!==_0x0f3e('0x3f')){var _0x408b98={};_0x408b98[_0x5252db['name']]={'$like':'%'+_0x9aebb5[_0x0f3e('0x34')]['filter']+'%'};return _0x408b98;}})});}_0x341bed=_[_0x0f3e('0x3e')]({},_0x341bed,_0x9aebb5[_0x0f3e('0x40')]);var _0x13baa8={'where':_0x341bed[_0x0f3e('0x3c')]};return db[_0x0f3e('0x2f')][_0x0f3e('0x25')](_0x13baa8)['then'](function(_0x458219){_0x4bb3eb[_0x0f3e('0x25')]=_0x458219;if(_0x9aebb5[_0x0f3e('0x34')][_0x0f3e('0x41')]){_0x341bed['include']=[{'all':!![]}];}return db[_0x0f3e('0x2f')][_0x0f3e('0x42')](_0x341bed);})[_0x0f3e('0x29')](function(_0x44bd06){_0x4bb3eb[_0x0f3e('0x43')]=_0x44bd06;return _0x4bb3eb;})[_0x0f3e('0x29')](respondWithFilteredResult(_0x1a753b,_0x341bed))[_0x0f3e('0x44')](handleError(_0x1a753b,null));};exports[_0x0f3e('0x45')]=function(_0x23e8e4,_0x4ac79d){var _0x4e62a2={'raw':![],'where':{'id':_0x23e8e4[_0x0f3e('0x46')]['id']}},_0x3a1516={};_0x3a1516['model']=_['keys'](db[_0x0f3e('0x2f')][_0x0f3e('0x30')]);_0x3a1516[_0x0f3e('0x34')]=_[_0x0f3e('0x35')](_0x23e8e4['query']);_0x3a1516[_0x0f3e('0x36')]=_[_0x0f3e('0x37')](_0x3a1516[_0x0f3e('0x33')],_0x3a1516[_0x0f3e('0x34')]);_0x4e62a2[_0x0f3e('0x38')]=_[_0x0f3e('0x37')](_0x3a1516[_0x0f3e('0x33')],qs['fields'](_0x23e8e4[_0x0f3e('0x34')]['fields']));_0x4e62a2[_0x0f3e('0x38')]=_0x4e62a2[_0x0f3e('0x38')]['length']?_0x4e62a2[_0x0f3e('0x38')]:_0x3a1516['model'];if(_0x23e8e4[_0x0f3e('0x34')][_0x0f3e('0x41')]){_0x4e62a2[_0x0f3e('0x47')]=[{'all':!![]}];}_0x4e62a2=_[_0x0f3e('0x3e')]({},_0x4e62a2,_0x23e8e4[_0x0f3e('0x40')]);return db[_0x0f3e('0x2f')][_0x0f3e('0x48')](_0x4e62a2)[_0x0f3e('0x29')](handleEntityNotFound(_0x4ac79d,null))['then'](respondWithResult(_0x4ac79d,null))[_0x0f3e('0x44')](handleError(_0x4ac79d,null));};exports[_0x0f3e('0x49')]=function(_0x3af2f2,_0x3eb6bf){return db[_0x0f3e('0x2f')][_0x0f3e('0x49')](_0x3af2f2[_0x0f3e('0x4a')],{})[_0x0f3e('0x29')](function(_0x1d521e){var _0x16f29c=_0x3af2f2[_0x0f3e('0x4b')][_0x0f3e('0x4c')]({'plain':!![]});if(!_0x16f29c)throw new Error(_0x0f3e('0x4d'));if(_0x16f29c[_0x0f3e('0x4e')]===_0x0f3e('0x4b')){var _0x4f824f=_0x1d521e[_0x0f3e('0x4c')]({'plain':!![]});var _0x564027=_0x0f3e('0x4f');return db[_0x0f3e('0x50')][_0x0f3e('0x48')]({'where':{'name':_0x564027,'userProfileId':_0x16f29c[_0x0f3e('0x51')]},'raw':!![]})[_0x0f3e('0x29')](function(_0x88ec7b){if(_0x88ec7b&&_0x88ec7b['autoAssociation']===0x0){return db[_0x0f3e('0x52')][_0x0f3e('0x49')]({'name':_0x4f824f[_0x0f3e('0x2c')],'resourceId':_0x4f824f['id'],'type':_0x88ec7b[_0x0f3e('0x2c')],'sectionId':_0x88ec7b['id']},{})[_0x0f3e('0x29')](function(){return _0x1d521e;});}else{return _0x1d521e;}})[_0x0f3e('0x44')](function(_0x4c181c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c181c);throw _0x4c181c;});}return _0x1d521e;})[_0x0f3e('0x29')](respondWithResult(_0x3eb6bf,0xc9))[_0x0f3e('0x44')](handleError(_0x3eb6bf,null));};exports[_0x0f3e('0x53')]=function(_0x3147ba,_0x1232e2){if(_0x3147ba[_0x0f3e('0x4a')]['id']){delete _0x3147ba['body']['id'];}return db['Team'][_0x0f3e('0x48')]({'where':{'id':_0x3147ba[_0x0f3e('0x46')]['id']}})['then'](handleEntityNotFound(_0x1232e2,null))[_0x0f3e('0x29')](saveUpdates(_0x3147ba[_0x0f3e('0x4a')],null))[_0x0f3e('0x29')](respondWithResult(_0x1232e2,null))['catch'](handleError(_0x1232e2,null));};exports[_0x0f3e('0x54')]=function(_0x5f1279,_0xb8c58c){var _0x223d55=_0x5f1279['params']['id'];var _0x13e886=[];return db['sequelize']['transaction'](function(_0x4903b3){var _0x2fc782=_0x0f3e('0x55')+_0x223d55;return db['sequelize'][_0x0f3e('0x34')](_0x2fc782,{'type':db['Sequelize']['QueryTypes'][_0x0f3e('0x56')],'raw':!![],'transaction':_0x4903b3})['then'](function(_0x21a1f4){_0x13e886=_[_0x0f3e('0x2e')](_0x21a1f4,function(_0x331829){return Number(_0x331829[_0x0f3e('0x57')]);});})[_0x0f3e('0x29')](function(){var _0x2ab7d5=_0x0f3e('0x58')+_0x223d55;return db[_0x0f3e('0x59')][_0x0f3e('0x34')](_0x2ab7d5,{'type':db[_0x0f3e('0x5a')][_0x0f3e('0x5b')][_0x0f3e('0x56')],'raw':!![],'transaction':_0x4903b3});})[_0x0f3e('0x29')](function(_0x137c9b){var _0x42e8b4=_[_0x0f3e('0x2e')](_0x137c9b,function(_0x55d4f1){return Number(_0x55d4f1[_0x0f3e('0x5c')]);});return db[_0x0f3e('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x13e886},'VoiceQueueId':{'$in':_0x42e8b4}},'transaction':_0x4903b3});})[_0x0f3e('0x29')](function(){var _0x4c7b00='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x223d55;return db[_0x0f3e('0x59')][_0x0f3e('0x34')](_0x4c7b00,{'type':db[_0x0f3e('0x5a')]['QueryTypes'][_0x0f3e('0x56')],'raw':!![],'transaction':_0x4903b3});})[_0x0f3e('0x29')](function(_0x31cf93){var _0x2f3fed=_[_0x0f3e('0x2e')](_0x31cf93,function(_0x3d65d4){return Number(_0x3d65d4['MailQueueId']);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x13e886},'MailQueueId':{'$in':_0x2f3fed}},'transaction':_0x4903b3});})[_0x0f3e('0x29')](function(){var _0x446092=_0x0f3e('0x5e')+_0x223d55;return db[_0x0f3e('0x59')][_0x0f3e('0x34')](_0x446092,{'type':db[_0x0f3e('0x5a')][_0x0f3e('0x5b')][_0x0f3e('0x56')],'raw':!![],'transaction':_0x4903b3});})['then'](function(_0x38280a){var _0x358015=_['map'](_0x38280a,function(_0x5676d3){return Number(_0x5676d3[_0x0f3e('0x5f')]);});return db[_0x0f3e('0x60')][_0x0f3e('0x54')]({'where':{'UserId':{'$in':_0x13e886},'SmsQueueId':{'$in':_0x358015}},'transaction':_0x4903b3});})[_0x0f3e('0x29')](function(){var _0x4aa071=_0x0f3e('0x61')+_0x223d55;return db['sequelize'][_0x0f3e('0x34')](_0x4aa071,{'type':db[_0x0f3e('0x5a')][_0x0f3e('0x5b')][_0x0f3e('0x56')],'raw':!![],'transaction':_0x4903b3});})[_0x0f3e('0x29')](function(_0x3128be){var _0x10880c=_[_0x0f3e('0x2e')](_0x3128be,function(_0x5c2421){return Number(_0x5c2421[_0x0f3e('0x62')]);});return db['UserChatQueue'][_0x0f3e('0x54')]({'where':{'UserId':{'$in':_0x13e886},'ChatQueueId':{'$in':_0x10880c}},'transaction':_0x4903b3});})[_0x0f3e('0x29')](function(){var _0x5181f6=_0x0f3e('0x63')+_0x223d55;return db[_0x0f3e('0x59')][_0x0f3e('0x34')](_0x5181f6,{'type':db[_0x0f3e('0x5a')][_0x0f3e('0x5b')]['SELECT'],'raw':!![],'transaction':_0x4903b3});})['then'](function(_0x125c4d){var _0x5e68d0=_[_0x0f3e('0x2e')](_0x125c4d,function(_0xc5a01d){return Number(_0xc5a01d[_0x0f3e('0x64')]);});return db[_0x0f3e('0x65')][_0x0f3e('0x54')]({'where':{'UserId':{'$in':_0x13e886},'FaxQueueId':{'$in':_0x5e68d0}},'transaction':_0x4903b3});})[_0x0f3e('0x29')](function(){var _0x5f0c0b='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x223d55;return db[_0x0f3e('0x59')][_0x0f3e('0x34')](_0x5f0c0b,{'type':db[_0x0f3e('0x5a')][_0x0f3e('0x5b')][_0x0f3e('0x56')],'raw':!![],'transaction':_0x4903b3});})[_0x0f3e('0x29')](function(_0x1d7940){var _0x2c2dfc=_[_0x0f3e('0x2e')](_0x1d7940,function(_0x20edab){return Number(_0x20edab[_0x0f3e('0x66')]);});return db['UserOpenchannelQueue'][_0x0f3e('0x54')]({'where':{'UserId':{'$in':_0x13e886},'OpenchannelQueueId':{'$in':_0x2c2dfc}},'transaction':_0x4903b3});})[_0x0f3e('0x29')](function(){var _0x2fc8c5='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x223d55;return db['sequelize'][_0x0f3e('0x34')](_0x2fc8c5,{'type':db[_0x0f3e('0x5a')][_0x0f3e('0x5b')][_0x0f3e('0x56')],'raw':!![],'transaction':_0x4903b3});})['then'](function(_0x101473){var _0x3c804f=_[_0x0f3e('0x2e')](_0x101473,function(_0x5ab818){return Number(_0x5ab818['WhatsappQueueId']);});return db[_0x0f3e('0x67')]['destroy']({'where':{'UserId':{'$in':_0x13e886},'WhatsappQueueId':{'$in':_0x3c804f}},'transaction':_0x4903b3});})[_0x0f3e('0x29')](function(){return db[_0x0f3e('0x68')][_0x0f3e('0x48')]({'where':{'TeamId':_0x223d55}});})['then'](function(_0x4933d2){if(_0x4933d2===null){return;}return db[_0x0f3e('0x69')][_0x0f3e('0x54')]({'where':{'UserId':{'$in':_0x13e886},'VoicePrefixId':_0x4933d2[_0x0f3e('0x6a')]},'transaction':_0x4903b3});})[_0x0f3e('0x29')](function(){return db[_0x0f3e('0x2f')][_0x0f3e('0x54')]({'where':{'id':_0x223d55},'cascade':!![],'transaction':_0x4903b3});})[_0x0f3e('0x29')](function(_0x237589){if(_0x237589===0x0){_0xb8c58c[_0x0f3e('0x1e')](0x194);}else{return db[_0x0f3e('0x52')][_0x0f3e('0x54')]({'where':{'type':_0x0f3e('0x4f'),'resourceId':_0x223d55},'cascade':!![],'transaction':_0x4903b3})[_0x0f3e('0x29')](function(){_0xb8c58c[_0x0f3e('0x1f')](0xcc)['end']();});}})['catch'](function(_0x4d90a8){_0xb8c58c[_0x0f3e('0x1f')](0x1f4)[_0x0f3e('0x6b')](_0x4d90a8);});});};exports[_0x0f3e('0x6c')]=function(_0x55ad4a,_0x471265,_0x21c67a){return db[_0x0f3e('0x2f')][_0x0f3e('0x6d')]({'where':{'id':_0x55ad4a[_0x0f3e('0x46')]['id']}})['then'](handleEntityNotFound(_0x471265,null))[_0x0f3e('0x29')](function(_0x3bc9a5){if(!_0x55ad4a[_0x0f3e('0x34')][_0x0f3e('0x6e')]||!utils[_0x0f3e('0x6f')](_0x55ad4a[_0x0f3e('0x34')][_0x0f3e('0x6e')])){throw new db['Sequelize'][(_0x0f3e('0x70'))](_0x0f3e('0x71'));}var _0x4e66a0={};var _0x7d3ce={};_0x7d3ce[_0x0f3e('0x33')]=_[_0x0f3e('0x35')](db[_[_0x0f3e('0x72')](_0x55ad4a[_0x0f3e('0x34')]['channel'][_0x0f3e('0x73')]())+_0x0f3e('0x74')]['rawAttributes']);_0x7d3ce[_0x0f3e('0x34')]=_[_0x0f3e('0x35')](_0x55ad4a[_0x0f3e('0x34')]);_0x7d3ce[_0x0f3e('0x36')]=_[_0x0f3e('0x37')](_0x7d3ce[_0x0f3e('0x33')],_0x7d3ce[_0x0f3e('0x34')]);_0x4e66a0['attributes']=_[_0x0f3e('0x37')](_0x7d3ce['model'],qs[_0x0f3e('0x75')](_0x55ad4a['query'][_0x0f3e('0x75')]));_0x4e66a0[_0x0f3e('0x38')]=_0x4e66a0[_0x0f3e('0x38')]['length']?_0x4e66a0['attributes']:_0x7d3ce[_0x0f3e('0x33')];_0x4e66a0[_0x0f3e('0x24')]=qs[_0x0f3e('0x24')](_0x55ad4a[_0x0f3e('0x34')][_0x0f3e('0x24')]);_0x4e66a0[_0x0f3e('0x22')]=qs[_0x0f3e('0x22')](_0x55ad4a[_0x0f3e('0x34')][_0x0f3e('0x22')]);_0x4e66a0[_0x0f3e('0x3a')]=qs[_0x0f3e('0x3b')](_0x55ad4a['query'][_0x0f3e('0x3b')]);_0x4e66a0[_0x0f3e('0x3c')]=qs['filters'](_[_0x0f3e('0x3d')](_0x55ad4a[_0x0f3e('0x34')],_0x7d3ce[_0x0f3e('0x36')]));_0x4e66a0=_[_0x0f3e('0x3e')]({},_0x4e66a0,_0x55ad4a['options']);return _0x3bc9a5[_0x0f3e('0x4c')+_[_0x0f3e('0x72')](_0x55ad4a['query'][_0x0f3e('0x6e')][_0x0f3e('0x73')]())+'Queues'](_0x4e66a0);})[_0x0f3e('0x29')](respondWithResult(_0x471265,null))['catch'](handleError(_0x471265,null));};exports[_0x0f3e('0x76')]=function(_0x2518de,_0x4b7dd7,_0x16ebc5){return db[_0x0f3e('0x2f')][_0x0f3e('0x6d')]({'where':{'id':_0x2518de['params']['id']}})[_0x0f3e('0x29')](function(_0x6bae85){if(_0x6bae85){if(!_0x2518de[_0x0f3e('0x4a')][_0x0f3e('0x6e')]||!utils[_0x0f3e('0x6f')](_0x2518de[_0x0f3e('0x4a')][_0x0f3e('0x6e')])){throw new db['Sequelize'][(_0x0f3e('0x70'))]('Unknown\x20channel');}return _0x6bae85[_0x0f3e('0x77')+_[_0x0f3e('0x72')](_0x2518de[_0x0f3e('0x4a')][_0x0f3e('0x6e')]['toLowerCase']())+_0x0f3e('0x78')](_0x2518de[_0x0f3e('0x4a')]['ids']);}return null;})[_0x0f3e('0x29')](handleEntityNotFound(_0x4b7dd7,null))[_0x0f3e('0x29')](respondWithStatusCode(_0x4b7dd7,null))[_0x0f3e('0x44')](handleError(_0x4b7dd7,null));};exports[_0x0f3e('0x79')]=function(_0x511fd8,_0x4aa3fe,_0x4e69f9){return db[_0x0f3e('0x2f')]['findOne']({'where':{'id':_0x511fd8[_0x0f3e('0x46')]['id']}})[_0x0f3e('0x29')](function(_0x26036d){if(_0x26036d){if(!_0x511fd8[_0x0f3e('0x34')][_0x0f3e('0x6e')]||!utils[_0x0f3e('0x6f')](_0x511fd8[_0x0f3e('0x34')][_0x0f3e('0x6e')])){throw new db[(_0x0f3e('0x5a'))]['ValidationError'](_0x0f3e('0x71'));}return _0x26036d[_0x0f3e('0x7a')+_[_0x0f3e('0x72')](_0x511fd8[_0x0f3e('0x34')]['channel'][_0x0f3e('0x73')]())+_0x0f3e('0x78')](_0x511fd8['query'][_0x0f3e('0x7b')]);}return null;})[_0x0f3e('0x29')](handleEntityNotFound(_0x4aa3fe,null))[_0x0f3e('0x29')](respondWithStatusCode(_0x4aa3fe,null))[_0x0f3e('0x44')](handleError(_0x4aa3fe,null));};exports['addAgents']=function(_0x223662,_0x962af5){var _0x2c6081=_[_0x0f3e('0x7c')](_0x223662[_0x0f3e('0x4a')][_0x0f3e('0x7b')])?_0x223662['body'][_0x0f3e('0x7b')]:[_0x223662[_0x0f3e('0x4a')][_0x0f3e('0x7b')]];var _0x32c5da=_0x223662['params']['id'];return db[_0x0f3e('0x2f')]['find']({'where':{'id':_0x32c5da}})[_0x0f3e('0x29')](handleEntityNotFound(_0x962af5,null))[_0x0f3e('0x29')](function(_0x460a14){if(_0x460a14){var _0x16c011=[_0x0f3e('0x7d'),'Chat','Mail',_0x0f3e('0x7e'),_0x0f3e('0x7f'),_0x0f3e('0x80'),_0x0f3e('0x81')];return db[_0x0f3e('0x59')][_0x0f3e('0x82')](function(_0x3b09f0){var _0x26cfba=_[_0x0f3e('0x2e')](_0x16c011,function(_0x4454f5){var _0x4dcef4={'attributes':['id','name']};if(_0x4454f5===_0x0f3e('0x7d')){_0x4dcef4[_0x0f3e('0x83')]={'attributes':[_0x0f3e('0x84')]};}return _0x460a14[_0x0f3e('0x4c')+_0x4454f5+_0x0f3e('0x78')](_0x4dcef4)[_0x0f3e('0x29')](function(_0x4199b4){var _0x28e5bf=_['map'](_0x4199b4,function(_0x546bcd){var _0x36697e=_[_0x0f3e('0x2e')](_0x2c6081,function(_0x2bd900){var _0x23f1ae={'where':{'UserId':_0x2bd900,[_0x4454f5+_0x0f3e('0x85')]:_0x546bcd['id']},'transaction':_0x3b09f0};if(_0x4454f5===_0x0f3e('0x7d')){_0x23f1ae[_0x0f3e('0x18')]={'penalty':_0x546bcd[_0x0f3e('0x86')]['penalty']};}return db[_0x0f3e('0x87')+_0x4454f5+_0x0f3e('0x74')]['findOrCreate'](_0x23f1ae)[_0x0f3e('0x29')](function(){socket[_0x0f3e('0x88')](_0x0f3e('0x4b')+_0x4454f5+'Queue:save',{'UserId':_0x2bd900,[_0x4454f5+_0x0f3e('0x85')]:_0x546bcd['id']});if(_0x4454f5!==_0x0f3e('0x7d')){return;}return db['User'][_0x0f3e('0x42')]({'where':{'id':_0x2c6081,'online':0x1},'attributes':['id',_0x0f3e('0x2c'),_0x0f3e('0x89'),_0x0f3e('0x8a'),_0x0f3e('0x8b')],'raw':!![]})[_0x0f3e('0x29')](function(_0xebe5b5){var _0x5ee934=_[_0x0f3e('0x2e')](_0xebe5b5,function(_0x32dbd9){return db['UserVoiceQueueRt'][_0x0f3e('0x8c')]({'membername':_0x32dbd9[_0x0f3e('0x2c')],'UserId':_0x32dbd9['id'],'queue_name':_0x546bcd[_0x0f3e('0x2c')],'VoiceQueueId':_0x546bcd['id'],'interface':_[_0x0f3e('0x8d')](_0x32dbd9[_0x0f3e('0x8b')])?util[_0x0f3e('0x8e')](_0x0f3e('0x8f'),_0x32dbd9[_0x0f3e('0x2c')]):_0x32dbd9[_0x0f3e('0x8b')],'paused':_0x32dbd9[_0x0f3e('0x8a')]||![],'penalty':_0x546bcd[_0x0f3e('0x86')][_0x0f3e('0x84')]},{'transaction':_0x3b09f0});});return Promise['all'](_0x5ee934);});});});return Promise[_0x0f3e('0x90')](_0x36697e);});return Promise['all'](_0x28e5bf);})[_0x0f3e('0x29')](function(){return db[_0x0f3e('0x68')]['findOne']({'where':{'teamId':_0x32c5da}})[_0x0f3e('0x29')](function(_0x29449b){if(_0x29449b){var _0x34f37f=_[_0x0f3e('0x2e')](_0x2c6081,function(_0x57d1f5){db['UserVoicePrefix'][_0x0f3e('0x8c')]({'UserId':_0x57d1f5,'VoicePrefixId':_0x29449b[_0x0f3e('0x6a')]});});return Promise['all'](_0x34f37f);}});});});return Promise[_0x0f3e('0x90')](_0x26cfba)['then'](function(){return _0x460a14[_0x0f3e('0x91')](_0x2c6081,{'transaction':_0x3b09f0})[_0x0f3e('0x92')](function(_0x721415){return _0x721415;});});});}})[_0x0f3e('0x29')](respondWithResult(_0x962af5,null))[_0x0f3e('0x44')](handleError(_0x962af5,null));};exports[_0x0f3e('0x93')]=function(_0x2a12ec,_0x3c1d29){var _0x70ee07=_[_0x0f3e('0x7c')](_0x2a12ec[_0x0f3e('0x34')][_0x0f3e('0x7b')])?_0x2a12ec[_0x0f3e('0x34')]['ids']:[_0x2a12ec['query']['ids']];var _0x48ec92=_0x2a12ec[_0x0f3e('0x46')]['id'];return db['Team'][_0x0f3e('0x48')]({'where':{'id':_0x48ec92}})[_0x0f3e('0x29')](handleEntityNotFound(_0x3c1d29,null))[_0x0f3e('0x29')](function(_0x1ade3a){if(_0x1ade3a){var _0x50398a=['Voice','Chat',_0x0f3e('0x94'),_0x0f3e('0x7e'),_0x0f3e('0x7f'),_0x0f3e('0x80'),_0x0f3e('0x81')];return db[_0x0f3e('0x59')][_0x0f3e('0x82')](function(_0x194caa){var _0x4ab552=_['map'](_0x50398a,function(_0x4c42d0){var _0x304e4d={'attributes':['id',_0x0f3e('0x2c')]};return _0x1ade3a[_0x0f3e('0x4c')+_0x4c42d0+_0x0f3e('0x78')](_0x304e4d)[_0x0f3e('0x29')](function(_0x1de2a2){var _0x2af03c=_['map'](_0x1de2a2,function(_0x5b876e){return _0x5b876e[_0x0f3e('0x93')](_0x70ee07,{'transaction':_0x194caa})[_0x0f3e('0x29')](function(){var _0x25e068=_[_0x0f3e('0x2e')](_0x70ee07,function(_0x553d9a){socket[_0x0f3e('0x88')](_0x0f3e('0x4b')+_0x4c42d0+_0x0f3e('0x95'),{'UserId':Number(_0x553d9a),[_0x4c42d0+_0x0f3e('0x85')]:_0x5b876e['id']});if(_0x4c42d0!==_0x0f3e('0x7d')){return;}return db['UserVoiceQueueRt'][_0x0f3e('0x54')]({'where':{'VoiceQueueId':_0x5b876e['id'],'UserId':_0x553d9a},'transaction':_0x194caa});});return Promise[_0x0f3e('0x90')](_0x25e068);});});return Promise[_0x0f3e('0x90')](_0x2af03c);});});return Promise['all'](_0x4ab552)['then'](function(){return _0x1ade3a[_0x0f3e('0x93')](_0x70ee07,{'transaction':_0x194caa});})[_0x0f3e('0x29')](function(){return db[_0x0f3e('0x68')][_0x0f3e('0x6d')]({'where':{'teamId':_0x48ec92}})[_0x0f3e('0x29')](function(_0x45e44a){if(_0x45e44a){var _0x476fd2=_['map'](_0x70ee07,function(_0x222c5b){db[_0x0f3e('0x69')][_0x0f3e('0x54')]({'where':{'UserId':_0x222c5b,'VoicePrefixId':_0x45e44a['VoicePrefixId']}});});return Promise[_0x0f3e('0x90')](_0x476fd2);}});});});}})['then'](respondWithStatusCode(_0x3c1d29,null))[_0x0f3e('0x44')](handleError(_0x3c1d29,null));};exports['getAgents']=function(_0x5a7293,_0x4745f8,_0x5e83fe){var _0x26bba3={};var _0x468b05={};var _0x452107;var _0x3c3e0b;return db['Team']['findOne']({'where':{'id':_0x5a7293[_0x0f3e('0x46')]['id']}})[_0x0f3e('0x29')](handleEntityNotFound(_0x4745f8,null))['then'](function(_0x33938d){if(_0x33938d){_0x452107=_0x33938d;_0x468b05[_0x0f3e('0x33')]=_[_0x0f3e('0x35')](db['User'][_0x0f3e('0x30')]);_0x468b05[_0x0f3e('0x34')]=_['keys'](_0x5a7293[_0x0f3e('0x34')]);_0x468b05[_0x0f3e('0x36')]=_[_0x0f3e('0x37')](_0x468b05[_0x0f3e('0x33')],_0x468b05[_0x0f3e('0x34')]);_0x26bba3['attributes']=_[_0x0f3e('0x37')](_0x468b05[_0x0f3e('0x33')],qs[_0x0f3e('0x75')](_0x5a7293[_0x0f3e('0x34')][_0x0f3e('0x75')]));_0x26bba3['attributes']=_0x26bba3[_0x0f3e('0x38')]['length']?_0x26bba3[_0x0f3e('0x38')]:_0x468b05['model'];_0x26bba3[_0x0f3e('0x3a')]=qs[_0x0f3e('0x3b')](_0x5a7293[_0x0f3e('0x34')][_0x0f3e('0x3b')]);_0x26bba3[_0x0f3e('0x3c')]=qs[_0x0f3e('0x36')](_[_0x0f3e('0x3d')](_0x5a7293['query'],_0x468b05['filters']));if(_0x5a7293[_0x0f3e('0x34')][_0x0f3e('0x96')]){_0x26bba3['where']=_[_0x0f3e('0x3e')](_0x26bba3[_0x0f3e('0x3c')],{'$or':_[_0x0f3e('0x2e')](_0x26bba3[_0x0f3e('0x38')],function(_0x51931f){var _0x3e1065={};_0x3e1065[_0x51931f]={'$like':'%'+_0x5a7293['query']['filter']+'%'};return _0x3e1065;})});}_0x26bba3=_[_0x0f3e('0x3e')]({},_0x26bba3,_0x5a7293[_0x0f3e('0x40')]);return _0x452107[_0x0f3e('0x97')](_0x26bba3);}})[_0x0f3e('0x29')](function(_0x20e9ff){if(_0x20e9ff){_0x3c3e0b=_0x20e9ff[_0x0f3e('0x39')];if(!_0x5a7293[_0x0f3e('0x34')][_0x0f3e('0x98')]('nolimit')){_0x26bba3[_0x0f3e('0x24')]=qs[_0x0f3e('0x24')](_0x5a7293[_0x0f3e('0x34')][_0x0f3e('0x24')]);_0x26bba3['offset']=qs[_0x0f3e('0x22')](_0x5a7293[_0x0f3e('0x34')]['offset']);}return _0x452107[_0x0f3e('0x97')](_0x26bba3);}})[_0x0f3e('0x29')](function(_0x4e77cc){if(_0x4e77cc){return _0x4e77cc?{'count':_0x3c3e0b,'rows':_0x4e77cc}:null;}})['then'](respondWithResult(_0x4745f8,null))[_0x0f3e('0x44')](handleError(_0x4745f8,null));};
\ No newline at end of file
index 2b23ee2..be316cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6b3e=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','Team'];(function(_0x25b2a0,_0x4aaf17){var _0x2b7e0a=function(_0x584051){while(--_0x584051){_0x25b2a0['push'](_0x25b2a0['shift']());}};_0x2b7e0a(++_0x4aaf17);}(_0x6b3e,0x15d));var _0xe6b3=function(_0x4585fe,_0x53a8c5){_0x4585fe=_0x4585fe-0x0;var _0x2e6492=_0x6b3e[_0x4585fe];return _0x2e6492;};'use strict';var EventEmitter=require(_0xe6b3('0x0'));var Team=require('../../mysqldb')['db'][_0xe6b3('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xe6b3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe6b3('0x3'),'afterDestroy':_0xe6b3('0x4')};function emitEvent(_0x257402){return function(_0x646ad2,_0xc37d10,_0x94c315){TeamEvents[_0xe6b3('0x5')](_0x257402+':'+_0x646ad2['id'],_0x646ad2);TeamEvents[_0xe6b3('0x5')](_0x257402,_0x646ad2);_0x94c315(null);};}for(var e in events){if(events[_0xe6b3('0x6')](e)){var event=events[e];Team[_0xe6b3('0x7')](e,emitEvent(event));}}module[_0xe6b3('0x8')]=TeamEvents;
\ No newline at end of file
+var _0x632c=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0x632c,0x159));var _0xc632=function(_0x304fe6,_0x56c64e){_0x304fe6=_0x304fe6-0x0;var _0x56d6df=_0x632c[_0x304fe6];return _0x56d6df;};'use strict';var EventEmitter=require(_0xc632('0x0'));var Team=require(_0xc632('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xc632('0x2')](0x0);var events={'afterCreate':_0xc632('0x3'),'afterUpdate':_0xc632('0x4'),'afterDestroy':_0xc632('0x5')};function emitEvent(_0x24815f){return function(_0x3d4730,_0x233ede,_0x5a87e0){TeamEvents[_0xc632('0x6')](_0x24815f+':'+_0x3d4730['id'],_0x3d4730);TeamEvents[_0xc632('0x6')](_0x24815f,_0x3d4730);_0x5a87e0(null);};}for(var e in events){if(events[_0xc632('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xc632('0x8')]=TeamEvents;
\ No newline at end of file
index 66db49d..64a527d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8fed=['Sms','Voice','Whatsapp','lodash','get','Queues','then','map','setDataValue','catch','exports','define','Team','teams','Fax','Mail','Openchannel'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0x8fed,0xad));var _0xd8fe=function(_0x4630bc,_0x540fb3){_0x4630bc=_0x4630bc-0x0;var _0x4ecd0d=_0x8fed[_0x4630bc];return _0x4ecd0d;};'use strict';var _=require(_0xd8fe('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x24cfa2,_0x5748ab){var _0x1b8bb0=_0xd8fe('0x1')+_0x5748ab+_0xd8fe('0x2');return _0x24cfa2[_0x1b8bb0]()[_0xd8fe('0x3')](function(_0x29643b){return _[_0xd8fe('0x4')](_0x29643b,function(_0x3529f6){_0x3529f6[_0xd8fe('0x5')]('channel',_0x5748ab);return _0x3529f6;});})[_0xd8fe('0x6')](function(_0xf77c42){throw _0xf77c42;});}module[_0xd8fe('0x7')]=function(_0x2110ac){return _0x2110ac[_0xd8fe('0x8')](_0xd8fe('0x9'),attributes,{'tableName':_0xd8fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xc44462=this;var _0x54544c=['Chat',_0xd8fe('0xb'),_0xd8fe('0xc'),_0xd8fe('0xd'),_0xd8fe('0xe'),_0xd8fe('0xf'),_0xd8fe('0x10')];return Promise['resolve']()[_0xd8fe('0x3')](function(){var _0x4d330d=_['map'](_0x54544c,function(_0x545823){return getQueuesByChannel(_0xc44462,_0x545823);});return Promise['all'](_0x4d330d);})['catch'](function(_0x4bcc07){throw _0x4bcc07;});}}});};
\ No newline at end of file
+var _0xff1f=['Whatsapp','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','catch','exports','define','Team','Chat','Mail','Openchannel','Sms'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xff1f,0xa5));var _0xfff1=function(_0x3a94e1,_0x22e4fd){_0x3a94e1=_0x3a94e1-0x0;var _0x6a09d5=_0xff1f[_0x3a94e1];return _0x6a09d5;};'use strict';var _=require(_0xfff1('0x0'));var attributes=require(_0xfff1('0x1'));function getQueuesByChannel(_0x56fc10,_0x53e4e9){var _0x4cc589=_0xfff1('0x2')+_0x53e4e9+_0xfff1('0x3');return _0x56fc10[_0x4cc589]()[_0xfff1('0x4')](function(_0x57ccbc){return _[_0xfff1('0x5')](_0x57ccbc,function(_0x4c5fd7){_0x4c5fd7[_0xfff1('0x6')]('channel',_0x53e4e9);return _0x4c5fd7;});})[_0xfff1('0x7')](function(_0xa5fd38){throw _0xa5fd38;});}module[_0xfff1('0x8')]=function(_0x38c6ab){return _0x38c6ab[_0xfff1('0x9')](_0xfff1('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x196cc7=this;var _0x61e550=[_0xfff1('0xb'),'Fax',_0xfff1('0xc'),_0xfff1('0xd'),_0xfff1('0xe'),'Voice',_0xfff1('0xf')];return Promise[_0xfff1('0x10')]()[_0xfff1('0x4')](function(){var _0x273800=_[_0xfff1('0x5')](_0x61e550,function(_0x1ca117){return getQueuesByChannel(_0x196cc7,_0x1ca117);});return Promise[_0xfff1('0x11')](_0x273800);})['catch'](function(_0x47e3b3){throw _0x47e3b3;});}}});};
\ No newline at end of file
index dc314a9..96e967d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6bb9=['socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x1b3233,_0x528ae0){var _0x46d7b0=function(_0x499ab1){while(--_0x499ab1){_0x1b3233['push'](_0x1b3233['shift']());}};_0x46d7b0(++_0x528ae0);}(_0x6bb9,0x1c2));var _0x96bb=function(_0x4f45c0,_0xce273){_0x4f45c0=_0x4f45c0-0x0;var _0x584a1b=_0x6bb9[_0x4f45c0];return _0x584a1b;};'use strict';var _=require('lodash');var util=require(_0x96bb('0x0'));var moment=require('moment');var BPromise=require(_0x96bb('0x1'));var rs=require(_0x96bb('0x2'));var fs=require('fs');var Redis=require(_0x96bb('0x3'));var db=require(_0x96bb('0x4'))['db'];var utils=require(_0x96bb('0x5'));var logger=require(_0x96bb('0x6'))('rpc');var config=require(_0x96bb('0x7'));var jayson=require(_0x96bb('0x8'));var client=jayson[_0x96bb('0x9')][_0x96bb('0xa')]({'port':0x232a});config[_0x96bb('0xb')]=_[_0x96bb('0xc')](config[_0x96bb('0xb')],{'host':_0x96bb('0xd'),'port':0x18eb});var socket=require(_0x96bb('0xe'))(new Redis(config[_0x96bb('0xb')]));require(_0x96bb('0xf'))[_0x96bb('0x10')](socket);function respondWithRpcPromise(_0x1725cd,_0x1c6686,_0x4f919f){return new BPromise(function(_0xa34c3c,_0x1ee2ac){return client[_0x96bb('0x11')](_0x1725cd,_0x4f919f)[_0x96bb('0x12')](function(_0x32abcc){logger[_0x96bb('0x13')]('Team,\x20%s,\x20%s',_0x1c6686,_0x96bb('0x14'));logger['debug'](_0x96bb('0x15'),_0x1c6686,_0x96bb('0x14'),JSON[_0x96bb('0x16')](_0x32abcc));if(_0x32abcc[_0x96bb('0x17')]){if(_0x32abcc[_0x96bb('0x17')][_0x96bb('0x18')]===0x1f4){logger['error'](_0x96bb('0x19'),_0x1c6686,_0x32abcc[_0x96bb('0x17')][_0x96bb('0x1a')]);return _0x1ee2ac(_0x32abcc[_0x96bb('0x17')][_0x96bb('0x1a')]);}logger[_0x96bb('0x17')](_0x96bb('0x19'),_0x1c6686,_0x32abcc[_0x96bb('0x17')][_0x96bb('0x1a')]);return _0xa34c3c(_0x32abcc[_0x96bb('0x17')][_0x96bb('0x1a')]);}else{logger[_0x96bb('0x13')]('Team,\x20%s,\x20%s',_0x1c6686,_0x96bb('0x14'));_0xa34c3c(_0x32abcc[_0x96bb('0x1b')][_0x96bb('0x1a')]);}})[_0x96bb('0x1c')](function(_0x1b5188){logger[_0x96bb('0x17')](_0x96bb('0x19'),_0x1c6686,_0x1b5188);_0x1ee2ac(_0x1b5188);});});}
\ No newline at end of file
+var _0xd344=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','moment'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xd344,0x16e));var _0x4d34=function(_0x12116d,_0x48b34c){_0x12116d=_0x12116d-0x0;var _0xc7f48b=_0xd344[_0x12116d];return _0xc7f48b;};'use strict';var _=require(_0x4d34('0x0'));var util=require('util');var moment=require(_0x4d34('0x1'));var BPromise=require('bluebird');var rs=require(_0x4d34('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d34('0x3'))['db'];var utils=require(_0x4d34('0x4'));var logger=require('../../config/logger')(_0x4d34('0x5'));var config=require('../../config/environment');var jayson=require(_0x4d34('0x6'));var client=jayson[_0x4d34('0x7')][_0x4d34('0x8')]({'port':0x232a});config[_0x4d34('0x9')]=_['defaults'](config['redis'],{'host':_0x4d34('0xa'),'port':0x18eb});var socket=require(_0x4d34('0xb'))(new Redis(config[_0x4d34('0x9')]));require('./team.socket')[_0x4d34('0xc')](socket);function respondWithRpcPromise(_0x496fc5,_0x247eaf,_0x9d538d){return new BPromise(function(_0x1ceca2,_0x217335){return client['request'](_0x496fc5,_0x9d538d)[_0x4d34('0xd')](function(_0x48d23f){logger[_0x4d34('0xe')](_0x4d34('0xf'),_0x247eaf,_0x4d34('0x10'));logger['debug'](_0x4d34('0x11'),_0x247eaf,_0x4d34('0x10'),JSON[_0x4d34('0x12')](_0x48d23f));if(_0x48d23f['error']){if(_0x48d23f['error'][_0x4d34('0x13')]===0x1f4){logger[_0x4d34('0x14')]('Team,\x20%s,\x20%s',_0x247eaf,_0x48d23f[_0x4d34('0x14')][_0x4d34('0x15')]);return _0x217335(_0x48d23f[_0x4d34('0x14')][_0x4d34('0x15')]);}logger[_0x4d34('0x14')](_0x4d34('0xf'),_0x247eaf,_0x48d23f[_0x4d34('0x14')]['message']);return _0x1ceca2(_0x48d23f[_0x4d34('0x14')]['message']);}else{logger['info'](_0x4d34('0xf'),_0x247eaf,_0x4d34('0x10'));_0x1ceca2(_0x48d23f[_0x4d34('0x16')][_0x4d34('0x15')]);}})['catch'](function(_0x2f6872){logger[_0x4d34('0x14')](_0x4d34('0xf'),_0x247eaf,_0x2f6872);_0x217335(_0x2f6872);});});}
\ No newline at end of file
index 96362c4..668ea4c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf81a=['register','length','team:','./team.events','save','remove'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xf81a,0x16b));var _0xaf81=function(_0x7b115a,_0x5eda28){_0x7b115a=_0x7b115a-0x0;var _0x2a7303=_0xf81a[_0x7b115a];return _0x2a7303;};'use strict';var TeamEvents=require(_0xaf81('0x0'));var events=[_0xaf81('0x1'),_0xaf81('0x2'),'update'];function createListener(_0x3f40f1,_0x3692c7){return function(_0x285b5b){_0x3692c7['emit'](_0x3f40f1,_0x285b5b);};}function removeListener(_0x4590d4,_0x398bb6){return function(){TeamEvents['removeListener'](_0x4590d4,_0x398bb6);};}exports[_0xaf81('0x3')]=function(_0x3c4f98){for(var _0x1c89dd=0x0,_0x5cfd36=events[_0xaf81('0x4')];_0x1c89dd<_0x5cfd36;_0x1c89dd++){var _0x365b31=events[_0x1c89dd];var _0x4c3052=createListener(_0xaf81('0x5')+_0x365b31,_0x3c4f98);TeamEvents['on'](_0x365b31,_0x4c3052);}};
\ No newline at end of file
+var _0xdd99=['emit','removeListener','register','team:','./team.events','save','remove'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xdd99,0x146));var _0x9dd9=function(_0x5dd50b,_0x58e8ea){_0x5dd50b=_0x5dd50b-0x0;var _0xde960c=_0xdd99[_0x5dd50b];return _0xde960c;};'use strict';var TeamEvents=require(_0x9dd9('0x0'));var events=[_0x9dd9('0x1'),_0x9dd9('0x2'),'update'];function createListener(_0x1cfa25,_0x51c70b){return function(_0x175f6b){_0x51c70b[_0x9dd9('0x3')](_0x1cfa25,_0x175f6b);};}function removeListener(_0x5e7d3c,_0x9a6b30){return function(){TeamEvents[_0x9dd9('0x4')](_0x5e7d3c,_0x9a6b30);};}exports[_0x9dd9('0x5')]=function(_0x29aad1){for(var _0x3a0a00=0x0,_0x59c174=events['length'];_0x3a0a00<_0x59c174;_0x3a0a00++){var _0x3bf33f=events[_0x3a0a00];var _0xd73926=createListener(_0x9dd9('0x6')+_0x3bf33f,_0x29aad1);TeamEvents['on'](_0x3bf33f,_0xd73926);}};
\ No newline at end of file
index 834bb0d..45eac11 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd52d=['INTEGER','exports'];(function(_0x188360,_0x3d93f8){var _0x1fbe6d=function(_0x3d9d32){while(--_0x3d9d32){_0x188360['push'](_0x188360['shift']());}};_0x1fbe6d(++_0x3d93f8);}(_0xd52d,0x1c7));var _0xdd52=function(_0x589176,_0x3ce805){_0x589176=_0x589176-0x0;var _0x1cc0a2=_0xd52d[_0x589176];return _0x1cc0a2;};'use strict';var Sequelize=require('sequelize');module[_0xdd52('0x0')]={'TeamId':{'type':Sequelize[_0xdd52('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
+var _0x16a3=['INTEGER'];(function(_0x3eab90,_0x190fd2){var _0x562b0e=function(_0x284dd6){while(--_0x284dd6){_0x3eab90['push'](_0x3eab90['shift']());}};_0x562b0e(++_0x190fd2);}(_0x16a3,0x1e0));var _0x316a=function(_0x3d7cd5,_0x57cc20){_0x3d7cd5=_0x3d7cd5-0x0;var _0x5f0a05=_0x16a3[_0x3d7cd5];return _0x5f0a05;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0x316a('0x0')]},'VoicePrefixId':{'type':Sequelize[_0x316a('0x0')]}};
\ No newline at end of file
index 9cddfd5..7ee457c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4cf8=['../../config/environment','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x31edb8,_0x75cfef){var _0xcbbfab=function(_0x3afa84){while(--_0x3afa84){_0x31edb8['push'](_0x31edb8['shift']());}};_0xcbbfab(++_0x75cfef);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x44c974,_0x1bcfde){_0x44c974=_0x44c974-0x0;var _0x5214c6=_0x4cf8[_0x44c974];return _0x5214c6;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var logger=require(_0x84cf('0x2'))(_0x84cf('0x3'));var moment=require(_0x84cf('0x4'));var BPromise=require(_0x84cf('0x5'));var rp=require(_0x84cf('0x6'));var fs=require('fs');var path=require(_0x84cf('0x7'));var rimraf=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var attributes=require(_0x84cf('0xa'));module[_0x84cf('0xb')]=function(_0x50ade2,_0x4af3f1){return _0x50ade2[_0x84cf('0xc')]('TeamVoicePrefix',attributes,{'tableName':_0x84cf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x0f88=['../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x296f0b,_0x2ff187){var _0x8471fc=function(_0x3386b8){while(--_0x3386b8){_0x296f0b['push'](_0x296f0b['shift']());}};_0x8471fc(++_0x2ff187);}(_0x0f88,0x1d9));var _0x80f8=function(_0x3508d1,_0x4436de){_0x3508d1=_0x3508d1-0x0;var _0x235dda=_0x0f88[_0x3508d1];return _0x235dda;};'use strict';var _=require(_0x80f8('0x0'));var util=require(_0x80f8('0x1'));var logger=require(_0x80f8('0x2'))(_0x80f8('0x3'));var moment=require(_0x80f8('0x4'));var BPromise=require(_0x80f8('0x5'));var rp=require(_0x80f8('0x6'));var fs=require('fs');var path=require(_0x80f8('0x7'));var rimraf=require('rimraf');var config=require(_0x80f8('0x8'));var attributes=require('./teamVoicePrefix.attributes');module[_0x80f8('0x9')]=function(_0x2ed778,_0x1add64){return _0x2ed778[_0x80f8('0xa')](_0x80f8('0xb'),attributes,{'tableName':_0x80f8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index e50f92c..658fc0b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x22c539,_0xee73be){var _0x4a68b0=function(_0x2bcb7c){while(--_0x2bcb7c){_0x22c539['push'](_0x22c539['shift']());}};_0x4a68b0(++_0xee73be);}(_0x70e0,0x17b));var _0x070e=function(_0x336307,_0x2ded91){_0x336307=_0x336307-0x0;var _0x1fc5ee=_0x70e0[_0x336307];return _0x1fc5ee;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router;
\ No newline at end of file
+var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1b0f88,_0x6f1df1){var _0x5f284f=function(_0x37c979){while(--_0x37c979){_0x1b0f88['push'](_0x1b0f88['shift']());}};_0x5f284f(++_0x6f1df1);}(_0x70e0,0x17b));var _0x070e=function(_0x476c69,_0x4e2e85){_0x476c69=_0x476c69-0x0;var _0x4ffd13=_0x70e0[_0x476c69];return _0x4ffd13;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router;
\ No newline at end of file
index 4e5ceb8..b2ca907 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xec29=['exports','INTEGER','sequelize'];(function(_0x54843d,_0x3a9db6){var _0x5223b8=function(_0x55f7f2){while(--_0x55f7f2){_0x54843d['push'](_0x54843d['shift']());}};_0x5223b8(++_0x3a9db6);}(_0xec29,0x1ca));var _0x9ec2=function(_0x27f9b0,_0x418aae){_0x27f9b0=_0x27f9b0-0x0;var _0x55bccf=_0xec29[_0x27f9b0];return _0x55bccf;};'use strict';var Sequelize=require(_0x9ec2('0x0'));module[_0x9ec2('0x1')]={'penalty':{'type':Sequelize[_0x9ec2('0x2')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x6eed=['sequelize','exports','INTEGER'];(function(_0x2cb742,_0x58e3ee){var _0x3e76d6=function(_0x3fd1da){while(--_0x3fd1da){_0x2cb742['push'](_0x2cb742['shift']());}};_0x3e76d6(++_0x58e3ee);}(_0x6eed,0xff));var _0xd6ee=function(_0x5de6c9,_0x471538){_0x5de6c9=_0x5de6c9-0x0;var _0x4f45f6=_0x6eed[_0x5de6c9];return _0x4f45f6;};'use strict';var Sequelize=require(_0xd6ee('0x0'));module[_0xd6ee('0x1')]={'penalty':{'type':Sequelize[_0xd6ee('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index efd13a2..6e51790 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb31a=['define','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x267c50,_0x1e71be){var _0x8da2c1=function(_0x2385d1){while(--_0x2385d1){_0x267c50['push'](_0x267c50['shift']());}};_0x8da2c1(++_0x1e71be);}(_0xb31a,0xd4));var _0xab31=function(_0x101024,_0x453057){_0x101024=_0x101024-0x0;var _0x268065=_0xb31a[_0x101024];return _0x268065;};'use strict';var _=require(_0xab31('0x0'));var util=require(_0xab31('0x1'));var logger=require(_0xab31('0x2'))(_0xab31('0x3'));var moment=require(_0xab31('0x4'));var BPromise=require(_0xab31('0x5'));var rp=require(_0xab31('0x6'));var fs=require('fs');var path=require(_0xab31('0x7'));var rimraf=require(_0xab31('0x8'));var config=require(_0xab31('0x9'));var attributes=require(_0xab31('0xa'));module[_0xab31('0xb')]=function(_0x9c6740,_0x2c336b){return _0x9c6740[_0xab31('0xc')]('TeamVoiceQueue',attributes,{'tableName':_0xab31('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xdfcc=['moment','bluebird','request-promise','rimraf','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger'];(function(_0x4ac6a1,_0xe069dd){var _0x2ad0e8=function(_0xa47546){while(--_0xa47546){_0x4ac6a1['push'](_0x4ac6a1['shift']());}};_0x2ad0e8(++_0xe069dd);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0xdfcc[_0x1780f8];return _0x33a410;};'use strict';var _=require(_0xcdfc('0x0'));var util=require(_0xcdfc('0x1'));var logger=require(_0xcdfc('0x2'))('api');var moment=require(_0xcdfc('0x3'));var BPromise=require(_0xcdfc('0x4'));var rp=require(_0xcdfc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdfc('0x6'));var config=require('../../config/environment');var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0xa928f6,_0x155d4c){return _0xa928f6['define'](_0xcdfc('0x7'),attributes,{'tableName':_0xcdfc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index f03efef..b5920c9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5455=['debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x28399b,_0x4689da){var _0xd00061=function(_0x44bea5){while(--_0x44bea5){_0x28399b['push'](_0x28399b['shift']());}};_0xd00061(++_0x4689da);}(_0x5455,0x197));var _0x5545=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5455[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x5545('0x0'));var moment=require(_0x5545('0x1'));var BPromise=require(_0x5545('0x2'));var rs=require(_0x5545('0x3'));var fs=require('fs');var Redis=require(_0x5545('0x4'));var db=require(_0x5545('0x5'))['db'];var utils=require(_0x5545('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5545('0x7'));var jayson=require(_0x5545('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea57f,_0x5d69d3,_0x5c2476){return new BPromise(function(_0x9cbb0d,_0x36f3b9){return client['request'](_0x2ea57f,_0x5c2476)[_0x5545('0x9')](function(_0xbf37f){logger[_0x5545('0xa')](_0x5545('0xb'),_0x5d69d3,_0x5545('0xc'));logger[_0x5545('0xd')](_0x5545('0xe'),_0x5d69d3,_0x5545('0xc'),JSON[_0x5545('0xf')](_0xbf37f));if(_0xbf37f['error']){if(_0xbf37f['error'][_0x5545('0x10')]===0x1f4){logger[_0x5545('0x11')](_0x5545('0xb'),_0x5d69d3,_0xbf37f[_0x5545('0x11')]['message']);return _0x36f3b9(_0xbf37f[_0x5545('0x11')][_0x5545('0x12')]);}logger['error'](_0x5545('0xb'),_0x5d69d3,_0xbf37f[_0x5545('0x11')][_0x5545('0x12')]);return _0x9cbb0d(_0xbf37f[_0x5545('0x11')]['message']);}else{logger[_0x5545('0xa')](_0x5545('0xb'),_0x5d69d3,_0x5545('0xc'));_0x9cbb0d(_0xbf37f[_0x5545('0x13')][_0x5545('0x12')]);}})[_0x5545('0x14')](function(_0xf9256c){logger[_0x5545('0x11')](_0x5545('0xb'),_0x5d69d3,_0xf9256c);_0x36f3b9(_0xf9256c);});});}
\ No newline at end of file
+var _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x55e0,0xdc));var _0x055e=function(_0x17bc97,_0x193276){_0x17bc97=_0x17bc97-0x0;var _0xde61d6=_0x55e0[_0x17bc97];return _0xde61d6;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});}
\ No newline at end of file
index d2e99a4..faab6d0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x94ff=['/:id','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','update','delete'];(function(_0x11fdd6,_0x3e9acf){var _0x1c79b9=function(_0x9eda9f){while(--_0x9eda9f){_0x11fdd6['push'](_0x11fdd6['shift']());}};_0x1c79b9(++_0x3e9acf);}(_0x94ff,0xc3));var _0xf94f=function(_0x38b718,_0x3e333e){_0x38b718=_0x38b718-0x0;var _0x353eb9=_0x94ff[_0x38b718];return _0x353eb9;};'use strict';var multer=require(_0xf94f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf94f('0x1'));var router=express[_0xf94f('0x2')]();var fs_extra=require(_0xf94f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf94f('0x4'));var config=require(_0xf94f('0x5'));var controller=require('./template.controller');router[_0xf94f('0x6')]('/',auth[_0xf94f('0x7')](),controller['index']);router[_0xf94f('0x6')]('/:id',auth[_0xf94f('0x7')](),controller[_0xf94f('0x8')]);router['post']('/',auth[_0xf94f('0x7')](),controller[_0xf94f('0x9')]);router[_0xf94f('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xf94f('0xb')]);router[_0xf94f('0xc')](_0xf94f('0xd'),auth[_0xf94f('0x7')](),controller[_0xf94f('0xe')]);module[_0xf94f('0xf')]=router;
\ No newline at end of file
+var _0x93e9=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x8484fc,_0x507683){var _0x2ecc7e=function(_0x4898c4){while(--_0x4898c4){_0x8484fc['push'](_0x8484fc['shift']());}};_0x2ecc7e(++_0x507683);}(_0x93e9,0xcc));var _0x993e=function(_0x1760f8,_0x3e8f45){_0x1760f8=_0x1760f8-0x0;var _0x3a002c=_0x93e9[_0x1760f8];return _0x3a002c;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['show']);router[_0x993e('0xd')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0xf')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller[_0x993e('0x10')]);router['delete'](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index 4a6b6f3..8a0e1ee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7903=['TEXT','sequelize','STRING'];(function(_0xf7a91b,_0x1c9b9d){var _0x52c82d=function(_0x13d7f5){while(--_0x13d7f5){_0xf7a91b['push'](_0xf7a91b['shift']());}};_0x52c82d(++_0x1c9b9d);}(_0x7903,0x1f3));var _0x3790=function(_0x593327,_0x208deb){_0x593327=_0x593327-0x0;var _0x4cef17=_0x7903[_0x593327];return _0x4cef17;};'use strict';var Sequelize=require(_0x3790('0x0'));module['exports']={'name':{'type':Sequelize[_0x3790('0x1')]},'description':{'type':Sequelize[_0x3790('0x1')]},'html':{'type':Sequelize[_0x3790('0x2')]}};
\ No newline at end of file
+var _0x4a77=['STRING','TEXT','sequelize','exports'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0x4a77,0x1e2));var _0x74a7=function(_0x47b4c3,_0x302ef4){_0x47b4c3=_0x47b4c3-0x0;var _0x4c2c48=_0x4a77[_0x47b4c3];return _0x4c2c48;};'use strict';var Sequelize=require(_0x74a7('0x0'));module[_0x74a7('0x1')]={'name':{'type':Sequelize[_0x74a7('0x2')]},'description':{'type':Sequelize[_0x74a7('0x2')]},'html':{'type':Sequelize[_0x74a7('0x3')]}};
\ No newline at end of file
index 1c83086..1a6c240 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfa72=['options','includeAll','findAll','show','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','autoAssociation','params','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','map','Template','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xfa72,0x150));var _0x2fa7=function(_0x123621,_0x223939){_0x123621=_0x123621-0x0;var _0x181507=_0xfa72[_0x123621];return _0x181507;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2fa7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2fa7('0x1'));var Mustache=require(_0x2fa7('0x2'));var util=require(_0x2fa7('0x3'));var path=require(_0x2fa7('0x4'));var sox=require(_0x2fa7('0x5'));var csv=require(_0x2fa7('0x6'));var ejs=require(_0x2fa7('0x7'));var fs=require('fs');var fs_extra=require(_0x2fa7('0x8'));var _=require('lodash');var squel=require(_0x2fa7('0x9'));var crypto=require(_0x2fa7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2fa7('0xb'));var toCsv=require(_0x2fa7('0x6'));var querystring=require(_0x2fa7('0xc'));var Papa=require('papaparse');var Redis=require(_0x2fa7('0xd'));var authService=require(_0x2fa7('0xe'));var qs=require(_0x2fa7('0xf'));var as=require(_0x2fa7('0x10'));var hardwareService=require(_0x2fa7('0x11'));var logger=require(_0x2fa7('0x12'))(_0x2fa7('0x13'));var utils=require(_0x2fa7('0x14'));var config=require(_0x2fa7('0x15'));var licenseUtil=require(_0x2fa7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x84d677,_0x1871bc){_0x1871bc=_0x1871bc||0xcc;return function(_0x333823){if(_0x333823){return _0x84d677[_0x2fa7('0x17')](_0x1871bc);}return _0x84d677[_0x2fa7('0x18')](_0x1871bc)['end']();};}function respondWithResult(_0x26fa01,_0x55ac93){_0x55ac93=_0x55ac93||0xc8;return function(_0x382819){if(_0x382819){return _0x26fa01[_0x2fa7('0x18')](_0x55ac93)[_0x2fa7('0x19')](_0x382819);}};}function respondWithFilteredResult(_0x2f645d,_0x1485ed){return function(_0x570a28){if(_0x570a28){var _0x58a455=typeof _0x1485ed[_0x2fa7('0x1a')]==='undefined'&&typeof _0x1485ed[_0x2fa7('0x1b')]==='undefined';var _0x4ba36d=_0x570a28[_0x2fa7('0x1c')];var _0x40bc39=_0x58a455?0x0:_0x1485ed[_0x2fa7('0x1a')];var _0x81416e=_0x58a455?_0x570a28[_0x2fa7('0x1c')]:_0x1485ed[_0x2fa7('0x1a')]+_0x1485ed[_0x2fa7('0x1b')];var _0x53ad05;if(_0x81416e>=_0x4ba36d){_0x81416e=_0x4ba36d;_0x53ad05=0xc8;}else{_0x53ad05=0xce;}_0x2f645d[_0x2fa7('0x18')](_0x53ad05);return _0x2f645d[_0x2fa7('0x1d')](_0x2fa7('0x1e'),_0x40bc39+'-'+_0x81416e+'/'+_0x4ba36d)[_0x2fa7('0x19')](_0x570a28);}return null;};}function patchUpdates(_0xfc2f37){return function(_0x203e23){try{jsonpatch[_0x2fa7('0x1f')](_0x203e23,_0xfc2f37,!![]);}catch(_0x3df279){return BPromise['reject'](_0x3df279);}return _0x203e23[_0x2fa7('0x20')]();};}function saveUpdates(_0x180681,_0x3c75db){return function(_0xff1e01){if(_0xff1e01){return _0xff1e01[_0x2fa7('0x21')](_0x180681)[_0x2fa7('0x22')](function(_0x59b451){return _0x59b451;});}return null;};}function removeEntity(_0x12352c,_0x2bf0ec){return function(_0x719f2e){if(_0x719f2e){return _0x719f2e[_0x2fa7('0x23')]()['then'](function(){var _0x13d104=_0x719f2e[_0x2fa7('0x24')]({'plain':!![]});var _0x5dcb42='Templates';return db[_0x2fa7('0x25')][_0x2fa7('0x23')]({'where':{'type':_0x5dcb42,'resourceId':_0x13d104['id']}})[_0x2fa7('0x22')](function(){return _0x719f2e;});})[_0x2fa7('0x22')](function(){_0x12352c[_0x2fa7('0x18')](0xcc)[_0x2fa7('0x26')]();});}};}function handleEntityNotFound(_0x131da5,_0x115da7){return function(_0x49a595){if(!_0x49a595){_0x131da5['sendStatus'](0x194);}return _0x49a595;};}function handleError(_0x54b7d4,_0x1a5e95){_0x1a5e95=_0x1a5e95||0x1f4;return function(_0x4b9e1c){logger[_0x2fa7('0x27')](_0x4b9e1c['stack']);if(_0x4b9e1c[_0x2fa7('0x28')]){delete _0x4b9e1c['name'];}_0x54b7d4[_0x2fa7('0x18')](_0x1a5e95)[_0x2fa7('0x29')](_0x4b9e1c);};}exports[_0x2fa7('0x2a')]=function(_0x355d7e,_0x103428){var _0x1d36ee={},_0x5605b2={},_0x4485ea={'count':0x0,'rows':[]};var _0x2729e9=_[_0x2fa7('0x2b')](db[_0x2fa7('0x2c')][_0x2fa7('0x2d')],function(_0x474241){return{'name':_0x474241[_0x2fa7('0x2e')],'type':_0x474241['type'][_0x2fa7('0x2f')]};});_0x5605b2[_0x2fa7('0x30')]=_[_0x2fa7('0x2b')](_0x2729e9,_0x2fa7('0x28'));_0x5605b2['query']=_[_0x2fa7('0x31')](_0x355d7e[_0x2fa7('0x32')]);_0x5605b2[_0x2fa7('0x33')]=_[_0x2fa7('0x34')](_0x5605b2[_0x2fa7('0x30')],_0x5605b2[_0x2fa7('0x32')]);_0x1d36ee[_0x2fa7('0x35')]=_[_0x2fa7('0x34')](_0x5605b2[_0x2fa7('0x30')],qs[_0x2fa7('0x36')](_0x355d7e[_0x2fa7('0x32')][_0x2fa7('0x36')]));_0x1d36ee['attributes']=_0x1d36ee['attributes'][_0x2fa7('0x37')]?_0x1d36ee[_0x2fa7('0x35')]:_0x5605b2[_0x2fa7('0x30')];if(!_0x355d7e[_0x2fa7('0x32')]['hasOwnProperty']('nolimit')){_0x1d36ee[_0x2fa7('0x1b')]=qs['limit'](_0x355d7e[_0x2fa7('0x32')][_0x2fa7('0x1b')]);_0x1d36ee[_0x2fa7('0x1a')]=qs['offset'](_0x355d7e[_0x2fa7('0x32')][_0x2fa7('0x1a')]);}_0x1d36ee[_0x2fa7('0x38')]=qs['sort'](_0x355d7e[_0x2fa7('0x32')][_0x2fa7('0x39')]);_0x1d36ee[_0x2fa7('0x3a')]=qs[_0x2fa7('0x33')](_[_0x2fa7('0x3b')](_0x355d7e[_0x2fa7('0x32')],_0x5605b2[_0x2fa7('0x33')]),_0x2729e9);if(_0x355d7e['query'][_0x2fa7('0x3c')]){_0x1d36ee['where']=_[_0x2fa7('0x3d')](_0x1d36ee[_0x2fa7('0x3a')],{'$or':_[_0x2fa7('0x2b')](_0x2729e9,function(_0x57334e){if(_0x57334e[_0x2fa7('0x3e')]!==_0x2fa7('0x3f')){var _0x44dc4a={};_0x44dc4a[_0x57334e['name']]={'$like':'%'+_0x355d7e['query'][_0x2fa7('0x3c')]+'%'};return _0x44dc4a;}})});}_0x1d36ee=_['merge']({},_0x1d36ee,_0x355d7e[_0x2fa7('0x40')]);var _0x422cf9={'where':_0x1d36ee[_0x2fa7('0x3a')]};return db[_0x2fa7('0x2c')][_0x2fa7('0x1c')](_0x422cf9)[_0x2fa7('0x22')](function(_0x5db325){_0x4485ea[_0x2fa7('0x1c')]=_0x5db325;if(_0x355d7e[_0x2fa7('0x32')][_0x2fa7('0x41')]){_0x1d36ee['include']=[{'all':!![]}];}return db[_0x2fa7('0x2c')][_0x2fa7('0x42')](_0x1d36ee);})['then'](function(_0x566618){_0x4485ea['rows']=_0x566618;return _0x4485ea;})[_0x2fa7('0x22')](respondWithFilteredResult(_0x103428,_0x1d36ee))['catch'](handleError(_0x103428,null));};exports[_0x2fa7('0x43')]=function(_0xcd80b3,_0xb68878){var _0x2fa866={'raw':!![],'where':{'id':_0xcd80b3['params']['id']}},_0x8ae1ee={};_0x8ae1ee[_0x2fa7('0x30')]=_['keys'](db[_0x2fa7('0x2c')][_0x2fa7('0x2d')]);_0x8ae1ee[_0x2fa7('0x32')]=_[_0x2fa7('0x31')](_0xcd80b3[_0x2fa7('0x32')]);_0x8ae1ee[_0x2fa7('0x33')]=_[_0x2fa7('0x34')](_0x8ae1ee[_0x2fa7('0x30')],_0x8ae1ee[_0x2fa7('0x32')]);_0x2fa866['attributes']=_['intersection'](_0x8ae1ee['model'],qs[_0x2fa7('0x36')](_0xcd80b3['query'][_0x2fa7('0x36')]));_0x2fa866['attributes']=_0x2fa866[_0x2fa7('0x35')][_0x2fa7('0x37')]?_0x2fa866['attributes']:_0x8ae1ee[_0x2fa7('0x30')];if(_0xcd80b3[_0x2fa7('0x32')][_0x2fa7('0x41')]){_0x2fa866[_0x2fa7('0x44')]=[{'all':!![]}];}_0x2fa866=_['merge']({},_0x2fa866,_0xcd80b3['options']);return db[_0x2fa7('0x2c')][_0x2fa7('0x45')](_0x2fa866)['then'](handleEntityNotFound(_0xb68878,null))[_0x2fa7('0x22')](respondWithResult(_0xb68878,null))[_0x2fa7('0x46')](handleError(_0xb68878,null));};exports[_0x2fa7('0x47')]=function(_0x1f754a,_0x51f065){return db['Template'][_0x2fa7('0x47')](_0x1f754a[_0x2fa7('0x48')],{})['then'](function(_0x51ebcf){var _0x3b0e10=_0x1f754a[_0x2fa7('0x49')][_0x2fa7('0x24')]({'plain':!![]});if(!_0x3b0e10)throw new Error(_0x2fa7('0x4a'));if(_0x3b0e10[_0x2fa7('0x4b')]===_0x2fa7('0x49')){var _0x52b687=_0x51ebcf[_0x2fa7('0x24')]({'plain':!![]});var _0x4bab1b=_0x2fa7('0x4c');return db[_0x2fa7('0x4d')]['find']({'where':{'name':_0x4bab1b,'userProfileId':_0x3b0e10['userProfileId']},'raw':!![]})[_0x2fa7('0x22')](function(_0x1b4653){if(_0x1b4653&&_0x1b4653[_0x2fa7('0x4e')]===0x0){return db['UserProfileResource'][_0x2fa7('0x47')]({'name':_0x52b687[_0x2fa7('0x28')],'resourceId':_0x52b687['id'],'type':_0x1b4653[_0x2fa7('0x28')],'sectionId':_0x1b4653['id']},{})['then'](function(){return _0x51ebcf;});}else{return _0x51ebcf;}})[_0x2fa7('0x46')](function(_0xa1affc){logger[_0x2fa7('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa1affc);throw _0xa1affc;});}return _0x51ebcf;})[_0x2fa7('0x22')](respondWithResult(_0x51f065,0xc9))[_0x2fa7('0x46')](handleError(_0x51f065,null));};exports[_0x2fa7('0x21')]=function(_0x924a21,_0x4170c2){if(_0x924a21[_0x2fa7('0x48')]['id']){delete _0x924a21[_0x2fa7('0x48')]['id'];}return db['Template'][_0x2fa7('0x45')]({'where':{'id':_0x924a21['params']['id']}})[_0x2fa7('0x22')](handleEntityNotFound(_0x4170c2,null))['then'](saveUpdates(_0x924a21[_0x2fa7('0x48')],null))[_0x2fa7('0x22')](respondWithResult(_0x4170c2,null))['catch'](handleError(_0x4170c2,null));};exports['destroy']=function(_0x3a88d3,_0x32db03){return db[_0x2fa7('0x2c')][_0x2fa7('0x45')]({'where':{'id':_0x3a88d3[_0x2fa7('0x4f')]['id']}})[_0x2fa7('0x22')](handleEntityNotFound(_0x32db03,null))[_0x2fa7('0x22')](removeEntity(_0x32db03,null))[_0x2fa7('0x46')](handleError(_0x32db03,null));};
\ No newline at end of file
+var _0xd28c=['sort','where','pick','filter','merge','VIRTUAL','options','Template','include','findAll','rows','catch','show','params','filters','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','get','Templates','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order'];(function(_0x2041db,_0x4cbe69){var _0x362835=function(_0x53618d){while(--_0x53618d){_0x2041db['push'](_0x2041db['shift']());}};_0x362835(++_0x4cbe69);}(_0xd28c,0xc4));var _0xcd28=function(_0xae62f,_0x4ba80d){_0xae62f=_0xae62f-0x0;var _0x244306=_0xd28c[_0xae62f];return _0x244306;};'use strict';var emlformat=require(_0xcd28('0x0'));var rimraf=require(_0xcd28('0x1'));var zipdir=require(_0xcd28('0x2'));var jsonpatch=require(_0xcd28('0x3'));var rp=require(_0xcd28('0x4'));var moment=require('moment');var BPromise=require(_0xcd28('0x5'));var Mustache=require(_0xcd28('0x6'));var util=require('util');var path=require(_0xcd28('0x7'));var sox=require(_0xcd28('0x8'));var csv=require(_0xcd28('0x9'));var ejs=require(_0xcd28('0xa'));var fs=require('fs');var fs_extra=require(_0xcd28('0xb'));var _=require(_0xcd28('0xc'));var squel=require(_0xcd28('0xd'));var crypto=require('crypto');var jsforce=require(_0xcd28('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcd28('0x9'));var querystring=require(_0xcd28('0xf'));var Papa=require(_0xcd28('0x10'));var Redis=require(_0xcd28('0x11'));var authService=require(_0xcd28('0x12'));var qs=require(_0xcd28('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd28('0x14'))(_0xcd28('0x15'));var utils=require('../../config/utils');var config=require(_0xcd28('0x16'));var licenseUtil=require(_0xcd28('0x17'));var db=require(_0xcd28('0x18'))['db'];function respondWithStatusCode(_0x54f20e,_0xd9185d){_0xd9185d=_0xd9185d||0xcc;return function(_0xb9a9dc){if(_0xb9a9dc){return _0x54f20e[_0xcd28('0x19')](_0xd9185d);}return _0x54f20e[_0xcd28('0x1a')](_0xd9185d)[_0xcd28('0x1b')]();};}function respondWithResult(_0x3c63b0,_0x4dcc75){_0x4dcc75=_0x4dcc75||0xc8;return function(_0x25c5da){if(_0x25c5da){return _0x3c63b0[_0xcd28('0x1a')](_0x4dcc75)[_0xcd28('0x1c')](_0x25c5da);}};}function respondWithFilteredResult(_0x58977f,_0x25fb14){return function(_0x95876b){if(_0x95876b){var _0x8a6933=typeof _0x25fb14[_0xcd28('0x1d')]===_0xcd28('0x1e')&&typeof _0x25fb14['limit']==='undefined';var _0x405e20=_0x95876b['count'];var _0x596722=_0x8a6933?0x0:_0x25fb14[_0xcd28('0x1d')];var _0x27dc8b=_0x8a6933?_0x95876b[_0xcd28('0x1f')]:_0x25fb14[_0xcd28('0x1d')]+_0x25fb14[_0xcd28('0x20')];var _0xa6398b;if(_0x27dc8b>=_0x405e20){_0x27dc8b=_0x405e20;_0xa6398b=0xc8;}else{_0xa6398b=0xce;}_0x58977f['status'](_0xa6398b);return _0x58977f[_0xcd28('0x21')](_0xcd28('0x22'),_0x596722+'-'+_0x27dc8b+'/'+_0x405e20)[_0xcd28('0x1c')](_0x95876b);}return null;};}function patchUpdates(_0xec16b8){return function(_0x2e8614){try{jsonpatch[_0xcd28('0x23')](_0x2e8614,_0xec16b8,!![]);}catch(_0x2971af){return BPromise[_0xcd28('0x24')](_0x2971af);}return _0x2e8614['save']();};}function saveUpdates(_0x467f3f,_0x295083){return function(_0x550793){if(_0x550793){return _0x550793['update'](_0x467f3f)[_0xcd28('0x25')](function(_0x1099af){return _0x1099af;});}return null;};}function removeEntity(_0x2d528b,_0x5250d7){return function(_0x1ca58b){if(_0x1ca58b){return _0x1ca58b[_0xcd28('0x26')]()['then'](function(){var _0xabe38d=_0x1ca58b[_0xcd28('0x27')]({'plain':!![]});var _0x87df3a=_0xcd28('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x87df3a,'resourceId':_0xabe38d['id']}})[_0xcd28('0x25')](function(){return _0x1ca58b;});})[_0xcd28('0x25')](function(){_0x2d528b[_0xcd28('0x1a')](0xcc)[_0xcd28('0x1b')]();});}};}function handleEntityNotFound(_0x2b9876,_0x3784c3){return function(_0x11b26f){if(!_0x11b26f){_0x2b9876[_0xcd28('0x19')](0x194);}return _0x11b26f;};}function handleError(_0x3f94ec,_0x1cc3e8){_0x1cc3e8=_0x1cc3e8||0x1f4;return function(_0x5689fd){logger[_0xcd28('0x29')](_0x5689fd[_0xcd28('0x2a')]);if(_0x5689fd[_0xcd28('0x2b')]){delete _0x5689fd[_0xcd28('0x2b')];}_0x3f94ec[_0xcd28('0x1a')](_0x1cc3e8)[_0xcd28('0x2c')](_0x5689fd);};}exports[_0xcd28('0x2d')]=function(_0x48b66b,_0x2eca61){var _0x4302e7={},_0x80400={},_0x4528aa={'count':0x0,'rows':[]};var _0x1153c2=_[_0xcd28('0x2e')](db['Template'][_0xcd28('0x2f')],function(_0x4d6c5e){return{'name':_0x4d6c5e['fieldName'],'type':_0x4d6c5e[_0xcd28('0x30')][_0xcd28('0x31')]};});_0x80400[_0xcd28('0x32')]=_[_0xcd28('0x2e')](_0x1153c2,'name');_0x80400['query']=_[_0xcd28('0x33')](_0x48b66b[_0xcd28('0x34')]);_0x80400['filters']=_['intersection'](_0x80400['model'],_0x80400[_0xcd28('0x34')]);_0x4302e7[_0xcd28('0x35')]=_[_0xcd28('0x36')](_0x80400['model'],qs[_0xcd28('0x37')](_0x48b66b[_0xcd28('0x34')][_0xcd28('0x37')]));_0x4302e7[_0xcd28('0x35')]=_0x4302e7[_0xcd28('0x35')]['length']?_0x4302e7[_0xcd28('0x35')]:_0x80400[_0xcd28('0x32')];if(!_0x48b66b[_0xcd28('0x34')][_0xcd28('0x38')](_0xcd28('0x39'))){_0x4302e7['limit']=qs[_0xcd28('0x20')](_0x48b66b[_0xcd28('0x34')][_0xcd28('0x20')]);_0x4302e7[_0xcd28('0x1d')]=qs[_0xcd28('0x1d')](_0x48b66b['query'][_0xcd28('0x1d')]);}_0x4302e7[_0xcd28('0x3a')]=qs[_0xcd28('0x3b')](_0x48b66b[_0xcd28('0x34')][_0xcd28('0x3b')]);_0x4302e7[_0xcd28('0x3c')]=qs['filters'](_[_0xcd28('0x3d')](_0x48b66b[_0xcd28('0x34')],_0x80400['filters']),_0x1153c2);if(_0x48b66b[_0xcd28('0x34')][_0xcd28('0x3e')]){_0x4302e7[_0xcd28('0x3c')]=_[_0xcd28('0x3f')](_0x4302e7[_0xcd28('0x3c')],{'$or':_['map'](_0x1153c2,function(_0x2fe0f7){if(_0x2fe0f7['type']!==_0xcd28('0x40')){var _0x5702f9={};_0x5702f9[_0x2fe0f7[_0xcd28('0x2b')]]={'$like':'%'+_0x48b66b[_0xcd28('0x34')][_0xcd28('0x3e')]+'%'};return _0x5702f9;}})});}_0x4302e7=_[_0xcd28('0x3f')]({},_0x4302e7,_0x48b66b[_0xcd28('0x41')]);var _0x4e36a3={'where':_0x4302e7[_0xcd28('0x3c')]};return db[_0xcd28('0x42')][_0xcd28('0x1f')](_0x4e36a3)[_0xcd28('0x25')](function(_0x1de8f2){_0x4528aa[_0xcd28('0x1f')]=_0x1de8f2;if(_0x48b66b[_0xcd28('0x34')]['includeAll']){_0x4302e7[_0xcd28('0x43')]=[{'all':!![]}];}return db[_0xcd28('0x42')][_0xcd28('0x44')](_0x4302e7);})[_0xcd28('0x25')](function(_0x4d6ced){_0x4528aa[_0xcd28('0x45')]=_0x4d6ced;return _0x4528aa;})[_0xcd28('0x25')](respondWithFilteredResult(_0x2eca61,_0x4302e7))[_0xcd28('0x46')](handleError(_0x2eca61,null));};exports[_0xcd28('0x47')]=function(_0x3a295f,_0x347056){var _0x4556f5={'raw':!![],'where':{'id':_0x3a295f[_0xcd28('0x48')]['id']}},_0x11a7d8={};_0x11a7d8[_0xcd28('0x32')]=_[_0xcd28('0x33')](db[_0xcd28('0x42')][_0xcd28('0x2f')]);_0x11a7d8['query']=_['keys'](_0x3a295f[_0xcd28('0x34')]);_0x11a7d8[_0xcd28('0x49')]=_[_0xcd28('0x36')](_0x11a7d8[_0xcd28('0x32')],_0x11a7d8[_0xcd28('0x34')]);_0x4556f5[_0xcd28('0x35')]=_[_0xcd28('0x36')](_0x11a7d8['model'],qs[_0xcd28('0x37')](_0x3a295f[_0xcd28('0x34')][_0xcd28('0x37')]));_0x4556f5[_0xcd28('0x35')]=_0x4556f5[_0xcd28('0x35')][_0xcd28('0x4a')]?_0x4556f5[_0xcd28('0x35')]:_0x11a7d8[_0xcd28('0x32')];if(_0x3a295f[_0xcd28('0x34')][_0xcd28('0x4b')]){_0x4556f5[_0xcd28('0x43')]=[{'all':!![]}];}_0x4556f5=_[_0xcd28('0x3f')]({},_0x4556f5,_0x3a295f[_0xcd28('0x41')]);return db[_0xcd28('0x42')][_0xcd28('0x4c')](_0x4556f5)['then'](handleEntityNotFound(_0x347056,null))[_0xcd28('0x25')](respondWithResult(_0x347056,null))['catch'](handleError(_0x347056,null));};exports[_0xcd28('0x4d')]=function(_0x3afbec,_0x2898a7){return db[_0xcd28('0x42')][_0xcd28('0x4d')](_0x3afbec['body'],{})[_0xcd28('0x25')](function(_0x965531){var _0x23ad1c=_0x3afbec[_0xcd28('0x4e')]['get']({'plain':!![]});if(!_0x23ad1c)throw new Error(_0xcd28('0x4f'));if(_0x23ad1c[_0xcd28('0x50')]===_0xcd28('0x4e')){var _0x2eaab4=_0x965531[_0xcd28('0x27')]({'plain':!![]});var _0x1e10ad=_0xcd28('0x28');return db['UserProfileSection'][_0xcd28('0x4c')]({'where':{'name':_0x1e10ad,'userProfileId':_0x23ad1c[_0xcd28('0x51')]},'raw':!![]})[_0xcd28('0x25')](function(_0x2b3c5a){if(_0x2b3c5a&&_0x2b3c5a['autoAssociation']===0x0){return db[_0xcd28('0x52')][_0xcd28('0x4d')]({'name':_0x2eaab4['name'],'resourceId':_0x2eaab4['id'],'type':_0x2b3c5a[_0xcd28('0x2b')],'sectionId':_0x2b3c5a['id']},{})[_0xcd28('0x25')](function(){return _0x965531;});}else{return _0x965531;}})[_0xcd28('0x46')](function(_0x559970){logger[_0xcd28('0x29')](_0xcd28('0x53'),_0x559970);throw _0x559970;});}return _0x965531;})[_0xcd28('0x25')](respondWithResult(_0x2898a7,0xc9))[_0xcd28('0x46')](handleError(_0x2898a7,null));};exports['update']=function(_0x173469,_0x5a43a4){if(_0x173469[_0xcd28('0x54')]['id']){delete _0x173469[_0xcd28('0x54')]['id'];}return db['Template']['find']({'where':{'id':_0x173469['params']['id']}})[_0xcd28('0x25')](handleEntityNotFound(_0x5a43a4,null))['then'](saveUpdates(_0x173469[_0xcd28('0x54')],null))[_0xcd28('0x25')](respondWithResult(_0x5a43a4,null))[_0xcd28('0x46')](handleError(_0x5a43a4,null));};exports[_0xcd28('0x26')]=function(_0x474206,_0x1aefe7){return db['Template']['find']({'where':{'id':_0x474206[_0xcd28('0x48')]['id']}})['then'](handleEntityNotFound(_0x1aefe7,null))[_0xcd28('0x25')](removeEntity(_0x1aefe7,null))['catch'](handleError(_0x1aefe7,null));};
\ No newline at end of file
index 6c378dc..b154dff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x62f6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates'];(function(_0x17823f,_0xffd807){var _0x51fc21=function(_0x5e4921){while(--_0x5e4921){_0x17823f['push'](_0x17823f['shift']());}};_0x51fc21(++_0xffd807);}(_0x62f6,0x69));var _0x662f=function(_0x47e5a3,_0x2d76af){_0x47e5a3=_0x47e5a3-0x0;var _0x2fccc6=_0x62f6[_0x47e5a3];return _0x2fccc6;};'use strict';var _=require(_0x662f('0x0'));var util=require(_0x662f('0x1'));var logger=require(_0x662f('0x2'))(_0x662f('0x3'));var moment=require(_0x662f('0x4'));var BPromise=require(_0x662f('0x5'));var rp=require(_0x662f('0x6'));var fs=require('fs');var path=require(_0x662f('0x7'));var rimraf=require(_0x662f('0x8'));var config=require(_0x662f('0x9'));var attributes=require(_0x662f('0xa'));module[_0x662f('0xb')]=function(_0x1570a5,_0x1c77a4){return _0x1570a5[_0x662f('0xc')](_0x662f('0xd'),attributes,{'tableName':_0x662f('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc280=['path','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc280,0x1c2));var _0x0c28=function(_0x358544,_0x53b69a){_0x358544=_0x358544-0x0;var _0x341d5b=_0xc280[_0x358544];return _0x341d5b;};'use strict';var _=require(_0x0c28('0x0'));var util=require(_0x0c28('0x1'));var logger=require(_0x0c28('0x2'))(_0x0c28('0x3'));var moment=require('moment');var BPromise=require(_0x0c28('0x4'));var rp=require(_0x0c28('0x5'));var fs=require('fs');var path=require(_0x0c28('0x6'));var rimraf=require('rimraf');var config=require(_0x0c28('0x7'));var attributes=require(_0x0c28('0x8'));module['exports']=function(_0x22681e,_0x2ddfa9){return _0x22681e[_0x0c28('0x9')](_0x0c28('0xa'),attributes,{'tableName':_0x0c28('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 41dab86..415de0e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4729=['catch','GetTemplate','Template','findAll','options','where','attributes','limit','include','map','model','stringify','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0x4729,0x123));var _0x9472=function(_0x3c04bb,_0x171aee){_0x3c04bb=_0x3c04bb-0x0;var _0x57070e=_0x4729[_0x3c04bb];return _0x57070e;};'use strict';var _=require(_0x9472('0x0'));var util=require('util');var moment=require(_0x9472('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9472('0x2'));var db=require(_0x9472('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9472('0x4'))(_0x9472('0x5'));var config=require(_0x9472('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9472('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23b16a,_0x1cf9cf,_0x43c61c){return new BPromise(function(_0xe2f384,_0x16c432){return client[_0x9472('0x8')](_0x23b16a,_0x43c61c)[_0x9472('0x9')](function(_0x135a81){logger[_0x9472('0xa')](_0x9472('0xb'),_0x1cf9cf,_0x9472('0xc'));logger[_0x9472('0xd')](_0x9472('0xe'),_0x1cf9cf,'request\x20sent',JSON['stringify'](_0x135a81));if(_0x135a81[_0x9472('0xf')]){if(_0x135a81[_0x9472('0xf')][_0x9472('0x10')]===0x1f4){logger[_0x9472('0xf')](_0x9472('0xb'),_0x1cf9cf,_0x135a81[_0x9472('0xf')][_0x9472('0x11')]);return _0x16c432(_0x135a81[_0x9472('0xf')][_0x9472('0x11')]);}logger[_0x9472('0xf')](_0x9472('0xb'),_0x1cf9cf,_0x135a81[_0x9472('0xf')]['message']);return _0xe2f384(_0x135a81[_0x9472('0xf')][_0x9472('0x11')]);}else{logger[_0x9472('0xa')]('Template,\x20%s,\x20%s',_0x1cf9cf,_0x9472('0xc'));_0xe2f384(_0x135a81[_0x9472('0x12')][_0x9472('0x11')]);}})[_0x9472('0x13')](function(_0x3629a0){logger[_0x9472('0xf')]('Template,\x20%s,\x20%s',_0x1cf9cf,_0x3629a0);_0x16c432(_0x3629a0);});});}exports[_0x9472('0x14')]=function(_0x48aa26){var _0x12b461=this;return new Promise(function(_0x5dcb5b,_0x2aaa32){return db[_0x9472('0x15')][_0x9472('0x16')]({'raw':_0x48aa26[_0x9472('0x17')]?_0x48aa26[_0x9472('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x48aa26[_0x9472('0x17')]?_0x48aa26['options'][_0x9472('0x18')]||null:null,'attributes':_0x48aa26[_0x9472('0x17')]?_0x48aa26['options'][_0x9472('0x19')]||null:null,'limit':_0x48aa26['options']?_0x48aa26[_0x9472('0x17')][_0x9472('0x1a')]||null:null,'include':_0x48aa26[_0x9472('0x17')]?_0x48aa26['options'][_0x9472('0x1b')]?_[_0x9472('0x1c')](_0x48aa26[_0x9472('0x17')][_0x9472('0x1b')],function(_0x4b3c45){return{'model':db[_0x4b3c45['model']],'as':_0x4b3c45['as'],'attributes':_0x4b3c45['attributes'],'include':_0x4b3c45['include']?_[_0x9472('0x1c')](_0x4b3c45['include'],function(_0x172d6d){return{'model':db[_0x172d6d[_0x9472('0x1d')]],'as':_0x172d6d['as'],'attributes':_0x172d6d[_0x9472('0x19')],'include':_0x172d6d['include']?_[_0x9472('0x1c')](_0x172d6d[_0x9472('0x1b')],function(_0x17f985){return{'model':db[_0x17f985['model']],'as':_0x17f985['as'],'attributes':_0x17f985[_0x9472('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9472('0x9')](function(_0x4e327f){logger[_0x9472('0xa')](_0x9472('0x14'),_0x48aa26);logger['debug'](_0x9472('0x14'),_0x48aa26,JSON[_0x9472('0x1e')](_0x4e327f));_0x5dcb5b(_0x4e327f);})['catch'](function(_0x4473cf){logger[_0x9472('0xf')](_0x9472('0x14'),_0x4473cf[_0x9472('0x11')],_0x48aa26);_0x2aaa32(_0x12b461[_0x9472('0xf')](0x1f4,_0x4473cf['message']));});});};
\ No newline at end of file
+var _0x2bf4=['info','catch','Template','findAll','options','raw','attributes','limit','include','map','model','GetTemplate','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x7cc9f2,_0x3f8167){var _0x1b784d=function(_0x474b8e){while(--_0x474b8e){_0x7cc9f2['push'](_0x7cc9f2['shift']());}};_0x1b784d(++_0x3f8167);}(_0x2bf4,0x1da));var _0x42bf=function(_0x26b180,_0x52d861){_0x26b180=_0x26b180-0x0;var _0x28e7f4=_0x2bf4[_0x26b180];return _0x28e7f4;};'use strict';var _=require(_0x42bf('0x0'));var util=require('util');var moment=require(_0x42bf('0x1'));var BPromise=require('bluebird');var rs=require(_0x42bf('0x2'));var fs=require('fs');var Redis=require(_0x42bf('0x3'));var db=require(_0x42bf('0x4'))['db'];var utils=require(_0x42bf('0x5'));var logger=require('../../config/logger')(_0x42bf('0x6'));var config=require(_0x42bf('0x7'));var jayson=require(_0x42bf('0x8'));var client=jayson[_0x42bf('0x9')][_0x42bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x97e561,_0x20f1b5,_0x2eab23){return new BPromise(function(_0x52fbae,_0x5a116e){return client[_0x42bf('0xb')](_0x97e561,_0x2eab23)[_0x42bf('0xc')](function(_0x3a2ff0){logger['info'](_0x42bf('0xd'),_0x20f1b5,'request\x20sent');logger[_0x42bf('0xe')](_0x42bf('0xf'),_0x20f1b5,_0x42bf('0x10'),JSON[_0x42bf('0x11')](_0x3a2ff0));if(_0x3a2ff0[_0x42bf('0x12')]){if(_0x3a2ff0['error'][_0x42bf('0x13')]===0x1f4){logger[_0x42bf('0x12')](_0x42bf('0xd'),_0x20f1b5,_0x3a2ff0['error'][_0x42bf('0x14')]);return _0x5a116e(_0x3a2ff0[_0x42bf('0x12')]['message']);}logger[_0x42bf('0x12')](_0x42bf('0xd'),_0x20f1b5,_0x3a2ff0[_0x42bf('0x12')][_0x42bf('0x14')]);return _0x52fbae(_0x3a2ff0[_0x42bf('0x12')]['message']);}else{logger[_0x42bf('0x15')](_0x42bf('0xd'),_0x20f1b5,_0x42bf('0x10'));_0x52fbae(_0x3a2ff0['result'][_0x42bf('0x14')]);}})[_0x42bf('0x16')](function(_0x3e9a53){logger[_0x42bf('0x12')]('Template,\x20%s,\x20%s',_0x20f1b5,_0x3e9a53);_0x5a116e(_0x3e9a53);});});}exports['GetTemplate']=function(_0xce9c20){var _0x4cca78=this;return new Promise(function(_0x41c523,_0x4ac7e0){return db[_0x42bf('0x17')][_0x42bf('0x18')]({'raw':_0xce9c20[_0x42bf('0x19')]?_0xce9c20[_0x42bf('0x19')][_0x42bf('0x1a')]===undefined?!![]:![]:!![],'where':_0xce9c20['options']?_0xce9c20[_0x42bf('0x19')]['where']||null:null,'attributes':_0xce9c20['options']?_0xce9c20[_0x42bf('0x19')][_0x42bf('0x1b')]||null:null,'limit':_0xce9c20[_0x42bf('0x19')]?_0xce9c20['options'][_0x42bf('0x1c')]||null:null,'include':_0xce9c20[_0x42bf('0x19')]?_0xce9c20[_0x42bf('0x19')][_0x42bf('0x1d')]?_['map'](_0xce9c20[_0x42bf('0x19')]['include'],function(_0x2af2bb){return{'model':db[_0x2af2bb['model']],'as':_0x2af2bb['as'],'attributes':_0x2af2bb[_0x42bf('0x1b')],'include':_0x2af2bb[_0x42bf('0x1d')]?_[_0x42bf('0x1e')](_0x2af2bb['include'],function(_0x30e32a){return{'model':db[_0x30e32a['model']],'as':_0x30e32a['as'],'attributes':_0x30e32a[_0x42bf('0x1b')],'include':_0x30e32a[_0x42bf('0x1d')]?_[_0x42bf('0x1e')](_0x30e32a[_0x42bf('0x1d')],function(_0x249071){return{'model':db[_0x249071[_0x42bf('0x1f')]],'as':_0x249071['as'],'attributes':_0x249071[_0x42bf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x42bf('0xc')](function(_0x517c43){logger[_0x42bf('0x15')](_0x42bf('0x20'),_0xce9c20);logger[_0x42bf('0xe')](_0x42bf('0x20'),_0xce9c20,JSON[_0x42bf('0x11')](_0x517c43));_0x41c523(_0x517c43);})[_0x42bf('0x16')](function(_0x4b0757){logger[_0x42bf('0x12')](_0x42bf('0x20'),_0x4b0757[_0x42bf('0x14')],_0xce9c20);_0x4ac7e0(_0x4cca78[_0x42bf('0x12')](0x1f4,_0x4b0757[_0x42bf('0x14')]));});});};
\ No newline at end of file
index 6874534..48fd0ee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa45d=['/:id/actions','getActions','create','post','addAllCondition','addAnyCondition','addAction','put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions'];(function(_0x180cd0,_0x386c6e){var _0x49fc32=function(_0x551c2c){while(--_0x551c2c){_0x180cd0['push'](_0x180cd0['shift']());}};_0x49fc32(++_0x386c6e);}(_0xa45d,0x19a));var _0xda45=function(_0x20fa16,_0x3adeed){_0x20fa16=_0x20fa16-0x0;var _0x52c059=_0xa45d[_0x20fa16];return _0x52c059;};'use strict';var multer=require(_0xda45('0x0'));var util=require(_0xda45('0x1'));var path=require('path');var timeout=require(_0xda45('0x2'));var express=require(_0xda45('0x3'));var router=express[_0xda45('0x4')]();var fs_extra=require(_0xda45('0x5'));var auth=require(_0xda45('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0xda45('0x7')]('/',auth['isAuthenticated'](),controller[_0xda45('0x8')]);router[_0xda45('0x7')](_0xda45('0x9'),auth[_0xda45('0xa')](),controller['show']);router[_0xda45('0x7')](_0xda45('0xb'),auth[_0xda45('0xa')](),controller[_0xda45('0xc')]);router[_0xda45('0x7')](_0xda45('0xd'),auth[_0xda45('0xa')](),controller[_0xda45('0xe')]);router[_0xda45('0x7')](_0xda45('0xf'),auth['isAuthenticated'](),controller[_0xda45('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xda45('0x11')]);router[_0xda45('0x12')](_0xda45('0xb'),auth[_0xda45('0xa')](),controller[_0xda45('0x13')]);router['post'](_0xda45('0xd'),auth[_0xda45('0xa')](),controller[_0xda45('0x14')]);router['post']('/:id/actions',auth[_0xda45('0xa')](),controller[_0xda45('0x15')]);router[_0xda45('0x16')](_0xda45('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xda45('0x17')](_0xda45('0x9'),auth['isAuthenticated'](),controller[_0xda45('0x18')]);module['exports']=router;
\ No newline at end of file
+var _0x242f=['addAllCondition','addAction','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create'];(function(_0x35a4d8,_0x2bcad3){var _0x27e249=function(_0x40286e){while(--_0x40286e){_0x35a4d8['push'](_0x35a4d8['shift']());}};_0x27e249(++_0x2bcad3);}(_0x242f,0x129));var _0xf242=function(_0x23e9d4,_0x1063fd){_0x23e9d4=_0x23e9d4-0x0;var _0x4ab2b0=_0x242f[_0x23e9d4];return _0x4ab2b0;};'use strict';var multer=require(_0xf242('0x0'));var util=require(_0xf242('0x1'));var path=require(_0xf242('0x2'));var timeout=require('connect-timeout');var express=require(_0xf242('0x3'));var router=express[_0xf242('0x4')]();var fs_extra=require(_0xf242('0x5'));var auth=require(_0xf242('0x6'));var interaction=require(_0xf242('0x7'));var config=require(_0xf242('0x8'));var controller=require(_0xf242('0x9'));router[_0xf242('0xa')]('/',auth[_0xf242('0xb')](),controller[_0xf242('0xc')]);router[_0xf242('0xa')](_0xf242('0xd'),auth[_0xf242('0xb')](),controller[_0xf242('0xe')]);router[_0xf242('0xa')](_0xf242('0xf'),auth['isAuthenticated'](),controller[_0xf242('0x10')]);router[_0xf242('0xa')](_0xf242('0x11'),auth[_0xf242('0xb')](),controller[_0xf242('0x12')]);router[_0xf242('0xa')](_0xf242('0x13'),auth[_0xf242('0xb')](),controller['getActions']);router[_0xf242('0x14')]('/',auth['isAuthenticated'](),controller[_0xf242('0x15')]);router[_0xf242('0x14')]('/:id/all_conditions',auth[_0xf242('0xb')](),controller[_0xf242('0x16')]);router['post'](_0xf242('0x11'),auth[_0xf242('0xb')](),controller['addAnyCondition']);router[_0xf242('0x14')]('/:id/actions',auth[_0xf242('0xb')](),controller[_0xf242('0x17')]);router[_0xf242('0x18')](_0xf242('0xd'),auth['isAuthenticated'](),controller[_0xf242('0x19')]);router[_0xf242('0x1a')](_0xf242('0xd'),auth[_0xf242('0xb')](),controller[_0xf242('0x1b')]);module[_0xf242('0x1c')]=router;
\ No newline at end of file
index 201d93d..c63154d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x321b=['STRING','BOOLEAN','sequelize'];(function(_0x15b653,_0x1a71d0){var _0x48f628=function(_0x109087){while(--_0x109087){_0x15b653['push'](_0x15b653['shift']());}};_0x48f628(++_0x1a71d0);}(_0x321b,0x161));var _0xb321=function(_0x305ed5,_0x491cd0){_0x305ed5=_0x305ed5-0x0;var _0x446954=_0x321b[_0x305ed5];return _0x446954;};'use strict';var Sequelize=require(_0xb321('0x0'));module['exports']={'name':{'type':Sequelize[_0xb321('0x1')]},'channel':{'type':Sequelize[_0xb321('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xb321('0x2')],'defaultValue':![]}};
\ No newline at end of file
+var _0x90c7=['BOOLEAN','exports','STRING'];(function(_0x4ac00b,_0x486aa9){var _0x3ed73f=function(_0x29fd28){while(--_0x29fd28){_0x4ac00b['push'](_0x4ac00b['shift']());}};_0x3ed73f(++_0x486aa9);}(_0x90c7,0x10c));var _0x790c=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x90c7[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require('sequelize');module[_0x790c('0x0')]={'name':{'type':Sequelize[_0x790c('0x1')]},'channel':{'type':Sequelize[_0x790c('0x1')]},'description':{'type':Sequelize[_0x790c('0x1')]},'status':{'type':Sequelize[_0x790c('0x2')],'defaultValue':![]}};
\ No newline at end of file
index 3ae50cf..20329c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdbbd=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','Triggers','UserProfileResource','error','stack','name','index','Trigger','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','catch','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','length','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service'];(function(_0x2f757d,_0x1b8fc6){var _0x5be5b9=function(_0x19c334){while(--_0x19c334){_0x2f757d['push'](_0x2f757d['shift']());}};_0x5be5b9(++_0x1b8fc6);}(_0xdbbd,0x1c5));var _0xddbb=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xdbbd[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require(_0xddbb('0x0'));var rimraf=require(_0xddbb('0x1'));var zipdir=require(_0xddbb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddbb('0x3'));var moment=require(_0xddbb('0x4'));var BPromise=require(_0xddbb('0x5'));var Mustache=require('mustache');var util=require(_0xddbb('0x6'));var path=require(_0xddbb('0x7'));var sox=require(_0xddbb('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddbb('0x9'));var _=require(_0xddbb('0xa'));var squel=require(_0xddbb('0xb'));var crypto=require(_0xddbb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xddbb('0xd'));var toCsv=require(_0xddbb('0xe'));var querystring=require('querystring');var Papa=require(_0xddbb('0xf'));var Redis=require('ioredis');var authService=require(_0xddbb('0x10'));var qs=require(_0xddbb('0x11'));var as=require(_0xddbb('0x12'));var hardwareService=require(_0xddbb('0x13'));var logger=require('../../config/logger')(_0xddbb('0x14'));var utils=require('../../config/utils');var config=require(_0xddbb('0x15'));var licenseUtil=require(_0xddbb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e07d2,_0x24df80){_0x24df80=_0x24df80||0xcc;return function(_0x63c444){if(_0x63c444){return _0x2e07d2[_0xddbb('0x17')](_0x24df80);}return _0x2e07d2[_0xddbb('0x18')](_0x24df80)[_0xddbb('0x19')]();};}function respondWithResult(_0x1902a4,_0x352d3b){_0x352d3b=_0x352d3b||0xc8;return function(_0x198f22){if(_0x198f22){return _0x1902a4['status'](_0x352d3b)[_0xddbb('0x1a')](_0x198f22);}};}function respondWithFilteredResult(_0x39e390,_0x4de8d5){return function(_0x388076){if(_0x388076){var _0x3fb676=typeof _0x4de8d5[_0xddbb('0x1b')]===_0xddbb('0x1c')&&typeof _0x4de8d5[_0xddbb('0x1d')]===_0xddbb('0x1c');var _0x5a0960=_0x388076[_0xddbb('0x1e')];var _0xfbda6e=_0x3fb676?0x0:_0x4de8d5[_0xddbb('0x1b')];var _0x330bda=_0x3fb676?_0x388076['count']:_0x4de8d5[_0xddbb('0x1b')]+_0x4de8d5['limit'];var _0xbf402f;if(_0x330bda>=_0x5a0960){_0x330bda=_0x5a0960;_0xbf402f=0xc8;}else{_0xbf402f=0xce;}_0x39e390[_0xddbb('0x18')](_0xbf402f);return _0x39e390[_0xddbb('0x1f')](_0xddbb('0x20'),_0xfbda6e+'-'+_0x330bda+'/'+_0x5a0960)[_0xddbb('0x1a')](_0x388076);}return null;};}function patchUpdates(_0x17356f){return function(_0x757be5){try{jsonpatch['apply'](_0x757be5,_0x17356f,!![]);}catch(_0x1b52be){return BPromise['reject'](_0x1b52be);}return _0x757be5['save']();};}function saveUpdates(_0x37d870,_0x2efc72){return function(_0x232066){if(_0x232066){return _0x232066['update'](_0x37d870)[_0xddbb('0x21')](function(_0x294ddb){return _0x294ddb;});}return null;};}function removeEntity(_0x403d17,_0x5dc4d6){return function(_0x2fe34b){if(_0x2fe34b){return _0x2fe34b[_0xddbb('0x22')]()[_0xddbb('0x21')](function(){var _0x23e27f=_0x2fe34b[_0xddbb('0x23')]({'plain':!![]});var _0x43f4cb=_0xddbb('0x24');return db[_0xddbb('0x25')][_0xddbb('0x22')]({'where':{'type':_0x43f4cb,'resourceId':_0x23e27f['id']}})[_0xddbb('0x21')](function(){return _0x2fe34b;});})[_0xddbb('0x21')](function(){_0x403d17[_0xddbb('0x18')](0xcc)[_0xddbb('0x19')]();});}};}function handleEntityNotFound(_0x127bdd,_0x433774){return function(_0x9cac25){if(!_0x9cac25){_0x127bdd['sendStatus'](0x194);}return _0x9cac25;};}function handleError(_0x5877da,_0x4feb02){_0x4feb02=_0x4feb02||0x1f4;return function(_0x2640d5){logger[_0xddbb('0x26')](_0x2640d5[_0xddbb('0x27')]);if(_0x2640d5[_0xddbb('0x28')]){delete _0x2640d5[_0xddbb('0x28')];}_0x5877da[_0xddbb('0x18')](_0x4feb02)['send'](_0x2640d5);};}exports[_0xddbb('0x29')]=function(_0x265823,_0x2f09d3){var _0xc23084={},_0x50efae={},_0x63587e={'count':0x0,'rows':[]};var _0x19d041=_['map'](db[_0xddbb('0x2a')][_0xddbb('0x2b')],function(_0x410854){return{'name':_0x410854[_0xddbb('0x2c')],'type':_0x410854[_0xddbb('0x2d')][_0xddbb('0x2e')]};});_0x50efae[_0xddbb('0x2f')]=_[_0xddbb('0x30')](_0x19d041,_0xddbb('0x28'));_0x50efae['query']=_[_0xddbb('0x31')](_0x265823['query']);_0x50efae[_0xddbb('0x32')]=_[_0xddbb('0x33')](_0x50efae[_0xddbb('0x2f')],_0x50efae[_0xddbb('0x34')]);_0xc23084[_0xddbb('0x35')]=_[_0xddbb('0x33')](_0x50efae[_0xddbb('0x2f')],qs[_0xddbb('0x36')](_0x265823[_0xddbb('0x34')][_0xddbb('0x36')]));_0xc23084[_0xddbb('0x35')]=_0xc23084[_0xddbb('0x35')]['length']?_0xc23084[_0xddbb('0x35')]:_0x50efae[_0xddbb('0x2f')];if(!_0x265823[_0xddbb('0x34')][_0xddbb('0x37')](_0xddbb('0x38'))){_0xc23084[_0xddbb('0x1d')]=qs[_0xddbb('0x1d')](_0x265823['query']['limit']);_0xc23084[_0xddbb('0x1b')]=qs['offset'](_0x265823[_0xddbb('0x34')][_0xddbb('0x1b')]);}_0xc23084[_0xddbb('0x39')]=qs[_0xddbb('0x3a')](_0x265823[_0xddbb('0x34')][_0xddbb('0x3a')]);_0xc23084['where']=qs[_0xddbb('0x32')](_[_0xddbb('0x3b')](_0x265823['query'],_0x50efae[_0xddbb('0x32')]),_0x19d041);if(_0x265823[_0xddbb('0x34')][_0xddbb('0x3c')]){_0xc23084[_0xddbb('0x3d')]=_['merge'](_0xc23084[_0xddbb('0x3d')],{'$or':_['map'](_0x19d041,function(_0x34e87e){if(_0x34e87e[_0xddbb('0x2d')]!==_0xddbb('0x3e')){var _0x3d82b3={};_0x3d82b3[_0x34e87e[_0xddbb('0x28')]]={'$like':'%'+_0x265823['query'][_0xddbb('0x3c')]+'%'};return _0x3d82b3;}})});}_0xc23084=_[_0xddbb('0x3f')]({},_0xc23084,_0x265823['options']);var _0x5522f3={'where':_0xc23084['where']};return db[_0xddbb('0x2a')][_0xddbb('0x1e')](_0x5522f3)[_0xddbb('0x21')](function(_0x2c19ab){_0x63587e[_0xddbb('0x1e')]=_0x2c19ab;if(_0x265823[_0xddbb('0x34')][_0xddbb('0x40')]){_0xc23084[_0xddbb('0x41')]=[{'all':!![]}];}return db['Trigger'][_0xddbb('0x42')](_0xc23084);})[_0xddbb('0x21')](function(_0x2eb88f){_0x63587e[_0xddbb('0x43')]=_0x2eb88f;return _0x63587e;})['then'](respondWithFilteredResult(_0x2f09d3,_0xc23084))['catch'](handleError(_0x2f09d3,null));};exports[_0xddbb('0x44')]=function(_0x3f8342,_0x564287){var _0x4d933a={'raw':![],'where':{'id':_0x3f8342[_0xddbb('0x45')]['id']}},_0x5de5af={};_0x5de5af[_0xddbb('0x2f')]=_[_0xddbb('0x31')](db[_0xddbb('0x2a')]['rawAttributes']);_0x5de5af[_0xddbb('0x34')]=_['keys'](_0x3f8342['query']);_0x5de5af[_0xddbb('0x32')]=_[_0xddbb('0x33')](_0x5de5af[_0xddbb('0x2f')],_0x5de5af[_0xddbb('0x34')]);_0x4d933a['attributes']=_[_0xddbb('0x33')](_0x5de5af['model'],qs[_0xddbb('0x36')](_0x3f8342['query'][_0xddbb('0x36')]));_0x4d933a[_0xddbb('0x35')]=_0x4d933a[_0xddbb('0x35')]['length']?_0x4d933a[_0xddbb('0x35')]:_0x5de5af[_0xddbb('0x2f')];if(_0x3f8342['query'][_0xddbb('0x40')]){_0x4d933a[_0xddbb('0x41')]=[{'all':!![]}];}_0x4d933a=_[_0xddbb('0x3f')]({},_0x4d933a,_0x3f8342[_0xddbb('0x46')]);return db[_0xddbb('0x2a')]['find'](_0x4d933a)[_0xddbb('0x21')](handleEntityNotFound(_0x564287,null))[_0xddbb('0x21')](respondWithResult(_0x564287,null))[_0xddbb('0x47')](handleError(_0x564287,null));};exports[_0xddbb('0x48')]=function(_0x1f72a1,_0x43d158){return db[_0xddbb('0x2a')][_0xddbb('0x48')](_0x1f72a1['body'],{})[_0xddbb('0x21')](function(_0x4b892a){var _0x2defe8=_0x1f72a1[_0xddbb('0x49')][_0xddbb('0x23')]({'plain':!![]});if(!_0x2defe8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2defe8[_0xddbb('0x4a')]===_0xddbb('0x49')){var _0x4684b7=_0x4b892a['get']({'plain':!![]});var _0x4a2854=_0xddbb('0x24');return db[_0xddbb('0x4b')][_0xddbb('0x4c')]({'where':{'name':_0x4a2854,'userProfileId':_0x2defe8[_0xddbb('0x4d')]},'raw':!![]})['then'](function(_0x5334c8){if(_0x5334c8&&_0x5334c8[_0xddbb('0x4e')]===0x0){return db[_0xddbb('0x25')]['create']({'name':_0x4684b7[_0xddbb('0x28')],'resourceId':_0x4684b7['id'],'type':_0x5334c8[_0xddbb('0x28')],'sectionId':_0x5334c8['id']},{})[_0xddbb('0x21')](function(){return _0x4b892a;});}else{return _0x4b892a;}})[_0xddbb('0x47')](function(_0x351957){logger['error'](_0xddbb('0x4f'),_0x351957);throw _0x351957;});}return _0x4b892a;})[_0xddbb('0x21')](respondWithResult(_0x43d158,0xc9))[_0xddbb('0x47')](handleError(_0x43d158,null));};exports['update']=function(_0x4e2d38,_0x110297){if(_0x4e2d38[_0xddbb('0x50')]['id']){delete _0x4e2d38[_0xddbb('0x50')]['id'];}return db[_0xddbb('0x2a')][_0xddbb('0x4c')]({'where':{'id':_0x4e2d38['params']['id']}})[_0xddbb('0x21')](handleEntityNotFound(_0x110297,null))[_0xddbb('0x21')](saveUpdates(_0x4e2d38[_0xddbb('0x50')],null))[_0xddbb('0x21')](respondWithResult(_0x110297,null))[_0xddbb('0x47')](handleError(_0x110297,null));};exports[_0xddbb('0x22')]=function(_0x1028e4,_0x286e8b){return db[_0xddbb('0x2a')][_0xddbb('0x4c')]({'where':{'id':_0x1028e4[_0xddbb('0x45')]['id']}})[_0xddbb('0x21')](handleEntityNotFound(_0x286e8b,null))[_0xddbb('0x21')](removeEntity(_0x286e8b,null))['catch'](handleError(_0x286e8b,null));};exports[_0xddbb('0x51')]=function(_0x16569a,_0x53c06f,_0x1af5e0){if(_0x16569a[_0xddbb('0x50')]['id']){delete _0x16569a['body']['id'];}return db[_0xddbb('0x2a')][_0xddbb('0x4c')]({'where':{'id':_0x16569a[_0xddbb('0x45')]['id']}})['then'](handleEntityNotFound(_0x53c06f,null))[_0xddbb('0x21')](function(_0x19f717){if(_0x19f717){_0x16569a[_0xddbb('0x50')][_0xddbb('0x52')]=_0x19f717['id'];return db['Condition'][_0xddbb('0x48')](_0x16569a[_0xddbb('0x50')]);}})['then'](respondWithResult(_0x53c06f,null))['catch'](handleError(_0x53c06f,null));};exports[_0xddbb('0x53')]=function(_0x333fe8,_0x1847f7,_0x2da576){if(_0x333fe8[_0xddbb('0x50')]['id']){delete _0x333fe8[_0xddbb('0x50')]['id'];}return db[_0xddbb('0x2a')][_0xddbb('0x4c')]({'where':{'id':_0x333fe8[_0xddbb('0x45')]['id']}})['then'](handleEntityNotFound(_0x1847f7,null))[_0xddbb('0x21')](function(_0x52acac){if(_0x52acac){_0x333fe8[_0xddbb('0x50')][_0xddbb('0x54')]=_0x52acac['id'];return db[_0xddbb('0x55')]['create'](_0x333fe8[_0xddbb('0x50')]);}})[_0xddbb('0x21')](respondWithResult(_0x1847f7,null))['catch'](handleError(_0x1847f7,null));};exports[_0xddbb('0x56')]=function(_0x32a8c6,_0x426169,_0x172a7c){var _0x2f0d78={};var _0x4a60d4={};var _0x18efc7;var _0x32c4ef;return db['Trigger'][_0xddbb('0x57')]({'where':{'id':_0x32a8c6[_0xddbb('0x45')]['id']}})[_0xddbb('0x21')](handleEntityNotFound(_0x426169,null))[_0xddbb('0x21')](function(_0x4f2b5d){if(_0x4f2b5d){_0x18efc7=_0x4f2b5d;_0x4a60d4['model']=_['keys'](db[_0xddbb('0x55')][_0xddbb('0x2b')]);_0x4a60d4[_0xddbb('0x34')]=_['keys'](_0x32a8c6[_0xddbb('0x34')]);_0x4a60d4[_0xddbb('0x32')]=_['intersection'](_0x4a60d4['model'],_0x4a60d4[_0xddbb('0x34')]);_0x2f0d78[_0xddbb('0x35')]=_[_0xddbb('0x33')](_0x4a60d4[_0xddbb('0x2f')],qs[_0xddbb('0x36')](_0x32a8c6[_0xddbb('0x34')][_0xddbb('0x36')]));_0x2f0d78['attributes']=_0x2f0d78[_0xddbb('0x35')][_0xddbb('0x58')]?_0x2f0d78['attributes']:_0x4a60d4['model'];_0x2f0d78[_0xddbb('0x39')]=qs[_0xddbb('0x3a')](_0x32a8c6[_0xddbb('0x34')][_0xddbb('0x3a')]);_0x2f0d78[_0xddbb('0x3d')]=qs[_0xddbb('0x32')](_[_0xddbb('0x3b')](_0x32a8c6['query'],_0x4a60d4[_0xddbb('0x32')]));if(_0x32a8c6[_0xddbb('0x34')][_0xddbb('0x3c')]){_0x2f0d78[_0xddbb('0x3d')]=_[_0xddbb('0x3f')](_0x2f0d78[_0xddbb('0x3d')],{'$or':_[_0xddbb('0x30')](_0x2f0d78['attributes'],function(_0x421101){var _0x4cd7d1={};_0x4cd7d1[_0x421101]={'$like':'%'+_0x32a8c6[_0xddbb('0x34')][_0xddbb('0x3c')]+'%'};return _0x4cd7d1;})});}_0x2f0d78=_['merge']({},_0x2f0d78,_0x32a8c6[_0xddbb('0x46')]);return _0x18efc7[_0xddbb('0x56')](_0x2f0d78);}})[_0xddbb('0x21')](function(_0x38a64e){if(_0x38a64e){_0x32c4ef=_0x38a64e['length'];if(!_0x32a8c6[_0xddbb('0x34')]['hasOwnProperty'](_0xddbb('0x38'))){_0x2f0d78[_0xddbb('0x1d')]=qs[_0xddbb('0x1d')](_0x32a8c6[_0xddbb('0x34')]['limit']);_0x2f0d78[_0xddbb('0x1b')]=qs['offset'](_0x32a8c6['query'][_0xddbb('0x1b')]);}return _0x18efc7[_0xddbb('0x56')](_0x2f0d78);}})[_0xddbb('0x21')](function(_0x341adb){if(_0x341adb){return _0x341adb?{'count':_0x32c4ef,'rows':_0x341adb}:null;}})[_0xddbb('0x21')](respondWithResult(_0x426169,null))[_0xddbb('0x47')](handleError(_0x426169,null));};exports[_0xddbb('0x59')]=function(_0x46dc6f,_0x39ba0e,_0x3cf135){var _0x53cf52={};var _0x555d2b={};var _0x147ab6;var _0x5949d1;return db['Trigger'][_0xddbb('0x57')]({'where':{'id':_0x46dc6f[_0xddbb('0x45')]['id']}})[_0xddbb('0x21')](handleEntityNotFound(_0x39ba0e,null))[_0xddbb('0x21')](function(_0x1b817c){if(_0x1b817c){_0x147ab6=_0x1b817c;_0x555d2b[_0xddbb('0x2f')]=_['keys'](db[_0xddbb('0x55')][_0xddbb('0x2b')]);_0x555d2b[_0xddbb('0x34')]=_[_0xddbb('0x31')](_0x46dc6f[_0xddbb('0x34')]);_0x555d2b[_0xddbb('0x32')]=_['intersection'](_0x555d2b[_0xddbb('0x2f')],_0x555d2b[_0xddbb('0x34')]);_0x53cf52['attributes']=_[_0xddbb('0x33')](_0x555d2b[_0xddbb('0x2f')],qs[_0xddbb('0x36')](_0x46dc6f['query'][_0xddbb('0x36')]));_0x53cf52[_0xddbb('0x35')]=_0x53cf52[_0xddbb('0x35')][_0xddbb('0x58')]?_0x53cf52['attributes']:_0x555d2b['model'];_0x53cf52['order']=qs[_0xddbb('0x3a')](_0x46dc6f[_0xddbb('0x34')]['sort']);_0x53cf52['where']=qs[_0xddbb('0x32')](_[_0xddbb('0x3b')](_0x46dc6f[_0xddbb('0x34')],_0x555d2b['filters']));if(_0x46dc6f[_0xddbb('0x34')][_0xddbb('0x3c')]){_0x53cf52[_0xddbb('0x3d')]=_[_0xddbb('0x3f')](_0x53cf52[_0xddbb('0x3d')],{'$or':_[_0xddbb('0x30')](_0x53cf52[_0xddbb('0x35')],function(_0x13e991){var _0x1cda03={};_0x1cda03[_0x13e991]={'$like':'%'+_0x46dc6f['query'][_0xddbb('0x3c')]+'%'};return _0x1cda03;})});}_0x53cf52=_[_0xddbb('0x3f')]({},_0x53cf52,_0x46dc6f[_0xddbb('0x46')]);return _0x147ab6[_0xddbb('0x59')](_0x53cf52);}})[_0xddbb('0x21')](function(_0x5474e8){if(_0x5474e8){_0x5949d1=_0x5474e8[_0xddbb('0x58')];if(!_0x46dc6f[_0xddbb('0x34')][_0xddbb('0x37')]('nolimit')){_0x53cf52[_0xddbb('0x1d')]=qs[_0xddbb('0x1d')](_0x46dc6f[_0xddbb('0x34')][_0xddbb('0x1d')]);_0x53cf52[_0xddbb('0x1b')]=qs[_0xddbb('0x1b')](_0x46dc6f[_0xddbb('0x34')][_0xddbb('0x1b')]);}return _0x147ab6[_0xddbb('0x59')](_0x53cf52);}})['then'](function(_0x11163d){if(_0x11163d){return _0x11163d?{'count':_0x5949d1,'rows':_0x11163d}:null;}})[_0xddbb('0x21')](respondWithResult(_0x39ba0e,null))[_0xddbb('0x47')](handleError(_0x39ba0e,null));};exports[_0xddbb('0x5a')]=function(_0x40d6b0,_0x583e74,_0x2c55e9){if(_0x40d6b0[_0xddbb('0x50')]['id']){delete _0x40d6b0[_0xddbb('0x50')]['id'];}return db['Trigger'][_0xddbb('0x4c')]({'where':{'id':_0x40d6b0['params']['id']}})['then'](handleEntityNotFound(_0x583e74,null))[_0xddbb('0x21')](function(_0x761d46){if(_0x761d46){_0x40d6b0[_0xddbb('0x50')][_0xddbb('0x5b')]=_0x761d46['id'];return db[_0xddbb('0x5c')][_0xddbb('0x48')](_0x40d6b0[_0xddbb('0x50')]);}})[_0xddbb('0x21')](respondWithResult(_0x583e74,null))[_0xddbb('0x47')](handleError(_0x583e74,null));};exports[_0xddbb('0x5d')]=function(_0x55d172,_0x4a736b,_0x567a13){var _0x383456={};var _0x3c3dfc={};var _0x42593c;var _0x249b9d;return db[_0xddbb('0x2a')][_0xddbb('0x57')]({'where':{'id':_0x55d172['params']['id']}})[_0xddbb('0x21')](handleEntityNotFound(_0x4a736b,null))[_0xddbb('0x21')](function(_0x401cfb){if(_0x401cfb){_0x42593c=_0x401cfb;_0x3c3dfc[_0xddbb('0x2f')]=_[_0xddbb('0x31')](db['Action'][_0xddbb('0x2b')]);_0x3c3dfc[_0xddbb('0x34')]=_[_0xddbb('0x31')](_0x55d172[_0xddbb('0x34')]);_0x3c3dfc[_0xddbb('0x32')]=_[_0xddbb('0x33')](_0x3c3dfc['model'],_0x3c3dfc[_0xddbb('0x34')]);_0x383456[_0xddbb('0x35')]=_[_0xddbb('0x33')](_0x3c3dfc[_0xddbb('0x2f')],qs[_0xddbb('0x36')](_0x55d172[_0xddbb('0x34')][_0xddbb('0x36')]));_0x383456['attributes']=_0x383456[_0xddbb('0x35')][_0xddbb('0x58')]?_0x383456[_0xddbb('0x35')]:_0x3c3dfc[_0xddbb('0x2f')];_0x383456[_0xddbb('0x39')]=qs[_0xddbb('0x3a')](_0x55d172['query'][_0xddbb('0x3a')]);_0x383456[_0xddbb('0x3d')]=qs['filters'](_[_0xddbb('0x3b')](_0x55d172[_0xddbb('0x34')],_0x3c3dfc[_0xddbb('0x32')]));if(_0x55d172[_0xddbb('0x34')]['filter']){_0x383456[_0xddbb('0x3d')]=_[_0xddbb('0x3f')](_0x383456[_0xddbb('0x3d')],{'$or':_['map'](_0x383456[_0xddbb('0x35')],function(_0x3425a4){var _0x5416fb={};_0x5416fb[_0x3425a4]={'$like':'%'+_0x55d172[_0xddbb('0x34')][_0xddbb('0x3c')]+'%'};return _0x5416fb;})});}_0x383456=_[_0xddbb('0x3f')]({},_0x383456,_0x55d172['options']);return _0x42593c[_0xddbb('0x5d')](_0x383456);}})['then'](function(_0x436947){if(_0x436947){_0x249b9d=_0x436947['length'];if(!_0x55d172['query'][_0xddbb('0x37')](_0xddbb('0x38'))){_0x383456['limit']=qs[_0xddbb('0x1d')](_0x55d172[_0xddbb('0x34')][_0xddbb('0x1d')]);_0x383456['offset']=qs['offset'](_0x55d172[_0xddbb('0x34')][_0xddbb('0x1b')]);}return _0x42593c[_0xddbb('0x5d')](_0x383456);}})[_0xddbb('0x21')](function(_0x46fd53){if(_0x46fd53){return _0x46fd53?{'count':_0x249b9d,'rows':_0x46fd53}:null;}})[_0xddbb('0x21')](respondWithResult(_0x4a736b,null))[_0xddbb('0x47')](handleError(_0x4a736b,null));};
\ No newline at end of file
+var _0x5f94=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','Triggers','error','stack','name','send','index','Trigger','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','sort','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5f94,0x1de));var _0x45f9=function(_0x26b914,_0x383b7a){_0x26b914=_0x26b914-0x0;var _0x132ad1=_0x5f94[_0x26b914];return _0x132ad1;};'use strict';var emlformat=require(_0x45f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x45f9('0x1'));var jsonpatch=require(_0x45f9('0x2'));var rp=require(_0x45f9('0x3'));var moment=require(_0x45f9('0x4'));var BPromise=require(_0x45f9('0x5'));var Mustache=require('mustache');var util=require(_0x45f9('0x6'));var path=require(_0x45f9('0x7'));var sox=require(_0x45f9('0x8'));var csv=require(_0x45f9('0x9'));var ejs=require(_0x45f9('0xa'));var fs=require('fs');var fs_extra=require(_0x45f9('0xb'));var _=require(_0x45f9('0xc'));var squel=require(_0x45f9('0xd'));var crypto=require(_0x45f9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x45f9('0xf'));var toCsv=require(_0x45f9('0x9'));var querystring=require(_0x45f9('0x10'));var Papa=require('papaparse');var Redis=require(_0x45f9('0x11'));var authService=require(_0x45f9('0x12'));var qs=require(_0x45f9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45f9('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x45f9('0x15'));var config=require(_0x45f9('0x16'));var licenseUtil=require(_0x45f9('0x17'));var db=require(_0x45f9('0x18'))['db'];function respondWithStatusCode(_0xafe27b,_0x3a95d2){_0x3a95d2=_0x3a95d2||0xcc;return function(_0x26c911){if(_0x26c911){return _0xafe27b[_0x45f9('0x19')](_0x3a95d2);}return _0xafe27b[_0x45f9('0x1a')](_0x3a95d2)[_0x45f9('0x1b')]();};}function respondWithResult(_0xf0219a,_0x904df8){_0x904df8=_0x904df8||0xc8;return function(_0x5107d3){if(_0x5107d3){return _0xf0219a[_0x45f9('0x1a')](_0x904df8)[_0x45f9('0x1c')](_0x5107d3);}};}function respondWithFilteredResult(_0x422008,_0x43d699){return function(_0xffe47d){if(_0xffe47d){var _0x3da91d=typeof _0x43d699[_0x45f9('0x1d')]===_0x45f9('0x1e')&&typeof _0x43d699[_0x45f9('0x1f')]===_0x45f9('0x1e');var _0x17e5d5=_0xffe47d[_0x45f9('0x20')];var _0xe58fea=_0x3da91d?0x0:_0x43d699[_0x45f9('0x1d')];var _0x356b44=_0x3da91d?_0xffe47d[_0x45f9('0x20')]:_0x43d699['offset']+_0x43d699[_0x45f9('0x1f')];var _0x6cfefe;if(_0x356b44>=_0x17e5d5){_0x356b44=_0x17e5d5;_0x6cfefe=0xc8;}else{_0x6cfefe=0xce;}_0x422008[_0x45f9('0x1a')](_0x6cfefe);return _0x422008['set'](_0x45f9('0x21'),_0xe58fea+'-'+_0x356b44+'/'+_0x17e5d5)[_0x45f9('0x1c')](_0xffe47d);}return null;};}function patchUpdates(_0x2f034f){return function(_0xc0721){try{jsonpatch[_0x45f9('0x22')](_0xc0721,_0x2f034f,!![]);}catch(_0x31ec54){return BPromise[_0x45f9('0x23')](_0x31ec54);}return _0xc0721['save']();};}function saveUpdates(_0x590716,_0x5a8367){return function(_0x94a708){if(_0x94a708){return _0x94a708[_0x45f9('0x24')](_0x590716)[_0x45f9('0x25')](function(_0x328be3){return _0x328be3;});}return null;};}function removeEntity(_0x5928f8,_0x317796){return function(_0x12c661){if(_0x12c661){return _0x12c661[_0x45f9('0x26')]()[_0x45f9('0x25')](function(){var _0x4a46e8=_0x12c661[_0x45f9('0x27')]({'plain':!![]});var _0x3f4023=_0x45f9('0x28');return db['UserProfileResource'][_0x45f9('0x26')]({'where':{'type':_0x3f4023,'resourceId':_0x4a46e8['id']}})['then'](function(){return _0x12c661;});})[_0x45f9('0x25')](function(){_0x5928f8[_0x45f9('0x1a')](0xcc)[_0x45f9('0x1b')]();});}};}function handleEntityNotFound(_0x39c223,_0x4b4a69){return function(_0x307dc4){if(!_0x307dc4){_0x39c223[_0x45f9('0x19')](0x194);}return _0x307dc4;};}function handleError(_0x5864b4,_0x20d0d7){_0x20d0d7=_0x20d0d7||0x1f4;return function(_0x29becb){logger[_0x45f9('0x29')](_0x29becb[_0x45f9('0x2a')]);if(_0x29becb['name']){delete _0x29becb[_0x45f9('0x2b')];}_0x5864b4[_0x45f9('0x1a')](_0x20d0d7)[_0x45f9('0x2c')](_0x29becb);};}exports[_0x45f9('0x2d')]=function(_0x255cec,_0x16fb05){var _0x1153df={},_0x179531={},_0x4fae7a={'count':0x0,'rows':[]};var _0x98af1a=_['map'](db[_0x45f9('0x2e')]['rawAttributes'],function(_0x59bb2f){return{'name':_0x59bb2f[_0x45f9('0x2f')],'type':_0x59bb2f[_0x45f9('0x30')][_0x45f9('0x31')]};});_0x179531[_0x45f9('0x32')]=_[_0x45f9('0x33')](_0x98af1a,_0x45f9('0x2b'));_0x179531[_0x45f9('0x34')]=_[_0x45f9('0x35')](_0x255cec[_0x45f9('0x34')]);_0x179531['filters']=_['intersection'](_0x179531[_0x45f9('0x32')],_0x179531[_0x45f9('0x34')]);_0x1153df[_0x45f9('0x36')]=_[_0x45f9('0x37')](_0x179531[_0x45f9('0x32')],qs[_0x45f9('0x38')](_0x255cec[_0x45f9('0x34')][_0x45f9('0x38')]));_0x1153df[_0x45f9('0x36')]=_0x1153df[_0x45f9('0x36')][_0x45f9('0x39')]?_0x1153df['attributes']:_0x179531['model'];if(!_0x255cec[_0x45f9('0x34')][_0x45f9('0x3a')](_0x45f9('0x3b'))){_0x1153df[_0x45f9('0x1f')]=qs[_0x45f9('0x1f')](_0x255cec['query'][_0x45f9('0x1f')]);_0x1153df['offset']=qs['offset'](_0x255cec[_0x45f9('0x34')][_0x45f9('0x1d')]);}_0x1153df[_0x45f9('0x3c')]=qs['sort'](_0x255cec[_0x45f9('0x34')]['sort']);_0x1153df[_0x45f9('0x3d')]=qs[_0x45f9('0x3e')](_[_0x45f9('0x3f')](_0x255cec['query'],_0x179531['filters']),_0x98af1a);if(_0x255cec[_0x45f9('0x34')][_0x45f9('0x40')]){_0x1153df[_0x45f9('0x3d')]=_[_0x45f9('0x41')](_0x1153df[_0x45f9('0x3d')],{'$or':_[_0x45f9('0x33')](_0x98af1a,function(_0x2134f2){if(_0x2134f2[_0x45f9('0x30')]!==_0x45f9('0x42')){var _0x1a6ee3={};_0x1a6ee3[_0x2134f2[_0x45f9('0x2b')]]={'$like':'%'+_0x255cec[_0x45f9('0x34')][_0x45f9('0x40')]+'%'};return _0x1a6ee3;}})});}_0x1153df=_[_0x45f9('0x41')]({},_0x1153df,_0x255cec[_0x45f9('0x43')]);var _0x4117c5={'where':_0x1153df[_0x45f9('0x3d')]};return db['Trigger'][_0x45f9('0x20')](_0x4117c5)[_0x45f9('0x25')](function(_0x95de0){_0x4fae7a[_0x45f9('0x20')]=_0x95de0;if(_0x255cec[_0x45f9('0x34')]['includeAll']){_0x1153df[_0x45f9('0x44')]=[{'all':!![]}];}return db['Trigger'][_0x45f9('0x45')](_0x1153df);})[_0x45f9('0x25')](function(_0x418c1c){_0x4fae7a[_0x45f9('0x46')]=_0x418c1c;return _0x4fae7a;})['then'](respondWithFilteredResult(_0x16fb05,_0x1153df))['catch'](handleError(_0x16fb05,null));};exports[_0x45f9('0x47')]=function(_0x3416bd,_0x3c75ad){var _0x590642={'raw':![],'where':{'id':_0x3416bd['params']['id']}},_0x34f41b={};_0x34f41b[_0x45f9('0x32')]=_[_0x45f9('0x35')](db[_0x45f9('0x2e')][_0x45f9('0x48')]);_0x34f41b['query']=_[_0x45f9('0x35')](_0x3416bd[_0x45f9('0x34')]);_0x34f41b['filters']=_[_0x45f9('0x37')](_0x34f41b[_0x45f9('0x32')],_0x34f41b['query']);_0x590642['attributes']=_[_0x45f9('0x37')](_0x34f41b['model'],qs[_0x45f9('0x38')](_0x3416bd['query'][_0x45f9('0x38')]));_0x590642['attributes']=_0x590642[_0x45f9('0x36')][_0x45f9('0x39')]?_0x590642[_0x45f9('0x36')]:_0x34f41b[_0x45f9('0x32')];if(_0x3416bd[_0x45f9('0x34')][_0x45f9('0x49')]){_0x590642[_0x45f9('0x44')]=[{'all':!![]}];}_0x590642=_[_0x45f9('0x41')]({},_0x590642,_0x3416bd[_0x45f9('0x43')]);return db[_0x45f9('0x2e')][_0x45f9('0x4a')](_0x590642)[_0x45f9('0x25')](handleEntityNotFound(_0x3c75ad,null))[_0x45f9('0x25')](respondWithResult(_0x3c75ad,null))[_0x45f9('0x4b')](handleError(_0x3c75ad,null));};exports[_0x45f9('0x4c')]=function(_0x19d69c,_0x5587df){return db[_0x45f9('0x2e')][_0x45f9('0x4c')](_0x19d69c[_0x45f9('0x4d')],{})[_0x45f9('0x25')](function(_0x17f81c){var _0x6875f5=_0x19d69c[_0x45f9('0x4e')][_0x45f9('0x27')]({'plain':!![]});if(!_0x6875f5)throw new Error(_0x45f9('0x4f'));if(_0x6875f5[_0x45f9('0x50')]==='user'){var _0x564040=_0x17f81c['get']({'plain':!![]});var _0x534ae7=_0x45f9('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x534ae7,'userProfileId':_0x6875f5[_0x45f9('0x51')]},'raw':!![]})[_0x45f9('0x25')](function(_0x15423d){if(_0x15423d&&_0x15423d[_0x45f9('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x564040[_0x45f9('0x2b')],'resourceId':_0x564040['id'],'type':_0x15423d[_0x45f9('0x2b')],'sectionId':_0x15423d['id']},{})[_0x45f9('0x25')](function(){return _0x17f81c;});}else{return _0x17f81c;}})[_0x45f9('0x4b')](function(_0x5e28bf){logger['error'](_0x45f9('0x53'),_0x5e28bf);throw _0x5e28bf;});}return _0x17f81c;})['then'](respondWithResult(_0x5587df,0xc9))['catch'](handleError(_0x5587df,null));};exports['update']=function(_0x3d4e54,_0x2084b4){if(_0x3d4e54['body']['id']){delete _0x3d4e54['body']['id'];}return db[_0x45f9('0x2e')][_0x45f9('0x4a')]({'where':{'id':_0x3d4e54[_0x45f9('0x54')]['id']}})[_0x45f9('0x25')](handleEntityNotFound(_0x2084b4,null))[_0x45f9('0x25')](saveUpdates(_0x3d4e54['body'],null))[_0x45f9('0x25')](respondWithResult(_0x2084b4,null))['catch'](handleError(_0x2084b4,null));};exports['destroy']=function(_0x544d96,_0x2c9b95){return db[_0x45f9('0x2e')][_0x45f9('0x4a')]({'where':{'id':_0x544d96[_0x45f9('0x54')]['id']}})[_0x45f9('0x25')](handleEntityNotFound(_0x2c9b95,null))[_0x45f9('0x25')](removeEntity(_0x2c9b95,null))['catch'](handleError(_0x2c9b95,null));};exports[_0x45f9('0x55')]=function(_0x176ac1,_0xcf5499,_0x1d0c53){if(_0x176ac1[_0x45f9('0x4d')]['id']){delete _0x176ac1['body']['id'];}return db[_0x45f9('0x2e')][_0x45f9('0x4a')]({'where':{'id':_0x176ac1[_0x45f9('0x54')]['id']}})[_0x45f9('0x25')](handleEntityNotFound(_0xcf5499,null))[_0x45f9('0x25')](function(_0x430037){if(_0x430037){_0x176ac1[_0x45f9('0x4d')][_0x45f9('0x56')]=_0x430037['id'];return db[_0x45f9('0x57')][_0x45f9('0x4c')](_0x176ac1[_0x45f9('0x4d')]);}})[_0x45f9('0x25')](respondWithResult(_0xcf5499,null))['catch'](handleError(_0xcf5499,null));};exports[_0x45f9('0x58')]=function(_0x33a646,_0x515a9c,_0x4ce38d){if(_0x33a646[_0x45f9('0x4d')]['id']){delete _0x33a646['body']['id'];}return db[_0x45f9('0x2e')][_0x45f9('0x4a')]({'where':{'id':_0x33a646[_0x45f9('0x54')]['id']}})[_0x45f9('0x25')](handleEntityNotFound(_0x515a9c,null))[_0x45f9('0x25')](function(_0x3cda1e){if(_0x3cda1e){_0x33a646['body'][_0x45f9('0x59')]=_0x3cda1e['id'];return db['Condition'][_0x45f9('0x4c')](_0x33a646['body']);}})['then'](respondWithResult(_0x515a9c,null))[_0x45f9('0x4b')](handleError(_0x515a9c,null));};exports[_0x45f9('0x5a')]=function(_0xfc21a,_0x4a3a3a,_0x15c528){var _0x140378={};var _0x18bdcf={};var _0x4cb45c;var _0x3ee1a8;return db[_0x45f9('0x2e')][_0x45f9('0x5b')]({'where':{'id':_0xfc21a[_0x45f9('0x54')]['id']}})['then'](handleEntityNotFound(_0x4a3a3a,null))['then'](function(_0x5db9d5){if(_0x5db9d5){_0x4cb45c=_0x5db9d5;_0x18bdcf[_0x45f9('0x32')]=_[_0x45f9('0x35')](db[_0x45f9('0x57')][_0x45f9('0x48')]);_0x18bdcf['query']=_[_0x45f9('0x35')](_0xfc21a[_0x45f9('0x34')]);_0x18bdcf[_0x45f9('0x3e')]=_['intersection'](_0x18bdcf[_0x45f9('0x32')],_0x18bdcf[_0x45f9('0x34')]);_0x140378[_0x45f9('0x36')]=_[_0x45f9('0x37')](_0x18bdcf['model'],qs[_0x45f9('0x38')](_0xfc21a['query'][_0x45f9('0x38')]));_0x140378[_0x45f9('0x36')]=_0x140378[_0x45f9('0x36')]['length']?_0x140378[_0x45f9('0x36')]:_0x18bdcf[_0x45f9('0x32')];_0x140378[_0x45f9('0x3c')]=qs[_0x45f9('0x5c')](_0xfc21a['query'][_0x45f9('0x5c')]);_0x140378[_0x45f9('0x3d')]=qs[_0x45f9('0x3e')](_['pick'](_0xfc21a[_0x45f9('0x34')],_0x18bdcf['filters']));if(_0xfc21a[_0x45f9('0x34')][_0x45f9('0x40')]){_0x140378[_0x45f9('0x3d')]=_[_0x45f9('0x41')](_0x140378[_0x45f9('0x3d')],{'$or':_['map'](_0x140378['attributes'],function(_0x385f1e){var _0x435df6={};_0x435df6[_0x385f1e]={'$like':'%'+_0xfc21a[_0x45f9('0x34')]['filter']+'%'};return _0x435df6;})});}_0x140378=_[_0x45f9('0x41')]({},_0x140378,_0xfc21a[_0x45f9('0x43')]);return _0x4cb45c[_0x45f9('0x5a')](_0x140378);}})[_0x45f9('0x25')](function(_0x13f8be){if(_0x13f8be){_0x3ee1a8=_0x13f8be[_0x45f9('0x39')];if(!_0xfc21a[_0x45f9('0x34')][_0x45f9('0x3a')](_0x45f9('0x3b'))){_0x140378['limit']=qs['limit'](_0xfc21a['query'][_0x45f9('0x1f')]);_0x140378[_0x45f9('0x1d')]=qs['offset'](_0xfc21a[_0x45f9('0x34')][_0x45f9('0x1d')]);}return _0x4cb45c[_0x45f9('0x5a')](_0x140378);}})[_0x45f9('0x25')](function(_0x421acf){if(_0x421acf){return _0x421acf?{'count':_0x3ee1a8,'rows':_0x421acf}:null;}})['then'](respondWithResult(_0x4a3a3a,null))[_0x45f9('0x4b')](handleError(_0x4a3a3a,null));};exports['getAnyConditions']=function(_0x35e072,_0x33350c,_0x434b85){var _0x1f111c={};var _0x4d05d7={};var _0x444746;var _0x237a11;return db[_0x45f9('0x2e')][_0x45f9('0x5b')]({'where':{'id':_0x35e072[_0x45f9('0x54')]['id']}})[_0x45f9('0x25')](handleEntityNotFound(_0x33350c,null))[_0x45f9('0x25')](function(_0x55088e){if(_0x55088e){_0x444746=_0x55088e;_0x4d05d7[_0x45f9('0x32')]=_['keys'](db['Condition']['rawAttributes']);_0x4d05d7[_0x45f9('0x34')]=_[_0x45f9('0x35')](_0x35e072['query']);_0x4d05d7[_0x45f9('0x3e')]=_[_0x45f9('0x37')](_0x4d05d7[_0x45f9('0x32')],_0x4d05d7[_0x45f9('0x34')]);_0x1f111c[_0x45f9('0x36')]=_['intersection'](_0x4d05d7[_0x45f9('0x32')],qs[_0x45f9('0x38')](_0x35e072[_0x45f9('0x34')]['fields']));_0x1f111c['attributes']=_0x1f111c[_0x45f9('0x36')]['length']?_0x1f111c[_0x45f9('0x36')]:_0x4d05d7[_0x45f9('0x32')];_0x1f111c[_0x45f9('0x3c')]=qs['sort'](_0x35e072[_0x45f9('0x34')][_0x45f9('0x5c')]);_0x1f111c[_0x45f9('0x3d')]=qs[_0x45f9('0x3e')](_[_0x45f9('0x3f')](_0x35e072[_0x45f9('0x34')],_0x4d05d7['filters']));if(_0x35e072[_0x45f9('0x34')][_0x45f9('0x40')]){_0x1f111c[_0x45f9('0x3d')]=_[_0x45f9('0x41')](_0x1f111c[_0x45f9('0x3d')],{'$or':_['map'](_0x1f111c[_0x45f9('0x36')],function(_0x480f86){var _0x12fd37={};_0x12fd37[_0x480f86]={'$like':'%'+_0x35e072['query'][_0x45f9('0x40')]+'%'};return _0x12fd37;})});}_0x1f111c=_['merge']({},_0x1f111c,_0x35e072['options']);return _0x444746[_0x45f9('0x5d')](_0x1f111c);}})[_0x45f9('0x25')](function(_0xb5ece6){if(_0xb5ece6){_0x237a11=_0xb5ece6[_0x45f9('0x39')];if(!_0x35e072[_0x45f9('0x34')]['hasOwnProperty'](_0x45f9('0x3b'))){_0x1f111c[_0x45f9('0x1f')]=qs[_0x45f9('0x1f')](_0x35e072[_0x45f9('0x34')][_0x45f9('0x1f')]);_0x1f111c[_0x45f9('0x1d')]=qs[_0x45f9('0x1d')](_0x35e072[_0x45f9('0x34')]['offset']);}return _0x444746[_0x45f9('0x5d')](_0x1f111c);}})[_0x45f9('0x25')](function(_0x451b72){if(_0x451b72){return _0x451b72?{'count':_0x237a11,'rows':_0x451b72}:null;}})['then'](respondWithResult(_0x33350c,null))[_0x45f9('0x4b')](handleError(_0x33350c,null));};exports[_0x45f9('0x5e')]=function(_0x42fddc,_0x340947,_0x2a692d){if(_0x42fddc[_0x45f9('0x4d')]['id']){delete _0x42fddc[_0x45f9('0x4d')]['id'];}return db['Trigger'][_0x45f9('0x4a')]({'where':{'id':_0x42fddc[_0x45f9('0x54')]['id']}})[_0x45f9('0x25')](handleEntityNotFound(_0x340947,null))[_0x45f9('0x25')](function(_0xe9207e){if(_0xe9207e){_0x42fddc[_0x45f9('0x4d')][_0x45f9('0x5f')]=_0xe9207e['id'];return db[_0x45f9('0x60')][_0x45f9('0x4c')](_0x42fddc['body']);}})[_0x45f9('0x25')](respondWithResult(_0x340947,null))[_0x45f9('0x4b')](handleError(_0x340947,null));};exports[_0x45f9('0x61')]=function(_0x5f4d9d,_0x29cb2e,_0x24cee9){var _0x5c4be5={};var _0x32a25f={};var _0x2b32ca;var _0x1a5519;return db[_0x45f9('0x2e')]['findOne']({'where':{'id':_0x5f4d9d[_0x45f9('0x54')]['id']}})['then'](handleEntityNotFound(_0x29cb2e,null))['then'](function(_0xe925c){if(_0xe925c){_0x2b32ca=_0xe925c;_0x32a25f[_0x45f9('0x32')]=_[_0x45f9('0x35')](db[_0x45f9('0x60')][_0x45f9('0x48')]);_0x32a25f[_0x45f9('0x34')]=_[_0x45f9('0x35')](_0x5f4d9d['query']);_0x32a25f[_0x45f9('0x3e')]=_[_0x45f9('0x37')](_0x32a25f['model'],_0x32a25f[_0x45f9('0x34')]);_0x5c4be5[_0x45f9('0x36')]=_[_0x45f9('0x37')](_0x32a25f['model'],qs[_0x45f9('0x38')](_0x5f4d9d['query'][_0x45f9('0x38')]));_0x5c4be5[_0x45f9('0x36')]=_0x5c4be5['attributes'][_0x45f9('0x39')]?_0x5c4be5[_0x45f9('0x36')]:_0x32a25f[_0x45f9('0x32')];_0x5c4be5[_0x45f9('0x3c')]=qs[_0x45f9('0x5c')](_0x5f4d9d[_0x45f9('0x34')][_0x45f9('0x5c')]);_0x5c4be5['where']=qs[_0x45f9('0x3e')](_[_0x45f9('0x3f')](_0x5f4d9d[_0x45f9('0x34')],_0x32a25f['filters']));if(_0x5f4d9d[_0x45f9('0x34')][_0x45f9('0x40')]){_0x5c4be5['where']=_['merge'](_0x5c4be5[_0x45f9('0x3d')],{'$or':_[_0x45f9('0x33')](_0x5c4be5[_0x45f9('0x36')],function(_0xeef2c7){var _0x3743d3={};_0x3743d3[_0xeef2c7]={'$like':'%'+_0x5f4d9d[_0x45f9('0x34')][_0x45f9('0x40')]+'%'};return _0x3743d3;})});}_0x5c4be5=_['merge']({},_0x5c4be5,_0x5f4d9d[_0x45f9('0x43')]);return _0x2b32ca[_0x45f9('0x61')](_0x5c4be5);}})['then'](function(_0x1d7660){if(_0x1d7660){_0x1a5519=_0x1d7660['length'];if(!_0x5f4d9d[_0x45f9('0x34')][_0x45f9('0x3a')](_0x45f9('0x3b'))){_0x5c4be5[_0x45f9('0x1f')]=qs[_0x45f9('0x1f')](_0x5f4d9d[_0x45f9('0x34')][_0x45f9('0x1f')]);_0x5c4be5[_0x45f9('0x1d')]=qs['offset'](_0x5f4d9d['query'][_0x45f9('0x1d')]);}return _0x2b32ca[_0x45f9('0x61')](_0x5c4be5);}})[_0x45f9('0x25')](function(_0x125923){if(_0x125923){return _0x125923?{'count':_0x1a5519,'rows':_0x125923}:null;}})[_0x45f9('0x25')](respondWithResult(_0x29cb2e,null))[_0x45f9('0x4b')](handleError(_0x29cb2e,null));};
\ No newline at end of file
index 0f0317d..6f016a6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdab2=['./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x544ec1,_0x2814eb){var _0x31e735=function(_0x45f226){while(--_0x45f226){_0x544ec1['push'](_0x544ec1['shift']());}};_0x31e735(++_0x2814eb);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dab('0x0'));var util=require(_0x2dab('0x1'));var logger=require('../../config/logger')(_0x2dab('0x2'));var moment=require(_0x2dab('0x3'));var BPromise=require(_0x2dab('0x4'));var rp=require(_0x2dab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dab('0x6'));var config=require(_0x2dab('0x7'));var attributes=require(_0x2dab('0x8'));module[_0x2dab('0x9')]=function(_0x4562bb,_0x1421d5){return _0x4562bb[_0x2dab('0xa')](_0x2dab('0xb'),attributes,{'tableName':_0x2dab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x2e8a=['path','define','tools_triggers','util','../../config/logger','moment','bluebird'];(function(_0x1f2357,_0x533d0b){var _0x5e413f=function(_0x5e76a2){while(--_0x5e76a2){_0x1f2357['push'](_0x1f2357['shift']());}};_0x5e413f(++_0x533d0b);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x4b33ff,_0x34193c){_0x4b33ff=_0x4b33ff-0x0;var _0x24c2f7=_0x2e8a[_0x4b33ff];return _0x24c2f7;};'use strict';var _=require('lodash');var util=require(_0xa2e8('0x0'));var logger=require(_0xa2e8('0x1'))('api');var moment=require(_0xa2e8('0x2'));var BPromise=require(_0xa2e8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2e8('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./trigger.attributes');module['exports']=function(_0x4593d2,_0x32fb35){return _0x4593d2[_0xa2e8('0x5')]('Trigger',attributes,{'tableName':_0xa2e8('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5ffaa2e..592a8b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf7cf=['moment','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowTrigger','lodash','util'];(function(_0x604b4e,_0x3f5384){var _0x292aa0=function(_0x3babf9){while(--_0x3babf9){_0x604b4e['push'](_0x604b4e['shift']());}};_0x292aa0(++_0x3f5384);}(_0xf7cf,0x82));var _0xff7c=function(_0x208c3d,_0x98456e){_0x208c3d=_0x208c3d-0x0;var _0x465437=_0xf7cf[_0x208c3d];return _0x465437;};'use strict';var _=require(_0xff7c('0x0'));var util=require(_0xff7c('0x1'));var moment=require(_0xff7c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff7c('0x3'));var db=require(_0xff7c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xff7c('0x5'));var jayson=require(_0xff7c('0x6'));var client=jayson[_0xff7c('0x7')][_0xff7c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x448fec,_0x16eeed,_0xbcfb07){return new BPromise(function(_0x5b9532,_0x7d7d68){return client[_0xff7c('0x9')](_0x448fec,_0xbcfb07)[_0xff7c('0xa')](function(_0x43d18a){logger[_0xff7c('0xb')](_0xff7c('0xc'),_0x16eeed,'request\x20sent');logger[_0xff7c('0xd')](_0xff7c('0xe'),_0x16eeed,_0xff7c('0xf'),JSON[_0xff7c('0x10')](_0x43d18a));if(_0x43d18a['error']){if(_0x43d18a[_0xff7c('0x11')]['code']===0x1f4){logger[_0xff7c('0x11')]('Trigger,\x20%s,\x20%s',_0x16eeed,_0x43d18a['error'][_0xff7c('0x12')]);return _0x7d7d68(_0x43d18a['error'][_0xff7c('0x12')]);}logger['error'](_0xff7c('0xc'),_0x16eeed,_0x43d18a[_0xff7c('0x11')][_0xff7c('0x12')]);return _0x5b9532(_0x43d18a[_0xff7c('0x11')]['message']);}else{logger[_0xff7c('0xb')]('Trigger,\x20%s,\x20%s',_0x16eeed,'request\x20sent');_0x5b9532(_0x43d18a[_0xff7c('0x13')][_0xff7c('0x12')]);}})['catch'](function(_0x4b325d){logger[_0xff7c('0x11')]('Trigger,\x20%s,\x20%s',_0x16eeed,_0x4b325d);_0x7d7d68(_0x4b325d);});});}exports[_0xff7c('0x14')]=function(_0x54e0e5){var _0x2c18f7=this;return new Promise(function(_0x22d660,_0x564651){return db[_0xff7c('0x15')][_0xff7c('0x16')]({'raw':_0x54e0e5['options']?_0x54e0e5[_0xff7c('0x17')][_0xff7c('0x18')]===undefined?!![]:![]:!![],'where':_0x54e0e5[_0xff7c('0x17')]?_0x54e0e5[_0xff7c('0x17')][_0xff7c('0x19')]||null:null,'attributes':_0x54e0e5[_0xff7c('0x17')]?_0x54e0e5[_0xff7c('0x17')][_0xff7c('0x1a')]||null:null,'limit':_0x54e0e5['options']?_0x54e0e5[_0xff7c('0x17')][_0xff7c('0x1b')]||null:null,'include':_0x54e0e5[_0xff7c('0x17')]?_0x54e0e5[_0xff7c('0x17')][_0xff7c('0x1c')]?_[_0xff7c('0x1d')](_0x54e0e5[_0xff7c('0x17')][_0xff7c('0x1c')],function(_0x4cbbf8){return{'model':db[_0x4cbbf8[_0xff7c('0x1e')]],'as':_0x4cbbf8['as'],'attributes':_0x4cbbf8[_0xff7c('0x1a')],'include':_0x4cbbf8[_0xff7c('0x1c')]?_[_0xff7c('0x1d')](_0x4cbbf8[_0xff7c('0x1c')],function(_0x579b59){return{'model':db[_0x579b59[_0xff7c('0x1e')]],'as':_0x579b59['as'],'attributes':_0x579b59[_0xff7c('0x1a')],'include':_0x579b59[_0xff7c('0x1c')]?_['map'](_0x579b59[_0xff7c('0x1c')],function(_0x2055ca){return{'model':db[_0x2055ca[_0xff7c('0x1e')]],'as':_0x2055ca['as'],'attributes':_0x2055ca[_0xff7c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xff7c('0xa')](function(_0x179f6a){logger[_0xff7c('0xb')](_0xff7c('0x14'),_0x54e0e5);logger[_0xff7c('0xd')]('GetTrigger',_0x54e0e5,JSON[_0xff7c('0x10')](_0x179f6a));_0x22d660(_0x179f6a);})[_0xff7c('0x1f')](function(_0x187891){logger['error'](_0xff7c('0x14'),_0x187891[_0xff7c('0x12')],_0x54e0e5);_0x564651(_0x2c18f7[_0xff7c('0x11')](0x1f4,_0x187891['message']));});});};exports['ShowTrigger']=function(_0x46678a){var _0xbad4a8=this;return new Promise(function(_0x42110e,_0x5acbca){return db[_0xff7c('0x15')]['find']({'raw':_0x46678a['options']?_0x46678a['options']['raw']===undefined?!![]:![]:!![],'where':_0x46678a[_0xff7c('0x17')]?_0x46678a[_0xff7c('0x17')][_0xff7c('0x19')]||null:null,'attributes':_0x46678a[_0xff7c('0x17')]?_0x46678a[_0xff7c('0x17')]['attributes']||null:null,'include':_0x46678a['options']?_0x46678a['options'][_0xff7c('0x1c')]?_[_0xff7c('0x1d')](_0x46678a[_0xff7c('0x17')][_0xff7c('0x1c')],function(_0x4c0624){return{'model':db[_0x4c0624[_0xff7c('0x1e')]],'as':_0x4c0624['as'],'attributes':_0x4c0624[_0xff7c('0x1a')],'include':_0x4c0624['include']?_['map'](_0x4c0624[_0xff7c('0x1c')],function(_0x3cbc93){return{'model':db[_0x3cbc93[_0xff7c('0x1e')]],'as':_0x3cbc93['as'],'attributes':_0x3cbc93[_0xff7c('0x1a')],'include':_0x3cbc93[_0xff7c('0x1c')]?_[_0xff7c('0x1d')](_0x3cbc93[_0xff7c('0x1c')],function(_0x56576d){return{'model':db[_0x56576d[_0xff7c('0x1e')]],'as':_0x56576d['as'],'attributes':_0x56576d['attributes']};}):[]};}):[]};}):[]:[]})[_0xff7c('0xa')](function(_0x2f1abc){logger[_0xff7c('0xb')](_0xff7c('0x20'),_0x46678a);logger[_0xff7c('0xd')](_0xff7c('0x20'),_0x46678a,JSON[_0xff7c('0x10')](_0x2f1abc));_0x42110e(_0x2f1abc);})[_0xff7c('0x1f')](function(_0x26b24e){logger['error'](_0xff7c('0x20'),_0x26b24e[_0xff7c('0x12')],_0x46678a);_0x5acbca(_0xbad4a8['error'](0x1f4,_0x26b24e[_0xff7c('0x12')]));});});};
\ No newline at end of file
+var _0x478d=['limit','include','map','model','Trigger','find','where','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTrigger','options','raw','attributes'];(function(_0x4ffc69,_0xe2c8e){var _0x3c55e9=function(_0x11eb48){while(--_0x11eb48){_0x4ffc69['push'](_0x4ffc69['shift']());}};_0x3c55e9(++_0xe2c8e);}(_0x478d,0x8c));var _0xd478=function(_0x48ac58,_0x27efe2){_0x48ac58=_0x48ac58-0x0;var _0x560abc=_0x478d[_0x48ac58];return _0x560abc;};'use strict';var _=require(_0xd478('0x0'));var util=require(_0xd478('0x1'));var moment=require(_0xd478('0x2'));var BPromise=require(_0xd478('0x3'));var rs=require(_0xd478('0x4'));var fs=require('fs');var Redis=require(_0xd478('0x5'));var db=require(_0xd478('0x6'))['db'];var utils=require(_0xd478('0x7'));var logger=require(_0xd478('0x8'))('rpc');var config=require(_0xd478('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5650f9,_0x18f006,_0x3b1835){return new BPromise(function(_0x36904b,_0x22a3b1){return client[_0xd478('0xa')](_0x5650f9,_0x3b1835)[_0xd478('0xb')](function(_0x362545){logger[_0xd478('0xc')](_0xd478('0xd'),_0x18f006,'request\x20sent');logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x18f006,_0xd478('0xe'),JSON[_0xd478('0xf')](_0x362545));if(_0x362545[_0xd478('0x10')]){if(_0x362545[_0xd478('0x10')][_0xd478('0x11')]===0x1f4){logger['error'](_0xd478('0xd'),_0x18f006,_0x362545[_0xd478('0x10')][_0xd478('0x12')]);return _0x22a3b1(_0x362545['error'][_0xd478('0x12')]);}logger[_0xd478('0x10')](_0xd478('0xd'),_0x18f006,_0x362545[_0xd478('0x10')][_0xd478('0x12')]);return _0x36904b(_0x362545['error']['message']);}else{logger[_0xd478('0xc')](_0xd478('0xd'),_0x18f006,'request\x20sent');_0x36904b(_0x362545[_0xd478('0x13')][_0xd478('0x12')]);}})[_0xd478('0x14')](function(_0x196ed3){logger[_0xd478('0x10')](_0xd478('0xd'),_0x18f006,_0x196ed3);_0x22a3b1(_0x196ed3);});});}exports[_0xd478('0x15')]=function(_0x8ed9a3){var _0x1d4b31=this;return new Promise(function(_0x97fdcb,_0x242398){return db['Trigger']['findAll']({'raw':_0x8ed9a3[_0xd478('0x16')]?_0x8ed9a3['options'][_0xd478('0x17')]===undefined?!![]:![]:!![],'where':_0x8ed9a3['options']?_0x8ed9a3[_0xd478('0x16')]['where']||null:null,'attributes':_0x8ed9a3[_0xd478('0x16')]?_0x8ed9a3[_0xd478('0x16')][_0xd478('0x18')]||null:null,'limit':_0x8ed9a3[_0xd478('0x16')]?_0x8ed9a3[_0xd478('0x16')][_0xd478('0x19')]||null:null,'include':_0x8ed9a3[_0xd478('0x16')]?_0x8ed9a3[_0xd478('0x16')][_0xd478('0x1a')]?_[_0xd478('0x1b')](_0x8ed9a3['options']['include'],function(_0x41a0f2){return{'model':db[_0x41a0f2[_0xd478('0x1c')]],'as':_0x41a0f2['as'],'attributes':_0x41a0f2[_0xd478('0x18')],'include':_0x41a0f2[_0xd478('0x1a')]?_[_0xd478('0x1b')](_0x41a0f2[_0xd478('0x1a')],function(_0x13be76){return{'model':db[_0x13be76['model']],'as':_0x13be76['as'],'attributes':_0x13be76[_0xd478('0x18')],'include':_0x13be76[_0xd478('0x1a')]?_[_0xd478('0x1b')](_0x13be76[_0xd478('0x1a')],function(_0x4c9648){return{'model':db[_0x4c9648[_0xd478('0x1c')]],'as':_0x4c9648['as'],'attributes':_0x4c9648[_0xd478('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd478('0xb')](function(_0x38daab){logger[_0xd478('0xc')](_0xd478('0x15'),_0x8ed9a3);logger['debug'](_0xd478('0x15'),_0x8ed9a3,JSON['stringify'](_0x38daab));_0x97fdcb(_0x38daab);})[_0xd478('0x14')](function(_0x3730e7){logger['error'](_0xd478('0x15'),_0x3730e7[_0xd478('0x12')],_0x8ed9a3);_0x242398(_0x1d4b31['error'](0x1f4,_0x3730e7[_0xd478('0x12')]));});});};exports['ShowTrigger']=function(_0x29f6e7){var _0x1fbd7b=this;return new Promise(function(_0x32d0bf,_0x2712a4){return db[_0xd478('0x1d')][_0xd478('0x1e')]({'raw':_0x29f6e7[_0xd478('0x16')]?_0x29f6e7[_0xd478('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x29f6e7[_0xd478('0x16')]?_0x29f6e7[_0xd478('0x16')][_0xd478('0x1f')]||null:null,'attributes':_0x29f6e7['options']?_0x29f6e7[_0xd478('0x16')][_0xd478('0x18')]||null:null,'include':_0x29f6e7['options']?_0x29f6e7[_0xd478('0x16')]['include']?_[_0xd478('0x1b')](_0x29f6e7['options'][_0xd478('0x1a')],function(_0x52c55a){return{'model':db[_0x52c55a[_0xd478('0x1c')]],'as':_0x52c55a['as'],'attributes':_0x52c55a[_0xd478('0x18')],'include':_0x52c55a[_0xd478('0x1a')]?_[_0xd478('0x1b')](_0x52c55a[_0xd478('0x1a')],function(_0x33751b){return{'model':db[_0x33751b[_0xd478('0x1c')]],'as':_0x33751b['as'],'attributes':_0x33751b[_0xd478('0x18')],'include':_0x33751b[_0xd478('0x1a')]?_[_0xd478('0x1b')](_0x33751b[_0xd478('0x1a')],function(_0x1a739a){return{'model':db[_0x1a739a[_0xd478('0x1c')]],'as':_0x1a739a['as'],'attributes':_0x1a739a[_0xd478('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b4b84){logger[_0xd478('0xc')](_0xd478('0x20'),_0x29f6e7);logger['debug'](_0xd478('0x20'),_0x29f6e7,JSON[_0xd478('0xf')](_0x4b4b84));_0x32d0bf(_0x4b4b84);})[_0xd478('0x14')](function(_0x4c37d9){logger[_0xd478('0x10')](_0xd478('0x20'),_0x4c37d9[_0xd478('0x12')],_0x29f6e7);_0x2712a4(_0x1fbd7b['error'](0x1f4,_0x4c37d9[_0xd478('0x12')]));});});};
\ No newline at end of file
index 84ed70d..0056621 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe5dd=['delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','show','post','/:id/clone','clone','create','put','update'];(function(_0x3c5c3c,_0x13b428){var _0x2a4714=function(_0x5d5ca3){while(--_0x5d5ca3){_0x3c5c3c['push'](_0x3c5c3c['shift']());}};_0x2a4714(++_0x13b428);}(_0xe5dd,0x1b6));var _0xde5d=function(_0x46f35e,_0x4feebb){_0x46f35e=_0x46f35e-0x0;var _0x5726bc=_0xe5dd[_0x46f35e];return _0x5726bc;};'use strict';var multer=require(_0xde5d('0x0'));var util=require(_0xde5d('0x1'));var path=require(_0xde5d('0x2'));var timeout=require(_0xde5d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xde5d('0x4'));var auth=require(_0xde5d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xde5d('0x6'));var controller=require(_0xde5d('0x7'));router[_0xde5d('0x8')]('/',auth[_0xde5d('0x9')](),controller['index']);router[_0xde5d('0x8')](_0xde5d('0xa'),auth[_0xde5d('0x9')](),controller[_0xde5d('0xb')]);router[_0xde5d('0xc')](_0xde5d('0xd'),auth[_0xde5d('0x9')](),controller[_0xde5d('0xe')]);router['post']('/',auth[_0xde5d('0x9')](),controller[_0xde5d('0xf')]);router[_0xde5d('0x10')]('/:id',auth[_0xde5d('0x9')](),controller[_0xde5d('0x11')]);router[_0xde5d('0x12')](_0xde5d('0xa'),auth[_0xde5d('0x9')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0x2cfa=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','show','post','/:id/clone','clone','create','put','destroy','exports'];(function(_0x2445e8,_0x57e1c8){var _0x4319a6=function(_0x345633){while(--_0x345633){_0x2445e8['push'](_0x2445e8['shift']());}};_0x4319a6(++_0x57e1c8);}(_0x2cfa,0x78));var _0xa2cf=function(_0x7a112,_0x2eb4a0){_0x7a112=_0x7a112-0x0;var _0x136dc5=_0x2cfa[_0x7a112];return _0x136dc5;};'use strict';var multer=require('multer');var util=require(_0xa2cf('0x0'));var path=require(_0xa2cf('0x1'));var timeout=require('connect-timeout');var express=require(_0xa2cf('0x2'));var router=express[_0xa2cf('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa2cf('0x4'));var interaction=require(_0xa2cf('0x5'));var config=require(_0xa2cf('0x6'));var controller=require(_0xa2cf('0x7'));router[_0xa2cf('0x8')]('/',auth['isAuthenticated'](),controller[_0xa2cf('0x9')]);router[_0xa2cf('0x8')](_0xa2cf('0xa'),auth[_0xa2cf('0xb')](),controller[_0xa2cf('0xc')]);router[_0xa2cf('0xd')](_0xa2cf('0xe'),auth['isAuthenticated'](),controller[_0xa2cf('0xf')]);router[_0xa2cf('0xd')]('/',auth[_0xa2cf('0xb')](),controller[_0xa2cf('0x10')]);router[_0xa2cf('0x11')](_0xa2cf('0xa'),auth[_0xa2cf('0xb')](),controller['update']);router['delete'](_0xa2cf('0xa'),auth[_0xa2cf('0xb')](),controller[_0xa2cf('0x12')]);module[_0xa2cf('0x13')]=router;
\ No newline at end of file
index 6b7c345..5e24823 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x534a=['all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','originate','uac','uas','pai','fingerprint','certificate','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','user','peer','friend','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','split'];(function(_0x3effae,_0x39483a){var _0x5679d5=function(_0x22a027){while(--_0x22a027){_0x3effae['push'](_0x3effae['shift']());}};_0x5679d5(++_0x39483a);}(_0x534a,0x147));var _0xa534=function(_0x33dadb,_0x16d0cc){_0x33dadb=_0x33dadb-0x0;var _0x3d4c4d=_0x534a[_0x33dadb];return _0x3d4c4d;};'use strict';var Sequelize=require(_0xa534('0x0'));module[_0xa534('0x1')]={'name':{'type':Sequelize[_0xa534('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa534('0x3')]('friend',_0xa534('0x4'),_0xa534('0x5')),'allowNull':![],'defaultValue':_0xa534('0x6')},'context':{'type':Sequelize[_0xa534('0x2')],'allowNull':![],'defaultValue':_0xa534('0x7')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xa534('0x8'),_0xa534('0x9'),_0xa534('0xa'),_0xa534('0xb'),_0xa534('0xc'),_0xa534('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0xa534('0x2')]},'permit':{'type':Sequelize[_0xa534('0x2')]},'secret':{'type':Sequelize[_0xa534('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xa534('0x2')]},'transport':{'type':Sequelize[_0xa534('0x2')],'defaultValue':_0xa534('0xe'),'set':function(_0x58b70f){this[_0xa534('0xf')](_0xa534('0x10'),_0x58b70f?_0x58b70f[_0xa534('0x11')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xa534('0x12')]('transport')['split'](','):null;},'comment':_0xa534('0x13')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xa534('0x14'),_0xa534('0x15'),_0xa534('0x16'),_0xa534('0x17')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no',_0xa534('0x19'),_0xa534('0x1a'),_0xa534('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xa534('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa534('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xa534('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x1b1b3f){this[_0xa534('0xf')](_0xa534('0x1c'),_0x1b1b3f?_0x1b1b3f['join'](','):null);},'get':function(){return this['getDataValue'](_0xa534('0x1c'))?this[_0xa534('0x12')]('nat')[_0xa534('0x1d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xa534('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xa534('0x2')]},'language':{'type':Sequelize[_0xa534('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa534('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa534('0x2')],'defaultValue':_0xa534('0x1e')},'allow':{'type':Sequelize[_0xa534('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xc2818d){this[_0xa534('0xf')](_0xa534('0x1f'),_0xc2818d?_0xc2818d[_0xa534('0x11')](';'):_0xa534('0x20'));},'get':function(){return this[_0xa534('0x12')](_0xa534('0x1f'))?this[_0xa534('0x12')](_0xa534('0x1f'))['split'](';'):null;},'comment':_0xa534('0x21')},'autoframing':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x4e243b){this[_0xa534('0xf')](_0xa534('0x22'),_0x4e243b?_0x4e243b[_0xa534('0x11')](','):null);},'get':function(){return this[_0xa534('0x12')](_0xa534('0x22'))?this['getDataValue'](_0xa534('0x22'))[_0xa534('0x1d')](','):null;},'comment':_0xa534('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0xa534('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no',_0xa534('0x24'))},'promiscredir':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no')},'accountcode':{'type':Sequelize[_0xa534('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa534('0x2')],'defaultValue':_0xa534('0x26')},'amaflags':{'type':Sequelize[_0xa534('0x2')]},'callcounter':{'type':Sequelize[_0xa534('0x3')]('yes','no'),'defaultValue':_0xa534('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xa534('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xa534('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xa534('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xa534('0x2')]},'videosupport':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no')},'mailbox':{'type':Sequelize[_0xa534('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0xa534('0x27'),'refuse',_0xa534('0x28'))},'session_expires':{'type':Sequelize[_0xa534('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xa534('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xa534('0x29'),_0xa534('0x2a')),'defaultValue':_0xa534('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xa534('0x2')]},'fromdomain':{'type':Sequelize[_0xa534('0x2')]},'fromuser':{'type':Sequelize[_0xa534('0x2')]},'port':{'type':Sequelize[_0xa534('0x25')](0x5)},'qualify':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no'),'defaultValue':_0xa534('0x18')},'keepalive':{'type':Sequelize[_0xa534('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xa534('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xa534('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa534('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no',_0xa534('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa534('0x2')]},'callbackextension':{'type':Sequelize[_0xa534('0x2')]},'timert1':{'type':Sequelize[_0xa534('0x25')](0xb)},'timerb':{'type':Sequelize[_0xa534('0x25')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xa534('0x2')]},'contactdeny':{'type':Sequelize[_0xa534('0x2')]},'contactacl':{'type':Sequelize[_0xa534('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xa534('0x2')]},'use_q850_reason':{'type':Sequelize[_0xa534('0x2')]},'maxforwards':{'type':Sequelize[_0xa534('0x25')](0xb)},'encryption':{'type':Sequelize[_0xa534('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa534('0x3')]('yes','no')},'force_avp':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no')},'icesupport':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xa534('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no',_0xa534('0x2c'),_0xa534('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xa534('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xa534('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xa534('0x2')]},'dtlscipher':{'type':Sequelize[_0xa534('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xa534('0x2')]},'dtlssetup':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x2e'),_0xa534('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa534('0x2')]},'usereqphone':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa534('0x2')]},'recordofffeature':{'type':Sequelize[_0xa534('0x2')]},'call_limit':{'type':Sequelize[_0xa534('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no')},'vmexten':{'type':Sequelize[_0xa534('0x2')]},'mohinterpret':{'type':Sequelize[_0xa534('0x2')]},'mohsuggest':{'type':Sequelize[_0xa534('0x2')]},'parkinglot':{'type':Sequelize[_0xa534('0x2')]},'description':{'type':Sequelize[_0xa534('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xa534('0x30')},'canreinvite':{'type':Sequelize[_0xa534('0x3')](_0xa534('0x18'),'no',_0xa534('0x19'),_0xa534('0x1a'),_0xa534('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xa534('0x2')]},'active':{'type':Sequelize[_0xa534('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa534('0x2')],'defaultValue':'no'}};
\ No newline at end of file
+var _0x6259=['shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','dynamic','nonat','update,nonat','BOOLEAN','sequelize','STRING','name','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','rfc2833','info'];(function(_0x3bed20,_0x266871){var _0x16ae48=function(_0x15df84){while(--_0x15df84){_0x3bed20['push'](_0x3bed20['shift']());}};_0x16ae48(++_0x266871);}(_0x6259,0x88));var _0x9625=function(_0x3b402f,_0x947a71){_0x3b402f=_0x3b402f-0x0;var _0x200d4c=_0x6259[_0x3b402f];return _0x200d4c;};'use strict';var Sequelize=require(_0x9625('0x0'));module['exports']={'name':{'type':Sequelize[_0x9625('0x1')],'allowNull':![],'unique':_0x9625('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x9625('0x3'),_0x9625('0x4'),'peer'),'allowNull':![],'defaultValue':_0x9625('0x3')},'context':{'type':Sequelize[_0x9625('0x1')],'allowNull':![],'defaultValue':_0x9625('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x9625('0x6'),_0x9625('0x7'),_0x9625('0x8'),_0x9625('0x9'),'PROHIB_NOT_SCREENED',_0x9625('0xa'),_0x9625('0xb'),_0x9625('0xc'))},'deny':{'type':Sequelize[_0x9625('0x1')]},'permit':{'type':Sequelize[_0x9625('0x1')]},'secret':{'type':Sequelize[_0x9625('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x9625('0x1')]},'transport':{'type':Sequelize[_0x9625('0x1')],'defaultValue':_0x9625('0xd'),'set':function(_0x108485){this[_0x9625('0xe')](_0x9625('0xf'),_0x108485?_0x108485[_0x9625('0x10')](','):null);},'get':function(){return this[_0x9625('0x11')](_0x9625('0xf'))?this[_0x9625('0x11')](_0x9625('0xf'))[_0x9625('0x12')](','):null;},'comment':_0x9625('0x13')},'dtmfmode':{'type':Sequelize[_0x9625('0x14')](_0x9625('0x15'),_0x9625('0x16'),_0x9625('0x17'),_0x9625('0x18'),_0x9625('0x19')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x9625('0x14')](_0x9625('0x1a'),'no','nonat',_0x9625('0x1b'),_0x9625('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9625('0x14')](_0x9625('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9625('0x1')]},'directmediadeny':{'type':Sequelize[_0x9625('0x1')]},'nat':{'type':Sequelize[_0x9625('0x1')],'defaultValue':_0x9625('0x1d'),'set':function(_0x38ded4){this['setDataValue'](_0x9625('0x1e'),_0x38ded4?_0x38ded4[_0x9625('0x10')](','):null);},'get':function(){return this[_0x9625('0x11')]('nat')?this[_0x9625('0x11')](_0x9625('0x1e'))[_0x9625('0x12')](','):null;},'comment':_0x9625('0x1f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9625('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x9625('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0x9625('0x1')],'allowNull':![],'defaultValue':_0x9625('0x20'),'set':function(_0x4c6da1){this['setDataValue'](_0x9625('0x21'),_0x4c6da1?_0x4c6da1[_0x9625('0x10')](';'):_0x9625('0x20'));},'get':function(){return this['getDataValue'](_0x9625('0x21'))?this['getDataValue'](_0x9625('0x21'))[_0x9625('0x12')](';'):null;},'comment':_0x9625('0x22')},'autoframing':{'type':Sequelize[_0x9625('0x14')](_0x9625('0x1a'),'no')},'insecure':{'type':Sequelize[_0x9625('0x1')],'defaultValue':_0x9625('0x23'),'set':function(_0x2f3490){this[_0x9625('0xe')](_0x9625('0x24'),_0x2f3490?_0x2f3490[_0x9625('0x10')](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue'](_0x9625('0x24'))[_0x9625('0x12')](','):null;},'comment':_0x9625('0x25')},'trustrpid':{'type':Sequelize[_0x9625('0x14')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9625('0x14')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9625('0x14')](_0x9625('0x1a'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x9625('0x1a'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x9625('0x1a'),'no')},'accountcode':{'type':Sequelize[_0x9625('0x26')](0xb)},'setvar':{'type':Sequelize[_0x9625('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x9625('0x27')},'amaflags':{'type':Sequelize[_0x9625('0x1')]},'callcounter':{'type':Sequelize[_0x9625('0x14')](_0x9625('0x1a'),'no'),'defaultValue':_0x9625('0x1a')},'busylevel':{'type':Sequelize[_0x9625('0x26')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x9625('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0x9625('0x14')](_0x9625('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x9625('0x14')](_0x9625('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x9625('0x14')](_0x9625('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x9625('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x9625('0x14')]('yes','no',_0x9625('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9625('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x9625('0x14')]('yes','no')},'mailbox':{'type':Sequelize[_0x9625('0x1')]},'session_timers':{'type':Sequelize[_0x9625('0x14')](_0x9625('0x29'),'refuse',_0x9625('0x2a'))},'session_expires':{'type':Sequelize[_0x9625('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x9625('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x9625('0x2b'),_0x9625('0x2c')),'defaultValue':_0x9625('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x9625('0x1')]},'regexten':{'type':Sequelize[_0x9625('0x1')]},'fromdomain':{'type':Sequelize[_0x9625('0x1')]},'fromuser':{'type':Sequelize[_0x9625('0x1')]},'port':{'type':Sequelize[_0x9625('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x9625('0x1a'),'no'),'defaultValue':_0x9625('0x1a')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x9625('0x1')]},'defaultuser':{'type':Sequelize[_0x9625('0x1')]},'rtptimeout':{'type':Sequelize[_0x9625('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x9625('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x9625('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x9625('0x1a'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9625('0x1')]},'callbackextension':{'type':Sequelize[_0x9625('0x1')]},'timert1':{'type':Sequelize[_0x9625('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x9625('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x9625('0x1')]},'contactdeny':{'type':Sequelize[_0x9625('0x1')]},'contactacl':{'type':Sequelize[_0x9625('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x9625('0x1')]},'use_q850_reason':{'type':Sequelize[_0x9625('0x1')]},'maxforwards':{'type':Sequelize[_0x9625('0x26')](0xb)},'encryption':{'type':Sequelize[_0x9625('0x14')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9625('0x14')]('yes','no')},'force_avp':{'type':Sequelize[_0x9625('0x14')](_0x9625('0x1a'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x9625('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0x9625('0x14')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x9625('0x14')](_0x9625('0x1a'),'no',_0x9625('0x2d'),_0x9625('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x9625('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x9625('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x9625('0x1')]},'dtlscipher':{'type':Sequelize[_0x9625('0x1')]},'dtlscafile':{'type':Sequelize[_0x9625('0x1')]},'dtlscapath':{'type':Sequelize[_0x9625('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x9625('0x2f'),_0x9625('0x30'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9625('0x1')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x9625('0x1')]},'call_limit':{'type':Sequelize[_0x9625('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x9625('0x14')](_0x9625('0x1a'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x9625('0x1')]},'mohinterpret':{'type':Sequelize[_0x9625('0x1')]},'mohsuggest':{'type':Sequelize[_0x9625('0x1')]},'parkinglot':{'type':Sequelize[_0x9625('0x1')]},'description':{'type':Sequelize[_0x9625('0x1')]},'host':{'type':Sequelize[_0x9625('0x1')],'defaultValue':_0x9625('0x31')},'canreinvite':{'type':Sequelize[_0x9625('0x14')](_0x9625('0x1a'),'no',_0x9625('0x32'),_0x9625('0x1b'),_0x9625('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x9625('0x1')]},'active':{'type':Sequelize[_0x9625('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}};
\ No newline at end of file
index ad7e044..e891c3a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8ef6=['userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','options','Trunk','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','catch','clone','omit','createdAt','updatedAt','create','body','get','role','UserProfileSection'];(function(_0x97fdf3,_0x3ed533){var _0x17a8d2=function(_0x12a602){while(--_0x12a602){_0x97fdf3['push'](_0x97fdf3['shift']());}};_0x17a8d2(++_0x3ed533);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2940dd,_0x170fce){_0x2940dd=_0x2940dd-0x0;var _0x3b9600=_0x8ef6[_0x2940dd];return _0x3b9600;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];var jayson=require(_0x68ef('0x1b'));var client=jayson[_0x68ef('0x1c')][_0x68ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x288cc9,_0x508671,_0x3b48dd,_0xc50cce){return new BPromise(function(_0x2657c5,_0x47fbb5){var _0x22fe96=_0xc50cce||client;return _0x22fe96[_0x68ef('0x1e')](_0x288cc9,_0x3b48dd)[_0x68ef('0x1f')](function(_0x5005ba){logger[_0x68ef('0x20')](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));logger[_0x68ef('0x23')]('Trunk,\x20%s,\x20%s,\x20%s',_0x508671,_0x68ef('0x22'),JSON['stringify'](_0x5005ba));if(_0x5005ba['error']){if(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x25')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x508671,_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);return _0x47fbb5(_0x5005ba[_0x68ef('0x24')]['message']);}logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x5005ba[_0x68ef('0x24')]['message']);return _0x2657c5(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);}else{logger['info'](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));_0x2657c5(_0x5005ba[_0x68ef('0x27')]['message']);}})['catch'](function(_0x59bebc){logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x59bebc);_0x47fbb5(_0x59bebc);});});}function respondWithStatusCode(_0x312cc9,_0x2e6e39){_0x2e6e39=_0x2e6e39||0xcc;return function(_0x438b4c){if(_0x438b4c){return _0x312cc9[_0x68ef('0x28')](_0x2e6e39);}return _0x312cc9[_0x68ef('0x29')](_0x2e6e39)[_0x68ef('0x2a')]();};}function respondWithResult(_0x65fd09,_0x13280b){_0x13280b=_0x13280b||0xc8;return function(_0x5e4dbe){if(_0x5e4dbe){return _0x65fd09[_0x68ef('0x29')](_0x13280b)['json'](_0x5e4dbe);}};}function respondWithFilteredResult(_0x599243,_0x55d8b0){return function(_0x1a7ce1){if(_0x1a7ce1){var _0x268f32=typeof _0x55d8b0[_0x68ef('0x2b')]===_0x68ef('0x2c')&&typeof _0x55d8b0['limit']==='undefined';var _0x1cbe4f=_0x1a7ce1[_0x68ef('0x2d')];var _0x7bf96=_0x268f32?0x0:_0x55d8b0[_0x68ef('0x2b')];var _0x22ef25=_0x268f32?_0x1a7ce1[_0x68ef('0x2d')]:_0x55d8b0[_0x68ef('0x2b')]+_0x55d8b0[_0x68ef('0x2e')];var _0x5a6dfd;if(_0x22ef25>=_0x1cbe4f){_0x22ef25=_0x1cbe4f;_0x5a6dfd=0xc8;}else{_0x5a6dfd=0xce;}_0x599243[_0x68ef('0x29')](_0x5a6dfd);return _0x599243[_0x68ef('0x2f')](_0x68ef('0x30'),_0x7bf96+'-'+_0x22ef25+'/'+_0x1cbe4f)['json'](_0x1a7ce1);}return null;};}function patchUpdates(_0x370a8f){return function(_0x523120){try{jsonpatch[_0x68ef('0x31')](_0x523120,_0x370a8f,!![]);}catch(_0x17588a){return BPromise['reject'](_0x17588a);}return _0x523120['save']();};}function saveUpdates(_0x159395,_0x5fa72a){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x68ef('0x32')](_0x159395)[_0x68ef('0x1f')](function(_0x2d67be){return _0x2d67be;});}return null;};}function removeEntity(_0x2d1e9f,_0x59e9fb){return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2c8bd0[_0x68ef('0x33')]()['then'](function(){var _0x2f8de2=_0x2c8bd0['get']({'plain':!![]});var _0x14581d=_0x68ef('0x34');return db['UserProfileResource'][_0x68ef('0x33')]({'where':{'type':_0x14581d,'resourceId':_0x2f8de2['id']}})['then'](function(){return _0x2c8bd0;});})[_0x68ef('0x1f')](function(){_0x2d1e9f['status'](0xcc)[_0x68ef('0x2a')]();});}};}function handleEntityNotFound(_0x1444e0,_0x798276){return function(_0x569949){if(!_0x569949){_0x1444e0[_0x68ef('0x28')](0x194);}return _0x569949;};}function handleError(_0x485dc3,_0x476938){_0x476938=_0x476938||0x1f4;return function(_0x4c9506){logger[_0x68ef('0x24')](_0x4c9506[_0x68ef('0x35')]);if(_0x4c9506[_0x68ef('0x36')]){delete _0x4c9506[_0x68ef('0x36')];}_0x485dc3[_0x68ef('0x29')](_0x476938)[_0x68ef('0x37')](_0x4c9506);};}exports['index']=function(_0x294fba,_0x15a6ab){var _0x32074a={},_0x52a8b9={},_0x32eddd={'count':0x0,'rows':[]};var _0x3c5de6=_[_0x68ef('0x38')](db['Trunk']['rawAttributes'],function(_0x14f0fc){return{'name':_0x14f0fc[_0x68ef('0x39')],'type':_0x14f0fc[_0x68ef('0x3a')][_0x68ef('0x3b')]};});_0x52a8b9[_0x68ef('0x3c')]=_[_0x68ef('0x38')](_0x3c5de6,_0x68ef('0x36'));_0x52a8b9['query']=_[_0x68ef('0x3d')](_0x294fba[_0x68ef('0x3e')]);_0x52a8b9[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x52a8b9['model'],_0x52a8b9[_0x68ef('0x3e')]);_0x32074a[_0x68ef('0x41')]=_[_0x68ef('0x40')](_0x52a8b9[_0x68ef('0x3c')],qs[_0x68ef('0x42')](_0x294fba[_0x68ef('0x3e')]['fields']));_0x32074a[_0x68ef('0x41')]=_0x32074a[_0x68ef('0x41')][_0x68ef('0x43')]?_0x32074a[_0x68ef('0x41')]:_0x52a8b9[_0x68ef('0x3c')];if(!_0x294fba[_0x68ef('0x3e')][_0x68ef('0x44')](_0x68ef('0x45'))){_0x32074a[_0x68ef('0x2e')]=qs['limit'](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2e')]);_0x32074a[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2b')]);}_0x32074a[_0x68ef('0x46')]=qs['sort'](_0x294fba[_0x68ef('0x3e')]['sort']);_0x32074a[_0x68ef('0x47')]=qs[_0x68ef('0x3f')](_[_0x68ef('0x48')](_0x294fba[_0x68ef('0x3e')],_0x52a8b9['filters']),_0x3c5de6);if(_0x294fba[_0x68ef('0x3e')]['filter']){_0x32074a[_0x68ef('0x47')]=_['merge'](_0x32074a[_0x68ef('0x47')],{'$or':_[_0x68ef('0x38')](_0x3c5de6,function(_0x105e8c){if(_0x105e8c['type']!=='VIRTUAL'){var _0x4044d5={};_0x4044d5[_0x105e8c[_0x68ef('0x36')]]={'$like':'%'+_0x294fba['query']['filter']+'%'};return _0x4044d5;}})});}_0x32074a=_['merge']({},_0x32074a,_0x294fba[_0x68ef('0x49')]);var _0x15c753={'where':_0x32074a[_0x68ef('0x47')]};return db[_0x68ef('0x4a')][_0x68ef('0x2d')](_0x15c753)['then'](function(_0x55f385){_0x32eddd[_0x68ef('0x2d')]=_0x55f385;if(_0x294fba[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0x32074a[_0x68ef('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x68ef('0x4d')](_0x32074a);})[_0x68ef('0x1f')](function(_0x1c9b6f){_0x32eddd[_0x68ef('0x4e')]=_0x1c9b6f;return _0x32eddd;})['then'](respondWithFilteredResult(_0x15a6ab,_0x32074a))['catch'](handleError(_0x15a6ab,null));};exports[_0x68ef('0x4f')]=function(_0x3c3074,_0x566e7c){var _0xfc7a74={'raw':![],'where':{'id':_0x3c3074[_0x68ef('0x50')]['id']}},_0x12fff3={};_0x12fff3[_0x68ef('0x3c')]=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x12fff3[_0x68ef('0x3e')]=_[_0x68ef('0x3d')](_0x3c3074['query']);_0x12fff3[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x12fff3[_0x68ef('0x3c')],_0x12fff3['query']);_0xfc7a74[_0x68ef('0x41')]=_['intersection'](_0x12fff3['model'],qs[_0x68ef('0x42')](_0x3c3074['query'][_0x68ef('0x42')]));_0xfc7a74[_0x68ef('0x41')]=_0xfc7a74[_0x68ef('0x41')][_0x68ef('0x43')]?_0xfc7a74[_0x68ef('0x41')]:_0x12fff3[_0x68ef('0x3c')];if(_0x3c3074[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0xfc7a74[_0x68ef('0x4c')]=[{'all':!![]}];}_0xfc7a74=_[_0x68ef('0x52')]({},_0xfc7a74,_0x3c3074['options']);return db['Trunk'][_0x68ef('0x53')](_0xfc7a74)[_0x68ef('0x1f')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x1f')](respondWithResult(_0x566e7c,null))[_0x68ef('0x54')](handleError(_0x566e7c,null));};exports[_0x68ef('0x55')]=function(_0x1d11d7,_0x15400c){var _0x300a64={'where':{'id':_0x1d11d7['params']['id']}},_0x40c784={};_0x40c784['model']=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x300a64['attributes']=_[_0x68ef('0x40')](_0x40c784[_0x68ef('0x3c')],qs['fields'](_0x1d11d7[_0x68ef('0x3e')]['fields']));_0x300a64[_0x68ef('0x41')]=_0x300a64[_0x68ef('0x41')][_0x68ef('0x43')]?_0x300a64[_0x68ef('0x41')]:_0x40c784[_0x68ef('0x3c')];if(_0x1d11d7[_0x68ef('0x3e')]['includeAll']){_0x300a64[_0x68ef('0x4c')]=[{'all':!![]}];}_0x300a64=_[_0x68ef('0x52')]({},_0x300a64,_0x1d11d7[_0x68ef('0x49')]);return db[_0x68ef('0x4a')][_0x68ef('0x53')](_0x300a64)[_0x68ef('0x1f')](handleEntityNotFound(_0x15400c,null))['then'](function(_0x9a978f){if(_0x9a978f){var _0x42d2a3=_0x9a978f['get']({'plain':!![]});_0x42d2a3=qs[_0x68ef('0x56')](_0x42d2a3,['id',_0x68ef('0x57'),_0x68ef('0x58')]);_0x1d11d7['body']=_[_0x68ef('0x56')](_0x1d11d7['body'],['id','createdAt',_0x68ef('0x58')]);return db['Trunk'][_0x68ef('0x59')](_['merge'](_0x42d2a3,_0x1d11d7[_0x68ef('0x5a')]),{'include':_0x1d11d7[_0x68ef('0x3e')][_0x68ef('0x4b')]?[{'all':!![]}]:undefined})[_0x68ef('0x1f')](function(_0x19ce17){var _0x19a9c4=_0x1d11d7['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x19a9c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19a9c4[_0x68ef('0x5c')]==='user'){var _0x2f97c5=_0x19ce17[_0x68ef('0x5b')]({'plain':!![]});var _0x212ec4=_0x68ef('0x34');return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x212ec4,'userProfileId':_0x19a9c4[_0x68ef('0x5e')]},'raw':!![]})['then'](function(_0x3ea4e7){if(_0x3ea4e7&&_0x3ea4e7[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x2f97c5[_0x68ef('0x36')],'resourceId':_0x2f97c5['id'],'type':_0x3ea4e7['name'],'sectionId':_0x3ea4e7['id']},{})[_0x68ef('0x1f')](function(){return _0x19ce17;});}else{return _0x19ce17;}})['catch'](function(_0x1ed172){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ed172);throw _0x1ed172;});}return _0x19ce17;});}})[_0x68ef('0x1f')](respondWithResult(_0x15400c,0xc9))[_0x68ef('0x54')](handleError(_0x15400c,null));};exports[_0x68ef('0x59')]=function(_0x21b2ce,_0x51f905,_0x124b49){var _0x570e0c;return db[_0x68ef('0x4a')][_0x68ef('0x59')](_0x21b2ce[_0x68ef('0x5a')],{'raw':!![]})['then'](function(_0x541e35){_0x570e0c=_0x541e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});})[_0x68ef('0x1f')](function(_0x454c6f){var _0x5b41e1=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),'utf8');var _0x3f56a7=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0xed16d1=ejs['render'](_0x5b41e1,{'trunks':_0x454c6f||[]});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0xed16d1);if(_0x570e0c[_0x68ef('0x69')]){var _0x595e79=ejs[_0x68ef('0x6a')](_0x3f56a7,{'trunks':_0x454c6f||[]});fs['writeFileSync'](_0x68ef('0x6b'),_0x595e79);}})['then'](function(){return respondWithRpcPromise('Reload',_0x68ef('0x59'),{'module':_0x68ef('0x6c')});})[_0x68ef('0x1f')](function(){var _0x405971=_0x21b2ce['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x405971)throw new Error(_0x68ef('0x6d'));if(_0x405971[_0x68ef('0x5c')]==='user'){var _0x3e14a4=_0x570e0c[_0x68ef('0x5b')]({'plain':!![]});return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x68ef('0x34'),'userProfileId':_0x405971[_0x68ef('0x5e')]},'raw':!![]})[_0x68ef('0x1f')](function(_0xfe72dc){if(_0xfe72dc&&_0xfe72dc[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x3e14a4[_0x68ef('0x36')],'resourceId':_0x3e14a4['id'],'type':_0xfe72dc['name'],'sectionId':_0xfe72dc['id']},{})[_0x68ef('0x1f')](function(){return _0x570e0c;});}else{return _0x570e0c;}})[_0x68ef('0x54')](function(_0x5db443){logger['error'](_0x68ef('0x6e'),_0x5db443);throw _0x5db443;});}return _0x570e0c;})['then'](respondWithResult(_0x51f905,0xc9))[_0x68ef('0x54')](handleError(_0x51f905,null));};exports[_0x68ef('0x32')]=function(_0x5f1b12,_0x4e0874,_0x31a336){var _0x5c500c;return db[_0x68ef('0x4a')]['find']({'where':{'id':_0x5f1b12[_0x68ef('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e0874,null))[_0x68ef('0x1f')](saveUpdates(_0x5f1b12[_0x68ef('0x5a')],null))['then'](function(_0x3c5e35){if(_0x3c5e35){_0x5c500c=_0x3c5e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});}})[_0x68ef('0x1f')](function(_0x50c308){if(_0x50c308){var _0x2bebdc=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4de1d1=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x65')),'utf8');var _0x4b0fb4=ejs['render'](_0x2bebdc,{'trunks':_0x50c308||[]});fs['writeFileSync'](_0x68ef('0x68'),_0x4b0fb4);var _0x28ad22=ejs[_0x68ef('0x6a')](_0x4de1d1,{'trunks':_0x50c308||[]});fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x28ad22);return respondWithRpcPromise(_0x68ef('0x6f'),_0x68ef('0x32'),{'module':_0x68ef('0x6c')});}return null;})[_0x68ef('0x1f')](function(_0x3ae3e9){if(_0x3ae3e9){return _0x5c500c;}})[_0x68ef('0x1f')](respondWithResult(_0x4e0874,null))[_0x68ef('0x54')](handleError(_0x4e0874,null));};exports[_0x68ef('0x33')]=function(_0x4bd5c3,_0x2b20dc,_0x556dfc){var _0x791181;return db['Trunk']['find']({'where':{'id':_0x4bd5c3[_0x68ef('0x50')]['id']}})[_0x68ef('0x1f')](handleEntityNotFound(_0x2b20dc,null))[_0x68ef('0x1f')](removeEntity(_0x2b20dc,null))[_0x68ef('0x1f')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x68ef('0x1f')](function(_0x308997){var _0x1f1dfd=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4dc885=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0x346049=ejs['render'](_0x1f1dfd,{'trunks':_0x308997});var _0x2a72e8=ejs['render'](_0x4dc885,{'trunks':_0x308997});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0x346049);fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x2a72e8);return respondWithRpcPromise('Reload',_0x68ef('0x33'),{'module':'chan_sip.so'});})[_0x68ef('0x54')](handleError(_0x2b20dc,null));};
\ No newline at end of file
+var _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x4de563,_0x5b2fa8){var _0x453b95=function(_0x1c68c7){while(--_0x1c68c7){_0x4de563['push'](_0x4de563['shift']());}};_0x453b95(++_0x5b2fa8);}(_0xe14d,0x1ee));var _0xde14=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xe14d[_0x2df507];return _0x1f7167;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));};
\ No newline at end of file
index af9082f..2f1f1d2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x32ac=['./trunk.attributes','exports','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5a60ce,_0x48f080){var _0x393e5e=function(_0x1c58fc){while(--_0x1c58fc){_0x5a60ce['push'](_0x5a60ce['shift']());}};_0x393e5e(++_0x48f080);}(_0x32ac,0x1ba));var _0xc32a=function(_0x3c0818,_0x4e58b2){_0x3c0818=_0x3c0818-0x0;var _0x429c48=_0x32ac[_0x3c0818];return _0x429c48;};'use strict';var _=require(_0xc32a('0x0'));var util=require('util');var logger=require(_0xc32a('0x1'))(_0xc32a('0x2'));var moment=require(_0xc32a('0x3'));var BPromise=require(_0xc32a('0x4'));var rp=require(_0xc32a('0x5'));var fs=require('fs');var path=require(_0xc32a('0x6'));var rimraf=require(_0xc32a('0x7'));var config=require(_0xc32a('0x8'));var attributes=require(_0xc32a('0x9'));module[_0xc32a('0xa')]=function(_0x5057f8,_0x2bf103){return _0x5057f8['define']('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x165e=['bluebird','request-promise','path','./trunk.attributes','exports','define','Trunk','lodash','util','../../config/logger'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x165e,0x1b5));var _0xe165=function(_0x3c37f5,_0x464875){_0x3c37f5=_0x3c37f5-0x0;var _0x5c25d7=_0x165e[_0x3c37f5];return _0x5c25d7;};'use strict';var _=require(_0xe165('0x0'));var util=require(_0xe165('0x1'));var logger=require(_0xe165('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe165('0x3'));var rp=require(_0xe165('0x4'));var fs=require('fs');var path=require(_0xe165('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe165('0x6'));module[_0xe165('0x7')]=function(_0x118376,_0x42fe3d){return _0x118376[_0xe165('0x8')](_0xe165('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index a03bca2..c1cd677 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3fb5=['Trunk,\x20%s,\x20%s,\x20%s','error','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','find','ShowTrunk','stringify','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','debug'];(function(_0x431ae1,_0x385f06){var _0x27fcbd=function(_0x16e71f){while(--_0x16e71f){_0x431ae1['push'](_0x431ae1['shift']());}};_0x27fcbd(++_0x385f06);}(_0x3fb5,0x73));var _0x53fb=function(_0x208714,_0x4396fa){_0x208714=_0x208714-0x0;var _0x96fc7b=_0x3fb5[_0x208714];return _0x96fc7b;};'use strict';var _=require(_0x53fb('0x0'));var util=require(_0x53fb('0x1'));var moment=require(_0x53fb('0x2'));var BPromise=require('bluebird');var rs=require(_0x53fb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x53fb('0x4'));var logger=require(_0x53fb('0x5'))(_0x53fb('0x6'));var config=require('../../config/environment');var jayson=require(_0x53fb('0x7'));var client=jayson['client'][_0x53fb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ecbae,_0x5aee21,_0x3b603d){return new BPromise(function(_0x1fd031,_0xf36c96){return client[_0x53fb('0x9')](_0x1ecbae,_0x3b603d)[_0x53fb('0xa')](function(_0x552f13){logger[_0x53fb('0xb')]('Trunk,\x20%s,\x20%s',_0x5aee21,'request\x20sent');logger[_0x53fb('0xc')](_0x53fb('0xd'),_0x5aee21,'request\x20sent',JSON['stringify'](_0x552f13));if(_0x552f13[_0x53fb('0xe')]){if(_0x552f13['error']['code']===0x1f4){logger['error'](_0x53fb('0xf'),_0x5aee21,_0x552f13[_0x53fb('0xe')]['message']);return _0xf36c96(_0x552f13['error'][_0x53fb('0x10')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5aee21,_0x552f13[_0x53fb('0xe')]['message']);return _0x1fd031(_0x552f13['error'][_0x53fb('0x10')]);}else{logger[_0x53fb('0xb')](_0x53fb('0xf'),_0x5aee21,'request\x20sent');_0x1fd031(_0x552f13[_0x53fb('0x11')][_0x53fb('0x10')]);}})[_0x53fb('0x12')](function(_0x4b1177){logger[_0x53fb('0xe')](_0x53fb('0xf'),_0x5aee21,_0x4b1177);_0xf36c96(_0x4b1177);});});}exports[_0x53fb('0x13')]=function(_0x367395){var _0x11349b=this;return new Promise(function(_0x2888d6,_0xc4799b){return db[_0x53fb('0x14')][_0x53fb('0x15')]({'raw':_0x367395[_0x53fb('0x16')]?_0x367395['options'][_0x53fb('0x17')]===undefined?!![]:![]:!![],'where':_0x367395[_0x53fb('0x16')]?_0x367395[_0x53fb('0x16')][_0x53fb('0x18')]||null:null,'attributes':_0x367395['options']?_0x367395[_0x53fb('0x16')][_0x53fb('0x19')]||null:null,'limit':_0x367395['options']?_0x367395[_0x53fb('0x16')]['limit']||null:null,'include':_0x367395[_0x53fb('0x16')]?_0x367395[_0x53fb('0x16')][_0x53fb('0x1a')]?_[_0x53fb('0x1b')](_0x367395['options']['include'],function(_0x4229cb){return{'model':db[_0x4229cb[_0x53fb('0x1c')]],'as':_0x4229cb['as'],'attributes':_0x4229cb[_0x53fb('0x19')],'include':_0x4229cb[_0x53fb('0x1a')]?_['map'](_0x4229cb[_0x53fb('0x1a')],function(_0x268997){return{'model':db[_0x268997[_0x53fb('0x1c')]],'as':_0x268997['as'],'attributes':_0x268997[_0x53fb('0x19')],'include':_0x268997[_0x53fb('0x1a')]?_['map'](_0x268997[_0x53fb('0x1a')],function(_0x564ab8){return{'model':db[_0x564ab8[_0x53fb('0x1c')]],'as':_0x564ab8['as'],'attributes':_0x564ab8[_0x53fb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x53fb('0xa')](function(_0x1c2ad3){logger[_0x53fb('0xb')](_0x53fb('0x13'),_0x367395);logger[_0x53fb('0xc')](_0x53fb('0x13'),_0x367395,JSON['stringify'](_0x1c2ad3));_0x2888d6(_0x1c2ad3);})['catch'](function(_0x2d5d0b){logger[_0x53fb('0xe')](_0x53fb('0x13'),_0x2d5d0b['message'],_0x367395);_0xc4799b(_0x11349b[_0x53fb('0xe')](0x1f4,_0x2d5d0b['message']));});});};exports['ShowTrunk']=function(_0x11bd63){var _0x5e63a2=this;return new Promise(function(_0x468c1e,_0x367271){return db[_0x53fb('0x14')][_0x53fb('0x1d')]({'raw':_0x11bd63[_0x53fb('0x16')]?_0x11bd63[_0x53fb('0x16')][_0x53fb('0x17')]===undefined?!![]:![]:!![],'where':_0x11bd63[_0x53fb('0x16')]?_0x11bd63['options'][_0x53fb('0x18')]||null:null,'attributes':_0x11bd63[_0x53fb('0x16')]?_0x11bd63[_0x53fb('0x16')]['attributes']||null:null,'include':_0x11bd63[_0x53fb('0x16')]?_0x11bd63[_0x53fb('0x16')][_0x53fb('0x1a')]?_['map'](_0x11bd63[_0x53fb('0x16')][_0x53fb('0x1a')],function(_0x136800){return{'model':db[_0x136800[_0x53fb('0x1c')]],'as':_0x136800['as'],'attributes':_0x136800[_0x53fb('0x19')],'include':_0x136800['include']?_[_0x53fb('0x1b')](_0x136800[_0x53fb('0x1a')],function(_0x4d0722){return{'model':db[_0x4d0722['model']],'as':_0x4d0722['as'],'attributes':_0x4d0722[_0x53fb('0x19')],'include':_0x4d0722[_0x53fb('0x1a')]?_[_0x53fb('0x1b')](_0x4d0722[_0x53fb('0x1a')],function(_0x40cdef){return{'model':db[_0x40cdef[_0x53fb('0x1c')]],'as':_0x40cdef['as'],'attributes':_0x40cdef[_0x53fb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x53fb('0xa')](function(_0x4bcb6c){logger[_0x53fb('0xb')](_0x53fb('0x1e'),_0x11bd63);logger[_0x53fb('0xc')](_0x53fb('0x1e'),_0x11bd63,JSON[_0x53fb('0x1f')](_0x4bcb6c));_0x468c1e(_0x4bcb6c);})['catch'](function(_0x25bdeb){logger[_0x53fb('0xe')]('ShowTrunk',_0x25bdeb[_0x53fb('0x10')],_0x11bd63);_0x367271(_0x5e63a2['error'](0x1f4,_0x25bdeb[_0x53fb('0x10')]));});});};
\ No newline at end of file
+var _0xa479=['include','map','model','ShowTrunk','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','error','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit'];(function(_0x30b7d5,_0x405205){var _0x5b40ef=function(_0x4286f4){while(--_0x4286f4){_0x30b7d5['push'](_0x30b7d5['shift']());}};_0x5b40ef(++_0x405205);}(_0xa479,0xb9));var _0x9a47=function(_0x460e85,_0x1c0b16){_0x460e85=_0x460e85-0x0;var _0x4f2b12=_0xa479[_0x460e85];return _0x4f2b12;};'use strict';var _=require(_0x9a47('0x0'));var util=require(_0x9a47('0x1'));var moment=require(_0x9a47('0x2'));var BPromise=require(_0x9a47('0x3'));var rs=require(_0x9a47('0x4'));var fs=require('fs');var Redis=require(_0x9a47('0x5'));var db=require(_0x9a47('0x6'))['db'];var utils=require(_0x9a47('0x7'));var logger=require('../../config/logger')(_0x9a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x9a47('0x9'));var client=jayson[_0x9a47('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9c79,_0x90b39,_0x55460d){return new BPromise(function(_0x23ac2b,_0x2cc609){return client[_0x9a47('0xb')](_0x1e9c79,_0x55460d)[_0x9a47('0xc')](function(_0x293cda){logger[_0x9a47('0xd')]('Trunk,\x20%s,\x20%s',_0x90b39,_0x9a47('0xe'));logger['debug'](_0x9a47('0xf'),_0x90b39,'request\x20sent',JSON[_0x9a47('0x10')](_0x293cda));if(_0x293cda['error']){if(_0x293cda['error'][_0x9a47('0x11')]===0x1f4){logger[_0x9a47('0x12')](_0x9a47('0x13'),_0x90b39,_0x293cda[_0x9a47('0x12')][_0x9a47('0x14')]);return _0x2cc609(_0x293cda[_0x9a47('0x12')][_0x9a47('0x14')]);}logger[_0x9a47('0x12')](_0x9a47('0x13'),_0x90b39,_0x293cda[_0x9a47('0x12')][_0x9a47('0x14')]);return _0x23ac2b(_0x293cda[_0x9a47('0x12')][_0x9a47('0x14')]);}else{logger[_0x9a47('0xd')]('Trunk,\x20%s,\x20%s',_0x90b39,_0x9a47('0xe'));_0x23ac2b(_0x293cda[_0x9a47('0x15')][_0x9a47('0x14')]);}})[_0x9a47('0x16')](function(_0x37841b){logger[_0x9a47('0x12')](_0x9a47('0x13'),_0x90b39,_0x37841b);_0x2cc609(_0x37841b);});});}exports[_0x9a47('0x17')]=function(_0x67403a){var _0x317cbf=this;return new Promise(function(_0x387188,_0x3a08e8){return db[_0x9a47('0x18')][_0x9a47('0x19')]({'raw':_0x67403a[_0x9a47('0x1a')]?_0x67403a[_0x9a47('0x1a')][_0x9a47('0x1b')]===undefined?!![]:![]:!![],'where':_0x67403a[_0x9a47('0x1a')]?_0x67403a['options'][_0x9a47('0x1c')]||null:null,'attributes':_0x67403a[_0x9a47('0x1a')]?_0x67403a[_0x9a47('0x1a')][_0x9a47('0x1d')]||null:null,'limit':_0x67403a['options']?_0x67403a[_0x9a47('0x1a')][_0x9a47('0x1e')]||null:null,'include':_0x67403a[_0x9a47('0x1a')]?_0x67403a['options'][_0x9a47('0x1f')]?_[_0x9a47('0x20')](_0x67403a[_0x9a47('0x1a')][_0x9a47('0x1f')],function(_0x2efa9f){return{'model':db[_0x2efa9f[_0x9a47('0x21')]],'as':_0x2efa9f['as'],'attributes':_0x2efa9f[_0x9a47('0x1d')],'include':_0x2efa9f[_0x9a47('0x1f')]?_['map'](_0x2efa9f[_0x9a47('0x1f')],function(_0xc3e5c7){return{'model':db[_0xc3e5c7['model']],'as':_0xc3e5c7['as'],'attributes':_0xc3e5c7[_0x9a47('0x1d')],'include':_0xc3e5c7['include']?_[_0x9a47('0x20')](_0xc3e5c7[_0x9a47('0x1f')],function(_0x100a2a){return{'model':db[_0x100a2a['model']],'as':_0x100a2a['as'],'attributes':_0x100a2a['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a47('0xc')](function(_0x464a72){logger[_0x9a47('0xd')](_0x9a47('0x17'),_0x67403a);logger['debug'](_0x9a47('0x17'),_0x67403a,JSON['stringify'](_0x464a72));_0x387188(_0x464a72);})[_0x9a47('0x16')](function(_0x3efa40){logger[_0x9a47('0x12')](_0x9a47('0x17'),_0x3efa40[_0x9a47('0x14')],_0x67403a);_0x3a08e8(_0x317cbf[_0x9a47('0x12')](0x1f4,_0x3efa40['message']));});});};exports[_0x9a47('0x22')]=function(_0x4a94d4){var _0x4d7efd=this;return new Promise(function(_0x2317f7,_0x2c6485){return db[_0x9a47('0x18')]['find']({'raw':_0x4a94d4[_0x9a47('0x1a')]?_0x4a94d4['options'][_0x9a47('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a94d4[_0x9a47('0x1a')]?_0x4a94d4[_0x9a47('0x1a')][_0x9a47('0x1c')]||null:null,'attributes':_0x4a94d4[_0x9a47('0x1a')]?_0x4a94d4[_0x9a47('0x1a')][_0x9a47('0x1d')]||null:null,'include':_0x4a94d4[_0x9a47('0x1a')]?_0x4a94d4[_0x9a47('0x1a')][_0x9a47('0x1f')]?_['map'](_0x4a94d4[_0x9a47('0x1a')]['include'],function(_0x21e8f4){return{'model':db[_0x21e8f4[_0x9a47('0x21')]],'as':_0x21e8f4['as'],'attributes':_0x21e8f4[_0x9a47('0x1d')],'include':_0x21e8f4['include']?_[_0x9a47('0x20')](_0x21e8f4[_0x9a47('0x1f')],function(_0x4f584f){return{'model':db[_0x4f584f[_0x9a47('0x21')]],'as':_0x4f584f['as'],'attributes':_0x4f584f[_0x9a47('0x1d')],'include':_0x4f584f[_0x9a47('0x1f')]?_[_0x9a47('0x20')](_0x4f584f[_0x9a47('0x1f')],function(_0x8ab214){return{'model':db[_0x8ab214['model']],'as':_0x8ab214['as'],'attributes':_0x8ab214[_0x9a47('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9a47('0xc')](function(_0x119373){logger[_0x9a47('0xd')](_0x9a47('0x22'),_0x4a94d4);logger[_0x9a47('0x23')](_0x9a47('0x22'),_0x4a94d4,JSON['stringify'](_0x119373));_0x2317f7(_0x119373);})['catch'](function(_0xf8d76b){logger[_0x9a47('0x12')](_0x9a47('0x22'),_0xf8d76b[_0x9a47('0x14')],_0x4a94d4);_0x2c6485(_0x4d7efd[_0x9a47('0x12')](0x1f4,_0xf8d76b['message']));});});};
\ No newline at end of file
index f7a1e01..85d7a03 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x28e9=['./user-setting.controller','/:id','isAuthenticated','update','Router','../../components/auth/service'];(function(_0x160692,_0x352f6f){var _0x2becb8=function(_0x6fcafb){while(--_0x6fcafb){_0x160692['push'](_0x160692['shift']());}};_0x2becb8(++_0x352f6f);}(_0x28e9,0x130));var _0x928e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x28e9[_0x4a9fb1];return _0x348672;};'use strict';var express=require('express');var router=express[_0x928e('0x0')]();var auth=require(_0x928e('0x1'));var controller=require(_0x928e('0x2'));router['put'](_0x928e('0x3'),auth[_0x928e('0x4')](),controller[_0x928e('0x5')]);module['exports']=router;
\ No newline at end of file
+var _0xea4e=['express','Router','../../components/auth/service','update','exports'];(function(_0x41a198,_0x3e5b08){var _0x2f35e2=function(_0x3c9859){while(--_0x3c9859){_0x41a198['push'](_0x41a198['shift']());}};_0x2f35e2(++_0x3e5b08);}(_0xea4e,0x127));var _0xeea4=function(_0x1d0764,_0x2beb7c){_0x1d0764=_0x1d0764-0x0;var _0x423f49=_0xea4e[_0x1d0764];return _0x423f49;};'use strict';var express=require(_0xeea4('0x0'));var router=express[_0xeea4('0x1')]();var auth=require(_0xeea4('0x2'));var controller=require('./user-setting.controller');router['put']('/:id',auth['isAuthenticated'](),controller[_0xeea4('0x3')]);module[_0xeea4('0x4')]=router;
\ No newline at end of file
index 478a39d..2893353 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6ae7=['debug','exports','ENUM','TEXT','INTEGER','error','warning','info'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x6ae7,0xb5));var _0x76ae=function(_0x211a30,_0x153dda){_0x211a30=_0x211a30-0x0;var _0x43f470=_0x6ae7[_0x211a30];return _0x43f470;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x76ae('0x0'),_0x76ae('0x1'),_0x76ae('0x2'),_0x76ae('0x3')];module[_0x76ae('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x76ae('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x76ae('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x76ae('0x7')],'unique':'UserId'}};
\ No newline at end of file
+var _0xa01e=['BOOLEAN','DATE','INTEGER','UserId','sequelize','warning','info','debug','exports','ENUM','error'];(function(_0x454969,_0x2facc6){var _0x14bf87=function(_0x477bd7){while(--_0x477bd7){_0x454969['push'](_0x454969['shift']());}};_0x14bf87(++_0x2facc6);}(_0xa01e,0xbf));var _0xea01=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa01e[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require(_0xea01('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xea01('0x1'),_0xea01('0x2'),_0xea01('0x3')];module[_0xea01('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xea01('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xea01('0x6'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xea01('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xea01('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xea01('0x9')],'unique':_0xea01('0xa')}};
\ No newline at end of file
index 1d9155b..39fb4ba 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x90ae=['then','sendStatus','error','name','role','admin','params','body','catch','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','status','json','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x90ae,0x195));var _0xe90a=function(_0x5ee624,_0x5c2676){_0x5ee624=_0x5ee624-0x0;var _0x177e46=_0x90ae[_0x5ee624];return _0x177e46;};'use strict';var _=require(_0xe90a('0x0'));var Redis=require(_0xe90a('0x1'));var logger=require(_0xe90a('0x2'))('api');var config=require(_0xe90a('0x3'));var db=require(_0xe90a('0x4'))['db'];var socket=require(_0xe90a('0x5'))(new Redis(config[_0xe90a('0x6')]));require(_0xe90a('0x7'))[_0xe90a('0x8')](socket);config[_0xe90a('0x6')]=_[_0xe90a('0x9')](config[_0xe90a('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x203575,_0x280721){_0x280721=_0x280721||0xc8;return function(_0x24b470){if(_0x24b470){return _0x203575[_0xe90a('0xa')](_0x280721)[_0xe90a('0xb')](_0x24b470);}};}function saveUpdates(_0x2602fa){return function(_0x592294){if(_0x592294){return _0x592294[_0xe90a('0xc')](_0x2602fa)[_0xe90a('0xd')](function(_0x2f08cc){return _0x2f08cc;});}return null;};}function handleEntityNotFound(_0x177f29){return function(_0x465cdd){if(!_0x465cdd){_0x177f29[_0xe90a('0xe')](0x194);}return _0x465cdd;};}function handleError(_0x1ea46b,_0x589103){_0x589103=_0x589103||0x1f4;return function(_0x3a77f3){logger[_0xe90a('0xf')](_0x3a77f3['stack']);if(_0x3a77f3['name']){delete _0x3a77f3[_0xe90a('0x10')];}_0x1ea46b[_0xe90a('0xa')](_0x589103)['send'](_0x3a77f3);};}exports[_0xe90a('0xc')]=function(_0xd215c8,_0x20ea41){if(_0xd215c8['user'][_0xe90a('0x11')]!==_0xe90a('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0xd215c8[_0xe90a('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db['UserSetting']['find']({'where':{'id':_0xd215c8[_0xe90a('0x13')]['id']}})[_0xe90a('0xd')](handleEntityNotFound(_0x20ea41,null))[_0xe90a('0xd')](saveUpdates(_0xd215c8[_0xe90a('0x14')],null))[_0xe90a('0xd')](respondWithResult(_0x20ea41,null))[_0xe90a('0x15')](handleError(_0x20ea41,null));};
\ No newline at end of file
+var _0x26cf=['catch','ioredis','../../config/logger','../../config/environment','socket.io-emitter','./user-setting.socket','register','defaults','redis','localhost','update','then','sendStatus','error','stack','name','status','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x26cf,0x135));var _0xf26c=function(_0x2a0119,_0x5237b3){_0x2a0119=_0x2a0119-0x0;var _0x2a7cff=_0x26cf[_0x2a0119];return _0x2a7cff;};'use strict';var _=require('lodash');var Redis=require(_0xf26c('0x0'));var logger=require(_0xf26c('0x1'))('api');var config=require(_0xf26c('0x2'));var db=require('../../mysqldb')['db'];var socket=require(_0xf26c('0x3'))(new Redis(config['redis']));require(_0xf26c('0x4'))[_0xf26c('0x5')](socket);config['redis']=_[_0xf26c('0x6')](config[_0xf26c('0x7')],{'host':_0xf26c('0x8'),'port':0x18eb});function respondWithResult(_0x325edc,_0x7fb718){_0x7fb718=_0x7fb718||0xc8;return function(_0x32d754){if(_0x32d754){return _0x325edc['status'](_0x7fb718)['json'](_0x32d754);}};}function saveUpdates(_0xb7b409){return function(_0x183751){if(_0x183751){return _0x183751[_0xf26c('0x9')](_0xb7b409)[_0xf26c('0xa')](function(_0x3e1c2c){return _0x3e1c2c;});}return null;};}function handleEntityNotFound(_0x3d031a){return function(_0xf065bd){if(!_0xf065bd){_0x3d031a[_0xf26c('0xb')](0x194);}return _0xf065bd;};}function handleError(_0x5ba445,_0x342cd6){_0x342cd6=_0x342cd6||0x1f4;return function(_0x341808){logger[_0xf26c('0xc')](_0x341808[_0xf26c('0xd')]);if(_0x341808[_0xf26c('0xe')]){delete _0x341808['name'];}_0x5ba445[_0xf26c('0xf')](_0x342cd6)['send'](_0x341808);};}exports[_0xf26c('0x9')]=function(_0x5684d3,_0x8e5313){if(_0x5684d3['user'][_0xf26c('0x10')]!=='admin')throw new Error(_0xf26c('0x11'));if(isNaN(Number(_0x5684d3[_0xf26c('0x12')]['id'])))throw new Error(_0xf26c('0x13'));return db[_0xf26c('0x14')]['find']({'where':{'id':_0x5684d3['params']['id']}})[_0xf26c('0xa')](handleEntityNotFound(_0x8e5313,null))[_0xf26c('0xa')](saveUpdates(_0x5684d3['body'],null))[_0xf26c('0xa')](respondWithResult(_0x8e5313,null))[_0xf26c('0x15')](handleError(_0x8e5313,null));};
\ No newline at end of file
index 3a1e18c..42138b8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb06a=['update','emit','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','save'];(function(_0x2fbcf6,_0x2e7155){var _0x3e7265=function(_0x15a3c3){while(--_0x15a3c3){_0x2fbcf6['push'](_0x2fbcf6['shift']());}};_0x3e7265(++_0x2e7155);}(_0xb06a,0x13f));var _0xab06=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0xb06a[_0x5311a1];return _0x2acb9f;};'use strict';var EventEmitter=require(_0xab06('0x0'));var UserSetting=require(_0xab06('0x1'))['db'][_0xab06('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xab06('0x3')](0x0);var events={'afterCreate':_0xab06('0x4'),'afterUpdate':_0xab06('0x5'),'afterDestroy':'remove'};function emitEvent(_0x493a88){return function(_0x1bab41,_0x434163,_0x3cad0d){UserSettingEvents[_0xab06('0x6')](_0x493a88+':'+_0x1bab41['id'],_0x1bab41);UserSettingEvents['emit'](_0x493a88,_0x1bab41);_0x3cad0d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xab06('0x7')](e,emitEvent(event));}}module[_0xab06('0x8')]=UserSettingEvents;
\ No newline at end of file
+var _0xd60c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting','save','remove'];(function(_0x4af26a,_0xee34de){var _0x4511f9=function(_0x294407){while(--_0x294407){_0x4af26a['push'](_0x4af26a['shift']());}};_0x4511f9(++_0xee34de);}(_0xd60c,0x1d8));var _0xcd60=function(_0x4dd2d9,_0x123b23){_0x4dd2d9=_0x4dd2d9-0x0;var _0x4cecfc=_0xd60c[_0x4dd2d9];return _0x4cecfc;};'use strict';var EventEmitter=require(_0xcd60('0x0'));var UserSetting=require(_0xcd60('0x1'))['db'][_0xcd60('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcd60('0x3'),'afterUpdate':'update','afterDestroy':_0xcd60('0x4')};function emitEvent(_0x2271bc){return function(_0x5b1026,_0xa4ea8a,_0xbb2b97){UserSettingEvents[_0xcd60('0x5')](_0x2271bc+':'+_0x5b1026['id'],_0x5b1026);UserSettingEvents[_0xcd60('0x5')](_0x2271bc,_0x5b1026);_0xbb2b97(null);};}for(var e in events){if(events[_0xcd60('0x6')](e)){var event=events[e];UserSetting[_0xcd60('0x7')](e,emitEvent(event));}}module[_0xcd60('0x8')]=UserSettingEvents;
\ No newline at end of file
index d7b3cff..3e08522 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x20df=['define','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0xc6cf56,_0x54f2e3){var _0x46aa2b=function(_0x2a65d6){while(--_0x2a65d6){_0xc6cf56['push'](_0xc6cf56['shift']());}};_0x46aa2b(++_0x54f2e3);}(_0x20df,0x7c));var _0xf20d=function(_0x4c7b20,_0x361515){_0x4c7b20=_0x4c7b20-0x0;var _0x4872bd=_0x20df[_0x4c7b20];return _0x4872bd;};'use strict';var attributes=require(_0xf20d('0x0'));module[_0xf20d('0x1')]=function(_0x44f997){return _0x44f997[_0xf20d('0x2')]('UserSetting',attributes,{'tableName':_0xf20d('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd2e60b){if(!_0xd2e60b[_0xf20d('0x4')])_0xd2e60b[_0xf20d('0x5')]=null;else if(_0xd2e60b[_0xf20d('0x5')]===null)_0xd2e60b['clientSideLoggingEnabledSince']=new Date();}}});};
\ No newline at end of file
+var _0x83e1=['exports','define','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x164aa1,_0x5a97ed){var _0x4b8b1d=function(_0x30d5af){while(--_0x30d5af){_0x164aa1['push'](_0x164aa1['shift']());}};_0x4b8b1d(++_0x5a97ed);}(_0x83e1,0x1ad));var _0x183e=function(_0x35d687,_0x28ec7d){_0x35d687=_0x35d687-0x0;var _0x3187af=_0x83e1[_0x35d687];return _0x3187af;};'use strict';var attributes=require(_0x183e('0x0'));module[_0x183e('0x1')]=function(_0x5f5222){return _0x5f5222[_0x183e('0x2')]('UserSetting',attributes,{'tableName':_0x183e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59d53f){if(!_0x59d53f['clientSideLoggingEnabled'])_0x59d53f[_0x183e('0x4')]=null;else if(_0x59d53f[_0x183e('0x4')]===null)_0x59d53f['clientSideLoggingEnabledSince']=new Date();}}});};
\ No newline at end of file
index 38f1e95..7ec715c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4507=['UserId','register','length','user-setting:','./user-setting.events','remove','update','emit','user-setting:update','user-setting:update:user-'];(function(_0x10acf7,_0x3b5452){var _0x5b3a7a=function(_0x4e1749){while(--_0x4e1749){_0x10acf7['push'](_0x10acf7['shift']());}};_0x5b3a7a(++_0x3b5452);}(_0x4507,0xcc));var _0x7450=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4507[_0x57b54c];return _0x59cc19;};'use strict';var UserSettingEvents=require(_0x7450('0x0'));var events=['save',_0x7450('0x1'),_0x7450('0x2')];function createListener(_0x39a43f,_0x3685ae){return function(_0x52a3ef){_0x3685ae[_0x7450('0x3')](_0x39a43f,_0x52a3ef);if(_0x39a43f===_0x7450('0x4')){_0x3685ae[_0x7450('0x3')](_0x7450('0x5')+_0x52a3ef[_0x7450('0x6')],_0x52a3ef);}};}exports[_0x7450('0x7')]=function(_0x33e8b5){for(var _0x146379=0x0,_0xb113ba=events[_0x7450('0x8')];_0x146379<_0xb113ba;_0x146379++){var _0x355151=events[_0x146379];var _0x386820=createListener(_0x7450('0x9')+_0x355151,_0x33e8b5);UserSettingEvents['on'](_0x355151,_0x386820);}};
\ No newline at end of file
+var _0xaca7=['user-setting:update:user-','register','user-setting:','./user-setting.events','save','remove','user-setting:update','emit'];(function(_0x345e4c,_0x3e73ba){var _0x40c41c=function(_0x23dfe0){while(--_0x23dfe0){_0x345e4c['push'](_0x345e4c['shift']());}};_0x40c41c(++_0x3e73ba);}(_0xaca7,0x1d3));var _0x7aca=function(_0x55a707,_0x43fc6a){_0x55a707=_0x55a707-0x0;var _0x32bfe7=_0xaca7[_0x55a707];return _0x32bfe7;};'use strict';var UserSettingEvents=require(_0x7aca('0x0'));var events=[_0x7aca('0x1'),_0x7aca('0x2'),'update'];function createListener(_0x5ec5d8,_0x2f107e){return function(_0x3853d4){_0x2f107e['emit'](_0x5ec5d8,_0x3853d4);if(_0x5ec5d8===_0x7aca('0x3')){_0x2f107e[_0x7aca('0x4')](_0x7aca('0x5')+_0x3853d4['UserId'],_0x3853d4);}};}exports[_0x7aca('0x6')]=function(_0x350417){for(var _0x2156e3=0x0,_0x34e9bc=events['length'];_0x2156e3<_0x34e9bc;_0x2156e3++){var _0x32695c=events[_0x2156e3];var _0x558c62=createListener(_0x7aca('0x7')+_0x32695c,_0x350417);UserSettingEvents['on'](_0x32695c,_0x558c62);}};
\ No newline at end of file
index 8ae173d..ac4230f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb565=['/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','join','root','server/files/images/','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','index','isAuthenticated','/presence','getPresence','/:id','show'];(function(_0x10266a,_0x1cfa84){var _0x334f87=function(_0x1d756f){while(--_0x1d756f){_0x10266a['push'](_0x10266a['shift']());}};_0x334f87(++_0x1cfa84);}(_0xb565,0x67));var _0x5b56=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0xb565[_0x5db657];return _0x2d6e70;};'use strict';var multer=require('multer');var util=require(_0x5b56('0x0'));var path=require(_0x5b56('0x1'));var timeout=require('connect-timeout');var express=require(_0x5b56('0x2'));var router=express[_0x5b56('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5b56('0x4'));var config=require(_0x5b56('0x5'));var controller=require(_0x5b56('0x6'));router[_0x5b56('0x7')]('/',auth['isAuthenticated'](),controller[_0x5b56('0x8')]);router[_0x5b56('0x7')]('/describe',auth[_0x5b56('0x9')](),controller['describe']);router[_0x5b56('0x7')]('/whoami',auth[_0x5b56('0x9')](),controller['whoami']);router[_0x5b56('0x7')](_0x5b56('0xa'),auth['isAuthenticated'](),controller[_0x5b56('0xb')]);router[_0x5b56('0x7')](_0x5b56('0xc'),auth['isAuthenticated'](),controller[_0x5b56('0xd')]);router['get'](_0x5b56('0xe'),controller[_0x5b56('0xf')]);router[_0x5b56('0x7')](_0x5b56('0x10'),auth[_0x5b56('0x9')](),controller['getOpenTabs']);router[_0x5b56('0x7')](_0x5b56('0x11'),auth[_0x5b56('0x9')](),controller['getContacts']);router['get'](_0x5b56('0x12'),auth['isAuthenticated'](),controller[_0x5b56('0x13')]);router[_0x5b56('0x7')]('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x5b56('0x14')]);router[_0x5b56('0x7')](_0x5b56('0x15'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x16')]);router[_0x5b56('0x7')](_0x5b56('0x17'),auth['isAuthenticated'](),controller['getRecordings']);router[_0x5b56('0x7')](_0x5b56('0x18'),auth['isAuthenticated'](),controller[_0x5b56('0x19')]);router[_0x5b56('0x7')](_0x5b56('0x1a'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x1b')]);router[_0x5b56('0x7')]('/:id/openchannel/interactions',auth[_0x5b56('0x9')](),controller[_0x5b56('0x1c')]);router[_0x5b56('0x7')](_0x5b56('0x1d'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x1e')]);router[_0x5b56('0x7')]('/:id/sms/interactions',auth[_0x5b56('0x9')](),controller[_0x5b56('0x1f')]);router[_0x5b56('0x7')](_0x5b56('0x20'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x21')]);router[_0x5b56('0x7')](_0x5b56('0x22'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x23')]);router[_0x5b56('0x7')](_0x5b56('0x24'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x25')]);router[_0x5b56('0x7')]('/:id/lists',auth['isAuthenticated'](),controller[_0x5b56('0x26')]);router[_0x5b56('0x7')](_0x5b56('0x27'),auth[_0x5b56('0x9')](),controller['getAgents']);router[_0x5b56('0x7')](_0x5b56('0x28'),auth[_0x5b56('0x9')](),controller['getVoicePrefixes']);router[_0x5b56('0x7')](_0x5b56('0x29'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x2a')]);router[_0x5b56('0x7')]('/:id/mail_accounts',auth[_0x5b56('0x9')](),controller['getMailAccounts']);router[_0x5b56('0x7')](_0x5b56('0x2b'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x2c')]);router[_0x5b56('0x7')](_0x5b56('0x2d'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x2e')]);router['get']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x5b56('0x2f')]);router['get'](_0x5b56('0x30'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x31')]);router['get'](_0x5b56('0x32'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x33')]);router[_0x5b56('0x7')](_0x5b56('0x34'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x35')]);router[_0x5b56('0x7')](_0x5b56('0x36'),auth['isAuthenticated'](),controller[_0x5b56('0x37')]);router[_0x5b56('0x38')](_0x5b56('0x11'),auth['isAuthenticated'](),controller[_0x5b56('0x39')]);router[_0x5b56('0x38')]('/',auth[_0x5b56('0x9')](),controller[_0x5b56('0x3a')]);router[_0x5b56('0x38')](_0x5b56('0x3b'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x3c')]);router['post'](_0x5b56('0x12'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x3d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19bc01,_0xe0bbfd,_0x2cd5fa){_0x2cd5fa(null,path[_0x5b56('0x3e')](config[_0x5b56('0x3f')],_0x5b56('0x40')));},'filename':function(_0x16413d,_0x819948,_0xb0c497){_0xb0c497(null,util['format']('%s-%s',Date[_0x5b56('0x41')](),_0x819948[_0x5b56('0x42')]));}})});router[_0x5b56('0x38')](_0x5b56('0xe'),upload[_0x5b56('0x43')](_0x5b56('0x44')),controller[_0x5b56('0x45')]);router[_0x5b56('0x38')](_0x5b56('0x46'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x47')]);router['post'](_0x5b56('0x48'),auth['isAuthenticated'](),controller[_0x5b56('0x49')]);router[_0x5b56('0x38')](_0x5b56('0x4a'),auth[_0x5b56('0x9')](),controller['pause']);router['post'](_0x5b56('0x4b'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x4c')]);router[_0x5b56('0x38')](_0x5b56('0x24'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x4d')]);router[_0x5b56('0x38')](_0x5b56('0x4e'),auth[_0x5b56('0x9')](),controller['addChatInteractions']);router[_0x5b56('0x38')](_0x5b56('0x4f'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x50')]);router[_0x5b56('0x38')](_0x5b56('0x51'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x52')]);router[_0x5b56('0x38')]('/:id/sms_interactions',auth[_0x5b56('0x9')](),controller['addSmsInteractions']);router[_0x5b56('0x38')](_0x5b56('0x53'),auth['isAuthenticated'](),controller[_0x5b56('0x54')]);router[_0x5b56('0x38')]('/:id/whatsapp_interactions',auth[_0x5b56('0x9')](),controller[_0x5b56('0x55')]);router[_0x5b56('0x38')](_0x5b56('0x29'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x56')]);router[_0x5b56('0x38')](_0x5b56('0x57'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x58')]);router[_0x5b56('0x38')](_0x5b56('0x2b'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x59')]);router[_0x5b56('0x38')](_0x5b56('0x2d'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x5a')]);router['post'](_0x5b56('0x5b'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x5c')]);router[_0x5b56('0x38')](_0x5b56('0x30'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x5d')]);router[_0x5b56('0x38')](_0x5b56('0x32'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x5e')]);router['post'](_0x5b56('0x36'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x5f')]);router[_0x5b56('0x60')](_0x5b56('0xc'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x61')]);router['put']('/:id/password',auth[_0x5b56('0x9')](),controller[_0x5b56('0x62')]);router['delete'](_0x5b56('0x12'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x63')]);router[_0x5b56('0x64')]('/:id/teams',auth[_0x5b56('0x9')](),controller[_0x5b56('0x65')]);router[_0x5b56('0x64')](_0x5b56('0xc'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x66')]);router[_0x5b56('0x64')](_0x5b56('0x4e'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x67')]);router[_0x5b56('0x64')](_0x5b56('0x4f'),auth['isAuthenticated'](),controller[_0x5b56('0x68')]);router[_0x5b56('0x64')](_0x5b56('0x51'),auth[_0x5b56('0x9')](),controller['removeFaxInteractions']);router[_0x5b56('0x64')](_0x5b56('0x69'),auth['isAuthenticated'](),controller[_0x5b56('0x6a')]);router[_0x5b56('0x64')](_0x5b56('0x53'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x6b')]);router[_0x5b56('0x64')](_0x5b56('0x6c'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x6d')]);router[_0x5b56('0x64')](_0x5b56('0x29'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x5b56('0x64')](_0x5b56('0x57'),auth['isAuthenticated'](),controller['removeMailAccounts']);router['delete']('/:id/openchannel_accounts',auth[_0x5b56('0x9')](),controller[_0x5b56('0x6e')]);router[_0x5b56('0x64')](_0x5b56('0x2d'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x6f')]);router['delete']('/:id/chat_websites',auth[_0x5b56('0x9')](),controller[_0x5b56('0x70')]);router[_0x5b56('0x64')]('/:id/whatsapp_accounts',auth[_0x5b56('0x9')](),controller[_0x5b56('0x71')]);router[_0x5b56('0x64')](_0x5b56('0x32'),auth[_0x5b56('0x9')](),controller[_0x5b56('0x72')]);router[_0x5b56('0x64')]('/:id/api_key',auth[_0x5b56('0x9')](),controller[_0x5b56('0x73')]);module[_0x5b56('0x74')]=router;
\ No newline at end of file
+var _0x63ea=['create','/create_many','bulkCreate','addQueues','diskStorage','join','root','%s-%s','now','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','unpause','addTeams','/:id/chat_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','update','/:id/password','changePassword','removeQueues','delete','/:id/teams','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','/whoami','whoami','/presence','/:id','show','getAvatar','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/lists','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x63ea,0x113));var _0xa63e=function(_0x1a86a8,_0x49b4cf){_0x1a86a8=_0x1a86a8-0x0;var _0x26399e=_0x63ea[_0x1a86a8];return _0x26399e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa63e('0x0'));var timeout=require(_0xa63e('0x1'));var express=require(_0xa63e('0x2'));var router=express[_0xa63e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa63e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa63e('0x5'));var controller=require(_0xa63e('0x6'));router[_0xa63e('0x7')]('/',auth['isAuthenticated'](),controller[_0xa63e('0x8')]);router[_0xa63e('0x7')](_0xa63e('0x9'),auth[_0xa63e('0xa')](),controller['describe']);router['get'](_0xa63e('0xb'),auth['isAuthenticated'](),controller[_0xa63e('0xc')]);router[_0xa63e('0x7')](_0xa63e('0xd'),auth[_0xa63e('0xa')](),controller['getPresence']);router[_0xa63e('0x7')](_0xa63e('0xe'),auth[_0xa63e('0xa')](),controller[_0xa63e('0xf')]);router[_0xa63e('0x7')]('/:id/avatar',controller[_0xa63e('0x10')]);router[_0xa63e('0x7')]('/:id/open_tabs',auth[_0xa63e('0xa')](),controller['getOpenTabs']);router[_0xa63e('0x7')](_0xa63e('0x11'),auth[_0xa63e('0xa')](),controller['getContacts']);router['get'](_0xa63e('0x12'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x13')]);router[_0xa63e('0x7')](_0xa63e('0x14'),auth[_0xa63e('0xa')](),controller['getVoiceQueuesRt']);router['get'](_0xa63e('0x15'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x16')]);router[_0xa63e('0x7')](_0xa63e('0x17'),auth['isAuthenticated'](),controller[_0xa63e('0x18')]);router['get']('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0xa63e('0x19')]);router[_0xa63e('0x7')](_0xa63e('0x1a'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x1b')]);router[_0xa63e('0x7')](_0xa63e('0x1c'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router['get'](_0xa63e('0x1d'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x1e')]);router['get'](_0xa63e('0x1f'),auth['isAuthenticated'](),controller[_0xa63e('0x20')]);router[_0xa63e('0x7')](_0xa63e('0x21'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x22')]);router[_0xa63e('0x7')](_0xa63e('0x23'),auth['isAuthenticated'](),controller[_0xa63e('0x24')]);router['get']('/:id/teams',auth[_0xa63e('0xa')](),controller['getTeams']);router[_0xa63e('0x7')](_0xa63e('0x25'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x26')]);router[_0xa63e('0x7')]('/:id/agents',auth['isAuthenticated'](),controller[_0xa63e('0x27')]);router[_0xa63e('0x7')]('/:id/prefixes',auth[_0xa63e('0xa')](),controller[_0xa63e('0x28')]);router['get'](_0xa63e('0x29'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x2a')]);router[_0xa63e('0x7')](_0xa63e('0x2b'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x2c')]);router['get'](_0xa63e('0x2d'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x2e')]);router[_0xa63e('0x7')](_0xa63e('0x2f'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x30')]);router[_0xa63e('0x7')](_0xa63e('0x31'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x32')]);router['get'](_0xa63e('0x33'),auth[_0xa63e('0xa')](),controller['getWhatsappAccounts']);router[_0xa63e('0x7')](_0xa63e('0x34'),auth[_0xa63e('0xa')](),controller['getSquareProjects']);router[_0xa63e('0x7')](_0xa63e('0x35'),auth[_0xa63e('0xa')](),controller['getScheduledCalls']);router[_0xa63e('0x7')](_0xa63e('0x36'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x37')]);router[_0xa63e('0x38')](_0xa63e('0x11'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x39')]);router[_0xa63e('0x38')]('/',auth[_0xa63e('0xa')](),controller[_0xa63e('0x3a')]);router[_0xa63e('0x38')](_0xa63e('0x3b'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x3c')]);router[_0xa63e('0x38')](_0xa63e('0x12'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x3d')]);var upload=multer({'storage':multer[_0xa63e('0x3e')]({'destination':function(_0x2ca8ee,_0x1337f,_0x46bf6d){_0x46bf6d(null,path[_0xa63e('0x3f')](config[_0xa63e('0x40')],'server/files/images/'));},'filename':function(_0x2359a6,_0x44a4d8,_0x53ebec){_0x53ebec(null,util['format'](_0xa63e('0x41'),Date[_0xa63e('0x42')](),_0x44a4d8[_0xa63e('0x43')]));}})});router[_0xa63e('0x38')](_0xa63e('0x44'),upload[_0xa63e('0x45')](_0xa63e('0x46')),controller[_0xa63e('0x47')]);router[_0xa63e('0x38')](_0xa63e('0x48'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x49')]);router['post'](_0xa63e('0x4a'),auth['isAuthenticated'](),controller['logout']);router[_0xa63e('0x38')]('/:id/pause',auth[_0xa63e('0xa')](),controller['pause']);router[_0xa63e('0x38')]('/:id/unpause',auth[_0xa63e('0xa')](),controller[_0xa63e('0x4b')]);router[_0xa63e('0x38')]('/:id/teams',auth[_0xa63e('0xa')](),controller[_0xa63e('0x4c')]);router[_0xa63e('0x38')](_0xa63e('0x4d'),auth[_0xa63e('0xa')](),controller['addChatInteractions']);router['post']('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xa63e('0x4e')]);router[_0xa63e('0x38')](_0xa63e('0x4f'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x50')]);router[_0xa63e('0x38')](_0xa63e('0x51'),auth[_0xa63e('0xa')](),controller['addSmsInteractions']);router[_0xa63e('0x38')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router['post'](_0xa63e('0x52'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x53')]);router['post'](_0xa63e('0x29'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x54')]);router[_0xa63e('0x38')](_0xa63e('0x2b'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x55')]);router[_0xa63e('0x38')](_0xa63e('0x2d'),auth[_0xa63e('0xa')](),controller['addOpenchannelAccounts']);router['post'](_0xa63e('0x2f'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x56')]);router[_0xa63e('0x38')](_0xa63e('0x31'),auth['isAuthenticated'](),controller[_0xa63e('0x57')]);router[_0xa63e('0x38')]('/:id/whatsapp_accounts',auth[_0xa63e('0xa')](),controller[_0xa63e('0x58')]);router[_0xa63e('0x38')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0xa63e('0x59')]);router['post'](_0xa63e('0x36'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x5a')]);router['put'](_0xa63e('0xe'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x5b')]);router['put'](_0xa63e('0x5c'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x5d')]);router['delete']('/:id/queues',auth[_0xa63e('0xa')](),controller[_0xa63e('0x5e')]);router[_0xa63e('0x5f')](_0xa63e('0x60'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x61')]);router[_0xa63e('0x5f')](_0xa63e('0xe'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x62')]);router[_0xa63e('0x5f')](_0xa63e('0x4d'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x63')]);router[_0xa63e('0x5f')]('/:id/mail_interactions',auth[_0xa63e('0xa')](),controller[_0xa63e('0x64')]);router[_0xa63e('0x5f')](_0xa63e('0x4f'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0xa63e('0x5f')](_0xa63e('0x51'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x65')]);router['delete'](_0xa63e('0x66'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x67')]);router[_0xa63e('0x5f')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xa63e('0x68')]);router[_0xa63e('0x5f')](_0xa63e('0x29'),auth[_0xa63e('0xa')](),controller['removeFaxAccounts']);router[_0xa63e('0x5f')](_0xa63e('0x2b'),auth[_0xa63e('0xa')](),controller['removeMailAccounts']);router['delete'](_0xa63e('0x2d'),auth['isAuthenticated'](),controller[_0xa63e('0x69')]);router[_0xa63e('0x5f')]('/:id/sms_accounts',auth[_0xa63e('0xa')](),controller['removeSmsAccounts']);router['delete']('/:id/chat_websites',auth[_0xa63e('0xa')](),controller[_0xa63e('0x6a')]);router[_0xa63e('0x5f')]('/:id/whatsapp_accounts',auth[_0xa63e('0xa')](),controller[_0xa63e('0x6b')]);router[_0xa63e('0x5f')](_0xa63e('0x34'),auth[_0xa63e('0xa')](),controller[_0xa63e('0x6c')]);router[_0xa63e('0x5f')]('/:id/api_key',auth[_0xa63e('0xa')](),controller[_0xa63e('0x6d')]);module[_0xa63e('0x6e')]=router;
\ No newline at end of file
index c7d8501..67913f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
index 6a3cffb..ed6c775 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe5eb=['status','json','offset','undefined','limit','count','set','emit','userNotification:recalc:','destroy','get','role','admin','Users','user','Telephones','telephone','map','value','includes','find','UserProfileResource','stack','name','send','index','User','fieldName','type','key','filter','password','getOptions','where','query','include','userSetting','true','UserSetting','attributes','findAll','rows','openTabs','length','push','chat','sms','dataValues','fax','mail','openchannel','whatsapp','model','keys','rawAttributes','salt','filters','intersection','fields','includeAll','merge','options','all','update','body','params','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','agent','permissions','101','103','113','110','104','106','107','108','109','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','UserProfileSection','isEmpty','Agents','compact','changePassword','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','ValidationError','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','isValidChannel','Unknown\x20channel','add','toLowerCase','Queues','penalty','spread','capitalize','Queue:save','VoiceQueue','voice','interface','voicePause','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','QueueId','Queue:remove','userpic','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','join','server/files/images/','ChatOpenTabs','createdAt','FaxOpenTabs','FAX','OPENCHANNEL','MailOpenTabs','MAIL','WhatsappOpenTabs','WHATSAPP','concat','getContacts','CmContact','order','sort','hasOwnProperty','List','Tags','color','tag','nolimit','getQueues','Queue','pick','getVoiceQueuesRt','getGroups','ChatGroup','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','format','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','headers','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','logout','forEach','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','Team','getTeams','addTeams','resolve','getAssociatedQueues','flattenDeep','addAgent','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getDataValue','removeTeams','transaction','getLists','CmList','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','Contact','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','flatten','col','asc','desc','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','moment','path','lodash','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','./user.socket','register','redis','defaults','localhost','client','http','request','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','User,\x20%s,\x20%s','result','catch','sendStatus','end'];(function(_0x65a0db,_0x55c5a0){var _0x987620=function(_0x23d53f){while(--_0x23d53f){_0x65a0db['push'](_0x65a0db['shift']());}};_0x987620(++_0x55c5a0);}(_0xe5eb,0x175));var _0xbe5e=function(_0x35f978,_0x1b898a){_0x35f978=_0x35f978-0x0;var _0x36988a=_0xe5eb[_0x35f978];return _0x36988a;};'use strict';var moment=require(_0xbe5e('0x0'));var util=require('util');var path=require(_0xbe5e('0x1'));var fs=require('fs');var _=require(_0xbe5e('0x2'));var squel=require('squel');var jayson=require(_0xbe5e('0x3'));var Redis=require(_0xbe5e('0x4'));var authService=require(_0xbe5e('0x5'));var qs=require(_0xbe5e('0x6'));var logger=require(_0xbe5e('0x7'))(_0xbe5e('0x8'));var utils=require(_0xbe5e('0x9'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0xbe5e('0xa'))[_0xbe5e('0xb')];var APINotFoundError=require(_0xbe5e('0xa'))[_0xbe5e('0xc')];var APIHandleError=require(_0xbe5e('0xa'))[_0xbe5e('0xd')];var db=require(_0xbe5e('0xe'))['db'];var socket=require(_0xbe5e('0xf'))(new Redis(config['redis']));require(_0xbe5e('0x10'))[_0xbe5e('0x11')](socket);config[_0xbe5e('0x12')]=_[_0xbe5e('0x13')](config['redis'],{'host':_0xbe5e('0x14'),'port':0x18eb});var amiClient=jayson[_0xbe5e('0x15')][_0xbe5e('0x16')]({'port':0x232a});var values;function respondWithRpcPromise(_0x2ac312,_0x28da45,_0x5cfb4c,_0x3307cf){return new Promise(function(_0xf2864b,_0xb7caef){var _0xfe24ec=_0x3307cf||amiClient;return _0xfe24ec[_0xbe5e('0x17')](_0x2ac312,_0x5cfb4c)[_0xbe5e('0x18')](function(_0x334d56){logger[_0xbe5e('0x19')]('User,\x20%s,\x20%s',_0x28da45,_0xbe5e('0x1a'));logger[_0xbe5e('0x1b')](_0xbe5e('0x1c'),_0x28da45,_0xbe5e('0x1a'),JSON[_0xbe5e('0x1d')](_0x334d56));if(_0x334d56['error']){if(_0x334d56[_0xbe5e('0x1e')][_0xbe5e('0x1f')]===0x1f4){logger[_0xbe5e('0x1e')]('User,\x20%s,\x20%s',_0x28da45,_0x334d56[_0xbe5e('0x1e')]['message']);return _0xb7caef(_0x334d56[_0xbe5e('0x1e')][_0xbe5e('0x20')]);}logger[_0xbe5e('0x1e')](_0xbe5e('0x21'),_0x28da45,_0x334d56[_0xbe5e('0x1e')][_0xbe5e('0x20')]);return _0xf2864b(_0x334d56[_0xbe5e('0x1e')]['message']);}else{logger[_0xbe5e('0x19')](_0xbe5e('0x21'),_0x28da45,_0xbe5e('0x1a'));_0xf2864b(_0x334d56[_0xbe5e('0x22')]['message']);}})[_0xbe5e('0x23')](function(_0x34aab5){logger[_0xbe5e('0x1e')]('User,\x20%s,\x20%s',_0x28da45,_0x34aab5);_0xb7caef(_0x34aab5);});});}function respondWithStatusCode(_0x4ff44a,_0x3d65ab){_0x3d65ab=_0x3d65ab||0xcc;return function(_0x32aa81){if(_0x32aa81){return _0x4ff44a[_0xbe5e('0x24')](_0x3d65ab);}return _0x4ff44a['status'](_0x3d65ab)[_0xbe5e('0x25')]();};}function respondWithResult(_0x25de44,_0x6af2d2){_0x6af2d2=_0x6af2d2||0xc8;return function(_0x5bcd9a){if(_0x5bcd9a){return _0x25de44[_0xbe5e('0x26')](_0x6af2d2)[_0xbe5e('0x27')](_0x5bcd9a);}};}function respondWithFilteredResult(_0x3df55e,_0x4f6fcf){return function(_0x378806){if(_0x378806){var _0x1779f5=typeof _0x4f6fcf[_0xbe5e('0x28')]===_0xbe5e('0x29')&&typeof _0x4f6fcf[_0xbe5e('0x2a')]===_0xbe5e('0x29');var _0x25a35a=_0x378806[_0xbe5e('0x2b')];var _0x24d075=_0x1779f5?0x0:_0x4f6fcf[_0xbe5e('0x28')];var _0x174992=_0x1779f5?_0x378806[_0xbe5e('0x2b')]:_0x4f6fcf[_0xbe5e('0x28')]+_0x4f6fcf[_0xbe5e('0x2a')];var _0x216bed;if(_0x174992>=_0x25a35a){_0x174992=_0x25a35a;_0x216bed=0xc8;}else{_0x216bed=0xce;}_0x3df55e[_0xbe5e('0x26')](_0x216bed);return _0x3df55e[_0xbe5e('0x2c')]('Content-Range',_0x24d075+'-'+_0x174992+'/'+_0x25a35a)[_0xbe5e('0x27')](_0x378806);}return null;};}function saveUpdates(_0x3b2aa1){return function(_0x105b0b){if(_0x105b0b){return _0x105b0b['update'](_0x3b2aa1)[_0xbe5e('0x18')](function(_0x4066c0){socket[_0xbe5e('0x2d')](_0xbe5e('0x2e')+_0x4066c0['id'],{});return _0x4066c0;});}return null;};}function removeEntity(_0x767f06){return function(_0x255400){if(_0x255400){return _0x255400[_0xbe5e('0x2f')]()['then'](function(){var _0x29d057=_0x255400[_0xbe5e('0x30')]({'plain':!![]});if(_0x29d057[_0xbe5e('0x31')]===_0xbe5e('0x32'))return;var _0x8a915d=[{'name':_0xbe5e('0x33'),'value':_0xbe5e('0x34'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0xbe5e('0x35'),'value':_0xbe5e('0x36'),'ignore':![]}];var _0x5a3d82=_(_0x8a915d)['filter']('ignore')[_0xbe5e('0x37')](_0xbe5e('0x38'))['value']();if(_[_0xbe5e('0x39')](_0x5a3d82,_0x29d057['role'])){return;}var _0x4d6579=_[_0xbe5e('0x3a')](_0x8a915d,[_0xbe5e('0x38'),_0x29d057['role']])['name'];return db[_0xbe5e('0x3b')]['destroy']({'where':{'type':_0x4d6579,'resourceId':_0x29d057['id']}})[_0xbe5e('0x18')](function(){return _0x255400;});})[_0xbe5e('0x18')](function(){_0x767f06[_0xbe5e('0x26')](0xcc)[_0xbe5e('0x25')]();});}};}function handleEntityNotFound(_0x5e697f){return function(_0x18ef43){if(!_0x18ef43){_0x5e697f[_0xbe5e('0x24')](0x194);}return _0x18ef43;};}function handleError(_0x34ded9,_0x1fd5bc){_0x1fd5bc=_0x1fd5bc||0x1f4;return function(_0x3d0073){logger[_0xbe5e('0x1e')](_0x3d0073[_0xbe5e('0x3c')]);if(_0x3d0073[_0xbe5e('0x3d')]){delete _0x3d0073[_0xbe5e('0x3d')];}_0x34ded9[_0xbe5e('0x26')](_0x1fd5bc)[_0xbe5e('0x3e')](_0x3d0073);};}exports[_0xbe5e('0x3f')]=function(_0x2a2af6,_0x282408){var _0x3d8689={},_0x2556c3={'count':0x0,'rows':[]};var _0x5287cf=_(db[_0xbe5e('0x40')]['rawAttributes'])['map'](function(_0x4aabce){return{'name':_0x4aabce[_0xbe5e('0x41')],'type':_0x4aabce[_0xbe5e('0x42')][_0xbe5e('0x43')]};})[_0xbe5e('0x44')](function(_0x4b5b73){return!_[_0xbe5e('0x39')]([_0xbe5e('0x45'),'salt'],_0x4b5b73[_0xbe5e('0x3d')]);})[_0xbe5e('0x38')]();_0x3d8689=qs[_0xbe5e('0x46')](_0x5287cf,_0x2a2af6);var _0x321160={'where':_0x3d8689[_0xbe5e('0x47')]};return db[_0xbe5e('0x40')][_0xbe5e('0x2b')](_0x321160)[_0xbe5e('0x18')](function(_0x1f683d){_0x2556c3[_0xbe5e('0x2b')]=_0x1f683d;if(_0x2a2af6[_0xbe5e('0x48')]['includeAll']){_0x3d8689[_0xbe5e('0x49')]=[{'all':!![]}];}if(_0x2a2af6[_0xbe5e('0x48')][_0xbe5e('0x4a')]===_0xbe5e('0x4b')){_0x3d8689[_0xbe5e('0x49')]=[{'model':db[_0xbe5e('0x4c')],'as':'userSetting'}];}if(!_['includes'](_0x3d8689[_0xbe5e('0x4d')],'id')){_0x3d8689[_0xbe5e('0x4d')]['push']('id');}return db[_0xbe5e('0x40')][_0xbe5e('0x4e')](_0x3d8689);})['then'](function(_0x33fa42){_0x2556c3[_0xbe5e('0x4f')]=_0x33fa42;if(_0x2a2af6['query'][_0xbe5e('0x50')]===_0xbe5e('0x4b')){var _0x39f868=[];for(var _0x5f0ca7=0x0;_0x5f0ca7<_0x2556c3['rows'][_0xbe5e('0x51')];_0x5f0ca7++){_0x39f868[_0xbe5e('0x52')](get_open_tabs(_0xbe5e('0x53'),_0x2556c3[_0xbe5e('0x4f')][_0x5f0ca7]['dataValues']));_0x39f868[_0xbe5e('0x52')](get_open_tabs(_0xbe5e('0x54'),_0x2556c3['rows'][_0x5f0ca7][_0xbe5e('0x55')]));_0x39f868[_0xbe5e('0x52')](get_open_tabs(_0xbe5e('0x56'),_0x2556c3['rows'][_0x5f0ca7][_0xbe5e('0x55')]));_0x39f868[_0xbe5e('0x52')](get_open_tabs(_0xbe5e('0x57'),_0x2556c3[_0xbe5e('0x4f')][_0x5f0ca7][_0xbe5e('0x55')]));_0x39f868['push'](get_open_tabs(_0xbe5e('0x58'),_0x2556c3[_0xbe5e('0x4f')][_0x5f0ca7][_0xbe5e('0x55')]));_0x39f868[_0xbe5e('0x52')](get_open_tabs(_0xbe5e('0x59'),_0x2556c3['rows'][_0x5f0ca7][_0xbe5e('0x55')]));}return Promise['all'](_0x39f868)[_0xbe5e('0x18')](function(){return _0x2556c3;});}else{return _0x2556c3;}})['then'](respondWithFilteredResult(_0x282408,_0x3d8689))[_0xbe5e('0x23')](handleError(_0x282408,null));};exports['show']=function(_0x2e5d7c,_0x4dfb61){var _0x1594c7={'raw':![],'where':{'id':_0x2e5d7c['params']['id']}},_0x3ba12f={};_0x3ba12f[_0xbe5e('0x5a')]=_['differenceBy'](_[_0xbe5e('0x5b')](db['User'][_0xbe5e('0x5c')]),[_0xbe5e('0x45'),_0xbe5e('0x5d')]);_0x3ba12f[_0xbe5e('0x48')]=_['keys'](_0x2e5d7c[_0xbe5e('0x48')]);_0x3ba12f[_0xbe5e('0x5e')]=_[_0xbe5e('0x5f')](_0x3ba12f['model'],_0x3ba12f[_0xbe5e('0x48')]);_0x1594c7[_0xbe5e('0x4d')]=_['intersection'](_0x3ba12f['model'],qs[_0xbe5e('0x60')](_0x2e5d7c['query']['fields']));_0x1594c7['attributes']=_0x1594c7[_0xbe5e('0x4d')]['length']?_0x1594c7[_0xbe5e('0x4d')]:_0x3ba12f['model'];if(_0x2e5d7c[_0xbe5e('0x48')][_0xbe5e('0x61')]){_0x1594c7[_0xbe5e('0x49')]=[{'all':!![]}];}if(_0x2e5d7c[_0xbe5e('0x48')]['userSetting']==='true'){_0x1594c7[_0xbe5e('0x49')]=[{'model':db[_0xbe5e('0x4c')],'as':_0xbe5e('0x4a')}];}_0x1594c7=_[_0xbe5e('0x62')]({},_0x1594c7,_0x2e5d7c[_0xbe5e('0x63')]);if(!_[_0xbe5e('0x39')](_0x1594c7[_0xbe5e('0x4d')],'id')){_0x1594c7[_0xbe5e('0x4d')]['push']('id');}return db['User'][_0xbe5e('0x3a')](_0x1594c7)[_0xbe5e('0x18')](handleEntityNotFound(_0x4dfb61,null))[_0xbe5e('0x18')](function(_0x5e2ffa){var _0x2029ae=[];values=_0x5e2ffa;if(_0x2e5d7c[_0xbe5e('0x48')][_0xbe5e('0x50')]==='true'){_0x2029ae[_0xbe5e('0x52')](get_open_tabs('chat',_0x5e2ffa[_0xbe5e('0x55')]));_0x2029ae[_0xbe5e('0x52')](get_open_tabs(_0xbe5e('0x54'),_0x5e2ffa[_0xbe5e('0x55')]));_0x2029ae[_0xbe5e('0x52')](get_open_tabs('openchannel',_0x5e2ffa[_0xbe5e('0x55')]));_0x2029ae['push'](get_open_tabs('whatsapp',_0x5e2ffa['dataValues']));_0x2029ae[_0xbe5e('0x52')](get_open_tabs(_0xbe5e('0x56'),_0x5e2ffa[_0xbe5e('0x55')]));_0x2029ae[_0xbe5e('0x52')](get_open_tabs(_0xbe5e('0x57'),_0x5e2ffa[_0xbe5e('0x55')]));return Promise[_0xbe5e('0x64')](_0x2029ae);}else{return values;}})['then'](function(){return values;})[_0xbe5e('0x18')](respondWithResult(_0x4dfb61,null))[_0xbe5e('0x23')](handleError(_0x4dfb61,null));};exports[_0xbe5e('0x65')]=function(_0x4dd6d8,_0x5def4a){if(_0x4dd6d8['body']['id']){delete _0x4dd6d8['body']['id'];}delete _0x4dd6d8[_0xbe5e('0x66')][_0xbe5e('0x31')];return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x4dd6d8[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x5def4a,null))[_0xbe5e('0x18')](saveUpdates(_0x4dd6d8['body'],null))[_0xbe5e('0x18')](respondWithResult(_0x5def4a,null))[_0xbe5e('0x23')](handleError(_0x5def4a,null));};exports[_0xbe5e('0x68')]=function(_0x1ab5ce,_0x1e778b){return db[_0xbe5e('0x40')]['describe']()[_0xbe5e('0x18')](respondWithResult(_0x1e778b,null))['catch'](handleError(_0x1e778b,null));};exports[_0xbe5e('0x69')]=function(_0x2effd7,_0x1305c1){return db[_0xbe5e('0x40')]['find']({'where':{'id':_0x2effd7[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x1305c1,null))[_0xbe5e('0x18')](function(_0x1d6aac){if(_0x1d6aac){return _0x1d6aac[_0xbe5e('0x69')](_0x2effd7[_0xbe5e('0x66')][_0xbe5e('0x6a')],_[_0xbe5e('0x6b')](_0x2effd7[_0xbe5e('0x66')],[_0xbe5e('0x6a'),'id'])||{});}})[_0xbe5e('0x18')](respondWithResult(_0x1305c1,null))['catch'](handleError(_0x1305c1,null));};function validateUser(_0x365b2d){return new Promise(function(_0x4dcdaa,_0xe26a53){if(_0x365b2d[_0xbe5e('0x6c')])return _0x4dcdaa(_0x365b2d);return db[_0xbe5e('0x6d')][_0xbe5e('0x6e')](0x1)[_0xbe5e('0x18')](function(_0x2db6d5){if(_0x2db6d5[_0xbe5e('0x6f')])authService[_0xbe5e('0x70')](_0x365b2d[_0xbe5e('0x45')]);db[_0xbe5e('0x40')][_0xbe5e('0x71')]('internal')[_0xbe5e('0x18')](function(_0x185af6){if(_[_0xbe5e('0x72')](_0x185af6)){_0x365b2d[_0xbe5e('0x6c')]=_0x2db6d5[_0xbe5e('0x73')]||0x1;return;}if(_[_0xbe5e('0x72')](_0x2db6d5[_0xbe5e('0x73')])||_0x2db6d5[_0xbe5e('0x73')]===_0x185af6){_0x365b2d[_0xbe5e('0x6c')]=_0x185af6+0x1;return;}if(_0x2db6d5[_0xbe5e('0x73')]>_0x185af6){_0x365b2d[_0xbe5e('0x6c')]=_0x2db6d5[_0xbe5e('0x73')];return;}return db[_0xbe5e('0x74')][_0xbe5e('0x48')](_0xbe5e('0x75'),{'type':db['sequelize'][_0xbe5e('0x76')][_0xbe5e('0x77')]})[_0xbe5e('0x18')](function(_0x55cbec){if(_0x55cbec&&_0x55cbec['length']){for(var _0x5971f4=0x0,_0x4b6729=_0x55cbec['length'];_0x5971f4<_0x4b6729&&_[_0xbe5e('0x72')](_0x365b2d['internal']);_0x5971f4++){if(_0x2db6d5[_0xbe5e('0x73')]<=_0x55cbec[_0x5971f4][_0xbe5e('0x78')]){_0x365b2d[_0xbe5e('0x6c')]=_0x55cbec[_0x5971f4][_0xbe5e('0x78')];}else if(_0x2db6d5[_0xbe5e('0x73')]>_0x55cbec[_0x5971f4][_0xbe5e('0x78')]&&_0x2db6d5[_0xbe5e('0x73')]<=_0x55cbec[_0x5971f4]['to']){_0x365b2d[_0xbe5e('0x6c')]=_0x2db6d5[_0xbe5e('0x73')];}}}if(_['isNil'](_0x365b2d[_0xbe5e('0x6c')])){_0x365b2d[_0xbe5e('0x6c')]=_0x185af6+0x1;}return _0x4dcdaa(_0x365b2d);});});})[_0xbe5e('0x23')](function(_0x233576){_0xe26a53(_0x233576);});});}function updateUser(_0x4f1261){return new Promise(function(_0x53479d,_0x4e42e7){try{if(_0x4f1261[_0xbe5e('0x79')]){_0x4f1261[_0xbe5e('0x7a')]=_0x4f1261[_0xbe5e('0x6c')];_0x4f1261[_0xbe5e('0x7b')]={'mailbox':_0x4f1261[_0xbe5e('0x6c')],'password':_0x4f1261[_0xbe5e('0x45')],'fullname':_0x4f1261[_0xbe5e('0x7c')],'email':_0x4f1261['email']};}if(_0x4f1261[_0xbe5e('0x31')]===_0xbe5e('0x7d')){if(!_0x4f1261[_0xbe5e('0x7e')])_0x4f1261[_0xbe5e('0x7e')]=[_0xbe5e('0x7f'),'102',_0xbe5e('0x80'),_0xbe5e('0x81'),_0xbe5e('0x82'),_0xbe5e('0x83'),'105',_0xbe5e('0x84'),_0xbe5e('0x85'),_0xbe5e('0x86'),_0xbe5e('0x87'),'100','111','114',_0xbe5e('0x88')];}_0x53479d(_0x4f1261);}catch(_0x3b6ba6){_0x4e42e7(_0x3b6ba6);}});}exports[_0xbe5e('0x89')]=function(_0x23acbd,_0x13903b){if(_0x23acbd[_0xbe5e('0x34')][_0xbe5e('0x31')]===_0xbe5e('0x7d'))throw new Error('Unauthorized');if(_0x23acbd[_0xbe5e('0x66')][_0xbe5e('0x31')]===_0xbe5e('0x34')&&_0x23acbd[_0xbe5e('0x34')]['role']!==_0xbe5e('0x32')){throw new Error(_0xbe5e('0x8a'));}if(_0x23acbd[_0xbe5e('0x66')]['role']===_0xbe5e('0x32')&&_0x23acbd[_0xbe5e('0x34')][_0xbe5e('0x31')]!==_0xbe5e('0x32')){throw new Error(_0xbe5e('0x8b'));}return licenseUtil['checkUserLimits']([_0x23acbd['body']])[_0xbe5e('0x18')](function(){return validateUser(_0x23acbd[_0xbe5e('0x66')]);})[_0xbe5e('0x18')](function(_0x188b6d){return updateUser(_0x188b6d)[_0xbe5e('0x18')](function(_0x1d40ca){if(_0x1d40ca[_0xbe5e('0x31')]===_0xbe5e('0x32')){_0x1d40ca[_0xbe5e('0x8c')]=_0x23acbd[_0xbe5e('0x34')][_0xbe5e('0x8c')];delete _0x1d40ca[_0xbe5e('0x8d')];}return _0x1d40ca;});})[_0xbe5e('0x18')](function(_0x5613fa){return db[_0xbe5e('0x40')][_0xbe5e('0x89')](_0x5613fa,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0xbe5e('0x18')](function(_0x14dd83){if(_0x23acbd['body']['role']===_0xbe5e('0x34'))return _0x14dd83;if(_0x23acbd[_0xbe5e('0x34')][_0xbe5e('0x31')]!=='user')return _0x14dd83;return db['UserProfileSection']['find']({'where':{'name':_0x14dd83[_0xbe5e('0x31')]===_0xbe5e('0x7d')?'Agents':_0xbe5e('0x35'),'userProfileId':_0x23acbd['user'][_0xbe5e('0x8d')]},'raw':!![]})[_0xbe5e('0x18')](function(_0x560c4b){if(!_0x560c4b||_0x560c4b[_0xbe5e('0x8e')]!=0x0)return _0x14dd83;return db['UserProfileResource'][_0xbe5e('0x89')]({'name':_0x14dd83[_0xbe5e('0x3d')],'resourceId':_0x14dd83['id'],'type':_0x560c4b['name'],'sectionId':_0x560c4b['id']},{})[_0xbe5e('0x18')](function(){return _0x14dd83;});})['catch'](function(_0x2e3f71){logger['error'](_0xbe5e('0x8f'),_0x2e3f71);throw _0x2e3f71;});})[_0xbe5e('0x18')](respondWithResult(_0x13903b,0xc9))[_0xbe5e('0x23')](handleError(_0x13903b,null));};exports[_0xbe5e('0x90')]=function(_0x5a9c42,_0x31bff9){var _0x345643=_0x5a9c42[_0xbe5e('0x66')];var _0x8ef83b=[];if(_0x5a9c42[_0xbe5e('0x34')][_0xbe5e('0x31')]===_0xbe5e('0x7d'))throw new Error(_0xbe5e('0x91'));if(_['some'](_0x345643,[_0xbe5e('0x31'),'user'])&&_0x5a9c42[_0xbe5e('0x34')]['role']!==_0xbe5e('0x32')){throw new Error(_0xbe5e('0x8a'));}if(_[_0xbe5e('0x92')](_0x345643,[_0xbe5e('0x31'),'admin'])&&_0x5a9c42[_0xbe5e('0x34')][_0xbe5e('0x31')]!==_0xbe5e('0x32')){throw new Error(_0xbe5e('0x93'));}return licenseUtil[_0xbe5e('0x94')](_0x345643)['then'](function(){return validateUser(_0x345643[0x0]);})[_0xbe5e('0x18')](function(){for(var _0x43f705=0x1;_0x43f705<_0x345643[_0xbe5e('0x51')];_0x43f705++){var _0x19fa98=_0x345643[_0x43f705-0x1][_0xbe5e('0x6c')];if(!_0x345643[_0x43f705][_0xbe5e('0x6c')])_0x345643[_0x43f705]['internal']=_0x19fa98+0x1;_0x8ef83b[_0xbe5e('0x52')](validateUser(_0x345643[_0x43f705]));}return Promise[_0xbe5e('0x64')](_0x8ef83b);})['then'](function(){_0x8ef83b=[];for(var _0x549861=0x0;_0x549861<_0x345643[_0xbe5e('0x51')];_0x549861++){_0x8ef83b[_0xbe5e('0x52')](updateUser(_0x345643[_0x549861]));}return Promise['all'](_0x8ef83b);})['then'](function(){_0x8ef83b=_0x345643[_0xbe5e('0x37')](function(_0x6476a){return db[_0xbe5e('0x40')][_0xbe5e('0x89')](_0x6476a,{'include':[{'model':db[_0xbe5e('0x7b')],'as':_0xbe5e('0x7b')}]})[_0xbe5e('0x18')](function(_0x318ec0){_0x6476a['id']=_0x318ec0['id'];return _0x6476a;});});return Promise[_0xbe5e('0x64')](_0x8ef83b);})[_0xbe5e('0x18')](function(_0x389ff4){if(_0x5a9c42[_0xbe5e('0x66')]['role']===_0xbe5e('0x34'))return _0x389ff4;if(_0x5a9c42[_0xbe5e('0x34')]['role']!==_0xbe5e('0x34'))return _0x389ff4;var _0x41feef=_[_0xbe5e('0x92')](_0x389ff4,function(_0x5316b5){return _0x5316b5[_0xbe5e('0x31')]===_0xbe5e('0x7d')||_0x5316b5['role']===_0xbe5e('0x36');});if(!_0x41feef)return _0x389ff4;return db[_0xbe5e('0x95')][_0xbe5e('0x4e')]({'where':{'name':{'$or':['Agents',_0xbe5e('0x35')]},'userProfileId':_0x5a9c42[_0xbe5e('0x34')][_0xbe5e('0x8d')]},'raw':!![]})[_0xbe5e('0x18')](function(_0x6d547c){if(_[_0xbe5e('0x96')](_0x6d547c)||!_['some'](_0x6d547c,[_0xbe5e('0x8e'),0x0]))return _0x389ff4;_0x8ef83b=[];var _0x23116f=_(_0x6d547c)[_0xbe5e('0x37')](function(_0x558e2b){if(_0x558e2b[_0xbe5e('0x8e')]===0x1)return;return _0x558e2b[_0xbe5e('0x3d')]===_0xbe5e('0x97')?_0xbe5e('0x7d'):_0xbe5e('0x36');})[_0xbe5e('0x98')]()[_0xbe5e('0x38')]();for(var _0x3d9ff5=0x0;_0x3d9ff5<_0x389ff4[_0xbe5e('0x51')];_0x3d9ff5++){if(!_['includes'](_0x23116f,_0x389ff4[_0x3d9ff5][_0xbe5e('0x31')]))return;var _0x499642=_0x389ff4[_0x3d9ff5][_0xbe5e('0x31')]===_0xbe5e('0x7d')?_0xbe5e('0x97'):_0xbe5e('0x35');_0x8ef83b[_0xbe5e('0x52')](db[_0xbe5e('0x3b')]['create']({'name':_0x389ff4[_0x3d9ff5][_0xbe5e('0x3d')],'resourceId':_0x389ff4[_0x3d9ff5]['id'],'type':_0x499642,'sectionId':_[_0xbe5e('0x3a')](_0x6d547c,[_0xbe5e('0x3d'),_0x499642])['id']},{}));}return Promise[_0xbe5e('0x64')](_0x8ef83b);});})[_0xbe5e('0x18')](respondWithResult(_0x31bff9,0xc9))[_0xbe5e('0x23')](handleError(_0x31bff9,null));};exports[_0xbe5e('0x99')]=function(_0x824db8,_0x50611b){if(_0x824db8[_0xbe5e('0x66')]['id']){delete _0x824db8[_0xbe5e('0x66')]['id'];}return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x824db8['params']['id']}})[_0xbe5e('0x18')](function(_0x451c70){if(!_0x451c70)return null;if(_0x451c70['id']===_0x824db8[_0xbe5e('0x34')]['id']){if(!_0x824db8[_0xbe5e('0x66')][_0xbe5e('0x9a')]||!_0x824db8[_0xbe5e('0x66')][_0xbe5e('0x9b')]){throw new db['Sequelize']['ValidationError'](_0xbe5e('0x9c'));}if(!_0x451c70[_0xbe5e('0x9d')](_0x824db8[_0xbe5e('0x66')][_0xbe5e('0x9a')])){throw new db[(_0xbe5e('0x9e'))][(_0xbe5e('0x9f'))](_0xbe5e('0xa0'));}if(_0x824db8[_0xbe5e('0x66')][_0xbe5e('0x9a')]===_0x824db8[_0xbe5e('0x66')][_0xbe5e('0x9b')]){throw new db[(_0xbe5e('0x9e'))][(_0xbe5e('0x9f'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x824db8[_0xbe5e('0x34')][_0xbe5e('0x31')]===_0xbe5e('0x32')){if(!_0x824db8['body'][_0xbe5e('0x9b')]){throw new db[(_0xbe5e('0x9e'))][(_0xbe5e('0x9f'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x824db8['user'][_0xbe5e('0x31')]===_0xbe5e('0x34')){if(!_0x824db8[_0xbe5e('0x66')][_0xbe5e('0x9b')]){throw new db[(_0xbe5e('0x9e'))]['ValidationError'](_0xbe5e('0xa1'));}if(_0x451c70['role']!==_0xbe5e('0x7d')){throw new db[(_0xbe5e('0x9e'))][(_0xbe5e('0x9f'))](_0xbe5e('0x91'));}}else{throw new db[(_0xbe5e('0x9e'))][(_0xbe5e('0x9f'))]('Unauthorized');}return _0x451c70;})[_0xbe5e('0x18')](handleEntityNotFound(_0x50611b,null))['then'](function(_0x33d62f){return db[_0xbe5e('0x6d')][_0xbe5e('0xa2')]({'attributes':['id','securePassword','enforcePasswordHistory',_0xbe5e('0xa3')]})[_0xbe5e('0x18')](function(_0x41d6b7){if(_0x41d6b7[_0xbe5e('0x6f')])authService['validatePasswordPattern'](_0x824db8['body'][_0xbe5e('0x9b')]);if(!_0x41d6b7['enforcePasswordHistory']||!_0x33d62f[_0xbe5e('0xa4')])return _0x33d62f;authService[_0xbe5e('0xa5')](_0x824db8[_0xbe5e('0x66')]['newPassword'],_0x33d62f[_0xbe5e('0xa4')],_0x41d6b7['passwordHistoryLimit']);return _0x33d62f;})['then'](saveUpdates({'password':_0x824db8[_0xbe5e('0x66')][_0xbe5e('0x9b')],'passwordResetAt':_0x824db8[_0xbe5e('0x34')]['id']==_0x824db8[_0xbe5e('0x67')]['id']?moment():null,'previousPasswords':authService[_0xbe5e('0xa6')](_0x824db8['body'][_0xbe5e('0x9b')],_0x33d62f[_0xbe5e('0xa4')])},null));})['then'](respondWithResult(_0x50611b,null))[_0xbe5e('0x23')](handleError(_0x50611b,null));};exports[_0xbe5e('0xa7')]=function(_0x17e569,_0x20c9ae){var _0x153c0e=_0x17e569[_0xbe5e('0x66')][_0xbe5e('0xa8')];return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x17e569[_0xbe5e('0x67')]['id']},'attributes':['id','name',_0xbe5e('0x31'),_0xbe5e('0xa9'),_0xbe5e('0xaa'),'voicePause','interface']})[_0xbe5e('0x18')](handleEntityNotFound(_0x20c9ae,null))[_0xbe5e('0x18')](function(_0x4e30e1){if(_0x4e30e1){if(!utils[_0xbe5e('0xab')](_0x153c0e)){throw new db['Sequelize'][(_0xbe5e('0x9f'))](_0xbe5e('0xac'));}return _0x4e30e1[_0xbe5e('0xad')+_['capitalize'](_0x153c0e[_0xbe5e('0xae')]())+_0xbe5e('0xaf')](_0x17e569[_0xbe5e('0x66')]['ids'],{'penalty':_0x17e569[_0xbe5e('0x66')][_0xbe5e('0xb0')]||0x0})[_0xbe5e('0xb1')](function(_0x211e5f){for(var _0x264c11=0x0;_0x264c11<_0x17e569[_0xbe5e('0x66')][_0xbe5e('0x6a')][_0xbe5e('0x51')];_0x264c11+=0x1){var _0x17e71c={'UserId':Number(_0x17e569[_0xbe5e('0x67')]['id'])};_0x17e71c[_['capitalize'](_0x153c0e[_0xbe5e('0xae')]())+'QueueId']=Number(_0x17e569[_0xbe5e('0x66')][_0xbe5e('0x6a')][_0x264c11]);socket[_0xbe5e('0x2d')](_0xbe5e('0x34')+_[_0xbe5e('0xb2')](_0x153c0e[_0xbe5e('0xae')]())+_0xbe5e('0xb3'),_0x17e71c);}return _0x211e5f;})[_0xbe5e('0x18')](function(){if(_0x153c0e==='voice'){return db[_0xbe5e('0xb4')]['findAll']({'where':{'id':_0x17e569[_0xbe5e('0x66')][_0xbe5e('0x6a')]||[]},'raw':!![],'attributes':['id',_0xbe5e('0x3d')]});}})[_0xbe5e('0x18')](function(_0x47992f){var _0x26ecc8=_0x4e30e1[_0xbe5e('0x30')]({'plain':!![]});var _0x3b7fc3=[];if(_0x153c0e===_0xbe5e('0xb5')&&_0x26ecc8[_0xbe5e('0x31')]===_0xbe5e('0x7d')&&_0x26ecc8[_0xbe5e('0xa9')]){for(let _0xb0b740=0x0;_0xb0b740<_0x47992f[_0xbe5e('0x51')];_0xb0b740+=0x1){_0x3b7fc3[_0xbe5e('0x52')]({'membername':_0x26ecc8['name'],'UserId':_0x26ecc8['id'],'queue_name':_0x47992f[_0xb0b740][_0xbe5e('0x3d')],'VoiceQueueId':_0x47992f[_0xb0b740]['id'],'interface':_[_0xbe5e('0x72')](_0x26ecc8[_0xbe5e('0xb6')])?util['format']('SIP/%s',_0x26ecc8[_0xbe5e('0x3d')]):_0x26ecc8[_0xbe5e('0xb6')],'paused':_0x26ecc8[_0xbe5e('0xb7')]||![],'penalty':_0x17e569[_0xbe5e('0x66')][_0xbe5e('0xb0')]||0x0});}return Promise['all'](_0x3b7fc3[_0xbe5e('0x37')](function(_0x3dcde3){return db[_0xbe5e('0xb8')][_0xbe5e('0xb9')](_0x3dcde3);}));}return _0x4e30e1;});}})[_0xbe5e('0x18')](respondWithStatusCode(_0x20c9ae,null))['catch'](handleError(_0x20c9ae,null));};exports[_0xbe5e('0xba')]=function(_0x2acbb3,_0x3d16fa){var _0x2c4786,_0x2fa40b;return db['User'][_0xbe5e('0x3a')]({'where':{'id':_0x2acbb3[_0xbe5e('0x67')]['id']},'attributes':['id','name',_0xbe5e('0x31')]})[_0xbe5e('0x18')](handleEntityNotFound(_0x3d16fa,null))['then'](function(_0x5db98d){if(_0x5db98d){_0x2c4786=_0x5db98d;if(!_0x2acbb3[_0xbe5e('0x48')][_0xbe5e('0xa8')]||!utils[_0xbe5e('0xab')](_0x2acbb3[_0xbe5e('0x48')]['channel'])){throw new db['Sequelize']['ValidationError'](_0xbe5e('0xac'));}return _0x5db98d[_0xbe5e('0xbb')+_['capitalize'](_0x2acbb3[_0xbe5e('0x48')][_0xbe5e('0xa8')][_0xbe5e('0xae')]())+'Queues'](_0x2acbb3[_0xbe5e('0x48')][_0xbe5e('0x6a')]);}})[_0xbe5e('0x18')](function(_0x1dd95a){if(_[_0xbe5e('0xbc')](_0x2acbb3[_0xbe5e('0x48')][_0xbe5e('0x6a')])){for(var _0x4f047c=0x0;_0x4f047c<_0x2acbb3[_0xbe5e('0x48')][_0xbe5e('0x6a')][_0xbe5e('0x51')];_0x4f047c+=0x1){_0x2fa40b={'UserId':Number(_0x2acbb3[_0xbe5e('0x67')]['id'])};_0x2fa40b[_[_0xbe5e('0xb2')](_0x2acbb3[_0xbe5e('0x48')]['channel'][_0xbe5e('0xae')]())+_0xbe5e('0xbd')]=Number(_0x2acbb3[_0xbe5e('0x48')]['ids'][_0x4f047c]);socket[_0xbe5e('0x2d')]('user'+_[_0xbe5e('0xb2')](_0x2acbb3[_0xbe5e('0x48')][_0xbe5e('0xa8')][_0xbe5e('0xae')]())+_0xbe5e('0xbe'),_0x2fa40b);}}else{_0x2fa40b={'UserId':Number(_0x2acbb3[_0xbe5e('0x67')]['id'])};_0x2fa40b[_[_0xbe5e('0xb2')](_0x2acbb3[_0xbe5e('0x48')][_0xbe5e('0xa8')][_0xbe5e('0xae')]())+_0xbe5e('0xbd')]=Number(_0x2acbb3[_0xbe5e('0x48')]['ids']);socket['emit']('user'+_[_0xbe5e('0xb2')](_0x2acbb3[_0xbe5e('0x48')]['channel'][_0xbe5e('0xae')]())+_0xbe5e('0xbe'),_0x2fa40b);}return _0x1dd95a;})[_0xbe5e('0x18')](function(){if(_0x2acbb3['query'][_0xbe5e('0xa8')]==='voice'){return db[_0xbe5e('0xb8')][_0xbe5e('0x2f')]({'where':{'UserId':_0x2acbb3[_0xbe5e('0x67')]['id'],'VoiceQueueId':_0x2acbb3[_0xbe5e('0x48')][_0xbe5e('0x6a')]},'individualHooks':!![]})['then'](function(){return _0x2c4786;});}return _0x2c4786;})[_0xbe5e('0x18')](respondWithStatusCode(_0x3d16fa,null))[_0xbe5e('0x23')](handleError(_0x3d16fa,null));};exports['addAvatar']=function(_0x11e73f,_0x1ed4b2){_0x11e73f[_0xbe5e('0x66')][_0xbe5e('0xbf')]=_0x11e73f[_0xbe5e('0xc0')][_0xbe5e('0xc1')];return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x11e73f[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x1ed4b2,null))[_0xbe5e('0x18')](saveUpdates(_0x11e73f[_0xbe5e('0x66')],null))[_0xbe5e('0x18')](respondWithResult(_0x1ed4b2,null))[_0xbe5e('0x23')](handleError(_0x1ed4b2,null));};exports[_0xbe5e('0xc2')]=function(_0x9632c5,_0x325f05){var _0x334982=path['join'](config[_0xbe5e('0xc3')],_0xbe5e('0xc4'));return db['User'][_0xbe5e('0x3a')]({'where':{'id':_0x9632c5[_0xbe5e('0x67')]['id']},'attributes':['id',_0xbe5e('0xbf')],'raw':!![]})['then'](handleEntityNotFound(_0x325f05,null))[_0xbe5e('0x18')](function(_0x5d6c46){if(_0x5d6c46){if(_[_0xbe5e('0x72')](_0x5d6c46[_0xbe5e('0xbf')])){return _0x325f05[_0xbe5e('0xc5')](_0x334982);}else{if(!fs[_0xbe5e('0xc6')](path[_0xbe5e('0xc7')](config[_0xbe5e('0xc3')],'server/files/images/',_0x5d6c46[_0xbe5e('0xbf')]))){return _0x325f05[_0xbe5e('0xc5')](_0x334982);}return _0x325f05[_0xbe5e('0xc5')](path[_0xbe5e('0xc7')](config[_0xbe5e('0xc3')],_0xbe5e('0xc8'),_0x5d6c46[_0xbe5e('0xbf')]));}}})[_0xbe5e('0x23')](handleError(_0x325f05,null));};exports['getOpenTabs']=function(_0x2f5443,_0x5b703b){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x2f5443[_0xbe5e('0x67')]['id']},'attributes':['id']})[_0xbe5e('0x18')](handleEntityNotFound(_0x5b703b,null))[_0xbe5e('0x18')](function(_0x526a93){var _0x18064c=[];values=_0x526a93['dataValues'];_0x18064c[_0xbe5e('0x52')](get_open_tabs('chat',_0x526a93[_0xbe5e('0x55')]));_0x18064c[_0xbe5e('0x52')](get_open_tabs(_0xbe5e('0x54'),_0x526a93[_0xbe5e('0x55')]));_0x18064c[_0xbe5e('0x52')](get_open_tabs(_0xbe5e('0x58'),_0x526a93[_0xbe5e('0x55')]));_0x18064c['push'](get_open_tabs(_0xbe5e('0x59'),_0x526a93[_0xbe5e('0x55')]));_0x18064c[_0xbe5e('0x52')](get_open_tabs('fax',_0x526a93[_0xbe5e('0x55')]));_0x18064c[_0xbe5e('0x52')](get_open_tabs('mail',_0x526a93[_0xbe5e('0x55')]));return Promise[_0xbe5e('0x64')](_0x18064c);})[_0xbe5e('0x18')](function(_0x5101e4){if(_0x5101e4){var _0x1bef01=_[_0xbe5e('0x37')](values[_0xbe5e('0xc9')],function(_0x22a914){return{'channel':'CHAT','id':_0x22a914['id'],'createdAt':_0x22a914[_0xbe5e('0xca')]};});var _0x1a1313=_[_0xbe5e('0x37')](values[_0xbe5e('0xcb')],function(_0x1e4ce6){return{'channel':_0xbe5e('0xcc'),'id':_0x1e4ce6['id'],'createdAt':_0x1e4ce6['createdAt']};});var _0x168b3e=_[_0xbe5e('0x37')](values['OpenchannelOpenTabs'],function(_0x549029){return{'channel':_0xbe5e('0xcd'),'id':_0x549029['id'],'createdAt':_0x549029[_0xbe5e('0xca')]};});var _0x23b818=_[_0xbe5e('0x37')](values[_0xbe5e('0xce')],function(_0x92e4d5){return{'channel':_0xbe5e('0xcf'),'id':_0x92e4d5['id'],'createdAt':_0x92e4d5[_0xbe5e('0xca')]};});var _0x4d6a90=_[_0xbe5e('0x37')](values['SmsOpenTabs'],function(_0x224d1a){return{'channel':'SMS','id':_0x224d1a['id'],'createdAt':_0x224d1a[_0xbe5e('0xca')]};});var _0x45fa7e=_[_0xbe5e('0x37')](values[_0xbe5e('0xd0')],function(_0x5358c6){return{'channel':_0xbe5e('0xd1'),'id':_0x5358c6['id'],'createdAt':_0x5358c6[_0xbe5e('0xca')]};});var _0x2cc5d0=_[_0xbe5e('0xd2')](_0x1bef01,_0x1a1313,_0x168b3e,_0x23b818,_0x4d6a90,_0x45fa7e);var _0x3b6096={'count':_0x2cc5d0[_0xbe5e('0x51')],'rows':_0x2cc5d0};return _0x3b6096;}else return null;})[_0xbe5e('0x18')](respondWithResult(_0x5b703b,null))[_0xbe5e('0x23')](handleError(_0x5b703b,null));};exports[_0xbe5e('0xd3')]=function(_0x396f73,_0x101cdb){var _0x5bb844={};var _0x598d5f={};var _0x5ed440;var _0x2efc89;return db[_0xbe5e('0x40')]['findOne']({'where':{'id':_0x396f73[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x101cdb,null))[_0xbe5e('0x18')](function(_0x2a9bf9){if(_0x2a9bf9){_0x5ed440=_0x2a9bf9;_0x598d5f['model']=_[_0xbe5e('0x5b')](db[_0xbe5e('0xd4')]['rawAttributes']);_0x598d5f['query']=_[_0xbe5e('0x5b')](_0x396f73['query']);_0x598d5f[_0xbe5e('0x5e')]=_['intersection'](_0x598d5f[_0xbe5e('0x5a')],_0x598d5f['query']);_0x5bb844[_0xbe5e('0x4d')]=_['intersection'](_0x598d5f[_0xbe5e('0x5a')],qs[_0xbe5e('0x60')](_0x396f73[_0xbe5e('0x48')][_0xbe5e('0x60')]));_0x5bb844[_0xbe5e('0x4d')]=_0x5bb844[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x5bb844[_0xbe5e('0x4d')]:_0x598d5f[_0xbe5e('0x5a')];_0x5bb844[_0xbe5e('0xd5')]=qs[_0xbe5e('0xd6')](_0x396f73['query'][_0xbe5e('0xd6')]);_0x5bb844[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_['pick'](_0x396f73[_0xbe5e('0x48')],_0x598d5f[_0xbe5e('0x5e')]));if(_0x396f73[_0xbe5e('0x48')][_0xbe5e('0x44')]){_0x5bb844[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x5bb844[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x5bb844[_0xbe5e('0x4d')],function(_0x591762){var _0x5c4e97={};_0x5c4e97[_0x591762]={'$like':'%'+_0x396f73[_0xbe5e('0x48')][_0xbe5e('0x44')]+'%'};return _0x5c4e97;})});}_0x5bb844=_[_0xbe5e('0x62')]({},_0x5bb844,_0x396f73[_0xbe5e('0x63')]);return _0x5ed440['getContacts'](_0x5bb844);}})[_0xbe5e('0x18')](function(_0x412a3d){if(_0x412a3d){_0x2efc89=_0x412a3d[_0xbe5e('0x51')];if(_0x396f73['query'][_0xbe5e('0xd7')](_0xbe5e('0x61'))){_0x5bb844[_0xbe5e('0x49')]=[{'model':db['CmList'],'as':_0xbe5e('0xd8'),'required':![]},{'model':db['Tag'],'as':_0xbe5e('0xd9'),'attributes':['id','name',_0xbe5e('0xda')],'where':_0x396f73[_0xbe5e('0x48')][_0xbe5e('0xdb')]?{'id':_0x396f73[_0xbe5e('0x48')][_0xbe5e('0xdb')]}:undefined,'required':_0x396f73['query'][_0xbe5e('0xdb')]?!![]:![]}];}if(!_0x396f73['query'][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x5bb844[_0xbe5e('0x2a')]=qs[_0xbe5e('0x2a')](_0x396f73[_0xbe5e('0x48')][_0xbe5e('0x2a')]);_0x5bb844[_0xbe5e('0x28')]=qs[_0xbe5e('0x28')](_0x396f73[_0xbe5e('0x48')][_0xbe5e('0x28')]);}return _0x5ed440[_0xbe5e('0xd3')](_0x5bb844);}})[_0xbe5e('0x18')](function(_0x4c2b19){if(_0x4c2b19){return _0x4c2b19?{'count':_0x2efc89,'rows':_0x4c2b19}:null;}})[_0xbe5e('0x18')](respondWithResult(_0x101cdb,null))[_0xbe5e('0x23')](handleError(_0x101cdb,null));};exports[_0xbe5e('0xdd')]=function(_0x350cb2,_0x662e5a){var _0x16695d;var _0x2a0ca2={};var _0x1d3877;return db[_0xbe5e('0x40')]['findOne']({'where':{'id':_0x350cb2[_0xbe5e('0x67')]['id']},'attributes':['id',_0xbe5e('0x3d'),_0xbe5e('0x31')]})[_0xbe5e('0x18')](handleEntityNotFound(_0x662e5a,null))[_0xbe5e('0x18')](function(_0x2eac93){if(!utils['isValidChannel'](_0x350cb2[_0xbe5e('0x48')]['channel'])){throw new db[(_0xbe5e('0x9e'))][(_0xbe5e('0x9f'))]('Unknown\x20channel');}_0x16695d=_0x2eac93;var _0x3fbd05={};_0x3fbd05[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db[_[_0xbe5e('0xb2')](_0x350cb2[_0xbe5e('0x48')][_0xbe5e('0xa8')])+_0xbe5e('0xde')][_0xbe5e('0x5c')]);_0x3fbd05[_0xbe5e('0x48')]=_['keys'](_0x350cb2[_0xbe5e('0x48')]);_0x3fbd05[_0xbe5e('0x5e')]=_['intersection'](_0x3fbd05[_0xbe5e('0x5a')],_0x3fbd05['query']);_0x2a0ca2[_0xbe5e('0x4d')]=_[_0xbe5e('0x5f')](_0x3fbd05[_0xbe5e('0x5a')],qs[_0xbe5e('0x60')](_0x350cb2[_0xbe5e('0x48')][_0xbe5e('0x60')]));_0x2a0ca2[_0xbe5e('0x4d')]=_0x2a0ca2[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x2a0ca2[_0xbe5e('0x4d')]:_0x3fbd05['model'];_0x2a0ca2['order']=qs[_0xbe5e('0xd6')](_0x350cb2[_0xbe5e('0x48')][_0xbe5e('0xd6')]);_0x2a0ca2[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_[_0xbe5e('0xdf')](_0x350cb2['query'],_0x3fbd05[_0xbe5e('0x5e')]));if(_0x350cb2[_0xbe5e('0x48')][_0xbe5e('0x44')]){_0x2a0ca2['where']=_[_0xbe5e('0x62')](_0x2a0ca2[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x2a0ca2[_0xbe5e('0x4d')],function(_0xf50b7d){var _0x4422cd={};_0x4422cd[_0xf50b7d]={'$like':'%'+_0x350cb2[_0xbe5e('0x48')]['filter']+'%'};return _0x4422cd;})});}_0x2a0ca2=_[_0xbe5e('0x62')]({},_0x2a0ca2,_0x350cb2['options']);switch(_0x16695d[_0xbe5e('0x31')]){case _0xbe5e('0x32'):return db[_[_0xbe5e('0xb2')](_0x350cb2['query']['channel'])+'Queue'][_0xbe5e('0x4e')](_0x2a0ca2);case'user':case _0xbe5e('0x7d'):return _0x16695d['get'+_['capitalize'](_0x350cb2[_0xbe5e('0x48')]['channel'])+_0xbe5e('0xaf')](_0x2a0ca2);default:throw new db[(_0xbe5e('0x9e'))]['ValidationError']('Unknown\x20role');}})['then'](function(_0x181a07){_0x1d3877=_0x181a07[_0xbe5e('0x51')];if(!_0x350cb2[_0xbe5e('0x48')][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x2a0ca2[_0xbe5e('0x2a')]=qs[_0xbe5e('0x2a')](_0x350cb2[_0xbe5e('0x48')][_0xbe5e('0x2a')]);_0x2a0ca2['offset']=qs['offset'](_0x350cb2[_0xbe5e('0x48')][_0xbe5e('0x28')]);}switch(_0x16695d['role']){case _0xbe5e('0x32'):return db[_[_0xbe5e('0xb2')](_0x350cb2[_0xbe5e('0x48')][_0xbe5e('0xa8')])+_0xbe5e('0xde')]['findAll'](_0x2a0ca2);case _0xbe5e('0x34'):case _0xbe5e('0x7d'):return _0x16695d['get'+_[_0xbe5e('0xb2')](_0x350cb2[_0xbe5e('0x48')][_0xbe5e('0xa8')])+_0xbe5e('0xaf')](_0x2a0ca2);}})[_0xbe5e('0x18')](function(_0x284bcf){return{'count':_0x1d3877,'rows':_0x284bcf};})['then'](respondWithResult(_0x662e5a,null))[_0xbe5e('0x23')](handleError(_0x662e5a,null));};exports[_0xbe5e('0xe0')]=function(_0x5162e6,_0x16c074){var _0x4a693d={};var _0x49b2e3={};var _0x4176d3;var _0x310dcc;return db[_0xbe5e('0x40')][_0xbe5e('0xa2')]({'where':{'id':_0x5162e6[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x16c074,null))['then'](function(_0x226134){if(_0x226134){_0x4176d3=_0x226134;_0x49b2e3[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db['UserVoiceQueueRt'][_0xbe5e('0x5c')]);_0x49b2e3[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x5162e6['query']);_0x49b2e3[_0xbe5e('0x5e')]=_['intersection'](_0x49b2e3[_0xbe5e('0x5a')],_0x49b2e3[_0xbe5e('0x48')]);_0x4a693d[_0xbe5e('0x4d')]=_[_0xbe5e('0x5f')](_0x49b2e3['model'],qs['fields'](_0x5162e6[_0xbe5e('0x48')][_0xbe5e('0x60')]));_0x4a693d[_0xbe5e('0x4d')]=_0x4a693d[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x4a693d['attributes']:_0x49b2e3[_0xbe5e('0x5a')];_0x4a693d[_0xbe5e('0xd5')]=qs[_0xbe5e('0xd6')](_0x5162e6[_0xbe5e('0x48')][_0xbe5e('0xd6')]);_0x4a693d[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_[_0xbe5e('0xdf')](_0x5162e6[_0xbe5e('0x48')],_0x49b2e3[_0xbe5e('0x5e')]));if(_0x5162e6[_0xbe5e('0x48')][_0xbe5e('0x44')]){_0x4a693d[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x4a693d[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x4a693d[_0xbe5e('0x4d')],function(_0x3e486b){var _0x2886dc={};_0x2886dc[_0x3e486b]={'$like':'%'+_0x5162e6[_0xbe5e('0x48')][_0xbe5e('0x44')]+'%'};return _0x2886dc;})});}_0x4a693d=_[_0xbe5e('0x62')]({},_0x4a693d,_0x5162e6[_0xbe5e('0x63')]);return _0x4176d3[_0xbe5e('0xe0')](_0x4a693d);}})['then'](function(_0x11cfb4){if(_0x11cfb4){_0x310dcc=_0x11cfb4['length'];if(!_0x5162e6[_0xbe5e('0x48')][_0xbe5e('0xd7')]('nolimit')){_0x4a693d[_0xbe5e('0x2a')]=qs[_0xbe5e('0x2a')](_0x5162e6[_0xbe5e('0x48')][_0xbe5e('0x2a')]);_0x4a693d[_0xbe5e('0x28')]=qs[_0xbe5e('0x28')](_0x5162e6[_0xbe5e('0x48')][_0xbe5e('0x28')]);}return _0x4176d3[_0xbe5e('0xe0')](_0x4a693d);}})['then'](function(_0x2d64ba){if(_0x2d64ba){return _0x2d64ba?{'count':_0x310dcc,'rows':_0x2d64ba}:null;}})['then'](respondWithResult(_0x16c074,null))[_0xbe5e('0x23')](handleError(_0x16c074,null));};exports[_0xbe5e('0xe1')]=function(_0x38f428,_0x163454){var _0x48ed32={};var _0x23f7bd={};var _0x30e43e;var _0x529fd6;return db['User'][_0xbe5e('0xa2')]({'where':{'id':_0x38f428[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x163454,null))[_0xbe5e('0x18')](function(_0x241473){if(_0x241473){_0x30e43e=_0x241473;_0x23f7bd['model']=_[_0xbe5e('0x5b')](db[_0xbe5e('0xe2')][_0xbe5e('0x5c')]);_0x23f7bd[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x38f428[_0xbe5e('0x48')]);_0x23f7bd[_0xbe5e('0x5e')]=_[_0xbe5e('0x5f')](_0x23f7bd[_0xbe5e('0x5a')],_0x23f7bd['query']);_0x48ed32[_0xbe5e('0x4d')]=_[_0xbe5e('0x5f')](_0x23f7bd[_0xbe5e('0x5a')],qs[_0xbe5e('0x60')](_0x38f428[_0xbe5e('0x48')]['fields']));_0x48ed32[_0xbe5e('0x4d')]=_0x48ed32[_0xbe5e('0x4d')]['length']?_0x48ed32['attributes']:_0x23f7bd[_0xbe5e('0x5a')];_0x48ed32[_0xbe5e('0xd5')]=qs['sort'](_0x38f428[_0xbe5e('0x48')][_0xbe5e('0xd6')]);_0x48ed32[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_[_0xbe5e('0xdf')](_0x38f428[_0xbe5e('0x48')],_0x23f7bd[_0xbe5e('0x5e')]));if(_0x38f428['query'][_0xbe5e('0x44')]){_0x48ed32[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x48ed32[_0xbe5e('0x47')],{'$or':_['map'](_0x48ed32[_0xbe5e('0x4d')],function(_0x26a54e){var _0x132732={};_0x132732[_0x26a54e]={'$like':'%'+_0x38f428['query'][_0xbe5e('0x44')]+'%'};return _0x132732;})});}_0x48ed32=_['merge']({},_0x48ed32,_0x38f428[_0xbe5e('0x63')]);return _0x30e43e[_0xbe5e('0xe1')](_0x48ed32);}})[_0xbe5e('0x18')](function(_0x79bfaf){if(_0x79bfaf){_0x529fd6=_0x79bfaf['length'];if(!_0x38f428[_0xbe5e('0x48')]['hasOwnProperty'](_0xbe5e('0xdc'))){_0x48ed32['limit']=qs[_0xbe5e('0x2a')](_0x38f428['query'][_0xbe5e('0x2a')]);_0x48ed32[_0xbe5e('0x28')]=qs['offset'](_0x38f428['query'][_0xbe5e('0x28')]);}return _0x30e43e[_0xbe5e('0xe1')](_0x48ed32);}})[_0xbe5e('0x18')](function(_0x2cd41a){if(_0x2cd41a){return _0x2cd41a?{'count':_0x529fd6,'rows':_0x2cd41a}:null;}})[_0xbe5e('0x18')](respondWithResult(_0x163454,null))[_0xbe5e('0x23')](handleError(_0x163454,null));};exports['getRecordings']=function(_0x349759,_0x34bda3){var _0x51f941={'raw':!![],'where':{}};var _0x17d558={};var _0x119206={'count':0x0,'rows':[]};return db[_0xbe5e('0x40')][_0xbe5e('0xa2')]({'where':{'id':_0x349759[_0xbe5e('0x67')]['id']}})['then'](handleEntityNotFound(_0x34bda3,null))[_0xbe5e('0x18')](function(_0x2bc387){if(_0x2bc387){_0x17d558[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db[_0xbe5e('0xe3')][_0xbe5e('0x5c')]);_0x17d558[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x349759[_0xbe5e('0x48')]);_0x17d558[_0xbe5e('0x5e')]=_[_0xbe5e('0x5f')](_0x17d558[_0xbe5e('0x5a')],_0x17d558[_0xbe5e('0x48')]);_0x51f941[_0xbe5e('0x4d')]=_['intersection'](_0x17d558[_0xbe5e('0x5a')],qs['fields'](_0x349759[_0xbe5e('0x48')]['fields']));_0x51f941['attributes']=_0x51f941[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x51f941['attributes']:_0x17d558[_0xbe5e('0x5a')];if(!_0x349759[_0xbe5e('0x48')][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x51f941[_0xbe5e('0x2a')]=qs[_0xbe5e('0x2a')](_0x349759[_0xbe5e('0x48')][_0xbe5e('0x2a')]);_0x51f941[_0xbe5e('0x28')]=qs[_0xbe5e('0x28')](_0x349759[_0xbe5e('0x48')][_0xbe5e('0x28')]);}_0x51f941[_0xbe5e('0xd5')]=qs[_0xbe5e('0xd6')](_0x349759['query'][_0xbe5e('0xd6')]);_0x51f941['where']=qs['filters'](_[_0xbe5e('0xdf')](_0x349759[_0xbe5e('0x48')],_0x17d558[_0xbe5e('0x5e')]));_0x51f941['where'][_0xbe5e('0xe4')]=_0x2bc387['id'];if(_0x349759[_0xbe5e('0x48')][_0xbe5e('0x44')]){_0x51f941[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x51f941[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x51f941['attributes'],function(_0x557e41){var _0x33cd94={};_0x33cd94[_0x557e41]={'$like':'%'+_0x349759[_0xbe5e('0x48')][_0xbe5e('0x44')]+'%'};return _0x33cd94;})});}_0x51f941=_[_0xbe5e('0x62')]({},_0x51f941,_0x349759['options']);return db[_0xbe5e('0xe3')][_0xbe5e('0x2b')]({'where':_0x51f941['where']})[_0xbe5e('0x18')](function(_0x8997cc){_0x119206[_0xbe5e('0x2b')]=_0x8997cc;if(_0x349759[_0xbe5e('0x48')]['includeAll']){_0x51f941[_0xbe5e('0x49')]=[{'all':!![]}];}return db[_0xbe5e('0xe3')]['findAll'](_0x51f941);})[_0xbe5e('0x18')](function(_0x5f1431){_0x119206['rows']=_0x5f1431;return _0x119206;});}})['then'](respondWithFilteredResult(_0x34bda3,_0x51f941))['catch'](handleError(_0x34bda3,null));};exports[_0xbe5e('0xe5')]=function(_0x37506b,_0x39c1af){var _0x9c11ac={'raw':!![],'where':{}};var _0x31e62c={};var _0x1ee04a={'count':0x0,'rows':[]};return db['User'][_0xbe5e('0xa2')]({'where':{'id':_0x37506b[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x39c1af,null))[_0xbe5e('0x18')](function(_0x39404a){if(_0x39404a){_0x31e62c['model']=_[_0xbe5e('0x5b')](db['ScreenRecording']['rawAttributes']);_0x31e62c[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x37506b[_0xbe5e('0x48')]);_0x31e62c[_0xbe5e('0x5e')]=_[_0xbe5e('0x5f')](_0x31e62c[_0xbe5e('0x5a')],_0x31e62c[_0xbe5e('0x48')]);_0x9c11ac[_0xbe5e('0x4d')]=_[_0xbe5e('0x5f')](_0x31e62c[_0xbe5e('0x5a')],qs[_0xbe5e('0x60')](_0x37506b[_0xbe5e('0x48')]['fields']));_0x9c11ac[_0xbe5e('0x4d')]=_0x9c11ac[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x9c11ac[_0xbe5e('0x4d')]:_0x31e62c[_0xbe5e('0x5a')];if(!_0x37506b[_0xbe5e('0x48')]['hasOwnProperty']('nolimit')){_0x9c11ac['limit']=qs[_0xbe5e('0x2a')](_0x37506b['query'][_0xbe5e('0x2a')]);_0x9c11ac['offset']=qs[_0xbe5e('0x28')](_0x37506b['query']['offset']);}_0x9c11ac['order']=qs[_0xbe5e('0xd6')](_0x37506b['query']['sort']);_0x9c11ac[_0xbe5e('0x47')]=qs['filters'](_[_0xbe5e('0xdf')](_0x37506b[_0xbe5e('0x48')],_0x31e62c[_0xbe5e('0x5e')]));_0x9c11ac['where'][_0xbe5e('0xe4')]=_0x39404a['id'];if(_0x37506b[_0xbe5e('0x48')][_0xbe5e('0x44')]){_0x9c11ac[_0xbe5e('0x47')]=_['merge'](_0x9c11ac[_0xbe5e('0x47')],{'$or':_['map'](_0x9c11ac[_0xbe5e('0x4d')],function(_0x1e38d7){var _0x49f03f={};_0x49f03f[_0x1e38d7]={'$like':'%'+_0x37506b[_0xbe5e('0x48')]['filter']+'%'};return _0x49f03f;})});}_0x9c11ac=_['merge']({},_0x9c11ac,_0x37506b[_0xbe5e('0x63')]);return db['ScreenRecording'][_0xbe5e('0x2b')]({'where':_0x9c11ac[_0xbe5e('0x47')]})['then'](function(_0xab647a){_0x1ee04a['count']=_0xab647a;if(_0x37506b[_0xbe5e('0x48')][_0xbe5e('0x61')]){_0x9c11ac[_0xbe5e('0x49')]=[{'all':!![]}];}return db[_0xbe5e('0xe6')][_0xbe5e('0x4e')](_0x9c11ac);})['then'](function(_0x3ba8df){_0x1ee04a[_0xbe5e('0x4f')]=_0x3ba8df;return _0x1ee04a;});}})[_0xbe5e('0x18')](respondWithFilteredResult(_0x39c1af,_0x9c11ac))[_0xbe5e('0x23')](handleError(_0x39c1af,null));};exports['getChatInteractions']=function(_0x41400d,_0x59d878){var _0x37882d={};var _0x20ce32={};var _0x1130c2;var _0x547474;return db[_0xbe5e('0x40')]['findOne']({'where':{'id':_0x41400d[_0xbe5e('0x67')]['id']}})['then'](handleEntityNotFound(_0x59d878,null))[_0xbe5e('0x18')](function(_0x20947e){if(_0x20947e){_0x1130c2=_0x20947e;_0x20ce32[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db[_0xbe5e('0xe7')][_0xbe5e('0x5c')]);_0x20ce32[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x41400d['query']);_0x20ce32[_0xbe5e('0x5e')]=_[_0xbe5e('0x5f')](_0x20ce32['model'],_0x20ce32['query']);_0x37882d['attributes']=_[_0xbe5e('0x5f')](_0x20ce32[_0xbe5e('0x5a')],qs[_0xbe5e('0x60')](_0x41400d[_0xbe5e('0x48')][_0xbe5e('0x60')]));_0x37882d[_0xbe5e('0x4d')]=_0x37882d[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x37882d[_0xbe5e('0x4d')]:_0x20ce32[_0xbe5e('0x5a')];_0x37882d[_0xbe5e('0xd5')]=qs['sort'](_0x41400d['query'][_0xbe5e('0xd6')]);_0x37882d['where']=qs[_0xbe5e('0x5e')](_['pick'](_0x41400d[_0xbe5e('0x48')],_0x20ce32[_0xbe5e('0x5e')]));if(_0x41400d['query'][_0xbe5e('0x44')]){_0x37882d[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x37882d['where'],{'$or':_[_0xbe5e('0x37')](_0x37882d[_0xbe5e('0x4d')],function(_0x3b3da0){var _0x3e815b={};_0x3e815b[_0x3b3da0]={'$like':'%'+_0x41400d['query'][_0xbe5e('0x44')]+'%'};return _0x3e815b;})});}_0x37882d=_[_0xbe5e('0x62')]({},_0x37882d,_0x41400d[_0xbe5e('0x63')]);return _0x1130c2['getChatInteractions'](_0x37882d);}})['then'](function(_0xcc149b){if(_0xcc149b){_0x547474=_0xcc149b[_0xbe5e('0x51')];if(!_0x41400d[_0xbe5e('0x48')][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x37882d[_0xbe5e('0x2a')]=qs[_0xbe5e('0x2a')](_0x41400d['query']['limit']);_0x37882d['offset']=qs[_0xbe5e('0x28')](_0x41400d[_0xbe5e('0x48')][_0xbe5e('0x28')]);}return _0x1130c2[_0xbe5e('0xe8')](_0x37882d);}})[_0xbe5e('0x18')](function(_0x59b869){if(_0x59b869){return _0x59b869?{'count':_0x547474,'rows':_0x59b869}:null;}})[_0xbe5e('0x18')](respondWithResult(_0x59d878,null))[_0xbe5e('0x23')](handleError(_0x59d878,null));};exports[_0xbe5e('0xe9')]=function(_0x1bec73,_0xd43065){var _0x3d112b={};var _0x38bf89={};var _0x1b2ddc;var _0x232468;return db[_0xbe5e('0x40')][_0xbe5e('0xa2')]({'where':{'id':_0x1bec73[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0xd43065,null))[_0xbe5e('0x18')](function(_0xfbd41e){if(_0xfbd41e){_0x1b2ddc=_0xfbd41e;_0x38bf89['model']=_['keys'](db[_0xbe5e('0xea')][_0xbe5e('0x5c')]);_0x38bf89[_0xbe5e('0x48')]=_['keys'](_0x1bec73[_0xbe5e('0x48')]);_0x38bf89[_0xbe5e('0x5e')]=_[_0xbe5e('0x5f')](_0x38bf89['model'],_0x38bf89[_0xbe5e('0x48')]);_0x3d112b[_0xbe5e('0x4d')]=_['intersection'](_0x38bf89[_0xbe5e('0x5a')],qs[_0xbe5e('0x60')](_0x1bec73[_0xbe5e('0x48')][_0xbe5e('0x60')]));_0x3d112b['attributes']=_0x3d112b['attributes'][_0xbe5e('0x51')]?_0x3d112b['attributes']:_0x38bf89[_0xbe5e('0x5a')];_0x3d112b[_0xbe5e('0xd5')]=qs[_0xbe5e('0xd6')](_0x1bec73[_0xbe5e('0x48')][_0xbe5e('0xd6')]);_0x3d112b['where']=qs[_0xbe5e('0x5e')](_[_0xbe5e('0xdf')](_0x1bec73[_0xbe5e('0x48')],_0x38bf89[_0xbe5e('0x5e')]));if(_0x1bec73[_0xbe5e('0x48')]['filter']){_0x3d112b[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x3d112b[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x3d112b['attributes'],function(_0x514572){var _0x45f327={};_0x45f327[_0x514572]={'$like':'%'+_0x1bec73['query'][_0xbe5e('0x44')]+'%'};return _0x45f327;})});}_0x3d112b=_[_0xbe5e('0x62')]({},_0x3d112b,_0x1bec73['options']);return _0x1b2ddc[_0xbe5e('0xe9')](_0x3d112b);}})['then'](function(_0x574f69){if(_0x574f69){_0x232468=_0x574f69[_0xbe5e('0x51')];if(!_0x1bec73[_0xbe5e('0x48')][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x3d112b[_0xbe5e('0x2a')]=qs[_0xbe5e('0x2a')](_0x1bec73[_0xbe5e('0x48')][_0xbe5e('0x2a')]);_0x3d112b[_0xbe5e('0x28')]=qs[_0xbe5e('0x28')](_0x1bec73[_0xbe5e('0x48')][_0xbe5e('0x28')]);}return _0x1b2ddc[_0xbe5e('0xe9')](_0x3d112b);}})['then'](function(_0x3f992d){if(_0x3f992d){return _0x3f992d?{'count':_0x232468,'rows':_0x3f992d}:null;}})[_0xbe5e('0x18')](respondWithResult(_0xd43065,null))[_0xbe5e('0x23')](handleError(_0xd43065,null));};exports[_0xbe5e('0xeb')]=function(_0x2161fb,_0x42ffef){var _0x29d2d8={'raw':!![],'where':{}};var _0x4ca41b={};var _0x2bf807={'count':0x0,'rows':[]};return db[_0xbe5e('0x40')][_0xbe5e('0xa2')]({'where':{'id':_0x2161fb['params']['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x42ffef,null))[_0xbe5e('0x18')](function(_0x51f255){if(_0x51f255){_0x4ca41b[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db[_0xbe5e('0xec')]['rawAttributes']);_0x4ca41b[_0xbe5e('0x48')]=_['keys'](_0x2161fb[_0xbe5e('0x48')]);_0x4ca41b['filters']=_[_0xbe5e('0x5f')](_0x4ca41b[_0xbe5e('0x5a')],_0x4ca41b['query']);_0x29d2d8[_0xbe5e('0x4d')]=_[_0xbe5e('0x5f')](_0x4ca41b[_0xbe5e('0x5a')],qs[_0xbe5e('0x60')](_0x2161fb[_0xbe5e('0x48')][_0xbe5e('0x60')]));_0x29d2d8[_0xbe5e('0x4d')]=_0x29d2d8[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x29d2d8[_0xbe5e('0x4d')]:_0x4ca41b[_0xbe5e('0x5a')];if(!_0x2161fb['query'][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x29d2d8[_0xbe5e('0x2a')]=qs[_0xbe5e('0x2a')](_0x2161fb['query']['limit']);_0x29d2d8[_0xbe5e('0x28')]=qs[_0xbe5e('0x28')](_0x2161fb[_0xbe5e('0x48')]['offset']);}_0x29d2d8[_0xbe5e('0xd5')]=qs[_0xbe5e('0xd6')](_0x2161fb[_0xbe5e('0x48')][_0xbe5e('0xd6')]);_0x29d2d8[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_[_0xbe5e('0xdf')](_0x2161fb[_0xbe5e('0x48')],_0x4ca41b[_0xbe5e('0x5e')]));_0x29d2d8[_0xbe5e('0x47')][_0xbe5e('0xe4')]=_0x51f255['id'];if(_0x2161fb[_0xbe5e('0x48')][_0xbe5e('0x44')]){_0x29d2d8[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x29d2d8[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x29d2d8[_0xbe5e('0x4d')],function(_0x21967c){var _0x23d67e={};_0x23d67e[_0x21967c]={'$like':'%'+_0x2161fb[_0xbe5e('0x48')][_0xbe5e('0x44')]+'%'};return _0x23d67e;})});}_0x29d2d8=_['merge']({},_0x29d2d8,_0x2161fb[_0xbe5e('0x63')]);return db['MailInteraction'][_0xbe5e('0x2b')]({'where':_0x29d2d8['where']})[_0xbe5e('0x18')](function(_0x769958){_0x2bf807[_0xbe5e('0x2b')]=_0x769958;if(_0x2161fb[_0xbe5e('0x48')]['includeAll']){_0x29d2d8[_0xbe5e('0x49')]=[{'all':!![]}];}return db[_0xbe5e('0xec')][_0xbe5e('0x4e')](_0x29d2d8);})[_0xbe5e('0x18')](function(_0x5305bf){_0x2bf807[_0xbe5e('0x4f')]=_0x5305bf;return _0x2bf807;});}})[_0xbe5e('0x18')](respondWithFilteredResult(_0x42ffef,_0x29d2d8))[_0xbe5e('0x23')](handleError(_0x42ffef,null));};exports[_0xbe5e('0xed')]=function(_0x32371c,_0x25fd55){var _0x82bdd8={};var _0x585d85={};var _0x1dbbc7;var _0x43791e;return db[_0xbe5e('0x40')][_0xbe5e('0xa2')]({'where':{'id':_0x32371c[_0xbe5e('0x67')]['id']}})['then'](handleEntityNotFound(_0x25fd55,null))[_0xbe5e('0x18')](function(_0x87733f){if(_0x87733f){_0x1dbbc7=_0x87733f;_0x585d85[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db[_0xbe5e('0xee')]['rawAttributes']);_0x585d85[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x32371c[_0xbe5e('0x48')]);_0x585d85[_0xbe5e('0x5e')]=_['intersection'](_0x585d85['model'],_0x585d85[_0xbe5e('0x48')]);_0x82bdd8[_0xbe5e('0x4d')]=_['intersection'](_0x585d85[_0xbe5e('0x5a')],qs[_0xbe5e('0x60')](_0x32371c[_0xbe5e('0x48')][_0xbe5e('0x60')]));_0x82bdd8[_0xbe5e('0x4d')]=_0x82bdd8[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x82bdd8['attributes']:_0x585d85[_0xbe5e('0x5a')];_0x82bdd8[_0xbe5e('0xd5')]=qs['sort'](_0x32371c[_0xbe5e('0x48')][_0xbe5e('0xd6')]);_0x82bdd8[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_['pick'](_0x32371c[_0xbe5e('0x48')],_0x585d85[_0xbe5e('0x5e')]));if(_0x32371c[_0xbe5e('0x48')][_0xbe5e('0x44')]){_0x82bdd8[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x82bdd8[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x82bdd8[_0xbe5e('0x4d')],function(_0x4ef7cf){var _0x47ef74={};_0x47ef74[_0x4ef7cf]={'$like':'%'+_0x32371c[_0xbe5e('0x48')][_0xbe5e('0x44')]+'%'};return _0x47ef74;})});}_0x82bdd8=_[_0xbe5e('0x62')]({},_0x82bdd8,_0x32371c[_0xbe5e('0x63')]);return _0x1dbbc7[_0xbe5e('0xed')](_0x82bdd8);}})[_0xbe5e('0x18')](function(_0x2f8bb5){if(_0x2f8bb5){_0x43791e=_0x2f8bb5[_0xbe5e('0x51')];if(!_0x32371c[_0xbe5e('0x48')][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x82bdd8['limit']=qs[_0xbe5e('0x2a')](_0x32371c[_0xbe5e('0x48')][_0xbe5e('0x2a')]);_0x82bdd8['offset']=qs[_0xbe5e('0x28')](_0x32371c[_0xbe5e('0x48')]['offset']);}return _0x1dbbc7[_0xbe5e('0xed')](_0x82bdd8);}})[_0xbe5e('0x18')](function(_0x83d234){if(_0x83d234){return _0x83d234?{'count':_0x43791e,'rows':_0x83d234}:null;}})[_0xbe5e('0x18')](respondWithResult(_0x25fd55,null))[_0xbe5e('0x23')](handleError(_0x25fd55,null));};exports[_0xbe5e('0xef')]=function(_0x509ecd,_0xdf57d1){var _0x5ef73d={};var _0x2c3c9f={};var _0x1286f4;var _0x5e779e;return db[_0xbe5e('0x40')][_0xbe5e('0xa2')]({'where':{'id':_0x509ecd[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0xdf57d1,null))['then'](function(_0x12f083){if(_0x12f083){_0x1286f4=_0x12f083;_0x2c3c9f[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db[_0xbe5e('0xf0')][_0xbe5e('0x5c')]);_0x2c3c9f[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x509ecd[_0xbe5e('0x48')]);_0x2c3c9f[_0xbe5e('0x5e')]=_['intersection'](_0x2c3c9f[_0xbe5e('0x5a')],_0x2c3c9f[_0xbe5e('0x48')]);_0x5ef73d[_0xbe5e('0x4d')]=_[_0xbe5e('0x5f')](_0x2c3c9f[_0xbe5e('0x5a')],qs[_0xbe5e('0x60')](_0x509ecd[_0xbe5e('0x48')][_0xbe5e('0x60')]));_0x5ef73d[_0xbe5e('0x4d')]=_0x5ef73d[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x5ef73d[_0xbe5e('0x4d')]:_0x2c3c9f[_0xbe5e('0x5a')];_0x5ef73d[_0xbe5e('0xd5')]=qs[_0xbe5e('0xd6')](_0x509ecd[_0xbe5e('0x48')][_0xbe5e('0xd6')]);_0x5ef73d[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_[_0xbe5e('0xdf')](_0x509ecd[_0xbe5e('0x48')],_0x2c3c9f[_0xbe5e('0x5e')]));if(_0x509ecd['query']['filter']){_0x5ef73d['where']=_[_0xbe5e('0x62')](_0x5ef73d[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x5ef73d[_0xbe5e('0x4d')],function(_0x2b0650){var _0xf341e2={};_0xf341e2[_0x2b0650]={'$like':'%'+_0x509ecd[_0xbe5e('0x48')]['filter']+'%'};return _0xf341e2;})});}_0x5ef73d=_[_0xbe5e('0x62')]({},_0x5ef73d,_0x509ecd[_0xbe5e('0x63')]);return _0x1286f4[_0xbe5e('0xef')](_0x5ef73d);}})[_0xbe5e('0x18')](function(_0x403819){if(_0x403819){_0x5e779e=_0x403819[_0xbe5e('0x51')];if(!_0x509ecd[_0xbe5e('0x48')][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x5ef73d[_0xbe5e('0x2a')]=qs['limit'](_0x509ecd[_0xbe5e('0x48')][_0xbe5e('0x2a')]);_0x5ef73d[_0xbe5e('0x28')]=qs[_0xbe5e('0x28')](_0x509ecd[_0xbe5e('0x48')][_0xbe5e('0x28')]);}return _0x1286f4[_0xbe5e('0xef')](_0x5ef73d);}})['then'](function(_0x34c10f){if(_0x34c10f){return _0x34c10f?{'count':_0x5e779e,'rows':_0x34c10f}:null;}})[_0xbe5e('0x18')](respondWithResult(_0xdf57d1,null))['catch'](handleError(_0xdf57d1,null));};exports['getWhatsappInteractions']=function(_0x4ebe8c,_0x25d3d7){var _0x161747={};var _0x381bb0={};var _0x22756f;var _0x52c286;return db[_0xbe5e('0x40')][_0xbe5e('0xa2')]({'where':{'id':_0x4ebe8c['params']['id']}})['then'](handleEntityNotFound(_0x25d3d7,null))['then'](function(_0x2a16f1){if(_0x2a16f1){_0x22756f=_0x2a16f1;_0x381bb0['model']=_[_0xbe5e('0x5b')](db[_0xbe5e('0xf1')]['rawAttributes']);_0x381bb0['query']=_['keys'](_0x4ebe8c[_0xbe5e('0x48')]);_0x381bb0[_0xbe5e('0x5e')]=_[_0xbe5e('0x5f')](_0x381bb0[_0xbe5e('0x5a')],_0x381bb0[_0xbe5e('0x48')]);_0x161747[_0xbe5e('0x4d')]=_[_0xbe5e('0x5f')](_0x381bb0[_0xbe5e('0x5a')],qs['fields'](_0x4ebe8c['query'][_0xbe5e('0x60')]));_0x161747[_0xbe5e('0x4d')]=_0x161747['attributes']['length']?_0x161747[_0xbe5e('0x4d')]:_0x381bb0[_0xbe5e('0x5a')];_0x161747[_0xbe5e('0xd5')]=qs[_0xbe5e('0xd6')](_0x4ebe8c[_0xbe5e('0x48')]['sort']);_0x161747[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_[_0xbe5e('0xdf')](_0x4ebe8c[_0xbe5e('0x48')],_0x381bb0[_0xbe5e('0x5e')]));if(_0x4ebe8c[_0xbe5e('0x48')][_0xbe5e('0x44')]){_0x161747[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x161747[_0xbe5e('0x47')],{'$or':_['map'](_0x161747[_0xbe5e('0x4d')],function(_0x2bc615){var _0x8d7d13={};_0x8d7d13[_0x2bc615]={'$like':'%'+_0x4ebe8c['query']['filter']+'%'};return _0x8d7d13;})});}_0x161747=_[_0xbe5e('0x62')]({},_0x161747,_0x4ebe8c[_0xbe5e('0x63')]);return _0x22756f[_0xbe5e('0xf2')](_0x161747);}})['then'](function(_0x2c53e){if(_0x2c53e){_0x52c286=_0x2c53e[_0xbe5e('0x51')];if(!_0x4ebe8c[_0xbe5e('0x48')]['hasOwnProperty'](_0xbe5e('0xdc'))){_0x161747['limit']=qs[_0xbe5e('0x2a')](_0x4ebe8c[_0xbe5e('0x48')][_0xbe5e('0x2a')]);_0x161747[_0xbe5e('0x28')]=qs['offset'](_0x4ebe8c[_0xbe5e('0x48')][_0xbe5e('0x28')]);}return _0x22756f[_0xbe5e('0xf2')](_0x161747);}})['then'](function(_0x3f55aa){if(_0x3f55aa){return _0x3f55aa?{'count':_0x52c286,'rows':_0x3f55aa}:null;}})[_0xbe5e('0x18')](respondWithResult(_0x25d3d7,null))[_0xbe5e('0x23')](handleError(_0x25d3d7,null));};exports[_0xbe5e('0xf3')]=function(_0xc08a05,_0x408c57,_0x32027b){var _0x4bf952;var _0x34386b;var _0x1697a7;var _0xd0b868=!_[_0xbe5e('0x72')](_0xc08a05[_0xbe5e('0x67')]['id'])?_0xc08a05[_0xbe5e('0x67')]['id']:!_[_0xbe5e('0x72')](_0xc08a05['user']['id'])?_0xc08a05[_0xbe5e('0x34')]['id']:null;return db[_0xbe5e('0x40')]['find']({'where':{'id':_0xd0b868,'role':{'$or':[_0xbe5e('0x32'),_0xbe5e('0x34'),_0xbe5e('0x7d')]}},'attributes':['id',_0xbe5e('0x3d'),_0xbe5e('0xf4'),_0xbe5e('0xf5'),_0xbe5e('0x31'),'internal','loginInPause']})[_0xbe5e('0x18')](function(_0x287a93){if(_0x287a93){if(_0x287a93[_0xbe5e('0x31')]===_0xbe5e('0x7d')){_0x4bf952=_0x287a93;if(_0xc08a05[_0xbe5e('0x66')][_0xbe5e('0xb6')]){_0x1697a7=util[_0xbe5e('0xf6')](_0xbe5e('0xf7'),_0x4bf952[_0xc08a05[_0xbe5e('0x66')][_0xbe5e('0xb6')]]);}else if(_0xc08a05[_0xbe5e('0x66')][_0xbe5e('0xf8')]){_0x1697a7=util[_0xbe5e('0xf6')](_0xbe5e('0xf9'),_0xc08a05[_0xbe5e('0x66')][_0xbe5e('0xf8')]);}else{_0x1697a7=util[_0xbe5e('0xf6')]('SIP/%s',_0x4bf952[_0xbe5e('0x3d')]);}socket['to'](util[_0xbe5e('0xf6')](_0xbe5e('0xfa'),_0x4bf952['name']))[_0xbe5e('0x2d')](_0xbe5e('0xfb'),{'user':{'id':_0x4bf952['id'],'name':_0x4bf952[_0xbe5e('0x3d')]},'ip':_0xc08a05[_0xbe5e('0xfc')]['x-forwarded-for']||_0xc08a05[_0xbe5e('0xfd')]['remoteAddress']||_0xc08a05[_0xbe5e('0xfe')][_0xbe5e('0xff')]||_0xc08a05[_0xbe5e('0xfd')][_0xbe5e('0xfe')][_0xbe5e('0xff')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x4bf952[_0xbe5e('0x3d')]},'individualHooks':!![]});}}else{throw new db[(_0xbe5e('0x9e'))][(_0xbe5e('0x9f'))](_0xbe5e('0x100'));}})['then'](function(){if(_0x4bf952){return _0x4bf952[_0xbe5e('0x101')]({'raw':!![]});}})[_0xbe5e('0x18')](function(_0x410d26){if(_0x4bf952){if(_0x410d26){_0x34386b=_0x410d26;if(_0x34386b[_0xbe5e('0x51')]){var _0x389118=_0x34386b[_0xbe5e('0x37')](function(_0x3c31d1){var _0x31ef88={'membername':_0x4bf952[_0xbe5e('0x3d')],'UserId':_0x4bf952['id'],'queue_name':_0x3c31d1[_0xbe5e('0x3d')],'VoiceQueueId':_0x3c31d1['id'],'interface':_0x1697a7,'paused':_0x4bf952[_0xbe5e('0xaa')]||![],'penalty':_0x3c31d1[_0xbe5e('0x102')]||0x0};return db['UserVoiceQueueRt'][_0xbe5e('0xb9')](_0x31ef88);});return Promise['all'](_0x389118);}}}})[_0xbe5e('0x18')](function(){if(_0x4bf952){return db[_0xbe5e('0x103')][_0xbe5e('0x4e')]({'where':{'membername':_0x4bf952['name'],'exitAt':null}});}})[_0xbe5e('0x18')](function(_0x4eed4d){if(_0x4bf952){var _0x422a3f=[];_0x4eed4d['forEach'](function(_0x4ce797){_0x422a3f[_0xbe5e('0x52')](_0x4ce797[_0xbe5e('0x65')]({'exitAt':moment()[_0xbe5e('0xf6')](_0xbe5e('0x104'))}));});return Promise[_0xbe5e('0x64')](_0x422a3f);}})[_0xbe5e('0x18')](function(){if(_0x4bf952){var _0x338b67=[];var _0x13af48=[];var _0x2f2a40=utils[_0xbe5e('0x105')]();var _0x3615ce={'membername':_0x4bf952['name'],'interface':_0x1697a7,'enterAt':moment()['format'](_0xbe5e('0x104')),'role':_0x4bf952['role'],'internal':_0x4bf952['internal']};_0x2f2a40['forEach'](function(_0x38ac4b){_0x338b67[_0xbe5e('0x52')](_[_0xbe5e('0x62')]({'channel':_0x38ac4b,'type':_0xbe5e('0x106'),'data1':_0xc08a05[_0xbe5e('0x66')][_0xbe5e('0x107')],'data2':_0x1697a7},_0x3615ce));if(_0x4bf952[_0xbe5e('0xaa')]){_0x13af48[_0xbe5e('0x52')](_['merge']({'channel':_0x38ac4b,'type':_0xbe5e('0x108'),'data1':_0xbe5e('0x109')},_0x3615ce));}});return db['MemberReport']['bulkCreate'](_0x338b67[_0xbe5e('0xd2')](_0x13af48),{'individualHooks':!![]});}})[_0xbe5e('0x18')](function(){if(_0x4bf952){return _0x4bf952['update']({'online':!![],'lastLoginAt':moment()[_0xbe5e('0xf6')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x4bf952[_0xbe5e('0xaa')]||![],'mailPause':_0x4bf952[_0xbe5e('0xaa')]||![],'chatPause':_0x4bf952[_0xbe5e('0xaa')]||![],'faxPause':_0x4bf952[_0xbe5e('0xaa')]||![],'smsPause':_0x4bf952['loginInPause']||![],'openchannelPause':_0x4bf952[_0xbe5e('0xaa')]||![],'whatsappPause':_0x4bf952[_0xbe5e('0xaa')]||![],'pauseType':_0x4bf952[_0xbe5e('0xaa')]?_0xbe5e('0x109'):null,'interface':_0x1697a7,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xbe5e('0x18')](function(_0x20aa9b){if(_0xc08a05['isMiddleware']){return _0x32027b();}else{return Promise['resolve'](_0x20aa9b)[_0xbe5e('0x18')](respondWithResult(_0x408c57,null));}})[_0xbe5e('0x23')](handleError(_0x408c57,null));};exports[_0xbe5e('0x10a')]=function(_0x153945,_0x145d50){var _0x1cd1bf;return db[_0xbe5e('0x40')]['find']({'where':{'id':_0x153945[_0xbe5e('0x67')]['id'],'role':_0xbe5e('0x7d')},'attributes':['id',_0xbe5e('0x3d'),_0xbe5e('0x31')]})[_0xbe5e('0x18')](handleEntityNotFound(_0x145d50,null))[_0xbe5e('0x18')](function(_0x3f8b26){if(_0x3f8b26){_0x1cd1bf=_0x3f8b26;return db['UserVoiceQueueRt'][_0xbe5e('0x2f')]({'where':{'membername':_0x1cd1bf['name']},'individualHooks':!![]});}})[_0xbe5e('0x18')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x1cd1bf[_0xbe5e('0x3d')],'exitAt':null}});})[_0xbe5e('0x18')](function(_0x6db618){var _0xb1e904=[];_0x6db618[_0xbe5e('0x10b')](function(_0x41e9db){_0xb1e904[_0xbe5e('0x52')](_0x41e9db[_0xbe5e('0x65')]({'exitAt':moment()[_0xbe5e('0xf6')](_0xbe5e('0x104'))}));});return Promise['all'](_0xb1e904);})['then'](function(){return _0x1cd1bf[_0xbe5e('0x65')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xbe5e('0x18')](respondWithResult(_0x145d50,null))[_0xbe5e('0x23')](handleError(_0x145d50,null));};exports[_0xbe5e('0x10c')]=function(_0x5ee65e,_0x55ffa7){var _0x1b0f96;return db[_0xbe5e('0xb8')]['update']({'paused':0x1},{'where':{'UserId':_0x5ee65e[_0xbe5e('0x67')]['id']},'individualHooks':!![]})[_0xbe5e('0x18')](function(){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x5ee65e[_0xbe5e('0x67')]['id'],'role':_0xbe5e('0x7d')},'attributes':['id','name','role',_0xbe5e('0x6c'),'interface',_0xbe5e('0xa9')]});})[_0xbe5e('0x18')](handleEntityNotFound(_0x55ffa7,null))[_0xbe5e('0x18')](function(_0x233722){if(_0x233722){_0x1b0f96=_0x233722;return respondWithRpcPromise(_0xbe5e('0x10d'),_0xbe5e('0x10c'),{'id':_0x1b0f96['id'],'name':_0x1b0f96[_0xbe5e('0x3d')],'pause':!![]});}})[_0xbe5e('0x18')](function(){if(_0x1b0f96){return db[_0xbe5e('0x103')]['findAll']({'where':{'membername':_0x1b0f96[_0xbe5e('0x3d')],'type':_0xbe5e('0x108'),'exitAt':null}});}})[_0xbe5e('0x18')](function(_0x4f202d){if(_0x4f202d['length']){var _0x5d1198=moment()['format'](_0xbe5e('0x104'));for(var _0xf5512c=0x0,_0x421d61=_0x4f202d['length'];_0xf5512c<_0x421d61;_0xf5512c++){_0x4f202d[_0xf5512c][_0xbe5e('0x10e')]({'exitAt':_0x5d1198});}}})[_0xbe5e('0x18')](function(){var _0x1e3b63=[];var _0x43b10d=utils[_0xbe5e('0x105')]();_0x43b10d[_0xbe5e('0x10b')](function(_0x17f0af){_0x1e3b63[_0xbe5e('0x52')]({'channel':_0x17f0af,'membername':_0x1b0f96[_0xbe5e('0x3d')],'interface':_[_0xbe5e('0x72')](_0x1b0f96[_0xbe5e('0xb6')])?util['format'](_0xbe5e('0xf9'),_0x1b0f96['name']):_0x1b0f96[_0xbe5e('0xb6')],'type':_0xbe5e('0x108'),'enterAt':moment()[_0xbe5e('0xf6')](_0xbe5e('0x104')),'data1':_0x5ee65e[_0xbe5e('0x66')][_0xbe5e('0x42')]||_0xbe5e('0x10f'),'role':_0x1b0f96['role'],'internal':_0x1b0f96[_0xbe5e('0x6c')]});});return db[_0xbe5e('0x103')][_0xbe5e('0x90')](_0x1e3b63,{'individualHooks':!![]});})[_0xbe5e('0x18')](function(){return _0x1b0f96['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5ee65e['body'][_0xbe5e('0x42')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xbe5e('0xf6')](_0xbe5e('0x104'))});})['then'](respondWithResult(_0x55ffa7,null))[_0xbe5e('0x23')](handleError(_0x55ffa7,null));};exports[_0xbe5e('0x110')]=function(_0x3f1bd4,_0x19dc34){if(_0x3f1bd4[_0xbe5e('0x66')][_0xbe5e('0xa8')]&&!utils['isValidChannel'](_0x3f1bd4[_0xbe5e('0x66')][_0xbe5e('0xa8')])){throw new APIBadRequestError(util[_0xbe5e('0xf6')](_0xbe5e('0x111'),_0x3f1bd4[_0xbe5e('0x66')][_0xbe5e('0xa8')]));}return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x3f1bd4[_0xbe5e('0x67')]['id']},'attributes':['id','name',_0xbe5e('0x31'),_0xbe5e('0x6c'),_0xbe5e('0xb6'),_0xbe5e('0xa9'),_0xbe5e('0xb7'),_0xbe5e('0x112'),_0xbe5e('0x113'),'faxPause',_0xbe5e('0x114'),_0xbe5e('0x115'),_0xbe5e('0x116'),_0xbe5e('0x117'),_0xbe5e('0x118')]})['then'](function(_0x192376){if(!_0x192376){throw new APINotFoundError(util[_0xbe5e('0xf6')](_0xbe5e('0x119'),_0x3f1bd4['params']['id']));}return _0x192376[_0xbe5e('0x110')](_0x3f1bd4[_0xbe5e('0x66')][_0xbe5e('0xa8')]);})[_0xbe5e('0x18')](respondWithResult(_0x19dc34,null))[_0xbe5e('0x23')](APIHandleError(_0x19dc34));};exports['getTeams']=function(_0x4f9100,_0x3bf2be){var _0x5f3e6a={};var _0x500e06={};var _0x2aa032;var _0x5d7027;return db['User'][_0xbe5e('0xa2')]({'where':{'id':_0x4f9100['params']['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x3bf2be,null))[_0xbe5e('0x18')](function(_0x1eefeb){if(_0x1eefeb){_0x2aa032=_0x1eefeb;_0x500e06[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db[_0xbe5e('0x11a')][_0xbe5e('0x5c')]);_0x500e06[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x4f9100[_0xbe5e('0x48')]);_0x500e06['filters']=_[_0xbe5e('0x5f')](_0x500e06[_0xbe5e('0x5a')],_0x500e06[_0xbe5e('0x48')]);_0x5f3e6a[_0xbe5e('0x4d')]=_[_0xbe5e('0x5f')](_0x500e06[_0xbe5e('0x5a')],qs['fields'](_0x4f9100['query'][_0xbe5e('0x60')]));_0x5f3e6a[_0xbe5e('0x4d')]=_0x5f3e6a['attributes'][_0xbe5e('0x51')]?_0x5f3e6a[_0xbe5e('0x4d')]:_0x500e06[_0xbe5e('0x5a')];_0x5f3e6a[_0xbe5e('0xd5')]=qs[_0xbe5e('0xd6')](_0x4f9100['query']['sort']);_0x5f3e6a[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_['pick'](_0x4f9100[_0xbe5e('0x48')],_0x500e06[_0xbe5e('0x5e')]));if(_0x4f9100[_0xbe5e('0x48')][_0xbe5e('0x44')]){_0x5f3e6a[_0xbe5e('0x47')]=_['merge'](_0x5f3e6a[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x5f3e6a['attributes'],function(_0x5c9175){var _0x2e7660={};_0x2e7660[_0x5c9175]={'$like':'%'+_0x4f9100[_0xbe5e('0x48')][_0xbe5e('0x44')]+'%'};return _0x2e7660;})});}_0x5f3e6a=_[_0xbe5e('0x62')]({},_0x5f3e6a,_0x4f9100[_0xbe5e('0x63')]);return _0x2aa032[_0xbe5e('0x11b')](_0x5f3e6a);}})[_0xbe5e('0x18')](function(_0x7c2bfd){if(_0x7c2bfd){_0x5d7027=_0x7c2bfd['length'];if(!_0x4f9100[_0xbe5e('0x48')][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x5f3e6a['limit']=qs['limit'](_0x4f9100['query'][_0xbe5e('0x2a')]);_0x5f3e6a[_0xbe5e('0x28')]=qs[_0xbe5e('0x28')](_0x4f9100[_0xbe5e('0x48')][_0xbe5e('0x28')]);}return _0x2aa032[_0xbe5e('0x11b')](_0x5f3e6a);}})[_0xbe5e('0x18')](function(_0x312f05){if(_0x312f05){return _0x312f05?{'count':_0x5d7027,'rows':_0x312f05}:null;}})[_0xbe5e('0x18')](respondWithResult(_0x3bf2be,null))['catch'](handleError(_0x3bf2be,null));};exports[_0xbe5e('0x11c')]=function(_0x3ab241,_0x436f52){var _0x144230=_0x3ab241[_0xbe5e('0x67')]['id'];var _0xfa5871=_0x3ab241[_0xbe5e('0x66')]?_0x3ab241[_0xbe5e('0x66')][_0xbe5e('0x6a')]:null;var _0x1df60f=[];return Promise[_0xbe5e('0x11d')]()[_0xbe5e('0x18')](function(){if(!_0xfa5871)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xbe5e('0x18')](function(){return db[_0xbe5e('0x40')][_0xbe5e('0xa2')]({'where':{'id':_0x144230}});})[_0xbe5e('0x18')](function(_0x444d80){if(!_0x444d80)throw new APINotFoundError(util[_0xbe5e('0xf6')](_0xbe5e('0x119'),_0x3ab241[_0xbe5e('0x67')]['id']));return db['sequelize']['transaction'](function(_0x2553b4){return _0x444d80[_0xbe5e('0x11c')](_0xfa5871,{'transaction':_0x2553b4})[_0xbe5e('0x18')](function(){return db[_0xbe5e('0x11a')][_0xbe5e('0x4e')]({'where':{'id':{'$in':_0xfa5871}}});})['then'](function(_0x26f43b){var _0x57349e=_[_0xbe5e('0x37')](_0x26f43b,function(_0x19ebcf){return _0x19ebcf[_0xbe5e('0x11e')]();});return Promise[_0xbe5e('0x64')](_0x57349e);})['then'](function(_0x57533f){_0x1df60f=_[_0xbe5e('0x11f')](_0x57533f);var _0x23bb61=_['map'](_0x1df60f,function(_0x119312){return _0x119312[_0xbe5e('0x120')](_0x444d80['id'],{'transaction':_0x2553b4});});return Promise['all'](_0x23bb61);})[_0xbe5e('0x18')](function(){if(!_0x444d80[_0xbe5e('0xa9')])return;var _0x18283f=_['filter'](_0x1df60f,function(_0x2c8851){return _0x2c8851['getDataValue'](_0xbe5e('0xa8'))===_0xbe5e('0x121');});var _0x579f87=_[_0xbe5e('0x37')](_0x18283f,function(_0x5c16a2){return db['UserVoiceQueueRt']['upsert']({'membername':_0x444d80['name'],'UserId':_0x444d80['id'],'queue_name':_0x5c16a2[_0xbe5e('0x3d')],'VoiceQueueId':_0x5c16a2['id'],'interface':_[_0xbe5e('0x72')](_0x444d80['interface'])?util[_0xbe5e('0xf6')](_0xbe5e('0xf9'),_0x444d80[_0xbe5e('0x3d')]):_0x444d80[_0xbe5e('0xb6')],'paused':_0x444d80[_0xbe5e('0xb7')]||![],'penalty':_0x444d80[_0xbe5e('0xb0')]},{'transaction':_0x2553b4});});return Promise[_0xbe5e('0x64')](_0x579f87);})[_0xbe5e('0x18')](function(){return db[_0xbe5e('0x122')][_0xbe5e('0x4e')]({'where':{'teamId':{'$in':_0xfa5871}}});})[_0xbe5e('0x18')](function(_0x58ae03){var _0x7be1a0=_[_0xbe5e('0x37')](_0x58ae03,function(_0x338188){return db[_0xbe5e('0x123')][_0xbe5e('0x89')]({'UserId':_0x444d80['id'],'VoicePrefixId':_0x338188[_0xbe5e('0x124')]},{'transaction':_0x2553b4});});return Promise['all'](_0x7be1a0);});});})['then'](function(){for(var _0xd93688=0x0;_0xd93688<_0x1df60f[_0xbe5e('0x51')];_0xd93688++){var _0x4357a6=_0x1df60f[_0xd93688][_0xbe5e('0x125')](_0xbe5e('0xa8'));var _0x57bf20=_0x4357a6+_0xbe5e('0xbd');socket[_0xbe5e('0x2d')](_0xbe5e('0x34')+_0x4357a6+_0xbe5e('0xb3'),{'UserId':_0x144230,['queueField']:_0x1df60f[_0xd93688]['id']});}})['then'](respondWithStatusCode(_0x436f52,null))[_0xbe5e('0x23')](APIHandleError(_0x436f52));};exports[_0xbe5e('0x126')]=function(_0x5038c9,_0xa6b576){var _0x13a386=_0x5038c9[_0xbe5e('0x67')]['id'];var _0x2cb9fd=null;if(_0x5038c9[_0xbe5e('0x48')][_0xbe5e('0x6a')]){_0x2cb9fd=_[_0xbe5e('0xbc')](_0x5038c9['query'][_0xbe5e('0x6a')])?_0x5038c9[_0xbe5e('0x48')][_0xbe5e('0x6a')]:[_0x5038c9[_0xbe5e('0x48')]['ids']];}var _0x5d9b63=[];return Promise[_0xbe5e('0x11d')]()[_0xbe5e('0x18')](function(){if(!_0x2cb9fd)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db['User'][_0xbe5e('0xa2')]({'where':{'id':_0x13a386}});})[_0xbe5e('0x18')](function(_0x554b66){if(!_0x554b66)throw new APINotFoundError(util[_0xbe5e('0xf6')](_0xbe5e('0x119'),_0x5038c9[_0xbe5e('0x67')]['id']));return db[_0xbe5e('0x74')][_0xbe5e('0x127')](function(_0x2f4af4){return _0x554b66[_0xbe5e('0x126')](_0x2cb9fd,{'transaction':_0x2f4af4})[_0xbe5e('0x18')](function(){return db[_0xbe5e('0x11a')][_0xbe5e('0x4e')]({'where':{'id':{'$in':_0x2cb9fd}}});})[_0xbe5e('0x18')](function(_0x45fde9){var _0x2a562a=_[_0xbe5e('0x37')](_0x45fde9,function(_0x5e7279){return _0x5e7279[_0xbe5e('0x11e')]();});return Promise[_0xbe5e('0x64')](_0x2a562a);})[_0xbe5e('0x18')](function(_0x89544a){_0x5d9b63=_[_0xbe5e('0x11f')](_0x89544a);var _0x21ed28=_['map'](_0x5d9b63,function(_0x548408){return _0x548408['removeAgent'](_0x554b66['id'],{'transaction':_0x2f4af4});});return Promise[_0xbe5e('0x64')](_0x21ed28);})[_0xbe5e('0x18')](function(){if(!_0x554b66[_0xbe5e('0xa9')])return;var _0x506c3d=_[_0xbe5e('0x44')](_0x5d9b63,function(_0x567493){return _0x567493[_0xbe5e('0x125')]('channel')===_0xbe5e('0x121');});var _0x5cb6d0=_['map'](_0x506c3d,function(_0x2bd3c4){return db[_0xbe5e('0xb8')]['destroy']({'where':{'VoiceQueueId':_0x2bd3c4['id'],'UserId':_0x554b66['id']},'transaction':_0x2f4af4});});return Promise[_0xbe5e('0x64')](_0x5cb6d0);})[_0xbe5e('0x18')](function(){return db[_0xbe5e('0x122')]['findAll']({'where':{'teamId':{'$in':_0x2cb9fd}}});})['then'](function(_0x26a06e){var _0x39cadf=_[_0xbe5e('0x37')](_0x26a06e,function(_0x9a9727){return db[_0xbe5e('0x123')]['destroy']({'where':{'UserId':_0x554b66['id'],'VoicePrefixId':_0x9a9727[_0xbe5e('0x124')]}},{'transaction':_0x2f4af4});});return Promise['all'](_0x39cadf);});});})['then'](function(){for(var _0x23265e=0x0;_0x23265e<_0x5d9b63[_0xbe5e('0x51')];_0x23265e++){var _0x24b68d=_0x5d9b63[_0x23265e][_0xbe5e('0x125')](_0xbe5e('0xa8'));var _0x1537d9=_0x24b68d+_0xbe5e('0xbd');socket[_0xbe5e('0x2d')](_0xbe5e('0x34')+_0x24b68d+_0xbe5e('0xbe'),{'UserId':_0x13a386,['queueField']:_0x5d9b63[_0x23265e]['id']});}})[_0xbe5e('0x18')](respondWithStatusCode(_0xa6b576,null))['catch'](APIHandleError(_0xa6b576));};exports[_0xbe5e('0x128')]=function(_0x5eeb61,_0x111219){var _0x5c9d38={};var _0x2760a0={};var _0x3240e4;var _0x5715e3;return db[_0xbe5e('0x40')][_0xbe5e('0xa2')]({'where':{'id':_0x5eeb61[_0xbe5e('0x67')]['id']}})['then'](handleEntityNotFound(_0x111219,null))[_0xbe5e('0x18')](function(_0x67c384){if(_0x67c384){_0x3240e4=_0x67c384;_0x2760a0[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db[_0xbe5e('0x129')][_0xbe5e('0x5c')]);_0x2760a0[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x5eeb61[_0xbe5e('0x48')]);_0x2760a0['filters']=_[_0xbe5e('0x5f')](_0x2760a0[_0xbe5e('0x5a')],_0x2760a0[_0xbe5e('0x48')]);_0x5c9d38[_0xbe5e('0x4d')]=_[_0xbe5e('0x5f')](_0x2760a0[_0xbe5e('0x5a')],qs['fields'](_0x5eeb61[_0xbe5e('0x48')][_0xbe5e('0x60')]));_0x5c9d38['attributes']=_0x5c9d38[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x5c9d38[_0xbe5e('0x4d')]:_0x2760a0[_0xbe5e('0x5a')];_0x5c9d38[_0xbe5e('0xd5')]=qs[_0xbe5e('0xd6')](_0x5eeb61[_0xbe5e('0x48')][_0xbe5e('0xd6')]);_0x5c9d38[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_[_0xbe5e('0xdf')](_0x5eeb61['query'],_0x2760a0[_0xbe5e('0x5e')]));if(_0x5eeb61['query'][_0xbe5e('0x44')]){_0x5c9d38['where']=_[_0xbe5e('0x62')](_0x5c9d38[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x5c9d38[_0xbe5e('0x4d')],function(_0x4a6019){var _0x271084={};_0x271084[_0x4a6019]={'$like':'%'+_0x5eeb61['query'][_0xbe5e('0x44')]+'%'};return _0x271084;})});}_0x5c9d38=_['merge']({},_0x5c9d38,_0x5eeb61[_0xbe5e('0x63')]);return _0x3240e4[_0xbe5e('0x128')](_0x5c9d38);}})[_0xbe5e('0x18')](function(_0x44e789){if(_0x44e789){_0x5715e3=_0x44e789[_0xbe5e('0x51')];if(!_0x5eeb61[_0xbe5e('0x48')][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x5c9d38[_0xbe5e('0x2a')]=qs[_0xbe5e('0x2a')](_0x5eeb61['query'][_0xbe5e('0x2a')]);_0x5c9d38[_0xbe5e('0x28')]=qs['offset'](_0x5eeb61['query'][_0xbe5e('0x28')]);}return _0x3240e4[_0xbe5e('0x128')](_0x5c9d38);}})[_0xbe5e('0x18')](function(_0x39fb5a){if(_0x39fb5a){return _0x39fb5a?{'count':_0x5715e3,'rows':_0x39fb5a}:null;}})[_0xbe5e('0x18')](respondWithResult(_0x111219,null))['catch'](handleError(_0x111219,null));};exports['getAgents']=function(_0x3fd5a4,_0x55038b){var _0x2e362a={};var _0x47442f={};var _0x28a56e;return db[_0xbe5e('0x40')][_0xbe5e('0xa2')]({'where':{'id':_0x3fd5a4[_0xbe5e('0x67')]['id']}})['then'](handleEntityNotFound(_0x55038b,null))['then'](function(_0x48d01a){if(_0x48d01a){_0x28a56e=_0x48d01a;_0x47442f['model']=_['keys'](db[_0xbe5e('0x40')][_0xbe5e('0x5c')]);_0x47442f[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x3fd5a4['query']);_0x47442f['filters']=_['intersection'](_0x47442f['model'],_0x47442f[_0xbe5e('0x48')]);_0x2e362a[_0xbe5e('0x4d')]=_[_0xbe5e('0x5f')](_0x47442f['model'],qs['fields'](_0x3fd5a4[_0xbe5e('0x48')]['fields']));_0x2e362a['attributes']=_0x2e362a[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x2e362a[_0xbe5e('0x4d')]:_0x47442f['model'];_0x2e362a[_0xbe5e('0xd5')]=qs[_0xbe5e('0xd6')](_0x3fd5a4[_0xbe5e('0x48')]['sort']);_0x2e362a[_0xbe5e('0x47')]=qs['filters'](_[_0xbe5e('0xdf')](_0x3fd5a4[_0xbe5e('0x48')],_0x47442f['filters']));if(_0x3fd5a4['query']['filter']){_0x2e362a[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x2e362a[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x2e362a[_0xbe5e('0x4d')],function(_0x49e41a){var _0x277a45={};_0x277a45[_0x49e41a]={'$like':'%'+_0x3fd5a4[_0xbe5e('0x48')][_0xbe5e('0x44')]+'%'};return _0x277a45;})});}_0x2e362a[_0xbe5e('0x5a')]=db[_0xbe5e('0x40')];_0x2e362a['as']=_0xbe5e('0x97');_0x2e362a=_[_0xbe5e('0x62')]({},_0x2e362a,_0x3fd5a4['options']);return _0x28a56e[_0xbe5e('0x101')]({'include':[_0x2e362a]});}})[_0xbe5e('0x18')](function(_0x28e1a5){if(_0x28e1a5){var _0xd958b3={},_0x155773=[];for(var _0x44fab7=0x0;_0x44fab7<_0x28e1a5['length'];_0x44fab7+=0x1){for(var _0x549122=0x0,_0x550b35;_0x549122<_0x28e1a5[_0x44fab7]['Agents'][_0xbe5e('0x51')];_0x549122+=0x1){_0x550b35=_0x28e1a5[_0x44fab7][_0xbe5e('0x97')][_0x549122][_0xbe5e('0x30')]({'plain':!![]});_0xd958b3[_0x550b35['id']]=_0x550b35;}}_0xd958b3=_[_0xbe5e('0x12a')](_0xd958b3);for(var _0x2aab11=qs[_0xbe5e('0x28')](_0x3fd5a4[_0xbe5e('0x48')]['offset']);_0x2aab11<_0xd958b3[_0xbe5e('0x51')]&&_0x155773[_0xbe5e('0x51')]<qs[_0xbe5e('0x2a')](_0x3fd5a4[_0xbe5e('0x48')][_0xbe5e('0x2a')]);_0x2aab11+=0x1){if(_0xd958b3[_0x2aab11]){_0x155773['push'](_0xd958b3[_0x2aab11]);}}return{'count':_0xd958b3[_0xbe5e('0x51')],'rows':_0x155773};}})[_0xbe5e('0x18')](respondWithResult(_0x55038b,null))[_0xbe5e('0x23')](handleError(_0x55038b,null));};exports[_0xbe5e('0x2f')]=function(_0x20a339,_0x5553e2){if(_0x20a339[_0xbe5e('0x34')]['id']==_0x20a339[_0xbe5e('0x67')]['id']){return _0x5553e2['status'](0x1f4)['send']({'message':_0xbe5e('0x12b')});}return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x20a339[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x5553e2,null))[_0xbe5e('0x18')](removeEntity(_0x5553e2,null))[_0xbe5e('0x23')](handleError(_0x5553e2,null));};exports[_0xbe5e('0x12c')]=function(_0x1a0209,_0x37c192){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x1a0209[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x37c192,null))[_0xbe5e('0x18')](function(_0x44c5b3){if(_0x44c5b3){return _0x44c5b3['addChatInteractions'](_0x1a0209[_0xbe5e('0x66')][_0xbe5e('0x6a')],_[_0xbe5e('0x6b')](_0x1a0209[_0xbe5e('0x66')],['ids','id'])||{})[_0xbe5e('0xb1')](function(){for(var _0x138dd2=0x0;_0x138dd2<_0x1a0209[_0xbe5e('0x66')]['ids'][_0xbe5e('0x51')];_0x138dd2+=0x1){socket['emit'](_0xbe5e('0x12d'),{'ChatInteractionId':Number(_0x1a0209[_0xbe5e('0x66')][_0xbe5e('0x6a')][_0x138dd2]),'UserId':Number(_0x1a0209[_0xbe5e('0x67')]['id'])});}return _0x1a0209[_0xbe5e('0x66')][_0xbe5e('0x6a')];});}})[_0xbe5e('0x18')](respondWithResult(_0x37c192,null))[_0xbe5e('0x23')](handleError(_0x37c192,null));};exports['removeChatInteractions']=function(_0x118084,_0xb3465b){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x118084['params']['id']}})['then'](handleEntityNotFound(_0xb3465b,null))[_0xbe5e('0x18')](function(_0x3b8a52){if(_0x3b8a52){return _0x3b8a52[_0xbe5e('0x12e')](_0x118084[_0xbe5e('0x48')][_0xbe5e('0x6a')])[_0xbe5e('0x18')](function(){if(_[_0xbe5e('0xbc')](_0x118084['query'][_0xbe5e('0x6a')])){for(var _0x52ec59=0x0;_0x52ec59<_0x118084[_0xbe5e('0x48')][_0xbe5e('0x6a')][_0xbe5e('0x51')];_0x52ec59+=0x1){socket[_0xbe5e('0x2d')](_0xbe5e('0x12f'),{'ChatInteractionId':Number(_0x118084[_0xbe5e('0x48')][_0xbe5e('0x6a')][_0x52ec59]),'UserId':Number(_0x118084[_0xbe5e('0x67')]['id'])});}}else{socket['emit'](_0xbe5e('0x12f'),{'ChatInteractionId':Number(_0x118084[_0xbe5e('0x48')][_0xbe5e('0x6a')]),'UserId':Number(_0x118084['params']['id'])});}});}})[_0xbe5e('0x18')](respondWithStatusCode(_0xb3465b,null))[_0xbe5e('0x23')](handleError(_0xb3465b,null));};exports[_0xbe5e('0x130')]=function(_0x4d0e4d,_0x35d075){return db[_0xbe5e('0x40')]['find']({'where':{'id':_0x4d0e4d['params']['id']}})['then'](handleEntityNotFound(_0x35d075,null))[_0xbe5e('0x18')](function(_0x46d578){if(_0x46d578){return _0x46d578[_0xbe5e('0x130')](_0x4d0e4d[_0xbe5e('0x66')][_0xbe5e('0x6a')],_[_0xbe5e('0x6b')](_0x4d0e4d['body'],[_0xbe5e('0x6a'),'id'])||{})[_0xbe5e('0xb1')](function(){for(var _0xf26299=0x0;_0xf26299<_0x4d0e4d[_0xbe5e('0x66')][_0xbe5e('0x6a')]['length'];_0xf26299+=0x1){socket[_0xbe5e('0x2d')](_0xbe5e('0x131'),{'MailInteractionId':Number(_0x4d0e4d['body'][_0xbe5e('0x6a')][_0xf26299]),'UserId':Number(_0x4d0e4d['params']['id'])});}return _0x4d0e4d[_0xbe5e('0x66')][_0xbe5e('0x6a')];});}})[_0xbe5e('0x18')](respondWithResult(_0x35d075,null))['catch'](handleError(_0x35d075,null));};exports[_0xbe5e('0x132')]=function(_0x2f93fd,_0x10e27d){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x2f93fd[_0xbe5e('0x67')]['id']}})['then'](handleEntityNotFound(_0x10e27d,null))['then'](function(_0x546a4c){if(_0x546a4c){return _0x546a4c[_0xbe5e('0x132')](_0x2f93fd['query'][_0xbe5e('0x6a')])['then'](function(){if(_[_0xbe5e('0xbc')](_0x2f93fd[_0xbe5e('0x48')][_0xbe5e('0x6a')])){for(var _0x280d1f=0x0;_0x280d1f<_0x2f93fd[_0xbe5e('0x48')][_0xbe5e('0x6a')][_0xbe5e('0x51')];_0x280d1f+=0x1){socket[_0xbe5e('0x2d')](_0xbe5e('0x133'),{'MailInteractionId':Number(_0x2f93fd['query'][_0xbe5e('0x6a')][_0x280d1f]),'UserId':Number(_0x2f93fd['params']['id'])});}}else{socket['emit'](_0xbe5e('0x133'),{'MailInteractionId':Number(_0x2f93fd[_0xbe5e('0x48')][_0xbe5e('0x6a')]),'UserId':Number(_0x2f93fd['params']['id'])});}});}})[_0xbe5e('0x18')](respondWithStatusCode(_0x10e27d,null))['catch'](handleError(_0x10e27d,null));};exports['addFaxInteractions']=function(_0x1b71d0,_0x508870){return db[_0xbe5e('0x40')]['find']({'where':{'id':_0x1b71d0[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x508870,null))[_0xbe5e('0x18')](function(_0x236a0c){if(_0x236a0c){return _0x236a0c['addFaxInteractions'](_0x1b71d0['body']['ids'],_['omit'](_0x1b71d0['body'],['ids','id'])||{})[_0xbe5e('0xb1')](function(){for(var _0x28bbb9=0x0;_0x28bbb9<_0x1b71d0['body']['ids'][_0xbe5e('0x51')];_0x28bbb9+=0x1){socket['emit'](_0xbe5e('0x134'),{'FaxInteractionId':Number(_0x1b71d0[_0xbe5e('0x66')][_0xbe5e('0x6a')][_0x28bbb9]),'UserId':Number(_0x1b71d0[_0xbe5e('0x67')]['id'])});}return _0x1b71d0['body'][_0xbe5e('0x6a')];});}})['then'](respondWithResult(_0x508870,null))[_0xbe5e('0x23')](handleError(_0x508870,null));};exports[_0xbe5e('0x135')]=function(_0x415b3f,_0x1b0af9){return db['User'][_0xbe5e('0x3a')]({'where':{'id':_0x415b3f[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x1b0af9,null))[_0xbe5e('0x18')](function(_0x293418){if(_0x293418){return _0x293418[_0xbe5e('0x135')](_0x415b3f['query'][_0xbe5e('0x6a')])[_0xbe5e('0x18')](function(){if(_[_0xbe5e('0xbc')](_0x415b3f[_0xbe5e('0x48')][_0xbe5e('0x6a')])){for(var _0x33833f=0x0;_0x33833f<_0x415b3f[_0xbe5e('0x48')][_0xbe5e('0x6a')]['length'];_0x33833f+=0x1){socket['emit'](_0xbe5e('0x136'),{'FaxInteractionId':Number(_0x415b3f[_0xbe5e('0x48')][_0xbe5e('0x6a')][_0x33833f]),'UserId':Number(_0x415b3f[_0xbe5e('0x67')]['id'])});}}else{socket['emit'](_0xbe5e('0x136'),{'FaxInteractionId':Number(_0x415b3f[_0xbe5e('0x48')][_0xbe5e('0x6a')]),'UserId':Number(_0x415b3f[_0xbe5e('0x67')]['id'])});}});}})[_0xbe5e('0x18')](respondWithStatusCode(_0x1b0af9,null))[_0xbe5e('0x23')](handleError(_0x1b0af9,null));};exports[_0xbe5e('0x137')]=function(_0x27c8d2,_0x590cf9){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x27c8d2[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x590cf9,null))[_0xbe5e('0x18')](function(_0x130e3d){if(_0x130e3d){return _0x130e3d[_0xbe5e('0x137')](_0x27c8d2[_0xbe5e('0x66')][_0xbe5e('0x6a')],_[_0xbe5e('0x6b')](_0x27c8d2[_0xbe5e('0x66')],[_0xbe5e('0x6a'),'id'])||{})['spread'](function(){for(var _0x9727d7=0x0;_0x9727d7<_0x27c8d2[_0xbe5e('0x66')][_0xbe5e('0x6a')][_0xbe5e('0x51')];_0x9727d7+=0x1){socket[_0xbe5e('0x2d')]('user_has_sms_interactions:save',{'SmsInteractionId':Number(_0x27c8d2['body'][_0xbe5e('0x6a')][_0x9727d7]),'UserId':Number(_0x27c8d2[_0xbe5e('0x67')]['id'])});}return _0x27c8d2[_0xbe5e('0x66')][_0xbe5e('0x6a')];});}})[_0xbe5e('0x18')](respondWithResult(_0x590cf9,null))[_0xbe5e('0x23')](handleError(_0x590cf9,null));};exports['removeSmsInteractions']=function(_0x202419,_0x29e40b){return db[_0xbe5e('0x40')]['find']({'where':{'id':_0x202419['params']['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x29e40b,null))['then'](function(_0x324bca){if(_0x324bca){return _0x324bca[_0xbe5e('0x138')](_0x202419[_0xbe5e('0x48')][_0xbe5e('0x6a')])['then'](function(){if(_['isArray'](_0x202419[_0xbe5e('0x48')][_0xbe5e('0x6a')])){for(var _0x1b32bb=0x0;_0x1b32bb<_0x202419['query'][_0xbe5e('0x6a')]['length'];_0x1b32bb+=0x1){socket[_0xbe5e('0x2d')](_0xbe5e('0x139'),{'SmsInteractionId':Number(_0x202419[_0xbe5e('0x48')][_0xbe5e('0x6a')][_0x1b32bb]),'UserId':Number(_0x202419[_0xbe5e('0x67')]['id'])});}}else{socket['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x202419[_0xbe5e('0x48')][_0xbe5e('0x6a')]),'UserId':Number(_0x202419[_0xbe5e('0x67')]['id'])});}});}})[_0xbe5e('0x18')](respondWithStatusCode(_0x29e40b,null))[_0xbe5e('0x23')](handleError(_0x29e40b,null));};exports[_0xbe5e('0x13a')]=function(_0x4eb302,_0x175078){return db['User'][_0xbe5e('0x3a')]({'where':{'id':_0x4eb302[_0xbe5e('0x67')]['id']}})['then'](handleEntityNotFound(_0x175078,null))[_0xbe5e('0x18')](function(_0x2219cf){if(_0x2219cf){return _0x2219cf[_0xbe5e('0x13a')](_0x4eb302[_0xbe5e('0x66')][_0xbe5e('0x6a')],_[_0xbe5e('0x6b')](_0x4eb302['body'],[_0xbe5e('0x6a'),'id'])||{})[_0xbe5e('0xb1')](function(){for(var _0x467fa8=0x0;_0x467fa8<_0x4eb302[_0xbe5e('0x66')]['ids'][_0xbe5e('0x51')];_0x467fa8+=0x1){socket[_0xbe5e('0x2d')](_0xbe5e('0x13b'),{'OpenchannelInteractionId':Number(_0x4eb302[_0xbe5e('0x66')][_0xbe5e('0x6a')][_0x467fa8]),'UserId':Number(_0x4eb302[_0xbe5e('0x67')]['id'])});}return _0x4eb302[_0xbe5e('0x66')][_0xbe5e('0x6a')];});}})[_0xbe5e('0x18')](respondWithResult(_0x175078,null))[_0xbe5e('0x23')](handleError(_0x175078,null));};exports[_0xbe5e('0x13c')]=function(_0x5df589,_0x3627f2){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x5df589[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x3627f2,null))['then'](function(_0x280f53){if(_0x280f53){return _0x280f53[_0xbe5e('0x13c')](_0x5df589[_0xbe5e('0x48')]['ids'])[_0xbe5e('0x18')](function(){if(_[_0xbe5e('0xbc')](_0x5df589[_0xbe5e('0x48')][_0xbe5e('0x6a')])){for(var _0x5e23a3=0x0;_0x5e23a3<_0x5df589['query'][_0xbe5e('0x6a')][_0xbe5e('0x51')];_0x5e23a3+=0x1){socket[_0xbe5e('0x2d')](_0xbe5e('0x13d'),{'OpenchannelInteractionId':Number(_0x5df589[_0xbe5e('0x48')]['ids'][_0x5e23a3]),'UserId':Number(_0x5df589[_0xbe5e('0x67')]['id'])});}}else{socket['emit'](_0xbe5e('0x13d'),{'OpenchannelInteractionId':Number(_0x5df589[_0xbe5e('0x48')][_0xbe5e('0x6a')]),'UserId':Number(_0x5df589[_0xbe5e('0x67')]['id'])});}});}})['then'](respondWithStatusCode(_0x3627f2,null))['catch'](handleError(_0x3627f2,null));};exports['addWhatsappInteractions']=function(_0x268b4f,_0x56cbac){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x268b4f[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x56cbac,null))['then'](function(_0x3584fa){if(_0x3584fa){return _0x3584fa[_0xbe5e('0x13e')](_0x268b4f[_0xbe5e('0x66')][_0xbe5e('0x6a')],_['omit'](_0x268b4f[_0xbe5e('0x66')],['ids','id'])||{})[_0xbe5e('0xb1')](function(){for(var _0x5660bb=0x0;_0x5660bb<_0x268b4f[_0xbe5e('0x66')][_0xbe5e('0x6a')][_0xbe5e('0x51')];_0x5660bb+=0x1){socket[_0xbe5e('0x2d')](_0xbe5e('0x13f'),{'WhatsappInteractionId':Number(_0x268b4f[_0xbe5e('0x66')]['ids'][_0x5660bb]),'UserId':Number(_0x268b4f['params']['id'])});}return _0x268b4f[_0xbe5e('0x66')]['ids'];});}})['then'](respondWithResult(_0x56cbac,null))[_0xbe5e('0x23')](handleError(_0x56cbac,null));};exports[_0xbe5e('0x140')]=function(_0x3d0c51,_0x53bde9){return db['User'][_0xbe5e('0x3a')]({'where':{'id':_0x3d0c51[_0xbe5e('0x67')]['id']}})['then'](handleEntityNotFound(_0x53bde9,null))['then'](function(_0x5afe25){if(_0x5afe25){return _0x5afe25[_0xbe5e('0x140')](_0x3d0c51[_0xbe5e('0x48')]['ids']);}})[_0xbe5e('0x18')](respondWithStatusCode(_0x53bde9,null))['catch'](handleError(_0x53bde9,null));};exports['getVoicePrefixes']=function(_0x3a3e4b,_0x3e491f){var _0x4f114e={};var _0x4b8b2b={};var _0x5c4733;var _0x580c7b;return db[_0xbe5e('0x40')]['findOne']({'where':{'id':_0x3a3e4b[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x3e491f,null))['then'](function(_0x3ccd3d){if(_0x3ccd3d){_0x5c4733=_0x3ccd3d;_0x4b8b2b[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db[_0xbe5e('0x141')][_0xbe5e('0x5c')]);_0x4b8b2b['query']=_[_0xbe5e('0x5b')](_0x3a3e4b['query']);_0x4b8b2b['filters']=_['intersection'](_0x4b8b2b[_0xbe5e('0x5a')],_0x4b8b2b[_0xbe5e('0x48')]);_0x4f114e[_0xbe5e('0x4d')]=_[_0xbe5e('0x5f')](_0x4b8b2b['model'],qs['fields'](_0x3a3e4b[_0xbe5e('0x48')][_0xbe5e('0x60')]));_0x4f114e[_0xbe5e('0x4d')]=_0x4f114e['attributes'][_0xbe5e('0x51')]?_0x4f114e[_0xbe5e('0x4d')]:_0x4b8b2b[_0xbe5e('0x5a')];_0x4f114e[_0xbe5e('0xd5')]=qs['sort'](_0x3a3e4b[_0xbe5e('0x48')][_0xbe5e('0xd6')]);_0x4f114e[_0xbe5e('0x47')]=qs['filters'](_[_0xbe5e('0xdf')](_0x3a3e4b[_0xbe5e('0x48')],_0x4b8b2b['filters']));if(_0x3a3e4b[_0xbe5e('0x48')][_0xbe5e('0x44')]){_0x4f114e[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x4f114e[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x4f114e['attributes'],function(_0x319eb0){var _0x1ec04d={};_0x1ec04d[_0x319eb0]={'$like':'%'+_0x3a3e4b[_0xbe5e('0x48')][_0xbe5e('0x44')]+'%'};return _0x1ec04d;})});}_0x4f114e=_['merge']({},_0x4f114e,_0x3a3e4b[_0xbe5e('0x63')]);return _0x5c4733[_0xbe5e('0x142')](_0x4f114e);}})[_0xbe5e('0x18')](function(_0x156897){if(_0x156897){_0x580c7b=_0x156897[_0xbe5e('0x51')];if(!_0x3a3e4b[_0xbe5e('0x48')][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x4f114e[_0xbe5e('0x2a')]=qs[_0xbe5e('0x2a')](_0x3a3e4b[_0xbe5e('0x48')]['limit']);_0x4f114e['offset']=qs[_0xbe5e('0x28')](_0x3a3e4b[_0xbe5e('0x48')][_0xbe5e('0x28')]);}return _0x5c4733[_0xbe5e('0x142')](_0x4f114e);}})[_0xbe5e('0x18')](function(_0x233b3e){if(_0x233b3e){return _0x233b3e?{'count':_0x580c7b,'rows':_0x233b3e}:null;}})['then'](respondWithResult(_0x3e491f,null))[_0xbe5e('0x23')](handleError(_0x3e491f,null));};exports[_0xbe5e('0x143')]=function(_0x4b3faf,_0x38549a){var _0x308f4c={};var _0xb6cae9={};var _0x3bed49;var _0x12d10d;return db['User'][_0xbe5e('0xa2')]({'where':{'id':_0x4b3faf[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x38549a,null))[_0xbe5e('0x18')](function(_0x554317){if(_0x554317){_0x3bed49=_0x554317;_0xb6cae9[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db[_0xbe5e('0x144')][_0xbe5e('0x5c')]);_0xb6cae9[_0xbe5e('0x48')]=_['keys'](_0x4b3faf[_0xbe5e('0x48')]);_0xb6cae9[_0xbe5e('0x5e')]=_[_0xbe5e('0x5f')](_0xb6cae9['model'],_0xb6cae9[_0xbe5e('0x48')]);_0x308f4c[_0xbe5e('0x4d')]=_[_0xbe5e('0x5f')](_0xb6cae9['model'],qs[_0xbe5e('0x60')](_0x4b3faf[_0xbe5e('0x48')][_0xbe5e('0x60')]));_0x308f4c[_0xbe5e('0x4d')]=_0x308f4c[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x308f4c[_0xbe5e('0x4d')]:_0xb6cae9[_0xbe5e('0x5a')];_0x308f4c[_0xbe5e('0xd5')]=qs[_0xbe5e('0xd6')](_0x4b3faf['query'][_0xbe5e('0xd6')]);_0x308f4c[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_[_0xbe5e('0xdf')](_0x4b3faf[_0xbe5e('0x48')],_0xb6cae9[_0xbe5e('0x5e')]));if(_0x4b3faf[_0xbe5e('0x48')]['filter']){_0x308f4c[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x308f4c[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x308f4c[_0xbe5e('0x4d')],function(_0x52d7d9){var _0x983d71={};_0x983d71[_0x52d7d9]={'$like':'%'+_0x4b3faf[_0xbe5e('0x48')][_0xbe5e('0x44')]+'%'};return _0x983d71;})});}_0x308f4c=_[_0xbe5e('0x62')]({},_0x308f4c,_0x4b3faf[_0xbe5e('0x63')]);return _0x3bed49[_0xbe5e('0x143')](_0x308f4c);}})[_0xbe5e('0x18')](function(_0x5c3042){if(_0x5c3042){_0x12d10d=_0x5c3042[_0xbe5e('0x51')];if(!_0x4b3faf[_0xbe5e('0x48')][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x308f4c[_0xbe5e('0x2a')]=qs[_0xbe5e('0x2a')](_0x4b3faf[_0xbe5e('0x48')]['limit']);_0x308f4c[_0xbe5e('0x28')]=qs[_0xbe5e('0x28')](_0x4b3faf['query'][_0xbe5e('0x28')]);}return _0x3bed49[_0xbe5e('0x143')](_0x308f4c);}})[_0xbe5e('0x18')](function(_0xda9cb7){if(_0xda9cb7){return _0xda9cb7?{'count':_0x12d10d,'rows':_0xda9cb7}:null;}})[_0xbe5e('0x18')](respondWithResult(_0x38549a,null))[_0xbe5e('0x23')](handleError(_0x38549a,null));};exports['addFaxAccounts']=function(_0x3f1bea,_0x540df4){return db[_0xbe5e('0x40')]['find']({'where':{'id':_0x3f1bea[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x540df4,null))[_0xbe5e('0x18')](function(_0x1e34a2){if(_0x1e34a2){return _0x1e34a2[_0xbe5e('0x145')](_0x3f1bea['body'][_0xbe5e('0x6a')],_[_0xbe5e('0x6b')](_0x3f1bea[_0xbe5e('0x66')],[_0xbe5e('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x540df4,null))[_0xbe5e('0x23')](handleError(_0x540df4,null));};exports[_0xbe5e('0x146')]=function(_0x15f07a,_0x3d4a4d){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x15f07a['params']['id']}})['then'](handleEntityNotFound(_0x3d4a4d,null))[_0xbe5e('0x18')](function(_0x596479){if(_0x596479){return _0x596479[_0xbe5e('0x146')](_0x15f07a[_0xbe5e('0x48')][_0xbe5e('0x6a')]);}})[_0xbe5e('0x18')](respondWithStatusCode(_0x3d4a4d,null))[_0xbe5e('0x23')](handleError(_0x3d4a4d,null));};exports['getMailAccounts']=function(_0x39d65d,_0x571ae8){var _0x1980aa={};var _0xbac6f3={};var _0x9c99ea;var _0x3b22d2;return db['User'][_0xbe5e('0xa2')]({'where':{'id':_0x39d65d[_0xbe5e('0x67')]['id']}})['then'](handleEntityNotFound(_0x571ae8,null))[_0xbe5e('0x18')](function(_0x24b0c0){if(_0x24b0c0){_0x9c99ea=_0x24b0c0;_0xbac6f3[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db[_0xbe5e('0x147')][_0xbe5e('0x5c')]);_0xbac6f3[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x39d65d[_0xbe5e('0x48')]);_0xbac6f3['filters']=_['intersection'](_0xbac6f3[_0xbe5e('0x5a')],_0xbac6f3['query']);_0x1980aa[_0xbe5e('0x4d')]=_[_0xbe5e('0x5f')](_0xbac6f3['model'],qs[_0xbe5e('0x60')](_0x39d65d[_0xbe5e('0x48')][_0xbe5e('0x60')]));_0x1980aa[_0xbe5e('0x4d')]=_0x1980aa[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x1980aa[_0xbe5e('0x4d')]:_0xbac6f3['model'];_0x1980aa[_0xbe5e('0xd5')]=qs[_0xbe5e('0xd6')](_0x39d65d['query'][_0xbe5e('0xd6')]);_0x1980aa['where']=qs[_0xbe5e('0x5e')](_[_0xbe5e('0xdf')](_0x39d65d[_0xbe5e('0x48')],_0xbac6f3[_0xbe5e('0x5e')]));if(_0x39d65d['query'][_0xbe5e('0x44')]){_0x1980aa[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x1980aa[_0xbe5e('0x47')],{'$or':_['map'](_0x1980aa[_0xbe5e('0x4d')],function(_0x2c4ff7){var _0x1ca056={};_0x1ca056[_0x2c4ff7]={'$like':'%'+_0x39d65d[_0xbe5e('0x48')][_0xbe5e('0x44')]+'%'};return _0x1ca056;})});}_0x1980aa=_[_0xbe5e('0x62')]({},_0x1980aa,_0x39d65d[_0xbe5e('0x63')]);return _0x9c99ea[_0xbe5e('0x148')](_0x1980aa);}})[_0xbe5e('0x18')](function(_0x25d0a9){if(_0x25d0a9){_0x3b22d2=_0x25d0a9[_0xbe5e('0x51')];if(!_0x39d65d[_0xbe5e('0x48')][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x1980aa[_0xbe5e('0x2a')]=qs['limit'](_0x39d65d[_0xbe5e('0x48')][_0xbe5e('0x2a')]);_0x1980aa['offset']=qs[_0xbe5e('0x28')](_0x39d65d[_0xbe5e('0x48')]['offset']);}return _0x9c99ea[_0xbe5e('0x148')](_0x1980aa);}})[_0xbe5e('0x18')](function(_0x9bce17){if(_0x9bce17){return _0x9bce17?{'count':_0x3b22d2,'rows':_0x9bce17}:null;}})['then'](respondWithResult(_0x571ae8,null))['catch'](handleError(_0x571ae8,null));};exports[_0xbe5e('0x149')]=function(_0x155493,_0x437441){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x155493['params']['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x437441,null))[_0xbe5e('0x18')](function(_0xc13376){if(_0xc13376){return _0xc13376['addMailAccounts'](_0x155493[_0xbe5e('0x66')][_0xbe5e('0x6a')],_[_0xbe5e('0x6b')](_0x155493['body'],['ids','id'])||{});}})[_0xbe5e('0x18')](respondWithResult(_0x437441,null))[_0xbe5e('0x23')](handleError(_0x437441,null));};exports[_0xbe5e('0x14a')]=function(_0x9d145,_0x197654){return db['User'][_0xbe5e('0x3a')]({'where':{'id':_0x9d145[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x197654,null))['then'](function(_0x4315c5){if(_0x4315c5){return _0x4315c5[_0xbe5e('0x14a')](_0x9d145[_0xbe5e('0x48')][_0xbe5e('0x6a')]);}})[_0xbe5e('0x18')](respondWithStatusCode(_0x197654,null))[_0xbe5e('0x23')](handleError(_0x197654,null));};exports[_0xbe5e('0x14b')]=function(_0x1715a8,_0xfdf6c){var _0x42b0f5={};var _0x4ca7b9={};var _0x30bb01;var _0x39006b;return db[_0xbe5e('0x40')][_0xbe5e('0xa2')]({'where':{'id':_0x1715a8['params']['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0xfdf6c,null))[_0xbe5e('0x18')](function(_0x256e99){if(_0x256e99){_0x30bb01=_0x256e99;_0x4ca7b9[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db[_0xbe5e('0x14c')]['rawAttributes']);_0x4ca7b9[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x1715a8[_0xbe5e('0x48')]);_0x4ca7b9[_0xbe5e('0x5e')]=_['intersection'](_0x4ca7b9[_0xbe5e('0x5a')],_0x4ca7b9[_0xbe5e('0x48')]);_0x42b0f5[_0xbe5e('0x4d')]=_['intersection'](_0x4ca7b9[_0xbe5e('0x5a')],qs[_0xbe5e('0x60')](_0x1715a8[_0xbe5e('0x48')][_0xbe5e('0x60')]));_0x42b0f5['attributes']=_0x42b0f5[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x42b0f5['attributes']:_0x4ca7b9[_0xbe5e('0x5a')];_0x42b0f5[_0xbe5e('0xd5')]=qs[_0xbe5e('0xd6')](_0x1715a8[_0xbe5e('0x48')][_0xbe5e('0xd6')]);_0x42b0f5[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_[_0xbe5e('0xdf')](_0x1715a8[_0xbe5e('0x48')],_0x4ca7b9['filters']));if(_0x1715a8['query'][_0xbe5e('0x44')]){_0x42b0f5[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x42b0f5[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x42b0f5['attributes'],function(_0x1e8113){var _0x4301c={};_0x4301c[_0x1e8113]={'$like':'%'+_0x1715a8[_0xbe5e('0x48')][_0xbe5e('0x44')]+'%'};return _0x4301c;})});}_0x42b0f5=_['merge']({},_0x42b0f5,_0x1715a8[_0xbe5e('0x63')]);return _0x30bb01['getOpenchannelAccounts'](_0x42b0f5);}})['then'](function(_0x4f50f6){if(_0x4f50f6){_0x39006b=_0x4f50f6[_0xbe5e('0x51')];if(!_0x1715a8[_0xbe5e('0x48')][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x42b0f5[_0xbe5e('0x2a')]=qs[_0xbe5e('0x2a')](_0x1715a8['query']['limit']);_0x42b0f5[_0xbe5e('0x28')]=qs['offset'](_0x1715a8['query'][_0xbe5e('0x28')]);}return _0x30bb01[_0xbe5e('0x14b')](_0x42b0f5);}})[_0xbe5e('0x18')](function(_0xc5da55){if(_0xc5da55){return _0xc5da55?{'count':_0x39006b,'rows':_0xc5da55}:null;}})['then'](respondWithResult(_0xfdf6c,null))[_0xbe5e('0x23')](handleError(_0xfdf6c,null));};exports[_0xbe5e('0x14d')]=function(_0x4d0de7,_0x4a200c){return db['User'][_0xbe5e('0x3a')]({'where':{'id':_0x4d0de7['params']['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x4a200c,null))[_0xbe5e('0x18')](function(_0x59fba0){if(_0x59fba0){return _0x59fba0['addOpenchannelAccounts'](_0x4d0de7[_0xbe5e('0x66')][_0xbe5e('0x6a')],_[_0xbe5e('0x6b')](_0x4d0de7['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x4a200c,null))['catch'](handleError(_0x4a200c,null));};exports[_0xbe5e('0x14e')]=function(_0x3ae189,_0x3fe26e){return db[_0xbe5e('0x40')]['find']({'where':{'id':_0x3ae189['params']['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x3fe26e,null))[_0xbe5e('0x18')](function(_0x2ac334){if(_0x2ac334){return _0x2ac334[_0xbe5e('0x14e')](_0x3ae189['query']['ids']);}})[_0xbe5e('0x18')](respondWithStatusCode(_0x3fe26e,null))[_0xbe5e('0x23')](handleError(_0x3fe26e,null));};exports[_0xbe5e('0x14f')]=function(_0x4cd44a,_0xa88e66){var _0x1cc56b={};var _0xdbf7f3={};var _0x5c7085;var _0x13fa38;return db['User'][_0xbe5e('0xa2')]({'where':{'id':_0x4cd44a[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0xa88e66,null))['then'](function(_0x4f51d7){if(_0x4f51d7){_0x5c7085=_0x4f51d7;_0xdbf7f3[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db[_0xbe5e('0x150')][_0xbe5e('0x5c')]);_0xdbf7f3[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x4cd44a[_0xbe5e('0x48')]);_0xdbf7f3[_0xbe5e('0x5e')]=_['intersection'](_0xdbf7f3[_0xbe5e('0x5a')],_0xdbf7f3[_0xbe5e('0x48')]);_0x1cc56b['attributes']=_[_0xbe5e('0x5f')](_0xdbf7f3[_0xbe5e('0x5a')],qs[_0xbe5e('0x60')](_0x4cd44a['query'][_0xbe5e('0x60')]));_0x1cc56b[_0xbe5e('0x4d')]=_0x1cc56b[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x1cc56b[_0xbe5e('0x4d')]:_0xdbf7f3[_0xbe5e('0x5a')];_0x1cc56b['order']=qs['sort'](_0x4cd44a[_0xbe5e('0x48')]['sort']);_0x1cc56b[_0xbe5e('0x47')]=qs['filters'](_[_0xbe5e('0xdf')](_0x4cd44a['query'],_0xdbf7f3['filters']));if(_0x4cd44a[_0xbe5e('0x48')][_0xbe5e('0x44')]){_0x1cc56b[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x1cc56b['where'],{'$or':_[_0xbe5e('0x37')](_0x1cc56b['attributes'],function(_0x4712e4){var _0xab8d07={};_0xab8d07[_0x4712e4]={'$like':'%'+_0x4cd44a[_0xbe5e('0x48')][_0xbe5e('0x44')]+'%'};return _0xab8d07;})});}_0x1cc56b=_[_0xbe5e('0x62')]({},_0x1cc56b,_0x4cd44a[_0xbe5e('0x63')]);return _0x5c7085[_0xbe5e('0x14f')](_0x1cc56b);}})[_0xbe5e('0x18')](function(_0x2aadcf){if(_0x2aadcf){_0x13fa38=_0x2aadcf[_0xbe5e('0x51')];if(!_0x4cd44a['query'][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x1cc56b[_0xbe5e('0x2a')]=qs[_0xbe5e('0x2a')](_0x4cd44a['query']['limit']);_0x1cc56b[_0xbe5e('0x28')]=qs[_0xbe5e('0x28')](_0x4cd44a[_0xbe5e('0x48')][_0xbe5e('0x28')]);}return _0x5c7085['getSmsAccounts'](_0x1cc56b);}})[_0xbe5e('0x18')](function(_0x127435){if(_0x127435){return _0x127435?{'count':_0x13fa38,'rows':_0x127435}:null;}})[_0xbe5e('0x18')](respondWithResult(_0xa88e66,null))[_0xbe5e('0x23')](handleError(_0xa88e66,null));};exports['addSmsAccounts']=function(_0x1c8e82,_0x799ff0){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x1c8e82[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x799ff0,null))[_0xbe5e('0x18')](function(_0x37345e){if(_0x37345e){return _0x37345e[_0xbe5e('0x151')](_0x1c8e82[_0xbe5e('0x66')][_0xbe5e('0x6a')],_[_0xbe5e('0x6b')](_0x1c8e82[_0xbe5e('0x66')],[_0xbe5e('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x799ff0,null))[_0xbe5e('0x23')](handleError(_0x799ff0,null));};exports[_0xbe5e('0x152')]=function(_0xb3ab75,_0x34788a){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0xb3ab75[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x34788a,null))[_0xbe5e('0x18')](function(_0x1adc08){if(_0x1adc08){return _0x1adc08[_0xbe5e('0x152')](_0xb3ab75[_0xbe5e('0x48')][_0xbe5e('0x6a')]);}})[_0xbe5e('0x18')](respondWithStatusCode(_0x34788a,null))['catch'](handleError(_0x34788a,null));};exports[_0xbe5e('0x153')]=function(_0x15be4f,_0x1d21b5){var _0x33fc4b={};var _0x44ada3={};var _0x58e633;var _0x5bf5c1;return db['User']['findOne']({'where':{'id':_0x15be4f[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x1d21b5,null))[_0xbe5e('0x18')](function(_0x2b7c1a){if(_0x2b7c1a){_0x58e633=_0x2b7c1a;_0x44ada3[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db['ChatWebsite'][_0xbe5e('0x5c')]);_0x44ada3[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x15be4f[_0xbe5e('0x48')]);_0x44ada3[_0xbe5e('0x5e')]=_[_0xbe5e('0x5f')](_0x44ada3[_0xbe5e('0x5a')],_0x44ada3[_0xbe5e('0x48')]);_0x33fc4b[_0xbe5e('0x4d')]=_[_0xbe5e('0x5f')](_0x44ada3[_0xbe5e('0x5a')],qs[_0xbe5e('0x60')](_0x15be4f[_0xbe5e('0x48')]['fields']));_0x33fc4b[_0xbe5e('0x4d')]=_0x33fc4b[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x33fc4b['attributes']:_0x44ada3[_0xbe5e('0x5a')];_0x33fc4b[_0xbe5e('0xd5')]=qs['sort'](_0x15be4f[_0xbe5e('0x48')][_0xbe5e('0xd6')]);_0x33fc4b[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_['pick'](_0x15be4f[_0xbe5e('0x48')],_0x44ada3['filters']));if(_0x15be4f[_0xbe5e('0x48')][_0xbe5e('0x44')]){_0x33fc4b[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x33fc4b[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x33fc4b[_0xbe5e('0x4d')],function(_0x157d0b){var _0x48e8c3={};_0x48e8c3[_0x157d0b]={'$like':'%'+_0x15be4f[_0xbe5e('0x48')][_0xbe5e('0x44')]+'%'};return _0x48e8c3;})});}_0x33fc4b=_[_0xbe5e('0x62')]({},_0x33fc4b,_0x15be4f['options']);return _0x58e633['getChatWebsites'](_0x33fc4b);}})[_0xbe5e('0x18')](function(_0xbba7d4){if(_0xbba7d4){_0x5bf5c1=_0xbba7d4['length'];if(!_0x15be4f[_0xbe5e('0x48')][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x33fc4b[_0xbe5e('0x2a')]=qs['limit'](_0x15be4f[_0xbe5e('0x48')][_0xbe5e('0x2a')]);_0x33fc4b[_0xbe5e('0x28')]=qs[_0xbe5e('0x28')](_0x15be4f[_0xbe5e('0x48')][_0xbe5e('0x28')]);}return _0x58e633[_0xbe5e('0x153')](_0x33fc4b);}})['then'](function(_0x55cc33){if(_0x55cc33){return _0x55cc33?{'count':_0x5bf5c1,'rows':_0x55cc33}:null;}})[_0xbe5e('0x18')](respondWithResult(_0x1d21b5,null))[_0xbe5e('0x23')](handleError(_0x1d21b5,null));};exports[_0xbe5e('0x154')]=function(_0x101146,_0x1e7fbd){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x101146[_0xbe5e('0x67')]['id']}})['then'](handleEntityNotFound(_0x1e7fbd,null))[_0xbe5e('0x18')](function(_0x3d71b5){if(_0x3d71b5){return _0x3d71b5[_0xbe5e('0x154')](_0x101146['body']['ids'],_[_0xbe5e('0x6b')](_0x101146[_0xbe5e('0x66')],[_0xbe5e('0x6a'),'id'])||{});}})[_0xbe5e('0x18')](respondWithResult(_0x1e7fbd,null))[_0xbe5e('0x23')](handleError(_0x1e7fbd,null));};exports[_0xbe5e('0x155')]=function(_0x480b9d,_0x2544b2){return db[_0xbe5e('0x40')]['find']({'where':{'id':_0x480b9d[_0xbe5e('0x67')]['id']}})['then'](handleEntityNotFound(_0x2544b2,null))[_0xbe5e('0x18')](function(_0x37e93c){if(_0x37e93c){return _0x37e93c['removeChatWebsites'](_0x480b9d[_0xbe5e('0x48')][_0xbe5e('0x6a')]);}})['then'](respondWithStatusCode(_0x2544b2,null))['catch'](handleError(_0x2544b2,null));};exports['getWhatsappAccounts']=function(_0x5b2394,_0x5a58a1){var _0x2dded0={};var _0xeab4e8={};var _0x492fea;var _0x1ae5e3;return db['User'][_0xbe5e('0xa2')]({'where':{'id':_0x5b2394[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x5a58a1,null))[_0xbe5e('0x18')](function(_0x6d9089){if(_0x6d9089){_0x492fea=_0x6d9089;_0xeab4e8[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db[_0xbe5e('0x156')][_0xbe5e('0x5c')]);_0xeab4e8[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x5b2394['query']);_0xeab4e8[_0xbe5e('0x5e')]=_[_0xbe5e('0x5f')](_0xeab4e8[_0xbe5e('0x5a')],_0xeab4e8['query']);_0x2dded0[_0xbe5e('0x4d')]=_['intersection'](_0xeab4e8[_0xbe5e('0x5a')],qs[_0xbe5e('0x60')](_0x5b2394[_0xbe5e('0x48')][_0xbe5e('0x60')]));_0x2dded0[_0xbe5e('0x4d')]=_0x2dded0[_0xbe5e('0x4d')]['length']?_0x2dded0[_0xbe5e('0x4d')]:_0xeab4e8[_0xbe5e('0x5a')];_0x2dded0[_0xbe5e('0xd5')]=qs['sort'](_0x5b2394[_0xbe5e('0x48')][_0xbe5e('0xd6')]);_0x2dded0[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_['pick'](_0x5b2394[_0xbe5e('0x48')],_0xeab4e8[_0xbe5e('0x5e')]));if(_0x5b2394['query'][_0xbe5e('0x44')]){_0x2dded0[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x2dded0[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x2dded0[_0xbe5e('0x4d')],function(_0x41d9ce){var _0x3565c8={};_0x3565c8[_0x41d9ce]={'$like':'%'+_0x5b2394[_0xbe5e('0x48')][_0xbe5e('0x44')]+'%'};return _0x3565c8;})});}_0x2dded0=_[_0xbe5e('0x62')]({},_0x2dded0,_0x5b2394['options']);return _0x492fea['getWhatsappAccounts'](_0x2dded0);}})['then'](function(_0x283be7){if(_0x283be7){_0x1ae5e3=_0x283be7['length'];if(!_0x5b2394[_0xbe5e('0x48')][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x2dded0[_0xbe5e('0x2a')]=qs[_0xbe5e('0x2a')](_0x5b2394[_0xbe5e('0x48')][_0xbe5e('0x2a')]);_0x2dded0[_0xbe5e('0x28')]=qs[_0xbe5e('0x28')](_0x5b2394[_0xbe5e('0x48')][_0xbe5e('0x28')]);}return _0x492fea[_0xbe5e('0x157')](_0x2dded0);}})[_0xbe5e('0x18')](function(_0x4c8f0d){if(_0x4c8f0d){return _0x4c8f0d?{'count':_0x1ae5e3,'rows':_0x4c8f0d}:null;}})[_0xbe5e('0x18')](respondWithResult(_0x5a58a1,null))['catch'](handleError(_0x5a58a1,null));};exports[_0xbe5e('0x158')]=function(_0x10c6af,_0x443d1a){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x10c6af['params']['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x443d1a,null))[_0xbe5e('0x18')](function(_0x5258c2){if(_0x5258c2){return _0x5258c2[_0xbe5e('0x158')](_0x10c6af[_0xbe5e('0x66')][_0xbe5e('0x6a')],_[_0xbe5e('0x6b')](_0x10c6af['body'],['ids','id'])||{});}})[_0xbe5e('0x18')](respondWithResult(_0x443d1a,null))[_0xbe5e('0x23')](handleError(_0x443d1a,null));};exports[_0xbe5e('0x159')]=function(_0x577727,_0x2ddea6){return db['User'][_0xbe5e('0x3a')]({'where':{'id':_0x577727[_0xbe5e('0x67')]['id']}})['then'](handleEntityNotFound(_0x2ddea6,null))[_0xbe5e('0x18')](function(_0x4302c8){if(_0x4302c8){return _0x4302c8['removeWhatsappAccounts'](_0x577727[_0xbe5e('0x48')][_0xbe5e('0x6a')]);}})['then'](respondWithStatusCode(_0x2ddea6,null))[_0xbe5e('0x23')](handleError(_0x2ddea6,null));};exports['getSquareProjects']=function(_0x4d31c7,_0xab3f07){var _0x2f3645={};var _0x282acd={};var _0x481717;var _0x460e6e;return db[_0xbe5e('0x40')][_0xbe5e('0xa2')]({'where':{'id':_0x4d31c7[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0xab3f07,null))[_0xbe5e('0x18')](function(_0x23a34a){if(_0x23a34a){_0x481717=_0x23a34a;_0x282acd[_0xbe5e('0x5a')]=_[_0xbe5e('0x5b')](db[_0xbe5e('0x15a')][_0xbe5e('0x5c')]);_0x282acd[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x4d31c7[_0xbe5e('0x48')]);_0x282acd['filters']=_[_0xbe5e('0x5f')](_0x282acd[_0xbe5e('0x5a')],_0x282acd[_0xbe5e('0x48')]);_0x2f3645['attributes']=_[_0xbe5e('0x5f')](_0x282acd[_0xbe5e('0x5a')],qs[_0xbe5e('0x60')](_0x4d31c7[_0xbe5e('0x48')]['fields']));_0x2f3645[_0xbe5e('0x4d')]=_0x2f3645[_0xbe5e('0x4d')][_0xbe5e('0x51')]?_0x2f3645['attributes']:_0x282acd[_0xbe5e('0x5a')];_0x2f3645['order']=qs[_0xbe5e('0xd6')](_0x4d31c7[_0xbe5e('0x48')][_0xbe5e('0xd6')]);_0x2f3645[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_[_0xbe5e('0xdf')](_0x4d31c7['query'],_0x282acd[_0xbe5e('0x5e')]));if(_0x4d31c7['query']['filter']){_0x2f3645[_0xbe5e('0x47')]=_['merge'](_0x2f3645[_0xbe5e('0x47')],{'$or':_[_0xbe5e('0x37')](_0x2f3645[_0xbe5e('0x4d')],function(_0x52bb99){var _0x288466={};_0x288466[_0x52bb99]={'$like':'%'+_0x4d31c7[_0xbe5e('0x48')][_0xbe5e('0x44')]+'%'};return _0x288466;})});}_0x2f3645=_['merge']({},_0x2f3645,_0x4d31c7[_0xbe5e('0x63')]);return _0x481717[_0xbe5e('0x15b')](_0x2f3645);}})['then'](function(_0x3dcedf){if(_0x3dcedf){_0x460e6e=_0x3dcedf['length'];if(!_0x4d31c7['query'][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x2f3645[_0xbe5e('0x2a')]=qs['limit'](_0x4d31c7[_0xbe5e('0x48')]['limit']);_0x2f3645[_0xbe5e('0x28')]=qs[_0xbe5e('0x28')](_0x4d31c7[_0xbe5e('0x48')]['offset']);}return _0x481717[_0xbe5e('0x15b')](_0x2f3645);}})['then'](function(_0x4a59e4){if(_0x4a59e4){return _0x4a59e4?{'count':_0x460e6e,'rows':_0x4a59e4}:null;}})[_0xbe5e('0x18')](respondWithResult(_0xab3f07,null))[_0xbe5e('0x23')](handleError(_0xab3f07,null));};exports[_0xbe5e('0x15c')]=function(_0x4b3bc4,_0x42933c){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x4b3bc4[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x42933c,null))['then'](function(_0x4a794c){if(_0x4a794c){return _0x4a794c[_0xbe5e('0x15c')](_0x4b3bc4[_0xbe5e('0x66')][_0xbe5e('0x6a')],_[_0xbe5e('0x6b')](_0x4b3bc4[_0xbe5e('0x66')],[_0xbe5e('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x42933c,null))[_0xbe5e('0x23')](handleError(_0x42933c,null));};exports[_0xbe5e('0x15d')]=function(_0x1148f9,_0x2c6aff){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0x1148f9[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x2c6aff,null))['then'](function(_0x49fef4){if(_0x49fef4){return _0x49fef4['removeSquareProjects'](_0x1148f9[_0xbe5e('0x48')][_0xbe5e('0x6a')]);}})[_0xbe5e('0x18')](respondWithStatusCode(_0x2c6aff,null))[_0xbe5e('0x23')](handleError(_0x2c6aff,null));};exports[_0xbe5e('0x15e')]=function(_0x63acdd,_0x1c4012){var _0x2096f1={},_0x1c2a78={},_0x596a1b={'count':0x0,'rows':[]};var _0x1bd785=db[_0xbe5e('0x15f')]['rawAttributes'];_0x1c2a78[_0xbe5e('0x5a')]=_['keys'](_0x1bd785);_0x1c2a78[_0xbe5e('0x48')]=_[_0xbe5e('0x5b')](_0x63acdd['query']);_0x1c2a78[_0xbe5e('0x5e')]=_[_0xbe5e('0x5f')](_0x1c2a78[_0xbe5e('0x5a')],_0x1c2a78[_0xbe5e('0x48')]);_0x1c2a78[_0xbe5e('0x5e')]=_[_0xbe5e('0xd2')](_0x1c2a78[_0xbe5e('0x5e')],[_0xbe5e('0x160'),_0xbe5e('0x161'),_0xbe5e('0x162'),_0xbe5e('0x163'),'$lt',_0xbe5e('0x164'),_0xbe5e('0x165'),_0xbe5e('0x166'),'$not',_0xbe5e('0x167'),_0xbe5e('0x168'),_0xbe5e('0x169'),_0xbe5e('0x16a'),'$like',_0xbe5e('0x16b'),_0xbe5e('0x16c'),_0xbe5e('0x16d'),_0xbe5e('0x16e'),_0xbe5e('0x16f'),_0xbe5e('0x170'),_0xbe5e('0x171'),_0xbe5e('0x172')]);_0x2096f1[_0xbe5e('0x4d')]=_[_0xbe5e('0x5f')](_0x1c2a78['model'],qs[_0xbe5e('0x60')](_0x63acdd[_0xbe5e('0x48')]['fields']));_0x2096f1[_0xbe5e('0x4d')]=_0x2096f1[_0xbe5e('0x4d')]['length']?_0x2096f1[_0xbe5e('0x4d')]:_0x1c2a78['model'];if(!_0x63acdd['query'][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x2096f1[_0xbe5e('0x2a')]=qs['limit'](_0x63acdd[_0xbe5e('0x48')]['limit']);_0x2096f1[_0xbe5e('0x28')]=qs[_0xbe5e('0x28')](_0x63acdd[_0xbe5e('0x48')][_0xbe5e('0x28')]);}_0x2096f1[_0xbe5e('0xd5')]=qs[_0xbe5e('0xd6')](_0x63acdd[_0xbe5e('0x48')][_0xbe5e('0xd6')]);_0x2096f1[_0xbe5e('0x47')]=qs[_0xbe5e('0x5e')](_[_0xbe5e('0xdf')](_0x63acdd['query'],_0x1c2a78[_0xbe5e('0x5e')]));if(_0x63acdd[_0xbe5e('0x48')][_0xbe5e('0x44')]){_0x2096f1[_0xbe5e('0x47')]=_[_0xbe5e('0x62')](_0x2096f1['where'],{'$or':_[_0xbe5e('0x37')](_0x2096f1['attributes'],function(_0x37c76c){var _0x57cfc2={};_0x57cfc2[_0x37c76c]={'$like':'%'+_0x63acdd[_0xbe5e('0x48')]['filter']+'%'};return _0x57cfc2;})});}_0x2096f1['where']={'$and':[_0x2096f1[_0xbe5e('0x47')],{'$or':[{'UserId':_0x63acdd[_0xbe5e('0x67')]['id']},{'OwnerId':_0x63acdd[_0xbe5e('0x67')]['id']}]}]};_0x2096f1=_[_0xbe5e('0x62')]({},_0x2096f1,_0x63acdd[_0xbe5e('0x63')]);var _0x5f102e={'where':_0x2096f1[_0xbe5e('0x47')]};return db[_0xbe5e('0x15f')][_0xbe5e('0x2b')](_0x5f102e)['then'](function(_0x2e6249){_0x596a1b[_0xbe5e('0x2b')]=_0x2e6249;if(_0x63acdd['query']['includeAll']){_0x2096f1['include']=[{'attributes':['id','firstName','lastName',_0xbe5e('0xf4')],'model':db[_0xbe5e('0xd4')],'as':_0xbe5e('0x173')},{'attributes':['id','name','dialActive'],'model':db[_0xbe5e('0xb4')],'as':_0xbe5e('0xde')}];}return db[_0xbe5e('0x15f')][_0xbe5e('0x4e')](_0x2096f1);})[_0xbe5e('0x18')](function(_0x48bfcb){_0x596a1b[_0xbe5e('0x4f')]=_0x48bfcb;return _0x596a1b;})[_0xbe5e('0x18')](respondWithFilteredResult(_0x1c4012,_0x2096f1))[_0xbe5e('0x23')](handleError(_0x1c4012,null));};exports[_0xbe5e('0x174')]=function(_0xd5ceba,_0xfad079){if(!_[_0xbe5e('0x72')](_0xd5ceba[_0xbe5e('0x34')]['id'])&&(_0xd5ceba['user'][_0xbe5e('0x31')]==_0xbe5e('0x32')||_0xd5ceba[_0xbe5e('0x34')]['role']=='user')){return db['User'][_0xbe5e('0xa2')]({'where':{'id':_0xd5ceba['params']['id']},'raw':!![]})['then'](function(_0x456f35){return authService[_0xbe5e('0x175')](_0x456f35);})[_0xbe5e('0x18')](function(_0x4582f0){if(_0x4582f0){return _0xfad079[_0xbe5e('0x26')](0xc8)[_0xbe5e('0x27')]({'api_key':_0x4582f0[_0xbe5e('0x176')]});}else{return _0xfad079['status'](0xcc)[_0xbe5e('0x27')]({'message':_0xbe5e('0x177')});}})[_0xbe5e('0x23')](handleError(_0xfad079,0x193));}else{return _0xfad079[_0xbe5e('0x26')](0x191)['json']({'message':'You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.'});}};exports[_0xbe5e('0x178')]=function(_0x13f529,_0x460f17){if(!_[_0xbe5e('0x72')](_0x13f529[_0xbe5e('0x34')]['id'])&&(_0x13f529[_0xbe5e('0x34')][_0xbe5e('0x31')]=='admin'||_0x13f529[_0xbe5e('0x34')][_0xbe5e('0x31')]=='user')){return db['User'][_0xbe5e('0x3a')]({'where':{'id':_0x13f529['params']['id']}})[_0xbe5e('0x18')](function(_0x500f72){return authService[_0xbe5e('0x179')](_0x500f72);})[_0xbe5e('0x18')](function(_0x12f899){return db[_0xbe5e('0x40')]['update']({'apiKeyIat':_0x12f899[_0xbe5e('0x17a')],'apiKeyNonce':_0x12f899[_0xbe5e('0x17b')]},{'where':{'id':_0x13f529[_0xbe5e('0x67')]['id']}})[_0xbe5e('0x18')](function(){return _0x460f17[_0xbe5e('0x26')](0xc8)[_0xbe5e('0x27')]({'api_key':_0x12f899[_0xbe5e('0x176')]});});})[_0xbe5e('0x23')](handleError(_0x460f17,0x193));}else{return _0x460f17['status'](0x191)[_0xbe5e('0x27')]({'message':_0xbe5e('0x17c')});}};exports['removeApiKey']=function(_0xb10a36,_0x5594f2){if(!_[_0xbe5e('0x72')](_0xb10a36[_0xbe5e('0x34')]['id'])&&(_0xb10a36[_0xbe5e('0x34')][_0xbe5e('0x31')]=='admin'||_0xb10a36['user'][_0xbe5e('0x31')]==_0xbe5e('0x34'))){return db[_0xbe5e('0x40')][_0xbe5e('0x3a')]({'where':{'id':_0xb10a36['params']['id']}})[_0xbe5e('0x18')](handleEntityNotFound(_0x5594f2,null))[_0xbe5e('0x18')](function(_0x921aad){if(_0x921aad&&_0x921aad[_0xbe5e('0x17d')]&&_0x921aad[_0xbe5e('0x17e')])return _0x921aad;else throw{'message':_0xbe5e('0x17f')};})[_0xbe5e('0x18')](function(){return db[_0xbe5e('0x40')][_0xbe5e('0x65')]({'apiKeyNonce':null,'apiKeyIat':null},{'where':{'id':_0xb10a36['params']['id']}});})[_0xbe5e('0x18')](respondWithStatusCode(_0x5594f2,0xc8))[_0xbe5e('0x23')](handleError(_0x5594f2,0x193));}else{return _0x5594f2[_0xbe5e('0x26')](0x191)[_0xbe5e('0x27')]({'message':_0xbe5e('0x17c')});}};exports[_0xbe5e('0x180')]=function(_0x319298,_0x33e314){var _0x1db440=_0x319298[_0xbe5e('0x34')][_0xbe5e('0x30')]({'plain':!![]});if(!_0x1db440){return _0x33e314[_0xbe5e('0x26')](0x191)[_0xbe5e('0x3e')](_0xbe5e('0x181'));}else{Promise[_0xbe5e('0x11d')]()['then'](function(){if(_0x319298[_0xbe5e('0x48')][_0xbe5e('0x4a')]!=='true')return;return _0x319298[_0xbe5e('0x34')]['getUserSetting']();})[_0xbe5e('0x18')](function(_0x103077){if(!_0x103077)return;return _0x103077[_0xbe5e('0x30')]({'plain':!![]});})[_0xbe5e('0x18')](function(_0x58f24c){_0x1db440[_0xbe5e('0x4a')]=_0x58f24c;return _0x33e314[_0xbe5e('0x26')](0xc8)[_0xbe5e('0x27')](_0x1db440);});}};exports[_0xbe5e('0x182')]=function(_0x16ecfd,_0xe323bd){var _0x406305={'offset':0x0},_0x4e464d={'count':0x0,'rows':[]};Promise[_0xbe5e('0x11d')]()[_0xbe5e('0x18')](function(){if(!_0x16ecfd[_0xbe5e('0x48')]['filter']&&!_0x16ecfd['query'][_0xbe5e('0x183')]&&!_0x16ecfd[_0xbe5e('0x48')][_0xbe5e('0x184')])return[];return Promise[_0xbe5e('0x11d')]()[_0xbe5e('0x18')](function(){var _0x575dad=[];if(!_['isEmpty'](_0x16ecfd[_0xbe5e('0x48')]['teams'])){_0x575dad[_0xbe5e('0x52')](db['Team']['findAll']({'attributes':['id',_0xbe5e('0x3d')],'where':{'id':_0x16ecfd[_0xbe5e('0x48')][_0xbe5e('0x183')]}}));}if(!_[_0xbe5e('0x96')](_0x16ecfd[_0xbe5e('0x48')][_0xbe5e('0x184')])){_0x575dad[_0xbe5e('0x52')](db[_0xbe5e('0xb4')][_0xbe5e('0x4e')]({'attributes':['id','name'],'type':'inbound','where':{'id':_0x16ecfd[_0xbe5e('0x48')][_0xbe5e('0x184')]}}));}return Promise['all'](_0x575dad);})[_0xbe5e('0x18')](function(_0x67d19){var _0x336f6e=_['flatten'](_0x67d19)[_0xbe5e('0x37')](function(_0x2ca607){return _0x2ca607['getAgents']({'attributes':['id',_0xbe5e('0x3d'),'internal','online'],'raw':!![]});});return Promise[_0xbe5e('0x64')](_0x336f6e);})[_0xbe5e('0x18')](function(_0x222005){var _0x5ed4a4=_[_0xbe5e('0x185')](_0x222005);if(!_0x16ecfd['query'][_0xbe5e('0x44')])return _0x5ed4a4;if(_[_0xbe5e('0x96')](_0x5ed4a4)){return db[_0xbe5e('0x40')][_0xbe5e('0x4e')]({'attributes':['id','name',_0xbe5e('0x6c'),_0xbe5e('0xa9')],'where':{'role':_0xbe5e('0x7d'),'$or':[db[_0xbe5e('0x74')][_0xbe5e('0x47')](db[_0xbe5e('0x74')]['fn']('lower',db['sequelize'][_0xbe5e('0x186')](_0xbe5e('0x3d'))),{'$like':'%'+_0x16ecfd['query']['filter']['toLowerCase']()+'%'}),{'internal':{'$like':'%'+_0x16ecfd[_0xbe5e('0x48')]['filter']+'%'}}]},'raw':!![]});}else{return _(_0x5ed4a4)[_0xbe5e('0x185')]()[_0xbe5e('0x44')](function(_0x199c5e){return _0x199c5e[_0xbe5e('0x3d')][_0xbe5e('0xae')]()[_0xbe5e('0x39')](_0x16ecfd[_0xbe5e('0x48')][_0xbe5e('0x44')][_0xbe5e('0xae')]())||_0x199c5e[_0xbe5e('0x6c')]['toString']()['includes'](_0x16ecfd[_0xbe5e('0x48')]['filter']);})[_0xbe5e('0x38')]();}})[_0xbe5e('0x18')](function(_0x509c50){var _0x4d3a27=_0xbe5e('0x3d');var _0x4dbac3=_0xbe5e('0x187');if(_0x16ecfd['query'][_0xbe5e('0xd6')]){_0x4dbac3=_0x16ecfd[_0xbe5e('0x48')][_0xbe5e('0xd6')][0x0]==='-'?_0xbe5e('0x188'):'asc';_0x4d3a27=_0x4dbac3==='asc'?_0x16ecfd['query'][_0xbe5e('0xd6')]:_0x16ecfd[_0xbe5e('0x48')][_0xbe5e('0xd6')]['substring'](0x1);}return _(_0x509c50)['uniqBy']('id')['orderBy']([function(_0x465770){return _0x4d3a27==='name'?_0x465770[_0x4d3a27][_0xbe5e('0xae')]():_0x465770[_0x4d3a27];}],[_0x4dbac3])['map'](function(_0x3641ee){return _[_0xbe5e('0xdf')](_0x3641ee,['id',_0xbe5e('0x3d'),_0xbe5e('0x6c'),'online']);})[_0xbe5e('0x38')]();})[_0xbe5e('0x18')](function(_0x210fde){return amiClient[_0xbe5e('0x17')](_0xbe5e('0x97'),_0x16ecfd)['then'](function(_0x426c16){if(_0x426c16[_0xbe5e('0x1e')])throw new Error(_0xbe5e('0x189'));var _0x403820=_0x426c16[_0xbe5e('0x22')];var _0xe15a60=jayson[_0xbe5e('0x15')][_0xbe5e('0x16')]({'port':0x232c});return _0xe15a60['request'](_0xbe5e('0x97'),_0x16ecfd)['then'](function(_0x5675b7){if(_0x5675b7['error'])throw new Error(_0xbe5e('0x18a'));var _0x31e285=_0x5675b7[_0xbe5e('0x22')];return _['merge']({},_0x31e285,_0x403820);});})['then'](function(_0x250e83){return _[_0xbe5e('0x37')](_0x210fde,function(_0x5ed23b){var _0x168c97=_[_0xbe5e('0x3a')](_0x250e83[_0xbe5e('0x4f')],['id',_0x5ed23b['id']]);if(!_0x168c97||!_0x5ed23b[_0xbe5e('0xa9')]){_0x5ed23b[_0xbe5e('0x26')]=_0xbe5e('0x18b');}else if(_0x168c97[_0xbe5e('0xb7')]){_0x5ed23b[_0xbe5e('0x26')]=_0xbe5e('0x10c');}else{_0x5ed23b[_0xbe5e('0x26')]=_[_0xbe5e('0x39')](['idle','unknown',_0xbe5e('0x18c'),_0xbe5e('0x18d'),null,undefined],_0x168c97[_0xbe5e('0x18e')])?_0xbe5e('0xa9'):_0xbe5e('0x18f');}return _0x5ed23b;});});});})[_0xbe5e('0x18')](function(_0x2da387){if(!_0x16ecfd[_0xbe5e('0x48')][_0xbe5e('0xd7')](_0xbe5e('0xdc'))){_0x406305[_0xbe5e('0x2a')]=qs[_0xbe5e('0x2a')](_0x16ecfd[_0xbe5e('0x48')]['limit']||0xa);_0x406305[_0xbe5e('0x28')]=qs[_0xbe5e('0x28')](_0x16ecfd[_0xbe5e('0x48')][_0xbe5e('0x28')]);}_0x4e464d[_0xbe5e('0x2b')]=_0x2da387['length'];_0x4e464d['rows']=_0x406305[_0xbe5e('0x2a')]?_0x2da387[_0xbe5e('0x190')](_0x406305[_0xbe5e('0x28')],_0x406305[_0xbe5e('0x28')]+_0x406305[_0xbe5e('0x2a')]):_0x2da387;return _0x4e464d;})[_0xbe5e('0x18')](respondWithFilteredResult(_0xe323bd,_0x406305))['catch'](handleError(_0xe323bd,null));};function get_open_tabs(_0x54b0f9,_0x103359){var _0x5d2b77=_0x54b0f9[_0xbe5e('0x191')](0x0)[_0xbe5e('0x192')]()+_0x54b0f9['slice'](0x1);var _0x53a1bb={'type':db[_0xbe5e('0x9e')][_0xbe5e('0x76')][_0xbe5e('0x77')],'raw':!![]};return new Promise(function(_0x23b865,_0x17cbf2){var _0x125e2d=squel[_0xbe5e('0x193')]()['field']('ui.'+_0x5d2b77+_0xbe5e('0x194'),'id')['field'](_0xbe5e('0x195'))[_0xbe5e('0x78')](_0xbe5e('0x196')+_0x54b0f9+_0xbe5e('0x197'),'ui')[_0xbe5e('0x47')](_0xbe5e('0x198'),_0x103359['id']);return db[_0xbe5e('0x74')][_0xbe5e('0x48')](_0x125e2d[_0xbe5e('0x199')](),_0x53a1bb)['then'](function(_0x1d6dbe){_0x103359[_0x5d2b77+_0xbe5e('0x19a')]=_0x1d6dbe;_0x23b865(_0x1d6dbe);})[_0xbe5e('0x23')](function(_0x5ef3a3){_0x17cbf2(_0x5ef3a3);});});}
\ No newline at end of file
+var _0x5482=['108','100','111','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','VoiceMail','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','each','UserProfileSection','Telephones','isEmpty','some','autoAssociation','compact','changePassword','params','newPassword','ValidationError','authenticate','Sequelize','Wrong\x20credentials','oldPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','findOne','securePassword','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','VoiceQueue','voice','online','format','SIP/%s','voicePause','UserVoiceQueueRt','upsert','removeQueues','channel','remove','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','download','existsSync','server/files/images/','CHAT','createdAt','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','order','sort','pick','CmList','List','Tag','color','tag','hasOwnProperty','nolimit','getQueues','Queue','getVoiceQueuesRt','ChatGroup','getGroups','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','phone','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','forEach','LOGIN','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','pause','updateAttributes','DEFAULT\x20PAUSE','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','QueuePause','unpause','manual','%s%s','Pause','getTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','User\x20with\x20id\x20%s\x20not\x20found','transaction','addTeams','Team','flattenDeep','Voice','UserVoicePrefix','VoicePrefixId','getDataValue','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','removeAgent','getLists','getAgents','values','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','CmHopper','$or','$gt','$lt','$eq','$between','$notBetween','$notIn','$like','$iLike','$overlap','$contains','$contained','$any','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','inbound','flatten','lower','col','toString','asc','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','charAt','slice','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','moment','bluebird','util','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','APIBadRequestError','../../errors/api','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','client','http','request','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','User,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','emit','userNotification:recalc:','destroy','get','role','admin','user','Agents','telephone','filter','ignore','value','includes','find','UserProfileResource','stack','send','index','User','rawAttributes','map','type','key','password','salt','name','getOptions','where','query','includeAll','include','userSetting','true','attributes','findAll','rows','openTabs','length','push','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','catch','show','model','keys','filters','intersection','fields','merge','options','body','describe','addContacts','ids','omit','internal','Setting','findById','validatePasswordPattern','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','mailbox','fullname','email','agent','permissions','101','102','103','113','110','104','106','107'];(function(_0x480bbd,_0x2a2f7b){var _0x2e36de=function(_0x192b44){while(--_0x192b44){_0x480bbd['push'](_0x480bbd['shift']());}};_0x2e36de(++_0x2a2f7b);}(_0x5482,0x111));var _0x2548=function(_0x5b3a3c,_0x5a8e66){_0x5b3a3c=_0x5b3a3c-0x0;var _0x282066=_0x5482[_0x5b3a3c];return _0x282066;};'use strict';var moment=require(_0x2548('0x0'));var BPromise=require(_0x2548('0x1'));var util=require(_0x2548('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x2548('0x3'));var squel=require(_0x2548('0x4'));var jayson=require(_0x2548('0x5'));var Redis=require(_0x2548('0x6'));var authService=require(_0x2548('0x7'));var qs=require(_0x2548('0x8'));var logger=require(_0x2548('0x9'))(_0x2548('0xa'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2548('0xb'));var APIBadRequestError=require('../../errors/api')[_0x2548('0xc')];var APINotFoundError=require(_0x2548('0xd'))[_0x2548('0xe')];var APIHandleError=require(_0x2548('0xd'))[_0x2548('0xf')];var db=require(_0x2548('0x10'))['db'];var socket=require(_0x2548('0x11'))(new Redis(config[_0x2548('0x12')]));require('./user.socket')[_0x2548('0x13')](socket);config[_0x2548('0x12')]=_[_0x2548('0x14')](config[_0x2548('0x12')],{'host':_0x2548('0x15'),'port':0x18eb});var client=jayson[_0x2548('0x16')][_0x2548('0x17')]({'port':0x232a});var values;function respondWithRpcPromise(_0x5f40ab,_0x4d22f4,_0x35b729,_0x40b606){return new BPromise(function(_0x2a1fc2,_0xe97d24){var _0x409568=_0x40b606||client;return _0x409568[_0x2548('0x18')](_0x5f40ab,_0x35b729)[_0x2548('0x19')](function(_0x23f190){logger[_0x2548('0x1a')]('User,\x20%s,\x20%s',_0x4d22f4,_0x2548('0x1b'));logger[_0x2548('0x1c')](_0x2548('0x1d'),_0x4d22f4,_0x2548('0x1b'),JSON['stringify'](_0x23f190));if(_0x23f190[_0x2548('0x1e')]){if(_0x23f190[_0x2548('0x1e')]['code']===0x1f4){logger[_0x2548('0x1e')](_0x2548('0x1f'),_0x4d22f4,_0x23f190[_0x2548('0x1e')][_0x2548('0x20')]);return _0xe97d24(_0x23f190['error'][_0x2548('0x20')]);}logger[_0x2548('0x1e')](_0x2548('0x1f'),_0x4d22f4,_0x23f190[_0x2548('0x1e')][_0x2548('0x20')]);return _0x2a1fc2(_0x23f190[_0x2548('0x1e')][_0x2548('0x20')]);}else{logger[_0x2548('0x1a')](_0x2548('0x1f'),_0x4d22f4,_0x2548('0x1b'));_0x2a1fc2(_0x23f190[_0x2548('0x21')]['message']);}})['catch'](function(_0x37cc4b){logger[_0x2548('0x1e')]('User,\x20%s,\x20%s',_0x4d22f4,_0x37cc4b);_0xe97d24(_0x37cc4b);});});}function respondWithStatusCode(_0x463460,_0xa363e0){_0xa363e0=_0xa363e0||0xcc;return function(_0x1379f4){if(_0x1379f4){return _0x463460[_0x2548('0x22')](_0xa363e0);}return _0x463460['status'](_0xa363e0)['end']();};}function respondWithResult(_0xc658e1,_0x4b1b09){_0x4b1b09=_0x4b1b09||0xc8;return function(_0x5911a2){if(_0x5911a2){return _0xc658e1[_0x2548('0x23')](_0x4b1b09)[_0x2548('0x24')](_0x5911a2);}};}function respondWithFilteredResult(_0x5e192c,_0xb15ef8){return function(_0x4e2327){if(_0x4e2327){var _0x3a89ef=typeof _0xb15ef8[_0x2548('0x25')]==='undefined'&&typeof _0xb15ef8[_0x2548('0x26')]===_0x2548('0x27');var _0x409c1e=_0x4e2327['count'];var _0x44f1b8=_0x3a89ef?0x0:_0xb15ef8[_0x2548('0x25')];var _0x5bb96a=_0x3a89ef?_0x4e2327[_0x2548('0x28')]:_0xb15ef8[_0x2548('0x25')]+_0xb15ef8[_0x2548('0x26')];var _0x445f7d;if(_0x5bb96a>=_0x409c1e){_0x5bb96a=_0x409c1e;_0x445f7d=0xc8;}else{_0x445f7d=0xce;}_0x5e192c[_0x2548('0x23')](_0x445f7d);return _0x5e192c[_0x2548('0x29')](_0x2548('0x2a'),_0x44f1b8+'-'+_0x5bb96a+'/'+_0x409c1e)[_0x2548('0x24')](_0x4e2327);}return null;};}function saveUpdates(_0x3d7af9){return function(_0x4d9e9e){if(_0x4d9e9e){return _0x4d9e9e[_0x2548('0x2b')](_0x3d7af9)[_0x2548('0x19')](function(_0x135657){socket[_0x2548('0x2c')](_0x2548('0x2d')+_0x135657['id'],{});return _0x135657;});}return null;};}function removeEntity(_0x1f03e8){return function(_0x2e4c35){if(_0x2e4c35){return _0x2e4c35[_0x2548('0x2e')]()['then'](function(){var _0x4b7cdd=_0x2e4c35[_0x2548('0x2f')]({'plain':!![]});if(_0x4b7cdd[_0x2548('0x30')]===_0x2548('0x31'))return;var _0x17e7cb=[{'name':'Users','value':_0x2548('0x32'),'ignore':!![]},{'name':_0x2548('0x33'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0x2548('0x34'),'ignore':![]}];var _0xd83e06=_(_0x17e7cb)[_0x2548('0x35')](_0x2548('0x36'))['map'](_0x2548('0x37'))[_0x2548('0x37')]();if(_[_0x2548('0x38')](_0xd83e06,_0x4b7cdd[_0x2548('0x30')])){return;}var _0x1f6969=_[_0x2548('0x39')](_0x17e7cb,[_0x2548('0x37'),_0x4b7cdd['role']])['name'];return db[_0x2548('0x3a')][_0x2548('0x2e')]({'where':{'type':_0x1f6969,'resourceId':_0x4b7cdd['id']}})['then'](function(){return _0x2e4c35;});})[_0x2548('0x19')](function(){_0x1f03e8[_0x2548('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbd3389){return function(_0x35ae15){if(!_0x35ae15){_0xbd3389['sendStatus'](0x194);}return _0x35ae15;};}function handleError(_0x70dad2,_0x541991){_0x541991=_0x541991||0x1f4;return function(_0x431f58){logger[_0x2548('0x1e')](_0x431f58[_0x2548('0x3b')]);if(_0x431f58['name']){delete _0x431f58['name'];}_0x70dad2[_0x2548('0x23')](_0x541991)[_0x2548('0x3c')](_0x431f58);};}exports[_0x2548('0x3d')]=function(_0x484a04,_0x5cfb49){var _0x55f406={},_0x18564e={'count':0x0,'rows':[]};var _0x44c4fd=_(db[_0x2548('0x3e')][_0x2548('0x3f')])[_0x2548('0x40')](function(_0x52c59a){return{'name':_0x52c59a['fieldName'],'type':_0x52c59a[_0x2548('0x41')][_0x2548('0x42')]};})[_0x2548('0x35')](function(_0x3a5dd){return!_[_0x2548('0x38')]([_0x2548('0x43'),_0x2548('0x44')],_0x3a5dd[_0x2548('0x45')]);})['value']();_0x55f406=qs[_0x2548('0x46')](_0x44c4fd,_0x484a04);var _0x3a8295={'where':_0x55f406[_0x2548('0x47')]};return db[_0x2548('0x3e')][_0x2548('0x28')](_0x3a8295)[_0x2548('0x19')](function(_0x3e7520){_0x18564e[_0x2548('0x28')]=_0x3e7520;if(_0x484a04[_0x2548('0x48')][_0x2548('0x49')]){_0x55f406[_0x2548('0x4a')]=[{'all':!![]}];}if(_0x484a04[_0x2548('0x48')][_0x2548('0x4b')]===_0x2548('0x4c')){_0x55f406[_0x2548('0x4a')]=[{'model':db['UserSetting'],'as':_0x2548('0x4b')}];}if(!_[_0x2548('0x38')](_0x55f406[_0x2548('0x4d')],'id')){_0x55f406[_0x2548('0x4d')]['push']('id');}return db[_0x2548('0x3e')][_0x2548('0x4e')](_0x55f406);})[_0x2548('0x19')](function(_0x2edbaf){_0x18564e[_0x2548('0x4f')]=_0x2edbaf;if(_0x484a04[_0x2548('0x48')][_0x2548('0x50')]==='true'){var _0x137bba=[];for(var _0x38192d=0x0;_0x38192d<_0x18564e['rows'][_0x2548('0x51')];_0x38192d++){_0x137bba[_0x2548('0x52')](get_open_tabs(_0x2548('0x53'),_0x18564e['rows'][_0x38192d][_0x2548('0x54')]));_0x137bba['push'](get_open_tabs(_0x2548('0x55'),_0x18564e[_0x2548('0x4f')][_0x38192d][_0x2548('0x54')]));_0x137bba[_0x2548('0x52')](get_open_tabs(_0x2548('0x56'),_0x18564e[_0x2548('0x4f')][_0x38192d][_0x2548('0x54')]));_0x137bba[_0x2548('0x52')](get_open_tabs(_0x2548('0x57'),_0x18564e[_0x2548('0x4f')][_0x38192d][_0x2548('0x54')]));_0x137bba[_0x2548('0x52')](get_open_tabs(_0x2548('0x58'),_0x18564e[_0x2548('0x4f')][_0x38192d]['dataValues']));_0x137bba[_0x2548('0x52')](get_open_tabs(_0x2548('0x59'),_0x18564e[_0x2548('0x4f')][_0x38192d]['dataValues']));}return BPromise[_0x2548('0x5a')](_0x137bba)[_0x2548('0x19')](function(){return _0x18564e;});}else{return _0x18564e;}})[_0x2548('0x19')](respondWithFilteredResult(_0x5cfb49,_0x55f406))[_0x2548('0x5b')](handleError(_0x5cfb49,null));};exports[_0x2548('0x5c')]=function(_0x11ffe7,_0x209a09){var _0x29a305={'raw':![],'where':{'id':_0x11ffe7['params']['id']}},_0x3b0ed3={};_0x3b0ed3[_0x2548('0x5d')]=_['differenceBy'](_[_0x2548('0x5e')](db[_0x2548('0x3e')][_0x2548('0x3f')]),[_0x2548('0x43'),_0x2548('0x44')]);_0x3b0ed3[_0x2548('0x48')]=_[_0x2548('0x5e')](_0x11ffe7[_0x2548('0x48')]);_0x3b0ed3[_0x2548('0x5f')]=_['intersection'](_0x3b0ed3[_0x2548('0x5d')],_0x3b0ed3['query']);_0x29a305['attributes']=_[_0x2548('0x60')](_0x3b0ed3[_0x2548('0x5d')],qs[_0x2548('0x61')](_0x11ffe7['query'][_0x2548('0x61')]));_0x29a305[_0x2548('0x4d')]=_0x29a305[_0x2548('0x4d')][_0x2548('0x51')]?_0x29a305[_0x2548('0x4d')]:_0x3b0ed3[_0x2548('0x5d')];if(_0x11ffe7[_0x2548('0x48')][_0x2548('0x49')]){_0x29a305[_0x2548('0x4a')]=[{'all':!![]}];}if(_0x11ffe7[_0x2548('0x48')][_0x2548('0x4b')]==='true'){_0x29a305['include']=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x29a305=_[_0x2548('0x62')]({},_0x29a305,_0x11ffe7[_0x2548('0x63')]);if(!_[_0x2548('0x38')](_0x29a305[_0x2548('0x4d')],'id')){_0x29a305[_0x2548('0x4d')][_0x2548('0x52')]('id');}return db[_0x2548('0x3e')]['find'](_0x29a305)[_0x2548('0x19')](handleEntityNotFound(_0x209a09,null))[_0x2548('0x19')](function(_0x2a60fb){var _0x42f5c2=[];values=_0x2a60fb;if(_0x11ffe7[_0x2548('0x48')][_0x2548('0x50')]==='true'){_0x42f5c2[_0x2548('0x52')](get_open_tabs(_0x2548('0x53'),_0x2a60fb['dataValues']));_0x42f5c2[_0x2548('0x52')](get_open_tabs(_0x2548('0x55'),_0x2a60fb[_0x2548('0x54')]));_0x42f5c2[_0x2548('0x52')](get_open_tabs(_0x2548('0x58'),_0x2a60fb[_0x2548('0x54')]));_0x42f5c2[_0x2548('0x52')](get_open_tabs(_0x2548('0x59'),_0x2a60fb[_0x2548('0x54')]));_0x42f5c2[_0x2548('0x52')](get_open_tabs(_0x2548('0x56'),_0x2a60fb[_0x2548('0x54')]));_0x42f5c2[_0x2548('0x52')](get_open_tabs(_0x2548('0x57'),_0x2a60fb[_0x2548('0x54')]));return BPromise[_0x2548('0x5a')](_0x42f5c2);}else{return values;}})[_0x2548('0x19')](function(){return values;})[_0x2548('0x19')](respondWithResult(_0x209a09,null))[_0x2548('0x5b')](handleError(_0x209a09,null));};exports['update']=function(_0x393dc7,_0x2a2784){if(_0x393dc7[_0x2548('0x64')]['id']){delete _0x393dc7['body']['id'];}delete _0x393dc7['body'][_0x2548('0x30')];return db[_0x2548('0x3e')]['find']({'where':{'id':_0x393dc7['params']['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x2a2784,null))[_0x2548('0x19')](saveUpdates(_0x393dc7['body'],null))['then'](respondWithResult(_0x2a2784,null))[_0x2548('0x5b')](handleError(_0x2a2784,null));};exports[_0x2548('0x65')]=function(_0x334188,_0x44a98c){return db[_0x2548('0x3e')][_0x2548('0x65')]()[_0x2548('0x19')](respondWithResult(_0x44a98c,null))[_0x2548('0x5b')](handleError(_0x44a98c,null));};exports[_0x2548('0x66')]=function(_0x360231,_0x451f28){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x360231['params']['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x451f28,null))[_0x2548('0x19')](function(_0x2eedd9){if(_0x2eedd9){return _0x2eedd9[_0x2548('0x66')](_0x360231['body'][_0x2548('0x67')],_[_0x2548('0x68')](_0x360231[_0x2548('0x64')],[_0x2548('0x67'),'id'])||{});}})[_0x2548('0x19')](respondWithResult(_0x451f28,null))[_0x2548('0x5b')](handleError(_0x451f28,null));};function validateUser(_0x2b2f81){return new BPromise(function(_0x4cac39,_0x4fb720){if(_0x2b2f81[_0x2548('0x69')])return _0x4cac39(_0x2b2f81);return db[_0x2548('0x6a')][_0x2548('0x6b')](0x1)[_0x2548('0x19')](function(_0x382345){if(_0x382345['securePassword'])authService[_0x2548('0x6c')](_0x2b2f81[_0x2548('0x43')]);db[_0x2548('0x3e')]['max']('internal')[_0x2548('0x19')](function(_0x2b52a8){if(_[_0x2548('0x6d')](_0x2b52a8)){_0x2b2f81[_0x2548('0x69')]=_0x382345[_0x2548('0x6e')]||0x1;return;}if(_[_0x2548('0x6d')](_0x382345['min_internal'])||_0x382345[_0x2548('0x6e')]===_0x2b52a8){_0x2b2f81[_0x2548('0x69')]=_0x2b52a8+0x1;return;}if(_0x382345[_0x2548('0x6e')]>_0x2b52a8){_0x2b2f81['internal']=_0x382345[_0x2548('0x6e')];return;}return db[_0x2548('0x6f')][_0x2548('0x48')](_0x2548('0x70'),{'type':db[_0x2548('0x6f')][_0x2548('0x71')][_0x2548('0x72')]})['then'](function(_0x1dc3b5){if(_0x1dc3b5&&_0x1dc3b5[_0x2548('0x51')]){for(var _0x25cb55=0x0,_0x1bb687=_0x1dc3b5['length'];_0x25cb55<_0x1bb687&&_['isNil'](_0x2b2f81[_0x2548('0x69')]);_0x25cb55++){if(_0x382345[_0x2548('0x6e')]<=_0x1dc3b5[_0x25cb55]['from']){_0x2b2f81[_0x2548('0x69')]=_0x1dc3b5[_0x25cb55][_0x2548('0x73')];}else if(_0x382345[_0x2548('0x6e')]>_0x1dc3b5[_0x25cb55][_0x2548('0x73')]&&_0x382345['min_internal']<=_0x1dc3b5[_0x25cb55]['to']){_0x2b2f81[_0x2548('0x69')]=_0x382345[_0x2548('0x6e')];}}}if(_[_0x2548('0x6d')](_0x2b2f81['internal'])){_0x2b2f81[_0x2548('0x69')]=_0x2b52a8+0x1;}return _0x4cac39(_0x2b2f81);});});})[_0x2548('0x5b')](function(_0xf525aa){_0x4fb720(_0xf525aa);});});}function updateUser(_0x40c8cb){return new BPromise(function(_0x117dd0,_0x4e5fbe){try{if(_0x40c8cb['voicemail']){_0x40c8cb[_0x2548('0x74')]=_0x40c8cb[_0x2548('0x69')];_0x40c8cb['VoiceMail']={'mailbox':_0x40c8cb['internal'],'password':_0x40c8cb[_0x2548('0x43')],'fullname':_0x40c8cb[_0x2548('0x75')],'email':_0x40c8cb[_0x2548('0x76')]};}if(_0x40c8cb[_0x2548('0x30')]===_0x2548('0x77')){if(!_0x40c8cb[_0x2548('0x78')])_0x40c8cb[_0x2548('0x78')]=[_0x2548('0x79'),_0x2548('0x7a'),_0x2548('0x7b'),_0x2548('0x7c'),_0x2548('0x7d'),_0x2548('0x7e'),'105',_0x2548('0x7f'),_0x2548('0x80'),_0x2548('0x81'),'109',_0x2548('0x82'),_0x2548('0x83'),'114','115'];}_0x117dd0(_0x40c8cb);}catch(_0x359c2a){_0x4e5fbe(_0x359c2a);}});}exports[_0x2548('0x84')]=function(_0x3a1511,_0x524c77){if(_0x3a1511['user'][_0x2548('0x30')]===_0x2548('0x77'))throw new Error('Unauthorized');if(_0x3a1511[_0x2548('0x64')][_0x2548('0x30')]===_0x2548('0x32')&&_0x3a1511[_0x2548('0x32')][_0x2548('0x30')]!==_0x2548('0x31')){throw new Error(_0x2548('0x85'));}if(_0x3a1511[_0x2548('0x64')][_0x2548('0x30')]==='admin'&&_0x3a1511['user']['role']!==_0x2548('0x31')){throw new Error(_0x2548('0x86'));}return licenseUtil['checkUserLimits']([_0x3a1511[_0x2548('0x64')]])[_0x2548('0x19')](function(){return validateUser(_0x3a1511[_0x2548('0x64')]);})[_0x2548('0x19')](function(_0x362dac){return updateUser(_0x362dac)[_0x2548('0x19')](function(_0x1b8c47){if(_0x1b8c47[_0x2548('0x30')]==='admin'){_0x1b8c47['settingsEnabled']=_0x3a1511['user'][_0x2548('0x87')];delete _0x1b8c47[_0x2548('0x88')];}return _0x1b8c47;});})['then'](function(_0x182bb6){return db['User'][_0x2548('0x84')](_0x182bb6,{'include':[{'model':db[_0x2548('0x89')],'as':_0x2548('0x89')}]});})[_0x2548('0x19')](function(_0x21533a){if(_0x3a1511[_0x2548('0x64')][_0x2548('0x30')]===_0x2548('0x32'))return _0x21533a;if(_0x3a1511[_0x2548('0x32')][_0x2548('0x30')]!==_0x2548('0x32'))return _0x21533a;return db['UserProfileSection']['find']({'where':{'name':_0x21533a[_0x2548('0x30')]===_0x2548('0x77')?_0x2548('0x33'):'Telephones','userProfileId':_0x3a1511['user']['userProfileId']},'raw':!![]})[_0x2548('0x19')](function(_0x50fdc7){if(!_0x50fdc7||_0x50fdc7['autoAssociation']!=0x0)return _0x21533a;return db['UserProfileResource']['create']({'name':_0x21533a[_0x2548('0x45')],'resourceId':_0x21533a['id'],'type':_0x50fdc7[_0x2548('0x45')],'sectionId':_0x50fdc7['id']},{})[_0x2548('0x19')](function(){return _0x21533a;});})['catch'](function(_0x10df1a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10df1a);throw _0x10df1a;});})[_0x2548('0x19')](respondWithResult(_0x524c77,0xc9))['catch'](handleError(_0x524c77,null));};exports[_0x2548('0x8a')]=function(_0x5aa5b4,_0x8e27ba){var _0x48c9f4=_0x5aa5b4[_0x2548('0x64')];var _0x3da68a=[];if(_0x5aa5b4[_0x2548('0x32')][_0x2548('0x30')]===_0x2548('0x77'))throw new Error('Unauthorized');if(_['some'](_0x48c9f4,[_0x2548('0x30'),_0x2548('0x32')])&&_0x5aa5b4[_0x2548('0x32')][_0x2548('0x30')]!=='admin'){throw new Error(_0x2548('0x85'));}if(_['some'](_0x48c9f4,['role','admin'])&&_0x5aa5b4[_0x2548('0x32')][_0x2548('0x30')]!=='admin'){throw new Error(_0x2548('0x8b'));}return licenseUtil[_0x2548('0x8c')](_0x48c9f4)[_0x2548('0x19')](function(){return validateUser(_0x48c9f4[0x0]);})[_0x2548('0x19')](function(){for(var _0x44fcb6=0x1;_0x44fcb6<_0x48c9f4[_0x2548('0x51')];_0x44fcb6++){var _0x3b6e86=_0x48c9f4[_0x44fcb6-0x1][_0x2548('0x69')];if(!_0x48c9f4[_0x44fcb6][_0x2548('0x69')])_0x48c9f4[_0x44fcb6][_0x2548('0x69')]=_0x3b6e86+0x1;_0x3da68a[_0x2548('0x52')](validateUser(_0x48c9f4[_0x44fcb6]));}return BPromise[_0x2548('0x5a')](_0x3da68a);})['then'](function(){_0x3da68a=[];for(var _0x581cc4=0x0;_0x581cc4<_0x48c9f4[_0x2548('0x51')];_0x581cc4++){_0x3da68a[_0x2548('0x52')](updateUser(_0x48c9f4[_0x581cc4]));}return BPromise['all'](_0x3da68a);})[_0x2548('0x19')](function(){return BPromise[_0x2548('0x8d')](_0x48c9f4,function(_0x3aa1c6){return db[_0x2548('0x3e')][_0x2548('0x84')](_0x3aa1c6,{'include':[{'model':db[_0x2548('0x89')],'as':_0x2548('0x89')}]})[_0x2548('0x19')](function(_0xf096c8){_0x3aa1c6['id']=_0xf096c8['id'];return _0x3aa1c6;});});})[_0x2548('0x19')](function(_0xad439d){if(_0x5aa5b4[_0x2548('0x64')][_0x2548('0x30')]===_0x2548('0x32'))return _0xad439d;if(_0x5aa5b4['user']['role']!==_0x2548('0x32'))return _0xad439d;var _0x5f6594=_['some'](_0xad439d,function(_0x69fa57){return _0x69fa57['role']===_0x2548('0x77')||_0x69fa57['role']===_0x2548('0x34');});if(!_0x5f6594)return _0xad439d;return db[_0x2548('0x8e')]['findAll']({'where':{'name':{'$or':[_0x2548('0x33'),_0x2548('0x8f')]},'userProfileId':_0x5aa5b4['user'][_0x2548('0x88')]},'raw':!![]})[_0x2548('0x19')](function(_0x1253dc){if(_[_0x2548('0x90')](_0x1253dc)||!_[_0x2548('0x91')](_0x1253dc,['autoAssociation',0x0]))return _0xad439d;_0x3da68a=[];var _0x5224bc=_(_0x1253dc)[_0x2548('0x40')](function(_0x5ed051){if(_0x5ed051[_0x2548('0x92')]===0x1)return;return _0x5ed051['name']===_0x2548('0x33')?_0x2548('0x77'):_0x2548('0x34');})[_0x2548('0x93')]()[_0x2548('0x37')]();for(var _0x5d2c9e=0x0;_0x5d2c9e<_0xad439d[_0x2548('0x51')];_0x5d2c9e++){if(!_[_0x2548('0x38')](_0x5224bc,_0xad439d[_0x5d2c9e][_0x2548('0x30')]))return;var _0x3e9dc5=_0xad439d[_0x5d2c9e][_0x2548('0x30')]===_0x2548('0x77')?_0x2548('0x33'):_0x2548('0x8f');_0x3da68a[_0x2548('0x52')](db[_0x2548('0x3a')][_0x2548('0x84')]({'name':_0xad439d[_0x5d2c9e][_0x2548('0x45')],'resourceId':_0xad439d[_0x5d2c9e]['id'],'type':_0x3e9dc5,'sectionId':_[_0x2548('0x39')](_0x1253dc,['name',_0x3e9dc5])['id']},{}));}return BPromise['all'](_0x3da68a);});})[_0x2548('0x19')](respondWithResult(_0x8e27ba,0xc9))[_0x2548('0x5b')](handleError(_0x8e27ba,null));};exports[_0x2548('0x94')]=function(_0x303925,_0xd9eaf1){if(_0x303925['body']['id']){delete _0x303925['body']['id'];}return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x303925[_0x2548('0x95')]['id']}})['then'](function(_0x4f68ab){if(!_0x4f68ab)return null;if(_0x4f68ab['id']===_0x303925[_0x2548('0x32')]['id']){if(!_0x303925[_0x2548('0x64')]['oldPassword']||!_0x303925[_0x2548('0x64')][_0x2548('0x96')]){throw new db['Sequelize'][(_0x2548('0x97'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x4f68ab[_0x2548('0x98')](_0x303925[_0x2548('0x64')]['oldPassword'])){throw new db[(_0x2548('0x99'))][(_0x2548('0x97'))](_0x2548('0x9a'));}if(_0x303925['body'][_0x2548('0x9b')]===_0x303925[_0x2548('0x64')][_0x2548('0x96')]){throw new db[(_0x2548('0x99'))][(_0x2548('0x97'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x303925[_0x2548('0x32')][_0x2548('0x30')]===_0x2548('0x31')){if(!_0x303925[_0x2548('0x64')][_0x2548('0x96')]){throw new db['Sequelize'][(_0x2548('0x97'))](_0x2548('0x9c'));}}else if(_0x303925['user']['role']==='user'){if(!_0x303925[_0x2548('0x64')]['newPassword']){throw new db[(_0x2548('0x99'))][(_0x2548('0x97'))](_0x2548('0x9c'));}if(_0x4f68ab[_0x2548('0x30')]!==_0x2548('0x77')){throw new db[(_0x2548('0x99'))]['ValidationError'](_0x2548('0x9d'));}}else{throw new db[(_0x2548('0x99'))][(_0x2548('0x97'))]('Unauthorized');}return _0x4f68ab;})[_0x2548('0x19')](handleEntityNotFound(_0xd9eaf1,null))[_0x2548('0x19')](function(_0x16bb71){return db[_0x2548('0x6a')][_0x2548('0x9e')]({'attributes':['id',_0x2548('0x9f'),'enforcePasswordHistory',_0x2548('0xa0')]})[_0x2548('0x19')](function(_0x22beb6){if(_0x22beb6['securePassword'])authService['validatePasswordPattern'](_0x303925[_0x2548('0x64')][_0x2548('0x96')]);if(!_0x22beb6[_0x2548('0xa1')]||!_0x16bb71[_0x2548('0xa2')])return _0x16bb71;authService[_0x2548('0xa3')](_0x303925[_0x2548('0x64')][_0x2548('0x96')],_0x16bb71['previousPasswords'],_0x22beb6[_0x2548('0xa0')]);return _0x16bb71;})['then'](saveUpdates({'password':_0x303925[_0x2548('0x64')][_0x2548('0x96')],'passwordResetAt':_0x303925['user']['id']==_0x303925['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x303925[_0x2548('0x64')]['newPassword'],_0x16bb71[_0x2548('0xa2')])},null));})[_0x2548('0x19')](respondWithResult(_0xd9eaf1,null))[_0x2548('0x5b')](handleError(_0xd9eaf1,null));};exports['addQueues']=function(_0x2af4d1,_0x414747){var _0x477ae9=_0x2af4d1[_0x2548('0x64')]['channel'];return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x2af4d1[_0x2548('0x95')]['id']},'attributes':['id',_0x2548('0x45'),_0x2548('0x30'),'online',_0x2548('0xa4'),'voicePause',_0x2548('0xa5')]})[_0x2548('0x19')](handleEntityNotFound(_0x414747,null))[_0x2548('0x19')](function(_0x5610e3){if(_0x5610e3){if(!utils[_0x2548('0xa6')](_0x477ae9)){throw new db['Sequelize'][(_0x2548('0x97'))](_0x2548('0xa7'));}return _0x5610e3[_0x2548('0xa8')+_[_0x2548('0xa9')](_0x477ae9[_0x2548('0xaa')]())+_0x2548('0xab')](_0x2af4d1[_0x2548('0x64')][_0x2548('0x67')],{'penalty':_0x2af4d1[_0x2548('0x64')][_0x2548('0xac')]||0x0})[_0x2548('0xad')](function(_0x136850){for(var _0x183362=0x0;_0x183362<_0x2af4d1[_0x2548('0x64')][_0x2548('0x67')]['length'];_0x183362+=0x1){var _0x471b35={'UserId':Number(_0x2af4d1['params']['id'])};_0x471b35[_[_0x2548('0xa9')](_0x477ae9[_0x2548('0xaa')]())+_0x2548('0xae')]=Number(_0x2af4d1[_0x2548('0x64')][_0x2548('0x67')][_0x183362]);socket[_0x2548('0x2c')](_0x2548('0x32')+_[_0x2548('0xa9')](_0x477ae9[_0x2548('0xaa')]())+_0x2548('0xaf'),_0x471b35);}return _0x136850;})['then'](function(){if(_0x477ae9==='voice'){return db[_0x2548('0xb0')]['findAll']({'where':{'id':_0x2af4d1['body'][_0x2548('0x67')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x2548('0x19')](function(_0x50ab3f){var _0x338a63=_0x5610e3['get']({'plain':!![]});var _0x5bdc5a=[];if(_0x477ae9===_0x2548('0xb1')&&_0x338a63['role']===_0x2548('0x77')&&_0x338a63[_0x2548('0xb2')]){for(var _0x2589e7=0x0;_0x2589e7<_0x50ab3f[_0x2548('0x51')];_0x2589e7+=0x1){_0x5bdc5a[_0x2548('0x52')]({'membername':_0x338a63[_0x2548('0x45')],'UserId':_0x338a63['id'],'queue_name':_0x50ab3f[_0x2589e7][_0x2548('0x45')],'VoiceQueueId':_0x50ab3f[_0x2589e7]['id'],'interface':_[_0x2548('0x6d')](_0x338a63[_0x2548('0xa5')])?util[_0x2548('0xb3')](_0x2548('0xb4'),_0x338a63[_0x2548('0x45')]):_0x338a63[_0x2548('0xa5')],'paused':_0x338a63[_0x2548('0xb5')]||![],'penalty':_0x2af4d1['body'][_0x2548('0xac')]||0x0});}return BPromise['each'](_0x5bdc5a,function(_0xa0867a){return db[_0x2548('0xb6')][_0x2548('0xb7')](_0xa0867a);});}return _0x5610e3;});}})[_0x2548('0x19')](respondWithStatusCode(_0x414747,null))[_0x2548('0x5b')](handleError(_0x414747,null));};exports[_0x2548('0xb8')]=function(_0x17b9bc,_0x27be47){var _0x331fb1,_0x4962fb;return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x17b9bc[_0x2548('0x95')]['id']},'attributes':['id','name',_0x2548('0x30')]})[_0x2548('0x19')](handleEntityNotFound(_0x27be47,null))[_0x2548('0x19')](function(_0x398d63){if(_0x398d63){_0x331fb1=_0x398d63;if(!_0x17b9bc[_0x2548('0x48')]['channel']||!utils[_0x2548('0xa6')](_0x17b9bc[_0x2548('0x48')][_0x2548('0xb9')])){throw new db['Sequelize'][(_0x2548('0x97'))](_0x2548('0xa7'));}return _0x398d63[_0x2548('0xba')+_[_0x2548('0xa9')](_0x17b9bc[_0x2548('0x48')][_0x2548('0xb9')][_0x2548('0xaa')]())+'Queues'](_0x17b9bc[_0x2548('0x48')][_0x2548('0x67')]);}})[_0x2548('0x19')](function(_0x38c8a4){if(_[_0x2548('0xbb')](_0x17b9bc['query'][_0x2548('0x67')])){for(var _0x4b6c55=0x0;_0x4b6c55<_0x17b9bc['query'][_0x2548('0x67')][_0x2548('0x51')];_0x4b6c55+=0x1){_0x4962fb={'UserId':Number(_0x17b9bc['params']['id'])};_0x4962fb[_[_0x2548('0xa9')](_0x17b9bc[_0x2548('0x48')][_0x2548('0xb9')][_0x2548('0xaa')]())+'QueueId']=Number(_0x17b9bc[_0x2548('0x48')][_0x2548('0x67')][_0x4b6c55]);socket['emit'](_0x2548('0x32')+_[_0x2548('0xa9')](_0x17b9bc['query'][_0x2548('0xb9')][_0x2548('0xaa')]())+_0x2548('0xbc'),_0x4962fb);}}else{_0x4962fb={'UserId':Number(_0x17b9bc[_0x2548('0x95')]['id'])};_0x4962fb[_['capitalize'](_0x17b9bc[_0x2548('0x48')][_0x2548('0xb9')][_0x2548('0xaa')]())+_0x2548('0xae')]=Number(_0x17b9bc[_0x2548('0x48')][_0x2548('0x67')]);socket[_0x2548('0x2c')](_0x2548('0x32')+_[_0x2548('0xa9')](_0x17b9bc[_0x2548('0x48')][_0x2548('0xb9')]['toLowerCase']())+'Queue:remove',_0x4962fb);}return _0x38c8a4;})[_0x2548('0x19')](function(){if(_0x17b9bc[_0x2548('0x48')][_0x2548('0xb9')]===_0x2548('0xb1')){return db[_0x2548('0xb6')][_0x2548('0x2e')]({'where':{'UserId':_0x17b9bc[_0x2548('0x95')]['id'],'VoiceQueueId':_0x17b9bc[_0x2548('0x48')][_0x2548('0x67')]},'individualHooks':!![]})[_0x2548('0x19')](function(){return _0x331fb1;});}return _0x331fb1;})['then'](respondWithStatusCode(_0x27be47,null))[_0x2548('0x5b')](handleError(_0x27be47,null));};exports[_0x2548('0xbd')]=function(_0x21717c,_0x306feb){_0x21717c[_0x2548('0x64')][_0x2548('0xbe')]=_0x21717c[_0x2548('0xbf')][_0x2548('0xc0')];return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x21717c[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x306feb,null))['then'](saveUpdates(_0x21717c['body'],null))[_0x2548('0x19')](respondWithResult(_0x306feb,null))[_0x2548('0x5b')](handleError(_0x306feb,null));};exports[_0x2548('0xc1')]=function(_0x104c95,_0x57ba46){var _0x3114fc=path[_0x2548('0xc2')](config[_0x2548('0xc3')],'server/files/images/logos/default_profile.png');return db[_0x2548('0x3e')]['find']({'where':{'id':_0x104c95[_0x2548('0x95')]['id']},'attributes':['id',_0x2548('0xbe')],'raw':!![]})[_0x2548('0x19')](handleEntityNotFound(_0x57ba46,null))[_0x2548('0x19')](function(_0x1b75a4){if(_0x1b75a4){if(_['isNil'](_0x1b75a4[_0x2548('0xbe')])){return _0x57ba46[_0x2548('0xc4')](_0x3114fc);}else{if(!fs[_0x2548('0xc5')](path['join'](config[_0x2548('0xc3')],_0x2548('0xc6'),_0x1b75a4[_0x2548('0xbe')]))){return _0x57ba46[_0x2548('0xc4')](_0x3114fc);}return _0x57ba46[_0x2548('0xc4')](path[_0x2548('0xc2')](config['root'],_0x2548('0xc6'),_0x1b75a4[_0x2548('0xbe')]));}}})[_0x2548('0x5b')](handleError(_0x57ba46,null));};exports['getOpenTabs']=function(_0x4fe9ad,_0x505a28){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x4fe9ad[_0x2548('0x95')]['id']},'attributes':['id']})[_0x2548('0x19')](handleEntityNotFound(_0x505a28,null))['then'](function(_0x151959){var _0x3e75bd=[];values=_0x151959['dataValues'];_0x3e75bd[_0x2548('0x52')](get_open_tabs('chat',_0x151959[_0x2548('0x54')]));_0x3e75bd['push'](get_open_tabs(_0x2548('0x55'),_0x151959[_0x2548('0x54')]));_0x3e75bd[_0x2548('0x52')](get_open_tabs(_0x2548('0x58'),_0x151959[_0x2548('0x54')]));_0x3e75bd[_0x2548('0x52')](get_open_tabs(_0x2548('0x59'),_0x151959[_0x2548('0x54')]));_0x3e75bd['push'](get_open_tabs('fax',_0x151959[_0x2548('0x54')]));_0x3e75bd['push'](get_open_tabs(_0x2548('0x57'),_0x151959[_0x2548('0x54')]));return BPromise[_0x2548('0x5a')](_0x3e75bd);})[_0x2548('0x19')](function(_0x160833){if(_0x160833){var _0x52eec7=_[_0x2548('0x40')](values['ChatOpenTabs'],function(_0x30416a){return{'channel':_0x2548('0xc7'),'id':_0x30416a['id'],'createdAt':_0x30416a[_0x2548('0xc8')]};});var _0x12bc11=_[_0x2548('0x40')](values['FaxOpenTabs'],function(_0x465674){return{'channel':_0x2548('0xc9'),'id':_0x465674['id'],'createdAt':_0x465674['createdAt']};});var _0x4a97b7=_[_0x2548('0x40')](values[_0x2548('0xca')],function(_0xcf7ce4){return{'channel':_0x2548('0xcb'),'id':_0xcf7ce4['id'],'createdAt':_0xcf7ce4[_0x2548('0xc8')]};});var _0x1086ba=_[_0x2548('0x40')](values[_0x2548('0xcc')],function(_0x598e42){return{'channel':_0x2548('0xcd'),'id':_0x598e42['id'],'createdAt':_0x598e42[_0x2548('0xc8')]};});var _0x9ed30a=_[_0x2548('0x40')](values[_0x2548('0xce')],function(_0x394ba8){return{'channel':'SMS','id':_0x394ba8['id'],'createdAt':_0x394ba8[_0x2548('0xc8')]};});var _0xf86dc7=_['map'](values[_0x2548('0xcf')],function(_0x5072b1){return{'channel':_0x2548('0xd0'),'id':_0x5072b1['id'],'createdAt':_0x5072b1[_0x2548('0xc8')]};});var _0x4abe45=_['concat'](_0x52eec7,_0x12bc11,_0x4a97b7,_0x1086ba,_0x9ed30a,_0xf86dc7);var _0x3fe63e={'count':_0x4abe45[_0x2548('0x51')],'rows':_0x4abe45};return _0x3fe63e;}else return null;})[_0x2548('0x19')](respondWithResult(_0x505a28,null))[_0x2548('0x5b')](handleError(_0x505a28,null));};exports[_0x2548('0xd1')]=function(_0x325622,_0x389cc3){var _0x32e546={};var _0x41d318={};var _0x21f380;var _0x55b539;return db[_0x2548('0x3e')][_0x2548('0x9e')]({'where':{'id':_0x325622['params']['id']}})['then'](handleEntityNotFound(_0x389cc3,null))[_0x2548('0x19')](function(_0x3fa241){if(_0x3fa241){_0x21f380=_0x3fa241;_0x41d318['model']=_[_0x2548('0x5e')](db[_0x2548('0xd2')][_0x2548('0x3f')]);_0x41d318[_0x2548('0x48')]=_[_0x2548('0x5e')](_0x325622['query']);_0x41d318[_0x2548('0x5f')]=_[_0x2548('0x60')](_0x41d318[_0x2548('0x5d')],_0x41d318[_0x2548('0x48')]);_0x32e546[_0x2548('0x4d')]=_['intersection'](_0x41d318[_0x2548('0x5d')],qs['fields'](_0x325622[_0x2548('0x48')]['fields']));_0x32e546[_0x2548('0x4d')]=_0x32e546[_0x2548('0x4d')][_0x2548('0x51')]?_0x32e546[_0x2548('0x4d')]:_0x41d318['model'];_0x32e546[_0x2548('0xd3')]=qs['sort'](_0x325622[_0x2548('0x48')][_0x2548('0xd4')]);_0x32e546['where']=qs[_0x2548('0x5f')](_[_0x2548('0xd5')](_0x325622[_0x2548('0x48')],_0x41d318[_0x2548('0x5f')]));if(_0x325622[_0x2548('0x48')][_0x2548('0x35')]){_0x32e546[_0x2548('0x47')]=_[_0x2548('0x62')](_0x32e546[_0x2548('0x47')],{'$or':_['map'](_0x32e546[_0x2548('0x4d')],function(_0xe9da6a){var _0x4fe30d={};_0x4fe30d[_0xe9da6a]={'$like':'%'+_0x325622[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x4fe30d;})});}_0x32e546=_['merge']({},_0x32e546,_0x325622['options']);return _0x21f380[_0x2548('0xd1')](_0x32e546);}})[_0x2548('0x19')](function(_0x475f3c){if(_0x475f3c){_0x55b539=_0x475f3c['length'];if(_0x325622['query']['hasOwnProperty'](_0x2548('0x49'))){_0x32e546[_0x2548('0x4a')]=[{'model':db[_0x2548('0xd6')],'as':_0x2548('0xd7'),'required':![]},{'model':db[_0x2548('0xd8')],'as':'Tags','attributes':['id',_0x2548('0x45'),_0x2548('0xd9')],'where':_0x325622[_0x2548('0x48')]['tag']?{'id':_0x325622[_0x2548('0x48')][_0x2548('0xda')]}:undefined,'required':_0x325622[_0x2548('0x48')][_0x2548('0xda')]?!![]:![]}];}if(!_0x325622[_0x2548('0x48')][_0x2548('0xdb')](_0x2548('0xdc'))){_0x32e546[_0x2548('0x26')]=qs[_0x2548('0x26')](_0x325622['query']['limit']);_0x32e546[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x325622[_0x2548('0x48')][_0x2548('0x25')]);}return _0x21f380[_0x2548('0xd1')](_0x32e546);}})['then'](function(_0x52ad57){if(_0x52ad57){return _0x52ad57?{'count':_0x55b539,'rows':_0x52ad57}:null;}})[_0x2548('0x19')](respondWithResult(_0x389cc3,null))['catch'](handleError(_0x389cc3,null));};exports[_0x2548('0xdd')]=function(_0x2a707e,_0x3bf761){var _0x4d3870;var _0x597aeb={};var _0x2f172b;return db[_0x2548('0x3e')][_0x2548('0x9e')]({'where':{'id':_0x2a707e[_0x2548('0x95')]['id']},'attributes':['id','name',_0x2548('0x30')]})[_0x2548('0x19')](handleEntityNotFound(_0x3bf761,null))[_0x2548('0x19')](function(_0x2ca517){if(!utils[_0x2548('0xa6')](_0x2a707e[_0x2548('0x48')][_0x2548('0xb9')])){throw new db['Sequelize'][(_0x2548('0x97'))](_0x2548('0xa7'));}_0x4d3870=_0x2ca517;var _0x3ff9fa={};_0x3ff9fa[_0x2548('0x5d')]=_[_0x2548('0x5e')](db[_[_0x2548('0xa9')](_0x2a707e[_0x2548('0x48')][_0x2548('0xb9')])+_0x2548('0xde')][_0x2548('0x3f')]);_0x3ff9fa['query']=_[_0x2548('0x5e')](_0x2a707e[_0x2548('0x48')]);_0x3ff9fa[_0x2548('0x5f')]=_[_0x2548('0x60')](_0x3ff9fa[_0x2548('0x5d')],_0x3ff9fa[_0x2548('0x48')]);_0x597aeb[_0x2548('0x4d')]=_[_0x2548('0x60')](_0x3ff9fa['model'],qs[_0x2548('0x61')](_0x2a707e[_0x2548('0x48')][_0x2548('0x61')]));_0x597aeb[_0x2548('0x4d')]=_0x597aeb[_0x2548('0x4d')][_0x2548('0x51')]?_0x597aeb[_0x2548('0x4d')]:_0x3ff9fa[_0x2548('0x5d')];_0x597aeb['order']=qs[_0x2548('0xd4')](_0x2a707e[_0x2548('0x48')][_0x2548('0xd4')]);_0x597aeb[_0x2548('0x47')]=qs['filters'](_['pick'](_0x2a707e[_0x2548('0x48')],_0x3ff9fa['filters']));if(_0x2a707e[_0x2548('0x48')][_0x2548('0x35')]){_0x597aeb['where']=_[_0x2548('0x62')](_0x597aeb[_0x2548('0x47')],{'$or':_[_0x2548('0x40')](_0x597aeb['attributes'],function(_0x4a4686){var _0x4a2380={};_0x4a2380[_0x4a4686]={'$like':'%'+_0x2a707e[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x4a2380;})});}_0x597aeb=_[_0x2548('0x62')]({},_0x597aeb,_0x2a707e['options']);switch(_0x4d3870[_0x2548('0x30')]){case _0x2548('0x31'):return db[_[_0x2548('0xa9')](_0x2a707e[_0x2548('0x48')][_0x2548('0xb9')])+_0x2548('0xde')][_0x2548('0x4e')](_0x597aeb);case'user':case'agent':return _0x4d3870[_0x2548('0x2f')+_[_0x2548('0xa9')](_0x2a707e[_0x2548('0x48')]['channel'])+_0x2548('0xab')](_0x597aeb);default:throw new db[(_0x2548('0x99'))][(_0x2548('0x97'))]('Unknown\x20role');}})[_0x2548('0x19')](function(_0x14755e){_0x2f172b=_0x14755e[_0x2548('0x51')];if(!_0x2a707e[_0x2548('0x48')][_0x2548('0xdb')]('nolimit')){_0x597aeb[_0x2548('0x26')]=qs[_0x2548('0x26')](_0x2a707e[_0x2548('0x48')][_0x2548('0x26')]);_0x597aeb[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x2a707e[_0x2548('0x48')]['offset']);}switch(_0x4d3870[_0x2548('0x30')]){case _0x2548('0x31'):return db[_[_0x2548('0xa9')](_0x2a707e[_0x2548('0x48')][_0x2548('0xb9')])+_0x2548('0xde')]['findAll'](_0x597aeb);case _0x2548('0x32'):case _0x2548('0x77'):return _0x4d3870['get'+_[_0x2548('0xa9')](_0x2a707e['query'][_0x2548('0xb9')])+_0x2548('0xab')](_0x597aeb);}})['then'](function(_0x3e10ba){return{'count':_0x2f172b,'rows':_0x3e10ba};})[_0x2548('0x19')](respondWithResult(_0x3bf761,null))[_0x2548('0x5b')](handleError(_0x3bf761,null));};exports[_0x2548('0xdf')]=function(_0x247893,_0x3b86aa){var _0x592729={};var _0x1a8ae8={};var _0x4e0845;var _0x6681a8;return db[_0x2548('0x3e')][_0x2548('0x9e')]({'where':{'id':_0x247893['params']['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x3b86aa,null))[_0x2548('0x19')](function(_0x3e49b1){if(_0x3e49b1){_0x4e0845=_0x3e49b1;_0x1a8ae8['model']=_[_0x2548('0x5e')](db[_0x2548('0xb6')][_0x2548('0x3f')]);_0x1a8ae8[_0x2548('0x48')]=_['keys'](_0x247893[_0x2548('0x48')]);_0x1a8ae8['filters']=_[_0x2548('0x60')](_0x1a8ae8['model'],_0x1a8ae8['query']);_0x592729[_0x2548('0x4d')]=_['intersection'](_0x1a8ae8['model'],qs[_0x2548('0x61')](_0x247893[_0x2548('0x48')][_0x2548('0x61')]));_0x592729[_0x2548('0x4d')]=_0x592729[_0x2548('0x4d')][_0x2548('0x51')]?_0x592729['attributes']:_0x1a8ae8[_0x2548('0x5d')];_0x592729[_0x2548('0xd3')]=qs[_0x2548('0xd4')](_0x247893[_0x2548('0x48')][_0x2548('0xd4')]);_0x592729[_0x2548('0x47')]=qs['filters'](_[_0x2548('0xd5')](_0x247893['query'],_0x1a8ae8[_0x2548('0x5f')]));if(_0x247893[_0x2548('0x48')][_0x2548('0x35')]){_0x592729[_0x2548('0x47')]=_[_0x2548('0x62')](_0x592729[_0x2548('0x47')],{'$or':_[_0x2548('0x40')](_0x592729[_0x2548('0x4d')],function(_0x4f874b){var _0x17d2d9={};_0x17d2d9[_0x4f874b]={'$like':'%'+_0x247893['query'][_0x2548('0x35')]+'%'};return _0x17d2d9;})});}_0x592729=_[_0x2548('0x62')]({},_0x592729,_0x247893[_0x2548('0x63')]);return _0x4e0845['getVoiceQueuesRt'](_0x592729);}})[_0x2548('0x19')](function(_0x5ecb91){if(_0x5ecb91){_0x6681a8=_0x5ecb91[_0x2548('0x51')];if(!_0x247893[_0x2548('0x48')]['hasOwnProperty'](_0x2548('0xdc'))){_0x592729[_0x2548('0x26')]=qs['limit'](_0x247893[_0x2548('0x48')][_0x2548('0x26')]);_0x592729[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x247893['query'][_0x2548('0x25')]);}return _0x4e0845['getVoiceQueuesRt'](_0x592729);}})[_0x2548('0x19')](function(_0x3d55ea){if(_0x3d55ea){return _0x3d55ea?{'count':_0x6681a8,'rows':_0x3d55ea}:null;}})[_0x2548('0x19')](respondWithResult(_0x3b86aa,null))[_0x2548('0x5b')](handleError(_0x3b86aa,null));};exports['getGroups']=function(_0x33e155,_0x507ebf){var _0x2c9e6d={};var _0x142ef2={};var _0x5271b1;var _0x44415a;return db[_0x2548('0x3e')]['findOne']({'where':{'id':_0x33e155['params']['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x507ebf,null))[_0x2548('0x19')](function(_0x1d7656){if(_0x1d7656){_0x5271b1=_0x1d7656;_0x142ef2[_0x2548('0x5d')]=_[_0x2548('0x5e')](db[_0x2548('0xe0')]['rawAttributes']);_0x142ef2[_0x2548('0x48')]=_[_0x2548('0x5e')](_0x33e155[_0x2548('0x48')]);_0x142ef2[_0x2548('0x5f')]=_['intersection'](_0x142ef2['model'],_0x142ef2['query']);_0x2c9e6d[_0x2548('0x4d')]=_[_0x2548('0x60')](_0x142ef2[_0x2548('0x5d')],qs['fields'](_0x33e155[_0x2548('0x48')][_0x2548('0x61')]));_0x2c9e6d[_0x2548('0x4d')]=_0x2c9e6d[_0x2548('0x4d')][_0x2548('0x51')]?_0x2c9e6d[_0x2548('0x4d')]:_0x142ef2[_0x2548('0x5d')];_0x2c9e6d[_0x2548('0xd3')]=qs[_0x2548('0xd4')](_0x33e155[_0x2548('0x48')]['sort']);_0x2c9e6d[_0x2548('0x47')]=qs[_0x2548('0x5f')](_[_0x2548('0xd5')](_0x33e155[_0x2548('0x48')],_0x142ef2[_0x2548('0x5f')]));if(_0x33e155[_0x2548('0x48')]['filter']){_0x2c9e6d[_0x2548('0x47')]=_[_0x2548('0x62')](_0x2c9e6d['where'],{'$or':_['map'](_0x2c9e6d[_0x2548('0x4d')],function(_0x2406d7){var _0x37cb0a={};_0x37cb0a[_0x2406d7]={'$like':'%'+_0x33e155[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x37cb0a;})});}_0x2c9e6d=_[_0x2548('0x62')]({},_0x2c9e6d,_0x33e155[_0x2548('0x63')]);return _0x5271b1[_0x2548('0xe1')](_0x2c9e6d);}})['then'](function(_0x48812c){if(_0x48812c){_0x44415a=_0x48812c[_0x2548('0x51')];if(!_0x33e155[_0x2548('0x48')]['hasOwnProperty'](_0x2548('0xdc'))){_0x2c9e6d['limit']=qs[_0x2548('0x26')](_0x33e155[_0x2548('0x48')]['limit']);_0x2c9e6d[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x33e155[_0x2548('0x48')][_0x2548('0x25')]);}return _0x5271b1[_0x2548('0xe1')](_0x2c9e6d);}})['then'](function(_0x2d2559){if(_0x2d2559){return _0x2d2559?{'count':_0x44415a,'rows':_0x2d2559}:null;}})[_0x2548('0x19')](respondWithResult(_0x507ebf,null))[_0x2548('0x5b')](handleError(_0x507ebf,null));};exports['getRecordings']=function(_0x317a18,_0x3be770){var _0x32e95a={'raw':!![],'where':{}};var _0x9235ee={};var _0x45f64b={'count':0x0,'rows':[]};return db['User'][_0x2548('0x9e')]({'where':{'id':_0x317a18[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x3be770,null))[_0x2548('0x19')](function(_0x6ebe14){if(_0x6ebe14){_0x9235ee[_0x2548('0x5d')]=_[_0x2548('0x5e')](db['VoiceRecording']['rawAttributes']);_0x9235ee['query']=_[_0x2548('0x5e')](_0x317a18['query']);_0x9235ee[_0x2548('0x5f')]=_[_0x2548('0x60')](_0x9235ee['model'],_0x9235ee[_0x2548('0x48')]);_0x32e95a[_0x2548('0x4d')]=_[_0x2548('0x60')](_0x9235ee[_0x2548('0x5d')],qs[_0x2548('0x61')](_0x317a18['query'][_0x2548('0x61')]));_0x32e95a[_0x2548('0x4d')]=_0x32e95a[_0x2548('0x4d')][_0x2548('0x51')]?_0x32e95a[_0x2548('0x4d')]:_0x9235ee[_0x2548('0x5d')];if(!_0x317a18[_0x2548('0x48')][_0x2548('0xdb')]('nolimit')){_0x32e95a[_0x2548('0x26')]=qs['limit'](_0x317a18['query'][_0x2548('0x26')]);_0x32e95a[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x317a18['query'][_0x2548('0x25')]);}_0x32e95a['order']=qs[_0x2548('0xd4')](_0x317a18[_0x2548('0x48')][_0x2548('0xd4')]);_0x32e95a[_0x2548('0x47')]=qs[_0x2548('0x5f')](_[_0x2548('0xd5')](_0x317a18[_0x2548('0x48')],_0x9235ee['filters']));_0x32e95a[_0x2548('0x47')][_0x2548('0xe2')]=_0x6ebe14['id'];if(_0x317a18[_0x2548('0x48')]['filter']){_0x32e95a[_0x2548('0x47')]=_[_0x2548('0x62')](_0x32e95a['where'],{'$or':_['map'](_0x32e95a[_0x2548('0x4d')],function(_0x59588a){var _0x5b0cfe={};_0x5b0cfe[_0x59588a]={'$like':'%'+_0x317a18[_0x2548('0x48')]['filter']+'%'};return _0x5b0cfe;})});}_0x32e95a=_['merge']({},_0x32e95a,_0x317a18['options']);return db[_0x2548('0xe3')][_0x2548('0x28')]({'where':_0x32e95a[_0x2548('0x47')]})[_0x2548('0x19')](function(_0x234e05){_0x45f64b['count']=_0x234e05;if(_0x317a18[_0x2548('0x48')][_0x2548('0x49')]){_0x32e95a[_0x2548('0x4a')]=[{'all':!![]}];}return db['VoiceRecording'][_0x2548('0x4e')](_0x32e95a);})[_0x2548('0x19')](function(_0x45a734){_0x45f64b[_0x2548('0x4f')]=_0x45a734;return _0x45f64b;});}})[_0x2548('0x19')](respondWithFilteredResult(_0x3be770,_0x32e95a))[_0x2548('0x5b')](handleError(_0x3be770,null));};exports[_0x2548('0xe4')]=function(_0x21dc21,_0x24e6b9){var _0x308f2b={'raw':!![],'where':{}};var _0x2e7f3b={};var _0x490b69={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x21dc21[_0x2548('0x95')]['id']}})['then'](handleEntityNotFound(_0x24e6b9,null))['then'](function(_0x23705e){if(_0x23705e){_0x2e7f3b[_0x2548('0x5d')]=_[_0x2548('0x5e')](db[_0x2548('0xe5')]['rawAttributes']);_0x2e7f3b[_0x2548('0x48')]=_[_0x2548('0x5e')](_0x21dc21[_0x2548('0x48')]);_0x2e7f3b[_0x2548('0x5f')]=_[_0x2548('0x60')](_0x2e7f3b['model'],_0x2e7f3b[_0x2548('0x48')]);_0x308f2b[_0x2548('0x4d')]=_['intersection'](_0x2e7f3b['model'],qs[_0x2548('0x61')](_0x21dc21[_0x2548('0x48')][_0x2548('0x61')]));_0x308f2b[_0x2548('0x4d')]=_0x308f2b[_0x2548('0x4d')][_0x2548('0x51')]?_0x308f2b['attributes']:_0x2e7f3b[_0x2548('0x5d')];if(!_0x21dc21[_0x2548('0x48')]['hasOwnProperty']('nolimit')){_0x308f2b['limit']=qs[_0x2548('0x26')](_0x21dc21[_0x2548('0x48')][_0x2548('0x26')]);_0x308f2b[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x21dc21['query'][_0x2548('0x25')]);}_0x308f2b[_0x2548('0xd3')]=qs[_0x2548('0xd4')](_0x21dc21['query']['sort']);_0x308f2b[_0x2548('0x47')]=qs[_0x2548('0x5f')](_[_0x2548('0xd5')](_0x21dc21[_0x2548('0x48')],_0x2e7f3b['filters']));_0x308f2b[_0x2548('0x47')][_0x2548('0xe2')]=_0x23705e['id'];if(_0x21dc21[_0x2548('0x48')][_0x2548('0x35')]){_0x308f2b[_0x2548('0x47')]=_[_0x2548('0x62')](_0x308f2b[_0x2548('0x47')],{'$or':_['map'](_0x308f2b['attributes'],function(_0x351813){var _0x237f67={};_0x237f67[_0x351813]={'$like':'%'+_0x21dc21[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x237f67;})});}_0x308f2b=_[_0x2548('0x62')]({},_0x308f2b,_0x21dc21[_0x2548('0x63')]);return db[_0x2548('0xe5')]['count']({'where':_0x308f2b[_0x2548('0x47')]})['then'](function(_0x15e400){_0x490b69['count']=_0x15e400;if(_0x21dc21[_0x2548('0x48')]['includeAll']){_0x308f2b['include']=[{'all':!![]}];}return db[_0x2548('0xe5')][_0x2548('0x4e')](_0x308f2b);})[_0x2548('0x19')](function(_0x13f1a6){_0x490b69[_0x2548('0x4f')]=_0x13f1a6;return _0x490b69;});}})['then'](respondWithFilteredResult(_0x24e6b9,_0x308f2b))[_0x2548('0x5b')](handleError(_0x24e6b9,null));};exports[_0x2548('0xe6')]=function(_0x43a503,_0x9c910b){var _0x48f96e={};var _0x446bb8={};var _0x16ced6;var _0x4be645;return db[_0x2548('0x3e')][_0x2548('0x9e')]({'where':{'id':_0x43a503[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x9c910b,null))[_0x2548('0x19')](function(_0x22408f){if(_0x22408f){_0x16ced6=_0x22408f;_0x446bb8[_0x2548('0x5d')]=_[_0x2548('0x5e')](db[_0x2548('0xe7')][_0x2548('0x3f')]);_0x446bb8[_0x2548('0x48')]=_[_0x2548('0x5e')](_0x43a503[_0x2548('0x48')]);_0x446bb8[_0x2548('0x5f')]=_['intersection'](_0x446bb8['model'],_0x446bb8[_0x2548('0x48')]);_0x48f96e[_0x2548('0x4d')]=_['intersection'](_0x446bb8['model'],qs[_0x2548('0x61')](_0x43a503[_0x2548('0x48')][_0x2548('0x61')]));_0x48f96e['attributes']=_0x48f96e[_0x2548('0x4d')][_0x2548('0x51')]?_0x48f96e[_0x2548('0x4d')]:_0x446bb8[_0x2548('0x5d')];_0x48f96e['order']=qs['sort'](_0x43a503[_0x2548('0x48')][_0x2548('0xd4')]);_0x48f96e[_0x2548('0x47')]=qs[_0x2548('0x5f')](_[_0x2548('0xd5')](_0x43a503[_0x2548('0x48')],_0x446bb8[_0x2548('0x5f')]));if(_0x43a503[_0x2548('0x48')][_0x2548('0x35')]){_0x48f96e[_0x2548('0x47')]=_['merge'](_0x48f96e['where'],{'$or':_[_0x2548('0x40')](_0x48f96e[_0x2548('0x4d')],function(_0x154dc9){var _0x183bf0={};_0x183bf0[_0x154dc9]={'$like':'%'+_0x43a503['query']['filter']+'%'};return _0x183bf0;})});}_0x48f96e=_[_0x2548('0x62')]({},_0x48f96e,_0x43a503['options']);return _0x16ced6[_0x2548('0xe6')](_0x48f96e);}})[_0x2548('0x19')](function(_0x532de2){if(_0x532de2){_0x4be645=_0x532de2[_0x2548('0x51')];if(!_0x43a503[_0x2548('0x48')]['hasOwnProperty']('nolimit')){_0x48f96e[_0x2548('0x26')]=qs[_0x2548('0x26')](_0x43a503[_0x2548('0x48')][_0x2548('0x26')]);_0x48f96e['offset']=qs[_0x2548('0x25')](_0x43a503['query'][_0x2548('0x25')]);}return _0x16ced6[_0x2548('0xe6')](_0x48f96e);}})[_0x2548('0x19')](function(_0x130c54){if(_0x130c54){return _0x130c54?{'count':_0x4be645,'rows':_0x130c54}:null;}})['then'](respondWithResult(_0x9c910b,null))[_0x2548('0x5b')](handleError(_0x9c910b,null));};exports['getOpenchannelInteractions']=function(_0x20b6e2,_0x34922f){var _0x36d967={};var _0x128c71={};var _0xfcf41a;var _0x49c1e7;return db[_0x2548('0x3e')][_0x2548('0x9e')]({'where':{'id':_0x20b6e2['params']['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x34922f,null))[_0x2548('0x19')](function(_0x19a4dc){if(_0x19a4dc){_0xfcf41a=_0x19a4dc;_0x128c71['model']=_[_0x2548('0x5e')](db[_0x2548('0xe8')][_0x2548('0x3f')]);_0x128c71['query']=_[_0x2548('0x5e')](_0x20b6e2['query']);_0x128c71[_0x2548('0x5f')]=_[_0x2548('0x60')](_0x128c71['model'],_0x128c71[_0x2548('0x48')]);_0x36d967[_0x2548('0x4d')]=_['intersection'](_0x128c71[_0x2548('0x5d')],qs[_0x2548('0x61')](_0x20b6e2[_0x2548('0x48')][_0x2548('0x61')]));_0x36d967[_0x2548('0x4d')]=_0x36d967['attributes'][_0x2548('0x51')]?_0x36d967[_0x2548('0x4d')]:_0x128c71[_0x2548('0x5d')];_0x36d967[_0x2548('0xd3')]=qs[_0x2548('0xd4')](_0x20b6e2[_0x2548('0x48')]['sort']);_0x36d967[_0x2548('0x47')]=qs[_0x2548('0x5f')](_['pick'](_0x20b6e2['query'],_0x128c71[_0x2548('0x5f')]));if(_0x20b6e2['query']['filter']){_0x36d967[_0x2548('0x47')]=_[_0x2548('0x62')](_0x36d967[_0x2548('0x47')],{'$or':_[_0x2548('0x40')](_0x36d967[_0x2548('0x4d')],function(_0x5935ec){var _0x1278f0={};_0x1278f0[_0x5935ec]={'$like':'%'+_0x20b6e2[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x1278f0;})});}_0x36d967=_[_0x2548('0x62')]({},_0x36d967,_0x20b6e2[_0x2548('0x63')]);return _0xfcf41a[_0x2548('0xe9')](_0x36d967);}})['then'](function(_0x29be08){if(_0x29be08){_0x49c1e7=_0x29be08[_0x2548('0x51')];if(!_0x20b6e2[_0x2548('0x48')][_0x2548('0xdb')](_0x2548('0xdc'))){_0x36d967[_0x2548('0x26')]=qs[_0x2548('0x26')](_0x20b6e2['query'][_0x2548('0x26')]);_0x36d967[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x20b6e2[_0x2548('0x48')][_0x2548('0x25')]);}return _0xfcf41a[_0x2548('0xe9')](_0x36d967);}})['then'](function(_0x2554ab){if(_0x2554ab){return _0x2554ab?{'count':_0x49c1e7,'rows':_0x2554ab}:null;}})[_0x2548('0x19')](respondWithResult(_0x34922f,null))[_0x2548('0x5b')](handleError(_0x34922f,null));};exports[_0x2548('0xea')]=function(_0xbe2c9b,_0x1a0b44){var _0x4a89dc={'raw':!![],'where':{}};var _0x246268={};var _0xccb930={'count':0x0,'rows':[]};return db['User'][_0x2548('0x9e')]({'where':{'id':_0xbe2c9b[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x1a0b44,null))['then'](function(_0x2519b7){if(_0x2519b7){_0x246268[_0x2548('0x5d')]=_[_0x2548('0x5e')](db['MailInteraction'][_0x2548('0x3f')]);_0x246268[_0x2548('0x48')]=_[_0x2548('0x5e')](_0xbe2c9b['query']);_0x246268[_0x2548('0x5f')]=_['intersection'](_0x246268[_0x2548('0x5d')],_0x246268['query']);_0x4a89dc[_0x2548('0x4d')]=_[_0x2548('0x60')](_0x246268[_0x2548('0x5d')],qs[_0x2548('0x61')](_0xbe2c9b['query']['fields']));_0x4a89dc[_0x2548('0x4d')]=_0x4a89dc[_0x2548('0x4d')][_0x2548('0x51')]?_0x4a89dc[_0x2548('0x4d')]:_0x246268[_0x2548('0x5d')];if(!_0xbe2c9b[_0x2548('0x48')][_0x2548('0xdb')](_0x2548('0xdc'))){_0x4a89dc[_0x2548('0x26')]=qs[_0x2548('0x26')](_0xbe2c9b[_0x2548('0x48')][_0x2548('0x26')]);_0x4a89dc[_0x2548('0x25')]=qs[_0x2548('0x25')](_0xbe2c9b[_0x2548('0x48')][_0x2548('0x25')]);}_0x4a89dc[_0x2548('0xd3')]=qs['sort'](_0xbe2c9b['query'][_0x2548('0xd4')]);_0x4a89dc[_0x2548('0x47')]=qs[_0x2548('0x5f')](_[_0x2548('0xd5')](_0xbe2c9b[_0x2548('0x48')],_0x246268['filters']));_0x4a89dc[_0x2548('0x47')][_0x2548('0xe2')]=_0x2519b7['id'];if(_0xbe2c9b[_0x2548('0x48')][_0x2548('0x35')]){_0x4a89dc[_0x2548('0x47')]=_[_0x2548('0x62')](_0x4a89dc[_0x2548('0x47')],{'$or':_[_0x2548('0x40')](_0x4a89dc[_0x2548('0x4d')],function(_0x381b3d){var _0x49fb5e={};_0x49fb5e[_0x381b3d]={'$like':'%'+_0xbe2c9b[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x49fb5e;})});}_0x4a89dc=_[_0x2548('0x62')]({},_0x4a89dc,_0xbe2c9b[_0x2548('0x63')]);return db[_0x2548('0xeb')][_0x2548('0x28')]({'where':_0x4a89dc[_0x2548('0x47')]})['then'](function(_0x58bd7a){_0xccb930['count']=_0x58bd7a;if(_0xbe2c9b['query'][_0x2548('0x49')]){_0x4a89dc[_0x2548('0x4a')]=[{'all':!![]}];}return db['MailInteraction'][_0x2548('0x4e')](_0x4a89dc);})[_0x2548('0x19')](function(_0x1384fd){_0xccb930[_0x2548('0x4f')]=_0x1384fd;return _0xccb930;});}})[_0x2548('0x19')](respondWithFilteredResult(_0x1a0b44,_0x4a89dc))[_0x2548('0x5b')](handleError(_0x1a0b44,null));};exports['getSmsInteractions']=function(_0x1c7941,_0x473e77){var _0xaa693e={};var _0x1cfc70={};var _0x3f413d;var _0x4aaab1;return db[_0x2548('0x3e')]['findOne']({'where':{'id':_0x1c7941[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x473e77,null))['then'](function(_0x5b5702){if(_0x5b5702){_0x3f413d=_0x5b5702;_0x1cfc70[_0x2548('0x5d')]=_['keys'](db[_0x2548('0xec')][_0x2548('0x3f')]);_0x1cfc70['query']=_[_0x2548('0x5e')](_0x1c7941['query']);_0x1cfc70['filters']=_[_0x2548('0x60')](_0x1cfc70['model'],_0x1cfc70[_0x2548('0x48')]);_0xaa693e[_0x2548('0x4d')]=_[_0x2548('0x60')](_0x1cfc70[_0x2548('0x5d')],qs[_0x2548('0x61')](_0x1c7941[_0x2548('0x48')][_0x2548('0x61')]));_0xaa693e[_0x2548('0x4d')]=_0xaa693e[_0x2548('0x4d')][_0x2548('0x51')]?_0xaa693e[_0x2548('0x4d')]:_0x1cfc70[_0x2548('0x5d')];_0xaa693e[_0x2548('0xd3')]=qs['sort'](_0x1c7941['query']['sort']);_0xaa693e[_0x2548('0x47')]=qs[_0x2548('0x5f')](_[_0x2548('0xd5')](_0x1c7941['query'],_0x1cfc70['filters']));if(_0x1c7941['query'][_0x2548('0x35')]){_0xaa693e[_0x2548('0x47')]=_['merge'](_0xaa693e[_0x2548('0x47')],{'$or':_[_0x2548('0x40')](_0xaa693e[_0x2548('0x4d')],function(_0x51ddfe){var _0x474b2={};_0x474b2[_0x51ddfe]={'$like':'%'+_0x1c7941[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x474b2;})});}_0xaa693e=_[_0x2548('0x62')]({},_0xaa693e,_0x1c7941[_0x2548('0x63')]);return _0x3f413d['getSmsInteractions'](_0xaa693e);}})[_0x2548('0x19')](function(_0x22f4e3){if(_0x22f4e3){_0x4aaab1=_0x22f4e3[_0x2548('0x51')];if(!_0x1c7941[_0x2548('0x48')][_0x2548('0xdb')](_0x2548('0xdc'))){_0xaa693e[_0x2548('0x26')]=qs[_0x2548('0x26')](_0x1c7941[_0x2548('0x48')][_0x2548('0x26')]);_0xaa693e[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x1c7941[_0x2548('0x48')][_0x2548('0x25')]);}return _0x3f413d[_0x2548('0xed')](_0xaa693e);}})[_0x2548('0x19')](function(_0x14b041){if(_0x14b041){return _0x14b041?{'count':_0x4aaab1,'rows':_0x14b041}:null;}})['then'](respondWithResult(_0x473e77,null))['catch'](handleError(_0x473e77,null));};exports[_0x2548('0xee')]=function(_0x5381a1,_0x56281d){var _0x26bfb2={};var _0x56c071={};var _0x3a1c14;var _0x6eb995;return db[_0x2548('0x3e')][_0x2548('0x9e')]({'where':{'id':_0x5381a1[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x56281d,null))[_0x2548('0x19')](function(_0x592d7d){if(_0x592d7d){_0x3a1c14=_0x592d7d;_0x56c071[_0x2548('0x5d')]=_['keys'](db['FaxInteraction'][_0x2548('0x3f')]);_0x56c071[_0x2548('0x48')]=_[_0x2548('0x5e')](_0x5381a1[_0x2548('0x48')]);_0x56c071[_0x2548('0x5f')]=_[_0x2548('0x60')](_0x56c071[_0x2548('0x5d')],_0x56c071[_0x2548('0x48')]);_0x26bfb2['attributes']=_[_0x2548('0x60')](_0x56c071[_0x2548('0x5d')],qs[_0x2548('0x61')](_0x5381a1[_0x2548('0x48')][_0x2548('0x61')]));_0x26bfb2[_0x2548('0x4d')]=_0x26bfb2['attributes'][_0x2548('0x51')]?_0x26bfb2[_0x2548('0x4d')]:_0x56c071['model'];_0x26bfb2[_0x2548('0xd3')]=qs['sort'](_0x5381a1['query'][_0x2548('0xd4')]);_0x26bfb2[_0x2548('0x47')]=qs[_0x2548('0x5f')](_['pick'](_0x5381a1[_0x2548('0x48')],_0x56c071[_0x2548('0x5f')]));if(_0x5381a1['query'][_0x2548('0x35')]){_0x26bfb2[_0x2548('0x47')]=_['merge'](_0x26bfb2[_0x2548('0x47')],{'$or':_['map'](_0x26bfb2['attributes'],function(_0xe6f0fa){var _0x5db6a8={};_0x5db6a8[_0xe6f0fa]={'$like':'%'+_0x5381a1[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x5db6a8;})});}_0x26bfb2=_[_0x2548('0x62')]({},_0x26bfb2,_0x5381a1['options']);return _0x3a1c14[_0x2548('0xee')](_0x26bfb2);}})[_0x2548('0x19')](function(_0x2a9fd5){if(_0x2a9fd5){_0x6eb995=_0x2a9fd5[_0x2548('0x51')];if(!_0x5381a1[_0x2548('0x48')][_0x2548('0xdb')](_0x2548('0xdc'))){_0x26bfb2[_0x2548('0x26')]=qs[_0x2548('0x26')](_0x5381a1[_0x2548('0x48')][_0x2548('0x26')]);_0x26bfb2[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x5381a1[_0x2548('0x48')][_0x2548('0x25')]);}return _0x3a1c14['getFaxInteractions'](_0x26bfb2);}})[_0x2548('0x19')](function(_0x36b83e){if(_0x36b83e){return _0x36b83e?{'count':_0x6eb995,'rows':_0x36b83e}:null;}})[_0x2548('0x19')](respondWithResult(_0x56281d,null))[_0x2548('0x5b')](handleError(_0x56281d,null));};exports[_0x2548('0xef')]=function(_0x193850,_0x2b6857){var _0x344127={};var _0x37f962={};var _0xcc565a;var _0x138284;return db['User'][_0x2548('0x9e')]({'where':{'id':_0x193850[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x2b6857,null))['then'](function(_0x22ff30){if(_0x22ff30){_0xcc565a=_0x22ff30;_0x37f962[_0x2548('0x5d')]=_[_0x2548('0x5e')](db['WhatsappInteraction'][_0x2548('0x3f')]);_0x37f962[_0x2548('0x48')]=_['keys'](_0x193850[_0x2548('0x48')]);_0x37f962[_0x2548('0x5f')]=_[_0x2548('0x60')](_0x37f962['model'],_0x37f962['query']);_0x344127[_0x2548('0x4d')]=_[_0x2548('0x60')](_0x37f962[_0x2548('0x5d')],qs[_0x2548('0x61')](_0x193850[_0x2548('0x48')][_0x2548('0x61')]));_0x344127[_0x2548('0x4d')]=_0x344127[_0x2548('0x4d')][_0x2548('0x51')]?_0x344127[_0x2548('0x4d')]:_0x37f962[_0x2548('0x5d')];_0x344127[_0x2548('0xd3')]=qs['sort'](_0x193850[_0x2548('0x48')]['sort']);_0x344127[_0x2548('0x47')]=qs[_0x2548('0x5f')](_[_0x2548('0xd5')](_0x193850['query'],_0x37f962[_0x2548('0x5f')]));if(_0x193850[_0x2548('0x48')]['filter']){_0x344127[_0x2548('0x47')]=_[_0x2548('0x62')](_0x344127[_0x2548('0x47')],{'$or':_[_0x2548('0x40')](_0x344127['attributes'],function(_0x4fdea6){var _0x1e795b={};_0x1e795b[_0x4fdea6]={'$like':'%'+_0x193850[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x1e795b;})});}_0x344127=_[_0x2548('0x62')]({},_0x344127,_0x193850[_0x2548('0x63')]);return _0xcc565a[_0x2548('0xef')](_0x344127);}})['then'](function(_0x3f1d8b){if(_0x3f1d8b){_0x138284=_0x3f1d8b['length'];if(!_0x193850['query']['hasOwnProperty'](_0x2548('0xdc'))){_0x344127[_0x2548('0x26')]=qs[_0x2548('0x26')](_0x193850[_0x2548('0x48')][_0x2548('0x26')]);_0x344127[_0x2548('0x25')]=qs['offset'](_0x193850['query'][_0x2548('0x25')]);}return _0xcc565a[_0x2548('0xef')](_0x344127);}})[_0x2548('0x19')](function(_0x50928){if(_0x50928){return _0x50928?{'count':_0x138284,'rows':_0x50928}:null;}})[_0x2548('0x19')](respondWithResult(_0x2b6857,null))[_0x2548('0x5b')](handleError(_0x2b6857,null));};exports['login']=function(_0x5cf5cf,_0x5901b6,_0x1a0dba){var _0x4f7697;var _0x3dcb1b;var _0x33c27b;var _0x5a1daa=!_[_0x2548('0x6d')](_0x5cf5cf[_0x2548('0x95')]['id'])?_0x5cf5cf[_0x2548('0x95')]['id']:!_[_0x2548('0x6d')](_0x5cf5cf['user']['id'])?_0x5cf5cf[_0x2548('0x32')]['id']:null;return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x5a1daa,'role':{'$or':[_0x2548('0x31'),'user',_0x2548('0x77')]}},'attributes':['id','name',_0x2548('0xf0'),'mobile',_0x2548('0x30'),_0x2548('0x69'),_0x2548('0xa4')]})[_0x2548('0x19')](function(_0x58530e){if(_0x58530e){if(_0x58530e[_0x2548('0x30')]===_0x2548('0x77')){_0x4f7697=_0x58530e;if(_0x5cf5cf[_0x2548('0x64')][_0x2548('0xa5')]){_0x33c27b=util[_0x2548('0xb3')](_0x2548('0xf1'),_0x4f7697[_0x5cf5cf['body']['interface']]);}else if(_0x5cf5cf[_0x2548('0x64')][_0x2548('0xf2')]){_0x33c27b=util[_0x2548('0xb3')](_0x2548('0xb4'),_0x5cf5cf[_0x2548('0x64')][_0x2548('0xf2')]);}else{_0x33c27b=util[_0x2548('0xb3')](_0x2548('0xb4'),_0x4f7697[_0x2548('0x45')]);}socket['to'](util[_0x2548('0xb3')](_0x2548('0xf3'),_0x4f7697[_0x2548('0x45')]))['emit'](_0x2548('0xf4'),{'user':{'id':_0x4f7697['id'],'name':_0x4f7697[_0x2548('0x45')]},'ip':_0x5cf5cf['headers'][_0x2548('0xf5')]||_0x5cf5cf[_0x2548('0xf6')][_0x2548('0xf7')]||_0x5cf5cf[_0x2548('0xf8')]['remoteAddress']||_0x5cf5cf[_0x2548('0xf6')][_0x2548('0xf8')]['remoteAddress']});return db['UserVoiceQueueRt'][_0x2548('0x2e')]({'where':{'membername':_0x4f7697['name']},'individualHooks':!![]});}}else{throw new db[(_0x2548('0x99'))][(_0x2548('0x97'))](_0x2548('0xf9'));}})[_0x2548('0x19')](function(){if(_0x4f7697){return _0x4f7697[_0x2548('0xfa')]({'raw':!![]});}})[_0x2548('0x19')](function(_0x5157ea){if(_0x4f7697){var _0xc7f993=[];if(_0x5157ea){_0x3dcb1b=_0x5157ea;if(_0x3dcb1b['length']){for(var _0x62efa5=0x0;_0x62efa5<_0x3dcb1b[_0x2548('0x51')];_0x62efa5++){_0xc7f993[_0x2548('0x52')]({'membername':_0x4f7697['name'],'UserId':_0x4f7697['id'],'queue_name':_0x3dcb1b[_0x62efa5][_0x2548('0x45')],'VoiceQueueId':_0x3dcb1b[_0x62efa5]['id'],'interface':_0x33c27b,'paused':_0x4f7697['loginInPause']||![],'penalty':_0x3dcb1b[_0x62efa5][_0x2548('0xfb')]||0x0});}return BPromise[_0x2548('0x8d')](_0xc7f993,function(_0x2b6574){return db['UserVoiceQueueRt']['upsert'](_0x2b6574);});}}}})[_0x2548('0x19')](function(){if(_0x4f7697){return db[_0x2548('0xfc')][_0x2548('0x4e')]({'where':{'membername':_0x4f7697['name'],'exitAt':null}});}})[_0x2548('0x19')](function(_0x56220f){if(_0x4f7697){var _0x199411=[];_0x56220f['forEach'](function(_0x47a29d){_0x199411['push'](_0x47a29d[_0x2548('0x2b')]({'exitAt':moment()[_0x2548('0xb3')](_0x2548('0xfd'))}));});return BPromise[_0x2548('0x5a')](_0x199411);}})[_0x2548('0x19')](function(){if(_0x4f7697){var _0x41a592=[];var _0x4b9dd8=[];var _0x7166c4=utils['getChannels']();var _0x2528ae={'membername':_0x4f7697[_0x2548('0x45')],'interface':_0x33c27b,'enterAt':moment()['format'](_0x2548('0xfd')),'role':_0x4f7697[_0x2548('0x30')],'internal':_0x4f7697[_0x2548('0x69')]};_0x7166c4[_0x2548('0xfe')](function(_0x3aa60b){_0x41a592[_0x2548('0x52')](_[_0x2548('0x62')]({'channel':_0x3aa60b,'type':_0x2548('0xff'),'data1':_0x5cf5cf[_0x2548('0x64')]['device'],'data2':_0x33c27b},_0x2528ae));if(_0x4f7697[_0x2548('0xa4')]){_0x4b9dd8[_0x2548('0x52')](_['merge']({'channel':_0x3aa60b,'type':_0x2548('0x100'),'data1':_0x2548('0x101')},_0x2528ae));}});return db[_0x2548('0xfc')]['bulkCreate'](_0x41a592[_0x2548('0x102')](_0x4b9dd8),{'individualHooks':!![]});}})['then'](function(){if(_0x4f7697){return _0x4f7697[_0x2548('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x2548('0xb3')](_0x2548('0xfd')),'voicePause':_0x4f7697[_0x2548('0xa4')]||![],'mailPause':_0x4f7697[_0x2548('0xa4')]||![],'chatPause':_0x4f7697['loginInPause']||![],'faxPause':_0x4f7697[_0x2548('0xa4')]||![],'smsPause':_0x4f7697[_0x2548('0xa4')]||![],'openchannelPause':_0x4f7697[_0x2548('0xa4')]||![],'whatsappPause':_0x4f7697[_0x2548('0xa4')]||![],'pauseType':_0x4f7697['loginInPause']?'LOGININPAUSE':null,'interface':_0x33c27b,'lastPauseAt':moment()[_0x2548('0xb3')](_0x2548('0xfd'))});}})['then'](function(_0x1701b4){if(_0x5cf5cf[_0x2548('0x103')]){return _0x1a0dba();}else{return BPromise[_0x2548('0x104')](_0x1701b4)['then'](respondWithResult(_0x5901b6,null));}})[_0x2548('0x5b')](handleError(_0x5901b6,null));};exports['logout']=function(_0x158b81,_0x54a390){var _0x4e81e2;return db['User'][_0x2548('0x39')]({'where':{'id':_0x158b81[_0x2548('0x95')]['id'],'role':_0x2548('0x77')},'attributes':['id',_0x2548('0x45'),'role']})[_0x2548('0x19')](handleEntityNotFound(_0x54a390,null))[_0x2548('0x19')](function(_0x44bd61){if(_0x44bd61){_0x4e81e2=_0x44bd61;return db[_0x2548('0xb6')][_0x2548('0x2e')]({'where':{'membername':_0x4e81e2[_0x2548('0x45')]},'individualHooks':!![]});}})[_0x2548('0x19')](function(){return db[_0x2548('0xfc')][_0x2548('0x4e')]({'where':{'membername':_0x4e81e2[_0x2548('0x45')],'exitAt':null}});})[_0x2548('0x19')](function(_0x52a40f){var _0x45ecec=[];_0x52a40f[_0x2548('0xfe')](function(_0x24891f){_0x45ecec[_0x2548('0x52')](_0x24891f[_0x2548('0x2b')]({'exitAt':moment()[_0x2548('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x45ecec);})[_0x2548('0x19')](function(){return _0x4e81e2[_0x2548('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x54a390,null))['catch'](handleError(_0x54a390,null));};exports[_0x2548('0x105')]=function(_0x59b1ad,_0x399a8a){var _0x525bd0;return db[_0x2548('0xb6')][_0x2548('0x2b')]({'paused':0x1},{'where':{'UserId':_0x59b1ad[_0x2548('0x95')]['id']},'individualHooks':!![]})[_0x2548('0x19')](function(){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x59b1ad[_0x2548('0x95')]['id'],'role':_0x2548('0x77')},'attributes':['id',_0x2548('0x45'),_0x2548('0x30'),_0x2548('0x69'),_0x2548('0xa5')]});})[_0x2548('0x19')](handleEntityNotFound(_0x399a8a,null))['then'](function(_0xb1f9ba){if(_0xb1f9ba){_0x525bd0=_0xb1f9ba;return respondWithRpcPromise('QueuePause',_0x2548('0x105'),{'id':_0x525bd0['id'],'name':_0x525bd0[_0x2548('0x45')],'pause':!![]});}})['then'](function(){if(_0x525bd0){return db[_0x2548('0xfc')]['findAll']({'where':{'membername':_0x525bd0[_0x2548('0x45')],'type':_0x2548('0x100'),'exitAt':null}});}})['then'](function(_0x2a22ba){if(_0x2a22ba[_0x2548('0x51')]){var _0x5a6a2a=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x47f722=0x0,_0xd71e90=_0x2a22ba[_0x2548('0x51')];_0x47f722<_0xd71e90;_0x47f722++){_0x2a22ba[_0x47f722][_0x2548('0x106')]({'exitAt':_0x5a6a2a});}}})[_0x2548('0x19')](function(){var _0x566107=[];var _0x1d794f=utils['getChannels']();_0x1d794f[_0x2548('0xfe')](function(_0x85ef90){_0x566107[_0x2548('0x52')]({'channel':_0x85ef90,'membername':_0x525bd0[_0x2548('0x45')],'interface':_[_0x2548('0x6d')](_0x525bd0[_0x2548('0xa5')])?util['format'](_0x2548('0xb4'),_0x525bd0[_0x2548('0x45')]):_0x525bd0['interface'],'type':_0x2548('0x100'),'enterAt':moment()[_0x2548('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x59b1ad['body'][_0x2548('0x41')]||_0x2548('0x107'),'role':_0x525bd0['role'],'internal':_0x525bd0[_0x2548('0x69')]});});return db['MemberReport']['bulkCreate'](_0x566107,{'individualHooks':!![]});})[_0x2548('0x19')](function(){return _0x525bd0[_0x2548('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x59b1ad[_0x2548('0x64')][_0x2548('0x41')]||_0x2548('0x107'),'lastPauseAt':moment()[_0x2548('0xb3')](_0x2548('0xfd'))});})[_0x2548('0x19')](respondWithResult(_0x399a8a,null))[_0x2548('0x5b')](handleError(_0x399a8a,null));};exports['unpause']=function(_0x412225,_0x428665){var _0x5687e9;return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x412225[_0x2548('0x95')]['id']},'attributes':['id','name','role','voicePause',_0x2548('0x108'),'chatPause',_0x2548('0x109'),_0x2548('0x10a'),_0x2548('0x10b'),_0x2548('0x10c'),_0x2548('0x10d'),_0x2548('0x10e')]})[_0x2548('0x19')](handleEntityNotFound(_0x428665,null))[_0x2548('0x19')](function(_0xbb0ad2){if(_0xbb0ad2){_0x5687e9=_0xbb0ad2;if(_0x412225[_0x2548('0x64')][_0x2548('0xb9')]&&!utils['isValidChannel'](_0x412225[_0x2548('0x64')][_0x2548('0xb9')])){throw new db[(_0x2548('0x99'))]['ValidationError'](_0x2548('0xa7'));}switch(_0x412225[_0x2548('0x64')][_0x2548('0xb9')]){case'voice':return respondWithRpcPromise(_0x2548('0x10f'),_0x2548('0x110'),{'id':_0x5687e9['id'],'name':_0x5687e9[_0x2548('0x45')],'pause':![]})['then'](function(){return db[_0x2548('0xb6')][_0x2548('0x2b')]({'paused':0x0},{'where':{'UserId':_0x5687e9['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport'][_0x2548('0x39')]({'where':{'channel':_0x412225[_0x2548('0x64')][_0x2548('0xb9')],'membername':_0x5687e9['name'],'type':_0x2548('0x100'),'exitAt':null}});})[_0x2548('0x19')](function(_0x22fabe){if(_0x22fabe){return _0x22fabe[_0x2548('0x2b')]({'exitAt':moment()[_0x2548('0xb3')](_0x2548('0xfd')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x2548('0x19')](function(){return _0x5687e9[_0x2548('0x2b')]({'voicePause':![]});});case'mail':case _0x2548('0x53'):case _0x2548('0x56'):case _0x2548('0x55'):case _0x2548('0x59'):case _0x2548('0x58'):return db[_0x2548('0xfc')][_0x2548('0x39')]({'where':{'channel':_0x412225[_0x2548('0x64')][_0x2548('0xb9')],'membername':_0x5687e9[_0x2548('0x45')],'type':_0x2548('0x100'),'exitAt':null}})[_0x2548('0x19')](function(_0x214233){if(_0x214233){return _0x214233[_0x2548('0x2b')]({'exitAt':moment()[_0x2548('0xb3')](_0x2548('0xfd')),'data2':_0x2548('0x111')},{'individualHooks':!![]});}return null;})[_0x2548('0x19')](function(){var _0x5e7ffc={};_[_0x2548('0x29')](_0x5e7ffc,util[_0x2548('0xb3')](_0x2548('0x112'),_0x412225[_0x2548('0x64')][_0x2548('0xb9')],_0x2548('0x113')),![]);return _0x5687e9['update'](_0x5e7ffc);});default:return respondWithRpcPromise(_0x2548('0x10f'),'unpause',{'id':_0x5687e9['id'],'name':_0x5687e9[_0x2548('0x45')],'pause':![]})['then'](function(){return db[_0x2548('0xb6')][_0x2548('0x2b')]({'paused':0x0},{'where':{'UserId':_0x5687e9['id']}});})['then'](function(){return db[_0x2548('0xfc')][_0x2548('0x4e')]({'where':{'membername':_0x5687e9[_0x2548('0x45')],'type':_0x2548('0x100'),'exitAt':null}});})[_0x2548('0x19')](function(_0xc8265a){var _0x936788=[];_0xc8265a[_0x2548('0xfe')](function(_0x2a128c){_0x936788[_0x2548('0x52')](_0x2a128c[_0x2548('0x2b')]({'exitAt':moment()[_0x2548('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x2548('0x111')}));});return BPromise[_0x2548('0x5a')](_0x936788);})['then'](function(){return _0x5687e9['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x2548('0x19')](respondWithResult(_0x428665,null))[_0x2548('0x5b')](handleError(_0x428665,null));};exports[_0x2548('0x114')]=function(_0x56158c,_0x1a859c){var _0x3798fb={};var _0xa412c4={};var _0x49708f;var _0x2c7843;return db[_0x2548('0x3e')][_0x2548('0x9e')]({'where':{'id':_0x56158c[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x1a859c,null))['then'](function(_0x4fa8bc){if(_0x4fa8bc){_0x49708f=_0x4fa8bc;_0xa412c4[_0x2548('0x5d')]=_[_0x2548('0x5e')](db['Team'][_0x2548('0x3f')]);_0xa412c4[_0x2548('0x48')]=_[_0x2548('0x5e')](_0x56158c['query']);_0xa412c4[_0x2548('0x5f')]=_['intersection'](_0xa412c4[_0x2548('0x5d')],_0xa412c4[_0x2548('0x48')]);_0x3798fb[_0x2548('0x4d')]=_['intersection'](_0xa412c4['model'],qs['fields'](_0x56158c[_0x2548('0x48')][_0x2548('0x61')]));_0x3798fb[_0x2548('0x4d')]=_0x3798fb['attributes'][_0x2548('0x51')]?_0x3798fb['attributes']:_0xa412c4['model'];_0x3798fb[_0x2548('0xd3')]=qs[_0x2548('0xd4')](_0x56158c[_0x2548('0x48')][_0x2548('0xd4')]);_0x3798fb['where']=qs[_0x2548('0x5f')](_[_0x2548('0xd5')](_0x56158c[_0x2548('0x48')],_0xa412c4['filters']));if(_0x56158c[_0x2548('0x48')][_0x2548('0x35')]){_0x3798fb[_0x2548('0x47')]=_['merge'](_0x3798fb['where'],{'$or':_[_0x2548('0x40')](_0x3798fb['attributes'],function(_0xed7832){var _0x4c89ae={};_0x4c89ae[_0xed7832]={'$like':'%'+_0x56158c['query'][_0x2548('0x35')]+'%'};return _0x4c89ae;})});}_0x3798fb=_[_0x2548('0x62')]({},_0x3798fb,_0x56158c['options']);return _0x49708f[_0x2548('0x114')](_0x3798fb);}})[_0x2548('0x19')](function(_0xc12177){if(_0xc12177){_0x2c7843=_0xc12177['length'];if(!_0x56158c[_0x2548('0x48')][_0x2548('0xdb')](_0x2548('0xdc'))){_0x3798fb[_0x2548('0x26')]=qs[_0x2548('0x26')](_0x56158c['query']['limit']);_0x3798fb[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x56158c[_0x2548('0x48')][_0x2548('0x25')]);}return _0x49708f[_0x2548('0x114')](_0x3798fb);}})['then'](function(_0x28e038){if(_0x28e038){return _0x28e038?{'count':_0x2c7843,'rows':_0x28e038}:null;}})[_0x2548('0x19')](respondWithResult(_0x1a859c,null))[_0x2548('0x5b')](handleError(_0x1a859c,null));};exports['addTeams']=function(_0x50d7f2,_0x54244c){var _0x18b3fd=_0x50d7f2['params']['id'];var _0x77c831=_0x50d7f2[_0x2548('0x64')]?_0x50d7f2[_0x2548('0x64')][_0x2548('0x67')]:null;var _0x1b0b3d=[];return Promise['resolve']()['then'](function(){if(!_0x77c831)throw new APIBadRequestError(_0x2548('0x115'));})[_0x2548('0x19')](function(){return db['User'][_0x2548('0x9e')]({'where':{'id':_0x18b3fd}});})[_0x2548('0x19')](function(_0x2e5fae){if(!_0x2e5fae)throw new APINotFoundError(util[_0x2548('0xb3')](_0x2548('0x116'),_0x50d7f2[_0x2548('0x95')]['id']));return db[_0x2548('0x6f')][_0x2548('0x117')](function(_0x433436){return _0x2e5fae[_0x2548('0x118')](_0x77c831,{'transaction':_0x433436})['then'](function(){return db[_0x2548('0x119')]['findAll']({'where':{'id':{'$in':_0x77c831}}});})[_0x2548('0x19')](function(_0x5018c8){var _0x4a7719=_[_0x2548('0x40')](_0x5018c8,function(_0x10f187){return _0x10f187['getAssociatedQueues']();});return Promise['all'](_0x4a7719);})[_0x2548('0x19')](function(_0x4c6389){_0x1b0b3d=_[_0x2548('0x11a')](_0x4c6389);var _0x131b37=_[_0x2548('0x40')](_0x1b0b3d,function(_0x3abbd9){return _0x3abbd9['addAgent'](_0x2e5fae['id'],{'transaction':_0x433436});});return Promise['all'](_0x131b37);})[_0x2548('0x19')](function(){if(!_0x2e5fae['online'])return;var _0x38f248=_[_0x2548('0x35')](_0x1b0b3d,function(_0x138434){return _0x138434['getDataValue'](_0x2548('0xb9'))===_0x2548('0x11b');});var _0x58eaca=_['map'](_0x38f248,function(_0x1cf1c9){return db[_0x2548('0xb6')]['upsert']({'membername':_0x2e5fae[_0x2548('0x45')],'UserId':_0x2e5fae['id'],'queue_name':_0x1cf1c9[_0x2548('0x45')],'VoiceQueueId':_0x1cf1c9['id'],'interface':_[_0x2548('0x6d')](_0x2e5fae['interface'])?util['format'](_0x2548('0xb4'),_0x2e5fae['name']):_0x2e5fae[_0x2548('0xa5')],'paused':_0x2e5fae[_0x2548('0xb5')]||![],'penalty':_0x2e5fae['penalty']},{'transaction':_0x433436});});return Promise[_0x2548('0x5a')](_0x58eaca);})[_0x2548('0x19')](function(){return db['TeamVoicePrefix'][_0x2548('0x4e')]({'where':{'teamId':{'$in':_0x77c831}}});})[_0x2548('0x19')](function(_0x3f05a4){var _0x3b9310=_[_0x2548('0x40')](_0x3f05a4,function(_0x43cd93){return db[_0x2548('0x11c')][_0x2548('0x84')]({'UserId':_0x2e5fae['id'],'VoicePrefixId':_0x43cd93[_0x2548('0x11d')]},{'transaction':_0x433436});});return Promise[_0x2548('0x5a')](_0x3b9310);});});})[_0x2548('0x19')](function(){for(var _0x58f29c=0x0;_0x58f29c<_0x1b0b3d[_0x2548('0x51')];_0x58f29c++){var _0x22ea95=_0x1b0b3d[_0x58f29c][_0x2548('0x11e')](_0x2548('0xb9'));var _0x27849a=_0x22ea95+_0x2548('0xae');socket['emit'](_0x2548('0x32')+_0x22ea95+_0x2548('0xaf'),{'UserId':_0x18b3fd,['queueField']:_0x1b0b3d[_0x58f29c]['id']});}})[_0x2548('0x19')](respondWithStatusCode(_0x54244c,null))['catch'](APIHandleError(_0x54244c));};exports[_0x2548('0x11f')]=function(_0x42a615,_0x45b63a){var _0x154229=_0x42a615[_0x2548('0x95')]['id'];var _0x2d54d3=null;if(_0x42a615[_0x2548('0x48')][_0x2548('0x67')]){_0x2d54d3=_[_0x2548('0xbb')](_0x42a615[_0x2548('0x48')][_0x2548('0x67')])?_0x42a615['query'][_0x2548('0x67')]:[_0x42a615[_0x2548('0x48')]['ids']];}var _0x34e7ed=[];return Promise[_0x2548('0x104')]()[_0x2548('0x19')](function(){if(!_0x2d54d3)throw new APIBadRequestError(_0x2548('0x120'));})[_0x2548('0x19')](function(){return db['User'][_0x2548('0x9e')]({'where':{'id':_0x154229}});})[_0x2548('0x19')](function(_0x58795a){if(!_0x58795a)throw new APINotFoundError(util[_0x2548('0xb3')](_0x2548('0x116'),_0x42a615[_0x2548('0x95')]['id']));return db[_0x2548('0x6f')]['transaction'](function(_0x22376c){return _0x58795a['removeTeams'](_0x2d54d3,{'transaction':_0x22376c})['then'](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x2d54d3}}});})[_0x2548('0x19')](function(_0x530399){var _0x8f100=_['map'](_0x530399,function(_0x504459){return _0x504459[_0x2548('0x121')]();});return Promise[_0x2548('0x5a')](_0x8f100);})[_0x2548('0x19')](function(_0x4ef159){_0x34e7ed=_['flattenDeep'](_0x4ef159);var _0x5ac7b1=_['map'](_0x34e7ed,function(_0x49aabc){return _0x49aabc[_0x2548('0x122')](_0x58795a['id'],{'transaction':_0x22376c});});return Promise['all'](_0x5ac7b1);})[_0x2548('0x19')](function(){if(!_0x58795a[_0x2548('0xb2')])return;var _0x55f548=_['filter'](_0x34e7ed,function(_0x26f5c0){return _0x26f5c0[_0x2548('0x11e')](_0x2548('0xb9'))===_0x2548('0x11b');});var _0x4a2d8e=_['map'](_0x55f548,function(_0x26190e){return db[_0x2548('0xb6')]['destroy']({'where':{'VoiceQueueId':_0x26190e['id'],'UserId':_0x58795a['id']},'transaction':_0x22376c});});return Promise[_0x2548('0x5a')](_0x4a2d8e);})[_0x2548('0x19')](function(){return db['TeamVoicePrefix'][_0x2548('0x4e')]({'where':{'teamId':{'$in':_0x2d54d3}}});})[_0x2548('0x19')](function(_0x57eb42){var _0x5080e3=_[_0x2548('0x40')](_0x57eb42,function(_0x1d65c6){return db[_0x2548('0x11c')]['destroy']({'where':{'UserId':_0x58795a['id'],'VoicePrefixId':_0x1d65c6['VoicePrefixId']}},{'transaction':_0x22376c});});return Promise[_0x2548('0x5a')](_0x5080e3);});});})[_0x2548('0x19')](function(){for(var _0x1447fe=0x0;_0x1447fe<_0x34e7ed[_0x2548('0x51')];_0x1447fe++){var _0x52dc8a=_0x34e7ed[_0x1447fe][_0x2548('0x11e')](_0x2548('0xb9'));var _0x36d051=_0x52dc8a+_0x2548('0xae');socket[_0x2548('0x2c')](_0x2548('0x32')+_0x52dc8a+_0x2548('0xbc'),{'UserId':_0x154229,['queueField']:_0x34e7ed[_0x1447fe]['id']});}})[_0x2548('0x19')](respondWithStatusCode(_0x45b63a,null))[_0x2548('0x5b')](APIHandleError(_0x45b63a));};exports[_0x2548('0x123')]=function(_0xe0822c,_0x269840){var _0x47410e={};var _0x5bec0b={};var _0x1024f7;var _0x38d1a6;return db[_0x2548('0x3e')][_0x2548('0x9e')]({'where':{'id':_0xe0822c[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x269840,null))[_0x2548('0x19')](function(_0x28e292){if(_0x28e292){_0x1024f7=_0x28e292;_0x5bec0b[_0x2548('0x5d')]=_[_0x2548('0x5e')](db[_0x2548('0xd6')][_0x2548('0x3f')]);_0x5bec0b[_0x2548('0x48')]=_[_0x2548('0x5e')](_0xe0822c[_0x2548('0x48')]);_0x5bec0b[_0x2548('0x5f')]=_[_0x2548('0x60')](_0x5bec0b[_0x2548('0x5d')],_0x5bec0b['query']);_0x47410e[_0x2548('0x4d')]=_['intersection'](_0x5bec0b[_0x2548('0x5d')],qs[_0x2548('0x61')](_0xe0822c[_0x2548('0x48')][_0x2548('0x61')]));_0x47410e[_0x2548('0x4d')]=_0x47410e[_0x2548('0x4d')][_0x2548('0x51')]?_0x47410e[_0x2548('0x4d')]:_0x5bec0b[_0x2548('0x5d')];_0x47410e[_0x2548('0xd3')]=qs[_0x2548('0xd4')](_0xe0822c[_0x2548('0x48')][_0x2548('0xd4')]);_0x47410e[_0x2548('0x47')]=qs['filters'](_[_0x2548('0xd5')](_0xe0822c[_0x2548('0x48')],_0x5bec0b[_0x2548('0x5f')]));if(_0xe0822c[_0x2548('0x48')][_0x2548('0x35')]){_0x47410e['where']=_[_0x2548('0x62')](_0x47410e[_0x2548('0x47')],{'$or':_[_0x2548('0x40')](_0x47410e[_0x2548('0x4d')],function(_0x40aa9f){var _0x37118b={};_0x37118b[_0x40aa9f]={'$like':'%'+_0xe0822c['query'][_0x2548('0x35')]+'%'};return _0x37118b;})});}_0x47410e=_['merge']({},_0x47410e,_0xe0822c['options']);return _0x1024f7['getLists'](_0x47410e);}})[_0x2548('0x19')](function(_0x589b6d){if(_0x589b6d){_0x38d1a6=_0x589b6d[_0x2548('0x51')];if(!_0xe0822c[_0x2548('0x48')]['hasOwnProperty'](_0x2548('0xdc'))){_0x47410e['limit']=qs[_0x2548('0x26')](_0xe0822c[_0x2548('0x48')]['limit']);_0x47410e['offset']=qs[_0x2548('0x25')](_0xe0822c[_0x2548('0x48')]['offset']);}return _0x1024f7['getLists'](_0x47410e);}})[_0x2548('0x19')](function(_0x2a4ee8){if(_0x2a4ee8){return _0x2a4ee8?{'count':_0x38d1a6,'rows':_0x2a4ee8}:null;}})['then'](respondWithResult(_0x269840,null))['catch'](handleError(_0x269840,null));};exports[_0x2548('0x124')]=function(_0x3c5d06,_0x4a4625){var _0x1fccaa={};var _0x49d0ca={};var _0x3dae3f;return db[_0x2548('0x3e')][_0x2548('0x9e')]({'where':{'id':_0x3c5d06['params']['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x4a4625,null))[_0x2548('0x19')](function(_0x330a66){if(_0x330a66){_0x3dae3f=_0x330a66;_0x49d0ca[_0x2548('0x5d')]=_['keys'](db[_0x2548('0x3e')]['rawAttributes']);_0x49d0ca[_0x2548('0x48')]=_[_0x2548('0x5e')](_0x3c5d06[_0x2548('0x48')]);_0x49d0ca[_0x2548('0x5f')]=_['intersection'](_0x49d0ca['model'],_0x49d0ca[_0x2548('0x48')]);_0x1fccaa['attributes']=_[_0x2548('0x60')](_0x49d0ca['model'],qs['fields'](_0x3c5d06['query'][_0x2548('0x61')]));_0x1fccaa[_0x2548('0x4d')]=_0x1fccaa['attributes'][_0x2548('0x51')]?_0x1fccaa[_0x2548('0x4d')]:_0x49d0ca[_0x2548('0x5d')];_0x1fccaa[_0x2548('0xd3')]=qs[_0x2548('0xd4')](_0x3c5d06[_0x2548('0x48')]['sort']);_0x1fccaa[_0x2548('0x47')]=qs[_0x2548('0x5f')](_[_0x2548('0xd5')](_0x3c5d06[_0x2548('0x48')],_0x49d0ca['filters']));if(_0x3c5d06[_0x2548('0x48')][_0x2548('0x35')]){_0x1fccaa[_0x2548('0x47')]=_[_0x2548('0x62')](_0x1fccaa['where'],{'$or':_[_0x2548('0x40')](_0x1fccaa[_0x2548('0x4d')],function(_0xe8b25a){var _0x25e831={};_0x25e831[_0xe8b25a]={'$like':'%'+_0x3c5d06[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x25e831;})});}_0x1fccaa['model']=db[_0x2548('0x3e')];_0x1fccaa['as']=_0x2548('0x33');_0x1fccaa=_['merge']({},_0x1fccaa,_0x3c5d06[_0x2548('0x63')]);return _0x3dae3f[_0x2548('0xfa')]({'include':[_0x1fccaa]});}})[_0x2548('0x19')](function(_0x5d113c){if(_0x5d113c){var _0x43e69f={},_0x57defe=[];for(var _0x402b47=0x0;_0x402b47<_0x5d113c['length'];_0x402b47+=0x1){for(var _0x1bd580=0x0,_0x16b1b9;_0x1bd580<_0x5d113c[_0x402b47][_0x2548('0x33')][_0x2548('0x51')];_0x1bd580+=0x1){_0x16b1b9=_0x5d113c[_0x402b47][_0x2548('0x33')][_0x1bd580]['get']({'plain':!![]});_0x43e69f[_0x16b1b9['id']]=_0x16b1b9;}}_0x43e69f=_[_0x2548('0x125')](_0x43e69f);for(var _0x372a42=qs[_0x2548('0x25')](_0x3c5d06[_0x2548('0x48')][_0x2548('0x25')]);_0x372a42<_0x43e69f[_0x2548('0x51')]&&_0x57defe[_0x2548('0x51')]<qs[_0x2548('0x26')](_0x3c5d06['query'][_0x2548('0x26')]);_0x372a42+=0x1){if(_0x43e69f[_0x372a42]){_0x57defe[_0x2548('0x52')](_0x43e69f[_0x372a42]);}}return{'count':_0x43e69f[_0x2548('0x51')],'rows':_0x57defe};}})[_0x2548('0x19')](respondWithResult(_0x4a4625,null))[_0x2548('0x5b')](handleError(_0x4a4625,null));};exports['destroy']=function(_0x46a10b,_0xec3050){if(_0x46a10b[_0x2548('0x32')]['id']==_0x46a10b[_0x2548('0x95')]['id']){return _0xec3050[_0x2548('0x23')](0x1f4)['send']({'message':'You\x20can\x27t\x20delete\x20yourself'});}return db[_0x2548('0x3e')]['find']({'where':{'id':_0x46a10b['params']['id']}})[_0x2548('0x19')](handleEntityNotFound(_0xec3050,null))['then'](removeEntity(_0xec3050,null))[_0x2548('0x5b')](handleError(_0xec3050,null));};exports[_0x2548('0x126')]=function(_0x2f9b71,_0x8872c0){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x2f9b71['params']['id']}})['then'](handleEntityNotFound(_0x8872c0,null))['then'](function(_0x43eef0){if(_0x43eef0){return _0x43eef0[_0x2548('0x126')](_0x2f9b71['body'][_0x2548('0x67')],_['omit'](_0x2f9b71[_0x2548('0x64')],[_0x2548('0x67'),'id'])||{})['spread'](function(){for(var _0x449f6f=0x0;_0x449f6f<_0x2f9b71[_0x2548('0x64')][_0x2548('0x67')][_0x2548('0x51')];_0x449f6f+=0x1){socket['emit'](_0x2548('0x127'),{'ChatInteractionId':Number(_0x2f9b71['body']['ids'][_0x449f6f]),'UserId':Number(_0x2f9b71[_0x2548('0x95')]['id'])});}return _0x2f9b71[_0x2548('0x64')]['ids'];});}})[_0x2548('0x19')](respondWithResult(_0x8872c0,null))[_0x2548('0x5b')](handleError(_0x8872c0,null));};exports[_0x2548('0x128')]=function(_0x4638fc,_0x55aec3){return db['User'][_0x2548('0x39')]({'where':{'id':_0x4638fc[_0x2548('0x95')]['id']}})['then'](handleEntityNotFound(_0x55aec3,null))[_0x2548('0x19')](function(_0x1b7bef){if(_0x1b7bef){return _0x1b7bef['removeChatInteractions'](_0x4638fc[_0x2548('0x48')]['ids'])['then'](function(){if(_[_0x2548('0xbb')](_0x4638fc['query'][_0x2548('0x67')])){for(var _0x3b5f2b=0x0;_0x3b5f2b<_0x4638fc[_0x2548('0x48')][_0x2548('0x67')]['length'];_0x3b5f2b+=0x1){socket[_0x2548('0x2c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x4638fc[_0x2548('0x48')][_0x2548('0x67')][_0x3b5f2b]),'UserId':Number(_0x4638fc[_0x2548('0x95')]['id'])});}}else{socket[_0x2548('0x2c')](_0x2548('0x129'),{'ChatInteractionId':Number(_0x4638fc[_0x2548('0x48')][_0x2548('0x67')]),'UserId':Number(_0x4638fc[_0x2548('0x95')]['id'])});}});}})[_0x2548('0x19')](respondWithStatusCode(_0x55aec3,null))['catch'](handleError(_0x55aec3,null));};exports[_0x2548('0x12a')]=function(_0xea3fef,_0x1715e1){return db['User'][_0x2548('0x39')]({'where':{'id':_0xea3fef[_0x2548('0x95')]['id']}})['then'](handleEntityNotFound(_0x1715e1,null))[_0x2548('0x19')](function(_0x4f7a37){if(_0x4f7a37){return _0x4f7a37[_0x2548('0x12a')](_0xea3fef[_0x2548('0x64')]['ids'],_[_0x2548('0x68')](_0xea3fef[_0x2548('0x64')],[_0x2548('0x67'),'id'])||{})[_0x2548('0xad')](function(){for(var _0x5f0faa=0x0;_0x5f0faa<_0xea3fef['body'][_0x2548('0x67')]['length'];_0x5f0faa+=0x1){socket['emit'](_0x2548('0x12b'),{'MailInteractionId':Number(_0xea3fef[_0x2548('0x64')][_0x2548('0x67')][_0x5f0faa]),'UserId':Number(_0xea3fef[_0x2548('0x95')]['id'])});}return _0xea3fef[_0x2548('0x64')]['ids'];});}})[_0x2548('0x19')](respondWithResult(_0x1715e1,null))['catch'](handleError(_0x1715e1,null));};exports[_0x2548('0x12c')]=function(_0x4cb47c,_0x5c1167){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x4cb47c[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x5c1167,null))[_0x2548('0x19')](function(_0x56bb7e){if(_0x56bb7e){return _0x56bb7e[_0x2548('0x12c')](_0x4cb47c[_0x2548('0x48')][_0x2548('0x67')])[_0x2548('0x19')](function(){if(_['isArray'](_0x4cb47c['query'][_0x2548('0x67')])){for(var _0x2c972a=0x0;_0x2c972a<_0x4cb47c[_0x2548('0x48')]['ids'][_0x2548('0x51')];_0x2c972a+=0x1){socket[_0x2548('0x2c')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4cb47c[_0x2548('0x48')][_0x2548('0x67')][_0x2c972a]),'UserId':Number(_0x4cb47c[_0x2548('0x95')]['id'])});}}else{socket[_0x2548('0x2c')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4cb47c[_0x2548('0x48')][_0x2548('0x67')]),'UserId':Number(_0x4cb47c['params']['id'])});}});}})[_0x2548('0x19')](respondWithStatusCode(_0x5c1167,null))[_0x2548('0x5b')](handleError(_0x5c1167,null));};exports[_0x2548('0x12d')]=function(_0x240e2f,_0xee8c6b){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x240e2f['params']['id']}})[_0x2548('0x19')](handleEntityNotFound(_0xee8c6b,null))['then'](function(_0x521b2c){if(_0x521b2c){return _0x521b2c[_0x2548('0x12d')](_0x240e2f[_0x2548('0x64')][_0x2548('0x67')],_[_0x2548('0x68')](_0x240e2f[_0x2548('0x64')],[_0x2548('0x67'),'id'])||{})[_0x2548('0xad')](function(){for(var _0x37b094=0x0;_0x37b094<_0x240e2f['body']['ids'][_0x2548('0x51')];_0x37b094+=0x1){socket[_0x2548('0x2c')]('user_has_fax_interactions:save',{'FaxInteractionId':Number(_0x240e2f[_0x2548('0x64')][_0x2548('0x67')][_0x37b094]),'UserId':Number(_0x240e2f[_0x2548('0x95')]['id'])});}return _0x240e2f['body']['ids'];});}})['then'](respondWithResult(_0xee8c6b,null))[_0x2548('0x5b')](handleError(_0xee8c6b,null));};exports[_0x2548('0x12e')]=function(_0x325fdd,_0x5be545){return db['User']['find']({'where':{'id':_0x325fdd[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x5be545,null))['then'](function(_0x495d14){if(_0x495d14){return _0x495d14['removeFaxInteractions'](_0x325fdd[_0x2548('0x48')][_0x2548('0x67')])[_0x2548('0x19')](function(){if(_[_0x2548('0xbb')](_0x325fdd[_0x2548('0x48')][_0x2548('0x67')])){for(var _0x492155=0x0;_0x492155<_0x325fdd['query'][_0x2548('0x67')][_0x2548('0x51')];_0x492155+=0x1){socket[_0x2548('0x2c')](_0x2548('0x12f'),{'FaxInteractionId':Number(_0x325fdd['query'][_0x2548('0x67')][_0x492155]),'UserId':Number(_0x325fdd['params']['id'])});}}else{socket[_0x2548('0x2c')](_0x2548('0x12f'),{'FaxInteractionId':Number(_0x325fdd[_0x2548('0x48')][_0x2548('0x67')]),'UserId':Number(_0x325fdd[_0x2548('0x95')]['id'])});}});}})[_0x2548('0x19')](respondWithStatusCode(_0x5be545,null))['catch'](handleError(_0x5be545,null));};exports[_0x2548('0x130')]=function(_0x2ca30c,_0x49644d){return db[_0x2548('0x3e')]['find']({'where':{'id':_0x2ca30c[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x49644d,null))[_0x2548('0x19')](function(_0x1b73a2){if(_0x1b73a2){return _0x1b73a2['addSmsInteractions'](_0x2ca30c['body'][_0x2548('0x67')],_[_0x2548('0x68')](_0x2ca30c['body'],['ids','id'])||{})['spread'](function(){for(var _0x3fc7e3=0x0;_0x3fc7e3<_0x2ca30c[_0x2548('0x64')][_0x2548('0x67')]['length'];_0x3fc7e3+=0x1){socket[_0x2548('0x2c')]('user_has_sms_interactions:save',{'SmsInteractionId':Number(_0x2ca30c[_0x2548('0x64')]['ids'][_0x3fc7e3]),'UserId':Number(_0x2ca30c[_0x2548('0x95')]['id'])});}return _0x2ca30c[_0x2548('0x64')][_0x2548('0x67')];});}})[_0x2548('0x19')](respondWithResult(_0x49644d,null))[_0x2548('0x5b')](handleError(_0x49644d,null));};exports['removeSmsInteractions']=function(_0x1175e3,_0x412db7){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x1175e3['params']['id']}})['then'](handleEntityNotFound(_0x412db7,null))[_0x2548('0x19')](function(_0x3a1114){if(_0x3a1114){return _0x3a1114[_0x2548('0x131')](_0x1175e3[_0x2548('0x48')][_0x2548('0x67')])[_0x2548('0x19')](function(){if(_[_0x2548('0xbb')](_0x1175e3[_0x2548('0x48')][_0x2548('0x67')])){for(var _0x28df58=0x0;_0x28df58<_0x1175e3[_0x2548('0x48')]['ids'][_0x2548('0x51')];_0x28df58+=0x1){socket['emit'](_0x2548('0x132'),{'SmsInteractionId':Number(_0x1175e3[_0x2548('0x48')]['ids'][_0x28df58]),'UserId':Number(_0x1175e3['params']['id'])});}}else{socket[_0x2548('0x2c')](_0x2548('0x132'),{'SmsInteractionId':Number(_0x1175e3['query']['ids']),'UserId':Number(_0x1175e3[_0x2548('0x95')]['id'])});}});}})['then'](respondWithStatusCode(_0x412db7,null))[_0x2548('0x5b')](handleError(_0x412db7,null));};exports[_0x2548('0x133')]=function(_0x33a526,_0x1893be){return db[_0x2548('0x3e')]['find']({'where':{'id':_0x33a526[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x1893be,null))[_0x2548('0x19')](function(_0xb4dd32){if(_0xb4dd32){return _0xb4dd32[_0x2548('0x133')](_0x33a526['body'][_0x2548('0x67')],_[_0x2548('0x68')](_0x33a526['body'],[_0x2548('0x67'),'id'])||{})['spread'](function(){for(var _0x53553b=0x0;_0x53553b<_0x33a526[_0x2548('0x64')][_0x2548('0x67')]['length'];_0x53553b+=0x1){socket[_0x2548('0x2c')](_0x2548('0x134'),{'OpenchannelInteractionId':Number(_0x33a526[_0x2548('0x64')][_0x2548('0x67')][_0x53553b]),'UserId':Number(_0x33a526[_0x2548('0x95')]['id'])});}return _0x33a526['body'][_0x2548('0x67')];});}})['then'](respondWithResult(_0x1893be,null))[_0x2548('0x5b')](handleError(_0x1893be,null));};exports[_0x2548('0x135')]=function(_0x27fe4f,_0xe63f3f){return db[_0x2548('0x3e')]['find']({'where':{'id':_0x27fe4f[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0xe63f3f,null))[_0x2548('0x19')](function(_0x3b6a19){if(_0x3b6a19){return _0x3b6a19['removeOpenchannelInteractions'](_0x27fe4f[_0x2548('0x48')]['ids'])[_0x2548('0x19')](function(){if(_['isArray'](_0x27fe4f[_0x2548('0x48')][_0x2548('0x67')])){for(var _0x29ef62=0x0;_0x29ef62<_0x27fe4f[_0x2548('0x48')]['ids'][_0x2548('0x51')];_0x29ef62+=0x1){socket[_0x2548('0x2c')](_0x2548('0x136'),{'OpenchannelInteractionId':Number(_0x27fe4f[_0x2548('0x48')][_0x2548('0x67')][_0x29ef62]),'UserId':Number(_0x27fe4f['params']['id'])});}}else{socket[_0x2548('0x2c')](_0x2548('0x136'),{'OpenchannelInteractionId':Number(_0x27fe4f[_0x2548('0x48')]['ids']),'UserId':Number(_0x27fe4f[_0x2548('0x95')]['id'])});}});}})[_0x2548('0x19')](respondWithStatusCode(_0xe63f3f,null))[_0x2548('0x5b')](handleError(_0xe63f3f,null));};exports[_0x2548('0x137')]=function(_0x4c632c,_0x38fa6f){return db['User'][_0x2548('0x39')]({'where':{'id':_0x4c632c[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x38fa6f,null))[_0x2548('0x19')](function(_0x3bc801){if(_0x3bc801){return _0x3bc801['addWhatsappInteractions'](_0x4c632c[_0x2548('0x64')][_0x2548('0x67')],_[_0x2548('0x68')](_0x4c632c['body'],[_0x2548('0x67'),'id'])||{})[_0x2548('0xad')](function(){for(var _0x2ebf51=0x0;_0x2ebf51<_0x4c632c[_0x2548('0x64')][_0x2548('0x67')][_0x2548('0x51')];_0x2ebf51+=0x1){socket[_0x2548('0x2c')](_0x2548('0x138'),{'WhatsappInteractionId':Number(_0x4c632c[_0x2548('0x64')][_0x2548('0x67')][_0x2ebf51]),'UserId':Number(_0x4c632c[_0x2548('0x95')]['id'])});}return _0x4c632c['body']['ids'];});}})[_0x2548('0x19')](respondWithResult(_0x38fa6f,null))[_0x2548('0x5b')](handleError(_0x38fa6f,null));};exports[_0x2548('0x139')]=function(_0x3296e9,_0x54df9d){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x3296e9[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x54df9d,null))[_0x2548('0x19')](function(_0x1468fa){if(_0x1468fa){return _0x1468fa[_0x2548('0x139')](_0x3296e9['query'][_0x2548('0x67')]);}})[_0x2548('0x19')](respondWithStatusCode(_0x54df9d,null))[_0x2548('0x5b')](handleError(_0x54df9d,null));};exports[_0x2548('0x13a')]=function(_0x315d24,_0x246245){var _0x46f4c8={};var _0x2b0cc8={};var _0x3cbac5;var _0x51ff0a;return db[_0x2548('0x3e')]['findOne']({'where':{'id':_0x315d24[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x246245,null))[_0x2548('0x19')](function(_0x24b4ed){if(_0x24b4ed){_0x3cbac5=_0x24b4ed;_0x2b0cc8[_0x2548('0x5d')]=_[_0x2548('0x5e')](db['VoicePrefix'][_0x2548('0x3f')]);_0x2b0cc8[_0x2548('0x48')]=_[_0x2548('0x5e')](_0x315d24['query']);_0x2b0cc8[_0x2548('0x5f')]=_[_0x2548('0x60')](_0x2b0cc8['model'],_0x2b0cc8[_0x2548('0x48')]);_0x46f4c8[_0x2548('0x4d')]=_['intersection'](_0x2b0cc8[_0x2548('0x5d')],qs[_0x2548('0x61')](_0x315d24[_0x2548('0x48')][_0x2548('0x61')]));_0x46f4c8[_0x2548('0x4d')]=_0x46f4c8[_0x2548('0x4d')][_0x2548('0x51')]?_0x46f4c8[_0x2548('0x4d')]:_0x2b0cc8[_0x2548('0x5d')];_0x46f4c8[_0x2548('0xd3')]=qs[_0x2548('0xd4')](_0x315d24['query'][_0x2548('0xd4')]);_0x46f4c8[_0x2548('0x47')]=qs[_0x2548('0x5f')](_[_0x2548('0xd5')](_0x315d24[_0x2548('0x48')],_0x2b0cc8[_0x2548('0x5f')]));if(_0x315d24[_0x2548('0x48')][_0x2548('0x35')]){_0x46f4c8[_0x2548('0x47')]=_[_0x2548('0x62')](_0x46f4c8[_0x2548('0x47')],{'$or':_[_0x2548('0x40')](_0x46f4c8[_0x2548('0x4d')],function(_0x1ffbdb){var _0x4d5c30={};_0x4d5c30[_0x1ffbdb]={'$like':'%'+_0x315d24[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x4d5c30;})});}_0x46f4c8=_['merge']({},_0x46f4c8,_0x315d24['options']);return _0x3cbac5[_0x2548('0x13a')](_0x46f4c8);}})[_0x2548('0x19')](function(_0x511322){if(_0x511322){_0x51ff0a=_0x511322[_0x2548('0x51')];if(!_0x315d24['query'][_0x2548('0xdb')](_0x2548('0xdc'))){_0x46f4c8['limit']=qs[_0x2548('0x26')](_0x315d24['query'][_0x2548('0x26')]);_0x46f4c8['offset']=qs['offset'](_0x315d24[_0x2548('0x48')]['offset']);}return _0x3cbac5[_0x2548('0x13a')](_0x46f4c8);}})[_0x2548('0x19')](function(_0x57016c){if(_0x57016c){return _0x57016c?{'count':_0x51ff0a,'rows':_0x57016c}:null;}})[_0x2548('0x19')](respondWithResult(_0x246245,null))[_0x2548('0x5b')](handleError(_0x246245,null));};exports[_0x2548('0x13b')]=function(_0x39e2fb,_0x189d3e){var _0x822ade={};var _0x5d864e={};var _0x8e0483;var _0x50a5cf;return db['User'][_0x2548('0x9e')]({'where':{'id':_0x39e2fb[_0x2548('0x95')]['id']}})['then'](handleEntityNotFound(_0x189d3e,null))[_0x2548('0x19')](function(_0x1aac1b){if(_0x1aac1b){_0x8e0483=_0x1aac1b;_0x5d864e[_0x2548('0x5d')]=_[_0x2548('0x5e')](db[_0x2548('0x13c')][_0x2548('0x3f')]);_0x5d864e[_0x2548('0x48')]=_[_0x2548('0x5e')](_0x39e2fb['query']);_0x5d864e[_0x2548('0x5f')]=_[_0x2548('0x60')](_0x5d864e[_0x2548('0x5d')],_0x5d864e[_0x2548('0x48')]);_0x822ade[_0x2548('0x4d')]=_['intersection'](_0x5d864e['model'],qs[_0x2548('0x61')](_0x39e2fb['query']['fields']));_0x822ade[_0x2548('0x4d')]=_0x822ade[_0x2548('0x4d')][_0x2548('0x51')]?_0x822ade[_0x2548('0x4d')]:_0x5d864e['model'];_0x822ade[_0x2548('0xd3')]=qs['sort'](_0x39e2fb['query'][_0x2548('0xd4')]);_0x822ade[_0x2548('0x47')]=qs[_0x2548('0x5f')](_['pick'](_0x39e2fb[_0x2548('0x48')],_0x5d864e[_0x2548('0x5f')]));if(_0x39e2fb[_0x2548('0x48')][_0x2548('0x35')]){_0x822ade[_0x2548('0x47')]=_[_0x2548('0x62')](_0x822ade[_0x2548('0x47')],{'$or':_['map'](_0x822ade[_0x2548('0x4d')],function(_0x43d400){var _0x36dd27={};_0x36dd27[_0x43d400]={'$like':'%'+_0x39e2fb[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x36dd27;})});}_0x822ade=_[_0x2548('0x62')]({},_0x822ade,_0x39e2fb[_0x2548('0x63')]);return _0x8e0483[_0x2548('0x13b')](_0x822ade);}})[_0x2548('0x19')](function(_0x4395f6){if(_0x4395f6){_0x50a5cf=_0x4395f6[_0x2548('0x51')];if(!_0x39e2fb[_0x2548('0x48')][_0x2548('0xdb')](_0x2548('0xdc'))){_0x822ade[_0x2548('0x26')]=qs['limit'](_0x39e2fb['query'][_0x2548('0x26')]);_0x822ade[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x39e2fb[_0x2548('0x48')]['offset']);}return _0x8e0483[_0x2548('0x13b')](_0x822ade);}})[_0x2548('0x19')](function(_0x4271ef){if(_0x4271ef){return _0x4271ef?{'count':_0x50a5cf,'rows':_0x4271ef}:null;}})[_0x2548('0x19')](respondWithResult(_0x189d3e,null))[_0x2548('0x5b')](handleError(_0x189d3e,null));};exports[_0x2548('0x13d')]=function(_0xcaf562,_0x186cbd){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0xcaf562[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x186cbd,null))['then'](function(_0x1a2276){if(_0x1a2276){return _0x1a2276[_0x2548('0x13d')](_0xcaf562[_0x2548('0x64')][_0x2548('0x67')],_[_0x2548('0x68')](_0xcaf562[_0x2548('0x64')],[_0x2548('0x67'),'id'])||{});}})['then'](respondWithResult(_0x186cbd,null))[_0x2548('0x5b')](handleError(_0x186cbd,null));};exports[_0x2548('0x13e')]=function(_0x572d3e,_0x3567c1){return db[_0x2548('0x3e')]['find']({'where':{'id':_0x572d3e[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x3567c1,null))[_0x2548('0x19')](function(_0x5308a2){if(_0x5308a2){return _0x5308a2[_0x2548('0x13e')](_0x572d3e[_0x2548('0x48')][_0x2548('0x67')]);}})[_0x2548('0x19')](respondWithStatusCode(_0x3567c1,null))[_0x2548('0x5b')](handleError(_0x3567c1,null));};exports['getMailAccounts']=function(_0x2a8f9a,_0x4af90b){var _0x18fb2b={};var _0x20ed10={};var _0x33efbd;var _0x3d055b;return db['User'][_0x2548('0x9e')]({'where':{'id':_0x2a8f9a[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x4af90b,null))[_0x2548('0x19')](function(_0x3cf9b7){if(_0x3cf9b7){_0x33efbd=_0x3cf9b7;_0x20ed10[_0x2548('0x5d')]=_[_0x2548('0x5e')](db[_0x2548('0x13f')]['rawAttributes']);_0x20ed10[_0x2548('0x48')]=_[_0x2548('0x5e')](_0x2a8f9a[_0x2548('0x48')]);_0x20ed10[_0x2548('0x5f')]=_[_0x2548('0x60')](_0x20ed10[_0x2548('0x5d')],_0x20ed10['query']);_0x18fb2b[_0x2548('0x4d')]=_['intersection'](_0x20ed10[_0x2548('0x5d')],qs[_0x2548('0x61')](_0x2a8f9a['query'][_0x2548('0x61')]));_0x18fb2b['attributes']=_0x18fb2b[_0x2548('0x4d')][_0x2548('0x51')]?_0x18fb2b[_0x2548('0x4d')]:_0x20ed10['model'];_0x18fb2b[_0x2548('0xd3')]=qs[_0x2548('0xd4')](_0x2a8f9a['query'][_0x2548('0xd4')]);_0x18fb2b[_0x2548('0x47')]=qs['filters'](_[_0x2548('0xd5')](_0x2a8f9a[_0x2548('0x48')],_0x20ed10[_0x2548('0x5f')]));if(_0x2a8f9a['query'][_0x2548('0x35')]){_0x18fb2b[_0x2548('0x47')]=_['merge'](_0x18fb2b[_0x2548('0x47')],{'$or':_[_0x2548('0x40')](_0x18fb2b[_0x2548('0x4d')],function(_0x117425){var _0x1fc460={};_0x1fc460[_0x117425]={'$like':'%'+_0x2a8f9a[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x1fc460;})});}_0x18fb2b=_['merge']({},_0x18fb2b,_0x2a8f9a['options']);return _0x33efbd[_0x2548('0x140')](_0x18fb2b);}})['then'](function(_0x39c4d1){if(_0x39c4d1){_0x3d055b=_0x39c4d1[_0x2548('0x51')];if(!_0x2a8f9a[_0x2548('0x48')][_0x2548('0xdb')]('nolimit')){_0x18fb2b[_0x2548('0x26')]=qs[_0x2548('0x26')](_0x2a8f9a['query'][_0x2548('0x26')]);_0x18fb2b['offset']=qs[_0x2548('0x25')](_0x2a8f9a[_0x2548('0x48')][_0x2548('0x25')]);}return _0x33efbd[_0x2548('0x140')](_0x18fb2b);}})[_0x2548('0x19')](function(_0x9a0bbc){if(_0x9a0bbc){return _0x9a0bbc?{'count':_0x3d055b,'rows':_0x9a0bbc}:null;}})[_0x2548('0x19')](respondWithResult(_0x4af90b,null))['catch'](handleError(_0x4af90b,null));};exports['addMailAccounts']=function(_0x4b3276,_0x15c316){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x4b3276[_0x2548('0x95')]['id']}})['then'](handleEntityNotFound(_0x15c316,null))[_0x2548('0x19')](function(_0x3338d6){if(_0x3338d6){return _0x3338d6[_0x2548('0x141')](_0x4b3276[_0x2548('0x64')][_0x2548('0x67')],_[_0x2548('0x68')](_0x4b3276[_0x2548('0x64')],[_0x2548('0x67'),'id'])||{});}})['then'](respondWithResult(_0x15c316,null))[_0x2548('0x5b')](handleError(_0x15c316,null));};exports[_0x2548('0x142')]=function(_0x42792e,_0x184479){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x42792e[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x184479,null))[_0x2548('0x19')](function(_0x1c9b38){if(_0x1c9b38){return _0x1c9b38['removeMailAccounts'](_0x42792e[_0x2548('0x48')][_0x2548('0x67')]);}})['then'](respondWithStatusCode(_0x184479,null))[_0x2548('0x5b')](handleError(_0x184479,null));};exports[_0x2548('0x143')]=function(_0x1a5680,_0x2f2928){var _0x1a5ccc={};var _0x5312af={};var _0xa38b25;var _0x46070d;return db[_0x2548('0x3e')][_0x2548('0x9e')]({'where':{'id':_0x1a5680[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x2f2928,null))[_0x2548('0x19')](function(_0x28b537){if(_0x28b537){_0xa38b25=_0x28b537;_0x5312af[_0x2548('0x5d')]=_[_0x2548('0x5e')](db[_0x2548('0x144')]['rawAttributes']);_0x5312af[_0x2548('0x48')]=_['keys'](_0x1a5680['query']);_0x5312af[_0x2548('0x5f')]=_[_0x2548('0x60')](_0x5312af['model'],_0x5312af[_0x2548('0x48')]);_0x1a5ccc[_0x2548('0x4d')]=_[_0x2548('0x60')](_0x5312af[_0x2548('0x5d')],qs[_0x2548('0x61')](_0x1a5680[_0x2548('0x48')][_0x2548('0x61')]));_0x1a5ccc['attributes']=_0x1a5ccc['attributes'][_0x2548('0x51')]?_0x1a5ccc[_0x2548('0x4d')]:_0x5312af['model'];_0x1a5ccc[_0x2548('0xd3')]=qs['sort'](_0x1a5680[_0x2548('0x48')]['sort']);_0x1a5ccc[_0x2548('0x47')]=qs[_0x2548('0x5f')](_[_0x2548('0xd5')](_0x1a5680[_0x2548('0x48')],_0x5312af['filters']));if(_0x1a5680[_0x2548('0x48')][_0x2548('0x35')]){_0x1a5ccc[_0x2548('0x47')]=_[_0x2548('0x62')](_0x1a5ccc[_0x2548('0x47')],{'$or':_[_0x2548('0x40')](_0x1a5ccc[_0x2548('0x4d')],function(_0x2ef3bf){var _0x15f825={};_0x15f825[_0x2ef3bf]={'$like':'%'+_0x1a5680[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x15f825;})});}_0x1a5ccc=_[_0x2548('0x62')]({},_0x1a5ccc,_0x1a5680[_0x2548('0x63')]);return _0xa38b25[_0x2548('0x143')](_0x1a5ccc);}})['then'](function(_0x746281){if(_0x746281){_0x46070d=_0x746281[_0x2548('0x51')];if(!_0x1a5680[_0x2548('0x48')][_0x2548('0xdb')]('nolimit')){_0x1a5ccc[_0x2548('0x26')]=qs[_0x2548('0x26')](_0x1a5680[_0x2548('0x48')][_0x2548('0x26')]);_0x1a5ccc[_0x2548('0x25')]=qs['offset'](_0x1a5680[_0x2548('0x48')]['offset']);}return _0xa38b25[_0x2548('0x143')](_0x1a5ccc);}})[_0x2548('0x19')](function(_0x5a6d2d){if(_0x5a6d2d){return _0x5a6d2d?{'count':_0x46070d,'rows':_0x5a6d2d}:null;}})[_0x2548('0x19')](respondWithResult(_0x2f2928,null))['catch'](handleError(_0x2f2928,null));};exports[_0x2548('0x145')]=function(_0x5612e9,_0x142975){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x5612e9[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x142975,null))[_0x2548('0x19')](function(_0x4aa8c2){if(_0x4aa8c2){return _0x4aa8c2['addOpenchannelAccounts'](_0x5612e9[_0x2548('0x64')][_0x2548('0x67')],_[_0x2548('0x68')](_0x5612e9['body'],['ids','id'])||{});}})[_0x2548('0x19')](respondWithResult(_0x142975,null))[_0x2548('0x5b')](handleError(_0x142975,null));};exports['removeOpenchannelAccounts']=function(_0xdf2e78,_0x3b84d2){return db['User'][_0x2548('0x39')]({'where':{'id':_0xdf2e78[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x3b84d2,null))['then'](function(_0x21a6a3){if(_0x21a6a3){return _0x21a6a3[_0x2548('0x146')](_0xdf2e78[_0x2548('0x48')][_0x2548('0x67')]);}})[_0x2548('0x19')](respondWithStatusCode(_0x3b84d2,null))[_0x2548('0x5b')](handleError(_0x3b84d2,null));};exports['getSmsAccounts']=function(_0x505f83,_0x1dd1a5){var _0x85147e={};var _0x221242={};var _0xa1d02f;var _0x49210e;return db[_0x2548('0x3e')][_0x2548('0x9e')]({'where':{'id':_0x505f83[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x1dd1a5,null))[_0x2548('0x19')](function(_0x29f1f8){if(_0x29f1f8){_0xa1d02f=_0x29f1f8;_0x221242[_0x2548('0x5d')]=_['keys'](db[_0x2548('0x147')][_0x2548('0x3f')]);_0x221242[_0x2548('0x48')]=_[_0x2548('0x5e')](_0x505f83[_0x2548('0x48')]);_0x221242[_0x2548('0x5f')]=_['intersection'](_0x221242[_0x2548('0x5d')],_0x221242[_0x2548('0x48')]);_0x85147e['attributes']=_['intersection'](_0x221242[_0x2548('0x5d')],qs[_0x2548('0x61')](_0x505f83[_0x2548('0x48')]['fields']));_0x85147e[_0x2548('0x4d')]=_0x85147e[_0x2548('0x4d')][_0x2548('0x51')]?_0x85147e['attributes']:_0x221242['model'];_0x85147e[_0x2548('0xd3')]=qs[_0x2548('0xd4')](_0x505f83[_0x2548('0x48')][_0x2548('0xd4')]);_0x85147e[_0x2548('0x47')]=qs[_0x2548('0x5f')](_[_0x2548('0xd5')](_0x505f83['query'],_0x221242['filters']));if(_0x505f83[_0x2548('0x48')][_0x2548('0x35')]){_0x85147e[_0x2548('0x47')]=_['merge'](_0x85147e[_0x2548('0x47')],{'$or':_[_0x2548('0x40')](_0x85147e[_0x2548('0x4d')],function(_0x110873){var _0x3d3230={};_0x3d3230[_0x110873]={'$like':'%'+_0x505f83[_0x2548('0x48')]['filter']+'%'};return _0x3d3230;})});}_0x85147e=_[_0x2548('0x62')]({},_0x85147e,_0x505f83['options']);return _0xa1d02f['getSmsAccounts'](_0x85147e);}})['then'](function(_0x527687){if(_0x527687){_0x49210e=_0x527687['length'];if(!_0x505f83['query'][_0x2548('0xdb')]('nolimit')){_0x85147e[_0x2548('0x26')]=qs['limit'](_0x505f83['query'][_0x2548('0x26')]);_0x85147e[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x505f83[_0x2548('0x48')][_0x2548('0x25')]);}return _0xa1d02f[_0x2548('0x148')](_0x85147e);}})[_0x2548('0x19')](function(_0x325423){if(_0x325423){return _0x325423?{'count':_0x49210e,'rows':_0x325423}:null;}})[_0x2548('0x19')](respondWithResult(_0x1dd1a5,null))[_0x2548('0x5b')](handleError(_0x1dd1a5,null));};exports[_0x2548('0x149')]=function(_0x669d24,_0x19de3a){return db[_0x2548('0x3e')]['find']({'where':{'id':_0x669d24['params']['id']}})['then'](handleEntityNotFound(_0x19de3a,null))[_0x2548('0x19')](function(_0x211468){if(_0x211468){return _0x211468[_0x2548('0x149')](_0x669d24[_0x2548('0x64')][_0x2548('0x67')],_[_0x2548('0x68')](_0x669d24[_0x2548('0x64')],[_0x2548('0x67'),'id'])||{});}})[_0x2548('0x19')](respondWithResult(_0x19de3a,null))[_0x2548('0x5b')](handleError(_0x19de3a,null));};exports['removeSmsAccounts']=function(_0x410cae,_0x4ed06b){return db['User'][_0x2548('0x39')]({'where':{'id':_0x410cae[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x4ed06b,null))[_0x2548('0x19')](function(_0x4892dd){if(_0x4892dd){return _0x4892dd[_0x2548('0x14a')](_0x410cae['query'][_0x2548('0x67')]);}})[_0x2548('0x19')](respondWithStatusCode(_0x4ed06b,null))[_0x2548('0x5b')](handleError(_0x4ed06b,null));};exports[_0x2548('0x14b')]=function(_0x5bf9c6,_0x51cf40){var _0x1bb785={};var _0x523961={};var _0x520918;var _0x3f0ff2;return db[_0x2548('0x3e')]['findOne']({'where':{'id':_0x5bf9c6['params']['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x51cf40,null))[_0x2548('0x19')](function(_0x4ba5fc){if(_0x4ba5fc){_0x520918=_0x4ba5fc;_0x523961['model']=_[_0x2548('0x5e')](db['ChatWebsite'][_0x2548('0x3f')]);_0x523961['query']=_[_0x2548('0x5e')](_0x5bf9c6[_0x2548('0x48')]);_0x523961[_0x2548('0x5f')]=_['intersection'](_0x523961[_0x2548('0x5d')],_0x523961['query']);_0x1bb785[_0x2548('0x4d')]=_[_0x2548('0x60')](_0x523961[_0x2548('0x5d')],qs[_0x2548('0x61')](_0x5bf9c6[_0x2548('0x48')][_0x2548('0x61')]));_0x1bb785['attributes']=_0x1bb785['attributes'][_0x2548('0x51')]?_0x1bb785['attributes']:_0x523961[_0x2548('0x5d')];_0x1bb785[_0x2548('0xd3')]=qs[_0x2548('0xd4')](_0x5bf9c6[_0x2548('0x48')]['sort']);_0x1bb785[_0x2548('0x47')]=qs[_0x2548('0x5f')](_[_0x2548('0xd5')](_0x5bf9c6[_0x2548('0x48')],_0x523961['filters']));if(_0x5bf9c6[_0x2548('0x48')][_0x2548('0x35')]){_0x1bb785[_0x2548('0x47')]=_['merge'](_0x1bb785[_0x2548('0x47')],{'$or':_['map'](_0x1bb785['attributes'],function(_0x41acf0){var _0x46d8b8={};_0x46d8b8[_0x41acf0]={'$like':'%'+_0x5bf9c6[_0x2548('0x48')]['filter']+'%'};return _0x46d8b8;})});}_0x1bb785=_['merge']({},_0x1bb785,_0x5bf9c6[_0x2548('0x63')]);return _0x520918['getChatWebsites'](_0x1bb785);}})[_0x2548('0x19')](function(_0x292b95){if(_0x292b95){_0x3f0ff2=_0x292b95[_0x2548('0x51')];if(!_0x5bf9c6[_0x2548('0x48')][_0x2548('0xdb')](_0x2548('0xdc'))){_0x1bb785['limit']=qs[_0x2548('0x26')](_0x5bf9c6['query']['limit']);_0x1bb785[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x5bf9c6[_0x2548('0x48')][_0x2548('0x25')]);}return _0x520918[_0x2548('0x14b')](_0x1bb785);}})[_0x2548('0x19')](function(_0x3471a0){if(_0x3471a0){return _0x3471a0?{'count':_0x3f0ff2,'rows':_0x3471a0}:null;}})[_0x2548('0x19')](respondWithResult(_0x51cf40,null))[_0x2548('0x5b')](handleError(_0x51cf40,null));};exports[_0x2548('0x14c')]=function(_0x1836f5,_0x33bb69){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x1836f5[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x33bb69,null))['then'](function(_0xd0085b){if(_0xd0085b){return _0xd0085b['addChatWebsites'](_0x1836f5['body'][_0x2548('0x67')],_[_0x2548('0x68')](_0x1836f5[_0x2548('0x64')],[_0x2548('0x67'),'id'])||{});}})[_0x2548('0x19')](respondWithResult(_0x33bb69,null))[_0x2548('0x5b')](handleError(_0x33bb69,null));};exports[_0x2548('0x14d')]=function(_0x2cd85f,_0x3d61e0){return db['User']['find']({'where':{'id':_0x2cd85f[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x3d61e0,null))[_0x2548('0x19')](function(_0x1a15f3){if(_0x1a15f3){return _0x1a15f3['removeChatWebsites'](_0x2cd85f[_0x2548('0x48')][_0x2548('0x67')]);}})['then'](respondWithStatusCode(_0x3d61e0,null))[_0x2548('0x5b')](handleError(_0x3d61e0,null));};exports[_0x2548('0x14e')]=function(_0x163abe,_0x1bd3d5){var _0x5c5aba={};var _0x313ab9={};var _0x5093e3;var _0x1196e2;return db[_0x2548('0x3e')][_0x2548('0x9e')]({'where':{'id':_0x163abe[_0x2548('0x95')]['id']}})['then'](handleEntityNotFound(_0x1bd3d5,null))[_0x2548('0x19')](function(_0x3a7a48){if(_0x3a7a48){_0x5093e3=_0x3a7a48;_0x313ab9[_0x2548('0x5d')]=_[_0x2548('0x5e')](db[_0x2548('0x14f')][_0x2548('0x3f')]);_0x313ab9[_0x2548('0x48')]=_[_0x2548('0x5e')](_0x163abe['query']);_0x313ab9[_0x2548('0x5f')]=_[_0x2548('0x60')](_0x313ab9['model'],_0x313ab9[_0x2548('0x48')]);_0x5c5aba[_0x2548('0x4d')]=_[_0x2548('0x60')](_0x313ab9[_0x2548('0x5d')],qs[_0x2548('0x61')](_0x163abe[_0x2548('0x48')]['fields']));_0x5c5aba[_0x2548('0x4d')]=_0x5c5aba[_0x2548('0x4d')]['length']?_0x5c5aba[_0x2548('0x4d')]:_0x313ab9[_0x2548('0x5d')];_0x5c5aba[_0x2548('0xd3')]=qs['sort'](_0x163abe['query']['sort']);_0x5c5aba[_0x2548('0x47')]=qs[_0x2548('0x5f')](_[_0x2548('0xd5')](_0x163abe['query'],_0x313ab9[_0x2548('0x5f')]));if(_0x163abe[_0x2548('0x48')]['filter']){_0x5c5aba[_0x2548('0x47')]=_[_0x2548('0x62')](_0x5c5aba[_0x2548('0x47')],{'$or':_[_0x2548('0x40')](_0x5c5aba[_0x2548('0x4d')],function(_0x28b059){var _0x4944db={};_0x4944db[_0x28b059]={'$like':'%'+_0x163abe[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x4944db;})});}_0x5c5aba=_[_0x2548('0x62')]({},_0x5c5aba,_0x163abe[_0x2548('0x63')]);return _0x5093e3['getWhatsappAccounts'](_0x5c5aba);}})[_0x2548('0x19')](function(_0x1796be){if(_0x1796be){_0x1196e2=_0x1796be[_0x2548('0x51')];if(!_0x163abe[_0x2548('0x48')][_0x2548('0xdb')]('nolimit')){_0x5c5aba[_0x2548('0x26')]=qs[_0x2548('0x26')](_0x163abe[_0x2548('0x48')][_0x2548('0x26')]);_0x5c5aba[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x163abe[_0x2548('0x48')][_0x2548('0x25')]);}return _0x5093e3[_0x2548('0x14e')](_0x5c5aba);}})['then'](function(_0xff19e6){if(_0xff19e6){return _0xff19e6?{'count':_0x1196e2,'rows':_0xff19e6}:null;}})['then'](respondWithResult(_0x1bd3d5,null))['catch'](handleError(_0x1bd3d5,null));};exports['addWhatsappAccounts']=function(_0x2d8851,_0x2ec1f6){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x2d8851[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x2ec1f6,null))[_0x2548('0x19')](function(_0x2838eb){if(_0x2838eb){return _0x2838eb['addWhatsappAccounts'](_0x2d8851[_0x2548('0x64')][_0x2548('0x67')],_[_0x2548('0x68')](_0x2d8851['body'],[_0x2548('0x67'),'id'])||{});}})['then'](respondWithResult(_0x2ec1f6,null))['catch'](handleError(_0x2ec1f6,null));};exports[_0x2548('0x150')]=function(_0x30d882,_0x185b5f){return db['User'][_0x2548('0x39')]({'where':{'id':_0x30d882[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x185b5f,null))[_0x2548('0x19')](function(_0x2ba247){if(_0x2ba247){return _0x2ba247[_0x2548('0x150')](_0x30d882[_0x2548('0x48')][_0x2548('0x67')]);}})[_0x2548('0x19')](respondWithStatusCode(_0x185b5f,null))[_0x2548('0x5b')](handleError(_0x185b5f,null));};exports[_0x2548('0x151')]=function(_0x5c47fc,_0x3466ec){var _0x16e486={};var _0xb39265={};var _0x3a7906;var _0x1a0490;return db['User'][_0x2548('0x9e')]({'where':{'id':_0x5c47fc[_0x2548('0x95')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x3466ec,null))[_0x2548('0x19')](function(_0x1cb67c){if(_0x1cb67c){_0x3a7906=_0x1cb67c;_0xb39265[_0x2548('0x5d')]=_['keys'](db['SquareProject'][_0x2548('0x3f')]);_0xb39265[_0x2548('0x48')]=_[_0x2548('0x5e')](_0x5c47fc[_0x2548('0x48')]);_0xb39265[_0x2548('0x5f')]=_[_0x2548('0x60')](_0xb39265[_0x2548('0x5d')],_0xb39265[_0x2548('0x48')]);_0x16e486[_0x2548('0x4d')]=_[_0x2548('0x60')](_0xb39265['model'],qs[_0x2548('0x61')](_0x5c47fc[_0x2548('0x48')][_0x2548('0x61')]));_0x16e486[_0x2548('0x4d')]=_0x16e486[_0x2548('0x4d')][_0x2548('0x51')]?_0x16e486[_0x2548('0x4d')]:_0xb39265['model'];_0x16e486[_0x2548('0xd3')]=qs[_0x2548('0xd4')](_0x5c47fc[_0x2548('0x48')][_0x2548('0xd4')]);_0x16e486[_0x2548('0x47')]=qs[_0x2548('0x5f')](_['pick'](_0x5c47fc[_0x2548('0x48')],_0xb39265[_0x2548('0x5f')]));if(_0x5c47fc['query']['filter']){_0x16e486[_0x2548('0x47')]=_[_0x2548('0x62')](_0x16e486[_0x2548('0x47')],{'$or':_[_0x2548('0x40')](_0x16e486['attributes'],function(_0x5b137f){var _0x4906c3={};_0x4906c3[_0x5b137f]={'$like':'%'+_0x5c47fc[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x4906c3;})});}_0x16e486=_[_0x2548('0x62')]({},_0x16e486,_0x5c47fc['options']);return _0x3a7906[_0x2548('0x151')](_0x16e486);}})[_0x2548('0x19')](function(_0xc09b14){if(_0xc09b14){_0x1a0490=_0xc09b14[_0x2548('0x51')];if(!_0x5c47fc[_0x2548('0x48')][_0x2548('0xdb')](_0x2548('0xdc'))){_0x16e486[_0x2548('0x26')]=qs[_0x2548('0x26')](_0x5c47fc[_0x2548('0x48')][_0x2548('0x26')]);_0x16e486[_0x2548('0x25')]=qs['offset'](_0x5c47fc[_0x2548('0x48')]['offset']);}return _0x3a7906[_0x2548('0x151')](_0x16e486);}})[_0x2548('0x19')](function(_0x3d7ee4){if(_0x3d7ee4){return _0x3d7ee4?{'count':_0x1a0490,'rows':_0x3d7ee4}:null;}})[_0x2548('0x19')](respondWithResult(_0x3466ec,null))[_0x2548('0x5b')](handleError(_0x3466ec,null));};exports['addSquareProjects']=function(_0x5691a6,_0x305093){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x5691a6[_0x2548('0x95')]['id']}})['then'](handleEntityNotFound(_0x305093,null))[_0x2548('0x19')](function(_0x81e948){if(_0x81e948){return _0x81e948[_0x2548('0x152')](_0x5691a6[_0x2548('0x64')]['ids'],_[_0x2548('0x68')](_0x5691a6['body'],[_0x2548('0x67'),'id'])||{});}})[_0x2548('0x19')](respondWithResult(_0x305093,null))['catch'](handleError(_0x305093,null));};exports[_0x2548('0x153')]=function(_0x1e3c45,_0x3744fb){return db['User'][_0x2548('0x39')]({'where':{'id':_0x1e3c45['params']['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x3744fb,null))[_0x2548('0x19')](function(_0x515d9d){if(_0x515d9d){return _0x515d9d['removeSquareProjects'](_0x1e3c45[_0x2548('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x3744fb,null))['catch'](handleError(_0x3744fb,null));};exports['getScheduledCalls']=function(_0x18583e,_0x15ecf2){var _0x3d3372={},_0x3181c6={},_0x255f31={'count':0x0,'rows':[]};var _0x3d2c1d=db[_0x2548('0x154')][_0x2548('0x3f')];_0x3181c6[_0x2548('0x5d')]=_[_0x2548('0x5e')](_0x3d2c1d);_0x3181c6[_0x2548('0x48')]=_[_0x2548('0x5e')](_0x18583e[_0x2548('0x48')]);_0x3181c6[_0x2548('0x5f')]=_[_0x2548('0x60')](_0x3181c6[_0x2548('0x5d')],_0x3181c6[_0x2548('0x48')]);_0x3181c6[_0x2548('0x5f')]=_['concat'](_0x3181c6[_0x2548('0x5f')],['$and',_0x2548('0x155'),_0x2548('0x156'),'$gte',_0x2548('0x157'),'$lte','$ne',_0x2548('0x158'),'$not',_0x2548('0x159'),_0x2548('0x15a'),'$in',_0x2548('0x15b'),_0x2548('0x15c'),'$notLike',_0x2548('0x15d'),'$notILike',_0x2548('0x15c'),_0x2548('0x15e'),_0x2548('0x15f'),_0x2548('0x160'),_0x2548('0x161')]);_0x3d3372['attributes']=_[_0x2548('0x60')](_0x3181c6[_0x2548('0x5d')],qs['fields'](_0x18583e['query'][_0x2548('0x61')]));_0x3d3372[_0x2548('0x4d')]=_0x3d3372['attributes']['length']?_0x3d3372[_0x2548('0x4d')]:_0x3181c6[_0x2548('0x5d')];if(!_0x18583e[_0x2548('0x48')][_0x2548('0xdb')]('nolimit')){_0x3d3372['limit']=qs[_0x2548('0x26')](_0x18583e[_0x2548('0x48')][_0x2548('0x26')]);_0x3d3372[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x18583e[_0x2548('0x48')][_0x2548('0x25')]);}_0x3d3372[_0x2548('0xd3')]=qs['sort'](_0x18583e[_0x2548('0x48')][_0x2548('0xd4')]);_0x3d3372['where']=qs[_0x2548('0x5f')](_['pick'](_0x18583e[_0x2548('0x48')],_0x3181c6[_0x2548('0x5f')]));if(_0x18583e['query'][_0x2548('0x35')]){_0x3d3372[_0x2548('0x47')]=_[_0x2548('0x62')](_0x3d3372[_0x2548('0x47')],{'$or':_[_0x2548('0x40')](_0x3d3372['attributes'],function(_0x4e4e75){var _0x580f7c={};_0x580f7c[_0x4e4e75]={'$like':'%'+_0x18583e[_0x2548('0x48')][_0x2548('0x35')]+'%'};return _0x580f7c;})});}_0x3d3372[_0x2548('0x47')]={'$and':[_0x3d3372[_0x2548('0x47')],{'$or':[{'UserId':_0x18583e[_0x2548('0x95')]['id']},{'OwnerId':_0x18583e[_0x2548('0x95')]['id']}]}]};_0x3d3372=_['merge']({},_0x3d3372,_0x18583e[_0x2548('0x63')]);var _0x528a00={'where':_0x3d3372['where']};return db[_0x2548('0x154')][_0x2548('0x28')](_0x528a00)[_0x2548('0x19')](function(_0x3f2ef2){_0x255f31[_0x2548('0x28')]=_0x3f2ef2;if(_0x18583e['query'][_0x2548('0x49')]){_0x3d3372[_0x2548('0x4a')]=[{'attributes':['id',_0x2548('0x162'),_0x2548('0x163'),'phone'],'model':db[_0x2548('0xd2')],'as':_0x2548('0x164')},{'attributes':['id',_0x2548('0x45'),_0x2548('0x165')],'model':db[_0x2548('0xb0')],'as':_0x2548('0xde')}];}return db['CmHopper'][_0x2548('0x4e')](_0x3d3372);})[_0x2548('0x19')](function(_0x36bc19){_0x255f31[_0x2548('0x4f')]=_0x36bc19;return _0x255f31;})[_0x2548('0x19')](respondWithFilteredResult(_0x15ecf2,_0x3d3372))['catch'](handleError(_0x15ecf2,null));};exports[_0x2548('0x166')]=function(_0x286e2a,_0x2f0f85){if(!_[_0x2548('0x6d')](_0x286e2a[_0x2548('0x32')]['id'])&&(_0x286e2a[_0x2548('0x32')][_0x2548('0x30')]=='admin'||_0x286e2a['user'][_0x2548('0x30')]==_0x2548('0x32'))){return db[_0x2548('0x3e')][_0x2548('0x9e')]({'where':{'id':_0x286e2a[_0x2548('0x95')]['id']},'raw':!![]})[_0x2548('0x19')](function(_0x450409){return authService[_0x2548('0x167')](_0x450409);})[_0x2548('0x19')](function(_0x215208){if(_0x215208){return _0x2f0f85[_0x2548('0x23')](0xc8)['json']({'api_key':_0x215208[_0x2548('0x168')]});}else{return _0x2f0f85[_0x2548('0x23')](0xcc)[_0x2548('0x24')]({'message':_0x2548('0x169')});}})['catch'](handleError(_0x2f0f85,0x193));}else{return _0x2f0f85[_0x2548('0x23')](0x191)[_0x2548('0x24')]({'message':'You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.'});}};exports[_0x2548('0x16a')]=function(_0x558182,_0xb71183){if(!_[_0x2548('0x6d')](_0x558182['user']['id'])&&(_0x558182[_0x2548('0x32')]['role']==_0x2548('0x31')||_0x558182[_0x2548('0x32')][_0x2548('0x30')]=='user')){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x558182[_0x2548('0x95')]['id']}})['then'](function(_0x5bbff0){return authService[_0x2548('0x16b')](_0x5bbff0);})['then'](function(_0x1c3909){return db[_0x2548('0x3e')][_0x2548('0x2b')]({'apiKeyIat':_0x1c3909[_0x2548('0x16c')],'apiKeyNonce':_0x1c3909[_0x2548('0x16d')]},{'where':{'id':_0x558182[_0x2548('0x95')]['id']}})['then'](function(){return _0xb71183['status'](0xc8)['json']({'api_key':_0x1c3909['token']});});})[_0x2548('0x5b')](handleError(_0xb71183,0x193));}else{return _0xb71183[_0x2548('0x23')](0x191)[_0x2548('0x24')]({'message':_0x2548('0x16e')});}};exports[_0x2548('0x16f')]=function(_0x474228,_0x2d34e4){if(!_['isNil'](_0x474228[_0x2548('0x32')]['id'])&&(_0x474228[_0x2548('0x32')][_0x2548('0x30')]==_0x2548('0x31')||_0x474228[_0x2548('0x32')][_0x2548('0x30')]=='user')){return db[_0x2548('0x3e')][_0x2548('0x39')]({'where':{'id':_0x474228['params']['id']}})['then'](handleEntityNotFound(_0x2d34e4,null))[_0x2548('0x19')](function(_0x31a3f0){if(_0x31a3f0&&_0x31a3f0[_0x2548('0x170')]&&_0x31a3f0[_0x2548('0x171')])return _0x31a3f0;else throw{'message':_0x2548('0x172')};})[_0x2548('0x19')](function(){return db[_0x2548('0x3e')][_0x2548('0x2b')]({'apiKeyNonce':null,'apiKeyIat':null},{'where':{'id':_0x474228[_0x2548('0x95')]['id']}});})[_0x2548('0x19')](respondWithStatusCode(_0x2d34e4,0xc8))['catch'](handleError(_0x2d34e4,0x193));}else{return _0x2d34e4[_0x2548('0x23')](0x191)['json']({'message':_0x2548('0x16e')});}};exports[_0x2548('0x173')]=function(_0x2cfb29,_0x5b6618){var _0x2e032b=_0x2cfb29[_0x2548('0x32')]['get']({'plain':!![]});if(!_0x2e032b){return _0x5b6618[_0x2548('0x23')](0x191)[_0x2548('0x3c')](_0x2548('0x174'));}else{Promise[_0x2548('0x104')]()[_0x2548('0x19')](function(){if(_0x2cfb29[_0x2548('0x48')]['userSetting']!==_0x2548('0x4c'))return;return _0x2cfb29[_0x2548('0x32')][_0x2548('0x175')]();})['then'](function(_0xff7dd1){if(!_0xff7dd1)return;return _0xff7dd1[_0x2548('0x2f')]({'plain':!![]});})[_0x2548('0x19')](function(_0x46189d){_0x2e032b[_0x2548('0x4b')]=_0x46189d;return _0x5b6618[_0x2548('0x23')](0xc8)[_0x2548('0x24')](_0x2e032b);});}};exports[_0x2548('0x176')]=function(_0x3210bf,_0x4e9e90){var _0x1a9412={'offset':0x0},_0x31c9bb={'count':0x0,'rows':[]};Promise[_0x2548('0x104')]()[_0x2548('0x19')](function(){if(!_0x3210bf['query'][_0x2548('0x35')]&&!_0x3210bf[_0x2548('0x48')][_0x2548('0x177')]&&!_0x3210bf['query'][_0x2548('0x178')])return[];return Promise[_0x2548('0x104')]()[_0x2548('0x19')](function(){var _0x4ea680=[];if(!_['isEmpty'](_0x3210bf['query'][_0x2548('0x177')])){_0x4ea680[_0x2548('0x52')](db[_0x2548('0x119')][_0x2548('0x4e')]({'attributes':['id',_0x2548('0x45')],'where':{'id':_0x3210bf['query'][_0x2548('0x177')]}}));}if(!_[_0x2548('0x90')](_0x3210bf['query'][_0x2548('0x178')])){_0x4ea680[_0x2548('0x52')](db['VoiceQueue'][_0x2548('0x4e')]({'attributes':['id',_0x2548('0x45')],'type':_0x2548('0x179'),'where':{'id':_0x3210bf['query']['queues']}}));}return Promise['all'](_0x4ea680);})['then'](function(_0x41fd41){var _0xf8f3dd=_['flatten'](_0x41fd41)[_0x2548('0x40')](function(_0x1a3bd3){return _0x1a3bd3[_0x2548('0x124')]({'attributes':['id',_0x2548('0x45'),'internal',_0x2548('0xb2')],'raw':!![]});});return Promise[_0x2548('0x5a')](_0xf8f3dd);})[_0x2548('0x19')](function(_0x45d620){var _0x3b2ea2=_[_0x2548('0x17a')](_0x45d620);if(!_0x3210bf[_0x2548('0x48')][_0x2548('0x35')])return _0x3b2ea2;if(_[_0x2548('0x90')](_0x3b2ea2)){return db[_0x2548('0x3e')][_0x2548('0x4e')]({'attributes':['id',_0x2548('0x45'),_0x2548('0x69'),'online'],'where':{'role':_0x2548('0x77'),'$or':[db['sequelize'][_0x2548('0x47')](db[_0x2548('0x6f')]['fn'](_0x2548('0x17b'),db[_0x2548('0x6f')][_0x2548('0x17c')](_0x2548('0x45'))),{'$like':'%'+_0x3210bf[_0x2548('0x48')][_0x2548('0x35')][_0x2548('0xaa')]()+'%'}),{'internal':{'$like':'%'+_0x3210bf[_0x2548('0x48')][_0x2548('0x35')]+'%'}}]},'raw':!![]});}else{return _(_0x3b2ea2)[_0x2548('0x17a')]()[_0x2548('0x35')](function(_0x47926c){return _0x47926c[_0x2548('0x45')]['toLowerCase']()['includes'](_0x3210bf['query'][_0x2548('0x35')][_0x2548('0xaa')]())||_0x47926c[_0x2548('0x69')][_0x2548('0x17d')]()[_0x2548('0x38')](_0x3210bf[_0x2548('0x48')][_0x2548('0x35')]);})[_0x2548('0x37')]();}})['then'](function(_0xbd9f96){var _0x5984f2='name';var _0x39b4b6=_0x2548('0x17e');if(_0x3210bf[_0x2548('0x48')][_0x2548('0xd4')]){_0x39b4b6=_0x3210bf[_0x2548('0x48')]['sort'][0x0]==='-'?'desc':_0x2548('0x17e');_0x5984f2=_0x39b4b6===_0x2548('0x17e')?_0x3210bf[_0x2548('0x48')]['sort']:_0x3210bf[_0x2548('0x48')][_0x2548('0xd4')]['substring'](0x1);}return _(_0xbd9f96)[_0x2548('0x17f')]('id')['orderBy']([function(_0x2fb1a8){return _0x5984f2===_0x2548('0x45')?_0x2fb1a8[_0x5984f2]['toLowerCase']():_0x2fb1a8[_0x5984f2];}],[_0x39b4b6])['map'](function(_0x10f951){return _['pick'](_0x10f951,['id',_0x2548('0x45'),_0x2548('0x69'),'online']);})[_0x2548('0x37')]();})[_0x2548('0x19')](function(_0x2427b9){return client[_0x2548('0x18')]('Agents',_0x3210bf)[_0x2548('0x19')](function(_0x1d270e){if(_0x1d270e['error'])throw new Error(_0x2548('0x180'));var _0x1f2cef=_0x1d270e['result'];var _0x437cbe=jayson[_0x2548('0x16')][_0x2548('0x17')]({'port':0x232c});return _0x437cbe[_0x2548('0x18')]('Agents',_0x3210bf)[_0x2548('0x19')](function(_0x498968){if(_0x498968[_0x2548('0x1e')])throw new Error(_0x2548('0x181'));var _0x59f9f7=_0x498968['result'];return _[_0x2548('0x62')]({},_0x59f9f7,_0x1f2cef);});})['then'](function(_0x5e6d51){return _['map'](_0x2427b9,function(_0x1ddf2b){var _0x1d7e4c=_[_0x2548('0x39')](_0x5e6d51[_0x2548('0x4f')],['id',_0x1ddf2b['id']]);if(!_0x1d7e4c||!_0x1ddf2b['online']){_0x1ddf2b[_0x2548('0x23')]=_0x2548('0x182');}else if(_0x1d7e4c[_0x2548('0xb5')]){_0x1ddf2b[_0x2548('0x23')]=_0x2548('0x105');}else{_0x1ddf2b[_0x2548('0x23')]=_[_0x2548('0x38')]([_0x2548('0x183'),_0x2548('0x184'),_0x2548('0x185'),_0x2548('0x186'),null,undefined],_0x1d7e4c[_0x2548('0x187')])?'online':_0x2548('0x188');}return _0x1ddf2b;});});});})[_0x2548('0x19')](function(_0x5b7237){if(!_0x3210bf[_0x2548('0x48')]['hasOwnProperty'](_0x2548('0xdc'))){_0x1a9412[_0x2548('0x26')]=qs['limit'](_0x3210bf[_0x2548('0x48')][_0x2548('0x26')]||0xa);_0x1a9412[_0x2548('0x25')]=qs[_0x2548('0x25')](_0x3210bf[_0x2548('0x48')][_0x2548('0x25')]);}_0x31c9bb[_0x2548('0x28')]=_0x5b7237[_0x2548('0x51')];_0x31c9bb[_0x2548('0x4f')]=_0x1a9412[_0x2548('0x26')]?_0x5b7237['slice'](_0x1a9412[_0x2548('0x25')],_0x1a9412[_0x2548('0x25')]+_0x1a9412[_0x2548('0x26')]):_0x5b7237;return _0x31c9bb;})['then'](respondWithFilteredResult(_0x4e9e90,_0x1a9412))['catch'](handleError(_0x4e9e90,null));};function get_open_tabs(_0x203afd,_0x17f3fd){var _0x2ade4c=_0x203afd[_0x2548('0x189')](0x0)['toUpperCase']()+_0x203afd[_0x2548('0x18a')](0x1);var _0x5697ea={'type':db[_0x2548('0x99')][_0x2548('0x71')]['SELECT'],'raw':!![]};return new BPromise(function(_0x3496cf,_0x473e95){var _0x1f34df=squel['select']()[_0x2548('0x18b')](_0x2548('0x18c')+_0x2ade4c+_0x2548('0x18d'),'id')['field'](_0x2548('0x18e'))[_0x2548('0x73')](_0x2548('0x18f')+_0x203afd+_0x2548('0x190'),'ui')[_0x2548('0x47')](_0x2548('0x191'),_0x17f3fd['id']);return db[_0x2548('0x6f')][_0x2548('0x48')](_0x1f34df[_0x2548('0x17d')](),_0x5697ea)[_0x2548('0x19')](function(_0x1f8ad8){_0x17f3fd[_0x2ade4c+'OpenTabs']=_0x1f8ad8;_0x3496cf(_0x1f8ad8);})[_0x2548('0x5b')](function(_0x5e7357){_0x473e95(_0x5e7357);});});}
\ No newline at end of file
index 62d005d..ca89937 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x18fc=['hasOwnProperty','exports','events','../../mysqldb','User','setMaxListeners','save','remove','emit'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x18fc,0xfe));var _0xc18f=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x18fc[_0x1bc013];return _0x55df36;};'use strict';var EventEmitter=require(_0xc18f('0x0'));var User=require(_0xc18f('0x1'))['db'][_0xc18f('0x2')];var UserEvents=new EventEmitter();UserEvents[_0xc18f('0x3')](0x0);var events={'afterCreate':_0xc18f('0x4'),'afterUpdate':'update','afterDestroy':_0xc18f('0x5')};function emitEvent(_0xbfa73b){return function(_0x10a221,_0x1f3cb6,_0x496ed4){UserEvents[_0xc18f('0x6')](_0xbfa73b+':'+_0x10a221['id'],_0x10a221);UserEvents[_0xc18f('0x6')](_0xbfa73b,_0x10a221);_0x496ed4(null);};}for(var e in events){if(events[_0xc18f('0x7')](e)){var event=events[e];User['hook'](e,emitEvent(event));}}module[_0xc18f('0x8')]=UserEvents;
\ No newline at end of file
+var _0x30f4=['events','../../mysqldb','User','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x4211c9,_0x42a8d4){var _0x2338f0=function(_0x328a6f){while(--_0x328a6f){_0x4211c9['push'](_0x4211c9['shift']());}};_0x2338f0(++_0x42a8d4);}(_0x30f4,0xc8));var _0x430f=function(_0x268ee5,_0x407dd8){_0x268ee5=_0x268ee5-0x0;var _0x1c3be7=_0x30f4[_0x268ee5];return _0x1c3be7;};'use strict';var EventEmitter=require(_0x430f('0x0'));var User=require(_0x430f('0x1'))['db'][_0x430f('0x2')];var UserEvents=new EventEmitter();UserEvents[_0x430f('0x3')](0x0);var events={'afterCreate':_0x430f('0x4'),'afterUpdate':_0x430f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x49685c){return function(_0xfbd1a8,_0x514457,_0x36ab8d){UserEvents['emit'](_0x49685c+':'+_0xfbd1a8['id'],_0xfbd1a8);UserEvents[_0x430f('0x6')](_0x49685c,_0xfbd1a8);_0x36ab8d(null);};}for(var e in events){if(events[_0x430f('0x7')](e)){var event=events[e];User['hook'](e,emitEvent(event));}}module['exports']=UserEvents;
\ No newline at end of file
index 30f30e9..95fa855 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd4f=['format','${UNIQUEID}.%s,a','auth','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','wav','gsm','context','system','extensionMonitor','includes','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=%s','Dial','SIP/%s,,tTxXU(xcally-mixmonitor-context)','Hangup','priority','defaults','VoiceChanSpy','findAll','then','internal','concat','catch','exports','define','User','users','utf8','utf8_bin','userProfileId','undefined','UserProfile','privacyEnabled','updatePassword','resolve','changed','find','updateMd5Password','VoiceExtension','bulkCreate','chanspy','destroy','encryptPassword','function','Missing\x20Callback','toString','base64','salt','from','sha1','indexOf','provider','Invalid\x20password','makeSalt','md5secret',':asterisk:','http','client','Agents','error','result','request','Unable\x20to\x20retrieve\x20RPC\x20agent\x20(Routing)','manual','QueuePause','voice','UserVoiceQueueRt','findOne','MemberReport','PAUSE','map','YYYY-MM-DD\x20HH:mm:ss','all','voicePause','mailPause','faxPause','smsPause','openchannelPause','../../config/utils','forEach','update','bluebird','crypto','util','md5','moment','jayson/promise','./user.attributes','length','from-sip','%s%s','prefix','push','Set','CDR(type)=%s','record','merge'];(function(_0xc786ea,_0x5e0c81){var _0x26783f=function(_0x45680e){while(--_0x45680e){_0xc786ea['push'](_0xc786ea['shift']());}};_0x26783f(++_0x5e0c81);}(_0xbd4f,0xbe));var _0xfbd4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xbd4f[_0x422905];return _0x33dc6c;};'use strict';var BPromise=require(_0xfbd4('0x0'));var crypto=require(_0xfbd4('0x1'));var util=require(_0xfbd4('0x2'));var md5=require(_0xfbd4('0x3'));var moment=require(_0xfbd4('0x4'));var _=require('lodash');var jayson=require(_0xfbd4('0x5'));var attributes=require(_0xfbd4('0x6'));var authTypes=['google'];var validatePresenceOf=function(_0x501914){return _0x501914&&_0x501914[_0xfbd4('0x7')];};var getChanSpyApplications=function(_0xe7dbc9,_0x7ce80b,_0xdf9be0){var _0x51ab8f={'context':_0xe7dbc9['context']||_0xfbd4('0x8'),'type':'system','isApp':![],'UserId':_0xe7dbc9['id']};var _0x4e2c47=[];for(var _0x15f0c8=0x0,_0x52fb64=0x1;_0x15f0c8<_0xdf9be0[_0xfbd4('0x7')];_0x15f0c8++,_0x52fb64=0x1){var _0x106e36={'exten':util['format'](_0xfbd4('0x9'),_0xdf9be0[_0x15f0c8][_0xfbd4('0xa')],_0x7ce80b),'ChanSpyId':_0xdf9be0[_0x15f0c8]['id']};_0x4e2c47[_0xfbd4('0xb')](_['merge']({'app':_0xfbd4('0xc'),'appdata':util['format'](_0xfbd4('0xd'),'chanspy'),'priority':_0x52fb64++},_0x51ab8f,_0x106e36));if(_0xdf9be0[_0x15f0c8][_0xfbd4('0xe')]){_0x4e2c47[_0xfbd4('0xb')](_[_0xfbd4('0xf')]({'app':'MixMonitor','appdata':util[_0xfbd4('0x10')](_0xfbd4('0x11'),_0xdf9be0[_0x15f0c8]['recordingFormat']),'priority':_0x52fb64++},_0x51ab8f,_0x106e36));}if(_0xdf9be0[_0x15f0c8][_0xfbd4('0x12')]){_0x4e2c47['push'](_[_0xfbd4('0xf')]({'app':'Authenticate','appdata':_0xdf9be0[_0x15f0c8][_0xfbd4('0x13')],'priority':_0x52fb64++},_0x51ab8f,_0x106e36));}_0x4e2c47['push'](_[_0xfbd4('0xf')]({'app':_0xfbd4('0x14'),'appdata':util['format'](_0xfbd4('0x15'),_0xe7dbc9[_0xfbd4('0x16')],_0xdf9be0[_0x15f0c8][_0xfbd4('0x17')]?_0xdf9be0[_0x15f0c8][_0xfbd4('0x17')][_0xfbd4('0x18')](''):''),'priority':_0x52fb64++},_0x51ab8f,_0x106e36));if(_0xdf9be0[_0x15f0c8][_0xfbd4('0xe')]){_0x4e2c47[_0xfbd4('0xb')](_[_0xfbd4('0xf')]({'app':_0xfbd4('0x19'),'priority':_0x52fb64++},_0x51ab8f,_0x106e36));}}return _0x4e2c47;};var getUserApplications=function(_0x3b03f5,_0x270aae){var _0x4e8398=[_0xfbd4('0x1a'),'WAV',_0xfbd4('0x1b')];var _0x2431ed={'context':_0x3b03f5[_0xfbd4('0x1c')]||_0xfbd4('0x8'),'exten':_0x270aae,'type':_0xfbd4('0x1d'),'isApp':![],'UserId':_0x3b03f5['id']};var _0x3fc0e4=[{'app':_0xfbd4('0xc'),'appdata':'CDR(type)=internal'}];if(_0x3b03f5[_0xfbd4('0x1e')]&&_[_0xfbd4('0x1f')](_0x4e8398,_0x3b03f5[_0xfbd4('0x1e')])){_0x3fc0e4[_0xfbd4('0xb')]({'app':_0xfbd4('0xc'),'appdata':_0xfbd4('0x20')});_0x3fc0e4['push']({'app':_0xfbd4('0xc'),'appdata':util['format'](_0xfbd4('0x21'),_0x3b03f5[_0xfbd4('0x1e')])});_0x3fc0e4['push']({'app':_0xfbd4('0x22'),'appdata':util[_0xfbd4('0x10')](_0xfbd4('0x23'),_0x3b03f5['name'])});}else{_0x3fc0e4[_0xfbd4('0xb')]({'app':_0xfbd4('0x22'),'appdata':util[_0xfbd4('0x10')]('SIP/%s,,tTxX',_0x3b03f5['name'])});}_0x3fc0e4[_0xfbd4('0xb')]({'app':_0xfbd4('0x24')});for(var _0x2ea997=0x0;_0x2ea997<_0x3fc0e4[_0xfbd4('0x7')];_0x2ea997++){_0x3fc0e4[_0x2ea997][_0xfbd4('0x25')]=_0x2ea997+0x1;_0x3fc0e4[_0x2ea997]=_[_0xfbd4('0x26')](_0x3fc0e4[_0x2ea997],_0x2431ed);}return _0x3fc0e4;};var getChanSpyPromise=function(_0xc86842,_0x8829e0){return new BPromise(function(_0x4fb428,_0x3392a2){return _0xc86842[_0xfbd4('0x27')][_0xfbd4('0x28')]()[_0xfbd4('0x29')](function(_0x47d351){if(_0x47d351){var _0xef4465=getChanSpyApplications(_0x8829e0,_0x8829e0[_0xfbd4('0x2a')],_0x47d351);if(_0x8829e0[_0xfbd4('0x2a')]!=_0x8829e0[_0xfbd4('0x16')]){_0xef4465=_0xef4465[_0xfbd4('0x2b')](getChanSpyApplications(_0x8829e0,_0x8829e0[_0xfbd4('0x16')],_0x47d351));}return _0x4fb428(_0xef4465);}return _0x4fb428([]);})[_0xfbd4('0x2c')](function(_0x1cee35){_0x3392a2(_0x1cee35);});});};module[_0xfbd4('0x2d')]=function(_0x42c8f3){var _0x197ae5=_0x42c8f3['models'];return _0x42c8f3[_0xfbd4('0x2e')](_0xfbd4('0x2f'),attributes,{'tableName':_0xfbd4('0x30'),'charset':_0xfbd4('0x31'),'collate':_0xfbd4('0x32'),'hooks':{'beforeCreate':function(_0xb64911,_0x34c3b7,_0xd784fc){var _0xf07900=typeof _0xb64911[_0xfbd4('0x33')]===_0xfbd4('0x34')?BPromise['resolve'](null):_0x197ae5[_0xfbd4('0x35')]['find']({'where':{'id':_0xb64911['userProfileId']}});_0xf07900['then'](function(_0x1ad957){if(_0x1ad957){_0xb64911[_0xfbd4('0x36')]=_0x1ad957['privacyEnabled'];}})[_0xfbd4('0x29')](function(){_0xb64911['updateMd5Password']();_0xb64911[_0xfbd4('0x37')](_0xd784fc);})[_0xfbd4('0x2c')](function(_0x1a1409){_0xd784fc(_0x1a1409);});},'beforeUpdate':function(_0x124e3c,_0x57344e,_0x17ac31){Promise[_0xfbd4('0x38')]()['then'](function(){if(_0x124e3c[_0xfbd4('0x39')]('userProfileId')===![])return;return _0x197ae5[_0xfbd4('0x35')][_0xfbd4('0x3a')]({'where':{'id':_0x124e3c[_0xfbd4('0x33')]}})[_0xfbd4('0x29')](function(_0x4a60e6){if(_0x4a60e6)_0x124e3c[_0xfbd4('0x36')]=_0x4a60e6[_0xfbd4('0x36')];return;});})[_0xfbd4('0x29')](function(){if(_0x124e3c[_0xfbd4('0x39')](_0xfbd4('0x13'))){_0x124e3c[_0xfbd4('0x3b')]();return _0x124e3c[_0xfbd4('0x37')](_0x17ac31);}_0x17ac31();})[_0xfbd4('0x2c')](function(_0x36ac8e){_0x17ac31(_0x36ac8e);});},'afterCreate':function(_0x394168,_0x6deb50,_0x3550ad){var _0x20e2a6=getUserApplications(_0x394168,_0x394168[_0xfbd4('0x2a')]);if(_0x394168[_0xfbd4('0x2a')]!=_0x394168[_0xfbd4('0x16')]){_0x20e2a6=_0x20e2a6[_0xfbd4('0x2b')](getUserApplications(_0x394168,_0x394168[_0xfbd4('0x16')]));}return Promise['resolve']()[_0xfbd4('0x29')](function(){if(!_0x394168['userSetting']){return _0x394168['createUserSetting']({'clientSideLoggingLevel':'error','clientSideLoggingEnabled':![]});}})[_0xfbd4('0x29')](function(){return _0x197ae5[_0xfbd4('0x3c')][_0xfbd4('0x3d')](_0x20e2a6);})['then'](function(){if(_0x394168[_0xfbd4('0x3e')]){return getChanSpyPromise(_0x197ae5,_0x394168);}})[_0xfbd4('0x29')](function(_0x5b382c){if(_0x5b382c&&_0x5b382c[_0xfbd4('0x7')]){return _0x197ae5['VoiceExtension'][_0xfbd4('0x3d')](_0x5b382c);}})['then'](function(){_0x3550ad();})['catch'](function(_0x12c3e9){_0x3550ad(_0x12c3e9);});},'afterUpdate':function(_0x1d7dd6,_0x1c285a,_0x4f075a){return BPromise['resolve']()[_0xfbd4('0x29')](function(){if(_0x1d7dd6[_0xfbd4('0x39')](_0xfbd4('0x3e'))||_0x1d7dd6[_0xfbd4('0x39')]('context')){return _0x197ae5['VoiceExtension'][_0xfbd4('0x3f')]({'where':{'UserId':_0x1d7dd6['id'],'type':_0xfbd4('0x1d'),'ChanSpyId':{'$ne':null}}})['then'](function(){if(_0x1d7dd6[_0xfbd4('0x3e')]){return getChanSpyPromise(_0x197ae5,_0x1d7dd6)['then'](function(_0x39aa26){if(_0x39aa26&&_0x39aa26[_0xfbd4('0x7')]){return _0x197ae5[_0xfbd4('0x3c')]['bulkCreate'](_0x39aa26);}});}});}})[_0xfbd4('0x29')](function(){if(_0x1d7dd6['changed']('extensionMonitor')||_0x1d7dd6[_0xfbd4('0x39')](_0xfbd4('0x1c'))){return _0x197ae5[_0xfbd4('0x3c')][_0xfbd4('0x3f')]({'where':{'UserId':_0x1d7dd6['id'],'type':'system','ChanSpyId':null}})[_0xfbd4('0x29')](function(){var _0x3adae0=getUserApplications(_0x1d7dd6,_0x1d7dd6[_0xfbd4('0x2a')]);if(_0x1d7dd6['internal']!=_0x1d7dd6[_0xfbd4('0x16')]){_0x3adae0=_0x3adae0[_0xfbd4('0x2b')](getUserApplications(_0x1d7dd6,_0x1d7dd6['name']));}return _0x197ae5[_0xfbd4('0x3c')][_0xfbd4('0x3d')](_0x3adae0);});}})[_0xfbd4('0x29')](function(){_0x4f075a();})['catch'](function(_0x480006){_0x4f075a(_0x480006);});},'afterDestroy':function(_0x4a76f3){return _0x197ae5[_0xfbd4('0x3c')]['destroy']({'where':{'UserId':_0x4a76f3['id'],'type':_0xfbd4('0x1d')}});}},'instanceMethods':{'authenticate':function(_0x115e36,_0x25c529){if(!_0x25c529){return this['password']===this['encryptPassword'](_0x115e36);}var _0x1471a5=this;this[_0xfbd4('0x40')](_0x115e36,function(_0x435a4d,_0x21149f){if(_0x435a4d){_0x25c529(_0x435a4d);}if(_0x1471a5[_0xfbd4('0x13')]===_0x21149f){_0x25c529(null,!![]);}else{_0x25c529(null,![]);}});},'makeSalt':function(_0x1be8b0,_0xa15ebe){var _0x40c0e6=0x10;if(typeof arguments[0x0]==='function'){_0xa15ebe=arguments[0x0];_0x1be8b0=_0x40c0e6;}else if(typeof arguments[0x1]===_0xfbd4('0x41')){_0xa15ebe=arguments[0x1];}else{throw new Error(_0xfbd4('0x42'));}if(!_0x1be8b0){_0x1be8b0=_0x40c0e6;}return crypto['randomBytes'](_0x1be8b0,function(_0x3d8c72,_0x1f8648){if(_0x3d8c72){_0xa15ebe(_0x3d8c72);}return _0xa15ebe(null,_0x1f8648[_0xfbd4('0x43')](_0xfbd4('0x44')));});},'encryptPassword':function(_0x4e5894,_0x30a7bf){if(!_0x4e5894||!this[_0xfbd4('0x45')]){return _0x30a7bf?_0x30a7bf(null):null;}var _0x4d0238=0x2710;var _0x55aa26=0x40;var _0x541282=Buffer[_0xfbd4('0x46')](this[_0xfbd4('0x45')],_0xfbd4('0x44'));if(!_0x30a7bf){return crypto['pbkdf2Sync'](_0x4e5894,_0x541282,_0x4d0238,_0x55aa26,_0xfbd4('0x47'))[_0xfbd4('0x43')](_0xfbd4('0x44'));}return crypto['pbkdf2'](_0x4e5894,_0x541282,_0x4d0238,_0x55aa26,'sha1',function(_0x21ac81,_0x3d6ce4){if(_0x21ac81){_0x30a7bf(_0x21ac81);}return _0x30a7bf(null,_0x3d6ce4['toString'](_0xfbd4('0x44')));});},'updatePassword':function(_0x36f654){if(!this['password']){return _0x36f654(null);}if(!validatePresenceOf(this[_0xfbd4('0x13')])&&authTypes[_0xfbd4('0x48')](this[_0xfbd4('0x49')])===-0x1){_0x36f654(new Error(_0xfbd4('0x4a')));}var _0x32aa25=this;this[_0xfbd4('0x4b')](function(_0x311ba2,_0x28bc98){if(_0x311ba2){return _0x36f654(_0x311ba2);}_0x32aa25[_0xfbd4('0x45')]=_0x28bc98;_0x32aa25['encryptPassword'](_0x32aa25[_0xfbd4('0x13')],function(_0x49742d,_0x5f5841){if(_0x49742d){_0x36f654(_0x49742d);}_0x32aa25['password']=_0x5f5841;_0x36f654(null);});});},'updateMd5Password':function(){this[_0xfbd4('0x4c')]=md5(this['name']+_0xfbd4('0x4d')+this['password']);return this[_0xfbd4('0x4c')];},'getRealtimeData':function(){var _0x1c8ad0={'id':this['id']};var _0x10bef5=jayson['client'][_0xfbd4('0x4e')]({'port':0x232a});var _0x3547c0=jayson[_0xfbd4('0x4f')][_0xfbd4('0x4e')]({'port':0x232c});var _0x5e1c13={};var _0x3b58d1={};return _0x10bef5['request'](_0xfbd4('0x50'),_0x1c8ad0)[_0xfbd4('0x29')](function(_0x52c65d){if(_0x52c65d[_0xfbd4('0x51')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agent\x20(AMI)');}_0x5e1c13=_0x52c65d[_0xfbd4('0x52')];return _0x3547c0[_0xfbd4('0x53')](_0xfbd4('0x50'),_0x1c8ad0);})[_0xfbd4('0x29')](function(_0x15ae20){if(_0x15ae20['error']){throw new Error(_0xfbd4('0x54'));}_0x3b58d1=_0x15ae20[_0xfbd4('0x52')];var _0x3e90c7=_[_0xfbd4('0xf')]({},_0x5e1c13,_0x3b58d1);return _0x3e90c7;})['catch'](function(_0x27e1be){throw _0x27e1be;});},'unpause':function(_0x2f8130,_0x5706d4=_0xfbd4('0x55')){var _0x2f7121=this;var _0x14dbef={};return Promise[_0xfbd4('0x38')]()['then'](function(){if(!_0x2f8130||_0x2f8130==='voice'&&_0x5706d4===_0xfbd4('0x55')){var _0x2d799f=jayson[_0xfbd4('0x4f')][_0xfbd4('0x4e')]({'port':0x232a});return _0x2d799f[_0xfbd4('0x53')](_0xfbd4('0x56'),{'id':_0x2f7121['id'],'name':_0x2f7121[_0xfbd4('0x16')],'pause':![]})[_0xfbd4('0x29')](function(_0x58bccc){if(_0x58bccc[_0xfbd4('0x51')]){throw new Error(util[_0xfbd4('0x10')]('Unable\x20to\x20unpause\x20agent\x20%s:$s',_0x2f7121['id'],_0x2f7121[_0xfbd4('0x16')]));}return _0x58bccc[_0xfbd4('0x52')]['message'];});}})[_0xfbd4('0x29')](function(){if(!_0x2f8130||_0x2f8130===_0xfbd4('0x57')){return _0x197ae5[_0xfbd4('0x58')]['update']({'paused':0x0},{'where':{'UserId':_0x2f7121['id']},'individualHooks':!![]});}})[_0xfbd4('0x29')](function(){var _0x141448=!_0x2f8130?_0xfbd4('0x28'):_0xfbd4('0x59');return _0x197ae5[_0xfbd4('0x5a')][_0x141448]({'where':{'channel':_0x2f8130,'membername':_0x2f7121[_0xfbd4('0x16')],'type':_0xfbd4('0x5b'),'exitAt':null}});})[_0xfbd4('0x29')](function(_0x6666ac){if(_0x6666ac){var _0x148e6c=Array['isArray'](_0x6666ac)?_0x6666ac:[_0x6666ac];var _0x3671e4=_0x148e6c[_0xfbd4('0x5c')](function(_0x364f1f){return _0x364f1f['update']({'exitAt':moment()['format'](_0xfbd4('0x5d')),'data2':_0x5706d4});});return Promise[_0xfbd4('0x5e')](_0x3671e4);}})[_0xfbd4('0x29')](function(){if(!_0x2f8130){_0x14dbef[_0xfbd4('0x5f')]=![];_0x14dbef[_0xfbd4('0x60')]=![];_0x14dbef['chatPause']=![];_0x14dbef[_0xfbd4('0x61')]=![];_0x14dbef[_0xfbd4('0x62')]=![];_0x14dbef['whatsappPause']=![];_0x14dbef[_0xfbd4('0x63')]=![];}else{_0x14dbef[_0x2f8130+'Pause']=![];}return _0x2f7121['getRealtimeData']();})[_0xfbd4('0x29')](function(_0x4adf20){var _0xa0d8cb=require(_0xfbd4('0x64'));var _0x58ceda=_0xa0d8cb['getChannels']();_0x58ceda[_0xfbd4('0x65')](function(_0x48d4e3){var _0x301775=_0x48d4e3+'Status';_0x2f7121['setDataValue']([_0x301775],_0x4adf20[_0x301775]);});return _0x2f7121[_0xfbd4('0x66')](_0x14dbef);})[_0xfbd4('0x2c')](function(_0x2885f8){throw _0x2885f8;});}}});};
\ No newline at end of file
+var _0x4b73=['CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','name','options','wav','WAV','gsm','from-sip','extensionMonitor','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=%s','Dial','SIP/%s,,tTxXU(xcally-mixmonitor-context)','SIP/%s,,tTxX','Hangup','priority','VoiceChanSpy','findAll','internal','concat','catch','exports','models','define','User','users','utf8_bin','userProfileId','undefined','UserProfile','find','then','privacyEnabled','updateMd5Password','updatePassword','resolve','changed','userSetting','createUserSetting','error','VoiceExtension','bulkCreate','destroy','system','encryptPassword','function','toString','base64','salt','pbkdf2Sync','sha1','pbkdf2','provider','Invalid\x20password','makeSalt','md5secret',':asterisk:','bluebird','crypto','util','md5','./user.attributes','google','length','context','format','%s%s','merge','Set'];(function(_0x5762dd,_0xea8ad1){var _0x1a65bd=function(_0x2253e2){while(--_0x2253e2){_0x5762dd['push'](_0x5762dd['shift']());}};_0x1a65bd(++_0xea8ad1);}(_0x4b73,0x8c));var _0x34b7=function(_0x402bfa,_0xa06308){_0x402bfa=_0x402bfa-0x0;var _0x3227ea=_0x4b73[_0x402bfa];return _0x3227ea;};'use strict';var BPromise=require(_0x34b7('0x0'));var crypto=require(_0x34b7('0x1'));var util=require(_0x34b7('0x2'));var md5=require(_0x34b7('0x3'));var _=require('lodash');var attributes=require(_0x34b7('0x4'));var authTypes=[_0x34b7('0x5')];var validatePresenceOf=function(_0x3c099e){return _0x3c099e&&_0x3c099e[_0x34b7('0x6')];};var getChanSpyApplications=function(_0x29081d,_0x214104,_0x4e315e){var _0x379cb7={'context':_0x29081d[_0x34b7('0x7')]||'from-sip','type':'system','isApp':![],'UserId':_0x29081d['id']};var _0x23aaa1=[];for(var _0x47d620=0x0,_0xad9244=0x1;_0x47d620<_0x4e315e[_0x34b7('0x6')];_0x47d620++,_0xad9244=0x1){var _0x4ef56e={'exten':util[_0x34b7('0x8')](_0x34b7('0x9'),_0x4e315e[_0x47d620]['prefix'],_0x214104),'ChanSpyId':_0x4e315e[_0x47d620]['id']};_0x23aaa1['push'](_[_0x34b7('0xa')]({'app':_0x34b7('0xb'),'appdata':util[_0x34b7('0x8')](_0x34b7('0xc'),_0x34b7('0xd')),'priority':_0xad9244++},_0x379cb7,_0x4ef56e));if(_0x4e315e[_0x47d620][_0x34b7('0xe')]){_0x23aaa1[_0x34b7('0xf')](_[_0x34b7('0xa')]({'app':_0x34b7('0x10'),'appdata':util['format'](_0x34b7('0x11'),_0x4e315e[_0x47d620][_0x34b7('0x12')]),'priority':_0xad9244++},_0x379cb7,_0x4ef56e));}if(_0x4e315e[_0x47d620]['auth']){_0x23aaa1[_0x34b7('0xf')](_[_0x34b7('0xa')]({'app':'Authenticate','appdata':_0x4e315e[_0x47d620][_0x34b7('0x13')],'priority':_0xad9244++},_0x379cb7,_0x4ef56e));}_0x23aaa1[_0x34b7('0xf')](_['merge']({'app':_0x34b7('0x14'),'appdata':util['format']('SIP/%s,%s',_0x29081d[_0x34b7('0x15')],_0x4e315e[_0x47d620]['options']?_0x4e315e[_0x47d620][_0x34b7('0x16')]['join'](''):''),'priority':_0xad9244++},_0x379cb7,_0x4ef56e));if(_0x4e315e[_0x47d620][_0x34b7('0xe')]){_0x23aaa1[_0x34b7('0xf')](_['merge']({'app':'StopMixMonitor','priority':_0xad9244++},_0x379cb7,_0x4ef56e));}}return _0x23aaa1;};var getUserApplications=function(_0xa52d52,_0x1ca674){var _0x26c2fa=[_0x34b7('0x17'),_0x34b7('0x18'),_0x34b7('0x19')];var _0x5ff9c8={'context':_0xa52d52[_0x34b7('0x7')]||_0x34b7('0x1a'),'exten':_0x1ca674,'type':'system','isApp':![],'UserId':_0xa52d52['id']};var _0x1ecb95=[{'app':'Set','appdata':'CDR(type)=internal'}];if(_0xa52d52[_0x34b7('0x1b')]&&_['includes'](_0x26c2fa,_0xa52d52['extensionMonitor'])){_0x1ecb95[_0x34b7('0xf')]({'app':_0x34b7('0xb'),'appdata':_0x34b7('0x1c')});_0x1ecb95['push']({'app':'Set','appdata':util[_0x34b7('0x8')](_0x34b7('0x1d'),_0xa52d52['extensionMonitor'])});_0x1ecb95[_0x34b7('0xf')]({'app':_0x34b7('0x1e'),'appdata':util[_0x34b7('0x8')](_0x34b7('0x1f'),_0xa52d52[_0x34b7('0x15')])});}else{_0x1ecb95['push']({'app':_0x34b7('0x1e'),'appdata':util[_0x34b7('0x8')](_0x34b7('0x20'),_0xa52d52[_0x34b7('0x15')])});}_0x1ecb95[_0x34b7('0xf')]({'app':_0x34b7('0x21')});for(var _0xf67c7a=0x0;_0xf67c7a<_0x1ecb95[_0x34b7('0x6')];_0xf67c7a++){_0x1ecb95[_0xf67c7a][_0x34b7('0x22')]=_0xf67c7a+0x1;_0x1ecb95[_0xf67c7a]=_['defaults'](_0x1ecb95[_0xf67c7a],_0x5ff9c8);}return _0x1ecb95;};var getChanSpyPromise=function(_0x3ee937,_0x26cdad){return new BPromise(function(_0x589c52,_0x25309e){return _0x3ee937[_0x34b7('0x23')][_0x34b7('0x24')]()['then'](function(_0x31d59c){if(_0x31d59c){var _0x351b70=getChanSpyApplications(_0x26cdad,_0x26cdad[_0x34b7('0x25')],_0x31d59c);if(_0x26cdad[_0x34b7('0x25')]!=_0x26cdad['name']){_0x351b70=_0x351b70[_0x34b7('0x26')](getChanSpyApplications(_0x26cdad,_0x26cdad[_0x34b7('0x15')],_0x31d59c));}return _0x589c52(_0x351b70);}return _0x589c52([]);})[_0x34b7('0x27')](function(_0x123646){_0x25309e(_0x123646);});});};module[_0x34b7('0x28')]=function(_0x41f2b5){var _0x5cfe56=_0x41f2b5[_0x34b7('0x29')];return _0x41f2b5[_0x34b7('0x2a')](_0x34b7('0x2b'),attributes,{'tableName':_0x34b7('0x2c'),'charset':'utf8','collate':_0x34b7('0x2d'),'hooks':{'beforeCreate':function(_0x53e36c,_0x56df55,_0x28df90){var _0x249dcf=typeof _0x53e36c[_0x34b7('0x2e')]===_0x34b7('0x2f')?BPromise['resolve'](null):_0x5cfe56[_0x34b7('0x30')][_0x34b7('0x31')]({'where':{'id':_0x53e36c[_0x34b7('0x2e')]}});_0x249dcf[_0x34b7('0x32')](function(_0x3f5187){if(_0x3f5187){_0x53e36c[_0x34b7('0x33')]=_0x3f5187[_0x34b7('0x33')];}})[_0x34b7('0x32')](function(){_0x53e36c[_0x34b7('0x34')]();_0x53e36c[_0x34b7('0x35')](_0x28df90);})[_0x34b7('0x27')](function(_0x40d943){_0x28df90(_0x40d943);});},'beforeUpdate':function(_0x4e7920,_0x3d0169,_0x3965ab){Promise[_0x34b7('0x36')]()['then'](function(){if(_0x4e7920[_0x34b7('0x37')](_0x34b7('0x2e'))===![])return;return _0x5cfe56[_0x34b7('0x30')][_0x34b7('0x31')]({'where':{'id':_0x4e7920['userProfileId']}})['then'](function(_0x4e3982){if(_0x4e3982)_0x4e7920[_0x34b7('0x33')]=_0x4e3982[_0x34b7('0x33')];return;});})[_0x34b7('0x32')](function(){if(_0x4e7920['changed'](_0x34b7('0x13'))){_0x4e7920['updateMd5Password']();return _0x4e7920['updatePassword'](_0x3965ab);}_0x3965ab();})['catch'](function(_0x2abcd0){_0x3965ab(_0x2abcd0);});},'afterCreate':function(_0x379a28,_0x587998,_0x563707){var _0x12987e=getUserApplications(_0x379a28,_0x379a28[_0x34b7('0x25')]);if(_0x379a28[_0x34b7('0x25')]!=_0x379a28[_0x34b7('0x15')]){_0x12987e=_0x12987e[_0x34b7('0x26')](getUserApplications(_0x379a28,_0x379a28[_0x34b7('0x15')]));}return Promise[_0x34b7('0x36')]()['then'](function(){if(!_0x379a28[_0x34b7('0x38')]){return _0x379a28[_0x34b7('0x39')]({'clientSideLoggingLevel':_0x34b7('0x3a'),'clientSideLoggingEnabled':![]});}})[_0x34b7('0x32')](function(){return _0x5cfe56[_0x34b7('0x3b')][_0x34b7('0x3c')](_0x12987e);})[_0x34b7('0x32')](function(){if(_0x379a28['chanspy']){return getChanSpyPromise(_0x5cfe56,_0x379a28);}})[_0x34b7('0x32')](function(_0x51b7a9){if(_0x51b7a9&&_0x51b7a9[_0x34b7('0x6')]){return _0x5cfe56[_0x34b7('0x3b')][_0x34b7('0x3c')](_0x51b7a9);}})['then'](function(){_0x563707();})[_0x34b7('0x27')](function(_0x1bf2e0){_0x563707(_0x1bf2e0);});},'afterUpdate':function(_0x48d03e,_0x188828,_0x1516d3){return BPromise[_0x34b7('0x36')]()['then'](function(){if(_0x48d03e['changed'](_0x34b7('0xd'))||_0x48d03e[_0x34b7('0x37')](_0x34b7('0x7'))){return _0x5cfe56[_0x34b7('0x3b')]['destroy']({'where':{'UserId':_0x48d03e['id'],'type':'system','ChanSpyId':{'$ne':null}}})['then'](function(){if(_0x48d03e[_0x34b7('0xd')]){return getChanSpyPromise(_0x5cfe56,_0x48d03e)['then'](function(_0x1052a5){if(_0x1052a5&&_0x1052a5['length']){return _0x5cfe56[_0x34b7('0x3b')][_0x34b7('0x3c')](_0x1052a5);}});}});}})[_0x34b7('0x32')](function(){if(_0x48d03e[_0x34b7('0x37')](_0x34b7('0x1b'))||_0x48d03e[_0x34b7('0x37')]('context')){return _0x5cfe56[_0x34b7('0x3b')][_0x34b7('0x3d')]({'where':{'UserId':_0x48d03e['id'],'type':_0x34b7('0x3e'),'ChanSpyId':null}})[_0x34b7('0x32')](function(){var _0x4d7f81=getUserApplications(_0x48d03e,_0x48d03e['internal']);if(_0x48d03e[_0x34b7('0x25')]!=_0x48d03e['name']){_0x4d7f81=_0x4d7f81[_0x34b7('0x26')](getUserApplications(_0x48d03e,_0x48d03e[_0x34b7('0x15')]));}return _0x5cfe56['VoiceExtension'][_0x34b7('0x3c')](_0x4d7f81);});}})[_0x34b7('0x32')](function(){_0x1516d3();})[_0x34b7('0x27')](function(_0x4e1535){_0x1516d3(_0x4e1535);});},'afterDestroy':function(_0x556132){return _0x5cfe56[_0x34b7('0x3b')][_0x34b7('0x3d')]({'where':{'UserId':_0x556132['id'],'type':_0x34b7('0x3e')}});}},'instanceMethods':{'authenticate':function(_0x4ede24,_0xd5a767){if(!_0xd5a767){return this[_0x34b7('0x13')]===this[_0x34b7('0x3f')](_0x4ede24);}var _0x13fb5e=this;this['encryptPassword'](_0x4ede24,function(_0x44bb82,_0x2436f8){if(_0x44bb82){_0xd5a767(_0x44bb82);}if(_0x13fb5e[_0x34b7('0x13')]===_0x2436f8){_0xd5a767(null,!![]);}else{_0xd5a767(null,![]);}});},'makeSalt':function(_0x5428cd,_0x5d075d){var _0x4204bc=0x10;if(typeof arguments[0x0]===_0x34b7('0x40')){_0x5d075d=arguments[0x0];_0x5428cd=_0x4204bc;}else if(typeof arguments[0x1]==='function'){_0x5d075d=arguments[0x1];}else{throw new Error('Missing\x20Callback');}if(!_0x5428cd){_0x5428cd=_0x4204bc;}return crypto['randomBytes'](_0x5428cd,function(_0x3c739d,_0x511fad){if(_0x3c739d){_0x5d075d(_0x3c739d);}return _0x5d075d(null,_0x511fad[_0x34b7('0x41')](_0x34b7('0x42')));});},'encryptPassword':function(_0x523e4e,_0x2e2b0f){if(!_0x523e4e||!this[_0x34b7('0x43')]){return _0x2e2b0f?_0x2e2b0f(null):null;}var _0x4682a0=0x2710;var _0x47b269=0x40;var _0x9a49fa=new Buffer(this[_0x34b7('0x43')],_0x34b7('0x42'));if(!_0x2e2b0f){return crypto[_0x34b7('0x44')](_0x523e4e,_0x9a49fa,_0x4682a0,_0x47b269,_0x34b7('0x45'))['toString']('base64');}return crypto[_0x34b7('0x46')](_0x523e4e,_0x9a49fa,_0x4682a0,_0x47b269,_0x34b7('0x45'),function(_0x3c920a,_0x13a19d){if(_0x3c920a){_0x2e2b0f(_0x3c920a);}return _0x2e2b0f(null,_0x13a19d[_0x34b7('0x41')](_0x34b7('0x42')));});},'updatePassword':function(_0x3e969f){if(!this[_0x34b7('0x13')]){return _0x3e969f(null);}if(!validatePresenceOf(this['password'])&&authTypes['indexOf'](this[_0x34b7('0x47')])===-0x1){_0x3e969f(new Error(_0x34b7('0x48')));}var _0x17a031=this;this[_0x34b7('0x49')](function(_0x1e5f56,_0x4f3611){if(_0x1e5f56){return _0x3e969f(_0x1e5f56);}_0x17a031[_0x34b7('0x43')]=_0x4f3611;_0x17a031[_0x34b7('0x3f')](_0x17a031[_0x34b7('0x13')],function(_0xf4512b,_0x4d86fb){if(_0xf4512b){_0x3e969f(_0xf4512b);}_0x17a031['password']=_0x4d86fb;_0x3e969f(null);});});},'updateMd5Password':function(){this[_0x34b7('0x4a')]=md5(this[_0x34b7('0x15')]+_0x34b7('0x4b')+this['password']);return this[_0x34b7('0x4a')];}}});};
\ No newline at end of file
index f50f250..7e7db84 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb476=['type','DEFAULT\x20PAUSE','role','bulkCreate','UnpauseUser','isValidChannel','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','mailPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','system','LogoutUser','destroy','length','all','phone','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','getChannels','LOGIN','callysquare','loginInPause','merge','concat','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','where','attributes','limit','include','model','map','info','debug','stringify','catch','error','message','ShowUser','find','raw','then','PauseUser','internal','interface','UserVoiceQueueRt','update','MemberReport','name','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','format','SIP/%s','PAUSE','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb476,0x126));var _0x6b47=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0xb476[_0x673722];return _0x21249c;};'use strict';var _=require(_0x6b47('0x0'));var util=require('util');var moment=require(_0x6b47('0x1'));var BPromise=require(_0x6b47('0x2'));var Redis=require(_0x6b47('0x3'));var db=require(_0x6b47('0x4'))['db'];var utils=require(_0x6b47('0x5'));var logger=require(_0x6b47('0x6'))(_0x6b47('0x7'));var config=require(_0x6b47('0x8'));config[_0x6b47('0x9')]=_[_0x6b47('0xa')](config[_0x6b47('0x9')],{'host':_0x6b47('0xb'),'port':0x18eb});var socket=require(_0x6b47('0xc'))(new Redis(config[_0x6b47('0x9')]));require(_0x6b47('0xd'))[_0x6b47('0xe')](socket);exports[_0x6b47('0xf')]=function(_0x52c96a){var _0x55b23e=this;return new Promise(function(_0x2042da,_0xdb5a44){return db[_0x6b47('0x10')][_0x6b47('0x11')]({'raw':_0x52c96a[_0x6b47('0x12')]?_0x52c96a[_0x6b47('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x52c96a[_0x6b47('0x12')]?_0x52c96a[_0x6b47('0x12')][_0x6b47('0x13')]||null:null,'attributes':_0x52c96a['options']?_0x52c96a[_0x6b47('0x12')][_0x6b47('0x14')]||null:null,'limit':_0x52c96a[_0x6b47('0x12')]?_0x52c96a['options'][_0x6b47('0x15')]||null:null,'include':_0x52c96a[_0x6b47('0x12')]?_0x52c96a[_0x6b47('0x12')][_0x6b47('0x16')]?_['map'](_0x52c96a[_0x6b47('0x12')][_0x6b47('0x16')],function(_0x2fb3f0){return{'model':db[_0x2fb3f0[_0x6b47('0x17')]],'as':_0x2fb3f0['as'],'attributes':_0x2fb3f0['attributes'],'include':_0x2fb3f0[_0x6b47('0x16')]?_[_0x6b47('0x18')](_0x2fb3f0[_0x6b47('0x16')],function(_0x5bebf8){return{'model':db[_0x5bebf8[_0x6b47('0x17')]],'as':_0x5bebf8['as'],'attributes':_0x5bebf8[_0x6b47('0x14')],'include':_0x5bebf8[_0x6b47('0x16')]?_[_0x6b47('0x18')](_0x5bebf8[_0x6b47('0x16')],function(_0x4af675){return{'model':db[_0x4af675[_0x6b47('0x17')]],'as':_0x4af675['as'],'attributes':_0x4af675[_0x6b47('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c4405){logger[_0x6b47('0x19')](_0x6b47('0xf'),_0x52c96a);logger[_0x6b47('0x1a')]('GetUser',_0x52c96a,JSON[_0x6b47('0x1b')](_0x1c4405));_0x2042da(_0x1c4405);})[_0x6b47('0x1c')](function(_0x26f62a){logger[_0x6b47('0x1d')]('GetUser',_0x26f62a[_0x6b47('0x1e')],_0x52c96a);_0xdb5a44(_0x55b23e['error'](0x1f4,_0x26f62a[_0x6b47('0x1e')]));});});};exports[_0x6b47('0x1f')]=function(_0x188b17){var _0x26c2ea=this;return new Promise(function(_0x3bd2b9,_0x13a52b){return db['User'][_0x6b47('0x20')]({'raw':_0x188b17[_0x6b47('0x12')]?_0x188b17[_0x6b47('0x12')][_0x6b47('0x21')]===undefined?!![]:![]:!![],'where':_0x188b17[_0x6b47('0x12')]?_0x188b17[_0x6b47('0x12')][_0x6b47('0x13')]||null:null,'attributes':_0x188b17['options']?_0x188b17[_0x6b47('0x12')][_0x6b47('0x14')]||null:null,'include':_0x188b17[_0x6b47('0x12')]?_0x188b17['options'][_0x6b47('0x16')]?_[_0x6b47('0x18')](_0x188b17['options'][_0x6b47('0x16')],function(_0x559d0d){return{'model':db[_0x559d0d[_0x6b47('0x17')]],'as':_0x559d0d['as'],'attributes':_0x559d0d[_0x6b47('0x14')],'include':_0x559d0d['include']?_[_0x6b47('0x18')](_0x559d0d['include'],function(_0x185723){return{'model':db[_0x185723[_0x6b47('0x17')]],'as':_0x185723['as'],'attributes':_0x185723['attributes'],'include':_0x185723[_0x6b47('0x16')]?_['map'](_0x185723[_0x6b47('0x16')],function(_0x703e2d){return{'model':db[_0x703e2d['model']],'as':_0x703e2d['as'],'attributes':_0x703e2d[_0x6b47('0x14')]};}):[]};}):[]};}):[]:[]})[_0x6b47('0x22')](function(_0xc093db){logger[_0x6b47('0x19')](_0x6b47('0x1f'),_0x188b17);logger[_0x6b47('0x1a')]('ShowUser',_0x188b17,JSON['stringify'](_0xc093db));_0x3bd2b9(_0xc093db);})[_0x6b47('0x1c')](function(_0x14fa05){logger[_0x6b47('0x1d')]('ShowUser',_0x14fa05[_0x6b47('0x1e')],_0x188b17);_0x13a52b(_0x26c2ea['error'](0x1f4,_0x14fa05[_0x6b47('0x1e')]));});});};exports[_0x6b47('0x23')]=function(_0x36a63e){var _0x5dff8a=this;return new Promise(function(_0x17b2d4,_0xc127ef){var _0xb4a345;return db[_0x6b47('0x10')][_0x6b47('0x20')]({'where':_0x36a63e[_0x6b47('0x12')]['where']||{},'attributes':['id','name','role',_0x6b47('0x24'),_0x6b47('0x25')]})[_0x6b47('0x22')](function(_0x5731c3){if(_0x5731c3){_0xb4a345=_0x5731c3;return db[_0x6b47('0x26')][_0x6b47('0x27')]({'paused':0x1},{'where':{'UserId':_0xb4a345['id']},'individualHooks':!![]});}})[_0x6b47('0x22')](function(){if(_0xb4a345){return db[_0x6b47('0x28')][_0x6b47('0x11')]({'where':{'membername':_0xb4a345[_0x6b47('0x29')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0xb477b1){if(_0xb4a345){if(_0xb477b1&&_0xb477b1['length']){var _0x5dd6ff=moment()['format'](_0x6b47('0x2a'));for(var _0x33b1a7=0x0,_0x4685b5=_0xb477b1['length'];_0x33b1a7<_0x4685b5;_0x33b1a7++){_0xb477b1[_0x33b1a7][_0x6b47('0x2b')]({'exitAt':_0x5dd6ff});}}}})[_0x6b47('0x22')](function(){if(_0xb4a345){var _0x548bfa=[];var _0x468b37=utils['getChannels']();_0x468b37[_0x6b47('0x2c')](function(_0x2f31f2){_0x548bfa[_0x6b47('0x2d')]({'channel':_0x2f31f2,'membername':_0xb4a345[_0x6b47('0x29')],'interface':_['isNil'](_0xb4a345[_0x6b47('0x25')])?util[_0x6b47('0x2e')](_0x6b47('0x2f'),_0xb4a345[_0x6b47('0x29')]):_0xb4a345['interface'],'type':_0x6b47('0x30'),'enterAt':moment()['format'](_0x6b47('0x2a')),'data1':_0x36a63e[_0x6b47('0x31')][_0x6b47('0x32')]||_0x6b47('0x33'),'role':_0xb4a345[_0x6b47('0x34')],'internal':_0xb4a345[_0x6b47('0x24')],'uniqueid':_0x36a63e['body']['uniqueid']||null});});return db[_0x6b47('0x28')][_0x6b47('0x35')](_0x548bfa,{'individualHooks':!![]});}})[_0x6b47('0x22')](function(){if(_0xb4a345){return _0xb4a345[_0x6b47('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x36a63e['body'][_0x6b47('0x32')]||_0x6b47('0x33'),'lastPauseAt':moment()[_0x6b47('0x2e')](_0x6b47('0x2a'))});}})[_0x6b47('0x22')](function(_0x5c57bf){_0x17b2d4(_0x5c57bf);})['catch'](function(_0x8e73a7){_0xc127ef(_0x5dff8a[_0x6b47('0x1d')](0x1f4,_0x8e73a7['message']));});});};exports[_0x6b47('0x36')]=function(_0x2585d2){var _0x269271=this;return new Promise(function(_0x3091e9,_0x5cda08){if(_0x2585d2[_0x6b47('0x31')]['channel']&&!utils[_0x6b47('0x37')](_0x2585d2['body'][_0x6b47('0x38')])){throw new Error(util[_0x6b47('0x2e')](_0x6b47('0x39'),_0x2585d2[_0x6b47('0x31')][_0x6b47('0x38')]));}return db[_0x6b47('0x10')][_0x6b47('0x3a')]({'where':_0x2585d2[_0x6b47('0x12')]['where']||{},'attributes':['id',_0x6b47('0x29'),_0x6b47('0x34'),_0x6b47('0x24'),_0x6b47('0x25'),_0x6b47('0x3b'),'voicePause',_0x6b47('0x3c'),'chatPause','faxPause','openchannelPause','smsPause',_0x6b47('0x3d'),_0x6b47('0x3e'),_0x6b47('0x3f')]})[_0x6b47('0x22')](function(_0x57f5b6){if(!_0x57f5b6){throw new Error(util[_0x6b47('0x2e')](_0x6b47('0x40'),_0x2585d2['params']['id']));}return _0x57f5b6[_0x6b47('0x41')](_0x2585d2[_0x6b47('0x31')][_0x6b47('0x38')],_0x6b47('0x42'));})[_0x6b47('0x22')](function(_0x53eb4c){_0x3091e9(_0x53eb4c);})[_0x6b47('0x1c')](function(_0x26aed5){_0x5cda08(_0x269271[_0x6b47('0x1d')](0x1f4,_0x26aed5['message']));});});};exports[_0x6b47('0x43')]=function(_0x2d06fb){var _0x132dce=this;return new Promise(function(_0x261eee,_0x35b4fb){var _0x294fad;return db[_0x6b47('0x10')][_0x6b47('0x3a')]({'where':_0x2d06fb[_0x6b47('0x12')][_0x6b47('0x13')]||{},'attributes':['id',_0x6b47('0x29')]})['then'](function(_0x356f42){if(_0x356f42){_0x294fad=_0x356f42;return db['UserVoiceQueueRt'][_0x6b47('0x44')]({'where':{'membername':_0x294fad[_0x6b47('0x29')]},'individualHooks':!![]});}})[_0x6b47('0x22')](function(){if(_0x294fad){return db[_0x6b47('0x28')][_0x6b47('0x11')]({'where':{'membername':_0x294fad['name'],'exitAt':null}});}})[_0x6b47('0x22')](function(_0x531506){if(_0x294fad){if(_0x531506&&_0x531506[_0x6b47('0x45')]){var _0x516457=[];_0x531506['forEach'](function(_0x1e4367){_0x516457[_0x6b47('0x2d')](_0x1e4367[_0x6b47('0x27')]({'exitAt':moment()['format'](_0x6b47('0x2a'))}));});return BPromise[_0x6b47('0x46')](_0x516457);}}})[_0x6b47('0x22')](function(){if(_0x294fad){return _0x294fad[_0x6b47('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x6b47('0x22')](function(_0x4bffa8){_0x261eee(_0x4bffa8);})['catch'](function(_0x2ae522){_0x35b4fb(_0x132dce[_0x6b47('0x1d')](0x1f4,_0x2ae522[_0x6b47('0x1e')]));});});};exports['LoginUser']=function(_0x4f55db){var _0x5f554f=this;return new Promise(function(_0x31d07b,_0x25415a){var _0x18b7a0;var _0x3ac30b;var _0x38ee42;var _0x14e22d;return db[_0x6b47('0x10')]['findOne']({'where':_0x4f55db['options']['where']||{},'attributes':['id',_0x6b47('0x29'),_0x6b47('0x34'),'mobile',_0x6b47('0x47'),_0x6b47('0x24'),'loginInPause',_0x6b47('0x25')]})[_0x6b47('0x22')](function(_0x58608a){if(_0x58608a){_0x18b7a0=_0x58608a;_0x14e22d=_0x4f55db['body'][_0x6b47('0x25')]?_0x4f55db[_0x6b47('0x31')][_0x6b47('0x25')]:util[_0x6b47('0x2e')](_0x6b47('0x2f'),_0x18b7a0[_0x6b47('0x29')]);return db[_0x6b47('0x10')][_0x6b47('0x48')]({'where':{'role':_0x6b47('0x49'),'online':!![],'id':{'$ne':_0x18b7a0['id']}}});}})['then'](function(_0x57bb27){if(_0x57bb27){_0x38ee42=_0x57bb27;return require(_0x6b47('0x4a'))[_0x6b47('0x4b')]();}})[_0x6b47('0x22')](function(_0x1ff5a9){if(_0x1ff5a9&&_0x1ff5a9[_0x6b47('0x4c')]&&_0x38ee42>=_0x1ff5a9[_0x6b47('0x4c')]){throw new Error(_0x6b47('0x4d'));}})[_0x6b47('0x22')](function(){if(_0x18b7a0){return db[_0x6b47('0x26')][_0x6b47('0x44')]({'where':{'membername':_0x18b7a0[_0x6b47('0x29')]},'individualHooks':!![]});}})[_0x6b47('0x22')](function(){if(_0x18b7a0){return _0x18b7a0[_0x6b47('0x4e')]({'raw':!![]});}})['then'](function(_0x3b4e88){if(_0x18b7a0){if(_0x3b4e88){var _0x4ddaf6=[];_0x3ac30b=_0x3b4e88;if(_0x3ac30b[_0x6b47('0x45')]){for(var _0x49893b=0x0;_0x49893b<_0x3ac30b[_0x6b47('0x45')];_0x49893b++){_0x4ddaf6[_0x6b47('0x2d')](db[_0x6b47('0x26')][_0x6b47('0x4f')]({'membername':_0x18b7a0[_0x6b47('0x29')],'UserId':_0x18b7a0['id'],'queue_name':_0x3ac30b[_0x49893b][_0x6b47('0x29')],'VoiceQueueId':_0x3ac30b[_0x49893b]['id'],'interface':_0x14e22d,'paused':_0x18b7a0['loginInPause']||![],'penalty':_0x3ac30b[_0x49893b]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x6b47('0x46')](_0x4ddaf6);}}}})['then'](function(){if(_0x18b7a0){return db[_0x6b47('0x28')][_0x6b47('0x11')]({'where':{'membername':_0x18b7a0['name'],'exitAt':null}});}})['then'](function(_0x1f5b00){if(_0x18b7a0){if(_0x1f5b00&&_0x1f5b00[_0x6b47('0x45')]){var _0x3bc570=[];_0x1f5b00[_0x6b47('0x2c')](function(_0x5a90ab){_0x3bc570[_0x6b47('0x2d')](_0x5a90ab[_0x6b47('0x27')]({'exitAt':moment()[_0x6b47('0x2e')](_0x6b47('0x2a'))}));});return BPromise['all'](_0x3bc570);}}})['then'](function(){if(_0x18b7a0){var _0x4d2cdd=[];var _0x3b0027=[];var _0x2a3bf2=utils[_0x6b47('0x50')]();var _0x395a4c={'membername':_0x18b7a0['name'],'interface':_0x14e22d,'enterAt':moment()[_0x6b47('0x2e')](_0x6b47('0x2a')),'role':_0x18b7a0[_0x6b47('0x34')],'internal':_0x18b7a0[_0x6b47('0x24')]};_0x2a3bf2[_0x6b47('0x2c')](function(_0x435222){_0x4d2cdd[_0x6b47('0x2d')](_['merge']({'channel':_0x435222,'type':_0x6b47('0x51'),'data1':_0x6b47('0x52'),'data2':_0x14e22d},_0x395a4c));if(_0x18b7a0[_0x6b47('0x53')]){_0x3b0027['push'](_[_0x6b47('0x54')]({'channel':_0x435222,'type':'PAUSE','data1':'LOGININPAUSE'},_0x395a4c));}});return db[_0x6b47('0x28')]['bulkCreate'](_0x4d2cdd[_0x6b47('0x55')](_0x3b0027),{'individualHooks':!![]});}})[_0x6b47('0x22')](function(){if(_0x18b7a0){return _0x18b7a0[_0x6b47('0x27')]({'online':!![],'lastLoginAt':moment()[_0x6b47('0x2e')](_0x6b47('0x2a')),'voicePause':_0x18b7a0[_0x6b47('0x53')]||![],'mailPause':_0x18b7a0['loginInPause']||![],'chatPause':_0x18b7a0[_0x6b47('0x53')]||![],'faxPause':_0x18b7a0[_0x6b47('0x53')]||![],'smsPause':_0x18b7a0[_0x6b47('0x53')]||![],'openchannelPause':_0x18b7a0[_0x6b47('0x53')]||![],'pauseType':_0x18b7a0[_0x6b47('0x53')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x6b47('0x2e')](_0x6b47('0x2a')),'interface':_0x14e22d});}})['then'](function(_0x1aa119){_0x31d07b(_0x1aa119);})[_0x6b47('0x1c')](function(_0x251092){_0x25415a(_0x5f554f[_0x6b47('0x1d')](0x1f4,_0x251092[_0x6b47('0x1e')]));});});};
\ No newline at end of file
+var _0xde3e=['GetUser','options','raw','where','limit','include','map','attributes','model','User','find','ShowUser','PauseUser','name','role','interface','UserVoiceQueueRt','update','MemberReport','findAll','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','internal','uniqueid','isValidChannel','channel','Unknown\x20channel','voice','system','chat','sms','set','%s%s','push','all','LogoutUser','findOne','destroy','mobile','phone','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','merge','callysquare','LOGININPAUSE','bulkCreate','concat','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xde3e,0x1af));var _0xede3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xde3e[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xede3('0x0'));var util=require(_0xede3('0x1'));var moment=require(_0xede3('0x2'));var BPromise=require(_0xede3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xede3('0x4'));var db=require(_0xede3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xede3('0x6'))('rpc');var config=require(_0xede3('0x7'));var jayson=require(_0xede3('0x8'));var client=jayson[_0xede3('0x9')][_0xede3('0xa')]({'port':0x232a});config['redis']=_[_0xede3('0xb')](config[_0xede3('0xc')],{'host':_0xede3('0xd'),'port':0x18eb});var socket=require(_0xede3('0xe'))(new Redis(config[_0xede3('0xc')]));require(_0xede3('0xf'))[_0xede3('0x10')](socket);function respondWithRpcPromise(_0x51fa1b,_0x4bb1e4,_0x5e78dd){return new BPromise(function(_0x1c93c7,_0x33f8a5){return client[_0xede3('0x11')](_0x51fa1b,_0x5e78dd)[_0xede3('0x12')](function(_0x3857bd){logger[_0xede3('0x13')](_0xede3('0x14'),_0x4bb1e4,_0xede3('0x15'));logger[_0xede3('0x16')]('User,\x20%s,\x20%s,\x20%s',_0x4bb1e4,'request\x20sent',JSON[_0xede3('0x17')](_0x3857bd));if(_0x3857bd[_0xede3('0x18')]){if(_0x3857bd[_0xede3('0x18')][_0xede3('0x19')]===0x1f4){logger['error'](_0xede3('0x14'),_0x4bb1e4,_0x3857bd[_0xede3('0x18')]['message']);return _0x33f8a5(_0x3857bd['error']['message']);}logger['error'](_0xede3('0x14'),_0x4bb1e4,_0x3857bd[_0xede3('0x18')]['message']);return _0x1c93c7(_0x3857bd[_0xede3('0x18')][_0xede3('0x1a')]);}else{logger['info'](_0xede3('0x14'),_0x4bb1e4,'request\x20sent');_0x1c93c7(_0x3857bd[_0xede3('0x1b')][_0xede3('0x1a')]);}})[_0xede3('0x1c')](function(_0x283a75){logger[_0xede3('0x18')]('User,\x20%s,\x20%s',_0x4bb1e4,_0x283a75);_0x33f8a5(_0x283a75);});});}exports[_0xede3('0x1d')]=function(_0x30f653){var _0x3061fb=this;return new Promise(function(_0xc4faae,_0x4071cf){return db['User']['findAll']({'raw':_0x30f653[_0xede3('0x1e')]?_0x30f653[_0xede3('0x1e')][_0xede3('0x1f')]===undefined?!![]:![]:!![],'where':_0x30f653[_0xede3('0x1e')]?_0x30f653['options'][_0xede3('0x20')]||null:null,'attributes':_0x30f653[_0xede3('0x1e')]?_0x30f653[_0xede3('0x1e')]['attributes']||null:null,'limit':_0x30f653[_0xede3('0x1e')]?_0x30f653[_0xede3('0x1e')][_0xede3('0x21')]||null:null,'include':_0x30f653[_0xede3('0x1e')]?_0x30f653[_0xede3('0x1e')][_0xede3('0x22')]?_[_0xede3('0x23')](_0x30f653['options'][_0xede3('0x22')],function(_0x253707){return{'model':db[_0x253707['model']],'as':_0x253707['as'],'attributes':_0x253707[_0xede3('0x24')],'include':_0x253707['include']?_[_0xede3('0x23')](_0x253707[_0xede3('0x22')],function(_0x17285b){return{'model':db[_0x17285b[_0xede3('0x25')]],'as':_0x17285b['as'],'attributes':_0x17285b[_0xede3('0x24')],'include':_0x17285b[_0xede3('0x22')]?_[_0xede3('0x23')](_0x17285b['include'],function(_0x43027c){return{'model':db[_0x43027c[_0xede3('0x25')]],'as':_0x43027c['as'],'attributes':_0x43027c[_0xede3('0x24')]};}):[]};}):[]};}):[]:[]})[_0xede3('0x12')](function(_0x23acd6){logger[_0xede3('0x13')](_0xede3('0x1d'),_0x30f653);logger[_0xede3('0x16')](_0xede3('0x1d'),_0x30f653,JSON['stringify'](_0x23acd6));_0xc4faae(_0x23acd6);})[_0xede3('0x1c')](function(_0x656b0c){logger['error'](_0xede3('0x1d'),_0x656b0c[_0xede3('0x1a')],_0x30f653);_0x4071cf(_0x3061fb[_0xede3('0x18')](0x1f4,_0x656b0c[_0xede3('0x1a')]));});});};exports['ShowUser']=function(_0x198856){var _0x3d52fe=this;return new Promise(function(_0x5859a9,_0x59cfa0){return db[_0xede3('0x26')][_0xede3('0x27')]({'raw':_0x198856[_0xede3('0x1e')]?_0x198856[_0xede3('0x1e')][_0xede3('0x1f')]===undefined?!![]:![]:!![],'where':_0x198856[_0xede3('0x1e')]?_0x198856[_0xede3('0x1e')][_0xede3('0x20')]||null:null,'attributes':_0x198856[_0xede3('0x1e')]?_0x198856[_0xede3('0x1e')][_0xede3('0x24')]||null:null,'include':_0x198856[_0xede3('0x1e')]?_0x198856['options'][_0xede3('0x22')]?_[_0xede3('0x23')](_0x198856[_0xede3('0x1e')][_0xede3('0x22')],function(_0x43466b){return{'model':db[_0x43466b[_0xede3('0x25')]],'as':_0x43466b['as'],'attributes':_0x43466b[_0xede3('0x24')],'include':_0x43466b[_0xede3('0x22')]?_[_0xede3('0x23')](_0x43466b[_0xede3('0x22')],function(_0x4044f3){return{'model':db[_0x4044f3[_0xede3('0x25')]],'as':_0x4044f3['as'],'attributes':_0x4044f3[_0xede3('0x24')],'include':_0x4044f3[_0xede3('0x22')]?_[_0xede3('0x23')](_0x4044f3[_0xede3('0x22')],function(_0x9451e1){return{'model':db[_0x9451e1[_0xede3('0x25')]],'as':_0x9451e1['as'],'attributes':_0x9451e1[_0xede3('0x24')]};}):[]};}):[]};}):[]:[]})[_0xede3('0x12')](function(_0x3d17ef){logger[_0xede3('0x13')](_0xede3('0x28'),_0x198856);logger['debug'](_0xede3('0x28'),_0x198856,JSON['stringify'](_0x3d17ef));_0x5859a9(_0x3d17ef);})[_0xede3('0x1c')](function(_0x5b18cb){logger['error'](_0xede3('0x28'),_0x5b18cb[_0xede3('0x1a')],_0x198856);_0x59cfa0(_0x3d52fe['error'](0x1f4,_0x5b18cb['message']));});});};exports[_0xede3('0x29')]=function(_0x21f669){var _0x5ac8ee=this;return new Promise(function(_0x5bc2ff,_0x878b0b){var _0x4afcf7;return db[_0xede3('0x26')][_0xede3('0x27')]({'where':_0x21f669['options'][_0xede3('0x20')]||{},'attributes':['id',_0xede3('0x2a'),_0xede3('0x2b'),'internal',_0xede3('0x2c')]})[_0xede3('0x12')](function(_0x249f1d){if(_0x249f1d){_0x4afcf7=_0x249f1d;return db[_0xede3('0x2d')][_0xede3('0x2e')]({'paused':0x1},{'where':{'UserId':_0x4afcf7['id']},'individualHooks':!![]});}})['then'](function(){if(_0x4afcf7){return db[_0xede3('0x2f')][_0xede3('0x30')]({'where':{'membername':_0x4afcf7[_0xede3('0x2a')],'type':_0xede3('0x31'),'exitAt':null}});}})[_0xede3('0x12')](function(_0x26db3a){if(_0x4afcf7){if(_0x26db3a&&_0x26db3a[_0xede3('0x32')]){var _0x212cef=moment()[_0xede3('0x33')](_0xede3('0x34'));for(var _0x2e077b=0x0,_0x379541=_0x26db3a[_0xede3('0x32')];_0x2e077b<_0x379541;_0x2e077b++){_0x26db3a[_0x2e077b][_0xede3('0x35')]({'exitAt':_0x212cef});}}}})[_0xede3('0x12')](function(){if(_0x4afcf7){var _0x3d4c89=[];var _0x28a02d=utils[_0xede3('0x36')]();_0x28a02d[_0xede3('0x37')](function(_0x49c24f){_0x3d4c89['push']({'channel':_0x49c24f,'membername':_0x4afcf7[_0xede3('0x2a')],'interface':_[_0xede3('0x38')](_0x4afcf7[_0xede3('0x2c')])?util['format'](_0xede3('0x39'),_0x4afcf7[_0xede3('0x2a')]):_0x4afcf7['interface'],'type':_0xede3('0x31'),'enterAt':moment()[_0xede3('0x33')](_0xede3('0x34')),'data1':_0x21f669[_0xede3('0x3a')][_0xede3('0x3b')]||_0xede3('0x3c'),'role':_0x4afcf7['role'],'internal':_0x4afcf7[_0xede3('0x3d')],'uniqueid':_0x21f669['body'][_0xede3('0x3e')]||null});});return db[_0xede3('0x2f')]['bulkCreate'](_0x3d4c89,{'individualHooks':!![]});}})[_0xede3('0x12')](function(){if(_0x4afcf7){return _0x4afcf7[_0xede3('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x21f669[_0xede3('0x3a')][_0xede3('0x3b')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xede3('0x33')](_0xede3('0x34'))});}})['then'](function(_0x52becf){_0x5bc2ff(_0x52becf);})['catch'](function(_0x2329cf){_0x878b0b(_0x5ac8ee[_0xede3('0x18')](0x1f4,_0x2329cf['message']));});});};exports['UnpauseUser']=function(_0x2f8fb5){var _0x262b53=this;return new Promise(function(_0x4dc0f7,_0x13f496){var _0x5756bc;return db[_0xede3('0x26')]['findOne']({'where':_0x2f8fb5[_0xede3('0x1e')][_0xede3('0x20')]||{},'attributes':['id',_0xede3('0x2a')]})[_0xede3('0x12')](function(_0x576187){if(_0x576187){_0x5756bc=_0x576187;if(_0x2f8fb5[_0xede3('0x3a')]['channel']&&!utils[_0xede3('0x3f')](_0x2f8fb5[_0xede3('0x3a')][_0xede3('0x40')])){throw new Error(_0xede3('0x41'));}switch(_0x2f8fb5[_0xede3('0x3a')]['channel']){case _0xede3('0x42'):return db['UserVoiceQueueRt'][_0xede3('0x2e')]({'paused':0x0},{'where':{'UserId':_0x5756bc['id']}})[_0xede3('0x12')](function(){return db[_0xede3('0x2f')][_0xede3('0x27')]({'where':{'channel':_0x2f8fb5[_0xede3('0x3a')][_0xede3('0x40')],'membername':_0x5756bc[_0xede3('0x2a')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x15d902){if(_0x15d902){return _0x15d902[_0xede3('0x2e')]({'exitAt':moment()[_0xede3('0x33')](_0xede3('0x34')),'data2':_0xede3('0x43')},{'individualHooks':!![]});}return null;})[_0xede3('0x12')](function(){return _0x5756bc[_0xede3('0x2e')]({'voicePause':![]});});case'mail':case _0xede3('0x44'):case'fax':case _0xede3('0x45'):case'openchannel':case'whatsapp':return db[_0xede3('0x2f')][_0xede3('0x27')]({'where':{'channel':_0x2f8fb5[_0xede3('0x3a')][_0xede3('0x40')],'membername':_0x5756bc[_0xede3('0x2a')],'type':_0xede3('0x31'),'exitAt':null}})['then'](function(_0x51d119){return _0x51d119[_0xede3('0x2e')]({'exitAt':moment()[_0xede3('0x33')](_0xede3('0x34')),'data2':_0xede3('0x43')},{'individualHooks':!![]});})['then'](function(){var _0x210ce4={};_[_0xede3('0x46')](_0x210ce4,util[_0xede3('0x33')](_0xede3('0x47'),_0x2f8fb5[_0xede3('0x3a')][_0xede3('0x40')],'Pause'),![]);return _0x5756bc[_0xede3('0x2e')](_0x210ce4);});default:return db[_0xede3('0x2d')]['update']({'paused':0x0},{'where':{'UserId':_0x5756bc['id']}})[_0xede3('0x12')](function(){return db['MemberReport'][_0xede3('0x30')]({'where':{'membername':_0x5756bc[_0xede3('0x2a')],'type':_0xede3('0x31'),'exitAt':null}});})[_0xede3('0x12')](function(_0xa6d913){var _0xb6c26d=[];_0xa6d913[_0xede3('0x37')](function(_0x3c9d43){_0xb6c26d[_0xede3('0x48')](_0x3c9d43[_0xede3('0x2e')]({'exitAt':moment()[_0xede3('0x33')](_0xede3('0x34')),'data2':'system'}));});return BPromise[_0xede3('0x49')](_0xb6c26d);})['then'](function(){return _0x5756bc['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xede3('0x12')](function(_0x24e3b9){_0x4dc0f7(_0x24e3b9);})[_0xede3('0x1c')](function(_0x426228){_0x13f496(_0x262b53[_0xede3('0x18')](0x1f4,_0x426228[_0xede3('0x1a')]));});});};exports[_0xede3('0x4a')]=function(_0x52d5a0){var _0x41c74d=this;return new Promise(function(_0x3ac700,_0x4373ef){var _0x494b7a;return db[_0xede3('0x26')][_0xede3('0x4b')]({'where':_0x52d5a0['options'][_0xede3('0x20')]||{},'attributes':['id',_0xede3('0x2a')]})[_0xede3('0x12')](function(_0x170d92){if(_0x170d92){_0x494b7a=_0x170d92;return db[_0xede3('0x2d')][_0xede3('0x4c')]({'where':{'membername':_0x494b7a[_0xede3('0x2a')]},'individualHooks':!![]});}})[_0xede3('0x12')](function(){if(_0x494b7a){return db[_0xede3('0x2f')][_0xede3('0x30')]({'where':{'membername':_0x494b7a[_0xede3('0x2a')],'exitAt':null}});}})['then'](function(_0x2016a3){if(_0x494b7a){if(_0x2016a3&&_0x2016a3[_0xede3('0x32')]){var _0x331c62=[];_0x2016a3[_0xede3('0x37')](function(_0x4a4bac){_0x331c62[_0xede3('0x48')](_0x4a4bac[_0xede3('0x2e')]({'exitAt':moment()['format'](_0xede3('0x34'))}));});return BPromise[_0xede3('0x49')](_0x331c62);}}})['then'](function(){if(_0x494b7a){return _0x494b7a[_0xede3('0x2e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x42fb31){_0x3ac700(_0x42fb31);})[_0xede3('0x1c')](function(_0x215d03){_0x4373ef(_0x41c74d['error'](0x1f4,_0x215d03[_0xede3('0x1a')]));});});};exports['LoginUser']=function(_0x3f74e0){var _0x3cf4a9=this;return new Promise(function(_0x1c4623,_0x1e9bd5){var _0x13a164;var _0x4ec8ae;var _0x17c164;var _0x404e8f;return db[_0xede3('0x26')][_0xede3('0x4b')]({'where':_0x3f74e0[_0xede3('0x1e')][_0xede3('0x20')]||{},'attributes':['id',_0xede3('0x2a'),'role',_0xede3('0x4d'),_0xede3('0x4e'),_0xede3('0x3d'),'loginInPause',_0xede3('0x2c')]})['then'](function(_0x5917f5){if(_0x5917f5){_0x13a164=_0x5917f5;_0x404e8f=_0x3f74e0[_0xede3('0x3a')]['interface']?_0x3f74e0['body'][_0xede3('0x2c')]:util[_0xede3('0x33')](_0xede3('0x39'),_0x13a164['name']);return db[_0xede3('0x26')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x13a164['id']}}});}})['then'](function(_0x4fa75a){if(_0x4fa75a){_0x17c164=_0x4fa75a;return require(_0xede3('0x4f'))[_0xede3('0x50')]();}})[_0xede3('0x12')](function(_0x243d38){if(_0x243d38&&_0x243d38[_0xede3('0x51')]&&_0x17c164>=_0x243d38['agents']){throw new Error(_0xede3('0x52'));}})['then'](function(){if(_0x13a164){return db[_0xede3('0x2d')]['destroy']({'where':{'membername':_0x13a164[_0xede3('0x2a')]},'individualHooks':!![]});}})[_0xede3('0x12')](function(){if(_0x13a164){return _0x13a164[_0xede3('0x53')]({'raw':!![]});}})['then'](function(_0x5b9727){if(_0x13a164){if(_0x5b9727){var _0x3e6387=[];_0x4ec8ae=_0x5b9727;if(_0x4ec8ae['length']){for(var _0x458e6e=0x0;_0x458e6e<_0x4ec8ae[_0xede3('0x32')];_0x458e6e++){_0x3e6387[_0xede3('0x48')](db[_0xede3('0x2d')][_0xede3('0x54')]({'membername':_0x13a164['name'],'UserId':_0x13a164['id'],'queue_name':_0x4ec8ae[_0x458e6e][_0xede3('0x2a')],'VoiceQueueId':_0x4ec8ae[_0x458e6e]['id'],'interface':_0x404e8f,'paused':_0x13a164[_0xede3('0x55')]||![],'penalty':_0x4ec8ae[_0x458e6e][_0xede3('0x56')]||0x0}));}return BPromise[_0xede3('0x49')](_0x3e6387);}}}})['then'](function(){if(_0x13a164){return db[_0xede3('0x2f')][_0xede3('0x30')]({'where':{'membername':_0x13a164[_0xede3('0x2a')],'exitAt':null}});}})[_0xede3('0x12')](function(_0x3a4b77){if(_0x13a164){if(_0x3a4b77&&_0x3a4b77['length']){var _0x332dab=[];_0x3a4b77[_0xede3('0x37')](function(_0x56ed9a){_0x332dab[_0xede3('0x48')](_0x56ed9a[_0xede3('0x2e')]({'exitAt':moment()['format'](_0xede3('0x34'))}));});return BPromise[_0xede3('0x49')](_0x332dab);}}})[_0xede3('0x12')](function(_0x434a96){if(_0x13a164){var _0x4e4d5e=[];var _0xda7bca=[];var _0x3fb500=utils[_0xede3('0x36')]();var _0x54b077={'membername':_0x13a164[_0xede3('0x2a')],'interface':_0x404e8f,'enterAt':moment()[_0xede3('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x13a164['role'],'internal':_0x13a164[_0xede3('0x3d')]};_0x3fb500['forEach'](function(_0x31431f){_0x4e4d5e[_0xede3('0x48')](_[_0xede3('0x57')]({'channel':_0x31431f,'type':'LOGIN','data1':_0xede3('0x58'),'data2':_0x404e8f},_0x54b077));if(_0x13a164['loginInPause']){_0xda7bca[_0xede3('0x48')](_[_0xede3('0x57')]({'channel':_0x31431f,'type':_0xede3('0x31'),'data1':_0xede3('0x59')},_0x54b077));}});return db[_0xede3('0x2f')][_0xede3('0x5a')](_0x4e4d5e[_0xede3('0x5b')](_0xda7bca),{'individualHooks':!![]});}})[_0xede3('0x12')](function(){if(_0x13a164){return _0x13a164['update']({'online':!![],'lastLoginAt':moment()['format'](_0xede3('0x34')),'voicePause':_0x13a164['loginInPause']||![],'mailPause':_0x13a164[_0xede3('0x55')]||![],'chatPause':_0x13a164[_0xede3('0x55')]||![],'faxPause':_0x13a164[_0xede3('0x55')]||![],'smsPause':_0x13a164[_0xede3('0x55')]||![],'openchannelPause':_0x13a164[_0xede3('0x55')]||![],'pauseType':_0x13a164[_0xede3('0x55')]?_0xede3('0x59'):null,'lastPauseAt':moment()[_0xede3('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x404e8f});}})[_0xede3('0x12')](function(_0x4a539a){_0x1c4623(_0x4a539a);})[_0xede3('0x1c')](function(_0x432b6d){_0x1e9bd5(_0x3cf4a9['error'](0x1f4,_0x432b6d['message']));});});};
\ No newline at end of file
index 4dcf9c9..3d6bef8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x602d=['user:','./user.events','save','remove','emit','removeListener','register','length'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x602d,0xe1));var _0xd602=function(_0x38210b,_0x9ed0b0){_0x38210b=_0x38210b-0x0;var _0x12d7b8=_0x602d[_0x38210b];return _0x12d7b8;};'use strict';var UserEvents=require(_0xd602('0x0'));var events=[_0xd602('0x1'),_0xd602('0x2'),'update'];function createListener(_0x3836f4,_0x152ad2){return function(_0x58a6f1){_0x152ad2[_0xd602('0x3')](_0x3836f4,_0x58a6f1);};}function removeListener(_0x278e15,_0x9de129){return function(){UserEvents[_0xd602('0x4')](_0x278e15,_0x9de129);};}exports[_0xd602('0x5')]=function(_0x54cbf8){for(var _0xe44ca=0x0,_0x131b06=events[_0xd602('0x6')];_0xe44ca<_0x131b06;_0xe44ca++){var _0x554674=events[_0xe44ca];var _0x32f1f5=createListener(_0xd602('0x7')+_0x554674,_0x54cbf8);UserEvents['on'](_0x554674,_0x32f1f5);}};
\ No newline at end of file
+var _0xe755=['remove','update','emit','user:','./user.events'];(function(_0x6824e4,_0x3be59a){var _0xccc831=function(_0x566e60){while(--_0x566e60){_0x6824e4['push'](_0x6824e4['shift']());}};_0xccc831(++_0x3be59a);}(_0xe755,0x90));var _0x5e75=function(_0x19564d,_0x4bff2f){_0x19564d=_0x19564d-0x0;var _0x5c4eb4=_0xe755[_0x19564d];return _0x5c4eb4;};'use strict';var UserEvents=require(_0x5e75('0x0'));var events=['save',_0x5e75('0x1'),_0x5e75('0x2')];function createListener(_0x247453,_0x3f76af){return function(_0x158c8b){_0x3f76af[_0x5e75('0x3')](_0x247453,_0x158c8b);};}function removeListener(_0xde7b63,_0xb8360f){return function(){UserEvents['removeListener'](_0xde7b63,_0xb8360f);};}exports['register']=function(_0x723000){for(var _0x76b288=0x0,_0x53b8e0=events['length'];_0x76b288<_0x53b8e0;_0x76b288++){var _0xda0957=events[_0x76b288];var _0x5c7b95=createListener(_0x5e75('0x4')+_0xda0957,_0x723000);UserEvents['on'](_0xda0957,_0x5c7b95);}};
\ No newline at end of file
index 20c9451..7c6cdef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x56d9a3,_0x388bab){var _0x2327f2=function(_0x37a4c3){while(--_0x37a4c3){_0x56d9a3['push'](_0x56d9a3['shift']());}};_0x2327f2(++_0x388bab);}(_0x70e0,0x17b));var _0x070e=function(_0x51b821,_0x572399){_0x51b821=_0x51b821-0x0;var _0x5a31b1=_0x70e0[_0x51b821];return _0x5a31b1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router;
\ No newline at end of file
+var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2233b7,_0x13838a){var _0xe993c7=function(_0x50ed52){while(--_0x50ed52){_0x2233b7['push'](_0x2233b7['shift']());}};_0xe993c7(++_0x13838a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xf34b0a,_0x11e116){_0xf34b0a=_0xf34b0a-0x0;var _0x5021e1=_0xcb91[_0xf34b0a];return _0x5021e1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router;
\ No newline at end of file
index fac146a..36301e9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0af1=['INTEGER'];(function(_0x48b2a7,_0x317a8d){var _0x5befca=function(_0x277af7){while(--_0x277af7){_0x48b2a7['push'](_0x48b2a7['shift']());}};_0x5befca(++_0x317a8d);}(_0x0af1,0x135));var _0x10af=function(_0x5ee388,_0x1a550c){_0x5ee388=_0x5ee388-0x0;var _0xaa9c8d=_0x0af1[_0x5ee388];return _0xaa9c8d;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x10af('0x0')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xfdb3=['sequelize','exports'];(function(_0x23064d,_0x164806){var _0x10ed79=function(_0x145c0f){while(--_0x145c0f){_0x23064d['push'](_0x23064d['shift']());}};_0x10ed79(++_0x164806);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x533dda,_0x1b0613){_0x533dda=_0x533dda-0x0;var _0xfe051=_0xfdb3[_0x533dda];return _0xfe051;};'use strict';var Sequelize=require(_0x3fdb('0x0'));module[_0x3fdb('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
index f8dbd23..848a127 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x94eb=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x2c2c3d,_0x4f154e){var _0x4ffbc1=function(_0x20b7e1){while(--_0x20b7e1){_0x2c2c3d['push'](_0x2c2c3d['shift']());}};_0x4ffbc1(++_0x4f154e);}(_0x94eb,0x81));var _0xb94e=function(_0x49de5f,_0x30141b){_0x49de5f=_0x49de5f-0x0;var _0x471d8d=_0x94eb[_0x49de5f];return _0x471d8d;};'use strict';var _=require(_0xb94e('0x0'));var util=require(_0xb94e('0x1'));var logger=require(_0xb94e('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb94e('0x3'));var rp=require(_0xb94e('0x4'));var fs=require('fs');var path=require(_0xb94e('0x5'));var rimraf=require(_0xb94e('0x6'));var config=require(_0xb94e('0x7'));var attributes=require(_0xb94e('0x8'));module[_0xb94e('0x9')]=function(_0x3e0bf1,_0x5b68e3){return _0x3e0bf1['define']('UserChatQueue',attributes,{'tableName':_0xb94e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xf1b3=['UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x1fe078,_0x3e1370){var _0x218a8c=function(_0x49aebd){while(--_0x49aebd){_0x1fe078['push'](_0x1fe078['shift']());}};_0x218a8c(++_0x3e1370);}(_0xf1b3,0x15e));var _0x3f1b=function(_0x5c91c0,_0x15d79f){_0x5c91c0=_0x5c91c0-0x0;var _0x5ec5cd=_0xf1b3[_0x5c91c0];return _0x5ec5cd;};'use strict';var _=require(_0x3f1b('0x0'));var util=require(_0x3f1b('0x1'));var logger=require(_0x3f1b('0x2'))(_0x3f1b('0x3'));var moment=require(_0x3f1b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f1b('0x5'));var rimraf=require(_0x3f1b('0x6'));var config=require(_0x3f1b('0x7'));var attributes=require(_0x3f1b('0x8'));module[_0x3f1b('0x9')]=function(_0x5692b9,_0x5a6700){return _0x5692b9['define'](_0x3f1b('0xa'),attributes,{'tableName':_0x3f1b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4db152f..33da44f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x66bb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x3b0271,_0x4cc818){var _0x1fb8fc=function(_0x3f3b63){while(--_0x3f3b63){_0x3b0271['push'](_0x3b0271['shift']());}};_0x1fb8fc(++_0x4cc818);}(_0x66bb,0x7b));var _0xb66b=function(_0xaacfd5,_0x214d8c){_0xaacfd5=_0xaacfd5-0x0;var _0x19fca1=_0x66bb[_0xaacfd5];return _0x19fca1;};'use strict';var _=require(_0xb66b('0x0'));var util=require(_0xb66b('0x1'));var moment=require(_0xb66b('0x2'));var BPromise=require(_0xb66b('0x3'));var rs=require(_0xb66b('0x4'));var fs=require('fs');var Redis=require(_0xb66b('0x5'));var db=require(_0xb66b('0x6'))['db'];var utils=require(_0xb66b('0x7'));var logger=require(_0xb66b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb66b('0x9'));var client=jayson[_0xb66b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12879d,_0x55fcba,_0x3563ad){return new BPromise(function(_0x4cee4e,_0x476cc4){return client['request'](_0x12879d,_0x3563ad)[_0xb66b('0xb')](function(_0x1b9005){logger[_0xb66b('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x55fcba,_0xb66b('0xd'));logger['debug'](_0xb66b('0xe'),_0x55fcba,_0xb66b('0xd'),JSON[_0xb66b('0xf')](_0x1b9005));if(_0x1b9005[_0xb66b('0x10')]){if(_0x1b9005['error']['code']===0x1f4){logger[_0xb66b('0x10')](_0xb66b('0x11'),_0x55fcba,_0x1b9005['error'][_0xb66b('0x12')]);return _0x476cc4(_0x1b9005[_0xb66b('0x10')][_0xb66b('0x12')]);}logger[_0xb66b('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x55fcba,_0x1b9005[_0xb66b('0x10')][_0xb66b('0x12')]);return _0x4cee4e(_0x1b9005['error'][_0xb66b('0x12')]);}else{logger[_0xb66b('0xc')](_0xb66b('0x11'),_0x55fcba,_0xb66b('0xd'));_0x4cee4e(_0x1b9005[_0xb66b('0x13')][_0xb66b('0x12')]);}})[_0xb66b('0x14')](function(_0x49f3d3){logger[_0xb66b('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x55fcba,_0x49f3d3);_0x476cc4(_0x49f3d3);});});}
\ No newline at end of file
+var _0x0299=['code','message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/environment','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x0299,0x82));var _0x9029=function(_0x54aaa6,_0x12432b){_0x54aaa6=_0x54aaa6-0x0;var _0x318048=_0x0299[_0x54aaa6];return _0x318048;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9029('0x0'));var BPromise=require(_0x9029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9029('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9029('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x9029('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9029('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1479d9,_0x237468,_0x1707c7){return new BPromise(function(_0x1b4553,_0xee0d43){return client[_0x9029('0x6')](_0x1479d9,_0x1707c7)[_0x9029('0x7')](function(_0x55f969){logger[_0x9029('0x8')](_0x9029('0x9'),_0x237468,_0x9029('0xa'));logger['debug'](_0x9029('0xb'),_0x237468,'request\x20sent',JSON[_0x9029('0xc')](_0x55f969));if(_0x55f969['error']){if(_0x55f969[_0x9029('0xd')][_0x9029('0xe')]===0x1f4){logger['error'](_0x9029('0x9'),_0x237468,_0x55f969[_0x9029('0xd')][_0x9029('0xf')]);return _0xee0d43(_0x55f969['error'][_0x9029('0xf')]);}logger['error'](_0x9029('0x9'),_0x237468,_0x55f969['error'][_0x9029('0xf')]);return _0x1b4553(_0x55f969[_0x9029('0xd')]['message']);}else{logger[_0x9029('0x8')](_0x9029('0x9'),_0x237468,_0x9029('0xa'));_0x1b4553(_0x55f969[_0x9029('0x10')][_0x9029('0xf')]);}})[_0x9029('0x11')](function(_0x2e8b0c){logger[_0x9029('0xd')](_0x9029('0x9'),_0x237468,_0x2e8b0c);_0xee0d43(_0x2e8b0c);});});}
\ No newline at end of file
index 7389db7..1ebc670 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2d991c,_0x1583d4){var _0x3d5af5=function(_0x4401aa){while(--_0x4401aa){_0x2d991c['push'](_0x2d991c['shift']());}};_0x3d5af5(++_0x1583d4);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router;
\ No newline at end of file
+var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x34f553,_0x5885f0){var _0x271bf2=function(_0x481545){while(--_0x481545){_0x34f553['push'](_0x34f553['shift']());}};_0x271bf2(++_0x5885f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router;
\ No newline at end of file
index 93d5daa..034b370 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa005=['sequelize','exports','INTEGER','STRING'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xa005,0x8c));var _0x5a00=function(_0x17e771,_0x55fd17){_0x17e771=_0x17e771-0x0;var _0x1f3a6d=_0xa005[_0x17e771];return _0x1f3a6d;};'use strict';var Sequelize=require(_0x5a00('0x0'));module[_0x5a00('0x1')]={'penalty':{'type':Sequelize[_0x5a00('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5a00('0x3')]}};
\ No newline at end of file
+var _0xb11d=['INTEGER','STRING','sequelize','exports'];(function(_0x19c76b,_0x3f0201){var _0x4d2a7b=function(_0x52a166){while(--_0x52a166){_0x19c76b['push'](_0x19c76b['shift']());}};_0x4d2a7b(++_0x3f0201);}(_0xb11d,0x1c2));var _0xdb11=function(_0x2df3ba,_0x439e64){_0x2df3ba=_0x2df3ba-0x0;var _0x556108=_0xb11d[_0x2df3ba];return _0x556108;};'use strict';var Sequelize=require(_0xdb11('0x0'));module[_0xdb11('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xdb11('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xdb11('0x3')]}};
\ No newline at end of file
index 7954c3a..4238813 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x746a=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues'];(function(_0x2f1e01,_0x3e3e19){var _0x5a1881=function(_0x31276e){while(--_0x31276e){_0x2f1e01['push'](_0x2f1e01['shift']());}};_0x5a1881(++_0x3e3e19);}(_0x746a,0xe4));var _0xa746=function(_0x55309b,_0x25680f){_0x55309b=_0x55309b-0x0;var _0x38afdb=_0x746a[_0x55309b];return _0x38afdb;};'use strict';var _=require(_0xa746('0x0'));var util=require(_0xa746('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa746('0x2'));var BPromise=require(_0xa746('0x3'));var rp=require(_0xa746('0x4'));var fs=require('fs');var path=require(_0xa746('0x5'));var rimraf=require(_0xa746('0x6'));var config=require(_0xa746('0x7'));var attributes=require(_0xa746('0x8'));module[_0xa746('0x9')]=function(_0x2f8e2a,_0x3a5842){return _0x2f8e2a['define'](_0xa746('0xa'),attributes,{'tableName':_0xa746('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd40d=['bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','api'];(function(_0x315f1a,_0x323780){var _0x5dc556=function(_0x15f9cb){while(--_0x15f9cb){_0x315f1a['push'](_0x315f1a['shift']());}};_0x5dc556(++_0x323780);}(_0xd40d,0x1ad));var _0xdd40=function(_0x14f5bd,_0x1efe54){_0x14f5bd=_0x14f5bd-0x0;var _0x4f234a=_0xd40d[_0x14f5bd];return _0x4f234a;};'use strict';var _=require(_0xdd40('0x0'));var util=require('util');var logger=require(_0xdd40('0x1'))(_0xdd40('0x2'));var moment=require('moment');var BPromise=require(_0xdd40('0x3'));var rp=require(_0xdd40('0x4'));var fs=require('fs');var path=require(_0xdd40('0x5'));var rimraf=require(_0xdd40('0x6'));var config=require(_0xdd40('0x7'));var attributes=require(_0xdd40('0x8'));module[_0xdd40('0x9')]=function(_0x23c975,_0x24acff){return _0x23c975['define'](_0xdd40('0xa'),attributes,{'tableName':_0xdd40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2572b00..b0f6726 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdd73=['debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','info','UserFaxQueue,\x20%s,\x20%s'];(function(_0x4288b2,_0x1e8867){var _0x38c6ff=function(_0x318093){while(--_0x318093){_0x4288b2['push'](_0x4288b2['shift']());}};_0x38c6ff(++_0x1e8867);}(_0xdd73,0x73));var _0x3dd7=function(_0x37c006,_0x1f647a){_0x37c006=_0x37c006-0x0;var _0x3f306e=_0xdd73[_0x37c006];return _0x3f306e;};'use strict';var _=require(_0x3dd7('0x0'));var util=require(_0x3dd7('0x1'));var moment=require(_0x3dd7('0x2'));var BPromise=require(_0x3dd7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dd7('0x4'));var db=require(_0x3dd7('0x5'))['db'];var utils=require(_0x3dd7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3dd7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3dd7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e20cc,_0x3a4ec2,_0x3f5774){return new BPromise(function(_0x104ae8,_0x4da093){return client['request'](_0x5e20cc,_0x3f5774)['then'](function(_0x1cb82a){logger[_0x3dd7('0x9')](_0x3dd7('0xa'),_0x3a4ec2,'request\x20sent');logger[_0x3dd7('0xb')](_0x3dd7('0xc'),_0x3a4ec2,_0x3dd7('0xd'),JSON[_0x3dd7('0xe')](_0x1cb82a));if(_0x1cb82a[_0x3dd7('0xf')]){if(_0x1cb82a[_0x3dd7('0xf')][_0x3dd7('0x10')]===0x1f4){logger['error'](_0x3dd7('0xa'),_0x3a4ec2,_0x1cb82a[_0x3dd7('0xf')][_0x3dd7('0x11')]);return _0x4da093(_0x1cb82a[_0x3dd7('0xf')]['message']);}logger[_0x3dd7('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x3a4ec2,_0x1cb82a[_0x3dd7('0xf')][_0x3dd7('0x11')]);return _0x104ae8(_0x1cb82a['error'][_0x3dd7('0x11')]);}else{logger['info'](_0x3dd7('0xa'),_0x3a4ec2,_0x3dd7('0xd'));_0x104ae8(_0x1cb82a['result'][_0x3dd7('0x11')]);}})['catch'](function(_0x3407b0){logger[_0x3dd7('0xf')](_0x3dd7('0xa'),_0x3a4ec2,_0x3407b0);_0x4da093(_0x3407b0);});});}
\ No newline at end of file
+var _0x4c5f=['code','message','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x54ff82,_0x2dc131){var _0x4ffc6a=function(_0x39ac58){while(--_0x39ac58){_0x54ff82['push'](_0x54ff82['shift']());}};_0x4ffc6a(++_0x2dc131);}(_0x4c5f,0x9c));var _0xf4c5=function(_0x446cde,_0x598102){_0x446cde=_0x446cde-0x0;var _0x114720=_0x4c5f[_0x446cde];return _0x114720;};'use strict';var _=require(_0xf4c5('0x0'));var util=require('util');var moment=require(_0xf4c5('0x1'));var BPromise=require(_0xf4c5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4c5('0x3'));var db=require(_0xf4c5('0x4'))['db'];var utils=require(_0xf4c5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf4c5('0x6'));var jayson=require(_0xf4c5('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14653d,_0x1cd6da,_0x50d05d){return new BPromise(function(_0x4fd5af,_0x47b2c9){return client[_0xf4c5('0x8')](_0x14653d,_0x50d05d)[_0xf4c5('0x9')](function(_0x3849d8){logger['info'](_0xf4c5('0xa'),_0x1cd6da,_0xf4c5('0xb'));logger[_0xf4c5('0xc')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1cd6da,'request\x20sent',JSON[_0xf4c5('0xd')](_0x3849d8));if(_0x3849d8[_0xf4c5('0xe')]){if(_0x3849d8['error'][_0xf4c5('0xf')]===0x1f4){logger[_0xf4c5('0xe')](_0xf4c5('0xa'),_0x1cd6da,_0x3849d8['error'][_0xf4c5('0x10')]);return _0x47b2c9(_0x3849d8[_0xf4c5('0xe')]['message']);}logger['error'](_0xf4c5('0xa'),_0x1cd6da,_0x3849d8['error'][_0xf4c5('0x10')]);return _0x4fd5af(_0x3849d8[_0xf4c5('0xe')][_0xf4c5('0x10')]);}else{logger[_0xf4c5('0x11')](_0xf4c5('0xa'),_0x1cd6da,'request\x20sent');_0x4fd5af(_0x3849d8['result']['message']);}})[_0xf4c5('0x12')](function(_0xf67b98){logger['error'](_0xf4c5('0xa'),_0x1cd6da,_0xf67b98);_0x47b2c9(_0xf67b98);});});}
\ No newline at end of file
index 898d41a..9d1c51a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4fb8e4,_0x4446dd){var _0x177a44=function(_0x730041){while(--_0x730041){_0x4fb8e4['push'](_0x4fb8e4['shift']());}};_0x177a44(++_0x4446dd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router;
\ No newline at end of file
+var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x53ba29,_0x24cbf5){var _0x17e219=function(_0x1c2544){while(--_0x1c2544){_0x53ba29['push'](_0x53ba29['shift']());}};_0x17e219(++_0x24cbf5);}(_0xe706,0xa3));var _0x6e70=function(_0xfd49ed,_0x1272e1){_0xfd49ed=_0xfd49ed-0x0;var _0x355f54=_0xe706[_0xfd49ed];return _0x355f54;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router;
\ No newline at end of file
index 3fb8d75..a0821ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb072=['exports','sequelize'];(function(_0x2dacca,_0x3b55a5){var _0x4e8745=function(_0x4c4515){while(--_0x4c4515){_0x2dacca['push'](_0x2dacca['shift']());}};_0x4e8745(++_0x3b55a5);}(_0xb072,0x1cd));var _0x2b07=function(_0x21ed54,_0x19f4b3){_0x21ed54=_0x21ed54-0x0;var _0x18ca9e=_0xb072[_0x21ed54];return _0x18ca9e;};'use strict';var Sequelize=require(_0x2b07('0x0'));module[_0x2b07('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
+var _0x00ce=['sequelize','exports','INTEGER'];(function(_0x46f5cf,_0x5b411d){var _0x4bcd74=function(_0x7f2b63){while(--_0x7f2b63){_0x46f5cf['push'](_0x46f5cf['shift']());}};_0x4bcd74(++_0x5b411d);}(_0x00ce,0x132));var _0xe00c=function(_0x26a97c,_0x514d61){_0x26a97c=_0x26a97c-0x0;var _0x2b06a0=_0x00ce[_0x26a97c];return _0x2b06a0;};'use strict';var Sequelize=require(_0xe00c('0x0'));module[_0xe00c('0x1')]={'penalty':{'type':Sequelize[_0xe00c('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index fd6a054..5c6e7b0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x66a2=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x66a2,0x1a2));var _0x266a=function(_0x41d862,_0x6c9e78){_0x41d862=_0x41d862-0x0;var _0x51bef4=_0x66a2[_0x41d862];return _0x51bef4;};'use strict';var _=require(_0x266a('0x0'));var util=require(_0x266a('0x1'));var logger=require(_0x266a('0x2'))('api');var moment=require(_0x266a('0x3'));var BPromise=require('bluebird');var rp=require(_0x266a('0x4'));var fs=require('fs');var path=require(_0x266a('0x5'));var rimraf=require(_0x266a('0x6'));var config=require('../../config/environment');var attributes=require(_0x266a('0x7'));module['exports']=function(_0x250ae2,_0x4eecd8){return _0x250ae2[_0x266a('0x8')](_0x266a('0x9'),attributes,{'tableName':_0x266a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x2aec=['rimraf','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','util','api','moment','bluebird','path'];(function(_0x39bc83,_0x4b1176){var _0x2501ea=function(_0x152f2a){while(--_0x152f2a){_0x39bc83['push'](_0x39bc83['shift']());}};_0x2501ea(++_0x4b1176);}(_0x2aec,0x170));var _0xc2ae=function(_0x56148f,_0x421ace){_0x56148f=_0x56148f-0x0;var _0x3b2a46=_0x2aec[_0x56148f];return _0x3b2a46;};'use strict';var _=require(_0xc2ae('0x0'));var util=require(_0xc2ae('0x1'));var logger=require('../../config/logger')(_0xc2ae('0x2'));var moment=require(_0xc2ae('0x3'));var BPromise=require(_0xc2ae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc2ae('0x5'));var rimraf=require(_0xc2ae('0x6'));var config=require('../../config/environment');var attributes=require(_0xc2ae('0x7'));module[_0xc2ae('0x8')]=function(_0x10fb42,_0x537c2a){return _0x10fb42[_0xc2ae('0x9')]('UserMailQueue',attributes,{'tableName':_0xc2ae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index b6ed274..1c46d33 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x008c,0x188));var _0xc008=function(_0x29548c,_0x21279f){_0x29548c=_0x29548c-0x0;var _0x3f6b63=_0x008c[_0x29548c];return _0x3f6b63;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}
\ No newline at end of file
+var _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result'];(function(_0x4fb8e4,_0x4446dd){var _0x177a44=function(_0x730041){while(--_0x730041){_0x4fb8e4['push'](_0x4fb8e4['shift']());}};_0x177a44(++_0x4446dd);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0xf3cd[_0x37cc52];return _0x2b4a90;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});}
\ No newline at end of file
index c101871..c6e11e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0046=['isAuthenticated','sendUserNotification','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x0046,0x11b));var _0x6004=function(_0x471938,_0x1aeff5){_0x471938=_0x471938-0x0;var _0x2c60eb=_0x0046[_0x471938];return _0x2c60eb;};'use strict';var multer=require(_0x6004('0x0'));var util=require(_0x6004('0x1'));var path=require('path');var timeout=require(_0x6004('0x2'));var express=require(_0x6004('0x3'));var router=express[_0x6004('0x4')]();var fs_extra=require(_0x6004('0x5'));var auth=require(_0x6004('0x6'));var interaction=require(_0x6004('0x7'));var config=require(_0x6004('0x8'));var controller=require(_0x6004('0x9'));router[_0x6004('0xa')]('/',auth[_0x6004('0xb')](),controller[_0x6004('0xc')]);module[_0x6004('0xd')]=router;
\ No newline at end of file
+var _0xc9f8=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','sendUserNotification','exports','path'];(function(_0x4d33d3,_0x4c3f5c){var _0x328233=function(_0x5d65a5){while(--_0x5d65a5){_0x4d33d3['push'](_0x4d33d3['shift']());}};_0x328233(++_0x4c3f5c);}(_0xc9f8,0x149));var _0x8c9f=function(_0x1d0e1d,_0x3c310b){_0x1d0e1d=_0x1d0e1d-0x0;var _0x86f0bc=_0xc9f8[_0x1d0e1d];return _0x86f0bc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8c9f('0x0'));var timeout=require(_0x8c9f('0x1'));var express=require(_0x8c9f('0x2'));var router=express[_0x8c9f('0x3')]();var fs_extra=require(_0x8c9f('0x4'));var auth=require(_0x8c9f('0x5'));var interaction=require(_0x8c9f('0x6'));var config=require(_0x8c9f('0x7'));var controller=require('./userNotification.controller');router[_0x8c9f('0x8')]('/',auth['isAuthenticated'](),controller[_0x8c9f('0x9')]);module[_0x8c9f('0xa')]=router;
\ No newline at end of file
index 73b8506..0620865 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1051=['BOOLEAN','sequelize','exports','TEXT'];(function(_0x3e6c19,_0x3c512f){var _0x4212ba=function(_0x2def8c){while(--_0x2def8c){_0x3e6c19['push'](_0x3e6c19['shift']());}};_0x4212ba(++_0x3c512f);}(_0x1051,0xa1));var _0x1105=function(_0x50536d,_0x310e0d){_0x50536d=_0x50536d-0x0;var _0xd48d5c=_0x1051[_0x50536d];return _0xd48d5c;};'use strict';var Sequelize=require(_0x1105('0x0'));module[_0x1105('0x1')]={'body':{'type':Sequelize[_0x1105('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x1105('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x1105('0x3')]}};
\ No newline at end of file
+var _0xc45c=['STRING','BOOLEAN','exports','TEXT'];(function(_0x1db184,_0xdfe3db){var _0x3df190=function(_0x34dbb4){while(--_0x34dbb4){_0x1db184['push'](_0x1db184['shift']());}};_0x3df190(++_0xdfe3db);}(_0xc45c,0x112));var _0xcc45=function(_0x2bff3d,_0x1ec1f4){_0x2bff3d=_0x2bff3d-0x0;var _0x56b1c4=_0xc45c[_0x2bff3d];return _0x56b1c4;};'use strict';var Sequelize=require('sequelize');module[_0xcc45('0x0')]={'body':{'type':Sequelize[_0xcc45('0x1')]},'senderName':{'type':Sequelize[_0xcc45('0x2')]},'recipientsId':{'type':Sequelize[_0xcc45('0x1')]},'recipientsDescription':{'type':Sequelize[_0xcc45('0x2')]},'beep':{'type':Sequelize[_0xcc45('0x3')]}};
\ No newline at end of file
index af8c016..9232796 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3002=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','ValidationError','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','model','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','findOne','html','view','startCase','User','union','ids','queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x22788c,_0x1f6041){var _0x2ea8f5=function(_0x20c316){while(--_0x20c316){_0x22788c['push'](_0x22788c['shift']());}};_0x2ea8f5(++_0x1f6041);}(_0x3002,0xb3));var _0x2300=function(_0x2d034b,_0x28862d){_0x2d034b=_0x2d034b-0x0;var _0x1db549=_0x3002[_0x2d034b];return _0x1db549;};'use strict';var emlformat=require(_0x2300('0x0'));var rimraf=require(_0x2300('0x1'));var zipdir=require(_0x2300('0x2'));var jsonpatch=require(_0x2300('0x3'));var rp=require(_0x2300('0x4'));var moment=require(_0x2300('0x5'));var BPromise=require(_0x2300('0x6'));var Mustache=require(_0x2300('0x7'));var util=require(_0x2300('0x8'));var path=require(_0x2300('0x9'));var sox=require(_0x2300('0xa'));var csv=require(_0x2300('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2300('0xc'));var squel=require(_0x2300('0xd'));var crypto=require(_0x2300('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2300('0xb'));var querystring=require(_0x2300('0xf'));var Papa=require(_0x2300('0x10'));var Redis=require(_0x2300('0x11'));var authService=require(_0x2300('0x12'));var qs=require(_0x2300('0x13'));var as=require(_0x2300('0x14'));var hardwareService=require(_0x2300('0x15'));var logger=require(_0x2300('0x16'))(_0x2300('0x17'));var utils=require(_0x2300('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2300('0x19'))['db'];config[_0x2300('0x1a')]=_[_0x2300('0x1b')](config[_0x2300('0x1a')],{'host':_0x2300('0x1c'),'port':0x18eb});var socket=require(_0x2300('0x1d'))(new Redis(config['redis']));require(_0x2300('0x1e'))['register'](socket);function respondWithStatusCode(_0x1f73bf,_0x3df726){_0x3df726=_0x3df726||0xcc;return function(_0x273e49){if(_0x273e49){return _0x1f73bf['sendStatus'](_0x3df726);}return _0x1f73bf[_0x2300('0x1f')](_0x3df726)[_0x2300('0x20')]();};}function respondWithResult(_0x430a2c,_0x4dec02){_0x4dec02=_0x4dec02||0xc8;return function(_0x1460a5){if(_0x1460a5){return _0x430a2c['status'](_0x4dec02)['json'](_0x1460a5);}};}function respondWithFilteredResult(_0x25f6ad,_0x9c42c5){return function(_0x14962d){if(_0x14962d){var _0x263783=typeof _0x9c42c5[_0x2300('0x21')]===_0x2300('0x22')&&typeof _0x9c42c5[_0x2300('0x23')]==='undefined';var _0x431239=_0x14962d['count'];var _0x50f980=_0x263783?0x0:_0x9c42c5[_0x2300('0x21')];var _0x20457c=_0x263783?_0x14962d[_0x2300('0x24')]:_0x9c42c5[_0x2300('0x21')]+_0x9c42c5[_0x2300('0x23')];var _0x542b6d;if(_0x20457c>=_0x431239){_0x20457c=_0x431239;_0x542b6d=0xc8;}else{_0x542b6d=0xce;}_0x25f6ad[_0x2300('0x1f')](_0x542b6d);return _0x25f6ad[_0x2300('0x25')](_0x2300('0x26'),_0x50f980+'-'+_0x20457c+'/'+_0x431239)[_0x2300('0x27')](_0x14962d);}return null;};}function patchUpdates(_0x22cd9c){return function(_0x25b57){try{jsonpatch[_0x2300('0x28')](_0x25b57,_0x22cd9c,!![]);}catch(_0x320269){return BPromise['reject'](_0x320269);}return _0x25b57[_0x2300('0x29')]();};}function saveUpdates(_0x5a6252,_0x84ea8c){return function(_0x299359){if(_0x299359){return _0x299359['update'](_0x5a6252)[_0x2300('0x2a')](function(_0x28ab42){return _0x28ab42;});}return null;};}function removeEntity(_0x19269,_0x3e8b5e){return function(_0xd1a352){if(_0xd1a352){return _0xd1a352[_0x2300('0x2b')]()[_0x2300('0x2a')](function(){_0x19269[_0x2300('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44e8a7,_0x46466f){return function(_0x215fb1){if(!_0x215fb1){_0x44e8a7['sendStatus'](0x194);}return _0x215fb1;};}function handleError(_0x3d3856,_0xea720){_0xea720=_0xea720||0x1f4;return function(_0x1c4f86){logger[_0x2300('0x2c')](_0x1c4f86[_0x2300('0x2d')]);if(_0x1c4f86[_0x2300('0x2e')]){delete _0x1c4f86[_0x2300('0x2e')];}_0x3d3856[_0x2300('0x1f')](_0xea720)[_0x2300('0x2f')](_0x1c4f86);};}exports['sendUserNotification']=function(_0x4fea6d,_0x57cc0e,_0x38e4af){if(!_0x4fea6d[_0x2300('0x30')][_0x2300('0x31')](_0x2300('0x32'))&&!_0x4fea6d['body']['hasOwnProperty'](_0x2300('0x33'))){throw new db[(_0x2300('0x34'))]['ValidationError'](_0x2300('0x35'));}else{if(_0x4fea6d[_0x2300('0x30')][_0x2300('0x31')](_0x2300('0x33'))&&!_0x4fea6d[_0x2300('0x30')][_0x2300('0x31')]('view')){throw new db['Sequelize'][(_0x2300('0x36'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x4fea6d[_0x2300('0x30')][_0x2300('0x31')](_0x2300('0x37'))){throw new db[(_0x2300('0x34'))][(_0x2300('0x36'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x16d4ec=JSON[_0x2300('0x38')](_0x4fea6d['body']['recipients']);}catch(_0x1a6cb1){logger[_0x2300('0x2c')](_0x1a6cb1);throw new db[(_0x2300('0x34'))]['ValidationError'](_0x2300('0x39'));}var _0x2edc37=[_0x2300('0x3a'),_0x2300('0x3b'),_0x2300('0x3c'),_0x2300('0x3d'),_0x2300('0x3e'),_0x2300('0x3f'),_0x2300('0x40'),_0x2300('0x41'),_0x2300('0x42')];if(_['some'](_0x16d4ec,function(_0x1b0faa){return!_['includes'](_0x2edc37,_0x1b0faa[_0x2300('0x43')][_0x2300('0x44')]());})){throw new db[(_0x2300('0x34'))][(_0x2300('0x36'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x57600f={};_0x57600f[_0x2300('0x45')]=_0x4fea6d[_0x2300('0x30')][_0x2300('0x31')](_0x2300('0x45'))?_0x4fea6d[_0x2300('0x30')][_0x2300('0x45')]:_0x4fea6d['user'][_0x2300('0x46')];_0x57600f['recipientsDescription']=_[_0x2300('0x47')](_0x4fea6d[_0x2300('0x30')][_0x2300('0x48')])?null:_0x4fea6d['body']['recipientsDescription'];_0x57600f[_0x2300('0x49')]=_0x4fea6d['body'][_0x2300('0x49')]||![];_0x57600f[_0x2300('0x4a')]=_0x4fea6d[_0x2300('0x42')]['id'];return getContent(_0x4fea6d[_0x2300('0x30')])[_0x2300('0x2a')](function(_0x3b8cf4){_0x57600f[_0x2300('0x30')]=_0x3b8cf4;return getRecipients(_0x16d4ec);})[_0x2300('0x2a')](function(_0x4ed062){_0x57600f[_0x2300('0x4b')]=_[_0x2300('0x4c')](_0x4ed062)[_0x2300('0x4d')](',');return db[_0x2300('0x4e')][_0x2300('0x4f')](function(_0x5daf55){return db[_0x2300('0x50')][_0x2300('0x51')](_0x57600f,{'raw':!![],'transaction':_0x5daf55})[_0x2300('0x2a')](function(_0x408438){var _0x3e7a34={'sender':_0x57600f[_0x2300('0x45')],'description':_0x57600f[_0x2300('0x48')],'content':_0x57600f[_0x2300('0x30')],'beep':_0x57600f[_0x2300('0x49')]};_0x4ed062[_0x2300('0x52')](function(_0x5a96e0){_0x3e7a34[_0x2300('0x53')]=_0x5a96e0;socket[_0x2300('0x54')](_0x2300('0x55'),_0x3e7a34);});return _0x408438;});});})[_0x2300('0x2a')](respondWithResult(_0x57cc0e,0xc9))['catch'](handleError(_0x57cc0e,null));};function getContent(_0x3f70c7){return new BPromise(function(_0xc57d27,_0x29f1ba){if(_0x3f70c7['text']){_0xc57d27(_0x3f70c7[_0x2300('0x32')]);return;}return db['Template'][_0x2300('0x56')]({'attributes':[_0x2300('0x57')],'where':{'id':_0x3f70c7[_0x2300('0x33')]},'raw':!![]})[_0x2300('0x2a')](function(_0x328f6d){if(!_0x328f6d)throw new db[(_0x2300('0x34'))][(_0x2300('0x36'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0xbf5854=Mustache['render'](_0x328f6d[_0x2300('0x57')],_0x3f70c7[_0x2300('0x58')]);_0xc57d27(_0xbf5854);})['catch'](function(_0x2027b8){_0x29f1ba(_0x2027b8);});});}function getRecipients(_0xa84a14){return new BPromise(function(_0x3529d0,_0x1f6575){var _0x5310df=[];var _0xdffd3a=[];_0xa84a14[_0x2300('0x52')](function(_0x181bc0){var _0x4d57d9=_[_0x2300('0x59')](_0x181bc0[_0x2300('0x43')][_0x2300('0x44')]());if(_0x4d57d9===_0x2300('0x5a')){_0x5310df=_[_0x2300('0x5b')](_0x5310df,_0x181bc0[_0x2300('0x5c')]);}else{if(_['includes'](_0x4d57d9,_0x2300('0x5d')))_0x4d57d9=_0x4d57d9['replace'](_0x2300('0x5d'),'Queue');_0x181bc0[_0x2300('0x5c')]['forEach'](function(_0x15283b){_0xdffd3a[_0x2300('0x5e')](getAgents(_0x4d57d9,_0x15283b));});}});return BPromise[_0x2300('0x5f')](_0xdffd3a)[_0x2300('0x2a')](function(_0x5c28ac){_0x5310df=_[_0x2300('0x5b')](_0x5310df,_[_0x2300('0x60')](_0x5c28ac));_0x3529d0(_0x5310df);})['catch'](function(_0x262b7b){_0x1f6575(_0x262b7b);});});}function getAgents(_0x348789,_0xe19e92){return new BPromise(function(_0x2aaaba,_0xba0dc){return db[_0x348789][_0x2300('0x56')]({'where':{'id':_0xe19e92}})[_0x2300('0x2a')](function(_0x12855e){return _0x12855e[_0x2300('0x61')]({'attributes':['id'],'raw':!![]})[_0x2300('0x2a')](function(_0x51ac95){var _0x4e41af=_[_0x2300('0x62')](_0x51ac95,'id');_0x2aaaba(_0x4e41af);});})['catch'](function(_0x3354fe){_0xba0dc(_0x3354fe);});});}
\ No newline at end of file
+var _0x57e1=['localhost','socket.io-emitter','./userNotification.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','sendUserNotification','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','transaction','UserNotification','create','recipient','emit','userNotification:send','catch','Template','findOne','html','forEach','startCase','User','ids','queue','replace','Queue','push','all','union','flatten','map','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0x57e1,0x116));var _0x157e=function(_0x49f096,_0xfc45e){_0x49f096=_0x49f096-0x0;var _0x515854=_0x57e1[_0x49f096];return _0x515854;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x157e('0x0'));var zipdir=require(_0x157e('0x1'));var jsonpatch=require(_0x157e('0x2'));var rp=require(_0x157e('0x3'));var moment=require('moment');var BPromise=require(_0x157e('0x4'));var Mustache=require(_0x157e('0x5'));var util=require(_0x157e('0x6'));var path=require(_0x157e('0x7'));var sox=require(_0x157e('0x8'));var csv=require(_0x157e('0x9'));var ejs=require(_0x157e('0xa'));var fs=require('fs');var fs_extra=require(_0x157e('0xb'));var _=require(_0x157e('0xc'));var squel=require('squel');var crypto=require(_0x157e('0xd'));var jsforce=require(_0x157e('0xe'));var deskjs=require(_0x157e('0xf'));var toCsv=require(_0x157e('0x9'));var querystring=require(_0x157e('0x10'));var Papa=require(_0x157e('0x11'));var Redis=require('ioredis');var authService=require(_0x157e('0x12'));var qs=require(_0x157e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x157e('0x14'));var logger=require(_0x157e('0x15'))(_0x157e('0x16'));var utils=require(_0x157e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x157e('0x18'));var db=require(_0x157e('0x19'))['db'];config[_0x157e('0x1a')]=_[_0x157e('0x1b')](config[_0x157e('0x1a')],{'host':_0x157e('0x1c'),'port':0x18eb});var socket=require(_0x157e('0x1d'))(new Redis(config['redis']));require(_0x157e('0x1e'))['register'](socket);function respondWithStatusCode(_0x27cd36,_0x22dcc9){_0x22dcc9=_0x22dcc9||0xcc;return function(_0x4720fa){if(_0x4720fa){return _0x27cd36['sendStatus'](_0x22dcc9);}return _0x27cd36[_0x157e('0x1f')](_0x22dcc9)[_0x157e('0x20')]();};}function respondWithResult(_0x5260e8,_0x4d6276){_0x4d6276=_0x4d6276||0xc8;return function(_0x32be87){if(_0x32be87){return _0x5260e8[_0x157e('0x1f')](_0x4d6276)[_0x157e('0x21')](_0x32be87);}};}function respondWithFilteredResult(_0xebed32,_0x3fb019){return function(_0x33cca4){if(_0x33cca4){var _0x5c83e5=typeof _0x3fb019[_0x157e('0x22')]===_0x157e('0x23')&&typeof _0x3fb019[_0x157e('0x24')]===_0x157e('0x23');var _0x5eb3d7=_0x33cca4[_0x157e('0x25')];var _0x1a9cc6=_0x5c83e5?0x0:_0x3fb019[_0x157e('0x22')];var _0x1fa774=_0x5c83e5?_0x33cca4[_0x157e('0x25')]:_0x3fb019[_0x157e('0x22')]+_0x3fb019['limit'];var _0x483c5a;if(_0x1fa774>=_0x5eb3d7){_0x1fa774=_0x5eb3d7;_0x483c5a=0xc8;}else{_0x483c5a=0xce;}_0xebed32[_0x157e('0x1f')](_0x483c5a);return _0xebed32[_0x157e('0x26')](_0x157e('0x27'),_0x1a9cc6+'-'+_0x1fa774+'/'+_0x5eb3d7)[_0x157e('0x21')](_0x33cca4);}return null;};}function patchUpdates(_0x50a400){return function(_0x235ea8){try{jsonpatch[_0x157e('0x28')](_0x235ea8,_0x50a400,!![]);}catch(_0x4d604a){return BPromise[_0x157e('0x29')](_0x4d604a);}return _0x235ea8[_0x157e('0x2a')]();};}function saveUpdates(_0xef7bf8,_0xeb2007){return function(_0x2a2283){if(_0x2a2283){return _0x2a2283['update'](_0xef7bf8)[_0x157e('0x2b')](function(_0x2a0271){return _0x2a0271;});}return null;};}function removeEntity(_0x5a6b78,_0x2cb269){return function(_0x455bfa){if(_0x455bfa){return _0x455bfa[_0x157e('0x2c')]()[_0x157e('0x2b')](function(){_0x5a6b78[_0x157e('0x1f')](0xcc)[_0x157e('0x20')]();});}};}function handleEntityNotFound(_0x56bcdd,_0x54df46){return function(_0x4f7988){if(!_0x4f7988){_0x56bcdd[_0x157e('0x2d')](0x194);}return _0x4f7988;};}function handleError(_0x2add2a,_0x40a8aa){_0x40a8aa=_0x40a8aa||0x1f4;return function(_0x3e9376){logger[_0x157e('0x2e')](_0x3e9376['stack']);if(_0x3e9376[_0x157e('0x2f')]){delete _0x3e9376[_0x157e('0x2f')];}_0x2add2a[_0x157e('0x1f')](_0x40a8aa)[_0x157e('0x30')](_0x3e9376);};}exports[_0x157e('0x31')]=function(_0x27ae49,_0x3eb18e,_0x1c6104){if(!_0x27ae49['body'][_0x157e('0x32')](_0x157e('0x33'))&&!_0x27ae49['body']['hasOwnProperty'](_0x157e('0x34'))){throw new db[(_0x157e('0x35'))]['ValidationError'](_0x157e('0x36'));}else{if(_0x27ae49[_0x157e('0x37')][_0x157e('0x32')](_0x157e('0x34'))&&!_0x27ae49[_0x157e('0x37')]['hasOwnProperty'](_0x157e('0x38'))){throw new db[(_0x157e('0x35'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x27ae49[_0x157e('0x37')][_0x157e('0x32')]('recipients')){throw new db[(_0x157e('0x35'))][(_0x157e('0x39'))](_0x157e('0x3a'));}else{try{var _0x10da74=JSON[_0x157e('0x3b')](_0x27ae49[_0x157e('0x37')][_0x157e('0x3c')]);}catch(_0x4c3c9f){logger[_0x157e('0x2e')](_0x4c3c9f);throw new db[(_0x157e('0x35'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x3d9c95=['chatqueue','faxqueue',_0x157e('0x3d'),_0x157e('0x3e'),_0x157e('0x3f'),'voicequeue',_0x157e('0x40'),_0x157e('0x41'),_0x157e('0x42')];if(_[_0x157e('0x43')](_0x10da74,function(_0x2acd82){return!_[_0x157e('0x44')](_0x3d9c95,_0x2acd82[_0x157e('0x45')][_0x157e('0x46')]());})){throw new db[(_0x157e('0x35'))][(_0x157e('0x39'))](_0x157e('0x47'));}}}var _0x1a3a95={};_0x1a3a95['senderName']=_0x27ae49[_0x157e('0x37')][_0x157e('0x32')](_0x157e('0x48'))?_0x27ae49[_0x157e('0x37')][_0x157e('0x48')]:_0x27ae49['user'][_0x157e('0x49')];_0x1a3a95[_0x157e('0x4a')]=_['isEmpty'](_0x27ae49[_0x157e('0x37')][_0x157e('0x4a')])?null:_0x27ae49[_0x157e('0x37')][_0x157e('0x4a')];_0x1a3a95[_0x157e('0x4b')]=_0x27ae49[_0x157e('0x37')][_0x157e('0x4b')]||![];_0x1a3a95[_0x157e('0x4c')]=_0x27ae49[_0x157e('0x42')]['id'];return getContent(_0x27ae49[_0x157e('0x37')])[_0x157e('0x2b')](function(_0x3d0ef7){_0x1a3a95[_0x157e('0x37')]=_0x3d0ef7;return getRecipients(_0x10da74);})[_0x157e('0x2b')](function(_0x2e950b){_0x1a3a95[_0x157e('0x4d')]=_[_0x157e('0x4e')](_0x2e950b)['join'](',');return db[_0x157e('0x4f')][_0x157e('0x50')](function(_0x2011e1){return db[_0x157e('0x51')][_0x157e('0x52')](_0x1a3a95,{'raw':!![],'transaction':_0x2011e1})[_0x157e('0x2b')](function(_0x27a8d1){var _0x180c89={'sender':_0x1a3a95['senderName'],'description':_0x1a3a95[_0x157e('0x4a')],'content':_0x1a3a95[_0x157e('0x37')],'beep':_0x1a3a95[_0x157e('0x4b')]};_0x2e950b['forEach'](function(_0x1bf530){_0x180c89[_0x157e('0x53')]=_0x1bf530;socket[_0x157e('0x54')](_0x157e('0x55'),_0x180c89);});return _0x27a8d1;});});})['then'](respondWithResult(_0x3eb18e,0xc9))[_0x157e('0x56')](handleError(_0x3eb18e,null));};function getContent(_0xbac2f7){return new BPromise(function(_0x5f363f,_0x5dfbcf){if(_0xbac2f7[_0x157e('0x33')]){_0x5f363f(_0xbac2f7['text']);return;}return db[_0x157e('0x57')][_0x157e('0x58')]({'attributes':[_0x157e('0x59')],'where':{'id':_0xbac2f7[_0x157e('0x34')]},'raw':!![]})[_0x157e('0x2b')](function(_0x4d364b){if(!_0x4d364b)throw new db[(_0x157e('0x35'))][(_0x157e('0x39'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x1196e4=Mustache['render'](_0x4d364b['html'],_0xbac2f7[_0x157e('0x38')]);_0x5f363f(_0x1196e4);})[_0x157e('0x56')](function(_0x54f7e1){_0x5dfbcf(_0x54f7e1);});});}function getRecipients(_0x69db47){return new BPromise(function(_0x255845,_0x1a18b3){var _0xd6da64=[];var _0x22c8d5=[];_0x69db47[_0x157e('0x5a')](function(_0x28bc27){var _0x1f3729=_[_0x157e('0x5b')](_0x28bc27[_0x157e('0x45')]['toLowerCase']());if(_0x1f3729===_0x157e('0x5c')){_0xd6da64=_['union'](_0xd6da64,_0x28bc27[_0x157e('0x5d')]);}else{if(_['includes'](_0x1f3729,_0x157e('0x5e')))_0x1f3729=_0x1f3729[_0x157e('0x5f')]('queue',_0x157e('0x60'));_0x28bc27['ids']['forEach'](function(_0x36057b){_0x22c8d5[_0x157e('0x61')](getAgents(_0x1f3729,_0x36057b));});}});return BPromise[_0x157e('0x62')](_0x22c8d5)[_0x157e('0x2b')](function(_0x2313cb){_0xd6da64=_[_0x157e('0x63')](_0xd6da64,_[_0x157e('0x64')](_0x2313cb));_0x255845(_0xd6da64);})[_0x157e('0x56')](function(_0x55849a){_0x1a18b3(_0x55849a);});});}function getAgents(_0x2353ce,_0x5dc1a4){return new BPromise(function(_0x2f4b6a,_0x3f8193){return db[_0x2353ce][_0x157e('0x58')]({'where':{'id':_0x5dc1a4}})[_0x157e('0x2b')](function(_0x11d942){return _0x11d942['getAgents']({'attributes':['id'],'raw':!![]})[_0x157e('0x2b')](function(_0xad9618){var _0x380e85=_[_0x157e('0x65')](_0xad9618,'id');_0x2f4b6a(_0x380e85);});})[_0x157e('0x56')](function(_0x420c16){_0x3f8193(_0x420c16);});});}
\ No newline at end of file
index 256954b..407b8da 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa503=['save','update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa503,0x8d));var _0x3a50=function(_0x511c7c,_0x126015){_0x511c7c=_0x511c7c-0x0;var _0x5255a9=_0xa503[_0x511c7c];return _0x5255a9;};'use strict';var EventEmitter=require(_0x3a50('0x0'));var UserNotification=require(_0x3a50('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3a50('0x2')](0x0);var events={'afterCreate':_0x3a50('0x3'),'afterUpdate':_0x3a50('0x4'),'afterDestroy':_0x3a50('0x5')};function emitEvent(_0x1dd5d6){return function(_0x277a7f,_0x304fd3,_0x2831f){UserNotificationEvents[_0x3a50('0x6')](_0x1dd5d6+':'+_0x277a7f['id'],_0x277a7f);UserNotificationEvents['emit'](_0x1dd5d6,_0x277a7f);_0x2831f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x3a50('0x7')](e,emitEvent(event));}}module[_0x3a50('0x8')]=UserNotificationEvents;
\ No newline at end of file
+var _0x5770=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5770,0xa7));var _0x0577=function(_0x22cf5c,_0xdfa91d){_0x22cf5c=_0x22cf5c-0x0;var _0x41d060=_0x5770[_0x22cf5c];return _0x41d060;};'use strict';var EventEmitter=require(_0x0577('0x0'));var UserNotification=require(_0x0577('0x1'))['db'][_0x0577('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x0577('0x3')](0x0);var events={'afterCreate':_0x0577('0x4'),'afterUpdate':'update','afterDestroy':_0x0577('0x5')};function emitEvent(_0x24331e){return function(_0x40b478,_0x542d79,_0x40713f){UserNotificationEvents[_0x0577('0x6')](_0x24331e+':'+_0x40b478['id'],_0x40b478);UserNotificationEvents[_0x0577('0x6')](_0x24331e,_0x40b478);_0x40713f(null);};}for(var e in events){if(events[_0x0577('0x7')](e)){var event=events[e];UserNotification[_0x0577('0x8')](e,emitEvent(event));}}module[_0x0577('0x9')]=UserNotificationEvents;
\ No newline at end of file
index d60d9af..da3fef0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1324=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications'];(function(_0x191994,_0xf3a234){var _0x291f21=function(_0x352c34){while(--_0x352c34){_0x191994['push'](_0x191994['shift']());}};_0x291f21(++_0xf3a234);}(_0x1324,0x97));var _0x4132=function(_0x24b926,_0x754118){_0x24b926=_0x24b926-0x0;var _0x2b28f1=_0x1324[_0x24b926];return _0x2b28f1;};'use strict';var _=require(_0x4132('0x0'));var util=require('util');var logger=require(_0x4132('0x1'))(_0x4132('0x2'));var moment=require(_0x4132('0x3'));var BPromise=require(_0x4132('0x4'));var rp=require(_0x4132('0x5'));var fs=require('fs');var path=require(_0x4132('0x6'));var rimraf=require(_0x4132('0x7'));var config=require(_0x4132('0x8'));var attributes=require(_0x4132('0x9'));module[_0x4132('0xa')]=function(_0x26d880,_0x43ff32){return _0x26d880[_0x4132('0xb')](_0x4132('0xc'),attributes,{'tableName':_0x4132('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4132('0xe')});};
\ No newline at end of file
+var _0x81f8=['../../config/environment','./userNotification.attributes','exports','userNotifications','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x5c5f7d,_0x1725f8){var _0xe85094=function(_0x54bd52){while(--_0x54bd52){_0x5c5f7d['push'](_0x5c5f7d['shift']());}};_0xe85094(++_0x1725f8);}(_0x81f8,0x1e4));var _0x881f=function(_0x3b030b,_0xcd1669){_0x3b030b=_0x3b030b-0x0;var _0x1ca79b=_0x81f8[_0x3b030b];return _0x1ca79b;};'use strict';var _=require(_0x881f('0x0'));var util=require('util');var logger=require(_0x881f('0x1'))(_0x881f('0x2'));var moment=require('moment');var BPromise=require(_0x881f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x881f('0x4'));var rimraf=require(_0x881f('0x5'));var config=require(_0x881f('0x6'));var attributes=require(_0x881f('0x7'));module[_0x881f('0x8')]=function(_0x1582b5,_0x4c16a3){return _0x1582b5['define']('UserNotification',attributes,{'tableName':_0x881f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
index de2f4f6..487fca2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x23fe=['request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','socket.io-emitter','./userNotification.socket','request','info','UserNotification,\x20%s,\x20%s'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x23fe,0x1e6));var _0xe23f=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x23fe[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0xe23f('0x0'));var util=require(_0xe23f('0x1'));var moment=require(_0xe23f('0x2'));var BPromise=require(_0xe23f('0x3'));var rs=require(_0xe23f('0x4'));var fs=require('fs');var Redis=require(_0xe23f('0x5'));var db=require(_0xe23f('0x6'))['db'];var utils=require(_0xe23f('0x7'));var logger=require(_0xe23f('0x8'))('rpc');var config=require(_0xe23f('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe23f('0xa')]({'port':0x232a});config[_0xe23f('0xb')]=_[_0xe23f('0xc')](config[_0xe23f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe23f('0xd'))(new Redis(config[_0xe23f('0xb')]));require(_0xe23f('0xe'))['register'](socket);function respondWithRpcPromise(_0x49fc41,_0x21ad70,_0x182f33){return new BPromise(function(_0x86fece,_0x1c144d){return client[_0xe23f('0xf')](_0x49fc41,_0x182f33)['then'](function(_0x4b943d){logger[_0xe23f('0x10')](_0xe23f('0x11'),_0x21ad70,_0xe23f('0x12'));logger[_0xe23f('0x13')](_0xe23f('0x14'),_0x21ad70,_0xe23f('0x12'),JSON['stringify'](_0x4b943d));if(_0x4b943d['error']){if(_0x4b943d[_0xe23f('0x15')][_0xe23f('0x16')]===0x1f4){logger['error'](_0xe23f('0x11'),_0x21ad70,_0x4b943d['error'][_0xe23f('0x17')]);return _0x1c144d(_0x4b943d[_0xe23f('0x15')][_0xe23f('0x17')]);}logger[_0xe23f('0x15')](_0xe23f('0x11'),_0x21ad70,_0x4b943d[_0xe23f('0x15')][_0xe23f('0x17')]);return _0x86fece(_0x4b943d[_0xe23f('0x15')]['message']);}else{logger[_0xe23f('0x10')]('UserNotification,\x20%s,\x20%s',_0x21ad70,_0xe23f('0x12'));_0x86fece(_0x4b943d['result'][_0xe23f('0x17')]);}})['catch'](function(_0x4d99f6){logger['error']('UserNotification,\x20%s,\x20%s',_0x21ad70,_0x4d99f6);_0x1c144d(_0x4d99f6);});});}
\ No newline at end of file
+var _0x555d=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','bluebird'];(function(_0x59aa41,_0x3f658f){var _0x5af84d=function(_0x50f987){while(--_0x50f987){_0x59aa41['push'](_0x59aa41['shift']());}};_0x5af84d(++_0x3f658f);}(_0x555d,0x196));var _0xd555=function(_0x37ef63,_0x52d21b){_0x37ef63=_0x37ef63-0x0;var _0x410a2e=_0x555d[_0x37ef63];return _0x410a2e;};'use strict';var _=require('lodash');var util=require(_0xd555('0x0'));var moment=require('moment');var BPromise=require(_0xd555('0x1'));var rs=require(_0xd555('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd555('0x3'));var logger=require(_0xd555('0x4'))(_0xd555('0x5'));var config=require(_0xd555('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd555('0x7')][_0xd555('0x8')]({'port':0x232a});config[_0xd555('0x9')]=_[_0xd555('0xa')](config[_0xd555('0x9')],{'host':_0xd555('0xb'),'port':0x18eb});var socket=require(_0xd555('0xc'))(new Redis(config[_0xd555('0x9')]));require(_0xd555('0xd'))[_0xd555('0xe')](socket);function respondWithRpcPromise(_0x287230,_0x82fff2,_0x445fe0){return new BPromise(function(_0xa04355,_0x5835cc){return client[_0xd555('0xf')](_0x287230,_0x445fe0)['then'](function(_0x5d757f){logger[_0xd555('0x10')](_0xd555('0x11'),_0x82fff2,_0xd555('0x12'));logger[_0xd555('0x13')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x82fff2,'request\x20sent',JSON['stringify'](_0x5d757f));if(_0x5d757f[_0xd555('0x14')]){if(_0x5d757f['error'][_0xd555('0x15')]===0x1f4){logger[_0xd555('0x14')]('UserNotification,\x20%s,\x20%s',_0x82fff2,_0x5d757f['error'][_0xd555('0x16')]);return _0x5835cc(_0x5d757f[_0xd555('0x14')][_0xd555('0x16')]);}logger[_0xd555('0x14')](_0xd555('0x11'),_0x82fff2,_0x5d757f['error']['message']);return _0xa04355(_0x5d757f['error'][_0xd555('0x16')]);}else{logger['info'](_0xd555('0x11'),_0x82fff2,_0xd555('0x12'));_0xa04355(_0x5d757f[_0xd555('0x17')][_0xd555('0x16')]);}})['catch'](function(_0x54d963){logger[_0xd555('0x14')](_0xd555('0x11'),_0x82fff2,_0x54d963);_0x5835cc(_0x54d963);});});}
\ No newline at end of file
index 4e26be1..445a087 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb71d=['save','remove','update','emit','removeListener','register','length','userNotification:','./userNotification.events'];(function(_0x74cf82,_0x3fb535){var _0x445914=function(_0x28023c){while(--_0x28023c){_0x74cf82['push'](_0x74cf82['shift']());}};_0x445914(++_0x3fb535);}(_0xb71d,0x18b));var _0xdb71=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb71d[_0x57b54c];return _0x59cc19;};'use strict';var UserNotificationEvents=require(_0xdb71('0x0'));var events=[_0xdb71('0x1'),_0xdb71('0x2'),_0xdb71('0x3')];function createListener(_0x5bfb6f,_0x5ff1b5){return function(_0xfa318c){_0x5ff1b5[_0xdb71('0x4')](_0x5bfb6f,_0xfa318c);};}function removeListener(_0x1ffe49,_0xab5ba6){return function(){UserNotificationEvents[_0xdb71('0x5')](_0x1ffe49,_0xab5ba6);};}exports[_0xdb71('0x6')]=function(_0x40cad5){for(var _0x18bc9c=0x0,_0x24d395=events[_0xdb71('0x7')];_0x18bc9c<_0x24d395;_0x18bc9c++){var _0x1ee7dc=events[_0x18bc9c];var _0x395b21=createListener(_0xdb71('0x8')+_0x1ee7dc,_0x40cad5);UserNotificationEvents['on'](_0x1ee7dc,_0x395b21);}};
\ No newline at end of file
+var _0x367a=['./userNotification.events','save','remove','update','register','length','userNotification:'];(function(_0x56ad29,_0x1536d6){var _0x4629b7=function(_0x1f44e6){while(--_0x1f44e6){_0x56ad29['push'](_0x56ad29['shift']());}};_0x4629b7(++_0x1536d6);}(_0x367a,0x93));var _0xa367=function(_0x57c8a8,_0x5c0c02){_0x57c8a8=_0x57c8a8-0x0;var _0x5156c5=_0x367a[_0x57c8a8];return _0x5156c5;};'use strict';var UserNotificationEvents=require(_0xa367('0x0'));var events=[_0xa367('0x1'),_0xa367('0x2'),_0xa367('0x3')];function createListener(_0x1a006b,_0x13b69c){return function(_0x49e5d4){_0x13b69c['emit'](_0x1a006b,_0x49e5d4);};}function removeListener(_0x46403f,_0x8f63a7){return function(){UserNotificationEvents['removeListener'](_0x46403f,_0x8f63a7);};}exports[_0xa367('0x4')]=function(_0x41ce82){for(var _0x560d8f=0x0,_0x28736c=events[_0xa367('0x5')];_0x560d8f<_0x28736c;_0x560d8f++){var _0x1c30bd=events[_0x560d8f];var _0x5747a5=createListener(_0xa367('0x6')+_0x1c30bd,_0x41ce82);UserNotificationEvents['on'](_0x1c30bd,_0x5747a5);}};
\ No newline at end of file
index ae35cbf..a889555 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4f3d01,_0x4da91e){var _0x2e9caf=function(_0x54d8c1){while(--_0x54d8c1){_0x4f3d01['push'](_0x4f3d01['shift']());}};_0x2e9caf(++_0x4da91e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x585ee5,_0x1c9dba){_0x585ee5=_0x585ee5-0x0;var _0x470808=_0xcb91[_0x585ee5];return _0x470808;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router;
\ No newline at end of file
+var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xdf13c9,_0x5da43f){var _0x302aaa=function(_0x42cc73){while(--_0x42cc73){_0xdf13c9['push'](_0xdf13c9['shift']());}};_0x302aaa(++_0x5da43f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router;
\ No newline at end of file
index a42144d..ec21bc1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd1db=['exports','INTEGER'];(function(_0x1c12a4,_0x12b2e5){var _0x1aaf7b=function(_0xcbf3e5){while(--_0xcbf3e5){_0x1c12a4['push'](_0x1c12a4['shift']());}};_0x1aaf7b(++_0x12b2e5);}(_0xd1db,0x90));var _0xbd1d=function(_0x221a6f,_0x1674c8){_0x221a6f=_0x221a6f-0x0;var _0x3db53d=_0xd1db[_0x221a6f];return _0x3db53d;};'use strict';var Sequelize=require('sequelize');module[_0xbd1d('0x0')]={'penalty':{'type':Sequelize[_0xbd1d('0x1')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xaa6d=['sequelize'];(function(_0x41877d,_0x19b756){var _0x4f4f49=function(_0x1a17c3){while(--_0x1a17c3){_0x41877d['push'](_0x41877d['shift']());}};_0x4f4f49(++_0x19b756);}(_0xaa6d,0x13f));var _0xdaa6=function(_0x410b95,_0x3211de){_0x410b95=_0x410b95-0x0;var _0x134db9=_0xaa6d[_0x410b95];return _0x134db9;};'use strict';var Sequelize=require(_0xdaa6('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
index 63375e4..d0b99f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8a50=['define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','exports'];(function(_0x654d8a,_0x3b5a46){var _0x5292d5=function(_0x387705){while(--_0x387705){_0x654d8a['push'](_0x654d8a['shift']());}};_0x5292d5(++_0x3b5a46);}(_0x8a50,0x1e3));var _0x08a5=function(_0x377eaf,_0x13255a){_0x377eaf=_0x377eaf-0x0;var _0x320bee=_0x8a50[_0x377eaf];return _0x320bee;};'use strict';var _=require(_0x08a5('0x0'));var util=require('util');var logger=require(_0x08a5('0x1'))(_0x08a5('0x2'));var moment=require('moment');var BPromise=require(_0x08a5('0x3'));var rp=require(_0x08a5('0x4'));var fs=require('fs');var path=require(_0x08a5('0x5'));var rimraf=require('rimraf');var config=require(_0x08a5('0x6'));var attributes=require(_0x08a5('0x7'));module[_0x08a5('0x8')]=function(_0x2fb15e,_0x16596f){return _0x2fb15e[_0x08a5('0x9')](_0x08a5('0xa'),attributes,{'tableName':_0x08a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x773b=['bluebird','request-promise','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x773b,0x1c8));var _0xb773=function(_0x274ac2,_0x4093a9){_0x274ac2=_0x274ac2-0x0;var _0x3facdc=_0x773b[_0x274ac2];return _0x3facdc;};'use strict';var _=require('lodash');var util=require(_0xb773('0x0'));var logger=require(_0xb773('0x1'))(_0xb773('0x2'));var moment=require('moment');var BPromise=require(_0xb773('0x3'));var rp=require(_0xb773('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb773('0x5'));module[_0xb773('0x6')]=function(_0x4578dd,_0x1ae132){return _0x4578dd['define'](_0xb773('0x7'),attributes,{'tableName':_0xb773('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 1896f09..ea75284 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe43b=['message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0xe98d48,_0x11430f){var _0x43b4a2=function(_0xab26f0){while(--_0xab26f0){_0xe98d48['push'](_0xe98d48['shift']());}};_0x43b4a2(++_0x11430f);}(_0xe43b,0x7a));var _0xbe43=function(_0x1d5458,_0x3acf09){_0x1d5458=_0x1d5458-0x0;var _0x9bf6f=_0xe43b[_0x1d5458];return _0x9bf6f;};'use strict';var _=require(_0xbe43('0x0'));var util=require(_0xbe43('0x1'));var moment=require('moment');var BPromise=require(_0xbe43('0x2'));var rs=require(_0xbe43('0x3'));var fs=require('fs');var Redis=require(_0xbe43('0x4'));var db=require(_0xbe43('0x5'))['db'];var utils=require(_0xbe43('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe43('0x7'));var jayson=require(_0xbe43('0x8'));var client=jayson[_0xbe43('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40ab72,_0x432f67,_0x2e6f06){return new BPromise(function(_0x1449d5,_0x5dc9ec){return client['request'](_0x40ab72,_0x2e6f06)[_0xbe43('0xa')](function(_0x8a0118){logger['info'](_0xbe43('0xb'),_0x432f67,_0xbe43('0xc'));logger[_0xbe43('0xd')](_0xbe43('0xe'),_0x432f67,'request\x20sent',JSON[_0xbe43('0xf')](_0x8a0118));if(_0x8a0118['error']){if(_0x8a0118['error'][_0xbe43('0x10')]===0x1f4){logger[_0xbe43('0x11')](_0xbe43('0xb'),_0x432f67,_0x8a0118[_0xbe43('0x11')][_0xbe43('0x12')]);return _0x5dc9ec(_0x8a0118[_0xbe43('0x11')][_0xbe43('0x12')]);}logger[_0xbe43('0x11')](_0xbe43('0xb'),_0x432f67,_0x8a0118[_0xbe43('0x11')]['message']);return _0x1449d5(_0x8a0118[_0xbe43('0x11')]['message']);}else{logger[_0xbe43('0x13')](_0xbe43('0xb'),_0x432f67,_0xbe43('0xc'));_0x1449d5(_0x8a0118['result'][_0xbe43('0x12')]);}})['catch'](function(_0x8b41db){logger['error'](_0xbe43('0xb'),_0x432f67,_0x8b41db);_0x5dc9ec(_0x8b41db);});});}
\ No newline at end of file
+var _0x1e19=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x1e19,0x16f));var _0x91e1=function(_0x36631d,_0x2786bf){_0x36631d=_0x36631d-0x0;var _0x410666=_0x1e19[_0x36631d];return _0x410666;};'use strict';var _=require(_0x91e1('0x0'));var util=require('util');var moment=require(_0x91e1('0x1'));var BPromise=require(_0x91e1('0x2'));var rs=require(_0x91e1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91e1('0x4'))['db'];var utils=require(_0x91e1('0x5'));var logger=require(_0x91e1('0x6'))(_0x91e1('0x7'));var config=require(_0x91e1('0x8'));var jayson=require(_0x91e1('0x9'));var client=jayson[_0x91e1('0xa')][_0x91e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d5a87,_0x1f1ecf,_0x21d889){return new BPromise(function(_0x383e54,_0x48c615){return client[_0x91e1('0xc')](_0x1d5a87,_0x21d889)[_0x91e1('0xd')](function(_0x543b19){logger[_0x91e1('0xe')](_0x91e1('0xf'),_0x1f1ecf,_0x91e1('0x10'));logger[_0x91e1('0x11')](_0x91e1('0x12'),_0x1f1ecf,_0x91e1('0x10'),JSON['stringify'](_0x543b19));if(_0x543b19[_0x91e1('0x13')]){if(_0x543b19['error']['code']===0x1f4){logger[_0x91e1('0x13')](_0x91e1('0xf'),_0x1f1ecf,_0x543b19[_0x91e1('0x13')][_0x91e1('0x14')]);return _0x48c615(_0x543b19[_0x91e1('0x13')][_0x91e1('0x14')]);}logger[_0x91e1('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1f1ecf,_0x543b19[_0x91e1('0x13')]['message']);return _0x383e54(_0x543b19[_0x91e1('0x13')][_0x91e1('0x14')]);}else{logger[_0x91e1('0xe')](_0x91e1('0xf'),_0x1f1ecf,_0x91e1('0x10'));_0x383e54(_0x543b19['result'][_0x91e1('0x14')]);}})[_0x91e1('0x15')](function(_0x3ffc8f){logger['error'](_0x91e1('0xf'),_0x1f1ecf,_0x3ffc8f);_0x48c615(_0x3ffc8f);});});}
\ No newline at end of file
index c02ffbf..76b6894 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x472c=['update','delete','removeSections','removeResources','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getSections','/:id/resources','getResources','post','create','clone','/:id/sections','addSections','addResources','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x472c,0x1a9));var _0xc472=function(_0x406fb1,_0x1273b8){_0x406fb1=_0x406fb1-0x0;var _0x2b8c1d=_0x472c[_0x406fb1];return _0x2b8c1d;};'use strict';var multer=require('multer');var util=require(_0xc472('0x0'));var path=require('path');var timeout=require(_0xc472('0x1'));var express=require('express');var router=express[_0xc472('0x2')]();var fs_extra=require(_0xc472('0x3'));var auth=require(_0xc472('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc472('0x5'));var controller=require('./userProfile.controller');router[_0xc472('0x6')]('/',auth[_0xc472('0x7')](),controller[_0xc472('0x8')]);router['get'](_0xc472('0x9'),auth[_0xc472('0x7')](),controller[_0xc472('0xa')]);router['get'](_0xc472('0xb'),auth[_0xc472('0x7')](),controller[_0xc472('0xc')]);router[_0xc472('0x6')]('/:id/sections',auth[_0xc472('0x7')](),controller[_0xc472('0xd')]);router['get'](_0xc472('0xe'),auth['isAuthenticated'](),controller[_0xc472('0xf')]);router[_0xc472('0x10')]('/',auth[_0xc472('0x7')](),controller[_0xc472('0x11')]);router['post']('/:id/clone',auth[_0xc472('0x7')](),controller[_0xc472('0x12')]);router['post'](_0xc472('0x13'),auth[_0xc472('0x7')](),controller[_0xc472('0x14')]);router[_0xc472('0x10')](_0xc472('0xe'),auth[_0xc472('0x7')](),controller[_0xc472('0x15')]);router[_0xc472('0x16')](_0xc472('0xb'),auth['isAuthenticated'](),controller[_0xc472('0x17')]);router['delete'](_0xc472('0xb'),auth[_0xc472('0x7')](),controller['destroy']);router[_0xc472('0x18')](_0xc472('0x13'),auth[_0xc472('0x7')](),controller[_0xc472('0x19')]);router[_0xc472('0x18')](_0xc472('0xe'),auth[_0xc472('0x7')](),controller[_0xc472('0x1a')]);module[_0xc472('0x1b')]=router;
\ No newline at end of file
+var _0x5b35=['index','/describe','isAuthenticated','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addResources','delete','destroy','removeResources','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x514816,_0x57c091){var _0x5c3a43=function(_0xd4a413){while(--_0xd4a413){_0x514816['push'](_0x514816['shift']());}};_0x5c3a43(++_0x57c091);}(_0x5b35,0x164));var _0x55b3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5b35[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x55b3('0x0'));var util=require('util');var path=require(_0x55b3('0x1'));var timeout=require(_0x55b3('0x2'));var express=require(_0x55b3('0x3'));var router=express[_0x55b3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x55b3('0x5'));var config=require(_0x55b3('0x6'));var controller=require('./userProfile.controller');router[_0x55b3('0x7')]('/',auth['isAuthenticated'](),controller[_0x55b3('0x8')]);router['get'](_0x55b3('0x9'),auth[_0x55b3('0xa')](),controller['describe']);router[_0x55b3('0x7')](_0x55b3('0xb'),auth[_0x55b3('0xa')](),controller[_0x55b3('0xc')]);router['get'](_0x55b3('0xd'),auth[_0x55b3('0xa')](),controller[_0x55b3('0xe')]);router[_0x55b3('0x7')](_0x55b3('0xf'),auth['isAuthenticated'](),controller[_0x55b3('0x10')]);router[_0x55b3('0x11')]('/',auth['isAuthenticated'](),controller[_0x55b3('0x12')]);router[_0x55b3('0x11')](_0x55b3('0x13'),auth[_0x55b3('0xa')](),controller[_0x55b3('0x14')]);router[_0x55b3('0x11')](_0x55b3('0xd'),auth[_0x55b3('0xa')](),controller['addSections']);router[_0x55b3('0x11')](_0x55b3('0xf'),auth[_0x55b3('0xa')](),controller[_0x55b3('0x15')]);router['put'](_0x55b3('0xb'),auth[_0x55b3('0xa')](),controller['update']);router[_0x55b3('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x55b3('0x17')]);router[_0x55b3('0x16')](_0x55b3('0xd'),auth['isAuthenticated'](),controller['removeSections']);router[_0x55b3('0x16')](_0x55b3('0xf'),auth[_0x55b3('0xa')](),controller[_0x55b3('0x18')]);module[_0x55b3('0x19')]=router;
\ No newline at end of file
index 75a8659..a12a4e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0685=['join','getDataValue','split','BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x0685,0x94));var _0x5068=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x0685[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x5068('0x0'));module['exports']={'name':{'type':Sequelize[_0x5068('0x1')],'allowNull':![],'unique':_0x5068('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1eb03d){this[_0x5068('0x3')](_0x5068('0x4'),_0x1eb03d?_0x1eb03d[_0x5068('0x5')](''):[]);},'get':function(){return this[_0x5068('0x6')](_0x5068('0x4'))?this[_0x5068('0x6')](_0x5068('0x4'))[_0x5068('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5068('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x5068('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x5068('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x5068('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x5068('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5068('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x5068('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}};
\ No newline at end of file
+var _0x69dc=['split','BOOLEAN','sequelize','exports','name','setDataValue','crudPermissions'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x69dc,0x128));var _0xc69d=function(_0x2fa640,_0x1a77d5){_0x2fa640=_0x2fa640-0x0;var _0x28d4f3=_0x69dc[_0x2fa640];return _0x28d4f3;};'use strict';var Sequelize=require(_0xc69d('0x0'));module[_0xc69d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc69d('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xc77904){this[_0xc69d('0x3')]('crudPermissions',_0xc77904?_0xc77904['join'](''):[]);},'get':function(){return this['getDataValue'](_0xc69d('0x4'))?this['getDataValue'](_0xc69d('0x4'))[_0xc69d('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xc69d('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xc69d('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xc69d('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xc69d('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc69d('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}};
\ No newline at end of file
index 3f11367..1296f1d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x75dc=['describe','transaction','each','Resources','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','push','findOne','Dashboard','forEach','bulkCreate','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfile','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','get','omit','createdAt','updatedAt','sequelize','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x75dc,0x1d7));var _0xc75d=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0x75dc[_0x5ac0f0];return _0x4aceec;};'use strict';var emlformat=require(_0xc75d('0x0'));var rimraf=require(_0xc75d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc75d('0x2'));var BPromise=require(_0xc75d('0x3'));var Mustache=require(_0xc75d('0x4'));var util=require(_0xc75d('0x5'));var path=require(_0xc75d('0x6'));var sox=require(_0xc75d('0x7'));var csv=require('to-csv');var ejs=require(_0xc75d('0x8'));var fs=require('fs');var fs_extra=require(_0xc75d('0x9'));var _=require(_0xc75d('0xa'));var squel=require('squel');var crypto=require(_0xc75d('0xb'));var jsforce=require(_0xc75d('0xc'));var deskjs=require(_0xc75d('0xd'));var toCsv=require(_0xc75d('0xe'));var querystring=require('querystring');var Papa=require(_0xc75d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc75d('0x10'));var as=require(_0xc75d('0x11'));var hardwareService=require(_0xc75d('0x12'));var logger=require(_0xc75d('0x13'))('api');var utils=require(_0xc75d('0x14'));var config=require(_0xc75d('0x15'));var licenseUtil=require(_0xc75d('0x16'));var db=require(_0xc75d('0x17'))['db'];config[_0xc75d('0x18')]=_[_0xc75d('0x19')](config[_0xc75d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc75d('0x1a'))(new Redis(config[_0xc75d('0x18')]));require(_0xc75d('0x1b'))[_0xc75d('0x1c')](socket);function respondWithStatusCode(_0x5171a2,_0x4a9461){_0x4a9461=_0x4a9461||0xcc;return function(_0x1208d7){if(_0x1208d7){return _0x5171a2[_0xc75d('0x1d')](_0x4a9461);}return _0x5171a2[_0xc75d('0x1e')](_0x4a9461)[_0xc75d('0x1f')]();};}function respondWithResult(_0x1d49b9,_0x331d68){_0x331d68=_0x331d68||0xc8;return function(_0x2bd581){if(_0x2bd581){return _0x1d49b9['status'](_0x331d68)[_0xc75d('0x20')](_0x2bd581);}};}function respondWithFilteredResult(_0x1fe446,_0x2d8aeb){return function(_0x389804){if(_0x389804){var _0x47123f=typeof _0x2d8aeb['offset']===_0xc75d('0x21')&&typeof _0x2d8aeb['limit']==='undefined';var _0x3933c5=_0x389804[_0xc75d('0x22')];var _0x38d301=_0x47123f?0x0:_0x2d8aeb[_0xc75d('0x23')];var _0x84ded6=_0x47123f?_0x389804['count']:_0x2d8aeb[_0xc75d('0x23')]+_0x2d8aeb[_0xc75d('0x24')];var _0x208f36;if(_0x84ded6>=_0x3933c5){_0x84ded6=_0x3933c5;_0x208f36=0xc8;}else{_0x208f36=0xce;}_0x1fe446[_0xc75d('0x1e')](_0x208f36);return _0x1fe446[_0xc75d('0x25')](_0xc75d('0x26'),_0x38d301+'-'+_0x84ded6+'/'+_0x3933c5)[_0xc75d('0x20')](_0x389804);}return null;};}function patchUpdates(_0x2327ec){return function(_0x4f24cb){try{jsonpatch[_0xc75d('0x27')](_0x4f24cb,_0x2327ec,!![]);}catch(_0x296456){return BPromise[_0xc75d('0x28')](_0x296456);}return _0x4f24cb[_0xc75d('0x29')]();};}function saveUpdates(_0x5ef8d0,_0x11ed64){return function(_0x2f7741){if(_0x2f7741){return _0x2f7741[_0xc75d('0x2a')](_0x5ef8d0)[_0xc75d('0x2b')](function(_0xae25c2){return _0xae25c2;});}return null;};}function removeEntity(_0x2e1687,_0x478787){return function(_0x35d72b){if(_0x35d72b){return _0x35d72b[_0xc75d('0x2c')]()['then'](function(){_0x2e1687['status'](0xcc)[_0xc75d('0x1f')]();});}};}function handleEntityNotFound(_0xd2b678,_0x452c51){return function(_0x393694){if(!_0x393694){_0xd2b678[_0xc75d('0x1d')](0x194);}return _0x393694;};}function handleError(_0x6bee54,_0x47b7b2){_0x47b7b2=_0x47b7b2||0x1f4;return function(_0x56fe50){logger[_0xc75d('0x2d')](_0x56fe50[_0xc75d('0x2e')]);if(_0x56fe50['name']){delete _0x56fe50[_0xc75d('0x2f')];}_0x6bee54[_0xc75d('0x1e')](_0x47b7b2)[_0xc75d('0x30')](_0x56fe50);};}exports[_0xc75d('0x31')]=function(_0x4cd194,_0x3f285a){var _0xcae944={},_0xaf6277={},_0x478f2b={'count':0x0,'rows':[]};var _0x5e3b25=_[_0xc75d('0x32')](db[_0xc75d('0x33')]['rawAttributes'],function(_0x3e269b){return{'name':_0x3e269b[_0xc75d('0x34')],'type':_0x3e269b[_0xc75d('0x35')][_0xc75d('0x36')]};});_0xaf6277[_0xc75d('0x37')]=_[_0xc75d('0x32')](_0x5e3b25,_0xc75d('0x2f'));_0xaf6277[_0xc75d('0x38')]=_[_0xc75d('0x39')](_0x4cd194[_0xc75d('0x38')]);_0xaf6277[_0xc75d('0x3a')]=_[_0xc75d('0x3b')](_0xaf6277[_0xc75d('0x37')],_0xaf6277['query']);_0xcae944[_0xc75d('0x3c')]=_[_0xc75d('0x3b')](_0xaf6277[_0xc75d('0x37')],qs[_0xc75d('0x3d')](_0x4cd194['query'][_0xc75d('0x3d')]));_0xcae944[_0xc75d('0x3c')]=_0xcae944[_0xc75d('0x3c')]['length']?_0xcae944['attributes']:_0xaf6277['model'];if(!_0x4cd194['query'][_0xc75d('0x3e')](_0xc75d('0x3f'))){_0xcae944['limit']=qs[_0xc75d('0x24')](_0x4cd194[_0xc75d('0x38')][_0xc75d('0x24')]);_0xcae944[_0xc75d('0x23')]=qs[_0xc75d('0x23')](_0x4cd194[_0xc75d('0x38')][_0xc75d('0x23')]);}_0xcae944[_0xc75d('0x40')]=qs[_0xc75d('0x41')](_0x4cd194[_0xc75d('0x38')]['sort']);_0xcae944['where']=qs[_0xc75d('0x3a')](_[_0xc75d('0x42')](_0x4cd194[_0xc75d('0x38')],_0xaf6277[_0xc75d('0x3a')]),_0x5e3b25);if(_0x4cd194[_0xc75d('0x38')]['filter']){_0xcae944[_0xc75d('0x43')]=_[_0xc75d('0x44')](_0xcae944[_0xc75d('0x43')],{'$or':_[_0xc75d('0x32')](_0x5e3b25,function(_0x2cf6f5){if(_0x2cf6f5['type']!==_0xc75d('0x45')){var _0x97509d={};_0x97509d[_0x2cf6f5['name']]={'$like':'%'+_0x4cd194['query'][_0xc75d('0x46')]+'%'};return _0x97509d;}})});}_0xcae944=_[_0xc75d('0x44')]({},_0xcae944,_0x4cd194[_0xc75d('0x47')]);var _0x45e479={'where':_0xcae944[_0xc75d('0x43')]};return db[_0xc75d('0x33')][_0xc75d('0x22')](_0x45e479)['then'](function(_0x1a5698){_0x478f2b[_0xc75d('0x22')]=_0x1a5698;if(_0x4cd194['query']['includeAll']){_0xcae944[_0xc75d('0x48')]=[{'all':!![]}];}return db[_0xc75d('0x33')][_0xc75d('0x49')](_0xcae944);})['then'](function(_0x22d4d9){_0x478f2b[_0xc75d('0x4a')]=_0x22d4d9;return _0x478f2b;})[_0xc75d('0x2b')](respondWithFilteredResult(_0x3f285a,_0xcae944))[_0xc75d('0x4b')](handleError(_0x3f285a,null));};exports[_0xc75d('0x4c')]=function(_0x288040,_0x54aa52){var _0x5b8f37={'raw':![],'where':{'id':_0x288040[_0xc75d('0x4d')]['id']}},_0x1afcf8={};_0x1afcf8[_0xc75d('0x37')]=_[_0xc75d('0x39')](db[_0xc75d('0x33')][_0xc75d('0x4e')]);_0x1afcf8[_0xc75d('0x38')]=_[_0xc75d('0x39')](_0x288040[_0xc75d('0x38')]);_0x1afcf8[_0xc75d('0x3a')]=_[_0xc75d('0x3b')](_0x1afcf8[_0xc75d('0x37')],_0x1afcf8[_0xc75d('0x38')]);_0x5b8f37[_0xc75d('0x3c')]=_[_0xc75d('0x3b')](_0x1afcf8[_0xc75d('0x37')],qs[_0xc75d('0x3d')](_0x288040[_0xc75d('0x38')][_0xc75d('0x3d')]));_0x5b8f37['attributes']=_0x5b8f37[_0xc75d('0x3c')][_0xc75d('0x4f')]?_0x5b8f37[_0xc75d('0x3c')]:_0x1afcf8['model'];if(_0x288040['query'][_0xc75d('0x50')]){_0x5b8f37['include']=[{'all':!![]}];}_0x5b8f37=_['merge']({},_0x5b8f37,_0x288040[_0xc75d('0x47')]);return db[_0xc75d('0x33')][_0xc75d('0x51')](_0x5b8f37)[_0xc75d('0x2b')](handleEntityNotFound(_0x54aa52,null))['then'](respondWithResult(_0x54aa52,null))[_0xc75d('0x4b')](handleError(_0x54aa52,null));};exports['create']=function(_0x1d2c6d,_0x17d063){return db[_0xc75d('0x33')][_0xc75d('0x52')](_0x1d2c6d[_0xc75d('0x53')],{})[_0xc75d('0x2b')](respondWithResult(_0x17d063,0xc9))['catch'](handleError(_0x17d063,null));};exports['clone']=function(_0x3e0b23,_0x35e9cd){var _0x4a9a66={'where':{'id':_0x3e0b23['params']['id']}},_0x219fda={};_0x219fda[_0xc75d('0x37')]=_[_0xc75d('0x39')](db[_0xc75d('0x33')][_0xc75d('0x4e')]);_0x4a9a66['attributes']=_[_0xc75d('0x3b')](_0x219fda['model'],qs[_0xc75d('0x3d')](_0x3e0b23['query'][_0xc75d('0x3d')]));_0x4a9a66[_0xc75d('0x3c')]=_0x4a9a66[_0xc75d('0x3c')]['length']?_0x4a9a66[_0xc75d('0x3c')]:_0x219fda['model'];if(_0x3e0b23[_0xc75d('0x38')]['includeAll']){_0x4a9a66[_0xc75d('0x48')]=[{'all':!![]}];}_0x4a9a66=_[_0xc75d('0x44')]({},_0x4a9a66,_0x3e0b23[_0xc75d('0x47')]);return db[_0xc75d('0x33')]['find'](_0x4a9a66)[_0xc75d('0x2b')](handleEntityNotFound(_0x35e9cd,null))['then'](function(_0x325501){if(_0x325501){var _0x51c44f=_0x325501[_0xc75d('0x54')]({'plain':!![]});_0x51c44f=qs[_0xc75d('0x55')](_0x51c44f,['id',_0xc75d('0x56'),_0xc75d('0x57'),'crudPermissions']);_0x3e0b23[_0xc75d('0x53')]=_['omit'](_0x3e0b23['body'],['id','createdAt',_0xc75d('0x57')]);return db[_0xc75d('0x58')]['transaction'](function(_0x3db39c){return db[_0xc75d('0x33')]['create'](_[_0xc75d('0x44')](_0x51c44f,_0x3e0b23[_0xc75d('0x53')]),{'include':_0x3e0b23[_0xc75d('0x38')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x3db39c})['then'](function(_0x91413e){var _0x283bdd=_0x91413e[_0xc75d('0x54')]({'plain':!![]});return db[_0xc75d('0x59')][_0xc75d('0x49')]({'where':{'userProfileId':_0x3e0b23[_0xc75d('0x4d')]['id']},'raw':!![]})[_0xc75d('0x2b')](function(_0x4ffa83){if(_0x4ffa83){return BPromise['each'](_0x4ffa83,function(_0x1a6084){return new BPromise(function(_0x27aef7,_0x400470){if(_0x1a6084[_0xc75d('0x5a')]===null||_0x1a6084[_0xc75d('0x5a')]===0x1)_0x27aef7(null);return db[_0xc75d('0x5b')]['findAll']({'where':{'sectionId':_0x1a6084['id']},'raw':!![]})[_0xc75d('0x2b')](function(_0x390959){var _0x45ac75=_[_0xc75d('0x32')](_0x390959,function(_0x1e8c77){return qs[_0xc75d('0x55')](_0x1e8c77,['id','createdAt',_0xc75d('0x57'),_0xc75d('0x5c')]);});_0x27aef7(_0x45ac75);})[_0xc75d('0x4b')](function(_0x26491e){_0x400470(_0x26491e);});})['then'](function(_0x176d8c){var _0x4788df=qs['omit'](_0x1a6084,['id',_0xc75d('0x56'),_0xc75d('0x57')]);_0x4788df[_0xc75d('0x5d')]=_0x283bdd['id'];if(_0x176d8c)_0x4788df['Resources']=_0x176d8c;return _0x4788df;})['then'](function(_0x5b61ff){return db[_0xc75d('0x59')]['create'](_0x5b61ff,{'include':[{'model':db[_0xc75d('0x5b')],'as':'Resources'}],'raw':!![],'transaction':_0x3db39c});});})[_0xc75d('0x2b')](function(){return _0x283bdd;});}});});});}})[_0xc75d('0x2b')](respondWithResult(_0x35e9cd,0xc9))['catch'](handleError(_0x35e9cd,null));};exports[_0xc75d('0x2a')]=function(_0x12db5b,_0x1f1ae1){if(_0x12db5b[_0xc75d('0x53')]['id']){delete _0x12db5b[_0xc75d('0x53')]['id'];}return db[_0xc75d('0x33')]['find']({'where':{'id':_0x12db5b['params']['id']}})[_0xc75d('0x2b')](handleEntityNotFound(_0x1f1ae1,null))[_0xc75d('0x2b')](saveUpdates(_0x12db5b[_0xc75d('0x53')],null))[_0xc75d('0x2b')](respondWithResult(_0x1f1ae1,null))['catch'](handleError(_0x1f1ae1,null));};exports[_0xc75d('0x2c')]=function(_0x561ec3,_0xcb89ba){return db['UserProfile'][_0xc75d('0x51')]({'where':{'id':_0x561ec3['params']['id']}})['then'](handleEntityNotFound(_0xcb89ba,null))[_0xc75d('0x2b')](removeEntity(_0xcb89ba,null))['catch'](handleError(_0xcb89ba,null));};exports[_0xc75d('0x5e')]=function(_0x572fc9,_0x183dc4){return db[_0xc75d('0x33')][_0xc75d('0x5e')]()[_0xc75d('0x2b')](respondWithResult(_0x183dc4,null))['catch'](handleError(_0x183dc4,null));};exports['addSections']=function(_0x657dd9,_0x4fcccf){var _0x4e83a4=_0x657dd9['body'];return db[_0xc75d('0x33')][_0xc75d('0x51')]({'where':{'id':_0x657dd9[_0xc75d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4fcccf,null))['then'](function(_0x5ef9e7){if(_0x5ef9e7){return db[_0xc75d('0x58')][_0xc75d('0x5f')](function(_0x3255f0){return db[_0xc75d('0x59')][_0xc75d('0x2c')]({'where':{'userProfileId':_0x657dd9[_0xc75d('0x4d')]['id'],'sectionId':_['map'](_0x4e83a4,function(_0x13148e){return _0x13148e[_0xc75d('0x5c')];})},'transaction':_0x3255f0})[_0xc75d('0x2b')](function(){var _0x16a353=_[_0xc75d('0x32')](_0x4e83a4,function(_0x492411){_0x492411['userProfileId']=_0x657dd9['params']['id'];return _0x492411;});var _0x4974ea=[];return BPromise[_0xc75d('0x60')](_0x16a353,function(_0x1cc157){return db[_0xc75d('0x59')][_0xc75d('0x52')](_0x1cc157,{'include':[{'model':db[_0xc75d('0x5b')],'as':_0xc75d('0x61')}],'raw':!![],'transaction':_0x3255f0})[_0xc75d('0x2b')](function(_0x36d664){_0x4974ea['push'](_0x36d664[_0xc75d('0x54')]({'plain':!![]}));});})[_0xc75d('0x2b')](function(){return _0x4974ea;});});});}})['then'](function(_0x43856d){return _0x43856d;})[_0xc75d('0x2b')](respondWithResult(_0x4fcccf,null))['catch'](handleError(_0x4fcccf,null));};exports[_0xc75d('0x62')]=function(_0x78cd3e,_0x5e9200){var _0xbc4f85;return db[_0xc75d('0x33')][_0xc75d('0x51')]({'where':{'id':_0x78cd3e[_0xc75d('0x4d')]['id']},'attributes':['id',_0xc75d('0x2f')]})['then'](handleEntityNotFound(_0x5e9200,null))[_0xc75d('0x2b')](function(_0x1be856){if(_0x1be856){_0xbc4f85=_0x1be856;return db[_0xc75d('0x59')][_0xc75d('0x2c')]({'where':{'userProfileId':_0x78cd3e[_0xc75d('0x4d')]['id'],'sectionId':_0x78cd3e[_0xc75d('0x38')][_0xc75d('0x63')]}});}})[_0xc75d('0x2b')](function(){return _0xbc4f85;})[_0xc75d('0x2b')](respondWithStatusCode(_0x5e9200,null))[_0xc75d('0x4b')](handleError(_0x5e9200,null));};exports[_0xc75d('0x64')]=function(_0x1b9d5e,_0x4d840b){var _0x53d9f2=[];var _0x5e63b1=[];return db[_0xc75d('0x59')][_0xc75d('0x49')]({'where':{'userProfileId':_0x1b9d5e['params']['id']},'raw':!![]})['then'](function(_0x41916e){_0x53d9f2=_[_0xc75d('0x46')](_0x41916e,function(_0x393941){return _0x393941[_0xc75d('0x65')]===0x1||_['includes']([0x3eb,0x709],_0x393941[_0xc75d('0x5c')]);});if(!_[_0xc75d('0x66')](_0x53d9f2)){return _['map'](_0x53d9f2,function(_0x42cbaf){return _0x42cbaf[_0xc75d('0x5c')];});}else{return;}})[_0xc75d('0x2b')](function(_0x2f3aa7){if(_0x2f3aa7)_0x5e63b1=_0x2f3aa7;if(_[_0xc75d('0x67')](_0x5e63b1,0x64)){var _0x3f6cad=_[_0xc75d('0x51')](_0x53d9f2,{'sectionId':0x64});return hasDefaultDashboard(_0x3f6cad)['then'](function(_0x5b1da9){return _[_0xc75d('0x32')](_0x53d9f2,function(_0x4b6068){if(_0x4b6068[_0xc75d('0x5c')]===0x64){_0x4b6068[_0xc75d('0x68')]=_0x5b1da9;}return _0x4b6068;});});}else{return;}})[_0xc75d('0x2b')](function(_0x13c94d){if(_0x13c94d)_0x53d9f2=_0x13c94d;if(_[_0xc75d('0x67')](_0x5e63b1,0x3eb)){var _0x43a9c1=_[_0xc75d('0x51')](_0x53d9f2,{'sectionId':0x3eb});return getCustomDashboards(_0x43a9c1)['then'](function(_0x238ef0){return _[_0xc75d('0x32')](_0x53d9f2,function(_0xb559b1){if(_0x43a9c1['enabled']){if(_0xb559b1['sectionId']===0x3eb){_0xb559b1[_0xc75d('0x68')]=_0x238ef0;}}else{if(_0xb559b1['sectionId']===0x64){_0xb559b1[_0xc75d('0x68')]=_0x238ef0;}}return _0xb559b1;});});}else{return;}})[_0xc75d('0x2b')](function(_0x1ea138){if(_0x1ea138)_0x53d9f2=_0x1ea138;if(_[_0xc75d('0x67')](_0x5e63b1,0x709)){var _0x5d4697=_['find'](_0x53d9f2,{'sectionId':0x709});return getPlugins(_0x5d4697)['then'](function(_0xc5c3ee){if(_0x5d4697[_0xc75d('0x65')]){return _[_0xc75d('0x32')](_0x53d9f2,function(_0x4aae6e){if(_0x4aae6e[_0xc75d('0x5c')]===0x709){_0x4aae6e[_0xc75d('0x68')]=_0xc5c3ee;}return _0x4aae6e;});}else{var _0x15485a={'sectionId':0x76c,'enabled':0x1,'subsections':_0xc5c3ee};var _0x5cf357=_[_0xc75d('0x32')](_0x53d9f2);_0x5cf357[_0xc75d('0x69')](_0x15485a);return _0x5cf357;}});}else{return;}})['then'](function(_0x1cd062){if(_0x1cd062)_0x53d9f2=_0x1cd062;return _[_0xc75d('0x46')](_0x53d9f2,[_0xc75d('0x65'),0x1]);})[_0xc75d('0x2b')](respondWithResult(_0x4d840b,null))[_0xc75d('0x4b')](handleError(_0x4d840b,null));};function hasDefaultDashboard(_0x34feed){var _0x569f99=[0x65];return new BPromise(function(_0x394e86,_0x196c80){try{if(_0x34feed[_0xc75d('0x5a')]){_0x394e86(_0x569f99);}else{return db[_0xc75d('0x5b')][_0xc75d('0x6a')]({'where':{'sectionId':_0x34feed['id']},'raw':!![]})[_0xc75d('0x2b')](function(_0x5bee61){_0x5bee61?_0x394e86(_0x569f99):_0x394e86();});}}catch(_0x129512){_0x196c80(_0x129512);}});}function getCustomDashboards(_0x4d7659){var _0x765f44=[];return new BPromise(function(_0x1c0c8c,_0xed628f){try{if(_0x4d7659[_0xc75d('0x5a')]){return db[_0xc75d('0x6b')][_0xc75d('0x49')]({'raw':!![]})[_0xc75d('0x2b')](function(_0x179d1e){_0x179d1e[_0xc75d('0x6c')](function(_0x45a4af){_0x765f44[_0xc75d('0x69')](_0x45a4af['id']+0x1869f);});_0x1c0c8c(_0x765f44);});}else{return db[_0xc75d('0x5b')][_0xc75d('0x49')]({'where':{'sectionId':_0x4d7659['id']},'raw':!![]})[_0xc75d('0x2b')](function(_0x34aabb){_0x34aabb[_0xc75d('0x6c')](function(_0x2af5a4){_0x765f44[_0xc75d('0x69')](_0x2af5a4['resourceId']+0x1869f);});_0x1c0c8c(_0x765f44);});}}catch(_0x525a07){_0xed628f(_0x525a07);}});}function getPlugins(_0x21b915){var _0x5476ad=[];return new BPromise(function(_0x535341,_0x4b98d8){try{if(_0x21b915[_0xc75d('0x5a')]){return db['Plugin'][_0xc75d('0x49')]({'raw':!![]})['then'](function(_0x41e255){_0x41e255['forEach'](function(_0x49147b){_0x5476ad['push'](_0x49147b['id']+0x15b38);});_0x535341(_0x5476ad);});}else{return db[_0xc75d('0x5b')][_0xc75d('0x49')]({'where':{'sectionId':_0x21b915['id']},'raw':!![]})[_0xc75d('0x2b')](function(_0x56a537){_0x56a537[_0xc75d('0x6c')](function(_0x5b86a5){_0x5476ad[_0xc75d('0x69')](_0x5b86a5['resourceId']+0x15b38);});_0x535341(_0x5476ad);});}}catch(_0x235453){_0x4b98d8(_0x235453);}});}exports['addResources']=function(_0x2a72bc,_0x5dd3b5){return db[_0xc75d('0x33')]['find']({'where':{'id':_0x2a72bc[_0xc75d('0x4d')]['id']}})[_0xc75d('0x2b')](handleEntityNotFound(_0x5dd3b5,null))[_0xc75d('0x2b')](function(_0x8b33f4){if(_0x8b33f4){return db[_0xc75d('0x58')][_0xc75d('0x5f')](function(_0x679d4d){return db[_0xc75d('0x59')][_0xc75d('0x49')]({'where':{'userProfileId':_0x2a72bc['params']['id']},'attributes':['id'],'raw':!![]})[_0xc75d('0x2b')](function(_0x48d30d){if(_0x48d30d){return db[_0xc75d('0x59')]['destroy']({'where':{'userProfileId':_0x2a72bc[_0xc75d('0x4d')]['id'],'id':_[_0xc75d('0x32')](_0x48d30d,function(_0x324d01){return _0x324d01['id'];})},'transaction':_0x679d4d});}})['then'](function(_0x154306){var _0x6b8d80=_[_0xc75d('0x32')](_0x2a72bc[_0xc75d('0x53')],function(_0x2c0f0e){_0x2c0f0e[_0xc75d('0x5d')]=_0x2a72bc[_0xc75d('0x4d')]['id'];return _0x2c0f0e;});return db[_0xc75d('0x59')][_0xc75d('0x6d')](_0x6b8d80,{'raw':!![],'transaction':_0x679d4d});})[_0xc75d('0x2b')](function(_0x1e0422){var _0x411cd3=_[_0xc75d('0x46')](_[_0xc75d('0x32')](_0x1e0422,function(_0x663e6e){return _0x663e6e[_0xc75d('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x411cd3){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x2a72bc['params']['id'],'sectionId':_[_0xc75d('0x32')](_0x411cd3,function(_0x4670da){return _0x4670da['sectionId'];})},'attributes':['id',_0xc75d('0x5c')],'raw':!![]})[_0xc75d('0x2b')](function(_0x4acc2a){var _0x2109a9=_[_0xc75d('0x32')](_0x2a72bc[_0xc75d('0x53')],function(_0x2d4c40){_0x2d4c40[_0xc75d('0x5d')]=_0x2a72bc['params']['id'];return _0x2d4c40;});return db[_0xc75d('0x5b')]['bulkCreate'](_0x2109a9,{'raw':!![],'transaction':_0x679d4d});});}})[_0xc75d('0x4b')](handleError(_0x5dd3b5,null));});}})['then'](function(_0x6b902e){var _0xfc481e=_[_0xc75d('0x32')](_0x6b902e,function(_0x1666f9){return _0x1666f9[_0xc75d('0x54')]({'plain':!![]});});})[_0xc75d('0x2b')](respondWithResult(_0x5dd3b5,null))['catch'](handleError(_0x5dd3b5,null));};exports['removeResources']=function(_0x1861c8,_0x37b61e,_0x1b882f){return db[_0xc75d('0x33')][_0xc75d('0x51')]({'where':{'id':_0x1861c8[_0xc75d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x37b61e,null))[_0xc75d('0x2b')](function(_0x4e7e0a){if(_0x4e7e0a){return _0x4e7e0a['removeResources'](_0x1861c8['query'][_0xc75d('0x63')]);}})[_0xc75d('0x2b')](respondWithStatusCode(_0x37b61e,null))['catch'](handleError(_0x37b61e,null));};exports[_0xc75d('0x6e')]=function(_0x5650db,_0xbb82b){var _0x15e4b1={};if(!_0x5650db[_0xc75d('0x38')][_0xc75d('0x6f')])throw new Error(_0xc75d('0x70'));if(!_0x5650db['query'][_0xc75d('0x3e')](_0xc75d('0x3f'))){_0x15e4b1['limit']=qs[_0xc75d('0x24')](_0x5650db[_0xc75d('0x38')][_0xc75d('0x24')]);_0x15e4b1[_0xc75d('0x23')]=qs['offset'](_0x5650db[_0xc75d('0x38')][_0xc75d('0x23')]);}return db[_0xc75d('0x33')][_0xc75d('0x51')]({'where':{'id':_0x5650db[_0xc75d('0x4d')]['id']}})[_0xc75d('0x2b')](function(_0x35585c){if(!_0x35585c)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x5650db[_0xc75d('0x4d')]['id']);return db['UserProfile']['getResources'](_0x5650db);})[_0xc75d('0x2b')](respondWithFilteredResult(_0xbb82b,_0x15e4b1))[_0xc75d('0x4b')](handleError(_0xbb82b,null));};
\ No newline at end of file
+var _0x5464=['includeAll','include','findAll','rows','catch','params','find','create','body','clone','get','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','sequelize','push','removeSections','getSections','isEmpty','includes','subsections','enabled','findOne','forEach','resourceId','removeResources','ids','nolimit','getResources','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','map','UserProfile','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options'];(function(_0x5e3fb7,_0x4f0c05){var _0x3c9228=function(_0x8636ae){while(--_0x8636ae){_0x5e3fb7['push'](_0x5e3fb7['shift']());}};_0x3c9228(++_0x4f0c05);}(_0x5464,0x15d));var _0x4546=function(_0x4aa0ac,_0x43381d){_0x4aa0ac=_0x4aa0ac-0x0;var _0x55b7fb=_0x5464[_0x4aa0ac];return _0x55b7fb;};'use strict';var emlformat=require(_0x4546('0x0'));var rimraf=require(_0x4546('0x1'));var zipdir=require(_0x4546('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4546('0x3'));var moment=require('moment');var BPromise=require(_0x4546('0x4'));var Mustache=require('mustache');var util=require(_0x4546('0x5'));var path=require(_0x4546('0x6'));var sox=require(_0x4546('0x7'));var csv=require(_0x4546('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4546('0x9'));var crypto=require(_0x4546('0xa'));var jsforce=require(_0x4546('0xb'));var deskjs=require(_0x4546('0xc'));var toCsv=require(_0x4546('0x8'));var querystring=require(_0x4546('0xd'));var Papa=require(_0x4546('0xe'));var Redis=require(_0x4546('0xf'));var authService=require(_0x4546('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4546('0x11'));var hardwareService=require(_0x4546('0x12'));var logger=require(_0x4546('0x13'))('api');var utils=require(_0x4546('0x14'));var config=require(_0x4546('0x15'));var licenseUtil=require(_0x4546('0x16'));var db=require(_0x4546('0x17'))['db'];config['redis']=_['defaults'](config[_0x4546('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x4f5571,_0x102180){_0x102180=_0x102180||0xcc;return function(_0x51e279){if(_0x51e279){return _0x4f5571[_0x4546('0x19')](_0x102180);}return _0x4f5571['status'](_0x102180)[_0x4546('0x1a')]();};}function respondWithResult(_0x564f3e,_0x3741f2){_0x3741f2=_0x3741f2||0xc8;return function(_0x18bc09){if(_0x18bc09){return _0x564f3e[_0x4546('0x1b')](_0x3741f2)[_0x4546('0x1c')](_0x18bc09);}};}function respondWithFilteredResult(_0x2a294b,_0x15e09e){return function(_0x57d8de){if(_0x57d8de){var _0x4ffd6b=typeof _0x15e09e['offset']===_0x4546('0x1d')&&typeof _0x15e09e[_0x4546('0x1e')]===_0x4546('0x1d');var _0x3d95c2=_0x57d8de[_0x4546('0x1f')];var _0x337a44=_0x4ffd6b?0x0:_0x15e09e[_0x4546('0x20')];var _0x2f6329=_0x4ffd6b?_0x57d8de[_0x4546('0x1f')]:_0x15e09e[_0x4546('0x20')]+_0x15e09e['limit'];var _0x2d689f;if(_0x2f6329>=_0x3d95c2){_0x2f6329=_0x3d95c2;_0x2d689f=0xc8;}else{_0x2d689f=0xce;}_0x2a294b[_0x4546('0x1b')](_0x2d689f);return _0x2a294b['set'](_0x4546('0x21'),_0x337a44+'-'+_0x2f6329+'/'+_0x3d95c2)[_0x4546('0x1c')](_0x57d8de);}return null;};}function patchUpdates(_0x1a1984){return function(_0x2f065d){try{jsonpatch[_0x4546('0x22')](_0x2f065d,_0x1a1984,!![]);}catch(_0x15b013){return BPromise['reject'](_0x15b013);}return _0x2f065d[_0x4546('0x23')]();};}function saveUpdates(_0x2cca8b,_0x4f9fcf){return function(_0x824698){if(_0x824698){return _0x824698[_0x4546('0x24')](_0x2cca8b)[_0x4546('0x25')](function(_0x4467ee){return _0x4467ee;});}return null;};}function removeEntity(_0x23084b,_0x53ae5e){return function(_0x49dc98){if(_0x49dc98){return _0x49dc98[_0x4546('0x26')]()[_0x4546('0x25')](function(){_0x23084b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43740e,_0x166d6f){return function(_0x15611c){if(!_0x15611c){_0x43740e[_0x4546('0x19')](0x194);}return _0x15611c;};}function handleError(_0x29a3f0,_0x225bc6){_0x225bc6=_0x225bc6||0x1f4;return function(_0xcea7da){logger['error'](_0xcea7da[_0x4546('0x27')]);if(_0xcea7da['name']){delete _0xcea7da[_0x4546('0x28')];}_0x29a3f0[_0x4546('0x1b')](_0x225bc6)['send'](_0xcea7da);};}exports['index']=function(_0xf7a95b,_0x5af997){var _0x3c7c7d={},_0x58b69={},_0x480d8e={'count':0x0,'rows':[]};var _0x5f0226=_[_0x4546('0x29')](db[_0x4546('0x2a')][_0x4546('0x2b')],function(_0x5716dc){return{'name':_0x5716dc[_0x4546('0x2c')],'type':_0x5716dc[_0x4546('0x2d')]['key']};});_0x58b69[_0x4546('0x2e')]=_['map'](_0x5f0226,_0x4546('0x28'));_0x58b69[_0x4546('0x2f')]=_[_0x4546('0x30')](_0xf7a95b[_0x4546('0x2f')]);_0x58b69['filters']=_[_0x4546('0x31')](_0x58b69[_0x4546('0x2e')],_0x58b69[_0x4546('0x2f')]);_0x3c7c7d[_0x4546('0x32')]=_[_0x4546('0x31')](_0x58b69[_0x4546('0x2e')],qs['fields'](_0xf7a95b[_0x4546('0x2f')][_0x4546('0x33')]));_0x3c7c7d['attributes']=_0x3c7c7d['attributes'][_0x4546('0x34')]?_0x3c7c7d[_0x4546('0x32')]:_0x58b69['model'];if(!_0xf7a95b[_0x4546('0x2f')][_0x4546('0x35')]('nolimit')){_0x3c7c7d['limit']=qs[_0x4546('0x1e')](_0xf7a95b[_0x4546('0x2f')][_0x4546('0x1e')]);_0x3c7c7d[_0x4546('0x20')]=qs[_0x4546('0x20')](_0xf7a95b[_0x4546('0x2f')]['offset']);}_0x3c7c7d[_0x4546('0x36')]=qs[_0x4546('0x37')](_0xf7a95b['query'][_0x4546('0x37')]);_0x3c7c7d['where']=qs[_0x4546('0x38')](_[_0x4546('0x39')](_0xf7a95b['query'],_0x58b69['filters']),_0x5f0226);if(_0xf7a95b[_0x4546('0x2f')][_0x4546('0x3a')]){_0x3c7c7d[_0x4546('0x3b')]=_['merge'](_0x3c7c7d[_0x4546('0x3b')],{'$or':_[_0x4546('0x29')](_0x5f0226,function(_0x24eb6d){if(_0x24eb6d[_0x4546('0x2d')]!==_0x4546('0x3c')){var _0x320772={};_0x320772[_0x24eb6d[_0x4546('0x28')]]={'$like':'%'+_0xf7a95b[_0x4546('0x2f')]['filter']+'%'};return _0x320772;}})});}_0x3c7c7d=_[_0x4546('0x3d')]({},_0x3c7c7d,_0xf7a95b[_0x4546('0x3e')]);var _0x4a76a2={'where':_0x3c7c7d['where']};return db[_0x4546('0x2a')][_0x4546('0x1f')](_0x4a76a2)[_0x4546('0x25')](function(_0x1ea5c4){_0x480d8e[_0x4546('0x1f')]=_0x1ea5c4;if(_0xf7a95b['query'][_0x4546('0x3f')]){_0x3c7c7d[_0x4546('0x40')]=[{'all':!![]}];}return db[_0x4546('0x2a')][_0x4546('0x41')](_0x3c7c7d);})[_0x4546('0x25')](function(_0x3fabf0){_0x480d8e[_0x4546('0x42')]=_0x3fabf0;return _0x480d8e;})[_0x4546('0x25')](respondWithFilteredResult(_0x5af997,_0x3c7c7d))[_0x4546('0x43')](handleError(_0x5af997,null));};exports['show']=function(_0x270f59,_0x1dd5b0){var _0x3510e0={'raw':![],'where':{'id':_0x270f59[_0x4546('0x44')]['id']}},_0x35b51e={};_0x35b51e[_0x4546('0x2e')]=_[_0x4546('0x30')](db[_0x4546('0x2a')][_0x4546('0x2b')]);_0x35b51e[_0x4546('0x2f')]=_[_0x4546('0x30')](_0x270f59['query']);_0x35b51e[_0x4546('0x38')]=_[_0x4546('0x31')](_0x35b51e['model'],_0x35b51e[_0x4546('0x2f')]);_0x3510e0[_0x4546('0x32')]=_[_0x4546('0x31')](_0x35b51e['model'],qs[_0x4546('0x33')](_0x270f59[_0x4546('0x2f')][_0x4546('0x33')]));_0x3510e0[_0x4546('0x32')]=_0x3510e0[_0x4546('0x32')][_0x4546('0x34')]?_0x3510e0[_0x4546('0x32')]:_0x35b51e[_0x4546('0x2e')];if(_0x270f59[_0x4546('0x2f')][_0x4546('0x3f')]){_0x3510e0['include']=[{'all':!![]}];}_0x3510e0=_[_0x4546('0x3d')]({},_0x3510e0,_0x270f59[_0x4546('0x3e')]);return db['UserProfile'][_0x4546('0x45')](_0x3510e0)[_0x4546('0x25')](handleEntityNotFound(_0x1dd5b0,null))[_0x4546('0x25')](respondWithResult(_0x1dd5b0,null))[_0x4546('0x43')](handleError(_0x1dd5b0,null));};exports['create']=function(_0x329566,_0x57bb39){return db[_0x4546('0x2a')][_0x4546('0x46')](_0x329566[_0x4546('0x47')],{})['then'](respondWithResult(_0x57bb39,0xc9))[_0x4546('0x43')](handleError(_0x57bb39,null));};exports[_0x4546('0x48')]=function(_0x13f705,_0xc8a1f3){var _0x25c4cf={'where':{'id':_0x13f705[_0x4546('0x44')]['id']}},_0x25c401={};_0x25c401[_0x4546('0x2e')]=_[_0x4546('0x30')](db[_0x4546('0x2a')][_0x4546('0x2b')]);_0x25c4cf['attributes']=_[_0x4546('0x31')](_0x25c401[_0x4546('0x2e')],qs['fields'](_0x13f705[_0x4546('0x2f')][_0x4546('0x33')]));_0x25c4cf[_0x4546('0x32')]=_0x25c4cf['attributes'][_0x4546('0x34')]?_0x25c4cf[_0x4546('0x32')]:_0x25c401[_0x4546('0x2e')];if(_0x13f705[_0x4546('0x2f')][_0x4546('0x3f')]){_0x25c4cf[_0x4546('0x40')]=[{'all':!![]}];}_0x25c4cf=_[_0x4546('0x3d')]({},_0x25c4cf,_0x13f705[_0x4546('0x3e')]);return db[_0x4546('0x2a')][_0x4546('0x45')](_0x25c4cf)[_0x4546('0x25')](handleEntityNotFound(_0xc8a1f3,null))[_0x4546('0x25')](function(_0x3d6094){if(_0x3d6094){var _0x145284=_0x3d6094[_0x4546('0x49')]({'plain':!![]});_0x145284=qs[_0x4546('0x4a')](_0x145284,['id','createdAt',_0x4546('0x4b'),_0x4546('0x4c')]);_0x13f705['body']=_[_0x4546('0x4a')](_0x13f705[_0x4546('0x47')],['id',_0x4546('0x4d'),_0x4546('0x4b')]);return db['sequelize'][_0x4546('0x4e')](function(_0x32248c){return db[_0x4546('0x2a')][_0x4546('0x46')](_[_0x4546('0x3d')](_0x145284,_0x13f705[_0x4546('0x47')]),{'include':_0x13f705[_0x4546('0x2f')][_0x4546('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x32248c})[_0x4546('0x25')](function(_0xcf682c){var _0x67f40d=_0xcf682c['get']({'plain':!![]});return db[_0x4546('0x4f')][_0x4546('0x41')]({'where':{'userProfileId':_0x13f705[_0x4546('0x44')]['id']},'raw':!![]})[_0x4546('0x25')](function(_0x4890b4){if(_0x4890b4){return BPromise[_0x4546('0x50')](_0x4890b4,function(_0x4a1a00){return new BPromise(function(_0x28238f,_0x24e66c){if(_0x4a1a00[_0x4546('0x51')]===null||_0x4a1a00[_0x4546('0x51')]===0x1)_0x28238f(null);return db[_0x4546('0x52')]['findAll']({'where':{'sectionId':_0x4a1a00['id']},'raw':!![]})[_0x4546('0x25')](function(_0x4f5edb){var _0x340d25=_['map'](_0x4f5edb,function(_0x4d88bb){return qs['omit'](_0x4d88bb,['id',_0x4546('0x4d'),'updatedAt',_0x4546('0x53')]);});_0x28238f(_0x340d25);})[_0x4546('0x43')](function(_0x1e4914){_0x24e66c(_0x1e4914);});})[_0x4546('0x25')](function(_0x5a8b9e){var _0x20b67f=qs[_0x4546('0x4a')](_0x4a1a00,['id',_0x4546('0x4d'),_0x4546('0x4b')]);_0x20b67f[_0x4546('0x54')]=_0x67f40d['id'];if(_0x5a8b9e)_0x20b67f['Resources']=_0x5a8b9e;return _0x20b67f;})[_0x4546('0x25')](function(_0x4b3340){return db[_0x4546('0x4f')]['create'](_0x4b3340,{'include':[{'model':db[_0x4546('0x52')],'as':_0x4546('0x55')}],'raw':!![],'transaction':_0x32248c});});})[_0x4546('0x25')](function(){return _0x67f40d;});}});});});}})['then'](respondWithResult(_0xc8a1f3,0xc9))[_0x4546('0x43')](handleError(_0xc8a1f3,null));};exports[_0x4546('0x24')]=function(_0x17b211,_0x220259){if(_0x17b211[_0x4546('0x47')]['id']){delete _0x17b211[_0x4546('0x47')]['id'];}return db[_0x4546('0x2a')][_0x4546('0x45')]({'where':{'id':_0x17b211['params']['id']}})[_0x4546('0x25')](handleEntityNotFound(_0x220259,null))[_0x4546('0x25')](saveUpdates(_0x17b211[_0x4546('0x47')],null))[_0x4546('0x25')](respondWithResult(_0x220259,null))[_0x4546('0x43')](handleError(_0x220259,null));};exports[_0x4546('0x26')]=function(_0x3c92ff,_0x322864){return db[_0x4546('0x2a')][_0x4546('0x45')]({'where':{'id':_0x3c92ff[_0x4546('0x44')]['id']}})[_0x4546('0x25')](handleEntityNotFound(_0x322864,null))[_0x4546('0x25')](removeEntity(_0x322864,null))[_0x4546('0x43')](handleError(_0x322864,null));};exports[_0x4546('0x56')]=function(_0x4d73a0,_0x21ff57){return db['UserProfile'][_0x4546('0x56')]()[_0x4546('0x25')](respondWithResult(_0x21ff57,null))['catch'](handleError(_0x21ff57,null));};exports[_0x4546('0x57')]=function(_0x335881,_0x27680b){var _0x180b24=_0x335881[_0x4546('0x47')];return db[_0x4546('0x2a')][_0x4546('0x45')]({'where':{'id':_0x335881[_0x4546('0x44')]['id']}})[_0x4546('0x25')](handleEntityNotFound(_0x27680b,null))[_0x4546('0x25')](function(_0x1aa678){if(_0x1aa678){return db[_0x4546('0x58')][_0x4546('0x4e')](function(_0x49cac3){return db[_0x4546('0x4f')][_0x4546('0x26')]({'where':{'userProfileId':_0x335881[_0x4546('0x44')]['id'],'sectionId':_['map'](_0x180b24,function(_0xb6e936){return _0xb6e936[_0x4546('0x53')];})},'transaction':_0x49cac3})[_0x4546('0x25')](function(){var _0x6bf923=_[_0x4546('0x29')](_0x180b24,function(_0x470cf9){_0x470cf9[_0x4546('0x54')]=_0x335881['params']['id'];return _0x470cf9;});var _0x460e0e=[];return BPromise[_0x4546('0x50')](_0x6bf923,function(_0x12237c){return db['UserProfileSection']['create'](_0x12237c,{'include':[{'model':db[_0x4546('0x52')],'as':_0x4546('0x55')}],'raw':!![],'transaction':_0x49cac3})['then'](function(_0x44dd7a){_0x460e0e[_0x4546('0x59')](_0x44dd7a[_0x4546('0x49')]({'plain':!![]}));});})[_0x4546('0x25')](function(){return _0x460e0e;});});});}})['then'](function(_0x4551a8){return _0x4551a8;})[_0x4546('0x25')](respondWithResult(_0x27680b,null))[_0x4546('0x43')](handleError(_0x27680b,null));};exports[_0x4546('0x5a')]=function(_0x1a97cb,_0x45f510){var _0x194d41;return db[_0x4546('0x2a')]['find']({'where':{'id':_0x1a97cb[_0x4546('0x44')]['id']},'attributes':['id',_0x4546('0x28')]})['then'](handleEntityNotFound(_0x45f510,null))[_0x4546('0x25')](function(_0x5a0de1){if(_0x5a0de1){_0x194d41=_0x5a0de1;return db['UserProfileSection'][_0x4546('0x26')]({'where':{'userProfileId':_0x1a97cb[_0x4546('0x44')]['id'],'sectionId':_0x1a97cb[_0x4546('0x2f')]['ids']}});}})[_0x4546('0x25')](function(){return _0x194d41;})[_0x4546('0x25')](respondWithStatusCode(_0x45f510,null))[_0x4546('0x43')](handleError(_0x45f510,null));};exports[_0x4546('0x5b')]=function(_0x361815,_0x40d040){var _0x2798a1=[];var _0x50078a=[];return db['UserProfileSection'][_0x4546('0x41')]({'where':{'userProfileId':_0x361815[_0x4546('0x44')]['id']},'raw':!![]})[_0x4546('0x25')](function(_0x205d8c){_0x2798a1=_[_0x4546('0x3a')](_0x205d8c,function(_0x332abe){return _0x332abe['enabled']===0x1||_['includes']([0x3eb,0x709],_0x332abe[_0x4546('0x53')]);});if(!_[_0x4546('0x5c')](_0x2798a1)){return _[_0x4546('0x29')](_0x2798a1,function(_0x16c904){return _0x16c904[_0x4546('0x53')];});}else{return;}})[_0x4546('0x25')](function(_0x3e38bd){if(_0x3e38bd)_0x50078a=_0x3e38bd;if(_[_0x4546('0x5d')](_0x50078a,0x64)){var _0x56142c=_[_0x4546('0x45')](_0x2798a1,{'sectionId':0x64});return hasDefaultDashboard(_0x56142c)['then'](function(_0x1590fc){return _[_0x4546('0x29')](_0x2798a1,function(_0x2edc95){if(_0x2edc95['sectionId']===0x64){_0x2edc95[_0x4546('0x5e')]=_0x1590fc;}return _0x2edc95;});});}else{return;}})[_0x4546('0x25')](function(_0x12a745){if(_0x12a745)_0x2798a1=_0x12a745;if(_[_0x4546('0x5d')](_0x50078a,0x3eb)){var _0xb07ca1=_[_0x4546('0x45')](_0x2798a1,{'sectionId':0x3eb});return getCustomDashboards(_0xb07ca1)[_0x4546('0x25')](function(_0x5858ea){return _[_0x4546('0x29')](_0x2798a1,function(_0xc35517){if(_0xb07ca1['enabled']){if(_0xc35517[_0x4546('0x53')]===0x3eb){_0xc35517[_0x4546('0x5e')]=_0x5858ea;}}else{if(_0xc35517['sectionId']===0x64){_0xc35517[_0x4546('0x5e')]=_0x5858ea;}}return _0xc35517;});});}else{return;}})[_0x4546('0x25')](function(_0x2ac84){if(_0x2ac84)_0x2798a1=_0x2ac84;if(_[_0x4546('0x5d')](_0x50078a,0x709)){var _0x5a7bea=_['find'](_0x2798a1,{'sectionId':0x709});return getPlugins(_0x5a7bea)[_0x4546('0x25')](function(_0x2c6d39){if(_0x5a7bea[_0x4546('0x5f')]){return _[_0x4546('0x29')](_0x2798a1,function(_0x2b48a9){if(_0x2b48a9['sectionId']===0x709){_0x2b48a9[_0x4546('0x5e')]=_0x2c6d39;}return _0x2b48a9;});}else{var _0x1db1cb={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2c6d39};var _0x39ddd5=_[_0x4546('0x29')](_0x2798a1);_0x39ddd5[_0x4546('0x59')](_0x1db1cb);return _0x39ddd5;}});}else{return;}})['then'](function(_0x2724d9){if(_0x2724d9)_0x2798a1=_0x2724d9;return _['filter'](_0x2798a1,[_0x4546('0x5f'),0x1]);})[_0x4546('0x25')](respondWithResult(_0x40d040,null))[_0x4546('0x43')](handleError(_0x40d040,null));};function hasDefaultDashboard(_0x21e7cf){var _0x29e6e3=[0x65];return new BPromise(function(_0x19ff9b,_0x26cb26){try{if(_0x21e7cf[_0x4546('0x51')]){_0x19ff9b(_0x29e6e3);}else{return db['UserProfileResource'][_0x4546('0x60')]({'where':{'sectionId':_0x21e7cf['id']},'raw':!![]})[_0x4546('0x25')](function(_0x353d63){_0x353d63?_0x19ff9b(_0x29e6e3):_0x19ff9b();});}}catch(_0x44bb63){_0x26cb26(_0x44bb63);}});}function getCustomDashboards(_0x3a0278){var _0x51761d=[];return new BPromise(function(_0x39fbe2,_0x5a6a2e){try{if(_0x3a0278['autoAssociation']){return db['Dashboard'][_0x4546('0x41')]({'raw':!![]})[_0x4546('0x25')](function(_0x212b14){_0x212b14[_0x4546('0x61')](function(_0x465d59){_0x51761d[_0x4546('0x59')](_0x465d59['id']+0x1869f);});_0x39fbe2(_0x51761d);});}else{return db[_0x4546('0x52')][_0x4546('0x41')]({'where':{'sectionId':_0x3a0278['id']},'raw':!![]})[_0x4546('0x25')](function(_0x2df3d5){_0x2df3d5['forEach'](function(_0x3b8888){_0x51761d['push'](_0x3b8888[_0x4546('0x62')]+0x1869f);});_0x39fbe2(_0x51761d);});}}catch(_0x278e43){_0x5a6a2e(_0x278e43);}});}function getPlugins(_0x3dbafd){var _0x2d7999=[];return new BPromise(function(_0xd25922,_0x44d4c1){try{if(_0x3dbafd[_0x4546('0x51')]){return db['Plugin'][_0x4546('0x41')]({'raw':!![]})[_0x4546('0x25')](function(_0x4c69d9){_0x4c69d9[_0x4546('0x61')](function(_0xfb7734){_0x2d7999[_0x4546('0x59')](_0xfb7734['id']+0x15b38);});_0xd25922(_0x2d7999);});}else{return db[_0x4546('0x52')][_0x4546('0x41')]({'where':{'sectionId':_0x3dbafd['id']},'raw':!![]})[_0x4546('0x25')](function(_0x210d6d){_0x210d6d[_0x4546('0x61')](function(_0x261c19){_0x2d7999[_0x4546('0x59')](_0x261c19[_0x4546('0x62')]+0x15b38);});_0xd25922(_0x2d7999);});}}catch(_0x2ba11b){_0x44d4c1(_0x2ba11b);}});}exports['addResources']=function(_0x37d871,_0xf3a8dc){return db[_0x4546('0x2a')][_0x4546('0x45')]({'where':{'id':_0x37d871[_0x4546('0x44')]['id']}})[_0x4546('0x25')](handleEntityNotFound(_0xf3a8dc,null))[_0x4546('0x25')](function(_0x240923){if(_0x240923){return db[_0x4546('0x58')][_0x4546('0x4e')](function(_0x40dd19){return db[_0x4546('0x4f')][_0x4546('0x41')]({'where':{'userProfileId':_0x37d871[_0x4546('0x44')]['id']},'attributes':['id'],'raw':!![]})[_0x4546('0x25')](function(_0x2aa5c6){if(_0x2aa5c6){return db[_0x4546('0x4f')][_0x4546('0x26')]({'where':{'userProfileId':_0x37d871[_0x4546('0x44')]['id'],'id':_[_0x4546('0x29')](_0x2aa5c6,function(_0xb8a3e4){return _0xb8a3e4['id'];})},'transaction':_0x40dd19});}})[_0x4546('0x25')](function(_0x21cb88){var _0x58e21b=_['map'](_0x37d871[_0x4546('0x47')],function(_0x509745){_0x509745[_0x4546('0x54')]=_0x37d871[_0x4546('0x44')]['id'];return _0x509745;});return db[_0x4546('0x4f')]['bulkCreate'](_0x58e21b,{'raw':!![],'transaction':_0x40dd19});})[_0x4546('0x25')](function(_0x55010f){var _0x497302=_[_0x4546('0x3a')](_[_0x4546('0x29')](_0x55010f,function(_0xad28f5){return _0xad28f5['get']({'plain':!![]});}),{'includeAll':![]});if(_0x497302){return db['UserProfileSection'][_0x4546('0x41')]({'where':{'userProfileId':_0x37d871[_0x4546('0x44')]['id'],'sectionId':_['map'](_0x497302,function(_0x633027){return _0x633027[_0x4546('0x53')];})},'attributes':['id',_0x4546('0x53')],'raw':!![]})[_0x4546('0x25')](function(_0x1d3e26){var _0x65a6a4=_[_0x4546('0x29')](_0x37d871['body'],function(_0x320531){_0x320531['userProfileId']=_0x37d871[_0x4546('0x44')]['id'];return _0x320531;});return db['UserProfileResource']['bulkCreate'](_0x65a6a4,{'raw':!![],'transaction':_0x40dd19});});}})[_0x4546('0x43')](handleError(_0xf3a8dc,null));});}})['then'](function(_0x4aee1f){var _0xb53087=_[_0x4546('0x29')](_0x4aee1f,function(_0x2b65b7){return _0x2b65b7[_0x4546('0x49')]({'plain':!![]});});})[_0x4546('0x25')](respondWithResult(_0xf3a8dc,null))[_0x4546('0x43')](handleError(_0xf3a8dc,null));};exports[_0x4546('0x63')]=function(_0x5e8e14,_0xf459e4,_0x53e24d){return db[_0x4546('0x2a')][_0x4546('0x45')]({'where':{'id':_0x5e8e14[_0x4546('0x44')]['id']}})[_0x4546('0x25')](handleEntityNotFound(_0xf459e4,null))[_0x4546('0x25')](function(_0x3eeb13){if(_0x3eeb13){return _0x3eeb13['removeResources'](_0x5e8e14[_0x4546('0x2f')][_0x4546('0x64')]);}})[_0x4546('0x25')](respondWithStatusCode(_0xf459e4,null))[_0x4546('0x43')](handleError(_0xf459e4,null));};exports['getResources']=function(_0x33f125,_0x3a3077){var _0x2111a0={};if(!_0x33f125['query']['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x33f125[_0x4546('0x2f')]['hasOwnProperty'](_0x4546('0x65'))){_0x2111a0['limit']=qs[_0x4546('0x1e')](_0x33f125['query'][_0x4546('0x1e')]);_0x2111a0[_0x4546('0x20')]=qs['offset'](_0x33f125[_0x4546('0x2f')]['offset']);}return db[_0x4546('0x2a')][_0x4546('0x45')]({'where':{'id':_0x33f125[_0x4546('0x44')]['id']}})[_0x4546('0x25')](function(_0x7f3cf0){if(!_0x7f3cf0)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x33f125[_0x4546('0x44')]['id']);return db[_0x4546('0x2a')][_0x4546('0x66')](_0x33f125);})[_0x4546('0x25')](respondWithFilteredResult(_0x3a3077,_0x2111a0))[_0x4546('0x43')](handleError(_0x3a3077,null));};
\ No newline at end of file
index 151a21d..86462b4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x01d9=['UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1eb585,_0x202476){var _0x497ee2=function(_0x36dffa){while(--_0x36dffa){_0x1eb585['push'](_0x1eb585['shift']());}};_0x497ee2(++_0x202476);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x901d('0x0'));var UserProfile=require(_0x901d('0x1'))['db'][_0x901d('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x901d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x901d('0x4'),'afterDestroy':_0x901d('0x5')};function emitEvent(_0x247cfc){return function(_0x8f7b4,_0x214f38,_0x456f31){UserProfileEvents[_0x901d('0x6')](_0x247cfc+':'+_0x8f7b4['id'],_0x8f7b4);UserProfileEvents['emit'](_0x247cfc,_0x8f7b4);_0x456f31(null);};}for(var e in events){if(events[_0x901d('0x7')](e)){var event=events[e];UserProfile[_0x901d('0x8')](e,emitEvent(event));}}module[_0x901d('0x9')]=UserProfileEvents;
\ No newline at end of file
+var _0x7046=['events','../../mysqldb','UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x111c5c,_0x124a16){var _0x20a69f=function(_0x3e14d4){while(--_0x3e14d4){_0x111c5c['push'](_0x111c5c['shift']());}};_0x20a69f(++_0x124a16);}(_0x7046,0x144));var _0x6704=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x7046[_0x8c43de];return _0xa6591b;};'use strict';var EventEmitter=require(_0x6704('0x0'));var UserProfile=require(_0x6704('0x1'))['db'][_0x6704('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6704('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6704('0x4'),'afterDestroy':_0x6704('0x5')};function emitEvent(_0x2899c5){return function(_0x5258e7,_0x1e9b2a,_0x35bcc6){UserProfileEvents[_0x6704('0x6')](_0x2899c5+':'+_0x5258e7['id'],_0x5258e7);UserProfileEvents[_0x6704('0x6')](_0x2899c5,_0x5258e7);_0x35bcc6(null);};}for(var e in events){if(events[_0x6704('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x6704('0x8')]=UserProfileEvents;
\ No newline at end of file
index b404ebf..b9f47cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x63cb=['admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','InteractionId','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','union','ignore','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','include','reportType','default','DefaultReports','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','true','chat','sms','dataValues','fax','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','findAll','then','associatedResources','map','model','name','catch','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','membername','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','VoiceQueues','users','agents','telephones'];(function(_0x473a66,_0x597ed9){var _0x18c775=function(_0x4626d0){while(--_0x4626d0){_0x473a66['push'](_0x473a66['shift']());}};_0x18c775(++_0x597ed9);}(_0x63cb,0x1ee));var _0xb63c=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x63cb[_0xd7b0a4];return _0x184e9e;};'use strict';var _=require('lodash');var attributes=require(_0xb63c('0x0'));var qs=require(_0xb63c('0x1'));var squel=require(_0xb63c('0x2'));module[_0xb63c('0x3')]=function(_0x91bc19){var _0x4e9a27=_0x91bc19[_0xb63c('0x4')];function _0x3ef89c(_0x422284,_0x56efc9){return new Promise(function(_0x5b1315,_0x41a091){if(!_0x56efc9)return _0x5b1315(null);var _0x4faa84=_0x56efc9[_0xb63c('0x5')]?{[_0x56efc9['filter'][_0xb63c('0x6')]]:_0x56efc9[_0xb63c('0x5')]['value']}:undefined;return _0x4e9a27[_0x422284][_0xb63c('0x7')]({'where':_0x4faa84,'raw':!![]})[_0xb63c('0x8')](function(_0x56373a){_0x56efc9[_0xb63c('0x9')]=_[_0xb63c('0xa')](_0x56373a,'id');_0x5b1315(_0x56efc9);})['catch'](function(_0x55b6ee){_0x41a091(_0x55b6ee);});});}function _0x1b232d(_0x35e1f1,_0x4b1dcb){return new Promise(function(_0x3c170e,_0x1cabe8){var _0xafae76=_0x35e1f1[_0xb63c('0x5')]?{[_0x35e1f1[_0xb63c('0x5')][_0xb63c('0x6')]]:_0x35e1f1[_0xb63c('0x5')]['value']}:undefined;return _0x4e9a27[_0x35e1f1[_0xb63c('0xb')]][_0xb63c('0x7')]({'where':_0xafae76,'raw':!![]})[_0xb63c('0x8')](function(_0x1850e4){_0x4b1dcb[_0xb63c('0x9')]=_[_0xb63c('0xa')](_0x1850e4,function(_0x2f7024){return _0x2f7024[_0xb63c('0xc')];});_0x3c170e(_0x4b1dcb);})[_0xb63c('0xd')](function(_0x46b0cb){_0x1cabe8(_0x46b0cb);});});}function _0xc2b1a4(_0x5299f7,_0x15d503,_0x17f3eb){if(!_0x15d503)return Promise['resolve'](null);return new Promise(function(_0x11c56e,_0x3dbd7f){return _0x4e9a27['UserProfileResource']['findAll']({'where':{'sectionId':_0x15d503['id']},'raw':!![]})[_0xb63c('0x8')](function(_0x390335){if(_0x5299f7[_0xb63c('0x6')]&&_0x5299f7[_0xb63c('0x6')]!=='id'){_0x15d503[_0xb63c('0x9')]=_[_0xb63c('0xa')](_0x390335,function(_0x429df7){return _0x429df7[_0x5299f7[_0xb63c('0x6')]];});}else{if(_0x17f3eb===_0xb63c('0xe')){_0x15d503['associatedResources']=_['map'](_0x390335,function(_0x1fc14c){return{'id':_0x1fc14c[_0xb63c('0xf')],'type':_0x1fc14c[_0xb63c('0x10')]};});}else{_0x15d503[_0xb63c('0x9')]=_[_0xb63c('0xa')](_0x390335,function(_0x583d4d){return _0x583d4d[_0xb63c('0xf')];});}}_0x11c56e(_0x15d503);})[_0xb63c('0xd')](function(_0x597cee){_0x3dbd7f(_0x597cee);});});}function _0xd7d62b(_0x9e2ff9,_0x74f24d){var _0x5b04eb={'parentSections':[]};switch(_0x9e2ff9[_0xb63c('0x11')]()){case _0xb63c('0x12'):_0x5b04eb['childModel']=_0xb63c('0x13');break;case _0xb63c('0x14'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x16');break;case _0xb63c('0x17'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x18');_0x5b04eb[_0xb63c('0x19')]=[{'name':'SquareProjects','field':'name','foreignKey':_0xb63c('0x1a')}];break;case _0xb63c('0x1b'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x1c');break;case _0xb63c('0x1d'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x1e');_0x5b04eb[_0xb63c('0x19')]=[{'name':_0xb63c('0x1f'),'field':'id','foreignKey':_0xb63c('0x20')}];break;case _0xb63c('0x21'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x22');break;case _0xb63c('0x23'):_0x5b04eb['childModel']=_0xb63c('0x24');break;case _0xb63c('0x25'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x26');break;case _0xb63c('0x27'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x28');break;case _0xb63c('0x29'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x2a');break;case'faxqueues':_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x2b');break;case'faxaccounts':_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x2c');break;case _0xb63c('0x2d'):case _0xb63c('0x2e'):case _0xb63c('0x2f'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x30');break;case _0xb63c('0x31'):_0x5b04eb[_0xb63c('0x15')]='VoiceContext';break;case'voicemails':_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x32');break;case _0xb63c('0x33'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x34');_0x5b04eb[_0xb63c('0x19')]=[{'name':_0xb63c('0x35'),'field':'name','foreignKey':'membername','model':_0xb63c('0x36'),'filter':{'field':_0xb63c('0x37'),'value':['agent']}},{'name':'Telephones','field':_0xb63c('0xc'),'foreignKey':_0xb63c('0x38'),'model':_0xb63c('0x36'),'filter':{'field':_0xb63c('0x37'),'value':[_0xb63c('0x39')]}},{'name':'VoiceQueues','field':_0xb63c('0xc'),'foreignKey':_0xb63c('0x3a'),'model':_0xb63c('0x3b'),'filter':{'field':_0xb63c('0x10'),'value':[_0xb63c('0x3c')]}},{'name':_0xb63c('0x3d'),'field':_0xb63c('0xc'),'foreignKey':_0xb63c('0x3a'),'model':'VoiceQueue','filter':{'field':_0xb63c('0x10'),'value':[_0xb63c('0x3e')]}}];break;case _0xb63c('0x3f'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x40');break;case _0xb63c('0x41'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x42');break;case _0xb63c('0x43'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x44');break;case'ivrcampaigns':_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x45');break;case _0xb63c('0x46'):_0x5b04eb['childModel']=_0xb63c('0x47');break;case _0xb63c('0x48'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x49');break;case _0xb63c('0x4a'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x4b');break;case _0xb63c('0x4c'):_0x5b04eb[_0xb63c('0x15')]='OpenchannelQueue';break;case _0xb63c('0x4d'):_0x5b04eb['childModel']=_0xb63c('0x4e');break;case'smsqueues':_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x4f');break;case'smsaccounts':_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x50');break;case _0xb63c('0x51'):_0x5b04eb['childModel']=_0xb63c('0x52');break;case _0xb63c('0x53'):_0x5b04eb['childModel']=_0xb63c('0x54');break;case'teams':_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x55');break;case'voicequeues':case _0xb63c('0x56'):_0x5b04eb['childModel']=_0xb63c('0x3b');if(_0x74f24d){_0x5b04eb[_0xb63c('0x19')]=[{'name':_0xb63c('0x57')},{'name':_0xb63c('0x3d')}];}break;case _0xb63c('0x58'):case _0xb63c('0x59'):case _0xb63c('0x5a'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x36');if(_0x74f24d){_0x5b04eb[_0xb63c('0x19')]=[{'name':'Users','filter':{'field':_0xb63c('0x37'),'value':[_0xb63c('0x5b'),_0xb63c('0x5c')]},'ignore':!![]},{'name':_0xb63c('0x35')},{'name':'Telephones'}];}break;case _0xb63c('0x5d'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x5e');break;case _0xb63c('0x5f'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x60');break;case _0xb63c('0x61'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x62');break;case'sugarcrmaccounts':_0x5b04eb['childModel']=_0xb63c('0x63');break;case'deskaccounts':_0x5b04eb[_0xb63c('0x15')]='DeskAccount';break;case'zohoaccounts':_0x5b04eb['childModel']=_0xb63c('0x64');break;case _0xb63c('0x65'):_0x5b04eb[_0xb63c('0x15')]='User';break;case _0xb63c('0x66'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x67');break;case _0xb63c('0x68'):_0x5b04eb[_0xb63c('0x15')]='Disposition';break;case _0xb63c('0x69'):_0x5b04eb['childModel']=_0xb63c('0x6a');break;case _0xb63c('0x6b'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x6c');break;case'pauses':_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x6d');break;case _0xb63c('0x6e'):_0x5b04eb['childModel']=_0xb63c('0x6f');break;case'sounds':_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x70');break;case _0xb63c('0x71'):_0x5b04eb['childModel']=_0xb63c('0x72');break;case _0xb63c('0x73'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x74');break;case _0xb63c('0x75'):_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x76');break;case _0xb63c('0x77'):_0x5b04eb['childModel']=_0xb63c('0x78');break;case'variables':_0x5b04eb[_0xb63c('0x15')]=_0xb63c('0x79');break;case _0xb63c('0x7a'):_0x5b04eb[_0xb63c('0x15')]='Plugin';break;case _0xb63c('0x7b'):_0x5b04eb['childModel']=_0xb63c('0xe');_0x5b04eb[_0xb63c('0x19')]=[{'name':_0xb63c('0x7c'),'field':'id','foreignKey':_0xb63c('0x7d')}];break;case _0xb63c('0x7e'):_0x5b04eb['childModel']=_0xb63c('0x7f');break;}return _0x5b04eb;}function _0x271220(_0x1ec824,_0x3e7def){var _0x1ba9c8=_0x1ec824[_0xb63c('0x80')](0x0)[_0xb63c('0x81')]()+_0x1ec824['slice'](0x1);var _0x70ff6={'type':_0x4e9a27[_0xb63c('0x82')][_0xb63c('0x83')][_0xb63c('0x84')],'raw':!![]};return new Promise(function(_0x2ba0e8,_0xb7ad99){var _0xd44d87=squel['select']()[_0xb63c('0x6')]('ui.'+_0x1ba9c8+_0xb63c('0x85'),'id')[_0xb63c('0x6')]('ui.createdAt')[_0xb63c('0x86')](_0xb63c('0x87')+_0x1ec824+_0xb63c('0x88'),'ui')[_0xb63c('0x89')](_0xb63c('0x8a'),_0x3e7def['id']);return _0x4e9a27[_0xb63c('0x8b')][_0xb63c('0x8c')](_0xd44d87[_0xb63c('0x8d')](),_0x70ff6)[_0xb63c('0x8')](function(_0x4939e7){_0x3e7def[_0x1ba9c8+_0xb63c('0x8e')]=_0x4939e7;_0x2ba0e8(_0x4939e7);})[_0xb63c('0xd')](function(_0x58a8e1){_0xb7ad99(_0x58a8e1);});});}return _0x91bc19[_0xb63c('0x8f')]('UserProfile',attributes,{'tableName':_0xb63c('0x90'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x53dd2d){var _0x2bd9fa={'raw':_0x53dd2d[_0xb63c('0x8c')][_0xb63c('0x91')],'where':{}};var _0x27fd31={};var _0x36f957={'count':0x0,'rows':[]};var _0x2c056d=_0x53dd2d['query'][_0xb63c('0x92')];var _0x269e8e=_0x53dd2d['query'][_0xb63c('0x93')]||![];var _0x23505a=_0xd7d62b(_0x2c056d,_0x269e8e);if(!_0x23505a[_0xb63c('0x15')])throw new Error(_0xb63c('0x94')+_0x2c056d+'\x27');var _0x5eff9a=[{'name':_0x2c056d}];if(!_[_0xb63c('0x95')](_0x23505a[_0xb63c('0x19')]))_0x5eff9a=_0x23505a['parentSections'];var _0x37d2f2=[];for(var _0x209d6d=0x0;_0x209d6d<_0x5eff9a[_0xb63c('0x96')];_0x209d6d++){_0x37d2f2[_0xb63c('0x97')](_0x4e9a27[_0xb63c('0x98')][_0xb63c('0x99')]({'where':{'userProfileId':_0x53dd2d[_0xb63c('0x9a')]['id'],'name':_0x5eff9a[_0x209d6d][_0xb63c('0xc')]},'raw':!![]}));}return Promise[_0xb63c('0x9b')](_0x37d2f2)[_0xb63c('0x8')](function(_0x4ec208){var _0xa9eb8a=_['filter'](_0x4ec208,function(_0x55bdd9){return _0x55bdd9?_0x55bdd9:undefined;});var _0x594e85=_[_0xb63c('0x5')](_0x5eff9a,['ignore',!![]]);var _0x2b6f12=_[_0xb63c('0x95')](_0xa9eb8a)&&_[_0xb63c('0x95')](_0x594e85)?null:_[_0xb63c('0x9c')](_0x594e85,_0xa9eb8a);if(!_0x2b6f12)return null;var _0x33132b=[];for(var _0x1d9571=0x0;_0x1d9571<_0x2b6f12['length'];_0x1d9571++){var _0x3b31bc=_[_0xb63c('0x99')](_0x5eff9a,function(_0x1241b9){return _0x2b6f12[_0x1d9571]?_0x1241b9[_0xb63c('0xc')]===_0x2b6f12[_0x1d9571][_0xb63c('0xc')]:null;});if(_0x3b31bc){if(_0x2b6f12[_0x1d9571][_0xb63c('0x9d')]){_0x33132b[_0xb63c('0x97')](_0x3ef89c(_0x23505a[_0xb63c('0x15')],_0x2b6f12[_0x1d9571]));}else{if(!_0x2b6f12[_0x1d9571]['autoAssociation']){_0x33132b['push'](_0xc2b1a4(_0x3b31bc,_0x2b6f12[_0x1d9571],_0x23505a[_0xb63c('0x15')]));}else{if(_0x3b31bc[_0xb63c('0xb')]){_0x33132b[_0xb63c('0x97')](_0x1b232d(_0x3b31bc,_0x2b6f12[_0x1d9571]));}}}}}return Promise[_0xb63c('0x9b')](_0x33132b);})[_0xb63c('0x8')](function(_0x3b9ced){var _0x185774=_0x3b9ced;var _0x235726=null;if(_0x185774){_0x235726=_0x185774[_0xb63c('0x96')]===0x1?_0x185774[0x0]:null;}if(!_0x235726&&!_0x185774)return _0x36f957;var _0x40aeb1=_0x4e9a27[_0x23505a[_0xb63c('0x15')]][_0xb63c('0x9e')];_0x27fd31[_0xb63c('0xb')]=_[_0xb63c('0x9f')](_0x40aeb1);_0x27fd31[_0xb63c('0x8c')]=_[_0xb63c('0x9f')](_0x53dd2d[_0xb63c('0x8c')]);_0x27fd31[_0xb63c('0xa0')]=_[_0xb63c('0xa1')](_0x27fd31[_0xb63c('0xb')],_0x27fd31['query']);_0x2bd9fa[_0xb63c('0xa2')]=_['intersection'](_0x27fd31[_0xb63c('0xb')],qs[_0xb63c('0xa3')](_0x53dd2d[_0xb63c('0x8c')]['fields']));_0x2bd9fa[_0xb63c('0xa2')]=_0x2bd9fa['attributes'][_0xb63c('0x96')]?_0x2bd9fa[_0xb63c('0xa2')]:_0x27fd31[_0xb63c('0xb')];if(!_0x53dd2d['query'][_0xb63c('0xa4')]('nolimit')){_0x2bd9fa[_0xb63c('0xa5')]=qs[_0xb63c('0xa5')](_0x53dd2d[_0xb63c('0x8c')][_0xb63c('0xa5')]);_0x2bd9fa['offset']=qs[_0xb63c('0xa6')](_0x53dd2d['query'][_0xb63c('0xa6')]);}_0x2bd9fa[_0xb63c('0xa7')]=qs['sort'](_0x53dd2d[_0xb63c('0x8c')][_0xb63c('0xa8')]);_0x2bd9fa[_0xb63c('0x89')]=qs[_0xb63c('0xa0')](_[_0xb63c('0xa9')](_0x53dd2d[_0xb63c('0x8c')],_0x27fd31['filters']));if(_0x53dd2d[_0xb63c('0x8c')][_0xb63c('0x5')]){_0x2bd9fa[_0xb63c('0x89')]=_[_0xb63c('0xaa')](_0x2bd9fa[_0xb63c('0x89')],{'$or':_['map'](_0x40aeb1,function(_0x3c7695){if(_0x3c7695[_0xb63c('0x10')]['key']!==_0xb63c('0xab')){var _0x56ac21={};_0x56ac21[_0x3c7695[_0xb63c('0x6')]]={'$like':'%'+_0x53dd2d[_0xb63c('0x8c')]['filter']+'%'};return _0x56ac21;}})});}var _0x41126a=[];var _0x5eea2e=null;var _0x527da9={};if(_0x235726){_0x5eea2e=_[_0xb63c('0x99')](_0x5eff9a,[_0xb63c('0xc'),_0x235726['name']]);if(_0x5eea2e[_0xb63c('0x6')]){_0x527da9={};if(_0x23505a['childModel']===_0xb63c('0xe')){_0x527da9[_0x5eea2e[_0xb63c('0xac')]]=_['map'](_0x235726['associatedResources'],'id');}else{_0x527da9[_0x5eea2e[_0xb63c('0xac')]]=_0x235726[_0xb63c('0x9')];}_0x41126a[_0xb63c('0x97')](_0x527da9);}else{_0x2bd9fa[_0xb63c('0x89')]['id']=_0x235726[_0xb63c('0x9')];}}else{for(var _0x387fec=0x0;_0x387fec<_0x185774[_0xb63c('0x96')];_0x387fec++){_0x5eea2e=_[_0xb63c('0x99')](_0x5eff9a,[_0xb63c('0xc'),_0x185774[_0x387fec]['name']]);if(_0x5eea2e['field']){_0x527da9={};_0x527da9[_0x5eea2e[_0xb63c('0xac')]]=_0x185774[_0x387fec][_0xb63c('0x9')];_0x41126a[_0xb63c('0x97')](_0x527da9);}else{if(!_0x2bd9fa['where']['id'])_0x2bd9fa['where']['id']=[];_0x185774[_0x387fec]['associatedResources'][_0xb63c('0xad')](function(_0x4134ea){_0x2bd9fa['where']['id']['push'](_0x4134ea);});}}}if(!_[_0xb63c('0x95')](_0x41126a)){_0x2bd9fa[_0xb63c('0x89')]=_['merge'](_0x2bd9fa[_0xb63c('0x89')],{'$and':{'$or':_0x41126a}});}_0x2bd9fa=_[_0xb63c('0xaa')]({},_0x2bd9fa,_0x53dd2d[_0xb63c('0xae')]);if(_0x235726&&!_0x235726[_0xb63c('0xaf')]&&_0x23505a[_0xb63c('0x15')]===_0xb63c('0xe')){if(_0x53dd2d[_0xb63c('0x8c')][_0xb63c('0xb0')]){_0x2bd9fa[_0xb63c('0xb1')]=[{'all':!![]}];}return _0x4e9a27[_0x23505a['childModel']][_0xb63c('0x7')](_0x2bd9fa)[_0xb63c('0x8')](function(_0x47c28e){var _0x3a2487=[];_0x47c28e[_0xb63c('0xad')](function(_0x1b60b0){var _0x3df87c;switch(_0x1b60b0[_0xb63c('0xb2')]){case _0xb63c('0xb3'):_0x3df87c=_[_0xb63c('0x99')](_0x235726[_0xb63c('0x9')],function(_0x79ba2){return _0x79ba2['id']===_0x1b60b0['reportId']&&_0x79ba2[_0xb63c('0x10')]===_0xb63c('0xb4');});break;case'custom':_0x3df87c=_[_0xb63c('0x99')](_0x235726['associatedResources'],function(_0x381792){return _0x381792['id']===_0x1b60b0[_0xb63c('0x7d')]&&_0x381792['type']===_0xb63c('0xb5');});break;}if(_0x3df87c)_0x3a2487[_0xb63c('0x97')](_0x1b60b0);});_0x36f957[_0xb63c('0xb6')]=_0x3a2487['length'];_0x36f957[_0xb63c('0xb7')]=_0x3a2487;return _0x36f957;});}else{if(!_[_0xb63c('0x95')](_0x53dd2d['query'][_0xb63c('0xb8')])){_0x2bd9fa[_0xb63c('0x89')]['id']=_0x2bd9fa[_0xb63c('0x89')]['id']?_[_0xb63c('0xa1')](_0x2bd9fa['where']['id'],_0x53dd2d[_0xb63c('0x8c')][_0xb63c('0xb8')]):_0x53dd2d['query'][_0xb63c('0xb8')];if(_0x53dd2d[_0xb63c('0x8c')][_0xb63c('0xb9')]){_0x2bd9fa[_0xb63c('0xa7')]=_0x53dd2d['query'][_0xb63c('0xb9')];}}if(_0x53dd2d['query'][_0xb63c('0xba')]){_0x2bd9fa[_0xb63c('0x89')]=_[_0xb63c('0xaa')](_0x2bd9fa[_0xb63c('0x89')],{'$and':_0x53dd2d[_0xb63c('0x8c')][_0xb63c('0xba')]});}return _0x4e9a27[_0x23505a[_0xb63c('0x15')]][_0xb63c('0xb6')]({'where':_0x2bd9fa[_0xb63c('0x89')]})[_0xb63c('0x8')](function(_0x22983b){_0x36f957[_0xb63c('0xb6')]=_0x22983b;if(_0x53dd2d[_0xb63c('0x8c')][_0xb63c('0xb0')]){if(_0x23505a[_0xb63c('0x15')]===_0xb63c('0x1e')){_0x2bd9fa['include']=[{'model':_0x4e9a27[_0xb63c('0x72')],'as':_0xb63c('0xbb'),'attributes':['id',_0xb63c('0xc'),_0xb63c('0xbc')],'required':_0x53dd2d[_0xb63c('0x8c')][_0xb63c('0xbd')]?!![]:![]},{'model':_0x4e9a27[_0xb63c('0x72')],'as':'ThroughTags','attributes':['id',_0xb63c('0xc'),_0xb63c('0xbc')],'through':_0x53dd2d[_0xb63c('0x8c')][_0xb63c('0xbd')]?{'attributes':[],'where':{'TagId':_0x53dd2d[_0xb63c('0x8c')][_0xb63c('0xbd')]||undefined}}:{},'required':_0x53dd2d['query'][_0xb63c('0xbd')]?!![]:![]}];}else{_0x2bd9fa[_0xb63c('0xb1')]=[{'all':!![]}];}}return _0x4e9a27[_0x23505a['childModel']][_0xb63c('0x7')](_0x2bd9fa);})[_0xb63c('0x8')](function(_0x54a9ff){_0x36f957['rows']=_0x54a9ff;if(_0x2c056d===_0xb63c('0x35')&&_0x53dd2d[_0xb63c('0x8c')]['openTabs']===_0xb63c('0xbe')){var _0x3748a0=[];for(var _0x423688=0x0;_0x423688<_0x36f957[_0xb63c('0xb7')][_0xb63c('0x96')];_0x423688++){_0x3748a0['push'](_0x271220(_0xb63c('0xbf'),_0x36f957[_0xb63c('0xb7')][_0x423688]['dataValues']));_0x3748a0['push'](_0x271220(_0xb63c('0xc0'),_0x36f957[_0xb63c('0xb7')][_0x423688][_0xb63c('0xc1')]));_0x3748a0[_0xb63c('0x97')](_0x271220(_0xb63c('0xc2'),_0x36f957['rows'][_0x423688]['dataValues']));_0x3748a0[_0xb63c('0x97')](_0x271220('mail',_0x36f957[_0xb63c('0xb7')][_0x423688]['dataValues']));_0x3748a0[_0xb63c('0x97')](_0x271220('openchannel',_0x36f957[_0xb63c('0xb7')][_0x423688]['dataValues']));_0x3748a0[_0xb63c('0x97')](_0x271220('whatsapp',_0x36f957[_0xb63c('0xb7')][_0x423688][_0xb63c('0xc1')]));}return Promise[_0xb63c('0x9b')](_0x3748a0)[_0xb63c('0x8')](function(){return _0x36f957;});}return _0x36f957;});}});}}});};
\ No newline at end of file
+var _0xb016=['SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','Agents','name','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','Team','voicequeues','queuecampaigns','users','agents','telephones','admin','user','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','deskaccounts','vtigeraccounts','cannedanswers','dispositions','Disposition','Dashboard','Interval','pauses','Sound','Tag','Template','triggers','Trigger','variables','Variable','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','limit','offset','sort','pick','key','forEach','merge','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','CmContact','Tags','color','ThroughTags','tag','openTabs','sms','dataValues','fax','openchannel','whatsapp','lodash','./userProfile.attributes','exports','models','field','filter','then','associatedResources','map','catch','value','model','resolve','UserProfileResource','findAll','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0xb016,0x159));var _0x6b01=function(_0x245ca9,_0x5f5b53){_0x245ca9=_0x245ca9-0x0;var _0x17e622=_0xb016[_0x245ca9];return _0x17e622;};'use strict';var _=require(_0x6b01('0x0'));var attributes=require(_0x6b01('0x1'));var qs=require('../../components/parsers/qs');var squel=require('squel');module[_0x6b01('0x2')]=function(_0x531b6a){var _0x160a7d=_0x531b6a[_0x6b01('0x3')];function _0x161b59(_0x3b9de1,_0x5964ca){return new Promise(function(_0x1b7dd6,_0x65407a){if(!_0x5964ca)return _0x1b7dd6(null);var _0x192b2d=_0x5964ca['filter']?{[_0x5964ca['filter'][_0x6b01('0x4')]]:_0x5964ca[_0x6b01('0x5')]['value']}:undefined;return _0x160a7d[_0x3b9de1]['findAll']({'where':_0x192b2d,'raw':!![]})[_0x6b01('0x6')](function(_0x1cb3a6){_0x5964ca[_0x6b01('0x7')]=_[_0x6b01('0x8')](_0x1cb3a6,'id');_0x1b7dd6(_0x5964ca);})[_0x6b01('0x9')](function(_0x5bed15){_0x65407a(_0x5bed15);});});}function _0x4b4a4d(_0x4627ef,_0x24049f){return new Promise(function(_0x2660c7,_0x5a8817){var _0x200614=_0x4627ef['filter']?{[_0x4627ef['filter'][_0x6b01('0x4')]]:_0x4627ef['filter'][_0x6b01('0xa')]}:undefined;return _0x160a7d[_0x4627ef[_0x6b01('0xb')]]['findAll']({'where':_0x200614,'raw':!![]})[_0x6b01('0x6')](function(_0x4ea5fa){_0x24049f['associatedResources']=_['map'](_0x4ea5fa,function(_0x3d4666){return _0x3d4666['name'];});_0x2660c7(_0x24049f);})['catch'](function(_0x3a259f){_0x5a8817(_0x3a259f);});});}function _0x327e86(_0x20dd83,_0x41efa3,_0x3d7045){if(!_0x41efa3)return Promise[_0x6b01('0xc')](null);return new Promise(function(_0x122769,_0x33ffe8){return _0x160a7d[_0x6b01('0xd')][_0x6b01('0xe')]({'where':{'sectionId':_0x41efa3['id']},'raw':!![]})[_0x6b01('0x6')](function(_0x4f2d08){if(_0x20dd83[_0x6b01('0x4')]&&_0x20dd83[_0x6b01('0x4')]!=='id'){_0x41efa3[_0x6b01('0x7')]=_[_0x6b01('0x8')](_0x4f2d08,function(_0x5a7d75){return _0x5a7d75[_0x20dd83[_0x6b01('0x4')]];});}else{if(_0x3d7045===_0x6b01('0xf')){_0x41efa3[_0x6b01('0x7')]=_['map'](_0x4f2d08,function(_0x3029e2){return{'id':_0x3029e2[_0x6b01('0x10')],'type':_0x3029e2[_0x6b01('0x11')]};});}else{_0x41efa3[_0x6b01('0x7')]=_[_0x6b01('0x8')](_0x4f2d08,function(_0x181b09){return _0x181b09[_0x6b01('0x10')];});}}_0x122769(_0x41efa3);})['catch'](function(_0x7caa07){_0x33ffe8(_0x7caa07);});});}function _0xcf9200(_0x42c990,_0x51243c){var _0x399808={'parentSections':[]};switch(_0x42c990[_0x6b01('0x12')]()){case _0x6b01('0x13'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x15');break;case _0x6b01('0x16'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x17');break;case _0x6b01('0x18'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x19');_0x399808[_0x6b01('0x1a')]=[{'name':_0x6b01('0x1b'),'field':'name','foreignKey':_0x6b01('0x1c')}];break;case _0x6b01('0x1d'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x1e');break;case _0x6b01('0x1f'):_0x399808['childModel']='CmContact';_0x399808[_0x6b01('0x1a')]=[{'name':_0x6b01('0x20'),'field':'id','foreignKey':_0x6b01('0x21')}];break;case _0x6b01('0x22'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x23');break;case'companies':_0x399808[_0x6b01('0x14')]='CmCompany';break;case _0x6b01('0x24'):_0x399808['childModel']=_0x6b01('0x25');break;case _0x6b01('0x26'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x27');break;case _0x6b01('0x28'):_0x399808['childModel']=_0x6b01('0x29');break;case _0x6b01('0x2a'):_0x399808[_0x6b01('0x14')]='FaxQueue';break;case'faxaccounts':_0x399808[_0x6b01('0x14')]='FaxAccount';break;case _0x6b01('0x2b'):case _0x6b01('0x2c'):case _0x6b01('0x2d'):_0x399808['childModel']=_0x6b01('0x2e');break;case _0x6b01('0x2f'):_0x399808[_0x6b01('0x14')]='VoiceContext';break;case _0x6b01('0x30'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x31');break;case _0x6b01('0x32'):_0x399808[_0x6b01('0x14')]='VoiceRecording';_0x399808[_0x6b01('0x1a')]=[{'name':_0x6b01('0x33'),'field':_0x6b01('0x34'),'foreignKey':_0x6b01('0x35'),'model':_0x6b01('0x36'),'filter':{'field':_0x6b01('0x37'),'value':[_0x6b01('0x38')]}},{'name':_0x6b01('0x39'),'field':'name','foreignKey':_0x6b01('0x35'),'model':'User','filter':{'field':_0x6b01('0x37'),'value':[_0x6b01('0x3a')]}},{'name':_0x6b01('0x3b'),'field':_0x6b01('0x34'),'foreignKey':_0x6b01('0x3c'),'model':_0x6b01('0x3d'),'filter':{'field':_0x6b01('0x11'),'value':['inbound']}},{'name':_0x6b01('0x3e'),'field':_0x6b01('0x34'),'foreignKey':_0x6b01('0x3c'),'model':_0x6b01('0x3d'),'filter':{'field':_0x6b01('0x11'),'value':[_0x6b01('0x3f')]}}];break;case _0x6b01('0x40'):_0x399808[_0x6b01('0x14')]='VoiceMusicOnHold';break;case _0x6b01('0x41'):_0x399808['childModel']=_0x6b01('0x42');break;case _0x6b01('0x43'):_0x399808['childModel']=_0x6b01('0x44');break;case _0x6b01('0x45'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x46');break;case _0x6b01('0x47'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x48');break;case _0x6b01('0x49'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x4a');break;case'mailsubstatuses':_0x399808[_0x6b01('0x14')]=_0x6b01('0x4b');break;case'openchannelqueues':_0x399808['childModel']=_0x6b01('0x4c');break;case _0x6b01('0x4d'):_0x399808['childModel']=_0x6b01('0x4e');break;case _0x6b01('0x4f'):_0x399808['childModel']=_0x6b01('0x50');break;case'smsaccounts':_0x399808[_0x6b01('0x14')]=_0x6b01('0x51');break;case _0x6b01('0x52'):_0x399808['childModel']=_0x6b01('0x53');break;case _0x6b01('0x54'):_0x399808['childModel']='WhatsappAccount';break;case'teams':_0x399808[_0x6b01('0x14')]=_0x6b01('0x55');break;case _0x6b01('0x56'):case _0x6b01('0x57'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x3d');if(_0x51243c){_0x399808['parentSections']=[{'name':_0x6b01('0x3b')},{'name':_0x6b01('0x3e')}];}break;case _0x6b01('0x58'):case _0x6b01('0x59'):case _0x6b01('0x5a'):_0x399808[_0x6b01('0x14')]='User';if(_0x51243c){_0x399808[_0x6b01('0x1a')]=[{'name':'Users','filter':{'field':'role','value':[_0x6b01('0x5b'),_0x6b01('0x5c')]},'ignore':!![]},{'name':'Agents'},{'name':_0x6b01('0x39')}];}break;case _0x6b01('0x5d'):_0x399808[_0x6b01('0x14')]='ZendeskAccount';break;case'salesforceaccounts':_0x399808['childModel']=_0x6b01('0x5e');break;case _0x6b01('0x5f'):_0x399808['childModel']=_0x6b01('0x60');break;case'sugarcrmaccounts':_0x399808['childModel']='SugarcrmAccount';break;case _0x6b01('0x61'):_0x399808[_0x6b01('0x14')]='DeskAccount';break;case'zohoaccounts':_0x399808[_0x6b01('0x14')]='ZohoAccount';break;case _0x6b01('0x62'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x36');break;case _0x6b01('0x63'):_0x399808[_0x6b01('0x14')]='CannedAnswer';break;case _0x6b01('0x64'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x65');break;case'customdashboards':_0x399808[_0x6b01('0x14')]=_0x6b01('0x66');break;case'intervals':_0x399808[_0x6b01('0x14')]=_0x6b01('0x67');break;case _0x6b01('0x68'):_0x399808[_0x6b01('0x14')]='Pause';break;case'scheduler':_0x399808[_0x6b01('0x14')]='Schedule';break;case'sounds':_0x399808[_0x6b01('0x14')]=_0x6b01('0x69');break;case'tags':_0x399808[_0x6b01('0x14')]=_0x6b01('0x6a');break;case'templates':_0x399808[_0x6b01('0x14')]=_0x6b01('0x6b');break;case _0x6b01('0x6c'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x6d');break;case'trunks':_0x399808[_0x6b01('0x14')]='Trunk';break;case _0x6b01('0x6e'):_0x399808[_0x6b01('0x14')]=_0x6b01('0x6f');break;case'plugins':_0x399808[_0x6b01('0x14')]=_0x6b01('0x70');break;case _0x6b01('0x71'):_0x399808[_0x6b01('0x14')]='AnalyticExtractedReport';_0x399808[_0x6b01('0x1a')]=[{'name':_0x6b01('0x72'),'field':'id','foreignKey':_0x6b01('0x73')}];break;case'metrics':_0x399808['childModel']=_0x6b01('0x74');break;}return _0x399808;}function _0x1aefc2(_0x11cbcc,_0x4e1702){var _0x21b99f=_0x11cbcc[_0x6b01('0x75')](0x0)[_0x6b01('0x76')]()+_0x11cbcc['slice'](0x1);var _0x54b3ae={'type':_0x160a7d[_0x6b01('0x77')][_0x6b01('0x78')]['SELECT'],'raw':!![]};return new Promise(function(_0x3e16e8,_0x3faa54){var _0xe6d027=squel[_0x6b01('0x79')]()[_0x6b01('0x4')](_0x6b01('0x7a')+_0x21b99f+_0x6b01('0x7b'),'id')[_0x6b01('0x4')](_0x6b01('0x7c'))['from'](_0x6b01('0x7d')+_0x11cbcc+_0x6b01('0x7e'),'ui')[_0x6b01('0x7f')](_0x6b01('0x80'),_0x4e1702['id']);return _0x160a7d[_0x6b01('0x81')][_0x6b01('0x82')](_0xe6d027[_0x6b01('0x83')](),_0x54b3ae)[_0x6b01('0x6')](function(_0x281e55){_0x4e1702[_0x21b99f+'OpenTabs']=_0x281e55;_0x3e16e8(_0x281e55);})[_0x6b01('0x9')](function(_0x25b39b){_0x3faa54(_0x25b39b);});});}return _0x531b6a[_0x6b01('0x84')](_0x6b01('0x85'),attributes,{'tableName':_0x6b01('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1dda2f){var _0x4c84cc={'raw':_0x1dda2f['query'][_0x6b01('0x87')],'where':{}};var _0x270128={};var _0x1f98d6={'count':0x0,'rows':[]};var _0xe40bee=_0x1dda2f[_0x6b01('0x82')][_0x6b01('0x88')];var _0x59bf90=_0x1dda2f[_0x6b01('0x82')][_0x6b01('0x89')]||![];var _0x475eb1=_0xcf9200(_0xe40bee,_0x59bf90);if(!_0x475eb1[_0x6b01('0x14')])throw new Error(_0x6b01('0x8a')+_0xe40bee+'\x27');var _0xf31bfa=[{'name':_0xe40bee}];if(!_[_0x6b01('0x8b')](_0x475eb1['parentSections']))_0xf31bfa=_0x475eb1[_0x6b01('0x1a')];var _0x4cb00d=[];for(var _0x1f83a9=0x0;_0x1f83a9<_0xf31bfa[_0x6b01('0x8c')];_0x1f83a9++){_0x4cb00d[_0x6b01('0x8d')](_0x160a7d['UserProfileSection'][_0x6b01('0x8e')]({'where':{'userProfileId':_0x1dda2f[_0x6b01('0x8f')]['id'],'name':_0xf31bfa[_0x1f83a9][_0x6b01('0x34')]},'raw':!![]}));}return Promise[_0x6b01('0x90')](_0x4cb00d)[_0x6b01('0x6')](function(_0x3bd4b8){var _0xdb2660=_[_0x6b01('0x5')](_0x3bd4b8,function(_0x357f54){return _0x357f54?_0x357f54:undefined;});var _0x1e0e00=_[_0x6b01('0x5')](_0xf31bfa,[_0x6b01('0x91'),!![]]);var _0x32e232=_[_0x6b01('0x8b')](_0xdb2660)&&_[_0x6b01('0x8b')](_0x1e0e00)?null:_[_0x6b01('0x92')](_0x1e0e00,_0xdb2660);if(!_0x32e232)return null;var _0x59f9d8=[];for(var _0x3f077f=0x0;_0x3f077f<_0x32e232[_0x6b01('0x8c')];_0x3f077f++){var _0x4a8fcb=_[_0x6b01('0x8e')](_0xf31bfa,function(_0x263346){return _0x32e232[_0x3f077f]?_0x263346[_0x6b01('0x34')]===_0x32e232[_0x3f077f][_0x6b01('0x34')]:null;});if(_0x4a8fcb){if(_0x32e232[_0x3f077f][_0x6b01('0x91')]){_0x59f9d8[_0x6b01('0x8d')](_0x161b59(_0x475eb1[_0x6b01('0x14')],_0x32e232[_0x3f077f]));}else{if(!_0x32e232[_0x3f077f][_0x6b01('0x93')]){_0x59f9d8[_0x6b01('0x8d')](_0x327e86(_0x4a8fcb,_0x32e232[_0x3f077f],_0x475eb1[_0x6b01('0x14')]));}else{if(_0x4a8fcb[_0x6b01('0xb')]){_0x59f9d8[_0x6b01('0x8d')](_0x4b4a4d(_0x4a8fcb,_0x32e232[_0x3f077f]));}}}}}return Promise[_0x6b01('0x90')](_0x59f9d8);})[_0x6b01('0x6')](function(_0x1a0bb7){var _0x5dd5ca=_0x1a0bb7;var _0xbcba19=null;if(_0x5dd5ca){_0xbcba19=_0x5dd5ca[_0x6b01('0x8c')]===0x1?_0x5dd5ca[0x0]:null;}if(!_0xbcba19&&!_0x5dd5ca)return _0x1f98d6;var _0x19a6d9=_0x160a7d[_0x475eb1[_0x6b01('0x14')]][_0x6b01('0x94')];_0x270128[_0x6b01('0xb')]=_[_0x6b01('0x95')](_0x19a6d9);_0x270128[_0x6b01('0x82')]=_[_0x6b01('0x95')](_0x1dda2f[_0x6b01('0x82')]);_0x270128[_0x6b01('0x96')]=_[_0x6b01('0x97')](_0x270128[_0x6b01('0xb')],_0x270128[_0x6b01('0x82')]);_0x4c84cc[_0x6b01('0x98')]=_[_0x6b01('0x97')](_0x270128[_0x6b01('0xb')],qs[_0x6b01('0x99')](_0x1dda2f[_0x6b01('0x82')][_0x6b01('0x99')]));_0x4c84cc['attributes']=_0x4c84cc['attributes']['length']?_0x4c84cc['attributes']:_0x270128[_0x6b01('0xb')];if(!_0x1dda2f['query']['hasOwnProperty']('nolimit')){_0x4c84cc[_0x6b01('0x9a')]=qs['limit'](_0x1dda2f[_0x6b01('0x82')][_0x6b01('0x9a')]);_0x4c84cc[_0x6b01('0x9b')]=qs[_0x6b01('0x9b')](_0x1dda2f[_0x6b01('0x82')]['offset']);}_0x4c84cc['order']=qs[_0x6b01('0x9c')](_0x1dda2f[_0x6b01('0x82')][_0x6b01('0x9c')]);_0x4c84cc['where']=qs[_0x6b01('0x96')](_[_0x6b01('0x9d')](_0x1dda2f[_0x6b01('0x82')],_0x270128[_0x6b01('0x96')]));if(_0x1dda2f[_0x6b01('0x82')]['filter']){_0x4c84cc[_0x6b01('0x7f')]=_['merge'](_0x4c84cc[_0x6b01('0x7f')],{'$or':_[_0x6b01('0x8')](_0x19a6d9,function(_0x20de51){if(_0x20de51[_0x6b01('0x11')][_0x6b01('0x9e')]!=='VIRTUAL'){var _0x214369={};_0x214369[_0x20de51[_0x6b01('0x4')]]={'$like':'%'+_0x1dda2f[_0x6b01('0x82')][_0x6b01('0x5')]+'%'};return _0x214369;}})});}var _0x4dbd69=[];var _0x396cab=null;var _0x27c738={};if(_0xbcba19){_0x396cab=_[_0x6b01('0x8e')](_0xf31bfa,[_0x6b01('0x34'),_0xbcba19[_0x6b01('0x34')]]);if(_0x396cab[_0x6b01('0x4')]){_0x27c738={};if(_0x475eb1['childModel']==='AnalyticExtractedReport'){_0x27c738[_0x396cab['foreignKey']]=_[_0x6b01('0x8')](_0xbcba19[_0x6b01('0x7')],'id');}else{_0x27c738[_0x396cab['foreignKey']]=_0xbcba19[_0x6b01('0x7')];}_0x4dbd69[_0x6b01('0x8d')](_0x27c738);}else{_0x4c84cc[_0x6b01('0x7f')]['id']=_0xbcba19[_0x6b01('0x7')];}}else{for(var _0x536748=0x0;_0x536748<_0x5dd5ca[_0x6b01('0x8c')];_0x536748++){_0x396cab=_['find'](_0xf31bfa,[_0x6b01('0x34'),_0x5dd5ca[_0x536748]['name']]);if(_0x396cab[_0x6b01('0x4')]){_0x27c738={};_0x27c738[_0x396cab['foreignKey']]=_0x5dd5ca[_0x536748][_0x6b01('0x7')];_0x4dbd69[_0x6b01('0x8d')](_0x27c738);}else{if(!_0x4c84cc[_0x6b01('0x7f')]['id'])_0x4c84cc[_0x6b01('0x7f')]['id']=[];_0x5dd5ca[_0x536748][_0x6b01('0x7')][_0x6b01('0x9f')](function(_0x193b70){_0x4c84cc['where']['id'][_0x6b01('0x8d')](_0x193b70);});}}}if(!_['isEmpty'](_0x4dbd69)){_0x4c84cc[_0x6b01('0x7f')]=_[_0x6b01('0xa0')](_0x4c84cc[_0x6b01('0x7f')],{'$and':{'$or':_0x4dbd69}});}_0x4c84cc=_[_0x6b01('0xa0')]({},_0x4c84cc,_0x1dda2f[_0x6b01('0xa1')]);if(_0xbcba19&&!_0xbcba19[_0x6b01('0x93')]&&_0x475eb1[_0x6b01('0x14')]===_0x6b01('0xf')){if(_0x1dda2f[_0x6b01('0x82')][_0x6b01('0xa2')]){_0x4c84cc[_0x6b01('0xa3')]=[{'all':!![]}];}return _0x160a7d[_0x475eb1['childModel']][_0x6b01('0xe')](_0x4c84cc)[_0x6b01('0x6')](function(_0x197c8d){var _0x41c2a9=[];_0x197c8d['forEach'](function(_0x2affc2){var _0x2f9f71;switch(_0x2affc2[_0x6b01('0xa4')]){case _0x6b01('0xa5'):_0x2f9f71=_[_0x6b01('0x8e')](_0xbcba19['associatedResources'],function(_0x3fb825){return _0x3fb825['id']===_0x2affc2['reportId']&&_0x3fb825[_0x6b01('0x11')]===_0x6b01('0xa6');});break;case _0x6b01('0xa7'):_0x2f9f71=_[_0x6b01('0x8e')](_0xbcba19[_0x6b01('0x7')],function(_0xb55ca5){return _0xb55ca5['id']===_0x2affc2[_0x6b01('0x73')]&&_0xb55ca5[_0x6b01('0x11')]===_0x6b01('0xa8');});break;}if(_0x2f9f71)_0x41c2a9[_0x6b01('0x8d')](_0x2affc2);});_0x1f98d6[_0x6b01('0xa9')]=_0x41c2a9[_0x6b01('0x8c')];_0x1f98d6[_0x6b01('0xaa')]=_0x41c2a9;return _0x1f98d6;});}else{if(!_[_0x6b01('0x8b')](_0x1dda2f['query'][_0x6b01('0xab')])){_0x4c84cc['where']['id']=_0x4c84cc['where']['id']?_[_0x6b01('0x97')](_0x4c84cc[_0x6b01('0x7f')]['id'],_0x1dda2f[_0x6b01('0x82')][_0x6b01('0xab')]):_0x1dda2f['query'][_0x6b01('0xab')];}return _0x160a7d[_0x475eb1[_0x6b01('0x14')]][_0x6b01('0xa9')]({'where':_0x4c84cc['where']})[_0x6b01('0x6')](function(_0x327f31){_0x1f98d6[_0x6b01('0xa9')]=_0x327f31;if(_0x1dda2f[_0x6b01('0x82')][_0x6b01('0xa2')]){if(_0x475eb1[_0x6b01('0x14')]===_0x6b01('0xac')){_0x4c84cc[_0x6b01('0xa3')]=[{'model':_0x160a7d['Tag'],'as':_0x6b01('0xad'),'attributes':['id',_0x6b01('0x34'),_0x6b01('0xae')],'required':_0x1dda2f[_0x6b01('0x82')]['tag']?!![]:![]},{'model':_0x160a7d['Tag'],'as':_0x6b01('0xaf'),'attributes':['id',_0x6b01('0x34'),_0x6b01('0xae')],'through':_0x1dda2f[_0x6b01('0x82')][_0x6b01('0xb0')]?{'attributes':[],'where':{'TagId':_0x1dda2f[_0x6b01('0x82')][_0x6b01('0xb0')]||undefined}}:{},'required':_0x1dda2f[_0x6b01('0x82')]['tag']?!![]:![]}];}else{_0x4c84cc[_0x6b01('0xa3')]=[{'all':!![]}];}}return _0x160a7d[_0x475eb1[_0x6b01('0x14')]][_0x6b01('0xe')](_0x4c84cc);})[_0x6b01('0x6')](function(_0x1e50e7){_0x1f98d6[_0x6b01('0xaa')]=_0x1e50e7;if(_0xe40bee===_0x6b01('0x33')&&_0x1dda2f['query'][_0x6b01('0xb1')]==='true'){var _0xe9de3b=[];for(var _0x40bef5=0x0;_0x40bef5<_0x1f98d6[_0x6b01('0xaa')][_0x6b01('0x8c')];_0x40bef5++){_0xe9de3b[_0x6b01('0x8d')](_0x1aefc2('chat',_0x1f98d6[_0x6b01('0xaa')][_0x40bef5]['dataValues']));_0xe9de3b[_0x6b01('0x8d')](_0x1aefc2(_0x6b01('0xb2'),_0x1f98d6['rows'][_0x40bef5][_0x6b01('0xb3')]));_0xe9de3b[_0x6b01('0x8d')](_0x1aefc2(_0x6b01('0xb4'),_0x1f98d6[_0x6b01('0xaa')][_0x40bef5][_0x6b01('0xb3')]));_0xe9de3b['push'](_0x1aefc2('mail',_0x1f98d6[_0x6b01('0xaa')][_0x40bef5][_0x6b01('0xb3')]));_0xe9de3b[_0x6b01('0x8d')](_0x1aefc2(_0x6b01('0xb5'),_0x1f98d6[_0x6b01('0xaa')][_0x40bef5][_0x6b01('0xb3')]));_0xe9de3b[_0x6b01('0x8d')](_0x1aefc2(_0x6b01('0xb6'),_0x1f98d6[_0x6b01('0xaa')][_0x40bef5]['dataValues']));}return Promise[_0x6b01('0x90')](_0xe9de3b)['then'](function(){return _0x1f98d6;});}return _0x1f98d6;});}});}}});};
\ No newline at end of file
index fd2d76a..6958242 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x905a=['catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','info','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x36734a,_0xdd12e1){var _0x565da1=function(_0x4e27d3){while(--_0x4e27d3){_0x36734a['push'](_0x36734a['shift']());}};_0x565da1(++_0xdd12e1);}(_0x905a,0xeb));var _0xa905=function(_0x3cc852,_0x4cd87a){_0x3cc852=_0x3cc852-0x0;var _0x2b13b9=_0x905a[_0x3cc852];return _0x2b13b9;};'use strict';var _=require(_0xa905('0x0'));var util=require('util');var moment=require(_0xa905('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa905('0x2'));var db=require(_0xa905('0x3'))['db'];var utils=require(_0xa905('0x4'));var logger=require(_0xa905('0x5'))(_0xa905('0x6'));var config=require(_0xa905('0x7'));var jayson=require(_0xa905('0x8'));var client=jayson[_0xa905('0x9')][_0xa905('0xa')]({'port':0x232a});config[_0xa905('0xb')]=_[_0xa905('0xc')](config[_0xa905('0xb')],{'host':_0xa905('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa905('0xb')]));require('./userProfile.socket')[_0xa905('0xe')](socket);function respondWithRpcPromise(_0x50004a,_0x4b5009,_0x34922c){return new BPromise(function(_0x118ff4,_0x58e8b4){return client[_0xa905('0xf')](_0x50004a,_0x34922c)['then'](function(_0x4e4ffa){logger[_0xa905('0x10')](_0xa905('0x11'),_0x4b5009,'request\x20sent');logger['debug'](_0xa905('0x12'),_0x4b5009,_0xa905('0x13'),JSON[_0xa905('0x14')](_0x4e4ffa));if(_0x4e4ffa[_0xa905('0x15')]){if(_0x4e4ffa[_0xa905('0x15')][_0xa905('0x16')]===0x1f4){logger['error'](_0xa905('0x11'),_0x4b5009,_0x4e4ffa['error'][_0xa905('0x17')]);return _0x58e8b4(_0x4e4ffa[_0xa905('0x15')]['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x4b5009,_0x4e4ffa[_0xa905('0x15')][_0xa905('0x17')]);return _0x118ff4(_0x4e4ffa[_0xa905('0x15')][_0xa905('0x17')]);}else{logger[_0xa905('0x10')](_0xa905('0x11'),_0x4b5009,_0xa905('0x13'));_0x118ff4(_0x4e4ffa[_0xa905('0x18')][_0xa905('0x17')]);}})[_0xa905('0x19')](function(_0x3afe0c){logger[_0xa905('0x15')]('UserProfile,\x20%s,\x20%s',_0x4b5009,_0x3afe0c);_0x58e8b4(_0x3afe0c);});});}
\ No newline at end of file
+var _0x7d37=['../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','redis','./userProfile.socket','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x1f2edb,_0x492654){var _0x2a7737=function(_0xa13fc8){while(--_0xa13fc8){_0x1f2edb['push'](_0x1f2edb['shift']());}};_0x2a7737(++_0x492654);}(_0x7d37,0x1db));var _0x77d3=function(_0x4040df,_0x240c1e){_0x4040df=_0x4040df-0x0;var _0x4e9e3b=_0x7d37[_0x4040df];return _0x4e9e3b;};'use strict';var _=require(_0x77d3('0x0'));var util=require(_0x77d3('0x1'));var moment=require(_0x77d3('0x2'));var BPromise=require('bluebird');var rs=require(_0x77d3('0x3'));var fs=require('fs');var Redis=require(_0x77d3('0x4'));var db=require(_0x77d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x77d3('0x6'))(_0x77d3('0x7'));var config=require('../../config/environment');var jayson=require(_0x77d3('0x8'));var client=jayson['client'][_0x77d3('0x9')]({'port':0x232a});config['redis']=_[_0x77d3('0xa')](config[_0x77d3('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x77d3('0xb')]));require(_0x77d3('0xc'))['register'](socket);function respondWithRpcPromise(_0x238791,_0x5e8c4d,_0x10f92e){return new BPromise(function(_0x57c75c,_0x1afabc){return client['request'](_0x238791,_0x10f92e)[_0x77d3('0xd')](function(_0x295d24){logger[_0x77d3('0xe')](_0x77d3('0xf'),_0x5e8c4d,_0x77d3('0x10'));logger[_0x77d3('0x11')](_0x77d3('0x12'),_0x5e8c4d,_0x77d3('0x10'),JSON[_0x77d3('0x13')](_0x295d24));if(_0x295d24['error']){if(_0x295d24[_0x77d3('0x14')]['code']===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x5e8c4d,_0x295d24[_0x77d3('0x14')][_0x77d3('0x15')]);return _0x1afabc(_0x295d24[_0x77d3('0x14')][_0x77d3('0x15')]);}logger[_0x77d3('0x14')]('UserProfile,\x20%s,\x20%s',_0x5e8c4d,_0x295d24[_0x77d3('0x14')][_0x77d3('0x15')]);return _0x57c75c(_0x295d24['error']['message']);}else{logger[_0x77d3('0xe')](_0x77d3('0xf'),_0x5e8c4d,_0x77d3('0x10'));_0x57c75c(_0x295d24[_0x77d3('0x16')][_0x77d3('0x15')]);}})[_0x77d3('0x17')](function(_0x12fb05){logger[_0x77d3('0x14')](_0x77d3('0xf'),_0x5e8c4d,_0x12fb05);_0x1afabc(_0x12fb05);});});}
\ No newline at end of file
index b89f0d2..faa8bba 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfe20=['removeListener','length','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfe20,0x191));var _0x0fe2=function(_0x13bd3b,_0x34ee8d){_0x13bd3b=_0x13bd3b-0x0;var _0x3a63cb=_0xfe20[_0x13bd3b];return _0x3a63cb;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x0fe2('0x0'),'remove','update'];function createListener(_0x1ecec3,_0x2ba8b6){return function(_0x3c9b67){_0x2ba8b6['emit'](_0x1ecec3,_0x3c9b67);};}function removeListener(_0x44dec7,_0x2aec95){return function(){UserProfileEvents[_0x0fe2('0x1')](_0x44dec7,_0x2aec95);};}exports['register']=function(_0x54007e){for(var _0x23165c=0x0,_0x574f50=events[_0x0fe2('0x2')];_0x23165c<_0x574f50;_0x23165c++){var _0x23fc1c=events[_0x23165c];var _0x1ff189=createListener('userProfile:'+_0x23fc1c,_0x54007e);UserProfileEvents['on'](_0x23fc1c,_0x1ff189);}};
\ No newline at end of file
+var _0xa2f8=['emit','removeListener','register','length','userProfile:','./userProfile.events','save','remove','update'];(function(_0x49623c,_0x25b980){var _0x5b0cb7=function(_0x12da08){while(--_0x12da08){_0x49623c['push'](_0x49623c['shift']());}};_0x5b0cb7(++_0x25b980);}(_0xa2f8,0x101));var _0x8a2f=function(_0x29f672,_0x1bd75f){_0x29f672=_0x29f672-0x0;var _0x598b19=_0xa2f8[_0x29f672];return _0x598b19;};'use strict';var UserProfileEvents=require(_0x8a2f('0x0'));var events=[_0x8a2f('0x1'),_0x8a2f('0x2'),_0x8a2f('0x3')];function createListener(_0x18ff39,_0x2b3996){return function(_0x3fd9fa){_0x2b3996[_0x8a2f('0x4')](_0x18ff39,_0x3fd9fa);};}function removeListener(_0x1bdd05,_0x59c0d7){return function(){UserProfileEvents[_0x8a2f('0x5')](_0x1bdd05,_0x59c0d7);};}exports[_0x8a2f('0x6')]=function(_0x54372e){for(var _0x452ac6=0x0,_0x382fcb=events[_0x8a2f('0x7')];_0x452ac6<_0x382fcb;_0x452ac6++){var _0x45f846=events[_0x452ac6];var _0x1432ca=createListener(_0x8a2f('0x8')+_0x45f846,_0x54372e);UserProfileEvents['on'](_0x45f846,_0x1432ca);}};
\ No newline at end of file
index 6d5f9dd..dc17634 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa869=['get','/:id','post','create','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','/describe','describe'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xa869,0x6b));var _0x9a86=function(_0x330c4f,_0x42be02){_0x330c4f=_0x330c4f-0x0;var _0x382182=_0xa869[_0x330c4f];return _0x382182;};'use strict';var multer=require('multer');var util=require(_0x9a86('0x0'));var path=require(_0x9a86('0x1'));var timeout=require(_0x9a86('0x2'));var express=require(_0x9a86('0x3'));var router=express['Router']();var fs_extra=require(_0x9a86('0x4'));var auth=require(_0x9a86('0x5'));var interaction=require(_0x9a86('0x6'));var config=require(_0x9a86('0x7'));var controller=require(_0x9a86('0x8'));router['get']('/',auth[_0x9a86('0x9')](),controller[_0x9a86('0xa')]);router['get'](_0x9a86('0xb'),auth[_0x9a86('0x9')](),controller[_0x9a86('0xc')]);router[_0x9a86('0xd')](_0x9a86('0xe'),auth[_0x9a86('0x9')](),controller['show']);router[_0x9a86('0xf')]('/',auth[_0x9a86('0x9')](),controller[_0x9a86('0x10')]);router['put'](_0x9a86('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x9a86('0x11')](_0x9a86('0xe'),auth['isAuthenticated'](),controller[_0x9a86('0x12')]);module[_0x9a86('0x13')]=router;
\ No newline at end of file
+var _0xb516=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','exports','util','connect-timeout'];(function(_0x3d4fc3,_0x4c1d67){var _0x1d0b82=function(_0x52dba0){while(--_0x52dba0){_0x3d4fc3['push'](_0x3d4fc3['shift']());}};_0x1d0b82(++_0x4c1d67);}(_0xb516,0x178));var _0x6b51=function(_0x50bde8,_0xfad854){_0x50bde8=_0x50bde8-0x0;var _0x1236a2=_0xb516[_0x50bde8];return _0x1236a2;};'use strict';var multer=require('multer');var util=require(_0x6b51('0x0'));var path=require('path');var timeout=require(_0x6b51('0x1'));var express=require(_0x6b51('0x2'));var router=express[_0x6b51('0x3')]();var fs_extra=require(_0x6b51('0x4'));var auth=require(_0x6b51('0x5'));var interaction=require(_0x6b51('0x6'));var config=require(_0x6b51('0x7'));var controller=require(_0x6b51('0x8'));router[_0x6b51('0x9')]('/',auth[_0x6b51('0xa')](),controller[_0x6b51('0xb')]);router[_0x6b51('0x9')]('/describe',auth[_0x6b51('0xa')](),controller[_0x6b51('0xc')]);router[_0x6b51('0x9')](_0x6b51('0xd'),auth[_0x6b51('0xa')](),controller[_0x6b51('0xe')]);router[_0x6b51('0xf')]('/',auth[_0x6b51('0xa')](),controller[_0x6b51('0x10')]);router[_0x6b51('0x11')]('/:id',auth[_0x6b51('0xa')](),controller[_0x6b51('0x12')]);router[_0x6b51('0x13')](_0x6b51('0xd'),auth[_0x6b51('0xa')](),controller['destroy']);module[_0x6b51('0x14')]=router;
\ No newline at end of file
index 19f6e1d..a93b45e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdf7b=['sequelize','STRING','INTEGER'];(function(_0x38c55a,_0x304cc1){var _0x2499a0=function(_0x2a17ff){while(--_0x2a17ff){_0x38c55a['push'](_0x38c55a['shift']());}};_0x2499a0(++_0x304cc1);}(_0xdf7b,0x11d));var _0xbdf7=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0xdf7b[_0x142ec2];return _0x45ef4e;};'use strict';var Sequelize=require(_0xbdf7('0x0'));module['exports']={'name':{'type':Sequelize[_0xbdf7('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xbdf7('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbdf7('0x1')],'allowNull':![]}};
\ No newline at end of file
+var _0x0e7e=['INTEGER','sequelize','exports','STRING'];(function(_0x5a2acc,_0x68ec1c){var _0x549be6=function(_0x1011e6){while(--_0x1011e6){_0x5a2acc['push'](_0x5a2acc['shift']());}};_0x549be6(++_0x68ec1c);}(_0x0e7e,0x199));var _0xe0e7=function(_0x3378c9,_0x3c96ee){_0x3378c9=_0x3378c9-0x0;var _0x16bf3f=_0x0e7e[_0x3378c9];return _0x16bf3f;};'use strict';var Sequelize=require(_0xe0e7('0x0'));module[_0xe0e7('0x1')]={'name':{'type':Sequelize[_0xe0e7('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe0e7('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}};
\ No newline at end of file
index d0d3cd4..ad1d2bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xba34=['../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0xba34,0x119));var _0x4ba3=function(_0x26260a,_0x3b362a){_0x26260a=_0x26260a-0x0;var _0xddd2c1=_0xba34[_0x26260a];return _0xddd2c1;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));};exports['describe']=function(_0x43f820,_0x19d70f){return db[_0x4ba3('0x2d')][_0x4ba3('0x4b')]()[_0x4ba3('0x26')](respondWithResult(_0x19d70f,null))[_0x4ba3('0x46')](handleError(_0x19d70f,null));};
\ No newline at end of file
+var _0xd943=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','UserProfileResource','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto'];(function(_0x43f842,_0x3b6bbd){var _0x579887=function(_0x26eaf4){while(--_0x26eaf4){_0x43f842['push'](_0x43f842['shift']());}};_0x579887(++_0x3b6bbd);}(_0xd943,0x15d));var _0x3d94=function(_0x291d18,_0x4f4f84){_0x291d18=_0x291d18-0x0;var _0x1503a3=_0xd943[_0x291d18];return _0x1503a3;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));};exports[_0x3d94('0x47')]=function(_0x4af4c2,_0x255630){return db['UserProfileResource']['describe']()[_0x3d94('0x22')](respondWithResult(_0x255630,null))['catch'](handleError(_0x255630,null));};
\ No newline at end of file
index 8d62963..a0657d6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x306b=['rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1ef159,_0x159992){var _0x3cfb2b=function(_0x2e3948){while(--_0x2e3948){_0x1ef159['push'](_0x1ef159['shift']());}};_0x3cfb2b(++_0x159992);}(_0x306b,0x152));var _0xb306=function(_0x1a47cf,_0x158dd1){_0x1a47cf=_0x1a47cf-0x0;var _0x48776d=_0x306b[_0x1a47cf];return _0x48776d;};'use strict';var _=require(_0xb306('0x0'));var util=require(_0xb306('0x1'));var logger=require(_0xb306('0x2'))(_0xb306('0x3'));var moment=require(_0xb306('0x4'));var BPromise=require(_0xb306('0x5'));var rp=require(_0xb306('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb306('0x7'));var config=require(_0xb306('0x8'));var attributes=require(_0xb306('0x9'));module[_0xb306('0xa')]=function(_0x2a9b21,_0x5e07f1){return _0x2a9b21['define'](_0xb306('0xb'),attributes,{'tableName':_0xb306('0xc'),'paranoid':![],'indexes':[{'name':_0xb306('0xd'),'fields':[_0xb306('0xe'),'sectionId']}],'timestamps':!![]});};
\ No newline at end of file
+var _0xf9f6=['util','../../config/logger','api','bluebird','path','../../config/environment','exports','define','user_profile_has_resources','compositeIndex','sectionId','lodash'];(function(_0x553150,_0x589ff3){var _0x18193d=function(_0x3a5ae6){while(--_0x3a5ae6){_0x553150['push'](_0x553150['shift']());}};_0x18193d(++_0x589ff3);}(_0xf9f6,0x107));var _0x6f9f=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0xf9f6[_0x21f931];return _0x3f083c;};'use strict';var _=require(_0x6f9f('0x0'));var util=require(_0x6f9f('0x1'));var logger=require(_0x6f9f('0x2'))(_0x6f9f('0x3'));var moment=require('moment');var BPromise=require(_0x6f9f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f9f('0x5'));var rimraf=require('rimraf');var config=require(_0x6f9f('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x6f9f('0x7')]=function(_0x255817,_0x1e49c0){return _0x255817[_0x6f9f('0x8')]('UserProfileResource',attributes,{'tableName':_0x6f9f('0x9'),'paranoid':![],'indexes':[{'name':_0x6f9f('0xa'),'fields':['resourceId',_0x6f9f('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
index 6523bd2..fd9cf98 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x30b2=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x5da808,_0x297143){var _0x4ff220=function(_0x16aa90){while(--_0x16aa90){_0x5da808['push'](_0x5da808['shift']());}};_0x4ff220(++_0x297143);}(_0x30b2,0xbb));var _0x230b=function(_0x3d6d54,_0x1d8b8f){_0x3d6d54=_0x3d6d54-0x0;var _0x4b7cf0=_0x30b2[_0x3d6d54];return _0x4b7cf0;};'use strict';var _=require(_0x230b('0x0'));var util=require('util');var moment=require(_0x230b('0x1'));var BPromise=require(_0x230b('0x2'));var rs=require(_0x230b('0x3'));var fs=require('fs');var Redis=require(_0x230b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x230b('0x5'));var logger=require(_0x230b('0x6'))(_0x230b('0x7'));var config=require(_0x230b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x230b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22ed8f,_0x1577af,_0x32b5f5){return new BPromise(function(_0x17011b,_0xe24b82){return client[_0x230b('0xa')](_0x22ed8f,_0x32b5f5)[_0x230b('0xb')](function(_0x82e771){logger[_0x230b('0xc')](_0x230b('0xd'),_0x1577af,_0x230b('0xe'));logger[_0x230b('0xf')](_0x230b('0x10'),_0x1577af,_0x230b('0xe'),JSON[_0x230b('0x11')](_0x82e771));if(_0x82e771['error']){if(_0x82e771['error'][_0x230b('0x12')]===0x1f4){logger[_0x230b('0x13')](_0x230b('0xd'),_0x1577af,_0x82e771[_0x230b('0x13')]['message']);return _0xe24b82(_0x82e771[_0x230b('0x13')][_0x230b('0x14')]);}logger[_0x230b('0x13')](_0x230b('0xd'),_0x1577af,_0x82e771[_0x230b('0x13')][_0x230b('0x14')]);return _0x17011b(_0x82e771[_0x230b('0x13')][_0x230b('0x14')]);}else{logger[_0x230b('0xc')](_0x230b('0xd'),_0x1577af,'request\x20sent');_0x17011b(_0x82e771[_0x230b('0x15')][_0x230b('0x14')]);}})[_0x230b('0x16')](function(_0x44d450){logger[_0x230b('0x13')](_0x230b('0xd'),_0x1577af,_0x44d450);_0xe24b82(_0x44d450);});});}
\ No newline at end of file
+var _0x19af=['request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x19af,0x18f));var _0xf19a=function(_0x30c70f,_0x3d7f8c){_0x30c70f=_0x30c70f-0x0;var _0x4b2165=_0x19af[_0x30c70f];return _0x4b2165;};'use strict';var _=require(_0xf19a('0x0'));var util=require(_0xf19a('0x1'));var moment=require(_0xf19a('0x2'));var BPromise=require(_0xf19a('0x3'));var rs=require(_0xf19a('0x4'));var fs=require('fs');var Redis=require(_0xf19a('0x5'));var db=require(_0xf19a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf19a('0x7'))(_0xf19a('0x8'));var config=require('../../config/environment');var jayson=require(_0xf19a('0x9'));var client=jayson['client'][_0xf19a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x230645,_0x4ae981,_0x229057){return new BPromise(function(_0x408ca0,_0x52dbbd){return client[_0xf19a('0xb')](_0x230645,_0x229057)[_0xf19a('0xc')](function(_0x41d378){logger[_0xf19a('0xd')](_0xf19a('0xe'),_0x4ae981,_0xf19a('0xf'));logger[_0xf19a('0x10')](_0xf19a('0x11'),_0x4ae981,_0xf19a('0xf'),JSON[_0xf19a('0x12')](_0x41d378));if(_0x41d378[_0xf19a('0x13')]){if(_0x41d378[_0xf19a('0x13')][_0xf19a('0x14')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x4ae981,_0x41d378['error']['message']);return _0x52dbbd(_0x41d378['error'][_0xf19a('0x15')]);}logger[_0xf19a('0x13')](_0xf19a('0xe'),_0x4ae981,_0x41d378[_0xf19a('0x13')][_0xf19a('0x15')]);return _0x408ca0(_0x41d378[_0xf19a('0x13')][_0xf19a('0x15')]);}else{logger[_0xf19a('0xd')](_0xf19a('0xe'),_0x4ae981,_0xf19a('0xf'));_0x408ca0(_0x41d378[_0xf19a('0x16')][_0xf19a('0x15')]);}})['catch'](function(_0x4c3d02){logger[_0xf19a('0x13')](_0xf19a('0xe'),_0x4ae981,_0x4c3d02);_0x52dbbd(_0x4c3d02);});});}
\ No newline at end of file
index 1284530..6f41d2d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9cf2=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','destroy','exports','multer'];(function(_0x2290d2,_0x19a730){var _0x2bd5ae=function(_0x414eac){while(--_0x414eac){_0x2290d2['push'](_0x2290d2['shift']());}};_0x2bd5ae(++_0x19a730);}(_0x9cf2,0x1cd));var _0x29cf=function(_0xb02385,_0x2b4739){_0xb02385=_0xb02385-0x0;var _0x65c10d=_0x9cf2[_0xb02385];return _0x65c10d;};'use strict';var multer=require(_0x29cf('0x0'));var util=require('util');var path=require(_0x29cf('0x1'));var timeout=require(_0x29cf('0x2'));var express=require(_0x29cf('0x3'));var router=express[_0x29cf('0x4')]();var fs_extra=require(_0x29cf('0x5'));var auth=require(_0x29cf('0x6'));var interaction=require(_0x29cf('0x7'));var config=require(_0x29cf('0x8'));var controller=require(_0x29cf('0x9'));router['get']('/',auth[_0x29cf('0xa')](),controller[_0x29cf('0xb')]);router[_0x29cf('0xc')](_0x29cf('0xd'),auth[_0x29cf('0xa')](),controller['describe']);router[_0x29cf('0xc')](_0x29cf('0xe'),auth[_0x29cf('0xa')](),controller[_0x29cf('0xf')]);router[_0x29cf('0x10')]('/',auth[_0x29cf('0xa')](),controller[_0x29cf('0x11')]);router[_0x29cf('0x12')]('/:id',auth[_0x29cf('0xa')](),controller['update']);router['delete'](_0x29cf('0xe'),auth[_0x29cf('0xa')](),controller[_0x29cf('0x13')]);module[_0x29cf('0x14')]=router;
\ No newline at end of file
+var _0x0279=['express','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','destroy','multer','util','path','connect-timeout'];(function(_0x43d457,_0x1ab41a){var _0x5e24d5=function(_0x15b5bf){while(--_0x15b5bf){_0x43d457['push'](_0x43d457['shift']());}};_0x5e24d5(++_0x1ab41a);}(_0x0279,0x1d7));var _0x9027=function(_0x412dd8,_0x355780){_0x412dd8=_0x412dd8-0x0;var _0x47b96=_0x0279[_0x412dd8];return _0x47b96;};'use strict';var multer=require(_0x9027('0x0'));var util=require(_0x9027('0x1'));var path=require(_0x9027('0x2'));var timeout=require(_0x9027('0x3'));var express=require(_0x9027('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9027('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9027('0x6'));var controller=require(_0x9027('0x7'));router[_0x9027('0x8')]('/',auth[_0x9027('0x9')](),controller[_0x9027('0xa')]);router[_0x9027('0x8')](_0x9027('0xb'),auth['isAuthenticated'](),controller[_0x9027('0xc')]);router[_0x9027('0x8')]('/:id',auth[_0x9027('0x9')](),controller[_0x9027('0xd')]);router[_0x9027('0xe')]('/',auth[_0x9027('0x9')](),controller[_0x9027('0xf')]);router['put'](_0x9027('0x10'),auth[_0x9027('0x9')](),controller[_0x9027('0x11')]);router['delete'](_0x9027('0x10'),auth[_0x9027('0x9')](),controller[_0x9027('0x12')]);module['exports']=router;
\ No newline at end of file
index 1edf1b3..f989075 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x93e9=['crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0xc6f8fd,_0x5b1733){var _0x53ae61=function(_0x3a004c){while(--_0x3a004c){_0xc6f8fd['push'](_0xc6f8fd['shift']());}};_0x53ae61(++_0x5b1733);}(_0x93e9,0xcc));var _0x993e=function(_0x1d1c0b,_0x3449f2){_0x1d1c0b=_0x1d1c0b-0x0;var _0x57ccd1=_0x93e9[_0x1d1c0b];return _0x57ccd1;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'name':{'type':Sequelize[_0x993e('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x993e('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x993e('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x993e('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x993e('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x55f739){this[_0x993e('0x5')](_0x993e('0x6'),_0x55f739?_0x55f739[_0x993e('0x7')](''):[]);},'get':function(){return this[_0x993e('0x8')](_0x993e('0x6'))?this[_0x993e('0x8')](_0x993e('0x6'))[_0x993e('0x9')](''):[];}}};
\ No newline at end of file
+var _0x69d3=['crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','join','getDataValue'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x69d3,0xda));var _0x369d=function(_0x4316f7,_0x47beaf){_0x4316f7=_0x4316f7-0x0;var _0x452f0b=_0x69d3[_0x4316f7];return _0x452f0b;};'use strict';var Sequelize=require(_0x369d('0x0'));module[_0x369d('0x1')]={'name':{'type':Sequelize[_0x369d('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x369d('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x369d('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xe38740){this['setDataValue']('crudPermissions',_0xe38740?_0xe38740[_0x369d('0x5')](''):[]);},'get':function(){return this[_0x369d('0x6')](_0x369d('0x7'))?this[_0x369d('0x6')](_0x369d('0x7'))[_0x369d('0x8')](''):[];}}};
\ No newline at end of file
index 27ad383..e7cfded 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf3b9=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','limit','undefined','count','offset','Content-Range','reject','save','update','destroy','then','end','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','find','catch'];(function(_0x299034,_0xd98afe){var _0x1f2354=function(_0x59862d){while(--_0x59862d){_0x299034['push'](_0x299034['shift']());}};_0x1f2354(++_0xd98afe);}(_0xf3b9,0xa1));var _0x9f3b=function(_0x41cc07,_0x389f58){_0x41cc07=_0x41cc07-0x0;var _0x8aa07f=_0xf3b9[_0x41cc07];return _0x8aa07f;};'use strict';var emlformat=require(_0x9f3b('0x0'));var rimraf=require(_0x9f3b('0x1'));var zipdir=require(_0x9f3b('0x2'));var jsonpatch=require(_0x9f3b('0x3'));var rp=require(_0x9f3b('0x4'));var moment=require(_0x9f3b('0x5'));var BPromise=require(_0x9f3b('0x6'));var Mustache=require(_0x9f3b('0x7'));var util=require(_0x9f3b('0x8'));var path=require(_0x9f3b('0x9'));var sox=require(_0x9f3b('0xa'));var csv=require('to-csv');var ejs=require(_0x9f3b('0xb'));var fs=require('fs');var fs_extra=require(_0x9f3b('0xc'));var _=require('lodash');var squel=require(_0x9f3b('0xd'));var crypto=require(_0x9f3b('0xe'));var jsforce=require(_0x9f3b('0xf'));var deskjs=require(_0x9f3b('0x10'));var toCsv=require(_0x9f3b('0x11'));var querystring=require(_0x9f3b('0x12'));var Papa=require(_0x9f3b('0x13'));var Redis=require(_0x9f3b('0x14'));var authService=require(_0x9f3b('0x15'));var qs=require(_0x9f3b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f3b('0x17'));var logger=require(_0x9f3b('0x18'))(_0x9f3b('0x19'));var utils=require(_0x9f3b('0x1a'));var config=require(_0x9f3b('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b1816,_0x531bc5){_0x531bc5=_0x531bc5||0xcc;return function(_0x41fbfe){if(_0x41fbfe){return _0x2b1816[_0x9f3b('0x1c')](_0x531bc5);}return _0x2b1816[_0x9f3b('0x1d')](_0x531bc5)['end']();};}function respondWithResult(_0x58430e,_0x4c59c4){_0x4c59c4=_0x4c59c4||0xc8;return function(_0x345e83){if(_0x345e83){return _0x58430e[_0x9f3b('0x1d')](_0x4c59c4)[_0x9f3b('0x1e')](_0x345e83);}};}function respondWithFilteredResult(_0x340307,_0x56b1f7){return function(_0x30786e){if(_0x30786e){var _0x491278=typeof _0x56b1f7['offset']==='undefined'&&typeof _0x56b1f7[_0x9f3b('0x1f')]===_0x9f3b('0x20');var _0x1bc745=_0x30786e[_0x9f3b('0x21')];var _0x273633=_0x491278?0x0:_0x56b1f7['offset'];var _0x32f525=_0x491278?_0x30786e[_0x9f3b('0x21')]:_0x56b1f7[_0x9f3b('0x22')]+_0x56b1f7['limit'];var _0x1ff162;if(_0x32f525>=_0x1bc745){_0x32f525=_0x1bc745;_0x1ff162=0xc8;}else{_0x1ff162=0xce;}_0x340307['status'](_0x1ff162);return _0x340307['set'](_0x9f3b('0x23'),_0x273633+'-'+_0x32f525+'/'+_0x1bc745)[_0x9f3b('0x1e')](_0x30786e);}return null;};}function patchUpdates(_0x5da586){return function(_0x5e1792){try{jsonpatch['apply'](_0x5e1792,_0x5da586,!![]);}catch(_0x5c797e){return BPromise[_0x9f3b('0x24')](_0x5c797e);}return _0x5e1792[_0x9f3b('0x25')]();};}function saveUpdates(_0x55a957,_0x2cdb7e){return function(_0xe739f1){if(_0xe739f1){return _0xe739f1[_0x9f3b('0x26')](_0x55a957)['then'](function(_0x251246){return _0x251246;});}return null;};}function removeEntity(_0x51f3e6,_0x1fc123){return function(_0x4b6153){if(_0x4b6153){return _0x4b6153[_0x9f3b('0x27')]()[_0x9f3b('0x28')](function(){_0x51f3e6[_0x9f3b('0x1d')](0xcc)[_0x9f3b('0x29')]();});}};}function handleEntityNotFound(_0x4db5b5,_0x3f0a4c){return function(_0x436658){if(!_0x436658){_0x4db5b5[_0x9f3b('0x1c')](0x194);}return _0x436658;};}function handleError(_0x39bc58,_0x53dbca){_0x53dbca=_0x53dbca||0x1f4;return function(_0x4489b5){logger['error'](_0x4489b5[_0x9f3b('0x2a')]);if(_0x4489b5['name']){delete _0x4489b5[_0x9f3b('0x2b')];}_0x39bc58[_0x9f3b('0x1d')](_0x53dbca)[_0x9f3b('0x2c')](_0x4489b5);};}exports[_0x9f3b('0x2d')]=function(_0x7d4b15,_0x3d9356){var _0x2abf97={},_0x5b80b4={},_0x4acc4b={'count':0x0,'rows':[]};var _0x1d04ac=_[_0x9f3b('0x2e')](db[_0x9f3b('0x2f')][_0x9f3b('0x30')],function(_0x155a14){return{'name':_0x155a14[_0x9f3b('0x31')],'type':_0x155a14['type'][_0x9f3b('0x32')]};});_0x5b80b4[_0x9f3b('0x33')]=_[_0x9f3b('0x2e')](_0x1d04ac,_0x9f3b('0x2b'));_0x5b80b4[_0x9f3b('0x34')]=_[_0x9f3b('0x35')](_0x7d4b15[_0x9f3b('0x34')]);_0x5b80b4[_0x9f3b('0x36')]=_[_0x9f3b('0x37')](_0x5b80b4[_0x9f3b('0x33')],_0x5b80b4['query']);_0x2abf97[_0x9f3b('0x38')]=_['intersection'](_0x5b80b4[_0x9f3b('0x33')],qs['fields'](_0x7d4b15[_0x9f3b('0x34')][_0x9f3b('0x39')]));_0x2abf97[_0x9f3b('0x38')]=_0x2abf97[_0x9f3b('0x38')][_0x9f3b('0x3a')]?_0x2abf97[_0x9f3b('0x38')]:_0x5b80b4[_0x9f3b('0x33')];if(!_0x7d4b15[_0x9f3b('0x34')][_0x9f3b('0x3b')](_0x9f3b('0x3c'))){_0x2abf97['limit']=qs[_0x9f3b('0x1f')](_0x7d4b15[_0x9f3b('0x34')][_0x9f3b('0x1f')]);_0x2abf97[_0x9f3b('0x22')]=qs[_0x9f3b('0x22')](_0x7d4b15[_0x9f3b('0x34')][_0x9f3b('0x22')]);}_0x2abf97['order']=qs[_0x9f3b('0x3d')](_0x7d4b15[_0x9f3b('0x34')]['sort']);_0x2abf97[_0x9f3b('0x3e')]=qs[_0x9f3b('0x36')](_[_0x9f3b('0x3f')](_0x7d4b15[_0x9f3b('0x34')],_0x5b80b4[_0x9f3b('0x36')]),_0x1d04ac);if(_0x7d4b15[_0x9f3b('0x34')][_0x9f3b('0x40')]){_0x2abf97[_0x9f3b('0x3e')]=_[_0x9f3b('0x41')](_0x2abf97['where'],{'$or':_[_0x9f3b('0x2e')](_0x1d04ac,function(_0x5c46f0){if(_0x5c46f0[_0x9f3b('0x42')]!==_0x9f3b('0x43')){var _0x379ee4={};_0x379ee4[_0x5c46f0[_0x9f3b('0x2b')]]={'$like':'%'+_0x7d4b15[_0x9f3b('0x34')]['filter']+'%'};return _0x379ee4;}})});}_0x2abf97=_[_0x9f3b('0x41')]({},_0x2abf97,_0x7d4b15[_0x9f3b('0x44')]);var _0x1231e6={'where':_0x2abf97[_0x9f3b('0x3e')]};return db[_0x9f3b('0x2f')][_0x9f3b('0x21')](_0x1231e6)[_0x9f3b('0x28')](function(_0x3b9e45){_0x4acc4b[_0x9f3b('0x21')]=_0x3b9e45;if(_0x7d4b15[_0x9f3b('0x34')][_0x9f3b('0x45')]){_0x2abf97[_0x9f3b('0x46')]=[{'all':!![]}];}return db[_0x9f3b('0x2f')]['findAll'](_0x2abf97);})['then'](function(_0x1951e7){_0x4acc4b[_0x9f3b('0x47')]=_0x1951e7;return _0x4acc4b;})[_0x9f3b('0x28')](respondWithFilteredResult(_0x3d9356,_0x2abf97))['catch'](handleError(_0x3d9356,null));};exports[_0x9f3b('0x48')]=function(_0x5d6dbd,_0x369fa7){var _0x162076={'raw':![],'where':{'id':_0x5d6dbd[_0x9f3b('0x49')]['id']}},_0x4d3d6d={};_0x4d3d6d[_0x9f3b('0x33')]=_['keys'](db[_0x9f3b('0x2f')][_0x9f3b('0x30')]);_0x4d3d6d[_0x9f3b('0x34')]=_[_0x9f3b('0x35')](_0x5d6dbd['query']);_0x4d3d6d[_0x9f3b('0x36')]=_[_0x9f3b('0x37')](_0x4d3d6d[_0x9f3b('0x33')],_0x4d3d6d[_0x9f3b('0x34')]);_0x162076[_0x9f3b('0x38')]=_['intersection'](_0x4d3d6d[_0x9f3b('0x33')],qs['fields'](_0x5d6dbd['query'][_0x9f3b('0x39')]));_0x162076[_0x9f3b('0x38')]=_0x162076[_0x9f3b('0x38')][_0x9f3b('0x3a')]?_0x162076[_0x9f3b('0x38')]:_0x4d3d6d['model'];if(_0x5d6dbd[_0x9f3b('0x34')][_0x9f3b('0x45')]){_0x162076[_0x9f3b('0x46')]=[{'all':!![]}];}_0x162076=_[_0x9f3b('0x41')]({},_0x162076,_0x5d6dbd[_0x9f3b('0x44')]);return db[_0x9f3b('0x2f')][_0x9f3b('0x4a')](_0x162076)[_0x9f3b('0x28')](handleEntityNotFound(_0x369fa7,null))[_0x9f3b('0x28')](respondWithResult(_0x369fa7,null))[_0x9f3b('0x4b')](handleError(_0x369fa7,null));};exports[_0x9f3b('0x4c')]=function(_0x215f2d,_0x3d4d20){return db[_0x9f3b('0x2f')][_0x9f3b('0x4c')](_0x215f2d[_0x9f3b('0x4d')],{})[_0x9f3b('0x28')](respondWithResult(_0x3d4d20,0xc9))[_0x9f3b('0x4b')](handleError(_0x3d4d20,null));};exports[_0x9f3b('0x26')]=function(_0x4bd705,_0x1e6cb5){if(_0x4bd705[_0x9f3b('0x4d')]['id']){delete _0x4bd705[_0x9f3b('0x4d')]['id'];}return db[_0x9f3b('0x2f')][_0x9f3b('0x4a')]({'where':{'id':_0x4bd705[_0x9f3b('0x49')]['id']}})[_0x9f3b('0x28')](handleEntityNotFound(_0x1e6cb5,null))[_0x9f3b('0x28')](saveUpdates(_0x4bd705['body'],null))[_0x9f3b('0x28')](respondWithResult(_0x1e6cb5,null))[_0x9f3b('0x4b')](handleError(_0x1e6cb5,null));};exports['destroy']=function(_0x30bcff,_0x163cd4){return db[_0x9f3b('0x2f')][_0x9f3b('0x4a')]({'where':{'id':_0x30bcff[_0x9f3b('0x49')]['id']}})[_0x9f3b('0x28')](handleEntityNotFound(_0x163cd4,null))['then'](removeEntity(_0x163cd4,null))[_0x9f3b('0x4b')](handleError(_0x163cd4,null));};exports[_0x9f3b('0x4e')]=function(_0x13993f,_0x2c0d51){return db[_0x9f3b('0x2f')][_0x9f3b('0x4e')]()['then'](respondWithResult(_0x2c0d51,null))[_0x9f3b('0x4b')](handleError(_0x2c0d51,null));};
\ No newline at end of file
+var _0x6d8d=['catch','show','params','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','type','VIRTUAL','rows'];(function(_0x1a2740,_0x2b1b09){var _0x3041d4=function(_0x393a1a){while(--_0x393a1a){_0x1a2740['push'](_0x1a2740['shift']());}};_0x3041d4(++_0x2b1b09);}(_0x6d8d,0xda));var _0xd6d8=function(_0x42b2dc,_0x219c6e){_0x42b2dc=_0x42b2dc-0x0;var _0x20db41=_0x6d8d[_0x42b2dc];return _0x20db41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6d8('0x0'));var zipdir=require(_0xd6d8('0x1'));var jsonpatch=require(_0xd6d8('0x2'));var rp=require(_0xd6d8('0x3'));var moment=require(_0xd6d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd6d8('0x5'));var util=require(_0xd6d8('0x6'));var path=require(_0xd6d8('0x7'));var sox=require(_0xd6d8('0x8'));var csv=require(_0xd6d8('0x9'));var ejs=require(_0xd6d8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6d8('0xb'));var squel=require(_0xd6d8('0xc'));var crypto=require(_0xd6d8('0xd'));var jsforce=require(_0xd6d8('0xe'));var deskjs=require(_0xd6d8('0xf'));var toCsv=require(_0xd6d8('0x9'));var querystring=require(_0xd6d8('0x10'));var Papa=require(_0xd6d8('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd6d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6d8('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd6d8('0x14'));var db=require(_0xd6d8('0x15'))['db'];function respondWithStatusCode(_0x2e60c1,_0x581fe3){_0x581fe3=_0x581fe3||0xcc;return function(_0x2e030a){if(_0x2e030a){return _0x2e60c1['sendStatus'](_0x581fe3);}return _0x2e60c1[_0xd6d8('0x16')](_0x581fe3)[_0xd6d8('0x17')]();};}function respondWithResult(_0xf40df8,_0x5d097d){_0x5d097d=_0x5d097d||0xc8;return function(_0x3c5254){if(_0x3c5254){return _0xf40df8[_0xd6d8('0x16')](_0x5d097d)[_0xd6d8('0x18')](_0x3c5254);}};}function respondWithFilteredResult(_0x14bb42,_0x595e33){return function(_0xc73276){if(_0xc73276){var _0x3c6dfe=typeof _0x595e33[_0xd6d8('0x19')]===_0xd6d8('0x1a')&&typeof _0x595e33[_0xd6d8('0x1b')]===_0xd6d8('0x1a');var _0x19f559=_0xc73276[_0xd6d8('0x1c')];var _0x464be9=_0x3c6dfe?0x0:_0x595e33[_0xd6d8('0x19')];var _0x3290f3=_0x3c6dfe?_0xc73276[_0xd6d8('0x1c')]:_0x595e33[_0xd6d8('0x19')]+_0x595e33[_0xd6d8('0x1b')];var _0x33a1be;if(_0x3290f3>=_0x19f559){_0x3290f3=_0x19f559;_0x33a1be=0xc8;}else{_0x33a1be=0xce;}_0x14bb42[_0xd6d8('0x16')](_0x33a1be);return _0x14bb42[_0xd6d8('0x1d')](_0xd6d8('0x1e'),_0x464be9+'-'+_0x3290f3+'/'+_0x19f559)[_0xd6d8('0x18')](_0xc73276);}return null;};}function patchUpdates(_0x431307){return function(_0x424181){try{jsonpatch['apply'](_0x424181,_0x431307,!![]);}catch(_0x585831){return BPromise[_0xd6d8('0x1f')](_0x585831);}return _0x424181[_0xd6d8('0x20')]();};}function saveUpdates(_0x4a6a5f,_0x5f3428){return function(_0x12c869){if(_0x12c869){return _0x12c869['update'](_0x4a6a5f)[_0xd6d8('0x21')](function(_0xed0390){return _0xed0390;});}return null;};}function removeEntity(_0x2cb54c,_0x46584f){return function(_0x855736){if(_0x855736){return _0x855736[_0xd6d8('0x22')]()[_0xd6d8('0x21')](function(){_0x2cb54c[_0xd6d8('0x16')](0xcc)[_0xd6d8('0x17')]();});}};}function handleEntityNotFound(_0x444000,_0x2d0f26){return function(_0x51a125){if(!_0x51a125){_0x444000[_0xd6d8('0x23')](0x194);}return _0x51a125;};}function handleError(_0x52f56e,_0x214405){_0x214405=_0x214405||0x1f4;return function(_0x52fab8){logger['error'](_0x52fab8[_0xd6d8('0x24')]);if(_0x52fab8[_0xd6d8('0x25')]){delete _0x52fab8[_0xd6d8('0x25')];}_0x52f56e[_0xd6d8('0x16')](_0x214405)[_0xd6d8('0x26')](_0x52fab8);};}exports[_0xd6d8('0x27')]=function(_0x4a4318,_0x1002cc){var _0x220a45={},_0x3969e0={},_0x3ebc3b={'count':0x0,'rows':[]};var _0x5e88d3=_[_0xd6d8('0x28')](db[_0xd6d8('0x29')][_0xd6d8('0x2a')],function(_0x238791){return{'name':_0x238791[_0xd6d8('0x2b')],'type':_0x238791['type'][_0xd6d8('0x2c')]};});_0x3969e0[_0xd6d8('0x2d')]=_[_0xd6d8('0x28')](_0x5e88d3,_0xd6d8('0x25'));_0x3969e0[_0xd6d8('0x2e')]=_[_0xd6d8('0x2f')](_0x4a4318[_0xd6d8('0x2e')]);_0x3969e0[_0xd6d8('0x30')]=_[_0xd6d8('0x31')](_0x3969e0[_0xd6d8('0x2d')],_0x3969e0[_0xd6d8('0x2e')]);_0x220a45[_0xd6d8('0x32')]=_[_0xd6d8('0x31')](_0x3969e0[_0xd6d8('0x2d')],qs['fields'](_0x4a4318[_0xd6d8('0x2e')][_0xd6d8('0x33')]));_0x220a45[_0xd6d8('0x32')]=_0x220a45[_0xd6d8('0x32')][_0xd6d8('0x34')]?_0x220a45[_0xd6d8('0x32')]:_0x3969e0[_0xd6d8('0x2d')];if(!_0x4a4318[_0xd6d8('0x2e')]['hasOwnProperty'](_0xd6d8('0x35'))){_0x220a45[_0xd6d8('0x1b')]=qs[_0xd6d8('0x1b')](_0x4a4318['query'][_0xd6d8('0x1b')]);_0x220a45['offset']=qs['offset'](_0x4a4318['query'][_0xd6d8('0x19')]);}_0x220a45[_0xd6d8('0x36')]=qs[_0xd6d8('0x37')](_0x4a4318[_0xd6d8('0x2e')][_0xd6d8('0x37')]);_0x220a45['where']=qs['filters'](_['pick'](_0x4a4318[_0xd6d8('0x2e')],_0x3969e0[_0xd6d8('0x30')]),_0x5e88d3);if(_0x4a4318[_0xd6d8('0x2e')][_0xd6d8('0x38')]){_0x220a45[_0xd6d8('0x39')]=_[_0xd6d8('0x3a')](_0x220a45[_0xd6d8('0x39')],{'$or':_[_0xd6d8('0x28')](_0x5e88d3,function(_0x54181f){if(_0x54181f[_0xd6d8('0x3b')]!==_0xd6d8('0x3c')){var _0x38d75c={};_0x38d75c[_0x54181f['name']]={'$like':'%'+_0x4a4318['query'][_0xd6d8('0x38')]+'%'};return _0x38d75c;}})});}_0x220a45=_[_0xd6d8('0x3a')]({},_0x220a45,_0x4a4318['options']);var _0x510d10={'where':_0x220a45[_0xd6d8('0x39')]};return db[_0xd6d8('0x29')]['count'](_0x510d10)[_0xd6d8('0x21')](function(_0x3aa731){_0x3ebc3b['count']=_0x3aa731;if(_0x4a4318['query']['includeAll']){_0x220a45['include']=[{'all':!![]}];}return db[_0xd6d8('0x29')]['findAll'](_0x220a45);})['then'](function(_0x403c08){_0x3ebc3b[_0xd6d8('0x3d')]=_0x403c08;return _0x3ebc3b;})['then'](respondWithFilteredResult(_0x1002cc,_0x220a45))[_0xd6d8('0x3e')](handleError(_0x1002cc,null));};exports[_0xd6d8('0x3f')]=function(_0x524e84,_0x29c477){var _0xd912ef={'raw':![],'where':{'id':_0x524e84[_0xd6d8('0x40')]['id']}},_0xdfbd5e={};_0xdfbd5e[_0xd6d8('0x2d')]=_[_0xd6d8('0x2f')](db['UserProfileSection'][_0xd6d8('0x2a')]);_0xdfbd5e[_0xd6d8('0x2e')]=_[_0xd6d8('0x2f')](_0x524e84['query']);_0xdfbd5e['filters']=_[_0xd6d8('0x31')](_0xdfbd5e['model'],_0xdfbd5e[_0xd6d8('0x2e')]);_0xd912ef[_0xd6d8('0x32')]=_[_0xd6d8('0x31')](_0xdfbd5e[_0xd6d8('0x2d')],qs['fields'](_0x524e84[_0xd6d8('0x2e')][_0xd6d8('0x33')]));_0xd912ef[_0xd6d8('0x32')]=_0xd912ef['attributes'][_0xd6d8('0x34')]?_0xd912ef[_0xd6d8('0x32')]:_0xdfbd5e[_0xd6d8('0x2d')];if(_0x524e84[_0xd6d8('0x2e')]['includeAll']){_0xd912ef['include']=[{'all':!![]}];}_0xd912ef=_['merge']({},_0xd912ef,_0x524e84['options']);return db[_0xd6d8('0x29')][_0xd6d8('0x41')](_0xd912ef)[_0xd6d8('0x21')](handleEntityNotFound(_0x29c477,null))[_0xd6d8('0x21')](respondWithResult(_0x29c477,null))['catch'](handleError(_0x29c477,null));};exports['create']=function(_0x4eabbf,_0x332249){return db[_0xd6d8('0x29')][_0xd6d8('0x42')](_0x4eabbf[_0xd6d8('0x43')],{})[_0xd6d8('0x21')](respondWithResult(_0x332249,0xc9))[_0xd6d8('0x3e')](handleError(_0x332249,null));};exports[_0xd6d8('0x44')]=function(_0x1d72c6,_0x34ab5){if(_0x1d72c6[_0xd6d8('0x43')]['id']){delete _0x1d72c6['body']['id'];}return db[_0xd6d8('0x29')]['find']({'where':{'id':_0x1d72c6['params']['id']}})[_0xd6d8('0x21')](handleEntityNotFound(_0x34ab5,null))[_0xd6d8('0x21')](saveUpdates(_0x1d72c6[_0xd6d8('0x43')],null))[_0xd6d8('0x21')](respondWithResult(_0x34ab5,null))['catch'](handleError(_0x34ab5,null));};exports['destroy']=function(_0x151477,_0x4552d6){return db['UserProfileSection']['find']({'where':{'id':_0x151477[_0xd6d8('0x40')]['id']}})[_0xd6d8('0x21')](handleEntityNotFound(_0x4552d6,null))['then'](removeEntity(_0x4552d6,null))[_0xd6d8('0x3e')](handleError(_0x4552d6,null));};exports[_0xd6d8('0x45')]=function(_0x4831e2,_0x458f63){return db[_0xd6d8('0x29')][_0xd6d8('0x45')]()[_0xd6d8('0x21')](respondWithResult(_0x458f63,null))[_0xd6d8('0x3e')](handleError(_0x458f63,null));};
\ No newline at end of file
index 6ea4e5b..6ef8d32 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x878d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','lodash','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x878d,0x15c));var _0xd878=function(_0x4d82e1,_0x5ac72b){_0x4d82e1=_0x4d82e1-0x0;var _0x5f3bd9=_0x878d[_0x4d82e1];return _0x5f3bd9;};'use strict';var _=require(_0xd878('0x0'));var util=require('util');var logger=require(_0xd878('0x1'))(_0xd878('0x2'));var moment=require(_0xd878('0x3'));var BPromise=require(_0xd878('0x4'));var rp=require(_0xd878('0x5'));var fs=require('fs');var path=require(_0xd878('0x6'));var rimraf=require(_0xd878('0x7'));var config=require(_0xd878('0x8'));var attributes=require(_0xd878('0x9'));module[_0xd878('0xa')]=function(_0xe98a81,_0x4df7aa){return _0xe98a81['define'](_0xd878('0xb'),attributes,{'tableName':_0xd878('0xc'),'paranoid':![],'indexes':[{'name':_0xd878('0xd'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x1aab=['UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define'];(function(_0x3c983b,_0x3927be){var _0x416427=function(_0x6acda){while(--_0x6acda){_0x3c983b['push'](_0x3c983b['shift']());}};_0x416427(++_0x3927be);}(_0x1aab,0x122));var _0xb1aa=function(_0x36daaa,_0x32a210){_0x36daaa=_0x36daaa-0x0;var _0x2f9048=_0x1aab[_0x36daaa];return _0x2f9048;};'use strict';var _=require(_0xb1aa('0x0'));var util=require(_0xb1aa('0x1'));var logger=require(_0xb1aa('0x2'))('api');var moment=require(_0xb1aa('0x3'));var BPromise=require('bluebird');var rp=require(_0xb1aa('0x4'));var fs=require('fs');var path=require(_0xb1aa('0x5'));var rimraf=require(_0xb1aa('0x6'));var config=require(_0xb1aa('0x7'));var attributes=require(_0xb1aa('0x8'));module['exports']=function(_0x5eb27f,_0x34e0f4){return _0x5eb27f[_0xb1aa('0x9')](_0xb1aa('0xa'),attributes,{'tableName':_0xb1aa('0xb'),'paranoid':![],'indexes':[{'name':_0xb1aa('0xc'),'fields':[_0xb1aa('0xd'),_0xb1aa('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
index e3c1311..5f620e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1933=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x133ed0,_0x18b453){var _0x416a92=function(_0x3534ef){while(--_0x3534ef){_0x133ed0['push'](_0x133ed0['shift']());}};_0x416a92(++_0x18b453);}(_0x1933,0xa7));var _0x3193=function(_0xd69a94,_0x6e41e0){_0xd69a94=_0xd69a94-0x0;var _0x40b99e=_0x1933[_0xd69a94];return _0x40b99e;};'use strict';var _=require('lodash');var util=require(_0x3193('0x0'));var moment=require(_0x3193('0x1'));var BPromise=require(_0x3193('0x2'));var rs=require(_0x3193('0x3'));var fs=require('fs');var Redis=require(_0x3193('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3193('0x5'));var logger=require(_0x3193('0x6'))(_0x3193('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3193('0x8')][_0x3193('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b0eda,_0x2ef071,_0x7cc555){return new BPromise(function(_0x4c2f07,_0x441f71){return client['request'](_0x2b0eda,_0x7cc555)['then'](function(_0x2d4a50){logger[_0x3193('0xa')](_0x3193('0xb'),_0x2ef071,'request\x20sent');logger[_0x3193('0xc')](_0x3193('0xd'),_0x2ef071,_0x3193('0xe'),JSON[_0x3193('0xf')](_0x2d4a50));if(_0x2d4a50[_0x3193('0x10')]){if(_0x2d4a50[_0x3193('0x10')][_0x3193('0x11')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2ef071,_0x2d4a50['error'][_0x3193('0x12')]);return _0x441f71(_0x2d4a50['error'][_0x3193('0x12')]);}logger['error'](_0x3193('0xb'),_0x2ef071,_0x2d4a50[_0x3193('0x10')]['message']);return _0x4c2f07(_0x2d4a50['error'][_0x3193('0x12')]);}else{logger[_0x3193('0xa')](_0x3193('0xb'),_0x2ef071,'request\x20sent');_0x4c2f07(_0x2d4a50[_0x3193('0x13')][_0x3193('0x12')]);}})[_0x3193('0x14')](function(_0x76590f){logger[_0x3193('0x10')](_0x3193('0xb'),_0x2ef071,_0x76590f);_0x441f71(_0x76590f);});});}
\ No newline at end of file
+var _0x4b2e=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x197789,_0x43d35b){var _0x48dcd=function(_0x4f2cdf){while(--_0x4f2cdf){_0x197789['push'](_0x197789['shift']());}};_0x48dcd(++_0x43d35b);}(_0x4b2e,0x1ec));var _0xe4b2=function(_0x4c0f1e,_0x5cc515){_0x4c0f1e=_0x4c0f1e-0x0;var _0x37d0fa=_0x4b2e[_0x4c0f1e];return _0x37d0fa;};'use strict';var _=require(_0xe4b2('0x0'));var util=require(_0xe4b2('0x1'));var moment=require(_0xe4b2('0x2'));var BPromise=require(_0xe4b2('0x3'));var rs=require(_0xe4b2('0x4'));var fs=require('fs');var Redis=require(_0xe4b2('0x5'));var db=require(_0xe4b2('0x6'))['db'];var utils=require(_0xe4b2('0x7'));var logger=require(_0xe4b2('0x8'))(_0xe4b2('0x9'));var config=require(_0xe4b2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe4b2('0xb')][_0xe4b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x566045,_0xeb41bc,_0xa7d655){return new BPromise(function(_0x4109ae,_0xe355b6){return client[_0xe4b2('0xd')](_0x566045,_0xa7d655)[_0xe4b2('0xe')](function(_0x486fd5){logger[_0xe4b2('0xf')](_0xe4b2('0x10'),_0xeb41bc,_0xe4b2('0x11'));logger[_0xe4b2('0x12')](_0xe4b2('0x13'),_0xeb41bc,_0xe4b2('0x11'),JSON[_0xe4b2('0x14')](_0x486fd5));if(_0x486fd5[_0xe4b2('0x15')]){if(_0x486fd5[_0xe4b2('0x15')][_0xe4b2('0x16')]===0x1f4){logger[_0xe4b2('0x15')]('UserProfileSection,\x20%s,\x20%s',_0xeb41bc,_0x486fd5[_0xe4b2('0x15')][_0xe4b2('0x17')]);return _0xe355b6(_0x486fd5[_0xe4b2('0x15')][_0xe4b2('0x17')]);}logger['error'](_0xe4b2('0x10'),_0xeb41bc,_0x486fd5[_0xe4b2('0x15')]['message']);return _0x4109ae(_0x486fd5[_0xe4b2('0x15')]['message']);}else{logger[_0xe4b2('0xf')](_0xe4b2('0x10'),_0xeb41bc,'request\x20sent');_0x4109ae(_0x486fd5[_0xe4b2('0x18')][_0xe4b2('0x17')]);}})['catch'](function(_0x15ed3d){logger['error']('UserProfileSection,\x20%s,\x20%s',_0xeb41bc,_0x15ed3d);_0xe355b6(_0x15ed3d);});});}
\ No newline at end of file
index 6ca3190..28c33af 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x523dce,_0x1fad37){var _0x3312be=function(_0x47adf4){while(--_0x47adf4){_0x523dce['push'](_0x523dce['shift']());}};_0x3312be(++_0x1fad37);}(_0xe706,0xa3));var _0x6e70=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0xe706[_0x39ffd1];return _0x31267e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router;
\ No newline at end of file
+var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5b740e,_0x6f2aba){var _0x5eb63e=function(_0x555eb5){while(--_0x555eb5){_0x5b740e['push'](_0x5b740e['shift']());}};_0x5eb63e(++_0x6f2aba);}(_0x70e0,0x17b));var _0x070e=function(_0x1a908d,_0x14460e){_0x1a908d=_0x1a908d-0x0;var _0x14fef6=_0x70e0[_0x1a908d];return _0x14fef6;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router;
\ No newline at end of file
index 6c774df..2fcf581 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2297=['sequelize','exports'];(function(_0x4e97f0,_0x5b4ff0){var _0x16a710=function(_0x27c3ab){while(--_0x27c3ab){_0x4e97f0['push'](_0x4e97f0['shift']());}};_0x16a710(++_0x5b4ff0);}(_0x2297,0x100));var _0x7229=function(_0x2b4fdd,_0x4c42c2){_0x2b4fdd=_0x2b4fdd-0x0;var _0x176e33=_0x2297[_0x2b4fdd];return _0x176e33;};'use strict';var Sequelize=require(_0x7229('0x0'));module[_0x7229('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
+var _0x44ed=['exports','sequelize'];(function(_0xfc420f,_0x3eb406){var _0x5cb00c=function(_0x101f0d){while(--_0x101f0d){_0xfc420f['push'](_0xfc420f['shift']());}};_0x5cb00c(++_0x3eb406);}(_0x44ed,0x183));var _0xd44e=function(_0x30730e,_0x83ca87){_0x30730e=_0x30730e-0x0;var _0x44e4a2=_0x44ed[_0x30730e];return _0x44e4a2;};'use strict';var Sequelize=require(_0xd44e('0x0'));module[_0xd44e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
index 69db67f..ffeab9d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xed1c=['exports','UserSmsQueue','user_has_sms_queues','lodash','util','request-promise','path','rimraf','./userSmsQueue.attributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xed1c,0xe4));var _0xced1=function(_0x375b8e,_0x142acd){_0x375b8e=_0x375b8e-0x0;var _0x555ef4=_0xed1c[_0x375b8e];return _0x555ef4;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xced1('0x2'));var fs=require('fs');var path=require(_0xced1('0x3'));var rimraf=require(_0xced1('0x4'));var config=require('../../config/environment');var attributes=require(_0xced1('0x5'));module[_0xced1('0x6')]=function(_0x466657,_0x37b22b){return _0x466657['define'](_0xced1('0x7'),attributes,{'tableName':_0xced1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4317=['./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4754c4,_0x2778cb){var _0x46c444=function(_0x2776c5){while(--_0x2776c5){_0x4754c4['push'](_0x4754c4['shift']());}};_0x46c444(++_0x2778cb);}(_0x4317,0x7c));var _0x7431=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4317[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x7431('0x0'));var logger=require(_0x7431('0x1'))(_0x7431('0x2'));var moment=require('moment');var BPromise=require(_0x7431('0x3'));var rp=require(_0x7431('0x4'));var fs=require('fs');var path=require(_0x7431('0x5'));var rimraf=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var attributes=require(_0x7431('0x8'));module['exports']=function(_0x57adc1,_0x1e1f35){return _0x57adc1[_0x7431('0x9')](_0x7431('0xa'),attributes,{'tableName':_0x7431('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d2efd32..cced3c7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb08b=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0xa73e59,_0x4ec963){var _0x24d7cd=function(_0x4fb5fd){while(--_0x4fb5fd){_0xa73e59['push'](_0xa73e59['shift']());}};_0x24d7cd(++_0x4ec963);}(_0xb08b,0x13a));var _0xbb08=function(_0x412b28,_0x534164){_0x412b28=_0x412b28-0x0;var _0x570de6=_0xb08b[_0x412b28];return _0x570de6;};'use strict';var _=require(_0xbb08('0x0'));var util=require(_0xbb08('0x1'));var moment=require(_0xbb08('0x2'));var BPromise=require('bluebird');var rs=require(_0xbb08('0x3'));var fs=require('fs');var Redis=require(_0xbb08('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb08('0x5'));var logger=require(_0xbb08('0x6'))(_0xbb08('0x7'));var config=require(_0xbb08('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d44fb,_0x4777e1,_0xd6f477){return new BPromise(function(_0x593c08,_0x17a8c6){return client[_0xbb08('0xa')](_0x5d44fb,_0xd6f477)['then'](function(_0x50ff56){logger[_0xbb08('0xb')](_0xbb08('0xc'),_0x4777e1,_0xbb08('0xd'));logger[_0xbb08('0xe')](_0xbb08('0xf'),_0x4777e1,_0xbb08('0xd'),JSON[_0xbb08('0x10')](_0x50ff56));if(_0x50ff56[_0xbb08('0x11')]){if(_0x50ff56[_0xbb08('0x11')][_0xbb08('0x12')]===0x1f4){logger[_0xbb08('0x11')](_0xbb08('0xc'),_0x4777e1,_0x50ff56[_0xbb08('0x11')]['message']);return _0x17a8c6(_0x50ff56[_0xbb08('0x11')][_0xbb08('0x13')]);}logger[_0xbb08('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x4777e1,_0x50ff56['error']['message']);return _0x593c08(_0x50ff56[_0xbb08('0x11')][_0xbb08('0x13')]);}else{logger[_0xbb08('0xb')](_0xbb08('0xc'),_0x4777e1,_0xbb08('0xd'));_0x593c08(_0x50ff56[_0xbb08('0x14')]['message']);}})[_0xbb08('0x15')](function(_0x512cac){logger['error'](_0xbb08('0xc'),_0x4777e1,_0x512cac);_0x17a8c6(_0x512cac);});});}
\ No newline at end of file
+var _0xc67b=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0xc67b,0xc0));var _0xbc67=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc67b[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xbc67('0x0'));var util=require('util');var moment=require(_0xbc67('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc67('0x2'));var fs=require('fs');var Redis=require(_0xbc67('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc67('0x4'));var logger=require(_0xbc67('0x5'))(_0xbc67('0x6'));var config=require(_0xbc67('0x7'));var jayson=require(_0xbc67('0x8'));var client=jayson[_0xbc67('0x9')][_0xbc67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44f449,_0x162812,_0x1e28f8){return new BPromise(function(_0x1f9fdf,_0x2eedd1){return client[_0xbc67('0xb')](_0x44f449,_0x1e28f8)[_0xbc67('0xc')](function(_0x155e38){logger[_0xbc67('0xd')](_0xbc67('0xe'),_0x162812,'request\x20sent');logger[_0xbc67('0xf')](_0xbc67('0x10'),_0x162812,_0xbc67('0x11'),JSON['stringify'](_0x155e38));if(_0x155e38[_0xbc67('0x12')]){if(_0x155e38[_0xbc67('0x12')][_0xbc67('0x13')]===0x1f4){logger[_0xbc67('0x12')](_0xbc67('0xe'),_0x162812,_0x155e38[_0xbc67('0x12')]['message']);return _0x2eedd1(_0x155e38[_0xbc67('0x12')][_0xbc67('0x14')]);}logger[_0xbc67('0x12')](_0xbc67('0xe'),_0x162812,_0x155e38[_0xbc67('0x12')][_0xbc67('0x14')]);return _0x1f9fdf(_0x155e38[_0xbc67('0x12')][_0xbc67('0x14')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x162812,_0xbc67('0x11'));_0x1f9fdf(_0x155e38[_0xbc67('0x15')][_0xbc67('0x14')]);}})[_0xbc67('0x16')](function(_0xc57f0a){logger[_0xbc67('0x12')](_0xbc67('0xe'),_0x162812,_0xc57f0a);_0x2eedd1(_0xc57f0a);});});}
\ No newline at end of file
index c1afa14..1f0c6b8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5883=['INTEGER','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x5883,0xcd));var _0x3588=function(_0x4bd048,_0xe905a2){_0x4bd048=_0x4bd048-0x0;var _0x2f1e2b=_0x5883[_0x4bd048];return _0x2f1e2b;};'use strict';var Sequelize=require('sequelize');module[_0x3588('0x0')]={'UserId':{'type':Sequelize[_0x3588('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
+var _0x7d81=['exports','INTEGER'];(function(_0x4d21ff,_0x19d202){var _0x22b554=function(_0x4473c5){while(--_0x4473c5){_0x4d21ff['push'](_0x4d21ff['shift']());}};_0x22b554(++_0x19d202);}(_0x7d81,0xba));var _0x17d8=function(_0x55c632,_0x2e7b2b){_0x55c632=_0x55c632-0x0;var _0x204ede=_0x7d81[_0x55c632];return _0x204ede;};'use strict';var Sequelize=require('sequelize');module[_0x17d8('0x0')]={'UserId':{'type':Sequelize[_0x17d8('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
index 7683981..c17cdd4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xc23ff5,_0x5501b2){var _0x19f999=function(_0x18d643){while(--_0x18d643){_0xc23ff5['push'](_0xc23ff5['shift']());}};_0x19f999(++_0x5501b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x590794,_0x2cb866){var _0x5625d0=function(_0x33312f){while(--_0x33312f){_0x590794['push'](_0x590794['shift']());}};_0x5625d0(++_0x2cb866);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 95e8fa5..044698d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1edc87,_0x45b59f){var _0xf15ea3=function(_0xdc89d){while(--_0xdc89d){_0x1edc87['push'](_0x1edc87['shift']());}};_0xf15ea3(++_0x45b59f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router;
\ No newline at end of file
+var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4d477e,_0xc6d912){var _0x11cecf=function(_0x27e792){while(--_0x27e792){_0x4d477e['push'](_0x4d477e['shift']());}};_0x11cecf(++_0xc6d912);}(_0xedd9,0xfc));var _0x9edd=function(_0x414e4f,_0x18875f){_0x414e4f=_0x414e4f-0x0;var _0x10839f=_0xedd9[_0x414e4f];return _0x10839f;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router;
\ No newline at end of file
index c8ed30d..99e4965 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf40b=['INTEGER','exports'];(function(_0x4741bc,_0x58a612){var _0x218083=function(_0x30c413){while(--_0x30c413){_0x4741bc['push'](_0x4741bc['shift']());}};_0x218083(++_0x58a612);}(_0xf40b,0xfb));var _0xbf40=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0xf40b[_0x52e363];return _0x3fc2b5;};'use strict';var Sequelize=require('sequelize');module[_0xbf40('0x0')]={'penalty':{'type':Sequelize[_0xbf40('0x1')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x3ccc=['INTEGER','sequelize'];(function(_0x3d3594,_0x934517){var _0xfec859=function(_0xc26827){while(--_0xc26827){_0x3d3594['push'](_0x3d3594['shift']());}};_0xfec859(++_0x934517);}(_0x3ccc,0x1bb));var _0xc3cc=function(_0x3c62ef,_0x4bb6ab){_0x3c62ef=_0x3c62ef-0x0;var _0x4d44f1=_0x3ccc[_0x3c62ef];return _0x4d44f1;};'use strict';var Sequelize=require(_0xc3cc('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc3cc('0x1')],'defaultValue':0x0}};
\ No newline at end of file
index 80a002e..370df24 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8c79=['bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger'];(function(_0x37106d,_0x335821){var _0x357cf6=function(_0x468b31){while(--_0x468b31){_0x37106d['push'](_0x37106d['shift']());}};_0x357cf6(++_0x335821);}(_0x8c79,0x18e));var _0x98c7=function(_0x2977e8,_0x257939){_0x2977e8=_0x2977e8-0x0;var _0x9da807=_0x8c79[_0x2977e8];return _0x9da807;};'use strict';var _=require(_0x98c7('0x0'));var util=require('util');var logger=require(_0x98c7('0x1'))('api');var moment=require('moment');var BPromise=require(_0x98c7('0x2'));var rp=require(_0x98c7('0x3'));var fs=require('fs');var path=require(_0x98c7('0x4'));var rimraf=require(_0x98c7('0x5'));var config=require('../../config/environment');var attributes=require(_0x98c7('0x6'));module[_0x98c7('0x7')]=function(_0xfb92e1,_0x1a5f2e){return _0xfb92e1['define'](_0x98c7('0x8'),attributes,{'tableName':_0x98c7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xae2a=['../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x48fb30,_0x922c0c){var _0x2b5b99=function(_0x2a1799){while(--_0x2a1799){_0x48fb30['push'](_0x48fb30['shift']());}};_0x2b5b99(++_0x922c0c);}(_0xae2a,0x1e6));var _0xaae2=function(_0x246a25,_0x2c0c46){_0x246a25=_0x246a25-0x0;var _0x5996f4=_0xae2a[_0x246a25];return _0x5996f4;};'use strict';var _=require(_0xaae2('0x0'));var util=require(_0xaae2('0x1'));var logger=require(_0xaae2('0x2'))(_0xaae2('0x3'));var moment=require(_0xaae2('0x4'));var BPromise=require(_0xaae2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaae2('0x6'));var rimraf=require(_0xaae2('0x7'));var config=require(_0xaae2('0x8'));var attributes=require(_0xaae2('0x9'));module[_0xaae2('0xa')]=function(_0x43dac8,_0x1b0282){return _0x43dac8['define'](_0xaae2('0xb'),attributes,{'tableName':_0xaae2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ca85064..a5a0ce1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0d5d=['util','moment','../../config/utils','../../config/logger','rpc','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x3f9ea9,_0x19840d){var _0x291e7f=function(_0x8012b4){while(--_0x8012b4){_0x3f9ea9['push'](_0x3f9ea9['shift']());}};_0x291e7f(++_0x19840d);}(_0x0d5d,0x143));var _0xd0d5=function(_0x42dfd6,_0x22ae80){_0x42dfd6=_0x42dfd6-0x0;var _0xa3a455=_0x0d5d[_0x42dfd6];return _0xa3a455;};'use strict';var _=require(_0xd0d5('0x0'));var util=require(_0xd0d5('0x1'));var moment=require(_0xd0d5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd0d5('0x3'));var logger=require(_0xd0d5('0x4'))(_0xd0d5('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd0d5('0x6')][_0xd0d5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21f983,_0x28aa5d,_0x5bb395){return new BPromise(function(_0x2e3fcf,_0x604d3a){return client['request'](_0x21f983,_0x5bb395)[_0xd0d5('0x8')](function(_0x3e2893){logger[_0xd0d5('0x9')](_0xd0d5('0xa'),_0x28aa5d,'request\x20sent');logger[_0xd0d5('0xb')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x28aa5d,_0xd0d5('0xc'),JSON[_0xd0d5('0xd')](_0x3e2893));if(_0x3e2893['error']){if(_0x3e2893['error']['code']===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x28aa5d,_0x3e2893[_0xd0d5('0xe')][_0xd0d5('0xf')]);return _0x604d3a(_0x3e2893[_0xd0d5('0xe')]['message']);}logger[_0xd0d5('0xe')](_0xd0d5('0xa'),_0x28aa5d,_0x3e2893[_0xd0d5('0xe')][_0xd0d5('0xf')]);return _0x2e3fcf(_0x3e2893['error'][_0xd0d5('0xf')]);}else{logger['info'](_0xd0d5('0xa'),_0x28aa5d,_0xd0d5('0xc'));_0x2e3fcf(_0x3e2893[_0xd0d5('0x10')][_0xd0d5('0xf')]);}})[_0xd0d5('0x11')](function(_0x4efa19){logger[_0xd0d5('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x28aa5d,_0x4efa19);_0x604d3a(_0x4efa19);});});}
\ No newline at end of file
+var _0x3591=['rpc','../../config/environment','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x59b1cb,_0x585808){var _0x3d5dc4=function(_0x4b37d4){while(--_0x4b37d4){_0x59b1cb['push'](_0x59b1cb['shift']());}};_0x3d5dc4(++_0x585808);}(_0x3591,0x119));var _0x1359=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x3591[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x1359('0x0'));var util=require(_0x1359('0x1'));var moment=require(_0x1359('0x2'));var BPromise=require(_0x1359('0x3'));var rs=require(_0x1359('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1359('0x5'))['db'];var utils=require(_0x1359('0x6'));var logger=require('../../config/logger')(_0x1359('0x7'));var config=require(_0x1359('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1359('0x9')][_0x1359('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e75cc,_0x2f07b2,_0x2c9acf){return new BPromise(function(_0x494657,_0x4132be){return client[_0x1359('0xb')](_0x2e75cc,_0x2c9acf)[_0x1359('0xc')](function(_0x40fa1f){logger[_0x1359('0xd')](_0x1359('0xe'),_0x2f07b2,_0x1359('0xf'));logger[_0x1359('0x10')](_0x1359('0x11'),_0x2f07b2,_0x1359('0xf'),JSON[_0x1359('0x12')](_0x40fa1f));if(_0x40fa1f[_0x1359('0x13')]){if(_0x40fa1f['error'][_0x1359('0x14')]===0x1f4){logger[_0x1359('0x13')](_0x1359('0xe'),_0x2f07b2,_0x40fa1f['error'][_0x1359('0x15')]);return _0x4132be(_0x40fa1f[_0x1359('0x13')]['message']);}logger[_0x1359('0x13')](_0x1359('0xe'),_0x2f07b2,_0x40fa1f['error']['message']);return _0x494657(_0x40fa1f[_0x1359('0x13')]['message']);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x2f07b2,'request\x20sent');_0x494657(_0x40fa1f[_0x1359('0x16')][_0x1359('0x15')]);}})[_0x1359('0x17')](function(_0x2ac65a){logger['error'](_0x1359('0xe'),_0x2f07b2,_0x2ac65a);_0x4132be(_0x2ac65a);});});}
\ No newline at end of file
index 86e0d52..e3e9902 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2723fe,_0x130c60){var _0x2276b5=function(_0x28ff30){while(--_0x28ff30){_0x2723fe['push'](_0x2723fe['shift']());}};_0x2276b5(++_0x130c60);}(_0xe706,0xa3));var _0x6e70=function(_0x4ff939,_0x5f54ea){_0x4ff939=_0x4ff939-0x0;var _0x3f8ba8=_0xe706[_0x4ff939];return _0x3f8ba8;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router;
\ No newline at end of file
+var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4444ab,_0x3fc6ad){var _0x4d86e9=function(_0x33905c){while(--_0x33905c){_0x4444ab['push'](_0x4444ab['shift']());}};_0x4d86e9(++_0x3fc6ad);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router;
\ No newline at end of file
index d6b47b0..d43edd3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3edc=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x1da83d,_0x8d879e){var _0x57e9ff=function(_0x5144b7){while(--_0x5144b7){_0x1da83d['push'](_0x1da83d['shift']());}};_0x57e9ff(++_0x8d879e);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x305b81,_0x47c0cc){_0x305b81=_0x305b81-0x0;var _0x12e30b=_0x3edc[_0x305b81];return _0x12e30b;};'use strict';var Sequelize=require(_0xc3ed('0x0'));module[_0xc3ed('0x1')]={'uniqueid':{'type':Sequelize[_0xc3ed('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xc3ed('0x3')},'membername':{'type':Sequelize[_0xc3ed('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xc3ed('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc3ed('0x5'),'comment':_0xc3ed('0x3')},'VoiceQueueId':{'type':Sequelize[_0xc3ed('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xc3ed('0x4')],'allowNull':![],'unique':_0xc3ed('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xc3ed('0x2')](0xb),'defaultValue':0x0,'comment':_0xc3ed('0x3')},'paused':{'type':Sequelize[_0xc3ed('0x2')](0xb),'defaultValue':0x0,'comment':_0xc3ed('0x3')}};
\ No newline at end of file
+var _0x2c53=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2c53,0x17a));var _0x32c5=function(_0x224dda,_0x16d0f9){_0x224dda=_0x224dda-0x0;var _0x2987ac=_0x2c53[_0x224dda];return _0x2987ac;};'use strict';var Sequelize=require(_0x32c5('0x0'));module[_0x32c5('0x1')]={'uniqueid':{'type':Sequelize[_0x32c5('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x32c5('0x3')},'membername':{'type':Sequelize[_0x32c5('0x4')],'allowNull':![],'comment':_0x32c5('0x3')},'UserId':{'type':Sequelize[_0x32c5('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x32c5('0x4')],'allowNull':![],'unique':_0x32c5('0x5'),'comment':_0x32c5('0x3')},'VoiceQueueId':{'type':Sequelize[_0x32c5('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x32c5('0x4')],'allowNull':![],'unique':_0x32c5('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x32c5('0x2')](0xb),'defaultValue':0x0,'comment':_0x32c5('0x3')},'paused':{'type':Sequelize[_0x32c5('0x2')](0xb),'defaultValue':0x0,'comment':_0x32c5('0x3')}};
\ No newline at end of file
index 7525d89..0863423 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd894=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit'];(function(_0x13d94a,_0x28b3ae){var _0x2e68cd=function(_0x4f0ff8){while(--_0x4f0ff8){_0x13d94a['push'](_0x13d94a['shift']());}};_0x2e68cd(++_0x28b3ae);}(_0xd894,0xde));var _0x4d89=function(_0xa3de91,_0x404116){_0xa3de91=_0xa3de91-0x0;var _0x37c549=_0xd894[_0xa3de91];return _0x37c549;};'use strict';var EventEmitter=require(_0x4d89('0x0'));var UserVoiceQueueRt=require(_0x4d89('0x1'))['db'][_0x4d89('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x4d89('0x3')](0x0);var events={'afterCreate':_0x4d89('0x4'),'afterUpdate':_0x4d89('0x5'),'afterDestroy':_0x4d89('0x6')};function emitEvent(_0x297b45){return function(_0x38f8db,_0x33dae7,_0x3ab2a6){UserVoiceQueueRtEvents[_0x4d89('0x7')](_0x297b45+':'+_0x38f8db['id'],_0x38f8db);UserVoiceQueueRtEvents['emit'](_0x297b45,_0x38f8db);_0x3ab2a6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x4d89('0x8')](e,emitEvent(event));}}module[_0x4d89('0x9')]=UserVoiceQueueRtEvents;
\ No newline at end of file
+var _0x6cbc=['emit','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove'];(function(_0x5cabb7,_0x2206e0){var _0xf50f40=function(_0xf2449d){while(--_0xf2449d){_0x5cabb7['push'](_0x5cabb7['shift']());}};_0xf50f40(++_0x2206e0);}(_0x6cbc,0x1c3));var _0xc6cb=function(_0x2e6b3d,_0x5226b4){_0x2e6b3d=_0x2e6b3d-0x0;var _0x5b3306=_0x6cbc[_0x2e6b3d];return _0x5b3306;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xc6cb('0x0'))['db'][_0xc6cb('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc6cb('0x2')](0x0);var events={'afterCreate':_0xc6cb('0x3'),'afterUpdate':'update','afterDestroy':_0xc6cb('0x4')};function emitEvent(_0x73879a){return function(_0x478aaf,_0x3e1f45,_0x90f5a3){UserVoiceQueueRtEvents[_0xc6cb('0x5')](_0x73879a+':'+_0x478aaf['id'],_0x478aaf);UserVoiceQueueRtEvents[_0xc6cb('0x5')](_0x73879a,_0x478aaf);_0x90f5a3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xc6cb('0x6')](e,emitEvent(event));}}module[_0xc6cb('0x7')]=UserVoiceQueueRtEvents;
\ No newline at end of file
index 820ee0d..7c7a8b8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x09c6=['request-promise','../../config/environment','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x09c6,0xd8));var _0x609c=function(_0x2b8142,_0x41ca2c){_0x2b8142=_0x2b8142-0x0;var _0x3d83a0=_0x09c6[_0x2b8142];return _0x3d83a0;};'use strict';var _=require(_0x609c('0x0'));var util=require(_0x609c('0x1'));var logger=require(_0x609c('0x2'))(_0x609c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x609c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x609c('0x5'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x609c('0x6')]=function(_0x4950ca,_0x1c9ed6){return _0x4950ca[_0x609c('0x7')](_0x609c('0x8'),attributes,{'tableName':_0x609c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x0cba=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0x0cba,0x1d9));var _0xa0cb=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0x0cba[_0x4409e7];return _0x24c751;};'use strict';var _=require('lodash');var util=require(_0xa0cb('0x0'));var logger=require('../../config/logger')(_0xa0cb('0x1'));var moment=require(_0xa0cb('0x2'));var BPromise=require(_0xa0cb('0x3'));var rp=require(_0xa0cb('0x4'));var fs=require('fs');var path=require(_0xa0cb('0x5'));var rimraf=require(_0xa0cb('0x6'));var config=require(_0xa0cb('0x7'));var attributes=require(_0xa0cb('0x8'));module[_0xa0cb('0x9')]=function(_0x47ca03,_0x43b462){return _0x47ca03[_0xa0cb('0xa')](_0xa0cb('0xb'),attributes,{'tableName':_0xa0cb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index e287f1f..632b44f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8d07=['lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','outboundQueuePauses'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8d07,0x110));var _0x78d0=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x8d07[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x78d0('0x0'));var util=require(_0x78d0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x78d0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78d0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x78d0('0x4'))(_0x78d0('0x5'));var config=require(_0x78d0('0x6'));var jayson=require(_0x78d0('0x7'));var client=jayson[_0x78d0('0x8')][_0x78d0('0x9')]({'port':0x232a});config[_0x78d0('0xa')]=_[_0x78d0('0xb')](config[_0x78d0('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x78d0('0xc'))(new Redis(config[_0x78d0('0xa')]));require(_0x78d0('0xd'))['register'](socket);function respondWithRpcPromise(_0x2be637,_0x5f3418,_0x3ec2eb){return new BPromise(function(_0x3a0b05,_0x2d2a2f){return client['request'](_0x2be637,_0x3ec2eb)['then'](function(_0x17f39c){logger[_0x78d0('0xe')](_0x78d0('0xf'),_0x5f3418,_0x78d0('0x10'));logger[_0x78d0('0x11')](_0x78d0('0x12'),_0x5f3418,'request\x20sent',JSON[_0x78d0('0x13')](_0x17f39c));if(_0x17f39c[_0x78d0('0x14')]){if(_0x17f39c[_0x78d0('0x14')][_0x78d0('0x15')]===0x1f4){logger[_0x78d0('0x14')](_0x78d0('0xf'),_0x5f3418,_0x17f39c[_0x78d0('0x14')]['message']);return _0x2d2a2f(_0x17f39c[_0x78d0('0x14')][_0x78d0('0x16')]);}logger[_0x78d0('0x14')](_0x78d0('0xf'),_0x5f3418,_0x17f39c['error']['message']);return _0x3a0b05(_0x17f39c[_0x78d0('0x14')][_0x78d0('0x16')]);}else{logger[_0x78d0('0xe')](_0x78d0('0xf'),_0x5f3418,_0x78d0('0x10'));_0x3a0b05(_0x17f39c[_0x78d0('0x17')]['message']);}})[_0x78d0('0x18')](function(_0x19bdfc){logger[_0x78d0('0x14')](_0x78d0('0xf'),_0x5f3418,_0x19bdfc);_0x2d2a2f(_0x19bdfc);});});}exports[_0x78d0('0x19')]=function(_0x1eac50){var _0x497ae5=this;return new Promise(function(_0x5cdddf,_0x56fc4b){return db[_0x78d0('0x1a')][_0x78d0('0x1b')]({'raw':_0x1eac50[_0x78d0('0x1c')]?_0x1eac50[_0x78d0('0x1c')][_0x78d0('0x1d')]===undefined?!![]:![]:!![],'where':_0x1eac50[_0x78d0('0x1c')]?_0x1eac50[_0x78d0('0x1c')]['where']||null:null,'attributes':[[db[_0x78d0('0x1e')]['fn'](_0x78d0('0x1f'),db[_0x78d0('0x1e')]['fn']('IF',db['sequelize'][_0x78d0('0x20')]('`paused`\x20=\x201,\x201,\x20null'))),_0x78d0('0x21')]]})['then'](function(_0x19b85e){logger[_0x78d0('0xe')](_0x78d0('0x19'),_0x1eac50);logger['debug'](_0x78d0('0x19'),_0x1eac50,JSON[_0x78d0('0x13')](_0x19b85e));_0x5cdddf(_0x19b85e);})[_0x78d0('0x18')](function(_0x5d0d5d){logger[_0x78d0('0x14')]('GetVoiceQueueRtPauses',_0x5d0d5d['message'],_0x1eac50);_0x56fc4b(_0x497ae5[_0x78d0('0x14')](0x1f4,_0x5d0d5d[_0x78d0('0x16')]));});});};
\ No newline at end of file
+var _0x45fb=['error','code','message','result','catch','GetVoiceQueueRtPauses','options','where','sequelize','COUNT','outboundQueuePauses','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','socket.io-emitter','redis','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent'];(function(_0x131fab,_0x147cf5){var _0x31b66e=function(_0x72462b){while(--_0x72462b){_0x131fab['push'](_0x131fab['shift']());}};_0x31b66e(++_0x147cf5);}(_0x45fb,0x136));var _0xb45f=function(_0x34bfda,_0x1cda3a){_0x34bfda=_0x34bfda-0x0;var _0x464d22=_0x45fb[_0x34bfda];return _0x464d22;};'use strict';var _=require(_0xb45f('0x0'));var util=require(_0xb45f('0x1'));var moment=require(_0xb45f('0x2'));var BPromise=require(_0xb45f('0x3'));var rs=require(_0xb45f('0x4'));var fs=require('fs');var Redis=require(_0xb45f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb45f('0x6'));var logger=require(_0xb45f('0x7'))(_0xb45f('0x8'));var config=require(_0xb45f('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb45f('0xa')]({'port':0x232a});config['redis']=_[_0xb45f('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb45f('0xc'))(new Redis(config[_0xb45f('0xd')]));require(_0xb45f('0xe'))[_0xb45f('0xf')](socket);function respondWithRpcPromise(_0x5044fd,_0x94214e,_0x3e98f8){return new BPromise(function(_0x593dc1,_0x331789){return client['request'](_0x5044fd,_0x3e98f8)[_0xb45f('0x10')](function(_0x119191){logger[_0xb45f('0x11')](_0xb45f('0x12'),_0x94214e,_0xb45f('0x13'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x94214e,_0xb45f('0x13'),JSON['stringify'](_0x119191));if(_0x119191[_0xb45f('0x14')]){if(_0x119191[_0xb45f('0x14')][_0xb45f('0x15')]===0x1f4){logger['error'](_0xb45f('0x12'),_0x94214e,_0x119191['error'][_0xb45f('0x16')]);return _0x331789(_0x119191[_0xb45f('0x14')][_0xb45f('0x16')]);}logger[_0xb45f('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x94214e,_0x119191[_0xb45f('0x14')]['message']);return _0x593dc1(_0x119191[_0xb45f('0x14')]['message']);}else{logger[_0xb45f('0x11')](_0xb45f('0x12'),_0x94214e,_0xb45f('0x13'));_0x593dc1(_0x119191[_0xb45f('0x17')][_0xb45f('0x16')]);}})[_0xb45f('0x18')](function(_0x48cdad){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x94214e,_0x48cdad);_0x331789(_0x48cdad);});});}exports[_0xb45f('0x19')]=function(_0x2ce625){var _0x396fc8=this;return new Promise(function(_0x49959b,_0x5a94d8){return db['UserVoiceQueueRt']['findAll']({'raw':_0x2ce625[_0xb45f('0x1a')]?_0x2ce625['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ce625[_0xb45f('0x1a')]?_0x2ce625[_0xb45f('0x1a')][_0xb45f('0x1b')]||null:null,'attributes':[[db[_0xb45f('0x1c')]['fn'](_0xb45f('0x1d'),db[_0xb45f('0x1c')]['fn']('IF',db[_0xb45f('0x1c')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xb45f('0x1e')]]})[_0xb45f('0x10')](function(_0x1dc821){logger[_0xb45f('0x11')]('GetVoiceQueueRtPauses',_0x2ce625);logger[_0xb45f('0x1f')](_0xb45f('0x19'),_0x2ce625,JSON[_0xb45f('0x20')](_0x1dc821));_0x49959b(_0x1dc821);})['catch'](function(_0x5943ed){logger[_0xb45f('0x14')](_0xb45f('0x19'),_0x5943ed[_0xb45f('0x16')],_0x2ce625);_0x5a94d8(_0x396fc8[_0xb45f('0x14')](0x1f4,_0x5943ed[_0xb45f('0x16')]));});});};
\ No newline at end of file
index c8c98eb..6291ac9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf961=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xf961,0x1cf));var _0x1f96=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xf961[_0x173441];return _0x2423a8;};'use strict';var UserVoiceQueueRtEvents=require(_0x1f96('0x0'));var events=[_0x1f96('0x1'),_0x1f96('0x2'),_0x1f96('0x3')];function createListener(_0x5f426a,_0x1174c8){return function(_0x1dc85a){_0x1174c8[_0x1f96('0x4')](_0x5f426a,_0x1dc85a);};}function removeListener(_0x4abe82,_0x3d032b){return function(){UserVoiceQueueRtEvents[_0x1f96('0x5')](_0x4abe82,_0x3d032b);};}exports[_0x1f96('0x6')]=function(_0x518062){for(var _0x40caad=0x0,_0x53e4d1=events[_0x1f96('0x7')];_0x40caad<_0x53e4d1;_0x40caad++){var _0x3244f8=events[_0x40caad];var _0x896b25=createListener(_0x1f96('0x8')+_0x3244f8,_0x518062);UserVoiceQueueRtEvents['on'](_0x3244f8,_0x896b25);}};
\ No newline at end of file
+var _0x6808=['length','./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register'];(function(_0x158e96,_0x870126){var _0x2ae1ae=function(_0x1d0e1f){while(--_0x1d0e1f){_0x158e96['push'](_0x158e96['shift']());}};_0x2ae1ae(++_0x870126);}(_0x6808,0xd1));var _0x8680=function(_0x1f9862,_0x2a5d0e){_0x1f9862=_0x1f9862-0x0;var _0x38c059=_0x6808[_0x1f9862];return _0x38c059;};'use strict';var UserVoiceQueueRtEvents=require(_0x8680('0x0'));var events=[_0x8680('0x1'),_0x8680('0x2'),_0x8680('0x3')];function createListener(_0x3d6fba,_0x2faa36){return function(_0x3d9cad){_0x2faa36[_0x8680('0x4')](_0x3d6fba,_0x3d9cad);};}function removeListener(_0x5a5ee3,_0x22e236){return function(){UserVoiceQueueRtEvents[_0x8680('0x5')](_0x5a5ee3,_0x22e236);};}exports[_0x8680('0x6')]=function(_0x34d05e){for(var _0x44175c=0x0,_0x5ea2c7=events[_0x8680('0x7')];_0x44175c<_0x5ea2c7;_0x44175c++){var _0x1b8e2c=events[_0x44175c];var _0x4d7b13=createListener('userVoiceQueueRt:'+_0x1b8e2c,_0x34d05e);UserVoiceQueueRtEvents['on'](_0x1b8e2c,_0x4d7b13);}};
\ No newline at end of file
index 7883262..111e43f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x50ab95,_0x480438){var _0x2c62cd=function(_0x2af369){while(--_0x2af369){_0x50ab95['push'](_0x50ab95['shift']());}};_0x2c62cd(++_0x480438);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router;
\ No newline at end of file
+var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3844d1,_0x3f751f){var _0x5c8b23=function(_0x5e1e3e){while(--_0x5e1e3e){_0x3844d1['push'](_0x3844d1['shift']());}};_0x5c8b23(++_0x3f751f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router;
\ No newline at end of file
index a3a37d8..8335678 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb2d5=['sequelize','INTEGER'];(function(_0x321059,_0x29a023){var _0x8487b4=function(_0x19d5f9){while(--_0x19d5f9){_0x321059['push'](_0x321059['shift']());}};_0x8487b4(++_0x29a023);}(_0xb2d5,0x11c));var _0x5b2d=function(_0x8270d4,_0x429f48){_0x8270d4=_0x8270d4-0x0;var _0x333b07=_0xb2d5[_0x8270d4];return _0x333b07;};'use strict';var Sequelize=require(_0x5b2d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x5b2d('0x1')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x0b8d=['INTEGER','exports'];(function(_0x58b6c7,_0x3bf35e){var _0x5f50d0=function(_0x532e10){while(--_0x532e10){_0x58b6c7['push'](_0x58b6c7['shift']());}};_0x5f50d0(++_0x3bf35e);}(_0x0b8d,0x195));var _0xd0b8=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x0b8d[_0x28aea5];return _0x6a55f9;};'use strict';var Sequelize=require('sequelize');module[_0xd0b8('0x0')]={'penalty':{'type':Sequelize[_0xd0b8('0x1')],'defaultValue':0x0}};
\ No newline at end of file
index 69e35bd..9e0d335 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3ed7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash'];(function(_0x5a2a10,_0x2fc26a){var _0x13bc04=function(_0x54503c){while(--_0x54503c){_0x5a2a10['push'](_0x5a2a10['shift']());}};_0x13bc04(++_0x2fc26a);}(_0x3ed7,0xe9));var _0x73ed=function(_0x5d38c7,_0x434c74){_0x5d38c7=_0x5d38c7-0x0;var _0x1328f9=_0x3ed7[_0x5d38c7];return _0x1328f9;};'use strict';var _=require(_0x73ed('0x0'));var util=require(_0x73ed('0x1'));var logger=require(_0x73ed('0x2'))(_0x73ed('0x3'));var moment=require(_0x73ed('0x4'));var BPromise=require(_0x73ed('0x5'));var rp=require(_0x73ed('0x6'));var fs=require('fs');var path=require(_0x73ed('0x7'));var rimraf=require(_0x73ed('0x8'));var config=require(_0x73ed('0x9'));var attributes=require('./userWhatsappQueue.attributes');module[_0x73ed('0xa')]=function(_0x377bcc,_0x2fb9af){return _0x377bcc['define'](_0x73ed('0xb'),attributes,{'tableName':_0x73ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xbac5=['exports','UserWhatsappQueue','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x487512,_0x3e4e4e){var _0x10e83e=function(_0x307845){while(--_0x307845){_0x487512['push'](_0x487512['shift']());}};_0x10e83e(++_0x3e4e4e);}(_0xbac5,0x1ba));var _0x5bac=function(_0x4f2d40,_0x2b76f8){_0x4f2d40=_0x4f2d40-0x0;var _0x227027=_0xbac5[_0x4f2d40];return _0x227027;};'use strict';var _=require(_0x5bac('0x0'));var util=require(_0x5bac('0x1'));var logger=require('../../config/logger')(_0x5bac('0x2'));var moment=require('moment');var BPromise=require(_0x5bac('0x3'));var rp=require(_0x5bac('0x4'));var fs=require('fs');var path=require(_0x5bac('0x5'));var rimraf=require(_0x5bac('0x6'));var config=require(_0x5bac('0x7'));var attributes=require(_0x5bac('0x8'));module[_0x5bac('0x9')]=function(_0x5ca4c8,_0x18f04c){return _0x5ca4c8['define'](_0x5bac('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 0dee2d0..a6866e9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x794d=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x112e2a,_0x273570){var _0x1e3cf1=function(_0x46deb3){while(--_0x46deb3){_0x112e2a['push'](_0x112e2a['shift']());}};_0x1e3cf1(++_0x273570);}(_0x794d,0x173));var _0xd794=function(_0x3b3750,_0x28f3b8){_0x3b3750=_0x3b3750-0x0;var _0x1b9e8b=_0x794d[_0x3b3750];return _0x1b9e8b;};'use strict';var _=require(_0xd794('0x0'));var util=require(_0xd794('0x1'));var moment=require(_0xd794('0x2'));var BPromise=require(_0xd794('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd794('0x4'));var db=require(_0xd794('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd794('0x6'))(_0xd794('0x7'));var config=require(_0xd794('0x8'));var jayson=require(_0xd794('0x9'));var client=jayson[_0xd794('0xa')][_0xd794('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x390ce7,_0x227ce9,_0x173860){return new BPromise(function(_0x3ee0c1,_0x530c25){return client['request'](_0x390ce7,_0x173860)[_0xd794('0xc')](function(_0x1c273e){logger[_0xd794('0xd')](_0xd794('0xe'),_0x227ce9,_0xd794('0xf'));logger[_0xd794('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x227ce9,_0xd794('0xf'),JSON[_0xd794('0x11')](_0x1c273e));if(_0x1c273e[_0xd794('0x12')]){if(_0x1c273e[_0xd794('0x12')]['code']===0x1f4){logger[_0xd794('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x227ce9,_0x1c273e[_0xd794('0x12')][_0xd794('0x13')]);return _0x530c25(_0x1c273e[_0xd794('0x12')][_0xd794('0x13')]);}logger[_0xd794('0x12')](_0xd794('0xe'),_0x227ce9,_0x1c273e[_0xd794('0x12')][_0xd794('0x13')]);return _0x3ee0c1(_0x1c273e[_0xd794('0x12')][_0xd794('0x13')]);}else{logger['info'](_0xd794('0xe'),_0x227ce9,'request\x20sent');_0x3ee0c1(_0x1c273e[_0xd794('0x14')][_0xd794('0x13')]);}})[_0xd794('0x15')](function(_0x367516){logger[_0xd794('0x12')](_0xd794('0xe'),_0x227ce9,_0x367516);_0x530c25(_0x367516);});});}
\ No newline at end of file
+var _0x4816=['UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x26bb1d,_0x36f80d){var _0x31a0e7=function(_0x48bc1e){while(--_0x48bc1e){_0x26bb1d['push'](_0x26bb1d['shift']());}};_0x31a0e7(++_0x36f80d);}(_0x4816,0x76));var _0x6481=function(_0x3c6835,_0x952d5c){_0x3c6835=_0x3c6835-0x0;var _0x1adeb9=_0x4816[_0x3c6835];return _0x1adeb9;};'use strict';var _=require('lodash');var util=require(_0x6481('0x0'));var moment=require(_0x6481('0x1'));var BPromise=require(_0x6481('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6481('0x3'));var db=require(_0x6481('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6481('0x5'))(_0x6481('0x6'));var config=require(_0x6481('0x7'));var jayson=require(_0x6481('0x8'));var client=jayson[_0x6481('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28900f,_0x504f58,_0xd39fba){return new BPromise(function(_0x42d6d3,_0xd6ae4c){return client[_0x6481('0xa')](_0x28900f,_0xd39fba)[_0x6481('0xb')](function(_0x34293e){logger[_0x6481('0xc')](_0x6481('0xd'),_0x504f58,'request\x20sent');logger['debug'](_0x6481('0xe'),_0x504f58,_0x6481('0xf'),JSON[_0x6481('0x10')](_0x34293e));if(_0x34293e['error']){if(_0x34293e[_0x6481('0x11')][_0x6481('0x12')]===0x1f4){logger[_0x6481('0x11')](_0x6481('0xd'),_0x504f58,_0x34293e[_0x6481('0x11')]['message']);return _0xd6ae4c(_0x34293e[_0x6481('0x11')][_0x6481('0x13')]);}logger[_0x6481('0x11')](_0x6481('0xd'),_0x504f58,_0x34293e['error'][_0x6481('0x13')]);return _0x42d6d3(_0x34293e[_0x6481('0x11')][_0x6481('0x13')]);}else{logger[_0x6481('0xc')](_0x6481('0xd'),_0x504f58,_0x6481('0xf'));_0x42d6d3(_0x34293e[_0x6481('0x14')][_0x6481('0x13')]);}})[_0x6481('0x15')](function(_0x73c4dc){logger[_0x6481('0x11')](_0x6481('0xd'),_0x504f58,_0x73c4dc);_0xd6ae4c(_0x73c4dc);});});}
\ No newline at end of file
index 4230bdd..8237597 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9649=['index','/:id','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./variable.controller','get','isAuthenticated'];(function(_0x3bd1bd,_0x4a6a33){var _0x46bca6=function(_0x585022){while(--_0x585022){_0x3bd1bd['push'](_0x3bd1bd['shift']());}};_0x46bca6(++_0x4a6a33);}(_0x9649,0x19f));var _0x9964=function(_0x495ea5,_0x28dc62){_0x495ea5=_0x495ea5-0x0;var _0x5be805=_0x9649[_0x495ea5];return _0x5be805;};'use strict';var multer=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var path=require(_0x9964('0x2'));var timeout=require(_0x9964('0x3'));var express=require('express');var router=express[_0x9964('0x4')]();var fs_extra=require(_0x9964('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9964('0x6'));var config=require('../../config/environment');var controller=require(_0x9964('0x7'));router[_0x9964('0x8')]('/',auth[_0x9964('0x9')](),controller[_0x9964('0xa')]);router[_0x9964('0x8')](_0x9964('0xb'),auth[_0x9964('0x9')](),controller['show']);router[_0x9964('0xc')]('/',auth[_0x9964('0x9')](),controller['create']);router[_0x9964('0xd')](_0x9964('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9964('0xe')](_0x9964('0xb'),auth[_0x9964('0x9')](),controller[_0x9964('0xf')]);module[_0x9964('0x10')]=router;
\ No newline at end of file
+var _0x9181=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4429d0,_0x3d1d3d){var _0x20e40d=function(_0x17d873){while(--_0x17d873){_0x4429d0['push'](_0x4429d0['shift']());}};_0x20e40d(++_0x3d1d3d);}(_0x9181,0x182));var _0x1918=function(_0x2b4ce9,_0x5d429d){_0x2b4ce9=_0x2b4ce9-0x0;var _0x3ce2ec=_0x9181[_0x2b4ce9];return _0x3ce2ec;};'use strict';var multer=require(_0x1918('0x0'));var util=require(_0x1918('0x1'));var path=require(_0x1918('0x2'));var timeout=require(_0x1918('0x3'));var express=require(_0x1918('0x4'));var router=express['Router']();var fs_extra=require(_0x1918('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1918('0x6'));var config=require(_0x1918('0x7'));var controller=require(_0x1918('0x8'));router[_0x1918('0x9')]('/',auth[_0x1918('0xa')](),controller[_0x1918('0xb')]);router['get'](_0x1918('0xc'),auth['isAuthenticated'](),controller[_0x1918('0xd')]);router['post']('/',auth[_0x1918('0xa')](),controller[_0x1918('0xe')]);router[_0x1918('0xf')](_0x1918('0xc'),auth[_0x1918('0xa')](),controller[_0x1918('0x10')]);router[_0x1918('0x11')](_0x1918('0xc'),auth[_0x1918('0xa')](),controller[_0x1918('0x12')]);module[_0x1918('0x13')]=router;
\ No newline at end of file
index 52582f1..5c76b2c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf7b3=['STRING','name','sequelize','exports'];(function(_0x1da217,_0x54e012){var _0x5bd377=function(_0x431b1a){while(--_0x431b1a){_0x1da217['push'](_0x1da217['shift']());}};_0x5bd377(++_0x54e012);}(_0xf7b3,0x112));var _0x3f7b=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0xf7b3[_0x4d8dc3];return _0x9b03d9;};'use strict';var Sequelize=require(_0x3f7b('0x0'));module[_0x3f7b('0x1')]={'name':{'type':Sequelize[_0x3f7b('0x2')],'unique':_0x3f7b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3f7b('0x2')]}};
\ No newline at end of file
+var _0x2e0a=['exports','STRING','name','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2e0a,0xa3));var _0xa2e0=function(_0x1a6d7a,_0x81f9d5){_0x1a6d7a=_0x1a6d7a-0x0;var _0x1ac8e1=_0x2e0a[_0x1a6d7a];return _0x1ac8e1;};'use strict';var Sequelize=require(_0xa2e0('0x0'));module[_0xa2e0('0x1')]={'name':{'type':Sequelize[_0xa2e0('0x2')],'unique':_0xa2e0('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa2e0('0x2')]}};
\ No newline at end of file
index 3635fc6..1df51c2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f36=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash'];(function(_0x8a0434,_0x48a60c){var _0x33c64f=function(_0x417a25){while(--_0x417a25){_0x8a0434['push'](_0x8a0434['shift']());}};_0x33c64f(++_0x48a60c);}(_0x2f36,0xa1));var _0x62f3=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x2f36[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0x62f3('0x0'));var rimraf=require(_0x62f3('0x1'));var zipdir=require(_0x62f3('0x2'));var jsonpatch=require(_0x62f3('0x3'));var rp=require('request-promise');var moment=require(_0x62f3('0x4'));var BPromise=require(_0x62f3('0x5'));var Mustache=require('mustache');var util=require(_0x62f3('0x6'));var path=require(_0x62f3('0x7'));var sox=require('sox');var csv=require(_0x62f3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x62f3('0x9'));var _=require(_0x62f3('0xa'));var squel=require(_0x62f3('0xb'));var crypto=require(_0x62f3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x62f3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x62f3('0xe'));var Papa=require(_0x62f3('0xf'));var Redis=require(_0x62f3('0x10'));var authService=require(_0x62f3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x62f3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x62f3('0x13'));var utils=require(_0x62f3('0x14'));var config=require(_0x62f3('0x15'));var licenseUtil=require(_0x62f3('0x16'));var db=require(_0x62f3('0x17'))['db'];function respondWithStatusCode(_0xf48a2,_0x5f4030){_0x5f4030=_0x5f4030||0xcc;return function(_0x57d945){if(_0x57d945){return _0xf48a2[_0x62f3('0x18')](_0x5f4030);}return _0xf48a2[_0x62f3('0x19')](_0x5f4030)[_0x62f3('0x1a')]();};}function respondWithResult(_0x44f972,_0x148621){_0x148621=_0x148621||0xc8;return function(_0x1f5ed3){if(_0x1f5ed3){return _0x44f972[_0x62f3('0x19')](_0x148621)[_0x62f3('0x1b')](_0x1f5ed3);}};}function respondWithFilteredResult(_0x175182,_0x4b6432){return function(_0x3d5586){if(_0x3d5586){var _0x514b2e=typeof _0x4b6432['offset']===_0x62f3('0x1c')&&typeof _0x4b6432[_0x62f3('0x1d')]===_0x62f3('0x1c');var _0x37e4b5=_0x3d5586[_0x62f3('0x1e')];var _0x1b213e=_0x514b2e?0x0:_0x4b6432[_0x62f3('0x1f')];var _0x1b9a63=_0x514b2e?_0x3d5586[_0x62f3('0x1e')]:_0x4b6432[_0x62f3('0x1f')]+_0x4b6432[_0x62f3('0x1d')];var _0x2f21ed;if(_0x1b9a63>=_0x37e4b5){_0x1b9a63=_0x37e4b5;_0x2f21ed=0xc8;}else{_0x2f21ed=0xce;}_0x175182[_0x62f3('0x19')](_0x2f21ed);return _0x175182[_0x62f3('0x20')]('Content-Range',_0x1b213e+'-'+_0x1b9a63+'/'+_0x37e4b5)[_0x62f3('0x1b')](_0x3d5586);}return null;};}function patchUpdates(_0x4a2e1b){return function(_0x40f029){try{jsonpatch[_0x62f3('0x21')](_0x40f029,_0x4a2e1b,!![]);}catch(_0x389aca){return BPromise[_0x62f3('0x22')](_0x389aca);}return _0x40f029[_0x62f3('0x23')]();};}function saveUpdates(_0x159b35,_0x1ce922){return function(_0x165936){if(_0x165936){return _0x165936[_0x62f3('0x24')](_0x159b35)[_0x62f3('0x25')](function(_0x273b8a){return _0x273b8a;});}return null;};}function removeEntity(_0x16b2c2,_0x1c812f){return function(_0x45f515){if(_0x45f515){return _0x45f515[_0x62f3('0x26')]()[_0x62f3('0x25')](function(){var _0x39ce09=_0x45f515[_0x62f3('0x27')]({'plain':!![]});var _0x1526cd=_0x62f3('0x28');return db[_0x62f3('0x29')][_0x62f3('0x26')]({'where':{'type':_0x1526cd,'resourceId':_0x39ce09['id']}})[_0x62f3('0x25')](function(){return _0x45f515;});})['then'](function(){_0x16b2c2[_0x62f3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4107e6,_0x5de5a7){return function(_0x1becb0){if(!_0x1becb0){_0x4107e6[_0x62f3('0x18')](0x194);}return _0x1becb0;};}function handleError(_0x305085,_0x175d74){_0x175d74=_0x175d74||0x1f4;return function(_0x4eb8c4){logger[_0x62f3('0x2a')](_0x4eb8c4[_0x62f3('0x2b')]);if(_0x4eb8c4[_0x62f3('0x2c')]){delete _0x4eb8c4[_0x62f3('0x2c')];}_0x305085[_0x62f3('0x19')](_0x175d74)['send'](_0x4eb8c4);};}exports[_0x62f3('0x2d')]=function(_0x55a90,_0x402064){var _0x5e9c6a={},_0x1cdccc={},_0x2a409c={'count':0x0,'rows':[]};var _0x2bf773=_[_0x62f3('0x2e')](db[_0x62f3('0x2f')][_0x62f3('0x30')],function(_0x3770b2){return{'name':_0x3770b2[_0x62f3('0x31')],'type':_0x3770b2[_0x62f3('0x32')][_0x62f3('0x33')]};});_0x1cdccc[_0x62f3('0x34')]=_['map'](_0x2bf773,_0x62f3('0x2c'));_0x1cdccc[_0x62f3('0x35')]=_[_0x62f3('0x36')](_0x55a90[_0x62f3('0x35')]);_0x1cdccc[_0x62f3('0x37')]=_[_0x62f3('0x38')](_0x1cdccc[_0x62f3('0x34')],_0x1cdccc[_0x62f3('0x35')]);_0x5e9c6a[_0x62f3('0x39')]=_[_0x62f3('0x38')](_0x1cdccc[_0x62f3('0x34')],qs[_0x62f3('0x3a')](_0x55a90[_0x62f3('0x35')][_0x62f3('0x3a')]));_0x5e9c6a[_0x62f3('0x39')]=_0x5e9c6a[_0x62f3('0x39')][_0x62f3('0x3b')]?_0x5e9c6a[_0x62f3('0x39')]:_0x1cdccc['model'];if(!_0x55a90[_0x62f3('0x35')][_0x62f3('0x3c')](_0x62f3('0x3d'))){_0x5e9c6a[_0x62f3('0x1d')]=qs['limit'](_0x55a90['query'][_0x62f3('0x1d')]);_0x5e9c6a['offset']=qs[_0x62f3('0x1f')](_0x55a90[_0x62f3('0x35')][_0x62f3('0x1f')]);}_0x5e9c6a[_0x62f3('0x3e')]=qs[_0x62f3('0x3f')](_0x55a90[_0x62f3('0x35')]['sort']);_0x5e9c6a['where']=qs[_0x62f3('0x37')](_[_0x62f3('0x40')](_0x55a90[_0x62f3('0x35')],_0x1cdccc['filters']),_0x2bf773);if(_0x55a90[_0x62f3('0x35')][_0x62f3('0x41')]){_0x5e9c6a[_0x62f3('0x42')]=_['merge'](_0x5e9c6a[_0x62f3('0x42')],{'$or':_[_0x62f3('0x2e')](_0x2bf773,function(_0x44ff40){if(_0x44ff40[_0x62f3('0x32')]!==_0x62f3('0x43')){var _0x11cb30={};_0x11cb30[_0x44ff40[_0x62f3('0x2c')]]={'$like':'%'+_0x55a90['query'][_0x62f3('0x41')]+'%'};return _0x11cb30;}})});}_0x5e9c6a=_[_0x62f3('0x44')]({},_0x5e9c6a,_0x55a90[_0x62f3('0x45')]);var _0x4bbfdd={'where':_0x5e9c6a[_0x62f3('0x42')]};return db[_0x62f3('0x2f')][_0x62f3('0x1e')](_0x4bbfdd)['then'](function(_0x21e35e){_0x2a409c[_0x62f3('0x1e')]=_0x21e35e;if(_0x55a90[_0x62f3('0x35')][_0x62f3('0x46')]){_0x5e9c6a[_0x62f3('0x47')]=[{'all':!![]}];}return db[_0x62f3('0x2f')][_0x62f3('0x48')](_0x5e9c6a);})[_0x62f3('0x25')](function(_0x4eab2c){_0x2a409c[_0x62f3('0x49')]=_0x4eab2c;return _0x2a409c;})[_0x62f3('0x25')](respondWithFilteredResult(_0x402064,_0x5e9c6a))['catch'](handleError(_0x402064,null));};exports[_0x62f3('0x4a')]=function(_0x33d748,_0x3cf615){var _0x3c6d78={'raw':!![],'where':{'id':_0x33d748[_0x62f3('0x4b')]['id']}},_0x16f8f4={};_0x16f8f4['model']=_[_0x62f3('0x36')](db['Variable'][_0x62f3('0x30')]);_0x16f8f4[_0x62f3('0x35')]=_[_0x62f3('0x36')](_0x33d748[_0x62f3('0x35')]);_0x16f8f4[_0x62f3('0x37')]=_['intersection'](_0x16f8f4[_0x62f3('0x34')],_0x16f8f4['query']);_0x3c6d78[_0x62f3('0x39')]=_[_0x62f3('0x38')](_0x16f8f4['model'],qs['fields'](_0x33d748['query'][_0x62f3('0x3a')]));_0x3c6d78[_0x62f3('0x39')]=_0x3c6d78[_0x62f3('0x39')][_0x62f3('0x3b')]?_0x3c6d78[_0x62f3('0x39')]:_0x16f8f4['model'];if(_0x33d748[_0x62f3('0x35')][_0x62f3('0x46')]){_0x3c6d78[_0x62f3('0x47')]=[{'all':!![]}];}_0x3c6d78=_[_0x62f3('0x44')]({},_0x3c6d78,_0x33d748[_0x62f3('0x45')]);return db[_0x62f3('0x2f')]['find'](_0x3c6d78)['then'](handleEntityNotFound(_0x3cf615,null))['then'](respondWithResult(_0x3cf615,null))['catch'](handleError(_0x3cf615,null));};exports['create']=function(_0x1d2650,_0x178ec2){return db[_0x62f3('0x2f')][_0x62f3('0x4c')](_0x1d2650['body'],{})['then'](function(_0x3ed179){var _0x231fcc=_0x1d2650[_0x62f3('0x4d')][_0x62f3('0x27')]({'plain':!![]});if(!_0x231fcc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x231fcc[_0x62f3('0x4e')]===_0x62f3('0x4d')){var _0xf22cee=_0x3ed179['get']({'plain':!![]});var _0x4f5ea8=_0x62f3('0x28');return db[_0x62f3('0x4f')]['find']({'where':{'name':_0x4f5ea8,'userProfileId':_0x231fcc[_0x62f3('0x50')]},'raw':!![]})[_0x62f3('0x25')](function(_0x54e5fe){if(_0x54e5fe&&_0x54e5fe[_0x62f3('0x51')]===0x0){return db[_0x62f3('0x29')][_0x62f3('0x4c')]({'name':_0xf22cee[_0x62f3('0x2c')],'resourceId':_0xf22cee['id'],'type':_0x54e5fe[_0x62f3('0x2c')],'sectionId':_0x54e5fe['id']},{})[_0x62f3('0x25')](function(){return _0x3ed179;});}else{return _0x3ed179;}})['catch'](function(_0x10be39){logger[_0x62f3('0x2a')](_0x62f3('0x52'),_0x10be39);throw _0x10be39;});}return _0x3ed179;})['then'](respondWithResult(_0x178ec2,0xc9))['catch'](handleError(_0x178ec2,null));};exports[_0x62f3('0x24')]=function(_0x52b3e2,_0x18fe55){if(_0x52b3e2[_0x62f3('0x53')]['id']){delete _0x52b3e2[_0x62f3('0x53')]['id'];}return db[_0x62f3('0x2f')][_0x62f3('0x54')]({'where':{'id':_0x52b3e2[_0x62f3('0x4b')]['id']}})[_0x62f3('0x25')](handleEntityNotFound(_0x18fe55,null))['then'](saveUpdates(_0x52b3e2[_0x62f3('0x53')],null))[_0x62f3('0x25')](respondWithResult(_0x18fe55,null))[_0x62f3('0x55')](handleError(_0x18fe55,null));};exports[_0x62f3('0x26')]=function(_0x3de85f,_0x212bed){return db[_0x62f3('0x2f')][_0x62f3('0x54')]({'where':{'id':_0x3de85f[_0x62f3('0x4b')]['id']}})[_0x62f3('0x25')](handleEntityNotFound(_0x212bed,null))[_0x62f3('0x25')](removeEntity(_0x212bed,null))[_0x62f3('0x55')](handleError(_0x212bed,null));};
\ No newline at end of file
+var _0x662c=['fields','length','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','count','includeAll','include','rows','keys','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Variables','UserProfileResource','name','map','Variable','rawAttributes','type','model','query','filters','intersection','attributes'];(function(_0x1139c5,_0x27a25c){var _0x4ca53c=function(_0x4bfddb){while(--_0x4bfddb){_0x1139c5['push'](_0x1139c5['shift']());}};_0x4ca53c(++_0x27a25c);}(_0x662c,0x69));var _0xc662=function(_0x4cbae6,_0x1e86b1){_0x4cbae6=_0x4cbae6-0x0;var _0x53d792=_0x662c[_0x4cbae6];return _0x53d792;};'use strict';var emlformat=require(_0xc662('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc662('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc662('0x2'));var BPromise=require(_0xc662('0x3'));var Mustache=require(_0xc662('0x4'));var util=require(_0xc662('0x5'));var path=require(_0xc662('0x6'));var sox=require(_0xc662('0x7'));var csv=require(_0xc662('0x8'));var ejs=require(_0xc662('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc662('0xa'));var squel=require(_0xc662('0xb'));var crypto=require(_0xc662('0xc'));var jsforce=require(_0xc662('0xd'));var deskjs=require(_0xc662('0xe'));var toCsv=require(_0xc662('0x8'));var querystring=require(_0xc662('0xf'));var Papa=require('papaparse');var Redis=require(_0xc662('0x10'));var authService=require(_0xc662('0x11'));var qs=require(_0xc662('0x12'));var as=require(_0xc662('0x13'));var hardwareService=require(_0xc662('0x14'));var logger=require(_0xc662('0x15'))('api');var utils=require(_0xc662('0x16'));var config=require(_0xc662('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc662('0x18'))['db'];function respondWithStatusCode(_0x13afcb,_0x588a27){_0x588a27=_0x588a27||0xcc;return function(_0x1b77fe){if(_0x1b77fe){return _0x13afcb[_0xc662('0x19')](_0x588a27);}return _0x13afcb[_0xc662('0x1a')](_0x588a27)[_0xc662('0x1b')]();};}function respondWithResult(_0x27a2d9,_0x1976ba){_0x1976ba=_0x1976ba||0xc8;return function(_0x371fb4){if(_0x371fb4){return _0x27a2d9[_0xc662('0x1a')](_0x1976ba)[_0xc662('0x1c')](_0x371fb4);}};}function respondWithFilteredResult(_0x12f177,_0x3c739f){return function(_0x446a17){if(_0x446a17){var _0x16f585=typeof _0x3c739f[_0xc662('0x1d')]==='undefined'&&typeof _0x3c739f['limit']==='undefined';var _0x3b89ba=_0x446a17['count'];var _0xf9a06e=_0x16f585?0x0:_0x3c739f[_0xc662('0x1d')];var _0x514b27=_0x16f585?_0x446a17['count']:_0x3c739f[_0xc662('0x1d')]+_0x3c739f[_0xc662('0x1e')];var _0x1369e5;if(_0x514b27>=_0x3b89ba){_0x514b27=_0x3b89ba;_0x1369e5=0xc8;}else{_0x1369e5=0xce;}_0x12f177[_0xc662('0x1a')](_0x1369e5);return _0x12f177[_0xc662('0x1f')](_0xc662('0x20'),_0xf9a06e+'-'+_0x514b27+'/'+_0x3b89ba)['json'](_0x446a17);}return null;};}function patchUpdates(_0x1e950d){return function(_0x5c9918){try{jsonpatch[_0xc662('0x21')](_0x5c9918,_0x1e950d,!![]);}catch(_0x2c204b){return BPromise[_0xc662('0x22')](_0x2c204b);}return _0x5c9918[_0xc662('0x23')]();};}function saveUpdates(_0x3b0261,_0x4eb52c){return function(_0x44d765){if(_0x44d765){return _0x44d765['update'](_0x3b0261)[_0xc662('0x24')](function(_0x4b232c){return _0x4b232c;});}return null;};}function removeEntity(_0x382727,_0x5d52b1){return function(_0x3ea49c){if(_0x3ea49c){return _0x3ea49c[_0xc662('0x25')]()[_0xc662('0x24')](function(){var _0x17eb96=_0x3ea49c[_0xc662('0x26')]({'plain':!![]});var _0x49cba6=_0xc662('0x27');return db[_0xc662('0x28')]['destroy']({'where':{'type':_0x49cba6,'resourceId':_0x17eb96['id']}})[_0xc662('0x24')](function(){return _0x3ea49c;});})[_0xc662('0x24')](function(){_0x382727[_0xc662('0x1a')](0xcc)[_0xc662('0x1b')]();});}};}function handleEntityNotFound(_0x401866,_0x351768){return function(_0x375251){if(!_0x375251){_0x401866['sendStatus'](0x194);}return _0x375251;};}function handleError(_0x181362,_0x2d6b24){_0x2d6b24=_0x2d6b24||0x1f4;return function(_0x44f283){logger['error'](_0x44f283['stack']);if(_0x44f283[_0xc662('0x29')]){delete _0x44f283[_0xc662('0x29')];}_0x181362['status'](_0x2d6b24)['send'](_0x44f283);};}exports['index']=function(_0x208b96,_0x8dfa41){var _0x4d9480={},_0x22c857={},_0x458d03={'count':0x0,'rows':[]};var _0x3f197e=_[_0xc662('0x2a')](db[_0xc662('0x2b')][_0xc662('0x2c')],function(_0x4c2814){return{'name':_0x4c2814['fieldName'],'type':_0x4c2814[_0xc662('0x2d')]['key']};});_0x22c857[_0xc662('0x2e')]=_[_0xc662('0x2a')](_0x3f197e,_0xc662('0x29'));_0x22c857[_0xc662('0x2f')]=_['keys'](_0x208b96[_0xc662('0x2f')]);_0x22c857[_0xc662('0x30')]=_[_0xc662('0x31')](_0x22c857[_0xc662('0x2e')],_0x22c857['query']);_0x4d9480[_0xc662('0x32')]=_[_0xc662('0x31')](_0x22c857[_0xc662('0x2e')],qs['fields'](_0x208b96[_0xc662('0x2f')][_0xc662('0x33')]));_0x4d9480[_0xc662('0x32')]=_0x4d9480[_0xc662('0x32')][_0xc662('0x34')]?_0x4d9480['attributes']:_0x22c857[_0xc662('0x2e')];if(!_0x208b96[_0xc662('0x2f')][_0xc662('0x35')]('nolimit')){_0x4d9480[_0xc662('0x1e')]=qs[_0xc662('0x1e')](_0x208b96[_0xc662('0x2f')][_0xc662('0x1e')]);_0x4d9480[_0xc662('0x1d')]=qs['offset'](_0x208b96['query'][_0xc662('0x1d')]);}_0x4d9480['order']=qs[_0xc662('0x36')](_0x208b96[_0xc662('0x2f')]['sort']);_0x4d9480['where']=qs[_0xc662('0x30')](_[_0xc662('0x37')](_0x208b96[_0xc662('0x2f')],_0x22c857['filters']),_0x3f197e);if(_0x208b96[_0xc662('0x2f')]['filter']){_0x4d9480[_0xc662('0x38')]=_[_0xc662('0x39')](_0x4d9480[_0xc662('0x38')],{'$or':_[_0xc662('0x2a')](_0x3f197e,function(_0x200563){if(_0x200563['type']!==_0xc662('0x3a')){var _0x13391e={};_0x13391e[_0x200563[_0xc662('0x29')]]={'$like':'%'+_0x208b96[_0xc662('0x2f')][_0xc662('0x3b')]+'%'};return _0x13391e;}})});}_0x4d9480=_[_0xc662('0x39')]({},_0x4d9480,_0x208b96['options']);var _0x48b510={'where':_0x4d9480[_0xc662('0x38')]};return db[_0xc662('0x2b')][_0xc662('0x3c')](_0x48b510)['then'](function(_0x19cb47){_0x458d03[_0xc662('0x3c')]=_0x19cb47;if(_0x208b96['query'][_0xc662('0x3d')]){_0x4d9480[_0xc662('0x3e')]=[{'all':!![]}];}return db[_0xc662('0x2b')]['findAll'](_0x4d9480);})[_0xc662('0x24')](function(_0x58906d){_0x458d03[_0xc662('0x3f')]=_0x58906d;return _0x458d03;})[_0xc662('0x24')](respondWithFilteredResult(_0x8dfa41,_0x4d9480))['catch'](handleError(_0x8dfa41,null));};exports['show']=function(_0x3635cb,_0x509888){var _0x43074d={'raw':!![],'where':{'id':_0x3635cb['params']['id']}},_0x4370fb={};_0x4370fb[_0xc662('0x2e')]=_[_0xc662('0x40')](db['Variable'][_0xc662('0x2c')]);_0x4370fb['query']=_[_0xc662('0x40')](_0x3635cb[_0xc662('0x2f')]);_0x4370fb[_0xc662('0x30')]=_[_0xc662('0x31')](_0x4370fb['model'],_0x4370fb[_0xc662('0x2f')]);_0x43074d['attributes']=_[_0xc662('0x31')](_0x4370fb[_0xc662('0x2e')],qs[_0xc662('0x33')](_0x3635cb['query'][_0xc662('0x33')]));_0x43074d['attributes']=_0x43074d['attributes'][_0xc662('0x34')]?_0x43074d[_0xc662('0x32')]:_0x4370fb[_0xc662('0x2e')];if(_0x3635cb[_0xc662('0x2f')][_0xc662('0x3d')]){_0x43074d['include']=[{'all':!![]}];}_0x43074d=_['merge']({},_0x43074d,_0x3635cb[_0xc662('0x41')]);return db[_0xc662('0x2b')][_0xc662('0x42')](_0x43074d)[_0xc662('0x24')](handleEntityNotFound(_0x509888,null))['then'](respondWithResult(_0x509888,null))[_0xc662('0x43')](handleError(_0x509888,null));};exports[_0xc662('0x44')]=function(_0x56d9cf,_0x2cf1d2){return db[_0xc662('0x2b')][_0xc662('0x44')](_0x56d9cf[_0xc662('0x45')],{})[_0xc662('0x24')](function(_0x2a7314){var _0x5e6829=_0x56d9cf[_0xc662('0x46')][_0xc662('0x26')]({'plain':!![]});if(!_0x5e6829)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e6829[_0xc662('0x47')]===_0xc662('0x46')){var _0x110f59=_0x2a7314[_0xc662('0x26')]({'plain':!![]});var _0x757f99=_0xc662('0x27');return db[_0xc662('0x48')][_0xc662('0x42')]({'where':{'name':_0x757f99,'userProfileId':_0x5e6829[_0xc662('0x49')]},'raw':!![]})['then'](function(_0x447174){if(_0x447174&&_0x447174[_0xc662('0x4a')]===0x0){return db[_0xc662('0x28')][_0xc662('0x44')]({'name':_0x110f59[_0xc662('0x29')],'resourceId':_0x110f59['id'],'type':_0x447174[_0xc662('0x29')],'sectionId':_0x447174['id']},{})[_0xc662('0x24')](function(){return _0x2a7314;});}else{return _0x2a7314;}})[_0xc662('0x43')](function(_0x3528a0){logger['error'](_0xc662('0x4b'),_0x3528a0);throw _0x3528a0;});}return _0x2a7314;})[_0xc662('0x24')](respondWithResult(_0x2cf1d2,0xc9))[_0xc662('0x43')](handleError(_0x2cf1d2,null));};exports[_0xc662('0x4c')]=function(_0x2144ed,_0x874d23){if(_0x2144ed['body']['id']){delete _0x2144ed[_0xc662('0x45')]['id'];}return db['Variable'][_0xc662('0x42')]({'where':{'id':_0x2144ed[_0xc662('0x4d')]['id']}})[_0xc662('0x24')](handleEntityNotFound(_0x874d23,null))[_0xc662('0x24')](saveUpdates(_0x2144ed[_0xc662('0x45')],null))['then'](respondWithResult(_0x874d23,null))[_0xc662('0x43')](handleError(_0x874d23,null));};exports[_0xc662('0x25')]=function(_0x3de082,_0x495957){return db['Variable'][_0xc662('0x42')]({'where':{'id':_0x3de082['params']['id']}})[_0xc662('0x24')](handleEntityNotFound(_0x495957,null))[_0xc662('0x24')](removeEntity(_0x495957,null))['catch'](handleError(_0x495957,null));};
\ No newline at end of file
index 82c786d..251e6e9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9388=['moment','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','api'];(function(_0x504582,_0x5b3965){var _0x43c6ce=function(_0x1199a4){while(--_0x1199a4){_0x504582['push'](_0x504582['shift']());}};_0x43c6ce(++_0x5b3965);}(_0x9388,0x1eb));var _0x8938=function(_0x36c8f5,_0x322472){_0x36c8f5=_0x36c8f5-0x0;var _0x55b836=_0x9388[_0x36c8f5];return _0x55b836;};'use strict';var _=require(_0x8938('0x0'));var util=require(_0x8938('0x1'));var logger=require('../../config/logger')(_0x8938('0x2'));var moment=require(_0x8938('0x3'));var BPromise=require(_0x8938('0x4'));var rp=require(_0x8938('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8938('0x6'));var config=require(_0x8938('0x7'));var attributes=require(_0x8938('0x8'));module[_0x8938('0x9')]=function(_0xf3d45a,_0x2159ca){return _0xf3d45a[_0x8938('0xa')](_0x8938('0xb'),attributes,{'tableName':_0x8938('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7623=['tools_variables','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./variable.attributes','exports'];(function(_0x124e34,_0x1afa9a){var _0x3ca71a=function(_0xb3d2ca){while(--_0xb3d2ca){_0x124e34['push'](_0x124e34['shift']());}};_0x3ca71a(++_0x1afa9a);}(_0x7623,0x97));var _0x3762=function(_0x1d3577,_0x17a32e){_0x1d3577=_0x1d3577-0x0;var _0x277d9a=_0x7623[_0x1d3577];return _0x277d9a;};'use strict';var _=require(_0x3762('0x0'));var util=require(_0x3762('0x1'));var logger=require(_0x3762('0x2'))(_0x3762('0x3'));var moment=require('moment');var BPromise=require(_0x3762('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3762('0x5'));var config=require(_0x3762('0x6'));var attributes=require(_0x3762('0x7'));module[_0x3762('0x8')]=function(_0x27a289,_0x3917bd){return _0x27a289['define']('Variable',attributes,{'tableName':_0x3762('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 8296a5b..853a0f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xa41a,0x6b));var _0xaa41=function(_0x11915b,_0x7e759f){_0x11915b=_0x11915b-0x0;var _0xe9101=_0xa41a[_0x11915b];return _0xe9101;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});};
\ No newline at end of file
+var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x769b53,_0x1047a3){var _0x2d5a20=function(_0x5a3c70){while(--_0x5a3c70){_0x769b53['push'](_0x769b53['shift']());}};_0x2d5a20(++_0x1047a3);}(_0xabce,0x103));var _0xeabc=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xabce[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});};
\ No newline at end of file
index 6d878fc..90322b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3c90=['/reset','canUpdate','pull','/restart','restart','exports','express','Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','fetch'];(function(_0x506c41,_0x3dd13b){var _0x59d3e7=function(_0x2f53f4){while(--_0x2f53f4){_0x506c41['push'](_0x506c41['shift']());}};_0x59d3e7(++_0x3dd13b);}(_0x3c90,0x13a));var _0x03c9=function(_0x45312f,_0x189ea1){_0x45312f=_0x45312f-0x0;var _0x1c4381=_0x3c90[_0x45312f];return _0x1c4381;};'use strict';var express=require(_0x03c9('0x0'));var router=express[_0x03c9('0x1')]();var auth=require(_0x03c9('0x2'));var controller=require(_0x03c9('0x3'));router[_0x03c9('0x4')]('/',controller['index']);router['get'](_0x03c9('0x5'),auth[_0x03c9('0x6')](),auth['canUpdate'](),controller[_0x03c9('0x7')]);router[_0x03c9('0x4')](_0x03c9('0x8'),auth[_0x03c9('0x6')](),auth[_0x03c9('0x9')](),controller['reset']);router[_0x03c9('0x4')]('/pull',auth[_0x03c9('0x6')](),auth[_0x03c9('0x9')](),controller[_0x03c9('0xa')]);router[_0x03c9('0x4')](_0x03c9('0xb'),auth['isAuthenticated'](),controller[_0x03c9('0xc')]);router[_0x03c9('0x4')]('/migrations',controller['migrations']);module[_0x03c9('0xd')]=router;
\ No newline at end of file
+var _0xb32f=['canUpdate','fetch','/reset','reset','pull','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0xb32f,0x12a));var _0xfb32=function(_0x5d00b6,_0x2018ea){_0x5d00b6=_0x5d00b6-0x0;var _0x18ff5f=_0xb32f[_0x5d00b6];return _0x18ff5f;};'use strict';var express=require(_0xfb32('0x0'));var router=express[_0xfb32('0x1')]();var auth=require(_0xfb32('0x2'));var controller=require(_0xfb32('0x3'));router[_0xfb32('0x4')]('/',controller[_0xfb32('0x5')]);router['get'](_0xfb32('0x6'),auth[_0xfb32('0x7')](),auth[_0xfb32('0x8')](),controller[_0xfb32('0x9')]);router[_0xfb32('0x4')](_0xfb32('0xa'),auth[_0xfb32('0x7')](),auth[_0xfb32('0x8')](),controller[_0xfb32('0xb')]);router[_0xfb32('0x4')]('/pull',auth['isAuthenticated'](),auth[_0xfb32('0x8')](),controller[_0xfb32('0xc')]);router[_0xfb32('0x4')]('/restart',auth['isAuthenticated'](),controller[_0xfb32('0xd')]);router[_0xfb32('0x4')](_0xfb32('0xe'),controller[_0xfb32('0xf')]);module[_0xfb32('0x10')]=router;
\ No newline at end of file
index 08f6063..5343cbc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x68d4=['.js','push','sort','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','umzug','path','lodash','pkginfo','version','compare-versions','../../config/pm2','simple-git','exports','query','latest','fetch','2.0.0','status','json','origin','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','pm2\x20restart\x20motion\x20%s','readdirSync','join','root','migrations','length','replace'];(function(_0x59e182,_0x41d7aa){var _0x3419da=function(_0x44a4f5){while(--_0x44a4f5){_0x59e182['push'](_0x59e182['shift']());}};_0x3419da(++_0x41d7aa);}(_0x68d4,0x1a0));var _0x468d=function(_0x5eb496,_0x25bc44){_0x5eb496=_0x5eb496-0x0;var _0x4f513a=_0x68d4[_0x5eb496];return _0x4f513a;};'use strict';var Umzug=require(_0x468d('0x0'));var path=require(_0x468d('0x1'));var fs=require('fs');var _=require(_0x468d('0x2'));var pkginfo=require(_0x468d('0x3'))(module,_0x468d('0x4'));var compareVersions=require(_0x468d('0x5'));var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x468d('0x6'));var logger=require('../../config/logger')('update');var git=require(_0x468d('0x7'))(config['root']);exports['index']=function(_0x1f6303,_0x522c84){var _0x456b0c={'current':module[_0x468d('0x8')][_0x468d('0x4')],'phonebar':0x2};if(_0x1f6303[_0x468d('0x9')]&&_0x1f6303['query'][_0x468d('0xa')]){return git[_0x468d('0xb')]()['tags'](function(_0x3e1747,_0x1a9ac9){_0x456b0c[_0x468d('0xa')]=(_0x3e1747?module['exports'][_0x468d('0x4')]:_0x1a9ac9[_0x468d('0xa')])||_0x468d('0xc');return _0x522c84[_0x468d('0xd')](0xc8)[_0x468d('0xe')](_0x456b0c);});}else{return _0x522c84['status'](0xc8)[_0x468d('0xe')](_0x456b0c);}};exports[_0x468d('0xb')]=function(_0x2c9a8d,_0x4087d0){return git['fetch']([_0x468d('0xf'),'master'],function(_0x4cee9e){if(_0x4cee9e){logger[_0x468d('0x10')](_0x4cee9e);return _0x4087d0[_0x468d('0xd')](0x1f4)[_0x468d('0xe')](_0x4cee9e);}logger[_0x468d('0x11')](_0x468d('0x12'));return _0x4087d0[_0x468d('0xd')](0xc8)[_0x468d('0xe')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x468d('0x13')]=function(_0x4727db,_0x539ffa){return git[_0x468d('0x13')]([_0x468d('0x14'),_0x468d('0x15')],function(_0x45adc7){if(_0x45adc7){logger[_0x468d('0x10')](_0x45adc7);return _0x539ffa['status'](0x1f4)[_0x468d('0xe')](_0x45adc7);}logger[_0x468d('0x11')](_0x468d('0x16'));return _0x539ffa[_0x468d('0xd')](0xc8)[_0x468d('0xe')]({'output':_0x468d('0x17')});});};exports[_0x468d('0x18')]=function(_0x1be664,_0x2d3e4b){exec('npm\x20install\x20--production',function(_0x217360,_0xa2bfd9,_0x17d2db){logger[_0x468d('0x11')](_0xa2bfd9);logger[_0x468d('0x11')](_0x17d2db);if(_0x217360){logger[_0x468d('0x10')](_0x217360);return _0x2d3e4b[_0x468d('0xd')](0x1f4)['json'](_0x217360);}return _0x2d3e4b[_0x468d('0xd')](0xc8)[_0x468d('0xe')]({'output':_0xa2bfd9});});};exports[_0x468d('0x19')]=function(_0x38bff6,_0x89f591){return pm2[_0x468d('0x19')](_0x468d('0x1a'))['then'](function(_0x972bd2){logger[_0x468d('0x11')](_0x468d('0x1b'),_0x972bd2);return _0x89f591[_0x468d('0xd')](0xc8)[_0x468d('0xe')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x45c4f1){logger[_0x468d('0x10')](_0x45c4f1);return _0x89f591[_0x468d('0xd')](0x1f4)[_0x468d('0xe')](_0x45c4f1);});};exports['migrations']=function(_0x547698,_0x416b6c){var _0x23edfc=fs[_0x468d('0x1c')](path[_0x468d('0x1d')](config[_0x468d('0x1e')],'server',_0x468d('0x1f')));var _0x5065c2=[];for(var _0x43b38a=0x0;_0x43b38a<_0x23edfc[_0x468d('0x20')];_0x43b38a++){var _0x27fae4=_0x23edfc[_0x43b38a][_0x468d('0x21')](_0x468d('0x22'),'');if(compareVersions(module[_0x468d('0x8')][_0x468d('0x4')],_0x27fae4)===-0x1){_0x5065c2[_0x468d('0x23')](_0x27fae4);}}if(_0x5065c2[_0x468d('0x20')]){var _0x1d2eb3=_0x5065c2[_0x468d('0x24')](compareVersions);var _0x58ac0a=new Umzug({'storage':_0x468d('0x25'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x468d('0x25')]['getQueryInterface'](),db[_0x468d('0x25')][_0x468d('0x26')],function(){throw new Error(_0x468d('0x27'));}],'path':path[_0x468d('0x1d')](config[_0x468d('0x1e')],_0x468d('0x28'),_0x468d('0x1f')),'pattern':/\.js$/}});_0x58ac0a['up']({'migrations':_['map'](_0x1d2eb3,function(_0x3d2997){return _0x3d2997+_0x468d('0x22');})})['then'](function(){return _0x416b6c[_0x468d('0xd')](0xc8)['json']({'output':_0x468d('0x29')+module[_0x468d('0x8')][_0x468d('0x4')]+_0x468d('0x2a')+_[_0x468d('0x2b')](_0x1d2eb3),'migrations':_[_0x468d('0x1d')](_0x1d2eb3)});})[_0x468d('0x2c')](function(_0x38f758){if(_0x38f758 instanceof db[_0x468d('0x25')]['UniqueConstraintError']){return _0x416b6c[_0x468d('0xd')](0xc8)[_0x468d('0xe')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x416b6c[_0x468d('0xd')](0x1f4)[_0x468d('0xe')](_0x38f758);}});}else{return _0x416b6c[_0x468d('0xd')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}};
\ No newline at end of file
+var _0x98c1=['tags','version','2.0.0','status','origin','master','error','json','info','git\x20fetch','--hard','FETCH_HEAD','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','server','migrations','replace','length','sequelize','Migration','getQueryInterface','constructor','join','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','exec','../../mysqldb','../../config/environment','../../config/logger','update','root','index','exports','query','latest','fetch'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x98c1,0xef));var _0x198c=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x98c1[_0x25662e];return _0x59b7bc;};'use strict';var Umzug=require(_0x198c('0x0'));var path=require(_0x198c('0x1'));var fs=require('fs');var _=require(_0x198c('0x2'));var pkginfo=require(_0x198c('0x3'))(module,'version');var compareVersions=require(_0x198c('0x4'));var exec=require('child_process')[_0x198c('0x5')];var db=require(_0x198c('0x6'))['db'];var config=require(_0x198c('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x198c('0x8'))(_0x198c('0x9'));var git=require('simple-git')(config[_0x198c('0xa')]);exports[_0x198c('0xb')]=function(_0x3fbd88,_0x16b479){var _0x3a0b53={'current':module[_0x198c('0xc')]['version'],'phonebar':0x2};if(_0x3fbd88[_0x198c('0xd')]&&_0x3fbd88[_0x198c('0xd')][_0x198c('0xe')]){return git[_0x198c('0xf')]()[_0x198c('0x10')](function(_0xd2d4c9,_0x29e835){_0x3a0b53[_0x198c('0xe')]=(_0xd2d4c9?module[_0x198c('0xc')][_0x198c('0x11')]:_0x29e835['latest'])||_0x198c('0x12');return _0x16b479[_0x198c('0x13')](0xc8)['json'](_0x3a0b53);});}else{return _0x16b479[_0x198c('0x13')](0xc8)['json'](_0x3a0b53);}};exports[_0x198c('0xf')]=function(_0x52a48e,_0x605e1){return git[_0x198c('0xf')]([_0x198c('0x14'),_0x198c('0x15')],function(_0x178fe2){if(_0x178fe2){logger[_0x198c('0x16')](_0x178fe2);return _0x605e1[_0x198c('0x13')](0x1f4)[_0x198c('0x17')](_0x178fe2);}logger[_0x198c('0x18')](_0x198c('0x19'));return _0x605e1[_0x198c('0x13')](0xc8)[_0x198c('0x17')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x55a708,_0x4e9088){return git['reset']([_0x198c('0x1a'),_0x198c('0x1b')],function(_0x3566a2){if(_0x3566a2){logger['error'](_0x3566a2);return _0x4e9088[_0x198c('0x13')](0x1f4)[_0x198c('0x17')](_0x3566a2);}logger[_0x198c('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x4e9088[_0x198c('0x13')](0xc8)[_0x198c('0x17')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x869195,_0x252c69){exec(_0x198c('0x1c'),function(_0x2262f8,_0x398fa0,_0x3eaa84){logger['info'](_0x398fa0);logger['info'](_0x3eaa84);if(_0x2262f8){logger[_0x198c('0x16')](_0x2262f8);return _0x252c69['status'](0x1f4)[_0x198c('0x17')](_0x2262f8);}return _0x252c69[_0x198c('0x13')](0xc8)['json']({'output':_0x398fa0});});};exports[_0x198c('0x1d')]=function(_0x19135f,_0x1f12b4){return pm2[_0x198c('0x1d')](_0x198c('0x1e'))[_0x198c('0x1f')](function(_0x37643b){logger[_0x198c('0x18')](_0x198c('0x20'),_0x37643b);return _0x1f12b4[_0x198c('0x13')](0xc8)[_0x198c('0x17')]({'output':_0x198c('0x21')});})['catch'](function(_0x382803){logger[_0x198c('0x16')](_0x382803);return _0x1f12b4['status'](0x1f4)[_0x198c('0x17')](_0x382803);});};exports['migrations']=function(_0xdbb346,_0x144cde){var _0x4c7b89=fs[_0x198c('0x22')](path['join'](config[_0x198c('0xa')],_0x198c('0x23'),_0x198c('0x24')));var _0x25dd1a=[];for(var _0x428f45=0x0;_0x428f45<_0x4c7b89['length'];_0x428f45++){var _0x25b9de=_0x4c7b89[_0x428f45][_0x198c('0x25')]('.js','');if(compareVersions(module[_0x198c('0xc')][_0x198c('0x11')],_0x25b9de)===-0x1){_0x25dd1a['push'](_0x25b9de);}}if(_0x25dd1a[_0x198c('0x26')]){var _0x288132=_0x25dd1a['sort'](compareVersions);var _0x3f0184=new Umzug({'storage':_0x198c('0x27'),'storageOptions':{'model':db['Migration'],'modelName':_0x198c('0x28'),'columnName':_0x198c('0x11')},'migrations':{'params':[db[_0x198c('0x27')][_0x198c('0x29')](),db[_0x198c('0x27')][_0x198c('0x2a')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x198c('0x2b')](config[_0x198c('0xa')],_0x198c('0x23'),_0x198c('0x24')),'pattern':/\.js$/}});_0x3f0184['up']({'migrations':_['map'](_0x288132,function(_0x2a9aea){return _0x2a9aea+_0x198c('0x2c');})})[_0x198c('0x1f')](function(){return _0x144cde[_0x198c('0x13')](0xc8)['json']({'output':_0x198c('0x2d')+module[_0x198c('0xc')][_0x198c('0x11')]+_0x198c('0x2e')+_[_0x198c('0x2f')](_0x288132),'migrations':_[_0x198c('0x2b')](_0x288132)});})[_0x198c('0x30')](function(_0x1f29db){if(_0x1f29db instanceof db[_0x198c('0x27')][_0x198c('0x31')]){return _0x144cde[_0x198c('0x13')](0xc8)[_0x198c('0x17')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x144cde[_0x198c('0x13')](0x1f4)[_0x198c('0x17')](_0x1f29db);}});}else{return _0x144cde[_0x198c('0x13')](0xc8)['json']({'output':_0x198c('0x32')});}};
\ No newline at end of file
index dbfddd4..cfc8d09 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc6ce=['/describe','describe','show','create','update','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x29ed18,_0xfb7794){var _0x4ce943=function(_0x5bdd75){while(--_0x5bdd75){_0x29ed18['push'](_0x29ed18['shift']());}};_0x4ce943(++_0xfb7794);}(_0xc6ce,0xc5));var _0xec6c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc6ce[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0xec6c('0x0'));var path=require(_0xec6c('0x1'));var timeout=require(_0xec6c('0x2'));var express=require(_0xec6c('0x3'));var router=express['Router']();var fs_extra=require(_0xec6c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xec6c('0x5'));var config=require(_0xec6c('0x6'));var controller=require(_0xec6c('0x7'));router[_0xec6c('0x8')]('/',auth[_0xec6c('0x9')](),controller[_0xec6c('0xa')]);router[_0xec6c('0x8')](_0xec6c('0xb'),auth[_0xec6c('0x9')](),controller[_0xec6c('0xc')]);router[_0xec6c('0x8')]('/:id',auth[_0xec6c('0x9')](),controller[_0xec6c('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xec6c('0xe')]);router['put']('/:id',auth[_0xec6c('0x9')](),controller[_0xec6c('0xf')]);router['delete']('/:id',auth[_0xec6c('0x9')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0x7321=['../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x3f1133,_0x3953f7){var _0x3c1f98=function(_0x4855c7){while(--_0x4855c7){_0x3f1133['push'](_0x3f1133['shift']());}};_0x3c1f98(++_0x3953f7);}(_0x7321,0x1e1));var _0x1732=function(_0x322944,_0x282203){_0x322944=_0x322944-0x0;var _0xc8374c=_0x7321[_0x322944];return _0xc8374c;};'use strict';var multer=require('multer');var util=require(_0x1732('0x0'));var path=require('path');var timeout=require(_0x1732('0x1'));var express=require(_0x1732('0x2'));var router=express[_0x1732('0x3')]();var fs_extra=require(_0x1732('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1732('0x5'));var config=require(_0x1732('0x6'));var controller=require(_0x1732('0x7'));router[_0x1732('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1732('0x8')](_0x1732('0x9'),auth[_0x1732('0xa')](),controller[_0x1732('0xb')]);router['get'](_0x1732('0xc'),auth['isAuthenticated'](),controller[_0x1732('0xd')]);router[_0x1732('0xe')]('/',auth[_0x1732('0xa')](),controller['create']);router['put'](_0x1732('0xc'),auth[_0x1732('0xa')](),controller['update']);router[_0x1732('0xf')](_0x1732('0xc'),auth[_0x1732('0xa')](),controller[_0x1732('0x10')]);module[_0x1732('0x11')]=router;
\ No newline at end of file
index 901282c..24da69e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5204=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x3a1835,_0x238528){var _0x21792b=function(_0x16c815){while(--_0x16c815){_0x3a1835['push'](_0x3a1835['shift']());}};_0x21792b(++_0x238528);}(_0x5204,0xdf));var _0x4520=function(_0x97c6ea,_0x4cffce){_0x97c6ea=_0x97c6ea-0x0;var _0x2d7f50=_0x5204[_0x97c6ea];return _0x2d7f50;};'use strict';var Sequelize=require(_0x4520('0x0'));module[_0x4520('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4520('0x2')]},'calleridnum':{'type':Sequelize[_0x4520('0x2')]},'calleridname':{'type':Sequelize[_0x4520('0x2')]},'queue':{'type':Sequelize[_0x4520('0x2')]},'interface':{'type':Sequelize[_0x4520('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x4520('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x4520('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4520('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4520('0x3')]},'holdtime':{'type':Sequelize[_0x4520('0x4')]},'agentcomplete':{'type':Sequelize[_0x4520('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4520('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4520('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x4520('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x4520('0x2')]},'lastevent':{'type':Sequelize[_0x4520('0x2')]},'channel':{'type':Sequelize[_0x4520('0x2')]},'channelstate':{'type':Sequelize[_0x4520('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4520('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4520('0x2')]},'connectedlinename':{'type':Sequelize[_0x4520('0x2')]},'language':{'type':Sequelize[_0x4520('0x2')]},'accountcode':{'type':Sequelize[_0x4520('0x2')]},'context':{'type':Sequelize[_0x4520('0x2')]},'exten':{'type':Sequelize[_0x4520('0x2')]},'priority':{'type':Sequelize[_0x4520('0x2')]},'destchannel':{'type':Sequelize[_0x4520('0x2')]},'destchannelstate':{'type':Sequelize[_0x4520('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x4520('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4520('0x2')]},'destcalleridname':{'type':Sequelize[_0x4520('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4520('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4520('0x2')]},'destlanguage':{'type':Sequelize[_0x4520('0x2')]},'destaccountcode':{'type':Sequelize[_0x4520('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x4520('0x2')]},'destpriority':{'type':Sequelize[_0x4520('0x2')]},'destuniqueid':{'type':Sequelize[_0x4520('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4520('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x4520('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4520('0x2')],'comment':_0x4520('0x6')},'transferexten':{'type':Sequelize[_0x4520('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4520('0x2')]},'agententerreason':{'type':Sequelize[_0x4520('0x4')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xb2af=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x186cda,_0x43e88a){var _0x502e00=function(_0x1c3cc8){while(--_0x1c3cc8){_0x186cda['push'](_0x186cda['shift']());}};_0x502e00(++_0x43e88a);}(_0xb2af,0xd2));var _0xfb2a=function(_0x4187d8,_0x121faa){_0x4187d8=_0x4187d8-0x0;var _0xe1c28e=_0xb2af[_0x4187d8];return _0xe1c28e;};'use strict';var Sequelize=require(_0xfb2a('0x0'));module[_0xfb2a('0x1')]={'type':{'type':Sequelize[_0xfb2a('0x2')]},'uniqueid':{'type':Sequelize[_0xfb2a('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfb2a('0x2')]},'queue':{'type':Sequelize[_0xfb2a('0x2')]},'interface':{'type':Sequelize[_0xfb2a('0x2')]},'membername':{'type':Sequelize[_0xfb2a('0x2')]},'agentcalledAt':{'type':Sequelize[_0xfb2a('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xfb2a('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xfb2a('0x3')]},'agentdumpAt':{'type':Sequelize[_0xfb2a('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xfb2a('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfb2a('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xfb2a('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xfb2a('0x5')]},'agentacw':{'type':Sequelize[_0xfb2a('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfb2a('0x5')]},'reason':{'type':Sequelize[_0xfb2a('0x2')]},'lastevent':{'type':Sequelize[_0xfb2a('0x2')]},'channel':{'type':Sequelize[_0xfb2a('0x2')]},'channelstate':{'type':Sequelize[_0xfb2a('0x5')]},'channelstatedesc':{'type':Sequelize[_0xfb2a('0x2')]},'connectedlinenum':{'type':Sequelize[_0xfb2a('0x2')]},'connectedlinename':{'type':Sequelize[_0xfb2a('0x2')]},'language':{'type':Sequelize[_0xfb2a('0x2')]},'accountcode':{'type':Sequelize[_0xfb2a('0x2')]},'context':{'type':Sequelize[_0xfb2a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xfb2a('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xfb2a('0x2')]},'destcalleridnum':{'type':Sequelize[_0xfb2a('0x2')]},'destcalleridname':{'type':Sequelize[_0xfb2a('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xfb2a('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xfb2a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xfb2a('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xfb2a('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xfb2a('0x2')]},'transfer':{'type':Sequelize[_0xfb2a('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xfb2a('0x2')],'comment':_0xfb2a('0x6')},'transferexten':{'type':Sequelize[_0xfb2a('0x2')]},'transferuniqueid':{'type':Sequelize[_0xfb2a('0x2')]},'agententerreason':{'type':Sequelize[_0xfb2a('0x5')],'defaultValue':0x0}};
\ No newline at end of file
index 8d29fa7..095ee56 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));};
\ No newline at end of file
+var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));};
\ No newline at end of file
index 19ceece..e4f7b23 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4b19=['uniqueid','destuniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','report_agent'];(function(_0x2b0690,_0x4f742f){var _0x82be1=function(_0x1e1084){while(--_0x1e1084){_0x2b0690['push'](_0x2b0690['shift']());}};_0x82be1(++_0x4f742f);}(_0x4b19,0x195));var _0x94b1=function(_0x11536c,_0x5dd752){_0x11536c=_0x11536c-0x0;var _0x14cb23=_0x4b19[_0x11536c];return _0x14cb23;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var logger=require(_0x94b1('0x1'))(_0x94b1('0x2'));var moment=require(_0x94b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x94b1('0x4'));var fs=require('fs');var path=require(_0x94b1('0x5'));var rimraf=require(_0x94b1('0x6'));var config=require('../../config/environment');var attributes=require(_0x94b1('0x7'));module[_0x94b1('0x8')]=function(_0x52d6c1,_0x24df76){return _0x52d6c1[_0x94b1('0x9')]('VoiceAgentReport',attributes,{'tableName':_0x94b1('0xa'),'paranoid':![],'indexes':[{'fields':[_0x94b1('0xb'),_0x94b1('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x448a=['./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','util','../../config/logger','moment','path','rimraf'];(function(_0x32c83f,_0x4cb2d6){var _0x15e3cd=function(_0xc75568){while(--_0xc75568){_0x32c83f['push'](_0x32c83f['shift']());}};_0x15e3cd(++_0x4cb2d6);}(_0x448a,0x1ef));var _0xa448=function(_0x58be7a,_0x176ab0){_0x58be7a=_0x58be7a-0x0;var _0x5991b0=_0x448a[_0x58be7a];return _0x5991b0;};'use strict';var _=require('lodash');var util=require(_0xa448('0x0'));var logger=require(_0xa448('0x1'))('api');var moment=require(_0xa448('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa448('0x3'));var rimraf=require(_0xa448('0x4'));var config=require('../../config/environment');var attributes=require(_0xa448('0x5'));module[_0xa448('0x6')]=function(_0x343b79,_0x2c16e3){return _0x343b79[_0xa448('0x7')](_0xa448('0x8'),attributes,{'tableName':_0xa448('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});};
\ No newline at end of file
index de32ca6..0a28c5f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9819=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','then','stringify','UpdateVoiceAgentReport','where','attributes','lodash','util','bluebird','randomstring','ioredis'];(function(_0x49c8de,_0x57ff68){var _0x527091=function(_0x360492){while(--_0x360492){_0x49c8de['push'](_0x49c8de['shift']());}};_0x527091(++_0x57ff68);}(_0x9819,0x127));var _0x9981=function(_0x4153de,_0x44969f){_0x4153de=_0x4153de-0x0;var _0x4ede86=_0x9819[_0x4153de];return _0x4ede86;};'use strict';var _=require(_0x9981('0x0'));var util=require(_0x9981('0x1'));var moment=require('moment');var BPromise=require(_0x9981('0x2'));var rs=require(_0x9981('0x3'));var fs=require('fs');var Redis=require(_0x9981('0x4'));var db=require(_0x9981('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9981('0x6'))(_0x9981('0x7'));var config=require(_0x9981('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9981('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cdb6e,_0x37876a,_0x398f34){return new BPromise(function(_0x498159,_0x2f2c3f){return client[_0x9981('0xa')](_0x4cdb6e,_0x398f34)['then'](function(_0x4b58a7){logger[_0x9981('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x37876a,_0x9981('0xc'));logger[_0x9981('0xd')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x37876a,_0x9981('0xc'),JSON['stringify'](_0x4b58a7));if(_0x4b58a7[_0x9981('0xe')]){if(_0x4b58a7[_0x9981('0xe')][_0x9981('0xf')]===0x1f4){logger[_0x9981('0xe')](_0x9981('0x10'),_0x37876a,_0x4b58a7[_0x9981('0xe')][_0x9981('0x11')]);return _0x2f2c3f(_0x4b58a7[_0x9981('0xe')][_0x9981('0x11')]);}logger[_0x9981('0xe')](_0x9981('0x10'),_0x37876a,_0x4b58a7['error'][_0x9981('0x11')]);return _0x498159(_0x4b58a7[_0x9981('0xe')][_0x9981('0x11')]);}else{logger[_0x9981('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x37876a,_0x9981('0xc'));_0x498159(_0x4b58a7[_0x9981('0x12')][_0x9981('0x11')]);}})[_0x9981('0x13')](function(_0x10c1d0){logger['error'](_0x9981('0x10'),_0x37876a,_0x10c1d0);_0x2f2c3f(_0x10c1d0);});});}exports[_0x9981('0x14')]=function(_0x24bcbb){var _0x1d9f5c=this;return new Promise(function(_0x4d9eb4,_0x457f79){return db[_0x9981('0x15')]['create'](_0x24bcbb[_0x9981('0x16')],{'raw':_0x24bcbb[_0x9981('0x17')]?_0x24bcbb[_0x9981('0x17')][_0x9981('0x18')]===undefined?!![]:![]:!![]})[_0x9981('0x19')](function(_0x2e4a20){logger[_0x9981('0xb')](_0x9981('0x14'),_0x24bcbb);logger['debug']('CreateVoiceAgentReport',_0x24bcbb,JSON[_0x9981('0x1a')](_0x2e4a20));_0x4d9eb4(_0x2e4a20);})[_0x9981('0x13')](function(_0x567347){logger[_0x9981('0xe')](_0x9981('0x14'),_0x567347[_0x9981('0x11')],_0x24bcbb);_0x457f79(_0x1d9f5c[_0x9981('0xe')](0x1f4,_0x567347[_0x9981('0x11')]));});});};exports[_0x9981('0x1b')]=function(_0x21e301){var _0x36817f=this;return new Promise(function(_0x360eb0,_0x354747){return db[_0x9981('0x15')]['update'](_0x21e301[_0x9981('0x16')],{'raw':_0x21e301[_0x9981('0x17')]?_0x21e301[_0x9981('0x17')][_0x9981('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21e301[_0x9981('0x17')]?_0x21e301[_0x9981('0x17')][_0x9981('0x1c')]||null:null,'attributes':_0x21e301['options']?_0x21e301['options'][_0x9981('0x1d')]||null:null,'limit':_0x21e301[_0x9981('0x17')]?_0x21e301['options']['limit']||null:null})['then'](function(_0x3b23d8){logger[_0x9981('0xb')](_0x9981('0x1b'),_0x21e301);logger[_0x9981('0xd')](_0x9981('0x1b'),_0x21e301,JSON[_0x9981('0x1a')](_0x3b23d8));_0x360eb0(_0x3b23d8);})[_0x9981('0x13')](function(_0x2ad12c){logger[_0x9981('0xe')](_0x9981('0x1b'),_0x2ad12c[_0x9981('0x11')],_0x21e301);_0x354747(_0x36817f[_0x9981('0xe')](0x1f4,_0x2ad12c[_0x9981('0x11')]));});});};
\ No newline at end of file
+var _0x0944=['code','message','result','CreateVoiceAgentReport','create','options','catch','UpdateVoiceAgentReport','update','body','raw','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x53e0af,_0x2da804){var _0x259245=function(_0x49095b){while(--_0x49095b){_0x53e0af['push'](_0x53e0af['shift']());}};_0x259245(++_0x2da804);}(_0x0944,0x16e));var _0x4094=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0x0944[_0x1f71d8];return _0x10b045;};'use strict';var _=require(_0x4094('0x0'));var util=require(_0x4094('0x1'));var moment=require(_0x4094('0x2'));var BPromise=require(_0x4094('0x3'));var rs=require(_0x4094('0x4'));var fs=require('fs');var Redis=require(_0x4094('0x5'));var db=require(_0x4094('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4094('0x7'))('rpc');var config=require(_0x4094('0x8'));var jayson=require(_0x4094('0x9'));var client=jayson[_0x4094('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x403b12,_0x3a52b4,_0x5f0aef){return new BPromise(function(_0x433b7f,_0x2ba197){return client['request'](_0x403b12,_0x5f0aef)[_0x4094('0xb')](function(_0x1d73c3){logger[_0x4094('0xc')](_0x4094('0xd'),_0x3a52b4,_0x4094('0xe'));logger[_0x4094('0xf')](_0x4094('0x10'),_0x3a52b4,_0x4094('0xe'),JSON['stringify'](_0x1d73c3));if(_0x1d73c3[_0x4094('0x11')]){if(_0x1d73c3['error'][_0x4094('0x12')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x3a52b4,_0x1d73c3[_0x4094('0x11')][_0x4094('0x13')]);return _0x2ba197(_0x1d73c3['error']['message']);}logger[_0x4094('0x11')](_0x4094('0xd'),_0x3a52b4,_0x1d73c3['error'][_0x4094('0x13')]);return _0x433b7f(_0x1d73c3[_0x4094('0x11')]['message']);}else{logger[_0x4094('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x3a52b4,_0x4094('0xe'));_0x433b7f(_0x1d73c3[_0x4094('0x14')][_0x4094('0x13')]);}})['catch'](function(_0x47b2c4){logger['error'](_0x4094('0xd'),_0x3a52b4,_0x47b2c4);_0x2ba197(_0x47b2c4);});});}exports[_0x4094('0x15')]=function(_0x5c2fd0){var _0x11b77f=this;return new Promise(function(_0x38b7a1,_0x42929c){return db['VoiceAgentReport'][_0x4094('0x16')](_0x5c2fd0['body'],{'raw':_0x5c2fd0[_0x4094('0x17')]?_0x5c2fd0[_0x4094('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x4094('0xb')](function(_0x19e34b){logger[_0x4094('0xc')](_0x4094('0x15'),_0x5c2fd0);logger['debug'](_0x4094('0x15'),_0x5c2fd0,JSON['stringify'](_0x19e34b));_0x38b7a1(_0x19e34b);})[_0x4094('0x18')](function(_0x1040c5){logger['error'](_0x4094('0x15'),_0x1040c5['message'],_0x5c2fd0);_0x42929c(_0x11b77f['error'](0x1f4,_0x1040c5[_0x4094('0x13')]));});});};exports[_0x4094('0x19')]=function(_0x5ba5cb){var _0x205bfe=this;return new Promise(function(_0x178a29,_0x22c865){return db['VoiceAgentReport'][_0x4094('0x1a')](_0x5ba5cb[_0x4094('0x1b')],{'raw':_0x5ba5cb[_0x4094('0x17')]?_0x5ba5cb[_0x4094('0x17')][_0x4094('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ba5cb[_0x4094('0x17')]?_0x5ba5cb[_0x4094('0x17')]['where']||null:null,'attributes':_0x5ba5cb[_0x4094('0x17')]?_0x5ba5cb[_0x4094('0x17')][_0x4094('0x1d')]||null:null,'limit':_0x5ba5cb['options']?_0x5ba5cb[_0x4094('0x17')][_0x4094('0x1e')]||null:null})['then'](function(_0x485256){logger['info'](_0x4094('0x19'),_0x5ba5cb);logger['debug'](_0x4094('0x19'),_0x5ba5cb,JSON[_0x4094('0x1f')](_0x485256));_0x178a29(_0x485256);})[_0x4094('0x18')](function(_0x3aae8d){logger[_0x4094('0x11')](_0x4094('0x19'),_0x3aae8d['message'],_0x5ba5cb);_0x22c865(_0x205bfe['error'](0x1f4,_0x3aae8d[_0x4094('0x13')]));});});};
\ No newline at end of file
index 747435d..75c30f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x00bb=['express','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x5dfc97,_0x1ca5f7){var _0x3132b7=function(_0x16206b){while(--_0x16206b){_0x5dfc97['push'](_0x5dfc97['shift']());}};_0x3132b7(++_0x1ca5f7);}(_0x00bb,0x1d8));var _0xb00b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x00bb[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var fs_extra=require(_0xb00b('0x4'));var auth=require(_0xb00b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb00b('0x6'));var controller=require(_0xb00b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb00b('0x8')](_0xb00b('0x9'),auth[_0xb00b('0xa')](),controller[_0xb00b('0xb')]);router[_0xb00b('0x8')](_0xb00b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb00b('0xd')]('/',auth[_0xb00b('0xa')](),controller[_0xb00b('0xe')]);router[_0xb00b('0xf')](_0xb00b('0xc'),auth['isAuthenticated'](),controller[_0xb00b('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb00b('0x11')]);module[_0xb00b('0x12')]=router;
\ No newline at end of file
+var _0x3eea=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2d951f,_0x31af3e){var _0x20a728=function(_0x1dc819){while(--_0x1dc819){_0x2d951f['push'](_0x2d951f['shift']());}};_0x20a728(++_0x31af3e);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x22f07d,_0xb02a4b){_0x22f07d=_0x22f07d-0x0;var _0x51f8df=_0x3eea[_0x22f07d];return _0x51f8df;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var fs_extra=require(_0xa3ee('0x5'));var auth=require(_0xa3ee('0x6'));var interaction=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var controller=require(_0xa3ee('0x9'));router[_0xa3ee('0xa')]('/',auth[_0xa3ee('0xb')](),controller['index']);router['get'](_0xa3ee('0xc'),auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['get'](_0xa3ee('0xe'),auth['isAuthenticated'](),controller[_0xa3ee('0xf')]);router['post']('/',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x10')]);router[_0xa3ee('0x11')]('/:id',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x12')]);router['delete']('/:id',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x13')]);module[_0xa3ee('0x14')]=router;
\ No newline at end of file
index b59c262..9fbbd68 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x98d1=['dialer','DATE','INTEGER','sequelize','STRING','inbound','internal','inbound-fax','outbound-fax'];(function(_0x54c889,_0x5a11e7){var _0x5c733c=function(_0x1dced5){while(--_0x1dced5){_0x54c889['push'](_0x54c889['shift']());}};_0x5c733c(++_0x5a11e7);}(_0x98d1,0x13e));var _0x198d=function(_0x1d4601,_0x5aeeb9){_0x1d4601=_0x1d4601-0x0;var _0x681636=_0x98d1[_0x1d4601];return _0x681636;};'use strict';var Sequelize=require(_0x198d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x198d('0x1')]},'type':{'type':Sequelize['ENUM'](_0x198d('0x2'),_0x198d('0x3'),'outbound',_0x198d('0x4'),_0x198d('0x5'),_0x198d('0x6'))},'tag':{'type':Sequelize[_0x198d('0x1')]},'accountcode':{'type':Sequelize[_0x198d('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x198d('0x1')]},'destinationcontext':{'type':Sequelize[_0x198d('0x1')]},'callerid':{'type':Sequelize[_0x198d('0x1')]},'channel':{'type':Sequelize[_0x198d('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x198d('0x7')]},'systemanswertime':{'type':Sequelize[_0x198d('0x7')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x198d('0x7')]},'duration':{'type':Sequelize[_0x198d('0x8')]},'billableseconds':{'type':Sequelize[_0x198d('0x8')]},'mohtime':{'type':Sequelize[_0x198d('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x198d('0x1')]},'amaflags':{'type':Sequelize[_0x198d('0x1')]},'userfield':{'type':Sequelize[_0x198d('0x1')]},'userDisposition':{'type':Sequelize[_0x198d('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x198d('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x198d('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x198d('0x8')]},'sipcallid':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x56e4=['STRING','internal','inbound-fax','outbound-fax','DATE','INTEGER','exports'];(function(_0x21f13e,_0x2c7cda){var _0x7804d4=function(_0x261863){while(--_0x261863){_0x21f13e['push'](_0x21f13e['shift']());}};_0x7804d4(++_0x2c7cda);}(_0x56e4,0x92));var _0x456e=function(_0x2617ce,_0x38edc8){_0x2617ce=_0x2617ce-0x0;var _0x56273e=_0x56e4[_0x2617ce];return _0x56273e;};'use strict';var Sequelize=require('sequelize');module[_0x456e('0x0')]={'uniqueid':{'type':Sequelize[_0x456e('0x1')]},'type':{'type':Sequelize['ENUM']('inbound',_0x456e('0x2'),'outbound',_0x456e('0x3'),_0x456e('0x4'),'dialer')},'tag':{'type':Sequelize[_0x456e('0x1')]},'accountcode':{'type':Sequelize[_0x456e('0x1')]},'source':{'type':Sequelize[_0x456e('0x1')]},'destination':{'type':Sequelize[_0x456e('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x456e('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x456e('0x1')]},'lastapplication':{'type':Sequelize[_0x456e('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x456e('0x5')]},'systemanswertime':{'type':Sequelize[_0x456e('0x5')]},'answertime':{'type':Sequelize[_0x456e('0x5')]},'endtime':{'type':Sequelize[_0x456e('0x5')]},'duration':{'type':Sequelize[_0x456e('0x6')]},'billableseconds':{'type':Sequelize[_0x456e('0x6')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x456e('0x1')]},'userfield':{'type':Sequelize[_0x456e('0x1')]},'userDisposition':{'type':Sequelize[_0x456e('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x456e('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x456e('0x1')]},'note':{'type':Sequelize[_0x456e('0x1')]},'prefix':{'type':Sequelize[_0x456e('0x1')]},'routeid':{'type':Sequelize[_0x456e('0x6')]},'sipcallid':{'type':Sequelize[_0x456e('0x1')]}};
\ No newline at end of file
index c77c519..1bbf775 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x5c9e02,_0x57acab){var _0x2b5f3d=function(_0x46f3e){while(--_0x46f3e){_0x5c9e02['push'](_0x5c9e02['shift']());}};_0x2b5f3d(++_0x57acab);}(_0xb10b,0x12a));var _0xbb10=function(_0x2fcd90,_0x4780cc){_0x2fcd90=_0x2fcd90-0x0;var _0x55b596=_0xb10b[_0x2fcd90];return _0x55b596;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));};
\ No newline at end of file
+var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0xadb5,0xad));var _0x5adb=function(_0x237d42,_0x496e52){_0x237d42=_0x237d42-0x0;var _0x25e558=_0xadb5[_0x237d42];return _0x25e558;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));};
\ No newline at end of file
index c09f809..03e8e30 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0f6c=['VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x0f6c,0x1bd));var _0xc0f6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0f6c[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xc0f6('0x0'));var logger=require(_0xc0f6('0x1'))(_0xc0f6('0x2'));var moment=require(_0xc0f6('0x3'));var BPromise=require(_0xc0f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0f6('0x5'));var rimraf=require('rimraf');var config=require(_0xc0f6('0x6'));var attributes=require(_0xc0f6('0x7'));module[_0xc0f6('0x8')]=function(_0x3a8c33,_0x487924){return _0x3a8c33[_0xc0f6('0x9')](_0xc0f6('0xa'),attributes,{'tableName':_0xc0f6('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc0f6('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xdd70=['VoiceCallReport','report_call','lodash','util','api','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0x40d1ba,_0x3cb77c){var _0x565261=function(_0x1a5b54){while(--_0x1a5b54){_0x40d1ba['push'](_0x40d1ba['shift']());}};_0x565261(++_0x3cb77c);}(_0xdd70,0x7a));var _0x0dd7=function(_0x452764,_0x33ba68){_0x452764=_0x452764-0x0;var _0x17bbad=_0xdd70[_0x452764];return _0x17bbad;};'use strict';var _=require(_0x0dd7('0x0'));var util=require(_0x0dd7('0x1'));var logger=require('../../config/logger')(_0x0dd7('0x2'));var moment=require('moment');var BPromise=require(_0x0dd7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0dd7('0x4'));var rimraf=require(_0x0dd7('0x5'));var config=require(_0x0dd7('0x6'));var attributes=require(_0x0dd7('0x7'));module[_0x0dd7('0x8')]=function(_0xb18522,_0x14e232){return _0xb18522[_0x0dd7('0x9')](_0x0dd7('0xa'),attributes,{'tableName':_0x0dd7('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
index 3beb54f..81e5d35 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc844=['stringify','error','code','message','result','catch','options','attributes','limit','include','map','then','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','create','raw','info','UpdateVoiceCallReport','update','body','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3742e7,_0x117e88){var _0x389d14=function(_0x4857fe){while(--_0x4857fe){_0x3742e7['push'](_0x3742e7['shift']());}};_0x389d14(++_0x117e88);}(_0xc844,0x1d0));var _0x4c84=function(_0x352651,_0x13dabf){_0x352651=_0x352651-0x0;var _0x343273=_0xc844[_0x352651];return _0x343273;};'use strict';var _=require(_0x4c84('0x0'));var util=require('util');var moment=require(_0x4c84('0x1'));var BPromise=require(_0x4c84('0x2'));var rs=require(_0x4c84('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c84('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c84('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4c84('0x6'));var client=jayson[_0x4c84('0x7')][_0x4c84('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4487dd,_0x98dbfb,_0x2f7114){return new BPromise(function(_0x366810,_0x3980e6){return client['request'](_0x4487dd,_0x2f7114)['then'](function(_0x280950){logger['info'](_0x4c84('0x9'),_0x98dbfb,_0x4c84('0xa'));logger[_0x4c84('0xb')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x98dbfb,'request\x20sent',JSON[_0x4c84('0xc')](_0x280950));if(_0x280950[_0x4c84('0xd')]){if(_0x280950['error'][_0x4c84('0xe')]===0x1f4){logger[_0x4c84('0xd')](_0x4c84('0x9'),_0x98dbfb,_0x280950[_0x4c84('0xd')][_0x4c84('0xf')]);return _0x3980e6(_0x280950['error'][_0x4c84('0xf')]);}logger[_0x4c84('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x98dbfb,_0x280950[_0x4c84('0xd')]['message']);return _0x366810(_0x280950['error'][_0x4c84('0xf')]);}else{logger['info'](_0x4c84('0x9'),_0x98dbfb,_0x4c84('0xa'));_0x366810(_0x280950[_0x4c84('0x10')][_0x4c84('0xf')]);}})[_0x4c84('0x11')](function(_0xd4e0f0){logger['error'](_0x4c84('0x9'),_0x98dbfb,_0xd4e0f0);_0x3980e6(_0xd4e0f0);});});}exports['GetVoiceCallReport']=function(_0x20f326){var _0x59a31f=this;return new Promise(function(_0x998580,_0x5c5dce){return db['VoiceCallReport']['findAll']({'raw':_0x20f326[_0x4c84('0x12')]?_0x20f326[_0x4c84('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x20f326[_0x4c84('0x12')]?_0x20f326[_0x4c84('0x12')]['where']||null:null,'attributes':_0x20f326[_0x4c84('0x12')]?_0x20f326[_0x4c84('0x12')][_0x4c84('0x13')]||null:null,'limit':_0x20f326[_0x4c84('0x12')]?_0x20f326['options'][_0x4c84('0x14')]||null:null,'include':_0x20f326[_0x4c84('0x12')]?_0x20f326[_0x4c84('0x12')][_0x4c84('0x15')]?_[_0x4c84('0x16')](_0x20f326['options'][_0x4c84('0x15')],function(_0x552716){return{'model':db[_0x552716['model']],'as':_0x552716['as'],'attributes':_0x552716[_0x4c84('0x13')],'include':_0x552716[_0x4c84('0x15')]?_['map'](_0x552716[_0x4c84('0x15')],function(_0xf479f4){return{'model':db[_0xf479f4['model']],'as':_0xf479f4['as'],'attributes':_0xf479f4[_0x4c84('0x13')],'include':_0xf479f4['include']?_[_0x4c84('0x16')](_0xf479f4[_0x4c84('0x15')],function(_0x31a515){return{'model':db[_0x31a515['model']],'as':_0x31a515['as'],'attributes':_0x31a515[_0x4c84('0x13')]};}):[]};}):[]};}):[]:[]})[_0x4c84('0x17')](function(_0x5dff0e){logger['info'](_0x4c84('0x18'),_0x20f326);logger[_0x4c84('0xb')]('GetVoiceCallReport',_0x20f326,JSON['stringify'](_0x5dff0e));_0x998580(_0x5dff0e);})[_0x4c84('0x11')](function(_0x294c8e){logger[_0x4c84('0xd')](_0x4c84('0x18'),_0x294c8e[_0x4c84('0xf')],_0x20f326);_0x5c5dce(_0x59a31f[_0x4c84('0xd')](0x1f4,_0x294c8e[_0x4c84('0xf')]));});});};exports[_0x4c84('0x19')]=function(_0x5a8743){var _0x3fe686=this;return new Promise(function(_0x3c3d0b,_0x29aece){return db[_0x4c84('0x1a')][_0x4c84('0x1b')](_0x5a8743['body'],{'raw':_0x5a8743['options']?_0x5a8743[_0x4c84('0x12')][_0x4c84('0x1c')]===undefined?!![]:![]:!![]})[_0x4c84('0x17')](function(_0x2d3fc5){logger[_0x4c84('0x1d')](_0x4c84('0x19'),_0x5a8743);logger[_0x4c84('0xb')](_0x4c84('0x19'),_0x5a8743,JSON[_0x4c84('0xc')](_0x2d3fc5));_0x3c3d0b(_0x2d3fc5);})[_0x4c84('0x11')](function(_0xac132d){logger['error'](_0x4c84('0x19'),_0xac132d[_0x4c84('0xf')],_0x5a8743);_0x29aece(_0x3fe686[_0x4c84('0xd')](0x1f4,_0xac132d[_0x4c84('0xf')]));});});};exports[_0x4c84('0x1e')]=function(_0x45a211){var _0x2a1b7c=this;return new Promise(function(_0x32d166,_0x4766a9){return db['VoiceCallReport'][_0x4c84('0x1f')](_0x45a211[_0x4c84('0x20')],{'raw':_0x45a211[_0x4c84('0x12')]?_0x45a211[_0x4c84('0x12')][_0x4c84('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45a211[_0x4c84('0x12')]?_0x45a211['options'][_0x4c84('0x21')]||null:null,'attributes':_0x45a211[_0x4c84('0x12')]?_0x45a211[_0x4c84('0x12')][_0x4c84('0x13')]||null:null,'limit':_0x45a211[_0x4c84('0x12')]?_0x45a211['options']['limit']||null:null})['then'](function(_0x3b49b0){logger[_0x4c84('0x1d')](_0x4c84('0x1e'),_0x45a211);logger[_0x4c84('0xb')](_0x4c84('0x1e'),_0x45a211,JSON[_0x4c84('0xc')](_0x3b49b0));_0x32d166(_0x3b49b0);})[_0x4c84('0x11')](function(_0x40ca6a){logger[_0x4c84('0xd')](_0x4c84('0x1e'),_0x40ca6a[_0x4c84('0xf')],_0x45a211);_0x4766a9(_0x2a1b7c[_0x4c84('0xd')](0x1f4,_0x40ca6a[_0x4c84('0xf')]));});});};
\ No newline at end of file
+var _0x3c1e=['model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map'];(function(_0x2563f7,_0x4daa86){var _0x4d65fd=function(_0x4caf7d){while(--_0x4caf7d){_0x2563f7['push'](_0x2563f7['shift']());}};_0x4d65fd(++_0x4daa86);}(_0x3c1e,0x1b3));var _0xe3c1=function(_0x1c5268,_0x3c13f8){_0x1c5268=_0x1c5268-0x0;var _0xf9603=_0x3c1e[_0x1c5268];return _0xf9603;};'use strict';var _=require(_0xe3c1('0x0'));var util=require(_0xe3c1('0x1'));var moment=require(_0xe3c1('0x2'));var BPromise=require('bluebird');var rs=require(_0xe3c1('0x3'));var fs=require('fs');var Redis=require(_0xe3c1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe3c1('0x5'));var logger=require(_0xe3c1('0x6'))(_0xe3c1('0x7'));var config=require(_0xe3c1('0x8'));var jayson=require(_0xe3c1('0x9'));var client=jayson[_0xe3c1('0xa')][_0xe3c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xab2770,_0x1952d0,_0x25a681){return new BPromise(function(_0x397a8c,_0xcedf32){return client[_0xe3c1('0xc')](_0xab2770,_0x25a681)[_0xe3c1('0xd')](function(_0x3be024){logger['info'](_0xe3c1('0xe'),_0x1952d0,_0xe3c1('0xf'));logger[_0xe3c1('0x10')](_0xe3c1('0x11'),_0x1952d0,'request\x20sent',JSON[_0xe3c1('0x12')](_0x3be024));if(_0x3be024[_0xe3c1('0x13')]){if(_0x3be024[_0xe3c1('0x13')]['code']===0x1f4){logger[_0xe3c1('0x13')](_0xe3c1('0xe'),_0x1952d0,_0x3be024['error'][_0xe3c1('0x14')]);return _0xcedf32(_0x3be024[_0xe3c1('0x13')][_0xe3c1('0x14')]);}logger[_0xe3c1('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x1952d0,_0x3be024['error'][_0xe3c1('0x14')]);return _0x397a8c(_0x3be024[_0xe3c1('0x13')]['message']);}else{logger[_0xe3c1('0x15')](_0xe3c1('0xe'),_0x1952d0,_0xe3c1('0xf'));_0x397a8c(_0x3be024[_0xe3c1('0x16')][_0xe3c1('0x14')]);}})[_0xe3c1('0x17')](function(_0x461110){logger[_0xe3c1('0x13')](_0xe3c1('0xe'),_0x1952d0,_0x461110);_0xcedf32(_0x461110);});});}exports[_0xe3c1('0x18')]=function(_0x4e1b89){var _0x57f759=this;return new Promise(function(_0x2f12c9,_0x398127){return db[_0xe3c1('0x19')]['findAll']({'raw':_0x4e1b89[_0xe3c1('0x1a')]?_0x4e1b89['options'][_0xe3c1('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e1b89['options']?_0x4e1b89['options'][_0xe3c1('0x1c')]||null:null,'attributes':_0x4e1b89[_0xe3c1('0x1a')]?_0x4e1b89[_0xe3c1('0x1a')][_0xe3c1('0x1d')]||null:null,'limit':_0x4e1b89['options']?_0x4e1b89[_0xe3c1('0x1a')][_0xe3c1('0x1e')]||null:null,'include':_0x4e1b89[_0xe3c1('0x1a')]?_0x4e1b89[_0xe3c1('0x1a')][_0xe3c1('0x1f')]?_[_0xe3c1('0x20')](_0x4e1b89['options']['include'],function(_0x20435c){return{'model':db[_0x20435c[_0xe3c1('0x21')]],'as':_0x20435c['as'],'attributes':_0x20435c['attributes'],'include':_0x20435c[_0xe3c1('0x1f')]?_[_0xe3c1('0x20')](_0x20435c[_0xe3c1('0x1f')],function(_0x2415fb){return{'model':db[_0x2415fb[_0xe3c1('0x21')]],'as':_0x2415fb['as'],'attributes':_0x2415fb[_0xe3c1('0x1d')],'include':_0x2415fb[_0xe3c1('0x1f')]?_[_0xe3c1('0x20')](_0x2415fb[_0xe3c1('0x1f')],function(_0xae9520){return{'model':db[_0xae9520['model']],'as':_0xae9520['as'],'attributes':_0xae9520[_0xe3c1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe3c1('0xd')](function(_0x4e9578){logger[_0xe3c1('0x15')](_0xe3c1('0x18'),_0x4e1b89);logger[_0xe3c1('0x10')](_0xe3c1('0x18'),_0x4e1b89,JSON['stringify'](_0x4e9578));_0x2f12c9(_0x4e9578);})[_0xe3c1('0x17')](function(_0x16a304){logger[_0xe3c1('0x13')](_0xe3c1('0x18'),_0x16a304[_0xe3c1('0x14')],_0x4e1b89);_0x398127(_0x57f759[_0xe3c1('0x13')](0x1f4,_0x16a304[_0xe3c1('0x14')]));});});};exports[_0xe3c1('0x22')]=function(_0x647d98){var _0x4b0d95=this;return new Promise(function(_0xa33a3,_0x3f209d){return db[_0xe3c1('0x19')][_0xe3c1('0x23')](_0x647d98[_0xe3c1('0x24')],{'raw':_0x647d98[_0xe3c1('0x1a')]?_0x647d98[_0xe3c1('0x1a')][_0xe3c1('0x1b')]===undefined?!![]:![]:!![]})[_0xe3c1('0xd')](function(_0x38106c){logger[_0xe3c1('0x15')]('CreateVoiceCallReport',_0x647d98);logger['debug']('CreateVoiceCallReport',_0x647d98,JSON[_0xe3c1('0x12')](_0x38106c));_0xa33a3(_0x38106c);})[_0xe3c1('0x17')](function(_0x252f67){logger[_0xe3c1('0x13')]('CreateVoiceCallReport',_0x252f67['message'],_0x647d98);_0x3f209d(_0x4b0d95[_0xe3c1('0x13')](0x1f4,_0x252f67[_0xe3c1('0x14')]));});});};exports[_0xe3c1('0x25')]=function(_0x154d0a){var _0x2809a4=this;return new Promise(function(_0x9cbcb1,_0x118e09){return db['VoiceCallReport'][_0xe3c1('0x26')](_0x154d0a[_0xe3c1('0x24')],{'raw':_0x154d0a[_0xe3c1('0x1a')]?_0x154d0a[_0xe3c1('0x1a')][_0xe3c1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x154d0a[_0xe3c1('0x1a')]?_0x154d0a[_0xe3c1('0x1a')][_0xe3c1('0x1c')]||null:null,'attributes':_0x154d0a[_0xe3c1('0x1a')]?_0x154d0a[_0xe3c1('0x1a')][_0xe3c1('0x1d')]||null:null,'limit':_0x154d0a[_0xe3c1('0x1a')]?_0x154d0a[_0xe3c1('0x1a')]['limit']||null:null})[_0xe3c1('0xd')](function(_0x55ec0c){logger[_0xe3c1('0x15')](_0xe3c1('0x25'),_0x154d0a);logger['debug'](_0xe3c1('0x25'),_0x154d0a,JSON[_0xe3c1('0x12')](_0x55ec0c));_0x9cbcb1(_0x55ec0c);})[_0xe3c1('0x17')](function(_0x3248a1){logger[_0xe3c1('0x13')]('UpdateVoiceCallReport',_0x3248a1[_0xe3c1('0x14')],_0x154d0a);_0x118e09(_0x2809a4[_0xe3c1('0x13')](0x1f4,_0x3248a1[_0xe3c1('0x14')]));});});};
\ No newline at end of file
index f2fb922..8caae93 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xde4c=['post','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','get','/:id','show'];(function(_0x445101,_0x2414bf){var _0x3c3d04=function(_0x249067){while(--_0x249067){_0x445101['push'](_0x445101['shift']());}};_0x3c3d04(++_0x2414bf);}(_0xde4c,0x72));var _0xcde4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde4c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xcde4('0x0'));var util=require('util');var path=require(_0xcde4('0x1'));var timeout=require('connect-timeout');var express=require(_0xcde4('0x2'));var router=express['Router']();var fs_extra=require(_0xcde4('0x3'));var auth=require(_0xcde4('0x4'));var interaction=require(_0xcde4('0x5'));var config=require(_0xcde4('0x6'));var controller=require(_0xcde4('0x7'));router['get']('/',auth[_0xcde4('0x8')](),controller['index']);router[_0xcde4('0x9')](_0xcde4('0xa'),auth['isAuthenticated'](),controller[_0xcde4('0xb')]);router[_0xcde4('0xc')]('/',auth[_0xcde4('0x8')](),controller['create']);router[_0xcde4('0xd')]('/:id',auth[_0xcde4('0x8')](),controller[_0xcde4('0xe')]);router[_0xcde4('0xf')]('/:id',auth[_0xcde4('0x8')](),controller[_0xcde4('0x10')]);module[_0xcde4('0x11')]=router;
\ No newline at end of file
+var _0x3a4d=['multer','util','path','express','fs-extra','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x3a4d,0x110));var _0xd3a4=function(_0x4aa662,_0x1cc90c){_0x4aa662=_0x4aa662-0x0;var _0x336478=_0x3a4d[_0x4aa662];return _0x336478;};'use strict';var multer=require(_0xd3a4('0x0'));var util=require(_0xd3a4('0x1'));var path=require(_0xd3a4('0x2'));var timeout=require('connect-timeout');var express=require(_0xd3a4('0x3'));var router=express['Router']();var fs_extra=require(_0xd3a4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd3a4('0x5'));var config=require('../../config/environment');var controller=require(_0xd3a4('0x6'));router[_0xd3a4('0x7')]('/',auth[_0xd3a4('0x8')](),controller[_0xd3a4('0x9')]);router['get'](_0xd3a4('0xa'),auth['isAuthenticated'](),controller[_0xd3a4('0xb')]);router[_0xd3a4('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xd3a4('0xa'),auth['isAuthenticated'](),controller[_0xd3a4('0xd')]);router[_0xd3a4('0xe')](_0xd3a4('0xa'),auth[_0xd3a4('0x8')](),controller[_0xd3a4('0xf')]);module[_0xd3a4('0x10')]=router;
\ No newline at end of file
index 580030c..381a777 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f1e=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options','join','getDataValue'];(function(_0xb03ba8,_0x48b05a){var _0xf5ca20=function(_0x561ba6){while(--_0x561ba6){_0xb03ba8['push'](_0xb03ba8['shift']());}};_0xf5ca20(++_0x48b05a);}(_0x5f1e,0x138));var _0xe5f1=function(_0x163dd5,_0x10b589){_0x163dd5=_0x163dd5-0x0;var _0x335b8b=_0x5f1e[_0x163dd5];return _0x335b8b;};'use strict';var Sequelize=require(_0xe5f1('0x0'));module[_0xe5f1('0x1')]={'name':{'type':Sequelize[_0xe5f1('0x2')]},'prefix':{'type':Sequelize[_0xe5f1('0x2')],'unique':_0xe5f1('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xe5f1('0x2')],'set':function(_0x11c69e){this[_0xe5f1('0x4')](_0xe5f1('0x5'),_0x11c69e?_0x11c69e[_0xe5f1('0x6')](''):[]);},'get':function(){return this[_0xe5f1('0x7')](_0xe5f1('0x5'))?this['getDataValue'](_0xe5f1('0x5'))[_0xe5f1('0x8')](''):[];}},'auth':{'type':Sequelize[_0xe5f1('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xe5f1('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe5f1('0x2')]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x55cb=['split','sequelize','exports','STRING','setDataValue','getDataValue','options'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x55cb,0x1eb));var _0xb55c=function(_0xcb0eb2,_0x3906bf){_0xcb0eb2=_0xcb0eb2-0x0;var _0xbab9b8=_0x55cb[_0xcb0eb2];return _0xbab9b8;};'use strict';var Sequelize=require(_0xb55c('0x0'));module[_0xb55c('0x1')]={'name':{'type':Sequelize[_0xb55c('0x2')]},'prefix':{'type':Sequelize[_0xb55c('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xb55c('0x2')],'set':function(_0x158898){this[_0xb55c('0x3')]('options',_0x158898?_0x158898['join'](''):[]);},'get':function(){return this[_0xb55c('0x4')](_0xb55c('0x5'))?this[_0xb55c('0x4')](_0xb55c('0x5'))[_0xb55c('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xb55c('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb55c('0x2')]},'description':{'type':Sequelize[_0xb55c('0x2')]}};
\ No newline at end of file
index 0875710..3c3cbb7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x18a9=['find','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','save','update','destroy','then','get','ChanSpies','end','error','stack','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key','map','name','query','keys','filters','model','attributes','length','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','params','intersection','fields','include','create','user','role','UserProfileSection'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0x18a9,0x15b));var _0x918a=function(_0x146878,_0x1fbf48){_0x146878=_0x146878-0x0;var _0x5bd309=_0x18a9[_0x146878];return _0x5bd309;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x918a('0x0'));var jsonpatch=require(_0x918a('0x1'));var rp=require(_0x918a('0x2'));var moment=require(_0x918a('0x3'));var BPromise=require(_0x918a('0x4'));var Mustache=require(_0x918a('0x5'));var util=require(_0x918a('0x6'));var path=require(_0x918a('0x7'));var sox=require(_0x918a('0x8'));var csv=require(_0x918a('0x9'));var ejs=require(_0x918a('0xa'));var fs=require('fs');var fs_extra=require(_0x918a('0xb'));var _=require('lodash');var squel=require(_0x918a('0xc'));var crypto=require(_0x918a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x918a('0xe'));var toCsv=require(_0x918a('0x9'));var querystring=require(_0x918a('0xf'));var Papa=require(_0x918a('0x10'));var Redis=require(_0x918a('0x11'));var authService=require(_0x918a('0x12'));var qs=require(_0x918a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x918a('0x14'));var logger=require(_0x918a('0x15'))(_0x918a('0x16'));var utils=require(_0x918a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x918a('0x18'));var db=require(_0x918a('0x19'))['db'];function respondWithStatusCode(_0x5c0f68,_0x36f4aa){_0x36f4aa=_0x36f4aa||0xcc;return function(_0x3e4490){if(_0x3e4490){return _0x5c0f68[_0x918a('0x1a')](_0x36f4aa);}return _0x5c0f68[_0x918a('0x1b')](_0x36f4aa)['end']();};}function respondWithResult(_0x162d88,_0x55c90e){_0x55c90e=_0x55c90e||0xc8;return function(_0x19583e){if(_0x19583e){return _0x162d88['status'](_0x55c90e)['json'](_0x19583e);}};}function respondWithFilteredResult(_0x325a8f,_0x22bd74){return function(_0x47ce2d){if(_0x47ce2d){var _0x355174=typeof _0x22bd74['offset']===_0x918a('0x1c')&&typeof _0x22bd74[_0x918a('0x1d')]===_0x918a('0x1c');var _0x4ae164=_0x47ce2d[_0x918a('0x1e')];var _0x51e467=_0x355174?0x0:_0x22bd74[_0x918a('0x1f')];var _0x22e347=_0x355174?_0x47ce2d[_0x918a('0x1e')]:_0x22bd74[_0x918a('0x1f')]+_0x22bd74['limit'];var _0x21a4a3;if(_0x22e347>=_0x4ae164){_0x22e347=_0x4ae164;_0x21a4a3=0xc8;}else{_0x21a4a3=0xce;}_0x325a8f[_0x918a('0x1b')](_0x21a4a3);return _0x325a8f[_0x918a('0x20')](_0x918a('0x21'),_0x51e467+'-'+_0x22e347+'/'+_0x4ae164)[_0x918a('0x22')](_0x47ce2d);}return null;};}function patchUpdates(_0x161142){return function(_0x2cf02b){try{jsonpatch['apply'](_0x2cf02b,_0x161142,!![]);}catch(_0x17acb7){return BPromise['reject'](_0x17acb7);}return _0x2cf02b[_0x918a('0x23')]();};}function saveUpdates(_0x4961fb,_0x4c5993){return function(_0x4c7675){if(_0x4c7675){return _0x4c7675[_0x918a('0x24')](_0x4961fb)['then'](function(_0x32a67d){return _0x32a67d;});}return null;};}function removeEntity(_0xd40a6c,_0xadd3bc){return function(_0x2d8077){if(_0x2d8077){return _0x2d8077[_0x918a('0x25')]()[_0x918a('0x26')](function(){var _0x1eca72=_0x2d8077[_0x918a('0x27')]({'plain':!![]});var _0xfdad4a=_0x918a('0x28');return db['UserProfileResource'][_0x918a('0x25')]({'where':{'type':_0xfdad4a,'resourceId':_0x1eca72['id']}})[_0x918a('0x26')](function(){return _0x2d8077;});})[_0x918a('0x26')](function(){_0xd40a6c['status'](0xcc)[_0x918a('0x29')]();});}};}function handleEntityNotFound(_0x36f103,_0x2728f2){return function(_0x549cb4){if(!_0x549cb4){_0x36f103[_0x918a('0x1a')](0x194);}return _0x549cb4;};}function handleError(_0x158f4e,_0x181c66){_0x181c66=_0x181c66||0x1f4;return function(_0x2a4e28){logger[_0x918a('0x2a')](_0x2a4e28[_0x918a('0x2b')]);if(_0x2a4e28['name']){delete _0x2a4e28['name'];}_0x158f4e['status'](_0x181c66)[_0x918a('0x2c')](_0x2a4e28);};}exports[_0x918a('0x2d')]=function(_0x5e09fd,_0x1dd40a){var _0x85573f={},_0x5b023f={},_0x5c7d95={'count':0x0,'rows':[]};var _0x3eb065=_['map'](db[_0x918a('0x2e')][_0x918a('0x2f')],function(_0x17fdfc){return{'name':_0x17fdfc[_0x918a('0x30')],'type':_0x17fdfc[_0x918a('0x31')][_0x918a('0x32')]};});_0x5b023f['model']=_[_0x918a('0x33')](_0x3eb065,_0x918a('0x34'));_0x5b023f[_0x918a('0x35')]=_[_0x918a('0x36')](_0x5e09fd[_0x918a('0x35')]);_0x5b023f[_0x918a('0x37')]=_['intersection'](_0x5b023f[_0x918a('0x38')],_0x5b023f[_0x918a('0x35')]);_0x85573f[_0x918a('0x39')]=_['intersection'](_0x5b023f[_0x918a('0x38')],qs['fields'](_0x5e09fd[_0x918a('0x35')]['fields']));_0x85573f[_0x918a('0x39')]=_0x85573f[_0x918a('0x39')][_0x918a('0x3a')]?_0x85573f[_0x918a('0x39')]:_0x5b023f[_0x918a('0x38')];if(!_0x5e09fd['query']['hasOwnProperty'](_0x918a('0x3b'))){_0x85573f[_0x918a('0x1d')]=qs['limit'](_0x5e09fd[_0x918a('0x35')][_0x918a('0x1d')]);_0x85573f[_0x918a('0x1f')]=qs[_0x918a('0x1f')](_0x5e09fd[_0x918a('0x35')][_0x918a('0x1f')]);}_0x85573f[_0x918a('0x3c')]=qs['sort'](_0x5e09fd[_0x918a('0x35')]['sort']);_0x85573f['where']=qs[_0x918a('0x37')](_[_0x918a('0x3d')](_0x5e09fd[_0x918a('0x35')],_0x5b023f[_0x918a('0x37')]),_0x3eb065);if(_0x5e09fd['query'][_0x918a('0x3e')]){_0x85573f[_0x918a('0x3f')]=_[_0x918a('0x40')](_0x85573f[_0x918a('0x3f')],{'$or':_[_0x918a('0x33')](_0x3eb065,function(_0x57654b){if(_0x57654b[_0x918a('0x31')]!==_0x918a('0x41')){var _0xd69e25={};_0xd69e25[_0x57654b[_0x918a('0x34')]]={'$like':'%'+_0x5e09fd[_0x918a('0x35')][_0x918a('0x3e')]+'%'};return _0xd69e25;}})});}_0x85573f=_[_0x918a('0x40')]({},_0x85573f,_0x5e09fd[_0x918a('0x42')]);var _0x2b14de={'where':_0x85573f['where']};return db[_0x918a('0x2e')][_0x918a('0x1e')](_0x2b14de)[_0x918a('0x26')](function(_0x4440bd){_0x5c7d95[_0x918a('0x1e')]=_0x4440bd;if(_0x5e09fd[_0x918a('0x35')][_0x918a('0x43')]){_0x85573f['include']=[{'all':!![]}];}return db[_0x918a('0x2e')][_0x918a('0x44')](_0x85573f);})[_0x918a('0x26')](function(_0x44c419){_0x5c7d95['rows']=_0x44c419;return _0x5c7d95;})[_0x918a('0x26')](respondWithFilteredResult(_0x1dd40a,_0x85573f))['catch'](handleError(_0x1dd40a,null));};exports[_0x918a('0x45')]=function(_0x39ae4e,_0x4943c2){var _0x4cb061={'raw':![],'where':{'id':_0x39ae4e[_0x918a('0x46')]['id']}},_0x424b2c={};_0x424b2c[_0x918a('0x38')]=_[_0x918a('0x36')](db['VoiceChanSpy']['rawAttributes']);_0x424b2c[_0x918a('0x35')]=_[_0x918a('0x36')](_0x39ae4e[_0x918a('0x35')]);_0x424b2c[_0x918a('0x37')]=_['intersection'](_0x424b2c['model'],_0x424b2c[_0x918a('0x35')]);_0x4cb061['attributes']=_[_0x918a('0x47')](_0x424b2c[_0x918a('0x38')],qs[_0x918a('0x48')](_0x39ae4e[_0x918a('0x35')][_0x918a('0x48')]));_0x4cb061[_0x918a('0x39')]=_0x4cb061[_0x918a('0x39')][_0x918a('0x3a')]?_0x4cb061[_0x918a('0x39')]:_0x424b2c[_0x918a('0x38')];if(_0x39ae4e[_0x918a('0x35')][_0x918a('0x43')]){_0x4cb061[_0x918a('0x49')]=[{'all':!![]}];}_0x4cb061=_[_0x918a('0x40')]({},_0x4cb061,_0x39ae4e['options']);return db[_0x918a('0x2e')]['find'](_0x4cb061)['then'](handleEntityNotFound(_0x4943c2,null))[_0x918a('0x26')](respondWithResult(_0x4943c2,null))['catch'](handleError(_0x4943c2,null));};exports[_0x918a('0x4a')]=function(_0x31cb92,_0x5e1a6a){return db['VoiceChanSpy'][_0x918a('0x4a')](_0x31cb92['body'],{})[_0x918a('0x26')](function(_0x111437){var _0x30036d=_0x31cb92[_0x918a('0x4b')][_0x918a('0x27')]({'plain':!![]});if(!_0x30036d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30036d[_0x918a('0x4c')]===_0x918a('0x4b')){var _0x3f4103=_0x111437['get']({'plain':!![]});var _0x457c65='ChanSpies';return db[_0x918a('0x4d')][_0x918a('0x4e')]({'where':{'name':_0x457c65,'userProfileId':_0x30036d[_0x918a('0x4f')]},'raw':!![]})[_0x918a('0x26')](function(_0x4d9df1){if(_0x4d9df1&&_0x4d9df1[_0x918a('0x50')]===0x0){return db[_0x918a('0x51')][_0x918a('0x4a')]({'name':_0x3f4103[_0x918a('0x34')],'resourceId':_0x3f4103['id'],'type':_0x4d9df1[_0x918a('0x34')],'sectionId':_0x4d9df1['id']},{})['then'](function(){return _0x111437;});}else{return _0x111437;}})[_0x918a('0x52')](function(_0x217fc7){logger[_0x918a('0x2a')](_0x918a('0x53'),_0x217fc7);throw _0x217fc7;});}return _0x111437;})['then'](respondWithResult(_0x5e1a6a,0xc9))[_0x918a('0x52')](handleError(_0x5e1a6a,null));};exports[_0x918a('0x24')]=function(_0x53961e,_0x295fa5){if(_0x53961e[_0x918a('0x54')]['id']){delete _0x53961e[_0x918a('0x54')]['id'];}return db[_0x918a('0x2e')]['find']({'where':{'id':_0x53961e[_0x918a('0x46')]['id']}})[_0x918a('0x26')](handleEntityNotFound(_0x295fa5,null))[_0x918a('0x26')](saveUpdates(_0x53961e[_0x918a('0x54')],null))[_0x918a('0x26')](respondWithResult(_0x295fa5,null))[_0x918a('0x52')](handleError(_0x295fa5,null));};exports[_0x918a('0x25')]=function(_0xbbff76,_0x11c637){return db[_0x918a('0x2e')][_0x918a('0x4e')]({'where':{'id':_0xbbff76[_0x918a('0x46')]['id']}})[_0x918a('0x26')](handleEntityNotFound(_0x11c637,null))[_0x918a('0x26')](removeEntity(_0x11c637,null))[_0x918a('0x52')](handleError(_0x11c637,null));};
\ No newline at end of file
+var _0x67da=['json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','ChanSpies','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceChanSpy','include','findAll','catch','params','intersection','length','includeAll','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status'];(function(_0xef0ce4,_0x5c2cba){var _0x4193c3=function(_0x3aebe9){while(--_0x3aebe9){_0xef0ce4['push'](_0xef0ce4['shift']());}};_0x4193c3(++_0x5c2cba);}(_0x67da,0x192));var _0xa67d=function(_0x1a06c5,_0x5d9861){_0x1a06c5=_0x1a06c5-0x0;var _0x4b7485=_0x67da[_0x1a06c5];return _0x4b7485;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa67d('0x0'));var zipdir=require(_0xa67d('0x1'));var jsonpatch=require(_0xa67d('0x2'));var rp=require(_0xa67d('0x3'));var moment=require(_0xa67d('0x4'));var BPromise=require(_0xa67d('0x5'));var Mustache=require(_0xa67d('0x6'));var util=require(_0xa67d('0x7'));var path=require(_0xa67d('0x8'));var sox=require(_0xa67d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa67d('0xa'));var _=require('lodash');var squel=require(_0xa67d('0xb'));var crypto=require(_0xa67d('0xc'));var jsforce=require(_0xa67d('0xd'));var deskjs=require(_0xa67d('0xe'));var toCsv=require(_0xa67d('0xf'));var querystring=require(_0xa67d('0x10'));var Papa=require(_0xa67d('0x11'));var Redis=require(_0xa67d('0x12'));var authService=require(_0xa67d('0x13'));var qs=require(_0xa67d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa67d('0x15'));var logger=require(_0xa67d('0x16'))(_0xa67d('0x17'));var utils=require(_0xa67d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa67d('0x19'));var db=require(_0xa67d('0x1a'))['db'];function respondWithStatusCode(_0x560485,_0x4e86f6){_0x4e86f6=_0x4e86f6||0xcc;return function(_0x304ee2){if(_0x304ee2){return _0x560485['sendStatus'](_0x4e86f6);}return _0x560485[_0xa67d('0x1b')](_0x4e86f6)['end']();};}function respondWithResult(_0x5d757b,_0x22dcc7){_0x22dcc7=_0x22dcc7||0xc8;return function(_0x3b99e3){if(_0x3b99e3){return _0x5d757b['status'](_0x22dcc7)[_0xa67d('0x1c')](_0x3b99e3);}};}function respondWithFilteredResult(_0x267a67,_0x1cfe81){return function(_0x288e5f){if(_0x288e5f){var _0x5a47de=typeof _0x1cfe81['offset']==='undefined'&&typeof _0x1cfe81['limit']===_0xa67d('0x1d');var _0x553811=_0x288e5f[_0xa67d('0x1e')];var _0xf8422c=_0x5a47de?0x0:_0x1cfe81[_0xa67d('0x1f')];var _0x1b58c3=_0x5a47de?_0x288e5f[_0xa67d('0x1e')]:_0x1cfe81[_0xa67d('0x1f')]+_0x1cfe81[_0xa67d('0x20')];var _0x5538a5;if(_0x1b58c3>=_0x553811){_0x1b58c3=_0x553811;_0x5538a5=0xc8;}else{_0x5538a5=0xce;}_0x267a67[_0xa67d('0x1b')](_0x5538a5);return _0x267a67[_0xa67d('0x21')](_0xa67d('0x22'),_0xf8422c+'-'+_0x1b58c3+'/'+_0x553811)[_0xa67d('0x1c')](_0x288e5f);}return null;};}function patchUpdates(_0x28f38b){return function(_0x1c3498){try{jsonpatch['apply'](_0x1c3498,_0x28f38b,!![]);}catch(_0x3f1898){return BPromise[_0xa67d('0x23')](_0x3f1898);}return _0x1c3498[_0xa67d('0x24')]();};}function saveUpdates(_0xed6c3e,_0x48f240){return function(_0x276ef7){if(_0x276ef7){return _0x276ef7['update'](_0xed6c3e)[_0xa67d('0x25')](function(_0x415141){return _0x415141;});}return null;};}function removeEntity(_0x46bbc8,_0x9c2935){return function(_0x559009){if(_0x559009){return _0x559009[_0xa67d('0x26')]()[_0xa67d('0x25')](function(){var _0x5ed92a=_0x559009[_0xa67d('0x27')]({'plain':!![]});var _0x3dd0b9=_0xa67d('0x28');return db[_0xa67d('0x29')][_0xa67d('0x26')]({'where':{'type':_0x3dd0b9,'resourceId':_0x5ed92a['id']}})[_0xa67d('0x25')](function(){return _0x559009;});})['then'](function(){_0x46bbc8[_0xa67d('0x1b')](0xcc)[_0xa67d('0x2a')]();});}};}function handleEntityNotFound(_0x4e730e,_0x2ac61a){return function(_0x83b547){if(!_0x83b547){_0x4e730e[_0xa67d('0x2b')](0x194);}return _0x83b547;};}function handleError(_0x1e7f28,_0x40f829){_0x40f829=_0x40f829||0x1f4;return function(_0x8793cf){logger[_0xa67d('0x2c')](_0x8793cf[_0xa67d('0x2d')]);if(_0x8793cf[_0xa67d('0x2e')]){delete _0x8793cf[_0xa67d('0x2e')];}_0x1e7f28[_0xa67d('0x1b')](_0x40f829)[_0xa67d('0x2f')](_0x8793cf);};}exports[_0xa67d('0x30')]=function(_0x393269,_0x5e4f04){var _0x2998af={},_0x20c751={},_0x1fc18f={'count':0x0,'rows':[]};var _0x2703f5=_[_0xa67d('0x31')](db['VoiceChanSpy'][_0xa67d('0x32')],function(_0xc2b129){return{'name':_0xc2b129[_0xa67d('0x33')],'type':_0xc2b129[_0xa67d('0x34')][_0xa67d('0x35')]};});_0x20c751[_0xa67d('0x36')]=_[_0xa67d('0x31')](_0x2703f5,_0xa67d('0x2e'));_0x20c751[_0xa67d('0x37')]=_[_0xa67d('0x38')](_0x393269['query']);_0x20c751[_0xa67d('0x39')]=_['intersection'](_0x20c751[_0xa67d('0x36')],_0x20c751[_0xa67d('0x37')]);_0x2998af[_0xa67d('0x3a')]=_['intersection'](_0x20c751[_0xa67d('0x36')],qs[_0xa67d('0x3b')](_0x393269[_0xa67d('0x37')][_0xa67d('0x3b')]));_0x2998af[_0xa67d('0x3a')]=_0x2998af[_0xa67d('0x3a')]['length']?_0x2998af[_0xa67d('0x3a')]:_0x20c751[_0xa67d('0x36')];if(!_0x393269['query']['hasOwnProperty']('nolimit')){_0x2998af[_0xa67d('0x20')]=qs['limit'](_0x393269[_0xa67d('0x37')][_0xa67d('0x20')]);_0x2998af[_0xa67d('0x1f')]=qs[_0xa67d('0x1f')](_0x393269[_0xa67d('0x37')][_0xa67d('0x1f')]);}_0x2998af[_0xa67d('0x3c')]=qs[_0xa67d('0x3d')](_0x393269[_0xa67d('0x37')][_0xa67d('0x3d')]);_0x2998af[_0xa67d('0x3e')]=qs[_0xa67d('0x39')](_[_0xa67d('0x3f')](_0x393269['query'],_0x20c751['filters']),_0x2703f5);if(_0x393269['query'][_0xa67d('0x40')]){_0x2998af['where']=_[_0xa67d('0x41')](_0x2998af[_0xa67d('0x3e')],{'$or':_[_0xa67d('0x31')](_0x2703f5,function(_0x3777ae){if(_0x3777ae['type']!==_0xa67d('0x42')){var _0x46669f={};_0x46669f[_0x3777ae[_0xa67d('0x2e')]]={'$like':'%'+_0x393269[_0xa67d('0x37')][_0xa67d('0x40')]+'%'};return _0x46669f;}})});}_0x2998af=_[_0xa67d('0x41')]({},_0x2998af,_0x393269[_0xa67d('0x43')]);var _0x5b51dc={'where':_0x2998af['where']};return db[_0xa67d('0x44')][_0xa67d('0x1e')](_0x5b51dc)[_0xa67d('0x25')](function(_0x15b9b8){_0x1fc18f[_0xa67d('0x1e')]=_0x15b9b8;if(_0x393269[_0xa67d('0x37')]['includeAll']){_0x2998af[_0xa67d('0x45')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xa67d('0x46')](_0x2998af);})[_0xa67d('0x25')](function(_0x2f698c){_0x1fc18f['rows']=_0x2f698c;return _0x1fc18f;})[_0xa67d('0x25')](respondWithFilteredResult(_0x5e4f04,_0x2998af))[_0xa67d('0x47')](handleError(_0x5e4f04,null));};exports['show']=function(_0x5765a8,_0xcd7852){var _0x5f0af2={'raw':![],'where':{'id':_0x5765a8[_0xa67d('0x48')]['id']}},_0x23f1e1={};_0x23f1e1[_0xa67d('0x36')]=_['keys'](db[_0xa67d('0x44')]['rawAttributes']);_0x23f1e1[_0xa67d('0x37')]=_[_0xa67d('0x38')](_0x5765a8['query']);_0x23f1e1[_0xa67d('0x39')]=_[_0xa67d('0x49')](_0x23f1e1[_0xa67d('0x36')],_0x23f1e1[_0xa67d('0x37')]);_0x5f0af2[_0xa67d('0x3a')]=_[_0xa67d('0x49')](_0x23f1e1[_0xa67d('0x36')],qs[_0xa67d('0x3b')](_0x5765a8['query'][_0xa67d('0x3b')]));_0x5f0af2[_0xa67d('0x3a')]=_0x5f0af2[_0xa67d('0x3a')][_0xa67d('0x4a')]?_0x5f0af2[_0xa67d('0x3a')]:_0x23f1e1['model'];if(_0x5765a8['query'][_0xa67d('0x4b')]){_0x5f0af2[_0xa67d('0x45')]=[{'all':!![]}];}_0x5f0af2=_[_0xa67d('0x41')]({},_0x5f0af2,_0x5765a8[_0xa67d('0x43')]);return db[_0xa67d('0x44')]['find'](_0x5f0af2)[_0xa67d('0x25')](handleEntityNotFound(_0xcd7852,null))['then'](respondWithResult(_0xcd7852,null))[_0xa67d('0x47')](handleError(_0xcd7852,null));};exports[_0xa67d('0x4c')]=function(_0x1c451f,_0x1dba18){return db[_0xa67d('0x44')]['create'](_0x1c451f[_0xa67d('0x4d')],{})[_0xa67d('0x25')](function(_0x348ebd){var _0x5833c2=_0x1c451f[_0xa67d('0x4e')][_0xa67d('0x27')]({'plain':!![]});if(!_0x5833c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5833c2[_0xa67d('0x4f')]===_0xa67d('0x4e')){var _0x51c887=_0x348ebd['get']({'plain':!![]});var _0x21581d=_0xa67d('0x28');return db[_0xa67d('0x50')][_0xa67d('0x51')]({'where':{'name':_0x21581d,'userProfileId':_0x5833c2[_0xa67d('0x52')]},'raw':!![]})[_0xa67d('0x25')](function(_0x355ae2){if(_0x355ae2&&_0x355ae2[_0xa67d('0x53')]===0x0){return db[_0xa67d('0x29')]['create']({'name':_0x51c887[_0xa67d('0x2e')],'resourceId':_0x51c887['id'],'type':_0x355ae2[_0xa67d('0x2e')],'sectionId':_0x355ae2['id']},{})['then'](function(){return _0x348ebd;});}else{return _0x348ebd;}})[_0xa67d('0x47')](function(_0x18f99d){logger['error'](_0xa67d('0x54'),_0x18f99d);throw _0x18f99d;});}return _0x348ebd;})['then'](respondWithResult(_0x1dba18,0xc9))[_0xa67d('0x47')](handleError(_0x1dba18,null));};exports[_0xa67d('0x55')]=function(_0x503413,_0x1de1fb){if(_0x503413[_0xa67d('0x4d')]['id']){delete _0x503413[_0xa67d('0x4d')]['id'];}return db[_0xa67d('0x44')][_0xa67d('0x51')]({'where':{'id':_0x503413[_0xa67d('0x48')]['id']}})[_0xa67d('0x25')](handleEntityNotFound(_0x1de1fb,null))[_0xa67d('0x25')](saveUpdates(_0x503413['body'],null))[_0xa67d('0x25')](respondWithResult(_0x1de1fb,null))[_0xa67d('0x47')](handleError(_0x1de1fb,null));};exports[_0xa67d('0x26')]=function(_0x42fb68,_0x539307){return db[_0xa67d('0x44')][_0xa67d('0x51')]({'where':{'id':_0x42fb68[_0xa67d('0x48')]['id']}})[_0xa67d('0x25')](handleEntityNotFound(_0x539307,null))[_0xa67d('0x25')](removeEntity(_0x539307,null))[_0xa67d('0x47')](handleError(_0x539307,null));};
\ No newline at end of file
index 0340ece..68a28fd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3b29=['models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','context','from-sip','format','%s%s','prefix','merge','Set','chanspy','MixMonitor','recordingFormat','auth','password','push','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','internal','concat','User','findAll','then','catch','exports'];(function(_0x4434aa,_0x20c97c){var _0x580660=function(_0x31c7d6){while(--_0x31c7d6){_0x4434aa['push'](_0x4434aa['shift']());}};_0x580660(++_0x20c97c);}(_0x3b29,0x14b));var _0x93b2=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3b29[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x93b2('0x0'));var util=require(_0x93b2('0x1'));var BPromise=require(_0x93b2('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3c3689,_0xeee62b,_0x511ae0){var _0x1ab883=0x1;var _0x1bc2fc=[];var _0x13ba37={'context':_0xeee62b[_0x93b2('0x3')]||_0x93b2('0x4'),'exten':util[_0x93b2('0x5')](_0x93b2('0x6'),_0x3c3689[_0x93b2('0x7')],_0x511ae0),'type':'system','isApp':![],'ChanSpyId':_0x3c3689['id'],'UserId':_0xeee62b['id']};_0x1bc2fc['push'](_[_0x93b2('0x8')]({'app':_0x93b2('0x9'),'appdata':util['format']('CDR(type)=%s',_0x93b2('0xa')),'priority':_0x1ab883++},_0x13ba37));if(_0x3c3689['record']){_0x1bc2fc['push'](_[_0x93b2('0x8')]({'app':_0x93b2('0xb'),'appdata':util[_0x93b2('0x5')]('${UNIQUEID}.%s,a',_0x3c3689[_0x93b2('0xc')]),'priority':_0x1ab883++},_0x13ba37));}if(_0x3c3689[_0x93b2('0xd')]){_0x1bc2fc['push'](_[_0x93b2('0x8')]({'app':'Authenticate','appdata':_0x3c3689[_0x93b2('0xe')],'priority':_0x1ab883++},_0x13ba37));}_0x1bc2fc[_0x93b2('0xf')](_[_0x93b2('0x8')]({'app':_0x93b2('0x10'),'appdata':util[_0x93b2('0x5')](_0x93b2('0x11'),_0xeee62b[_0x93b2('0x12')],_0x3c3689[_0x93b2('0x13')]?_0x3c3689[_0x93b2('0x13')]['join'](''):''),'priority':_0x1ab883++},_0x13ba37));if(_0x3c3689['record']){_0x1bc2fc[_0x93b2('0xf')](_[_0x93b2('0x8')]({'app':_0x93b2('0x14'),'priority':_0x1ab883++},_0x13ba37));}return _0x1bc2fc;};var getChanSpyApplications=function(_0x57d365,_0x13c16d){var _0x4781b2=[];for(var _0x1d728f=0x0,_0x50d8ad=0x1;_0x1d728f<_0x13c16d[_0x93b2('0x15')];_0x1d728f++,_0x50d8ad=0x1){_0x4781b2=_0x4781b2['concat'](getUserApplications(_0x57d365,_0x13c16d[_0x1d728f],_0x13c16d[_0x1d728f][_0x93b2('0x16')]));if(_0x13c16d[_0x1d728f][_0x93b2('0x16')]!=_0x13c16d[_0x1d728f][_0x93b2('0x12')]){_0x4781b2=_0x4781b2[_0x93b2('0x17')](getUserApplications(_0x57d365,_0x13c16d[_0x1d728f],_0x13c16d[_0x1d728f][_0x93b2('0x12')]));}}return _0x4781b2;};var getChanSpyPromise=function(_0x2da10b,_0x3a7b8a){return new BPromise(function(_0xe56220,_0x291a7d){return _0x2da10b[_0x93b2('0x18')][_0x93b2('0x19')]({'attributes':['id',_0x93b2('0x12'),_0x93b2('0x16')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x93b2('0x1a')](function(_0x199144){if(_0x199144){return _0xe56220(getChanSpyApplications(_0x3a7b8a,_0x199144));}return _0xe56220([]);})[_0x93b2('0x1b')](function(_0x5ef941){_0x291a7d(_0x5ef941);});});};module[_0x93b2('0x1c')]=function(_0x3ffba2,_0x4f428b){var _0x1dd760=_0x3ffba2[_0x93b2('0x1d')];return _0x3ffba2[_0x93b2('0x1e')](_0x93b2('0x1f'),attributes,{'tableName':_0x93b2('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1935f5,_0x2b14df,_0x33eb25){return getChanSpyPromise(_0x1dd760,_0x1935f5)[_0x93b2('0x1a')](function(_0x2a8717){if(_0x2a8717&&_0x2a8717[_0x93b2('0x15')]){return _0x1dd760[_0x93b2('0x21')]['bulkCreate'](_0x2a8717);}})[_0x93b2('0x1a')](function(){_0x33eb25();})[_0x93b2('0x1b')](function(_0x13c58a){_0x33eb25(_0x13c58a);});},'afterUpdate':function(_0x20d7f7,_0x387419,_0x4dd7f2){return _0x1dd760[_0x93b2('0x21')][_0x93b2('0x22')]({'where':{'ChanSpyId':_0x20d7f7['id']}})['then'](function(){return getChanSpyPromise(_0x1dd760,_0x20d7f7);})[_0x93b2('0x1a')](function(_0x45fb77){if(_0x45fb77&&_0x45fb77[_0x93b2('0x15')]){return _0x1dd760[_0x93b2('0x21')][_0x93b2('0x23')](_0x45fb77);}})['then'](function(){_0x4dd7f2();})[_0x93b2('0x1b')](function(_0x4a32fd){_0x4dd7f2(_0x4a32fd);});},'afterDestroy':function(_0x23174e,_0x233113,_0x155baf){return _0x1dd760[_0x93b2('0x21')]['destroy']({'where':{'ChanSpyId':_0x23174e['id']}})[_0x93b2('0x1a')](function(){_0x155baf();})[_0x93b2('0x1b')](function(_0x3d9257){_0x155baf(_0x3d9257);});}}});};
\ No newline at end of file
+var _0x7364=['MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','push','Authenticate','ChanSpy','options','join','record','StopMixMonitor','length','concat','internal','name','User','findAll','agent','catch','models','define','VoiceChanSpy','voice_chanspy','then','bulkCreate','VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','chanspy'];(function(_0x355ea1,_0x4d6e68){var _0x1a45ab=function(_0x354dcb){while(--_0x354dcb){_0x355ea1['push'](_0x355ea1['shift']());}};_0x1a45ab(++_0x4d6e68);}(_0x7364,0xbf));var _0x4736=function(_0x89f7f0,_0x7a95ed){_0x89f7f0=_0x89f7f0-0x0;var _0x5b6373=_0x7364[_0x89f7f0];return _0x5b6373;};'use strict';var _=require(_0x4736('0x0'));var util=require(_0x4736('0x1'));var BPromise=require(_0x4736('0x2'));var attributes=require(_0x4736('0x3'));var getUserApplications=function(_0x4e57a0,_0x2d5536,_0x567ea6){var _0x25a89e=0x1;var _0x162802=[];var _0x4ccebe={'context':_0x2d5536[_0x4736('0x4')]||_0x4736('0x5'),'exten':util[_0x4736('0x6')](_0x4736('0x7'),_0x4e57a0[_0x4736('0x8')],_0x567ea6),'type':_0x4736('0x9'),'isApp':![],'ChanSpyId':_0x4e57a0['id'],'UserId':_0x2d5536['id']};_0x162802['push'](_[_0x4736('0xa')]({'app':_0x4736('0xb'),'appdata':util[_0x4736('0x6')](_0x4736('0xc'),_0x4736('0xd')),'priority':_0x25a89e++},_0x4ccebe));if(_0x4e57a0['record']){_0x162802['push'](_['merge']({'app':_0x4736('0xe'),'appdata':util['format'](_0x4736('0xf'),_0x4e57a0[_0x4736('0x10')]),'priority':_0x25a89e++},_0x4ccebe));}if(_0x4e57a0[_0x4736('0x11')]){_0x162802[_0x4736('0x12')](_[_0x4736('0xa')]({'app':_0x4736('0x13'),'appdata':_0x4e57a0['password'],'priority':_0x25a89e++},_0x4ccebe));}_0x162802[_0x4736('0x12')](_[_0x4736('0xa')]({'app':_0x4736('0x14'),'appdata':util[_0x4736('0x6')]('SIP/%s,%s',_0x2d5536['name'],_0x4e57a0[_0x4736('0x15')]?_0x4e57a0[_0x4736('0x15')][_0x4736('0x16')](''):''),'priority':_0x25a89e++},_0x4ccebe));if(_0x4e57a0[_0x4736('0x17')]){_0x162802[_0x4736('0x12')](_['merge']({'app':_0x4736('0x18'),'priority':_0x25a89e++},_0x4ccebe));}return _0x162802;};var getChanSpyApplications=function(_0x2d1587,_0x4981cd){var _0x37fa71=[];for(var _0x5dba31=0x0,_0x5799ea=0x1;_0x5dba31<_0x4981cd[_0x4736('0x19')];_0x5dba31++,_0x5799ea=0x1){_0x37fa71=_0x37fa71[_0x4736('0x1a')](getUserApplications(_0x2d1587,_0x4981cd[_0x5dba31],_0x4981cd[_0x5dba31][_0x4736('0x1b')]));if(_0x4981cd[_0x5dba31][_0x4736('0x1b')]!=_0x4981cd[_0x5dba31][_0x4736('0x1c')]){_0x37fa71=_0x37fa71[_0x4736('0x1a')](getUserApplications(_0x2d1587,_0x4981cd[_0x5dba31],_0x4981cd[_0x5dba31]['name']));}}return _0x37fa71;};var getChanSpyPromise=function(_0x466049,_0x2bc9f4){return new BPromise(function(_0xf2ff18,_0x1b7a35){return _0x466049[_0x4736('0x1d')][_0x4736('0x1e')]({'attributes':['id','name',_0x4736('0x1b')],'where':{'role':_0x4736('0x1f'),'chanspy':!![]},'raw':!![]})['then'](function(_0x3d2a7c){if(_0x3d2a7c){return _0xf2ff18(getChanSpyApplications(_0x2bc9f4,_0x3d2a7c));}return _0xf2ff18([]);})[_0x4736('0x20')](function(_0x566731){_0x1b7a35(_0x566731);});});};module['exports']=function(_0x18202e,_0x11990b){var _0x5df19b=_0x18202e[_0x4736('0x21')];return _0x18202e[_0x4736('0x22')](_0x4736('0x23'),attributes,{'tableName':_0x4736('0x24'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x159125,_0x154563,_0x3a741c){return getChanSpyPromise(_0x5df19b,_0x159125)[_0x4736('0x25')](function(_0x3c9f4b){if(_0x3c9f4b&&_0x3c9f4b['length']){return _0x5df19b['VoiceExtension'][_0x4736('0x26')](_0x3c9f4b);}})[_0x4736('0x25')](function(){_0x3a741c();})[_0x4736('0x20')](function(_0x271b60){_0x3a741c(_0x271b60);});},'afterUpdate':function(_0x47249e,_0x5c59d7,_0x366a91){return _0x5df19b['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x47249e['id']}})['then'](function(){return getChanSpyPromise(_0x5df19b,_0x47249e);})[_0x4736('0x25')](function(_0x106e84){if(_0x106e84&&_0x106e84['length']){return _0x5df19b[_0x4736('0x27')]['bulkCreate'](_0x106e84);}})[_0x4736('0x25')](function(){_0x366a91();})[_0x4736('0x20')](function(_0x227913){_0x366a91(_0x227913);});},'afterDestroy':function(_0x5efb08,_0x2fd0b2,_0x5ae188){return _0x5df19b[_0x4736('0x27')][_0x4736('0x28')]({'where':{'ChanSpyId':_0x5efb08['id']}})['then'](function(){_0x5ae188();})['catch'](function(_0x27dc39){_0x5ae188(_0x27dc39);});}}});};
\ No newline at end of file
index 908e5da..7dcb853 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f2f=['lodash','util','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','code','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x6f2f[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6f2('0x3'))(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6f2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c94ad,_0x26cd28,_0x774922){return new BPromise(function(_0x15a71c,_0x1873c8){return client[_0xf6f2('0x7')](_0x1c94ad,_0x774922)[_0xf6f2('0x8')](function(_0x294a85){logger[_0xf6f2('0x9')]('VoiceChanSpy,\x20%s,\x20%s',_0x26cd28,_0xf6f2('0xa'));logger[_0xf6f2('0xb')](_0xf6f2('0xc'),_0x26cd28,_0xf6f2('0xa'),JSON['stringify'](_0x294a85));if(_0x294a85['error']){if(_0x294a85['error'][_0xf6f2('0xd')]===0x1f4){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x1873c8(_0x294a85[_0xf6f2('0xe')]['message']);}logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x294a85[_0xf6f2('0xe')][_0xf6f2('0x10')]);return _0x15a71c(_0x294a85[_0xf6f2('0xe')]['message']);}else{logger[_0xf6f2('0x9')](_0xf6f2('0xf'),_0x26cd28,_0xf6f2('0xa'));_0x15a71c(_0x294a85[_0xf6f2('0x11')][_0xf6f2('0x10')]);}})[_0xf6f2('0x12')](function(_0x17dec3){logger[_0xf6f2('0xe')](_0xf6f2('0xf'),_0x26cd28,_0x17dec3);_0x1873c8(_0x17dec3);});});}
\ No newline at end of file
+var _0xe600=['rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1b2989,_0x12784c){var _0x5d8470=function(_0x212eef){while(--_0x212eef){_0x1b2989['push'](_0x1b2989['shift']());}};_0x5d8470(++_0x12784c);}(_0xe600,0x159));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x0e60('0x0'));var moment=require('moment');var BPromise=require(_0x0e60('0x1'));var rs=require(_0x0e60('0x2'));var fs=require('fs');var Redis=require(_0x0e60('0x3'));var db=require(_0x0e60('0x4'))['db'];var utils=require(_0x0e60('0x5'));var logger=require(_0x0e60('0x6'))(_0x0e60('0x7'));var config=require(_0x0e60('0x8'));var jayson=require(_0x0e60('0x9'));var client=jayson[_0x0e60('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7563,_0x497a61,_0x6727dd){return new BPromise(function(_0x30eaed,_0x5ba123){return client[_0x0e60('0xb')](_0x1d7563,_0x6727dd)[_0x0e60('0xc')](function(_0x238537){logger[_0x0e60('0xd')](_0x0e60('0xe'),_0x497a61,_0x0e60('0xf'));logger['debug'](_0x0e60('0x10'),_0x497a61,_0x0e60('0xf'),JSON[_0x0e60('0x11')](_0x238537));if(_0x238537[_0x0e60('0x12')]){if(_0x238537[_0x0e60('0x12')][_0x0e60('0x13')]===0x1f4){logger[_0x0e60('0x12')](_0x0e60('0xe'),_0x497a61,_0x238537['error'][_0x0e60('0x14')]);return _0x5ba123(_0x238537[_0x0e60('0x12')][_0x0e60('0x14')]);}logger[_0x0e60('0x12')](_0x0e60('0xe'),_0x497a61,_0x238537[_0x0e60('0x12')]['message']);return _0x30eaed(_0x238537[_0x0e60('0x12')]['message']);}else{logger[_0x0e60('0xd')](_0x0e60('0xe'),_0x497a61,_0x0e60('0xf'));_0x30eaed(_0x238537['result'][_0x0e60('0x14')]);}})[_0x0e60('0x15')](function(_0xdb7760){logger[_0x0e60('0x12')](_0x0e60('0xe'),_0x497a61,_0xdb7760);_0x5ba123(_0xdb7760);});});}
\ No newline at end of file
index 54147ad..17dc928 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcdf0=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports'];(function(_0x46f01a,_0xc5ab14){var _0xfe8a59=function(_0x1496c2){while(--_0x1496c2){_0x46f01a['push'](_0x46f01a['shift']());}};_0xfe8a59(++_0xc5ab14);}(_0xcdf0,0xe1));var _0x0cdf=function(_0x175e17,_0x465620){_0x175e17=_0x175e17-0x0;var _0x277e88=_0xcdf0[_0x175e17];return _0x277e88;};'use strict';var multer=require('multer');var util=require(_0x0cdf('0x0'));var path=require('path');var timeout=require(_0x0cdf('0x1'));var express=require(_0x0cdf('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0cdf('0x3'));var interaction=require(_0x0cdf('0x4'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x0cdf('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0cdf('0x5')](_0x0cdf('0x6'),auth[_0x0cdf('0x7')](),controller[_0x0cdf('0x8')]);router['post']('/',auth[_0x0cdf('0x7')](),controller[_0x0cdf('0x9')]);router[_0x0cdf('0xa')]('/:id',auth[_0x0cdf('0x7')](),controller[_0x0cdf('0xb')]);router[_0x0cdf('0xc')](_0x0cdf('0x6'),auth[_0x0cdf('0x7')](),controller[_0x0cdf('0xd')]);module[_0x0cdf('0xe')]=router;
\ No newline at end of file
+var _0x3691=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x47638d,_0x2c6518){var _0x42ccbb=function(_0xecd2c){while(--_0xecd2c){_0x47638d['push'](_0x47638d['shift']());}};_0x42ccbb(++_0x2c6518);}(_0x3691,0xa4));var _0x1369=function(_0xb7df96,_0xabf861){_0xb7df96=_0xb7df96-0x0;var _0x16055f=_0x3691[_0xb7df96];return _0x16055f;};'use strict';var multer=require(_0x1369('0x0'));var util=require(_0x1369('0x1'));var path=require(_0x1369('0x2'));var timeout=require(_0x1369('0x3'));var express=require(_0x1369('0x4'));var router=express[_0x1369('0x5')]();var fs_extra=require(_0x1369('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1369('0x7'));var config=require(_0x1369('0x8'));var controller=require('./voiceContext.controller');router[_0x1369('0x9')]('/',auth[_0x1369('0xa')](),controller[_0x1369('0xb')]);router[_0x1369('0x9')](_0x1369('0xc'),auth[_0x1369('0xa')](),controller[_0x1369('0xd')]);router['post']('/',auth[_0x1369('0xa')](),controller[_0x1369('0xe')]);router[_0x1369('0xf')](_0x1369('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x1369('0x10')](_0x1369('0xc'),auth[_0x1369('0xa')](),controller[_0x1369('0x11')]);module[_0x1369('0x12')]=router;
\ No newline at end of file
index 72f3d85..98a4c1b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7b30=['BOOLEAN','STRING'];(function(_0xc4f39f,_0xa5296b){var _0x30d690=function(_0x48491d){while(--_0x48491d){_0xc4f39f['push'](_0xc4f39f['shift']());}};_0x30d690(++_0xa5296b);}(_0x7b30,0x111));var _0x07b3=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x7b30[_0x5e36d1];return _0x950b9e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x07b3('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x07b3('0x1')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xdcf4=['BOOLEAN','sequelize','exports','STRING'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0xdcf4,0xf1));var _0x4dcf=function(_0x9eaf9a,_0x384ad9){_0x9eaf9a=_0x9eaf9a-0x0;var _0x25a881=_0xdcf4[_0x9eaf9a];return _0x25a881;};'use strict';var Sequelize=require(_0x4dcf('0x0'));module[_0x4dcf('0x1')]={'name':{'type':Sequelize[_0x4dcf('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x4dcf('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x4dcf('0x3')],'defaultValue':0x0}};
\ No newline at end of file
index 5ad9b55..5a638e7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x35d5=['VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','end','limit','undefined','count','offset','Content-Range','json','reject','save','Contexts','UserProfileResource','index','VoiceContext','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','name','options','rows','includeAll','include','find','catch','create','body','readFileSync','join','root','utf8','render','writeFileSync','Reload','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','findAll','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','error','code'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x35d5,0x102));var _0x535d=function(_0x24b4b8,_0x568afe){_0x24b4b8=_0x24b4b8-0x0;var _0x5f111c=_0x35d5[_0x24b4b8];return _0x5f111c;};'use strict';var emlformat=require(_0x535d('0x0'));var rimraf=require(_0x535d('0x1'));var zipdir=require(_0x535d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x535d('0x3'));var BPromise=require(_0x535d('0x4'));var Mustache=require(_0x535d('0x5'));var util=require(_0x535d('0x6'));var path=require(_0x535d('0x7'));var sox=require(_0x535d('0x8'));var csv=require(_0x535d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x535d('0xa'));var squel=require('squel');var crypto=require(_0x535d('0xb'));var jsforce=require(_0x535d('0xc'));var deskjs=require(_0x535d('0xd'));var toCsv=require(_0x535d('0x9'));var querystring=require(_0x535d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x535d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x535d('0x10'));var hardwareService=require(_0x535d('0x11'));var logger=require('../../config/logger')(_0x535d('0x12'));var utils=require(_0x535d('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x535d('0x14'))['db'];var jayson=require(_0x535d('0x15'));var client=jayson[_0x535d('0x16')][_0x535d('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x468231,_0x19628b,_0x444ce7,_0x4d6f7d){return new BPromise(function(_0x1d5872,_0x354b1c){var _0x25df3f=_0x4d6f7d||client;return _0x25df3f['request'](_0x468231,_0x444ce7)[_0x535d('0x18')](function(_0x1108b1){logger[_0x535d('0x19')]('VoiceContext,\x20%s,\x20%s',_0x19628b,_0x535d('0x1a'));logger[_0x535d('0x1b')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x19628b,_0x535d('0x1a'),JSON['stringify'](_0x1108b1));if(_0x1108b1[_0x535d('0x1c')]){if(_0x1108b1[_0x535d('0x1c')][_0x535d('0x1d')]===0x1f4){logger[_0x535d('0x1c')](_0x535d('0x1e'),_0x19628b,_0x1108b1[_0x535d('0x1c')][_0x535d('0x1f')]);return _0x354b1c(_0x1108b1[_0x535d('0x1c')][_0x535d('0x1f')]);}logger[_0x535d('0x1c')](_0x535d('0x1e'),_0x19628b,_0x1108b1['error'][_0x535d('0x1f')]);return _0x1d5872(_0x1108b1['error'][_0x535d('0x1f')]);}else{logger['info'](_0x535d('0x1e'),_0x19628b,_0x535d('0x1a'));_0x1d5872(_0x1108b1[_0x535d('0x20')][_0x535d('0x1f')]);}})['catch'](function(_0x274098){logger[_0x535d('0x1c')](_0x535d('0x1e'),_0x19628b,_0x274098);_0x354b1c(_0x274098);});});}function respondWithStatusCode(_0x478adc,_0x2ffa8b){_0x2ffa8b=_0x2ffa8b||0xcc;return function(_0x23b5f5){if(_0x23b5f5){return _0x478adc[_0x535d('0x21')](_0x2ffa8b);}return _0x478adc[_0x535d('0x22')](_0x2ffa8b)[_0x535d('0x23')]();};}function respondWithResult(_0x552207,_0x2bae46){_0x2bae46=_0x2bae46||0xc8;return function(_0x47363d){if(_0x47363d){return _0x552207[_0x535d('0x22')](_0x2bae46)['json'](_0x47363d);}};}function respondWithFilteredResult(_0x1a7438,_0xb97695){return function(_0x22478d){if(_0x22478d){var _0x39dda=typeof _0xb97695['offset']==='undefined'&&typeof _0xb97695[_0x535d('0x24')]===_0x535d('0x25');var _0x545cc9=_0x22478d[_0x535d('0x26')];var _0x1a05f2=_0x39dda?0x0:_0xb97695[_0x535d('0x27')];var _0x2c2ef0=_0x39dda?_0x22478d[_0x535d('0x26')]:_0xb97695['offset']+_0xb97695[_0x535d('0x24')];var _0x99f37;if(_0x2c2ef0>=_0x545cc9){_0x2c2ef0=_0x545cc9;_0x99f37=0xc8;}else{_0x99f37=0xce;}_0x1a7438[_0x535d('0x22')](_0x99f37);return _0x1a7438['set'](_0x535d('0x28'),_0x1a05f2+'-'+_0x2c2ef0+'/'+_0x545cc9)[_0x535d('0x29')](_0x22478d);}return null;};}function patchUpdates(_0x1ed3fa){return function(_0x1fe5bd){try{jsonpatch['apply'](_0x1fe5bd,_0x1ed3fa,!![]);}catch(_0x41ca16){return BPromise[_0x535d('0x2a')](_0x41ca16);}return _0x1fe5bd[_0x535d('0x2b')]();};}function saveUpdates(_0x68f37c,_0x58328b){return function(_0x3d1f2b){if(_0x3d1f2b){return _0x3d1f2b['update'](_0x68f37c)[_0x535d('0x18')](function(_0x41578b){return _0x41578b;});}return null;};}function removeEntity(_0x4fcfba,_0x742450){return function(_0x10b8a3){if(_0x10b8a3){return _0x10b8a3['destroy']()['then'](function(){var _0x158d06=_0x10b8a3['get']({'plain':!![]});var _0x996cc1=_0x535d('0x2c');return db[_0x535d('0x2d')]['destroy']({'where':{'type':_0x996cc1,'resourceId':_0x158d06['id']}})[_0x535d('0x18')](function(){return _0x10b8a3;});})[_0x535d('0x18')](function(){_0x4fcfba[_0x535d('0x22')](0xcc)[_0x535d('0x23')]();});}};}function handleEntityNotFound(_0x226d7a,_0x3dd2fc){return function(_0x4798ae){if(!_0x4798ae){_0x226d7a[_0x535d('0x21')](0x194);}return _0x4798ae;};}function handleError(_0x42b341,_0x1213ea){_0x1213ea=_0x1213ea||0x1f4;return function(_0x45fb66){logger[_0x535d('0x1c')](_0x45fb66['stack']);if(_0x45fb66['name']){delete _0x45fb66['name'];}_0x42b341[_0x535d('0x22')](_0x1213ea)['send'](_0x45fb66);};}exports[_0x535d('0x2e')]=function(_0x1aad47,_0x3896c4){var _0x521b39={},_0x3d1809={},_0x169ab3={'count':0x0,'rows':[]};var _0x2cb991=_['map'](db[_0x535d('0x2f')][_0x535d('0x30')],function(_0x390eba){return{'name':_0x390eba[_0x535d('0x31')],'type':_0x390eba['type'][_0x535d('0x32')]};});_0x3d1809[_0x535d('0x33')]=_[_0x535d('0x34')](_0x2cb991,'name');_0x3d1809[_0x535d('0x35')]=_['keys'](_0x1aad47[_0x535d('0x35')]);_0x3d1809[_0x535d('0x36')]=_[_0x535d('0x37')](_0x3d1809[_0x535d('0x33')],_0x3d1809[_0x535d('0x35')]);_0x521b39[_0x535d('0x38')]=_['intersection'](_0x3d1809[_0x535d('0x33')],qs[_0x535d('0x39')](_0x1aad47[_0x535d('0x35')][_0x535d('0x39')]));_0x521b39['attributes']=_0x521b39[_0x535d('0x38')][_0x535d('0x3a')]?_0x521b39[_0x535d('0x38')]:_0x3d1809['model'];if(!_0x1aad47[_0x535d('0x35')][_0x535d('0x3b')]('nolimit')){_0x521b39[_0x535d('0x24')]=qs[_0x535d('0x24')](_0x1aad47[_0x535d('0x35')]['limit']);_0x521b39[_0x535d('0x27')]=qs[_0x535d('0x27')](_0x1aad47[_0x535d('0x35')][_0x535d('0x27')]);}_0x521b39[_0x535d('0x3c')]=qs[_0x535d('0x3d')](_0x1aad47[_0x535d('0x35')][_0x535d('0x3d')]);_0x521b39[_0x535d('0x3e')]=qs[_0x535d('0x36')](_['pick'](_0x1aad47['query'],_0x3d1809[_0x535d('0x36')]),_0x2cb991);if(_0x1aad47[_0x535d('0x35')][_0x535d('0x3f')]){_0x521b39[_0x535d('0x3e')]=_[_0x535d('0x40')](_0x521b39[_0x535d('0x3e')],{'$or':_[_0x535d('0x34')](_0x2cb991,function(_0x520b37){if(_0x520b37[_0x535d('0x41')]!==_0x535d('0x42')){var _0x2a73ab={};_0x2a73ab[_0x520b37[_0x535d('0x43')]]={'$like':'%'+_0x1aad47['query']['filter']+'%'};return _0x2a73ab;}})});}_0x521b39=_[_0x535d('0x40')]({},_0x521b39,_0x1aad47[_0x535d('0x44')]);var _0x50b1bc={'where':_0x521b39[_0x535d('0x3e')]};return db[_0x535d('0x2f')][_0x535d('0x26')](_0x50b1bc)[_0x535d('0x18')](function(_0x40e5de){_0x169ab3[_0x535d('0x26')]=_0x40e5de;if(_0x1aad47[_0x535d('0x35')]['includeAll']){_0x521b39['include']=[{'all':!![]}];}return db[_0x535d('0x2f')]['findAll'](_0x521b39);})[_0x535d('0x18')](function(_0x240260){_0x169ab3[_0x535d('0x45')]=_0x240260;return _0x169ab3;})[_0x535d('0x18')](respondWithFilteredResult(_0x3896c4,_0x521b39))['catch'](handleError(_0x3896c4,null));};exports['show']=function(_0x26a497,_0x2657c4){var _0x1cae5e={'raw':![],'where':{'id':_0x26a497['params']['id']}},_0x1455bb={};_0x1455bb[_0x535d('0x33')]=_['keys'](db[_0x535d('0x2f')]['rawAttributes']);_0x1455bb['query']=_['keys'](_0x26a497[_0x535d('0x35')]);_0x1455bb[_0x535d('0x36')]=_[_0x535d('0x37')](_0x1455bb['model'],_0x1455bb[_0x535d('0x35')]);_0x1cae5e[_0x535d('0x38')]=_['intersection'](_0x1455bb[_0x535d('0x33')],qs[_0x535d('0x39')](_0x26a497[_0x535d('0x35')][_0x535d('0x39')]));_0x1cae5e[_0x535d('0x38')]=_0x1cae5e[_0x535d('0x38')][_0x535d('0x3a')]?_0x1cae5e[_0x535d('0x38')]:_0x1455bb[_0x535d('0x33')];if(_0x26a497[_0x535d('0x35')][_0x535d('0x46')]){_0x1cae5e[_0x535d('0x47')]=[{'all':!![]}];}_0x1cae5e=_[_0x535d('0x40')]({},_0x1cae5e,_0x26a497['options']);return db['VoiceContext'][_0x535d('0x48')](_0x1cae5e)[_0x535d('0x18')](handleEntityNotFound(_0x2657c4,null))[_0x535d('0x18')](respondWithResult(_0x2657c4,null))[_0x535d('0x49')](handleError(_0x2657c4,null));};exports[_0x535d('0x4a')]=function(_0x85a9e,_0x2e8c9d,_0xd77bee){var _0x43412c;return db[_0x535d('0x2f')][_0x535d('0x4a')](_0x85a9e[_0x535d('0x4b')],{'raw':!![]})[_0x535d('0x18')](function(_0x2c73e6){_0x43412c=_0x2c73e6;return db[_0x535d('0x2f')]['findAll']({'raw':!![]});})[_0x535d('0x18')](function(_0x3d89a7){var _0x541eb8=fs[_0x535d('0x4c')](path[_0x535d('0x4d')](config[_0x535d('0x4e')],'server/files/templates/context.ejs'),_0x535d('0x4f'));var _0xda1982=ejs[_0x535d('0x50')](_0x541eb8,{'contexts':_0x3d89a7||[]});fs[_0x535d('0x51')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xda1982);})[_0x535d('0x18')](function(){return respondWithRpcPromise(_0x535d('0x52'),_0x535d('0x4a'),{'module':'chan_sip.so'});})[_0x535d('0x18')](function(){var _0x42c247=_0x85a9e[_0x535d('0x53')][_0x535d('0x54')]({'plain':!![]});if(!_0x42c247)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42c247['role']===_0x535d('0x53')){var _0x317786=_0x43412c[_0x535d('0x54')]({'plain':!![]});return db[_0x535d('0x55')]['find']({'where':{'name':_0x535d('0x2c'),'userProfileId':_0x42c247[_0x535d('0x56')]},'raw':!![]})['then'](function(_0x2f5a3d){if(_0x2f5a3d&&_0x2f5a3d[_0x535d('0x57')]===0x0){return db[_0x535d('0x2d')]['create']({'name':_0x317786[_0x535d('0x43')],'resourceId':_0x317786['id'],'type':_0x2f5a3d[_0x535d('0x43')],'sectionId':_0x2f5a3d['id']},{})[_0x535d('0x18')](function(){return _0x43412c;});}else{return _0x43412c;}})[_0x535d('0x49')](function(_0x50b1ec){logger[_0x535d('0x1c')](_0x535d('0x58'),_0x50b1ec);throw _0x50b1ec;});}return _0x43412c;})[_0x535d('0x18')](respondWithResult(_0x2e8c9d,0xc9))['catch'](handleError(_0x2e8c9d,null));};exports[_0x535d('0x59')]=function(_0x2366f4,_0x5ada47,_0x17f66d){var _0x428790;return db['VoiceContext'][_0x535d('0x48')]({'where':{'id':_0x2366f4[_0x535d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5ada47,null))[_0x535d('0x18')](saveUpdates(_0x2366f4[_0x535d('0x4b')],null))[_0x535d('0x18')](function(_0x428eb4){if(_0x428eb4){_0x428790=_0x428eb4;return db[_0x535d('0x2f')][_0x535d('0x5b')]({'raw':!![]});}})[_0x535d('0x18')](function(_0x2432d6){var _0x5aca1a=fs[_0x535d('0x4c')](path['join'](config[_0x535d('0x4e')],_0x535d('0x5c')),_0x535d('0x4f'));var _0x73f79d=ejs[_0x535d('0x50')](_0x5aca1a,{'contexts':_0x2432d6||[]});fs[_0x535d('0x51')](_0x535d('0x5d'),_0x73f79d);})[_0x535d('0x18')](function(){return respondWithRpcPromise(_0x535d('0x52'),_0x535d('0x59'),{'module':_0x535d('0x5e')});})[_0x535d('0x18')](function(){return _0x428790;})['then'](respondWithResult(_0x5ada47,null))[_0x535d('0x49')](handleError(_0x5ada47,null));};exports[_0x535d('0x5f')]=function(_0x1a7906,_0x2f01c0,_0x182246){var _0x122e70;return db[_0x535d('0x2f')]['find']({'where':{'id':_0x1a7906[_0x535d('0x5a')]['id']}})[_0x535d('0x18')](handleEntityNotFound(_0x2f01c0,null))[_0x535d('0x18')](removeEntity(_0x2f01c0,null))['then'](function(){return db[_0x535d('0x2f')][_0x535d('0x5b')]({'raw':!![]});})['then'](function(_0x31bb72){var _0x3faf56=fs[_0x535d('0x4c')](path[_0x535d('0x4d')](config[_0x535d('0x4e')],_0x535d('0x5c')),'utf8');var _0x4bb389=ejs[_0x535d('0x50')](_0x3faf56,{'contexts':_0x31bb72});fs[_0x535d('0x51')](_0x535d('0x5d'),_0x4bb389);return respondWithRpcPromise(_0x535d('0x52'),_0x535d('0x5f'),{'module':'chan_sip.so'});})[_0x535d('0x49')](handleError(_0x2f01c0,null));};
\ No newline at end of file
+var _0xa455=['includeAll','include','findAll','show','params','rawAttributes','intersection','find','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','get','UserProfileResource','destroy','then','stack','name','index','map','VoiceContext','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','VIRTUAL','merge','options','where'];(function(_0x114bf1,_0x16ac4a){var _0x58072f=function(_0x377d8a){while(--_0x377d8a){_0x114bf1['push'](_0x114bf1['shift']());}};_0x58072f(++_0x16ac4a);}(_0xa455,0x162));var _0x5a45=function(_0x2f9552,_0x3ec340){_0x2f9552=_0x2f9552-0x0;var _0x290e9d=_0xa455[_0x2f9552];return _0x290e9d;};'use strict';var emlformat=require(_0x5a45('0x0'));var rimraf=require(_0x5a45('0x1'));var zipdir=require(_0x5a45('0x2'));var jsonpatch=require(_0x5a45('0x3'));var rp=require(_0x5a45('0x4'));var moment=require(_0x5a45('0x5'));var BPromise=require(_0x5a45('0x6'));var Mustache=require(_0x5a45('0x7'));var util=require(_0x5a45('0x8'));var path=require(_0x5a45('0x9'));var sox=require('sox');var csv=require(_0x5a45('0xa'));var ejs=require(_0x5a45('0xb'));var fs=require('fs');var fs_extra=require(_0x5a45('0xc'));var _=require(_0x5a45('0xd'));var squel=require(_0x5a45('0xe'));var crypto=require(_0x5a45('0xf'));var jsforce=require(_0x5a45('0x10'));var deskjs=require(_0x5a45('0x11'));var toCsv=require(_0x5a45('0xa'));var querystring=require(_0x5a45('0x12'));var Papa=require(_0x5a45('0x13'));var Redis=require(_0x5a45('0x14'));var authService=require(_0x5a45('0x15'));var qs=require(_0x5a45('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a45('0x17'));var logger=require(_0x5a45('0x18'))(_0x5a45('0x19'));var utils=require(_0x5a45('0x1a'));var config=require(_0x5a45('0x1b'));var licenseUtil=require(_0x5a45('0x1c'));var db=require(_0x5a45('0x1d'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5a45('0x1e')][_0x5a45('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2e46cf,_0x508302,_0x44381d,_0x6f609){return new BPromise(function(_0x2c8711,_0x443822){var _0x1ad274=_0x6f609||client;return _0x1ad274[_0x5a45('0x20')](_0x2e46cf,_0x44381d)['then'](function(_0x5fef44){logger[_0x5a45('0x21')](_0x5a45('0x22'),_0x508302,'request\x20sent');logger[_0x5a45('0x23')](_0x5a45('0x24'),_0x508302,_0x5a45('0x25'),JSON[_0x5a45('0x26')](_0x5fef44));if(_0x5fef44[_0x5a45('0x27')]){if(_0x5fef44['error'][_0x5a45('0x28')]===0x1f4){logger[_0x5a45('0x27')](_0x5a45('0x22'),_0x508302,_0x5fef44[_0x5a45('0x27')][_0x5a45('0x29')]);return _0x443822(_0x5fef44['error'][_0x5a45('0x29')]);}logger[_0x5a45('0x27')](_0x5a45('0x22'),_0x508302,_0x5fef44['error'][_0x5a45('0x29')]);return _0x2c8711(_0x5fef44['error'][_0x5a45('0x29')]);}else{logger['info'](_0x5a45('0x22'),_0x508302,_0x5a45('0x25'));_0x2c8711(_0x5fef44['result'][_0x5a45('0x29')]);}})[_0x5a45('0x2a')](function(_0x322b77){logger[_0x5a45('0x27')](_0x5a45('0x22'),_0x508302,_0x322b77);_0x443822(_0x322b77);});});}function respondWithStatusCode(_0x96050f,_0x1713fc){_0x1713fc=_0x1713fc||0xcc;return function(_0x4fbdb2){if(_0x4fbdb2){return _0x96050f[_0x5a45('0x2b')](_0x1713fc);}return _0x96050f[_0x5a45('0x2c')](_0x1713fc)[_0x5a45('0x2d')]();};}function respondWithResult(_0x56e29c,_0x59f0dd){_0x59f0dd=_0x59f0dd||0xc8;return function(_0x50997c){if(_0x50997c){return _0x56e29c[_0x5a45('0x2c')](_0x59f0dd)[_0x5a45('0x2e')](_0x50997c);}};}function respondWithFilteredResult(_0x46bde9,_0x180c52){return function(_0x1d76d2){if(_0x1d76d2){var _0x3e6254=typeof _0x180c52[_0x5a45('0x2f')]==='undefined'&&typeof _0x180c52[_0x5a45('0x30')]===_0x5a45('0x31');var _0x2981aa=_0x1d76d2[_0x5a45('0x32')];var _0x2990ba=_0x3e6254?0x0:_0x180c52[_0x5a45('0x2f')];var _0x587fc0=_0x3e6254?_0x1d76d2[_0x5a45('0x32')]:_0x180c52[_0x5a45('0x2f')]+_0x180c52['limit'];var _0xab6a11;if(_0x587fc0>=_0x2981aa){_0x587fc0=_0x2981aa;_0xab6a11=0xc8;}else{_0xab6a11=0xce;}_0x46bde9['status'](_0xab6a11);return _0x46bde9[_0x5a45('0x33')]('Content-Range',_0x2990ba+'-'+_0x587fc0+'/'+_0x2981aa)['json'](_0x1d76d2);}return null;};}function patchUpdates(_0xb1dea3){return function(_0x57c24e){try{jsonpatch[_0x5a45('0x34')](_0x57c24e,_0xb1dea3,!![]);}catch(_0x9887e6){return BPromise[_0x5a45('0x35')](_0x9887e6);}return _0x57c24e['save']();};}function saveUpdates(_0x528df4,_0x229db4){return function(_0x4296f1){if(_0x4296f1){return _0x4296f1[_0x5a45('0x36')](_0x528df4)['then'](function(_0x5ef21f){return _0x5ef21f;});}return null;};}function removeEntity(_0x23344f,_0x24ec72){return function(_0x35069c){if(_0x35069c){return _0x35069c['destroy']()['then'](function(){var _0x27ded8=_0x35069c[_0x5a45('0x37')]({'plain':!![]});var _0x302d94='Contexts';return db[_0x5a45('0x38')][_0x5a45('0x39')]({'where':{'type':_0x302d94,'resourceId':_0x27ded8['id']}})[_0x5a45('0x3a')](function(){return _0x35069c;});})[_0x5a45('0x3a')](function(){_0x23344f[_0x5a45('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x304544,_0xe2d88e){return function(_0x5020e2){if(!_0x5020e2){_0x304544[_0x5a45('0x2b')](0x194);}return _0x5020e2;};}function handleError(_0x4a777a,_0x43db4c){_0x43db4c=_0x43db4c||0x1f4;return function(_0x453845){logger['error'](_0x453845[_0x5a45('0x3b')]);if(_0x453845[_0x5a45('0x3c')]){delete _0x453845[_0x5a45('0x3c')];}_0x4a777a[_0x5a45('0x2c')](_0x43db4c)['send'](_0x453845);};}exports[_0x5a45('0x3d')]=function(_0x166e83,_0xfc4165){var _0x446688={},_0x2a4cea={},_0x39fd57={'count':0x0,'rows':[]};var _0x4de2d3=_[_0x5a45('0x3e')](db[_0x5a45('0x3f')]['rawAttributes'],function(_0x4c6391){return{'name':_0x4c6391[_0x5a45('0x40')],'type':_0x4c6391[_0x5a45('0x41')][_0x5a45('0x42')]};});_0x2a4cea[_0x5a45('0x43')]=_[_0x5a45('0x3e')](_0x4de2d3,_0x5a45('0x3c'));_0x2a4cea['query']=_[_0x5a45('0x44')](_0x166e83[_0x5a45('0x45')]);_0x2a4cea[_0x5a45('0x46')]=_['intersection'](_0x2a4cea[_0x5a45('0x43')],_0x2a4cea[_0x5a45('0x45')]);_0x446688[_0x5a45('0x47')]=_['intersection'](_0x2a4cea['model'],qs[_0x5a45('0x48')](_0x166e83[_0x5a45('0x45')][_0x5a45('0x48')]));_0x446688[_0x5a45('0x47')]=_0x446688[_0x5a45('0x47')][_0x5a45('0x49')]?_0x446688['attributes']:_0x2a4cea[_0x5a45('0x43')];if(!_0x166e83[_0x5a45('0x45')][_0x5a45('0x4a')](_0x5a45('0x4b'))){_0x446688[_0x5a45('0x30')]=qs[_0x5a45('0x30')](_0x166e83[_0x5a45('0x45')][_0x5a45('0x30')]);_0x446688[_0x5a45('0x2f')]=qs[_0x5a45('0x2f')](_0x166e83['query'][_0x5a45('0x2f')]);}_0x446688[_0x5a45('0x4c')]=qs['sort'](_0x166e83[_0x5a45('0x45')][_0x5a45('0x4d')]);_0x446688['where']=qs[_0x5a45('0x46')](_['pick'](_0x166e83['query'],_0x2a4cea[_0x5a45('0x46')]),_0x4de2d3);if(_0x166e83[_0x5a45('0x45')]['filter']){_0x446688['where']=_['merge'](_0x446688['where'],{'$or':_['map'](_0x4de2d3,function(_0x5c1096){if(_0x5c1096[_0x5a45('0x41')]!==_0x5a45('0x4e')){var _0x140b4d={};_0x140b4d[_0x5c1096[_0x5a45('0x3c')]]={'$like':'%'+_0x166e83['query']['filter']+'%'};return _0x140b4d;}})});}_0x446688=_[_0x5a45('0x4f')]({},_0x446688,_0x166e83[_0x5a45('0x50')]);var _0x22cea8={'where':_0x446688[_0x5a45('0x51')]};return db['VoiceContext'][_0x5a45('0x32')](_0x22cea8)[_0x5a45('0x3a')](function(_0x539927){_0x39fd57['count']=_0x539927;if(_0x166e83[_0x5a45('0x45')][_0x5a45('0x52')]){_0x446688[_0x5a45('0x53')]=[{'all':!![]}];}return db[_0x5a45('0x3f')][_0x5a45('0x54')](_0x446688);})[_0x5a45('0x3a')](function(_0x442284){_0x39fd57['rows']=_0x442284;return _0x39fd57;})['then'](respondWithFilteredResult(_0xfc4165,_0x446688))[_0x5a45('0x2a')](handleError(_0xfc4165,null));};exports[_0x5a45('0x55')]=function(_0x7427e8,_0x4d68db){var _0x20c478={'raw':![],'where':{'id':_0x7427e8[_0x5a45('0x56')]['id']}},_0x18618b={};_0x18618b[_0x5a45('0x43')]=_[_0x5a45('0x44')](db[_0x5a45('0x3f')][_0x5a45('0x57')]);_0x18618b[_0x5a45('0x45')]=_[_0x5a45('0x44')](_0x7427e8['query']);_0x18618b[_0x5a45('0x46')]=_[_0x5a45('0x58')](_0x18618b['model'],_0x18618b[_0x5a45('0x45')]);_0x20c478[_0x5a45('0x47')]=_['intersection'](_0x18618b[_0x5a45('0x43')],qs[_0x5a45('0x48')](_0x7427e8[_0x5a45('0x45')][_0x5a45('0x48')]));_0x20c478[_0x5a45('0x47')]=_0x20c478[_0x5a45('0x47')]['length']?_0x20c478[_0x5a45('0x47')]:_0x18618b[_0x5a45('0x43')];if(_0x7427e8[_0x5a45('0x45')][_0x5a45('0x52')]){_0x20c478[_0x5a45('0x53')]=[{'all':!![]}];}_0x20c478=_['merge']({},_0x20c478,_0x7427e8[_0x5a45('0x50')]);return db[_0x5a45('0x3f')][_0x5a45('0x59')](_0x20c478)[_0x5a45('0x3a')](handleEntityNotFound(_0x4d68db,null))[_0x5a45('0x3a')](respondWithResult(_0x4d68db,null))['catch'](handleError(_0x4d68db,null));};exports[_0x5a45('0x5a')]=function(_0x37a962,_0x7408c8,_0x1a1973){var _0x1b776e;return db[_0x5a45('0x3f')][_0x5a45('0x5a')](_0x37a962['body'],{'raw':!![]})['then'](function(_0x54549b){_0x1b776e=_0x54549b;return db[_0x5a45('0x3f')][_0x5a45('0x54')]({'raw':!![]});})[_0x5a45('0x3a')](function(_0x455125){var _0x33603e=fs[_0x5a45('0x5b')](path[_0x5a45('0x5c')](config[_0x5a45('0x5d')],_0x5a45('0x5e')),_0x5a45('0x5f'));var _0x5cf228=ejs[_0x5a45('0x60')](_0x33603e,{'contexts':_0x455125||[]});fs[_0x5a45('0x61')](_0x5a45('0x62'),_0x5cf228);})['then'](function(){return respondWithRpcPromise(_0x5a45('0x63'),_0x5a45('0x5a'),{'module':_0x5a45('0x64')});})['then'](function(){var _0xfbad06=_0x37a962[_0x5a45('0x65')][_0x5a45('0x37')]({'plain':!![]});if(!_0xfbad06)throw new Error(_0x5a45('0x66'));if(_0xfbad06[_0x5a45('0x67')]===_0x5a45('0x65')){var _0x513715=_0x1b776e[_0x5a45('0x37')]({'plain':!![]});return db[_0x5a45('0x68')][_0x5a45('0x59')]({'where':{'name':_0x5a45('0x69'),'userProfileId':_0xfbad06[_0x5a45('0x6a')]},'raw':!![]})[_0x5a45('0x3a')](function(_0x1c2773){if(_0x1c2773&&_0x1c2773[_0x5a45('0x6b')]===0x0){return db[_0x5a45('0x38')][_0x5a45('0x5a')]({'name':_0x513715[_0x5a45('0x3c')],'resourceId':_0x513715['id'],'type':_0x1c2773['name'],'sectionId':_0x1c2773['id']},{})[_0x5a45('0x3a')](function(){return _0x1b776e;});}else{return _0x1b776e;}})['catch'](function(_0x3c1ed2){logger[_0x5a45('0x27')](_0x5a45('0x6c'),_0x3c1ed2);throw _0x3c1ed2;});}return _0x1b776e;})[_0x5a45('0x3a')](respondWithResult(_0x7408c8,0xc9))[_0x5a45('0x2a')](handleError(_0x7408c8,null));};exports['update']=function(_0x3b5d48,_0x6e1ba2,_0x3ad9d3){var _0x203db2;return db['VoiceContext'][_0x5a45('0x59')]({'where':{'id':_0x3b5d48[_0x5a45('0x56')]['id']}})[_0x5a45('0x3a')](handleEntityNotFound(_0x6e1ba2,null))[_0x5a45('0x3a')](saveUpdates(_0x3b5d48['body'],null))[_0x5a45('0x3a')](function(_0xb3b02){if(_0xb3b02){_0x203db2=_0xb3b02;return db[_0x5a45('0x3f')][_0x5a45('0x54')]({'raw':!![]});}})[_0x5a45('0x3a')](function(_0x3392ec){var _0xdb739b=fs['readFileSync'](path[_0x5a45('0x5c')](config[_0x5a45('0x5d')],_0x5a45('0x5e')),_0x5a45('0x5f'));var _0x406e14=ejs['render'](_0xdb739b,{'contexts':_0x3392ec||[]});fs[_0x5a45('0x61')](_0x5a45('0x62'),_0x406e14);})[_0x5a45('0x3a')](function(){return respondWithRpcPromise(_0x5a45('0x63'),'update',{'module':'chan_sip.so'});})[_0x5a45('0x3a')](function(){return _0x203db2;})[_0x5a45('0x3a')](respondWithResult(_0x6e1ba2,null))[_0x5a45('0x2a')](handleError(_0x6e1ba2,null));};exports['destroy']=function(_0x502d9a,_0x2ad3bc,_0x5e5bbd){var _0x16e31c;return db[_0x5a45('0x3f')]['find']({'where':{'id':_0x502d9a[_0x5a45('0x56')]['id']}})[_0x5a45('0x3a')](handleEntityNotFound(_0x2ad3bc,null))['then'](removeEntity(_0x2ad3bc,null))['then'](function(){return db[_0x5a45('0x3f')]['findAll']({'raw':!![]});})['then'](function(_0x28f377){var _0x2e92fd=fs[_0x5a45('0x5b')](path[_0x5a45('0x5c')](config[_0x5a45('0x5d')],_0x5a45('0x5e')),_0x5a45('0x5f'));var _0x56753d=ejs[_0x5a45('0x60')](_0x2e92fd,{'contexts':_0x28f377});fs[_0x5a45('0x61')](_0x5a45('0x62'),_0x56753d);return respondWithRpcPromise(_0x5a45('0x63'),_0x5a45('0x39'),{'module':_0x5a45('0x64')});})[_0x5a45('0x2a')](handleError(_0x2ad3bc,null));};
\ No newline at end of file
index 28be5de..260072b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0c14=['voice_contexts','lodash','util','../../config/logger','request-promise','path','rimraf','./voiceContext.attributes','exports','define','VoiceContext'];(function(_0x5af4c7,_0x4e2c95){var _0xb7ee2a=function(_0x2eebe3){while(--_0x2eebe3){_0x5af4c7['push'](_0x5af4c7['shift']());}};_0xb7ee2a(++_0x4e2c95);}(_0x0c14,0xc7));var _0x40c1=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x0c14[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0x40c1('0x0'));var util=require(_0x40c1('0x1'));var logger=require(_0x40c1('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x40c1('0x3'));var fs=require('fs');var path=require(_0x40c1('0x4'));var rimraf=require(_0x40c1('0x5'));var config=require('../../config/environment');var attributes=require(_0x40c1('0x6'));module[_0x40c1('0x7')]=function(_0x1225d1,_0x12e3b5){return _0x1225d1[_0x40c1('0x8')](_0x40c1('0x9'),attributes,{'tableName':_0x40c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xcfc8=['lodash','util','api','moment','bluebird','rimraf','../../config/environment','exports','define','VoiceContext'];(function(_0x53b06b,_0x39d644){var _0x533caf=function(_0x449745){while(--_0x449745){_0x53b06b['push'](_0x53b06b['shift']());}};_0x533caf(++_0x39d644);}(_0xcfc8,0x172));var _0x8cfc=function(_0x55584a,_0x44bf48){_0x55584a=_0x55584a-0x0;var _0x5b9220=_0xcfc8[_0x55584a];return _0x5b9220;};'use strict';var _=require(_0x8cfc('0x0'));var util=require(_0x8cfc('0x1'));var logger=require('../../config/logger')(_0x8cfc('0x2'));var moment=require(_0x8cfc('0x3'));var BPromise=require(_0x8cfc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8cfc('0x5'));var config=require(_0x8cfc('0x6'));var attributes=require('./voiceContext.attributes');module[_0x8cfc('0x7')]=function(_0x4de994,_0x23ba2a){return _0x4de994[_0x8cfc('0x8')](_0x8cfc('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 306ae99..d8961f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2160=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','VoiceContext,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x2160,0x132));var _0x0216=function(_0x10026f,_0x31c31e){_0x10026f=_0x10026f-0x0;var _0x322512=_0x2160[_0x10026f];return _0x322512;};'use strict';var _=require('lodash');var util=require(_0x0216('0x0'));var moment=require(_0x0216('0x1'));var BPromise=require(_0x0216('0x2'));var rs=require(_0x0216('0x3'));var fs=require('fs');var Redis=require(_0x0216('0x4'));var db=require(_0x0216('0x5'))['db'];var utils=require(_0x0216('0x6'));var logger=require(_0x0216('0x7'))(_0x0216('0x8'));var config=require(_0x0216('0x9'));var jayson=require(_0x0216('0xa'));var client=jayson[_0x0216('0xb')][_0x0216('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x462464,_0x47af64,_0x337ccd){return new BPromise(function(_0x2fd88d,_0x578377){return client['request'](_0x462464,_0x337ccd)[_0x0216('0xd')](function(_0x34ec07){logger[_0x0216('0xe')]('VoiceContext,\x20%s,\x20%s',_0x47af64,_0x0216('0xf'));logger[_0x0216('0x10')](_0x0216('0x11'),_0x47af64,'request\x20sent',JSON['stringify'](_0x34ec07));if(_0x34ec07[_0x0216('0x12')]){if(_0x34ec07[_0x0216('0x12')][_0x0216('0x13')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x47af64,_0x34ec07[_0x0216('0x12')][_0x0216('0x14')]);return _0x578377(_0x34ec07[_0x0216('0x12')][_0x0216('0x14')]);}logger[_0x0216('0x12')](_0x0216('0x15'),_0x47af64,_0x34ec07[_0x0216('0x12')]['message']);return _0x2fd88d(_0x34ec07['error'][_0x0216('0x14')]);}else{logger[_0x0216('0xe')](_0x0216('0x15'),_0x47af64,_0x0216('0xf'));_0x2fd88d(_0x34ec07['result'][_0x0216('0x14')]);}})[_0x0216('0x16')](function(_0x49f9ef){logger[_0x0216('0x12')](_0x0216('0x15'),_0x47af64,_0x49f9ef);_0x578377(_0x49f9ef);});});}
\ No newline at end of file
+var _0x777d=['stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x277cff,_0x485110){var _0x3b4268=function(_0x4d0690){while(--_0x4d0690){_0x277cff['push'](_0x277cff['shift']());}};_0x3b4268(++_0x485110);}(_0x777d,0xe9));var _0xd777=function(_0x57fcc0,_0x585004){_0x57fcc0=_0x57fcc0-0x0;var _0x5270df=_0x777d[_0x57fcc0];return _0x5270df;};'use strict';var _=require('lodash');var util=require(_0xd777('0x0'));var moment=require(_0xd777('0x1'));var BPromise=require(_0xd777('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd777('0x3'));var db=require(_0xd777('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd777('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd777('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc7c954,_0x5d1a5f,_0x57d67f){return new BPromise(function(_0x49d55d,_0x197296){return client[_0xd777('0x7')](_0xc7c954,_0x57d67f)[_0xd777('0x8')](function(_0x25450d){logger[_0xd777('0x9')](_0xd777('0xa'),_0x5d1a5f,_0xd777('0xb'));logger[_0xd777('0xc')](_0xd777('0xd'),_0x5d1a5f,_0xd777('0xb'),JSON[_0xd777('0xe')](_0x25450d));if(_0x25450d[_0xd777('0xf')]){if(_0x25450d[_0xd777('0xf')]['code']===0x1f4){logger['error'](_0xd777('0xa'),_0x5d1a5f,_0x25450d['error'][_0xd777('0x10')]);return _0x197296(_0x25450d[_0xd777('0xf')][_0xd777('0x10')]);}logger[_0xd777('0xf')](_0xd777('0xa'),_0x5d1a5f,_0x25450d['error'][_0xd777('0x10')]);return _0x49d55d(_0x25450d['error'][_0xd777('0x10')]);}else{logger[_0xd777('0x9')](_0xd777('0xa'),_0x5d1a5f,_0xd777('0xb'));_0x49d55d(_0x25450d[_0xd777('0x11')]['message']);}})[_0xd777('0x12')](function(_0x4b3d52){logger[_0xd777('0xf')]('VoiceContext,\x20%s,\x20%s',_0x5d1a5f,_0x4b3d52);_0x197296(_0x4b3d52);});});}
\ No newline at end of file
index 6302289..d0f9294 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1521=['put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x5a6682,_0x4a4dc5){var _0x302c5a=function(_0x209f04){while(--_0x209f04){_0x5a6682['push'](_0x5a6682['shift']());}};_0x302c5a(++_0x4a4dc5);}(_0x1521,0x11c));var _0x1152=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0x1521[_0x4fb1b8];return _0x146c71;};'use strict';var multer=require('multer');var util=require(_0x1152('0x0'));var path=require(_0x1152('0x1'));var timeout=require(_0x1152('0x2'));var express=require(_0x1152('0x3'));var router=express[_0x1152('0x4')]();var fs_extra=require(_0x1152('0x5'));var auth=require(_0x1152('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1152('0x7'));var controller=require('./voiceDialReport.controller');router[_0x1152('0x8')]('/',auth[_0x1152('0x9')](),controller[_0x1152('0xa')]);router['get'](_0x1152('0xb'),auth[_0x1152('0x9')](),controller[_0x1152('0xc')]);router['get'](_0x1152('0xd'),auth[_0x1152('0x9')](),controller[_0x1152('0xe')]);router[_0x1152('0xf')]('/',auth[_0x1152('0x9')](),controller['create']);router[_0x1152('0x10')](_0x1152('0xd'),auth[_0x1152('0x9')](),controller[_0x1152('0x11')]);router[_0x1152('0x12')](_0x1152('0xd'),auth[_0x1152('0x9')](),controller[_0x1152('0x13')]);module['exports']=router;
\ No newline at end of file
+var _0xea70=['./voiceDialReport.controller','get','isAuthenticated','/describe','describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4ae8c2,_0x409a64){var _0x252e29=function(_0x4ead37){while(--_0x4ead37){_0x4ae8c2['push'](_0x4ae8c2['shift']());}};_0x252e29(++_0x409a64);}(_0xea70,0x175));var _0x0ea7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xea70[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var path=require(_0x0ea7('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ea7('0x3'));var router=express['Router']();var fs_extra=require(_0x0ea7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0ea7('0x5'));var config=require(_0x0ea7('0x6'));var controller=require(_0x0ea7('0x7'));router[_0x0ea7('0x8')]('/',auth[_0x0ea7('0x9')](),controller['index']);router[_0x0ea7('0x8')](_0x0ea7('0xa'),auth['isAuthenticated'](),controller[_0x0ea7('0xb')]);router[_0x0ea7('0x8')]('/:id',auth[_0x0ea7('0x9')](),controller[_0x0ea7('0xc')]);router[_0x0ea7('0xd')]('/',auth[_0x0ea7('0x9')](),controller['create']);router[_0x0ea7('0xe')](_0x0ea7('0xf'),auth[_0x0ea7('0x9')](),controller[_0x0ea7('0x10')]);router[_0x0ea7('0x11')]('/:id',auth[_0x0ea7('0x9')](),controller[_0x0ea7('0x12')]);module[_0x0ea7('0x13')]=router;
\ No newline at end of file
index 10b7bbb..0c9ea75 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9bde=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x1014b6,_0x4678b9){var _0x6e9f8b=function(_0x21c652){while(--_0x21c652){_0x1014b6['push'](_0x1014b6['shift']());}};_0x6e9f8b(++_0x4678b9);}(_0x9bde,0xe1));var _0xe9bd=function(_0x394305,_0x2cf11d){_0x394305=_0x394305-0x0;var _0x3c9cef=_0x9bde[_0x394305];return _0x3c9cef;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe9bd('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'calleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'calleridname':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinename':{'type':Sequelize[_0xe9bd('0x1')]},'language':{'type':Sequelize[_0xe9bd('0x1')]},'accountcode':{'type':Sequelize[_0xe9bd('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe9bd('0x1')]},'priority':{'type':Sequelize[_0xe9bd('0x2')]},'uniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'linkedid':{'type':Sequelize[_0xe9bd('0x1')]},'destchannel':{'type':Sequelize[_0xe9bd('0x1')]},'destchannelstate':{'type':Sequelize[_0xe9bd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridname':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe9bd('0x1')]},'destcontext':{'type':Sequelize[_0xe9bd('0x1')]},'destexten':{'type':Sequelize[_0xe9bd('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'destlinkedid':{'type':Sequelize[_0xe9bd('0x1')]},'dialstring':{'type':Sequelize[_0xe9bd('0x1')]},'dialstatus':{'type':Sequelize[_0xe9bd('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe9bd('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe9bd('0x1')],'comment':_0xe9bd('0x4')},'routeId':{'type':Sequelize[_0xe9bd('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe9bd('0x2')]}};
\ No newline at end of file
+var _0x8d0e=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x1afb5b,_0x494062){var _0x5ac8aa=function(_0x5cac0f){while(--_0x5cac0f){_0x1afb5b['push'](_0x1afb5b['shift']());}};_0x5ac8aa(++_0x494062);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x48f05b,_0x1790fe){_0x48f05b=_0x48f05b-0x0;var _0x1bbc41=_0x8d0e[_0x48f05b];return _0x1bbc41;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'privilege':{'type':Sequelize[_0xe8d0('0x2')]},'channel':{'type':Sequelize[_0xe8d0('0x2')]},'channelstate':{'type':Sequelize[_0xe8d0('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'calleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x3')]},'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'linkedid':{'type':Sequelize[_0xe8d0('0x2')]},'destchannel':{'type':Sequelize[_0xe8d0('0x2')]},'destchannelstate':{'type':Sequelize[_0xe8d0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe8d0('0x2')]},'destlanguage':{'type':Sequelize[_0xe8d0('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xe8d0('0x2')]},'destpriority':{'type':Sequelize[_0xe8d0('0x3')]},'destuniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'destlinkedid':{'type':Sequelize[_0xe8d0('0x2')]},'dialstring':{'type':Sequelize[_0xe8d0('0x2')]},'dialstatus':{'type':Sequelize[_0xe8d0('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe8d0('0x4')]},'endtime':{'type':Sequelize[_0xe8d0('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xe8d0('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xe8d0('0x3')]},'billableseconds':{'type':Sequelize[_0xe8d0('0x3')]}};
\ No newline at end of file
index 729f922..726044c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2bfb=['index','VoiceDialReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','rows','catch','params','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','sendStatus','name','send'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x2bfb,0x1ed));var _0xb2bf=function(_0x5365aa,_0x43d4de){_0x5365aa=_0x5365aa-0x0;var _0x5266d7=_0x2bfb[_0x5365aa];return _0x5266d7;};'use strict';var emlformat=require(_0xb2bf('0x0'));var rimraf=require(_0xb2bf('0x1'));var zipdir=require(_0xb2bf('0x2'));var jsonpatch=require(_0xb2bf('0x3'));var rp=require(_0xb2bf('0x4'));var moment=require(_0xb2bf('0x5'));var BPromise=require(_0xb2bf('0x6'));var Mustache=require(_0xb2bf('0x7'));var util=require('util');var path=require(_0xb2bf('0x8'));var sox=require('sox');var csv=require(_0xb2bf('0x9'));var ejs=require(_0xb2bf('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2bf('0xb'));var squel=require(_0xb2bf('0xc'));var crypto=require('crypto');var jsforce=require(_0xb2bf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb2bf('0x9'));var querystring=require(_0xb2bf('0xe'));var Papa=require(_0xb2bf('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb2bf('0x10'));var utils=require(_0xb2bf('0x11'));var config=require(_0xb2bf('0x12'));var licenseUtil=require(_0xb2bf('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bb573,_0x4ff6c7){_0x4ff6c7=_0x4ff6c7||0xcc;return function(_0x23395a){if(_0x23395a){return _0x2bb573['sendStatus'](_0x4ff6c7);}return _0x2bb573[_0xb2bf('0x14')](_0x4ff6c7)[_0xb2bf('0x15')]();};}function respondWithResult(_0x5c5dd7,_0x3b8dac){_0x3b8dac=_0x3b8dac||0xc8;return function(_0x30ae36){if(_0x30ae36){return _0x5c5dd7[_0xb2bf('0x14')](_0x3b8dac)['json'](_0x30ae36);}};}function respondWithFilteredResult(_0x34405c,_0x2cf03b){return function(_0x14c07f){if(_0x14c07f){var _0x56946c=typeof _0x2cf03b[_0xb2bf('0x16')]===_0xb2bf('0x17')&&typeof _0x2cf03b[_0xb2bf('0x18')]===_0xb2bf('0x17');var _0x53e501=_0x14c07f[_0xb2bf('0x19')];var _0x12c1fa=_0x56946c?0x0:_0x2cf03b['offset'];var _0xb7fbba=_0x56946c?_0x14c07f['count']:_0x2cf03b[_0xb2bf('0x16')]+_0x2cf03b['limit'];var _0x23f7e8;if(_0xb7fbba>=_0x53e501){_0xb7fbba=_0x53e501;_0x23f7e8=0xc8;}else{_0x23f7e8=0xce;}_0x34405c['status'](_0x23f7e8);return _0x34405c['set'](_0xb2bf('0x1a'),_0x12c1fa+'-'+_0xb7fbba+'/'+_0x53e501)[_0xb2bf('0x1b')](_0x14c07f);}return null;};}function patchUpdates(_0x90faad){return function(_0x6d94c7){try{jsonpatch['apply'](_0x6d94c7,_0x90faad,!![]);}catch(_0xcc1c15){return BPromise[_0xb2bf('0x1c')](_0xcc1c15);}return _0x6d94c7[_0xb2bf('0x1d')]();};}function saveUpdates(_0x510c8a,_0x415f2c){return function(_0x4f29bd){if(_0x4f29bd){return _0x4f29bd[_0xb2bf('0x1e')](_0x510c8a)['then'](function(_0x49fb87){return _0x49fb87;});}return null;};}function removeEntity(_0x231c49,_0x3f922b){return function(_0x219a1f){if(_0x219a1f){return _0x219a1f['destroy']()[_0xb2bf('0x1f')](function(){_0x231c49[_0xb2bf('0x14')](0xcc)[_0xb2bf('0x15')]();});}};}function handleEntityNotFound(_0x15ffcf,_0x28dcdb){return function(_0xdb3ca){if(!_0xdb3ca){_0x15ffcf[_0xb2bf('0x20')](0x194);}return _0xdb3ca;};}function handleError(_0x50c06c,_0x57bb88){_0x57bb88=_0x57bb88||0x1f4;return function(_0x2b0209){logger['error'](_0x2b0209['stack']);if(_0x2b0209[_0xb2bf('0x21')]){delete _0x2b0209[_0xb2bf('0x21')];}_0x50c06c[_0xb2bf('0x14')](_0x57bb88)[_0xb2bf('0x22')](_0x2b0209);};}exports[_0xb2bf('0x23')]=function(_0x41dcd9,_0x2ce9f4){var _0x4dd5e4={},_0x16027d={},_0x7150cd={'count':0x0,'rows':[]};var _0xedf0e1=_['map'](db[_0xb2bf('0x24')][_0xb2bf('0x25')],function(_0x2bc47b){return{'name':_0x2bc47b[_0xb2bf('0x26')],'type':_0x2bc47b[_0xb2bf('0x27')][_0xb2bf('0x28')]};});_0x16027d[_0xb2bf('0x29')]=_[_0xb2bf('0x2a')](_0xedf0e1,'name');_0x16027d['query']=_[_0xb2bf('0x2b')](_0x41dcd9[_0xb2bf('0x2c')]);_0x16027d[_0xb2bf('0x2d')]=_[_0xb2bf('0x2e')](_0x16027d[_0xb2bf('0x29')],_0x16027d['query']);_0x4dd5e4['attributes']=_['intersection'](_0x16027d[_0xb2bf('0x29')],qs[_0xb2bf('0x2f')](_0x41dcd9[_0xb2bf('0x2c')][_0xb2bf('0x2f')]));_0x4dd5e4['attributes']=_0x4dd5e4[_0xb2bf('0x30')][_0xb2bf('0x31')]?_0x4dd5e4[_0xb2bf('0x30')]:_0x16027d[_0xb2bf('0x29')];if(!_0x41dcd9['query'][_0xb2bf('0x32')]('nolimit')){_0x4dd5e4['limit']=qs[_0xb2bf('0x18')](_0x41dcd9[_0xb2bf('0x2c')]['limit']);_0x4dd5e4[_0xb2bf('0x16')]=qs[_0xb2bf('0x16')](_0x41dcd9[_0xb2bf('0x2c')][_0xb2bf('0x16')]);}_0x4dd5e4[_0xb2bf('0x33')]=qs['sort'](_0x41dcd9[_0xb2bf('0x2c')][_0xb2bf('0x34')]);_0x4dd5e4[_0xb2bf('0x35')]=qs['filters'](_['pick'](_0x41dcd9['query'],_0x16027d[_0xb2bf('0x2d')]),_0xedf0e1);if(_0x41dcd9['query'][_0xb2bf('0x36')]){_0x4dd5e4[_0xb2bf('0x35')]=_[_0xb2bf('0x37')](_0x4dd5e4[_0xb2bf('0x35')],{'$or':_[_0xb2bf('0x2a')](_0xedf0e1,function(_0x2cdc79){if(_0x2cdc79[_0xb2bf('0x27')]!=='VIRTUAL'){var _0x4e747c={};_0x4e747c[_0x2cdc79['name']]={'$like':'%'+_0x41dcd9[_0xb2bf('0x2c')][_0xb2bf('0x36')]+'%'};return _0x4e747c;}})});}_0x4dd5e4=_[_0xb2bf('0x37')]({},_0x4dd5e4,_0x41dcd9['options']);var _0x45dd23={'where':_0x4dd5e4[_0xb2bf('0x35')]};return db[_0xb2bf('0x24')][_0xb2bf('0x19')](_0x45dd23)['then'](function(_0x314517){_0x7150cd[_0xb2bf('0x19')]=_0x314517;if(_0x41dcd9['query'][_0xb2bf('0x38')]){_0x4dd5e4[_0xb2bf('0x39')]=[{'all':!![]}];}return db[_0xb2bf('0x24')]['findAll'](_0x4dd5e4);})['then'](function(_0x56a890){_0x7150cd[_0xb2bf('0x3a')]=_0x56a890;return _0x7150cd;})[_0xb2bf('0x1f')](respondWithFilteredResult(_0x2ce9f4,_0x4dd5e4))[_0xb2bf('0x3b')](handleError(_0x2ce9f4,null));};exports['show']=function(_0x54a99c,_0x481097){var _0x3dc9f7={'raw':!![],'where':{'id':_0x54a99c[_0xb2bf('0x3c')]['id']}},_0xc69955={};_0xc69955['model']=_['keys'](db[_0xb2bf('0x24')]['rawAttributes']);_0xc69955['query']=_[_0xb2bf('0x2b')](_0x54a99c[_0xb2bf('0x2c')]);_0xc69955[_0xb2bf('0x2d')]=_[_0xb2bf('0x2e')](_0xc69955[_0xb2bf('0x29')],_0xc69955[_0xb2bf('0x2c')]);_0x3dc9f7[_0xb2bf('0x30')]=_['intersection'](_0xc69955['model'],qs[_0xb2bf('0x2f')](_0x54a99c['query'][_0xb2bf('0x2f')]));_0x3dc9f7[_0xb2bf('0x30')]=_0x3dc9f7[_0xb2bf('0x30')]['length']?_0x3dc9f7[_0xb2bf('0x30')]:_0xc69955[_0xb2bf('0x29')];if(_0x54a99c['query'][_0xb2bf('0x38')]){_0x3dc9f7[_0xb2bf('0x39')]=[{'all':!![]}];}_0x3dc9f7=_[_0xb2bf('0x37')]({},_0x3dc9f7,_0x54a99c[_0xb2bf('0x3d')]);return db['VoiceDialReport'][_0xb2bf('0x3e')](_0x3dc9f7)[_0xb2bf('0x1f')](handleEntityNotFound(_0x481097,null))['then'](respondWithResult(_0x481097,null))[_0xb2bf('0x3b')](handleError(_0x481097,null));};exports[_0xb2bf('0x3f')]=function(_0x489330,_0x1c38c2){return db[_0xb2bf('0x24')]['create'](_0x489330[_0xb2bf('0x40')],{})[_0xb2bf('0x1f')](respondWithResult(_0x1c38c2,0xc9))[_0xb2bf('0x3b')](handleError(_0x1c38c2,null));};exports[_0xb2bf('0x1e')]=function(_0x517780,_0x46148c){if(_0x517780['body']['id']){delete _0x517780[_0xb2bf('0x40')]['id'];}return db[_0xb2bf('0x24')][_0xb2bf('0x3e')]({'where':{'id':_0x517780[_0xb2bf('0x3c')]['id']}})['then'](handleEntityNotFound(_0x46148c,null))['then'](saveUpdates(_0x517780[_0xb2bf('0x40')],null))['then'](respondWithResult(_0x46148c,null))[_0xb2bf('0x3b')](handleError(_0x46148c,null));};exports[_0xb2bf('0x41')]=function(_0x1d80f6,_0x39f90e){return db[_0xb2bf('0x24')][_0xb2bf('0x3e')]({'where':{'id':_0x1d80f6[_0xb2bf('0x3c')]['id']}})[_0xb2bf('0x1f')](handleEntityNotFound(_0x39f90e,null))[_0xb2bf('0x1f')](removeEntity(_0x39f90e,null))[_0xb2bf('0x3b')](handleError(_0x39f90e,null));};exports['describe']=function(_0x2bb5e2,_0x4aeae6){return db[_0xb2bf('0x24')]['describe']()['then'](respondWithResult(_0x4aeae6,null))[_0xb2bf('0x3b')](handleError(_0x4aeae6,null));};
\ No newline at end of file
+var _0xa727=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceDialReport','include','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x4b6643,_0x9e4308){var _0x3dc376=function(_0x39aab1){while(--_0x39aab1){_0x4b6643['push'](_0x4b6643['shift']());}};_0x3dc376(++_0x9e4308);}(_0xa727,0x16c));var _0x7a72=function(_0x473cb1,_0x59575f){_0x473cb1=_0x473cb1-0x0;var _0x586c4a=_0xa727[_0x473cb1];return _0x586c4a;};'use strict';var emlformat=require(_0x7a72('0x0'));var rimraf=require(_0x7a72('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a72('0x2'));var rp=require('request-promise');var moment=require(_0x7a72('0x3'));var BPromise=require(_0x7a72('0x4'));var Mustache=require(_0x7a72('0x5'));var util=require('util');var path=require(_0x7a72('0x6'));var sox=require(_0x7a72('0x7'));var csv=require(_0x7a72('0x8'));var ejs=require(_0x7a72('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a72('0xa'));var squel=require(_0x7a72('0xb'));var crypto=require(_0x7a72('0xc'));var jsforce=require(_0x7a72('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7a72('0x8'));var querystring=require(_0x7a72('0xe'));var Papa=require(_0x7a72('0xf'));var Redis=require(_0x7a72('0x10'));var authService=require(_0x7a72('0x11'));var qs=require(_0x7a72('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a72('0x13'));var logger=require(_0x7a72('0x14'))(_0x7a72('0x15'));var utils=require(_0x7a72('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7a72('0x17'));var db=require(_0x7a72('0x18'))['db'];function respondWithStatusCode(_0x312fb3,_0x2f8b1b){_0x2f8b1b=_0x2f8b1b||0xcc;return function(_0xa70cfb){if(_0xa70cfb){return _0x312fb3[_0x7a72('0x19')](_0x2f8b1b);}return _0x312fb3['status'](_0x2f8b1b)['end']();};}function respondWithResult(_0x1cfa8c,_0x26dc4b){_0x26dc4b=_0x26dc4b||0xc8;return function(_0x500064){if(_0x500064){return _0x1cfa8c[_0x7a72('0x1a')](_0x26dc4b)['json'](_0x500064);}};}function respondWithFilteredResult(_0x59a305,_0x471e04){return function(_0x58c4bf){if(_0x58c4bf){var _0xea826=typeof _0x471e04[_0x7a72('0x1b')]===_0x7a72('0x1c')&&typeof _0x471e04[_0x7a72('0x1d')]===_0x7a72('0x1c');var _0x1b3114=_0x58c4bf[_0x7a72('0x1e')];var _0x439995=_0xea826?0x0:_0x471e04[_0x7a72('0x1b')];var _0xc784f0=_0xea826?_0x58c4bf['count']:_0x471e04[_0x7a72('0x1b')]+_0x471e04['limit'];var _0x1e7289;if(_0xc784f0>=_0x1b3114){_0xc784f0=_0x1b3114;_0x1e7289=0xc8;}else{_0x1e7289=0xce;}_0x59a305[_0x7a72('0x1a')](_0x1e7289);return _0x59a305[_0x7a72('0x1f')](_0x7a72('0x20'),_0x439995+'-'+_0xc784f0+'/'+_0x1b3114)[_0x7a72('0x21')](_0x58c4bf);}return null;};}function patchUpdates(_0x268482){return function(_0x2ed7e9){try{jsonpatch[_0x7a72('0x22')](_0x2ed7e9,_0x268482,!![]);}catch(_0x1e89f2){return BPromise[_0x7a72('0x23')](_0x1e89f2);}return _0x2ed7e9[_0x7a72('0x24')]();};}function saveUpdates(_0x587804,_0x27dcb8){return function(_0x3ee522){if(_0x3ee522){return _0x3ee522[_0x7a72('0x25')](_0x587804)[_0x7a72('0x26')](function(_0x1ba829){return _0x1ba829;});}return null;};}function removeEntity(_0xc3e9c2,_0x49c6f4){return function(_0x2f88c9){if(_0x2f88c9){return _0x2f88c9[_0x7a72('0x27')]()['then'](function(){_0xc3e9c2[_0x7a72('0x1a')](0xcc)[_0x7a72('0x28')]();});}};}function handleEntityNotFound(_0x19f082,_0x10eb1d){return function(_0x1ec1fc){if(!_0x1ec1fc){_0x19f082[_0x7a72('0x19')](0x194);}return _0x1ec1fc;};}function handleError(_0x4f306f,_0x1f91be){_0x1f91be=_0x1f91be||0x1f4;return function(_0x9e4629){logger[_0x7a72('0x29')](_0x9e4629[_0x7a72('0x2a')]);if(_0x9e4629[_0x7a72('0x2b')]){delete _0x9e4629[_0x7a72('0x2b')];}_0x4f306f[_0x7a72('0x1a')](_0x1f91be)[_0x7a72('0x2c')](_0x9e4629);};}exports['index']=function(_0x4911ee,_0x9dac3c){var _0x46f275={},_0x80369d={},_0x31d401={'count':0x0,'rows':[]};var _0x3dfc75=_[_0x7a72('0x2d')](db['VoiceDialReport']['rawAttributes'],function(_0x315b13){return{'name':_0x315b13['fieldName'],'type':_0x315b13[_0x7a72('0x2e')]['key']};});_0x80369d['model']=_[_0x7a72('0x2d')](_0x3dfc75,_0x7a72('0x2b'));_0x80369d[_0x7a72('0x2f')]=_[_0x7a72('0x30')](_0x4911ee[_0x7a72('0x2f')]);_0x80369d[_0x7a72('0x31')]=_[_0x7a72('0x32')](_0x80369d['model'],_0x80369d[_0x7a72('0x2f')]);_0x46f275[_0x7a72('0x33')]=_[_0x7a72('0x32')](_0x80369d[_0x7a72('0x34')],qs[_0x7a72('0x35')](_0x4911ee[_0x7a72('0x2f')]['fields']));_0x46f275[_0x7a72('0x33')]=_0x46f275[_0x7a72('0x33')][_0x7a72('0x36')]?_0x46f275[_0x7a72('0x33')]:_0x80369d[_0x7a72('0x34')];if(!_0x4911ee[_0x7a72('0x2f')][_0x7a72('0x37')](_0x7a72('0x38'))){_0x46f275[_0x7a72('0x1d')]=qs[_0x7a72('0x1d')](_0x4911ee['query'][_0x7a72('0x1d')]);_0x46f275[_0x7a72('0x1b')]=qs[_0x7a72('0x1b')](_0x4911ee[_0x7a72('0x2f')][_0x7a72('0x1b')]);}_0x46f275[_0x7a72('0x39')]=qs[_0x7a72('0x3a')](_0x4911ee['query']['sort']);_0x46f275[_0x7a72('0x3b')]=qs[_0x7a72('0x31')](_[_0x7a72('0x3c')](_0x4911ee[_0x7a72('0x2f')],_0x80369d['filters']),_0x3dfc75);if(_0x4911ee[_0x7a72('0x2f')][_0x7a72('0x3d')]){_0x46f275[_0x7a72('0x3b')]=_[_0x7a72('0x3e')](_0x46f275[_0x7a72('0x3b')],{'$or':_[_0x7a72('0x2d')](_0x3dfc75,function(_0x1e8771){if(_0x1e8771[_0x7a72('0x2e')]!=='VIRTUAL'){var _0x3a1947={};_0x3a1947[_0x1e8771['name']]={'$like':'%'+_0x4911ee[_0x7a72('0x2f')][_0x7a72('0x3d')]+'%'};return _0x3a1947;}})});}_0x46f275=_[_0x7a72('0x3e')]({},_0x46f275,_0x4911ee[_0x7a72('0x3f')]);var _0x66be7b={'where':_0x46f275[_0x7a72('0x3b')]};return db[_0x7a72('0x40')][_0x7a72('0x1e')](_0x66be7b)[_0x7a72('0x26')](function(_0xc59cc9){_0x31d401[_0x7a72('0x1e')]=_0xc59cc9;if(_0x4911ee[_0x7a72('0x2f')]['includeAll']){_0x46f275[_0x7a72('0x41')]=[{'all':!![]}];}return db[_0x7a72('0x40')]['findAll'](_0x46f275);})['then'](function(_0x230f08){_0x31d401[_0x7a72('0x42')]=_0x230f08;return _0x31d401;})[_0x7a72('0x26')](respondWithFilteredResult(_0x9dac3c,_0x46f275))[_0x7a72('0x43')](handleError(_0x9dac3c,null));};exports[_0x7a72('0x44')]=function(_0x29f52a,_0x1a3a61){var _0x1bbfbe={'raw':!![],'where':{'id':_0x29f52a[_0x7a72('0x45')]['id']}},_0x3ddc60={};_0x3ddc60[_0x7a72('0x34')]=_[_0x7a72('0x30')](db[_0x7a72('0x40')]['rawAttributes']);_0x3ddc60['query']=_[_0x7a72('0x30')](_0x29f52a[_0x7a72('0x2f')]);_0x3ddc60[_0x7a72('0x31')]=_['intersection'](_0x3ddc60[_0x7a72('0x34')],_0x3ddc60[_0x7a72('0x2f')]);_0x1bbfbe['attributes']=_[_0x7a72('0x32')](_0x3ddc60[_0x7a72('0x34')],qs[_0x7a72('0x35')](_0x29f52a[_0x7a72('0x2f')][_0x7a72('0x35')]));_0x1bbfbe['attributes']=_0x1bbfbe[_0x7a72('0x33')]['length']?_0x1bbfbe[_0x7a72('0x33')]:_0x3ddc60[_0x7a72('0x34')];if(_0x29f52a[_0x7a72('0x2f')][_0x7a72('0x46')]){_0x1bbfbe[_0x7a72('0x41')]=[{'all':!![]}];}_0x1bbfbe=_[_0x7a72('0x3e')]({},_0x1bbfbe,_0x29f52a[_0x7a72('0x3f')]);return db[_0x7a72('0x40')][_0x7a72('0x47')](_0x1bbfbe)['then'](handleEntityNotFound(_0x1a3a61,null))[_0x7a72('0x26')](respondWithResult(_0x1a3a61,null))[_0x7a72('0x43')](handleError(_0x1a3a61,null));};exports[_0x7a72('0x48')]=function(_0x42c5bc,_0xe5f065){return db[_0x7a72('0x40')]['create'](_0x42c5bc['body'],{})['then'](respondWithResult(_0xe5f065,0xc9))[_0x7a72('0x43')](handleError(_0xe5f065,null));};exports[_0x7a72('0x25')]=function(_0x378595,_0x5a5e0e){if(_0x378595['body']['id']){delete _0x378595['body']['id'];}return db[_0x7a72('0x40')][_0x7a72('0x47')]({'where':{'id':_0x378595[_0x7a72('0x45')]['id']}})[_0x7a72('0x26')](handleEntityNotFound(_0x5a5e0e,null))[_0x7a72('0x26')](saveUpdates(_0x378595[_0x7a72('0x49')],null))[_0x7a72('0x26')](respondWithResult(_0x5a5e0e,null))[_0x7a72('0x43')](handleError(_0x5a5e0e,null));};exports[_0x7a72('0x27')]=function(_0x43331e,_0x4b1475){return db[_0x7a72('0x40')][_0x7a72('0x47')]({'where':{'id':_0x43331e[_0x7a72('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b1475,null))['then'](removeEntity(_0x4b1475,null))[_0x7a72('0x43')](handleError(_0x4b1475,null));};exports['describe']=function(_0x2b0b7e,_0xdf30b9){return db[_0x7a72('0x40')][_0x7a72('0x4a')]()[_0x7a72('0x26')](respondWithResult(_0xdf30b9,null))['catch'](handleError(_0xdf30b9,null));};
\ No newline at end of file
index 3743d34..89cdc30 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x074c=['util','api','moment','bluebird','path','rimraf','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','uniqueid','lodash'];(function(_0x51821c,_0x2e39c5){var _0x20bde8=function(_0x2d307a){while(--_0x2d307a){_0x51821c['push'](_0x51821c['shift']());}};_0x20bde8(++_0x2e39c5);}(_0x074c,0x9b));var _0xc074=function(_0x28ea86,_0x15dee1){_0x28ea86=_0x28ea86-0x0;var _0x45bf56=_0x074c[_0x28ea86];return _0x45bf56;};'use strict';var _=require(_0xc074('0x0'));var util=require(_0xc074('0x1'));var logger=require('../../config/logger')(_0xc074('0x2'));var moment=require(_0xc074('0x3'));var BPromise=require(_0xc074('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc074('0x5'));var rimraf=require(_0xc074('0x6'));var config=require('../../config/environment');var attributes=require(_0xc074('0x7'));module[_0xc074('0x8')]=function(_0x5cd593,_0xc8767d){return _0x5cd593['define'](_0xc074('0x9'),attributes,{'tableName':_0xc074('0xa'),'paranoid':![],'indexes':[{'fields':[_0xc074('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x6f2a=['path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','lodash','../../config/logger','api','moment'];(function(_0x5489f7,_0x262142){var _0x4b74d1=function(_0x1c2253){while(--_0x1c2253){_0x5489f7['push'](_0x5489f7['shift']());}};_0x4b74d1(++_0x262142);}(_0x6f2a,0x1e0));var _0xa6f2=function(_0x3616f0,_0x1b4301){_0x3616f0=_0x3616f0-0x0;var _0x1830b6=_0x6f2a[_0x3616f0];return _0x1830b6;};'use strict';var _=require(_0xa6f2('0x0'));var util=require('util');var logger=require(_0xa6f2('0x1'))(_0xa6f2('0x2'));var moment=require(_0xa6f2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa6f2('0x4'));var rimraf=require(_0xa6f2('0x5'));var config=require(_0xa6f2('0x6'));var attributes=require(_0xa6f2('0x7'));module[_0xa6f2('0x8')]=function(_0x953046,_0x17e952){return _0x953046[_0xa6f2('0x9')](_0xa6f2('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
index 6791a73..16ddc9e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x39b9=['request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','stringify','catch','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s'];(function(_0x5c6a1b,_0x11e4c0){var _0x348603=function(_0x9f4358){while(--_0x9f4358){_0x5c6a1b['push'](_0x5c6a1b['shift']());}};_0x348603(++_0x11e4c0);}(_0x39b9,0x162));var _0x939b=function(_0x3a0ebd,_0x47f368){_0x3a0ebd=_0x3a0ebd-0x0;var _0x51a660=_0x39b9[_0x3a0ebd];return _0x51a660;};'use strict';var _=require(_0x939b('0x0'));var util=require(_0x939b('0x1'));var moment=require(_0x939b('0x2'));var BPromise=require(_0x939b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x939b('0x4'));var db=require(_0x939b('0x5'))['db'];var utils=require(_0x939b('0x6'));var logger=require(_0x939b('0x7'))(_0x939b('0x8'));var config=require(_0x939b('0x9'));var jayson=require(_0x939b('0xa'));var client=jayson[_0x939b('0xb')][_0x939b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x509912,_0x5eeda9,_0x4c7534){return new BPromise(function(_0x171984,_0x487d05){return client[_0x939b('0xd')](_0x509912,_0x4c7534)['then'](function(_0x2ed138){logger[_0x939b('0xe')](_0x939b('0xf'),_0x5eeda9,_0x939b('0x10'));logger[_0x939b('0x11')](_0x939b('0x12'),_0x5eeda9,_0x939b('0x10'),JSON['stringify'](_0x2ed138));if(_0x2ed138[_0x939b('0x13')]){if(_0x2ed138[_0x939b('0x13')][_0x939b('0x14')]===0x1f4){logger[_0x939b('0x13')](_0x939b('0xf'),_0x5eeda9,_0x2ed138['error'][_0x939b('0x15')]);return _0x487d05(_0x2ed138[_0x939b('0x13')][_0x939b('0x15')]);}logger[_0x939b('0x13')](_0x939b('0xf'),_0x5eeda9,_0x2ed138[_0x939b('0x13')][_0x939b('0x15')]);return _0x171984(_0x2ed138['error']['message']);}else{logger[_0x939b('0xe')](_0x939b('0xf'),_0x5eeda9,_0x939b('0x10'));_0x171984(_0x2ed138[_0x939b('0x16')]['message']);}})['catch'](function(_0x19bd61){logger[_0x939b('0x13')](_0x939b('0xf'),_0x5eeda9,_0x19bd61);_0x487d05(_0x19bd61);});});}exports[_0x939b('0x17')]=function(_0x3548fe){var _0x261c42=this;return new Promise(function(_0x290490,_0x3c3b8f){return db[_0x939b('0x18')][_0x939b('0x19')](_0x3548fe[_0x939b('0x1a')],{'raw':_0x3548fe['options']?_0x3548fe[_0x939b('0x1b')][_0x939b('0x1c')]===undefined?!![]:![]:!![]})[_0x939b('0x1d')](function(_0x3e1358){logger[_0x939b('0xe')]('CreateVoiceDialReport',_0x3548fe);logger['debug']('CreateVoiceDialReport',_0x3548fe,JSON[_0x939b('0x1e')](_0x3e1358));_0x290490(_0x3e1358);})[_0x939b('0x1f')](function(_0x4d9256){logger[_0x939b('0x13')]('CreateVoiceDialReport',_0x4d9256[_0x939b('0x15')],_0x3548fe);_0x3c3b8f(_0x261c42[_0x939b('0x13')](0x1f4,_0x4d9256[_0x939b('0x15')]));});});};exports[_0x939b('0x20')]=function(_0x229002){var _0x4e9490=this;return new Promise(function(_0x2ed0d5,_0x4fcd01){return db[_0x939b('0x18')][_0x939b('0x21')](_0x229002[_0x939b('0x1a')],{'raw':_0x229002[_0x939b('0x1b')]?_0x229002['options'][_0x939b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x229002[_0x939b('0x1b')]?_0x229002[_0x939b('0x1b')][_0x939b('0x22')]||null:null,'attributes':_0x229002[_0x939b('0x1b')]?_0x229002['options'][_0x939b('0x23')]||null:null,'limit':_0x229002[_0x939b('0x1b')]?_0x229002[_0x939b('0x1b')][_0x939b('0x24')]||null:null})[_0x939b('0x1d')](function(_0x2d4164){logger[_0x939b('0xe')](_0x939b('0x20'),_0x229002);logger[_0x939b('0x11')]('UpdateVoiceDialReport',_0x229002,JSON[_0x939b('0x1e')](_0x2d4164));_0x2ed0d5(_0x2d4164);})[_0x939b('0x1f')](function(_0x57dea2){logger[_0x939b('0x13')](_0x939b('0x20'),_0x57dea2[_0x939b('0x15')],_0x229002);_0x4fcd01(_0x4e9490[_0x939b('0x13')](0x1f4,_0x57dea2[_0x939b('0x15')]));});});};
\ No newline at end of file
+var _0xf07f=['info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','catch','UpdateVoiceDialReport','attributes','limit','then','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x16beca,_0x2458e8){var _0x45e93e=function(_0x2cc912){while(--_0x2cc912){_0x16beca['push'](_0x16beca['shift']());}};_0x45e93e(++_0x2458e8);}(_0xf07f,0xed));var _0xff07=function(_0x253871,_0x45b54b){_0x253871=_0x253871-0x0;var _0x3dc42c=_0xf07f[_0x253871];return _0x3dc42c;};'use strict';var _=require(_0xff07('0x0'));var util=require('util');var moment=require(_0xff07('0x1'));var BPromise=require('bluebird');var rs=require(_0xff07('0x2'));var fs=require('fs');var Redis=require(_0xff07('0x3'));var db=require(_0xff07('0x4'))['db'];var utils=require(_0xff07('0x5'));var logger=require('../../config/logger')(_0xff07('0x6'));var config=require(_0xff07('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xff07('0x8')][_0xff07('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f7d1e,_0x6b1d43,_0x1d4793){return new BPromise(function(_0x436bad,_0x39e2f8){return client[_0xff07('0xa')](_0x4f7d1e,_0x1d4793)['then'](function(_0x4a8be1){logger[_0xff07('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x6b1d43,_0xff07('0xc'));logger[_0xff07('0xd')](_0xff07('0xe'),_0x6b1d43,_0xff07('0xc'),JSON['stringify'](_0x4a8be1));if(_0x4a8be1[_0xff07('0xf')]){if(_0x4a8be1[_0xff07('0xf')][_0xff07('0x10')]===0x1f4){logger[_0xff07('0xf')](_0xff07('0x11'),_0x6b1d43,_0x4a8be1['error'][_0xff07('0x12')]);return _0x39e2f8(_0x4a8be1[_0xff07('0xf')][_0xff07('0x12')]);}logger[_0xff07('0xf')](_0xff07('0x11'),_0x6b1d43,_0x4a8be1[_0xff07('0xf')][_0xff07('0x12')]);return _0x436bad(_0x4a8be1['error'][_0xff07('0x12')]);}else{logger[_0xff07('0xb')](_0xff07('0x11'),_0x6b1d43,_0xff07('0xc'));_0x436bad(_0x4a8be1[_0xff07('0x13')][_0xff07('0x12')]);}})['catch'](function(_0x13d2d6){logger[_0xff07('0xf')](_0xff07('0x11'),_0x6b1d43,_0x13d2d6);_0x39e2f8(_0x13d2d6);});});}exports[_0xff07('0x14')]=function(_0x706a3c){var _0x479e28=this;return new Promise(function(_0x249af9,_0x513f13){return db[_0xff07('0x15')][_0xff07('0x16')](_0x706a3c[_0xff07('0x17')],{'raw':_0x706a3c['options']?_0x706a3c[_0xff07('0x18')][_0xff07('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x31ae50){logger[_0xff07('0xb')](_0xff07('0x14'),_0x706a3c);logger[_0xff07('0xd')]('CreateVoiceDialReport',_0x706a3c,JSON['stringify'](_0x31ae50));_0x249af9(_0x31ae50);})[_0xff07('0x1a')](function(_0x30e1fa){logger[_0xff07('0xf')](_0xff07('0x14'),_0x30e1fa[_0xff07('0x12')],_0x706a3c);_0x513f13(_0x479e28[_0xff07('0xf')](0x1f4,_0x30e1fa[_0xff07('0x12')]));});});};exports[_0xff07('0x1b')]=function(_0x91f29e){var _0x13b605=this;return new Promise(function(_0x3dd99a,_0x2508a7){return db['VoiceDialReport']['update'](_0x91f29e[_0xff07('0x17')],{'raw':_0x91f29e[_0xff07('0x18')]?_0x91f29e[_0xff07('0x18')][_0xff07('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x91f29e[_0xff07('0x18')]?_0x91f29e[_0xff07('0x18')]['where']||null:null,'attributes':_0x91f29e['options']?_0x91f29e[_0xff07('0x18')][_0xff07('0x1c')]||null:null,'limit':_0x91f29e['options']?_0x91f29e[_0xff07('0x18')][_0xff07('0x1d')]||null:null})[_0xff07('0x1e')](function(_0x2a7386){logger['info'](_0xff07('0x1b'),_0x91f29e);logger[_0xff07('0xd')]('UpdateVoiceDialReport',_0x91f29e,JSON['stringify'](_0x2a7386));_0x3dd99a(_0x2a7386);})[_0xff07('0x1a')](function(_0x507494){logger[_0xff07('0xf')](_0xff07('0x1b'),_0x507494['message'],_0x91f29e);_0x2508a7(_0x13b605[_0xff07('0xf')](0x1f4,_0x507494[_0xff07('0x12')]));});});};
\ No newline at end of file
index 1dde355..7fad35b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf49e=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','/:id','post','addApplications','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0xe53257,_0x5a8117){var _0xfdc3a1=function(_0x53eb23){while(--_0x53eb23){_0xe53257['push'](_0xe53257['shift']());}};_0xfdc3a1(++_0x5a8117);}(_0xf49e,0x117));var _0xef49=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xf49e[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xef49('0x0'));var util=require('util');var path=require(_0xef49('0x1'));var timeout=require(_0xef49('0x2'));var express=require(_0xef49('0x3'));var router=express[_0xef49('0x4')]();var fs_extra=require(_0xef49('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xef49('0x6'));var config=require(_0xef49('0x7'));var controller=require(_0xef49('0x8'));router['get']('/',auth[_0xef49('0x9')](),controller[_0xef49('0xa')]);router[_0xef49('0xb')](_0xef49('0xc'),auth[_0xef49('0x9')](),controller['show']);router['post']('/',auth[_0xef49('0x9')](),controller['create']);router[_0xef49('0xd')]('/:id/applications',auth[_0xef49('0x9')](),controller[_0xef49('0xe')]);router[_0xef49('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xef49('0x10')]);router[_0xef49('0x11')](_0xef49('0xc'),auth[_0xef49('0x9')](),controller[_0xef49('0x12')]);module['exports']=router;
\ No newline at end of file
+var _0x15dd=['get','/:id','isAuthenticated','post','create','addApplications','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller'];(function(_0x41ebf7,_0x51d695){var _0x4be724=function(_0x3d1fa7){while(--_0x3d1fa7){_0x41ebf7['push'](_0x41ebf7['shift']());}};_0x4be724(++_0x51d695);}(_0x15dd,0x118));var _0xd15d=function(_0x31f076,_0x287501){_0x31f076=_0x31f076-0x0;var _0x518098=_0x15dd[_0x31f076];return _0x518098;};'use strict';var multer=require(_0xd15d('0x0'));var util=require('util');var path=require(_0xd15d('0x1'));var timeout=require(_0xd15d('0x2'));var express=require(_0xd15d('0x3'));var router=express['Router']();var fs_extra=require(_0xd15d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd15d('0x5'));var config=require(_0xd15d('0x6'));var controller=require(_0xd15d('0x7'));router[_0xd15d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd15d('0x8')](_0xd15d('0x9'),auth[_0xd15d('0xa')](),controller['show']);router[_0xd15d('0xb')]('/',auth['isAuthenticated'](),controller[_0xd15d('0xc')]);router[_0xd15d('0xb')]('/:id/applications',auth[_0xd15d('0xa')](),controller[_0xd15d('0xd')]);router['put'](_0xd15d('0x9'),auth[_0xd15d('0xa')](),controller[_0xd15d('0xe')]);router[_0xd15d('0xf')](_0xd15d('0x9'),auth[_0xd15d('0xa')](),controller[_0xd15d('0x10')]);module[_0xd15d('0x11')]=router;
\ No newline at end of file
index 181a5b1..033ba24 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7b14=['any','*,*,*,*','INTEGER','wav','BOOLEAN','VIRTUAL','getDataValue','sequelize','exports','STRING','ENUM','inbound','outbound','internal','inbound-fax','system'];(function(_0x546496,_0x51544c){var _0x3afe5a=function(_0x190030){while(--_0x190030){_0x546496['push'](_0x546496['shift']());}};_0x3afe5a(++_0x51544c);}(_0x7b14,0x107));var _0x47b1=function(_0x96080a,_0x39ac46){_0x96080a=_0x96080a-0x0;var _0x11440a=_0x7b14[_0x96080a];return _0x11440a;};'use strict';var Sequelize=require(_0x47b1('0x0'));module[_0x47b1('0x1')]={'context':{'type':Sequelize[_0x47b1('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x47b1('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x47b1('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x47b1('0x3')](_0x47b1('0x4'),_0x47b1('0x5'),_0x47b1('0x6'),_0x47b1('0x7'),'outbound-fax',_0x47b1('0x8'),_0x47b1('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x47b1('0xa')},'IntervalId':{'type':Sequelize[_0x47b1('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x47b1('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x47b1('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x47b1('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x47b1('0xc')},'answer':{'type':Sequelize[_0x47b1('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x47b1('0xe')],'get':function(_0x444e68){return this[_0x47b1('0xf')]('exten');}},'alias':{'type':Sequelize[_0x47b1('0x2')],'allowNull':!![]}};
\ No newline at end of file
+var _0x5582=['inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','compositeIndex','STRING','NoOp','ENUM','outbound'];(function(_0x2ece48,_0x3ead11){var _0x2112b4=function(_0x5b8ed2){while(--_0x5b8ed2){_0x2ece48['push'](_0x2ece48['shift']());}};_0x2112b4(++_0x3ead11);}(_0x5582,0xf8));var _0x2558=function(_0x365ad1,_0x597ef6){_0x365ad1=_0x365ad1-0x0;var _0x4c9c37=_0x5582[_0x365ad1];return _0x4c9c37;};'use strict';var Sequelize=require(_0x2558('0x0'));module[_0x2558('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2558('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x2558('0x3')],'allowNull':![],'unique':_0x2558('0x2')},'priority':{'type':Sequelize[_0x2558('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x2558('0x2')},'tag':{'type':Sequelize[_0x2558('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x2558('0x3')],'allowNull':![],'defaultValue':_0x2558('0x4')},'appdata':{'type':Sequelize[_0x2558('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x2558('0x5')]('inbound',_0x2558('0x6'),'internal',_0x2558('0x7'),_0x2558('0x8'),_0x2558('0x9'),_0x2558('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x2558('0x3')]},'interval':{'type':Sequelize[_0x2558('0x3')],'allowNull':![],'defaultValue':_0x2558('0xb')},'IntervalId':{'type':Sequelize[_0x2558('0xc')]},'isApp':{'type':Sequelize[_0x2558('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x2558('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x2558('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0x2558('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x2558('0xc')]},'recordingFormat':{'type':Sequelize[_0x2558('0x3')],'defaultValue':_0x2558('0xe')},'answer':{'type':Sequelize[_0x2558('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x2558('0xf')],'get':function(_0x260efc){return this['getDataValue'](_0x2558('0x10'));}},'alias':{'type':Sequelize[_0x2558('0x3')],'allowNull':!![]}};
\ No newline at end of file
index f8ca352..9e2107c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x271e=['Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','./voiceExtension.socket','sendStatus','status','end','json','limit','count','offset','set','Content-Range','destroy','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','includes','type','find','name','UserProfileResource','stack','send','index','VoiceExtension','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','startsWith','concat','user','get','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','exten','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction'];(function(_0x49fe7f,_0x5349c1){var _0x1b5ce1=function(_0x1cf090){while(--_0x1cf090){_0x49fe7f['push'](_0x49fe7f['shift']());}};_0x1b5ce1(++_0x5349c1);}(_0x271e,0x68));var _0xe271=function(_0x470d21,_0x367605){_0x470d21=_0x470d21-0x0;var _0x224ea7=_0x271e[_0x470d21];return _0x224ea7;};'use strict';var _=require('lodash');var Redis=require(_0xe271('0x0'));var qs=require(_0xe271('0x1'));var logger=require('../../config/logger')(_0xe271('0x2'));var config=require(_0xe271('0x3'));var db=require(_0xe271('0x4'))['db'];config[_0xe271('0x5')]=_['defaults'](config[_0xe271('0x5')],{'host':_0xe271('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe271('0x5')]));require(_0xe271('0x7'))['register'](socket);function respondWithStatusCode(_0xf89471,_0x5d9b05){_0x5d9b05=_0x5d9b05||0xcc;return function(_0x47f683){if(_0x47f683){return _0xf89471[_0xe271('0x8')](_0x5d9b05);}return _0xf89471[_0xe271('0x9')](_0x5d9b05)[_0xe271('0xa')]();};}function respondWithResult(_0x4be549,_0x371e6d){_0x371e6d=_0x371e6d||0xc8;return function(_0x3b8e4b){if(_0x3b8e4b){return _0x4be549['status'](_0x371e6d)[_0xe271('0xb')](_0x3b8e4b);}};}function respondWithFilteredResult(_0x58a101,_0xf7befb){return function(_0x1b501e){if(_0x1b501e){var _0x48391a=typeof _0xf7befb['offset']==='undefined'&&typeof _0xf7befb[_0xe271('0xc')]==='undefined';var _0x1f95b1=_0x1b501e[_0xe271('0xd')];var _0x35d82e=_0x48391a?0x0:_0xf7befb[_0xe271('0xe')];var _0x34fca4=_0x48391a?_0x1b501e[_0xe271('0xd')]:_0xf7befb[_0xe271('0xe')]+_0xf7befb['limit'];var _0x44d6ee;if(_0x34fca4>=_0x1f95b1){_0x34fca4=_0x1f95b1;_0x44d6ee=0xc8;}else{_0x44d6ee=0xce;}_0x58a101[_0xe271('0x9')](_0x44d6ee);return _0x58a101[_0xe271('0xf')](_0xe271('0x10'),_0x35d82e+'-'+_0x34fca4+'/'+_0x1f95b1)[_0xe271('0xb')](_0x1b501e);}return null;};}function removeEntity(_0x8a98b6){return function(_0x519339){if(_0x519339){return _0x519339[_0xe271('0x11')]()[_0xe271('0x12')](function(){var _0x27bae8=_0x519339['get']({'plain':!![]});var _0x2b1a8b=[{'name':_0xe271('0x13'),'value':_0xe271('0x14'),'ignore':![]},{'name':_0xe271('0x15'),'value':_0xe271('0x16'),'ignore':![]},{'name':_0xe271('0x17'),'value':_0xe271('0x18'),'ignore':![]}];var _0x348e68=_(_0x2b1a8b)[_0xe271('0x19')]('ignore')[_0xe271('0x1a')](_0xe271('0x1b'))[_0xe271('0x1b')]();if(_[_0xe271('0x1c')](_0x348e68,_0x27bae8[_0xe271('0x1d')])){return;}var _0x275904=_[_0xe271('0x1e')](_0x2b1a8b,[_0xe271('0x1b'),_0x27bae8[_0xe271('0x1d')]])[_0xe271('0x1f')];return db[_0xe271('0x20')][_0xe271('0x11')]({'where':{'type':_0x275904,'resourceId':_0x27bae8['id']}})[_0xe271('0x12')](function(){return _0x519339;});})[_0xe271('0x12')](function(){_0x8a98b6[_0xe271('0x9')](0xcc)[_0xe271('0xa')]();});}};}function handleEntityNotFound(_0x3fab28){return function(_0x1b887b){if(!_0x1b887b){_0x3fab28[_0xe271('0x8')](0x194);}return _0x1b887b;};}function handleError(_0x2d1669,_0x1df3fb){_0x1df3fb=_0x1df3fb||0x1f4;return function(_0xfe8db5){logger['error'](_0xfe8db5[_0xe271('0x21')]);if(_0xfe8db5['name']){delete _0xfe8db5[_0xe271('0x1f')];}_0x2d1669['status'](_0x1df3fb)[_0xe271('0x22')](_0xfe8db5);};}exports[_0xe271('0x23')]=function(_0x15f88e,_0x54232e){var _0x45d0d1={},_0x13c299={},_0x1a0144={'count':0x0,'rows':[]};var _0x78442f=_[_0xe271('0x1a')](db[_0xe271('0x24')][_0xe271('0x25')],function(_0x3f575e){return{'name':_0x3f575e[_0xe271('0x26')],'type':_0x3f575e[_0xe271('0x1d')]['key']};});_0x13c299[_0xe271('0x27')]=_[_0xe271('0x1a')](_0x78442f,_0xe271('0x1f'));_0x13c299[_0xe271('0x28')]=_[_0xe271('0x29')](_0x15f88e[_0xe271('0x28')]);_0x13c299['filters']=_[_0xe271('0x2a')](_0x13c299[_0xe271('0x27')],_0x13c299[_0xe271('0x28')]);_0x45d0d1[_0xe271('0x2b')]=_['intersection'](_0x13c299['model'],qs[_0xe271('0x2c')](_0x15f88e[_0xe271('0x28')][_0xe271('0x2c')]));_0x45d0d1[_0xe271('0x2b')]=_0x45d0d1['attributes'][_0xe271('0x2d')]?_0x45d0d1[_0xe271('0x2b')]:_0x13c299[_0xe271('0x27')];if(!_0x15f88e['query'][_0xe271('0x2e')](_0xe271('0x2f'))){_0x45d0d1['limit']=qs['limit'](_0x15f88e['query']['limit']);_0x45d0d1[_0xe271('0xe')]=qs[_0xe271('0xe')](_0x15f88e[_0xe271('0x28')][_0xe271('0xe')]);}_0x45d0d1['order']=qs[_0xe271('0x30')](_0x15f88e['query']['sort']);_0x45d0d1[_0xe271('0x31')]=qs[_0xe271('0x32')](_[_0xe271('0x33')](_0x15f88e['query'],_0x13c299[_0xe271('0x32')]),_0x78442f);if(_0x15f88e[_0xe271('0x28')][_0xe271('0x19')]){_0x45d0d1['where']=_[_0xe271('0x34')](_0x45d0d1['where'],{'$or':_[_0xe271('0x1a')](_0x78442f,function(_0xea16d7){if(_0xea16d7[_0xe271('0x1d')]!=='VIRTUAL'){var _0x160969={};_0x160969[_0xea16d7[_0xe271('0x1f')]]={'$like':'%'+_0x15f88e[_0xe271('0x28')]['filter']+'%'};return _0x160969;}})});}_0x45d0d1=_[_0xe271('0x34')]({},_0x45d0d1,_0x15f88e[_0xe271('0x35')]);var _0x450c89={'where':_0x45d0d1[_0xe271('0x31')]};return db[_0xe271('0x24')][_0xe271('0xd')](_0x450c89)[_0xe271('0x12')](function(_0x2d1e1a){_0x1a0144['count']=_0x2d1e1a;if(_0x15f88e[_0xe271('0x28')][_0xe271('0x36')]){_0x45d0d1[_0xe271('0x37')]=[{'all':!![]}];}return db[_0xe271('0x24')][_0xe271('0x38')](_0x45d0d1);})['then'](function(_0x40fcdc){_0x1a0144[_0xe271('0x39')]=_0x40fcdc;return _0x1a0144;})[_0xe271('0x12')](respondWithFilteredResult(_0x54232e,_0x45d0d1))[_0xe271('0x3a')](handleError(_0x54232e,null));};exports[_0xe271('0x3b')]=function(_0x559d44,_0x566b01){var _0x4c471c={'raw':![],'where':{'id':_0x559d44[_0xe271('0x3c')]['id']}},_0x32c11f={};_0x32c11f[_0xe271('0x27')]=_[_0xe271('0x29')](db[_0xe271('0x24')][_0xe271('0x25')]);_0x32c11f[_0xe271('0x28')]=_[_0xe271('0x29')](_0x559d44[_0xe271('0x28')]);_0x32c11f['filters']=_[_0xe271('0x2a')](_0x32c11f[_0xe271('0x27')],_0x32c11f['query']);_0x4c471c[_0xe271('0x2b')]=_['intersection'](_0x32c11f[_0xe271('0x27')],qs[_0xe271('0x2c')](_0x559d44[_0xe271('0x28')]['fields']));_0x4c471c[_0xe271('0x2b')]=_0x4c471c[_0xe271('0x2b')][_0xe271('0x2d')]?_0x4c471c[_0xe271('0x2b')]:_0x32c11f[_0xe271('0x27')];if(_0x559d44['query'][_0xe271('0x36')]){_0x4c471c[_0xe271('0x37')]=[{'all':!![]}];}_0x4c471c=_[_0xe271('0x34')]({},_0x4c471c,_0x559d44[_0xe271('0x35')]);return db[_0xe271('0x24')][_0xe271('0x1e')](_0x4c471c)['then'](handleEntityNotFound(_0x566b01,null))[_0xe271('0x12')](respondWithResult(_0x566b01,null))['catch'](handleError(_0x566b01,null));};exports[_0xe271('0x11')]=function(_0x3a4d8a,_0x4d39ef){return db[_0xe271('0x24')]['find']({'where':{'id':_0x3a4d8a[_0xe271('0x3c')]['id']}})[_0xe271('0x12')](handleEntityNotFound(_0x4d39ef,null))['then'](removeEntity(_0x4d39ef,null))[_0xe271('0x3a')](handleError(_0x4d39ef,null));};exports[_0xe271('0x3d')]=function(_0x1b2c03,_0x10bfdf){if(_0x1b2c03[_0xe271('0x3e')]['type']===_0xe271('0x16')&&!_[_0xe271('0x3f')](_0x1b2c03[_0xe271('0x3e')]['exten'],'_')){_0x1b2c03[_0xe271('0x3e')]['exten']='_'[_0xe271('0x40')](_0x1b2c03[_0xe271('0x3e')]['exten']);}return db[_0xe271('0x24')][_0xe271('0x3d')](_0x1b2c03[_0xe271('0x3e')],{'raw':![]})['then'](function(_0x3c5bce){var _0x4c7757=_0x1b2c03[_0xe271('0x41')][_0xe271('0x42')]({'plain':!![]});if(!_0x4c7757)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c7757[_0xe271('0x43')]===_0xe271('0x41')){var _0x4a0eb6=_0x3c5bce[_0xe271('0x42')]({'plain':!![]});var _0x322509=[{'name':'InboundRoutes','value':_0xe271('0x14')},{'name':_0xe271('0x15'),'value':'outbound'},{'name':'InternalRoutes','value':_0xe271('0x18')}];var _0xd6d78c=_[_0xe271('0x1e')](_0x322509,[_0xe271('0x1b'),_0x4a0eb6[_0xe271('0x1d')]])[_0xe271('0x1f')];return db['UserProfileSection'][_0xe271('0x1e')]({'where':{'name':_0xd6d78c,'userProfileId':_0x4c7757[_0xe271('0x44')]},'raw':!![]})[_0xe271('0x12')](function(_0x2f9c91){if(_0x2f9c91&&_0x2f9c91[_0xe271('0x45')]===0x0){return db[_0xe271('0x20')][_0xe271('0x3d')]({'name':_0x4a0eb6[_0xe271('0x1f')],'resourceId':_0x4a0eb6['id'],'type':_0x2f9c91[_0xe271('0x1f')],'sectionId':_0x2f9c91['id']},{})[_0xe271('0x12')](function(){return _0x3c5bce;});}else{return _0x3c5bce;}})[_0xe271('0x3a')](function(_0x5dd041){logger[_0xe271('0x46')](_0xe271('0x47'),_0x5dd041);throw _0x5dd041;});}return _0x3c5bce;})['then'](respondWithResult(_0x10bfdf,0xc9))[_0xe271('0x3a')](handleError(_0x10bfdf,null));};exports[_0xe271('0x48')]=function(_0x1dce7d,_0x635fe4){if(_0x1dce7d[_0xe271('0x3e')]['id']){delete _0x1dce7d['body']['id'];}return db[_0xe271('0x24')][_0xe271('0x1e')]({'where':{'id':_0x1dce7d['params']['id']}})[_0xe271('0x12')](handleEntityNotFound(_0x635fe4,null))[_0xe271('0x12')](function(_0x2775af){if(_0x2775af){return db[_0xe271('0x24')]['update'](_['pick'](_0x1dce7d[_0xe271('0x3e')],[_0xe271('0x49'),_0xe271('0x4a'),_0xe271('0x4b'),_0xe271('0x4c'),'cutdigits',_0xe271('0x4d'),_0xe271('0x4e')]),{'where':{'context':_0x2775af['context'],'exten':_0x2775af[_0xe271('0x49')]},'individualHooks':!![]})[_0xe271('0x12')](function(_0x26a3f6){return _0x26a3f6;});}return null;})[_0xe271('0x12')](respondWithStatusCode(_0x635fe4,null))[_0xe271('0x3a')](handleError(_0x635fe4,null));};exports[_0xe271('0x4f')]=function(_0xc8d458,_0x42c885){var _0x388b6f=_0xc8d458[_0xe271('0x3c')]['id'];var _0x56ab50=_0xc8d458[_0xe271('0x3e')];var _0x43b2a9=0xc8;var _0x504893=null;return db[_0xe271('0x50')][_0xe271('0x51')]({'isolationLevel':db[_0xe271('0x50')][_0xe271('0x52')][_0xe271('0x53')][_0xe271('0x54')]},function(_0x575c7a){return db[_0xe271('0x24')][_0xe271('0x55')]({'where':{'id':_0x388b6f},'transaction':_0x575c7a})[_0xe271('0x12')](function(_0x3d1eba){if(_0x3d1eba){return db[_0xe271('0x24')][_0xe271('0x11')]({'where':{'VoiceExtensionId':_0x388b6f},'transaction':_0x575c7a})[_0xe271('0x12')](function(){var _0x5f2af4=_['map'](_0x56ab50,function(_0x9be3a4){_0x9be3a4[_0xe271('0x56')]=_0x388b6f;_0x9be3a4[_0xe271('0x57')]=!![];return _0x9be3a4;});return _0x3d1eba[_0xe271('0x58')](_0x5f2af4);})[_0xe271('0x12')](function(_0x3016dd){return db[_0xe271('0x24')][_0xe271('0x59')](_0x3016dd,{'transaction':_0x575c7a});});}else{_0x43b2a9=0x194;_0x504893=[];}});})['then'](function(){if(_0x43b2a9!==0x194){return db['VoiceExtension'][_0xe271('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x388b6f},'order':_0xe271('0x5b')})[_0xe271('0x12')](function(_0x1c9750){_0x504893=_0x1c9750;});}})[_0xe271('0x3a')](function(_0x5eaa0d){_0x43b2a9=0x1f4;logger[_0xe271('0x46')](_0x5eaa0d['stack']);if(_0x5eaa0d[_0xe271('0x1f')]){delete _0x5eaa0d['name'];}_0x504893=_0x5eaa0d;})[_0xe271('0x5c')](function(){if(_0x504893===null){_0x42c885[_0xe271('0x8')](_0x43b2a9);}else{if(_0x43b2a9===0x1f4){_0x42c885['status'](_0x43b2a9)[_0xe271('0x22')](_0x504893);}else{_0x42c885[_0xe271('0x9')](_0x43b2a9)[_0xe271('0xb')](_0x504893);}}});};
\ No newline at end of file
+var _0xa2e8=['order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','update','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','destroy','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','type','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0xa2e8,0x1bc));var _0x8a2e=function(_0xf5a323,_0x30127b){_0xf5a323=_0xf5a323-0x0;var _0x13f3a=_0xa2e8[_0xf5a323];return _0x13f3a;};'use strict';var _=require(_0x8a2e('0x0'));var Redis=require(_0x8a2e('0x1'));var qs=require(_0x8a2e('0x2'));var logger=require(_0x8a2e('0x3'))(_0x8a2e('0x4'));var config=require(_0x8a2e('0x5'));var db=require(_0x8a2e('0x6'))['db'];config[_0x8a2e('0x7')]=_[_0x8a2e('0x8')](config[_0x8a2e('0x7')],{'host':_0x8a2e('0x9'),'port':0x18eb});var socket=require(_0x8a2e('0xa'))(new Redis(config['redis']));require(_0x8a2e('0xb'))[_0x8a2e('0xc')](socket);function respondWithStatusCode(_0x12c1ad,_0x2b5ac7){_0x2b5ac7=_0x2b5ac7||0xcc;return function(_0x1ac96d){if(_0x1ac96d){return _0x12c1ad[_0x8a2e('0xd')](_0x2b5ac7);}return _0x12c1ad[_0x8a2e('0xe')](_0x2b5ac7)[_0x8a2e('0xf')]();};}function respondWithResult(_0x17fd15,_0x4f9b5b){_0x4f9b5b=_0x4f9b5b||0xc8;return function(_0x1e5f7c){if(_0x1e5f7c){return _0x17fd15[_0x8a2e('0xe')](_0x4f9b5b)['json'](_0x1e5f7c);}};}function respondWithFilteredResult(_0x594c96,_0x5db7ba){return function(_0xb9614d){if(_0xb9614d){var _0x2add78=typeof _0x5db7ba['offset']===_0x8a2e('0x10')&&typeof _0x5db7ba[_0x8a2e('0x11')]===_0x8a2e('0x10');var _0x1497a4=_0xb9614d[_0x8a2e('0x12')];var _0x397bf9=_0x2add78?0x0:_0x5db7ba['offset'];var _0xef5501=_0x2add78?_0xb9614d[_0x8a2e('0x12')]:_0x5db7ba[_0x8a2e('0x13')]+_0x5db7ba[_0x8a2e('0x11')];var _0x1baffe;if(_0xef5501>=_0x1497a4){_0xef5501=_0x1497a4;_0x1baffe=0xc8;}else{_0x1baffe=0xce;}_0x594c96[_0x8a2e('0xe')](_0x1baffe);return _0x594c96[_0x8a2e('0x14')](_0x8a2e('0x15'),_0x397bf9+'-'+_0xef5501+'/'+_0x1497a4)[_0x8a2e('0x16')](_0xb9614d);}return null;};}function removeEntity(_0x1ef3d4){return function(_0x3a66f9){if(_0x3a66f9){return _0x3a66f9[_0x8a2e('0x17')]()[_0x8a2e('0x18')](function(){var _0x44f195=_0x3a66f9['get']({'plain':!![]});var _0x65b79a=[{'name':_0x8a2e('0x19'),'value':_0x8a2e('0x1a'),'ignore':![]},{'name':_0x8a2e('0x1b'),'value':_0x8a2e('0x1c'),'ignore':![]},{'name':_0x8a2e('0x1d'),'value':_0x8a2e('0x1e'),'ignore':![]}];var _0x5e3753=_(_0x65b79a)[_0x8a2e('0x1f')](_0x8a2e('0x20'))[_0x8a2e('0x21')](_0x8a2e('0x22'))[_0x8a2e('0x22')]();if(_['includes'](_0x5e3753,_0x44f195[_0x8a2e('0x23')])){return;}var _0x2ef4f6=_['find'](_0x65b79a,[_0x8a2e('0x22'),_0x44f195[_0x8a2e('0x23')]])[_0x8a2e('0x24')];return db[_0x8a2e('0x25')][_0x8a2e('0x17')]({'where':{'type':_0x2ef4f6,'resourceId':_0x44f195['id']}})[_0x8a2e('0x18')](function(){return _0x3a66f9;});})[_0x8a2e('0x18')](function(){_0x1ef3d4[_0x8a2e('0xe')](0xcc)[_0x8a2e('0xf')]();});}};}function handleEntityNotFound(_0x578e0d){return function(_0x549429){if(!_0x549429){_0x578e0d['sendStatus'](0x194);}return _0x549429;};}function handleError(_0x17cfdd,_0x26279c){_0x26279c=_0x26279c||0x1f4;return function(_0x3e20bc){logger[_0x8a2e('0x26')](_0x3e20bc[_0x8a2e('0x27')]);if(_0x3e20bc[_0x8a2e('0x24')]){delete _0x3e20bc[_0x8a2e('0x24')];}_0x17cfdd[_0x8a2e('0xe')](_0x26279c)[_0x8a2e('0x28')](_0x3e20bc);};}exports[_0x8a2e('0x29')]=function(_0x4816c3,_0xb1f13c){var _0x56b55c={},_0x3fbe71={},_0x312d0d={'count':0x0,'rows':[]};var _0xdae7ba=_[_0x8a2e('0x21')](db[_0x8a2e('0x2a')][_0x8a2e('0x2b')],function(_0x376890){return{'name':_0x376890[_0x8a2e('0x2c')],'type':_0x376890['type'][_0x8a2e('0x2d')]};});_0x3fbe71[_0x8a2e('0x2e')]=_[_0x8a2e('0x21')](_0xdae7ba,_0x8a2e('0x24'));_0x3fbe71[_0x8a2e('0x2f')]=_[_0x8a2e('0x30')](_0x4816c3[_0x8a2e('0x2f')]);_0x3fbe71[_0x8a2e('0x31')]=_['intersection'](_0x3fbe71[_0x8a2e('0x2e')],_0x3fbe71['query']);_0x56b55c['attributes']=_[_0x8a2e('0x32')](_0x3fbe71[_0x8a2e('0x2e')],qs[_0x8a2e('0x33')](_0x4816c3[_0x8a2e('0x2f')][_0x8a2e('0x33')]));_0x56b55c[_0x8a2e('0x34')]=_0x56b55c[_0x8a2e('0x34')][_0x8a2e('0x35')]?_0x56b55c[_0x8a2e('0x34')]:_0x3fbe71[_0x8a2e('0x2e')];if(!_0x4816c3['query'][_0x8a2e('0x36')](_0x8a2e('0x37'))){_0x56b55c[_0x8a2e('0x11')]=qs[_0x8a2e('0x11')](_0x4816c3[_0x8a2e('0x2f')][_0x8a2e('0x11')]);_0x56b55c[_0x8a2e('0x13')]=qs['offset'](_0x4816c3[_0x8a2e('0x2f')][_0x8a2e('0x13')]);}_0x56b55c[_0x8a2e('0x38')]=qs[_0x8a2e('0x39')](_0x4816c3[_0x8a2e('0x2f')][_0x8a2e('0x39')]);_0x56b55c[_0x8a2e('0x3a')]=qs[_0x8a2e('0x31')](_[_0x8a2e('0x3b')](_0x4816c3[_0x8a2e('0x2f')],_0x3fbe71['filters']),_0xdae7ba);if(_0x4816c3[_0x8a2e('0x2f')][_0x8a2e('0x1f')]){_0x56b55c[_0x8a2e('0x3a')]=_[_0x8a2e('0x3c')](_0x56b55c[_0x8a2e('0x3a')],{'$or':_[_0x8a2e('0x21')](_0xdae7ba,function(_0xf2dbee){if(_0xf2dbee[_0x8a2e('0x23')]!==_0x8a2e('0x3d')){var _0x239fbe={};_0x239fbe[_0xf2dbee['name']]={'$like':'%'+_0x4816c3[_0x8a2e('0x2f')][_0x8a2e('0x1f')]+'%'};return _0x239fbe;}})});}_0x56b55c=_[_0x8a2e('0x3c')]({},_0x56b55c,_0x4816c3[_0x8a2e('0x3e')]);var _0x5cdab3={'where':_0x56b55c[_0x8a2e('0x3a')]};return db[_0x8a2e('0x2a')][_0x8a2e('0x12')](_0x5cdab3)['then'](function(_0x9f3ac2){_0x312d0d['count']=_0x9f3ac2;if(_0x4816c3['query'][_0x8a2e('0x3f')]){_0x56b55c[_0x8a2e('0x40')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x56b55c);})[_0x8a2e('0x18')](function(_0x54577e){_0x312d0d[_0x8a2e('0x41')]=_0x54577e;return _0x312d0d;})[_0x8a2e('0x18')](respondWithFilteredResult(_0xb1f13c,_0x56b55c))[_0x8a2e('0x42')](handleError(_0xb1f13c,null));};exports[_0x8a2e('0x43')]=function(_0x110f13,_0x13cc03){var _0x4af6c9={'raw':![],'where':{'id':_0x110f13[_0x8a2e('0x44')]['id']}},_0x13d5bd={};_0x13d5bd['model']=_[_0x8a2e('0x30')](db[_0x8a2e('0x2a')][_0x8a2e('0x2b')]);_0x13d5bd[_0x8a2e('0x2f')]=_[_0x8a2e('0x30')](_0x110f13[_0x8a2e('0x2f')]);_0x13d5bd[_0x8a2e('0x31')]=_[_0x8a2e('0x32')](_0x13d5bd[_0x8a2e('0x2e')],_0x13d5bd['query']);_0x4af6c9[_0x8a2e('0x34')]=_[_0x8a2e('0x32')](_0x13d5bd['model'],qs[_0x8a2e('0x33')](_0x110f13['query']['fields']));_0x4af6c9[_0x8a2e('0x34')]=_0x4af6c9[_0x8a2e('0x34')][_0x8a2e('0x35')]?_0x4af6c9['attributes']:_0x13d5bd[_0x8a2e('0x2e')];if(_0x110f13[_0x8a2e('0x2f')][_0x8a2e('0x3f')]){_0x4af6c9['include']=[{'all':!![]}];}_0x4af6c9=_[_0x8a2e('0x3c')]({},_0x4af6c9,_0x110f13['options']);return db[_0x8a2e('0x2a')][_0x8a2e('0x45')](_0x4af6c9)[_0x8a2e('0x18')](handleEntityNotFound(_0x13cc03,null))[_0x8a2e('0x18')](respondWithResult(_0x13cc03,null))[_0x8a2e('0x42')](handleError(_0x13cc03,null));};exports[_0x8a2e('0x17')]=function(_0x238fed,_0x52dd16){return db[_0x8a2e('0x2a')][_0x8a2e('0x45')]({'where':{'id':_0x238fed['params']['id']}})[_0x8a2e('0x18')](handleEntityNotFound(_0x52dd16,null))[_0x8a2e('0x18')](removeEntity(_0x52dd16,null))[_0x8a2e('0x42')](handleError(_0x52dd16,null));};exports[_0x8a2e('0x46')]=function(_0x1b9aa2,_0x265046){if(_0x1b9aa2['body']['type']===_0x8a2e('0x1c')&&!_[_0x8a2e('0x47')](_0x1b9aa2['body'][_0x8a2e('0x48')],'_')){_0x1b9aa2['body']['exten']='_'['concat'](_0x1b9aa2['body'][_0x8a2e('0x48')]);}return db[_0x8a2e('0x2a')]['create'](_0x1b9aa2['body'],{'raw':![]})[_0x8a2e('0x18')](function(_0x26490e){var _0x37a0f9=_0x1b9aa2[_0x8a2e('0x49')]['get']({'plain':!![]});if(!_0x37a0f9)throw new Error(_0x8a2e('0x4a'));if(_0x37a0f9[_0x8a2e('0x4b')]==='user'){var _0xfd6d19=_0x26490e[_0x8a2e('0x4c')]({'plain':!![]});var _0x202e12=[{'name':'InboundRoutes','value':_0x8a2e('0x1a')},{'name':_0x8a2e('0x1b'),'value':_0x8a2e('0x1c')},{'name':_0x8a2e('0x1d'),'value':_0x8a2e('0x1e')}];var _0x2570aa=_[_0x8a2e('0x45')](_0x202e12,[_0x8a2e('0x22'),_0xfd6d19[_0x8a2e('0x23')]])[_0x8a2e('0x24')];return db[_0x8a2e('0x4d')]['find']({'where':{'name':_0x2570aa,'userProfileId':_0x37a0f9['userProfileId']},'raw':!![]})[_0x8a2e('0x18')](function(_0x311f86){if(_0x311f86&&_0x311f86[_0x8a2e('0x4e')]===0x0){return db[_0x8a2e('0x25')][_0x8a2e('0x46')]({'name':_0xfd6d19[_0x8a2e('0x24')],'resourceId':_0xfd6d19['id'],'type':_0x311f86[_0x8a2e('0x24')],'sectionId':_0x311f86['id']},{})['then'](function(){return _0x26490e;});}else{return _0x26490e;}})['catch'](function(_0x472442){logger[_0x8a2e('0x26')](_0x8a2e('0x4f'),_0x472442);throw _0x472442;});}return _0x26490e;})['then'](respondWithResult(_0x265046,0xc9))['catch'](handleError(_0x265046,null));};exports['update']=function(_0x2f3797,_0x2ebe03){if(_0x2f3797[_0x8a2e('0x50')]['id']){delete _0x2f3797['body']['id'];}return db[_0x8a2e('0x2a')]['find']({'where':{'id':_0x2f3797['params']['id']}})[_0x8a2e('0x18')](handleEntityNotFound(_0x2ebe03,null))[_0x8a2e('0x18')](function(_0x52a2d){if(_0x52a2d){return db[_0x8a2e('0x2a')][_0x8a2e('0x51')](_[_0x8a2e('0x3b')](_0x2f3797[_0x8a2e('0x50')],[_0x8a2e('0x48'),_0x8a2e('0x52'),_0x8a2e('0x53'),_0x8a2e('0x54'),'cutdigits',_0x8a2e('0x55'),_0x8a2e('0x56')]),{'where':{'context':_0x52a2d[_0x8a2e('0x52')],'exten':_0x52a2d['exten']},'individualHooks':!![]})[_0x8a2e('0x18')](function(_0x4117e5){return _0x4117e5;});}return null;})[_0x8a2e('0x18')](respondWithStatusCode(_0x2ebe03,null))[_0x8a2e('0x42')](handleError(_0x2ebe03,null));};exports[_0x8a2e('0x57')]=function(_0x19c856,_0x4874c5){var _0x2088ff=_0x19c856[_0x8a2e('0x44')]['id'];var _0x1622fa=_0x19c856['body'];var _0x49dbc1=0xc8;var _0x1f068d=null;return db[_0x8a2e('0x58')][_0x8a2e('0x59')]({'isolationLevel':db[_0x8a2e('0x58')][_0x8a2e('0x5a')][_0x8a2e('0x5b')][_0x8a2e('0x5c')]},function(_0x363d49){return db[_0x8a2e('0x2a')][_0x8a2e('0x5d')]({'where':{'id':_0x2088ff},'transaction':_0x363d49})['then'](function(_0x14f9fb){if(_0x14f9fb){return db[_0x8a2e('0x2a')]['destroy']({'where':{'VoiceExtensionId':_0x2088ff},'transaction':_0x363d49})[_0x8a2e('0x18')](function(){var _0x34ea80=_[_0x8a2e('0x21')](_0x1622fa,function(_0x5dff1b){_0x5dff1b[_0x8a2e('0x5e')]=_0x2088ff;_0x5dff1b[_0x8a2e('0x5f')]=!![];return _0x5dff1b;});return _0x14f9fb[_0x8a2e('0x60')](_0x34ea80);})[_0x8a2e('0x18')](function(_0x102b8d){return db[_0x8a2e('0x2a')]['bulkCreate'](_0x102b8d,{'transaction':_0x363d49});});}else{_0x49dbc1=0x194;_0x1f068d=[];}});})[_0x8a2e('0x18')](function(){if(_0x49dbc1!==0x194){return db['VoiceExtension'][_0x8a2e('0x61')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2088ff},'order':_0x8a2e('0x62')})[_0x8a2e('0x18')](function(_0xba54f1){_0x1f068d=_0xba54f1;});}})['catch'](function(_0x26830d){_0x49dbc1=0x1f4;logger[_0x8a2e('0x26')](_0x26830d[_0x8a2e('0x27')]);if(_0x26830d['name']){delete _0x26830d[_0x8a2e('0x24')];}_0x1f068d=_0x26830d;})[_0x8a2e('0x63')](function(){if(_0x1f068d===null){_0x4874c5[_0x8a2e('0xd')](_0x49dbc1);}else{if(_0x49dbc1===0x1f4){_0x4874c5[_0x8a2e('0xe')](_0x49dbc1)[_0x8a2e('0x28')](_0x1f068d);}else{_0x4874c5['status'](_0x49dbc1)[_0x8a2e('0x16')](_0x1f068d);}}});};
\ No newline at end of file
index ce1984f..8438e73 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1bd1=['VoiceExtension','setMaxListeners','update','remove','hook','exports','events','../../mysqldb'];(function(_0x3720fd,_0x4776fe){var _0x227fbe=function(_0x289345){while(--_0x289345){_0x3720fd['push'](_0x3720fd['shift']());}};_0x227fbe(++_0x4776fe);}(_0x1bd1,0x106));var _0x11bd=function(_0xbb6c6b,_0x38a86c){_0xbb6c6b=_0xbb6c6b-0x0;var _0x9ca7de=_0x1bd1[_0xbb6c6b];return _0x9ca7de;};'use strict';var EventEmitter=require(_0x11bd('0x0'));var VoiceExtension=require(_0x11bd('0x1'))['db'][_0x11bd('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x11bd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x11bd('0x4'),'afterDestroy':_0x11bd('0x5')};function emitEvent(_0x5eb0fd){return function(_0x525b1e,_0x3f6f62,_0x47359e){VoiceExtensionEvents['emit'](_0x5eb0fd+':'+_0x525b1e['id'],_0x525b1e);VoiceExtensionEvents['emit'](_0x5eb0fd,_0x525b1e);_0x47359e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x11bd('0x6')](e,emitEvent(event));}}module[_0x11bd('0x7')]=VoiceExtensionEvents;
\ No newline at end of file
+var _0x37b8=['hook','events','../../mysqldb','VoiceExtension','save','update','remove','hasOwnProperty'];(function(_0x179535,_0x494780){var _0x11ef66=function(_0x5d924f){while(--_0x5d924f){_0x179535['push'](_0x179535['shift']());}};_0x11ef66(++_0x494780);}(_0x37b8,0x109));var _0x837b=function(_0x45a562,_0x55f598){_0x45a562=_0x45a562-0x0;var _0x37c290=_0x37b8[_0x45a562];return _0x37c290;};'use strict';var EventEmitter=require(_0x837b('0x0'));var VoiceExtension=require(_0x837b('0x1'))['db'][_0x837b('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x837b('0x3'),'afterUpdate':_0x837b('0x4'),'afterDestroy':_0x837b('0x5')};function emitEvent(_0x4238b2){return function(_0x117fc6,_0x59631c,_0x5ee7bb){VoiceExtensionEvents['emit'](_0x4238b2+':'+_0x117fc6['id'],_0x117fc6);VoiceExtensionEvents['emit'](_0x4238b2,_0x117fc6);_0x5ee7bb(null);};}for(var e in events){if(events[_0x837b('0x6')](e)){var event=events[e];VoiceExtension[_0x837b('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents;
\ No newline at end of file
index 73ce8f1..2d1d4a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa81a=['findAll','interval','IntervalId','then','intervals','map','filter','toLowerCase','tag','ExecIf','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','hasOwnProperty','answer','queue','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','outboundDial','appdata','last','priority','concat','catch','define','VoiceExtension','get','Hangup','lodash','exports','type','Set','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','trunk','timeout','options','url','length','name','param','split','prefix','phone','SIP','replace','U(xcally-mixmonitor-context)','join','isEmpty','Interval'];(function(_0x5d4d2b,_0x5ce375){var _0x3909df=function(_0x4edda8){while(--_0x4edda8){_0x5d4d2b['push'](_0x5d4d2b['shift']());}};_0x3909df(++_0x5ce375);}(_0xa81a,0x1f1));var _0xaa81=function(_0x2641d3,_0x490d50){_0x2641d3=_0x2641d3-0x0;var _0x597a0a=_0xa81a[_0x2641d3];return _0x597a0a;};'use strict';var _=require(_0xaa81('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xaa81('0x1')]=function(_0x179af9){var _0x39b293=_0x179af9['models'];function _0x79f781(_0x408cb8){var _0x27da76=0x2;var _0x5accbf=[{'type':_0x408cb8[_0xaa81('0x2')],'app':_0xaa81('0x3'),'appdata':'CDR(type)='+_0x408cb8[_0xaa81('0x2')],'context':_0x408cb8[_0xaa81('0x4')],'exten':_0x408cb8[_0xaa81('0x5')],'priority':_0x27da76++,'VoiceExtensionId':_0x408cb8['id']},{'type':_0x408cb8[_0xaa81('0x2')],'app':_0x408cb8[_0xaa81('0x6')]?_0xaa81('0x3'):_0xaa81('0x7'),'appdata':_0x408cb8['alias']?_0xaa81('0x8')+_0x408cb8['alias']:_0xaa81('0x9'),'context':_0x408cb8['context'],'exten':_0x408cb8[_0xaa81('0x5')],'priority':_0x27da76++,'VoiceExtensionId':_0x408cb8['id']}];if(_0x408cb8[_0xaa81('0x2')]===_0xaa81('0xa')){_0x5accbf[_0xaa81('0xb')]({'type':'inbound','app':_0xaa81('0x3'),'appdata':_0xaa81('0xc')+_0x408cb8['id'],'context':_0x408cb8[_0xaa81('0x4')],'exten':_0x408cb8[_0xaa81('0x5')],'priority':_0x27da76++,'VoiceExtensionId':_0x408cb8['id']});}_0x5accbf[_0xaa81('0xb')]({'type':_0x408cb8['type'],'app':_0xaa81('0x3'),'appdata':_0xaa81('0xd'),'context':_0x408cb8[_0xaa81('0x4')],'exten':_0x408cb8['exten'],'priority':_0x27da76++,'VoiceExtensionId':_0x408cb8['id']},{'type':_0x408cb8[_0xaa81('0x2')],'app':_0xaa81('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x408cb8[_0xaa81('0x4')],'exten':_0x408cb8[_0xaa81('0x5')],'priority':_0x27da76++,'VoiceExtensionId':_0x408cb8['id']},{'type':_0x408cb8[_0xaa81('0x2')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x408cb8[_0xaa81('0x4')],'exten':_0x408cb8[_0xaa81('0x5')],'priority':_0x27da76++,'VoiceExtensionId':_0x408cb8['id']});return _0x5accbf;}function _0x5ea017(_0x4fe30b){var _0x32f047=0x2;var _0x4a2264=[{'type':_0xaa81('0xe'),'app':_0xaa81('0x3'),'appdata':'CDR(type)=outbound','context':_0x4fe30b[_0xaa81('0x4')],'exten':_0x4fe30b['exten'],'priority':_0x32f047++,'VoiceExtensionId':_0x4fe30b['id']},{'type':_0xaa81('0xe'),'app':_0x4fe30b[_0xaa81('0x6')]?_0xaa81('0x3'):_0xaa81('0x7'),'appdata':_0x4fe30b['alias']?_0xaa81('0x8')+_0x4fe30b[_0xaa81('0x6')]:_0xaa81('0x9'),'context':_0x4fe30b[_0xaa81('0x4')],'exten':_0x4fe30b['exten'],'priority':_0x32f047++,'VoiceExtensionId':_0x4fe30b['id']},{'type':_0xaa81('0xe'),'app':_0xaa81('0x3'),'appdata':_0xaa81('0xf')+(_0x4fe30b[_0xaa81('0x10')]?_0xaa81('0x11')+_0x4fe30b['cutdigits']+'}':_0xaa81('0x12')),'context':_0x4fe30b[_0xaa81('0x4')],'exten':_0x4fe30b[_0xaa81('0x5')],'priority':_0x32f047++,'VoiceExtensionId':_0x4fe30b['id']},{'type':_0xaa81('0xe'),'app':_0xaa81('0x3'),'appdata':_0xaa81('0xc')+_0x4fe30b['id'],'context':_0x4fe30b[_0xaa81('0x4')],'exten':_0x4fe30b[_0xaa81('0x5')],'priority':_0x32f047++,'VoiceExtensionId':_0x4fe30b['id']},{'type':'outbound','app':'ExecIf','appdata':_0xaa81('0x13')+(_0x32f047+0x2)+'):Goto('+(_0x32f047+0x1)+')','context':_0x4fe30b[_0xaa81('0x4')],'exten':_0x4fe30b['exten'],'priority':_0x32f047++,'VoiceExtensionId':_0x4fe30b['id']},{'type':_0xaa81('0xe'),'app':_0xaa81('0x3'),'appdata':_0x4fe30b[_0xaa81('0x10')]?'CDR(prefix)=${EXTEN:0:'+_0x4fe30b[_0xaa81('0x10')]+'}':_0xaa81('0x14'),'context':_0x4fe30b['context'],'exten':_0x4fe30b['exten'],'priority':_0x32f047++,'VoiceExtensionId':_0x4fe30b['id']},{'type':'outbound','app':_0xaa81('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4fe30b[_0xaa81('0x4')],'exten':_0x4fe30b[_0xaa81('0x5')],'priority':_0x32f047++,'VoiceExtensionId':_0x4fe30b['id']},{'type':_0xaa81('0xe'),'app':_0xaa81('0x3'),'appdata':_0xaa81('0x15'),'context':_0x4fe30b[_0xaa81('0x4')],'exten':_0x4fe30b[_0xaa81('0x5')],'priority':_0x32f047++,'VoiceExtensionId':_0x4fe30b['id']},{'type':_0xaa81('0xe'),'app':_0xaa81('0x3'),'appdata':_0xaa81('0x16'),'context':_0x4fe30b['context'],'exten':_0x4fe30b['exten'],'priority':_0x32f047++,'VoiceExtensionId':_0x4fe30b['id']},{'type':_0xaa81('0xe'),'app':_0xaa81('0x3'),'appdata':'outboundrouteid='+_0x4fe30b['id'],'context':_0x4fe30b[_0xaa81('0x4')],'exten':_0x4fe30b['exten'],'priority':_0x32f047++,'VoiceExtensionId':_0x4fe30b['id']}];if(_0x4fe30b['hasOwnProperty'](_0xaa81('0x17'))&&_0x4fe30b[_0xaa81('0x17')]!==_0xaa81('0x18')){_0x4a2264[_0xaa81('0xb')]({'type':_0xaa81('0xe'),'app':_0xaa81('0x3'),'appdata':_0xaa81('0x19'),'context':_0x4fe30b[_0xaa81('0x4')],'exten':_0x4fe30b[_0xaa81('0x5')],'priority':_0x32f047++,'VoiceExtensionId':_0x4fe30b['id']},{'type':_0xaa81('0xe'),'app':_0xaa81('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4fe30b['recordingFormat']||'wav','context':_0x4fe30b[_0xaa81('0x4')],'exten':_0x4fe30b[_0xaa81('0x5')],'priority':_0x32f047++,'VoiceExtensionId':_0x4fe30b['id']});}return _0x4a2264;}function _0x2b53b9(_0x4679d6,_0x2aa5fc){var _0x62b339=[{'name':_0xaa81('0x1a'),'param':0x0},{'name':_0xaa81('0x1b'),'param':0x1},{'name':_0xaa81('0x1c'),'param':0x2},{'name':_0xaa81('0x1d'),'param':0x3}];var _0x14926d={};var _0x519a22=_0x2aa5fc['split'](',');var _0x5e0d79=[];for(var _0x54af06=0x0;_0x54af06<_0x62b339[_0xaa81('0x1e')];_0x54af06++){switch(_0x62b339[_0x54af06][_0xaa81('0x1f')]){case _0xaa81('0x1a'):_0x14926d['trunk']=_0x519a22[_0x62b339[_0x54af06][_0xaa81('0x20')]][_0xaa81('0x21')]('/')[0x1];_0x14926d['phone']=_0x519a22[_0x62b339[_0x54af06][_0xaa81('0x20')]]['split']('/')[0x2];_0x14926d[_0xaa81('0x22')]=_0x14926d[_0xaa81('0x23')]?_0x14926d[_0xaa81('0x23')][_0xaa81('0x21')]('$')[0x0]:undefined;_0x14926d['phone']=_0x4679d6[_0xaa81('0x10')]?(_0x14926d[_0xaa81('0x22')]||'')+'${EXTEN:'+_0x4679d6['cutdigits']+'}':(_0x14926d[_0xaa81('0x22')]||'')+_0xaa81('0x12');_0x5e0d79[_0x62b339[_0x54af06][_0xaa81('0x20')]]=[_0xaa81('0x24'),_0x14926d[_0xaa81('0x1a')],_0x14926d[_0xaa81('0x23')]]['join']('/');break;case _0xaa81('0x1c'):_0x14926d[_0xaa81('0x1c')]=_0x519a22[_0x62b339[_0x54af06][_0xaa81('0x20')]];if(_0x4679d6[_0xaa81('0x17')]!=='none'){if(_0x14926d['options']['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x14926d[_0xaa81('0x1c')]+='U(xcally-mixmonitor-context)';}}else{_0x14926d[_0xaa81('0x1c')]=_0x14926d['options'][_0xaa81('0x25')](_0xaa81('0x26'),'');}_0x5e0d79[_0x62b339[_0x54af06]['param']]=_0x14926d['options'];break;default:_0x5e0d79[_0x62b339[_0x54af06][_0xaa81('0x20')]]=_0x519a22[_0x62b339[_0x54af06][_0xaa81('0x20')]];}}return _0x5e0d79[_0xaa81('0x27')](',');}function _0x3d367d(_0xe5e028,_0x279162,_0xd747fe){return new Promise(function(_0x586bce,_0x116e87){var _0x205376=[];if(_[_0xaa81('0x28')](_0x279162))return _0x586bce(_0x205376);_0x39b293[_0xaa81('0x29')][_0xaa81('0x2a')]({'attributes':['id',_0xaa81('0x2b'),_0xaa81('0x2c')],'raw':!![]})[_0xaa81('0x2d')](function(_0x38e9e5){for(var _0x29e24e=0x0,_0x323bd5=0x0;_0x29e24e<_0x279162['length'];_0x29e24e++,_0x323bd5=0x0){var _0x3ee13f=_0x279162[_0x29e24e];var _0x14210e=[];var _0x826e29=[];delete _0x3ee13f['id'];if(_0x3ee13f[_0xaa81('0x2b')]!=='*,*,*,*'){_0x3ee13f[_0xaa81('0x2e')]=[_0x3ee13f[_0xaa81('0x2b')]];}else{_0x3ee13f[_0xaa81('0x2e')]=_0x3ee13f[_0xaa81('0x2c')]?_[_0xaa81('0x2f')](_[_0xaa81('0x30')](_0x38e9e5,{'IntervalId':_0x3ee13f[_0xaa81('0x2c')]}),_0xaa81('0x2b')):[];}_0x3ee13f['context']=_0xe5e028[_0xaa81('0x4')];_0x3ee13f[_0xaa81('0x5')]=_0xe5e028['exten'];if(_0x3ee13f[_0xaa81('0x2')])_0x3ee13f[_0xaa81('0x2')]=_0x3ee13f[_0xaa81('0x2')][_0xaa81('0x31')]();if(_0xe5e028[_0xaa81('0x2')]===_0xaa81('0xe')){if(_0x3ee13f['hasOwnProperty'](_0xaa81('0x32'))&&_0x3ee13f[_0xaa81('0x32')]&&_0x3ee13f['tag']!=='--'){_0x14210e[_0xaa81('0xb')]({'type':_0x3ee13f['type']['toLowerCase'](),'app':_0xaa81('0x3'),'appdata':'CDR(tag)='+_0x3ee13f[_0xaa81('0x32')],'context':_0xe5e028[_0xaa81('0x4')],'exten':_0xe5e028['exten'],'priority':_0x3ee13f[_0xaa81('0x2e')][_0xaa81('0x1e')]+_0xd747fe+_0x323bd5++,'VoiceExtensionId':_0xe5e028['id']});}_0x14210e[_0xaa81('0xb')]({'type':_0x3ee13f[_0xaa81('0x2')][_0xaa81('0x31')](),'app':_0xaa81('0x33'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x3ee13f[_0xaa81('0x34')]?_0xaa81('0x35')+_0x3ee13f[_0xaa81('0x34')]+')':_0xaa81('0x36')),'context':_0xe5e028[_0xaa81('0x4')],'exten':_0xe5e028[_0xaa81('0x5')],'priority':_0x3ee13f['intervals']['length']+_0xd747fe+_0x323bd5++,'VoiceExtensionId':_0xe5e028['id']});}else{if(_0x3ee13f[_0xaa81('0x37')](_0xaa81('0x38'))){if([_0xaa81('0x39'),_0xaa81('0x3a')][_0xaa81('0x3b')](_0x3ee13f['app'][_0xaa81('0x31')]())&&_0x3ee13f[_0xaa81('0x3c')]!==_0xaa81('0x3d')){if(_0x3ee13f['answer']){_0x14210e[_0xaa81('0xb')]({'type':_0x3ee13f['type'][_0xaa81('0x31')](),'app':_0xaa81('0x33'),'appdata':_0xaa81('0x3e'),'context':_0xe5e028[_0xaa81('0x4')],'exten':_0xe5e028['exten'],'priority':_0x3ee13f[_0xaa81('0x2e')][_0xaa81('0x1e')]+_0xd747fe+_0x323bd5++,'VoiceExtensionId':_0xe5e028['id']});_0x14210e[_0xaa81('0xb')]({'type':_0x3ee13f[_0xaa81('0x2')][_0xaa81('0x31')](),'app':'Set','appdata':_0xaa81('0x3f'),'context':_0xe5e028[_0xaa81('0x4')],'exten':_0xe5e028[_0xaa81('0x5')],'priority':_0x3ee13f[_0xaa81('0x2e')]['length']+_0xd747fe+_0x323bd5++,'VoiceExtensionId':_0xe5e028['id']});}else{_0x14210e['push']({'type':_0x3ee13f['type'][_0xaa81('0x31')](),'app':'ExecIf','appdata':_0xaa81('0x40'),'context':_0xe5e028[_0xaa81('0x4')],'exten':_0xe5e028[_0xaa81('0x5')],'priority':_0x3ee13f['intervals']['length']+_0xd747fe+_0x323bd5++,'VoiceExtensionId':_0xe5e028['id']});_0x14210e[_0xaa81('0xb')]({'type':_0x3ee13f[_0xaa81('0x2')]['toLowerCase'](),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0xe5e028[_0xaa81('0x4')],'exten':_0xe5e028[_0xaa81('0x5')],'priority':_0x3ee13f[_0xaa81('0x2e')][_0xaa81('0x1e')]+_0xd747fe+_0x323bd5++,'VoiceExtensionId':_0xe5e028['id']});}}}}for(var _0x42ed2d=0x0;_0x42ed2d<_0x3ee13f[_0xaa81('0x2e')][_0xaa81('0x1e')];_0x42ed2d++){var _0x52f32b=_0xd747fe+_0x3ee13f[_0xaa81('0x2e')][_0xaa81('0x1e')];var _0x51070b=_0x42ed2d===_0x3ee13f[_0xaa81('0x2e')]['length']-0x1?_0xd747fe+_0x14210e[_0xaa81('0x1e')]+_0x826e29['length']+0x2:_0xd747fe+_0x42ed2d+0x1;_0x14210e[_0xaa81('0x41')](_0x42ed2d,0x0,{'type':_0xe5e028[_0xaa81('0x2')],'app':'GotoIfTime','appdata':_0x3ee13f['intervals'][_0x42ed2d]+'?'+_0xe5e028[_0xaa81('0x4')]+_0xaa81('0x42')+_0x52f32b+':'+_0xe5e028[_0xaa81('0x4')]+_0xaa81('0x42')+_0x51070b,'exten':_0xe5e028['exten'],'context':_0xe5e028['context'],'priority':_0xd747fe+_0x42ed2d,'VoiceExtensionId':_0xe5e028['id']});}if(_0x3ee13f[_0xaa81('0x3c')]===_0xaa81('0x43'))_0x3ee13f[_0xaa81('0x44')]=_0x2b53b9(_0xe5e028,_0x3ee13f[_0xaa81('0x44')]);_0x3ee13f['priority']=_0x14210e[_0xaa81('0x1e')]?_[_0xaa81('0x45')](_0x14210e)[_0xaa81('0x46')]+0x1:_0xd747fe;_0x205376=_[_0xaa81('0x47')](_0x205376,_0x14210e,[_0x3ee13f],_0x826e29);_0xd747fe=_[_0xaa81('0x45')](_0x205376)[_0xaa81('0x46')]+0x1;}return _0x586bce(_0x205376);})[_0xaa81('0x48')](function(_0x3157f8){_0x116e87(_0x3157f8);});});}return _0x179af9[_0xaa81('0x49')](_0xaa81('0x4a'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x57cd5d){var _0x15bfd8=this[_0xaa81('0x4b')]({'plain':!![]});var _0x3008d8=_0x15bfd8[_0xaa81('0x2')]==='outbound'?_0x5ea017(_0x15bfd8):_0x79f781(_0x15bfd8);return _0x3d367d(_0x15bfd8,_0x57cd5d,_[_0xaa81('0x45')](_0x3008d8)[_0xaa81('0x46')]+0x1)['then'](function(_0x1c5c50){var _0x291fbf=_[_0xaa81('0x47')](_0x3008d8,_0x1c5c50);_0x291fbf[_0xaa81('0xb')]({'type':_0x15bfd8[_0xaa81('0x2')],'app':_0xaa81('0x4c'),'exten':_0x15bfd8[_0xaa81('0x5')],'context':_0x15bfd8[_0xaa81('0x4')],'priority':_[_0xaa81('0x45')](_0x291fbf)[_0xaa81('0x46')]+0x1,'VoiceExtensionId':_0x15bfd8['id']});return _0x291fbf;});}}});};
\ No newline at end of file
+var _0x81bd=['join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','IntervalId','then','interval','*,*,*,*','intervals','map','filter','toLowerCase','hasOwnProperty','tag','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','Set','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','recordingFormat','wav','trunk','timeout','options','url','length','split','phone','prefix','${EXTEN:','param','SIP'];(function(_0x5a54bf,_0x5a504b){var _0x5807ae=function(_0x249443){while(--_0x249443){_0x5a54bf['push'](_0x5a54bf['shift']());}};_0x5807ae(++_0x5a504b);}(_0x81bd,0x7c));var _0xd81b=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0x81bd[_0x19115e];return _0x45bbd4;};'use strict';var _=require(_0xd81b('0x0'));var attributes=require(_0xd81b('0x1'));module[_0xd81b('0x2')]=function(_0x2337b1){var _0x2d27cb=_0x2337b1[_0xd81b('0x3')];function _0x111a9c(_0x54e096){var _0x16e8de=0x2;var _0x2c3d9e=[{'type':_0x54e096[_0xd81b('0x4')],'app':'Set','appdata':_0xd81b('0x5')+_0x54e096[_0xd81b('0x4')],'context':_0x54e096[_0xd81b('0x6')],'exten':_0x54e096['exten'],'priority':_0x16e8de++,'VoiceExtensionId':_0x54e096['id']},{'type':_0x54e096['type'],'app':_0x54e096[_0xd81b('0x7')]?'Set':_0xd81b('0x8'),'appdata':_0x54e096[_0xd81b('0x7')]?_0xd81b('0x9')+_0x54e096[_0xd81b('0x7')]:_0xd81b('0xa'),'context':_0x54e096[_0xd81b('0x6')],'exten':_0x54e096[_0xd81b('0xb')],'priority':_0x16e8de++,'VoiceExtensionId':_0x54e096['id']}];if(_0x54e096[_0xd81b('0x4')]===_0xd81b('0xc')){_0x2c3d9e[_0xd81b('0xd')]({'type':_0xd81b('0xc'),'app':_0xd81b('0xe'),'appdata':_0xd81b('0xf')+_0x54e096['id'],'context':_0x54e096['context'],'exten':_0x54e096[_0xd81b('0xb')],'priority':_0x16e8de++,'VoiceExtensionId':_0x54e096['id']});}_0x2c3d9e['push']({'type':_0x54e096[_0xd81b('0x4')],'app':_0xd81b('0xe'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x54e096[_0xd81b('0x6')],'exten':_0x54e096['exten'],'priority':_0x16e8de++,'VoiceExtensionId':_0x54e096['id']},{'type':_0x54e096[_0xd81b('0x4')],'app':_0xd81b('0xe'),'appdata':_0xd81b('0x10'),'context':_0x54e096[_0xd81b('0x6')],'exten':_0x54e096[_0xd81b('0xb')],'priority':_0x16e8de++,'VoiceExtensionId':_0x54e096['id']},{'type':_0x54e096['type'],'app':_0xd81b('0xe'),'appdata':_0xd81b('0x11'),'context':_0x54e096['context'],'exten':_0x54e096[_0xd81b('0xb')],'priority':_0x16e8de++,'VoiceExtensionId':_0x54e096['id']});return _0x2c3d9e;}function _0x26df61(_0x4657cf){var _0x15e860=0x2;var _0x5f7db6=[{'type':_0xd81b('0x12'),'app':_0xd81b('0xe'),'appdata':_0xd81b('0x13'),'context':_0x4657cf[_0xd81b('0x6')],'exten':_0x4657cf[_0xd81b('0xb')],'priority':_0x15e860++,'VoiceExtensionId':_0x4657cf['id']},{'type':_0xd81b('0x12'),'app':_0x4657cf[_0xd81b('0x7')]?_0xd81b('0xe'):_0xd81b('0x8'),'appdata':_0x4657cf[_0xd81b('0x7')]?_0xd81b('0x9')+_0x4657cf['alias']:'No\x20alias\x20set','context':_0x4657cf[_0xd81b('0x6')],'exten':_0x4657cf[_0xd81b('0xb')],'priority':_0x15e860++,'VoiceExtensionId':_0x4657cf['id']},{'type':_0xd81b('0x12'),'app':'Set','appdata':_0xd81b('0x14')+(_0x4657cf[_0xd81b('0x15')]?'${EXTEN:'+_0x4657cf[_0xd81b('0x15')]+'}':_0xd81b('0x16')),'context':_0x4657cf[_0xd81b('0x6')],'exten':_0x4657cf[_0xd81b('0xb')],'priority':_0x15e860++,'VoiceExtensionId':_0x4657cf['id']},{'type':_0xd81b('0x12'),'app':_0xd81b('0xe'),'appdata':_0xd81b('0xf')+_0x4657cf['id'],'context':_0x4657cf[_0xd81b('0x6')],'exten':_0x4657cf[_0xd81b('0xb')],'priority':_0x15e860++,'VoiceExtensionId':_0x4657cf['id']},{'type':_0xd81b('0x12'),'app':_0xd81b('0x17'),'appdata':_0xd81b('0x18')+(_0x15e860+0x2)+'):Goto('+(_0x15e860+0x1)+')','context':_0x4657cf[_0xd81b('0x6')],'exten':_0x4657cf[_0xd81b('0xb')],'priority':_0x15e860++,'VoiceExtensionId':_0x4657cf['id']},{'type':_0xd81b('0x12'),'app':_0xd81b('0xe'),'appdata':_0x4657cf[_0xd81b('0x15')]?_0xd81b('0x19')+_0x4657cf[_0xd81b('0x15')]+'}':_0xd81b('0x1a'),'context':_0x4657cf[_0xd81b('0x6')],'exten':_0x4657cf['exten'],'priority':_0x15e860++,'VoiceExtensionId':_0x4657cf['id']},{'type':_0xd81b('0x12'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4657cf[_0xd81b('0x6')],'exten':_0x4657cf[_0xd81b('0xb')],'priority':_0x15e860++,'VoiceExtensionId':_0x4657cf['id']},{'type':'outbound','app':'Set','appdata':_0xd81b('0x10'),'context':_0x4657cf[_0xd81b('0x6')],'exten':_0x4657cf[_0xd81b('0xb')],'priority':_0x15e860++,'VoiceExtensionId':_0x4657cf['id']},{'type':_0xd81b('0x12'),'app':_0xd81b('0xe'),'appdata':_0xd81b('0x11'),'context':_0x4657cf['context'],'exten':_0x4657cf[_0xd81b('0xb')],'priority':_0x15e860++,'VoiceExtensionId':_0x4657cf['id']},{'type':_0xd81b('0x12'),'app':'Set','appdata':'outboundrouteid='+_0x4657cf['id'],'context':_0x4657cf[_0xd81b('0x6')],'exten':_0x4657cf[_0xd81b('0xb')],'priority':_0x15e860++,'VoiceExtensionId':_0x4657cf['id']}];if(_0x4657cf['hasOwnProperty']('recordingFormat')&&_0x4657cf['recordingFormat']!==_0xd81b('0x1b')){_0x5f7db6[_0xd81b('0xd')]({'type':_0xd81b('0x12'),'app':_0xd81b('0xe'),'appdata':_0xd81b('0x1c'),'context':_0x4657cf[_0xd81b('0x6')],'exten':_0x4657cf[_0xd81b('0xb')],'priority':_0x15e860++,'VoiceExtensionId':_0x4657cf['id']},{'type':'outbound','app':_0xd81b('0xe'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4657cf[_0xd81b('0x1d')]||_0xd81b('0x1e'),'context':_0x4657cf[_0xd81b('0x6')],'exten':_0x4657cf[_0xd81b('0xb')],'priority':_0x15e860++,'VoiceExtensionId':_0x4657cf['id']});}return _0x5f7db6;}function _0x36c69f(_0x221e1f,_0x1c20d3){var _0x2d23b9=[{'name':_0xd81b('0x1f'),'param':0x0},{'name':_0xd81b('0x20'),'param':0x1},{'name':_0xd81b('0x21'),'param':0x2},{'name':_0xd81b('0x22'),'param':0x3}];var _0x346038={};var _0x57bc0c=_0x1c20d3['split'](',');var _0x413bf6=[];for(var _0x46119e=0x0;_0x46119e<_0x2d23b9[_0xd81b('0x23')];_0x46119e++){switch(_0x2d23b9[_0x46119e]['name']){case _0xd81b('0x1f'):_0x346038[_0xd81b('0x1f')]=_0x57bc0c[_0x2d23b9[_0x46119e]['param']][_0xd81b('0x24')]('/')[0x1];_0x346038[_0xd81b('0x25')]=_0x57bc0c[_0x2d23b9[_0x46119e]['param']][_0xd81b('0x24')]('/')[0x2];_0x346038['prefix']=_0x346038[_0xd81b('0x25')]?_0x346038[_0xd81b('0x25')][_0xd81b('0x24')]('$')[0x0]:undefined;_0x346038[_0xd81b('0x25')]=_0x221e1f['cutdigits']?(_0x346038[_0xd81b('0x26')]||'')+_0xd81b('0x27')+_0x221e1f[_0xd81b('0x15')]+'}':(_0x346038[_0xd81b('0x26')]||'')+_0xd81b('0x16');_0x413bf6[_0x2d23b9[_0x46119e][_0xd81b('0x28')]]=[_0xd81b('0x29'),_0x346038['trunk'],_0x346038[_0xd81b('0x25')]][_0xd81b('0x2a')]('/');break;case _0xd81b('0x21'):_0x346038['options']=_0x57bc0c[_0x2d23b9[_0x46119e][_0xd81b('0x28')]];if(_0x221e1f[_0xd81b('0x1d')]!==_0xd81b('0x1b')){if(_0x346038[_0xd81b('0x21')][_0xd81b('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x346038[_0xd81b('0x21')]+=_0xd81b('0x2c');}}else{_0x346038[_0xd81b('0x21')]=_0x346038[_0xd81b('0x21')][_0xd81b('0x2d')](_0xd81b('0x2c'),'');}_0x413bf6[_0x2d23b9[_0x46119e][_0xd81b('0x28')]]=_0x346038[_0xd81b('0x21')];break;default:_0x413bf6[_0x2d23b9[_0x46119e][_0xd81b('0x28')]]=_0x57bc0c[_0x2d23b9[_0x46119e][_0xd81b('0x28')]];}}return _0x413bf6[_0xd81b('0x2a')](',');}function _0x4b8ffc(_0x35b18f,_0x2778b3,_0x25824e){return new Promise(function(_0xa5e391,_0x1e6654){var _0x194d2a=[];if(_[_0xd81b('0x2e')](_0x2778b3))return _0xa5e391(_0x194d2a);_0x2d27cb[_0xd81b('0x2f')]['findAll']({'attributes':['id','interval',_0xd81b('0x30')],'raw':!![]})[_0xd81b('0x31')](function(_0x2b1383){for(var _0x222c5e=0x0,_0x1f5d84=0x0;_0x222c5e<_0x2778b3[_0xd81b('0x23')];_0x222c5e++,_0x1f5d84=0x0){var _0x334bd0=_0x2778b3[_0x222c5e];var _0x2e44f3=[];var _0x2fa588=[];delete _0x334bd0['id'];if(_0x334bd0[_0xd81b('0x32')]!==_0xd81b('0x33')){_0x334bd0[_0xd81b('0x34')]=[_0x334bd0['interval']];}else{_0x334bd0[_0xd81b('0x34')]=_0x334bd0[_0xd81b('0x30')]?_[_0xd81b('0x35')](_[_0xd81b('0x36')](_0x2b1383,{'IntervalId':_0x334bd0[_0xd81b('0x30')]}),_0xd81b('0x32')):[];}_0x334bd0[_0xd81b('0x6')]=_0x35b18f[_0xd81b('0x6')];_0x334bd0[_0xd81b('0xb')]=_0x35b18f['exten'];if(_0x334bd0[_0xd81b('0x4')])_0x334bd0[_0xd81b('0x4')]=_0x334bd0[_0xd81b('0x4')][_0xd81b('0x37')]();if(_0x35b18f['type']===_0xd81b('0x12')){if(_0x334bd0[_0xd81b('0x38')](_0xd81b('0x39'))&&_0x334bd0[_0xd81b('0x39')]&&_0x334bd0[_0xd81b('0x39')]!=='--'){_0x2e44f3[_0xd81b('0xd')]({'type':_0x334bd0[_0xd81b('0x4')][_0xd81b('0x37')](),'app':_0xd81b('0xe'),'appdata':'CDR(tag)='+_0x334bd0['tag'],'context':_0x35b18f[_0xd81b('0x6')],'exten':_0x35b18f[_0xd81b('0xb')],'priority':_0x334bd0[_0xd81b('0x34')][_0xd81b('0x23')]+_0x25824e+_0x1f5d84++,'VoiceExtensionId':_0x35b18f['id']});}_0x2e44f3[_0xd81b('0xd')]({'type':_0x334bd0[_0xd81b('0x4')][_0xd81b('0x37')](),'app':_0xd81b('0x17'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x334bd0[_0xd81b('0x3a')]?_0xd81b('0x3b')+_0x334bd0[_0xd81b('0x3a')]+')':_0xd81b('0x3c')),'context':_0x35b18f[_0xd81b('0x6')],'exten':_0x35b18f['exten'],'priority':_0x334bd0[_0xd81b('0x34')][_0xd81b('0x23')]+_0x25824e+_0x1f5d84++,'VoiceExtensionId':_0x35b18f['id']});}else{if(_0x334bd0['hasOwnProperty'](_0xd81b('0x3d'))){if([_0xd81b('0x3e'),_0xd81b('0x3f')][_0xd81b('0x40')](_0x334bd0[_0xd81b('0x41')][_0xd81b('0x37')]())&&_0x334bd0[_0xd81b('0x42')]!==_0xd81b('0x43')){if(_0x334bd0[_0xd81b('0x3d')]){_0x2e44f3[_0xd81b('0xd')]({'type':_0x334bd0[_0xd81b('0x4')]['toLowerCase'](),'app':_0xd81b('0x17'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x35b18f[_0xd81b('0x6')],'exten':_0x35b18f[_0xd81b('0xb')],'priority':_0x334bd0[_0xd81b('0x34')][_0xd81b('0x23')]+_0x25824e+_0x1f5d84++,'VoiceExtensionId':_0x35b18f['id']});_0x2e44f3[_0xd81b('0xd')]({'type':_0x334bd0[_0xd81b('0x4')]['toLowerCase'](),'app':_0xd81b('0xe'),'appdata':_0xd81b('0x44'),'context':_0x35b18f['context'],'exten':_0x35b18f['exten'],'priority':_0x334bd0[_0xd81b('0x34')]['length']+_0x25824e+_0x1f5d84++,'VoiceExtensionId':_0x35b18f['id']});}else{_0x2e44f3[_0xd81b('0xd')]({'type':_0x334bd0['type'][_0xd81b('0x37')](),'app':_0xd81b('0x17'),'appdata':_0xd81b('0x45'),'context':_0x35b18f['context'],'exten':_0x35b18f[_0xd81b('0xb')],'priority':_0x334bd0[_0xd81b('0x34')]['length']+_0x25824e+_0x1f5d84++,'VoiceExtensionId':_0x35b18f['id']});_0x2e44f3[_0xd81b('0xd')]({'type':_0x334bd0[_0xd81b('0x4')]['toLowerCase'](),'app':_0xd81b('0xe'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x35b18f[_0xd81b('0x6')],'exten':_0x35b18f[_0xd81b('0xb')],'priority':_0x334bd0[_0xd81b('0x34')][_0xd81b('0x23')]+_0x25824e+_0x1f5d84++,'VoiceExtensionId':_0x35b18f['id']});}}}}for(var _0x4add79=0x0;_0x4add79<_0x334bd0[_0xd81b('0x34')][_0xd81b('0x23')];_0x4add79++){var _0x24dfce=_0x25824e+_0x334bd0[_0xd81b('0x34')][_0xd81b('0x23')];var _0x5c4533=_0x4add79===_0x334bd0[_0xd81b('0x34')][_0xd81b('0x23')]-0x1?_0x25824e+_0x2e44f3[_0xd81b('0x23')]+_0x2fa588[_0xd81b('0x23')]+0x2:_0x25824e+_0x4add79+0x1;_0x2e44f3[_0xd81b('0x46')](_0x4add79,0x0,{'type':_0x35b18f[_0xd81b('0x4')],'app':_0xd81b('0x47'),'appdata':_0x334bd0['intervals'][_0x4add79]+'?'+_0x35b18f['context']+',${EXTEN},'+_0x24dfce+':'+_0x35b18f[_0xd81b('0x6')]+_0xd81b('0x48')+_0x5c4533,'exten':_0x35b18f[_0xd81b('0xb')],'context':_0x35b18f[_0xd81b('0x6')],'priority':_0x25824e+_0x4add79,'VoiceExtensionId':_0x35b18f['id']});}if(_0x334bd0[_0xd81b('0x42')]===_0xd81b('0x49'))_0x334bd0[_0xd81b('0x4a')]=_0x36c69f(_0x35b18f,_0x334bd0['appdata']);_0x334bd0[_0xd81b('0x4b')]=_0x2e44f3[_0xd81b('0x23')]?_[_0xd81b('0x4c')](_0x2e44f3)[_0xd81b('0x4b')]+0x1:_0x25824e;_0x194d2a=_[_0xd81b('0x4d')](_0x194d2a,_0x2e44f3,[_0x334bd0],_0x2fa588);_0x25824e=_[_0xd81b('0x4c')](_0x194d2a)[_0xd81b('0x4b')]+0x1;}return _0xa5e391(_0x194d2a);})['catch'](function(_0x14b187){_0x1e6654(_0x14b187);});});}return _0x2337b1[_0xd81b('0x4e')](_0xd81b('0x4f'),attributes,{'tableName':_0xd81b('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x8a3dbc){var _0x1cbd4a=this[_0xd81b('0x51')]({'plain':!![]});var _0x19d4f0=_0x1cbd4a[_0xd81b('0x4')]===_0xd81b('0x12')?_0x26df61(_0x1cbd4a):_0x111a9c(_0x1cbd4a);return _0x4b8ffc(_0x1cbd4a,_0x8a3dbc,_[_0xd81b('0x4c')](_0x19d4f0)[_0xd81b('0x4b')]+0x1)['then'](function(_0xc45841){var _0x5358a6=_[_0xd81b('0x4d')](_0x19d4f0,_0xc45841);_0x5358a6[_0xd81b('0xd')]({'type':_0x1cbd4a[_0xd81b('0x4')],'app':_0xd81b('0x52'),'exten':_0x1cbd4a[_0xd81b('0xb')],'context':_0x1cbd4a[_0xd81b('0x6')],'priority':_[_0xd81b('0x4c')](_0x5358a6)[_0xd81b('0x4b')]+0x1,'VoiceExtensionId':_0x1cbd4a['id']});return _0x5358a6;});}}});};
\ No newline at end of file
index c210171..118f549 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd67b=['include','model','map','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit'];(function(_0xd1fe,_0x1325f3){var _0x3e94c5=function(_0x3f4cc9){while(--_0x3f4cc9){_0xd1fe['push'](_0xd1fe['shift']());}};_0x3e94c5(++_0x1325f3);}(_0xd67b,0x133));var _0xbd67=function(_0x515fff,_0x5e6993){_0x515fff=_0x515fff-0x0;var _0x283527=_0xd67b[_0x515fff];return _0x283527;};'use strict';var _=require('lodash');var util=require(_0xbd67('0x0'));var moment=require('moment');var BPromise=require(_0xbd67('0x1'));var rs=require(_0xbd67('0x2'));var fs=require('fs');var Redis=require(_0xbd67('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd67('0x4'));var logger=require('../../config/logger')(_0xbd67('0x5'));var config=require('../../config/environment');var jayson=require(_0xbd67('0x6'));var client=jayson[_0xbd67('0x7')][_0xbd67('0x8')]({'port':0x232a});config[_0xbd67('0x9')]=_[_0xbd67('0xa')](config[_0xbd67('0x9')],{'host':_0xbd67('0xb'),'port':0x18eb});var socket=require(_0xbd67('0xc'))(new Redis(config[_0xbd67('0x9')]));require(_0xbd67('0xd'))[_0xbd67('0xe')](socket);function respondWithRpcPromise(_0x3a7f43,_0x283f2f,_0x52b981){return new BPromise(function(_0x54954b,_0x208920){return client['request'](_0x3a7f43,_0x52b981)[_0xbd67('0xf')](function(_0xb6b4b5){logger[_0xbd67('0x10')](_0xbd67('0x11'),_0x283f2f,_0xbd67('0x12'));logger[_0xbd67('0x13')](_0xbd67('0x14'),_0x283f2f,_0xbd67('0x12'),JSON[_0xbd67('0x15')](_0xb6b4b5));if(_0xb6b4b5[_0xbd67('0x16')]){if(_0xb6b4b5['error'][_0xbd67('0x17')]===0x1f4){logger[_0xbd67('0x16')](_0xbd67('0x11'),_0x283f2f,_0xb6b4b5[_0xbd67('0x16')][_0xbd67('0x18')]);return _0x208920(_0xb6b4b5[_0xbd67('0x16')][_0xbd67('0x18')]);}logger[_0xbd67('0x16')](_0xbd67('0x11'),_0x283f2f,_0xb6b4b5[_0xbd67('0x16')]['message']);return _0x54954b(_0xb6b4b5['error'][_0xbd67('0x18')]);}else{logger[_0xbd67('0x10')](_0xbd67('0x11'),_0x283f2f,'request\x20sent');_0x54954b(_0xb6b4b5[_0xbd67('0x19')][_0xbd67('0x18')]);}})[_0xbd67('0x1a')](function(_0x4b764f){logger[_0xbd67('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x283f2f,_0x4b764f);_0x208920(_0x4b764f);});});}exports[_0xbd67('0x1b')]=function(_0x4609b7){var _0xb3f67f=this;return new Promise(function(_0x5e42c7,_0x3c4102){return db[_0xbd67('0x1c')][_0xbd67('0x1d')]({'raw':_0x4609b7[_0xbd67('0x1e')]?_0x4609b7[_0xbd67('0x1e')][_0xbd67('0x1f')]===undefined?!![]:![]:!![],'where':_0x4609b7['options']?_0x4609b7[_0xbd67('0x1e')][_0xbd67('0x20')]||null:null,'attributes':_0x4609b7[_0xbd67('0x1e')]?_0x4609b7[_0xbd67('0x1e')][_0xbd67('0x21')]||null:null,'limit':_0x4609b7[_0xbd67('0x1e')]?_0x4609b7[_0xbd67('0x1e')][_0xbd67('0x22')]||null:null,'include':_0x4609b7[_0xbd67('0x1e')]?_0x4609b7[_0xbd67('0x1e')][_0xbd67('0x23')]?_['map'](_0x4609b7[_0xbd67('0x1e')]['include'],function(_0x25bf7a){return{'model':db[_0x25bf7a[_0xbd67('0x24')]],'as':_0x25bf7a['as'],'attributes':_0x25bf7a[_0xbd67('0x21')],'include':_0x25bf7a['include']?_[_0xbd67('0x25')](_0x25bf7a[_0xbd67('0x23')],function(_0x4dfa19){return{'model':db[_0x4dfa19[_0xbd67('0x24')]],'as':_0x4dfa19['as'],'attributes':_0x4dfa19[_0xbd67('0x21')],'include':_0x4dfa19[_0xbd67('0x23')]?_[_0xbd67('0x25')](_0x4dfa19[_0xbd67('0x23')],function(_0x55c2d4){return{'model':db[_0x55c2d4['model']],'as':_0x55c2d4['as'],'attributes':_0x55c2d4[_0xbd67('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbd67('0xf')](function(_0x4675ac){logger[_0xbd67('0x10')](_0xbd67('0x1b'),_0x4609b7);logger[_0xbd67('0x13')](_0xbd67('0x1b'),_0x4609b7,JSON[_0xbd67('0x15')](_0x4675ac));_0x5e42c7(_0x4675ac);})[_0xbd67('0x1a')](function(_0x34e5a8){logger['error']('GetVoiceExtension',_0x34e5a8[_0xbd67('0x18')],_0x4609b7);_0x3c4102(_0xb3f67f[_0xbd67('0x16')](0x1f4,_0x34e5a8[_0xbd67('0x18')]));});});};
\ No newline at end of file
+var _0x5294=['debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetVoiceExtension','findAll','options','raw','attributes','include','map','model'];(function(_0x2e53e1,_0x12aed1){var _0x3a23de=function(_0xd84699){while(--_0xd84699){_0x2e53e1['push'](_0x2e53e1['shift']());}};_0x3a23de(++_0x12aed1);}(_0x5294,0x111));var _0x4529=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x5294[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x4529('0x0'));var util=require(_0x4529('0x1'));var moment=require(_0x4529('0x2'));var BPromise=require(_0x4529('0x3'));var rs=require(_0x4529('0x4'));var fs=require('fs');var Redis=require(_0x4529('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4529('0x6'));var logger=require(_0x4529('0x7'))(_0x4529('0x8'));var config=require('../../config/environment');var jayson=require(_0x4529('0x9'));var client=jayson[_0x4529('0xa')][_0x4529('0xb')]({'port':0x232a});config[_0x4529('0xc')]=_['defaults'](config[_0x4529('0xc')],{'host':_0x4529('0xd'),'port':0x18eb});var socket=require(_0x4529('0xe'))(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x350678,_0x2532f4,_0x19777f){return new BPromise(function(_0x579574,_0x1a13b6){return client[_0x4529('0xf')](_0x350678,_0x19777f)[_0x4529('0x10')](function(_0x3143ba){logger[_0x4529('0x11')](_0x4529('0x12'),_0x2532f4,'request\x20sent');logger['debug'](_0x4529('0x13'),_0x2532f4,_0x4529('0x14'),JSON['stringify'](_0x3143ba));if(_0x3143ba[_0x4529('0x15')]){if(_0x3143ba['error'][_0x4529('0x16')]===0x1f4){logger[_0x4529('0x15')](_0x4529('0x12'),_0x2532f4,_0x3143ba[_0x4529('0x15')]['message']);return _0x1a13b6(_0x3143ba[_0x4529('0x15')][_0x4529('0x17')]);}logger[_0x4529('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x2532f4,_0x3143ba[_0x4529('0x15')][_0x4529('0x17')]);return _0x579574(_0x3143ba[_0x4529('0x15')][_0x4529('0x17')]);}else{logger['info'](_0x4529('0x12'),_0x2532f4,_0x4529('0x14'));_0x579574(_0x3143ba['result'][_0x4529('0x17')]);}})[_0x4529('0x18')](function(_0x10b3e1){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x2532f4,_0x10b3e1);_0x1a13b6(_0x10b3e1);});});}exports[_0x4529('0x19')]=function(_0x722e24){var _0x3e4467=this;return new Promise(function(_0x1c70d4,_0x32b8dc){return db['VoiceExtension'][_0x4529('0x1a')]({'raw':_0x722e24[_0x4529('0x1b')]?_0x722e24[_0x4529('0x1b')][_0x4529('0x1c')]===undefined?!![]:![]:!![],'where':_0x722e24[_0x4529('0x1b')]?_0x722e24[_0x4529('0x1b')]['where']||null:null,'attributes':_0x722e24[_0x4529('0x1b')]?_0x722e24[_0x4529('0x1b')][_0x4529('0x1d')]||null:null,'limit':_0x722e24['options']?_0x722e24[_0x4529('0x1b')]['limit']||null:null,'include':_0x722e24[_0x4529('0x1b')]?_0x722e24[_0x4529('0x1b')][_0x4529('0x1e')]?_[_0x4529('0x1f')](_0x722e24[_0x4529('0x1b')][_0x4529('0x1e')],function(_0x2647d3){return{'model':db[_0x2647d3[_0x4529('0x20')]],'as':_0x2647d3['as'],'attributes':_0x2647d3[_0x4529('0x1d')],'include':_0x2647d3['include']?_['map'](_0x2647d3['include'],function(_0x43c608){return{'model':db[_0x43c608[_0x4529('0x20')]],'as':_0x43c608['as'],'attributes':_0x43c608[_0x4529('0x1d')],'include':_0x43c608[_0x4529('0x1e')]?_[_0x4529('0x1f')](_0x43c608['include'],function(_0x534c2d){return{'model':db[_0x534c2d[_0x4529('0x20')]],'as':_0x534c2d['as'],'attributes':_0x534c2d[_0x4529('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4529('0x10')](function(_0x3e0d2c){logger['info']('GetVoiceExtension',_0x722e24);logger[_0x4529('0x21')](_0x4529('0x19'),_0x722e24,JSON['stringify'](_0x3e0d2c));_0x1c70d4(_0x3e0d2c);})[_0x4529('0x18')](function(_0x25519e){logger[_0x4529('0x15')](_0x4529('0x19'),_0x25519e[_0x4529('0x17')],_0x722e24);_0x32b8dc(_0x3e4467[_0x4529('0x15')](0x1f4,_0x25519e[_0x4529('0x17')]));});});};
\ No newline at end of file
index e973a5f..2e7b560 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0xe32be4,_0x277ff6){var _0x2a9507=function(_0x17e49b){while(--_0x17e49b){_0xe32be4['push'](_0xe32be4['shift']());}};_0x2a9507(++_0x277ff6);}(_0x4975,0x86));var _0x5497=function(_0x5bfd4f,_0x350a7d){_0x5bfd4f=_0x5bfd4f-0x0;var _0x538214=_0x4975[_0x5bfd4f];return _0x538214;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}};
\ No newline at end of file
+var _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x2562ec,_0x282fff){var _0x3dad71=function(_0x2075d7){while(--_0x2075d7){_0x2562ec['push'](_0x2562ec['shift']());}};_0x3dad71(++_0x282fff);}(_0x5fab,0x177));var _0xb5fa=function(_0x308c6a,_0xe04d64){_0x308c6a=_0x308c6a-0x0;var _0x257b4d=_0x5fab[_0x308c6a];return _0x257b4d;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}};
\ No newline at end of file
index 8f24a95..31a8109 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc1c6=['multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','getMessages','create','put','update','delete','destroy','exports'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x146973,_0x2633a5){_0x146973=_0x146973-0x0;var _0x4631aa=_0xc1c6[_0x146973];return _0x4631aa;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var fs_extra=require(_0x6c1c('0x4'));var auth=require(_0x6c1c('0x5'));var interaction=require(_0x6c1c('0x6'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x6c1c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x8')]);router['get'](_0x6c1c('0x9'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x7')]('/:id/messages',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xc')]);router['post']('/',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xd')]);router[_0x6c1c('0xe')](_0x6c1c('0x9'),auth['isAuthenticated'](),controller[_0x6c1c('0xf')]);router[_0x6c1c('0x10')](_0x6c1c('0x9'),auth['isAuthenticated'](),controller[_0x6c1c('0x11')]);module[_0x6c1c('0x12')]=router;
\ No newline at end of file
+var _0x1883=['index','/:id','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x1883,0xab));var _0x3188=function(_0x5cc7e7,_0x3b9912){_0x5cc7e7=_0x5cc7e7-0x0;var _0x155769=_0x1883[_0x5cc7e7];return _0x155769;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['show']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['post']('/',auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')](_0x3188('0xe'),auth['isAuthenticated'](),controller[_0x3188('0x13')]);router[_0x3188('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3188('0x15')]);module[_0x3188('0x16')]=router;
\ No newline at end of file
index 9097fff..76db905 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc3c2=['VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','contest_mailbox','setDataValue','email','string','trim','central','yes','ENUM','TIMESTAMP','INTEGER'];(function(_0x36706e,_0x1b2f39){var _0x2620f2=function(_0x1ea2e3){while(--_0x1ea2e3){_0x36706e['push'](_0x36706e['shift']());}};_0x2620f2(++_0x1b2f39);}(_0xc3c2,0xaf));var _0x2c3c=function(_0x20044c,_0x42b90b){_0x20044c=_0x20044c-0x0;var _0x3a8204=_0xc3c2[_0x20044c];return _0x3a8204;};'use strict';var Sequelize=require(_0x2c3c('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x2c3c('0x1')]},'context':{'type':Sequelize[_0x2c3c('0x1')],'defaultValue':'from-voicemail','unique':_0x2c3c('0x2')},'mailbox':{'type':Sequelize[_0x2c3c('0x1')],'defaultValue':'','allowNull':![],'unique':_0x2c3c('0x2')},'password':{'type':Sequelize[_0x2c3c('0x1')]},'fullname':{'type':Sequelize[_0x2c3c('0x1')]},'email':{'type':Sequelize[_0x2c3c('0x1')],'validate':{'isEmail':!![]},'set':function(_0x5ecd42){this[_0x2c3c('0x3')](_0x2c3c('0x4'),typeof _0x5ecd42===_0x2c3c('0x5')&&_0x5ecd42[_0x2c3c('0x6')]()?_0x5ecd42['trim']():null);}},'pager':{'type':Sequelize[_0x2c3c('0x1')]},'tz':{'type':Sequelize[_0x2c3c('0x1')],'defaultValue':_0x2c3c('0x7')},'attach':{'type':Sequelize['ENUM'](_0x2c3c('0x8'),'no'),'defaultValue':_0x2c3c('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x2c3c('0x9')](_0x2c3c('0x8'),'no'),'defaultValue':_0x2c3c('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x2c3c('0x1')]},'callback':{'type':Sequelize[_0x2c3c('0x1')]},'review':{'type':Sequelize[_0x2c3c('0x9')](_0x2c3c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x2c3c('0x9')](_0x2c3c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x2c3c('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x2c3c('0x9')](_0x2c3c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x2c3c('0x9')](_0x2c3c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x2c3c('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x2c3c('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x2c3c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x2c3c('0x9')](_0x2c3c('0x8'),'no'),'defaultValue':_0x2c3c('0x8'),'allowNull':![]},'stamp':{'type':_0x2c3c('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x2c3c('0x1')]},'maxsecs':{'type':Sequelize[_0x2c3c('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x2c3c('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x2c3c('0xc')],'get':function(){return this[_0x2c3c('0xd')](_0x2c3c('0xe'))+_0x2c3c('0xf')+this[_0x2c3c('0xd')](_0x2c3c('0x10'));}}};
\ No newline at end of file
+var _0x27a8=['VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x1b9b48,_0x58a7d0){var _0x581e68=function(_0xe4e03e){while(--_0xe4e03e){_0x1b9b48['push'](_0x1b9b48['shift']());}};_0x581e68(++_0x58a7d0);}(_0x27a8,0x76));var _0x827a=function(_0x245af9,_0x4bbf47){_0x245af9=_0x245af9-0x0;var _0x42e611=_0x27a8[_0x245af9];return _0x42e611;};'use strict';var Sequelize=require(_0x827a('0x0'));module[_0x827a('0x1')]={'customer_id':{'type':Sequelize[_0x827a('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x827a('0x3'),'unique':_0x827a('0x4')},'mailbox':{'type':Sequelize[_0x827a('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x827a('0x2')]},'fullname':{'type':Sequelize[_0x827a('0x2')]},'email':{'type':Sequelize[_0x827a('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2a59f4){this[_0x827a('0x5')](_0x827a('0x6'),typeof _0x2a59f4===_0x827a('0x7')&&_0x2a59f4[_0x827a('0x8')]()?_0x2a59f4['trim']():null);}},'pager':{'type':Sequelize[_0x827a('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x827a('0x9')},'attach':{'type':Sequelize[_0x827a('0xa')](_0x827a('0xb'),'no'),'defaultValue':_0x827a('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x827a('0xa')]('yes','no'),'defaultValue':_0x827a('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0x827a('0x2')]},'callback':{'type':Sequelize[_0x827a('0x2')]},'review':{'type':Sequelize[_0x827a('0xa')](_0x827a('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x827a('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x827a('0xa')](_0x827a('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x827a('0xa')](_0x827a('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x827a('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x827a('0xa')](_0x827a('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x827a('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x827a('0xa')](_0x827a('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x827a('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x827a('0xa')](_0x827a('0xb'),'no'),'defaultValue':_0x827a('0xb'),'allowNull':![]},'stamp':{'type':_0x827a('0xd')},'emailsubject':{'type':Sequelize[_0x827a('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x827a('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x827a('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x827a('0xf')],'get':function(){return this[_0x827a('0x10')]('fullname')+_0x827a('0x11')+this[_0x827a('0x10')](_0x827a('0x12'));}}};
\ No newline at end of file
index a836d08..1baa20e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xea28=['undefined','limit','count','reject','update','then','get','Voicemails','sendStatus','stack','name','send','index','map','VoiceMail','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','intersection','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','body','params','destroy','getMessages','VoiceMailMessage','rawAttributes','order','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x20be09,_0x5e2957){var _0x20c5d8=function(_0x166943){while(--_0x166943){_0x20be09['push'](_0x20be09['shift']());}};_0x20c5d8(++_0x5e2957);}(_0xea28,0x13a));var _0x8ea2=function(_0x1141c4,_0x1c6a05){_0x1141c4=_0x1141c4-0x0;var _0x558a3a=_0xea28[_0x1141c4];return _0x558a3a;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1b')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1b')](_0x772bad)[_0x8ea2('0x1c')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=typeof _0xbb9bd1[_0x8ea2('0x1d')]===_0x8ea2('0x1e')&&typeof _0xbb9bd1[_0x8ea2('0x1f')]===_0x8ea2('0x1e');var _0x3bc774=_0x3cff96[_0x8ea2('0x20')];var _0x1b64cf=_0x11f5e8?0x0:_0xbb9bd1[_0x8ea2('0x1d')];var _0x467045=_0x11f5e8?_0x3cff96[_0x8ea2('0x20')]:_0xbb9bd1[_0x8ea2('0x1d')]+_0xbb9bd1[_0x8ea2('0x1f')];var _0x134cbe;if(_0x467045>=_0x3bc774){_0x467045=_0x3bc774;_0x134cbe=0xc8;}else{_0x134cbe=0xce;}_0x393faf[_0x8ea2('0x1b')](_0x134cbe);return _0x393faf['set']('Content-Range',_0x1b64cf+'-'+_0x467045+'/'+_0x3bc774)[_0x8ea2('0x1c')](_0x3cff96);}return null;};}function patchUpdates(_0x248c18){return function(_0x29151a){try{jsonpatch['apply'](_0x29151a,_0x248c18,!![]);}catch(_0x46f4fe){return BPromise[_0x8ea2('0x21')](_0x46f4fe);}return _0x29151a['save']();};}function saveUpdates(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x22')](_0x3d593b)[_0x8ea2('0x23')](function(_0xe5c943){return _0xe5c943;});}return null;};}function removeEntity(_0x199417,_0x1e4cc9){return function(_0x18ec34){if(_0x18ec34){return _0x18ec34['destroy']()[_0x8ea2('0x23')](function(){var _0x4f48bd=_0x18ec34[_0x8ea2('0x24')]({'plain':!![]});var _0x42bec8=_0x8ea2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x42bec8,'resourceId':_0x4f48bd['id']}})[_0x8ea2('0x23')](function(){return _0x18ec34;});})['then'](function(){_0x199417[_0x8ea2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be291,_0x12fa37){return function(_0x21c526){if(!_0x21c526){_0x3be291[_0x8ea2('0x26')](0x194);}return _0x21c526;};}function handleError(_0x4e1b90,_0x5ce1d4){_0x5ce1d4=_0x5ce1d4||0x1f4;return function(_0xacaa6c){logger['error'](_0xacaa6c[_0x8ea2('0x27')]);if(_0xacaa6c[_0x8ea2('0x28')]){delete _0xacaa6c[_0x8ea2('0x28')];}_0x4e1b90[_0x8ea2('0x1b')](_0x5ce1d4)[_0x8ea2('0x29')](_0xacaa6c);};}exports[_0x8ea2('0x2a')]=function(_0x32e225,_0x316707){var _0x19e868={},_0x9c5fac={},_0x56d914={'count':0x0,'rows':[]};var _0x5b7ff9=_[_0x8ea2('0x2b')](db[_0x8ea2('0x2c')]['rawAttributes'],function(_0x4a110f){return{'name':_0x4a110f[_0x8ea2('0x2d')],'type':_0x4a110f['type'][_0x8ea2('0x2e')]};});_0x9c5fac[_0x8ea2('0x2f')]=_['map'](_0x5b7ff9,_0x8ea2('0x28'));_0x9c5fac[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x32e225['query']);_0x9c5fac['filters']=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],_0x9c5fac[_0x8ea2('0x30')]);_0x19e868[_0x8ea2('0x32')]=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],qs[_0x8ea2('0x33')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x19e868[_0x8ea2('0x32')]=_0x19e868[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x19e868[_0x8ea2('0x32')]:_0x9c5fac['model'];if(!_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x35')](_0x8ea2('0x36'))){_0x19e868[_0x8ea2('0x1f')]=qs['limit'](_0x32e225[_0x8ea2('0x30')]['limit']);_0x19e868[_0x8ea2('0x1d')]=qs[_0x8ea2('0x1d')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x19e868['order']=qs[_0x8ea2('0x37')](_0x32e225['query']['sort']);_0x19e868[_0x8ea2('0x38')]=qs['filters'](_[_0x8ea2('0x39')](_0x32e225[_0x8ea2('0x30')],_0x9c5fac[_0x8ea2('0x3a')]),_0x5b7ff9);if(_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x19e868['where']=_[_0x8ea2('0x3c')](_0x19e868['where'],{'$or':_[_0x8ea2('0x2b')](_0x5b7ff9,function(_0x282f00){if(_0x282f00[_0x8ea2('0x3d')]!==_0x8ea2('0x3e')){var _0x4f9a8c={};_0x4f9a8c[_0x282f00[_0x8ea2('0x28')]]={'$like':'%'+_0x32e225['query'][_0x8ea2('0x3b')]+'%'};return _0x4f9a8c;}})});}_0x19e868=_['merge']({},_0x19e868,_0x32e225[_0x8ea2('0x3f')]);var _0x450e8f={'where':_0x19e868[_0x8ea2('0x38')]};return db[_0x8ea2('0x2c')][_0x8ea2('0x20')](_0x450e8f)[_0x8ea2('0x23')](function(_0x2f4fa8){_0x56d914['count']=_0x2f4fa8;if(_0x32e225['query'][_0x8ea2('0x40')]){_0x19e868['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x19e868);})[_0x8ea2('0x23')](function(_0x5d9ba0){_0x56d914[_0x8ea2('0x41')]=_0x5d9ba0;return _0x56d914;})[_0x8ea2('0x23')](respondWithFilteredResult(_0x316707,_0x19e868))[_0x8ea2('0x42')](handleError(_0x316707,null));};exports[_0x8ea2('0x43')]=function(_0x989d9b,_0x8f700f){var _0x3b2219={'raw':!![],'where':{'id':_0x989d9b['params']['id']}},_0x348b17={};_0x348b17[_0x8ea2('0x2f')]=_[_0x8ea2('0x31')](db[_0x8ea2('0x2c')]['rawAttributes']);_0x348b17[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x989d9b[_0x8ea2('0x30')]);_0x348b17[_0x8ea2('0x3a')]=_[_0x8ea2('0x44')](_0x348b17['model'],_0x348b17[_0x8ea2('0x30')]);_0x3b2219[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x348b17['model'],qs[_0x8ea2('0x33')](_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x3b2219[_0x8ea2('0x32')]=_0x3b2219[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x3b2219[_0x8ea2('0x32')]:_0x348b17[_0x8ea2('0x2f')];if(_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x40')]){_0x3b2219[_0x8ea2('0x45')]=[{'all':!![]}];}_0x3b2219=_[_0x8ea2('0x3c')]({},_0x3b2219,_0x989d9b[_0x8ea2('0x3f')]);return db[_0x8ea2('0x2c')]['find'](_0x3b2219)[_0x8ea2('0x23')](handleEntityNotFound(_0x8f700f,null))[_0x8ea2('0x23')](respondWithResult(_0x8f700f,null))[_0x8ea2('0x42')](handleError(_0x8f700f,null));};exports[_0x8ea2('0x46')]=function(_0x182a46,_0x1daa25){return db[_0x8ea2('0x2c')][_0x8ea2('0x46')](_0x182a46['body'],{})[_0x8ea2('0x23')](function(_0x37a1cf){var _0x24dddb=_0x182a46['user']['get']({'plain':!![]});if(!_0x24dddb)throw new Error(_0x8ea2('0x47'));if(_0x24dddb[_0x8ea2('0x48')]===_0x8ea2('0x49')){var _0x5e5c37=_0x37a1cf[_0x8ea2('0x24')]({'plain':!![]});var _0x315b5d=_0x8ea2('0x25');return db[_0x8ea2('0x4a')][_0x8ea2('0x4b')]({'where':{'name':_0x315b5d,'userProfileId':_0x24dddb['userProfileId']},'raw':!![]})['then'](function(_0x24a22a){if(_0x24a22a&&_0x24a22a[_0x8ea2('0x4c')]===0x0){return db[_0x8ea2('0x4d')]['create']({'name':_0x5e5c37[_0x8ea2('0x28')],'resourceId':_0x5e5c37['id'],'type':_0x24a22a[_0x8ea2('0x28')],'sectionId':_0x24a22a['id']},{})[_0x8ea2('0x23')](function(){return _0x37a1cf;});}else{return _0x37a1cf;}})['catch'](function(_0x5c6524){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c6524);throw _0x5c6524;});}return _0x37a1cf;})['then'](respondWithResult(_0x1daa25,0xc9))[_0x8ea2('0x42')](handleError(_0x1daa25,null));};exports[_0x8ea2('0x22')]=function(_0x5f56f8,_0x49cf11){if(_0x5f56f8[_0x8ea2('0x4e')]['id']){delete _0x5f56f8[_0x8ea2('0x4e')]['id'];}return db[_0x8ea2('0x2c')]['find']({'where':{'id':_0x5f56f8[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x49cf11,null))['then'](saveUpdates(_0x5f56f8[_0x8ea2('0x4e')],null))[_0x8ea2('0x23')](respondWithResult(_0x49cf11,null))[_0x8ea2('0x42')](handleError(_0x49cf11,null));};exports[_0x8ea2('0x50')]=function(_0x4728b4,_0x58674d){return db['VoiceMail']['find']({'where':{'id':_0x4728b4[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x58674d,null))[_0x8ea2('0x23')](removeEntity(_0x58674d,null))[_0x8ea2('0x42')](handleError(_0x58674d,null));};exports[_0x8ea2('0x51')]=function(_0x3836c3,_0x36fda3,_0x5265e7){return db['VoiceMail']['findOne']({'where':{'id':_0x3836c3[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x36fda3,null))[_0x8ea2('0x23')](function(_0x2bbec0){var _0x57720d;var _0x11824e={},_0x2b8662={};_0x2b8662['model']=_[_0x8ea2('0x31')](db[_0x8ea2('0x52')][_0x8ea2('0x53')]);_0x2b8662[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x3836c3['query']);_0x2b8662['filters']=_['intersection'](_0x2b8662[_0x8ea2('0x2f')],_0x2b8662[_0x8ea2('0x30')]);_0x11824e[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x2b8662[_0x8ea2('0x2f')],qs['fields'](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x11824e[_0x8ea2('0x32')]=_0x11824e[_0x8ea2('0x32')]['length']?_0x11824e[_0x8ea2('0x32')]:_0x2b8662['model'];if(!_0x3836c3[_0x8ea2('0x30')]['hasOwnProperty'](_0x8ea2('0x36'))){_0x11824e[_0x8ea2('0x1f')]=qs['limit'](_0x3836c3['query'][_0x8ea2('0x1f')]);_0x11824e['offset']=qs[_0x8ea2('0x1d')](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x11824e[_0x8ea2('0x54')]=qs['sort'](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x37')]);_0x11824e[_0x8ea2('0x38')]=qs[_0x8ea2('0x3a')](_[_0x8ea2('0x39')](_0x3836c3[_0x8ea2('0x30')],_0x2b8662[_0x8ea2('0x3a')]));if(_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x11824e[_0x8ea2('0x38')]=_[_0x8ea2('0x3c')](_0x11824e[_0x8ea2('0x38')],{'$or':_['map'](_0x11824e[_0x8ea2('0x32')],function(_0x2d130a){var _0x4de6ba={};_0x4de6ba[_0x2d130a]={'$like':'%'+_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x3b')]+'%'};return _0x4de6ba;})});}_0x11824e[_0x8ea2('0x38')]=_[_0x8ea2('0x3c')](_0x11824e[_0x8ea2('0x38')],{'mailboxuser':_0x2bbec0[_0x8ea2('0x55')]});_0x11824e=_[_0x8ea2('0x3c')]({},_0x11824e,_0x3836c3[_0x8ea2('0x3f')]);return db[_0x8ea2('0x52')]['findAndCountAll'](_0x11824e)[_0x8ea2('0x23')](respondWithFilteredResult(_0x36fda3,_0x11824e));})[_0x8ea2('0x42')](handleError(_0x36fda3,null));};
\ No newline at end of file
+var _0x0abf=['Content-Range','apply','reject','save','update','then','get','Voicemails','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','model','keys','query','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','map','type','VIRTUAL','merge','options','VoiceMail','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','destroy','getMessages','findOne','VoiceMailMessage','hasOwnProperty','order','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x5f491f,_0x4c3d6c){var _0x5673b0=function(_0x42a40f){while(--_0x42a40f){_0x5f491f['push'](_0x5f491f['shift']());}};_0x5673b0(++_0x4c3d6c);}(_0x0abf,0xe8));var _0xf0ab=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0abf[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];function respondWithStatusCode(_0x38ca67,_0x34ccdc){_0x34ccdc=_0x34ccdc||0xcc;return function(_0x4fdd5f){if(_0x4fdd5f){return _0x38ca67[_0xf0ab('0x17')](_0x34ccdc);}return _0x38ca67[_0xf0ab('0x18')](_0x34ccdc)[_0xf0ab('0x19')]();};}function respondWithResult(_0x35c75f,_0x1824ef){_0x1824ef=_0x1824ef||0xc8;return function(_0x36cabe){if(_0x36cabe){return _0x35c75f[_0xf0ab('0x18')](_0x1824ef)[_0xf0ab('0x1a')](_0x36cabe);}};}function respondWithFilteredResult(_0x180d0b,_0x3c5bfd){return function(_0x20f453){if(_0x20f453){var _0x221bac=typeof _0x3c5bfd[_0xf0ab('0x1b')]===_0xf0ab('0x1c')&&typeof _0x3c5bfd[_0xf0ab('0x1d')]==='undefined';var _0x457465=_0x20f453[_0xf0ab('0x1e')];var _0x1803f0=_0x221bac?0x0:_0x3c5bfd[_0xf0ab('0x1b')];var _0x776619=_0x221bac?_0x20f453[_0xf0ab('0x1e')]:_0x3c5bfd[_0xf0ab('0x1b')]+_0x3c5bfd[_0xf0ab('0x1d')];var _0x1713d6;if(_0x776619>=_0x457465){_0x776619=_0x457465;_0x1713d6=0xc8;}else{_0x1713d6=0xce;}_0x180d0b[_0xf0ab('0x18')](_0x1713d6);return _0x180d0b[_0xf0ab('0x1f')](_0xf0ab('0x20'),_0x1803f0+'-'+_0x776619+'/'+_0x457465)[_0xf0ab('0x1a')](_0x20f453);}return null;};}function patchUpdates(_0x22a205){return function(_0x2cd961){try{jsonpatch[_0xf0ab('0x21')](_0x2cd961,_0x22a205,!![]);}catch(_0x537673){return BPromise[_0xf0ab('0x22')](_0x537673);}return _0x2cd961[_0xf0ab('0x23')]();};}function saveUpdates(_0x1e1483,_0x11ab3a){return function(_0x3bf6a1){if(_0x3bf6a1){return _0x3bf6a1[_0xf0ab('0x24')](_0x1e1483)[_0xf0ab('0x25')](function(_0x20140b){return _0x20140b;});}return null;};}function removeEntity(_0x36ad01,_0x18bb37){return function(_0x43119f){if(_0x43119f){return _0x43119f['destroy']()['then'](function(){var _0x4eee21=_0x43119f[_0xf0ab('0x26')]({'plain':!![]});var _0x4f0caf=_0xf0ab('0x27');return db[_0xf0ab('0x28')]['destroy']({'where':{'type':_0x4f0caf,'resourceId':_0x4eee21['id']}})[_0xf0ab('0x25')](function(){return _0x43119f;});})[_0xf0ab('0x25')](function(){_0x36ad01[_0xf0ab('0x18')](0xcc)[_0xf0ab('0x19')]();});}};}function handleEntityNotFound(_0x7d4ff9,_0x502921){return function(_0x2d0da7){if(!_0x2d0da7){_0x7d4ff9['sendStatus'](0x194);}return _0x2d0da7;};}function handleError(_0x55d799,_0x1dcd2e){_0x1dcd2e=_0x1dcd2e||0x1f4;return function(_0x4306c6){logger[_0xf0ab('0x29')](_0x4306c6[_0xf0ab('0x2a')]);if(_0x4306c6[_0xf0ab('0x2b')]){delete _0x4306c6[_0xf0ab('0x2b')];}_0x55d799[_0xf0ab('0x18')](_0x1dcd2e)[_0xf0ab('0x2c')](_0x4306c6);};}exports[_0xf0ab('0x2d')]=function(_0x2f0fcd,_0x21e8ac){var _0x199753={},_0x58cbe1={},_0x1e1ffb={'count':0x0,'rows':[]};var _0x35973a=_['map'](db['VoiceMail'][_0xf0ab('0x2e')],function(_0x1dc84e){return{'name':_0x1dc84e[_0xf0ab('0x2f')],'type':_0x1dc84e['type']['key']};});_0x58cbe1[_0xf0ab('0x30')]=_['map'](_0x35973a,_0xf0ab('0x2b'));_0x58cbe1['query']=_[_0xf0ab('0x31')](_0x2f0fcd[_0xf0ab('0x32')]);_0x58cbe1['filters']=_['intersection'](_0x58cbe1[_0xf0ab('0x30')],_0x58cbe1[_0xf0ab('0x32')]);_0x199753[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x58cbe1[_0xf0ab('0x30')],qs[_0xf0ab('0x35')](_0x2f0fcd[_0xf0ab('0x32')][_0xf0ab('0x35')]));_0x199753[_0xf0ab('0x33')]=_0x199753[_0xf0ab('0x33')][_0xf0ab('0x36')]?_0x199753[_0xf0ab('0x33')]:_0x58cbe1[_0xf0ab('0x30')];if(!_0x2f0fcd[_0xf0ab('0x32')]['hasOwnProperty'](_0xf0ab('0x37'))){_0x199753[_0xf0ab('0x1d')]=qs[_0xf0ab('0x1d')](_0x2f0fcd['query'][_0xf0ab('0x1d')]);_0x199753[_0xf0ab('0x1b')]=qs[_0xf0ab('0x1b')](_0x2f0fcd['query'][_0xf0ab('0x1b')]);}_0x199753['order']=qs[_0xf0ab('0x38')](_0x2f0fcd['query'][_0xf0ab('0x38')]);_0x199753[_0xf0ab('0x39')]=qs[_0xf0ab('0x3a')](_[_0xf0ab('0x3b')](_0x2f0fcd[_0xf0ab('0x32')],_0x58cbe1[_0xf0ab('0x3a')]),_0x35973a);if(_0x2f0fcd['query'][_0xf0ab('0x3c')]){_0x199753[_0xf0ab('0x39')]=_['merge'](_0x199753[_0xf0ab('0x39')],{'$or':_[_0xf0ab('0x3d')](_0x35973a,function(_0x1d4eec){if(_0x1d4eec[_0xf0ab('0x3e')]!==_0xf0ab('0x3f')){var _0x11e3b7={};_0x11e3b7[_0x1d4eec[_0xf0ab('0x2b')]]={'$like':'%'+_0x2f0fcd['query'][_0xf0ab('0x3c')]+'%'};return _0x11e3b7;}})});}_0x199753=_[_0xf0ab('0x40')]({},_0x199753,_0x2f0fcd[_0xf0ab('0x41')]);var _0x4bd6d1={'where':_0x199753[_0xf0ab('0x39')]};return db[_0xf0ab('0x42')][_0xf0ab('0x1e')](_0x4bd6d1)[_0xf0ab('0x25')](function(_0x2b7ed5){_0x1e1ffb['count']=_0x2b7ed5;if(_0x2f0fcd[_0xf0ab('0x32')][_0xf0ab('0x43')]){_0x199753[_0xf0ab('0x44')]=[{'all':!![]}];}return db[_0xf0ab('0x42')][_0xf0ab('0x45')](_0x199753);})[_0xf0ab('0x25')](function(_0x45849c){_0x1e1ffb[_0xf0ab('0x46')]=_0x45849c;return _0x1e1ffb;})[_0xf0ab('0x25')](respondWithFilteredResult(_0x21e8ac,_0x199753))[_0xf0ab('0x47')](handleError(_0x21e8ac,null));};exports[_0xf0ab('0x48')]=function(_0x32ec93,_0x22a265){var _0x5e6b6b={'raw':!![],'where':{'id':_0x32ec93[_0xf0ab('0x49')]['id']}},_0x4c4ab9={};_0x4c4ab9['model']=_[_0xf0ab('0x31')](db[_0xf0ab('0x42')]['rawAttributes']);_0x4c4ab9[_0xf0ab('0x32')]=_[_0xf0ab('0x31')](_0x32ec93['query']);_0x4c4ab9[_0xf0ab('0x3a')]=_[_0xf0ab('0x34')](_0x4c4ab9[_0xf0ab('0x30')],_0x4c4ab9[_0xf0ab('0x32')]);_0x5e6b6b[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x4c4ab9[_0xf0ab('0x30')],qs[_0xf0ab('0x35')](_0x32ec93[_0xf0ab('0x32')][_0xf0ab('0x35')]));_0x5e6b6b[_0xf0ab('0x33')]=_0x5e6b6b[_0xf0ab('0x33')][_0xf0ab('0x36')]?_0x5e6b6b[_0xf0ab('0x33')]:_0x4c4ab9['model'];if(_0x32ec93['query'][_0xf0ab('0x43')]){_0x5e6b6b['include']=[{'all':!![]}];}_0x5e6b6b=_['merge']({},_0x5e6b6b,_0x32ec93['options']);return db[_0xf0ab('0x42')][_0xf0ab('0x4a')](_0x5e6b6b)[_0xf0ab('0x25')](handleEntityNotFound(_0x22a265,null))[_0xf0ab('0x25')](respondWithResult(_0x22a265,null))[_0xf0ab('0x47')](handleError(_0x22a265,null));};exports[_0xf0ab('0x4b')]=function(_0x472c1b,_0x1a0f21){return db[_0xf0ab('0x42')][_0xf0ab('0x4b')](_0x472c1b[_0xf0ab('0x4c')],{})[_0xf0ab('0x25')](function(_0x4e6c9b){var _0x393c9a=_0x472c1b[_0xf0ab('0x4d')][_0xf0ab('0x26')]({'plain':!![]});if(!_0x393c9a)throw new Error(_0xf0ab('0x4e'));if(_0x393c9a[_0xf0ab('0x4f')]===_0xf0ab('0x4d')){var _0x430921=_0x4e6c9b[_0xf0ab('0x26')]({'plain':!![]});var _0x47f564='Voicemails';return db['UserProfileSection'][_0xf0ab('0x4a')]({'where':{'name':_0x47f564,'userProfileId':_0x393c9a[_0xf0ab('0x50')]},'raw':!![]})['then'](function(_0xa1a416){if(_0xa1a416&&_0xa1a416[_0xf0ab('0x51')]===0x0){return db['UserProfileResource'][_0xf0ab('0x4b')]({'name':_0x430921[_0xf0ab('0x2b')],'resourceId':_0x430921['id'],'type':_0xa1a416[_0xf0ab('0x2b')],'sectionId':_0xa1a416['id']},{})[_0xf0ab('0x25')](function(){return _0x4e6c9b;});}else{return _0x4e6c9b;}})[_0xf0ab('0x47')](function(_0x33112b){logger[_0xf0ab('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33112b);throw _0x33112b;});}return _0x4e6c9b;})[_0xf0ab('0x25')](respondWithResult(_0x1a0f21,0xc9))['catch'](handleError(_0x1a0f21,null));};exports[_0xf0ab('0x24')]=function(_0x4c9d2b,_0x1a402b){if(_0x4c9d2b['body']['id']){delete _0x4c9d2b['body']['id'];}return db[_0xf0ab('0x42')]['find']({'where':{'id':_0x4c9d2b[_0xf0ab('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a402b,null))[_0xf0ab('0x25')](saveUpdates(_0x4c9d2b['body'],null))[_0xf0ab('0x25')](respondWithResult(_0x1a402b,null))[_0xf0ab('0x47')](handleError(_0x1a402b,null));};exports[_0xf0ab('0x52')]=function(_0x57f9dd,_0x47f270){return db['VoiceMail'][_0xf0ab('0x4a')]({'where':{'id':_0x57f9dd[_0xf0ab('0x49')]['id']}})['then'](handleEntityNotFound(_0x47f270,null))['then'](removeEntity(_0x47f270,null))[_0xf0ab('0x47')](handleError(_0x47f270,null));};exports[_0xf0ab('0x53')]=function(_0x8df75a,_0x4ead7d,_0x227597){return db[_0xf0ab('0x42')][_0xf0ab('0x54')]({'where':{'id':_0x8df75a[_0xf0ab('0x49')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x4ead7d,null))[_0xf0ab('0x25')](function(_0x1e6a4e){var _0x4d80a6;var _0x41ed17={},_0x5b24e3={};_0x5b24e3[_0xf0ab('0x30')]=_[_0xf0ab('0x31')](db[_0xf0ab('0x55')][_0xf0ab('0x2e')]);_0x5b24e3[_0xf0ab('0x32')]=_[_0xf0ab('0x31')](_0x8df75a[_0xf0ab('0x32')]);_0x5b24e3[_0xf0ab('0x3a')]=_[_0xf0ab('0x34')](_0x5b24e3[_0xf0ab('0x30')],_0x5b24e3['query']);_0x41ed17[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x5b24e3[_0xf0ab('0x30')],qs[_0xf0ab('0x35')](_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x35')]));_0x41ed17[_0xf0ab('0x33')]=_0x41ed17[_0xf0ab('0x33')][_0xf0ab('0x36')]?_0x41ed17['attributes']:_0x5b24e3['model'];if(!_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x56')](_0xf0ab('0x37'))){_0x41ed17['limit']=qs[_0xf0ab('0x1d')](_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x1d')]);_0x41ed17['offset']=qs[_0xf0ab('0x1b')](_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x1b')]);}_0x41ed17[_0xf0ab('0x57')]=qs[_0xf0ab('0x38')](_0x8df75a['query'][_0xf0ab('0x38')]);_0x41ed17[_0xf0ab('0x39')]=qs[_0xf0ab('0x3a')](_[_0xf0ab('0x3b')](_0x8df75a[_0xf0ab('0x32')],_0x5b24e3[_0xf0ab('0x3a')]));if(_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x3c')]){_0x41ed17[_0xf0ab('0x39')]=_[_0xf0ab('0x40')](_0x41ed17[_0xf0ab('0x39')],{'$or':_[_0xf0ab('0x3d')](_0x41ed17[_0xf0ab('0x33')],function(_0x513ed3){var _0x5c9c0e={};_0x5c9c0e[_0x513ed3]={'$like':'%'+_0x8df75a[_0xf0ab('0x32')][_0xf0ab('0x3c')]+'%'};return _0x5c9c0e;})});}_0x41ed17[_0xf0ab('0x39')]=_['merge'](_0x41ed17[_0xf0ab('0x39')],{'mailboxuser':_0x1e6a4e['mailbox']});_0x41ed17=_[_0xf0ab('0x40')]({},_0x41ed17,_0x8df75a[_0xf0ab('0x41')]);return db[_0xf0ab('0x55')]['findAndCountAll'](_0x41ed17)[_0xf0ab('0x25')](respondWithFilteredResult(_0x4ead7d,_0x41ed17));})['catch'](handleError(_0x4ead7d,null));};
\ No newline at end of file
index 4f6dca9..0bd5fa0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfcc1=['mailbox','lodash','util','../../config/logger','api','request-promise','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x242b98,_0x197e65){var _0x2fc83b=function(_0x28de77){while(--_0x28de77){_0x242b98['push'](_0x242b98['shift']());}};_0x2fc83b(++_0x197e65);}(_0xfcc1,0x15d));var _0x1fcc=function(_0x525370,_0x5abe18){_0x525370=_0x525370-0x0;var _0x4a1ae9=_0xfcc1[_0x525370];return _0x4a1ae9;};'use strict';var _=require(_0x1fcc('0x0'));var util=require(_0x1fcc('0x1'));var logger=require(_0x1fcc('0x2'))(_0x1fcc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1fcc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1fcc('0x5'));var attributes=require('./voiceMail.attributes');module[_0x1fcc('0x6')]=function(_0x47520c,_0x15e271){return _0x47520c[_0x1fcc('0x7')](_0x1fcc('0x8'),attributes,{'tableName':_0x1fcc('0x9'),'paranoid':![],'indexes':[{'name':_0x1fcc('0xa'),'fields':[_0x1fcc('0xb'),'context']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x4b80=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox','context','lodash','../../config/logger','api'];(function(_0x30723a,_0xb6bbc6){var _0x3d17fe=function(_0x22711e){while(--_0x22711e){_0x30723a['push'](_0x30723a['shift']());}};_0x3d17fe(++_0xb6bbc6);}(_0x4b80,0xc0));var _0x04b8=function(_0x3b6834,_0x5d55a0){_0x3b6834=_0x3b6834-0x0;var _0x53f5ac=_0x4b80[_0x3b6834];return _0x53f5ac;};'use strict';var _=require(_0x04b8('0x0'));var util=require('util');var logger=require(_0x04b8('0x1'))(_0x04b8('0x2'));var moment=require('moment');var BPromise=require(_0x04b8('0x3'));var rp=require(_0x04b8('0x4'));var fs=require('fs');var path=require(_0x04b8('0x5'));var rimraf=require(_0x04b8('0x6'));var config=require(_0x04b8('0x7'));var attributes=require(_0x04b8('0x8'));module[_0x04b8('0x9')]=function(_0x88a483,_0x5bafc8){return _0x88a483[_0x04b8('0xa')]('VoiceMail',attributes,{'tableName':_0x04b8('0xb'),'paranoid':![],'indexes':[{'name':_0x04b8('0xc'),'fields':[_0x04b8('0xd'),_0x04b8('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
index 38e23a9..0ec71ff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe796=['../../config/logger','jayson/promise','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe796,0x1da));var _0x6e79=function(_0x2ed8e8,_0x145cca){_0x2ed8e8=_0x2ed8e8-0x0;var _0x82e99a=_0xe796[_0x2ed8e8];return _0x82e99a;};'use strict';var _=require(_0x6e79('0x0'));var util=require('util');var moment=require(_0x6e79('0x1'));var BPromise=require(_0x6e79('0x2'));var rs=require(_0x6e79('0x3'));var fs=require('fs');var Redis=require(_0x6e79('0x4'));var db=require(_0x6e79('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e79('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6e79('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b2d35,_0x22dc75,_0x1892ae){return new BPromise(function(_0x403ef0,_0x3f791c){return client[_0x6e79('0x8')](_0x2b2d35,_0x1892ae)[_0x6e79('0x9')](function(_0x5bbf80){logger['info'](_0x6e79('0xa'),_0x22dc75,_0x6e79('0xb'));logger[_0x6e79('0xc')](_0x6e79('0xd'),_0x22dc75,_0x6e79('0xb'),JSON[_0x6e79('0xe')](_0x5bbf80));if(_0x5bbf80[_0x6e79('0xf')]){if(_0x5bbf80[_0x6e79('0xf')][_0x6e79('0x10')]===0x1f4){logger['error'](_0x6e79('0xa'),_0x22dc75,_0x5bbf80['error']['message']);return _0x3f791c(_0x5bbf80[_0x6e79('0xf')][_0x6e79('0x11')]);}logger['error'](_0x6e79('0xa'),_0x22dc75,_0x5bbf80['error'][_0x6e79('0x11')]);return _0x403ef0(_0x5bbf80[_0x6e79('0xf')][_0x6e79('0x11')]);}else{logger[_0x6e79('0x12')]('VoiceMail,\x20%s,\x20%s',_0x22dc75,_0x6e79('0xb'));_0x403ef0(_0x5bbf80[_0x6e79('0x13')][_0x6e79('0x11')]);}})['catch'](function(_0x1927a1){logger['error']('VoiceMail,\x20%s,\x20%s',_0x22dc75,_0x1927a1);_0x3f791c(_0x1927a1);});});}
\ No newline at end of file
+var _0xfc36=['info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x3fca3a,_0x27f108){var _0x352a6a=function(_0x41a8ff){while(--_0x41a8ff){_0x3fca3a['push'](_0x3fca3a['shift']());}};_0x352a6a(++_0x27f108);}(_0xfc36,0x106));var _0x6fc3=function(_0x5ab23b,_0x88f5aa){_0x5ab23b=_0x5ab23b-0x0;var _0x28e18f=_0xfc36[_0x5ab23b];return _0x28e18f;};'use strict';var _=require(_0x6fc3('0x0'));var util=require(_0x6fc3('0x1'));var moment=require(_0x6fc3('0x2'));var BPromise=require(_0x6fc3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6fc3('0x4'));var db=require(_0x6fc3('0x5'))['db'];var utils=require(_0x6fc3('0x6'));var logger=require(_0x6fc3('0x7'))(_0x6fc3('0x8'));var config=require('../../config/environment');var jayson=require(_0x6fc3('0x9'));var client=jayson[_0x6fc3('0xa')][_0x6fc3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x392575,_0x5dc4db,_0x1d68a0){return new BPromise(function(_0x2ead6a,_0x534acb){return client[_0x6fc3('0xc')](_0x392575,_0x1d68a0)[_0x6fc3('0xd')](function(_0x32a07c){logger[_0x6fc3('0xe')](_0x6fc3('0xf'),_0x5dc4db,_0x6fc3('0x10'));logger[_0x6fc3('0x11')](_0x6fc3('0x12'),_0x5dc4db,_0x6fc3('0x10'),JSON[_0x6fc3('0x13')](_0x32a07c));if(_0x32a07c[_0x6fc3('0x14')]){if(_0x32a07c[_0x6fc3('0x14')][_0x6fc3('0x15')]===0x1f4){logger[_0x6fc3('0x14')](_0x6fc3('0xf'),_0x5dc4db,_0x32a07c[_0x6fc3('0x14')][_0x6fc3('0x16')]);return _0x534acb(_0x32a07c[_0x6fc3('0x14')][_0x6fc3('0x16')]);}logger[_0x6fc3('0x14')](_0x6fc3('0xf'),_0x5dc4db,_0x32a07c['error'][_0x6fc3('0x16')]);return _0x2ead6a(_0x32a07c[_0x6fc3('0x14')][_0x6fc3('0x16')]);}else{logger['info'](_0x6fc3('0xf'),_0x5dc4db,'request\x20sent');_0x2ead6a(_0x32a07c['result']['message']);}})['catch'](function(_0xbeaf95){logger['error'](_0x6fc3('0xf'),_0x5dc4db,_0xbeaf95);_0x534acb(_0xbeaf95);});});}
\ No newline at end of file
index 90b084a..73a674c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeee5=['get','/:id','isAuthenticated','show','/:id/download','create','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index'];(function(_0x2caf55,_0xb80b11){var _0xfbaf=function(_0xf58737){while(--_0xf58737){_0x2caf55['push'](_0x2caf55['shift']());}};_0xfbaf(++_0xb80b11);}(_0xeee5,0xa3));var _0x5eee=function(_0x3c4e69,_0x591a82){_0x3c4e69=_0x3c4e69-0x0;var _0x4a6839=_0xeee5[_0x3c4e69];return _0x4a6839;};'use strict';var multer=require('multer');var util=require(_0x5eee('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5eee('0x1'));var router=express[_0x5eee('0x2')]();var fs_extra=require(_0x5eee('0x3'));var auth=require(_0x5eee('0x4'));var interaction=require(_0x5eee('0x5'));var config=require(_0x5eee('0x6'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5eee('0x7')]);router[_0x5eee('0x8')](_0x5eee('0x9'),auth[_0x5eee('0xa')](),controller[_0x5eee('0xb')]);router['get'](_0x5eee('0xc'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x5eee('0xa')](),controller[_0x5eee('0xd')]);router[_0x5eee('0xe')](_0x5eee('0x9'),auth[_0x5eee('0xa')](),controller[_0x5eee('0xf')]);router[_0x5eee('0x10')]('/:id',auth[_0x5eee('0xa')](),controller[_0x5eee('0x11')]);module[_0x5eee('0x12')]=router;
\ No newline at end of file
+var _0x07d9=['../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x34f273,_0x37a8c3){var _0x1f2544=function(_0x1b9a6b){while(--_0x1b9a6b){_0x34f273['push'](_0x34f273['shift']());}};_0x1f2544(++_0x37a8c3);}(_0x07d9,0xcb));var _0x907d=function(_0x1d6140,_0x1642a9){_0x1d6140=_0x1d6140-0x0;var _0x64119c=_0x07d9[_0x1d6140];return _0x64119c;};'use strict';var multer=require(_0x907d('0x0'));var util=require(_0x907d('0x1'));var path=require('path');var timeout=require(_0x907d('0x2'));var express=require(_0x907d('0x3'));var router=express[_0x907d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x907d('0x5'));var interaction=require(_0x907d('0x6'));var config=require(_0x907d('0x7'));var controller=require(_0x907d('0x8'));router[_0x907d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x907d('0x9')]('/:id',auth[_0x907d('0xa')](),controller['show']);router[_0x907d('0x9')](_0x907d('0xb'),auth[_0x907d('0xa')](),controller[_0x907d('0xc')]);router[_0x907d('0xd')]('/',auth[_0x907d('0xa')](),controller[_0x907d('0xe')]);router[_0x907d('0xf')](_0x907d('0x10'),auth[_0x907d('0xa')](),controller[_0x907d('0x11')]);router[_0x907d('0x12')](_0x907d('0x10'),auth[_0x907d('0xa')](),controller[_0x907d('0x13')]);module[_0x907d('0x14')]=router;
\ No newline at end of file
index 22ea9ea..d1c9533 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9df3=['VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x535522,_0x1188db){var _0x61e7d9=function(_0x3a88ff){while(--_0x3a88ff){_0x535522['push'](_0x535522['shift']());}};_0x61e7d9(++_0x1188db);}(_0x9df3,0x8d));var _0x39df=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x9df3[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x39df('0x0'));module[_0x39df('0x1')]={'name':{'type':Sequelize[_0x39df('0x2')],'get':function(_0x5bc83a){return this[_0x39df('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x39df('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x39df('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x39df('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x39df('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x39df('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x39df('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x39df('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x39df('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x39df('0x6')](_0x39df('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x39df('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x39df('0x5')],'defaultValue':''},'stamp':{'type':_0x39df('0x8'),'defaultValue':Sequelize[_0x39df('0x9')](_0x39df('0xa'))}};
\ No newline at end of file
+var _0x54d1=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','INTEGER','STRING','BLOB','TIMESTAMP'];(function(_0x24afdc,_0x44f029){var _0xf2b555=function(_0x1cdf4f){while(--_0x1cdf4f){_0x24afdc['push'](_0x24afdc['shift']());}};_0xf2b555(++_0x44f029);}(_0x54d1,0x17c));var _0x154d=function(_0x2f4129,_0x27598){_0x2f4129=_0x2f4129-0x0;var _0x1f3a0f=_0x54d1[_0x2f4129];return _0x1f3a0f;};'use strict';var Sequelize=require(_0x154d('0x0'));module[_0x154d('0x1')]={'name':{'type':Sequelize[_0x154d('0x2')],'get':function(_0x55ea3c){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x154d('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x154d('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x154d('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x154d('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x154d('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x154d('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x154d('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x154d('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x154d('0x6'),'defaultValue':Sequelize[_0x154d('0x7')](_0x154d('0x8'))}};
\ No newline at end of file
index cf298bc..0c5e8bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdc84=['../../config/utils','../../mysqldb','json','offset','limit','count','status','set','Content-Range','apply','reject','update','then','end','sendStatus','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','destroy','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x55e454,_0x83b6b0){var _0x1de62b=function(_0xdb561c){while(--_0xdb561c){_0x55e454['push'](_0x55e454['shift']());}};_0x1de62b(++_0x83b6b0);}(_0xdc84,0x90));var _0x4dc8=function(_0x9faff7,_0x59a564){_0x9faff7=_0x9faff7-0x0;var _0x4f8043=_0xdc84[_0x9faff7];return _0x4f8043;};'use strict';var emlformat=require(_0x4dc8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4dc8('0x1'));var jsonpatch=require(_0x4dc8('0x2'));var rp=require(_0x4dc8('0x3'));var moment=require('moment');var BPromise=require(_0x4dc8('0x4'));var Mustache=require('mustache');var util=require(_0x4dc8('0x5'));var path=require('path');var sox=require(_0x4dc8('0x6'));var csv=require('to-csv');var ejs=require(_0x4dc8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4dc8('0x8'));var squel=require(_0x4dc8('0x9'));var crypto=require(_0x4dc8('0xa'));var jsforce=require(_0x4dc8('0xb'));var deskjs=require(_0x4dc8('0xc'));var toCsv=require(_0x4dc8('0xd'));var querystring=require('querystring');var Papa=require(_0x4dc8('0xe'));var Redis=require('ioredis');var authService=require(_0x4dc8('0xf'));var qs=require(_0x4dc8('0x10'));var as=require(_0x4dc8('0x11'));var hardwareService=require(_0x4dc8('0x12'));var logger=require(_0x4dc8('0x13'))('api');var utils=require(_0x4dc8('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4dc8('0x15'))['db'];function respondWithStatusCode(_0x5dd739,_0x58b822){_0x58b822=_0x58b822||0xcc;return function(_0x4529cc){if(_0x4529cc){return _0x5dd739['sendStatus'](_0x58b822);}return _0x5dd739['status'](_0x58b822)['end']();};}function respondWithResult(_0x56133a,_0x4030bb){_0x4030bb=_0x4030bb||0xc8;return function(_0x27555c){if(_0x27555c){return _0x56133a['status'](_0x4030bb)[_0x4dc8('0x16')](_0x27555c);}};}function respondWithFilteredResult(_0x59c6a9,_0x5e7c07){return function(_0x25b99d){if(_0x25b99d){var _0x1c6383=typeof _0x5e7c07[_0x4dc8('0x17')]==='undefined'&&typeof _0x5e7c07[_0x4dc8('0x18')]==='undefined';var _0x3190d9=_0x25b99d['count'];var _0x42152f=_0x1c6383?0x0:_0x5e7c07[_0x4dc8('0x17')];var _0x5170c6=_0x1c6383?_0x25b99d[_0x4dc8('0x19')]:_0x5e7c07['offset']+_0x5e7c07['limit'];var _0x3fc733;if(_0x5170c6>=_0x3190d9){_0x5170c6=_0x3190d9;_0x3fc733=0xc8;}else{_0x3fc733=0xce;}_0x59c6a9[_0x4dc8('0x1a')](_0x3fc733);return _0x59c6a9[_0x4dc8('0x1b')](_0x4dc8('0x1c'),_0x42152f+'-'+_0x5170c6+'/'+_0x3190d9)['json'](_0x25b99d);}return null;};}function patchUpdates(_0x3ed5c6){return function(_0xbd85da){try{jsonpatch[_0x4dc8('0x1d')](_0xbd85da,_0x3ed5c6,!![]);}catch(_0x582474){return BPromise[_0x4dc8('0x1e')](_0x582474);}return _0xbd85da['save']();};}function saveUpdates(_0x2147b6,_0x32ffe6){return function(_0x32ec45){if(_0x32ec45){return _0x32ec45[_0x4dc8('0x1f')](_0x2147b6)[_0x4dc8('0x20')](function(_0x1059a3){return _0x1059a3;});}return null;};}function removeEntity(_0x4e4f38,_0x2b43c3){return function(_0x292c5f){if(_0x292c5f){return _0x292c5f['destroy']()[_0x4dc8('0x20')](function(){_0x4e4f38[_0x4dc8('0x1a')](0xcc)[_0x4dc8('0x21')]();});}};}function handleEntityNotFound(_0x375761,_0x20bf09){return function(_0x319db2){if(!_0x319db2){_0x375761[_0x4dc8('0x22')](0x194);}return _0x319db2;};}function handleError(_0x26d597,_0x1c6a97){_0x1c6a97=_0x1c6a97||0x1f4;return function(_0xc3ba37){logger['error'](_0xc3ba37['stack']);if(_0xc3ba37['name']){delete _0xc3ba37['name'];}_0x26d597[_0x4dc8('0x1a')](_0x1c6a97)['send'](_0xc3ba37);};}exports['index']=function(_0x19e321,_0x57d7f0){var _0x1dd799={},_0x67f9d0={},_0x13a2b3={'count':0x0,'rows':[]};var _0x3b9e31=_[_0x4dc8('0x23')](db[_0x4dc8('0x24')][_0x4dc8('0x25')],function(_0xc95107){return{'name':_0xc95107[_0x4dc8('0x26')],'type':_0xc95107[_0x4dc8('0x27')][_0x4dc8('0x28')]};});_0x67f9d0[_0x4dc8('0x29')]=_[_0x4dc8('0x2a')](_['map'](_0x3b9e31,_0x4dc8('0x2b')),[_0x4dc8('0x2b')]);_0x67f9d0[_0x4dc8('0x2c')]=_['keys'](_0x19e321[_0x4dc8('0x2c')]);_0x67f9d0[_0x4dc8('0x2d')]=_[_0x4dc8('0x2e')](_0x67f9d0['model'],_0x67f9d0[_0x4dc8('0x2c')]);_0x1dd799[_0x4dc8('0x2f')]=_[_0x4dc8('0x2e')](_0x67f9d0[_0x4dc8('0x29')],qs['fields'](_0x19e321[_0x4dc8('0x2c')][_0x4dc8('0x30')]));_0x1dd799[_0x4dc8('0x2f')]=_0x1dd799[_0x4dc8('0x2f')][_0x4dc8('0x31')]?_0x1dd799[_0x4dc8('0x2f')]:_0x67f9d0[_0x4dc8('0x29')];if(!_0x19e321[_0x4dc8('0x2c')][_0x4dc8('0x32')](_0x4dc8('0x33'))){_0x1dd799[_0x4dc8('0x18')]=qs[_0x4dc8('0x18')](_0x19e321[_0x4dc8('0x2c')][_0x4dc8('0x18')]);_0x1dd799['offset']=qs[_0x4dc8('0x17')](_0x19e321['query'][_0x4dc8('0x17')]);}_0x1dd799['order']=qs[_0x4dc8('0x34')](_0x19e321[_0x4dc8('0x2c')][_0x4dc8('0x34')]);_0x1dd799[_0x4dc8('0x35')]=qs[_0x4dc8('0x2d')](_[_0x4dc8('0x36')](_0x19e321[_0x4dc8('0x2c')],_0x67f9d0[_0x4dc8('0x2d')]),_0x3b9e31);if(_0x19e321['query'][_0x4dc8('0x37')]){_0x1dd799['where']=_['merge'](_0x1dd799['where'],{'$or':_[_0x4dc8('0x23')](_0x3b9e31,function(_0x5b0cd2){if(_0x5b0cd2[_0x4dc8('0x27')]!==_0x4dc8('0x38')){var _0x1cba1d={};_0x1cba1d[_0x5b0cd2['name']]={'$like':'%'+_0x19e321[_0x4dc8('0x2c')][_0x4dc8('0x37')]+'%'};return _0x1cba1d;}})});}_0x1dd799=_[_0x4dc8('0x39')]({},_0x1dd799,_0x19e321['options']);var _0xc90c10={'where':_0x1dd799[_0x4dc8('0x35')]};return db[_0x4dc8('0x24')][_0x4dc8('0x19')](_0xc90c10)[_0x4dc8('0x20')](function(_0x511156){_0x13a2b3[_0x4dc8('0x19')]=_0x511156;if(_0x19e321[_0x4dc8('0x2c')][_0x4dc8('0x3a')]){_0x1dd799[_0x4dc8('0x3b')]=[{'all':!![]}];}return db[_0x4dc8('0x24')][_0x4dc8('0x3c')](_0x1dd799);})[_0x4dc8('0x20')](function(_0x15c6ef){_0x13a2b3[_0x4dc8('0x3d')]=_0x15c6ef;return _0x13a2b3;})['then'](respondWithFilteredResult(_0x57d7f0,_0x1dd799))[_0x4dc8('0x3e')](handleError(_0x57d7f0,null));};exports[_0x4dc8('0x3f')]=function(_0x1c64d0,_0x36cedd){var _0x392c6d={'raw':!![],'where':{'id':_0x1c64d0[_0x4dc8('0x40')]['id']}},_0x27a335={};_0x27a335['model']=_['keys'](db[_0x4dc8('0x24')][_0x4dc8('0x25')]);_0x27a335['query']=_[_0x4dc8('0x41')](_0x1c64d0[_0x4dc8('0x2c')]);_0x27a335[_0x4dc8('0x2d')]=_[_0x4dc8('0x2e')](_0x27a335[_0x4dc8('0x29')],_0x27a335[_0x4dc8('0x2c')]);_0x392c6d[_0x4dc8('0x2f')]=_['intersection'](_0x27a335[_0x4dc8('0x29')],qs[_0x4dc8('0x30')](_0x1c64d0[_0x4dc8('0x2c')][_0x4dc8('0x30')]));_0x392c6d[_0x4dc8('0x2f')]=_0x392c6d[_0x4dc8('0x2f')]['length']?_0x392c6d[_0x4dc8('0x2f')]:_0x27a335['model'];if(_0x1c64d0[_0x4dc8('0x2c')][_0x4dc8('0x3a')]){_0x392c6d[_0x4dc8('0x3b')]=[{'all':!![]}];}_0x392c6d=_[_0x4dc8('0x39')]({},_0x392c6d,_0x1c64d0[_0x4dc8('0x42')]);return db[_0x4dc8('0x24')][_0x4dc8('0x43')](_0x392c6d)[_0x4dc8('0x20')](handleEntityNotFound(_0x36cedd,null))[_0x4dc8('0x20')](respondWithResult(_0x36cedd,null))[_0x4dc8('0x3e')](handleError(_0x36cedd,null));};exports[_0x4dc8('0x44')]=function(_0x5cb181,_0x15721e){return db[_0x4dc8('0x24')][_0x4dc8('0x44')](_0x5cb181[_0x4dc8('0x45')],{})[_0x4dc8('0x20')](respondWithResult(_0x15721e,0xc9))[_0x4dc8('0x3e')](handleError(_0x15721e,null));};exports[_0x4dc8('0x1f')]=function(_0x3a0f84,_0x1abd8a){if(_0x3a0f84[_0x4dc8('0x45')]['id']){delete _0x3a0f84[_0x4dc8('0x45')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x3a0f84[_0x4dc8('0x40')]['id']}})[_0x4dc8('0x20')](handleEntityNotFound(_0x1abd8a,null))[_0x4dc8('0x20')](saveUpdates(_0x3a0f84[_0x4dc8('0x45')],null))[_0x4dc8('0x20')](respondWithResult(_0x1abd8a,null))[_0x4dc8('0x3e')](handleError(_0x1abd8a,null));};exports[_0x4dc8('0x46')]=function(_0x1f59e6,_0x301c31){return db[_0x4dc8('0x24')][_0x4dc8('0x43')]({'where':{'id':_0x1f59e6['params']['id']}})[_0x4dc8('0x20')](handleEntityNotFound(_0x301c31,null))[_0x4dc8('0x20')](removeEntity(_0x301c31,null))[_0x4dc8('0x3e')](handleError(_0x301c31,null));};exports[_0x4dc8('0x47')]=function(_0x1dab3c,_0x462a5a,_0x3da0ee){return db[_0x4dc8('0x24')]['find']({'where':{'id':_0x1dab3c[_0x4dc8('0x40')]['id']},'attributes':['id',_0x4dc8('0x48'),_0x4dc8('0x49')]})[_0x4dc8('0x20')](handleEntityNotFound(_0x462a5a,null))['then'](function(_0x1d6561){if(_0x1d6561){if(!_0x1d6561[_0x4dc8('0x48')]){throw new db[(_0x4dc8('0x4a'))][(_0x4dc8('0x4b'))]('VoiceMailMessage\x20not\x20found');}var _0x1bc492={'Content-Type':_0x4dc8('0x4c'),'Content-Disposition':_0x4dc8('0x4d')};if(_0x1d6561['msg_id']){_0x1bc492[_0x4dc8('0x4e')]=_0x4dc8('0x4f')+_0x1d6561[_0x4dc8('0x49')]+_0x4dc8('0x50');}_0x462a5a[_0x4dc8('0x1b')](_0x1bc492);return _0x462a5a[_0x4dc8('0x51')](new Buffer(_0x1d6561['recording']));}})[_0x4dc8('0x3e')](handleError(_0x462a5a,null));};
\ No newline at end of file
+var _0x1c8f=['findAll','rows','catch','show','params','rawAttributes','find','create','update','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','name','send','index','map','VoiceMailMessage','fieldName','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x4b1501,_0x3267b0){var _0x5f4dd4=function(_0x521e37){while(--_0x521e37){_0x4b1501['push'](_0x4b1501['shift']());}};_0x5f4dd4(++_0x3267b0);}(_0x1c8f,0x6b));var _0xf1c8=function(_0x3d4875,_0x58820a){_0x3d4875=_0x3d4875-0x0;var _0x3c9d54=_0x1c8f[_0x3d4875];return _0x3c9d54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf1c8('0x0'));var zipdir=require(_0xf1c8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf1c8('0x2'));var BPromise=require(_0xf1c8('0x3'));var Mustache=require(_0xf1c8('0x4'));var util=require(_0xf1c8('0x5'));var path=require(_0xf1c8('0x6'));var sox=require(_0xf1c8('0x7'));var csv=require(_0xf1c8('0x8'));var ejs=require(_0xf1c8('0x9'));var fs=require('fs');var fs_extra=require(_0xf1c8('0xa'));var _=require(_0xf1c8('0xb'));var squel=require(_0xf1c8('0xc'));var crypto=require(_0xf1c8('0xd'));var jsforce=require(_0xf1c8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf1c8('0x8'));var querystring=require('querystring');var Papa=require(_0xf1c8('0xf'));var Redis=require(_0xf1c8('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf1c8('0x11'));var hardwareService=require(_0xf1c8('0x12'));var logger=require(_0xf1c8('0x13'))(_0xf1c8('0x14'));var utils=require(_0xf1c8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf1c8('0x16'))['db'];function respondWithStatusCode(_0x171f8d,_0x4208bd){_0x4208bd=_0x4208bd||0xcc;return function(_0x48b5c9){if(_0x48b5c9){return _0x171f8d[_0xf1c8('0x17')](_0x4208bd);}return _0x171f8d[_0xf1c8('0x18')](_0x4208bd)[_0xf1c8('0x19')]();};}function respondWithResult(_0x42de48,_0x3cc895){_0x3cc895=_0x3cc895||0xc8;return function(_0x23396e){if(_0x23396e){return _0x42de48[_0xf1c8('0x18')](_0x3cc895)[_0xf1c8('0x1a')](_0x23396e);}};}function respondWithFilteredResult(_0xd3b1c,_0xd14e6d){return function(_0x1c6e89){if(_0x1c6e89){var _0x4f22e9=typeof _0xd14e6d[_0xf1c8('0x1b')]===_0xf1c8('0x1c')&&typeof _0xd14e6d[_0xf1c8('0x1d')]===_0xf1c8('0x1c');var _0x5f22b3=_0x1c6e89[_0xf1c8('0x1e')];var _0x406c5a=_0x4f22e9?0x0:_0xd14e6d['offset'];var _0x3cd517=_0x4f22e9?_0x1c6e89[_0xf1c8('0x1e')]:_0xd14e6d[_0xf1c8('0x1b')]+_0xd14e6d[_0xf1c8('0x1d')];var _0x3c00b8;if(_0x3cd517>=_0x5f22b3){_0x3cd517=_0x5f22b3;_0x3c00b8=0xc8;}else{_0x3c00b8=0xce;}_0xd3b1c[_0xf1c8('0x18')](_0x3c00b8);return _0xd3b1c[_0xf1c8('0x1f')]('Content-Range',_0x406c5a+'-'+_0x3cd517+'/'+_0x5f22b3)['json'](_0x1c6e89);}return null;};}function patchUpdates(_0x28c57c){return function(_0x153ec3){try{jsonpatch[_0xf1c8('0x20')](_0x153ec3,_0x28c57c,!![]);}catch(_0x335598){return BPromise[_0xf1c8('0x21')](_0x335598);}return _0x153ec3[_0xf1c8('0x22')]();};}function saveUpdates(_0x786073,_0x39e965){return function(_0x34bf25){if(_0x34bf25){return _0x34bf25['update'](_0x786073)[_0xf1c8('0x23')](function(_0x3eb645){return _0x3eb645;});}return null;};}function removeEntity(_0x212d7e,_0x163da4){return function(_0x3a7773){if(_0x3a7773){return _0x3a7773[_0xf1c8('0x24')]()['then'](function(){_0x212d7e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x117171,_0x13b8e6){return function(_0x2496f5){if(!_0x2496f5){_0x117171[_0xf1c8('0x17')](0x194);}return _0x2496f5;};}function handleError(_0x1f8070,_0x287b04){_0x287b04=_0x287b04||0x1f4;return function(_0x46c2ad){logger[_0xf1c8('0x25')](_0x46c2ad['stack']);if(_0x46c2ad[_0xf1c8('0x26')]){delete _0x46c2ad[_0xf1c8('0x26')];}_0x1f8070[_0xf1c8('0x18')](_0x287b04)[_0xf1c8('0x27')](_0x46c2ad);};}exports[_0xf1c8('0x28')]=function(_0x5dbeb4,_0x4df1af){var _0x1610a6={},_0x2e4838={},_0x272371={'count':0x0,'rows':[]};var _0x12ab85=_[_0xf1c8('0x29')](db[_0xf1c8('0x2a')]['rawAttributes'],function(_0x2fb3cc){return{'name':_0x2fb3cc[_0xf1c8('0x2b')],'type':_0x2fb3cc['type'][_0xf1c8('0x2c')]};});_0x2e4838[_0xf1c8('0x2d')]=_[_0xf1c8('0x2e')](_['map'](_0x12ab85,_0xf1c8('0x26')),[_0xf1c8('0x26')]);_0x2e4838['query']=_[_0xf1c8('0x2f')](_0x5dbeb4[_0xf1c8('0x30')]);_0x2e4838[_0xf1c8('0x31')]=_[_0xf1c8('0x32')](_0x2e4838[_0xf1c8('0x2d')],_0x2e4838[_0xf1c8('0x30')]);_0x1610a6['attributes']=_[_0xf1c8('0x32')](_0x2e4838[_0xf1c8('0x2d')],qs[_0xf1c8('0x33')](_0x5dbeb4[_0xf1c8('0x30')][_0xf1c8('0x33')]));_0x1610a6[_0xf1c8('0x34')]=_0x1610a6[_0xf1c8('0x34')][_0xf1c8('0x35')]?_0x1610a6[_0xf1c8('0x34')]:_0x2e4838[_0xf1c8('0x2d')];if(!_0x5dbeb4[_0xf1c8('0x30')][_0xf1c8('0x36')](_0xf1c8('0x37'))){_0x1610a6['limit']=qs[_0xf1c8('0x1d')](_0x5dbeb4[_0xf1c8('0x30')][_0xf1c8('0x1d')]);_0x1610a6[_0xf1c8('0x1b')]=qs[_0xf1c8('0x1b')](_0x5dbeb4[_0xf1c8('0x30')]['offset']);}_0x1610a6[_0xf1c8('0x38')]=qs[_0xf1c8('0x39')](_0x5dbeb4[_0xf1c8('0x30')][_0xf1c8('0x39')]);_0x1610a6[_0xf1c8('0x3a')]=qs[_0xf1c8('0x31')](_[_0xf1c8('0x3b')](_0x5dbeb4[_0xf1c8('0x30')],_0x2e4838['filters']),_0x12ab85);if(_0x5dbeb4['query'][_0xf1c8('0x3c')]){_0x1610a6[_0xf1c8('0x3a')]=_[_0xf1c8('0x3d')](_0x1610a6['where'],{'$or':_[_0xf1c8('0x29')](_0x12ab85,function(_0x372e3b){if(_0x372e3b[_0xf1c8('0x3e')]!==_0xf1c8('0x3f')){var _0x4179e0={};_0x4179e0[_0x372e3b[_0xf1c8('0x26')]]={'$like':'%'+_0x5dbeb4[_0xf1c8('0x30')]['filter']+'%'};return _0x4179e0;}})});}_0x1610a6=_[_0xf1c8('0x3d')]({},_0x1610a6,_0x5dbeb4[_0xf1c8('0x40')]);var _0x49eb80={'where':_0x1610a6[_0xf1c8('0x3a')]};return db[_0xf1c8('0x2a')][_0xf1c8('0x1e')](_0x49eb80)[_0xf1c8('0x23')](function(_0x4870bd){_0x272371[_0xf1c8('0x1e')]=_0x4870bd;if(_0x5dbeb4[_0xf1c8('0x30')][_0xf1c8('0x41')]){_0x1610a6[_0xf1c8('0x42')]=[{'all':!![]}];}return db[_0xf1c8('0x2a')][_0xf1c8('0x43')](_0x1610a6);})[_0xf1c8('0x23')](function(_0x5bb5ac){_0x272371[_0xf1c8('0x44')]=_0x5bb5ac;return _0x272371;})['then'](respondWithFilteredResult(_0x4df1af,_0x1610a6))[_0xf1c8('0x45')](handleError(_0x4df1af,null));};exports[_0xf1c8('0x46')]=function(_0x24a15c,_0x39c3e0){var _0x509418={'raw':!![],'where':{'id':_0x24a15c[_0xf1c8('0x47')]['id']}},_0x1f7728={};_0x1f7728[_0xf1c8('0x2d')]=_[_0xf1c8('0x2f')](db[_0xf1c8('0x2a')][_0xf1c8('0x48')]);_0x1f7728[_0xf1c8('0x30')]=_[_0xf1c8('0x2f')](_0x24a15c[_0xf1c8('0x30')]);_0x1f7728['filters']=_[_0xf1c8('0x32')](_0x1f7728[_0xf1c8('0x2d')],_0x1f7728[_0xf1c8('0x30')]);_0x509418[_0xf1c8('0x34')]=_[_0xf1c8('0x32')](_0x1f7728[_0xf1c8('0x2d')],qs[_0xf1c8('0x33')](_0x24a15c[_0xf1c8('0x30')][_0xf1c8('0x33')]));_0x509418['attributes']=_0x509418['attributes'][_0xf1c8('0x35')]?_0x509418[_0xf1c8('0x34')]:_0x1f7728[_0xf1c8('0x2d')];if(_0x24a15c['query'][_0xf1c8('0x41')]){_0x509418[_0xf1c8('0x42')]=[{'all':!![]}];}_0x509418=_[_0xf1c8('0x3d')]({},_0x509418,_0x24a15c[_0xf1c8('0x40')]);return db[_0xf1c8('0x2a')][_0xf1c8('0x49')](_0x509418)[_0xf1c8('0x23')](handleEntityNotFound(_0x39c3e0,null))[_0xf1c8('0x23')](respondWithResult(_0x39c3e0,null))[_0xf1c8('0x45')](handleError(_0x39c3e0,null));};exports[_0xf1c8('0x4a')]=function(_0x427d5e,_0x5f4f92){return db['VoiceMailMessage'][_0xf1c8('0x4a')](_0x427d5e['body'],{})[_0xf1c8('0x23')](respondWithResult(_0x5f4f92,0xc9))[_0xf1c8('0x45')](handleError(_0x5f4f92,null));};exports[_0xf1c8('0x4b')]=function(_0x127eb6,_0x179742){if(_0x127eb6[_0xf1c8('0x4c')]['id']){delete _0x127eb6[_0xf1c8('0x4c')]['id'];}return db[_0xf1c8('0x2a')][_0xf1c8('0x49')]({'where':{'id':_0x127eb6['params']['id']}})[_0xf1c8('0x23')](handleEntityNotFound(_0x179742,null))[_0xf1c8('0x23')](saveUpdates(_0x127eb6[_0xf1c8('0x4c')],null))[_0xf1c8('0x23')](respondWithResult(_0x179742,null))[_0xf1c8('0x45')](handleError(_0x179742,null));};exports[_0xf1c8('0x24')]=function(_0x1eadc4,_0x12a3d6){return db[_0xf1c8('0x2a')][_0xf1c8('0x49')]({'where':{'id':_0x1eadc4[_0xf1c8('0x47')]['id']}})[_0xf1c8('0x23')](handleEntityNotFound(_0x12a3d6,null))[_0xf1c8('0x23')](removeEntity(_0x12a3d6,null))['catch'](handleError(_0x12a3d6,null));};exports[_0xf1c8('0x4d')]=function(_0x204838,_0x409287,_0x48cf9d){return db[_0xf1c8('0x2a')][_0xf1c8('0x49')]({'where':{'id':_0x204838[_0xf1c8('0x47')]['id']},'attributes':['id',_0xf1c8('0x4e'),_0xf1c8('0x4f')]})['then'](handleEntityNotFound(_0x409287,null))[_0xf1c8('0x23')](function(_0x14b489){if(_0x14b489){if(!_0x14b489[_0xf1c8('0x4e')]){throw new db[(_0xf1c8('0x50'))]['ValidationError'](_0xf1c8('0x51'));}var _0x4b353a={'Content-Type':_0xf1c8('0x52'),'Content-Disposition':_0xf1c8('0x53')};if(_0x14b489[_0xf1c8('0x4f')]){_0x4b353a[_0xf1c8('0x54')]=_0xf1c8('0x55')+_0x14b489[_0xf1c8('0x4f')]+_0xf1c8('0x56');}_0x409287[_0xf1c8('0x1f')](_0x4b353a);return _0x409287[_0xf1c8('0x27')](new Buffer(_0x14b489[_0xf1c8('0x4e')]));}})['catch'](handleError(_0x409287,null));};
\ No newline at end of file
index b54f40f..a8895c8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5b15=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api'];(function(_0x5eae5a,_0x2e0273){var _0x4d5b97=function(_0x4ca4e9){while(--_0x4ca4e9){_0x5eae5a['push'](_0x5eae5a['shift']());}};_0x4d5b97(++_0x2e0273);}(_0x5b15,0x10b));var _0x55b1=function(_0x224362,_0x2c5341){_0x224362=_0x224362-0x0;var _0x11e1a8=_0x5b15[_0x224362];return _0x11e1a8;};'use strict';var _=require(_0x55b1('0x0'));var util=require('util');var logger=require(_0x55b1('0x1'))(_0x55b1('0x2'));var moment=require(_0x55b1('0x3'));var BPromise=require(_0x55b1('0x4'));var rp=require(_0x55b1('0x5'));var fs=require('fs');var path=require(_0x55b1('0x6'));var rimraf=require(_0x55b1('0x7'));var config=require(_0x55b1('0x8'));var attributes=require(_0x55b1('0x9'));module[_0x55b1('0xa')]=function(_0x6ed725,_0x5d2013){return _0x6ed725[_0x55b1('0xb')](_0x55b1('0xc'),attributes,{'tableName':_0x55b1('0xd'),'paranoid':![],'indexes':[{'name':_0x55b1('0xe'),'fields':[_0x55b1('0xe')]}],'timestamps':![]});};
\ No newline at end of file
+var _0x595e=['request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x56b03c,_0x1c09e2){var _0x171cd4=function(_0x353a1c){while(--_0x353a1c){_0x56b03c['push'](_0x56b03c['shift']());}};_0x171cd4(++_0x1c09e2);}(_0x595e,0xaa));var _0xe595=function(_0x409eb7,_0x32a0b6){_0x409eb7=_0x409eb7-0x0;var _0x3d9d2d=_0x595e[_0x409eb7];return _0x3d9d2d;};'use strict';var _=require(_0xe595('0x0'));var util=require(_0xe595('0x1'));var logger=require(_0xe595('0x2'))(_0xe595('0x3'));var moment=require(_0xe595('0x4'));var BPromise=require(_0xe595('0x5'));var rp=require(_0xe595('0x6'));var fs=require('fs');var path=require(_0xe595('0x7'));var rimraf=require(_0xe595('0x8'));var config=require(_0xe595('0x9'));var attributes=require(_0xe595('0xa'));module[_0xe595('0xb')]=function(_0x17143e,_0x5e65d9){return _0x17143e[_0xe595('0xc')](_0xe595('0xd'),attributes,{'tableName':_0xe595('0xe'),'paranoid':![],'indexes':[{'name':_0xe595('0xf'),'fields':['dir']}],'timestamps':![]});};
\ No newline at end of file
index ff6ea6d..d38f681 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe1d3=['info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','request','then'];(function(_0x3f288d,_0x3c7a97){var _0x5e8468=function(_0xb0189c){while(--_0xb0189c){_0x3f288d['push'](_0x3f288d['shift']());}};_0x5e8468(++_0x3c7a97);}(_0xe1d3,0xd2));var _0x3e1d=function(_0x48a714,_0x39717f){_0x48a714=_0x48a714-0x0;var _0x3bec51=_0xe1d3[_0x48a714];return _0x3bec51;};'use strict';var _=require(_0x3e1d('0x0'));var util=require(_0x3e1d('0x1'));var moment=require(_0x3e1d('0x2'));var BPromise=require('bluebird');var rs=require(_0x3e1d('0x3'));var fs=require('fs');var Redis=require(_0x3e1d('0x4'));var db=require(_0x3e1d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3e1d('0x6'));var jayson=require(_0x3e1d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x55f8f2,_0x48cc06,_0x38d364){return new BPromise(function(_0x52b3e8,_0x3957e5){return client[_0x3e1d('0x8')](_0x55f8f2,_0x38d364)[_0x3e1d('0x9')](function(_0x2787d6){logger[_0x3e1d('0xa')](_0x3e1d('0xb'),_0x48cc06,_0x3e1d('0xc'));logger[_0x3e1d('0xd')](_0x3e1d('0xe'),_0x48cc06,_0x3e1d('0xc'),JSON[_0x3e1d('0xf')](_0x2787d6));if(_0x2787d6[_0x3e1d('0x10')]){if(_0x2787d6[_0x3e1d('0x10')][_0x3e1d('0x11')]===0x1f4){logger['error'](_0x3e1d('0xb'),_0x48cc06,_0x2787d6[_0x3e1d('0x10')][_0x3e1d('0x12')]);return _0x3957e5(_0x2787d6[_0x3e1d('0x10')]['message']);}logger['error'](_0x3e1d('0xb'),_0x48cc06,_0x2787d6[_0x3e1d('0x10')][_0x3e1d('0x12')]);return _0x52b3e8(_0x2787d6[_0x3e1d('0x10')][_0x3e1d('0x12')]);}else{logger[_0x3e1d('0xa')](_0x3e1d('0xb'),_0x48cc06,_0x3e1d('0xc'));_0x52b3e8(_0x2787d6[_0x3e1d('0x13')][_0x3e1d('0x12')]);}})['catch'](function(_0x584d1c){logger[_0x3e1d('0x10')](_0x3e1d('0xb'),_0x48cc06,_0x584d1c);_0x3957e5(_0x584d1c);});});}
\ No newline at end of file
+var _0xe785=['debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x395280,_0x5ac453){var _0x30f10c=function(_0x51d324){while(--_0x51d324){_0x395280['push'](_0x395280['shift']());}};_0x30f10c(++_0x5ac453);}(_0xe785,0x11a));var _0x5e78=function(_0x5c24a0,_0x88cf57){_0x5c24a0=_0x5c24a0-0x0;var _0x1e2eed=_0xe785[_0x5c24a0];return _0x1e2eed;};'use strict';var _=require(_0x5e78('0x0'));var util=require(_0x5e78('0x1'));var moment=require(_0x5e78('0x2'));var BPromise=require(_0x5e78('0x3'));var rs=require(_0x5e78('0x4'));var fs=require('fs');var Redis=require(_0x5e78('0x5'));var db=require(_0x5e78('0x6'))['db'];var utils=require(_0x5e78('0x7'));var logger=require(_0x5e78('0x8'))(_0x5e78('0x9'));var config=require(_0x5e78('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5e78('0xb')][_0x5e78('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x520024,_0x566d94,_0x1eed29){return new BPromise(function(_0x42df72,_0x5bfd7f){return client[_0x5e78('0xd')](_0x520024,_0x1eed29)['then'](function(_0x5d7aa6){logger[_0x5e78('0xe')](_0x5e78('0xf'),_0x566d94,_0x5e78('0x10'));logger[_0x5e78('0x11')](_0x5e78('0x12'),_0x566d94,_0x5e78('0x10'),JSON['stringify'](_0x5d7aa6));if(_0x5d7aa6['error']){if(_0x5d7aa6[_0x5e78('0x13')][_0x5e78('0x14')]===0x1f4){logger[_0x5e78('0x13')](_0x5e78('0xf'),_0x566d94,_0x5d7aa6[_0x5e78('0x13')]['message']);return _0x5bfd7f(_0x5d7aa6[_0x5e78('0x13')][_0x5e78('0x15')]);}logger[_0x5e78('0x13')](_0x5e78('0xf'),_0x566d94,_0x5d7aa6[_0x5e78('0x13')][_0x5e78('0x15')]);return _0x42df72(_0x5d7aa6[_0x5e78('0x13')][_0x5e78('0x15')]);}else{logger[_0x5e78('0xe')](_0x5e78('0xf'),_0x566d94,'request\x20sent');_0x42df72(_0x5d7aa6[_0x5e78('0x16')][_0x5e78('0x15')]);}})['catch'](function(_0x2d64f4){logger[_0x5e78('0x13')](_0x5e78('0xf'),_0x566d94,_0x2d64f4);_0x5bfd7f(_0x2d64f4);});});}
\ No newline at end of file
index 1bf9827..efb21ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1e53=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1ef406,_0x2b5eb2){var _0x1f0173=function(_0x2df073){while(--_0x2df073){_0x1ef406['push'](_0x1ef406['shift']());}};_0x1f0173(++_0x2b5eb2);}(_0x1e53,0xa8));var _0x31e5=function(_0x793c45,_0x22a198){_0x793c45=_0x793c45-0x0;var _0x379aa7=_0x1e53[_0x793c45];return _0x379aa7;};'use strict';var multer=require(_0x31e5('0x0'));var util=require(_0x31e5('0x1'));var path=require('path');var timeout=require(_0x31e5('0x2'));var express=require(_0x31e5('0x3'));var router=express['Router']();var fs_extra=require(_0x31e5('0x4'));var auth=require(_0x31e5('0x5'));var interaction=require(_0x31e5('0x6'));var config=require(_0x31e5('0x7'));var controller=require(_0x31e5('0x8'));router[_0x31e5('0x9')]('/',auth[_0x31e5('0xa')](),controller[_0x31e5('0xb')]);router[_0x31e5('0x9')](_0x31e5('0xc'),auth[_0x31e5('0xa')](),controller[_0x31e5('0xd')]);router[_0x31e5('0x9')](_0x31e5('0xe'),auth[_0x31e5('0xa')](),controller[_0x31e5('0xf')]);router[_0x31e5('0x10')]('/',auth[_0x31e5('0xa')](),controller[_0x31e5('0x11')]);router['post'](_0x31e5('0xe'),auth[_0x31e5('0xa')](),controller[_0x31e5('0x12')]);router[_0x31e5('0x13')]('/:id',auth[_0x31e5('0xa')](),controller[_0x31e5('0x14')]);router[_0x31e5('0x15')](_0x31e5('0xc'),auth[_0x31e5('0xa')](),controller[_0x31e5('0x16')]);router[_0x31e5('0x15')](_0x31e5('0x17'),auth[_0x31e5('0xa')](),controller['removeSound']);module[_0x31e5('0x18')]=router;
\ No newline at end of file
+var _0x078f=['../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','/:id','show','getSounds','post','create','update','/:id/sounds/:id2','removeSound','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x36c87d,_0x2ab247){var _0x54dc55=function(_0x2b4112){while(--_0x2b4112){_0x36c87d['push'](_0x36c87d['shift']());}};_0x54dc55(++_0x2ab247);}(_0x078f,0x11d));var _0xf078=function(_0xab1c2d,_0x137bb5){_0xab1c2d=_0xab1c2d-0x0;var _0x30704f=_0x078f[_0xab1c2d];return _0x30704f;};'use strict';var multer=require(_0xf078('0x0'));var util=require(_0xf078('0x1'));var path=require(_0xf078('0x2'));var timeout=require(_0xf078('0x3'));var express=require(_0xf078('0x4'));var router=express[_0xf078('0x5')]();var fs_extra=require(_0xf078('0x6'));var auth=require(_0xf078('0x7'));var interaction=require(_0xf078('0x8'));var config=require(_0xf078('0x9'));var controller=require(_0xf078('0xa'));router['get']('/',auth[_0xf078('0xb')](),controller[_0xf078('0xc')]);router['get'](_0xf078('0xd'),auth[_0xf078('0xb')](),controller[_0xf078('0xe')]);router['get']('/:id/sounds',auth[_0xf078('0xb')](),controller[_0xf078('0xf')]);router[_0xf078('0x10')]('/',auth[_0xf078('0xb')](),controller[_0xf078('0x11')]);router['post']('/:id/sounds',auth[_0xf078('0xb')](),controller['addSound']);router['put']('/:id',auth[_0xf078('0xb')](),controller[_0xf078('0x12')]);router['delete'](_0xf078('0xd'),auth[_0xf078('0xb')](),controller['destroy']);router['delete'](_0xf078('0x13'),auth[_0xf078('0xb')](),controller[_0xf078('0x14')]);module['exports']=router;
\ No newline at end of file
index 062cafb..a86eb5c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2902=['files','alpha','BOOLEAN','sequelize','STRING','name','ENUM','custom','quietmp3nb','quietmp3','mp3'];(function(_0x3298b1,_0x1a3aa3){var _0x476594=function(_0x2a9641){while(--_0x2a9641){_0x3298b1['push'](_0x3298b1['shift']());}};_0x476594(++_0x1a3aa3);}(_0x2902,0x137));var _0x2290=function(_0x4cb095,_0x58da07){_0x4cb095=_0x4cb095-0x0;var _0x2b565d=_0x2902[_0x4cb095];return _0x2b565d;};'use strict';var Sequelize=require(_0x2290('0x0'));module['exports']={'name':{'type':Sequelize[_0x2290('0x1')],'allowNull':![],'unique':_0x2290('0x2')},'mode':{'type':Sequelize[_0x2290('0x3')](_0x2290('0x4'),'files','mp3nb',_0x2290('0x5'),_0x2290('0x6'),_0x2290('0x7')),'allowNull':!![],'defaultValue':_0x2290('0x8')},'directory':{'type':Sequelize[_0x2290('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x2290('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x2290('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x2290('0x1')],'allowNull':!![],'defaultValue':_0x2290('0x9')},'format':{'type':Sequelize[_0x2290('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x2290('0xa')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xbdcb=['mp3','alpha','exports','STRING','name','ENUM','files','quietmp3nb','quietmp3'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xbdcb,0x161));var _0xbbdc=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xbdcb[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0xbbdc('0x0')]={'name':{'type':Sequelize[_0xbbdc('0x1')],'allowNull':![],'unique':_0xbbdc('0x2')},'mode':{'type':Sequelize[_0xbbdc('0x3')]('custom',_0xbbdc('0x4'),'mp3nb',_0xbbdc('0x5'),_0xbbdc('0x6'),_0xbbdc('0x7')),'allowNull':!![],'defaultValue':_0xbbdc('0x4')},'directory':{'type':Sequelize[_0xbbdc('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xbbdc('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xbbdc('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xbbdc('0x1')],'allowNull':!![],'defaultValue':_0xbbdc('0x8')},'format':{'type':Sequelize[_0xbbdc('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}};
\ No newline at end of file
index a494f88..c57db86 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa821=['map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','catch','body','find','sequelize','mode','files','directory','join','server/files/moh','create','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','root','server/files/sounds/converted','format','basename','extname','symlinkSync','message','removeSound','id2','createdAt','%s.%s','getSounds','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','name','send','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa821,0x1a4));var _0x1a82=function(_0x3ba5e1,_0x4ac569){_0x3ba5e1=_0x3ba5e1-0x0;var _0xce7650=_0xa821[_0x3ba5e1];return _0xce7650;};'use strict';var emlformat=require(_0x1a82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a82('0x1'));var jsonpatch=require(_0x1a82('0x2'));var rp=require(_0x1a82('0x3'));var moment=require(_0x1a82('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a82('0x5'));var path=require('path');var sox=require(_0x1a82('0x6'));var csv=require(_0x1a82('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a82('0x8'));var _=require(_0x1a82('0x9'));var squel=require(_0x1a82('0xa'));var crypto=require('crypto');var jsforce=require(_0x1a82('0xb'));var deskjs=require(_0x1a82('0xc'));var toCsv=require(_0x1a82('0x7'));var querystring=require(_0x1a82('0xd'));var Papa=require(_0x1a82('0xe'));var Redis=require('ioredis');var authService=require(_0x1a82('0xf'));var qs=require(_0x1a82('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a82('0x11'));var logger=require('../../config/logger')(_0x1a82('0x12'));var utils=require('../../config/utils');var config=require(_0x1a82('0x13'));var licenseUtil=require(_0x1a82('0x14'));var db=require(_0x1a82('0x15'))['db'];function respondWithStatusCode(_0x4a986e,_0x2c641e){_0x2c641e=_0x2c641e||0xcc;return function(_0x1b31f3){if(_0x1b31f3){return _0x4a986e['sendStatus'](_0x2c641e);}return _0x4a986e[_0x1a82('0x16')](_0x2c641e)[_0x1a82('0x17')]();};}function respondWithResult(_0x2fd83f,_0x41db58){_0x41db58=_0x41db58||0xc8;return function(_0x524d34){if(_0x524d34){return _0x2fd83f[_0x1a82('0x16')](_0x41db58)[_0x1a82('0x18')](_0x524d34);}};}function respondWithFilteredResult(_0x494412,_0x49ce6f){return function(_0x36e2b0){if(_0x36e2b0){var _0x2aad19=typeof _0x49ce6f[_0x1a82('0x19')]==='undefined'&&typeof _0x49ce6f[_0x1a82('0x1a')]==='undefined';var _0x1db5d9=_0x36e2b0['count'];var _0x1be92e=_0x2aad19?0x0:_0x49ce6f[_0x1a82('0x19')];var _0x389947=_0x2aad19?_0x36e2b0[_0x1a82('0x1b')]:_0x49ce6f[_0x1a82('0x19')]+_0x49ce6f[_0x1a82('0x1a')];var _0x2e527e;if(_0x389947>=_0x1db5d9){_0x389947=_0x1db5d9;_0x2e527e=0xc8;}else{_0x2e527e=0xce;}_0x494412[_0x1a82('0x16')](_0x2e527e);return _0x494412[_0x1a82('0x1c')](_0x1a82('0x1d'),_0x1be92e+'-'+_0x389947+'/'+_0x1db5d9)[_0x1a82('0x18')](_0x36e2b0);}return null;};}function patchUpdates(_0x6f7445){return function(_0x572ed7){try{jsonpatch[_0x1a82('0x1e')](_0x572ed7,_0x6f7445,!![]);}catch(_0x4aeb49){return BPromise[_0x1a82('0x1f')](_0x4aeb49);}return _0x572ed7[_0x1a82('0x20')]();};}function saveUpdates(_0x4ed910,_0x25b2f2){return function(_0xadad57){if(_0xadad57){return _0xadad57[_0x1a82('0x21')](_0x4ed910)[_0x1a82('0x22')](function(_0x5cb29b){return _0x5cb29b;});}return null;};}function removeEntity(_0x33156f,_0x294acc){return function(_0x5c3a10){if(_0x5c3a10){return _0x5c3a10[_0x1a82('0x23')]()[_0x1a82('0x22')](function(){var _0x537518=_0x5c3a10[_0x1a82('0x24')]({'plain':!![]});var _0x5202fe=_0x1a82('0x25');return db[_0x1a82('0x26')][_0x1a82('0x23')]({'where':{'type':_0x5202fe,'resourceId':_0x537518['id']}})[_0x1a82('0x22')](function(){return _0x5c3a10;});})[_0x1a82('0x22')](function(){_0x33156f[_0x1a82('0x16')](0xcc)[_0x1a82('0x17')]();});}};}function handleEntityNotFound(_0x7e4e0e,_0x40a93f){return function(_0x5a08de){if(!_0x5a08de){_0x7e4e0e[_0x1a82('0x27')](0x194);}return _0x5a08de;};}function handleError(_0x47afaf,_0x13ca7c){_0x13ca7c=_0x13ca7c||0x1f4;return function(_0x25040c){logger[_0x1a82('0x28')](_0x25040c['stack']);if(_0x25040c[_0x1a82('0x29')]){delete _0x25040c[_0x1a82('0x29')];}_0x47afaf[_0x1a82('0x16')](_0x13ca7c)[_0x1a82('0x2a')](_0x25040c);};}exports[_0x1a82('0x2b')]=function(_0x44a2b0,_0xf378fd){var _0x19f616={},_0x3971f4={},_0x209b28={'count':0x0,'rows':[]};var _0xb6c158=_[_0x1a82('0x2c')](db[_0x1a82('0x2d')][_0x1a82('0x2e')],function(_0x7dc40c){return{'name':_0x7dc40c[_0x1a82('0x2f')],'type':_0x7dc40c[_0x1a82('0x30')][_0x1a82('0x31')]};});_0x3971f4[_0x1a82('0x32')]=_['map'](_0xb6c158,_0x1a82('0x29'));_0x3971f4[_0x1a82('0x33')]=_[_0x1a82('0x34')](_0x44a2b0[_0x1a82('0x33')]);_0x3971f4[_0x1a82('0x35')]=_['intersection'](_0x3971f4[_0x1a82('0x32')],_0x3971f4[_0x1a82('0x33')]);_0x19f616[_0x1a82('0x36')]=_['intersection'](_0x3971f4[_0x1a82('0x32')],qs[_0x1a82('0x37')](_0x44a2b0[_0x1a82('0x33')]['fields']));_0x19f616[_0x1a82('0x36')]=_0x19f616[_0x1a82('0x36')][_0x1a82('0x38')]?_0x19f616[_0x1a82('0x36')]:_0x3971f4[_0x1a82('0x32')];if(!_0x44a2b0[_0x1a82('0x33')]['hasOwnProperty'](_0x1a82('0x39'))){_0x19f616[_0x1a82('0x1a')]=qs[_0x1a82('0x1a')](_0x44a2b0[_0x1a82('0x33')][_0x1a82('0x1a')]);_0x19f616[_0x1a82('0x19')]=qs[_0x1a82('0x19')](_0x44a2b0[_0x1a82('0x33')]['offset']);}_0x19f616[_0x1a82('0x3a')]=qs[_0x1a82('0x3b')](_0x44a2b0[_0x1a82('0x33')][_0x1a82('0x3b')]);delete _0x44a2b0['query'][_0x1a82('0x3b')];_0x19f616[_0x1a82('0x3c')]=qs['filters'](_[_0x1a82('0x3d')](_0x44a2b0[_0x1a82('0x33')],_0x3971f4[_0x1a82('0x35')]),_0xb6c158);if(_0x44a2b0[_0x1a82('0x33')][_0x1a82('0x3e')]){_0x19f616['where']=_[_0x1a82('0x3f')](_0x19f616[_0x1a82('0x3c')],{'$or':_[_0x1a82('0x2c')](_0xb6c158,function(_0x42b99f){if(_0x42b99f[_0x1a82('0x30')]!==_0x1a82('0x40')){var _0x574b90={};_0x574b90[_0x42b99f[_0x1a82('0x29')]]={'$like':'%'+_0x44a2b0['query'][_0x1a82('0x3e')]+'%'};return _0x574b90;}})});}_0x19f616=_['merge']({},_0x19f616,_0x44a2b0[_0x1a82('0x41')]);var _0x2a50c7={'where':_0x19f616['where']};return db[_0x1a82('0x2d')][_0x1a82('0x1b')](_0x2a50c7)[_0x1a82('0x22')](function(_0x3c7496){_0x209b28['count']=_0x3c7496;if(_0x44a2b0[_0x1a82('0x33')][_0x1a82('0x42')]){_0x19f616[_0x1a82('0x43')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x1a82('0x44')](_0x19f616);})[_0x1a82('0x22')](function(_0x58a55a){_0x209b28[_0x1a82('0x45')]=_0x58a55a;return _0x209b28;})['then'](respondWithFilteredResult(_0xf378fd,_0x19f616))['catch'](handleError(_0xf378fd,null));};exports[_0x1a82('0x46')]=function(_0x460ab8,_0x5db632){var _0x34474f={'raw':![],'where':{'id':_0x460ab8[_0x1a82('0x47')]['id']}},_0x1862c9={};_0x1862c9[_0x1a82('0x32')]=_['keys'](db['VoiceMusicOnHold'][_0x1a82('0x2e')]);_0x1862c9['query']=_[_0x1a82('0x34')](_0x460ab8[_0x1a82('0x33')]);_0x1862c9[_0x1a82('0x35')]=_[_0x1a82('0x48')](_0x1862c9['model'],_0x1862c9[_0x1a82('0x33')]);_0x34474f[_0x1a82('0x36')]=_[_0x1a82('0x48')](_0x1862c9['model'],qs[_0x1a82('0x37')](_0x460ab8[_0x1a82('0x33')][_0x1a82('0x37')]));_0x34474f[_0x1a82('0x36')]=_0x34474f[_0x1a82('0x36')][_0x1a82('0x38')]?_0x34474f[_0x1a82('0x36')]:_0x1862c9['model'];if(_0x460ab8['query']['includeAll']){_0x34474f['include']=[{'all':!![]}];}_0x34474f=_[_0x1a82('0x3f')]({},_0x34474f,_0x460ab8[_0x1a82('0x41')]);return db[_0x1a82('0x2d')]['find'](_0x34474f)['then'](handleEntityNotFound(_0x5db632,null))[_0x1a82('0x22')](respondWithResult(_0x5db632,null))[_0x1a82('0x49')](handleError(_0x5db632,null));};exports[_0x1a82('0x21')]=function(_0x3b44e0,_0x1a0ebf){if(_0x3b44e0[_0x1a82('0x4a')]['id']){delete _0x3b44e0[_0x1a82('0x4a')]['id'];}return db[_0x1a82('0x2d')][_0x1a82('0x4b')]({'where':{'id':_0x3b44e0['params']['id']}})[_0x1a82('0x22')](handleEntityNotFound(_0x1a0ebf,null))[_0x1a82('0x22')](saveUpdates(_0x3b44e0[_0x1a82('0x4a')],null))['then'](respondWithResult(_0x1a0ebf,null))['catch'](handleError(_0x1a0ebf,null));};exports['create']=function(_0x1d725e,_0x582d3e,_0x1930a1){return db[_0x1a82('0x4c')]['transaction'](function(_0x31f2c6){if(_0x1d725e[_0x1a82('0x4a')][_0x1a82('0x4d')]===_0x1a82('0x4e')){_0x1d725e[_0x1a82('0x4a')][_0x1a82('0x4f')]=path[_0x1a82('0x50')](config['root'],_0x1a82('0x51'),_0x1d725e[_0x1a82('0x4a')]['name']);}return db[_0x1a82('0x2d')][_0x1a82('0x52')](_0x1d725e[_0x1a82('0x4a')],{'transaction':_0x31f2c6})[_0x1a82('0x22')](function(_0x4971bc){if(_0x1d725e[_0x1a82('0x4a')]['mode']==='files'){fs[_0x1a82('0x53')](_0x4971bc['directory'],parseInt('0777',0x8));}var _0x379281=_0x1d725e[_0x1a82('0x54')][_0x1a82('0x24')]({'plain':!![]});if(!_0x379281)throw new Error(_0x1a82('0x55'));if(_0x379281[_0x1a82('0x56')]==='user'){var _0x404594=_0x4971bc['get']({'plain':!![]});return db[_0x1a82('0x57')][_0x1a82('0x4b')]({'where':{'name':_0x1a82('0x25'),'userProfileId':_0x379281[_0x1a82('0x58')]},'raw':!![]})[_0x1a82('0x22')](function(_0x4db22a){if(_0x4db22a&&_0x4db22a[_0x1a82('0x59')]===0x0){return db['UserProfileResource'][_0x1a82('0x52')]({'name':_0x404594['name'],'resourceId':_0x404594['id'],'type':_0x4db22a[_0x1a82('0x29')],'sectionId':_0x4db22a['id']},{})[_0x1a82('0x22')](function(){return _0x4971bc;});}else{return _0x4971bc;}})['catch'](function(_0xa98079){logger[_0x1a82('0x28')](_0x1a82('0x5a'),_0xa98079);});}return _0x4971bc;});})[_0x1a82('0x22')](respondWithResult(_0x582d3e,0xc9))['catch'](handleError(_0x582d3e,null));};exports[_0x1a82('0x23')]=function(_0x2536ec,_0x28f9be,_0x2d5be8){var _0x1ff89a;return db[_0x1a82('0x2d')][_0x1a82('0x4b')]({'where':{'id':_0x2536ec[_0x1a82('0x47')]['id']}})['then'](function(_0x224f1c){if(_0x224f1c){return db['sequelize'][_0x1a82('0x5b')](function(_0x1c0ed2){return _0x224f1c[_0x1a82('0x23')]({'transaction':_0x1c0ed2,'raw':!![]})[_0x1a82('0x22')](function(_0x459e8d){if(_0x459e8d[_0x1a82('0x4f')]){fs[_0x1a82('0x5c')](_0x459e8d[_0x1a82('0x4f')])[_0x1a82('0x5d')](function(_0x45d245){fs[_0x1a82('0x5e')](path[_0x1a82('0x50')](_0x459e8d[_0x1a82('0x4f')],_0x45d245));});fs[_0x1a82('0x5f')](_0x459e8d[_0x1a82('0x4f')]);}return _0x459e8d;});})['catch'](function(_0xedafca){throw new db[(_0x1a82('0x60'))][(_0x1a82('0x61'))](_0xedafca['message']);});}})[_0x1a82('0x22')](handleEntityNotFound(_0x28f9be,null))[_0x1a82('0x22')](removeEntity(_0x28f9be,null))[_0x1a82('0x49')](handleError(_0x28f9be,null));};exports[_0x1a82('0x62')]=function(_0x193560,_0x2a6f72,_0x32ae1b){return db['sequelize']['transaction'](function(_0x574ab5){var _0x17f3db;return db[_0x1a82('0x2d')]['find']({'where':{'id':_0x193560['params']['id']}})[_0x1a82('0x22')](function(_0xfb5536){if(_0xfb5536){_0x17f3db=_0xfb5536;return _0xfb5536['addSound'](_0x193560[_0x1a82('0x4a')]['id'],{'transaction':_0x574ab5});}})['then'](function(_0x143d5d){if(_0x143d5d){return db[_0x1a82('0x63')][_0x1a82('0x64')]({'where':{'id':_0x193560[_0x1a82('0x4a')]['id']},'attributes':['id',_0x1a82('0x29'),_0x1a82('0x65'),_0x1a82('0x66'),'createdAt'],'raw':!![]});}})['then'](function(_0x5202fd){if(_0x5202fd){var _0x118f90=path[_0x1a82('0x50')](config[_0x1a82('0x67')],_0x1a82('0x68'),util[_0x1a82('0x69')]('%s.%s',path[_0x1a82('0x6a')](_0x5202fd[_0x1a82('0x65')],path[_0x1a82('0x6b')](_0x5202fd[_0x1a82('0x65')])),_0x5202fd[_0x1a82('0x66')]));var _0x15c78e=path[_0x1a82('0x50')](config[_0x1a82('0x67')],'server/files/moh',_0x17f3db[_0x1a82('0x29')],util[_0x1a82('0x69')]('%s.%s',_0x5202fd[_0x1a82('0x29')],_0x5202fd['converted_format']));fs[_0x1a82('0x6c')](_0x118f90,_0x15c78e);return _0x5202fd;}})['catch'](function(_0x34b3f7){throw new db[(_0x1a82('0x60'))][(_0x1a82('0x61'))](_0x34b3f7[_0x1a82('0x6d')]);});})[_0x1a82('0x22')](handleEntityNotFound(_0x2a6f72,null))[_0x1a82('0x22')](respondWithResult(_0x2a6f72,0xc9))[_0x1a82('0x49')](handleError(_0x2a6f72,null));};exports[_0x1a82('0x6e')]=function(_0x144c30,_0x270579,_0x2c61a3){return db[_0x1a82('0x4c')][_0x1a82('0x5b')](function(_0x20fabc){var _0x513015;return db['VoiceMusicOnHold'][_0x1a82('0x64')]({'where':{'id':_0x144c30['params']['id']}})[_0x1a82('0x22')](handleEntityNotFound(_0x270579,null))[_0x1a82('0x22')](function(_0x570de9){if(_0x570de9){_0x513015=_0x570de9;return _0x570de9[_0x1a82('0x6e')](_0x144c30[_0x1a82('0x47')][_0x1a82('0x6f')]);}})[_0x1a82('0x22')](function(_0xf022ec){if(_0xf022ec){return db[_0x1a82('0x63')][_0x1a82('0x64')]({'where':{'id':_0x144c30[_0x1a82('0x47')][_0x1a82('0x6f')]},'attributes':['id','name',_0x1a82('0x65'),'converted_format',_0x1a82('0x70')],'raw':!![]});}})[_0x1a82('0x22')](function(_0x5b6276){if(_0x5b6276){fs[_0x1a82('0x5e')](path[_0x1a82('0x50')](_0x513015[_0x1a82('0x4f')],util[_0x1a82('0x69')](_0x1a82('0x71'),_0x5b6276[_0x1a82('0x29')],_0x5b6276[_0x1a82('0x66')])));return _0x5b6276;}})[_0x1a82('0x49')](function(_0x489515){throw new db[(_0x1a82('0x60'))][(_0x1a82('0x61'))](_0x489515[_0x1a82('0x6d')]);});})['then'](handleEntityNotFound(_0x270579,null))[_0x1a82('0x22')](respondWithStatusCode(_0x270579,0xcc))[_0x1a82('0x49')](handleError(_0x270579,null));};exports[_0x1a82('0x72')]=function(_0x2693e5,_0x220622,_0x5c9491){var _0x12872a={};var _0x3411c1={};var _0x5a86d9;var _0x1a4105;return db[_0x1a82('0x2d')]['findOne']({'where':{'id':_0x2693e5[_0x1a82('0x47')]['id']}})[_0x1a82('0x22')](handleEntityNotFound(_0x220622,null))['then'](function(_0x15d2a2){if(_0x15d2a2){_0x5a86d9=_0x15d2a2;_0x3411c1[_0x1a82('0x32')]=_['keys'](db[_0x1a82('0x63')][_0x1a82('0x2e')]);_0x3411c1[_0x1a82('0x33')]=_[_0x1a82('0x34')](_0x2693e5['query']);_0x3411c1[_0x1a82('0x35')]=_[_0x1a82('0x48')](_0x3411c1[_0x1a82('0x32')],_0x3411c1[_0x1a82('0x33')]);_0x12872a[_0x1a82('0x36')]=_[_0x1a82('0x48')](_0x3411c1['model'],qs[_0x1a82('0x37')](_0x2693e5[_0x1a82('0x33')][_0x1a82('0x37')]));_0x12872a[_0x1a82('0x36')]=_0x12872a[_0x1a82('0x36')][_0x1a82('0x38')]?_0x12872a[_0x1a82('0x36')]:_0x3411c1[_0x1a82('0x32')];_0x12872a[_0x1a82('0x3a')]=qs[_0x1a82('0x3b')](_0x2693e5[_0x1a82('0x33')][_0x1a82('0x3b')]);_0x12872a['where']=qs['filters'](_[_0x1a82('0x3d')](_0x2693e5[_0x1a82('0x33')],_0x3411c1[_0x1a82('0x35')]));if(_0x2693e5[_0x1a82('0x33')][_0x1a82('0x3e')]){_0x12872a[_0x1a82('0x3c')]=_[_0x1a82('0x3f')](_0x12872a[_0x1a82('0x3c')],{'$or':_['map'](_0x12872a['attributes'],function(_0x1ad690){var _0x3f6a17={};_0x3f6a17[_0x1ad690]={'$like':'%'+_0x2693e5[_0x1a82('0x33')][_0x1a82('0x3e')]+'%'};return _0x3f6a17;})});}_0x12872a=_[_0x1a82('0x3f')]({},_0x12872a,_0x2693e5[_0x1a82('0x41')]);return _0x5a86d9[_0x1a82('0x72')](_0x12872a);}})['then'](function(_0x22273e){if(_0x22273e){_0x1a4105=_0x22273e[_0x1a82('0x38')];if(!_0x2693e5[_0x1a82('0x33')][_0x1a82('0x73')](_0x1a82('0x39'))){_0x12872a[_0x1a82('0x1a')]=qs[_0x1a82('0x1a')](_0x2693e5[_0x1a82('0x33')][_0x1a82('0x1a')]);_0x12872a[_0x1a82('0x19')]=qs[_0x1a82('0x19')](_0x2693e5[_0x1a82('0x33')][_0x1a82('0x19')]);}return _0x5a86d9[_0x1a82('0x72')](_0x12872a);}})[_0x1a82('0x22')](function(_0xf888a){if(_0xf888a){return _0xf888a?{'count':_0x1a4105,'rows':_0xf888a}:null;}})[_0x1a82('0x22')](respondWithResult(_0x220622,null))['catch'](handleError(_0x220622,null));};
\ No newline at end of file
+var _0x0671=['mode','directory','root','server/files/moh','files','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','sequelize','readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','findOne','createdAt','join','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','converted_format','symlinkSync','message','id2','Sound','getSounds','rawAttributes','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','sendStatus','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','rows','catch','find','body','params','transaction'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x0671,0xfc));var _0x1067=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x0671[_0x999b85];return _0x1d7124;};'use strict';var emlformat=require(_0x1067('0x0'));var rimraf=require(_0x1067('0x1'));var zipdir=require(_0x1067('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1067('0x3'));var BPromise=require(_0x1067('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1067('0x5'));var sox=require(_0x1067('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1067('0x7'));var _=require(_0x1067('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1067('0x9'));var toCsv=require(_0x1067('0xa'));var querystring=require(_0x1067('0xb'));var Papa=require(_0x1067('0xc'));var Redis=require(_0x1067('0xd'));var authService=require(_0x1067('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1067('0xf'));var hardwareService=require(_0x1067('0x10'));var logger=require(_0x1067('0x11'))(_0x1067('0x12'));var utils=require('../../config/utils');var config=require(_0x1067('0x13'));var licenseUtil=require(_0x1067('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dfec9,_0x3750a1){_0x3750a1=_0x3750a1||0xcc;return function(_0x4efdb4){if(_0x4efdb4){return _0x3dfec9['sendStatus'](_0x3750a1);}return _0x3dfec9[_0x1067('0x15')](_0x3750a1)['end']();};}function respondWithResult(_0x3723ff,_0x2049bf){_0x2049bf=_0x2049bf||0xc8;return function(_0x28357d){if(_0x28357d){return _0x3723ff[_0x1067('0x15')](_0x2049bf)[_0x1067('0x16')](_0x28357d);}};}function respondWithFilteredResult(_0x5b0dc0,_0x12edab){return function(_0x4db693){if(_0x4db693){var _0x1323a4=typeof _0x12edab[_0x1067('0x17')]===_0x1067('0x18')&&typeof _0x12edab[_0x1067('0x19')]===_0x1067('0x18');var _0x57e97c=_0x4db693[_0x1067('0x1a')];var _0x1acd09=_0x1323a4?0x0:_0x12edab[_0x1067('0x17')];var _0x23e570=_0x1323a4?_0x4db693[_0x1067('0x1a')]:_0x12edab[_0x1067('0x17')]+_0x12edab['limit'];var _0xb7b664;if(_0x23e570>=_0x57e97c){_0x23e570=_0x57e97c;_0xb7b664=0xc8;}else{_0xb7b664=0xce;}_0x5b0dc0['status'](_0xb7b664);return _0x5b0dc0[_0x1067('0x1b')](_0x1067('0x1c'),_0x1acd09+'-'+_0x23e570+'/'+_0x57e97c)['json'](_0x4db693);}return null;};}function patchUpdates(_0xc4090f){return function(_0x9e42f4){try{jsonpatch[_0x1067('0x1d')](_0x9e42f4,_0xc4090f,!![]);}catch(_0x398bf4){return BPromise[_0x1067('0x1e')](_0x398bf4);}return _0x9e42f4['save']();};}function saveUpdates(_0x31dbca,_0x2d7349){return function(_0x26b618){if(_0x26b618){return _0x26b618[_0x1067('0x1f')](_0x31dbca)[_0x1067('0x20')](function(_0x58ea32){return _0x58ea32;});}return null;};}function removeEntity(_0x4a976f,_0x64cf6d){return function(_0x2f6a70){if(_0x2f6a70){return _0x2f6a70[_0x1067('0x21')]()[_0x1067('0x20')](function(){var _0x451c6b=_0x2f6a70[_0x1067('0x22')]({'plain':!![]});var _0x321065=_0x1067('0x23');return db[_0x1067('0x24')]['destroy']({'where':{'type':_0x321065,'resourceId':_0x451c6b['id']}})[_0x1067('0x20')](function(){return _0x2f6a70;});})[_0x1067('0x20')](function(){_0x4a976f[_0x1067('0x15')](0xcc)[_0x1067('0x25')]();});}};}function handleEntityNotFound(_0x3f4da6,_0x1bcb3d){return function(_0x44f6c4){if(!_0x44f6c4){_0x3f4da6[_0x1067('0x26')](0x194);}return _0x44f6c4;};}function handleError(_0x1fde63,_0xb9dc3d){_0xb9dc3d=_0xb9dc3d||0x1f4;return function(_0xa6c945){logger[_0x1067('0x27')](_0xa6c945[_0x1067('0x28')]);if(_0xa6c945[_0x1067('0x29')]){delete _0xa6c945[_0x1067('0x29')];}_0x1fde63[_0x1067('0x15')](_0xb9dc3d)[_0x1067('0x2a')](_0xa6c945);};}exports[_0x1067('0x2b')]=function(_0x39dd89,_0x479522){var _0x2443a9={},_0x1792d6={},_0xceda2b={'count':0x0,'rows':[]};var _0x4ee6ca=_['map'](db['VoiceMusicOnHold']['rawAttributes'],function(_0x832035){return{'name':_0x832035[_0x1067('0x2c')],'type':_0x832035[_0x1067('0x2d')][_0x1067('0x2e')]};});_0x1792d6[_0x1067('0x2f')]=_[_0x1067('0x30')](_0x4ee6ca,'name');_0x1792d6[_0x1067('0x31')]=_[_0x1067('0x32')](_0x39dd89[_0x1067('0x31')]);_0x1792d6[_0x1067('0x33')]=_[_0x1067('0x34')](_0x1792d6[_0x1067('0x2f')],_0x1792d6[_0x1067('0x31')]);_0x2443a9[_0x1067('0x35')]=_['intersection'](_0x1792d6[_0x1067('0x2f')],qs['fields'](_0x39dd89['query'][_0x1067('0x36')]));_0x2443a9[_0x1067('0x35')]=_0x2443a9[_0x1067('0x35')][_0x1067('0x37')]?_0x2443a9['attributes']:_0x1792d6[_0x1067('0x2f')];if(!_0x39dd89[_0x1067('0x31')][_0x1067('0x38')](_0x1067('0x39'))){_0x2443a9['limit']=qs[_0x1067('0x19')](_0x39dd89[_0x1067('0x31')][_0x1067('0x19')]);_0x2443a9['offset']=qs[_0x1067('0x17')](_0x39dd89[_0x1067('0x31')][_0x1067('0x17')]);}_0x2443a9[_0x1067('0x3a')]=qs[_0x1067('0x3b')](_0x39dd89[_0x1067('0x31')][_0x1067('0x3b')]);delete _0x39dd89[_0x1067('0x31')][_0x1067('0x3b')];_0x2443a9[_0x1067('0x3c')]=qs[_0x1067('0x33')](_[_0x1067('0x3d')](_0x39dd89['query'],_0x1792d6[_0x1067('0x33')]),_0x4ee6ca);if(_0x39dd89[_0x1067('0x31')][_0x1067('0x3e')]){_0x2443a9[_0x1067('0x3c')]=_[_0x1067('0x3f')](_0x2443a9[_0x1067('0x3c')],{'$or':_[_0x1067('0x30')](_0x4ee6ca,function(_0x1ef6e0){if(_0x1ef6e0['type']!==_0x1067('0x40')){var _0x120d8b={};_0x120d8b[_0x1ef6e0[_0x1067('0x29')]]={'$like':'%'+_0x39dd89[_0x1067('0x31')][_0x1067('0x3e')]+'%'};return _0x120d8b;}})});}_0x2443a9=_[_0x1067('0x3f')]({},_0x2443a9,_0x39dd89[_0x1067('0x41')]);var _0x33c91f={'where':_0x2443a9['where']};return db[_0x1067('0x42')][_0x1067('0x1a')](_0x33c91f)[_0x1067('0x20')](function(_0x212ffd){_0xceda2b['count']=_0x212ffd;if(_0x39dd89[_0x1067('0x31')][_0x1067('0x43')]){_0x2443a9[_0x1067('0x44')]=[{'all':!![]}];}return db[_0x1067('0x42')]['findAll'](_0x2443a9);})[_0x1067('0x20')](function(_0x343227){_0xceda2b[_0x1067('0x45')]=_0x343227;return _0xceda2b;})[_0x1067('0x20')](respondWithFilteredResult(_0x479522,_0x2443a9))[_0x1067('0x46')](handleError(_0x479522,null));};exports['show']=function(_0x23b3c3,_0x1b1e4b){var _0x30e5a4={'raw':![],'where':{'id':_0x23b3c3['params']['id']}},_0x3c78a6={};_0x3c78a6[_0x1067('0x2f')]=_['keys'](db[_0x1067('0x42')]['rawAttributes']);_0x3c78a6[_0x1067('0x31')]=_[_0x1067('0x32')](_0x23b3c3[_0x1067('0x31')]);_0x3c78a6[_0x1067('0x33')]=_[_0x1067('0x34')](_0x3c78a6['model'],_0x3c78a6[_0x1067('0x31')]);_0x30e5a4['attributes']=_[_0x1067('0x34')](_0x3c78a6[_0x1067('0x2f')],qs[_0x1067('0x36')](_0x23b3c3[_0x1067('0x31')][_0x1067('0x36')]));_0x30e5a4[_0x1067('0x35')]=_0x30e5a4[_0x1067('0x35')][_0x1067('0x37')]?_0x30e5a4[_0x1067('0x35')]:_0x3c78a6[_0x1067('0x2f')];if(_0x23b3c3[_0x1067('0x31')][_0x1067('0x43')]){_0x30e5a4['include']=[{'all':!![]}];}_0x30e5a4=_[_0x1067('0x3f')]({},_0x30e5a4,_0x23b3c3['options']);return db[_0x1067('0x42')][_0x1067('0x47')](_0x30e5a4)[_0x1067('0x20')](handleEntityNotFound(_0x1b1e4b,null))['then'](respondWithResult(_0x1b1e4b,null))['catch'](handleError(_0x1b1e4b,null));};exports[_0x1067('0x1f')]=function(_0x4ae9a6,_0x175a70){if(_0x4ae9a6['body']['id']){delete _0x4ae9a6[_0x1067('0x48')]['id'];}return db[_0x1067('0x42')][_0x1067('0x47')]({'where':{'id':_0x4ae9a6[_0x1067('0x49')]['id']}})[_0x1067('0x20')](handleEntityNotFound(_0x175a70,null))[_0x1067('0x20')](saveUpdates(_0x4ae9a6['body'],null))[_0x1067('0x20')](respondWithResult(_0x175a70,null))[_0x1067('0x46')](handleError(_0x175a70,null));};exports['create']=function(_0x42b9e4,_0x38b2c6,_0x53eb70){return db['sequelize'][_0x1067('0x4a')](function(_0xfeb363){if(_0x42b9e4['body'][_0x1067('0x4b')]==='files'){_0x42b9e4[_0x1067('0x48')][_0x1067('0x4c')]=path['join'](config[_0x1067('0x4d')],_0x1067('0x4e'),_0x42b9e4['body'][_0x1067('0x29')]);}return db[_0x1067('0x42')]['create'](_0x42b9e4[_0x1067('0x48')],{'transaction':_0xfeb363})[_0x1067('0x20')](function(_0x3e5703){if(_0x42b9e4[_0x1067('0x48')][_0x1067('0x4b')]===_0x1067('0x4f')){fs[_0x1067('0x50')](_0x3e5703['directory'],parseInt('0777',0x8));}var _0x3b3d4d=_0x42b9e4[_0x1067('0x51')][_0x1067('0x22')]({'plain':!![]});if(!_0x3b3d4d)throw new Error(_0x1067('0x52'));if(_0x3b3d4d[_0x1067('0x53')]===_0x1067('0x51')){var _0x2308ec=_0x3e5703[_0x1067('0x22')]({'plain':!![]});return db[_0x1067('0x54')]['find']({'where':{'name':_0x1067('0x23'),'userProfileId':_0x3b3d4d[_0x1067('0x55')]},'raw':!![]})[_0x1067('0x20')](function(_0x432434){if(_0x432434&&_0x432434[_0x1067('0x56')]===0x0){return db[_0x1067('0x24')]['create']({'name':_0x2308ec[_0x1067('0x29')],'resourceId':_0x2308ec['id'],'type':_0x432434[_0x1067('0x29')],'sectionId':_0x432434['id']},{})[_0x1067('0x20')](function(){return _0x3e5703;});}else{return _0x3e5703;}})[_0x1067('0x46')](function(_0x58cb02){logger[_0x1067('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58cb02);});}return _0x3e5703;});})[_0x1067('0x20')](respondWithResult(_0x38b2c6,0xc9))['catch'](handleError(_0x38b2c6,null));};exports[_0x1067('0x21')]=function(_0x51e30d,_0x51f293,_0x311a8c){var _0xd902b6;return db[_0x1067('0x42')][_0x1067('0x47')]({'where':{'id':_0x51e30d[_0x1067('0x49')]['id']}})['then'](function(_0xb3df33){if(_0xb3df33){return db[_0x1067('0x57')][_0x1067('0x4a')](function(_0x52bdb3){return _0xb3df33[_0x1067('0x21')]({'transaction':_0x52bdb3,'raw':!![]})[_0x1067('0x20')](function(_0x123d02){if(_0x123d02[_0x1067('0x4c')]){fs[_0x1067('0x58')](_0x123d02[_0x1067('0x4c')])['forEach'](function(_0xb25e90){fs[_0x1067('0x59')](path['join'](_0x123d02[_0x1067('0x4c')],_0xb25e90));});fs[_0x1067('0x5a')](_0x123d02[_0x1067('0x4c')]);}return _0x123d02;});})[_0x1067('0x46')](function(_0x55371f){throw new db[(_0x1067('0x5b'))][(_0x1067('0x5c'))](_0x55371f['message']);});}})[_0x1067('0x20')](handleEntityNotFound(_0x51f293,null))[_0x1067('0x20')](removeEntity(_0x51f293,null))[_0x1067('0x46')](handleError(_0x51f293,null));};exports['addSound']=function(_0x39de24,_0x4eafce,_0x48ff27){return db[_0x1067('0x57')][_0x1067('0x4a')](function(_0x767216){var _0x4bc221;return db[_0x1067('0x42')][_0x1067('0x47')]({'where':{'id':_0x39de24[_0x1067('0x49')]['id']}})['then'](function(_0x46a28){if(_0x46a28){_0x4bc221=_0x46a28;return _0x46a28['addSound'](_0x39de24[_0x1067('0x48')]['id'],{'transaction':_0x767216});}})[_0x1067('0x20')](function(_0x22df64){if(_0x22df64){return db['Sound'][_0x1067('0x5d')]({'where':{'id':_0x39de24['body']['id']},'attributes':['id',_0x1067('0x29'),'save_name','converted_format',_0x1067('0x5e')],'raw':!![]});}})[_0x1067('0x20')](function(_0x17414c){if(_0x17414c){var _0x13c76f=path[_0x1067('0x5f')](config[_0x1067('0x4d')],_0x1067('0x60'),util[_0x1067('0x61')](_0x1067('0x62'),path[_0x1067('0x63')](_0x17414c[_0x1067('0x64')],path[_0x1067('0x65')](_0x17414c[_0x1067('0x64')])),_0x17414c[_0x1067('0x66')]));var _0x26f476=path[_0x1067('0x5f')](config[_0x1067('0x4d')],_0x1067('0x4e'),_0x4bc221[_0x1067('0x29')],util[_0x1067('0x61')]('%s.%s',_0x17414c[_0x1067('0x29')],_0x17414c['converted_format']));fs[_0x1067('0x67')](_0x13c76f,_0x26f476);return _0x17414c;}})[_0x1067('0x46')](function(_0x32b7fb){throw new db[(_0x1067('0x5b'))]['ValidationError'](_0x32b7fb[_0x1067('0x68')]);});})[_0x1067('0x20')](handleEntityNotFound(_0x4eafce,null))[_0x1067('0x20')](respondWithResult(_0x4eafce,0xc9))[_0x1067('0x46')](handleError(_0x4eafce,null));};exports['removeSound']=function(_0x1835d2,_0x4d0a72,_0x27a77a){return db['sequelize'][_0x1067('0x4a')](function(_0x14c5d4){var _0x6f6547;return db['VoiceMusicOnHold'][_0x1067('0x5d')]({'where':{'id':_0x1835d2[_0x1067('0x49')]['id']}})[_0x1067('0x20')](handleEntityNotFound(_0x4d0a72,null))[_0x1067('0x20')](function(_0x48903b){if(_0x48903b){_0x6f6547=_0x48903b;return _0x48903b['removeSound'](_0x1835d2['params'][_0x1067('0x69')]);}})['then'](function(_0x2ea918){if(_0x2ea918){return db[_0x1067('0x6a')][_0x1067('0x5d')]({'where':{'id':_0x1835d2[_0x1067('0x49')][_0x1067('0x69')]},'attributes':['id','name','save_name',_0x1067('0x66'),'createdAt'],'raw':!![]});}})[_0x1067('0x20')](function(_0x46b47f){if(_0x46b47f){fs[_0x1067('0x59')](path[_0x1067('0x5f')](_0x6f6547[_0x1067('0x4c')],util['format'](_0x1067('0x62'),_0x46b47f['name'],_0x46b47f['converted_format'])));return _0x46b47f;}})['catch'](function(_0x1fd0e7){throw new db[(_0x1067('0x5b'))]['ValidationError'](_0x1fd0e7[_0x1067('0x68')]);});})[_0x1067('0x20')](handleEntityNotFound(_0x4d0a72,null))[_0x1067('0x20')](respondWithStatusCode(_0x4d0a72,0xcc))[_0x1067('0x46')](handleError(_0x4d0a72,null));};exports[_0x1067('0x6b')]=function(_0x11cb1e,_0x2e5f4a,_0x864777){var _0x37184e={};var _0x118abc={};var _0x253ee9;var _0x1a4019;return db[_0x1067('0x42')][_0x1067('0x5d')]({'where':{'id':_0x11cb1e[_0x1067('0x49')]['id']}})[_0x1067('0x20')](handleEntityNotFound(_0x2e5f4a,null))[_0x1067('0x20')](function(_0x499c2f){if(_0x499c2f){_0x253ee9=_0x499c2f;_0x118abc[_0x1067('0x2f')]=_[_0x1067('0x32')](db['Sound'][_0x1067('0x6c')]);_0x118abc[_0x1067('0x31')]=_[_0x1067('0x32')](_0x11cb1e['query']);_0x118abc['filters']=_[_0x1067('0x34')](_0x118abc[_0x1067('0x2f')],_0x118abc[_0x1067('0x31')]);_0x37184e[_0x1067('0x35')]=_['intersection'](_0x118abc[_0x1067('0x2f')],qs['fields'](_0x11cb1e[_0x1067('0x31')][_0x1067('0x36')]));_0x37184e['attributes']=_0x37184e[_0x1067('0x35')][_0x1067('0x37')]?_0x37184e[_0x1067('0x35')]:_0x118abc[_0x1067('0x2f')];_0x37184e['order']=qs[_0x1067('0x3b')](_0x11cb1e['query'][_0x1067('0x3b')]);_0x37184e[_0x1067('0x3c')]=qs['filters'](_[_0x1067('0x3d')](_0x11cb1e[_0x1067('0x31')],_0x118abc['filters']));if(_0x11cb1e[_0x1067('0x31')][_0x1067('0x3e')]){_0x37184e['where']=_['merge'](_0x37184e['where'],{'$or':_[_0x1067('0x30')](_0x37184e['attributes'],function(_0x4562ca){var _0x327d00={};_0x327d00[_0x4562ca]={'$like':'%'+_0x11cb1e[_0x1067('0x31')]['filter']+'%'};return _0x327d00;})});}_0x37184e=_['merge']({},_0x37184e,_0x11cb1e['options']);return _0x253ee9['getSounds'](_0x37184e);}})['then'](function(_0x49fca9){if(_0x49fca9){_0x1a4019=_0x49fca9[_0x1067('0x37')];if(!_0x11cb1e[_0x1067('0x31')][_0x1067('0x38')](_0x1067('0x39'))){_0x37184e[_0x1067('0x19')]=qs[_0x1067('0x19')](_0x11cb1e['query'][_0x1067('0x19')]);_0x37184e[_0x1067('0x17')]=qs[_0x1067('0x17')](_0x11cb1e[_0x1067('0x31')]['offset']);}return _0x253ee9[_0x1067('0x6b')](_0x37184e);}})[_0x1067('0x20')](function(_0x34fed2){if(_0x34fed2){return _0x34fed2?{'count':_0x1a4019,'rows':_0x34fed2}:null;}})[_0x1067('0x20')](respondWithResult(_0x2e5f4a,null))[_0x1067('0x46')](handleError(_0x2e5f4a,null));};
\ No newline at end of file
index 0b1e708..ecc6627 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf0ff=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','util','../../config/logger','api','moment','request-promise','path'];(function(_0x29f2dd,_0xa55841){var _0x3fb9d4=function(_0x4f6033){while(--_0x4f6033){_0x29f2dd['push'](_0x29f2dd['shift']());}};_0x3fb9d4(++_0xa55841);}(_0xf0ff,0x1e9));var _0xff0f=function(_0x30dd03,_0x44c557){_0x30dd03=_0x30dd03-0x0;var _0x3e6ebb=_0xf0ff[_0x30dd03];return _0x3e6ebb;};'use strict';var _=require('lodash');var util=require(_0xff0f('0x0'));var logger=require(_0xff0f('0x1'))(_0xff0f('0x2'));var moment=require(_0xff0f('0x3'));var BPromise=require('bluebird');var rp=require(_0xff0f('0x4'));var fs=require('fs');var path=require(_0xff0f('0x5'));var rimraf=require(_0xff0f('0x6'));var config=require(_0xff0f('0x7'));var attributes=require(_0xff0f('0x8'));module['exports']=function(_0x5acf4a,_0x4d2c31){return _0x5acf4a[_0xff0f('0x9')](_0xff0f('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xbf16=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','moment','request-promise'];(function(_0x5b445b,_0xd251da){var _0x1a40fe=function(_0x218fce){while(--_0x218fce){_0x5b445b['push'](_0x5b445b['shift']());}};_0x1a40fe(++_0xd251da);}(_0xbf16,0x73));var _0x6bf1=function(_0x16841a,_0x1f86cf){_0x16841a=_0x16841a-0x0;var _0x150513=_0xbf16[_0x16841a];return _0x150513;};'use strict';var _=require(_0x6bf1('0x0'));var util=require(_0x6bf1('0x1'));var logger=require(_0x6bf1('0x2'))('api');var moment=require(_0x6bf1('0x3'));var BPromise=require('bluebird');var rp=require(_0x6bf1('0x4'));var fs=require('fs');var path=require(_0x6bf1('0x5'));var rimraf=require(_0x6bf1('0x6'));var config=require(_0x6bf1('0x7'));var attributes=require(_0x6bf1('0x8'));module['exports']=function(_0x200657,_0x379d93){return _0x200657[_0x6bf1('0x9')](_0x6bf1('0xa'),attributes,{'tableName':_0x6bf1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 7c6a381..2373f1d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x44b70f,_0xc7840b){var _0x456a7e=function(_0x3187c3){while(--_0x3187c3){_0x44b70f['push'](_0x44b70f['shift']());}};_0x456a7e(++_0xc7840b);}(_0x70e0,0x17b));var _0x070e=function(_0x276a69,_0x3fdc4b){_0x276a69=_0x276a69-0x0;var _0x24d824=_0x70e0[_0x276a69];return _0x24d824;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});}
\ No newline at end of file
+var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5126fb,_0x330733){var _0x50b397=function(_0x177131){while(--_0x177131){_0x5126fb['push'](_0x5126fb['shift']());}};_0x50b397(++_0x330733);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}
\ No newline at end of file
index c440d43..c23bd5e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9335=['post','create','addAgents','addTeams','update','destroy','removeAgents','delete','removeTeams','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','/:id/users','getAgents','/:id/teams','getTeams'];(function(_0x3509d0,_0x2d4586){var _0x5b9815=function(_0x4d79a1){while(--_0x4d79a1){_0x3509d0['push'](_0x3509d0['shift']());}};_0x5b9815(++_0x2d4586);}(_0x9335,0xab));var _0x5933=function(_0x8c4ccb,_0x550347){_0x8c4ccb=_0x8c4ccb-0x0;var _0x2c7d50=_0x9335[_0x8c4ccb];return _0x2c7d50;};'use strict';var multer=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var path=require('path');var timeout=require(_0x5933('0x2'));var express=require(_0x5933('0x3'));var router=express[_0x5933('0x4')]();var fs_extra=require(_0x5933('0x5'));var auth=require(_0x5933('0x6'));var interaction=require(_0x5933('0x7'));var config=require(_0x5933('0x8'));var controller=require('./voicePrefix.controller');router[_0x5933('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5933('0x9')](_0x5933('0xa'),auth[_0x5933('0xb')](),controller['describe']);router[_0x5933('0x9')](_0x5933('0xc'),auth[_0x5933('0xb')](),controller[_0x5933('0xd')]);router[_0x5933('0x9')](_0x5933('0xe'),auth[_0x5933('0xb')](),controller[_0x5933('0xf')]);router[_0x5933('0x9')](_0x5933('0x10'),auth[_0x5933('0xb')](),controller[_0x5933('0x11')]);router[_0x5933('0x12')]('/',auth['isAuthenticated'](),controller[_0x5933('0x13')]);router['post'](_0x5933('0xe'),auth[_0x5933('0xb')](),controller[_0x5933('0x14')]);router['post'](_0x5933('0x10'),auth['isAuthenticated'](),controller[_0x5933('0x15')]);router['put'](_0x5933('0xc'),auth['isAuthenticated'](),controller[_0x5933('0x16')]);router['delete'](_0x5933('0xc'),auth[_0x5933('0xb')](),controller[_0x5933('0x17')]);router['delete']('/:id/users',auth[_0x5933('0xb')](),controller[_0x5933('0x18')]);router[_0x5933('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5933('0x1a')]);module['exports']=router;
\ No newline at end of file
+var _0x6f49=['connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','create','post','addAgents','update','delete','removeAgents','removeTeams','util','path'];(function(_0x46d72e,_0x36fb53){var _0x4087da=function(_0x11ae6e){while(--_0x11ae6e){_0x46d72e['push'](_0x46d72e['shift']());}};_0x4087da(++_0x36fb53);}(_0x6f49,0xa6));var _0x96f4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f49[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x96f4('0x0'));var path=require(_0x96f4('0x1'));var timeout=require(_0x96f4('0x2'));var express=require(_0x96f4('0x3'));var router=express[_0x96f4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x96f4('0x5'));var controller=require('./voicePrefix.controller');router[_0x96f4('0x6')]('/',auth[_0x96f4('0x7')](),controller[_0x96f4('0x8')]);router['get'](_0x96f4('0x9'),auth[_0x96f4('0x7')](),controller[_0x96f4('0xa')]);router[_0x96f4('0x6')](_0x96f4('0xb'),auth[_0x96f4('0x7')](),controller[_0x96f4('0xc')]);router[_0x96f4('0x6')](_0x96f4('0xd'),auth['isAuthenticated'](),controller[_0x96f4('0xe')]);router[_0x96f4('0x6')](_0x96f4('0xf'),auth[_0x96f4('0x7')](),controller[_0x96f4('0x10')]);router['post']('/',auth[_0x96f4('0x7')](),controller[_0x96f4('0x11')]);router[_0x96f4('0x12')]('/:id/users',auth[_0x96f4('0x7')](),controller[_0x96f4('0x13')]);router[_0x96f4('0x12')](_0x96f4('0xf'),auth['isAuthenticated'](),controller['addTeams']);router['put'](_0x96f4('0xb'),auth[_0x96f4('0x7')](),controller[_0x96f4('0x14')]);router[_0x96f4('0x15')](_0x96f4('0xb'),auth[_0x96f4('0x7')](),controller['destroy']);router[_0x96f4('0x15')](_0x96f4('0xd'),auth[_0x96f4('0x7')](),controller[_0x96f4('0x16')]);router['delete'](_0x96f4('0xf'),auth[_0x96f4('0x7')](),controller[_0x96f4('0x17')]);module['exports']=router;
\ No newline at end of file
index a9bd90d..5688b61 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x55ab=['VIRTUAL','system-','STRING','INTEGER','name'];(function(_0x578a8b,_0x16e7f5){var _0xe4c0d5=function(_0x28933f){while(--_0x28933f){_0x578a8b['push'](_0x578a8b['shift']());}};_0xe4c0d5(++_0x16e7f5);}(_0x55ab,0x1ee));var _0xb55a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x55ab[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb55a('0x0')},'prefix':{'type':Sequelize[_0xb55a('0x1')],'get':function(_0x965e7d){return _0xb55a('0x2')+this['getDataValue'](_0xb55a('0x0'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xb55a('0x3')]},'VoiceExtensionId':{'type':Sequelize[_0xb55a('0x4')]}};
\ No newline at end of file
+var _0xf820=['system-','INTEGER','sequelize','STRING','name','VIRTUAL'];(function(_0x5c3e46,_0x229bf0){var _0xdb86dc=function(_0x2950ae){while(--_0x2950ae){_0x5c3e46['push'](_0x5c3e46['shift']());}};_0xdb86dc(++_0x229bf0);}(_0xf820,0x10a));var _0x0f82=function(_0x472d0a,_0xe30a4e){_0x472d0a=_0x472d0a-0x0;var _0xc7d931=_0xf820[_0x472d0a];return _0xc7d931;};'use strict';var Sequelize=require(_0x0f82('0x0'));module['exports']={'name':{'type':Sequelize[_0x0f82('0x1')],'allowNull':![],'unique':_0x0f82('0x2')},'prefix':{'type':Sequelize[_0x0f82('0x3')],'get':function(_0x407409){return _0x0f82('0x4')+this['getDataValue'](_0x0f82('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x0f82('0x5')]}};
\ No newline at end of file
index 9c1335e..6842ad2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe2cf=['socket.io-emitter','register','end','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','catch','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoicePrefixes','autoAssociation','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','addAgents','ids','userVoicePrefix:save','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','nolimit','getTeams','addTeams','findAll','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','removeTeams','field','tq.TeamId','from','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x363595,_0x5c9b3d){var _0xab9893=function(_0x3ce4b2){while(--_0x3ce4b2){_0x363595['push'](_0x363595['shift']());}};_0xab9893(++_0x5c9b3d);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x478e2f,_0xcc2041){_0x478e2f=_0x478e2f-0x0;var _0x4b088d=_0xe2cf[_0x478e2f];return _0x4b088d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe2c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe2c('0x1'));var rp=require('request-promise');var moment=require(_0xfe2c('0x2'));var BPromise=require(_0xfe2c('0x3'));var Mustache=require(_0xfe2c('0x4'));var util=require(_0xfe2c('0x5'));var path=require('path');var sox=require(_0xfe2c('0x6'));var csv=require(_0xfe2c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe2c('0x8'));var squel=require(_0xfe2c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfe2c('0xa'));var toCsv=require(_0xfe2c('0x7'));var querystring=require(_0xfe2c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe2c('0xc'));var qs=require(_0xfe2c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe2c('0xe'));var logger=require(_0xfe2c('0xf'))(_0xfe2c('0x10'));var utils=require(_0xfe2c('0x11'));var config=require(_0xfe2c('0x12'));var licenseUtil=require(_0xfe2c('0x13'));var db=require(_0xfe2c('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfe2c('0x15'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xfe2c('0x16')](socket);function respondWithStatusCode(_0x4d0a10,_0x2aa7df){_0x2aa7df=_0x2aa7df||0xcc;return function(_0x12e4c4){if(_0x12e4c4){return _0x4d0a10['sendStatus'](_0x2aa7df);}return _0x4d0a10['status'](_0x2aa7df)[_0xfe2c('0x17')]();};}function respondWithResult(_0x3b3ebd,_0x1dbed4){_0x1dbed4=_0x1dbed4||0xc8;return function(_0x56cebc){if(_0x56cebc){return _0x3b3ebd['status'](_0x1dbed4)[_0xfe2c('0x18')](_0x56cebc);}};}function respondWithFilteredResult(_0x96a3a3,_0x135436){return function(_0x23242b){if(_0x23242b){var _0x36aeec=typeof _0x135436[_0xfe2c('0x19')]==='undefined'&&typeof _0x135436[_0xfe2c('0x1a')]===_0xfe2c('0x1b');var _0x1d7852=_0x23242b[_0xfe2c('0x1c')];var _0x55f751=_0x36aeec?0x0:_0x135436[_0xfe2c('0x19')];var _0x59bdeb=_0x36aeec?_0x23242b['count']:_0x135436[_0xfe2c('0x19')]+_0x135436[_0xfe2c('0x1a')];var _0x4bf7c0;if(_0x59bdeb>=_0x1d7852){_0x59bdeb=_0x1d7852;_0x4bf7c0=0xc8;}else{_0x4bf7c0=0xce;}_0x96a3a3[_0xfe2c('0x1d')](_0x4bf7c0);return _0x96a3a3[_0xfe2c('0x1e')]('Content-Range',_0x55f751+'-'+_0x59bdeb+'/'+_0x1d7852)[_0xfe2c('0x18')](_0x23242b);}return null;};}function patchUpdates(_0x5dd54b){return function(_0x4481ff){try{jsonpatch[_0xfe2c('0x1f')](_0x4481ff,_0x5dd54b,!![]);}catch(_0x8b5c0d){return BPromise[_0xfe2c('0x20')](_0x8b5c0d);}return _0x4481ff[_0xfe2c('0x21')]();};}function saveUpdates(_0x2ee3b3,_0x57cd6d){return function(_0x41a545){if(_0x41a545){return _0x41a545[_0xfe2c('0x22')](_0x2ee3b3)[_0xfe2c('0x23')](function(_0x26448c){return _0x26448c;});}return null;};}function removeEntity(_0x3486b5,_0x10afde){return function(_0x53bab0){if(_0x53bab0){return _0x53bab0[_0xfe2c('0x24')]()['then'](function(){var _0x16daf3=_0x53bab0[_0xfe2c('0x25')]({'plain':!![]});var _0x1c35d3='VoicePrefixes';return db[_0xfe2c('0x26')][_0xfe2c('0x24')]({'where':{'type':_0x1c35d3,'resourceId':_0x16daf3['id']}})['then'](function(){return _0x53bab0;});})[_0xfe2c('0x23')](function(){_0x3486b5[_0xfe2c('0x1d')](0xcc)[_0xfe2c('0x17')]();});}};}function handleEntityNotFound(_0x53a8c1,_0x170026){return function(_0x1b7c91){if(!_0x1b7c91){_0x53a8c1['sendStatus'](0x194);}return _0x1b7c91;};}function handleError(_0x481219,_0x1cf1d7){_0x1cf1d7=_0x1cf1d7||0x1f4;return function(_0x13e9a9){logger[_0xfe2c('0x27')](_0x13e9a9[_0xfe2c('0x28')]);if(_0x13e9a9[_0xfe2c('0x29')]){delete _0x13e9a9['name'];}_0x481219[_0xfe2c('0x1d')](_0x1cf1d7)[_0xfe2c('0x2a')](_0x13e9a9);};}exports[_0xfe2c('0x2b')]=function(_0x210c2e,_0x2843a5){var _0xabc499={},_0x69d23a={},_0x3f8696={'count':0x0,'rows':[]};var _0x2e09fe=_[_0xfe2c('0x2c')](db[_0xfe2c('0x2d')][_0xfe2c('0x2e')],function(_0x4e6b92){return{'name':_0x4e6b92[_0xfe2c('0x2f')],'type':_0x4e6b92[_0xfe2c('0x30')][_0xfe2c('0x31')]};});_0x69d23a['model']=_[_0xfe2c('0x2c')](_0x2e09fe,_0xfe2c('0x29'));_0x69d23a['query']=_[_0xfe2c('0x32')](_0x210c2e[_0xfe2c('0x33')]);_0x69d23a[_0xfe2c('0x34')]=_['intersection'](_0x69d23a[_0xfe2c('0x35')],_0x69d23a[_0xfe2c('0x33')]);_0xabc499[_0xfe2c('0x36')]=_[_0xfe2c('0x37')](_0x69d23a[_0xfe2c('0x35')],qs[_0xfe2c('0x38')](_0x210c2e[_0xfe2c('0x33')]['fields']));_0xabc499['attributes']=_0xabc499[_0xfe2c('0x36')][_0xfe2c('0x39')]?_0xabc499[_0xfe2c('0x36')]:_0x69d23a[_0xfe2c('0x35')];if(!_0x210c2e['query'][_0xfe2c('0x3a')]('nolimit')){_0xabc499[_0xfe2c('0x1a')]=qs[_0xfe2c('0x1a')](_0x210c2e['query'][_0xfe2c('0x1a')]);_0xabc499['offset']=qs['offset'](_0x210c2e[_0xfe2c('0x33')][_0xfe2c('0x19')]);}_0xabc499[_0xfe2c('0x3b')]=qs[_0xfe2c('0x3c')](_0x210c2e[_0xfe2c('0x33')][_0xfe2c('0x3c')]);_0xabc499[_0xfe2c('0x3d')]=qs[_0xfe2c('0x34')](_[_0xfe2c('0x3e')](_0x210c2e[_0xfe2c('0x33')],_0x69d23a[_0xfe2c('0x34')]),_0x2e09fe);if(_0x210c2e['query'][_0xfe2c('0x3f')]){_0xabc499[_0xfe2c('0x3d')]=_[_0xfe2c('0x40')](_0xabc499['where'],{'$or':_['map'](_0x2e09fe,function(_0x4e5f0b){if(_0x4e5f0b[_0xfe2c('0x30')]!==_0xfe2c('0x41')){var _0x428b32={};_0x428b32[_0x4e5f0b[_0xfe2c('0x29')]]={'$like':'%'+_0x210c2e['query'][_0xfe2c('0x3f')]+'%'};return _0x428b32;}})});}_0xabc499=_[_0xfe2c('0x40')]({},_0xabc499,_0x210c2e[_0xfe2c('0x42')]);var _0x278acb={'where':_0xabc499[_0xfe2c('0x3d')]};return db['VoicePrefix'][_0xfe2c('0x1c')](_0x278acb)[_0xfe2c('0x23')](function(_0x6055dd){_0x3f8696[_0xfe2c('0x1c')]=_0x6055dd;if(_0x210c2e['query']['includeAll']){_0xabc499[_0xfe2c('0x43')]=[{'all':!![]}];}return db[_0xfe2c('0x2d')]['findAll'](_0xabc499);})[_0xfe2c('0x23')](function(_0x27862d){_0x3f8696[_0xfe2c('0x44')]=_0x27862d;return _0x3f8696;})[_0xfe2c('0x23')](respondWithFilteredResult(_0x2843a5,_0xabc499))['catch'](handleError(_0x2843a5,null));};exports[_0xfe2c('0x45')]=function(_0xfe35e5,_0x331a8a){var _0x466cdb={'raw':![],'where':{'id':_0xfe35e5[_0xfe2c('0x46')]['id']}},_0x122a05={};_0x122a05[_0xfe2c('0x35')]=_[_0xfe2c('0x32')](db['VoicePrefix'][_0xfe2c('0x2e')]);_0x122a05['query']=_[_0xfe2c('0x32')](_0xfe35e5[_0xfe2c('0x33')]);_0x122a05[_0xfe2c('0x34')]=_[_0xfe2c('0x37')](_0x122a05['model'],_0x122a05['query']);_0x466cdb['attributes']=_['intersection'](_0x122a05['model'],qs[_0xfe2c('0x38')](_0xfe35e5['query']['fields']));_0x466cdb[_0xfe2c('0x36')]=_0x466cdb['attributes'][_0xfe2c('0x39')]?_0x466cdb['attributes']:_0x122a05[_0xfe2c('0x35')];if(_0xfe35e5[_0xfe2c('0x33')][_0xfe2c('0x47')]){_0x466cdb[_0xfe2c('0x43')]=[{'all':!![]}];}_0x466cdb=_[_0xfe2c('0x40')]({},_0x466cdb,_0xfe35e5['options']);return db[_0xfe2c('0x2d')][_0xfe2c('0x48')](_0x466cdb)[_0xfe2c('0x23')](handleEntityNotFound(_0x331a8a,null))['then'](respondWithResult(_0x331a8a,null))[_0xfe2c('0x49')](handleError(_0x331a8a,null));};exports[_0xfe2c('0x24')]=function(_0x579b6b,_0x56f716){return db['VoicePrefix'][_0xfe2c('0x48')]({'where':{'id':_0x579b6b[_0xfe2c('0x46')]['id']}})[_0xfe2c('0x23')](handleEntityNotFound(_0x56f716,null))[_0xfe2c('0x23')](removeEntity(_0x56f716,null))[_0xfe2c('0x49')](handleError(_0x56f716,null));};exports['describe']=function(_0x24cdce,_0x2983b0){return db[_0xfe2c('0x2d')]['describe']()['then'](respondWithResult(_0x2983b0,null))[_0xfe2c('0x49')](handleError(_0x2983b0,null));};exports[_0xfe2c('0x4a')]=function(_0x2daa5f,_0x154381){var _0x384766;return db[_0xfe2c('0x4b')][_0xfe2c('0x4c')](function(_0x37e3de){return db[_0xfe2c('0x2d')][_0xfe2c('0x4a')](_0x2daa5f['body'],{'transaction':_0x37e3de})[_0xfe2c('0x23')](function(_0x34e8e0){_0x384766=_0x34e8e0[_0xfe2c('0x25')]({'plain':!![]});return db[_0xfe2c('0x4d')][_0xfe2c('0x48')]({'where':{'id':_0x384766[_0xfe2c('0x4e')]},'raw':!![]})[_0xfe2c('0x23')](function(_0x158e70){return createVoicePrefixExtensions(_0x384766,_0x158e70,_0x37e3de);});});})[_0xfe2c('0x23')](function(){var _0xf54c02=_0x2daa5f[_0xfe2c('0x4f')]['get']({'plain':!![]});if(!_0xf54c02)throw new Error(_0xfe2c('0x50'));if(_0xf54c02['role']===_0xfe2c('0x4f')){var _0x4f4bc6=_0x384766;return db['UserProfileSection']['find']({'where':{'name':_0xfe2c('0x51'),'userProfileId':_0xf54c02['userProfileId']},'raw':!![]})[_0xfe2c('0x23')](function(_0x5f47cc){if(_0x5f47cc&&_0x5f47cc[_0xfe2c('0x52')]===0x0){return db[_0xfe2c('0x26')][_0xfe2c('0x4a')]({'name':_0x4f4bc6[_0xfe2c('0x29')],'resourceId':_0x4f4bc6['id'],'type':_0x5f47cc[_0xfe2c('0x29')],'sectionId':_0x5f47cc['id']},{})[_0xfe2c('0x23')](function(){return _0x384766;});}else{return _0x384766;}})[_0xfe2c('0x49')](function(_0x11d99e){logger[_0xfe2c('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11d99e);throw _0x11d99e;});}return _0x384766;})[_0xfe2c('0x23')](respondWithResult(_0x154381,null))[_0xfe2c('0x49')](handleError(_0x154381,null));};function Extension(_0xf9ed12,_0x385c21,_0x366687,_0x5e6d96){this[_0xfe2c('0x53')]=_0xfe2c('0x54');this['exten']=_0xf9ed12;this['app']=_0x366687;this[_0xfe2c('0x30')]=_0xfe2c('0x55');this[_0xfe2c('0x56')]=_0xfe2c('0x57');this[_0xfe2c('0x58')]=_0x385c21;this[_0xfe2c('0x59')]=_0x5e6d96;}function createVoicePrefixExtensions(_0x306f81,_0x510c61,_0x1a2278){return new BPromise(function(_0x33df71,_0x4679){var _0x821144=new Extension(formatPrefixName(_0x306f81[_0xfe2c('0x5a')]),0x1,_0xfe2c('0x5b'),_0xfe2c('0x5c'));_0x821144['VoicePrefixId']=_0x306f81['id'];return db[_0xfe2c('0x4d')]['create'](_0x821144,{'transaction':_0x1a2278})[_0xfe2c('0x23')](function(_0x349d72){var _0x4cede1=_0x349d72[_0xfe2c('0x25')]({'plain':!![]});var _0x5caca7=_[_0xfe2c('0x2c')](addVoicePrefixExtensions(_0x306f81,_0x510c61),function(_0x377064){_0x377064['VoiceExtensionId']=_0x4cede1['id'];_0x377064[_0xfe2c('0x5d')]=_0x306f81['id'];return _0x377064;});return db['VoiceExtension'][_0xfe2c('0x5e')](_0x5caca7,{'transaction':_0x1a2278})['then'](function(_0x23827b){if(!_0x23827b){return _0x4679(_0xfe2c('0x5f'));}else{return _0x33df71(_0x23827b);}})['catch'](function(_0x661798){return _0x4679(_0x661798);});});;});};function addVoicePrefixExtensions(_0x7a0a77,_0x17b42a){var _0xda63e=[];var _0xa47aeb=formatPrefixName(_0x7a0a77['prefix']);_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x2,_0xfe2c('0x61'),_0xfe2c('0x62')+_0x7a0a77[_0xfe2c('0x29')]));if(_0x7a0a77['callerIdAll']){_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x3,'Set',_0xfe2c('0x63')+_0x7a0a77['callerIdAll']));}else{_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x3,_0xfe2c('0x5b'),_0xfe2c('0x64')));}_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x4,_0xfe2c('0x65'),_0x17b42a[_0xfe2c('0x53')]+','+_0xfe2c('0x66')+(0x8+_0x7a0a77[_0xfe2c('0x29')][_0xfe2c('0x39')])+'}'+','+0x1));return _0xda63e;}function formatPrefixName(_0x21b07a){var _0x3da347='_';for(var _0x2fcb15=0x0;_0x2fcb15<_0x21b07a[_0xfe2c('0x39')];_0x2fcb15++){if(_0x21b07a[_0xfe2c('0x67')](_0x2fcb15)=='-'){_0x3da347+=_0x21b07a[_0xfe2c('0x67')](_0x2fcb15);}else{_0x3da347+='['+_0x21b07a[_0xfe2c('0x67')](_0x2fcb15)+']';}}_0x3da347+='.';return _0x3da347;}exports['update']=function(_0x2f48d5,_0x53513a,_0xdafb46){var _0x5aee3f=_0x2f48d5[_0xfe2c('0x68')];_0x5aee3f['prefix']='system-'+_0x5aee3f[_0xfe2c('0x29')]+'-';return db[_0xfe2c('0x4b')][_0xfe2c('0x4c')](function(_0x40124f){return db[_0xfe2c('0x2d')]['update'](_0x5aee3f,{'where':{'id':_0x5aee3f['id']},'transaction':_0x40124f})[_0xfe2c('0x23')](function(){return db[_0xfe2c('0x4d')]['destroy']({'where':{'VoicePrefixId':_0x5aee3f['id']},'transaction':_0x40124f})[_0xfe2c('0x23')](function(){return db[_0xfe2c('0x4d')]['find']({'where':{'id':_0x5aee3f['VoiceExtensionId']},'raw':!![]})['then'](function(_0x14d619){return createVoicePrefixExtensions(_0x5aee3f,_0x14d619,_0x40124f);});});});})[_0xfe2c('0x23')](function(){return db[_0xfe2c('0x2d')]['findById'](_0x5aee3f['id']);})['then'](respondWithResult(_0x53513a,null))[_0xfe2c('0x49')](handleError(_0x53513a,null));};exports[_0xfe2c('0x69')]=function(_0x56a3be,_0x3508c2,_0x9c07d5){return db[_0xfe2c('0x2d')][_0xfe2c('0x48')]({'where':{'id':_0x56a3be['params']['id']}})['then'](handleEntityNotFound(_0x3508c2,null))[_0xfe2c('0x23')](function(_0x414b87){if(_0x414b87){return _0x414b87['addAgents'](_0x56a3be[_0xfe2c('0x68')][_0xfe2c('0x6a')],_['omit'](_0x56a3be[_0xfe2c('0x68')],['ids','id'])||{})['spread'](function(_0x1f5190){for(var _0x157ad0=0x0;_0x157ad0<_0x56a3be['body'][_0xfe2c('0x6a')][_0xfe2c('0x39')];_0x157ad0+=0x1){socket['emit'](_0xfe2c('0x6b'),{'UserId':Number(_0x56a3be['body'][_0xfe2c('0x6a')][_0x157ad0]),'VoicePrefixId':Number(_0x56a3be[_0xfe2c('0x46')]['id'])});}return _0x1f5190;});}})[_0xfe2c('0x23')](respondWithResult(_0x3508c2,null))[_0xfe2c('0x49')](handleError(_0x3508c2,null));};exports['removeAgents']=function(_0x10e0a0,_0x85c898,_0x5317e4){return db[_0xfe2c('0x2d')]['find']({'where':{'id':_0x10e0a0[_0xfe2c('0x46')]['id']}})['then'](handleEntityNotFound(_0x85c898,null))[_0xfe2c('0x23')](function(_0x23311a){if(_0x23311a){return _0x23311a['removeAgents'](_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')])[_0xfe2c('0x23')](function(){if(_[_0xfe2c('0x6c')](_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')])){for(var _0x52627b=0x0;_0x52627b<_0x10e0a0[_0xfe2c('0x33')]['ids']['length'];_0x52627b+=0x1){socket[_0xfe2c('0x6d')](_0xfe2c('0x6e'),{'UserId':Number(_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')][_0x52627b]),'VoicePrefixId':Number(_0x10e0a0[_0xfe2c('0x46')]['id'])});}}else{socket[_0xfe2c('0x6d')]('userVoicePrefix:remove',{'UserId':Number(_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')]),'VoicePrefixId':Number(_0x10e0a0[_0xfe2c('0x46')]['id'])});}});}})[_0xfe2c('0x23')](respondWithStatusCode(_0x85c898,null))['catch'](handleError(_0x85c898,null));};exports[_0xfe2c('0x6f')]=function(_0x4f595d,_0x392232,_0x114553){var _0x512137={};var _0x1baccd={};var _0x540a67;var _0x49f9e1;return db['VoicePrefix'][_0xfe2c('0x70')]({'where':{'id':_0x4f595d[_0xfe2c('0x46')]['id']}})[_0xfe2c('0x23')](handleEntityNotFound(_0x392232,null))[_0xfe2c('0x23')](function(_0x4147fc){if(_0x4147fc){_0x540a67=_0x4147fc;_0x1baccd[_0xfe2c('0x35')]=_[_0xfe2c('0x32')](db[_0xfe2c('0x71')][_0xfe2c('0x2e')]);_0x1baccd['query']=_['keys'](_0x4f595d[_0xfe2c('0x33')]);_0x1baccd[_0xfe2c('0x34')]=_[_0xfe2c('0x37')](_0x1baccd[_0xfe2c('0x35')],_0x1baccd[_0xfe2c('0x33')]);_0x512137[_0xfe2c('0x36')]=_['intersection'](_0x1baccd[_0xfe2c('0x35')],qs[_0xfe2c('0x38')](_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x38')]));_0x512137[_0xfe2c('0x36')]=_0x512137[_0xfe2c('0x36')][_0xfe2c('0x39')]?_0x512137[_0xfe2c('0x36')]:_0x1baccd[_0xfe2c('0x35')];_0x512137['order']=qs[_0xfe2c('0x3c')](_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3c')]);_0x512137[_0xfe2c('0x3d')]=qs[_0xfe2c('0x34')](_[_0xfe2c('0x3e')](_0x4f595d['query'],_0x1baccd[_0xfe2c('0x34')]));if(_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3f')]){_0x512137[_0xfe2c('0x3d')]=_['merge'](_0x512137['where'],{'$or':_[_0xfe2c('0x2c')](_0x512137[_0xfe2c('0x36')],function(_0x312e84){var _0x57643d={};_0x57643d[_0x312e84]={'$like':'%'+_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3f')]+'%'};return _0x57643d;})});}_0x512137=_[_0xfe2c('0x40')]({},_0x512137,_0x4f595d['options']);return _0x540a67[_0xfe2c('0x6f')](_0x512137);}})[_0xfe2c('0x23')](function(_0x1193c2){if(_0x1193c2){_0x49f9e1=_0x1193c2[_0xfe2c('0x39')];if(!_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3a')](_0xfe2c('0x72'))){_0x512137[_0xfe2c('0x1a')]=qs[_0xfe2c('0x1a')](_0x4f595d['query'][_0xfe2c('0x1a')]);_0x512137['offset']=qs[_0xfe2c('0x19')](_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x19')]);}return _0x540a67['getAgents'](_0x512137);}})['then'](function(_0x4f39af){if(_0x4f39af){return _0x4f39af?{'count':_0x49f9e1,'rows':_0x4f39af}:null;}})[_0xfe2c('0x23')](respondWithResult(_0x392232,null))[_0xfe2c('0x49')](handleError(_0x392232,null));};exports[_0xfe2c('0x73')]=function(_0x3b07e7,_0x37e3d8,_0x27d025){var _0x23e1db={};var _0x14ebf0={};var _0x20c22a;var _0xb283e0;return db[_0xfe2c('0x2d')][_0xfe2c('0x70')]({'where':{'id':_0x3b07e7[_0xfe2c('0x46')]['id']}})['then'](handleEntityNotFound(_0x37e3d8,null))[_0xfe2c('0x23')](function(_0x532f06){if(_0x532f06){_0x20c22a=_0x532f06;_0x14ebf0[_0xfe2c('0x35')]=_[_0xfe2c('0x32')](db['Team']['rawAttributes']);_0x14ebf0['query']=_[_0xfe2c('0x32')](_0x3b07e7[_0xfe2c('0x33')]);_0x14ebf0[_0xfe2c('0x34')]=_[_0xfe2c('0x37')](_0x14ebf0[_0xfe2c('0x35')],_0x14ebf0[_0xfe2c('0x33')]);_0x23e1db['attributes']=_['intersection'](_0x14ebf0[_0xfe2c('0x35')],qs[_0xfe2c('0x38')](_0x3b07e7[_0xfe2c('0x33')]['fields']));_0x23e1db[_0xfe2c('0x36')]=_0x23e1db['attributes'][_0xfe2c('0x39')]?_0x23e1db[_0xfe2c('0x36')]:_0x14ebf0[_0xfe2c('0x35')];_0x23e1db[_0xfe2c('0x3b')]=qs['sort'](_0x3b07e7[_0xfe2c('0x33')][_0xfe2c('0x3c')]);_0x23e1db[_0xfe2c('0x3d')]=qs[_0xfe2c('0x34')](_[_0xfe2c('0x3e')](_0x3b07e7['query'],_0x14ebf0[_0xfe2c('0x34')]));if(_0x3b07e7[_0xfe2c('0x33')]['filter']){_0x23e1db[_0xfe2c('0x3d')]=_[_0xfe2c('0x40')](_0x23e1db[_0xfe2c('0x3d')],{'$or':_[_0xfe2c('0x2c')](_0x23e1db[_0xfe2c('0x36')],function(_0x50f27e){var _0x995423={};_0x995423[_0x50f27e]={'$like':'%'+_0x3b07e7[_0xfe2c('0x33')][_0xfe2c('0x3f')]+'%'};return _0x995423;})});}_0x23e1db=_[_0xfe2c('0x40')]({},_0x23e1db,_0x3b07e7[_0xfe2c('0x42')]);return _0x20c22a[_0xfe2c('0x73')](_0x23e1db);}})[_0xfe2c('0x23')](function(_0x142bf1){if(_0x142bf1){_0xb283e0=_0x142bf1['length'];if(!_0x3b07e7['query'][_0xfe2c('0x3a')](_0xfe2c('0x72'))){_0x23e1db[_0xfe2c('0x1a')]=qs[_0xfe2c('0x1a')](_0x3b07e7[_0xfe2c('0x33')][_0xfe2c('0x1a')]);_0x23e1db['offset']=qs['offset'](_0x3b07e7['query'][_0xfe2c('0x19')]);}return _0x20c22a[_0xfe2c('0x73')](_0x23e1db);}})[_0xfe2c('0x23')](function(_0x2351d5){if(_0x2351d5){return _0x2351d5?{'count':_0xb283e0,'rows':_0x2351d5}:null;}})[_0xfe2c('0x23')](respondWithResult(_0x37e3d8,null))[_0xfe2c('0x49')](handleError(_0x37e3d8,null));};exports[_0xfe2c('0x74')]=function(_0x3f2102,_0x1cc35d,_0x246d5d){var _0x5f34d3=_0x3f2102[_0xfe2c('0x68')][_0xfe2c('0x6a')];var _0x14631f;return db['Team'][_0xfe2c('0x75')]({'where':{'id':_0x5f34d3},'attributes':['id'],'include':[{'model':db[_0xfe2c('0x71')],'as':_0xfe2c('0x76'),'attributes':['id',_0xfe2c('0x29'),_0xfe2c('0x77'),_0xfe2c('0x78'),'interface'],'raw':!![]}]})['then'](function(_0x5f4744){if(_0x5f4744){_0x14631f=_0x5f4744;var _0x18ad4f=_[_0xfe2c('0x79')](_0x5f4744,function(_0x24faae){var _0x450e1d=_0x24faae[_0xfe2c('0x25')]({'plain':!![]});return _0x450e1d[_0xfe2c('0x76')];});return db['VoicePrefix'][_0xfe2c('0x48')]({'where':{'id':_0x3f2102['params']['id']}})[_0xfe2c('0x23')](function(_0x552cd3){return db['sequelize'][_0xfe2c('0x4c')](function(_0x32ed72){return _0x552cd3[_0xfe2c('0x74')](_0x5f34d3,{'transaction':_0x32ed72})['then'](function(){return BPromise[_0xfe2c('0x7a')](_0x14631f,function(_0x4f946d){return db[_0xfe2c('0x7b')][_0xfe2c('0x7c')]({'TeamId':_0x4f946d['id'],'VoicePrefixId':_0x3f2102[_0xfe2c('0x46')]['id']},{'transaction':_0x32ed72});});})[_0xfe2c('0x23')](function(){return BPromise['each'](_0x18ad4f,function(_0x42495d){return db[_0xfe2c('0x7d')]['findOrCreate']({'where':{'UserId':_0x42495d['id'],'VoicePrefixId':_0x3f2102[_0xfe2c('0x46')]['id']},'transaction':_0x32ed72});});})[_0xfe2c('0x23')](function(){_0x18ad4f[_0xfe2c('0x7e')](function(_0x1682b2){socket[_0xfe2c('0x6d')]('userVoicePrefix:save',{'UserId':_0x1682b2['id'],'VoicePrefixId':_0x552cd3['id']});});});});});}})[_0xfe2c('0x23')](respondWithStatusCode(_0x1cc35d,null))[_0xfe2c('0x49')](handleError(_0x1cc35d,null));};exports[_0xfe2c('0x7f')]=function(_0x3027f9,_0x3d6fba,_0x2523cc){return db['Team'][_0xfe2c('0x75')]({'where':{'id':_0x3027f9[_0xfe2c('0x33')][_0xfe2c('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfe2c('0x76'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3d6fba,null))[_0xfe2c('0x23')](function(_0x5cbd7f){var _0x3dba12=_[_0xfe2c('0x2c')](_0x5cbd7f,'id');var _0x40be3c=[];var _0x4dd915=[];var _0x6efab6=squel['select']();_0x6efab6[_0xfe2c('0x80')](_0xfe2c('0x81'))[_0xfe2c('0x82')]('team_has_voice_prefixes','tq')[_0xfe2c('0x83')](_0xfe2c('0x84'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfe2c('0x3d')](_0xfe2c('0x85'),_0x3027f9['params']['id']);for(var _0x3b6535=0x0;_0x3b6535<_0x5cbd7f[_0xfe2c('0x39')];_0x3b6535+=0x1){let _0x1d712e=_0x5cbd7f[_0x3b6535];for(var _0x14696e=0x0;_0x14696e<_0x1d712e[_0xfe2c('0x76')][_0xfe2c('0x39')];_0x14696e+=0x1){let _0x252527=_0x1d712e[_0xfe2c('0x76')][_0x14696e];var _0x1c0877=_0x6efab6[_0xfe2c('0x86')]();_0x1c0877[_0xfe2c('0x3d')](_0xfe2c('0x87'),_0x252527['id']);_0x4dd915[_0xfe2c('0x60')](db[_0xfe2c('0x4b')][_0xfe2c('0x33')](_0x1c0877[_0xfe2c('0x88')](),{'type':db['sequelize'][_0xfe2c('0x89')]['SELECT']})[_0xfe2c('0x23')](function(_0x5f3a0f){if(_0x5f3a0f[_0xfe2c('0x39')]===0x1){return _0x252527['id'];}else{var _0x329de0=_[_0xfe2c('0x8a')](_[_0xfe2c('0x2c')](_0x5f3a0f,_0xfe2c('0x8b')),function(_0x5b6e4f){return _[_0xfe2c('0x8c')](_0x3dba12,_0x5b6e4f);});if(_0x329de0){return _0x252527['id'];}}}));}}return BPromise[_0xfe2c('0x8d')](_0x4dd915)[_0xfe2c('0x23')](function(_0x57d173){_0x40be3c=_(_0x40be3c)['union'](_0x57d173)[_0xfe2c('0x8e')]()[_0xfe2c('0x8f')]();return db['VoicePrefix'][_0xfe2c('0x48')]({'where':{'id':_0x3027f9[_0xfe2c('0x46')]['id']}})[_0xfe2c('0x23')](function(_0x2f3af6){return db[_0xfe2c('0x4b')]['transaction'](function(_0x36abbf){return _0x2f3af6[_0xfe2c('0x7f')](_0x3027f9[_0xfe2c('0x33')][_0xfe2c('0x6a')],{'transaction':_0x36abbf})[_0xfe2c('0x23')](function(){if(!_[_0xfe2c('0x90')](_0x40be3c)){return _0x2f3af6[_0xfe2c('0x91')](_0x40be3c,{'transaction':_0x36abbf});}})[_0xfe2c('0x23')](function(){_0x40be3c['forEach'](function(_0x29c9ef){socket['emit'](_0xfe2c('0x6e'),{'UserId':_0x29c9ef,'VoicePrefixId':_0x2f3af6['id']});});});});});});})[_0xfe2c('0x23')](respondWithStatusCode(_0x3d6fba,null))[_0xfe2c('0x49')](handleError(_0x3d6fba,null));};
\ No newline at end of file
+var _0xed3c=['apply','save','then','destroy','get','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','keys','find','params','describe','create','sequelize','transaction','body','VoiceExtensionId','role','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','UserProfileResource','from-sip','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','update','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','findAll','Agents','interface','flatMap','each','upsert','UserVoicePrefix','forEach','Team','select','field','tq.TeamId','from','join','user_has_teams','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','union','compact','value','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x3b6d76,_0x47638c){var _0x25fa86=function(_0x370ba7){while(--_0x370ba7){_0x3b6d76['push'](_0x3b6d76['shift']());}};_0x25fa86(++_0x47638c);}(_0xed3c,0x1a6));var _0xced3=function(_0x544ec1,_0x2814eb){_0x544ec1=_0x544ec1-0x0;var _0x31e735=_0xed3c[_0x544ec1];return _0x31e735;};'use strict';var emlformat=require(_0xced3('0x0'));var rimraf=require(_0xced3('0x1'));var zipdir=require(_0xced3('0x2'));var jsonpatch=require(_0xced3('0x3'));var rp=require('request-promise');var moment=require(_0xced3('0x4'));var BPromise=require(_0xced3('0x5'));var Mustache=require(_0xced3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xced3('0x7'));var csv=require(_0xced3('0x8'));var ejs=require(_0xced3('0x9'));var fs=require('fs');var fs_extra=require(_0xced3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xced3('0x14'));var db=require(_0xced3('0x15'))['db'];config[_0xced3('0x16')]=_[_0xced3('0x17')](config[_0xced3('0x16')],{'host':_0xced3('0x18'),'port':0x18eb});var socket=require(_0xced3('0x19'))(new Redis(config['redis']));require(_0xced3('0x1a'))['register'](socket);function respondWithStatusCode(_0xf2db6f,_0x435616){_0x435616=_0x435616||0xcc;return function(_0x20d099){if(_0x20d099){return _0xf2db6f[_0xced3('0x1b')](_0x435616);}return _0xf2db6f['status'](_0x435616)[_0xced3('0x1c')]();};}function respondWithResult(_0x322c2d,_0x4acae6){_0x4acae6=_0x4acae6||0xc8;return function(_0x3b5962){if(_0x3b5962){return _0x322c2d[_0xced3('0x1d')](_0x4acae6)[_0xced3('0x1e')](_0x3b5962);}};}function respondWithFilteredResult(_0x17f611,_0x55dbd5){return function(_0x4569af){if(_0x4569af){var _0x4a3afe=typeof _0x55dbd5[_0xced3('0x1f')]===_0xced3('0x20')&&typeof _0x55dbd5[_0xced3('0x21')]===_0xced3('0x20');var _0x44143f=_0x4569af[_0xced3('0x22')];var _0xe0cf2e=_0x4a3afe?0x0:_0x55dbd5[_0xced3('0x1f')];var _0x3f688c=_0x4a3afe?_0x4569af[_0xced3('0x22')]:_0x55dbd5[_0xced3('0x1f')]+_0x55dbd5['limit'];var _0x5b8b1f;if(_0x3f688c>=_0x44143f){_0x3f688c=_0x44143f;_0x5b8b1f=0xc8;}else{_0x5b8b1f=0xce;}_0x17f611['status'](_0x5b8b1f);return _0x17f611[_0xced3('0x23')](_0xced3('0x24'),_0xe0cf2e+'-'+_0x3f688c+'/'+_0x44143f)[_0xced3('0x1e')](_0x4569af);}return null;};}function patchUpdates(_0x4bf915){return function(_0x19d15c){try{jsonpatch[_0xced3('0x25')](_0x19d15c,_0x4bf915,!![]);}catch(_0x526854){return BPromise['reject'](_0x526854);}return _0x19d15c[_0xced3('0x26')]();};}function saveUpdates(_0x101708,_0x219fa8){return function(_0x15c6c5){if(_0x15c6c5){return _0x15c6c5['update'](_0x101708)[_0xced3('0x27')](function(_0x23f92b){return _0x23f92b;});}return null;};}function removeEntity(_0x4fc285,_0x3fb4f9){return function(_0x4da7ce){if(_0x4da7ce){return _0x4da7ce[_0xced3('0x28')]()[_0xced3('0x27')](function(){var _0x3b728d=_0x4da7ce[_0xced3('0x29')]({'plain':!![]});var _0x2ec2c4='VoicePrefixes';return db['UserProfileResource'][_0xced3('0x28')]({'where':{'type':_0x2ec2c4,'resourceId':_0x3b728d['id']}})['then'](function(){return _0x4da7ce;});})[_0xced3('0x27')](function(){_0x4fc285[_0xced3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3db664,_0x4024fa){return function(_0x196956){if(!_0x196956){_0x3db664[_0xced3('0x1b')](0x194);}return _0x196956;};}function handleError(_0x4389f8,_0x38f594){_0x38f594=_0x38f594||0x1f4;return function(_0x895a32){logger[_0xced3('0x2a')](_0x895a32[_0xced3('0x2b')]);if(_0x895a32['name']){delete _0x895a32[_0xced3('0x2c')];}_0x4389f8[_0xced3('0x1d')](_0x38f594)[_0xced3('0x2d')](_0x895a32);};}exports[_0xced3('0x2e')]=function(_0x111769,_0x21e4a2){var _0x41ce44={},_0x4f2439={},_0xc8e557={'count':0x0,'rows':[]};var _0x30cd7f=_[_0xced3('0x2f')](db[_0xced3('0x30')][_0xced3('0x31')],function(_0x407a24){return{'name':_0x407a24[_0xced3('0x32')],'type':_0x407a24[_0xced3('0x33')][_0xced3('0x34')]};});_0x4f2439[_0xced3('0x35')]=_[_0xced3('0x2f')](_0x30cd7f,_0xced3('0x2c'));_0x4f2439[_0xced3('0x36')]=_['keys'](_0x111769[_0xced3('0x36')]);_0x4f2439['filters']=_[_0xced3('0x37')](_0x4f2439[_0xced3('0x35')],_0x4f2439[_0xced3('0x36')]);_0x41ce44[_0xced3('0x38')]=_[_0xced3('0x37')](_0x4f2439[_0xced3('0x35')],qs[_0xced3('0x39')](_0x111769[_0xced3('0x36')][_0xced3('0x39')]));_0x41ce44[_0xced3('0x38')]=_0x41ce44['attributes'][_0xced3('0x3a')]?_0x41ce44[_0xced3('0x38')]:_0x4f2439['model'];if(!_0x111769[_0xced3('0x36')][_0xced3('0x3b')](_0xced3('0x3c'))){_0x41ce44['limit']=qs['limit'](_0x111769[_0xced3('0x36')]['limit']);_0x41ce44[_0xced3('0x1f')]=qs[_0xced3('0x1f')](_0x111769['query'][_0xced3('0x1f')]);}_0x41ce44[_0xced3('0x3d')]=qs[_0xced3('0x3e')](_0x111769['query'][_0xced3('0x3e')]);_0x41ce44['where']=qs['filters'](_[_0xced3('0x3f')](_0x111769[_0xced3('0x36')],_0x4f2439[_0xced3('0x40')]),_0x30cd7f);if(_0x111769['query'][_0xced3('0x41')]){_0x41ce44[_0xced3('0x42')]=_[_0xced3('0x43')](_0x41ce44[_0xced3('0x42')],{'$or':_[_0xced3('0x2f')](_0x30cd7f,function(_0x2a8e0e){if(_0x2a8e0e[_0xced3('0x33')]!==_0xced3('0x44')){var _0x9c8a07={};_0x9c8a07[_0x2a8e0e[_0xced3('0x2c')]]={'$like':'%'+_0x111769[_0xced3('0x36')][_0xced3('0x41')]+'%'};return _0x9c8a07;}})});}_0x41ce44=_[_0xced3('0x43')]({},_0x41ce44,_0x111769[_0xced3('0x45')]);var _0x1ced3a={'where':_0x41ce44['where']};return db[_0xced3('0x30')][_0xced3('0x22')](_0x1ced3a)[_0xced3('0x27')](function(_0x1a6c1f){_0xc8e557[_0xced3('0x22')]=_0x1a6c1f;if(_0x111769[_0xced3('0x36')][_0xced3('0x46')]){_0x41ce44[_0xced3('0x47')]=[{'all':!![]}];}return db[_0xced3('0x30')]['findAll'](_0x41ce44);})[_0xced3('0x27')](function(_0x47ab23){_0xc8e557[_0xced3('0x48')]=_0x47ab23;return _0xc8e557;})[_0xced3('0x27')](respondWithFilteredResult(_0x21e4a2,_0x41ce44))[_0xced3('0x49')](handleError(_0x21e4a2,null));};exports['show']=function(_0x11e733,_0x34f24a){var _0x3569f3={'raw':![],'where':{'id':_0x11e733['params']['id']}},_0x26b8ac={};_0x26b8ac[_0xced3('0x35')]=_[_0xced3('0x4a')](db[_0xced3('0x30')][_0xced3('0x31')]);_0x26b8ac[_0xced3('0x36')]=_['keys'](_0x11e733[_0xced3('0x36')]);_0x26b8ac[_0xced3('0x40')]=_[_0xced3('0x37')](_0x26b8ac[_0xced3('0x35')],_0x26b8ac[_0xced3('0x36')]);_0x3569f3[_0xced3('0x38')]=_[_0xced3('0x37')](_0x26b8ac['model'],qs[_0xced3('0x39')](_0x11e733[_0xced3('0x36')]['fields']));_0x3569f3['attributes']=_0x3569f3[_0xced3('0x38')]['length']?_0x3569f3[_0xced3('0x38')]:_0x26b8ac[_0xced3('0x35')];if(_0x11e733[_0xced3('0x36')][_0xced3('0x46')]){_0x3569f3[_0xced3('0x47')]=[{'all':!![]}];}_0x3569f3=_[_0xced3('0x43')]({},_0x3569f3,_0x11e733[_0xced3('0x45')]);return db[_0xced3('0x30')][_0xced3('0x4b')](_0x3569f3)['then'](handleEntityNotFound(_0x34f24a,null))[_0xced3('0x27')](respondWithResult(_0x34f24a,null))[_0xced3('0x49')](handleError(_0x34f24a,null));};exports[_0xced3('0x28')]=function(_0x469b6,_0x24ee62){return db[_0xced3('0x30')]['find']({'where':{'id':_0x469b6[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x24ee62,null))[_0xced3('0x27')](removeEntity(_0x24ee62,null))[_0xced3('0x49')](handleError(_0x24ee62,null));};exports[_0xced3('0x4d')]=function(_0x14dbfe,_0x1543b0){return db[_0xced3('0x30')][_0xced3('0x4d')]()[_0xced3('0x27')](respondWithResult(_0x1543b0,null))[_0xced3('0x49')](handleError(_0x1543b0,null));};exports[_0xced3('0x4e')]=function(_0x4a9111,_0x1c69df){var _0x4bd3cb;return db[_0xced3('0x4f')][_0xced3('0x50')](function(_0xc93e05){return db['VoicePrefix']['create'](_0x4a9111[_0xced3('0x51')],{'transaction':_0xc93e05})[_0xced3('0x27')](function(_0x53724a){_0x4bd3cb=_0x53724a[_0xced3('0x29')]({'plain':!![]});return db['VoiceExtension'][_0xced3('0x4b')]({'where':{'id':_0x4bd3cb[_0xced3('0x52')]},'raw':!![]})['then'](function(_0x1627f9){return createVoicePrefixExtensions(_0x4bd3cb,_0x1627f9,_0xc93e05);});});})[_0xced3('0x27')](function(){var _0xf4d7bf=_0x4a9111['user'][_0xced3('0x29')]({'plain':!![]});if(!_0xf4d7bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf4d7bf[_0xced3('0x53')]===_0xced3('0x54')){var _0x4694b8=_0x4bd3cb;return db[_0xced3('0x55')][_0xced3('0x4b')]({'where':{'name':_0xced3('0x56'),'userProfileId':_0xf4d7bf[_0xced3('0x57')]},'raw':!![]})[_0xced3('0x27')](function(_0x1b2592){if(_0x1b2592&&_0x1b2592[_0xced3('0x58')]===0x0){return db[_0xced3('0x59')]['create']({'name':_0x4694b8[_0xced3('0x2c')],'resourceId':_0x4694b8['id'],'type':_0x1b2592[_0xced3('0x2c')],'sectionId':_0x1b2592['id']},{})[_0xced3('0x27')](function(){return _0x4bd3cb;});}else{return _0x4bd3cb;}})[_0xced3('0x49')](function(_0x21a22d){logger[_0xced3('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21a22d);throw _0x21a22d;});}return _0x4bd3cb;})[_0xced3('0x27')](respondWithResult(_0x1c69df,null))[_0xced3('0x49')](handleError(_0x1c69df,null));};function Extension(_0x21ea6a,_0x440a0f,_0x443469,_0x1537ca){this['context']=_0xced3('0x5a');this['exten']=_0x21ea6a;this[_0xced3('0x5b')]=_0x443469;this['type']=_0xced3('0x5c');this[_0xced3('0x5d')]='Voice\x20Prefix\x20Extension';this[_0xced3('0x5e')]=_0x440a0f;this[_0xced3('0x5f')]=_0x1537ca;}function createVoicePrefixExtensions(_0x76d1f6,_0x3bb7d5,_0x1ec94b){return new BPromise(function(_0x21eeec,_0x2318a0){var _0x206dd3=new Extension(formatPrefixName(_0x76d1f6[_0xced3('0x60')]),0x1,_0xced3('0x61'),_0xced3('0x62'));_0x206dd3[_0xced3('0x63')]=_0x76d1f6['id'];return db[_0xced3('0x64')]['create'](_0x206dd3,{'transaction':_0x1ec94b})[_0xced3('0x27')](function(_0xb2b5d7){var _0x2857c8=_0xb2b5d7[_0xced3('0x29')]({'plain':!![]});var _0x4f8a3f=_[_0xced3('0x2f')](addVoicePrefixExtensions(_0x76d1f6,_0x3bb7d5),function(_0x979b24){_0x979b24[_0xced3('0x52')]=_0x2857c8['id'];_0x979b24[_0xced3('0x63')]=_0x76d1f6['id'];return _0x979b24;});return db[_0xced3('0x64')][_0xced3('0x65')](_0x4f8a3f,{'transaction':_0x1ec94b})[_0xced3('0x27')](function(_0x4df923){if(!_0x4df923){return _0x2318a0(_0xced3('0x66'));}else{return _0x21eeec(_0x4df923);}})[_0xced3('0x49')](function(_0x5db4eb){return _0x2318a0(_0x5db4eb);});});;});};function addVoicePrefixExtensions(_0x1630d7,_0xde15b5){var _0x3a9dac=[];var _0x2ac060=formatPrefixName(_0x1630d7['prefix']);_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x2,_0xced3('0x68'),_0xced3('0x69')+_0x1630d7[_0xced3('0x2c')]));if(_0x1630d7[_0xced3('0x6a')]){_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x3,_0xced3('0x68'),_0xced3('0x6b')+_0x1630d7[_0xced3('0x6a')]));}else{_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x3,'NoOp',_0xced3('0x6c')));}_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x4,'goto',_0xde15b5['context']+','+_0xced3('0x6d')+(0x8+_0x1630d7['name'][_0xced3('0x3a')])+'}'+','+0x1));return _0x3a9dac;}function formatPrefixName(_0x256216){var _0x5e3d3d='_';for(var _0x2936b5=0x0;_0x2936b5<_0x256216[_0xced3('0x3a')];_0x2936b5++){if(_0x256216['charAt'](_0x2936b5)=='-'){_0x5e3d3d+=_0x256216[_0xced3('0x6e')](_0x2936b5);}else{_0x5e3d3d+='['+_0x256216['charAt'](_0x2936b5)+']';}}_0x5e3d3d+='.';return _0x5e3d3d;}exports[_0xced3('0x6f')]=function(_0x58b66b,_0xf8ccc6,_0x3c9de8){var _0x11f393=_0x58b66b['body'];_0x11f393[_0xced3('0x60')]=_0xced3('0x70')+_0x11f393[_0xced3('0x2c')]+'-';return db['sequelize'][_0xced3('0x50')](function(_0x1abe1a){return db[_0xced3('0x30')][_0xced3('0x6f')](_0x11f393,{'where':{'id':_0x11f393['id']},'transaction':_0x1abe1a})['then'](function(){return db['VoiceExtension'][_0xced3('0x28')]({'where':{'VoicePrefixId':_0x11f393['id']},'transaction':_0x1abe1a})[_0xced3('0x27')](function(){return db[_0xced3('0x64')][_0xced3('0x4b')]({'where':{'id':_0x11f393[_0xced3('0x52')]},'raw':!![]})[_0xced3('0x27')](function(_0x55da18){return createVoicePrefixExtensions(_0x11f393,_0x55da18,_0x1abe1a);});});});})[_0xced3('0x27')](function(){return db['VoicePrefix'][_0xced3('0x71')](_0x11f393['id']);})[_0xced3('0x27')](respondWithResult(_0xf8ccc6,null))[_0xced3('0x49')](handleError(_0xf8ccc6,null));};exports[_0xced3('0x72')]=function(_0x569055,_0x24d0ad,_0x22e74d){return db['VoicePrefix']['find']({'where':{'id':_0x569055[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x24d0ad,null))[_0xced3('0x27')](function(_0x138e25){if(_0x138e25){return _0x138e25[_0xced3('0x72')](_0x569055['body'][_0xced3('0x73')],_[_0xced3('0x74')](_0x569055[_0xced3('0x51')],[_0xced3('0x73'),'id'])||{})['spread'](function(_0x13020d){for(var _0x1777eb=0x0;_0x1777eb<_0x569055[_0xced3('0x51')][_0xced3('0x73')][_0xced3('0x3a')];_0x1777eb+=0x1){socket[_0xced3('0x75')](_0xced3('0x76'),{'UserId':Number(_0x569055[_0xced3('0x51')][_0xced3('0x73')][_0x1777eb]),'VoicePrefixId':Number(_0x569055[_0xced3('0x4c')]['id'])});}return _0x13020d;});}})['then'](respondWithResult(_0x24d0ad,null))[_0xced3('0x49')](handleError(_0x24d0ad,null));};exports[_0xced3('0x77')]=function(_0x498ea9,_0x284cf2,_0xeef6f4){return db[_0xced3('0x30')][_0xced3('0x4b')]({'where':{'id':_0x498ea9[_0xced3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x284cf2,null))[_0xced3('0x27')](function(_0x3e561e){if(_0x3e561e){return _0x3e561e['removeAgents'](_0x498ea9[_0xced3('0x36')][_0xced3('0x73')])[_0xced3('0x27')](function(){if(_[_0xced3('0x78')](_0x498ea9[_0xced3('0x36')][_0xced3('0x73')])){for(var _0x5c68e1=0x0;_0x5c68e1<_0x498ea9[_0xced3('0x36')][_0xced3('0x73')][_0xced3('0x3a')];_0x5c68e1+=0x1){socket[_0xced3('0x75')](_0xced3('0x79'),{'UserId':Number(_0x498ea9[_0xced3('0x36')]['ids'][_0x5c68e1]),'VoicePrefixId':Number(_0x498ea9['params']['id'])});}}else{socket[_0xced3('0x75')](_0xced3('0x79'),{'UserId':Number(_0x498ea9[_0xced3('0x36')][_0xced3('0x73')]),'VoicePrefixId':Number(_0x498ea9[_0xced3('0x4c')]['id'])});}});}})[_0xced3('0x27')](respondWithStatusCode(_0x284cf2,null))[_0xced3('0x49')](handleError(_0x284cf2,null));};exports['getAgents']=function(_0x3d64ec,_0x290ca3,_0x51979a){var _0x5de22d={};var _0x12de12={};var _0x29f8b5;var _0x3b07ac;return db[_0xced3('0x30')][_0xced3('0x7a')]({'where':{'id':_0x3d64ec['params']['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x290ca3,null))['then'](function(_0x34edbf){if(_0x34edbf){_0x29f8b5=_0x34edbf;_0x12de12[_0xced3('0x35')]=_[_0xced3('0x4a')](db[_0xced3('0x7b')][_0xced3('0x31')]);_0x12de12['query']=_[_0xced3('0x4a')](_0x3d64ec[_0xced3('0x36')]);_0x12de12[_0xced3('0x40')]=_[_0xced3('0x37')](_0x12de12['model'],_0x12de12['query']);_0x5de22d[_0xced3('0x38')]=_[_0xced3('0x37')](_0x12de12[_0xced3('0x35')],qs[_0xced3('0x39')](_0x3d64ec[_0xced3('0x36')][_0xced3('0x39')]));_0x5de22d[_0xced3('0x38')]=_0x5de22d[_0xced3('0x38')]['length']?_0x5de22d['attributes']:_0x12de12[_0xced3('0x35')];_0x5de22d[_0xced3('0x3d')]=qs[_0xced3('0x3e')](_0x3d64ec[_0xced3('0x36')][_0xced3('0x3e')]);_0x5de22d[_0xced3('0x42')]=qs[_0xced3('0x40')](_[_0xced3('0x3f')](_0x3d64ec[_0xced3('0x36')],_0x12de12[_0xced3('0x40')]));if(_0x3d64ec[_0xced3('0x36')]['filter']){_0x5de22d[_0xced3('0x42')]=_['merge'](_0x5de22d[_0xced3('0x42')],{'$or':_[_0xced3('0x2f')](_0x5de22d[_0xced3('0x38')],function(_0x3ad616){var _0x1df2d1={};_0x1df2d1[_0x3ad616]={'$like':'%'+_0x3d64ec[_0xced3('0x36')][_0xced3('0x41')]+'%'};return _0x1df2d1;})});}_0x5de22d=_[_0xced3('0x43')]({},_0x5de22d,_0x3d64ec[_0xced3('0x45')]);return _0x29f8b5[_0xced3('0x7c')](_0x5de22d);}})[_0xced3('0x27')](function(_0x3869f3){if(_0x3869f3){_0x3b07ac=_0x3869f3[_0xced3('0x3a')];if(!_0x3d64ec[_0xced3('0x36')][_0xced3('0x3b')](_0xced3('0x3c'))){_0x5de22d[_0xced3('0x21')]=qs['limit'](_0x3d64ec['query']['limit']);_0x5de22d[_0xced3('0x1f')]=qs[_0xced3('0x1f')](_0x3d64ec[_0xced3('0x36')][_0xced3('0x1f')]);}return _0x29f8b5[_0xced3('0x7c')](_0x5de22d);}})[_0xced3('0x27')](function(_0x587891){if(_0x587891){return _0x587891?{'count':_0x3b07ac,'rows':_0x587891}:null;}})[_0xced3('0x27')](respondWithResult(_0x290ca3,null))[_0xced3('0x49')](handleError(_0x290ca3,null));};exports['getTeams']=function(_0x5e6a80,_0x451c1a,_0x3284da){var _0x34ebbd={};var _0x4412cc={};var _0x3e5f7f;var _0x3b3a5c;return db['VoicePrefix'][_0xced3('0x7a')]({'where':{'id':_0x5e6a80['params']['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x451c1a,null))[_0xced3('0x27')](function(_0x44a80b){if(_0x44a80b){_0x3e5f7f=_0x44a80b;_0x4412cc['model']=_['keys'](db['Team'][_0xced3('0x31')]);_0x4412cc[_0xced3('0x36')]=_['keys'](_0x5e6a80[_0xced3('0x36')]);_0x4412cc[_0xced3('0x40')]=_['intersection'](_0x4412cc[_0xced3('0x35')],_0x4412cc[_0xced3('0x36')]);_0x34ebbd[_0xced3('0x38')]=_[_0xced3('0x37')](_0x4412cc[_0xced3('0x35')],qs[_0xced3('0x39')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x39')]));_0x34ebbd['attributes']=_0x34ebbd[_0xced3('0x38')][_0xced3('0x3a')]?_0x34ebbd[_0xced3('0x38')]:_0x4412cc[_0xced3('0x35')];_0x34ebbd[_0xced3('0x3d')]=qs[_0xced3('0x3e')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x3e')]);_0x34ebbd[_0xced3('0x42')]=qs[_0xced3('0x40')](_[_0xced3('0x3f')](_0x5e6a80[_0xced3('0x36')],_0x4412cc[_0xced3('0x40')]));if(_0x5e6a80[_0xced3('0x36')][_0xced3('0x41')]){_0x34ebbd['where']=_[_0xced3('0x43')](_0x34ebbd[_0xced3('0x42')],{'$or':_[_0xced3('0x2f')](_0x34ebbd[_0xced3('0x38')],function(_0x2c59f5){var _0x5874b5={};_0x5874b5[_0x2c59f5]={'$like':'%'+_0x5e6a80['query'][_0xced3('0x41')]+'%'};return _0x5874b5;})});}_0x34ebbd=_[_0xced3('0x43')]({},_0x34ebbd,_0x5e6a80[_0xced3('0x45')]);return _0x3e5f7f[_0xced3('0x7d')](_0x34ebbd);}})[_0xced3('0x27')](function(_0x26920d){if(_0x26920d){_0x3b3a5c=_0x26920d[_0xced3('0x3a')];if(!_0x5e6a80['query']['hasOwnProperty'](_0xced3('0x3c'))){_0x34ebbd['limit']=qs[_0xced3('0x21')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x21')]);_0x34ebbd[_0xced3('0x1f')]=qs[_0xced3('0x1f')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x1f')]);}return _0x3e5f7f[_0xced3('0x7d')](_0x34ebbd);}})[_0xced3('0x27')](function(_0x2b688c){if(_0x2b688c){return _0x2b688c?{'count':_0x3b3a5c,'rows':_0x2b688c}:null;}})[_0xced3('0x27')](respondWithResult(_0x451c1a,null))[_0xced3('0x49')](handleError(_0x451c1a,null));};exports[_0xced3('0x7e')]=function(_0xbd91ef,_0x561aca,_0x4b2f62){var _0x361c6f=_0xbd91ef['body'][_0xced3('0x73')];var _0x4f0fcb;return db['Team'][_0xced3('0x7f')]({'where':{'id':_0x361c6f},'attributes':['id'],'include':[{'model':db[_0xced3('0x7b')],'as':_0xced3('0x80'),'attributes':['id',_0xced3('0x2c'),'online','voicePause',_0xced3('0x81')],'raw':!![]}]})[_0xced3('0x27')](function(_0x2f2f77){if(_0x2f2f77){_0x4f0fcb=_0x2f2f77;var _0x5448d5=_[_0xced3('0x82')](_0x2f2f77,function(_0x50cc83){var _0x4b6afc=_0x50cc83[_0xced3('0x29')]({'plain':!![]});return _0x4b6afc[_0xced3('0x80')];});return db[_0xced3('0x30')][_0xced3('0x4b')]({'where':{'id':_0xbd91ef[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](function(_0x420c12){return db[_0xced3('0x4f')]['transaction'](function(_0x566191){return _0x420c12[_0xced3('0x7e')](_0x361c6f,{'transaction':_0x566191})['then'](function(){return BPromise[_0xced3('0x83')](_0x4f0fcb,function(_0x239dda){return db['TeamVoicePrefix'][_0xced3('0x84')]({'TeamId':_0x239dda['id'],'VoicePrefixId':_0xbd91ef[_0xced3('0x4c')]['id']},{'transaction':_0x566191});});})[_0xced3('0x27')](function(){return BPromise[_0xced3('0x83')](_0x5448d5,function(_0x7fb3c7){return db[_0xced3('0x85')]['findOrCreate']({'where':{'UserId':_0x7fb3c7['id'],'VoicePrefixId':_0xbd91ef[_0xced3('0x4c')]['id']},'transaction':_0x566191});});})[_0xced3('0x27')](function(){_0x5448d5[_0xced3('0x86')](function(_0x3d88fc){socket[_0xced3('0x75')](_0xced3('0x76'),{'UserId':_0x3d88fc['id'],'VoicePrefixId':_0x420c12['id']});});});});});}})['then'](respondWithStatusCode(_0x561aca,null))['catch'](handleError(_0x561aca,null));};exports['removeTeams']=function(_0x4074b9,_0x2e2303,_0x26af34){return db[_0xced3('0x87')][_0xced3('0x7f')]({'where':{'id':_0x4074b9['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xced3('0x7b')],'as':_0xced3('0x80'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2e2303,null))['then'](function(_0xdec3b0){var _0x38a06b=_[_0xced3('0x2f')](_0xdec3b0,'id');var _0xbeffe6=[];var _0x2211ed=[];var _0x22ab59=squel[_0xced3('0x88')]();_0x22ab59[_0xced3('0x89')](_0xced3('0x8a'))[_0xced3('0x8b')]('team_has_voice_prefixes','tq')[_0xced3('0x8c')](_0xced3('0x8d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xced3('0x42')](_0xced3('0x8e'),_0x4074b9[_0xced3('0x4c')]['id']);for(var _0x268c72=0x0;_0x268c72<_0xdec3b0[_0xced3('0x3a')];_0x268c72+=0x1){let _0x26daab=_0xdec3b0[_0x268c72];for(var _0x1ab60d=0x0;_0x1ab60d<_0x26daab[_0xced3('0x80')]['length'];_0x1ab60d+=0x1){let _0x5dd10b=_0x26daab[_0xced3('0x80')][_0x1ab60d];var _0x173a37=_0x22ab59['clone']();_0x173a37[_0xced3('0x42')](_0xced3('0x8f'),_0x5dd10b['id']);_0x2211ed[_0xced3('0x67')](db[_0xced3('0x4f')][_0xced3('0x36')](_0x173a37[_0xced3('0x90')](),{'type':db['sequelize'][_0xced3('0x91')]['SELECT']})['then'](function(_0x2ed48f){if(_0x2ed48f[_0xced3('0x3a')]===0x1){return _0x5dd10b['id'];}else{var _0x21f013=_[_0xced3('0x92')](_['map'](_0x2ed48f,_0xced3('0x93')),function(_0x1082c0){return _['includes'](_0x38a06b,_0x1082c0);});if(_0x21f013){return _0x5dd10b['id'];}}}));}}return BPromise['all'](_0x2211ed)['then'](function(_0x3e8ed7){_0xbeffe6=_(_0xbeffe6)[_0xced3('0x94')](_0x3e8ed7)[_0xced3('0x95')]()[_0xced3('0x96')]();return db[_0xced3('0x30')][_0xced3('0x4b')]({'where':{'id':_0x4074b9[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](function(_0x235faa){return db[_0xced3('0x4f')]['transaction'](function(_0x5e9fba){return _0x235faa[_0xced3('0x97')](_0x4074b9[_0xced3('0x36')]['ids'],{'transaction':_0x5e9fba})['then'](function(){if(!_[_0xced3('0x98')](_0xbeffe6)){return _0x235faa[_0xced3('0x77')](_0xbeffe6,{'transaction':_0x5e9fba});}})[_0xced3('0x27')](function(){_0xbeffe6['forEach'](function(_0x473c70){socket['emit'](_0xced3('0x79'),{'UserId':_0x473c70,'VoicePrefixId':_0x235faa['id']});});});});});});})['then'](respondWithStatusCode(_0x2e2303,null))[_0xced3('0x49')](handleError(_0x2e2303,null));};
\ No newline at end of file
index 5f1ca36..5eb0584 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x977b=['hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x130c63,_0x5a5936){var _0x3c5a36=function(_0x376bb7){while(--_0x376bb7){_0x130c63['push'](_0x130c63['shift']());}};_0x3c5a36(++_0x5a5936);}(_0x977b,0x84));var _0xb977=function(_0x4eeb0d,_0x4f625f){_0x4eeb0d=_0x4eeb0d-0x0;var _0x21f381=_0x977b[_0x4eeb0d];return _0x21f381;};'use strict';var EventEmitter=require(_0xb977('0x0'));var VoicePrefix=require(_0xb977('0x1'))['db'][_0xb977('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xb977('0x3')](0x0);var events={'afterCreate':_0xb977('0x4'),'afterUpdate':_0xb977('0x5'),'afterDestroy':_0xb977('0x6')};function emitEvent(_0x814aee){return function(_0x1dd5c6,_0x23fcad,_0x156f30){VoicePrefixEvents['emit'](_0x814aee+':'+_0x1dd5c6['id'],_0x1dd5c6);VoicePrefixEvents['emit'](_0x814aee,_0x1dd5c6);_0x156f30(null);};}for(var e in events){if(events[_0xb977('0x7')](e)){var event=events[e];VoicePrefix[_0xb977('0x8')](e,emitEvent(event));}}module[_0xb977('0x9')]=VoicePrefixEvents;
\ No newline at end of file
+var _0x506c=['hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x28983a,_0x55c4b0){var _0x2d5a53=function(_0xbbb348){while(--_0xbbb348){_0x28983a['push'](_0x28983a['shift']());}};_0x2d5a53(++_0x55c4b0);}(_0x506c,0x1e2));var _0xc506=function(_0x56f57e,_0x16c24c){_0x56f57e=_0x56f57e-0x0;var _0x65cafb=_0x506c[_0x56f57e];return _0x65cafb;};'use strict';var EventEmitter=require(_0xc506('0x0'));var VoicePrefix=require(_0xc506('0x1'))['db'][_0xc506('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc506('0x3')](0x0);var events={'afterCreate':_0xc506('0x4'),'afterUpdate':_0xc506('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5c4255){return function(_0x3068cf,_0x1635dd,_0x26e801){VoicePrefixEvents[_0xc506('0x6')](_0x5c4255+':'+_0x3068cf['id'],_0x3068cf);VoicePrefixEvents[_0xc506('0x6')](_0x5c4255,_0x3068cf);_0x26e801(null);};}for(var e in events){if(events[_0xc506('0x7')](e)){var event=events[e];VoicePrefix[_0xc506('0x8')](e,emitEvent(event));}}module[_0xc506('0x9')]=VoicePrefixEvents;
\ No newline at end of file
index c49e64f..e4110e8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8b03=['rimraf','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x34dc15,_0x306336){var _0x174f2d=function(_0x19c5b5){while(--_0x19c5b5){_0x34dc15['push'](_0x34dc15['shift']());}};_0x174f2d(++_0x306336);}(_0x8b03,0x11e));var _0x38b0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b03[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x38b0('0x0'));var util=require(_0x38b0('0x1'));var logger=require(_0x38b0('0x2'))(_0x38b0('0x3'));var moment=require(_0x38b0('0x4'));var BPromise=require(_0x38b0('0x5'));var rp=require(_0x38b0('0x6'));var fs=require('fs');var path=require(_0x38b0('0x7'));var rimraf=require(_0x38b0('0x8'));var config=require(_0x38b0('0x9'));var attributes=require(_0x38b0('0xa'));module[_0x38b0('0xb')]=function(_0x25ce97,_0x543de8){return _0x25ce97[_0x38b0('0xc')]('VoicePrefix',attributes,{'tableName':_0x38b0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x21a2=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','util'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x21a2,0xca));var _0x221a=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x21a2[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x221a('0x0'));var util=require(_0x221a('0x1'));var logger=require(_0x221a('0x2'))('api');var moment=require(_0x221a('0x3'));var BPromise=require(_0x221a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x221a('0x5'));var rimraf=require(_0x221a('0x6'));var config=require(_0x221a('0x7'));var attributes=require(_0x221a('0x8'));module['exports']=function(_0x2baf5e,_0x377476){return _0x2baf5e[_0x221a('0x9')](_0x221a('0xa'),attributes,{'tableName':_0x221a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 15da2a8..1bc9b99 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2b29=['code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x2ff995,_0x1c649c){var _0x1602f3=function(_0xca94c6){while(--_0xca94c6){_0x2ff995['push'](_0x2ff995['shift']());}};_0x1602f3(++_0x1c649c);}(_0x2b29,0x163));var _0x92b2=function(_0x49b558,_0x51f677){_0x49b558=_0x49b558-0x0;var _0x4f3cea=_0x2b29[_0x49b558];return _0x4f3cea;};'use strict';var _=require('lodash');var util=require(_0x92b2('0x0'));var moment=require(_0x92b2('0x1'));var BPromise=require(_0x92b2('0x2'));var rs=require(_0x92b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92b2('0x4'))['db'];var utils=require(_0x92b2('0x5'));var logger=require(_0x92b2('0x6'))(_0x92b2('0x7'));var config=require(_0x92b2('0x8'));var jayson=require(_0x92b2('0x9'));var client=jayson['client'][_0x92b2('0xa')]({'port':0x232a});config['redis']=_[_0x92b2('0xb')](config[_0x92b2('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x92b2('0xd'))(new Redis(config[_0x92b2('0xc')]));require(_0x92b2('0xe'))[_0x92b2('0xf')](socket);function respondWithRpcPromise(_0x592c9e,_0x2b17de,_0x21bbf5){return new BPromise(function(_0x187eab,_0x1ef7f3){return client[_0x92b2('0x10')](_0x592c9e,_0x21bbf5)[_0x92b2('0x11')](function(_0xa18d4e){logger['info'](_0x92b2('0x12'),_0x2b17de,_0x92b2('0x13'));logger[_0x92b2('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2b17de,_0x92b2('0x13'),JSON[_0x92b2('0x15')](_0xa18d4e));if(_0xa18d4e[_0x92b2('0x16')]){if(_0xa18d4e[_0x92b2('0x16')][_0x92b2('0x17')]===0x1f4){logger[_0x92b2('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x2b17de,_0xa18d4e[_0x92b2('0x16')]['message']);return _0x1ef7f3(_0xa18d4e[_0x92b2('0x16')][_0x92b2('0x18')]);}logger[_0x92b2('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x2b17de,_0xa18d4e['error'][_0x92b2('0x18')]);return _0x187eab(_0xa18d4e['error'][_0x92b2('0x18')]);}else{logger['info'](_0x92b2('0x12'),_0x2b17de,_0x92b2('0x13'));_0x187eab(_0xa18d4e[_0x92b2('0x19')][_0x92b2('0x18')]);}})[_0x92b2('0x1a')](function(_0x3dfd47){logger[_0x92b2('0x16')](_0x92b2('0x12'),_0x2b17de,_0x3dfd47);_0x1ef7f3(_0x3dfd47);});});}
\ No newline at end of file
+var _0x363e=['localhost','socket.io-emitter','./voicePrefix.socket','register','then','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x35e361,_0x93be6b){var _0x38d9be=function(_0x245017){while(--_0x245017){_0x35e361['push'](_0x35e361['shift']());}};_0x38d9be(++_0x93be6b);}(_0x363e,0x179));var _0xe363=function(_0x429608,_0x33aef4){_0x429608=_0x429608-0x0;var _0x2fa9b7=_0x363e[_0x429608];return _0x2fa9b7;};'use strict';var _=require(_0xe363('0x0'));var util=require(_0xe363('0x1'));var moment=require('moment');var BPromise=require(_0xe363('0x2'));var rs=require(_0xe363('0x3'));var fs=require('fs');var Redis=require(_0xe363('0x4'));var db=require(_0xe363('0x5'))['db'];var utils=require(_0xe363('0x6'));var logger=require(_0xe363('0x7'))(_0xe363('0x8'));var config=require(_0xe363('0x9'));var jayson=require(_0xe363('0xa'));var client=jayson[_0xe363('0xb')][_0xe363('0xc')]({'port':0x232a});config['redis']=_[_0xe363('0xd')](config[_0xe363('0xe')],{'host':_0xe363('0xf'),'port':0x18eb});var socket=require(_0xe363('0x10'))(new Redis(config['redis']));require(_0xe363('0x11'))[_0xe363('0x12')](socket);function respondWithRpcPromise(_0x18cfa8,_0x46076b,_0x29a78c){return new BPromise(function(_0x4133e9,_0x3304a1){return client['request'](_0x18cfa8,_0x29a78c)[_0xe363('0x13')](function(_0x45cd96){logger['info'](_0xe363('0x14'),_0x46076b,'request\x20sent');logger['debug'](_0xe363('0x15'),_0x46076b,_0xe363('0x16'),JSON[_0xe363('0x17')](_0x45cd96));if(_0x45cd96[_0xe363('0x18')]){if(_0x45cd96[_0xe363('0x18')]['code']===0x1f4){logger[_0xe363('0x18')](_0xe363('0x14'),_0x46076b,_0x45cd96['error'][_0xe363('0x19')]);return _0x3304a1(_0x45cd96[_0xe363('0x18')]['message']);}logger[_0xe363('0x18')](_0xe363('0x14'),_0x46076b,_0x45cd96['error'][_0xe363('0x19')]);return _0x4133e9(_0x45cd96[_0xe363('0x18')]['message']);}else{logger[_0xe363('0x1a')](_0xe363('0x14'),_0x46076b,_0xe363('0x16'));_0x4133e9(_0x45cd96['result'][_0xe363('0x19')]);}})[_0xe363('0x1b')](function(_0x5177f4){logger[_0xe363('0x18')](_0xe363('0x14'),_0x46076b,_0x5177f4);_0x3304a1(_0x5177f4);});});}
\ No newline at end of file
index d07c5c6..ba0f798 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xda3f=['voicePrefix:','save','remove','register','length'];(function(_0x51bbb3,_0x324911){var _0x18bf9c=function(_0x19145a){while(--_0x19145a){_0x51bbb3['push'](_0x51bbb3['shift']());}};_0x18bf9c(++_0x324911);}(_0xda3f,0xec));var _0xfda3=function(_0x2c5a13,_0x1e291c){_0x2c5a13=_0x2c5a13-0x0;var _0x47fd03=_0xda3f[_0x2c5a13];return _0x47fd03;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xfda3('0x0'),_0xfda3('0x1'),'update'];function createListener(_0x5299b0,_0x5d7071){return function(_0x3859fe){_0x5d7071['emit'](_0x5299b0,_0x3859fe);};}function removeListener(_0x36dc71,_0x22187d){return function(){VoicePrefixEvents['removeListener'](_0x36dc71,_0x22187d);};}exports[_0xfda3('0x2')]=function(_0x43a010){for(var _0x47e7e2=0x0,_0x4e72d1=events[_0xfda3('0x3')];_0x47e7e2<_0x4e72d1;_0x47e7e2++){var _0x42476a=events[_0x47e7e2];var _0x125e2a=createListener(_0xfda3('0x4')+_0x42476a,_0x43a010);VoicePrefixEvents['on'](_0x42476a,_0x125e2a);}};
\ No newline at end of file
+var _0xbde2=['length','voicePrefix:','save','remove','update','emit','removeListener','register'];(function(_0x57fca6,_0x497213){var _0x1f2800=function(_0x3333b8){while(--_0x3333b8){_0x57fca6['push'](_0x57fca6['shift']());}};_0x1f2800(++_0x497213);}(_0xbde2,0x7a));var _0x2bde=function(_0x150970,_0x7b713e){_0x150970=_0x150970-0x0;var _0x40b1f3=_0xbde2[_0x150970];return _0x40b1f3;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x2bde('0x0'),_0x2bde('0x1'),_0x2bde('0x2')];function createListener(_0x4efae2,_0x3b1018){return function(_0x1055e2){_0x3b1018[_0x2bde('0x3')](_0x4efae2,_0x1055e2);};}function removeListener(_0x530c9f,_0x3622bb){return function(){VoicePrefixEvents[_0x2bde('0x4')](_0x530c9f,_0x3622bb);};}exports[_0x2bde('0x5')]=function(_0x3b3039){for(var _0x50c1a1=0x0,_0x30d926=events[_0x2bde('0x6')];_0x50c1a1<_0x30d926;_0x50c1a1++){var _0x39522f=events[_0x50c1a1];var _0x3ddbc4=createListener(_0x2bde('0x7')+_0x39522f,_0x3b3039);VoicePrefixEvents['on'](_0x39522f,_0x3ddbc4);}};
\ No newline at end of file
index 12471f1..8cebcbf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x12723c,_0x148a5a){var _0x3fc804=function(_0x810da6){while(--_0x810da6){_0x12723c['push'](_0x12723c['shift']());}};_0x3fc804(++_0x148a5a);}(_0xb10b,0x12a));var _0xbb10=function(_0x3878bd,_0x51e3e5){_0x3878bd=_0x3878bd-0x0;var _0x359e60=_0xb10b[_0x3878bd];return _0x359e60;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router;
\ No newline at end of file
+var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x2575eb,_0x456f3f){var _0x1c49da=function(_0x32dcb1){while(--_0x32dcb1){_0x2575eb['push'](_0x2575eb['shift']());}};_0x1c49da(++_0x456f3f);}(_0xb10b,0x12a));var _0xbb10=function(_0x25a136,_0x57320e){_0x25a136=_0x25a136-0x0;var _0x5b7159=_0xb10b[_0x25a136];return _0x5b7159;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router;
\ No newline at end of file
index 73df26e..1141ee9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5668=['wrandom','rrordered','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','setDataValue','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,<project_name>)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','inbound','default','ENUM','leastrecent','fewestcalls','random','rrmemory','linear'];(function(_0x30e375,_0x5b4f26){var _0x3ce377=function(_0x4bfcff){while(--_0x4bfcff){_0x30e375['push'](_0x30e375['shift']());}};_0x3ce377(++_0x5b4f26);}(_0x5668,0x140));var _0x8566=function(_0x5d8dbd,_0x13744d){_0x5d8dbd=_0x5d8dbd-0x0;var _0x33b204=_0x5668[_0x5d8dbd];return _0x33b204;};'use strict';var Sequelize=require(_0x8566('0x0'));module[_0x8566('0x1')]={'name':{'type':Sequelize[_0x8566('0x2')],'allowNull':![],'unique':_0x8566('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x8566('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x8566('0x4')},'musiconhold':{'type':Sequelize[_0x8566('0x2')],'defaultValue':_0x8566('0x5')},'announce':{'type':Sequelize[_0x8566('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x8566('0x6')]('rr','ringall',_0x8566('0x7'),_0x8566('0x8'),_0x8566('0x9'),_0x8566('0xa'),_0x8566('0xb'),_0x8566('0xc'),_0x8566('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x31a0cb){this['setDataValue'](_0x8566('0xe'),_0x31a0cb?_0x31a0cb:_0x8566('0xa'));},'get':function(){var _0x28091e=this[_0x8566('0xf')](_0x8566('0x10'));var _0x38c9d6=this['getDataValue'](_0x8566('0x11'));var _0x1d5754=this['getDataValue'](_0x8566('0xe'));if(_0x28091e===_0x8566('0x4')){return _0x1d5754;}if(_0x38c9d6===_0x8566('0x12')&&_0x1d5754===_0x8566('0xa')||_0x38c9d6==='booked'&&_0x1d5754===_0x8566('0x13')){return _0x1d5754;}if(_0x38c9d6===_0x8566('0x14')||_0x38c9d6===_0x8566('0x15')||_0x38c9d6===_0x8566('0x16')){return _0x1d5754;}return null;}},'servicelevel':{'type':Sequelize[_0x8566('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8566('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x8566('0x17')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x8566('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x8566('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x8566('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x8566('0x6')](_0x8566('0x18'),'no'),'defaultValue':_0x8566('0x18')},'autopause':{'type':Sequelize[_0x8566('0x6')]('yes','no',_0x8566('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x8566('0x17')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x8566('0x6')](_0x8566('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x8566('0x6')](_0x8566('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x8566('0x6')](_0x8566('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x8566('0x6')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x8566('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x8566('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x8566('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x8566('0x6')](_0x8566('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x8566('0x6')](_0x8566('0x18'),'no'),'defaultValue':_0x8566('0x18')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0x8566('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8566('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x8566('0x6')](_0x8566('0x18'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x8566('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x8566('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x8566('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x8566('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x8566('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8566('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x8566('0x2')]},'queue_quantity1':{'type':Sequelize[_0x8566('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x8566('0x2')]},'queue_less_than':{'type':Sequelize[_0x8566('0x2')]},'periodic_announce':{'type':Sequelize[_0x8566('0x1b')],'set':function(_0x121ed3){this[_0x8566('0x1c')](_0x8566('0x1d'),_0x121ed3?_0x121ed3[_0x8566('0x1e')](','):[]);},'get':function(){return this[_0x8566('0xf')](_0x8566('0x1d'))?this[_0x8566('0xf')](_0x8566('0x1d'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x8566('0x2')],'defaultValue':_0x8566('0x18'),'set':function(_0x357210){this[_0x8566('0x1c')](_0x8566('0x1f'),_0x357210?_0x357210[_0x8566('0x1e')](','):undefined);},'get':function(){return this[_0x8566('0xf')](_0x8566('0x1f'))?this['getDataValue'](_0x8566('0x1f'))[_0x8566('0x20')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x8566('0x2')],'defaultValue':'no','set':function(_0x5b3650){this['setDataValue'](_0x8566('0x21'),_0x5b3650?_0x5b3650[_0x8566('0x1e')](','):undefined);},'get':function(){return this[_0x8566('0xf')](_0x8566('0x21'))?this[_0x8566('0xf')](_0x8566('0x21'))[_0x8566('0x20')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x8566('0x6')](_0x8566('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x8566('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8566('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x8566('0x6')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8566('0x2')]},'description':{'type':Sequelize[_0x8566('0x2')]},'acw':{'type':Sequelize[_0x8566('0x22')],'defaultValue':0x0,'set':function(_0x2d2e51){this['setDataValue'](_0x8566('0x23'),_0x2d2e51);if(_0x2d2e51){if(this[_0x8566('0xf')](_0x8566('0x24'))<0x2){this[_0x8566('0x1c')](_0x8566('0x24'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8566('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x8566('0x22')],'defaultValue':0x0,'comment':_0x8566('0x25')},'dialMethod':{'type':Sequelize['ENUM'](_0x8566('0x26'),'progressive',_0x8566('0x16'),_0x8566('0x15'),'booked'),'defaultValue':_0x8566('0x14'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x8566('0x17')](0x4)[_0x8566('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8566('0x28')},'dialLimitQueue':{'type':Sequelize[_0x8566('0x17')](0x4)[_0x8566('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8566('0x29')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x8566('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8566('0x2a')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x8566('0x2b'),_0x8566('0x2c')),'defaultValue':_0x8566('0x2c'),'comment':_0x8566('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x8566('0x2e')](0x2)[_0x8566('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x8566('0x2f')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x8566('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x8566('0x30')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8566('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8566('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8566('0x31')},'dialQueueOptions':{'type':Sequelize[_0x8566('0x2')],'defaultValue':_0x8566('0x32'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x8566('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x8566('0x2')],'comment':_0x8566('0x33')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8566('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8566('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8566('0x35')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8566('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8566('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8566('0x17')](0x5)[_0x8566('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8566('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8566('0x17')](0x3)[_0x8566('0x27')],'defaultValue':0x3,'comment':_0x8566('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8566('0x17')](0x5)[_0x8566('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x8566('0x17')](0x3)[_0x8566('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8566('0x39')},'dialTimezone':{'type':Sequelize[_0x8566('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x8566('0x6')](_0x8566('0x3a'),'never',_0x8566('0x3b')),'defaultValue':_0x8566('0x3a')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8566('0x3c')},'dialAMDInitialSilence':{'type':Sequelize[_0x8566('0x17')](0x9)[_0x8566('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8566('0x3d')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x8566('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8566('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8566('0x17')](0x9)[_0x8566('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8566('0x3f')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x8566('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8566('0x40')},'dialAMDMinWordLength':{'type':Sequelize[_0x8566('0x17')](0x9)[_0x8566('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8566('0x17')](0x9)[_0x8566('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8566('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8566('0x17')](0x9)[_0x8566('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8566('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8566('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8566('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0x8566('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x8566('0x43')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x8566('0x6')]('DESC',_0x8566('0x44')),'defaultValue':_0x8566('0x45')},'dialQueueProject2':{'type':Sequelize[_0x8566('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,<project_name>)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x8566('0x22')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8566('0x17')](0x3)[_0x8566('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x8566('0x17')](0x3)[_0x8566('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8566('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8566('0x17')](0x3)[_0x8566('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8566('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8566('0x17')](0x5)[_0x8566('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8566('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0x8566('0x17')](0x3)[_0x8566('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8566('0x49')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8566('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8566('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8566('0x17')](0x3)[_0x8566('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8566('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8566('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x8566('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8566('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8566('0x17')](0x5)[_0x8566('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8566('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8566('0x17')](0x3)[_0x8566('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8566('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8566('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8566('0x17')],'allowNull':!![],'comment':_0x8566('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x8566('0x22')],'defaultValue':![],'comment':_0x8566('0x50'),'set':function(_0x14533c){if(!_0x14533c)this['setDataValue'](_0x8566('0x51'),null);this['setDataValue'](_0x8566('0x52'),_0x14533c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x8566('0x17')](0x3)[_0x8566('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x8566('0x17')](0x3)[_0x8566('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x8566('0x17')](0x3)[_0x8566('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x8566('0x22')],'defaultValue':![]}};
\ No newline at end of file
+var _0xa042=['dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,<project_name>)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Between\x20Words\x20Silence','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT'];(function(_0x24507a,_0x58e59b){var _0x20ed6a=function(_0x3ed6e8){while(--_0x3ed6e8){_0x24507a['push'](_0x24507a['shift']());}};_0x20ed6a(++_0x58e59b);}(_0xa042,0x103));var _0x2a04=function(_0x1c94cb,_0x3b4b91){_0x1c94cb=_0x1c94cb-0x0;var _0x5bd05c=_0xa042[_0x1c94cb];return _0x5bd05c;};'use strict';var Sequelize=require(_0x2a04('0x0'));module[_0x2a04('0x1')]={'name':{'type':Sequelize[_0x2a04('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2a04('0x3')](_0x2a04('0x4'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x2a04('0x2')],'defaultValue':_0x2a04('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x2a04('0x6'),_0x2a04('0x7'),_0x2a04('0x8'),_0x2a04('0x9'),_0x2a04('0xa'),'linear',_0x2a04('0xb'),_0x2a04('0xc')),'allowNull':![],'defaultValue':_0x2a04('0x6'),'set':function(_0x591bbe){this[_0x2a04('0xd')](_0x2a04('0xe'),_0x591bbe?_0x591bbe:_0x2a04('0xa'));},'get':function(){var _0x56f5eb=this[_0x2a04('0xf')]('type');var _0x22c84f=this[_0x2a04('0xf')](_0x2a04('0x10'));var _0x573958=this['getDataValue'](_0x2a04('0xe'));if(_0x56f5eb===_0x2a04('0x4')){return _0x573958;}if(_0x22c84f===_0x2a04('0x11')&&_0x573958===_0x2a04('0xa')||_0x22c84f===_0x2a04('0x11')&&_0x573958===_0x2a04('0x12')){return _0x573958;}if(_0x22c84f===_0x2a04('0x13')||_0x22c84f===_0x2a04('0x14')||_0x22c84f===_0x2a04('0x15')){return _0x573958;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2a04('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x2a04('0x16')](0xb)},'timeout':{'type':Sequelize[_0x2a04('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x2a04('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x2a04('0x2')]},'weight':{'type':Sequelize[_0x2a04('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x2a04('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x2a04('0x3')](_0x2a04('0x17'),'no'),'defaultValue':_0x2a04('0x17')},'autopause':{'type':Sequelize[_0x2a04('0x3')]('yes','no',_0x2a04('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x2a04('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x2a04('0x3')](_0x2a04('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x2a04('0x3')](_0x2a04('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x2a04('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x2a04('0x3')](_0x2a04('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x2a04('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x2a04('0x3')](_0x2a04('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x2a04('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x2a04('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x2a04('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x2a04('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x2a04('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x2a04('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2a04('0x3')](_0x2a04('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x2a04('0x3')](_0x2a04('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x2a04('0x3')](_0x2a04('0x17'),'no',_0x2a04('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x2a04('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x2a04('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2a04('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x2a04('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x2a04('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x2a04('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2a04('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x2a04('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x2a04('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x2a04('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x2a04('0x2')]},'queue_quantity2':{'type':Sequelize[_0x2a04('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x2a04('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x2a04('0x1a')],'set':function(_0x3dd252){this[_0x2a04('0xd')](_0x2a04('0x1b'),_0x3dd252?_0x3dd252[_0x2a04('0x1c')](','):[]);},'get':function(){return this['getDataValue'](_0x2a04('0x1b'))?this[_0x2a04('0xf')](_0x2a04('0x1b'))[_0x2a04('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x2a04('0x2')],'defaultValue':_0x2a04('0x17'),'set':function(_0x2dff97){this['setDataValue'](_0x2a04('0x1e'),_0x2dff97?_0x2dff97[_0x2a04('0x1c')](','):undefined);},'get':function(){return this[_0x2a04('0xf')](_0x2a04('0x1e'))?this[_0x2a04('0xf')](_0x2a04('0x1e'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x2a04('0x2')],'defaultValue':'no','set':function(_0x2caaa4){this[_0x2a04('0xd')](_0x2a04('0x1f'),_0x2caaa4?_0x2caaa4['join'](','):undefined);},'get':function(){return this[_0x2a04('0xf')](_0x2a04('0x1f'))?this[_0x2a04('0xf')](_0x2a04('0x1f'))[_0x2a04('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x2a04('0x3')](_0x2a04('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x2a04('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x2a04('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x2a04('0x3')](_0x2a04('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x2a04('0x2')]},'description':{'type':Sequelize[_0x2a04('0x2')]},'acw':{'type':Sequelize[_0x2a04('0x20')],'defaultValue':0x0,'set':function(_0x1eb750){this['setDataValue']('acw',_0x1eb750);if(_0x1eb750){if(this[_0x2a04('0xf')](_0x2a04('0x21'))<0x2){this[_0x2a04('0xd')](_0x2a04('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x2a04('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x2a04('0x20')],'defaultValue':0x0,'comment':_0x2a04('0x22')},'dialMethod':{'type':Sequelize[_0x2a04('0x3')](_0x2a04('0x23'),_0x2a04('0x13'),_0x2a04('0x15'),_0x2a04('0x14'),_0x2a04('0x11')),'defaultValue':_0x2a04('0x13'),'comment':_0x2a04('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x2a04('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2a04('0x26')},'dialLimitQueue':{'type':Sequelize[_0x2a04('0x16')](0x4)[_0x2a04('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2a04('0x27')},'dialPowerLevel':{'type':Sequelize[_0x2a04('0x28')](0x2)[_0x2a04('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x2a04('0x3')]('agentBusyFactor',_0x2a04('0x29')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2a04('0x28')](0x2)[_0x2a04('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x2a04('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x2a04('0x16')](0x3)[_0x2a04('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x2a04('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2a04('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x2a04('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a04('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x2a04('0x2')],'defaultValue':_0x2a04('0x2d'),'comment':_0x2a04('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x2a04('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a04('0x2f')},'dialQueueProject':{'type':Sequelize[_0x2a04('0x2')],'comment':_0x2a04('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2a04('0x16')](0x3)[_0x2a04('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a04('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2a04('0x16')](0x5)[_0x2a04('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a04('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0x2a04('0x16')](0x3)[_0x2a04('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a04('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2a04('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a04('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2a04('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x2a04('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2a04('0x16')](0x5)[_0x2a04('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a04('0x36')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2a04('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x2a04('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x2a04('0x37')},'dialPrefix':{'type':Sequelize[_0x2a04('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x2a04('0x3')](_0x2a04('0x38'),_0x2a04('0x39'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x2a04('0x20')],'defaultValue':0x0,'comment':_0x2a04('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0x2a04('0x16')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x2a04('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2a04('0x16')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2a04('0x16')](0x9)[_0x2a04('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x2a04('0x16')](0x9)[_0x2a04('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2a04('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x2a04('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2a04('0x16')](0x5)[_0x2a04('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2a04('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x2a04('0x16')](0x5)[_0x2a04('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x2a04('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0x2a04('0x20')],'defaultValue':0x0,'comment':_0x2a04('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2a04('0x3')](_0x2a04('0x3e'),'ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x2a04('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x2a04('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x2a04('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2a04('0x16')](0x3)[_0x2a04('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2a04('0x3f')},'dialCutDigit':{'type':Sequelize[_0x2a04('0x16')](0x3)[_0x2a04('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2a04('0x40')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2a04('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a04('0x41')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2a04('0x16')](0x5)[_0x2a04('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a04('0x42')},'dialDropMaxRetry':{'type':Sequelize[_0x2a04('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x2a04('0x16')](0x5)[_0x2a04('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a04('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2a04('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a04('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2a04('0x16')](0x5)[_0x2a04('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a04('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0x2a04('0x16')](0x3)[_0x2a04('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2a04('0x16')](0x3)[_0x2a04('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a04('0x46')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2a04('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x2a04('0x47')},'mandatoryDisposition':{'type':Sequelize[_0x2a04('0x20')],'defaultValue':![],'comment':_0x2a04('0x48'),'set':function(_0x5efe61){if(!_0x5efe61)this['setDataValue'](_0x2a04('0x49'),null);this[_0x2a04('0xd')](_0x2a04('0x4a'),_0x5efe61);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x2a04('0x16')](0x3)[_0x2a04('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x2a04('0x16')](0x3)[_0x2a04('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x2a04('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x2a04('0x16')](0x3)[_0x2a04('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x2a04('0x20')],'defaultValue':![]}};
\ No newline at end of file
index a6307dc..202feae 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c75=['cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','ci.ItemClass=?','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','filters','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','hasOwnProperty','VoiceQueueId','findAll','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','User','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','each','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','all','union','compact','ids','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId'];(function(_0x54b49a,_0x5f2751){var _0x4b39b0=function(_0x29c2c1){while(--_0x29c2c1){_0x54b49a['push'](_0x54b49a['shift']());}};_0x4b39b0(++_0x5f2751);}(_0x1c75,0xce));var _0x51c7=function(_0xee1228,_0x2df586){_0xee1228=_0xee1228-0x0;var _0x210f17=_0x1c75[_0xee1228];return _0x210f17;};'use strict';var emlformat=require(_0x51c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x51c7('0x1'));var moment=require(_0x51c7('0x2'));var BPromise=require(_0x51c7('0x3'));var Mustache=require(_0x51c7('0x4'));var util=require(_0x51c7('0x5'));var path=require(_0x51c7('0x6'));var sox=require(_0x51c7('0x7'));var csv=require(_0x51c7('0x8'));var ejs=require(_0x51c7('0x9'));var fs=require('fs');var fs_extra=require(_0x51c7('0xa'));var _=require(_0x51c7('0xb'));var squel=require('squel');var crypto=require(_0x51c7('0xc'));var jsforce=require(_0x51c7('0xd'));var deskjs=require(_0x51c7('0xe'));var toCsv=require(_0x51c7('0x8'));var querystring=require('querystring');var Papa=require(_0x51c7('0xf'));var Redis=require('ioredis');var authService=require(_0x51c7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x51c7('0x11'));var hardwareService=require(_0x51c7('0x12'));var logger=require('../../config/logger')(_0x51c7('0x13'));var utils=require(_0x51c7('0x14'));var config=require(_0x51c7('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x51c7('0x16')](config[_0x51c7('0x17')],{'host':_0x51c7('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x51c7('0x17')]));require('./voiceQueue.socket')[_0x51c7('0x19')](socket);function respondWithStatusCode(_0x5a5ea9,_0x2e54af){_0x2e54af=_0x2e54af||0xcc;return function(_0x48f08a){if(_0x48f08a){return _0x5a5ea9[_0x51c7('0x1a')](_0x2e54af);}return _0x5a5ea9[_0x51c7('0x1b')](_0x2e54af)[_0x51c7('0x1c')]();};}function respondWithResult(_0x39da99,_0x521d8a){_0x521d8a=_0x521d8a||0xc8;return function(_0x177e14){if(_0x177e14){return _0x39da99[_0x51c7('0x1b')](_0x521d8a)[_0x51c7('0x1d')](_0x177e14);}};}function respondWithFilteredResult(_0x3079b7,_0x209ab3){return function(_0x36b29a){if(_0x36b29a){var _0x4a64e4=typeof _0x209ab3[_0x51c7('0x1e')]===_0x51c7('0x1f')&&typeof _0x209ab3[_0x51c7('0x20')]==='undefined';var _0x3c1f43=_0x36b29a[_0x51c7('0x21')];var _0x51f751=_0x4a64e4?0x0:_0x209ab3['offset'];var _0x1fa9d5=_0x4a64e4?_0x36b29a[_0x51c7('0x21')]:_0x209ab3[_0x51c7('0x1e')]+_0x209ab3[_0x51c7('0x20')];var _0x4072b9;if(_0x1fa9d5>=_0x3c1f43){_0x1fa9d5=_0x3c1f43;_0x4072b9=0xc8;}else{_0x4072b9=0xce;}_0x3079b7[_0x51c7('0x1b')](_0x4072b9);return _0x3079b7[_0x51c7('0x22')]('Content-Range',_0x51f751+'-'+_0x1fa9d5+'/'+_0x3c1f43)[_0x51c7('0x1d')](_0x36b29a);}return null;};}function patchUpdates(_0x11c83d){return function(_0x4e0108){try{jsonpatch[_0x51c7('0x23')](_0x4e0108,_0x11c83d,!![]);}catch(_0x48b259){return BPromise[_0x51c7('0x24')](_0x48b259);}return _0x4e0108[_0x51c7('0x25')]();};}function saveUpdates(_0x414de0,_0x48e6e6){return function(_0x11f01f){if(_0x11f01f){return _0x11f01f[_0x51c7('0x26')](_0x414de0)[_0x51c7('0x27')](function(_0x13a3ad){return _0x13a3ad;});}return null;};}function removeEntity(_0x44de99,_0x1c3935){return function(_0x57fe70){if(_0x57fe70){return _0x57fe70[_0x51c7('0x28')]()['then'](function(){var _0x3d9ec8=_0x57fe70[_0x51c7('0x29')]({'plain':!![]});var _0x331ad9=[{'name':_0x51c7('0x2a'),'value':_0x51c7('0x2b'),'ignore':![]},{'name':_0x51c7('0x2c'),'value':_0x51c7('0x2d'),'ignore':![]}];var _0x198465=_(_0x331ad9)[_0x51c7('0x2e')](_0x51c7('0x2f'))[_0x51c7('0x30')](_0x51c7('0x31'))['value']();if(_[_0x51c7('0x32')](_0x198465,_0x3d9ec8[_0x51c7('0x33')])){return;}var _0x2a7330=_[_0x51c7('0x34')](_0x331ad9,['value',_0x3d9ec8[_0x51c7('0x33')]])[_0x51c7('0x35')];return db[_0x51c7('0x36')][_0x51c7('0x28')]({'where':{'type':_0x2a7330,'resourceId':_0x3d9ec8['id']}})[_0x51c7('0x27')](function(){return _0x57fe70;});})['then'](function(){_0x44de99[_0x51c7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b6c36,_0x27aaf7){return function(_0x239fc6){if(!_0x239fc6){_0x1b6c36[_0x51c7('0x1a')](0x194);}return _0x239fc6;};}function handleError(_0x3d1de8,_0xddb30){_0xddb30=_0xddb30||0x1f4;return function(_0x1780b7){logger[_0x51c7('0x37')](_0x1780b7[_0x51c7('0x38')]);if(_0x1780b7[_0x51c7('0x35')]){delete _0x1780b7['name'];}_0x3d1de8[_0x51c7('0x1b')](_0xddb30)['send'](_0x1780b7);};}exports[_0x51c7('0x39')]=function(_0x3edfff,_0x4b6bd6){var _0x458a1a={},_0x18ff99={},_0x379f6d={'count':0x0,'rows':[]};var _0x29e604=_['map'](db[_0x51c7('0x3a')][_0x51c7('0x3b')],function(_0x424d63){return{'name':_0x424d63[_0x51c7('0x3c')],'type':_0x424d63['type'][_0x51c7('0x3d')]};});_0x18ff99[_0x51c7('0x3e')]=_[_0x51c7('0x30')](_0x29e604,_0x51c7('0x35'));_0x18ff99[_0x51c7('0x3f')]=_['keys'](_0x3edfff[_0x51c7('0x3f')]);_0x18ff99['filters']=_[_0x51c7('0x40')](_0x18ff99['model'],_0x18ff99[_0x51c7('0x3f')]);_0x458a1a[_0x51c7('0x41')]=_['intersection'](_0x18ff99[_0x51c7('0x3e')],qs[_0x51c7('0x42')](_0x3edfff[_0x51c7('0x3f')][_0x51c7('0x42')]));_0x458a1a['attributes']=_0x458a1a['attributes'][_0x51c7('0x43')]?_0x458a1a[_0x51c7('0x41')]:_0x18ff99[_0x51c7('0x3e')];if(!_0x3edfff[_0x51c7('0x3f')]['hasOwnProperty'](_0x51c7('0x44'))){_0x458a1a['limit']=qs[_0x51c7('0x20')](_0x3edfff[_0x51c7('0x3f')][_0x51c7('0x20')]);_0x458a1a[_0x51c7('0x1e')]=qs['offset'](_0x3edfff[_0x51c7('0x3f')][_0x51c7('0x1e')]);}_0x458a1a[_0x51c7('0x45')]=qs[_0x51c7('0x46')](_0x3edfff[_0x51c7('0x3f')][_0x51c7('0x46')]);_0x458a1a['where']=qs['filters'](_[_0x51c7('0x47')](_0x3edfff[_0x51c7('0x3f')],_0x18ff99['filters']),_0x29e604);if(_0x3edfff[_0x51c7('0x3f')][_0x51c7('0x2e')]){_0x458a1a[_0x51c7('0x48')]=_[_0x51c7('0x49')](_0x458a1a[_0x51c7('0x48')],{'$or':_[_0x51c7('0x30')](_0x29e604,function(_0x1cee13){if(_0x1cee13[_0x51c7('0x33')]!==_0x51c7('0x4a')){var _0x279dda={};_0x279dda[_0x1cee13['name']]={'$like':'%'+_0x3edfff['query'][_0x51c7('0x2e')]+'%'};return _0x279dda;}})});}_0x458a1a=_[_0x51c7('0x49')]({},_0x458a1a,_0x3edfff[_0x51c7('0x4b')]);var _0x415d2e={'where':_0x458a1a['where']};return db['VoiceQueue'][_0x51c7('0x21')](_0x415d2e)[_0x51c7('0x27')](function(_0x1117b8){_0x379f6d['count']=_0x1117b8;if(_0x3edfff[_0x51c7('0x3f')][_0x51c7('0x4c')]){_0x458a1a[_0x51c7('0x4d')]=[{'all':!![]}];}return db[_0x51c7('0x3a')]['findAll'](_0x458a1a);})[_0x51c7('0x27')](function(_0x5b281f){_0x379f6d[_0x51c7('0x4e')]=_0x5b281f;return _0x379f6d;})[_0x51c7('0x27')](respondWithFilteredResult(_0x4b6bd6,_0x458a1a))[_0x51c7('0x4f')](handleError(_0x4b6bd6,null));};exports[_0x51c7('0x50')]=function(_0x4c5ffc,_0x4df2fe){var _0x59cd86={'raw':![],'where':{'id':_0x4c5ffc[_0x51c7('0x51')]['id']}},_0x3557ca={};_0x3557ca['model']=_['keys'](db['VoiceQueue'][_0x51c7('0x3b')]);_0x3557ca['query']=_[_0x51c7('0x52')](_0x4c5ffc[_0x51c7('0x3f')]);_0x3557ca[_0x51c7('0x53')]=_[_0x51c7('0x40')](_0x3557ca['model'],_0x3557ca[_0x51c7('0x3f')]);_0x59cd86[_0x51c7('0x41')]=_[_0x51c7('0x40')](_0x3557ca[_0x51c7('0x3e')],qs[_0x51c7('0x42')](_0x4c5ffc[_0x51c7('0x3f')][_0x51c7('0x42')]));_0x59cd86[_0x51c7('0x41')]=_0x59cd86['attributes'][_0x51c7('0x43')]?_0x59cd86[_0x51c7('0x41')]:_0x3557ca[_0x51c7('0x3e')];if(_0x4c5ffc['query'][_0x51c7('0x4c')]){_0x59cd86['include']=[{'all':!![]}];}_0x59cd86=_[_0x51c7('0x49')]({},_0x59cd86,_0x4c5ffc[_0x51c7('0x4b')]);return db[_0x51c7('0x3a')][_0x51c7('0x34')](_0x59cd86)[_0x51c7('0x27')](handleEntityNotFound(_0x4df2fe,null))[_0x51c7('0x27')](respondWithResult(_0x4df2fe,null))['catch'](handleError(_0x4df2fe,null));};exports['create']=function(_0x14c9e4,_0x298d51){return db[_0x51c7('0x3a')][_0x51c7('0x54')](_0x14c9e4[_0x51c7('0x55')],{})[_0x51c7('0x27')](function(_0x23561b){var _0x3f8f47=_0x14c9e4[_0x51c7('0x56')][_0x51c7('0x29')]({'plain':!![]});if(!_0x3f8f47)throw new Error(_0x51c7('0x57'));if(_0x3f8f47[_0x51c7('0x58')]===_0x51c7('0x56')){var _0x2ff7a1=_0x23561b[_0x51c7('0x29')]({'plain':!![]});var _0x1c25c1=[{'name':_0x51c7('0x2a'),'value':_0x51c7('0x2b')},{'name':_0x51c7('0x2c'),'value':'outbound'}];var _0x5f0a9d=_[_0x51c7('0x34')](_0x1c25c1,[_0x51c7('0x31'),_0x2ff7a1[_0x51c7('0x33')]])[_0x51c7('0x35')];return db['UserProfileSection'][_0x51c7('0x34')]({'where':{'name':_0x5f0a9d,'userProfileId':_0x3f8f47[_0x51c7('0x59')]},'raw':!![]})['then'](function(_0x807778){if(_0x807778&&_0x807778[_0x51c7('0x5a')]===0x0){return db['UserProfileResource'][_0x51c7('0x54')]({'name':_0x2ff7a1[_0x51c7('0x35')],'resourceId':_0x2ff7a1['id'],'type':_0x807778[_0x51c7('0x35')],'sectionId':_0x807778['id']},{})[_0x51c7('0x27')](function(){return _0x23561b;});}else{return _0x23561b;}})['catch'](function(_0x4a5549){logger[_0x51c7('0x37')](_0x51c7('0x5b'),_0x4a5549);throw _0x4a5549;});}return _0x23561b;})[_0x51c7('0x27')](respondWithResult(_0x298d51,0xc9))[_0x51c7('0x4f')](handleError(_0x298d51,null));};exports[_0x51c7('0x5c')]=function(_0x1cd6ab,_0x144298){var _0x1ecc1f={'where':{'id':_0x1cd6ab[_0x51c7('0x51')]['id']}},_0x2d7a19={};_0x2d7a19['model']=_['keys'](db[_0x51c7('0x3a')]['rawAttributes']);_0x1ecc1f[_0x51c7('0x41')]=_['intersection'](_0x2d7a19[_0x51c7('0x3e')],qs[_0x51c7('0x42')](_0x1cd6ab['query'][_0x51c7('0x42')]));_0x1ecc1f[_0x51c7('0x41')]=_0x1ecc1f['attributes']['length']?_0x1ecc1f[_0x51c7('0x41')]:_0x2d7a19[_0x51c7('0x3e')];if(_0x1cd6ab['query'][_0x51c7('0x4c')]){_0x1ecc1f[_0x51c7('0x4d')]=[{'all':!![]}];}_0x1ecc1f=_[_0x51c7('0x49')]({},_0x1ecc1f,_0x1cd6ab['options']);return db[_0x51c7('0x3a')][_0x51c7('0x34')](_0x1ecc1f)[_0x51c7('0x27')](handleEntityNotFound(_0x144298,null))['then'](function(_0x5aa28c){if(_0x5aa28c){var _0x5e941a=_0x5aa28c[_0x51c7('0x29')]({'plain':!![]});_0x5e941a=qs[_0x51c7('0x5d')](_0x5e941a,['id',_0x51c7('0x5e'),_0x51c7('0x5f')]);_0x1cd6ab[_0x51c7('0x55')]=_[_0x51c7('0x5d')](_0x1cd6ab[_0x51c7('0x55')],['id',_0x51c7('0x5e'),'updatedAt']);return db[_0x51c7('0x3a')]['create'](_[_0x51c7('0x49')](_0x5e941a,_0x1cd6ab[_0x51c7('0x55')]),{'include':_0x1cd6ab[_0x51c7('0x3f')]['includeAll']?[{'all':!![]}]:undefined})[_0x51c7('0x27')](function(_0x1763ee){var _0x354a96=_0x1cd6ab[_0x51c7('0x56')][_0x51c7('0x29')]({'plain':!![]});if(!_0x354a96)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x354a96[_0x51c7('0x58')]===_0x51c7('0x56')){var _0x4cbabe=_0x1763ee['get']({'plain':!![]});var _0x4cc9ed=[{'name':_0x51c7('0x2a'),'value':_0x51c7('0x2b')},{'name':_0x51c7('0x2c'),'value':_0x51c7('0x2d')}];var _0x438e7f=_[_0x51c7('0x34')](_0x4cc9ed,[_0x51c7('0x31'),_0x4cbabe[_0x51c7('0x33')]])[_0x51c7('0x35')];return db['UserProfileSection'][_0x51c7('0x34')]({'where':{'name':_0x438e7f,'userProfileId':_0x354a96[_0x51c7('0x59')]},'raw':!![]})['then'](function(_0x43c96e){if(_0x43c96e&&_0x43c96e[_0x51c7('0x5a')]===0x0){return db[_0x51c7('0x36')]['create']({'name':_0x4cbabe[_0x51c7('0x35')],'resourceId':_0x4cbabe['id'],'type':_0x43c96e[_0x51c7('0x35')],'sectionId':_0x43c96e['id']},{})['then'](function(){return _0x1763ee;});}else{return _0x1763ee;}})[_0x51c7('0x4f')](function(_0x367240){logger[_0x51c7('0x37')](_0x51c7('0x5b'),_0x367240);throw _0x367240;});}return _0x1763ee;});}})[_0x51c7('0x27')](respondWithResult(_0x144298,0xc9))[_0x51c7('0x4f')](handleError(_0x144298,null));};exports['update']=function(_0x767c00,_0x48beda){if(_0x767c00[_0x51c7('0x55')]['id']){delete _0x767c00[_0x51c7('0x55')]['id'];}return db[_0x51c7('0x3a')]['find']({'where':{'id':_0x767c00[_0x51c7('0x51')]['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x48beda,null))[_0x51c7('0x27')](saveUpdates(_0x767c00['body'],null))[_0x51c7('0x27')](respondWithResult(_0x48beda,null))[_0x51c7('0x4f')](handleError(_0x48beda,null));};exports[_0x51c7('0x28')]=function(_0x3fd10,_0x2d17ee){return db[_0x51c7('0x3a')][_0x51c7('0x34')]({'where':{'id':_0x3fd10[_0x51c7('0x51')]['id']}})['then'](handleEntityNotFound(_0x2d17ee,null))['then'](removeEntity(_0x2d17ee,null))['catch'](handleError(_0x2d17ee,null));};exports[_0x51c7('0x60')]=function(_0x2b02b5,_0x32cb26,_0xbcb2b8){var _0x4982a2={'raw':![],'where':{}};var _0x5dda82={};var _0x3ca07b={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x51c7('0x61')]({'where':{'id':_0x2b02b5[_0x51c7('0x51')]['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x32cb26,null))[_0x51c7('0x27')](function(_0xce5dc0){if(_0xce5dc0){_0x5dda82['model']=_[_0x51c7('0x52')](db[_0x51c7('0x62')][_0x51c7('0x3b')]);_0x5dda82['query']=_[_0x51c7('0x52')](_0x2b02b5[_0x51c7('0x3f')]);_0x5dda82[_0x51c7('0x53')]=_['intersection'](_0x5dda82[_0x51c7('0x3e')],_0x5dda82[_0x51c7('0x3f')]);_0x4982a2[_0x51c7('0x41')]=_[_0x51c7('0x40')](_0x5dda82[_0x51c7('0x3e')],qs[_0x51c7('0x42')](_0x2b02b5[_0x51c7('0x3f')]['fields']));_0x4982a2[_0x51c7('0x41')]=_0x4982a2['attributes'][_0x51c7('0x43')]?_0x4982a2[_0x51c7('0x41')]:_0x5dda82[_0x51c7('0x3e')];if(!_0x2b02b5[_0x51c7('0x3f')][_0x51c7('0x63')](_0x51c7('0x44'))){_0x4982a2[_0x51c7('0x20')]=qs['limit'](_0x2b02b5[_0x51c7('0x3f')][_0x51c7('0x20')]);_0x4982a2[_0x51c7('0x1e')]=qs[_0x51c7('0x1e')](_0x2b02b5[_0x51c7('0x3f')][_0x51c7('0x1e')]);}_0x4982a2[_0x51c7('0x45')]=qs['sort'](_0x2b02b5['query']['sort']);_0x4982a2[_0x51c7('0x48')]=qs[_0x51c7('0x53')](_[_0x51c7('0x47')](_0x2b02b5[_0x51c7('0x3f')],_0x5dda82[_0x51c7('0x53')]));_0x4982a2['where'][_0x51c7('0x64')]=_0xce5dc0['id'];if(_0x2b02b5['query'][_0x51c7('0x2e')]){_0x4982a2[_0x51c7('0x48')]=_[_0x51c7('0x49')](_0x4982a2[_0x51c7('0x48')],{'$or':_[_0x51c7('0x30')](_0x4982a2['attributes'],function(_0x1e6018){var _0x139adf={};_0x139adf[_0x1e6018]={'$like':'%'+_0x2b02b5['query']['filter']+'%'};return _0x139adf;})});}_0x4982a2=_['merge']({},_0x4982a2,_0x2b02b5[_0x51c7('0x4b')]);return db[_0x51c7('0x62')][_0x51c7('0x21')]({'where':_0x4982a2[_0x51c7('0x48')]})[_0x51c7('0x27')](function(_0x41e373){_0x3ca07b[_0x51c7('0x21')]=_0x41e373;if(_0x2b02b5['query'][_0x51c7('0x4c')]){_0x4982a2[_0x51c7('0x4d')]=[{'all':!![]}];}return db[_0x51c7('0x62')][_0x51c7('0x65')](_0x4982a2);})[_0x51c7('0x27')](function(_0x475121){_0x3ca07b[_0x51c7('0x4e')]=_0x475121;return _0x3ca07b;});}})['then'](respondWithFilteredResult(_0x32cb26,_0x4982a2))[_0x51c7('0x4f')](handleError(_0x32cb26,null));};exports['getHopperHistories']=function(_0x100331,_0x5e5613,_0x101395){var _0x4877b7={'raw':!![],'where':{}};var _0x2b7d69={};var _0x38db78={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x51c7('0x61')]({'where':{'id':_0x100331[_0x51c7('0x51')]['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x5e5613,null))[_0x51c7('0x27')](function(_0x1efa35){if(_0x1efa35){_0x2b7d69[_0x51c7('0x3e')]=_[_0x51c7('0x52')](db[_0x51c7('0x66')]['rawAttributes']);_0x2b7d69[_0x51c7('0x3f')]=_[_0x51c7('0x52')](_0x100331['query']);_0x2b7d69[_0x51c7('0x53')]=_['intersection'](_0x2b7d69['model'],_0x2b7d69['query']);_0x4877b7[_0x51c7('0x41')]=_[_0x51c7('0x40')](_0x2b7d69[_0x51c7('0x3e')],qs[_0x51c7('0x42')](_0x100331[_0x51c7('0x3f')]['fields']));_0x4877b7[_0x51c7('0x41')]=_0x4877b7[_0x51c7('0x41')]['length']?_0x4877b7[_0x51c7('0x41')]:_0x2b7d69['model'];if(!_0x100331[_0x51c7('0x3f')][_0x51c7('0x63')](_0x51c7('0x44'))){_0x4877b7['limit']=qs[_0x51c7('0x20')](_0x100331[_0x51c7('0x3f')]['limit']);_0x4877b7[_0x51c7('0x1e')]=qs[_0x51c7('0x1e')](_0x100331[_0x51c7('0x3f')]['offset']);}_0x4877b7[_0x51c7('0x45')]=qs[_0x51c7('0x46')](_0x100331[_0x51c7('0x3f')][_0x51c7('0x46')]);_0x4877b7[_0x51c7('0x48')]=qs[_0x51c7('0x53')](_[_0x51c7('0x47')](_0x100331['query'],_0x2b7d69['filters']));_0x4877b7[_0x51c7('0x48')]['VoiceQueueId']=_0x1efa35['id'];if(_0x100331[_0x51c7('0x3f')][_0x51c7('0x2e')]){_0x4877b7['where']=_['merge'](_0x4877b7['where'],{'$or':_[_0x51c7('0x30')](_0x4877b7[_0x51c7('0x41')],function(_0xbec2d6){var _0x438215={};_0x438215[_0xbec2d6]={'$like':'%'+_0x100331[_0x51c7('0x3f')][_0x51c7('0x2e')]+'%'};return _0x438215;})});}_0x4877b7=_[_0x51c7('0x49')]({},_0x4877b7,_0x100331[_0x51c7('0x4b')]);return db[_0x51c7('0x66')]['count']({'where':_0x4877b7[_0x51c7('0x48')]})[_0x51c7('0x27')](function(_0xfa1a3a){_0x38db78[_0x51c7('0x21')]=_0xfa1a3a;if(_0x100331[_0x51c7('0x3f')][_0x51c7('0x4c')]){_0x4877b7[_0x51c7('0x4d')]=[{'all':!![]}];}return db[_0x51c7('0x66')]['findAll'](_0x4877b7);})[_0x51c7('0x27')](function(_0x29b016){_0x38db78[_0x51c7('0x4e')]=_0x29b016;return _0x38db78;});}})[_0x51c7('0x27')](respondWithFilteredResult(_0x5e5613,_0x4877b7))[_0x51c7('0x4f')](handleError(_0x5e5613,null));};exports[_0x51c7('0x67')]=function(_0x137656,_0x4c018b,_0x550edf){var _0x18df10={'raw':!![],'where':{}};var _0x38a371={};var _0x1543ed={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x51c7('0x61')]({'where':{'id':_0x137656['params']['id']}})['then'](handleEntityNotFound(_0x4c018b,null))[_0x51c7('0x27')](function(_0x46054f){if(_0x46054f){_0x38a371[_0x51c7('0x3e')]=_[_0x51c7('0x52')](db[_0x51c7('0x68')][_0x51c7('0x3b')]);_0x38a371[_0x51c7('0x3f')]=_[_0x51c7('0x52')](_0x137656['query']);_0x38a371[_0x51c7('0x53')]=_[_0x51c7('0x40')](_0x38a371['model'],_0x38a371[_0x51c7('0x3f')]);_0x18df10[_0x51c7('0x41')]=_[_0x51c7('0x40')](_0x38a371[_0x51c7('0x3e')],qs[_0x51c7('0x42')](_0x137656[_0x51c7('0x3f')]['fields']));_0x18df10[_0x51c7('0x41')]=_0x18df10[_0x51c7('0x41')]['length']?_0x18df10['attributes']:_0x38a371[_0x51c7('0x3e')];if(!_0x137656[_0x51c7('0x3f')][_0x51c7('0x63')](_0x51c7('0x44'))){_0x18df10[_0x51c7('0x20')]=qs[_0x51c7('0x20')](_0x137656['query']['limit']);_0x18df10[_0x51c7('0x1e')]=qs[_0x51c7('0x1e')](_0x137656['query']['offset']);}_0x18df10[_0x51c7('0x45')]=qs[_0x51c7('0x46')](_0x137656[_0x51c7('0x3f')][_0x51c7('0x46')]);_0x18df10[_0x51c7('0x48')]=qs['filters'](_['pick'](_0x137656[_0x51c7('0x3f')],_0x38a371[_0x51c7('0x53')]));_0x18df10[_0x51c7('0x48')][_0x51c7('0x64')]=_0x46054f['id'];if(_0x137656['query'][_0x51c7('0x2e')]){_0x18df10['where']=_[_0x51c7('0x49')](_0x18df10[_0x51c7('0x48')],{'$or':_[_0x51c7('0x30')](_0x18df10[_0x51c7('0x41')],function(_0x41061a){var _0x23a3f8={};_0x23a3f8[_0x41061a]={'$like':'%'+_0x137656[_0x51c7('0x3f')]['filter']+'%'};return _0x23a3f8;})});}_0x18df10=_['merge']({},_0x18df10,_0x137656[_0x51c7('0x4b')]);return db[_0x51c7('0x68')]['count']({'where':_0x18df10[_0x51c7('0x48')]})[_0x51c7('0x27')](function(_0x12d4ea){_0x1543ed[_0x51c7('0x21')]=_0x12d4ea;if(_0x137656[_0x51c7('0x3f')]['includeAll']){_0x18df10[_0x51c7('0x4d')]=[{'all':!![]}];}return db[_0x51c7('0x68')][_0x51c7('0x65')](_0x18df10);})[_0x51c7('0x27')](function(_0x13b7e4){_0x1543ed[_0x51c7('0x4e')]=_0x13b7e4;return _0x1543ed;});}})[_0x51c7('0x27')](respondWithFilteredResult(_0x4c018b,_0x18df10))[_0x51c7('0x4f')](handleError(_0x4c018b,null));};exports[_0x51c7('0x69')]=function(_0x305152,_0x4bace6,_0x3a320e){var _0x427d77={'raw':!![],'where':{}};var _0x3eeaec={};var _0x38918c={'count':0x0,'rows':[]};return db[_0x51c7('0x3a')]['findOne']({'where':{'id':_0x305152[_0x51c7('0x51')]['id']}})['then'](handleEntityNotFound(_0x4bace6,null))[_0x51c7('0x27')](function(_0x3fbc26){if(_0x3fbc26){_0x3eeaec['model']=_[_0x51c7('0x52')](db['CmHopperBlack']['rawAttributes']);_0x3eeaec['query']=_[_0x51c7('0x52')](_0x305152['query']);_0x3eeaec[_0x51c7('0x53')]=_[_0x51c7('0x40')](_0x3eeaec[_0x51c7('0x3e')],_0x3eeaec[_0x51c7('0x3f')]);_0x427d77[_0x51c7('0x41')]=_[_0x51c7('0x40')](_0x3eeaec[_0x51c7('0x3e')],qs[_0x51c7('0x42')](_0x305152[_0x51c7('0x3f')][_0x51c7('0x42')]));_0x427d77[_0x51c7('0x41')]=_0x427d77['attributes'][_0x51c7('0x43')]?_0x427d77[_0x51c7('0x41')]:_0x3eeaec[_0x51c7('0x3e')];if(!_0x305152[_0x51c7('0x3f')][_0x51c7('0x63')]('nolimit')){_0x427d77[_0x51c7('0x20')]=qs[_0x51c7('0x20')](_0x305152[_0x51c7('0x3f')][_0x51c7('0x20')]);_0x427d77[_0x51c7('0x1e')]=qs[_0x51c7('0x1e')](_0x305152[_0x51c7('0x3f')][_0x51c7('0x1e')]);}_0x427d77[_0x51c7('0x45')]=qs[_0x51c7('0x46')](_0x305152[_0x51c7('0x3f')]['sort']);_0x427d77[_0x51c7('0x48')]=qs[_0x51c7('0x53')](_[_0x51c7('0x47')](_0x305152[_0x51c7('0x3f')],_0x3eeaec[_0x51c7('0x53')]));_0x427d77[_0x51c7('0x48')][_0x51c7('0x64')]=_0x3fbc26['id'];if(_0x305152['query'][_0x51c7('0x2e')]){_0x427d77['where']=_[_0x51c7('0x49')](_0x427d77['where'],{'$or':_[_0x51c7('0x30')](_0x427d77['attributes'],function(_0x205a95){var _0x25ef2c={};_0x25ef2c[_0x205a95]={'$like':'%'+_0x305152[_0x51c7('0x3f')][_0x51c7('0x2e')]+'%'};return _0x25ef2c;})});}_0x427d77=_[_0x51c7('0x49')]({},_0x427d77,_0x305152[_0x51c7('0x4b')]);return db['CmHopperBlack'][_0x51c7('0x21')]({'where':_0x427d77[_0x51c7('0x48')]})[_0x51c7('0x27')](function(_0x3a99f2){_0x38918c[_0x51c7('0x21')]=_0x3a99f2;if(_0x305152['query'][_0x51c7('0x4c')]){_0x427d77[_0x51c7('0x4d')]=[{'all':!![]}];}return db[_0x51c7('0x6a')][_0x51c7('0x65')](_0x427d77);})['then'](function(_0x212497){_0x38918c['rows']=_0x212497;return _0x38918c;});}})['then'](respondWithFilteredResult(_0x4bace6,_0x427d77))['catch'](handleError(_0x4bace6,null));};exports['getTeams']=function(_0x26ed72,_0x1b87be,_0x5b0db5){var _0x239a88={};var _0x2a78c6={};var _0xc1f05a;var _0x534eb0;return db[_0x51c7('0x3a')][_0x51c7('0x61')]({'where':{'id':_0x26ed72[_0x51c7('0x51')]['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x1b87be,null))[_0x51c7('0x27')](function(_0x380445){if(_0x380445){_0xc1f05a=_0x380445;_0x2a78c6[_0x51c7('0x3e')]=_[_0x51c7('0x52')](db[_0x51c7('0x6b')][_0x51c7('0x3b')]);_0x2a78c6['query']=_['keys'](_0x26ed72[_0x51c7('0x3f')]);_0x2a78c6['filters']=_[_0x51c7('0x40')](_0x2a78c6[_0x51c7('0x3e')],_0x2a78c6[_0x51c7('0x3f')]);_0x239a88[_0x51c7('0x41')]=_[_0x51c7('0x40')](_0x2a78c6[_0x51c7('0x3e')],qs[_0x51c7('0x42')](_0x26ed72[_0x51c7('0x3f')][_0x51c7('0x42')]));_0x239a88['attributes']=_0x239a88[_0x51c7('0x41')][_0x51c7('0x43')]?_0x239a88[_0x51c7('0x41')]:_0x2a78c6[_0x51c7('0x3e')];_0x239a88['order']=qs[_0x51c7('0x46')](_0x26ed72[_0x51c7('0x3f')][_0x51c7('0x46')]);_0x239a88[_0x51c7('0x48')]=qs[_0x51c7('0x53')](_[_0x51c7('0x47')](_0x26ed72[_0x51c7('0x3f')],_0x2a78c6[_0x51c7('0x53')]));if(_0x26ed72[_0x51c7('0x3f')]['filter']){_0x239a88[_0x51c7('0x48')]=_[_0x51c7('0x49')](_0x239a88['where'],{'$or':_[_0x51c7('0x30')](_0x239a88['attributes'],function(_0x5ce447){var _0x2401c7={};_0x2401c7[_0x5ce447]={'$like':'%'+_0x26ed72['query'][_0x51c7('0x2e')]+'%'};return _0x2401c7;})});}_0x239a88=_[_0x51c7('0x49')]({},_0x239a88,_0x26ed72[_0x51c7('0x4b')]);return _0xc1f05a[_0x51c7('0x6c')](_0x239a88);}})[_0x51c7('0x27')](function(_0x43f024){if(_0x43f024){_0x534eb0=_0x43f024[_0x51c7('0x43')];if(!_0x26ed72[_0x51c7('0x3f')][_0x51c7('0x63')](_0x51c7('0x44'))){_0x239a88[_0x51c7('0x20')]=qs[_0x51c7('0x20')](_0x26ed72['query'][_0x51c7('0x20')]);_0x239a88[_0x51c7('0x1e')]=qs[_0x51c7('0x1e')](_0x26ed72['query'][_0x51c7('0x1e')]);}return _0xc1f05a[_0x51c7('0x6c')](_0x239a88);}})[_0x51c7('0x27')](function(_0xdc3303){if(_0xdc3303){return _0xdc3303?{'count':_0x534eb0,'rows':_0xdc3303}:null;}})['then'](respondWithResult(_0x1b87be,null))[_0x51c7('0x4f')](handleError(_0x1b87be,null));};exports[_0x51c7('0x6d')]=function(_0x15a197,_0x44b5e1,_0x31dcef){var _0x4bfdca=_0x15a197[_0x51c7('0x55')][_0x51c7('0x6e')];var _0x575b1f=_[_0x51c7('0x30')](_0x4bfdca,'id');return db['Team'][_0x51c7('0x65')]({'where':{'id':_0x575b1f},'attributes':['id'],'include':[{'model':db[_0x51c7('0x6f')],'as':'Agents','attributes':['id','name',_0x51c7('0x70'),_0x51c7('0x71'),_0x51c7('0x72')],'raw':!![]}]})['then'](function(_0x387f28){if(_0x387f28){var _0x5dc1ed=_[_0x51c7('0x73')](_0x387f28,function(_0x32e0b8){var _0x240ff9=_0x32e0b8['get']({'plain':!![]});_0x240ff9[_0x51c7('0x74')][_0x51c7('0x75')](function(_0x2969b3){_0x2969b3[_0x51c7('0x76')]=_[_0x51c7('0x34')](_0x4bfdca,{'id':_0x240ff9['id']})[_0x51c7('0x76')];});return _0x240ff9[_0x51c7('0x74')];});return db[_0x51c7('0x3a')][_0x51c7('0x34')]({'where':{'id':_0x15a197['params']['id']}})[_0x51c7('0x27')](function(_0x14cb58){return db[_0x51c7('0x77')]['transaction'](function(_0x465ef1){return _0x14cb58[_0x51c7('0x6d')](_0x575b1f,{'transaction':_0x465ef1})[_0x51c7('0x27')](function(){return BPromise[_0x51c7('0x78')](_0x4bfdca,function(_0x30d4c5){return db['TeamVoiceQueue'][_0x51c7('0x79')]({'TeamId':_0x30d4c5['id'],'VoiceQueueId':_0x15a197[_0x51c7('0x51')]['id'],'penalty':_0x30d4c5[_0x51c7('0x76')]},{'transaction':_0x465ef1});});})['then'](function(){return BPromise['each'](_0x5dc1ed,function(_0x3bff10){return db['UserVoiceQueue'][_0x51c7('0x7a')]({'where':{'UserId':_0x3bff10['id'],'VoiceQueueId':_0x15a197[_0x51c7('0x51')]['id']},'defaults':{'penalty':_0x3bff10['penalty']},'transaction':_0x465ef1});});})['then'](function(){return BPromise[_0x51c7('0x78')](_[_0x51c7('0x2e')](_0x5dc1ed,{'online':!![]}),function(_0x1e38ea){return db[_0x51c7('0x7b')][_0x51c7('0x79')]({'membername':_0x1e38ea[_0x51c7('0x35')],'UserId':_0x1e38ea['id'],'queue_name':_0x14cb58[_0x51c7('0x35')],'VoiceQueueId':_0x14cb58['id'],'interface':_[_0x51c7('0x7c')](_0x1e38ea[_0x51c7('0x72')])?util[_0x51c7('0x7d')](_0x51c7('0x7e'),_0x1e38ea[_0x51c7('0x35')]):_0x1e38ea['interface'],'paused':_0x1e38ea[_0x51c7('0x71')]||![],'penalty':_0x1e38ea['penalty']},{'transaction':_0x465ef1});});})[_0x51c7('0x27')](function(){_0x5dc1ed['forEach'](function(_0x5c28f2){socket['emit'](_0x51c7('0x7f'),{'UserId':_0x5c28f2['id'],'VoiceQueueId':_0x14cb58['id']});});});});});}})[_0x51c7('0x27')](respondWithStatusCode(_0x44b5e1,null))[_0x51c7('0x4f')](handleError(_0x44b5e1,null));};exports[_0x51c7('0x80')]=function(_0x36b4f2,_0x2bfbcc,_0x28a961){return db[_0x51c7('0x6b')]['findAll']({'where':{'id':_0x36b4f2['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x51c7('0x6f')],'as':_0x51c7('0x74'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2bfbcc,null))['then'](function(_0x3bff28){var _0x36e2ea=_[_0x51c7('0x30')](_0x3bff28,'id');var _0x14eb5a=[];var _0x28955e=[];var _0x978c60=squel[_0x51c7('0x81')]();_0x978c60[_0x51c7('0x82')](_0x51c7('0x83'))[_0x51c7('0x84')](_0x51c7('0x85'),'tq')[_0x51c7('0x86')](_0x51c7('0x87'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x51c7('0x48')](_0x51c7('0x88'),_0x36b4f2[_0x51c7('0x51')]['id']);for(var _0x2b2d29=0x0;_0x2b2d29<_0x3bff28[_0x51c7('0x43')];_0x2b2d29+=0x1){let _0x27da85=_0x3bff28[_0x2b2d29];for(var _0x28ac1a=0x0;_0x28ac1a<_0x27da85[_0x51c7('0x74')][_0x51c7('0x43')];_0x28ac1a+=0x1){let _0x3db9e7=_0x27da85[_0x51c7('0x74')][_0x28ac1a];var _0x3a7702=_0x978c60[_0x51c7('0x5c')]();_0x3a7702[_0x51c7('0x48')](_0x51c7('0x89'),_0x3db9e7['id']);_0x28955e[_0x51c7('0x8a')](db[_0x51c7('0x77')][_0x51c7('0x3f')](_0x3a7702[_0x51c7('0x8b')](),{'type':db[_0x51c7('0x77')][_0x51c7('0x8c')]['SELECT']})[_0x51c7('0x27')](function(_0x491e59){if(_0x491e59[_0x51c7('0x43')]===0x1){return _0x3db9e7['id'];}else{var _0x54d582=_[_0x51c7('0x8d')](_[_0x51c7('0x30')](_0x491e59,'TeamId'),function(_0x2b980e){return _[_0x51c7('0x32')](_0x36e2ea,_0x2b980e);});if(_0x54d582){return _0x3db9e7['id'];}}}));}}return BPromise[_0x51c7('0x8e')](_0x28955e)[_0x51c7('0x27')](function(_0x53e643){_0x14eb5a=_(_0x14eb5a)[_0x51c7('0x8f')](_0x53e643)[_0x51c7('0x90')]()[_0x51c7('0x31')]();return db['VoiceQueue']['find']({'where':{'id':_0x36b4f2['params']['id']}})[_0x51c7('0x27')](function(_0x319ccc){return db[_0x51c7('0x77')]['transaction'](function(_0x56b96e){return _0x319ccc[_0x51c7('0x80')](_0x36b4f2[_0x51c7('0x3f')][_0x51c7('0x91')],{'transaction':_0x56b96e})[_0x51c7('0x27')](function(){if(!_[_0x51c7('0x92')](_0x14eb5a)){return _0x319ccc[_0x51c7('0x93')](_0x14eb5a,{'transaction':_0x56b96e})['then'](function(){return db[_0x51c7('0x7b')]['destroy']({'where':{'VoiceQueueId':_0x36b4f2[_0x51c7('0x51')]['id'],'UserId':_0x14eb5a},'transaction':_0x56b96e});});}})[_0x51c7('0x27')](function(){_0x14eb5a['forEach'](function(_0x5ec666){socket[_0x51c7('0x94')](_0x51c7('0x95'),{'UserId':_0x5ec666,'VoiceQueueId':_0x319ccc['id']});});});});});});})[_0x51c7('0x27')](respondWithStatusCode(_0x2bfbcc,null))[_0x51c7('0x4f')](handleError(_0x2bfbcc,null));};exports['addAgents']=function(_0x42d2ce,_0x157420,_0x41c983){var _0x3eb9c1,_0x194c29;return db['VoiceQueue'][_0x51c7('0x34')]({'where':{'id':_0x42d2ce[_0x51c7('0x51')]['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x157420,null))[_0x51c7('0x27')](function(_0x4ddb63){if(_0x4ddb63){_0x194c29=_0x4ddb63;return _0x4ddb63[_0x51c7('0x96')](_0x42d2ce[_0x51c7('0x55')][_0x51c7('0x91')],_[_0x51c7('0x5d')](_0x42d2ce[_0x51c7('0x55')],[_0x51c7('0x91'),'id'])||{})[_0x51c7('0x97')](function(_0x45bdb5){for(var _0x5bceb3=0x0;_0x5bceb3<_0x42d2ce[_0x51c7('0x55')][_0x51c7('0x91')][_0x51c7('0x43')];_0x5bceb3+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x42d2ce[_0x51c7('0x55')]['ids'][_0x5bceb3]),'VoiceQueueId':Number(_0x42d2ce[_0x51c7('0x51')]['id'])});}return _0x45bdb5;});}})[_0x51c7('0x27')](function(_0x1ab86a){_0x3eb9c1=_0x1ab86a||[];if(_0x194c29){return db[_0x51c7('0x6f')][_0x51c7('0x65')]({'where':{'id':_0x42d2ce[_0x51c7('0x55')]['ids']},'attributes':['id','name',_0x51c7('0x70'),_0x51c7('0x71'),_0x51c7('0x72')],'raw':!![]});}})[_0x51c7('0x27')](function(_0xe39649){if(!_[_0x51c7('0x92')](_0xe39649)){var _0x339a44=[];for(var _0x5c7017=0x0;_0x5c7017<_0xe39649[_0x51c7('0x43')];_0x5c7017++){if(_0xe39649[_0x5c7017][_0x51c7('0x70')]){_0x339a44[_0x51c7('0x8a')](db[_0x51c7('0x7b')][_0x51c7('0x79')]({'membername':_0xe39649[_0x5c7017][_0x51c7('0x35')],'UserId':_0xe39649[_0x5c7017]['id'],'queue_name':_0x194c29[_0x51c7('0x35')],'VoiceQueueId':_0x194c29['id'],'interface':_[_0x51c7('0x7c')](_0xe39649[_0x5c7017]['interface'])?util[_0x51c7('0x7d')](_0x51c7('0x7e'),_0xe39649[_0x5c7017][_0x51c7('0x35')]):_0xe39649[_0x5c7017][_0x51c7('0x72')],'paused':_0xe39649[_0x5c7017][_0x51c7('0x71')]||![],'penalty':_0x42d2ce[_0x51c7('0x55')][_0x51c7('0x76')]||0x0}));}}return BPromise[_0x51c7('0x8e')](_0x339a44);}})[_0x51c7('0x27')](function(){return _0x3eb9c1;})[_0x51c7('0x27')](respondWithResult(_0x157420,null))[_0x51c7('0x4f')](handleError(_0x157420,null));};exports['removeAgents']=function(_0xa4d3d4,_0xbac2a2,_0x285b97){return db['VoiceQueue']['find']({'where':{'id':_0xa4d3d4['params']['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0xbac2a2,null))[_0x51c7('0x27')](function(_0x2aa1cc){if(_0x2aa1cc){return _0x2aa1cc['removeAgents'](_0xa4d3d4[_0x51c7('0x3f')][_0x51c7('0x91')])[_0x51c7('0x27')](function(){if(_['isArray'](_0xa4d3d4[_0x51c7('0x3f')][_0x51c7('0x91')])){for(var _0x4e6b10=0x0;_0x4e6b10<_0xa4d3d4[_0x51c7('0x3f')][_0x51c7('0x91')]['length'];_0x4e6b10+=0x1){socket[_0x51c7('0x94')](_0x51c7('0x95'),{'UserId':Number(_0xa4d3d4[_0x51c7('0x3f')]['ids'][_0x4e6b10]),'VoiceQueueId':Number(_0xa4d3d4[_0x51c7('0x51')]['id'])});}}else{socket['emit'](_0x51c7('0x95'),{'UserId':Number(_0xa4d3d4[_0x51c7('0x3f')]['ids']),'VoiceQueueId':Number(_0xa4d3d4[_0x51c7('0x51')]['id'])});}});}})[_0x51c7('0x27')](function(_0x4189e7){return db[_0x51c7('0x7b')]['destroy']({'where':{'VoiceQueueId':_0xa4d3d4[_0x51c7('0x51')]['id'],'UserId':_0xa4d3d4[_0x51c7('0x3f')][_0x51c7('0x91')]}})['then'](function(){return _0x4189e7;});})[_0x51c7('0x27')](respondWithStatusCode(_0xbac2a2,null))['catch'](handleError(_0xbac2a2,null));};exports[_0x51c7('0x98')]=function(_0x1ae1c0,_0x2e623c,_0xf5dc72){var _0x4dbbe1={};var _0x192ab1={};var _0x4ff9c3;var _0x4fd7a4;return db['VoiceQueue'][_0x51c7('0x61')]({'where':{'id':_0x1ae1c0[_0x51c7('0x51')]['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x2e623c,null))[_0x51c7('0x27')](function(_0x19bc39){if(_0x19bc39){_0x4ff9c3=_0x19bc39;_0x192ab1[_0x51c7('0x3e')]=_[_0x51c7('0x52')](db[_0x51c7('0x6f')][_0x51c7('0x3b')]);_0x192ab1['query']=_['keys'](_0x1ae1c0[_0x51c7('0x3f')]);_0x192ab1['filters']=_[_0x51c7('0x40')](_0x192ab1['model'],_0x192ab1[_0x51c7('0x3f')]);_0x4dbbe1[_0x51c7('0x41')]=_[_0x51c7('0x40')](_0x192ab1[_0x51c7('0x3e')],qs['fields'](_0x1ae1c0[_0x51c7('0x3f')][_0x51c7('0x42')]));_0x4dbbe1['attributes']=_0x4dbbe1[_0x51c7('0x41')]['length']?_0x4dbbe1[_0x51c7('0x41')]:_0x192ab1[_0x51c7('0x3e')];_0x4dbbe1[_0x51c7('0x45')]=qs['sort'](_0x1ae1c0[_0x51c7('0x3f')][_0x51c7('0x46')]);_0x4dbbe1[_0x51c7('0x48')]=qs[_0x51c7('0x53')](_['pick'](_0x1ae1c0['query'],_0x192ab1[_0x51c7('0x53')]));if(_0x1ae1c0[_0x51c7('0x3f')][_0x51c7('0x2e')]){_0x4dbbe1[_0x51c7('0x48')]=_[_0x51c7('0x49')](_0x4dbbe1[_0x51c7('0x48')],{'$or':_['map'](_0x4dbbe1[_0x51c7('0x41')],function(_0x5122dd){var _0x5a3295={};_0x5a3295[_0x5122dd]={'$like':'%'+_0x1ae1c0[_0x51c7('0x3f')][_0x51c7('0x2e')]+'%'};return _0x5a3295;})});}_0x4dbbe1=_[_0x51c7('0x49')]({},_0x4dbbe1,_0x1ae1c0[_0x51c7('0x4b')]);return _0x4ff9c3[_0x51c7('0x98')](_0x4dbbe1);}})['then'](function(_0x5d03ae){if(_0x5d03ae){_0x4fd7a4=_0x5d03ae[_0x51c7('0x43')];if(!_0x1ae1c0['query'][_0x51c7('0x63')](_0x51c7('0x44'))){_0x4dbbe1[_0x51c7('0x20')]=qs[_0x51c7('0x20')](_0x1ae1c0[_0x51c7('0x3f')][_0x51c7('0x20')]);_0x4dbbe1['offset']=qs[_0x51c7('0x1e')](_0x1ae1c0[_0x51c7('0x3f')][_0x51c7('0x1e')]);}return _0x4ff9c3[_0x51c7('0x98')](_0x4dbbe1);}})[_0x51c7('0x27')](function(_0xe28177){if(_0xe28177){return _0xe28177?{'count':_0x4fd7a4,'rows':_0xe28177}:null;}})[_0x51c7('0x27')](respondWithResult(_0x2e623c,null))[_0x51c7('0x4f')](handleError(_0x2e623c,null));};exports[_0x51c7('0x99')]=function(_0x542262,_0x158ca7,_0x18750d){var _0x976dff={};var _0x31cef5={};var _0x55c0c6;var _0x3e685d;return db[_0x51c7('0x3a')][_0x51c7('0x61')]({'where':{'id':_0x542262['params']['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x158ca7,null))[_0x51c7('0x27')](function(_0x5b12d0){if(_0x5b12d0){_0x55c0c6=_0x5b12d0;_0x31cef5['model']=_[_0x51c7('0x52')](db['UserVoiceQueueRt'][_0x51c7('0x3b')]);_0x31cef5[_0x51c7('0x3f')]=_['keys'](_0x542262['query']);_0x31cef5['filters']=_['intersection'](_0x31cef5[_0x51c7('0x3e')],_0x31cef5['query']);_0x976dff[_0x51c7('0x41')]=_[_0x51c7('0x40')](_0x31cef5[_0x51c7('0x3e')],qs[_0x51c7('0x42')](_0x542262[_0x51c7('0x3f')][_0x51c7('0x42')]));_0x976dff['attributes']=_0x976dff[_0x51c7('0x41')][_0x51c7('0x43')]?_0x976dff[_0x51c7('0x41')]:_0x31cef5[_0x51c7('0x3e')];_0x976dff[_0x51c7('0x45')]=qs[_0x51c7('0x46')](_0x542262[_0x51c7('0x3f')][_0x51c7('0x46')]);_0x976dff[_0x51c7('0x48')]=qs[_0x51c7('0x53')](_['pick'](_0x542262[_0x51c7('0x3f')],_0x31cef5[_0x51c7('0x53')]));if(_0x542262[_0x51c7('0x3f')][_0x51c7('0x2e')]){_0x976dff[_0x51c7('0x48')]=_['merge'](_0x976dff[_0x51c7('0x48')],{'$or':_[_0x51c7('0x30')](_0x976dff[_0x51c7('0x41')],function(_0x3b85db){var _0x1c4f59={};_0x1c4f59[_0x3b85db]={'$like':'%'+_0x542262[_0x51c7('0x3f')][_0x51c7('0x2e')]+'%'};return _0x1c4f59;})});}_0x976dff=_['merge']({},_0x976dff,_0x542262[_0x51c7('0x4b')]);return _0x55c0c6[_0x51c7('0x99')](_0x976dff);}})[_0x51c7('0x27')](function(_0x7437ba){if(_0x7437ba){_0x3e685d=_0x7437ba['length'];if(!_0x542262['query']['hasOwnProperty'](_0x51c7('0x44'))){_0x976dff['limit']=qs[_0x51c7('0x20')](_0x542262[_0x51c7('0x3f')][_0x51c7('0x20')]);_0x976dff[_0x51c7('0x1e')]=qs[_0x51c7('0x1e')](_0x542262[_0x51c7('0x3f')][_0x51c7('0x1e')]);}return _0x55c0c6[_0x51c7('0x99')](_0x976dff);}})[_0x51c7('0x27')](function(_0x4199d7){return _0x4199d7?{'count':_0x3e685d,'rows':_0x4199d7}:null;})['then'](respondWithResult(_0x158ca7,null))[_0x51c7('0x4f')](handleError(_0x158ca7,null));};exports[_0x51c7('0x9a')]=function(_0x48ca7c,_0x2f3cc9,_0x1ba036){var _0xab5656={};var _0x871e3d={};var _0x3a5ab9;var _0x3006b9;return db['VoiceQueue'][_0x51c7('0x61')]({'where':{'id':_0x48ca7c['params']['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x2f3cc9,null))[_0x51c7('0x27')](function(_0x2cc43d){if(_0x2cc43d){_0x3a5ab9=_0x2cc43d;_0x871e3d[_0x51c7('0x3e')]=_['keys'](db['CmList'][_0x51c7('0x3b')]);_0x871e3d[_0x51c7('0x3f')]=_[_0x51c7('0x52')](_0x48ca7c[_0x51c7('0x3f')]);_0x871e3d[_0x51c7('0x53')]=_['intersection'](_0x871e3d[_0x51c7('0x3e')],_0x871e3d[_0x51c7('0x3f')]);_0xab5656[_0x51c7('0x41')]=_[_0x51c7('0x40')](_0x871e3d['model'],qs[_0x51c7('0x42')](_0x48ca7c['query']['fields']));_0xab5656[_0x51c7('0x41')]=_0xab5656[_0x51c7('0x41')][_0x51c7('0x43')]?_0xab5656[_0x51c7('0x41')]:_0x871e3d['model'];_0xab5656[_0x51c7('0x45')]=qs[_0x51c7('0x46')](_0x48ca7c[_0x51c7('0x3f')][_0x51c7('0x46')]);_0xab5656[_0x51c7('0x48')]=qs[_0x51c7('0x53')](_[_0x51c7('0x47')](_0x48ca7c[_0x51c7('0x3f')],_0x871e3d['filters']));if(_0x48ca7c[_0x51c7('0x3f')][_0x51c7('0x2e')]){_0xab5656[_0x51c7('0x48')]=_[_0x51c7('0x49')](_0xab5656['where'],{'$or':_[_0x51c7('0x30')](_0xab5656[_0x51c7('0x41')],function(_0x4ce974){var _0x45851b={};_0x45851b[_0x4ce974]={'$like':'%'+_0x48ca7c[_0x51c7('0x3f')]['filter']+'%'};return _0x45851b;})});}_0xab5656=_[_0x51c7('0x49')]({},_0xab5656,_0x48ca7c[_0x51c7('0x4b')]);return _0x3a5ab9[_0x51c7('0x9a')](_0xab5656);}})[_0x51c7('0x27')](function(_0x169342){if(_0x169342){_0x3006b9=_0x169342[_0x51c7('0x43')];if(!_0x48ca7c['query']['hasOwnProperty'](_0x51c7('0x44'))){_0xab5656['limit']=qs['limit'](_0x48ca7c[_0x51c7('0x3f')]['limit']);_0xab5656[_0x51c7('0x1e')]=qs['offset'](_0x48ca7c['query']['offset']);}return _0x3a5ab9['getLists'](_0xab5656);}})[_0x51c7('0x27')](function(_0xcf21e){if(_0xcf21e){return _0xcf21e?{'count':_0x3006b9,'rows':_0xcf21e}:null;}})[_0x51c7('0x27')](respondWithResult(_0x2f3cc9,null))['catch'](handleError(_0x2f3cc9,null));};exports[_0x51c7('0x9b')]=function(_0x32b7c0,_0x273c4b,_0x2ad573){var _0x12e2af=moment()[_0x51c7('0x7d')](_0x51c7('0x9c'));var _0x132606,_0x1aa3b0;return db[_0x51c7('0x3a')][_0x51c7('0x34')]({'where':{'id':_0x32b7c0[_0x51c7('0x51')]['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x273c4b,null))[_0x51c7('0x27')](function(_0x39975e){if(_0x39975e){_0x1aa3b0=_0x39975e;return _0x39975e['addLists'](_0x32b7c0[_0x51c7('0x55')][_0x51c7('0x91')],_['omit'](_0x32b7c0[_0x51c7('0x55')],[_0x51c7('0x91'),'id'])||{});}return null;})[_0x51c7('0x97')](function(_0xd2de04){var _0x1e1a8c;_0x132606=_0xd2de04||[];var _0xef4fe=[];if(_0xd2de04){for(var _0x4654be=0x0;_0x4654be<_0xd2de04[_0x51c7('0x43')];_0x4654be+=0x1){var _0x59f535=_0xd2de04[_0x4654be][_0x51c7('0x29')]({'plain':!![]});_0x1aa3b0[_0x51c7('0x9d')]=_0x32b7c0['body'][_0x51c7('0x9d')]?_0x32b7c0['body'][_0x51c7('0x9d')]:_0x1aa3b0[_0x51c7('0x9d')];switch(_0x1aa3b0[_0x51c7('0x9d')]){case _0x51c7('0x9e'):_0x1e1a8c=squel[_0x51c7('0x9f')]()[_0x51c7('0xa0')](_0x51c7('0xa1'))[_0x51c7('0xa2')]([_0x51c7('0xa3'),_0x51c7('0xa4'),_0x51c7('0xa5'),_0x51c7('0xa6'),'VoiceQueueId',_0x51c7('0x5e'),_0x51c7('0x5f')],squel[_0x51c7('0x81')]()[_0x51c7('0x82')](_0x51c7('0xa3'),'phone')['field']('\x27'+_0x12e2af+'\x27',_0x51c7('0xa4'))[_0x51c7('0x82')]('id',_0x51c7('0xa5'))[_0x51c7('0x82')](_0x59f535[_0x51c7('0xa7')][_0x51c7('0x8b')](),'ListId')[_0x51c7('0x82')](_0x32b7c0[_0x51c7('0x51')]['id'][_0x51c7('0x8b')](),'VoiceQueueId')[_0x51c7('0x82')]('\x27'+_0x12e2af+'\x27',_0x51c7('0x5e'))[_0x51c7('0x82')]('\x27'+_0x12e2af+'\x27',_0x51c7('0x5f'))['from'](_0x51c7('0xa8'))[_0x51c7('0x48')]('deletedAt\x20IS\x20NULL')['where'](_0x51c7('0xa9'),_0x59f535[_0x51c7('0xa7')][_0x51c7('0x8b')]())[_0x51c7('0x48')](_0x51c7('0xaa'))[_0x51c7('0x48')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x51c7('0xab'))[_0x51c7('0x84')]('cm_hopper_final')[_0x51c7('0x48')](_0x51c7('0x88'),_0x32b7c0[_0x51c7('0x51')]['id'][_0x51c7('0x8b')]()))[_0x51c7('0x48')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x51c7('0xac'))['from'](_0x51c7('0xa1'))[_0x51c7('0x48')](_0x51c7('0x88'),_0x32b7c0[_0x51c7('0x51')]['id'][_0x51c7('0x8b')]())))['toString']();break;case'onlyIfOpen':_0x1e1a8c=squel[_0x51c7('0x9f')]()['into']('cm_hopper')[_0x51c7('0xa2')](['phone','scheduledAt',_0x51c7('0xa5'),_0x51c7('0xa6'),_0x51c7('0x64'),_0x51c7('0x5e'),_0x51c7('0x5f')],squel[_0x51c7('0x81')]()[_0x51c7('0x82')](_0x51c7('0xa3'),_0x51c7('0xa3'))[_0x51c7('0x82')]('\x27'+_0x12e2af+'\x27',_0x51c7('0xa4'))[_0x51c7('0x82')]('id','ContactId')[_0x51c7('0x82')](_0x59f535['CmListId']['toString'](),_0x51c7('0xa6'))['field'](_0x32b7c0['params']['id'][_0x51c7('0x8b')](),_0x51c7('0x64'))[_0x51c7('0x82')]('\x27'+_0x12e2af+'\x27',_0x51c7('0x5e'))[_0x51c7('0x82')]('\x27'+_0x12e2af+'\x27',_0x51c7('0x5f'))[_0x51c7('0x84')](_0x51c7('0xa8'))[_0x51c7('0x48')](_0x51c7('0xad'))['where'](_0x51c7('0xa9'),_0x59f535[_0x51c7('0xa7')][_0x51c7('0x8b')]())[_0x51c7('0x48')](_0x51c7('0xaa'))[_0x51c7('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x51c7('0x81')]()[_0x51c7('0x82')]('COALESCE(phone,\x27\x27)')[_0x51c7('0x84')](_0x51c7('0xa1'))[_0x51c7('0x48')](_0x51c7('0x88'),_0x32b7c0[_0x51c7('0x51')]['id'][_0x51c7('0x8b')]())))['toString']();break;default:_0x1e1a8c=squel[_0x51c7('0x9f')]()[_0x51c7('0xa0')](_0x51c7('0xa1'))[_0x51c7('0xa2')]([_0x51c7('0xa3'),_0x51c7('0xa4'),_0x51c7('0xa5'),_0x51c7('0xa6'),'VoiceQueueId','createdAt',_0x51c7('0x5f')],squel[_0x51c7('0x81')]()[_0x51c7('0x82')](_0x51c7('0xa3'),_0x51c7('0xa3'))[_0x51c7('0x82')]('\x27'+_0x12e2af+'\x27','scheduledAt')[_0x51c7('0x82')]('id',_0x51c7('0xa5'))[_0x51c7('0x82')](_0x59f535[_0x51c7('0xa7')][_0x51c7('0x8b')](),'ListId')['field'](_0x32b7c0[_0x51c7('0x51')]['id']['toString'](),'VoiceQueueId')[_0x51c7('0x82')]('\x27'+_0x12e2af+'\x27',_0x51c7('0x5e'))[_0x51c7('0x82')]('\x27'+_0x12e2af+'\x27',_0x51c7('0x5f'))[_0x51c7('0x84')](_0x51c7('0xa8'))[_0x51c7('0x48')]('deletedAt\x20IS\x20NULL')[_0x51c7('0x48')]('ListId\x20=\x20?',_0x59f535[_0x51c7('0xa7')][_0x51c7('0x8b')]())['where'](_0x51c7('0xaa')))['toString']();}_0xef4fe[_0x51c7('0x8a')](db['sequelize'][_0x51c7('0x3f')](_0x1e1a8c));}return BPromise[_0x51c7('0x8e')](_0xef4fe);}})[_0x51c7('0x27')](function(){var _0x22b1ca=[];var _0xb5a589=squel[_0x51c7('0x9f')]()['into'](_0x51c7('0xae'))[_0x51c7('0xa2')]([_0x51c7('0xaf'),'phone',_0x51c7('0xb0'),_0x51c7('0x5e'),_0x51c7('0x5f')],squel[_0x51c7('0x81')]()[_0x51c7('0x82')](_0x51c7('0xb1'))[_0x51c7('0x82')]('ci.item')['field'](_0x51c7('0xb2'))['field']('\x27'+_0x12e2af+'\x27','createdAt')[_0x51c7('0x82')]('\x27'+_0x12e2af+'\x27',_0x51c7('0x5f'))[_0x51c7('0x84')](_0x51c7('0xb3'),'ci')[_0x51c7('0x86')](_0x51c7('0xa1'),'h','h.ContactId=ci.CmContactId')['where']('h.scheduledat=?',_0x12e2af)[_0x51c7('0x48')](_0x51c7('0xb4'),'PHONE'))['toString']();_0x22b1ca[_0x51c7('0x8a')](db[_0x51c7('0x77')][_0x51c7('0x3f')](_0xb5a589));return BPromise[_0x51c7('0x8e')](_0x22b1ca);})[_0x51c7('0x27')](function(){return _0x132606;})[_0x51c7('0x27')](respondWithResult(_0x273c4b,null))[_0x51c7('0x4f')](handleError(_0x273c4b,null));};exports['removeLists']=function(_0x42422d,_0x30e6d5,_0x524249){return db['VoiceQueue']['find']({'where':{'id':_0x42422d[_0x51c7('0x51')]['id']}})['then'](handleEntityNotFound(_0x30e6d5,null))[_0x51c7('0x27')](function(_0x49ea52){if(_0x49ea52){return _0x49ea52[_0x51c7('0xb5')](_0x42422d[_0x51c7('0x3f')][_0x51c7('0x91')]);}})[_0x51c7('0x27')](function(_0x188476){if(_0x188476){return db[_0x51c7('0x62')]['destroy']({'where':{'ListId':_0x42422d[_0x51c7('0x3f')][_0x51c7('0x91')],'VoiceQueueId':_0x42422d[_0x51c7('0x51')]['id']}})[_0x51c7('0x27')](function(){return _0x188476;});}})[_0x51c7('0x27')](respondWithStatusCode(_0x30e6d5,null))[_0x51c7('0x4f')](handleError(_0x30e6d5,null));};exports[_0x51c7('0xb6')]=function(_0x1f27bb,_0x5b6220,_0x41c760){var _0x472cf0={};var _0x18c0da={};var _0x3cc9f1;var _0x29bd98;return db['VoiceQueue'][_0x51c7('0x61')]({'where':{'id':_0x1f27bb[_0x51c7('0x51')]['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x5b6220,null))[_0x51c7('0x27')](function(_0x4eae77){if(_0x4eae77){_0x3cc9f1=_0x4eae77;_0x18c0da[_0x51c7('0x3e')]=_[_0x51c7('0x52')](db[_0x51c7('0xb7')][_0x51c7('0x3b')]);_0x18c0da[_0x51c7('0x3f')]=_[_0x51c7('0x52')](_0x1f27bb[_0x51c7('0x3f')]);_0x18c0da[_0x51c7('0x53')]=_['intersection'](_0x18c0da[_0x51c7('0x3e')],_0x18c0da['query']);_0x472cf0[_0x51c7('0x41')]=_['intersection'](_0x18c0da[_0x51c7('0x3e')],qs[_0x51c7('0x42')](_0x1f27bb[_0x51c7('0x3f')][_0x51c7('0x42')]));_0x472cf0[_0x51c7('0x41')]=_0x472cf0[_0x51c7('0x41')]['length']?_0x472cf0['attributes']:_0x18c0da[_0x51c7('0x3e')];_0x472cf0[_0x51c7('0x45')]=qs[_0x51c7('0x46')](_0x1f27bb[_0x51c7('0x3f')][_0x51c7('0x46')]);_0x472cf0[_0x51c7('0x48')]=qs[_0x51c7('0x53')](_[_0x51c7('0x47')](_0x1f27bb[_0x51c7('0x3f')],_0x18c0da['filters']));if(_0x1f27bb[_0x51c7('0x3f')][_0x51c7('0x2e')]){_0x472cf0[_0x51c7('0x48')]=_[_0x51c7('0x49')](_0x472cf0[_0x51c7('0x48')],{'$or':_[_0x51c7('0x30')](_0x472cf0['attributes'],function(_0x34cc41){var _0x5292a6={};_0x5292a6[_0x34cc41]={'$like':'%'+_0x1f27bb[_0x51c7('0x3f')][_0x51c7('0x2e')]+'%'};return _0x5292a6;})});}_0x472cf0=_[_0x51c7('0x49')]({},_0x472cf0,_0x1f27bb[_0x51c7('0x4b')]);return _0x3cc9f1[_0x51c7('0xb6')](_0x472cf0);}})[_0x51c7('0x27')](function(_0x10b00e){if(_0x10b00e){_0x29bd98=_0x10b00e['length'];if(!_0x1f27bb[_0x51c7('0x3f')][_0x51c7('0x63')](_0x51c7('0x44'))){_0x472cf0['limit']=qs[_0x51c7('0x20')](_0x1f27bb[_0x51c7('0x3f')][_0x51c7('0x20')]);_0x472cf0['offset']=qs['offset'](_0x1f27bb[_0x51c7('0x3f')][_0x51c7('0x1e')]);}return _0x3cc9f1[_0x51c7('0xb6')](_0x472cf0);}})[_0x51c7('0x27')](function(_0x1d87cc){if(_0x1d87cc){return _0x1d87cc?{'count':_0x29bd98,'rows':_0x1d87cc}:null;}})[_0x51c7('0x27')](respondWithResult(_0x5b6220,null))[_0x51c7('0x4f')](handleError(_0x5b6220,null));};exports[_0x51c7('0xb8')]=function(_0x1633e7,_0x371605,_0x37472f){var _0x2b47e6,_0x3bad87;return db[_0x51c7('0x3a')][_0x51c7('0x34')]({'where':{'id':_0x1633e7[_0x51c7('0x51')]['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x371605,null))[_0x51c7('0x27')](function(_0x1d94e4){if(_0x1d94e4){_0x3bad87=_0x1d94e4;return _0x1d94e4[_0x51c7('0xb8')](_0x1633e7['body'][_0x51c7('0x91')],_[_0x51c7('0x5d')](_0x1633e7['body'],[_0x51c7('0x91'),'id'])||{});}return null;})['spread'](function(_0x138d50){var _0x5ef59d;_0x2b47e6=_0x138d50||[];var _0xb6377=[];if(_0x138d50){for(var _0x3f7bb1=0x0;_0x3f7bb1<_0x138d50[_0x51c7('0x43')];_0x3f7bb1+=0x1){var _0x24dcd4=_0x138d50[_0x3f7bb1][_0x51c7('0x29')]({'plain':!![]});_0x5ef59d=squel['insert']()[_0x51c7('0xa0')](_0x51c7('0xb9'))['fromQuery']([_0x51c7('0xa3'),_0x51c7('0xa5'),_0x51c7('0xa6'),_0x51c7('0x64'),_0x51c7('0x5e'),_0x51c7('0x5f')],squel[_0x51c7('0x81')]()[_0x51c7('0x82')](_0x51c7('0xa3'),_0x51c7('0xa3'))[_0x51c7('0x82')]('id',_0x51c7('0xa5'))[_0x51c7('0x82')](_0x24dcd4[_0x51c7('0xa7')][_0x51c7('0x8b')](),'ListId')[_0x51c7('0x82')](_0x1633e7[_0x51c7('0x51')]['id'][_0x51c7('0x8b')](),_0x51c7('0x64'))['field']('NOW()',_0x51c7('0x5e'))[_0x51c7('0x82')](_0x51c7('0xba'),_0x51c7('0x5f'))[_0x51c7('0x84')](_0x51c7('0xa8'))[_0x51c7('0x48')]('deletedAt\x20IS\x20NULL')[_0x51c7('0x48')]('ListId\x20=\x20?',_0x24dcd4[_0x51c7('0xa7')][_0x51c7('0x8b')]())[_0x51c7('0x48')](_0x51c7('0xaa')))[_0x51c7('0x8b')]();_0xb6377[_0x51c7('0x8a')](db[_0x51c7('0x77')][_0x51c7('0x3f')](_0x5ef59d));}return BPromise[_0x51c7('0x8e')](_0xb6377);}})[_0x51c7('0x27')](function(){return _0x2b47e6;})['then'](respondWithResult(_0x371605,null))[_0x51c7('0x4f')](handleError(_0x371605,null));};exports['removeBlackLists']=function(_0x22359e,_0x35fbe9,_0x196e58){return db[_0x51c7('0x3a')][_0x51c7('0x34')]({'where':{'id':_0x22359e[_0x51c7('0x51')]['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x35fbe9,null))[_0x51c7('0x27')](function(_0x18296f){if(_0x18296f){return _0x18296f['removeBlackLists'](_0x22359e[_0x51c7('0x3f')][_0x51c7('0x91')]);}})[_0x51c7('0x27')](function(_0x4d7652){if(_0x4d7652){return db['CmHopperBlack'][_0x51c7('0x28')]({'where':{'ListId':_0x22359e[_0x51c7('0x3f')][_0x51c7('0x91')],'VoiceQueueId':_0x22359e['params']['id']}})[_0x51c7('0x27')](function(){return _0x4d7652;});}})[_0x51c7('0x27')](respondWithStatusCode(_0x35fbe9,null))[_0x51c7('0x4f')](handleError(_0x35fbe9,null));};
\ No newline at end of file
+var _0xc9c3=['map','value','includes','find','type','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','query','filters','attributes','intersection','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','VoiceQueue','findAll','rows','catch','show','params','keys','length','includeAll','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','QueueCampaigns','outbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','addTeams','TeamVoiceQueue','upsert','UserVoiceQueue','each','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','every','TeamId','all','transaction','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','CmListId','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','fromQuery','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','inbound','filter','ignore'];(function(_0x49864e,_0x18c8c6){var _0x148ac6=function(_0x282d84){while(--_0x282d84){_0x49864e['push'](_0x49864e['shift']());}};_0x148ac6(++_0x18c8c6);}(_0xc9c3,0x96));var _0x3c9c=function(_0x5caf31,_0x3aaeac){_0x5caf31=_0x5caf31-0x0;var _0x36f7b3=_0xc9c3[_0x5caf31];return _0x36f7b3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3c9c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c9c('0x1'));var moment=require(_0x3c9c('0x2'));var BPromise=require(_0x3c9c('0x3'));var Mustache=require(_0x3c9c('0x4'));var util=require(_0x3c9c('0x5'));var path=require(_0x3c9c('0x6'));var sox=require(_0x3c9c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c9c('0x8'));var squel=require(_0x3c9c('0x9'));var crypto=require(_0x3c9c('0xa'));var jsforce=require(_0x3c9c('0xb'));var deskjs=require(_0x3c9c('0xc'));var toCsv=require(_0x3c9c('0xd'));var querystring=require(_0x3c9c('0xe'));var Papa=require(_0x3c9c('0xf'));var Redis=require(_0x3c9c('0x10'));var authService=require(_0x3c9c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3c9c('0x12'));var hardwareService=require(_0x3c9c('0x13'));var logger=require('../../config/logger')(_0x3c9c('0x14'));var utils=require('../../config/utils');var config=require(_0x3c9c('0x15'));var licenseUtil=require(_0x3c9c('0x16'));var db=require(_0x3c9c('0x17'))['db'];config[_0x3c9c('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3c9c('0x19'))(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x22c495,_0x59d169){_0x59d169=_0x59d169||0xcc;return function(_0x3f1881){if(_0x3f1881){return _0x22c495[_0x3c9c('0x1a')](_0x59d169);}return _0x22c495[_0x3c9c('0x1b')](_0x59d169)[_0x3c9c('0x1c')]();};}function respondWithResult(_0x4a43d2,_0x265cc2){_0x265cc2=_0x265cc2||0xc8;return function(_0x490383){if(_0x490383){return _0x4a43d2['status'](_0x265cc2)['json'](_0x490383);}};}function respondWithFilteredResult(_0x3200a3,_0x32d94a){return function(_0x216fd8){if(_0x216fd8){var _0x3eee19=typeof _0x32d94a[_0x3c9c('0x1d')]===_0x3c9c('0x1e')&&typeof _0x32d94a[_0x3c9c('0x1f')]==='undefined';var _0x15a90a=_0x216fd8['count'];var _0x461711=_0x3eee19?0x0:_0x32d94a['offset'];var _0x164fde=_0x3eee19?_0x216fd8[_0x3c9c('0x20')]:_0x32d94a['offset']+_0x32d94a[_0x3c9c('0x1f')];var _0x29e4ac;if(_0x164fde>=_0x15a90a){_0x164fde=_0x15a90a;_0x29e4ac=0xc8;}else{_0x29e4ac=0xce;}_0x3200a3[_0x3c9c('0x1b')](_0x29e4ac);return _0x3200a3['set'](_0x3c9c('0x21'),_0x461711+'-'+_0x164fde+'/'+_0x15a90a)[_0x3c9c('0x22')](_0x216fd8);}return null;};}function patchUpdates(_0x2d5ffc){return function(_0x937abf){try{jsonpatch[_0x3c9c('0x23')](_0x937abf,_0x2d5ffc,!![]);}catch(_0x3bc5c4){return BPromise[_0x3c9c('0x24')](_0x3bc5c4);}return _0x937abf[_0x3c9c('0x25')]();};}function saveUpdates(_0x509bf7,_0x6ed08a){return function(_0x4d58b9){if(_0x4d58b9){return _0x4d58b9[_0x3c9c('0x26')](_0x509bf7)[_0x3c9c('0x27')](function(_0x4ca078){return _0x4ca078;});}return null;};}function removeEntity(_0x527bb9,_0x379880){return function(_0x1e8589){if(_0x1e8589){return _0x1e8589[_0x3c9c('0x28')]()[_0x3c9c('0x27')](function(){var _0x4c283d=_0x1e8589[_0x3c9c('0x29')]({'plain':!![]});var _0x65b831=[{'name':'VoiceQueues','value':_0x3c9c('0x2a'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x3aeb60=_(_0x65b831)[_0x3c9c('0x2b')](_0x3c9c('0x2c'))[_0x3c9c('0x2d')](_0x3c9c('0x2e'))['value']();if(_[_0x3c9c('0x2f')](_0x3aeb60,_0x4c283d['type'])){return;}var _0x18b434=_[_0x3c9c('0x30')](_0x65b831,[_0x3c9c('0x2e'),_0x4c283d[_0x3c9c('0x31')]])['name'];return db[_0x3c9c('0x32')][_0x3c9c('0x28')]({'where':{'type':_0x18b434,'resourceId':_0x4c283d['id']}})[_0x3c9c('0x27')](function(){return _0x1e8589;});})[_0x3c9c('0x27')](function(){_0x527bb9[_0x3c9c('0x1b')](0xcc)[_0x3c9c('0x1c')]();});}};}function handleEntityNotFound(_0x314403,_0x317209){return function(_0x4d9c55){if(!_0x4d9c55){_0x314403[_0x3c9c('0x1a')](0x194);}return _0x4d9c55;};}function handleError(_0x1b36a8,_0x1b5226){_0x1b5226=_0x1b5226||0x1f4;return function(_0x38ca2e){logger[_0x3c9c('0x33')](_0x38ca2e[_0x3c9c('0x34')]);if(_0x38ca2e[_0x3c9c('0x35')]){delete _0x38ca2e[_0x3c9c('0x35')];}_0x1b36a8[_0x3c9c('0x1b')](_0x1b5226)[_0x3c9c('0x36')](_0x38ca2e);};}exports[_0x3c9c('0x37')]=function(_0xb86ddc,_0x394a50){var _0x1662ac={},_0x5f4f64={},_0xa1d0f={'count':0x0,'rows':[]};var _0x34266f=_[_0x3c9c('0x2d')](db['VoiceQueue'][_0x3c9c('0x38')],function(_0x7a3545){return{'name':_0x7a3545[_0x3c9c('0x39')],'type':_0x7a3545[_0x3c9c('0x31')]['key']};});_0x5f4f64['model']=_[_0x3c9c('0x2d')](_0x34266f,_0x3c9c('0x35'));_0x5f4f64[_0x3c9c('0x3a')]=_['keys'](_0xb86ddc['query']);_0x5f4f64[_0x3c9c('0x3b')]=_['intersection'](_0x5f4f64['model'],_0x5f4f64[_0x3c9c('0x3a')]);_0x1662ac[_0x3c9c('0x3c')]=_[_0x3c9c('0x3d')](_0x5f4f64['model'],qs[_0x3c9c('0x3e')](_0xb86ddc[_0x3c9c('0x3a')][_0x3c9c('0x3e')]));_0x1662ac['attributes']=_0x1662ac['attributes']['length']?_0x1662ac[_0x3c9c('0x3c')]:_0x5f4f64[_0x3c9c('0x3f')];if(!_0xb86ddc[_0x3c9c('0x3a')][_0x3c9c('0x40')](_0x3c9c('0x41'))){_0x1662ac[_0x3c9c('0x1f')]=qs['limit'](_0xb86ddc['query'][_0x3c9c('0x1f')]);_0x1662ac[_0x3c9c('0x1d')]=qs[_0x3c9c('0x1d')](_0xb86ddc['query'][_0x3c9c('0x1d')]);}_0x1662ac[_0x3c9c('0x42')]=qs[_0x3c9c('0x43')](_0xb86ddc['query']['sort']);_0x1662ac[_0x3c9c('0x44')]=qs[_0x3c9c('0x3b')](_[_0x3c9c('0x45')](_0xb86ddc['query'],_0x5f4f64[_0x3c9c('0x3b')]),_0x34266f);if(_0xb86ddc[_0x3c9c('0x3a')][_0x3c9c('0x2b')]){_0x1662ac[_0x3c9c('0x44')]=_['merge'](_0x1662ac[_0x3c9c('0x44')],{'$or':_[_0x3c9c('0x2d')](_0x34266f,function(_0x55496a){if(_0x55496a['type']!==_0x3c9c('0x46')){var _0xe92b80={};_0xe92b80[_0x55496a['name']]={'$like':'%'+_0xb86ddc[_0x3c9c('0x3a')][_0x3c9c('0x2b')]+'%'};return _0xe92b80;}})});}_0x1662ac=_[_0x3c9c('0x47')]({},_0x1662ac,_0xb86ddc[_0x3c9c('0x48')]);var _0x40b45c={'where':_0x1662ac[_0x3c9c('0x44')]};return db['VoiceQueue'][_0x3c9c('0x20')](_0x40b45c)[_0x3c9c('0x27')](function(_0xae0088){_0xa1d0f[_0x3c9c('0x20')]=_0xae0088;if(_0xb86ddc[_0x3c9c('0x3a')]['includeAll']){_0x1662ac['include']=[{'all':!![]}];}return db[_0x3c9c('0x49')][_0x3c9c('0x4a')](_0x1662ac);})[_0x3c9c('0x27')](function(_0x25285d){_0xa1d0f[_0x3c9c('0x4b')]=_0x25285d;return _0xa1d0f;})['then'](respondWithFilteredResult(_0x394a50,_0x1662ac))[_0x3c9c('0x4c')](handleError(_0x394a50,null));};exports[_0x3c9c('0x4d')]=function(_0x27a013,_0x222ffa){var _0xcd7ebc={'raw':![],'where':{'id':_0x27a013[_0x3c9c('0x4e')]['id']}},_0x58f6b7={};_0x58f6b7[_0x3c9c('0x3f')]=_[_0x3c9c('0x4f')](db[_0x3c9c('0x49')][_0x3c9c('0x38')]);_0x58f6b7[_0x3c9c('0x3a')]=_[_0x3c9c('0x4f')](_0x27a013['query']);_0x58f6b7[_0x3c9c('0x3b')]=_[_0x3c9c('0x3d')](_0x58f6b7[_0x3c9c('0x3f')],_0x58f6b7[_0x3c9c('0x3a')]);_0xcd7ebc[_0x3c9c('0x3c')]=_[_0x3c9c('0x3d')](_0x58f6b7['model'],qs[_0x3c9c('0x3e')](_0x27a013[_0x3c9c('0x3a')][_0x3c9c('0x3e')]));_0xcd7ebc[_0x3c9c('0x3c')]=_0xcd7ebc[_0x3c9c('0x3c')][_0x3c9c('0x50')]?_0xcd7ebc[_0x3c9c('0x3c')]:_0x58f6b7[_0x3c9c('0x3f')];if(_0x27a013[_0x3c9c('0x3a')][_0x3c9c('0x51')]){_0xcd7ebc[_0x3c9c('0x52')]=[{'all':!![]}];}_0xcd7ebc=_[_0x3c9c('0x47')]({},_0xcd7ebc,_0x27a013[_0x3c9c('0x48')]);return db[_0x3c9c('0x49')][_0x3c9c('0x30')](_0xcd7ebc)[_0x3c9c('0x27')](handleEntityNotFound(_0x222ffa,null))['then'](respondWithResult(_0x222ffa,null))['catch'](handleError(_0x222ffa,null));};exports['create']=function(_0xff4ef7,_0x3d9301){return db[_0x3c9c('0x49')][_0x3c9c('0x53')](_0xff4ef7['body'],{})[_0x3c9c('0x27')](function(_0x5b98da){var _0x4a4be4=_0xff4ef7[_0x3c9c('0x54')][_0x3c9c('0x29')]({'plain':!![]});if(!_0x4a4be4)throw new Error(_0x3c9c('0x55'));if(_0x4a4be4[_0x3c9c('0x56')]===_0x3c9c('0x54')){var _0x1f961b=_0x5b98da[_0x3c9c('0x29')]({'plain':!![]});var _0x149f42=[{'name':_0x3c9c('0x57'),'value':'inbound'},{'name':_0x3c9c('0x58'),'value':_0x3c9c('0x59')}];var _0x437ff5=_[_0x3c9c('0x30')](_0x149f42,[_0x3c9c('0x2e'),_0x1f961b[_0x3c9c('0x31')]])[_0x3c9c('0x35')];return db['UserProfileSection']['find']({'where':{'name':_0x437ff5,'userProfileId':_0x4a4be4[_0x3c9c('0x5a')]},'raw':!![]})[_0x3c9c('0x27')](function(_0x3f6347){if(_0x3f6347&&_0x3f6347[_0x3c9c('0x5b')]===0x0){return db[_0x3c9c('0x32')][_0x3c9c('0x53')]({'name':_0x1f961b[_0x3c9c('0x35')],'resourceId':_0x1f961b['id'],'type':_0x3f6347[_0x3c9c('0x35')],'sectionId':_0x3f6347['id']},{})[_0x3c9c('0x27')](function(){return _0x5b98da;});}else{return _0x5b98da;}})[_0x3c9c('0x4c')](function(_0x13ae81){logger[_0x3c9c('0x33')](_0x3c9c('0x5c'),_0x13ae81);throw _0x13ae81;});}return _0x5b98da;})[_0x3c9c('0x27')](respondWithResult(_0x3d9301,0xc9))['catch'](handleError(_0x3d9301,null));};exports[_0x3c9c('0x5d')]=function(_0x4306fe,_0x1b6f0a){var _0x1573f2={'where':{'id':_0x4306fe['params']['id']}},_0x16fbcf={};_0x16fbcf[_0x3c9c('0x3f')]=_[_0x3c9c('0x4f')](db['VoiceQueue']['rawAttributes']);_0x1573f2[_0x3c9c('0x3c')]=_[_0x3c9c('0x3d')](_0x16fbcf['model'],qs[_0x3c9c('0x3e')](_0x4306fe[_0x3c9c('0x3a')][_0x3c9c('0x3e')]));_0x1573f2[_0x3c9c('0x3c')]=_0x1573f2[_0x3c9c('0x3c')][_0x3c9c('0x50')]?_0x1573f2[_0x3c9c('0x3c')]:_0x16fbcf[_0x3c9c('0x3f')];if(_0x4306fe[_0x3c9c('0x3a')][_0x3c9c('0x51')]){_0x1573f2[_0x3c9c('0x52')]=[{'all':!![]}];}_0x1573f2=_['merge']({},_0x1573f2,_0x4306fe[_0x3c9c('0x48')]);return db['VoiceQueue']['find'](_0x1573f2)[_0x3c9c('0x27')](handleEntityNotFound(_0x1b6f0a,null))[_0x3c9c('0x27')](function(_0x1a1485){if(_0x1a1485){var _0x4695a7=_0x1a1485[_0x3c9c('0x29')]({'plain':!![]});_0x4695a7=qs[_0x3c9c('0x5e')](_0x4695a7,['id',_0x3c9c('0x5f'),'updatedAt']);_0x4306fe[_0x3c9c('0x60')]=_[_0x3c9c('0x5e')](_0x4306fe[_0x3c9c('0x60')],['id',_0x3c9c('0x5f'),_0x3c9c('0x61')]);return db['VoiceQueue']['create'](_[_0x3c9c('0x47')](_0x4695a7,_0x4306fe[_0x3c9c('0x60')]),{'include':_0x4306fe[_0x3c9c('0x3a')][_0x3c9c('0x51')]?[{'all':!![]}]:undefined})[_0x3c9c('0x27')](function(_0x990934){var _0x332503=_0x4306fe[_0x3c9c('0x54')][_0x3c9c('0x29')]({'plain':!![]});if(!_0x332503)throw new Error(_0x3c9c('0x55'));if(_0x332503[_0x3c9c('0x56')]===_0x3c9c('0x54')){var _0x4311c0=_0x990934[_0x3c9c('0x29')]({'plain':!![]});var _0xd46ccf=[{'name':_0x3c9c('0x57'),'value':_0x3c9c('0x2a')},{'name':'QueueCampaigns','value':_0x3c9c('0x59')}];var _0x56a197=_['find'](_0xd46ccf,[_0x3c9c('0x2e'),_0x4311c0[_0x3c9c('0x31')]])[_0x3c9c('0x35')];return db['UserProfileSection'][_0x3c9c('0x30')]({'where':{'name':_0x56a197,'userProfileId':_0x332503[_0x3c9c('0x5a')]},'raw':!![]})['then'](function(_0x23cb34){if(_0x23cb34&&_0x23cb34[_0x3c9c('0x5b')]===0x0){return db['UserProfileResource']['create']({'name':_0x4311c0['name'],'resourceId':_0x4311c0['id'],'type':_0x23cb34[_0x3c9c('0x35')],'sectionId':_0x23cb34['id']},{})[_0x3c9c('0x27')](function(){return _0x990934;});}else{return _0x990934;}})[_0x3c9c('0x4c')](function(_0x3d94da){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d94da);throw _0x3d94da;});}return _0x990934;});}})[_0x3c9c('0x27')](respondWithResult(_0x1b6f0a,0xc9))[_0x3c9c('0x4c')](handleError(_0x1b6f0a,null));};exports[_0x3c9c('0x26')]=function(_0x94bc44,_0x4342a9){if(_0x94bc44[_0x3c9c('0x60')]['id']){delete _0x94bc44[_0x3c9c('0x60')]['id'];}return db[_0x3c9c('0x49')][_0x3c9c('0x30')]({'where':{'id':_0x94bc44['params']['id']}})['then'](handleEntityNotFound(_0x4342a9,null))[_0x3c9c('0x27')](saveUpdates(_0x94bc44['body'],null))['then'](respondWithResult(_0x4342a9,null))['catch'](handleError(_0x4342a9,null));};exports[_0x3c9c('0x28')]=function(_0x1159c0,_0x5c4237){return db['VoiceQueue'][_0x3c9c('0x30')]({'where':{'id':_0x1159c0['params']['id']}})[_0x3c9c('0x27')](handleEntityNotFound(_0x5c4237,null))['then'](removeEntity(_0x5c4237,null))[_0x3c9c('0x4c')](handleError(_0x5c4237,null));};exports[_0x3c9c('0x62')]=function(_0x2cbb5f,_0x587598,_0x4c0093){var _0x27c3f9={'raw':![],'where':{}};var _0x5ca292={};var _0x1d2c9d={'count':0x0,'rows':[]};return db[_0x3c9c('0x49')][_0x3c9c('0x63')]({'where':{'id':_0x2cbb5f[_0x3c9c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x587598,null))[_0x3c9c('0x27')](function(_0xbeaf58){if(_0xbeaf58){_0x5ca292['model']=_[_0x3c9c('0x4f')](db[_0x3c9c('0x64')]['rawAttributes']);_0x5ca292[_0x3c9c('0x3a')]=_[_0x3c9c('0x4f')](_0x2cbb5f['query']);_0x5ca292[_0x3c9c('0x3b')]=_[_0x3c9c('0x3d')](_0x5ca292[_0x3c9c('0x3f')],_0x5ca292['query']);_0x27c3f9['attributes']=_[_0x3c9c('0x3d')](_0x5ca292[_0x3c9c('0x3f')],qs['fields'](_0x2cbb5f[_0x3c9c('0x3a')][_0x3c9c('0x3e')]));_0x27c3f9[_0x3c9c('0x3c')]=_0x27c3f9['attributes'][_0x3c9c('0x50')]?_0x27c3f9[_0x3c9c('0x3c')]:_0x5ca292['model'];if(!_0x2cbb5f[_0x3c9c('0x3a')][_0x3c9c('0x40')](_0x3c9c('0x41'))){_0x27c3f9[_0x3c9c('0x1f')]=qs[_0x3c9c('0x1f')](_0x2cbb5f[_0x3c9c('0x3a')][_0x3c9c('0x1f')]);_0x27c3f9[_0x3c9c('0x1d')]=qs[_0x3c9c('0x1d')](_0x2cbb5f[_0x3c9c('0x3a')]['offset']);}_0x27c3f9[_0x3c9c('0x42')]=qs[_0x3c9c('0x43')](_0x2cbb5f['query'][_0x3c9c('0x43')]);_0x27c3f9[_0x3c9c('0x44')]=qs['filters'](_[_0x3c9c('0x45')](_0x2cbb5f[_0x3c9c('0x3a')],_0x5ca292[_0x3c9c('0x3b')]));_0x27c3f9[_0x3c9c('0x44')][_0x3c9c('0x65')]=_0xbeaf58['id'];if(_0x2cbb5f['query'][_0x3c9c('0x2b')]){_0x27c3f9[_0x3c9c('0x44')]=_[_0x3c9c('0x47')](_0x27c3f9[_0x3c9c('0x44')],{'$or':_[_0x3c9c('0x2d')](_0x27c3f9[_0x3c9c('0x3c')],function(_0x3ef3d1){var _0x2de80a={};_0x2de80a[_0x3ef3d1]={'$like':'%'+_0x2cbb5f[_0x3c9c('0x3a')][_0x3c9c('0x2b')]+'%'};return _0x2de80a;})});}_0x27c3f9=_[_0x3c9c('0x47')]({},_0x27c3f9,_0x2cbb5f[_0x3c9c('0x48')]);return db[_0x3c9c('0x64')]['count']({'where':_0x27c3f9[_0x3c9c('0x44')]})[_0x3c9c('0x27')](function(_0x508903){_0x1d2c9d[_0x3c9c('0x20')]=_0x508903;if(_0x2cbb5f[_0x3c9c('0x3a')][_0x3c9c('0x51')]){_0x27c3f9['include']=[{'all':!![]}];}return db[_0x3c9c('0x64')][_0x3c9c('0x4a')](_0x27c3f9);})[_0x3c9c('0x27')](function(_0x285ebc){_0x1d2c9d[_0x3c9c('0x4b')]=_0x285ebc;return _0x1d2c9d;});}})[_0x3c9c('0x27')](respondWithFilteredResult(_0x587598,_0x27c3f9))['catch'](handleError(_0x587598,null));};exports[_0x3c9c('0x66')]=function(_0x4ca0b7,_0x2265e8,_0x48a57f){var _0x4950c3={'raw':!![],'where':{}};var _0x263270={};var _0x5391a7={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3c9c('0x63')]({'where':{'id':_0x4ca0b7[_0x3c9c('0x4e')]['id']}})[_0x3c9c('0x27')](handleEntityNotFound(_0x2265e8,null))[_0x3c9c('0x27')](function(_0x2f4e79){if(_0x2f4e79){_0x263270[_0x3c9c('0x3f')]=_[_0x3c9c('0x4f')](db[_0x3c9c('0x67')][_0x3c9c('0x38')]);_0x263270[_0x3c9c('0x3a')]=_[_0x3c9c('0x4f')](_0x4ca0b7['query']);_0x263270['filters']=_[_0x3c9c('0x3d')](_0x263270['model'],_0x263270['query']);_0x4950c3[_0x3c9c('0x3c')]=_[_0x3c9c('0x3d')](_0x263270[_0x3c9c('0x3f')],qs[_0x3c9c('0x3e')](_0x4ca0b7[_0x3c9c('0x3a')]['fields']));_0x4950c3[_0x3c9c('0x3c')]=_0x4950c3[_0x3c9c('0x3c')]['length']?_0x4950c3['attributes']:_0x263270[_0x3c9c('0x3f')];if(!_0x4ca0b7['query'][_0x3c9c('0x40')](_0x3c9c('0x41'))){_0x4950c3[_0x3c9c('0x1f')]=qs[_0x3c9c('0x1f')](_0x4ca0b7[_0x3c9c('0x3a')][_0x3c9c('0x1f')]);_0x4950c3[_0x3c9c('0x1d')]=qs[_0x3c9c('0x1d')](_0x4ca0b7[_0x3c9c('0x3a')][_0x3c9c('0x1d')]);}_0x4950c3['order']=qs[_0x3c9c('0x43')](_0x4ca0b7[_0x3c9c('0x3a')][_0x3c9c('0x43')]);_0x4950c3[_0x3c9c('0x44')]=qs['filters'](_[_0x3c9c('0x45')](_0x4ca0b7['query'],_0x263270[_0x3c9c('0x3b')]));_0x4950c3[_0x3c9c('0x44')]['VoiceQueueId']=_0x2f4e79['id'];if(_0x4ca0b7[_0x3c9c('0x3a')]['filter']){_0x4950c3['where']=_[_0x3c9c('0x47')](_0x4950c3[_0x3c9c('0x44')],{'$or':_[_0x3c9c('0x2d')](_0x4950c3[_0x3c9c('0x3c')],function(_0x17e5ce){var _0x5c96ad={};_0x5c96ad[_0x17e5ce]={'$like':'%'+_0x4ca0b7[_0x3c9c('0x3a')]['filter']+'%'};return _0x5c96ad;})});}_0x4950c3=_[_0x3c9c('0x47')]({},_0x4950c3,_0x4ca0b7['options']);return db[_0x3c9c('0x67')][_0x3c9c('0x20')]({'where':_0x4950c3[_0x3c9c('0x44')]})[_0x3c9c('0x27')](function(_0x126e3d){_0x5391a7[_0x3c9c('0x20')]=_0x126e3d;if(_0x4ca0b7[_0x3c9c('0x3a')][_0x3c9c('0x51')]){_0x4950c3['include']=[{'all':!![]}];}return db[_0x3c9c('0x67')][_0x3c9c('0x4a')](_0x4950c3);})[_0x3c9c('0x27')](function(_0x5614df){_0x5391a7[_0x3c9c('0x4b')]=_0x5614df;return _0x5391a7;});}})[_0x3c9c('0x27')](respondWithFilteredResult(_0x2265e8,_0x4950c3))[_0x3c9c('0x4c')](handleError(_0x2265e8,null));};exports[_0x3c9c('0x68')]=function(_0x107f4f,_0xdfe4f7,_0x58e1e8){var _0x10b6b9={'raw':!![],'where':{}};var _0x2ba1f1={};var _0x2e158c={'count':0x0,'rows':[]};return db[_0x3c9c('0x49')]['findOne']({'where':{'id':_0x107f4f[_0x3c9c('0x4e')]['id']}})[_0x3c9c('0x27')](handleEntityNotFound(_0xdfe4f7,null))[_0x3c9c('0x27')](function(_0x517fa2){if(_0x517fa2){_0x2ba1f1['model']=_[_0x3c9c('0x4f')](db[_0x3c9c('0x69')][_0x3c9c('0x38')]);_0x2ba1f1[_0x3c9c('0x3a')]=_[_0x3c9c('0x4f')](_0x107f4f[_0x3c9c('0x3a')]);_0x2ba1f1[_0x3c9c('0x3b')]=_[_0x3c9c('0x3d')](_0x2ba1f1[_0x3c9c('0x3f')],_0x2ba1f1[_0x3c9c('0x3a')]);_0x10b6b9[_0x3c9c('0x3c')]=_[_0x3c9c('0x3d')](_0x2ba1f1['model'],qs['fields'](_0x107f4f[_0x3c9c('0x3a')][_0x3c9c('0x3e')]));_0x10b6b9[_0x3c9c('0x3c')]=_0x10b6b9[_0x3c9c('0x3c')][_0x3c9c('0x50')]?_0x10b6b9[_0x3c9c('0x3c')]:_0x2ba1f1[_0x3c9c('0x3f')];if(!_0x107f4f['query']['hasOwnProperty'](_0x3c9c('0x41'))){_0x10b6b9['limit']=qs[_0x3c9c('0x1f')](_0x107f4f[_0x3c9c('0x3a')][_0x3c9c('0x1f')]);_0x10b6b9[_0x3c9c('0x1d')]=qs['offset'](_0x107f4f[_0x3c9c('0x3a')][_0x3c9c('0x1d')]);}_0x10b6b9[_0x3c9c('0x42')]=qs[_0x3c9c('0x43')](_0x107f4f[_0x3c9c('0x3a')][_0x3c9c('0x43')]);_0x10b6b9['where']=qs['filters'](_[_0x3c9c('0x45')](_0x107f4f[_0x3c9c('0x3a')],_0x2ba1f1[_0x3c9c('0x3b')]));_0x10b6b9[_0x3c9c('0x44')][_0x3c9c('0x65')]=_0x517fa2['id'];if(_0x107f4f[_0x3c9c('0x3a')]['filter']){_0x10b6b9[_0x3c9c('0x44')]=_[_0x3c9c('0x47')](_0x10b6b9[_0x3c9c('0x44')],{'$or':_[_0x3c9c('0x2d')](_0x10b6b9['attributes'],function(_0x73dcda){var _0x5460ca={};_0x5460ca[_0x73dcda]={'$like':'%'+_0x107f4f['query'][_0x3c9c('0x2b')]+'%'};return _0x5460ca;})});}_0x10b6b9=_['merge']({},_0x10b6b9,_0x107f4f[_0x3c9c('0x48')]);return db[_0x3c9c('0x69')]['count']({'where':_0x10b6b9[_0x3c9c('0x44')]})[_0x3c9c('0x27')](function(_0x189663){_0x2e158c[_0x3c9c('0x20')]=_0x189663;if(_0x107f4f[_0x3c9c('0x3a')]['includeAll']){_0x10b6b9['include']=[{'all':!![]}];}return db[_0x3c9c('0x69')][_0x3c9c('0x4a')](_0x10b6b9);})[_0x3c9c('0x27')](function(_0xf86c09){_0x2e158c[_0x3c9c('0x4b')]=_0xf86c09;return _0x2e158c;});}})[_0x3c9c('0x27')](respondWithFilteredResult(_0xdfe4f7,_0x10b6b9))[_0x3c9c('0x4c')](handleError(_0xdfe4f7,null));};exports[_0x3c9c('0x6a')]=function(_0x12f53,_0x1352fa,_0x441c95){var _0x258dd7={'raw':!![],'where':{}};var _0x4b6a24={};var _0x2e9535={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3c9c('0x63')]({'where':{'id':_0x12f53['params']['id']}})[_0x3c9c('0x27')](handleEntityNotFound(_0x1352fa,null))[_0x3c9c('0x27')](function(_0x2c5246){if(_0x2c5246){_0x4b6a24[_0x3c9c('0x3f')]=_[_0x3c9c('0x4f')](db[_0x3c9c('0x6b')]['rawAttributes']);_0x4b6a24[_0x3c9c('0x3a')]=_['keys'](_0x12f53[_0x3c9c('0x3a')]);_0x4b6a24['filters']=_[_0x3c9c('0x3d')](_0x4b6a24[_0x3c9c('0x3f')],_0x4b6a24[_0x3c9c('0x3a')]);_0x258dd7['attributes']=_['intersection'](_0x4b6a24['model'],qs[_0x3c9c('0x3e')](_0x12f53['query']['fields']));_0x258dd7['attributes']=_0x258dd7[_0x3c9c('0x3c')]['length']?_0x258dd7['attributes']:_0x4b6a24['model'];if(!_0x12f53[_0x3c9c('0x3a')]['hasOwnProperty'](_0x3c9c('0x41'))){_0x258dd7[_0x3c9c('0x1f')]=qs[_0x3c9c('0x1f')](_0x12f53['query'][_0x3c9c('0x1f')]);_0x258dd7['offset']=qs[_0x3c9c('0x1d')](_0x12f53[_0x3c9c('0x3a')]['offset']);}_0x258dd7[_0x3c9c('0x42')]=qs[_0x3c9c('0x43')](_0x12f53['query'][_0x3c9c('0x43')]);_0x258dd7[_0x3c9c('0x44')]=qs[_0x3c9c('0x3b')](_[_0x3c9c('0x45')](_0x12f53[_0x3c9c('0x3a')],_0x4b6a24[_0x3c9c('0x3b')]));_0x258dd7[_0x3c9c('0x44')][_0x3c9c('0x65')]=_0x2c5246['id'];if(_0x12f53[_0x3c9c('0x3a')]['filter']){_0x258dd7[_0x3c9c('0x44')]=_[_0x3c9c('0x47')](_0x258dd7[_0x3c9c('0x44')],{'$or':_[_0x3c9c('0x2d')](_0x258dd7[_0x3c9c('0x3c')],function(_0x5559d7){var _0x5973d9={};_0x5973d9[_0x5559d7]={'$like':'%'+_0x12f53[_0x3c9c('0x3a')][_0x3c9c('0x2b')]+'%'};return _0x5973d9;})});}_0x258dd7=_[_0x3c9c('0x47')]({},_0x258dd7,_0x12f53[_0x3c9c('0x48')]);return db[_0x3c9c('0x6b')]['count']({'where':_0x258dd7[_0x3c9c('0x44')]})['then'](function(_0x45811b){_0x2e9535['count']=_0x45811b;if(_0x12f53[_0x3c9c('0x3a')]['includeAll']){_0x258dd7['include']=[{'all':!![]}];}return db[_0x3c9c('0x6b')][_0x3c9c('0x4a')](_0x258dd7);})[_0x3c9c('0x27')](function(_0x50ea44){_0x2e9535[_0x3c9c('0x4b')]=_0x50ea44;return _0x2e9535;});}})[_0x3c9c('0x27')](respondWithFilteredResult(_0x1352fa,_0x258dd7))[_0x3c9c('0x4c')](handleError(_0x1352fa,null));};exports[_0x3c9c('0x6c')]=function(_0x4b9eb2,_0xc6b2cf,_0x5cc313){var _0x42c9f3={};var _0x47ee15={};var _0x50d273;var _0x2aabae;return db['VoiceQueue'][_0x3c9c('0x63')]({'where':{'id':_0x4b9eb2['params']['id']}})['then'](handleEntityNotFound(_0xc6b2cf,null))['then'](function(_0x3e00ce){if(_0x3e00ce){_0x50d273=_0x3e00ce;_0x47ee15[_0x3c9c('0x3f')]=_[_0x3c9c('0x4f')](db[_0x3c9c('0x6d')]['rawAttributes']);_0x47ee15[_0x3c9c('0x3a')]=_[_0x3c9c('0x4f')](_0x4b9eb2['query']);_0x47ee15['filters']=_[_0x3c9c('0x3d')](_0x47ee15['model'],_0x47ee15[_0x3c9c('0x3a')]);_0x42c9f3[_0x3c9c('0x3c')]=_['intersection'](_0x47ee15[_0x3c9c('0x3f')],qs[_0x3c9c('0x3e')](_0x4b9eb2[_0x3c9c('0x3a')]['fields']));_0x42c9f3['attributes']=_0x42c9f3[_0x3c9c('0x3c')][_0x3c9c('0x50')]?_0x42c9f3['attributes']:_0x47ee15[_0x3c9c('0x3f')];_0x42c9f3['order']=qs['sort'](_0x4b9eb2[_0x3c9c('0x3a')][_0x3c9c('0x43')]);_0x42c9f3['where']=qs['filters'](_[_0x3c9c('0x45')](_0x4b9eb2[_0x3c9c('0x3a')],_0x47ee15[_0x3c9c('0x3b')]));if(_0x4b9eb2[_0x3c9c('0x3a')][_0x3c9c('0x2b')]){_0x42c9f3[_0x3c9c('0x44')]=_[_0x3c9c('0x47')](_0x42c9f3[_0x3c9c('0x44')],{'$or':_[_0x3c9c('0x2d')](_0x42c9f3['attributes'],function(_0x46602e){var _0x1b3d08={};_0x1b3d08[_0x46602e]={'$like':'%'+_0x4b9eb2[_0x3c9c('0x3a')][_0x3c9c('0x2b')]+'%'};return _0x1b3d08;})});}_0x42c9f3=_[_0x3c9c('0x47')]({},_0x42c9f3,_0x4b9eb2['options']);return _0x50d273[_0x3c9c('0x6c')](_0x42c9f3);}})[_0x3c9c('0x27')](function(_0x1498f2){if(_0x1498f2){_0x2aabae=_0x1498f2[_0x3c9c('0x50')];if(!_0x4b9eb2['query']['hasOwnProperty'](_0x3c9c('0x41'))){_0x42c9f3[_0x3c9c('0x1f')]=qs['limit'](_0x4b9eb2[_0x3c9c('0x3a')][_0x3c9c('0x1f')]);_0x42c9f3[_0x3c9c('0x1d')]=qs[_0x3c9c('0x1d')](_0x4b9eb2[_0x3c9c('0x3a')][_0x3c9c('0x1d')]);}return _0x50d273[_0x3c9c('0x6c')](_0x42c9f3);}})[_0x3c9c('0x27')](function(_0x3c98b5){if(_0x3c98b5){return _0x3c98b5?{'count':_0x2aabae,'rows':_0x3c98b5}:null;}})[_0x3c9c('0x27')](respondWithResult(_0xc6b2cf,null))[_0x3c9c('0x4c')](handleError(_0xc6b2cf,null));};exports['addTeams']=function(_0x5abab5,_0x140449,_0x2ab056){var _0x56eb48=_0x5abab5[_0x3c9c('0x60')][_0x3c9c('0x6e')];var _0x31c02b=_['map'](_0x56eb48,'id');return db['Team'][_0x3c9c('0x4a')]({'where':{'id':_0x31c02b},'attributes':['id'],'include':[{'model':db[_0x3c9c('0x6f')],'as':_0x3c9c('0x70'),'attributes':['id',_0x3c9c('0x35'),_0x3c9c('0x71'),_0x3c9c('0x72'),_0x3c9c('0x73')],'raw':!![]}]})['then'](function(_0x5f21c1){if(_0x5f21c1){var _0x32b5b2=_[_0x3c9c('0x74')](_0x5f21c1,function(_0x29a73d){var _0x8bfdea=_0x29a73d['get']({'plain':!![]});_0x8bfdea['Agents'][_0x3c9c('0x75')](function(_0x5c7233){_0x5c7233[_0x3c9c('0x76')]=_[_0x3c9c('0x30')](_0x56eb48,{'id':_0x8bfdea['id']})[_0x3c9c('0x76')];});return _0x8bfdea[_0x3c9c('0x70')];});return db[_0x3c9c('0x49')][_0x3c9c('0x30')]({'where':{'id':_0x5abab5[_0x3c9c('0x4e')]['id']}})[_0x3c9c('0x27')](function(_0x575a0e){return db[_0x3c9c('0x77')]['transaction'](function(_0x19484b){return _0x575a0e[_0x3c9c('0x78')](_0x31c02b,{'transaction':_0x19484b})[_0x3c9c('0x27')](function(){return BPromise['each'](_0x56eb48,function(_0x328a43){return db[_0x3c9c('0x79')][_0x3c9c('0x7a')]({'TeamId':_0x328a43['id'],'VoiceQueueId':_0x5abab5[_0x3c9c('0x4e')]['id'],'penalty':_0x328a43[_0x3c9c('0x76')]},{'transaction':_0x19484b});});})['then'](function(){return BPromise['each'](_0x32b5b2,function(_0xc5ed4){return db[_0x3c9c('0x7b')]['findOrCreate']({'where':{'UserId':_0xc5ed4['id'],'VoiceQueueId':_0x5abab5[_0x3c9c('0x4e')]['id']},'defaults':{'penalty':_0xc5ed4[_0x3c9c('0x76')]},'transaction':_0x19484b});});})[_0x3c9c('0x27')](function(){return BPromise[_0x3c9c('0x7c')](_['filter'](_0x32b5b2,{'online':!![]}),function(_0x52c484){return db[_0x3c9c('0x7d')]['upsert']({'membername':_0x52c484[_0x3c9c('0x35')],'UserId':_0x52c484['id'],'queue_name':_0x575a0e[_0x3c9c('0x35')],'VoiceQueueId':_0x575a0e['id'],'interface':_[_0x3c9c('0x7e')](_0x52c484[_0x3c9c('0x73')])?util[_0x3c9c('0x7f')](_0x3c9c('0x80'),_0x52c484[_0x3c9c('0x35')]):_0x52c484[_0x3c9c('0x73')],'paused':_0x52c484[_0x3c9c('0x72')]||![],'penalty':_0x52c484[_0x3c9c('0x76')]},{'transaction':_0x19484b});});})[_0x3c9c('0x27')](function(){_0x32b5b2['forEach'](function(_0x1efa7f){socket[_0x3c9c('0x81')](_0x3c9c('0x82'),{'UserId':_0x1efa7f['id'],'VoiceQueueId':_0x575a0e['id']});});});});});}})['then'](respondWithStatusCode(_0x140449,null))[_0x3c9c('0x4c')](handleError(_0x140449,null));};exports[_0x3c9c('0x83')]=function(_0x172dd9,_0x104299,_0x5341fe){return db[_0x3c9c('0x6d')][_0x3c9c('0x4a')]({'where':{'id':_0x172dd9[_0x3c9c('0x3a')][_0x3c9c('0x84')]},'attributes':['id'],'include':[{'model':db[_0x3c9c('0x6f')],'as':_0x3c9c('0x70'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x104299,null))[_0x3c9c('0x27')](function(_0x2471ce){var _0x25e1e7=_['map'](_0x2471ce,'id');var _0x4a1d36=[];var _0x52086d=[];var _0x7d182c=squel[_0x3c9c('0x85')]();_0x7d182c[_0x3c9c('0x86')](_0x3c9c('0x87'))[_0x3c9c('0x88')](_0x3c9c('0x89'),'tq')['join'](_0x3c9c('0x8a'),'ut',_0x3c9c('0x8b'))['where'](_0x3c9c('0x8c'),_0x172dd9[_0x3c9c('0x4e')]['id']);for(var _0x592f68=0x0;_0x592f68<_0x2471ce[_0x3c9c('0x50')];_0x592f68+=0x1){let _0x2e1c83=_0x2471ce[_0x592f68];for(var _0x2cbcd7=0x0;_0x2cbcd7<_0x2e1c83[_0x3c9c('0x70')][_0x3c9c('0x50')];_0x2cbcd7+=0x1){let _0x23c89e=_0x2e1c83[_0x3c9c('0x70')][_0x2cbcd7];var _0x17be35=_0x7d182c[_0x3c9c('0x5d')]();_0x17be35[_0x3c9c('0x44')](_0x3c9c('0x8d'),_0x23c89e['id']);_0x52086d[_0x3c9c('0x8e')](db[_0x3c9c('0x77')][_0x3c9c('0x3a')](_0x17be35[_0x3c9c('0x8f')](),{'type':db[_0x3c9c('0x77')]['QueryTypes']['SELECT']})[_0x3c9c('0x27')](function(_0x1f8f97){if(_0x1f8f97[_0x3c9c('0x50')]===0x1){return _0x23c89e['id'];}else{var _0x3ccfcf=_[_0x3c9c('0x90')](_[_0x3c9c('0x2d')](_0x1f8f97,_0x3c9c('0x91')),function(_0x161f4e){return _[_0x3c9c('0x2f')](_0x25e1e7,_0x161f4e);});if(_0x3ccfcf){return _0x23c89e['id'];}}}));}}return BPromise[_0x3c9c('0x92')](_0x52086d)[_0x3c9c('0x27')](function(_0x288c1c){_0x4a1d36=_(_0x4a1d36)['union'](_0x288c1c)['compact']()['value']();return db[_0x3c9c('0x49')][_0x3c9c('0x30')]({'where':{'id':_0x172dd9[_0x3c9c('0x4e')]['id']}})[_0x3c9c('0x27')](function(_0x5e5d3e){return db[_0x3c9c('0x77')][_0x3c9c('0x93')](function(_0x569d4a){return _0x5e5d3e['removeTeams'](_0x172dd9['query'][_0x3c9c('0x84')],{'transaction':_0x569d4a})[_0x3c9c('0x27')](function(){if(!_['isEmpty'](_0x4a1d36)){return _0x5e5d3e[_0x3c9c('0x94')](_0x4a1d36,{'transaction':_0x569d4a})[_0x3c9c('0x27')](function(){return db[_0x3c9c('0x7d')][_0x3c9c('0x28')]({'where':{'VoiceQueueId':_0x172dd9[_0x3c9c('0x4e')]['id'],'UserId':_0x4a1d36},'transaction':_0x569d4a});});}})[_0x3c9c('0x27')](function(){_0x4a1d36[_0x3c9c('0x75')](function(_0x1b4a1a){socket['emit'](_0x3c9c('0x95'),{'UserId':_0x1b4a1a,'VoiceQueueId':_0x5e5d3e['id']});});});});});});})[_0x3c9c('0x27')](respondWithStatusCode(_0x104299,null))['catch'](handleError(_0x104299,null));};exports[_0x3c9c('0x96')]=function(_0x2a5517,_0x3573d5,_0x5d5578){var _0x17d65a,_0x1cf94d;return db['VoiceQueue']['find']({'where':{'id':_0x2a5517[_0x3c9c('0x4e')]['id']}})[_0x3c9c('0x27')](handleEntityNotFound(_0x3573d5,null))[_0x3c9c('0x27')](function(_0x294f08){if(_0x294f08){_0x1cf94d=_0x294f08;return _0x294f08[_0x3c9c('0x96')](_0x2a5517[_0x3c9c('0x60')][_0x3c9c('0x84')],_['omit'](_0x2a5517[_0x3c9c('0x60')],[_0x3c9c('0x84'),'id'])||{})[_0x3c9c('0x97')](function(_0x184d45){for(var _0x36c8bb=0x0;_0x36c8bb<_0x2a5517[_0x3c9c('0x60')][_0x3c9c('0x84')][_0x3c9c('0x50')];_0x36c8bb+=0x1){socket[_0x3c9c('0x81')](_0x3c9c('0x82'),{'UserId':Number(_0x2a5517[_0x3c9c('0x60')][_0x3c9c('0x84')][_0x36c8bb]),'VoiceQueueId':Number(_0x2a5517[_0x3c9c('0x4e')]['id'])});}return _0x184d45;});}})[_0x3c9c('0x27')](function(_0x4e1681){_0x17d65a=_0x4e1681||[];if(_0x1cf94d){return db['User']['findAll']({'where':{'id':_0x2a5517[_0x3c9c('0x60')][_0x3c9c('0x84')]},'attributes':['id',_0x3c9c('0x35'),_0x3c9c('0x71'),'voicePause',_0x3c9c('0x73')],'raw':!![]});}})[_0x3c9c('0x27')](function(_0x67c740){if(!_['isEmpty'](_0x67c740)){var _0x3a3397=[];for(var _0x5ab1ed=0x0;_0x5ab1ed<_0x67c740['length'];_0x5ab1ed++){if(_0x67c740[_0x5ab1ed]['online']){_0x3a3397[_0x3c9c('0x8e')](db[_0x3c9c('0x7d')][_0x3c9c('0x7a')]({'membername':_0x67c740[_0x5ab1ed]['name'],'UserId':_0x67c740[_0x5ab1ed]['id'],'queue_name':_0x1cf94d[_0x3c9c('0x35')],'VoiceQueueId':_0x1cf94d['id'],'interface':_['isNil'](_0x67c740[_0x5ab1ed][_0x3c9c('0x73')])?util[_0x3c9c('0x7f')](_0x3c9c('0x80'),_0x67c740[_0x5ab1ed]['name']):_0x67c740[_0x5ab1ed][_0x3c9c('0x73')],'paused':_0x67c740[_0x5ab1ed]['voicePause']||![],'penalty':_0x2a5517['body']['penalty']||0x0}));}}return BPromise[_0x3c9c('0x92')](_0x3a3397);}})[_0x3c9c('0x27')](function(){return _0x17d65a;})['then'](respondWithResult(_0x3573d5,null))['catch'](handleError(_0x3573d5,null));};exports['removeAgents']=function(_0x24ab12,_0x56acd6,_0x1240f2){return db[_0x3c9c('0x49')][_0x3c9c('0x30')]({'where':{'id':_0x24ab12[_0x3c9c('0x4e')]['id']}})[_0x3c9c('0x27')](handleEntityNotFound(_0x56acd6,null))[_0x3c9c('0x27')](function(_0x5ed78a){if(_0x5ed78a){return _0x5ed78a['removeAgents'](_0x24ab12['query']['ids'])['then'](function(){if(_[_0x3c9c('0x98')](_0x24ab12[_0x3c9c('0x3a')]['ids'])){for(var _0x42838a=0x0;_0x42838a<_0x24ab12[_0x3c9c('0x3a')][_0x3c9c('0x84')][_0x3c9c('0x50')];_0x42838a+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x24ab12['query'][_0x3c9c('0x84')][_0x42838a]),'VoiceQueueId':Number(_0x24ab12[_0x3c9c('0x4e')]['id'])});}}else{socket['emit'](_0x3c9c('0x95'),{'UserId':Number(_0x24ab12['query'][_0x3c9c('0x84')]),'VoiceQueueId':Number(_0x24ab12[_0x3c9c('0x4e')]['id'])});}});}})['then'](function(_0x15239c){return db[_0x3c9c('0x7d')][_0x3c9c('0x28')]({'where':{'VoiceQueueId':_0x24ab12[_0x3c9c('0x4e')]['id'],'UserId':_0x24ab12[_0x3c9c('0x3a')][_0x3c9c('0x84')]}})['then'](function(){return _0x15239c;});})['then'](respondWithStatusCode(_0x56acd6,null))['catch'](handleError(_0x56acd6,null));};exports[_0x3c9c('0x99')]=function(_0xcdc42b,_0x3b6090,_0x5d852a){var _0x6bf4c6={};var _0x59c6c8={};var _0x28f510;var _0x33b65c;return db[_0x3c9c('0x49')][_0x3c9c('0x63')]({'where':{'id':_0xcdc42b[_0x3c9c('0x4e')]['id']}})[_0x3c9c('0x27')](handleEntityNotFound(_0x3b6090,null))[_0x3c9c('0x27')](function(_0x58b3c8){if(_0x58b3c8){_0x28f510=_0x58b3c8;_0x59c6c8[_0x3c9c('0x3f')]=_[_0x3c9c('0x4f')](db[_0x3c9c('0x6f')][_0x3c9c('0x38')]);_0x59c6c8[_0x3c9c('0x3a')]=_['keys'](_0xcdc42b[_0x3c9c('0x3a')]);_0x59c6c8['filters']=_[_0x3c9c('0x3d')](_0x59c6c8[_0x3c9c('0x3f')],_0x59c6c8['query']);_0x6bf4c6['attributes']=_['intersection'](_0x59c6c8[_0x3c9c('0x3f')],qs[_0x3c9c('0x3e')](_0xcdc42b['query'][_0x3c9c('0x3e')]));_0x6bf4c6[_0x3c9c('0x3c')]=_0x6bf4c6['attributes'][_0x3c9c('0x50')]?_0x6bf4c6[_0x3c9c('0x3c')]:_0x59c6c8[_0x3c9c('0x3f')];_0x6bf4c6[_0x3c9c('0x42')]=qs[_0x3c9c('0x43')](_0xcdc42b[_0x3c9c('0x3a')][_0x3c9c('0x43')]);_0x6bf4c6[_0x3c9c('0x44')]=qs[_0x3c9c('0x3b')](_[_0x3c9c('0x45')](_0xcdc42b[_0x3c9c('0x3a')],_0x59c6c8['filters']));if(_0xcdc42b['query']['filter']){_0x6bf4c6[_0x3c9c('0x44')]=_[_0x3c9c('0x47')](_0x6bf4c6[_0x3c9c('0x44')],{'$or':_[_0x3c9c('0x2d')](_0x6bf4c6[_0x3c9c('0x3c')],function(_0x4f1a9a){var _0x38d941={};_0x38d941[_0x4f1a9a]={'$like':'%'+_0xcdc42b['query'][_0x3c9c('0x2b')]+'%'};return _0x38d941;})});}_0x6bf4c6=_['merge']({},_0x6bf4c6,_0xcdc42b[_0x3c9c('0x48')]);return _0x28f510[_0x3c9c('0x99')](_0x6bf4c6);}})[_0x3c9c('0x27')](function(_0x2adcb2){if(_0x2adcb2){_0x33b65c=_0x2adcb2[_0x3c9c('0x50')];if(!_0xcdc42b[_0x3c9c('0x3a')]['hasOwnProperty'](_0x3c9c('0x41'))){_0x6bf4c6['limit']=qs[_0x3c9c('0x1f')](_0xcdc42b[_0x3c9c('0x3a')]['limit']);_0x6bf4c6[_0x3c9c('0x1d')]=qs[_0x3c9c('0x1d')](_0xcdc42b['query'][_0x3c9c('0x1d')]);}return _0x28f510[_0x3c9c('0x99')](_0x6bf4c6);}})[_0x3c9c('0x27')](function(_0x3b8781){if(_0x3b8781){return _0x3b8781?{'count':_0x33b65c,'rows':_0x3b8781}:null;}})[_0x3c9c('0x27')](respondWithResult(_0x3b6090,null))[_0x3c9c('0x4c')](handleError(_0x3b6090,null));};exports[_0x3c9c('0x9a')]=function(_0x2b6495,_0x21b27b,_0x3fcec9){var _0x13b386={};var _0x13de89={};var _0x52828e;var _0x247a4d;return db[_0x3c9c('0x49')][_0x3c9c('0x63')]({'where':{'id':_0x2b6495['params']['id']}})[_0x3c9c('0x27')](handleEntityNotFound(_0x21b27b,null))[_0x3c9c('0x27')](function(_0x236c5e){if(_0x236c5e){_0x52828e=_0x236c5e;_0x13de89[_0x3c9c('0x3f')]=_[_0x3c9c('0x4f')](db[_0x3c9c('0x7d')][_0x3c9c('0x38')]);_0x13de89[_0x3c9c('0x3a')]=_[_0x3c9c('0x4f')](_0x2b6495[_0x3c9c('0x3a')]);_0x13de89[_0x3c9c('0x3b')]=_[_0x3c9c('0x3d')](_0x13de89['model'],_0x13de89[_0x3c9c('0x3a')]);_0x13b386['attributes']=_['intersection'](_0x13de89['model'],qs['fields'](_0x2b6495[_0x3c9c('0x3a')]['fields']));_0x13b386[_0x3c9c('0x3c')]=_0x13b386[_0x3c9c('0x3c')]['length']?_0x13b386[_0x3c9c('0x3c')]:_0x13de89[_0x3c9c('0x3f')];_0x13b386['order']=qs[_0x3c9c('0x43')](_0x2b6495[_0x3c9c('0x3a')][_0x3c9c('0x43')]);_0x13b386[_0x3c9c('0x44')]=qs[_0x3c9c('0x3b')](_[_0x3c9c('0x45')](_0x2b6495['query'],_0x13de89[_0x3c9c('0x3b')]));if(_0x2b6495[_0x3c9c('0x3a')][_0x3c9c('0x2b')]){_0x13b386['where']=_[_0x3c9c('0x47')](_0x13b386[_0x3c9c('0x44')],{'$or':_[_0x3c9c('0x2d')](_0x13b386[_0x3c9c('0x3c')],function(_0x24a412){var _0x264827={};_0x264827[_0x24a412]={'$like':'%'+_0x2b6495[_0x3c9c('0x3a')][_0x3c9c('0x2b')]+'%'};return _0x264827;})});}_0x13b386=_[_0x3c9c('0x47')]({},_0x13b386,_0x2b6495[_0x3c9c('0x48')]);return _0x52828e['getMembers'](_0x13b386);}})[_0x3c9c('0x27')](function(_0x38d305){if(_0x38d305){_0x247a4d=_0x38d305[_0x3c9c('0x50')];if(!_0x2b6495[_0x3c9c('0x3a')]['hasOwnProperty'](_0x3c9c('0x41'))){_0x13b386['limit']=qs[_0x3c9c('0x1f')](_0x2b6495[_0x3c9c('0x3a')][_0x3c9c('0x1f')]);_0x13b386[_0x3c9c('0x1d')]=qs[_0x3c9c('0x1d')](_0x2b6495[_0x3c9c('0x3a')][_0x3c9c('0x1d')]);}return _0x52828e[_0x3c9c('0x9a')](_0x13b386);}})[_0x3c9c('0x27')](function(_0x4dbb61){return _0x4dbb61?{'count':_0x247a4d,'rows':_0x4dbb61}:null;})[_0x3c9c('0x27')](respondWithResult(_0x21b27b,null))[_0x3c9c('0x4c')](handleError(_0x21b27b,null));};exports[_0x3c9c('0x9b')]=function(_0x45cd5d,_0x52e16d,_0x1c2779){var _0x5670f0={};var _0xbbcc4f={};var _0x4debfb;var _0x32ae5a;return db['VoiceQueue'][_0x3c9c('0x63')]({'where':{'id':_0x45cd5d[_0x3c9c('0x4e')]['id']}})[_0x3c9c('0x27')](handleEntityNotFound(_0x52e16d,null))[_0x3c9c('0x27')](function(_0x38dfab){if(_0x38dfab){_0x4debfb=_0x38dfab;_0xbbcc4f[_0x3c9c('0x3f')]=_['keys'](db[_0x3c9c('0x9c')][_0x3c9c('0x38')]);_0xbbcc4f[_0x3c9c('0x3a')]=_['keys'](_0x45cd5d[_0x3c9c('0x3a')]);_0xbbcc4f[_0x3c9c('0x3b')]=_[_0x3c9c('0x3d')](_0xbbcc4f['model'],_0xbbcc4f[_0x3c9c('0x3a')]);_0x5670f0[_0x3c9c('0x3c')]=_[_0x3c9c('0x3d')](_0xbbcc4f[_0x3c9c('0x3f')],qs[_0x3c9c('0x3e')](_0x45cd5d[_0x3c9c('0x3a')][_0x3c9c('0x3e')]));_0x5670f0['attributes']=_0x5670f0['attributes'][_0x3c9c('0x50')]?_0x5670f0[_0x3c9c('0x3c')]:_0xbbcc4f[_0x3c9c('0x3f')];_0x5670f0[_0x3c9c('0x42')]=qs[_0x3c9c('0x43')](_0x45cd5d[_0x3c9c('0x3a')][_0x3c9c('0x43')]);_0x5670f0['where']=qs[_0x3c9c('0x3b')](_['pick'](_0x45cd5d[_0x3c9c('0x3a')],_0xbbcc4f[_0x3c9c('0x3b')]));if(_0x45cd5d[_0x3c9c('0x3a')][_0x3c9c('0x2b')]){_0x5670f0[_0x3c9c('0x44')]=_[_0x3c9c('0x47')](_0x5670f0['where'],{'$or':_[_0x3c9c('0x2d')](_0x5670f0['attributes'],function(_0x5dfc52){var _0x2d0c01={};_0x2d0c01[_0x5dfc52]={'$like':'%'+_0x45cd5d[_0x3c9c('0x3a')]['filter']+'%'};return _0x2d0c01;})});}_0x5670f0=_[_0x3c9c('0x47')]({},_0x5670f0,_0x45cd5d[_0x3c9c('0x48')]);return _0x4debfb[_0x3c9c('0x9b')](_0x5670f0);}})[_0x3c9c('0x27')](function(_0x4d79b1){if(_0x4d79b1){_0x32ae5a=_0x4d79b1[_0x3c9c('0x50')];if(!_0x45cd5d['query'][_0x3c9c('0x40')](_0x3c9c('0x41'))){_0x5670f0[_0x3c9c('0x1f')]=qs['limit'](_0x45cd5d[_0x3c9c('0x3a')]['limit']);_0x5670f0[_0x3c9c('0x1d')]=qs['offset'](_0x45cd5d[_0x3c9c('0x3a')]['offset']);}return _0x4debfb[_0x3c9c('0x9b')](_0x5670f0);}})[_0x3c9c('0x27')](function(_0xb893de){if(_0xb893de){return _0xb893de?{'count':_0x32ae5a,'rows':_0xb893de}:null;}})[_0x3c9c('0x27')](respondWithResult(_0x52e16d,null))[_0x3c9c('0x4c')](handleError(_0x52e16d,null));};exports[_0x3c9c('0x9d')]=function(_0x1cbf6c,_0x1815dc,_0x110f4c){var _0x2702ac=moment()[_0x3c9c('0x7f')](_0x3c9c('0x9e'));var _0x48b0ea,_0x4d3420;return db[_0x3c9c('0x49')][_0x3c9c('0x30')]({'where':{'id':_0x1cbf6c[_0x3c9c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1815dc,null))[_0x3c9c('0x27')](function(_0x2e02ce){if(_0x2e02ce){_0x4d3420=_0x2e02ce;return _0x2e02ce[_0x3c9c('0x9d')](_0x1cbf6c[_0x3c9c('0x60')][_0x3c9c('0x84')],_['omit'](_0x1cbf6c[_0x3c9c('0x60')],[_0x3c9c('0x84'),'id'])||{});}return null;})['spread'](function(_0x2b152d){var _0x4ab3bb;_0x48b0ea=_0x2b152d||[];var _0x32d1d3=[];if(_0x2b152d){for(var _0x2f5596=0x0;_0x2f5596<_0x2b152d[_0x3c9c('0x50')];_0x2f5596+=0x1){var _0x1af3ad=_0x2b152d[_0x2f5596]['get']({'plain':!![]});_0x4d3420['dialCheckDuplicateType']=_0x1cbf6c['body'][_0x3c9c('0x9f')]?_0x1cbf6c['body']['dialCheckDuplicateType']:_0x4d3420['dialCheckDuplicateType'];switch(_0x4d3420[_0x3c9c('0x9f')]){case _0x3c9c('0xa0'):_0x4ab3bb=squel[_0x3c9c('0xa1')]()[_0x3c9c('0xa2')](_0x3c9c('0xa3'))['fromQuery']([_0x3c9c('0xa4'),_0x3c9c('0xa5'),_0x3c9c('0xa6'),_0x3c9c('0xa7'),_0x3c9c('0x65'),'createdAt',_0x3c9c('0x61')],squel[_0x3c9c('0x85')]()[_0x3c9c('0x86')](_0x3c9c('0xa4'),_0x3c9c('0xa4'))[_0x3c9c('0x86')]('\x27'+_0x2702ac+'\x27',_0x3c9c('0xa5'))[_0x3c9c('0x86')]('id',_0x3c9c('0xa6'))[_0x3c9c('0x86')](_0x1af3ad[_0x3c9c('0xa8')][_0x3c9c('0x8f')](),_0x3c9c('0xa7'))[_0x3c9c('0x86')](_0x1cbf6c['params']['id'][_0x3c9c('0x8f')](),_0x3c9c('0x65'))['field']('\x27'+_0x2702ac+'\x27',_0x3c9c('0x5f'))[_0x3c9c('0x86')]('\x27'+_0x2702ac+'\x27',_0x3c9c('0x61'))[_0x3c9c('0x88')](_0x3c9c('0xa9'))[_0x3c9c('0x44')]('deletedAt\x20IS\x20NULL')[_0x3c9c('0x44')]('ListId\x20=\x20?',_0x1af3ad[_0x3c9c('0xa8')][_0x3c9c('0x8f')]())[_0x3c9c('0x44')](_0x3c9c('0xaa'))['where'](_0x3c9c('0xab'),squel['select']()[_0x3c9c('0x86')](_0x3c9c('0xac'))[_0x3c9c('0x88')](_0x3c9c('0xad'))[_0x3c9c('0x44')](_0x3c9c('0x8c'),_0x1cbf6c[_0x3c9c('0x4e')]['id']['toString']()))[_0x3c9c('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3c9c('0x85')]()[_0x3c9c('0x86')](_0x3c9c('0xae'))[_0x3c9c('0x88')]('cm_hopper')[_0x3c9c('0x44')](_0x3c9c('0x8c'),_0x1cbf6c[_0x3c9c('0x4e')]['id']['toString']())))[_0x3c9c('0x8f')]();break;case'onlyIfOpen':_0x4ab3bb=squel[_0x3c9c('0xa1')]()[_0x3c9c('0xa2')](_0x3c9c('0xa3'))[_0x3c9c('0xaf')]([_0x3c9c('0xa4'),_0x3c9c('0xa5'),'ContactId',_0x3c9c('0xa7'),'VoiceQueueId',_0x3c9c('0x5f'),_0x3c9c('0x61')],squel[_0x3c9c('0x85')]()[_0x3c9c('0x86')]('phone',_0x3c9c('0xa4'))[_0x3c9c('0x86')]('\x27'+_0x2702ac+'\x27',_0x3c9c('0xa5'))[_0x3c9c('0x86')]('id',_0x3c9c('0xa6'))['field'](_0x1af3ad[_0x3c9c('0xa8')]['toString'](),_0x3c9c('0xa7'))[_0x3c9c('0x86')](_0x1cbf6c[_0x3c9c('0x4e')]['id']['toString'](),_0x3c9c('0x65'))[_0x3c9c('0x86')]('\x27'+_0x2702ac+'\x27',_0x3c9c('0x5f'))[_0x3c9c('0x86')]('\x27'+_0x2702ac+'\x27',_0x3c9c('0x61'))[_0x3c9c('0x88')](_0x3c9c('0xa9'))[_0x3c9c('0x44')](_0x3c9c('0xb0'))[_0x3c9c('0x44')](_0x3c9c('0xb1'),_0x1af3ad['CmListId'][_0x3c9c('0x8f')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x3c9c('0x44')](_0x3c9c('0xab'),squel[_0x3c9c('0x85')]()[_0x3c9c('0x86')](_0x3c9c('0xae'))[_0x3c9c('0x88')](_0x3c9c('0xa3'))[_0x3c9c('0x44')](_0x3c9c('0x8c'),_0x1cbf6c[_0x3c9c('0x4e')]['id'][_0x3c9c('0x8f')]())))[_0x3c9c('0x8f')]();break;default:_0x4ab3bb=squel[_0x3c9c('0xa1')]()[_0x3c9c('0xa2')](_0x3c9c('0xa3'))[_0x3c9c('0xaf')]([_0x3c9c('0xa4'),_0x3c9c('0xa5'),_0x3c9c('0xa6'),_0x3c9c('0xa7'),_0x3c9c('0x65'),_0x3c9c('0x5f'),_0x3c9c('0x61')],squel[_0x3c9c('0x85')]()[_0x3c9c('0x86')](_0x3c9c('0xa4'),_0x3c9c('0xa4'))['field']('\x27'+_0x2702ac+'\x27','scheduledAt')[_0x3c9c('0x86')]('id','ContactId')['field'](_0x1af3ad[_0x3c9c('0xa8')]['toString'](),'ListId')[_0x3c9c('0x86')](_0x1cbf6c[_0x3c9c('0x4e')]['id'][_0x3c9c('0x8f')](),_0x3c9c('0x65'))[_0x3c9c('0x86')]('\x27'+_0x2702ac+'\x27',_0x3c9c('0x5f'))[_0x3c9c('0x86')]('\x27'+_0x2702ac+'\x27','updatedAt')[_0x3c9c('0x88')](_0x3c9c('0xa9'))[_0x3c9c('0x44')](_0x3c9c('0xb0'))[_0x3c9c('0x44')](_0x3c9c('0xb1'),_0x1af3ad[_0x3c9c('0xa8')][_0x3c9c('0x8f')]())['where'](_0x3c9c('0xaa')))[_0x3c9c('0x8f')]();}_0x32d1d3['push'](db[_0x3c9c('0x77')][_0x3c9c('0x3a')](_0x4ab3bb));}return BPromise[_0x3c9c('0x92')](_0x32d1d3);}})[_0x3c9c('0x27')](function(){var _0x9a85c0=[];var _0x10ff69=squel[_0x3c9c('0xa1')]()[_0x3c9c('0xa2')](_0x3c9c('0xb2'))[_0x3c9c('0xaf')]([_0x3c9c('0xb3'),_0x3c9c('0xa4'),_0x3c9c('0xb4'),_0x3c9c('0x5f'),_0x3c9c('0x61')],squel[_0x3c9c('0x85')]()['field'](_0x3c9c('0xb5'))[_0x3c9c('0x86')](_0x3c9c('0xb6'))['field'](_0x3c9c('0xb7'))['field']('\x27'+_0x2702ac+'\x27',_0x3c9c('0x5f'))[_0x3c9c('0x86')]('\x27'+_0x2702ac+'\x27','updatedAt')['from'](_0x3c9c('0xb8'),'ci')[_0x3c9c('0xb9')](_0x3c9c('0xa3'),'h',_0x3c9c('0xba'))[_0x3c9c('0x44')](_0x3c9c('0xbb'),_0x2702ac)[_0x3c9c('0x44')]('ci.ItemClass=?',_0x3c9c('0xbc')))[_0x3c9c('0x8f')]();_0x9a85c0['push'](db[_0x3c9c('0x77')][_0x3c9c('0x3a')](_0x10ff69));return BPromise['all'](_0x9a85c0);})['then'](function(){return _0x48b0ea;})['then'](respondWithResult(_0x1815dc,null))[_0x3c9c('0x4c')](handleError(_0x1815dc,null));};exports[_0x3c9c('0xbd')]=function(_0x25b8e1,_0x1bfe77,_0x48183e){return db['VoiceQueue'][_0x3c9c('0x30')]({'where':{'id':_0x25b8e1[_0x3c9c('0x4e')]['id']}})[_0x3c9c('0x27')](handleEntityNotFound(_0x1bfe77,null))['then'](function(_0x1dc4bd){if(_0x1dc4bd){return _0x1dc4bd['removeLists'](_0x25b8e1['query'][_0x3c9c('0x84')]);}})[_0x3c9c('0x27')](function(_0xecbeb4){if(_0xecbeb4){return db[_0x3c9c('0x64')]['destroy']({'where':{'ListId':_0x25b8e1[_0x3c9c('0x3a')][_0x3c9c('0x84')],'VoiceQueueId':_0x25b8e1[_0x3c9c('0x4e')]['id']}})[_0x3c9c('0x27')](function(){return _0xecbeb4;});}})[_0x3c9c('0x27')](respondWithStatusCode(_0x1bfe77,null))[_0x3c9c('0x4c')](handleError(_0x1bfe77,null));};exports[_0x3c9c('0xbe')]=function(_0x218d51,_0x99501f,_0x2b49c0){var _0x2f52a8={};var _0x4ea6b9={};var _0x1fad28;var _0x3175c4;return db[_0x3c9c('0x49')][_0x3c9c('0x63')]({'where':{'id':_0x218d51[_0x3c9c('0x4e')]['id']}})[_0x3c9c('0x27')](handleEntityNotFound(_0x99501f,null))[_0x3c9c('0x27')](function(_0x161d53){if(_0x161d53){_0x1fad28=_0x161d53;_0x4ea6b9[_0x3c9c('0x3f')]=_[_0x3c9c('0x4f')](db[_0x3c9c('0x9c')][_0x3c9c('0x38')]);_0x4ea6b9[_0x3c9c('0x3a')]=_[_0x3c9c('0x4f')](_0x218d51[_0x3c9c('0x3a')]);_0x4ea6b9['filters']=_[_0x3c9c('0x3d')](_0x4ea6b9[_0x3c9c('0x3f')],_0x4ea6b9[_0x3c9c('0x3a')]);_0x2f52a8[_0x3c9c('0x3c')]=_[_0x3c9c('0x3d')](_0x4ea6b9[_0x3c9c('0x3f')],qs[_0x3c9c('0x3e')](_0x218d51[_0x3c9c('0x3a')][_0x3c9c('0x3e')]));_0x2f52a8[_0x3c9c('0x3c')]=_0x2f52a8[_0x3c9c('0x3c')][_0x3c9c('0x50')]?_0x2f52a8[_0x3c9c('0x3c')]:_0x4ea6b9[_0x3c9c('0x3f')];_0x2f52a8[_0x3c9c('0x42')]=qs[_0x3c9c('0x43')](_0x218d51['query'][_0x3c9c('0x43')]);_0x2f52a8[_0x3c9c('0x44')]=qs[_0x3c9c('0x3b')](_[_0x3c9c('0x45')](_0x218d51[_0x3c9c('0x3a')],_0x4ea6b9[_0x3c9c('0x3b')]));if(_0x218d51['query'][_0x3c9c('0x2b')]){_0x2f52a8[_0x3c9c('0x44')]=_[_0x3c9c('0x47')](_0x2f52a8[_0x3c9c('0x44')],{'$or':_['map'](_0x2f52a8[_0x3c9c('0x3c')],function(_0x589a5b){var _0x377010={};_0x377010[_0x589a5b]={'$like':'%'+_0x218d51[_0x3c9c('0x3a')][_0x3c9c('0x2b')]+'%'};return _0x377010;})});}_0x2f52a8=_['merge']({},_0x2f52a8,_0x218d51[_0x3c9c('0x48')]);return _0x1fad28['getBlackLists'](_0x2f52a8);}})['then'](function(_0x4e727d){if(_0x4e727d){_0x3175c4=_0x4e727d[_0x3c9c('0x50')];if(!_0x218d51[_0x3c9c('0x3a')][_0x3c9c('0x40')](_0x3c9c('0x41'))){_0x2f52a8[_0x3c9c('0x1f')]=qs['limit'](_0x218d51[_0x3c9c('0x3a')][_0x3c9c('0x1f')]);_0x2f52a8[_0x3c9c('0x1d')]=qs['offset'](_0x218d51[_0x3c9c('0x3a')]['offset']);}return _0x1fad28[_0x3c9c('0xbe')](_0x2f52a8);}})[_0x3c9c('0x27')](function(_0x585794){if(_0x585794){return _0x585794?{'count':_0x3175c4,'rows':_0x585794}:null;}})[_0x3c9c('0x27')](respondWithResult(_0x99501f,null))[_0x3c9c('0x4c')](handleError(_0x99501f,null));};exports[_0x3c9c('0xbf')]=function(_0x998d43,_0x62e103,_0x2de18b){var _0x10d2c2,_0x4e5c3c;return db[_0x3c9c('0x49')][_0x3c9c('0x30')]({'where':{'id':_0x998d43['params']['id']}})[_0x3c9c('0x27')](handleEntityNotFound(_0x62e103,null))[_0x3c9c('0x27')](function(_0x481933){if(_0x481933){_0x4e5c3c=_0x481933;return _0x481933['addBlackLists'](_0x998d43[_0x3c9c('0x60')][_0x3c9c('0x84')],_[_0x3c9c('0x5e')](_0x998d43[_0x3c9c('0x60')],['ids','id'])||{});}return null;})[_0x3c9c('0x97')](function(_0x1cf0e9){var _0x4da5a9;_0x10d2c2=_0x1cf0e9||[];var _0x52123d=[];if(_0x1cf0e9){for(var _0x295147=0x0;_0x295147<_0x1cf0e9[_0x3c9c('0x50')];_0x295147+=0x1){var _0x6ef991=_0x1cf0e9[_0x295147][_0x3c9c('0x29')]({'plain':!![]});_0x4da5a9=squel[_0x3c9c('0xa1')]()[_0x3c9c('0xa2')](_0x3c9c('0xc0'))[_0x3c9c('0xaf')]([_0x3c9c('0xa4'),'ContactId',_0x3c9c('0xa7'),_0x3c9c('0x65'),_0x3c9c('0x5f'),_0x3c9c('0x61')],squel['select']()['field'](_0x3c9c('0xa4'),_0x3c9c('0xa4'))[_0x3c9c('0x86')]('id',_0x3c9c('0xa6'))[_0x3c9c('0x86')](_0x6ef991[_0x3c9c('0xa8')][_0x3c9c('0x8f')](),_0x3c9c('0xa7'))[_0x3c9c('0x86')](_0x998d43[_0x3c9c('0x4e')]['id']['toString'](),_0x3c9c('0x65'))[_0x3c9c('0x86')](_0x3c9c('0xc1'),'createdAt')[_0x3c9c('0x86')](_0x3c9c('0xc1'),_0x3c9c('0x61'))[_0x3c9c('0x88')]('cm_contacts')[_0x3c9c('0x44')](_0x3c9c('0xb0'))['where'](_0x3c9c('0xb1'),_0x6ef991[_0x3c9c('0xa8')]['toString']())[_0x3c9c('0x44')](_0x3c9c('0xaa')))[_0x3c9c('0x8f')]();_0x52123d['push'](db['sequelize'][_0x3c9c('0x3a')](_0x4da5a9));}return BPromise[_0x3c9c('0x92')](_0x52123d);}})[_0x3c9c('0x27')](function(){return _0x10d2c2;})['then'](respondWithResult(_0x62e103,null))[_0x3c9c('0x4c')](handleError(_0x62e103,null));};exports[_0x3c9c('0xc2')]=function(_0x1fbed7,_0xea27c,_0x16066f){return db[_0x3c9c('0x49')]['find']({'where':{'id':_0x1fbed7[_0x3c9c('0x4e')]['id']}})[_0x3c9c('0x27')](handleEntityNotFound(_0xea27c,null))['then'](function(_0xe84648){if(_0xe84648){return _0xe84648['removeBlackLists'](_0x1fbed7['query'][_0x3c9c('0x84')]);}})[_0x3c9c('0x27')](function(_0xfc7a4c){if(_0xfc7a4c){return db[_0x3c9c('0x6b')][_0x3c9c('0x28')]({'where':{'ListId':_0x1fbed7[_0x3c9c('0x3a')][_0x3c9c('0x84')],'VoiceQueueId':_0x1fbed7[_0x3c9c('0x4e')]['id']}})['then'](function(){return _0xfc7a4c;});}})[_0x3c9c('0x27')](respondWithStatusCode(_0xea27c,null))[_0x3c9c('0x4c')](handleError(_0xea27c,null));};
\ No newline at end of file
index 416338e..acbe751 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x38ae=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x32ec97,_0x30c90a){var _0x1cc51f=function(_0x1c37d1){while(--_0x1c37d1){_0x32ec97['push'](_0x32ec97['shift']());}};_0x1cc51f(++_0x30c90a);}(_0x38ae,0x182));var _0xe38a=function(_0x187f4b,_0x12fd52){_0x187f4b=_0x187f4b-0x0;var _0x132087=_0x38ae[_0x187f4b];return _0x132087;};'use strict';var EventEmitter=require(_0xe38a('0x0'));var VoiceQueue=require(_0xe38a('0x1'))['db'][_0xe38a('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xe38a('0x3')](0x0);var events={'afterCreate':_0xe38a('0x4'),'afterUpdate':_0xe38a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3591e1){return function(_0x55f749,_0x493ee4,_0x2a5e94){VoiceQueueEvents[_0xe38a('0x6')](_0x3591e1+':'+_0x55f749['id'],_0x55f749);VoiceQueueEvents['emit'](_0x3591e1,_0x55f749);_0x2a5e94(null);};}for(var e in events){if(events[_0xe38a('0x7')](e)){var event=events[e];VoiceQueue[_0xe38a('0x8')](e,emitEvent(event));}}module[_0xe38a('0x9')]=VoiceQueueEvents;
\ No newline at end of file
+var _0x469a=['remove','emit','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x166edb,_0x3968fd){var _0x3a99e6=function(_0x3522e3){while(--_0x3522e3){_0x166edb['push'](_0x166edb['shift']());}};_0x3a99e6(++_0x3968fd);}(_0x469a,0x163));var _0xa469=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0x469a[_0x336376];return _0x1d2a8e;};'use strict';var EventEmitter=require(_0xa469('0x0'));var VoiceQueue=require(_0xa469('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa469('0x2')](0x0);var events={'afterCreate':_0xa469('0x3'),'afterUpdate':_0xa469('0x4'),'afterDestroy':_0xa469('0x5')};function emitEvent(_0x1e2215){return function(_0x7b2c08,_0x48819b,_0x2fdf20){VoiceQueueEvents[_0xa469('0x6')](_0x1e2215+':'+_0x7b2c08['id'],_0x7b2c08);VoiceQueueEvents[_0xa469('0x6')](_0x1e2215,_0x7b2c08);_0x2fdf20(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xa469('0x7')]=VoiceQueueEvents;
\ No newline at end of file
index fde3fc7..d62bef7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3c5073,_0x20df77){var _0x324c6f=function(_0xecfa97){while(--_0xecfa97){_0x3c5073['push'](_0x3c5073['shift']());}};_0x324c6f(++_0x20df77);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0xcdd992,_0x4ee33){var _0x26e073=function(_0x540027){while(--_0x540027){_0xcdd992['push'](_0xcdd992['shift']());}};_0x26e073(++_0x4ee33);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 0bfd091..099cdd4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a90=['include','model','map','then','GetVoiceQueue','find','ShowVoiceQueue','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceQueue,\x20%s,\x20%s','message','info','catch','VoiceQueue','findAll','raw','options','attributes','limit'];(function(_0x38a247,_0x5a33c2){var _0x1ee93c=function(_0x112458){while(--_0x112458){_0x38a247['push'](_0x38a247['shift']());}};_0x1ee93c(++_0x5a33c2);}(_0x7a90,0x170));var _0x07a9=function(_0x33dbb8,_0x259fd1){_0x33dbb8=_0x33dbb8-0x0;var _0x54788a=_0x7a90[_0x33dbb8];return _0x54788a;};'use strict';var _=require(_0x07a9('0x0'));var util=require(_0x07a9('0x1'));var moment=require(_0x07a9('0x2'));var BPromise=require(_0x07a9('0x3'));var rs=require(_0x07a9('0x4'));var fs=require('fs');var Redis=require(_0x07a9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x07a9('0x6'))(_0x07a9('0x7'));var config=require(_0x07a9('0x8'));var jayson=require(_0x07a9('0x9'));var client=jayson[_0x07a9('0xa')][_0x07a9('0xb')]({'port':0x232a});config[_0x07a9('0xc')]=_[_0x07a9('0xd')](config['redis'],{'host':_0x07a9('0xe'),'port':0x18eb});var socket=require(_0x07a9('0xf'))(new Redis(config[_0x07a9('0xc')]));require(_0x07a9('0x10'))[_0x07a9('0x11')](socket);function respondWithRpcPromise(_0x70983e,_0x28eee3,_0x5cd552){return new BPromise(function(_0x51ff1c,_0x321e05){return client['request'](_0x70983e,_0x5cd552)['then'](function(_0x24a888){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x28eee3,'request\x20sent');logger['debug'](_0x07a9('0x12'),_0x28eee3,_0x07a9('0x13'),JSON['stringify'](_0x24a888));if(_0x24a888[_0x07a9('0x14')]){if(_0x24a888[_0x07a9('0x14')][_0x07a9('0x15')]===0x1f4){logger[_0x07a9('0x14')](_0x07a9('0x16'),_0x28eee3,_0x24a888[_0x07a9('0x14')][_0x07a9('0x17')]);return _0x321e05(_0x24a888[_0x07a9('0x14')][_0x07a9('0x17')]);}logger[_0x07a9('0x14')](_0x07a9('0x16'),_0x28eee3,_0x24a888[_0x07a9('0x14')][_0x07a9('0x17')]);return _0x51ff1c(_0x24a888[_0x07a9('0x14')][_0x07a9('0x17')]);}else{logger[_0x07a9('0x18')](_0x07a9('0x16'),_0x28eee3,'request\x20sent');_0x51ff1c(_0x24a888['result'][_0x07a9('0x17')]);}})[_0x07a9('0x19')](function(_0x44e457){logger[_0x07a9('0x14')](_0x07a9('0x16'),_0x28eee3,_0x44e457);_0x321e05(_0x44e457);});});}exports['GetVoiceQueue']=function(_0x13a690){var _0x17909a=this;return new Promise(function(_0x3dfcba,_0x11ee58){return db[_0x07a9('0x1a')][_0x07a9('0x1b')]({'raw':_0x13a690['options']?_0x13a690['options'][_0x07a9('0x1c')]===undefined?!![]:![]:!![],'where':_0x13a690[_0x07a9('0x1d')]?_0x13a690[_0x07a9('0x1d')]['where']||null:null,'attributes':_0x13a690[_0x07a9('0x1d')]?_0x13a690[_0x07a9('0x1d')][_0x07a9('0x1e')]||null:null,'limit':_0x13a690[_0x07a9('0x1d')]?_0x13a690[_0x07a9('0x1d')][_0x07a9('0x1f')]||null:null,'include':_0x13a690['options']?_0x13a690[_0x07a9('0x1d')][_0x07a9('0x20')]?_['map'](_0x13a690[_0x07a9('0x1d')][_0x07a9('0x20')],function(_0x4cfe87){return{'model':db[_0x4cfe87[_0x07a9('0x21')]],'as':_0x4cfe87['as'],'attributes':_0x4cfe87[_0x07a9('0x1e')],'include':_0x4cfe87[_0x07a9('0x20')]?_[_0x07a9('0x22')](_0x4cfe87[_0x07a9('0x20')],function(_0x1f4bff){return{'model':db[_0x1f4bff[_0x07a9('0x21')]],'as':_0x1f4bff['as'],'attributes':_0x1f4bff[_0x07a9('0x1e')],'include':_0x1f4bff[_0x07a9('0x20')]?_[_0x07a9('0x22')](_0x1f4bff[_0x07a9('0x20')],function(_0x2b5bb8){return{'model':db[_0x2b5bb8[_0x07a9('0x21')]],'as':_0x2b5bb8['as'],'attributes':_0x2b5bb8[_0x07a9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x07a9('0x23')](function(_0x5da2ac){logger[_0x07a9('0x18')](_0x07a9('0x24'),_0x13a690);logger['debug'](_0x07a9('0x24'),_0x13a690,JSON['stringify'](_0x5da2ac));_0x3dfcba(_0x5da2ac);})[_0x07a9('0x19')](function(_0x383d1a){logger['error'](_0x07a9('0x24'),_0x383d1a[_0x07a9('0x17')],_0x13a690);_0x11ee58(_0x17909a['error'](0x1f4,_0x383d1a[_0x07a9('0x17')]));});});};exports['ShowVoiceQueue']=function(_0x48ecf3){var _0x1d9563=this;return new Promise(function(_0x3aa2dc,_0x4a1fef){return db[_0x07a9('0x1a')][_0x07a9('0x25')]({'raw':_0x48ecf3[_0x07a9('0x1d')]?_0x48ecf3[_0x07a9('0x1d')][_0x07a9('0x1c')]===undefined?!![]:![]:!![],'where':_0x48ecf3['options']?_0x48ecf3[_0x07a9('0x1d')]['where']||null:null,'attributes':_0x48ecf3[_0x07a9('0x1d')]?_0x48ecf3[_0x07a9('0x1d')][_0x07a9('0x1e')]||null:null,'include':_0x48ecf3[_0x07a9('0x1d')]?_0x48ecf3['options'][_0x07a9('0x20')]?_[_0x07a9('0x22')](_0x48ecf3[_0x07a9('0x1d')][_0x07a9('0x20')],function(_0xbbfb6e){return{'model':db[_0xbbfb6e[_0x07a9('0x21')]],'as':_0xbbfb6e['as'],'attributes':_0xbbfb6e[_0x07a9('0x1e')],'include':_0xbbfb6e[_0x07a9('0x20')]?_[_0x07a9('0x22')](_0xbbfb6e[_0x07a9('0x20')],function(_0xf95d45){return{'model':db[_0xf95d45[_0x07a9('0x21')]],'as':_0xf95d45['as'],'attributes':_0xf95d45[_0x07a9('0x1e')],'include':_0xf95d45[_0x07a9('0x20')]?_['map'](_0xf95d45['include'],function(_0x704d4e){return{'model':db[_0x704d4e[_0x07a9('0x21')]],'as':_0x704d4e['as'],'attributes':_0x704d4e['attributes']};}):[]};}):[]};}):[]:[]})[_0x07a9('0x23')](function(_0x258844){logger['info'](_0x07a9('0x26'),_0x48ecf3);logger[_0x07a9('0x27')](_0x07a9('0x26'),_0x48ecf3,JSON['stringify'](_0x258844));_0x3aa2dc(_0x258844);})[_0x07a9('0x19')](function(_0x1004ae){logger[_0x07a9('0x14')](_0x07a9('0x26'),_0x1004ae[_0x07a9('0x17')],_0x48ecf3);_0x4a1fef(_0x1d9563['error'](0x1f4,_0x1004ae[_0x07a9('0x17')]));});});};
\ No newline at end of file
+var _0xcb54=['where','attributes','limit','include','map','model','stringify','catch','ShowVoiceQueue','VoiceQueue','util','moment','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetVoiceQueue','findAll','options','raw'];(function(_0x212fcc,_0x1a8867){var _0x4d8190=function(_0x347f7b){while(--_0x347f7b){_0x212fcc['push'](_0x212fcc['shift']());}};_0x4d8190(++_0x1a8867);}(_0xcb54,0x9a));var _0x4cb5=function(_0x5671ed,_0x2464a6){_0x5671ed=_0x5671ed-0x0;var _0x295d6b=_0xcb54[_0x5671ed];return _0x295d6b;};'use strict';var _=require('lodash');var util=require(_0x4cb5('0x0'));var moment=require(_0x4cb5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cb5('0x2'));var db=require(_0x4cb5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4cb5('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4cb5('0x5'));var client=jayson[_0x4cb5('0x6')][_0x4cb5('0x7')]({'port':0x232a});config[_0x4cb5('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4cb5('0x9'))(new Redis(config[_0x4cb5('0x8')]));require(_0x4cb5('0xa'))[_0x4cb5('0xb')](socket);function respondWithRpcPromise(_0x47bde9,_0x42e46b,_0x517443){return new BPromise(function(_0x112bf7,_0x2f4caa){return client[_0x4cb5('0xc')](_0x47bde9,_0x517443)[_0x4cb5('0xd')](function(_0xf5cfab){logger[_0x4cb5('0xe')](_0x4cb5('0xf'),_0x42e46b,_0x4cb5('0x10'));logger[_0x4cb5('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x42e46b,_0x4cb5('0x10'),JSON['stringify'](_0xf5cfab));if(_0xf5cfab[_0x4cb5('0x12')]){if(_0xf5cfab[_0x4cb5('0x12')][_0x4cb5('0x13')]===0x1f4){logger[_0x4cb5('0x12')](_0x4cb5('0xf'),_0x42e46b,_0xf5cfab[_0x4cb5('0x12')]['message']);return _0x2f4caa(_0xf5cfab['error']['message']);}logger[_0x4cb5('0x12')](_0x4cb5('0xf'),_0x42e46b,_0xf5cfab[_0x4cb5('0x12')][_0x4cb5('0x14')]);return _0x112bf7(_0xf5cfab[_0x4cb5('0x12')][_0x4cb5('0x14')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x42e46b,_0x4cb5('0x10'));_0x112bf7(_0xf5cfab[_0x4cb5('0x15')][_0x4cb5('0x14')]);}})['catch'](function(_0x365e9a){logger['error'](_0x4cb5('0xf'),_0x42e46b,_0x365e9a);_0x2f4caa(_0x365e9a);});});}exports[_0x4cb5('0x16')]=function(_0x236f78){var _0x2145dd=this;return new Promise(function(_0x24b8ac,_0x604eca){return db['VoiceQueue'][_0x4cb5('0x17')]({'raw':_0x236f78[_0x4cb5('0x18')]?_0x236f78['options'][_0x4cb5('0x19')]===undefined?!![]:![]:!![],'where':_0x236f78[_0x4cb5('0x18')]?_0x236f78['options'][_0x4cb5('0x1a')]||null:null,'attributes':_0x236f78['options']?_0x236f78[_0x4cb5('0x18')][_0x4cb5('0x1b')]||null:null,'limit':_0x236f78[_0x4cb5('0x18')]?_0x236f78['options'][_0x4cb5('0x1c')]||null:null,'include':_0x236f78['options']?_0x236f78[_0x4cb5('0x18')][_0x4cb5('0x1d')]?_[_0x4cb5('0x1e')](_0x236f78['options'][_0x4cb5('0x1d')],function(_0x10507f){return{'model':db[_0x10507f[_0x4cb5('0x1f')]],'as':_0x10507f['as'],'attributes':_0x10507f[_0x4cb5('0x1b')],'include':_0x10507f['include']?_[_0x4cb5('0x1e')](_0x10507f[_0x4cb5('0x1d')],function(_0x2e1f05){return{'model':db[_0x2e1f05[_0x4cb5('0x1f')]],'as':_0x2e1f05['as'],'attributes':_0x2e1f05[_0x4cb5('0x1b')],'include':_0x2e1f05[_0x4cb5('0x1d')]?_[_0x4cb5('0x1e')](_0x2e1f05[_0x4cb5('0x1d')],function(_0x5ad28b){return{'model':db[_0x5ad28b[_0x4cb5('0x1f')]],'as':_0x5ad28b['as'],'attributes':_0x5ad28b[_0x4cb5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4cb5('0xd')](function(_0x54cc95){logger['info'](_0x4cb5('0x16'),_0x236f78);logger[_0x4cb5('0x11')](_0x4cb5('0x16'),_0x236f78,JSON[_0x4cb5('0x20')](_0x54cc95));_0x24b8ac(_0x54cc95);})[_0x4cb5('0x21')](function(_0x351728){logger[_0x4cb5('0x12')](_0x4cb5('0x16'),_0x351728[_0x4cb5('0x14')],_0x236f78);_0x604eca(_0x2145dd['error'](0x1f4,_0x351728[_0x4cb5('0x14')]));});});};exports[_0x4cb5('0x22')]=function(_0x3ce054){var _0xda9f56=this;return new Promise(function(_0x3c7e79,_0xf2bb5d){return db[_0x4cb5('0x23')]['find']({'raw':_0x3ce054[_0x4cb5('0x18')]?_0x3ce054[_0x4cb5('0x18')][_0x4cb5('0x19')]===undefined?!![]:![]:!![],'where':_0x3ce054[_0x4cb5('0x18')]?_0x3ce054['options'][_0x4cb5('0x1a')]||null:null,'attributes':_0x3ce054[_0x4cb5('0x18')]?_0x3ce054[_0x4cb5('0x18')][_0x4cb5('0x1b')]||null:null,'include':_0x3ce054[_0x4cb5('0x18')]?_0x3ce054[_0x4cb5('0x18')][_0x4cb5('0x1d')]?_['map'](_0x3ce054['options'][_0x4cb5('0x1d')],function(_0x18a9fe){return{'model':db[_0x18a9fe[_0x4cb5('0x1f')]],'as':_0x18a9fe['as'],'attributes':_0x18a9fe[_0x4cb5('0x1b')],'include':_0x18a9fe[_0x4cb5('0x1d')]?_[_0x4cb5('0x1e')](_0x18a9fe[_0x4cb5('0x1d')],function(_0x29b374){return{'model':db[_0x29b374[_0x4cb5('0x1f')]],'as':_0x29b374['as'],'attributes':_0x29b374[_0x4cb5('0x1b')],'include':_0x29b374[_0x4cb5('0x1d')]?_[_0x4cb5('0x1e')](_0x29b374[_0x4cb5('0x1d')],function(_0x510414){return{'model':db[_0x510414[_0x4cb5('0x1f')]],'as':_0x510414['as'],'attributes':_0x510414['attributes']};}):[]};}):[]};}):[]:[]})[_0x4cb5('0xd')](function(_0x39589a){logger['info'](_0x4cb5('0x22'),_0x3ce054);logger[_0x4cb5('0x11')](_0x4cb5('0x22'),_0x3ce054,JSON['stringify'](_0x39589a));_0x3c7e79(_0x39589a);})[_0x4cb5('0x21')](function(_0x933164){logger[_0x4cb5('0x12')](_0x4cb5('0x22'),_0x933164['message'],_0x3ce054);_0xf2bb5d(_0xda9f56[_0x4cb5('0x12')](0x1f4,_0x933164[_0x4cb5('0x14')]));});});};
\ No newline at end of file
index 7c6d1c1..3aee7a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9e4c=['register','length','voiceQueue:','./voiceQueue.events','save','remove','update'];(function(_0x4eeb7c,_0x86d349){var _0x212640=function(_0x3afbef){while(--_0x3afbef){_0x4eeb7c['push'](_0x4eeb7c['shift']());}};_0x212640(++_0x86d349);}(_0x9e4c,0xe3));var _0xc9e4=function(_0x210556,_0xf3c6c4){_0x210556=_0x210556-0x0;var _0x4d4b0f=_0x9e4c[_0x210556];return _0x4d4b0f;};'use strict';var VoiceQueueEvents=require(_0xc9e4('0x0'));var events=[_0xc9e4('0x1'),_0xc9e4('0x2'),_0xc9e4('0x3')];function createListener(_0x440812,_0x2761ac){return function(_0x596108){_0x2761ac['emit'](_0x440812,_0x596108);};}function removeListener(_0x438c43,_0x25a39b){return function(){VoiceQueueEvents['removeListener'](_0x438c43,_0x25a39b);};}exports[_0xc9e4('0x4')]=function(_0x410be7){for(var _0x4a54a4=0x0,_0x222bb8=events[_0xc9e4('0x5')];_0x4a54a4<_0x222bb8;_0x4a54a4++){var _0x3f2c65=events[_0x4a54a4];var _0x428b4a=createListener(_0xc9e4('0x6')+_0x3f2c65,_0x410be7);VoiceQueueEvents['on'](_0x3f2c65,_0x428b4a);}};
\ No newline at end of file
+var _0x2eda=['update','emit','removeListener','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x3444fa,_0x545b29){var _0x195965=function(_0x25bbe4){while(--_0x25bbe4){_0x3444fa['push'](_0x3444fa['shift']());}};_0x195965(++_0x545b29);}(_0x2eda,0x123));var _0xa2ed=function(_0x5c33ef,_0x3be2d7){_0x5c33ef=_0x5c33ef-0x0;var _0x2fe74c=_0x2eda[_0x5c33ef];return _0x2fe74c;};'use strict';var VoiceQueueEvents=require(_0xa2ed('0x0'));var events=[_0xa2ed('0x1'),_0xa2ed('0x2'),_0xa2ed('0x3')];function createListener(_0x9e2d0b,_0x5ce8e9){return function(_0x5400cb){_0x5ce8e9[_0xa2ed('0x4')](_0x9e2d0b,_0x5400cb);};}function removeListener(_0x50b4c4,_0xbeb55b){return function(){VoiceQueueEvents[_0xa2ed('0x5')](_0x50b4c4,_0xbeb55b);};}exports['register']=function(_0x213fe6){for(var _0x467644=0x0,_0x5fa217=events['length'];_0x467644<_0x5fa217;_0x467644++){var _0x39e49d=events[_0x467644];var _0x4c9f96=createListener(_0xa2ed('0x6')+_0x39e49d,_0x213fe6);VoiceQueueEvents['on'](_0x39e49d,_0x4c9f96);}};
\ No newline at end of file
index eb5aab4..8ffd90a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xddd1=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','put','update','destroy','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xddd1,0xab));var _0x1ddd=function(_0xb32fb9,_0x50af09){_0xb32fb9=_0xb32fb9-0x0;var _0x57cab1=_0xddd1[_0xb32fb9];return _0x57cab1;};'use strict';var multer=require('multer');var util=require(_0x1ddd('0x0'));var path=require(_0x1ddd('0x1'));var timeout=require(_0x1ddd('0x2'));var express=require(_0x1ddd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1ddd('0x4'));var interaction=require(_0x1ddd('0x5'));var config=require('../../config/environment');var controller=require(_0x1ddd('0x6'));router[_0x1ddd('0x7')]('/',auth[_0x1ddd('0x8')](),controller[_0x1ddd('0x9')]);router[_0x1ddd('0x7')](_0x1ddd('0xa'),auth[_0x1ddd('0x8')](),controller[_0x1ddd('0xb')]);router[_0x1ddd('0x7')](_0x1ddd('0xc'),auth['isAuthenticated'](),controller[_0x1ddd('0xd')]);router['get'](_0x1ddd('0xe'),auth[_0x1ddd('0x8')](),controller['show']);router['post']('/',auth[_0x1ddd('0x8')](),controller['create']);router[_0x1ddd('0xf')](_0x1ddd('0xe'),auth[_0x1ddd('0x8')](),controller[_0x1ddd('0x10')]);router['delete']('/:id',auth[_0x1ddd('0x8')](),controller[_0x1ddd('0x11')]);module[_0x1ddd('0x12')]=router;
\ No newline at end of file
+var _0x0f71=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','/:id','post','create','put','destroy'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x0f71,0x13b));var _0x10f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f71[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x10f7('0x0'));var util=require('util');var path=require(_0x10f7('0x1'));var timeout=require(_0x10f7('0x2'));var express=require(_0x10f7('0x3'));var router=express[_0x10f7('0x4')]();var fs_extra=require(_0x10f7('0x5'));var auth=require(_0x10f7('0x6'));var interaction=require(_0x10f7('0x7'));var config=require(_0x10f7('0x8'));var controller=require(_0x10f7('0x9'));router[_0x10f7('0xa')]('/',auth[_0x10f7('0xb')](),controller[_0x10f7('0xc')]);router[_0x10f7('0xa')](_0x10f7('0xd'),auth[_0x10f7('0xb')](),controller[_0x10f7('0xe')]);router[_0x10f7('0xa')]('/index',auth['isAuthenticated'](),controller[_0x10f7('0xf')]);router['get'](_0x10f7('0x10'),auth[_0x10f7('0xb')](),controller['show']);router[_0x10f7('0x11')]('/',auth[_0x10f7('0xb')](),controller[_0x10f7('0x12')]);router[_0x10f7('0x13')](_0x10f7('0x10'),auth[_0x10f7('0xb')](),controller['update']);router['delete']('/:id',auth[_0x10f7('0xb')](),controller[_0x10f7('0x14')]);module['exports']=router;
\ No newline at end of file
index af2fa50..76981a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5d09=['queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue'];(function(_0x41489d,_0x248136){var _0x2044c9=function(_0x5a54a9){while(--_0x5a54a9){_0x41489d['push'](_0x41489d['shift']());}};_0x2044c9(++_0x248136);}(_0x5d09,0xb9));var _0x95d0=function(_0x14be19,_0x3067bb){_0x14be19=_0x14be19-0x0;var _0x240fb4=_0x5d09[_0x14be19];return _0x240fb4;};'use strict';var Sequelize=require(_0x95d0('0x0'));var moment=require(_0x95d0('0x1'));module[_0x95d0('0x2')]={'type':{'type':Sequelize[_0x95d0('0x3')]},'uniqueid':{'type':Sequelize[_0x95d0('0x3')]},'calleridnum':{'type':Sequelize[_0x95d0('0x3')]},'calleridname':{'type':Sequelize[_0x95d0('0x3')]},'queue':{'type':Sequelize[_0x95d0('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x95d0('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x95d0('0x4')],'set':function(_0x1154cb){var _0x86652a=moment(_0x1154cb);var _0x5611c2=moment(this['getDataValue']('queuecallerjoinAt'))[_0x95d0('0x5')](_0x95d0('0x6'));var _0x5f5886=_0x86652a[_0x95d0('0x7')](_0x5611c2,_0x95d0('0x8'));this[_0x95d0('0x9')](_0x95d0('0xa'),_0x1154cb);this['setDataValue'](_0x95d0('0xb'),_0x5f5886||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x95d0('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x95d0('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x95d0('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x95d0('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x95d0('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x95d0('0x3')],'comment':_0x95d0('0xe')},'originalposition':{'type':Sequelize[_0x95d0('0xc')]},'channel':{'type':Sequelize[_0x95d0('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x95d0('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x95d0('0x3')]},'priority':{'type':Sequelize[_0x95d0('0x3')]},'holdtime':{'type':Sequelize[_0x95d0('0xc')]},'mohtime':{'type':Sequelize[_0x95d0('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x95d0('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x95d0('0x3')]},'transfer':{'type':Sequelize[_0x95d0('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x95d0('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x95d0('0x3')]},'transferuniqueid':{'type':Sequelize[_0x95d0('0x3')]},'disposition':{'type':Sequelize[_0x95d0('0x3')]},'secondDisposition':{'type':Sequelize[_0x95d0('0x3')]},'thirdDisposition':{'type':Sequelize[_0x95d0('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x95d0('0xc')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xd8f1=['getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x16ce0c,_0x454bfa){var _0x21901c=function(_0x5863f4){while(--_0x5863f4){_0x16ce0c['push'](_0x16ce0c['shift']());}};_0x21901c(++_0x454bfa);}(_0xd8f1,0x164));var _0x1d8f=function(_0xd567d4,_0x546ab2){_0xd567d4=_0xd567d4-0x0;var _0x3661b1=_0xd8f1[_0xd567d4];return _0x3661b1;};'use strict';var Sequelize=require(_0x1d8f('0x0'));var moment=require('moment');module[_0x1d8f('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1d8f('0x2')]},'calleridnum':{'type':Sequelize[_0x1d8f('0x2')]},'calleridname':{'type':Sequelize[_0x1d8f('0x2')]},'queue':{'type':Sequelize[_0x1d8f('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x1d8f('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x146b22){var _0x538826=moment(_0x146b22);var _0x1d33f0=moment(this[_0x1d8f('0x4')](_0x1d8f('0x5')))[_0x1d8f('0x6')](_0x1d8f('0x7'));var _0x5c4142=_0x538826[_0x1d8f('0x8')](_0x1d33f0,_0x1d8f('0x9'));this['setDataValue']('queuecallerleaveAt',_0x146b22);this[_0x1d8f('0xa')]('holdtime',_0x5c4142||null);}},'position':{'type':Sequelize[_0x1d8f('0xb')]},'count':{'type':Sequelize[_0x1d8f('0xb')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x1d8f('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1d8f('0x3')]},'queuecallerexit':{'type':Sequelize[_0x1d8f('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x1d8f('0xd')},'originalposition':{'type':Sequelize[_0x1d8f('0xb')]},'channel':{'type':Sequelize[_0x1d8f('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x1d8f('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1d8f('0x2')]},'priority':{'type':Sequelize[_0x1d8f('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1d8f('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x1d8f('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x1d8f('0xe')},'transferexten':{'type':Sequelize[_0x1d8f('0x2')]},'transferuniqueid':{'type':Sequelize[_0x1d8f('0x2')]},'disposition':{'type':Sequelize[_0x1d8f('0x2')]},'secondDisposition':{'type':Sequelize[_0x1d8f('0x2')]},'thirdDisposition':{'type':Sequelize[_0x1d8f('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x1d8f('0xb')],'defaultValue':0x0}};
\ No newline at end of file
index 8557d02..e533a30 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xad99=['ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','undefined','limit','offset','count','json','apply','save','destroy','then','error','stack','name','send','index','map','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','VoiceQueueReport','find','create','body','catch','update','describe','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x311b65,_0x4494df){var _0x431ce0=function(_0x42efb1){while(--_0x42efb1){_0x311b65['push'](_0x311b65['shift']());}};_0x431ce0(++_0x4494df);}(_0xad99,0x142));var _0x9ad9=function(_0x5abba1,_0x3153d3){_0x5abba1=_0x5abba1-0x0;var _0x2ffbb0=_0xad99[_0x5abba1];return _0x2ffbb0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ad9('0x0'));var zipdir=require(_0x9ad9('0x1'));var jsonpatch=require(_0x9ad9('0x2'));var rp=require('request-promise');var moment=require(_0x9ad9('0x3'));var BPromise=require(_0x9ad9('0x4'));var Mustache=require(_0x9ad9('0x5'));var util=require(_0x9ad9('0x6'));var path=require(_0x9ad9('0x7'));var sox=require(_0x9ad9('0x8'));var csv=require(_0x9ad9('0x9'));var ejs=require(_0x9ad9('0xa'));var fs=require('fs');var fs_extra=require(_0x9ad9('0xb'));var _=require(_0x9ad9('0xc'));var squel=require('squel');var crypto=require(_0x9ad9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9ad9('0xe'));var toCsv=require(_0x9ad9('0x9'));var querystring=require('querystring');var Papa=require(_0x9ad9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9ad9('0x10'));var as=require(_0x9ad9('0x11'));var hardwareService=require(_0x9ad9('0x12'));var logger=require(_0x9ad9('0x13'))(_0x9ad9('0x14'));var utils=require(_0x9ad9('0x15'));var config=require(_0x9ad9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ad9('0x17'))['db'];config[_0x9ad9('0x18')]=_[_0x9ad9('0x19')](config['redis'],{'host':_0x9ad9('0x1a'),'port':0x18eb});var socket=require(_0x9ad9('0x1b'))(new Redis(config['redis']));require(_0x9ad9('0x1c'))[_0x9ad9('0x1d')](socket);function respondWithStatusCode(_0x579e0b,_0xe0ed32){_0xe0ed32=_0xe0ed32||0xcc;return function(_0x4db06c){if(_0x4db06c){return _0x579e0b[_0x9ad9('0x1e')](_0xe0ed32);}return _0x579e0b[_0x9ad9('0x1f')](_0xe0ed32)[_0x9ad9('0x20')]();};}function respondWithResult(_0x5ce283,_0x10bc2e){_0x10bc2e=_0x10bc2e||0xc8;return function(_0x5aef34){if(_0x5aef34){return _0x5ce283[_0x9ad9('0x1f')](_0x10bc2e)['json'](_0x5aef34);}};}function respondWithFilteredResult(_0x48691b,_0x5c305e){return function(_0x3c6b77){if(_0x3c6b77){var _0x2cc203=typeof _0x5c305e['offset']===_0x9ad9('0x21')&&typeof _0x5c305e[_0x9ad9('0x22')]===_0x9ad9('0x21');var _0x43d9ef=_0x3c6b77['count'];var _0x4a830a=_0x2cc203?0x0:_0x5c305e[_0x9ad9('0x23')];var _0x5a2562=_0x2cc203?_0x3c6b77[_0x9ad9('0x24')]:_0x5c305e[_0x9ad9('0x23')]+_0x5c305e[_0x9ad9('0x22')];var _0x455958;if(_0x5a2562>=_0x43d9ef){_0x5a2562=_0x43d9ef;_0x455958=0xc8;}else{_0x455958=0xce;}_0x48691b[_0x9ad9('0x1f')](_0x455958);return _0x48691b['set']('Content-Range',_0x4a830a+'-'+_0x5a2562+'/'+_0x43d9ef)[_0x9ad9('0x25')](_0x3c6b77);}return null;};}function patchUpdates(_0x340107){return function(_0x26d866){try{jsonpatch[_0x9ad9('0x26')](_0x26d866,_0x340107,!![]);}catch(_0x185ff7){return BPromise['reject'](_0x185ff7);}return _0x26d866[_0x9ad9('0x27')]();};}function saveUpdates(_0x4b6b6c,_0x57d959){return function(_0x39b7ae){if(_0x39b7ae){return _0x39b7ae['update'](_0x4b6b6c)['then'](function(_0x114f5f){return _0x114f5f;});}return null;};}function removeEntity(_0x4ead67,_0x37c3b6){return function(_0x5af003){if(_0x5af003){return _0x5af003[_0x9ad9('0x28')]()[_0x9ad9('0x29')](function(){_0x4ead67[_0x9ad9('0x1f')](0xcc)[_0x9ad9('0x20')]();});}};}function handleEntityNotFound(_0x3679b2,_0x48951c){return function(_0x50db46){if(!_0x50db46){_0x3679b2['sendStatus'](0x194);}return _0x50db46;};}function handleError(_0x14b733,_0x58bd96){_0x58bd96=_0x58bd96||0x1f4;return function(_0x2bfb19){logger[_0x9ad9('0x2a')](_0x2bfb19[_0x9ad9('0x2b')]);if(_0x2bfb19[_0x9ad9('0x2c')]){delete _0x2bfb19[_0x9ad9('0x2c')];}_0x14b733[_0x9ad9('0x1f')](_0x58bd96)[_0x9ad9('0x2d')](_0x2bfb19);};}exports[_0x9ad9('0x2e')]=function(_0x159d79,_0x45cde3){var _0x53cef7={},_0x519bbc={},_0x42c5e3={'count':0x0,'rows':[]};var _0x4c0f95=_[_0x9ad9('0x2f')](db['VoiceQueueReport']['rawAttributes'],function(_0x3f94c4){return{'name':_0x3f94c4[_0x9ad9('0x30')],'type':_0x3f94c4[_0x9ad9('0x31')][_0x9ad9('0x32')]};});_0x519bbc['model']=_[_0x9ad9('0x2f')](_0x4c0f95,'name');_0x519bbc['query']=_[_0x9ad9('0x33')](_0x159d79[_0x9ad9('0x34')]);_0x519bbc[_0x9ad9('0x35')]=_[_0x9ad9('0x36')](_0x519bbc['model'],_0x519bbc[_0x9ad9('0x34')]);_0x53cef7[_0x9ad9('0x37')]=_[_0x9ad9('0x36')](_0x519bbc[_0x9ad9('0x38')],qs[_0x9ad9('0x39')](_0x159d79[_0x9ad9('0x34')][_0x9ad9('0x39')]));_0x53cef7[_0x9ad9('0x37')]=_0x53cef7[_0x9ad9('0x37')][_0x9ad9('0x3a')]?_0x53cef7['attributes']:_0x519bbc[_0x9ad9('0x38')];if(!_0x159d79[_0x9ad9('0x34')][_0x9ad9('0x3b')](_0x9ad9('0x3c'))){_0x53cef7[_0x9ad9('0x22')]=qs[_0x9ad9('0x22')](_0x159d79[_0x9ad9('0x34')][_0x9ad9('0x22')]);_0x53cef7['offset']=qs[_0x9ad9('0x23')](_0x159d79['query'][_0x9ad9('0x23')]);}_0x53cef7[_0x9ad9('0x3d')]=qs[_0x9ad9('0x3e')](_0x159d79[_0x9ad9('0x34')][_0x9ad9('0x3e')]);_0x53cef7[_0x9ad9('0x3f')]=qs['filters'](_[_0x9ad9('0x40')](_0x159d79[_0x9ad9('0x34')],_0x519bbc[_0x9ad9('0x35')]),_0x4c0f95);if(_0x159d79[_0x9ad9('0x34')][_0x9ad9('0x41')]){_0x53cef7['where']=_['merge'](_0x53cef7[_0x9ad9('0x3f')],{'$or':_[_0x9ad9('0x2f')](_0x4c0f95,function(_0x522ea0){if(_0x522ea0[_0x9ad9('0x31')]!==_0x9ad9('0x42')){var _0x1c0fd2={};_0x1c0fd2[_0x522ea0[_0x9ad9('0x2c')]]={'$like':'%'+_0x159d79[_0x9ad9('0x34')][_0x9ad9('0x41')]+'%'};return _0x1c0fd2;}})});}_0x53cef7=_[_0x9ad9('0x43')]({},_0x53cef7,_0x159d79[_0x9ad9('0x44')]);var _0x2e8ddc={'where':_0x53cef7[_0x9ad9('0x3f')]};return db['VoiceQueueReport']['count'](_0x2e8ddc)[_0x9ad9('0x29')](function(_0x247629){_0x42c5e3[_0x9ad9('0x24')]=_0x247629;if(_0x159d79[_0x9ad9('0x34')][_0x9ad9('0x45')]){_0x53cef7['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x9ad9('0x46')](_0x53cef7);})['then'](function(_0x50f99f){_0x42c5e3[_0x9ad9('0x47')]=_0x50f99f;return _0x42c5e3;})[_0x9ad9('0x29')](respondWithFilteredResult(_0x45cde3,_0x53cef7))['catch'](handleError(_0x45cde3,null));};exports[_0x9ad9('0x48')]=function(_0x27518d,_0x496b5b){var _0x1dc0cf={'raw':![],'where':{'id':_0x27518d[_0x9ad9('0x49')]['id']}},_0x1c5269={};_0x1c5269[_0x9ad9('0x38')]=_[_0x9ad9('0x33')](db['VoiceQueueReport']['rawAttributes']);_0x1c5269[_0x9ad9('0x34')]=_[_0x9ad9('0x33')](_0x27518d[_0x9ad9('0x34')]);_0x1c5269[_0x9ad9('0x35')]=_[_0x9ad9('0x36')](_0x1c5269[_0x9ad9('0x38')],_0x1c5269[_0x9ad9('0x34')]);_0x1dc0cf[_0x9ad9('0x37')]=_['intersection'](_0x1c5269[_0x9ad9('0x38')],qs[_0x9ad9('0x39')](_0x27518d[_0x9ad9('0x34')][_0x9ad9('0x39')]));_0x1dc0cf[_0x9ad9('0x37')]=_0x1dc0cf[_0x9ad9('0x37')][_0x9ad9('0x3a')]?_0x1dc0cf[_0x9ad9('0x37')]:_0x1c5269[_0x9ad9('0x38')];if(_0x27518d[_0x9ad9('0x34')][_0x9ad9('0x45')]){_0x1dc0cf[_0x9ad9('0x4a')]=[{'all':!![]}];}_0x1dc0cf=_[_0x9ad9('0x43')]({},_0x1dc0cf,_0x27518d[_0x9ad9('0x44')]);return db[_0x9ad9('0x4b')][_0x9ad9('0x4c')](_0x1dc0cf)[_0x9ad9('0x29')](handleEntityNotFound(_0x496b5b,null))[_0x9ad9('0x29')](respondWithResult(_0x496b5b,null))['catch'](handleError(_0x496b5b,null));};exports[_0x9ad9('0x4d')]=function(_0x26fded,_0x5f1182){return db['VoiceQueueReport'][_0x9ad9('0x4d')](_0x26fded[_0x9ad9('0x4e')],{})[_0x9ad9('0x29')](respondWithResult(_0x5f1182,0xc9))[_0x9ad9('0x4f')](handleError(_0x5f1182,null));};exports[_0x9ad9('0x50')]=function(_0x40e0f1,_0x10be01){if(_0x40e0f1[_0x9ad9('0x4e')]['id']){delete _0x40e0f1[_0x9ad9('0x4e')]['id'];}return db[_0x9ad9('0x4b')]['find']({'where':{'id':_0x40e0f1[_0x9ad9('0x49')]['id']}})[_0x9ad9('0x29')](handleEntityNotFound(_0x10be01,null))[_0x9ad9('0x29')](saveUpdates(_0x40e0f1[_0x9ad9('0x4e')],null))[_0x9ad9('0x29')](respondWithResult(_0x10be01,null))[_0x9ad9('0x4f')](handleError(_0x10be01,null));};exports[_0x9ad9('0x28')]=function(_0x41ae4c,_0x305e7b){return db[_0x9ad9('0x4b')][_0x9ad9('0x4c')]({'where':{'id':_0x41ae4c[_0x9ad9('0x49')]['id']}})['then'](handleEntityNotFound(_0x305e7b,null))[_0x9ad9('0x29')](removeEntity(_0x305e7b,null))[_0x9ad9('0x4f')](handleError(_0x305e7b,null));};exports[_0x9ad9('0x51')]=function(_0x51888b,_0x2b801c){return db[_0x9ad9('0x4b')][_0x9ad9('0x51')]()[_0x9ad9('0x29')](respondWithResult(_0x2b801c,null))[_0x9ad9('0x4f')](handleError(_0x2b801c,null));};exports[_0x9ad9('0x52')]=function(_0xe94dea,_0x2ad920){var _0x5f0e37={},_0x1b2038={},_0x58d58b={'count':0x0,'rows':[]};_0x1b2038[_0x9ad9('0x38')]=_['keys'](db[_0x9ad9('0x4b')]['rawAttributes']);_0x1b2038[_0x9ad9('0x34')]=_['keys'](_0xe94dea[_0x9ad9('0x34')]);_0x1b2038[_0x9ad9('0x35')]=_[_0x9ad9('0x36')](_0x1b2038['model'],_0x1b2038['query']);_0x5f0e37['attributes']=_[_0x9ad9('0x36')](_0x1b2038[_0x9ad9('0x38')],qs['fields'](_0xe94dea[_0x9ad9('0x34')][_0x9ad9('0x39')]));_0x5f0e37[_0x9ad9('0x37')]=_0x5f0e37[_0x9ad9('0x37')][_0x9ad9('0x3a')]?_0x5f0e37['attributes']:_0x1b2038[_0x9ad9('0x38')];if(!_0xe94dea[_0x9ad9('0x34')][_0x9ad9('0x3b')](_0x9ad9('0x3c'))){_0x5f0e37[_0x9ad9('0x22')]=qs['limit'](_0xe94dea[_0x9ad9('0x34')]['limit']);_0x5f0e37['offset']=qs[_0x9ad9('0x23')](_0xe94dea[_0x9ad9('0x34')][_0x9ad9('0x23')]);}_0x5f0e37[_0x9ad9('0x3d')]=qs[_0x9ad9('0x3e')](_0xe94dea[_0x9ad9('0x34')][_0x9ad9('0x3e')]);_0x5f0e37[_0x9ad9('0x3f')]=qs[_0x9ad9('0x35')](_[_0x9ad9('0x40')](_0xe94dea[_0x9ad9('0x34')],_0x1b2038['filters']));if(_0xe94dea['query'][_0x9ad9('0x41')]){_0x5f0e37['where']=_[_0x9ad9('0x43')](_0x5f0e37['where'],{'$or':_[_0x9ad9('0x2f')](_0x5f0e37[_0x9ad9('0x37')],function(_0x49d3a4){var _0x3282fd={};_0x3282fd[_0x49d3a4]={'$like':'%'+_0xe94dea[_0x9ad9('0x34')][_0x9ad9('0x41')]+'%'};return _0x3282fd;})});}_0x5f0e37=_[_0x9ad9('0x43')]({},_0x5f0e37,_0xe94dea[_0x9ad9('0x44')]);var _0x5d3c55={'where':_0x5f0e37[_0x9ad9('0x3f')]};return db[_0x9ad9('0x4b')][_0x9ad9('0x24')](_0x5d3c55)[_0x9ad9('0x29')](function(_0x10adbb){_0x58d58b[_0x9ad9('0x24')]=_0x10adbb;if(_0xe94dea[_0x9ad9('0x34')]['includeAll']){_0x5f0e37['include']=[{'all':!![]}];}return db[_0x9ad9('0x4b')]['findAll'](_0x5f0e37);})['then'](function(_0x258876){_0x58d58b[_0x9ad9('0x47')]=_0x258876;return _0x58d58b;})[_0x9ad9('0x29')](respondWithFilteredResult(_0x2ad920,_0x5f0e37,_0x9ad9('0x52')))[_0x9ad9('0x4f')](handleError(_0x2ad920,null,_0x9ad9('0x52')));};
\ No newline at end of file
+var _0x5cdd=['filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where'];(function(_0x1242aa,_0x4d821c){var _0x3fd80a=function(_0x1928a0){while(--_0x1928a0){_0x1242aa['push'](_0x1242aa['shift']());}};_0x3fd80a(++_0x4d821c);}(_0x5cdd,0x159));var _0xd5cd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5cdd[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xd5cd('0x0'));var rimraf=require(_0xd5cd('0x1'));var zipdir=require(_0xd5cd('0x2'));var jsonpatch=require(_0xd5cd('0x3'));var rp=require(_0xd5cd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd5cd('0x5'));var path=require('path');var sox=require(_0xd5cd('0x6'));var csv=require(_0xd5cd('0x7'));var ejs=require(_0xd5cd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5cd('0x9'));var squel=require(_0xd5cd('0xa'));var crypto=require(_0xd5cd('0xb'));var jsforce=require(_0xd5cd('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd5cd('0xd'));var Redis=require(_0xd5cd('0xe'));var authService=require(_0xd5cd('0xf'));var qs=require(_0xd5cd('0x10'));var as=require(_0xd5cd('0x11'));var hardwareService=require(_0xd5cd('0x12'));var logger=require('../../config/logger')(_0xd5cd('0x13'));var utils=require(_0xd5cd('0x14'));var config=require(_0xd5cd('0x15'));var licenseUtil=require(_0xd5cd('0x16'));var db=require(_0xd5cd('0x17'))['db'];config['redis']=_[_0xd5cd('0x18')](config[_0xd5cd('0x19')],{'host':_0xd5cd('0x1a'),'port':0x18eb});var socket=require(_0xd5cd('0x1b'))(new Redis(config[_0xd5cd('0x19')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x17d241,_0x27f74f){_0x27f74f=_0x27f74f||0xcc;return function(_0x49cd45){if(_0x49cd45){return _0x17d241[_0xd5cd('0x1c')](_0x27f74f);}return _0x17d241['status'](_0x27f74f)[_0xd5cd('0x1d')]();};}function respondWithResult(_0x5501ec,_0x3f523a){_0x3f523a=_0x3f523a||0xc8;return function(_0x593977){if(_0x593977){return _0x5501ec[_0xd5cd('0x1e')](_0x3f523a)['json'](_0x593977);}};}function respondWithFilteredResult(_0x1751a1,_0x2c8244){return function(_0x4075a1){if(_0x4075a1){var _0x5c786b=typeof _0x2c8244[_0xd5cd('0x1f')]===_0xd5cd('0x20')&&typeof _0x2c8244[_0xd5cd('0x21')]==='undefined';var _0x4da442=_0x4075a1[_0xd5cd('0x22')];var _0xc8852b=_0x5c786b?0x0:_0x2c8244['offset'];var _0x3a5d8e=_0x5c786b?_0x4075a1['count']:_0x2c8244[_0xd5cd('0x1f')]+_0x2c8244['limit'];var _0x4ef334;if(_0x3a5d8e>=_0x4da442){_0x3a5d8e=_0x4da442;_0x4ef334=0xc8;}else{_0x4ef334=0xce;}_0x1751a1['status'](_0x4ef334);return _0x1751a1[_0xd5cd('0x23')]('Content-Range',_0xc8852b+'-'+_0x3a5d8e+'/'+_0x4da442)[_0xd5cd('0x24')](_0x4075a1);}return null;};}function patchUpdates(_0x5695ff){return function(_0x1c5d29){try{jsonpatch[_0xd5cd('0x25')](_0x1c5d29,_0x5695ff,!![]);}catch(_0x2456ff){return BPromise[_0xd5cd('0x26')](_0x2456ff);}return _0x1c5d29[_0xd5cd('0x27')]();};}function saveUpdates(_0x27b141,_0x49b30f){return function(_0x38c7a3){if(_0x38c7a3){return _0x38c7a3[_0xd5cd('0x28')](_0x27b141)[_0xd5cd('0x29')](function(_0x3cf726){return _0x3cf726;});}return null;};}function removeEntity(_0x7593e,_0xf9c7d4){return function(_0x22e987){if(_0x22e987){return _0x22e987[_0xd5cd('0x2a')]()[_0xd5cd('0x29')](function(){_0x7593e[_0xd5cd('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bccda,_0x411dc7){return function(_0x40a5c5){if(!_0x40a5c5){_0x5bccda[_0xd5cd('0x1c')](0x194);}return _0x40a5c5;};}function handleError(_0x5ab4a1,_0x4c2c47){_0x4c2c47=_0x4c2c47||0x1f4;return function(_0x5f2987){logger[_0xd5cd('0x2b')](_0x5f2987[_0xd5cd('0x2c')]);if(_0x5f2987[_0xd5cd('0x2d')]){delete _0x5f2987['name'];}_0x5ab4a1[_0xd5cd('0x1e')](_0x4c2c47)[_0xd5cd('0x2e')](_0x5f2987);};}exports['index']=function(_0x4ac594,_0x57704e){var _0x3f5aad={},_0xfa39e4={},_0x28d81f={'count':0x0,'rows':[]};var _0x54946b=_[_0xd5cd('0x2f')](db[_0xd5cd('0x30')][_0xd5cd('0x31')],function(_0x3c8d8e){return{'name':_0x3c8d8e[_0xd5cd('0x32')],'type':_0x3c8d8e[_0xd5cd('0x33')][_0xd5cd('0x34')]};});_0xfa39e4[_0xd5cd('0x35')]=_[_0xd5cd('0x2f')](_0x54946b,_0xd5cd('0x2d'));_0xfa39e4['query']=_[_0xd5cd('0x36')](_0x4ac594[_0xd5cd('0x37')]);_0xfa39e4[_0xd5cd('0x38')]=_[_0xd5cd('0x39')](_0xfa39e4[_0xd5cd('0x35')],_0xfa39e4[_0xd5cd('0x37')]);_0x3f5aad['attributes']=_['intersection'](_0xfa39e4[_0xd5cd('0x35')],qs[_0xd5cd('0x3a')](_0x4ac594[_0xd5cd('0x37')]['fields']));_0x3f5aad['attributes']=_0x3f5aad[_0xd5cd('0x3b')][_0xd5cd('0x3c')]?_0x3f5aad['attributes']:_0xfa39e4[_0xd5cd('0x35')];if(!_0x4ac594['query']['hasOwnProperty'](_0xd5cd('0x3d'))){_0x3f5aad[_0xd5cd('0x21')]=qs[_0xd5cd('0x21')](_0x4ac594[_0xd5cd('0x37')][_0xd5cd('0x21')]);_0x3f5aad[_0xd5cd('0x1f')]=qs['offset'](_0x4ac594[_0xd5cd('0x37')][_0xd5cd('0x1f')]);}_0x3f5aad[_0xd5cd('0x3e')]=qs[_0xd5cd('0x3f')](_0x4ac594[_0xd5cd('0x37')][_0xd5cd('0x3f')]);_0x3f5aad[_0xd5cd('0x40')]=qs[_0xd5cd('0x38')](_['pick'](_0x4ac594[_0xd5cd('0x37')],_0xfa39e4[_0xd5cd('0x38')]),_0x54946b);if(_0x4ac594[_0xd5cd('0x37')][_0xd5cd('0x41')]){_0x3f5aad[_0xd5cd('0x40')]=_[_0xd5cd('0x42')](_0x3f5aad[_0xd5cd('0x40')],{'$or':_['map'](_0x54946b,function(_0x4b0c2d){if(_0x4b0c2d[_0xd5cd('0x33')]!==_0xd5cd('0x43')){var _0x40838c={};_0x40838c[_0x4b0c2d['name']]={'$like':'%'+_0x4ac594[_0xd5cd('0x37')][_0xd5cd('0x41')]+'%'};return _0x40838c;}})});}_0x3f5aad=_[_0xd5cd('0x42')]({},_0x3f5aad,_0x4ac594[_0xd5cd('0x44')]);var _0x5e9ee9={'where':_0x3f5aad[_0xd5cd('0x40')]};return db[_0xd5cd('0x30')][_0xd5cd('0x22')](_0x5e9ee9)[_0xd5cd('0x29')](function(_0x38ac2d){_0x28d81f[_0xd5cd('0x22')]=_0x38ac2d;if(_0x4ac594['query'][_0xd5cd('0x45')]){_0x3f5aad[_0xd5cd('0x46')]=[{'all':!![]}];}return db[_0xd5cd('0x30')][_0xd5cd('0x47')](_0x3f5aad);})[_0xd5cd('0x29')](function(_0x1c0664){_0x28d81f['rows']=_0x1c0664;return _0x28d81f;})[_0xd5cd('0x29')](respondWithFilteredResult(_0x57704e,_0x3f5aad))[_0xd5cd('0x48')](handleError(_0x57704e,null));};exports[_0xd5cd('0x49')]=function(_0xc0f7b6,_0x417032){var _0x34e238={'raw':![],'where':{'id':_0xc0f7b6[_0xd5cd('0x4a')]['id']}},_0x51105a={};_0x51105a[_0xd5cd('0x35')]=_[_0xd5cd('0x36')](db[_0xd5cd('0x30')]['rawAttributes']);_0x51105a[_0xd5cd('0x37')]=_[_0xd5cd('0x36')](_0xc0f7b6[_0xd5cd('0x37')]);_0x51105a['filters']=_[_0xd5cd('0x39')](_0x51105a[_0xd5cd('0x35')],_0x51105a[_0xd5cd('0x37')]);_0x34e238['attributes']=_[_0xd5cd('0x39')](_0x51105a[_0xd5cd('0x35')],qs[_0xd5cd('0x3a')](_0xc0f7b6[_0xd5cd('0x37')][_0xd5cd('0x3a')]));_0x34e238[_0xd5cd('0x3b')]=_0x34e238[_0xd5cd('0x3b')][_0xd5cd('0x3c')]?_0x34e238['attributes']:_0x51105a[_0xd5cd('0x35')];if(_0xc0f7b6[_0xd5cd('0x37')][_0xd5cd('0x45')]){_0x34e238[_0xd5cd('0x46')]=[{'all':!![]}];}_0x34e238=_[_0xd5cd('0x42')]({},_0x34e238,_0xc0f7b6[_0xd5cd('0x44')]);return db[_0xd5cd('0x30')][_0xd5cd('0x4b')](_0x34e238)[_0xd5cd('0x29')](handleEntityNotFound(_0x417032,null))[_0xd5cd('0x29')](respondWithResult(_0x417032,null))[_0xd5cd('0x48')](handleError(_0x417032,null));};exports[_0xd5cd('0x4c')]=function(_0x583736,_0xe861aa){return db['VoiceQueueReport'][_0xd5cd('0x4c')](_0x583736[_0xd5cd('0x4d')],{})[_0xd5cd('0x29')](respondWithResult(_0xe861aa,0xc9))[_0xd5cd('0x48')](handleError(_0xe861aa,null));};exports[_0xd5cd('0x28')]=function(_0x5562c8,_0x3303d5){if(_0x5562c8[_0xd5cd('0x4d')]['id']){delete _0x5562c8[_0xd5cd('0x4d')]['id'];}return db['VoiceQueueReport'][_0xd5cd('0x4b')]({'where':{'id':_0x5562c8[_0xd5cd('0x4a')]['id']}})[_0xd5cd('0x29')](handleEntityNotFound(_0x3303d5,null))[_0xd5cd('0x29')](saveUpdates(_0x5562c8[_0xd5cd('0x4d')],null))[_0xd5cd('0x29')](respondWithResult(_0x3303d5,null))[_0xd5cd('0x48')](handleError(_0x3303d5,null));};exports[_0xd5cd('0x2a')]=function(_0x518610,_0xdc1c74){return db[_0xd5cd('0x30')][_0xd5cd('0x4b')]({'where':{'id':_0x518610[_0xd5cd('0x4a')]['id']}})[_0xd5cd('0x29')](handleEntityNotFound(_0xdc1c74,null))[_0xd5cd('0x29')](removeEntity(_0xdc1c74,null))[_0xd5cd('0x48')](handleError(_0xdc1c74,null));};exports['describe']=function(_0x12e596,_0x206678){return db['VoiceQueueReport'][_0xd5cd('0x4e')]()[_0xd5cd('0x29')](respondWithResult(_0x206678,null))[_0xd5cd('0x48')](handleError(_0x206678,null));};exports[_0xd5cd('0x4f')]=function(_0x2d12ad,_0x593c63){var _0x5c61b1={},_0x399998={},_0x2c4b0d={'count':0x0,'rows':[]};_0x399998[_0xd5cd('0x35')]=_[_0xd5cd('0x36')](db['VoiceQueueReport'][_0xd5cd('0x31')]);_0x399998[_0xd5cd('0x37')]=_[_0xd5cd('0x36')](_0x2d12ad[_0xd5cd('0x37')]);_0x399998[_0xd5cd('0x38')]=_[_0xd5cd('0x39')](_0x399998[_0xd5cd('0x35')],_0x399998['query']);_0x5c61b1[_0xd5cd('0x3b')]=_['intersection'](_0x399998[_0xd5cd('0x35')],qs[_0xd5cd('0x3a')](_0x2d12ad[_0xd5cd('0x37')]['fields']));_0x5c61b1[_0xd5cd('0x3b')]=_0x5c61b1[_0xd5cd('0x3b')][_0xd5cd('0x3c')]?_0x5c61b1['attributes']:_0x399998[_0xd5cd('0x35')];if(!_0x2d12ad[_0xd5cd('0x37')][_0xd5cd('0x50')](_0xd5cd('0x3d'))){_0x5c61b1[_0xd5cd('0x21')]=qs[_0xd5cd('0x21')](_0x2d12ad['query'][_0xd5cd('0x21')]);_0x5c61b1[_0xd5cd('0x1f')]=qs[_0xd5cd('0x1f')](_0x2d12ad[_0xd5cd('0x37')][_0xd5cd('0x1f')]);}_0x5c61b1[_0xd5cd('0x3e')]=qs[_0xd5cd('0x3f')](_0x2d12ad[_0xd5cd('0x37')][_0xd5cd('0x3f')]);_0x5c61b1['where']=qs[_0xd5cd('0x38')](_['pick'](_0x2d12ad[_0xd5cd('0x37')],_0x399998[_0xd5cd('0x38')]));if(_0x2d12ad[_0xd5cd('0x37')][_0xd5cd('0x41')]){_0x5c61b1['where']=_[_0xd5cd('0x42')](_0x5c61b1[_0xd5cd('0x40')],{'$or':_[_0xd5cd('0x2f')](_0x5c61b1[_0xd5cd('0x3b')],function(_0x40a0c5){var _0x161be9={};_0x161be9[_0x40a0c5]={'$like':'%'+_0x2d12ad[_0xd5cd('0x37')][_0xd5cd('0x41')]+'%'};return _0x161be9;})});}_0x5c61b1=_['merge']({},_0x5c61b1,_0x2d12ad[_0xd5cd('0x44')]);var _0x24b5f8={'where':_0x5c61b1['where']};return db[_0xd5cd('0x30')][_0xd5cd('0x22')](_0x24b5f8)[_0xd5cd('0x29')](function(_0x542ddc){_0x2c4b0d[_0xd5cd('0x22')]=_0x542ddc;if(_0x2d12ad['query'][_0xd5cd('0x45')]){_0x5c61b1[_0xd5cd('0x46')]=[{'all':!![]}];}return db[_0xd5cd('0x30')][_0xd5cd('0x47')](_0x5c61b1);})[_0xd5cd('0x29')](function(_0x20210e){_0x2c4b0d[_0xd5cd('0x51')]=_0x20210e;return _0x2c4b0d;})[_0xd5cd('0x29')](respondWithFilteredResult(_0x593c63,_0x5c61b1,'getVoiceQueuesReport'))[_0xd5cd('0x48')](handleError(_0x593c63,null,'getVoiceQueuesReport'));};
\ No newline at end of file
index dcce9ed..34eb6aa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd555=['VoiceQueueReport','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x25e184,_0x4b4f16){var _0x5b14f6=function(_0x3efa19){while(--_0x3efa19){_0x25e184['push'](_0x25e184['shift']());}};_0x5b14f6(++_0x4b4f16);}(_0xd555,0xef));var _0x5d55=function(_0x2e1777,_0x1f056a){_0x2e1777=_0x2e1777-0x0;var _0x35628f=_0xd555[_0x2e1777];return _0x35628f;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x5d55('0x0'))['db'][_0x5d55('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5d55('0x2'),'afterDestroy':_0x5d55('0x3')};function emitEvent(_0x4cffc9){return function(_0x3b0633,_0x3bc1b9,_0xf7804e){VoiceQueueReportEvents[_0x5d55('0x4')](_0x4cffc9+':'+_0x3b0633['id'],_0x3b0633);VoiceQueueReportEvents[_0x5d55('0x4')](_0x4cffc9,_0x3b0633);_0xf7804e(null);};}for(var e in events){if(events[_0x5d55('0x5')](e)){var event=events[e];VoiceQueueReport[_0x5d55('0x6')](e,emitEvent(event));}}module[_0x5d55('0x7')]=VoiceQueueReportEvents;
\ No newline at end of file
+var _0x2d65=['remove','emit','hook','exports','events','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x73ba5,_0x2c2ae7){var _0x5ab252=function(_0x48d75f){while(--_0x48d75f){_0x73ba5['push'](_0x73ba5['shift']());}};_0x5ab252(++_0x2c2ae7);}(_0x2d65,0xe5));var _0x52d6=function(_0xc668cf,_0x4ac6d1){_0xc668cf=_0xc668cf-0x0;var _0x1451aa=_0x2d65[_0xc668cf];return _0x1451aa;};'use strict';var EventEmitter=require(_0x52d6('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x52d6('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x52d6('0x2')](0x0);var events={'afterCreate':_0x52d6('0x3'),'afterUpdate':_0x52d6('0x4'),'afterDestroy':_0x52d6('0x5')};function emitEvent(_0x85ba85){return function(_0x3c195f,_0x491e5e,_0x26f49e){VoiceQueueReportEvents[_0x52d6('0x6')](_0x85ba85+':'+_0x3c195f['id'],_0x3c195f);VoiceQueueReportEvents[_0x52d6('0x6')](_0x85ba85,_0x3c195f);_0x26f49e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x52d6('0x7')](e,emitEvent(event));}}module[_0x52d6('0x8')]=VoiceQueueReportEvents;
\ No newline at end of file
index 059e243..28bf213 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0c85=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceQueueReport','uniqueid','calleridnum','lodash','util'];(function(_0x211643,_0x4d5082){var _0xd72259=function(_0x2a3eb1){while(--_0x2a3eb1){_0x211643['push'](_0x211643['shift']());}};_0xd72259(++_0x4d5082);}(_0x0c85,0x1b0));var _0x50c8=function(_0x570a01,_0x86669){_0x570a01=_0x570a01-0x0;var _0x979a39=_0x0c85[_0x570a01];return _0x979a39;};'use strict';var _=require(_0x50c8('0x0'));var util=require(_0x50c8('0x1'));var logger=require(_0x50c8('0x2'))(_0x50c8('0x3'));var moment=require(_0x50c8('0x4'));var BPromise=require(_0x50c8('0x5'));var rp=require(_0x50c8('0x6'));var fs=require('fs');var path=require(_0x50c8('0x7'));var rimraf=require('rimraf');var config=require(_0x50c8('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x50c8('0x9')]=function(_0x5ece0b,_0x2a038d){return _0x5ece0b[_0x50c8('0xa')](_0x50c8('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x50c8('0xc')]},{'fields':[_0x50c8('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x8398=['bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','util','../../config/logger','api','moment'];(function(_0x463ac4,_0x484ef7){var _0x3c1d12=function(_0x80a0){while(--_0x80a0){_0x463ac4['push'](_0x463ac4['shift']());}};_0x3c1d12(++_0x484ef7);}(_0x8398,0x158));var _0x8839=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x8398[_0x1203f];return _0x365f0a;};'use strict';var _=require('lodash');var util=require(_0x8839('0x0'));var logger=require(_0x8839('0x1'))(_0x8839('0x2'));var moment=require(_0x8839('0x3'));var BPromise=require(_0x8839('0x4'));var rp=require(_0x8839('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8839('0x6'));var config=require(_0x8839('0x7'));var attributes=require(_0x8839('0x8'));module[_0x8839('0x9')]=function(_0x188501,_0x591dc8){return _0x188501['define'](_0x8839('0xa'),attributes,{'tableName':_0x8839('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});};
\ No newline at end of file
index 25de2c2..02fc0af 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4f76=['info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','options','raw','where','attributes','limit','map','include','model','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','create','UpdateVoiceQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','./voiceQueueReport.socket','register','request','then'];(function(_0x3a5fdd,_0x410065){var _0x46fcd6=function(_0x565738){while(--_0x565738){_0x3a5fdd['push'](_0x3a5fdd['shift']());}};_0x46fcd6(++_0x410065);}(_0x4f76,0x19d));var _0x64f7=function(_0x4b4b0e,_0x6c674){_0x4b4b0e=_0x4b4b0e-0x0;var _0x4c2d91=_0x4f76[_0x4b4b0e];return _0x4c2d91;};'use strict';var _=require(_0x64f7('0x0'));var util=require(_0x64f7('0x1'));var moment=require(_0x64f7('0x2'));var BPromise=require(_0x64f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64f7('0x4'));var db=require(_0x64f7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x64f7('0x6'));var config=require('../../config/environment');var jayson=require(_0x64f7('0x7'));var client=jayson[_0x64f7('0x8')][_0x64f7('0x9')]({'port':0x232a});config[_0x64f7('0xa')]=_[_0x64f7('0xb')](config[_0x64f7('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x64f7('0xa')]));require(_0x64f7('0xc'))[_0x64f7('0xd')](socket);function respondWithRpcPromise(_0x3c90a2,_0x596fff,_0x2ec6e7){return new BPromise(function(_0xbe3ace,_0x1193b4){return client[_0x64f7('0xe')](_0x3c90a2,_0x2ec6e7)[_0x64f7('0xf')](function(_0x3f4f14){logger[_0x64f7('0x10')](_0x64f7('0x11'),_0x596fff,_0x64f7('0x12'));logger[_0x64f7('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x596fff,'request\x20sent',JSON[_0x64f7('0x14')](_0x3f4f14));if(_0x3f4f14[_0x64f7('0x15')]){if(_0x3f4f14[_0x64f7('0x15')][_0x64f7('0x16')]===0x1f4){logger['error'](_0x64f7('0x11'),_0x596fff,_0x3f4f14['error'][_0x64f7('0x17')]);return _0x1193b4(_0x3f4f14['error']['message']);}logger[_0x64f7('0x15')](_0x64f7('0x11'),_0x596fff,_0x3f4f14[_0x64f7('0x15')][_0x64f7('0x17')]);return _0xbe3ace(_0x3f4f14['error']['message']);}else{logger[_0x64f7('0x10')](_0x64f7('0x11'),_0x596fff,_0x64f7('0x12'));_0xbe3ace(_0x3f4f14[_0x64f7('0x18')][_0x64f7('0x17')]);}})[_0x64f7('0x19')](function(_0x354e74){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x596fff,_0x354e74);_0x1193b4(_0x354e74);});});}exports['GetVoiceQueueReport']=function(_0x476bb5){var _0x567a57=this;return new Promise(function(_0xc0cadf,_0x1a9b9c){return db['VoiceQueueReport']['findAll']({'raw':_0x476bb5[_0x64f7('0x1a')]?_0x476bb5['options'][_0x64f7('0x1b')]===undefined?!![]:![]:!![],'where':_0x476bb5[_0x64f7('0x1a')]?_0x476bb5['options'][_0x64f7('0x1c')]||null:null,'attributes':_0x476bb5[_0x64f7('0x1a')]?_0x476bb5[_0x64f7('0x1a')][_0x64f7('0x1d')]||null:null,'limit':_0x476bb5[_0x64f7('0x1a')]?_0x476bb5[_0x64f7('0x1a')][_0x64f7('0x1e')]||null:null,'include':_0x476bb5[_0x64f7('0x1a')]?_0x476bb5[_0x64f7('0x1a')]['include']?_[_0x64f7('0x1f')](_0x476bb5[_0x64f7('0x1a')][_0x64f7('0x20')],function(_0x50ceee){return{'model':db[_0x50ceee[_0x64f7('0x21')]],'as':_0x50ceee['as'],'attributes':_0x50ceee[_0x64f7('0x1d')],'include':_0x50ceee[_0x64f7('0x20')]?_[_0x64f7('0x1f')](_0x50ceee[_0x64f7('0x20')],function(_0x3608e6){return{'model':db[_0x3608e6[_0x64f7('0x21')]],'as':_0x3608e6['as'],'attributes':_0x3608e6['attributes'],'include':_0x3608e6[_0x64f7('0x20')]?_[_0x64f7('0x1f')](_0x3608e6['include'],function(_0x14e2fe){return{'model':db[_0x14e2fe[_0x64f7('0x21')]],'as':_0x14e2fe['as'],'attributes':_0x14e2fe[_0x64f7('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a6c64){logger[_0x64f7('0x10')](_0x64f7('0x22'),_0x476bb5);logger[_0x64f7('0x13')]('GetVoiceQueueReport',_0x476bb5,JSON['stringify'](_0x3a6c64));_0xc0cadf(_0x3a6c64);})[_0x64f7('0x19')](function(_0x5ab372){logger[_0x64f7('0x15')](_0x64f7('0x22'),_0x5ab372[_0x64f7('0x17')],_0x476bb5);_0x1a9b9c(_0x567a57[_0x64f7('0x15')](0x1f4,_0x5ab372[_0x64f7('0x17')]));});});};exports[_0x64f7('0x23')]=function(_0x16bd95){var _0x51e7d9=this;return new Promise(function(_0xc69da3,_0xf28113){return db[_0x64f7('0x24')][_0x64f7('0x25')](_0x16bd95['body'],{'raw':_0x16bd95[_0x64f7('0x1a')]?_0x16bd95[_0x64f7('0x1a')][_0x64f7('0x1b')]===undefined?!![]:![]:!![]})[_0x64f7('0xf')](function(_0x46bc7c){logger['info']('CreateVoiceQueueReport',_0x16bd95);logger[_0x64f7('0x13')]('CreateVoiceQueueReport',_0x16bd95,JSON[_0x64f7('0x14')](_0x46bc7c));_0xc69da3(_0x46bc7c);})[_0x64f7('0x19')](function(_0x1f78ae){logger['error'](_0x64f7('0x23'),_0x1f78ae[_0x64f7('0x17')],_0x16bd95);_0xf28113(_0x51e7d9[_0x64f7('0x15')](0x1f4,_0x1f78ae[_0x64f7('0x17')]));});});};exports[_0x64f7('0x26')]=function(_0x5ecb46){var _0x2471ab=this;return new Promise(function(_0x4d9f6d,_0x1440c4){return db[_0x64f7('0x24')]['update'](_0x5ecb46['body'],{'raw':_0x5ecb46[_0x64f7('0x1a')]?_0x5ecb46[_0x64f7('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ecb46[_0x64f7('0x1a')]?_0x5ecb46[_0x64f7('0x1a')][_0x64f7('0x1c')]||null:null,'attributes':_0x5ecb46[_0x64f7('0x1a')]?_0x5ecb46[_0x64f7('0x1a')][_0x64f7('0x1d')]||null:null,'limit':_0x5ecb46[_0x64f7('0x1a')]?_0x5ecb46[_0x64f7('0x1a')][_0x64f7('0x1e')]||null:null})[_0x64f7('0xf')](function(_0xc86259){logger[_0x64f7('0x10')]('UpdateVoiceQueueReport',_0x5ecb46);logger[_0x64f7('0x13')]('UpdateVoiceQueueReport',_0x5ecb46,JSON[_0x64f7('0x14')](_0xc86259));_0x4d9f6d(_0xc86259);})[_0x64f7('0x19')](function(_0x512a9c){logger['error'](_0x64f7('0x26'),_0x512a9c[_0x64f7('0x17')],_0x5ecb46);_0x1440c4(_0x2471ab[_0x64f7('0x15')](0x1f4,_0x512a9c[_0x64f7('0x17')]));});});};
\ No newline at end of file
+var _0x7a10=['UpdateVoiceQueueReport','VoiceQueueReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceQueueReport','findAll','options','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','raw','catch'];(function(_0x37ce06,_0xe005fe){var _0x56599b=function(_0x563400){while(--_0x563400){_0x37ce06['push'](_0x37ce06['shift']());}};_0x56599b(++_0xe005fe);}(_0x7a10,0x190));var _0x07a1=function(_0x659cf2,_0x1f77e7){_0x659cf2=_0x659cf2-0x0;var _0x43d5ee=_0x7a10[_0x659cf2];return _0x43d5ee;};'use strict';var _=require(_0x07a1('0x0'));var util=require(_0x07a1('0x1'));var moment=require(_0x07a1('0x2'));var BPromise=require(_0x07a1('0x3'));var rs=require(_0x07a1('0x4'));var fs=require('fs');var Redis=require(_0x07a1('0x5'));var db=require(_0x07a1('0x6'))['db'];var utils=require(_0x07a1('0x7'));var logger=require(_0x07a1('0x8'))(_0x07a1('0x9'));var config=require(_0x07a1('0xa'));var jayson=require(_0x07a1('0xb'));var client=jayson[_0x07a1('0xc')]['http']({'port':0x232a});config[_0x07a1('0xd')]=_[_0x07a1('0xe')](config[_0x07a1('0xd')],{'host':_0x07a1('0xf'),'port':0x18eb});var socket=require(_0x07a1('0x10'))(new Redis(config[_0x07a1('0xd')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x51892b,_0x44ea31,_0x2d6b88){return new BPromise(function(_0xa199c0,_0x498e3a){return client['request'](_0x51892b,_0x2d6b88)[_0x07a1('0x11')](function(_0x4fe423){logger[_0x07a1('0x12')](_0x07a1('0x13'),_0x44ea31,_0x07a1('0x14'));logger[_0x07a1('0x15')](_0x07a1('0x16'),_0x44ea31,'request\x20sent',JSON[_0x07a1('0x17')](_0x4fe423));if(_0x4fe423[_0x07a1('0x18')]){if(_0x4fe423[_0x07a1('0x18')][_0x07a1('0x19')]===0x1f4){logger[_0x07a1('0x18')](_0x07a1('0x13'),_0x44ea31,_0x4fe423['error'][_0x07a1('0x1a')]);return _0x498e3a(_0x4fe423[_0x07a1('0x18')][_0x07a1('0x1a')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x44ea31,_0x4fe423[_0x07a1('0x18')][_0x07a1('0x1a')]);return _0xa199c0(_0x4fe423['error'][_0x07a1('0x1a')]);}else{logger[_0x07a1('0x12')](_0x07a1('0x13'),_0x44ea31,_0x07a1('0x14'));_0xa199c0(_0x4fe423['result'][_0x07a1('0x1a')]);}})['catch'](function(_0xaab60c){logger['error'](_0x07a1('0x13'),_0x44ea31,_0xaab60c);_0x498e3a(_0xaab60c);});});}exports[_0x07a1('0x1b')]=function(_0x1c66be){var _0x375cd3=this;return new Promise(function(_0x520f4e,_0x5897eb){return db['VoiceQueueReport'][_0x07a1('0x1c')]({'raw':_0x1c66be[_0x07a1('0x1d')]?_0x1c66be[_0x07a1('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1c66be[_0x07a1('0x1d')]?_0x1c66be[_0x07a1('0x1d')]['where']||null:null,'attributes':_0x1c66be[_0x07a1('0x1d')]?_0x1c66be[_0x07a1('0x1d')][_0x07a1('0x1e')]||null:null,'limit':_0x1c66be[_0x07a1('0x1d')]?_0x1c66be[_0x07a1('0x1d')][_0x07a1('0x1f')]||null:null,'include':_0x1c66be['options']?_0x1c66be[_0x07a1('0x1d')][_0x07a1('0x20')]?_[_0x07a1('0x21')](_0x1c66be['options'][_0x07a1('0x20')],function(_0x36060b){return{'model':db[_0x36060b[_0x07a1('0x22')]],'as':_0x36060b['as'],'attributes':_0x36060b[_0x07a1('0x1e')],'include':_0x36060b['include']?_[_0x07a1('0x21')](_0x36060b[_0x07a1('0x20')],function(_0x31c6ca){return{'model':db[_0x31c6ca[_0x07a1('0x22')]],'as':_0x31c6ca['as'],'attributes':_0x31c6ca[_0x07a1('0x1e')],'include':_0x31c6ca[_0x07a1('0x20')]?_[_0x07a1('0x21')](_0x31c6ca[_0x07a1('0x20')],function(_0x350faa){return{'model':db[_0x350faa[_0x07a1('0x22')]],'as':_0x350faa['as'],'attributes':_0x350faa['attributes']};}):[]};}):[]};}):[]:[]})[_0x07a1('0x11')](function(_0x35c3ee){logger[_0x07a1('0x12')](_0x07a1('0x1b'),_0x1c66be);logger['debug'](_0x07a1('0x1b'),_0x1c66be,JSON[_0x07a1('0x17')](_0x35c3ee));_0x520f4e(_0x35c3ee);})['catch'](function(_0x20fe00){logger[_0x07a1('0x18')](_0x07a1('0x1b'),_0x20fe00['message'],_0x1c66be);_0x5897eb(_0x375cd3['error'](0x1f4,_0x20fe00['message']));});});};exports[_0x07a1('0x23')]=function(_0x521afa){var _0x8de3ce=this;return new Promise(function(_0x35350f,_0x3440b3){return db['VoiceQueueReport'][_0x07a1('0x24')](_0x521afa[_0x07a1('0x25')],{'raw':_0x521afa['options']?_0x521afa[_0x07a1('0x1d')][_0x07a1('0x26')]===undefined?!![]:![]:!![]})[_0x07a1('0x11')](function(_0x38efad){logger[_0x07a1('0x12')]('CreateVoiceQueueReport',_0x521afa);logger['debug'](_0x07a1('0x23'),_0x521afa,JSON[_0x07a1('0x17')](_0x38efad));_0x35350f(_0x38efad);})[_0x07a1('0x27')](function(_0x560aa8){logger[_0x07a1('0x18')](_0x07a1('0x23'),_0x560aa8[_0x07a1('0x1a')],_0x521afa);_0x3440b3(_0x8de3ce[_0x07a1('0x18')](0x1f4,_0x560aa8[_0x07a1('0x1a')]));});});};exports[_0x07a1('0x28')]=function(_0x33563a){var _0xe4ca21=this;return new Promise(function(_0x5ae6c2,_0x33fe5c){return db[_0x07a1('0x29')][_0x07a1('0x2a')](_0x33563a[_0x07a1('0x25')],{'raw':_0x33563a[_0x07a1('0x1d')]?_0x33563a[_0x07a1('0x1d')][_0x07a1('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33563a[_0x07a1('0x1d')]?_0x33563a['options'][_0x07a1('0x2b')]||null:null,'attributes':_0x33563a[_0x07a1('0x1d')]?_0x33563a['options']['attributes']||null:null,'limit':_0x33563a['options']?_0x33563a[_0x07a1('0x1d')][_0x07a1('0x1f')]||null:null})[_0x07a1('0x11')](function(_0x30af84){logger[_0x07a1('0x12')](_0x07a1('0x28'),_0x33563a);logger[_0x07a1('0x15')](_0x07a1('0x28'),_0x33563a,JSON[_0x07a1('0x17')](_0x30af84));_0x5ae6c2(_0x30af84);})[_0x07a1('0x27')](function(_0x56c9fd){logger[_0x07a1('0x18')](_0x07a1('0x28'),_0x56c9fd[_0x07a1('0x1a')],_0x33563a);_0x33fe5c(_0xe4ca21[_0x07a1('0x18')](0x1f4,_0x56c9fd['message']));});});};
\ No newline at end of file
index 2a3fe73..b4fe001 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x37a7=['voiceQueueReport:','./voiceQueueReport.events','save','removeListener','register'];(function(_0x4dcecc,_0x3865b9){var _0x2aa658=function(_0x334d85){while(--_0x334d85){_0x4dcecc['push'](_0x4dcecc['shift']());}};_0x2aa658(++_0x3865b9);}(_0x37a7,0x6f));var _0x737a=function(_0x26d544,_0x4a16ac){_0x26d544=_0x26d544-0x0;var _0x139daa=_0x37a7[_0x26d544];return _0x139daa;};'use strict';var VoiceQueueReportEvents=require(_0x737a('0x0'));var events=[_0x737a('0x1'),'remove','update'];function createListener(_0x5a259b,_0x2d4b54){return function(_0xc5eaef){_0x2d4b54['emit'](_0x5a259b,_0xc5eaef);};}function removeListener(_0x524516,_0x4af128){return function(){VoiceQueueReportEvents[_0x737a('0x2')](_0x524516,_0x4af128);};}exports[_0x737a('0x3')]=function(_0x7f4eed){for(var _0x11109c=0x0,_0x2f6800=events['length'];_0x11109c<_0x2f6800;_0x11109c++){var _0x244850=events[_0x11109c];var _0x249898=createListener(_0x737a('0x4')+_0x244850,_0x7f4eed);VoiceQueueReportEvents['on'](_0x244850,_0x249898);}};
\ No newline at end of file
+var _0x1db9=['remove','update','emit','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0xeddadb,_0x155711){var _0x1c5b15=function(_0x3fd5c6){while(--_0x3fd5c6){_0xeddadb['push'](_0xeddadb['shift']());}};_0x1c5b15(++_0x155711);}(_0x1db9,0x176));var _0x91db=function(_0x33f673,_0x434978){_0x33f673=_0x33f673-0x0;var _0x13b2f8=_0x1db9[_0x33f673];return _0x13b2f8;};'use strict';var VoiceQueueReportEvents=require(_0x91db('0x0'));var events=[_0x91db('0x1'),_0x91db('0x2'),_0x91db('0x3')];function createListener(_0xcdfaed,_0xb6de0b){return function(_0x49b8c5){_0xb6de0b[_0x91db('0x4')](_0xcdfaed,_0x49b8c5);};}function removeListener(_0x42ae75,_0x59c944){return function(){VoiceQueueReportEvents['removeListener'](_0x42ae75,_0x59c944);};}exports[_0x91db('0x5')]=function(_0x4b3f5c){for(var _0x5e69d9=0x0,_0x433c75=events[_0x91db('0x6')];_0x5e69d9<_0x433c75;_0x5e69d9++){var _0x45fea0=events[_0x5e69d9];var _0x2330c2=createListener(_0x91db('0x7')+_0x45fea0,_0x4b3f5c);VoiceQueueReportEvents['on'](_0x45fea0,_0x2330c2);}};
\ No newline at end of file
index af94dc6..fc858bd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb2be=['destroy','exports','multer','path','connect-timeout','fs-extra','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','show','create','put','/:id','delete'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xb2be,0xb2));var _0xeb2b=function(_0xcf807,_0x4c736b){_0xcf807=_0xcf807-0x0;var _0x2ef9e9=_0xb2be[_0xcf807];return _0x2ef9e9;};'use strict';var multer=require(_0xeb2b('0x0'));var util=require('util');var path=require(_0xeb2b('0x1'));var timeout=require(_0xeb2b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xeb2b('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xeb2b('0x4'));var controller=require(_0xeb2b('0x5'));router[_0xeb2b('0x6')]('/',auth[_0xeb2b('0x7')](),controller[_0xeb2b('0x8')]);router[_0xeb2b('0x6')]('/:id',auth[_0xeb2b('0x7')](),controller[_0xeb2b('0x9')]);router['post']('/',auth[_0xeb2b('0x7')](),controller[_0xeb2b('0xa')]);router[_0xeb2b('0xb')](_0xeb2b('0xc'),auth[_0xeb2b('0x7')](),controller['update']);router[_0xeb2b('0xd')](_0xeb2b('0xc'),auth[_0xeb2b('0x7')](),controller[_0xeb2b('0xe')]);module[_0xeb2b('0xf')]=router;
\ No newline at end of file
+var _0x08ce=['isAuthenticated','index','get','post','create','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller'];(function(_0x4b1c7b,_0x533a9c){var _0x5a87d7=function(_0x5e8731){while(--_0x5e8731){_0x4b1c7b['push'](_0x4b1c7b['shift']());}};_0x5a87d7(++_0x533a9c);}(_0x08ce,0x86));var _0xe08c=function(_0x38133c,_0x2748cb){_0x38133c=_0x38133c-0x0;var _0x39bdde=_0x08ce[_0x38133c];return _0x39bdde;};'use strict';var multer=require(_0xe08c('0x0'));var util=require(_0xe08c('0x1'));var path=require(_0xe08c('0x2'));var timeout=require(_0xe08c('0x3'));var express=require(_0xe08c('0x4'));var router=express[_0xe08c('0x5')]();var fs_extra=require(_0xe08c('0x6'));var auth=require(_0xe08c('0x7'));var interaction=require(_0xe08c('0x8'));var config=require('../../config/environment');var controller=require(_0xe08c('0x9'));router['get']('/',auth[_0xe08c('0xa')](),controller[_0xe08c('0xb')]);router[_0xe08c('0xc')]('/:id',auth[_0xe08c('0xa')](),controller['show']);router[_0xe08c('0xd')]('/',auth[_0xe08c('0xa')](),controller[_0xe08c('0xe')]);router['put'](_0xe08c('0xf'),auth[_0xe08c('0xa')](),controller['update']);router['delete'](_0xe08c('0xf'),auth[_0xe08c('0xa')](),controller[_0xe08c('0x10')]);module[_0xe08c('0x11')]=router;
\ No newline at end of file
index 87160f3..015610a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa613=['moment','exports','STRING','DATE','format'];(function(_0x4a727b,_0x396546){var _0x299581=function(_0x23fb9b){while(--_0x23fb9b){_0x4a727b['push'](_0x4a727b['shift']());}};_0x299581(++_0x396546);}(_0xa613,0x18b));var _0x3a61=function(_0x291276,_0x5a4690){_0x291276=_0x291276-0x0;var _0x303ab3=_0xa613[_0x291276];return _0x303ab3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3a61('0x0'));module[_0x3a61('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x3a61('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x3a61('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x3a61('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x3a61('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x3a61('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x3a61('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x3a61('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x3a61('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x3a61('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x3a61('0x3')],'allowNull':![],'defaultValue':moment()[_0x3a61('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}};
\ No newline at end of file
+var _0x36c3=['DATE','format','sequelize','moment','STRING'];(function(_0x5bccfa,_0x5cecbd){var _0x5f3e8c=function(_0x21f69c){while(--_0x21f69c){_0x5bccfa['push'](_0x5bccfa['shift']());}};_0x5f3e8c(++_0x5cecbd);}(_0x36c3,0x1a6));var _0x336c=function(_0x4081a5,_0x27e9e2){_0x4081a5=_0x4081a5-0x0;var _0x59f5d9=_0x36c3[_0x4081a5];return _0x59f5d9;};'use strict';var Sequelize=require(_0x336c('0x0'));var moment=require(_0x336c('0x1'));module['exports']={'time':{'type':Sequelize[_0x336c('0x2')]},'callid':{'type':Sequelize[_0x336c('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x336c('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x336c('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x336c('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x336c('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x336c('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x336c('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x336c('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x336c('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x336c('0x3')],'allowNull':![],'defaultValue':moment()[_0x336c('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}};
\ No newline at end of file
index 5275f42..deb15e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd271=['create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','send','index','map','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueuesLog','include','findAll','rows','catch','params','length','options','find'];(function(_0xb54ffa,_0x31d47f){var _0x5294a0=function(_0x3be538){while(--_0x3be538){_0xb54ffa['push'](_0xb54ffa['shift']());}};_0x5294a0(++_0x31d47f);}(_0xd271,0x1d1));var _0x1d27=function(_0x159329,_0x1219db){_0x159329=_0x159329-0x0;var _0x48b32c=_0xd271[_0x159329];return _0x48b32c;};'use strict';var emlformat=require(_0x1d27('0x0'));var rimraf=require(_0x1d27('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d27('0x2'));var rp=require(_0x1d27('0x3'));var moment=require(_0x1d27('0x4'));var BPromise=require(_0x1d27('0x5'));var Mustache=require(_0x1d27('0x6'));var util=require('util');var path=require(_0x1d27('0x7'));var sox=require(_0x1d27('0x8'));var csv=require(_0x1d27('0x9'));var ejs=require(_0x1d27('0xa'));var fs=require('fs');var fs_extra=require(_0x1d27('0xb'));var _=require(_0x1d27('0xc'));var squel=require('squel');var crypto=require(_0x1d27('0xd'));var jsforce=require(_0x1d27('0xe'));var deskjs=require(_0x1d27('0xf'));var toCsv=require(_0x1d27('0x9'));var querystring=require('querystring');var Papa=require(_0x1d27('0x10'));var Redis=require('ioredis');var authService=require(_0x1d27('0x11'));var qs=require(_0x1d27('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d27('0x13'));var logger=require('../../config/logger')(_0x1d27('0x14'));var utils=require(_0x1d27('0x15'));var config=require(_0x1d27('0x16'));var licenseUtil=require(_0x1d27('0x17'));var db=require(_0x1d27('0x18'))['db'];function respondWithStatusCode(_0x3518fe,_0x4204d0){_0x4204d0=_0x4204d0||0xcc;return function(_0x11d0f3){if(_0x11d0f3){return _0x3518fe[_0x1d27('0x19')](_0x4204d0);}return _0x3518fe[_0x1d27('0x1a')](_0x4204d0)[_0x1d27('0x1b')]();};}function respondWithResult(_0x1baf87,_0x40bee9){_0x40bee9=_0x40bee9||0xc8;return function(_0x5b60f7){if(_0x5b60f7){return _0x1baf87['status'](_0x40bee9)[_0x1d27('0x1c')](_0x5b60f7);}};}function respondWithFilteredResult(_0x1c91f9,_0x5bd9e1){return function(_0xb66f10){if(_0xb66f10){var _0x51641f=typeof _0x5bd9e1['offset']===_0x1d27('0x1d')&&typeof _0x5bd9e1[_0x1d27('0x1e')]===_0x1d27('0x1d');var _0x3fb331=_0xb66f10[_0x1d27('0x1f')];var _0x499952=_0x51641f?0x0:_0x5bd9e1[_0x1d27('0x20')];var _0x425f19=_0x51641f?_0xb66f10[_0x1d27('0x1f')]:_0x5bd9e1[_0x1d27('0x20')]+_0x5bd9e1['limit'];var _0x3a55be;if(_0x425f19>=_0x3fb331){_0x425f19=_0x3fb331;_0x3a55be=0xc8;}else{_0x3a55be=0xce;}_0x1c91f9[_0x1d27('0x1a')](_0x3a55be);return _0x1c91f9[_0x1d27('0x21')](_0x1d27('0x22'),_0x499952+'-'+_0x425f19+'/'+_0x3fb331)[_0x1d27('0x1c')](_0xb66f10);}return null;};}function patchUpdates(_0xe57d32){return function(_0x5ba802){try{jsonpatch[_0x1d27('0x23')](_0x5ba802,_0xe57d32,!![]);}catch(_0x4f4d47){return BPromise[_0x1d27('0x24')](_0x4f4d47);}return _0x5ba802[_0x1d27('0x25')]();};}function saveUpdates(_0x2e6a1a,_0x376793){return function(_0x3be984){if(_0x3be984){return _0x3be984['update'](_0x2e6a1a)[_0x1d27('0x26')](function(_0x92c692){return _0x92c692;});}return null;};}function removeEntity(_0x295038,_0x5d32b8){return function(_0x5b1570){if(_0x5b1570){return _0x5b1570[_0x1d27('0x27')]()[_0x1d27('0x26')](function(){_0x295038[_0x1d27('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c3686,_0x340c69){return function(_0xcff08a){if(!_0xcff08a){_0x3c3686['sendStatus'](0x194);}return _0xcff08a;};}function handleError(_0x2b2f6e,_0x290844){_0x290844=_0x290844||0x1f4;return function(_0x4b9377){logger['error'](_0x4b9377[_0x1d27('0x28')]);if(_0x4b9377['name']){delete _0x4b9377['name'];}_0x2b2f6e[_0x1d27('0x1a')](_0x290844)[_0x1d27('0x29')](_0x4b9377);};}exports[_0x1d27('0x2a')]=function(_0x317f03,_0x566a80){var _0x5a2eff={},_0x3284c8={},_0x3b72d7={'count':0x0,'rows':[]};var _0x4f146d=_[_0x1d27('0x2b')](db['VoiceQueuesLog'][_0x1d27('0x2c')],function(_0x36a84d){return{'name':_0x36a84d[_0x1d27('0x2d')],'type':_0x36a84d['type'][_0x1d27('0x2e')]};});_0x3284c8[_0x1d27('0x2f')]=_[_0x1d27('0x2b')](_0x4f146d,_0x1d27('0x30'));_0x3284c8[_0x1d27('0x31')]=_[_0x1d27('0x32')](_0x317f03[_0x1d27('0x31')]);_0x3284c8[_0x1d27('0x33')]=_[_0x1d27('0x34')](_0x3284c8[_0x1d27('0x2f')],_0x3284c8[_0x1d27('0x31')]);_0x5a2eff['attributes']=_[_0x1d27('0x34')](_0x3284c8[_0x1d27('0x2f')],qs['fields'](_0x317f03[_0x1d27('0x31')][_0x1d27('0x35')]));_0x5a2eff[_0x1d27('0x36')]=_0x5a2eff['attributes']['length']?_0x5a2eff[_0x1d27('0x36')]:_0x3284c8['model'];if(!_0x317f03[_0x1d27('0x31')][_0x1d27('0x37')](_0x1d27('0x38'))){_0x5a2eff[_0x1d27('0x1e')]=qs[_0x1d27('0x1e')](_0x317f03[_0x1d27('0x31')][_0x1d27('0x1e')]);_0x5a2eff['offset']=qs[_0x1d27('0x20')](_0x317f03[_0x1d27('0x31')][_0x1d27('0x20')]);}_0x5a2eff[_0x1d27('0x39')]=qs[_0x1d27('0x3a')](_0x317f03[_0x1d27('0x31')][_0x1d27('0x3a')]);_0x5a2eff[_0x1d27('0x3b')]=qs[_0x1d27('0x33')](_[_0x1d27('0x3c')](_0x317f03['query'],_0x3284c8[_0x1d27('0x33')]),_0x4f146d);if(_0x317f03[_0x1d27('0x31')][_0x1d27('0x3d')]){_0x5a2eff[_0x1d27('0x3b')]=_[_0x1d27('0x3e')](_0x5a2eff['where'],{'$or':_['map'](_0x4f146d,function(_0xa0209e){if(_0xa0209e[_0x1d27('0x3f')]!==_0x1d27('0x40')){var _0x2ad626={};_0x2ad626[_0xa0209e[_0x1d27('0x30')]]={'$like':'%'+_0x317f03[_0x1d27('0x31')]['filter']+'%'};return _0x2ad626;}})});}_0x5a2eff=_[_0x1d27('0x3e')]({},_0x5a2eff,_0x317f03['options']);var _0x22bac0={'where':_0x5a2eff[_0x1d27('0x3b')]};return db[_0x1d27('0x41')]['count'](_0x22bac0)[_0x1d27('0x26')](function(_0xe4d0d8){_0x3b72d7[_0x1d27('0x1f')]=_0xe4d0d8;if(_0x317f03[_0x1d27('0x31')]['includeAll']){_0x5a2eff[_0x1d27('0x42')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x1d27('0x43')](_0x5a2eff);})[_0x1d27('0x26')](function(_0x364446){_0x3b72d7[_0x1d27('0x44')]=_0x364446;return _0x3b72d7;})[_0x1d27('0x26')](respondWithFilteredResult(_0x566a80,_0x5a2eff))[_0x1d27('0x45')](handleError(_0x566a80,null));};exports['show']=function(_0x45c4dd,_0x4d2573){var _0x1acbcb={'raw':!![],'where':{'id':_0x45c4dd[_0x1d27('0x46')]['id']}},_0x448c0e={};_0x448c0e['model']=_[_0x1d27('0x32')](db['VoiceQueuesLog'][_0x1d27('0x2c')]);_0x448c0e[_0x1d27('0x31')]=_[_0x1d27('0x32')](_0x45c4dd[_0x1d27('0x31')]);_0x448c0e[_0x1d27('0x33')]=_[_0x1d27('0x34')](_0x448c0e[_0x1d27('0x2f')],_0x448c0e[_0x1d27('0x31')]);_0x1acbcb['attributes']=_[_0x1d27('0x34')](_0x448c0e[_0x1d27('0x2f')],qs[_0x1d27('0x35')](_0x45c4dd[_0x1d27('0x31')]['fields']));_0x1acbcb[_0x1d27('0x36')]=_0x1acbcb['attributes'][_0x1d27('0x47')]?_0x1acbcb['attributes']:_0x448c0e[_0x1d27('0x2f')];if(_0x45c4dd[_0x1d27('0x31')]['includeAll']){_0x1acbcb[_0x1d27('0x42')]=[{'all':!![]}];}_0x1acbcb=_[_0x1d27('0x3e')]({},_0x1acbcb,_0x45c4dd[_0x1d27('0x48')]);return db[_0x1d27('0x41')][_0x1d27('0x49')](_0x1acbcb)[_0x1d27('0x26')](handleEntityNotFound(_0x4d2573,null))['then'](respondWithResult(_0x4d2573,null))[_0x1d27('0x45')](handleError(_0x4d2573,null));};exports['create']=function(_0x2ca224,_0x351b1e){return db['VoiceQueuesLog'][_0x1d27('0x4a')](_0x2ca224[_0x1d27('0x4b')],{})[_0x1d27('0x26')](respondWithResult(_0x351b1e,0xc9))[_0x1d27('0x45')](handleError(_0x351b1e,null));};exports[_0x1d27('0x4c')]=function(_0x3e6ea8,_0x2454b5){if(_0x3e6ea8[_0x1d27('0x4b')]['id']){delete _0x3e6ea8['body']['id'];}return db[_0x1d27('0x41')][_0x1d27('0x49')]({'where':{'id':_0x3e6ea8[_0x1d27('0x46')]['id']}})[_0x1d27('0x26')](handleEntityNotFound(_0x2454b5,null))['then'](saveUpdates(_0x3e6ea8['body'],null))[_0x1d27('0x26')](respondWithResult(_0x2454b5,null))['catch'](handleError(_0x2454b5,null));};exports[_0x1d27('0x27')]=function(_0x30e780,_0x4fed60){return db['VoiceQueuesLog'][_0x1d27('0x49')]({'where':{'id':_0x30e780[_0x1d27('0x46')]['id']}})[_0x1d27('0x26')](handleEntityNotFound(_0x4fed60,null))['then'](removeEntity(_0x4fed60,null))[_0x1d27('0x45')](handleError(_0x4fed60,null));};
\ No newline at end of file
+var _0x56cc=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','destroy','then','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','filter','includeAll','include','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra'];(function(_0x2bc1b5,_0x4198af){var _0x313646=function(_0x22ba6b){while(--_0x22ba6b){_0x2bc1b5['push'](_0x2bc1b5['shift']());}};_0x313646(++_0x4198af);}(_0x56cc,0x116));var _0xc56c=function(_0x2edd45,_0x4a7b6e){_0x2edd45=_0x2edd45-0x0;var _0x43f686=_0x56cc[_0x2edd45];return _0x43f686;};'use strict';var emlformat=require(_0xc56c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc56c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc56c('0x2'));var moment=require(_0xc56c('0x3'));var BPromise=require(_0xc56c('0x4'));var Mustache=require(_0xc56c('0x5'));var util=require('util');var path=require(_0xc56c('0x6'));var sox=require(_0xc56c('0x7'));var csv=require('to-csv');var ejs=require(_0xc56c('0x8'));var fs=require('fs');var fs_extra=require(_0xc56c('0x9'));var _=require('lodash');var squel=require(_0xc56c('0xa'));var crypto=require(_0xc56c('0xb'));var jsforce=require(_0xc56c('0xc'));var deskjs=require(_0xc56c('0xd'));var toCsv=require(_0xc56c('0xe'));var querystring=require(_0xc56c('0xf'));var Papa=require(_0xc56c('0x10'));var Redis=require('ioredis');var authService=require(_0xc56c('0x11'));var qs=require(_0xc56c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc56c('0x13'));var logger=require(_0xc56c('0x14'))(_0xc56c('0x15'));var utils=require(_0xc56c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc56c('0x17'));var db=require(_0xc56c('0x18'))['db'];function respondWithStatusCode(_0x1a96e4,_0x2b511f){_0x2b511f=_0x2b511f||0xcc;return function(_0x1d160c){if(_0x1d160c){return _0x1a96e4['sendStatus'](_0x2b511f);}return _0x1a96e4[_0xc56c('0x19')](_0x2b511f)[_0xc56c('0x1a')]();};}function respondWithResult(_0x55b4bb,_0x497d23){_0x497d23=_0x497d23||0xc8;return function(_0x581b99){if(_0x581b99){return _0x55b4bb[_0xc56c('0x19')](_0x497d23)[_0xc56c('0x1b')](_0x581b99);}};}function respondWithFilteredResult(_0x113852,_0x5ae689){return function(_0x4c9aac){if(_0x4c9aac){var _0x3ea4e7=typeof _0x5ae689[_0xc56c('0x1c')]==='undefined'&&typeof _0x5ae689[_0xc56c('0x1d')]===_0xc56c('0x1e');var _0x184dcb=_0x4c9aac['count'];var _0x5217c3=_0x3ea4e7?0x0:_0x5ae689[_0xc56c('0x1c')];var _0x46ca75=_0x3ea4e7?_0x4c9aac[_0xc56c('0x1f')]:_0x5ae689[_0xc56c('0x1c')]+_0x5ae689[_0xc56c('0x1d')];var _0x57862e;if(_0x46ca75>=_0x184dcb){_0x46ca75=_0x184dcb;_0x57862e=0xc8;}else{_0x57862e=0xce;}_0x113852['status'](_0x57862e);return _0x113852[_0xc56c('0x20')](_0xc56c('0x21'),_0x5217c3+'-'+_0x46ca75+'/'+_0x184dcb)[_0xc56c('0x1b')](_0x4c9aac);}return null;};}function patchUpdates(_0x5979ae){return function(_0x448dcc){try{jsonpatch[_0xc56c('0x22')](_0x448dcc,_0x5979ae,!![]);}catch(_0x3182bc){return BPromise['reject'](_0x3182bc);}return _0x448dcc['save']();};}function saveUpdates(_0x1d52ba,_0x4efa48){return function(_0x365d6c){if(_0x365d6c){return _0x365d6c[_0xc56c('0x23')](_0x1d52ba)['then'](function(_0x3519db){return _0x3519db;});}return null;};}function removeEntity(_0x28ba82,_0x9b5918){return function(_0x4c5d94){if(_0x4c5d94){return _0x4c5d94[_0xc56c('0x24')]()[_0xc56c('0x25')](function(){_0x28ba82[_0xc56c('0x19')](0xcc)[_0xc56c('0x1a')]();});}};}function handleEntityNotFound(_0x1f0f32,_0x51d5bd){return function(_0x446199){if(!_0x446199){_0x1f0f32[_0xc56c('0x26')](0x194);}return _0x446199;};}function handleError(_0x4bcf15,_0xfb9259){_0xfb9259=_0xfb9259||0x1f4;return function(_0x14e2c2){logger[_0xc56c('0x27')](_0x14e2c2[_0xc56c('0x28')]);if(_0x14e2c2[_0xc56c('0x29')]){delete _0x14e2c2['name'];}_0x4bcf15['status'](_0xfb9259)[_0xc56c('0x2a')](_0x14e2c2);};}exports[_0xc56c('0x2b')]=function(_0x45f58c,_0x910fca){var _0x5b4074={},_0x11efc0={},_0x2a0126={'count':0x0,'rows':[]};var _0x255e08=_[_0xc56c('0x2c')](db[_0xc56c('0x2d')][_0xc56c('0x2e')],function(_0x4ce584){return{'name':_0x4ce584[_0xc56c('0x2f')],'type':_0x4ce584['type']['key']};});_0x11efc0[_0xc56c('0x30')]=_[_0xc56c('0x2c')](_0x255e08,_0xc56c('0x29'));_0x11efc0[_0xc56c('0x31')]=_['keys'](_0x45f58c[_0xc56c('0x31')]);_0x11efc0[_0xc56c('0x32')]=_[_0xc56c('0x33')](_0x11efc0[_0xc56c('0x30')],_0x11efc0[_0xc56c('0x31')]);_0x5b4074[_0xc56c('0x34')]=_['intersection'](_0x11efc0[_0xc56c('0x30')],qs['fields'](_0x45f58c[_0xc56c('0x31')][_0xc56c('0x35')]));_0x5b4074[_0xc56c('0x34')]=_0x5b4074[_0xc56c('0x34')][_0xc56c('0x36')]?_0x5b4074['attributes']:_0x11efc0[_0xc56c('0x30')];if(!_0x45f58c[_0xc56c('0x31')]['hasOwnProperty'](_0xc56c('0x37'))){_0x5b4074[_0xc56c('0x1d')]=qs['limit'](_0x45f58c[_0xc56c('0x31')]['limit']);_0x5b4074[_0xc56c('0x1c')]=qs['offset'](_0x45f58c[_0xc56c('0x31')][_0xc56c('0x1c')]);}_0x5b4074[_0xc56c('0x38')]=qs[_0xc56c('0x39')](_0x45f58c[_0xc56c('0x31')][_0xc56c('0x39')]);_0x5b4074['where']=qs[_0xc56c('0x32')](_[_0xc56c('0x3a')](_0x45f58c[_0xc56c('0x31')],_0x11efc0[_0xc56c('0x32')]),_0x255e08);if(_0x45f58c[_0xc56c('0x31')]['filter']){_0x5b4074[_0xc56c('0x3b')]=_[_0xc56c('0x3c')](_0x5b4074[_0xc56c('0x3b')],{'$or':_[_0xc56c('0x2c')](_0x255e08,function(_0x289353){if(_0x289353['type']!=='VIRTUAL'){var _0x334658={};_0x334658[_0x289353[_0xc56c('0x29')]]={'$like':'%'+_0x45f58c[_0xc56c('0x31')][_0xc56c('0x3d')]+'%'};return _0x334658;}})});}_0x5b4074=_['merge']({},_0x5b4074,_0x45f58c['options']);var _0x13dca5={'where':_0x5b4074[_0xc56c('0x3b')]};return db[_0xc56c('0x2d')][_0xc56c('0x1f')](_0x13dca5)[_0xc56c('0x25')](function(_0x5e60bd){_0x2a0126[_0xc56c('0x1f')]=_0x5e60bd;if(_0x45f58c['query'][_0xc56c('0x3e')]){_0x5b4074[_0xc56c('0x3f')]=[{'all':!![]}];}return db[_0xc56c('0x2d')]['findAll'](_0x5b4074);})[_0xc56c('0x25')](function(_0x532e48){_0x2a0126[_0xc56c('0x40')]=_0x532e48;return _0x2a0126;})[_0xc56c('0x25')](respondWithFilteredResult(_0x910fca,_0x5b4074))[_0xc56c('0x41')](handleError(_0x910fca,null));};exports[_0xc56c('0x42')]=function(_0x58ef79,_0x27d701){var _0x4d87a1={'raw':!![],'where':{'id':_0x58ef79[_0xc56c('0x43')]['id']}},_0x400b72={};_0x400b72[_0xc56c('0x30')]=_[_0xc56c('0x44')](db['VoiceQueuesLog'][_0xc56c('0x2e')]);_0x400b72[_0xc56c('0x31')]=_[_0xc56c('0x44')](_0x58ef79[_0xc56c('0x31')]);_0x400b72[_0xc56c('0x32')]=_[_0xc56c('0x33')](_0x400b72[_0xc56c('0x30')],_0x400b72[_0xc56c('0x31')]);_0x4d87a1[_0xc56c('0x34')]=_['intersection'](_0x400b72[_0xc56c('0x30')],qs['fields'](_0x58ef79[_0xc56c('0x31')][_0xc56c('0x35')]));_0x4d87a1[_0xc56c('0x34')]=_0x4d87a1['attributes'][_0xc56c('0x36')]?_0x4d87a1[_0xc56c('0x34')]:_0x400b72['model'];if(_0x58ef79[_0xc56c('0x31')]['includeAll']){_0x4d87a1['include']=[{'all':!![]}];}_0x4d87a1=_['merge']({},_0x4d87a1,_0x58ef79['options']);return db[_0xc56c('0x2d')][_0xc56c('0x45')](_0x4d87a1)['then'](handleEntityNotFound(_0x27d701,null))[_0xc56c('0x25')](respondWithResult(_0x27d701,null))[_0xc56c('0x41')](handleError(_0x27d701,null));};exports[_0xc56c('0x46')]=function(_0xd0285d,_0xb0927c){return db[_0xc56c('0x2d')][_0xc56c('0x46')](_0xd0285d[_0xc56c('0x47')],{})[_0xc56c('0x25')](respondWithResult(_0xb0927c,0xc9))[_0xc56c('0x41')](handleError(_0xb0927c,null));};exports[_0xc56c('0x23')]=function(_0x59f3a0,_0x4fdc13){if(_0x59f3a0[_0xc56c('0x47')]['id']){delete _0x59f3a0[_0xc56c('0x47')]['id'];}return db[_0xc56c('0x2d')][_0xc56c('0x45')]({'where':{'id':_0x59f3a0['params']['id']}})['then'](handleEntityNotFound(_0x4fdc13,null))[_0xc56c('0x25')](saveUpdates(_0x59f3a0[_0xc56c('0x47')],null))[_0xc56c('0x25')](respondWithResult(_0x4fdc13,null))[_0xc56c('0x41')](handleError(_0x4fdc13,null));};exports[_0xc56c('0x24')]=function(_0x542f7f,_0x227581){return db[_0xc56c('0x2d')][_0xc56c('0x45')]({'where':{'id':_0x542f7f[_0xc56c('0x43')]['id']}})[_0xc56c('0x25')](handleEntityNotFound(_0x227581,null))[_0xc56c('0x25')](removeEntity(_0x227581,null))[_0xc56c('0x41')](handleError(_0x227581,null));};
\ No newline at end of file
index 95bbe25..eecf87f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcab6=['VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x32847b,_0x2c7ed8){var _0x1d931f=function(_0x2e20c9){while(--_0x2e20c9){_0x32847b['push'](_0x32847b['shift']());}};_0x1d931f(++_0x2c7ed8);}(_0xcab6,0xd4));var _0x6cab=function(_0x117ea5,_0x9eba99){_0x117ea5=_0x117ea5-0x0;var _0x26c290=_0xcab6[_0x117ea5];return _0x26c290;};'use strict';var _=require(_0x6cab('0x0'));var util=require('util');var logger=require(_0x6cab('0x1'))(_0x6cab('0x2'));var moment=require(_0x6cab('0x3'));var BPromise=require(_0x6cab('0x4'));var rp=require(_0x6cab('0x5'));var fs=require('fs');var path=require(_0x6cab('0x6'));var rimraf=require('rimraf');var config=require(_0x6cab('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x6cab('0x8')]=function(_0x1953cd,_0x13464a){return _0x1953cd['define'](_0x6cab('0x9'),attributes,{'tableName':_0x6cab('0xa'),'paranoid':![],'indexes':[{'name':_0x6cab('0xb'),'fields':[_0x6cab('0xc'),'dtm']}],'timestamps':![]});};
\ No newline at end of file
+var _0x4c18=['exports','define','voice_queues_log','event_dtm','event','dtm','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x317497,_0x2d6cf7){var _0x3445b0=function(_0x22fe4d){while(--_0x22fe4d){_0x317497['push'](_0x317497['shift']());}};_0x3445b0(++_0x2d6cf7);}(_0x4c18,0x18e));var _0x84c1=function(_0x9d4e5a,_0x41a758){_0x9d4e5a=_0x9d4e5a-0x0;var _0x1d4c62=_0x4c18[_0x9d4e5a];return _0x1d4c62;};'use strict';var _=require(_0x84c1('0x0'));var util=require(_0x84c1('0x1'));var logger=require('../../config/logger')(_0x84c1('0x2'));var moment=require('moment');var BPromise=require(_0x84c1('0x3'));var rp=require(_0x84c1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84c1('0x5'));var config=require(_0x84c1('0x6'));var attributes=require(_0x84c1('0x7'));module[_0x84c1('0x8')]=function(_0x52cd21,_0x597cdb){return _0x52cd21[_0x84c1('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0x84c1('0xa'),'paranoid':![],'indexes':[{'name':_0x84c1('0xb'),'fields':[_0x84c1('0xc'),_0x84c1('0xd')]}],'timestamps':![]});};
\ No newline at end of file
index 4beb2a1..e15f3e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xff4f=['message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x5d3855,_0x221f75){var _0x4d671f=function(_0x4d3ba4){while(--_0x4d3ba4){_0x5d3855['push'](_0x5d3855['shift']());}};_0x4d671f(++_0x221f75);}(_0xff4f,0x19a));var _0xfff4=function(_0x1c8653,_0x240cbc){_0x1c8653=_0x1c8653-0x0;var _0x56a15d=_0xff4f[_0x1c8653];return _0x56a15d;};'use strict';var _=require(_0xfff4('0x0'));var util=require(_0xfff4('0x1'));var moment=require('moment');var BPromise=require(_0xfff4('0x2'));var rs=require(_0xfff4('0x3'));var fs=require('fs');var Redis=require(_0xfff4('0x4'));var db=require(_0xfff4('0x5'))['db'];var utils=require(_0xfff4('0x6'));var logger=require(_0xfff4('0x7'))(_0xfff4('0x8'));var config=require(_0xfff4('0x9'));var jayson=require(_0xfff4('0xa'));var client=jayson[_0xfff4('0xb')][_0xfff4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45b652,_0x1f5675,_0x43418d){return new BPromise(function(_0x49c9c8,_0x3beed6){return client[_0xfff4('0xd')](_0x45b652,_0x43418d)[_0xfff4('0xe')](function(_0x51c823){logger[_0xfff4('0xf')](_0xfff4('0x10'),_0x1f5675,_0xfff4('0x11'));logger[_0xfff4('0x12')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x1f5675,_0xfff4('0x11'),JSON[_0xfff4('0x13')](_0x51c823));if(_0x51c823[_0xfff4('0x14')]){if(_0x51c823[_0xfff4('0x14')][_0xfff4('0x15')]===0x1f4){logger[_0xfff4('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1f5675,_0x51c823[_0xfff4('0x14')][_0xfff4('0x16')]);return _0x3beed6(_0x51c823[_0xfff4('0x14')][_0xfff4('0x16')]);}logger[_0xfff4('0x14')](_0xfff4('0x10'),_0x1f5675,_0x51c823['error'][_0xfff4('0x16')]);return _0x49c9c8(_0x51c823['error'][_0xfff4('0x16')]);}else{logger[_0xfff4('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1f5675,'request\x20sent');_0x49c9c8(_0x51c823[_0xfff4('0x17')]['message']);}})['catch'](function(_0x4f1a3a){logger[_0xfff4('0x14')](_0xfff4('0x10'),_0x1f5675,_0x4f1a3a);_0x3beed6(_0x4f1a3a);});});}
\ No newline at end of file
+var _0x6759=['stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x30e476,_0x3602e6){var _0x28ed64=function(_0x380351){while(--_0x380351){_0x30e476['push'](_0x30e476['shift']());}};_0x28ed64(++_0x3602e6);}(_0x6759,0x10d));var _0x9675=function(_0x49f30e,_0xf28439){_0x49f30e=_0x49f30e-0x0;var _0x2cafd5=_0x6759[_0x49f30e];return _0x2cafd5;};'use strict';var _=require('lodash');var util=require(_0x9675('0x0'));var moment=require('moment');var BPromise=require(_0x9675('0x1'));var rs=require(_0x9675('0x2'));var fs=require('fs');var Redis=require(_0x9675('0x3'));var db=require(_0x9675('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9675('0x5'))(_0x9675('0x6'));var config=require(_0x9675('0x7'));var jayson=require(_0x9675('0x8'));var client=jayson[_0x9675('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b4d6a,_0x20d593,_0x1a3770){return new BPromise(function(_0x31e170,_0x2fd726){return client[_0x9675('0xa')](_0x5b4d6a,_0x1a3770)[_0x9675('0xb')](function(_0x2178ae){logger[_0x9675('0xc')](_0x9675('0xd'),_0x20d593,'request\x20sent');logger[_0x9675('0xe')](_0x9675('0xf'),_0x20d593,_0x9675('0x10'),JSON[_0x9675('0x11')](_0x2178ae));if(_0x2178ae[_0x9675('0x12')]){if(_0x2178ae[_0x9675('0x12')][_0x9675('0x13')]===0x1f4){logger[_0x9675('0x12')](_0x9675('0xd'),_0x20d593,_0x2178ae[_0x9675('0x12')][_0x9675('0x14')]);return _0x2fd726(_0x2178ae[_0x9675('0x12')][_0x9675('0x14')]);}logger['error'](_0x9675('0xd'),_0x20d593,_0x2178ae[_0x9675('0x12')][_0x9675('0x14')]);return _0x31e170(_0x2178ae[_0x9675('0x12')]['message']);}else{logger[_0x9675('0xc')](_0x9675('0xd'),_0x20d593,_0x9675('0x10'));_0x31e170(_0x2178ae['result'][_0x9675('0x14')]);}})[_0x9675('0x15')](function(_0x344d8c){logger[_0x9675('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x20d593,_0x344d8c);_0x2fd726(_0x344d8c);});});}
\ No newline at end of file
index 8f36961..b4bc6b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0125=['Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x3e8c0a,_0x3b65c2){var _0x570c01=function(_0x41e569){while(--_0x41e569){_0x3e8c0a['push'](_0x3e8c0a['shift']());}};_0x570c01(++_0x3b65c2);}(_0x0125,0x114));var _0x5012=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0x0125[_0x4cce65];return _0x4d1b45;};'use strict';var multer=require(_0x5012('0x0'));var util=require(_0x5012('0x1'));var path=require('path');var timeout=require(_0x5012('0x2'));var express=require(_0x5012('0x3'));var router=express[_0x5012('0x4')]();var fs_extra=require(_0x5012('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5012('0x6'));var config=require(_0x5012('0x7'));var controller=require(_0x5012('0x8'));router[_0x5012('0x9')]('/',auth[_0x5012('0xa')](),controller[_0x5012('0xb')]);router[_0x5012('0x9')](_0x5012('0xc'),auth[_0x5012('0xa')](),controller[_0x5012('0xd')]);router[_0x5012('0x9')](_0x5012('0xe'),auth[_0x5012('0xa')](),controller[_0x5012('0xf')]);router[_0x5012('0x9')](_0x5012('0x10'),auth[_0x5012('0xa')](),controller[_0x5012('0x11')]);router['get'](_0x5012('0x12'),controller[_0x5012('0x13')]);router[_0x5012('0x9')](_0x5012('0x14'),auth[_0x5012('0xa')](),controller[_0x5012('0x15')]);router[_0x5012('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5012('0x16')](_0x5012('0x14'),auth[_0x5012('0xa')](),controller[_0x5012('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5012('0x18')]);router[_0x5012('0x19')](_0x5012('0xe'),auth['isAuthenticated'](),controller[_0x5012('0x1a')]);module[_0x5012('0x1b')]=router;
\ No newline at end of file
+var _0x7a15=['show','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a15,0x1a1));var _0x57a1=function(_0x463685,_0x3acee4){_0x463685=_0x463685-0x0;var _0x2fcd55=_0x7a15[_0x463685];return _0x2fcd55;};'use strict';var multer=require(_0x57a1('0x0'));var util=require(_0x57a1('0x1'));var path=require('path');var timeout=require(_0x57a1('0x2'));var express=require(_0x57a1('0x3'));var router=express[_0x57a1('0x4')]();var fs_extra=require(_0x57a1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x57a1('0x6'));var config=require(_0x57a1('0x7'));var controller=require(_0x57a1('0x8'));router[_0x57a1('0x9')]('/',auth[_0x57a1('0xa')](),controller[_0x57a1('0xb')]);router['get'](_0x57a1('0xc'),auth[_0x57a1('0xa')](),controller[_0x57a1('0xd')]);router[_0x57a1('0x9')](_0x57a1('0xe'),auth[_0x57a1('0xa')](),controller[_0x57a1('0xf')]);router[_0x57a1('0x9')](_0x57a1('0x10'),auth[_0x57a1('0xa')](),controller[_0x57a1('0x11')]);router[_0x57a1('0x9')](_0x57a1('0x12'),controller[_0x57a1('0x13')]);router[_0x57a1('0x9')]('/:id/transcribe',auth[_0x57a1('0xa')](),controller[_0x57a1('0x14')]);router[_0x57a1('0x15')]('/',auth[_0x57a1('0xa')](),controller[_0x57a1('0x16')]);router[_0x57a1('0x15')](_0x57a1('0x17'),auth['isAuthenticated'](),controller[_0x57a1('0x18')]);router[_0x57a1('0x19')](_0x57a1('0xe'),auth[_0x57a1('0xa')](),controller[_0x57a1('0x1a')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index cfd8b8e..a1512cc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}};
\ No newline at end of file
+var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}};
\ No newline at end of file
index 43bac0b..226f9ac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb42=['apply','reject','update','then','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','params','fields','length','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','sequelize','col','$and','push','recording','existsSync','Sequelize','extname','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0xf76691,_0x473e32){var _0x9e6adc=function(_0x216e91){while(--_0x216e91){_0xf76691['push'](_0xf76691['shift']());}};_0x9e6adc(++_0x473e32);}(_0xcb42,0x1a5));var _0x2cb4=function(_0x36feba,_0x541932){_0x36feba=_0x36feba-0x0;var _0x358e41=_0xcb42[_0x36feba];return _0x358e41;};'use strict';var emlformat=require(_0x2cb4('0x0'));var rimraf=require(_0x2cb4('0x1'));var zipdir=require(_0x2cb4('0x2'));var jsonpatch=require(_0x2cb4('0x3'));var rp=require(_0x2cb4('0x4'));var moment=require(_0x2cb4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2cb4('0x6'));var util=require(_0x2cb4('0x7'));var path=require('path');var sox=require(_0x2cb4('0x8'));var csv=require('to-csv');var ejs=require(_0x2cb4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2cb4('0xa'));var jsforce=require(_0x2cb4('0xb'));var deskjs=require(_0x2cb4('0xc'));var toCsv=require(_0x2cb4('0xd'));var querystring=require(_0x2cb4('0xe'));var Papa=require(_0x2cb4('0xf'));var AWS=require(_0x2cb4('0x10'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2cb4('0x11'));var as=require(_0x2cb4('0x12'));var hardwareService=require(_0x2cb4('0x13'));var logger=require(_0x2cb4('0x14'))(_0x2cb4('0x15'));var utils=require(_0x2cb4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2cb4('0x17'));var db=require(_0x2cb4('0x18'))['db'];function respondWithStatusCode(_0xadf567,_0x36c42d){_0x36c42d=_0x36c42d||0xcc;return function(_0x526843){if(_0x526843){return _0xadf567[_0x2cb4('0x19')](_0x36c42d);}return _0xadf567[_0x2cb4('0x1a')](_0x36c42d)[_0x2cb4('0x1b')]();};}function respondWithResult(_0x1758c6,_0x180823){_0x180823=_0x180823||0xc8;return function(_0x1fcd16){if(_0x1fcd16){return _0x1758c6[_0x2cb4('0x1a')](_0x180823)[_0x2cb4('0x1c')](_0x1fcd16);}};}function respondWithFilteredResult(_0x5be7fe,_0x3ba78d){return function(_0x2a8063){if(_0x2a8063){var _0xd24a8e=typeof _0x3ba78d[_0x2cb4('0x1d')]===_0x2cb4('0x1e')&&typeof _0x3ba78d['limit']==='undefined';var _0x31156b=_0x2a8063[_0x2cb4('0x1f')];var _0x527a3c=_0xd24a8e?0x0:_0x3ba78d['offset'];var _0x14f57c=_0xd24a8e?_0x2a8063[_0x2cb4('0x1f')]:_0x3ba78d['offset']+_0x3ba78d['limit'];var _0x4124eb;if(_0x14f57c>=_0x31156b){_0x14f57c=_0x31156b;_0x4124eb=0xc8;}else{_0x4124eb=0xce;}_0x5be7fe['status'](_0x4124eb);return _0x5be7fe['set']('Content-Range',_0x527a3c+'-'+_0x14f57c+'/'+_0x31156b)[_0x2cb4('0x1c')](_0x2a8063);}return null;};}function patchUpdates(_0xbb75e6){return function(_0x53fd75){try{jsonpatch[_0x2cb4('0x20')](_0x53fd75,_0xbb75e6,!![]);}catch(_0x5d0e97){return BPromise[_0x2cb4('0x21')](_0x5d0e97);}return _0x53fd75['save']();};}function saveUpdates(_0x3edfe3,_0x154224){return function(_0x21c358){if(_0x21c358){return _0x21c358[_0x2cb4('0x22')](_0x3edfe3)[_0x2cb4('0x23')](function(_0x1705d0){return _0x1705d0;});}return null;};}function removeEntity(_0x402ce0,_0x25ffc2){return function(_0x2db834){if(_0x2db834){return _0x2db834['destroy']()[_0x2cb4('0x23')](function(){_0x402ce0[_0x2cb4('0x1a')](0xcc)[_0x2cb4('0x1b')]();});}};}function handleEntityNotFound(_0x289f11,_0x57a6b1){return function(_0x567978){if(!_0x567978){_0x289f11[_0x2cb4('0x19')](0x194);}return _0x567978;};}function handleError(_0xd39a02,_0x9c4d23){_0x9c4d23=_0x9c4d23||0x1f4;return function(_0xecd2fd){logger[_0x2cb4('0x24')](_0xecd2fd[_0x2cb4('0x25')]);if(_0xecd2fd[_0x2cb4('0x26')]){delete _0xecd2fd[_0x2cb4('0x26')];}_0xd39a02[_0x2cb4('0x1a')](_0x9c4d23)[_0x2cb4('0x27')](_0xecd2fd);};}exports[_0x2cb4('0x28')]=function(_0x2c8ddc,_0x2fb766){var _0x4def9={},_0x76705b={},_0x2fb506={'count':0x0,'rows':[]};var _0x2ead9d=_[_0x2cb4('0x29')](db[_0x2cb4('0x2a')][_0x2cb4('0x2b')],function(_0xb19ee3){return{'name':_0xb19ee3[_0x2cb4('0x2c')],'type':_0xb19ee3[_0x2cb4('0x2d')][_0x2cb4('0x2e')]};});_0x76705b[_0x2cb4('0x2f')]=_[_0x2cb4('0x30')](_[_0x2cb4('0x29')](_0x2ead9d,_0x2cb4('0x26')),[_0x2cb4('0x31')]);_0x76705b[_0x2cb4('0x32')]=_[_0x2cb4('0x33')](_0x2c8ddc[_0x2cb4('0x32')]);_0x76705b[_0x2cb4('0x34')]=_[_0x2cb4('0x35')](_0x76705b['model'],_0x76705b[_0x2cb4('0x32')]);_0x4def9[_0x2cb4('0x36')]=_[_0x2cb4('0x35')](_0x76705b[_0x2cb4('0x2f')],qs['fields'](_0x2c8ddc[_0x2cb4('0x32')]['fields']));_0x4def9['attributes']=_0x4def9[_0x2cb4('0x36')]['length']?_0x4def9[_0x2cb4('0x36')]:_0x76705b[_0x2cb4('0x2f')];if(!_0x2c8ddc['query'][_0x2cb4('0x37')](_0x2cb4('0x38'))){_0x4def9[_0x2cb4('0x39')]=qs[_0x2cb4('0x39')](_0x2c8ddc[_0x2cb4('0x32')][_0x2cb4('0x39')]);_0x4def9['offset']=qs[_0x2cb4('0x1d')](_0x2c8ddc[_0x2cb4('0x32')][_0x2cb4('0x1d')]);}_0x4def9[_0x2cb4('0x3a')]=qs[_0x2cb4('0x3b')](_0x2c8ddc[_0x2cb4('0x32')][_0x2cb4('0x3b')]);_0x4def9[_0x2cb4('0x3c')]=qs[_0x2cb4('0x34')](_[_0x2cb4('0x3d')](_0x2c8ddc['query'],_0x76705b['filters']),_0x2ead9d);if(_0x2c8ddc['query']['filter']){_0x4def9['where']=_[_0x2cb4('0x3e')](_0x4def9[_0x2cb4('0x3c')],{'$or':_[_0x2cb4('0x29')](_0x2ead9d,function(_0xe0d4c){if(_0xe0d4c[_0x2cb4('0x2d')]!=='VIRTUAL'){var _0xac315e={};_0xac315e[_0xe0d4c[_0x2cb4('0x26')]]={'$like':'%'+_0x2c8ddc['query'][_0x2cb4('0x3f')]+'%'};return _0xac315e;}})});}_0x4def9=_[_0x2cb4('0x3e')]({},_0x4def9,_0x2c8ddc[_0x2cb4('0x40')]);var _0x733ec8={'where':_0x4def9[_0x2cb4('0x3c')]};return db[_0x2cb4('0x2a')][_0x2cb4('0x1f')](_0x733ec8)['then'](function(_0x3e4d59){_0x2fb506[_0x2cb4('0x1f')]=_0x3e4d59;if(_0x2c8ddc['query'][_0x2cb4('0x41')]){_0x4def9[_0x2cb4('0x42')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x4def9);})[_0x2cb4('0x23')](function(_0x2564b6){_0x2fb506[_0x2cb4('0x43')]=_0x2564b6;return _0x2fb506;})['then'](respondWithFilteredResult(_0x2fb766,_0x4def9))[_0x2cb4('0x44')](handleError(_0x2fb766,null));};exports[_0x2cb4('0x45')]=function(_0x105131,_0x1e74d1){var _0x4e28ee={'raw':![],'where':{'id':_0x105131[_0x2cb4('0x46')]['id']}},_0x1130cc={};_0x1130cc[_0x2cb4('0x2f')]=_[_0x2cb4('0x33')](db[_0x2cb4('0x2a')][_0x2cb4('0x2b')]);_0x1130cc[_0x2cb4('0x32')]=_[_0x2cb4('0x33')](_0x105131[_0x2cb4('0x32')]);_0x1130cc[_0x2cb4('0x34')]=_['intersection'](_0x1130cc[_0x2cb4('0x2f')],_0x1130cc['query']);_0x4e28ee[_0x2cb4('0x36')]=_[_0x2cb4('0x35')](_0x1130cc['model'],qs[_0x2cb4('0x47')](_0x105131['query'][_0x2cb4('0x47')]));_0x4e28ee[_0x2cb4('0x36')]=_0x4e28ee[_0x2cb4('0x36')][_0x2cb4('0x48')]?_0x4e28ee[_0x2cb4('0x36')]:_0x1130cc[_0x2cb4('0x2f')];if(_0x105131[_0x2cb4('0x32')][_0x2cb4('0x41')]){_0x4e28ee[_0x2cb4('0x42')]=[{'all':!![]}];}_0x4e28ee=_[_0x2cb4('0x3e')]({},_0x4e28ee,_0x105131['options']);return db['VoiceRecording']['find'](_0x4e28ee)[_0x2cb4('0x23')](handleEntityNotFound(_0x1e74d1,null))[_0x2cb4('0x23')](respondWithResult(_0x1e74d1,null))['catch'](handleError(_0x1e74d1,null));};exports[_0x2cb4('0x49')]=function(_0x25adb2,_0x5d69a3){return db[_0x2cb4('0x2a')][_0x2cb4('0x49')](_0x25adb2['body'],{})[_0x2cb4('0x23')](respondWithResult(_0x5d69a3,0xc9))['catch'](handleError(_0x5d69a3,null));};exports[_0x2cb4('0x22')]=function(_0x8a5b10,_0x4acec2){if(_0x8a5b10[_0x2cb4('0x4a')]['id']){delete _0x8a5b10[_0x2cb4('0x4a')]['id'];}return db['VoiceRecording'][_0x2cb4('0x4b')]({'where':{'id':_0x8a5b10['params']['id']}})[_0x2cb4('0x23')](handleEntityNotFound(_0x4acec2,null))['then'](saveUpdates(_0x8a5b10[_0x2cb4('0x4a')],null))[_0x2cb4('0x23')](respondWithResult(_0x4acec2,null))['catch'](handleError(_0x4acec2,null));};exports[_0x2cb4('0x4c')]=function(_0x126182,_0x2f5b16){return db[_0x2cb4('0x2a')][_0x2cb4('0x4c')]()[_0x2cb4('0x23')](respondWithResult(_0x2f5b16,null))['catch'](handleError(_0x2f5b16,null));};exports[_0x2cb4('0x4d')]=function(_0x33ce07,_0x3f2efa,_0x5d0332){var _0x536bfe=require(_0x2cb4('0x4e'));var _0x98de5=![];var _0xcd3af2={};if(_0x33ce07[_0x2cb4('0x32')][_0x2cb4('0x2d')]&&_0x33ce07[_0x2cb4('0x32')]['type']===_0x2cb4('0x4f')){_0xcd3af2[_0x2cb4('0x4f')]=_0x33ce07[_0x2cb4('0x46')]['id'];}else{_0xcd3af2['id']=_0x33ce07[_0x2cb4('0x46')]['id'];}return db[_0x2cb4('0x2a')]['find']({'where':_0xcd3af2,'attributes':['id',_0x2cb4('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x3f2efa,null))[_0x2cb4('0x23')](function(_0x514964){if(_0x514964){var _0x5ac656=_0x514964[_0x2cb4('0x50')];var _0x1bacc0=util['format'](_0x2cb4('0x51'),_0x5ac656);if(fs['existsSync'](_0x1bacc0)){_0x98de5=!![];return _0x536bfe[_0x2cb4('0x52')](_0x1bacc0,_0x5ac656,config[_0x2cb4('0x53')]['recording'])[_0x2cb4('0x23')](function(){return _0x514964;});}return _0x514964;}})[_0x2cb4('0x23')](function(_0x4029b3){if(_0x4029b3){var _0x3870e7=_0x4029b3[_0x2cb4('0x50')];if(!fs['existsSync'](_0x3870e7)){throw new db['Sequelize'][(_0x2cb4('0x54'))](_0x2cb4('0x55'));}if(_0x4029b3[_0x2cb4('0x56')]){return _0x3f2efa[_0x2cb4('0x4d')](_0x3870e7,_0x4029b3['filename']+path['extname'](_0x3870e7),function(){if(_0x98de5){fs[_0x2cb4('0x57')](_0x3870e7);}});}else{return _0x3f2efa[_0x2cb4('0x4d')](_0x3870e7,function(_0x1c205f){if(_0x98de5){fs[_0x2cb4('0x57')](_0x3870e7);}});}}})[_0x2cb4('0x44')](function(_0x56b529){if(_0x56b529['message']==='VoiceRecording\x20not\x20found'){_0x3f2efa[_0x2cb4('0x1a')](0x194)[_0x2cb4('0x27')]('Not\x20found');}else{return handleError(_0x3f2efa,null);}});};exports['downloads']=function(_0x20debf,_0x14a7f7,_0xb0e3c4){var _0x589b68=require(_0x2cb4('0x4e'));var _0x1a21ca=![];var _0x111282={'$and':[db[_0x2cb4('0x58')]['where'](db[_0x2cb4('0x58')]['fn']('MD5',db[_0x2cb4('0x58')][_0x2cb4('0x59')](_0x2cb4('0x4f'))),_0x20debf[_0x2cb4('0x32')]['token'])]};if(_0x20debf['query'][_0x2cb4('0x2d')]&&_0x20debf[_0x2cb4('0x32')][_0x2cb4('0x2d')]===_0x2cb4('0x4f')){_0x111282[_0x2cb4('0x5a')][_0x2cb4('0x5b')]({'uniqueid':_0x20debf[_0x2cb4('0x46')]['id']});}else{_0x111282['$and'][_0x2cb4('0x5b')]({'id':_0x20debf[_0x2cb4('0x46')]['id']});}return db[_0x2cb4('0x2a')][_0x2cb4('0x4b')]({'where':_0x111282,'attributes':['id',_0x2cb4('0x50')],'raw':!![]})[_0x2cb4('0x23')](handleEntityNotFound(_0x14a7f7,null))['then'](function(_0x584b66){if(_0x584b66){var _0x28282b=util['format']('%s.cypher',_0x584b66[_0x2cb4('0x50')]);if(fs['existsSync'](_0x28282b)){_0x1a21ca=!![];return _0x589b68[_0x2cb4('0x52')](_0x28282b,_0x584b66[_0x2cb4('0x50')],config[_0x2cb4('0x53')][_0x2cb4('0x5c')])[_0x2cb4('0x23')](function(){return _0x584b66;});}return _0x584b66;}})[_0x2cb4('0x23')](function(_0x488146){if(_0x488146){if(!fs[_0x2cb4('0x5d')](_0x488146[_0x2cb4('0x50')])){throw new db[(_0x2cb4('0x5e'))][(_0x2cb4('0x54'))]('VoiceRecording\x20not\x20found');}if(_0x488146['filename']){return _0x14a7f7['download'](_0x488146[_0x2cb4('0x50')],_0x488146[_0x2cb4('0x56')]+path[_0x2cb4('0x5f')](_0x488146[_0x2cb4('0x50')]),function(){if(_0x1a21ca){fs[_0x2cb4('0x57')](_0x488146['value']);}});}else{return _0x14a7f7[_0x2cb4('0x4d')](_0x488146[_0x2cb4('0x50')],function(_0x2fcde9){if(_0x1a21ca){fs[_0x2cb4('0x57')](_0x488146[_0x2cb4('0x50')]);}});}}})['catch'](handleError(_0x14a7f7,null));};exports[_0x2cb4('0x60')]=function(_0x2a1fe4,_0x5077f1){return db[_0x2cb4('0x2a')][_0x2cb4('0x4b')]({'where':{'id':_0x2a1fe4[_0x2cb4('0x46')]['id']}})['then'](function(_0x199779){if(_[_0x2cb4('0x61')](_0x199779)){throw new ReferenceError(_0x2cb4('0x62'));}return _0x199779;})[_0x2cb4('0x23')](function(_0x23150d){var _0x95d0ea=_0x23150d[_0x2cb4('0x50')];logger['info'](_0x2cb4('0x63'),_0x95d0ea);if(!_[_0x2cb4('0x61')](_0x23150d[_0x2cb4('0x50')])&&fs[_0x2cb4('0x5d')](_0x95d0ea)){logger[_0x2cb4('0x64')](_0x2cb4('0x65')+_0x95d0ea+_0x2cb4('0x66'));fs['unlinkSync'](_0x95d0ea);}_0x95d0ea=_0x95d0ea+_0x2cb4('0x67');if(!_['isNil'](_0x23150d[_0x2cb4('0x50')])&&fs[_0x2cb4('0x5d')](_0x95d0ea)){logger[_0x2cb4('0x64')](_0x2cb4('0x65')+_0x95d0ea+_0x2cb4('0x66'));fs[_0x2cb4('0x68')](_0x95d0ea);}return _0x23150d;})[_0x2cb4('0x23')](function(_0x24c410){if(!_0x24c410)throw new InternalError();return _0x24c410[_0x2cb4('0x60')]();})['then'](function(){_0x5077f1['status'](0xcc)[_0x2cb4('0x1b')]();})[_0x2cb4('0x44')](handleError(_0x5077f1,null));};function getBucketslist(_0x19001d,_0x43879a,_0x1a4028){return new Promise(function(_0x1bfa1e,_0x16725d){var _0xa28b8d=new AWS['S3']({'accessKeyId':_0x43879a,'secretAccessKey':_0x19001d,'region':_0x1a4028});_0xa28b8d['listBuckets']({},function(_0x471375,_0x197fc2){if(_0x471375){return _0x16725d(_0x471375);}else{return _0x1bfa1e(_0x197fc2);}});});}function createBucket(_0x100d83,_0x362eaa,_0x1fd5b6,_0xbf7d5){return new Promise(function(_0x7ef322,_0x4e3091){var _0x579706=new AWS['S3']({'accessKeyId':_0x362eaa,'secretAccessKey':_0x100d83,'region':_0x1fd5b6});_0x579706[_0x2cb4('0x69')]({'Bucket':_0xbf7d5},function(_0xf0c5ae,_0x58b5c5){if(_0xf0c5ae){return _0x4e3091(_0xf0c5ae);}else{return _0x7ef322(_0x58b5c5);}});});}function uploadFile(_0x486419,_0x1ff8d9,_0x44fb4e,_0x41eff1,_0x412c06,_0x903d84){return new Promise(function(_0x3969c3,_0x38d9c6){var _0x47546f=new AWS['S3']({'accessKeyId':_0x1ff8d9,'secretAccessKey':_0x486419,'region':_0x44fb4e});_0x47546f['upload']({'Bucket':_0x41eff1,'Key':_0x412c06,'Body':_0x903d84},function(_0x51f9cd,_0x510e91){if(_0x51f9cd){return _0x38d9c6(_0x51f9cd);}else{return _0x3969c3(_0x510e91);}});});}function startTranscribe(_0x1743df,_0x908eb1,_0x46468d,_0x1c2918,_0x491a92,_0x3ed342){return new Promise(function(_0x20c8f2,_0x11a876){var _0xf27c78=new AWS['TranscribeService']({'accessKeyId':_0x908eb1,'secretAccessKey':_0x1743df,'region':_0x46468d});_0xf27c78[_0x2cb4('0x6a')]({'TranscriptionJobName':_0x1c2918,'LanguageCode':_0x491a92,'Media':{'MediaFileUri':_0x3ed342}},function(_0x51aa93,_0x4067d6){if(_0x51aa93){return _0x11a876(_0x51aa93);}else{return _0x20c8f2(_0x4067d6);}});});}function transcribe(_0x382e06,_0x4710cb,_0x4e51c5,_0x19f393,_0x11935d,_0x7efa13,_0x4d1951){return new Promise(function(_0x26e21f,_0x59541b){var _0x5857ad={};logger[_0x2cb4('0x64')](util[_0x2cb4('0x31')](_0x2cb4('0x6b'),_0x382e06,_0x11935d));return uploadFile(_0x4710cb,_0x4e51c5,_0x19f393,_0x11935d,path[_0x2cb4('0x6c')](_0x7efa13),fs['readFileSync'](_0x7efa13))['then'](function(_0x1b282a){logger['info'](util[_0x2cb4('0x31')](_0x2cb4('0x6d'),_0x382e06,_0x11935d,_0x1b282a[_0x2cb4('0x6e')]));_0x5857ad[_0x2cb4('0x6f')]=_0x1b282a[_0x2cb4('0x70')];_0x5857ad[_0x2cb4('0x71')]=_0x1b282a[_0x2cb4('0x6e')];logger[_0x2cb4('0x64')](util[_0x2cb4('0x31')](_0x2cb4('0x72'),_0x382e06));return startTranscribe(_0x4710cb,_0x4e51c5,_0x19f393,uuidv4(),_0x4d1951,_0x1b282a[_0x2cb4('0x6e')]);})[_0x2cb4('0x23')](function(_0x56e4d3){logger[_0x2cb4('0x64')](util[_0x2cb4('0x31')](_0x2cb4('0x73'),_0x382e06,_0x56e4d3[_0x2cb4('0x74')][_0x2cb4('0x75')]));_0x5857ad[_0x2cb4('0x76')]=_0x56e4d3[_0x2cb4('0x74')]['TranscriptionJobName'];_0x5857ad[_0x2cb4('0x77')]=_0x56e4d3['TranscriptionJob'][_0x2cb4('0x78')];return _0x26e21f(_0x5857ad);})[_0x2cb4('0x44')](function(_0x34779e){return _0x59541b(_0x34779e);});});}exports[_0x2cb4('0x79')]=function(_0x2c2650,_0x547d03,_0x13db20){var _0x11a79f;var _0x517754;var _0x3dee8c;var _0x1f46ed=require(_0x2cb4('0x4e'));return db[_0x2cb4('0x2a')][_0x2cb4('0x7a')]({'where':{'id':_0x2c2650['params']['id']}})[_0x2cb4('0x23')](function(_0x457742){if(_0x457742){var _0x2ae172=util[_0x2cb4('0x31')](_0x2cb4('0x51'),_0x457742[_0x2cb4('0x50')]);if(fs[_0x2cb4('0x5d')](_0x2ae172)){cypher=!![];return _0x1f46ed[_0x2cb4('0x52')](_0x2ae172,_0x457742[_0x2cb4('0x50')],config[_0x2cb4('0x53')]['recording'])['then'](function(){return _0x457742;});}return _0x457742;}})['then'](function(_0x1ed13c){if(!_0x1ed13c){throw new db[(_0x2cb4('0x5e'))][(_0x2cb4('0x54'))](_0x2cb4('0x7b'));}_0x517754=_0x1ed13c;return db[_0x2cb4('0x7c')][_0x2cb4('0x7a')]({'where':{'id':0x1}});})[_0x2cb4('0x23')](handleEntityNotFound(_0x547d03,null))[_0x2cb4('0x23')](function(_0xd7c8ad){if(_0xd7c8ad){_0x11a79f=_0xd7c8ad;if(!_0x11a79f['transcribe']||!_0x11a79f['transcribeAccountId']||!_0x11a79f[_0x2cb4('0x7d')]||!_0x11a79f[_0x2cb4('0x7e')]||!_0x11a79f[_0x2cb4('0x6f')]){throw new db[(_0x2cb4('0x5e'))][(_0x2cb4('0x54'))](_0x2cb4('0x7f'));}if(_0x2c2650['body'][_0x2cb4('0x80')]&&(!_0x11a79f['sentiment']||!_0x11a79f[_0x2cb4('0x81')]||!_0x11a79f[_0x2cb4('0x82')]||!_0x11a79f[_0x2cb4('0x7e')]||!_0x11a79f[_0x2cb4('0x6f')])){throw new db['Sequelize'][(_0x2cb4('0x54'))](_0x2cb4('0x83'));}return db['CloudProvider'][_0x2cb4('0x7a')]({'where':{'id':_0x11a79f[_0x2cb4('0x84')]}});}})[_0x2cb4('0x23')](function(_0x34566b){if(!_0x34566b){throw new db[(_0x2cb4('0x5e'))][(_0x2cb4('0x54'))](_0x2cb4('0x85'));}if(!_0x34566b[_0x2cb4('0x86')]||!_0x34566b[_0x2cb4('0x87')]){throw new db[(_0x2cb4('0x5e'))][(_0x2cb4('0x54'))](_0x2cb4('0x88'));}_0x3dee8c=_0x34566b;return getBucketslist(_0x3dee8c[_0x2cb4('0x86')],_0x3dee8c[_0x2cb4('0x87')],_0x11a79f[_0x2cb4('0x7d')]);})[_0x2cb4('0x23')](function(_0x5be38c){if(_0x5be38c&&_0x5be38c[_0x2cb4('0x89')]){var _0x25b147=_[_0x2cb4('0x4b')](_0x5be38c[_0x2cb4('0x89')],function(_0xb1a149){return _0xb1a149[_0x2cb4('0x8a')]===_0x11a79f[_0x2cb4('0x6f')];});if(!_0x25b147){logger[_0x2cb4('0x64')](util['format'](_0x2cb4('0x8b'),_0x2c2650[_0x2cb4('0x46')]['id'],_0x11a79f[_0x2cb4('0x6f')]));return createBucket(_0x3dee8c['data1'],_0x3dee8c[_0x2cb4('0x87')],_0x11a79f['transcribeRegion'],_0x11a79f[_0x2cb4('0x6f')]);}logger[_0x2cb4('0x64')](util[_0x2cb4('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2c2650[_0x2cb4('0x46')]['id'],_0x11a79f[_0x2cb4('0x6f')]));return;}})[_0x2cb4('0x23')](function(_0x572ccb){if(_0x517754[_0x2cb4('0x77')]===_0x2cb4('0x8c')){return transcribe(_0x2c2650[_0x2cb4('0x46')]['id'],_0x3dee8c[_0x2cb4('0x86')],_0x3dee8c[_0x2cb4('0x87')],_0x11a79f[_0x2cb4('0x7d')],_0x11a79f[_0x2cb4('0x6f')],_0x517754[_0x2cb4('0x50')],_0x11a79f[_0x2cb4('0x7e')]);}else{logger['info'](util[_0x2cb4('0x31')](_0x2cb4('0x8d'),_0x2c2650[_0x2cb4('0x46')]['id']));return{'transcribeStatus':_0x2cb4('0x8e')};}})['then'](function(_0x513a0d){if(_0x513a0d){_0x513a0d[_0x2cb4('0x8f')]=_0x2c2650[_0x2cb4('0x4a')][_0x2cb4('0x80')];return _0x517754[_0x2cb4('0x90')](_0x513a0d);}})['then'](respondWithResult(_0x547d03,null))[_0x2cb4('0x44')](handleError(_0x547d03,null));};function writeFile(_0x537aad,_0xecd691){return new Promise(function(_0x4f9b77,_0x54435){fs[_0x2cb4('0x91')](_0xecd691,_0x537aad,function(_0x3dbdf2,_0x2b74c2){if(_0x3dbdf2){return _0x54435(_0x3dbdf2);}else{return _0x4f9b77(_0x2b74c2);}});});}exports['downloadTranscribe']=function(_0x18c0e0,_0x1bd144,_0x2b83fc){return db[_0x2cb4('0x2a')]['findOne']({'where':{'id':_0x18c0e0['params']['id']}})['then'](handleEntityNotFound(_0x1bd144))['then'](function(_0x2c7c13){if(_0x2c7c13&&_0x2c7c13['fileText']){var _0x3ff677=_0x2c7c13[_0x2cb4('0x92')];var _0x5049a4=config[_0x2cb4('0x93')]+_0x2cb4('0x94')+_0x2c7c13['id']+_0x2cb4('0x95');if(fs[_0x2cb4('0x5d')](_0x5049a4)){return _0x5049a4;}return writeFile(_0x3ff677,_0x5049a4)[_0x2cb4('0x23')](function(){return _0x5049a4;});}else{throw new db[(_0x2cb4('0x5e'))][(_0x2cb4('0x54'))](_0x2cb4('0x96'));}})[_0x2cb4('0x23')](function(_0x3fa4cc){return _0x1bd144[_0x2cb4('0x4d')](_0x3fa4cc);})[_0x2cb4('0x44')](handleError(_0x1bd144));};
\ No newline at end of file
+var _0x0149=['root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','then','destroy','error','name','send','index','map','fieldName','type','key','model','format','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceRecording','findAll','show','rawAttributes','find','catch','create','update','body','params','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','filename','extname','unlink','VoiceRecording\x20not\x20found','../../components/encryptor','sequelize','MD5','token','$and','push','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Sequelize','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0149,0x131));var _0x9014=function(_0x2ee552,_0xeacfeb){_0x2ee552=_0x2ee552-0x0;var _0x5dc602=_0x0149[_0x2ee552];return _0x5dc602;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9014('0x0'));var zipdir=require(_0x9014('0x1'));var jsonpatch=require(_0x9014('0x2'));var rp=require(_0x9014('0x3'));var moment=require(_0x9014('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9014('0x5'));var path=require(_0x9014('0x6'));var sox=require(_0x9014('0x7'));var csv=require(_0x9014('0x8'));var ejs=require(_0x9014('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9014('0xa'));var squel=require(_0x9014('0xb'));var crypto=require(_0x9014('0xc'));var jsforce=require(_0x9014('0xd'));var deskjs=require(_0x9014('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9014('0xf'));var AWS=require(_0x9014('0x10'));var uuidv4=require(_0x9014('0x11'));var Redis=require(_0x9014('0x12'));var authService=require(_0x9014('0x13'));var qs=require(_0x9014('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9014('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9014('0x16'));var db=require(_0x9014('0x17'))['db'];function respondWithStatusCode(_0x178f47,_0x1613c4){_0x1613c4=_0x1613c4||0xcc;return function(_0x262cf1){if(_0x262cf1){return _0x178f47[_0x9014('0x18')](_0x1613c4);}return _0x178f47[_0x9014('0x19')](_0x1613c4)[_0x9014('0x1a')]();};}function respondWithResult(_0x23f65b,_0x1afb0e){_0x1afb0e=_0x1afb0e||0xc8;return function(_0x10f78f){if(_0x10f78f){return _0x23f65b[_0x9014('0x19')](_0x1afb0e)['json'](_0x10f78f);}};}function respondWithFilteredResult(_0x83931c,_0x2b86d7){return function(_0x6a4f8f){if(_0x6a4f8f){var _0x310bf7=typeof _0x2b86d7[_0x9014('0x1b')]==='undefined'&&typeof _0x2b86d7[_0x9014('0x1c')]===_0x9014('0x1d');var _0x41d6da=_0x6a4f8f[_0x9014('0x1e')];var _0x29bd44=_0x310bf7?0x0:_0x2b86d7[_0x9014('0x1b')];var _0x54868b=_0x310bf7?_0x6a4f8f[_0x9014('0x1e')]:_0x2b86d7['offset']+_0x2b86d7[_0x9014('0x1c')];var _0x142278;if(_0x54868b>=_0x41d6da){_0x54868b=_0x41d6da;_0x142278=0xc8;}else{_0x142278=0xce;}_0x83931c[_0x9014('0x19')](_0x142278);return _0x83931c[_0x9014('0x1f')]('Content-Range',_0x29bd44+'-'+_0x54868b+'/'+_0x41d6da)[_0x9014('0x20')](_0x6a4f8f);}return null;};}function patchUpdates(_0x26eb20){return function(_0x4a4911){try{jsonpatch[_0x9014('0x21')](_0x4a4911,_0x26eb20,!![]);}catch(_0x4e98b8){return BPromise[_0x9014('0x22')](_0x4e98b8);}return _0x4a4911[_0x9014('0x23')]();};}function saveUpdates(_0x380b8a,_0x26df15){return function(_0x384d69){if(_0x384d69){return _0x384d69['update'](_0x380b8a)[_0x9014('0x24')](function(_0x641b39){return _0x641b39;});}return null;};}function removeEntity(_0x538268,_0x5c907d){return function(_0x325078){if(_0x325078){return _0x325078[_0x9014('0x25')]()[_0x9014('0x24')](function(){_0x538268[_0x9014('0x19')](0xcc)[_0x9014('0x1a')]();});}};}function handleEntityNotFound(_0x302994,_0x169a37){return function(_0xfd2e42){if(!_0xfd2e42){_0x302994[_0x9014('0x18')](0x194);}return _0xfd2e42;};}function handleError(_0x146f9e,_0x5c6bc2){_0x5c6bc2=_0x5c6bc2||0x1f4;return function(_0x16a8de){logger[_0x9014('0x26')](_0x16a8de['stack']);if(_0x16a8de[_0x9014('0x27')]){delete _0x16a8de['name'];}_0x146f9e[_0x9014('0x19')](_0x5c6bc2)[_0x9014('0x28')](_0x16a8de);};}exports[_0x9014('0x29')]=function(_0x3e88bb,_0x4b7924){var _0x4b5885={},_0x50f3a4={},_0x336d08={'count':0x0,'rows':[]};var _0x1dc613=_[_0x9014('0x2a')](db['VoiceRecording']['rawAttributes'],function(_0x1d24db){return{'name':_0x1d24db[_0x9014('0x2b')],'type':_0x1d24db[_0x9014('0x2c')][_0x9014('0x2d')]};});_0x50f3a4[_0x9014('0x2e')]=_['differenceBy'](_[_0x9014('0x2a')](_0x1dc613,_0x9014('0x27')),[_0x9014('0x2f')]);_0x50f3a4[_0x9014('0x30')]=_[_0x9014('0x31')](_0x3e88bb['query']);_0x50f3a4['filters']=_['intersection'](_0x50f3a4[_0x9014('0x2e')],_0x50f3a4['query']);_0x4b5885['attributes']=_[_0x9014('0x32')](_0x50f3a4['model'],qs['fields'](_0x3e88bb['query'][_0x9014('0x33')]));_0x4b5885['attributes']=_0x4b5885[_0x9014('0x34')][_0x9014('0x35')]?_0x4b5885[_0x9014('0x34')]:_0x50f3a4[_0x9014('0x2e')];if(!_0x3e88bb[_0x9014('0x30')][_0x9014('0x36')](_0x9014('0x37'))){_0x4b5885[_0x9014('0x1c')]=qs[_0x9014('0x1c')](_0x3e88bb[_0x9014('0x30')]['limit']);_0x4b5885[_0x9014('0x1b')]=qs['offset'](_0x3e88bb['query']['offset']);}_0x4b5885[_0x9014('0x38')]=qs['sort'](_0x3e88bb['query'][_0x9014('0x39')]);_0x4b5885[_0x9014('0x3a')]=qs[_0x9014('0x3b')](_[_0x9014('0x3c')](_0x3e88bb['query'],_0x50f3a4[_0x9014('0x3b')]),_0x1dc613);if(_0x3e88bb[_0x9014('0x30')][_0x9014('0x3d')]){_0x4b5885[_0x9014('0x3a')]=_[_0x9014('0x3e')](_0x4b5885[_0x9014('0x3a')],{'$or':_[_0x9014('0x2a')](_0x1dc613,function(_0x2edfe6){if(_0x2edfe6[_0x9014('0x2c')]!==_0x9014('0x3f')){var _0x596eea={};_0x596eea[_0x2edfe6[_0x9014('0x27')]]={'$like':'%'+_0x3e88bb['query'][_0x9014('0x3d')]+'%'};return _0x596eea;}})});}_0x4b5885=_[_0x9014('0x3e')]({},_0x4b5885,_0x3e88bb[_0x9014('0x40')]);var _0x39fe00={'where':_0x4b5885[_0x9014('0x3a')]};return db['VoiceRecording']['count'](_0x39fe00)[_0x9014('0x24')](function(_0x136eb1){_0x336d08[_0x9014('0x1e')]=_0x136eb1;if(_0x3e88bb[_0x9014('0x30')][_0x9014('0x41')]){_0x4b5885[_0x9014('0x42')]=[{'all':!![]}];}return db[_0x9014('0x43')][_0x9014('0x44')](_0x4b5885);})['then'](function(_0x30349d){_0x336d08['rows']=_0x30349d;return _0x336d08;})['then'](respondWithFilteredResult(_0x4b7924,_0x4b5885))['catch'](handleError(_0x4b7924,null));};exports[_0x9014('0x45')]=function(_0x4c42f6,_0x224153){var _0x550cbe={'raw':![],'where':{'id':_0x4c42f6['params']['id']}},_0x4b2e96={};_0x4b2e96['model']=_[_0x9014('0x31')](db[_0x9014('0x43')][_0x9014('0x46')]);_0x4b2e96[_0x9014('0x30')]=_[_0x9014('0x31')](_0x4c42f6[_0x9014('0x30')]);_0x4b2e96['filters']=_[_0x9014('0x32')](_0x4b2e96[_0x9014('0x2e')],_0x4b2e96[_0x9014('0x30')]);_0x550cbe[_0x9014('0x34')]=_[_0x9014('0x32')](_0x4b2e96[_0x9014('0x2e')],qs['fields'](_0x4c42f6[_0x9014('0x30')][_0x9014('0x33')]));_0x550cbe[_0x9014('0x34')]=_0x550cbe[_0x9014('0x34')][_0x9014('0x35')]?_0x550cbe[_0x9014('0x34')]:_0x4b2e96[_0x9014('0x2e')];if(_0x4c42f6['query'][_0x9014('0x41')]){_0x550cbe[_0x9014('0x42')]=[{'all':!![]}];}_0x550cbe=_['merge']({},_0x550cbe,_0x4c42f6[_0x9014('0x40')]);return db[_0x9014('0x43')][_0x9014('0x47')](_0x550cbe)[_0x9014('0x24')](handleEntityNotFound(_0x224153,null))[_0x9014('0x24')](respondWithResult(_0x224153,null))[_0x9014('0x48')](handleError(_0x224153,null));};exports[_0x9014('0x49')]=function(_0x1e349e,_0x289b0e){return db[_0x9014('0x43')][_0x9014('0x49')](_0x1e349e['body'],{})[_0x9014('0x24')](respondWithResult(_0x289b0e,0xc9))['catch'](handleError(_0x289b0e,null));};exports[_0x9014('0x4a')]=function(_0x1896f6,_0xd04a99){if(_0x1896f6[_0x9014('0x4b')]['id']){delete _0x1896f6[_0x9014('0x4b')]['id'];}return db[_0x9014('0x43')][_0x9014('0x47')]({'where':{'id':_0x1896f6[_0x9014('0x4c')]['id']}})[_0x9014('0x24')](handleEntityNotFound(_0xd04a99,null))[_0x9014('0x24')](saveUpdates(_0x1896f6[_0x9014('0x4b')],null))[_0x9014('0x24')](respondWithResult(_0xd04a99,null))[_0x9014('0x48')](handleError(_0xd04a99,null));};exports[_0x9014('0x4d')]=function(_0x7a9afc,_0x12c269){return db['VoiceRecording'][_0x9014('0x4d')]()['then'](respondWithResult(_0x12c269,null))[_0x9014('0x48')](handleError(_0x12c269,null));};exports[_0x9014('0x4e')]=function(_0x2665f1,_0x49e921,_0x945227){var _0x14fb6e=require('../../components/encryptor');var _0x585c4f=![];var _0x38745b={};if(_0x2665f1[_0x9014('0x30')][_0x9014('0x2c')]&&_0x2665f1['query'][_0x9014('0x2c')]===_0x9014('0x4f')){_0x38745b['uniqueid']=_0x2665f1['params']['id'];}else{_0x38745b['id']=_0x2665f1['params']['id'];}return db[_0x9014('0x43')][_0x9014('0x47')]({'where':_0x38745b,'attributes':['id','value'],'raw':!![]})[_0x9014('0x24')](handleEntityNotFound(_0x49e921,null))[_0x9014('0x24')](function(_0x31120f){if(_0x31120f){var _0x25b0d9=_0x31120f[_0x9014('0x50')];var _0x20d0ec=util[_0x9014('0x2f')](_0x9014('0x51'),_0x25b0d9);if(fs[_0x9014('0x52')](_0x20d0ec)){_0x585c4f=!![];return _0x14fb6e[_0x9014('0x53')](_0x20d0ec,_0x25b0d9,config[_0x9014('0x54')][_0x9014('0x55')])[_0x9014('0x24')](function(){return _0x31120f;});}return _0x31120f;}})[_0x9014('0x24')](function(_0x457d03){if(_0x457d03){var _0x2ed909=_0x457d03[_0x9014('0x50')];if(!fs[_0x9014('0x52')](_0x2ed909)){throw new db['Sequelize'][(_0x9014('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x457d03[_0x9014('0x57')]){return _0x49e921[_0x9014('0x4e')](_0x2ed909,_0x457d03[_0x9014('0x57')]+path[_0x9014('0x58')](_0x2ed909),function(){if(_0x585c4f){fs['unlink'](_0x2ed909);}});}else{return _0x49e921['download'](_0x2ed909,function(_0x30e08d){if(_0x585c4f){fs[_0x9014('0x59')](_0x2ed909);}});}}})[_0x9014('0x48')](function(_0x4539df){if(_0x4539df['message']===_0x9014('0x5a')){_0x49e921[_0x9014('0x19')](0x194)[_0x9014('0x28')]('Not\x20found');}else{return handleError(_0x49e921,null);}});};exports['downloads']=function(_0x3ef1f6,_0x469b04,_0x5683b0){var _0x2631d=require(_0x9014('0x5b'));var _0x2277f6=![];var _0x43c6cd={'$and':[db[_0x9014('0x5c')]['where'](db[_0x9014('0x5c')]['fn'](_0x9014('0x5d'),db[_0x9014('0x5c')]['col'](_0x9014('0x4f'))),_0x3ef1f6[_0x9014('0x30')][_0x9014('0x5e')])]};if(_0x3ef1f6[_0x9014('0x30')]['type']&&_0x3ef1f6['query'][_0x9014('0x2c')]==='uniqueid'){_0x43c6cd[_0x9014('0x5f')][_0x9014('0x60')]({'uniqueid':_0x3ef1f6['params']['id']});}else{_0x43c6cd['$and']['push']({'id':_0x3ef1f6['params']['id']});}return db[_0x9014('0x43')][_0x9014('0x47')]({'where':_0x43c6cd,'attributes':['id',_0x9014('0x50')],'raw':!![]})[_0x9014('0x24')](handleEntityNotFound(_0x469b04,null))[_0x9014('0x24')](function(_0x51effe){if(_0x51effe){var _0x3d7751=util[_0x9014('0x2f')](_0x9014('0x51'),_0x51effe[_0x9014('0x50')]);if(fs['existsSync'](_0x3d7751)){_0x2277f6=!![];return _0x2631d['decryptFile'](_0x3d7751,_0x51effe['value'],config[_0x9014('0x54')][_0x9014('0x55')])[_0x9014('0x24')](function(){return _0x51effe;});}return _0x51effe;}})[_0x9014('0x24')](function(_0xf5824){if(_0xf5824){if(!fs['existsSync'](_0xf5824[_0x9014('0x50')])){throw new db['Sequelize'][(_0x9014('0x56'))](_0x9014('0x5a'));}if(_0xf5824['filename']){return _0x469b04[_0x9014('0x4e')](_0xf5824[_0x9014('0x50')],_0xf5824[_0x9014('0x57')]+path[_0x9014('0x58')](_0xf5824[_0x9014('0x50')]),function(){if(_0x2277f6){fs[_0x9014('0x59')](_0xf5824['value']);}});}else{return _0x469b04[_0x9014('0x4e')](_0xf5824['value'],function(_0x554362){if(_0x2277f6){fs[_0x9014('0x59')](_0xf5824[_0x9014('0x50')]);}});}}})[_0x9014('0x48')](handleError(_0x469b04,null));};exports[_0x9014('0x25')]=function(_0x7c3a09,_0x10267a){return db[_0x9014('0x43')][_0x9014('0x47')]({'where':{'id':_0x7c3a09['params']['id']}})['then'](function(_0x458d4a){if(_['isNil'](_0x458d4a)){throw new ReferenceError(_0x9014('0x61'));}return _0x458d4a;})[_0x9014('0x24')](function(_0x55b6ad){var _0x191323=_0x55b6ad[_0x9014('0x50')];logger[_0x9014('0x62')](_0x9014('0x63'),_0x191323);if(!_[_0x9014('0x64')](_0x55b6ad[_0x9014('0x50')])&&fs[_0x9014('0x52')](_0x191323)){logger[_0x9014('0x62')](_0x9014('0x65')+_0x191323+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x9014('0x66')](_0x191323);}_0x191323=_0x191323+_0x9014('0x67');if(!_[_0x9014('0x64')](_0x55b6ad['value'])&&fs[_0x9014('0x52')](_0x191323)){logger[_0x9014('0x62')]('File:\x20\x22'+_0x191323+_0x9014('0x68'));fs[_0x9014('0x66')](_0x191323);}return _0x55b6ad;})['then'](function(_0x4bf156){if(!_0x4bf156)throw new InternalError();return _0x4bf156['destroy']();})[_0x9014('0x24')](function(){_0x10267a[_0x9014('0x19')](0xcc)[_0x9014('0x1a')]();})[_0x9014('0x48')](handleError(_0x10267a,null));};function getBucketslist(_0x112cc5,_0x55fd1b,_0x2e339a){return new Promise(function(_0x346a66,_0x115ca0){var _0x39a50f=new AWS['S3']({'accessKeyId':_0x55fd1b,'secretAccessKey':_0x112cc5,'region':_0x2e339a});_0x39a50f[_0x9014('0x69')]({},function(_0x2e7a9a,_0xbed7c0){if(_0x2e7a9a){return _0x115ca0(_0x2e7a9a);}else{return _0x346a66(_0xbed7c0);}});});}function createBucket(_0x39cbc1,_0x25b07c,_0x1874d3,_0x100ea5){return new Promise(function(_0x2d75db,_0x4744b7){var _0x569dfd=new AWS['S3']({'accessKeyId':_0x25b07c,'secretAccessKey':_0x39cbc1,'region':_0x1874d3});_0x569dfd[_0x9014('0x6a')]({'Bucket':_0x100ea5},function(_0x53edd5,_0x588153){if(_0x53edd5){return _0x4744b7(_0x53edd5);}else{return _0x2d75db(_0x588153);}});});}function uploadFile(_0x4daf62,_0x12fcdc,_0x417c94,_0x36f05c,_0x38ffff,_0x27b3a7){return new Promise(function(_0x5e7d47,_0x570e4c){var _0x1bd3ee=new AWS['S3']({'accessKeyId':_0x12fcdc,'secretAccessKey':_0x4daf62,'region':_0x417c94});_0x1bd3ee[_0x9014('0x6b')]({'Bucket':_0x36f05c,'Key':_0x38ffff,'Body':_0x27b3a7},function(_0x21b30d,_0x5db972){if(_0x21b30d){return _0x570e4c(_0x21b30d);}else{return _0x5e7d47(_0x5db972);}});});}function startTranscribe(_0x36a29d,_0x5b00e6,_0x5d0a60,_0x512e6a,_0x2a29dc,_0xfe52a8){return new Promise(function(_0x28e781,_0x4f9315){var _0x114814=new AWS[(_0x9014('0x6c'))]({'accessKeyId':_0x5b00e6,'secretAccessKey':_0x36a29d,'region':_0x5d0a60});_0x114814[_0x9014('0x6d')]({'TranscriptionJobName':_0x512e6a,'LanguageCode':_0x2a29dc,'Media':{'MediaFileUri':_0xfe52a8}},function(_0x3e7ddd,_0x1fb05d){if(_0x3e7ddd){return _0x4f9315(_0x3e7ddd);}else{return _0x28e781(_0x1fb05d);}});});}function transcribe(_0x117000,_0x51e7ba,_0x3cf77b,_0x1f6923,_0x199d53,_0x4841c5,_0x4ab6a2){return new Promise(function(_0x17fa55,_0x2339bb){var _0x4f1814={};logger[_0x9014('0x62')](util[_0x9014('0x2f')](_0x9014('0x6e'),_0x117000,_0x199d53));return uploadFile(_0x51e7ba,_0x3cf77b,_0x1f6923,_0x199d53,path['basename'](_0x4841c5),fs[_0x9014('0x6f')](_0x4841c5))[_0x9014('0x24')](function(_0x291006){logger[_0x9014('0x62')](util[_0x9014('0x2f')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x117000,_0x199d53,_0x291006[_0x9014('0x70')]));_0x4f1814[_0x9014('0x71')]=_0x291006[_0x9014('0x72')];_0x4f1814['location']=_0x291006[_0x9014('0x70')];logger[_0x9014('0x62')](util[_0x9014('0x2f')](_0x9014('0x73'),_0x117000));return startTranscribe(_0x51e7ba,_0x3cf77b,_0x1f6923,uuidv4(),_0x4ab6a2,_0x291006[_0x9014('0x70')]);})[_0x9014('0x24')](function(_0x513804){logger[_0x9014('0x62')](util[_0x9014('0x2f')](_0x9014('0x74'),_0x117000,_0x513804[_0x9014('0x75')][_0x9014('0x76')]));_0x4f1814[_0x9014('0x77')]=_0x513804[_0x9014('0x75')]['TranscriptionJobName'];_0x4f1814[_0x9014('0x78')]=_0x513804[_0x9014('0x75')][_0x9014('0x79')];return _0x17fa55(_0x4f1814);})['catch'](function(_0x368272){return _0x2339bb(_0x368272);});});}exports[_0x9014('0x7a')]=function(_0x44abba,_0x343b5e,_0x42df36){var _0x56a55e;var _0x5bb340;var _0x217b55;var _0x1aecdb=require(_0x9014('0x5b'));return db[_0x9014('0x43')][_0x9014('0x7b')]({'where':{'id':_0x44abba['params']['id']}})['then'](function(_0xdd6638){if(_0xdd6638){var _0x40efe0=util[_0x9014('0x2f')]('%s.cypher',_0xdd6638[_0x9014('0x50')]);if(fs['existsSync'](_0x40efe0)){cypher=!![];return _0x1aecdb['decryptFile'](_0x40efe0,_0xdd6638['value'],config[_0x9014('0x54')][_0x9014('0x55')])[_0x9014('0x24')](function(){return _0xdd6638;});}return _0xdd6638;}})['then'](function(_0x22054b){if(!_0x22054b){throw new db[(_0x9014('0x7c'))][(_0x9014('0x56'))](_0x9014('0x7d'));}_0x5bb340=_0x22054b;return db[_0x9014('0x7e')][_0x9014('0x7b')]({'where':{'id':0x1}});})[_0x9014('0x24')](handleEntityNotFound(_0x343b5e,null))[_0x9014('0x24')](function(_0x47c2a0){if(_0x47c2a0){_0x56a55e=_0x47c2a0;if(!_0x56a55e[_0x9014('0x7f')]||!_0x56a55e[_0x9014('0x80')]||!_0x56a55e[_0x9014('0x81')]||!_0x56a55e['language']||!_0x56a55e[_0x9014('0x71')]){throw new db[(_0x9014('0x7c'))][(_0x9014('0x56'))](_0x9014('0x82'));}if(_0x44abba[_0x9014('0x4b')][_0x9014('0x83')]&&(!_0x56a55e[_0x9014('0x84')]||!_0x56a55e[_0x9014('0x85')]||!_0x56a55e[_0x9014('0x86')]||!_0x56a55e['language']||!_0x56a55e[_0x9014('0x71')])){throw new db['Sequelize'][(_0x9014('0x56'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x9014('0x87')]['findOne']({'where':{'id':_0x56a55e[_0x9014('0x80')]}});}})[_0x9014('0x24')](function(_0x490f0b){if(!_0x490f0b){throw new db[(_0x9014('0x7c'))][(_0x9014('0x56'))](_0x9014('0x88'));}if(!_0x490f0b[_0x9014('0x89')]||!_0x490f0b['data2']){throw new db[(_0x9014('0x7c'))][(_0x9014('0x56'))]('Cloud\x20Provider\x20not\x20configured');}_0x217b55=_0x490f0b;return getBucketslist(_0x217b55['data1'],_0x217b55[_0x9014('0x8a')],_0x56a55e[_0x9014('0x81')]);})['then'](function(_0x8e8f3){if(_0x8e8f3&&_0x8e8f3[_0x9014('0x8b')]){var _0x2523f6=_['find'](_0x8e8f3[_0x9014('0x8b')],function(_0x321ae3){return _0x321ae3['Name']===_0x56a55e[_0x9014('0x71')];});if(!_0x2523f6){logger['info'](util[_0x9014('0x2f')](_0x9014('0x8c'),_0x44abba[_0x9014('0x4c')]['id'],_0x56a55e[_0x9014('0x71')]));return createBucket(_0x217b55['data1'],_0x217b55['data2'],_0x56a55e[_0x9014('0x81')],_0x56a55e['bucket']);}logger[_0x9014('0x62')](util['format'](_0x9014('0x8d'),_0x44abba[_0x9014('0x4c')]['id'],_0x56a55e[_0x9014('0x71')]));return;}})[_0x9014('0x24')](function(_0x7d4f24){if(_0x5bb340[_0x9014('0x78')]==='NEW'){return transcribe(_0x44abba[_0x9014('0x4c')]['id'],_0x217b55['data1'],_0x217b55['data2'],_0x56a55e[_0x9014('0x81')],_0x56a55e['bucket'],_0x5bb340[_0x9014('0x50')],_0x56a55e['language']);}else{logger[_0x9014('0x62')](util[_0x9014('0x2f')](_0x9014('0x8e'),_0x44abba['params']['id']));return{'transcribeStatus':_0x9014('0x8f')};}})[_0x9014('0x24')](function(_0x4bcf88){if(_0x4bcf88){_0x4bcf88[_0x9014('0x90')]=_0x44abba[_0x9014('0x4b')][_0x9014('0x83')];return _0x5bb340['updateAttributes'](_0x4bcf88);}})[_0x9014('0x24')](respondWithResult(_0x343b5e,null))[_0x9014('0x48')](handleError(_0x343b5e,null));};function writeFile(_0x53cc78,_0x135146){return new Promise(function(_0x328778,_0x52b4ec){fs[_0x9014('0x91')](_0x135146,_0x53cc78,function(_0x5135a1,_0x1a9079){if(_0x5135a1){return _0x52b4ec(_0x5135a1);}else{return _0x328778(_0x1a9079);}});});}exports[_0x9014('0x92')]=function(_0x445c48,_0x740c3a,_0x254c37){return db['VoiceRecording'][_0x9014('0x7b')]({'where':{'id':_0x445c48['params']['id']}})[_0x9014('0x24')](handleEntityNotFound(_0x740c3a))[_0x9014('0x24')](function(_0x403aa2){if(_0x403aa2&&_0x403aa2['fileText']){var _0x5614=_0x403aa2[_0x9014('0x93')];var _0x5a012a=config[_0x9014('0x94')]+_0x9014('0x95')+_0x403aa2['id']+'.txt';if(fs[_0x9014('0x52')](_0x5a012a)){return _0x5a012a;}return writeFile(_0x5614,_0x5a012a)[_0x9014('0x24')](function(){return _0x5a012a;});}else{throw new db[(_0x9014('0x7c'))][(_0x9014('0x56'))](_0x9014('0x96'));}})[_0x9014('0x24')](function(_0x54c6be){return _0x740c3a[_0x9014('0x4e')](_0x54c6be);})[_0x9014('0x48')](handleError(_0x740c3a));};
\ No newline at end of file
index 1173615..b8b9a01 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xea92=['define','voice_recordings','uniqueid','lodash','util','moment','bluebird','request-promise','path','./voiceRecording.attributes','exports'];(function(_0x2404c0,_0xe15b8c){var _0x4424d6=function(_0x4e6bcf){while(--_0x4e6bcf){_0x2404c0['push'](_0x2404c0['shift']());}};_0x4424d6(++_0xe15b8c);}(_0xea92,0x1bb));var _0x2ea9=function(_0x50a054,_0x4a3763){_0x50a054=_0x50a054-0x0;var _0x121dd9=_0xea92[_0x50a054];return _0x121dd9;};'use strict';var _=require(_0x2ea9('0x0'));var util=require(_0x2ea9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2ea9('0x2'));var BPromise=require(_0x2ea9('0x3'));var rp=require(_0x2ea9('0x4'));var fs=require('fs');var path=require(_0x2ea9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2ea9('0x6'));module[_0x2ea9('0x7')]=function(_0x2fc4bb,_0xe0d6ef){return _0x2fc4bb[_0x2ea9('0x8')]('VoiceRecording',attributes,{'tableName':_0x2ea9('0x9'),'paranoid':![],'indexes':[{'name':_0x2ea9('0xa'),'fields':[_0x2ea9('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x72a0=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceRecording.attributes','define','VoiceRecording','voice_recordings'];(function(_0x4061dd,_0x49333c){var _0x2bfd4b=function(_0x4899d2){while(--_0x4899d2){_0x4061dd['push'](_0x4061dd['shift']());}};_0x2bfd4b(++_0x49333c);}(_0x72a0,0x194));var _0x072a=function(_0x260d5d,_0x4a21fb){_0x260d5d=_0x260d5d-0x0;var _0x589b30=_0x72a0[_0x260d5d];return _0x589b30;};'use strict';var _=require(_0x072a('0x0'));var util=require(_0x072a('0x1'));var logger=require(_0x072a('0x2'))(_0x072a('0x3'));var moment=require(_0x072a('0x4'));var BPromise=require(_0x072a('0x5'));var rp=require(_0x072a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x072a('0x7'));var config=require('../../config/environment');var attributes=require(_0x072a('0x8'));module['exports']=function(_0x23100f,_0x597fd9){return _0x23100f[_0x072a('0x9')](_0x072a('0xa'),attributes,{'tableName':_0x072a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x072a('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
index a008fbf..b4f662f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa30a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','UpdateVoiceRecording','update','body','options','where','limit','debug','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x2bbbc2,_0x2fd8b9){var _0x1f0319=function(_0x30ba37){while(--_0x30ba37){_0x2bbbc2['push'](_0x2bbbc2['shift']());}};_0x1f0319(++_0x2fd8b9);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8af448,_0x14fe09,_0x42dc22){return new BPromise(function(_0x5d076a,_0xedbc45){return client[_0xaa30('0xb')](_0x8af448,_0x42dc22)[_0xaa30('0xc')](function(_0x59d028){logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,'request\x20sent');logger['debug'](_0xaa30('0xf'),_0x14fe09,'request\x20sent',JSON[_0xaa30('0x10')](_0x59d028));if(_0x59d028[_0xaa30('0x11')]){if(_0x59d028[_0xaa30('0x11')][_0xaa30('0x12')]===0x1f4){logger['error'](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0xedbc45(_0x59d028['error'][_0xaa30('0x13')]);}logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0x5d076a(_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);}else{logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,_0xaa30('0x14'));_0x5d076a(_0x59d028['result'][_0xaa30('0x13')]);}})['catch'](function(_0x5eb356){logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x5eb356);_0xedbc45(_0x5eb356);});});}exports[_0xaa30('0x15')]=function(_0x540e36){var _0x54fa49=this;return new Promise(function(_0x53f9fd,_0x23ad3b){return db['VoiceRecording'][_0xaa30('0x16')](_0x540e36[_0xaa30('0x17')],{'raw':_0x540e36['options']?_0x540e36['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')][_0xaa30('0x19')]||null:null,'attributes':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')]['attributes']||null:null,'limit':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')][_0xaa30('0x1a')]||null:null})[_0xaa30('0xc')](function(_0x1ff442){logger['info'](_0xaa30('0x15'),_0x540e36);logger[_0xaa30('0x1b')](_0xaa30('0x15'),_0x540e36,JSON[_0xaa30('0x10')](_0x1ff442));_0x53f9fd(_0x1ff442);})['catch'](function(_0x14d7fa){logger[_0xaa30('0x11')](_0xaa30('0x15'),_0x14d7fa[_0xaa30('0x13')],_0x540e36);_0x23ad3b(_0x54fa49[_0xaa30('0x11')](0x1f4,_0x14d7fa[_0xaa30('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x467850){var _0x465701=this;return new Promise(function(_0x5d4da8,_0xb043e4){var _0x5b3efb=require(_0xaa30('0x1c'));var _0x33a0c9;return db[_0xaa30('0x1d')][_0xaa30('0x1e')]({'attributes':['id',_0xaa30('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xaa30('0xc')](function(_0x6ff09a){_0x33a0c9=_0x6ff09a;return db[_0xaa30('0x20')][_0xaa30('0x21')](_0x467850[_0xaa30('0x17')]);})[_0xaa30('0xc')](function(_0x43003f){if(_0x33a0c9[_0xaa30('0x1f')]&&fs[_0xaa30('0x22')](_0x43003f[_0xaa30('0x23')])){var _0x1a3f64=util[_0xaa30('0x24')](_0xaa30('0x25'),_0x43003f['value']);return _0x5b3efb[_0xaa30('0x26')](_0x43003f[_0xaa30('0x23')],_0x1a3f64,config[_0xaa30('0x27')][_0xaa30('0x28')])[_0xaa30('0xc')](function(){fs[_0xaa30('0x29')](_0x43003f['value']);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x43003f;});}return _0x43003f;})[_0xaa30('0xc')](function(_0x407090){logger[_0xaa30('0xd')](_0xaa30('0x2a'),_0x467850);logger[_0xaa30('0x1b')]('CreateVoiceRecording',_0x467850,JSON['stringify'](_0x407090));_0x5d4da8(_0x407090);})[_0xaa30('0x2b')](function(_0x2d26fb){logger['error'](_0xaa30('0x2a'),_0x2d26fb['message'],_0x467850);_0xb043e4(_0x465701[_0xaa30('0x11')](0x1f4,_0x2d26fb['message']));});});};
\ No newline at end of file
+var _0xc1c6=['format','%s.cypher','value','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','update','options','raw','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','Setting','callRecordingEncryption','VoiceRecording','create','existsSync'];(function(_0x5df52c,_0x4b3466){var _0x1389a4=function(_0xddc268){while(--_0xddc268){_0x5df52c['push'](_0x5df52c['shift']());}};_0x1389a4(++_0x4b3466);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4f49dc,_0x2a335a){_0x4f49dc=_0x4f49dc-0x0;var _0x5b069f=_0xc1c6[_0x4f49dc];return _0x5b069f;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});}exports['UpdateVoiceRecording']=function(_0x137770){var _0x4ede06=this;return new Promise(function(_0x338dc2,_0x1a0ab9){return db['VoiceRecording'][_0x6c1c('0x13')](_0x137770['body'],{'raw':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x16')]||null:null,'attributes':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x17')]||null:null,'limit':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x18')]||null:null})[_0x6c1c('0x9')](function(_0x9c6c55){logger[_0x6c1c('0x11')](_0x6c1c('0x19'),_0x137770);logger[_0x6c1c('0xc')](_0x6c1c('0x19'),_0x137770,JSON[_0x6c1c('0xe')](_0x9c6c55));_0x338dc2(_0x9c6c55);})[_0x6c1c('0x12')](function(_0x96046a){logger[_0x6c1c('0xf')](_0x6c1c('0x19'),_0x96046a[_0x6c1c('0x10')],_0x137770);_0x1a0ab9(_0x4ede06[_0x6c1c('0xf')](0x1f4,_0x96046a[_0x6c1c('0x10')]));});});};exports[_0x6c1c('0x1a')]=function(_0x1b9d7d){var _0x2feaf4=this;return new Promise(function(_0x5f4568,_0x2595c3){var _0x4d73aa=require(_0x6c1c('0x1b'));var _0x4c23f8;return db[_0x6c1c('0x1c')]['findOne']({'attributes':['id',_0x6c1c('0x1d')],'where':{'id':0x1},'raw':!![]})[_0x6c1c('0x9')](function(_0x504348){_0x4c23f8=_0x504348;return db[_0x6c1c('0x1e')][_0x6c1c('0x1f')](_0x1b9d7d['body']);})[_0x6c1c('0x9')](function(_0x19a8f1){if(_0x4c23f8[_0x6c1c('0x1d')]&&fs[_0x6c1c('0x20')](_0x19a8f1['value'])){var _0x52c036=util[_0x6c1c('0x21')](_0x6c1c('0x22'),_0x19a8f1[_0x6c1c('0x23')]);return _0x4d73aa[_0x6c1c('0x24')](_0x19a8f1[_0x6c1c('0x23')],_0x52c036,config[_0x6c1c('0x25')]['recording'])[_0x6c1c('0x9')](function(){fs[_0x6c1c('0x26')](_0x19a8f1['value']);logger[_0x6c1c('0x11')](_0x6c1c('0x27'));return _0x19a8f1;});}return _0x19a8f1;})[_0x6c1c('0x9')](function(_0x15b6d2){logger['info'](_0x6c1c('0x1a'),_0x1b9d7d);logger[_0x6c1c('0xc')](_0x6c1c('0x1a'),_0x1b9d7d,JSON['stringify'](_0x15b6d2));_0x5f4568(_0x15b6d2);})[_0x6c1c('0x12')](function(_0x4e5767){logger[_0x6c1c('0xf')]('CreateVoiceRecording',_0x4e5767[_0x6c1c('0x10')],_0x1b9d7d);_0x2595c3(_0x2feaf4[_0x6c1c('0xf')](0x1f4,_0x4e5767[_0x6c1c('0x10')]));});});};
\ No newline at end of file
index 7fb129b..172d52d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbf43=['../../config/environment','get','isAuthenticated','index','/describe','post','create','update','delete','/:id','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0xbf43,0xa5));var _0x3bf4=function(_0x4690a4,_0x1daf10){_0x4690a4=_0x4690a4-0x0;var _0x2d4b32=_0xbf43[_0x4690a4];return _0x2d4b32;};'use strict';var multer=require(_0x3bf4('0x0'));var util=require(_0x3bf4('0x1'));var path=require(_0x3bf4('0x2'));var timeout=require('connect-timeout');var express=require(_0x3bf4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3bf4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3bf4('0x5'));var controller=require('./voiceTransferReport.controller');router[_0x3bf4('0x6')]('/',auth[_0x3bf4('0x7')](),controller[_0x3bf4('0x8')]);router[_0x3bf4('0x6')](_0x3bf4('0x9'),auth[_0x3bf4('0x7')](),controller['describe']);router[_0x3bf4('0x6')]('/:id',auth[_0x3bf4('0x7')](),controller['show']);router[_0x3bf4('0xa')]('/',auth[_0x3bf4('0x7')](),controller[_0x3bf4('0xb')]);router['put']('/:id',auth[_0x3bf4('0x7')](),controller[_0x3bf4('0xc')]);router[_0x3bf4('0xd')](_0x3bf4('0xe'),auth[_0x3bf4('0x7')](),controller[_0x3bf4('0xf')]);module[_0x3bf4('0x10')]=router;
\ No newline at end of file
+var _0x0c66=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x15b3cb,_0x2b4d05){var _0x106668=function(_0x422914){while(--_0x422914){_0x15b3cb['push'](_0x15b3cb['shift']());}};_0x106668(++_0x2b4d05);}(_0x0c66,0xb2));var _0x60c6=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x0c66[_0x1beef3];return _0x5af964;};'use strict';var multer=require(_0x60c6('0x0'));var util=require(_0x60c6('0x1'));var path=require(_0x60c6('0x2'));var timeout=require(_0x60c6('0x3'));var express=require(_0x60c6('0x4'));var router=express[_0x60c6('0x5')]();var fs_extra=require(_0x60c6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x60c6('0x7'));var config=require(_0x60c6('0x8'));var controller=require('./voiceTransferReport.controller');router[_0x60c6('0x9')]('/',auth[_0x60c6('0xa')](),controller[_0x60c6('0xb')]);router[_0x60c6('0x9')](_0x60c6('0xc'),auth[_0x60c6('0xa')](),controller[_0x60c6('0xd')]);router[_0x60c6('0x9')](_0x60c6('0xe'),auth[_0x60c6('0xa')](),controller[_0x60c6('0xf')]);router[_0x60c6('0x10')]('/',auth[_0x60c6('0xa')](),controller[_0x60c6('0x11')]);router[_0x60c6('0x12')](_0x60c6('0xe'),auth['isAuthenticated'](),controller[_0x60c6('0x13')]);router['delete'](_0x60c6('0xe'),auth[_0x60c6('0xa')](),controller[_0x60c6('0x14')]);module[_0x60c6('0x15')]=router;
\ No newline at end of file
index 5d202a8..60d7332 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9bdc=['sequelize','exports','ENUM','blind','STRING','Yes'];(function(_0x1879f7,_0x231de9){var _0x510026=function(_0x129c81){while(--_0x129c81){_0x1879f7['push'](_0x1879f7['shift']());}};_0x510026(++_0x231de9);}(_0x9bdc,0x156));var _0xc9bd=function(_0xd94842,_0x1b17b9){_0xd94842=_0xd94842-0x0;var _0x46fa3c=_0x9bdc[_0xd94842];return _0x46fa3c;};'use strict';var Sequelize=require(_0xc9bd('0x0'));var moment=require('moment');module[_0xc9bd('0x1')]={'type':{'type':Sequelize[_0xc9bd('0x2')](_0xc9bd('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xc9bd('0x4')]},'transferercalleridname':{'type':Sequelize[_0xc9bd('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xc9bd('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xc9bd('0x4')]},'transferercontext':{'type':Sequelize[_0xc9bd('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xc9bd('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xc9bd('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xc9bd('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xc9bd('0x4')]},'transfereecontext':{'type':Sequelize[_0xc9bd('0x4')]},'transfereeexten':{'type':Sequelize[_0xc9bd('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xc9bd('0x4')]},'isexternal':{'type':Sequelize[_0xc9bd('0x2')](_0xc9bd('0x5'),'No')},'context':{'type':Sequelize[_0xc9bd('0x4')]},'extension':{'type':Sequelize[_0xc9bd('0x4')]}};
\ No newline at end of file
+var _0xa2a6=['blind','STRING','Yes','sequelize','ENUM'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0xa2a6,0x80));var _0x6a2a=function(_0x82f311,_0x5a14ac){_0x82f311=_0x82f311-0x0;var _0x2ea11c=_0xa2a6[_0x82f311];return _0x2ea11c;};'use strict';var Sequelize=require(_0x6a2a('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x6a2a('0x1')](_0x6a2a('0x2'),'attended')},'result':{'type':Sequelize[_0x6a2a('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x6a2a('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x6a2a('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x6a2a('0x3')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x6a2a('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x6a2a('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x6a2a('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x6a2a('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x6a2a('0x3')]},'transfereecontext':{'type':Sequelize[_0x6a2a('0x3')]},'transfereeexten':{'type':Sequelize[_0x6a2a('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x6a2a('0x3')]},'isexternal':{'type':Sequelize[_0x6a2a('0x1')](_0x6a2a('0x4'),'No')},'context':{'type':Sequelize[_0x6a2a('0x3')]},'extension':{'type':Sequelize[_0x6a2a('0x3')]}};
\ No newline at end of file
index 9684b16..4014b03 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1dcf=['error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','offset','sort','where','pick','filter','merge','VIRTUAL','includeAll','VoiceTransferReport','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','limit','set','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x17df99,_0x1bf9ab){var _0x19a1fe=function(_0x143490){while(--_0x143490){_0x17df99['push'](_0x17df99['shift']());}};_0x19a1fe(++_0x1bf9ab);}(_0x1dcf,0x195));var _0xf1dc=function(_0x4b2d,_0x41cc9c){_0x4b2d=_0x4b2d-0x0;var _0x448e27=_0x1dcf[_0x4b2d];return _0x448e27;};'use strict';var emlformat=require(_0xf1dc('0x0'));var rimraf=require(_0xf1dc('0x1'));var zipdir=require(_0xf1dc('0x2'));var jsonpatch=require(_0xf1dc('0x3'));var rp=require(_0xf1dc('0x4'));var moment=require(_0xf1dc('0x5'));var BPromise=require(_0xf1dc('0x6'));var Mustache=require('mustache');var util=require(_0xf1dc('0x7'));var path=require(_0xf1dc('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf1dc('0x9'));var _=require(_0xf1dc('0xa'));var squel=require(_0xf1dc('0xb'));var crypto=require(_0xf1dc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf1dc('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf1dc('0xe'));var Papa=require(_0xf1dc('0xf'));var Redis=require(_0xf1dc('0x10'));var authService=require(_0xf1dc('0x11'));var qs=require(_0xf1dc('0x12'));var as=require(_0xf1dc('0x13'));var hardwareService=require(_0xf1dc('0x14'));var logger=require('../../config/logger')(_0xf1dc('0x15'));var utils=require(_0xf1dc('0x16'));var config=require(_0xf1dc('0x17'));var licenseUtil=require(_0xf1dc('0x18'));var db=require(_0xf1dc('0x19'))['db'];function respondWithStatusCode(_0x551741,_0x37d932){_0x37d932=_0x37d932||0xcc;return function(_0x59e885){if(_0x59e885){return _0x551741['sendStatus'](_0x37d932);}return _0x551741[_0xf1dc('0x1a')](_0x37d932)[_0xf1dc('0x1b')]();};}function respondWithResult(_0x4ddf38,_0x1eaf37){_0x1eaf37=_0x1eaf37||0xc8;return function(_0x559846){if(_0x559846){return _0x4ddf38[_0xf1dc('0x1a')](_0x1eaf37)['json'](_0x559846);}};}function respondWithFilteredResult(_0x57eb2e,_0x6dccf9){return function(_0x7de0c6){if(_0x7de0c6){var _0x259b5f=typeof _0x6dccf9['offset']===_0xf1dc('0x1c')&&typeof _0x6dccf9['limit']===_0xf1dc('0x1c');var _0x21f2e3=_0x7de0c6[_0xf1dc('0x1d')];var _0x266f13=_0x259b5f?0x0:_0x6dccf9['offset'];var _0x2015c0=_0x259b5f?_0x7de0c6[_0xf1dc('0x1d')]:_0x6dccf9['offset']+_0x6dccf9[_0xf1dc('0x1e')];var _0x5c9545;if(_0x2015c0>=_0x21f2e3){_0x2015c0=_0x21f2e3;_0x5c9545=0xc8;}else{_0x5c9545=0xce;}_0x57eb2e['status'](_0x5c9545);return _0x57eb2e[_0xf1dc('0x1f')]('Content-Range',_0x266f13+'-'+_0x2015c0+'/'+_0x21f2e3)['json'](_0x7de0c6);}return null;};}function patchUpdates(_0x4c7e7){return function(_0x59debe){try{jsonpatch[_0xf1dc('0x20')](_0x59debe,_0x4c7e7,!![]);}catch(_0x32df6c){return BPromise[_0xf1dc('0x21')](_0x32df6c);}return _0x59debe[_0xf1dc('0x22')]();};}function saveUpdates(_0xafbf3,_0x82b25f){return function(_0x4a240f){if(_0x4a240f){return _0x4a240f[_0xf1dc('0x23')](_0xafbf3)[_0xf1dc('0x24')](function(_0x4c79a6){return _0x4c79a6;});}return null;};}function removeEntity(_0x374b1c,_0x2da732){return function(_0x5cd5b9){if(_0x5cd5b9){return _0x5cd5b9[_0xf1dc('0x25')]()['then'](function(){_0x374b1c['status'](0xcc)[_0xf1dc('0x1b')]();});}};}function handleEntityNotFound(_0x10ad21,_0x47daeb){return function(_0x348812){if(!_0x348812){_0x10ad21[_0xf1dc('0x26')](0x194);}return _0x348812;};}function handleError(_0x3ce5fb,_0x451874){_0x451874=_0x451874||0x1f4;return function(_0x3f2d57){logger[_0xf1dc('0x27')](_0x3f2d57[_0xf1dc('0x28')]);if(_0x3f2d57[_0xf1dc('0x29')]){delete _0x3f2d57[_0xf1dc('0x29')];}_0x3ce5fb[_0xf1dc('0x1a')](_0x451874)[_0xf1dc('0x2a')](_0x3f2d57);};}exports['index']=function(_0xb8f480,_0x5e5c5b){var _0xe546b8={},_0x229719={},_0x3186c3={'count':0x0,'rows':[]};var _0x4f7abb=_[_0xf1dc('0x2b')](db['VoiceTransferReport'][_0xf1dc('0x2c')],function(_0x331e10){return{'name':_0x331e10['fieldName'],'type':_0x331e10[_0xf1dc('0x2d')][_0xf1dc('0x2e')]};});_0x229719[_0xf1dc('0x2f')]=_[_0xf1dc('0x2b')](_0x4f7abb,_0xf1dc('0x29'));_0x229719[_0xf1dc('0x30')]=_[_0xf1dc('0x31')](_0xb8f480[_0xf1dc('0x30')]);_0x229719[_0xf1dc('0x32')]=_[_0xf1dc('0x33')](_0x229719[_0xf1dc('0x2f')],_0x229719[_0xf1dc('0x30')]);_0xe546b8['attributes']=_[_0xf1dc('0x33')](_0x229719['model'],qs[_0xf1dc('0x34')](_0xb8f480[_0xf1dc('0x30')][_0xf1dc('0x34')]));_0xe546b8['attributes']=_0xe546b8[_0xf1dc('0x35')][_0xf1dc('0x36')]?_0xe546b8[_0xf1dc('0x35')]:_0x229719['model'];if(!_0xb8f480['query']['hasOwnProperty']('nolimit')){_0xe546b8['limit']=qs[_0xf1dc('0x1e')](_0xb8f480['query'][_0xf1dc('0x1e')]);_0xe546b8[_0xf1dc('0x37')]=qs['offset'](_0xb8f480[_0xf1dc('0x30')][_0xf1dc('0x37')]);}_0xe546b8['order']=qs['sort'](_0xb8f480[_0xf1dc('0x30')][_0xf1dc('0x38')]);_0xe546b8[_0xf1dc('0x39')]=qs[_0xf1dc('0x32')](_[_0xf1dc('0x3a')](_0xb8f480[_0xf1dc('0x30')],_0x229719[_0xf1dc('0x32')]),_0x4f7abb);if(_0xb8f480[_0xf1dc('0x30')][_0xf1dc('0x3b')]){_0xe546b8['where']=_[_0xf1dc('0x3c')](_0xe546b8['where'],{'$or':_[_0xf1dc('0x2b')](_0x4f7abb,function(_0x4a41cd){if(_0x4a41cd[_0xf1dc('0x2d')]!==_0xf1dc('0x3d')){var _0x19235d={};_0x19235d[_0x4a41cd[_0xf1dc('0x29')]]={'$like':'%'+_0xb8f480[_0xf1dc('0x30')][_0xf1dc('0x3b')]+'%'};return _0x19235d;}})});}_0xe546b8=_[_0xf1dc('0x3c')]({},_0xe546b8,_0xb8f480['options']);var _0x79105c={'where':_0xe546b8['where']};return db['VoiceTransferReport'][_0xf1dc('0x1d')](_0x79105c)[_0xf1dc('0x24')](function(_0x4404b1){_0x3186c3[_0xf1dc('0x1d')]=_0x4404b1;if(_0xb8f480[_0xf1dc('0x30')][_0xf1dc('0x3e')]){_0xe546b8['include']=[{'all':!![]}];}return db[_0xf1dc('0x3f')][_0xf1dc('0x40')](_0xe546b8);})[_0xf1dc('0x24')](function(_0x815eec){_0x3186c3[_0xf1dc('0x41')]=_0x815eec;return _0x3186c3;})[_0xf1dc('0x24')](respondWithFilteredResult(_0x5e5c5b,_0xe546b8))[_0xf1dc('0x42')](handleError(_0x5e5c5b,null));};exports[_0xf1dc('0x43')]=function(_0x5aa712,_0x2a5496){var _0x573f3a={'raw':!![],'where':{'id':_0x5aa712[_0xf1dc('0x44')]['id']}},_0x13cb99={};_0x13cb99[_0xf1dc('0x2f')]=_['keys'](db[_0xf1dc('0x3f')]['rawAttributes']);_0x13cb99['query']=_[_0xf1dc('0x31')](_0x5aa712[_0xf1dc('0x30')]);_0x13cb99['filters']=_[_0xf1dc('0x33')](_0x13cb99['model'],_0x13cb99['query']);_0x573f3a[_0xf1dc('0x35')]=_[_0xf1dc('0x33')](_0x13cb99['model'],qs[_0xf1dc('0x34')](_0x5aa712[_0xf1dc('0x30')][_0xf1dc('0x34')]));_0x573f3a[_0xf1dc('0x35')]=_0x573f3a[_0xf1dc('0x35')]['length']?_0x573f3a[_0xf1dc('0x35')]:_0x13cb99['model'];if(_0x5aa712[_0xf1dc('0x30')][_0xf1dc('0x3e')]){_0x573f3a['include']=[{'all':!![]}];}_0x573f3a=_[_0xf1dc('0x3c')]({},_0x573f3a,_0x5aa712[_0xf1dc('0x45')]);return db['VoiceTransferReport'][_0xf1dc('0x46')](_0x573f3a)[_0xf1dc('0x24')](handleEntityNotFound(_0x2a5496,null))[_0xf1dc('0x24')](respondWithResult(_0x2a5496,null))[_0xf1dc('0x42')](handleError(_0x2a5496,null));};exports[_0xf1dc('0x47')]=function(_0x110653,_0x581a8c){return db['VoiceTransferReport'][_0xf1dc('0x47')](_0x110653['body'],{})[_0xf1dc('0x24')](respondWithResult(_0x581a8c,0xc9))['catch'](handleError(_0x581a8c,null));};exports[_0xf1dc('0x23')]=function(_0x11b8cb,_0x59a3d6){if(_0x11b8cb['body']['id']){delete _0x11b8cb[_0xf1dc('0x48')]['id'];}return db[_0xf1dc('0x3f')][_0xf1dc('0x46')]({'where':{'id':_0x11b8cb[_0xf1dc('0x44')]['id']}})[_0xf1dc('0x24')](handleEntityNotFound(_0x59a3d6,null))[_0xf1dc('0x24')](saveUpdates(_0x11b8cb[_0xf1dc('0x48')],null))[_0xf1dc('0x24')](respondWithResult(_0x59a3d6,null))[_0xf1dc('0x42')](handleError(_0x59a3d6,null));};exports[_0xf1dc('0x25')]=function(_0x4a681d,_0x351e90){return db[_0xf1dc('0x3f')][_0xf1dc('0x46')]({'where':{'id':_0x4a681d['params']['id']}})[_0xf1dc('0x24')](handleEntityNotFound(_0x351e90,null))[_0xf1dc('0x24')](removeEntity(_0x351e90,null))['catch'](handleError(_0x351e90,null));};exports[_0xf1dc('0x49')]=function(_0x48e0b9,_0xa29d5d){return db[_0xf1dc('0x3f')][_0xf1dc('0x49')]()[_0xf1dc('0x24')](respondWithResult(_0xa29d5d,null))[_0xf1dc('0x42')](handleError(_0xa29d5d,null));};
\ No newline at end of file
+var _0x4d78=['mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','update','then','end','error','stack','name','send','index','VoiceTransferReport','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3e6d98,_0x3f642a){var _0x48a45f=function(_0x5c1c06){while(--_0x5c1c06){_0x3e6d98['push'](_0x3e6d98['shift']());}};_0x48a45f(++_0x3f642a);}(_0x4d78,0x1d4));var _0x84d7=function(_0x51faaa,_0x2f46b3){_0x51faaa=_0x51faaa-0x0;var _0x26e8a3=_0x4d78[_0x51faaa];return _0x26e8a3;};'use strict';var emlformat=require(_0x84d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x84d7('0x1'));var jsonpatch=require(_0x84d7('0x2'));var rp=require(_0x84d7('0x3'));var moment=require(_0x84d7('0x4'));var BPromise=require(_0x84d7('0x5'));var Mustache=require(_0x84d7('0x6'));var util=require('util');var path=require('path');var sox=require(_0x84d7('0x7'));var csv=require(_0x84d7('0x8'));var ejs=require(_0x84d7('0x9'));var fs=require('fs');var fs_extra=require(_0x84d7('0xa'));var _=require(_0x84d7('0xb'));var squel=require(_0x84d7('0xc'));var crypto=require(_0x84d7('0xd'));var jsforce=require(_0x84d7('0xe'));var deskjs=require(_0x84d7('0xf'));var toCsv=require(_0x84d7('0x8'));var querystring=require(_0x84d7('0x10'));var Papa=require(_0x84d7('0x11'));var Redis=require(_0x84d7('0x12'));var authService=require(_0x84d7('0x13'));var qs=require(_0x84d7('0x14'));var as=require(_0x84d7('0x15'));var hardwareService=require(_0x84d7('0x16'));var logger=require(_0x84d7('0x17'))(_0x84d7('0x18'));var utils=require('../../config/utils');var config=require(_0x84d7('0x19'));var licenseUtil=require(_0x84d7('0x1a'));var db=require(_0x84d7('0x1b'))['db'];function respondWithStatusCode(_0x52455f,_0x196039){_0x196039=_0x196039||0xcc;return function(_0x29cf89){if(_0x29cf89){return _0x52455f[_0x84d7('0x1c')](_0x196039);}return _0x52455f[_0x84d7('0x1d')](_0x196039)['end']();};}function respondWithResult(_0x11466e,_0x7b887f){_0x7b887f=_0x7b887f||0xc8;return function(_0x41d26b){if(_0x41d26b){return _0x11466e['status'](_0x7b887f)[_0x84d7('0x1e')](_0x41d26b);}};}function respondWithFilteredResult(_0x468529,_0x1095fc){return function(_0x46b81b){if(_0x46b81b){var _0xab1b57=typeof _0x1095fc[_0x84d7('0x1f')]==='undefined'&&typeof _0x1095fc[_0x84d7('0x20')]===_0x84d7('0x21');var _0x88e4d6=_0x46b81b[_0x84d7('0x22')];var _0x32ab13=_0xab1b57?0x0:_0x1095fc['offset'];var _0x29a6f9=_0xab1b57?_0x46b81b[_0x84d7('0x22')]:_0x1095fc['offset']+_0x1095fc[_0x84d7('0x20')];var _0x41a45a;if(_0x29a6f9>=_0x88e4d6){_0x29a6f9=_0x88e4d6;_0x41a45a=0xc8;}else{_0x41a45a=0xce;}_0x468529[_0x84d7('0x1d')](_0x41a45a);return _0x468529['set'](_0x84d7('0x23'),_0x32ab13+'-'+_0x29a6f9+'/'+_0x88e4d6)[_0x84d7('0x1e')](_0x46b81b);}return null;};}function patchUpdates(_0x5bb690){return function(_0x2922bf){try{jsonpatch[_0x84d7('0x24')](_0x2922bf,_0x5bb690,!![]);}catch(_0x4abe78){return BPromise['reject'](_0x4abe78);}return _0x2922bf['save']();};}function saveUpdates(_0x33aad7,_0x41251f){return function(_0x470590){if(_0x470590){return _0x470590[_0x84d7('0x25')](_0x33aad7)['then'](function(_0xffa2c7){return _0xffa2c7;});}return null;};}function removeEntity(_0x1a65c9,_0x2130c8){return function(_0x422dd1){if(_0x422dd1){return _0x422dd1['destroy']()[_0x84d7('0x26')](function(){_0x1a65c9[_0x84d7('0x1d')](0xcc)[_0x84d7('0x27')]();});}};}function handleEntityNotFound(_0x2b29e4,_0x251116){return function(_0x3303e4){if(!_0x3303e4){_0x2b29e4[_0x84d7('0x1c')](0x194);}return _0x3303e4;};}function handleError(_0x2c137,_0x341af6){_0x341af6=_0x341af6||0x1f4;return function(_0x439acc){logger[_0x84d7('0x28')](_0x439acc[_0x84d7('0x29')]);if(_0x439acc['name']){delete _0x439acc[_0x84d7('0x2a')];}_0x2c137[_0x84d7('0x1d')](_0x341af6)[_0x84d7('0x2b')](_0x439acc);};}exports[_0x84d7('0x2c')]=function(_0x582618,_0x132171){var _0xc29da7={},_0x8a9fc2={},_0x542274={'count':0x0,'rows':[]};var _0x353ead=_['map'](db[_0x84d7('0x2d')]['rawAttributes'],function(_0x3d8af4){return{'name':_0x3d8af4[_0x84d7('0x2e')],'type':_0x3d8af4['type'][_0x84d7('0x2f')]};});_0x8a9fc2[_0x84d7('0x30')]=_[_0x84d7('0x31')](_0x353ead,_0x84d7('0x2a'));_0x8a9fc2[_0x84d7('0x32')]=_[_0x84d7('0x33')](_0x582618[_0x84d7('0x32')]);_0x8a9fc2['filters']=_[_0x84d7('0x34')](_0x8a9fc2[_0x84d7('0x30')],_0x8a9fc2[_0x84d7('0x32')]);_0xc29da7[_0x84d7('0x35')]=_[_0x84d7('0x34')](_0x8a9fc2[_0x84d7('0x30')],qs[_0x84d7('0x36')](_0x582618[_0x84d7('0x32')][_0x84d7('0x36')]));_0xc29da7[_0x84d7('0x35')]=_0xc29da7[_0x84d7('0x35')][_0x84d7('0x37')]?_0xc29da7[_0x84d7('0x35')]:_0x8a9fc2[_0x84d7('0x30')];if(!_0x582618[_0x84d7('0x32')][_0x84d7('0x38')](_0x84d7('0x39'))){_0xc29da7['limit']=qs[_0x84d7('0x20')](_0x582618[_0x84d7('0x32')][_0x84d7('0x20')]);_0xc29da7['offset']=qs[_0x84d7('0x1f')](_0x582618['query'][_0x84d7('0x1f')]);}_0xc29da7[_0x84d7('0x3a')]=qs[_0x84d7('0x3b')](_0x582618[_0x84d7('0x32')][_0x84d7('0x3b')]);_0xc29da7[_0x84d7('0x3c')]=qs['filters'](_[_0x84d7('0x3d')](_0x582618[_0x84d7('0x32')],_0x8a9fc2[_0x84d7('0x3e')]),_0x353ead);if(_0x582618['query'][_0x84d7('0x3f')]){_0xc29da7[_0x84d7('0x3c')]=_['merge'](_0xc29da7[_0x84d7('0x3c')],{'$or':_['map'](_0x353ead,function(_0x5013d2){if(_0x5013d2[_0x84d7('0x40')]!==_0x84d7('0x41')){var _0x277873={};_0x277873[_0x5013d2['name']]={'$like':'%'+_0x582618[_0x84d7('0x32')][_0x84d7('0x3f')]+'%'};return _0x277873;}})});}_0xc29da7=_['merge']({},_0xc29da7,_0x582618[_0x84d7('0x42')]);var _0x1db545={'where':_0xc29da7[_0x84d7('0x3c')]};return db[_0x84d7('0x2d')][_0x84d7('0x22')](_0x1db545)['then'](function(_0x5d21f6){_0x542274[_0x84d7('0x22')]=_0x5d21f6;if(_0x582618[_0x84d7('0x32')][_0x84d7('0x43')]){_0xc29da7[_0x84d7('0x44')]=[{'all':!![]}];}return db[_0x84d7('0x2d')][_0x84d7('0x45')](_0xc29da7);})['then'](function(_0x129b7){_0x542274[_0x84d7('0x46')]=_0x129b7;return _0x542274;})[_0x84d7('0x26')](respondWithFilteredResult(_0x132171,_0xc29da7))[_0x84d7('0x47')](handleError(_0x132171,null));};exports['show']=function(_0x32013b,_0x399cb7){var _0x2faddf={'raw':!![],'where':{'id':_0x32013b[_0x84d7('0x48')]['id']}},_0x1792aa={};_0x1792aa[_0x84d7('0x30')]=_[_0x84d7('0x33')](db[_0x84d7('0x2d')][_0x84d7('0x49')]);_0x1792aa[_0x84d7('0x32')]=_[_0x84d7('0x33')](_0x32013b[_0x84d7('0x32')]);_0x1792aa['filters']=_['intersection'](_0x1792aa['model'],_0x1792aa[_0x84d7('0x32')]);_0x2faddf[_0x84d7('0x35')]=_[_0x84d7('0x34')](_0x1792aa[_0x84d7('0x30')],qs['fields'](_0x32013b[_0x84d7('0x32')]['fields']));_0x2faddf[_0x84d7('0x35')]=_0x2faddf['attributes'][_0x84d7('0x37')]?_0x2faddf[_0x84d7('0x35')]:_0x1792aa[_0x84d7('0x30')];if(_0x32013b['query'][_0x84d7('0x43')]){_0x2faddf[_0x84d7('0x44')]=[{'all':!![]}];}_0x2faddf=_['merge']({},_0x2faddf,_0x32013b[_0x84d7('0x42')]);return db[_0x84d7('0x2d')][_0x84d7('0x4a')](_0x2faddf)[_0x84d7('0x26')](handleEntityNotFound(_0x399cb7,null))[_0x84d7('0x26')](respondWithResult(_0x399cb7,null))[_0x84d7('0x47')](handleError(_0x399cb7,null));};exports[_0x84d7('0x4b')]=function(_0x58e751,_0xb9cc53){return db[_0x84d7('0x2d')][_0x84d7('0x4b')](_0x58e751['body'],{})[_0x84d7('0x26')](respondWithResult(_0xb9cc53,0xc9))['catch'](handleError(_0xb9cc53,null));};exports['update']=function(_0x53b2a9,_0xb94e14){if(_0x53b2a9['body']['id']){delete _0x53b2a9['body']['id'];}return db[_0x84d7('0x2d')][_0x84d7('0x4a')]({'where':{'id':_0x53b2a9[_0x84d7('0x48')]['id']}})['then'](handleEntityNotFound(_0xb94e14,null))['then'](saveUpdates(_0x53b2a9[_0x84d7('0x4c')],null))[_0x84d7('0x26')](respondWithResult(_0xb94e14,null))[_0x84d7('0x47')](handleError(_0xb94e14,null));};exports[_0x84d7('0x4d')]=function(_0x3ac819,_0x3e2485){return db[_0x84d7('0x2d')][_0x84d7('0x4a')]({'where':{'id':_0x3ac819[_0x84d7('0x48')]['id']}})[_0x84d7('0x26')](handleEntityNotFound(_0x3e2485,null))[_0x84d7('0x26')](removeEntity(_0x3e2485,null))['catch'](handleError(_0x3e2485,null));};exports['describe']=function(_0x2668b8,_0x4b5bf0){return db['VoiceTransferReport'][_0x84d7('0x4e')]()[_0x84d7('0x26')](respondWithResult(_0x4b5bf0,null))[_0x84d7('0x47')](handleError(_0x4b5bf0,null));};
\ No newline at end of file
index 6a7f8c7..b94bb1e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c7d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util','api'];(function(_0x3e7952,_0x71a8fa){var _0x391356=function(_0x1fd62d){while(--_0x1fd62d){_0x3e7952['push'](_0x3e7952['shift']());}};_0x391356(++_0x71a8fa);}(_0x1c7d,0x10f));var _0xd1c7=function(_0xcdbe7b,_0xdb9953){_0xcdbe7b=_0xcdbe7b-0x0;var _0x2ffbe0=_0x1c7d[_0xcdbe7b];return _0x2ffbe0;};'use strict';var _=require('lodash');var util=require(_0xd1c7('0x0'));var logger=require('../../config/logger')(_0xd1c7('0x1'));var moment=require(_0xd1c7('0x2'));var BPromise=require(_0xd1c7('0x3'));var rp=require(_0xd1c7('0x4'));var fs=require('fs');var path=require(_0xd1c7('0x5'));var rimraf=require(_0xd1c7('0x6'));var config=require(_0xd1c7('0x7'));var attributes=require(_0xd1c7('0x8'));module[_0xd1c7('0x9')]=function(_0x2d6d84,_0x4e28af){return _0x2d6d84[_0xd1c7('0xa')](_0xd1c7('0xb'),attributes,{'tableName':_0xd1c7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc1b2=['exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./voiceTransferReport.attributes'];(function(_0x88281e,_0x502f0b){var _0x4c8edf=function(_0x1d8afc){while(--_0x1d8afc){_0x88281e['push'](_0x88281e['shift']());}};_0x4c8edf(++_0x502f0b);}(_0xc1b2,0x1a8));var _0x2c1b=function(_0x38a089,_0x32bc46){_0x38a089=_0x38a089-0x0;var _0xe821ed=_0xc1b2[_0x38a089];return _0xe821ed;};'use strict';var _=require(_0x2c1b('0x0'));var util=require('util');var logger=require(_0x2c1b('0x1'))(_0x2c1b('0x2'));var moment=require(_0x2c1b('0x3'));var BPromise=require(_0x2c1b('0x4'));var rp=require(_0x2c1b('0x5'));var fs=require('fs');var path=require(_0x2c1b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2c1b('0x7'));module[_0x2c1b('0x8')]=function(_0x36a0ab,_0x5bcb03){return _0x36a0ab[_0x2c1b('0x9')](_0x2c1b('0xa'),attributes,{'tableName':_0x2c1b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5fed72a..82bdb07 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2b7b=['message','VoiceTransferReport,\x20%s,\x20%s','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','catch','util','moment','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','code'];(function(_0x4f7c53,_0x4cef1c){var _0xa7acdb=function(_0x59a0f2){while(--_0x59a0f2){_0x4f7c53['push'](_0x4f7c53['shift']());}};_0xa7acdb(++_0x4cef1c);}(_0x2b7b,0x161));var _0xb2b7=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2b7b[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0xb2b7('0x0'));var moment=require(_0xb2b7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2b7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb2b7('0x3'));var logger=require('../../config/logger')(_0xb2b7('0x4'));var config=require(_0xb2b7('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb2b7('0x6')][_0xb2b7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2bee03,_0x5ec634,_0x3b095c){return new BPromise(function(_0x236cc9,_0x18ab6e){return client[_0xb2b7('0x8')](_0x2bee03,_0x3b095c)[_0xb2b7('0x9')](function(_0x11b984){logger[_0xb2b7('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x5ec634,_0xb2b7('0xb'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x5ec634,_0xb2b7('0xb'),JSON[_0xb2b7('0xc')](_0x11b984));if(_0x11b984['error']){if(_0x11b984[_0xb2b7('0xd')][_0xb2b7('0xe')]===0x1f4){logger[_0xb2b7('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x5ec634,_0x11b984[_0xb2b7('0xd')][_0xb2b7('0xf')]);return _0x18ab6e(_0x11b984[_0xb2b7('0xd')][_0xb2b7('0xf')]);}logger[_0xb2b7('0xd')](_0xb2b7('0x10'),_0x5ec634,_0x11b984[_0xb2b7('0xd')][_0xb2b7('0xf')]);return _0x236cc9(_0x11b984['error'][_0xb2b7('0xf')]);}else{logger[_0xb2b7('0xa')](_0xb2b7('0x10'),_0x5ec634,'request\x20sent');_0x236cc9(_0x11b984['result'][_0xb2b7('0xf')]);}})['catch'](function(_0x17f400){logger[_0xb2b7('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x5ec634,_0x17f400);_0x18ab6e(_0x17f400);});});}exports[_0xb2b7('0x11')]=function(_0x216e48){var _0x1fdfdf=this;return new Promise(function(_0x6e1fac,_0x55ea1c){return db[_0xb2b7('0x12')]['create'](_0x216e48[_0xb2b7('0x13')],{'raw':_0x216e48[_0xb2b7('0x14')]?_0x216e48[_0xb2b7('0x14')][_0xb2b7('0x15')]===undefined?!![]:![]:!![]})[_0xb2b7('0x9')](function(_0x47ec){logger['info']('CreateVoiceTransferReport',_0x216e48);logger['debug'](_0xb2b7('0x11'),_0x216e48,JSON[_0xb2b7('0xc')](_0x47ec));_0x6e1fac(_0x47ec);})[_0xb2b7('0x16')](function(_0x10d5be){logger['error'](_0xb2b7('0x11'),_0x10d5be[_0xb2b7('0xf')],_0x216e48);_0x55ea1c(_0x1fdfdf[_0xb2b7('0xd')](0x1f4,_0x10d5be[_0xb2b7('0xf')]));});});};
\ No newline at end of file
+var _0x291d=['client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','options','raw','then','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x30bb7c,_0x27a364){var _0x3b32be=function(_0x4b031d){while(--_0x4b031d){_0x30bb7c['push'](_0x30bb7c['shift']());}};_0x3b32be(++_0x27a364);}(_0x291d,0x152));var _0xd291=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x291d[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require('lodash');var util=require(_0xd291('0x0'));var moment=require(_0xd291('0x1'));var BPromise=require('bluebird');var rs=require(_0xd291('0x2'));var fs=require('fs');var Redis=require(_0xd291('0x3'));var db=require(_0xd291('0x4'))['db'];var utils=require(_0xd291('0x5'));var logger=require(_0xd291('0x6'))(_0xd291('0x7'));var config=require(_0xd291('0x8'));var jayson=require(_0xd291('0x9'));var client=jayson[_0xd291('0xa')][_0xd291('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d91f6,_0x34b38f,_0x573250){return new BPromise(function(_0xdd3007,_0x166b91){return client[_0xd291('0xc')](_0x4d91f6,_0x573250)['then'](function(_0x760d2b){logger[_0xd291('0xd')](_0xd291('0xe'),_0x34b38f,_0xd291('0xf'));logger['debug'](_0xd291('0x10'),_0x34b38f,_0xd291('0xf'),JSON[_0xd291('0x11')](_0x760d2b));if(_0x760d2b[_0xd291('0x12')]){if(_0x760d2b[_0xd291('0x12')][_0xd291('0x13')]===0x1f4){logger['error'](_0xd291('0xe'),_0x34b38f,_0x760d2b['error'][_0xd291('0x14')]);return _0x166b91(_0x760d2b['error'][_0xd291('0x14')]);}logger[_0xd291('0x12')](_0xd291('0xe'),_0x34b38f,_0x760d2b[_0xd291('0x12')]['message']);return _0xdd3007(_0x760d2b['error'][_0xd291('0x14')]);}else{logger['info'](_0xd291('0xe'),_0x34b38f,_0xd291('0xf'));_0xdd3007(_0x760d2b[_0xd291('0x15')]['message']);}})[_0xd291('0x16')](function(_0x4c13d5){logger['error'](_0xd291('0xe'),_0x34b38f,_0x4c13d5);_0x166b91(_0x4c13d5);});});}exports[_0xd291('0x17')]=function(_0x564400){var _0x1ce9ad=this;return new Promise(function(_0x49aed4,_0x2761ab){return db[_0xd291('0x18')]['create'](_0x564400['body'],{'raw':_0x564400[_0xd291('0x19')]?_0x564400['options'][_0xd291('0x1a')]===undefined?!![]:![]:!![]})[_0xd291('0x1b')](function(_0x3a29e1){logger[_0xd291('0xd')]('CreateVoiceTransferReport',_0x564400);logger[_0xd291('0x1c')](_0xd291('0x17'),_0x564400,JSON[_0xd291('0x11')](_0x3a29e1));_0x49aed4(_0x3a29e1);})[_0xd291('0x16')](function(_0x177505){logger[_0xd291('0x12')]('CreateVoiceTransferReport',_0x177505[_0xd291('0x14')],_0x564400);_0x2761ab(_0x1ce9ad[_0xd291('0x12')](0x1f4,_0x177505[_0xd291('0x14')]));});});};
\ No newline at end of file
index 25db926..a257622 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedd9=['unhold','/calls','calls','/transfer','exports','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','/unhold'];(function(_0x54f8bf,_0x19e342){var _0xa63916=function(_0x501838){while(--_0x501838){_0x54f8bf['push'](_0x54f8bf['shift']());}};_0xa63916(++_0x19e342);}(_0xedd9,0xfc));var _0x9edd=function(_0x550ae2,_0x395896){_0x550ae2=_0x550ae2-0x0;var _0x236657=_0xedd9[_0x550ae2];return _0x236657;};'use strict';var express=require('express');var router=express[_0x9edd('0x0')]();var auth=require(_0x9edd('0x1'));var controller=require(_0x9edd('0x2'));router[_0x9edd('0x3')](_0x9edd('0x4'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x7')]);router['post'](_0x9edd('0x8'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x9')]);router['post'](_0x9edd('0xa'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xb')]);router[_0x9edd('0x3')](_0x9edd('0xc'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller['hold']);router[_0x9edd('0x3')](_0x9edd('0xd'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xe')]);router['post'](_0x9edd('0xf'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x10')]);router[_0x9edd('0x3')](_0x9edd('0x11'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller['transfer']);module[_0x9edd('0x12')]=router;
\ No newline at end of file
+var _0xf4eb=['/hangup','isAuthenticated','isWebrtcLicence','hangup','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','express','/originate','originate','post'];(function(_0x1df213,_0x5e6263){var _0x320977=function(_0x585140){while(--_0x585140){_0x1df213['push'](_0x1df213['shift']());}};_0x320977(++_0x5e6263);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2d0946,_0x5d6c96){_0x2d0946=_0x2d0946-0x0;var _0x459b31=_0xf4eb[_0x2d0946];return _0x459b31;};'use strict';var express=require(_0xbf4e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0xbf4e('0x1'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0x2')]);router[_0xbf4e('0x3')](_0xbf4e('0x4'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x3')]('/answer',auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xbf4e('0x3')](_0xbf4e('0x8'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x3')](_0xbf4e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xb')]);router['post'](_0xbf4e('0xc'),auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xd')]);router['post']('/transfer',auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xe')]);module[_0xbf4e('0xf')]=router;
\ No newline at end of file
index cd07e9b..56540e3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x98d3=['transfer\x20executed!','path','lodash','../../config/environment','bluebird','client','http','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','name','status','send','request','error','message','catch','User','findOne','agent','then','VoiceChannels','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','UserId','conference','webbar:conference','transfer\x20fired:','transferNumber'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x98d3,0x173));var _0x398d=function(_0x299d38,_0x1be761){_0x299d38=_0x299d38-0x0;var _0x437f0e=_0x98d3[_0x299d38];return _0x437f0e;};'use strict';var path=require(_0x398d('0x0'));var fs=require('fs');var _=require(_0x398d('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x398d('0x2'));var util=require('util');var BPromise=require(_0x398d('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x398d('0x4')][_0x398d('0x5')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0x398d('0x6'));config[_0x398d('0x7')]=_[_0x398d('0x8')](config['redis'],{'host':_0x398d('0x9'),'port':0x18eb});var io=require(_0x398d('0xa'))(new Redis(config[_0x398d('0x7')]));var Schema=require(_0x398d('0xb'));var originateValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x398d('0xd'),'required':[!![],_0x398d('0xe')]},'callerId':{'type':_0x398d('0xd')},'callbackUrl':{'type':_0x398d('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]},'sessionId':{'type':_0x398d('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x398d('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]},'sessionId':{'type':_0x398d('0xd'),'required':[!![],_0x398d('0x10')]},'transferNumber':{'type':_0x398d('0xd'),'required':[!![],_0x398d('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]},'sessionId':{'type':_0x398d('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]}});function emit(_0x278004,_0x4099a5,_0x3ff03c){logger[_0x398d('0x12')](_0x278004,_0x4099a5,JSON['stringify'](_0x3ff03c));io['to'](_0x278004)[_0x398d('0x13')](_0x4099a5,_0x3ff03c);}function handleError(_0x54e717){return function(_0x673840){console[_0x398d('0x14')](_0x398d('0x15'),_0x673840,_0x673840 instanceof RangeError);logger['error'](_0x673840['stack']);if(_0x673840 instanceof RangeError){if(_0x673840['name']){delete _0x673840[_0x398d('0x16')];}_0x54e717[_0x398d('0x17')](0x194)[_0x398d('0x18')](_0x673840);}else{if(_0x673840[_0x398d('0x16')]){delete _0x673840[_0x398d('0x16')];}_0x54e717[_0x398d('0x17')](0x1f4)[_0x398d('0x18')](_0x673840);}};}function checkError(){return function(_0x552411){if(!_0x552411){throw new RangeError('NotFound');}return _0x552411;};}function respondWithRpcPromise(_0x5e667d,_0x16e580){return new BPromise(function(_0x3b275a,_0x1ea5f9){var _0x2affed=amiClient;return _0x2affed[_0x398d('0x19')](_0x5e667d,_0x16e580)['then'](function(_0x5c4c70){if(_0x5c4c70[_0x398d('0x1a')]){if(_0x5c4c70[_0x398d('0x1a')]['code']===0x1f4){return _0x1ea5f9(_0x5c4c70[_0x398d('0x1a')][_0x398d('0x1b')]);}return _0x3b275a(_0x5c4c70['error']['message']);}else{_0x3b275a(_0x5c4c70['result']);}})[_0x398d('0x1c')](function(_0x2cc4ef){_0x1ea5f9(_0x2cc4ef);});});}function getAgent(_0x24fa2c){return db[_0x398d('0x1d')][_0x398d('0x1e')]({'where':{'id':_0x24fa2c,'role':_0x398d('0x1f')}})[_0x398d('0x20')](checkError());}function getAgentCheckSession(_0x17318c,_0x4f4466){return new BPromise(function(_0x35bd19,_0x557dce){var _0x4aa568=respondWithRpcPromise(_0x398d('0x21'));var _0x27bc6e=getAgent(_0x17318c);Promise['all']([_0x4aa568,_0x27bc6e])[_0x398d('0x20')](function(_0x558249){var _0x3ae172=_0x558249[0x0];var _0x8abf30=_0x558249[0x1];var _0x582d16=_['filter'](_0x3ae172[_0x398d('0x22')],function(_0x2ca780){return _0x2ca780['UserId']==_0x8abf30['id']&&_0x2ca780[_0x398d('0x23')]==_0x4f4466;});if(_0x582d16[_0x398d('0x24')]==0x1){_0x35bd19(_0x8abf30);}else{_0x557dce(new RangeError(_0x398d('0x25')+_0x4f4466+_0x398d('0x26')));}});});}exports[_0x398d('0x27')]=function(_0x3bcc5e,_0x490bee){logger['info'](_0x398d('0x28'),_0x3bcc5e[_0x398d('0x29')]);var _0x45f1a3=originateValidation[_0x398d('0xb')](_0x3bcc5e[_0x398d('0x29')]);if(_0x45f1a3[_0x398d('0x24')]>0x0){return _0x490bee[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x45f1a3);}var _0x1827be=_0x3bcc5e['body'][_0x398d('0x2b')];var _0x3807f0=_0x3bcc5e[_0x398d('0x29')]['callNumber'];var _0x5be779=_0x3bcc5e[_0x398d('0x29')][_0x398d('0x2c')];var _0x3fb8ff=_0x3bcc5e[_0x398d('0x29')][_0x398d('0x2d')];return getAgent(_0x1827be)[_0x398d('0x20')](function(_0x324d76){logger[_0x398d('0x12')](_0x398d('0x2e'),_0x324d76[_0x398d('0x16')]);emit(util[_0x398d('0x2f')](_0x398d('0x30'),_0x324d76[_0x398d('0x16')]),_0x398d('0x31'),{'callNumber':_0x3807f0,'callerId':_0x5be779,'callbackUrl':_0x3fb8ff});return _0x490bee[_0x398d('0x17')](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x32')});})[_0x398d('0x1c')](handleError(_0x490bee));};exports[_0x398d('0x33')]=function(_0x5ae43b,_0x244512){logger[_0x398d('0x12')](_0x398d('0x34'),_0x5ae43b[_0x398d('0x29')]);var _0x209c2b=hangupValidation[_0x398d('0xb')](_0x5ae43b[_0x398d('0x29')]);if(_0x209c2b['length']>0x0){return _0x244512[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x209c2b);}var _0x165d26=_0x5ae43b[_0x398d('0x29')][_0x398d('0x2b')];var _0x219651=_0x5ae43b[_0x398d('0x29')][_0x398d('0x23')];return getAgent(_0x165d26)['then'](function(_0x208eb2){logger[_0x398d('0x12')](_0x398d('0x2e'),_0x208eb2[_0x398d('0x16')]);emit(util[_0x398d('0x2f')]('user:%s',_0x208eb2[_0x398d('0x16')]),_0x398d('0x35'),{'sessionId':_0x219651});return _0x244512['status'](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x36')});})[_0x398d('0x1c')](handleError(_0x244512));};exports[_0x398d('0x37')]=function(_0x217fc0,_0x30ac4d){logger[_0x398d('0x12')](_0x398d('0x38'),_0x217fc0[_0x398d('0x29')]);var _0x5d7d33=answerValidation[_0x398d('0xb')](_0x217fc0[_0x398d('0x29')]);if(_0x5d7d33[_0x398d('0x24')]>0x0){return _0x30ac4d[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x5d7d33);}var _0x227984=_0x217fc0['body'][_0x398d('0x2b')];var _0x1a6bdc=_0x217fc0['body'][_0x398d('0x23')];return getAgent(_0x227984)[_0x398d('0x20')](function(_0x2f419f){logger['info'](_0x398d('0x2e'),_0x2f419f[_0x398d('0x16')]);emit(util[_0x398d('0x2f')](_0x398d('0x30'),_0x2f419f[_0x398d('0x16')]),'webbar:answer',{'sessionId':_0x1a6bdc});return _0x30ac4d[_0x398d('0x17')](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x39')});})['catch'](handleError(_0x30ac4d));};exports[_0x398d('0x3a')]=function(_0x3f9fb2,_0x578a0f){logger[_0x398d('0x12')](_0x398d('0x3b'),_0x3f9fb2[_0x398d('0x29')]);var _0x1f67a9=holdValidation[_0x398d('0xb')](_0x3f9fb2[_0x398d('0x29')]);if(_0x1f67a9[_0x398d('0x24')]>0x0){return _0x578a0f[_0x398d('0x17')](0x190)['json'](_0x1f67a9);}var _0x34c0fc=_0x3f9fb2[_0x398d('0x29')]['userId'];var _0x5f4aef=_0x3f9fb2[_0x398d('0x29')][_0x398d('0x23')];return getAgent(_0x34c0fc)[_0x398d('0x20')](function(_0x35d260){logger['info'](_0x398d('0x2e'),_0x35d260['name']);emit(util[_0x398d('0x2f')]('user:%s',_0x35d260[_0x398d('0x16')]),'webbar:hold',{'sessionId':_0x5f4aef});return _0x578a0f['status'](0xc8)['json']({'error':![],'message':_0x398d('0x3c')});})[_0x398d('0x1c')](handleError(_0x578a0f));};exports[_0x398d('0x3d')]=function(_0x3fa030,_0x578784){logger['info'](_0x398d('0x3e'),_0x3fa030[_0x398d('0x29')]);var _0x1615ee=unholdValidation['validate'](_0x3fa030[_0x398d('0x29')]);if(_0x1615ee[_0x398d('0x24')]>0x0){return _0x578784[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x1615ee);}var _0x20c488=_0x3fa030[_0x398d('0x29')]['userId'];var _0x158828=_0x3fa030[_0x398d('0x29')][_0x398d('0x23')];return getAgent(_0x20c488)[_0x398d('0x20')](function(_0x499f2e){logger[_0x398d('0x12')](_0x398d('0x2e'),_0x499f2e[_0x398d('0x16')]);emit(util[_0x398d('0x2f')]('user:%s',_0x499f2e['name']),_0x398d('0x3f'),{'sessionId':_0x158828});return _0x578784['status'](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x40')});})['catch'](handleError(_0x578784));};exports[_0x398d('0x41')]=function(_0x5109e7,_0x2eac8c){logger[_0x398d('0x12')](_0x398d('0x42'),_0x2eac8c[_0x398d('0x29')]);var _0x360e67=callsValidation[_0x398d('0xb')](_0x5109e7[_0x398d('0x29')]);if(_0x360e67[_0x398d('0x24')]>0x0){return _0x2eac8c[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x360e67);}var _0x179862=_0x5109e7[_0x398d('0x29')][_0x398d('0x2b')];var _0x783c74=respondWithRpcPromise(_0x398d('0x21'));var _0x3f3108=getAgent(_0x179862);return Promise[_0x398d('0x43')]([_0x783c74,_0x3f3108])[_0x398d('0x20')](function(_0x4717cf){var _0xb25709=_0x4717cf[0x0];var _0x7f4acb=_0x4717cf[0x1];var _0xcd2b9d=_['filter'](_0xb25709[_0x398d('0x22')],function(_0x26d6f8){return _0x26d6f8[_0x398d('0x44')]==_0x7f4acb['id'];});return _0x2eac8c[_0x398d('0x17')](0xc8)[_0x398d('0x2a')]({'count':_0xcd2b9d[_0x398d('0x24')],'rows':_0xcd2b9d});})[_0x398d('0x1c')](handleError(_0x2eac8c));};exports[_0x398d('0x45')]=function(_0xe6cf33,_0x9c3971){logger[_0x398d('0x12')]('conference\x20fired:',_0xe6cf33[_0x398d('0x29')]);var _0x207fd6=conferenceValidation['validate'](_0xe6cf33[_0x398d('0x29')]);if(_0x207fd6['length']>0x0){return _0x9c3971['status'](0x190)['json'](_0x207fd6);}var _0x37646f=_0xe6cf33[_0x398d('0x29')]['userId'];return getAgent(_0x37646f)[_0x398d('0x20')](function(_0x278262){logger[_0x398d('0x12')]('entityFound:',_0x278262[_0x398d('0x16')]);emit(util[_0x398d('0x2f')](_0x398d('0x30'),_0x278262['name']),_0x398d('0x46'));return _0x9c3971['status'](0xc8)[_0x398d('0x2a')]({'error':![],'message':'conference\x20executed!'});})[_0x398d('0x1c')](handleError(_0x9c3971));};exports['transfer']=function(_0x35c204,_0x1b5929){logger[_0x398d('0x12')](_0x398d('0x47'),_0x35c204[_0x398d('0x29')]);var _0x56e3f6=transferValidation[_0x398d('0xb')](_0x35c204[_0x398d('0x29')]);if(_0x56e3f6[_0x398d('0x24')]>0x0){return _0x1b5929[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x56e3f6);}var _0x12d76f=_0x35c204[_0x398d('0x29')]['userId'];var _0x227661=_0x35c204[_0x398d('0x29')][_0x398d('0x23')];var _0x5085f4=_0x35c204['body'][_0x398d('0x48')];return getAgent(_0x12d76f)[_0x398d('0x20')](function(_0x540121){logger['info'](_0x398d('0x2e'),_0x540121['name']);emit(util[_0x398d('0x2f')]('user:%s',_0x540121[_0x398d('0x16')]),'webbar:transfer',{'sessionId':_0x227661,'transferNumber':_0x5085f4});return _0x1b5929['status'](0xc8)['json']({'error':![],'message':_0x398d('0x49')});})[_0x398d('0x1c')](handleError(_0x1b5929));};
\ No newline at end of file
+var _0xa74f=['user:%s','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','calls','calls\x20fired:','VoiceChannels','filter','rows','conference\x20fired:','webbar:conference','transfer','transferNumber','transfer\x20executed!','../../mysqldb','bluebird','jayson/promise','client','http','webbarapi','defaults','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','handleError:','error','stack','name','status','send','message','catch','User','agent','then','all','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callerId','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','format','webbar:hangup','hangup\x20executed!','answer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa74f,0x9a));var _0xfa74=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0xa74f[_0x5b5cde];return _0x364ad2;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0xfa74('0x0'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0xfa74('0x1'));var jayson=require(_0xfa74('0x2'));var amiClient=jayson[_0xfa74('0x3')][_0xfa74('0x4')]({'port':0x232a});var logger=require('../../config/logger')(_0xfa74('0x5'));var Redis=require('ioredis');config['redis']=_[_0xfa74('0x6')](config[_0xfa74('0x7')],{'host':_0xfa74('0x8'),'port':0x18eb});var io=require(_0xfa74('0x9'))(new Redis(config[_0xfa74('0x7')]));var Schema=require(_0xfa74('0xa'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfa74('0xb')]},'callNumber':{'type':_0xfa74('0xc'),'required':[!![],_0xfa74('0xd')]},'callerId':{'type':_0xfa74('0xc')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]},'sessionId':{'type':_0xfa74('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xfa74('0xc'),'required':[!![],_0xfa74('0xf')]},'transferNumber':{'type':_0xfa74('0xc'),'required':[!![],_0xfa74('0x10')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfa74('0xb')]},'sessionId':{'type':_0xfa74('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]},'sessionId':{'type':_0xfa74('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfa74('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]}});function emit(_0x1f1de0,_0x3867f8,_0x40af70){logger[_0xfa74('0x11')](_0x1f1de0,_0x3867f8,JSON['stringify'](_0x40af70));io['to'](_0x1f1de0)[_0xfa74('0x12')](_0x3867f8,_0x40af70);}function handleError(_0xe0e33d){return function(_0x51dda1){console['log'](_0xfa74('0x13'),_0x51dda1,_0x51dda1 instanceof RangeError);logger[_0xfa74('0x14')](_0x51dda1[_0xfa74('0x15')]);if(_0x51dda1 instanceof RangeError){if(_0x51dda1['name']){delete _0x51dda1[_0xfa74('0x16')];}_0xe0e33d[_0xfa74('0x17')](0x194)[_0xfa74('0x18')](_0x51dda1);}else{if(_0x51dda1['name']){delete _0x51dda1[_0xfa74('0x16')];}_0xe0e33d[_0xfa74('0x17')](0x1f4)[_0xfa74('0x18')](_0x51dda1);}};}function checkError(){return function(_0x4a5ee4){if(!_0x4a5ee4){throw new RangeError('NotFound');}return _0x4a5ee4;};}function respondWithRpcPromise(_0x100851,_0x2257a0){return new BPromise(function(_0x9932db,_0xeaaa19){var _0x1a453d=amiClient;return _0x1a453d['request'](_0x100851,_0x2257a0)['then'](function(_0x3721bf){if(_0x3721bf['error']){if(_0x3721bf['error']['code']===0x1f4){return _0xeaaa19(_0x3721bf[_0xfa74('0x14')][_0xfa74('0x19')]);}return _0x9932db(_0x3721bf[_0xfa74('0x14')]['message']);}else{_0x9932db(_0x3721bf['result']);}})[_0xfa74('0x1a')](function(_0xeb6c11){_0xeaaa19(_0xeb6c11);});});}function getAgent(_0x5ed1c8){return db[_0xfa74('0x1b')]['findOne']({'where':{'id':_0x5ed1c8,'role':_0xfa74('0x1c')}})[_0xfa74('0x1d')](checkError());}function getAgentCheckSession(_0x55d8e4,_0x298388){return new BPromise(function(_0x1130de,_0x122415){var _0x218c86=respondWithRpcPromise('VoiceChannels');var _0xd9c55d=getAgent(_0x55d8e4);Promise[_0xfa74('0x1e')]([_0x218c86,_0xd9c55d])[_0xfa74('0x1d')](function(_0x57d90e){var _0x4d4bed=_0x57d90e[0x0];var _0x1322a4=_0x57d90e[0x1];var _0x8b706e=_['filter'](_0x4d4bed['rows'],function(_0x343466){return _0x343466['UserId']==_0x1322a4['id']&&_0x343466[_0xfa74('0x1f')]==_0x298388;});if(_0x8b706e['length']==0x1){_0x1130de(_0x1322a4);}else{_0x122415(new RangeError(_0xfa74('0x20')+_0x298388+_0xfa74('0x21')));}});});}exports[_0xfa74('0x22')]=function(_0xdd93e5,_0x4c506f){logger[_0xfa74('0x11')](_0xfa74('0x23'),_0xdd93e5[_0xfa74('0x24')]);var _0x16f9dc=originateValidation[_0xfa74('0xa')](_0xdd93e5[_0xfa74('0x24')]);if(_0x16f9dc[_0xfa74('0x25')]>0x0){return _0x4c506f['status'](0x190)[_0xfa74('0x26')](_0x16f9dc);}var _0x5a9f43=_0xdd93e5[_0xfa74('0x24')][_0xfa74('0x27')];var _0xcc5e32=_0xdd93e5[_0xfa74('0x24')]['callNumber'];var _0x5055d3=_0xdd93e5[_0xfa74('0x24')][_0xfa74('0x28')];var _0x44b725=_0xdd93e5[_0xfa74('0x24')]['callbackUrl'];return getAgent(_0x5a9f43)[_0xfa74('0x1d')](function(_0x231698){logger['info']('entityFound:',_0x231698['name']);emit(util['format']('user:%s',_0x231698[_0xfa74('0x16')]),_0xfa74('0x29'),{'callNumber':_0xcc5e32,'callerId':_0x5055d3,'callbackUrl':_0x44b725});return _0x4c506f[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x2a')});})[_0xfa74('0x1a')](handleError(_0x4c506f));};exports[_0xfa74('0x2b')]=function(_0x13475a,_0x1a2d52){logger['info'](_0xfa74('0x2c'),_0x13475a[_0xfa74('0x24')]);var _0x430339=hangupValidation[_0xfa74('0xa')](_0x13475a[_0xfa74('0x24')]);if(_0x430339[_0xfa74('0x25')]>0x0){return _0x1a2d52['status'](0x190)[_0xfa74('0x26')](_0x430339);}var _0x1f0806=_0x13475a[_0xfa74('0x24')][_0xfa74('0x27')];var _0x5853d4=_0x13475a[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x1f0806)[_0xfa74('0x1d')](function(_0x35f252){logger['info'](_0xfa74('0x2d'),_0x35f252[_0xfa74('0x16')]);emit(util[_0xfa74('0x2e')]('user:%s',_0x35f252['name']),_0xfa74('0x2f'),{'sessionId':_0x5853d4});return _0x1a2d52[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x30')});})['catch'](handleError(_0x1a2d52));};exports[_0xfa74('0x31')]=function(_0x171923,_0x54e66d){logger['info']('answer\x20fired:',_0x171923['body']);var _0x95c891=answerValidation[_0xfa74('0xa')](_0x171923[_0xfa74('0x24')]);if(_0x95c891[_0xfa74('0x25')]>0x0){return _0x54e66d[_0xfa74('0x17')](0x190)[_0xfa74('0x26')](_0x95c891);}var _0x7735c5=_0x171923['body'][_0xfa74('0x27')];var _0x3938c1=_0x171923[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x7735c5)[_0xfa74('0x1d')](function(_0x4af7d4){logger[_0xfa74('0x11')](_0xfa74('0x2d'),_0x4af7d4[_0xfa74('0x16')]);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x4af7d4[_0xfa74('0x16')]),_0xfa74('0x33'),{'sessionId':_0x3938c1});return _0x54e66d[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x34')});})['catch'](handleError(_0x54e66d));};exports[_0xfa74('0x35')]=function(_0x4ebb67,_0xb7db3){logger[_0xfa74('0x11')](_0xfa74('0x36'),_0x4ebb67[_0xfa74('0x24')]);var _0x4911a5=holdValidation[_0xfa74('0xa')](_0x4ebb67[_0xfa74('0x24')]);if(_0x4911a5['length']>0x0){return _0xb7db3[_0xfa74('0x17')](0x190)[_0xfa74('0x26')](_0x4911a5);}var _0x5cbb70=_0x4ebb67[_0xfa74('0x24')][_0xfa74('0x27')];var _0x26d239=_0x4ebb67[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x5cbb70)['then'](function(_0x54e06c){logger[_0xfa74('0x11')](_0xfa74('0x2d'),_0x54e06c['name']);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x54e06c[_0xfa74('0x16')]),'webbar:hold',{'sessionId':_0x26d239});return _0xb7db3['status'](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x37')});})[_0xfa74('0x1a')](handleError(_0xb7db3));};exports[_0xfa74('0x38')]=function(_0x36508a,_0x3cb23d){logger[_0xfa74('0x11')](_0xfa74('0x39'),_0x36508a['body']);var _0x214994=unholdValidation[_0xfa74('0xa')](_0x36508a[_0xfa74('0x24')]);if(_0x214994[_0xfa74('0x25')]>0x0){return _0x3cb23d['status'](0x190)['json'](_0x214994);}var _0x3146de=_0x36508a['body'][_0xfa74('0x27')];var _0x221dc7=_0x36508a[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x3146de)[_0xfa74('0x1d')](function(_0x144c80){logger[_0xfa74('0x11')]('entityFound:',_0x144c80[_0xfa74('0x16')]);emit(util['format'](_0xfa74('0x32'),_0x144c80['name']),'webbar:unhold',{'sessionId':_0x221dc7});return _0x3cb23d[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x3cb23d));};exports[_0xfa74('0x3a')]=function(_0x1ab715,_0x8afe72){logger[_0xfa74('0x11')](_0xfa74('0x3b'),_0x8afe72[_0xfa74('0x24')]);var _0x1198f3=callsValidation[_0xfa74('0xa')](_0x1ab715[_0xfa74('0x24')]);if(_0x1198f3[_0xfa74('0x25')]>0x0){return _0x8afe72['status'](0x190)[_0xfa74('0x26')](_0x1198f3);}var _0xc89005=_0x1ab715['body']['userId'];var _0x3d88dc=respondWithRpcPromise(_0xfa74('0x3c'));var _0x99f568=getAgent(_0xc89005);return Promise[_0xfa74('0x1e')]([_0x3d88dc,_0x99f568])[_0xfa74('0x1d')](function(_0x5475f1){var _0x36cfc6=_0x5475f1[0x0];var _0x4d6235=_0x5475f1[0x1];var _0x26b398=_[_0xfa74('0x3d')](_0x36cfc6[_0xfa74('0x3e')],function(_0x480295){return _0x480295['UserId']==_0x4d6235['id'];});return _0x8afe72[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'count':_0x26b398[_0xfa74('0x25')],'rows':_0x26b398});})[_0xfa74('0x1a')](handleError(_0x8afe72));};exports['conference']=function(_0xe87727,_0x2f5c31){logger['info'](_0xfa74('0x3f'),_0xe87727[_0xfa74('0x24')]);var _0x1861af=conferenceValidation[_0xfa74('0xa')](_0xe87727['body']);if(_0x1861af[_0xfa74('0x25')]>0x0){return _0x2f5c31['status'](0x190)[_0xfa74('0x26')](_0x1861af);}var _0x3ceb9d=_0xe87727[_0xfa74('0x24')][_0xfa74('0x27')];return getAgent(_0x3ceb9d)[_0xfa74('0x1d')](function(_0x6a3790){logger[_0xfa74('0x11')](_0xfa74('0x2d'),_0x6a3790[_0xfa74('0x16')]);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x6a3790[_0xfa74('0x16')]),_0xfa74('0x40'));return _0x2f5c31[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':'conference\x20executed!'});})[_0xfa74('0x1a')](handleError(_0x2f5c31));};exports[_0xfa74('0x41')]=function(_0x5035dd,_0x57a923){logger[_0xfa74('0x11')]('transfer\x20fired:',_0x5035dd[_0xfa74('0x24')]);var _0x2e8174=transferValidation[_0xfa74('0xa')](_0x5035dd['body']);if(_0x2e8174[_0xfa74('0x25')]>0x0){return _0x57a923['status'](0x190)['json'](_0x2e8174);}var _0x1856ea=_0x5035dd[_0xfa74('0x24')][_0xfa74('0x27')];var _0x414e31=_0x5035dd[_0xfa74('0x24')][_0xfa74('0x1f')];var _0x70120d=_0x5035dd[_0xfa74('0x24')][_0xfa74('0x42')];return getAgent(_0x1856ea)[_0xfa74('0x1d')](function(_0x2588bb){logger['info'](_0xfa74('0x2d'),_0x2588bb['name']);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x2588bb[_0xfa74('0x16')]),'webbar:transfer',{'sessionId':_0x414e31,'transferNumber':_0x70120d});return _0x57a923[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x43')});})['catch'](handleError(_0x57a923));};
\ No newline at end of file
index cfd237f..defaf79 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x896e=['/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAnswer','/:id/notify','notify','/:id/send','send','put','destroy','delete','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0x896e,0x1e9));var _0xe896=function(_0x243f41,_0x2b539f){_0x243f41=_0x243f41-0x0;var _0x3d9be8=_0x896e[_0x243f41];return _0x3d9be8;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var fs_extra=require(_0xe896('0x6'));var auth=require(_0xe896('0x7'));var interaction=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var controller=require(_0xe896('0xa'));router[_0xe896('0xb')]('/',auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0xb')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0xf')]);router['get'](_0xe896('0x10'),auth[_0xe896('0xe')](),controller[_0xe896('0x11')]);router['get'](_0xe896('0x12'),auth['isAuthenticated'](),controller[_0xe896('0x13')]);router['get'](_0xe896('0x14'),auth[_0xe896('0xe')](),controller[_0xe896('0x15')]);router['get'](_0xe896('0x16'),auth[_0xe896('0xe')](),controller[_0xe896('0x17')]);router['get'](_0xe896('0x18'),auth[_0xe896('0xe')](),controller[_0xe896('0x19')]);router['post']('/',auth[_0xe896('0xe')](),controller[_0xe896('0x1a')]);router[_0xe896('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe896('0x1c')]);router[_0xe896('0x1b')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xe896('0x1d')]);router[_0xe896('0x1b')]('/:id/users',auth[_0xe896('0xe')](),controller['addAgents']);router[_0xe896('0x1b')](_0xe896('0x18'),auth[_0xe896('0xe')](),controller['addApplications']);router[_0xe896('0x1b')](_0xe896('0x1e'),controller[_0xe896('0x1f')]);router[_0xe896('0x1b')](_0xe896('0x20'),auth[_0xe896('0xe')](),controller[_0xe896('0x21')]);router[_0xe896('0x22')]('/:id',auth[_0xe896('0xe')](),controller['update']);router['delete'](_0xe896('0x10'),auth[_0xe896('0xe')](),controller[_0xe896('0x23')]);router[_0xe896('0x24')]('/:id/dispositions',auth[_0xe896('0xe')](),controller['removeDispositions']);router['delete'](_0xe896('0x14'),auth[_0xe896('0xe')](),controller[_0xe896('0x25')]);router[_0xe896('0x24')](_0xe896('0x16'),auth[_0xe896('0xe')](),controller[_0xe896('0x26')]);module['exports']=router;
\ No newline at end of file
+var _0x781d=['post','addDisposition','/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x781d,0x14a));var _0xd781=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x781d[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd781('0x2'));var router=express[_0xd781('0x3')]();var fs_extra=require(_0xd781('0x4'));var auth=require(_0xd781('0x5'));var interaction=require(_0xd781('0x6'));var config=require(_0xd781('0x7'));var controller=require(_0xd781('0x8'));router[_0xd781('0x9')]('/',auth[_0xd781('0xa')](),controller[_0xd781('0xb')]);router['get'](_0xd781('0xc'),auth[_0xd781('0xa')](),controller[_0xd781('0xd')]);router[_0xd781('0x9')]('/:id',auth[_0xd781('0xa')](),controller['show']);router[_0xd781('0x9')](_0xd781('0xe'),auth['isAuthenticated'](),controller[_0xd781('0xf')]);router[_0xd781('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xd781('0x10')]);router[_0xd781('0x9')](_0xd781('0x11'),auth[_0xd781('0xa')](),controller[_0xd781('0x12')]);router[_0xd781('0x9')](_0xd781('0x13'),auth[_0xd781('0xa')](),controller[_0xd781('0x14')]);router[_0xd781('0x15')]('/',auth[_0xd781('0xa')](),controller['create']);router[_0xd781('0x15')](_0xd781('0xe'),auth['isAuthenticated'](),controller[_0xd781('0x16')]);router['post'](_0xd781('0x17'),auth[_0xd781('0xa')](),controller[_0xd781('0x18')]);router[_0xd781('0x15')](_0xd781('0x11'),auth[_0xd781('0xa')](),controller[_0xd781('0x19')]);router['post'](_0xd781('0x13'),auth[_0xd781('0xa')](),controller[_0xd781('0x1a')]);router[_0xd781('0x15')](_0xd781('0x1b'),controller[_0xd781('0x1c')]);router[_0xd781('0x15')](_0xd781('0x1d'),auth['isAuthenticated'](),controller[_0xd781('0x1e')]);router[_0xd781('0x1f')](_0xd781('0x20'),auth[_0xd781('0xa')](),controller[_0xd781('0x21')]);router[_0xd781('0x22')](_0xd781('0x20'),auth['isAuthenticated'](),controller[_0xd781('0x23')]);router['delete']('/:id/dispositions',auth[_0xd781('0xa')](),controller['removeDispositions']);router[_0xd781('0x22')](_0xd781('0x17'),auth[_0xd781('0xa')](),controller[_0xd781('0x24')]);router[_0xd781('0x22')](_0xd781('0x11'),auth[_0xd781('0xa')](),controller[_0xd781('0x25')]);module[_0xd781('0x26')]=router;
\ No newline at end of file
index 4e23108..b4c3a89 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x379f=['ENUM','sinch','TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','name','STRING','generate'];(function(_0x599085,_0x10d2e4){var _0x502f5b=function(_0x3f0857){while(--_0x3f0857){_0x599085['push'](_0x599085['shift']());}};_0x502f5b(++_0x10d2e4);}(_0x379f,0x169));var _0xf379=function(_0x412721,_0x4eee35){_0x412721=_0x412721-0x0;var _0x13907c=_0x379f[_0x412721];return _0x13907c;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf379('0x0'),'allowNull':![]},'key':{'type':Sequelize[_0xf379('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xf379('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xf379('0x1')],'defaultValue':function(){return rs[_0xf379('0x2')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf379('0x3')]('twilio',_0xf379('0x4'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xf379('0x1')]},'notificationTemplate':{'type':Sequelize[_0xf379('0x5')],'defaultValue':function(){return _0xf379('0x6');}},'notificationSound':{'type':Sequelize[_0xf379('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xf379('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf379('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf379('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf379('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf379('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xf379('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xf379('0x7')],'defaultValue':![],'comment':_0xf379('0xa'),'set':function(_0x28d823){if(!_0x28d823){this[_0xf379('0xb')](_0xf379('0xc'),null);}this[_0xf379('0xb')](_0xf379('0xd'),_0x28d823);}},'description':{'type':Sequelize[_0xf379('0x1')]}};
\ No newline at end of file
+var _0xd0df=['TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','STRING','generate','ENUM','sinch'];(function(_0xd3476e,_0x51b88d){var _0x26aff2=function(_0x5b7828){while(--_0x5b7828){_0xd3476e['push'](_0xd3476e['shift']());}};_0x26aff2(++_0x51b88d);}(_0xd0df,0x139));var _0xfd0d=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0xd0df[_0xf48cce];return _0x2a5c38;};'use strict';var Sequelize=require(_0xfd0d('0x0'));var rs=require('randomstring');module[_0xfd0d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfd0d('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xfd0d('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xfd0d('0x3')],'defaultValue':function(){return rs[_0xfd0d('0x4')]();}},'phone':{'type':Sequelize[_0xfd0d('0x3')]},'type':{'type':Sequelize[_0xfd0d('0x5')]('twilio',_0xfd0d('0x6'))},'accountSid':{'type':Sequelize[_0xfd0d('0x3')]},'baseUrl':{'type':Sequelize[_0xfd0d('0x3')]},'authToken':{'type':Sequelize[_0xfd0d('0x3')]},'notificationTemplate':{'type':Sequelize[_0xfd0d('0x7')],'defaultValue':function(){return _0xfd0d('0x8');}},'notificationSound':{'type':Sequelize[_0xfd0d('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfd0d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfd0d('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfd0d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfd0d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xfd0d('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xfd0d('0x9')],'defaultValue':![],'comment':_0xfd0d('0xc'),'set':function(_0x6d95f8){if(!_0x6d95f8){this[_0xfd0d('0xd')](_0xfd0d('0xe'),null);}this[_0xfd0d('0xd')](_0xfd0d('0xf'),_0x6d95f8);}},'description':{'type':Sequelize[_0xfd0d('0x3')]}};
\ No newline at end of file
index 7bd3cb9..430050d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7c06=['Contacts','updatedAt','DESC','list','omit','defaults','WhatsappInteraction','interaction','created','push','close','unmanaged','WhatsappMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','Content-Type','text/xml','send','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','end','status','undefined','offset','limit','set','Content-Range','json','apply','reject','save','get','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','include','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','WhatsappAccountId','getDispositions','findOne','Disposition','count','findAll','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','Applications','account','statuses','read','message_id','applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList'];(function(_0x47c164,_0x59e20d){var _0x3be125=function(_0x4c15cf){while(--_0x4c15cf){_0x47c164['push'](_0x47c164['shift']());}};_0x3be125(++_0x59e20d);}(_0x7c06,0x1a9));var _0x67c0=function(_0x596ba6,_0x4e8dab){_0x596ba6=_0x596ba6-0x0;var _0x2d3de8=_0x7c06[_0x596ba6];return _0x2d3de8;};'use strict';var emlformat=require(_0x67c0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x67c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x67c0('0x2'));var moment=require(_0x67c0('0x3'));var BPromise=require(_0x67c0('0x4'));var Mustache=require(_0x67c0('0x5'));var util=require(_0x67c0('0x6'));var path=require('path');var sox=require(_0x67c0('0x7'));var csv=require(_0x67c0('0x8'));var ejs=require(_0x67c0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x67c0('0xa'));var squel=require(_0x67c0('0xb'));var crypto=require(_0x67c0('0xc'));var jsforce=require(_0x67c0('0xd'));var deskjs=require(_0x67c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x67c0('0xf'));var Papa=require('papaparse');var Redis=require(_0x67c0('0x10'));var authService=require(_0x67c0('0x11'));var qs=require(_0x67c0('0x12'));var as=require(_0x67c0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x67c0('0x14'))('api');var utils=require(_0x67c0('0x15'));var config=require(_0x67c0('0x16'));var licenseUtil=require(_0x67c0('0x17'));var db=require(_0x67c0('0x18'))['db'];config[_0x67c0('0x19')]=_['defaults'](config[_0x67c0('0x19')],{'host':_0x67c0('0x1a'),'port':0x18eb});var socket=require(_0x67c0('0x1b'))(new Redis(config[_0x67c0('0x19')]));require(_0x67c0('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x67c0('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x3fa899,_0x5dc40f,_0x5a60a2,_0x232d02){return new BPromise(function(_0x21e658,_0x237e0b){var _0x10043a=_0x232d02||client;return _0x10043a[_0x67c0('0x1e')](_0x3fa899,_0x5a60a2)[_0x67c0('0x1f')](function(_0xfc497f){logger['info'](_0x67c0('0x20'),_0x5dc40f,_0x67c0('0x21'));logger[_0x67c0('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5dc40f,_0x67c0('0x21'),JSON[_0x67c0('0x23')](_0xfc497f));if(_0xfc497f[_0x67c0('0x24')]){if(_0xfc497f[_0x67c0('0x24')][_0x67c0('0x25')]===0x1f4){logger[_0x67c0('0x24')](_0x67c0('0x20'),_0x5dc40f,_0xfc497f[_0x67c0('0x24')]['message']);return _0x237e0b(_0xfc497f[_0x67c0('0x24')][_0x67c0('0x26')]);}logger['error'](_0x67c0('0x20'),_0x5dc40f,_0xfc497f[_0x67c0('0x24')]['message']);return _0x21e658(_0xfc497f[_0x67c0('0x24')][_0x67c0('0x26')]);}else{logger[_0x67c0('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x5dc40f,_0x67c0('0x21'));_0x21e658(_0xfc497f[_0x67c0('0x28')][_0x67c0('0x26')]);}})[_0x67c0('0x29')](function(_0x51fde6){logger['error'](_0x67c0('0x20'),_0x5dc40f,_0x51fde6);_0x237e0b(_0x51fde6);});});}function respondWithStatusCode(_0x31dbb4,_0x2441d2){_0x2441d2=_0x2441d2||0xcc;return function(_0x2e6709){if(_0x2e6709){return _0x31dbb4[_0x67c0('0x2a')](_0x2441d2);}return _0x31dbb4['status'](_0x2441d2)[_0x67c0('0x2b')]();};}function respondWithResult(_0x5a101c,_0x48126a){_0x48126a=_0x48126a||0xc8;return function(_0x66215){if(_0x66215){return _0x5a101c[_0x67c0('0x2c')](_0x48126a)['json'](_0x66215);}};}function respondWithFilteredResult(_0x3a01b1,_0x25b98f){return function(_0x38138b){if(_0x38138b){var _0x2de1ba=typeof _0x25b98f['offset']===_0x67c0('0x2d')&&typeof _0x25b98f['limit']==='undefined';var _0xab94f5=_0x38138b['count'];var _0x2b0192=_0x2de1ba?0x0:_0x25b98f['offset'];var _0x519284=_0x2de1ba?_0x38138b['count']:_0x25b98f[_0x67c0('0x2e')]+_0x25b98f[_0x67c0('0x2f')];var _0x3c0eba;if(_0x519284>=_0xab94f5){_0x519284=_0xab94f5;_0x3c0eba=0xc8;}else{_0x3c0eba=0xce;}_0x3a01b1['status'](_0x3c0eba);return _0x3a01b1[_0x67c0('0x30')](_0x67c0('0x31'),_0x2b0192+'-'+_0x519284+'/'+_0xab94f5)[_0x67c0('0x32')](_0x38138b);}return null;};}function patchUpdates(_0x158deb){return function(_0x4f4686){try{jsonpatch[_0x67c0('0x33')](_0x4f4686,_0x158deb,!![]);}catch(_0x2764c4){return BPromise[_0x67c0('0x34')](_0x2764c4);}return _0x4f4686[_0x67c0('0x35')]();};}function saveUpdates(_0x14058d,_0x29906c){return function(_0x4e7d26){if(_0x4e7d26){return _0x4e7d26['update'](_0x14058d)[_0x67c0('0x1f')](function(_0xb8c62b){return _0xb8c62b;});}return null;};}function removeEntity(_0x2c5b0f,_0x467644){return function(_0x30f2b6){if(_0x30f2b6){return _0x30f2b6['destroy']()[_0x67c0('0x1f')](function(){var _0x5e2962=_0x30f2b6[_0x67c0('0x36')]({'plain':!![]});var _0x5e7b9c='WhatsappAccounts';return db[_0x67c0('0x37')][_0x67c0('0x38')]({'where':{'type':_0x5e7b9c,'resourceId':_0x5e2962['id']}})[_0x67c0('0x1f')](function(){return _0x30f2b6;});})[_0x67c0('0x1f')](function(){_0x2c5b0f[_0x67c0('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36e1ac,_0x12db1c){return function(_0x1ecc83){if(!_0x1ecc83){_0x36e1ac[_0x67c0('0x2a')](0x194);}return _0x1ecc83;};}function handleError(_0x31d1f6,_0x5e3831){_0x5e3831=_0x5e3831||0x1f4;return function(_0x595798){logger['error'](_0x595798[_0x67c0('0x39')]);if(_0x595798[_0x67c0('0x3a')]){delete _0x595798[_0x67c0('0x3a')];}_0x31d1f6[_0x67c0('0x2c')](_0x5e3831)['send'](_0x595798);};}exports[_0x67c0('0x3b')]=function(_0x1b2b48,_0x213569){var _0x532e6a={'include':[{'model':db[_0x67c0('0x3c')],'as':_0x67c0('0x3d')}]},_0xaf3e20={},_0x151a06={'count':0x0,'rows':[]};var _0xe4af84=_[_0x67c0('0x3e')](db[_0x67c0('0x3f')]['rawAttributes'],function(_0x44b848){return{'name':_0x44b848[_0x67c0('0x40')],'type':_0x44b848[_0x67c0('0x41')][_0x67c0('0x42')]};});_0xaf3e20[_0x67c0('0x43')]=_[_0x67c0('0x3e')](_0xe4af84,_0x67c0('0x3a'));_0xaf3e20[_0x67c0('0x44')]=_[_0x67c0('0x45')](_0x1b2b48[_0x67c0('0x44')]);_0xaf3e20[_0x67c0('0x46')]=_['intersection'](_0xaf3e20[_0x67c0('0x43')],_0xaf3e20['query']);_0x532e6a['attributes']=_[_0x67c0('0x47')](_0xaf3e20[_0x67c0('0x43')],qs[_0x67c0('0x48')](_0x1b2b48[_0x67c0('0x44')][_0x67c0('0x48')]));_0x532e6a[_0x67c0('0x49')]=_0x532e6a[_0x67c0('0x49')][_0x67c0('0x4a')]?_0x532e6a[_0x67c0('0x49')]:_0xaf3e20['model'];if(!_0x1b2b48[_0x67c0('0x44')][_0x67c0('0x4b')](_0x67c0('0x4c'))){_0x532e6a[_0x67c0('0x2f')]=qs[_0x67c0('0x2f')](_0x1b2b48[_0x67c0('0x44')]['limit']);_0x532e6a[_0x67c0('0x2e')]=qs[_0x67c0('0x2e')](_0x1b2b48[_0x67c0('0x44')][_0x67c0('0x2e')]);}_0x532e6a[_0x67c0('0x4d')]=qs[_0x67c0('0x4e')](_0x1b2b48[_0x67c0('0x44')][_0x67c0('0x4e')]);_0x532e6a['where']=qs[_0x67c0('0x46')](_[_0x67c0('0x4f')](_0x1b2b48[_0x67c0('0x44')],_0xaf3e20['filters']),_0xe4af84);if(_0x1b2b48[_0x67c0('0x44')]['filter']){_0x532e6a[_0x67c0('0x50')]=_['merge'](_0x532e6a['where'],{'$or':_['map'](_0xe4af84,function(_0x3808a6){if(_0x3808a6[_0x67c0('0x41')]!==_0x67c0('0x51')){var _0x1cc8b7={};_0x1cc8b7[_0x3808a6['name']]={'$like':'%'+_0x1b2b48[_0x67c0('0x44')][_0x67c0('0x52')]+'%'};return _0x1cc8b7;}})});}_0x532e6a=_[_0x67c0('0x53')]({},_0x532e6a,_0x1b2b48[_0x67c0('0x54')]);var _0x229139={'where':_0x532e6a[_0x67c0('0x50')]};return db[_0x67c0('0x3f')]['count'](_0x229139)['then'](function(_0x1f0f8f){_0x151a06['count']=_0x1f0f8f;if(_0x1b2b48[_0x67c0('0x44')]['includeAll']){_0x532e6a[_0x67c0('0x55')]=[{'all':!![]}];}return db[_0x67c0('0x3f')]['findAll'](_0x532e6a);})['then'](function(_0x5c6f31){_0x151a06['rows']=_0x5c6f31;return _0x151a06;})[_0x67c0('0x1f')](respondWithFilteredResult(_0x213569,_0x532e6a))[_0x67c0('0x29')](handleError(_0x213569,null));};exports[_0x67c0('0x56')]=function(_0x275b69,_0x39a831){var _0x542e85={'raw':![],'where':{'id':_0x275b69[_0x67c0('0x57')]['id']},'include':[{'model':db[_0x67c0('0x3c')],'as':_0x67c0('0x3d')}]},_0x4e811b={};_0x4e811b['model']=_[_0x67c0('0x45')](db[_0x67c0('0x3f')][_0x67c0('0x58')]);_0x4e811b[_0x67c0('0x44')]=_['keys'](_0x275b69[_0x67c0('0x44')]);_0x4e811b[_0x67c0('0x46')]=_[_0x67c0('0x47')](_0x4e811b[_0x67c0('0x43')],_0x4e811b[_0x67c0('0x44')]);_0x542e85[_0x67c0('0x49')]=_[_0x67c0('0x47')](_0x4e811b['model'],qs[_0x67c0('0x48')](_0x275b69[_0x67c0('0x44')][_0x67c0('0x48')]));_0x542e85[_0x67c0('0x49')]=_0x542e85[_0x67c0('0x49')][_0x67c0('0x4a')]?_0x542e85[_0x67c0('0x49')]:_0x4e811b[_0x67c0('0x43')];if(_0x275b69[_0x67c0('0x44')][_0x67c0('0x59')]){_0x542e85['include']=[{'all':!![]}];}_0x542e85=_[_0x67c0('0x53')]({},_0x542e85,_0x275b69[_0x67c0('0x54')]);return db[_0x67c0('0x3f')][_0x67c0('0x5a')](_0x542e85)['then'](handleEntityNotFound(_0x39a831,null))[_0x67c0('0x1f')](respondWithResult(_0x39a831,null))[_0x67c0('0x29')](handleError(_0x39a831,null));};exports[_0x67c0('0x5b')]=function(_0x69b357,_0x2e951f){return db[_0x67c0('0x3f')][_0x67c0('0x5b')](_0x69b357[_0x67c0('0x5c')],{})[_0x67c0('0x1f')](function(_0x2ee6ff){var _0x330888=_0x69b357[_0x67c0('0x5d')][_0x67c0('0x36')]({'plain':!![]});if(!_0x330888)throw new Error(_0x67c0('0x5e'));if(_0x330888[_0x67c0('0x5f')]===_0x67c0('0x5d')){var _0x2fd6e8=_0x2ee6ff[_0x67c0('0x36')]({'plain':!![]});var _0xe0117f='WhatsappAccounts';return db[_0x67c0('0x60')][_0x67c0('0x5a')]({'where':{'name':_0xe0117f,'userProfileId':_0x330888['userProfileId']},'raw':!![]})[_0x67c0('0x1f')](function(_0x449e7b){if(_0x449e7b&&_0x449e7b[_0x67c0('0x61')]===0x0){return db[_0x67c0('0x37')][_0x67c0('0x5b')]({'name':_0x2fd6e8[_0x67c0('0x3a')],'resourceId':_0x2fd6e8['id'],'type':_0x449e7b[_0x67c0('0x3a')],'sectionId':_0x449e7b['id']},{})['then'](function(){return _0x2ee6ff;});}else{return _0x2ee6ff;}})[_0x67c0('0x29')](function(_0x1e11fc){logger[_0x67c0('0x24')](_0x67c0('0x62'),_0x1e11fc);throw _0x1e11fc;});}return _0x2ee6ff;})[_0x67c0('0x1f')](respondWithResult(_0x2e951f,0xc9))['catch'](handleError(_0x2e951f,null));};exports[_0x67c0('0x63')]=function(_0x310d96,_0x5af17a){if(_0x310d96[_0x67c0('0x5c')]['id']){delete _0x310d96[_0x67c0('0x5c')]['id'];}return db[_0x67c0('0x3f')]['find']({'where':{'id':_0x310d96[_0x67c0('0x57')]['id']},'include':[{'model':db[_0x67c0('0x3c')],'as':_0x67c0('0x3d')}]})['then'](handleEntityNotFound(_0x5af17a,null))[_0x67c0('0x1f')](saveUpdates(_0x310d96[_0x67c0('0x5c')],null))[_0x67c0('0x1f')](respondWithResult(_0x5af17a,null))[_0x67c0('0x29')](handleError(_0x5af17a,null));};exports[_0x67c0('0x38')]=function(_0x360b70,_0x5302e4){return db[_0x67c0('0x3f')]['find']({'where':{'id':_0x360b70['params']['id']}})[_0x67c0('0x1f')](handleEntityNotFound(_0x5302e4,null))[_0x67c0('0x1f')](removeEntity(_0x5302e4,null))[_0x67c0('0x29')](handleError(_0x5302e4,null));};exports['describe']=function(_0x53a0f5,_0x30ac22){return db[_0x67c0('0x3f')][_0x67c0('0x64')]()['then'](respondWithResult(_0x30ac22,null))[_0x67c0('0x29')](handleError(_0x30ac22,null));};exports['addDisposition']=function(_0x8ebe1c,_0x59c9d8,_0x110e34){if(_0x8ebe1c['body']['id']){delete _0x8ebe1c['body']['id'];}return db[_0x67c0('0x3f')][_0x67c0('0x5a')]({'where':{'id':_0x8ebe1c['params']['id']}})['then'](handleEntityNotFound(_0x59c9d8,null))[_0x67c0('0x1f')](function(_0x45baff){if(_0x45baff){_0x8ebe1c[_0x67c0('0x5c')][_0x67c0('0x65')]=_0x45baff['id'];return db['Disposition'][_0x67c0('0x5b')](_0x8ebe1c[_0x67c0('0x5c')]);}})[_0x67c0('0x1f')](respondWithResult(_0x59c9d8,null))[_0x67c0('0x29')](handleError(_0x59c9d8,null));};exports[_0x67c0('0x66')]=function(_0x164f55,_0x138db0,_0x3005f8){var _0x1b2a94={'raw':![],'where':{}};var _0x2a7209={};var _0x53b836={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x67c0('0x67')]({'where':{'id':_0x164f55[_0x67c0('0x57')]['id']}})[_0x67c0('0x1f')](handleEntityNotFound(_0x138db0,null))['then'](function(_0x3e8e52){if(_0x3e8e52){_0x2a7209[_0x67c0('0x43')]=_[_0x67c0('0x45')](db[_0x67c0('0x68')][_0x67c0('0x58')]);_0x2a7209[_0x67c0('0x44')]=_[_0x67c0('0x45')](_0x164f55['query']);_0x2a7209[_0x67c0('0x46')]=_[_0x67c0('0x47')](_0x2a7209[_0x67c0('0x43')],_0x2a7209['query']);_0x1b2a94[_0x67c0('0x49')]=_[_0x67c0('0x47')](_0x2a7209[_0x67c0('0x43')],qs[_0x67c0('0x48')](_0x164f55[_0x67c0('0x44')][_0x67c0('0x48')]));_0x1b2a94['attributes']=_0x1b2a94['attributes'][_0x67c0('0x4a')]?_0x1b2a94[_0x67c0('0x49')]:_0x2a7209[_0x67c0('0x43')];if(!_0x164f55[_0x67c0('0x44')][_0x67c0('0x4b')](_0x67c0('0x4c'))){_0x1b2a94[_0x67c0('0x2f')]=qs[_0x67c0('0x2f')](_0x164f55['query'][_0x67c0('0x2f')]);_0x1b2a94[_0x67c0('0x2e')]=qs[_0x67c0('0x2e')](_0x164f55[_0x67c0('0x44')]['offset']);}_0x1b2a94[_0x67c0('0x4d')]=qs[_0x67c0('0x4e')](_0x164f55['query']['sort']);_0x1b2a94[_0x67c0('0x50')]=qs['filters'](_['pick'](_0x164f55[_0x67c0('0x44')],_0x2a7209[_0x67c0('0x46')]));_0x1b2a94[_0x67c0('0x50')]['WhatsappAccountId']=_0x3e8e52['id'];if(_0x164f55[_0x67c0('0x44')]['filter']){_0x1b2a94['where']=_[_0x67c0('0x53')](_0x1b2a94[_0x67c0('0x50')],{'$or':_['map'](_0x1b2a94[_0x67c0('0x49')],function(_0x5330c0){var _0x3c8d4f={};_0x3c8d4f[_0x5330c0]={'$like':'%'+_0x164f55[_0x67c0('0x44')][_0x67c0('0x52')]+'%'};return _0x3c8d4f;})});}_0x1b2a94=_['merge']({},_0x1b2a94,_0x164f55[_0x67c0('0x54')]);return db[_0x67c0('0x68')][_0x67c0('0x69')]({'where':_0x1b2a94[_0x67c0('0x50')]})[_0x67c0('0x1f')](function(_0x322a0e){_0x53b836[_0x67c0('0x69')]=_0x322a0e;if(_0x164f55[_0x67c0('0x44')][_0x67c0('0x59')]){_0x1b2a94[_0x67c0('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x67c0('0x6a')](_0x1b2a94);})['then'](function(_0x9f9769){_0x53b836[_0x67c0('0x6b')]=_0x9f9769;return _0x53b836;});}})[_0x67c0('0x1f')](respondWithFilteredResult(_0x138db0,_0x1b2a94))[_0x67c0('0x29')](handleError(_0x138db0,null));};exports[_0x67c0('0x6c')]=function(_0xe5ec9a,_0xd12596,_0x17813e){return db[_0x67c0('0x3f')][_0x67c0('0x5a')]({'where':{'id':_0xe5ec9a['params']['id']}})[_0x67c0('0x1f')](handleEntityNotFound(_0xd12596,null))['then'](function(_0x28de8d){if(_0x28de8d){return _0x28de8d[_0x67c0('0x6c')](_0xe5ec9a[_0x67c0('0x44')]['ids']);}})['then'](respondWithStatusCode(_0xd12596,null))[_0x67c0('0x29')](handleError(_0xd12596,null));};exports['addAnswer']=function(_0x1f2d83,_0x2045be,_0x584850){if(_0x1f2d83['body']['id']){delete _0x1f2d83[_0x67c0('0x5c')]['id'];}return db[_0x67c0('0x3f')][_0x67c0('0x5a')]({'where':{'id':_0x1f2d83[_0x67c0('0x57')]['id']}})[_0x67c0('0x1f')](handleEntityNotFound(_0x2045be,null))[_0x67c0('0x1f')](function(_0x565de2){if(_0x565de2){_0x1f2d83[_0x67c0('0x5c')][_0x67c0('0x65')]=_0x565de2['id'];return db[_0x67c0('0x6d')][_0x67c0('0x5b')](_0x1f2d83[_0x67c0('0x5c')]);}})[_0x67c0('0x1f')](respondWithResult(_0x2045be,null))['catch'](handleError(_0x2045be,null));};exports[_0x67c0('0x6e')]=function(_0xe862de,_0x477eb3,_0x595f07){var _0x20a444={'raw':![],'where':{}};var _0x441e0b={};var _0x440bc9={'count':0x0,'rows':[]};return db[_0x67c0('0x3f')][_0x67c0('0x67')]({'where':{'id':_0xe862de[_0x67c0('0x57')]['id']}})[_0x67c0('0x1f')](handleEntityNotFound(_0x477eb3,null))['then'](function(_0x554c13){if(_0x554c13){_0x441e0b[_0x67c0('0x43')]=_[_0x67c0('0x45')](db[_0x67c0('0x6d')][_0x67c0('0x58')]);_0x441e0b[_0x67c0('0x44')]=_[_0x67c0('0x45')](_0xe862de[_0x67c0('0x44')]);_0x441e0b[_0x67c0('0x46')]=_[_0x67c0('0x47')](_0x441e0b['model'],_0x441e0b[_0x67c0('0x44')]);_0x20a444[_0x67c0('0x49')]=_['intersection'](_0x441e0b[_0x67c0('0x43')],qs[_0x67c0('0x48')](_0xe862de[_0x67c0('0x44')][_0x67c0('0x48')]));_0x20a444[_0x67c0('0x49')]=_0x20a444[_0x67c0('0x49')][_0x67c0('0x4a')]?_0x20a444[_0x67c0('0x49')]:_0x441e0b[_0x67c0('0x43')];if(!_0xe862de[_0x67c0('0x44')][_0x67c0('0x4b')]('nolimit')){_0x20a444[_0x67c0('0x2f')]=qs[_0x67c0('0x2f')](_0xe862de['query']['limit']);_0x20a444['offset']=qs['offset'](_0xe862de[_0x67c0('0x44')][_0x67c0('0x2e')]);}_0x20a444['order']=qs[_0x67c0('0x4e')](_0xe862de[_0x67c0('0x44')]['sort']);_0x20a444[_0x67c0('0x50')]=qs[_0x67c0('0x46')](_[_0x67c0('0x4f')](_0xe862de[_0x67c0('0x44')],_0x441e0b[_0x67c0('0x46')]));_0x20a444[_0x67c0('0x50')][_0x67c0('0x65')]=_0x554c13['id'];if(_0xe862de['query']['filter']){_0x20a444[_0x67c0('0x50')]=_[_0x67c0('0x53')](_0x20a444['where'],{'$or':_[_0x67c0('0x3e')](_0x20a444[_0x67c0('0x49')],function(_0x736f0){var _0xe1f827={};_0xe1f827[_0x736f0]={'$like':'%'+_0xe862de[_0x67c0('0x44')]['filter']+'%'};return _0xe1f827;})});}_0x20a444=_['merge']({},_0x20a444,_0xe862de[_0x67c0('0x54')]);return db[_0x67c0('0x6d')][_0x67c0('0x69')]({'where':_0x20a444[_0x67c0('0x50')]})[_0x67c0('0x1f')](function(_0x445c30){_0x440bc9[_0x67c0('0x69')]=_0x445c30;if(_0xe862de['query'][_0x67c0('0x59')]){_0x20a444[_0x67c0('0x55')]=[{'all':!![]}];}return db[_0x67c0('0x6d')][_0x67c0('0x6a')](_0x20a444);})['then'](function(_0x57d9d7){_0x440bc9[_0x67c0('0x6b')]=_0x57d9d7;return _0x440bc9;});}})[_0x67c0('0x1f')](respondWithFilteredResult(_0x477eb3,_0x20a444))['catch'](handleError(_0x477eb3,null));};exports[_0x67c0('0x6f')]=function(_0x53b21e,_0x6d39b4,_0x2658c8){return db['WhatsappAccount'][_0x67c0('0x5a')]({'where':{'id':_0x53b21e[_0x67c0('0x57')]['id']}})[_0x67c0('0x1f')](handleEntityNotFound(_0x6d39b4,null))[_0x67c0('0x1f')](function(_0xe015cb){if(_0xe015cb){return _0xe015cb[_0x67c0('0x6f')](_0x53b21e[_0x67c0('0x44')][_0x67c0('0x70')]);}})[_0x67c0('0x1f')](respondWithStatusCode(_0x6d39b4,null))['catch'](handleError(_0x6d39b4,null));};exports['addAgents']=function(_0x27e57f,_0x430621,_0x1d85fc){return db[_0x67c0('0x3f')][_0x67c0('0x5a')]({'where':{'id':_0x27e57f[_0x67c0('0x57')]['id']}})['then'](handleEntityNotFound(_0x430621,null))['then'](function(_0x9e96e9){if(_0x9e96e9){return _0x9e96e9[_0x67c0('0x71')](_0x27e57f[_0x67c0('0x5c')][_0x67c0('0x70')],_['omit'](_0x27e57f[_0x67c0('0x5c')],[_0x67c0('0x70'),'id'])||{})[_0x67c0('0x72')](function(_0x382e29){for(var _0x43fea3=0x0;_0x43fea3<_0x27e57f['body']['ids'][_0x67c0('0x4a')];_0x43fea3+=0x1){socket[_0x67c0('0x73')](_0x67c0('0x74'),{'UserId':Number(_0x27e57f[_0x67c0('0x5c')][_0x67c0('0x70')][_0x43fea3]),'WhatsappAccountId':Number(_0x27e57f[_0x67c0('0x57')]['id'])});}return _0x382e29;});}})[_0x67c0('0x1f')](respondWithResult(_0x430621,null))[_0x67c0('0x29')](handleError(_0x430621,null));};exports[_0x67c0('0x75')]=function(_0x57e22f,_0x5f366e,_0x1e8f3b){return db[_0x67c0('0x3f')][_0x67c0('0x5a')]({'where':{'id':_0x57e22f['params']['id']}})[_0x67c0('0x1f')](handleEntityNotFound(_0x5f366e,null))[_0x67c0('0x1f')](function(_0xd0aade){if(_0xd0aade){return _0xd0aade[_0x67c0('0x75')](_0x57e22f[_0x67c0('0x44')][_0x67c0('0x70')])[_0x67c0('0x1f')](function(){if(_[_0x67c0('0x76')](_0x57e22f[_0x67c0('0x44')]['ids'])){for(var _0x14e709=0x0;_0x14e709<_0x57e22f[_0x67c0('0x44')][_0x67c0('0x70')][_0x67c0('0x4a')];_0x14e709+=0x1){socket[_0x67c0('0x73')](_0x67c0('0x77'),{'UserId':Number(_0x57e22f[_0x67c0('0x44')][_0x67c0('0x70')][_0x14e709]),'WhatsappAccountId':Number(_0x57e22f[_0x67c0('0x57')]['id'])});}}else{socket[_0x67c0('0x73')](_0x67c0('0x77'),{'UserId':Number(_0x57e22f['query'][_0x67c0('0x70')]),'WhatsappAccountId':Number(_0x57e22f[_0x67c0('0x57')]['id'])});}});}})[_0x67c0('0x1f')](respondWithStatusCode(_0x5f366e,null))[_0x67c0('0x29')](handleError(_0x5f366e,null));};exports[_0x67c0('0x78')]=function(_0x2debe8,_0x4ab8c8,_0x5e88f3){var _0x2d88e6={};var _0x30cabc={};var _0x5c149e;var _0x4ca3a5;return db['WhatsappAccount'][_0x67c0('0x67')]({'where':{'id':_0x2debe8['params']['id']}})[_0x67c0('0x1f')](handleEntityNotFound(_0x4ab8c8,null))[_0x67c0('0x1f')](function(_0x8e1fed){if(_0x8e1fed){_0x5c149e=_0x8e1fed;_0x30cabc['model']=_[_0x67c0('0x45')](db['User'][_0x67c0('0x58')]);_0x30cabc[_0x67c0('0x44')]=_['keys'](_0x2debe8[_0x67c0('0x44')]);_0x30cabc[_0x67c0('0x46')]=_[_0x67c0('0x47')](_0x30cabc[_0x67c0('0x43')],_0x30cabc[_0x67c0('0x44')]);_0x2d88e6[_0x67c0('0x49')]=_[_0x67c0('0x47')](_0x30cabc['model'],qs['fields'](_0x2debe8[_0x67c0('0x44')][_0x67c0('0x48')]));_0x2d88e6['attributes']=_0x2d88e6[_0x67c0('0x49')][_0x67c0('0x4a')]?_0x2d88e6[_0x67c0('0x49')]:_0x30cabc['model'];_0x2d88e6[_0x67c0('0x4d')]=qs['sort'](_0x2debe8[_0x67c0('0x44')][_0x67c0('0x4e')]);_0x2d88e6['where']=qs['filters'](_[_0x67c0('0x4f')](_0x2debe8[_0x67c0('0x44')],_0x30cabc['filters']));if(_0x2debe8[_0x67c0('0x44')][_0x67c0('0x52')]){_0x2d88e6[_0x67c0('0x50')]=_[_0x67c0('0x53')](_0x2d88e6[_0x67c0('0x50')],{'$or':_[_0x67c0('0x3e')](_0x2d88e6[_0x67c0('0x49')],function(_0x3800a6){var _0x15811d={};_0x15811d[_0x3800a6]={'$like':'%'+_0x2debe8[_0x67c0('0x44')]['filter']+'%'};return _0x15811d;})});}_0x2d88e6=_[_0x67c0('0x53')]({},_0x2d88e6,_0x2debe8[_0x67c0('0x54')]);return _0x5c149e['getAgents'](_0x2d88e6);}})[_0x67c0('0x1f')](function(_0x1e2eec){if(_0x1e2eec){_0x4ca3a5=_0x1e2eec[_0x67c0('0x4a')];if(!_0x2debe8['query'][_0x67c0('0x4b')](_0x67c0('0x4c'))){_0x2d88e6[_0x67c0('0x2f')]=qs[_0x67c0('0x2f')](_0x2debe8['query'][_0x67c0('0x2f')]);_0x2d88e6[_0x67c0('0x2e')]=qs[_0x67c0('0x2e')](_0x2debe8[_0x67c0('0x44')][_0x67c0('0x2e')]);}return _0x5c149e['getAgents'](_0x2d88e6);}})[_0x67c0('0x1f')](function(_0x19a453){if(_0x19a453){return _0x19a453?{'count':_0x4ca3a5,'rows':_0x19a453}:null;}})['then'](respondWithResult(_0x4ab8c8,null))['catch'](handleError(_0x4ab8c8,null));};exports['addApplications']=function(_0xffdebc,_0x40b2df){var _0x5f0928=_0xffdebc[_0x67c0('0x57')]['id'];var _0x395711=_0xffdebc[_0x67c0('0x5c')];var _0x5025b3=0xc8;var _0x4cb854=null;return db[_0x67c0('0x79')][_0x67c0('0x7a')]({'isolationLevel':db[_0x67c0('0x79')][_0x67c0('0x7b')][_0x67c0('0x7c')]['READ_COMMITTED']},function(_0x49a5f1){return db[_0x67c0('0x3f')][_0x67c0('0x67')]({'where':{'id':_0x5f0928},'transaction':_0x49a5f1})['then'](function(_0x465281){if(_0x465281){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x5f0928},'transaction':_0x49a5f1})[_0x67c0('0x1f')](function(){var _0x47ee38=_[_0x67c0('0x3e')](_0x395711,function(_0x1bff83){_0x1bff83['WhatsappAccountId']=_0x5f0928;return _0x1bff83;});return db[_0x67c0('0x7d')][_0x67c0('0x7e')](_0x47ee38,{'transaction':_0x49a5f1});});}else{_0x5025b3=0x194;_0x4cb854=[];}});})[_0x67c0('0x1f')](function(){if(_0x5025b3!==0x194){return db['WhatsappApplication'][_0x67c0('0x7f')]({'where':{'WhatsappAccountId':_0x5f0928},'order':_0x67c0('0x80')})['then'](function(_0x497d5e){_0x4cb854=_0x497d5e;});}})[_0x67c0('0x29')](function(_0x23a62f){_0x5025b3=0x1f4;logger[_0x67c0('0x24')](_0x23a62f[_0x67c0('0x39')]);if(_0x23a62f['name']){delete _0x23a62f[_0x67c0('0x3a')];}_0x4cb854=_0x23a62f;})[_0x67c0('0x81')](function(){if(_0x4cb854===null){_0x40b2df['sendStatus'](_0x5025b3);}else{if(_0x5025b3===0x1f4){_0x40b2df[_0x67c0('0x2c')](_0x5025b3)['send'](_0x4cb854);}else{_0x40b2df['status'](_0x5025b3)[_0x67c0('0x32')](_0x4cb854);}}});};exports['getApplications']=function(_0x7a9744,_0x549211,_0x43e9c3){var _0x3945fe={};var _0x5e8bf6={};var _0x2e730d;var _0x3d249f;return db[_0x67c0('0x3f')][_0x67c0('0x67')]({'where':{'id':_0x7a9744[_0x67c0('0x57')]['id']}})[_0x67c0('0x1f')](handleEntityNotFound(_0x549211,null))[_0x67c0('0x1f')](function(_0x1784e0){if(_0x1784e0){_0x2e730d=_0x1784e0;_0x5e8bf6[_0x67c0('0x43')]=_[_0x67c0('0x45')](db[_0x67c0('0x7d')][_0x67c0('0x58')]);_0x5e8bf6[_0x67c0('0x44')]=_[_0x67c0('0x45')](_0x7a9744[_0x67c0('0x44')]);_0x5e8bf6[_0x67c0('0x46')]=_[_0x67c0('0x47')](_0x5e8bf6[_0x67c0('0x43')],_0x5e8bf6[_0x67c0('0x44')]);_0x3945fe[_0x67c0('0x49')]=_[_0x67c0('0x47')](_0x5e8bf6['model'],qs[_0x67c0('0x48')](_0x7a9744[_0x67c0('0x44')][_0x67c0('0x48')]));_0x3945fe['attributes']=_0x3945fe[_0x67c0('0x49')][_0x67c0('0x4a')]?_0x3945fe[_0x67c0('0x49')]:_0x5e8bf6[_0x67c0('0x43')];_0x3945fe['order']=qs[_0x67c0('0x4e')](_0x7a9744['query'][_0x67c0('0x4e')]);_0x3945fe[_0x67c0('0x50')]=qs[_0x67c0('0x46')](_[_0x67c0('0x4f')](_0x7a9744[_0x67c0('0x44')],_0x5e8bf6[_0x67c0('0x46')]));if(_0x7a9744[_0x67c0('0x44')][_0x67c0('0x52')]){_0x3945fe[_0x67c0('0x50')]=_[_0x67c0('0x53')](_0x3945fe[_0x67c0('0x50')],{'$or':_[_0x67c0('0x3e')](_0x3945fe[_0x67c0('0x49')],function(_0x256804){var _0x1ac2a8={};_0x1ac2a8[_0x256804]={'$like':'%'+_0x7a9744['query']['filter']+'%'};return _0x1ac2a8;})});}_0x3945fe=_[_0x67c0('0x53')]({},_0x3945fe,_0x7a9744[_0x67c0('0x54')]);return _0x2e730d[_0x67c0('0x82')](_0x3945fe);}})[_0x67c0('0x1f')](function(_0x19d065){if(_0x19d065){_0x3d249f=_0x19d065[_0x67c0('0x4a')];if(!_0x7a9744[_0x67c0('0x44')]['hasOwnProperty']('nolimit')){_0x3945fe['limit']=qs[_0x67c0('0x2f')](_0x7a9744['query'][_0x67c0('0x2f')]);_0x3945fe[_0x67c0('0x2e')]=qs[_0x67c0('0x2e')](_0x7a9744['query'][_0x67c0('0x2e')]);}return _0x2e730d[_0x67c0('0x82')](_0x3945fe);}})[_0x67c0('0x1f')](function(_0x5cb4b1){if(_0x5cb4b1){return _0x5cb4b1?{'count':_0x3d249f,'rows':_0x5cb4b1}:null;}})[_0x67c0('0x1f')](respondWithResult(_0x549211,null))[_0x67c0('0x29')](handleError(_0x549211,null));};exports[_0x67c0('0x83')]=function(_0x43eb69,_0x3edd4d,_0x39ccf3){var _0x3a024e={'channel':'whatsapp'};var _0x1db422=[];var _0x3d9579=[];var _0x273e7a={};return db[_0x67c0('0x3f')][_0x67c0('0x5a')]({'where':{'id':_0x43eb69[_0x67c0('0x57')]['id']},'include':[{'model':db[_0x67c0('0x7d')],'as':_0x67c0('0x84')}]})[_0x67c0('0x1f')](handleEntityNotFound(_0x3edd4d,null))['then'](function(_0x368915){_0x3a024e['account']=_0x368915;if(_0x3a024e[_0x67c0('0x85')]&&_0x3a024e[_0x67c0('0x85')]['type']==='sinch'&&_0x43eb69['body'][_0x67c0('0x86')]){if(_0x43eb69[_0x67c0('0x5c')][_0x67c0('0x86')][_0x67c0('0x4a')]===0x0)return;if(_0x43eb69['body']['statuses'][0x0]['state']!==_0x67c0('0x87'))return;return db['WhatsappMessage'][_0x67c0('0x63')]({'read':!![],'readAt':_0x43eb69[_0x67c0('0x5c')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x43eb69[_0x67c0('0x5c')][_0x67c0('0x86')][0x0][_0x67c0('0x88')]},'individualHooks':!![]})[_0x67c0('0x1f')](function(_0x4ca7bc){return _0x3edd4d[_0x67c0('0x2c')](0xc8)['json'](_0x4ca7bc);});}_0x3a024e[_0x67c0('0x89')]=_['orderBy'](_0x368915[_0x67c0('0x84')],[_0x67c0('0x80')],[_0x67c0('0x8a')]);if(_0x3a024e[_0x67c0('0x85')][_0x67c0('0x84')]){delete _0x3a024e[_0x67c0('0x85')][_0x67c0('0x84')];}return db[_0x67c0('0x8b')][_0x67c0('0x64')]()['then'](function(_0x111c1c){if(!_0x111c1c){throw new db[(_0x67c0('0x8c'))][(_0x67c0('0x8d'))](_0x67c0('0x8e'));}_0x1db422=_[_0x67c0('0x8f')](_[_0x67c0('0x45')](_0x111c1c),[_0x67c0('0x90'),'updatedAt']);_0x3d9579=_[_0x67c0('0x8f')](_[_0x67c0('0x45')](_0x111c1c),[_0x67c0('0x90'),'updatedAt',_0x67c0('0x91'),_0x67c0('0x92')]);_0x3a024e['body']={'mapKey':_0x67c0('0x93')};if(_0x3a024e[_0x67c0('0x85')]&&_0x3a024e['account'][_0x67c0('0x41')]==='twilio'){_0x3a024e[_0x67c0('0x5c')]['from']=_0x43eb69[_0x67c0('0x5c')][_0x67c0('0x94')][_0x67c0('0x95')](_0x67c0('0x96'),'');_0x3a024e[_0x67c0('0x5c')][_0x67c0('0x5c')]=_0x43eb69['body'][_0x67c0('0x97')];_0x3a024e['body'][_0x67c0('0x98')]=_0x43eb69[_0x67c0('0x5c')][_0x67c0('0x99')];}if(_0x3a024e['account']&&_0x3a024e[_0x67c0('0x85')][_0x67c0('0x41')]==='sinch'){_0x3a024e[_0x67c0('0x5c')]['from']=_0x43eb69[_0x67c0('0x5c')][_0x67c0('0x9a')][0x0][_0x67c0('0x9b')];_0x3a024e[_0x67c0('0x5c')][_0x67c0('0x5c')]=_0x43eb69[_0x67c0('0x5c')]['notifications'][0x0][_0x67c0('0x26')][_0x67c0('0x5c')];_0x3a024e[_0x67c0('0x5c')][_0x67c0('0x98')]=_0x43eb69['body']['notifications'][0x0][_0x67c0('0x88')];}if(_0x3a024e['body']['id']){delete _0x3a024e[_0x67c0('0x5c')]['id'];}if(_['isNil'](_0x3a024e[_0x67c0('0x5c')]['from'])){throw new db['Sequelize'][(_0x67c0('0x8d'))]('from\x20is\x20mandatory');}if(_[_0x67c0('0x9c')](_0x3a024e[_0x67c0('0x5c')][_0x67c0('0x5c')])||_0x3a024e['body']['body']===''){throw new db[(_0x67c0('0x8c'))][(_0x67c0('0x8d'))](_0x67c0('0x9d'));}if(_[_0x67c0('0x9c')](_0x3a024e[_0x67c0('0x5c')][_0x67c0('0x9e')])){throw new db[(_0x67c0('0x8c'))][(_0x67c0('0x8d'))](_0x67c0('0x9f')+_0x3d9579);}if(!_[_0x67c0('0xa0')](_0x3d9579,_0x3a024e[_0x67c0('0x5c')][_0x67c0('0x9e')])){throw new db['Sequelize']['ValidationError'](_0x67c0('0xa1')+_0x3d9579);}_0x273e7a[_0x3a024e[_0x67c0('0x5c')][_0x67c0('0x9e')]]=_0x3a024e[_0x67c0('0x5c')]['from'];return db[_0x67c0('0xa2')]['find']({'where':{'id':_0x3a024e[_0x67c0('0x85')][_0x67c0('0x92')]},'include':[{'model':db['CmContact'],'as':_0x67c0('0xa3'),'where':_0x273e7a,'limit':0x1,'order':[[_0x67c0('0xa4'),_0x67c0('0xa5')]]}]});})[_0x67c0('0x1f')](handleEntityNotFound(_0x3edd4d,null))[_0x67c0('0x1f')](function(_0x16581a){if(_0x16581a){_0x3a024e[_0x67c0('0xa6')]=_[_0x67c0('0xa7')](_0x16581a,[_0x67c0('0xa3')]);if(_0x16581a[_0x67c0('0xa3')][_0x67c0('0x4a')]){return _0x16581a['Contacts'][0x0];}var _0x154d0a=_[_0x67c0('0xa8')](_0x3a024e['body'],{'firstName':_0x3a024e[_0x67c0('0x5c')][_0x67c0('0x9b')],'ListId':_0x16581a['id']});_0x154d0a[_0x3a024e[_0x67c0('0x5c')][_0x67c0('0x9e')]]=_0x3a024e[_0x67c0('0x5c')][_0x67c0('0x9b')];return db[_0x67c0('0x8b')]['create'](_0x154d0a,{'fields':_0x1db422,'raw':!![]});}})['then'](handleEntityNotFound(_0x3edd4d,null))['then'](function(_0x51f1a1){if(_0x51f1a1){_0x3a024e['contact']=_0x51f1a1;var _0x3e119c={'ContactId':_0x51f1a1['id'],'phone':_0x3a024e[_0x67c0('0x5c')][_0x67c0('0x9b')],'WhatsappAccountId':_0x43eb69[_0x67c0('0x57')]['id']};var _0x14b777={'ContactId':_0x51f1a1['id'],'WhatsappAccountId':_0x43eb69[_0x67c0('0x57')]['id'],'closed':![]};return db[_0x67c0('0xa9')][_0x67c0('0x5a')]({'where':_0x14b777})['then'](function(_0x4831c8){if(_0x4831c8){return[_0x4831c8,![]];}return db[_0x67c0('0xa9')][_0x67c0('0x5b')](_0x3e119c)[_0x67c0('0x1f')](function(_0x27e6a9){return[_0x27e6a9,!![]];});});}})[_0x67c0('0x72')](function(_0x120143,_0x5267ca){_0x3a024e[_0x67c0('0xaa')]=_0x120143[_0x67c0('0x36')]({'plain':!![]});_0x3a024e[_0x67c0('0xaa')][_0x67c0('0xab')]=![];if(_0x5267ca){if(_0x3a024e[_0x67c0('0x85')]['autoclose']){_0x3a024e['applications'][_0x67c0('0xac')]({'id':0x0,'priority':_0x3a024e['applications'][_0x67c0('0x4a')]+0x1,'app':_0x67c0('0xad'),'appdata':_0x67c0('0xae'),'interval':'*,*,*,*'});}_0x3a024e[_0x67c0('0xaa')][_0x67c0('0xab')]=!![];}return db[_0x67c0('0xaf')][_0x67c0('0x5b')]({'phone':_0x3a024e[_0x67c0('0x5c')][_0x67c0('0x9b')],'messageId':_0x3a024e['body'][_0x67c0('0x98')],'body':_0x3a024e[_0x67c0('0x5c')][_0x67c0('0x5c')],'WhatsappAccountId':_0x43eb69[_0x67c0('0x57')]['id'],'WhatsappInteractionId':_0x120143['id'],'direction':'in','ContactId':_0x120143['ContactId'],'AttachmentId':_0x3a024e[_0x67c0('0x5c')]['AttachmentId']});})[_0x67c0('0x1f')](function(_0x2a005f){_0x3a024e[_0x67c0('0x26')]=_0x2a005f;if(_0x3a024e[_0x67c0('0xaa')][_0x67c0('0xb0')]){return db[_0x67c0('0xb1')][_0x67c0('0x5a')]({'attributes':['id',_0x67c0('0x3a')],'where':{'id':_0x3a024e['interaction'][_0x67c0('0xb0')]}})[_0x67c0('0x1f')](function(_0x28ca05){if(_0x28ca05){_0x3a024e[_0x67c0('0x89')][_0x67c0('0xb2')]({'id':0x0,'priority':0x0,'app':_0x67c0('0xb3'),'appdata':_0x28ca05[_0x67c0('0x3a')]+','+(_0x3a024e[_0x67c0('0x85')][_0x67c0('0xb4')]||0xa),'interval':_0x67c0('0xb5')});}return respondWithRpcPromise('Start',_0x67c0('0xb6'),_0x3a024e);});}return respondWithRpcPromise(_0x67c0('0xb7'),_0x67c0('0xb6'),_0x3a024e);})[_0x67c0('0x1f')](function(_0x2916a1){if(_0x2916a1){var _0x388a1b=0xc8;var _0x1e628f=_0x67c0('0xb8');logger[_0x67c0('0x27')](_0x67c0('0xb9'),_0x1e628f,_0x388a1b,_0x67c0('0xba'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1e628f,_0x388a1b,_0x67c0('0xba'),JSON[_0x67c0('0x23')](_0x2916a1));if(_0x3a024e[_0x67c0('0x85')][_0x67c0('0x41')]===_0x67c0('0xbb')){return _0x3edd4d[_0x67c0('0x2c')](_0x388a1b)['set'](_0x67c0('0xbc'),_0x67c0('0xbd'))[_0x67c0('0xbe')]('<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<Response></Response>');}else{return _0x3edd4d['status'](_0x388a1b)['json'](_0x2916a1);}}});})['catch'](handleError(_0x3edd4d,null));};exports[_0x67c0('0xbe')]=function(_0x4dbb18,_0x449a6a,_0x4abc01){var _0x4f3eb2,_0x13107b,_0x3946fe;if(_[_0x67c0('0x9c')](_0x4dbb18[_0x67c0('0x5c')][_0x67c0('0x5c')])||_0x4dbb18[_0x67c0('0x5c')][_0x67c0('0x5c')]===''){throw new db[(_0x67c0('0x8c'))][(_0x67c0('0x8d'))](_0x67c0('0x9d'));}if(_[_0x67c0('0x9c')](_0x4dbb18[_0x67c0('0x5c')]['to'])){throw new db['Sequelize'][(_0x67c0('0x8d'))](_0x67c0('0xbf'));}_0x4f3eb2=_0x4dbb18['body']['to'];return db[_0x67c0('0x3f')][_0x67c0('0x5a')]({'where':{'id':_0x4dbb18['params']['id']},'include':[{'model':db[_0x67c0('0xa2')],'as':_0x67c0('0xc0'),'include':[{'model':db[_0x67c0('0x8b')],'as':_0x67c0('0xa3'),'where':{'mobile':_0x4f3eb2},'limit':0x1,'order':[[_0x67c0('0xa4'),_0x67c0('0xa5')]]}]}]})[_0x67c0('0x1f')](handleEntityNotFound(_0x449a6a,null))['then'](function(_0x52041f){if(_0x52041f&&_0x52041f[_0x67c0('0xc0')]){_0x13107b=_0x52041f[_0x67c0('0x36')]({'plain':!![]});if(_0x13107b[_0x67c0('0xc0')]&&_0x13107b['List'][_0x67c0('0xa3')][_0x67c0('0x4a')]){return _0x13107b['List'][_0x67c0('0xa3')][0x0];}return db['CmContact']['create'](_[_0x67c0('0xa8')](_0x4dbb18[_0x67c0('0x5c')],{'firstName':_0x4f3eb2,'mobile':_0x4f3eb2,'phone':_0x4f3eb2,'ListId':_0x13107b[_0x67c0('0x92')]}));}})[_0x67c0('0x1f')](handleEntityNotFound(_0x449a6a,null))[_0x67c0('0x1f')](function(_0x5e2137){if(_0x5e2137){_0x3946fe=_0x5e2137;return db['WhatsappInteraction'][_0x67c0('0x5a')]({'where':{'ContactId':_0x3946fe['id'],'closed':![],'WhatsappAccountId':_0x13107b['id']}})[_0x67c0('0x1f')](function(_0x1779fa){if(_0x1779fa){return[_0x1779fa,![]];}return db['WhatsappInteraction'][_0x67c0('0x5b')]({'UserId':_0x4dbb18[_0x67c0('0x5d')]['id'],'ContactId':_0x3946fe['id'],'WhatsappAccountId':_0x13107b['id'],'phone':_0x4f3eb2,'firstMsgDirection':_0x67c0('0xc1'),'Messages':[_[_0x67c0('0x53')](_0x4dbb18[_0x67c0('0x5c')],{'read':![],'body':_0x4dbb18['body'][_0x67c0('0x5c')],'phone':_0x4f3eb2,'WhatsappAccountId':_0x13107b['id'],'UserId':_0x4dbb18[_0x67c0('0x5d')]['id'],'ContactId':_0x3946fe['id']})]},{'include':[{'model':db[_0x67c0('0xaf')],'as':_0x67c0('0xc2')}]})[_0x67c0('0x1f')](function(_0x56edd3){return[_0x56edd3,!![]];});});}})['spread'](function(_0x35fefd,_0x3b32ea){if(_0x3b32ea){return _0x35fefd;}return db['WhatsappMessage'][_0x67c0('0x5b')](_[_0x67c0('0x53')](_0x4dbb18[_0x67c0('0x5c')],{'read':![],'body':_0x4dbb18[_0x67c0('0x5c')][_0x67c0('0x5c')],'phone':_0x4f3eb2,'WhatsappAccountId':_0x13107b['id'],'WhatsappInteractionId':_0x35fefd['id'],'UserId':_0x4dbb18['user']['id'],'ContactId':_0x3946fe['id']}))[_0x67c0('0x1f')](function(_0xb3387a){_0x35fefd[_0x67c0('0xc3')][_0x67c0('0xc2')]=[];_0x35fefd['dataValues'][_0x67c0('0xc2')]['push'](_0xb3387a[_0x67c0('0xc3')]);return _0x35fefd;});})[_0x67c0('0x1f')](respondWithResult(_0x449a6a,null))[_0x67c0('0x29')](handleError(_0x449a6a,null));};
\ No newline at end of file
+var _0x1740=['Body','notifications','messageId','message_id','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','CmContact','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','text/xml','<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<Response></Response>','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','merge','where','filter','options','includeAll','include','WhatsappAccount','findAll','rows','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','WhatsappAccountId','Disposition','findOne','rawAttributes','sort','pick','removeDispositions','ids','CannedAnswer','removeAnswers','addAgents','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','priority','stack','finally','sendStatus','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','replace','whatsapp:'];(function(_0x10f049,_0x88db28){var _0x1639c5=function(_0x28685e){while(--_0x28685e){_0x10f049['push'](_0x10f049['shift']());}};_0x1639c5(++_0x88db28);}(_0x1740,0x1a6));var _0x0174=function(_0x517400,_0x382347){_0x517400=_0x517400-0x0;var _0x15b36b=_0x1740[_0x517400];return _0x15b36b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0174('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0174('0x1'));var rp=require(_0x0174('0x2'));var moment=require(_0x0174('0x3'));var BPromise=require(_0x0174('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0174('0x5'));var sox=require(_0x0174('0x6'));var csv=require(_0x0174('0x7'));var ejs=require(_0x0174('0x8'));var fs=require('fs');var fs_extra=require(_0x0174('0x9'));var _=require(_0x0174('0xa'));var squel=require(_0x0174('0xb'));var crypto=require('crypto');var jsforce=require(_0x0174('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0174('0xd'));var Papa=require(_0x0174('0xe'));var Redis=require(_0x0174('0xf'));var authService=require(_0x0174('0x10'));var qs=require(_0x0174('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0174('0x12'));var logger=require(_0x0174('0x13'))(_0x0174('0x14'));var utils=require(_0x0174('0x15'));var config=require(_0x0174('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0174('0x17'))['db'];config[_0x0174('0x18')]=_[_0x0174('0x19')](config['redis'],{'host':_0x0174('0x1a'),'port':0x18eb});var socket=require(_0x0174('0x1b'))(new Redis(config[_0x0174('0x18')]));require(_0x0174('0x1c'))[_0x0174('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x9aada9,_0x38cffa,_0x845f11,_0x558885){return new BPromise(function(_0x3eb473,_0x5f1d97){var _0x197552=_0x558885||client;return _0x197552[_0x0174('0x1e')](_0x9aada9,_0x845f11)[_0x0174('0x1f')](function(_0x1af6cf){logger[_0x0174('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x38cffa,_0x0174('0x21'));logger[_0x0174('0x22')](_0x0174('0x23'),_0x38cffa,'request\x20sent',JSON['stringify'](_0x1af6cf));if(_0x1af6cf['error']){if(_0x1af6cf[_0x0174('0x24')][_0x0174('0x25')]===0x1f4){logger[_0x0174('0x24')](_0x0174('0x26'),_0x38cffa,_0x1af6cf['error'][_0x0174('0x27')]);return _0x5f1d97(_0x1af6cf[_0x0174('0x24')][_0x0174('0x27')]);}logger[_0x0174('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x38cffa,_0x1af6cf[_0x0174('0x24')]['message']);return _0x3eb473(_0x1af6cf[_0x0174('0x24')][_0x0174('0x27')]);}else{logger[_0x0174('0x20')](_0x0174('0x26'),_0x38cffa,_0x0174('0x21'));_0x3eb473(_0x1af6cf[_0x0174('0x28')][_0x0174('0x27')]);}})[_0x0174('0x29')](function(_0x224161){logger[_0x0174('0x24')](_0x0174('0x26'),_0x38cffa,_0x224161);_0x5f1d97(_0x224161);});});}function respondWithStatusCode(_0x17176e,_0x592cb5){_0x592cb5=_0x592cb5||0xcc;return function(_0x394f3f){if(_0x394f3f){return _0x17176e['sendStatus'](_0x592cb5);}return _0x17176e[_0x0174('0x2a')](_0x592cb5)[_0x0174('0x2b')]();};}function respondWithResult(_0x4a757c,_0x10f023){_0x10f023=_0x10f023||0xc8;return function(_0xd95746){if(_0xd95746){return _0x4a757c[_0x0174('0x2a')](_0x10f023)[_0x0174('0x2c')](_0xd95746);}};}function respondWithFilteredResult(_0x2428a4,_0x1332bc){return function(_0x4bcc70){if(_0x4bcc70){var _0x3fdea1=typeof _0x1332bc[_0x0174('0x2d')]===_0x0174('0x2e')&&typeof _0x1332bc[_0x0174('0x2f')]==='undefined';var _0x41964a=_0x4bcc70[_0x0174('0x30')];var _0x41bbd5=_0x3fdea1?0x0:_0x1332bc[_0x0174('0x2d')];var _0x1af9b4=_0x3fdea1?_0x4bcc70[_0x0174('0x30')]:_0x1332bc[_0x0174('0x2d')]+_0x1332bc[_0x0174('0x2f')];var _0x337736;if(_0x1af9b4>=_0x41964a){_0x1af9b4=_0x41964a;_0x337736=0xc8;}else{_0x337736=0xce;}_0x2428a4[_0x0174('0x2a')](_0x337736);return _0x2428a4[_0x0174('0x31')](_0x0174('0x32'),_0x41bbd5+'-'+_0x1af9b4+'/'+_0x41964a)[_0x0174('0x2c')](_0x4bcc70);}return null;};}function patchUpdates(_0x5b3018){return function(_0x48a3e3){try{jsonpatch[_0x0174('0x33')](_0x48a3e3,_0x5b3018,!![]);}catch(_0x2e37d9){return BPromise[_0x0174('0x34')](_0x2e37d9);}return _0x48a3e3[_0x0174('0x35')]();};}function saveUpdates(_0x26de8e,_0x5775a7){return function(_0x27d42a){if(_0x27d42a){return _0x27d42a[_0x0174('0x36')](_0x26de8e)[_0x0174('0x1f')](function(_0x227185){return _0x227185;});}return null;};}function removeEntity(_0x42d3f1,_0x55152e){return function(_0x6b0689){if(_0x6b0689){return _0x6b0689[_0x0174('0x37')]()[_0x0174('0x1f')](function(){var _0x3f9ab3=_0x6b0689[_0x0174('0x38')]({'plain':!![]});var _0x1a4793=_0x0174('0x39');return db[_0x0174('0x3a')]['destroy']({'where':{'type':_0x1a4793,'resourceId':_0x3f9ab3['id']}})[_0x0174('0x1f')](function(){return _0x6b0689;});})[_0x0174('0x1f')](function(){_0x42d3f1[_0x0174('0x2a')](0xcc)[_0x0174('0x2b')]();});}};}function handleEntityNotFound(_0x1546eb,_0x2a5206){return function(_0x3f4973){if(!_0x3f4973){_0x1546eb['sendStatus'](0x194);}return _0x3f4973;};}function handleError(_0x3c3e35,_0x149470){_0x149470=_0x149470||0x1f4;return function(_0x4623dc){logger[_0x0174('0x24')](_0x4623dc['stack']);if(_0x4623dc[_0x0174('0x3b')]){delete _0x4623dc['name'];}_0x3c3e35[_0x0174('0x2a')](_0x149470)[_0x0174('0x3c')](_0x4623dc);};}exports['index']=function(_0x4a4abc,_0x3be07b){var _0x459902={'include':[{'model':db[_0x0174('0x3d')],'as':_0x0174('0x3e')}]},_0x3bf8d5={},_0x210662={'count':0x0,'rows':[]};var _0x1dcb47=_[_0x0174('0x3f')](db['WhatsappAccount']['rawAttributes'],function(_0x5bb282){return{'name':_0x5bb282['fieldName'],'type':_0x5bb282[_0x0174('0x40')][_0x0174('0x41')]};});_0x3bf8d5[_0x0174('0x42')]=_['map'](_0x1dcb47,'name');_0x3bf8d5['query']=_['keys'](_0x4a4abc[_0x0174('0x43')]);_0x3bf8d5[_0x0174('0x44')]=_['intersection'](_0x3bf8d5['model'],_0x3bf8d5[_0x0174('0x43')]);_0x459902[_0x0174('0x45')]=_[_0x0174('0x46')](_0x3bf8d5['model'],qs[_0x0174('0x47')](_0x4a4abc['query']['fields']));_0x459902[_0x0174('0x45')]=_0x459902[_0x0174('0x45')]['length']?_0x459902[_0x0174('0x45')]:_0x3bf8d5[_0x0174('0x42')];if(!_0x4a4abc[_0x0174('0x43')][_0x0174('0x48')](_0x0174('0x49'))){_0x459902[_0x0174('0x2f')]=qs[_0x0174('0x2f')](_0x4a4abc[_0x0174('0x43')][_0x0174('0x2f')]);_0x459902[_0x0174('0x2d')]=qs[_0x0174('0x2d')](_0x4a4abc[_0x0174('0x43')][_0x0174('0x2d')]);}_0x459902[_0x0174('0x4a')]=qs['sort'](_0x4a4abc[_0x0174('0x43')]['sort']);_0x459902['where']=qs[_0x0174('0x44')](_['pick'](_0x4a4abc[_0x0174('0x43')],_0x3bf8d5[_0x0174('0x44')]),_0x1dcb47);if(_0x4a4abc[_0x0174('0x43')]['filter']){_0x459902['where']=_[_0x0174('0x4b')](_0x459902[_0x0174('0x4c')],{'$or':_['map'](_0x1dcb47,function(_0x5cea81){if(_0x5cea81[_0x0174('0x40')]!=='VIRTUAL'){var _0x2d10ea={};_0x2d10ea[_0x5cea81[_0x0174('0x3b')]]={'$like':'%'+_0x4a4abc['query'][_0x0174('0x4d')]+'%'};return _0x2d10ea;}})});}_0x459902=_[_0x0174('0x4b')]({},_0x459902,_0x4a4abc[_0x0174('0x4e')]);var _0x5e6873={'where':_0x459902[_0x0174('0x4c')]};return db['WhatsappAccount'][_0x0174('0x30')](_0x5e6873)['then'](function(_0x51e88d){_0x210662[_0x0174('0x30')]=_0x51e88d;if(_0x4a4abc['query'][_0x0174('0x4f')]){_0x459902[_0x0174('0x50')]=[{'all':!![]}];}return db[_0x0174('0x51')][_0x0174('0x52')](_0x459902);})[_0x0174('0x1f')](function(_0x48ee3a){_0x210662[_0x0174('0x53')]=_0x48ee3a;return _0x210662;})['then'](respondWithFilteredResult(_0x3be07b,_0x459902))['catch'](handleError(_0x3be07b,null));};exports[_0x0174('0x54')]=function(_0x37553a,_0x40f33c){var _0x19fb35={'raw':![],'where':{'id':_0x37553a[_0x0174('0x55')]['id']},'include':[{'model':db[_0x0174('0x3d')],'as':_0x0174('0x3e')}]},_0x46dbd7={};_0x46dbd7[_0x0174('0x42')]=_['keys'](db[_0x0174('0x51')]['rawAttributes']);_0x46dbd7[_0x0174('0x43')]=_[_0x0174('0x56')](_0x37553a[_0x0174('0x43')]);_0x46dbd7[_0x0174('0x44')]=_[_0x0174('0x46')](_0x46dbd7[_0x0174('0x42')],_0x46dbd7[_0x0174('0x43')]);_0x19fb35[_0x0174('0x45')]=_[_0x0174('0x46')](_0x46dbd7[_0x0174('0x42')],qs['fields'](_0x37553a[_0x0174('0x43')][_0x0174('0x47')]));_0x19fb35[_0x0174('0x45')]=_0x19fb35[_0x0174('0x45')][_0x0174('0x57')]?_0x19fb35[_0x0174('0x45')]:_0x46dbd7[_0x0174('0x42')];if(_0x37553a[_0x0174('0x43')][_0x0174('0x4f')]){_0x19fb35[_0x0174('0x50')]=[{'all':!![]}];}_0x19fb35=_[_0x0174('0x4b')]({},_0x19fb35,_0x37553a[_0x0174('0x4e')]);return db[_0x0174('0x51')][_0x0174('0x58')](_0x19fb35)[_0x0174('0x1f')](handleEntityNotFound(_0x40f33c,null))[_0x0174('0x1f')](respondWithResult(_0x40f33c,null))[_0x0174('0x29')](handleError(_0x40f33c,null));};exports[_0x0174('0x59')]=function(_0x5dffd8,_0x4fb75e){return db[_0x0174('0x51')][_0x0174('0x59')](_0x5dffd8[_0x0174('0x5a')],{})[_0x0174('0x1f')](function(_0x27a572){var _0x216509=_0x5dffd8[_0x0174('0x5b')][_0x0174('0x38')]({'plain':!![]});if(!_0x216509)throw new Error(_0x0174('0x5c'));if(_0x216509[_0x0174('0x5d')]==='user'){var _0x269e02=_0x27a572[_0x0174('0x38')]({'plain':!![]});var _0x591aae=_0x0174('0x39');return db[_0x0174('0x5e')]['find']({'where':{'name':_0x591aae,'userProfileId':_0x216509[_0x0174('0x5f')]},'raw':!![]})['then'](function(_0x4076cc){if(_0x4076cc&&_0x4076cc[_0x0174('0x60')]===0x0){return db['UserProfileResource'][_0x0174('0x59')]({'name':_0x269e02[_0x0174('0x3b')],'resourceId':_0x269e02['id'],'type':_0x4076cc[_0x0174('0x3b')],'sectionId':_0x4076cc['id']},{})['then'](function(){return _0x27a572;});}else{return _0x27a572;}})[_0x0174('0x29')](function(_0x4a0ad9){logger[_0x0174('0x24')](_0x0174('0x61'),_0x4a0ad9);throw _0x4a0ad9;});}return _0x27a572;})['then'](respondWithResult(_0x4fb75e,0xc9))[_0x0174('0x29')](handleError(_0x4fb75e,null));};exports[_0x0174('0x36')]=function(_0xadbc0,_0x4edcfc){if(_0xadbc0['body']['id']){delete _0xadbc0[_0x0174('0x5a')]['id'];}return db[_0x0174('0x51')][_0x0174('0x58')]({'where':{'id':_0xadbc0[_0x0174('0x55')]['id']},'include':[{'model':db[_0x0174('0x3d')],'as':_0x0174('0x3e')}]})['then'](handleEntityNotFound(_0x4edcfc,null))[_0x0174('0x1f')](saveUpdates(_0xadbc0[_0x0174('0x5a')],null))[_0x0174('0x1f')](respondWithResult(_0x4edcfc,null))['catch'](handleError(_0x4edcfc,null));};exports[_0x0174('0x37')]=function(_0x127a5a,_0x27eb08){return db[_0x0174('0x51')][_0x0174('0x58')]({'where':{'id':_0x127a5a[_0x0174('0x55')]['id']}})[_0x0174('0x1f')](handleEntityNotFound(_0x27eb08,null))['then'](removeEntity(_0x27eb08,null))[_0x0174('0x29')](handleError(_0x27eb08,null));};exports['describe']=function(_0x7d5107,_0x3fc6b8){return db['WhatsappAccount']['describe']()[_0x0174('0x1f')](respondWithResult(_0x3fc6b8,null))[_0x0174('0x29')](handleError(_0x3fc6b8,null));};exports[_0x0174('0x62')]=function(_0x5746bc,_0x5d5b50,_0xfe45c8){if(_0x5746bc[_0x0174('0x5a')]['id']){delete _0x5746bc[_0x0174('0x5a')]['id'];}return db[_0x0174('0x51')][_0x0174('0x58')]({'where':{'id':_0x5746bc[_0x0174('0x55')]['id']}})[_0x0174('0x1f')](handleEntityNotFound(_0x5d5b50,null))[_0x0174('0x1f')](function(_0x33ac66){if(_0x33ac66){_0x5746bc[_0x0174('0x5a')][_0x0174('0x63')]=_0x33ac66['id'];return db[_0x0174('0x64')][_0x0174('0x59')](_0x5746bc[_0x0174('0x5a')]);}})[_0x0174('0x1f')](respondWithResult(_0x5d5b50,null))[_0x0174('0x29')](handleError(_0x5d5b50,null));};exports['getDispositions']=function(_0x2dbf05,_0x23a8fe,_0x4fe526){var _0x2f8a20={'raw':![],'where':{}};var _0x4a9781={};var _0xce41e9={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x0174('0x65')]({'where':{'id':_0x2dbf05[_0x0174('0x55')]['id']}})[_0x0174('0x1f')](handleEntityNotFound(_0x23a8fe,null))[_0x0174('0x1f')](function(_0x343add){if(_0x343add){_0x4a9781[_0x0174('0x42')]=_['keys'](db[_0x0174('0x64')][_0x0174('0x66')]);_0x4a9781[_0x0174('0x43')]=_['keys'](_0x2dbf05[_0x0174('0x43')]);_0x4a9781['filters']=_[_0x0174('0x46')](_0x4a9781[_0x0174('0x42')],_0x4a9781[_0x0174('0x43')]);_0x2f8a20[_0x0174('0x45')]=_[_0x0174('0x46')](_0x4a9781[_0x0174('0x42')],qs['fields'](_0x2dbf05[_0x0174('0x43')][_0x0174('0x47')]));_0x2f8a20['attributes']=_0x2f8a20[_0x0174('0x45')][_0x0174('0x57')]?_0x2f8a20[_0x0174('0x45')]:_0x4a9781['model'];if(!_0x2dbf05['query'][_0x0174('0x48')](_0x0174('0x49'))){_0x2f8a20['limit']=qs[_0x0174('0x2f')](_0x2dbf05[_0x0174('0x43')]['limit']);_0x2f8a20[_0x0174('0x2d')]=qs[_0x0174('0x2d')](_0x2dbf05[_0x0174('0x43')][_0x0174('0x2d')]);}_0x2f8a20['order']=qs[_0x0174('0x67')](_0x2dbf05[_0x0174('0x43')][_0x0174('0x67')]);_0x2f8a20[_0x0174('0x4c')]=qs['filters'](_[_0x0174('0x68')](_0x2dbf05[_0x0174('0x43')],_0x4a9781[_0x0174('0x44')]));_0x2f8a20[_0x0174('0x4c')]['WhatsappAccountId']=_0x343add['id'];if(_0x2dbf05[_0x0174('0x43')]['filter']){_0x2f8a20[_0x0174('0x4c')]=_['merge'](_0x2f8a20[_0x0174('0x4c')],{'$or':_[_0x0174('0x3f')](_0x2f8a20['attributes'],function(_0x552dff){var _0xf0e500={};_0xf0e500[_0x552dff]={'$like':'%'+_0x2dbf05[_0x0174('0x43')][_0x0174('0x4d')]+'%'};return _0xf0e500;})});}_0x2f8a20=_[_0x0174('0x4b')]({},_0x2f8a20,_0x2dbf05['options']);return db[_0x0174('0x64')][_0x0174('0x30')]({'where':_0x2f8a20[_0x0174('0x4c')]})['then'](function(_0x101dce){_0xce41e9[_0x0174('0x30')]=_0x101dce;if(_0x2dbf05['query'][_0x0174('0x4f')]){_0x2f8a20[_0x0174('0x50')]=[{'all':!![]}];}return db[_0x0174('0x64')][_0x0174('0x52')](_0x2f8a20);})['then'](function(_0x8ac054){_0xce41e9[_0x0174('0x53')]=_0x8ac054;return _0xce41e9;});}})[_0x0174('0x1f')](respondWithFilteredResult(_0x23a8fe,_0x2f8a20))['catch'](handleError(_0x23a8fe,null));};exports['removeDispositions']=function(_0xd4c2f8,_0x568ff2,_0x555a97){return db['WhatsappAccount'][_0x0174('0x58')]({'where':{'id':_0xd4c2f8[_0x0174('0x55')]['id']}})['then'](handleEntityNotFound(_0x568ff2,null))['then'](function(_0x1ac172){if(_0x1ac172){return _0x1ac172[_0x0174('0x69')](_0xd4c2f8['query'][_0x0174('0x6a')]);}})[_0x0174('0x1f')](respondWithStatusCode(_0x568ff2,null))[_0x0174('0x29')](handleError(_0x568ff2,null));};exports['addAnswer']=function(_0x56f9f4,_0x1bab20,_0x7757df){if(_0x56f9f4[_0x0174('0x5a')]['id']){delete _0x56f9f4[_0x0174('0x5a')]['id'];}return db[_0x0174('0x51')][_0x0174('0x58')]({'where':{'id':_0x56f9f4['params']['id']}})['then'](handleEntityNotFound(_0x1bab20,null))[_0x0174('0x1f')](function(_0x4f9880){if(_0x4f9880){_0x56f9f4[_0x0174('0x5a')][_0x0174('0x63')]=_0x4f9880['id'];return db[_0x0174('0x6b')][_0x0174('0x59')](_0x56f9f4[_0x0174('0x5a')]);}})[_0x0174('0x1f')](respondWithResult(_0x1bab20,null))[_0x0174('0x29')](handleError(_0x1bab20,null));};exports['getAnswers']=function(_0x1a2a35,_0x2abcb9,_0xcf1b40){var _0x5bba65={'raw':![],'where':{}};var _0x2d7566={};var _0x22e17e={'count':0x0,'rows':[]};return db[_0x0174('0x51')]['findOne']({'where':{'id':_0x1a2a35[_0x0174('0x55')]['id']}})[_0x0174('0x1f')](handleEntityNotFound(_0x2abcb9,null))[_0x0174('0x1f')](function(_0x3c171f){if(_0x3c171f){_0x2d7566['model']=_[_0x0174('0x56')](db['CannedAnswer'][_0x0174('0x66')]);_0x2d7566[_0x0174('0x43')]=_['keys'](_0x1a2a35[_0x0174('0x43')]);_0x2d7566[_0x0174('0x44')]=_['intersection'](_0x2d7566[_0x0174('0x42')],_0x2d7566[_0x0174('0x43')]);_0x5bba65[_0x0174('0x45')]=_['intersection'](_0x2d7566[_0x0174('0x42')],qs['fields'](_0x1a2a35[_0x0174('0x43')][_0x0174('0x47')]));_0x5bba65[_0x0174('0x45')]=_0x5bba65[_0x0174('0x45')][_0x0174('0x57')]?_0x5bba65[_0x0174('0x45')]:_0x2d7566[_0x0174('0x42')];if(!_0x1a2a35[_0x0174('0x43')][_0x0174('0x48')](_0x0174('0x49'))){_0x5bba65[_0x0174('0x2f')]=qs['limit'](_0x1a2a35[_0x0174('0x43')][_0x0174('0x2f')]);_0x5bba65[_0x0174('0x2d')]=qs[_0x0174('0x2d')](_0x1a2a35[_0x0174('0x43')][_0x0174('0x2d')]);}_0x5bba65['order']=qs[_0x0174('0x67')](_0x1a2a35[_0x0174('0x43')]['sort']);_0x5bba65['where']=qs[_0x0174('0x44')](_[_0x0174('0x68')](_0x1a2a35[_0x0174('0x43')],_0x2d7566['filters']));_0x5bba65[_0x0174('0x4c')][_0x0174('0x63')]=_0x3c171f['id'];if(_0x1a2a35['query'][_0x0174('0x4d')]){_0x5bba65[_0x0174('0x4c')]=_[_0x0174('0x4b')](_0x5bba65['where'],{'$or':_[_0x0174('0x3f')](_0x5bba65[_0x0174('0x45')],function(_0x1da134){var _0x4c3883={};_0x4c3883[_0x1da134]={'$like':'%'+_0x1a2a35[_0x0174('0x43')][_0x0174('0x4d')]+'%'};return _0x4c3883;})});}_0x5bba65=_[_0x0174('0x4b')]({},_0x5bba65,_0x1a2a35[_0x0174('0x4e')]);return db[_0x0174('0x6b')][_0x0174('0x30')]({'where':_0x5bba65[_0x0174('0x4c')]})[_0x0174('0x1f')](function(_0x19eee8){_0x22e17e['count']=_0x19eee8;if(_0x1a2a35[_0x0174('0x43')]['includeAll']){_0x5bba65[_0x0174('0x50')]=[{'all':!![]}];}return db[_0x0174('0x6b')][_0x0174('0x52')](_0x5bba65);})[_0x0174('0x1f')](function(_0x39e5f6){_0x22e17e['rows']=_0x39e5f6;return _0x22e17e;});}})[_0x0174('0x1f')](respondWithFilteredResult(_0x2abcb9,_0x5bba65))[_0x0174('0x29')](handleError(_0x2abcb9,null));};exports[_0x0174('0x6c')]=function(_0x3d2e4e,_0x326234,_0x4c4884){return db[_0x0174('0x51')][_0x0174('0x58')]({'where':{'id':_0x3d2e4e['params']['id']}})['then'](handleEntityNotFound(_0x326234,null))[_0x0174('0x1f')](function(_0x309dfb){if(_0x309dfb){return _0x309dfb[_0x0174('0x6c')](_0x3d2e4e[_0x0174('0x43')][_0x0174('0x6a')]);}})[_0x0174('0x1f')](respondWithStatusCode(_0x326234,null))[_0x0174('0x29')](handleError(_0x326234,null));};exports[_0x0174('0x6d')]=function(_0xfe0b9d,_0x5c0ede,_0x47e907){return db[_0x0174('0x51')][_0x0174('0x58')]({'where':{'id':_0xfe0b9d[_0x0174('0x55')]['id']}})[_0x0174('0x1f')](handleEntityNotFound(_0x5c0ede,null))[_0x0174('0x1f')](function(_0x47f6dc){if(_0x47f6dc){return _0x47f6dc[_0x0174('0x6d')](_0xfe0b9d['body']['ids'],_['omit'](_0xfe0b9d[_0x0174('0x5a')],[_0x0174('0x6a'),'id'])||{})[_0x0174('0x6e')](function(_0x40d956){for(var _0x4bee84=0x0;_0x4bee84<_0xfe0b9d[_0x0174('0x5a')][_0x0174('0x6a')]['length'];_0x4bee84+=0x1){socket[_0x0174('0x6f')]('userWhatsappAccount:save',{'UserId':Number(_0xfe0b9d[_0x0174('0x5a')][_0x0174('0x6a')][_0x4bee84]),'WhatsappAccountId':Number(_0xfe0b9d['params']['id'])});}return _0x40d956;});}})['then'](respondWithResult(_0x5c0ede,null))[_0x0174('0x29')](handleError(_0x5c0ede,null));};exports[_0x0174('0x70')]=function(_0x41789c,_0x158004,_0x435ca7){return db[_0x0174('0x51')]['find']({'where':{'id':_0x41789c[_0x0174('0x55')]['id']}})['then'](handleEntityNotFound(_0x158004,null))[_0x0174('0x1f')](function(_0x1fe442){if(_0x1fe442){return _0x1fe442['removeAgents'](_0x41789c[_0x0174('0x43')][_0x0174('0x6a')])[_0x0174('0x1f')](function(){if(_['isArray'](_0x41789c[_0x0174('0x43')][_0x0174('0x6a')])){for(var _0x38eee1=0x0;_0x38eee1<_0x41789c[_0x0174('0x43')][_0x0174('0x6a')][_0x0174('0x57')];_0x38eee1+=0x1){socket[_0x0174('0x6f')](_0x0174('0x71'),{'UserId':Number(_0x41789c[_0x0174('0x43')][_0x0174('0x6a')][_0x38eee1]),'WhatsappAccountId':Number(_0x41789c[_0x0174('0x55')]['id'])});}}else{socket[_0x0174('0x6f')](_0x0174('0x71'),{'UserId':Number(_0x41789c['query'][_0x0174('0x6a')]),'WhatsappAccountId':Number(_0x41789c[_0x0174('0x55')]['id'])});}});}})[_0x0174('0x1f')](respondWithStatusCode(_0x158004,null))[_0x0174('0x29')](handleError(_0x158004,null));};exports[_0x0174('0x72')]=function(_0x4fd5a9,_0x40d3c1,_0x461d4c){var _0x32aea4={};var _0x364653={};var _0xbba093;var _0x45e8d0;return db[_0x0174('0x51')]['findOne']({'where':{'id':_0x4fd5a9['params']['id']}})[_0x0174('0x1f')](handleEntityNotFound(_0x40d3c1,null))[_0x0174('0x1f')](function(_0x409675){if(_0x409675){_0xbba093=_0x409675;_0x364653[_0x0174('0x42')]=_['keys'](db[_0x0174('0x73')][_0x0174('0x66')]);_0x364653[_0x0174('0x43')]=_[_0x0174('0x56')](_0x4fd5a9['query']);_0x364653[_0x0174('0x44')]=_[_0x0174('0x46')](_0x364653['model'],_0x364653['query']);_0x32aea4['attributes']=_[_0x0174('0x46')](_0x364653[_0x0174('0x42')],qs[_0x0174('0x47')](_0x4fd5a9[_0x0174('0x43')]['fields']));_0x32aea4[_0x0174('0x45')]=_0x32aea4['attributes'][_0x0174('0x57')]?_0x32aea4[_0x0174('0x45')]:_0x364653[_0x0174('0x42')];_0x32aea4[_0x0174('0x4a')]=qs[_0x0174('0x67')](_0x4fd5a9[_0x0174('0x43')][_0x0174('0x67')]);_0x32aea4[_0x0174('0x4c')]=qs[_0x0174('0x44')](_[_0x0174('0x68')](_0x4fd5a9[_0x0174('0x43')],_0x364653[_0x0174('0x44')]));if(_0x4fd5a9[_0x0174('0x43')][_0x0174('0x4d')]){_0x32aea4['where']=_[_0x0174('0x4b')](_0x32aea4[_0x0174('0x4c')],{'$or':_[_0x0174('0x3f')](_0x32aea4['attributes'],function(_0x5b0aa2){var _0x5e19eb={};_0x5e19eb[_0x5b0aa2]={'$like':'%'+_0x4fd5a9[_0x0174('0x43')]['filter']+'%'};return _0x5e19eb;})});}_0x32aea4=_[_0x0174('0x4b')]({},_0x32aea4,_0x4fd5a9[_0x0174('0x4e')]);return _0xbba093[_0x0174('0x72')](_0x32aea4);}})[_0x0174('0x1f')](function(_0x1346a6){if(_0x1346a6){_0x45e8d0=_0x1346a6[_0x0174('0x57')];if(!_0x4fd5a9[_0x0174('0x43')][_0x0174('0x48')](_0x0174('0x49'))){_0x32aea4[_0x0174('0x2f')]=qs[_0x0174('0x2f')](_0x4fd5a9[_0x0174('0x43')][_0x0174('0x2f')]);_0x32aea4['offset']=qs[_0x0174('0x2d')](_0x4fd5a9['query'][_0x0174('0x2d')]);}return _0xbba093['getAgents'](_0x32aea4);}})[_0x0174('0x1f')](function(_0x11a7b0){if(_0x11a7b0){return _0x11a7b0?{'count':_0x45e8d0,'rows':_0x11a7b0}:null;}})[_0x0174('0x1f')](respondWithResult(_0x40d3c1,null))[_0x0174('0x29')](handleError(_0x40d3c1,null));};exports[_0x0174('0x74')]=function(_0x390589,_0x18c52b){var _0x4686e3=_0x390589['params']['id'];var _0x1e3222=_0x390589[_0x0174('0x5a')];var _0x51d4b5=0xc8;var _0x51479b=null;return db[_0x0174('0x75')]['transaction']({'isolationLevel':db[_0x0174('0x75')][_0x0174('0x76')][_0x0174('0x77')]['READ_COMMITTED']},function(_0x1e9748){return db[_0x0174('0x51')][_0x0174('0x65')]({'where':{'id':_0x4686e3},'transaction':_0x1e9748})['then'](function(_0x5d7c94){if(_0x5d7c94){return db[_0x0174('0x78')][_0x0174('0x37')]({'where':{'WhatsappAccountId':_0x4686e3},'transaction':_0x1e9748})[_0x0174('0x1f')](function(){var _0xcf3adf=_[_0x0174('0x3f')](_0x1e3222,function(_0x5b4eec){_0x5b4eec[_0x0174('0x63')]=_0x4686e3;return _0x5b4eec;});return db[_0x0174('0x78')]['bulkCreate'](_0xcf3adf,{'transaction':_0x1e9748});});}else{_0x51d4b5=0x194;_0x51479b=[];}});})[_0x0174('0x1f')](function(){if(_0x51d4b5!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x4686e3},'order':_0x0174('0x79')})[_0x0174('0x1f')](function(_0x1fb638){_0x51479b=_0x1fb638;});}})[_0x0174('0x29')](function(_0xcdc717){_0x51d4b5=0x1f4;logger['error'](_0xcdc717[_0x0174('0x7a')]);if(_0xcdc717[_0x0174('0x3b')]){delete _0xcdc717[_0x0174('0x3b')];}_0x51479b=_0xcdc717;})[_0x0174('0x7b')](function(){if(_0x51479b===null){_0x18c52b[_0x0174('0x7c')](_0x51d4b5);}else{if(_0x51d4b5===0x1f4){_0x18c52b[_0x0174('0x2a')](_0x51d4b5)[_0x0174('0x3c')](_0x51479b);}else{_0x18c52b[_0x0174('0x2a')](_0x51d4b5)[_0x0174('0x2c')](_0x51479b);}}});};exports[_0x0174('0x7d')]=function(_0x538475,_0x35a1d1,_0x5ef3d8){var _0x28cf1b={};var _0x410847={};var _0x10e9bf;var _0x490c71;return db[_0x0174('0x51')][_0x0174('0x65')]({'where':{'id':_0x538475[_0x0174('0x55')]['id']}})['then'](handleEntityNotFound(_0x35a1d1,null))[_0x0174('0x1f')](function(_0x26f5e1){if(_0x26f5e1){_0x10e9bf=_0x26f5e1;_0x410847['model']=_[_0x0174('0x56')](db[_0x0174('0x78')]['rawAttributes']);_0x410847[_0x0174('0x43')]=_[_0x0174('0x56')](_0x538475[_0x0174('0x43')]);_0x410847[_0x0174('0x44')]=_[_0x0174('0x46')](_0x410847['model'],_0x410847[_0x0174('0x43')]);_0x28cf1b['attributes']=_[_0x0174('0x46')](_0x410847['model'],qs[_0x0174('0x47')](_0x538475[_0x0174('0x43')][_0x0174('0x47')]));_0x28cf1b[_0x0174('0x45')]=_0x28cf1b[_0x0174('0x45')][_0x0174('0x57')]?_0x28cf1b[_0x0174('0x45')]:_0x410847[_0x0174('0x42')];_0x28cf1b[_0x0174('0x4a')]=qs[_0x0174('0x67')](_0x538475[_0x0174('0x43')]['sort']);_0x28cf1b[_0x0174('0x4c')]=qs[_0x0174('0x44')](_[_0x0174('0x68')](_0x538475[_0x0174('0x43')],_0x410847[_0x0174('0x44')]));if(_0x538475[_0x0174('0x43')][_0x0174('0x4d')]){_0x28cf1b[_0x0174('0x4c')]=_[_0x0174('0x4b')](_0x28cf1b[_0x0174('0x4c')],{'$or':_[_0x0174('0x3f')](_0x28cf1b['attributes'],function(_0x387e41){var _0xe0c96c={};_0xe0c96c[_0x387e41]={'$like':'%'+_0x538475['query'][_0x0174('0x4d')]+'%'};return _0xe0c96c;})});}_0x28cf1b=_[_0x0174('0x4b')]({},_0x28cf1b,_0x538475['options']);return _0x10e9bf[_0x0174('0x7d')](_0x28cf1b);}})[_0x0174('0x1f')](function(_0x349974){if(_0x349974){_0x490c71=_0x349974[_0x0174('0x57')];if(!_0x538475[_0x0174('0x43')]['hasOwnProperty'](_0x0174('0x49'))){_0x28cf1b[_0x0174('0x2f')]=qs[_0x0174('0x2f')](_0x538475[_0x0174('0x43')]['limit']);_0x28cf1b[_0x0174('0x2d')]=qs[_0x0174('0x2d')](_0x538475[_0x0174('0x43')][_0x0174('0x2d')]);}return _0x10e9bf[_0x0174('0x7d')](_0x28cf1b);}})['then'](function(_0x2b58a6){if(_0x2b58a6){return _0x2b58a6?{'count':_0x490c71,'rows':_0x2b58a6}:null;}})[_0x0174('0x1f')](respondWithResult(_0x35a1d1,null))[_0x0174('0x29')](handleError(_0x35a1d1,null));};exports[_0x0174('0x7e')]=function(_0xf570ba,_0xe49d22,_0x57fa55){var _0x394262={'channel':_0x0174('0x7f')};var _0x321f27=[];var _0x55d1be=[];var _0x35f2cb={};return db['WhatsappAccount'][_0x0174('0x58')]({'where':{'id':_0xf570ba[_0x0174('0x55')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x0174('0x80')}]})['then'](handleEntityNotFound(_0xe49d22,null))[_0x0174('0x1f')](function(_0x90fcc1){_0x394262[_0x0174('0x81')]=_0x90fcc1;if(_0x394262['account']&&_0x394262[_0x0174('0x81')][_0x0174('0x40')]===_0x0174('0x82')&&_0xf570ba['body'][_0x0174('0x83')]){if(_0xf570ba[_0x0174('0x5a')]['statuses']['length']===0x0)return;if(_0xf570ba[_0x0174('0x5a')][_0x0174('0x83')][0x0][_0x0174('0x84')]!==_0x0174('0x85'))return;return db[_0x0174('0x86')][_0x0174('0x36')]({'read':!![],'readAt':_0xf570ba[_0x0174('0x5a')][_0x0174('0x83')][0x0][_0x0174('0x87')]},{'where':{'messageId':_0xf570ba[_0x0174('0x5a')][_0x0174('0x83')][0x0]['message_id']},'individualHooks':!![]})[_0x0174('0x1f')](function(_0x147b1b){return _0xe49d22['status'](0xc8)[_0x0174('0x2c')](_0x147b1b);});}_0x394262[_0x0174('0x88')]=_['orderBy'](_0x90fcc1[_0x0174('0x80')],[_0x0174('0x79')],['asc']);if(_0x394262[_0x0174('0x81')]['Applications']){delete _0x394262['account'][_0x0174('0x80')];}return db['CmContact']['describe']()[_0x0174('0x1f')](function(_0x3b7066){if(!_0x3b7066){throw new db[(_0x0174('0x89'))][(_0x0174('0x8a'))]('no\x20available\x20attributes');}_0x321f27=_[_0x0174('0x8b')](_[_0x0174('0x56')](_0x3b7066),[_0x0174('0x8c'),_0x0174('0x8d')]);_0x55d1be=_[_0x0174('0x8b')](_[_0x0174('0x56')](_0x3b7066),[_0x0174('0x8c'),_0x0174('0x8d'),_0x0174('0x8e'),_0x0174('0x8f')]);_0x394262['body']={'mapKey':'mobile'};if(_0x394262[_0x0174('0x81')]&&_0x394262[_0x0174('0x81')]['type']===_0x0174('0x90')){_0x394262[_0x0174('0x5a')][_0x0174('0x91')]=_0xf570ba['body']['From'][_0x0174('0x92')](_0x0174('0x93'),'');_0x394262[_0x0174('0x5a')]['body']=_0xf570ba[_0x0174('0x5a')][_0x0174('0x94')];_0x394262[_0x0174('0x5a')]['messageId']=_0xf570ba[_0x0174('0x5a')]['MessageSid'];}if(_0x394262[_0x0174('0x81')]&&_0x394262['account']['type']===_0x0174('0x82')){_0x394262['body'][_0x0174('0x91')]=_0xf570ba[_0x0174('0x5a')][_0x0174('0x95')][0x0]['from'];_0x394262[_0x0174('0x5a')][_0x0174('0x5a')]=_0xf570ba[_0x0174('0x5a')][_0x0174('0x95')][0x0]['message']['body'];_0x394262[_0x0174('0x5a')][_0x0174('0x96')]=_0xf570ba[_0x0174('0x5a')][_0x0174('0x95')][0x0][_0x0174('0x97')];}if(_0x394262[_0x0174('0x5a')]['id']){delete _0x394262[_0x0174('0x5a')]['id'];}if(_[_0x0174('0x98')](_0x394262[_0x0174('0x5a')][_0x0174('0x91')])){throw new db[(_0x0174('0x89'))]['ValidationError'](_0x0174('0x99'));}if(_[_0x0174('0x98')](_0x394262[_0x0174('0x5a')][_0x0174('0x5a')])||_0x394262[_0x0174('0x5a')][_0x0174('0x5a')]===''){throw new db[(_0x0174('0x89'))][(_0x0174('0x8a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0174('0x98')](_0x394262[_0x0174('0x5a')]['mapKey'])){throw new db[(_0x0174('0x89'))][(_0x0174('0x8a'))](_0x0174('0x9a')+_0x55d1be);}if(!_[_0x0174('0x9b')](_0x55d1be,_0x394262[_0x0174('0x5a')][_0x0174('0x9c')])){throw new db['Sequelize'][(_0x0174('0x8a'))](_0x0174('0x9d')+_0x55d1be);}_0x35f2cb[_0x394262[_0x0174('0x5a')]['mapKey']]=_0x394262[_0x0174('0x5a')][_0x0174('0x91')];return db[_0x0174('0x9e')]['find']({'where':{'id':_0x394262['account'][_0x0174('0x8f')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x35f2cb,'limit':0x1,'order':[['updatedAt',_0x0174('0x9f')]]}]});})[_0x0174('0x1f')](handleEntityNotFound(_0xe49d22,null))[_0x0174('0x1f')](function(_0xc10a0c){if(_0xc10a0c){_0x394262[_0x0174('0xa0')]=_[_0x0174('0xa1')](_0xc10a0c,[_0x0174('0xa2')]);if(_0xc10a0c[_0x0174('0xa2')][_0x0174('0x57')]){return _0xc10a0c[_0x0174('0xa2')][0x0];}var _0x465fb9=_['defaults'](_0x394262[_0x0174('0x5a')],{'firstName':_0x394262['body']['from'],'ListId':_0xc10a0c['id']});_0x465fb9[_0x394262['body'][_0x0174('0x9c')]]=_0x394262[_0x0174('0x5a')][_0x0174('0x91')];return db[_0x0174('0xa3')][_0x0174('0x59')](_0x465fb9,{'fields':_0x321f27,'raw':!![]});}})[_0x0174('0x1f')](handleEntityNotFound(_0xe49d22,null))[_0x0174('0x1f')](function(_0x2b8d7e){if(_0x2b8d7e){_0x394262[_0x0174('0xa4')]=_0x2b8d7e;var _0x3da13e={'ContactId':_0x2b8d7e['id'],'phone':_0x394262['body'][_0x0174('0x91')],'WhatsappAccountId':_0xf570ba[_0x0174('0x55')]['id']};var _0x322fc8={'ContactId':_0x2b8d7e['id'],'WhatsappAccountId':_0xf570ba[_0x0174('0x55')]['id'],'closed':![]};return db[_0x0174('0xa5')]['find']({'where':_0x322fc8})[_0x0174('0x1f')](function(_0x4b8a47){if(_0x4b8a47){return[_0x4b8a47,![]];}return db[_0x0174('0xa5')][_0x0174('0x59')](_0x3da13e)['then'](function(_0x102e86){return[_0x102e86,!![]];});});}})['spread'](function(_0x53609a,_0x22360c){_0x394262[_0x0174('0xa6')]=_0x53609a[_0x0174('0x38')]({'plain':!![]});_0x394262['interaction'][_0x0174('0xa7')]=![];if(_0x22360c){if(_0x394262[_0x0174('0x81')]['autoclose']){_0x394262['applications'][_0x0174('0xa8')]({'id':0x0,'priority':_0x394262[_0x0174('0x88')]['length']+0x1,'app':_0x0174('0xa9'),'appdata':_0x0174('0xaa'),'interval':_0x0174('0xab')});}_0x394262['interaction'][_0x0174('0xa7')]=!![];}return db['WhatsappMessage'][_0x0174('0x59')]({'phone':_0x394262[_0x0174('0x5a')]['from'],'messageId':_0x394262[_0x0174('0x5a')][_0x0174('0x96')],'body':_0x394262['body'][_0x0174('0x5a')],'WhatsappAccountId':_0xf570ba[_0x0174('0x55')]['id'],'WhatsappInteractionId':_0x53609a['id'],'direction':'in','ContactId':_0x53609a[_0x0174('0xac')],'AttachmentId':_0x394262[_0x0174('0x5a')]['AttachmentId']});})[_0x0174('0x1f')](function(_0x45505c){_0x394262[_0x0174('0x27')]=_0x45505c;if(_0x394262[_0x0174('0xa6')][_0x0174('0xad')]){return db['User']['find']({'attributes':['id',_0x0174('0x3b')],'where':{'id':_0x394262[_0x0174('0xa6')][_0x0174('0xad')]}})[_0x0174('0x1f')](function(_0x17278b){if(_0x17278b){_0x394262[_0x0174('0x88')][_0x0174('0xae')]({'id':0x0,'priority':0x0,'app':_0x0174('0xaf'),'appdata':_0x17278b[_0x0174('0x3b')]+','+(_0x394262[_0x0174('0x81')][_0x0174('0xb0')]||0xa),'interval':_0x0174('0xab')});}return respondWithRpcPromise('Start',_0x0174('0xb1'),_0x394262);});}return respondWithRpcPromise('Start','startRouting',_0x394262);})[_0x0174('0x1f')](function(_0x49a96a){if(_0x49a96a){var _0x8d933f=0xc8;var _0x16ad30=_0x0174('0xb2');logger[_0x0174('0x20')](_0x0174('0x23'),_0x16ad30,_0x8d933f,'entity\x20found');logger[_0x0174('0x22')](_0x0174('0xb3'),_0x16ad30,_0x8d933f,_0x0174('0xb4'),JSON[_0x0174('0xb5')](_0x49a96a));if(_0x394262['account'][_0x0174('0x40')]===_0x0174('0x90')){return _0xe49d22[_0x0174('0x2a')](_0x8d933f)['set']('Content-Type',_0x0174('0xb6'))[_0x0174('0x3c')](_0x0174('0xb7'));}else{return _0xe49d22[_0x0174('0x2a')](_0x8d933f)[_0x0174('0x2c')](_0x49a96a);}}});})[_0x0174('0x29')](handleError(_0xe49d22,null));};exports[_0x0174('0x3c')]=function(_0x12e781,_0x46e287,_0x4d6042){var _0x966018,_0x247359,_0x4ab63b;if(_[_0x0174('0x98')](_0x12e781[_0x0174('0x5a')][_0x0174('0x5a')])||_0x12e781[_0x0174('0x5a')]['body']===''){throw new db['Sequelize'][(_0x0174('0x8a'))](_0x0174('0xb8'));}if(_[_0x0174('0x98')](_0x12e781[_0x0174('0x5a')]['to'])){throw new db['Sequelize'][(_0x0174('0x8a'))](_0x0174('0xb9'));}_0x966018=_0x12e781[_0x0174('0x5a')]['to'];return db[_0x0174('0x51')][_0x0174('0x58')]({'where':{'id':_0x12e781[_0x0174('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0x0174('0xba'),'include':[{'model':db[_0x0174('0xa3')],'as':_0x0174('0xa2'),'where':{'mobile':_0x966018},'limit':0x1,'order':[[_0x0174('0x8d'),_0x0174('0x9f')]]}]}]})['then'](handleEntityNotFound(_0x46e287,null))[_0x0174('0x1f')](function(_0xa249d2){if(_0xa249d2&&_0xa249d2[_0x0174('0xba')]){_0x247359=_0xa249d2[_0x0174('0x38')]({'plain':!![]});if(_0x247359[_0x0174('0xba')]&&_0x247359[_0x0174('0xba')][_0x0174('0xa2')][_0x0174('0x57')]){return _0x247359[_0x0174('0xba')][_0x0174('0xa2')][0x0];}return db['CmContact'][_0x0174('0x59')](_[_0x0174('0x19')](_0x12e781[_0x0174('0x5a')],{'firstName':_0x966018,'mobile':_0x966018,'phone':_0x966018,'ListId':_0x247359[_0x0174('0x8f')]}));}})[_0x0174('0x1f')](handleEntityNotFound(_0x46e287,null))[_0x0174('0x1f')](function(_0x65752d){if(_0x65752d){_0x4ab63b=_0x65752d;return db[_0x0174('0xa5')][_0x0174('0x58')]({'where':{'ContactId':_0x4ab63b['id'],'closed':![],'WhatsappAccountId':_0x247359['id']}})[_0x0174('0x1f')](function(_0x564a03){if(_0x564a03){return[_0x564a03,![]];}return db[_0x0174('0xa5')][_0x0174('0x59')]({'UserId':_0x12e781[_0x0174('0x5b')]['id'],'ContactId':_0x4ab63b['id'],'WhatsappAccountId':_0x247359['id'],'phone':_0x966018,'firstMsgDirection':_0x0174('0xbb'),'Messages':[_[_0x0174('0x4b')](_0x12e781[_0x0174('0x5a')],{'read':![],'body':_0x12e781['body']['body'],'phone':_0x966018,'WhatsappAccountId':_0x247359['id'],'UserId':_0x12e781[_0x0174('0x5b')]['id'],'ContactId':_0x4ab63b['id']})]},{'include':[{'model':db[_0x0174('0x86')],'as':_0x0174('0xbc')}]})[_0x0174('0x1f')](function(_0x57865f){return[_0x57865f,!![]];});});}})['spread'](function(_0x43d7b2,_0x25a06c){if(_0x25a06c){return _0x43d7b2;}return db[_0x0174('0x86')][_0x0174('0x59')](_[_0x0174('0x4b')](_0x12e781[_0x0174('0x5a')],{'read':![],'body':_0x12e781['body'][_0x0174('0x5a')],'phone':_0x966018,'WhatsappAccountId':_0x247359['id'],'WhatsappInteractionId':_0x43d7b2['id'],'UserId':_0x12e781[_0x0174('0x5b')]['id'],'ContactId':_0x4ab63b['id']}))['then'](function(_0x98ebd){_0x43d7b2[_0x0174('0xbd')]['Messages']=[];_0x43d7b2[_0x0174('0xbd')][_0x0174('0xbc')][_0x0174('0xa8')](_0x98ebd[_0x0174('0xbd')]);return _0x43d7b2;});})['then'](respondWithResult(_0x46e287,null))[_0x0174('0x29')](handleError(_0x46e287,null));};
\ No newline at end of file
index 1f61203..b42f61d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaedf=['update','remove','emit','hasOwnProperty','hook','exports','setMaxListeners','save'];(function(_0x3d19b2,_0x279342){var _0x4eb93e=function(_0x439fea){while(--_0x439fea){_0x3d19b2['push'](_0x3d19b2['shift']());}};_0x4eb93e(++_0x279342);}(_0xaedf,0x17e));var _0xfaed=function(_0x19c4c5,_0x36ff71){_0x19c4c5=_0x19c4c5-0x0;var _0x5ab31c=_0xaedf[_0x19c4c5];return _0x5ab31c;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xfaed('0x0')](0x0);var events={'afterCreate':_0xfaed('0x1'),'afterUpdate':_0xfaed('0x2'),'afterDestroy':_0xfaed('0x3')};function emitEvent(_0x528e4f){return function(_0x35b6b6,_0x230ab,_0x326b08){WhatsappAccountEvents[_0xfaed('0x4')](_0x528e4f+':'+_0x35b6b6['id'],_0x35b6b6);WhatsappAccountEvents[_0xfaed('0x4')](_0x528e4f,_0x35b6b6);_0x326b08(null);};}for(var e in events){if(events[_0xfaed('0x5')](e)){var event=events[e];WhatsappAccount[_0xfaed('0x6')](e,emitEvent(event));}}module[_0xfaed('0x7')]=WhatsappAccountEvents;
\ No newline at end of file
+var _0x675a=['../../mysqldb','WhatsappAccount','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x25c2a7,_0x1e9d21){var _0xf85a8b=function(_0x23be31){while(--_0x23be31){_0x25c2a7['push'](_0x25c2a7['shift']());}};_0xf85a8b(++_0x1e9d21);}(_0x675a,0x147));var _0xa675=function(_0x5b6ef4,_0x523eec){_0x5b6ef4=_0x5b6ef4-0x0;var _0x4c77b6=_0x675a[_0x5b6ef4];return _0x4c77b6;};'use strict';var EventEmitter=require(_0xa675('0x0'));var WhatsappAccount=require(_0xa675('0x1'))['db'][_0xa675('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa675('0x3'),'afterUpdate':'update','afterDestroy':_0xa675('0x4')};function emitEvent(_0x7b4148){return function(_0x9606af,_0x2484aa,_0x1d09f2){WhatsappAccountEvents[_0xa675('0x5')](_0x7b4148+':'+_0x9606af['id'],_0x9606af);WhatsappAccountEvents[_0xa675('0x5')](_0x7b4148,_0x9606af);_0x1d09f2(null);};}for(var e in events){if(events[_0xa675('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xa675('0x7')]=WhatsappAccountEvents;
\ No newline at end of file
index 195e59d..5547880 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2652=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts'];(function(_0x11c361,_0x4f5b42){var _0x1f5355=function(_0x259200){while(--_0x259200){_0x11c361['push'](_0x11c361['shift']());}};_0x1f5355(++_0x4f5b42);}(_0x2652,0x6c));var _0x2265=function(_0x5db269,_0x3df0ad){_0x5db269=_0x5db269-0x0;var _0x1f5787=_0x2652[_0x5db269];return _0x1f5787;};'use strict';var _=require('lodash');var util=require(_0x2265('0x0'));var logger=require(_0x2265('0x1'))(_0x2265('0x2'));var moment=require('moment');var BPromise=require(_0x2265('0x3'));var rp=require(_0x2265('0x4'));var fs=require('fs');var path=require(_0x2265('0x5'));var rimraf=require(_0x2265('0x6'));var config=require(_0x2265('0x7'));var attributes=require(_0x2265('0x8'));module['exports']=function(_0x5ab531,_0x48e34f){return _0x5ab531[_0x2265('0x9')](_0x2265('0xa'),attributes,{'tableName':_0x2265('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x2328=['rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','moment','request-promise','path'];(function(_0x12c549,_0x1b8c58){var _0x1f97a1=function(_0x495416){while(--_0x495416){_0x12c549['push'](_0x12c549['shift']());}};_0x1f97a1(++_0x1b8c58);}(_0x2328,0x103));var _0x8232=function(_0x4e8fc3,_0x3d7e6c){_0x4e8fc3=_0x4e8fc3-0x0;var _0x181f62=_0x2328[_0x4e8fc3];return _0x181f62;};'use strict';var _=require(_0x8232('0x0'));var util=require('util');var logger=require(_0x8232('0x1'))('api');var moment=require(_0x8232('0x2'));var BPromise=require('bluebird');var rp=require(_0x8232('0x3'));var fs=require('fs');var path=require(_0x8232('0x4'));var rimraf=require(_0x8232('0x5'));var config=require(_0x8232('0x6'));var attributes=require(_0x8232('0x7'));module[_0x8232('0x8')]=function(_0x27dff7,_0x5e83de){return _0x27dff7[_0x8232('0x9')](_0x8232('0xa'),attributes,{'tableName':_0x8232('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 28597c5..672cd0e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xefa1=['then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','attributes','map','model','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request'];(function(_0x2fba3e,_0x1c0bf1){var _0x5c19bc=function(_0x103757){while(--_0x103757){_0x2fba3e['push'](_0x2fba3e['shift']());}};_0x5c19bc(++_0x1c0bf1);}(_0xefa1,0x175));var _0x1efa=function(_0x598d9b,_0xe2d67d){_0x598d9b=_0x598d9b-0x0;var _0x1313ca=_0xefa1[_0x598d9b];return _0x1313ca;};'use strict';var _=require(_0x1efa('0x0'));var util=require(_0x1efa('0x1'));var moment=require(_0x1efa('0x2'));var BPromise=require(_0x1efa('0x3'));var rs=require(_0x1efa('0x4'));var fs=require('fs');var Redis=require(_0x1efa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1efa('0x6'));var logger=require('../../config/logger')(_0x1efa('0x7'));var config=require(_0x1efa('0x8'));var jayson=require(_0x1efa('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x1efa('0xa')]=_[_0x1efa('0xb')](config['redis'],{'host':_0x1efa('0xc'),'port':0x18eb});var socket=require(_0x1efa('0xd'))(new Redis(config[_0x1efa('0xa')]));require(_0x1efa('0xe'))[_0x1efa('0xf')](socket);function respondWithRpcPromise(_0xf52ad4,_0x4a9f66,_0x174b4a){return new BPromise(function(_0x767408,_0x1947be){return client[_0x1efa('0x10')](_0xf52ad4,_0x174b4a)[_0x1efa('0x11')](function(_0x50dbce){logger[_0x1efa('0x12')](_0x1efa('0x13'),_0x4a9f66,_0x1efa('0x14'));logger[_0x1efa('0x15')](_0x1efa('0x16'),_0x4a9f66,'request\x20sent',JSON['stringify'](_0x50dbce));if(_0x50dbce[_0x1efa('0x17')]){if(_0x50dbce['error'][_0x1efa('0x18')]===0x1f4){logger['error'](_0x1efa('0x13'),_0x4a9f66,_0x50dbce['error'][_0x1efa('0x19')]);return _0x1947be(_0x50dbce['error'][_0x1efa('0x19')]);}logger[_0x1efa('0x17')](_0x1efa('0x13'),_0x4a9f66,_0x50dbce[_0x1efa('0x17')][_0x1efa('0x19')]);return _0x767408(_0x50dbce[_0x1efa('0x17')]['message']);}else{logger[_0x1efa('0x12')](_0x1efa('0x13'),_0x4a9f66,'request\x20sent');_0x767408(_0x50dbce[_0x1efa('0x1a')][_0x1efa('0x19')]);}})['catch'](function(_0x49aee8){logger[_0x1efa('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x4a9f66,_0x49aee8);_0x1947be(_0x49aee8);});});}exports[_0x1efa('0x1b')]=function(_0x2123e1){var _0x1f3248=this;return new Promise(function(_0x45e128,_0x4de70b){return db[_0x1efa('0x1c')][_0x1efa('0x1d')]({'raw':_0x2123e1[_0x1efa('0x1e')]?_0x2123e1['options'][_0x1efa('0x1f')]===undefined?!![]:![]:!![],'where':_0x2123e1['options']?_0x2123e1[_0x1efa('0x1e')][_0x1efa('0x20')]||null:null,'attributes':_0x2123e1['options']?_0x2123e1[_0x1efa('0x1e')]['attributes']||null:null,'include':_0x2123e1[_0x1efa('0x1e')]?_0x2123e1['options'][_0x1efa('0x21')]?_['map'](_0x2123e1[_0x1efa('0x1e')][_0x1efa('0x21')],function(_0x8950f){return{'model':db[_0x8950f['model']],'as':_0x8950f['as'],'attributes':_0x8950f[_0x1efa('0x22')],'include':_0x8950f[_0x1efa('0x21')]?_[_0x1efa('0x23')](_0x8950f['include'],function(_0x151170){return{'model':db[_0x151170[_0x1efa('0x24')]],'as':_0x151170['as'],'attributes':_0x151170['attributes'],'include':_0x151170[_0x1efa('0x21')]?_[_0x1efa('0x23')](_0x151170['include'],function(_0x1ab12e){return{'model':db[_0x1ab12e[_0x1efa('0x24')]],'as':_0x1ab12e['as'],'attributes':_0x1ab12e['attributes']};}):[]};}):[]};}):[]:[]})[_0x1efa('0x11')](function(_0x4dd839){logger[_0x1efa('0x12')]('ShowWhatsappAccount',_0x2123e1);logger[_0x1efa('0x15')](_0x1efa('0x1b'),_0x2123e1,JSON[_0x1efa('0x25')](_0x4dd839));_0x45e128(_0x4dd839);})[_0x1efa('0x26')](function(_0x47c491){logger[_0x1efa('0x17')](_0x1efa('0x1b'),_0x47c491[_0x1efa('0x19')],_0x2123e1);_0x4de70b(_0x1f3248['error'](0x1f4,_0x47c491[_0x1efa('0x19')]));});});};
\ No newline at end of file
+var _0x8d14=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','include','model','attributes','map','catch'];(function(_0xc376e1,_0x1a2b83){var _0x63e01c=function(_0x3cd0f8){while(--_0x3cd0f8){_0xc376e1['push'](_0xc376e1['shift']());}};_0x63e01c(++_0x1a2b83);}(_0x8d14,0x15f));var _0x48d1=function(_0x5bf9ef,_0x344613){_0x5bf9ef=_0x5bf9ef-0x0;var _0x3b5c27=_0x8d14[_0x5bf9ef];return _0x3b5c27;};'use strict';var _=require(_0x48d1('0x0'));var util=require(_0x48d1('0x1'));var moment=require(_0x48d1('0x2'));var BPromise=require(_0x48d1('0x3'));var rs=require(_0x48d1('0x4'));var fs=require('fs');var Redis=require(_0x48d1('0x5'));var db=require(_0x48d1('0x6'))['db'];var utils=require(_0x48d1('0x7'));var logger=require(_0x48d1('0x8'))(_0x48d1('0x9'));var config=require(_0x48d1('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x48d1('0xb')][_0x48d1('0xc')]({'port':0x232a});config['redis']=_[_0x48d1('0xd')](config[_0x48d1('0xe')],{'host':_0x48d1('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x48d1('0xe')]));require(_0x48d1('0x10'))[_0x48d1('0x11')](socket);function respondWithRpcPromise(_0x5744c4,_0x500ab2,_0x39178c){return new BPromise(function(_0x2ded17,_0x5f11ff){return client[_0x48d1('0x12')](_0x5744c4,_0x39178c)[_0x48d1('0x13')](function(_0x58a7fe){logger[_0x48d1('0x14')](_0x48d1('0x15'),_0x500ab2,_0x48d1('0x16'));logger[_0x48d1('0x17')](_0x48d1('0x18'),_0x500ab2,_0x48d1('0x16'),JSON[_0x48d1('0x19')](_0x58a7fe));if(_0x58a7fe[_0x48d1('0x1a')]){if(_0x58a7fe['error'][_0x48d1('0x1b')]===0x1f4){logger[_0x48d1('0x1a')](_0x48d1('0x15'),_0x500ab2,_0x58a7fe[_0x48d1('0x1a')][_0x48d1('0x1c')]);return _0x5f11ff(_0x58a7fe[_0x48d1('0x1a')][_0x48d1('0x1c')]);}logger[_0x48d1('0x1a')](_0x48d1('0x15'),_0x500ab2,_0x58a7fe[_0x48d1('0x1a')][_0x48d1('0x1c')]);return _0x2ded17(_0x58a7fe[_0x48d1('0x1a')]['message']);}else{logger[_0x48d1('0x14')](_0x48d1('0x15'),_0x500ab2,_0x48d1('0x16'));_0x2ded17(_0x58a7fe[_0x48d1('0x1d')]['message']);}})['catch'](function(_0x287087){logger[_0x48d1('0x1a')](_0x48d1('0x15'),_0x500ab2,_0x287087);_0x5f11ff(_0x287087);});});}exports[_0x48d1('0x1e')]=function(_0x18d7a8){var _0x4416d8=this;return new Promise(function(_0x1c1349,_0x1b2236){return db[_0x48d1('0x1f')][_0x48d1('0x20')]({'raw':_0x18d7a8['options']?_0x18d7a8[_0x48d1('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x18d7a8[_0x48d1('0x21')]?_0x18d7a8[_0x48d1('0x21')]['where']||null:null,'attributes':_0x18d7a8['options']?_0x18d7a8[_0x48d1('0x21')]['attributes']||null:null,'include':_0x18d7a8[_0x48d1('0x21')]?_0x18d7a8[_0x48d1('0x21')][_0x48d1('0x22')]?_['map'](_0x18d7a8[_0x48d1('0x21')][_0x48d1('0x22')],function(_0x73ee9){return{'model':db[_0x73ee9[_0x48d1('0x23')]],'as':_0x73ee9['as'],'attributes':_0x73ee9[_0x48d1('0x24')],'include':_0x73ee9[_0x48d1('0x22')]?_[_0x48d1('0x25')](_0x73ee9[_0x48d1('0x22')],function(_0x586d4f){return{'model':db[_0x586d4f[_0x48d1('0x23')]],'as':_0x586d4f['as'],'attributes':_0x586d4f[_0x48d1('0x24')],'include':_0x586d4f['include']?_['map'](_0x586d4f[_0x48d1('0x22')],function(_0x3d0deb){return{'model':db[_0x3d0deb['model']],'as':_0x3d0deb['as'],'attributes':_0x3d0deb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xd3038e){logger['info'](_0x48d1('0x1e'),_0x18d7a8);logger['debug'](_0x48d1('0x1e'),_0x18d7a8,JSON[_0x48d1('0x19')](_0xd3038e));_0x1c1349(_0xd3038e);})[_0x48d1('0x26')](function(_0x1dec73){logger['error']('ShowWhatsappAccount',_0x1dec73['message'],_0x18d7a8);_0x1b2236(_0x4416d8[_0x48d1('0x1a')](0x1f4,_0x1dec73[_0x48d1('0x1c')]));});});};
\ No newline at end of file
index 7d369de..add3985 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e36=['./whatsappAccount.events','save','update','emit','removeListener','register','length','whatsappAccount:'];(function(_0x5550e7,_0x295a48){var _0x25aa53=function(_0x309491){while(--_0x309491){_0x5550e7['push'](_0x5550e7['shift']());}};_0x25aa53(++_0x295a48);}(_0x5e36,0x128));var _0x65e3=function(_0x445fd0,_0x48b75e){_0x445fd0=_0x445fd0-0x0;var _0x59281d=_0x5e36[_0x445fd0];return _0x59281d;};'use strict';var WhatsappAccountEvents=require(_0x65e3('0x0'));var events=[_0x65e3('0x1'),'remove',_0x65e3('0x2')];function createListener(_0x2cee09,_0x470d50){return function(_0x732b92){_0x470d50[_0x65e3('0x3')](_0x2cee09,_0x732b92);};}function removeListener(_0x4c4190,_0x3a3663){return function(){WhatsappAccountEvents[_0x65e3('0x4')](_0x4c4190,_0x3a3663);};}exports[_0x65e3('0x5')]=function(_0x2f3c5b){for(var _0x276e41=0x0,_0x4352ae=events[_0x65e3('0x6')];_0x276e41<_0x4352ae;_0x276e41++){var _0x1f70a7=events[_0x276e41];var _0x56ee11=createListener(_0x65e3('0x7')+_0x1f70a7,_0x2f3c5b);WhatsappAccountEvents['on'](_0x1f70a7,_0x56ee11);}};
\ No newline at end of file
+var _0xd029=['whatsappAccount:','./whatsappAccount.events','save','remove','removeListener','register','length'];(function(_0x9af891,_0x132b1d){var _0x4556d5=function(_0x2e0960){while(--_0x2e0960){_0x9af891['push'](_0x9af891['shift']());}};_0x4556d5(++_0x132b1d);}(_0xd029,0xc5));var _0x9d02=function(_0x128b42,_0x49d070){_0x128b42=_0x128b42-0x0;var _0x47d363=_0xd029[_0x128b42];return _0x47d363;};'use strict';var WhatsappAccountEvents=require(_0x9d02('0x0'));var events=[_0x9d02('0x1'),_0x9d02('0x2'),'update'];function createListener(_0x229d74,_0x237914){return function(_0x3c6e5a){_0x237914['emit'](_0x229d74,_0x3c6e5a);};}function removeListener(_0x115456,_0x41d3a1){return function(){WhatsappAccountEvents[_0x9d02('0x3')](_0x115456,_0x41d3a1);};}exports[_0x9d02('0x4')]=function(_0x381098){for(var _0x51a5f5=0x0,_0x70843c=events[_0x9d02('0x5')];_0x51a5f5<_0x70843c;_0x51a5f5++){var _0x16f505=events[_0x51a5f5];var _0x4502ac=createListener(_0x9d02('0x6')+_0x16f505,_0x381098);WhatsappAccountEvents['on'](_0x16f505,_0x4502ac);}};
\ No newline at end of file
index d85174d..4cd9e0f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x01e1=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','post','create','put','update','delete','/:id'];(function(_0x1ce8cf,_0x38f192){var _0x5b0a5d=function(_0x47e3a9){while(--_0x47e3a9){_0x1ce8cf['push'](_0x1ce8cf['shift']());}};_0x5b0a5d(++_0x38f192);}(_0x01e1,0xc9));var _0x101e=function(_0x59ee0f,_0x4c2787){_0x59ee0f=_0x59ee0f-0x0;var _0x19c2d3=_0x01e1[_0x59ee0f];return _0x19c2d3;};'use strict';var multer=require(_0x101e('0x0'));var util=require(_0x101e('0x1'));var path=require(_0x101e('0x2'));var timeout=require(_0x101e('0x3'));var express=require(_0x101e('0x4'));var router=express[_0x101e('0x5')]();var fs_extra=require(_0x101e('0x6'));var auth=require(_0x101e('0x7'));var interaction=require(_0x101e('0x8'));var config=require(_0x101e('0x9'));var controller=require(_0x101e('0xa'));router[_0x101e('0xb')]('/',auth[_0x101e('0xc')](),controller['index']);router[_0x101e('0xb')]('/:id',auth[_0x101e('0xc')](),controller['show']);router[_0x101e('0xd')]('/',auth[_0x101e('0xc')](),controller[_0x101e('0xe')]);router[_0x101e('0xf')]('/:id',auth[_0x101e('0xc')](),controller[_0x101e('0x10')]);router[_0x101e('0x11')](_0x101e('0x12'),auth[_0x101e('0xc')](),controller[_0x101e('0x13')]);module['exports']=router;
\ No newline at end of file
+var _0x7441=['isAuthenticated','index','get','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','./whatsappApplication.controller'];(function(_0x26f7d4,_0x5d0acf){var _0x4676ed=function(_0x42e9ec){while(--_0x42e9ec){_0x26f7d4['push'](_0x26f7d4['shift']());}};_0x4676ed(++_0x5d0acf);}(_0x7441,0x181));var _0x1744=function(_0x3cf6df,_0x1758ff){_0x3cf6df=_0x3cf6df-0x0;var _0x4a91c2=_0x7441[_0x3cf6df];return _0x4a91c2;};'use strict';var multer=require('multer');var util=require(_0x1744('0x0'));var path=require(_0x1744('0x1'));var timeout=require(_0x1744('0x2'));var express=require(_0x1744('0x3'));var router=express[_0x1744('0x4')]();var fs_extra=require(_0x1744('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1744('0x6'));router['get']('/',auth[_0x1744('0x7')](),controller[_0x1744('0x8')]);router[_0x1744('0x9')](_0x1744('0xa'),auth[_0x1744('0x7')](),controller['show']);router['post']('/',auth[_0x1744('0x7')](),controller['create']);router['put'](_0x1744('0xa'),auth[_0x1744('0x7')](),controller[_0x1744('0xb')]);router[_0x1744('0xc')](_0x1744('0xa'),auth[_0x1744('0x7')](),controller[_0x1744('0xd')]);module['exports']=router;
\ No newline at end of file
index 26e807c..3406c95 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfdd7=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x542e20,_0x5f7462){var _0x4a2d94=function(_0x54ba88){while(--_0x54ba88){_0x542e20['push'](_0x542e20['shift']());}};_0x4a2d94(++_0x5f7462);}(_0xfdd7,0xc4));var _0x7fdd=function(_0x4a7729,_0x572ab5){_0x4a7729=_0x4a7729-0x0;var _0x219c46=_0xfdd7[_0x4a7729];return _0x219c46;};'use strict';var Sequelize=require(_0x7fdd('0x0'));module[_0x7fdd('0x1')]={'priority':{'type':Sequelize[_0x7fdd('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7fdd('0x3')],'allowNull':![],'defaultValue':_0x7fdd('0x4')},'appdata':{'type':Sequelize[_0x7fdd('0x5')]()},'description':{'type':Sequelize[_0x7fdd('0x3')]},'interval':{'type':Sequelize[_0x7fdd('0x3')],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
+var _0x9962=['INTEGER','STRING','TEXT','exports'];(function(_0x317946,_0x111cfc){var _0x3f8853=function(_0x321b96){while(--_0x321b96){_0x317946['push'](_0x317946['shift']());}};_0x3f8853(++_0x111cfc);}(_0x9962,0xd7));var _0x2996=function(_0x2ede21,_0x20f6c5){_0x2ede21=_0x2ede21-0x0;var _0xae64c1=_0x9962[_0x2ede21];return _0xae64c1;};'use strict';var Sequelize=require('sequelize');module[_0x2996('0x0')]={'priority':{'type':Sequelize[_0x2996('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2996('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2996('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2996('0x2')],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
index fb50251..8dafa1a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x61f1=['includeAll','include','findAll','catch','show','params','find','create','body','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','WhatsappApplication','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x2cfc77,_0x35c6c2){var _0x1aab3c=function(_0xa476d){while(--_0xa476d){_0x2cfc77['push'](_0x2cfc77['shift']());}};_0x1aab3c(++_0x35c6c2);}(_0x61f1,0x18a));var _0x161f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x61f1[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x161f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x161f('0x1'));var rp=require(_0x161f('0x2'));var moment=require(_0x161f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x161f('0x4'));var path=require(_0x161f('0x5'));var sox=require('sox');var csv=require(_0x161f('0x6'));var ejs=require(_0x161f('0x7'));var fs=require('fs');var fs_extra=require(_0x161f('0x8'));var _=require(_0x161f('0x9'));var squel=require(_0x161f('0xa'));var crypto=require('crypto');var jsforce=require(_0x161f('0xb'));var deskjs=require(_0x161f('0xc'));var toCsv=require(_0x161f('0x6'));var querystring=require(_0x161f('0xd'));var Papa=require(_0x161f('0xe'));var Redis=require(_0x161f('0xf'));var authService=require(_0x161f('0x10'));var qs=require(_0x161f('0x11'));var as=require(_0x161f('0x12'));var hardwareService=require(_0x161f('0x13'));var logger=require(_0x161f('0x14'))('api');var utils=require(_0x161f('0x15'));var config=require(_0x161f('0x16'));var licenseUtil=require(_0x161f('0x17'));var db=require(_0x161f('0x18'))['db'];function respondWithStatusCode(_0x113346,_0x4b0917){_0x4b0917=_0x4b0917||0xcc;return function(_0x30b9fb){if(_0x30b9fb){return _0x113346[_0x161f('0x19')](_0x4b0917);}return _0x113346[_0x161f('0x1a')](_0x4b0917)[_0x161f('0x1b')]();};}function respondWithResult(_0x4b34db,_0xc6108b){_0xc6108b=_0xc6108b||0xc8;return function(_0x3a80c4){if(_0x3a80c4){return _0x4b34db[_0x161f('0x1a')](_0xc6108b)[_0x161f('0x1c')](_0x3a80c4);}};}function respondWithFilteredResult(_0x4470d9,_0x1ceffb){return function(_0x594742){if(_0x594742){var _0x486261=typeof _0x1ceffb[_0x161f('0x1d')]===_0x161f('0x1e')&&typeof _0x1ceffb[_0x161f('0x1f')]==='undefined';var _0x325d4c=_0x594742[_0x161f('0x20')];var _0x2cf920=_0x486261?0x0:_0x1ceffb['offset'];var _0x420818=_0x486261?_0x594742['count']:_0x1ceffb[_0x161f('0x1d')]+_0x1ceffb[_0x161f('0x1f')];var _0x10fd8e;if(_0x420818>=_0x325d4c){_0x420818=_0x325d4c;_0x10fd8e=0xc8;}else{_0x10fd8e=0xce;}_0x4470d9[_0x161f('0x1a')](_0x10fd8e);return _0x4470d9[_0x161f('0x21')](_0x161f('0x22'),_0x2cf920+'-'+_0x420818+'/'+_0x325d4c)[_0x161f('0x1c')](_0x594742);}return null;};}function patchUpdates(_0x3a3a61){return function(_0x1153ce){try{jsonpatch[_0x161f('0x23')](_0x1153ce,_0x3a3a61,!![]);}catch(_0xdba48d){return BPromise[_0x161f('0x24')](_0xdba48d);}return _0x1153ce[_0x161f('0x25')]();};}function saveUpdates(_0x5a92b8,_0x3ae0dc){return function(_0xc6fc5e){if(_0xc6fc5e){return _0xc6fc5e[_0x161f('0x26')](_0x5a92b8)['then'](function(_0x5966d6){return _0x5966d6;});}return null;};}function removeEntity(_0xca1a9f,_0xaf2a44){return function(_0x161d91){if(_0x161d91){return _0x161d91[_0x161f('0x27')]()[_0x161f('0x28')](function(){_0xca1a9f['status'](0xcc)[_0x161f('0x1b')]();});}};}function handleEntityNotFound(_0x2b501f,_0x2ad3d2){return function(_0x4c1cac){if(!_0x4c1cac){_0x2b501f[_0x161f('0x19')](0x194);}return _0x4c1cac;};}function handleError(_0x378423,_0xe900b0){_0xe900b0=_0xe900b0||0x1f4;return function(_0x413c75){logger[_0x161f('0x29')](_0x413c75[_0x161f('0x2a')]);if(_0x413c75['name']){delete _0x413c75[_0x161f('0x2b')];}_0x378423[_0x161f('0x1a')](_0xe900b0)[_0x161f('0x2c')](_0x413c75);};}exports[_0x161f('0x2d')]=function(_0x94935,_0xc3a866){var _0x589793={},_0x18e910={},_0x3c5717={'count':0x0,'rows':[]};var _0x264d09=_['map'](db[_0x161f('0x2e')][_0x161f('0x2f')],function(_0x151bf4){return{'name':_0x151bf4[_0x161f('0x30')],'type':_0x151bf4[_0x161f('0x31')][_0x161f('0x32')]};});_0x18e910[_0x161f('0x33')]=_[_0x161f('0x34')](_0x264d09,'name');_0x18e910['query']=_[_0x161f('0x35')](_0x94935[_0x161f('0x36')]);_0x18e910[_0x161f('0x37')]=_['intersection'](_0x18e910['model'],_0x18e910['query']);_0x589793[_0x161f('0x38')]=_[_0x161f('0x39')](_0x18e910['model'],qs[_0x161f('0x3a')](_0x94935[_0x161f('0x36')][_0x161f('0x3a')]));_0x589793[_0x161f('0x38')]=_0x589793['attributes'][_0x161f('0x3b')]?_0x589793['attributes']:_0x18e910[_0x161f('0x33')];if(!_0x94935[_0x161f('0x36')][_0x161f('0x3c')](_0x161f('0x3d'))){_0x589793[_0x161f('0x1f')]=qs[_0x161f('0x1f')](_0x94935[_0x161f('0x36')][_0x161f('0x1f')]);_0x589793[_0x161f('0x1d')]=qs[_0x161f('0x1d')](_0x94935['query'][_0x161f('0x1d')]);}_0x589793['order']=qs[_0x161f('0x3e')](_0x94935[_0x161f('0x36')]['sort']);_0x589793[_0x161f('0x3f')]=qs[_0x161f('0x37')](_[_0x161f('0x40')](_0x94935[_0x161f('0x36')],_0x18e910['filters']),_0x264d09);if(_0x94935[_0x161f('0x36')][_0x161f('0x41')]){_0x589793['where']=_['merge'](_0x589793['where'],{'$or':_[_0x161f('0x34')](_0x264d09,function(_0x1dc384){if(_0x1dc384['type']!==_0x161f('0x42')){var _0x4cdb1a={};_0x4cdb1a[_0x1dc384['name']]={'$like':'%'+_0x94935[_0x161f('0x36')][_0x161f('0x41')]+'%'};return _0x4cdb1a;}})});}_0x589793=_[_0x161f('0x43')]({},_0x589793,_0x94935['options']);var _0x779e5f={'where':_0x589793[_0x161f('0x3f')]};return db[_0x161f('0x2e')][_0x161f('0x20')](_0x779e5f)[_0x161f('0x28')](function(_0x44b437){_0x3c5717[_0x161f('0x20')]=_0x44b437;if(_0x94935[_0x161f('0x36')][_0x161f('0x44')]){_0x589793[_0x161f('0x45')]=[{'all':!![]}];}return db[_0x161f('0x2e')][_0x161f('0x46')](_0x589793);})[_0x161f('0x28')](function(_0x49a60b){_0x3c5717['rows']=_0x49a60b;return _0x3c5717;})[_0x161f('0x28')](respondWithFilteredResult(_0xc3a866,_0x589793))[_0x161f('0x47')](handleError(_0xc3a866,null));};exports[_0x161f('0x48')]=function(_0xbf283e,_0x51076d){var _0xebcfb1={'raw':!![],'where':{'id':_0xbf283e[_0x161f('0x49')]['id']}},_0x2972d3={};_0x2972d3[_0x161f('0x33')]=_[_0x161f('0x35')](db[_0x161f('0x2e')][_0x161f('0x2f')]);_0x2972d3['query']=_[_0x161f('0x35')](_0xbf283e[_0x161f('0x36')]);_0x2972d3['filters']=_['intersection'](_0x2972d3[_0x161f('0x33')],_0x2972d3['query']);_0xebcfb1[_0x161f('0x38')]=_[_0x161f('0x39')](_0x2972d3[_0x161f('0x33')],qs[_0x161f('0x3a')](_0xbf283e[_0x161f('0x36')][_0x161f('0x3a')]));_0xebcfb1[_0x161f('0x38')]=_0xebcfb1[_0x161f('0x38')]['length']?_0xebcfb1[_0x161f('0x38')]:_0x2972d3[_0x161f('0x33')];if(_0xbf283e[_0x161f('0x36')][_0x161f('0x44')]){_0xebcfb1[_0x161f('0x45')]=[{'all':!![]}];}_0xebcfb1=_[_0x161f('0x43')]({},_0xebcfb1,_0xbf283e['options']);return db[_0x161f('0x2e')][_0x161f('0x4a')](_0xebcfb1)[_0x161f('0x28')](handleEntityNotFound(_0x51076d,null))[_0x161f('0x28')](respondWithResult(_0x51076d,null))[_0x161f('0x47')](handleError(_0x51076d,null));};exports['create']=function(_0x5bbc82,_0x5d8ef8){return db['WhatsappApplication'][_0x161f('0x4b')](_0x5bbc82['body'],{})[_0x161f('0x28')](respondWithResult(_0x5d8ef8,0xc9))['catch'](handleError(_0x5d8ef8,null));};exports[_0x161f('0x26')]=function(_0x23c4ce,_0x913df3){if(_0x23c4ce['body']['id']){delete _0x23c4ce[_0x161f('0x4c')]['id'];}return db[_0x161f('0x2e')]['find']({'where':{'id':_0x23c4ce['params']['id']}})[_0x161f('0x28')](handleEntityNotFound(_0x913df3,null))['then'](saveUpdates(_0x23c4ce[_0x161f('0x4c')],null))['then'](respondWithResult(_0x913df3,null))[_0x161f('0x47')](handleError(_0x913df3,null));};exports[_0x161f('0x27')]=function(_0x165aff,_0x3f2ebb){return db[_0x161f('0x2e')][_0x161f('0x4a')]({'where':{'id':_0x165aff[_0x161f('0x49')]['id']}})[_0x161f('0x28')](handleEntityNotFound(_0x3f2ebb,null))[_0x161f('0x28')](removeEntity(_0x3f2ebb,null))[_0x161f('0x47')](handleError(_0x3f2ebb,null));};
\ No newline at end of file
+var _0x6c99=['WhatsappApplication','findAll','rows','show','params','intersection','length','includeAll','find','catch','create','body','update','eml-format','zip-dir','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','query','keys','filters','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','include'];(function(_0x2b36f5,_0x5732dc){var _0x5f06b6=function(_0x5def4f){while(--_0x5def4f){_0x2b36f5['push'](_0x2b36f5['shift']());}};_0x5f06b6(++_0x5732dc);}(_0x6c99,0x9b));var _0x96c9=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0x6c99[_0x3b632f];return _0x10e788;};'use strict';var emlformat=require(_0x96c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x96c9('0x2'));var path=require(_0x96c9('0x3'));var sox=require(_0x96c9('0x4'));var csv=require(_0x96c9('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x96c9('0x6'));var _=require(_0x96c9('0x7'));var squel=require(_0x96c9('0x8'));var crypto=require(_0x96c9('0x9'));var jsforce=require(_0x96c9('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x96c9('0xb'));var Papa=require('papaparse');var Redis=require(_0x96c9('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x96c9('0xd'));var as=require(_0x96c9('0xe'));var hardwareService=require(_0x96c9('0xf'));var logger=require(_0x96c9('0x10'))('api');var utils=require(_0x96c9('0x11'));var config=require(_0x96c9('0x12'));var licenseUtil=require(_0x96c9('0x13'));var db=require(_0x96c9('0x14'))['db'];function respondWithStatusCode(_0x3e2e57,_0x5243ca){_0x5243ca=_0x5243ca||0xcc;return function(_0x46f105){if(_0x46f105){return _0x3e2e57[_0x96c9('0x15')](_0x5243ca);}return _0x3e2e57[_0x96c9('0x16')](_0x5243ca)[_0x96c9('0x17')]();};}function respondWithResult(_0x59418c,_0x5d1f4e){_0x5d1f4e=_0x5d1f4e||0xc8;return function(_0x3f1cf9){if(_0x3f1cf9){return _0x59418c[_0x96c9('0x16')](_0x5d1f4e)[_0x96c9('0x18')](_0x3f1cf9);}};}function respondWithFilteredResult(_0x2f6ec5,_0x5c1116){return function(_0x4fa3db){if(_0x4fa3db){var _0x5d18da=typeof _0x5c1116[_0x96c9('0x19')]==='undefined'&&typeof _0x5c1116[_0x96c9('0x1a')]==='undefined';var _0x1ceeb0=_0x4fa3db[_0x96c9('0x1b')];var _0x21a0d0=_0x5d18da?0x0:_0x5c1116[_0x96c9('0x19')];var _0x3bdf8f=_0x5d18da?_0x4fa3db['count']:_0x5c1116[_0x96c9('0x19')]+_0x5c1116['limit'];var _0x3dd3de;if(_0x3bdf8f>=_0x1ceeb0){_0x3bdf8f=_0x1ceeb0;_0x3dd3de=0xc8;}else{_0x3dd3de=0xce;}_0x2f6ec5[_0x96c9('0x16')](_0x3dd3de);return _0x2f6ec5[_0x96c9('0x1c')]('Content-Range',_0x21a0d0+'-'+_0x3bdf8f+'/'+_0x1ceeb0)['json'](_0x4fa3db);}return null;};}function patchUpdates(_0x17aea5){return function(_0x20f974){try{jsonpatch[_0x96c9('0x1d')](_0x20f974,_0x17aea5,!![]);}catch(_0x1bf748){return BPromise[_0x96c9('0x1e')](_0x1bf748);}return _0x20f974[_0x96c9('0x1f')]();};}function saveUpdates(_0x596453,_0x101a25){return function(_0x3a7fc5){if(_0x3a7fc5){return _0x3a7fc5['update'](_0x596453)[_0x96c9('0x20')](function(_0x2a7ae1){return _0x2a7ae1;});}return null;};}function removeEntity(_0x185bb5,_0x575364){return function(_0x13e642){if(_0x13e642){return _0x13e642[_0x96c9('0x21')]()[_0x96c9('0x20')](function(){_0x185bb5[_0x96c9('0x16')](0xcc)[_0x96c9('0x17')]();});}};}function handleEntityNotFound(_0x2b7ad3,_0x62b05e){return function(_0x5c7252){if(!_0x5c7252){_0x2b7ad3[_0x96c9('0x15')](0x194);}return _0x5c7252;};}function handleError(_0x40b1db,_0x316d86){_0x316d86=_0x316d86||0x1f4;return function(_0x3b8b0f){logger[_0x96c9('0x22')](_0x3b8b0f[_0x96c9('0x23')]);if(_0x3b8b0f[_0x96c9('0x24')]){delete _0x3b8b0f[_0x96c9('0x24')];}_0x40b1db[_0x96c9('0x16')](_0x316d86)[_0x96c9('0x25')](_0x3b8b0f);};}exports[_0x96c9('0x26')]=function(_0x7d2858,_0x56b920){var _0x5364e5={},_0x342216={},_0x3a770b={'count':0x0,'rows':[]};var _0x4cae5a=_[_0x96c9('0x27')](db['WhatsappApplication']['rawAttributes'],function(_0x1fa934){return{'name':_0x1fa934[_0x96c9('0x28')],'type':_0x1fa934[_0x96c9('0x29')]['key']};});_0x342216['model']=_[_0x96c9('0x27')](_0x4cae5a,_0x96c9('0x24'));_0x342216[_0x96c9('0x2a')]=_[_0x96c9('0x2b')](_0x7d2858[_0x96c9('0x2a')]);_0x342216[_0x96c9('0x2c')]=_['intersection'](_0x342216['model'],_0x342216[_0x96c9('0x2a')]);_0x5364e5[_0x96c9('0x2d')]=_['intersection'](_0x342216[_0x96c9('0x2e')],qs[_0x96c9('0x2f')](_0x7d2858[_0x96c9('0x2a')][_0x96c9('0x2f')]));_0x5364e5[_0x96c9('0x2d')]=_0x5364e5[_0x96c9('0x2d')]['length']?_0x5364e5[_0x96c9('0x2d')]:_0x342216[_0x96c9('0x2e')];if(!_0x7d2858[_0x96c9('0x2a')][_0x96c9('0x30')]('nolimit')){_0x5364e5[_0x96c9('0x1a')]=qs['limit'](_0x7d2858['query'][_0x96c9('0x1a')]);_0x5364e5['offset']=qs[_0x96c9('0x19')](_0x7d2858['query'][_0x96c9('0x19')]);}_0x5364e5[_0x96c9('0x31')]=qs[_0x96c9('0x32')](_0x7d2858['query']['sort']);_0x5364e5[_0x96c9('0x33')]=qs['filters'](_[_0x96c9('0x34')](_0x7d2858['query'],_0x342216[_0x96c9('0x2c')]),_0x4cae5a);if(_0x7d2858[_0x96c9('0x2a')][_0x96c9('0x35')]){_0x5364e5[_0x96c9('0x33')]=_['merge'](_0x5364e5[_0x96c9('0x33')],{'$or':_[_0x96c9('0x27')](_0x4cae5a,function(_0x338925){if(_0x338925[_0x96c9('0x29')]!==_0x96c9('0x36')){var _0x770669={};_0x770669[_0x338925[_0x96c9('0x24')]]={'$like':'%'+_0x7d2858[_0x96c9('0x2a')][_0x96c9('0x35')]+'%'};return _0x770669;}})});}_0x5364e5=_[_0x96c9('0x37')]({},_0x5364e5,_0x7d2858[_0x96c9('0x38')]);var _0x331735={'where':_0x5364e5['where']};return db['WhatsappApplication'][_0x96c9('0x1b')](_0x331735)[_0x96c9('0x20')](function(_0x59db64){_0x3a770b[_0x96c9('0x1b')]=_0x59db64;if(_0x7d2858[_0x96c9('0x2a')]['includeAll']){_0x5364e5[_0x96c9('0x39')]=[{'all':!![]}];}return db[_0x96c9('0x3a')][_0x96c9('0x3b')](_0x5364e5);})[_0x96c9('0x20')](function(_0x3b64c8){_0x3a770b[_0x96c9('0x3c')]=_0x3b64c8;return _0x3a770b;})[_0x96c9('0x20')](respondWithFilteredResult(_0x56b920,_0x5364e5))['catch'](handleError(_0x56b920,null));};exports[_0x96c9('0x3d')]=function(_0x3d9056,_0x18592b){var _0x3a3399={'raw':!![],'where':{'id':_0x3d9056[_0x96c9('0x3e')]['id']}},_0x49ee79={};_0x49ee79['model']=_[_0x96c9('0x2b')](db[_0x96c9('0x3a')]['rawAttributes']);_0x49ee79[_0x96c9('0x2a')]=_[_0x96c9('0x2b')](_0x3d9056[_0x96c9('0x2a')]);_0x49ee79[_0x96c9('0x2c')]=_[_0x96c9('0x3f')](_0x49ee79[_0x96c9('0x2e')],_0x49ee79[_0x96c9('0x2a')]);_0x3a3399[_0x96c9('0x2d')]=_[_0x96c9('0x3f')](_0x49ee79['model'],qs['fields'](_0x3d9056[_0x96c9('0x2a')][_0x96c9('0x2f')]));_0x3a3399[_0x96c9('0x2d')]=_0x3a3399[_0x96c9('0x2d')][_0x96c9('0x40')]?_0x3a3399['attributes']:_0x49ee79[_0x96c9('0x2e')];if(_0x3d9056[_0x96c9('0x2a')][_0x96c9('0x41')]){_0x3a3399[_0x96c9('0x39')]=[{'all':!![]}];}_0x3a3399=_['merge']({},_0x3a3399,_0x3d9056['options']);return db[_0x96c9('0x3a')][_0x96c9('0x42')](_0x3a3399)[_0x96c9('0x20')](handleEntityNotFound(_0x18592b,null))['then'](respondWithResult(_0x18592b,null))[_0x96c9('0x43')](handleError(_0x18592b,null));};exports['create']=function(_0x3c4bf1,_0x2071d5){return db['WhatsappApplication'][_0x96c9('0x44')](_0x3c4bf1[_0x96c9('0x45')],{})['then'](respondWithResult(_0x2071d5,0xc9))[_0x96c9('0x43')](handleError(_0x2071d5,null));};exports[_0x96c9('0x46')]=function(_0x986731,_0x16156e){if(_0x986731[_0x96c9('0x45')]['id']){delete _0x986731[_0x96c9('0x45')]['id'];}return db[_0x96c9('0x3a')][_0x96c9('0x42')]({'where':{'id':_0x986731[_0x96c9('0x3e')]['id']}})[_0x96c9('0x20')](handleEntityNotFound(_0x16156e,null))['then'](saveUpdates(_0x986731[_0x96c9('0x45')],null))['then'](respondWithResult(_0x16156e,null))[_0x96c9('0x43')](handleError(_0x16156e,null));};exports[_0x96c9('0x21')]=function(_0x25f3df,_0x59dea7){return db[_0x96c9('0x3a')][_0x96c9('0x42')]({'where':{'id':_0x25f3df[_0x96c9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x59dea7,null))[_0x96c9('0x20')](removeEntity(_0x59dea7,null))[_0x96c9('0x43')](handleError(_0x59dea7,null));};
\ No newline at end of file
index c890f05..9c93bef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa5c=['../../config/logger','api','rimraf','exports','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x3b2a12,_0x551c27){_0x3b2a12=_0x3b2a12-0x0;var _0xf1e92=_0xaa5c[_0x3b2a12];return _0xf1e92;};'use strict';var _=require(_0xcaa5('0x0'));var util=require(_0xcaa5('0x1'));var logger=require(_0xcaa5('0x2'))(_0xcaa5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcaa5('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0xcaa5('0x5')]=function(_0x42afd4,_0x1877d0){return _0x42afd4['define'](_0xcaa5('0x6'),attributes,{'tableName':_0xcaa5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcaa5('0x8'),'collate':_0xcaa5('0x9')});};
\ No newline at end of file
+var _0x99e9=['util','../../config/logger','api','moment','request-promise','path','rimraf','./whatsappApplication.attributes','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x162404,_0x3903c7){var _0x1d7869=function(_0x430b43){while(--_0x430b43){_0x162404['push'](_0x162404['shift']());}};_0x1d7869(++_0x3903c7);}(_0x99e9,0xb4));var _0x999e=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0x99e9[_0x1bd323];return _0x13097b;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x999e('0xa'),'collate':_0x999e('0xb')});};
\ No newline at end of file
index 159f471..8905f31 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x4c9f6a,_0xcb2cb2){var _0x5df5b9=function(_0x303cf2){while(--_0x303cf2){_0x4c9f6a['push'](_0x4c9f6a['shift']());}};_0x5df5b9(++_0xcb2cb2);}(_0x99e9,0xb4));var _0x999e=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0x99e9[_0x242a4f];return _0x122117;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});}
\ No newline at end of file
+var _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x10d0df,_0x110dde){var _0x31d0d8=function(_0x23b259){while(--_0x23b259){_0x10d0df['push'](_0x10d0df['shift']());}};_0x31d0d8(++_0x110dde);}(_0x54ef,0x112));var _0xf54e=function(_0xb5ca04,_0x349539){_0xb5ca04=_0xb5ca04-0x0;var _0x5b238d=_0x54ef[_0xb5ca04];return _0x5b238d;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});}
\ No newline at end of file
index 6f57eba..9a8e1b2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xee3c=['index','/describe','describe','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','whatsapp','whatsappinteraction:addtags','tracked','whatsappinteraction:update','update','destroy','delete','/:id/tags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0xee3c,0x14a));var _0xcee3=function(_0x1b64d0,_0x2cadae){_0x1b64d0=_0x1b64d0-0x0;var _0x14ac64=_0xee3c[_0x1b64d0];return _0x14ac64;};'use strict';var multer=require(_0xcee3('0x0'));var util=require(_0xcee3('0x1'));var path=require(_0xcee3('0x2'));var timeout=require(_0xcee3('0x3'));var express=require(_0xcee3('0x4'));var router=express[_0xcee3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcee3('0x6'));var config=require(_0xcee3('0x7'));var controller=require(_0xcee3('0x8'));router[_0xcee3('0x9')]('/',auth[_0xcee3('0xa')](),controller[_0xcee3('0xb')]);router[_0xcee3('0x9')](_0xcee3('0xc'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xd')]);router[_0xcee3('0x9')](_0xcee3('0xe'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xf')]);router[_0xcee3('0x9')]('/:id/messages',auth[_0xcee3('0xa')](),controller[_0xcee3('0x10')]);router[_0xcee3('0x9')](_0xcee3('0x11'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x12')]);router['post']('/',auth[_0xcee3('0xa')](),controller[_0xcee3('0x13')]);router[_0xcee3('0x14')](_0xcee3('0x15'),auth[_0xcee3('0xa')](),controller['addMessage']);router[_0xcee3('0x14')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xcee3('0x16'),_0xcee3('0x17')),controller['addTags']);router['put'](_0xcee3('0xe'),auth['isAuthenticated'](),interaction[_0xcee3('0x18')]('whatsapp',_0xcee3('0x19')),controller[_0xcee3('0x1a')]);router['delete'](_0xcee3('0xe'),auth[_0xcee3('0xa')](),interaction[_0xcee3('0x18')](_0xcee3('0x16'),'whatsappinteraction:destroy'),controller[_0xcee3('0x1b')]);router[_0xcee3('0x1c')](_0xcee3('0x1d'),auth[_0xcee3('0xa')](),controller['removeTags']);module[_0xcee3('0x1e')]=router;
\ No newline at end of file
+var _0x83d0=['addTags','put','whatsappinteraction:update','delete','whatsapp','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','download','create','post','/:id/tags','tracked'];(function(_0x40b72c,_0x169fbd){var _0x4ab3b4=function(_0x349d00){while(--_0x349d00){_0x40b72c['push'](_0x40b72c['shift']());}};_0x4ab3b4(++_0x169fbd);}(_0x83d0,0xb7));var _0x083d=function(_0x19c3ab,_0x522002){_0x19c3ab=_0x19c3ab-0x0;var _0x4f1b41=_0x83d0[_0x19c3ab];return _0x4f1b41;};'use strict';var multer=require(_0x083d('0x0'));var util=require(_0x083d('0x1'));var path=require(_0x083d('0x2'));var timeout=require(_0x083d('0x3'));var express=require(_0x083d('0x4'));var router=express[_0x083d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x083d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x083d('0x7'));router[_0x083d('0x8')]('/',auth[_0x083d('0x9')](),controller[_0x083d('0xa')]);router[_0x083d('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x083d('0xb')]);router[_0x083d('0x8')](_0x083d('0xc'),auth['isAuthenticated'](),controller[_0x083d('0xd')]);router[_0x083d('0x8')](_0x083d('0xe'),auth[_0x083d('0x9')](),controller['getMessages']);router[_0x083d('0x8')]('/:id/download',auth[_0x083d('0x9')](),controller[_0x083d('0xf')]);router['post']('/',auth[_0x083d('0x9')](),controller[_0x083d('0x10')]);router[_0x083d('0x11')](_0x083d('0xe'),auth[_0x083d('0x9')](),controller['addMessage']);router[_0x083d('0x11')](_0x083d('0x12'),auth['isAuthenticated'](),interaction[_0x083d('0x13')]('whatsapp','whatsappinteraction:addtags'),controller[_0x083d('0x14')]);router[_0x083d('0x15')](_0x083d('0xc'),auth[_0x083d('0x9')](),interaction[_0x083d('0x13')]('whatsapp',_0x083d('0x16')),controller['update']);router[_0x083d('0x17')](_0x083d('0xc'),auth[_0x083d('0x9')](),interaction[_0x083d('0x13')](_0x083d('0x18'),_0x083d('0x19')),controller[_0x083d('0x1a')]);router[_0x083d('0x17')](_0x083d('0x12'),auth[_0x083d('0x9')](),controller[_0x083d('0x1b')]);module[_0x083d('0x1c')]=router;
\ No newline at end of file
index 20b61b8..b8fd03e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4986=['exports','STRING','DATE','ENUM','out','sequelize','moment'];(function(_0x57333f,_0x48685d){var _0x25e4d2=function(_0x39d525){while(--_0x39d525){_0x57333f['push'](_0x57333f['shift']());}};_0x25e4d2(++_0x48685d);}(_0x4986,0x6e));var _0x6498=function(_0xcbd0dc,_0x2610b0){_0xcbd0dc=_0xcbd0dc-0x0;var _0x565b8a=_0x4986[_0xcbd0dc];return _0x565b8a;};'use strict';var Sequelize=require(_0x6498('0x0'));var moment=require(_0x6498('0x1'));module[_0x6498('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6498('0x3')]},'secondDisposition':{'type':Sequelize[_0x6498('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6498('0x3')]},'phone':{'type':Sequelize[_0x6498('0x3')]},'read1stAt':{'type':Sequelize[_0x6498('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x6498('0x5')]('in',_0x6498('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6498('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x6498('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
+var _0x63f2=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x20187f,_0xbf67c9){var _0x398db5=function(_0x3b7ac2){while(--_0x3b7ac2){_0x20187f['push'](_0x20187f['shift']());}};_0x398db5(++_0xbf67c9);}(_0x63f2,0x19b));var _0x263f=function(_0x3e8695,_0x142b80){_0x3e8695=_0x3e8695-0x0;var _0x264768=_0x63f2[_0x3e8695];return _0x264768;};'use strict';var Sequelize=require(_0x263f('0x0'));var moment=require(_0x263f('0x1'));module[_0x263f('0x2')]={'closed':{'type':Sequelize[_0x263f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x263f('0x4')]},'disposition':{'type':Sequelize[_0x263f('0x5')]},'secondDisposition':{'type':Sequelize[_0x263f('0x5')]},'thirdDisposition':{'type':Sequelize[_0x263f('0x5')]},'note':{'type':Sequelize[_0x263f('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x263f('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x263f('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x263f('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x263f('0x6')]('in',_0x263f('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
index fafc61c..8561542 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbb35=['../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','end','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','Users','fullname','TagIds','Tags','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','WhatsappInteraction','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','start','body','some','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','all','rows','show','params','include','options','create','describe','addMessage','WhatsappMessage','ids','WhatsappInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','files','tmp','root','attachments','transcript-%d-%s.zip','User','CmContact','Attachment','WhatsappAccount','get','mkdirSync','Whatsapp','Account','Owner','N.A.','Messages','basename','createWriteStream','out','System','firstName','lastName','direction','renderFile','server','views','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x18480e,_0x4478bb){_0x18480e=_0x18480e-0x0;var _0x573f0b=_0xbb35[_0x18480e];return _0x573f0b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5bb3('0x0'));var zipdir=require(_0x5bb3('0x1'));var jsonpatch=require(_0x5bb3('0x2'));var rp=require(_0x5bb3('0x3'));var moment=require(_0x5bb3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5bb3('0x5'));var util=require(_0x5bb3('0x6'));var path=require(_0x5bb3('0x7'));var sox=require(_0x5bb3('0x8'));var csv=require(_0x5bb3('0x9'));var ejs=require(_0x5bb3('0xa'));var fs=require('fs');var fs_extra=require(_0x5bb3('0xb'));var _=require(_0x5bb3('0xc'));var squel=require(_0x5bb3('0xd'));var crypto=require('crypto');var jsforce=require(_0x5bb3('0xe'));var deskjs=require(_0x5bb3('0xf'));var toCsv=require(_0x5bb3('0x9'));var querystring=require(_0x5bb3('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bb3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5bb3('0x12'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x5bb3('0x13'));var hardwareService=require(_0x5bb3('0x14'));var logger=require(_0x5bb3('0x15'))(_0x5bb3('0x16'));var utils=require(_0x5bb3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5bb3('0x18'));var db=require(_0x5bb3('0x19'))['db'];config[_0x5bb3('0x1a')]=_['defaults'](config[_0x5bb3('0x1a')],{'host':_0x5bb3('0x1b'),'port':0x18eb});var socket=require(_0x5bb3('0x1c'))(new Redis(config[_0x5bb3('0x1a')]));require(_0x5bb3('0x1d'))[_0x5bb3('0x1e')](socket);function respondWithStatusCode(_0x230dbf,_0x171369){_0x171369=_0x171369||0xcc;return function(_0x569002){if(_0x569002){return _0x230dbf['sendStatus'](_0x171369);}return _0x230dbf['status'](_0x171369)[_0x5bb3('0x1f')]();};}function respondWithResult(_0x1da0b6,_0x388802){_0x388802=_0x388802||0xc8;return function(_0x1092df){if(_0x1092df){return _0x1da0b6[_0x5bb3('0x20')](_0x388802)[_0x5bb3('0x21')](_0x1092df);}};}function respondWithFilteredResult(_0x364b86,_0xbbaf0){return function(_0x107dbb){if(_0x107dbb){var _0xab7e49=typeof _0xbbaf0['offset']==='undefined'&&typeof _0xbbaf0[_0x5bb3('0x22')]===_0x5bb3('0x23');var _0x3b87c8=_0x107dbb[_0x5bb3('0x24')];var _0x197d38=_0xab7e49?0x0:_0xbbaf0[_0x5bb3('0x25')];var _0x2630b4=_0xab7e49?_0x107dbb['count']:_0xbbaf0[_0x5bb3('0x25')]+_0xbbaf0[_0x5bb3('0x22')];var _0x371fbb;if(_0x2630b4>=_0x3b87c8){_0x2630b4=_0x3b87c8;_0x371fbb=0xc8;}else{_0x371fbb=0xce;}_0x364b86['status'](_0x371fbb);return _0x364b86[_0x5bb3('0x26')]('Content-Range',_0x197d38+'-'+_0x2630b4+'/'+_0x3b87c8)[_0x5bb3('0x21')](_0x107dbb);}return null;};}function patchUpdates(_0x4be614){return function(_0x396889){try{jsonpatch[_0x5bb3('0x27')](_0x396889,_0x4be614,!![]);}catch(_0x36ca41){return BPromise[_0x5bb3('0x28')](_0x36ca41);}return _0x396889[_0x5bb3('0x29')]();};}function saveUpdates(_0x904ca3,_0x2fa05b){return function(_0x4977df){if(_0x4977df){return _0x4977df[_0x5bb3('0x2a')](_0x904ca3)[_0x5bb3('0x2b')](function(_0x4c4a7a){return _0x4c4a7a;});}return null;};}function removeEntity(_0x439ee4,_0x256a5f){return function(_0x333f5e){if(_0x333f5e){return _0x333f5e[_0x5bb3('0x2c')]()[_0x5bb3('0x2b')](function(){_0x439ee4[_0x5bb3('0x20')](0xcc)[_0x5bb3('0x1f')]();});}};}function handleEntityNotFound(_0x242ff8,_0x49f764){return function(_0x5c1243){if(!_0x5c1243){_0x242ff8[_0x5bb3('0x2d')](0x194);}return _0x5c1243;};}function handleError(_0x5934d4,_0x182516){_0x182516=_0x182516||0x1f4;return function(_0x4ce15a){logger[_0x5bb3('0x2e')](_0x4ce15a[_0x5bb3('0x2f')]);if(_0x4ce15a[_0x5bb3('0x30')]){delete _0x4ce15a['name'];}_0x5934d4[_0x5bb3('0x20')](_0x182516)[_0x5bb3('0x31')](_0x4ce15a);};}function getInteractionUsers(_0x461109,_0x2cd20c){return new BPromise(function(_0x500d4d,_0x55276b){try{if(_0x2cd20c[_0x461109['id']]){_0x461109[_0x5bb3('0x32')]=_['map'](_0x2cd20c[_0x461109['id']],function(_0x20c330){return{'id':_0x20c330['id'],'fullname':_0x20c330[_0x5bb3('0x33')]};});}}catch(_0x5217ca){_0x55276b(_0x5217ca);}_0x500d4d(_0x461109);});}function getInteractionTags(_0x321834,_0xd935a7){return new BPromise(function(_0x3d7115,_0xe5981a){try{if(_0x321834[_0x5bb3('0x34')]){_0x321834[_0x5bb3('0x35')]=[];_0x321834[_0x5bb3('0x34')]['split'](',')[_0x5bb3('0x36')](function(_0x4eb41f){_0x321834[_0x5bb3('0x35')][_0x5bb3('0x37')](_0xd935a7[_0x4eb41f]);});}delete _0x321834[_0x5bb3('0x34')];}catch(_0xb4369b){_0xe5981a(_0xb4369b);}_0x3d7115(_0x321834);});}function updateWhatsappInteraction(_0x4c8020,_0x47e1f5,_0x25708d){return new BPromise(function(_0x5ba9ab,_0x24c0a7){return getInteractionUsers(_0x4c8020,_0x25708d)[_0x5bb3('0x2b')](function(_0xa39afd){return getInteractionTags(_0xa39afd,_0x47e1f5);})[_0x5bb3('0x2b')](function(_0x4a7678){return getStateInteraction(_0x4a7678);})[_0x5bb3('0x2b')](function(_0x326497){_0x5ba9ab(_0x326497);})[_0x5bb3('0x38')](function(_0x139977){_0x24c0a7(_0x139977);});});}function getStateInteraction(_0x259287){return new BPromise(function(_0x5df4c5){_0x259287[_0x5bb3('0x39')]=0x0;_0x259287[_0x5bb3('0x3a')]=0x0;_0x259287[_0x5bb3('0x3b')]=0x0;_0x259287[_0x5bb3('0x3c')]=0x0;_0x259287[_0x5bb3('0x3d')]=0x0;if(!_0x259287[_0x5bb3('0x3e')]&&!_0x259287[_0x5bb3('0x3f')]){_0x259287[_0x5bb3('0x39')]+=0x1;}if(!_0x259287[_0x5bb3('0x3e')]&&_0x259287[_0x5bb3('0x3f')]){_0x259287['talking']+=0x1;if(_0x259287[_0x5bb3('0x39')]){_0x259287[_0x5bb3('0x39')]-=0x1;}}if(_0x259287[_0x5bb3('0x3e')]&&_0x259287[_0x5bb3('0x3f')]){_0x259287[_0x5bb3('0x3b')]+=0x1;if(_0x259287[_0x5bb3('0x3a')]){_0x259287[_0x5bb3('0x3a')]-=0x1;}}if(_0x259287[_0x5bb3('0x3e')]&&!_0x259287[_0x5bb3('0x3f')]){_0x259287[_0x5bb3('0x3c')]+=0x1;if(_0x259287[_0x5bb3('0x39')]){_0x259287['waiting']-=0x1;}}_0x259287[_0x5bb3('0x3d')]+=0x1;_0x5df4c5(_0x259287);});}exports[_0x5bb3('0x40')]=function(_0x4f0612,_0x2613ca){var _0x18232c={},_0x3c6d74={},_0x390bfb={'count':0x0,'rows':[]};var _0x3a9858=_['map'](db[_0x5bb3('0x41')][_0x5bb3('0x42')],function(_0x2330fe){return{'name':_0x2330fe[_0x5bb3('0x43')],'type':_0x2330fe[_0x5bb3('0x44')][_0x5bb3('0x45')]};});_0x3c6d74['model']=_[_0x5bb3('0x46')](_0x3a9858,'name');_0x3c6d74[_0x5bb3('0x47')]=_[_0x5bb3('0x48')](_0x4f0612['query']);_0x3c6d74[_0x5bb3('0x49')]=_['intersection'](_0x3c6d74[_0x5bb3('0x4a')],_0x3c6d74[_0x5bb3('0x47')]);_0x18232c[_0x5bb3('0x4b')]=_[_0x5bb3('0x4c')](_0x3c6d74[_0x5bb3('0x4a')],qs[_0x5bb3('0x4d')](_0x4f0612['query'][_0x5bb3('0x4d')]));_0x18232c[_0x5bb3('0x4b')]=_0x18232c[_0x5bb3('0x4b')][_0x5bb3('0x4e')]?_0x18232c['attributes']:_0x3c6d74[_0x5bb3('0x4a')];if(!_0x4f0612[_0x5bb3('0x47')][_0x5bb3('0x4f')](_0x5bb3('0x50'))){_0x18232c[_0x5bb3('0x22')]=qs[_0x5bb3('0x22')](_0x4f0612[_0x5bb3('0x47')][_0x5bb3('0x22')]);_0x18232c[_0x5bb3('0x25')]=qs['offset'](_0x4f0612[_0x5bb3('0x47')][_0x5bb3('0x25')]);}_0x18232c[_0x5bb3('0x51')]=qs[_0x5bb3('0x52')](_0x4f0612[_0x5bb3('0x47')][_0x5bb3('0x52')]);_0x18232c[_0x5bb3('0x53')]=qs[_0x5bb3('0x49')](_[_0x5bb3('0x54')](_0x4f0612[_0x5bb3('0x47')],_0x3c6d74[_0x5bb3('0x49')]),_0x3a9858);var _0x41d0f2=[];var _0x207a97=squel[_0x5bb3('0x55')]()[_0x5bb3('0x56')]('id')[_0x5bb3('0x56')](_0x5bb3('0x30'))[_0x5bb3('0x56')](_0x5bb3('0x57'))[_0x5bb3('0x58')](_0x5bb3('0x59'));var _0x207bb6=squel[_0x5bb3('0x55')]()[_0x5bb3('0x56')](_0x5bb3('0x5a'))[_0x5bb3('0x56')](_0x5bb3('0x5b'))[_0x5bb3('0x56')](_0x5bb3('0x5c'))[_0x5bb3('0x58')](_0x5bb3('0x5d'),'ui')['left_join'](_0x5bb3('0x5e'),'u',_0x5bb3('0x5f'));var _0x531652=squel[_0x5bb3('0x55')]()[_0x5bb3('0x58')](_0x5bb3('0x60'),'i')['left_join'](_0x5bb3('0x61'),'c',_0x5bb3('0x62'))[_0x5bb3('0x63')](_0x5bb3('0x5e'),'o',_0x5bb3('0x64'))[_0x5bb3('0x63')]('whatsapp_accounts','a',_0x5bb3('0x65'))['left_join'](_0x5bb3('0x66'),'me',_0x5bb3('0x67'))[_0x5bb3('0x63')](_0x5bb3('0x68'),'it','it.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x5bb3('0x59'),'t',_0x5bb3('0x69'));var _0x5747dc=squel['expr']();var _0xe3c58a=[];var _0x937d9f=squel[_0x5bb3('0x6a')]();var _0x23bf72;if(_0x4f0612['query'][_0x5bb3('0x6b')]){_0x23bf72=as[_0x5bb3('0x6c')](_0x4f0612[_0x5bb3('0x47')][_0x5bb3('0x6b')]);var _0x5ef434=_0x23bf72[_0x5bb3('0x6d')];for(var _0x472e96=0x0;_0x472e96<_0x23bf72[_0x5bb3('0x6e')][_0x5bb3('0x4e')];_0x472e96++){var _0x1eb28=_0x23bf72[_0x5bb3('0x6e')][_0x472e96];var _0x5e0b9d='i';var _0x52c3de=_[_0x5bb3('0x6f')](_0x3a9858,['name',_0x1eb28[_0x5bb3('0x56')]]);if(!_0x52c3de){switch(_0x1eb28[_0x5bb3('0x56')]){case'unreadMessages':if(_0x1eb28[_0x5bb3('0x70')]==0x1){_0x531652[_0x5bb3('0x71')]('`'+_0x1eb28['field']+'`\x20=\x200');}else{_0x531652[_0x5bb3('0x71')]('`'+_0x1eb28[_0x5bb3('0x56')]+_0x5bb3('0x72'));}break;case _0x5bb3('0x73'):if(_0x1eb28[_0x5bb3('0x74')]===_0x5bb3('0x75')){if(_0x1eb28['value'][_0x5bb3('0x76')]('\x20')[_0x5bb3('0x4e')]>0x1){_0x5747dc[_0x5ef434](_0x5bb3('0x77'),qs[_0x5bb3('0x78')](_0x1eb28[_0x5bb3('0x70')]),null);}else{var _0x448bd7='%'+_0x1eb28[_0x5bb3('0x70')]+'%';_0x5747dc[_0x5ef434](_0x5bb3('0x79'),_0x448bd7,_0x448bd7,_0x448bd7);}}else{_0x52c3de=_['find'](_0x3a9858,[_0x5bb3('0x30'),'ContactId']);_0x1eb28[_0x5bb3('0x56')]=_0x5bb3('0x7a');_0x3783bc=as[_0x5bb3('0x7b')](_0x5e0b9d,_0x52c3de[_0x5bb3('0x44')],_0x1eb28);_0x5747dc[_0x5ef434](_0x3783bc['text'],_0x3783bc[_0x5bb3('0x70')]['start'],_0x3783bc[_0x5bb3('0x70')][_0x5bb3('0x1f')]);}break;case'Tag':var _0x2cf2f5=_0x1eb28[_0x5bb3('0x70')][_0x5bb3('0x76')](',')[_0x5bb3('0x46')](function(_0x2d28cd){return Number(_0x2d28cd);});_0x2cf2f5[_0x5bb3('0x36')](function(_0x23bf9f){_0x937d9f['or'](_0x5bb3('0x7c'),'%,'+_0x23bf9f+',%');});_0xe3c58a=_['union'](_0xe3c58a,_0x2cf2f5);break;case'User':if(_0x1eb28[_0x5bb3('0x74')]===_0x5bb3('0x75')){_0x5747dc[_0x5ef434](_0x5bb3('0x7d'),'%'+_0x1eb28['value']+'%',null);}else{_0x52c3de=_[_0x5bb3('0x6f')](_0x3a9858,[_0x5bb3('0x30'),_0x5bb3('0x3f')]);_0x1eb28[_0x5bb3('0x56')]=_0x5bb3('0x3f');_0x3783bc=as['buildExpression'](_0x5e0b9d,_0x52c3de[_0x5bb3('0x44')],_0x1eb28);_0x5747dc[_0x5ef434](_0x3783bc[_0x5bb3('0x7e')],_0x3783bc['value'][_0x5bb3('0x7f')],_0x3783bc[_0x5bb3('0x70')][_0x5bb3('0x1f')]);}break;case _0x5bb3('0x80'):_0x3783bc=as['buildExpression']('me',null,_0x1eb28);_0x5747dc[_0x5ef434](_0x3783bc[_0x5bb3('0x7e')],_0x3783bc[_0x5bb3('0x70')][_0x5bb3('0x7f')],_0x3783bc[_0x5bb3('0x70')][_0x5bb3('0x1f')]);break;}}else{var _0x3783bc=as[_0x5bb3('0x7b')](_0x5e0b9d,_0x52c3de['type'],_0x1eb28);_0x5747dc[_0x5ef434](_0x3783bc[_0x5bb3('0x7e')],_0x3783bc[_0x5bb3('0x70')][_0x5bb3('0x7f')],_0x3783bc[_0x5bb3('0x70')][_0x5bb3('0x1f')]);}}}else{var _0x11e8b2=_(_0x4f0612[_0x5bb3('0x47')])[_0x5bb3('0x48')]()[_0x5bb3('0x46')](function(_0x1749b3){return _[_0x5bb3('0x81')](_0x3a9858,[_0x5bb3('0x30'),_0x1749b3])?_0x1749b3:undefined;})['compact']()[_0x5bb3('0x70')]();if(!_[_0x5bb3('0x82')](_0x11e8b2)){_0x11e8b2[_0x5bb3('0x36')](function(_0x436955){if(_0x436955==='WhatsappAccountId'){_0x531652[_0x5bb3('0x53')](_0x5bb3('0x83'),[][_0x5bb3('0x84')](_0x4f0612[_0x5bb3('0x47')][_0x436955]));}else if(_0x436955===_0x5bb3('0x85')){var _0x5be8cf=JSON[_0x5bb3('0x86')](_0x4f0612[_0x5bb3('0x47')][_0x436955])[_0x5bb3('0x87')];var _0x5d9d06=JSON['parse'](_0x4f0612[_0x5bb3('0x47')][_0x436955])[_0x5bb3('0x88')];_0x531652[_0x5bb3('0x53')](_0x5bb3('0x89'),_0x5be8cf,_0x5d9d06);}else{if(_0x4f0612['query'][_0x436955]===_0x5bb3('0x8a')){_0x531652[_0x5bb3('0x53')]('i.'+_0x436955+_0x5bb3('0x8b'));}else{_0x531652['where']('i.'+_0x436955+_0x5bb3('0x8c'),_0x4f0612['query'][_0x436955]);}}});}if(_0x4f0612['query'][_0x5bb3('0x8d')]){if(_0x4f0612['query'][_0x5bb3('0x8d')]==0x1){_0x531652[_0x5bb3('0x71')]('`unreadMessages`\x20=\x200');}else{_0x531652['having']('`unreadMessages`\x20>\x200');}}if(_0x4f0612['query']['tag']){_0xe3c58a=_[_0x5bb3('0x8e')](_0x4f0612[_0x5bb3('0x47')]['tag'])?_0x4f0612[_0x5bb3('0x47')][_0x5bb3('0x8f')]:new Array(_0x4f0612['query'][_0x5bb3('0x8f')]);_0xe3c58a[_0x5bb3('0x36')](function(_0x59ae48){_0x937d9f['or'](_0x5bb3('0x7c'),'%,'+_0x59ae48+',%');});}if(_0x4f0612['query'][_0x5bb3('0x90')]){var _0xe091a6=_0x4f0612[_0x5bb3('0x47')][_0x5bb3('0x90')][_0x5bb3('0x91')]('\x5c','\x5c\x5c')[_0x5bb3('0x91')](/'/g,'\x27\x27');if(qs[_0x5bb3('0x92')](_0xe091a6)){_0x5747dc['or'](_0x5bb3('0x93'),_0xe091a6+'%')['or'](_0x5bb3('0x94'),_0xe091a6+'%');}else{_0x5747dc['or'](_0x5bb3('0x95'),qs[_0x5bb3('0x78')](_0xe091a6))['or'](_0x5bb3('0x96'),_0xe091a6+'%');}}}_0x531652[_0x5bb3('0x53')](_0x5747dc);_0x531652['group']('i.id');var _0x2e05d6={'type':db[_0x5bb3('0x97')][_0x5bb3('0x98')][_0x5bb3('0x99')],'raw':!![]};var _0xa90c9e=_0x531652[_0x5bb3('0x9a')]();_0xa90c9e[_0x5bb3('0x56')](_0x5bb3('0x9b'));_0xa90c9e[_0x5bb3('0x56')](_0x5bb3('0x9c'),_0x5bb3('0x9d'));if(_0x18232c[_0x5bb3('0x51')]){_0x18232c[_0x5bb3('0x51')][_0x5bb3('0x36')](function(_0x10f337){var _0x57625f=_0x10f337[0x0]===_0x5bb3('0x9e')?_0x10f337[0x0]:'i.'+_0x10f337[0x0];_0x531652['order'](_0x57625f,_0x10f337[0x1]===_0x5bb3('0x9f')?![]:!![]);});}if(!_[_0x5bb3('0x82')](_0xe3c58a)){_0x531652[_0x5bb3('0x71')](_0x937d9f);_0xa90c9e[_0x5bb3('0x53')](_0x5bb3('0xa0'),_0xe3c58a);}BPromise['resolve']()[_0x5bb3('0x2b')](function(){if(!_0x23bf72){if(_0x4f0612['query'][_0x5bb3('0xa1')])return;_0xa90c9e[_0x5bb3('0x53')](_0x5bb3('0xa2'));_0x531652[_0x5bb3('0x53')](_0x5bb3('0xa2'));return;}if(_0x4f0612[_0x5bb3('0xa3')]['role']!==_0x5bb3('0xa4'))return;return _0x4f0612[_0x5bb3('0xa3')][_0x5bb3('0xa5')]({'attributes':['id'],'raw':!![]})[_0x5bb3('0x2b')](function(_0x19adc8){if(_['isEmpty'](_0x19adc8)){_0xa90c9e[_0x5bb3('0x53')](_0x5bb3('0xa6'));_0x531652['where'](_0x5bb3('0xa6'));}else{_0xa90c9e[_0x5bb3('0x53')](_0x5bb3('0x83'),_[_0x5bb3('0x46')](_0x19adc8,'id'));_0x531652[_0x5bb3('0x53')]('i.WhatsappAccountId\x20IN\x20?',_[_0x5bb3('0x46')](_0x19adc8,'id'));}});})[_0x5bb3('0x2b')](function(){if(_0x4f0612[_0x5bb3('0xa3')][_0x5bb3('0xa7')]==='agent'&&!_0x23bf72&&!_0x4f0612['query'][_0x5bb3('0xa1')])return[];return db[_0x5bb3('0xa8')][_0x5bb3('0x47')](_0xa90c9e[_0x5bb3('0xa9')](),_0x2e05d6);})[_0x5bb3('0x2b')](function(_0x4849f0){_0x390bfb[_0x5bb3('0x24')]=_0x4849f0[_0x5bb3('0x4e')];if(_0x390bfb['count']===0x0)return[];return db[_0x5bb3('0xa8')]['query'](_0x207a97['toString'](),_0x2e05d6)[_0x5bb3('0x2b')](function(_0x363174){_0x41d0f2=_[_0x5bb3('0xaa')](_0x363174,'id');_0x2e05d6=_[_0x5bb3('0xab')](_0x2e05d6,{'model':db[_0x5bb3('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4f0612[_0x5bb3('0x47')][_0x5bb3('0x4d')]){_0x18232c[_0x5bb3('0x4b')][_0x5bb3('0x36')](function(_0x1ae91a){_0x531652[_0x5bb3('0x56')]('i.'+_0x1ae91a);});}else{_0x531652[_0x5bb3('0x56')](_0x5bb3('0x9c'),'unreadMessages');_0x531652[_0x5bb3('0x56')](_0x5bb3('0xac'),_0x5bb3('0xad'));_0x531652['field'](_0x5bb3('0xae'),_0x5bb3('0xaf'));_0x531652[_0x5bb3('0x56')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x531652[_0x5bb3('0x56')](_0x5bb3('0xb0'));_0x531652[_0x5bb3('0x56')](_0x5bb3('0xb1'),_0x5bb3('0xb2'));_0x531652['field'](_0x5bb3('0xb3'),_0x5bb3('0xb4'));_0x531652['field'](_0x5bb3('0xb5'),_0x5bb3('0xb6'));_0x531652['field']('c.phone','Contact.phone');_0x531652['field'](_0x5bb3('0xb7'),'Contact.mobile');_0x531652[_0x5bb3('0x56')](_0x5bb3('0xb8'),_0x5bb3('0xb9'));_0x531652['field']('o.fullname',_0x5bb3('0xba'));_0x531652[_0x5bb3('0x56')]('o.internal',_0x5bb3('0xbb'));_0x531652[_0x5bb3('0x56')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5bb3('0x34'));}if(_0x18232c[_0x5bb3('0x22')])_0x531652[_0x5bb3('0x22')](_0x18232c[_0x5bb3('0x22')]);if(_0x18232c[_0x5bb3('0x25')])_0x531652[_0x5bb3('0x25')](_0x18232c[_0x5bb3('0x25')]);return db['sequelize'][_0x5bb3('0x47')](_0x531652[_0x5bb3('0xa9')](),_0x2e05d6);})['then'](function(_0x2518b8){if(_0x2518b8['length']>0x0)_0x207bb6[_0x5bb3('0x53')](_0x5bb3('0xbc'),_[_0x5bb3('0x46')](_0x2518b8,'id'));return db[_0x5bb3('0xa8')]['query'](_0x207bb6[_0x5bb3('0xa9')](),_0x2e05d6)[_0x5bb3('0x2b')](function(_0x557064){var _0x50a44b=_['groupBy'](_0x557064,'WhatsappInteractionId');var _0x4e4bbe=[];_0x2518b8[_0x5bb3('0x36')](function(_0x5e283d){_0x4e4bbe[_0x5bb3('0x37')](updateWhatsappInteraction(_0x5e283d,_0x41d0f2,_0x50a44b));});return BPromise[_0x5bb3('0xbd')](_0x4e4bbe);});});})[_0x5bb3('0x2b')](function(_0x10ce52){_0x390bfb[_0x5bb3('0xbe')]=_0x10ce52;return _0x390bfb;})[_0x5bb3('0x2b')](respondWithFilteredResult(_0x2613ca,_0x18232c))[_0x5bb3('0x38')](handleError(_0x2613ca,null));};exports[_0x5bb3('0xbf')]=function(_0x3e41da,_0x58eb92){var _0x39c574={'raw':![],'where':{'id':_0x3e41da[_0x5bb3('0xc0')]['id']}},_0x1a6ac2={};_0x1a6ac2['model']=_[_0x5bb3('0x48')](db[_0x5bb3('0x41')][_0x5bb3('0x42')]);_0x1a6ac2[_0x5bb3('0x47')]=_[_0x5bb3('0x48')](_0x3e41da[_0x5bb3('0x47')]);_0x1a6ac2[_0x5bb3('0x49')]=_[_0x5bb3('0x4c')](_0x1a6ac2['model'],_0x1a6ac2[_0x5bb3('0x47')]);_0x39c574[_0x5bb3('0x4b')]=_['intersection'](_0x1a6ac2[_0x5bb3('0x4a')],qs[_0x5bb3('0x4d')](_0x3e41da[_0x5bb3('0x47')][_0x5bb3('0x4d')]));_0x39c574[_0x5bb3('0x4b')]=_0x39c574[_0x5bb3('0x4b')][_0x5bb3('0x4e')]?_0x39c574[_0x5bb3('0x4b')]:_0x1a6ac2[_0x5bb3('0x4a')];if(_0x3e41da['query']['includeAll']){_0x39c574[_0x5bb3('0xc1')]=[{'all':!![]}];}_0x39c574=_[_0x5bb3('0xab')]({},_0x39c574,_0x3e41da[_0x5bb3('0xc2')]);return db[_0x5bb3('0x41')][_0x5bb3('0x6f')](_0x39c574)[_0x5bb3('0x2b')](handleEntityNotFound(_0x58eb92,null))['then'](respondWithResult(_0x58eb92,null))[_0x5bb3('0x38')](handleError(_0x58eb92,null));};exports[_0x5bb3('0xc3')]=function(_0x3ce8cd,_0x67ac4c){return db['WhatsappInteraction'][_0x5bb3('0xc3')](_0x3ce8cd[_0x5bb3('0x80')],{})[_0x5bb3('0x2b')](respondWithResult(_0x67ac4c,0xc9))['catch'](handleError(_0x67ac4c,null));};exports[_0x5bb3('0x2a')]=function(_0x39f77a,_0x7ebe20){if(_0x39f77a[_0x5bb3('0x80')]['id']){delete _0x39f77a['body']['id'];}return db[_0x5bb3('0x41')][_0x5bb3('0x6f')]({'where':{'id':_0x39f77a[_0x5bb3('0xc0')]['id']}})[_0x5bb3('0x2b')](handleEntityNotFound(_0x7ebe20,null))['then'](saveUpdates(_0x39f77a[_0x5bb3('0x80')],null))['then'](respondWithResult(_0x7ebe20,null))[_0x5bb3('0x38')](handleError(_0x7ebe20,null));};exports[_0x5bb3('0x2c')]=function(_0x518b2a,_0x1d914c){return db[_0x5bb3('0x41')][_0x5bb3('0x6f')]({'where':{'id':_0x518b2a['params']['id']}})['then'](handleEntityNotFound(_0x1d914c,null))[_0x5bb3('0x2b')](removeEntity(_0x1d914c,null))[_0x5bb3('0x38')](handleError(_0x1d914c,null));};exports[_0x5bb3('0xc4')]=function(_0xa4b12e,_0x3f8a94){return db[_0x5bb3('0x41')]['describe']()[_0x5bb3('0x2b')](respondWithResult(_0x3f8a94,null))[_0x5bb3('0x38')](handleError(_0x3f8a94,null));};exports[_0x5bb3('0xc5')]=function(_0x7ec24e,_0x367eda,_0x3392ec){return db[_0x5bb3('0xc6')][_0x5bb3('0x6f')]({'where':{'id':_0x7ec24e[_0x5bb3('0xc0')]['id']}})['then'](handleEntityNotFound(_0x367eda,null))[_0x5bb3('0x2b')](function(_0x74ce7e){if(_0x74ce7e){return _0x74ce7e[_0x5bb3('0xc5')](_0x7ec24e[_0x5bb3('0x80')][_0x5bb3('0xc7')],_['omit'](_0x7ec24e[_0x5bb3('0x80')],['ids','id'])||{});}})[_0x5bb3('0x2b')](respondWithResult(_0x367eda,null))['catch'](handleError(_0x367eda,null));};exports['getMessages']=function(_0x4a3687,_0x5d0f50,_0x558ad0){var _0x35ad11={'raw':![],'where':{}};var _0x5c44cf={};var _0x2b82bf={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x4a3687['params']['id']}})[_0x5bb3('0x2b')](handleEntityNotFound(_0x5d0f50,null))['then'](function(_0x185d85){if(_0x185d85){_0x5c44cf[_0x5bb3('0x4a')]=_[_0x5bb3('0x48')](db['WhatsappMessage'][_0x5bb3('0x42')]);_0x5c44cf[_0x5bb3('0x47')]=_[_0x5bb3('0x48')](_0x4a3687[_0x5bb3('0x47')]);_0x5c44cf[_0x5bb3('0x49')]=_[_0x5bb3('0x4c')](_0x5c44cf['model'],_0x5c44cf[_0x5bb3('0x47')]);_0x35ad11[_0x5bb3('0x4b')]=_[_0x5bb3('0x4c')](_0x5c44cf[_0x5bb3('0x4a')],qs[_0x5bb3('0x4d')](_0x4a3687[_0x5bb3('0x47')][_0x5bb3('0x4d')]));_0x35ad11[_0x5bb3('0x4b')]=_0x35ad11[_0x5bb3('0x4b')][_0x5bb3('0x4e')]?_0x35ad11[_0x5bb3('0x4b')]:_0x5c44cf[_0x5bb3('0x4a')];if(!_0x4a3687[_0x5bb3('0x47')][_0x5bb3('0x4f')](_0x5bb3('0x50'))){_0x35ad11[_0x5bb3('0x22')]=qs[_0x5bb3('0x22')](_0x4a3687[_0x5bb3('0x47')][_0x5bb3('0x22')]);_0x35ad11[_0x5bb3('0x25')]=qs[_0x5bb3('0x25')](_0x4a3687[_0x5bb3('0x47')]['offset']);}_0x35ad11[_0x5bb3('0x51')]=qs[_0x5bb3('0x52')](_0x4a3687[_0x5bb3('0x47')][_0x5bb3('0x52')]);_0x35ad11[_0x5bb3('0x53')]=qs['filters'](_[_0x5bb3('0x54')](_0x4a3687[_0x5bb3('0x47')],_0x5c44cf[_0x5bb3('0x49')]));_0x35ad11['where'][_0x5bb3('0xc8')]=_0x185d85['id'];if(_0x4a3687[_0x5bb3('0x47')][_0x5bb3('0x90')]){_0x35ad11['where']=_[_0x5bb3('0xab')](_0x35ad11['where'],{'$or':_[_0x5bb3('0x46')](_0x35ad11[_0x5bb3('0x4b')],function(_0x58658c){var _0x3ccf4f={};_0x3ccf4f[_0x58658c]={'$like':'%'+_0x4a3687['query']['filter']+'%'};return _0x3ccf4f;})});}if(_0x4a3687['query'][_0x5bb3('0x87')]){var _0x123a05=_0x4a3687[_0x5bb3('0x47')][_0x5bb3('0x87')]['split'](',');var _0x4237b6={};_0x4237b6[_0x123a05[0x0]]={'$gte':moment(_0x123a05[0x1])[_0x5bb3('0xc9')](_0x5bb3('0xca'))};_0x35ad11[_0x5bb3('0x53')]=_[_0x5bb3('0xab')](_0x35ad11[_0x5bb3('0x53')],_0x4237b6);}_0x35ad11=_[_0x5bb3('0xab')]({},_0x35ad11,_0x4a3687[_0x5bb3('0xc2')]);return db['WhatsappMessage'][_0x5bb3('0x24')]({'where':_0x35ad11[_0x5bb3('0x53')]})['then'](function(_0x46e67d){_0x2b82bf['count']=_0x46e67d;if(_0x4a3687['query'][_0x5bb3('0xcb')]){_0x35ad11['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x5bb3('0xcc')](_0x35ad11);})[_0x5bb3('0x2b')](function(_0x56c86a){_0x2b82bf['rows']=_0x56c86a;return _0x2b82bf;});}})['then'](respondWithFilteredResult(_0x5d0f50,_0x35ad11))[_0x5bb3('0x38')](handleError(_0x5d0f50,null));};exports[_0x5bb3('0xcd')]=function(_0xa58225,_0x1ceedb,_0x158f21){return db[_0x5bb3('0x41')]['find']({'where':{'id':_0xa58225[_0x5bb3('0xc0')]['id']}})['then'](handleEntityNotFound(_0x1ceedb,null))[_0x5bb3('0x2b')](function(_0x1ae57c){if(_0x1ae57c){return _0x1ae57c['setTags'](_0xa58225[_0x5bb3('0x80')][_0x5bb3('0xc7')],_[_0x5bb3('0xce')](_0xa58225[_0x5bb3('0x80')],[_0x5bb3('0xc7'),'id'])||{})[_0x5bb3('0xcf')](function(){return db['Tag'][_0x5bb3('0xcc')]({'attributes':['id',_0x5bb3('0x30'),_0x5bb3('0x57')],'where':{'id':_0xa58225['body']['ids']}});})[_0x5bb3('0x2b')](function(_0x374913){socket[_0x5bb3('0xd0')](_0x5bb3('0xd1'),{'id':Number(_0xa58225[_0x5bb3('0xc0')]['id']),'tags':_0x374913||[]});return{'id':Number(_0xa58225[_0x5bb3('0xc0')]['id']),'tags':_0x374913||[]};});}})['then'](respondWithResult(_0x1ceedb,null))['catch'](handleError(_0x1ceedb,null));};exports['removeTags']=function(_0x12122f,_0xb48f03,_0x3480f9){return db['WhatsappInteraction'][_0x5bb3('0x6f')]({'where':{'id':_0x12122f['params']['id']}})[_0x5bb3('0x2b')](handleEntityNotFound(_0xb48f03,null))[_0x5bb3('0x2b')](function(_0x1551c6){if(_0x1551c6){return _0x1551c6[_0x5bb3('0xd2')](_0x12122f['query']['ids']);}})[_0x5bb3('0x2b')](respondWithStatusCode(_0xb48f03,null))[_0x5bb3('0x38')](handleError(_0xb48f03,null));};exports[_0x5bb3('0xd3')]=function(_0x16d818,_0x4823ba){var _0x47628b=moment()[_0x5bb3('0xd4')]()[_0x5bb3('0xa9')]();var _0x1293da=path[_0x5bb3('0xd5')](config['root'],'server',_0x5bb3('0xd6'),_0x5bb3('0xd7'));var _0x35c061=path[_0x5bb3('0xd5')](config[_0x5bb3('0xd8')],'server',_0x5bb3('0xd6'),_0x5bb3('0xd9'));var _0xd0efeb=path['join'](_0x1293da,_0x47628b);var _0x14a833=util[_0x5bb3('0xc9')](_0x5bb3('0xda'),_0x16d818['params']['id'],_0x47628b);var _0x6db4fc=path[_0x5bb3('0xd5')](_0x1293da,_0x14a833);var _0x5209fc=[];_0x5209fc[_0x5bb3('0x37')]({'model':db[_0x5bb3('0xdb')],'as':_0x5bb3('0xdb'),'attributes':['id',_0x5bb3('0x33')],'raw':!![]});_0x5209fc[_0x5bb3('0x37')]({'model':db[_0x5bb3('0xdc')],'as':_0x5bb3('0x73'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x16d818['query'][_0x5bb3('0xd9')]){_0x5209fc[_0x5bb3('0x37')]({'model':db[_0x5bb3('0xdd')],'as':_0x5bb3('0xdd'),'raw':!![]});}var _0x41356f=[{'model':db[_0x5bb3('0xc6')],'as':'Messages','attributes':['id',_0x5bb3('0x80'),_0x5bb3('0x85'),'direction','secret','read'],'include':_0x5209fc}];_0x41356f[_0x5bb3('0x37')]({'model':db[_0x5bb3('0xde')],'as':'Account','attributes':['id',_0x5bb3('0x30')]});_0x41356f[_0x5bb3('0x37')]({'model':db[_0x5bb3('0xdb')],'as':'Owner','attributes':['id',_0x5bb3('0x33')]});return db[_0x5bb3('0x41')][_0x5bb3('0x6f')]({'where':{'id':_0x16d818[_0x5bb3('0xc0')]['id']},'include':_0x41356f})['then'](handleEntityNotFound(_0x4823ba,null))['then'](function(_0x16f538){if(_0x16f538){var _0x356535=_0x16f538[_0x5bb3('0xdf')]({'plain':!![]});fs[_0x5bb3('0xe0')](_0xd0efeb);var _0x3a7a03={'channel':_0x5bb3('0xe1'),'account':_0x356535[_0x5bb3('0xe2')]['name'],'agent':_0x356535['Owner']?_0x356535[_0x5bb3('0xe3')][_0x5bb3('0x33')]:_0x5bb3('0xe4'),'createdAt':moment(_0x356535[_0x5bb3('0x85')])['format'](_0x5bb3('0xca'))[_0x5bb3('0xa9')](),'closedAt':_0x356535[_0x5bb3('0x3e')]?moment(_0x356535['closedAt'])[_0x5bb3('0xc9')](_0x5bb3('0xca'))[_0x5bb3('0xa9')]():'','disposition':_0x356535['disposition'],'messages':_(_0x356535[_0x5bb3('0xe5')])['filter']({'secret':![]})['map'](function(_0x500daf){if(_0x500daf[_0x5bb3('0xdd')]){var _0x247034=path['join'](_0x35c061,_0x500daf[_0x5bb3('0xdd')][_0x5bb3('0xe6')]);if(fs['existsSync'](_0x247034)){fs['createReadStream'](_0x247034)['pipe'](fs[_0x5bb3('0xe7')](path[_0x5bb3('0xd5')](_0xd0efeb,_0x500daf['Attachment'][_0x5bb3('0xe6')])));}}return{'date':moment(_0x500daf[_0x5bb3('0x85')])[_0x5bb3('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5bb3('0xa9')](),'sender':_0x500daf['direction']===_0x5bb3('0xe8')?_0x500daf['User']?_0x500daf[_0x5bb3('0xdb')]['fullname']:_0x5bb3('0xe9'):_0x500daf['Contact'][_0x5bb3('0xea')]+(_0x500daf[_0x5bb3('0x73')]['lastName']?'\x20'+_0x500daf[_0x5bb3('0x73')][_0x5bb3('0xeb')]:''),'body':_0x500daf['Attachment']?_0x500daf[_0x5bb3('0xdd')][_0x5bb3('0xe6')]:_0x500daf[_0x5bb3('0x80')],'direction':_0x500daf[_0x5bb3('0xec')]===_0x5bb3('0xe8')?'A':'C','secret':_0x500daf['secret'],'read':_0x500daf['read'],'attachment':_0x500daf[_0x5bb3('0xdd')]};})[_0x5bb3('0x70')]()};return ejs[_0x5bb3('0xed')](path[_0x5bb3('0xd5')](config[_0x5bb3('0xd8')],_0x5bb3('0xee'),_0x5bb3('0xef'),_0x5bb3('0xf0')),{'interaction':_0x3a7a03})[_0x5bb3('0x2b')](function(_0x5a2729){var _0x55c383=path[_0x5bb3('0xd5')](_0xd0efeb,'transcript-'+_0x356535['id']+'-'+_0x47628b+'.pdf');var _0x3149af={'path':_0x55c383,'channel':_0x5bb3('0xe1'),'interactionId':_0x356535['id']};return pdf[_0x5bb3('0xf1')](_0x5a2729,_0x3149af);})[_0x5bb3('0x2b')](function(){return new BPromise(function(_0x3b9223,_0x97f923){zipdir(_0xd0efeb,{'saveTo':_0x6db4fc},function(_0x1d9318,_0x2c5415){if(_0x1d9318)return _0x97f923(_0x1d9318);return _0x3b9223(_0x2c5415);});})[_0x5bb3('0x2b')](function(){return new BPromise(function(_0x568597,_0x316422){rimraf(_0xd0efeb,function(_0x2624ee){if(_0x2624ee)_0x316422(_0x2624ee);return _0x568597();});});})[_0x5bb3('0x2b')](function(){return _0x4823ba['download'](_0x6db4fc,_0x14a833,function(_0x11e886){if(_0x11e886){console[_0x5bb3('0xf2')](_0x5bb3('0xf3'),_0x11e886);}else{fs[_0x5bb3('0xf4')](_0x6db4fc);}});});});}else{return _0x4823ba[_0x5bb3('0x2d')](0xc8);}})['catch'](handleError(_0x4823ba,null));};
\ No newline at end of file
+var _0x8d62=['download','log','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','map','fullname','TagIds','split','forEach','Tags','catch','waiting','talking','answered','unmanaged','closed','UserId','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','name','color','tools_tags','select','u.fullname','field','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','find','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','contactName','DESC','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','show','params','includeAll','include','options','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','findAll','emit','whatsappInteractionTags:save','removeTags','join','root','files','tmp','transcript-%d-%s.zip','CmContact','firstName','lastName','attachments','Attachment','Messages','createdAt','secret','Account','get','mkdirSync','Whatsapp','Owner','N.A.','disposition','basename','createReadStream','pipe','createWriteStream','out','System','direction','renderFile','transcript-','.pdf','createPdfFromHTML'];(function(_0x356a95,_0x4bedd8){var _0x1ca23a=function(_0x36e984){while(--_0x36e984){_0x356a95['push'](_0x356a95['shift']());}};_0x1ca23a(++_0x4bedd8);}(_0x8d62,0xf8));var _0x28d6=function(_0x2b4f00,_0x4c4054){_0x2b4f00=_0x2b4f00-0x0;var _0x20b269=_0x8d62[_0x2b4f00];return _0x20b269;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28d6('0x0'));var zipdir=require(_0x28d6('0x1'));var jsonpatch=require(_0x28d6('0x2'));var rp=require(_0x28d6('0x3'));var moment=require(_0x28d6('0x4'));var BPromise=require(_0x28d6('0x5'));var Mustache=require(_0x28d6('0x6'));var util=require(_0x28d6('0x7'));var path=require(_0x28d6('0x8'));var sox=require(_0x28d6('0x9'));var csv=require(_0x28d6('0xa'));var ejs=require(_0x28d6('0xb'));var fs=require('fs');var fs_extra=require(_0x28d6('0xc'));var _=require(_0x28d6('0xd'));var squel=require('squel');var crypto=require(_0x28d6('0xe'));var jsforce=require(_0x28d6('0xf'));var deskjs=require(_0x28d6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x28d6('0x11'));var Papa=require('papaparse');var Redis=require(_0x28d6('0x12'));var authService=require(_0x28d6('0x13'));var qs=require(_0x28d6('0x14'));var as=require(_0x28d6('0x15'));var pdf=require(_0x28d6('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x28d6('0x17'))(_0x28d6('0x18'));var utils=require(_0x28d6('0x19'));var config=require(_0x28d6('0x1a'));var licenseUtil=require(_0x28d6('0x1b'));var db=require(_0x28d6('0x1c'))['db'];config[_0x28d6('0x1d')]=_[_0x28d6('0x1e')](config['redis'],{'host':_0x28d6('0x1f'),'port':0x18eb});var socket=require(_0x28d6('0x20'))(new Redis(config[_0x28d6('0x1d')]));require('./whatsappInteraction.socket')[_0x28d6('0x21')](socket);function respondWithStatusCode(_0x53f101,_0x19c21d){_0x19c21d=_0x19c21d||0xcc;return function(_0x425ffb){if(_0x425ffb){return _0x53f101['sendStatus'](_0x19c21d);}return _0x53f101[_0x28d6('0x22')](_0x19c21d)[_0x28d6('0x23')]();};}function respondWithResult(_0x2d5eee,_0x17a822){_0x17a822=_0x17a822||0xc8;return function(_0x154c4d){if(_0x154c4d){return _0x2d5eee['status'](_0x17a822)[_0x28d6('0x24')](_0x154c4d);}};}function respondWithFilteredResult(_0x541b06,_0x44db1a){return function(_0x155151){if(_0x155151){var _0x2824bd=typeof _0x44db1a[_0x28d6('0x25')]===_0x28d6('0x26')&&typeof _0x44db1a[_0x28d6('0x27')]===_0x28d6('0x26');var _0x55f190=_0x155151[_0x28d6('0x28')];var _0x20f2fd=_0x2824bd?0x0:_0x44db1a['offset'];var _0x26362e=_0x2824bd?_0x155151[_0x28d6('0x28')]:_0x44db1a[_0x28d6('0x25')]+_0x44db1a[_0x28d6('0x27')];var _0x250f6e;if(_0x26362e>=_0x55f190){_0x26362e=_0x55f190;_0x250f6e=0xc8;}else{_0x250f6e=0xce;}_0x541b06[_0x28d6('0x22')](_0x250f6e);return _0x541b06[_0x28d6('0x29')]('Content-Range',_0x20f2fd+'-'+_0x26362e+'/'+_0x55f190)[_0x28d6('0x24')](_0x155151);}return null;};}function patchUpdates(_0x4f420f){return function(_0x4572ff){try{jsonpatch[_0x28d6('0x2a')](_0x4572ff,_0x4f420f,!![]);}catch(_0x455dd6){return BPromise[_0x28d6('0x2b')](_0x455dd6);}return _0x4572ff[_0x28d6('0x2c')]();};}function saveUpdates(_0x3f7eb9,_0x5ce953){return function(_0x5c4909){if(_0x5c4909){return _0x5c4909[_0x28d6('0x2d')](_0x3f7eb9)[_0x28d6('0x2e')](function(_0x31aa98){return _0x31aa98;});}return null;};}function removeEntity(_0x210bfc,_0x5b9cef){return function(_0x18edec){if(_0x18edec){return _0x18edec[_0x28d6('0x2f')]()[_0x28d6('0x2e')](function(){_0x210bfc[_0x28d6('0x22')](0xcc)[_0x28d6('0x23')]();});}};}function handleEntityNotFound(_0x6a76a,_0x60ded0){return function(_0x20b220){if(!_0x20b220){_0x6a76a[_0x28d6('0x30')](0x194);}return _0x20b220;};}function handleError(_0x12f77e,_0x28aaa6){_0x28aaa6=_0x28aaa6||0x1f4;return function(_0x1f2298){logger[_0x28d6('0x31')](_0x1f2298[_0x28d6('0x32')]);if(_0x1f2298['name']){delete _0x1f2298['name'];}_0x12f77e[_0x28d6('0x22')](_0x28aaa6)[_0x28d6('0x33')](_0x1f2298);};}function getInteractionUsers(_0x3f4dd1,_0x124404){return new BPromise(function(_0x324cff,_0x6b156e){try{if(_0x124404[_0x3f4dd1['id']]){_0x3f4dd1['Users']=_[_0x28d6('0x34')](_0x124404[_0x3f4dd1['id']],function(_0x5ccdc6){return{'id':_0x5ccdc6['id'],'fullname':_0x5ccdc6[_0x28d6('0x35')]};});}}catch(_0x502695){_0x6b156e(_0x502695);}_0x324cff(_0x3f4dd1);});}function getInteractionTags(_0x1fc791,_0x2594cb){return new BPromise(function(_0x398c05,_0x3fd81c){try{if(_0x1fc791[_0x28d6('0x36')]){_0x1fc791['Tags']=[];_0x1fc791['TagIds'][_0x28d6('0x37')](',')[_0x28d6('0x38')](function(_0x570ee2){_0x1fc791[_0x28d6('0x39')]['push'](_0x2594cb[_0x570ee2]);});}delete _0x1fc791[_0x28d6('0x36')];}catch(_0x5f3cdd){_0x3fd81c(_0x5f3cdd);}_0x398c05(_0x1fc791);});}function updateWhatsappInteraction(_0x3ffd45,_0x56a10f,_0x8cfe51){return new BPromise(function(_0x2b125c,_0x5557ac){return getInteractionUsers(_0x3ffd45,_0x8cfe51)[_0x28d6('0x2e')](function(_0x283cd6){return getInteractionTags(_0x283cd6,_0x56a10f);})[_0x28d6('0x2e')](function(_0x37031c){return getStateInteraction(_0x37031c);})['then'](function(_0x35961a){_0x2b125c(_0x35961a);})[_0x28d6('0x3a')](function(_0x2197a9){_0x5557ac(_0x2197a9);});});}function getStateInteraction(_0x2ae540){return new BPromise(function(_0x4f52e3){_0x2ae540[_0x28d6('0x3b')]=0x0;_0x2ae540[_0x28d6('0x3c')]=0x0;_0x2ae540[_0x28d6('0x3d')]=0x0;_0x2ae540[_0x28d6('0x3e')]=0x0;_0x2ae540['total']=0x0;if(!_0x2ae540[_0x28d6('0x3f')]&&!_0x2ae540[_0x28d6('0x40')]){_0x2ae540[_0x28d6('0x3b')]+=0x1;}if(!_0x2ae540[_0x28d6('0x3f')]&&_0x2ae540[_0x28d6('0x40')]){_0x2ae540[_0x28d6('0x3c')]+=0x1;if(_0x2ae540[_0x28d6('0x3b')]){_0x2ae540[_0x28d6('0x3b')]-=0x1;}}if(_0x2ae540[_0x28d6('0x3f')]&&_0x2ae540[_0x28d6('0x40')]){_0x2ae540[_0x28d6('0x3d')]+=0x1;if(_0x2ae540[_0x28d6('0x3c')]){_0x2ae540[_0x28d6('0x3c')]-=0x1;}}if(_0x2ae540[_0x28d6('0x3f')]&&!_0x2ae540[_0x28d6('0x40')]){_0x2ae540[_0x28d6('0x3e')]+=0x1;if(_0x2ae540['waiting']){_0x2ae540['waiting']-=0x1;}}_0x2ae540['total']+=0x1;_0x4f52e3(_0x2ae540);});}exports[_0x28d6('0x41')]=function(_0x4914d2,_0x4d1aab){var _0x293320={},_0x4ea383={},_0x213bf9={'count':0x0,'rows':[]};var _0x3f551a=_['map'](db[_0x28d6('0x42')][_0x28d6('0x43')],function(_0x26e711){return{'name':_0x26e711[_0x28d6('0x44')],'type':_0x26e711[_0x28d6('0x45')][_0x28d6('0x46')]};});_0x4ea383[_0x28d6('0x47')]=_[_0x28d6('0x34')](_0x3f551a,'name');_0x4ea383[_0x28d6('0x48')]=_[_0x28d6('0x49')](_0x4914d2['query']);_0x4ea383[_0x28d6('0x4a')]=_[_0x28d6('0x4b')](_0x4ea383[_0x28d6('0x47')],_0x4ea383['query']);_0x293320[_0x28d6('0x4c')]=_[_0x28d6('0x4b')](_0x4ea383[_0x28d6('0x47')],qs[_0x28d6('0x4d')](_0x4914d2['query'][_0x28d6('0x4d')]));_0x293320[_0x28d6('0x4c')]=_0x293320[_0x28d6('0x4c')]['length']?_0x293320[_0x28d6('0x4c')]:_0x4ea383[_0x28d6('0x47')];if(!_0x4914d2[_0x28d6('0x48')][_0x28d6('0x4e')]('nolimit')){_0x293320[_0x28d6('0x27')]=qs[_0x28d6('0x27')](_0x4914d2[_0x28d6('0x48')][_0x28d6('0x27')]);_0x293320[_0x28d6('0x25')]=qs['offset'](_0x4914d2[_0x28d6('0x48')][_0x28d6('0x25')]);}_0x293320[_0x28d6('0x4f')]=qs[_0x28d6('0x50')](_0x4914d2[_0x28d6('0x48')][_0x28d6('0x50')]);_0x293320[_0x28d6('0x51')]=qs[_0x28d6('0x4a')](_[_0x28d6('0x52')](_0x4914d2[_0x28d6('0x48')],_0x4ea383['filters']),_0x3f551a);var _0x4c8edb=[];var _0x261c01=squel['select']()['field']('id')['field'](_0x28d6('0x53'))['field'](_0x28d6('0x54'))['from'](_0x28d6('0x55'));var _0x3b7f2e=squel[_0x28d6('0x56')]()['field']('u.id')['field'](_0x28d6('0x57'))[_0x28d6('0x58')]('ui.WhatsappInteractionId')[_0x28d6('0x59')](_0x28d6('0x5a'),'ui')[_0x28d6('0x5b')](_0x28d6('0x5c'),'u',_0x28d6('0x5d'));var _0x20e8cb=squel[_0x28d6('0x56')]()[_0x28d6('0x59')]('whatsapp_interactions','i')[_0x28d6('0x5b')](_0x28d6('0x5e'),'c',_0x28d6('0x5f'))[_0x28d6('0x5b')](_0x28d6('0x5c'),'o',_0x28d6('0x60'))[_0x28d6('0x5b')]('whatsapp_accounts','a',_0x28d6('0x61'))['left_join'](_0x28d6('0x62'),'me',_0x28d6('0x63'))[_0x28d6('0x5b')](_0x28d6('0x64'),'it',_0x28d6('0x65'))[_0x28d6('0x5b')]('tools_tags','t',_0x28d6('0x66'));var _0x5794ae=squel[_0x28d6('0x67')]();var _0x538dad=[];var _0x1a3c39=squel[_0x28d6('0x67')]();var _0x25fdbc;if(_0x4914d2[_0x28d6('0x48')]['search']){_0x25fdbc=as[_0x28d6('0x68')](_0x4914d2[_0x28d6('0x48')][_0x28d6('0x69')]);var _0x3a9779=_0x25fdbc[_0x28d6('0x6a')];for(var _0x3ca520=0x0;_0x3ca520<_0x25fdbc[_0x28d6('0x6b')][_0x28d6('0x6c')];_0x3ca520++){var _0x164f53=_0x25fdbc[_0x28d6('0x6b')][_0x3ca520];var _0x267661='i';var _0x5b249c=_[_0x28d6('0x6d')](_0x3f551a,[_0x28d6('0x53'),_0x164f53[_0x28d6('0x58')]]);if(!_0x5b249c){switch(_0x164f53[_0x28d6('0x58')]){case _0x28d6('0x6e'):if(_0x164f53['value']==0x1){_0x20e8cb[_0x28d6('0x6f')]('`'+_0x164f53[_0x28d6('0x58')]+_0x28d6('0x70'));}else{_0x20e8cb[_0x28d6('0x6f')]('`'+_0x164f53[_0x28d6('0x58')]+'`\x20>\x200');}break;case _0x28d6('0x71'):if(_0x164f53[_0x28d6('0x72')]===_0x28d6('0x73')){if(_0x164f53[_0x28d6('0x74')]['split']('\x20')[_0x28d6('0x6c')]>0x1){_0x5794ae[_0x3a9779]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x28d6('0x75')](_0x164f53[_0x28d6('0x74')]),null);}else{var _0x351f8d='%'+_0x164f53['value']+'%';_0x5794ae[_0x3a9779](_0x28d6('0x76'),_0x351f8d,_0x351f8d,_0x351f8d);}}else{_0x5b249c=_[_0x28d6('0x6d')](_0x3f551a,[_0x28d6('0x53'),_0x28d6('0x77')]);_0x164f53[_0x28d6('0x58')]=_0x28d6('0x77');_0x2d34c0=as[_0x28d6('0x78')](_0x267661,_0x5b249c['type'],_0x164f53);_0x5794ae[_0x3a9779](_0x2d34c0[_0x28d6('0x79')],_0x2d34c0[_0x28d6('0x74')][_0x28d6('0x7a')],_0x2d34c0[_0x28d6('0x74')][_0x28d6('0x23')]);}break;case _0x28d6('0x7b'):var _0x32e762=_0x164f53[_0x28d6('0x74')][_0x28d6('0x37')](',')[_0x28d6('0x34')](function(_0x5d1441){return Number(_0x5d1441);});_0x32e762[_0x28d6('0x38')](function(_0xbe3e6){_0x1a3c39['or'](_0x28d6('0x7c'),'%,'+_0xbe3e6+',%');});_0x538dad=_[_0x28d6('0x7d')](_0x538dad,_0x32e762);break;case _0x28d6('0x7e'):if(_0x164f53['operator']===_0x28d6('0x73')){_0x5794ae[_0x3a9779](_0x28d6('0x7f'),'%'+_0x164f53[_0x28d6('0x74')]+'%',null);}else{_0x5b249c=_[_0x28d6('0x6d')](_0x3f551a,[_0x28d6('0x53'),_0x28d6('0x40')]);_0x164f53[_0x28d6('0x58')]='UserId';_0x2d34c0=as['buildExpression'](_0x267661,_0x5b249c[_0x28d6('0x45')],_0x164f53);_0x5794ae[_0x3a9779](_0x2d34c0[_0x28d6('0x79')],_0x2d34c0[_0x28d6('0x74')]['start'],_0x2d34c0[_0x28d6('0x74')]['end']);}break;case'body':_0x2d34c0=as[_0x28d6('0x78')]('me',null,_0x164f53);_0x5794ae[_0x3a9779](_0x2d34c0[_0x28d6('0x79')],_0x2d34c0[_0x28d6('0x74')][_0x28d6('0x7a')],_0x2d34c0[_0x28d6('0x74')][_0x28d6('0x23')]);break;}}else{var _0x2d34c0=as['buildExpression'](_0x267661,_0x5b249c['type'],_0x164f53);_0x5794ae[_0x3a9779](_0x2d34c0['text'],_0x2d34c0[_0x28d6('0x74')][_0x28d6('0x7a')],_0x2d34c0[_0x28d6('0x74')][_0x28d6('0x23')]);}}}else{var _0xc851a8=_(_0x4914d2[_0x28d6('0x48')])[_0x28d6('0x49')]()[_0x28d6('0x34')](function(_0x26a2f7){return _[_0x28d6('0x80')](_0x3f551a,['name',_0x26a2f7])?_0x26a2f7:undefined;})[_0x28d6('0x81')]()[_0x28d6('0x74')]();if(!_[_0x28d6('0x82')](_0xc851a8)){_0xc851a8[_0x28d6('0x38')](function(_0x223a03){if(_0x223a03===_0x28d6('0x83')){_0x20e8cb[_0x28d6('0x51')](_0x28d6('0x84'),[][_0x28d6('0x85')](_0x4914d2['query'][_0x223a03]));}else if(_0x223a03==='createdAt'){var _0xc03601=JSON[_0x28d6('0x86')](_0x4914d2[_0x28d6('0x48')][_0x223a03])['$gte'];var _0x376a7d=JSON[_0x28d6('0x86')](_0x4914d2[_0x28d6('0x48')][_0x223a03])[_0x28d6('0x87')];_0x20e8cb[_0x28d6('0x51')](_0x28d6('0x88'),_0xc03601,_0x376a7d);}else{if(_0x4914d2[_0x28d6('0x48')][_0x223a03]===_0x28d6('0x89')){_0x20e8cb[_0x28d6('0x51')]('i.'+_0x223a03+_0x28d6('0x8a'));}else{_0x20e8cb[_0x28d6('0x51')]('i.'+_0x223a03+_0x28d6('0x8b'),_0x4914d2[_0x28d6('0x48')][_0x223a03]);}}});}if(_0x4914d2[_0x28d6('0x48')][_0x28d6('0x8c')]){if(_0x4914d2['query'][_0x28d6('0x8c')]==0x1){_0x20e8cb[_0x28d6('0x6f')](_0x28d6('0x8d'));}else{_0x20e8cb[_0x28d6('0x6f')]('`unreadMessages`\x20>\x200');}}if(_0x4914d2[_0x28d6('0x48')]['tag']){_0x538dad=_[_0x28d6('0x8e')](_0x4914d2[_0x28d6('0x48')]['tag'])?_0x4914d2[_0x28d6('0x48')]['tag']:new Array(_0x4914d2[_0x28d6('0x48')][_0x28d6('0x8f')]);_0x538dad[_0x28d6('0x38')](function(_0x3fede2){_0x1a3c39['or'](_0x28d6('0x7c'),'%,'+_0x3fede2+',%');});}if(_0x4914d2[_0x28d6('0x48')]['filter']){var _0x12bbc3=_0x4914d2[_0x28d6('0x48')][_0x28d6('0x90')][_0x28d6('0x91')]('\x5c','\x5c\x5c')[_0x28d6('0x91')](/'/g,'\x27\x27');if(qs[_0x28d6('0x92')](_0x12bbc3)){_0x5794ae['or'](_0x28d6('0x93'),_0x12bbc3+'%')['or'](_0x28d6('0x94'),_0x12bbc3+'%');}else{_0x5794ae['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x28d6('0x75')](_0x12bbc3))['or'](_0x28d6('0x95'),_0x12bbc3+'%');}}}_0x20e8cb[_0x28d6('0x51')](_0x5794ae);_0x20e8cb['group'](_0x28d6('0x96'));var _0xc7bb3b={'type':db[_0x28d6('0x97')][_0x28d6('0x98')]['SELECT'],'raw':!![]};var _0x4fc89e=_0x20e8cb[_0x28d6('0x99')]();_0x4fc89e[_0x28d6('0x58')]('i.id');_0x4fc89e[_0x28d6('0x58')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x28d6('0x6e'));if(_0x293320[_0x28d6('0x4f')]){_0x293320[_0x28d6('0x4f')][_0x28d6('0x38')](function(_0x55f12c){var _0x47dc3e=_0x55f12c[0x0]===_0x28d6('0x9a')?_0x55f12c[0x0]:'i.'+_0x55f12c[0x0];_0x20e8cb['order'](_0x47dc3e,_0x55f12c[0x1]===_0x28d6('0x9b')?![]:!![]);});}if(!_['isEmpty'](_0x538dad)){_0x20e8cb[_0x28d6('0x6f')](_0x1a3c39);_0x4fc89e[_0x28d6('0x51')](_0x28d6('0x9c'),_0x538dad);}BPromise['resolve']()[_0x28d6('0x2e')](function(){if(!_0x25fdbc){if(_0x4914d2['query'][_0x28d6('0x83')])return;_0x4fc89e[_0x28d6('0x51')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x20e8cb[_0x28d6('0x51')](_0x28d6('0x9d'));return;}if(_0x4914d2[_0x28d6('0x9e')]['role']!==_0x28d6('0x9f'))return;return _0x4914d2['user'][_0x28d6('0xa0')]({'attributes':['id'],'raw':!![]})['then'](function(_0x384a6b){if(_['isEmpty'](_0x384a6b)){_0x4fc89e[_0x28d6('0x51')]('i.WhatsappAccountId\x20IS\x20NULL');_0x20e8cb[_0x28d6('0x51')](_0x28d6('0xa1'));}else{_0x4fc89e[_0x28d6('0x51')](_0x28d6('0x84'),_[_0x28d6('0x34')](_0x384a6b,'id'));_0x20e8cb['where'](_0x28d6('0x84'),_[_0x28d6('0x34')](_0x384a6b,'id'));}});})['then'](function(){if(_0x4914d2[_0x28d6('0x9e')]['role']===_0x28d6('0x9f')&&!_0x25fdbc&&!_0x4914d2[_0x28d6('0x48')]['WhatsappAccountId'])return[];return db[_0x28d6('0xa2')]['query'](_0x4fc89e[_0x28d6('0xa3')](),_0xc7bb3b);})[_0x28d6('0x2e')](function(_0x47730f){_0x213bf9['count']=_0x47730f[_0x28d6('0x6c')];if(_0x213bf9['count']===0x0)return[];return db[_0x28d6('0xa2')][_0x28d6('0x48')](_0x261c01['toString'](),_0xc7bb3b)[_0x28d6('0x2e')](function(_0x3972be){_0x4c8edb=_[_0x28d6('0xa4')](_0x3972be,'id');_0xc7bb3b=_[_0x28d6('0xa5')](_0xc7bb3b,{'model':db[_0x28d6('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4914d2['query'][_0x28d6('0x4d')]){_0x293320['attributes']['forEach'](function(_0xe42103){_0x20e8cb[_0x28d6('0x58')]('i.'+_0xe42103);});}else{_0x20e8cb[_0x28d6('0x58')](_0x28d6('0xa6'),_0x28d6('0x6e'));_0x20e8cb[_0x28d6('0x58')]('a.key',_0x28d6('0xa7'));_0x20e8cb[_0x28d6('0x58')]('a.mandatoryDisposition',_0x28d6('0xa8'));_0x20e8cb[_0x28d6('0x58')](_0x28d6('0xa9'),_0x28d6('0x9a'));_0x20e8cb['field'](_0x28d6('0xaa'));_0x20e8cb['field'](_0x28d6('0xab'),_0x28d6('0xac'));_0x20e8cb[_0x28d6('0x58')](_0x28d6('0xad'),'Contact.lastName');_0x20e8cb[_0x28d6('0x58')](_0x28d6('0xae'),_0x28d6('0xaf'));_0x20e8cb['field'](_0x28d6('0xb0'),_0x28d6('0xb1'));_0x20e8cb['field'](_0x28d6('0xb2'),_0x28d6('0xb3'));_0x20e8cb[_0x28d6('0x58')](_0x28d6('0xb4'),'Contact.fax');_0x20e8cb[_0x28d6('0x58')](_0x28d6('0xb5'),_0x28d6('0xb6'));_0x20e8cb[_0x28d6('0x58')](_0x28d6('0xb7'),'Owner.internal');_0x20e8cb[_0x28d6('0x58')](_0x28d6('0xb8'),'TagIds');}if(_0x293320[_0x28d6('0x27')])_0x20e8cb[_0x28d6('0x27')](_0x293320[_0x28d6('0x27')]);if(_0x293320[_0x28d6('0x25')])_0x20e8cb[_0x28d6('0x25')](_0x293320[_0x28d6('0x25')]);return db['sequelize']['query'](_0x20e8cb['toString'](),_0xc7bb3b);})[_0x28d6('0x2e')](function(_0x49a860){if(_0x49a860[_0x28d6('0x6c')]>0x0)_0x3b7f2e[_0x28d6('0x51')](_0x28d6('0xb9'),_[_0x28d6('0x34')](_0x49a860,'id'));return db['sequelize'][_0x28d6('0x48')](_0x3b7f2e[_0x28d6('0xa3')](),_0xc7bb3b)[_0x28d6('0x2e')](function(_0x3f6e05){var _0x39eb76=_[_0x28d6('0xba')](_0x3f6e05,_0x28d6('0xbb'));var _0x41c7c5=[];_0x49a860[_0x28d6('0x38')](function(_0x3cfb9b){_0x41c7c5[_0x28d6('0xbc')](updateWhatsappInteraction(_0x3cfb9b,_0x4c8edb,_0x39eb76));});return BPromise[_0x28d6('0xbd')](_0x41c7c5);});});})[_0x28d6('0x2e')](function(_0x329c8a){_0x213bf9['rows']=_0x329c8a;return _0x213bf9;})[_0x28d6('0x2e')](respondWithFilteredResult(_0x4d1aab,_0x293320))['catch'](handleError(_0x4d1aab,null));};exports[_0x28d6('0xbe')]=function(_0x10c7ea,_0x34437c){var _0x15c72d={'raw':![],'where':{'id':_0x10c7ea[_0x28d6('0xbf')]['id']}},_0x1dabc3={};_0x1dabc3[_0x28d6('0x47')]=_[_0x28d6('0x49')](db[_0x28d6('0x42')][_0x28d6('0x43')]);_0x1dabc3[_0x28d6('0x48')]=_[_0x28d6('0x49')](_0x10c7ea[_0x28d6('0x48')]);_0x1dabc3['filters']=_['intersection'](_0x1dabc3[_0x28d6('0x47')],_0x1dabc3['query']);_0x15c72d['attributes']=_[_0x28d6('0x4b')](_0x1dabc3[_0x28d6('0x47')],qs[_0x28d6('0x4d')](_0x10c7ea[_0x28d6('0x48')][_0x28d6('0x4d')]));_0x15c72d['attributes']=_0x15c72d['attributes'][_0x28d6('0x6c')]?_0x15c72d[_0x28d6('0x4c')]:_0x1dabc3[_0x28d6('0x47')];if(_0x10c7ea['query'][_0x28d6('0xc0')]){_0x15c72d[_0x28d6('0xc1')]=[{'all':!![]}];}_0x15c72d=_['merge']({},_0x15c72d,_0x10c7ea[_0x28d6('0xc2')]);return db[_0x28d6('0x42')]['find'](_0x15c72d)[_0x28d6('0x2e')](handleEntityNotFound(_0x34437c,null))[_0x28d6('0x2e')](respondWithResult(_0x34437c,null))[_0x28d6('0x3a')](handleError(_0x34437c,null));};exports['create']=function(_0x315fa1,_0xe65944){return db[_0x28d6('0x42')][_0x28d6('0xc3')](_0x315fa1['body'],{})[_0x28d6('0x2e')](respondWithResult(_0xe65944,0xc9))[_0x28d6('0x3a')](handleError(_0xe65944,null));};exports[_0x28d6('0x2d')]=function(_0x3d0d85,_0x21708d){if(_0x3d0d85[_0x28d6('0xc4')]['id']){delete _0x3d0d85['body']['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x3d0d85[_0x28d6('0xbf')]['id']}})[_0x28d6('0x2e')](handleEntityNotFound(_0x21708d,null))[_0x28d6('0x2e')](saveUpdates(_0x3d0d85['body'],null))[_0x28d6('0x2e')](respondWithResult(_0x21708d,null))[_0x28d6('0x3a')](handleError(_0x21708d,null));};exports[_0x28d6('0x2f')]=function(_0x37ee73,_0x434d06){return db[_0x28d6('0x42')][_0x28d6('0x6d')]({'where':{'id':_0x37ee73[_0x28d6('0xbf')]['id']}})[_0x28d6('0x2e')](handleEntityNotFound(_0x434d06,null))[_0x28d6('0x2e')](removeEntity(_0x434d06,null))['catch'](handleError(_0x434d06,null));};exports[_0x28d6('0xc5')]=function(_0x86c8ee,_0x591713){return db['WhatsappInteraction'][_0x28d6('0xc5')]()[_0x28d6('0x2e')](respondWithResult(_0x591713,null))[_0x28d6('0x3a')](handleError(_0x591713,null));};exports[_0x28d6('0xc6')]=function(_0x47162e,_0x4593bf,_0x2eb811){return db[_0x28d6('0xc7')][_0x28d6('0x6d')]({'where':{'id':_0x47162e[_0x28d6('0xbf')]['id']}})[_0x28d6('0x2e')](handleEntityNotFound(_0x4593bf,null))['then'](function(_0x3d1ed5){if(_0x3d1ed5){return _0x3d1ed5['addMessage'](_0x47162e[_0x28d6('0xc4')][_0x28d6('0xc8')],_[_0x28d6('0xc9')](_0x47162e[_0x28d6('0xc4')],[_0x28d6('0xc8'),'id'])||{});}})['then'](respondWithResult(_0x4593bf,null))[_0x28d6('0x3a')](handleError(_0x4593bf,null));};exports[_0x28d6('0xca')]=function(_0x2d5d93,_0x3d1351,_0x10aba3){var _0x5da8fb={'raw':![],'where':{}};var _0x1b099b={};var _0x442c12={'count':0x0,'rows':[]};return db[_0x28d6('0x42')][_0x28d6('0xcb')]({'where':{'id':_0x2d5d93['params']['id']}})[_0x28d6('0x2e')](handleEntityNotFound(_0x3d1351,null))[_0x28d6('0x2e')](function(_0x5d8db5){if(_0x5d8db5){_0x1b099b[_0x28d6('0x47')]=_[_0x28d6('0x49')](db[_0x28d6('0xc7')]['rawAttributes']);_0x1b099b[_0x28d6('0x48')]=_[_0x28d6('0x49')](_0x2d5d93[_0x28d6('0x48')]);_0x1b099b[_0x28d6('0x4a')]=_[_0x28d6('0x4b')](_0x1b099b[_0x28d6('0x47')],_0x1b099b[_0x28d6('0x48')]);_0x5da8fb[_0x28d6('0x4c')]=_[_0x28d6('0x4b')](_0x1b099b[_0x28d6('0x47')],qs['fields'](_0x2d5d93['query'][_0x28d6('0x4d')]));_0x5da8fb[_0x28d6('0x4c')]=_0x5da8fb[_0x28d6('0x4c')]['length']?_0x5da8fb[_0x28d6('0x4c')]:_0x1b099b[_0x28d6('0x47')];if(!_0x2d5d93[_0x28d6('0x48')][_0x28d6('0x4e')]('nolimit')){_0x5da8fb[_0x28d6('0x27')]=qs[_0x28d6('0x27')](_0x2d5d93[_0x28d6('0x48')][_0x28d6('0x27')]);_0x5da8fb[_0x28d6('0x25')]=qs[_0x28d6('0x25')](_0x2d5d93[_0x28d6('0x48')][_0x28d6('0x25')]);}_0x5da8fb['order']=qs[_0x28d6('0x50')](_0x2d5d93[_0x28d6('0x48')]['sort']);_0x5da8fb[_0x28d6('0x51')]=qs[_0x28d6('0x4a')](_[_0x28d6('0x52')](_0x2d5d93[_0x28d6('0x48')],_0x1b099b[_0x28d6('0x4a')]));_0x5da8fb[_0x28d6('0x51')][_0x28d6('0xbb')]=_0x5d8db5['id'];if(_0x2d5d93[_0x28d6('0x48')][_0x28d6('0x90')]){_0x5da8fb[_0x28d6('0x51')]=_[_0x28d6('0xa5')](_0x5da8fb[_0x28d6('0x51')],{'$or':_[_0x28d6('0x34')](_0x5da8fb['attributes'],function(_0x1f727a){var _0x1346a9={};_0x1346a9[_0x1f727a]={'$like':'%'+_0x2d5d93['query'][_0x28d6('0x90')]+'%'};return _0x1346a9;})});}if(_0x2d5d93[_0x28d6('0x48')][_0x28d6('0xcc')]){var _0x5d1b3b=_0x2d5d93['query']['$gte'][_0x28d6('0x37')](',');var _0x2bbd42={};_0x2bbd42[_0x5d1b3b[0x0]]={'$gte':moment(_0x5d1b3b[0x1])[_0x28d6('0xcd')](_0x28d6('0xce'))};_0x5da8fb[_0x28d6('0x51')]=_['merge'](_0x5da8fb[_0x28d6('0x51')],_0x2bbd42);}_0x5da8fb=_[_0x28d6('0xa5')]({},_0x5da8fb,_0x2d5d93[_0x28d6('0xc2')]);return db['WhatsappMessage'][_0x28d6('0x28')]({'where':_0x5da8fb[_0x28d6('0x51')]})[_0x28d6('0x2e')](function(_0x830bea){_0x442c12[_0x28d6('0x28')]=_0x830bea;if(_0x2d5d93['query'][_0x28d6('0xc0')]){_0x5da8fb[_0x28d6('0xc1')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x5da8fb);})['then'](function(_0x3179bd){_0x442c12['rows']=_0x3179bd;return _0x442c12;});}})[_0x28d6('0x2e')](respondWithFilteredResult(_0x3d1351,_0x5da8fb))[_0x28d6('0x3a')](handleError(_0x3d1351,null));};exports[_0x28d6('0xcf')]=function(_0x30980c,_0x537c51,_0xb4e004){return db['WhatsappInteraction'][_0x28d6('0x6d')]({'where':{'id':_0x30980c[_0x28d6('0xbf')]['id']}})[_0x28d6('0x2e')](handleEntityNotFound(_0x537c51,null))[_0x28d6('0x2e')](function(_0x10bd45){if(_0x10bd45){return _0x10bd45[_0x28d6('0xd0')](_0x30980c['body'][_0x28d6('0xc8')],_[_0x28d6('0xc9')](_0x30980c[_0x28d6('0xc4')],[_0x28d6('0xc8'),'id'])||{})['spread'](function(){return db[_0x28d6('0x7b')][_0x28d6('0xd1')]({'attributes':['id',_0x28d6('0x53'),_0x28d6('0x54')],'where':{'id':_0x30980c[_0x28d6('0xc4')][_0x28d6('0xc8')]}});})['then'](function(_0x257f4b){socket[_0x28d6('0xd2')](_0x28d6('0xd3'),{'id':Number(_0x30980c[_0x28d6('0xbf')]['id']),'tags':_0x257f4b||[]});return{'id':Number(_0x30980c[_0x28d6('0xbf')]['id']),'tags':_0x257f4b||[]};});}})[_0x28d6('0x2e')](respondWithResult(_0x537c51,null))[_0x28d6('0x3a')](handleError(_0x537c51,null));};exports[_0x28d6('0xd4')]=function(_0x1acbb1,_0x21a91d,_0x21bbeb){return db[_0x28d6('0x42')][_0x28d6('0x6d')]({'where':{'id':_0x1acbb1[_0x28d6('0xbf')]['id']}})[_0x28d6('0x2e')](handleEntityNotFound(_0x21a91d,null))[_0x28d6('0x2e')](function(_0xe571cd){if(_0xe571cd){return _0xe571cd[_0x28d6('0xd4')](_0x1acbb1[_0x28d6('0x48')][_0x28d6('0xc8')]);}})[_0x28d6('0x2e')](respondWithStatusCode(_0x21a91d,null))[_0x28d6('0x3a')](handleError(_0x21a91d,null));};exports['download']=function(_0x43ce60,_0x23a5fd){var _0x1558c9=moment()['unix']()[_0x28d6('0xa3')]();var _0x11b000=path[_0x28d6('0xd5')](config[_0x28d6('0xd6')],'server',_0x28d6('0xd7'),_0x28d6('0xd8'));var _0x1bf230=path[_0x28d6('0xd5')](config[_0x28d6('0xd6')],'server',_0x28d6('0xd7'),'attachments');var _0x212310=path['join'](_0x11b000,_0x1558c9);var _0x33b7a4=util[_0x28d6('0xcd')](_0x28d6('0xd9'),_0x43ce60[_0x28d6('0xbf')]['id'],_0x1558c9);var _0x8ce858=path[_0x28d6('0xd5')](_0x11b000,_0x33b7a4);var _0x58f3eb=[];_0x58f3eb['push']({'model':db['User'],'as':_0x28d6('0x7e'),'attributes':['id',_0x28d6('0x35')],'raw':!![]});_0x58f3eb[_0x28d6('0xbc')]({'model':db[_0x28d6('0xda')],'as':'Contact','attributes':['id',_0x28d6('0xdb'),_0x28d6('0xdc')],'raw':!![]});if(_0x43ce60[_0x28d6('0x48')][_0x28d6('0xdd')]){_0x58f3eb['push']({'model':db[_0x28d6('0xde')],'as':_0x28d6('0xde'),'raw':!![]});}var _0x17345c=[{'model':db['WhatsappMessage'],'as':_0x28d6('0xdf'),'attributes':['id',_0x28d6('0xc4'),_0x28d6('0xe0'),'direction',_0x28d6('0xe1'),_0x28d6('0x8c')],'include':_0x58f3eb}];_0x17345c[_0x28d6('0xbc')]({'model':db['WhatsappAccount'],'as':_0x28d6('0xe2'),'attributes':['id',_0x28d6('0x53')]});_0x17345c[_0x28d6('0xbc')]({'model':db['User'],'as':'Owner','attributes':['id',_0x28d6('0x35')]});return db['WhatsappInteraction'][_0x28d6('0x6d')]({'where':{'id':_0x43ce60[_0x28d6('0xbf')]['id']},'include':_0x17345c})[_0x28d6('0x2e')](handleEntityNotFound(_0x23a5fd,null))['then'](function(_0x455f17){if(_0x455f17){var _0x684c17=_0x455f17[_0x28d6('0xe3')]({'plain':!![]});fs[_0x28d6('0xe4')](_0x212310);var _0x40a31f={'channel':_0x28d6('0xe5'),'account':_0x684c17['Account']['name'],'agent':_0x684c17['Owner']?_0x684c17[_0x28d6('0xe6')]['fullname']:_0x28d6('0xe7'),'createdAt':moment(_0x684c17['createdAt'])[_0x28d6('0xcd')](_0x28d6('0xce'))['toString'](),'closedAt':_0x684c17[_0x28d6('0x3f')]?moment(_0x684c17['closedAt'])[_0x28d6('0xcd')](_0x28d6('0xce'))[_0x28d6('0xa3')]():'','disposition':_0x684c17[_0x28d6('0xe8')],'messages':_(_0x684c17[_0x28d6('0xdf')])[_0x28d6('0x90')]({'secret':![]})[_0x28d6('0x34')](function(_0x40243c){if(_0x40243c[_0x28d6('0xde')]){var _0x3ca387=path[_0x28d6('0xd5')](_0x1bf230,_0x40243c[_0x28d6('0xde')][_0x28d6('0xe9')]);if(fs['existsSync'](_0x3ca387)){fs[_0x28d6('0xea')](_0x3ca387)[_0x28d6('0xeb')](fs[_0x28d6('0xec')](path['join'](_0x212310,_0x40243c[_0x28d6('0xde')]['basename'])));}}return{'date':moment(_0x40243c[_0x28d6('0xe0')])['format'](_0x28d6('0xce'))[_0x28d6('0xa3')](),'sender':_0x40243c['direction']===_0x28d6('0xed')?_0x40243c[_0x28d6('0x7e')]?_0x40243c['User'][_0x28d6('0x35')]:_0x28d6('0xee'):_0x40243c[_0x28d6('0x71')][_0x28d6('0xdb')]+(_0x40243c[_0x28d6('0x71')][_0x28d6('0xdc')]?'\x20'+_0x40243c[_0x28d6('0x71')][_0x28d6('0xdc')]:''),'body':_0x40243c['Attachment']?_0x40243c['Attachment'][_0x28d6('0xe9')]:_0x40243c['body'],'direction':_0x40243c[_0x28d6('0xef')]===_0x28d6('0xed')?'A':'C','secret':_0x40243c['secret'],'read':_0x40243c[_0x28d6('0x8c')],'attachment':_0x40243c[_0x28d6('0xde')]};})[_0x28d6('0x74')]()};return ejs[_0x28d6('0xf0')](path[_0x28d6('0xd5')](config['root'],'server','views','downloadInteraction.ejs'),{'interaction':_0x40a31f})[_0x28d6('0x2e')](function(_0x1cc1da){var _0x2d3439=path['join'](_0x212310,_0x28d6('0xf1')+_0x684c17['id']+'-'+_0x1558c9+_0x28d6('0xf2'));var _0x1c5537={'path':_0x2d3439,'channel':_0x28d6('0xe5'),'interactionId':_0x684c17['id']};return pdf[_0x28d6('0xf3')](_0x1cc1da,_0x1c5537);})['then'](function(){return new BPromise(function(_0x2d5b8e,_0x4976ee){zipdir(_0x212310,{'saveTo':_0x8ce858},function(_0x3fcb14,_0x25a2df){if(_0x3fcb14)return _0x4976ee(_0x3fcb14);return _0x2d5b8e(_0x25a2df);});})[_0x28d6('0x2e')](function(){return new BPromise(function(_0x5e87b6,_0x37ce82){rimraf(_0x212310,function(_0x4965de){if(_0x4965de)_0x37ce82(_0x4965de);return _0x5e87b6();});});})[_0x28d6('0x2e')](function(){return _0x23a5fd[_0x28d6('0xf4')](_0x8ce858,_0x33b7a4,function(_0x3e27f1){if(_0x3e27f1){console[_0x28d6('0xf5')]('err',_0x3e27f1);}else{fs['unlinkSync'](_0x8ce858);}});});});}else{return _0x23a5fd[_0x28d6('0x30')](0xc8);}})['catch'](handleError(_0x23a5fd,null));};
\ No newline at end of file
index 2c78f27..f4ef574 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7dc2=['setDataValue','map','findAll','then','length','emit','hook','exports','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','getUsers'];(function(_0x3c5369,_0x4ae55a){var _0x875b06=function(_0x32eed1){while(--_0x32eed1){_0x3c5369['push'](_0x3c5369['shift']());}};_0x875b06(++_0x4ae55a);}(_0x7dc2,0x19d));var _0x27dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7dc2[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x27dc('0x0')];var WhatsappMessage=require(_0x27dc('0x1'))['db'][_0x27dc('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x27dc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x27dc('0x4'),'afterDestroy':_0x27dc('0x5')};function emitEvent(_0x52337b){return function(_0x1d16ae,_0x23bbbe,_0x5a442a){_0x1d16ae[_0x27dc('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x95bbb6){_0x1d16ae[_0x27dc('0x7')]('Users',_0x95bbb6[_0x27dc('0x8')](function(_0x1039b1){return{'id':_0x1039b1['id']};}));return WhatsappMessage[_0x27dc('0x9')]({'where':{'WhatsappInteractionId':_0x1d16ae['id'],'direction':'in','read':![]},'raw':!![]});})[_0x27dc('0xa')](function(_0x50e11b){_0x1d16ae[_0x27dc('0x7')]('unreadMessages',_0x50e11b[_0x27dc('0xb')]);WhatsappInteractionEvents[_0x27dc('0xc')](_0x52337b+':'+_0x1d16ae['id'],_0x1d16ae);WhatsappInteractionEvents[_0x27dc('0xc')](_0x52337b,_0x1d16ae);_0x5a442a(null);})['catch'](_0x5a442a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x27dc('0xd')](e,emitEvent(event));}}module[_0x27dc('0xe')]=WhatsappInteractionEvents;
\ No newline at end of file
+var _0x8369=['save','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners'];(function(_0x107c63,_0x3c8135){var _0x265f4d=function(_0x198c44){while(--_0x198c44){_0x107c63['push'](_0x107c63['shift']());}};_0x265f4d(++_0x3c8135);}(_0x8369,0x10b));var _0x9836=function(_0x47d684,_0x1fa08a){_0x47d684=_0x47d684-0x0;var _0x4232b2=_0x8369[_0x47d684];return _0x4232b2;};'use strict';var EventEmitter=require(_0x9836('0x0'));var WhatsappInteraction=require(_0x9836('0x1'))['db'][_0x9836('0x2')];var WhatsappMessage=require(_0x9836('0x1'))['db'][_0x9836('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9836('0x4')](0x0);var events={'afterCreate':_0x9836('0x5'),'afterUpdate':'update','afterDestroy':_0x9836('0x6')};function emitEvent(_0x5f08f9){return function(_0x188996,_0x3c5846,_0x4e937c){_0x188996[_0x9836('0x7')]({'attributes':['id'],'raw':!![]})[_0x9836('0x8')](function(_0x52ae78){_0x188996[_0x9836('0x9')](_0x9836('0xa'),_0x52ae78[_0x9836('0xb')](function(_0x2482d8){return{'id':_0x2482d8['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x188996['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9836('0x8')](function(_0x18b9de){_0x188996[_0x9836('0x9')](_0x9836('0xc'),_0x18b9de['length']);WhatsappInteractionEvents[_0x9836('0xd')](_0x5f08f9+':'+_0x188996['id'],_0x188996);WhatsappInteractionEvents[_0x9836('0xd')](_0x5f08f9,_0x188996);_0x4e937c(null);})[_0x9836('0xe')](_0x4e937c(null));};}for(var e in events){if(events[_0x9836('0xf')](e)){var event=events[e];WhatsappInteraction[_0x9836('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents;
\ No newline at end of file
index e397e0d..f7e130e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc403=['../../config/logger','api','moment','request-promise','rimraf','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x4834ae,_0x4fcda8){var _0x571f66=function(_0x44f9f2){while(--_0x44f9f2){_0x4834ae['push'](_0x4834ae['shift']());}};_0x571f66(++_0x4fcda8);}(_0xc403,0xc2));var _0x3c40=function(_0x10e25a,_0x4b7421){_0x10e25a=_0x10e25a-0x0;var _0x27444f=_0xc403[_0x10e25a];return _0x27444f;};'use strict';var _=require(_0x3c40('0x0'));var util=require('util');var logger=require(_0x3c40('0x1'))(_0x3c40('0x2'));var moment=require(_0x3c40('0x3'));var BPromise=require('bluebird');var rp=require(_0x3c40('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c40('0x5'));var config=require('../../config/environment');var attributes=require(_0x3c40('0x6'));module[_0x3c40('0x7')]=function(_0x485ca2,_0x372667){return _0x485ca2['define'](_0x3c40('0x8'),attributes,{'tableName':_0x3c40('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13b1b5,_0x29763f,_0x47441d){if(_0x13b1b5[_0x3c40('0xa')](_0x3c40('0xb'))){_0x13b1b5[_0x3c40('0xc')]=moment()[_0x3c40('0xd')](_0x3c40('0xe'));}_0x47441d(null,_0x13b1b5);}}});};
\ No newline at end of file
+var _0xbe96=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions'];(function(_0x2b3ab0,_0x2a8158){var _0x4dab13=function(_0x3fb787){while(--_0x3fb787){_0x2b3ab0['push'](_0x2b3ab0['shift']());}};_0x4dab13(++_0x2a8158);}(_0xbe96,0x19a));var _0x6be9=function(_0x346f1c,_0x406e5e){_0x346f1c=_0x346f1c-0x0;var _0x265c7e=_0xbe96[_0x346f1c];return _0x265c7e;};'use strict';var _=require(_0x6be9('0x0'));var util=require('util');var logger=require(_0x6be9('0x1'))('api');var moment=require(_0x6be9('0x2'));var BPromise=require(_0x6be9('0x3'));var rp=require(_0x6be9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6be9('0x5'));var config=require('../../config/environment');var attributes=require(_0x6be9('0x6'));module[_0x6be9('0x7')]=function(_0x14bd9a,_0x4bfa77){return _0x14bd9a['define'](_0x6be9('0x8'),attributes,{'tableName':_0x6be9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x39c9ba,_0x584644,_0x596a4a){if(_0x39c9ba[_0x6be9('0xa')](_0x6be9('0xb'))){_0x39c9ba[_0x6be9('0xc')]=moment()[_0x6be9('0xd')](_0x6be9('0xe'));}_0x596a4a(null,_0x39c9ba);}}});};
\ No newline at end of file
index df2725f..0d1bf82 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf957=['then','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','WhatsappInteraction','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body','options','raw','where','attributes','limit'];(function(_0x9ca449,_0x59aa11){var _0x4442e4=function(_0x493fb6){while(--_0x493fb6){_0x9ca449['push'](_0x9ca449['shift']());}};_0x4442e4(++_0x59aa11);}(_0xf957,0x1cb));var _0x7f95=function(_0x37c892,_0x2d8c82){_0x37c892=_0x37c892-0x0;var _0x353fb4=_0xf957[_0x37c892];return _0x353fb4;};'use strict';var _=require('lodash');var util=require(_0x7f95('0x0'));var moment=require(_0x7f95('0x1'));var BPromise=require(_0x7f95('0x2'));var rs=require(_0x7f95('0x3'));var fs=require('fs');var Redis=require(_0x7f95('0x4'));var db=require(_0x7f95('0x5'))['db'];var utils=require(_0x7f95('0x6'));var logger=require(_0x7f95('0x7'))(_0x7f95('0x8'));var config=require(_0x7f95('0x9'));var jayson=require(_0x7f95('0xa'));var client=jayson[_0x7f95('0xb')][_0x7f95('0xc')]({'port':0x232a});config[_0x7f95('0xd')]=_[_0x7f95('0xe')](config[_0x7f95('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f95('0xf'))(new Redis(config[_0x7f95('0xd')]));require(_0x7f95('0x10'))[_0x7f95('0x11')](socket);function respondWithRpcPromise(_0x10ddf9,_0x2f6281,_0x2a8293){return new BPromise(function(_0x51aa9b,_0x419299){return client[_0x7f95('0x12')](_0x10ddf9,_0x2a8293)['then'](function(_0x44f9b6){logger[_0x7f95('0x13')](_0x7f95('0x14'),_0x2f6281,_0x7f95('0x15'));logger[_0x7f95('0x16')](_0x7f95('0x17'),_0x2f6281,'request\x20sent',JSON[_0x7f95('0x18')](_0x44f9b6));if(_0x44f9b6[_0x7f95('0x19')]){if(_0x44f9b6[_0x7f95('0x19')][_0x7f95('0x1a')]===0x1f4){logger[_0x7f95('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x2f6281,_0x44f9b6[_0x7f95('0x19')][_0x7f95('0x1b')]);return _0x419299(_0x44f9b6['error'][_0x7f95('0x1b')]);}logger[_0x7f95('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x2f6281,_0x44f9b6[_0x7f95('0x19')][_0x7f95('0x1b')]);return _0x51aa9b(_0x44f9b6[_0x7f95('0x19')][_0x7f95('0x1b')]);}else{logger['info'](_0x7f95('0x14'),_0x2f6281,_0x7f95('0x15'));_0x51aa9b(_0x44f9b6[_0x7f95('0x1c')]['message']);}})[_0x7f95('0x1d')](function(_0x1462b2){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x2f6281,_0x1462b2);_0x419299(_0x1462b2);});});}exports['UpdateWhatsappInteraction']=function(_0x353b06){var _0x31ffe0=this;return new Promise(function(_0x136268,_0x9b3c15){return db['WhatsappInteraction']['update'](_0x353b06[_0x7f95('0x1e')],{'raw':_0x353b06[_0x7f95('0x1f')]?_0x353b06[_0x7f95('0x1f')][_0x7f95('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x353b06[_0x7f95('0x1f')]?_0x353b06['options'][_0x7f95('0x21')]||null:null,'attributes':_0x353b06[_0x7f95('0x1f')]?_0x353b06[_0x7f95('0x1f')][_0x7f95('0x22')]||null:null,'limit':_0x353b06[_0x7f95('0x1f')]?_0x353b06[_0x7f95('0x1f')][_0x7f95('0x23')]||null:null})[_0x7f95('0x24')](function(_0x54bdd8){logger[_0x7f95('0x13')](_0x7f95('0x25'),_0x353b06);logger[_0x7f95('0x16')](_0x7f95('0x25'),_0x353b06,JSON[_0x7f95('0x18')](_0x54bdd8));_0x136268(_0x54bdd8);})[_0x7f95('0x1d')](function(_0x5a90a4){logger[_0x7f95('0x19')](_0x7f95('0x25'),_0x5a90a4[_0x7f95('0x1b')],_0x353b06);_0x9b3c15(_0x31ffe0[_0x7f95('0x19')](0x1f4,_0x5a90a4['message']));});});};exports[_0x7f95('0x26')]=function(_0x2b3c46){return new Promise(function(_0x4cef81,_0x5df704){return db[_0x7f95('0x27')]['find']({'where':_0x2b3c46[_0x7f95('0x1f')]?_0x2b3c46['options']['where']||null:null})['then'](function(_0x2035a0){if(_0x2035a0){return _0x2035a0[_0x7f95('0x28')](_0x2b3c46[_0x7f95('0x1e')][_0x7f95('0x29')],_[_0x7f95('0x2a')](_0x2b3c46[_0x7f95('0x1e')],[_0x7f95('0x29'),'id'])||{});}})[_0x7f95('0x2b')](function(_0x355c9f){logger[_0x7f95('0x13')]('AddTags',_0x2b3c46);logger[_0x7f95('0x16')](_0x7f95('0x2c'),_0x2b3c46,JSON[_0x7f95('0x18')](_0x355c9f));_0x4cef81(_0x355c9f);})[_0x7f95('0x1d')](function(_0x4e3073){logger[_0x7f95('0x19')]('AddTags',_0x4e3073[_0x7f95('0x1b')],_0x2b3c46);_0x5df704(_this[_0x7f95('0x19')](0x1f4,_0x4e3073[_0x7f95('0x1b')]));});});};
\ No newline at end of file
+var _0x9465=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','attributes','limit','AddTagsToWhatsappInteraction','find','where','ids','omit','spread','AddTags','lodash','util'];(function(_0x3911c5,_0x439f70){var _0x15513e=function(_0x59282a){while(--_0x59282a){_0x3911c5['push'](_0x3911c5['shift']());}};_0x15513e(++_0x439f70);}(_0x9465,0x106));var _0x5946=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0x9465[_0x38c632];return _0x12737e;};'use strict';var _=require(_0x5946('0x0'));var util=require(_0x5946('0x1'));var moment=require(_0x5946('0x2'));var BPromise=require('bluebird');var rs=require(_0x5946('0x3'));var fs=require('fs');var Redis=require(_0x5946('0x4'));var db=require(_0x5946('0x5'))['db'];var utils=require(_0x5946('0x6'));var logger=require(_0x5946('0x7'))(_0x5946('0x8'));var config=require(_0x5946('0x9'));var jayson=require(_0x5946('0xa'));var client=jayson[_0x5946('0xb')][_0x5946('0xc')]({'port':0x232a});config[_0x5946('0xd')]=_[_0x5946('0xe')](config[_0x5946('0xd')],{'host':_0x5946('0xf'),'port':0x18eb});var socket=require(_0x5946('0x10'))(new Redis(config[_0x5946('0xd')]));require(_0x5946('0x11'))[_0x5946('0x12')](socket);function respondWithRpcPromise(_0x45052e,_0x2f0163,_0x5a9024){return new BPromise(function(_0x1c4a04,_0x24165d){return client['request'](_0x45052e,_0x5a9024)[_0x5946('0x13')](function(_0x34455e){logger['info'](_0x5946('0x14'),_0x2f0163,_0x5946('0x15'));logger[_0x5946('0x16')](_0x5946('0x17'),_0x2f0163,_0x5946('0x15'),JSON[_0x5946('0x18')](_0x34455e));if(_0x34455e[_0x5946('0x19')]){if(_0x34455e[_0x5946('0x19')]['code']===0x1f4){logger[_0x5946('0x19')](_0x5946('0x14'),_0x2f0163,_0x34455e[_0x5946('0x19')][_0x5946('0x1a')]);return _0x24165d(_0x34455e[_0x5946('0x19')]['message']);}logger[_0x5946('0x19')](_0x5946('0x14'),_0x2f0163,_0x34455e[_0x5946('0x19')]['message']);return _0x1c4a04(_0x34455e[_0x5946('0x19')][_0x5946('0x1a')]);}else{logger[_0x5946('0x1b')]('WhatsappInteraction,\x20%s,\x20%s',_0x2f0163,'request\x20sent');_0x1c4a04(_0x34455e['result'][_0x5946('0x1a')]);}})[_0x5946('0x1c')](function(_0x1809a9){logger[_0x5946('0x19')](_0x5946('0x14'),_0x2f0163,_0x1809a9);_0x24165d(_0x1809a9);});});}exports[_0x5946('0x1d')]=function(_0x42ac20){var _0x16dcba=this;return new Promise(function(_0x113693,_0x69b7c4){return db[_0x5946('0x1e')][_0x5946('0x1f')](_0x42ac20[_0x5946('0x20')],{'raw':_0x42ac20['options']?_0x42ac20[_0x5946('0x21')][_0x5946('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42ac20['options']?_0x42ac20[_0x5946('0x21')]['where']||null:null,'attributes':_0x42ac20[_0x5946('0x21')]?_0x42ac20['options'][_0x5946('0x23')]||null:null,'limit':_0x42ac20[_0x5946('0x21')]?_0x42ac20[_0x5946('0x21')][_0x5946('0x24')]||null:null})[_0x5946('0x13')](function(_0xefc17e){logger[_0x5946('0x1b')](_0x5946('0x1d'),_0x42ac20);logger['debug'](_0x5946('0x1d'),_0x42ac20,JSON['stringify'](_0xefc17e));_0x113693(_0xefc17e);})['catch'](function(_0x510256){logger[_0x5946('0x19')](_0x5946('0x1d'),_0x510256[_0x5946('0x1a')],_0x42ac20);_0x69b7c4(_0x16dcba[_0x5946('0x19')](0x1f4,_0x510256[_0x5946('0x1a')]));});});};exports[_0x5946('0x25')]=function(_0x4e28e8){return new Promise(function(_0x2bb4e1,_0x4e343f){return db[_0x5946('0x1e')][_0x5946('0x26')]({'where':_0x4e28e8[_0x5946('0x21')]?_0x4e28e8[_0x5946('0x21')][_0x5946('0x27')]||null:null})[_0x5946('0x13')](function(_0x2f09cd){if(_0x2f09cd){return _0x2f09cd['addTags'](_0x4e28e8[_0x5946('0x20')][_0x5946('0x28')],_[_0x5946('0x29')](_0x4e28e8['body'],['ids','id'])||{});}})[_0x5946('0x2a')](function(_0x20b229){logger[_0x5946('0x1b')]('AddTags',_0x4e28e8);logger[_0x5946('0x16')](_0x5946('0x2b'),_0x4e28e8,JSON[_0x5946('0x18')](_0x20b229));_0x2bb4e1(_0x20b229);})[_0x5946('0x1c')](function(_0x322c1d){logger[_0x5946('0x19')](_0x5946('0x2b'),_0x322c1d[_0x5946('0x1a')],_0x4e28e8);_0x4e343f(_this[_0x5946('0x19')](0x1f4,_0x322c1d['message']));});});};
\ No newline at end of file
index 6880c8d..bc4c503 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa217=['emit','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0xea343d,_0x311197){var _0x2c6e9c=function(_0x454bd6){while(--_0x454bd6){_0xea343d['push'](_0xea343d['shift']());}};_0x2c6e9c(++_0x311197);}(_0xa217,0x9c));var _0x7a21=function(_0x102123,_0x5c1a48){_0x102123=_0x102123-0x0;var _0x151fee=_0xa217[_0x102123];return _0x151fee;};'use strict';var WhatsappInteractionEvents=require(_0x7a21('0x0'));var events=[_0x7a21('0x1'),_0x7a21('0x2'),_0x7a21('0x3')];function createListener(_0x30a74f,_0xfea6a3){return function(_0x4cfc13){_0xfea6a3[_0x7a21('0x4')](_0x30a74f,_0x4cfc13);};}function removeListener(_0x2d0a06,_0x3696df){return function(){WhatsappInteractionEvents['removeListener'](_0x2d0a06,_0x3696df);};}exports[_0x7a21('0x5')]=function(_0x11c21f){for(var _0x5840d9=0x0,_0x59b96c=events[_0x7a21('0x6')];_0x5840d9<_0x59b96c;_0x5840d9++){var _0x441b8f=events[_0x5840d9];var _0x466389=createListener(_0x7a21('0x7')+_0x441b8f,_0x11c21f);WhatsappInteractionEvents['on'](_0x441b8f,_0x466389);}};
\ No newline at end of file
+var _0x8a0f=['./whatsappInteraction.events','save','remove','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0x8a0f,0x1f0));var _0xf8a0=function(_0x5ee0d8,_0x127386){_0x5ee0d8=_0x5ee0d8-0x0;var _0x14992b=_0x8a0f[_0x5ee0d8];return _0x14992b;};'use strict';var WhatsappInteractionEvents=require(_0xf8a0('0x0'));var events=[_0xf8a0('0x1'),_0xf8a0('0x2'),'update'];function createListener(_0xc3cbf6,_0x3f38d2){return function(_0x260c19){_0x3f38d2[_0xf8a0('0x3')](_0xc3cbf6,_0x260c19);};}function removeListener(_0x4fee4,_0x3086f8){return function(){WhatsappInteractionEvents[_0xf8a0('0x4')](_0x4fee4,_0x3086f8);};}exports[_0xf8a0('0x5')]=function(_0x35c594){for(var _0x44ddb4=0x0,_0x42b156=events[_0xf8a0('0x6')];_0x44ddb4<_0x42b156;_0x44ddb4++){var _0x3e19dc=events[_0x44ddb4];var _0x39a7d6=createListener(_0xf8a0('0x7')+_0x3e19dc,_0x35c594);WhatsappInteractionEvents['on'](_0x3e19dc,_0x39a7d6);}};
\ No newline at end of file
index bec8305..8898078 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x688b=['./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x189091,_0x5e5342){var _0x72a4a6=function(_0x553b14){while(--_0x553b14){_0x189091['push'](_0x189091['shift']());}};_0x72a4a6(++_0x5e5342);}(_0x688b,0xe0));var _0xb688=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0x688b[_0x39f34f];return _0x59fee1;};'use strict';var multer=require(_0xb688('0x0'));var util=require(_0xb688('0x1'));var path=require(_0xb688('0x2'));var timeout=require(_0xb688('0x3'));var express=require(_0xb688('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb688('0x5'));var interaction=require(_0xb688('0x6'));var config=require(_0xb688('0x7'));var controller=require(_0xb688('0x8'));router[_0xb688('0x9')]('/',auth[_0xb688('0xa')](),controller[_0xb688('0xb')]);router[_0xb688('0x9')]('/describe',auth[_0xb688('0xa')](),controller[_0xb688('0xc')]);router[_0xb688('0x9')](_0xb688('0xd'),auth['isAuthenticated'](),controller[_0xb688('0xe')]);router[_0xb688('0xf')]('/',auth[_0xb688('0xa')](),interaction[_0xb688('0x10')](_0xb688('0x11'),_0xb688('0x12')),controller[_0xb688('0x13')]);router[_0xb688('0xf')](_0xb688('0x14'),controller[_0xb688('0x15')]);router[_0xb688('0x16')]('/:id',auth[_0xb688('0xa')](),controller['update']);router[_0xb688('0x16')]('/:id/accept',auth['isAuthenticated'](),controller[_0xb688('0x17')]);router['put'](_0xb688('0x18'),auth[_0xb688('0xa')](),controller[_0xb688('0x19')]);router[_0xb688('0x1a')](_0xb688('0xd'),auth[_0xb688('0xa')](),controller[_0xb688('0x1b')]);module[_0xb688('0x1c')]=router;
\ No newline at end of file
+var _0x118f=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','index','isAuthenticated','describe','show','post','whatsapp','whatsappmessage:create','create','put','/:id','update'];(function(_0x2a05bf,_0x55e3a4){var _0x38a62e=function(_0x28d868){while(--_0x28d868){_0x2a05bf['push'](_0x2a05bf['shift']());}};_0x38a62e(++_0x55e3a4);}(_0x118f,0x13b));var _0xf118=function(_0x2a036a,_0x2cbbdf){_0x2a036a=_0x2a036a-0x0;var _0xee0b06=_0x118f[_0x2a036a];return _0xee0b06;};'use strict';var multer=require(_0xf118('0x0'));var util=require(_0xf118('0x1'));var path=require(_0xf118('0x2'));var timeout=require('connect-timeout');var express=require(_0xf118('0x3'));var router=express[_0xf118('0x4')]();var fs_extra=require(_0xf118('0x5'));var auth=require(_0xf118('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf118('0x7'));var controller=require(_0xf118('0x8'));router[_0xf118('0x9')]('/',auth['isAuthenticated'](),controller[_0xf118('0xa')]);router[_0xf118('0x9')]('/describe',auth[_0xf118('0xb')](),controller[_0xf118('0xc')]);router[_0xf118('0x9')]('/:id',auth[_0xf118('0xb')](),controller[_0xf118('0xd')]);router[_0xf118('0xe')]('/',auth[_0xf118('0xb')](),interaction['tracked'](_0xf118('0xf'),_0xf118('0x10')),controller[_0xf118('0x11')]);router['post']('/:id/status',controller['status']);router[_0xf118('0x12')](_0xf118('0x13'),auth[_0xf118('0xb')](),controller[_0xf118('0x14')]);router['put'](_0xf118('0x15'),auth[_0xf118('0xb')](),controller[_0xf118('0x16')]);router[_0xf118('0x12')](_0xf118('0x17'),auth[_0xf118('0xb')](),controller[_0xf118('0x18')]);router[_0xf118('0x19')](_0xf118('0x13'),auth['isAuthenticated'](),controller[_0xf118('0x1a')]);module[_0xf118('0x1b')]=router;
\ No newline at end of file
index ef1a586..22217c1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaf40=['BOOLEAN','ENUM','out','STRING','DATE','exports','TEXT','medium'];(function(_0x183923,_0x329f79){var _0xa598b7=function(_0x5bf669){while(--_0x5bf669){_0x183923['push'](_0x183923['shift']());}};_0xa598b7(++_0x329f79);}(_0xaf40,0x75));var _0x0af4=function(_0x338e2f,_0x247ce2){_0x338e2f=_0x338e2f-0x0;var _0x1994d7=_0xaf40[_0x338e2f];return _0x1994d7;};'use strict';var Sequelize=require('sequelize');module[_0x0af4('0x0')]={'body':{'type':Sequelize[_0x0af4('0x1')](_0x0af4('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0af4('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0af4('0x4')]('in',_0x0af4('0x5')),'defaultValue':_0x0af4('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0af4('0x6')](0xbe)},'phone':{'type':Sequelize[_0x0af4('0x6')]},'readAt':{'type':Sequelize[_0x0af4('0x7')]},'secret':{'type':Sequelize[_0x0af4('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0af4('0x6')]},'providerResponse':{'type':Sequelize[_0x0af4('0x1')]}};
\ No newline at end of file
+var _0x52f6=['exports','BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x52f6,0x11f));var _0x652f=function(_0x4df49a,_0x3cfd47){_0x4df49a=_0x4df49a-0x0;var _0x5d48c0=_0x52f6[_0x4df49a];return _0x5d48c0;};'use strict';var Sequelize=require(_0x652f('0x0'));module[_0x652f('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x652f('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x652f('0x3')]('in',_0x652f('0x4')),'defaultValue':_0x652f('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x652f('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x652f('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x652f('0x5')]},'providerResponse':{'type':Sequelize[_0x652f('0x7')]}};
\ No newline at end of file
index 804042f..25f54c7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x83a2=['length','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','include','find','create','body','params','describe','whatsapp-interactions','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','update','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','agent','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','User','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','destroy','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x1cfc9e,_0x1eee4b){var _0x3d7d69=function(_0x1e3589){while(--_0x1e3589){_0x1cfc9e['push'](_0x1cfc9e['shift']());}};_0x3d7d69(++_0x1eee4b);}(_0x83a2,0xcf));var _0x283a=function(_0x5dc8d1,_0x26e8ad){_0x5dc8d1=_0x5dc8d1-0x0;var _0x116062=_0x83a2[_0x5dc8d1];return _0x116062;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x283a('0x0'));var zipdir=require(_0x283a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x283a('0x2'));var moment=require(_0x283a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x283a('0x4'));var util=require('util');var path=require(_0x283a('0x5'));var sox=require(_0x283a('0x6'));var csv=require(_0x283a('0x7'));var ejs=require(_0x283a('0x8'));var fs=require('fs');var fs_extra=require(_0x283a('0x9'));var _=require(_0x283a('0xa'));var squel=require(_0x283a('0xb'));var crypto=require(_0x283a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x283a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x283a('0xe'));var Redis=require(_0x283a('0xf'));var authService=require(_0x283a('0x10'));var qs=require(_0x283a('0x11'));var as=require(_0x283a('0x12'));var hardwareService=require(_0x283a('0x13'));var logger=require(_0x283a('0x14'))('api');var utils=require(_0x283a('0x15'));var config=require(_0x283a('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x283a('0x17')](config[_0x283a('0x18')],{'host':_0x283a('0x19'),'port':0x18eb});var socket=require(_0x283a('0x1a'))(new Redis(config[_0x283a('0x18')]));require('./whatsappMessage.socket')[_0x283a('0x1b')](socket);var jayson=require(_0x283a('0x1c'));var client=jayson[_0x283a('0x1d')][_0x283a('0x1e')]({'port':0x232c});var client9002=jayson[_0x283a('0x1d')][_0x283a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3562ef,_0x20752b,_0x42cd2b,_0x54374b){return new BPromise(function(_0x76f105,_0x11ae07){var _0x3f42eb=_0x54374b||client;return _0x3f42eb[_0x283a('0x1f')](_0x3562ef,_0x42cd2b)[_0x283a('0x20')](function(_0x4b46b2){logger[_0x283a('0x21')](_0x283a('0x22'),_0x20752b,_0x283a('0x23'));logger[_0x283a('0x24')](_0x283a('0x25'),_0x20752b,_0x283a('0x23'),JSON[_0x283a('0x26')](_0x4b46b2));if(_0x4b46b2[_0x283a('0x27')]){if(_0x4b46b2[_0x283a('0x27')][_0x283a('0x28')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x20752b,_0x4b46b2[_0x283a('0x27')][_0x283a('0x29')]);return _0x11ae07(_0x4b46b2[_0x283a('0x27')]['message']);}logger[_0x283a('0x27')](_0x283a('0x22'),_0x20752b,_0x4b46b2[_0x283a('0x27')][_0x283a('0x29')]);return _0x76f105(_0x4b46b2[_0x283a('0x27')][_0x283a('0x29')]);}else{logger[_0x283a('0x21')](_0x283a('0x22'),_0x20752b,_0x283a('0x23'));_0x76f105(_0x4b46b2[_0x283a('0x2a')][_0x283a('0x29')]);}})[_0x283a('0x2b')](function(_0x527080){logger[_0x283a('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x20752b,_0x527080);_0x11ae07(_0x527080);});});}function respondWithStatusCode(_0x2c698c,_0x4032c0){_0x4032c0=_0x4032c0||0xcc;return function(_0x5efbf5){if(_0x5efbf5){return _0x2c698c[_0x283a('0x2c')](_0x4032c0);}return _0x2c698c[_0x283a('0x2d')](_0x4032c0)[_0x283a('0x2e')]();};}function respondWithResult(_0x19e6cd,_0x54defd){_0x54defd=_0x54defd||0xc8;return function(_0x39c80c){if(_0x39c80c){return _0x19e6cd[_0x283a('0x2d')](_0x54defd)['json'](_0x39c80c);}};}function respondWithFilteredResult(_0x5b3b98,_0x4cb103){return function(_0x374051){if(_0x374051){var _0x339a0d=typeof _0x4cb103[_0x283a('0x2f')]===_0x283a('0x30')&&typeof _0x4cb103[_0x283a('0x31')]==='undefined';var _0x393452=_0x374051['count'];var _0x5087a1=_0x339a0d?0x0:_0x4cb103[_0x283a('0x2f')];var _0xdd4e2f=_0x339a0d?_0x374051[_0x283a('0x32')]:_0x4cb103['offset']+_0x4cb103[_0x283a('0x31')];var _0x2e08d5;if(_0xdd4e2f>=_0x393452){_0xdd4e2f=_0x393452;_0x2e08d5=0xc8;}else{_0x2e08d5=0xce;}_0x5b3b98[_0x283a('0x2d')](_0x2e08d5);return _0x5b3b98['set'](_0x283a('0x33'),_0x5087a1+'-'+_0xdd4e2f+'/'+_0x393452)[_0x283a('0x34')](_0x374051);}return null;};}function patchUpdates(_0x2936f4){return function(_0x4b37d3){try{jsonpatch['apply'](_0x4b37d3,_0x2936f4,!![]);}catch(_0x4adde5){return BPromise[_0x283a('0x35')](_0x4adde5);}return _0x4b37d3[_0x283a('0x36')]();};}function saveUpdates(_0x6432fa,_0x506628){return function(_0x47340c){if(_0x47340c){return _0x47340c['update'](_0x6432fa)[_0x283a('0x20')](function(_0xcba2dc){return _0xcba2dc;});}return null;};}function removeEntity(_0x3df4a9,_0x1d5788){return function(_0x34790d){if(_0x34790d){return _0x34790d[_0x283a('0x37')]()[_0x283a('0x20')](function(){_0x3df4a9[_0x283a('0x2d')](0xcc)[_0x283a('0x2e')]();});}};}function handleEntityNotFound(_0x4c609c,_0x9c9ade){return function(_0x863198){if(!_0x863198){_0x4c609c[_0x283a('0x2c')](0x194);}return _0x863198;};}function handleError(_0x3571ce,_0x505785){_0x505785=_0x505785||0x1f4;return function(_0x5b1d96){logger[_0x283a('0x27')](_0x5b1d96[_0x283a('0x38')]);if(_0x5b1d96[_0x283a('0x39')]){delete _0x5b1d96[_0x283a('0x39')];}_0x3571ce[_0x283a('0x2d')](_0x505785)[_0x283a('0x3a')](_0x5b1d96);};}exports['index']=function(_0x1f96ab,_0x513e3a){var _0x5847ee={},_0x227a38={},_0xc77e86={'count':0x0,'rows':[]};var _0x167c21=_[_0x283a('0x3b')](db[_0x283a('0x3c')][_0x283a('0x3d')],function(_0x31168f){return{'name':_0x31168f[_0x283a('0x3e')],'type':_0x31168f[_0x283a('0x3f')][_0x283a('0x40')]};});_0x227a38[_0x283a('0x41')]=_[_0x283a('0x3b')](_0x167c21,_0x283a('0x39'));_0x227a38[_0x283a('0x42')]=_[_0x283a('0x43')](_0x1f96ab['query']);_0x227a38['filters']=_[_0x283a('0x44')](_0x227a38[_0x283a('0x41')],_0x227a38[_0x283a('0x42')]);_0x5847ee[_0x283a('0x45')]=_[_0x283a('0x44')](_0x227a38[_0x283a('0x41')],qs[_0x283a('0x46')](_0x1f96ab[_0x283a('0x42')][_0x283a('0x46')]));_0x5847ee[_0x283a('0x45')]=_0x5847ee['attributes'][_0x283a('0x47')]?_0x5847ee[_0x283a('0x45')]:_0x227a38[_0x283a('0x41')];if(!_0x1f96ab[_0x283a('0x42')]['hasOwnProperty'](_0x283a('0x48'))){_0x5847ee[_0x283a('0x31')]=qs[_0x283a('0x31')](_0x1f96ab[_0x283a('0x42')][_0x283a('0x31')]);_0x5847ee['offset']=qs[_0x283a('0x2f')](_0x1f96ab[_0x283a('0x42')][_0x283a('0x2f')]);}_0x5847ee['order']=qs[_0x283a('0x49')](_0x1f96ab[_0x283a('0x42')]['sort']);_0x5847ee['where']=qs[_0x283a('0x4a')](_[_0x283a('0x4b')](_0x1f96ab[_0x283a('0x42')],_0x227a38[_0x283a('0x4a')]),_0x167c21);if(_0x1f96ab['query'][_0x283a('0x4c')]){_0x5847ee[_0x283a('0x4d')]=_[_0x283a('0x4e')](_0x5847ee[_0x283a('0x4d')],{'$or':_[_0x283a('0x3b')](_0x167c21,function(_0xc8e88e){if(_0xc8e88e['type']!==_0x283a('0x4f')){var _0x476fae={};_0x476fae[_0xc8e88e[_0x283a('0x39')]]={'$like':'%'+_0x1f96ab[_0x283a('0x42')][_0x283a('0x4c')]+'%'};return _0x476fae;}})});}_0x5847ee=_['merge']({},_0x5847ee,_0x1f96ab[_0x283a('0x50')]);var _0x1ee469={'where':_0x5847ee[_0x283a('0x4d')]};return db[_0x283a('0x3c')][_0x283a('0x32')](_0x1ee469)[_0x283a('0x20')](function(_0x1e4b54){_0xc77e86['count']=_0x1e4b54;if(_0x1f96ab[_0x283a('0x42')][_0x283a('0x51')]){_0x5847ee['include']=[{'all':!![]}];}return db[_0x283a('0x3c')][_0x283a('0x52')](_0x5847ee);})[_0x283a('0x20')](function(_0x3a78e4){_0xc77e86[_0x283a('0x53')]=_0x3a78e4;return _0xc77e86;})['then'](respondWithFilteredResult(_0x513e3a,_0x5847ee))['catch'](handleError(_0x513e3a,null));};exports['show']=function(_0x23a5b7,_0x90fac8){var _0x22ac54={'raw':!![],'where':{'id':_0x23a5b7['params']['id']}},_0x797a0e={};_0x797a0e['model']=_['keys'](db[_0x283a('0x3c')][_0x283a('0x3d')]);_0x797a0e[_0x283a('0x42')]=_[_0x283a('0x43')](_0x23a5b7[_0x283a('0x42')]);_0x797a0e['filters']=_['intersection'](_0x797a0e[_0x283a('0x41')],_0x797a0e[_0x283a('0x42')]);_0x22ac54[_0x283a('0x45')]=_[_0x283a('0x44')](_0x797a0e[_0x283a('0x41')],qs['fields'](_0x23a5b7[_0x283a('0x42')][_0x283a('0x46')]));_0x22ac54[_0x283a('0x45')]=_0x22ac54[_0x283a('0x45')]['length']?_0x22ac54[_0x283a('0x45')]:_0x797a0e['model'];if(_0x23a5b7[_0x283a('0x42')][_0x283a('0x51')]){_0x22ac54[_0x283a('0x54')]=[{'all':!![]}];}_0x22ac54=_[_0x283a('0x4e')]({},_0x22ac54,_0x23a5b7[_0x283a('0x50')]);return db[_0x283a('0x3c')][_0x283a('0x55')](_0x22ac54)[_0x283a('0x20')](handleEntityNotFound(_0x90fac8,null))[_0x283a('0x20')](respondWithResult(_0x90fac8,null))['catch'](handleError(_0x90fac8,null));};exports[_0x283a('0x56')]=function(_0x3eb6f6,_0x523a47){return db[_0x283a('0x3c')][_0x283a('0x56')](_0x3eb6f6[_0x283a('0x57')],{})['then'](respondWithResult(_0x523a47,0xc9))['catch'](handleError(_0x523a47,null));};exports['update']=function(_0x2fe86a,_0x2ff362){if(_0x2fe86a[_0x283a('0x57')]['id']){delete _0x2fe86a[_0x283a('0x57')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x2fe86a[_0x283a('0x58')]['id']}})['then'](handleEntityNotFound(_0x2ff362,null))[_0x283a('0x20')](saveUpdates(_0x2fe86a[_0x283a('0x57')],null))[_0x283a('0x20')](respondWithResult(_0x2ff362,null))[_0x283a('0x2b')](handleError(_0x2ff362,null));};exports['destroy']=function(_0x433bea,_0x35893b){return db['WhatsappMessage'][_0x283a('0x55')]({'where':{'id':_0x433bea[_0x283a('0x58')]['id']}})['then'](handleEntityNotFound(_0x35893b,null))[_0x283a('0x20')](removeEntity(_0x35893b,null))[_0x283a('0x2b')](handleError(_0x35893b,null));};exports[_0x283a('0x59')]=function(_0x23af1d,_0x3308d2){return db[_0x283a('0x3c')][_0x283a('0x59')]()[_0x283a('0x20')](respondWithResult(_0x3308d2,null))['catch'](handleError(_0x3308d2,null));};var interaction_log=require(_0x283a('0x14'))(_0x283a('0x5a'));exports['accept']=function(_0x30e16a,_0x3db147,_0x178d54){var _0x350ab1={'agent':{},'channel':'whatsapp'};if(_0x30e16a[_0x283a('0x57')]['id']){delete _0x30e16a[_0x283a('0x57')]['id'];}_0x30e16a[_0x283a('0x57')]['read']=!![];_0x30e16a['body']['readAt']=moment()[_0x283a('0x5b')](_0x283a('0x5c'));_0x30e16a['body'][_0x283a('0x5d')]=_0x30e16a[_0x283a('0x57')][_0x283a('0x5d')]||_0x30e16a[_0x283a('0x5e')]['id'];_0x350ab1['agent']['id']=_0x30e16a[_0x283a('0x57')]['UserId'];return db[_0x283a('0x3c')][_0x283a('0x55')]({'where':{'id':_0x30e16a[_0x283a('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3db147,null))[_0x283a('0x20')](saveUpdates(_0x30e16a[_0x283a('0x57')],null))[_0x283a('0x20')](function(_0x7a4e41){if(_0x7a4e41){_0x350ab1[_0x283a('0x29')]=_0x7a4e41[_0x283a('0x5f')]({'plain':!![]});return db[_0x283a('0x60')]['find']({'where':{'id':_0x7a4e41[_0x283a('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x3db147,null))[_0x283a('0x20')](function(_0x3f723c){if(_0x3f723c){return _0x3f723c[_0x283a('0x62')]({'UserId':_0x30e16a[_0x283a('0x57')]['UserId'],'read1stAt':_[_0x283a('0x63')](_0x3f723c[_0x283a('0x64')])?moment()[_0x283a('0x5b')](_0x283a('0x5c')):undefined});}return null;})[_0x283a('0x20')](function(_0x2f3731){if(_0x2f3731){_0x350ab1[_0x283a('0x65')]=_0x2f3731[_0x283a('0x5f')]({'plain':!![]});interaction_log['info'](_0x283a('0x66'),_0x30e16a[_0x283a('0x5e')]['id'],_0x30e16a[_0x283a('0x5e')][_0x283a('0x39')],_0x30e16a[_0x283a('0x5e')][_0x283a('0x67')],_0x350ab1[_0x283a('0x65')]['id'],_0x30e16a[_0x283a('0x57')]?JSON['stringify'](_0x30e16a['body']):_0x283a('0x68'));return respondWithRpcPromise('AcceptMessage',_0x283a('0x69'),_0x350ab1);}return null;})[_0x283a('0x20')](function(_0x121366){var _0x5324b3=_0x283a('0x6a')+_0x121366[_0x283a('0x29')][_0x283a('0x6b')];return db['sequelize'][_0x283a('0x42')](_0x5324b3,{'type':db[_0x283a('0x6c')][_0x283a('0x6d')][_0x283a('0x6e')],'raw':!![]})[_0x283a('0x20')](function(_0x27c82a){return _0x27c82a;});})[_0x283a('0x20')](function(_0x4dd57f){if(_0x4dd57f){_0x350ab1['message'][_0x283a('0x6f')]=_0x4dd57f[0x0];if(!_0x30e16a[_0x283a('0x57')][_0x283a('0x5d')])return;return db['User'][_0x283a('0x55')]({'where':{'id':_0x30e16a[_0x283a('0x57')][_0x283a('0x5d')],'role':_0x283a('0x70')},'attributes':['id',_0x283a('0x39'),_0x283a('0x71'),_0x283a('0x72'),_0x283a('0x73')],'raw':!![]});}return null;})[_0x283a('0x20')](function(_0x40b09b){if(!_0x40b09b)return null;_0x350ab1[_0x283a('0x29')][_0x283a('0x70')]=_0x40b09b;return _0x350ab1;})[_0x283a('0x20')](function(_0x222644){if(_0x222644){if(_0x30e16a[_0x283a('0x57')][_0x283a('0x74')]){_0x350ab1['message']['interface']=util['format'](_0x283a('0x75'),_0x30e16a[_0x283a('0x5e')]['name']);_0x350ab1['message'][_0x283a('0x76')]=_0x350ab1[_0x283a('0x76')];_0x350ab1[_0x283a('0x29')][_0x283a('0x77')]=_0x350ab1[_0x283a('0x76')];_0x350ab1[_0x283a('0x29')][_0x283a('0x78')]=_0x283a('0x79');return respondWithRpcPromise('EventManager',_0x283a('0x7a'),{'event':'acceptmessage','message':_0x350ab1[_0x283a('0x29')]},client9002)[_0x283a('0x20')](function(){return _0x350ab1;});}return _0x350ab1;}return null;})[_0x283a('0x20')](respondWithResult(_0x3db147,null))['catch'](handleError(_0x3db147,null));};var interaction_log=require(_0x283a('0x14'))(_0x283a('0x5a'));exports[_0x283a('0x35')]=function(_0x1f6f7a,_0x4a9b17,_0x449f23){var _0xf0a047={'agent':{},'channel':'whatsapp'};if(_0x1f6f7a[_0x283a('0x57')]['id']){delete _0x1f6f7a[_0x283a('0x57')]['id'];}_0x1f6f7a[_0x283a('0x57')][_0x283a('0x5d')]=_0x1f6f7a[_0x283a('0x57')][_0x283a('0x5d')]||_0x1f6f7a['user']['id'];_0xf0a047['agent']['id']=_0x1f6f7a[_0x283a('0x57')]['UserId'];return db[_0x283a('0x3c')][_0x283a('0x55')]({'where':{'id':_0x1f6f7a[_0x283a('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4a9b17,null))['then'](function(_0xbe75be){if(_0xbe75be){_0xf0a047[_0x283a('0x29')]=_0xbe75be[_0x283a('0x5f')]({'plain':!![]});return db[_0x283a('0x60')]['find']({'where':{'id':_0xbe75be[_0x283a('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x4a9b17,null))['then'](function(_0x51eb83){if(_0x51eb83){_0xf0a047[_0x283a('0x65')]=_0x51eb83[_0x283a('0x5f')]({'plain':!![]});interaction_log[_0x283a('0x21')](_0x283a('0x7b'),_0x1f6f7a[_0x283a('0x5e')]['id'],_0x1f6f7a[_0x283a('0x5e')][_0x283a('0x39')],_0x1f6f7a[_0x283a('0x5e')][_0x283a('0x67')],_0xf0a047[_0x283a('0x65')]['id'],_0x1f6f7a[_0x283a('0x57')]?JSON['stringify'](_0x1f6f7a[_0x283a('0x57')]):_0x283a('0x68'));return respondWithRpcPromise(_0x283a('0x7c'),_0x283a('0x7d'),_0xf0a047);}return null;})[_0x283a('0x20')](function(_0x487a72){var _0x5d5f16=_0x283a('0x6a')+_0x487a72['message'][_0x283a('0x6b')];return db[_0x283a('0x7e')][_0x283a('0x42')](_0x5d5f16,{'type':db['Sequelize'][_0x283a('0x6d')][_0x283a('0x6e')],'raw':!![]})[_0x283a('0x20')](function(_0x3008ff){return _0x3008ff;});})[_0x283a('0x20')](function(_0x21fddc){if(_0x21fddc){_0xf0a047[_0x283a('0x29')][_0x283a('0x6f')]=_0x21fddc[0x0];if(!_0x1f6f7a[_0x283a('0x57')][_0x283a('0x5d')])return;return db[_0x283a('0x7f')][_0x283a('0x55')]({'where':{'id':_0x1f6f7a[_0x283a('0x57')][_0x283a('0x5d')],'role':_0x283a('0x70')},'attributes':['id','name',_0x283a('0x71'),_0x283a('0x72'),_0x283a('0x73')],'raw':!![]});}return null;})[_0x283a('0x20')](function(_0xd59835){if(!_0xd59835)return null;_0xf0a047[_0x283a('0x29')][_0x283a('0x70')]=_0xd59835;return _0xf0a047;})[_0x283a('0x20')](function(_0x30026f){if(_0x30026f){_0x30026f[_0x283a('0x29')][_0x283a('0x80')]=util[_0x283a('0x5b')]('SIP/%s',_0x1f6f7a[_0x283a('0x5e')][_0x283a('0x39')]);_0x30026f[_0x283a('0x29')][_0x283a('0x76')]=_0xf0a047['channel'];_0x30026f['message']['motionChannel']=_0xf0a047[_0x283a('0x76')];_0x30026f[_0x283a('0x29')][_0x283a('0x78')]='reject';respondWithRpcPromise('EventManager',_0x283a('0x7a'),{'event':_0x283a('0x81'),'message':_0x30026f[_0x283a('0x29')]},client9002);return _0xf0a047;}return null;})[_0x283a('0x20')](respondWithResult(_0x4a9b17,null))['catch'](handleError(_0x4a9b17,null));};exports[_0x283a('0x2d')]=function(_0x25040d,_0xe18b18,_0x52a926){if(_0x25040d['body']['id']){delete _0x25040d[_0x283a('0x57')]['id'];}var _0x283b28;return db[_0x283a('0x3c')]['find']({'where':{'id':_0x25040d['params']['id']}})[_0x283a('0x20')](handleEntityNotFound(_0xe18b18,null))['then'](function(_0x4f4f29){if(_0x4f4f29){_0x283b28=_0x4f4f29;return db[_0x283a('0x82')][_0x283a('0x55')]({'where':{'id':_0x4f4f29[_0x283a('0x83')]}});}})[_0x283a('0x20')](handleEntityNotFound(_0xe18b18,null))[_0x283a('0x20')](function(_0x445a0a){if(_0x445a0a){logger[_0x283a('0x24')](_0x283a('0x84'),_0x283a('0x2d'),'received\x20delivery\x20report\x20from',_0x445a0a[_0x283a('0x3f')],util[_0x283a('0x85')](_0x25040d['body'],{'showHidden':![],'depth':null}));switch(_0x445a0a[_0x283a('0x3f')]){case'twilio':if(_0x25040d[_0x283a('0x57')][_0x283a('0x86')]&&_0x25040d[_0x283a('0x57')][_0x283a('0x86')]===_0x283b28['messageId']&&_0x25040d[_0x283a('0x57')][_0x283a('0x87')]&&_0x25040d[_0x283a('0x57')][_0x283a('0x87')]===_0x283a('0x88')){return _0x283b28['update']({'read':!![]});}else{logger[_0x283a('0x27')](_0x283a('0x89'),_0x283a('0x2d'),_0x283a('0x8a'),util[_0x283a('0x85')](_0x25040d[_0x283a('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x283b28;}})[_0x283a('0x20')](respondWithResult(_0xe18b18,null))[_0x283a('0x2b')](handleError(_0xe18b18,null));};
\ No newline at end of file
+var _0xfe36=['zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','keys','includeAll','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','format','UserId','user','get','WhatsappInteraction','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','WhatsappInteractionId','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf'];(function(_0x54ebbc,_0x58eba2){var _0x213c7a=function(_0x35814d){while(--_0x35814d){_0x54ebbc['push'](_0x54ebbc['shift']());}};_0x213c7a(++_0x58eba2);}(_0xfe36,0x1ab));var _0x6fe3=function(_0x2e32ab,_0x27fc9d){_0x2e32ab=_0x2e32ab-0x0;var _0x121577=_0xfe36[_0x2e32ab];return _0x121577;};'use strict';var emlformat=require(_0x6fe3('0x0'));var rimraf=require(_0x6fe3('0x1'));var zipdir=require(_0x6fe3('0x2'));var jsonpatch=require(_0x6fe3('0x3'));var rp=require('request-promise');var moment=require(_0x6fe3('0x4'));var BPromise=require(_0x6fe3('0x5'));var Mustache=require('mustache');var util=require(_0x6fe3('0x6'));var path=require(_0x6fe3('0x7'));var sox=require('sox');var csv=require(_0x6fe3('0x8'));var ejs=require(_0x6fe3('0x9'));var fs=require('fs');var fs_extra=require(_0x6fe3('0xa'));var _=require(_0x6fe3('0xb'));var squel=require(_0x6fe3('0xc'));var crypto=require('crypto');var jsforce=require(_0x6fe3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6fe3('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6fe3('0xe'));var qs=require(_0x6fe3('0xf'));var as=require(_0x6fe3('0x10'));var hardwareService=require(_0x6fe3('0x11'));var logger=require(_0x6fe3('0x12'))(_0x6fe3('0x13'));var utils=require(_0x6fe3('0x14'));var config=require(_0x6fe3('0x15'));var licenseUtil=require(_0x6fe3('0x16'));var db=require('../../mysqldb')['db'];config[_0x6fe3('0x17')]=_['defaults'](config['redis'],{'host':_0x6fe3('0x18'),'port':0x18eb});var socket=require(_0x6fe3('0x19'))(new Redis(config[_0x6fe3('0x17')]));require(_0x6fe3('0x1a'))[_0x6fe3('0x1b')](socket);var jayson=require(_0x6fe3('0x1c'));var client=jayson['client'][_0x6fe3('0x1d')]({'port':0x232c});var client9002=jayson[_0x6fe3('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26a58e,_0x5d44cc,_0x2a4435,_0x552f55){return new BPromise(function(_0x31d75a,_0x4dce1f){var _0x3f7b9f=_0x552f55||client;return _0x3f7b9f[_0x6fe3('0x1f')](_0x26a58e,_0x2a4435)[_0x6fe3('0x20')](function(_0x47fe8f){logger[_0x6fe3('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x5d44cc,_0x6fe3('0x22'));logger[_0x6fe3('0x23')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5d44cc,'request\x20sent',JSON[_0x6fe3('0x24')](_0x47fe8f));if(_0x47fe8f[_0x6fe3('0x25')]){if(_0x47fe8f[_0x6fe3('0x25')][_0x6fe3('0x26')]===0x1f4){logger['error'](_0x6fe3('0x27'),_0x5d44cc,_0x47fe8f[_0x6fe3('0x25')][_0x6fe3('0x28')]);return _0x4dce1f(_0x47fe8f['error'][_0x6fe3('0x28')]);}logger[_0x6fe3('0x25')](_0x6fe3('0x27'),_0x5d44cc,_0x47fe8f[_0x6fe3('0x25')]['message']);return _0x31d75a(_0x47fe8f['error']['message']);}else{logger[_0x6fe3('0x21')](_0x6fe3('0x27'),_0x5d44cc,_0x6fe3('0x22'));_0x31d75a(_0x47fe8f['result'][_0x6fe3('0x28')]);}})[_0x6fe3('0x29')](function(_0x5c33fd){logger[_0x6fe3('0x25')](_0x6fe3('0x27'),_0x5d44cc,_0x5c33fd);_0x4dce1f(_0x5c33fd);});});}function respondWithStatusCode(_0x3fb722,_0xd38343){_0xd38343=_0xd38343||0xcc;return function(_0x326724){if(_0x326724){return _0x3fb722[_0x6fe3('0x2a')](_0xd38343);}return _0x3fb722[_0x6fe3('0x2b')](_0xd38343)[_0x6fe3('0x2c')]();};}function respondWithResult(_0x53b57c,_0x35be7a){_0x35be7a=_0x35be7a||0xc8;return function(_0x279f31){if(_0x279f31){return _0x53b57c[_0x6fe3('0x2b')](_0x35be7a)['json'](_0x279f31);}};}function respondWithFilteredResult(_0x549786,_0x1ee351){return function(_0x5a0d88){if(_0x5a0d88){var _0x596bb7=typeof _0x1ee351[_0x6fe3('0x2d')]==='undefined'&&typeof _0x1ee351[_0x6fe3('0x2e')]===_0x6fe3('0x2f');var _0x1bb363=_0x5a0d88[_0x6fe3('0x30')];var _0x1f9821=_0x596bb7?0x0:_0x1ee351[_0x6fe3('0x2d')];var _0x5938aa=_0x596bb7?_0x5a0d88[_0x6fe3('0x30')]:_0x1ee351[_0x6fe3('0x2d')]+_0x1ee351[_0x6fe3('0x2e')];var _0x3f1694;if(_0x5938aa>=_0x1bb363){_0x5938aa=_0x1bb363;_0x3f1694=0xc8;}else{_0x3f1694=0xce;}_0x549786['status'](_0x3f1694);return _0x549786[_0x6fe3('0x31')](_0x6fe3('0x32'),_0x1f9821+'-'+_0x5938aa+'/'+_0x1bb363)[_0x6fe3('0x33')](_0x5a0d88);}return null;};}function patchUpdates(_0x1eda9a){return function(_0x7e7c77){try{jsonpatch[_0x6fe3('0x34')](_0x7e7c77,_0x1eda9a,!![]);}catch(_0x4d77e8){return BPromise[_0x6fe3('0x35')](_0x4d77e8);}return _0x7e7c77['save']();};}function saveUpdates(_0x3459d4,_0x1ce47e){return function(_0x1ff390){if(_0x1ff390){return _0x1ff390['update'](_0x3459d4)[_0x6fe3('0x20')](function(_0x42ccb6){return _0x42ccb6;});}return null;};}function removeEntity(_0x29ebe3,_0x2bb719){return function(_0x3f429f){if(_0x3f429f){return _0x3f429f[_0x6fe3('0x36')]()[_0x6fe3('0x20')](function(){_0x29ebe3[_0x6fe3('0x2b')](0xcc)[_0x6fe3('0x2c')]();});}};}function handleEntityNotFound(_0x3b2af0,_0x474aec){return function(_0x5ed8ff){if(!_0x5ed8ff){_0x3b2af0['sendStatus'](0x194);}return _0x5ed8ff;};}function handleError(_0xcd8395,_0x394aab){_0x394aab=_0x394aab||0x1f4;return function(_0x253ac8){logger['error'](_0x253ac8[_0x6fe3('0x37')]);if(_0x253ac8[_0x6fe3('0x38')]){delete _0x253ac8['name'];}_0xcd8395['status'](_0x394aab)[_0x6fe3('0x39')](_0x253ac8);};}exports[_0x6fe3('0x3a')]=function(_0x5c03da,_0x21c398){var _0x140658={},_0x128486={},_0x267b83={'count':0x0,'rows':[]};var _0x466ee3=_[_0x6fe3('0x3b')](db[_0x6fe3('0x3c')][_0x6fe3('0x3d')],function(_0xbf4525){return{'name':_0xbf4525[_0x6fe3('0x3e')],'type':_0xbf4525[_0x6fe3('0x3f')][_0x6fe3('0x40')]};});_0x128486[_0x6fe3('0x41')]=_[_0x6fe3('0x3b')](_0x466ee3,'name');_0x128486[_0x6fe3('0x42')]=_['keys'](_0x5c03da[_0x6fe3('0x42')]);_0x128486['filters']=_['intersection'](_0x128486[_0x6fe3('0x41')],_0x128486[_0x6fe3('0x42')]);_0x140658['attributes']=_[_0x6fe3('0x43')](_0x128486[_0x6fe3('0x41')],qs[_0x6fe3('0x44')](_0x5c03da['query'][_0x6fe3('0x44')]));_0x140658[_0x6fe3('0x45')]=_0x140658['attributes'][_0x6fe3('0x46')]?_0x140658[_0x6fe3('0x45')]:_0x128486[_0x6fe3('0x41')];if(!_0x5c03da[_0x6fe3('0x42')]['hasOwnProperty'](_0x6fe3('0x47'))){_0x140658[_0x6fe3('0x2e')]=qs[_0x6fe3('0x2e')](_0x5c03da[_0x6fe3('0x42')]['limit']);_0x140658[_0x6fe3('0x2d')]=qs[_0x6fe3('0x2d')](_0x5c03da[_0x6fe3('0x42')][_0x6fe3('0x2d')]);}_0x140658[_0x6fe3('0x48')]=qs[_0x6fe3('0x49')](_0x5c03da[_0x6fe3('0x42')]['sort']);_0x140658[_0x6fe3('0x4a')]=qs[_0x6fe3('0x4b')](_[_0x6fe3('0x4c')](_0x5c03da[_0x6fe3('0x42')],_0x128486[_0x6fe3('0x4b')]),_0x466ee3);if(_0x5c03da[_0x6fe3('0x42')][_0x6fe3('0x4d')]){_0x140658[_0x6fe3('0x4a')]=_[_0x6fe3('0x4e')](_0x140658[_0x6fe3('0x4a')],{'$or':_['map'](_0x466ee3,function(_0xcaab4f){if(_0xcaab4f[_0x6fe3('0x3f')]!==_0x6fe3('0x4f')){var _0x6414b2={};_0x6414b2[_0xcaab4f[_0x6fe3('0x38')]]={'$like':'%'+_0x5c03da[_0x6fe3('0x42')][_0x6fe3('0x4d')]+'%'};return _0x6414b2;}})});}_0x140658=_[_0x6fe3('0x4e')]({},_0x140658,_0x5c03da[_0x6fe3('0x50')]);var _0x40d616={'where':_0x140658[_0x6fe3('0x4a')]};return db[_0x6fe3('0x3c')]['count'](_0x40d616)[_0x6fe3('0x20')](function(_0x4d2dd7){_0x267b83[_0x6fe3('0x30')]=_0x4d2dd7;if(_0x5c03da[_0x6fe3('0x42')]['includeAll']){_0x140658['include']=[{'all':!![]}];}return db[_0x6fe3('0x3c')][_0x6fe3('0x51')](_0x140658);})[_0x6fe3('0x20')](function(_0x67ff7b){_0x267b83[_0x6fe3('0x52')]=_0x67ff7b;return _0x267b83;})[_0x6fe3('0x20')](respondWithFilteredResult(_0x21c398,_0x140658))[_0x6fe3('0x29')](handleError(_0x21c398,null));};exports[_0x6fe3('0x53')]=function(_0x234e6a,_0x24ba7f){var _0x330237={'raw':!![],'where':{'id':_0x234e6a[_0x6fe3('0x54')]['id']}},_0x2f37f3={};_0x2f37f3[_0x6fe3('0x41')]=_[_0x6fe3('0x55')](db[_0x6fe3('0x3c')][_0x6fe3('0x3d')]);_0x2f37f3[_0x6fe3('0x42')]=_['keys'](_0x234e6a[_0x6fe3('0x42')]);_0x2f37f3['filters']=_[_0x6fe3('0x43')](_0x2f37f3[_0x6fe3('0x41')],_0x2f37f3['query']);_0x330237[_0x6fe3('0x45')]=_[_0x6fe3('0x43')](_0x2f37f3[_0x6fe3('0x41')],qs[_0x6fe3('0x44')](_0x234e6a[_0x6fe3('0x42')][_0x6fe3('0x44')]));_0x330237[_0x6fe3('0x45')]=_0x330237['attributes'][_0x6fe3('0x46')]?_0x330237[_0x6fe3('0x45')]:_0x2f37f3[_0x6fe3('0x41')];if(_0x234e6a[_0x6fe3('0x42')][_0x6fe3('0x56')]){_0x330237['include']=[{'all':!![]}];}_0x330237=_['merge']({},_0x330237,_0x234e6a['options']);return db['WhatsappMessage'][_0x6fe3('0x57')](_0x330237)[_0x6fe3('0x20')](handleEntityNotFound(_0x24ba7f,null))[_0x6fe3('0x20')](respondWithResult(_0x24ba7f,null))[_0x6fe3('0x29')](handleError(_0x24ba7f,null));};exports['create']=function(_0x4ef2a0,_0x1b04d3){return db[_0x6fe3('0x3c')][_0x6fe3('0x58')](_0x4ef2a0[_0x6fe3('0x59')],{})[_0x6fe3('0x20')](respondWithResult(_0x1b04d3,0xc9))[_0x6fe3('0x29')](handleError(_0x1b04d3,null));};exports['update']=function(_0x2c55df,_0x4dd33b){if(_0x2c55df[_0x6fe3('0x59')]['id']){delete _0x2c55df[_0x6fe3('0x59')]['id'];}return db[_0x6fe3('0x3c')][_0x6fe3('0x57')]({'where':{'id':_0x2c55df['params']['id']}})[_0x6fe3('0x20')](handleEntityNotFound(_0x4dd33b,null))[_0x6fe3('0x20')](saveUpdates(_0x2c55df[_0x6fe3('0x59')],null))[_0x6fe3('0x20')](respondWithResult(_0x4dd33b,null))[_0x6fe3('0x29')](handleError(_0x4dd33b,null));};exports['destroy']=function(_0x3dc691,_0x464c63){return db[_0x6fe3('0x3c')][_0x6fe3('0x57')]({'where':{'id':_0x3dc691[_0x6fe3('0x54')]['id']}})[_0x6fe3('0x20')](handleEntityNotFound(_0x464c63,null))['then'](removeEntity(_0x464c63,null))['catch'](handleError(_0x464c63,null));};exports['describe']=function(_0x2980af,_0x30adf5){return db[_0x6fe3('0x3c')][_0x6fe3('0x5a')]()[_0x6fe3('0x20')](respondWithResult(_0x30adf5,null))[_0x6fe3('0x29')](handleError(_0x30adf5,null));};var interaction_log=require(_0x6fe3('0x12'))(_0x6fe3('0x5b'));exports[_0x6fe3('0x5c')]=function(_0xddf294,_0x5e8a78,_0x4bfb11){var _0x193840={'agent':{},'channel':_0x6fe3('0x5d')};if(_0xddf294[_0x6fe3('0x59')]['id']){delete _0xddf294[_0x6fe3('0x59')]['id'];}_0xddf294[_0x6fe3('0x59')][_0x6fe3('0x5e')]=!![];_0xddf294['body']['readAt']=moment()[_0x6fe3('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0xddf294[_0x6fe3('0x59')][_0x6fe3('0x60')]=_0xddf294[_0x6fe3('0x59')][_0x6fe3('0x60')]||_0xddf294[_0x6fe3('0x61')]['id'];_0x193840['agent']['id']=_0xddf294[_0x6fe3('0x59')]['UserId'];return db[_0x6fe3('0x3c')][_0x6fe3('0x57')]({'where':{'id':_0xddf294[_0x6fe3('0x54')]['id'],'UserId':null}})[_0x6fe3('0x20')](handleEntityNotFound(_0x5e8a78,null))[_0x6fe3('0x20')](saveUpdates(_0xddf294[_0x6fe3('0x59')],null))['then'](function(_0x1d9bfd){if(_0x1d9bfd){_0x193840['message']=_0x1d9bfd[_0x6fe3('0x62')]({'plain':!![]});return db[_0x6fe3('0x63')]['find']({'where':{'id':_0x1d9bfd['WhatsappInteractionId']}});}return null;})[_0x6fe3('0x20')](handleEntityNotFound(_0x5e8a78,null))[_0x6fe3('0x20')](function(_0x58c84c){if(_0x58c84c){return _0x58c84c[_0x6fe3('0x64')]({'UserId':_0xddf294[_0x6fe3('0x59')][_0x6fe3('0x60')],'read1stAt':_[_0x6fe3('0x65')](_0x58c84c[_0x6fe3('0x66')])?moment()[_0x6fe3('0x5f')](_0x6fe3('0x67')):undefined});}return null;})[_0x6fe3('0x20')](function(_0x4747b0){if(_0x4747b0){_0x193840[_0x6fe3('0x68')]=_0x4747b0[_0x6fe3('0x62')]({'plain':!![]});interaction_log[_0x6fe3('0x21')](_0x6fe3('0x69'),_0xddf294[_0x6fe3('0x61')]['id'],_0xddf294[_0x6fe3('0x61')][_0x6fe3('0x38')],_0xddf294['user'][_0x6fe3('0x6a')],_0x193840['interaction']['id'],_0xddf294[_0x6fe3('0x59')]?JSON['stringify'](_0xddf294[_0x6fe3('0x59')]):_0x6fe3('0x6b'));return respondWithRpcPromise(_0x6fe3('0x6c'),_0x6fe3('0x6d'),_0x193840);}return null;})[_0x6fe3('0x20')](function(_0x35e3b6){var _0x1f61f5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x35e3b6['message'][_0x6fe3('0x6e')];return db[_0x6fe3('0x6f')][_0x6fe3('0x42')](_0x1f61f5,{'type':db['Sequelize'][_0x6fe3('0x70')][_0x6fe3('0x71')],'raw':!![]})['then'](function(_0x39305c){return _0x39305c;});})[_0x6fe3('0x20')](function(_0x3b5369){if(_0x3b5369){_0x193840['message'][_0x6fe3('0x72')]=_0x3b5369[0x0];if(!_0xddf294[_0x6fe3('0x59')][_0x6fe3('0x60')])return;return db[_0x6fe3('0x73')][_0x6fe3('0x57')]({'where':{'id':_0xddf294['body'][_0x6fe3('0x60')],'role':_0x6fe3('0x74')},'attributes':['id',_0x6fe3('0x38'),_0x6fe3('0x75'),_0x6fe3('0x76'),_0x6fe3('0x77')],'raw':!![]});}return null;})[_0x6fe3('0x20')](function(_0x353da5){if(!_0x353da5)return null;_0x193840[_0x6fe3('0x28')][_0x6fe3('0x74')]=_0x353da5;return _0x193840;})[_0x6fe3('0x20')](function(_0x31f504){if(_0x31f504){if(_0xddf294[_0x6fe3('0x59')][_0x6fe3('0x78')]){_0x193840[_0x6fe3('0x28')][_0x6fe3('0x79')]=util['format'](_0x6fe3('0x7a'),_0xddf294[_0x6fe3('0x61')][_0x6fe3('0x38')]);_0x193840[_0x6fe3('0x28')][_0x6fe3('0x7b')]=_0x193840[_0x6fe3('0x7b')];_0x193840[_0x6fe3('0x28')][_0x6fe3('0x7c')]=_0x193840[_0x6fe3('0x7b')];_0x193840[_0x6fe3('0x28')][_0x6fe3('0x7d')]='accept';return respondWithRpcPromise(_0x6fe3('0x7e'),'EventManager',{'event':_0x6fe3('0x7f'),'message':_0x193840['message']},client9002)['then'](function(){return _0x193840;});}return _0x193840;}return null;})[_0x6fe3('0x20')](respondWithResult(_0x5e8a78,null))['catch'](handleError(_0x5e8a78,null));};var interaction_log=require(_0x6fe3('0x12'))('whatsapp-interactions');exports[_0x6fe3('0x35')]=function(_0x45cd66,_0x3098a3,_0x3f0b65){var _0x3cfc7b={'agent':{},'channel':_0x6fe3('0x5d')};if(_0x45cd66[_0x6fe3('0x59')]['id']){delete _0x45cd66[_0x6fe3('0x59')]['id'];}_0x45cd66[_0x6fe3('0x59')]['UserId']=_0x45cd66[_0x6fe3('0x59')][_0x6fe3('0x60')]||_0x45cd66[_0x6fe3('0x61')]['id'];_0x3cfc7b['agent']['id']=_0x45cd66['body']['UserId'];return db[_0x6fe3('0x3c')][_0x6fe3('0x57')]({'where':{'id':_0x45cd66[_0x6fe3('0x54')]['id'],'UserId':null}})[_0x6fe3('0x20')](handleEntityNotFound(_0x3098a3,null))[_0x6fe3('0x20')](function(_0xf75a9){if(_0xf75a9){_0x3cfc7b[_0x6fe3('0x28')]=_0xf75a9['get']({'plain':!![]});return db[_0x6fe3('0x63')][_0x6fe3('0x57')]({'where':{'id':_0xf75a9[_0x6fe3('0x80')]}});}return null;})['then'](handleEntityNotFound(_0x3098a3,null))[_0x6fe3('0x20')](function(_0x5acb7b){if(_0x5acb7b){_0x3cfc7b[_0x6fe3('0x68')]=_0x5acb7b['get']({'plain':!![]});interaction_log[_0x6fe3('0x21')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x45cd66['user']['id'],_0x45cd66['user'][_0x6fe3('0x38')],_0x45cd66[_0x6fe3('0x61')][_0x6fe3('0x6a')],_0x3cfc7b[_0x6fe3('0x68')]['id'],_0x45cd66[_0x6fe3('0x59')]?JSON['stringify'](_0x45cd66[_0x6fe3('0x59')]):_0x6fe3('0x6b'));return respondWithRpcPromise('RejectMessage',_0x6fe3('0x81'),_0x3cfc7b);}return null;})['then'](function(_0x4a0bca){var _0x233d1b=_0x6fe3('0x82')+_0x4a0bca[_0x6fe3('0x28')][_0x6fe3('0x6e')];return db[_0x6fe3('0x6f')][_0x6fe3('0x42')](_0x233d1b,{'type':db[_0x6fe3('0x83')]['QueryTypes'][_0x6fe3('0x71')],'raw':!![]})[_0x6fe3('0x20')](function(_0x13bf9d){return _0x13bf9d;});})[_0x6fe3('0x20')](function(_0xefd05){if(_0xefd05){_0x3cfc7b[_0x6fe3('0x28')][_0x6fe3('0x72')]=_0xefd05[0x0];if(!_0x45cd66['body']['UserId'])return;return db[_0x6fe3('0x73')][_0x6fe3('0x57')]({'where':{'id':_0x45cd66[_0x6fe3('0x59')]['UserId'],'role':_0x6fe3('0x74')},'attributes':['id',_0x6fe3('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x6fe3('0x20')](function(_0x3c005a){if(!_0x3c005a)return null;_0x3cfc7b['message'][_0x6fe3('0x74')]=_0x3c005a;return _0x3cfc7b;})[_0x6fe3('0x20')](function(_0x3c0a9b){if(_0x3c0a9b){_0x3c0a9b[_0x6fe3('0x28')]['interface']=util[_0x6fe3('0x5f')](_0x6fe3('0x7a'),_0x45cd66[_0x6fe3('0x61')]['name']);_0x3c0a9b[_0x6fe3('0x28')]['channel']=_0x3cfc7b[_0x6fe3('0x7b')];_0x3c0a9b['message'][_0x6fe3('0x7c')]=_0x3cfc7b['channel'];_0x3c0a9b[_0x6fe3('0x28')]['event']='reject';respondWithRpcPromise(_0x6fe3('0x7e'),_0x6fe3('0x7e'),{'event':_0x6fe3('0x84'),'message':_0x3c0a9b[_0x6fe3('0x28')]},client9002);return _0x3cfc7b;}return null;})[_0x6fe3('0x20')](respondWithResult(_0x3098a3,null))[_0x6fe3('0x29')](handleError(_0x3098a3,null));};exports['status']=function(_0x5c3a9a,_0x63f038,_0x3f1b94){if(_0x5c3a9a['body']['id']){delete _0x5c3a9a['body']['id'];}var _0x2240ac;return db[_0x6fe3('0x3c')][_0x6fe3('0x57')]({'where':{'id':_0x5c3a9a[_0x6fe3('0x54')]['id']}})[_0x6fe3('0x20')](handleEntityNotFound(_0x63f038,null))[_0x6fe3('0x20')](function(_0x2807be){if(_0x2807be){_0x2240ac=_0x2807be;return db[_0x6fe3('0x85')][_0x6fe3('0x57')]({'where':{'id':_0x2807be[_0x6fe3('0x86')]}});}})['then'](handleEntityNotFound(_0x63f038,null))['then'](function(_0x351d25){if(_0x351d25){logger[_0x6fe3('0x23')](_0x6fe3('0x87'),_0x6fe3('0x2b'),_0x6fe3('0x88'),_0x351d25[_0x6fe3('0x3f')],util[_0x6fe3('0x89')](_0x5c3a9a[_0x6fe3('0x59')],{'showHidden':![],'depth':null}));switch(_0x351d25[_0x6fe3('0x3f')]){case _0x6fe3('0x8a'):if(_0x5c3a9a[_0x6fe3('0x59')][_0x6fe3('0x8b')]&&_0x5c3a9a[_0x6fe3('0x59')][_0x6fe3('0x8b')]===_0x2240ac[_0x6fe3('0x8c')]&&_0x5c3a9a[_0x6fe3('0x59')][_0x6fe3('0x8d')]&&_0x5c3a9a[_0x6fe3('0x59')][_0x6fe3('0x8d')]===_0x6fe3('0x5e')){return _0x2240ac[_0x6fe3('0x64')]({'read':!![]});}else{logger[_0x6fe3('0x25')](_0x6fe3('0x8e'),_0x6fe3('0x2b'),'twilio',util[_0x6fe3('0x89')](_0x5c3a9a['body'],{'showHidden':![],'depth':null}));}break;}return _0x2240ac;}})[_0x6fe3('0x20')](respondWithResult(_0x63f038,null))[_0x6fe3('0x29')](handleError(_0x63f038,null));};
\ No newline at end of file
index 24ea7c1..369004d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2e54=['update','remove','emit','hasOwnProperty','exports','events','setMaxListeners','save'];(function(_0x2aacff,_0x3e99bb){var _0xca4bf3=function(_0xc57cb0){while(--_0xc57cb0){_0x2aacff['push'](_0x2aacff['shift']());}};_0xca4bf3(++_0x3e99bb);}(_0x2e54,0x1dd));var _0x42e5=function(_0x5375c3,_0x4f2b50){_0x5375c3=_0x5375c3-0x0;var _0x37ee9a=_0x2e54[_0x5375c3];return _0x37ee9a;};'use strict';var EventEmitter=require(_0x42e5('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x42e5('0x1')](0x0);var events={'afterCreate':_0x42e5('0x2'),'afterUpdate':_0x42e5('0x3'),'afterDestroy':_0x42e5('0x4')};function emitEvent(_0x326371){return function(_0x153440,_0x42736b,_0x528772){WhatsappMessageEvents[_0x42e5('0x5')](_0x326371+':'+_0x153440['id'],_0x153440);WhatsappMessageEvents[_0x42e5('0x5')](_0x326371,_0x153440);_0x528772(null);};}for(var e in events){if(events[_0x42e5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x42e5('0x7')]=WhatsappMessageEvents;
\ No newline at end of file
+var _0x8130=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x4918ce,_0x1ceb72){var _0x11476e=function(_0x37074d){while(--_0x37074d){_0x4918ce['push'](_0x4918ce['shift']());}};_0x11476e(++_0x1ceb72);}(_0x8130,0x146));var _0x0813=function(_0x1e79e8,_0x41dff1){_0x1e79e8=_0x1e79e8-0x0;var _0x7b50c8=_0x8130[_0x1e79e8];return _0x7b50c8;};'use strict';var EventEmitter=require(_0x0813('0x0'));var WhatsappMessage=require(_0x0813('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x0813('0x2')](0x0);var events={'afterCreate':_0x0813('0x3'),'afterUpdate':_0x0813('0x4'),'afterDestroy':_0x0813('0x5')};function emitEvent(_0x1421d7){return function(_0x25d6c6,_0x4e66f4,_0x442a9b){WhatsappMessageEvents['emit'](_0x1421d7+':'+_0x25d6c6['id'],_0x25d6c6);WhatsappMessageEvents['emit'](_0x1421d7,_0x25d6c6);_0x442a9b(null);};}for(var e in events){if(events[_0x0813('0x6')](e)){var event=events[e];WhatsappMessage[_0x0813('0x7')](e,emitEvent(event));}}module[_0x0813('0x8')]=WhatsappMessageEvents;
\ No newline at end of file
index c38788e..9b0a66d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1a11=['../../config/logger','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','error','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','application/json','message_id','statuses','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x1a11,0x120));var _0x11a1=function(_0x502775,_0x571eb4){_0x502775=_0x502775-0x0;var _0x104d5b=_0x1a11[_0x502775];return _0x104d5b;};'use strict';var _=require(_0x11a1('0x0'));var util=require(_0x11a1('0x1'));var logger=require(_0x11a1('0x2'))('api');var moment=require(_0x11a1('0x3'));var BPromise=require(_0x11a1('0x4'));var rp=require(_0x11a1('0x5'));var fetch=require(_0x11a1('0x6'));var fs=require('fs');var path=require(_0x11a1('0x7'));var rimraf=require(_0x11a1('0x8'));var config=require(_0x11a1('0x9'));var attributes=require(_0x11a1('0xa'));module[_0x11a1('0xb')]=function(_0x70c9b5,_0x1473ae){return _0x70c9b5[_0x11a1('0xc')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x11a1('0xd'),'fields':[_0x11a1('0xd')]},{'name':'fti_whatsapp_messages','fields':[_0x11a1('0xe')],'type':_0x11a1('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x321801,_0x554921,_0xf045b0){var _0x5dfcfc=_0x70c9b5[_0x11a1('0x10')];var _0xa3e3bf=_0x321801[_0x11a1('0x11')]({'plain':!![]});if(_0xa3e3bf['direction']['toLowerCase']()==='in'||_0xa3e3bf[_0x11a1('0x12')][_0x11a1('0x13')]()===_0x11a1('0x14')&&!_0xa3e3bf[_0x11a1('0x15')]&&!_[_0x11a1('0x16')](_0xa3e3bf[_0x11a1('0x17')])){_0x5dfcfc[_0x11a1('0x18')]['findOne']({'where':{'id':_0xa3e3bf[_0x11a1('0x19')]}})[_0x11a1('0x1a')](function(_0x18d754){if(_0x18d754){_0x18d754[_0x11a1('0x1b')]({'lastMsgAt':_0xa3e3bf[_0x11a1('0x1c')],'lastMsgDirection':_0xa3e3bf[_0x11a1('0x12')][_0x11a1('0x13')]()});}})['catch'](function(_0x53eb54){console[_0x11a1('0x1d')](_0x53eb54);});}if(_0xa3e3bf[_0x11a1('0x12')]===_0x11a1('0x14')&&!_0xa3e3bf[_0x11a1('0x15')]){var _0x39bf86;_0x5dfcfc['WhatsappAccount'][_0x11a1('0x1e')]({'where':{'id':_0xa3e3bf[_0x11a1('0x1f')]},'raw':!![]})['then'](function(_0x1f1eef){_0x39bf86=_0x1f1eef;if(_0x39bf86&&_0x39bf86['type']){switch(_0x39bf86[_0x11a1('0x20')]){case _0x11a1('0x21'):var _0x266cb0=require(_0x11a1('0x21'));if(_0x39bf86[_0x11a1('0x22')]&&_0x39bf86[_0x11a1('0x23')]&&_0x39bf86[_0x11a1('0x24')]){var _0x5a0a06=new _0x266cb0(_0x39bf86[_0x11a1('0x22')],_0x39bf86[_0x11a1('0x23')]);_0x5a0a06[_0x11a1('0x25')][_0x11a1('0x26')]({'body':_0xa3e3bf[_0x11a1('0xe')],'to':_0x11a1('0x27')+_0xa3e3bf['phone'],'from':'whatsapp:'+_0x39bf86[_0x11a1('0x24')],'statusCallback':_0x39bf86[_0x11a1('0x28')]+_0x11a1('0x29')+_0xa3e3bf['id']+'/status?token='+_0x39bf86[_0x11a1('0x2a')]})[_0x11a1('0x1a')](function(_0x14fc9){if(_0x14fc9[_0x11a1('0x2b')]){return _0x321801[_0x11a1('0x1b')]({'messageId':_0x14fc9[_0x11a1('0x2b')]});}})[_0x11a1('0x2c')](function(_0x5eea2f){logger[_0x11a1('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',util['inspect'](_0x5eea2f,{'showHidden':![],'depth':null}));});}else{logger[_0x11a1('0x1d')](_0x11a1('0x2d'),_0x11a1('0x2e'),'twilio',_0x11a1('0x2f'));}break;case'sinch':var _0xf0e16e=_0x39bf86[_0x11a1('0x22')];var _0x40cdbf=_0x39bf86[_0x11a1('0x23')];var _0x1eabcd=_0x39bf86[_0x11a1('0x30')]+_0x11a1('0x31')+_0xf0e16e+_0x11a1('0x32');var _0x2c95c8={'to':[_0xa3e3bf['phone']],'message':{'type':'text','text':_0xa3e3bf[_0x11a1('0xe')]}};var _0x19f77c={'method':'POST','uri':_0x1eabcd,'headers':{'Authorization':'Bearer\x20'+_0x40cdbf,'Content-Type':_0x11a1('0x33')},'body':_0x2c95c8,'json':!![]};rp(_0x19f77c)[_0x11a1('0x1a')](function(_0x3da31a){if(_0x3da31a['statuses'][0x0][_0x11a1('0x34')]){return _0x321801[_0x11a1('0x1b')]({'messageId':_0x3da31a[_0x11a1('0x35')][0x0][_0x11a1('0x34')]});}})[_0x11a1('0x2c')](function(_0x44cb8d){logger['err'](_0x11a1('0x36'),_0x44cb8d);});break;}}})[_0x11a1('0x37')](function(){_0xf045b0();});}else{_0xf045b0();}}},'charset':_0x11a1('0x38'),'collate':_0x11a1('0x39')});};
\ No newline at end of file
+var _0x2e14=['request-promise','rimraf','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','error','secret','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/status?token=','token','then','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird'];(function(_0x4d3681,_0x136f19){var _0x22c7ac=function(_0x3c6120){while(--_0x3c6120){_0x4d3681['push'](_0x4d3681['shift']());}};_0x22c7ac(++_0x136f19);}(_0x2e14,0x158));var _0x42e1=function(_0x57d00d,_0x3bb282){_0x57d00d=_0x57d00d-0x0;var _0x2d2b37=_0x2e14[_0x57d00d];return _0x2d2b37;};'use strict';var _=require(_0x42e1('0x0'));var util=require(_0x42e1('0x1'));var logger=require('../../config/logger')(_0x42e1('0x2'));var moment=require('moment');var BPromise=require(_0x42e1('0x3'));var rp=require(_0x42e1('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require(_0x42e1('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x59030f,_0x932744){return _0x59030f['define'](_0x42e1('0x6'),attributes,{'tableName':_0x42e1('0x7'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x42e1('0x8')]},{'name':_0x42e1('0x9'),'fields':[_0x42e1('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2d456e,_0x125643,_0x1ede6f){var _0x573a79=_0x59030f['models'];var _0x32266c=_0x2d456e[_0x42e1('0xb')]({'plain':!![]});if(_0x32266c[_0x42e1('0xc')][_0x42e1('0xd')]()==='in'||_0x32266c['direction'][_0x42e1('0xd')]()===_0x42e1('0xe')&&!_0x32266c['secret']&&!_[_0x42e1('0xf')](_0x32266c[_0x42e1('0x10')])){_0x573a79[_0x42e1('0x11')][_0x42e1('0x12')]({'where':{'id':_0x32266c[_0x42e1('0x13')]}})['then'](function(_0x5466c9){if(_0x5466c9){_0x5466c9[_0x42e1('0x14')]({'lastMsgAt':_0x32266c[_0x42e1('0x15')],'lastMsgDirection':_0x32266c[_0x42e1('0xc')][_0x42e1('0xd')]()});}})[_0x42e1('0x16')](function(_0x2a41ee){console[_0x42e1('0x17')](_0x2a41ee);});}if(_0x32266c[_0x42e1('0xc')]==='out'&&!_0x32266c[_0x42e1('0x18')]){var _0x31374b;_0x573a79[_0x42e1('0x19')]['find']({'where':{'id':_0x32266c[_0x42e1('0x1a')]},'raw':!![]})['then'](function(_0x27bf5c){_0x31374b=_0x27bf5c;if(_0x31374b&&_0x31374b[_0x42e1('0x1b')]){switch(_0x31374b['type']){case'twilio':var _0xa5ab46=require(_0x42e1('0x1c'));if(_0x31374b[_0x42e1('0x1d')]&&_0x31374b[_0x42e1('0x1e')]&&_0x31374b['phone']){var _0x5d70cd=new _0xa5ab46(_0x31374b[_0x42e1('0x1d')],_0x31374b[_0x42e1('0x1e')]);_0x5d70cd[_0x42e1('0x1f')][_0x42e1('0x20')]({'body':_0x32266c[_0x42e1('0xa')],'to':_0x42e1('0x21')+_0x32266c[_0x42e1('0x22')],'from':_0x42e1('0x21')+_0x31374b[_0x42e1('0x22')],'statusCallback':_0x31374b[_0x42e1('0x23')]+'/api/whatsapp/messages/'+_0x32266c['id']+_0x42e1('0x24')+_0x31374b[_0x42e1('0x25')]})[_0x42e1('0x26')](function(_0x284dc9){if(_0x284dc9[_0x42e1('0x27')]){return _0x2d456e['update']({'messageId':_0x284dc9[_0x42e1('0x27')]});}})[_0x42e1('0x16')](function(_0xe0e281){logger[_0x42e1('0x17')](_0x42e1('0x28'),_0x42e1('0x29'),_0x42e1('0x1c'),util[_0x42e1('0x2a')](_0xe0e281,{'showHidden':![],'depth':null}));});}else{logger[_0x42e1('0x17')](_0x42e1('0x28'),_0x42e1('0x29'),'twilio',_0x42e1('0x2b'));}break;case _0x42e1('0x2c'):var _0x5d1951=_0x31374b[_0x42e1('0x1d')];var _0x5068e9=_0x31374b[_0x42e1('0x1e')];var _0x3b7c98=_0x31374b[_0x42e1('0x2d')]+_0x42e1('0x2e')+_0x5d1951+_0x42e1('0x2f');var _0x197379={'to':[_0x32266c[_0x42e1('0x22')]],'message':{'type':_0x42e1('0x30'),'text':_0x32266c[_0x42e1('0xa')]}};var _0x322e02={'method':'POST','uri':_0x3b7c98,'headers':{'Authorization':_0x42e1('0x31')+_0x5068e9,'Content-Type':_0x42e1('0x32')},'body':_0x197379,'json':!![]};rp(_0x322e02)[_0x42e1('0x26')](function(_0x5b1f20){if(_0x5b1f20[_0x42e1('0x33')][0x0][_0x42e1('0x34')]){return _0x2d456e[_0x42e1('0x14')]({'messageId':_0x5b1f20[_0x42e1('0x33')][0x0][_0x42e1('0x34')]});}})['catch'](function(_0x19cf24){logger[_0x42e1('0x35')](_0x42e1('0x36'),_0x19cf24);});break;}}})[_0x42e1('0x37')](function(){_0x1ede6f();});}else{_0x1ede6f();}}},'charset':_0x42e1('0x38'),'collate':_0x42e1('0x39')});};
\ No newline at end of file
index 97639cb..b9851ff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2702=['socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','error','code','message','result','catch','CreateWhatsappMessage','create','options','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost'];(function(_0x44b61a,_0x192d8c){var _0x2b1904=function(_0x2a4d6e){while(--_0x2a4d6e){_0x44b61a['push'](_0x44b61a['shift']());}};_0x2b1904(++_0x192d8c);}(_0x2702,0x18a));var _0x2270=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x2702[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x2270('0x0'));var moment=require(_0x2270('0x1'));var BPromise=require(_0x2270('0x2'));var rs=require(_0x2270('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2270('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2270('0x5'))(_0x2270('0x6'));var config=require(_0x2270('0x7'));var jayson=require(_0x2270('0x8'));var client=jayson['client'][_0x2270('0x9')]({'port':0x232a});config[_0x2270('0xa')]=_['defaults'](config[_0x2270('0xa')],{'host':_0x2270('0xb'),'port':0x18eb});var socket=require(_0x2270('0xc'))(new Redis(config[_0x2270('0xa')]));require(_0x2270('0xd'))[_0x2270('0xe')](socket);function respondWithRpcPromise(_0x1341f6,_0x1689d7,_0x916498){return new BPromise(function(_0x1e497d,_0x3cfb5f){return client[_0x2270('0xf')](_0x1341f6,_0x916498)[_0x2270('0x10')](function(_0x597700){logger[_0x2270('0x11')](_0x2270('0x12'),_0x1689d7,'request\x20sent');logger[_0x2270('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1689d7,'request\x20sent',JSON['stringify'](_0x597700));if(_0x597700[_0x2270('0x14')]){if(_0x597700[_0x2270('0x14')][_0x2270('0x15')]===0x1f4){logger[_0x2270('0x14')](_0x2270('0x12'),_0x1689d7,_0x597700['error']['message']);return _0x3cfb5f(_0x597700[_0x2270('0x14')][_0x2270('0x16')]);}logger[_0x2270('0x14')](_0x2270('0x12'),_0x1689d7,_0x597700[_0x2270('0x14')]['message']);return _0x1e497d(_0x597700['error'][_0x2270('0x16')]);}else{logger['info'](_0x2270('0x12'),_0x1689d7,'request\x20sent');_0x1e497d(_0x597700[_0x2270('0x17')]['message']);}})[_0x2270('0x18')](function(_0x33af82){logger[_0x2270('0x14')](_0x2270('0x12'),_0x1689d7,_0x33af82);_0x3cfb5f(_0x33af82);});});}exports[_0x2270('0x19')]=function(_0x32e567){var _0x4156b1=this;return new Promise(function(_0x522bf4,_0x2eca89){return db['WhatsappMessage'][_0x2270('0x1a')](_0x32e567['body'],{'raw':_0x32e567[_0x2270('0x1b')]?_0x32e567[_0x2270('0x1b')][_0x2270('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5c7f51){logger[_0x2270('0x11')](_0x2270('0x19'),_0x32e567);logger[_0x2270('0x13')](_0x2270('0x19'),_0x32e567,JSON['stringify'](_0x5c7f51));_0x522bf4(_0x5c7f51);})[_0x2270('0x18')](function(_0x563446){logger[_0x2270('0x14')](_0x2270('0x19'),_0x563446[_0x2270('0x16')],_0x32e567);_0x2eca89(_0x4156b1['error'](0x1f4,_0x563446[_0x2270('0x16')]));});});};
\ No newline at end of file
+var _0x9046=['options','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body'];(function(_0xaf25ae,_0x2001c1){var _0x49732d=function(_0x5b764d){while(--_0x5b764d){_0xaf25ae['push'](_0xaf25ae['shift']());}};_0x49732d(++_0x2001c1);}(_0x9046,0x176));var _0x6904=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0x9046[_0x1fcaf1];return _0x55f464;};'use strict';var _=require(_0x6904('0x0'));var util=require(_0x6904('0x1'));var moment=require(_0x6904('0x2'));var BPromise=require(_0x6904('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6904('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6904('0x5'))('rpc');var config=require(_0x6904('0x6'));var jayson=require(_0x6904('0x7'));var client=jayson[_0x6904('0x8')][_0x6904('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6904('0xa')],{'host':_0x6904('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6904('0xc'))[_0x6904('0xd')](socket);function respondWithRpcPromise(_0x5459d2,_0x22c9cc,_0x4083c3){return new BPromise(function(_0x3df6d7,_0x1beeea){return client['request'](_0x5459d2,_0x4083c3)[_0x6904('0xe')](function(_0x1267bb){logger[_0x6904('0xf')](_0x6904('0x10'),_0x22c9cc,_0x6904('0x11'));logger[_0x6904('0x12')](_0x6904('0x13'),_0x22c9cc,_0x6904('0x11'),JSON['stringify'](_0x1267bb));if(_0x1267bb[_0x6904('0x14')]){if(_0x1267bb['error'][_0x6904('0x15')]===0x1f4){logger[_0x6904('0x14')](_0x6904('0x10'),_0x22c9cc,_0x1267bb['error'][_0x6904('0x16')]);return _0x1beeea(_0x1267bb[_0x6904('0x14')][_0x6904('0x16')]);}logger[_0x6904('0x14')](_0x6904('0x10'),_0x22c9cc,_0x1267bb[_0x6904('0x14')][_0x6904('0x16')]);return _0x3df6d7(_0x1267bb['error'][_0x6904('0x16')]);}else{logger[_0x6904('0xf')](_0x6904('0x10'),_0x22c9cc,_0x6904('0x11'));_0x3df6d7(_0x1267bb[_0x6904('0x17')][_0x6904('0x16')]);}})[_0x6904('0x18')](function(_0x2308fe){logger[_0x6904('0x14')](_0x6904('0x10'),_0x22c9cc,_0x2308fe);_0x1beeea(_0x2308fe);});});}exports[_0x6904('0x19')]=function(_0x563735){var _0x4592c3=this;return new Promise(function(_0x3d0d92,_0x2424a6){return db[_0x6904('0x1a')][_0x6904('0x1b')](_0x563735[_0x6904('0x1c')],{'raw':_0x563735[_0x6904('0x1d')]?_0x563735[_0x6904('0x1d')][_0x6904('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2a9135){logger[_0x6904('0xf')](_0x6904('0x19'),_0x563735);logger[_0x6904('0x12')](_0x6904('0x19'),_0x563735,JSON['stringify'](_0x2a9135));_0x3d0d92(_0x2a9135);})[_0x6904('0x18')](function(_0x5b54cd){logger[_0x6904('0x14')](_0x6904('0x19'),_0x5b54cd[_0x6904('0x16')],_0x563735);_0x2424a6(_0x4592c3[_0x6904('0x14')](0x1f4,_0x5b54cd[_0x6904('0x16')]));});});};
\ No newline at end of file
index 9f865dc..c27f8d0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0f8d=['register','length','whatsappMessage:','save','remove','update','emit','removeListener'];(function(_0x57e9c3,_0x25d1c9){var _0x48f3e7=function(_0x3251d9){while(--_0x3251d9){_0x57e9c3['push'](_0x57e9c3['shift']());}};_0x48f3e7(++_0x25d1c9);}(_0x0f8d,0x193));var _0xd0f8=function(_0x4d0729,_0x107590){_0x4d0729=_0x4d0729-0x0;var _0xe3c29f=_0x0f8d[_0x4d0729];return _0xe3c29f;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xd0f8('0x0'),_0xd0f8('0x1'),_0xd0f8('0x2')];function createListener(_0x2a84a8,_0x226014){return function(_0x5a6441){_0x226014[_0xd0f8('0x3')](_0x2a84a8,_0x5a6441);};}function removeListener(_0x2c042e,_0x4db2de){return function(){WhatsappMessageEvents[_0xd0f8('0x4')](_0x2c042e,_0x4db2de);};}exports[_0xd0f8('0x5')]=function(_0x40fc6b){for(var _0x17d951=0x0,_0x98803=events[_0xd0f8('0x6')];_0x17d951<_0x98803;_0x17d951++){var _0x3321b2=events[_0x17d951];var _0x20fb9d=createListener(_0xd0f8('0x7')+_0x3321b2,_0x40fc6b);WhatsappMessageEvents['on'](_0x3321b2,_0x20fb9d);}};
\ No newline at end of file
+var _0x1a08=['emit','removeListener','register','length','./whatsappMessage.events','save','remove','update'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0x1a08,0x1a4));var _0x81a0=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0x1a08[_0x36fbef];return _0x45e270;};'use strict';var WhatsappMessageEvents=require(_0x81a0('0x0'));var events=[_0x81a0('0x1'),_0x81a0('0x2'),_0x81a0('0x3')];function createListener(_0x395940,_0x1b1ec0){return function(_0x593d0b){_0x1b1ec0[_0x81a0('0x4')](_0x395940,_0x593d0b);};}function removeListener(_0x461369,_0x1c6531){return function(){WhatsappMessageEvents[_0x81a0('0x5')](_0x461369,_0x1c6531);};}exports[_0x81a0('0x6')]=function(_0x5c73ad){for(var _0x2b9504=0x0,_0x3df59e=events[_0x81a0('0x7')];_0x2b9504<_0x3df59e;_0x2b9504++){var _0x1dab33=events[_0x2b9504];var _0x464eec=createListener('whatsappMessage:'+_0x1dab33,_0x5c73ad);WhatsappMessageEvents['on'](_0x1dab33,_0x464eec);}};
\ No newline at end of file
index e975531..85c6fb2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x41ec=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members','getMembers','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','util','path'];(function(_0x28f7e1,_0x3d6924){var _0x495bb4=function(_0x590cff){while(--_0x590cff){_0x28f7e1['push'](_0x28f7e1['shift']());}};_0x495bb4(++_0x3d6924);}(_0x41ec,0xde));var _0xc41e=function(_0x3bb6d6,_0x36cfeb){_0x3bb6d6=_0x3bb6d6-0x0;var _0x2123f0=_0x41ec[_0x3bb6d6];return _0x2123f0;};'use strict';var multer=require('multer');var util=require(_0xc41e('0x0'));var path=require(_0xc41e('0x1'));var timeout=require(_0xc41e('0x2'));var express=require(_0xc41e('0x3'));var router=express[_0xc41e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc41e('0x5'));var interaction=require(_0xc41e('0x6'));var config=require('../../config/environment');var controller=require(_0xc41e('0x7'));router['get']('/',auth[_0xc41e('0x8')](),controller[_0xc41e('0x9')]);router[_0xc41e('0xa')](_0xc41e('0xb'),auth[_0xc41e('0x8')](),controller[_0xc41e('0xc')]);router['get']('/:id',auth[_0xc41e('0x8')](),controller[_0xc41e('0xd')]);router[_0xc41e('0xa')](_0xc41e('0xe'),auth[_0xc41e('0x8')](),controller[_0xc41e('0xf')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0xc41e('0xa')](_0xc41e('0x10'),auth[_0xc41e('0x8')](),controller[_0xc41e('0x11')]);router[_0xc41e('0x12')]('/',auth[_0xc41e('0x8')](),controller[_0xc41e('0x13')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0xc41e('0x14')]);router[_0xc41e('0x12')](_0xc41e('0x10'),auth[_0xc41e('0x8')](),controller[_0xc41e('0x15')]);router[_0xc41e('0x16')](_0xc41e('0x17'),auth['isAuthenticated'](),controller[_0xc41e('0x18')]);router[_0xc41e('0x19')](_0xc41e('0x17'),auth['isAuthenticated'](),controller[_0xc41e('0x1a')]);router[_0xc41e('0x19')]('/:id/teams',auth[_0xc41e('0x8')](),controller[_0xc41e('0x1b')]);router[_0xc41e('0x19')]('/:id/users',auth[_0xc41e('0x8')](),controller['removeAgents']);module['exports']=router;
\ No newline at end of file
+var _0x218d=['getMembers','/:id/teams','getTeams','getAgents','post','addAgents','put','delete','removeTeams','/:id/users','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','/:id/members'];(function(_0x4e1bd1,_0x323c13){var _0x1689ec=function(_0x5df987){while(--_0x5df987){_0x4e1bd1['push'](_0x4e1bd1['shift']());}};_0x1689ec(++_0x323c13);}(_0x218d,0x143));var _0xd218=function(_0x4df744,_0xecb4cf){_0x4df744=_0x4df744-0x0;var _0x3e8422=_0x218d[_0x4df744];return _0x3e8422;};'use strict';var multer=require(_0xd218('0x0'));var util=require(_0xd218('0x1'));var path=require(_0xd218('0x2'));var timeout=require(_0xd218('0x3'));var express=require(_0xd218('0x4'));var router=express[_0xd218('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd218('0x6'));var interaction=require(_0xd218('0x7'));var config=require(_0xd218('0x8'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0xd218('0x9')](),controller[_0xd218('0xa')]);router[_0xd218('0xb')](_0xd218('0xc'),auth[_0xd218('0x9')](),controller['describe']);router[_0xd218('0xb')](_0xd218('0xd'),auth[_0xd218('0x9')](),controller['show']);router[_0xd218('0xb')](_0xd218('0xe'),auth[_0xd218('0x9')](),controller[_0xd218('0xf')]);router['get'](_0xd218('0x10'),auth[_0xd218('0x9')](),controller[_0xd218('0x11')]);router[_0xd218('0xb')]('/:id/users',auth[_0xd218('0x9')](),controller[_0xd218('0x12')]);router[_0xd218('0x13')]('/',auth[_0xd218('0x9')](),controller['create']);router[_0xd218('0x13')](_0xd218('0x10'),auth[_0xd218('0x9')](),controller['addTeams']);router[_0xd218('0x13')]('/:id/users',auth[_0xd218('0x9')](),controller[_0xd218('0x14')]);router[_0xd218('0x15')]('/:id',auth[_0xd218('0x9')](),controller['update']);router['delete'](_0xd218('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xd218('0x16')](_0xd218('0x10'),auth[_0xd218('0x9')](),controller[_0xd218('0x17')]);router[_0xd218('0x16')](_0xd218('0x18'),auth['isAuthenticated'](),controller[_0xd218('0x19')]);module['exports']=router;
\ No newline at end of file
index ea07df1..da7a365 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x292e=['sequelize','exports','STRING','name','rrmemory','beepall','roundrobin'];(function(_0x34a32e,_0x26f089){var _0x24ca9b=function(_0x47c1c5){while(--_0x47c1c5){_0x34a32e['push'](_0x34a32e['shift']());}};_0x24ca9b(++_0x26f089);}(_0x292e,0xcb));var _0xe292=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x292e[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0xe292('0x0'));module[_0xe292('0x1')]={'name':{'type':Sequelize[_0xe292('0x2')],'unique':_0xe292('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe292('0x4'),_0xe292('0x5'),_0xe292('0x6'))},'description':{'type':Sequelize[_0xe292('0x2')]}};
\ No newline at end of file
+var _0x89e8=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x5d75ff,_0x5bc7ac){var _0x1c1894=function(_0x1fcade){while(--_0x1fcade){_0x5d75ff['push'](_0x5d75ff['shift']());}};_0x1c1894(++_0x5bc7ac);}(_0x89e8,0x74));var _0x889e=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x89e8[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x889e('0x0'));module[_0x889e('0x1')]={'name':{'type':Sequelize[_0x889e('0x2')],'unique':_0x889e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x889e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x889e('0x5')](_0x889e('0x6'),_0x889e('0x7'),'roundrobin')},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index fc9310f..f0765e7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2149=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','User','findAndCountAll','agent','format','%s/%s','SIP','whatsappPause','createdAt','updatedAt','getTeams','Team','addTeams','online','voicePause','interface','Agents','sequelize','each','findOrCreate','forEach','userWhatsappQueue:save','ids','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','union','compact','value','removeTeams','removeAgents','emit','userWhatsappQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x3472c8,_0x871097){var _0x5006b5=function(_0x5b87dd){while(--_0x5b87dd){_0x3472c8['push'](_0x3472c8['shift']());}};_0x5006b5(++_0x871097);}(_0x2149,0x1de));var _0x9214=function(_0x364f58,_0x51904c){_0x364f58=_0x364f58-0x0;var _0x64b9d0=_0x2149[_0x364f58];return _0x64b9d0;};'use strict';var emlformat=require(_0x9214('0x0'));var rimraf=require(_0x9214('0x1'));var zipdir=require(_0x9214('0x2'));var jsonpatch=require(_0x9214('0x3'));var rp=require(_0x9214('0x4'));var moment=require(_0x9214('0x5'));var BPromise=require(_0x9214('0x6'));var Mustache=require(_0x9214('0x7'));var util=require('util');var path=require('path');var sox=require(_0x9214('0x8'));var csv=require(_0x9214('0x9'));var ejs=require(_0x9214('0xa'));var fs=require('fs');var fs_extra=require(_0x9214('0xb'));var _=require(_0x9214('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9214('0xd'));var deskjs=require(_0x9214('0xe'));var toCsv=require(_0x9214('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9214('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9214('0x10'));var as=require(_0x9214('0x11'));var hardwareService=require(_0x9214('0x12'));var logger=require(_0x9214('0x13'))(_0x9214('0x14'));var utils=require(_0x9214('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9214('0x16'));var db=require(_0x9214('0x17'))['db'];config['redis']=_[_0x9214('0x18')](config[_0x9214('0x19')],{'host':_0x9214('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9214('0x19')]));require(_0x9214('0x1b'))[_0x9214('0x1c')](socket);function respondWithStatusCode(_0x56293b,_0x1a5d37){_0x1a5d37=_0x1a5d37||0xcc;return function(_0x25655e){if(_0x25655e){return _0x56293b[_0x9214('0x1d')](_0x1a5d37);}return _0x56293b[_0x9214('0x1e')](_0x1a5d37)[_0x9214('0x1f')]();};}function respondWithResult(_0x4bdd97,_0x39782b){_0x39782b=_0x39782b||0xc8;return function(_0x5dd9b4){if(_0x5dd9b4){return _0x4bdd97[_0x9214('0x1e')](_0x39782b)['json'](_0x5dd9b4);}};}function respondWithFilteredResult(_0x2555ff,_0x4dac0a){return function(_0x42c339){if(_0x42c339){var _0x3505c9=typeof _0x4dac0a[_0x9214('0x20')]===_0x9214('0x21')&&typeof _0x4dac0a[_0x9214('0x22')]===_0x9214('0x21');var _0x375a0b=_0x42c339[_0x9214('0x23')];var _0x56dba9=_0x3505c9?0x0:_0x4dac0a['offset'];var _0x37684e=_0x3505c9?_0x42c339['count']:_0x4dac0a[_0x9214('0x20')]+_0x4dac0a[_0x9214('0x22')];var _0x1eee95;if(_0x37684e>=_0x375a0b){_0x37684e=_0x375a0b;_0x1eee95=0xc8;}else{_0x1eee95=0xce;}_0x2555ff[_0x9214('0x1e')](_0x1eee95);return _0x2555ff['set'](_0x9214('0x24'),_0x56dba9+'-'+_0x37684e+'/'+_0x375a0b)['json'](_0x42c339);}return null;};}function patchUpdates(_0x14a98c){return function(_0x3956e9){try{jsonpatch[_0x9214('0x25')](_0x3956e9,_0x14a98c,!![]);}catch(_0x4579f4){return BPromise['reject'](_0x4579f4);}return _0x3956e9[_0x9214('0x26')]();};}function saveUpdates(_0x2550dc,_0x4cc7f3){return function(_0x7f02b9){if(_0x7f02b9){return _0x7f02b9[_0x9214('0x27')](_0x2550dc)[_0x9214('0x28')](function(_0x2bdee5){return _0x2bdee5;});}return null;};}function removeEntity(_0x4e2499,_0x3772bb){return function(_0x2e2ea7){if(_0x2e2ea7){return _0x2e2ea7[_0x9214('0x29')]()[_0x9214('0x28')](function(){var _0x3bb400=_0x2e2ea7[_0x9214('0x2a')]({'plain':!![]});var _0x1a8e14=_0x9214('0x2b');return db[_0x9214('0x2c')][_0x9214('0x29')]({'where':{'type':_0x1a8e14,'resourceId':_0x3bb400['id']}})[_0x9214('0x28')](function(){return _0x2e2ea7;});})['then'](function(){_0x4e2499[_0x9214('0x1e')](0xcc)[_0x9214('0x1f')]();});}};}function handleEntityNotFound(_0x1dbde6,_0x57eda0){return function(_0x77977a){if(!_0x77977a){_0x1dbde6[_0x9214('0x1d')](0x194);}return _0x77977a;};}function handleError(_0x5ce48a,_0x5e5278){_0x5e5278=_0x5e5278||0x1f4;return function(_0x2f812a){logger[_0x9214('0x2d')](_0x2f812a[_0x9214('0x2e')]);if(_0x2f812a[_0x9214('0x2f')]){delete _0x2f812a[_0x9214('0x2f')];}_0x5ce48a[_0x9214('0x1e')](_0x5e5278)['send'](_0x2f812a);};}exports[_0x9214('0x30')]=function(_0x56d22a,_0x53357e){var _0x18c04b={},_0x342fcd={},_0x3f8813={'count':0x0,'rows':[]};var _0x35a34a=_[_0x9214('0x31')](db[_0x9214('0x32')][_0x9214('0x33')],function(_0x150e6e){return{'name':_0x150e6e[_0x9214('0x34')],'type':_0x150e6e[_0x9214('0x35')]['key']};});_0x342fcd[_0x9214('0x36')]=_[_0x9214('0x31')](_0x35a34a,'name');_0x342fcd[_0x9214('0x37')]=_[_0x9214('0x38')](_0x56d22a[_0x9214('0x37')]);_0x342fcd[_0x9214('0x39')]=_[_0x9214('0x3a')](_0x342fcd[_0x9214('0x36')],_0x342fcd[_0x9214('0x37')]);_0x18c04b[_0x9214('0x3b')]=_[_0x9214('0x3a')](_0x342fcd[_0x9214('0x36')],qs[_0x9214('0x3c')](_0x56d22a[_0x9214('0x37')][_0x9214('0x3c')]));_0x18c04b['attributes']=_0x18c04b[_0x9214('0x3b')][_0x9214('0x3d')]?_0x18c04b[_0x9214('0x3b')]:_0x342fcd[_0x9214('0x36')];if(!_0x56d22a[_0x9214('0x37')][_0x9214('0x3e')]('nolimit')){_0x18c04b[_0x9214('0x22')]=qs[_0x9214('0x22')](_0x56d22a[_0x9214('0x37')][_0x9214('0x22')]);_0x18c04b['offset']=qs[_0x9214('0x20')](_0x56d22a[_0x9214('0x37')][_0x9214('0x20')]);}_0x18c04b[_0x9214('0x3f')]=qs[_0x9214('0x40')](_0x56d22a['query']['sort']);_0x18c04b[_0x9214('0x41')]=qs[_0x9214('0x39')](_[_0x9214('0x42')](_0x56d22a['query'],_0x342fcd['filters']),_0x35a34a);if(_0x56d22a[_0x9214('0x37')][_0x9214('0x43')]){_0x18c04b[_0x9214('0x41')]=_['merge'](_0x18c04b['where'],{'$or':_[_0x9214('0x31')](_0x35a34a,function(_0x597469){if(_0x597469['type']!=='VIRTUAL'){var _0x203fce={};_0x203fce[_0x597469['name']]={'$like':'%'+_0x56d22a[_0x9214('0x37')]['filter']+'%'};return _0x203fce;}})});}_0x18c04b=_[_0x9214('0x44')]({},_0x18c04b,_0x56d22a[_0x9214('0x45')]);var _0x5e2a23={'where':_0x18c04b['where']};return db[_0x9214('0x32')][_0x9214('0x23')](_0x5e2a23)['then'](function(_0x3c88f4){_0x3f8813[_0x9214('0x23')]=_0x3c88f4;if(_0x56d22a[_0x9214('0x37')][_0x9214('0x46')]){_0x18c04b[_0x9214('0x47')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x9214('0x48')](_0x18c04b);})[_0x9214('0x28')](function(_0x5a545d){_0x3f8813[_0x9214('0x49')]=_0x5a545d;return _0x3f8813;})[_0x9214('0x28')](respondWithFilteredResult(_0x53357e,_0x18c04b))[_0x9214('0x4a')](handleError(_0x53357e,null));};exports[_0x9214('0x4b')]=function(_0x151f8f,_0x187d73){var _0x5da8c3={'raw':!![],'where':{'id':_0x151f8f[_0x9214('0x4c')]['id']}},_0x11dd43={};_0x11dd43[_0x9214('0x36')]=_['keys'](db[_0x9214('0x32')][_0x9214('0x33')]);_0x11dd43[_0x9214('0x37')]=_[_0x9214('0x38')](_0x151f8f[_0x9214('0x37')]);_0x11dd43[_0x9214('0x39')]=_[_0x9214('0x3a')](_0x11dd43[_0x9214('0x36')],_0x11dd43['query']);_0x5da8c3[_0x9214('0x3b')]=_[_0x9214('0x3a')](_0x11dd43['model'],qs[_0x9214('0x3c')](_0x151f8f[_0x9214('0x37')][_0x9214('0x3c')]));_0x5da8c3['attributes']=_0x5da8c3['attributes'][_0x9214('0x3d')]?_0x5da8c3[_0x9214('0x3b')]:_0x11dd43[_0x9214('0x36')];if(_0x151f8f[_0x9214('0x37')]['includeAll']){_0x5da8c3[_0x9214('0x47')]=[{'all':!![]}];}_0x5da8c3=_[_0x9214('0x44')]({},_0x5da8c3,_0x151f8f['options']);return db[_0x9214('0x32')][_0x9214('0x4d')](_0x5da8c3)['then'](handleEntityNotFound(_0x187d73,null))['then'](respondWithResult(_0x187d73,null))[_0x9214('0x4a')](handleError(_0x187d73,null));};exports['create']=function(_0x1380ec,_0x1b596b){return db[_0x9214('0x32')][_0x9214('0x4e')](_0x1380ec[_0x9214('0x4f')],{})['then'](function(_0x2bb27a){var _0x31dff5=_0x1380ec[_0x9214('0x50')][_0x9214('0x2a')]({'plain':!![]});if(!_0x31dff5)throw new Error(_0x9214('0x51'));if(_0x31dff5['role']==='user'){var _0x12f1e0=_0x2bb27a['get']({'plain':!![]});var _0x4a8d2d=_0x9214('0x2b');return db[_0x9214('0x52')][_0x9214('0x4d')]({'where':{'name':_0x4a8d2d,'userProfileId':_0x31dff5[_0x9214('0x53')]},'raw':!![]})['then'](function(_0x33431f){if(_0x33431f&&_0x33431f[_0x9214('0x54')]===0x0){return db['UserProfileResource'][_0x9214('0x4e')]({'name':_0x12f1e0['name'],'resourceId':_0x12f1e0['id'],'type':_0x33431f[_0x9214('0x2f')],'sectionId':_0x33431f['id']},{})[_0x9214('0x28')](function(){return _0x2bb27a;});}else{return _0x2bb27a;}})['catch'](function(_0x28a523){logger['error'](_0x9214('0x55'),_0x28a523);throw _0x28a523;});}return _0x2bb27a;})[_0x9214('0x28')](respondWithResult(_0x1b596b,0xc9))[_0x9214('0x4a')](handleError(_0x1b596b,null));};exports['update']=function(_0xca0486,_0x1e2de9){if(_0xca0486[_0x9214('0x4f')]['id']){delete _0xca0486[_0x9214('0x4f')]['id'];}return db[_0x9214('0x32')][_0x9214('0x4d')]({'where':{'id':_0xca0486['params']['id']}})[_0x9214('0x28')](handleEntityNotFound(_0x1e2de9,null))['then'](saveUpdates(_0xca0486[_0x9214('0x4f')],null))[_0x9214('0x28')](respondWithResult(_0x1e2de9,null))['catch'](handleError(_0x1e2de9,null));};exports['destroy']=function(_0x5a79ee,_0x593ce4){return db[_0x9214('0x32')][_0x9214('0x4d')]({'where':{'id':_0x5a79ee[_0x9214('0x4c')]['id']}})[_0x9214('0x28')](handleEntityNotFound(_0x593ce4,null))[_0x9214('0x28')](removeEntity(_0x593ce4,null))[_0x9214('0x4a')](handleError(_0x593ce4,null));};exports[_0x9214('0x56')]=function(_0xa20142,_0x22713a){return db[_0x9214('0x32')][_0x9214('0x56')]()[_0x9214('0x28')](respondWithResult(_0x22713a,null))[_0x9214('0x4a')](handleError(_0x22713a,null));};exports[_0x9214('0x57')]=function(_0x43b3e2,_0x53d58b,_0x1a5374){var _0x35ac5c={'raw':!![],'where':{}},_0x3b4fd0={},_0x1ae0e0;return db['WhatsappQueue'][_0x9214('0x58')]({'where':{'id':_0x43b3e2[_0x9214('0x4c')]['id']}})[_0x9214('0x28')](handleEntityNotFound(_0x53d58b,null))[_0x9214('0x28')](function(_0x53eaa6){if(_0x53eaa6){_0x1ae0e0=_0x53eaa6[_0x9214('0x2a')]({'plain':!![]});_0x3b4fd0[_0x9214('0x36')]=_[_0x9214('0x38')](db[_0x9214('0x59')]['rawAttributes']);_0x3b4fd0[_0x9214('0x37')]=_[_0x9214('0x38')](_0x43b3e2[_0x9214('0x37')]);_0x3b4fd0['filters']=_[_0x9214('0x3a')](_0x3b4fd0[_0x9214('0x36')],_0x3b4fd0[_0x9214('0x37')]);_0x35ac5c[_0x9214('0x3b')]=_[_0x9214('0x3a')](_0x3b4fd0[_0x9214('0x36')],qs['fields'](_0x43b3e2[_0x9214('0x37')][_0x9214('0x3c')]));_0x35ac5c[_0x9214('0x3b')]=_0x35ac5c[_0x9214('0x3b')][_0x9214('0x3d')]?_0x35ac5c[_0x9214('0x3b')]:_0x3b4fd0[_0x9214('0x36')];if(!_0x43b3e2[_0x9214('0x37')][_0x9214('0x3e')](_0x9214('0x5a'))){_0x35ac5c[_0x9214('0x22')]=qs['limit'](_0x43b3e2[_0x9214('0x37')]['limit']);_0x35ac5c[_0x9214('0x20')]=qs[_0x9214('0x20')](_0x43b3e2[_0x9214('0x37')]['offset']);}_0x35ac5c[_0x9214('0x3f')]=qs[_0x9214('0x40')](_0x43b3e2[_0x9214('0x37')][_0x9214('0x40')]);_0x35ac5c[_0x9214('0x41')]=qs[_0x9214('0x39')](_[_0x9214('0x42')](_0x43b3e2[_0x9214('0x37')],_0x3b4fd0[_0x9214('0x39')]));_0x35ac5c['where'][_0x9214('0x5b')]=_0x53eaa6['id'];if(_0x43b3e2[_0x9214('0x37')][_0x9214('0x43')]){_0x35ac5c[_0x9214('0x41')]=_[_0x9214('0x44')](_0x35ac5c[_0x9214('0x41')],{'$or':_[_0x9214('0x31')](_0x35ac5c['attributes'],function(_0x1120f3){var _0x5d5676={};_0x5d5676[_0x1120f3]={'$like':'%'+_0x43b3e2[_0x9214('0x37')][_0x9214('0x43')]+'%'};return _0x5d5676;})});}_0x35ac5c=_[_0x9214('0x44')]({},_0x35ac5c,_0x43b3e2[_0x9214('0x45')]);return db[_0x9214('0x59')][_0x9214('0x48')](_0x35ac5c);}})[_0x9214('0x28')](function(_0x38bede){if(_0x38bede){return db[_0x9214('0x5c')][_0x9214('0x5d')]({'where':{'id':_[_0x9214('0x31')](_0x38bede,'UserId'),'role':_0x9214('0x5e')},'attributes':['id',_0x9214('0x2f'),'whatsappPause','updatedAt','createdAt']});}})[_0x9214('0x28')](function(_0x178a1f){if(_0x178a1f){return{'count':_0x178a1f[_0x9214('0x23')],'rows':_[_0x9214('0x31')](_0x178a1f[_0x9214('0x49')],function(_0x3778c6){return{'membername':_0x3778c6[_0x9214('0x2f')],'UserId':_0x3778c6['id'],'queue_name':_0x1ae0e0[_0x9214('0x2f')],'WhatsappQueueId':_0x1ae0e0['id'],'interface':util[_0x9214('0x5f')](_0x9214('0x60'),_0x9214('0x61'),_0x3778c6[_0x9214('0x2f')]),'penalty':0x0,'paused':_0x3778c6[_0x9214('0x62')],'createdAt':_0x3778c6[_0x9214('0x63')],'updatedAt':_0x3778c6[_0x9214('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x53d58b,_0x35ac5c))[_0x9214('0x4a')](handleError(_0x53d58b,null));};exports[_0x9214('0x65')]=function(_0x44ae44,_0x252b69,_0x208c71){var _0x277649={};var _0x33aa73={};var _0x1314de;var _0x4b69b0;return db[_0x9214('0x32')]['findOne']({'where':{'id':_0x44ae44[_0x9214('0x4c')]['id']}})[_0x9214('0x28')](handleEntityNotFound(_0x252b69,null))[_0x9214('0x28')](function(_0x385aa1){if(_0x385aa1){_0x1314de=_0x385aa1;_0x33aa73[_0x9214('0x36')]=_[_0x9214('0x38')](db[_0x9214('0x66')][_0x9214('0x33')]);_0x33aa73[_0x9214('0x37')]=_[_0x9214('0x38')](_0x44ae44[_0x9214('0x37')]);_0x33aa73[_0x9214('0x39')]=_[_0x9214('0x3a')](_0x33aa73[_0x9214('0x36')],_0x33aa73[_0x9214('0x37')]);_0x277649[_0x9214('0x3b')]=_[_0x9214('0x3a')](_0x33aa73[_0x9214('0x36')],qs[_0x9214('0x3c')](_0x44ae44['query'][_0x9214('0x3c')]));_0x277649[_0x9214('0x3b')]=_0x277649[_0x9214('0x3b')]['length']?_0x277649['attributes']:_0x33aa73[_0x9214('0x36')];_0x277649[_0x9214('0x3f')]=qs[_0x9214('0x40')](_0x44ae44[_0x9214('0x37')]['sort']);_0x277649[_0x9214('0x41')]=qs[_0x9214('0x39')](_[_0x9214('0x42')](_0x44ae44[_0x9214('0x37')],_0x33aa73[_0x9214('0x39')]));if(_0x44ae44[_0x9214('0x37')][_0x9214('0x43')]){_0x277649[_0x9214('0x41')]=_['merge'](_0x277649[_0x9214('0x41')],{'$or':_[_0x9214('0x31')](_0x277649[_0x9214('0x3b')],function(_0x45e114){var _0x577139={};_0x577139[_0x45e114]={'$like':'%'+_0x44ae44[_0x9214('0x37')]['filter']+'%'};return _0x577139;})});}_0x277649=_[_0x9214('0x44')]({},_0x277649,_0x44ae44[_0x9214('0x45')]);return _0x1314de[_0x9214('0x65')](_0x277649);}})['then'](function(_0x18f103){if(_0x18f103){_0x4b69b0=_0x18f103[_0x9214('0x3d')];if(!_0x44ae44[_0x9214('0x37')][_0x9214('0x3e')](_0x9214('0x5a'))){_0x277649[_0x9214('0x22')]=qs[_0x9214('0x22')](_0x44ae44[_0x9214('0x37')][_0x9214('0x22')]);_0x277649[_0x9214('0x20')]=qs[_0x9214('0x20')](_0x44ae44[_0x9214('0x37')][_0x9214('0x20')]);}return _0x1314de[_0x9214('0x65')](_0x277649);}})[_0x9214('0x28')](function(_0x341811){if(_0x341811){return _0x341811?{'count':_0x4b69b0,'rows':_0x341811}:null;}})['then'](respondWithResult(_0x252b69,null))[_0x9214('0x4a')](handleError(_0x252b69,null));};exports[_0x9214('0x67')]=function(_0xfe4d5c,_0x561ede,_0x3d2e6b){var _0xc431c=_0xfe4d5c[_0x9214('0x4f')]['ids'];return db['Team'][_0x9214('0x48')]({'where':{'id':_0xc431c},'attributes':['id'],'include':[{'model':db[_0x9214('0x5c')],'as':'Agents','attributes':['id',_0x9214('0x2f'),_0x9214('0x68'),_0x9214('0x69'),_0x9214('0x6a')],'raw':!![]}]})['then'](function(_0x10aeef){if(_0x10aeef){var _0xd2502b=_['flatMap'](_0x10aeef,function(_0x1513c8){var _0x4a21fd=_0x1513c8['get']({'plain':!![]});return _0x4a21fd[_0x9214('0x6b')];});return db[_0x9214('0x32')][_0x9214('0x4d')]({'where':{'id':_0xfe4d5c[_0x9214('0x4c')]['id']}})[_0x9214('0x28')](function(_0x596d29){return db[_0x9214('0x6c')]['transaction'](function(_0x2acc71){return _0x596d29[_0x9214('0x67')](_0xc431c,{'transaction':_0x2acc71})['then'](function(){return BPromise[_0x9214('0x6d')](_0xd2502b,function(_0x40c66e){return db[_0x9214('0x59')][_0x9214('0x6e')]({'where':{'UserId':_0x40c66e['id'],'WhatsappQueueId':_0xfe4d5c[_0x9214('0x4c')]['id']},'transaction':_0x2acc71});});})['then'](function(){_0xd2502b[_0x9214('0x6f')](function(_0xcd9c57){socket['emit'](_0x9214('0x70'),{'UserId':_0xcd9c57['id'],'WhatsappQueueId':_0x596d29['id']});});});});});}})[_0x9214('0x28')](respondWithStatusCode(_0x561ede,null))['catch'](handleError(_0x561ede,null));};exports['removeTeams']=function(_0x13e9a3,_0x4c9d42,_0x5f1081){return db['Team'][_0x9214('0x48')]({'where':{'id':_0x13e9a3[_0x9214('0x37')][_0x9214('0x71')]},'attributes':['id'],'include':[{'model':db[_0x9214('0x5c')],'as':_0x9214('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4c9d42,null))['then'](function(_0x1141a1){var _0x17c1d2=_['map'](_0x1141a1,'id');var _0x5aa037=[];var _0x1824b2=[];var _0x22fac8=squel['select']();_0x22fac8[_0x9214('0x72')]('tq.TeamId')[_0x9214('0x73')](_0x9214('0x74'),'tq')[_0x9214('0x75')](_0x9214('0x76'),'ut',_0x9214('0x77'))['where'](_0x9214('0x78'),_0x13e9a3[_0x9214('0x4c')]['id']);for(var _0x5e5623=0x0;_0x5e5623<_0x1141a1[_0x9214('0x3d')];_0x5e5623+=0x1){let _0x2896c5=_0x1141a1[_0x5e5623];for(var _0x31eca4=0x0;_0x31eca4<_0x2896c5[_0x9214('0x6b')][_0x9214('0x3d')];_0x31eca4+=0x1){let _0x1a04cf=_0x2896c5[_0x9214('0x6b')][_0x31eca4];var _0x23a685=_0x22fac8[_0x9214('0x79')]();_0x23a685['where'](_0x9214('0x7a'),_0x1a04cf['id']);_0x1824b2[_0x9214('0x7b')](db['sequelize']['query'](_0x23a685[_0x9214('0x7c')](),{'type':db[_0x9214('0x6c')]['QueryTypes'][_0x9214('0x7d')]})['then'](function(_0x57ba40){if(_0x57ba40[_0x9214('0x3d')]===0x1){return _0x1a04cf['id'];}else{var _0x5a0593=_[_0x9214('0x7e')](_[_0x9214('0x31')](_0x57ba40,'TeamId'),function(_0x4bc86c){return _[_0x9214('0x7f')](_0x17c1d2,_0x4bc86c);});if(_0x5a0593){return _0x1a04cf['id'];}}}));}}return BPromise[_0x9214('0x80')](_0x1824b2)[_0x9214('0x28')](function(_0x542532){_0x5aa037=_(_0x5aa037)[_0x9214('0x81')](_0x542532)[_0x9214('0x82')]()[_0x9214('0x83')]();return db[_0x9214('0x32')][_0x9214('0x4d')]({'where':{'id':_0x13e9a3['params']['id']}})[_0x9214('0x28')](function(_0xbec90a){return db[_0x9214('0x6c')]['transaction'](function(_0x598080){return _0xbec90a[_0x9214('0x84')](_0x13e9a3[_0x9214('0x37')]['ids'],{'transaction':_0x598080})['then'](function(){if(!_['isEmpty'](_0x5aa037)){return _0xbec90a[_0x9214('0x85')](_0x5aa037,{'transaction':_0x598080});}})[_0x9214('0x28')](function(){_0x5aa037[_0x9214('0x6f')](function(_0x2c6543){socket[_0x9214('0x86')](_0x9214('0x87'),{'UserId':_0x2c6543,'WhatsappQueueId':_0xbec90a['id']});});});});});});})['then'](respondWithStatusCode(_0x4c9d42,null))[_0x9214('0x4a')](handleError(_0x4c9d42,null));};exports[_0x9214('0x88')]=function(_0x4c2a10,_0x4d2f39,_0xa139ee){return db['WhatsappQueue'][_0x9214('0x4d')]({'where':{'id':_0x4c2a10['params']['id']}})[_0x9214('0x28')](handleEntityNotFound(_0x4d2f39,null))[_0x9214('0x28')](function(_0x7243f9){if(_0x7243f9){return _0x7243f9[_0x9214('0x88')](_0x4c2a10[_0x9214('0x4f')][_0x9214('0x71')],_['omit'](_0x4c2a10['body'],[_0x9214('0x71'),'id'])||{})['spread'](function(_0x1f5b95){for(var _0x240f3f=0x0;_0x240f3f<_0x4c2a10[_0x9214('0x4f')][_0x9214('0x71')][_0x9214('0x3d')];_0x240f3f+=0x1){socket[_0x9214('0x86')](_0x9214('0x70'),{'UserId':Number(_0x4c2a10['body'][_0x9214('0x71')][_0x240f3f]),'WhatsappQueueId':Number(_0x4c2a10[_0x9214('0x4c')]['id'])});}return _0x1f5b95;});}})[_0x9214('0x28')](respondWithResult(_0x4d2f39,null))[_0x9214('0x4a')](handleError(_0x4d2f39,null));};exports['removeAgents']=function(_0x42cf09,_0x79197a,_0x2a968b){return db['WhatsappQueue'][_0x9214('0x4d')]({'where':{'id':_0x42cf09[_0x9214('0x4c')]['id']}})[_0x9214('0x28')](handleEntityNotFound(_0x79197a,null))['then'](function(_0x2d0474){if(_0x2d0474){return _0x2d0474[_0x9214('0x85')](_0x42cf09[_0x9214('0x37')][_0x9214('0x71')])[_0x9214('0x28')](function(){if(_[_0x9214('0x89')](_0x42cf09[_0x9214('0x37')][_0x9214('0x71')])){for(var _0xcc3d43=0x0;_0xcc3d43<_0x42cf09['query'][_0x9214('0x71')][_0x9214('0x3d')];_0xcc3d43+=0x1){socket['emit'](_0x9214('0x87'),{'UserId':Number(_0x42cf09[_0x9214('0x37')][_0x9214('0x71')][_0xcc3d43]),'WhatsappQueueId':Number(_0x42cf09[_0x9214('0x4c')]['id'])});}}else{socket[_0x9214('0x86')]('userWhatsappQueue:remove',{'UserId':Number(_0x42cf09[_0x9214('0x37')][_0x9214('0x71')]),'WhatsappQueueId':Number(_0x42cf09[_0x9214('0x4c')]['id'])});}});}})[_0x9214('0x28')](respondWithStatusCode(_0x79197a,null))[_0x9214('0x4a')](handleError(_0x79197a,null));};exports[_0x9214('0x8a')]=function(_0x4aaa27,_0x32777d,_0x265c97){var _0x368153={};var _0x5e3277={};var _0xff260e;var _0x165bc2;return db[_0x9214('0x32')][_0x9214('0x58')]({'where':{'id':_0x4aaa27[_0x9214('0x4c')]['id']}})[_0x9214('0x28')](handleEntityNotFound(_0x32777d,null))['then'](function(_0x4ef315){if(_0x4ef315){_0xff260e=_0x4ef315;_0x5e3277[_0x9214('0x36')]=_[_0x9214('0x38')](db['User']['rawAttributes']);_0x5e3277[_0x9214('0x37')]=_[_0x9214('0x38')](_0x4aaa27['query']);_0x5e3277[_0x9214('0x39')]=_[_0x9214('0x3a')](_0x5e3277['model'],_0x5e3277[_0x9214('0x37')]);_0x368153[_0x9214('0x3b')]=_[_0x9214('0x3a')](_0x5e3277[_0x9214('0x36')],qs[_0x9214('0x3c')](_0x4aaa27['query'][_0x9214('0x3c')]));_0x368153['attributes']=_0x368153[_0x9214('0x3b')][_0x9214('0x3d')]?_0x368153[_0x9214('0x3b')]:_0x5e3277['model'];_0x368153[_0x9214('0x3f')]=qs[_0x9214('0x40')](_0x4aaa27[_0x9214('0x37')][_0x9214('0x40')]);_0x368153[_0x9214('0x41')]=qs[_0x9214('0x39')](_[_0x9214('0x42')](_0x4aaa27['query'],_0x5e3277[_0x9214('0x39')]));if(_0x4aaa27[_0x9214('0x37')]['filter']){_0x368153['where']=_['merge'](_0x368153[_0x9214('0x41')],{'$or':_[_0x9214('0x31')](_0x368153['attributes'],function(_0x3bbb96){var _0x3a5532={};_0x3a5532[_0x3bbb96]={'$like':'%'+_0x4aaa27['query']['filter']+'%'};return _0x3a5532;})});}_0x368153=_['merge']({},_0x368153,_0x4aaa27[_0x9214('0x45')]);return _0xff260e['getAgents'](_0x368153);}})[_0x9214('0x28')](function(_0x34dbac){if(_0x34dbac){_0x165bc2=_0x34dbac['length'];if(!_0x4aaa27['query'][_0x9214('0x3e')]('nolimit')){_0x368153[_0x9214('0x22')]=qs[_0x9214('0x22')](_0x4aaa27['query']['limit']);_0x368153[_0x9214('0x20')]=qs['offset'](_0x4aaa27[_0x9214('0x37')][_0x9214('0x20')]);}return _0xff260e[_0x9214('0x8a')](_0x368153);}})['then'](function(_0x11242d){if(_0x11242d){return _0x11242d?{'count':_0x165bc2,'rows':_0x11242d}:null;}})['then'](respondWithResult(_0x32777d,null))[_0x9214('0x4a')](handleError(_0x32777d,null));};
\ No newline at end of file
+var _0x40e5=['../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','WhatsappQueues','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','WhatsappQueue','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','%s/%s','SIP','Team','getTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','emit','userWhatsappQueue:save','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','includes','union','compact','value','removeTeams','removeAgents','forEach','addAgents','omit','userWhatsappQueue:remove','getAgents','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xa8f776,_0x420cbf){var _0x435961=function(_0x241c69){while(--_0x241c69){_0xa8f776['push'](_0xa8f776['shift']());}};_0x435961(++_0x420cbf);}(_0x40e5,0x76));var _0x540e=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x40e5[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x540e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x540e('0x1'));var rp=require(_0x540e('0x2'));var moment=require('moment');var BPromise=require(_0x540e('0x3'));var Mustache=require('mustache');var util=require(_0x540e('0x4'));var path=require(_0x540e('0x5'));var sox=require(_0x540e('0x6'));var csv=require(_0x540e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x540e('0x8'));var _=require(_0x540e('0x9'));var squel=require(_0x540e('0xa'));var crypto=require(_0x540e('0xb'));var jsforce=require(_0x540e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x540e('0x7'));var querystring=require(_0x540e('0xd'));var Papa=require(_0x540e('0xe'));var Redis=require(_0x540e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x540e('0x10'));var as=require(_0x540e('0x11'));var hardwareService=require(_0x540e('0x12'));var logger=require(_0x540e('0x13'))('api');var utils=require(_0x540e('0x14'));var config=require(_0x540e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x540e('0x16'))['db'];config[_0x540e('0x17')]=_[_0x540e('0x18')](config[_0x540e('0x17')],{'host':_0x540e('0x19'),'port':0x18eb});var socket=require(_0x540e('0x1a'))(new Redis(config['redis']));require(_0x540e('0x1b'))[_0x540e('0x1c')](socket);function respondWithStatusCode(_0x2aa33b,_0x187277){_0x187277=_0x187277||0xcc;return function(_0x1b9bc3){if(_0x1b9bc3){return _0x2aa33b[_0x540e('0x1d')](_0x187277);}return _0x2aa33b[_0x540e('0x1e')](_0x187277)[_0x540e('0x1f')]();};}function respondWithResult(_0x3c0c6d,_0x5cd3d8){_0x5cd3d8=_0x5cd3d8||0xc8;return function(_0x43a3da){if(_0x43a3da){return _0x3c0c6d[_0x540e('0x1e')](_0x5cd3d8)[_0x540e('0x20')](_0x43a3da);}};}function respondWithFilteredResult(_0x2fb602,_0x47b4a0){return function(_0x335dde){if(_0x335dde){var _0x50b9e6=typeof _0x47b4a0[_0x540e('0x21')]===_0x540e('0x22')&&typeof _0x47b4a0['limit']===_0x540e('0x22');var _0xe7d84=_0x335dde[_0x540e('0x23')];var _0xad9c6f=_0x50b9e6?0x0:_0x47b4a0[_0x540e('0x21')];var _0x24913f=_0x50b9e6?_0x335dde['count']:_0x47b4a0[_0x540e('0x21')]+_0x47b4a0[_0x540e('0x24')];var _0x55db12;if(_0x24913f>=_0xe7d84){_0x24913f=_0xe7d84;_0x55db12=0xc8;}else{_0x55db12=0xce;}_0x2fb602['status'](_0x55db12);return _0x2fb602[_0x540e('0x25')](_0x540e('0x26'),_0xad9c6f+'-'+_0x24913f+'/'+_0xe7d84)[_0x540e('0x20')](_0x335dde);}return null;};}function patchUpdates(_0x30358f){return function(_0x18c403){try{jsonpatch[_0x540e('0x27')](_0x18c403,_0x30358f,!![]);}catch(_0x2f92c0){return BPromise[_0x540e('0x28')](_0x2f92c0);}return _0x18c403[_0x540e('0x29')]();};}function saveUpdates(_0x6c1647,_0x3e70b6){return function(_0x1e58ad){if(_0x1e58ad){return _0x1e58ad[_0x540e('0x2a')](_0x6c1647)[_0x540e('0x2b')](function(_0x29cfcd){return _0x29cfcd;});}return null;};}function removeEntity(_0x1bbde2,_0x10c09d){return function(_0xceee56){if(_0xceee56){return _0xceee56[_0x540e('0x2c')]()[_0x540e('0x2b')](function(){var _0x41465b=_0xceee56['get']({'plain':!![]});var _0x132b14=_0x540e('0x2d');return db[_0x540e('0x2e')][_0x540e('0x2c')]({'where':{'type':_0x132b14,'resourceId':_0x41465b['id']}})[_0x540e('0x2b')](function(){return _0xceee56;});})['then'](function(){_0x1bbde2[_0x540e('0x1e')](0xcc)[_0x540e('0x1f')]();});}};}function handleEntityNotFound(_0x2ea25b,_0x374fb4){return function(_0x22cdac){if(!_0x22cdac){_0x2ea25b[_0x540e('0x1d')](0x194);}return _0x22cdac;};}function handleError(_0x1ec274,_0x102057){_0x102057=_0x102057||0x1f4;return function(_0x35c30c){logger[_0x540e('0x2f')](_0x35c30c[_0x540e('0x30')]);if(_0x35c30c[_0x540e('0x31')]){delete _0x35c30c[_0x540e('0x31')];}_0x1ec274[_0x540e('0x1e')](_0x102057)['send'](_0x35c30c);};}exports[_0x540e('0x32')]=function(_0x5e87f1,_0x46b1bc){var _0x2129a8={},_0x4869aa={},_0x19a971={'count':0x0,'rows':[]};var _0xa9a6f1=_[_0x540e('0x33')](db['WhatsappQueue'][_0x540e('0x34')],function(_0x3f9e9a){return{'name':_0x3f9e9a[_0x540e('0x35')],'type':_0x3f9e9a[_0x540e('0x36')][_0x540e('0x37')]};});_0x4869aa[_0x540e('0x38')]=_[_0x540e('0x33')](_0xa9a6f1,_0x540e('0x31'));_0x4869aa[_0x540e('0x39')]=_[_0x540e('0x3a')](_0x5e87f1[_0x540e('0x39')]);_0x4869aa[_0x540e('0x3b')]=_[_0x540e('0x3c')](_0x4869aa[_0x540e('0x38')],_0x4869aa[_0x540e('0x39')]);_0x2129a8[_0x540e('0x3d')]=_['intersection'](_0x4869aa['model'],qs['fields'](_0x5e87f1['query'][_0x540e('0x3e')]));_0x2129a8[_0x540e('0x3d')]=_0x2129a8[_0x540e('0x3d')][_0x540e('0x3f')]?_0x2129a8['attributes']:_0x4869aa['model'];if(!_0x5e87f1[_0x540e('0x39')][_0x540e('0x40')](_0x540e('0x41'))){_0x2129a8[_0x540e('0x24')]=qs[_0x540e('0x24')](_0x5e87f1[_0x540e('0x39')][_0x540e('0x24')]);_0x2129a8['offset']=qs['offset'](_0x5e87f1['query'][_0x540e('0x21')]);}_0x2129a8[_0x540e('0x42')]=qs[_0x540e('0x43')](_0x5e87f1[_0x540e('0x39')][_0x540e('0x43')]);_0x2129a8[_0x540e('0x44')]=qs[_0x540e('0x3b')](_[_0x540e('0x45')](_0x5e87f1[_0x540e('0x39')],_0x4869aa[_0x540e('0x3b')]),_0xa9a6f1);if(_0x5e87f1[_0x540e('0x39')]['filter']){_0x2129a8['where']=_[_0x540e('0x46')](_0x2129a8['where'],{'$or':_[_0x540e('0x33')](_0xa9a6f1,function(_0x1a3f0b){if(_0x1a3f0b[_0x540e('0x36')]!==_0x540e('0x47')){var _0x2c4e76={};_0x2c4e76[_0x1a3f0b[_0x540e('0x31')]]={'$like':'%'+_0x5e87f1[_0x540e('0x39')][_0x540e('0x48')]+'%'};return _0x2c4e76;}})});}_0x2129a8=_[_0x540e('0x46')]({},_0x2129a8,_0x5e87f1[_0x540e('0x49')]);var _0x10c25f={'where':_0x2129a8[_0x540e('0x44')]};return db[_0x540e('0x4a')][_0x540e('0x23')](_0x10c25f)['then'](function(_0x2d6b2c){_0x19a971[_0x540e('0x23')]=_0x2d6b2c;if(_0x5e87f1[_0x540e('0x39')][_0x540e('0x4b')]){_0x2129a8[_0x540e('0x4c')]=[{'all':!![]}];}return db[_0x540e('0x4a')][_0x540e('0x4d')](_0x2129a8);})[_0x540e('0x2b')](function(_0x3e7726){_0x19a971[_0x540e('0x4e')]=_0x3e7726;return _0x19a971;})[_0x540e('0x2b')](respondWithFilteredResult(_0x46b1bc,_0x2129a8))['catch'](handleError(_0x46b1bc,null));};exports[_0x540e('0x4f')]=function(_0x564f49,_0x3bed48){var _0x1fb718={'raw':!![],'where':{'id':_0x564f49[_0x540e('0x50')]['id']}},_0x36b89b={};_0x36b89b[_0x540e('0x38')]=_[_0x540e('0x3a')](db['WhatsappQueue'][_0x540e('0x34')]);_0x36b89b['query']=_['keys'](_0x564f49[_0x540e('0x39')]);_0x36b89b[_0x540e('0x3b')]=_[_0x540e('0x3c')](_0x36b89b['model'],_0x36b89b[_0x540e('0x39')]);_0x1fb718[_0x540e('0x3d')]=_[_0x540e('0x3c')](_0x36b89b['model'],qs['fields'](_0x564f49['query'][_0x540e('0x3e')]));_0x1fb718['attributes']=_0x1fb718[_0x540e('0x3d')]['length']?_0x1fb718['attributes']:_0x36b89b[_0x540e('0x38')];if(_0x564f49[_0x540e('0x39')][_0x540e('0x4b')]){_0x1fb718['include']=[{'all':!![]}];}_0x1fb718=_[_0x540e('0x46')]({},_0x1fb718,_0x564f49['options']);return db[_0x540e('0x4a')][_0x540e('0x51')](_0x1fb718)['then'](handleEntityNotFound(_0x3bed48,null))['then'](respondWithResult(_0x3bed48,null))[_0x540e('0x52')](handleError(_0x3bed48,null));};exports[_0x540e('0x53')]=function(_0x299ba3,_0x591b8c){return db[_0x540e('0x4a')]['create'](_0x299ba3[_0x540e('0x54')],{})['then'](function(_0x3cba63){var _0x5d448f=_0x299ba3[_0x540e('0x55')]['get']({'plain':!![]});if(!_0x5d448f)throw new Error(_0x540e('0x56'));if(_0x5d448f[_0x540e('0x57')]===_0x540e('0x55')){var _0x14bdcd=_0x3cba63[_0x540e('0x58')]({'plain':!![]});var _0x4eb9ad='WhatsappQueues';return db[_0x540e('0x59')][_0x540e('0x51')]({'where':{'name':_0x4eb9ad,'userProfileId':_0x5d448f[_0x540e('0x5a')]},'raw':!![]})[_0x540e('0x2b')](function(_0x333719){if(_0x333719&&_0x333719['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x14bdcd[_0x540e('0x31')],'resourceId':_0x14bdcd['id'],'type':_0x333719[_0x540e('0x31')],'sectionId':_0x333719['id']},{})['then'](function(){return _0x3cba63;});}else{return _0x3cba63;}})['catch'](function(_0x1f8595){logger['error'](_0x540e('0x5b'),_0x1f8595);throw _0x1f8595;});}return _0x3cba63;})[_0x540e('0x2b')](respondWithResult(_0x591b8c,0xc9))[_0x540e('0x52')](handleError(_0x591b8c,null));};exports[_0x540e('0x2a')]=function(_0x49e35d,_0x3b22d1){if(_0x49e35d[_0x540e('0x54')]['id']){delete _0x49e35d['body']['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x49e35d[_0x540e('0x50')]['id']}})[_0x540e('0x2b')](handleEntityNotFound(_0x3b22d1,null))[_0x540e('0x2b')](saveUpdates(_0x49e35d[_0x540e('0x54')],null))[_0x540e('0x2b')](respondWithResult(_0x3b22d1,null))[_0x540e('0x52')](handleError(_0x3b22d1,null));};exports[_0x540e('0x2c')]=function(_0x3bbd3c,_0x5cb5e9){return db['WhatsappQueue']['find']({'where':{'id':_0x3bbd3c['params']['id']}})[_0x540e('0x2b')](handleEntityNotFound(_0x5cb5e9,null))[_0x540e('0x2b')](removeEntity(_0x5cb5e9,null))['catch'](handleError(_0x5cb5e9,null));};exports['describe']=function(_0x414729,_0x442fa0){return db['WhatsappQueue'][_0x540e('0x5c')]()['then'](respondWithResult(_0x442fa0,null))[_0x540e('0x52')](handleError(_0x442fa0,null));};exports['getMembers']=function(_0x4ef124,_0x2f6c07,_0x558041){var _0x357dbd={'raw':!![],'where':{}},_0x1eb6b2={},_0x37a49b;return db[_0x540e('0x4a')][_0x540e('0x5d')]({'where':{'id':_0x4ef124[_0x540e('0x50')]['id']}})['then'](handleEntityNotFound(_0x2f6c07,null))[_0x540e('0x2b')](function(_0x40665b){if(_0x40665b){_0x37a49b=_0x40665b[_0x540e('0x58')]({'plain':!![]});_0x1eb6b2['model']=_[_0x540e('0x3a')](db[_0x540e('0x5e')][_0x540e('0x34')]);_0x1eb6b2[_0x540e('0x39')]=_[_0x540e('0x3a')](_0x4ef124['query']);_0x1eb6b2['filters']=_['intersection'](_0x1eb6b2[_0x540e('0x38')],_0x1eb6b2[_0x540e('0x39')]);_0x357dbd[_0x540e('0x3d')]=_['intersection'](_0x1eb6b2['model'],qs[_0x540e('0x3e')](_0x4ef124[_0x540e('0x39')][_0x540e('0x3e')]));_0x357dbd[_0x540e('0x3d')]=_0x357dbd['attributes'][_0x540e('0x3f')]?_0x357dbd[_0x540e('0x3d')]:_0x1eb6b2['model'];if(!_0x4ef124[_0x540e('0x39')]['hasOwnProperty'](_0x540e('0x41'))){_0x357dbd[_0x540e('0x24')]=qs[_0x540e('0x24')](_0x4ef124[_0x540e('0x39')][_0x540e('0x24')]);_0x357dbd[_0x540e('0x21')]=qs[_0x540e('0x21')](_0x4ef124[_0x540e('0x39')][_0x540e('0x21')]);}_0x357dbd[_0x540e('0x42')]=qs[_0x540e('0x43')](_0x4ef124[_0x540e('0x39')][_0x540e('0x43')]);_0x357dbd[_0x540e('0x44')]=qs[_0x540e('0x3b')](_[_0x540e('0x45')](_0x4ef124[_0x540e('0x39')],_0x1eb6b2[_0x540e('0x3b')]));_0x357dbd[_0x540e('0x44')][_0x540e('0x5f')]=_0x40665b['id'];if(_0x4ef124[_0x540e('0x39')]['filter']){_0x357dbd['where']=_[_0x540e('0x46')](_0x357dbd[_0x540e('0x44')],{'$or':_[_0x540e('0x33')](_0x357dbd[_0x540e('0x3d')],function(_0x56c3bf){var _0x5c726f={};_0x5c726f[_0x56c3bf]={'$like':'%'+_0x4ef124[_0x540e('0x39')][_0x540e('0x48')]+'%'};return _0x5c726f;})});}_0x357dbd=_['merge']({},_0x357dbd,_0x4ef124[_0x540e('0x49')]);return db[_0x540e('0x5e')][_0x540e('0x4d')](_0x357dbd);}})[_0x540e('0x2b')](function(_0x2db0ac){if(_0x2db0ac){return db['User'][_0x540e('0x60')]({'where':{'id':_['map'](_0x2db0ac,_0x540e('0x61')),'role':_0x540e('0x62')},'attributes':['id',_0x540e('0x31'),_0x540e('0x63'),_0x540e('0x64'),'createdAt']});}})['then'](function(_0x242144){if(_0x242144){return{'count':_0x242144[_0x540e('0x23')],'rows':_[_0x540e('0x33')](_0x242144[_0x540e('0x4e')],function(_0x346bb0){return{'membername':_0x346bb0[_0x540e('0x31')],'UserId':_0x346bb0['id'],'queue_name':_0x37a49b[_0x540e('0x31')],'WhatsappQueueId':_0x37a49b['id'],'interface':util[_0x540e('0x65')](_0x540e('0x66'),_0x540e('0x67'),_0x346bb0[_0x540e('0x31')]),'penalty':0x0,'paused':_0x346bb0['whatsappPause'],'createdAt':_0x346bb0['createdAt'],'updatedAt':_0x346bb0[_0x540e('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x540e('0x2b')](respondWithFilteredResult(_0x2f6c07,_0x357dbd))[_0x540e('0x52')](handleError(_0x2f6c07,null));};exports['getTeams']=function(_0x45fa95,_0x4b27e7,_0x298800){var _0x214151={};var _0xf441ba={};var _0x315b62;var _0x1040e3;return db[_0x540e('0x4a')]['findOne']({'where':{'id':_0x45fa95[_0x540e('0x50')]['id']}})['then'](handleEntityNotFound(_0x4b27e7,null))['then'](function(_0x4d19f6){if(_0x4d19f6){_0x315b62=_0x4d19f6;_0xf441ba[_0x540e('0x38')]=_[_0x540e('0x3a')](db[_0x540e('0x68')][_0x540e('0x34')]);_0xf441ba[_0x540e('0x39')]=_[_0x540e('0x3a')](_0x45fa95[_0x540e('0x39')]);_0xf441ba[_0x540e('0x3b')]=_['intersection'](_0xf441ba[_0x540e('0x38')],_0xf441ba[_0x540e('0x39')]);_0x214151[_0x540e('0x3d')]=_['intersection'](_0xf441ba['model'],qs[_0x540e('0x3e')](_0x45fa95[_0x540e('0x39')][_0x540e('0x3e')]));_0x214151['attributes']=_0x214151['attributes']['length']?_0x214151['attributes']:_0xf441ba[_0x540e('0x38')];_0x214151[_0x540e('0x42')]=qs[_0x540e('0x43')](_0x45fa95['query'][_0x540e('0x43')]);_0x214151['where']=qs['filters'](_[_0x540e('0x45')](_0x45fa95['query'],_0xf441ba[_0x540e('0x3b')]));if(_0x45fa95['query'][_0x540e('0x48')]){_0x214151['where']=_[_0x540e('0x46')](_0x214151['where'],{'$or':_[_0x540e('0x33')](_0x214151[_0x540e('0x3d')],function(_0x552388){var _0x4d0e74={};_0x4d0e74[_0x552388]={'$like':'%'+_0x45fa95[_0x540e('0x39')][_0x540e('0x48')]+'%'};return _0x4d0e74;})});}_0x214151=_['merge']({},_0x214151,_0x45fa95[_0x540e('0x49')]);return _0x315b62[_0x540e('0x69')](_0x214151);}})['then'](function(_0x5861e8){if(_0x5861e8){_0x1040e3=_0x5861e8[_0x540e('0x3f')];if(!_0x45fa95[_0x540e('0x39')][_0x540e('0x40')](_0x540e('0x41'))){_0x214151[_0x540e('0x24')]=qs[_0x540e('0x24')](_0x45fa95[_0x540e('0x39')][_0x540e('0x24')]);_0x214151[_0x540e('0x21')]=qs['offset'](_0x45fa95[_0x540e('0x39')]['offset']);}return _0x315b62[_0x540e('0x69')](_0x214151);}})[_0x540e('0x2b')](function(_0x3eab21){if(_0x3eab21){return _0x3eab21?{'count':_0x1040e3,'rows':_0x3eab21}:null;}})[_0x540e('0x2b')](respondWithResult(_0x4b27e7,null))[_0x540e('0x52')](handleError(_0x4b27e7,null));};exports['addTeams']=function(_0x51a2f0,_0xb0dc0b,_0x108198){var _0x3119df=_0x51a2f0[_0x540e('0x54')][_0x540e('0x6a')];return db[_0x540e('0x68')][_0x540e('0x4d')]({'where':{'id':_0x3119df},'attributes':['id'],'include':[{'model':db[_0x540e('0x6b')],'as':_0x540e('0x6c'),'attributes':['id',_0x540e('0x31'),_0x540e('0x6d'),_0x540e('0x6e'),'interface'],'raw':!![]}]})[_0x540e('0x2b')](function(_0x1408d5){if(_0x1408d5){var _0x52c411=_[_0x540e('0x6f')](_0x1408d5,function(_0x17615c){var _0x2b407f=_0x17615c[_0x540e('0x58')]({'plain':!![]});return _0x2b407f[_0x540e('0x6c')];});return db[_0x540e('0x4a')]['find']({'where':{'id':_0x51a2f0[_0x540e('0x50')]['id']}})[_0x540e('0x2b')](function(_0x5d561b){return db[_0x540e('0x70')][_0x540e('0x71')](function(_0x58deb4){return _0x5d561b['addTeams'](_0x3119df,{'transaction':_0x58deb4})['then'](function(){return BPromise['each'](_0x52c411,function(_0x28bbe9){return db['UserWhatsappQueue'][_0x540e('0x72')]({'where':{'UserId':_0x28bbe9['id'],'WhatsappQueueId':_0x51a2f0['params']['id']},'transaction':_0x58deb4});});})['then'](function(){_0x52c411['forEach'](function(_0x18f307){socket[_0x540e('0x73')](_0x540e('0x74'),{'UserId':_0x18f307['id'],'WhatsappQueueId':_0x5d561b['id']});});});});});}})[_0x540e('0x2b')](respondWithStatusCode(_0xb0dc0b,null))[_0x540e('0x52')](handleError(_0xb0dc0b,null));};exports['removeTeams']=function(_0x122775,_0x419b5e,_0x3f8e0a){return db[_0x540e('0x68')][_0x540e('0x4d')]({'where':{'id':_0x122775[_0x540e('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x540e('0x6b')],'as':_0x540e('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x540e('0x2b')](handleEntityNotFound(_0x419b5e,null))[_0x540e('0x2b')](function(_0x239967){var _0x5bf1c4=_[_0x540e('0x33')](_0x239967,'id');var _0x16f6a7=[];var _0x140fef=[];var _0x18fbe4=squel[_0x540e('0x75')]();_0x18fbe4[_0x540e('0x76')](_0x540e('0x77'))['from']('team_has_whatsapp_queues','tq')[_0x540e('0x78')](_0x540e('0x79'),'ut',_0x540e('0x7a'))['where']('WhatsappQueueId\x20=\x20?',_0x122775['params']['id']);for(var _0x51b33a=0x0;_0x51b33a<_0x239967['length'];_0x51b33a+=0x1){let _0x33560d=_0x239967[_0x51b33a];for(var _0x2f2d7b=0x0;_0x2f2d7b<_0x33560d[_0x540e('0x6c')][_0x540e('0x3f')];_0x2f2d7b+=0x1){let _0x38c6cd=_0x33560d['Agents'][_0x2f2d7b];var _0x31e7e0=_0x18fbe4[_0x540e('0x7b')]();_0x31e7e0[_0x540e('0x44')](_0x540e('0x7c'),_0x38c6cd['id']);_0x140fef[_0x540e('0x7d')](db[_0x540e('0x70')][_0x540e('0x39')](_0x31e7e0['toString'](),{'type':db[_0x540e('0x70')][_0x540e('0x7e')]['SELECT']})[_0x540e('0x2b')](function(_0x193d2c){if(_0x193d2c['length']===0x1){return _0x38c6cd['id'];}else{var _0x2f7f57=_['every'](_[_0x540e('0x33')](_0x193d2c,'TeamId'),function(_0x203aee){return _[_0x540e('0x7f')](_0x5bf1c4,_0x203aee);});if(_0x2f7f57){return _0x38c6cd['id'];}}}));}}return BPromise['all'](_0x140fef)['then'](function(_0x315abc){_0x16f6a7=_(_0x16f6a7)[_0x540e('0x80')](_0x315abc)[_0x540e('0x81')]()[_0x540e('0x82')]();return db[_0x540e('0x4a')][_0x540e('0x51')]({'where':{'id':_0x122775[_0x540e('0x50')]['id']}})[_0x540e('0x2b')](function(_0x142499){return db[_0x540e('0x70')][_0x540e('0x71')](function(_0x385690){return _0x142499[_0x540e('0x83')](_0x122775[_0x540e('0x39')]['ids'],{'transaction':_0x385690})[_0x540e('0x2b')](function(){if(!_['isEmpty'](_0x16f6a7)){return _0x142499[_0x540e('0x84')](_0x16f6a7,{'transaction':_0x385690});}})[_0x540e('0x2b')](function(){_0x16f6a7[_0x540e('0x85')](function(_0x3b5183){socket[_0x540e('0x73')]('userWhatsappQueue:remove',{'UserId':_0x3b5183,'WhatsappQueueId':_0x142499['id']});});});});});});})['then'](respondWithStatusCode(_0x419b5e,null))[_0x540e('0x52')](handleError(_0x419b5e,null));};exports['addAgents']=function(_0x6c7350,_0x3cd82a,_0x1546ab){return db[_0x540e('0x4a')][_0x540e('0x51')]({'where':{'id':_0x6c7350[_0x540e('0x50')]['id']}})[_0x540e('0x2b')](handleEntityNotFound(_0x3cd82a,null))[_0x540e('0x2b')](function(_0x5e411f){if(_0x5e411f){return _0x5e411f[_0x540e('0x86')](_0x6c7350[_0x540e('0x54')][_0x540e('0x6a')],_[_0x540e('0x87')](_0x6c7350[_0x540e('0x54')],[_0x540e('0x6a'),'id'])||{})['spread'](function(_0x28ad05){for(var _0x57e946=0x0;_0x57e946<_0x6c7350[_0x540e('0x54')][_0x540e('0x6a')][_0x540e('0x3f')];_0x57e946+=0x1){socket[_0x540e('0x73')](_0x540e('0x74'),{'UserId':Number(_0x6c7350[_0x540e('0x54')][_0x540e('0x6a')][_0x57e946]),'WhatsappQueueId':Number(_0x6c7350[_0x540e('0x50')]['id'])});}return _0x28ad05;});}})[_0x540e('0x2b')](respondWithResult(_0x3cd82a,null))[_0x540e('0x52')](handleError(_0x3cd82a,null));};exports[_0x540e('0x84')]=function(_0x1d1ad2,_0x2a6f68,_0xd92221){return db['WhatsappQueue'][_0x540e('0x51')]({'where':{'id':_0x1d1ad2[_0x540e('0x50')]['id']}})[_0x540e('0x2b')](handleEntityNotFound(_0x2a6f68,null))[_0x540e('0x2b')](function(_0x27b981){if(_0x27b981){return _0x27b981[_0x540e('0x84')](_0x1d1ad2[_0x540e('0x39')][_0x540e('0x6a')])[_0x540e('0x2b')](function(){if(_['isArray'](_0x1d1ad2[_0x540e('0x39')][_0x540e('0x6a')])){for(var _0xbf5363=0x0;_0xbf5363<_0x1d1ad2[_0x540e('0x39')]['ids'][_0x540e('0x3f')];_0xbf5363+=0x1){socket[_0x540e('0x73')](_0x540e('0x88'),{'UserId':Number(_0x1d1ad2[_0x540e('0x39')]['ids'][_0xbf5363]),'WhatsappQueueId':Number(_0x1d1ad2[_0x540e('0x50')]['id'])});}}else{socket[_0x540e('0x73')](_0x540e('0x88'),{'UserId':Number(_0x1d1ad2[_0x540e('0x39')][_0x540e('0x6a')]),'WhatsappQueueId':Number(_0x1d1ad2[_0x540e('0x50')]['id'])});}});}})[_0x540e('0x2b')](respondWithStatusCode(_0x2a6f68,null))[_0x540e('0x52')](handleError(_0x2a6f68,null));};exports[_0x540e('0x89')]=function(_0x3d33b1,_0xaf4c19,_0x33aa21){var _0x58ec7d={};var _0x2db14c={};var _0x2c3f91;var _0x12618f;return db[_0x540e('0x4a')][_0x540e('0x5d')]({'where':{'id':_0x3d33b1[_0x540e('0x50')]['id']}})[_0x540e('0x2b')](handleEntityNotFound(_0xaf4c19,null))[_0x540e('0x2b')](function(_0x23e2a1){if(_0x23e2a1){_0x2c3f91=_0x23e2a1;_0x2db14c[_0x540e('0x38')]=_['keys'](db[_0x540e('0x6b')][_0x540e('0x34')]);_0x2db14c[_0x540e('0x39')]=_['keys'](_0x3d33b1['query']);_0x2db14c['filters']=_['intersection'](_0x2db14c[_0x540e('0x38')],_0x2db14c[_0x540e('0x39')]);_0x58ec7d['attributes']=_[_0x540e('0x3c')](_0x2db14c[_0x540e('0x38')],qs['fields'](_0x3d33b1[_0x540e('0x39')]['fields']));_0x58ec7d['attributes']=_0x58ec7d['attributes']['length']?_0x58ec7d[_0x540e('0x3d')]:_0x2db14c['model'];_0x58ec7d['order']=qs[_0x540e('0x43')](_0x3d33b1[_0x540e('0x39')][_0x540e('0x43')]);_0x58ec7d[_0x540e('0x44')]=qs[_0x540e('0x3b')](_[_0x540e('0x45')](_0x3d33b1['query'],_0x2db14c['filters']));if(_0x3d33b1[_0x540e('0x39')][_0x540e('0x48')]){_0x58ec7d[_0x540e('0x44')]=_['merge'](_0x58ec7d[_0x540e('0x44')],{'$or':_[_0x540e('0x33')](_0x58ec7d['attributes'],function(_0x2a726a){var _0x518a4f={};_0x518a4f[_0x2a726a]={'$like':'%'+_0x3d33b1[_0x540e('0x39')][_0x540e('0x48')]+'%'};return _0x518a4f;})});}_0x58ec7d=_[_0x540e('0x46')]({},_0x58ec7d,_0x3d33b1[_0x540e('0x49')]);return _0x2c3f91['getAgents'](_0x58ec7d);}})[_0x540e('0x2b')](function(_0x43becb){if(_0x43becb){_0x12618f=_0x43becb['length'];if(!_0x3d33b1['query'][_0x540e('0x40')]('nolimit')){_0x58ec7d[_0x540e('0x24')]=qs[_0x540e('0x24')](_0x3d33b1['query'][_0x540e('0x24')]);_0x58ec7d[_0x540e('0x21')]=qs[_0x540e('0x21')](_0x3d33b1['query'][_0x540e('0x21')]);}return _0x2c3f91[_0x540e('0x89')](_0x58ec7d);}})[_0x540e('0x2b')](function(_0x5a35f9){if(_0x5a35f9){return _0x5a35f9?{'count':_0x12618f,'rows':_0x5a35f9}:null;}})[_0x540e('0x2b')](respondWithResult(_0xaf4c19,null))[_0x540e('0x52')](handleError(_0xaf4c19,null));};
\ No newline at end of file
index c0954a3..bd730f1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe9c1=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9c1,0x13f));var _0x1e9c=function(_0x383b8b,_0x3a4520){_0x383b8b=_0x383b8b-0x0;var _0x1c7781=_0xe9c1[_0x383b8b];return _0x1c7781;};'use strict';var EventEmitter=require(_0x1e9c('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x1e9c('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x1e9c('0x2')](0x0);var events={'afterCreate':_0x1e9c('0x3'),'afterUpdate':_0x1e9c('0x4'),'afterDestroy':_0x1e9c('0x5')};function emitEvent(_0x29dd54){return function(_0x2d4bad,_0x38d1c4,_0x2e7cb4){WhatsappQueueEvents['emit'](_0x29dd54+':'+_0x2d4bad['id'],_0x2d4bad);WhatsappQueueEvents[_0x1e9c('0x6')](_0x29dd54,_0x2d4bad);_0x2e7cb4(null);};}for(var e in events){if(events[_0x1e9c('0x7')](e)){var event=events[e];WhatsappQueue[_0x1e9c('0x8')](e,emitEvent(event));}}module[_0x1e9c('0x9')]=WhatsappQueueEvents;
\ No newline at end of file
+var _0x3256=['events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','exports'];(function(_0x26bdda,_0x3ae7ec){var _0x4c4761=function(_0x5d6e73){while(--_0x5d6e73){_0x26bdda['push'](_0x26bdda['shift']());}};_0x4c4761(++_0x3ae7ec);}(_0x3256,0x11f));var _0x6325=function(_0x1d0a7f,_0x563594){_0x1d0a7f=_0x1d0a7f-0x0;var _0x59306d=_0x3256[_0x1d0a7f];return _0x59306d;};'use strict';var EventEmitter=require(_0x6325('0x0'));var WhatsappQueue=require(_0x6325('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6325('0x2')](0x0);var events={'afterCreate':_0x6325('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3b9b63){return function(_0x36561c,_0x2ebe1e,_0x3ac384){WhatsappQueueEvents[_0x6325('0x4')](_0x3b9b63+':'+_0x36561c['id'],_0x36561c);WhatsappQueueEvents[_0x6325('0x4')](_0x3b9b63,_0x36561c);_0x3ac384(null);};}for(var e in events){if(events[_0x6325('0x5')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x6325('0x6')]=WhatsappQueueEvents;
\ No newline at end of file
index aad4d2f..5dc5d8e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9216=['bluebird','request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','whatsapp_queues','lodash','api'];(function(_0xe2cfd8,_0x552a7a){var _0x898043=function(_0x4bdbaf){while(--_0x4bdbaf){_0xe2cfd8['push'](_0xe2cfd8['shift']());}};_0x898043(++_0x552a7a);}(_0x9216,0x1a5));var _0x6921=function(_0x48bae4,_0x3502fe){_0x48bae4=_0x48bae4-0x0;var _0x210760=_0x9216[_0x48bae4];return _0x210760;};'use strict';var _=require(_0x6921('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6921('0x1'));var moment=require('moment');var BPromise=require(_0x6921('0x2'));var rp=require(_0x6921('0x3'));var fs=require('fs');var path=require(_0x6921('0x4'));var rimraf=require('rimraf');var config=require(_0x6921('0x5'));var attributes=require(_0x6921('0x6'));module[_0x6921('0x7')]=function(_0x4f75f5,_0x818923){return _0x4f75f5['define']('WhatsappQueue',attributes,{'tableName':_0x6921('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xe75b=['request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4f53a6,_0x582ff5){var _0x30e4b7=function(_0x1aaf04){while(--_0x1aaf04){_0x4f53a6['push'](_0x4f53a6['shift']());}};_0x30e4b7(++_0x582ff5);}(_0xe75b,0x1cf));var _0xbe75=function(_0x2a3079,_0x18bc4d){_0x2a3079=_0x2a3079-0x0;var _0x3fa680=_0xe75b[_0x2a3079];return _0x3fa680;};'use strict';var _=require(_0xbe75('0x0'));var util=require('util');var logger=require(_0xbe75('0x1'))(_0xbe75('0x2'));var moment=require(_0xbe75('0x3'));var BPromise=require(_0xbe75('0x4'));var rp=require(_0xbe75('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe75('0x6'));var config=require(_0xbe75('0x7'));var attributes=require(_0xbe75('0x8'));module[_0xbe75('0x9')]=function(_0x19b3fa,_0x5ec596){return _0x19b3fa[_0xbe75('0xa')](_0xbe75('0xb'),attributes,{'tableName':_0xbe75('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 0b1dd49..8f6718d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0ddb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','map','model','include','ShowWhatsappQueue','find','raw','lodash','util'];(function(_0x211b9c,_0x3e4a38){var _0x5be03d=function(_0x512424){while(--_0x512424){_0x211b9c['push'](_0x211b9c['shift']());}};_0x5be03d(++_0x3e4a38);}(_0x0ddb,0x18a));var _0xb0dd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0ddb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb0dd('0x0'));var util=require(_0xb0dd('0x1'));var moment=require(_0xb0dd('0x2'));var BPromise=require(_0xb0dd('0x3'));var rs=require(_0xb0dd('0x4'));var fs=require('fs');var Redis=require(_0xb0dd('0x5'));var db=require(_0xb0dd('0x6'))['db'];var utils=require(_0xb0dd('0x7'));var logger=require(_0xb0dd('0x8'))(_0xb0dd('0x9'));var config=require(_0xb0dd('0xa'));var jayson=require(_0xb0dd('0xb'));var client=jayson[_0xb0dd('0xc')]['http']({'port':0x232a});config['redis']=_[_0xb0dd('0xd')](config[_0xb0dd('0xe')],{'host':_0xb0dd('0xf'),'port':0x18eb});var socket=require(_0xb0dd('0x10'))(new Redis(config['redis']));require(_0xb0dd('0x11'))[_0xb0dd('0x12')](socket);function respondWithRpcPromise(_0x446835,_0x4de5d7,_0x1c337d){return new BPromise(function(_0x11c72f,_0x3106f1){return client[_0xb0dd('0x13')](_0x446835,_0x1c337d)[_0xb0dd('0x14')](function(_0x4ab7f3){logger[_0xb0dd('0x15')](_0xb0dd('0x16'),_0x4de5d7,_0xb0dd('0x17'));logger[_0xb0dd('0x18')](_0xb0dd('0x19'),_0x4de5d7,_0xb0dd('0x17'),JSON[_0xb0dd('0x1a')](_0x4ab7f3));if(_0x4ab7f3[_0xb0dd('0x1b')]){if(_0x4ab7f3['error'][_0xb0dd('0x1c')]===0x1f4){logger[_0xb0dd('0x1b')](_0xb0dd('0x16'),_0x4de5d7,_0x4ab7f3['error'][_0xb0dd('0x1d')]);return _0x3106f1(_0x4ab7f3[_0xb0dd('0x1b')][_0xb0dd('0x1d')]);}logger[_0xb0dd('0x1b')](_0xb0dd('0x16'),_0x4de5d7,_0x4ab7f3[_0xb0dd('0x1b')][_0xb0dd('0x1d')]);return _0x11c72f(_0x4ab7f3[_0xb0dd('0x1b')][_0xb0dd('0x1d')]);}else{logger['info'](_0xb0dd('0x16'),_0x4de5d7,_0xb0dd('0x17'));_0x11c72f(_0x4ab7f3['result'][_0xb0dd('0x1d')]);}})[_0xb0dd('0x1e')](function(_0x4277b0){logger[_0xb0dd('0x1b')](_0xb0dd('0x16'),_0x4de5d7,_0x4277b0);_0x3106f1(_0x4277b0);});});}exports[_0xb0dd('0x1f')]=function(_0x26151c){var _0x518565=this;return new Promise(function(_0xc1e9de,_0x53daba){return db[_0xb0dd('0x20')][_0xb0dd('0x21')]({'raw':_0x26151c[_0xb0dd('0x22')]?_0x26151c['options']['raw']===undefined?!![]:![]:!![],'where':_0x26151c['options']?_0x26151c['options'][_0xb0dd('0x23')]||null:null,'attributes':_0x26151c[_0xb0dd('0x22')]?_0x26151c[_0xb0dd('0x22')][_0xb0dd('0x24')]||null:null,'limit':_0x26151c[_0xb0dd('0x22')]?_0x26151c['options'][_0xb0dd('0x25')]||null:null,'include':_0x26151c[_0xb0dd('0x22')]?_0x26151c[_0xb0dd('0x22')]['include']?_[_0xb0dd('0x26')](_0x26151c['options']['include'],function(_0x7985cb){return{'model':db[_0x7985cb[_0xb0dd('0x27')]],'as':_0x7985cb['as'],'attributes':_0x7985cb[_0xb0dd('0x24')],'include':_0x7985cb[_0xb0dd('0x28')]?_[_0xb0dd('0x26')](_0x7985cb['include'],function(_0x73b493){return{'model':db[_0x73b493[_0xb0dd('0x27')]],'as':_0x73b493['as'],'attributes':_0x73b493[_0xb0dd('0x24')],'include':_0x73b493[_0xb0dd('0x28')]?_[_0xb0dd('0x26')](_0x73b493[_0xb0dd('0x28')],function(_0x1d420e){return{'model':db[_0x1d420e[_0xb0dd('0x27')]],'as':_0x1d420e['as'],'attributes':_0x1d420e[_0xb0dd('0x24')]};}):[]};}):[]};}):[]:[]})[_0xb0dd('0x14')](function(_0x299014){logger[_0xb0dd('0x15')](_0xb0dd('0x1f'),_0x26151c);logger['debug'](_0xb0dd('0x1f'),_0x26151c,JSON[_0xb0dd('0x1a')](_0x299014));_0xc1e9de(_0x299014);})['catch'](function(_0x3e2900){logger[_0xb0dd('0x1b')](_0xb0dd('0x1f'),_0x3e2900['message'],_0x26151c);_0x53daba(_0x518565['error'](0x1f4,_0x3e2900[_0xb0dd('0x1d')]));});});};exports[_0xb0dd('0x29')]=function(_0xa8423e){var _0x508abb=this;return new Promise(function(_0xbc32db,_0x1000d7){return db[_0xb0dd('0x20')][_0xb0dd('0x2a')]({'raw':_0xa8423e[_0xb0dd('0x22')]?_0xa8423e[_0xb0dd('0x22')][_0xb0dd('0x2b')]===undefined?!![]:![]:!![],'where':_0xa8423e[_0xb0dd('0x22')]?_0xa8423e[_0xb0dd('0x22')]['where']||null:null,'attributes':_0xa8423e[_0xb0dd('0x22')]?_0xa8423e[_0xb0dd('0x22')]['attributes']||null:null,'include':_0xa8423e['options']?_0xa8423e[_0xb0dd('0x22')]['include']?_[_0xb0dd('0x26')](_0xa8423e[_0xb0dd('0x22')][_0xb0dd('0x28')],function(_0x57ec5c){return{'model':db[_0x57ec5c[_0xb0dd('0x27')]],'as':_0x57ec5c['as'],'attributes':_0x57ec5c[_0xb0dd('0x24')],'include':_0x57ec5c[_0xb0dd('0x28')]?_[_0xb0dd('0x26')](_0x57ec5c[_0xb0dd('0x28')],function(_0x1ff14d){return{'model':db[_0x1ff14d[_0xb0dd('0x27')]],'as':_0x1ff14d['as'],'attributes':_0x1ff14d[_0xb0dd('0x24')],'include':_0x1ff14d['include']?_[_0xb0dd('0x26')](_0x1ff14d[_0xb0dd('0x28')],function(_0x37885d){return{'model':db[_0x37885d[_0xb0dd('0x27')]],'as':_0x37885d['as'],'attributes':_0x37885d[_0xb0dd('0x24')]};}):[]};}):[]};}):[]:[]})[_0xb0dd('0x14')](function(_0x25ad52){logger[_0xb0dd('0x15')](_0xb0dd('0x29'),_0xa8423e);logger[_0xb0dd('0x18')](_0xb0dd('0x29'),_0xa8423e,JSON[_0xb0dd('0x1a')](_0x25ad52));_0xbc32db(_0x25ad52);})['catch'](function(_0x34ebf2){logger['error'](_0xb0dd('0x29'),_0x34ebf2[_0xb0dd('0x1d')],_0xa8423e);_0x1000d7(_0x508abb[_0xb0dd('0x1b')](0x1f4,_0x34ebf2[_0xb0dd('0x1d')]));});});};
\ No newline at end of file
+var _0x3feb=['catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x3feb,0x1a8));var _0xb3fe=function(_0x14b526,_0x3d8fcd){_0x14b526=_0x14b526-0x0;var _0x4fb4d8=_0x3feb[_0x14b526];return _0x4fb4d8;};'use strict';var _=require(_0xb3fe('0x0'));var util=require(_0xb3fe('0x1'));var moment=require(_0xb3fe('0x2'));var BPromise=require(_0xb3fe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3fe('0x4'));var db=require(_0xb3fe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb3fe('0x6'))(_0xb3fe('0x7'));var config=require('../../config/environment');var jayson=require(_0xb3fe('0x8'));var client=jayson[_0xb3fe('0x9')]['http']({'port':0x232a});config[_0xb3fe('0xa')]=_['defaults'](config['redis'],{'host':_0xb3fe('0xb'),'port':0x18eb});var socket=require(_0xb3fe('0xc'))(new Redis(config[_0xb3fe('0xa')]));require(_0xb3fe('0xd'))[_0xb3fe('0xe')](socket);function respondWithRpcPromise(_0x31087f,_0x37d67f,_0x31ff51){return new BPromise(function(_0x1e1ebf,_0x23ff8a){return client[_0xb3fe('0xf')](_0x31087f,_0x31ff51)[_0xb3fe('0x10')](function(_0x1ecbb6){logger[_0xb3fe('0x11')](_0xb3fe('0x12'),_0x37d67f,_0xb3fe('0x13'));logger[_0xb3fe('0x14')](_0xb3fe('0x15'),_0x37d67f,'request\x20sent',JSON[_0xb3fe('0x16')](_0x1ecbb6));if(_0x1ecbb6[_0xb3fe('0x17')]){if(_0x1ecbb6[_0xb3fe('0x17')][_0xb3fe('0x18')]===0x1f4){logger[_0xb3fe('0x17')](_0xb3fe('0x12'),_0x37d67f,_0x1ecbb6[_0xb3fe('0x17')][_0xb3fe('0x19')]);return _0x23ff8a(_0x1ecbb6[_0xb3fe('0x17')][_0xb3fe('0x19')]);}logger['error'](_0xb3fe('0x12'),_0x37d67f,_0x1ecbb6[_0xb3fe('0x17')]['message']);return _0x1e1ebf(_0x1ecbb6['error'][_0xb3fe('0x19')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x37d67f,'request\x20sent');_0x1e1ebf(_0x1ecbb6[_0xb3fe('0x1a')][_0xb3fe('0x19')]);}})[_0xb3fe('0x1b')](function(_0x2dc7eb){logger[_0xb3fe('0x17')](_0xb3fe('0x12'),_0x37d67f,_0x2dc7eb);_0x23ff8a(_0x2dc7eb);});});}exports[_0xb3fe('0x1c')]=function(_0x571dda){var _0x2d3373=this;return new Promise(function(_0x1094d7,_0x384455){return db[_0xb3fe('0x1d')][_0xb3fe('0x1e')]({'raw':_0x571dda[_0xb3fe('0x1f')]?_0x571dda[_0xb3fe('0x1f')][_0xb3fe('0x20')]===undefined?!![]:![]:!![],'where':_0x571dda[_0xb3fe('0x1f')]?_0x571dda[_0xb3fe('0x1f')][_0xb3fe('0x21')]||null:null,'attributes':_0x571dda[_0xb3fe('0x1f')]?_0x571dda['options'][_0xb3fe('0x22')]||null:null,'limit':_0x571dda[_0xb3fe('0x1f')]?_0x571dda['options'][_0xb3fe('0x23')]||null:null,'include':_0x571dda['options']?_0x571dda[_0xb3fe('0x1f')][_0xb3fe('0x24')]?_[_0xb3fe('0x25')](_0x571dda[_0xb3fe('0x1f')][_0xb3fe('0x24')],function(_0x5a702e){return{'model':db[_0x5a702e[_0xb3fe('0x26')]],'as':_0x5a702e['as'],'attributes':_0x5a702e[_0xb3fe('0x22')],'include':_0x5a702e['include']?_['map'](_0x5a702e[_0xb3fe('0x24')],function(_0xe02573){return{'model':db[_0xe02573[_0xb3fe('0x26')]],'as':_0xe02573['as'],'attributes':_0xe02573['attributes'],'include':_0xe02573[_0xb3fe('0x24')]?_[_0xb3fe('0x25')](_0xe02573[_0xb3fe('0x24')],function(_0x39fed4){return{'model':db[_0x39fed4[_0xb3fe('0x26')]],'as':_0x39fed4['as'],'attributes':_0x39fed4[_0xb3fe('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x540a3e){logger[_0xb3fe('0x11')](_0xb3fe('0x1c'),_0x571dda);logger[_0xb3fe('0x14')](_0xb3fe('0x1c'),_0x571dda,JSON[_0xb3fe('0x16')](_0x540a3e));_0x1094d7(_0x540a3e);})['catch'](function(_0x1f3211){logger[_0xb3fe('0x17')](_0xb3fe('0x1c'),_0x1f3211[_0xb3fe('0x19')],_0x571dda);_0x384455(_0x2d3373['error'](0x1f4,_0x1f3211[_0xb3fe('0x19')]));});});};exports[_0xb3fe('0x27')]=function(_0x10f26e){var _0x2be01d=this;return new Promise(function(_0x2e9c5f,_0x3c8e54){return db[_0xb3fe('0x1d')][_0xb3fe('0x28')]({'raw':_0x10f26e[_0xb3fe('0x1f')]?_0x10f26e[_0xb3fe('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x10f26e[_0xb3fe('0x1f')]?_0x10f26e['options']['where']||null:null,'attributes':_0x10f26e[_0xb3fe('0x1f')]?_0x10f26e[_0xb3fe('0x1f')][_0xb3fe('0x22')]||null:null,'include':_0x10f26e[_0xb3fe('0x1f')]?_0x10f26e['options'][_0xb3fe('0x24')]?_[_0xb3fe('0x25')](_0x10f26e[_0xb3fe('0x1f')][_0xb3fe('0x24')],function(_0x2f97d0){return{'model':db[_0x2f97d0[_0xb3fe('0x26')]],'as':_0x2f97d0['as'],'attributes':_0x2f97d0[_0xb3fe('0x22')],'include':_0x2f97d0[_0xb3fe('0x24')]?_[_0xb3fe('0x25')](_0x2f97d0[_0xb3fe('0x24')],function(_0x2f2071){return{'model':db[_0x2f2071[_0xb3fe('0x26')]],'as':_0x2f2071['as'],'attributes':_0x2f2071[_0xb3fe('0x22')],'include':_0x2f2071['include']?_[_0xb3fe('0x25')](_0x2f2071[_0xb3fe('0x24')],function(_0x145d34){return{'model':db[_0x145d34[_0xb3fe('0x26')]],'as':_0x145d34['as'],'attributes':_0x145d34[_0xb3fe('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb3fe('0x10')](function(_0x4962bb){logger[_0xb3fe('0x11')](_0xb3fe('0x27'),_0x10f26e);logger[_0xb3fe('0x14')]('ShowWhatsappQueue',_0x10f26e,JSON[_0xb3fe('0x16')](_0x4962bb));_0x2e9c5f(_0x4962bb);})[_0xb3fe('0x1b')](function(_0xf50b80){logger[_0xb3fe('0x17')](_0xb3fe('0x27'),_0xf50b80[_0xb3fe('0x19')],_0x10f26e);_0x3c8e54(_0x2be01d[_0xb3fe('0x17')](0x1f4,_0xf50b80[_0xb3fe('0x19')]));});});};
\ No newline at end of file
index 99ea1a7..826c32b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb463=['register','whatsappQueue:','save','remove','update','removeListener'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb463,0x116));var _0x3b46=function(_0x5aaa6c,_0x163165){_0x5aaa6c=_0x5aaa6c-0x0;var _0x16774a=_0xb463[_0x5aaa6c];return _0x16774a;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x3b46('0x0'),_0x3b46('0x1'),_0x3b46('0x2')];function createListener(_0x20d489,_0x35d000){return function(_0x4b100a){_0x35d000['emit'](_0x20d489,_0x4b100a);};}function removeListener(_0x551741,_0x527ce4){return function(){WhatsappQueueEvents[_0x3b46('0x3')](_0x551741,_0x527ce4);};}exports[_0x3b46('0x4')]=function(_0x1ba251){for(var _0x150c26=0x0,_0x5d7a16=events['length'];_0x150c26<_0x5d7a16;_0x150c26++){var _0x3cdb56=events[_0x150c26];var _0x4c223b=createListener(_0x3b46('0x5')+_0x3cdb56,_0x1ba251);WhatsappQueueEvents['on'](_0x3cdb56,_0x4c223b);}};
\ No newline at end of file
+var _0xc469=['./whatsappQueue.events','save','update','emit','removeListener','whatsappQueue:'];(function(_0x2dceb2,_0x102cb1){var _0x59952d=function(_0x348af8){while(--_0x348af8){_0x2dceb2['push'](_0x2dceb2['shift']());}};_0x59952d(++_0x102cb1);}(_0xc469,0x1f2));var _0x9c46=function(_0x55d829,_0x43f06c){_0x55d829=_0x55d829-0x0;var _0x52163b=_0xc469[_0x55d829];return _0x52163b;};'use strict';var WhatsappQueueEvents=require(_0x9c46('0x0'));var events=[_0x9c46('0x1'),'remove',_0x9c46('0x2')];function createListener(_0x2032dc,_0x5248c4){return function(_0x2d76b6){_0x5248c4[_0x9c46('0x3')](_0x2032dc,_0x2d76b6);};}function removeListener(_0x56afc0,_0x18d122){return function(){WhatsappQueueEvents[_0x9c46('0x4')](_0x56afc0,_0x18d122);};}exports['register']=function(_0x216310){for(var _0xd08de0=0x0,_0x2fc53e=events['length'];_0xd08de0<_0x2fc53e;_0xd08de0++){var _0xa4e3cf=events[_0xd08de0];var _0x21f4d2=createListener(_0x9c46('0x5')+_0xa4e3cf,_0x216310);WhatsappQueueEvents['on'](_0xa4e3cf,_0x21f4d2);}};
\ No newline at end of file
index 06b0ed5..f1a40b7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5493=['index','describe','post','create','put','/:id','update','delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x5493,0x1cb));var _0x3549=function(_0x31328a,_0x52fe9e){_0x31328a=_0x31328a-0x0;var _0x4289f6=_0x5493[_0x31328a];return _0x4289f6;};'use strict';var multer=require('multer');var util=require(_0x3549('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3549('0x1'));var router=express[_0x3549('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3549('0x3'));var interaction=require(_0x3549('0x4'));var config=require(_0x3549('0x5'));var controller=require(_0x3549('0x6'));router[_0x3549('0x7')]('/',auth[_0x3549('0x8')](),controller[_0x3549('0x9')]);router['get']('/describe',auth[_0x3549('0x8')](),controller[_0x3549('0xa')]);router['get']('/:id',auth[_0x3549('0x8')](),controller['show']);router[_0x3549('0xb')]('/',auth[_0x3549('0x8')](),controller[_0x3549('0xc')]);router[_0x3549('0xd')](_0x3549('0xe'),auth[_0x3549('0x8')](),controller[_0x3549('0xf')]);router[_0x3549('0x10')](_0x3549('0xe'),auth[_0x3549('0x8')](),controller['destroy']);module[_0x3549('0x11')]=router;
\ No newline at end of file
+var _0xcc57=['index','/describe','/:id','show','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated'];(function(_0x541710,_0x4c11c7){var _0xfdb78f=function(_0x3c48b5){while(--_0x3c48b5){_0x541710['push'](_0x541710['shift']());}};_0xfdb78f(++_0x4c11c7);}(_0xcc57,0x14a));var _0x7cc5=function(_0x3ddaa0,_0x4c7abc){_0x3ddaa0=_0x3ddaa0-0x0;var _0x52bdbe=_0xcc57[_0x3ddaa0];return _0x52bdbe;};'use strict';var multer=require(_0x7cc5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7cc5('0x1'));var express=require(_0x7cc5('0x2'));var router=express[_0x7cc5('0x3')]();var fs_extra=require(_0x7cc5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7cc5('0x5'));var config=require(_0x7cc5('0x6'));var controller=require(_0x7cc5('0x7'));router[_0x7cc5('0x8')]('/',auth[_0x7cc5('0x9')](),controller[_0x7cc5('0xa')]);router[_0x7cc5('0x8')](_0x7cc5('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x7cc5('0x8')](_0x7cc5('0xc'),auth['isAuthenticated'](),controller[_0x7cc5('0xd')]);router[_0x7cc5('0xe')]('/',auth[_0x7cc5('0x9')](),controller[_0x7cc5('0xf')]);router['put'](_0x7cc5('0xc'),auth[_0x7cc5('0x9')](),controller[_0x7cc5('0x10')]);router[_0x7cc5('0x11')](_0x7cc5('0xc'),auth[_0x7cc5('0x9')](),controller[_0x7cc5('0x12')]);module[_0x7cc5('0x13')]=router;
\ No newline at end of file
index 26177f3..35ea4e3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x17983a,_0x50e9cf){var _0x8c3fea=function(_0x24c7ca){while(--_0x24c7ca){_0x17983a['push'](_0x17983a['shift']());}};_0x8c3fea(++_0x50e9cf);}(_0x7a54,0x106));var _0x47a5=function(_0x538ad6,_0x5cf14a){_0x538ad6=_0x538ad6-0x0;var _0x2a1428=_0x7a54[_0x538ad6];return _0x2a1428;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}};
\ No newline at end of file
+var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5310b5,_0x4d27f4){var _0x304d42=function(_0x21a043){while(--_0x21a043){_0x5310b5['push'](_0x5310b5['shift']());}};_0x304d42(++_0x4d27f4);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}};
\ No newline at end of file
index b5e0f57..0138730 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x14a0=['mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x14a0,0x8e));var _0x014a=function(_0x213f16,_0x28927c){_0x213f16=_0x213f16-0x0;var _0x41c5f7=_0x14a0[_0x213f16];return _0x41c5f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];function respondWithStatusCode(_0x43bfeb,_0x1bcd1){_0x1bcd1=_0x1bcd1||0xcc;return function(_0x20cb56){if(_0x20cb56){return _0x43bfeb[_0x014a('0x14')](_0x1bcd1);}return _0x43bfeb[_0x014a('0x15')](_0x1bcd1)[_0x014a('0x16')]();};}function respondWithResult(_0x71535d,_0x45cd80){_0x45cd80=_0x45cd80||0xc8;return function(_0x3c54c8){if(_0x3c54c8){return _0x71535d['status'](_0x45cd80)[_0x014a('0x17')](_0x3c54c8);}};}function respondWithFilteredResult(_0x3cf92f,_0x59f207){return function(_0x3a836f){if(_0x3a836f){var _0x128c46=typeof _0x59f207['offset']===_0x014a('0x18')&&typeof _0x59f207[_0x014a('0x19')]===_0x014a('0x18');var _0x12da95=_0x3a836f[_0x014a('0x1a')];var _0x12d339=_0x128c46?0x0:_0x59f207[_0x014a('0x1b')];var _0x263b07=_0x128c46?_0x3a836f[_0x014a('0x1a')]:_0x59f207[_0x014a('0x1b')]+_0x59f207[_0x014a('0x19')];var _0x89e132;if(_0x263b07>=_0x12da95){_0x263b07=_0x12da95;_0x89e132=0xc8;}else{_0x89e132=0xce;}_0x3cf92f[_0x014a('0x15')](_0x89e132);return _0x3cf92f[_0x014a('0x1c')]('Content-Range',_0x12d339+'-'+_0x263b07+'/'+_0x12da95)[_0x014a('0x17')](_0x3a836f);}return null;};}function patchUpdates(_0x109a9c){return function(_0x11065f){try{jsonpatch[_0x014a('0x1d')](_0x11065f,_0x109a9c,!![]);}catch(_0xc9a563){return BPromise[_0x014a('0x1e')](_0xc9a563);}return _0x11065f[_0x014a('0x1f')]();};}function saveUpdates(_0x3dd2d0,_0x290b86){return function(_0x486e66){if(_0x486e66){return _0x486e66[_0x014a('0x20')](_0x3dd2d0)['then'](function(_0x1a1318){return _0x1a1318;});}return null;};}function removeEntity(_0x26718b,_0x44d921){return function(_0x36d52b){if(_0x36d52b){return _0x36d52b[_0x014a('0x21')]()[_0x014a('0x22')](function(){_0x26718b[_0x014a('0x15')](0xcc)[_0x014a('0x16')]();});}};}function handleEntityNotFound(_0x165a42,_0x4c2627){return function(_0x3b4b92){if(!_0x3b4b92){_0x165a42['sendStatus'](0x194);}return _0x3b4b92;};}function handleError(_0x39a432,_0x28701e){_0x28701e=_0x28701e||0x1f4;return function(_0x4f1c44){logger['error'](_0x4f1c44[_0x014a('0x23')]);if(_0x4f1c44[_0x014a('0x24')]){delete _0x4f1c44[_0x014a('0x24')];}_0x39a432['status'](_0x28701e)[_0x014a('0x25')](_0x4f1c44);};}exports[_0x014a('0x26')]=function(_0x598179,_0x31dc95){var _0x2560a6={},_0x496040={},_0x4f9c1c={'count':0x0,'rows':[]};var _0x397850=_[_0x014a('0x27')](db[_0x014a('0x28')][_0x014a('0x29')],function(_0x4ea00c){return{'name':_0x4ea00c[_0x014a('0x2a')],'type':_0x4ea00c[_0x014a('0x2b')][_0x014a('0x2c')]};});_0x496040[_0x014a('0x2d')]=_[_0x014a('0x27')](_0x397850,_0x014a('0x24'));_0x496040[_0x014a('0x2e')]=_[_0x014a('0x2f')](_0x598179[_0x014a('0x2e')]);_0x496040[_0x014a('0x30')]=_[_0x014a('0x31')](_0x496040['model'],_0x496040[_0x014a('0x2e')]);_0x2560a6[_0x014a('0x32')]=_[_0x014a('0x31')](_0x496040[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x598179[_0x014a('0x2e')][_0x014a('0x33')]));_0x2560a6['attributes']=_0x2560a6[_0x014a('0x32')][_0x014a('0x34')]?_0x2560a6['attributes']:_0x496040[_0x014a('0x2d')];if(!_0x598179[_0x014a('0x2e')][_0x014a('0x35')](_0x014a('0x36'))){_0x2560a6[_0x014a('0x19')]=qs[_0x014a('0x19')](_0x598179[_0x014a('0x2e')][_0x014a('0x19')]);_0x2560a6['offset']=qs[_0x014a('0x1b')](_0x598179[_0x014a('0x2e')][_0x014a('0x1b')]);}_0x2560a6[_0x014a('0x37')]=qs['sort'](_0x598179[_0x014a('0x2e')][_0x014a('0x38')]);_0x2560a6[_0x014a('0x39')]=qs[_0x014a('0x30')](_[_0x014a('0x3a')](_0x598179[_0x014a('0x2e')],_0x496040[_0x014a('0x30')]),_0x397850);if(_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]){_0x2560a6['where']=_[_0x014a('0x3c')](_0x2560a6['where'],{'$or':_[_0x014a('0x27')](_0x397850,function(_0xc11492){if(_0xc11492[_0x014a('0x2b')]!==_0x014a('0x3d')){var _0x43376c={};_0x43376c[_0xc11492['name']]={'$like':'%'+_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]+'%'};return _0x43376c;}})});}_0x2560a6=_['merge']({},_0x2560a6,_0x598179[_0x014a('0x3e')]);var _0x2990df={'where':_0x2560a6[_0x014a('0x39')]};return db[_0x014a('0x28')][_0x014a('0x1a')](_0x2990df)[_0x014a('0x22')](function(_0x17b1b6){_0x4f9c1c[_0x014a('0x1a')]=_0x17b1b6;if(_0x598179[_0x014a('0x2e')]['includeAll']){_0x2560a6[_0x014a('0x3f')]=[{'all':!![]}];}return db[_0x014a('0x28')][_0x014a('0x40')](_0x2560a6);})[_0x014a('0x22')](function(_0x5f1a91){_0x4f9c1c[_0x014a('0x41')]=_0x5f1a91;return _0x4f9c1c;})[_0x014a('0x22')](respondWithFilteredResult(_0x31dc95,_0x2560a6))[_0x014a('0x42')](handleError(_0x31dc95,null));};exports[_0x014a('0x43')]=function(_0x1dc647,_0x430a56){var _0x5f2969={'raw':!![],'where':{'id':_0x1dc647[_0x014a('0x44')]['id']}},_0x361866={};_0x361866['model']=_[_0x014a('0x2f')](db[_0x014a('0x28')][_0x014a('0x29')]);_0x361866['query']=_[_0x014a('0x2f')](_0x1dc647['query']);_0x361866['filters']=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],_0x361866['query']);_0x5f2969[_0x014a('0x32')]=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x1dc647[_0x014a('0x2e')][_0x014a('0x33')]));_0x5f2969['attributes']=_0x5f2969[_0x014a('0x32')][_0x014a('0x34')]?_0x5f2969[_0x014a('0x32')]:_0x361866['model'];if(_0x1dc647['query'][_0x014a('0x45')]){_0x5f2969['include']=[{'all':!![]}];}_0x5f2969=_['merge']({},_0x5f2969,_0x1dc647[_0x014a('0x3e')]);return db['WhatsappQueueReport'][_0x014a('0x46')](_0x5f2969)[_0x014a('0x22')](handleEntityNotFound(_0x430a56,null))[_0x014a('0x22')](respondWithResult(_0x430a56,null))['catch'](handleError(_0x430a56,null));};exports[_0x014a('0x47')]=function(_0x23be18,_0x12cd9b){return db[_0x014a('0x28')][_0x014a('0x47')](_0x23be18[_0x014a('0x48')],{})['then'](respondWithResult(_0x12cd9b,0xc9))[_0x014a('0x42')](handleError(_0x12cd9b,null));};exports[_0x014a('0x20')]=function(_0x5a861c,_0x1a4df9){if(_0x5a861c[_0x014a('0x48')]['id']){delete _0x5a861c[_0x014a('0x48')]['id'];}return db[_0x014a('0x28')][_0x014a('0x46')]({'where':{'id':_0x5a861c[_0x014a('0x44')]['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x1a4df9,null))[_0x014a('0x22')](saveUpdates(_0x5a861c['body'],null))[_0x014a('0x22')](respondWithResult(_0x1a4df9,null))[_0x014a('0x42')](handleError(_0x1a4df9,null));};exports[_0x014a('0x21')]=function(_0x135e7e,_0x312c7a){return db['WhatsappQueueReport'][_0x014a('0x46')]({'where':{'id':_0x135e7e['params']['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x312c7a,null))[_0x014a('0x22')](removeEntity(_0x312c7a,null))[_0x014a('0x42')](handleError(_0x312c7a,null));};exports[_0x014a('0x49')]=function(_0x3caa6e,_0x4f8547){return db['WhatsappQueueReport']['describe']()['then'](respondWithResult(_0x4f8547,null))[_0x014a('0x42')](handleError(_0x4f8547,null));};
\ No newline at end of file
+var _0xf45e=['Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','index','map','rawAttributes','type','key','model','name','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','WhatsappQueueReport','includeAll','include','findAll','rows','show','params','keys','length','merge','find','create','body','update','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set'];(function(_0x30a3ae,_0xb384eb){var _0x31d559=function(_0x1f6ac0){while(--_0x1f6ac0){_0x30a3ae['push'](_0x30a3ae['shift']());}};_0x31d559(++_0xb384eb);}(_0xf45e,0x115));var _0xef45=function(_0x3392ca,_0x294992){_0x3392ca=_0x3392ca-0x0;var _0x508fda=_0xf45e[_0x3392ca];return _0x508fda;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208b35,_0x5f0593){return function(_0x38b470){if(!_0x38b470){_0x208b35[_0xef45('0x2a')](0x194);}return _0x38b470;};}function handleError(_0x578f03,_0x46e423){_0x46e423=_0x46e423||0x1f4;return function(_0x2c356d){logger['error'](_0x2c356d[_0xef45('0x2b')]);if(_0x2c356d['name']){delete _0x2c356d['name'];}_0x578f03['status'](_0x46e423)['send'](_0x2c356d);};}exports[_0xef45('0x2c')]=function(_0x2f72ef,_0x217e8d){var _0x15ad38={},_0x5782d0={},_0x18f304={'count':0x0,'rows':[]};var _0x4f028c=_[_0xef45('0x2d')](db['WhatsappQueueReport'][_0xef45('0x2e')],function(_0x5bfd2d){return{'name':_0x5bfd2d['fieldName'],'type':_0x5bfd2d[_0xef45('0x2f')][_0xef45('0x30')]};});_0x5782d0[_0xef45('0x31')]=_[_0xef45('0x2d')](_0x4f028c,_0xef45('0x32'));_0x5782d0['query']=_['keys'](_0x2f72ef['query']);_0x5782d0[_0xef45('0x33')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],_0x5782d0[_0xef45('0x35')]);_0x15ad38[_0xef45('0x36')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],qs['fields'](_0x2f72ef['query'][_0xef45('0x37')]));_0x15ad38['attributes']=_0x15ad38[_0xef45('0x36')]['length']?_0x15ad38[_0xef45('0x36')]:_0x5782d0[_0xef45('0x31')];if(!_0x2f72ef[_0xef45('0x35')][_0xef45('0x38')](_0xef45('0x39'))){_0x15ad38['limit']=qs[_0xef45('0x20')](_0x2f72ef[_0xef45('0x35')][_0xef45('0x20')]);_0x15ad38['offset']=qs['offset'](_0x2f72ef[_0xef45('0x35')][_0xef45('0x1e')]);}_0x15ad38['order']=qs[_0xef45('0x3a')](_0x2f72ef['query']['sort']);_0x15ad38[_0xef45('0x3b')]=qs[_0xef45('0x33')](_[_0xef45('0x3c')](_0x2f72ef['query'],_0x5782d0[_0xef45('0x33')]),_0x4f028c);if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]){_0x15ad38[_0xef45('0x3b')]=_['merge'](_0x15ad38['where'],{'$or':_[_0xef45('0x2d')](_0x4f028c,function(_0x474be1){if(_0x474be1[_0xef45('0x2f')]!==_0xef45('0x3e')){var _0x269a11={};_0x269a11[_0x474be1[_0xef45('0x32')]]={'$like':'%'+_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]+'%'};return _0x269a11;}})});}_0x15ad38=_['merge']({},_0x15ad38,_0x2f72ef['options']);var _0x13f8b2={'where':_0x15ad38[_0xef45('0x3b')]};return db[_0xef45('0x3f')][_0xef45('0x21')](_0x13f8b2)[_0xef45('0x29')](function(_0x3bcada){_0x18f304[_0xef45('0x21')]=_0x3bcada;if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x40')]){_0x15ad38[_0xef45('0x41')]=[{'all':!![]}];}return db[_0xef45('0x3f')][_0xef45('0x42')](_0x15ad38);})[_0xef45('0x29')](function(_0xd7d217){_0x18f304[_0xef45('0x43')]=_0xd7d217;return _0x18f304;})[_0xef45('0x29')](respondWithFilteredResult(_0x217e8d,_0x15ad38))['catch'](handleError(_0x217e8d,null));};exports[_0xef45('0x44')]=function(_0x5bdfad,_0x1b9d45){var _0x82c123={'raw':!![],'where':{'id':_0x5bdfad[_0xef45('0x45')]['id']}},_0x54ccb8={};_0x54ccb8['model']=_[_0xef45('0x46')](db['WhatsappQueueReport'][_0xef45('0x2e')]);_0x54ccb8[_0xef45('0x35')]=_[_0xef45('0x46')](_0x5bdfad[_0xef45('0x35')]);_0x54ccb8[_0xef45('0x33')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],_0x54ccb8['query']);_0x82c123[_0xef45('0x36')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],qs[_0xef45('0x37')](_0x5bdfad[_0xef45('0x35')][_0xef45('0x37')]));_0x82c123[_0xef45('0x36')]=_0x82c123[_0xef45('0x36')][_0xef45('0x47')]?_0x82c123[_0xef45('0x36')]:_0x54ccb8[_0xef45('0x31')];if(_0x5bdfad[_0xef45('0x35')][_0xef45('0x40')]){_0x82c123[_0xef45('0x41')]=[{'all':!![]}];}_0x82c123=_[_0xef45('0x48')]({},_0x82c123,_0x5bdfad['options']);return db[_0xef45('0x3f')][_0xef45('0x49')](_0x82c123)[_0xef45('0x29')](handleEntityNotFound(_0x1b9d45,null))['then'](respondWithResult(_0x1b9d45,null))['catch'](handleError(_0x1b9d45,null));};exports['create']=function(_0x29aeab,_0x18143c){return db[_0xef45('0x3f')][_0xef45('0x4a')](_0x29aeab[_0xef45('0x4b')],{})[_0xef45('0x29')](respondWithResult(_0x18143c,0xc9))['catch'](handleError(_0x18143c,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){if(_0x463796['body']['id']){delete _0x463796['body']['id'];}return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x463796['params']['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x2b2419,null))[_0xef45('0x29')](saveUpdates(_0x463796[_0xef45('0x4b')],null))[_0xef45('0x29')](respondWithResult(_0x2b2419,null))[_0xef45('0x4d')](handleError(_0x2b2419,null));};exports[_0xef45('0x28')]=function(_0x23581f,_0xfa5fdd){return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x23581f[_0xef45('0x45')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0xfa5fdd,null))[_0xef45('0x29')](removeEntity(_0xfa5fdd,null))[_0xef45('0x4d')](handleError(_0xfa5fdd,null));};exports['describe']=function(_0x22b75e,_0x24aceb){return db[_0xef45('0x3f')]['describe']()[_0xef45('0x29')](respondWithResult(_0x24aceb,null))[_0xef45('0x4d')](handleError(_0x24aceb,null));};
\ No newline at end of file
index 8f732cf..3b57b42 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x55b6=['./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4f0c2b,_0x2c9d14){var _0x526436=function(_0x2e13b6){while(--_0x2e13b6){_0x4f0c2b['push'](_0x4f0c2b['shift']());}};_0x526436(++_0x2c9d14);}(_0x55b6,0x1cd));var _0x655b=function(_0x348356,_0xd373ee){_0x348356=_0x348356-0x0;var _0x5e7ef7=_0x55b6[_0x348356];return _0x5e7ef7;};'use strict';var _=require('lodash');var util=require(_0x655b('0x0'));var logger=require('../../config/logger')(_0x655b('0x1'));var moment=require(_0x655b('0x2'));var BPromise=require('bluebird');var rp=require(_0x655b('0x3'));var fs=require('fs');var path=require(_0x655b('0x4'));var rimraf=require(_0x655b('0x5'));var config=require(_0x655b('0x6'));var attributes=require(_0x655b('0x7'));module[_0x655b('0x8')]=function(_0x189352,_0x4ad408){return _0x189352['define'](_0x655b('0x9'),attributes,{'tableName':_0x655b('0xa'),'paranoid':![],'indexes':[{'name':_0x655b('0xb'),'fields':[_0x655b('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x5b09=['request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','bluebird'];(function(_0x2ccace,_0x282a3f){var _0x34394f=function(_0x4b023a){while(--_0x4b023a){_0x2ccace['push'](_0x2ccace['shift']());}};_0x34394f(++_0x282a3f);}(_0x5b09,0x1c3));var _0x95b0=function(_0x302c83,_0x44e919){_0x302c83=_0x302c83-0x0;var _0x2d0cd5=_0x5b09[_0x302c83];return _0x2d0cd5;};'use strict';var _=require(_0x95b0('0x0'));var util=require(_0x95b0('0x1'));var logger=require(_0x95b0('0x2'))('api');var moment=require('moment');var BPromise=require(_0x95b0('0x3'));var rp=require(_0x95b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95b0('0x5'));var config=require(_0x95b0('0x6'));var attributes=require(_0x95b0('0x7'));module[_0x95b0('0x8')]=function(_0x5e2b75,_0x27a7e6){return _0x5e2b75[_0x95b0('0x9')](_0x95b0('0xa'),attributes,{'tableName':_0x95b0('0xb'),'paranoid':![],'indexes':[{'name':_0x95b0('0xc'),'fields':[_0x95b0('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
index 5412c48..7ac5d87 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x15e7=['stringify','code','message','error','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','update','where','limit','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x15e7,0x1ef));var _0x715e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x15e7[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x715e('0x0'));var util=require(_0x715e('0x1'));var moment=require(_0x715e('0x2'));var BPromise=require(_0x715e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x715e('0x4'))['db'];var utils=require(_0x715e('0x5'));var logger=require(_0x715e('0x6'))(_0x715e('0x7'));var config=require(_0x715e('0x8'));var jayson=require(_0x715e('0x9'));var client=jayson[_0x715e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dd60a,_0x1075ee,_0x5ba7bc){return new BPromise(function(_0x52470e,_0x886ccd){return client[_0x715e('0xb')](_0x2dd60a,_0x5ba7bc)[_0x715e('0xc')](function(_0x5c54e2){logger[_0x715e('0xd')](_0x715e('0xe'),_0x1075ee,_0x715e('0xf'));logger[_0x715e('0x10')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x1075ee,_0x715e('0xf'),JSON[_0x715e('0x11')](_0x5c54e2));if(_0x5c54e2['error']){if(_0x5c54e2['error'][_0x715e('0x12')]===0x1f4){logger['error'](_0x715e('0xe'),_0x1075ee,_0x5c54e2['error'][_0x715e('0x13')]);return _0x886ccd(_0x5c54e2[_0x715e('0x14')][_0x715e('0x13')]);}logger[_0x715e('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1075ee,_0x5c54e2['error'][_0x715e('0x13')]);return _0x52470e(_0x5c54e2[_0x715e('0x14')][_0x715e('0x13')]);}else{logger[_0x715e('0xd')](_0x715e('0xe'),_0x1075ee,_0x715e('0xf'));_0x52470e(_0x5c54e2[_0x715e('0x15')]['message']);}})['catch'](function(_0x3dc6ed){logger['error'](_0x715e('0xe'),_0x1075ee,_0x3dc6ed);_0x886ccd(_0x3dc6ed);});});}exports[_0x715e('0x16')]=function(_0x4db6ac){var _0x587da6=this;return new Promise(function(_0x66e709,_0x38b36a){return db[_0x715e('0x17')][_0x715e('0x18')](_0x4db6ac['body'],{'raw':_0x4db6ac[_0x715e('0x19')]?_0x4db6ac[_0x715e('0x19')][_0x715e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x181312){logger['info']('CreateWhatsappQueueReport',_0x4db6ac);logger[_0x715e('0x10')](_0x715e('0x16'),_0x4db6ac,JSON['stringify'](_0x181312));_0x66e709(_0x181312);})['catch'](function(_0x2a6376){logger[_0x715e('0x14')](_0x715e('0x16'),_0x2a6376[_0x715e('0x13')],_0x4db6ac);_0x38b36a(_0x587da6[_0x715e('0x14')](0x1f4,_0x2a6376['message']));});});};exports[_0x715e('0x1b')]=function(_0x105bf7){var _0x365476=this;return new Promise(function(_0x5e2339,_0xa70d32){return db[_0x715e('0x17')][_0x715e('0x1c')](_0x105bf7['body'],{'raw':_0x105bf7[_0x715e('0x19')]?_0x105bf7['options'][_0x715e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x105bf7['options']?_0x105bf7[_0x715e('0x19')][_0x715e('0x1d')]||null:null,'attributes':_0x105bf7[_0x715e('0x19')]?_0x105bf7[_0x715e('0x19')]['attributes']||null:null,'limit':_0x105bf7['options']?_0x105bf7[_0x715e('0x19')][_0x715e('0x1e')]||null:null})['then'](function(_0x488f49){logger['info'](_0x715e('0x1b'),_0x105bf7);logger[_0x715e('0x10')](_0x715e('0x1b'),_0x105bf7,JSON[_0x715e('0x11')](_0x488f49));_0x5e2339(_0x488f49);})[_0x715e('0x1f')](function(_0x2d15e0){logger[_0x715e('0x14')](_0x715e('0x1b'),_0x2d15e0['message'],_0x105bf7);_0xa70d32(_0x365476[_0x715e('0x14')](0x1f4,_0x2d15e0['message']));});});};
\ No newline at end of file
+var _0x9acb=['stringify','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','then','UpdateWhatsappQueueReport','update','raw','where','attributes','limit','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0xbe9008,_0x5dbaa5){var _0x1e10e6=function(_0xa4ac0e){while(--_0xa4ac0e){_0xbe9008['push'](_0xbe9008['shift']());}};_0x1e10e6(++_0x5dbaa5);}(_0x9acb,0x13a));var _0xb9ac=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x9acb[_0xc6be3a];return _0x56a310;};'use strict';var _=require('lodash');var util=require(_0xb9ac('0x0'));var moment=require('moment');var BPromise=require(_0xb9ac('0x1'));var rs=require(_0xb9ac('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9ac('0x3'))['db'];var utils=require(_0xb9ac('0x4'));var logger=require(_0xb9ac('0x5'))('rpc');var config=require(_0xb9ac('0x6'));var jayson=require(_0xb9ac('0x7'));var client=jayson[_0xb9ac('0x8')][_0xb9ac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a0254,_0x1ff8af,_0x41601c){return new BPromise(function(_0x82b97a,_0x5596e1){return client[_0xb9ac('0xa')](_0x5a0254,_0x41601c)['then'](function(_0x3103ef){logger[_0xb9ac('0xb')](_0xb9ac('0xc'),_0x1ff8af,_0xb9ac('0xd'));logger[_0xb9ac('0xe')](_0xb9ac('0xf'),_0x1ff8af,_0xb9ac('0xd'),JSON[_0xb9ac('0x10')](_0x3103ef));if(_0x3103ef['error']){if(_0x3103ef[_0xb9ac('0x11')][_0xb9ac('0x12')]===0x1f4){logger[_0xb9ac('0x11')](_0xb9ac('0xc'),_0x1ff8af,_0x3103ef[_0xb9ac('0x11')]['message']);return _0x5596e1(_0x3103ef['error'][_0xb9ac('0x13')]);}logger[_0xb9ac('0x11')](_0xb9ac('0xc'),_0x1ff8af,_0x3103ef[_0xb9ac('0x11')][_0xb9ac('0x13')]);return _0x82b97a(_0x3103ef[_0xb9ac('0x11')]['message']);}else{logger['info'](_0xb9ac('0xc'),_0x1ff8af,_0xb9ac('0xd'));_0x82b97a(_0x3103ef['result'][_0xb9ac('0x13')]);}})[_0xb9ac('0x14')](function(_0x58d793){logger[_0xb9ac('0x11')](_0xb9ac('0xc'),_0x1ff8af,_0x58d793);_0x5596e1(_0x58d793);});});}exports[_0xb9ac('0x15')]=function(_0x3a7868){var _0x56a9d9=this;return new Promise(function(_0x22977c,_0x24e587){return db[_0xb9ac('0x16')][_0xb9ac('0x17')](_0x3a7868[_0xb9ac('0x18')],{'raw':_0x3a7868[_0xb9ac('0x19')]?_0x3a7868[_0xb9ac('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xb9ac('0x1a')](function(_0xe6ab6e){logger[_0xb9ac('0xb')](_0xb9ac('0x15'),_0x3a7868);logger[_0xb9ac('0xe')](_0xb9ac('0x15'),_0x3a7868,JSON['stringify'](_0xe6ab6e));_0x22977c(_0xe6ab6e);})[_0xb9ac('0x14')](function(_0x1d045e){logger[_0xb9ac('0x11')]('CreateWhatsappQueueReport',_0x1d045e['message'],_0x3a7868);_0x24e587(_0x56a9d9['error'](0x1f4,_0x1d045e['message']));});});};exports[_0xb9ac('0x1b')]=function(_0x5500d4){var _0x5e6a4f=this;return new Promise(function(_0x12d799,_0x33f347){return db[_0xb9ac('0x16')][_0xb9ac('0x1c')](_0x5500d4[_0xb9ac('0x18')],{'raw':_0x5500d4[_0xb9ac('0x19')]?_0x5500d4[_0xb9ac('0x19')][_0xb9ac('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5500d4[_0xb9ac('0x19')]?_0x5500d4[_0xb9ac('0x19')][_0xb9ac('0x1e')]||null:null,'attributes':_0x5500d4['options']?_0x5500d4[_0xb9ac('0x19')][_0xb9ac('0x1f')]||null:null,'limit':_0x5500d4[_0xb9ac('0x19')]?_0x5500d4[_0xb9ac('0x19')][_0xb9ac('0x20')]||null:null})[_0xb9ac('0x1a')](function(_0x52f456){logger['info'](_0xb9ac('0x1b'),_0x5500d4);logger[_0xb9ac('0xe')](_0xb9ac('0x1b'),_0x5500d4,JSON[_0xb9ac('0x10')](_0x52f456));_0x12d799(_0x52f456);})[_0xb9ac('0x14')](function(_0x52a619){logger[_0xb9ac('0x11')]('UpdateWhatsappQueueReport',_0x52a619['message'],_0x5500d4);_0x33f347(_0x5e6a4f[_0xb9ac('0x11')](0x1f4,_0x52a619['message']));});});};
\ No newline at end of file
index 27366df..1ca935c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa054=['/:id','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','show','create','put','update','delete'];(function(_0x1fe0f3,_0x45fa0d){var _0x1022c6=function(_0x5a11c8){while(--_0x5a11c8){_0x1fe0f3['push'](_0x1fe0f3['shift']());}};_0x1022c6(++_0x45fa0d);}(_0xa054,0x1b3));var _0x4a05=function(_0x3ef45e,_0xe84f33){_0x3ef45e=_0x3ef45e-0x0;var _0x69e7c=_0xa054[_0x3ef45e];return _0x69e7c;};'use strict';var multer=require('multer');var util=require(_0x4a05('0x0'));var path=require('path');var timeout=require(_0x4a05('0x1'));var express=require(_0x4a05('0x2'));var router=express[_0x4a05('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4a05('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4a05('0x5'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x4a05('0x6')](),controller[_0x4a05('0x7')]);router[_0x4a05('0x8')](_0x4a05('0x9'),auth[_0x4a05('0x6')](),controller['describe']);router[_0x4a05('0x8')]('/:id',auth[_0x4a05('0x6')](),controller[_0x4a05('0xa')]);router['post']('/',auth[_0x4a05('0x6')](),controller[_0x4a05('0xb')]);router[_0x4a05('0xc')]('/:id',auth[_0x4a05('0x6')](),controller[_0x4a05('0xd')]);router[_0x4a05('0xe')](_0x4a05('0xf'),auth['isAuthenticated'](),controller[_0x4a05('0x10')]);module[_0x4a05('0x11')]=router;
\ No newline at end of file
+var _0x1a90=['./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','post','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x523059,_0x4912a0){var _0x4e1f2d=function(_0x4abfc9){while(--_0x4abfc9){_0x523059['push'](_0x523059['shift']());}};_0x4e1f2d(++_0x4912a0);}(_0x1a90,0x1ae));var _0x01a9=function(_0x1e26a3,_0x5bc84d){_0x1e26a3=_0x1e26a3-0x0;var _0x1dfbd7=_0x1a90[_0x1e26a3];return _0x1dfbd7;};'use strict';var multer=require(_0x01a9('0x0'));var util=require(_0x01a9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x01a9('0x2'));var router=express[_0x01a9('0x3')]();var fs_extra=require(_0x01a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x01a9('0x5'));var config=require(_0x01a9('0x6'));var controller=require(_0x01a9('0x7'));router[_0x01a9('0x8')]('/',auth[_0x01a9('0x9')](),controller[_0x01a9('0xa')]);router[_0x01a9('0x8')](_0x01a9('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x01a9('0x8')](_0x01a9('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x01a9('0xd')]('/',auth[_0x01a9('0x9')](),controller['create']);router[_0x01a9('0xe')](_0x01a9('0xc'),auth[_0x01a9('0x9')](),controller[_0x01a9('0xf')]);router[_0x01a9('0x10')](_0x01a9('0xc'),auth[_0x01a9('0x9')](),controller[_0x01a9('0x11')]);module[_0x01a9('0x12')]=router;
\ No newline at end of file
index f6ed942..5b85dcb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x556634,_0x520958){_0x556634=_0x556634-0x0;var _0x4429fd=_0x0b0e[_0x556634];return _0x4429fd;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}};
\ No newline at end of file
+var _0x5ed9=['account','agent','queue','sequelize','exports','ENUM'];(function(_0x274071,_0x4e5698){var _0x58228b=function(_0x497b89){while(--_0x497b89){_0x274071['push'](_0x274071['shift']());}};_0x58228b(++_0x4e5698);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5ed9[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x95ed('0x0'));module[_0x95ed('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x95ed('0x2')](_0x95ed('0x3'),_0x95ed('0x4'),_0x95ed('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}};
\ No newline at end of file
index 293c9ef..f42732f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1849=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','key','model','map','query','filters'];(function(_0x3cdb1e,_0x39bc2e){var _0x545682=function(_0x4b4afb){while(--_0x4b4afb){_0x3cdb1e['push'](_0x3cdb1e['shift']());}};_0x545682(++_0x39bc2e);}(_0x1849,0x19e));var _0x9184=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1849[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x9184('0x0'));var rimraf=require(_0x9184('0x1'));var zipdir=require(_0x9184('0x2'));var jsonpatch=require(_0x9184('0x3'));var rp=require(_0x9184('0x4'));var moment=require(_0x9184('0x5'));var BPromise=require(_0x9184('0x6'));var Mustache=require(_0x9184('0x7'));var util=require(_0x9184('0x8'));var path=require(_0x9184('0x9'));var sox=require('sox');var csv=require(_0x9184('0xa'));var ejs=require(_0x9184('0xb'));var fs=require('fs');var fs_extra=require(_0x9184('0xc'));var _=require('lodash');var squel=require(_0x9184('0xd'));var crypto=require(_0x9184('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9184('0xf'));var Papa=require(_0x9184('0x10'));var Redis=require('ioredis');var authService=require(_0x9184('0x11'));var qs=require(_0x9184('0x12'));var as=require(_0x9184('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9184('0x14'))(_0x9184('0x15'));var utils=require(_0x9184('0x16'));var config=require(_0x9184('0x17'));var licenseUtil=require(_0x9184('0x18'));var db=require(_0x9184('0x19'))['db'];function respondWithStatusCode(_0x48ec30,_0x77a92f){_0x77a92f=_0x77a92f||0xcc;return function(_0x3299ac){if(_0x3299ac){return _0x48ec30['sendStatus'](_0x77a92f);}return _0x48ec30[_0x9184('0x1a')](_0x77a92f)[_0x9184('0x1b')]();};}function respondWithResult(_0x399c86,_0x3f2c98){_0x3f2c98=_0x3f2c98||0xc8;return function(_0x2d38ee){if(_0x2d38ee){return _0x399c86['status'](_0x3f2c98)[_0x9184('0x1c')](_0x2d38ee);}};}function respondWithFilteredResult(_0x44dfe1,_0x3b2d8e){return function(_0x39d4f6){if(_0x39d4f6){var _0x336e6f=typeof _0x3b2d8e['offset']===_0x9184('0x1d')&&typeof _0x3b2d8e['limit']===_0x9184('0x1d');var _0x127777=_0x39d4f6[_0x9184('0x1e')];var _0x3b94d1=_0x336e6f?0x0:_0x3b2d8e[_0x9184('0x1f')];var _0xe45390=_0x336e6f?_0x39d4f6[_0x9184('0x1e')]:_0x3b2d8e[_0x9184('0x1f')]+_0x3b2d8e[_0x9184('0x20')];var _0x2f8140;if(_0xe45390>=_0x127777){_0xe45390=_0x127777;_0x2f8140=0xc8;}else{_0x2f8140=0xce;}_0x44dfe1['status'](_0x2f8140);return _0x44dfe1[_0x9184('0x21')](_0x9184('0x22'),_0x3b94d1+'-'+_0xe45390+'/'+_0x127777)['json'](_0x39d4f6);}return null;};}function patchUpdates(_0xb8acf1){return function(_0x3c0871){try{jsonpatch[_0x9184('0x23')](_0x3c0871,_0xb8acf1,!![]);}catch(_0x5c0119){return BPromise[_0x9184('0x24')](_0x5c0119);}return _0x3c0871[_0x9184('0x25')]();};}function saveUpdates(_0x36c393,_0x57a515){return function(_0x5dc9f1){if(_0x5dc9f1){return _0x5dc9f1['update'](_0x36c393)[_0x9184('0x26')](function(_0x2b97f0){return _0x2b97f0;});}return null;};}function removeEntity(_0x3d7b8e,_0x3c8c06){return function(_0x482c72){if(_0x482c72){return _0x482c72[_0x9184('0x27')]()[_0x9184('0x26')](function(){_0x3d7b8e[_0x9184('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216e94,_0x2e0e8c){return function(_0x2f402d){if(!_0x2f402d){_0x216e94[_0x9184('0x28')](0x194);}return _0x2f402d;};}function handleError(_0x28eeb5,_0x2a5c2b){_0x2a5c2b=_0x2a5c2b||0x1f4;return function(_0x3a3849){logger[_0x9184('0x29')](_0x3a3849[_0x9184('0x2a')]);if(_0x3a3849[_0x9184('0x2b')]){delete _0x3a3849['name'];}_0x28eeb5['status'](_0x2a5c2b)[_0x9184('0x2c')](_0x3a3849);};}exports[_0x9184('0x2d')]=function(_0x2aaa0f,_0x18dc05){var _0x41973f={},_0x69edb0={},_0x402ba3={'count':0x0,'rows':[]};var _0x30f464=_['map'](db[_0x9184('0x2e')][_0x9184('0x2f')],function(_0x4aa9e5){return{'name':_0x4aa9e5[_0x9184('0x30')],'type':_0x4aa9e5['type'][_0x9184('0x31')]};});_0x69edb0[_0x9184('0x32')]=_[_0x9184('0x33')](_0x30f464,_0x9184('0x2b'));_0x69edb0['query']=_['keys'](_0x2aaa0f[_0x9184('0x34')]);_0x69edb0[_0x9184('0x35')]=_[_0x9184('0x36')](_0x69edb0[_0x9184('0x32')],_0x69edb0[_0x9184('0x34')]);_0x41973f['attributes']=_[_0x9184('0x36')](_0x69edb0['model'],qs[_0x9184('0x37')](_0x2aaa0f[_0x9184('0x34')]['fields']));_0x41973f[_0x9184('0x38')]=_0x41973f[_0x9184('0x38')][_0x9184('0x39')]?_0x41973f[_0x9184('0x38')]:_0x69edb0[_0x9184('0x32')];if(!_0x2aaa0f[_0x9184('0x34')][_0x9184('0x3a')](_0x9184('0x3b'))){_0x41973f[_0x9184('0x20')]=qs[_0x9184('0x20')](_0x2aaa0f['query'][_0x9184('0x20')]);_0x41973f['offset']=qs[_0x9184('0x1f')](_0x2aaa0f[_0x9184('0x34')][_0x9184('0x1f')]);}_0x41973f[_0x9184('0x3c')]=qs[_0x9184('0x3d')](_0x2aaa0f[_0x9184('0x34')][_0x9184('0x3d')]);_0x41973f['where']=qs[_0x9184('0x35')](_[_0x9184('0x3e')](_0x2aaa0f[_0x9184('0x34')],_0x69edb0[_0x9184('0x35')]),_0x30f464);if(_0x2aaa0f[_0x9184('0x34')]['filter']){_0x41973f[_0x9184('0x3f')]=_[_0x9184('0x40')](_0x41973f[_0x9184('0x3f')],{'$or':_[_0x9184('0x33')](_0x30f464,function(_0x29fa7c){if(_0x29fa7c['type']!=='VIRTUAL'){var _0x37f14c={};_0x37f14c[_0x29fa7c[_0x9184('0x2b')]]={'$like':'%'+_0x2aaa0f[_0x9184('0x34')][_0x9184('0x41')]+'%'};return _0x37f14c;}})});}_0x41973f=_['merge']({},_0x41973f,_0x2aaa0f[_0x9184('0x42')]);var _0x1399a5={'where':_0x41973f['where']};return db[_0x9184('0x2e')][_0x9184('0x1e')](_0x1399a5)[_0x9184('0x26')](function(_0x42f072){_0x402ba3[_0x9184('0x1e')]=_0x42f072;if(_0x2aaa0f['query'][_0x9184('0x43')]){_0x41973f[_0x9184('0x44')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x9184('0x45')](_0x41973f);})[_0x9184('0x26')](function(_0x4e32c4){_0x402ba3[_0x9184('0x46')]=_0x4e32c4;return _0x402ba3;})[_0x9184('0x26')](respondWithFilteredResult(_0x18dc05,_0x41973f))[_0x9184('0x47')](handleError(_0x18dc05,null));};exports['show']=function(_0x4f30ca,_0x586ca0){var _0x437041={'raw':!![],'where':{'id':_0x4f30ca['params']['id']}},_0x430673={};_0x430673['model']=_[_0x9184('0x48')](db[_0x9184('0x2e')]['rawAttributes']);_0x430673[_0x9184('0x34')]=_[_0x9184('0x48')](_0x4f30ca['query']);_0x430673['filters']=_[_0x9184('0x36')](_0x430673[_0x9184('0x32')],_0x430673[_0x9184('0x34')]);_0x437041['attributes']=_['intersection'](_0x430673['model'],qs['fields'](_0x4f30ca[_0x9184('0x34')]['fields']));_0x437041['attributes']=_0x437041[_0x9184('0x38')]['length']?_0x437041['attributes']:_0x430673[_0x9184('0x32')];if(_0x4f30ca[_0x9184('0x34')][_0x9184('0x43')]){_0x437041[_0x9184('0x44')]=[{'all':!![]}];}_0x437041=_[_0x9184('0x40')]({},_0x437041,_0x4f30ca[_0x9184('0x42')]);return db[_0x9184('0x2e')][_0x9184('0x49')](_0x437041)[_0x9184('0x26')](handleEntityNotFound(_0x586ca0,null))['then'](respondWithResult(_0x586ca0,null))[_0x9184('0x47')](handleError(_0x586ca0,null));};exports[_0x9184('0x4a')]=function(_0x3ee3f8,_0x18581a){return db[_0x9184('0x2e')][_0x9184('0x4a')](_0x3ee3f8[_0x9184('0x4b')],{})[_0x9184('0x26')](respondWithResult(_0x18581a,0xc9))['catch'](handleError(_0x18581a,null));};exports['update']=function(_0x51ea52,_0x571606){if(_0x51ea52[_0x9184('0x4b')]['id']){delete _0x51ea52[_0x9184('0x4b')]['id'];}return db[_0x9184('0x2e')]['find']({'where':{'id':_0x51ea52[_0x9184('0x4c')]['id']}})['then'](handleEntityNotFound(_0x571606,null))[_0x9184('0x26')](saveUpdates(_0x51ea52[_0x9184('0x4b')],null))[_0x9184('0x26')](respondWithResult(_0x571606,null))[_0x9184('0x47')](handleError(_0x571606,null));};exports[_0x9184('0x27')]=function(_0x4bfadb,_0x52733e){return db['WhatsappTransferReport'][_0x9184('0x49')]({'where':{'id':_0x4bfadb[_0x9184('0x4c')]['id']}})[_0x9184('0x26')](handleEntityNotFound(_0x52733e,null))['then'](removeEntity(_0x52733e,null))['catch'](handleError(_0x52733e,null));};exports[_0x9184('0x4d')]=function(_0x41414e,_0x2e236c){return db[_0x9184('0x2e')][_0x9184('0x4d')]()[_0x9184('0x26')](respondWithResult(_0x2e236c,null))[_0x9184('0x47')](handleError(_0x2e236c,null));};
\ No newline at end of file
+var _0x65f6=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','map','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x43941d,_0x52a14a){var _0x2a0f62=function(_0x5bd5ae){while(--_0x5bd5ae){_0x43941d['push'](_0x43941d['shift']());}};_0x2a0f62(++_0x52a14a);}(_0x65f6,0x170));var _0x665f=function(_0x216825,_0x199d5f){_0x216825=_0x216825-0x0;var _0x20c0d0=_0x65f6[_0x216825];return _0x20c0d0;};'use strict';var emlformat=require(_0x665f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x665f('0x1'));var jsonpatch=require(_0x665f('0x2'));var rp=require(_0x665f('0x3'));var moment=require(_0x665f('0x4'));var BPromise=require(_0x665f('0x5'));var Mustache=require(_0x665f('0x6'));var util=require('util');var path=require(_0x665f('0x7'));var sox=require('sox');var csv=require(_0x665f('0x8'));var ejs=require(_0x665f('0x9'));var fs=require('fs');var fs_extra=require(_0x665f('0xa'));var _=require(_0x665f('0xb'));var squel=require(_0x665f('0xc'));var crypto=require('crypto');var jsforce=require(_0x665f('0xd'));var deskjs=require(_0x665f('0xe'));var toCsv=require(_0x665f('0x8'));var querystring=require(_0x665f('0xf'));var Papa=require(_0x665f('0x10'));var Redis=require(_0x665f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x665f('0x12'));var as=require(_0x665f('0x13'));var hardwareService=require(_0x665f('0x14'));var logger=require(_0x665f('0x15'))(_0x665f('0x16'));var utils=require(_0x665f('0x17'));var config=require(_0x665f('0x18'));var licenseUtil=require(_0x665f('0x19'));var db=require(_0x665f('0x1a'))['db'];function respondWithStatusCode(_0x16843f,_0x41787d){_0x41787d=_0x41787d||0xcc;return function(_0x4d1b27){if(_0x4d1b27){return _0x16843f['sendStatus'](_0x41787d);}return _0x16843f[_0x665f('0x1b')](_0x41787d)[_0x665f('0x1c')]();};}function respondWithResult(_0x19b593,_0x1bc06f){_0x1bc06f=_0x1bc06f||0xc8;return function(_0x1118a4){if(_0x1118a4){return _0x19b593[_0x665f('0x1b')](_0x1bc06f)['json'](_0x1118a4);}};}function respondWithFilteredResult(_0x4c7fb9,_0xbae6ac){return function(_0xccbf68){if(_0xccbf68){var _0x1c1bd6=typeof _0xbae6ac[_0x665f('0x1d')]===_0x665f('0x1e')&&typeof _0xbae6ac[_0x665f('0x1f')]==='undefined';var _0x48252b=_0xccbf68[_0x665f('0x20')];var _0x54b11b=_0x1c1bd6?0x0:_0xbae6ac[_0x665f('0x1d')];var _0xabc5a5=_0x1c1bd6?_0xccbf68['count']:_0xbae6ac['offset']+_0xbae6ac['limit'];var _0x15f0db;if(_0xabc5a5>=_0x48252b){_0xabc5a5=_0x48252b;_0x15f0db=0xc8;}else{_0x15f0db=0xce;}_0x4c7fb9[_0x665f('0x1b')](_0x15f0db);return _0x4c7fb9['set'](_0x665f('0x21'),_0x54b11b+'-'+_0xabc5a5+'/'+_0x48252b)[_0x665f('0x22')](_0xccbf68);}return null;};}function patchUpdates(_0x12dd05){return function(_0x1f09eb){try{jsonpatch[_0x665f('0x23')](_0x1f09eb,_0x12dd05,!![]);}catch(_0x4be28e){return BPromise[_0x665f('0x24')](_0x4be28e);}return _0x1f09eb[_0x665f('0x25')]();};}function saveUpdates(_0xae22d6,_0x33699d){return function(_0x4a149b){if(_0x4a149b){return _0x4a149b[_0x665f('0x26')](_0xae22d6)[_0x665f('0x27')](function(_0x1272d9){return _0x1272d9;});}return null;};}function removeEntity(_0x4502a6,_0xff8443){return function(_0x4ab43d){if(_0x4ab43d){return _0x4ab43d[_0x665f('0x28')]()[_0x665f('0x27')](function(){_0x4502a6[_0x665f('0x1b')](0xcc)[_0x665f('0x1c')]();});}};}function handleEntityNotFound(_0x476b69,_0x50e418){return function(_0x39d5ca){if(!_0x39d5ca){_0x476b69[_0x665f('0x29')](0x194);}return _0x39d5ca;};}function handleError(_0x50b09a,_0xec7adf){_0xec7adf=_0xec7adf||0x1f4;return function(_0x1716c9){logger['error'](_0x1716c9[_0x665f('0x2a')]);if(_0x1716c9[_0x665f('0x2b')]){delete _0x1716c9[_0x665f('0x2b')];}_0x50b09a[_0x665f('0x1b')](_0xec7adf)['send'](_0x1716c9);};}exports['index']=function(_0x279afc,_0x31781a){var _0x2e4a3a={},_0x597ca7={},_0x2a7da8={'count':0x0,'rows':[]};var _0x3051c8=_[_0x665f('0x2c')](db[_0x665f('0x2d')]['rawAttributes'],function(_0x56f4ae){return{'name':_0x56f4ae[_0x665f('0x2e')],'type':_0x56f4ae[_0x665f('0x2f')][_0x665f('0x30')]};});_0x597ca7[_0x665f('0x31')]=_['map'](_0x3051c8,_0x665f('0x2b'));_0x597ca7[_0x665f('0x32')]=_[_0x665f('0x33')](_0x279afc[_0x665f('0x32')]);_0x597ca7[_0x665f('0x34')]=_[_0x665f('0x35')](_0x597ca7[_0x665f('0x31')],_0x597ca7[_0x665f('0x32')]);_0x2e4a3a[_0x665f('0x36')]=_['intersection'](_0x597ca7[_0x665f('0x31')],qs[_0x665f('0x37')](_0x279afc[_0x665f('0x32')][_0x665f('0x37')]));_0x2e4a3a[_0x665f('0x36')]=_0x2e4a3a[_0x665f('0x36')][_0x665f('0x38')]?_0x2e4a3a['attributes']:_0x597ca7[_0x665f('0x31')];if(!_0x279afc['query'][_0x665f('0x39')]('nolimit')){_0x2e4a3a[_0x665f('0x1f')]=qs['limit'](_0x279afc[_0x665f('0x32')]['limit']);_0x2e4a3a[_0x665f('0x1d')]=qs[_0x665f('0x1d')](_0x279afc['query'][_0x665f('0x1d')]);}_0x2e4a3a[_0x665f('0x3a')]=qs[_0x665f('0x3b')](_0x279afc[_0x665f('0x32')][_0x665f('0x3b')]);_0x2e4a3a['where']=qs[_0x665f('0x34')](_[_0x665f('0x3c')](_0x279afc['query'],_0x597ca7['filters']),_0x3051c8);if(_0x279afc[_0x665f('0x32')][_0x665f('0x3d')]){_0x2e4a3a[_0x665f('0x3e')]=_['merge'](_0x2e4a3a['where'],{'$or':_[_0x665f('0x2c')](_0x3051c8,function(_0x47c1f9){if(_0x47c1f9[_0x665f('0x2f')]!==_0x665f('0x3f')){var _0x20a294={};_0x20a294[_0x47c1f9[_0x665f('0x2b')]]={'$like':'%'+_0x279afc[_0x665f('0x32')][_0x665f('0x3d')]+'%'};return _0x20a294;}})});}_0x2e4a3a=_[_0x665f('0x40')]({},_0x2e4a3a,_0x279afc[_0x665f('0x41')]);var _0x577e6d={'where':_0x2e4a3a[_0x665f('0x3e')]};return db[_0x665f('0x2d')][_0x665f('0x20')](_0x577e6d)[_0x665f('0x27')](function(_0x5505ae){_0x2a7da8['count']=_0x5505ae;if(_0x279afc[_0x665f('0x32')]['includeAll']){_0x2e4a3a[_0x665f('0x42')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x665f('0x43')](_0x2e4a3a);})['then'](function(_0x500319){_0x2a7da8['rows']=_0x500319;return _0x2a7da8;})[_0x665f('0x27')](respondWithFilteredResult(_0x31781a,_0x2e4a3a))[_0x665f('0x44')](handleError(_0x31781a,null));};exports[_0x665f('0x45')]=function(_0x12fd57,_0x289d60){var _0x438db7={'raw':!![],'where':{'id':_0x12fd57[_0x665f('0x46')]['id']}},_0x207518={};_0x207518[_0x665f('0x31')]=_[_0x665f('0x33')](db[_0x665f('0x2d')][_0x665f('0x47')]);_0x207518[_0x665f('0x32')]=_[_0x665f('0x33')](_0x12fd57['query']);_0x207518[_0x665f('0x34')]=_[_0x665f('0x35')](_0x207518[_0x665f('0x31')],_0x207518[_0x665f('0x32')]);_0x438db7[_0x665f('0x36')]=_[_0x665f('0x35')](_0x207518[_0x665f('0x31')],qs[_0x665f('0x37')](_0x12fd57[_0x665f('0x32')][_0x665f('0x37')]));_0x438db7[_0x665f('0x36')]=_0x438db7[_0x665f('0x36')][_0x665f('0x38')]?_0x438db7[_0x665f('0x36')]:_0x207518[_0x665f('0x31')];if(_0x12fd57[_0x665f('0x32')][_0x665f('0x48')]){_0x438db7[_0x665f('0x42')]=[{'all':!![]}];}_0x438db7=_[_0x665f('0x40')]({},_0x438db7,_0x12fd57[_0x665f('0x41')]);return db['WhatsappTransferReport'][_0x665f('0x49')](_0x438db7)['then'](handleEntityNotFound(_0x289d60,null))[_0x665f('0x27')](respondWithResult(_0x289d60,null))[_0x665f('0x44')](handleError(_0x289d60,null));};exports[_0x665f('0x4a')]=function(_0x97d760,_0x10c0aa){return db[_0x665f('0x2d')][_0x665f('0x4a')](_0x97d760[_0x665f('0x4b')],{})[_0x665f('0x27')](respondWithResult(_0x10c0aa,0xc9))[_0x665f('0x44')](handleError(_0x10c0aa,null));};exports['update']=function(_0x189674,_0x1fe29c){if(_0x189674[_0x665f('0x4b')]['id']){delete _0x189674[_0x665f('0x4b')]['id'];}return db[_0x665f('0x2d')][_0x665f('0x49')]({'where':{'id':_0x189674[_0x665f('0x46')]['id']}})[_0x665f('0x27')](handleEntityNotFound(_0x1fe29c,null))[_0x665f('0x27')](saveUpdates(_0x189674[_0x665f('0x4b')],null))[_0x665f('0x27')](respondWithResult(_0x1fe29c,null))[_0x665f('0x44')](handleError(_0x1fe29c,null));};exports[_0x665f('0x28')]=function(_0x43ef74,_0x5164d0){return db['WhatsappTransferReport']['find']({'where':{'id':_0x43ef74[_0x665f('0x46')]['id']}})[_0x665f('0x27')](handleEntityNotFound(_0x5164d0,null))[_0x665f('0x27')](removeEntity(_0x5164d0,null))[_0x665f('0x44')](handleError(_0x5164d0,null));};exports[_0x665f('0x4c')]=function(_0x88df6e,_0x39c20a){return db[_0x665f('0x2d')][_0x665f('0x4c')]()[_0x665f('0x27')](respondWithResult(_0x39c20a,null))['catch'](handleError(_0x39c20a,null));};
\ No newline at end of file
index 5945f36..6efde17 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf53e=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x44197a,_0x50ccda){var _0x256a8e=function(_0x4153af){while(--_0x4153af){_0x44197a['push'](_0x44197a['shift']());}};_0x256a8e(++_0x50ccda);}(_0xf53e,0x1a8));var _0xef53=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf53e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xef53('0x0'));var util=require(_0xef53('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xef53('0x2'));var BPromise=require('bluebird');var rp=require(_0xef53('0x3'));var fs=require('fs');var path=require(_0xef53('0x4'));var rimraf=require(_0xef53('0x5'));var config=require(_0xef53('0x6'));var attributes=require('./whatsappTransferReport.attributes');module[_0xef53('0x7')]=function(_0x521f7d,_0x4a38b3){return _0x521f7d[_0xef53('0x8')](_0xef53('0x9'),attributes,{'tableName':_0xef53('0xa'),'paranoid':![],'indexes':[{'name':_0xef53('0xb'),'fields':[_0xef53('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xd616=['api','path','rimraf','../../config/environment','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','../../config/logger'];(function(_0x34d13a,_0x34aece){var _0x179786=function(_0x54a421){while(--_0x54a421){_0x34d13a['push'](_0x34d13a['shift']());}};_0x179786(++_0x34aece);}(_0xd616,0x98));var _0x6d61=function(_0x206338,_0x2d800b){_0x206338=_0x206338-0x0;var _0x2b87f2=_0xd616[_0x206338];return _0x2b87f2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6d61('0x0'))(_0x6d61('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d61('0x2'));var rimraf=require(_0x6d61('0x3'));var config=require(_0x6d61('0x4'));var attributes=require('./whatsappTransferReport.attributes');module[_0x6d61('0x5')]=function(_0x3176f9,_0x398407){return _0x3176f9['define'](_0x6d61('0x6'),attributes,{'tableName':_0x6d61('0x7'),'paranoid':![],'indexes':[{'name':_0x6d61('0x8'),'fields':[_0x6d61('0x8')]}],'timestamps':!![]});};
\ No newline at end of file
index 6b6d797..f3b01b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe0dc=['error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b7d7d,_0xc96d25){var _0x37589c=function(_0x161578){while(--_0x161578){_0x5b7d7d['push'](_0x5b7d7d['shift']());}};_0x37589c(++_0xc96d25);}(_0xe0dc,0x190));var _0xce0d=function(_0x4180c6,_0x642cf3){_0x4180c6=_0x4180c6-0x0;var _0xe0e5aa=_0xe0dc[_0x4180c6];return _0xe0e5aa;};'use strict';var _=require(_0xce0d('0x0'));var util=require('util');var moment=require(_0xce0d('0x1'));var BPromise=require(_0xce0d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce0d('0x3'));var db=require(_0xce0d('0x4'))['db'];var utils=require(_0xce0d('0x5'));var logger=require(_0xce0d('0x6'))('rpc');var config=require(_0xce0d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xce0d('0x8')][_0xce0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eee17,_0x4724f4,_0x3d0c1d){return new BPromise(function(_0x2f82c0,_0x15d5c0){return client[_0xce0d('0xa')](_0x2eee17,_0x3d0c1d)[_0xce0d('0xb')](function(_0x3e63c7){logger[_0xce0d('0xc')](_0xce0d('0xd'),_0x4724f4,_0xce0d('0xe'));logger[_0xce0d('0xf')](_0xce0d('0x10'),_0x4724f4,_0xce0d('0xe'),JSON[_0xce0d('0x11')](_0x3e63c7));if(_0x3e63c7[_0xce0d('0x12')]){if(_0x3e63c7[_0xce0d('0x12')]['code']===0x1f4){logger[_0xce0d('0x12')](_0xce0d('0xd'),_0x4724f4,_0x3e63c7[_0xce0d('0x12')][_0xce0d('0x13')]);return _0x15d5c0(_0x3e63c7[_0xce0d('0x12')][_0xce0d('0x13')]);}logger[_0xce0d('0x12')](_0xce0d('0xd'),_0x4724f4,_0x3e63c7[_0xce0d('0x12')][_0xce0d('0x13')]);return _0x2f82c0(_0x3e63c7[_0xce0d('0x12')][_0xce0d('0x13')]);}else{logger[_0xce0d('0xc')](_0xce0d('0xd'),_0x4724f4,_0xce0d('0xe'));_0x2f82c0(_0x3e63c7[_0xce0d('0x14')][_0xce0d('0x13')]);}})[_0xce0d('0x15')](function(_0x459c44){logger[_0xce0d('0x12')](_0xce0d('0xd'),_0x4724f4,_0x459c44);_0x15d5c0(_0x459c44);});});}
\ No newline at end of file
+var _0x1b1a=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1b1a,0x1a1));var _0xa1b1=function(_0x5aef17,_0x592cd4){_0x5aef17=_0x5aef17-0x0;var _0x43f9d0=_0x1b1a[_0x5aef17];return _0x43f9d0;};'use strict';var _=require(_0xa1b1('0x0'));var util=require(_0xa1b1('0x1'));var moment=require('moment');var BPromise=require(_0xa1b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa1b1('0x3'));var db=require(_0xa1b1('0x4'))['db'];var utils=require(_0xa1b1('0x5'));var logger=require(_0xa1b1('0x6'))('rpc');var config=require(_0xa1b1('0x7'));var jayson=require(_0xa1b1('0x8'));var client=jayson[_0xa1b1('0x9')][_0xa1b1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cf367,_0x5b39a3,_0x19c65c){return new BPromise(function(_0x5c2ba0,_0x1037c3){return client[_0xa1b1('0xb')](_0x5cf367,_0x19c65c)['then'](function(_0x474244){logger[_0xa1b1('0xc')](_0xa1b1('0xd'),_0x5b39a3,_0xa1b1('0xe'));logger[_0xa1b1('0xf')](_0xa1b1('0x10'),_0x5b39a3,_0xa1b1('0xe'),JSON['stringify'](_0x474244));if(_0x474244[_0xa1b1('0x11')]){if(_0x474244[_0xa1b1('0x11')][_0xa1b1('0x12')]===0x1f4){logger[_0xa1b1('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5b39a3,_0x474244[_0xa1b1('0x11')][_0xa1b1('0x13')]);return _0x1037c3(_0x474244[_0xa1b1('0x11')][_0xa1b1('0x13')]);}logger[_0xa1b1('0x11')](_0xa1b1('0xd'),_0x5b39a3,_0x474244[_0xa1b1('0x11')]['message']);return _0x5c2ba0(_0x474244['error'][_0xa1b1('0x13')]);}else{logger[_0xa1b1('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5b39a3,_0xa1b1('0xe'));_0x5c2ba0(_0x474244[_0xa1b1('0x14')][_0xa1b1('0x13')]);}})[_0xa1b1('0x15')](function(_0x34557e){logger[_0xa1b1('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5b39a3,_0x34557e);_0x1037c3(_0x34557e);});});}
\ No newline at end of file
index 80b4fb6..60f93ea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ffe=['catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','join','Offline\x20apps:','status','name','None','log','App\x20Ready!'];(function(_0x3ee146,_0x5ec137){var _0x3bb7d0=function(_0xfc8a76){while(--_0xfc8a76){_0x3ee146['push'](_0x3ee146['shift']());}};_0x3bb7d0(++_0x5ec137);}(_0x1ffe,0xa5));var _0xe1ff=function(_0x2a00ed,_0x4e8066){_0x2a00ed=_0x2a00ed-0x0;var _0x3b0dbb=_0x1ffe[_0x2a00ed];return _0x3b0dbb;};'use strict';var _=require(_0xe1ff('0x0'));var db=require(_0xe1ff('0x1'))['db'];var seedDb=require(_0xe1ff('0x2'));var checkLicense=require(_0xe1ff('0x3'));var rpc=require(_0xe1ff('0x4'));var config=require(_0xe1ff('0x5'));var logger=require(_0xe1ff('0x6'))(_0xe1ff('0x7'));var pm2=require(_0xe1ff('0x8'));var pm2Config=require(_0xe1ff('0x9'));var schedule=require(_0xe1ff('0xa'));var chat=require(_0xe1ff('0xb'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0xe1ff('0xc'));function main(){return db[_0xe1ff('0xd')][_0xe1ff('0xe')]()[_0xe1ff('0xf')](function(){if(config[_0xe1ff('0x10')]){return seedDb[_0xe1ff('0x11')]();}})[_0xe1ff('0xf')](function(){return checkLicense[_0xe1ff('0x11')]();})[_0xe1ff('0xf')](function(){return rpc[_0xe1ff('0x12')]();})[_0xe1ff('0xf')](function(_0x5f51d3){logger[_0xe1ff('0x13')](_0x5f51d3);return chat[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return whatsapp[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return schedule[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return transcribe[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return provider[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(_0x1010ef){logger['info'](_0x1010ef);return pm2[_0xe1ff('0x14')](pm2Config);})[_0xe1ff('0xf')](function(_0x26511f){var _0x486942=_0x26511f[_0xe1ff('0x15')](function(_0x45597a){return typeof _0x45597a['exitCode']==='number'&&_0x45597a['exitCode']>=0x0;});if(_0x486942[_0xe1ff('0x16')]>0x0){throw new Error(_0x486942[_0xe1ff('0x16')]+_0xe1ff('0x17')+_[_0xe1ff('0x18')](_0x486942,function(_0x45c3be){return'\x22'+_0x45c3be[_0xe1ff('0x19')]['name']+'\x22';}));}logger['info'](_0xe1ff('0x1a'),_[_0xe1ff('0x18')](_[_0xe1ff('0x15')](_0x26511f,{'status':_0xe1ff('0x1b')}),'name')[_0xe1ff('0x1c')]());logger[_0xe1ff('0x13')](_0xe1ff('0x1d'),_[_0xe1ff('0x18')](_[_0xe1ff('0x15')](_0x26511f,function(_0x149cd7){return _0x149cd7[_0xe1ff('0x1e')]!==_0xe1ff('0x1b');}),_0xe1ff('0x1f'))[_0xe1ff('0x1c')]()||_0xe1ff('0x20'));console[_0xe1ff('0x21')](_0xe1ff('0x22'));})[_0xe1ff('0x23')](function(_0x37face){console[_0xe1ff('0x21')](_0xe1ff('0x24'),_0x37face);logger[_0xe1ff('0x25')](_0xe1ff('0x26'),_0x37face);process[_0xe1ff('0x27')](0x1);});}main();
\ No newline at end of file
+var _0x9b69=['join','Offline\x20apps:','filter','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online'];(function(_0x5ee6d6,_0x28cd9c){var _0x22fc33=function(_0x10ee1d){while(--_0x10ee1d){_0x5ee6d6['push'](_0x5ee6d6['shift']());}};_0x22fc33(++_0x28cd9c);}(_0x9b69,0xa3));var _0x99b6=function(_0xa8721b,_0x42c0f8){_0xa8721b=_0xa8721b-0x0;var _0x255f8c=_0x9b69[_0xa8721b];return _0x255f8c;};'use strict';var _=require(_0x99b6('0x0'));var db=require(_0x99b6('0x1'))['db'];var seedDb=require(_0x99b6('0x2'));var checkLicense=require('./config/license');var rpc=require('./rpc');var config=require(_0x99b6('0x3'));var logger=require('./config/logger')(_0x99b6('0x4'));var pm2=require(_0x99b6('0x5'));var pm2Config=require(_0x99b6('0x6'));var schedule=require('./config/schedule');var chat=require(_0x99b6('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x99b6('0x8'));var provider=require(_0x99b6('0x9'));function main(){return db[_0x99b6('0xa')][_0x99b6('0xb')]()[_0x99b6('0xc')](function(){if(config[_0x99b6('0xd')]){return seedDb[_0x99b6('0xe')]();}})[_0x99b6('0xc')](function(){return checkLicense[_0x99b6('0xe')]();})[_0x99b6('0xc')](function(){return rpc[_0x99b6('0xf')]();})[_0x99b6('0xc')](function(_0x3af521){logger[_0x99b6('0x10')](_0x3af521);return chat[_0x99b6('0x11')]();})[_0x99b6('0xc')](function(){return whatsapp[_0x99b6('0x11')]();})[_0x99b6('0xc')](function(){return schedule[_0x99b6('0x11')]();})[_0x99b6('0xc')](function(){return transcribe['start']();})['then'](function(){return provider['start']();})['then'](function(_0x57033e){logger['info'](_0x57033e);return pm2['start'](pm2Config);})[_0x99b6('0xc')](function(_0x184e90){var _0x2cda40=_0x184e90['filter'](function(_0xb63749){return typeof _0xb63749[_0x99b6('0x12')]===_0x99b6('0x13')&&_0xb63749[_0x99b6('0x12')]>=0x0;});if(_0x2cda40['length']>0x0){throw new Error(_0x2cda40[_0x99b6('0x14')]+_0x99b6('0x15')+_[_0x99b6('0x16')](_0x2cda40,function(_0x2a2bf2){return'\x22'+_0x2a2bf2[_0x99b6('0x17')][_0x99b6('0x18')]+'\x22';}));}logger[_0x99b6('0x10')](_0x99b6('0x19'),_[_0x99b6('0x16')](_['filter'](_0x184e90,{'status':_0x99b6('0x1a')}),_0x99b6('0x18'))[_0x99b6('0x1b')]());logger[_0x99b6('0x10')](_0x99b6('0x1c'),_[_0x99b6('0x16')](_[_0x99b6('0x1d')](_0x184e90,function(_0x59045f){return _0x59045f['status']!==_0x99b6('0x1a');}),_0x99b6('0x18'))[_0x99b6('0x1b')]()||_0x99b6('0x1e'));console['log'](_0x99b6('0x1f'));})[_0x99b6('0x20')](function(_0x440752){console[_0x99b6('0x21')](_0x99b6('0x22'),_0x440752);logger[_0x99b6('0x23')](_0x99b6('0x24'),_0x440752);process[_0x99b6('0x25')](0x1);});}main();
\ No newline at end of file
index 5389f57..41a7d12 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34e8=['validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','join','promisify','sign','secret','secrets','payload','options','verify','toString','hex','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','user','ChatInteraction','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User','find','pass','status','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','getUuid','then','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','minutes','User\x20not\x20found.','canUpdate','use','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'];(function(_0xdbc55e,_0x3c1f9f){var _0x56e8b3=function(_0x1a6717){while(--_0x1a6717){_0xdbc55e['push'](_0xdbc55e['shift']());}};_0x56e8b3(++_0x3c1f9f);}(_0x34e8,0x12c));var _0x834e=function(_0x12beed,_0xc703cb){_0x12beed=_0x12beed-0x0;var _0x2ffd64=_0x34e8[_0x12beed];return _0x2ffd64;};'use strict';var db=require(_0x834e('0x0'))['db'];var config=require(_0x834e('0x1'));var hardwareConf=require(_0x834e('0x2'));var licenseUtil=require(_0x834e('0x3'));var encryptor=require('../encryptor');var _=require(_0x834e('0x4'));var jwt=require(_0x834e('0x5'));var expressJwt=require(_0x834e('0x6'));var compose=require(_0x834e('0x7'));var basicAuth=require(_0x834e('0x8'));var crypto=require(_0x834e('0x9'));var BPromise=require(_0x834e('0xa'));var util=require('util');var moment=require(_0x834e('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x834e('0xc')]});var userAttributes=['id',_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10'),_0x834e('0x11'),_0x834e('0x12'),_0x834e('0x13'),_0x834e('0x14'),_0x834e('0x15'),_0x834e('0x16'),_0x834e('0x17'),_0x834e('0x18'),_0x834e('0x19'),_0x834e('0x1a'),_0x834e('0x1b'),_0x834e('0x1c'),'lastLoginAt',_0x834e('0x1d'),_0x834e('0x1e'),'allowmessenger',_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),'phoneBarDnd',_0x834e('0x23'),_0x834e('0x24'),'phoneBarEnableSettings',_0x834e('0x25'),'phoneBarPrefixRequired',_0x834e('0x26'),_0x834e('0x27'),'hotdesk',_0x834e('0x28'),_0x834e('0x29'),_0x834e('0x2a'),'settingsEnabled',_0x834e('0x2b'),_0x834e('0x2c'),_0x834e('0x2d'),_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30'),_0x834e('0x31'),'chatAutoanswerDelay',_0x834e('0x32'),_0x834e('0x33'),_0x834e('0x34'),_0x834e('0x35'),'openchannelAutoanswer',_0x834e('0x36'),_0x834e('0x37'),'faxAutoanswerDelay',_0x834e('0x38'),_0x834e('0x39')];exports[_0x834e('0x3a')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x231619,_0x34563b,_0x589dde){if(_0x231619[_0x834e('0x3b')]){_0x589dde();}else{return db[_0x834e('0x3c')]['findOne']({'where':{'id':_0x231619[_0x834e('0x3d')]['id']},'attributes':['id',_0x834e('0x3e'),_0x834e('0x3f')],'raw':!![]})['then'](function(_0x24fcf7){if(_0x24fcf7&&_0x24fcf7[_0x834e('0x3e')]){return _0x34563b['status'](_0x24fcf7['disposition']===_0x834e('0x40')?0x195:0x193)['json']({'message':_0x24fcf7[_0x834e('0x3f')]===_0x834e('0x40')?_0x834e('0x41'):_0x834e('0x42')});}else{_0x589dde();}})[_0x834e('0x43')](function(_0x130cc5){_0x589dde(_0x130cc5);});}});};exports['isAuthenticated']=function isAuthenticated(_0x510780){return compose()['use'](function(_0x58c1d7,_0x2c7a8d,_0x567cea){var _0x106d6a;if(_0x58c1d7['headers'][_0x834e('0x44')]){if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],_0x834e('0x47'))){var _0x390119=basicAuth(_0x58c1d7);db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'name':_0x390119[_0x834e('0xf')]}})['then'](function(_0xef9ec2){if(!_0xef9ec2||!_0xef9ec2['authenticate'](_0x390119[_0x834e('0x4a')])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x4d')});}_0x58c1d7[_0x834e('0x3b')]={'id':_0xef9ec2['id']};_0x567cea();})[_0x834e('0x43')](function(_0x4696a1){_0x567cea(_0x4696a1);});}else if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],'Bearer')){validateJwt(_0x58c1d7,_0x2c7a8d,_0x567cea);}else{if(_0x510780){_0x567cea();}else{return _0x2c7a8d[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}}}else if(_0x58c1d7[_0x834e('0x4f')]['apikey']){try{var _0x3f88ad={'audience':hardwareConf[_0x834e('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x58c1d7['query']['apikey'],_0x3f88ad)[_0x834e('0x51')](function(_0x41bf4d){return db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x41bf4d[_0x834e('0x52')]}})[_0x834e('0x51')](function(_0x4c2ef6){_0x106d6a=_0x4c2ef6;return db[_0x834e('0x53')]['findOne']({'where':{'id':0x1},'attributes':[_0x834e('0x54'),_0x834e('0x55')],'raw':!![]});})['then'](function(_0x18ac3b){if(!_0x106d6a||!_[_0x834e('0x56')](_0x106d6a['apiKeyNonce'],_0x41bf4d['nonce'])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x57')});}if(_0x106d6a[_0x834e('0x58')]){return _0x2c7a8d[_0x834e('0x4b')](0x191)['json']({'message':_0x834e('0x59')});}if(_0x106d6a['blocked']){if(_0x18ac3b['blockDuration']>0x0){if(moment(_0x106d6a[_0x834e('0x5a')])['add'](_0x18ac3b[_0x834e('0x55')],_0x834e('0x5b'))>moment()){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}else{return _0x2c7a8d['status'](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}_0x58c1d7[_0x834e('0x3b')]={'id':_0x106d6a['id']};_0x567cea();});})['catch'](function(){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1e3e71){_0x567cea(_0x1e3e71);}}else if(_0x510780){_0x567cea();}else{return _0x2c7a8d['status'](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}})['use'](function(_0x4a6942,_0x22ea21,_0x16969b){if(_0x4a6942[_0x834e('0x3b')]){db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x4a6942[_0x834e('0x3b')]['id']},'attributes':userAttributes})[_0x834e('0x51')](function(_0x4a3381){if(!_0x4a3381){return _0x22ea21[_0x834e('0x4b')](0x194)['json']({'message':_0x834e('0x5c')});}_0x4a6942['user']=_0x4a3381;_0x16969b();})[_0x834e('0x43')](function(_0x5a5807){_0x16969b(_0x5a5807);});}else if(_0x510780){_0x16969b();}else{return _0x22ea21[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x834e('0x5d')]=function canUpdate(){return compose()[_0x834e('0x5e')](function(_0xa880cb,_0xd55cc3,_0x252ea0){return licenseUtil[_0x834e('0x5f')]()[_0x834e('0x51')](function(_0x3ccd8e){if(_0x3ccd8e[_0x834e('0x60')]){_0x252ea0();}else{return _0xd55cc3[_0x834e('0x4b')](0x193)['json']({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0x47a8a9){_0x252ea0(_0x47a8a9);});});};exports[_0x834e('0x62')]=function isWebrtcLicence(){return compose()[_0x834e('0x5e')](function(_0x25b035,_0x2112d5,_0x19b5ef){return licenseUtil[_0x834e('0x5f')]()['then'](function(_0x59c855){if(_0x59c855[_0x834e('0x63')]){_0x19b5ef();}else{return _0x2112d5[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0xd1d83b){_0x19b5ef(_0xd1d83b);});});};exports[_0x834e('0x64')]=function(_0x43f599,_0x1419eb,_0x390c45){_0x43f599[_0x834e('0x64')]=!![];return _0x390c45();};exports[_0x834e('0x65')]=function signToken(_0x1a28f6){return signJwt(_0x1a28f6);};exports[_0x834e('0x66')]=function(_0x2aa072,_0x1a3855){if(!_0x2aa072[_0x834e('0x3b')]){return _0x1a3855[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':_0x834e('0x67')});}var _0x4cfacd={'payload':{'id':_0x2aa072[_0x834e('0x3b')]['id'],'role':_0x2aa072[_0x834e('0x3b')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4cfacd)[_0x834e('0x51')](function(_0x3b0988){_0x1a3855['cookie'](_0x834e('0x68'),_0x3b0988);_0x1a3855[_0x834e('0x69')](_0x834e('0x6a'));})[_0x834e('0x43')](function(_0x4288e4){return _0x1a3855[_0x834e('0x4b')](0x1f4)[_0x834e('0x6b')](_0x4288e4);});};exports['retrieveApiKey']=function(_0x1ad7fe){if(_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6d')])||_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6e')])){return null;}else{return createJwt(_0x1ad7fe);}};exports[_0x834e('0x6f')]=function(_0x344b51){_0x344b51[_0x834e('0x6d')]=generateNonce();_0x344b51['apiKeyIat']=generateIssuedAt();return createJwt(_0x344b51);};exports[_0x834e('0x70')]=function(_0x4dc104,_0x2f4bde){var _0x53a9ee=_0x4dc104[_0x834e('0x4f')]['apikey'];if(_0x53a9ee){var _0x527eef={'nonce':_0x2f4bde[_0x834e('0x6d')],'iat':_0x2f4bde[_0x834e('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x53a9ee,_0x527eef)[_0x834e('0x51')](function(){return generateApiKey(_0x2f4bde);});}else{throw{'message':_0x834e('0x71')};}};exports[_0x834e('0x72')]=function(_0x387365){var _0x21c417=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x21c417[_0x834e('0x73')](_0x387365))throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x834e('0x76')]=function(_0x3c70bf,_0x5d5ac2,_0x281342){var _0x4e2b22=encryptor[_0x834e('0x77')](_0x5d5ac2)[_0x834e('0x78')](',');for(var _0x5160c4=0x0;_0x5160c4<_0x281342;_0x5160c4++){if(!_0x4e2b22[_0x5160c4])break;if(_0x3c70bf[_0x834e('0x79')]()===_0x4e2b22[_0x5160c4][_0x834e('0x79')]()){var _0x2de29a=util[_0x834e('0x7a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x281342);if(_0x281342===0x1){_0x2de29a=_0x834e('0x7b');}throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))](_0x2de29a);}}return;};exports['updatePasswordsHistory']=function(_0x246b8e,_0x1fcae9){var _0x3a7683=_0x1fcae9?encryptor[_0x834e('0x77')](_0x1fcae9)[_0x834e('0x78')](','):[];if(_0x3a7683[_0x834e('0x7c')]===0x5){_0x3a7683[_0x834e('0x7d')](-0x1,0x1);}_0x3a7683[_0x834e('0x7e')](_0x246b8e);return encryptor[_0x834e('0x7f')](_0x3a7683[_0x834e('0x80')](','));};function signJwt(_0x1e4310){var _0x1dfa95=BPromise[_0x834e('0x81')](jwt[_0x834e('0x82')],{'context':jwt});var _0x460a7a=_0x1e4310[_0x834e('0x83')]||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x193a15,_0x3e3467){_0x1dfa95(_0x1e4310[_0x834e('0x85')],_0x460a7a,_0x1e4310[_0x834e('0x86')])['then'](function(_0x2145cf){_0x193a15(_0x2145cf);})[_0x834e('0x43')](function(_0x45bcc2){_0x3e3467(_0x45bcc2);});});}function verifyJwt(_0x36cc14,_0x4ca099,_0x30faa8){var _0x5a9c70=BPromise['promisify'](jwt[_0x834e('0x87')],{'context':jwt});var _0x2b1ec7=_0x30faa8||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x216105,_0x3821ad){_0x5a9c70(_0x36cc14,_0x2b1ec7,_0x4ca099)[_0x834e('0x51')](function(_0xe5c8f6){_0x216105(_0xe5c8f6);})['catch'](function(_0xdef8c4){_0x3821ad(_0xdef8c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x834e('0x88')](_0x834e('0x89'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x834e('0x88')]();}function createJwt(_0x82f2a7){var _0x363cc2={'payload':{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')]},'options':{'algorithm':'HS512','subject':_0x82f2a7['id'][_0x834e('0x88')](),'issuer':hardwareConf[_0x834e('0x50')](),'audience':hardwareConf[_0x834e('0x50')]()}};return signJwt(_0x363cc2)[_0x834e('0x51')](function(_0x3181af){return{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')],'token':_0x3181af};});}
\ No newline at end of file
+var _0x70e0=['express-jwt','composable-middleware','crypto','util','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','catch','headers','authorization','startsWith','Basic','User','authenticate','Bearer','status','query','apikey','getUuid','find','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','splice','encryptString','promisify','sign','secret','secrets','session','options','verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken'];(function(_0x22a3bc,_0x4da94e){var _0x4dcc97=function(_0x3408da){while(--_0x3408da){_0x22a3bc['push'](_0x22a3bc['shift']());}};_0x4dcc97(++_0x4da94e);}(_0x70e0,0x17b));var _0x070e=function(_0x2c2bdf,_0x19cea5){_0x2c2bdf=_0x2c2bdf-0x0;var _0x449bdc=_0x70e0[_0x2c2bdf];return _0x449bdc;};'use strict';var db=require(_0x070e('0x0'))['db'];var config=require(_0x070e('0x1'));var hardwareConf=require(_0x070e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x070e('0x3'));var jwt=require(_0x070e('0x4'));var expressJwt=require(_0x070e('0x5'));var compose=require(_0x070e('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x070e('0x7'));var BPromise=require('bluebird');var util=require(_0x070e('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0x070e('0x9'),_0x070e('0xa'),_0x070e('0xb'),_0x070e('0xc'),_0x070e('0xd'),_0x070e('0xe'),_0x070e('0xf'),'md5secret','voicePause',_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13'),_0x070e('0x14'),_0x070e('0x15'),_0x070e('0x16'),_0x070e('0x17'),_0x070e('0x18'),_0x070e('0x19'),_0x070e('0x1a'),'passwordResetAt','alias',_0x070e('0x1b'),'phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording',_0x070e('0x1c'),_0x070e('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0x070e('0x1e'),_0x070e('0x1f'),_0x070e('0x20'),_0x070e('0x21'),'userProfileId','privacyEnabled',_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26'),'ignorePauseForPreviewCalls',_0x070e('0x27'),_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a'),_0x070e('0x2b'),'smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer',_0x070e('0x2c'),_0x070e('0x2d'),_0x070e('0x2e'),'whatsappAutoanswer',_0x070e('0x2f')];exports['isChatInteractionAuthorized']=function(){return this[_0x070e('0x30')](!![])[_0x070e('0x31')](function(_0x27a01e,_0x33e8c6,_0x28a1c3){if(_0x27a01e[_0x070e('0x32')]){_0x28a1c3();}else{return db[_0x070e('0x33')][_0x070e('0x34')]({'where':{'id':_0x27a01e['params']['id']},'attributes':['id',_0x070e('0x35'),_0x070e('0x36')],'raw':!![]})[_0x070e('0x37')](function(_0x503f4d){if(_0x503f4d&&_0x503f4d[_0x070e('0x35')]){return _0x33e8c6['status'](_0x503f4d['disposition']===_0x070e('0x38')?0x195:0x193)[_0x070e('0x39')]({'message':_0x503f4d[_0x070e('0x36')]===_0x070e('0x38')?_0x070e('0x3a'):'Forbidden.'});}else{_0x28a1c3();}})[_0x070e('0x3b')](function(_0x219e48){_0x28a1c3(_0x219e48);});}});};exports[_0x070e('0x30')]=function isAuthenticated(_0x1d2a34){return compose()[_0x070e('0x31')](function(_0x28d7f2,_0x1a1892,_0x26373b){var _0x5e8326;if(_0x28d7f2[_0x070e('0x3c')][_0x070e('0x3d')]){if(_[_0x070e('0x3e')](_0x28d7f2['headers']['authorization'],_0x070e('0x3f'))){var _0x46065c=basicAuth(_0x28d7f2);db[_0x070e('0x40')]['find']({'where':{'name':_0x46065c[_0x070e('0xb')]}})[_0x070e('0x37')](function(_0x3a9425){if(!_0x3a9425||!_0x3a9425[_0x070e('0x41')](_0x46065c['pass'])){return _0x1a1892['status'](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x28d7f2[_0x070e('0x32')]={'id':_0x3a9425['id']};_0x26373b();})['catch'](function(_0x1dff97){_0x26373b(_0x1dff97);});}else if(_[_0x070e('0x3e')](_0x28d7f2['headers']['authorization'],_0x070e('0x42'))){validateJwt(_0x28d7f2,_0x1a1892,_0x26373b);}else{if(_0x1d2a34){_0x26373b();}else{return _0x1a1892[_0x070e('0x43')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x28d7f2[_0x070e('0x44')][_0x070e('0x45')]){try{var _0x444d02={'audience':hardwareConf[_0x070e('0x46')](),'issuer':hardwareConf[_0x070e('0x46')]()};verifyJwt(_0x28d7f2['query']['apikey'],_0x444d02)[_0x070e('0x37')](function(_0x3011c4){return db[_0x070e('0x40')][_0x070e('0x47')]({'where':{'id':_0x3011c4[_0x070e('0x48')]}})['then'](function(_0x22f3a9){_0x5e8326=_0x22f3a9;return db[_0x070e('0x49')]['findOne']({'where':{'id':0x1},'attributes':[_0x070e('0x4a'),_0x070e('0x4b')],'raw':!![]});})['then'](function(_0x4d4ee8){if(!_0x5e8326||!_['isEqual'](_0x5e8326[_0x070e('0x4c')],_0x3011c4[_0x070e('0x4d')])){return _0x1a1892[_0x070e('0x43')](0x191)[_0x070e('0x39')]({'message':_0x070e('0x4e')});}if(_0x5e8326['disabled']){return _0x1a1892[_0x070e('0x43')](0x191)[_0x070e('0x39')]({'message':_0x070e('0x4f')});}if(_0x5e8326['blocked']){if(_0x4d4ee8[_0x070e('0x4b')]>0x0){if(moment(_0x5e8326[_0x070e('0x50')])[_0x070e('0x51')](_0x4d4ee8['blockDuration'],_0x070e('0x52'))>moment()){return _0x1a1892[_0x070e('0x43')](0x191)['json']({'message':_0x070e('0x4f')});}}else{return _0x1a1892['status'](0x191)[_0x070e('0x39')]({'message':_0x070e('0x4f')});}}_0x28d7f2[_0x070e('0x32')]={'id':_0x5e8326['id']};_0x26373b();});})[_0x070e('0x3b')](function(){return _0x1a1892[_0x070e('0x43')](0x191)['json']({'message':_0x070e('0x4f')});});}catch(_0x5db2ce){_0x26373b(_0x5db2ce);}}else if(_0x1d2a34){_0x26373b();}else{return _0x1a1892['status'](0x193)[_0x070e('0x39')]({'message':_0x070e('0x53')});}})[_0x070e('0x31')](function(_0x4d52ff,_0x2ad56c,_0x1223be){if(_0x4d52ff[_0x070e('0x32')]){db[_0x070e('0x40')]['find']({'where':{'id':_0x4d52ff[_0x070e('0x32')]['id']},'attributes':userAttributes})['then'](function(_0x544b53){if(!_0x544b53){return _0x2ad56c['status'](0x194)[_0x070e('0x39')]({'message':_0x070e('0x54')});}_0x4d52ff[_0x070e('0x32')]=_0x544b53;_0x1223be();})[_0x070e('0x3b')](function(_0x34f23e){_0x1223be(_0x34f23e);});}else if(_0x1d2a34){_0x1223be();}else{return _0x2ad56c['status'](0x194)[_0x070e('0x39')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x070e('0x55')]=function canUpdate(){return compose()[_0x070e('0x31')](function(_0xff760c,_0x52fcea,_0x54285a){return licenseUtil[_0x070e('0x56')]()['then'](function(_0x35349f){if(_0x35349f[_0x070e('0x57')]){_0x54285a();}else{return _0x52fcea[_0x070e('0x43')](0x193)['json']({'message':_0x070e('0x58')});}})[_0x070e('0x3b')](function(_0x48d836){_0x54285a(_0x48d836);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x070e('0x31')](function(_0x945901,_0x2d43ce,_0x1fc7c4){return licenseUtil[_0x070e('0x56')]()['then'](function(_0x20b80e){if(_0x20b80e[_0x070e('0x59')]){_0x1fc7c4();}else{return _0x2d43ce[_0x070e('0x43')](0x193)[_0x070e('0x39')]({'message':_0x070e('0x58')});}})[_0x070e('0x3b')](function(_0x1f54d5){_0x1fc7c4(_0x1f54d5);});});};exports[_0x070e('0x5a')]=function(_0xd67987,_0x66a3f3,_0x210c4d){_0xd67987[_0x070e('0x5a')]=!![];return _0x210c4d();};exports[_0x070e('0x5b')]=function signToken(_0x216d27){return signJwt(_0x216d27);};exports[_0x070e('0x5c')]=function(_0x5e051a,_0x171621){if(!_0x5e051a[_0x070e('0x32')]){return _0x171621[_0x070e('0x43')](0x194)[_0x070e('0x39')]({'message':_0x070e('0x5d')});}var _0x3bd738={'payload':{'id':_0x5e051a[_0x070e('0x32')]['id'],'role':_0x5e051a[_0x070e('0x32')][_0x070e('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3bd738)['then'](function(_0x251696){_0x171621['cookie'](_0x070e('0x5e'),_0x251696);_0x171621[_0x070e('0x5f')]('/dashboards/general');})[_0x070e('0x3b')](function(_0x130a50){return _0x171621[_0x070e('0x43')](0x1f4)[_0x070e('0x60')](_0x130a50);});};exports[_0x070e('0x61')]=function(_0x1e8a4f){if(_[_0x070e('0x62')](_0x1e8a4f['apiKeyNonce'])||_[_0x070e('0x62')](_0x1e8a4f['apiKeyIat'])){return null;}else{return createJwt(_0x1e8a4f);}};exports['generateApiKey']=function(_0x3a06c6){_0x3a06c6[_0x070e('0x4c')]=generateNonce();_0x3a06c6[_0x070e('0x63')]=generateIssuedAt();return createJwt(_0x3a06c6);};exports[_0x070e('0x64')]=function(_0x202015,_0x7948ed){var _0x440fa1=_0x202015[_0x070e('0x44')]['apikey'];if(_0x440fa1){var _0x477e69={'nonce':_0x7948ed['apiKeyNonce'],'iat':_0x7948ed['apiKeyIat'],'audience':hardwareConf[_0x070e('0x46')](),'issuer':hardwareConf[_0x070e('0x46')]()};return verifyJwt(_0x440fa1,_0x477e69)['then'](function(){return generateApiKey(_0x7948ed);});}else{throw{'message':_0x070e('0x65')};}};exports[_0x070e('0x66')]=function(_0x210f4a){var _0x2f8104=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2f8104[_0x070e('0x67')](_0x210f4a))throw new db[(_0x070e('0x68'))][(_0x070e('0x69'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x5943e3,_0x3087e5,_0x1948a5){var _0x29f497=encryptor[_0x070e('0x6a')](_0x3087e5)['split'](',');for(var _0x25f34c=0x0;_0x25f34c<_0x1948a5;_0x25f34c++){if(!_0x29f497[_0x25f34c])break;if(_0x5943e3['toLowerCase']()===_0x29f497[_0x25f34c][_0x070e('0x6b')]()){var _0x1cbb7e=util[_0x070e('0x6c')](_0x070e('0x6d'),_0x1948a5);if(_0x1948a5===0x1){_0x1cbb7e=_0x070e('0x6e');}throw new db[(_0x070e('0x68'))]['ValidationError'](_0x1cbb7e);}}return;};exports[_0x070e('0x6f')]=function(_0x18e8d0,_0x8aaf00){var _0x533431=_0x8aaf00?encryptor[_0x070e('0x6a')](_0x8aaf00)[_0x070e('0x70')](','):[];if(_0x533431['length']===0x5){_0x533431[_0x070e('0x71')](-0x1,0x1);}_0x533431['unshift'](_0x18e8d0);return encryptor[_0x070e('0x72')](_0x533431['join'](','));};function signJwt(_0x4cb86f){var _0x4b354d=BPromise[_0x070e('0x73')](jwt[_0x070e('0x74')],{'context':jwt});var _0x1100d8=_0x4cb86f[_0x070e('0x75')]||config[_0x070e('0x76')][_0x070e('0x77')];return new BPromise(function(_0x498bc6,_0x841c89){_0x4b354d(_0x4cb86f['payload'],_0x1100d8,_0x4cb86f[_0x070e('0x78')])['then'](function(_0x2e10f7){_0x498bc6(_0x2e10f7);})[_0x070e('0x3b')](function(_0x5b0b46){_0x841c89(_0x5b0b46);});});}function verifyJwt(_0x1bcdc3,_0x50399e,_0x1a9e25){var _0x139630=BPromise[_0x070e('0x73')](jwt[_0x070e('0x79')],{'context':jwt});var _0x764b06=_0x1a9e25||config[_0x070e('0x76')][_0x070e('0x77')];return new BPromise(function(_0x148f1d,_0x3ef9cc){_0x139630(_0x1bcdc3,_0x764b06,_0x50399e)[_0x070e('0x37')](function(_0x40c560){_0x148f1d(_0x40c560);})[_0x070e('0x3b')](function(_0x455bf2){_0x3ef9cc(_0x455bf2);});});}function generateNonce(){return crypto[_0x070e('0x7a')](0x10)['toString'](_0x070e('0x7b'));}function generateIssuedAt(){return Math[_0x070e('0x7c')](Date[_0x070e('0x7d')]()/0x3e8)[_0x070e('0x7e')]();}function createJwt(_0x5712d1){var _0x2ccd8d={'payload':{'iat':_0x5712d1[_0x070e('0x63')],'nonce':_0x5712d1[_0x070e('0x4c')]},'options':{'algorithm':_0x070e('0x7f'),'subject':_0x5712d1['id'][_0x070e('0x7e')](),'issuer':hardwareConf[_0x070e('0x46')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x2ccd8d)[_0x070e('0x37')](function(_0x7d154){return{'iat':_0x5712d1[_0x070e('0x63')],'nonce':_0x5712d1[_0x070e('0x4c')],'token':_0x7d154};});}
\ No newline at end of file
index 1444463..5cf49dd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x00bb=['encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','indexOf','hasOwnProperty','encryptFile','createWriteStream','data','update','binary','write','end','unlink','decryptFile','final','close','encryptString','secret','createCipher','base64','createDecipher','utf8','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','session','aes-256-ctr','aes192'];(function(_0x560b54,_0x2ce3f1){var _0x4653de=function(_0x2d4d70){while(--_0x2d4d70){_0x560b54['push'](_0x560b54['shift']());}};_0x4653de(++_0x2ce3f1);}(_0x00bb,0xff));var _0xb00b=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x00bb[_0x6c993a];return _0x27f547;};'use strict';var crypto=require(_0xb00b('0x0'));var fs=require('fs');var BPromise=require(_0xb00b('0x1'));var _=require(_0xb00b('0x2'));var config=require(_0xb00b('0x3'));var logger=require(_0xb00b('0x4'))(_0xb00b('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xb00b('0x6')],'algorithm':_0xb00b('0x7')};const fileOptions={'algorithm':_0xb00b('0x8')};if(config[_0xb00b('0x9')]&&config[_0xb00b('0x9')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xb00b('0x9')][_0xb00b('0xa')]);if(isSupported){fileOptions['algorithm']=config[_0xb00b('0x9')][_0xb00b('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xb00b('0xb')](config[_0xb00b('0x9')][_0xb00b('0xa')],_0xb00b('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x21dd34){return AES_SUPPORTED_RX['test'](_0x21dd34);}function getSupportedCiphers(){return crypto[_0xb00b('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x31de96){return getSupportedCiphers()[_0xb00b('0xe')](_0x31de96)>-0x1;}function combineOptions(_0xb99bc0){var _0x3c96f0={};for(var _0x3afd66 in fileOptions){if(fileOptions[_0xb00b('0xf')](_0x3afd66)){_0x3c96f0[_0x3afd66]=fileOptions[_0x3afd66];}}if(_0xb99bc0){for(var _0xfa0be in _0xb99bc0){if(_0xb99bc0['hasOwnProperty'](_0xfa0be)){_0x3c96f0[_0xfa0be]=_0xb99bc0[_0xfa0be];}}}return _0x3c96f0;}exports[_0xb00b('0x10')]=function(_0x2f7fbd,_0x118d08,_0x5d3506,_0x9f143){return new BPromise(function(_0x2cd154,_0x523630){_0x9f143=combineOptions(_0x9f143);var _0x4a9250=new Buffer(_0x5d3506);var _0x52b422=fs['createReadStream'](_0x2f7fbd);var _0x4383ae=fs[_0xb00b('0x11')](_0x118d08);var _0x49fb06=crypto['createCipher'](_0x9f143[_0xb00b('0xa')],_0x4a9250);_0x52b422['on'](_0xb00b('0x12'),function(_0x1bfd27){var _0x422074=new Buffer(_0x49fb06[_0xb00b('0x13')](_0x1bfd27),_0xb00b('0x14'));_0x4383ae['write'](_0x422074);});_0x52b422['on']('end',function(){try{var _0x33337b=new Buffer(_0x49fb06['final']('binary'),'binary');_0x4383ae[_0xb00b('0x15')](_0x33337b);_0x4383ae[_0xb00b('0x16')]();_0x4383ae['on']('close',function(){return _0x2cd154(_0x118d08);});}catch(_0x579b8c){fs[_0xb00b('0x17')](_0x118d08);return _0x523630(_0x579b8c);}});});};exports[_0xb00b('0x18')]=function(_0x17e9db,_0x40c065,_0x32ad18,_0x29a058){return new BPromise(function(_0xb664b3,_0x395c98){_0x29a058=combineOptions(_0x29a058);var _0x5beb3b=new Buffer(_0x32ad18);var _0x4bde77=fs['createReadStream'](_0x17e9db);var _0x58089d=fs[_0xb00b('0x11')](_0x40c065);var _0x3ea44e=crypto['createDecipher'](_0x29a058[_0xb00b('0xa')],_0x5beb3b);_0x4bde77['on'](_0xb00b('0x12'),function(_0x8cfa21){var _0x215b1c=new Buffer(_0x3ea44e[_0xb00b('0x13')](_0x8cfa21),_0xb00b('0x14'));_0x58089d[_0xb00b('0x15')](_0x215b1c);});_0x4bde77['on'](_0xb00b('0x16'),function(){try{var _0x3c1923=new Buffer(_0x3ea44e[_0xb00b('0x19')](_0xb00b('0x14')),_0xb00b('0x14'));_0x58089d[_0xb00b('0x15')](_0x3c1923);_0x58089d[_0xb00b('0x16')]();_0x58089d['on'](_0xb00b('0x1a'),function(){return _0xb664b3(_0x40c065);});}catch(_0x3e4067){fs['unlink'](_0x40c065);return _0x395c98(_0x3e4067);}});});};exports[_0xb00b('0x1b')]=function(_0x1edb64,_0x2109fe,_0x1cf7e5){var _0xfd6c65=_0x1cf7e5||stringOptions[_0xb00b('0xa')];var _0xab68ac=_0x2109fe||stringOptions[_0xb00b('0x1c')];var _0xad8032=crypto[_0xb00b('0x1d')](_0xfd6c65,_0xab68ac);var _0x34d1ed=_0xad8032[_0xb00b('0x13')](_0x1edb64,'utf8',_0xb00b('0x1e'));_0x34d1ed+=_0xad8032[_0xb00b('0x19')](_0xb00b('0x1e'));return _0x34d1ed;};exports['decryptString']=function(_0x3a83f6,_0x38dbcc,_0x2a314e){var _0x4248dd=_0x2a314e||stringOptions[_0xb00b('0xa')];var _0x2523b8=_0x38dbcc||stringOptions[_0xb00b('0x1c')];var _0x32e56a=crypto[_0xb00b('0x1f')](_0x4248dd,_0x2523b8);var _0x4c71d5=_0x32e56a[_0xb00b('0x13')](_0x3a83f6,'base64',_0xb00b('0x20'));_0x4c71d5+=_0x32e56a['final']('utf8');return _0x4c71d5;};
\ No newline at end of file
+var _0x24e0=['hasOwnProperty','createReadStream','createWriteStream','data','update','write','end','final','binary','close','unlink','decryptFile','createDecipher','encryptString','secret','utf8','base64','crypto','bluebird','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','test','getCiphers','filter'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x24e0,0x109));var _0x024e=function(_0x51e403,_0x4c179f){_0x51e403=_0x51e403-0x0;var _0x3eca2c=_0x24e0[_0x51e403];return _0x3eca2c;};'use strict';var crypto=require(_0x024e('0x0'));var fs=require('fs');var BPromise=require(_0x024e('0x1'));var _=require('lodash');var config=require(_0x024e('0x2'));var logger=require(_0x024e('0x3'))(_0x024e('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x024e('0x5')]['session'],'algorithm':_0x024e('0x6')};const fileOptions={'algorithm':_0x024e('0x7')};if(config[_0x024e('0x8')]&&config['encrypt'][_0x024e('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x024e('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x024e('0x8')][_0x024e('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x024e('0xa')](',\x20');logger['error'](config[_0x024e('0x8')][_0x024e('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x3affdc){return AES_SUPPORTED_RX[_0x024e('0xb')](_0x3affdc);}function getSupportedCiphers(){return crypto[_0x024e('0xc')]()[_0x024e('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x55b2ed){return getSupportedCiphers()['indexOf'](_0x55b2ed)>-0x1;}function combineOptions(_0x2212bb){var _0x44335d={};for(var _0x39bd23 in fileOptions){if(fileOptions[_0x024e('0xe')](_0x39bd23)){_0x44335d[_0x39bd23]=fileOptions[_0x39bd23];}}if(_0x2212bb){for(var _0x79dc44 in _0x2212bb){if(_0x2212bb[_0x024e('0xe')](_0x79dc44)){_0x44335d[_0x79dc44]=_0x2212bb[_0x79dc44];}}}return _0x44335d;}exports['encryptFile']=function(_0x4fe1e0,_0x3f286b,_0x1c8e9b,_0x56367b){return new BPromise(function(_0x188eaa,_0x1b9c1c){_0x56367b=combineOptions(_0x56367b);var _0x40fb0e=new Buffer(_0x1c8e9b);var _0xcbf23f=fs[_0x024e('0xf')](_0x4fe1e0);var _0x393dde=fs[_0x024e('0x10')](_0x3f286b);var _0x476aae=crypto['createCipher'](_0x56367b['algorithm'],_0x40fb0e);_0xcbf23f['on'](_0x024e('0x11'),function(_0x58478c){var _0xe25af6=new Buffer(_0x476aae[_0x024e('0x12')](_0x58478c),'binary');_0x393dde[_0x024e('0x13')](_0xe25af6);});_0xcbf23f['on'](_0x024e('0x14'),function(){try{var _0x31174a=new Buffer(_0x476aae[_0x024e('0x15')](_0x024e('0x16')),_0x024e('0x16'));_0x393dde[_0x024e('0x13')](_0x31174a);_0x393dde[_0x024e('0x14')]();_0x393dde['on'](_0x024e('0x17'),function(){return _0x188eaa(_0x3f286b);});}catch(_0x4330a4){fs[_0x024e('0x18')](_0x3f286b);return _0x1b9c1c(_0x4330a4);}});});};exports[_0x024e('0x19')]=function(_0x44ee6c,_0x506f28,_0x1bc503,_0x17b59){return new BPromise(function(_0x2d882d,_0x5e1f41){_0x17b59=combineOptions(_0x17b59);var _0x261da9=new Buffer(_0x1bc503);var _0x5d65ef=fs['createReadStream'](_0x44ee6c);var _0x36b1d4=fs[_0x024e('0x10')](_0x506f28);var _0x4287bb=crypto[_0x024e('0x1a')](_0x17b59['algorithm'],_0x261da9);_0x5d65ef['on'](_0x024e('0x11'),function(_0x302f04){var _0x1f374c=new Buffer(_0x4287bb['update'](_0x302f04),_0x024e('0x16'));_0x36b1d4[_0x024e('0x13')](_0x1f374c);});_0x5d65ef['on'](_0x024e('0x14'),function(){try{var _0x3c555c=new Buffer(_0x4287bb[_0x024e('0x15')](_0x024e('0x16')),_0x024e('0x16'));_0x36b1d4['write'](_0x3c555c);_0x36b1d4['end']();_0x36b1d4['on']('close',function(){return _0x2d882d(_0x506f28);});}catch(_0x3a83d3){fs[_0x024e('0x18')](_0x506f28);return _0x5e1f41(_0x3a83d3);}});});};exports[_0x024e('0x1b')]=function(_0x3bcefb,_0x3e7313,_0x56271f){var _0x5a0dd0=_0x56271f||stringOptions['algorithm'];var _0x1017a8=_0x3e7313||stringOptions[_0x024e('0x1c')];var _0x150245=crypto['createCipher'](_0x5a0dd0,_0x1017a8);var _0x587cfe=_0x150245['update'](_0x3bcefb,_0x024e('0x1d'),_0x024e('0x1e'));_0x587cfe+=_0x150245[_0x024e('0x15')](_0x024e('0x1e'));return _0x587cfe;};exports['decryptString']=function(_0x8a5c14,_0x1abae3,_0x491348){var _0x44f242=_0x491348||stringOptions[_0x024e('0x9')];var _0x298756=_0x1abae3||stringOptions['secret'];var _0x5eea59=crypto[_0x024e('0x1a')](_0x44f242,_0x298756);var _0x3034cb=_0x5eea59['update'](_0x8a5c14,_0x024e('0x1e'),_0x024e('0x1d'));_0x3034cb+=_0x5eea59[_0x024e('0x15')]('utf8');return _0x3034cb;};
\ No newline at end of file
index 892d887..bb3fb4f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0fa0=['then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','query','dirname','existsSync','join','mkdirSync','length','%s%d.%s','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','inspect','util','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','CSV','Setting','split','splitSizeCsv'];(function(_0x51a54d,_0x91ebba){var _0x2dcf18=function(_0x14c3bd){while(--_0x14c3bd){_0x51a54d['push'](_0x51a54d['shift']());}};_0x2dcf18(++_0x91ebba);}(_0x0fa0,0x1a5));var _0x00fa=function(_0x31acce,_0x3e59bf){_0x31acce=_0x31acce-0x0;var _0xaa9ec4=_0x0fa0[_0x31acce];return _0xaa9ec4;};'use strict';var util=require(_0x00fa('0x0'));var path=require(_0x00fa('0x1'));var _=require(_0x00fa('0x2'));var csv=require(_0x00fa('0x3'));var fs=require('fs');var BPromise=require(_0x00fa('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x00fa('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x00fa('0x6'))[_0x00fa('0x7')];var logger=require(_0x00fa('0x8'))(_0x00fa('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x00fa('0xa')][0x2]);var QUERY=process[_0x00fa('0xa')][0x3];var PATH=process[_0x00fa('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x38ebaf,_0x1f464d){var _0x364a11={'status':_0x38ebaf};var _0x19f589={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1f464d){_0x364a11['savename']=_0x1f464d;}return db[_0x00fa('0xb')][_0x00fa('0xc')](_0x364a11,_0x19f589);}function main(){var _0x843512=0x1388;var _0x5c121a;logger[_0x00fa('0xd')](util[_0x00fa('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x00fa('0xf')));return db[_0x00fa('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x00fa('0x11'),_0x00fa('0x12')]})[_0x00fa('0x13')](function(_0x54fd43){if(_0x54fd43){_0x5c121a=_0x54fd43;_0x843512=_0x5c121a[_0x00fa('0x12')]||0x1388;}})['then'](function(){return dbH[_0x00fa('0x14')]['query'](util[_0x00fa('0xe')](_0x00fa('0x15'),QUERY),{'type':dbH['sequelize'][_0x00fa('0x16')][_0x00fa('0x17')]});})[_0x00fa('0x13')](function(_0x5c38d4){if(!_0x5c38d4[0x0][_0x00fa('0x18')]){return analyticExtractedReport(_0x00fa('0x19'));}var _0x21ba7d=[];var _0x187a50=0x0;if(_0x5c121a['split']){if(_0x5c38d4&&_0x5c38d4['length']){var _0xcc9eed=_[_0x00fa('0x1a')](_0x5c38d4[0x0][_0x00fa('0x18')]/_0x843512);var _0x34fb85=Number['isInteger'](_0x5c38d4[0x0][_0x00fa('0x18')]/_0x843512)?_0x5c38d4[0x0][_0x00fa('0x18')]%_0x843512:0x0;_0xcc9eed[_0x00fa('0x1b')](function(_0x2f48a0){if(_0x2f48a0>0x0){_0x187a50+=_0x843512;}_0x21ba7d['push'](dbH[_0x00fa('0x14')]['query'](util[_0x00fa('0xe')](_0x00fa('0x1c'),QUERY,_0x843512,_0x187a50),{'type':dbH['sequelize'][_0x00fa('0x16')]['SELECT']}));});if(_0x34fb85>0x0){_0x187a50+=_0x843512;_0x21ba7d[_0x00fa('0x1d')](dbH[_0x00fa('0x14')]['query'](util[_0x00fa('0xe')](_0x00fa('0x1c'),QUERY,_0x34fb85,_0x187a50),{'type':dbH['sequelize'][_0x00fa('0x16')][_0x00fa('0x17')]}));}}}else{_0x21ba7d[_0x00fa('0x1d')](dbH[_0x00fa('0x14')][_0x00fa('0x1e')](QUERY,{'type':dbH[_0x00fa('0x14')][_0x00fa('0x16')][_0x00fa('0x17')]}));}var _0x57db78=path[_0x00fa('0x1f')](PATH);var _0x2f73c7=path['basename'](PATH,'.csv');var _0x132b6b=_0x5c121a[_0x00fa('0x11')]&&_0x21ba7d['length']>0x1;var _0x4ba540=[];if(!fs[_0x00fa('0x20')](path[_0x00fa('0x21')](_0x57db78,_0x2f73c7))&&_0x132b6b){fs[_0x00fa('0x22')](path['join'](_0x57db78,_0x2f73c7));}return BPromise['each'](_0x21ba7d,function(_0x30d57f){_0x4ba540[_0x00fa('0x1d')](_0x30d57f);})['then'](function(){for(var _0x503a2c=0x0;_0x503a2c<_0x4ba540[_0x00fa('0x23')];_0x503a2c+=0x1){var _0x15d40c;var _0x305de5=_0x4ba540[_0x503a2c];if(_0x132b6b){_0x15d40c=path[_0x00fa('0x21')](_0x57db78,_0x2f73c7,util[_0x00fa('0xe')](_0x00fa('0x24'),_0x2f73c7,_0x503a2c,_0x00fa('0x25')));}else{_0x15d40c=path[_0x00fa('0x21')](_0x57db78,util[_0x00fa('0xe')](_0x00fa('0x26'),_0x2f73c7,'csv'));}fs[_0x00fa('0x27')](_0x15d40c,csv(_0x305de5));}})[_0x00fa('0x13')](function(){if(_0x132b6b){return new Promise(function(_0x242231){zipdir(path[_0x00fa('0x21')](_0x57db78,_0x2f73c7),{'saveTo':path[_0x00fa('0x21')](_0x57db78,util[_0x00fa('0xe')]('%s.%s',_0x2f73c7,'zip'))},function(_0x595df2,_0x40c19c){rimraf(path['join'](_0x57db78,_0x2f73c7),function(){});_0x242231('zip\x20finished');});});}})[_0x00fa('0x13')](function(){logger[_0x00fa('0xd')](util['format'](_0x00fa('0x28'),EXTRACTED_REPORT_ID,_0x00fa('0xf')));return analyticExtractedReport(_0x00fa('0x29'),_0x132b6b?util[_0x00fa('0xe')](_0x00fa('0x26'),_0x2f73c7,_0x132b6b?_0x00fa('0x2a'):_0x00fa('0x25')):null);});})['catch'](function(_0x22ea0e){logger[_0x00fa('0xd')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x00fa('0xf')),util[_0x00fa('0x2b')](_0x22ea0e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process['exit'](EXIT_CODE);});}main();
\ No newline at end of file
+var _0x7005=['path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Setting','find','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','util'];(function(_0x4539ca,_0x3a07cd){var _0x552d4a=function(_0x5413d1){while(--_0x5413d1){_0x4539ca['push'](_0x4539ca['shift']());}};_0x552d4a(++_0x3a07cd);}(_0x7005,0xfe));var _0x5700=function(_0x1286cd,_0x3a0d87){_0x1286cd=_0x1286cd-0x0;var _0x321aa0=_0x7005[_0x1286cd];return _0x321aa0;};'use strict';var util=require(_0x5700('0x0'));var path=require(_0x5700('0x1'));var _=require(_0x5700('0x2'));var csv=require(_0x5700('0x3'));var fs=require('fs');var BPromise=require(_0x5700('0x4'));var zipdir=require(_0x5700('0x5'));var rimraf=require('rimraf');var db=require(_0x5700('0x6'))['db'];var dbH=require(_0x5700('0x6'))[_0x5700('0x7')];var logger=require(_0x5700('0x8'))(_0x5700('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x5700('0xa')][0x2]);var QUERY=process[_0x5700('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x10cd29,_0x270353){var _0x1b7f44={'status':_0x10cd29};var _0x11e860={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x270353){_0x1b7f44[_0x5700('0xb')]=_0x270353;}return db[_0x5700('0xc')][_0x5700('0xd')](_0x1b7f44,_0x11e860);}function main(){var _0x412c30=0x1388;var _0x20165a;logger[_0x5700('0xe')](util[_0x5700('0xf')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0x5700('0x10')][_0x5700('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x5700('0x12')]})[_0x5700('0x13')](function(_0x1165ac){if(_0x1165ac){_0x20165a=_0x1165ac;_0x412c30=_0x20165a[_0x5700('0x12')]||0x1388;}})['then'](function(){return dbH[_0x5700('0x14')][_0x5700('0x15')](util[_0x5700('0xf')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x5700('0x14')][_0x5700('0x16')][_0x5700('0x17')]});})[_0x5700('0x13')](function(_0x44c2ec){if(!_0x44c2ec[0x0][_0x5700('0x18')]){return analyticExtractedReport(_0x5700('0x19'));}var _0x480bfd=[];var _0x2d3904=0x0;if(_0x20165a[_0x5700('0x1a')]){if(_0x44c2ec&&_0x44c2ec[_0x5700('0x1b')]){var _0x1ff561=_[_0x5700('0x1c')](_0x44c2ec[0x0]['num']/_0x412c30);var _0x22904f=Number[_0x5700('0x1d')](_0x44c2ec[0x0][_0x5700('0x18')]/_0x412c30)?_0x44c2ec[0x0]['num']%_0x412c30:0x0;_0x1ff561[_0x5700('0x1e')](function(_0x40d1d9){if(_0x40d1d9>0x0){_0x2d3904+=_0x412c30;}_0x480bfd[_0x5700('0x1f')](dbH['sequelize'][_0x5700('0x15')](util[_0x5700('0xf')](_0x5700('0x20'),QUERY,_0x412c30,_0x2d3904),{'type':dbH[_0x5700('0x14')][_0x5700('0x16')][_0x5700('0x17')]}));});if(_0x22904f>0x0){_0x2d3904+=_0x412c30;_0x480bfd[_0x5700('0x1f')](dbH[_0x5700('0x14')][_0x5700('0x15')](util[_0x5700('0xf')](_0x5700('0x20'),QUERY,_0x22904f,_0x2d3904),{'type':dbH[_0x5700('0x14')][_0x5700('0x16')][_0x5700('0x17')]}));}}}else{_0x480bfd['push'](dbH[_0x5700('0x14')][_0x5700('0x15')](QUERY,{'type':dbH['sequelize'][_0x5700('0x16')]['SELECT']}));}var _0x3e0b09=path[_0x5700('0x21')](PATH);var _0x1189a2=path[_0x5700('0x22')](PATH,'.csv');var _0xd31914=_0x20165a[_0x5700('0x1a')]&&_0x480bfd[_0x5700('0x1b')]>0x1;var _0x16f23a=[];if(!fs[_0x5700('0x23')](path['join'](_0x3e0b09,_0x1189a2))&&_0xd31914){fs['mkdirSync'](path[_0x5700('0x24')](_0x3e0b09,_0x1189a2));}return BPromise[_0x5700('0x25')](_0x480bfd,function(_0x3e1235){_0x16f23a[_0x5700('0x1f')](_0x3e1235);})[_0x5700('0x13')](function(){for(var _0x11df3c=0x0;_0x11df3c<_0x16f23a[_0x5700('0x1b')];_0x11df3c+=0x1){var _0x126d23;var _0x2d792c=_0x16f23a[_0x11df3c];if(_0xd31914){_0x126d23=path[_0x5700('0x24')](_0x3e0b09,_0x1189a2,util[_0x5700('0xf')](_0x5700('0x26'),_0x1189a2,_0x11df3c,_0x5700('0x27')));}else{_0x126d23=path[_0x5700('0x24')](_0x3e0b09,util[_0x5700('0xf')](_0x5700('0x28'),_0x1189a2,_0x5700('0x27')));}fs[_0x5700('0x29')](_0x126d23,csv(_0x2d792c));}})[_0x5700('0x13')](function(){if(_0xd31914){return new Promise(function(_0x2e58e1){zipdir(path['join'](_0x3e0b09,_0x1189a2),{'saveTo':path[_0x5700('0x24')](_0x3e0b09,util[_0x5700('0xf')](_0x5700('0x28'),_0x1189a2,_0x5700('0x2a')))},function(_0x5d8d01,_0x1c535d){rimraf(path[_0x5700('0x24')](_0x3e0b09,_0x1189a2),function(){});_0x2e58e1(_0x5700('0x2b'));});});}})['then'](function(){logger[_0x5700('0xe')](util[_0x5700('0xf')](_0x5700('0x2c'),EXTRACTED_REPORT_ID,_0x5700('0x2d')));return analyticExtractedReport(_0x5700('0x2e'),_0xd31914?util[_0x5700('0xf')](_0x5700('0x28'),_0x1189a2,_0xd31914?_0x5700('0x2a'):'csv'):null);});})[_0x5700('0x2f')](function(_0x7a888a){logger[_0x5700('0xe')](util[_0x5700('0xf')](_0x5700('0x30'),EXTRACTED_REPORT_ID,_0x5700('0x2d')),util['inspect'](_0x7a888a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5700('0x31'));})[_0x5700('0x32')](function(){process['exit'](EXIT_CODE);});}main();
\ No newline at end of file
index d68e0d3..6eaa0d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x90bb=['JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','tableHeader','map','pick','toString','value','fill','length','auto','body','push','concat','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','basename','existsSync','join','mkdirSync','each','flatten','%s%d.%s','pdf','all','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','zip-dir','rimraf','jsdom'];(function(_0x3d5393,_0x48b037){var _0x14bbfe=function(_0x5b4e51){while(--_0x5b4e51){_0x3d5393['push'](_0x3d5393['shift']());}};_0x14bbfe(++_0x48b037);}(_0x90bb,0x178));var _0xb90b=function(_0x3cdab5,_0x352bd6){_0x3cdab5=_0x3cdab5-0x0;var _0x23840b=_0x90bb[_0x3cdab5];return _0x23840b;};'use strict';var _=require(_0xb90b('0x0'));var fs=require('fs');var util=require(_0xb90b('0x1'));var path=require(_0xb90b('0x2'));var moment=require(_0xb90b('0x3'));var htmlToPdfmake=require(_0xb90b('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xb90b('0x5'));var rimraf=require(_0xb90b('0x6'));var JSDOM=require(_0xb90b('0x7'))[_0xb90b('0x8')];var window=new JSDOM('')[_0xb90b('0x9')];var BPromise=require(_0xb90b('0xa'));var db=require(_0xb90b('0xb'))['db'];var dbH=require(_0xb90b('0xb'))[_0xb90b('0xc')];var logger=require(_0xb90b('0xd'))(_0xb90b('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0xb90b('0xf')][0x2]);var QUERY=process[_0xb90b('0xf')][0x3];var PATH=process[_0xb90b('0xf')][0x4];var NAME=process[_0xb90b('0xf')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x375f85,_0x35489e){var _0xd29bef={'status':_0x375f85};var _0x2eb8b8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x35489e){_0xd29bef[_0xb90b('0x10')]=_0x35489e;}return db[_0xb90b('0x11')][_0xb90b('0x12')](_0xd29bef,_0x2eb8b8);}function getHeaders(_0x4aae12){return _['map'](_0x4aae12,function(_0x243c8a){return{'text':_0x243c8a,'style':_0xb90b('0x13')};});}function getRows(_0x2b7c65,_0x476745){return _[_0xb90b('0x14')](_0x476745,function(_0x54cfd1){return _(_0x54cfd1)[_0xb90b('0x15')](_0x2b7c65)['map'](function(_0xf5bf54){return _0xf5bf54?_[_0xb90b('0x16')](_0xf5bf54):'';})[_0xb90b('0x17')]();});}function createTable(_0x13c31a,_0xc3b607){var _0x483325={'widths':_[_0xb90b('0x18')](Array(_0x13c31a[_0xb90b('0x19')]),0x91),'heights':function(_0x5535ec){return _0x5535ec===0x0?_0xb90b('0x1a'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x54ab6f=getHeaders(_0x13c31a);_0x483325[_0xb90b('0x1b')][_0xb90b('0x1c')](_0x54ab6f);var _0xd7daf2=getRows(_0x13c31a,_0xc3b607);_0x483325[_0xb90b('0x1b')]=_0x483325['body'][_0xb90b('0x1d')](_0xd7daf2);return _0x483325;}function createTables(_0x20291b){var _0x48f7e8=[];var _0x36e10b=_['chunk'](Object['keys'](_0x20291b[0x0]),0x5);_0x36e10b[_0xb90b('0x1e')](function(_0x477279){_0x48f7e8[_0xb90b('0x1c')](createTable(_0x477279,_0x20291b));});return _0x48f7e8;}function getPDFDocDefinition(_0x3fec92){var _0x373a45=util[_0xb90b('0x1f')](_0xb90b('0x20'),NAME,EXTRACTED_REPORT[_0xb90b('0x21')],moment(EXTRACTED_REPORT[_0xb90b('0x22')])[_0xb90b('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0xb90b('0x23')])[_0xb90b('0x1f')](FORMAT));var _0x1b9976=[];for(var _0x6da06b=0x0;_0x6da06b<_0x3fec92[_0xb90b('0x19')];_0x6da06b++){var _0x15549e=[];if(_0x6da06b===0x0){_0x15549e[_0xb90b('0x1c')]({'text':_0x373a45,'style':_0xb90b('0x24')});}var _0x1b3549={'table':_0x3fec92[_0x6da06b]};if(_0x6da06b>0x0){_0x1b3549[_0xb90b('0x25')]=_0xb90b('0x26');_0x1b3549[_0xb90b('0x27')]=[0x0,0x46,0x0,0x0];}_0x15549e[_0xb90b('0x1c')](_0x1b3549);_0x1b9976[_0xb90b('0x1c')](_0x15549e);}return{'pageSize':'A4','pageOrientation':_0xb90b('0x28'),'content':_0x1b9976,'footer':function(_0x2ad517,_0x2f8e8d){return{'text':_0x2ad517[_0xb90b('0x16')]()+_0xb90b('0x29')+_0x2f8e8d,'style':_0xb90b('0x2a')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xb90b('0x2b')},'footer':{'alignment':_0xb90b('0x2c'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5f1a6f){var _0x55f095=0x1388;var _0xe73c92;if(!_0x5f1a6f[0x0][_0xb90b('0x2d')]){return analyticExtractedReport(_0xb90b('0x2e'));}return db[_0xb90b('0x2f')][_0xb90b('0x30')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb90b('0x31'),_0xb90b('0x32')]})['then'](function(_0x33a168){if(_0x33a168){_0xe73c92=_0x33a168;_0x55f095=_0xe73c92['splitSizePdf']||0x3e8;}})[_0xb90b('0x33')](function(){var _0x40f03b=[];var _0x523442=0x0;if(_0xe73c92[_0xb90b('0x31')]){if(_0x5f1a6f&&_0x5f1a6f[_0xb90b('0x19')]){var _0x2ae342=_[_0xb90b('0x34')](_0x5f1a6f[0x0][_0xb90b('0x2d')]/_0x55f095);var _0x3e8165=Number[_0xb90b('0x35')](_0x5f1a6f[0x0][_0xb90b('0x2d')]/_0x55f095)?_0x5f1a6f[0x0][_0xb90b('0x2d')]%_0x55f095:0x0;_0x2ae342[_0xb90b('0x1e')](function(_0x505b1a){if(_0x505b1a>0x0){_0x523442+=_0x55f095;}_0x40f03b[_0xb90b('0x1c')](dbH[_0xb90b('0x36')]['query'](util['format'](_0xb90b('0x37'),QUERY,_0x55f095,_0x523442),{'type':dbH['sequelize'][_0xb90b('0x38')][_0xb90b('0x39')]}));});if(_0x3e8165>0x0){_0x523442+=_0x55f095;_0x40f03b[_0xb90b('0x1c')](dbH[_0xb90b('0x36')]['query'](util[_0xb90b('0x1f')](_0xb90b('0x37'),QUERY,_0x3e8165,_0x523442),{'type':dbH[_0xb90b('0x36')]['QueryTypes'][_0xb90b('0x39')]}));}}}else{_0x40f03b[_0xb90b('0x1c')](dbH[_0xb90b('0x36')][_0xb90b('0x3a')](QUERY,{'type':dbH[_0xb90b('0x36')]['QueryTypes']['SELECT']}));}var _0x436976=path[_0xb90b('0x3b')](PATH);var _0x4e0ab8=path[_0xb90b('0x3c')](PATH,'.pdf');var _0x432a3e=_0xe73c92[_0xb90b('0x31')]&&_0x40f03b[_0xb90b('0x19')]>0x1;var _0x19d492=[];if(!fs[_0xb90b('0x3d')](path[_0xb90b('0x3e')](_0x436976,_0x4e0ab8))&&_0x432a3e){fs[_0xb90b('0x3f')](path[_0xb90b('0x3e')](_0x436976,_0x4e0ab8));}return BPromise[_0xb90b('0x40')](_0x40f03b,function(_0x2f0c41){_0x19d492[_0xb90b('0x1c')](_0x2f0c41);})[_0xb90b('0x33')](function(){var _0x5a78ea=[];for(var _0x157faa=0x0;_0x157faa<_0x19d492['length'];_0x157faa+=0x1){var _0x2fd13f=_0x19d492[_0x157faa];var _0x25cf3e=createTables(_[_0xb90b('0x41')](_0x2fd13f));var _0x34e4db;var _0x422fa3=getPDFDocDefinition(_0x25cf3e);var _0x517e44=getPDFPrinter();var _0x493e6b=_0x517e44['createPdfKitDocument'](_0x422fa3);if(_0x432a3e){_0x34e4db=path[_0xb90b('0x3e')](_0x436976,_0x4e0ab8,util[_0xb90b('0x1f')](_0xb90b('0x42'),_0x4e0ab8,_0x157faa,'pdf'));}else{_0x34e4db=path[_0xb90b('0x3e')](_0x436976,util[_0xb90b('0x1f')]('%s.%s',_0x4e0ab8,_0xb90b('0x43')));}_0x5a78ea[_0xb90b('0x1c')](writePDFDocument(_0x493e6b,_0x34e4db));}return Promise[_0xb90b('0x44')](_0x5a78ea);})[_0xb90b('0x33')](function(){if(_0x432a3e){return new Promise(function(_0x34a367){zipdir(path[_0xb90b('0x3e')](_0x436976,_0x4e0ab8),{'saveTo':path[_0xb90b('0x3e')](_0x436976,util[_0xb90b('0x1f')](_0xb90b('0x45'),_0x4e0ab8,_0xb90b('0x46')))},function(){rimraf(path[_0xb90b('0x3e')](_0x436976,_0x4e0ab8),function(){});_0x34a367('zip\x20finished');});});}})[_0xb90b('0x33')](function(){if(!_0x432a3e)return;rimraf(path[_0xb90b('0x3e')](_0x436976,_0x4e0ab8),function(){});})['then'](function(){logger[_0xb90b('0x47')](util[_0xb90b('0x1f')](_0xb90b('0x48'),EXTRACTED_REPORT_ID,_0xb90b('0x49')));return analyticExtractedReport(_0xb90b('0x4a'),_0x432a3e?util[_0xb90b('0x1f')](_0xb90b('0x45'),_0x4e0ab8,_0x432a3e?_0xb90b('0x46'):_0xb90b('0x43')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xb90b('0x1f')](_0xb90b('0x4b'),EXTRACTED_REPORT_ID,_0xb90b('0x49')));return db['AnalyticExtractedReport'][_0xb90b('0x4c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xb90b('0x33')](function(_0x530fe2){EXTRACTED_REPORT=_0x530fe2;return dbH[_0xb90b('0x36')][_0xb90b('0x3a')](util[_0xb90b('0x1f')](_0xb90b('0x4d'),QUERY),{'type':dbH['sequelize'][_0xb90b('0x38')][_0xb90b('0x39')]});})['then'](extractReport)[_0xb90b('0x4e')](function(_0xd1380f){logger['info'](util[_0xb90b('0x1f')](_0xb90b('0x4f'),EXTRACTED_REPORT_ID,'PDF'),util[_0xb90b('0x50')](_0xd1380f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb90b('0x51'));})[_0xb90b('0x52')](function(){process[_0xb90b('0x53')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x231609=new PdfPrinter({'Arial':{'normal':__dirname+_0xb90b('0x54'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xb90b('0x55'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x231609;}function getPDFDocDefinitionFromHTML(_0x1bd854,_0x118699){var _0x21209d=util['format'](_0xb90b('0x56'),_0x118699[_0xb90b('0x57')],_0x118699[_0xb90b('0x58')]);var _0x3bd5df=moment()[_0xb90b('0x1f')]('YYYY-MM-DD')[_0xb90b('0x16')]();var _0x30c49b=htmlToPdfmake(_0x1bd854,{'window':window,'tableAutoSize':!![]});return{'content':[_0x30c49b],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xb90b('0x59'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xb90b('0x24')}];},'footer':function(_0x1878e5,_0x3d452a){return[{'text':util[_0xb90b('0x1f')](_0xb90b('0x5a'),_0x21209d,_0x1878e5,_0x3d452a,_0x3bd5df),'style':_0xb90b('0x2a')}];}};}function writePDFDocument(_0x3a12da,_0xe56506){return new Promise(function(_0x266732,_0x3a019a){var _0x1afdf9=_0x3a12da[_0xb90b('0x5b')](fs[_0xb90b('0x5c')](_0xe56506));_0x1afdf9['on']('finish',function(){_0x266732(_0xb90b('0x5d'));});_0x1afdf9['on']('error',function(_0x10f15d){_0x3a019a(_0x10f15d);});_0x3a12da['end']();});}exports[_0xb90b('0x5e')]=function(_0x3eded9,_0x365150){var _0x336739=getPDFPrinter();var _0x8d1ae3=getPDFDocDefinitionFromHTML(_0x3eded9,_0x365150);var _0x529542=_0x336739[_0xb90b('0x5f')](_0x8d1ae3);return writePDFDocument(_0x529542,_0x365150['path'])['catch'](function(_0x471501){throw _0x471501;});};
\ No newline at end of file
+var _0x278b=['html-to-pdfmake','zip-dir','rimraf','JSDOM','bluebird','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value','length','auto','body','concat','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','margin','landscape','\x20/\x20','footer','Arial','black','right','Setting','splitSizePdf','then','split','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','existsSync','each','flatten','createPdfKitDocument','join','%s.%s','pdf','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','path','lodash','moment'];(function(_0x3305c8,_0x1f3059){var _0x3494a6=function(_0x1de0e4){while(--_0x1de0e4){_0x3305c8['push'](_0x3305c8['shift']());}};_0x3494a6(++_0x1f3059);}(_0x278b,0x14a));var _0xb278=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x278b[_0xa9a245];return _0x2d0eaa;};'use strict';var _=require(_0xb278('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0xb278('0x1'));var htmlToPdfmake=require(_0xb278('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xb278('0x3'));var rimraf=require(_0xb278('0x4'));var JSDOM=require('jsdom')[_0xb278('0x5')];var window=new JSDOM('')['window'];var BPromise=require(_0xb278('0x6'));var db=require(_0xb278('0x7'))['db'];var dbH=require(_0xb278('0x7'))['dbH'];var logger=require(_0xb278('0x8'))(_0xb278('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xb278('0xa')][0x3];var PATH=process[_0xb278('0xa')][0x4];var NAME=process[_0xb278('0xa')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x539148,_0x59e819){var _0x19cac4={'status':_0x539148};var _0x50567c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x59e819){_0x19cac4[_0xb278('0xb')]=_0x59e819;}return db[_0xb278('0xc')][_0xb278('0xd')](_0x19cac4,_0x50567c);}function getHeaders(_0x14898a){return _[_0xb278('0xe')](_0x14898a,function(_0x14d4f8){return{'text':_0x14d4f8,'style':_0xb278('0xf')};});}function getRows(_0x49b998,_0xe88c53){return _[_0xb278('0xe')](_0xe88c53,function(_0xc8fadd){return _(_0xc8fadd)['pick'](_0x49b998)['map'](function(_0x37ca68){return _0x37ca68?_[_0xb278('0x10')](_0x37ca68):'';})[_0xb278('0x11')]();});}function createTable(_0xabc9cd,_0xf39468){var _0x211101={'widths':_['fill'](Array(_0xabc9cd[_0xb278('0x12')]),0x91),'heights':function(_0x651de9){return _0x651de9===0x0?_0xb278('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2d58a8=getHeaders(_0xabc9cd);_0x211101[_0xb278('0x14')]['push'](_0x2d58a8);var _0x520e0a=getRows(_0xabc9cd,_0xf39468);_0x211101[_0xb278('0x14')]=_0x211101['body'][_0xb278('0x15')](_0x520e0a);return _0x211101;}function createTables(_0x5c836f){var _0x4fefee=[];var _0x4afc88=_[_0xb278('0x16')](Object[_0xb278('0x17')](_0x5c836f[0x0]),0x5);_0x4afc88[_0xb278('0x18')](function(_0xcfb998){_0x4fefee[_0xb278('0x19')](createTable(_0xcfb998,_0x5c836f));});return _0x4fefee;}function getPDFDocDefinition(_0x5965f1){var _0x2d725b=util[_0xb278('0x1a')](_0xb278('0x1b'),NAME,EXTRACTED_REPORT[_0xb278('0x1c')],moment(EXTRACTED_REPORT[_0xb278('0x1d')])[_0xb278('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0xb278('0x1e')])[_0xb278('0x1a')](FORMAT));var _0x51b98a=[];for(var _0x1a3a36=0x0;_0x1a3a36<_0x5965f1['length'];_0x1a3a36++){var _0x15b1dc=[];if(_0x1a3a36===0x0){_0x15b1dc[_0xb278('0x19')]({'text':_0x2d725b,'style':_0xb278('0x1f')});}var _0x5199f4={'table':_0x5965f1[_0x1a3a36]};if(_0x1a3a36>0x0){_0x5199f4['pageBreak']='before';_0x5199f4[_0xb278('0x20')]=[0x0,0x46,0x0,0x0];}_0x15b1dc[_0xb278('0x19')](_0x5199f4);_0x51b98a[_0xb278('0x19')](_0x15b1dc);}return{'pageSize':'A4','pageOrientation':_0xb278('0x21'),'content':_0x51b98a,'footer':function(_0x5a50d2,_0x31a017){return{'text':_0x5a50d2['toString']()+_0xb278('0x22')+_0x31a017,'style':_0xb278('0x23')};},'defaultStyle':{'font':_0xb278('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xb278('0x25')},'footer':{'alignment':_0xb278('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5a75fa){var _0x42ae00=0x1388;var _0x1ba3fd;if(!_0x5a75fa[0x0]['num']){return analyticExtractedReport('Empty');}return db[_0xb278('0x27')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xb278('0x28')]})[_0xb278('0x29')](function(_0x340e79){if(_0x340e79){_0x1ba3fd=_0x340e79;_0x42ae00=_0x1ba3fd[_0xb278('0x28')]||0x3e8;}})[_0xb278('0x29')](function(){var _0x437ae4=[];var _0x4dd9f7=0x0;if(_0x1ba3fd[_0xb278('0x2a')]){if(_0x5a75fa&&_0x5a75fa[_0xb278('0x12')]){var _0x237870=_['range'](_0x5a75fa[0x0][_0xb278('0x2b')]/_0x42ae00);var _0x24ff92=Number[_0xb278('0x2c')](_0x5a75fa[0x0]['num']/_0x42ae00)?_0x5a75fa[0x0][_0xb278('0x2b')]%_0x42ae00:0x0;_0x237870[_0xb278('0x18')](function(_0x4ef3c7){if(_0x4ef3c7>0x0){_0x4dd9f7+=_0x42ae00;}_0x437ae4[_0xb278('0x19')](dbH[_0xb278('0x2d')][_0xb278('0x2e')](util['format'](_0xb278('0x2f'),QUERY,_0x42ae00,_0x4dd9f7),{'type':dbH[_0xb278('0x2d')][_0xb278('0x30')][_0xb278('0x31')]}));});if(_0x24ff92>0x0){_0x4dd9f7+=_0x42ae00;_0x437ae4['push'](dbH[_0xb278('0x2d')][_0xb278('0x2e')](util[_0xb278('0x1a')](_0xb278('0x2f'),QUERY,_0x24ff92,_0x4dd9f7),{'type':dbH[_0xb278('0x2d')][_0xb278('0x30')][_0xb278('0x31')]}));}}}else{_0x437ae4[_0xb278('0x19')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xb278('0x2d')][_0xb278('0x30')][_0xb278('0x31')]}));}var _0x1cc950=path['dirname'](PATH);var _0xc1d46e=path[_0xb278('0x32')](PATH,'.pdf');var _0x1d7c8f=_0x1ba3fd[_0xb278('0x2a')]&&_0x437ae4[_0xb278('0x12')]>0x1;var _0x24f315=[];if(!fs[_0xb278('0x33')](path['join'](_0x1cc950,_0xc1d46e))&&_0x1d7c8f){fs['mkdirSync'](path['join'](_0x1cc950,_0xc1d46e));}return BPromise[_0xb278('0x34')](_0x437ae4,function(_0x145dcd){_0x24f315[_0xb278('0x19')](_0x145dcd);})[_0xb278('0x29')](function(){var _0x187521=[];for(var _0x2850d2=0x0;_0x2850d2<_0x24f315[_0xb278('0x12')];_0x2850d2+=0x1){var _0x52a491=_0x24f315[_0x2850d2];var _0x110802=createTables(_[_0xb278('0x35')](_0x52a491));var _0x1c1df9;var _0x186c2a=getPDFDocDefinition(_0x110802);var _0x267197=getPDFPrinter();var _0x47a5f3=_0x267197[_0xb278('0x36')](_0x186c2a);if(_0x1d7c8f){_0x1c1df9=path[_0xb278('0x37')](_0x1cc950,_0xc1d46e,util[_0xb278('0x1a')]('%s%d.%s',_0xc1d46e,_0x2850d2,'pdf'));}else{_0x1c1df9=path[_0xb278('0x37')](_0x1cc950,util[_0xb278('0x1a')](_0xb278('0x38'),_0xc1d46e,_0xb278('0x39')));}_0x187521[_0xb278('0x19')](writePDFDocument(_0x47a5f3,_0x1c1df9));}return Promise[_0xb278('0x3a')](_0x187521);})[_0xb278('0x29')](function(){if(_0x1d7c8f){return new Promise(function(_0x2062fa){zipdir(path[_0xb278('0x37')](_0x1cc950,_0xc1d46e),{'saveTo':path['join'](_0x1cc950,util[_0xb278('0x1a')](_0xb278('0x38'),_0xc1d46e,_0xb278('0x3b')))},function(){rimraf(path[_0xb278('0x37')](_0x1cc950,_0xc1d46e),function(){});_0x2062fa('zip\x20finished');});});}})[_0xb278('0x29')](function(){if(!_0x1d7c8f)return;rimraf(path[_0xb278('0x37')](_0x1cc950,_0xc1d46e),function(){});})['then'](function(){logger[_0xb278('0x3c')](util['format'](_0xb278('0x3d'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xb278('0x3e'),_0x1d7c8f?util[_0xb278('0x1a')]('%s.%s',_0xc1d46e,_0x1d7c8f?_0xb278('0x3b'):_0xb278('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xb278('0x1a')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb278('0x3f')));return db[_0xb278('0xc')][_0xb278('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x2bcbe9){EXTRACTED_REPORT=_0x2bcbe9;return dbH[_0xb278('0x2d')][_0xb278('0x2e')](util[_0xb278('0x1a')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xb278('0x2d')][_0xb278('0x30')]['SELECT']});})[_0xb278('0x29')](extractReport)[_0xb278('0x41')](function(_0x4c77c9){logger[_0xb278('0x3c')](util['format'](_0xb278('0x42'),EXTRACTED_REPORT_ID,_0xb278('0x3f')),util[_0xb278('0x43')](_0x4c77c9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb278('0x44'));})[_0xb278('0x45')](function(){process[_0xb278('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2b15f5=new PdfPrinter({'Arial':{'normal':__dirname+_0xb278('0x47'),'bold':__dirname+_0xb278('0x48'),'italics':__dirname+_0xb278('0x49'),'bolditalics':__dirname+_0xb278('0x4a')}});return _0x2b15f5;}function getPDFDocDefinitionFromHTML(_0x504161,_0x451c31){var _0x38a4eb=util[_0xb278('0x1a')](_0xb278('0x4b'),_0x451c31['channel'],_0x451c31['interactionId']);var _0x5c6e7b=moment()[_0xb278('0x1a')]('YYYY-MM-DD')['toString']();var _0x5525c9=htmlToPdfmake(_0x504161,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5525c9],'defaultStyle':{'font':_0xb278('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xb278('0x4c'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xb278('0x4c'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xb278('0x4c')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xb278('0x1f')}];},'footer':function(_0x1f5b01,_0x142de9){return[{'text':util[_0xb278('0x1a')](_0xb278('0x4d'),_0x38a4eb,_0x1f5b01,_0x142de9,_0x5c6e7b),'style':'footer'}];}};}function writePDFDocument(_0x5d5e06,_0x21fda1){return new Promise(function(_0x10126e,_0x476905){var _0x1eccb2=_0x5d5e06[_0xb278('0x4e')](fs['createWriteStream'](_0x21fda1));_0x1eccb2['on'](_0xb278('0x4f'),function(){_0x10126e(_0xb278('0x4f'));});_0x1eccb2['on'](_0xb278('0x50'),function(_0x30ac26){_0x476905(_0x30ac26);});_0x5d5e06[_0xb278('0x51')]();});}exports['createPdfFromHTML']=function(_0x492a91,_0x640832){var _0x25619a=getPDFPrinter();var _0x44156d=getPDFDocDefinitionFromHTML(_0x492a91,_0x640832);var _0x1d4b58=_0x25619a[_0xb278('0x36')](_0x44156d);return writePDFDocument(_0x1d4b58,_0x640832[_0xb278('0x52')])[_0xb278('0x41')](function(_0x4b3cd5){throw _0x4b3cd5;});};
\ No newline at end of file
index 0f25700..144ff1a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x86bc=['forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','util','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','split','length','range','isInteger'];(function(_0x52c233,_0x4ea17f){var _0xbd0306=function(_0x57cf62){while(--_0x57cf62){_0x52c233['push'](_0x52c233['shift']());}};_0xbd0306(++_0x4ea17f);}(_0x86bc,0x19f));var _0xc86b=function(_0x56ee37,_0x54be86){_0x56ee37=_0x56ee37-0x0;var _0x22c5ed=_0x86bc[_0x56ee37];return _0x22c5ed;};'use strict';var util=require(_0xc86b('0x0'));var path=require('path');var _=require(_0xc86b('0x1'));var fs=require('fs');var json2xls=require(_0xc86b('0x2'));var BPromise=require('bluebird');var zipdir=require(_0xc86b('0x3'));var rimraf=require(_0xc86b('0x4'));var db=require(_0xc86b('0x5'))['db'];var dbH=require(_0xc86b('0x5'))[_0xc86b('0x6')];var logger=require(_0xc86b('0x7'))(_0xc86b('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xc86b('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4b3c7a,_0x250d13){var _0x363552={'status':_0x4b3c7a};var _0x5d3249={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x250d13){_0x363552['savename']=_0x250d13;}return db[_0xc86b('0xa')]['update'](_0x363552,_0x5d3249);}function main(){var _0x18e687=0x1388;var _0xf338d1;logger[_0xc86b('0xb')](util[_0xc86b('0xc')](_0xc86b('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0xc86b('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0xc86b('0xf')](function(_0x3ec1fd){if(_0x3ec1fd){_0xf338d1=_0x3ec1fd;_0x18e687=_0xf338d1[_0xc86b('0x10')]||0x1388;}})[_0xc86b('0xf')](function(){return dbH[_0xc86b('0x11')][_0xc86b('0x12')](util[_0xc86b('0xc')](_0xc86b('0x13'),QUERY),{'type':dbH[_0xc86b('0x11')][_0xc86b('0x14')]['SELECT']});})[_0xc86b('0xf')](function(_0x535e1f){if(!_0x535e1f[0x0][_0xc86b('0x15')]){return analyticExtractedReport('Empty');}var _0x23191d=[];var _0x1e341b=0x0;if(_0xf338d1[_0xc86b('0x16')]){if(_0x535e1f&&_0x535e1f[_0xc86b('0x17')]){var _0x38fe40=_[_0xc86b('0x18')](_0x535e1f[0x0][_0xc86b('0x15')]/_0x18e687);var _0x4c1cdf=Number[_0xc86b('0x19')](_0x535e1f[0x0][_0xc86b('0x15')]/_0x18e687)?_0x535e1f[0x0][_0xc86b('0x15')]%_0x18e687:0x0;_0x38fe40[_0xc86b('0x1a')](function(_0x49ffce){if(_0x49ffce>0x0){_0x1e341b+=_0x18e687;}_0x23191d[_0xc86b('0x1b')](dbH[_0xc86b('0x11')][_0xc86b('0x12')](util[_0xc86b('0xc')](_0xc86b('0x1c'),QUERY,_0x18e687,_0x1e341b),{'type':dbH[_0xc86b('0x11')][_0xc86b('0x14')]['SELECT']}));});if(_0x4c1cdf>0x0){_0x1e341b+=_0x18e687;_0x23191d['push'](dbH[_0xc86b('0x11')][_0xc86b('0x12')](util[_0xc86b('0xc')](_0xc86b('0x1c'),QUERY,_0x4c1cdf,_0x1e341b),{'type':dbH[_0xc86b('0x11')][_0xc86b('0x14')][_0xc86b('0x1d')]}));}}}else{_0x23191d['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xc86b('0x11')][_0xc86b('0x14')][_0xc86b('0x1d')]}));}var _0x37191b=path[_0xc86b('0x1e')](PATH);var _0x37c9f9=path[_0xc86b('0x1f')](PATH,'.xlsx');var _0x36b954=_0xf338d1[_0xc86b('0x16')]&&_0x23191d[_0xc86b('0x17')]>0x1;var _0x2cf41e=[];if(!fs[_0xc86b('0x20')](path[_0xc86b('0x21')](_0x37191b,_0x37c9f9))&&_0x36b954){fs[_0xc86b('0x22')](path[_0xc86b('0x21')](_0x37191b,_0x37c9f9));}return BPromise[_0xc86b('0x23')](_0x23191d,function(_0x305a55){_0x2cf41e[_0xc86b('0x1b')](_0x305a55);})[_0xc86b('0xf')](function(){for(var _0x5d100c=0x0;_0x5d100c<_0x2cf41e[_0xc86b('0x17')];_0x5d100c+=0x1){var _0x29844d;var _0x69aaf7=_0x2cf41e[_0x5d100c];if(_0x36b954){_0x29844d=path['join'](_0x37191b,_0x37c9f9,util[_0xc86b('0xc')](_0xc86b('0x24'),_0x37c9f9,_0x5d100c,_0xc86b('0x25')));}else{_0x29844d=path[_0xc86b('0x21')](_0x37191b,util[_0xc86b('0xc')]('%s.%s',_0x37c9f9,_0xc86b('0x25')));}fs[_0xc86b('0x26')](_0x29844d,json2xls(_0x69aaf7),_0xc86b('0x27'));}})[_0xc86b('0xf')](function(){if(_0x36b954){return new Promise(function(_0x1e4a33){zipdir(path[_0xc86b('0x21')](_0x37191b,_0x37c9f9),{'saveTo':path['join'](_0x37191b,util[_0xc86b('0xc')](_0xc86b('0x28'),_0x37c9f9,_0xc86b('0x29')))},function(_0x59e726,_0x519484){rimraf(path[_0xc86b('0x21')](_0x37191b,_0x37c9f9),function(){});_0x1e4a33('zip\x20finished');});});}})['then'](function(){logger[_0xc86b('0xb')](util[_0xc86b('0xc')](_0xc86b('0x2a'),EXTRACTED_REPORT_ID,_0xc86b('0x2b')));return analyticExtractedReport(_0xc86b('0x2c'),_0x36b954?util[_0xc86b('0xc')]('%s.%s',_0x37c9f9,_0x36b954?_0xc86b('0x29'):_0xc86b('0x25')):null);});})[_0xc86b('0x2d')](function(_0x121940){logger['info'](util[_0xc86b('0xc')](_0xc86b('0x2e'),EXTRACTED_REPORT_ID,_0xc86b('0x2b')),util[_0xc86b('0x2f')](_0x121940,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xc86b('0x30')](function(){process['exit'](EXIT_CODE);});}main();
\ No newline at end of file
+var _0x6d35=['mkdirSync','length','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','path','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','range','isInteger','num','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','.xlsx','split','existsSync','join'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6d35,0xd7));var _0x56d3=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6d35[_0x1facfa];return _0x9ec701;};'use strict';var util=require('util');var path=require(_0x56d3('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x56d3('0x1'));var BPromise=require('bluebird');var zipdir=require(_0x56d3('0x2'));var rimraf=require(_0x56d3('0x3'));var db=require(_0x56d3('0x4'))['db'];var dbH=require(_0x56d3('0x4'))[_0x56d3('0x5')];var logger=require(_0x56d3('0x6'))(_0x56d3('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x56d3('0x8')][0x3];var PATH=process[_0x56d3('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x51a4b3,_0x530c50){var _0x25296f={'status':_0x51a4b3};var _0x1d417f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x530c50){_0x25296f['savename']=_0x530c50;}return db[_0x56d3('0x9')][_0x56d3('0xa')](_0x25296f,_0x1d417f);}function main(){var _0x46dc52=0x1388;var _0x325b11;logger[_0x56d3('0xb')](util[_0x56d3('0xc')](_0x56d3('0xd'),EXTRACTED_REPORT_ID,_0x56d3('0xe')));return db[_0x56d3('0xf')][_0x56d3('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x56d3('0x11')]})[_0x56d3('0x12')](function(_0x4dc829){if(_0x4dc829){_0x325b11=_0x4dc829;_0x46dc52=_0x325b11[_0x56d3('0x11')]||0x1388;}})[_0x56d3('0x12')](function(){return dbH[_0x56d3('0x13')][_0x56d3('0x14')](util[_0x56d3('0xc')](_0x56d3('0x15'),QUERY),{'type':dbH[_0x56d3('0x13')][_0x56d3('0x16')][_0x56d3('0x17')]});})[_0x56d3('0x12')](function(_0x369306){if(!_0x369306[0x0]['num']){return analyticExtractedReport(_0x56d3('0x18'));}var _0x262baf=[];var _0x3f8c96=0x0;if(_0x325b11['split']){if(_0x369306&&_0x369306['length']){var _0x2f2632=_[_0x56d3('0x19')](_0x369306[0x0]['num']/_0x46dc52);var _0x55b227=Number[_0x56d3('0x1a')](_0x369306[0x0][_0x56d3('0x1b')]/_0x46dc52)?_0x369306[0x0][_0x56d3('0x1b')]%_0x46dc52:0x0;_0x2f2632[_0x56d3('0x1c')](function(_0x267a70){if(_0x267a70>0x0){_0x3f8c96+=_0x46dc52;}_0x262baf['push'](dbH['sequelize'][_0x56d3('0x14')](util[_0x56d3('0xc')](_0x56d3('0x1d'),QUERY,_0x46dc52,_0x3f8c96),{'type':dbH[_0x56d3('0x13')][_0x56d3('0x16')][_0x56d3('0x17')]}));});if(_0x55b227>0x0){_0x3f8c96+=_0x46dc52;_0x262baf[_0x56d3('0x1e')](dbH['sequelize'][_0x56d3('0x14')](util[_0x56d3('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x55b227,_0x3f8c96),{'type':dbH[_0x56d3('0x13')]['QueryTypes']['SELECT']}));}}}else{_0x262baf[_0x56d3('0x1e')](dbH['sequelize'][_0x56d3('0x14')](QUERY,{'type':dbH[_0x56d3('0x13')]['QueryTypes'][_0x56d3('0x17')]}));}var _0x3a491d=path['dirname'](PATH);var _0x4505fd=path['basename'](PATH,_0x56d3('0x1f'));var _0x186adb=_0x325b11[_0x56d3('0x20')]&&_0x262baf['length']>0x1;var _0x218ec1=[];if(!fs[_0x56d3('0x21')](path[_0x56d3('0x22')](_0x3a491d,_0x4505fd))&&_0x186adb){fs[_0x56d3('0x23')](path[_0x56d3('0x22')](_0x3a491d,_0x4505fd));}return BPromise['each'](_0x262baf,function(_0x124079){_0x218ec1['push'](_0x124079);})[_0x56d3('0x12')](function(){for(var _0x3c5c1e=0x0;_0x3c5c1e<_0x218ec1[_0x56d3('0x24')];_0x3c5c1e+=0x1){var _0x3b9c54;var _0x105aea=_0x218ec1[_0x3c5c1e];if(_0x186adb){_0x3b9c54=path[_0x56d3('0x22')](_0x3a491d,_0x4505fd,util['format'](_0x56d3('0x25'),_0x4505fd,_0x3c5c1e,'xlsx'));}else{_0x3b9c54=path[_0x56d3('0x22')](_0x3a491d,util[_0x56d3('0xc')](_0x56d3('0x26'),_0x4505fd,_0x56d3('0x27')));}fs[_0x56d3('0x28')](_0x3b9c54,json2xls(_0x105aea),_0x56d3('0x29'));}})[_0x56d3('0x12')](function(){if(_0x186adb){return new Promise(function(_0x5e03fc){zipdir(path[_0x56d3('0x22')](_0x3a491d,_0x4505fd),{'saveTo':path['join'](_0x3a491d,util[_0x56d3('0xc')](_0x56d3('0x26'),_0x4505fd,_0x56d3('0x2a')))},function(_0x7411f6,_0x6f65d0){rimraf(path['join'](_0x3a491d,_0x4505fd),function(){});_0x5e03fc(_0x56d3('0x2b'));});});}})[_0x56d3('0x12')](function(){logger['info'](util[_0x56d3('0xc')](_0x56d3('0x2c'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x56d3('0x2d'),_0x186adb?util[_0x56d3('0xc')]('%s.%s',_0x4505fd,_0x186adb?'zip':_0x56d3('0x27')):null);});})[_0x56d3('0x2e')](function(_0x3ad8cd){logger[_0x56d3('0xb')](util[_0x56d3('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x56d3('0xe')),util[_0x56d3('0x2f')](_0x3ad8cd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x56d3('0x30'));})[_0x56d3('0x31')](function(){process['exit'](EXIT_CODE);});}main();
\ No newline at end of file
index 7da482e..3502568 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb953=['$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','concat','Hangup','transaction','destroy','then','bulkCreate','sortBy','catch','error','lodash','util','findAll','intervals','models','VoiceExtension','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','find','push','Set','format','CDR(type)=%s','context','type','CDR(routeid)=','VoiceExtensionId','outbound','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','map','hasOwnProperty','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb953,0xa1));var _0x3b95=function(_0x6455d7,_0x1259a0){_0x6455d7=_0x6455d7-0x0;var _0x5c3920=_0xb953[_0x6455d7];return _0x5c3920;};'use strict';var _=require(_0x3b95('0x0'));var util=require(_0x3b95('0x1'));function rewrite(_0x5e8389,_0x1de3c9){var _0x365a20=this;return _0x5e8389['models']['Interval'][_0x3b95('0x2')]({'raw':!![]})['then'](function(_0x13d87e){_0x365a20[_0x3b95('0x3')]=_0x13d87e;return _0x5e8389[_0x3b95('0x4')]['VoiceExtension'][_0x3b95('0x2')]({'where':{'IntervalId':_0x1de3c9['IntervalId']},'raw':!![]});})['then'](function(_0x5c2a0d){return _0x5e8389[_0x3b95('0x4')][_0x3b95('0x5')][_0x3b95('0x2')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x5c2a0d,_0x3b95('0x6')))}},'order':[{'raw':_0x3b95('0x7')}],'raw':!![]});})['then'](function(_0x53738f){var _0x1981b0=_[_0x3b95('0x8')](_0x53738f,{'priority':'1'});var _0x23ccfa=_['filter'](_0x53738f,{'isApp':0x1});var _0x18dc8d=_[_0x3b95('0x9')](_0x23ccfa,_0x3b95('0x6'));var _0x5b8c18=[_0x3b95('0xa'),_0x3b95('0xb')];var _0x138e3a=[];var _0x5dfb8c=[];for(var _0x60935f in _0x18dc8d){if(_0x18dc8d['hasOwnProperty'](_0x60935f)){_0x365a20[_0x3b95('0xc')]=0x2;_0x365a20[_0x3b95('0xd')]=[];_0x365a20[_0x3b95('0xe')]=_[_0x3b95('0xf')](_0x1981b0,{'exten':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x6')]});_0x365a20['extensions'][_0x3b95('0x10')]({'type':_0x18dc8d[_0x60935f][0x0]['type'],'app':_0x3b95('0x11'),'appdata':util[_0x3b95('0x12')](_0x3b95('0x13'),_0x18dc8d[_0x60935f][0x0]['type']),'context':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x14')],'exten':_0x18dc8d[_0x60935f][0x0]['exten'],'priority':_0x365a20[_0x3b95('0xc')]++,'VoiceExtensionId':_0x18dc8d[_0x60935f][0x0]['VoiceExtensionId']});if(_0x18dc8d[_0x60935f][0x0][_0x3b95('0x15')]==='inbound'){_0x365a20['extensions'][_0x3b95('0x10')]({'type':_0x18dc8d[_0x60935f][0x0]['type'],'app':_0x3b95('0x11'),'appdata':_0x3b95('0x16')+_0x18dc8d[_0x60935f][0x0][_0x3b95('0x17')],'context':_0x18dc8d[_0x60935f][0x0]['context'],'exten':_0x18dc8d[_0x60935f][0x0]['exten'],'priority':_0x365a20[_0x3b95('0xc')]++,'VoiceExtensionId':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x17')]});}else if(_0x18dc8d[_0x60935f][0x0][_0x3b95('0x15')]===_0x3b95('0x18')){if(_0x365a20[_0x3b95('0xe')]){_0x365a20[_0x3b95('0xd')][_0x3b95('0x10')]({'type':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x15')],'app':_0x3b95('0x11'),'appdata':'CDR(destination)='+(_0x365a20['extension'][_0x3b95('0x19')]?'${EXTEN:'+_0x365a20[_0x3b95('0xe')][_0x3b95('0x19')]+'}':_0x3b95('0x1a')),'context':_0x18dc8d[_0x60935f][0x0]['context'],'exten':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x6')],'priority':_0x365a20[_0x3b95('0xc')]++,'VoiceExtensionId':_0x18dc8d[_0x60935f][0x0]['VoiceExtensionId']});}_0x365a20[_0x3b95('0xd')][_0x3b95('0x10')]({'type':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x15')],'app':_0x3b95('0x11'),'appdata':'CDR(routeid)='+_0x18dc8d[_0x60935f][0x0][_0x3b95('0x17')],'context':_0x18dc8d[_0x60935f][0x0]['context'],'exten':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x6')],'priority':_0x365a20['priority']++,'VoiceExtensionId':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x17')]});var _0x4eefcb=_0x365a20['priority']++;_0x365a20['extensions'][_0x3b95('0x10')]({'type':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x15')],'app':_0x3b95('0x1b'),'appdata':_0x3b95('0x1c')+(_0x4eefcb+0x2)+'):Goto('+(_0x4eefcb+0x1)+')','context':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x14')],'exten':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x6')],'priority':_0x4eefcb,'VoiceExtensionId':_0x18dc8d[_0x60935f][0x0]['VoiceExtensionId']});if(_0x365a20[_0x3b95('0xe')]){_0x365a20['extensions'][_0x3b95('0x10')]({'type':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x15')],'app':_0x3b95('0x11'),'appdata':_0x365a20[_0x3b95('0xe')][_0x3b95('0x19')]?_0x3b95('0x1d')+_0x365a20[_0x3b95('0xe')][_0x3b95('0x19')]+'}':_0x3b95('0x1e'),'context':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x14')],'exten':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x6')],'priority':_0x365a20[_0x3b95('0xc')]++,'VoiceExtensionId':_0x18dc8d[_0x60935f][0x0]['VoiceExtensionId']});}_0x365a20[_0x3b95('0xd')]['push']({'type':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x15')],'app':_0x3b95('0x11'),'appdata':_0x3b95('0x1f')+_0x18dc8d[_0x60935f][0x0]['VoiceExtensionId'],'context':_0x18dc8d[_0x60935f][0x0]['context'],'exten':_0x18dc8d[_0x60935f][0x0]['exten'],'priority':_0x365a20['priority']++,'VoiceExtensionId':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x17')]});if(_0x365a20['extension']&&_0x365a20['extension']['hasOwnProperty'](_0x3b95('0x20'))&&_0x365a20[_0x3b95('0xe')][_0x3b95('0x20')]!==_0x3b95('0x21')){_0x365a20[_0x3b95('0xd')][_0x3b95('0x10')]({'type':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x15')],'app':_0x3b95('0x11'),'appdata':_0x3b95('0x22'),'context':_0x18dc8d[_0x60935f][0x0]['context'],'exten':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x6')],'priority':_0x365a20[_0x3b95('0xc')]++,'VoiceExtensionId':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x17')]});_0x365a20[_0x3b95('0xd')][_0x3b95('0x10')]({'type':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x15')],'app':_0x3b95('0x11'),'appdata':_0x3b95('0x23')+_0x365a20[_0x3b95('0xe')][_0x3b95('0x20')]||_0x3b95('0x24'),'context':_0x18dc8d[_0x60935f][0x0]['context'],'exten':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x6')],'priority':_0x365a20['priority']++,'VoiceExtensionId':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x17')]});}}_0x365a20[_0x3b95('0xd')][_0x3b95('0x10')]({'type':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x15')],'app':_0x3b95('0x11'),'appdata':_0x3b95('0x25'),'context':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x14')],'exten':_0x18dc8d[_0x60935f][0x0]['exten'],'priority':_0x365a20['priority']++,'VoiceExtensionId':_0x18dc8d[_0x60935f][0x0]['VoiceExtensionId']});_0x365a20[_0x3b95('0xd')][_0x3b95('0x10')]({'type':_0x18dc8d[_0x60935f][0x0]['type'],'app':_0x3b95('0x11'),'appdata':_0x3b95('0x26'),'context':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x14')],'exten':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x6')],'priority':_0x365a20[_0x3b95('0xc')]++,'VoiceExtensionId':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x17')]});_0x365a20['extensions'][_0x3b95('0x10')]({'type':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x15')],'app':'Set','appdata':_0x3b95('0x27'),'context':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x14')],'exten':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x6')],'priority':_0x365a20[_0x3b95('0xc')]++,'VoiceExtensionId':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x17')]});for(var _0xe5f856=0x0,_0x4728eb=0x0;_0xe5f856<_0x18dc8d[_0x60935f]['length'];_0xe5f856+=0x1,_0x4728eb=0x0){var _0x45bb94=_0x18dc8d[_0x60935f][_0xe5f856];if(_0x45bb94[_0x3b95('0x15')]){_0x45bb94[_0x3b95('0x15')]=_0x45bb94[_0x3b95('0x15')][_0x3b95('0x28')]();}var _0x38bfe9=[];var _0x545bfe=[];delete _0x45bb94['id'];delete _0x45bb94[_0x3b95('0x29')];delete _0x45bb94[_0x3b95('0x2a')];var _0xf78b4d=_0x45bb94[_0x3b95('0x2b')]!==_0x3b95('0x2c')?[_0x45bb94[_0x3b95('0x2b')]]:_0x45bb94[_0x3b95('0x2d')]?_[_0x3b95('0x2e')](_['filter'](_0x365a20['intervals'],{'IntervalId':_0x45bb94['IntervalId']}),'interval'):[];if(_0x45bb94[_0x3b95('0x2f')](_0x3b95('0x30'))){if(_0x45bb94['tag']&&_0x45bb94[_0x3b95('0x30')]!=='--'){_0x38bfe9[_0x3b95('0x10')]({'type':_0x45bb94[_0x3b95('0x15')],'app':_0x3b95('0x11'),'appdata':_0x3b95('0x31')+_0x45bb94[_0x3b95('0x30')],'context':_0x45bb94[_0x3b95('0x14')],'exten':_0x45bb94[_0x3b95('0x6')],'priority':_0xf78b4d[_0x3b95('0x32')]+_0x365a20[_0x3b95('0xc')]+_0x4728eb++,'VoiceExtensionId':_0x45bb94[_0x3b95('0x17')]});}}if(_0x45bb94[_0x3b95('0x15')]===_0x3b95('0x18')&&_0x45bb94['hasOwnProperty'](_0x3b95('0x33'))){if(_0x45bb94[_0x3b95('0x33')]){_0x38bfe9[_0x3b95('0x10')]({'type':_0x45bb94[_0x3b95('0x15')],'app':_0x3b95('0x1b'),'appdata':_0x3b95('0x34')+_0x45bb94[_0x3b95('0x33')]+')','context':_0x45bb94[_0x3b95('0x14')],'exten':_0x45bb94[_0x3b95('0x6')],'priority':_0xf78b4d[_0x3b95('0x32')]+_0x365a20[_0x3b95('0xc')]+_0x4728eb++,'VoiceExtensionId':_0x45bb94[_0x3b95('0x17')]});}else{_0x38bfe9[_0x3b95('0x10')]({'type':_0x45bb94[_0x3b95('0x15')],'app':'ExecIf','appdata':_0x3b95('0x35'),'context':_0x45bb94[_0x3b95('0x14')],'exten':_0x45bb94[_0x3b95('0x6')],'priority':_0xf78b4d['length']+_0x365a20[_0x3b95('0xc')]+_0x4728eb++,'VoiceExtensionId':_0x45bb94['VoiceExtensionId']});}}if(_0x45bb94[_0x3b95('0x2f')](_0x3b95('0x36'))){if(_0x5b8c18[_0x3b95('0x37')](_0x45bb94[_0x3b95('0x38')][_0x3b95('0x28')]())>=0x0&&_0x45bb94['appType']!==_0x3b95('0x39')){if(_0x45bb94[_0x3b95('0x36')]){_0x38bfe9[_0x3b95('0x10')]({'type':_0x45bb94['type'],'app':_0x3b95('0x1b'),'appdata':_0x3b95('0x3a'),'context':_0x45bb94[_0x3b95('0x14')],'exten':_0x45bb94[_0x3b95('0x6')],'priority':_0xf78b4d[_0x3b95('0x32')]+_0x365a20['priority']+_0x4728eb++,'VoiceExtensionId':_0x45bb94[_0x3b95('0x17')]});_0x38bfe9[_0x3b95('0x10')]({'type':_0x45bb94[_0x3b95('0x15')],'app':_0x3b95('0x11'),'appdata':_0x3b95('0x3b'),'context':_0x45bb94[_0x3b95('0x14')],'exten':_0x45bb94[_0x3b95('0x6')],'priority':_0xf78b4d['length']+_0x365a20[_0x3b95('0xc')]+_0x4728eb++,'VoiceExtensionId':_0x45bb94[_0x3b95('0x17')]});}else{_0x38bfe9[_0x3b95('0x10')]({'type':_0x45bb94['type'],'app':_0x3b95('0x1b'),'appdata':_0x3b95('0x3c'),'context':_0x45bb94[_0x3b95('0x14')],'exten':_0x45bb94[_0x3b95('0x6')],'priority':_0xf78b4d['length']+_0x365a20['priority']+_0x4728eb++,'VoiceExtensionId':_0x45bb94['VoiceExtensionId']});_0x38bfe9[_0x3b95('0x10')]({'type':_0x45bb94[_0x3b95('0x15')],'app':_0x3b95('0x11'),'appdata':_0x3b95('0x3d'),'context':_0x45bb94[_0x3b95('0x14')],'exten':_0x45bb94[_0x3b95('0x6')],'priority':_0xf78b4d[_0x3b95('0x32')]+_0x365a20[_0x3b95('0xc')]+_0x4728eb++,'VoiceExtensionId':_0x45bb94[_0x3b95('0x17')]});}}}for(var _0x24aae1=0x0;_0x24aae1<_0xf78b4d['length'];_0x24aae1+=0x1){var _0x31d9b2=_0x365a20['priority']+_0xf78b4d[_0x3b95('0x32')];var _0x14a677=_0x24aae1===_0xf78b4d[_0x3b95('0x32')]-0x1?_0x365a20[_0x3b95('0xc')]+_0x38bfe9['length']+_0x545bfe['length']+0x2:_0x365a20[_0x3b95('0xc')]+_0x24aae1+0x1;_0x38bfe9[_0x3b95('0x3e')](_0x24aae1,0x0,{'type':_0x45bb94['type'],'app':'GotoIfTime','appdata':_0xf78b4d[_0x24aae1]+'?'+_0x45bb94[_0x3b95('0x14')]+_0x3b95('0x3f')+_0x31d9b2+':'+_0x45bb94[_0x3b95('0x14')]+',${EXTEN},'+_0x14a677,'exten':_0x45bb94[_0x3b95('0x6')],'context':_0x45bb94[_0x3b95('0x14')],'priority':_0x365a20[_0x3b95('0xc')]+_0x24aae1,'VoiceExtensionId':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x17')]});}_0x45bb94['priority']=_0x38bfe9[_0x3b95('0x32')]?_['last'](_0x38bfe9)[_0x3b95('0xc')]+0x1:_0x365a20['priority'];_0x365a20[_0x3b95('0xc')]=(_0x545bfe[_0x3b95('0x32')]?_['last'](_0x545bfe)[_0x3b95('0xc')]:_0x45bb94[_0x3b95('0xc')])+0x1;_0x365a20[_0x3b95('0xd')]=_[_0x3b95('0x40')](_0x365a20['extensions'],_0x38bfe9,[_0x45bb94],_0x545bfe);}_0x365a20['extensions'][_0x3b95('0x10')]({'type':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x15')],'app':_0x3b95('0x41'),'exten':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x6')],'context':_0x18dc8d[_0x60935f][0x0]['context'],'priority':_0x365a20[_0x3b95('0xc')],'VoiceExtensionId':_0x18dc8d[_0x60935f][0x0][_0x3b95('0x17')]});_0x138e3a[_0x3b95('0x10')](_0x18dc8d[_0x60935f][0x0][_0x3b95('0x17')]);_0x5dfb8c=_[_0x3b95('0x40')](_0x5dfb8c,_0x365a20[_0x3b95('0xd')]);}}return _0x5e8389[_0x3b95('0x42')](function(_0x1a10da){return _0x5e8389[_0x3b95('0x4')][_0x3b95('0x5')][_0x3b95('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x138e3a}},'transaction':_0x1a10da})[_0x3b95('0x44')](function(_0x460372){return _0x5e8389[_0x3b95('0x4')][_0x3b95('0x5')][_0x3b95('0x45')](_[_0x3b95('0x46')](_0x5dfb8c,_0x3b95('0xc')),{'transaction':_0x1a10da});});});})[_0x3b95('0x47')](function(_0x578598){console[_0x3b95('0x48')](_0x578598);});}exports['rewrite']=rewrite;
\ No newline at end of file
+var _0x2d52=['destroy','bulkCreate','sortBy','catch','rewrite','lodash','models','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','playback','hasOwnProperty','priority','extension','find','extensions','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction'];(function(_0x1e0188,_0x16401f){var _0x4c231c=function(_0x3f93ec){while(--_0x3f93ec){_0x1e0188['push'](_0x1e0188['shift']());}};_0x4c231c(++_0x16401f);}(_0x2d52,0xdd));var _0x22d5=function(_0x510f5d,_0x4ac744){_0x510f5d=_0x510f5d-0x0;var _0x1692a7=_0x2d52[_0x510f5d];return _0x1692a7;};'use strict';var _=require(_0x22d5('0x0'));var util=require('util');function rewrite(_0x195bc0,_0x11126d){var _0x33d83b=this;return _0x195bc0[_0x22d5('0x1')]['Interval'][_0x22d5('0x2')]({'raw':!![]})['then'](function(_0x1f3b13){_0x33d83b[_0x22d5('0x3')]=_0x1f3b13;return _0x195bc0['models'][_0x22d5('0x4')][_0x22d5('0x2')]({'where':{'IntervalId':_0x11126d[_0x22d5('0x5')]},'raw':!![]});})[_0x22d5('0x6')](function(_0x4f7521){return _0x195bc0[_0x22d5('0x1')][_0x22d5('0x4')][_0x22d5('0x2')]({'where':{'exten':{'$in':_[_0x22d5('0x7')](_[_0x22d5('0x8')](_0x4f7521,'exten'))}},'order':[{'raw':_0x22d5('0x9')}],'raw':!![]});})[_0x22d5('0x6')](function(_0x339664){var _0x283080=_[_0x22d5('0xa')](_0x339664,{'priority':'1'});var _0x17549d=_[_0x22d5('0xa')](_0x339664,{'isApp':0x1});var _0x1cacc9=_['groupBy'](_0x17549d,_0x22d5('0xb'));var _0x5ecd7b=['queue',_0x22d5('0xc')];var _0x14b09c=[];var _0x2da842=[];for(var _0x4efaa2 in _0x1cacc9){if(_0x1cacc9[_0x22d5('0xd')](_0x4efaa2)){_0x33d83b[_0x22d5('0xe')]=0x2;_0x33d83b['extensions']=[];_0x33d83b[_0x22d5('0xf')]=_[_0x22d5('0x10')](_0x283080,{'exten':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0xb')]});_0x33d83b[_0x22d5('0x11')][_0x22d5('0x12')]({'type':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x13')],'app':_0x22d5('0x14'),'appdata':util[_0x22d5('0x15')](_0x22d5('0x16'),_0x1cacc9[_0x4efaa2][0x0]['type']),'context':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x17')],'exten':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0xb')],'priority':_0x33d83b['priority']++,'VoiceExtensionId':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x18')]});if(_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x13')]===_0x22d5('0x19')){_0x33d83b[_0x22d5('0x11')]['push']({'type':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x13')],'app':_0x22d5('0x14'),'appdata':_0x22d5('0x1a')+_0x1cacc9[_0x4efaa2][0x0]['VoiceExtensionId'],'context':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x17')],'exten':_0x1cacc9[_0x4efaa2][0x0]['exten'],'priority':_0x33d83b['priority']++,'VoiceExtensionId':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x18')]});}else if(_0x1cacc9[_0x4efaa2][0x0]['type']===_0x22d5('0x1b')){if(_0x33d83b[_0x22d5('0xf')]){_0x33d83b[_0x22d5('0x11')][_0x22d5('0x12')]({'type':_0x1cacc9[_0x4efaa2][0x0]['type'],'app':_0x22d5('0x14'),'appdata':_0x22d5('0x1c')+(_0x33d83b[_0x22d5('0xf')][_0x22d5('0x1d')]?_0x22d5('0x1e')+_0x33d83b[_0x22d5('0xf')][_0x22d5('0x1d')]+'}':'${EXTEN}'),'context':_0x1cacc9[_0x4efaa2][0x0]['context'],'exten':_0x1cacc9[_0x4efaa2][0x0]['exten'],'priority':_0x33d83b[_0x22d5('0xe')]++,'VoiceExtensionId':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x18')]});}_0x33d83b[_0x22d5('0x11')][_0x22d5('0x12')]({'type':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x13')],'app':_0x22d5('0x14'),'appdata':_0x22d5('0x1a')+_0x1cacc9[_0x4efaa2][0x0]['VoiceExtensionId'],'context':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x17')],'exten':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0xb')],'priority':_0x33d83b[_0x22d5('0xe')]++,'VoiceExtensionId':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x18')]});var _0x457323=_0x33d83b[_0x22d5('0xe')]++;_0x33d83b[_0x22d5('0x11')][_0x22d5('0x12')]({'type':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x13')],'app':_0x22d5('0x1f'),'appdata':_0x22d5('0x20')+(_0x457323+0x2)+'):Goto('+(_0x457323+0x1)+')','context':_0x1cacc9[_0x4efaa2][0x0]['context'],'exten':_0x1cacc9[_0x4efaa2][0x0]['exten'],'priority':_0x457323,'VoiceExtensionId':_0x1cacc9[_0x4efaa2][0x0]['VoiceExtensionId']});if(_0x33d83b[_0x22d5('0xf')]){_0x33d83b['extensions'][_0x22d5('0x12')]({'type':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x13')],'app':_0x22d5('0x14'),'appdata':_0x33d83b['extension']['cutdigits']?_0x22d5('0x21')+_0x33d83b[_0x22d5('0xf')][_0x22d5('0x1d')]+'}':_0x22d5('0x22'),'context':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x17')],'exten':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0xb')],'priority':_0x33d83b[_0x22d5('0xe')]++,'VoiceExtensionId':_0x1cacc9[_0x4efaa2][0x0]['VoiceExtensionId']});}_0x33d83b[_0x22d5('0x11')][_0x22d5('0x12')]({'type':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x13')],'app':_0x22d5('0x14'),'appdata':_0x22d5('0x23')+_0x1cacc9[_0x4efaa2][0x0]['VoiceExtensionId'],'context':_0x1cacc9[_0x4efaa2][0x0]['context'],'exten':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0xb')],'priority':_0x33d83b[_0x22d5('0xe')]++,'VoiceExtensionId':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x18')]});if(_0x33d83b['extension']&&_0x33d83b[_0x22d5('0xf')]['hasOwnProperty'](_0x22d5('0x24'))&&_0x33d83b[_0x22d5('0xf')]['recordingFormat']!==_0x22d5('0x25')){_0x33d83b[_0x22d5('0x11')][_0x22d5('0x12')]({'type':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x13')],'app':_0x22d5('0x14'),'appdata':_0x22d5('0x26'),'context':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x17')],'exten':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0xb')],'priority':_0x33d83b[_0x22d5('0xe')]++,'VoiceExtensionId':_0x1cacc9[_0x4efaa2][0x0]['VoiceExtensionId']});_0x33d83b[_0x22d5('0x11')]['push']({'type':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x13')],'app':_0x22d5('0x14'),'appdata':_0x22d5('0x27')+_0x33d83b['extension']['recordingFormat']||_0x22d5('0x28'),'context':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x17')],'exten':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0xb')],'priority':_0x33d83b[_0x22d5('0xe')]++,'VoiceExtensionId':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x18')]});}}_0x33d83b[_0x22d5('0x11')][_0x22d5('0x12')]({'type':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x13')],'app':_0x22d5('0x14'),'appdata':_0x22d5('0x29'),'context':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x17')],'exten':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0xb')],'priority':_0x33d83b[_0x22d5('0xe')]++,'VoiceExtensionId':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x18')]});_0x33d83b[_0x22d5('0x11')][_0x22d5('0x12')]({'type':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x13')],'app':_0x22d5('0x14'),'appdata':_0x22d5('0x2a'),'context':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x17')],'exten':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0xb')],'priority':_0x33d83b['priority']++,'VoiceExtensionId':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x18')]});_0x33d83b['extensions'][_0x22d5('0x12')]({'type':_0x1cacc9[_0x4efaa2][0x0]['type'],'app':_0x22d5('0x14'),'appdata':_0x22d5('0x2b'),'context':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x17')],'exten':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0xb')],'priority':_0x33d83b['priority']++,'VoiceExtensionId':_0x1cacc9[_0x4efaa2][0x0]['VoiceExtensionId']});for(var _0x2aaaaa=0x0,_0x2f1ce7=0x0;_0x2aaaaa<_0x1cacc9[_0x4efaa2][_0x22d5('0x2c')];_0x2aaaaa+=0x1,_0x2f1ce7=0x0){var _0x570d03=_0x1cacc9[_0x4efaa2][_0x2aaaaa];if(_0x570d03[_0x22d5('0x13')]){_0x570d03[_0x22d5('0x13')]=_0x570d03[_0x22d5('0x13')][_0x22d5('0x2d')]();}var _0x4b34ca=[];var _0x2cb12e=[];delete _0x570d03['id'];delete _0x570d03[_0x22d5('0x2e')];delete _0x570d03['updatedAt'];var _0x477e23=_0x570d03[_0x22d5('0x2f')]!==_0x22d5('0x30')?[_0x570d03['interval']]:_0x570d03[_0x22d5('0x5')]?_[_0x22d5('0x8')](_['filter'](_0x33d83b[_0x22d5('0x3')],{'IntervalId':_0x570d03[_0x22d5('0x5')]}),'interval'):[];if(_0x570d03['hasOwnProperty'](_0x22d5('0x31'))){if(_0x570d03[_0x22d5('0x31')]&&_0x570d03[_0x22d5('0x31')]!=='--'){_0x4b34ca[_0x22d5('0x12')]({'type':_0x570d03['type'],'app':_0x22d5('0x14'),'appdata':_0x22d5('0x32')+_0x570d03[_0x22d5('0x31')],'context':_0x570d03[_0x22d5('0x17')],'exten':_0x570d03[_0x22d5('0xb')],'priority':_0x477e23[_0x22d5('0x2c')]+_0x33d83b[_0x22d5('0xe')]+_0x2f1ce7++,'VoiceExtensionId':_0x570d03[_0x22d5('0x18')]});}}if(_0x570d03['type']===_0x22d5('0x1b')&&_0x570d03[_0x22d5('0xd')](_0x22d5('0x33'))){if(_0x570d03[_0x22d5('0x33')]){_0x4b34ca[_0x22d5('0x12')]({'type':_0x570d03[_0x22d5('0x13')],'app':_0x22d5('0x1f'),'appdata':_0x22d5('0x34')+_0x570d03['callerID']+')','context':_0x570d03['context'],'exten':_0x570d03['exten'],'priority':_0x477e23['length']+_0x33d83b[_0x22d5('0xe')]+_0x2f1ce7++,'VoiceExtensionId':_0x570d03['VoiceExtensionId']});}else{_0x4b34ca[_0x22d5('0x12')]({'type':_0x570d03[_0x22d5('0x13')],'app':_0x22d5('0x1f'),'appdata':_0x22d5('0x35'),'context':_0x570d03['context'],'exten':_0x570d03['exten'],'priority':_0x477e23[_0x22d5('0x2c')]+_0x33d83b[_0x22d5('0xe')]+_0x2f1ce7++,'VoiceExtensionId':_0x570d03[_0x22d5('0x18')]});}}if(_0x570d03[_0x22d5('0xd')](_0x22d5('0x36'))){if(_0x5ecd7b[_0x22d5('0x37')](_0x570d03[_0x22d5('0x38')][_0x22d5('0x2d')]())>=0x0&&_0x570d03['appType']!==_0x22d5('0x39')){if(_0x570d03['answer']){_0x4b34ca[_0x22d5('0x12')]({'type':_0x570d03['type'],'app':_0x22d5('0x1f'),'appdata':_0x22d5('0x3a'),'context':_0x570d03['context'],'exten':_0x570d03[_0x22d5('0xb')],'priority':_0x477e23['length']+_0x33d83b[_0x22d5('0xe')]+_0x2f1ce7++,'VoiceExtensionId':_0x570d03['VoiceExtensionId']});_0x4b34ca['push']({'type':_0x570d03[_0x22d5('0x13')],'app':_0x22d5('0x14'),'appdata':_0x22d5('0x3b'),'context':_0x570d03[_0x22d5('0x17')],'exten':_0x570d03[_0x22d5('0xb')],'priority':_0x477e23[_0x22d5('0x2c')]+_0x33d83b[_0x22d5('0xe')]+_0x2f1ce7++,'VoiceExtensionId':_0x570d03[_0x22d5('0x18')]});}else{_0x4b34ca['push']({'type':_0x570d03[_0x22d5('0x13')],'app':_0x22d5('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x570d03['context'],'exten':_0x570d03[_0x22d5('0xb')],'priority':_0x477e23[_0x22d5('0x2c')]+_0x33d83b['priority']+_0x2f1ce7++,'VoiceExtensionId':_0x570d03['VoiceExtensionId']});_0x4b34ca['push']({'type':_0x570d03['type'],'app':'Set','appdata':_0x22d5('0x3c'),'context':_0x570d03[_0x22d5('0x17')],'exten':_0x570d03[_0x22d5('0xb')],'priority':_0x477e23[_0x22d5('0x2c')]+_0x33d83b[_0x22d5('0xe')]+_0x2f1ce7++,'VoiceExtensionId':_0x570d03[_0x22d5('0x18')]});}}}for(var _0x291568=0x0;_0x291568<_0x477e23[_0x22d5('0x2c')];_0x291568+=0x1){var _0x430ca9=_0x33d83b['priority']+_0x477e23[_0x22d5('0x2c')];var _0x3b79f8=_0x291568===_0x477e23[_0x22d5('0x2c')]-0x1?_0x33d83b[_0x22d5('0xe')]+_0x4b34ca['length']+_0x2cb12e[_0x22d5('0x2c')]+0x2:_0x33d83b[_0x22d5('0xe')]+_0x291568+0x1;_0x4b34ca[_0x22d5('0x3d')](_0x291568,0x0,{'type':_0x570d03[_0x22d5('0x13')],'app':'GotoIfTime','appdata':_0x477e23[_0x291568]+'?'+_0x570d03[_0x22d5('0x17')]+',${EXTEN},'+_0x430ca9+':'+_0x570d03[_0x22d5('0x17')]+_0x22d5('0x3e')+_0x3b79f8,'exten':_0x570d03[_0x22d5('0xb')],'context':_0x570d03[_0x22d5('0x17')],'priority':_0x33d83b['priority']+_0x291568,'VoiceExtensionId':_0x1cacc9[_0x4efaa2][0x0]['VoiceExtensionId']});}_0x570d03[_0x22d5('0xe')]=_0x4b34ca[_0x22d5('0x2c')]?_[_0x22d5('0x3f')](_0x4b34ca)[_0x22d5('0xe')]+0x1:_0x33d83b[_0x22d5('0xe')];_0x33d83b['priority']=(_0x2cb12e[_0x22d5('0x2c')]?_[_0x22d5('0x3f')](_0x2cb12e)[_0x22d5('0xe')]:_0x570d03[_0x22d5('0xe')])+0x1;_0x33d83b['extensions']=_[_0x22d5('0x40')](_0x33d83b[_0x22d5('0x11')],_0x4b34ca,[_0x570d03],_0x2cb12e);}_0x33d83b['extensions']['push']({'type':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x13')],'app':_0x22d5('0x41'),'exten':_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0xb')],'context':_0x1cacc9[_0x4efaa2][0x0]['context'],'priority':_0x33d83b['priority'],'VoiceExtensionId':_0x1cacc9[_0x4efaa2][0x0]['VoiceExtensionId']});_0x14b09c['push'](_0x1cacc9[_0x4efaa2][0x0][_0x22d5('0x18')]);_0x2da842=_[_0x22d5('0x40')](_0x2da842,_0x33d83b['extensions']);}}return _0x195bc0[_0x22d5('0x42')](function(_0x378de2){return _0x195bc0['models']['VoiceExtension'][_0x22d5('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x14b09c}},'transaction':_0x378de2})[_0x22d5('0x6')](function(_0x8c6f7c){return _0x195bc0[_0x22d5('0x1')]['VoiceExtension'][_0x22d5('0x44')](_[_0x22d5('0x45')](_0x2da842,'priority'),{'transaction':_0x378de2});});});})[_0x22d5('0x46')](function(_0x1983a2){console['error'](_0x1983a2);});}exports[_0x22d5('0x47')]=rewrite;
\ No newline at end of file
index 43fead0..aa6e86c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x225f=['onlyIfOpen','sequelize','catch','all','VoiceQueue','findAll','outbound','BlackLists','get','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','duplicate','CmContact','create','keys','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','into','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','phone','NOW()','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','ListId','cm_contacts','id\x20IN\x20?','calleridnum','cm_hopper_final','str','dialCheckDuplicateType','CmList','Lists','always','query','VoiceQueueId'];(function(_0x2611c1,_0x22657e){var _0x1903b2=function(_0x1319c2){while(--_0x1319c2){_0x2611c1['push'](_0x2611c1['shift']());}};_0x1903b2(++_0x22657e);}(_0x225f,0x168));var _0xf225=function(_0x2cf3a3,_0x3f3284){_0x2cf3a3=_0x2cf3a3-0x0;var _0x580d31=_0x225f[_0x2cf3a3];return _0x580d31;};'use strict';var BPromise=require(_0xf225('0x0'));var util=require(_0xf225('0x1'));var _=require(_0xf225('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xf225('0x3'));var Redis=require(_0xf225('0x4'));var db=require(_0xf225('0x5'))['db'];var config=require(_0xf225('0x6'));var logger=require(_0xf225('0x7'))(_0xf225('0x8'));config[_0xf225('0x9')]=_[_0xf225('0xa')](config[_0xf225('0x9')],{'host':_0xf225('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf225('0x9')]));require(_0xf225('0xc'))[_0xf225('0xd')](socket);try{if(!process[_0xf225('0xe')][0x2]||process['argv'][0x2]==='undefined'||process['argv'][0x2]===_0xf225('0xf')){throw new Error(_0xf225('0x10'));}var FILEPATH=process[_0xf225('0xe')][0x2];if(!process[_0xf225('0xe')][0x3]||process[_0xf225('0xe')][0x3]===_0xf225('0x11')||process[_0xf225('0xe')][0x3]===_0xf225('0xf')||!process[_0xf225('0xe')][0x4]||process['argv'][0x4]===_0xf225('0x11')||process[_0xf225('0xe')][0x4]===_0xf225('0xf')){throw new Error(_0xf225('0x12'));}var FIELDS=_[_0xf225('0x13')](process['argv'][0x3][_0xf225('0x14')](','),process['argv'][0x4][_0xf225('0x14')](','));if(!process[_0xf225('0xe')][0x5]||process['argv'][0x5]===_0xf225('0x11')||process[_0xf225('0xe')][0x5]==='null'){throw new Error(_0xf225('0x15'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0xf225('0xe')][0x6]!=='null'?process[_0xf225('0xe')][0x6]:null;var DUPLICATES=process[_0xf225('0xe')][0x7]&&process[_0xf225('0xe')][0x7]!==_0xf225('0x11')&&process[_0xf225('0xe')][0x7]!==_0xf225('0xf')?process[_0xf225('0xe')][0x7]:null;if(!process['argv'][0x8]||process[_0xf225('0xe')][0x8]===_0xf225('0x11')||process['argv'][0x8]===_0xf225('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xf225('0xe')][0x8];}catch(_0x54e7f1){logger[_0xf225('0x16')](_0x54e7f1);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x1cf349,_0x2be711,_0x7096b1,_0x491cef){var _0x1ac26f={'message':_0x2be711};_0x1ac26f[_0x1cf349]=!![];if(_0x7096b1){_0x1ac26f[_0xf225('0x17')]=_0x7096b1;}if(_0x491cef){_0x1ac26f[_0xf225('0x18')]=_0x491cef;}return _0x1ac26f;}function isEmail(_0x8d74e6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xf225('0x19')](_0x8d74e6);}function checkRow(_0x4378cf,_0x8e4d9d,_0x1ef129){return new BPromise(function(_0x5b7057,_0x2cc1ff){if(_['isNil'](_0x4378cf)){return _0x2cc1ff(handleCheckRowError('error',_0xf225('0x1a'),null,_0x1ef129));}if(_0x4378cf[_0xf225('0x1b')]&&_0x4378cf['errors'][_0xf225('0x1c')]){var _0x8225d1=_[_0xf225('0x1d')](_0x4378cf[_0xf225('0x1b')],_0xf225('0x1e'))[_0xf225('0x1f')](';');return _0x2cc1ff(handleCheckRowError(_0xf225('0x16'),_0x8225d1,null,_0x1ef129));}var _0x4e3846={};for(var _0x403013 in FIELDS){if(FIELDS[_0xf225('0x20')](_0x403013)&&FIELDS[_0x403013]){_0x4e3846[_0x403013]=_0x4378cf[_0xf225('0x21')][0x0][FIELDS[_0x403013]]||_0x4378cf['data'][0x0]['\ufeff'+FIELDS[_0x403013]];}}if(!_0x4e3846[_0xf225('0x22')]){return _0x2cc1ff(handleCheckRowError('error',_0xf225('0x23'),null,_0x1ef129));}if(!_0x4e3846['phone']){return _0x2cc1ff(handleCheckRowError('error',_0xf225('0x24'),null,_0x1ef129));}if(_0x4e3846[_0xf225('0x25')]){var _0x249d88=moment(_0x4e3846[_0xf225('0x25')],_0xf225('0x26'));if(!_0x249d88[_0xf225('0x27')]()){return _0x2cc1ff(handleCheckRowError('error',_0xf225('0x28'),null,_0x1ef129));}}if(_0x4e3846[_0xf225('0x29')]){if(!isEmail(_0x4e3846['email'])){return _0x2cc1ff(handleCheckRowError(_0xf225('0x16'),'email\x20format\x20is\x20not\x20valid!',null,_0x1ef129));}}_0x4e3846['ListId']=LISTID;_0x4e3846['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xf225('0x1c')]&&_0x8e4d9d){var _0x489a82={};for(var _0x3de129=0x0,_0xd53828=DUPLICATES[_0xf225('0x1c')];_0x3de129<_0xd53828;_0x3de129+=0x1){_0x489a82[DUPLICATES[_0x3de129]]=_0x4e3846[DUPLICATES[_0x3de129]];}var _0x2b9b7f=_['find'](_0x8e4d9d,_0x489a82);if(_0x2b9b7f){return _0x2cc1ff(handleCheckRowError(_0xf225('0x2a'),'Duplicate\x20Contact',_0x2b9b7f,_0x1ef129));}}return db[_0xf225('0x2b')][_0xf225('0x2c')](_0x4e3846,{'raw':!![],'hooks':![],'fields':_[_0xf225('0x2d')](_0x4e3846)})[_0xf225('0x2e')](function(_0x4f8886){if(DUPLICATES&&DUPLICATES[_0xf225('0x1c')]&&_0x8e4d9d){_0x8e4d9d[_0xf225('0x2f')](_['pick'](_0x4e3846,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4f8886['id'];return _0x5b7057();})['catch'](function(_0x2e307b){return _0x2cc1ff(handleCheckRowError(_0xf225('0x16'),_0xf225('0x30')+(_0x2e307b[_0xf225('0x1e')]||JSON[_0xf225('0x31')](_0x2e307b)),null,_0x1ef129));});});}function checkHopper(){function _0x104183(){return function(_0x57924e){logger[_0xf225('0x16')](_0xf225('0x32'),_0xf225('0x33'),util['inspect'](_0x57924e,{'showHidden':![],'depth':null}));};}var _0x218d87=function(_0x22c12f,_0x2b2e6d){var _0x3e2b50=squel[_0xf225('0x34')]()[_0xf225('0x35')]('cm_hopper')[_0xf225('0x36')](['phone',_0xf225('0x37'),_0xf225('0x38'),'ListId',_0x2b2e6d,_0xf225('0x39'),_0xf225('0x3a')],squel[_0xf225('0x3b')]()[_0xf225('0x3c')]('phone',_0xf225('0x3d'))[_0xf225('0x3c')](_0xf225('0x3e'),_0xf225('0x37'))[_0xf225('0x3c')]('id',_0xf225('0x38'))[_0xf225('0x3c')](LISTID['toString'](),'ListId')[_0xf225('0x3c')](_0x22c12f['id']['toString'](),_0x2b2e6d)[_0xf225('0x3c')](_0xf225('0x3e'),'createdAt')[_0xf225('0x3c')](_0xf225('0x3e'),_0xf225('0x3a'))[_0xf225('0x3f')]('cm_contacts')[_0xf225('0x40')](_0xf225('0x41'))[_0xf225('0x40')](_0xf225('0x42'),LISTID[_0xf225('0x43')]())[_0xf225('0x40')](_0xf225('0x44'))[_0xf225('0x40')](_0xf225('0x45'),squel['select']()[_0xf225('0x3c')]('phone')[_0xf225('0x3f')](_0xf225('0x46'))[_0xf225('0x40')](_0x2b2e6d+_0xf225('0x47'),_0x22c12f['id'][_0xf225('0x43')]())))[_0xf225('0x43')]();return _0x3e2b50;};var _0x390ecd=function(_0x21261f,_0x320290){var _0x33aa78=squel[_0xf225('0x34')]()['into'](_0xf225('0x46'))[_0xf225('0x36')]([_0xf225('0x3d'),_0xf225('0x37'),_0xf225('0x38'),_0xf225('0x48'),_0x320290,_0xf225('0x39'),_0xf225('0x3a')],squel[_0xf225('0x3b')]()[_0xf225('0x3c')](_0xf225('0x3d'),_0xf225('0x3d'))['field'](_0xf225('0x3e'),_0xf225('0x37'))[_0xf225('0x3c')]('id',_0xf225('0x38'))['field'](LISTID[_0xf225('0x43')](),_0xf225('0x48'))['field'](_0x21261f['id']['toString'](),_0x320290)[_0xf225('0x3c')](_0xf225('0x3e'),'createdAt')[_0xf225('0x3c')](_0xf225('0x3e'),_0xf225('0x3a'))['from'](_0xf225('0x49'))[_0xf225('0x40')](_0xf225('0x41'))['where'](_0xf225('0x42'),LISTID[_0xf225('0x43')]())[_0xf225('0x40')](_0xf225('0x4a'),squel['str'](hopperContacts))[_0xf225('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0xf225('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf225('0x3b')]()[_0xf225('0x3c')](_0xf225('0x4b'))[_0xf225('0x3f')](_0xf225('0x4c'))[_0xf225('0x40')](_0x320290+_0xf225('0x47'),_0x21261f['id'][_0xf225('0x43')]()))[_0xf225('0x40')](_0xf225('0x45'),squel[_0xf225('0x3b')]()[_0xf225('0x3c')]('phone')[_0xf225('0x3f')]('cm_hopper')['where'](_0x320290+_0xf225('0x47'),_0x21261f['id']['toString']())))['toString']();return _0x33aa78;};function _0x210746(_0x19fc0e,_0x29ad6b){var _0x144118=squel[_0xf225('0x34')]()['into'](_0xf225('0x46'))[_0xf225('0x36')]([_0xf225('0x3d'),_0xf225('0x37'),_0xf225('0x38'),'ListId',_0x29ad6b,_0xf225('0x39'),_0xf225('0x3a')],squel['select']()[_0xf225('0x3c')]('phone','phone')[_0xf225('0x3c')]('NOW()',_0xf225('0x37'))['field']('id',_0xf225('0x38'))[_0xf225('0x3c')](LISTID[_0xf225('0x43')](),_0xf225('0x48'))['field'](_0x19fc0e['id'][_0xf225('0x43')](),_0x29ad6b)[_0xf225('0x3c')](_0xf225('0x3e'),'createdAt')[_0xf225('0x3c')]('NOW()',_0xf225('0x3a'))['from'](_0xf225('0x49'))['where'](_0xf225('0x41'))[_0xf225('0x40')](_0xf225('0x42'),LISTID[_0xf225('0x43')]())['where']('id\x20IN\x20?',squel[_0xf225('0x4d')](hopperContacts))[_0xf225('0x40')](_0xf225('0x44')))[_0xf225('0x43')]();return _0x144118;}function _0x29093c(_0x5cc89c,_0x13a09a){var _0x250d80=squel[_0xf225('0x34')]()[_0xf225('0x35')]('cm_hopper_black')[_0xf225('0x36')]([_0xf225('0x3d'),_0xf225('0x38'),'ListId',_0x13a09a,_0xf225('0x39'),_0xf225('0x3a')],squel[_0xf225('0x3b')]()['field'](_0xf225('0x3d'),_0xf225('0x3d'))[_0xf225('0x3c')]('id',_0xf225('0x38'))[_0xf225('0x3c')](LISTID[_0xf225('0x43')](),_0xf225('0x48'))[_0xf225('0x3c')](_0x5cc89c['id'][_0xf225('0x43')](),_0x13a09a)[_0xf225('0x3c')](_0xf225('0x3e'),_0xf225('0x39'))[_0xf225('0x3c')]('NOW()',_0xf225('0x3a'))[_0xf225('0x3f')]('cm_contacts')['where'](_0xf225('0x41'))['where'](_0xf225('0x42'),LISTID['toString']())[_0xf225('0x40')](_0xf225('0x4a'),squel[_0xf225('0x4d')](hopperContacts))[_0xf225('0x40')]('phone\x20IS\x20NOT\x20NULL'))[_0xf225('0x43')]();return _0x250d80;}return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id',_0xf225('0x4e')],'include':[{'model':db[_0xf225('0x4f')],'as':_0xf225('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x56069b){var _0xc06692=[];if(_0x56069b){var _0x564d0f;for(var _0x3d66fa=0x0,_0x2ef66a;_0x3d66fa<_0x56069b[_0xf225('0x1c')];_0x3d66fa+=0x1){_0x2ef66a=_0x56069b[_0x3d66fa]['get']({'plain':!![]});switch(_0x2ef66a['dialCheckDuplicateType']){case _0xf225('0x51'):_0xc06692[_0xf225('0x2f')](db['sequelize'][_0xf225('0x52')](_0x390ecd(_0x2ef66a,_0xf225('0x53')))[_0xf225('0x2e')](function(){})['catch'](_0x104183()));break;case _0xf225('0x54'):_0xc06692['push'](db[_0xf225('0x55')]['query'](_0x218d87(_0x2ef66a,'VoiceQueueId'))[_0xf225('0x2e')](function(){})['catch'](_0x104183()));break;default:_0xc06692[_0xf225('0x2f')](db[_0xf225('0x55')][_0xf225('0x52')](_0x210746(_0x2ef66a,_0xf225('0x53')))[_0xf225('0x2e')](function(){})[_0xf225('0x56')](_0x104183()));}}}return _0xc06692;})[_0xf225('0x57')]()[_0xf225('0x2e')](function(){return db[_0xf225('0x58')][_0xf225('0x59')]({'where':{'type':_0xf225('0x5a')},'attributes':['id'],'include':[{'model':db[_0xf225('0x4f')],'as':_0xf225('0x5b'),'where':{'id':LISTID}}]})[_0xf225('0x2e')](function(_0x310c98){var _0x2e5c63=[];if(_0x310c98){var _0x5b0e58;for(var _0xf2e456=0x0,_0x484ad6;_0xf2e456<_0x310c98[_0xf225('0x1c')];_0xf2e456+=0x1){_0x484ad6=_0x310c98[_0xf2e456][_0xf225('0x5c')]({'plain':!![]});_0x2e5c63[_0xf225('0x2f')](db[_0xf225('0x55')][_0xf225('0x52')](_0x29093c(_0x484ad6,'VoiceQueueId'))[_0xf225('0x2e')](function(){})[_0xf225('0x56')](_0x104183()));}}return _0x2e5c63;})[_0xf225('0x57')]();})[_0xf225('0x2e')](function(){return db[_0xf225('0x5d')][_0xf225('0x59')]({'attributes':['id',_0xf225('0x4e')],'include':[{'model':db[_0xf225('0x4f')],'as':_0xf225('0x50'),'where':{'id':LISTID}}]})[_0xf225('0x2e')](function(_0x1a8136){var _0x56c19a=[];if(_0x1a8136){for(var _0x3002f2=0x0,_0x37f1d7;_0x3002f2<_0x1a8136['length'];_0x3002f2+=0x1){_0x37f1d7=_0x1a8136[_0x3002f2][_0xf225('0x5c')]({'plain':!![]});switch(_0x37f1d7['dialCheckDuplicateType']){case _0xf225('0x51'):_0x56c19a[_0xf225('0x2f')](db[_0xf225('0x55')][_0xf225('0x52')](_0x390ecd(_0x37f1d7,_0xf225('0x5e')))['then'](function(){})[_0xf225('0x56')](_0x104183()));break;case _0xf225('0x54'):_0x56c19a['push'](db[_0xf225('0x55')][_0xf225('0x52')](_0x218d87(_0x37f1d7,_0xf225('0x5e')))[_0xf225('0x2e')](function(){})[_0xf225('0x56')](_0x104183()));break;default:_0x56c19a['push'](db[_0xf225('0x55')][_0xf225('0x52')](_0x210746(_0x37f1d7,_0xf225('0x5e')))[_0xf225('0x2e')](function(){})[_0xf225('0x56')](_0x104183()));}}}return _0x56c19a;})[_0xf225('0x57')]();})[_0xf225('0x2e')](function(){return db[_0xf225('0x5d')][_0xf225('0x59')]({'attributes':['id'],'include':[{'model':db[_0xf225('0x4f')],'as':_0xf225('0x5b'),'where':{'id':LISTID}}]})[_0xf225('0x2e')](function(_0x38543c){var _0x37a1d2=[];if(_0x38543c){for(var _0x25c80f=0x0,_0x169144;_0x25c80f<_0x38543c['length'];_0x25c80f+=0x1){_0x169144=_0x38543c[_0x25c80f][_0xf225('0x5c')]({'plain':!![]});_0x37a1d2[_0xf225('0x2f')](db[_0xf225('0x55')][_0xf225('0x52')](_0x29093c(_0x169144,'CampaignId'))[_0xf225('0x2e')](function(){})['catch'](_0x104183()));}}return _0x37a1d2;})[_0xf225('0x57')]();})[_0xf225('0x56')](function(_0x1533e4){logger[_0xf225('0x16')](_0xf225('0x5f'),_0xf225('0x60'),_0x1533e4['message']);});}var processPromises=function(_0x387f14){return BPromise[_0xf225('0x57')](promises)[_0xf225('0x2e')](function(_0x4ced5e){})['catch'](function(_0x3b176e){logger['error']('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x3b176e));})[_0xf225('0x61')](function(){socket[_0xf225('0x62')](_0xf225('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x387f14){return _0x387f14[_0xf225('0x64')]();}});};var endCsv=function(){return BPromise[_0xf225('0x65')]()[_0xf225('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0xf225('0x2e')](function(){socket[_0xf225('0x62')](_0xf225('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xf225('0x66')](FILEPATH);}catch(_0x33ed2d){logger[_0xf225('0x16')](_0xf225('0x67'),JSON[_0xf225('0x31')](_0x33ed2d));}finally{process[_0xf225('0x68')](0x0);}});};process['on']('SIGINT',function(){logger[_0xf225('0x69')](_0xf225('0x6a'));endCsv();});function main(){return BPromise[_0xf225('0x65')]()[_0xf225('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xf225('0x14')](',');return db[_0xf225('0x2b')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xf225('0x2e')](function(_0x3b38cd){var _0x322b23=fs[_0xf225('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x322b23,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e8412,_0x24f1fe){total+=0x1;var _0x16b193=total;promises[_0xf225('0x2f')](checkRow(_0x1e8412,_0x3b38cd,_0x16b193)[_0xf225('0x2e')](function(){success+=0x1;})[_0xf225('0x56')](function(_0x3325ca){if(_0x3325ca[_0xf225('0x16')]){errors+=0x1;delete _0x3325ca[_0xf225('0x16')];}else if(_0x3325ca['duplicate']){duplicates+=0x1;delete _0x3325ca[_0xf225('0x2a')];}rows[_0xf225('0x2f')](_0x3325ca);}));if(total%0xc8===0x0){_0x24f1fe['pause']();return processPromises(_0x24f1fe);}},'complete':function(){return processPromises()['then'](function(){logger[_0xf225('0x69')](_0xf225('0x6c'));endCsv();});},'error':function(_0x5a2ceb,_0xdc89ba){logger['info'](_0xf225('0x6d'),JSON[_0xf225('0x31')](_0x5a2ceb));endCsv();}});})[_0xf225('0x56')](function(_0x195e70){logger[_0xf225('0x16')](_0xf225('0x6e'),JSON[_0xf225('0x31')](_0x195e70));});}main();
\ No newline at end of file
+var _0xc208=['Error\x20while\x20creating\x20contact:\x20','checkHopper','insert','into','cm_hopper','ContactId','ListId','createdAt','updatedAt','select','field','toString','NOW()','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','fromQuery','scheduledAt','cm_contacts','id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CmList','get','CampaignId','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','CompanyId','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','catch'];(function(_0x341a33,_0x2588d1){var _0x2b5f26=function(_0x160ca5){while(--_0x160ca5){_0x341a33['push'](_0x341a33['shift']());}};_0x2b5f26(++_0x2588d1);}(_0xc208,0x116));var _0x8c20=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc208[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x8c20('0x0'));var util=require(_0x8c20('0x1'));var _=require(_0x8c20('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x8c20('0x3'));var Redis=require(_0x8c20('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x8c20('0x5'));var logger=require(_0x8c20('0x6'))(_0x8c20('0x7'));config['redis']=_['defaults'](config[_0x8c20('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x8c20('0x9'))(new Redis(config['redis']));require(_0x8c20('0xa'))[_0x8c20('0xb')](socket);try{if(!process[_0x8c20('0xc')][0x2]||process[_0x8c20('0xc')][0x2]===_0x8c20('0xd')||process[_0x8c20('0xc')][0x2]===_0x8c20('0xe')){throw new Error(_0x8c20('0xf'));}var FILEPATH=process[_0x8c20('0xc')][0x2];if(!process[_0x8c20('0xc')][0x3]||process[_0x8c20('0xc')][0x3]===_0x8c20('0xd')||process[_0x8c20('0xc')][0x3]==='null'||!process[_0x8c20('0xc')][0x4]||process[_0x8c20('0xc')][0x4]===_0x8c20('0xd')||process[_0x8c20('0xc')][0x4]===_0x8c20('0xe')){throw new Error(_0x8c20('0x10'));}var FIELDS=_[_0x8c20('0x11')](process[_0x8c20('0xc')][0x3][_0x8c20('0x12')](','),process['argv'][0x4][_0x8c20('0x12')](','));if(!process[_0x8c20('0xc')][0x5]||process[_0x8c20('0xc')][0x5]==='undefined'||process[_0x8c20('0xc')][0x5]===_0x8c20('0xe')){throw new Error(_0x8c20('0x13'));}var LISTID=process[_0x8c20('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x8c20('0xc')][0x6]!==_0x8c20('0xd')&&process[_0x8c20('0xc')][0x6]!==_0x8c20('0xe')?process[_0x8c20('0xc')][0x6]:null;var DUPLICATES=process[_0x8c20('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x8c20('0xc')][0x7]!==_0x8c20('0xe')?process[_0x8c20('0xc')][0x7]:null;if(!process[_0x8c20('0xc')][0x8]||process['argv'][0x8]===_0x8c20('0xd')||process[_0x8c20('0xc')][0x8]==='null'){throw new Error(_0x8c20('0x14'));}var SOCKET_TIMESTAMP=process[_0x8c20('0xc')][0x8];}catch(_0x439d2f){logger[_0x8c20('0x15')](_0x439d2f);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x405648,_0x5d54f1,_0x504d4e,_0x3efc80){var _0xac0317={'message':_0x5d54f1};_0xac0317[_0x405648]=!![];if(_0x504d4e){_0xac0317['contact']=_0x504d4e;}if(_0x3efc80){_0xac0317[_0x8c20('0x16')]=_0x3efc80;}return _0xac0317;}function isEmail(_0x402a38){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x8c20('0x17')](_0x402a38);}function checkRow(_0x4b5269,_0x20d949,_0x26373f){return new BPromise(function(_0x4d5299,_0x10b02a){if(_['isNil'](_0x4b5269)){return _0x10b02a(handleCheckRowError(_0x8c20('0x15'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x26373f));}if(_0x4b5269[_0x8c20('0x18')]&&_0x4b5269['errors'][_0x8c20('0x19')]){var _0x59091f=_[_0x8c20('0x1a')](_0x4b5269[_0x8c20('0x18')],_0x8c20('0x1b'))[_0x8c20('0x1c')](';');return _0x10b02a(handleCheckRowError('error',_0x59091f,null,_0x26373f));}var _0x30529c={};for(var _0x1c6c06 in FIELDS){if(FIELDS[_0x8c20('0x1d')](_0x1c6c06)&&FIELDS[_0x1c6c06]){_0x30529c[_0x1c6c06]=_0x4b5269[_0x8c20('0x1e')][0x0][FIELDS[_0x1c6c06]]||_0x4b5269['data'][0x0]['\ufeff'+FIELDS[_0x1c6c06]];}}if(!_0x30529c['firstName']){return _0x10b02a(handleCheckRowError(_0x8c20('0x15'),_0x8c20('0x1f'),null,_0x26373f));}if(!_0x30529c[_0x8c20('0x20')]){return _0x10b02a(handleCheckRowError(_0x8c20('0x15'),_0x8c20('0x21'),null,_0x26373f));}if(_0x30529c[_0x8c20('0x22')]){var _0x491c96=moment(_0x30529c['birthDate'],_0x8c20('0x23'));if(!_0x491c96[_0x8c20('0x24')]()){return _0x10b02a(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x26373f));}}if(_0x30529c[_0x8c20('0x25')]){if(!isEmail(_0x30529c[_0x8c20('0x25')])){return _0x10b02a(handleCheckRowError(_0x8c20('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x26373f));}}_0x30529c['ListId']=LISTID;_0x30529c[_0x8c20('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x20d949){var _0x953a09={};for(var _0x1b04f4=0x0,_0x40243b=DUPLICATES[_0x8c20('0x19')];_0x1b04f4<_0x40243b;_0x1b04f4+=0x1){_0x953a09[DUPLICATES[_0x1b04f4]]=_0x30529c[DUPLICATES[_0x1b04f4]];}var _0x265083=_['find'](_0x20d949,_0x953a09);if(_0x265083){return _0x10b02a(handleCheckRowError(_0x8c20('0x27'),_0x8c20('0x28'),_0x265083,_0x26373f));}}return db[_0x8c20('0x29')]['create'](_0x30529c,{'raw':!![],'hooks':![],'fields':_[_0x8c20('0x2a')](_0x30529c)})[_0x8c20('0x2b')](function(_0x541d79){if(DUPLICATES&&DUPLICATES[_0x8c20('0x19')]&&_0x20d949){_0x20d949[_0x8c20('0x2c')](_['pick'](_0x30529c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x541d79['id'];return _0x4d5299();})[_0x8c20('0x2d')](function(_0x56dbbe){return _0x10b02a(handleCheckRowError(_0x8c20('0x15'),_0x8c20('0x2e')+(_0x56dbbe[_0x8c20('0x1b')]||JSON['stringify'](_0x56dbbe)),null,_0x26373f));});});}function checkHopper(){function _0x18f3be(){return function(_0x2ee2a6){logger[_0x8c20('0x15')]('cmContact',_0x8c20('0x2f'),util['inspect'](_0x2ee2a6,{'showHidden':![],'depth':null}));};}var _0xd07ae4=function(_0x42444b,_0x168aaf){var _0x44d225=squel[_0x8c20('0x30')]()[_0x8c20('0x31')](_0x8c20('0x32'))['fromQuery'](['phone','scheduledAt',_0x8c20('0x33'),_0x8c20('0x34'),_0x168aaf,_0x8c20('0x35'),_0x8c20('0x36')],squel[_0x8c20('0x37')]()[_0x8c20('0x38')](_0x8c20('0x20'),_0x8c20('0x20'))[_0x8c20('0x38')]('NOW()','scheduledAt')[_0x8c20('0x38')]('id',_0x8c20('0x33'))[_0x8c20('0x38')](LISTID[_0x8c20('0x39')](),'ListId')[_0x8c20('0x38')](_0x42444b['id'][_0x8c20('0x39')](),_0x168aaf)['field'](_0x8c20('0x3a'),_0x8c20('0x35'))[_0x8c20('0x38')](_0x8c20('0x3a'),_0x8c20('0x36'))[_0x8c20('0x3b')]('cm_contacts')[_0x8c20('0x3c')](_0x8c20('0x3d'))[_0x8c20('0x3c')](_0x8c20('0x3e'),LISTID[_0x8c20('0x39')]())['where'](_0x8c20('0x3f'))[_0x8c20('0x3c')](_0x8c20('0x40'),squel[_0x8c20('0x37')]()[_0x8c20('0x38')](_0x8c20('0x20'))[_0x8c20('0x3b')](_0x8c20('0x32'))[_0x8c20('0x3c')](_0x168aaf+'\x20=\x20?',_0x42444b['id'][_0x8c20('0x39')]())))[_0x8c20('0x39')]();return _0x44d225;};var _0x142e86=function(_0x4274b9,_0x541661){var _0x574215=squel[_0x8c20('0x30')]()[_0x8c20('0x31')]('cm_hopper')[_0x8c20('0x41')]([_0x8c20('0x20'),'scheduledAt',_0x8c20('0x33'),_0x8c20('0x34'),_0x541661,_0x8c20('0x35'),_0x8c20('0x36')],squel[_0x8c20('0x37')]()[_0x8c20('0x38')]('phone',_0x8c20('0x20'))[_0x8c20('0x38')](_0x8c20('0x3a'),_0x8c20('0x42'))[_0x8c20('0x38')]('id',_0x8c20('0x33'))[_0x8c20('0x38')](LISTID[_0x8c20('0x39')](),_0x8c20('0x34'))[_0x8c20('0x38')](_0x4274b9['id'][_0x8c20('0x39')](),_0x541661)[_0x8c20('0x38')](_0x8c20('0x3a'),_0x8c20('0x35'))[_0x8c20('0x38')](_0x8c20('0x3a'),_0x8c20('0x36'))[_0x8c20('0x3b')](_0x8c20('0x43'))[_0x8c20('0x3c')](_0x8c20('0x3d'))['where'](_0x8c20('0x3e'),LISTID[_0x8c20('0x39')]())[_0x8c20('0x3c')](_0x8c20('0x44'),squel[_0x8c20('0x45')](hopperContacts))[_0x8c20('0x3c')](_0x8c20('0x3f'))[_0x8c20('0x3c')](_0x8c20('0x40'),squel[_0x8c20('0x37')]()[_0x8c20('0x38')](_0x8c20('0x46'))['from'](_0x8c20('0x47'))[_0x8c20('0x3c')](_0x541661+_0x8c20('0x48'),_0x4274b9['id'][_0x8c20('0x39')]()))[_0x8c20('0x3c')](_0x8c20('0x40'),squel[_0x8c20('0x37')]()['field'](_0x8c20('0x20'))[_0x8c20('0x3b')](_0x8c20('0x32'))[_0x8c20('0x3c')](_0x541661+'\x20=\x20?',_0x4274b9['id'][_0x8c20('0x39')]())))['toString']();return _0x574215;};function _0x1335b9(_0x128f10,_0x2fec7c){var _0x81fe62=squel['insert']()[_0x8c20('0x31')]('cm_hopper')[_0x8c20('0x41')](['phone',_0x8c20('0x42'),_0x8c20('0x33'),_0x8c20('0x34'),_0x2fec7c,'createdAt',_0x8c20('0x36')],squel[_0x8c20('0x37')]()['field'](_0x8c20('0x20'),'phone')[_0x8c20('0x38')]('NOW()',_0x8c20('0x42'))['field']('id',_0x8c20('0x33'))['field'](LISTID[_0x8c20('0x39')](),_0x8c20('0x34'))[_0x8c20('0x38')](_0x128f10['id'][_0x8c20('0x39')](),_0x2fec7c)[_0x8c20('0x38')](_0x8c20('0x3a'),_0x8c20('0x35'))['field'](_0x8c20('0x3a'),_0x8c20('0x36'))[_0x8c20('0x3b')](_0x8c20('0x43'))[_0x8c20('0x3c')](_0x8c20('0x3d'))['where'](_0x8c20('0x3e'),LISTID[_0x8c20('0x39')]())[_0x8c20('0x3c')](_0x8c20('0x44'),squel[_0x8c20('0x45')](hopperContacts))['where'](_0x8c20('0x3f')))['toString']();return _0x81fe62;}function _0x2b0d56(_0x54c283,_0x5f4460){var _0xf78aae=squel[_0x8c20('0x30')]()[_0x8c20('0x31')](_0x8c20('0x49'))['fromQuery']([_0x8c20('0x20'),_0x8c20('0x33'),_0x8c20('0x34'),_0x5f4460,_0x8c20('0x35'),'updatedAt'],squel[_0x8c20('0x37')]()['field']('phone','phone')[_0x8c20('0x38')]('id','ContactId')[_0x8c20('0x38')](LISTID['toString'](),'ListId')[_0x8c20('0x38')](_0x54c283['id'][_0x8c20('0x39')](),_0x5f4460)[_0x8c20('0x38')]('NOW()','createdAt')[_0x8c20('0x38')](_0x8c20('0x3a'),_0x8c20('0x36'))[_0x8c20('0x3b')](_0x8c20('0x43'))[_0x8c20('0x3c')](_0x8c20('0x3d'))['where'](_0x8c20('0x3e'),LISTID['toString']())[_0x8c20('0x3c')]('id\x20IN\x20?',squel[_0x8c20('0x45')](hopperContacts))[_0x8c20('0x3c')](_0x8c20('0x3f')))['toString']();return _0xf78aae;}return db[_0x8c20('0x4a')][_0x8c20('0x4b')]({'where':{'type':_0x8c20('0x4c')},'attributes':['id',_0x8c20('0x4d')],'include':[{'model':db['CmList'],'as':_0x8c20('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x25175a){var _0x348399=[];if(_0x25175a){var _0x1c044d;for(var _0x3dee75=0x0,_0x857e6c;_0x3dee75<_0x25175a[_0x8c20('0x19')];_0x3dee75+=0x1){_0x857e6c=_0x25175a[_0x3dee75]['get']({'plain':!![]});switch(_0x857e6c[_0x8c20('0x4d')]){case _0x8c20('0x4f'):_0x348399['push'](db['sequelize'][_0x8c20('0x50')](_0x142e86(_0x857e6c,_0x8c20('0x51')))[_0x8c20('0x2b')](function(){})['catch'](_0x18f3be()));break;case _0x8c20('0x52'):_0x348399['push'](db[_0x8c20('0x53')]['query'](_0xd07ae4(_0x857e6c,_0x8c20('0x51')))[_0x8c20('0x2b')](function(){})['catch'](_0x18f3be()));break;default:_0x348399[_0x8c20('0x2c')](db['sequelize'][_0x8c20('0x50')](_0x1335b9(_0x857e6c,_0x8c20('0x51')))[_0x8c20('0x2b')](function(){})[_0x8c20('0x2d')](_0x18f3be()));}}}return _0x348399;})[_0x8c20('0x54')]()[_0x8c20('0x2b')](function(){return db[_0x8c20('0x4a')][_0x8c20('0x4b')]({'where':{'type':_0x8c20('0x4c')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x8c20('0x55'),'where':{'id':LISTID}}]})[_0x8c20('0x2b')](function(_0x2347d2){var _0x42bad9=[];if(_0x2347d2){var _0x76cd5e;for(var _0xe3743f=0x0,_0x134c94;_0xe3743f<_0x2347d2['length'];_0xe3743f+=0x1){_0x134c94=_0x2347d2[_0xe3743f]['get']({'plain':!![]});_0x42bad9[_0x8c20('0x2c')](db[_0x8c20('0x53')]['query'](_0x2b0d56(_0x134c94,_0x8c20('0x51')))[_0x8c20('0x2b')](function(){})[_0x8c20('0x2d')](_0x18f3be()));}}return _0x42bad9;})['all']();})[_0x8c20('0x2b')](function(){return db[_0x8c20('0x56')]['findAll']({'attributes':['id',_0x8c20('0x4d')],'include':[{'model':db[_0x8c20('0x57')],'as':_0x8c20('0x4e'),'where':{'id':LISTID}}]})[_0x8c20('0x2b')](function(_0x56e7d0){var _0x30cedd=[];if(_0x56e7d0){for(var _0x2f6eac=0x0,_0x3d529f;_0x2f6eac<_0x56e7d0['length'];_0x2f6eac+=0x1){_0x3d529f=_0x56e7d0[_0x2f6eac][_0x8c20('0x58')]({'plain':!![]});switch(_0x3d529f[_0x8c20('0x4d')]){case _0x8c20('0x4f'):_0x30cedd[_0x8c20('0x2c')](db[_0x8c20('0x53')][_0x8c20('0x50')](_0x142e86(_0x3d529f,_0x8c20('0x59')))[_0x8c20('0x2b')](function(){})[_0x8c20('0x2d')](_0x18f3be()));break;case'onlyIfOpen':_0x30cedd['push'](db['sequelize'][_0x8c20('0x50')](_0xd07ae4(_0x3d529f,_0x8c20('0x59')))[_0x8c20('0x2b')](function(){})[_0x8c20('0x2d')](_0x18f3be()));break;default:_0x30cedd[_0x8c20('0x2c')](db['sequelize'][_0x8c20('0x50')](_0x1335b9(_0x3d529f,'CampaignId'))['then'](function(){})[_0x8c20('0x2d')](_0x18f3be()));}}}return _0x30cedd;})[_0x8c20('0x54')]();})['then'](function(){return db['Campaign'][_0x8c20('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x8c20('0x57')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x8c20('0x2b')](function(_0x5c5fb8){var _0x57b040=[];if(_0x5c5fb8){for(var _0x4d66ad=0x0,_0x3c10d5;_0x4d66ad<_0x5c5fb8['length'];_0x4d66ad+=0x1){_0x3c10d5=_0x5c5fb8[_0x4d66ad][_0x8c20('0x58')]({'plain':!![]});_0x57b040[_0x8c20('0x2c')](db[_0x8c20('0x53')]['query'](_0x2b0d56(_0x3c10d5,'CampaignId'))[_0x8c20('0x2b')](function(){})[_0x8c20('0x2d')](_0x18f3be()));}}return _0x57b040;})[_0x8c20('0x54')]();})['catch'](function(_0x157432){logger[_0x8c20('0x15')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x157432[_0x8c20('0x1b')]);});}var processPromises=function(_0x3e71c1){return BPromise[_0x8c20('0x54')](promises)[_0x8c20('0x2b')](function(_0x45430c){})[_0x8c20('0x2d')](function(_0x21ade5){logger[_0x8c20('0x15')](_0x8c20('0x5a'),JSON[_0x8c20('0x5b')](_0x21ade5));})[_0x8c20('0x5c')](function(){socket[_0x8c20('0x5d')](_0x8c20('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3e71c1){return _0x3e71c1[_0x8c20('0x5f')]();}});};var endCsv=function(){return BPromise[_0x8c20('0x60')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x8c20('0x2b')](function(){socket[_0x8c20('0x5d')](_0x8c20('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x3d4f89){logger[_0x8c20('0x15')](_0x8c20('0x61'),JSON[_0x8c20('0x5b')](_0x3d4f89));}finally{process[_0x8c20('0x62')](0x0);}});};process['on'](_0x8c20('0x63'),function(){logger['info'](_0x8c20('0x64'));endCsv();});function main(){return BPromise[_0x8c20('0x60')]()[_0x8c20('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x8c20('0x29')][_0x8c20('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x10e587){var _0x2596a6=fs[_0x8c20('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x8c20('0x66')](_0x2596a6,{'header':!![],'skipEmptyLines':!![],'step':function(_0x54c9fd,_0x3348cf){total+=0x1;var _0x51e3bb=total;promises['push'](checkRow(_0x54c9fd,_0x10e587,_0x51e3bb)[_0x8c20('0x2b')](function(){success+=0x1;})[_0x8c20('0x2d')](function(_0x56b4b3){if(_0x56b4b3[_0x8c20('0x15')]){errors+=0x1;delete _0x56b4b3['error'];}else if(_0x56b4b3['duplicate']){duplicates+=0x1;delete _0x56b4b3[_0x8c20('0x27')];}rows['push'](_0x56b4b3);}));if(total%0xc8===0x0){_0x3348cf[_0x8c20('0x67')]();return processPromises(_0x3348cf);}},'complete':function(){return processPromises()[_0x8c20('0x2b')](function(){logger['info'](_0x8c20('0x68'));endCsv();});},'error':function(_0x54bb85,_0x451b){logger[_0x8c20('0x69')](_0x8c20('0x6a'),JSON['stringify'](_0x54bb85));endCsv();}});})['catch'](function(_0x11aa53){logger['error'](_0x8c20('0x6b'),JSON[_0x8c20('0x5b')](_0x11aa53));});}main();
\ No newline at end of file
index 0254909..e20efca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x35b5=['CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactTypeId','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','root','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','phone','join','where','\x20=\x20','then','push','all','AdditionalPhones','length','split','isNil','filter','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','from','cm_contacts','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.ListId','cm_hopper_black','cm_contacts.ListId\x20=\x20','field','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','UserId','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','sequelize','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','set','offset','query','main','stringify','clone','socket_timestamp','server/files/tmp','.csv','includes','header','ContactItemType','findAll','name','_description','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','utcOffset','firstName','\x20not\x20specified','itemTypeId','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_'];(function(_0x21a173,_0x1f6b9a){var _0x244d96=function(_0x2aea9f){while(--_0x2aea9f){_0x21a173['push'](_0x21a173['shift']());}};_0x244d96(++_0x1f6b9a);}(_0x35b5,0xd4));var _0x535b=function(_0x26257c,_0x3da628){_0x26257c=_0x26257c-0x0;var _0x4d045a=_0x35b5[_0x26257c];return _0x4d045a;};'use strict';var fs=require('fs');var path=require(_0x535b('0x0'));var _=require(_0x535b('0x1'));var Papa=require(_0x535b('0x2'));var util=require(_0x535b('0x3'));var BPromise=require(_0x535b('0x4'));var moment=require(_0x535b('0x5'));var squel=require(_0x535b('0x6'));var Redis=require(_0x535b('0x7'));var db=require(_0x535b('0x8'))['db'];var config=require(_0x535b('0x9'));var shared=require(_0x535b('0xa'));var logger=require(_0x535b('0xb'))(_0x535b('0xc'));config[_0x535b('0xd')]=_['defaults'](config[_0x535b('0xd')],{'host':_0x535b('0xe'),'port':0x18eb});var socket=require(_0x535b('0xf'))(new Redis(config[_0x535b('0xd')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x535b('0x10')](_0x535b('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x535b('0x11'));function isEmail(_0x5b8cbc){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x5b8cbc);}function selectNotIn(_0x5650,_0x17fe52,_0x218d51,_0x413848,_0x1fb190){return squel[_0x535b('0x12')]()['field'](_0x535b('0x13'))['from'](_0x413848)[_0x535b('0x14')](_0x17fe52,null,_0x17fe52+'.id\x20=\x20'+_0x413848+'.'+_0x218d51)[_0x535b('0x15')](_0x413848+'.'+_0x218d51+_0x535b('0x16')+_0x5650+'.'+_0x218d51)['where'](_0x17fe52+'.dialCheckDuplicateType\x20IN\x20('+_0x1fb190[_0x535b('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xa500c9,_0x2839b0){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x535b('0x17')](function(_0x3513ea){if(_0x3513ea!==null){var _0x11fda7=[];for(var _0xafb10=0x0;_0xafb10<_0x3513ea['length'];_0xafb10++){var _0x2f11ff=_0x3513ea[_0xafb10];_0x11fda7[_0x535b('0x18')](insertAdditionalPhones(_0x2f11ff));}}Promise[_0x535b('0x19')](_0x11fda7)[_0x535b('0x17')](function(){_0xa500c9({'val':0x1});});});});}function insertAdditionalPhones(_0x40ffe1){return new Promise(function(_0x44b14d,_0xf5b611){var _0x592c8c=_0x40ffe1[_0x535b('0x1a')];var _0x921a4a=_0x592c8c['split'](';');var _0x5b3916=[];orderBy=0x0;for(var _0x1039c0=0x0;_0x1039c0<_0x921a4a[_0x535b('0x1b')];_0x1039c0++){_0x5b3916['push'](splitAdditionalPhone(_0x40ffe1['id'],_0x921a4a[_0x1039c0]));}Promise[_0x535b('0x19')](_0x5b3916)[_0x535b('0x17')](function(){_0x44b14d({'val':_0x921a4a[_0x535b('0x1b')]});});});}function splitAdditionalPhone(_0x10d5ca,_0x4cd196){return new Promise(function(_0x40c054,_0x306723){var _0xa9d982=_0x4cd196[_0x535b('0x1c')](':');var _0x1f006c=_0xa9d982[0x0];var _0x1294ee=_0xa9d982[0x1];if(!_[_0x535b('0x1d')](_0x1294ee)){var _0x2e7e39=_0x1294ee[_0x535b('0x1c')]('|');var _0x3db441=[];for(var _0x1782d9=0x0;_0x1782d9<_0x2e7e39[_0x535b('0x1b')];_0x1782d9++){if(_0x2e7e39[_0x1782d9]!==''){var _0x2be8c1=_[_0x535b('0x1e')](promisesAdditionalPhones,{'contactId':_0x10d5ca,'phone':_0x2e7e39[_0x1782d9]});if(_0x2be8c1[_0x535b('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x535b('0x18')]({'contactId':_0x10d5ca,'contactTypeId':_0x1f006c,'phone':_0x2e7e39[_0x1782d9],'orderBy':orderBy});}}}_0x40c054({'ok':0x1});}else _0x40c054({'res':0x0});});}function createAdditionalPhone(_0x36d7f8,_0x1e9d5e,_0x11af02,_0x4dee47){var _0x2fda41='';var _0x2d1001='';var _0x3c2f43=_0x11af02['split']('§');_0x2fda41=_0x3c2f43[0x0];if(_0x3c2f43['length']==0x2)_0x2d1001=_0x3c2f43[0x1];return new Promise(function(_0x136e09,_0x424ea2){return db[_0x535b('0x1f')]['findOne']({'where':{'CmContactId':_0x36d7f8,'item':_0x2fda41}})[_0x535b('0x17')](function(_0x3d2503){if(_0x3d2503){return db[_0x535b('0x1f')][_0x535b('0x20')]({'ItemTypeId':_0x1e9d5e,'description':_0x2d1001,'OrderBy':_0x4dee47},{'where':{'CmContactId':_0x36d7f8,'item':_0x2fda41}})[_0x535b('0x17')](function(_0x470872){_0x136e09({'res':_0x535b('0x21')});});}else{return db[_0x535b('0x1f')][_0x535b('0x22')]({'CmContactId':_0x36d7f8,'item':_0x2fda41,'description':_0x2d1001,'ItemTypeId':_0x1e9d5e,'OrderBy':_0x4dee47,'ItemClass':_0x535b('0x23')})['then'](function(_0x236d16){_0x136e09({'res':_0x535b('0x24')});});}});});}function insertCmHopper(_0x5496d8,_0x1ba706,_0x1e2c09,_0x598cf4,_0x451823){var _0x5acd6b=['cm_contacts.phone',_0x535b('0x25'),_0x535b('0x26'),'cm_contacts.ListId',_0x1ba706+'.'+_0x598cf4,_0x535b('0x27'),_0x535b('0x28'),_0x535b('0x29'),_0x535b('0x2a'),'\x22'+_0x451823+'\x22'];return squel[_0x535b('0x2b')]()[_0x535b('0x2c')](_0x535b('0x2d'))[_0x535b('0x2e')](['phone',_0x535b('0x2f'),_0x535b('0x30'),_0x535b('0x31'),_0x598cf4,_0x535b('0x32'),_0x535b('0x33'),_0x535b('0x34'),'UserId',_0x535b('0x35')],squel[_0x535b('0x12')]()[_0x535b('0x36')](_0x5acd6b)[_0x535b('0x37')](_0x1ba706)['join'](_0x535b('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x1ba706+_0x535b('0x39'))[_0x535b('0x14')](_0x1e2c09,null,_0x1e2c09+_0x535b('0x3a')+_0x1ba706+'.'+_0x598cf4)[_0x535b('0x15')](_0x1ba706+_0x535b('0x3b'),_0x5496d8)[_0x535b('0x15')](_0x535b('0x3c'),NOW)['where'](_0x535b('0x3d'),selectNotIn(_0x1ba706,_0x1e2c09,_0x598cf4,_0x535b('0x2d'),[_0x535b('0x3e'),_0x535b('0x3f')]))[_0x535b('0x15')](_0x535b('0x3d'),selectNotIn(_0x1ba706,_0x1e2c09,_0x598cf4,'cm_hopper',[_0x535b('0x3e')])))[_0x535b('0x40')]();}function insertCmHopperBlack(_0x1fbe9e,_0x35a685,_0x45cf4b,_0x5c42c1){var _0xbb1c8a=[_0x535b('0x41'),_0x535b('0x26'),_0x535b('0x42'),_0x35a685+'.'+_0x5c42c1,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x535b('0x2b')]()[_0x535b('0x2c')](_0x535b('0x43'))[_0x535b('0x2e')]([_0x535b('0x13'),_0x535b('0x30'),_0x535b('0x31'),_0x5c42c1,_0x535b('0x32'),_0x535b('0x33')],squel[_0x535b('0x12')]()[_0x535b('0x36')](_0xbb1c8a)[_0x535b('0x37')](_0x35a685)[_0x535b('0x14')]('cm_contacts',null,_0x535b('0x44')+_0x35a685+_0x535b('0x39'))[_0x535b('0x14')](_0x45cf4b,null,_0x45cf4b+_0x535b('0x3a')+_0x35a685+'.'+_0x5c42c1)[_0x535b('0x15')](_0x35a685+_0x535b('0x3b'),_0x1fbe9e)[_0x535b('0x15')](_0x535b('0x3c'),NOW)[_0x535b('0x15')](_0x535b('0x3d'),squel['select']()[_0x535b('0x45')](_0x535b('0x13'))[_0x535b('0x37')](_0x535b('0x43'))['where'](_0x535b('0x46'),_0x1fbe9e)[_0x535b('0x15')](_0x5c42c1+_0x535b('0x16')+_0x35a685+'.'+_0x5c42c1)))[_0x535b('0x40')]();}function insertTzCmHopper(_0x43dc11,_0x5ee80b,_0x2a3af6,_0x1abe69,_0x18292a,_0x2eb795){var _0x73eb2d=[_0x535b('0x41'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x2eb795+_0x535b('0x47'),_0x535b('0x26'),_0x535b('0x42'),_0x5ee80b+'.'+_0x1abe69,_0x535b('0x27'),_0x535b('0x28'),_0x535b('0x29'),_0x535b('0x2a'),'\x22'+_0x18292a+'\x22'];var _0x2682ad=squel[_0x535b('0x2b')]()[_0x535b('0x2c')]('cm_hopper')[_0x535b('0x2e')]([_0x535b('0x13'),_0x535b('0x2f'),_0x535b('0x30'),_0x535b('0x31'),_0x1abe69,'createdAt',_0x535b('0x33'),_0x535b('0x34'),_0x535b('0x48'),_0x535b('0x35')],squel['select']()[_0x535b('0x36')](_0x73eb2d)[_0x535b('0x37')](_0x5ee80b)[_0x535b('0x14')](_0x535b('0x38'),null,_0x535b('0x44')+_0x5ee80b+_0x535b('0x39'))[_0x535b('0x14')](_0x2a3af6,null,_0x2a3af6+_0x535b('0x3a')+_0x5ee80b+'.'+_0x1abe69)[_0x535b('0x14')](_0x2eb795,null,_0x2eb795+_0x535b('0x3a')+_0x5ee80b+'.'+_0x1abe69)[_0x535b('0x15')](_0x5ee80b+_0x535b('0x3b'),_0x43dc11)[_0x535b('0x15')](_0x535b('0x3c'),NOW)[_0x535b('0x15')](_0x535b('0x3d'),selectNotIn(_0x5ee80b,_0x2a3af6,_0x1abe69,'cm_hopper',['\x22always\x22',_0x535b('0x3f')]))[_0x535b('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5ee80b,_0x2a3af6,_0x1abe69,_0x535b('0x2d'),['\x22always\x22'])))[_0x535b('0x40')]();return _0x2682ad;}function insertTzCmHopperBlack(_0x13820a,_0x4ee52d,_0x25aeac,_0xe6fe0){var _0x2779d4=['cm_contacts.phone',_0x535b('0x26'),_0x535b('0x42'),_0x4ee52d+'.'+_0xe6fe0,_0x535b('0x27'),_0x535b('0x28')];return squel[_0x535b('0x2b')]()[_0x535b('0x2c')](_0x535b('0x43'))['fromQuery'](['phone',_0x535b('0x30'),_0x535b('0x31'),_0xe6fe0,_0x535b('0x32'),_0x535b('0x33')],squel[_0x535b('0x12')]()[_0x535b('0x36')](_0x2779d4)[_0x535b('0x37')](_0x4ee52d)[_0x535b('0x14')](_0x535b('0x38'),null,_0x535b('0x44')+_0x4ee52d+'.CmListId')['join'](_0x25aeac,null,_0x25aeac+'.id\x20=\x20'+_0x4ee52d+'.'+_0xe6fe0)[_0x535b('0x15')](_0x4ee52d+'.CmListId\x20=\x20?',_0x13820a)[_0x535b('0x15')](_0x535b('0x3c'),NOW)[_0x535b('0x15')](_0x535b('0x3d'),squel['select']()[_0x535b('0x45')]('phone')['from'](_0x535b('0x43'))[_0x535b('0x15')](_0x535b('0x46'),_0x13820a)['where'](_0xe6fe0+'\x20=\x20'+_0x4ee52d+'.'+_0xe6fe0)))[_0x535b('0x40')]();}function insertCmHopperAdditionalPhones(_0x2ac9b8){var _0x3a1b48=[_0x535b('0x49'),_0x535b('0x4a'),_0x535b('0x4b'),_0x535b('0x4c'),_0x535b('0x4d')];return squel[_0x535b('0x2b')]()[_0x535b('0x2c')](_0x535b('0x4e'))[_0x535b('0x2e')]([_0x535b('0x4f'),_0x535b('0x13'),'OrderBy',_0x535b('0x32'),'updatedAt'],squel[_0x535b('0x12')]()[_0x535b('0x36')](_0x3a1b48)[_0x535b('0x37')]('cm_hopper')[_0x535b('0x14')](_0x535b('0x38'),null,_0x535b('0x50'))['join'](_0x535b('0x51'),null,_0x535b('0x52'))[_0x535b('0x15')](_0x535b('0x53'),_0x2ac9b8)['where'](_0x535b('0x3c'),NOW))['toString']();}function insertCmContact(_0x3058d4,_0x1612aa,_0x53a941,_0x16c8fc){var _0x3ca653=_['concat'](_[_0x535b('0x54')](_0x16c8fc),[_0x535b('0x31'),_0x535b('0x55'),_0x535b('0x32'),_0x535b('0x33')]);return squel[_0x535b('0x2b')]()['into']('cm_contacts')[_0x535b('0x2e')](_0x3ca653,squel[_0x535b('0x12')]()[_0x535b('0x36')](_0x3ca653)[_0x535b('0x37')](_0x1612aa)['where']('('+_0x53a941[_0x535b('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0x535b('0x12')]()[_0x535b('0x36')](_0x53a941)[_0x535b('0x37')](_0x535b('0x38'))[_0x535b('0x15')](_0x535b('0x46'),_0x3058d4)[_0x535b('0x15')](_0x535b('0x56')))[_0x535b('0x15')](_0x535b('0x57'),squel[_0x535b('0x12')]()[_0x535b('0x45')]('MIN(id)',_0x535b('0x58'))['from'](_0x1612aa)[_0x535b('0x59')](_0x53a941[_0x535b('0x14')](','))))[_0x535b('0x40')]();}function handleStop(){logger[_0x535b('0x5a')](_0x535b('0x5b'));stopped=!![];}function handleUncaughtException(_0x20fccf){logger[_0x535b('0x5c')](_0x20fccf[_0x535b('0x5d')]);process[_0x535b('0x5e')](0x1);}function handleError(_0x30fe7c,_0x39d4e1){stats[_0x535b('0x5f')][_0x535b('0x18')]({'name':_0x39d4e1[_0x535b('0x60')],'message':_0x39d4e1[_0x535b('0x5d')],'row':_0x30fe7c});}function handleQuery(_0x5ebcab){logger[_0x535b('0x5a')](_0x5ebcab);return db['sequelize']['query'](_0x5ebcab)[_0x535b('0x61')](function(_0x55f4b2){results[_0x535b('0x18')](_0x55f4b2);})[_0x535b('0x62')](function(_0xf7021f){logger['error'](_0xf7021f[_0x535b('0x5d')]);});}function updateTzCampaigns(_0x3ca46e){return new Promise(function(_0x1449d7,_0x1009bc){var _0x45c62d=squel[_0x535b('0x12')]()[_0x535b('0x36')]([_0x535b('0x63'),_0x535b('0x64')])['from']('campaigns')[_0x535b('0x14')](_0x535b('0x65'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x535b('0x15')]('campaigns_has_cm_lists.CmListId='+_0x3ca46e);db[_0x535b('0x66')]['query'](_0x45c62d[_0x535b('0x40')]())[_0x535b('0x61')](function(_0x4e7132){var _0x340ae5=[];for(var _0x58b489=0x0;_0x58b489<_0x4e7132['length'];_0x58b489++){_0x340ae5['push'](getTimezoneData(_0x4e7132[_0x58b489],tmp_campaigns));}BPromise[_0x535b('0x19')](_0x340ae5)[_0x535b('0x17')](function(){_0x1449d7({'val':0x1});});})['catch'](function(_0x3f7cc5){logger[_0x535b('0x5c')](_0x3f7cc5['message']);_0x1449d7({'val':0x0});});});}function updateTzVoiceQueues(_0x2a3b71){return new Promise(function(_0x32b676,_0x11c5d7){var _0x240ca5=squel[_0x535b('0x12')]()[_0x535b('0x36')](['voice_queues.id',_0x535b('0x67')])['from'](_0x535b('0x68'))[_0x535b('0x14')](_0x535b('0x69'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x535b('0x15')](_0x535b('0x6a')+_0x2a3b71);db['sequelize']['query'](_0x240ca5[_0x535b('0x40')]())[_0x535b('0x61')](function(_0x1ae177){var _0x130b60=[];for(var _0x550695=0x0;_0x550695<_0x1ae177[_0x535b('0x1b')];_0x550695++){_0x130b60[_0x535b('0x18')](getTimezoneData(_0x1ae177[_0x550695],tmp_voice_queues));}BPromise['all'](_0x130b60)['then'](function(){_0x32b676({'val':0x1});});})[_0x535b('0x62')](function(_0x56c8f5){logger['error'](_0x56c8f5[_0x535b('0x5d')]);_0x32b676({'val':0x0});});});}function getTimezoneData(_0x3f680d,_0x5dd096){return new Promise(function(_0x5e2419,_0x166acb){var _0x3b8410=shared[_0x535b('0x6b')];var _0x2b7ff2=_0x3b8410[_0x3f680d[_0x535b('0x6c')]];if(_['isNil'](_0x2b7ff2)){_0x5e2419({'ret':0x1});}else{var _0x4d5050=_0x2b7ff2['utcOffset'];var _0x204583=squel[_0x535b('0x2b')]()[_0x535b('0x2c')](_0x5dd096)[_0x535b('0x6d')]('id',_0x3f680d['id'])[_0x535b('0x6d')](_0x535b('0x6e'),_0x4d5050)[_0x535b('0x6d')](_0x535b('0x6c'),_0x3f680d[_0x535b('0x6c')])[_0x535b('0x40')]();return db[_0x535b('0x66')][_0x535b('0x6f')](_0x204583)[_0x535b('0x61')](function(_0x360193){_0x5e2419({'ret':0x1});})[_0x535b('0x62')](function(_0x10644d){logger[_0x535b('0x5c')](_0x10644d[_0x535b('0x5d')]);_0x166acb({'ret':0x1});});}});}function handleTZQuery(_0x27b74c){logger[_0x535b('0x5a')](_0x27b74c);return db[_0x535b('0x66')][_0x535b('0x6f')](_0x27b74c)['spread'](function(_0x3e02da){})[_0x535b('0x62')](function(_0x341c0c){logger[_0x535b('0x5c')](_0x341c0c[_0x535b('0x5d')]);});}function main(_0x13dcc5,_0x324744,_0x4051a0,_0x4b5f03){logger[_0x535b('0x5a')](_0x535b('0x70'),_0x13dcc5,JSON[_0x535b('0x71')](_0x324744));process['send']('start');var _0x561d17=_0x324744['binding'];var _0x36b7db=_[_0x535b('0x72')](_0x561d17);var _0x183886=_0x324744[_0x535b('0x73')];var _0x9182a0=path[_0x535b('0x14')](config['root'],_0x535b('0x74'),_0x183886+_0x535b('0x75'));hasTZ=_[_0x535b('0x54')](_0x561d17)[_0x535b('0x76')](_0x535b('0x6c'));var _0x24f95d=_[_0x535b('0x54')](_0x561d17)[_0x535b('0x14')]();logger['info'](_0x535b('0x77'),_0x24f95d);db[_0x535b('0x78')][_0x535b('0x79')]({'raw':!![],'attributes':['id',_0x535b('0x7a')]})[_0x535b('0x17')](function(_0x3e304a){for(var _0x40ff90=0x0;_0x40ff90<_0x3e304a[_0x535b('0x1b')];_0x40ff90++){if(_0x3e304a[_0x40ff90]['name']in _0x561d17){contactItemTypes[_0x535b('0x18')](_0x3e304a[_0x40ff90]);delete _0x36b7db[_0x3e304a[_0x40ff90]['name']];hasAdditionalPhones=!![];}for(var _0x12da8e in _0x561d17){if(_0x3e304a[_0x40ff90][_0x535b('0x7a')]+_0x535b('0x7b')===_0x12da8e){phoneDescriptions[_0x535b('0x18')]({'itemTypeId':_0x3e304a[_0x40ff90]['id'],'description':_0x12da8e});delete _0x36b7db[_0x12da8e];}}}if(hasAdditionalPhones)_0x36b7db['AdditionalPhones']='';var _0x49001e=_[_0x535b('0x54')](_0x36b7db)['join']();logger[_0x535b('0x5a')](_0x535b('0x77'),_0x49001e);fs['writeFileSync'](_0x9182a0,_0x49001e+'\x0a');Papa[_0x535b('0x7c')](fs[_0x535b('0x7d')](_0x13dcc5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3f52d2,_0x50c0d9){try{for(var _0x1d836e=0x0,_0x34955d=[];_0x1d836e<_0x3f52d2[_0x535b('0x7e')][_0x535b('0x1b')];_0x1d836e++){stats[_0x535b('0x7f')]+=0x1;if(_0x3f52d2[_0x535b('0x5f')][_0x1d836e]){handleError(_0x3f52d2[_0x535b('0x7e')][_0x1d836e],_0x3f52d2['errors'][_0x1d836e]);}else{var _0x41370c=[];var _0x5d6d5d=[];var _0x4691b4={};for(var _0x41c08f in _0x561d17){let _0x10536c=contactItemTypes['find'](_0x2971b5=>_0x2971b5[_0x535b('0x7a')]===_0x41c08f);let _0x568013=contactItemTypes[_0x535b('0x80')](_0xfa49a8=>_0xfa49a8[_0x535b('0x7a')]+'_description'===_0x41c08f);if(_[_0x535b('0x1d')](_0x10536c)&&_[_0x535b('0x1d')](_0x568013)){if(_0x561d17[_0x535b('0x81')](_0x41c08f)){if(_0x3f52d2[_0x535b('0x7e')][_0x1d836e][_0x561d17[_0x41c08f]]){var _0x486a7a=_[_0x535b('0x82')](_0x3f52d2[_0x535b('0x7e')][_0x1d836e][_0x561d17[_0x41c08f]][_0x535b('0x83')](/"/g,'\x27'));switch(_0x41c08f){case _0x535b('0x2f'):var _0x1eeca5=moment(_0x486a7a,_0x535b('0x11'),!![]);if(_0x1eeca5[_0x535b('0x84')]()){_0x34955d[_0x535b('0x18')]('\x22'+_0x486a7a+'\x22');}else{_0x41370c[_0x535b('0x18')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x535b('0x34'):var _0x40e79f=parseInt(_0x486a7a);_0x486a7a=_[_0x535b('0x85')](_0x40e79f)||_0x40e79f<0x0||_0x40e79f>0x4?_0x4b5f03?0x3:0x2:_0x40e79f;_0x34955d[_0x535b('0x18')]('\x22'+_0x486a7a+'\x22');break;case _0x535b('0x48'):var _0x207070=parseInt(_0x486a7a);if(_[_0x535b('0x86')](_0x207070)&&_[_0x535b('0x76')](_0x4051a0,_0x207070)){_0x34955d[_0x535b('0x18')]('\x22'+_0x207070+'\x22');}else{_0x41370c[_0x535b('0x18')]('agent\x20not\x20exists');}break;case _0x535b('0x87'):if(isEmail(_0x486a7a)){_0x34955d[_0x535b('0x18')]('\x22'+_0x486a7a+'\x22');}else{_0x41370c[_0x535b('0x18')](_0x535b('0x88'));}break;case _0x535b('0x89'):var _0x20e67a=moment(_0x486a7a,_0x535b('0x8a'),!![]);if(_0x20e67a[_0x535b('0x84')]()){_0x34955d[_0x535b('0x18')]('\x22'+_0x486a7a+'\x22');}else{_0x41370c[_0x535b('0x18')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x535b('0x6c'):var _0x148bd3=shared[_0x535b('0x6b')];var _0x12e320=_0x148bd3[_0x486a7a];if(!_[_0x535b('0x1d')](_0x12e320)){var _0x2726d2=_0x12e320[_0x535b('0x8b')];_0x34955d[_0x535b('0x18')]('\x22'+_0x486a7a+'\x22');_0x34955d['push']('\x22'+_0x2726d2+'\x22');}break;default:_0x34955d['push']('\x22'+_0x486a7a+'\x22');}}else{switch(_0x41c08f){case _0x535b('0x8c'):case _0x535b('0x13'):_0x41370c[_0x535b('0x18')](_0x41c08f+_0x535b('0x8d'));break;default:_0x34955d['push']('\x22\x22');}}}}else{var _0x3488f7='';if(!_[_0x535b('0x1d')](_0x10536c)){if(!_0x4691b4['hasOwnProperty'](_0x10536c['id'])){if(!_[_0x535b('0x1d')](_0x3f52d2['data'][_0x1d836e][_0x561d17[_0x41c08f]])){var _0x486a7a=_[_0x535b('0x82')](_0x3f52d2[_0x535b('0x7e')][_0x1d836e][_0x561d17[_0x41c08f]][_0x535b('0x83')](/"/g,'\x27'));var _0x53cd24=phoneDescriptions[_0x535b('0x80')](_0x5020b6=>_0x5020b6[_0x535b('0x8e')]===_0x10536c['id']);if(!_[_0x535b('0x1d')](_0x53cd24)){var _0x452d0=_['trim'](_0x3f52d2[_0x535b('0x7e')][_0x1d836e][_0x561d17[_0x53cd24['description']]][_0x535b('0x83')](/"/g,'\x27'));if(!_[_0x535b('0x1d')](_0x452d0))_0x486a7a=_0x486a7a+'§'+_0x452d0;}if(_0x3488f7=='')_0x3488f7=_0x486a7a;else _0x3488f7+='|'+_0x486a7a;}_0x5d6d5d[_0x535b('0x18')](_0x10536c['id']+':'+_0x3488f7);_0x4691b4[_0x10536c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x34955d[_0x535b('0x18')]('\x22'+_0x5d6d5d[_0x535b('0x14')](';')+'\x22');}if(_0x41370c[_0x535b('0x1b')]){handleError(_0x3f52d2[_0x535b('0x7e')][_0x1d836e],{'code':_0x535b('0x8f'),'message':_0x41370c[_0x535b('0x14')]()});}else{fs[_0x535b('0x90')](_0x9182a0,_0x34955d['join']()+'\x0a');}_0x34955d=[];}if(!(stats[_0x535b('0x7f')]%0xc8)){socket[_0x535b('0x91')](_0x535b('0x92')+_0x183886,stats);stats[_0x535b('0x5f')]=[];}}if(stopped){logger[_0x535b('0x5a')](_0x535b('0x93'));_0x50c0d9['abort']();}}catch(_0x129085){handleError(_0x3f52d2[_0x535b('0x7e')][_0x1d836e],{'code':_0x535b('0x94'),'message':_0x129085[_0x535b('0x5d')]});logger[_0x535b('0x5c')](_0x535b('0x95'),_0x129085[_0x535b('0x5d')]);}},'complete':function(){try{var _0x5e9e59=[];var _0x36c200=[];var _0x308498=_0x535b('0x38');if(_0x324744[_0x535b('0x96')]&&_0x324744[_0x535b('0x96')][_0x535b('0x1b')]){_0x308498=_0x535b('0x97')+_0x183886;_0x5e9e59[_0x535b('0x18')](_0x535b('0x98')+_0x308498+_0x535b('0x99'));}tmp_campaigns='campaigns_'+_0x183886;tmp_voice_queues='voice_queues_'+_0x183886;_0x36c200[_0x535b('0x18')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x36c200[_0x535b('0x18')](_0x535b('0x98')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x535b('0x9a')](_0x36c200,handleTZQuery)['then'](function(_0x6b7109){updateTzCampaigns(_0x324744['ListId'])[_0x535b('0x17')](function(_0x2f5b63){updateTzVoiceQueues(_0x324744[_0x535b('0x31')])[_0x535b('0x17')](function(_0x2ff835){if(hasTZ)_0x49001e=_0x49001e[_0x535b('0x83')](_0x535b('0x6c'),_0x535b('0x9b'));var _0x219779=util[_0x535b('0x10')](_0x535b('0x9c'),_0x9182a0,_0x308498,_0x49001e,_0x324744[_0x535b('0x31')],_0x324744[_0x535b('0x55')]||null,NOW,NOW);if(_[_0x535b('0x1d')](_0x561d17['scheduledat'])){_0x219779+=_0x535b('0x9d');}_0x5e9e59[_0x535b('0x18')](_0x219779);if(_0x324744['duplicates']&&_0x324744[_0x535b('0x96')][_0x535b('0x1b')]){_0x5e9e59[_0x535b('0x18')](insertCmContact(_0x324744[_0x535b('0x31')],_0x308498,_0x324744[_0x535b('0x96')],_0x561d17));_0x5e9e59[_0x535b('0x18')](_0x535b('0x9e')+_0x308498+';');}BPromise[_0x535b('0x9a')](_0x5e9e59,handleQuery)[_0x535b('0x17')](function(_0x31bb07){BPromise[_0x535b('0x19')]([handleAdditionalPhones()])[_0x535b('0x17')](function(){_0x5e9e59=[];for(var _0x3015da=0x0;_0x3015da<promisesAdditionalPhones[_0x535b('0x1b')];_0x3015da++){if(promisesAdditionalPhones[_0x3015da]['phone']!='§'){_0x5e9e59[_0x535b('0x18')](createAdditionalPhone(promisesAdditionalPhones[_0x3015da]['contactId'],promisesAdditionalPhones[_0x3015da][_0x535b('0x9f')],promisesAdditionalPhones[_0x3015da][_0x535b('0x13')],promisesAdditionalPhones[_0x3015da]['orderBy']));}}BPromise[_0x535b('0x19')](_0x5e9e59)[_0x535b('0x17')](function(){_0x5e9e59=[];if(hasTZ){_0x5e9e59[_0x535b('0x18')](insertTzCmHopper(_0x324744[_0x535b('0x31')],_0x535b('0x69'),_0x535b('0x68'),_0x535b('0xa0'),_0x4b5f03,tmp_voice_queues));_0x5e9e59[_0x535b('0x18')](insertTzCmHopperBlack(_0x324744['ListId'],'voice_queues_has_cm_blacklists','voice_queues',_0x535b('0xa0')));_0x5e9e59[_0x535b('0x18')](insertTzCmHopper(_0x324744[_0x535b('0x31')],_0x535b('0x65'),_0x535b('0xa1'),_0x535b('0xa2'),_0x4b5f03,tmp_campaigns));_0x5e9e59[_0x535b('0x18')](insertTzCmHopperBlack(_0x324744[_0x535b('0x31')],_0x535b('0xa3'),'campaigns',_0x535b('0xa2')));_0x5e9e59[_0x535b('0x18')](insertCmHopperAdditionalPhones(_0x324744[_0x535b('0x31')]));}else{_0x5e9e59[_0x535b('0x18')](insertCmHopper(_0x324744[_0x535b('0x31')],_0x535b('0x69'),_0x535b('0x68'),_0x535b('0xa0'),_0x4b5f03));_0x5e9e59[_0x535b('0x18')](insertCmHopperBlack(_0x324744[_0x535b('0x31')],_0x535b('0xa4'),'voice_queues',_0x535b('0xa0')));_0x5e9e59[_0x535b('0x18')](insertCmHopper(_0x324744[_0x535b('0x31')],_0x535b('0x65'),'campaigns',_0x535b('0xa2'),_0x4b5f03));_0x5e9e59['push'](insertCmHopperBlack(_0x324744['ListId'],_0x535b('0xa3'),'campaigns',_0x535b('0xa2')));_0x5e9e59['push'](insertCmHopperAdditionalPhones(_0x324744['ListId']));}_0x5e9e59[_0x535b('0x18')](_0x535b('0x9e')+tmp_campaigns+';');_0x5e9e59[_0x535b('0x18')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x535b('0x9a')](_0x5e9e59,handleQuery)[_0x535b('0x17')](function(_0x398efa){stats[_0x535b('0xa5')]=!![];stats[_0x535b('0xa6')]=_0x324744[_0x535b('0x96')]&&_0x324744['duplicates'][_0x535b('0x1b')]?results[0x2]['affectedRows']:results[0x0][_0x535b('0xa6')];socket[_0x535b('0x91')](_0x535b('0x92')+_0x183886,stats);fs[_0x535b('0xa7')](_0x13dcc5);fs[_0x535b('0xa7')](_0x9182a0);process['exit'](0x0);})[_0x535b('0x62')](function(_0x2dcc94){logger[_0x535b('0x5c')](_0x2dcc94[_0x535b('0x5d')]);process[_0x535b('0x5e')](0x1);});});});})[_0x535b('0x62')](function(_0x57f02d){logger[_0x535b('0x5c')](_0x57f02d[_0x535b('0x5d')]);process[_0x535b('0x5e')](0x1);});});});});}catch(_0x31380a){logger[_0x535b('0x5c')](_0x535b('0xa8'),_0x31380a[_0x535b('0x5d')]);process[_0x535b('0x5e')](0x1);}},'error':function(_0x332ab4,_0x38e74b,_0x11a043,_0x5c36c2){throw new Error(_0x5c36c2);}});});}function validate(){if(process[_0x535b('0xa9')]&&process['argv'][_0x535b('0x1b')]<0x4){throw new Error('arguments\x20<filename>\x20<parameters>\x20<agents>');}var _0x130541=path[_0x535b('0x14')](config[_0x535b('0xaa')],_0x535b('0x74'),process[_0x535b('0xa9')][0x2]);if(!fs[_0x535b('0xab')](_0x130541)){throw new Error(_0x535b('0xac'));}var _0x5be9d9={};try{_0x5be9d9=JSON[_0x535b('0x7c')](process[_0x535b('0xa9')][0x3]);if(!_0x5be9d9[_0x535b('0xad')]){throw new Error(_0x535b('0xae'));}if(!_0x5be9d9[_0x535b('0xad')]['phone']){throw new Error(_0x535b('0xaf'));}if(!_0x5be9d9[_0x535b('0xad')][_0x535b('0x8c')]){throw new Error('firstName\x20is\x20mandatory');}var _0x3cfb0a=0x0;if(_0x5be9d9[_0x535b('0xad')][_0x535b('0x48')]){_0x3cfb0a=0x1;}if(!_0x5be9d9[_0x535b('0x31')]){throw new Error(_0x535b('0xb0'));}}catch(_0x31000d){throw new Error(_0x535b('0xb1'));}var _0x2cd858=[];try{_0x2cd858=_[_0x535b('0xb2')](JSON[_0x535b('0x7c')](process['argv'][0x4]),'id');}catch(_0x501827){logger[_0x535b('0x5a')](_0x535b('0xb3'));}main(_0x130541,_0x5be9d9,_0x2cd858,_0x3cfb0a);}validate();process['on'](_0x535b('0xb4'),handleStop);process['on'](_0x535b('0xb5'),handleUncaughtException);
\ No newline at end of file
+var _0xb8f0=['uncaughtException','path','lodash','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','defaults','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','where','\x20=\x20','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','update','updated','create','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','phone','scheduledat','createdAt','updatedAt','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper_black','ContactId','ListId','priority','UserId','cm_contacts.id','.CmListId','ListId\x20=\x20?','toString','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','sequelize','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','query','timezones','dialTimezone','utcOffset','set','stringify','send','binding','socket_timestamp','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','parse','createReadStream','data','rows','find','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','replace','itemTypeId','description','SystemRow','appendFileSync','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','emit','unlink','complete','argv','arguments\x20<filename>\x20<parameters>\x20<agents>','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','No\x20agent\x20available','SIGINT'];(function(_0x34af83,_0x325496){var _0x4e4317=function(_0x119f03){while(--_0x119f03){_0x34af83['push'](_0x34af83['shift']());}};_0x4e4317(++_0x325496);}(_0xb8f0,0x16d));var _0x0b8f=function(_0xa8360d,_0x464489){_0xa8360d=_0xa8360d-0x0;var _0x6adc12=_0xb8f0[_0xa8360d];return _0x6adc12;};'use strict';var fs=require('fs');var path=require(_0x0b8f('0x0'));var _=require(_0x0b8f('0x1'));var Papa=require('papaparse');var util=require(_0x0b8f('0x2'));var BPromise=require(_0x0b8f('0x3'));var moment=require(_0x0b8f('0x4'));var squel=require(_0x0b8f('0x5'));var Redis=require(_0x0b8f('0x6'));var db=require(_0x0b8f('0x7'))['db'];var config=require(_0x0b8f('0x8'));var shared=require(_0x0b8f('0x9'));var logger=require(_0x0b8f('0xa'))(_0x0b8f('0xb'));config['redis']=_[_0x0b8f('0xc')](config[_0x0b8f('0xd')],{'host':_0x0b8f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0b8f('0xd')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x0b8f('0xf')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x0b8f('0x10'));function isEmail(_0x4d1823){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0b8f('0x11')](_0x4d1823);}function selectNotIn(_0x947b0,_0x4116d8,_0x3a5d9d,_0x49f5bd,_0xa7321b){return squel[_0x0b8f('0x12')]()[_0x0b8f('0x13')]('phone')[_0x0b8f('0x14')](_0x49f5bd)[_0x0b8f('0x15')](_0x4116d8,null,_0x4116d8+'.id\x20=\x20'+_0x49f5bd+'.'+_0x3a5d9d)[_0x0b8f('0x16')](_0x49f5bd+'.'+_0x3a5d9d+_0x0b8f('0x17')+_0x947b0+'.'+_0x3a5d9d)[_0x0b8f('0x16')](_0x4116d8+'.dialCheckDuplicateType\x20IN\x20('+_0xa7321b['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5746f6,_0x23bd6f){promisesAdditionalPhones=[];return db[_0x0b8f('0x18')][_0x0b8f('0x19')]({'raw':!![],'attributes':['id',_0x0b8f('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x0b8f('0x1b')](function(_0x496522){if(_0x496522!==null){var _0x5327bd=[];for(var _0x326c9f=0x0;_0x326c9f<_0x496522[_0x0b8f('0x1c')];_0x326c9f++){var _0x3b5f0f=_0x496522[_0x326c9f];_0x5327bd[_0x0b8f('0x1d')](insertAdditionalPhones(_0x3b5f0f));}}Promise[_0x0b8f('0x1e')](_0x5327bd)['then'](function(){_0x5746f6({'val':0x1});});});});}function insertAdditionalPhones(_0x4e3180){return new Promise(function(_0x2eb80b,_0x26fb76){var _0xfe4a7c=_0x4e3180[_0x0b8f('0x1a')];var _0x1053e0=_0xfe4a7c[_0x0b8f('0x1f')](';');var _0x4158a4=[];orderBy=0x0;for(var _0x4b89a1=0x0;_0x4b89a1<_0x1053e0[_0x0b8f('0x1c')];_0x4b89a1++){_0x4158a4['push'](splitAdditionalPhone(_0x4e3180['id'],_0x1053e0[_0x4b89a1]));}Promise[_0x0b8f('0x1e')](_0x4158a4)['then'](function(){_0x2eb80b({'val':_0x1053e0[_0x0b8f('0x1c')]});});});}function splitAdditionalPhone(_0x3a7ca1,_0x1f3b98){return new Promise(function(_0x147c2d,_0x31365b){var _0x52952d=_0x1f3b98[_0x0b8f('0x1f')](':');var _0x12acb9=_0x52952d[0x0];var _0x4c07c6=_0x52952d[0x1];if(!_[_0x0b8f('0x20')](_0x4c07c6)){var _0x25ef26=_0x4c07c6[_0x0b8f('0x1f')]('|');var _0x274781=[];for(var _0x2f72f1=0x0;_0x2f72f1<_0x25ef26[_0x0b8f('0x1c')];_0x2f72f1++){if(_0x25ef26[_0x2f72f1]!==''){var _0x3e7347=_[_0x0b8f('0x21')](promisesAdditionalPhones,{'contactId':_0x3a7ca1,'phone':_0x25ef26[_0x2f72f1]});if(_0x3e7347['length']==0x0){orderBy++;promisesAdditionalPhones[_0x0b8f('0x1d')]({'contactId':_0x3a7ca1,'contactTypeId':_0x12acb9,'phone':_0x25ef26[_0x2f72f1],'orderBy':orderBy});}}}_0x147c2d({'ok':0x1});}else _0x147c2d({'res':0x0});});}function createAdditionalPhone(_0x1f39ba,_0x2537e1,_0x22cee4,_0x57752c){var _0x2ecf33='';var _0x3c8f15='';var _0x4333ad=_0x22cee4[_0x0b8f('0x1f')]('§');_0x2ecf33=_0x4333ad[0x0];if(_0x4333ad[_0x0b8f('0x1c')]==0x2)_0x3c8f15=_0x4333ad[0x1];return new Promise(function(_0x5f119a,_0x14f801){return db[_0x0b8f('0x22')]['findOne']({'where':{'CmContactId':_0x1f39ba,'item':_0x2ecf33}})['then'](function(_0x2665e1){if(_0x2665e1){return db['CmContactHasItem'][_0x0b8f('0x23')]({'ItemTypeId':_0x2537e1,'description':_0x3c8f15,'OrderBy':_0x57752c},{'where':{'CmContactId':_0x1f39ba,'item':_0x2ecf33}})[_0x0b8f('0x1b')](function(_0x2ebb7e){_0x5f119a({'res':_0x0b8f('0x24')});});}else{return db[_0x0b8f('0x22')][_0x0b8f('0x25')]({'CmContactId':_0x1f39ba,'item':_0x2ecf33,'description':_0x3c8f15,'ItemTypeId':_0x2537e1,'OrderBy':_0x57752c,'ItemClass':'PHONE'})[_0x0b8f('0x1b')](function(_0x3f733a){_0x5f119a({'res':'inserted'});});}});});}function insertCmHopper(_0x45f2b4,_0x21011c,_0x28e301,_0x57f86f,_0xa868ce){var _0x5027e1=[_0x0b8f('0x26'),_0x0b8f('0x27'),'cm_contacts.id',_0x0b8f('0x28'),_0x21011c+'.'+_0x57f86f,_0x0b8f('0x29'),_0x0b8f('0x2a'),_0x0b8f('0x2b'),_0x0b8f('0x2c'),'\x22'+_0xa868ce+'\x22'];return squel[_0x0b8f('0x2d')]()[_0x0b8f('0x2e')]('cm_hopper')[_0x0b8f('0x2f')]([_0x0b8f('0x30'),_0x0b8f('0x31'),'ContactId','ListId',_0x57f86f,_0x0b8f('0x32'),_0x0b8f('0x33'),'priority','UserId',_0x0b8f('0x34')],squel['select']()[_0x0b8f('0x35')](_0x5027e1)['from'](_0x21011c)[_0x0b8f('0x15')](_0x0b8f('0x36'),null,_0x0b8f('0x37')+_0x21011c+'.CmListId')[_0x0b8f('0x15')](_0x28e301,null,_0x28e301+_0x0b8f('0x38')+_0x21011c+'.'+_0x57f86f)['where'](_0x21011c+_0x0b8f('0x39'),_0x45f2b4)[_0x0b8f('0x16')](_0x0b8f('0x3a'),NOW)[_0x0b8f('0x16')](_0x0b8f('0x3b'),selectNotIn(_0x21011c,_0x28e301,_0x57f86f,_0x0b8f('0x3c'),[_0x0b8f('0x3d'),_0x0b8f('0x3e')]))[_0x0b8f('0x16')](_0x0b8f('0x3b'),selectNotIn(_0x21011c,_0x28e301,_0x57f86f,_0x0b8f('0x3c'),[_0x0b8f('0x3d')])))['toString']();}function insertCmHopperBlack(_0x329013,_0x494adb,_0x100330,_0xe716c4){var _0x5f2e29=[_0x0b8f('0x26'),'cm_contacts.id','cm_contacts.ListId',_0x494adb+'.'+_0xe716c4,_0x0b8f('0x29'),'cm_contacts.updatedAt'];return squel[_0x0b8f('0x2d')]()['into'](_0x0b8f('0x3f'))[_0x0b8f('0x2f')]([_0x0b8f('0x30'),_0x0b8f('0x40'),'ListId',_0xe716c4,'createdAt',_0x0b8f('0x33')],squel['select']()[_0x0b8f('0x35')](_0x5f2e29)[_0x0b8f('0x14')](_0x494adb)[_0x0b8f('0x15')](_0x0b8f('0x36'),null,_0x0b8f('0x37')+_0x494adb+'.CmListId')[_0x0b8f('0x15')](_0x100330,null,_0x100330+'.id\x20=\x20'+_0x494adb+'.'+_0xe716c4)['where'](_0x494adb+_0x0b8f('0x39'),_0x329013)[_0x0b8f('0x16')](_0x0b8f('0x3a'),NOW)[_0x0b8f('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x0b8f('0x12')]()[_0x0b8f('0x13')]('phone')[_0x0b8f('0x14')](_0x0b8f('0x3f'))[_0x0b8f('0x16')]('ListId\x20=\x20?',_0x329013)['where'](_0xe716c4+'\x20=\x20'+_0x494adb+'.'+_0xe716c4)))['toString']();}function insertTzCmHopper(_0x4398cc,_0x3abc2a,_0x4d8072,_0x2487ae,_0x340a32,_0x1f0a69){var _0x54bd04=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0x1f0a69+'.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id',_0x0b8f('0x28'),_0x3abc2a+'.'+_0x2487ae,'cm_contacts.createdAt',_0x0b8f('0x2a'),'cm_contacts.priority',_0x0b8f('0x2c'),'\x22'+_0x340a32+'\x22'];var _0x1b7b5a=squel[_0x0b8f('0x2d')]()['into'](_0x0b8f('0x3c'))[_0x0b8f('0x2f')](['phone',_0x0b8f('0x31'),'ContactId',_0x0b8f('0x41'),_0x2487ae,_0x0b8f('0x32'),_0x0b8f('0x33'),_0x0b8f('0x42'),_0x0b8f('0x43'),'recallme'],squel[_0x0b8f('0x12')]()[_0x0b8f('0x35')](_0x54bd04)[_0x0b8f('0x14')](_0x3abc2a)[_0x0b8f('0x15')](_0x0b8f('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x3abc2a+'.CmListId')[_0x0b8f('0x15')](_0x4d8072,null,_0x4d8072+'.id\x20=\x20'+_0x3abc2a+'.'+_0x2487ae)[_0x0b8f('0x15')](_0x1f0a69,null,_0x1f0a69+_0x0b8f('0x38')+_0x3abc2a+'.'+_0x2487ae)[_0x0b8f('0x16')](_0x3abc2a+_0x0b8f('0x39'),_0x4398cc)['where'](_0x0b8f('0x3a'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3abc2a,_0x4d8072,_0x2487ae,_0x0b8f('0x3c'),[_0x0b8f('0x3d'),_0x0b8f('0x3e')]))['where'](_0x0b8f('0x3b'),selectNotIn(_0x3abc2a,_0x4d8072,_0x2487ae,_0x0b8f('0x3c'),[_0x0b8f('0x3d')])))['toString']();return _0x1b7b5a;}function insertTzCmHopperBlack(_0x111d16,_0x750f38,_0x33f395,_0x1b2744){var _0x39e143=[_0x0b8f('0x26'),_0x0b8f('0x44'),_0x0b8f('0x28'),_0x750f38+'.'+_0x1b2744,_0x0b8f('0x29'),_0x0b8f('0x2a')];return squel[_0x0b8f('0x2d')]()[_0x0b8f('0x2e')](_0x0b8f('0x3f'))['fromQuery']([_0x0b8f('0x30'),_0x0b8f('0x40'),_0x0b8f('0x41'),_0x1b2744,_0x0b8f('0x32'),_0x0b8f('0x33')],squel['select']()[_0x0b8f('0x35')](_0x39e143)[_0x0b8f('0x14')](_0x750f38)[_0x0b8f('0x15')](_0x0b8f('0x36'),null,_0x0b8f('0x37')+_0x750f38+_0x0b8f('0x45'))[_0x0b8f('0x15')](_0x33f395,null,_0x33f395+_0x0b8f('0x38')+_0x750f38+'.'+_0x1b2744)[_0x0b8f('0x16')](_0x750f38+'.CmListId\x20=\x20?',_0x111d16)[_0x0b8f('0x16')](_0x0b8f('0x3a'),NOW)[_0x0b8f('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x0b8f('0x12')]()[_0x0b8f('0x13')]('phone')[_0x0b8f('0x14')]('cm_hopper_black')['where'](_0x0b8f('0x46'),_0x111d16)['where'](_0x1b2744+'\x20=\x20'+_0x750f38+'.'+_0x1b2744)))[_0x0b8f('0x47')]();}function insertCmHopperAdditionalPhones(_0x262ae5){var _0x34e848=['cm_hopper.id',_0x0b8f('0x48'),'cm_contact_has_items.OrderBy',_0x0b8f('0x49'),'cm_contact_has_items.updatedAt'];return squel[_0x0b8f('0x2d')]()[_0x0b8f('0x2e')](_0x0b8f('0x4a'))[_0x0b8f('0x2f')]([_0x0b8f('0x4b'),'phone',_0x0b8f('0x4c'),_0x0b8f('0x32'),_0x0b8f('0x33')],squel[_0x0b8f('0x12')]()[_0x0b8f('0x35')](_0x34e848)[_0x0b8f('0x14')](_0x0b8f('0x3c'))['join'](_0x0b8f('0x36'),null,_0x0b8f('0x4d'))[_0x0b8f('0x15')](_0x0b8f('0x4e'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x0b8f('0x16')]('cm_hopper.ListId\x20=\x20?',_0x262ae5)['where'](_0x0b8f('0x3a'),NOW))[_0x0b8f('0x47')]();}function insertCmContact(_0x177b7d,_0x5f02bf,_0x1e446a,_0x10beed){var _0x10a0b6=_[_0x0b8f('0x4f')](_[_0x0b8f('0x50')](_0x10beed),[_0x0b8f('0x41'),_0x0b8f('0x51'),_0x0b8f('0x32'),'updatedAt']);return squel['insert']()[_0x0b8f('0x2e')](_0x0b8f('0x36'))[_0x0b8f('0x2f')](_0x10a0b6,squel[_0x0b8f('0x12')]()[_0x0b8f('0x35')](_0x10a0b6)[_0x0b8f('0x14')](_0x5f02bf)[_0x0b8f('0x16')]('('+_0x1e446a[_0x0b8f('0x15')](',')+_0x0b8f('0x52'),squel[_0x0b8f('0x12')]()[_0x0b8f('0x35')](_0x1e446a)[_0x0b8f('0x14')](_0x0b8f('0x36'))[_0x0b8f('0x16')](_0x0b8f('0x46'),_0x177b7d)[_0x0b8f('0x16')]('deletedAt\x20IS\x20NULL'))[_0x0b8f('0x16')]('id\x20IN\x20?',squel[_0x0b8f('0x12')]()[_0x0b8f('0x13')](_0x0b8f('0x53'),_0x0b8f('0x54'))['from'](_0x5f02bf)[_0x0b8f('0x55')](_0x1e446a[_0x0b8f('0x15')](','))))[_0x0b8f('0x47')]();}function handleStop(){logger[_0x0b8f('0x56')](_0x0b8f('0x57'));stopped=!![];}function handleUncaughtException(_0x47245b){logger[_0x0b8f('0x58')](_0x47245b[_0x0b8f('0x59')]);process[_0x0b8f('0x5a')](0x1);}function handleError(_0x43eace,_0x5c07e9){stats[_0x0b8f('0x5b')][_0x0b8f('0x1d')]({'name':_0x5c07e9[_0x0b8f('0x5c')],'message':_0x5c07e9[_0x0b8f('0x59')],'row':_0x43eace});}function handleQuery(_0x4a3d41){logger[_0x0b8f('0x56')](_0x4a3d41);return db['sequelize']['query'](_0x4a3d41)['spread'](function(_0x128f93){results['push'](_0x128f93);})[_0x0b8f('0x5d')](function(_0x425d82){logger['error'](_0x425d82['message']);});}function updateTzCampaigns(_0x44653e){return new Promise(function(_0x1cf76b,_0x36d527){var _0x3aab01=squel[_0x0b8f('0x12')]()['fields']([_0x0b8f('0x5e'),_0x0b8f('0x5f')])[_0x0b8f('0x14')](_0x0b8f('0x60'))['join'](_0x0b8f('0x61'),null,_0x0b8f('0x62'))[_0x0b8f('0x16')]('campaigns_has_cm_lists.CmListId='+_0x44653e);db[_0x0b8f('0x63')]['query'](_0x3aab01['toString']())[_0x0b8f('0x64')](function(_0x250af0){var _0x3bbce4=[];for(var _0x32c113=0x0;_0x32c113<_0x250af0[_0x0b8f('0x1c')];_0x32c113++){_0x3bbce4['push'](getTimezoneData(_0x250af0[_0x32c113],tmp_campaigns));}BPromise[_0x0b8f('0x1e')](_0x3bbce4)['then'](function(){_0x1cf76b({'val':0x1});});})['catch'](function(_0x99f3a){logger[_0x0b8f('0x58')](_0x99f3a[_0x0b8f('0x59')]);_0x1cf76b({'val':0x0});});});}function updateTzVoiceQueues(_0x3e34c7){return new Promise(function(_0xb0a673,_0x80c7be){var _0x7ebd9e=squel['select']()[_0x0b8f('0x35')]([_0x0b8f('0x65'),_0x0b8f('0x66')])[_0x0b8f('0x14')]('voice_queues')[_0x0b8f('0x15')](_0x0b8f('0x67'),null,_0x0b8f('0x68'))[_0x0b8f('0x16')](_0x0b8f('0x69')+_0x3e34c7);db[_0x0b8f('0x63')][_0x0b8f('0x6a')](_0x7ebd9e['toString']())[_0x0b8f('0x64')](function(_0xf2a9e1){var _0x5cb232=[];for(var _0x1d58c8=0x0;_0x1d58c8<_0xf2a9e1[_0x0b8f('0x1c')];_0x1d58c8++){_0x5cb232[_0x0b8f('0x1d')](getTimezoneData(_0xf2a9e1[_0x1d58c8],tmp_voice_queues));}BPromise[_0x0b8f('0x1e')](_0x5cb232)[_0x0b8f('0x1b')](function(){_0xb0a673({'val':0x1});});})['catch'](function(_0x59a063){logger[_0x0b8f('0x58')](_0x59a063[_0x0b8f('0x59')]);_0xb0a673({'val':0x0});});});}function getTimezoneData(_0x12d388,_0x22c3b1){return new Promise(function(_0x273e26,_0x77bdfa){var _0x160b24=shared[_0x0b8f('0x6b')];var _0xb6e2c8=_0x160b24[_0x12d388[_0x0b8f('0x6c')]];if(_['isNil'](_0xb6e2c8)){_0x273e26({'ret':0x1});}else{var _0x4071fc=_0xb6e2c8[_0x0b8f('0x6d')];var _0x4665cc=squel[_0x0b8f('0x2d')]()[_0x0b8f('0x2e')](_0x22c3b1)[_0x0b8f('0x6e')]('id',_0x12d388['id'])[_0x0b8f('0x6e')]('offset',_0x4071fc)[_0x0b8f('0x6e')](_0x0b8f('0x6c'),_0x12d388[_0x0b8f('0x6c')])['toString']();return db[_0x0b8f('0x63')][_0x0b8f('0x6a')](_0x4665cc)[_0x0b8f('0x64')](function(_0x3b5901){_0x273e26({'ret':0x1});})[_0x0b8f('0x5d')](function(_0x3a21c7){logger[_0x0b8f('0x58')](_0x3a21c7[_0x0b8f('0x59')]);_0x77bdfa({'ret':0x1});});}});}function handleTZQuery(_0x564baf){logger[_0x0b8f('0x56')](_0x564baf);return db['sequelize'][_0x0b8f('0x6a')](_0x564baf)[_0x0b8f('0x64')](function(_0x27dcd5){})[_0x0b8f('0x5d')](function(_0x57da1d){logger['error'](_0x57da1d[_0x0b8f('0x59')]);});}function main(_0x5bf0f4,_0x1b095a,_0x26689b,_0x50f7df){logger[_0x0b8f('0x56')]('main',_0x5bf0f4,JSON[_0x0b8f('0x6f')](_0x1b095a));process[_0x0b8f('0x70')]('start');var _0x8f5512=_0x1b095a[_0x0b8f('0x71')];var _0x27cf85=_['clone'](_0x8f5512);var _0x4ba93e=_0x1b095a[_0x0b8f('0x72')];var _0x163eb1=path[_0x0b8f('0x15')](config['root'],_0x0b8f('0x73'),_0x4ba93e+_0x0b8f('0x74'));hasTZ=_[_0x0b8f('0x50')](_0x8f5512)[_0x0b8f('0x75')](_0x0b8f('0x6c'));var _0x17b60f=_[_0x0b8f('0x50')](_0x8f5512)[_0x0b8f('0x15')]();logger[_0x0b8f('0x56')](_0x0b8f('0x76'),_0x17b60f);db[_0x0b8f('0x77')][_0x0b8f('0x19')]({'raw':!![],'attributes':['id',_0x0b8f('0x78')]})[_0x0b8f('0x1b')](function(_0x7a7cd0){for(var _0x4ca244=0x0;_0x4ca244<_0x7a7cd0[_0x0b8f('0x1c')];_0x4ca244++){if(_0x7a7cd0[_0x4ca244][_0x0b8f('0x78')]in _0x8f5512){contactItemTypes[_0x0b8f('0x1d')](_0x7a7cd0[_0x4ca244]);delete _0x27cf85[_0x7a7cd0[_0x4ca244][_0x0b8f('0x78')]];hasAdditionalPhones=!![];}for(var _0x16760c in _0x8f5512){if(_0x7a7cd0[_0x4ca244][_0x0b8f('0x78')]+_0x0b8f('0x79')===_0x16760c){phoneDescriptions['push']({'itemTypeId':_0x7a7cd0[_0x4ca244]['id'],'description':_0x16760c});delete _0x27cf85[_0x16760c];}}}if(hasAdditionalPhones)_0x27cf85[_0x0b8f('0x1a')]='';var _0x52fabb=_['keys'](_0x27cf85)[_0x0b8f('0x15')]();logger['info']('header',_0x52fabb);fs['writeFileSync'](_0x163eb1,_0x52fabb+'\x0a');Papa[_0x0b8f('0x7a')](fs[_0x0b8f('0x7b')](_0x5bf0f4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x592c5b,_0x565612){try{for(var _0x20a6af=0x0,_0x5e681a=[];_0x20a6af<_0x592c5b[_0x0b8f('0x7c')][_0x0b8f('0x1c')];_0x20a6af++){stats[_0x0b8f('0x7d')]+=0x1;if(_0x592c5b[_0x0b8f('0x5b')][_0x20a6af]){handleError(_0x592c5b[_0x0b8f('0x7c')][_0x20a6af],_0x592c5b['errors'][_0x20a6af]);}else{var _0xe8a9f5=[];var _0x582504=[];var _0x3c398c={};for(var _0x21e85a in _0x8f5512){let _0x437e08=contactItemTypes[_0x0b8f('0x7e')](_0x570bb8=>_0x570bb8['name']===_0x21e85a);let _0xdc4bd0=contactItemTypes[_0x0b8f('0x7e')](_0x3e188a=>_0x3e188a[_0x0b8f('0x78')]+_0x0b8f('0x79')===_0x21e85a);if(_[_0x0b8f('0x20')](_0x437e08)&&_[_0x0b8f('0x20')](_0xdc4bd0)){if(_0x8f5512[_0x0b8f('0x7f')](_0x21e85a)){if(_0x592c5b['data'][_0x20a6af][_0x8f5512[_0x21e85a]]){var _0x3aa43e=_[_0x0b8f('0x80')](_0x592c5b['data'][_0x20a6af][_0x8f5512[_0x21e85a]]['replace'](/"/g,'\x27'));switch(_0x21e85a){case _0x0b8f('0x31'):var _0xaed7b5=moment(_0x3aa43e,_0x0b8f('0x10'),!![]);if(_0xaed7b5[_0x0b8f('0x81')]()){_0x5e681a[_0x0b8f('0x1d')]('\x22'+_0x3aa43e+'\x22');}else{_0xe8a9f5[_0x0b8f('0x1d')](_0x0b8f('0x82'));}break;case _0x0b8f('0x42'):var _0xe6e7d3=parseInt(_0x3aa43e);_0x3aa43e=_[_0x0b8f('0x83')](_0xe6e7d3)||_0xe6e7d3<0x0||_0xe6e7d3>0x4?_0x50f7df?0x3:0x2:_0xe6e7d3;_0x5e681a[_0x0b8f('0x1d')]('\x22'+_0x3aa43e+'\x22');break;case _0x0b8f('0x43'):var _0xd088de=parseInt(_0x3aa43e);if(_[_0x0b8f('0x84')](_0xd088de)&&_[_0x0b8f('0x75')](_0x26689b,_0xd088de)){_0x5e681a[_0x0b8f('0x1d')]('\x22'+_0xd088de+'\x22');}else{_0xe8a9f5[_0x0b8f('0x1d')](_0x0b8f('0x85'));}break;case _0x0b8f('0x86'):if(isEmail(_0x3aa43e)){_0x5e681a[_0x0b8f('0x1d')]('\x22'+_0x3aa43e+'\x22');}else{_0xe8a9f5[_0x0b8f('0x1d')](_0x0b8f('0x87'));}break;case _0x0b8f('0x88'):var _0x2b04e9=moment(_0x3aa43e,_0x0b8f('0x89'),!![]);if(_0x2b04e9[_0x0b8f('0x81')]()){_0x5e681a[_0x0b8f('0x1d')]('\x22'+_0x3aa43e+'\x22');}else{_0xe8a9f5[_0x0b8f('0x1d')](_0x0b8f('0x8a'));}break;case _0x0b8f('0x6c'):var _0xb671d5=shared[_0x0b8f('0x6b')];var _0x4a936b=_0xb671d5[_0x3aa43e];if(!_[_0x0b8f('0x20')](_0x4a936b)){var _0x517217=_0x4a936b[_0x0b8f('0x6d')];_0x5e681a[_0x0b8f('0x1d')]('\x22'+_0x3aa43e+'\x22');_0x5e681a[_0x0b8f('0x1d')]('\x22'+_0x517217+'\x22');}break;default:_0x5e681a[_0x0b8f('0x1d')]('\x22'+_0x3aa43e+'\x22');}}else{switch(_0x21e85a){case'firstName':case _0x0b8f('0x30'):_0xe8a9f5['push'](_0x21e85a+_0x0b8f('0x8b'));break;default:_0x5e681a['push']('\x22\x22');}}}}else{var _0x575251='';if(!_[_0x0b8f('0x20')](_0x437e08)){if(!_0x3c398c[_0x0b8f('0x7f')](_0x437e08['id'])){if(!_[_0x0b8f('0x20')](_0x592c5b['data'][_0x20a6af][_0x8f5512[_0x21e85a]])){var _0x3aa43e=_[_0x0b8f('0x80')](_0x592c5b[_0x0b8f('0x7c')][_0x20a6af][_0x8f5512[_0x21e85a]][_0x0b8f('0x8c')](/"/g,'\x27'));var _0x52890d=phoneDescriptions[_0x0b8f('0x7e')](_0x7abde=>_0x7abde[_0x0b8f('0x8d')]===_0x437e08['id']);if(!_[_0x0b8f('0x20')](_0x52890d)){var _0x223a1c=_[_0x0b8f('0x80')](_0x592c5b[_0x0b8f('0x7c')][_0x20a6af][_0x8f5512[_0x52890d[_0x0b8f('0x8e')]]][_0x0b8f('0x8c')](/"/g,'\x27'));if(!_[_0x0b8f('0x20')](_0x223a1c))_0x3aa43e=_0x3aa43e+'§'+_0x223a1c;}if(_0x575251=='')_0x575251=_0x3aa43e;else _0x575251+='|'+_0x3aa43e;}_0x582504[_0x0b8f('0x1d')](_0x437e08['id']+':'+_0x575251);_0x3c398c[_0x437e08['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5e681a['push']('\x22'+_0x582504[_0x0b8f('0x15')](';')+'\x22');}if(_0xe8a9f5[_0x0b8f('0x1c')]){handleError(_0x592c5b[_0x0b8f('0x7c')][_0x20a6af],{'code':_0x0b8f('0x8f'),'message':_0xe8a9f5[_0x0b8f('0x15')]()});}else{fs[_0x0b8f('0x90')](_0x163eb1,_0x5e681a[_0x0b8f('0x15')]()+'\x0a');}_0x5e681a=[];}if(!(stats[_0x0b8f('0x7d')]%0xc8)){socket['emit']('contact:import:'+_0x4ba93e,stats);stats[_0x0b8f('0x5b')]=[];}}if(stopped){logger[_0x0b8f('0x56')](_0x0b8f('0x91'));_0x565612[_0x0b8f('0x92')]();}}catch(_0x31ee1d){handleError(_0x592c5b[_0x0b8f('0x7c')][_0x20a6af],{'code':_0x0b8f('0x93'),'message':_0x31ee1d[_0x0b8f('0x59')]});logger[_0x0b8f('0x58')](_0x0b8f('0x94'),_0x31ee1d[_0x0b8f('0x59')]);}},'complete':function(){try{var _0x553d62=[];var _0x30b5f1=[];var _0x2afa48='cm_contacts';if(_0x1b095a['duplicates']&&_0x1b095a[_0x0b8f('0x95')]['length']){_0x2afa48=_0x0b8f('0x96')+_0x4ba93e;_0x553d62['push'](_0x0b8f('0x97')+_0x2afa48+_0x0b8f('0x98'));}tmp_campaigns=_0x0b8f('0x99')+_0x4ba93e;tmp_voice_queues=_0x0b8f('0x9a')+_0x4ba93e;_0x30b5f1['push'](_0x0b8f('0x97')+tmp_campaigns+_0x0b8f('0x9b'));_0x30b5f1[_0x0b8f('0x1d')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x0b8f('0x9b'));BPromise[_0x0b8f('0x9c')](_0x30b5f1,handleTZQuery)[_0x0b8f('0x1b')](function(_0x16b41a){updateTzCampaigns(_0x1b095a[_0x0b8f('0x41')])[_0x0b8f('0x1b')](function(_0x49ddef){updateTzVoiceQueues(_0x1b095a[_0x0b8f('0x41')])[_0x0b8f('0x1b')](function(_0x5be9cb){if(hasTZ)_0x52fabb=_0x52fabb['replace'](_0x0b8f('0x6c'),'dialTimezone,utcOffset');var _0x2f2d4d=util['format'](_0x0b8f('0x9d'),_0x163eb1,_0x2afa48,_0x52fabb,_0x1b095a[_0x0b8f('0x41')],_0x1b095a[_0x0b8f('0x51')]||null,NOW,NOW);if(_[_0x0b8f('0x20')](_0x8f5512['scheduledat'])){_0x2f2d4d+=_0x0b8f('0x9e');}_0x553d62[_0x0b8f('0x1d')](_0x2f2d4d);if(_0x1b095a[_0x0b8f('0x95')]&&_0x1b095a[_0x0b8f('0x95')][_0x0b8f('0x1c')]){_0x553d62['push'](insertCmContact(_0x1b095a['ListId'],_0x2afa48,_0x1b095a['duplicates'],_0x8f5512));_0x553d62['push'](_0x0b8f('0x9f')+_0x2afa48+';');}BPromise[_0x0b8f('0x9c')](_0x553d62,handleQuery)[_0x0b8f('0x1b')](function(_0x25997a){BPromise[_0x0b8f('0x1e')]([handleAdditionalPhones()])[_0x0b8f('0x1b')](function(){_0x553d62=[];for(var _0x3ff80a=0x0;_0x3ff80a<promisesAdditionalPhones[_0x0b8f('0x1c')];_0x3ff80a++){if(promisesAdditionalPhones[_0x3ff80a][_0x0b8f('0x30')]!='§'){_0x553d62[_0x0b8f('0x1d')](createAdditionalPhone(promisesAdditionalPhones[_0x3ff80a][_0x0b8f('0xa0')],promisesAdditionalPhones[_0x3ff80a][_0x0b8f('0xa1')],promisesAdditionalPhones[_0x3ff80a]['phone'],promisesAdditionalPhones[_0x3ff80a][_0x0b8f('0xa2')]));}}BPromise[_0x0b8f('0x1e')](_0x553d62)[_0x0b8f('0x1b')](function(){_0x553d62=[];if(hasTZ){_0x553d62['push'](insertTzCmHopper(_0x1b095a['ListId'],_0x0b8f('0x67'),_0x0b8f('0xa3'),_0x0b8f('0xa4'),_0x50f7df,tmp_voice_queues));_0x553d62['push'](insertTzCmHopperBlack(_0x1b095a[_0x0b8f('0x41')],_0x0b8f('0xa5'),_0x0b8f('0xa3'),_0x0b8f('0xa4')));_0x553d62['push'](insertTzCmHopper(_0x1b095a[_0x0b8f('0x41')],'campaigns_has_cm_lists','campaigns',_0x0b8f('0xa6'),_0x50f7df,tmp_campaigns));_0x553d62['push'](insertTzCmHopperBlack(_0x1b095a['ListId'],_0x0b8f('0xa7'),_0x0b8f('0x60'),_0x0b8f('0xa6')));_0x553d62['push'](insertCmHopperAdditionalPhones(_0x1b095a[_0x0b8f('0x41')]));}else{_0x553d62[_0x0b8f('0x1d')](insertCmHopper(_0x1b095a[_0x0b8f('0x41')],'voice_queues_has_cm_lists',_0x0b8f('0xa3'),_0x0b8f('0xa4'),_0x50f7df));_0x553d62[_0x0b8f('0x1d')](insertCmHopperBlack(_0x1b095a[_0x0b8f('0x41')],_0x0b8f('0xa5'),_0x0b8f('0xa3'),_0x0b8f('0xa4')));_0x553d62['push'](insertCmHopper(_0x1b095a[_0x0b8f('0x41')],'campaigns_has_cm_lists',_0x0b8f('0x60'),'CampaignId',_0x50f7df));_0x553d62[_0x0b8f('0x1d')](insertCmHopperBlack(_0x1b095a[_0x0b8f('0x41')],_0x0b8f('0xa7'),_0x0b8f('0x60'),'CampaignId'));_0x553d62[_0x0b8f('0x1d')](insertCmHopperAdditionalPhones(_0x1b095a[_0x0b8f('0x41')]));}_0x553d62[_0x0b8f('0x1d')](_0x0b8f('0x9f')+tmp_campaigns+';');_0x553d62['push'](_0x0b8f('0x9f')+tmp_voice_queues+';');BPromise['each'](_0x553d62,handleQuery)[_0x0b8f('0x1b')](function(_0x39bca1){stats[_0x0b8f('0xa8')]=!![];stats[_0x0b8f('0xa9')]=_0x1b095a[_0x0b8f('0x95')]&&_0x1b095a['duplicates'][_0x0b8f('0x1c')]?results[0x2]['affectedRows']:results[0x0][_0x0b8f('0xa9')];socket[_0x0b8f('0xaa')]('contact:import:'+_0x4ba93e,stats);fs[_0x0b8f('0xab')](_0x5bf0f4);fs[_0x0b8f('0xab')](_0x163eb1);process[_0x0b8f('0x5a')](0x0);})['catch'](function(_0x2db852){logger[_0x0b8f('0x58')](_0x2db852[_0x0b8f('0x59')]);process[_0x0b8f('0x5a')](0x1);});});});})[_0x0b8f('0x5d')](function(_0x6d6440){logger[_0x0b8f('0x58')](_0x6d6440[_0x0b8f('0x59')]);process[_0x0b8f('0x5a')](0x1);});});});});}catch(_0x1e9db3){logger[_0x0b8f('0x58')](_0x0b8f('0xac'),_0x1e9db3[_0x0b8f('0x59')]);process[_0x0b8f('0x5a')](0x1);}},'error':function(_0x54db34,_0x20bf86,_0x58758b,_0x8f42d8){throw new Error(_0x8f42d8);}});});}function validate(){if(process[_0x0b8f('0xad')]&&process[_0x0b8f('0xad')][_0x0b8f('0x1c')]<0x4){throw new Error(_0x0b8f('0xae'));}var _0x18f164=path[_0x0b8f('0x15')](config['root'],_0x0b8f('0x73'),process[_0x0b8f('0xad')][0x2]);if(!fs['existsSync'](_0x18f164)){throw new Error(_0x0b8f('0xaf'));}var _0x2b050a={};try{_0x2b050a=JSON[_0x0b8f('0x7a')](process['argv'][0x3]);if(!_0x2b050a[_0x0b8f('0x71')]){throw new Error(_0x0b8f('0xb0'));}if(!_0x2b050a['binding']['phone']){throw new Error(_0x0b8f('0xb1'));}if(!_0x2b050a[_0x0b8f('0x71')]['firstName']){throw new Error(_0x0b8f('0xb2'));}var _0x177c2d=0x0;if(_0x2b050a['binding']['UserId']){_0x177c2d=0x1;}if(!_0x2b050a[_0x0b8f('0x41')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0xe537c1){throw new Error('body\x20id\x20mandatory');}var _0x40cdcb=[];try{_0x40cdcb=_['map'](JSON[_0x0b8f('0x7a')](process['argv'][0x4]),'id');}catch(_0x3ba84b){logger[_0x0b8f('0x56')](_0x0b8f('0xb3'));}main(_0x18f164,_0x2b050a,_0x40cdcb,_0x177c2d);}validate();process['on'](_0x0b8f('0xb4'),handleStop);process['on'](_0x0b8f('0xb5'),handleUncaughtException);
\ No newline at end of file
index d0d1dd6..a766f6d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x97c1=['cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','info','code','sequelize','main','stringify','send','start','binding','server/files/tmp','.csv','body','findAll','name','_description','header','writeFileSync','parse','createReadStream','data','rows','errors','find','trim','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','dateOfBirth','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','replace','description','SystemRow','contact:import:','Abort\x20parser','abort','CREATE\x20TABLE\x20','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','affectedRows','emit','unlink','exit','complete','argv','arguments\x20<filename>\x20<parameters>\x20<agents>','existsSync','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','YYYYMMDDHHmmss','test','select','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','select\x20*\x20from\x20','spread','length','isNil','push','all','then','catch','error','message','AdditionalPhones','split','filter','findOne','CmContactHasItem','updated','create','PHONE','inserted','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','cm_contacts.updatedAt','cm_hopper_black','.CmListId','field','ListId\x20=\x20?','\x20=\x20?','toString','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','OrderBy','createdAt','cm_contacts.id\x20=\x20cm_hopper.ContactId'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x97c1,0xdf));var _0x197c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x97c1[_0x122ef9];return _0x42fba0;};'use strict';var fs=require('fs');var path=require(_0x197c('0x0'));var _=require(_0x197c('0x1'));var Papa=require('papaparse');var util=require(_0x197c('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x197c('0x3'));var Redis=require(_0x197c('0x4'));var db=require(_0x197c('0x5'))['db'];var config=require(_0x197c('0x6'));var logger=require(_0x197c('0x7'))('import');config['redis']=_[_0x197c('0x8')](config[_0x197c('0x9')],{'host':_0x197c('0xa'),'port':0x18eb});var socket=require(_0x197c('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x197c('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0x197c('0xd')](_0x197c('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x853d68){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x197c('0xf')](_0x853d68);}function selectNotIn(_0x49cd61,_0x46fb80,_0x2d00c3,_0x1e9300,_0x1c5428){return squel[_0x197c('0x10')]()['field'](_0x197c('0x11'))[_0x197c('0x12')](_0x1e9300)[_0x197c('0x13')](_0x46fb80,null,_0x46fb80+_0x197c('0x14')+_0x1e9300+'.'+_0x2d00c3)['where'](_0x1e9300+'.'+_0x2d00c3+_0x197c('0x15')+_0x49cd61+'.'+_0x2d00c3)[_0x197c('0x16')](_0x46fb80+_0x197c('0x17')+_0x1c5428[_0x197c('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x188ff2,_0x109af2){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize']['query'](_0x197c('0x18')+tempTableName)[_0x197c('0x19')](function(_0x2083d4){if(_0x2083d4!==null){var _0x24901f=[];for(var _0x33f8d3=0x0;_0x33f8d3<_0x2083d4[_0x197c('0x1a')];_0x33f8d3++){var _0x437050=_0x2083d4[_0x33f8d3];if(!_[_0x197c('0x1b')](_0x437050['phone'])){if(!_[_0x197c('0x1b')](_0x437050['AdditionalPhones']))_0x24901f['push'](insertAdditionalPhones(_0x437050));promisesContact[_0x197c('0x1c')]({'contact':_0x437050});}}}Promise[_0x197c('0x1d')](_0x24901f)[_0x197c('0x1e')](function(){_0x188ff2({'val':0x1});});})[_0x197c('0x1f')](function(_0x4a4994){logger[_0x197c('0x20')](_0x4a4994[_0x197c('0x21')]);});});}function insertAdditionalPhones(_0x3c16d0){return new Promise(function(_0x5c278a,_0x1adb43){var _0x27b3df=_0x3c16d0[_0x197c('0x22')];if(_[_0x197c('0x1b')](_0x27b3df))_0x1adb43({'val':0x0});else{var _0x46801c=_0x27b3df[_0x197c('0x23')](';');var _0x362bbf=[];orderBy=0x0;for(var _0x2092a0=0x0;_0x2092a0<_0x46801c[_0x197c('0x1a')];_0x2092a0++){_0x362bbf[_0x197c('0x1c')](splitAdditionalPhone(_0x3c16d0['id'],_0x46801c[_0x2092a0]));}Promise[_0x197c('0x1d')](_0x362bbf)[_0x197c('0x1e')](function(){_0x5c278a({'val':_0x46801c[_0x197c('0x1a')]});});}});}function splitAdditionalPhone(_0x2a1310,_0x37b040){return new Promise(function(_0x25486a,_0x5f4a02){var _0x112e27=_0x37b040[_0x197c('0x23')](':');var _0x2b6319=_0x112e27[0x0];var _0x499051=_0x112e27[0x1];if(_0x499051!==''){var _0x2c2952=_0x499051[_0x197c('0x23')]('|');var _0x4c3337=[];for(var _0x5e7bc9=0x0;_0x5e7bc9<_0x2c2952[_0x197c('0x1a')];_0x5e7bc9++){if(_0x2c2952[_0x5e7bc9]!==''){var _0x48f759=_[_0x197c('0x24')](promisesAdditionalPhones,{'contactId':_0x2a1310,'phone':_0x2c2952[_0x5e7bc9]});if(_0x48f759[_0x197c('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x197c('0x1c')]({'contactId':_0x2a1310,'contactTypeId':_0x2b6319,'phone':_0x2c2952[_0x5e7bc9],'orderBy':orderBy});}}}_0x25486a({'ok':0x1});}else _0x25486a({'res':0x0});});}function createAdditionalPhone(_0x16e026,_0x2f031c,_0x3cdcd8,_0x2b6154){var _0x215df1='';var _0x4422d1='';var _0x5df39e=_0x3cdcd8['split']('§');_0x215df1=_0x5df39e[0x0];if(_0x5df39e['length']==0x2)_0x4422d1=_0x5df39e[0x1];return new Promise(function(_0x57c289,_0x5f7425){return db['CmContactHasItem'][_0x197c('0x25')]({'where':{'CmContactId':_0x16e026,'item':_0x215df1}})[_0x197c('0x1e')](function(_0x58bc60){if(_0x58bc60){return db[_0x197c('0x26')]['update']({'ItemTypeId':_0x2f031c,'description':_0x4422d1,'OrderBy':_0x2b6154},{'where':{'CmContactId':_0x16e026,'item':_0x215df1}})[_0x197c('0x1e')](function(_0x1155e1){_0x57c289({'res':_0x197c('0x27')});});}else{return db[_0x197c('0x26')][_0x197c('0x28')]({'CmContactId':_0x16e026,'item':_0x215df1,'ItemTypeId':_0x2f031c,'description':_0x4422d1,'OrderBy':_0x2b6154,'ItemClass':_0x197c('0x29')})[_0x197c('0x1e')](function(_0x41d792){_0x57c289({'res':_0x197c('0x2a')});});}});});}function updateContact(_0x5692d9){return new Promise(function(_0x5565fa,_0x2a58f6){var _0x3af036=_0x5692d9['id'];delete _0x5692d9['id'];return db[_0x197c('0x2b')][_0x197c('0x2c')](_0x5692d9,{'where':{'id':_0x3af036}})[_0x197c('0x1e')](function(_0x1cb7e8){updatedRows+=0x1;return db[_0x197c('0x2d')]['update']({'phone':_0x5692d9['phone']},{'where':{'ContactId':_0x3af036}})[_0x197c('0x1e')](function(_0x70a54){_0x5565fa({'ret':'OK'});});});});}function insertCmHopper(_0x4d085b,_0x5bebe7,_0x3cdaa1,_0x2a884b,_0x218339){var _0x3263de=[_0x197c('0x2e'),_0x197c('0x2f'),_0x197c('0x30'),_0x197c('0x31'),_0x5bebe7+'.'+_0x2a884b,_0x197c('0x32'),'cm_contacts.updatedAt',_0x197c('0x33'),_0x197c('0x34'),'\x22'+_0x218339+'\x22'];return squel[_0x197c('0x35')]()[_0x197c('0x36')](_0x197c('0x37'))[_0x197c('0x38')](['phone',_0x197c('0x39'),_0x197c('0x3a'),_0x197c('0x3b'),_0x2a884b,'createdAt',_0x197c('0x3c'),_0x197c('0x3d'),_0x197c('0x3e'),_0x197c('0x3f')],squel[_0x197c('0x10')]()[_0x197c('0x40')](_0x3263de)[_0x197c('0x12')](_0x5bebe7)[_0x197c('0x13')](_0x197c('0x41'),null,_0x197c('0x42')+_0x5bebe7+'.CmListId')[_0x197c('0x13')](_0x3cdaa1,null,_0x3cdaa1+_0x197c('0x14')+_0x5bebe7+'.'+_0x2a884b)['where'](_0x5bebe7+'.CmListId\x20=\x20?',_0x4d085b)[_0x197c('0x16')](_0x197c('0x43'),NOW)[_0x197c('0x16')](_0x197c('0x44'),selectNotIn(_0x5bebe7,_0x3cdaa1,_0x2a884b,_0x197c('0x37'),['\x22always\x22',_0x197c('0x45')]))[_0x197c('0x16')](_0x197c('0x44'),selectNotIn(_0x5bebe7,_0x3cdaa1,_0x2a884b,_0x197c('0x37'),[_0x197c('0x46')])))['toString']();}function insertCmHopperBlack(_0x3e21bd,_0x37bb94,_0x6d7bda,_0x197b27){var _0x2f3c4b=['cm_contacts.phone',_0x197c('0x30'),_0x197c('0x31'),_0x37bb94+'.'+_0x197b27,_0x197c('0x32'),_0x197c('0x47')];return squel[_0x197c('0x35')]()[_0x197c('0x36')](_0x197c('0x48'))[_0x197c('0x38')]([_0x197c('0x11'),_0x197c('0x3a'),_0x197c('0x3b'),_0x197b27,'createdAt','updatedAt'],squel['select']()['fields'](_0x2f3c4b)[_0x197c('0x12')](_0x37bb94)[_0x197c('0x13')]('cm_contacts',null,_0x197c('0x42')+_0x37bb94+_0x197c('0x49'))['join'](_0x6d7bda,null,_0x6d7bda+_0x197c('0x14')+_0x37bb94+'.'+_0x197b27)[_0x197c('0x16')](_0x37bb94+'.CmListId\x20=\x20?',_0x3e21bd)[_0x197c('0x16')](_0x197c('0x43'),NOW)['where'](_0x197c('0x44'),squel[_0x197c('0x10')]()[_0x197c('0x4a')]('phone')[_0x197c('0x12')](_0x197c('0x48'))[_0x197c('0x16')](_0x197c('0x4b'),_0x3e21bd)['where'](_0x197b27+_0x197c('0x4c'),_0x37bb94+'.'+_0x197b27)))[_0x197c('0x4d')]();}function insertCmHopperAdditionalPhones(_0x190819){var _0x553d63=['cm_hopper.id',_0x197c('0x4e'),_0x197c('0x4f'),_0x197c('0x50'),_0x197c('0x51')];return squel[_0x197c('0x35')]()[_0x197c('0x36')]('cm_hopper_additional_phones')[_0x197c('0x38')](['CmHopperId',_0x197c('0x11'),_0x197c('0x52'),_0x197c('0x53'),_0x197c('0x3c')],squel[_0x197c('0x10')]()[_0x197c('0x40')](_0x553d63)[_0x197c('0x12')](_0x197c('0x37'))['join'](_0x197c('0x41'),null,_0x197c('0x54'))[_0x197c('0x13')]('cm_contact_has_items',null,_0x197c('0x55'))['where'](_0x197c('0x56'),_0x190819)[_0x197c('0x16')](_0x197c('0x43'),NOW))[_0x197c('0x4d')]();}function insertCmContact(_0x1d7cdd,_0x304537,_0x360599,_0x21d21f){var _0x544bc5=_[_0x197c('0x57')](_[_0x197c('0x58')](_0x21d21f),[_0x197c('0x3b'),'CompanyId',_0x197c('0x53'),_0x197c('0x3c')]);return squel[_0x197c('0x35')]()[_0x197c('0x36')](_0x197c('0x41'))['fromQuery'](_0x544bc5,squel['select']()[_0x197c('0x40')](_0x544bc5)[_0x197c('0x12')](_0x304537)[_0x197c('0x16')]('('+_0x360599[_0x197c('0x13')](',')+_0x197c('0x59'),squel['select']()['fields'](_0x360599)[_0x197c('0x12')](_0x197c('0x41'))['where'](_0x197c('0x4b'),_0x1d7cdd))[_0x197c('0x16')](_0x197c('0x5a'),squel[_0x197c('0x10')]()[_0x197c('0x4a')](_0x197c('0x5b'),'min_id')[_0x197c('0x12')](_0x304537)[_0x197c('0x5c')](_0x360599['join'](','))))['toString']();}function handleStop(){logger[_0x197c('0x5d')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0xfc9461){logger[_0x197c('0x20')](_0xfc9461[_0x197c('0x21')]);process['exit'](0x1);}function handleError(_0x104034,_0x3da366){stats['errors'][_0x197c('0x1c')]({'name':_0x3da366[_0x197c('0x5e')],'message':_0x3da366[_0x197c('0x21')],'row':_0x104034});}function handleQuery(_0x5ebd0b){logger[_0x197c('0x5d')](_0x5ebd0b);return db[_0x197c('0x5f')]['query'](_0x5ebd0b)['spread'](function(_0x381191){results[_0x197c('0x1c')](_0x381191);})[_0x197c('0x1f')](function(_0x4889cd){logger[_0x197c('0x20')](_0x4889cd[_0x197c('0x21')]);});}function main(_0x32e8ba,_0x4b4734,_0xe84f3b,_0x53911a){logger[_0x197c('0x5d')](_0x197c('0x60'),_0x32e8ba,JSON[_0x197c('0x61')](_0x4b4734));process[_0x197c('0x62')](_0x197c('0x63'));var _0xaf09a=_0x4b4734[_0x197c('0x64')];var _0x42dd11=_['clone'](_0xaf09a);var _0x1f7ad0=_0x4b4734['socket_timestamp'];var _0x491162=path['join'](config['root'],_0x197c('0x65'),_0x1f7ad0+_0x197c('0x66'));logger[_0x197c('0x5d')](_0x197c('0x67'),_0x4b4734);db['ContactItemType'][_0x197c('0x68')]({'raw':!![],'attributes':['id','name']})[_0x197c('0x1e')](function(_0x573600){for(var _0x9df94b=0x0;_0x9df94b<_0x573600['length'];_0x9df94b++){if(_0x573600[_0x9df94b][_0x197c('0x69')]in _0xaf09a){contactItemTypes[_0x197c('0x1c')](_0x573600[_0x9df94b]);delete _0x42dd11[_0x573600[_0x9df94b][_0x197c('0x69')]];hasAdditionalPhones=!![];}for(var _0x40f83f in _0xaf09a){if(_0x573600[_0x9df94b]['name']+_0x197c('0x6a')===_0x40f83f){phoneDescriptions[_0x197c('0x1c')]({'itemTypeId':_0x573600[_0x9df94b]['id'],'description':_0x40f83f});delete _0x42dd11[_0x40f83f];}}}if(hasAdditionalPhones)_0x42dd11[_0x197c('0x22')]='';var _0x523a69=_[_0x197c('0x58')](_0x42dd11)[_0x197c('0x13')]();logger[_0x197c('0x5d')](_0x197c('0x6b'),_0x523a69);fs[_0x197c('0x6c')](_0x491162,_0x523a69+'\x0a');Papa[_0x197c('0x6d')](fs[_0x197c('0x6e')](_0x32e8ba),{'header':!![],'skipEmptyLines':!![],'step':function(_0x436a53,_0x2c7e66){try{for(var _0x1947bd=0x0,_0x342efa=[];_0x1947bd<_0x436a53[_0x197c('0x6f')][_0x197c('0x1a')];_0x1947bd++){stats[_0x197c('0x70')]+=0x1;if(_0x436a53[_0x197c('0x71')][_0x1947bd]){handleError(_0x436a53[_0x197c('0x6f')][_0x1947bd],_0x436a53[_0x197c('0x71')][_0x1947bd]);}else{var _0x2a03e3=[];var _0x4d22b5=[];var _0x4cb57d={};for(var _0x502748 in _0xaf09a){let _0x13c52b=contactItemTypes['find'](_0xa7ee86=>_0xa7ee86['name']===_0x502748);let _0x5a601c=contactItemTypes[_0x197c('0x72')](_0x2c9746=>_0x2c9746[_0x197c('0x69')]+'_description'===_0x502748);if(_[_0x197c('0x1b')](_0x13c52b)&&_[_0x197c('0x1b')](_0x5a601c)){if(_0xaf09a['hasOwnProperty'](_0x502748)){if(_0x436a53[_0x197c('0x6f')][_0x1947bd][_0xaf09a[_0x502748]]){var _0x4b1088=_[_0x197c('0x73')](_0x436a53[_0x197c('0x6f')][_0x1947bd][_0xaf09a[_0x502748]]['replace'](/"/g,'\x27'));switch(_0x502748){case _0x197c('0x39'):var _0x541dfa=moment(_0x4b1088,_0x197c('0xc'),!![]);if(_0x541dfa['isValid']()){_0x342efa[_0x197c('0x1c')]('\x22'+_0x4b1088+'\x22');}else{_0x2a03e3[_0x197c('0x1c')](_0x197c('0x74'));}break;case'priority':var _0x2eb67=parseInt(_0x4b1088);_0x4b1088=_[_0x197c('0x75')](_0x2eb67)||_0x2eb67<0x0||_0x2eb67>0x4?_0x53911a?0x3:0x2:_0x2eb67;_0x342efa[_0x197c('0x1c')]('\x22'+_0x4b1088+'\x22');break;case'UserId':var _0xa6a5af=parseInt(_0x4b1088);if(_[_0x197c('0x76')](_0xa6a5af)&&_[_0x197c('0x77')](_0xe84f3b,_0xa6a5af)){_0x342efa[_0x197c('0x1c')]('\x22'+_0xa6a5af+'\x22');}else{_0x2a03e3[_0x197c('0x1c')](_0x197c('0x78'));}break;case'email':if(isEmail(_0x4b1088)){_0x342efa[_0x197c('0x1c')]('\x22'+_0x4b1088+'\x22');}else{_0x2a03e3['push']('email\x20wrong\x20format');}break;case _0x197c('0x79'):var _0x8c0d4a=moment(_0x4b1088,'YYYY-MM-DD',!![]);if(_0x8c0d4a[_0x197c('0x7a')]()){_0x342efa[_0x197c('0x1c')]('\x22'+_0x4b1088+'\x22');}else{_0x2a03e3[_0x197c('0x1c')](_0x197c('0x7b'));}break;default:_0x342efa[_0x197c('0x1c')]('\x22'+_0x4b1088+'\x22');}}else{switch(_0x502748){case'firstName':case'phone':_0x2a03e3['push'](_0x502748+'\x20not\x20specified');break;default:_0x342efa[_0x197c('0x1c')]('\x22\x22');}}}}else{var _0x3d024b='';if(!_['isNil'](_0x13c52b)){if(!_0x4cb57d['hasOwnProperty'](_0x13c52b['id'])){for(var _0x213e01=0x0;_0x213e01<_0xaf09a[_0x502748]['length'];_0x213e01++){var _0x4b1088=_[_0x197c('0x73')](_0x436a53[_0x197c('0x6f')][_0x1947bd][_0xaf09a[_0x502748][_0x213e01]][_0x197c('0x7c')](/"/g,'\x27'));var _0xca4458=phoneDescriptions[_0x197c('0x72')](_0x17285b=>_0x17285b['itemTypeId']===_0x13c52b['id']);if(!_[_0x197c('0x1b')](_0xca4458)){var _0x2321e1=_[_0x197c('0x73')](_0x436a53[_0x197c('0x6f')][_0x1947bd][_0xaf09a[_0xca4458[_0x197c('0x7d')]][0x0]][_0x197c('0x7c')](/"/g,'\x27'));if(!_[_0x197c('0x1b')](_0x2321e1))_0x4b1088=_0x4b1088+'§'+_0x2321e1;}if(_0x3d024b=='')_0x3d024b=_0x4b1088;else _0x3d024b+='|'+_0x4b1088;}_0x4d22b5['push'](_0x13c52b['id']+':'+_0x3d024b);_0x4cb57d[_0x13c52b['id']]=0x1;}}}}if(hasAdditionalPhones){_0x342efa[_0x197c('0x1c')]('\x22'+_0x4d22b5[_0x197c('0x13')](';')+'\x22');}if(_0x2a03e3[_0x197c('0x1a')]){handleError(_0x436a53[_0x197c('0x6f')][_0x1947bd],{'code':_0x197c('0x7e'),'message':_0x2a03e3[_0x197c('0x13')]()});}else{fs['appendFileSync'](_0x491162,_0x342efa[_0x197c('0x13')]()+'\x0a');}_0x342efa=[];}if(!(stats[_0x197c('0x70')]%0xc8)){socket['emit'](_0x197c('0x7f')+_0x1f7ad0,stats);stats[_0x197c('0x71')]=[];}}if(stopped){logger[_0x197c('0x5d')](_0x197c('0x80'));_0x2c7e66[_0x197c('0x81')]();}}catch(_0x479f7f){handleError(_0x436a53['data'][_0x1947bd],{'code':'SystemError','message':_0x479f7f[_0x197c('0x21')]});logger['error']('step',_0x479f7f[_0x197c('0x21')]);}},'complete':function(){try{var _0x23472f=[];var _0x3b9abb=tempTableName;_0x23472f[_0x197c('0x1c')](_0x197c('0x82')+_0x3b9abb+'\x20LIKE\x20cm_contacts;');logger['info'](_0x197c('0x83'),contactItemTypes[_0x197c('0x1a')]);var _0x555cdd=util[_0x197c('0xd')](_0x197c('0x84'),_0x491162,_0x3b9abb,_0x523a69,_0x4b4734[_0x197c('0x3b')],_0x4b4734[_0x197c('0x85')]||null,NOW,NOW);if(_[_0x197c('0x1b')](_0xaf09a[_0x197c('0x39')])){_0x555cdd+=',\x20scheduledAt\x20=\x20NOW()';}_0x23472f[_0x197c('0x1c')](_0x555cdd);BPromise[_0x197c('0x86')](_0x23472f,handleQuery)[_0x197c('0x1e')](function(_0x26fe80){BPromise[_0x197c('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x23472f=[];for(var _0x525254=0x0;_0x525254<promisesContact[_0x197c('0x1a')];_0x525254++){_0x23472f['push'](updateContact(promisesContact[_0x525254][_0x197c('0x87')]));}BPromise[_0x197c('0x1d')](_0x23472f)[_0x197c('0x1e')](function(){_0x23472f=[];for(var _0x11dd06=0x0;_0x11dd06<promisesAdditionalPhones[_0x197c('0x1a')];_0x11dd06++){_0x23472f['push'](createAdditionalPhone(promisesAdditionalPhones[_0x11dd06][_0x197c('0x88')],promisesAdditionalPhones[_0x11dd06][_0x197c('0x89')],promisesAdditionalPhones[_0x11dd06][_0x197c('0x11')],promisesAdditionalPhones[_0x11dd06][_0x197c('0x8a')]));}BPromise['all'](_0x23472f)['then'](function(){_0x23472f=[];_0x23472f[_0x197c('0x1c')](insertCmHopperAdditionalPhones(_0x4b4734['ListId']));_0x23472f['push'](_0x197c('0x8b')+_0x3b9abb+';');BPromise[_0x197c('0x86')](_0x23472f,handleQuery)[_0x197c('0x1e')](function(_0x595eec){stats['finish']=!![];stats[_0x197c('0x8c')]=updatedRows;socket[_0x197c('0x8d')]('contact:import:'+_0x1f7ad0,stats);fs[_0x197c('0x8e')](_0x32e8ba);fs[_0x197c('0x8e')](_0x491162);process['exit'](0x0);})[_0x197c('0x1f')](function(_0x25393c){logger['error'](_0x25393c[_0x197c('0x21')]);process['exit'](0x1);});});});});})[_0x197c('0x1f')](function(_0x18c722){logger[_0x197c('0x20')](_0x18c722[_0x197c('0x21')]);process[_0x197c('0x8f')](0x1);});}catch(_0x56bdf5){logger[_0x197c('0x20')](_0x197c('0x90'),_0x56bdf5[_0x197c('0x21')]);process[_0x197c('0x8f')](0x1);}},'error':function(_0x2bbe66,_0x33c765,_0x2b3a66,_0x4c83e1){throw new Error(_0x4c83e1);}});});}function validate(){if(process[_0x197c('0x91')]&&process['argv'][_0x197c('0x1a')]<0x4){throw new Error(_0x197c('0x92'));}var _0x154cb0=path[_0x197c('0x13')](config['root'],_0x197c('0x65'),process[_0x197c('0x91')][0x2]);if(!fs[_0x197c('0x93')](_0x154cb0)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x308431={};try{_0x308431=JSON[_0x197c('0x6d')](process[_0x197c('0x91')][0x3]);if(!_0x308431[_0x197c('0x64')]){throw new Error(_0x197c('0x94'));}var _0x67c9a3=0x0;if(_0x308431[_0x197c('0x64')]['UserId']){_0x67c9a3=0x1;}if(!_0x308431[_0x197c('0x3b')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0xd0fc75){throw new Error(_0x197c('0x95'));}var _0x33cb9d=[];try{_0x33cb9d=_[_0x197c('0x96')](JSON[_0x197c('0x6d')](process['argv'][0x4]),'id');}catch(_0x406517){logger[_0x197c('0x5d')](_0x197c('0x97'));}main(_0x154cb0,_0x308431,_0x33cb9d,_0x67c9a3);}validate();process['on'](_0x197c('0x98'),handleStop);process['on'](_0x197c('0x99'),handleUncaughtException);
\ No newline at end of file
+var _0x9656=['rows','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','itemTypeId','description','appendFileSync','emit','Abort\x20parser','abort','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','arguments\x20<filename>\x20<parameters>\x20<agents>','argv','existsSync','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','parse','No\x20agent\x20available','uncaughtException','path','papaparse','util','moment','../../../config/environment','import','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','select','field','join','where','\x20=\x20','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','phone','push','all','then','catch','error','message','AdditionalPhones','split','filter','CmContactHasItem','findOne','create','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','createdAt','updatedAt','priority','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','ContactId','ListId','.id\x20=\x20','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','exit','errors','stringify','start','clone','socket_timestamp','root','server/files/tmp','body','ContactItemType','name','_description','header','writeFileSync','data'];(function(_0x1ea103,_0x4f7b45){var _0x5afd47=function(_0xfef0aa){while(--_0xfef0aa){_0x1ea103['push'](_0x1ea103['shift']());}};_0x5afd47(++_0x4f7b45);}(_0x9656,0x15e));var _0x6965=function(_0x4dd25e,_0x4c31db){_0x4dd25e=_0x4dd25e-0x0;var _0x44b075=_0x9656[_0x4dd25e];return _0x44b075;};'use strict';var fs=require('fs');var path=require(_0x6965('0x0'));var _=require('lodash');var Papa=require(_0x6965('0x1'));var util=require(_0x6965('0x2'));var BPromise=require('bluebird');var moment=require(_0x6965('0x3'));var squel=require('squel');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x6965('0x4'));var logger=require('../../../config/logger')(_0x6965('0x5'));config['redis']=_[_0x6965('0x6')](config['redis'],{'host':_0x6965('0x7'),'port':0x18eb});var socket=require(_0x6965('0x8'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x6965('0x9'));var tempTableName=_0x6965('0xa')+moment()[_0x6965('0xb')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x5c20b9){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x5c20b9);}function selectNotIn(_0x136a49,_0x11bea1,_0x46e3b8,_0x48df6c,_0x41e0c7){return squel[_0x6965('0xc')]()[_0x6965('0xd')]('phone')['from'](_0x48df6c)[_0x6965('0xe')](_0x11bea1,null,_0x11bea1+'.id\x20=\x20'+_0x48df6c+'.'+_0x46e3b8)[_0x6965('0xf')](_0x48df6c+'.'+_0x46e3b8+_0x6965('0x10')+_0x136a49+'.'+_0x46e3b8)[_0x6965('0xf')](_0x11bea1+'.dialCheckDuplicateType\x20IN\x20('+_0x41e0c7[_0x6965('0xe')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x209912,_0x2cab05){promisesAdditionalPhones=[];promisesContact=[];return db[_0x6965('0x11')][_0x6965('0x12')](_0x6965('0x13')+tempTableName)[_0x6965('0x14')](function(_0x40e4f3){if(_0x40e4f3!==null){var _0x3d5ba1=[];for(var _0x465214=0x0;_0x465214<_0x40e4f3[_0x6965('0x15')];_0x465214++){var _0x4a52dd=_0x40e4f3[_0x465214];if(!_[_0x6965('0x16')](_0x4a52dd[_0x6965('0x17')])){if(!_[_0x6965('0x16')](_0x4a52dd['AdditionalPhones']))_0x3d5ba1[_0x6965('0x18')](insertAdditionalPhones(_0x4a52dd));promisesContact[_0x6965('0x18')]({'contact':_0x4a52dd});}}}Promise[_0x6965('0x19')](_0x3d5ba1)[_0x6965('0x1a')](function(){_0x209912({'val':0x1});});})[_0x6965('0x1b')](function(_0x56df3b){logger[_0x6965('0x1c')](_0x56df3b[_0x6965('0x1d')]);});});}function insertAdditionalPhones(_0x6ec6a7){return new Promise(function(_0x263adc,_0x5b9561){var _0x88e4c0=_0x6ec6a7[_0x6965('0x1e')];if(_['isNil'](_0x88e4c0))_0x5b9561({'val':0x0});else{var _0x1e8a33=_0x88e4c0[_0x6965('0x1f')](';');var _0x19148a=[];orderBy=0x0;for(var _0x4e5015=0x0;_0x4e5015<_0x1e8a33['length'];_0x4e5015++){_0x19148a[_0x6965('0x18')](splitAdditionalPhone(_0x6ec6a7['id'],_0x1e8a33[_0x4e5015]));}Promise[_0x6965('0x19')](_0x19148a)[_0x6965('0x1a')](function(){_0x263adc({'val':_0x1e8a33['length']});});}});}function splitAdditionalPhone(_0x175585,_0x3ac99c){return new Promise(function(_0x1b4070,_0x16a64a){var _0x2ce0ae=_0x3ac99c[_0x6965('0x1f')](':');var _0x3a0845=_0x2ce0ae[0x0];var _0x3568d5=_0x2ce0ae[0x1];if(_0x3568d5!==''){var _0x5983ab=_0x3568d5[_0x6965('0x1f')]('|');var _0x14cc29=[];for(var _0x3a8f78=0x0;_0x3a8f78<_0x5983ab[_0x6965('0x15')];_0x3a8f78++){if(_0x5983ab[_0x3a8f78]!==''){var _0x4cf5ce=_[_0x6965('0x20')](promisesAdditionalPhones,{'contactId':_0x175585,'phone':_0x5983ab[_0x3a8f78]});if(_0x4cf5ce['length']==0x0){orderBy++;promisesAdditionalPhones[_0x6965('0x18')]({'contactId':_0x175585,'contactTypeId':_0x3a0845,'phone':_0x5983ab[_0x3a8f78],'orderBy':orderBy});}}}_0x1b4070({'ok':0x1});}else _0x1b4070({'res':0x0});});}function createAdditionalPhone(_0x4fa13c,_0x1ee288,_0x1ae67e,_0x35373c){var _0x538eeb='';var _0x28715c='';var _0x13baee=_0x1ae67e[_0x6965('0x1f')]('§');_0x538eeb=_0x13baee[0x0];if(_0x13baee[_0x6965('0x15')]==0x2)_0x28715c=_0x13baee[0x1];return new Promise(function(_0x593d0e,_0x35f56b){return db[_0x6965('0x21')][_0x6965('0x22')]({'where':{'CmContactId':_0x4fa13c,'item':_0x538eeb}})[_0x6965('0x1a')](function(_0x49c8e8){if(_0x49c8e8){return db[_0x6965('0x21')]['update']({'ItemTypeId':_0x1ee288,'description':_0x28715c,'OrderBy':_0x35373c},{'where':{'CmContactId':_0x4fa13c,'item':_0x538eeb}})['then'](function(_0x5dfacd){_0x593d0e({'res':'updated'});});}else{return db['CmContactHasItem'][_0x6965('0x23')]({'CmContactId':_0x4fa13c,'item':_0x538eeb,'ItemTypeId':_0x1ee288,'description':_0x28715c,'OrderBy':_0x35373c,'ItemClass':'PHONE'})[_0x6965('0x1a')](function(_0x178cb6){_0x593d0e({'res':'inserted'});});}});});}function updateContact(_0x4f534e){return new Promise(function(_0x5a5070,_0x20c147){var _0x55e87d=_0x4f534e['id'];delete _0x4f534e['id'];return db[_0x6965('0x24')][_0x6965('0x25')](_0x4f534e,{'where':{'id':_0x55e87d}})[_0x6965('0x1a')](function(_0x40eb8f){updatedRows+=0x1;return db[_0x6965('0x26')][_0x6965('0x25')]({'phone':_0x4f534e['phone']},{'where':{'ContactId':_0x55e87d}})[_0x6965('0x1a')](function(_0xcf9dd7){_0x5a5070({'ret':'OK'});});});});}function insertCmHopper(_0x2bd287,_0x82c811,_0x5c6372,_0x14e6ed,_0x4d8b32){var _0x56cea5=[_0x6965('0x27'),_0x6965('0x28'),_0x6965('0x29'),_0x6965('0x2a'),_0x82c811+'.'+_0x14e6ed,'cm_contacts.createdAt',_0x6965('0x2b'),_0x6965('0x2c'),'cm_contacts.UserId','\x22'+_0x4d8b32+'\x22'];return squel[_0x6965('0x2d')]()[_0x6965('0x2e')](_0x6965('0x2f'))[_0x6965('0x30')]([_0x6965('0x17'),_0x6965('0x31'),'ContactId','ListId',_0x14e6ed,_0x6965('0x32'),_0x6965('0x33'),_0x6965('0x34'),'UserId',_0x6965('0x35')],squel['select']()[_0x6965('0x36')](_0x56cea5)[_0x6965('0x37')](_0x82c811)['join'](_0x6965('0x38'),null,_0x6965('0x39')+_0x82c811+'.CmListId')['join'](_0x5c6372,null,_0x5c6372+'.id\x20=\x20'+_0x82c811+'.'+_0x14e6ed)[_0x6965('0xf')](_0x82c811+_0x6965('0x3a'),_0x2bd287)[_0x6965('0xf')](_0x6965('0x3b'),NOW)[_0x6965('0xf')](_0x6965('0x3c'),selectNotIn(_0x82c811,_0x5c6372,_0x14e6ed,'cm_hopper',[_0x6965('0x3d'),_0x6965('0x3e')]))[_0x6965('0xf')](_0x6965('0x3c'),selectNotIn(_0x82c811,_0x5c6372,_0x14e6ed,'cm_hopper',[_0x6965('0x3d')])))[_0x6965('0x3f')]();}function insertCmHopperBlack(_0x2e3b99,_0x1e26ee,_0x359aa1,_0x1d660b){var _0x1b58b9=[_0x6965('0x27'),_0x6965('0x29'),_0x6965('0x2a'),_0x1e26ee+'.'+_0x1d660b,_0x6965('0x40'),_0x6965('0x2b')];return squel['insert']()[_0x6965('0x2e')](_0x6965('0x41'))[_0x6965('0x30')](['phone',_0x6965('0x42'),_0x6965('0x43'),_0x1d660b,_0x6965('0x32'),_0x6965('0x33')],squel[_0x6965('0xc')]()['fields'](_0x1b58b9)['from'](_0x1e26ee)[_0x6965('0xe')](_0x6965('0x38'),null,_0x6965('0x39')+_0x1e26ee+'.CmListId')[_0x6965('0xe')](_0x359aa1,null,_0x359aa1+_0x6965('0x44')+_0x1e26ee+'.'+_0x1d660b)[_0x6965('0xf')](_0x1e26ee+_0x6965('0x3a'),_0x2e3b99)[_0x6965('0xf')](_0x6965('0x3b'),NOW)[_0x6965('0xf')](_0x6965('0x3c'),squel[_0x6965('0xc')]()['field'](_0x6965('0x17'))[_0x6965('0x37')](_0x6965('0x41'))[_0x6965('0xf')](_0x6965('0x45'),_0x2e3b99)[_0x6965('0xf')](_0x1d660b+_0x6965('0x46'),_0x1e26ee+'.'+_0x1d660b)))[_0x6965('0x3f')]();}function insertCmHopperAdditionalPhones(_0x5da425){var _0x330a54=[_0x6965('0x47'),'cm_contact_has_items.item',_0x6965('0x48'),_0x6965('0x49'),'cm_contact_has_items.updatedAt'];return squel[_0x6965('0x2d')]()[_0x6965('0x2e')](_0x6965('0x4a'))[_0x6965('0x30')]([_0x6965('0x4b'),_0x6965('0x17'),_0x6965('0x4c'),_0x6965('0x32'),_0x6965('0x33')],squel[_0x6965('0xc')]()[_0x6965('0x36')](_0x330a54)[_0x6965('0x37')](_0x6965('0x2f'))[_0x6965('0xe')](_0x6965('0x38'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x6965('0xe')](_0x6965('0x4d'),null,_0x6965('0x4e'))[_0x6965('0xf')]('cm_hopper.ListId\x20=\x20?',_0x5da425)[_0x6965('0xf')](_0x6965('0x3b'),NOW))[_0x6965('0x3f')]();}function insertCmContact(_0x27fac5,_0x5640f0,_0x1c54f7,_0x2c3489){var _0x4e9719=_[_0x6965('0x4f')](_[_0x6965('0x50')](_0x2c3489),[_0x6965('0x43'),_0x6965('0x51'),_0x6965('0x32'),_0x6965('0x33')]);return squel[_0x6965('0x2d')]()[_0x6965('0x2e')](_0x6965('0x38'))[_0x6965('0x30')](_0x4e9719,squel['select']()[_0x6965('0x36')](_0x4e9719)[_0x6965('0x37')](_0x5640f0)[_0x6965('0xf')]('('+_0x1c54f7['join'](',')+_0x6965('0x52'),squel[_0x6965('0xc')]()['fields'](_0x1c54f7)[_0x6965('0x37')](_0x6965('0x38'))['where'](_0x6965('0x45'),_0x27fac5))[_0x6965('0xf')](_0x6965('0x53'),squel[_0x6965('0xc')]()[_0x6965('0xd')](_0x6965('0x54'),_0x6965('0x55'))[_0x6965('0x37')](_0x5640f0)[_0x6965('0x56')](_0x1c54f7[_0x6965('0xe')](','))))[_0x6965('0x3f')]();}function handleStop(){logger[_0x6965('0x57')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x21ecf5){logger[_0x6965('0x1c')](_0x21ecf5[_0x6965('0x1d')]);process[_0x6965('0x58')](0x1);}function handleError(_0x180fc8,_0x455ca1){stats[_0x6965('0x59')]['push']({'name':_0x455ca1['code'],'message':_0x455ca1[_0x6965('0x1d')],'row':_0x180fc8});}function handleQuery(_0xd92c64){logger[_0x6965('0x57')](_0xd92c64);return db['sequelize'][_0x6965('0x12')](_0xd92c64)['spread'](function(_0x287eaf){results[_0x6965('0x18')](_0x287eaf);})[_0x6965('0x1b')](function(_0xc4f1a5){logger[_0x6965('0x1c')](_0xc4f1a5['message']);});}function main(_0x2a7985,_0x1079c4,_0xbf3eea,_0x21f565){logger[_0x6965('0x57')]('main',_0x2a7985,JSON[_0x6965('0x5a')](_0x1079c4));process['send'](_0x6965('0x5b'));var _0x58d99a=_0x1079c4['binding'];var _0x160778=_[_0x6965('0x5c')](_0x58d99a);var _0x19a20d=_0x1079c4[_0x6965('0x5d')];var _0x1d30e3=path[_0x6965('0xe')](config[_0x6965('0x5e')],_0x6965('0x5f'),_0x19a20d+'.csv');logger[_0x6965('0x57')](_0x6965('0x60'),_0x1079c4);db[_0x6965('0x61')]['findAll']({'raw':!![],'attributes':['id','name']})[_0x6965('0x1a')](function(_0x411c88){for(var _0x227e57=0x0;_0x227e57<_0x411c88[_0x6965('0x15')];_0x227e57++){if(_0x411c88[_0x227e57][_0x6965('0x62')]in _0x58d99a){contactItemTypes[_0x6965('0x18')](_0x411c88[_0x227e57]);delete _0x160778[_0x411c88[_0x227e57]['name']];hasAdditionalPhones=!![];}for(var _0x98e184 in _0x58d99a){if(_0x411c88[_0x227e57][_0x6965('0x62')]+_0x6965('0x63')===_0x98e184){phoneDescriptions[_0x6965('0x18')]({'itemTypeId':_0x411c88[_0x227e57]['id'],'description':_0x98e184});delete _0x160778[_0x98e184];}}}if(hasAdditionalPhones)_0x160778[_0x6965('0x1e')]='';var _0xab066c=_[_0x6965('0x50')](_0x160778)[_0x6965('0xe')]();logger['info'](_0x6965('0x64'),_0xab066c);fs[_0x6965('0x65')](_0x1d30e3,_0xab066c+'\x0a');Papa['parse'](fs['createReadStream'](_0x2a7985),{'header':!![],'skipEmptyLines':!![],'step':function(_0x95470d,_0x14d347){try{for(var _0x154996=0x0,_0x5e7dcb=[];_0x154996<_0x95470d[_0x6965('0x66')][_0x6965('0x15')];_0x154996++){stats[_0x6965('0x67')]+=0x1;if(_0x95470d[_0x6965('0x59')][_0x154996]){handleError(_0x95470d['data'][_0x154996],_0x95470d[_0x6965('0x59')][_0x154996]);}else{var _0x4e0c03=[];var _0x255066=[];var _0xcc037a={};for(var _0x177ebc in _0x58d99a){let _0x5862f4=contactItemTypes[_0x6965('0x68')](_0x18f685=>_0x18f685[_0x6965('0x62')]===_0x177ebc);let _0x37addd=contactItemTypes[_0x6965('0x68')](_0x45977a=>_0x45977a['name']+_0x6965('0x63')===_0x177ebc);if(_[_0x6965('0x16')](_0x5862f4)&&_[_0x6965('0x16')](_0x37addd)){if(_0x58d99a[_0x6965('0x69')](_0x177ebc)){if(_0x95470d[_0x6965('0x66')][_0x154996][_0x58d99a[_0x177ebc]]){var _0x134fb2=_[_0x6965('0x6a')](_0x95470d[_0x6965('0x66')][_0x154996][_0x58d99a[_0x177ebc]][_0x6965('0x6b')](/"/g,'\x27'));switch(_0x177ebc){case _0x6965('0x31'):var _0x36d4bd=moment(_0x134fb2,_0x6965('0x9'),!![]);if(_0x36d4bd[_0x6965('0x6c')]()){_0x5e7dcb['push']('\x22'+_0x134fb2+'\x22');}else{_0x4e0c03[_0x6965('0x18')](_0x6965('0x6d'));}break;case _0x6965('0x34'):var _0x110a82=parseInt(_0x134fb2);_0x134fb2=_[_0x6965('0x6e')](_0x110a82)||_0x110a82<0x0||_0x110a82>0x4?_0x21f565?0x3:0x2:_0x110a82;_0x5e7dcb['push']('\x22'+_0x134fb2+'\x22');break;case _0x6965('0x6f'):var _0x2d2396=parseInt(_0x134fb2);if(_['isNumber'](_0x2d2396)&&_['includes'](_0xbf3eea,_0x2d2396)){_0x5e7dcb[_0x6965('0x18')]('\x22'+_0x2d2396+'\x22');}else{_0x4e0c03['push'](_0x6965('0x70'));}break;case _0x6965('0x71'):if(isEmail(_0x134fb2)){_0x5e7dcb[_0x6965('0x18')]('\x22'+_0x134fb2+'\x22');}else{_0x4e0c03[_0x6965('0x18')](_0x6965('0x72'));}break;case _0x6965('0x73'):var _0x2cd1d3=moment(_0x134fb2,_0x6965('0x74'),!![]);if(_0x2cd1d3[_0x6965('0x6c')]()){_0x5e7dcb['push']('\x22'+_0x134fb2+'\x22');}else{_0x4e0c03[_0x6965('0x18')](_0x6965('0x75'));}break;default:_0x5e7dcb[_0x6965('0x18')]('\x22'+_0x134fb2+'\x22');}}else{switch(_0x177ebc){case'firstName':case _0x6965('0x17'):_0x4e0c03[_0x6965('0x18')](_0x177ebc+_0x6965('0x76'));break;default:_0x5e7dcb['push']('\x22\x22');}}}}else{var _0x5b022a='';if(!_['isNil'](_0x5862f4)){if(!_0xcc037a[_0x6965('0x69')](_0x5862f4['id'])){for(var _0xf0186=0x0;_0xf0186<_0x58d99a[_0x177ebc]['length'];_0xf0186++){var _0x134fb2=_[_0x6965('0x6a')](_0x95470d[_0x6965('0x66')][_0x154996][_0x58d99a[_0x177ebc][_0xf0186]][_0x6965('0x6b')](/"/g,'\x27'));var _0x4de464=phoneDescriptions[_0x6965('0x68')](_0x56e90f=>_0x56e90f[_0x6965('0x77')]===_0x5862f4['id']);if(!_[_0x6965('0x16')](_0x4de464)){var _0x521d99=_[_0x6965('0x6a')](_0x95470d['data'][_0x154996][_0x58d99a[_0x4de464[_0x6965('0x78')]][0x0]][_0x6965('0x6b')](/"/g,'\x27'));if(!_[_0x6965('0x16')](_0x521d99))_0x134fb2=_0x134fb2+'§'+_0x521d99;}if(_0x5b022a=='')_0x5b022a=_0x134fb2;else _0x5b022a+='|'+_0x134fb2;}_0x255066[_0x6965('0x18')](_0x5862f4['id']+':'+_0x5b022a);_0xcc037a[_0x5862f4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5e7dcb[_0x6965('0x18')]('\x22'+_0x255066[_0x6965('0xe')](';')+'\x22');}if(_0x4e0c03[_0x6965('0x15')]){handleError(_0x95470d[_0x6965('0x66')][_0x154996],{'code':'SystemRow','message':_0x4e0c03[_0x6965('0xe')]()});}else{fs[_0x6965('0x79')](_0x1d30e3,_0x5e7dcb[_0x6965('0xe')]()+'\x0a');}_0x5e7dcb=[];}if(!(stats[_0x6965('0x67')]%0xc8)){socket[_0x6965('0x7a')]('contact:import:'+_0x19a20d,stats);stats[_0x6965('0x59')]=[];}}if(stopped){logger[_0x6965('0x57')](_0x6965('0x7b'));_0x14d347[_0x6965('0x7c')]();}}catch(_0x4a0c0a){handleError(_0x95470d[_0x6965('0x66')][_0x154996],{'code':'SystemError','message':_0x4a0c0a[_0x6965('0x1d')]});logger[_0x6965('0x1c')](_0x6965('0x7d'),_0x4a0c0a['message']);}},'complete':function(){try{var _0x512f7c=[];var _0x57887c=tempTableName;_0x512f7c[_0x6965('0x18')](_0x6965('0x7e')+_0x57887c+_0x6965('0x7f'));logger[_0x6965('0x57')]('CIS\x20len',contactItemTypes[_0x6965('0x15')]);var _0x2072cc=util['format'](_0x6965('0x80'),_0x1d30e3,_0x57887c,_0xab066c,_0x1079c4['ListId'],_0x1079c4[_0x6965('0x51')]||null,NOW,NOW);if(_[_0x6965('0x16')](_0x58d99a[_0x6965('0x31')])){_0x2072cc+=_0x6965('0x81');}_0x512f7c['push'](_0x2072cc);BPromise[_0x6965('0x82')](_0x512f7c,handleQuery)[_0x6965('0x1a')](function(_0x1d6713){BPromise[_0x6965('0x19')]([handleAdditionalPhones()])['then'](function(){_0x512f7c=[];for(var _0x19e225=0x0;_0x19e225<promisesContact[_0x6965('0x15')];_0x19e225++){_0x512f7c['push'](updateContact(promisesContact[_0x19e225][_0x6965('0x83')]));}BPromise[_0x6965('0x19')](_0x512f7c)[_0x6965('0x1a')](function(){_0x512f7c=[];for(var _0x2fe5bf=0x0;_0x2fe5bf<promisesAdditionalPhones[_0x6965('0x15')];_0x2fe5bf++){_0x512f7c['push'](createAdditionalPhone(promisesAdditionalPhones[_0x2fe5bf][_0x6965('0x84')],promisesAdditionalPhones[_0x2fe5bf][_0x6965('0x85')],promisesAdditionalPhones[_0x2fe5bf][_0x6965('0x17')],promisesAdditionalPhones[_0x2fe5bf][_0x6965('0x86')]));}BPromise[_0x6965('0x19')](_0x512f7c)[_0x6965('0x1a')](function(){_0x512f7c=[];_0x512f7c[_0x6965('0x18')](insertCmHopperAdditionalPhones(_0x1079c4[_0x6965('0x43')]));_0x512f7c[_0x6965('0x18')](_0x6965('0x87')+_0x57887c+';');BPromise['each'](_0x512f7c,handleQuery)[_0x6965('0x1a')](function(_0x319129){stats[_0x6965('0x88')]=!![];stats[_0x6965('0x89')]=updatedRows;socket[_0x6965('0x7a')]('contact:import:'+_0x19a20d,stats);fs[_0x6965('0x8a')](_0x2a7985);fs[_0x6965('0x8a')](_0x1d30e3);process['exit'](0x0);})[_0x6965('0x1b')](function(_0x367146){logger['error'](_0x367146[_0x6965('0x1d')]);process[_0x6965('0x58')](0x1);});});});});})[_0x6965('0x1b')](function(_0x1cf512){logger[_0x6965('0x1c')](_0x1cf512['message']);process[_0x6965('0x58')](0x1);});}catch(_0x3e6dc2){logger[_0x6965('0x1c')](_0x6965('0x8b'),_0x3e6dc2['message']);process[_0x6965('0x58')](0x1);}},'error':function(_0x282623,_0xe206b0,_0x301eac,_0x1966c2){throw new Error(_0x1966c2);}});});}function validate(){if(process['argv']&&process['argv'][_0x6965('0x15')]<0x4){throw new Error(_0x6965('0x8c'));}var _0x3c0259=path['join'](config[_0x6965('0x5e')],_0x6965('0x5f'),process[_0x6965('0x8d')][0x2]);if(!fs[_0x6965('0x8e')](_0x3c0259)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x4715c7={};try{_0x4715c7=JSON['parse'](process[_0x6965('0x8d')][0x3]);if(!_0x4715c7[_0x6965('0x8f')]){throw new Error(_0x6965('0x90'));}var _0x2573af=0x0;if(_0x4715c7[_0x6965('0x8f')][_0x6965('0x6f')]){_0x2573af=0x1;}if(!_0x4715c7[_0x6965('0x43')]){throw new Error(_0x6965('0x91'));}}catch(_0x3431e9){throw new Error(_0x6965('0x92'));}var _0x4d8e1a=[];try{_0x4d8e1a=_[_0x6965('0x93')](JSON[_0x6965('0x94')](process['argv'][0x4]),'id');}catch(_0x129051){logger[_0x6965('0x57')](_0x6965('0x95'));}main(_0x3c0259,_0x4715c7,_0x4d8e1a,_0x2573af);}validate();process['on']('SIGINT',handleStop);process['on'](_0x6965('0x96'),handleUncaughtException);
\ No newline at end of file
index db2dfb0..9cf049f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8676=['getDescriptions','toLowerCase','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','Date','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','voice','inbound','variable','queue','push','outbound','Outbound\x20Call','destcalleridnum'];(function(_0x4a17f8,_0x54bbf5){var _0x3c6440=function(_0x53566e){while(--_0x53566e){_0x4a17f8['push'](_0x4a17f8['shift']());}};_0x3c6440(++_0x54bbf5);}(_0x8676,0xe6));var _0x6867=function(_0x362737,_0x5b42c2){_0x362737=_0x362737-0x0;var _0x1c3604=_0x8676[_0x362737];return _0x1c3604;};'use strict';exports['getSubjects']=function(_0x5a2b13,_0x364d80){var _0x88cdea=[{'type':_0x6867('0x0'),'content':_0x6867('0x1'),'variableName':null}];switch(_0x5a2b13['toLowerCase']()){case _0x6867('0x2'):switch(_0x364d80['toLowerCase']()){case _0x6867('0x3'):_0x88cdea['push']({'type':_0x6867('0x4'),'content':'','variableName':_0x6867('0x5')});_0x88cdea[_0x6867('0x6')]({'type':_0x6867('0x4'),'content':'','variableName':'calleridnum'});break;case _0x6867('0x7'):_0x88cdea[_0x6867('0x6')]({'type':_0x6867('0x0'),'content':_0x6867('0x8'),'variableName':null});_0x88cdea[_0x6867('0x6')]({'type':_0x6867('0x4'),'content':'','variableName':_0x6867('0x9')});break;}}return _0x88cdea;};exports[_0x6867('0xa')]=function(_0x3b5ae0,_0x43bd18){var _0x3c17ac=[];switch(_0x3b5ae0['toLowerCase']()){case _0x6867('0x2'):switch(_0x43bd18[_0x6867('0xb')]()){case'inbound':_0x3c17ac=[{'type':_0x6867('0x0'),'content':_0x6867('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0xe'),'keyType':_0x6867('0x4'),'variableName':_0x6867('0xf')},{'type':'keyValue','content':'','key':_0x6867('0x10'),'keyType':_0x6867('0x4'),'variableName':_0x6867('0x11')},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0x12'),'keyType':_0x6867('0x4'),'variableName':_0x6867('0x13')},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0x14'),'keyType':_0x6867('0x4'),'variableName':_0x6867('0x5')},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0x15'),'keyType':_0x6867('0x4'),'variableName':_0x6867('0x16')},{'type':_0x6867('0xd'),'content':'','key':'Date','keyType':_0x6867('0x4'),'variableName':_0x6867('0x17')},{'type':'string','content':_0x6867('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x6867('0xd'),'content':'','key':'Agent\x20Name','keyType':_0x6867('0x4'),'variableName':_0x6867('0x19')},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0x1a'),'keyType':_0x6867('0x4'),'variableName':'destcalleridnum'},{'type':_0x6867('0x0'),'content':_0x6867('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0x1c'),'keyType':_0x6867('0x4'),'variableName':_0x6867('0x17')},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0x1d'),'keyType':_0x6867('0x4'),'variableName':'agentconnectAt'},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0x1e'),'keyType':'variable','variableName':_0x6867('0x1f')},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0x20'),'keyType':_0x6867('0x4'),'variableName':_0x6867('0x21')},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0x22'),'keyType':_0x6867('0x4'),'variableName':_0x6867('0x23')}];break;case _0x6867('0x7'):_0x3c17ac=[{'type':_0x6867('0x0'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0x24'),'keyType':_0x6867('0x4'),'keyContent':'','variableName':_0x6867('0x9')},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0x25'),'keyType':_0x6867('0x4'),'keyContent':'','variableName':_0x6867('0x26')},{'type':_0x6867('0xd'),'content':'','key':'UniqueId','keyType':_0x6867('0x4'),'keyContent':'','variableName':'uniqueid'},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0x27'),'keyType':'variable','keyContent':'','variableName':_0x6867('0x28')},{'type':_0x6867('0x0'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0x29'),'keyType':_0x6867('0x4'),'keyContent':'','variableName':_0x6867('0x2a')},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0x2b'),'keyType':'variable','keyContent':'','variableName':_0x6867('0x2c')},{'type':'keyValue','content':'','key':'Duration','keyType':_0x6867('0x4'),'keyContent':'','variableName':_0x6867('0x2d')},{'type':_0x6867('0xd'),'content':'','key':_0x6867('0x2e'),'keyType':_0x6867('0x4'),'keyContent':'','variableName':_0x6867('0x2f')}];break;}}return _0x3c17ac;};
\ No newline at end of file
+var _0x188b=['Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','push','queue','variable','Outbound\x20Call','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','calleridnum','Caller\x20Name','calleridname','Call\x20To','Queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','outbound','Called\x20Number','Member\x20Name','uniqueid','starttime','Answer\x20Time','answertime','duration'];(function(_0x52c7ba,_0x2e0695){var _0x2b276e=function(_0x28eb52){while(--_0x28eb52){_0x52c7ba['push'](_0x52c7ba['shift']());}};_0x2b276e(++_0x2e0695);}(_0x188b,0x159));var _0xb188=function(_0x4dd120,_0x4d703d){_0x4dd120=_0x4dd120-0x0;var _0x4fc3af=_0x188b[_0x4dd120];return _0x4fc3af;};'use strict';exports[_0xb188('0x0')]=function(_0x5b624d,_0x10127a){var _0x577ce7=[{'type':_0xb188('0x1'),'content':_0xb188('0x2'),'variableName':null}];switch(_0x5b624d[_0xb188('0x3')]()){case'voice':switch(_0x10127a[_0xb188('0x3')]()){case'inbound':_0x577ce7[_0xb188('0x4')]({'type':'variable','content':'','variableName':_0xb188('0x5')});_0x577ce7[_0xb188('0x4')]({'type':_0xb188('0x6'),'content':'','variableName':'calleridnum'});break;case'outbound':_0x577ce7['push']({'type':_0xb188('0x1'),'content':_0xb188('0x7'),'variableName':null});_0x577ce7[_0xb188('0x4')]({'type':_0xb188('0x6'),'content':'','variableName':_0xb188('0x8')});break;}}return _0x577ce7;};exports[_0xb188('0x9')]=function(_0x34d945,_0x4a3ce5){var _0x45b47f=[];switch(_0x34d945['toLowerCase']()){case _0xb188('0xa'):switch(_0x4a3ce5[_0xb188('0x3')]()){case'inbound':_0x45b47f=[{'type':_0xb188('0x1'),'content':_0xb188('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xb188('0xc'),'content':'','key':'Caller\x20Number','keyType':_0xb188('0x6'),'variableName':_0xb188('0xd')},{'type':_0xb188('0xc'),'content':'','key':_0xb188('0xe'),'keyType':_0xb188('0x6'),'variableName':_0xb188('0xf')},{'type':_0xb188('0xc'),'content':'','key':_0xb188('0x10'),'keyType':_0xb188('0x6'),'variableName':'destexten'},{'type':_0xb188('0xc'),'content':'','key':_0xb188('0x11'),'keyType':_0xb188('0x6'),'variableName':_0xb188('0x5')},{'type':_0xb188('0xc'),'content':'','key':_0xb188('0x12'),'keyType':_0xb188('0x6'),'variableName':'uniqueid'},{'type':_0xb188('0xc'),'content':'','key':_0xb188('0x13'),'keyType':'variable','variableName':_0xb188('0x14')},{'type':_0xb188('0x1'),'content':_0xb188('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xb188('0xc'),'content':'','key':_0xb188('0x16'),'keyType':'variable','variableName':_0xb188('0x17')},{'type':_0xb188('0xc'),'content':'','key':_0xb188('0x18'),'keyType':_0xb188('0x6'),'variableName':_0xb188('0x8')},{'type':_0xb188('0x1'),'content':_0xb188('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xb188('0xc'),'content':'','key':_0xb188('0x1a'),'keyType':'variable','variableName':_0xb188('0x14')},{'type':'keyValue','content':'','key':_0xb188('0x1b'),'keyType':_0xb188('0x6'),'variableName':_0xb188('0x1c')},{'type':_0xb188('0xc'),'content':'','key':_0xb188('0x1d'),'keyType':'variable','variableName':_0xb188('0x1e')},{'type':_0xb188('0xc'),'content':'','key':_0xb188('0x1f'),'keyType':_0xb188('0x6'),'variableName':_0xb188('0x20')},{'type':'keyValue','content':'','key':_0xb188('0x21'),'keyType':_0xb188('0x6'),'variableName':'talktime'}];break;case _0xb188('0x22'):_0x45b47f=[{'type':_0xb188('0x1'),'content':_0xb188('0xb'),'variableName':null},{'type':_0xb188('0xc'),'content':'','key':_0xb188('0x23'),'keyType':_0xb188('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0xb188('0xc'),'content':'','key':_0xb188('0x24'),'keyType':_0xb188('0x6'),'keyContent':'','variableName':'membername'},{'type':_0xb188('0xc'),'content':'','key':'UniqueId','keyType':_0xb188('0x6'),'keyContent':'','variableName':_0xb188('0x25')},{'type':_0xb188('0xc'),'content':'','key':_0xb188('0x13'),'keyType':_0xb188('0x6'),'keyContent':'','variableName':_0xb188('0x26')},{'type':_0xb188('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xb188('0xc'),'content':'','key':_0xb188('0x27'),'keyType':_0xb188('0x6'),'keyContent':'','variableName':_0xb188('0x28')},{'type':_0xb188('0xc'),'content':'','key':'Complete\x20Time','keyType':_0xb188('0x6'),'keyContent':'','variableName':'endtime'},{'type':'keyValue','content':'','key':'Duration','keyType':_0xb188('0x6'),'keyContent':'','variableName':_0xb188('0x29')},{'type':'keyValue','content':'','key':_0xb188('0x2a'),'keyType':_0xb188('0x6'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x45b47f;};
\ No newline at end of file
index e24c4fe..5cefdba 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4521=['body','omit','html','phone','mobile','lodash','../../config/logger','openchannel-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','stringify','null','Interaction','findOne','then','update','info','catch','user'];(function(_0x5e270a,_0x340284){var _0x52bcb7=function(_0x336415){while(--_0x336415){_0x5e270a['push'](_0x5e270a['shift']());}};_0x52bcb7(++_0x340284);}(_0x4521,0xdd));var _0x1452=function(_0x2dc817,_0x8f80db){_0x2dc817=_0x2dc817-0x0;var _0x4fa37c=_0x4521[_0x2dc817];return _0x4fa37c;};'use strict';var _=require(_0x1452('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x1452('0x1'))(_0x1452('0x2')),'mail':require(_0x1452('0x1'))('mail-interactions'),'fax':require(_0x1452('0x1'))('fax-interactions'),'sms':require(_0x1452('0x1'))('sms-interactions'),'chat':require(_0x1452('0x1'))('chat-interactions'),'whatsapp':require(_0x1452('0x1'))(_0x1452('0x3'))};function getInteractionId(_0x56596a,_0x1db493,_0x144b8a){if(_0x56596a&&_0x56596a[_[_0x1452('0x4')](_0x144b8a)+_0x1452('0x5')]){return _0x56596a[_[_0x1452('0x4')](_0x144b8a)+_0x1452('0x5')];}else if(_0x56596a&&_0x56596a['id']){return _0x56596a['id'];}else if(_0x1db493&&_0x1db493['id']){return _0x1db493['id'];}else{return _0x1452('0x6');}}function log(_0x360581,_0x55ec13,_0x4ee787,_0xe77ee,_0x1a9974,_0xe8d6c9){loggers[_0x1a9974[_0x1452('0x7')]()][_0x360581](_0x1452('0x8'),_0xe8d6c9['toUpperCase'](),_0x55ec13?_0x55ec13['id']:null,_0x55ec13?_0x55ec13[_0x1452('0x9')]:null,_0x55ec13?_0x55ec13['role']:null,getInteractionId(_0x4ee787,_0xe77ee,_0x1a9974),_0x4ee787?JSON[_0x1452('0xa')](_0x4ee787):_0x1452('0xb'));}function updateUser(_0x1f79bd,_0x405358,_0x34facd,_0x17bc35,_0x2d56d4){db[_[_0x1452('0x4')](_0x17bc35)+_0x1452('0xc')][_0x1452('0xd')]({'where':{'id':getInteractionId(_0x405358,_0x34facd,_0x17bc35)}})[_0x1452('0xe')](function(_0x1a5d36){if(_0x1a5d36){return _0x1a5d36[_0x1452('0xf')]({'UserId':_0x1f79bd?_0x1f79bd['id']:null});}})[_0x1452('0xe')](function(_0x312825){if(_0x312825){log(_0x1452('0x10'),_0x1f79bd,_0x405358,_0x34facd,_0x17bc35,_0x2d56d4);}})[_0x1452('0x11')](function(){log('error',_0x1f79bd,_0x405358,_0x34facd,_0x17bc35,_0x2d56d4);});}exports['tracked']=function(_0x1c7f50,_0x4ae10b){return function(_0xf204bc,_0x315f7e,_0x46b0ca){var _0x58a6cf=_0xf204bc[_0x1452('0x12')];var _0x378b23={};var _0x25e7be=_0xf204bc['query'];if(_0x378b23){_0x378b23=_['clone'](_0xf204bc[_0x1452('0x13')]);_0x378b23=_[_0x1452('0x14')](_0x378b23,['body',_0x1452('0x15'),_0x1452('0x16'),'fax',_0x1452('0x17')]);}updateUser(_0x58a6cf,_0x378b23,_0x25e7be,_0x1c7f50,_0x4ae10b);_0x46b0ca(null);};};
\ No newline at end of file
+var _0xe198=['upperFirst','Interaction','findOne','update','info','catch','tracked','clone','body','html','phone','fax','mobile','lodash','../../mysqldb','openchannel-interactions','mail-interactions','fax-interactions','../../config/logger','chat-interactions','whatsapp-interactions','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null'];(function(_0x451e44,_0x2a4226){var _0x58f6ca=function(_0x504c35){while(--_0x504c35){_0x451e44['push'](_0x451e44['shift']());}};_0x58f6ca(++_0x2a4226);}(_0xe198,0x15d));var _0x8e19=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xe198[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x8e19('0x0'));var db=require(_0x8e19('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x8e19('0x2')),'mail':require('../../config/logger')(_0x8e19('0x3')),'fax':require('../../config/logger')(_0x8e19('0x4')),'sms':require(_0x8e19('0x5'))('sms-interactions'),'chat':require('../../config/logger')(_0x8e19('0x6')),'whatsapp':require(_0x8e19('0x5'))(_0x8e19('0x7'))};function getInteractionId(_0x586f6f,_0x3d5dd4,_0x48ff7e){if(_0x586f6f&&_0x586f6f[_['upperFirst'](_0x48ff7e)+_0x8e19('0x8')]){return _0x586f6f[_['upperFirst'](_0x48ff7e)+_0x8e19('0x8')];}else if(_0x586f6f&&_0x586f6f['id']){return _0x586f6f['id'];}else if(_0x3d5dd4&&_0x3d5dd4['id']){return _0x3d5dd4['id'];}else{return _0x8e19('0x9');}}function log(_0x2f83c5,_0x487aa6,_0x4a85ac,_0x36d665,_0x507899,_0x255514){loggers[_0x507899['toLowerCase']()][_0x2f83c5](_0x8e19('0xa'),_0x255514['toUpperCase'](),_0x487aa6?_0x487aa6['id']:null,_0x487aa6?_0x487aa6[_0x8e19('0xb')]:null,_0x487aa6?_0x487aa6[_0x8e19('0xc')]:null,getInteractionId(_0x4a85ac,_0x36d665,_0x507899),_0x4a85ac?JSON[_0x8e19('0xd')](_0x4a85ac):_0x8e19('0xe'));}function updateUser(_0x19667c,_0x5b3c97,_0x16bf0e,_0x2a00f7,_0x37f341){db[_[_0x8e19('0xf')](_0x2a00f7)+_0x8e19('0x10')][_0x8e19('0x11')]({'where':{'id':getInteractionId(_0x5b3c97,_0x16bf0e,_0x2a00f7)}})['then'](function(_0xd9eb1e){if(_0xd9eb1e){return _0xd9eb1e[_0x8e19('0x12')]({'UserId':_0x19667c?_0x19667c['id']:null});}})['then'](function(_0x2edcfa){if(_0x2edcfa){log(_0x8e19('0x13'),_0x19667c,_0x5b3c97,_0x16bf0e,_0x2a00f7,_0x37f341);}})[_0x8e19('0x14')](function(){log('error',_0x19667c,_0x5b3c97,_0x16bf0e,_0x2a00f7,_0x37f341);});}exports[_0x8e19('0x15')]=function(_0x92d565,_0x2277ae){return function(_0x1c59b7,_0x44284b,_0x59d860){var _0x1f8b91=_0x1c59b7['user'];var _0x4a79e3={};var _0x7e3eb7=_0x1c59b7['query'];if(_0x4a79e3){_0x4a79e3=_[_0x8e19('0x16')](_0x1c59b7[_0x8e19('0x17')]);_0x4a79e3=_['omit'](_0x4a79e3,[_0x8e19('0x17'),_0x8e19('0x18'),_0x8e19('0x19'),_0x8e19('0x1a'),_0x8e19('0x1b')]);}updateUser(_0x1f8b91,_0x4a79e3,_0x7e3eb7,_0x92d565,_0x2277ae);_0x59d860(null);};};
\ No newline at end of file
index 75e1312..3925754 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1995=['hasOwnProperty','License','then','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse'];(function(_0x197db8,_0x357240){var _0xf193ff=function(_0x16309b){while(--_0x16309b){_0x197db8['push'](_0x197db8['shift']());}};_0xf193ff(++_0x357240);}(_0x1995,0xed));var _0x5199=function(_0x4203ea,_0x473c9e){_0x4203ea=_0x4203ea-0x0;var _0x306ef6=_0x1995[_0x4203ea];return _0x306ef6;};'use strict';var crypto=require(_0x5199('0x0'));var util=require(_0x5199('0x1'));var compose=require(_0x5199('0x2'));var db=require(_0x5199('0x3'))['db'];var config=require(_0x5199('0x4'));function getValueFromLicense(_0x2378f8,_0x4aec70){if(_0x2378f8&&_0x4aec70){if(_0x4aec70[_0x5199('0x5')]&&_0x4aec70[_0x5199('0x6')]){var _0x2af533=_0x4aec70[_0x5199('0x5')];var _0x304c38=_0x4aec70[_0x5199('0x6')];var _0x1a2780=_0x2af533['split']('-')[0x4];var _0x412af3=_0x2af533[_0x5199('0x7')]('-')[0x0];var _0x4af314=crypto[_0x5199('0x8')](_0x5199('0x9'),util[_0x5199('0xa')](_0x5199('0xb'),_0x1a2780,_0x2af533,_0x412af3));var _0x234d70=_0x4af314['update'](_0x304c38,_0x5199('0xc'),_0x5199('0xd'));_0x234d70+=_0x4af314[_0x5199('0xe')]('utf8');var _0x5f452f=JSON[_0x5199('0xf')](_0x234d70);return _0x5f452f[_0x5199('0x10')](_0x2378f8)?_0x5f452f[_0x2378f8]:null;}}return null;}function isLimit(_0x40f02d,_0x377bb2,_0x5da2ae,_0x4ea092){var _0x22ca4d=_0x377bb2;return compose()['use'](function(_0x2c31d2,_0x401be1,_0x558128){return db[_0x5199('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x158ce4){var _0x40e994=getValueFromLicense(_0x40f02d,_0x158ce4);return _0x40e994?_0x40e994:_0x22ca4d;})[_0x5199('0x12')](function(_0xfebeef){_0x22ca4d=_0xfebeef;return _0x5da2ae['count'](_0x4ea092);})[_0x5199('0x12')](function(_0x502011){if(_0x502011>=_0x22ca4d){return _0x401be1['status'](0x193)['json']({'message':util[_0x5199('0xa')](_0x5199('0x13'),_0x40f02d)});}_0x558128();})[_0x5199('0x14')](function(_0x10b8cd){_0x558128(_0x10b8cd);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0x5199('0x15')},{'role':'user'}]}});}exports[_0x5199('0x16')]=isUserLimit;
\ No newline at end of file
+var _0xb0d4=['parse','hasOwnProperty','use','License','findOne','then','count','status','json','catch','User','user','isUserLimit','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','final','utf8'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb0d4,0x1e1));var _0x4b0d=function(_0x441ea0,_0x60e671){_0x441ea0=_0x441ea0-0x0;var _0x47c7ad=_0xb0d4[_0x441ea0];return _0x47c7ad;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0x4b0d('0x0'));var db=require(_0x4b0d('0x1'))['db'];var config=require(_0x4b0d('0x2'));function getValueFromLicense(_0x418049,_0x36b7cb){if(_0x418049&&_0x36b7cb){if(_0x36b7cb[_0x4b0d('0x3')]&&_0x36b7cb[_0x4b0d('0x4')]){var _0x5d80f2=_0x36b7cb[_0x4b0d('0x3')];var _0x399359=_0x36b7cb[_0x4b0d('0x4')];var _0x23b3f1=_0x5d80f2[_0x4b0d('0x5')]('-')[0x4];var _0x1bcaac=_0x5d80f2[_0x4b0d('0x5')]('-')[0x0];var _0x305d51=crypto[_0x4b0d('0x6')](_0x4b0d('0x7'),util['format'](_0x4b0d('0x8'),_0x23b3f1,_0x5d80f2,_0x1bcaac));var _0x5f4d47=_0x305d51[_0x4b0d('0x9')](_0x399359,_0x4b0d('0xa'),'utf8');_0x5f4d47+=_0x305d51[_0x4b0d('0xb')](_0x4b0d('0xc'));var _0x5770cd=JSON[_0x4b0d('0xd')](_0x5f4d47);return _0x5770cd[_0x4b0d('0xe')](_0x418049)?_0x5770cd[_0x418049]:null;}}return null;}function isLimit(_0x1d0c74,_0x3d516e,_0x3fd0be,_0x3f8efb){var _0x5990b8=_0x3d516e;return compose()[_0x4b0d('0xf')](function(_0x3b3688,_0x599f58,_0x377a08){return db[_0x4b0d('0x10')][_0x4b0d('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x4b0d('0x12')](function(_0x5b488){var _0x526700=getValueFromLicense(_0x1d0c74,_0x5b488);return _0x526700?_0x526700:_0x5990b8;})['then'](function(_0x4b008b){_0x5990b8=_0x4b008b;return _0x3fd0be[_0x4b0d('0x13')](_0x3f8efb);})['then'](function(_0x331c7a){if(_0x331c7a>=_0x5990b8){return _0x599f58[_0x4b0d('0x14')](0x193)[_0x4b0d('0x15')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x1d0c74)});}_0x377a08();})[_0x4b0d('0x16')](function(_0x2a6aa8){_0x377a08(_0x2a6aa8);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x4b0d('0x17')],{'where':{'$or':[{'role':'admin'},{'role':_0x4b0d('0x18')}]}});}exports[_0x4b0d('0x19')]=isUserLimit;
\ No newline at end of file
index 0c3eae9..f68a208 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x750d=['lodash','moment','parseSearch','[$or]','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','LIKE\x20?','$lt','<\x20?','>\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','$endsWith','pop','utcOffset','hours','seconds'];(function(_0x11de69,_0x46c7c6){var _0x211379=function(_0x58c8dd){while(--_0x58c8dd){_0x11de69['push'](_0x11de69['shift']());}};_0x211379(++_0x46c7c6);}(_0x750d,0x118));var _0xd750=function(_0xdef98,_0x3001ab){_0xdef98=_0xdef98-0x0;var _0x58aa=_0x750d[_0xdef98];return _0x58aa;};'use strict';var _=require(_0xd750('0x0'));var moment=require(_0xd750('0x1'));exports[_0xd750('0x2')]=function(_0x203fd7){var _0x2a0c5a={'conditions':[]};_0x2a0c5a['sqlOperator']=_['startsWith'](_0x203fd7,_0xd750('0x3'))?'or':'and';var _0xdbe1fa=_0x203fd7[_0xd750('0x4')](_0xd750('0x5'),'')[_0xd750('0x4')](_0xd750('0x3'),'')[_0xd750('0x6')]('||');for(var _0x198045=0x0;_0x198045<_0xdbe1fa[_0xd750('0x7')];_0x198045++){var _0x221b5a=_0xdbe1fa[_0x198045][_0xd750('0x6')](':=');var _0x4bf1ef=_0x221b5a[0x0];var _0x22ce6f=_0x221b5a[_0xd750('0x8')](0x1);_0x22ce6f[_0xd750('0x9')](function(_0x1784cd){var _0x1c4ce3=_0x1784cd[_0xd750('0x6')]('[')[_0xd750('0xa')]();var _0x51fd9e=_0x1784cd[_0xd750('0xb')](/\[(.*?)\]/g);_0x51fd9e[_0xd750('0x9')](function(_0x26e071){var _0x367975=_0x26e071['split']('[')[_0xd750('0xc')](function(_0x50e517){return _0x50e517[_0xd750('0xd')](']')>-0x1;})['map'](function(_0x410aaf){return _0x410aaf['split'](']')[0x0];})[0x0];_0x2a0c5a[_0xd750('0xe')][_0xd750('0xf')]({'field':_0x4bf1ef,'operator':_0x1c4ce3,'value':_0x367975});});});}return _0x2a0c5a;};exports[_0xd750('0x10')]=function(_0xb9146f,_0x31b2ca,_0x317d9d){var _0x59404c={};if(_0x31b2ca===_0xd750('0x11')){if(_0x317d9d[_0xd750('0x12')]===_0xd750('0x13')){_0x317d9d[_0xd750('0x12')]=_0xd750('0x14');_0x317d9d[_0xd750('0x15')]+=','+_0x317d9d[_0xd750('0x15')];}else if(_[_0xd750('0x16')]([_0xd750('0x17'),'$lte'],_0x317d9d['operator'])){_0x317d9d[_0xd750('0x15')]=moment(_0x317d9d[_0xd750('0x15')])[_0xd750('0x18')](0x1,_0xd750('0x19'))[_0xd750('0x1a')](_0xd750('0x1b'));}}if(_0x317d9d[_0xd750('0x1c')]){_0x31b2ca=_0x317d9d['castTo'];_0x59404c[_0xd750('0x1d')]=_0xd750('0x1e')+_0xb9146f+'.'+_0x317d9d[_0xd750('0x1f')]+_0xd750('0x20')+_0x317d9d['castTo']+')\x20'+parseOperator(_0x317d9d[_0xd750('0x12')]);}else{_0x59404c[_0xd750('0x1d')]=_0xb9146f+'.'+_0x317d9d[_0xd750('0x1f')]+'\x20'+parseOperator(_0x317d9d[_0xd750('0x12')]);}if(_['includes']([_0xd750('0x21'),_0xd750('0x22')],_0x317d9d[_0xd750('0x12')]))_0x59404c[_0xd750('0x1d')]='('+_0x59404c[_0xd750('0x1d')]+_0xd750('0x23')+_0xb9146f+'.'+_0x317d9d[_0xd750('0x1f')]+'\x20IS\x20NULL)';_0x59404c[_0xd750('0x15')]=parseValue(_0x31b2ca,_0x317d9d['operator'],_0x317d9d[_0xd750('0x15')]);return _0x59404c;};function parseOperator(_0x3441ac){var _0x20d017;switch(_0x3441ac){case _0xd750('0x24'):_0x20d017=_0xd750('0x25');break;case'$notIn':_0x20d017=_0xd750('0x26');break;case'$eq':_0x20d017='=\x20?';break;case _0xd750('0x21'):_0x20d017=_0xd750('0x27');break;case'$substring':case'$startsWith':case'$endsWith':_0x20d017=_0xd750('0x28');break;case _0xd750('0x29'):_0x20d017=_0xd750('0x2a');break;case'$gt':_0x20d017=_0xd750('0x2b');break;case _0xd750('0x2c'):_0x20d017=_0xd750('0x2d');break;case _0xd750('0x2e'):_0x20d017=_0xd750('0x2f');break;case _0xd750('0x14'):_0x20d017=_0xd750('0x30');break;}return _0x20d017;}function parseValue(_0x1d204f,_0x398cb1,_0x187b75){var _0x8d8d52={'start':undefined,'end':undefined};switch(_0x398cb1){case _0xd750('0x24'):case'$notIn':_0x8d8d52[_0xd750('0x31')]=_0x187b75[_0xd750('0x6')](',');break;case _0xd750('0x32'):_0x8d8d52[_0xd750('0x31')]='%'+_0x187b75+'%';break;case'$startsWith':_0x8d8d52[_0xd750('0x31')]=_0x187b75+'%';break;case _0xd750('0x33'):_0x8d8d52['start']='%'+_0x187b75;break;case _0xd750('0x14'):var _0x7b6f44=_0x187b75[_0xd750('0x6')](',');var _0x187b75=_0x7b6f44[_0xd750('0xa')]();var _0x517daa=_0x7b6f44[_0xd750('0x34')]();if(_0x1d204f===_0xd750('0x11')){_0x187b75=moment(_0x187b75)[_0xd750('0x35')](0x0,!![])['format']();_0x517daa=moment(_0x517daa)[_0xd750('0x35')](0x0,!![])[_0xd750('0x18')](0x17,_0xd750('0x36'))['add'](0x3b,'minutes')[_0xd750('0x18')](0x3b,_0xd750('0x37'))[_0xd750('0x1a')]();}_0x8d8d52={'start':_0x187b75,'end':_0x517daa};break;default:_0x8d8d52[_0xd750('0x31')]=_0x187b75;break;}return _0x8d8d52;}
\ No newline at end of file
+var _0x26d6=['filter','indexOf','map','conditions','push','DATE','operator','$eq','$between','value','$lte','add','days','format','castTo','CAST(','text','field','includes','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','$startsWith','$endsWith','utcOffset','minutes','lodash','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','forEach','shift'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x26d6,0x134));var _0x626d=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x26d6[_0x3c4f1f];return _0x19cb69;};'use strict';var _=require(_0x626d('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x4870fa){var _0x4f8c96={'conditions':[]};_0x4f8c96[_0x626d('0x1')]=_[_0x626d('0x2')](_0x4870fa,_0x626d('0x3'))?'or':_0x626d('0x4');var _0x5ba348=_0x4870fa[_0x626d('0x5')](_0x626d('0x6'),'')[_0x626d('0x5')](_0x626d('0x3'),'')[_0x626d('0x7')]('||');for(var _0x574cc1=0x0;_0x574cc1<_0x5ba348['length'];_0x574cc1++){var _0x2e29e0=_0x5ba348[_0x574cc1][_0x626d('0x7')](':=');var _0x1b4c48=_0x2e29e0[0x0];var _0x31a0a6=_0x2e29e0['slice'](0x1);_0x31a0a6[_0x626d('0x8')](function(_0x17df09){var _0x5f0327=_0x17df09[_0x626d('0x7')]('[')[_0x626d('0x9')]();var _0xc9bda9=_0x17df09['match'](/\[(.*?)\]/g);_0xc9bda9[_0x626d('0x8')](function(_0x198cc5){var _0x2524b2=_0x198cc5[_0x626d('0x7')]('[')[_0x626d('0xa')](function(_0x362b04){return _0x362b04[_0x626d('0xb')](']')>-0x1;})[_0x626d('0xc')](function(_0x40f634){return _0x40f634[_0x626d('0x7')](']')[0x0];})[0x0];_0x4f8c96[_0x626d('0xd')][_0x626d('0xe')]({'field':_0x1b4c48,'operator':_0x5f0327,'value':_0x2524b2});});});}return _0x4f8c96;};exports['buildExpression']=function(_0x196a80,_0xa1c813,_0x2681d3){var _0x1a1a36={};if(_0xa1c813===_0x626d('0xf')){if(_0x2681d3[_0x626d('0x10')]===_0x626d('0x11')){_0x2681d3[_0x626d('0x10')]=_0x626d('0x12');_0x2681d3[_0x626d('0x13')]+=','+_0x2681d3[_0x626d('0x13')];}else if(_['includes'](['$gt',_0x626d('0x14')],_0x2681d3[_0x626d('0x10')])){_0x2681d3['value']=moment(_0x2681d3[_0x626d('0x13')])[_0x626d('0x15')](0x1,_0x626d('0x16'))[_0x626d('0x17')]('YYYY-MM-DD');}}if(_0x2681d3[_0x626d('0x18')]){_0xa1c813=_0x2681d3[_0x626d('0x18')];_0x1a1a36['text']=_0x626d('0x19')+_0x196a80+'.'+_0x2681d3['field']+'\x20AS\x20'+_0x2681d3[_0x626d('0x18')]+')\x20'+parseOperator(_0x2681d3['operator']);}else{_0x1a1a36[_0x626d('0x1a')]=_0x196a80+'.'+_0x2681d3[_0x626d('0x1b')]+'\x20'+parseOperator(_0x2681d3['operator']);}if(_[_0x626d('0x1c')](['$ne','$notIn'],_0x2681d3[_0x626d('0x10')]))_0x1a1a36[_0x626d('0x1a')]='('+_0x1a1a36[_0x626d('0x1a')]+_0x626d('0x1d')+_0x196a80+'.'+_0x2681d3[_0x626d('0x1b')]+_0x626d('0x1e');_0x1a1a36['value']=parseValue(_0xa1c813,_0x2681d3['operator'],_0x2681d3[_0x626d('0x13')]);return _0x1a1a36;};function parseOperator(_0x42c5e2){var _0x6b9bc6;switch(_0x42c5e2){case _0x626d('0x1f'):_0x6b9bc6=_0x626d('0x20');break;case _0x626d('0x21'):_0x6b9bc6=_0x626d('0x22');break;case _0x626d('0x11'):_0x6b9bc6=_0x626d('0x23');break;case _0x626d('0x24'):_0x6b9bc6=_0x626d('0x25');break;case'$substring':case'$startsWith':case'$endsWith':_0x6b9bc6=_0x626d('0x26');break;case _0x626d('0x27'):_0x6b9bc6=_0x626d('0x28');break;case _0x626d('0x29'):_0x6b9bc6=_0x626d('0x2a');break;case'$lte':_0x6b9bc6=_0x626d('0x2b');break;case _0x626d('0x2c'):_0x6b9bc6=_0x626d('0x2d');break;case _0x626d('0x12'):_0x6b9bc6=_0x626d('0x2e');break;}return _0x6b9bc6;}function parseValue(_0x2eea12,_0xc400e5,_0x5c4eb7){var _0x33e270={'start':undefined,'end':undefined};switch(_0xc400e5){case _0x626d('0x1f'):case _0x626d('0x21'):_0x33e270[_0x626d('0x2f')]=_0x5c4eb7['split'](',');break;case _0x626d('0x30'):_0x33e270[_0x626d('0x2f')]='%'+_0x5c4eb7+'%';break;case _0x626d('0x31'):_0x33e270['start']=_0x5c4eb7+'%';break;case _0x626d('0x32'):_0x33e270[_0x626d('0x2f')]='%'+_0x5c4eb7;break;case'$between':var _0x79a02e=_0x5c4eb7[_0x626d('0x7')](',');var _0x5c4eb7=_0x79a02e[_0x626d('0x9')]();var _0x23e169=_0x79a02e['pop']();if(_0x2eea12===_0x626d('0xf')){_0x5c4eb7=moment(_0x5c4eb7)[_0x626d('0x33')](0x0,!![])[_0x626d('0x17')]();_0x23e169=moment(_0x23e169)[_0x626d('0x33')](0x0,!![])['add'](0x17,'hours')[_0x626d('0x15')](0x3b,_0x626d('0x34'))['add'](0x3b,'seconds')[_0x626d('0x17')]();}_0x33e270={'start':_0x5c4eb7,'end':_0x23e169};break;default:_0x33e270[_0x626d('0x2f')]=_0x5c4eb7;break;}return _0x33e270;}
\ No newline at end of file
index 562a675..b62caa4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f47=['hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','map','intersection','model','attributes','nolimit','where','pick','filter','object','columns','value','merge','lower','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','find','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','limit','offset','sort','priority','cast','col','DESC','unsigned','ASC','isObject','isString','length','unset'];(function(_0x3bcf9e,_0x148a5d){var _0x1bb37c=function(_0xcaf5da){while(--_0xcaf5da){_0x3bcf9e['push'](_0x3bcf9e['shift']());}};_0x1bb37c(++_0x148a5d);}(_0x6f47,0xc7));var _0x76f4=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x6f47[_0x3c2a69];return _0x596bc8;};'use strict';var _=require('lodash');var sequelize=require(_0x76f4('0x0'));var moment=require(_0x76f4('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5bc799){var _0x2092f3=['ne'];try{var _0x5765c1=JSON[_0x76f4('0x2')](_0x5bc799);var _0x47d3e1=Object[_0x76f4('0x3')](_0x5765c1)[0x0];return _0x2092f3[_0x76f4('0x4')](_0x47d3e1);}catch(_0x2795ee){return![];}}function getOperatorValue(_0x2523ba){var _0x5754ca=JSON[_0x76f4('0x2')](_0x2523ba);var _0xfc2405=Object[_0x76f4('0x3')](_0x5754ca)[0x0];var _0x497f99=_0x5754ca[_0xfc2405];return{['$'+_0xfc2405]:_0x497f99};}exports[_0x76f4('0x5')]=function(_0x25656d){var _0x65d2c7=null;if(_0x25656d){_0x65d2c7=_0x25656d[_0x76f4('0x6')](',');}return _0x65d2c7;};exports[_0x76f4('0x7')]=function(_0x4c6b5c,_0x5367d6){var _0x3347ef={};if(!_[_0x76f4('0x8')](_0x4c6b5c)){_['forOwn'](_0x4c6b5c,function(_0x51d500,_0x3d8554){try{if(_0x5367d6){var _0x458c22=_[_0x76f4('0x9')](_0x5367d6,{'name':_0x3d8554})||{};if(hasSequelizeOperator(_0x51d500)){_0x3347ef[_0x3d8554]=getOperatorValue(_0x51d500);}else if(_0x458c22[_0x76f4('0xa')]===_0x76f4('0xb')&&_[_0x76f4('0xc')](_0x51d500)){var _0xf7e347=JSON[_0x76f4('0x2')](_0x51d500);var _0x2157f9={'$gte':moment(moment(_0xf7e347['$gte'])[_0x76f4('0xd')](_0x76f4('0xe')))['utc']()['format'](),'$lte':moment(moment(_0xf7e347['$lte'])[_0x76f4('0xd')](_0x76f4('0xe')))[_0x76f4('0xf')]()[_0x76f4('0x10')](0x1,'s')[_0x76f4('0xd')]()};_0x3347ef[_0x3d8554]=_0x2157f9;}else if(_0x458c22[_0x76f4('0x11')]===_0x76f4('0x12')){_0x3347ef[_0x3d8554]=_0x51d500;}else{_0x3347ef[_0x3d8554]=_[_0x76f4('0x13')](_0x51d500)?_0x51d500:JSON[_0x76f4('0x2')](_0x51d500);}}else{_0x3347ef[_0x3d8554]=_[_0x76f4('0x13')](_0x51d500)?_0x51d500:JSON[_0x76f4('0x2')](_0x51d500);}}catch(_0x2d4bd1){_0x3347ef[_0x3d8554]=_0x51d500[_0x76f4('0x6')](',');}});}return _0x3347ef;};exports[_0x76f4('0x14')]=function(_0x17625e){_0x17625e=parseInt(_0x17625e,0xa);if(!_0x17625e||_0x17625e<0x0){_0x17625e=LIMIT_VALUE;}return _0x17625e;};exports[_0x76f4('0x15')]=function(_0xfedbe4){_0xfedbe4=parseInt(_0xfedbe4,0xa);if(!_0xfedbe4||_0xfedbe4<0x0){_0xfedbe4=0x0;}return _0xfedbe4;};exports[_0x76f4('0x16')]=function(_0x435534){var _0x35b406,_0x46f057=null;if(_0x435534){_0x35b406=_0x435534[_0x76f4('0x6')](',');_0x46f057=_['map'](_0x35b406,function(_0x262937){if(_0x262937['indexOf']('-')===0x0){return[_0x262937===_0x76f4('0x17')?sequelize[_0x76f4('0x18')](sequelize[_0x76f4('0x19')]('priority'),'unsigned'):_0x262937['substr'](0x1),_0x76f4('0x1a')];}else{return[_0x262937===_0x76f4('0x17')?sequelize[_0x76f4('0x18')](sequelize[_0x76f4('0x19')](_0x76f4('0x17')),_0x76f4('0x1b')):_0x262937,_0x76f4('0x1c')];}});}return _0x46f057;};exports['omit']=function(_0x504aa8,_0x3794fa){if(_['isEmpty'](_0x504aa8)){return _0x504aa8;}if(_[_0x76f4('0x13')](_0x504aa8)){for(var _0x5355bd=0x0;_0x5355bd<_0x504aa8['length'];_0x5355bd+=0x1){_0x504aa8[_0x5355bd]=this['omit'](_0x504aa8[_0x5355bd],_0x3794fa);}return _0x504aa8;}if(!_[_0x76f4('0x1d')](_0x504aa8)){return _0x504aa8;}if(_[_0x76f4('0x1e')](_0x3794fa)){_0x3794fa=[_0x3794fa];}if(!_[_0x76f4('0x13')](_0x3794fa)){return _0x504aa8;}for(var _0x1d1fe6=0x0;_0x1d1fe6<_0x3794fa[_0x76f4('0x1f')];_0x1d1fe6+=0x1){_[_0x76f4('0x20')](_0x504aa8,_0x3794fa[_0x1d1fe6]);}for(var _0x5ca31f in _0x504aa8){if(_0x504aa8[_0x76f4('0x21')](_0x5ca31f)){_0x504aa8[_0x5ca31f]=this['omit'](_0x504aa8[_0x5ca31f],_0x3794fa);}}return _0x504aa8;};exports['isNumeric']=function(_0x5b3f07){return _0x5b3f07[_0x76f4('0x22')](RegExp(_0x76f4('0x23')))?!![]:![];};exports[_0x76f4('0x24')]=function(_0x1dea0e){return _0x1dea0e['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x76f4('0x25')]=function(_0x4f6f3a){var _0x259c26=[];_0x4f6f3a[_0x76f4('0x6')](/[ ,]+/)[_0x76f4('0x26')](function(_0x1c2c5c){_0x1c2c5c=_0x1c2c5c[_0x76f4('0x27')](/([^:]")"+/g,'$1');_0x1c2c5c='+'+_0x1c2c5c+'*';var _0x5a6fd4=/[ `!@#$%^&*()_\-?~]/;if(_0x1c2c5c['match'](_0x5a6fd4))_0x1c2c5c='\x22'+_0x1c2c5c+'\x22';_0x259c26[_0x76f4('0x28')](_0x1c2c5c);});return _0x259c26[_0x76f4('0x29')]('\x20');};exports[_0x76f4('0x2a')]=function(_0x281db6,_0x1f2adf,_0x3780b6){var _0x2a13ca={},_0x46ba77={};if(_0x1f2adf[_0x76f4('0x2b')][_0x76f4('0x2c')]){_0x1f2adf[_0x76f4('0x2b')]['id']=_0x1f2adf[_0x76f4('0x2b')]['$id'];delete _0x1f2adf['query']['$id'];}_0x2a13ca['model']=_[_0x76f4('0x2d')](_0x281db6,_0x76f4('0x11'));_0x2a13ca[_0x76f4('0x2b')]=_[_0x76f4('0x3')](_0x1f2adf[_0x76f4('0x2b')]);_0x2a13ca['filters']=_[_0x76f4('0x2e')](_0x2a13ca[_0x76f4('0x2f')],_0x2a13ca[_0x76f4('0x2b')]);_0x46ba77[_0x76f4('0x30')]=_[_0x76f4('0x2e')](_0x2a13ca[_0x76f4('0x2f')],this[_0x76f4('0x5')](_0x1f2adf[_0x76f4('0x2b')][_0x76f4('0x5')]));_0x46ba77[_0x76f4('0x30')]=_0x46ba77[_0x76f4('0x30')][_0x76f4('0x1f')]?_0x46ba77[_0x76f4('0x30')]:_0x2a13ca[_0x76f4('0x2f')];if(!_0x1f2adf[_0x76f4('0x2b')][_0x76f4('0x21')](_0x76f4('0x31'))){_0x46ba77[_0x76f4('0x14')]=this['limit'](_0x1f2adf[_0x76f4('0x2b')][_0x76f4('0x14')]);_0x46ba77[_0x76f4('0x15')]=this['offset'](_0x1f2adf['query'][_0x76f4('0x15')]);}_0x46ba77['order']=this[_0x76f4('0x16')](_0x1f2adf['query'][_0x76f4('0x16')]);_0x46ba77[_0x76f4('0x32')]=this[_0x76f4('0x7')](_[_0x76f4('0x33')](_0x1f2adf[_0x76f4('0x2b')],_0x2a13ca[_0x76f4('0x7')]),_0x281db6);if(_0x1f2adf[_0x76f4('0x2b')][_0x76f4('0x34')]){var _0x16779e=_0x281db6;var _0x80e29f=_0x1f2adf['query']['filter'];if(typeof _0x80e29f===_0x76f4('0x35')){_0x16779e=_[_0x76f4('0x34')](_0x281db6,function(_0x364cf7){return _[_0x76f4('0x4')](_0x80e29f[_0x76f4('0x36')],_0x364cf7[_0x76f4('0x11')]);});_0x80e29f=_0x80e29f[_0x76f4('0x37')];}_0x46ba77[_0x76f4('0x32')]=_[_0x76f4('0x38')](_0x46ba77['where'],{'$or':_[_0x76f4('0x2d')](_0x16779e,function(_0xe744af){if(_0xe744af['type']!=='VIRTUAL'){if(_0x3780b6){return sequelize[_0x76f4('0x32')](sequelize['fn'](_0x76f4('0x39'),sequelize[_0x76f4('0x19')](_0xe744af[_0x76f4('0x11')])),{'$like':sequelize['fn'](_0x76f4('0x39'),'%'+_0x1f2adf['query'][_0x76f4('0x34')]+'%')});}else{var _0x4126aa={};_0x4126aa[_0xe744af[_0x76f4('0x11')]]={'$like':'%'+_0x1f2adf[_0x76f4('0x2b')][_0x76f4('0x34')]+'%'};return _0x4126aa;}}})});}_0x46ba77=_[_0x76f4('0x38')]({},_0x46ba77,_0x1f2adf['options']);return _0x46ba77;};
\ No newline at end of file
+var _0xeff8=['^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','join','query','$id','filters','intersection','model','attributes','nolimit','order','pick','filter','columns','value','where','merge','VIRTUAL','lower','options','lodash','sequelize','keys','includes','parse','fields','split','isEmpty','find','type','$gte','format','utc','$lte','YYYY-MM-DD','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','cast','col','unsigned','DESC','priority','ASC','omit','length','isObject','isString','unset','hasOwnProperty','match'];(function(_0x2c8de4,_0x48ecd7){var _0xa5f1d5=function(_0x521b2a){while(--_0x521b2a){_0x2c8de4['push'](_0x2c8de4['shift']());}};_0xa5f1d5(++_0x48ecd7);}(_0xeff8,0x186));var _0x8eff=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0xeff8[_0x286726];return _0xcd4fe9;};'use strict';var _=require(_0x8eff('0x0'));var sequelize=require(_0x8eff('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x367eaf){var _0x354ff4=['ne'];try{var _0x1e55a0=JSON['parse'](_0x367eaf);var _0x2d7c9c=Object[_0x8eff('0x2')](_0x1e55a0)[0x0];return _0x354ff4[_0x8eff('0x3')](_0x2d7c9c);}catch(_0x2911b1){return![];}}function getOperatorValue(_0x4ac51c){var _0x469641=JSON[_0x8eff('0x4')](_0x4ac51c);var _0x3409bc=Object[_0x8eff('0x2')](_0x469641)[0x0];var _0x491f01=_0x469641[_0x3409bc];return{['$'+_0x3409bc]:_0x491f01};}exports[_0x8eff('0x5')]=function(_0x19557f){var _0x17f22b=null;if(_0x19557f){_0x17f22b=_0x19557f[_0x8eff('0x6')](',');}return _0x17f22b;};exports['filters']=function(_0x56f120,_0x359d62){var _0x430b45={};if(!_[_0x8eff('0x7')](_0x56f120)){_['forOwn'](_0x56f120,function(_0x2a87d2,_0x369b5d){try{if(_0x359d62){var _0x5172a5=_[_0x8eff('0x8')](_0x359d62,{'name':_0x369b5d})||{};if(hasSequelizeOperator(_0x2a87d2)){_0x430b45[_0x369b5d]=getOperatorValue(_0x2a87d2);}else if(_0x5172a5[_0x8eff('0x9')]==='DATE'&&_['isPlainObject'](_0x2a87d2)){var _0x45f280=JSON[_0x8eff('0x4')](_0x2a87d2);var _0xfa12bb={'$gte':moment(moment(_0x45f280[_0x8eff('0xa')])[_0x8eff('0xb')]('YYYY-MM-DD'))[_0x8eff('0xc')]()[_0x8eff('0xb')](),'$lte':moment(moment(_0x45f280[_0x8eff('0xd')])[_0x8eff('0xb')](_0x8eff('0xe')))[_0x8eff('0xc')]()[_0x8eff('0xf')](0x1,'s')[_0x8eff('0xb')]()};_0x430b45[_0x369b5d]=_0xfa12bb;}else if(_0x5172a5[_0x8eff('0x10')]===_0x8eff('0x11')){_0x430b45[_0x369b5d]=_0x2a87d2;}else{_0x430b45[_0x369b5d]=_[_0x8eff('0x12')](_0x2a87d2)?_0x2a87d2:JSON['parse'](_0x2a87d2);}}else{_0x430b45[_0x369b5d]=_[_0x8eff('0x12')](_0x2a87d2)?_0x2a87d2:JSON[_0x8eff('0x4')](_0x2a87d2);}}catch(_0x3cd1dc){_0x430b45[_0x369b5d]=_0x2a87d2[_0x8eff('0x6')](',');}});}return _0x430b45;};exports[_0x8eff('0x13')]=function(_0x3c800b){_0x3c800b=parseInt(_0x3c800b,0xa);if(!_0x3c800b||_0x3c800b<0x0){_0x3c800b=LIMIT_VALUE;}return _0x3c800b;};exports[_0x8eff('0x14')]=function(_0x399d96){_0x399d96=parseInt(_0x399d96,0xa);if(!_0x399d96||_0x399d96<0x0){_0x399d96=0x0;}return _0x399d96;};exports[_0x8eff('0x15')]=function(_0x198ee9){var _0x453c7a,_0x1b65f9=null;if(_0x198ee9){_0x453c7a=_0x198ee9[_0x8eff('0x6')](',');_0x1b65f9=_[_0x8eff('0x16')](_0x453c7a,function(_0xdbb7b5){if(_0xdbb7b5[_0x8eff('0x17')]('-')===0x0){return[_0xdbb7b5==='priority'?sequelize[_0x8eff('0x18')](sequelize[_0x8eff('0x19')]('priority'),_0x8eff('0x1a')):_0xdbb7b5['substr'](0x1),_0x8eff('0x1b')];}else{return[_0xdbb7b5===_0x8eff('0x1c')?sequelize[_0x8eff('0x18')](sequelize[_0x8eff('0x19')](_0x8eff('0x1c')),'unsigned'):_0xdbb7b5,_0x8eff('0x1d')];}});}return _0x1b65f9;};exports[_0x8eff('0x1e')]=function(_0x50784c,_0x15b66f){if(_[_0x8eff('0x7')](_0x50784c)){return _0x50784c;}if(_[_0x8eff('0x12')](_0x50784c)){for(var _0x3b698b=0x0;_0x3b698b<_0x50784c[_0x8eff('0x1f')];_0x3b698b+=0x1){_0x50784c[_0x3b698b]=this[_0x8eff('0x1e')](_0x50784c[_0x3b698b],_0x15b66f);}return _0x50784c;}if(!_[_0x8eff('0x20')](_0x50784c)){return _0x50784c;}if(_[_0x8eff('0x21')](_0x15b66f)){_0x15b66f=[_0x15b66f];}if(!_['isArray'](_0x15b66f)){return _0x50784c;}for(var _0x3e1607=0x0;_0x3e1607<_0x15b66f[_0x8eff('0x1f')];_0x3e1607+=0x1){_[_0x8eff('0x22')](_0x50784c,_0x15b66f[_0x3e1607]);}for(var _0xb88ce9 in _0x50784c){if(_0x50784c[_0x8eff('0x23')](_0xb88ce9)){_0x50784c[_0xb88ce9]=this[_0x8eff('0x1e')](_0x50784c[_0xb88ce9],_0x15b66f);}}return _0x50784c;};exports['isNumeric']=function(_0x4ed3b8){return _0x4ed3b8[_0x8eff('0x24')](RegExp(_0x8eff('0x25')))?!![]:![];};exports[_0x8eff('0x26')]=function(_0x5ce071){return _0x5ce071[_0x8eff('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x8eff('0x27')]=function(_0x229e0d){var _0x1da0fa=[];_0x229e0d[_0x8eff('0x6')](/[ ,]+/)[_0x8eff('0x28')](function(_0x141bd7){_0x141bd7=_0x141bd7[_0x8eff('0x29')](/([^:]")"+/g,'$1');_0x141bd7='+'+_0x141bd7+'*';var _0x36a613=/[ `!@#$%^&*()_\-?~]/;if(_0x141bd7[_0x8eff('0x24')](_0x36a613))_0x141bd7='\x22'+_0x141bd7+'\x22';_0x1da0fa[_0x8eff('0x2a')](_0x141bd7);});return _0x1da0fa[_0x8eff('0x2b')]('\x20');};exports['getOptions']=function(_0x2ad4b7,_0x165f8e,_0x115fa4){var _0x7da1fb={},_0x50f211={};if(_0x165f8e[_0x8eff('0x2c')][_0x8eff('0x2d')]){_0x165f8e['query']['id']=_0x165f8e['query'][_0x8eff('0x2d')];delete _0x165f8e[_0x8eff('0x2c')]['$id'];}_0x7da1fb['model']=_['map'](_0x2ad4b7,_0x8eff('0x10'));_0x7da1fb['query']=_[_0x8eff('0x2')](_0x165f8e['query']);_0x7da1fb[_0x8eff('0x2e')]=_[_0x8eff('0x2f')](_0x7da1fb[_0x8eff('0x30')],_0x7da1fb[_0x8eff('0x2c')]);_0x50f211[_0x8eff('0x31')]=_[_0x8eff('0x2f')](_0x7da1fb['model'],this[_0x8eff('0x5')](_0x165f8e['query'][_0x8eff('0x5')]));_0x50f211['attributes']=_0x50f211[_0x8eff('0x31')][_0x8eff('0x1f')]?_0x50f211[_0x8eff('0x31')]:_0x7da1fb[_0x8eff('0x30')];if(!_0x165f8e['query'][_0x8eff('0x23')](_0x8eff('0x32'))){_0x50f211[_0x8eff('0x13')]=this['limit'](_0x165f8e[_0x8eff('0x2c')][_0x8eff('0x13')]);_0x50f211[_0x8eff('0x14')]=this[_0x8eff('0x14')](_0x165f8e[_0x8eff('0x2c')][_0x8eff('0x14')]);}_0x50f211[_0x8eff('0x33')]=this[_0x8eff('0x15')](_0x165f8e[_0x8eff('0x2c')]['sort']);_0x50f211['where']=this[_0x8eff('0x2e')](_[_0x8eff('0x34')](_0x165f8e[_0x8eff('0x2c')],_0x7da1fb[_0x8eff('0x2e')]),_0x2ad4b7);if(_0x165f8e[_0x8eff('0x2c')][_0x8eff('0x35')]){var _0x18b132=_0x2ad4b7;var _0x5acc86=_0x165f8e[_0x8eff('0x2c')][_0x8eff('0x35')];if(typeof _0x5acc86==='object'){_0x18b132=_[_0x8eff('0x35')](_0x2ad4b7,function(_0x1ad6b3){return _[_0x8eff('0x3')](_0x5acc86[_0x8eff('0x36')],_0x1ad6b3[_0x8eff('0x10')]);});_0x5acc86=_0x5acc86[_0x8eff('0x37')];}_0x50f211[_0x8eff('0x38')]=_[_0x8eff('0x39')](_0x50f211[_0x8eff('0x38')],{'$or':_['map'](_0x18b132,function(_0x37f376){if(_0x37f376[_0x8eff('0x9')]!==_0x8eff('0x3a')){if(_0x115fa4){return sequelize[_0x8eff('0x38')](sequelize['fn'](_0x8eff('0x3b'),sequelize['col'](_0x37f376[_0x8eff('0x10')])),{'$like':sequelize['fn']('lower','%'+_0x165f8e[_0x8eff('0x2c')][_0x8eff('0x35')]+'%')});}else{var _0x1e9d99={};_0x1e9d99[_0x37f376[_0x8eff('0x10')]]={'$like':'%'+_0x165f8e['query'][_0x8eff('0x35')]+'%'};return _0x1e9d99;}}})});}_0x50f211=_[_0x8eff('0x39')]({},_0x50f211,_0x165f8e[_0x8eff('0x3c')]);return _0x50f211;};
\ No newline at end of file
index 30af2cd..b181623 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x38e558,_0x2937e9){var _0x2b1048=function(_0x5f23cd){while(--_0x5f23cd){_0x38e558['push'](_0x38e558['shift']());}};_0x2b1048(++_0x2937e9);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());};
\ No newline at end of file
+var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x5e875b,_0x38b586){var _0x3e2185=function(_0x2829b0){while(--_0x2829b0){_0x5e875b['push'](_0x5e875b['shift']());}};_0x3e2185(++_0x38b586);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());};
\ No newline at end of file
index 4ac2932..c87aaf0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe7bd=['execSync','../environment','networkInterfaces','keys','length','filter','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','model','join','md5','update','digest','hex','licenseToken','test','hostname','createHash','substring','lodash','bimedia-machine-uuid'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xe7bd,0x132));var _0xde7b=function(_0x11deef,_0x34bbdb){_0x11deef=_0x11deef-0x0;var _0xe9ba85=_0xe7bd[_0x11deef];return _0xe9ba85;};'use strict';var _=require(_0xde7b('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xde7b('0x1'));var exec=require('child_process')[_0xde7b('0x2')];var config=require(_0xde7b('0x3'));function getInterfaces(){var _0x44e07c=[];var _0x2058f8=os[_0xde7b('0x4')]();var _0x77bb9=_['orderBy'](_[_0xde7b('0x5')](_0x2058f8));for(var _0x3d3e59=0x0;_0x3d3e59<_0x77bb9[_0xde7b('0x6')];_0x3d3e59++){var _0x84a917=_0x2058f8[_0x77bb9[_0x3d3e59]][_0xde7b('0x7')](function(_0x2bd8c6){return _0x2bd8c6[_0xde7b('0x8')]===_0xde7b('0x9')&&_0x2bd8c6[_0xde7b('0xa')]===![];});_0x44e07c=_0x44e07c['concat'](_0x84a917);}return _0x44e07c;}function getFirstInterface(){var _0x419d02=_[_0xde7b('0xb')](getInterfaces());return{'macAddress':_0x419d02&&_0x419d02[_0xde7b('0xc')]?_0x419d02['mac']:_0xde7b('0xd'),'ipAddress':_0x419d02&&_0x419d02[_0xde7b('0xe')]?_0x419d02[_0xde7b('0xe')]:_0xde7b('0xf')};}exports[_0xde7b('0x10')]=getFirstInterface;function getCPUhash(){var _0x49c235=_['orderBy'](os['cpus']()['map'](function(_0x2404cc){return _0x2404cc[_0xde7b('0x11')];}))[_0xde7b('0x12')](':');return crypto['createHash'](_0xde7b('0x13'))[_0xde7b('0x14')](_0x49c235)[_0xde7b('0x15')](_0xde7b('0x16'));}exports['getUuid']=function(){var _0x37fde6=os['platform']();var _0x543776=/[0-9a-f-]{36}/;if(config[_0xde7b('0x17')]&&_0x543776[_0xde7b('0x18')](config[_0xde7b('0x17')])){return config[_0xde7b('0x17')];}else if(_0x37fde6==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x183356=getFirstInterface();var _0x4ec5d3=getCPUhash();var _0x301c6f=_0x4ec5d3+'|'+os[_0xde7b('0x19')]()+'|'+_0x183356['macAddress']+'|'+_0x183356['ipAddress'];var _0x228aa5=crypto[_0xde7b('0x1a')]('md5')['update'](_0x301c6f)[_0xde7b('0x15')](_0xde7b('0x16'));return _0x228aa5[_0xde7b('0x1b')](0x0,0x8)+'-'+_0x228aa5['substring'](0x8,0xc)+'-'+_0x228aa5['substring'](0xc,0x10)+'-'+_0x228aa5['substring'](0x10,0x14)+'-'+_0x228aa5['substring'](0x14);}};
\ No newline at end of file
+var _0xd3c5=['networkInterfaces','orderBy','keys','length','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','join','createHash','update','digest','hex','getUuid','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment'];(function(_0x1b83e9,_0x3fd16e){var _0x371112=function(_0x8bd6a9){while(--_0x8bd6a9){_0x1b83e9['push'](_0x1b83e9['shift']());}};_0x371112(++_0x3fd16e);}(_0xd3c5,0x8a));var _0x5d3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd3c5[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5d3c('0x0'));var os=require('os');var crypto=require(_0x5d3c('0x1'));var machine=require(_0x5d3c('0x2'));var exec=require(_0x5d3c('0x3'))[_0x5d3c('0x4')];var config=require(_0x5d3c('0x5'));function getInterfaces(){var _0x1b52bc=[];var _0x3bc424=os[_0x5d3c('0x6')]();var _0x1be905=_[_0x5d3c('0x7')](_[_0x5d3c('0x8')](_0x3bc424));for(var _0x3207bc=0x0;_0x3207bc<_0x1be905[_0x5d3c('0x9')];_0x3207bc++){var _0x443226=_0x3bc424[_0x1be905[_0x3207bc]]['filter'](function(_0x560cc6){return _0x560cc6[_0x5d3c('0xa')]===_0x5d3c('0xb')&&_0x560cc6[_0x5d3c('0xc')]===![];});_0x1b52bc=_0x1b52bc['concat'](_0x443226);}return _0x1b52bc;}function getFirstInterface(){var _0x1613d7=_[_0x5d3c('0xd')](getInterfaces());return{'macAddress':_0x1613d7&&_0x1613d7['mac']?_0x1613d7[_0x5d3c('0xe')]:_0x5d3c('0xf'),'ipAddress':_0x1613d7&&_0x1613d7[_0x5d3c('0x10')]?_0x1613d7[_0x5d3c('0x10')]:'127.0.0.1'};}exports[_0x5d3c('0x11')]=getFirstInterface;function getCPUhash(){var _0x314ef9=_[_0x5d3c('0x7')](os[_0x5d3c('0x12')]()[_0x5d3c('0x13')](function(_0x46cc75){return _0x46cc75[_0x5d3c('0x14')];}))[_0x5d3c('0x15')](':');return crypto[_0x5d3c('0x16')]('md5')[_0x5d3c('0x17')](_0x314ef9)[_0x5d3c('0x18')](_0x5d3c('0x19'));}exports[_0x5d3c('0x1a')]=function(){var _0x523602=os['platform']();var _0x222ad3=/[0-9a-f-]{36}/;if(config[_0x5d3c('0x1b')]&&_0x222ad3[_0x5d3c('0x1c')](config[_0x5d3c('0x1b')])){return config[_0x5d3c('0x1b')];}else if(_0x523602==='win32'){return exec(_0x5d3c('0x1d'),{'encoding':_0x5d3c('0x1e')})[_0x5d3c('0x1f')]('\x0d\x0a','');}else{var _0x115a9a=getFirstInterface();var _0x5f42f4=getCPUhash();var _0x137922=_0x5f42f4+'|'+os[_0x5d3c('0x20')]()+'|'+_0x115a9a['macAddress']+'|'+_0x115a9a[_0x5d3c('0x21')];var _0x5118b4=crypto['createHash'](_0x5d3c('0x22'))[_0x5d3c('0x17')](_0x137922)[_0x5d3c('0x18')](_0x5d3c('0x19'));return _0x5118b4['substring'](0x0,0x8)+'-'+_0x5118b4['substring'](0x8,0xc)+'-'+_0x5118b4[_0x5d3c('0x23')](0xc,0x10)+'-'+_0x5118b4['substring'](0x10,0x14)+'-'+_0x5118b4[_0x5d3c('0x23')](0x14);}};
\ No newline at end of file
index aa5d362..f83a55b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3889=['%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','version','then','catch','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format'];(function(_0x29c3f8,_0x53a97f){var _0x18ad8c=function(_0x312404){while(--_0x312404){_0x29c3f8['push'](_0x29c3f8['shift']());}};_0x18ad8c(++_0x53a97f);}(_0x3889,0x16a));var _0x9388=function(_0x4e80cf,_0x413318){_0x4e80cf=_0x4e80cf-0x0;var _0x1e37c6=_0x3889[_0x4e80cf];return _0x1e37c6;};'use strict';var util=require('util');var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0x9388('0x0'));var pkginfo=require(_0x9388('0x1'))(module,'version');var db=require(_0x9388('0x2'))['db'];var encryptor=require(_0x9388('0x3'));var hardware=require(_0x9388('0x4'));var logger=require('../logger')(_0x9388('0x5'));var HOST=_0x9388('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5a608d){return new BPromise(function(_0x54be64,_0xcfd918){var _0xd7df92=util[_0x9388('0x7')](_0x9388('0x8'),HOST,_0x5a608d,module[_0x9388('0x9')]['version']);if(oldToken){_0xd7df92=util[_0x9388('0x7')](_0x9388('0xa'),HOST,_0x5a608d,module['exports'][_0x9388('0xb')],oldToken);}var _0x37a769={'uri':_0xd7df92,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x37a769)[_0x9388('0xc')](function(_0x3b347a){_0x54be64(_0x3b347a);})[_0x9388('0xd')](function(_0x125974){_0xcfd918(_0x125974);});});}function manageLicense(_0x172a95,_0x1258f8){var _0x4e632e=_0x1258f8['get']({'plain':!![]});if(!isOldTokenSent&&_0x4e632e[_0x9388('0xe')]!==_0x172a95&&!_0x4e632e['data2']){oldToken=_0x4e632e[_0x9388('0xe')];}httpRequest(_0x172a95)['then'](function(_0x5d7815){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5d7815[_0x9388('0xf')]){isOldTokenSent=![];if(!_0x4e632e[_0x9388('0x5')]&&_0x4e632e[_0x9388('0x5')]!=_0x5d7815[_0x9388('0x5')]||_0x4e632e[_0x9388('0x5')]&&_0x4e632e['data2']){logger[_0x9388('0x10')](_0x9388('0x11'));}if(_0x4e632e['license']&&!_0x4e632e['data2']&&_0x4e632e['license']!=_0x5d7815[_0x9388('0x5')]){logger[_0x9388('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x4e632e['license']&&!_0x4e632e[_0x9388('0x12')]&&_0x4e632e[_0x9388('0x5')]==_0x5d7815[_0x9388('0x5')]){return _0x1258f8;}return _0x1258f8[_0x9388('0x13')]({'data1':_0x172a95,'data2':null,'license':_0x5d7815[_0x9388('0x5')]});}else{if(_0x5d7815['license']||_0x4e632e[_0x9388('0x5')]){if(!_0x4e632e[_0x9388('0x12')]){if(_0x4e632e[_0x9388('0xe')]==_0x172a95){GRAY_PERIOD_REASON='Disabled';logger[_0x9388('0x10')](_0x9388('0x14'));}else{GRAY_PERIOD_REASON=_0x9388('0x15');logger['info'](_0x9388('0x16'),_0x4e632e[_0x9388('0xe')],_0x172a95);}logger['info'](_0x9388('0x17'),GRAY_PERIOD_REASON[_0x9388('0x18')](),moment()['format'](_0x9388('0x19')));return _0x1258f8[_0x9388('0x13')]({'data2':encryptor[_0x9388('0x1a')](moment()[_0x9388('0x7')](_0x9388('0x19')))});}else{if(moment()[_0x9388('0x1b')](encryptor[_0x9388('0x1c')](_0x4e632e[_0x9388('0x12')]),'days')>DAYS){logger[_0x9388('0x10')](_0x9388('0x1d'),moment()[_0x9388('0x7')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x1258f8[_0x9388('0x13')]({'data1':_0x172a95,'data2':null,'license':null});}}}else{if(_0x4e632e[_0x9388('0xe')]!=_0x172a95){logger[_0x9388('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4e632e['data1'],_0x172a95);return _0x1258f8[_0x9388('0x13')]({'data1':_0x172a95,'data2':null,'license':null});}}}return _0x1258f8;})[_0x9388('0xc')](function(_0x2889fd){_0x1258f8=_0x2889fd;})[_0x9388('0xd')](function(_0x43e01d){logger[_0x9388('0x1e')](_0x43e01d['message']);})[_0x9388('0x1f')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x1258f8);},TIME);});}function defaultLicense(){var _0x4bb759=hardware[_0x9388('0x20')]();if(_0x4bb759){return db['License'][_0x9388('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x4bb759}})[_0x9388('0x22')](function(_0x493468,_0x192724){logger[_0x9388('0x10')](_0x9388('0x23'),_0x4bb759);manageLicense(_0x4bb759,_0x493468);})[_0x9388('0xd')](function(_0x352dd3){logger[_0x9388('0x1e')](_0x352dd3[_0x9388('0x24')]);});}}exports['default']=defaultLicense;
\ No newline at end of file
+var _0x0201=['bluebird','pkginfo','version','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','exports','GET','then','catch','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','encryptString','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','error','message','finally','getUuid','License','default','util','moment','request-promise'];(function(_0x2fdee1,_0x466858){var _0x2c5533=function(_0x1f34de){while(--_0x1f34de){_0x2fdee1['push'](_0x2fdee1['shift']());}};_0x2c5533(++_0x466858);}(_0x0201,0x8d));var _0x1020=function(_0x259022,_0x526152){_0x259022=_0x259022-0x0;var _0x5c2f3a=_0x0201[_0x259022];return _0x5c2f3a;};'use strict';var util=require(_0x1020('0x0'));var moment=require(_0x1020('0x1'));var rp=require(_0x1020('0x2'));var BPromise=require(_0x1020('0x3'));var pkginfo=require(_0x1020('0x4'))(module,_0x1020('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x1020('0x6'));var hardware=require(_0x1020('0x7'));var logger=require('../logger')(_0x1020('0x8'));var HOST=_0x1020('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x35b40c){return new BPromise(function(_0x431c90,_0x25a725){var _0x6479c=util[_0x1020('0xa')]('%s/api/servers/%s/check?version=%s',HOST,_0x35b40c,module[_0x1020('0xb')][_0x1020('0x5')]);if(oldToken){_0x6479c=util[_0x1020('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x35b40c,module['exports']['version'],oldToken);}var _0x3c486a={'uri':_0x6479c,'method':_0x1020('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x3c486a)[_0x1020('0xd')](function(_0x596645){_0x431c90(_0x596645);})[_0x1020('0xe')](function(_0x52c718){_0x25a725(_0x52c718);});});}function manageLicense(_0x25b74f,_0x2f1e69){var _0x2ca34c=_0x2f1e69['get']({'plain':!![]});if(!isOldTokenSent&&_0x2ca34c[_0x1020('0xf')]!==_0x25b74f&&!_0x2ca34c['data2']){oldToken=_0x2ca34c[_0x1020('0xf')];}httpRequest(_0x25b74f)['then'](function(_0x1b123c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1b123c[_0x1020('0x10')]){isOldTokenSent=![];if(!_0x2ca34c[_0x1020('0x8')]&&_0x2ca34c['license']!=_0x1b123c['license']||_0x2ca34c[_0x1020('0x8')]&&_0x2ca34c['data2']){logger['info'](_0x1020('0x11'));}if(_0x2ca34c[_0x1020('0x8')]&&!_0x2ca34c[_0x1020('0x12')]&&_0x2ca34c[_0x1020('0x8')]!=_0x1b123c['license']){logger[_0x1020('0x13')](_0x1020('0x14'));}if(_0x2ca34c[_0x1020('0x8')]&&!_0x2ca34c['data2']&&_0x2ca34c[_0x1020('0x8')]==_0x1b123c[_0x1020('0x8')]){return _0x2f1e69;}return _0x2f1e69[_0x1020('0x15')]({'data1':_0x25b74f,'data2':null,'license':_0x1b123c['license']});}else{if(_0x1b123c['license']||_0x2ca34c[_0x1020('0x8')]){if(!_0x2ca34c[_0x1020('0x12')]){if(_0x2ca34c[_0x1020('0xf')]==_0x25b74f){GRAY_PERIOD_REASON=_0x1020('0x16');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x1020('0x17');logger[_0x1020('0x13')](_0x1020('0x18'),_0x2ca34c[_0x1020('0xf')],_0x25b74f);}logger[_0x1020('0x13')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x1020('0x19')](),moment()[_0x1020('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x2f1e69['update']({'data2':encryptor[_0x1020('0x1a')](moment()[_0x1020('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor['decryptString'](_0x2ca34c[_0x1020('0x12')]),_0x1020('0x1b'))>DAYS){logger[_0x1020('0x13')](_0x1020('0x1c'),moment()['format'](_0x1020('0x1d')));isOldTokenSent=![];return _0x2f1e69['update']({'data1':_0x25b74f,'data2':null,'license':null});}}}else{if(_0x2ca34c[_0x1020('0xf')]!=_0x25b74f){logger[_0x1020('0x13')](_0x1020('0x18'),_0x2ca34c[_0x1020('0xf')],_0x25b74f);return _0x2f1e69[_0x1020('0x15')]({'data1':_0x25b74f,'data2':null,'license':null});}}}return _0x2f1e69;})['then'](function(_0xd0ce2d){_0x2f1e69=_0xd0ce2d;})[_0x1020('0xe')](function(_0x22ddb6){logger[_0x1020('0x1e')](_0x22ddb6[_0x1020('0x1f')]);})[_0x1020('0x20')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x2f1e69);},TIME);});}function defaultLicense(){var _0x46e8a1=hardware[_0x1020('0x21')]();if(_0x46e8a1){return db[_0x1020('0x22')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x46e8a1}})['spread'](function(_0x125871,_0x38b2d9){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x46e8a1);manageLicense(_0x46e8a1,_0x125871);})[_0x1020('0xe')](function(_0x20f6da){logger[_0x1020('0x1e')](_0x20f6da['message']);});}}exports[_0x1020('0x23')]=defaultLicense;
\ No newline at end of file
index 8f5d96d..cdb920c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0c49=['gray','deadline','add','days','grayReason','machineUuid','changed','disabled','message','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','data2','split','decryptString','format','%s:%s:%s','parse','demo'];(function(_0x368b5b,_0x43fab9){var _0x4853e8=function(_0x1abe49){while(--_0x1abe49){_0x368b5b['push'](_0x368b5b['shift']());}};_0x4853e8(++_0x43fab9);}(_0x0c49,0x1e3));var _0x90c4=function(_0x137d1e,_0x25bebf){_0x137d1e=_0x137d1e-0x0;var _0xee6c0b=_0x0c49[_0x137d1e];return _0xee6c0b;};'use strict';var util=require(_0x90c4('0x0'));var _=require(_0x90c4('0x1'));var moment=require('moment');var BPromise=require(_0x90c4('0x2'));var hardware=require(_0x90c4('0x3'));var encryptor=require(_0x90c4('0x4'));var db=require(_0x90c4('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x90c4('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x90c4('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x90c4('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x23065c){return new BPromise(function(_0x599510,_0x3f2722){return db[_0x90c4('0x9')][_0x90c4('0xa')](_[_0x90c4('0xb')](_0x23065c,{'raw':!![],'where':{'id':0x1}}))[_0x90c4('0xc')](function(_0x2fa76a){return checkLicense(_0x2fa76a,null);})[_0x90c4('0xc')](function(_0x543157){_0x599510(_0x543157);return;})[_0x90c4('0xd')](function(_0xafc04b){_0x3f2722(_0xafc04b);});});}function checkLicense(_0x1b4f68,_0x33355e){if(!_0x1b4f68){demoLicense[_0x90c4('0xe')]=_0x1b4f68[_0x90c4('0xf')];return demoLicense;}try{var _0x3dcf5e=_0x33355e||_0x1b4f68['license'];if(_['isEmpty'](_0x3dcf5e)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x555079=_0x1b4f68['data1'];var _0x16c66a=_0x1b4f68[_0x90c4('0x10')];var _0x4fff1a=_0x555079[_0x90c4('0x11')]('-')[0x4];var _0x1f0dc0=_0x555079[_0x90c4('0x11')]('-')[0x0];var _0x32ee13=encryptor[_0x90c4('0x12')](_0x3dcf5e,util[_0x90c4('0x13')](_0x90c4('0x14'),_0x4fff1a,_0x555079,_0x1f0dc0));var _0x6c9836=JSON[_0x90c4('0x15')](_0x32ee13);_0x6c9836[_0x90c4('0x16')]=![];_0x6c9836['uuid']=_0x555079;_0x6c9836['machineUuid']=hardware['getUuid']();if(_0x16c66a){var _0x32661c=encryptor['decryptString'](_0x16c66a);_0x6c9836[_0x90c4('0x17')]=_0x32661c;_0x6c9836[_0x90c4('0x18')]=moment(_0x32661c)[_0x90c4('0x19')](0x7,_0x90c4('0x1a'))[_0x90c4('0x13')]();_0x6c9836[_0x90c4('0x1b')]=_0x6c9836['uuid']!=_0x6c9836[_0x90c4('0x1c')]?_0x90c4('0x1d'):_0x90c4('0x1e');}return _0x6c9836;}catch(_0x9549d9){breakingLicense[_0x90c4('0xe')]=_0x1b4f68[_0x90c4('0xf')];breakingLicense[_0x90c4('0x1f')]=_0x9549d9['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1f7c17,_0x2125c6){getLicense()[_0x90c4('0xc')](function(_0x36c0ea){return db['User'][_0x90c4('0x20')]({'attributes':[_0x90c4('0x21'),[db[_0x90c4('0x22')]['fn'](_0x90c4('0x23'),db[_0x90c4('0x22')][_0x90c4('0x24')]('role')),_0x90c4('0x25')]],'group':_0x90c4('0x21'),'where':{'role':{'$or':[_0x90c4('0x26'),_0x90c4('0x27'),_0x90c4('0x28')]}},'raw':!![]})[_0x90c4('0xc')](function(_0x29084f){var _0x2b230e={'user':_0x36c0ea['users']||0x0,'telephone':_0x36c0ea[_0x90c4('0x29')]||0x0};_0x29084f[_0x90c4('0x2a')](function(_0x5c3c2f){var _0x545d03=_0x5c3c2f['role']===_0x90c4('0x26')?_0x90c4('0x27'):_0x5c3c2f['role'];_0x2b230e[_0x545d03]-=_0x5c3c2f['count'];if(_0x2b230e[_0x545d03]<0x0)_0x2b230e[_0x545d03]=0x0;});_0x1f7c17(_0x2b230e);return;});})[_0x90c4('0xd')](function(_0x257f74){_0x2125c6(_0x257f74);});});}function checkUserLimits(_0x349d2b){return new BPromise(function(_0x34ab28,_0x556647){getLimits()[_0x90c4('0xc')](function(_0x5ad53e){var _0x10168a=_[_0x90c4('0x2b')](_[_0x90c4('0x2c')](_0x349d2b,'role'),[_0x90c4('0x26'),_0x90c4('0x27'),_0x90c4('0x28')]);var _0x2ff89c=(_0x10168a[_0x90c4('0x26')]||0x0)+(_0x10168a[_0x90c4('0x27')]||0x0);var _0x329105=_0x10168a[_0x90c4('0x28')]||0x0;if(_0x2ff89c>_0x5ad53e[_0x90c4('0x27')])return _0x556647(_0x90c4('0x2d'));if(_0x329105>_0x5ad53e['telephone'])return _0x556647('License\x20limit\x20reached\x20for\x20telephones');return _0x34ab28();})[_0x90c4('0xd')](function(_0x204aa7){_0x556647(_0x204aa7);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense};
\ No newline at end of file
+var _0x685e=['uuid','gray','deadline','add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','admin','user','telephone','users','telephones','forEach','count','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse'];(function(_0x53f125,_0x4ba12e){var _0x209b38=function(_0x67892c){while(--_0x67892c){_0x53f125['push'](_0x53f125['shift']());}};_0x209b38(++_0x4ba12e);}(_0x685e,0x1de));var _0xe685=function(_0x403115,_0x2d6d03){_0x403115=_0x403115-0x0;var _0x596ef3=_0x685e[_0x403115];return _0x596ef3;};'use strict';var util=require('util');var _=require(_0xe685('0x0'));var moment=require(_0xe685('0x1'));var BPromise=require(_0xe685('0x2'));var hardware=require(_0xe685('0x3'));var encryptor=require(_0xe685('0x4'));var db=require(_0xe685('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xe685('0x6'),'machineUuid':hardware[_0xe685('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe685('0x8'),'machineUuid':hardware[_0xe685('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x201397){return new BPromise(function(_0x4ac4ca,_0x1b3c88){return db[_0xe685('0x9')][_0xe685('0xa')](_[_0xe685('0xb')](_0x201397,{'raw':!![],'where':{'id':0x1}}))[_0xe685('0xc')](function(_0x8e2c79){return checkLicense(_0x8e2c79,null);})['then'](function(_0x7d7efe){_0x4ac4ca(_0x7d7efe);return;})['catch'](function(_0x591965){_0x1b3c88(_0x591965);});});}function checkLicense(_0x493f26,_0x3bbe11){if(!_0x493f26){demoLicense['uuid']=_0x493f26[_0xe685('0xd')];return demoLicense;}try{var _0x498bce=_0x3bbe11||_0x493f26[_0xe685('0xe')];if(_[_0xe685('0xf')](_0x498bce)){throw new Error(_0xe685('0x10'));}var _0x266213=_0x493f26[_0xe685('0xd')];var _0x4b50b4=_0x493f26['data2'];var _0x4e9265=_0x266213[_0xe685('0x11')]('-')[0x4];var _0x375b26=_0x266213[_0xe685('0x11')]('-')[0x0];var _0x3fadc2=encryptor[_0xe685('0x12')](_0x498bce,util[_0xe685('0x13')](_0xe685('0x14'),_0x4e9265,_0x266213,_0x375b26));var _0x5bc7ef=JSON[_0xe685('0x15')](_0x3fadc2);_0x5bc7ef['demo']=![];_0x5bc7ef[_0xe685('0x16')]=_0x266213;_0x5bc7ef['machineUuid']=hardware[_0xe685('0x7')]();if(_0x4b50b4){var _0x185699=encryptor['decryptString'](_0x4b50b4);_0x5bc7ef[_0xe685('0x17')]=_0x185699;_0x5bc7ef[_0xe685('0x18')]=moment(_0x185699)[_0xe685('0x19')](0x7,_0xe685('0x1a'))[_0xe685('0x13')]();_0x5bc7ef[_0xe685('0x1b')]=_0x5bc7ef['uuid']!=_0x5bc7ef['machineUuid']?_0xe685('0x1c'):_0xe685('0x1d');}return _0x5bc7ef;}catch(_0xa9c340){breakingLicense[_0xe685('0x16')]=_0x493f26[_0xe685('0xd')];breakingLicense['message']=_0xa9c340[_0xe685('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5665cd,_0x32e052){getLicense()[_0xe685('0xc')](function(_0x5c9323){return db[_0xe685('0x1f')][_0xe685('0x20')]({'attributes':[_0xe685('0x21'),[db[_0xe685('0x22')]['fn'](_0xe685('0x23'),db[_0xe685('0x22')][_0xe685('0x24')](_0xe685('0x21'))),'count']],'group':'role','where':{'role':{'$or':[_0xe685('0x25'),_0xe685('0x26'),_0xe685('0x27')]}},'raw':!![]})[_0xe685('0xc')](function(_0x3c27cc){var _0x58256b={'user':_0x5c9323[_0xe685('0x28')]||0x0,'telephone':_0x5c9323[_0xe685('0x29')]||0x0};_0x3c27cc[_0xe685('0x2a')](function(_0x2c9de9){var _0x3baaa7=_0x2c9de9[_0xe685('0x21')]===_0xe685('0x25')?_0xe685('0x26'):_0x2c9de9[_0xe685('0x21')];_0x58256b[_0x3baaa7]-=_0x2c9de9[_0xe685('0x2b')];if(_0x58256b[_0x3baaa7]<0x0)_0x58256b[_0x3baaa7]=0x0;});_0x5665cd(_0x58256b);return;});})[_0xe685('0x2c')](function(_0x4ab21e){_0x32e052(_0x4ab21e);});});}function checkUserLimits(_0x81338d){return new BPromise(function(_0x90c924,_0x5e804d){getLimits()['then'](function(_0x47b205){var _0x59d379=_[_0xe685('0x2d')](_[_0xe685('0x2e')](_0x81338d,_0xe685('0x21')),[_0xe685('0x25'),_0xe685('0x26'),_0xe685('0x27')]);var _0x3a4ed7=(_0x59d379[_0xe685('0x25')]||0x0)+(_0x59d379[_0xe685('0x26')]||0x0);var _0x168784=_0x59d379[_0xe685('0x27')]||0x0;if(_0x3a4ed7>_0x47b205[_0xe685('0x26')])return _0x5e804d(_0xe685('0x2f'));if(_0x168784>_0x47b205[_0xe685('0x27')])return _0x5e804d(_0xe685('0x30'));return _0x90c924();})[_0xe685('0x2c')](function(_0x791c78){_0x5e804d(_0x791c78);});});}module[_0xe685('0x31')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense};
\ No newline at end of file
index d7e4688..1297811 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8f4c=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x4a87cf,_0x52acba){var _0x1311b3=function(_0x5f1ee5){while(--_0x5f1ee5){_0x4a87cf['push'](_0x4a87cf['shift']());}};_0x1311b3(++_0x52acba);}(_0x8f4c,0x113));var _0xc8f4=function(_0x4f96b0,_0x4b2175){_0x4f96b0=_0x4f96b0-0x0;var _0x49025b=_0x8f4c[_0x4f96b0];return _0x49025b;};'use strict';module[_0xc8f4('0x0')]={'DOMAIN':_0xc8f4('0x1'),'SESSION_SECRET':_0xc8f4('0x2'),'GOOGLE_ID':_0xc8f4('0x3'),'GOOGLE_SECRET':_0xc8f4('0x4'),'DEBUG':''};
\ No newline at end of file
+var _0x6a95=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x1c2f8,_0x4d901c){var _0xc15a14=function(_0x571a8c){while(--_0x571a8c){_0x1c2f8['push'](_0x1c2f8['shift']());}};_0xc15a14(++_0x4d901c);}(_0x6a95,0x1db));var _0x56a9=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x6a95[_0x12d033];return _0x3b4e80;};'use strict';module[_0x56a9('0x0')]={'DOMAIN':_0x56a9('0x1'),'SESSION_SECRET':_0x56a9('0x2'),'GOOGLE_ID':_0x56a9('0x3'),'GOOGLE_SECRET':_0x56a9('0x4'),'DEBUG':''};
\ No newline at end of file
index 6ca6cf0..cc44804 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfba5=['fileLogger','exports','../utils/loggers'];(function(_0x1ced03,_0x31c446){var _0xa8b928=function(_0xd9a6bf){while(--_0xd9a6bf){_0x1ced03['push'](_0x1ced03['shift']());}};_0xa8b928(++_0x31c446);}(_0xfba5,0x16d));var _0x5fba=function(_0x33cb78,_0x4ae47f){_0x33cb78=_0x33cb78-0x0;var _0x157a72=_0xfba5[_0x33cb78];return _0x157a72;};'use strict';var fileLogger=require(_0x5fba('0x0'))[_0x5fba('0x1')];module[_0x5fba('0x2')]=fileLogger;
\ No newline at end of file
+var _0xd77b=['exports'];(function(_0x5c2d75,_0x4035fc){var _0x48f399=function(_0x576db0){while(--_0x576db0){_0x5c2d75['push'](_0x5c2d75['shift']());}};_0x48f399(++_0x4035fc);}(_0xd77b,0x1ea));var _0xbd77=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd77b[_0x42cae2];return _0x5f256f;};'use strict';var fileLogger=require('../utils/loggers')['fileLogger'];module[_0xbd77('0x0')]=fileLogger;
\ No newline at end of file
index d687bfa..de8f647 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0d99=['path','express','ami','email','join','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports'];(function(_0x1c32f4,_0x5ec782){var _0xd56a96=function(_0x53017d){while(--_0x53017d){_0x1c32f4['push'](_0x1c32f4['shift']());}};_0xd56a96(++_0x5ec782);}(_0x0d99,0x186));var _0x90d9=function(_0xb849e7,_0x24aa49){_0xb849e7=_0xb849e7-0x0;var _0x344014=_0x0d99[_0xb849e7];return _0x344014;};'use strict';var path=require(_0x90d9('0x0'));var os=require('os');var config={'apps':[{'name':_0x90d9('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x90d9('0x2'),'script':path['join'](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0x90d9('0x3'),'script':path[_0x90d9('0x4')](__dirname,_0x90d9('0x5'))},{'name':_0x90d9('0x6'),'script':path[_0x90d9('0x4')](__dirname,_0x90d9('0x7'))},{'name':'xdr','script':path[_0x90d9('0x4')](__dirname,_0x90d9('0x8'))}]};module[_0x90d9('0x9')]=config;
\ No newline at end of file
+var _0x12cb=['../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path','express','join'];(function(_0x507652,_0x58dcd8){var _0x1c3ba0=function(_0x101b7c){while(--_0x101b7c){_0x507652['push'](_0x507652['shift']());}};_0x1c3ba0(++_0x58dcd8);}(_0x12cb,0x115));var _0xb12c=function(_0x335c99,_0x189bd6){_0x335c99=_0x335c99-0x0;var _0x3958ff=_0x12cb[_0x335c99];return _0x3958ff;};'use strict';var path=require(_0xb12c('0x0'));var os=require('os');var config={'apps':[{'name':_0xb12c('0x1'),'script':path[_0xb12c('0x2')](__dirname,_0xb12c('0x3'))},{'name':_0xb12c('0x4'),'script':path[_0xb12c('0x2')](__dirname,_0xb12c('0x5'))},{'name':_0xb12c('0x6'),'script':path[_0xb12c('0x2')](__dirname,_0xb12c('0x7'))},{'name':_0xb12c('0x8'),'script':path[_0xb12c('0x2')](__dirname,_0xb12c('0x9'))},{'name':_0xb12c('0xa'),'script':path[_0xb12c('0x2')](__dirname,_0xb12c('0xb'))},{'name':'xdr','script':path['join'](__dirname,_0xb12c('0xc'))}]};module[_0xb12c('0xd')]=config;
\ No newline at end of file
index 7f45565..a3ce4be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4286=['stop','restart','list','describe','dump','pm2','bluebird','./config','connected','start','then','disconnect'];(function(_0x4ad9f9,_0x3c23f0){var _0x3229b0=function(_0x4d76e9){while(--_0x4d76e9){_0x4ad9f9['push'](_0x4ad9f9['shift']());}};_0x3229b0(++_0x3c23f0);}(_0x4286,0x149));var _0x6428=function(_0x4e2cbf,_0x407bb1){_0x4e2cbf=_0x4e2cbf-0x0;var _0x35540b=_0x4286[_0x4e2cbf];return _0x35540b;};'use strict';var pm2=require(_0x6428('0x0'));var BPromise=require(_0x6428('0x1'));var config=require(_0x6428('0x2'));function connect(){return new BPromise(function(_0x577fda,_0x848ef3){return pm2['connect'](function(_0x3aaeb1){if(_0x3aaeb1){return _0x848ef3(_0x3aaeb1);}return _0x577fda(_0x6428('0x3'));});});};exports[_0x6428('0x4')]=function(_0x27a1eb){return connect()[_0x6428('0x5')](function(){return new BPromise(function(_0xebba1a,_0x28b602){return pm2[_0x6428('0x4')](_0x27a1eb,function(_0x590423,_0x571e20){if(_0x590423){return _0x28b602(_0x590423);}pm2[_0x6428('0x6')]();return _0xebba1a(_0x571e20);});});});};exports['stop']=function(_0x4527a8){return connect()['then'](function(){return new BPromise(function(_0x31732b,_0x151869){return pm2[_0x6428('0x7')](_0x4527a8,function(_0xbf34ca,_0x5ad5ca){if(_0xbf34ca){return _0x151869(_0xbf34ca);}pm2[_0x6428('0x6')]();return _0x31732b(_0x5ad5ca);});});});};exports[_0x6428('0x8')]=function(_0xa8a882){return connect()['then'](function(){return new BPromise(function(_0x52ca70,_0x31b34e){return pm2[_0x6428('0x8')](_0xa8a882,function(_0x1be3dc,_0x1d7bfa){if(_0x1be3dc){return _0x31b34e(_0x1be3dc);}pm2[_0x6428('0x6')]();return _0x52ca70(_0x1d7bfa);});});});};exports[_0x6428('0x9')]=function(){return connect()[_0x6428('0x5')](function(){return new BPromise(function(_0x326ca6,_0x2bc3bb){return pm2['list'](function(_0x3d86d3,_0x415e6c){if(_0x3d86d3){return _0x2bc3bb(_0x3d86d3);}pm2[_0x6428('0x6')]();return _0x326ca6(_0x415e6c);});});});};exports[_0x6428('0xa')]=function(_0x881fa5){return connect()[_0x6428('0x5')](function(){return new BPromise(function(_0x2237a1,_0x165014){return pm2['describe'](_0x881fa5,function(_0x3a3342,_0x48f2e2){if(_0x3a3342){return _0x165014(_0x3a3342);}pm2[_0x6428('0x6')]();return _0x2237a1(_0x48f2e2);});});});};exports['delete']=function(_0x6232d5){return connect()['then'](function(){return new BPromise(function(_0x50308a,_0x452d16){return pm2['delete'](_0x6232d5,function(_0xbd9fd2,_0x1caa0d){if(_0xbd9fd2){return _0x452d16(_0xbd9fd2);}pm2[_0x6428('0x6')]();return _0x50308a(_0x1caa0d);});});});};exports[_0x6428('0xb')]=function(){return connect()[_0x6428('0x5')](function(){return new BPromise(function(_0x1da423,_0x3870f1){return pm2[_0x6428('0xb')](function(_0x2ae89c){if(_0x2ae89c){return _0x3870f1(_0x2ae89c);}return _0x1da423('saved');});});});};
\ No newline at end of file
+var _0x9d18=['pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved'];(function(_0x1b046f,_0x8e5fa6){var _0x1f6c8f=function(_0x4a2f64){while(--_0x4a2f64){_0x1b046f['push'](_0x1b046f['shift']());}};_0x1f6c8f(++_0x8e5fa6);}(_0x9d18,0xe1));var _0x89d1=function(_0x31dc39,_0x1ed3dd){_0x31dc39=_0x31dc39-0x0;var _0x4c426c=_0x9d18[_0x31dc39];return _0x4c426c;};'use strict';var pm2=require(_0x89d1('0x0'));var BPromise=require(_0x89d1('0x1'));var config=require(_0x89d1('0x2'));function connect(){return new BPromise(function(_0x59a81f,_0xf30321){return pm2[_0x89d1('0x3')](function(_0x59e0de){if(_0x59e0de){return _0xf30321(_0x59e0de);}return _0x59a81f(_0x89d1('0x4'));});});};exports[_0x89d1('0x5')]=function(_0x487be9){return connect()[_0x89d1('0x6')](function(){return new BPromise(function(_0x383493,_0x458d07){return pm2[_0x89d1('0x5')](_0x487be9,function(_0x6bf769,_0x3091e0){if(_0x6bf769){return _0x458d07(_0x6bf769);}pm2[_0x89d1('0x7')]();return _0x383493(_0x3091e0);});});});};exports['stop']=function(_0x4436f9){return connect()[_0x89d1('0x6')](function(){return new BPromise(function(_0x1574ba,_0x2caeb9){return pm2[_0x89d1('0x8')](_0x4436f9,function(_0x2f6523,_0x1ec61d){if(_0x2f6523){return _0x2caeb9(_0x2f6523);}pm2[_0x89d1('0x7')]();return _0x1574ba(_0x1ec61d);});});});};exports['restart']=function(_0x20f489){return connect()['then'](function(){return new BPromise(function(_0x15c08f,_0x53286f){return pm2[_0x89d1('0x9')](_0x20f489,function(_0x4f9446,_0x4b40a0){if(_0x4f9446){return _0x53286f(_0x4f9446);}pm2[_0x89d1('0x7')]();return _0x15c08f(_0x4b40a0);});});});};exports[_0x89d1('0xa')]=function(){return connect()[_0x89d1('0x6')](function(){return new BPromise(function(_0x13e4dc,_0x35b6b3){return pm2['list'](function(_0xebac24,_0x8cac01){if(_0xebac24){return _0x35b6b3(_0xebac24);}pm2['disconnect']();return _0x13e4dc(_0x8cac01);});});});};exports[_0x89d1('0xb')]=function(_0x318cde){return connect()[_0x89d1('0x6')](function(){return new BPromise(function(_0xc67653,_0xa777fb){return pm2[_0x89d1('0xb')](_0x318cde,function(_0x1ab7e6,_0x48c56a){if(_0x1ab7e6){return _0xa777fb(_0x1ab7e6);}pm2[_0x89d1('0x7')]();return _0xc67653(_0x48c56a);});});});};exports['delete']=function(_0x369346){return connect()[_0x89d1('0x6')](function(){return new BPromise(function(_0x298d66,_0x39914c){return pm2[_0x89d1('0xc')](_0x369346,function(_0x1e3ebc,_0x2692d1){if(_0x1e3ebc){return _0x39914c(_0x1e3ebc);}pm2[_0x89d1('0x7')]();return _0x298d66(_0x2692d1);});});});};exports[_0x89d1('0xd')]=function(){return connect()[_0x89d1('0x6')](function(){return new BPromise(function(_0xa7f5c6,_0x3f61de){return pm2[_0x89d1('0xd')](function(_0x4dc1f5){if(_0x4dc1f5){return _0x3f61de(_0x4dc1f5);}return _0xa7f5c6(_0x89d1('0xe'));});});});};
\ No newline at end of file
index 15d6e51..abb1809 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3718=['system','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join'];(function(_0x346f65,_0x5bd9eb){var _0x5b4795=function(_0x1697de){while(--_0x1697de){_0x346f65['push'](_0x346f65['shift']());}};_0x5b4795(++_0x5bd9eb);}(_0x3718,0x146));var _0x8371=function(_0x27df59,_0x402198){_0x27df59=_0x27df59-0x0;var _0x548eb4=_0x3718[_0x27df59];return _0x548eb4;};'use strict';var _=require(_0x8371('0x0'));var moment=require(_0x8371('0x1'));var Redis=require(_0x8371('0x2'));var util=require(_0x8371('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x8371('0x4'));config['redis']=_[_0x8371('0x5')](config[_0x8371('0x6')],{'host':_0x8371('0x7'),'port':0x18eb});var io=require(_0x8371('0x8'))(new Redis(config[_0x8371('0x6')]));function closeInteractions(){var _0x498727=0x0;var _0x29aa9f=[];return db[_0x8371('0x9')][_0x8371('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x8371('0xb')](function(_0x284b5b){_0x498727=_0x284b5b[_0x8371('0xc')];if(_0x498727){return db[_0x8371('0xd')][_0x8371('0xe')]({'raw':!![],'attributes':['id',_0x8371('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8371('0x10')](_0x284b5b[_0x8371('0xc')],_0x8371('0x11'))}}});}else{return[];}})[_0x8371('0xb')](function(_0x1d11aa){if(_0x1d11aa&&_0x1d11aa[_0x8371('0x12')]){_0x29aa9f=_['map'](_0x1d11aa||[],'id');logger[_0x8371('0x13')](_0x8371('0x14'),_0x29aa9f[_0x8371('0x15')]());return db[_0x8371('0xd')]['update']({'closeReason':_0x8371('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x8371('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x29aa9f}});}})['then'](function(){if(_0x29aa9f&&_0x29aa9f['length']){logger[_0x8371('0x13')](_0x8371('0x18'),_0x29aa9f[_0x8371('0x15')]());for(var _0x3157a8=0x0;_0x3157a8<_0x29aa9f[_0x8371('0x12')];_0x3157a8++){io[_0x8371('0x19')]('chatInteraction:update',{'id':_0x29aa9f[_0x3157a8],'closed':!![]});}}})['catch'](function(_0x29b81f){logger['error'](_0x8371('0x1a'),_0x29b81f?util[_0x8371('0x1b')](_0x29b81f,{'showHidden':![],'depth':null}):'');});}exports[_0x8371('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
+var _0x77a2=['catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','Setting','chatTimeout','then','findAll','lastMsgAt','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit'];(function(_0x271beb,_0x585c96){var _0x30a759=function(_0x508f6d){while(--_0x508f6d){_0x271beb['push'](_0x271beb['shift']());}};_0x30a759(++_0x585c96);}(_0x77a2,0x14f));var _0x277a=function(_0x3eca07,_0x3763db){_0x3eca07=_0x3eca07-0x0;var _0x5a75a2=_0x77a2[_0x3eca07];return _0x5a75a2;};'use strict';var _=require(_0x277a('0x0'));var moment=require(_0x277a('0x1'));var Redis=require(_0x277a('0x2'));var util=require(_0x277a('0x3'));var config=require(_0x277a('0x4'));var db=require(_0x277a('0x5'))['db'];var logger=require(_0x277a('0x6'))('schedule');config[_0x277a('0x7')]=_[_0x277a('0x8')](config[_0x277a('0x7')],{'host':_0x277a('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x277a('0x7')]));function closeInteractions(){var _0x8ca6ca=0x0;var _0x265d83=[];return db[_0x277a('0xa')]['find']({'raw':!![],'attributes':['id',_0x277a('0xb')],'where':{'id':0x1}})[_0x277a('0xc')](function(_0x57c067){_0x8ca6ca=_0x57c067['chatTimeout'];if(_0x8ca6ca){return db['ChatInteraction'][_0x277a('0xd')]({'raw':!![],'attributes':['id',_0x277a('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x57c067[_0x277a('0xb')],_0x277a('0xf'))}}});}else{return[];}})[_0x277a('0xc')](function(_0x1047e7){if(_0x1047e7&&_0x1047e7[_0x277a('0x10')]){_0x265d83=_['map'](_0x1047e7||[],'id');logger[_0x277a('0x11')](_0x277a('0x12'),_0x265d83[_0x277a('0x13')]());return db[_0x277a('0x14')][_0x277a('0x15')]({'closeReason':_0x277a('0x16'),'disposition':_0x277a('0x17'),'closed':!![],'closedAt':moment()[_0x277a('0x18')](_0x277a('0x19'))},{'where':{'id':_0x265d83}});}})[_0x277a('0xc')](function(){if(_0x265d83&&_0x265d83['length']){logger['info'](_0x277a('0x1a'),_0x265d83[_0x277a('0x13')]());for(var _0x376bb2=0x0;_0x376bb2<_0x265d83['length'];_0x376bb2++){io[_0x277a('0x1b')]('chatInteraction:update',{'id':_0x265d83[_0x376bb2],'closed':!![]});}}})[_0x277a('0x1c')](function(_0x5793e8){logger[_0x277a('0x1d')](_0x277a('0x1e'),_0x5793e8?util[_0x277a('0x1f')](_0x5793e8,{'showHidden':![],'depth':null}):'');});}exports[_0x277a('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
index f52ed9c..a585d49 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6e5e=['startAllRefreshIntervals'];(function(_0x43caed,_0x1edb45){var _0x1841eb=function(_0x365ad4){while(--_0x365ad4){_0x43caed['push'](_0x43caed['shift']());}};_0x1841eb(++_0x1edb45);}(_0x6e5e,0xe0));var _0xe6e5=function(_0x41cef2,_0x2127a4){_0x41cef2=_0x41cef2-0x0;var _0x9717cc=_0x6e5e[_0x41cef2];return _0x9717cc;};'use strict';function start(){var _0x1fb28a=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x1fb28a[_0xe6e5('0x0')]();}module['exports']={'intervals':{},'start':start};
\ No newline at end of file
+var _0xce4e=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x135fa5,_0x5068d7){var _0x40789f=function(_0x280a2d){while(--_0x280a2d){_0x135fa5['push'](_0x135fa5['shift']());}};_0x40789f(++_0x5068d7);}(_0xce4e,0x143));var _0xece4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xce4e[_0xa464c9];return _0x3d73c4;};'use strict';function start(){var _0x1a1a4c=require(_0xece4('0x0'));return _0x1a1a4c[_0xece4('0x1')]();}module[_0xece4('0x2')]={'intervals':{},'start':start};
\ No newline at end of file
index 1d7e90e..a2a8f56 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8151=['extname','savename','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Sent','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','output','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','toString','keyBy','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','cron','active','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','run','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename'];(function(_0x5e7699,_0x34c7cf){var _0x139ad2=function(_0x56de51){while(--_0x56de51){_0x5e7699['push'](_0x5e7699['shift']());}};_0x139ad2(++_0x34c7cf);}(_0x8151,0xd5));var _0x1815=function(_0x73b80e,_0x4daa4a){_0x73b80e=_0x73b80e-0x0;var _0x4c31cd=_0x8151[_0x73b80e];return _0x4c31cd;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x1815('0x0'));var moment=require(_0x1815('0x1'));var CronJobManager=require(_0x1815('0x2'));var jayson=require(_0x1815('0x3'));var BPromise=require(_0x1815('0x4'));var logger=require(_0x1815('0x5'))(_0x1815('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x1815('0x7'));var analyticDefaultReportController=require(_0x1815('0x8'));var client=jayson[_0x1815('0x9')][_0x1815('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x47bf47,_0xe0e3ee){return function(){logger[_0x1815('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x47bf47[_0x1815('0xc')]);var _0x37398a=!![];var _0x1cb53e=_0x47bf47[_0x1815('0xd')][_0x1815('0xe')]();var _0x11b308={'account':_0x1cb53e,'message':{'from':util[_0x1815('0xf')](_0x1815('0x10'),_0x47bf47['MailAccount'][_0x1815('0x11')],_0x47bf47[_0x1815('0xd')][_0x1815('0xc')]||_0x47bf47[_0x1815('0xd')][_0x1815('0x12')]['user']),'to':_0x47bf47[_0x1815('0xc')],'cc':_0x47bf47['cc'],'bcc':_0x47bf47[_0x1815('0x13')],'subject':util[_0x1815('0xf')](_0x1815('0x14'),_0xe0e3ee['name'],_0x47bf47[_0x1815('0x15')],_0x47bf47[_0x1815('0x16')])}};var _0x273530=path[_0x1815('0x17')](__dirname,_0x1815('0x18'));var _0x1468d7=_0xe0e3ee['savename'];var _0x222cee=util['format'](_0x1815('0x19'),path[_0x1815('0x1a')](_0xe0e3ee['savename'],path[_0x1815('0x1b')](_0xe0e3ee[_0x1815('0x1c')])),'zip');var _0x3a6623=path[_0x1815('0x17')](_0x273530,_0x1468d7);var _0xa930aa=path[_0x1815('0x17')](_0x273530,_0x222cee);if(fs['existsSync'](_0x3a6623)){_0xe0e3ee[_0x1815('0x1d')]='Sent';_0x11b308[_0x1815('0x1e')][_0x1815('0x1f')]=[{'filename':_0x1468d7,'path':_0x3a6623}];_0x11b308[_0x1815('0x1e')]['text']=util[_0x1815('0xf')](_0x1815('0x20'),JSON[_0x1815('0x21')](_0xe0e3ee,null,0x2));}else if(fs[_0x1815('0x22')](_0xa930aa)){_0xe0e3ee[_0x1815('0x1d')]=_0x1815('0x23');_0x11b308[_0x1815('0x1e')][_0x1815('0x1f')]=[{'filename':_0x222cee,'path':_0xa930aa}];}else{_0x11b308['message'][_0x1815('0x24')]=_0x1815('0x25');if(!_0x47bf47['sendIfEmpty']){_0x37398a=![];logger['info'](_0x1815('0x26'));}}if(_0x37398a){return client['request'](_0x1815('0x27'),_0x11b308)[_0x1815('0x28')](function(_0x512415){if(_0x512415[_0x1815('0x29')]){return logger[_0x1815('0x29')](_0x1815('0x2a'),JSON['stringify'](_0x512415));}return logger['info']('email\x20sent');})[_0x1815('0x2b')](function(_0x2a445e){return logger[_0x1815('0x29')]('error\x20mail',JSON[_0x1815('0x21')](_0x2a445e));});}};}function handleError(){return function(_0x222da6){return logger[_0x1815('0x29')](JSON['stringify'](_0x222da6));};}function handleResult(_0x14c33b){return function(_0x4d415a){logger[_0x1815('0xb')](_0x1815('0x2c'),JSON[_0x1815('0x21')](_0x4d415a));if(_0x14c33b['MailAccount']&&_0x14c33b[_0x1815('0xd')]['Smtp']&&!_[_0x1815('0x2d')](_0x14c33b[_0x1815('0xc')])){setTimeout(handleSendEmail(_0x14c33b,_0x4d415a),0x3c*0x3e8);}};}function handleJob(_0x4e1c86){return function(){try{if(_[_0x1815('0x2d')](_0x4e1c86['subtractNumber'])){return logger['info'](_0x1815('0x2e'));}if(_[_0x1815('0x2d')](_0x4e1c86[_0x1815('0x16')])){return logger[_0x1815('0xb')](_0x1815('0x2f'));}var _0x11d4da={'startDate':moment()[_0x1815('0x30')](_0x4e1c86[_0x1815('0x15')],_0x4e1c86['subtractUnit'])[_0x1815('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x1815('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x1815('0x31'),'output':_0x4e1c86[_0x1815('0x32')],'name':_0x4e1c86[_0x1815('0x11')]};if(!_[_0x1815('0x2d')](_0x4e1c86[_0x1815('0x33')])){logger[_0x1815('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x4e1c86[_0x1815('0x33')]);return analyticDefaultReportController[_0x1815('0x34')]({'id':_0x4e1c86[_0x1815('0x33')]},_0x11d4da)[_0x1815('0x28')](handleResult(_0x4e1c86))[_0x1815('0x2b')](handleError());}if(!_[_0x1815('0x2d')](_0x4e1c86['CustomReportId'])){logger[_0x1815('0xb')](_0x1815('0x35'),_0x4e1c86['CustomReportId']);return analyticCustomReportController[_0x1815('0x34')]({'id':_0x4e1c86[_0x1815('0x36')]},_0x11d4da)[_0x1815('0x28')](handleResult(_0x4e1c86))[_0x1815('0x2b')](handleError());}}catch(_0x4cf063){logger[_0x1815('0x29')](JSON['stringify'](_0x4cf063));}return logger[_0x1815('0xb')](_0x1815('0x37'));};}function getJobs(_0x3a0d64){var _0x3f2d1e={};if(_0x3a0d64){_0x3f2d1e['id']=_0x3a0d64;}return db[_0x1815('0x38')][_0x1815('0x39')]({'where':_0x3f2d1e,'include':[{'model':db[_0x1815('0xd')],'attributes':['id',_0x1815('0x11'),_0x1815('0xc')],'include':[{'model':db['MailServerOut'],'as':_0x1815('0x12'),'include':[{'model':db[_0x1815('0x3a')],'as':_0x1815('0x3a')}]}]}]})[_0x1815('0x28')](function(_0x2d38d1){var _0xcda9b2=_[_0x1815('0x3b')](manager[_0x1815('0x3c')]);var _0x4d5518=_['map'](_0x2d38d1,function(_0x1ac2f6){return _0x1ac2f6['id'][_0x1815('0x3d')]();});var _0x137218=_[_0x1815('0x3e')](_0x2d38d1,function(_0x1d543b){return _0x1d543b['id'][_0x1815('0x3d')]();});var _0x269bed=_0x3a0d64?_0x4d5518:_[_0x1815('0x3f')](_0x4d5518,_0xcda9b2);var _0x609fac=_['intersection'](_0x4d5518,_0xcda9b2);var _0x5c8752=_[_0x1815('0x3f')](_0xcda9b2,_0x4d5518);var _0x58aca2;var _0x198cbc;for(_0x58aca2=0x0;_0x58aca2<_0x5c8752[_0x1815('0x40')]&&!_0x3a0d64;_0x58aca2+=0x1){_0x198cbc=_0x5c8752[_0x58aca2][_0x1815('0x3d')]();if(manager[_0x1815('0x41')](_0x198cbc)){manager[_0x1815('0x42')](_0x198cbc);manager[_0x1815('0x43')](_0x198cbc);logger[_0x1815('0xb')](_0x1815('0x44'),_0x198cbc);}}logger['info'](_0x1815('0x45'),JSON[_0x1815('0x21')](_0x269bed));for(_0x58aca2=0x0;_0x58aca2<_0x269bed[_0x1815('0x40')];_0x58aca2+=0x1){_0x198cbc=_0x269bed[_0x58aca2][_0x1815('0x3d')]();logger[_0x1815('0xb')]('index',_0x198cbc);if(_0x3a0d64){logger['info']('my\x20id',_0x3a0d64);logger[_0x1815('0xb')](JSON[_0x1815('0x21')](_0x137218[_0x198cbc]));BPromise['resolve']()['then'](handleJob(_0x137218[_0x198cbc]));logger['info']('run\x20job',_0x137218[_0x198cbc][_0x1815('0x11')],_0x137218[_0x198cbc]['cron']);}else if(_0x137218[_0x198cbc][_0x1815('0x46')]&&_0x137218[_0x198cbc][_0x1815('0x47')]&&moment()['isBetween'](_0x137218[_0x198cbc][_0x1815('0x48')],_0x137218[_0x198cbc][_0x1815('0x49')])){manager[_0x1815('0x4a')](_0x198cbc,_0x137218[_0x198cbc][_0x1815('0x46')],handleJob(_0x137218[_0x198cbc]));manager[_0x1815('0x4b')](_0x198cbc);logger[_0x1815('0xb')](_0x1815('0x4c'),_0x137218[_0x198cbc][_0x1815('0x11')],_0x137218[_0x198cbc][_0x1815('0x46')]);}else if(manager[_0x1815('0x41')](_0x198cbc)){manager[_0x1815('0x42')](_0x198cbc);manager[_0x1815('0x43')](_0x198cbc);logger[_0x1815('0xb')](_0x1815('0x4d'),_0x137218[_0x198cbc][_0x1815('0x11')],_0x137218[_0x198cbc][_0x1815('0x46')]);}}for(_0x58aca2=0x0,_0x198cbc;_0x58aca2<_0x609fac['length']&&!_0x3a0d64;_0x58aca2+=0x1){_0x198cbc=_0x609fac[_0x58aca2][_0x1815('0x3d')]();if(manager[_0x1815('0x41')](_0x198cbc)){if(_0x137218[_0x198cbc]['cron']&&_0x137218[_0x198cbc]['active']&&moment()['isBetween'](_0x137218[_0x198cbc][_0x1815('0x48')],_0x137218[_0x198cbc][_0x1815('0x49')])){manager[_0x1815('0x4e')](_0x198cbc,_0x137218[_0x198cbc][_0x1815('0x46')],handleJob(_0x137218[_0x198cbc]));logger[_0x1815('0xb')]('update\x20cron',_0x137218[_0x198cbc]['name'],_0x137218[_0x198cbc][_0x1815('0x46')]);}else{manager[_0x1815('0x42')](_0x198cbc);manager[_0x1815('0x43')](_0x198cbc);logger[_0x1815('0xb')](_0x1815('0x4d'),_0x137218[_0x198cbc][_0x1815('0x11')],_0x137218[_0x198cbc][_0x1815('0x46')]);}}}})[_0x1815('0x2b')](function(_0x202322){logger[_0x1815('0x29')](JSON[_0x1815('0x21')](_0x202322));});}exports[_0x1815('0x4f')]=function(_0x46b59e){return getJobs(_0x46b59e);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();};
\ No newline at end of file
+var _0x6484=['findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','exists','stop','deleteJob','delete\x20cron','toRun','length','index','cron','active','isBetween','startAt','add','start','add\x20cron','stop\x20cron','endAt','update','update\x20cron','run','path','lodash','moment','cron-job-manager','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','../../files/reports','savename','%s.%s','extname','zip','join','status','Sent','message','stringify','existsSync','attachments','text','sendIfEmpty','request','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule'];(function(_0x7f76b8,_0x18d3bd){var _0x295d6f=function(_0x2e6e25){while(--_0x2e6e25){_0x7f76b8['push'](_0x7f76b8['shift']());}};_0x295d6f(++_0x18d3bd);}(_0x6484,0x1bb));var _0x4648=function(_0x31ece1,_0x55c20a){_0x31ece1=_0x31ece1-0x0;var _0x4fae4d=_0x6484[_0x31ece1];return _0x4fae4d;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x4648('0x0'));var _=require(_0x4648('0x1'));var moment=require(_0x4648('0x2'));var CronJobManager=require(_0x4648('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x4648('0x4'));var logger=require(_0x4648('0x5'))('schedule');var db=require(_0x4648('0x6'))['db'];var analyticCustomReportController=require(_0x4648('0x7'));var analyticDefaultReportController=require(_0x4648('0x8'));var client=jayson['client'][_0x4648('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3d4cc9,_0x12c92f){return function(){logger[_0x4648('0xa')](_0x4648('0xb'),_0x3d4cc9[_0x4648('0xc')]);var _0x27d81b=!![];var _0xc8eaeb=_0x3d4cc9[_0x4648('0xd')]['getSmtpOptions']();var _0x51e481={'account':_0xc8eaeb,'message':{'from':util['format'](_0x4648('0xe'),_0x3d4cc9[_0x4648('0xd')][_0x4648('0xf')],_0x3d4cc9[_0x4648('0xd')][_0x4648('0xc')]||_0x3d4cc9[_0x4648('0xd')][_0x4648('0x10')][_0x4648('0x11')]),'to':_0x3d4cc9[_0x4648('0xc')],'cc':_0x3d4cc9['cc'],'bcc':_0x3d4cc9[_0x4648('0x12')],'subject':util[_0x4648('0x13')](_0x4648('0x14'),_0x12c92f[_0x4648('0xf')],_0x3d4cc9['subtractNumber'],_0x3d4cc9[_0x4648('0x15')])}};var _0x55e4a3=path['join'](__dirname,_0x4648('0x16'));var _0x1023e1=_0x12c92f[_0x4648('0x17')];var _0x43866f=util[_0x4648('0x13')](_0x4648('0x18'),path['basename'](_0x12c92f[_0x4648('0x17')],path[_0x4648('0x19')](_0x12c92f['savename'])),_0x4648('0x1a'));var _0x17029f=path[_0x4648('0x1b')](_0x55e4a3,_0x1023e1);var _0x54fa92=path[_0x4648('0x1b')](_0x55e4a3,_0x43866f);if(fs['existsSync'](_0x17029f)){_0x12c92f[_0x4648('0x1c')]=_0x4648('0x1d');_0x51e481[_0x4648('0x1e')]['attachments']=[{'filename':_0x1023e1,'path':_0x17029f}];_0x51e481[_0x4648('0x1e')]['text']=util[_0x4648('0x13')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x4648('0x1f')](_0x12c92f,null,0x2));}else if(fs[_0x4648('0x20')](_0x54fa92)){_0x12c92f[_0x4648('0x1c')]=_0x4648('0x1d');_0x51e481[_0x4648('0x1e')][_0x4648('0x21')]=[{'filename':_0x43866f,'path':_0x54fa92}];}else{_0x51e481[_0x4648('0x1e')][_0x4648('0x22')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x3d4cc9[_0x4648('0x23')]){_0x27d81b=![];logger[_0x4648('0xa')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x27d81b){return client[_0x4648('0x24')]('SendMail',_0x51e481)[_0x4648('0x25')](function(_0x3f4ca1){if(_0x3f4ca1[_0x4648('0x26')]){return logger[_0x4648('0x26')](_0x4648('0x27'),JSON[_0x4648('0x1f')](_0x3f4ca1));}return logger[_0x4648('0xa')](_0x4648('0x28'));})[_0x4648('0x29')](function(_0xea10cc){return logger[_0x4648('0x26')](_0x4648('0x27'),JSON[_0x4648('0x1f')](_0xea10cc));});}};}function handleError(){return function(_0x38075e){return logger[_0x4648('0x26')](JSON[_0x4648('0x1f')](_0x38075e));};}function handleResult(_0x52431d){return function(_0x3d1b78){logger[_0x4648('0xa')](_0x4648('0x2a'),JSON[_0x4648('0x1f')](_0x3d1b78));if(_0x52431d[_0x4648('0xd')]&&_0x52431d[_0x4648('0xd')]['Smtp']&&!_['isNil'](_0x52431d[_0x4648('0xc')])){setTimeout(handleSendEmail(_0x52431d,_0x3d1b78),0x3c*0x3e8);}};}function handleJob(_0x176f73){return function(){try{if(_[_0x4648('0x2b')](_0x176f73[_0x4648('0x2c')])){return logger[_0x4648('0xa')](_0x4648('0x2d'));}if(_[_0x4648('0x2b')](_0x176f73['subtractUnit'])){return logger[_0x4648('0xa')](_0x4648('0x2e'));}var _0x16be99={'startDate':moment()['subtract'](_0x176f73[_0x4648('0x2c')],_0x176f73['subtractUnit'])[_0x4648('0x13')](_0x4648('0x2f')),'endDate':moment()[_0x4648('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x4648('0x30'),'output':_0x176f73['output'],'name':_0x176f73['name']};if(!_[_0x4648('0x2b')](_0x176f73['DefaultReportId'])){logger[_0x4648('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x176f73[_0x4648('0x31')]);return analyticDefaultReportController[_0x4648('0x32')]({'id':_0x176f73[_0x4648('0x31')]},_0x16be99)[_0x4648('0x25')](handleResult(_0x176f73))[_0x4648('0x29')](handleError());}if(!_['isNil'](_0x176f73[_0x4648('0x33')])){logger['info'](_0x4648('0x34'),_0x176f73[_0x4648('0x33')]);return analyticCustomReportController[_0x4648('0x32')]({'id':_0x176f73[_0x4648('0x33')]},_0x16be99)['then'](handleResult(_0x176f73))[_0x4648('0x29')](handleError());}}catch(_0x3d0178){logger['error'](JSON[_0x4648('0x1f')](_0x3d0178));}return logger['info'](_0x4648('0x35'));};}function getJobs(_0x2bc174){var _0x10f8ea={};if(_0x2bc174){_0x10f8ea['id']=_0x2bc174;}return db[_0x4648('0x36')][_0x4648('0x37')]({'where':_0x10f8ea,'include':[{'model':db[_0x4648('0xd')],'attributes':['id','name',_0x4648('0xc')],'include':[{'model':db[_0x4648('0x38')],'as':_0x4648('0x10'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]}]})[_0x4648('0x25')](function(_0x1d41d2){var _0x372921=_[_0x4648('0x39')](manager[_0x4648('0x3a')]);var _0x511bcc=_[_0x4648('0x3b')](_0x1d41d2,function(_0x2709f3){return _0x2709f3['id'][_0x4648('0x3c')]();});var _0x245028=_[_0x4648('0x3d')](_0x1d41d2,function(_0x58b6fd){return _0x58b6fd['id'][_0x4648('0x3c')]();});var _0x469c6b=_0x2bc174?_0x511bcc:_[_0x4648('0x3e')](_0x511bcc,_0x372921);var _0x33a5e2=_[_0x4648('0x3f')](_0x511bcc,_0x372921);var _0x92ebc9=_[_0x4648('0x3e')](_0x372921,_0x511bcc);var _0x24a1b9;var _0x4fb86c;for(_0x24a1b9=0x0;_0x24a1b9<_0x92ebc9['length']&&!_0x2bc174;_0x24a1b9+=0x1){_0x4fb86c=_0x92ebc9[_0x24a1b9][_0x4648('0x3c')]();if(manager[_0x4648('0x40')](_0x4fb86c)){manager[_0x4648('0x41')](_0x4fb86c);manager[_0x4648('0x42')](_0x4fb86c);logger['info'](_0x4648('0x43'),_0x4fb86c);}}logger['info'](_0x4648('0x44'),JSON['stringify'](_0x469c6b));for(_0x24a1b9=0x0;_0x24a1b9<_0x469c6b[_0x4648('0x45')];_0x24a1b9+=0x1){_0x4fb86c=_0x469c6b[_0x24a1b9][_0x4648('0x3c')]();logger['info'](_0x4648('0x46'),_0x4fb86c);if(_0x2bc174){logger[_0x4648('0xa')]('my\x20id',_0x2bc174);logger[_0x4648('0xa')](JSON[_0x4648('0x1f')](_0x245028[_0x4fb86c]));BPromise['resolve']()[_0x4648('0x25')](handleJob(_0x245028[_0x4fb86c]));logger[_0x4648('0xa')]('run\x20job',_0x245028[_0x4fb86c][_0x4648('0xf')],_0x245028[_0x4fb86c]['cron']);}else if(_0x245028[_0x4fb86c][_0x4648('0x47')]&&_0x245028[_0x4fb86c][_0x4648('0x48')]&&moment()[_0x4648('0x49')](_0x245028[_0x4fb86c][_0x4648('0x4a')],_0x245028[_0x4fb86c]['endAt'])){manager[_0x4648('0x4b')](_0x4fb86c,_0x245028[_0x4fb86c][_0x4648('0x47')],handleJob(_0x245028[_0x4fb86c]));manager[_0x4648('0x4c')](_0x4fb86c);logger['info'](_0x4648('0x4d'),_0x245028[_0x4fb86c][_0x4648('0xf')],_0x245028[_0x4fb86c]['cron']);}else if(manager[_0x4648('0x40')](_0x4fb86c)){manager[_0x4648('0x41')](_0x4fb86c);manager['deleteJob'](_0x4fb86c);logger['info'](_0x4648('0x4e'),_0x245028[_0x4fb86c][_0x4648('0xf')],_0x245028[_0x4fb86c][_0x4648('0x47')]);}}for(_0x24a1b9=0x0,_0x4fb86c;_0x24a1b9<_0x33a5e2[_0x4648('0x45')]&&!_0x2bc174;_0x24a1b9+=0x1){_0x4fb86c=_0x33a5e2[_0x24a1b9]['toString']();if(manager[_0x4648('0x40')](_0x4fb86c)){if(_0x245028[_0x4fb86c]['cron']&&_0x245028[_0x4fb86c]['active']&&moment()[_0x4648('0x49')](_0x245028[_0x4fb86c][_0x4648('0x4a')],_0x245028[_0x4fb86c][_0x4648('0x4f')])){manager[_0x4648('0x50')](_0x4fb86c,_0x245028[_0x4fb86c]['cron'],handleJob(_0x245028[_0x4fb86c]));logger[_0x4648('0xa')](_0x4648('0x51'),_0x245028[_0x4fb86c]['name'],_0x245028[_0x4fb86c][_0x4648('0x47')]);}else{manager['stop'](_0x4fb86c);manager[_0x4648('0x42')](_0x4fb86c);logger[_0x4648('0xa')](_0x4648('0x4e'),_0x245028[_0x4fb86c][_0x4648('0xf')],_0x245028[_0x4fb86c][_0x4648('0x47')]);}}}})[_0x4648('0x29')](function(_0x2177ea){logger[_0x4648('0x26')](JSON[_0x4648('0x1f')](_0x2177ea));});}exports[_0x4648('0x52')]=function(_0x39b86a){return getJobs(_0x39b86a);};exports[_0x4648('0x4c')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();};
\ No newline at end of file
index 2f19074..5ef605a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1e7b=['Positive','Negative','Mixed','Neutral','FAILED','findOne','Cloud\x20Provider\x20not\x20available','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','bucket','Transcribe\x20not\x20configured','CloudProvider','forEach','push','all','catch','error','start','lodash','aws-sdk','util','bluebird','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1e7b,0x12d));var _0xb1e7=function(_0x2c1101,_0x1909d9){_0x2c1101=_0x2c1101-0x0;var _0x56f52f=_0x1e7b[_0x2c1101];return _0x56f52f;};var _=require(_0xb1e7('0x0'));var AWS=require(_0xb1e7('0x1'));var rp=require('request-promise');var util=require(_0xb1e7('0x2'));var BPromise=require(_0xb1e7('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xb1e7('0x4'))(_0xb1e7('0x5'));function getTranscriptionJob(_0x41ab3e,_0x2222eb,_0x4d6501,_0x1b473f){return new Promise(function(_0x2f733c,_0x3bc43b){var _0x35c43c=new AWS[(_0xb1e7('0x6'))]({'accessKeyId':_0x2222eb,'secretAccessKey':_0x41ab3e,'region':_0x4d6501});_0x35c43c['getTranscriptionJob']({'TranscriptionJobName':_0x1b473f},function(_0x161376,_0xca6a82){if(_0x161376){return _0x3bc43b(_0x161376);}else{return _0x2f733c(_0xca6a82);}});});}function sentiment(_0xf189f8,_0x1e20f8,_0x53bcee,_0x1c27e8,_0x842e0a){return new Promise(function(_0x400ad9,_0x13af76){var _0x2521e9=new AWS[(_0xb1e7('0x7'))]({'accessKeyId':_0x1e20f8,'secretAccessKey':_0xf189f8,'region':_0x53bcee});_0x2521e9[_0xb1e7('0x8')]({'Text':_0x1c27e8,'LanguageCode':_0x842e0a[_0xb1e7('0x9')](0x0,0x2)},function(_0x363557,_0xa10fa6){if(_0x363557){return _0x13af76(_0x363557);}else{return _0x400ad9(_0xa10fa6);}});});}function checkTranscribeJob(_0x5db797,_0x5894c2,_0x28c5bb){var _0x1e943d;return new BPromise(function(_0x299714,_0x4b157d){logger[_0xb1e7('0xa')](util[_0xb1e7('0xb')](_0xb1e7('0xc'),_0x5db797['id'],_0x5db797['transcribeName']));return getTranscriptionJob(_0x28c5bb[_0xb1e7('0xd')],_0x28c5bb[_0xb1e7('0xe')],_0x5894c2[_0xb1e7('0xf')],_0x5db797['transcribeName'])[_0xb1e7('0x10')](function(_0x2f677d){logger[_0xb1e7('0xa')](util[_0xb1e7('0xb')](_0xb1e7('0x11'),_0x5db797['id'],_0x5db797[_0xb1e7('0x12')],_0x2f677d[_0xb1e7('0x13')][_0xb1e7('0x14')]));if(!_0x5db797[_0xb1e7('0x15')]){switch(_0x2f677d[_0xb1e7('0x13')][_0xb1e7('0x14')]){case _0xb1e7('0x16'):var _0xa1ddc={'transcribeStatus':_0x2f677d[_0xb1e7('0x13')][_0xb1e7('0x14')],'fileUri':_0x2f677d['TranscriptionJob'][_0xb1e7('0x17')][_0xb1e7('0x18')]};logger['info'](util[_0xb1e7('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x5db797['id']));return rp({'uri':_0x2f677d[_0xb1e7('0x13')][_0xb1e7('0x17')][_0xb1e7('0x18')],'json':!![]})[_0xb1e7('0x10')](function(_0x310b1b){logger[_0xb1e7('0xa')](util['format'](_0xb1e7('0x19'),_0x5db797['id']));if(_0x310b1b&&_0x310b1b[_0xb1e7('0x1a')]&&_0x310b1b['results']['transcripts']&&_0x310b1b[_0xb1e7('0x1a')][_0xb1e7('0x1b')][_0xb1e7('0x1c')]){_0xa1ddc['fileText']='';for(var _0x1265d9=0x0;_0x1265d9<_0x310b1b[_0xb1e7('0x1a')][_0xb1e7('0x1b')][_0xb1e7('0x1c')];_0x1265d9++){_0xa1ddc['fileText']+=_0x310b1b['results'][_0xb1e7('0x1b')][_0x1265d9]['transcript']+'';}}return _0x5db797[_0xb1e7('0x1d')](_0xa1ddc);})[_0xb1e7('0x10')](function(){logger[_0xb1e7('0xa')](util[_0xb1e7('0xb')](_0xb1e7('0x1e'),_0x5db797['id']));if(!_0x5db797[_0xb1e7('0x1f')]){throw new db[(_0xb1e7('0x20'))][(_0xb1e7('0x21'))](_0xb1e7('0x22'));}if(!_0x5894c2[_0xb1e7('0x23')]||!_0x5894c2[_0xb1e7('0x24')]||!_0x5894c2[_0xb1e7('0x25')]||!_0x5894c2[_0xb1e7('0x26')]||!_0x5894c2['bucket']){throw new db[(_0xb1e7('0x20'))][(_0xb1e7('0x21'))](_0xb1e7('0x27'));}if(!_0xa1ddc[_0xb1e7('0x15')]){throw new Error('Transcript\x20not\x20available');}if(_0x5894c2[_0xb1e7('0x24')]===_0x28c5bb['id']){return _0x28c5bb;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xb1e7('0x24')]}});}})[_0xb1e7('0x10')](function(_0x3d0c48){if(!_0x3d0c48){throw new db[(_0xb1e7('0x20'))][(_0xb1e7('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3d0c48['data1']||!_0x3d0c48['data2']){throw new db[(_0xb1e7('0x20'))][(_0xb1e7('0x21'))](_0xb1e7('0x28'));}_0x1e943d=_0x3d0c48;logger[_0xb1e7('0xa')](util[_0xb1e7('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5db797['id']));return sentiment(_0x1e943d[_0xb1e7('0xd')],_0x1e943d[_0xb1e7('0xe')],_0x5894c2[_0xb1e7('0x25')],_0xa1ddc[_0xb1e7('0x15')],_0x5894c2[_0xb1e7('0x26')]);})['then'](function(_0x4bc23a){logger[_0xb1e7('0xa')](util[_0xb1e7('0xb')](_0xb1e7('0x29'),_0x5db797['id']));return _0x5db797['update']({'sentiment':_0x4bc23a[_0xb1e7('0x2a')],'sPositive':_0x4bc23a[_0xb1e7('0x2b')][_0xb1e7('0x2c')],'sNegative':_0x4bc23a[_0xb1e7('0x2b')][_0xb1e7('0x2d')],'sMixed':_0x4bc23a['SentimentScore'][_0xb1e7('0x2e')],'sNeutral':_0x4bc23a[_0xb1e7('0x2b')][_0xb1e7('0x2f')]});})[_0xb1e7('0x10')](function(){logger[_0xb1e7('0xa')](util[_0xb1e7('0xb')](_0xb1e7('0x1e'),_0x5db797['id']));_0x299714();});case _0xb1e7('0x30'):return _0x5db797['update']({'transcribeStatus':_0xb1e7('0x30'),'failureReason':_0x2f677d[_0xb1e7('0x13')]['FailureReason']})[_0xb1e7('0x10')](function(){logger[_0xb1e7('0xa')](util[_0xb1e7('0xb')](_0xb1e7('0x1e'),_0x5db797['id']));_0x299714();});default:logger[_0xb1e7('0xa')](util[_0xb1e7('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x5db797['id']));break;}}else{return BPromise['resolve']()[_0xb1e7('0x10')](function(){if(!_0x5db797[_0xb1e7('0x1f')]){throw new db['Sequelize'][(_0xb1e7('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5894c2[_0xb1e7('0x23')]||!_0x5894c2[_0xb1e7('0x24')]||!_0x5894c2['sentimentRegion']||!_0x5894c2[_0xb1e7('0x26')]||!_0x5894c2['bucket']){throw new db[(_0xb1e7('0x20'))][(_0xb1e7('0x21'))](_0xb1e7('0x27'));}if(!_0x5db797['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x5894c2[_0xb1e7('0x24')]===_0x28c5bb['id']){return _0x28c5bb;}else{return db['CloudProvider'][_0xb1e7('0x31')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x53987c){if(!_0x53987c){throw new db[(_0xb1e7('0x20'))][(_0xb1e7('0x21'))](_0xb1e7('0x32'));}if(!_0x53987c[_0xb1e7('0xd')]||!_0x53987c['data2']){throw new db[(_0xb1e7('0x20'))][(_0xb1e7('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x1e943d=_0x53987c;logger['info'](util[_0xb1e7('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5db797['id']));return sentiment(_0x1e943d['data1'],_0x1e943d[_0xb1e7('0xe')],_0x5894c2[_0xb1e7('0x25')],_0x5db797[_0xb1e7('0x15')],_0x5894c2[_0xb1e7('0x26')]);})[_0xb1e7('0x10')](function(_0x3d6862){logger[_0xb1e7('0xa')](util['format'](_0xb1e7('0x29'),_0x5db797['id']));return _0x5db797[_0xb1e7('0x1d')]({'sentiment':_0x3d6862[_0xb1e7('0x2a')],'sPositive':_0x3d6862[_0xb1e7('0x2b')][_0xb1e7('0x2c')],'sNegative':_0x3d6862[_0xb1e7('0x2b')][_0xb1e7('0x2d')],'sMixed':_0x3d6862[_0xb1e7('0x2b')][_0xb1e7('0x2e')],'sNeutral':_0x3d6862[_0xb1e7('0x2b')]['Neutral'],'transcribeStatus':_0xb1e7('0x16')});})['then'](function(){logger[_0xb1e7('0xa')](util[_0xb1e7('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5db797['id']));_0x299714();});}})['catch'](function(_0x4c043f){if(_0x4c043f){if(!_0x4c043f[_0xb1e7('0x33')]||_0x4c043f['name']!==_0xb1e7('0x34')){logger['error'](util[_0xb1e7('0xb')](_0xb1e7('0x35'),_0x5db797['id']),util[_0xb1e7('0x36')](_0x4c043f,{'showHidden':![],'depth':null}));}}_0x299714();});});}function checkTranscribe(){var _0x9fc86d;var _0x387b57;var _0x24a1de;return db[_0xb1e7('0x37')][_0xb1e7('0x38')]({'where':{'transcribeStatus':_0xb1e7('0x39')}})[_0xb1e7('0x10')](function(_0x296e2c){if(!_0x296e2c||!_0x296e2c[_0xb1e7('0x1c')]){throw new db[(_0xb1e7('0x20'))][(_0xb1e7('0x21'))](_0xb1e7('0x3a'));}_0x9fc86d=_0x296e2c;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](function(_0x371511){if(!_0x371511){throw new db[(_0xb1e7('0x20'))][(_0xb1e7('0x21'))]('Settings\x20not\x20available');}_0x387b57=_0x371511;if(!_0x387b57['transcribe']||!_0x387b57[_0xb1e7('0x3b')]||!_0x387b57[_0xb1e7('0xf')]||!_0x387b57[_0xb1e7('0x26')]||!_0x387b57[_0xb1e7('0x3c')]){throw new db[(_0xb1e7('0x20'))]['ValidationError'](_0xb1e7('0x3d'));}return db[_0xb1e7('0x3e')]['findOne']({'where':{'id':_0x387b57[_0xb1e7('0x3b')]}});})[_0xb1e7('0x10')](function(_0x39f200){if(!_0x39f200){throw new db['Sequelize'][(_0xb1e7('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x39f200[_0xb1e7('0xd')]||!_0x39f200[_0xb1e7('0xe')]){throw new db[(_0xb1e7('0x20'))][(_0xb1e7('0x21'))](_0xb1e7('0x28'));}_0x24a1de=_0x39f200;var _0x15c136=[];_0x9fc86d[_0xb1e7('0x3f')](function(_0x2eb7cc){_0x15c136[_0xb1e7('0x40')](checkTranscribeJob(_0x2eb7cc,_0x387b57,_0x24a1de));});return BPromise[_0xb1e7('0x41')](_0x15c136);})[_0xb1e7('0x42')](function(_0x368227){if(_0x368227){if(!_0x368227['name']||_0x368227['name']!==_0xb1e7('0x34')){logger[_0xb1e7('0x43')](util[_0xb1e7('0x36')](_0x368227,{'showHidden':![],'depth':null}));}}});}exports[_0xb1e7('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file
+var _0x7d25=['detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeRegion','then','transcribeName','TranscriptionJobStatus','fileText','TranscriptionJob','TranscriptFileUri','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20configured','findOne','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','forEach','push','all','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend'];(function(_0x384a37,_0x3d5c30){var _0x5474f1=function(_0x12544f){while(--_0x12544f){_0x384a37['push'](_0x384a37['shift']());}};_0x5474f1(++_0x3d5c30);}(_0x7d25,0x8a));var _0x57d2=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x7d25[_0x556927];return _0x5f1235;};var _=require('lodash');var AWS=require(_0x57d2('0x0'));var rp=require(_0x57d2('0x1'));var util=require(_0x57d2('0x2'));var BPromise=require(_0x57d2('0x3'));var db=require(_0x57d2('0x4'))['db'];var logger=require(_0x57d2('0x5'))(_0x57d2('0x6'));function getTranscriptionJob(_0x5c1baa,_0x5337ca,_0x52a4f4,_0x5dea84){return new Promise(function(_0x3c5511,_0x49cc5f){var _0x1f43b2=new AWS[(_0x57d2('0x7'))]({'accessKeyId':_0x5337ca,'secretAccessKey':_0x5c1baa,'region':_0x52a4f4});_0x1f43b2[_0x57d2('0x8')]({'TranscriptionJobName':_0x5dea84},function(_0x59ae87,_0x49e3e5){if(_0x59ae87){return _0x49cc5f(_0x59ae87);}else{return _0x3c5511(_0x49e3e5);}});});}function sentiment(_0xeb8b91,_0x4f94a6,_0x3a1ec5,_0x5153c2,_0xa04872){return new Promise(function(_0x485438,_0x429301){var _0x1a86db=new AWS[(_0x57d2('0x9'))]({'accessKeyId':_0x4f94a6,'secretAccessKey':_0xeb8b91,'region':_0x3a1ec5});_0x1a86db[_0x57d2('0xa')]({'Text':_0x5153c2,'LanguageCode':_0xa04872[_0x57d2('0xb')](0x0,0x2)},function(_0x142928,_0xe8357c){if(_0x142928){return _0x429301(_0x142928);}else{return _0x485438(_0xe8357c);}});});}function checkTranscribeJob(_0x197426,_0x43d7fb,_0x32c33a){var _0x28428b;return new BPromise(function(_0x3181ad,_0x6940ef){logger[_0x57d2('0xc')](util[_0x57d2('0xd')](_0x57d2('0xe'),_0x197426['id'],_0x197426['transcribeName']));return getTranscriptionJob(_0x32c33a['data1'],_0x32c33a[_0x57d2('0xf')],_0x43d7fb[_0x57d2('0x10')],_0x197426['transcribeName'])[_0x57d2('0x11')](function(_0x319489){logger['info'](util[_0x57d2('0xd')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x197426['id'],_0x197426[_0x57d2('0x12')],_0x319489['TranscriptionJob'][_0x57d2('0x13')]));if(!_0x197426[_0x57d2('0x14')]){switch(_0x319489[_0x57d2('0x15')]['TranscriptionJobStatus']){case'COMPLETED':var _0xbaeda8={'transcribeStatus':_0x319489[_0x57d2('0x15')][_0x57d2('0x13')],'fileUri':_0x319489[_0x57d2('0x15')]['Transcript'][_0x57d2('0x16')]};logger[_0x57d2('0xc')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x197426['id']));return rp({'uri':_0x319489[_0x57d2('0x15')][_0x57d2('0x17')][_0x57d2('0x16')],'json':!![]})[_0x57d2('0x11')](function(_0x386196){logger[_0x57d2('0xc')](util[_0x57d2('0xd')](_0x57d2('0x18'),_0x197426['id']));if(_0x386196&&_0x386196[_0x57d2('0x19')]&&_0x386196[_0x57d2('0x19')][_0x57d2('0x1a')]&&_0x386196[_0x57d2('0x19')][_0x57d2('0x1a')][_0x57d2('0x1b')]){_0xbaeda8['fileText']='';for(var _0x424ddc=0x0;_0x424ddc<_0x386196[_0x57d2('0x19')][_0x57d2('0x1a')][_0x57d2('0x1b')];_0x424ddc++){_0xbaeda8[_0x57d2('0x14')]+=_0x386196['results'][_0x57d2('0x1a')][_0x424ddc][_0x57d2('0x1c')]+'';}}return _0x197426[_0x57d2('0x1d')](_0xbaeda8);})[_0x57d2('0x11')](function(){logger[_0x57d2('0xc')](util[_0x57d2('0xd')](_0x57d2('0x1e'),_0x197426['id']));if(!_0x197426['tempSentiment']){throw new db[(_0x57d2('0x1f'))][(_0x57d2('0x20'))](_0x57d2('0x21'));}if(!_0x43d7fb[_0x57d2('0x22')]||!_0x43d7fb[_0x57d2('0x23')]||!_0x43d7fb[_0x57d2('0x24')]||!_0x43d7fb[_0x57d2('0x25')]||!_0x43d7fb[_0x57d2('0x26')]){throw new db[(_0x57d2('0x1f'))][(_0x57d2('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0xbaeda8[_0x57d2('0x14')]){throw new Error(_0x57d2('0x27'));}if(_0x43d7fb[_0x57d2('0x23')]===_0x32c33a['id']){return _0x32c33a;}else{return db[_0x57d2('0x28')]['findOne']({'where':{'id':_settings[_0x57d2('0x23')]}});}})[_0x57d2('0x11')](function(_0x21152e){if(!_0x21152e){throw new db[(_0x57d2('0x1f'))][(_0x57d2('0x20'))](_0x57d2('0x29'));}if(!_0x21152e[_0x57d2('0x2a')]||!_0x21152e[_0x57d2('0xf')]){throw new db[(_0x57d2('0x1f'))]['ValidationError'](_0x57d2('0x2b'));}_0x28428b=_0x21152e;logger[_0x57d2('0xc')](util['format'](_0x57d2('0x2c'),_0x197426['id']));return sentiment(_0x28428b[_0x57d2('0x2a')],_0x28428b['data2'],_0x43d7fb[_0x57d2('0x24')],_0xbaeda8[_0x57d2('0x14')],_0x43d7fb[_0x57d2('0x25')]);})[_0x57d2('0x11')](function(_0x1805ee){logger['info'](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x197426['id']));return _0x197426['update']({'sentiment':_0x1805ee[_0x57d2('0x2d')],'sPositive':_0x1805ee[_0x57d2('0x2e')][_0x57d2('0x2f')],'sNegative':_0x1805ee[_0x57d2('0x2e')][_0x57d2('0x30')],'sMixed':_0x1805ee['SentimentScore'][_0x57d2('0x31')],'sNeutral':_0x1805ee['SentimentScore'][_0x57d2('0x32')]});})[_0x57d2('0x11')](function(){logger[_0x57d2('0xc')](util['format'](_0x57d2('0x1e'),_0x197426['id']));_0x3181ad();});case _0x57d2('0x33'):return _0x197426['update']({'transcribeStatus':_0x57d2('0x33'),'failureReason':_0x319489[_0x57d2('0x15')][_0x57d2('0x34')]})[_0x57d2('0x11')](function(){logger[_0x57d2('0xc')](util[_0x57d2('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x197426['id']));_0x3181ad();});default:logger[_0x57d2('0xc')](util['format'](_0x57d2('0x35'),_0x197426['id']));break;}}else{return BPromise[_0x57d2('0x36')]()[_0x57d2('0x11')](function(){if(!_0x197426[_0x57d2('0x37')]){throw new db[(_0x57d2('0x1f'))]['ValidationError'](_0x57d2('0x21'));}if(!_0x43d7fb[_0x57d2('0x22')]||!_0x43d7fb['sentimentAccountId']||!_0x43d7fb[_0x57d2('0x24')]||!_0x43d7fb[_0x57d2('0x25')]||!_0x43d7fb[_0x57d2('0x26')]){throw new db['Sequelize'][(_0x57d2('0x20'))](_0x57d2('0x38'));}if(!_0x197426[_0x57d2('0x14')]){throw new Error(_0x57d2('0x27'));}if(_0x43d7fb['sentimentAccountId']===_0x32c33a['id']){return _0x32c33a;}else{return db['CloudProvider'][_0x57d2('0x39')]({'where':{'id':_settings[_0x57d2('0x23')]}});}})[_0x57d2('0x11')](function(_0x5795e7){if(!_0x5795e7){throw new db['Sequelize'][(_0x57d2('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5795e7[_0x57d2('0x2a')]||!_0x5795e7[_0x57d2('0xf')]){throw new db[(_0x57d2('0x1f'))][(_0x57d2('0x20'))](_0x57d2('0x2b'));}_0x28428b=_0x5795e7;logger['info'](util[_0x57d2('0xd')](_0x57d2('0x2c'),_0x197426['id']));return sentiment(_0x28428b['data1'],_0x28428b[_0x57d2('0xf')],_0x43d7fb['sentimentRegion'],_0x197426[_0x57d2('0x14')],_0x43d7fb[_0x57d2('0x25')]);})[_0x57d2('0x11')](function(_0x323273){logger['info'](util['format'](_0x57d2('0x3a'),_0x197426['id']));return _0x197426['update']({'sentiment':_0x323273['Sentiment'],'sPositive':_0x323273[_0x57d2('0x2e')]['Positive'],'sNegative':_0x323273['SentimentScore'][_0x57d2('0x30')],'sMixed':_0x323273['SentimentScore'][_0x57d2('0x31')],'sNeutral':_0x323273['SentimentScore'][_0x57d2('0x32')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x57d2('0xc')](util[_0x57d2('0xd')](_0x57d2('0x1e'),_0x197426['id']));_0x3181ad();});}})[_0x57d2('0x3b')](function(_0x2c6105){if(_0x2c6105){if(!_0x2c6105[_0x57d2('0x3c')]||_0x2c6105['name']!==_0x57d2('0x3d')){logger[_0x57d2('0x3e')](util[_0x57d2('0xd')](_0x57d2('0x3f'),_0x197426['id']),util[_0x57d2('0x40')](_0x2c6105,{'showHidden':![],'depth':null}));}}_0x3181ad();});});}function checkTranscribe(){var _0x8efa5;var _0x69ebf7;var _0x406375;return db['VoiceRecording'][_0x57d2('0x41')]({'where':{'transcribeStatus':_0x57d2('0x42')}})['then'](function(_0x3f9a3f){if(!_0x3f9a3f||!_0x3f9a3f['length']){throw new db['Sequelize'][(_0x57d2('0x20'))](_0x57d2('0x43'));}_0x8efa5=_0x3f9a3f;return db[_0x57d2('0x44')][_0x57d2('0x39')]({'where':{'id':0x1}});})['then'](function(_0x265d24){if(!_0x265d24){throw new db[(_0x57d2('0x1f'))]['ValidationError']('Settings\x20not\x20available');}_0x69ebf7=_0x265d24;if(!_0x69ebf7[_0x57d2('0x6')]||!_0x69ebf7[_0x57d2('0x45')]||!_0x69ebf7[_0x57d2('0x10')]||!_0x69ebf7[_0x57d2('0x25')]||!_0x69ebf7[_0x57d2('0x26')]){throw new db[(_0x57d2('0x1f'))]['ValidationError']('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x57d2('0x39')]({'where':{'id':_0x69ebf7['transcribeAccountId']}});})[_0x57d2('0x11')](function(_0x2ef710){if(!_0x2ef710){throw new db['Sequelize'][(_0x57d2('0x20'))](_0x57d2('0x29'));}if(!_0x2ef710[_0x57d2('0x2a')]||!_0x2ef710['data2']){throw new db[(_0x57d2('0x1f'))][(_0x57d2('0x20'))](_0x57d2('0x2b'));}_0x406375=_0x2ef710;var _0x1d8329=[];_0x8efa5[_0x57d2('0x46')](function(_0x2e90eb){_0x1d8329[_0x57d2('0x47')](checkTranscribeJob(_0x2e90eb,_0x69ebf7,_0x406375));});return BPromise[_0x57d2('0x48')](_0x1d8329);})[_0x57d2('0x3b')](function(_0x56714c){if(_0x56714c){if(!_0x56714c[_0x57d2('0x3c')]||_0x56714c[_0x57d2('0x3c')]!==_0x57d2('0x3d')){logger['error'](util[_0x57d2('0x40')](_0x56714c,{'showHidden':![],'depth':null}));}}});}exports[_0x57d2('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file
index 6de18c4..c0b83f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3127=['map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','util','../../config/environment','../../mysqldb','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length'];(function(_0xb7cb50,_0x3cbb5d){var _0x3d9328=function(_0x27f008){while(--_0x27f008){_0xb7cb50['push'](_0xb7cb50['shift']());}};_0x3d9328(++_0x3cbb5d);}(_0x3127,0xbb));var _0x7312=function(_0x4401b7,_0x98b2f1){_0x4401b7=_0x4401b7-0x0;var _0x458b00=_0x3127[_0x4401b7];return _0x458b00;};'use strict';var _=require(_0x7312('0x0'));var moment=require(_0x7312('0x1'));var Redis=require('ioredis');var util=require(_0x7312('0x2'));var config=require(_0x7312('0x3'));var db=require(_0x7312('0x4'))['db'];var logger=require('../logger')(_0x7312('0x5'));config[_0x7312('0x6')]=_['defaults'](config['redis'],{'host':_0x7312('0x7'),'port':0x18eb});var io=require(_0x7312('0x8'))(new Redis(config[_0x7312('0x6')]));function closeInteractions(){var _0x484f7b=[];return db[_0x7312('0x9')][_0x7312('0xa')]({'raw':!![],'attributes':['id',_0x7312('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7312('0xc')](0x18,_0x7312('0xd'))}}})[_0x7312('0xe')](function(_0x529b70){if(_0x529b70&&_0x529b70[_0x7312('0xf')]){_0x484f7b=_[_0x7312('0x10')](_0x529b70||[],'id');logger[_0x7312('0x11')](_0x7312('0x12'),_0x484f7b[_0x7312('0x13')]());return db[_0x7312('0x9')][_0x7312('0x14')]({'closeReason':_0x7312('0x15'),'disposition':_0x7312('0x16'),'closed':!![],'closedAt':moment()[_0x7312('0x17')](_0x7312('0x18'))},{'where':{'id':_0x484f7b}});}})['then'](function(){if(_0x484f7b&&_0x484f7b[_0x7312('0xf')]){logger[_0x7312('0x11')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x484f7b[_0x7312('0x13')]());for(var _0x51f876=0x0;_0x51f876<_0x484f7b[_0x7312('0xf')];_0x51f876++){io['emit']('whatsappInteraction:update',{'id':_0x484f7b[_0x51f876],'closed':!![]});}}})[_0x7312('0x19')](function(_0x2423dc){logger[_0x7312('0x1a')](_0x7312('0x1b'),_0x2423dc?util[_0x7312('0x1c')](_0x2423dc,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
+var _0x5458=['whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','findAll','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','WhatsappInteraction','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join'];(function(_0x136963,_0x3e96d4){var _0x331e59=function(_0x187297){while(--_0x187297){_0x136963['push'](_0x136963['shift']());}};_0x331e59(++_0x3e96d4);}(_0x5458,0x1c7));var _0x8545=function(_0x14284a,_0x1acbe9){_0x14284a=_0x14284a-0x0;var _0x4a458a=_0x5458[_0x14284a];return _0x4a458a;};'use strict';var _=require(_0x8545('0x0'));var moment=require(_0x8545('0x1'));var Redis=require(_0x8545('0x2'));var util=require('util');var config=require(_0x8545('0x3'));var db=require(_0x8545('0x4'))['db'];var logger=require('../logger')(_0x8545('0x5'));config[_0x8545('0x6')]=_[_0x8545('0x7')](config['redis'],{'host':_0x8545('0x8'),'port':0x18eb});var io=require(_0x8545('0x9'))(new Redis(config[_0x8545('0x6')]));function closeInteractions(){var _0x359d01=[];return db['WhatsappInteraction'][_0x8545('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8545('0xb')](0x18,_0x8545('0xc'))}}})[_0x8545('0xd')](function(_0x10931d){if(_0x10931d&&_0x10931d[_0x8545('0xe')]){_0x359d01=_[_0x8545('0xf')](_0x10931d||[],'id');logger[_0x8545('0x10')](_0x8545('0x11'),_0x359d01['join']());return db[_0x8545('0x12')][_0x8545('0x13')]({'closeReason':_0x8545('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x8545('0x15')](_0x8545('0x16'))},{'where':{'id':_0x359d01}});}})[_0x8545('0xd')](function(){if(_0x359d01&&_0x359d01[_0x8545('0xe')]){logger[_0x8545('0x10')](_0x8545('0x17'),_0x359d01[_0x8545('0x18')]());for(var _0x2de10e=0x0;_0x2de10e<_0x359d01[_0x8545('0xe')];_0x2de10e++){io['emit'](_0x8545('0x19'),{'id':_0x359d01[_0x2de10e],'closed':!![]});}}})[_0x8545('0x1a')](function(_0x4c606a){logger[_0x8545('0x1b')](_0x8545('0x1c'),_0x4c606a?util[_0x8545('0x1d')](_0x4c606a,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
index fbd6ccf..6d80bc8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0d90=['log','contacts2','CmHopper','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','now','innocenzo.biondo','@xcally.com','destroy','then','CmContact','bulkCreate','finished\x20populating','contacts1','hopper1'];(function(_0xdc9cfc,_0x2d90ea){var _0x1ce4bb=function(_0x49ba91){while(--_0x49ba91){_0xdc9cfc['push'](_0xdc9cfc['shift']());}};_0x1ce4bb(++_0x2d90ea);}(_0x0d90,0x181));var _0x00d9=function(_0x41591f,_0x4bc998){_0x41591f=_0x41591f-0x0;var _0x17354d=_0x0d90[_0x41591f];return _0x17354d;};'use strict';var util=require(_0x00d9('0x0'));var db=require(_0x00d9('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x00d9('0x2')]({'id':i,'firstName':_0x00d9('0x3')+i,'lastName':_0x00d9('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x00d9('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x00d9('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x00d9('0x5')](),'updatedAt':Date[_0x00d9('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x00d9('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x00d9('0x6')+i+_0x00d9('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x00d9('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x00d9('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x00d9('0x5')](),'updatedAt':Date['now']()});}db['CmContact'][_0x00d9('0x8')]({'where':{}})[_0x00d9('0x9')](function(){return db[_0x00d9('0xa')][_0x00d9('0xb')](contacts);})[_0x00d9('0x9')](function(){console['log'](_0x00d9('0xc'),_0x00d9('0xd'));return db['CmHopper'][_0x00d9('0x8')]({'where':{}});})[_0x00d9('0x9')](function(){return db['CmHopper'][_0x00d9('0xb')](hopper);})['then'](function(){console['log'](_0x00d9('0xc'),_0x00d9('0xe'));return db[_0x00d9('0xa')][_0x00d9('0xb')](contacts2);})['then'](function(){console[_0x00d9('0xf')](_0x00d9('0xc'),_0x00d9('0x10'));return db[_0x00d9('0x11')][_0x00d9('0xb')](hopper2);})['then'](function(){console[_0x00d9('0xf')](_0x00d9('0xc'),_0x00d9('0x12'));})[_0x00d9('0x13')](function(_0x1bf3e2){console['log'](_0x1bf3e2);});
\ No newline at end of file
+var _0x25aa=['contacts1','CmHopper','bulkCreate','log','contacts2','hopper2','../mysqldb','push','Innocenzo','Biondo','@xcally.com','now','CmContact','destroy','then','finished\x20populating'];(function(_0xd7d9c7,_0x3f5360){var _0x3e0839=function(_0x2a4969){while(--_0x2a4969){_0xd7d9c7['push'](_0xd7d9c7['shift']());}};_0x3e0839(++_0x3f5360);}(_0x25aa,0x1e6));var _0xa25a=function(_0x60286b,_0x3247c1){_0x60286b=_0x60286b-0x0;var _0x5dff69=_0x25aa[_0x60286b];return _0x5dff69;};'use strict';var util=require('util');var db=require(_0xa25a('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xa25a('0x1')]({'id':i,'firstName':_0xa25a('0x2')+i,'lastName':_0xa25a('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xa25a('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xa25a('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xa25a('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa25a('0x5')](),'updatedAt':Date[_0xa25a('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xa25a('0x1')]({'id':i,'firstName':_0xa25a('0x2')+i,'lastName':_0xa25a('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xa25a('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xa25a('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa25a('0x5')](),'updatedAt':Date[_0xa25a('0x5')]()});}db[_0xa25a('0x6')][_0xa25a('0x7')]({'where':{}})[_0xa25a('0x8')](function(){return db[_0xa25a('0x6')]['bulkCreate'](contacts);})[_0xa25a('0x8')](function(){console['log'](_0xa25a('0x9'),_0xa25a('0xa'));return db['CmHopper'][_0xa25a('0x7')]({'where':{}});})['then'](function(){return db[_0xa25a('0xb')][_0xa25a('0xc')](hopper);})[_0xa25a('0x8')](function(){console[_0xa25a('0xd')](_0xa25a('0x9'),'hopper1');return db[_0xa25a('0x6')][_0xa25a('0xc')](contacts2);})[_0xa25a('0x8')](function(){console[_0xa25a('0xd')](_0xa25a('0x9'),_0xa25a('0xe'));return db[_0xa25a('0xb')][_0xa25a('0xc')](hopper2);})[_0xa25a('0x8')](function(){console[_0xa25a('0xd')](_0xa25a('0x9'),_0xa25a('0xf'));})['catch'](function(_0x3204d0){console[_0xa25a('0xd')](_0x3204d0);});
\ No newline at end of file
index b4a426f..1de8882 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6307=['catch','util','push','format','%s%s','agent','%s%s@xcally.com','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user'];(function(_0x2a6732,_0xab0429){var _0x16698c=function(_0x200659){while(--_0x200659){_0x2a6732['push'](_0x2a6732['shift']());}};_0x16698c(++_0xab0429);}(_0x6307,0xac));var _0x7630=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x6307[_0x34843e];return _0x598f7f;};'use strict';var util=require(_0x7630('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7630('0x1')]({'name':util[_0x7630('0x2')](_0x7630('0x3'),_0x7630('0x4'),i),'fullname':util[_0x7630('0x2')](_0x7630('0x3'),_0x7630('0x4'),i),'email':util[_0x7630('0x2')](_0x7630('0x5'),'agent',i),'role':_0x7630('0x4'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x7630('0x6'),'ws',_0x7630('0x7')],'disallow':[_0x7630('0x8')],'allow':[_0x7630('0x9')],'defaultuser':util[_0x7630('0x2')](_0x7630('0x3'),'agent',i),'encryption':_0x7630('0xa'),'avpf':_0x7630('0xa'),'force_avp':_0x7630('0xa'),'icesupport':_0x7630('0xa'),'dtlsenable':_0x7630('0xa'),'dtlsverify':'no','dtlscertfile':_0x7630('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x7630('0xc'),'callerid':util[_0x7630('0x2')](_0x7630('0xd'),util[_0x7630('0x2')](_0x7630('0x3'),_0x7630('0x4'),i),0xfa0+i)});}db[_0x7630('0xe')][_0x7630('0xf')](users)['then'](function(){console[_0x7630('0x10')](_0x7630('0x11'));})[_0x7630('0x12')](function(_0x586829){console[_0x7630('0x10')](_0x586829);});
\ No newline at end of file
+var _0xb4d0=['ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','log','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','udp','all'];(function(_0x46bea4,_0x455b2f){var _0x54f2f8=function(_0x426efc){while(--_0x426efc){_0x46bea4['push'](_0x46bea4['shift']());}};_0x54f2f8(++_0x455b2f);}(_0xb4d0,0x168));var _0x0b4d=function(_0xe13681,_0x417526){_0xe13681=_0xe13681-0x0;var _0x5f0d45=_0xb4d0[_0xe13681];return _0x5f0d45;};'use strict';var util=require('util');var db=require(_0x0b4d('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x0b4d('0x1')]({'name':util[_0x0b4d('0x2')](_0x0b4d('0x3'),_0x0b4d('0x4'),i),'fullname':util[_0x0b4d('0x2')](_0x0b4d('0x3'),_0x0b4d('0x4'),i),'email':util['format'](_0x0b4d('0x5'),_0x0b4d('0x4'),i),'role':_0x0b4d('0x4'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x0b4d('0x6'),'ws','wss'],'disallow':[_0x0b4d('0x7')],'allow':[_0x0b4d('0x8')],'defaultuser':util['format'](_0x0b4d('0x3'),'agent',i),'encryption':_0x0b4d('0x9'),'avpf':'yes','force_avp':_0x0b4d('0x9'),'icesupport':'yes','dtlsenable':_0x0b4d('0x9'),'dtlsverify':'no','dtlscertfile':_0x0b4d('0xa'),'dtlsprivatekey':_0x0b4d('0xb'),'dtlssetup':'actpass','callerid':util[_0x0b4d('0x2')](_0x0b4d('0xc'),util[_0x0b4d('0x2')]('%s%s',_0x0b4d('0x4'),i),0xfa0+i)});}db[_0x0b4d('0xd')][_0x0b4d('0xe')](users)['then'](function(){console[_0x0b4d('0xf')]('add\x20user');})['catch'](function(_0x38165c){console[_0x0b4d('0xf')](_0x38165c);});
\ No newline at end of file
index fd59c0e..68c993b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x04fa=['join','connection','request','remoteAddress','remotePort','log','SocketIO\x20','nsp','address','disconnect','CONNECTED','util','bluebird','../mysqldb','./environment','name','User','role','agent','type','UserProfileSection','autoAssociation','ChatQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','resourceId','where','Campaign','ivr','then','Agents','length','format','user:%s','handshake','query','find','userProfileId','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','user','voice:inbound','voice:outbound','VoiceQueues','FaxQueues','MailQueue','OpenchannelQueues','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','voice','chat','sms','openchannel','whatsapp','map','removeChatInteractions','user_has_chat_interactions:remove','emit','user_has_mail_interactions:remove','leave','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','OpenchannelInteractions','user_has_openchannel_interactions:remove','catch'];(function(_0x4ca758,_0x5f435e){var _0x1e3660=function(_0x2b32c2){while(--_0x2b32c2){_0x4ca758['push'](_0x4ca758['shift']());}};_0x1e3660(++_0x5f435e);}(_0x04fa,0x119));var _0xa04f=function(_0x517649,_0x2ab1ed){_0x517649=_0x517649-0x0;var _0x4ebc6c=_0x04fa[_0x517649];return _0x4ebc6c;};'use strict';var _=require('lodash');var util=require(_0xa04f('0x0'));var BPromise=require(_0xa04f('0x1'));var db=require(_0xa04f('0x2'))['db'];var config=require(_0xa04f('0x3'));var queryQueues={'attributes':['id',_0xa04f('0x4')],'include':[{'as':'Agents','model':db[_0xa04f('0x5')],'attributes':['id','name',_0xa04f('0x6')],'raw':!![],'where':{'role':_0xa04f('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xa04f('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xa04f('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xa04f('0x4')],'where':{'role':_0xa04f('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xa04f('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x4a8c2a,_0x4d254b,_0x5ea498){return db[_0xa04f('0x9')]['findOne']({'where':{'name':_0x4a8c2a,'userProfileId':_0x4d254b},'raw':!![]})['then'](function(_0x4005da){if(_0x4005da){if(_0x4005da[_0xa04f('0xa')]){switch(_0x4a8c2a){case'VoiceQueues':case _0xa04f('0xb'):case'FaxQueues':case _0xa04f('0xc'):case _0xa04f('0xd'):case'OpenchannelQueues':case _0xa04f('0xe'):return db[_0x5ea498][_0xa04f('0xf')](queryQueues);case'Telephones':return db[_0x5ea498]['findAll'](queryTelephones);case'Trunks':return db[_0x5ea498][_0xa04f('0xf')](queryTrunks);case _0xa04f('0x10'):return db[_0x5ea498][_0xa04f('0xf')](queryCampaigns);}}else{return db[_0xa04f('0x11')][_0xa04f('0xf')]({'attributes':[_0xa04f('0x12')],'where':{'sectionId':_0x4005da['id']},'raw':!![]})['then'](function(_0xf25bd){if(_0xf25bd){var _0x2737f2={'where':{'id':_['map'](_0xf25bd,_0xa04f('0x12'))},'raw':!![]};switch(_0x5ea498){case _0xa04f('0x5'):_0x2737f2[_0xa04f('0x13')][_0xa04f('0x6')]='telephone';break;case _0xa04f('0x14'):_0x2737f2['where'][_0xa04f('0x8')]=_0xa04f('0x15');break;}return db[_0x5ea498]['findAll'](_0x2737f2);}else{return[];}});}}else{return[];}})[_0xa04f('0x16')](function(_0x29fca1){return _0x29fca1;});}function joinOrLeaveQueues(_0x31e707,_0x4ee169,_0x550f61,_0x40e7d5){_0x31e707[_0x4ee169](util['format']('%s:queue:%s',_0x550f61,_0x40e7d5[_0xa04f('0x4')]));if(_0x40e7d5[_0xa04f('0x17')]){for(var _0x48f760=0x0;_0x48f760<_0x40e7d5['Agents'][_0xa04f('0x18')];_0x48f760+=0x1){_0x31e707[_0x4ee169](util[_0xa04f('0x19')](_0xa04f('0x1a'),_0x40e7d5[_0xa04f('0x17')][_0x48f760][_0xa04f('0x4')]));}}}function joinOrLeave(_0x147df7,_0x600bfa,_0x40bc69){var _0x28dc9b;if(_0x147df7[_0xa04f('0x1b')][_0xa04f('0x1c')]['id']){db[_0xa04f('0x5')][_0xa04f('0x1d')]({'attributes':['id',_0xa04f('0x4'),'role',_0xa04f('0x1e')],'where':{'id':_0x147df7[_0xa04f('0x1b')][_0xa04f('0x1c')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa04f('0x1f')],'as':_0xa04f('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0xa04f('0x21')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa04f('0x22')],'as':_0xa04f('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xa04f('0x24')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa04f('0x25')],'as':_0xa04f('0x26'),'attributes':['id'],'raw':!![]}]})[_0xa04f('0x16')](function(_0x7e0865){if(_0x7e0865){_0x28dc9b=_0x7e0865;_0x147df7[_0x600bfa](util[_0xa04f('0x19')](_0xa04f('0x1a'),_0x7e0865[_0xa04f('0x4')]));var _0x4bde12=[];switch(_0x7e0865[_0xa04f('0x6')]){case _0xa04f('0x27'):_0x147df7[_0x600bfa]('voice:inbound');_0x147df7[_0x600bfa]('voice:outbound');if(queryQueues[_0xa04f('0x28')](_0xa04f('0x29'))){delete queryQueues[_0xa04f('0x29')];}_0x4bde12[_0xa04f('0x2a')](db[_0xa04f('0x2b')][_0xa04f('0xf')](queryQueues));_0x4bde12['push'](db[_0xa04f('0x2c')][_0xa04f('0xf')](queryQueues));_0x4bde12[_0xa04f('0x2a')](db['FaxQueue']['findAll'](queryQueues));_0x4bde12['push'](db[_0xa04f('0x2d')][_0xa04f('0xf')](queryQueues));_0x4bde12[_0xa04f('0x2a')](db['MailQueue']['findAll'](queryQueues));_0x4bde12[_0xa04f('0x2a')](db[_0xa04f('0x2e')][_0xa04f('0xf')](queryQueues));_0x4bde12[_0xa04f('0x2a')](db[_0xa04f('0x2f')][_0xa04f('0xf')](queryQueues));_0x4bde12['push'](db[_0xa04f('0x5')][_0xa04f('0xf')](queryTelephones));_0x4bde12[_0xa04f('0x2a')](db['Trunk'][_0xa04f('0xf')](queryTrunks));_0x4bde12[_0xa04f('0x2a')](db[_0xa04f('0x14')][_0xa04f('0xf')](queryCampaigns));_0x4bde12['push'](db['User']['findAll'](queryAgents));break;case _0xa04f('0x30'):_0x147df7[_0x600bfa](_0xa04f('0x31'));_0x147df7[_0x600bfa](_0xa04f('0x32'));_0x4bde12[_0xa04f('0x2a')](getAssociatedResources(_0xa04f('0x33'),_0x7e0865[_0xa04f('0x1e')],'VoiceQueue'));_0x4bde12['push'](getAssociatedResources('ChatQueues',_0x7e0865[_0xa04f('0x1e')],_0xa04f('0x2c')));_0x4bde12['push'](getAssociatedResources(_0xa04f('0x34'),_0x7e0865[_0xa04f('0x1e')],'FaxQueue'));_0x4bde12['push'](getAssociatedResources(_0xa04f('0xc'),_0x7e0865[_0xa04f('0x1e')],_0xa04f('0x2d')));_0x4bde12[_0xa04f('0x2a')](getAssociatedResources(_0xa04f('0xd'),_0x7e0865[_0xa04f('0x1e')],_0xa04f('0x35')));_0x4bde12['push'](getAssociatedResources(_0xa04f('0x36'),_0x7e0865['userProfileId'],_0xa04f('0x2e')));_0x4bde12['push'](getAssociatedResources(_0xa04f('0xe'),_0x7e0865[_0xa04f('0x1e')],_0xa04f('0x2f')));_0x4bde12[_0xa04f('0x2a')](getAssociatedResources('Telephones',_0x7e0865[_0xa04f('0x1e')],'User'));_0x4bde12[_0xa04f('0x2a')](getAssociatedResources(_0xa04f('0x37'),_0x7e0865[_0xa04f('0x1e')],'Trunk'));_0x4bde12['push'](getAssociatedResources('IvrCampaigns',_0x7e0865[_0xa04f('0x1e')],_0xa04f('0x14')));_0x4bde12[_0xa04f('0x2a')](db['User'][_0xa04f('0xf')](queryAgents));break;case _0xa04f('0x7'):_0x147df7[_0x600bfa](_0xa04f('0x31'));_0x147df7[_0x600bfa]('voice:outbound');_0x4bde12[_0xa04f('0x2a')](_0x7e0865[_0xa04f('0x38')]({'attributes':['id',_0xa04f('0x4')]}));_0x4bde12[_0xa04f('0x2a')](_0x7e0865[_0xa04f('0x39')]({'attributes':['id',_0xa04f('0x4')]}));_0x4bde12[_0xa04f('0x2a')](_0x7e0865[_0xa04f('0x3a')]({'attributes':['id',_0xa04f('0x4')]}));_0x4bde12[_0xa04f('0x2a')](_0x7e0865[_0xa04f('0x3b')]({'attributes':['id','name']}));_0x4bde12['push'](_0x7e0865[_0xa04f('0x3c')]({'attributes':['id',_0xa04f('0x4')]}));_0x4bde12[_0xa04f('0x2a')](_0x7e0865['getOpenchannelQueues']({'attributes':['id',_0xa04f('0x4')]}));_0x4bde12[_0xa04f('0x2a')](_0x7e0865[_0xa04f('0x3d')]({'attributes':['id',_0xa04f('0x4')]}));break;}return BPromise['all'](_0x4bde12);}})[_0xa04f('0x16')](function(_0xd48727){if(_0xd48727&&_0xd48727[_0xa04f('0x18')]){for(var _0x45d060=0x0;_0x45d060<_0xd48727[_0xa04f('0x18')];_0x45d060+=0x1){for(var _0x402853=0x0;_0x402853<_0xd48727[_0x45d060][_0xa04f('0x18')];_0x402853+=0x1){switch(_0x45d060){case 0x0:joinOrLeaveQueues(_0x147df7,_0x600bfa,_0xa04f('0x3e'),_0xd48727[_0x45d060][_0x402853]);break;case 0x1:joinOrLeaveQueues(_0x147df7,_0x600bfa,_0xa04f('0x3f'),_0xd48727[_0x45d060][_0x402853]);break;case 0x2:joinOrLeaveQueues(_0x147df7,_0x600bfa,'fax',_0xd48727[_0x45d060][_0x402853]);break;case 0x3:joinOrLeaveQueues(_0x147df7,_0x600bfa,_0xa04f('0x40'),_0xd48727[_0x45d060][_0x402853]);break;case 0x4:joinOrLeaveQueues(_0x147df7,_0x600bfa,'mail',_0xd48727[_0x45d060][_0x402853]);break;case 0x5:joinOrLeaveQueues(_0x147df7,_0x600bfa,_0xa04f('0x41'),_0xd48727[_0x45d060][_0x402853]);break;case 0x6:joinOrLeaveQueues(_0x147df7,_0x600bfa,_0xa04f('0x42'),_0xd48727[_0x45d060][_0x402853]);break;case 0x7:if(_0x28dc9b[_0xa04f('0x6')]!==_0xa04f('0x7'))_0x147df7[_0x600bfa](util[_0xa04f('0x19')]('telephone:%s',_0xd48727[_0x45d060][_0x402853]['name']));break;case 0x8:if(_0x28dc9b[_0xa04f('0x6')]!==_0xa04f('0x7'))_0x147df7[_0x600bfa](util[_0xa04f('0x19')]('trunk:%s',_0xd48727[_0x45d060][_0x402853][_0xa04f('0x4')]));break;case 0x9:if(_0x28dc9b[_0xa04f('0x6')]!=='agent')_0x147df7[_0x600bfa](util[_0xa04f('0x19')]('campaign:%s:%s',_0xd48727[_0x45d060][_0x402853][_0xa04f('0x8')],_0xd48727[_0x45d060][_0x402853]['name']));break;case 0xa:_0x147df7[_0x600bfa](util[_0xa04f('0x19')](_0xa04f('0x1a'),_0xd48727[_0x45d060][_0x402853]['name']));break;}}}}})[_0xa04f('0x16')](function(){if(_0x600bfa==='leave'){var _0xf348d5=_[_0xa04f('0x43')](_0x28dc9b['ChatInteractions'],'id');return _0x28dc9b[_0xa04f('0x44')](_0xf348d5)['then'](function(){for(var _0x131d6d=0x0;_0x131d6d<_0xf348d5['length'];_0x131d6d+=0x1){_0x40bc69['emit'](_0xa04f('0x45'),{'ChatInteractionId':Number(_0xf348d5[_0x131d6d]),'UserId':Number(_0x28dc9b['id'])});}});}})[_0xa04f('0x16')](function(){if(_0x600bfa==='leave'){var _0x29d25b=_[_0xa04f('0x43')](_0x28dc9b[_0xa04f('0x20')],'id');return _0x28dc9b['removeMailInteractions'](_0x29d25b)['then'](function(){for(var _0x56d7d5=0x0;_0x56d7d5<_0x29d25b[_0xa04f('0x18')];_0x56d7d5+=0x1){_0x40bc69[_0xa04f('0x46')](_0xa04f('0x47'),{'MailInteractionId':Number(_0x29d25b[_0x56d7d5]),'UserId':Number(_0x28dc9b['id'])});}});}})[_0xa04f('0x16')](function(){if(_0x600bfa===_0xa04f('0x48')){var _0x4e68ed=_[_0xa04f('0x43')](_0x28dc9b['FaxInteractions'],'id');return _0x28dc9b[_0xa04f('0x49')](_0x4e68ed)[_0xa04f('0x16')](function(){for(var _0x5765e5=0x0;_0x5765e5<_0x4e68ed['length'];_0x5765e5+=0x1){_0x40bc69[_0xa04f('0x46')](_0xa04f('0x4a'),{'FaxInteractionId':Number(_0x4e68ed[_0x5765e5]),'UserId':Number(_0x28dc9b['id'])});}});}})[_0xa04f('0x16')](function(){if(_0x600bfa===_0xa04f('0x48')){var _0x4bd9f0=_[_0xa04f('0x43')](_0x28dc9b['SmsInteractions'],'id');return _0x28dc9b['removeSmsInteractions'](_0x4bd9f0)[_0xa04f('0x16')](function(){for(var _0x1cf068=0x0;_0x1cf068<_0x4bd9f0[_0xa04f('0x18')];_0x1cf068+=0x1){_0x40bc69[_0xa04f('0x46')](_0xa04f('0x4b'),{'SmsInteractionId':Number(_0x4bd9f0[_0x1cf068]),'UserId':Number(_0x28dc9b['id'])});}});}})[_0xa04f('0x16')](function(){if(_0x600bfa==='leave'){var _0x2b6051=_[_0xa04f('0x43')](_0x28dc9b[_0xa04f('0x4c')],'id');return _0x28dc9b['removeOpenchannelInteractions'](_0x2b6051)[_0xa04f('0x16')](function(){for(var _0x5bc47d=0x0;_0x5bc47d<_0x2b6051[_0xa04f('0x18')];_0x5bc47d+=0x1){_0x40bc69[_0xa04f('0x46')](_0xa04f('0x4d'),{'OpenchannelInteractionId':Number(_0x2b6051[_0x5bc47d]),'UserId':Number(_0x28dc9b['id'])});}});}})[_0xa04f('0x16')](function(){if(_0x600bfa==='leave'){var _0x1d0f2f=_[_0xa04f('0x43')](_0x28dc9b[_0xa04f('0x26')],'id');return _0x28dc9b['removeWhatsappInteractions'](_0x1d0f2f)[_0xa04f('0x16')](function(){for(var _0x1dd9e6=0x0;_0x1dd9e6<_0x1d0f2f['length'];_0x1dd9e6+=0x1){_0x40bc69[_0xa04f('0x46')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x1d0f2f[_0x1dd9e6]),'UserId':Number(_0x28dc9b['id'])});}});}})[_0xa04f('0x4e')](function(_0x5002ae){_0x147df7['log'](_0x5002ae);});}}function onDisconnect(_0x8c677b,_0x5552e8){joinOrLeave(_0x8c677b,_0xa04f('0x48'),_0x5552e8);}function onConnect(_0x594ff2){joinOrLeave(_0x594ff2,_0xa04f('0x4f'));}exports['default']=function(_0x4e6b7b){_0x4e6b7b['on'](_0xa04f('0x50'),function(_0xa0f0a8){_0xa0f0a8['setMaxListeners'](0x0);_0xa0f0a8['address']=_0xa0f0a8[_0xa04f('0x51')][_0xa04f('0x50')][_0xa04f('0x52')]+':'+_0xa0f0a8[_0xa04f('0x51')][_0xa04f('0x50')][_0xa04f('0x53')];_0xa0f0a8['connectedAt']=new Date();_0xa0f0a8['log']=function(_0x223242){console[_0xa04f('0x54')](_0xa04f('0x55')+_0xa0f0a8[_0xa04f('0x56')][_0xa04f('0x4')]+'['+_0xa0f0a8[_0xa04f('0x57')]+']',_0x223242);};_0xa0f0a8['on'](_0xa04f('0x58'),function(){onDisconnect(_0xa0f0a8,_0x4e6b7b);_0xa0f0a8[_0xa04f('0x54')]('DISCONNECTED');});onConnect(_0xa0f0a8);_0xa0f0a8['log'](_0xa04f('0x59'));});};
\ No newline at end of file
+var _0xc0a4=['DISCONNECTED','CONNECTED','lodash','util','../mysqldb','name','Agents','User','role','agent','telephone','type','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','Telephones','IvrCampaigns','findAll','UserProfileResource','map','where','Campaign','ivr','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','format','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','Trunk','VoiceQueue','FaxQueue','MailQueues','OpenchannelQueue','WhatsappQueue','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getOpenchannelQueues','all','voice','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','remoteAddress','connectedAt','SocketIO\x20','nsp','address'];(function(_0x461d25,_0x5d6b99){var _0x19f79e=function(_0x15353b){while(--_0x15353b){_0x461d25['push'](_0x461d25['shift']());}};_0x19f79e(++_0x5d6b99);}(_0xc0a4,0xc6));var _0x4c0a=function(_0x3c7b4e,_0x5ed116){_0x3c7b4e=_0x3c7b4e-0x0;var _0x31bb95=_0xc0a4[_0x3c7b4e];return _0x31bb95;};'use strict';var _=require(_0x4c0a('0x0'));var util=require(_0x4c0a('0x1'));var BPromise=require('bluebird');var db=require(_0x4c0a('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x4c0a('0x3')],'include':[{'as':_0x4c0a('0x4'),'model':db[_0x4c0a('0x5')],'attributes':['id',_0x4c0a('0x3'),_0x4c0a('0x6')],'raw':!![],'where':{'role':_0x4c0a('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x4c0a('0x3')],'where':{'role':_0x4c0a('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x4c0a('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x4c0a('0x3')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4c0a('0x3'),_0x4c0a('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x551074,_0x103f41,_0x493120){return db[_0x4c0a('0xa')]['findOne']({'where':{'name':_0x551074,'userProfileId':_0x103f41},'raw':!![]})[_0x4c0a('0xb')](function(_0x9df259){if(_0x9df259){if(_0x9df259[_0x4c0a('0xc')]){switch(_0x551074){case _0x4c0a('0xd'):case _0x4c0a('0xe'):case _0x4c0a('0xf'):case _0x4c0a('0x10'):case'MailQueues':case _0x4c0a('0x11'):case _0x4c0a('0x12'):return db[_0x493120]['findAll'](queryQueues);case _0x4c0a('0x13'):return db[_0x493120]['findAll'](queryTelephones);case'Trunks':return db[_0x493120]['findAll'](queryTrunks);case _0x4c0a('0x14'):return db[_0x493120][_0x4c0a('0x15')](queryCampaigns);}}else{return db[_0x4c0a('0x16')][_0x4c0a('0x15')]({'attributes':['resourceId'],'where':{'sectionId':_0x9df259['id']},'raw':!![]})[_0x4c0a('0xb')](function(_0x80b5be){if(_0x80b5be){var _0x5117ee={'where':{'id':_[_0x4c0a('0x17')](_0x80b5be,'resourceId')},'raw':!![]};switch(_0x493120){case _0x4c0a('0x5'):_0x5117ee[_0x4c0a('0x18')]['role']=_0x4c0a('0x8');break;case _0x4c0a('0x19'):_0x5117ee['where'][_0x4c0a('0x9')]=_0x4c0a('0x1a');break;}return db[_0x493120][_0x4c0a('0x15')](_0x5117ee);}else{return[];}});}}else{return[];}})['then'](function(_0x1f76a4){return _0x1f76a4;});}function joinOrLeaveQueues(_0xad0b94,_0x11a8c1,_0x3617c9,_0x22c139){_0xad0b94[_0x11a8c1](util['format'](_0x4c0a('0x1b'),_0x3617c9,_0x22c139[_0x4c0a('0x3')]));if(_0x22c139['Agents']){for(var _0x2d0b41=0x0;_0x2d0b41<_0x22c139['Agents'][_0x4c0a('0x1c')];_0x2d0b41+=0x1){_0xad0b94[_0x11a8c1](util['format'](_0x4c0a('0x1d'),_0x22c139[_0x4c0a('0x4')][_0x2d0b41][_0x4c0a('0x3')]));}}}function joinOrLeave(_0x5ccbfd,_0x238725,_0x3a83a6){var _0xfb4530;if(_0x5ccbfd[_0x4c0a('0x1e')][_0x4c0a('0x1f')]['id']){db[_0x4c0a('0x5')][_0x4c0a('0x20')]({'attributes':['id',_0x4c0a('0x3'),_0x4c0a('0x6'),_0x4c0a('0x21')],'where':{'id':_0x5ccbfd[_0x4c0a('0x1e')][_0x4c0a('0x1f')]['id']},'include':[{'model':db[_0x4c0a('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x4c0a('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x4c0a('0x24')],'as':_0x4c0a('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x4c0a('0x26')],'as':_0x4c0a('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x4c0a('0x28')],'as':_0x4c0a('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x4c0a('0x2a')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x4c0a('0xb')](function(_0x3ef6cc){if(_0x3ef6cc){_0xfb4530=_0x3ef6cc;_0x5ccbfd[_0x238725](util[_0x4c0a('0x2b')]('user:%s',_0x3ef6cc['name']));var _0x5e64d5=[];switch(_0x3ef6cc[_0x4c0a('0x6')]){case'admin':_0x5ccbfd[_0x238725](_0x4c0a('0x2c'));_0x5ccbfd[_0x238725](_0x4c0a('0x2d'));if(queryQueues[_0x4c0a('0x2e')](_0x4c0a('0x2f'))){delete queryQueues[_0x4c0a('0x2f')];}_0x5e64d5[_0x4c0a('0x30')](db['VoiceQueue'][_0x4c0a('0x15')](queryQueues));_0x5e64d5[_0x4c0a('0x30')](db[_0x4c0a('0x31')]['findAll'](queryQueues));_0x5e64d5[_0x4c0a('0x30')](db['FaxQueue'][_0x4c0a('0x15')](queryQueues));_0x5e64d5['push'](db[_0x4c0a('0x32')][_0x4c0a('0x15')](queryQueues));_0x5e64d5[_0x4c0a('0x30')](db['MailQueue'][_0x4c0a('0x15')](queryQueues));_0x5e64d5[_0x4c0a('0x30')](db['OpenchannelQueue'][_0x4c0a('0x15')](queryQueues));_0x5e64d5['push'](db['WhatsappQueue'][_0x4c0a('0x15')](queryQueues));_0x5e64d5['push'](db[_0x4c0a('0x5')][_0x4c0a('0x15')](queryTelephones));_0x5e64d5[_0x4c0a('0x30')](db[_0x4c0a('0x33')][_0x4c0a('0x15')](queryTrunks));_0x5e64d5[_0x4c0a('0x30')](db['Campaign'][_0x4c0a('0x15')](queryCampaigns));_0x5e64d5['push'](db[_0x4c0a('0x5')]['findAll'](queryAgents));break;case'user':_0x5ccbfd[_0x238725](_0x4c0a('0x2c'));_0x5ccbfd[_0x238725](_0x4c0a('0x2d'));_0x5e64d5[_0x4c0a('0x30')](getAssociatedResources(_0x4c0a('0xd'),_0x3ef6cc[_0x4c0a('0x21')],_0x4c0a('0x34')));_0x5e64d5[_0x4c0a('0x30')](getAssociatedResources(_0x4c0a('0xe'),_0x3ef6cc[_0x4c0a('0x21')],_0x4c0a('0x31')));_0x5e64d5[_0x4c0a('0x30')](getAssociatedResources(_0x4c0a('0xf'),_0x3ef6cc['userProfileId'],_0x4c0a('0x35')));_0x5e64d5['push'](getAssociatedResources(_0x4c0a('0x10'),_0x3ef6cc['userProfileId'],_0x4c0a('0x32')));_0x5e64d5[_0x4c0a('0x30')](getAssociatedResources(_0x4c0a('0x36'),_0x3ef6cc[_0x4c0a('0x21')],'MailQueue'));_0x5e64d5[_0x4c0a('0x30')](getAssociatedResources('OpenchannelQueues',_0x3ef6cc['userProfileId'],_0x4c0a('0x37')));_0x5e64d5[_0x4c0a('0x30')](getAssociatedResources('WhatsappQueues',_0x3ef6cc[_0x4c0a('0x21')],_0x4c0a('0x38')));_0x5e64d5['push'](getAssociatedResources('Telephones',_0x3ef6cc['userProfileId'],_0x4c0a('0x5')));_0x5e64d5[_0x4c0a('0x30')](getAssociatedResources(_0x4c0a('0x39'),_0x3ef6cc[_0x4c0a('0x21')],_0x4c0a('0x33')));_0x5e64d5[_0x4c0a('0x30')](getAssociatedResources(_0x4c0a('0x14'),_0x3ef6cc[_0x4c0a('0x21')],_0x4c0a('0x19')));_0x5e64d5[_0x4c0a('0x30')](db[_0x4c0a('0x5')][_0x4c0a('0x15')](queryAgents));break;case _0x4c0a('0x7'):_0x5ccbfd[_0x238725](_0x4c0a('0x2c'));_0x5ccbfd[_0x238725]('voice:outbound');_0x5e64d5[_0x4c0a('0x30')](_0x3ef6cc[_0x4c0a('0x3a')]({'attributes':['id',_0x4c0a('0x3')]}));_0x5e64d5['push'](_0x3ef6cc[_0x4c0a('0x3b')]({'attributes':['id',_0x4c0a('0x3')]}));_0x5e64d5[_0x4c0a('0x30')](_0x3ef6cc[_0x4c0a('0x3c')]({'attributes':['id',_0x4c0a('0x3')]}));_0x5e64d5['push'](_0x3ef6cc['getSmsQueues']({'attributes':['id',_0x4c0a('0x3')]}));_0x5e64d5[_0x4c0a('0x30')](_0x3ef6cc['getMailQueues']({'attributes':['id','name']}));_0x5e64d5[_0x4c0a('0x30')](_0x3ef6cc[_0x4c0a('0x3d')]({'attributes':['id',_0x4c0a('0x3')]}));_0x5e64d5[_0x4c0a('0x30')](_0x3ef6cc['getWhatsappQueues']({'attributes':['id',_0x4c0a('0x3')]}));break;}return BPromise[_0x4c0a('0x3e')](_0x5e64d5);}})[_0x4c0a('0xb')](function(_0x508c7d){if(_0x508c7d&&_0x508c7d[_0x4c0a('0x1c')]){for(var _0x4b5f08=0x0;_0x4b5f08<_0x508c7d['length'];_0x4b5f08+=0x1){for(var _0x4b5047=0x0;_0x4b5047<_0x508c7d[_0x4b5f08][_0x4c0a('0x1c')];_0x4b5047+=0x1){switch(_0x4b5f08){case 0x0:joinOrLeaveQueues(_0x5ccbfd,_0x238725,_0x4c0a('0x3f'),_0x508c7d[_0x4b5f08][_0x4b5047]);break;case 0x1:joinOrLeaveQueues(_0x5ccbfd,_0x238725,_0x4c0a('0x40'),_0x508c7d[_0x4b5f08][_0x4b5047]);break;case 0x2:joinOrLeaveQueues(_0x5ccbfd,_0x238725,'fax',_0x508c7d[_0x4b5f08][_0x4b5047]);break;case 0x3:joinOrLeaveQueues(_0x5ccbfd,_0x238725,_0x4c0a('0x41'),_0x508c7d[_0x4b5f08][_0x4b5047]);break;case 0x4:joinOrLeaveQueues(_0x5ccbfd,_0x238725,_0x4c0a('0x42'),_0x508c7d[_0x4b5f08][_0x4b5047]);break;case 0x5:joinOrLeaveQueues(_0x5ccbfd,_0x238725,_0x4c0a('0x43'),_0x508c7d[_0x4b5f08][_0x4b5047]);break;case 0x6:joinOrLeaveQueues(_0x5ccbfd,_0x238725,_0x4c0a('0x44'),_0x508c7d[_0x4b5f08][_0x4b5047]);break;case 0x7:if(_0xfb4530[_0x4c0a('0x6')]!==_0x4c0a('0x7'))_0x5ccbfd[_0x238725](util['format'](_0x4c0a('0x45'),_0x508c7d[_0x4b5f08][_0x4b5047][_0x4c0a('0x3')]));break;case 0x8:if(_0xfb4530[_0x4c0a('0x6')]!=='agent')_0x5ccbfd[_0x238725](util[_0x4c0a('0x2b')](_0x4c0a('0x46'),_0x508c7d[_0x4b5f08][_0x4b5047]['name']));break;case 0x9:if(_0xfb4530[_0x4c0a('0x6')]!==_0x4c0a('0x7'))_0x5ccbfd[_0x238725](util[_0x4c0a('0x2b')](_0x4c0a('0x47'),_0x508c7d[_0x4b5f08][_0x4b5047]['type'],_0x508c7d[_0x4b5f08][_0x4b5047][_0x4c0a('0x3')]));break;case 0xa:_0x5ccbfd[_0x238725](util[_0x4c0a('0x2b')](_0x4c0a('0x1d'),_0x508c7d[_0x4b5f08][_0x4b5047][_0x4c0a('0x3')]));break;}}}}})[_0x4c0a('0xb')](function(){if(_0x238725===_0x4c0a('0x48')){var _0x232285=_[_0x4c0a('0x17')](_0xfb4530[_0x4c0a('0x49')],'id');return _0xfb4530[_0x4c0a('0x4a')](_0x232285)['then'](function(){for(var _0x442d94=0x0;_0x442d94<_0x232285[_0x4c0a('0x1c')];_0x442d94+=0x1){_0x3a83a6[_0x4c0a('0x4b')](_0x4c0a('0x4c'),{'ChatInteractionId':Number(_0x232285[_0x442d94]),'UserId':Number(_0xfb4530['id'])});}});}})[_0x4c0a('0xb')](function(){if(_0x238725==='leave'){var _0x4b4861=_[_0x4c0a('0x17')](_0xfb4530[_0x4c0a('0x23')],'id');return _0xfb4530[_0x4c0a('0x4d')](_0x4b4861)[_0x4c0a('0xb')](function(){for(var _0x41e829=0x0;_0x41e829<_0x4b4861[_0x4c0a('0x1c')];_0x41e829+=0x1){_0x3a83a6[_0x4c0a('0x4b')](_0x4c0a('0x4e'),{'MailInteractionId':Number(_0x4b4861[_0x41e829]),'UserId':Number(_0xfb4530['id'])});}});}})['then'](function(){if(_0x238725===_0x4c0a('0x48')){var _0x38393=_['map'](_0xfb4530['FaxInteractions'],'id');return _0xfb4530[_0x4c0a('0x4f')](_0x38393)[_0x4c0a('0xb')](function(){for(var _0x435dff=0x0;_0x435dff<_0x38393[_0x4c0a('0x1c')];_0x435dff+=0x1){_0x3a83a6[_0x4c0a('0x4b')](_0x4c0a('0x50'),{'FaxInteractionId':Number(_0x38393[_0x435dff]),'UserId':Number(_0xfb4530['id'])});}});}})[_0x4c0a('0xb')](function(){if(_0x238725===_0x4c0a('0x48')){var _0x3d3d39=_[_0x4c0a('0x17')](_0xfb4530[_0x4c0a('0x27')],'id');return _0xfb4530[_0x4c0a('0x51')](_0x3d3d39)[_0x4c0a('0xb')](function(){for(var _0x2b2f68=0x0;_0x2b2f68<_0x3d3d39['length'];_0x2b2f68+=0x1){_0x3a83a6[_0x4c0a('0x4b')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x3d3d39[_0x2b2f68]),'UserId':Number(_0xfb4530['id'])});}});}})['then'](function(){if(_0x238725==='leave'){var _0x102519=_[_0x4c0a('0x17')](_0xfb4530['OpenchannelInteractions'],'id');return _0xfb4530['removeOpenchannelInteractions'](_0x102519)[_0x4c0a('0xb')](function(){for(var _0x19f73d=0x0;_0x19f73d<_0x102519[_0x4c0a('0x1c')];_0x19f73d+=0x1){_0x3a83a6['emit'](_0x4c0a('0x52'),{'OpenchannelInteractionId':Number(_0x102519[_0x19f73d]),'UserId':Number(_0xfb4530['id'])});}});}})[_0x4c0a('0xb')](function(){if(_0x238725===_0x4c0a('0x48')){var _0x213b1e=_[_0x4c0a('0x17')](_0xfb4530[_0x4c0a('0x53')],'id');return _0xfb4530[_0x4c0a('0x54')](_0x213b1e)[_0x4c0a('0xb')](function(){for(var _0x1a48bc=0x0;_0x1a48bc<_0x213b1e[_0x4c0a('0x1c')];_0x1a48bc+=0x1){_0x3a83a6['emit'](_0x4c0a('0x55'),{'WhatsappInteractionId':Number(_0x213b1e[_0x1a48bc]),'UserId':Number(_0xfb4530['id'])});}});}})[_0x4c0a('0x56')](function(_0x14576a){_0x5ccbfd[_0x4c0a('0x57')](_0x14576a);});}}function onDisconnect(_0x32a919,_0x1eecbc){joinOrLeave(_0x32a919,'leave',_0x1eecbc);}function onConnect(_0x3f5d31){joinOrLeave(_0x3f5d31,_0x4c0a('0x58'));}exports[_0x4c0a('0x59')]=function(_0x54cdc7){_0x54cdc7['on'](_0x4c0a('0x5a'),function(_0x574646){_0x574646['setMaxListeners'](0x0);_0x574646['address']=_0x574646['request']['connection'][_0x4c0a('0x5b')]+':'+_0x574646['request'][_0x4c0a('0x5a')]['remotePort'];_0x574646[_0x4c0a('0x5c')]=new Date();_0x574646[_0x4c0a('0x57')]=function(_0x4d1f61){console[_0x4c0a('0x57')](_0x4c0a('0x5d')+_0x574646[_0x4c0a('0x5e')][_0x4c0a('0x3')]+'['+_0x574646[_0x4c0a('0x5f')]+']',_0x4d1f61);};_0x574646['on']('disconnect',function(){onDisconnect(_0x574646,_0x54cdc7);_0x574646[_0x4c0a('0x57')](_0x4c0a('0x60'));});onConnect(_0x574646);_0x574646[_0x4c0a('0x57')](_0x4c0a('0x61'));});};
\ No newline at end of file
index f0ff1ee..a133738 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7e8a=['Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','code','Trigger,\x20%s','catch','get','channel','event','direction','ContactId','undefined','sequelize','query','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','name','outgoingmessage','AfterCreateMessage','motionChannel','offlineMessage','opened','resolve','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','agent','changed','closed','substatus','AfterUpdate','User','fullname','default','length','hasOwnProperty','model','toLowerCase','util','../../mysqldb','jayson/promise','../logger','triggers','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','ChatOfflineMessage','newmessage','Sms','Whatsapp','WhatsappInteraction','Fax','FaxInteraction'];(function(_0x4a249c,_0x1f51d9){var _0x241100=function(_0x4a4587){while(--_0x4a4587){_0x4a249c['push'](_0x4a249c['shift']());}};_0x241100(++_0x1f51d9);}(_0x7e8a,0xbe));var _0xa7e8=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x7e8a[_0x9cd4c3];return _0x4c9025;};'use strict';var util=require(_0xa7e8('0x0'));var db=require(_0xa7e8('0x1'))['db'];var jayson=require(_0xa7e8('0x2'));var logger=require(_0xa7e8('0x3'))(_0xa7e8('0x4'));var client=jayson['client'][_0xa7e8('0x5')]({'port':0x232a});var triggers=[{'channel':_0xa7e8('0x6'),'model':_0xa7e8('0x7'),'event':_0xa7e8('0x8'),'condition':_0xa7e8('0x9'),'callback':afterCreate},{'channel':_0xa7e8('0x6'),'model':'ChatInteraction','event':_0xa7e8('0xa'),'condition':_0xa7e8('0xb'),'callback':afterUpdate},{'channel':_0xa7e8('0x6'),'model':_0xa7e8('0xc'),'event':_0xa7e8('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xa7e8('0x6'),'model':_0xa7e8('0xd'),'event':_0xa7e8('0x8'),'condition':_0xa7e8('0xe'),'callback':afterCreateOfflineMessage},{'channel':_0xa7e8('0xf'),'model':'SmsInteraction','event':'afterCreate','condition':_0xa7e8('0x9'),'callback':afterCreate},{'channel':_0xa7e8('0xf'),'model':'SmsInteraction','event':'afterUpdate','condition':_0xa7e8('0xb'),'callback':afterUpdate},{'channel':_0xa7e8('0xf'),'model':'SmsMessage','event':'afterCreate','condition':_0xa7e8('0xe'),'callback':afterCreateMessage},{'channel':_0xa7e8('0x10'),'model':_0xa7e8('0x11'),'event':'afterCreate','condition':_0xa7e8('0x9'),'callback':afterCreate},{'channel':_0xa7e8('0x10'),'model':_0xa7e8('0x11'),'event':'afterUpdate','condition':_0xa7e8('0xb'),'callback':afterUpdate},{'channel':_0xa7e8('0x10'),'model':'WhatsappMessage','event':_0xa7e8('0x8'),'condition':_0xa7e8('0xe'),'callback':afterCreateMessage},{'channel':_0xa7e8('0x12'),'model':_0xa7e8('0x13'),'event':_0xa7e8('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xa7e8('0x12'),'model':_0xa7e8('0x13'),'event':_0xa7e8('0xa'),'condition':_0xa7e8('0xb'),'callback':afterUpdate},{'channel':_0xa7e8('0x12'),'model':'FaxMessage','event':_0xa7e8('0x8'),'condition':_0xa7e8('0xe'),'callback':afterCreateMessage},{'channel':_0xa7e8('0x14'),'model':_0xa7e8('0x15'),'event':_0xa7e8('0x8'),'condition':_0xa7e8('0x9'),'callback':afterCreate},{'channel':_0xa7e8('0x14'),'model':_0xa7e8('0x15'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xa7e8('0x14'),'model':_0xa7e8('0x16'),'event':_0xa7e8('0x8'),'condition':_0xa7e8('0xe'),'callback':afterCreateMessage},{'channel':_0xa7e8('0x17'),'model':'OpenchannelInteraction','event':'afterCreate','condition':_0xa7e8('0x9'),'callback':afterCreate},{'channel':_0xa7e8('0x17'),'model':_0xa7e8('0x18'),'event':_0xa7e8('0xa'),'condition':_0xa7e8('0xb'),'callback':afterUpdate},{'channel':_0xa7e8('0x17'),'model':_0xa7e8('0x19'),'event':_0xa7e8('0x8'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x2e7734){return client[_0xa7e8('0x1a')](_0xa7e8('0x1b'),_0x2e7734)[_0xa7e8('0x1c')](function(_0x1ddd4a){logger[_0xa7e8('0x1d')]('Trigger,\x20%s',_0xa7e8('0x1b'),_0x1ddd4a);if(_0x1ddd4a['error']){if(_0x1ddd4a[_0xa7e8('0x1e')][_0xa7e8('0x1f')]===0x1f4){logger[_0xa7e8('0x1e')](_0xa7e8('0x20'),_0xa7e8('0x1b'),_0x1ddd4a[_0xa7e8('0x1e')]);}}})[_0xa7e8('0x21')](function(_0x480b37){logger[_0xa7e8('0x1e')](_0xa7e8('0x20'),_0xa7e8('0x1b'),_0x480b37);});}function afterCreateMessage(_0x5e4c04){return function(_0x40bc9c){_0x40bc9c=_0x40bc9c[_0xa7e8('0x22')]({'plain':!![]});_0x40bc9c[_0xa7e8('0x23')]=_0x5e4c04;_0x40bc9c['motionChannel']=_0x5e4c04;_0x40bc9c[_0xa7e8('0x24')]=_0x40bc9c[_0xa7e8('0x25')];Promise['resolve']()[_0xa7e8('0x1c')](function(){if(typeof _0x40bc9c[_0xa7e8('0x26')]===_0xa7e8('0x27'))return null;var _0x4495a6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x40bc9c[_0xa7e8('0x26')];return db[_0xa7e8('0x28')][_0xa7e8('0x29')](_0x4495a6,{'type':db['Sequelize'][_0xa7e8('0x2a')][_0xa7e8('0x2b')],'raw':!![]});})[_0xa7e8('0x1c')](function(_0x33949d){if(_0x33949d){_0x40bc9c[_0xa7e8('0x2c')]=_0x33949d[0x0];}if(typeof _0x40bc9c[_0xa7e8('0x2d')]===_0xa7e8('0x27'))return;return getAgent(_0x40bc9c[_0xa7e8('0x2d')]);})[_0xa7e8('0x1c')](function(_0x25daac){if(_0x25daac){_0x40bc9c[_0xa7e8('0x2e')]=util[_0xa7e8('0x2f')](_0xa7e8('0x30'),_0x25daac[_0xa7e8('0x31')]);_0x40bc9c['agent']=_0x25daac;_0x40bc9c['channel']=_0x5e4c04;return request({'event':'incomingmessage','message':_0x40bc9c});}else{return request({'event':_0xa7e8('0x32'),'message':_0x40bc9c});}})[_0xa7e8('0x21')](function(_0x489058){logger[_0xa7e8('0x1e')]('Trigger,\x20%s',_0xa7e8('0x33'),_0x489058);});};}function afterCreateOfflineMessage(_0x153c8d){return function(_0x2787bf){_0x2787bf=_0x2787bf['get']({'plain':!![]});_0x2787bf['channel']=_0x153c8d;_0x2787bf[_0xa7e8('0x34')]=_0x153c8d;_0x2787bf[_0xa7e8('0x24')]=_0xa7e8('0x35');return request({'event':_0x2787bf['event'],'message':_0x2787bf});};}function afterCreate(_0x50673d,_0x8ac16d){return function(_0x247159){_0x247159=_0x247159['get']({'plain':!![]});_0x247159['channel']=_0x50673d;_0x247159[_0xa7e8('0x34')]=_0x50673d;_0x247159[_0xa7e8('0x24')]=_0xa7e8('0x36');Promise[_0xa7e8('0x37')]()[_0xa7e8('0x1c')](function(){var _0x455cad=_0xa7e8('0x38')+_0x247159[_0xa7e8('0x26')];return db[_0xa7e8('0x28')][_0xa7e8('0x29')](_0x455cad,{'type':db[_0xa7e8('0x39')][_0xa7e8('0x2a')]['SELECT'],'raw':!![]});})['then'](function(_0x16bcad){if(_0x16bcad){_0x247159['contact']=_0x16bcad[0x0];}if(typeof _0x247159['UserId']===_0xa7e8('0x27'))return;return getAgent(_0x247159['UserId']);})[_0xa7e8('0x1c')](function(_0xdd7894){if(_0xdd7894){_0x247159[_0xa7e8('0x2e')]=util[_0xa7e8('0x2f')]('SIP/%s',_0xdd7894[_0xa7e8('0x31')]);_0x247159[_0xa7e8('0x3a')]=_0xdd7894;}return request({'event':_0x8ac16d,'message':_0x247159});})[_0xa7e8('0x21')](function(_0x552255){logger[_0xa7e8('0x1e')](_0xa7e8('0x20'),'AfterCreate',_0x552255);});};}function afterUpdate(_0x20f9b8){return function(_0x40a257){var _0x410d28=_0x40a257[_0xa7e8('0x3b')]('closed')&&_0x40a257[_0xa7e8('0x3c')];var _0x50e0cd=_0x40a257[_0xa7e8('0x3b')](_0xa7e8('0x3d'));if(_0x410d28||_0x50e0cd){var _0x40c36e=_0x410d28?'closedinteraction':_0xa7e8('0x3d');var _0x35b5c0=_0x40a257[_0xa7e8('0x22')]({'plain':!![]});_0x35b5c0[_0xa7e8('0x23')]=_0x20f9b8;_0x35b5c0[_0xa7e8('0x34')]=_0x20f9b8;_0x35b5c0[_0xa7e8('0x24')]=_0x410d28?_0xa7e8('0x3c'):_0xa7e8('0x3d');var _0x283661=_0xa7e8('0x38')+_0x35b5c0[_0xa7e8('0x26')];return db[_0xa7e8('0x28')][_0xa7e8('0x29')](_0x283661,{'type':db[_0xa7e8('0x39')][_0xa7e8('0x2a')][_0xa7e8('0x2b')],'raw':!![]})[_0xa7e8('0x1c')](function(_0x40fbec){if(_0x40fbec){_0x35b5c0[_0xa7e8('0x2c')]=_0x40fbec[0x0];}if(typeof _0x35b5c0[_0xa7e8('0x2d')]===_0xa7e8('0x27'))return;return getAgent(_0x35b5c0[_0xa7e8('0x2d')]);})[_0xa7e8('0x1c')](function(_0x53f8be){if(_0x53f8be){_0x35b5c0[_0xa7e8('0x2e')]=util[_0xa7e8('0x2f')](_0xa7e8('0x30'),_0x53f8be[_0xa7e8('0x31')]);_0x35b5c0[_0xa7e8('0x3a')]=_0x53f8be;}return request({'event':_0x40c36e,'message':_0x35b5c0});})[_0xa7e8('0x21')](function(_0xd14b75){logger['error'](_0xa7e8('0x20'),_0xa7e8('0x3e'),_0xd14b75);});}};}function getAgent(_0x4d3a78){return db[_0xa7e8('0x3f')]['find']({'where':{'id':_0x4d3a78},'attributes':['id',_0xa7e8('0x31'),_0xa7e8('0x40'),'email','internal'],'raw':!![]})[_0xa7e8('0x1c')](function(_0x181c27){return _0x181c27;});}exports[_0xa7e8('0x41')]=function(){for(var _0x1a278b=0x0;_0x1a278b<triggers[_0xa7e8('0x42')];_0x1a278b+=0x1){if(db[_0xa7e8('0x43')](triggers[_0x1a278b][_0xa7e8('0x44')])){db[triggers[_0x1a278b]['model']]['hook'](triggers[_0x1a278b][_0xa7e8('0x24')],triggers[_0x1a278b]['callback'](triggers[_0x1a278b][_0xa7e8('0x23')][_0xa7e8('0x45')](),triggers[_0x1a278b]['condition']));}}};
\ No newline at end of file
+var _0x1fc4=['resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','SIP/%s','name','incomingmessage','outgoingmessage','AfterCreateMessage','get','offlineMessage','event','opened','query','contact','interface','format','agent','AfterCreate','changed','closed','substatus','find','fullname','internal','default','length','hasOwnProperty','model','hook','callback','../../mysqldb','jayson/promise','../logger','triggers','client','http','ChatInteraction','Chat','afterUpdate','closedinteraction','newmessage','ChatOfflineMessage','afterCreate','Sms','SmsInteraction','newinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','then','Trigger,\x20%s','EventManager','error','code','catch','channel','motionChannel','direction'];(function(_0x476cf9,_0x124e78){var _0x47996f=function(_0x2ed379){while(--_0x2ed379){_0x476cf9['push'](_0x476cf9['shift']());}};_0x47996f(++_0x124e78);}(_0x1fc4,0xff));var _0x41fc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1fc4[_0x2dafbe];return _0x58a45a;};'use strict';var util=require('util');var db=require(_0x41fc('0x0'))['db'];var jayson=require(_0x41fc('0x1'));var logger=require(_0x41fc('0x2'))(_0x41fc('0x3'));var client=jayson[_0x41fc('0x4')][_0x41fc('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x41fc('0x6'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x41fc('0x7'),'model':_0x41fc('0x6'),'event':_0x41fc('0x8'),'condition':_0x41fc('0x9'),'callback':afterUpdate},{'channel':_0x41fc('0x7'),'model':'ChatMessage','event':'afterCreate','condition':_0x41fc('0xa'),'callback':afterCreateMessage},{'channel':'Chat','model':_0x41fc('0xb'),'event':_0x41fc('0xc'),'condition':_0x41fc('0xa'),'callback':afterCreateOfflineMessage},{'channel':_0x41fc('0xd'),'model':_0x41fc('0xe'),'event':'afterCreate','condition':_0x41fc('0xf'),'callback':afterCreate},{'channel':'Sms','model':_0x41fc('0xe'),'event':_0x41fc('0x8'),'condition':_0x41fc('0x9'),'callback':afterUpdate},{'channel':'Sms','model':_0x41fc('0x10'),'event':_0x41fc('0xc'),'condition':_0x41fc('0xa'),'callback':afterCreateMessage},{'channel':_0x41fc('0x11'),'model':_0x41fc('0x12'),'event':_0x41fc('0xc'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x41fc('0x11'),'model':'WhatsappInteraction','event':_0x41fc('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Whatsapp','model':_0x41fc('0x13'),'event':_0x41fc('0xc'),'condition':_0x41fc('0xa'),'callback':afterCreateMessage},{'channel':_0x41fc('0x14'),'model':_0x41fc('0x15'),'event':_0x41fc('0xc'),'condition':_0x41fc('0xf'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0x41fc('0x8'),'condition':_0x41fc('0x9'),'callback':afterUpdate},{'channel':_0x41fc('0x14'),'model':'FaxMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':'MailInteraction','event':_0x41fc('0xc'),'condition':_0x41fc('0xf'),'callback':afterCreate},{'channel':_0x41fc('0x16'),'model':_0x41fc('0x17'),'event':'afterUpdate','condition':_0x41fc('0x9'),'callback':afterUpdate},{'channel':_0x41fc('0x16'),'model':_0x41fc('0x18'),'event':'afterCreate','condition':_0x41fc('0xa'),'callback':afterCreateMessage},{'channel':_0x41fc('0x19'),'model':'OpenchannelInteraction','event':'afterCreate','condition':_0x41fc('0xf'),'callback':afterCreate},{'channel':_0x41fc('0x19'),'model':_0x41fc('0x1a'),'event':_0x41fc('0x8'),'condition':_0x41fc('0x9'),'callback':afterUpdate},{'channel':_0x41fc('0x19'),'model':_0x41fc('0x1b'),'event':_0x41fc('0xc'),'condition':_0x41fc('0xa'),'callback':afterCreateMessage}];function request(_0x56345a){return client['request']('EventManager',_0x56345a)[_0x41fc('0x1c')](function(_0x12fe06){logger['info'](_0x41fc('0x1d'),_0x41fc('0x1e'),_0x12fe06);if(_0x12fe06['error']){if(_0x12fe06[_0x41fc('0x1f')][_0x41fc('0x20')]===0x1f4){logger[_0x41fc('0x1f')](_0x41fc('0x1d'),_0x41fc('0x1e'),_0x12fe06[_0x41fc('0x1f')]);}}})[_0x41fc('0x21')](function(_0x24cedc){logger[_0x41fc('0x1f')](_0x41fc('0x1d'),_0x41fc('0x1e'),_0x24cedc);});}function afterCreateMessage(_0x4bf7fc){return function(_0x57d619){_0x57d619=_0x57d619['get']({'plain':!![]});_0x57d619[_0x41fc('0x22')]=_0x4bf7fc;_0x57d619[_0x41fc('0x23')]=_0x4bf7fc;_0x57d619['event']=_0x57d619[_0x41fc('0x24')];Promise[_0x41fc('0x25')]()['then'](function(){if(typeof _0x57d619[_0x41fc('0x26')]===_0x41fc('0x27'))return null;var _0x1f0708=_0x41fc('0x28')+_0x57d619[_0x41fc('0x26')];return db[_0x41fc('0x29')]['query'](_0x1f0708,{'type':db[_0x41fc('0x2a')][_0x41fc('0x2b')][_0x41fc('0x2c')],'raw':!![]});})[_0x41fc('0x1c')](function(_0x74ecda){if(_0x74ecda){_0x57d619['contact']=_0x74ecda[0x0];}if(typeof _0x57d619['UserId']===_0x41fc('0x27'))return;return getAgent(_0x57d619[_0x41fc('0x2d')]);})[_0x41fc('0x1c')](function(_0x90d67f){if(_0x90d67f){_0x57d619['interface']=util['format'](_0x41fc('0x2e'),_0x90d67f[_0x41fc('0x2f')]);_0x57d619['agent']=_0x90d67f;_0x57d619[_0x41fc('0x22')]=_0x4bf7fc;return request({'event':_0x41fc('0x30'),'message':_0x57d619});}else{return request({'event':_0x41fc('0x31'),'message':_0x57d619});}})[_0x41fc('0x21')](function(_0x159305){logger[_0x41fc('0x1f')](_0x41fc('0x1d'),_0x41fc('0x32'),_0x159305);});};}function afterCreateOfflineMessage(_0x2bb657){return function(_0x56198d){_0x56198d=_0x56198d[_0x41fc('0x33')]({'plain':!![]});_0x56198d[_0x41fc('0x22')]=_0x2bb657;_0x56198d[_0x41fc('0x23')]=_0x2bb657;_0x56198d['event']=_0x41fc('0x34');return request({'event':_0x56198d[_0x41fc('0x35')],'message':_0x56198d});};}function afterCreate(_0x4aa56b,_0x50f553){return function(_0x206b20){_0x206b20=_0x206b20[_0x41fc('0x33')]({'plain':!![]});_0x206b20[_0x41fc('0x22')]=_0x4aa56b;_0x206b20[_0x41fc('0x23')]=_0x4aa56b;_0x206b20[_0x41fc('0x35')]=_0x41fc('0x36');Promise[_0x41fc('0x25')]()[_0x41fc('0x1c')](function(){var _0x124873='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x206b20[_0x41fc('0x26')];return db[_0x41fc('0x29')][_0x41fc('0x37')](_0x124873,{'type':db['Sequelize'][_0x41fc('0x2b')][_0x41fc('0x2c')],'raw':!![]});})[_0x41fc('0x1c')](function(_0x22e4a0){if(_0x22e4a0){_0x206b20[_0x41fc('0x38')]=_0x22e4a0[0x0];}if(typeof _0x206b20['UserId']===_0x41fc('0x27'))return;return getAgent(_0x206b20[_0x41fc('0x2d')]);})[_0x41fc('0x1c')](function(_0x469dae){if(_0x469dae){_0x206b20[_0x41fc('0x39')]=util[_0x41fc('0x3a')](_0x41fc('0x2e'),_0x469dae[_0x41fc('0x2f')]);_0x206b20[_0x41fc('0x3b')]=_0x469dae;}return request({'event':_0x50f553,'message':_0x206b20});})[_0x41fc('0x21')](function(_0x5504d6){logger[_0x41fc('0x1f')]('Trigger,\x20%s',_0x41fc('0x3c'),_0x5504d6);});};}function afterUpdate(_0x59cd76){return function(_0xaeda06){var _0x2c1e2e=_0xaeda06[_0x41fc('0x3d')](_0x41fc('0x3e'))&&_0xaeda06[_0x41fc('0x3e')];var _0x400246=_0xaeda06[_0x41fc('0x3d')]('substatus');if(_0x2c1e2e||_0x400246){var _0x52b977=_0x2c1e2e?'closedinteraction':_0x41fc('0x3f');var _0x5319e3=_0xaeda06[_0x41fc('0x33')]({'plain':!![]});_0x5319e3[_0x41fc('0x22')]=_0x59cd76;_0x5319e3[_0x41fc('0x23')]=_0x59cd76;_0x5319e3[_0x41fc('0x35')]=_0x2c1e2e?_0x41fc('0x3e'):_0x41fc('0x3f');var _0x209300='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5319e3[_0x41fc('0x26')];return db[_0x41fc('0x29')][_0x41fc('0x37')](_0x209300,{'type':db['Sequelize'][_0x41fc('0x2b')][_0x41fc('0x2c')],'raw':!![]})[_0x41fc('0x1c')](function(_0x313653){if(_0x313653){_0x5319e3[_0x41fc('0x38')]=_0x313653[0x0];}if(typeof _0x5319e3[_0x41fc('0x2d')]===_0x41fc('0x27'))return;return getAgent(_0x5319e3['UserId']);})[_0x41fc('0x1c')](function(_0x61c71c){if(_0x61c71c){_0x5319e3['interface']=util[_0x41fc('0x3a')](_0x41fc('0x2e'),_0x61c71c[_0x41fc('0x2f')]);_0x5319e3['agent']=_0x61c71c;}return request({'event':_0x52b977,'message':_0x5319e3});})[_0x41fc('0x21')](function(_0x41c330){logger[_0x41fc('0x1f')](_0x41fc('0x1d'),'AfterUpdate',_0x41c330);});}};}function getAgent(_0x422e42){return db['User'][_0x41fc('0x40')]({'where':{'id':_0x422e42},'attributes':['id',_0x41fc('0x2f'),_0x41fc('0x41'),'email',_0x41fc('0x42')],'raw':!![]})[_0x41fc('0x1c')](function(_0x3202c5){return _0x3202c5;});}exports[_0x41fc('0x43')]=function(){for(var _0x305683=0x0;_0x305683<triggers[_0x41fc('0x44')];_0x305683+=0x1){if(db[_0x41fc('0x45')](triggers[_0x305683]['model'])){db[triggers[_0x305683][_0x41fc('0x46')]][_0x41fc('0x47')](triggers[_0x305683][_0x41fc('0x35')],triggers[_0x305683][_0x41fc('0x48')](triggers[_0x305683][_0x41fc('0x22')]['toLowerCase'](),triggers[_0x305683]['condition']));}}};
\ No newline at end of file
index 6008eb5..a6a19d3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x91bd=['updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','sms','whatsapp','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt'];(function(_0x1bb1c3,_0x46dc1d){var _0x3f4fcd=function(_0x43dce2){while(--_0x43dce2){_0x1bb1c3['push'](_0x1bb1c3['shift']());}};_0x3f4fcd(++_0x46dc1d);}(_0x91bd,0x66));var _0xd91b=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x91bd[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0xd91b('0x0'));var BPromise=require(_0xd91b('0x1'));var db=require(_0xd91b('0x2'))['db'];var util=require(_0xd91b('0x3'));var channels=[_0xd91b('0x4'),'mail','chat','fax',_0xd91b('0x5'),_0xd91b('0x6'),'openchannel'];exports[_0xd91b('0x7')]=function(){return channels;};exports[_0xd91b('0x8')]=function(_0x192d66){_0x192d66=_0x192d66[_0xd91b('0x9')]();return _['includes'](channels,_0x192d66);};exports[_0xd91b('0xa')]=function(_0x3c80d3,_0x55d519,_0x57ea9e,_0x1e9cc8){var _0x573880={'loginAttempts':_0x55d519,'blocked':_0x57ea9e};if(!_[_0xd91b('0xb')](_0x1e9cc8)){_0x573880[_0xd91b('0xc')]=_0x1e9cc8;}return _0x3c80d3[_0xd91b('0xd')](_0x573880);};exports[_0xd91b('0xe')]=function(_0x46d09a){return new BPromise(function(_0x3b0d89,_0xec1e77){var _0x41d18d=0x0;if(_0x46d09a[_0xd91b('0xf')]!==_0xd91b('0x10')){_0x3b0d89(_0x46d09a);}db[_0xd91b('0x11')][_0xd91b('0x12')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x46d09a['id']}}})[_0xd91b('0x13')](function(_0x33f5bf){_0x41d18d=_0x33f5bf;return util[_0xd91b('0xe')]();})[_0xd91b('0x13')](function(_0x5b8dff){if(_0x5b8dff&&_0x5b8dff[_0xd91b('0x14')]&&_0x41d18d>=_0x5b8dff[_0xd91b('0x14')]){throw Error(_0xd91b('0x15'));}_0x3b0d89(_0x46d09a);})[_0xd91b('0x16')](function(_0x4f5a31){_0xec1e77(_0x4f5a31);});});};
\ No newline at end of file
+var _0xfb1e=['../mysqldb','./license/util','voice','mail','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','getLicense','role','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird'];(function(_0x1eacae,_0x17e1e4){var _0x40db7e=function(_0x475231){while(--_0x475231){_0x1eacae['push'](_0x1eacae['shift']());}};_0x40db7e(++_0x17e1e4);}(_0xfb1e,0x88));var _0xefb1=function(_0xcc8c94,_0xa4267a){_0xcc8c94=_0xcc8c94-0x0;var _0x1eabb9=_0xfb1e[_0xcc8c94];return _0x1eabb9;};'use strict';var _=require(_0xefb1('0x0'));var BPromise=require(_0xefb1('0x1'));var db=require(_0xefb1('0x2'))['db'];var util=require(_0xefb1('0x3'));var channels=[_0xefb1('0x4'),_0xefb1('0x5'),'chat',_0xefb1('0x6'),_0xefb1('0x7'),'whatsapp',_0xefb1('0x8')];exports[_0xefb1('0x9')]=function(){return channels;};exports[_0xefb1('0xa')]=function(_0x44e83e){_0x44e83e=_0x44e83e[_0xefb1('0xb')]();return _[_0xefb1('0xc')](channels,_0x44e83e);};exports[_0xefb1('0xd')]=function(_0x4d2a10,_0x5116b4,_0x3e595c,_0x1ffe86){var _0x4d5687={'loginAttempts':_0x5116b4,'blocked':_0x3e595c};if(!_[_0xefb1('0xe')](_0x1ffe86)){_0x4d5687['blockedAt']=_0x1ffe86;}return _0x4d2a10['updateAttributes'](_0x4d5687);};exports[_0xefb1('0xf')]=function(_0x575cee){return new BPromise(function(_0x2d46a9,_0x5ef5f1){var _0x56a72b=0x0;if(_0x575cee[_0xefb1('0x10')]!==_0xefb1('0x11')){_0x2d46a9(_0x575cee);}db['User'][_0xefb1('0x12')]({'where':{'role':_0xefb1('0x11'),'online':!![],'id':{'$ne':_0x575cee['id']}}})[_0xefb1('0x13')](function(_0x1c8f2c){_0x56a72b=_0x1c8f2c;return util['getLicense']();})[_0xefb1('0x13')](function(_0x3bce89){if(_0x3bce89&&_0x3bce89[_0xefb1('0x14')]&&_0x56a72b>=_0x3bce89['agents']){throw Error(_0xefb1('0x15'));}_0x2d46a9(_0x575cee);})[_0xefb1('0x16')](function(_0x4b1dff){_0x5ef5f1(_0x4b1dff);});});};
\ No newline at end of file
index 321cbdb..d3d16bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf109=['status','exports','util','../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits','message','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack'];(function(_0x3b7a0c,_0xf1a4c2){var _0x3bb70f=function(_0x248b52){while(--_0x248b52){_0x3b7a0c['push'](_0x3b7a0c['shift']());}};_0x3bb70f(++_0xf1a4c2);}(_0xf109,0xce));var _0x9f10=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xf109[_0x88cd7b];return _0x56fcc8;};'use strict';var util=require(_0x9f10('0x0'));var logger=require(_0x9f10('0x1'))(_0x9f10('0x2'));var APIError=function(_0x5d2950,_0x5b381d){this['message']=_0x5d2950||_0x9f10('0x3');this[_0x9f10('0x4')]=_0x5b381d||_0x9f10('0x5');util[_0x9f10('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4027f4){this[_0x9f10('0x7')]=_0x4027f4||_0x9f10('0x8');this[_0x9f10('0x4')]=_0x9f10('0x8');util[_0x9f10('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x3fd82f){this['message']=_0x3fd82f||_0x9f10('0x9');this[_0x9f10('0x4')]=_0x9f10('0xa');util[_0x9f10('0x6')](APINotFoundError,APIError);};function getStatusCode(_0x325f22){switch(_0x325f22){case'Bad\x20Request':return 0x190;case _0x9f10('0xb'),_0x9f10('0xc'):return 0x193;case _0x9f10('0xa'):return 0x194;default:return 0x1f4;}}function handleError(_0x4e577d){return function(_0x50215f){logger[_0x9f10('0xd')](_0x50215f[_0x9f10('0xe')]);var _0x407336=getStatusCode(_0x50215f['name']);if(_0x50215f[_0x9f10('0x4')])delete _0x50215f[_0x9f10('0x4')];return _0x4e577d[_0x9f10('0xf')](_0x407336)['send'](_0x50215f);};}module[_0x9f10('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError};
\ No newline at end of file
+var _0xb688=['status','send','exports','../config/logger','api','message','Internal\x20Server\x20Error','Error','inherits','name','Entity\x20not\x20found','Not\x20Found','Bad\x20Request','Forbidden','OutOfInterval','error','stack'];(function(_0x46dce0,_0x2e12a8){var _0x254615=function(_0x172af0){while(--_0x172af0){_0x46dce0['push'](_0x46dce0['shift']());}};_0x254615(++_0x2e12a8);}(_0xb688,0xcf));var _0x8b68=function(_0x53294a,_0x547f5b){_0x53294a=_0x53294a-0x0;var _0x4d8684=_0xb688[_0x53294a];return _0x4d8684;};'use strict';var util=require('util');var logger=require(_0x8b68('0x0'))(_0x8b68('0x1'));var APIError=function(_0x266285,_0x1080e8){this[_0x8b68('0x2')]=_0x266285||_0x8b68('0x3');this['name']=_0x1080e8||_0x8b68('0x4');util[_0x8b68('0x5')](APIError,Error);};var APIBadRequestError=function(_0x30f33d){this[_0x8b68('0x2')]=_0x30f33d||'Bad\x20Request';this[_0x8b68('0x6')]='Bad\x20Request';util[_0x8b68('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x2bbffd){this[_0x8b68('0x2')]=_0x2bbffd||_0x8b68('0x7');this[_0x8b68('0x6')]=_0x8b68('0x8');util[_0x8b68('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x21d944){switch(_0x21d944){case _0x8b68('0x9'):return 0x190;case _0x8b68('0xa'),_0x8b68('0xb'):return 0x193;case _0x8b68('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x2a852a){return function(_0x502727){logger[_0x8b68('0xc')](_0x502727[_0x8b68('0xd')]);var _0x5e76c=getStatusCode(_0x502727[_0x8b68('0x6')]);if(_0x502727[_0x8b68('0x6')])delete _0x502727[_0x8b68('0x6')];return _0x2a852a[_0x8b68('0xe')](_0x5e76c)[_0x8b68('0xf')](_0x502727);};}module[_0x8b68('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError};
\ No newline at end of file
index 52eb411..8881902 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f4d=['exports','404','status','json','send'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f4d,0x91));var _0xd5f4=function(_0x56986e,_0x28a678){_0x56986e=_0x56986e-0x0;var _0x19224f=_0x5f4d[_0x56986e];return _0x19224f;};'use strict';module[_0xd5f4('0x0')][0x194]=function pageNotFound(_0x56c4fc,_0x435d4b){var _0x51a3b2=_0xd5f4('0x1');var _0x5c6f38=0x194;var _0x594748={'status':_0x5c6f38};_0x435d4b['status'](_0x594748[_0xd5f4('0x2')]);_0x435d4b['render'](_0x51a3b2,{},function(_0x1473bc,_0x207c2d){if(_0x1473bc){return _0x435d4b[_0xd5f4('0x2')](_0x594748[_0xd5f4('0x2')])[_0xd5f4('0x3')](_0x594748);}_0x435d4b[_0xd5f4('0x4')](_0x207c2d);});};
\ No newline at end of file
+var _0x8533=['json','exports','404','status','render'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x8533,0x141));var _0x3853=function(_0x5a2ba5,_0x620adc){_0x5a2ba5=_0x5a2ba5-0x0;var _0x507107=_0x8533[_0x5a2ba5];return _0x507107;};'use strict';module[_0x3853('0x0')][0x194]=function pageNotFound(_0x12f06c,_0x448053){var _0x58c857=_0x3853('0x1');var _0x2f27aa=0x194;var _0x5ea26d={'status':_0x2f27aa};_0x448053[_0x3853('0x2')](_0x5ea26d['status']);_0x448053[_0x3853('0x3')](_0x58c857,{},function(_0x4fa9de,_0x1f4e98){if(_0x4fa9de){return _0x448053[_0x3853('0x2')](_0x5ea26d[_0x3853('0x2')])[_0x3853('0x4')](_0x5ea26d);}_0x448053['send'](_0x1f4e98);});};
\ No newline at end of file
index 216f231..64ee7ee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6969=['Automation','../api/automation/automation.model','CannedAnswer','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','UserId','hasOne','UserSetting','userSetting','cascade','hasMany','VoiceQueuesRt','Extensions','HopperFinals','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteractions','UserNotifications','belongsTo','UserProfile','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','SmsInteractions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','UserVoicePrefix','FaxQueue','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Applications','moh_has_sounds','Members','CmHopper','Hoppers','VoiceQueueId','CmHopperHistory','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','AgentReports','Contact','MailAccount','MailAccountId','restrict','CloudProviderId','Imap','Dispositions','Answers','Interactions','List','ListId','TemplateId','mandatoryDispositionPause','MailQueue','UserMailQueue','team_has_mail_queues','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Tags','Tag','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','Dashboard','DashboardItem','Items','Disposition','FaxAccountId','user_has_fax_accounts','TagId','FaxInteractionId','fax_interaction_has_tags','ThroughTags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','ProactiveActions','Agent','Queue','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','ChatGroupId','CompanyId','Phones','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ChatApplications','FaxApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','ItemType','ItemTypeId','Hopper','Trigger','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','SugarcrmConfiguration','Field','DeskAccount','int_desk_configuration_has_tags','ZohoAccount','int_freshdesk_configuration_has_tags','VariableId','VtigerField','VtigerAccount','ServicenowAccount','FreshsalesField','ChatQueueReport','FromId','ToId','SessionId','ProjectId','ChatQueues','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','HopperHistory','Queues','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','user','Smtp','exports','../config/environment','lodash','jstz','determine','defaultsDeep','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','MailServerOut','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','CmCompany','CmContact','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action'];(function(_0x14120c,_0x48b616){var _0x57f2f4=function(_0x4c6aef){while(--_0x4c6aef){_0x14120c['push'](_0x14120c['shift']());}};_0x57f2f4(++_0x48b616);}(_0x6969,0x18f));var _0x9696=function(_0x24ab35,_0x4c8dc1){_0x24ab35=_0x24ab35-0x0;var _0x531610=_0x6969[_0x24ab35];return _0x531610;};'use strict';var config=require(_0x9696('0x0'));var Sequelize=require('sequelize');var _=require(_0x9696('0x1'));var jstz=require(_0x9696('0x2'));var timezone=jstz[_0x9696('0x3')]();config['sequelize']=_[_0x9696('0x4')](config[_0x9696('0x5')],{'database':_0x9696('0x6'),'username':_0x9696('0x7'),'password':_0x9696('0x8'),'options':{'host':_0x9696('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x9696('0xa')},'logging':![],'timezone':timezone[_0x9696('0xb')](),'define':{'charset':_0x9696('0xc'),'collate':_0x9696('0xd')}}});config[_0x9696('0xe')]=_[_0x9696('0x4')](config[_0x9696('0xe')],{'database':'motion2','username':_0x9696('0x7'),'password':_0x9696('0x8'),'options':{'host':_0x9696('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x9696('0xb')](),'define':{'charset':_0x9696('0xc'),'collate':_0x9696('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9696('0x5')][_0x9696('0xf')],config[_0x9696('0x5')][_0x9696('0x10')],config[_0x9696('0x5')][_0x9696('0x11')],config[_0x9696('0x5')][_0x9696('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x9696('0xf')],config[_0x9696('0xe')][_0x9696('0x10')],config[_0x9696('0xe')][_0x9696('0x11')],config[_0x9696('0xe')][_0x9696('0x12')])};db[_0x9696('0x13')]=db['sequelize'][_0x9696('0x14')](_0x9696('0x15'));db[_0x9696('0x16')]=db[_0x9696('0x5')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db[_0x9696('0x17')]=db[_0x9696('0x5')]['import'](_0x9696('0x18'));db[_0x9696('0x19')]=db[_0x9696('0x5')][_0x9696('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0x9696('0x1a')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x1b'));db['VoiceQueue']=db[_0x9696('0x5')][_0x9696('0x14')]('../api/voiceQueue/voiceQueue.model');db[_0x9696('0x1c')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x1d'));db[_0x9696('0x1e')]=db['sequelize'][_0x9696('0x14')](_0x9696('0x1f'));db[_0x9696('0x20')]=db['sequelize']['import']('../api/voiceMail/voiceMail.model');db[_0x9696('0x21')]=db['sequelize']['import'](_0x9696('0x22'));db['VoiceCallReport']=db[_0x9696('0x5')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x9696('0x23')]=db['sequelize'][_0x9696('0x14')](_0x9696('0x24'));db[_0x9696('0x25')]=db[_0x9696('0x5')]['import'](_0x9696('0x26'));db[_0x9696('0x27')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x28'));db[_0x9696('0x29')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x2a'));db[_0x9696('0x2b')]=db[_0x9696('0x5')]['import'](_0x9696('0x2c'));db[_0x9696('0x2d')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x2e'));db['UserVoiceQueueRt']=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x2f'));db[_0x9696('0x30')]=db[_0x9696('0x5')]['import'](_0x9696('0x31'));db[_0x9696('0x32')]=db['sequelize'][_0x9696('0x14')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x33'));db['UserFaxQueue']=db[_0x9696('0x5')]['import'](_0x9696('0x34'));db[_0x9696('0x35')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x36'));db[_0x9696('0x37')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x38'));db[_0x9696('0x39')]=db[_0x9696('0x5')][_0x9696('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x9696('0x3a')]=db[_0x9696('0x5')][_0x9696('0x14')]('../api/mailServerIn/mailServerIn.model');db[_0x9696('0x3b')]=db[_0x9696('0x5')]['import']('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0x9696('0x5')]['import']('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0x9696('0x5')]['import'](_0x9696('0x3c'));db[_0x9696('0x3d')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x3e'));db[_0x9696('0x3f')]=db[_0x9696('0x5')][_0x9696('0x14')]('../api/mailInteraction/mailInteraction.model');db[_0x9696('0x40')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x41'));db[_0x9696('0x42')]=db[_0x9696('0x5')]['import'](_0x9696('0x43'));db[_0x9696('0x44')]=db[_0x9696('0x5')][_0x9696('0x14')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x9696('0x5')]['import'](_0x9696('0x45'));db['DashboardItem']=db['sequelize'][_0x9696('0x14')](_0x9696('0x46'));db[_0x9696('0x47')]=db[_0x9696('0x5')][_0x9696('0x14')]('../api/faxAccount/faxAccount.model');db[_0x9696('0x48')]=db['sequelize'][_0x9696('0x14')](_0x9696('0x49'));db[_0x9696('0x4a')]=db['sequelize']['import'](_0x9696('0x4b'));db[_0x9696('0x4c')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x4d'));db['FaxQueue']=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x4e'));db[_0x9696('0x4f')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x50'));db[_0x9696('0x51')]=db[_0x9696('0x5')]['import'](_0x9696('0x52'));db[_0x9696('0x53')]=db['sequelize'][_0x9696('0x14')](_0x9696('0x54'));db[_0x9696('0x55')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x56'));db[_0x9696('0x57')]=db[_0x9696('0x5')][_0x9696('0x14')]('../api/smsMessage/smsMessage.model');db[_0x9696('0x58')]=db[_0x9696('0x5')]['import'](_0x9696('0x59'));db[_0x9696('0x5a')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x5b'));db[_0x9696('0x5c')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x5d'));db[_0x9696('0x5e')]=db[_0x9696('0x5')][_0x9696('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x9696('0x5f')]=db['sequelize'][_0x9696('0x14')](_0x9696('0x60'));db['OpenchannelQueue']=db[_0x9696('0x5')][_0x9696('0x14')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x61'));db[_0x9696('0x62')]=db['sequelize'][_0x9696('0x14')](_0x9696('0x63'));db[_0x9696('0x64')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x65'));db[_0x9696('0x66')]=db[_0x9696('0x5')][_0x9696('0x14')]('../api/chatInteraction/chatInteraction.model');db[_0x9696('0x67')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x68'));db['ChatOfflineMessage']=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x69'));db[_0x9696('0x6a')]=db[_0x9696('0x5')]['import']('../api/chatQueue/chatQueue.model');db[_0x9696('0x6b')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x6c'));db['ChatProactiveAction']=db[_0x9696('0x5')][_0x9696('0x14')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x9696('0x6d')]=db['sequelize']['import']('../api/cmCompany/cmCompany.model');db[_0x9696('0x6e')]=db[_0x9696('0x5')]['import']('../api/cmContact/cmContact.model');db['CmHopper']=db[_0x9696('0x5')]['import']('../api/cmHopper/cmHopper.model');db[_0x9696('0x6f')]=db[_0x9696('0x5')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0x9696('0x70')]=db['sequelize'][_0x9696('0x14')](_0x9696('0x71'));db['CmHopperHistory']=db['sequelize']['import']('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db['sequelize']['import'](_0x9696('0x72'));db['CmCustomField']=db['sequelize'][_0x9696('0x14')](_0x9696('0x73'));db[_0x9696('0x74')]=db['sequelize'][_0x9696('0x14')]('../api/action/action.model');db[_0x9696('0x75')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x76'));db[_0x9696('0x77')]=db[_0x9696('0x5')][_0x9696('0x14')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0x9696('0x5')]['import'](_0x9696('0x78'));db[_0x9696('0x79')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x7a'));db[_0x9696('0x7b')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x7c'));db[_0x9696('0x7d')]=db['sequelize'][_0x9696('0x14')](_0x9696('0x7e'));db[_0x9696('0x7f')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x80'));db[_0x9696('0x81')]=db[_0x9696('0x5')]['import'](_0x9696('0x82'));db[_0x9696('0x83')]=db[_0x9696('0x5')][_0x9696('0x14')]('../api/schedule/schedule.model');db[_0x9696('0x84')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x85'));db['Tag']=db['sequelize'][_0x9696('0x14')](_0x9696('0x86'));db[_0x9696('0x87')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x88'));db[_0x9696('0x89')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x8a'));db[_0x9696('0x8b')]=db[_0x9696('0x5')]['import'](_0x9696('0x8c'));db[_0x9696('0x8d')]=db['sequelize'][_0x9696('0x14')]('../api/template/template.model');db['Trigger']=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x8e'));db[_0x9696('0x8f')]=db['sequelize'][_0x9696('0x14')](_0x9696('0x90'));db[_0x9696('0x91')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x92'));db[_0x9696('0x93')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x94'));db['AnalyticCustomReport']=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x95'));db[_0x9696('0x96')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x97'));db[_0x9696('0x98')]=db['sequelize'][_0x9696('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x9696('0x99')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x9a'));db[_0x9696('0x9b')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x9c'));db[_0x9696('0x9d')]=db['sequelize'][_0x9696('0x14')](_0x9696('0x9e'));db[_0x9696('0x9f')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xa0'));db[_0x9696('0xa1')]=db['sequelize'][_0x9696('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xa2'));db[_0x9696('0xa3')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xa4'));db['SugarcrmConfiguration']=db['sequelize'][_0x9696('0x14')](_0x9696('0xa5'));db[_0x9696('0xa6')]=db['sequelize'][_0x9696('0x14')](_0x9696('0xa7'));db['DeskAccount']=db[_0x9696('0x5')][_0x9696('0x14')]('../api/intDeskAccount/intDeskAccount.model');db[_0x9696('0xa8')]=db['sequelize'][_0x9696('0x14')](_0x9696('0xa9'));db[_0x9696('0xaa')]=db['sequelize'][_0x9696('0x14')](_0x9696('0xab'));db['ZohoAccount']=db['sequelize'][_0x9696('0x14')](_0x9696('0xac'));db[_0x9696('0xad')]=db[_0x9696('0x5')][_0x9696('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x9696('0xae')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xaf'));db[_0x9696('0xb0')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xb1'));db[_0x9696('0xb2')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xb3'));db[_0x9696('0xb4')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xb5'));db[_0x9696('0xb6')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xb7'));db[_0x9696('0xb8')]=db[_0x9696('0x5')]['import'](_0x9696('0xb9'));db[_0x9696('0xba')]=db[_0x9696('0x5')]['import'](_0x9696('0xbb'));db['VtigerAccount']=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xbc'));db[_0x9696('0xbd')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xbe'));db['VtigerField']=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xbf'));db['ServicenowAccount']=db[_0x9696('0x5')][_0x9696('0x14')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x9696('0xc0')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xc1'));db[_0x9696('0xc2')]=db[_0x9696('0x5')]['import'](_0x9696('0xc3'));db[_0x9696('0xc4')]=db[_0x9696('0x5')][_0x9696('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x9696('0xc5')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xc6'));db[_0x9696('0xc7')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xc8'));db[_0x9696('0xc9')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xca'));db[_0x9696('0xcb')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xcc'));db['FreshsalesField']=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xcd'));db[_0x9696('0x91')]=db[_0x9696('0x5')]['import']('../api/integration/integration.model');db[_0x9696('0xce')]=db[_0x9696('0x5')]['import']('../api/network/network.model');db['ChatQueueReport']=db['sequelize'][_0x9696('0x14')](_0x9696('0xcf'));db[_0x9696('0xd0')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xd1'));db[_0x9696('0xd2')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xd3'));db[_0x9696('0xd4')]=db['sequelize'][_0x9696('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x9696('0xd5')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xd6'));db[_0x9696('0xd7')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xd8'));db[_0x9696('0xd9')]=db[_0x9696('0x5')]['import'](_0x9696('0xda'));db[_0x9696('0xdb')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xdc'));db[_0x9696('0xdd')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xde'));db[_0x9696('0xdf')]=db['sequelize'][_0x9696('0x14')](_0x9696('0xe0'));db[_0x9696('0xe1')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xe2'));db[_0x9696('0xe3')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xe4'));db[_0x9696('0xe5')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xe6'));db['SquareMessage']=db['sequelize'][_0x9696('0x14')](_0x9696('0xe7'));db[_0x9696('0xe8')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xe9'));db[_0x9696('0xea')]=db['sequelize']['import']('../api/license/license.model');db[_0x9696('0xeb')]=db[_0x9696('0x5')]['import'](_0x9696('0xec'));db[_0x9696('0xed')]=db[_0x9696('0x5')]['import'](_0x9696('0xee'));db[_0x9696('0xef')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xf0'));db[_0x9696('0xf1')]=db[_0x9696('0x5')][_0x9696('0x14')]('../api/plugin/plugin.model');db[_0x9696('0xf2')]=db[_0x9696('0x5')]['import']('../api/mailTransferReport/mailTransferReport.model');db[_0x9696('0xf3')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xf4'));db[_0x9696('0xf5')]=db[_0x9696('0x5')]['import'](_0x9696('0xf6'));db[_0x9696('0xf7')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xf8'));db[_0x9696('0xf9')]=db[_0x9696('0x5')][_0x9696('0x14')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xfa'));db[_0x9696('0xfb')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xfc'));db['UserProfile']=db[_0x9696('0x5')][_0x9696('0x14')]('../api/userProfile/userProfile.model');db[_0x9696('0xfd')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0xfe'));db[_0x9696('0xff')]=db['sequelize'][_0x9696('0x14')](_0x9696('0x100'));db[_0x9696('0x101')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x102'));db['WhatsappAccount']=db['sequelize'][_0x9696('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0x9696('0x103')]=db[_0x9696('0x5')]['import'](_0x9696('0x104'));db[_0x9696('0x105')]=db[_0x9696('0x5')]['import'](_0x9696('0x106'));db[_0x9696('0x107')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x108'));db[_0x9696('0x109')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x10a'));db['WhatsappTransferReport']=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x10b'));db[_0x9696('0x10c')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x10d'));db[_0x9696('0x10e')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x10f'));db[_0x9696('0x110')]=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x111'));db[_0x9696('0x112')]=db[_0x9696('0x5')]['import'](_0x9696('0x113'));db['UserVoicePrefix']=db['sequelize']['import'](_0x9696('0x114'));db['UserSetting']=db[_0x9696('0x5')][_0x9696('0x14')](_0x9696('0x115'));db[_0x9696('0x13')]['hasOne'](db[_0x9696('0x20')],{'as':_0x9696('0x20'),'onDelete':'cascade','foreignKey':_0x9696('0x116')});db[_0x9696('0x13')][_0x9696('0x117')](db[_0x9696('0x118')],{'as':_0x9696('0x119'),'onDelete':_0x9696('0x11a'),'foreignKey':'UserId'});db[_0x9696('0x13')][_0x9696('0x11b')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0x9696('0x116')});db['User'][_0x9696('0x11b')](db['UserVoiceQueueRt'],{'as':_0x9696('0x11c'),'foreignKey':_0x9696('0x116')});db[_0x9696('0x13')][_0x9696('0x11b')](db['VoiceExtension'],{'as':_0x9696('0x11d'),'onDelete':_0x9696('0x11a'),'hooks':!![]});db['User'][_0x9696('0x11b')](db['CmHopperFinal'],{'as':_0x9696('0x11e'),'foreignKey':_0x9696('0x116')});db[_0x9696('0x13')][_0x9696('0x11b')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x9696('0x116')});db[_0x9696('0x13')][_0x9696('0x11b')](db[_0x9696('0x11f')],{'as':_0x9696('0x11f'),'foreignKey':_0x9696('0x116')});db[_0x9696('0x13')][_0x9696('0x11b')](db[_0x9696('0x5e')],{'as':_0x9696('0x120'),'foreignKey':'UserId'});db[_0x9696('0x13')][_0x9696('0x11b')](db[_0x9696('0x66')],{'as':_0x9696('0x121'),'foreignKey':_0x9696('0x116')});db[_0x9696('0x13')][_0x9696('0x11b')](db[_0x9696('0x55')],{'as':'SmsInteractions','foreignKey':_0x9696('0x116')});db[_0x9696('0x13')]['hasMany'](db[_0x9696('0x4a')],{'as':_0x9696('0x122'),'foreignKey':_0x9696('0x116')});db[_0x9696('0x13')][_0x9696('0x11b')](db[_0x9696('0x3f')],{'as':_0x9696('0x123'),'foreignKey':_0x9696('0x116')});db['User']['hasMany'](db[_0x9696('0x105')],{'as':'WhatsappInteractions','foreignKey':_0x9696('0x116')});db[_0x9696('0x13')]['hasMany'](db[_0x9696('0x101')],{'as':_0x9696('0x124'),'foreignKey':'SenderId'});db[_0x9696('0x13')][_0x9696('0x125')](db[_0x9696('0x126')],{'as':_0x9696('0x126'),'foreignKey':_0x9696('0x127')});db['User']['belongsToMany'](db[_0x9696('0x6b')],{'as':_0x9696('0x128'),'through':_0x9696('0x129')});db[_0x9696('0x13')][_0x9696('0x12a')](db[_0x9696('0x6e')],{'as':_0x9696('0x12b'),'through':_0x9696('0x12c')});db['User'][_0x9696('0x12a')](db[_0x9696('0x12d')],{'as':_0x9696('0x12e'),'through':_0x9696('0x12f')});db[_0x9696('0x13')][_0x9696('0x12a')](db['Team'],{'through':_0x9696('0x130')});db[_0x9696('0x13')][_0x9696('0x12a')](db[_0x9696('0x3f')],{'as':_0x9696('0x123'),'through':_0x9696('0x131')});db[_0x9696('0x13')][_0x9696('0x12a')](db[_0x9696('0x66')],{'as':_0x9696('0x121'),'through':_0x9696('0x132')});db[_0x9696('0x13')]['belongsToMany'](db[_0x9696('0x4a')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0x9696('0x13')]['belongsToMany'](db[_0x9696('0x55')],{'as':_0x9696('0x133'),'through':'user_has_sms_interactions'});db['User'][_0x9696('0x12a')](db[_0x9696('0x5e')],{'as':_0x9696('0x120'),'through':_0x9696('0x134')});db[_0x9696('0x13')][_0x9696('0x12a')](db[_0x9696('0x105')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x9696('0x13')][_0x9696('0x12a')](db[_0x9696('0x135')],{'as':_0x9696('0x136'),'through':_0x9696('0x30'),'required':![]});db[_0x9696('0x13')][_0x9696('0x12a')](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0x9696('0x137'),'required':![]});db[_0x9696('0x13')][_0x9696('0x12a')](db['MailQueue'],{'as':'MailQueues','through':'UserMailQueue','required':![]});db[_0x9696('0x13')]['belongsToMany'](db[_0x9696('0x6a')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0x9696('0x13')]['belongsToMany'](db[_0x9696('0x138')],{'as':_0x9696('0x139'),'through':_0x9696('0x13a'),'required':![]});db[_0x9696('0x13')][_0x9696('0x12a')](db[_0x9696('0x58')],{'as':_0x9696('0x13b'),'through':_0x9696('0x35'),'required':![]});db[_0x9696('0x13')][_0x9696('0x12a')](db[_0x9696('0x13c')],{'as':_0x9696('0x13d'),'through':_0x9696('0x37'),'required':![]});db['User']['belongsToMany'](db[_0x9696('0x10c')],{'as':_0x9696('0x13e'),'through':'UserWhatsappQueue','required':![]});db[_0x9696('0x13')]['belongsToMany'](db[_0x9696('0x12d')],{'through':_0x9696('0x12f')});db['User'][_0x9696('0x12a')](db[_0x9696('0x13f')],{'as':_0x9696('0x140'),'through':_0x9696('0x141')});db[_0x9696('0x13')][_0x9696('0x12a')](db['FaxAccount'],{'as':_0x9696('0x142'),'through':'user_has_fax_accounts'});db['User']['belongsToMany'](db['MailAccount'],{'as':'MailAccounts','through':_0x9696('0x143')});db[_0x9696('0x13')][_0x9696('0x12a')](db[_0x9696('0x5a')],{'as':_0x9696('0x144'),'through':_0x9696('0x145')});db[_0x9696('0x13')][_0x9696('0x12a')](db[_0x9696('0x51')],{'as':_0x9696('0x146'),'through':_0x9696('0x147')});db['User'][_0x9696('0x12a')](db[_0x9696('0x148')],{'as':_0x9696('0x149'),'through':_0x9696('0x14a')});db['User'][_0x9696('0x12a')](db[_0x9696('0xe3')],{'as':_0x9696('0x14b'),'through':_0x9696('0x14c')});db[_0x9696('0x16')]['hasMany'](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x14d')});db[_0x9696('0x17')][_0x9696('0x11b')](db[_0x9696('0x19')],{'onDelete':_0x9696('0x11a')});db[_0x9696('0x19')][_0x9696('0x11b')](db['VoiceExtension'],{'as':_0x9696('0x14e'),'onDelete':_0x9696('0x11a')});db[_0x9696('0x1a')][_0x9696('0x12a')](db[_0x9696('0x84')],{'as':'Sounds','through':_0x9696('0x14f')});db[_0x9696('0x135')][_0x9696('0x11b')](db['UserVoiceQueueRt'],{'as':_0x9696('0x150'),'foreignKey':'VoiceQueueId'});db[_0x9696('0x135')][_0x9696('0x11b')](db[_0x9696('0x151')],{'as':_0x9696('0x152'),'foreignKey':_0x9696('0x153')});db[_0x9696('0x135')]['hasMany'](db['CmHopperFinal'],{'as':_0x9696('0x11e'),'foreignKey':_0x9696('0x153')});db[_0x9696('0x135')][_0x9696('0x11b')](db[_0x9696('0x154')],{'as':_0x9696('0x155'),'foreignKey':_0x9696('0x153')});db[_0x9696('0x135')]['hasMany'](db[_0x9696('0x11f')],{'as':_0x9696('0x11f'),'foreignKey':'VoiceQueueId'});db[_0x9696('0x135')][_0x9696('0x11b')](db['CmHopperBlack'],{'as':_0x9696('0x156'),'foreignKey':_0x9696('0x153')});db[_0x9696('0x135')]['hasMany'](db[_0x9696('0xd5')],{'as':_0x9696('0x157'),'foreignKey':_0x9696('0x153')});db['VoiceQueue'][_0x9696('0x125')](db[_0x9696('0x2b')],{'as':_0x9696('0x2b'),'foreignKey':_0x9696('0x158')});db[_0x9696('0x135')][_0x9696('0x125')](db[_0x9696('0x2b')],{'as':_0x9696('0x159'),'foreignKey':_0x9696('0x15a')});db[_0x9696('0x135')][_0x9696('0x125')](db[_0x9696('0x7b')],{'as':_0x9696('0x7b'),'foreignKey':_0x9696('0x15b')});db[_0x9696('0x135')][_0x9696('0x125')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x9696('0x15c')});db[_0x9696('0x135')][_0x9696('0x12a')](db[_0x9696('0x12d')],{'as':_0x9696('0x12e'),'through':_0x9696('0x15d')});db[_0x9696('0x135')][_0x9696('0x12a')](db['User'],{'as':_0x9696('0x15e'),'through':_0x9696('0x30')});db[_0x9696('0x135')][_0x9696('0x12a')](db[_0x9696('0xe8')],{'as':_0x9696('0x15f'),'through':_0x9696('0x110')});db['VoiceQueue'][_0x9696('0x12a')](db[_0x9696('0x12d')],{'as':_0x9696('0x160'),'through':_0x9696('0x161')});db[_0x9696('0x1c')]['belongsTo'](db[_0x9696('0x13')],{'as':'User','foreignKey':'UserId'});db[_0x9696('0x1e')][_0x9696('0x125')](db['User'],{'as':_0x9696('0x13'),'foreignKey':'UserId'});db[_0x9696('0x20')]['hasMany'](db['VoiceMailMessage'],{'as':_0x9696('0x162'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x163'),'sourceKey':_0x9696('0x164')});db[_0x9696('0x21')][_0x9696('0x125')](db[_0x9696('0x20')],{'foreignKey':_0x9696('0x163'),'targetKey':'mailbox'});db[_0x9696('0x165')][_0x9696('0x11b')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0x9696('0x165')][_0x9696('0x11b')](db[_0x9696('0x25')],{'as':_0x9696('0x166'),'foreignKey':'uniqueid','constraints':![]});db[_0x9696('0x165')][_0x9696('0x125')](db[_0x9696('0x13')],{'as':_0x9696('0x13'),'foreignKey':_0x9696('0x116')});db['VoiceCallReport'][_0x9696('0x125')](db[_0x9696('0x6e')],{'as':_0x9696('0x167'),'foreignKey':'ContactId'});db['MailServerIn'][_0x9696('0x125')](db[_0x9696('0x168')],{'as':_0x9696('0x168'),'foreignKey':_0x9696('0x169')});db[_0x9696('0x3a')][_0x9696('0x125')](db[_0x9696('0x10e')],{'as':_0x9696('0x10e'),'foreignKey':'CloudProviderId','onDelete':_0x9696('0x16a')});db[_0x9696('0x3b')][_0x9696('0x125')](db[_0x9696('0x168')],{'as':_0x9696('0x168'),'foreignKey':_0x9696('0x169')});db['MailServerOut']['belongsTo'](db[_0x9696('0x10e')],{'as':_0x9696('0x10e'),'foreignKey':_0x9696('0x16b'),'onDelete':'restrict'});db[_0x9696('0x168')][_0x9696('0x117')](db[_0x9696('0x3a')],{'as':_0x9696('0x16c'),'onDelete':_0x9696('0x11a')});db[_0x9696('0x168')][_0x9696('0x117')](db[_0x9696('0x3b')],{'as':'Smtp','onDelete':_0x9696('0x11a')});db['MailAccount'][_0x9696('0x11b')](db['Disposition'],{'as':_0x9696('0x16d'),'foreignKey':'MailAccountId','onDelete':_0x9696('0x11a')});db[_0x9696('0x168')][_0x9696('0x11b')](db['CannedAnswer'],{'as':_0x9696('0x16e'),'foreignKey':_0x9696('0x169')});db[_0x9696('0x168')][_0x9696('0x11b')](db[_0x9696('0x40')],{'as':_0x9696('0x162'),'foreignKey':_0x9696('0x169')});db[_0x9696('0x168')]['hasMany'](db['MailInteraction'],{'as':_0x9696('0x16f')});db['MailAccount']['hasMany'](db[_0x9696('0x42')],{'as':'Applications'});db[_0x9696('0x168')][_0x9696('0x125')](db[_0x9696('0x12d')],{'as':_0x9696('0x170'),'foreignKey':_0x9696('0x171')});db[_0x9696('0x168')][_0x9696('0x125')](db[_0x9696('0x8d')],{'as':'Template','foreignKey':_0x9696('0x172')});db[_0x9696('0x168')][_0x9696('0x125')](db[_0x9696('0x7d')],{'as':_0x9696('0x173'),'foreignKey':_0x9696('0x15c')});db[_0x9696('0x168')]['belongsToMany'](db[_0x9696('0x13')],{'as':_0x9696('0x15e'),'through':_0x9696('0x143')});db[_0x9696('0x174')][_0x9696('0x12a')](db[_0x9696('0x13')],{'as':_0x9696('0x15e'),'through':_0x9696('0x175')});db[_0x9696('0x174')][_0x9696('0x12a')](db[_0x9696('0xe8')],{'through':_0x9696('0x176'),'as':_0x9696('0x15f')});db['MailInteraction'][_0x9696('0x11b')](db[_0x9696('0x40')],{'as':_0x9696('0x162'),'onDelete':'cascade','foreignKey':_0x9696('0x177')});db[_0x9696('0x3f')]['belongsTo'](db[_0x9696('0x168')],{'as':_0x9696('0x178'),'foreignKey':'MailAccountId'});db[_0x9696('0x3f')][_0x9696('0x125')](db[_0x9696('0x6e')],{'as':_0x9696('0x167'),'foreignKey':_0x9696('0x179')});db[_0x9696('0x3f')][_0x9696('0x125')](db[_0x9696('0x13')],{'as':_0x9696('0x17a'),'foreignKey':_0x9696('0x116')});db[_0x9696('0x3f')][_0x9696('0x12a')](db['Tag'],{'through':_0x9696('0x17b'),'as':_0x9696('0x17c')});db[_0x9696('0x3f')][_0x9696('0x12a')](db[_0x9696('0x17d')],{'through':_0x9696('0x17b'),'as':'ThroughTags'});db[_0x9696('0x3f')]['belongsToMany'](db[_0x9696('0x13')],{'as':_0x9696('0x17e'),'through':_0x9696('0x131'),'foreignKey':_0x9696('0x177')});db['MailMessage'][_0x9696('0x11b')](db[_0x9696('0xef')],{'as':_0x9696('0x17f'),'onDelete':_0x9696('0x11a')});db[_0x9696('0x40')][_0x9696('0x125')](db[_0x9696('0x13')],{'as':_0x9696('0x13')});db[_0x9696('0x40')][_0x9696('0x125')](db[_0x9696('0x6e')],{'onDelete':_0x9696('0x11a'),'as':_0x9696('0x167')});db[_0x9696('0x40')][_0x9696('0x125')](db[_0x9696('0x3f')],{'as':_0x9696('0x180'),'foreignKey':_0x9696('0x177')});db['MailMessage']['belongsTo'](db['MailAccount'],{'as':_0x9696('0x178'),'foreignKey':_0x9696('0x169')});db[_0x9696('0x40')][_0x9696('0x125')](db[_0x9696('0x13f')],{'as':_0x9696('0x13f'),'foreignKey':_0x9696('0x181')});db['MailMessage'][_0x9696('0x125')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x9696('0x182')});db[_0x9696('0x42')][_0x9696('0x125')](db[_0x9696('0x13')],{'onDelete':_0x9696('0x16a')});db[_0x9696('0x42')][_0x9696('0x125')](db[_0x9696('0x174')],{'onDelete':_0x9696('0x16a')});db[_0x9696('0x42')][_0x9696('0x125')](db['MailAccount'],{'onDelete':'restrict'});db[_0x9696('0x42')]['belongsTo'](db[_0x9696('0x7b')],{'onDelete':_0x9696('0x16a'),'foreignKey':_0x9696('0x15b')});db[_0x9696('0x42')][_0x9696('0x125')](db['Tag'],{'onDelete':_0x9696('0x16a'),'foreignKey':'TagId'});db[_0x9696('0x44')]['belongsTo'](db[_0x9696('0x168')],{});db[_0x9696('0x44')][_0x9696('0x125')](db['CmList'],{'as':_0x9696('0x170'),'foreignKey':_0x9696('0x171')});db['MailQueueReport'][_0x9696('0x125')](db['CmContact'],{'as':_0x9696('0x167'),'foreignKey':_0x9696('0x179')});db['MailQueueReport'][_0x9696('0x125')](db[_0x9696('0x3f')],{});db['MailQueueReport'][_0x9696('0x125')](db['MailMessage'],{});db[_0x9696('0x44')][_0x9696('0x125')](db[_0x9696('0x13')],{});db['MailQueueReport']['belongsTo'](db[_0x9696('0x174')],{});db[_0x9696('0x183')][_0x9696('0x11b')](db[_0x9696('0x184')],{'as':_0x9696('0x185'),'onDelete':_0x9696('0x11a')});db[_0x9696('0x47')][_0x9696('0x11b')](db[_0x9696('0x186')],{'as':_0x9696('0x16d'),'foreignKey':'FaxAccountId','onDelete':_0x9696('0x11a')});db[_0x9696('0x47')][_0x9696('0x11b')](db[_0x9696('0x77')],{'as':_0x9696('0x16e'),'foreignKey':_0x9696('0x187')});db[_0x9696('0x47')][_0x9696('0x11b')](db[_0x9696('0x4a')],{'as':'Interactions'});db['FaxAccount'][_0x9696('0x11b')](db[_0x9696('0x48')],{'as':_0x9696('0x14e')});db['FaxAccount'][_0x9696('0x11b')](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0x9696('0x11a')});db[_0x9696('0x47')]['hasMany'](db[_0x9696('0x4c')],{'as':_0x9696('0x162')});db[_0x9696('0x47')][_0x9696('0x125')](db['Trunk'],{'as':_0x9696('0x2b')});db[_0x9696('0x47')][_0x9696('0x125')](db[_0x9696('0x12d')],{'as':_0x9696('0x170'),'foreignKey':_0x9696('0x171')});db[_0x9696('0x47')][_0x9696('0x125')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x9696('0x15c')});db[_0x9696('0x47')]['belongsToMany'](db[_0x9696('0x13')],{'as':_0x9696('0x15e'),'through':_0x9696('0x188')});db[_0x9696('0x48')]['belongsTo'](db['User'],{'onDelete':_0x9696('0x16a')});db[_0x9696('0x48')]['belongsTo'](db[_0x9696('0x138')],{'onDelete':'restrict'});db[_0x9696('0x48')][_0x9696('0x125')](db[_0x9696('0x47')],{'onDelete':_0x9696('0x16a')});db[_0x9696('0x48')][_0x9696('0x125')](db[_0x9696('0x17d')],{'onDelete':_0x9696('0x16a'),'foreignKey':_0x9696('0x189')});db['FaxInteraction']['hasMany'](db[_0x9696('0x4c')],{'as':_0x9696('0x162'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x18a')});db['FaxInteraction'][_0x9696('0x125')](db[_0x9696('0x47')],{'as':_0x9696('0x178'),'foreignKey':'FaxAccountId'});db['FaxInteraction']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x9696('0x179')});db[_0x9696('0x4a')][_0x9696('0x125')](db['User'],{'as':_0x9696('0x17a'),'foreignKey':_0x9696('0x116')});db['FaxInteraction'][_0x9696('0x12a')](db[_0x9696('0x17d')],{'through':_0x9696('0x18b'),'as':_0x9696('0x17c')});db[_0x9696('0x4a')][_0x9696('0x12a')](db[_0x9696('0x17d')],{'through':'fax_interaction_has_tags','as':_0x9696('0x18c')});db[_0x9696('0x4a')]['belongsToMany'](db[_0x9696('0x13')],{'as':'Users','through':_0x9696('0x18d'),'foreignKey':_0x9696('0x18a')});db[_0x9696('0x4c')][_0x9696('0x125')](db[_0x9696('0x13')],{'onDelete':_0x9696('0x11a'),'as':_0x9696('0x13')});db[_0x9696('0x4c')][_0x9696('0x125')](db[_0x9696('0x4a')],{'as':_0x9696('0x180'),'foreignKey':_0x9696('0x18a')});db[_0x9696('0x4c')][_0x9696('0x125')](db['CmContact'],{'onDelete':_0x9696('0x11a'),'as':'Contact'});db[_0x9696('0x4c')][_0x9696('0x125')](db[_0x9696('0xef')],{'as':_0x9696('0xef'),'foreignKey':_0x9696('0x18e')});db[_0x9696('0x4c')]['belongsTo'](db[_0x9696('0x47')],{'as':_0x9696('0x178'),'foreignKey':_0x9696('0x187')});db['FaxQueue']['belongsToMany'](db['User'],{'as':_0x9696('0x15e'),'through':_0x9696('0x13a')});db[_0x9696('0x138')]['belongsToMany'](db[_0x9696('0xe8')],{'through':_0x9696('0x18f'),'as':_0x9696('0x15f')});db[_0x9696('0x4f')][_0x9696('0x125')](db['FaxAccount'],{});db[_0x9696('0x4f')][_0x9696('0x125')](db[_0x9696('0x12d')],{'as':_0x9696('0x170'),'foreignKey':_0x9696('0x171')});db[_0x9696('0x4f')][_0x9696('0x125')](db['CmContact'],{'as':_0x9696('0x167'),'foreignKey':_0x9696('0x179')});db[_0x9696('0x4f')]['belongsTo'](db[_0x9696('0x4a')],{});db[_0x9696('0x4f')][_0x9696('0x125')](db['FaxMessage'],{});db[_0x9696('0x4f')]['belongsTo'](db[_0x9696('0x13')],{});db['FaxQueueReport'][_0x9696('0x125')](db[_0x9696('0x138')],{});db[_0x9696('0x51')]['hasMany'](db['Disposition'],{'as':_0x9696('0x16d'),'foreignKey':_0x9696('0x190'),'onDelete':_0x9696('0x11a')});db[_0x9696('0x51')]['hasMany'](db[_0x9696('0x77')],{'as':_0x9696('0x16e'),'foreignKey':'SmsAccountId'});db[_0x9696('0x51')][_0x9696('0x11b')](db['SmsMessage'],{'as':_0x9696('0x162'),'foreignKey':_0x9696('0x190')});db['SmsAccount'][_0x9696('0x11b')](db['SmsInteraction'],{'as':'Interactions'});db[_0x9696('0x51')][_0x9696('0x11b')](db[_0x9696('0x53')],{'as':_0x9696('0x14e')});db['SmsAccount'][_0x9696('0x125')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['SmsAccount'][_0x9696('0x125')](db[_0x9696('0x7d')],{'as':_0x9696('0x173'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9696('0x51')][_0x9696('0x12a')](db[_0x9696('0x13')],{'as':'Agents','through':'user_has_sms_accounts'});db['SmsApplication'][_0x9696('0x125')](db[_0x9696('0x13')],{'onDelete':_0x9696('0x16a')});db['SmsApplication'][_0x9696('0x125')](db['SmsQueue'],{'onDelete':_0x9696('0x16a')});db[_0x9696('0x53')][_0x9696('0x125')](db['SmsAccount'],{'onDelete':_0x9696('0x16a')});db['SmsApplication']['belongsTo'](db['Interval'],{'onDelete':_0x9696('0x16a'),'foreignKey':'IntervalId'});db[_0x9696('0x53')][_0x9696('0x125')](db[_0x9696('0x17d')],{'onDelete':_0x9696('0x16a'),'foreignKey':_0x9696('0x189')});db[_0x9696('0x55')][_0x9696('0x11b')](db[_0x9696('0x57')],{'as':'Messages','onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x191')});db[_0x9696('0x55')][_0x9696('0x125')](db[_0x9696('0x51')],{'as':_0x9696('0x178'),'foreignKey':_0x9696('0x190')});db[_0x9696('0x55')][_0x9696('0x125')](db['CmContact'],{'as':_0x9696('0x167'),'foreignKey':_0x9696('0x179')});db[_0x9696('0x55')]['belongsTo'](db[_0x9696('0x13')],{'as':_0x9696('0x17a'),'foreignKey':'UserId'});db[_0x9696('0x55')][_0x9696('0x12a')](db[_0x9696('0x17d')],{'through':'sms_interaction_has_tags','as':_0x9696('0x17c')});db[_0x9696('0x55')]['belongsToMany'](db[_0x9696('0x17d')],{'through':_0x9696('0x192'),'as':'ThroughTags'});db[_0x9696('0x55')]['belongsToMany'](db[_0x9696('0x13')],{'as':'Users','through':_0x9696('0x193'),'foreignKey':_0x9696('0x191')});db['SmsMessage'][_0x9696('0x125')](db['User'],{'as':'User'});db[_0x9696('0x57')][_0x9696('0x125')](db[_0x9696('0x6e')],{'onDelete':'cascade','as':_0x9696('0x167')});db[_0x9696('0x57')][_0x9696('0x125')](db[_0x9696('0x55')],{'onDelete':'cascade','as':'Interaction','foreignKey':'SmsInteractionId'});db[_0x9696('0x57')][_0x9696('0x125')](db['SmsAccount'],{'as':_0x9696('0x178'),'foreignKey':_0x9696('0x190')});db['SmsQueue'][_0x9696('0x12a')](db[_0x9696('0x13')],{'as':_0x9696('0x15e'),'through':_0x9696('0x35'),'foreignKey':'SmsQueueId'});db[_0x9696('0x58')][_0x9696('0x12a')](db[_0x9696('0xe8')],{'through':_0x9696('0x194'),'as':_0x9696('0x15f')});db[_0x9696('0x5a')][_0x9696('0x11b')](db['Disposition'],{'as':_0x9696('0x16d'),'foreignKey':'OpenchannelAccountId','onDelete':_0x9696('0x11a')});db['OpenchannelAccount']['hasMany'](db[_0x9696('0x77')],{'as':_0x9696('0x16e'),'foreignKey':'OpenchannelAccountId'});db[_0x9696('0x5a')][_0x9696('0x11b')](db[_0x9696('0x5e')],{'as':'Interactions','foreignKey':_0x9696('0x195')});db[_0x9696('0x5a')][_0x9696('0x11b')](db['OpenchannelMessage'],{'as':_0x9696('0x162'),'foreignKey':'OpenchannelAccountId'});db[_0x9696('0x5a')][_0x9696('0x11b')](db[_0x9696('0x5c')],{'as':_0x9696('0x14e'),'foreignKey':'OpenchannelAccountId'});db[_0x9696('0x5a')]['belongsTo'](db[_0x9696('0x12d')],{'as':_0x9696('0x170'),'foreignKey':_0x9696('0x171')});db['OpenchannelAccount'][_0x9696('0x125')](db[_0x9696('0x7d')],{'as':_0x9696('0x173'),'foreignKey':_0x9696('0x15c')});db['OpenchannelAccount'][_0x9696('0x12a')](db[_0x9696('0x13')],{'as':_0x9696('0x15e'),'through':_0x9696('0x145')});db['OpenchannelApplication'][_0x9696('0x125')](db[_0x9696('0x13')],{'onDelete':'restrict'});db[_0x9696('0x5c')][_0x9696('0x125')](db[_0x9696('0x13c')],{'onDelete':_0x9696('0x16a'),'foreignKey':'OpenchannelQueueId'});db[_0x9696('0x5c')][_0x9696('0x125')](db[_0x9696('0x5a')],{'onDelete':'restrict','foreignKey':_0x9696('0x195')});db[_0x9696('0x5c')][_0x9696('0x125')](db[_0x9696('0x7b')],{'onDelete':_0x9696('0x16a'),'foreignKey':_0x9696('0x15b')});db['OpenchannelApplication'][_0x9696('0x125')](db[_0x9696('0x17d')],{'onDelete':_0x9696('0x16a'),'foreignKey':_0x9696('0x189')});db['OpenchannelInteraction'][_0x9696('0x11b')](db['OpenchannelMessage'],{'as':_0x9696('0x162'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x196')});db['OpenchannelInteraction'][_0x9696('0x125')](db[_0x9696('0x5a')],{'as':_0x9696('0x178'),'foreignKey':_0x9696('0x195')});db[_0x9696('0x5e')]['belongsTo'](db[_0x9696('0x6e')],{'as':_0x9696('0x167'),'foreignKey':_0x9696('0x179')});db['OpenchannelInteraction']['belongsTo'](db[_0x9696('0x13')],{'as':_0x9696('0x17a'),'foreignKey':_0x9696('0x116')});db[_0x9696('0x5e')][_0x9696('0x12a')](db['Tag'],{'through':_0x9696('0x197'),'as':_0x9696('0x17c')});db[_0x9696('0x5e')][_0x9696('0x12a')](db[_0x9696('0x17d')],{'through':_0x9696('0x197'),'as':_0x9696('0x18c')});db[_0x9696('0x5e')][_0x9696('0x12a')](db[_0x9696('0x13')],{'as':_0x9696('0x17e'),'through':_0x9696('0x134'),'foreignKey':_0x9696('0x196')});db[_0x9696('0x5f')][_0x9696('0x125')](db['User'],{'onDelete':_0x9696('0x11a'),'as':'User'});db['OpenchannelMessage'][_0x9696('0x125')](db[_0x9696('0x6e')],{'onDelete':_0x9696('0x11a'),'as':_0x9696('0x167')});db[_0x9696('0x5f')][_0x9696('0x125')](db[_0x9696('0x5e')],{'onDelete':_0x9696('0x11a'),'as':_0x9696('0x180'),'foreignKey':'OpenchannelInteractionId'});db[_0x9696('0x5f')][_0x9696('0x125')](db[_0x9696('0xef')],{'as':_0x9696('0xef'),'foreignKey':_0x9696('0x18e')});db['OpenchannelMessage']['belongsTo'](db[_0x9696('0x5a')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x9696('0x13c')][_0x9696('0x12a')](db['User'],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0x9696('0x198')});db[_0x9696('0x13c')]['belongsToMany'](db[_0x9696('0xe8')],{'through':'team_has_openchannel_queues','as':_0x9696('0x15f')});db['ChatWebsite']['hasMany'](db[_0x9696('0x186')],{'as':_0x9696('0x16d'),'foreignKey':_0x9696('0x181'),'onDelete':_0x9696('0x11a')});db[_0x9696('0x13f')][_0x9696('0x11b')](db[_0x9696('0x77')],{'as':_0x9696('0x16e'),'foreignKey':'ChatWebsiteId'});db[_0x9696('0x13f')][_0x9696('0x11b')](db['ChatProactiveAction'],{'as':_0x9696('0x199')});db[_0x9696('0x13f')][_0x9696('0x11b')](db[_0x9696('0x66')],{'as':_0x9696('0x16f')});db['ChatWebsite'][_0x9696('0x11b')](db[_0x9696('0x64')],{'as':_0x9696('0x14e')});db[_0x9696('0x13f')][_0x9696('0x11b')](db[_0x9696('0x67')],{'as':_0x9696('0x162')});db[_0x9696('0x13f')][_0x9696('0x125')](db[_0x9696('0x12d')],{'as':_0x9696('0x170'),'foreignKey':'ListId'});db['ChatWebsite'][_0x9696('0x125')](db['Interval'],{'as':_0x9696('0x7b'),'foreignKey':'IntervalId'});db['ChatWebsite']['belongsTo'](db[_0x9696('0x168')],{'as':_0x9696('0x168'),'foreignKey':'MailAccountId'});db[_0x9696('0x13f')]['belongsTo'](db[_0x9696('0x7d')],{'as':_0x9696('0x173'),'foreignKey':_0x9696('0x15c')});db['ChatWebsite'][_0x9696('0x12a')](db[_0x9696('0x13')],{'as':_0x9696('0x15e'),'through':'user_has_chat_websites'});db[_0x9696('0x62')][_0x9696('0x125')](db[_0x9696('0x5a')],{});db[_0x9696('0x62')]['belongsTo'](db[_0x9696('0x12d')],{'as':_0x9696('0x170'),'foreignKey':_0x9696('0x171')});db['OpenchannelQueueReport'][_0x9696('0x125')](db[_0x9696('0x6e')],{'as':_0x9696('0x167'),'foreignKey':_0x9696('0x179')});db[_0x9696('0x62')][_0x9696('0x125')](db[_0x9696('0x5e')],{});db[_0x9696('0x62')]['belongsTo'](db[_0x9696('0x5f')],{});db[_0x9696('0x62')][_0x9696('0x125')](db[_0x9696('0x13')],{});db[_0x9696('0x62')]['belongsTo'](db['OpenchannelQueue'],{});db[_0x9696('0x64')][_0x9696('0x125')](db['User'],{'as':_0x9696('0x19a'),'foreignKey':_0x9696('0x116'),'onDelete':_0x9696('0x16a')});db[_0x9696('0x64')][_0x9696('0x125')](db['ChatQueue'],{'as':_0x9696('0x19b'),'foreignKey':'ChatQueueId','onDelete':_0x9696('0x16a')});db['ChatApplication']['belongsTo'](db['ChatWebsite'],{'as':'Website','foreignKey':_0x9696('0x181'),'onDelete':_0x9696('0x16a')});db[_0x9696('0x64')][_0x9696('0x125')](db[_0x9696('0x17d')],{'onDelete':'restrict','foreignKey':_0x9696('0x189')});db[_0x9696('0x66')][_0x9696('0x11b')](db['ChatMessage'],{'as':_0x9696('0x162'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x19c')});db[_0x9696('0x66')][_0x9696('0x125')](db[_0x9696('0x13f')],{'as':_0x9696('0x178'),'foreignKey':_0x9696('0x181')});db[_0x9696('0x66')][_0x9696('0x125')](db['CmContact'],{'as':_0x9696('0x167'),'foreignKey':_0x9696('0x179')});db[_0x9696('0x66')][_0x9696('0x125')](db[_0x9696('0x13')],{'as':_0x9696('0x17a'),'foreignKey':_0x9696('0x116')});db['ChatInteraction'][_0x9696('0x12a')](db[_0x9696('0x17d')],{'through':_0x9696('0x19d'),'as':'Tags'});db[_0x9696('0x66')][_0x9696('0x12a')](db['Tag'],{'through':_0x9696('0x19d'),'as':'ThroughTags'});db[_0x9696('0x66')][_0x9696('0x12a')](db[_0x9696('0x13')],{'as':'Users','through':_0x9696('0x132'),'foreignKey':_0x9696('0x19c')});db['ChatMessage']['belongsTo'](db['User'],{'onDelete':_0x9696('0x11a'),'as':_0x9696('0x13')});db[_0x9696('0x67')]['belongsTo'](db[_0x9696('0x6e')],{'onDelete':_0x9696('0x11a'),'as':_0x9696('0x167'),'foreignKey':_0x9696('0x179')});db[_0x9696('0x67')][_0x9696('0x125')](db[_0x9696('0x66')],{'onDelete':_0x9696('0x11a'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x9696('0x67')][_0x9696('0x125')](db[_0x9696('0xef')],{'as':_0x9696('0xef'),'foreignKey':'AttachmentId'});db['ChatMessage'][_0x9696('0x125')](db[_0x9696('0x13f')],{'as':_0x9696('0x178'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage']['hasMany'](db[_0x9696('0xef')],{'as':_0x9696('0x17f'),'foreignKey':_0x9696('0x182'),'onDelete':_0x9696('0x11a'),'hooks':!![]});db[_0x9696('0x19e')][_0x9696('0x125')](db[_0x9696('0x6e')],{'onDelete':_0x9696('0x11a'),'as':'Contact','foreignKey':_0x9696('0x179')});db[_0x9696('0x19e')][_0x9696('0x125')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x9696('0x181')});db[_0x9696('0x6a')]['belongsToMany'](db['User'],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x9696('0x6a')][_0x9696('0x12a')](db[_0x9696('0xe8')],{'through':_0x9696('0x19f'),'as':_0x9696('0x15f')});db[_0x9696('0x6b')][_0x9696('0x11b')](db[_0x9696('0xd0')],{'as':_0x9696('0x162'),'foreignKey':_0x9696('0x1a0'),'onDelete':_0x9696('0x11a')});db[_0x9696('0x6b')][_0x9696('0x12a')](db['User'],{'as':_0x9696('0x150'),'through':_0x9696('0x129')});db['ChatProactiveAction'][_0x9696('0x125')](db[_0x9696('0x13f')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x9696('0x6d')][_0x9696('0x11b')](db['CmContact'],{'as':_0x9696('0x12b'),'foreignKey':_0x9696('0x1a1')});db[_0x9696('0x6e')][_0x9696('0x11b')](db[_0x9696('0x89')],{'as':_0x9696('0x1a2'),'foreignKey':_0x9696('0x1a3')});db[_0x9696('0x6e')][_0x9696('0x11b')](db[_0x9696('0x151')],{'as':'Hoppers','foreignKey':_0x9696('0x179')});db['CmContact'][_0x9696('0x11b')](db[_0x9696('0x70')],{'as':_0x9696('0x11e'),'foreignKey':'ContactId'});db[_0x9696('0x6e')][_0x9696('0x11b')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x9696('0x179')});db[_0x9696('0x6e')][_0x9696('0x11b')](db[_0x9696('0x11f')],{'as':_0x9696('0x11f'),'foreignKey':_0x9696('0x179')});db[_0x9696('0x6e')][_0x9696('0x11b')](db['JscriptySessionReport'],{'as':_0x9696('0x157'),'foreignKey':_0x9696('0x179')});db[_0x9696('0x6e')][_0x9696('0x11b')](db[_0x9696('0x5e')],{'as':_0x9696('0x120'),'foreignKey':_0x9696('0x179'),'onDelete':_0x9696('0x16a')});db[_0x9696('0x6e')]['hasMany'](db[_0x9696('0x66')],{'as':'ChatInteractions','foreignKey':_0x9696('0x179'),'onDelete':_0x9696('0x16a')});db[_0x9696('0x6e')][_0x9696('0x11b')](db[_0x9696('0x55')],{'as':_0x9696('0x133'),'foreignKey':_0x9696('0x179'),'onDelete':'restrict'});db[_0x9696('0x6e')][_0x9696('0x11b')](db[_0x9696('0x4a')],{'as':_0x9696('0x122'),'foreignKey':'ContactId','onDelete':_0x9696('0x16a')});db['CmContact'][_0x9696('0x11b')](db[_0x9696('0x3f')],{'as':_0x9696('0x123'),'foreignKey':_0x9696('0x179'),'onDelete':_0x9696('0x16a')});db[_0x9696('0x6e')][_0x9696('0x125')](db[_0x9696('0x6d')],{'as':_0x9696('0x1a4'),'foreignKey':'CompanyId'});db['CmContact']['belongsTo'](db[_0x9696('0x12d')],{'as':_0x9696('0x170'),'foreignKey':_0x9696('0x171'),'onDelete':_0x9696('0x11a')});db[_0x9696('0x6e')][_0x9696('0x12a')](db['User'],{'as':_0x9696('0x17e'),'through':_0x9696('0x12c')});db[_0x9696('0x6e')][_0x9696('0x12a')](db[_0x9696('0x17d')],{'as':_0x9696('0x17c'),'through':_0x9696('0x1a5')});db[_0x9696('0x6e')][_0x9696('0x12a')](db[_0x9696('0x17d')],{'through':_0x9696('0x1a5'),'as':_0x9696('0x18c')});db[_0x9696('0x151')][_0x9696('0x11b')](db[_0x9696('0x8b')],{'as':_0x9696('0x1a6'),'foreignKey':_0x9696('0x1a7')});db['CmHopper'][_0x9696('0x125')](db[_0x9696('0x6e')],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0x9696('0x151')][_0x9696('0x125')](db[_0x9696('0x12d')],{'as':'List','foreignKey':_0x9696('0x171'),'onDelete':_0x9696('0x11a')});db[_0x9696('0x151')]['belongsTo'](db[_0x9696('0x13')],{'as':_0x9696('0x19a'),'foreignKey':_0x9696('0x116')});db[_0x9696('0x151')][_0x9696('0x125')](db[_0x9696('0x135')],{'as':_0x9696('0x19b'),'foreignKey':_0x9696('0x153'),'onDelete':'cascade'});db[_0x9696('0x151')][_0x9696('0x125')](db[_0x9696('0xeb')],{'as':_0x9696('0xeb'),'foreignKey':_0x9696('0x1a8'),'onDelete':'cascade'});db[_0x9696('0x151')][_0x9696('0x125')](db['User'],{'as':'Owner','foreignKey':_0x9696('0x1a9')});db[_0x9696('0x6f')][_0x9696('0x125')](db[_0x9696('0x6e')],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0x9696('0x6f')]['belongsTo'](db['CmList'],{'as':_0x9696('0x170'),'foreignKey':_0x9696('0x171'),'onDelete':_0x9696('0x11a')});db[_0x9696('0x6f')]['belongsTo'](db[_0x9696('0x135')],{'as':_0x9696('0x19b'),'foreignKey':_0x9696('0x153'),'onDelete':_0x9696('0x11a')});db[_0x9696('0x6f')][_0x9696('0x125')](db[_0x9696('0xeb')],{'as':_0x9696('0xeb'),'foreignKey':_0x9696('0x1a8'),'onDelete':_0x9696('0x11a')});db[_0x9696('0x75')][_0x9696('0x11b')](db[_0x9696('0x79')],{'as':{'plural':_0x9696('0x1aa'),'singular':_0x9696('0x1ab')},'foreignKey':_0x9696('0x1ac'),'onDelete':_0x9696('0x11a'),'hooks':!![]});db[_0x9696('0x75')][_0x9696('0x11b')](db[_0x9696('0x79')],{'as':{'plural':'Any','singular':_0x9696('0x1ad')},'foreignKey':_0x9696('0x1ae'),'onDelete':_0x9696('0x11a'),'hooks':!![]});db[_0x9696('0x75')][_0x9696('0x11b')](db[_0x9696('0x74')],{'as':_0x9696('0x1af'),'foreignKey':_0x9696('0x1b0'),'onDelete':_0x9696('0x11a'),'hooks':!![]});db[_0x9696('0x186')][_0x9696('0x11b')](db['Disposition'],{'as':_0x9696('0x16d'),'foreignKey':'ParentId','onDelete':_0x9696('0x11a')});db[_0x9696('0x7b')][_0x9696('0x11b')](db[_0x9696('0x7b')],{'as':'Intervals','foreignKey':_0x9696('0x15b'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x9696('0x7b')]['hasMany'](db[_0x9696('0x19')],{'as':_0x9696('0x11d'),'foreignKey':_0x9696('0x15b'),'onDelete':'restrict'});db[_0x9696('0x7b')][_0x9696('0x11b')](db[_0x9696('0x42')],{'as':'MailApplications','foreignKey':'IntervalId'});db['Interval'][_0x9696('0x11b')](db[_0x9696('0x64')],{'as':_0x9696('0x1b1'),'foreignKey':_0x9696('0x15b')});db[_0x9696('0x7b')][_0x9696('0x11b')](db[_0x9696('0x48')],{'as':_0x9696('0x1b2'),'foreignKey':'IntervalId'});db[_0x9696('0x7b')][_0x9696('0x11b')](db[_0x9696('0x53')],{'as':'SmsApplications','foreignKey':_0x9696('0x15b')});db[_0x9696('0x83')][_0x9696('0x125')](db['MailAccount'],{});db[_0x9696('0x83')]['belongsTo'](db[_0x9696('0x96')],{'foreignKey':_0x9696('0x1b3')});db[_0x9696('0x83')]['belongsTo'](db[_0x9696('0x1b4')],{'foreignKey':_0x9696('0x1b5')});db['Sound'][_0x9696('0x12a')](db[_0x9696('0x1a')],{'as':_0x9696('0x1b6'),'through':_0x9696('0x14f'),'onDelete':'restrict'});db[_0x9696('0x17d')][_0x9696('0x12a')](db[_0x9696('0x6e')],{'through':'cm_contact_has_tags'});db[_0x9696('0x17d')][_0x9696('0x12a')](db['ChatInteraction'],{'through':_0x9696('0x19d')});db[_0x9696('0x17d')][_0x9696('0x12a')](db[_0x9696('0x3f')],{'through':_0x9696('0x17b')});db[_0x9696('0x17d')][_0x9696('0x12a')](db[_0x9696('0x55')],{'through':'sms_interaction_has_tags'});db[_0x9696('0x17d')][_0x9696('0x12a')](db[_0x9696('0x4a')],{'through':_0x9696('0x18b')});db['Tag']['belongsToMany'](db[_0x9696('0x5e')],{'through':_0x9696('0x197')});db[_0x9696('0x17d')][_0x9696('0x12a')](db[_0x9696('0x105')],{'through':'whatsapp_interaction_has_tags'});db[_0x9696('0x89')][_0x9696('0x125')](db[_0x9696('0x87')],{'as':_0x9696('0x1b7'),'foreignKey':_0x9696('0x1b8')});db[_0x9696('0x8b')][_0x9696('0x125')](db['CmHopper'],{'as':_0x9696('0x1b9'),'foreignKey':'CmHopperId'});db['CmContactHasItem'][_0x9696('0x125')](db[_0x9696('0x6e')],{'as':'Contact','foreignKey':'CmContactId'});db[_0x9696('0x1ba')][_0x9696('0x11b')](db[_0x9696('0x79')],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':_0x9696('0x1bb'),'onDelete':_0x9696('0x11a'),'hooks':!![]});db[_0x9696('0x1ba')][_0x9696('0x11b')](db[_0x9696('0x79')],{'as':{'plural':_0x9696('0x1bc'),'singular':_0x9696('0x1bd')},'foreignKey':_0x9696('0x1be'),'onDelete':_0x9696('0x11a'),'hooks':!![]});db[_0x9696('0x1ba')][_0x9696('0x11b')](db['Action'],{'as':_0x9696('0x1af'),'foreignKey':'TriggerId','onDelete':_0x9696('0x11a'),'hooks':!![]});db[_0x9696('0x1b4')][_0x9696('0x11b')](db[_0x9696('0x9b')],{'as':_0x9696('0x1bf'),'onDelete':'cascade','foreignKey':_0x9696('0x1b5'),'hooks':!![]});db[_0x9696('0x96')]['hasMany'](db[_0x9696('0x9b')],{'as':_0x9696('0x1bf'),'onDelete':'cascade','foreignKey':_0x9696('0x1b3')});db['AnalyticMetric']['hasMany'](db[_0x9696('0x9b')],{'as':_0x9696('0x1bf'),'onDelete':'cascade','foreignKey':_0x9696('0x1c0')});db[_0x9696('0x9b')][_0x9696('0x125')](db[_0x9696('0x99')],{'foreignKey':_0x9696('0x1c0')});db['SalesforceAccount'][_0x9696('0x11b')](db[_0x9696('0xa1')],{'as':_0x9696('0x1c1'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c2')});db[_0x9696('0xa1')][_0x9696('0x11b')](db[_0x9696('0x1c3')],{'as':_0x9696('0x1c4'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c5')});db[_0x9696('0xa1')]['hasMany'](db[_0x9696('0x1c3')],{'as':_0x9696('0x1c6'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c7')});db[_0x9696('0xa1')]['hasMany'](db[_0x9696('0x1c3')],{'as':_0x9696('0x1bf'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c8')});db[_0x9696('0xa1')][_0x9696('0x125')](db['SalesforceAccount'],{'as':'Account','foreignKey':_0x9696('0x1c2')});db[_0x9696('0x1c3')][_0x9696('0x11b')](db[_0x9696('0x1c3')],{'as':_0x9696('0x1c9'),'foreignKey':_0x9696('0x1c5')});db[_0x9696('0x1c3')][_0x9696('0x11b')](db['SalesforceField'],{'as':_0x9696('0x1ca'),'foreignKey':_0x9696('0x1c7')});db[_0x9696('0x1c3')]['hasMany'](db[_0x9696('0x1c3')],{'as':'Field','foreignKey':_0x9696('0x1c8')});db['SalesforceField'][_0x9696('0x125')](db[_0x9696('0x8f')],{'as':_0x9696('0x8f'),'foreignKey':'VariableId'});db[_0x9696('0xa3')]['hasMany'](db[_0x9696('0x1cb')],{'as':_0x9696('0x1c1'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c2')});db[_0x9696('0x1cb')]['hasMany'](db[_0x9696('0xa6')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x9696('0x1c5')});db[_0x9696('0x1cb')]['hasMany'](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c7')});db[_0x9696('0x1cb')][_0x9696('0x11b')](db[_0x9696('0xa6')],{'as':_0x9696('0x1bf'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c8')});db[_0x9696('0x1cb')]['belongsTo'](db[_0x9696('0xa3')],{'as':'Account','foreignKey':'AccountId'});db[_0x9696('0xa6')][_0x9696('0x11b')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0x9696('0x1c5')});db[_0x9696('0xa6')][_0x9696('0x11b')](db[_0x9696('0xa6')],{'as':_0x9696('0x1ca'),'foreignKey':_0x9696('0x1c7')});db[_0x9696('0xa6')][_0x9696('0x11b')](db[_0x9696('0xa6')],{'as':_0x9696('0x1cc'),'foreignKey':_0x9696('0x1c8')});db[_0x9696('0xa6')]['belongsTo'](db[_0x9696('0x8f')],{'as':_0x9696('0x8f'),'foreignKey':'VariableId'});db[_0x9696('0x1cd')][_0x9696('0x11b')](db['DeskConfiguration'],{'as':_0x9696('0x1c1'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c2')});db[_0x9696('0xa8')][_0x9696('0x11b')](db[_0x9696('0xaa')],{'as':_0x9696('0x1c4'),'onDelete':_0x9696('0x11a'),'foreignKey':'SubjectId'});db[_0x9696('0xa8')][_0x9696('0x11b')](db[_0x9696('0xaa')],{'as':'Descriptions','onDelete':_0x9696('0x11a'),'foreignKey':'DescriptionId'});db[_0x9696('0xa8')][_0x9696('0x11b')](db['DeskField'],{'as':_0x9696('0x1bf'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c8')});db[_0x9696('0xa8')]['belongsTo'](db[_0x9696('0x1cd')],{'as':_0x9696('0x178'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x9696('0x12a')](db[_0x9696('0x17d')],{'through':_0x9696('0x1ce')});db[_0x9696('0xaa')][_0x9696('0x11b')](db[_0x9696('0xaa')],{'as':'Subject','foreignKey':_0x9696('0x1c5')});db['DeskField'][_0x9696('0x11b')](db[_0x9696('0xaa')],{'as':_0x9696('0x1ca'),'foreignKey':_0x9696('0x1c7')});db['DeskField'][_0x9696('0x11b')](db[_0x9696('0xaa')],{'as':_0x9696('0x1cc'),'foreignKey':_0x9696('0x1c8')});db[_0x9696('0xaa')][_0x9696('0x125')](db['Variable'],{'as':_0x9696('0x8f'),'foreignKey':'VariableId'});db[_0x9696('0x1cf')][_0x9696('0x11b')](db[_0x9696('0xad')],{'as':_0x9696('0x1c1'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c2')});db[_0x9696('0xad')]['hasMany'](db[_0x9696('0xae')],{'as':_0x9696('0x1c4'),'onDelete':'cascade','foreignKey':_0x9696('0x1c5')});db[_0x9696('0xad')][_0x9696('0x11b')](db[_0x9696('0xae')],{'as':_0x9696('0x1c6'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c7')});db[_0x9696('0xad')][_0x9696('0x11b')](db[_0x9696('0xae')],{'as':_0x9696('0x1bf'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c8')});db[_0x9696('0xad')][_0x9696('0x125')](db[_0x9696('0x1cf')],{'as':_0x9696('0x178'),'foreignKey':_0x9696('0x1c2')});db[_0x9696('0xae')][_0x9696('0x11b')](db[_0x9696('0xae')],{'as':'Subject','foreignKey':_0x9696('0x1c5')});db[_0x9696('0xae')][_0x9696('0x11b')](db[_0x9696('0xae')],{'as':_0x9696('0x1ca'),'foreignKey':_0x9696('0x1c7')});db[_0x9696('0xae')][_0x9696('0x11b')](db[_0x9696('0xae')],{'as':'Field','foreignKey':_0x9696('0x1c8')});db[_0x9696('0xae')]['belongsTo'](db[_0x9696('0x8f')],{'as':_0x9696('0x8f'),'foreignKey':'VariableId'});db[_0x9696('0xb0')][_0x9696('0x11b')](db[_0x9696('0xb2')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x9696('0x1c2')});db[_0x9696('0xb2')]['hasMany'](db[_0x9696('0xb4')],{'as':_0x9696('0x1c4'),'foreignKey':_0x9696('0x1c5')});db[_0x9696('0xb2')][_0x9696('0x11b')](db[_0x9696('0xb4')],{'as':'Descriptions','foreignKey':_0x9696('0x1c7')});db[_0x9696('0xb2')][_0x9696('0x11b')](db['ZendeskField'],{'as':'Fields','foreignKey':_0x9696('0x1c8')});db['ZendeskConfiguration'][_0x9696('0x125')](db[_0x9696('0xb0')],{'as':'Account','foreignKey':_0x9696('0x1c2')});db[_0x9696('0xb2')]['belongsToMany'](db[_0x9696('0x17d')],{'through':'int_zendesk_configuration_has_tags'});db[_0x9696('0xb4')][_0x9696('0x11b')](db['ZendeskField'],{'as':'Subject','foreignKey':_0x9696('0x1c5')});db[_0x9696('0xb4')]['hasMany'](db[_0x9696('0xb4')],{'as':_0x9696('0x1ca'),'foreignKey':_0x9696('0x1c7')});db['ZendeskField'][_0x9696('0x11b')](db[_0x9696('0xb4')],{'as':_0x9696('0x1cc'),'foreignKey':'FieldId'});db[_0x9696('0xb4')]['belongsTo'](db['Variable'],{'as':_0x9696('0x8f'),'foreignKey':'VariableId'});db[_0x9696('0xb6')][_0x9696('0x11b')](db['FreshdeskConfiguration'],{'as':_0x9696('0x1c1'),'onDelete':'cascade','foreignKey':_0x9696('0x1c2')});db['FreshdeskConfiguration'][_0x9696('0x11b')](db[_0x9696('0xba')],{'as':_0x9696('0x1c4'),'onDelete':_0x9696('0x11a'),'foreignKey':'SubjectId'});db[_0x9696('0xb8')]['hasMany'](db[_0x9696('0xba')],{'as':_0x9696('0x1c6'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c7')});db[_0x9696('0xb8')]['hasMany'](db[_0x9696('0xba')],{'as':_0x9696('0x1bf'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c8')});db[_0x9696('0xb8')][_0x9696('0x125')](db[_0x9696('0xb6')],{'as':_0x9696('0x178'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x9696('0x12a')](db[_0x9696('0x17d')],{'through':_0x9696('0x1d0')});db[_0x9696('0xba')][_0x9696('0x11b')](db[_0x9696('0xba')],{'as':_0x9696('0x1c9'),'foreignKey':_0x9696('0x1c5')});db[_0x9696('0xba')][_0x9696('0x11b')](db[_0x9696('0xba')],{'as':_0x9696('0x1ca'),'foreignKey':_0x9696('0x1c7')});db[_0x9696('0xba')][_0x9696('0x11b')](db['FreshdeskField'],{'as':_0x9696('0x1cc'),'foreignKey':_0x9696('0x1c8')});db[_0x9696('0xba')][_0x9696('0x125')](db['Variable'],{'as':_0x9696('0x8f'),'foreignKey':_0x9696('0x1d1')});db['VtigerAccount'][_0x9696('0x11b')](db[_0x9696('0xbd')],{'as':_0x9696('0x1c1'),'onDelete':'cascade','foreignKey':'AccountId'});db['VtigerConfiguration'][_0x9696('0x11b')](db[_0x9696('0x1d2')],{'as':_0x9696('0x1c4'),'foreignKey':_0x9696('0x1c5')});db[_0x9696('0xbd')][_0x9696('0x11b')](db['VtigerField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x9696('0x11b')](db[_0x9696('0x1d2')],{'as':_0x9696('0x1bf'),'foreignKey':_0x9696('0x1c8')});db[_0x9696('0xbd')][_0x9696('0x125')](db[_0x9696('0x1d3')],{'as':_0x9696('0x178'),'foreignKey':'AccountId'});db[_0x9696('0x1d2')]['hasMany'](db[_0x9696('0x1d2')],{'as':_0x9696('0x1c9'),'foreignKey':'SubjectId'});db[_0x9696('0x1d2')][_0x9696('0x11b')](db[_0x9696('0x1d2')],{'as':_0x9696('0x1ca'),'foreignKey':_0x9696('0x1c7')});db[_0x9696('0x1d2')][_0x9696('0x11b')](db[_0x9696('0x1d2')],{'as':_0x9696('0x1cc'),'foreignKey':_0x9696('0x1c8')});db[_0x9696('0x1d2')][_0x9696('0x125')](db['Variable'],{'as':_0x9696('0x8f'),'foreignKey':'VariableId'});db[_0x9696('0x1d4')][_0x9696('0x11b')](db[_0x9696('0xc0')],{'as':_0x9696('0x1c1'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c2')});db[_0x9696('0xc0')][_0x9696('0x11b')](db['ServicenowField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x9696('0xc0')][_0x9696('0x11b')](db[_0x9696('0xc2')],{'as':_0x9696('0x1c6'),'foreignKey':'DescriptionId'});db[_0x9696('0xc0')][_0x9696('0x11b')](db[_0x9696('0xc2')],{'as':_0x9696('0x1bf'),'foreignKey':_0x9696('0x1c8')});db['ServicenowConfiguration']['belongsTo'](db[_0x9696('0x1d4')],{'as':_0x9696('0x178'),'foreignKey':'AccountId'});db['ServicenowField'][_0x9696('0x11b')](db['ServicenowField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x9696('0xc2')][_0x9696('0x11b')](db['ServicenowField'],{'as':'Description','foreignKey':_0x9696('0x1c7')});db[_0x9696('0xc2')][_0x9696('0x11b')](db['ServicenowField'],{'as':'Field','foreignKey':_0x9696('0x1c8')});db[_0x9696('0xc2')][_0x9696('0x125')](db[_0x9696('0x8f')],{'as':'Variable','foreignKey':_0x9696('0x1d1')});db[_0x9696('0xc4')]['hasMany'](db[_0x9696('0xc5')],{'as':'Configurations','onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c2')});db['Dynamics365Account'][_0x9696('0x125')](db[_0x9696('0x10e')],{'as':_0x9696('0x10e'),'foreignKey':_0x9696('0x16b')});db[_0x9696('0xc5')][_0x9696('0x11b')](db[_0x9696('0xc7')],{'as':_0x9696('0x1c4'),'onDelete':_0x9696('0x11a'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0x9696('0x11b')](db[_0x9696('0xc7')],{'as':_0x9696('0x1c6'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c7')});db[_0x9696('0xc5')]['hasMany'](db[_0x9696('0xc7')],{'as':_0x9696('0x1bf'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c8')});db[_0x9696('0xc5')][_0x9696('0x125')](db[_0x9696('0xc4')],{'as':_0x9696('0x178'),'foreignKey':_0x9696('0x1c2')});db['Dynamics365Field'][_0x9696('0x11b')](db[_0x9696('0xc7')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x9696('0xc7')][_0x9696('0x11b')](db[_0x9696('0xc7')],{'as':_0x9696('0x1ca'),'foreignKey':_0x9696('0x1c7')});db[_0x9696('0xc7')]['hasMany'](db['Dynamics365Field'],{'as':_0x9696('0x1cc'),'foreignKey':_0x9696('0x1c8')});db[_0x9696('0xc7')][_0x9696('0x125')](db[_0x9696('0x8f')],{'as':_0x9696('0x8f'),'foreignKey':_0x9696('0x1d1')});db['FreshsalesAccount'][_0x9696('0x11b')](db[_0x9696('0xcb')],{'as':_0x9696('0x1c1'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1c2')});db['FreshsalesConfiguration'][_0x9696('0x11b')](db[_0x9696('0x1d5')],{'as':_0x9696('0x1c4'),'foreignKey':'SubjectId'});db[_0x9696('0xcb')][_0x9696('0x11b')](db['FreshsalesField'],{'as':_0x9696('0x1c6'),'foreignKey':_0x9696('0x1c7')});db[_0x9696('0xcb')]['hasMany'](db[_0x9696('0x1d5')],{'as':_0x9696('0x1bf'),'foreignKey':_0x9696('0x1c8')});db['FreshsalesConfiguration'][_0x9696('0x125')](db[_0x9696('0xc9')],{'as':_0x9696('0x178'),'foreignKey':'AccountId'});db[_0x9696('0x1d5')][_0x9696('0x11b')](db[_0x9696('0x1d5')],{'as':_0x9696('0x1c9'),'foreignKey':_0x9696('0x1c5')});db['FreshsalesField'][_0x9696('0x11b')](db[_0x9696('0x1d5')],{'as':_0x9696('0x1ca'),'foreignKey':_0x9696('0x1c7')});db['FreshsalesField'][_0x9696('0x11b')](db[_0x9696('0x1d5')],{'as':'Field','foreignKey':'FieldId'});db[_0x9696('0x1d5')][_0x9696('0x125')](db[_0x9696('0x8f')],{'as':_0x9696('0x8f'),'foreignKey':_0x9696('0x1d1')});db[_0x9696('0x1d6')]['belongsTo'](db['ChatWebsite'],{});db[_0x9696('0x1d6')][_0x9696('0x125')](db[_0x9696('0x12d')],{'as':'List','foreignKey':_0x9696('0x171')});db[_0x9696('0x1d6')][_0x9696('0x125')](db['CmContact'],{'as':'Contact','foreignKey':_0x9696('0x179')});db[_0x9696('0x1d6')][_0x9696('0x125')](db['ChatInteraction'],{});db['ChatQueueReport'][_0x9696('0x125')](db[_0x9696('0x67')],{});db[_0x9696('0x1d6')]['belongsTo'](db[_0x9696('0x13')],{});db[_0x9696('0x1d6')]['belongsTo'](db[_0x9696('0x6a')],{});db['ChatInternalMessage'][_0x9696('0x125')](db[_0x9696('0x13')],{'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1d7')});db['ChatInternalMessage'][_0x9696('0x125')](db[_0x9696('0x13')],{'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1d8')});db['JscriptySessionReport'][_0x9696('0x11b')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x9696('0x11a')});db[_0x9696('0xd5')][_0x9696('0x11b')](db[_0x9696('0xd2')],{'foreignKey':_0x9696('0x1d9'),'onDelete':'cascade'});db[_0x9696('0xd7')]['belongsTo'](db[_0x9696('0x51')],{});db[_0x9696('0xd7')][_0x9696('0x125')](db[_0x9696('0x12d')],{'as':'List','foreignKey':_0x9696('0x171')});db[_0x9696('0xd7')][_0x9696('0x125')](db[_0x9696('0x6e')],{'as':'Contact','foreignKey':_0x9696('0x179')});db[_0x9696('0xd7')][_0x9696('0x125')](db[_0x9696('0x55')],{});db[_0x9696('0xd7')]['belongsTo'](db[_0x9696('0x57')],{});db[_0x9696('0xd7')][_0x9696('0x125')](db[_0x9696('0x13')],{});db[_0x9696('0xd7')]['belongsTo'](db[_0x9696('0x58')],{});db[_0x9696('0xdd')]['hasMany'](db[_0x9696('0xd5')],{'foreignKey':_0x9696('0x1da')});db[_0x9696('0xdd')][_0x9696('0x11b')](db[_0x9696('0xd4')],{'foreignKey':_0x9696('0x1da')});db[_0x9696('0xdd')][_0x9696('0x11b')](db[_0x9696('0xd2')],{'foreignKey':_0x9696('0x1da')});db[_0x9696('0xe3')][_0x9696('0x12a')](db['User'],{'as':'Users','through':_0x9696('0x14c')});db[_0x9696('0xe8')][_0x9696('0x12a')](db[_0x9696('0x13')],{'as':_0x9696('0x15e'),'through':_0x9696('0x130')});db['Team'][_0x9696('0x12a')](db[_0x9696('0x135')],{'through':'TeamVoiceQueue','as':_0x9696('0x136')});db[_0x9696('0xe8')][_0x9696('0x12a')](db[_0x9696('0x174')],{'through':'team_has_mail_queues','as':'MailQueues'});db['Team'][_0x9696('0x12a')](db[_0x9696('0x6a')],{'through':'team_has_chat_queues','as':_0x9696('0x1db')});db[_0x9696('0xe8')]['belongsToMany'](db['FaxQueue'],{'through':_0x9696('0x18f'),'as':_0x9696('0x139')});db[_0x9696('0xe8')]['belongsToMany'](db['SmsQueue'],{'through':'team_has_sms_queues','as':'SmsQueues'});db['Team']['belongsToMany'](db[_0x9696('0x13c')],{'through':_0x9696('0x1dc'),'as':_0x9696('0x13d')});db[_0x9696('0xe8')]['belongsToMany'](db['WhatsappQueue'],{'through':_0x9696('0x1dd'),'as':_0x9696('0x13e')});db['Team'][_0x9696('0x12a')](db[_0x9696('0xfb')],{'through':_0x9696('0x112'),'as':'VoicePrefixes'});db['Campaign']['hasMany'](db[_0x9696('0x151')],{'as':_0x9696('0x152'),'foreignKey':_0x9696('0x1a8')});db[_0x9696('0xeb')][_0x9696('0x11b')](db[_0x9696('0x70')],{'as':'HopperFinals','foreignKey':_0x9696('0x1a8')});db[_0x9696('0xeb')][_0x9696('0x11b')](db['CmHopperHistory'],{'as':_0x9696('0x155'),'foreignKey':_0x9696('0x1a8')});db[_0x9696('0xeb')]['hasMany'](db[_0x9696('0x6f')],{'as':_0x9696('0x156'),'foreignKey':_0x9696('0x1a8')});db[_0x9696('0xeb')]['belongsTo'](db[_0x9696('0x2b')],{'as':'Trunk','foreignKey':_0x9696('0x158')});db['Campaign'][_0x9696('0x125')](db[_0x9696('0x2b')],{'as':'TrunkBackup','foreignKey':_0x9696('0x15a')});db[_0x9696('0xeb')][_0x9696('0x125')](db['Interval'],{'as':_0x9696('0x7b'),'foreignKey':_0x9696('0x15b')});db[_0x9696('0xeb')][_0x9696('0x125')](db[_0x9696('0xe3')],{'as':'SquareProject','foreignKey':_0x9696('0x1de')});db[_0x9696('0xeb')][_0x9696('0x12a')](db[_0x9696('0x12d')],{'as':'Lists','through':_0x9696('0x1df')});db[_0x9696('0xeb')][_0x9696('0x12a')](db[_0x9696('0x12d')],{'as':_0x9696('0x160'),'through':_0x9696('0x1e0')});db[_0x9696('0xef')][_0x9696('0x125')](db[_0x9696('0x19e')],{'as':_0x9696('0x19e'),'foreignKey':'ChatOfflineMessageId'});db[_0x9696('0xf2')][_0x9696('0x125')](db[_0x9696('0x40')],{});db['MailTransferReport']['belongsTo'](db[_0x9696('0x3f')],{});db[_0x9696('0xf2')]['belongsTo'](db[_0x9696('0x168')],{'foreignKey':_0x9696('0x1e1'),'as':_0x9696('0x1e2')});db[_0x9696('0xf2')][_0x9696('0x125')](db['User'],{'foreignKey':_0x9696('0x1e3'),'as':_0x9696('0x1e4')});db['MailTransferReport'][_0x9696('0x125')](db['User'],{'foreignKey':_0x9696('0x1e5'),'as':_0x9696('0x1e6')});db[_0x9696('0xf2')]['belongsTo'](db[_0x9696('0x174')],{'foreignKey':_0x9696('0x1e7'),'as':_0x9696('0x1e8')});db[_0x9696('0xf2')]['belongsTo'](db[_0x9696('0x168')],{'foreignKey':_0x9696('0x1e9'),'as':_0x9696('0x1ea')});db[_0x9696('0xf3')][_0x9696('0x125')](db[_0x9696('0x67')],{});db[_0x9696('0xf3')]['belongsTo'](db[_0x9696('0x66')],{});db[_0x9696('0xf3')][_0x9696('0x125')](db[_0x9696('0x13f')],{'foreignKey':'FromChatWebsiteId','as':_0x9696('0x1e2')});db[_0x9696('0xf3')]['belongsTo'](db['User'],{'foreignKey':_0x9696('0x1e3'),'as':_0x9696('0x1e4')});db[_0x9696('0xf3')][_0x9696('0x125')](db[_0x9696('0x13')],{'foreignKey':_0x9696('0x1e5'),'as':_0x9696('0x1e6')});db[_0x9696('0xf3')][_0x9696('0x125')](db[_0x9696('0x6a')],{'foreignKey':_0x9696('0x1eb'),'as':'ToQueue'});db[_0x9696('0xf3')][_0x9696('0x125')](db[_0x9696('0x13f')],{'foreignKey':_0x9696('0x1ec'),'as':_0x9696('0x1ea')});db[_0x9696('0xf5')][_0x9696('0x125')](db['FaxMessage'],{});db[_0x9696('0xf5')][_0x9696('0x125')](db['FaxInteraction'],{});db[_0x9696('0xf5')]['belongsTo'](db[_0x9696('0x47')],{'foreignKey':_0x9696('0x1ed'),'as':_0x9696('0x1e2')});db[_0x9696('0xf5')]['belongsTo'](db['User'],{'foreignKey':_0x9696('0x1e3'),'as':_0x9696('0x1e4')});db['FaxTransferReport'][_0x9696('0x125')](db[_0x9696('0x13')],{'foreignKey':_0x9696('0x1e5'),'as':_0x9696('0x1e6')});db[_0x9696('0xf5')][_0x9696('0x125')](db[_0x9696('0x138')],{'foreignKey':_0x9696('0x1ee'),'as':'ToQueue'});db[_0x9696('0xf5')]['belongsTo'](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x9696('0xf7')][_0x9696('0x125')](db['OpenchannelMessage'],{});db[_0x9696('0xf7')]['belongsTo'](db[_0x9696('0x5e')],{});db[_0x9696('0xf7')][_0x9696('0x125')](db[_0x9696('0x5a')],{'foreignKey':_0x9696('0x1ef'),'as':_0x9696('0x1e2')});db[_0x9696('0xf7')][_0x9696('0x125')](db[_0x9696('0x13')],{'foreignKey':_0x9696('0x1e3'),'as':_0x9696('0x1e4')});db[_0x9696('0xf7')]['belongsTo'](db[_0x9696('0x13')],{'foreignKey':_0x9696('0x1e5'),'as':_0x9696('0x1e6')});db[_0x9696('0xf7')][_0x9696('0x125')](db[_0x9696('0x13c')],{'foreignKey':_0x9696('0x1f0'),'as':_0x9696('0x1e8')});db[_0x9696('0xf7')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x9696('0x1f1'),'as':_0x9696('0x1ea')});db[_0x9696('0xf9')][_0x9696('0x125')](db[_0x9696('0x57')],{});db[_0x9696('0xf9')][_0x9696('0x125')](db[_0x9696('0x55')],{});db['SmsTransferReport']['belongsTo'](db[_0x9696('0x51')],{'foreignKey':_0x9696('0x1f2'),'as':'FromAccount'});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x9696('0x1e3'),'as':'FromAgent'});db['SmsTransferReport'][_0x9696('0x125')](db[_0x9696('0x13')],{'foreignKey':_0x9696('0x1e5'),'as':_0x9696('0x1e6')});db[_0x9696('0xf9')]['belongsTo'](db[_0x9696('0x58')],{'foreignKey':_0x9696('0x1f3'),'as':_0x9696('0x1e8')});db[_0x9696('0xf9')][_0x9696('0x125')](db[_0x9696('0x51')],{'foreignKey':_0x9696('0x1f4'),'as':'ToAccount'});db[_0x9696('0x12d')][_0x9696('0x11b')](db['Disposition'],{'as':_0x9696('0x16d'),'foreignKey':'ListId','onDelete':_0x9696('0x11a')});db[_0x9696('0x12d')][_0x9696('0x11b')](db[_0x9696('0x1f5')],{'as':'CustomFields','foreignKey':'ListId'});db['CmList'][_0x9696('0x11b')](db[_0x9696('0x6e')],{'as':_0x9696('0x12b'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x171')});db[_0x9696('0x12d')][_0x9696('0x11b')](db[_0x9696('0x70')],{'as':_0x9696('0x11e'),'foreignKey':'ListId'});db[_0x9696('0x12d')][_0x9696('0x11b')](db[_0x9696('0x154')],{'as':_0x9696('0x1f6'),'foreignKey':_0x9696('0x171')});db[_0x9696('0x12d')][_0x9696('0x11b')](db[_0x9696('0x11f')],{'as':'ReportAgentPreview','foreignKey':_0x9696('0x171')});db[_0x9696('0x12d')][_0x9696('0x12a')](db[_0x9696('0x135')],{'as':_0x9696('0x1f7'),'through':_0x9696('0x15d')});db[_0x9696('0x12d')][_0x9696('0x12a')](db['User'],{'as':_0x9696('0x15e'),'through':_0x9696('0x12f')});db['VoicePrefix'][_0x9696('0x11b')](db[_0x9696('0x19')],{'as':'Extensions','onDelete':_0x9696('0x11a')});db[_0x9696('0xfb')]['belongsToMany'](db[_0x9696('0x13')],{'as':_0x9696('0x15e'),'through':_0x9696('0x137')});db[_0x9696('0xfb')][_0x9696('0x12a')](db[_0x9696('0xe8')],{'through':_0x9696('0x112'),'as':_0x9696('0x15f')});db['UserProfile']['hasMany'](db[_0x9696('0x13')],{'as':'Users','foreignKey':'userProfileId'});db[_0x9696('0x126')]['hasMany'](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0x9696('0x11a')});db[_0x9696('0xfd')][_0x9696('0x11b')](db['UserProfileResource'],{'as':_0x9696('0x1f8'),'foreignKey':_0x9696('0x1f9'),'onDelete':_0x9696('0x11a')});db[_0x9696('0x148')][_0x9696('0x11b')](db[_0x9696('0x186')],{'as':_0x9696('0x16d'),'foreignKey':_0x9696('0x1fa'),'onDelete':'cascade'});db['WhatsappAccount']['hasMany'](db[_0x9696('0x77')],{'as':_0x9696('0x16e'),'foreignKey':_0x9696('0x1fa')});db[_0x9696('0x148')]['hasMany'](db[_0x9696('0x107')],{'as':_0x9696('0x162'),'foreignKey':_0x9696('0x1fa')});db['WhatsappAccount']['hasMany'](db[_0x9696('0x105')],{'as':'Interactions'});db[_0x9696('0x148')][_0x9696('0x11b')](db[_0x9696('0x103')],{'as':'Applications'});db[_0x9696('0x148')][_0x9696('0x125')](db['CmList'],{'as':_0x9696('0x170'),'foreignKey':_0x9696('0x171')});db['WhatsappAccount'][_0x9696('0x125')](db[_0x9696('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x9696('0x15c')});db[_0x9696('0x148')][_0x9696('0x12a')](db[_0x9696('0x13')],{'as':'Agents','through':_0x9696('0x14a')});db[_0x9696('0x103')][_0x9696('0x125')](db[_0x9696('0x13')],{'onDelete':_0x9696('0x16a')});db['WhatsappApplication'][_0x9696('0x125')](db['WhatsappQueue'],{'onDelete':_0x9696('0x16a')});db[_0x9696('0x103')]['belongsTo'](db['WhatsappAccount'],{'onDelete':'restrict'});db[_0x9696('0x103')][_0x9696('0x125')](db[_0x9696('0x7b')],{'onDelete':_0x9696('0x16a'),'foreignKey':_0x9696('0x15b')});db['WhatsappApplication']['belongsTo'](db[_0x9696('0x17d')],{'onDelete':_0x9696('0x16a'),'foreignKey':_0x9696('0x189')});db['WhatsappInteraction'][_0x9696('0x11b')](db['WhatsappMessage'],{'as':_0x9696('0x162'),'onDelete':_0x9696('0x11a'),'foreignKey':_0x9696('0x1fb')});db[_0x9696('0x105')][_0x9696('0x125')](db[_0x9696('0x148')],{'as':_0x9696('0x178'),'foreignKey':_0x9696('0x1fa')});db['WhatsappInteraction'][_0x9696('0x125')](db[_0x9696('0x6e')],{'as':'Contact','foreignKey':_0x9696('0x179')});db['WhatsappInteraction']['belongsTo'](db[_0x9696('0x13')],{'as':'Owner','foreignKey':_0x9696('0x116')});db[_0x9696('0x105')][_0x9696('0x12a')](db['Tag'],{'through':_0x9696('0x1fc'),'as':_0x9696('0x17c')});db['WhatsappInteraction'][_0x9696('0x12a')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x9696('0x18c')});db[_0x9696('0x105')][_0x9696('0x12a')](db[_0x9696('0x13')],{'as':_0x9696('0x17e'),'through':_0x9696('0x1fd'),'foreignKey':'WhatsappInteractionId'});db[_0x9696('0x107')][_0x9696('0x125')](db[_0x9696('0x13')],{'as':_0x9696('0x13')});db[_0x9696('0x107')][_0x9696('0x125')](db[_0x9696('0x6e')],{'onDelete':'cascade','as':'Contact'});db['WhatsappMessage']['belongsTo'](db[_0x9696('0x105')],{'onDelete':_0x9696('0x11a'),'as':'Interaction','foreignKey':_0x9696('0x1fb')});db[_0x9696('0x107')][_0x9696('0x125')](db[_0x9696('0x148')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x9696('0x109')][_0x9696('0x125')](db['WhatsappAccount'],{});db[_0x9696('0x109')][_0x9696('0x125')](db['CmList'],{'as':_0x9696('0x170'),'foreignKey':_0x9696('0x171')});db[_0x9696('0x109')][_0x9696('0x125')](db[_0x9696('0x6e')],{'as':'Contact','foreignKey':_0x9696('0x179')});db[_0x9696('0x109')][_0x9696('0x125')](db[_0x9696('0x105')],{});db[_0x9696('0x109')][_0x9696('0x125')](db[_0x9696('0x10c')],{});db['WhatsappQueueReport'][_0x9696('0x125')](db[_0x9696('0x107')],{});db[_0x9696('0x109')][_0x9696('0x125')](db[_0x9696('0x13')],{});db[_0x9696('0x1fe')][_0x9696('0x125')](db[_0x9696('0x107')],{});db[_0x9696('0x1fe')][_0x9696('0x125')](db[_0x9696('0x105')],{});db[_0x9696('0x1fe')][_0x9696('0x125')](db[_0x9696('0x148')],{'foreignKey':_0x9696('0x1ff'),'as':_0x9696('0x1e2')});db['WhatsappTransferReport']['belongsTo'](db[_0x9696('0x148')],{'foreignKey':_0x9696('0x200'),'as':_0x9696('0x1ea')});db[_0x9696('0x1fe')][_0x9696('0x125')](db[_0x9696('0x10c')],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0x9696('0x1fe')][_0x9696('0x125')](db['User'],{'foreignKey':_0x9696('0x1e3'),'as':_0x9696('0x1e4')});db[_0x9696('0x1fe')][_0x9696('0x125')](db[_0x9696('0x13')],{'foreignKey':_0x9696('0x1e5'),'as':_0x9696('0x1e6')});db[_0x9696('0x10c')][_0x9696('0x12a')](db[_0x9696('0x13')],{'as':'Agents','through':_0x9696('0x39'),'foreignKey':'WhatsappQueueId'});db[_0x9696('0x10c')][_0x9696('0x12a')](db[_0x9696('0xe8')],{'through':_0x9696('0x1dd'),'as':_0x9696('0x15f')});db[_0x9696('0x118')][_0x9696('0x125')](db[_0x9696('0x13')],{'as':_0x9696('0x201'),'foreignKey':_0x9696('0x116'),'onDelete':_0x9696('0x11a'),'hooks':!![]});db[_0x9696('0x10e')]['hasOne'](db[_0x9696('0xc4')],{'as':'Dynamics365Account','onDelete':'restrict'});db[_0x9696('0x10e')][_0x9696('0x117')](db['MailServerIn'],{'as':'Imap','onDelete':_0x9696('0x16a')});db[_0x9696('0x10e')]['hasOne'](db[_0x9696('0x3b')],{'as':_0x9696('0x202'),'onDelete':_0x9696('0x16a')});module[_0x9696('0x203')]={'db':db,'dbH':dbH};
\ No newline at end of file
+var _0x065a=['DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','License','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','hasMany','Recordings','VoiceExtension','Extensions','HopperFinals','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','userProfileId','Groups','belongsToMany','cm_user_has_contacts','Lists','user_has_teams','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueue','MailQueues','UserMailQueue','ChatQueue','FaxQueue','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','OpenchannelAccounts','SmsAccounts','SquareProjects','ChanSpyId','Applications','moh_has_sounds','Members','CmHopper','Hoppers','HopperHistories','VoiceQueueId','HopperBlacks','Trunk','TrunkId','belongsTo','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Answers','List','ListId','TemplateId','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','Tags','Users','user_has_mail_interactions','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','IntervalId','TagId','Dispositions','FaxAccountId','Interactions','FaxApplication','Exntensions','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatProactiveAction','ChatApplication','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatMessage','Attachments','team_has_chat_queues','ChatGroup','chat_group_has_users','Contacts','CmContactHasItem','CmContactId','JscriptySessions','cm_contact_has_tags','CmHopperId','Agent','Queue','Campaign','CampaignId','OwnerId','Condition','OneAll','AutomationAllId','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','ItemTypeId','Hopper','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','AnalyticMetric','MetricId','AccountId','SalesforceConfiguration','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Description','Field','SugarcrmAccount','VariableId','Configurations','int_desk_configuration_has_tags','Subject','ZohoAccount','ZohoField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','ServicenowField','Dynamics365Field','FreshsalesField','FreshsalesAccount','SessionId','JscriptyAnswerReport','ProjectId','user_has_square_projects','WhatsappQueues','TrunkBackup','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToChatQueueId','FaxTransferReport','ToFaxAccountId','OpenchannelTransferReport','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','whatsapp_interaction_has_tags','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','../config/environment','sequelize','lodash','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceField','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model'];(function(_0x359ae8,_0x2a08ef){var _0x3b49a9=function(_0x4f6d45){while(--_0x4f6d45){_0x359ae8['push'](_0x359ae8['shift']());}};_0x3b49a9(++_0x2a08ef);}(_0x065a,0x15a));var _0xa065=function(_0x5422b6,_0x3e930a){_0x5422b6=_0x5422b6-0x0;var _0x16ade7=_0x065a[_0x5422b6];return _0x16ade7;};'use strict';var config=require(_0xa065('0x0'));var Sequelize=require(_0xa065('0x1'));var _=require(_0xa065('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0xa065('0x1')]=_[_0xa065('0x3')](config['sequelize'],{'database':'motion2','username':_0xa065('0x4'),'password':_0xa065('0x5'),'options':{'host':_0xa065('0x6'),'port':0xcea,'dialect':_0xa065('0x7'),'dialectOptions':{'charset':_0xa065('0x8')},'logging':![],'timezone':timezone[_0xa065('0x9')](),'define':{'charset':_0xa065('0xa'),'collate':_0xa065('0xb')}}});config[_0xa065('0xc')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0xa065('0xd'),'username':_0xa065('0x4'),'password':_0xa065('0x5'),'options':{'host':_0xa065('0x6'),'port':0xcea,'dialect':_0xa065('0x7'),'dialectOptions':{'charset':_0xa065('0x8')},'logging':![],'timezone':timezone[_0xa065('0x9')](),'define':{'charset':_0xa065('0xa'),'collate':_0xa065('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xa065('0xe')],config[_0xa065('0x1')][_0xa065('0xf')],config[_0xa065('0x1')][_0xa065('0x10')],config[_0xa065('0x1')][_0xa065('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa065('0xc')]['database'],config[_0xa065('0xc')][_0xa065('0xf')],config[_0xa065('0xc')][_0xa065('0x10')],config[_0xa065('0xc')][_0xa065('0x11')])};db[_0xa065('0x12')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x14'));db[_0xa065('0x15')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x16'));db[_0xa065('0x17')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x18'));db['VoiceExtension']=db[_0xa065('0x1')][_0xa065('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0xa065('0x19')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x1a'));db[_0xa065('0x1b')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/voiceQueue/voiceQueue.model');db[_0xa065('0x1c')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x1d'));db[_0xa065('0x1e')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x1f'));db[_0xa065('0x20')]=db['sequelize'][_0xa065('0x13')]('../api/voiceMail/voiceMail.model');db[_0xa065('0x21')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x22'));db[_0xa065('0x23')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x24'));db['VoiceDialReport']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x25'));db[_0xa065('0x26')]=db[_0xa065('0x1')]['import'](_0xa065('0x27'));db[_0xa065('0x28')]=db['sequelize'][_0xa065('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xa065('0x29')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x2a'));db['Trunk']=db[_0xa065('0x1')]['import'](_0xa065('0x2b'));db['VoiceTransferReport']=db[_0xa065('0x1')][_0xa065('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xa065('0x2c')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xa065('0x2d')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x2e'));db[_0xa065('0x2f')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x30'));db['UserMailQueue']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x31'));db['UserFaxQueue']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x32'));db[_0xa065('0x33')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x34'));db[_0xa065('0x35')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x36'));db[_0xa065('0x37')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x38'));db[_0xa065('0x39')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x3a'));db[_0xa065('0x3b')]=db[_0xa065('0x1')]['import'](_0xa065('0x3c'));db[_0xa065('0x3d')]=db[_0xa065('0x1')]['import'](_0xa065('0x3e'));db['MailQueue']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x3f'));db[_0xa065('0x40')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xa065('0x1')]['import'](_0xa065('0x41'));db[_0xa065('0x42')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/mailMessage/mailMessage.model');db[_0xa065('0x43')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/mailApplication/mailApplication.model');db[_0xa065('0x44')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x45'));db[_0xa065('0x46')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x47'));db[_0xa065('0x48')]=db['sequelize']['import'](_0xa065('0x49'));db[_0xa065('0x4a')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x4b'));db['FaxApplication']=db['sequelize']['import'](_0xa065('0x4c'));db[_0xa065('0x4d')]=db[_0xa065('0x1')]['import']('../api/faxInteraction/faxInteraction.model');db[_0xa065('0x4e')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x4f'));db['FaxQueue']=db[_0xa065('0x1')]['import'](_0xa065('0x50'));db[_0xa065('0x51')]=db['sequelize']['import'](_0xa065('0x52'));db[_0xa065('0x53')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x54'));db[_0xa065('0x55')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x56'));db['SmsInteraction']=db['sequelize'][_0xa065('0x13')](_0xa065('0x57'));db[_0xa065('0x58')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x59'));db[_0xa065('0x5a')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x5b'));db[_0xa065('0x5c')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x5d'));db['OpenchannelApplication']=db[_0xa065('0x1')][_0xa065('0x13')]('../api/openchannelApplication/openchannelApplication.model');db[_0xa065('0x5e')]=db['sequelize']['import'](_0xa065('0x5f'));db[_0xa065('0x60')]=db['sequelize'][_0xa065('0x13')]('../api/openchannelMessage/openchannelMessage.model');db[_0xa065('0x61')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0xa065('0x62')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x63'));db[_0xa065('0x64')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x65'));db['ChatApplication']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x66'));db['ChatInteraction']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x67'));db['ChatMessage']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x68'));db['ChatOfflineMessage']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x69'));db['ChatQueue']=db[_0xa065('0x1')]['import']('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x6a'));db['ChatProactiveAction']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x6b'));db[_0xa065('0x6c')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x6d'));db[_0xa065('0x6e')]=db[_0xa065('0x1')]['import'](_0xa065('0x6f'));db['CmHopper']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x70'));db[_0xa065('0x71')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x72'));db[_0xa065('0x73')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x74'));db[_0xa065('0x75')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x76'));db[_0xa065('0x77')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x78'));db['CmCustomField']=db['sequelize'][_0xa065('0x13')](_0xa065('0x79'));db[_0xa065('0x7a')]=db['sequelize']['import']('../api/action/action.model');db[_0xa065('0x7b')]=db[_0xa065('0x1')]['import'](_0xa065('0x7c'));db[_0xa065('0x7d')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x7e'));db[_0xa065('0x7f')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x80'));db['Condition']=db['sequelize'][_0xa065('0x13')](_0xa065('0x81'));db[_0xa065('0x82')]=db[_0xa065('0x1')]['import'](_0xa065('0x83'));db['Pause']=db['sequelize'][_0xa065('0x13')](_0xa065('0x84'));db[_0xa065('0x85')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x86'));db['VoiceQueuesLog']=db[_0xa065('0x1')][_0xa065('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x87'));db[_0xa065('0x88')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x89'));db[_0xa065('0x8a')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x8b'));db[_0xa065('0x8c')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x8d'));db['CmContactHasItem']=db['sequelize'][_0xa065('0x13')](_0xa065('0x8e'));db[_0xa065('0x8f')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x90'));db[_0xa065('0x91')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x92'));db['Trigger']=db[_0xa065('0x1')]['import'](_0xa065('0x93'));db[_0xa065('0x94')]=db[_0xa065('0x1')]['import'](_0xa065('0x95'));db['Integration']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x96'));db[_0xa065('0x97')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x98'));db['AnalyticCustomReport']=db[_0xa065('0x1')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0xa065('0x99')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x9a'));db[_0xa065('0x9b')]=db['sequelize']['import'](_0xa065('0x9c'));db['AnalyticMetric']=db['sequelize'][_0xa065('0x13')](_0xa065('0x9d'));db['AnalyticFieldReport']=db[_0xa065('0x1')][_0xa065('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xa065('0x9e')]=db[_0xa065('0x1')]['import'](_0xa065('0x9f'));db[_0xa065('0xa0')]=db[_0xa065('0x1')]['import'](_0xa065('0xa1'));db['SalesforceConfiguration']=db[_0xa065('0x1')][_0xa065('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xa065('0xa2')]=db[_0xa065('0x1')]['import']('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0xa065('0x1')][_0xa065('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xa065('0xa3')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xa4'));db[_0xa065('0xa5')]=db[_0xa065('0x1')]['import'](_0xa065('0xa6'));db[_0xa065('0xa7')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xa8'));db[_0xa065('0xa9')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xaa'));db[_0xa065('0xab')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xac'));db['ZohoAccount']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xad'));db[_0xa065('0xae')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xaf'));db['ZohoField']=db[_0xa065('0x1')]['import']('../api/intZohoField/intZohoField.model');db[_0xa065('0xb0')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xb1'));db[_0xa065('0xb2')]=db['sequelize'][_0xa065('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xa065('0xb3')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xb4'));db[_0xa065('0xb5')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xa065('0xb6')]=db['sequelize'][_0xa065('0x13')](_0xa065('0xb7'));db[_0xa065('0xb8')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xa065('0xb9')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xba'));db['VtigerConfiguration']=db[_0xa065('0x1')]['import'](_0xa065('0xbb'));db['VtigerField']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xbc'));db[_0xa065('0xbd')]=db['sequelize'][_0xa065('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xa065('0xbe')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xbf'));db['ServicenowField']=db['sequelize'][_0xa065('0x13')](_0xa065('0xc0'));db[_0xa065('0xc1')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xa065('0xc2')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xc3'));db['Dynamics365Field']=db[_0xa065('0x1')][_0xa065('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xc4'));db[_0xa065('0xc5')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xc6'));db[_0xa065('0xc7')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x96'));db[_0xa065('0xc8')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xc9'));db[_0xa065('0xca')]=db['sequelize'][_0xa065('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0xa065('0xcb')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xcc'));db['JscriptyAnswerReport']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xcd'));db[_0xa065('0xce')]=db['sequelize'][_0xa065('0x13')](_0xa065('0xcf'));db[_0xa065('0xd0')]=db[_0xa065('0x1')]['import'](_0xa065('0xd1'));db[_0xa065('0xd2')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/smsQueueReport/smsQueueReport.model');db[_0xa065('0xd3')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xd4'));db[_0xa065('0xd5')]=db[_0xa065('0x1')]['import']('../api/squareReportDetail/squareReportDetail.model');db[_0xa065('0xd6')]=db[_0xa065('0x1')]['import'](_0xa065('0xd7'));db['Setting']=db[_0xa065('0x1')]['import'](_0xa065('0xd8'));db[_0xa065('0xd9')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xda'));db[_0xa065('0xdb')]=db[_0xa065('0x1')]['import'](_0xa065('0xdc'));db[_0xa065('0xdd')]=db['sequelize'][_0xa065('0x13')](_0xa065('0xde'));db[_0xa065('0xdf')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/squareMessage/squareMessage.model');db[_0xa065('0xe0')]=db[_0xa065('0x1')]['import']('../api/team/team.model');db[_0xa065('0xe1')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/license/license.model');db['Campaign']=db['sequelize'][_0xa065('0x13')]('../api/campaign/campaign.model');db[_0xa065('0xe2')]=db['sequelize']['import'](_0xa065('0xe3'));db[_0xa065('0xe4')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/attachment/attachment.model');db[_0xa065('0xe5')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xe6'));db[_0xa065('0xe7')]=db['sequelize'][_0xa065('0x13')](_0xa065('0xe8'));db[_0xa065('0xe9')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xea'));db['FaxTransferReport']=db[_0xa065('0x1')][_0xa065('0x13')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xeb'));db[_0xa065('0xec')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0xa065('0xed')]=db['sequelize'][_0xa065('0x13')]('../api/cmList/cmList.model');db[_0xa065('0xee')]=db['sequelize'][_0xa065('0x13')](_0xa065('0xef'));db[_0xa065('0xf0')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xf1'));db[_0xa065('0xf2')]=db['sequelize'][_0xa065('0x13')](_0xa065('0xf3'));db[_0xa065('0xf4')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/userProfileResource/userProfileResource.model');db[_0xa065('0xf5')]=db[_0xa065('0x1')]['import'](_0xa065('0xf6'));db[_0xa065('0xf7')]=db[_0xa065('0x1')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0xa065('0xf8')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xf9'));db[_0xa065('0xfa')]=db[_0xa065('0x1')]['import'](_0xa065('0xfb'));db[_0xa065('0xfc')]=db[_0xa065('0x1')]['import'](_0xa065('0xfd'));db['WhatsappQueueReport']=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0xfe'));db[_0xa065('0xff')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x100'));db[_0xa065('0x101')]=db['sequelize'][_0xa065('0x13')](_0xa065('0x102'));db[_0xa065('0x103')]=db[_0xa065('0x1')][_0xa065('0x13')]('../api/cloudProvider/cloudProvider.model');db[_0xa065('0x104')]=db['sequelize']['import'](_0xa065('0x105'));db[_0xa065('0x106')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x107'));db[_0xa065('0x108')]=db['sequelize'][_0xa065('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0xa065('0x109')]=db[_0xa065('0x1')][_0xa065('0x13')](_0xa065('0x10a'));db[_0xa065('0x12')][_0xa065('0x10b')](db[_0xa065('0x20')],{'as':_0xa065('0x20'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x10d')});db[_0xa065('0x12')][_0xa065('0x10b')](db[_0xa065('0x109')],{'as':_0xa065('0x10e'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x10d')});db[_0xa065('0x12')][_0xa065('0x10f')](db['VoiceRecording'],{'as':_0xa065('0x110'),'foreignKey':'UserId'});db[_0xa065('0x12')][_0xa065('0x10f')](db[_0xa065('0x2c')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0xa065('0x12')][_0xa065('0x10f')](db[_0xa065('0x111')],{'as':_0xa065('0x112'),'onDelete':_0xa065('0x10c'),'hooks':!![]});db['User'][_0xa065('0x10f')](db['CmHopperFinal'],{'as':_0xa065('0x113'),'foreignKey':_0xa065('0x10d')});db[_0xa065('0x12')]['hasMany'](db[_0xa065('0x75')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0xa065('0x12')][_0xa065('0x10f')](db[_0xa065('0x77')],{'as':_0xa065('0x77'),'foreignKey':'UserId'});db['User'][_0xa065('0x10f')](db[_0xa065('0x5e')],{'as':_0xa065('0x114'),'foreignKey':_0xa065('0x10d')});db['User'][_0xa065('0x10f')](db[_0xa065('0x115')],{'as':_0xa065('0x116'),'foreignKey':_0xa065('0x10d')});db[_0xa065('0x12')][_0xa065('0x10f')](db[_0xa065('0x117')],{'as':_0xa065('0x118'),'foreignKey':_0xa065('0x10d')});db[_0xa065('0x12')][_0xa065('0x10f')](db[_0xa065('0x4d')],{'as':_0xa065('0x119'),'foreignKey':_0xa065('0x10d')});db['User'][_0xa065('0x10f')](db[_0xa065('0x11a')],{'as':_0xa065('0x11b'),'foreignKey':_0xa065('0x10d')});db['User'][_0xa065('0x10f')](db[_0xa065('0xfa')],{'as':_0xa065('0x11c'),'foreignKey':_0xa065('0x10d')});db[_0xa065('0x12')]['hasMany'](db['UserNotification'],{'as':_0xa065('0x11d'),'foreignKey':_0xa065('0x11e')});db[_0xa065('0x12')]['belongsTo'](db['UserProfile'],{'as':_0xa065('0xf0'),'foreignKey':_0xa065('0x11f')});db['User']['belongsToMany'](db['ChatGroup'],{'as':_0xa065('0x120'),'through':'chat_group_has_users'});db[_0xa065('0x12')][_0xa065('0x121')](db[_0xa065('0x6e')],{'as':'Contacts','through':_0xa065('0x122')});db['User'][_0xa065('0x121')](db['CmList'],{'as':_0xa065('0x123'),'through':'cm_user_has_lists'});db[_0xa065('0x12')][_0xa065('0x121')](db[_0xa065('0xe0')],{'through':_0xa065('0x124')});db[_0xa065('0x12')][_0xa065('0x121')](db[_0xa065('0x11a')],{'as':_0xa065('0x11b'),'through':'user_has_mail_interactions'});db[_0xa065('0x12')][_0xa065('0x121')](db[_0xa065('0x115')],{'as':_0xa065('0x116'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0xa065('0x4d')],{'as':_0xa065('0x119'),'through':_0xa065('0x125')});db[_0xa065('0x12')][_0xa065('0x121')](db[_0xa065('0x117')],{'as':_0xa065('0x118'),'through':_0xa065('0x126')});db[_0xa065('0x12')][_0xa065('0x121')](db[_0xa065('0x5e')],{'as':_0xa065('0x114'),'through':'user_has_openchannel_interactions'});db['User'][_0xa065('0x121')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0xa065('0x127')});db['User'][_0xa065('0x121')](db[_0xa065('0x1b')],{'as':_0xa065('0x128'),'through':_0xa065('0x2d'),'required':![]});db['User'][_0xa065('0x121')](db[_0xa065('0xee')],{'as':_0xa065('0x129'),'through':_0xa065('0x108'),'required':![]});db[_0xa065('0x12')][_0xa065('0x121')](db[_0xa065('0x12a')],{'as':_0xa065('0x12b'),'through':_0xa065('0x12c'),'required':![]});db['User'][_0xa065('0x121')](db[_0xa065('0x12d')],{'as':'ChatQueues','through':_0xa065('0x2f'),'required':![],'hooks':!![]});db[_0xa065('0x12')][_0xa065('0x121')](db[_0xa065('0x12e')],{'as':_0xa065('0x12f'),'through':_0xa065('0x130'),'required':![]});db[_0xa065('0x12')][_0xa065('0x121')](db['SmsQueue'],{'as':_0xa065('0x131'),'through':_0xa065('0x33'),'required':![]});db[_0xa065('0x12')][_0xa065('0x121')](db[_0xa065('0x61')],{'as':_0xa065('0x132'),'through':_0xa065('0x35'),'required':![]});db[_0xa065('0x12')]['belongsToMany'](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0xa065('0x37'),'required':![]});db[_0xa065('0x12')]['belongsToMany'](db['CmList'],{'through':_0xa065('0x133')});db['User']['belongsToMany'](db['ChatWebsite'],{'as':_0xa065('0x134'),'through':_0xa065('0x135')});db[_0xa065('0x12')][_0xa065('0x121')](db[_0xa065('0x4a')],{'as':_0xa065('0x136'),'through':'user_has_fax_accounts'});db[_0xa065('0x12')]['belongsToMany'](db['MailAccount'],{'as':_0xa065('0x137'),'through':'user_has_mail_accounts'});db['User'][_0xa065('0x121')](db[_0xa065('0x5c')],{'as':_0xa065('0x138'),'through':'user_has_openchannel_accounts'});db['User'][_0xa065('0x121')](db[_0xa065('0x53')],{'as':_0xa065('0x139'),'through':'user_has_sms_accounts'});db[_0xa065('0x12')][_0xa065('0x121')](db[_0xa065('0xf7')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0xa065('0x12')][_0xa065('0x121')](db['SquareProject'],{'as':_0xa065('0x13a'),'through':'user_has_square_projects'});db[_0xa065('0x15')][_0xa065('0x10f')](db[_0xa065('0x111')],{'as':'SpiedAgents','onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x13b')});db[_0xa065('0x17')][_0xa065('0x10f')](db[_0xa065('0x111')],{'onDelete':'cascade'});db[_0xa065('0x111')][_0xa065('0x10f')](db[_0xa065('0x111')],{'as':_0xa065('0x13c'),'onDelete':_0xa065('0x10c')});db[_0xa065('0x19')]['belongsToMany'](db[_0xa065('0x88')],{'as':'Sounds','through':_0xa065('0x13d')});db['VoiceQueue']['hasMany'](db[_0xa065('0x2c')],{'as':_0xa065('0x13e'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0xa065('0x13f')],{'as':_0xa065('0x140'),'foreignKey':'VoiceQueueId'});db[_0xa065('0x1b')][_0xa065('0x10f')](db[_0xa065('0x73')],{'as':_0xa065('0x113'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xa065('0x10f')](db[_0xa065('0x75')],{'as':_0xa065('0x141'),'foreignKey':_0xa065('0x142')});db[_0xa065('0x1b')]['hasMany'](db[_0xa065('0x77')],{'as':_0xa065('0x77'),'foreignKey':_0xa065('0x142')});db[_0xa065('0x1b')]['hasMany'](db[_0xa065('0x71')],{'as':_0xa065('0x143'),'foreignKey':_0xa065('0x142')});db[_0xa065('0x1b')][_0xa065('0x10f')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0xa065('0x142')});db[_0xa065('0x1b')]['belongsTo'](db[_0xa065('0x144')],{'as':_0xa065('0x144'),'foreignKey':_0xa065('0x145')});db[_0xa065('0x1b')][_0xa065('0x146')](db[_0xa065('0x144')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0xa065('0x1b')][_0xa065('0x146')](db[_0xa065('0x82')],{'as':_0xa065('0x82'),'foreignKey':'IntervalId'});db[_0xa065('0x1b')][_0xa065('0x146')](db[_0xa065('0x147')],{'as':_0xa065('0x148'),'foreignKey':_0xa065('0x149')});db['VoiceQueue']['belongsToMany'](db[_0xa065('0xed')],{'as':_0xa065('0x123'),'through':_0xa065('0x14a')});db[_0xa065('0x1b')][_0xa065('0x121')](db[_0xa065('0x12')],{'as':_0xa065('0x14b'),'through':_0xa065('0x2d')});db['VoiceQueue']['belongsToMany'](db[_0xa065('0xe0')],{'as':_0xa065('0x14c'),'through':_0xa065('0x104')});db[_0xa065('0x1b')][_0xa065('0x121')](db[_0xa065('0xed')],{'as':_0xa065('0x14d'),'through':_0xa065('0x14e')});db[_0xa065('0x1c')]['belongsTo'](db['User'],{'as':_0xa065('0x12'),'foreignKey':_0xa065('0x10d')});db[_0xa065('0x1e')][_0xa065('0x146')](db[_0xa065('0x12')],{'as':_0xa065('0x12'),'foreignKey':_0xa065('0x10d')});db['VoiceMail']['hasMany'](db[_0xa065('0x21')],{'as':_0xa065('0x14f'),'onDelete':_0xa065('0x10c'),'foreignKey':'mailboxuser','sourceKey':_0xa065('0x150')});db[_0xa065('0x21')][_0xa065('0x146')](db[_0xa065('0x20')],{'foreignKey':_0xa065('0x151'),'targetKey':_0xa065('0x150')});db[_0xa065('0x23')][_0xa065('0x10f')](db['VoiceQueueReport'],{'as':_0xa065('0x152'),'foreignKey':_0xa065('0x153'),'constraints':![]});db[_0xa065('0x23')][_0xa065('0x10f')](db[_0xa065('0x26')],{'as':_0xa065('0x154'),'foreignKey':_0xa065('0x153'),'constraints':![]});db[_0xa065('0x23')][_0xa065('0x146')](db[_0xa065('0x12')],{'as':_0xa065('0x12'),'foreignKey':'UserId'});db['VoiceCallReport'][_0xa065('0x146')](db[_0xa065('0x6e')],{'as':'Contact','foreignKey':_0xa065('0x155')});db['MailServerIn'][_0xa065('0x146')](db[_0xa065('0x3d')],{'as':_0xa065('0x3d'),'foreignKey':_0xa065('0x156')});db['MailServerIn'][_0xa065('0x146')](db[_0xa065('0x103')],{'as':_0xa065('0x103'),'foreignKey':_0xa065('0x157'),'onDelete':_0xa065('0x158')});db[_0xa065('0x3b')]['belongsTo'](db[_0xa065('0x3d')],{'as':_0xa065('0x3d'),'foreignKey':_0xa065('0x156')});db[_0xa065('0x3b')][_0xa065('0x146')](db[_0xa065('0x103')],{'as':_0xa065('0x103'),'foreignKey':_0xa065('0x157'),'onDelete':_0xa065('0x158')});db[_0xa065('0x3d')][_0xa065('0x10b')](db[_0xa065('0x39')],{'as':_0xa065('0x159'),'onDelete':_0xa065('0x10c')});db[_0xa065('0x3d')][_0xa065('0x10b')](db[_0xa065('0x3b')],{'as':_0xa065('0x15a'),'onDelete':_0xa065('0x10c')});db[_0xa065('0x3d')][_0xa065('0x10f')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xa065('0x156'),'onDelete':'cascade'});db[_0xa065('0x3d')][_0xa065('0x10f')](db[_0xa065('0x7d')],{'as':_0xa065('0x15b'),'foreignKey':_0xa065('0x156')});db[_0xa065('0x3d')][_0xa065('0x10f')](db[_0xa065('0x42')],{'as':_0xa065('0x14f'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xa065('0x10f')](db['MailInteraction'],{'as':'Interactions'});db[_0xa065('0x3d')][_0xa065('0x10f')](db['MailApplication'],{'as':_0xa065('0x13c')});db[_0xa065('0x3d')][_0xa065('0x146')](db[_0xa065('0xed')],{'as':_0xa065('0x15c'),'foreignKey':_0xa065('0x15d')});db['MailAccount']['belongsTo'](db['Template'],{'as':'Template','foreignKey':_0xa065('0x15e')});db['MailAccount'][_0xa065('0x146')](db[_0xa065('0x147')],{'as':_0xa065('0x148'),'foreignKey':_0xa065('0x149')});db['MailAccount'][_0xa065('0x121')](db[_0xa065('0x12')],{'as':_0xa065('0x14b'),'through':_0xa065('0x15f')});db[_0xa065('0x12a')]['belongsToMany'](db['User'],{'as':_0xa065('0x14b'),'through':_0xa065('0x12c')});db['MailQueue'][_0xa065('0x121')](db[_0xa065('0xe0')],{'through':_0xa065('0x160'),'as':_0xa065('0x14c')});db[_0xa065('0x11a')]['hasMany'](db[_0xa065('0x42')],{'as':_0xa065('0x14f'),'onDelete':'cascade','foreignKey':_0xa065('0x161')});db['MailInteraction'][_0xa065('0x146')](db[_0xa065('0x3d')],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x156')});db[_0xa065('0x11a')]['belongsTo'](db[_0xa065('0x6e')],{'as':_0xa065('0x163'),'foreignKey':_0xa065('0x155')});db[_0xa065('0x11a')][_0xa065('0x146')](db[_0xa065('0x12')],{'as':_0xa065('0x164'),'foreignKey':_0xa065('0x10d')});db[_0xa065('0x11a')]['belongsToMany'](db[_0xa065('0x8a')],{'through':_0xa065('0x165'),'as':_0xa065('0x166')});db['MailInteraction']['belongsToMany'](db[_0xa065('0x8a')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db['MailInteraction'][_0xa065('0x121')](db[_0xa065('0x12')],{'as':_0xa065('0x167'),'through':_0xa065('0x168'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0xa065('0x10f')](db[_0xa065('0xe4')],{'as':'Attachments','onDelete':_0xa065('0x10c')});db[_0xa065('0x42')][_0xa065('0x146')](db[_0xa065('0x12')],{'as':_0xa065('0x12')});db[_0xa065('0x42')]['belongsTo'](db[_0xa065('0x6e')],{'onDelete':_0xa065('0x10c'),'as':_0xa065('0x163')});db[_0xa065('0x42')][_0xa065('0x146')](db[_0xa065('0x11a')],{'as':_0xa065('0x169'),'foreignKey':_0xa065('0x161')});db[_0xa065('0x42')][_0xa065('0x146')](db['MailAccount'],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x156')});db['MailMessage']['belongsTo'](db[_0xa065('0x62')],{'as':_0xa065('0x62'),'foreignKey':_0xa065('0x16a')});db[_0xa065('0x42')][_0xa065('0x146')](db[_0xa065('0x16b')],{'as':_0xa065('0x16b'),'foreignKey':_0xa065('0x16c')});db[_0xa065('0x43')][_0xa065('0x146')](db[_0xa065('0x12')],{'onDelete':_0xa065('0x158')});db[_0xa065('0x43')][_0xa065('0x146')](db[_0xa065('0x12a')],{'onDelete':_0xa065('0x158')});db[_0xa065('0x43')]['belongsTo'](db[_0xa065('0x3d')],{'onDelete':_0xa065('0x158')});db[_0xa065('0x43')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0xa065('0x16d')});db[_0xa065('0x43')]['belongsTo'](db[_0xa065('0x8a')],{'onDelete':'restrict','foreignKey':_0xa065('0x16e')});db[_0xa065('0x44')]['belongsTo'](db[_0xa065('0x3d')],{});db[_0xa065('0x44')][_0xa065('0x146')](db[_0xa065('0xed')],{'as':_0xa065('0x15c'),'foreignKey':_0xa065('0x15d')});db['MailQueueReport'][_0xa065('0x146')](db['CmContact'],{'as':'Contact','foreignKey':_0xa065('0x155')});db[_0xa065('0x44')][_0xa065('0x146')](db['MailInteraction'],{});db[_0xa065('0x44')][_0xa065('0x146')](db[_0xa065('0x42')],{});db[_0xa065('0x44')][_0xa065('0x146')](db[_0xa065('0x12')],{});db[_0xa065('0x44')][_0xa065('0x146')](db[_0xa065('0x12a')],{});db[_0xa065('0x46')][_0xa065('0x10f')](db[_0xa065('0x48')],{'as':'Items','onDelete':'cascade'});db[_0xa065('0x4a')][_0xa065('0x10f')](db[_0xa065('0x7f')],{'as':_0xa065('0x16f'),'foreignKey':_0xa065('0x170'),'onDelete':'cascade'});db['FaxAccount'][_0xa065('0x10f')](db[_0xa065('0x7d')],{'as':_0xa065('0x15b'),'foreignKey':_0xa065('0x170')});db[_0xa065('0x4a')][_0xa065('0x10f')](db[_0xa065('0x4d')],{'as':_0xa065('0x171')});db['FaxAccount'][_0xa065('0x10f')](db[_0xa065('0x172')],{'as':_0xa065('0x13c')});db[_0xa065('0x4a')][_0xa065('0x10f')](db['VoiceExtension'],{'as':_0xa065('0x173'),'onDelete':'cascade'});db['FaxAccount'][_0xa065('0x10f')](db[_0xa065('0x4e')],{'as':_0xa065('0x14f')});db[_0xa065('0x4a')]['belongsTo'](db['Trunk'],{'as':_0xa065('0x144')});db[_0xa065('0x4a')][_0xa065('0x146')](db['CmList'],{'as':_0xa065('0x15c'),'foreignKey':'ListId'});db[_0xa065('0x4a')][_0xa065('0x146')](db[_0xa065('0x147')],{'as':_0xa065('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xa065('0x4a')]['belongsToMany'](db['User'],{'as':_0xa065('0x14b'),'through':'user_has_fax_accounts'});db[_0xa065('0x172')][_0xa065('0x146')](db['User'],{'onDelete':_0xa065('0x158')});db['FaxApplication'][_0xa065('0x146')](db[_0xa065('0x12e')],{'onDelete':_0xa065('0x158')});db['FaxApplication']['belongsTo'](db[_0xa065('0x4a')],{'onDelete':_0xa065('0x158')});db[_0xa065('0x172')]['belongsTo'](db[_0xa065('0x8a')],{'onDelete':_0xa065('0x158'),'foreignKey':_0xa065('0x16e')});db[_0xa065('0x4d')][_0xa065('0x10f')](db['FaxMessage'],{'as':'Messages','onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x174')});db[_0xa065('0x4d')][_0xa065('0x146')](db[_0xa065('0x4a')],{'as':_0xa065('0x162'),'foreignKey':'FaxAccountId'});db[_0xa065('0x4d')][_0xa065('0x146')](db[_0xa065('0x6e')],{'as':_0xa065('0x163'),'foreignKey':_0xa065('0x155')});db['FaxInteraction'][_0xa065('0x146')](db[_0xa065('0x12')],{'as':_0xa065('0x164'),'foreignKey':_0xa065('0x10d')});db[_0xa065('0x4d')]['belongsToMany'](db[_0xa065('0x8a')],{'through':_0xa065('0x175'),'as':'Tags'});db['FaxInteraction'][_0xa065('0x121')](db[_0xa065('0x8a')],{'through':'fax_interaction_has_tags','as':_0xa065('0x176')});db[_0xa065('0x4d')][_0xa065('0x121')](db[_0xa065('0x12')],{'as':_0xa065('0x167'),'through':_0xa065('0x125'),'foreignKey':_0xa065('0x174')});db[_0xa065('0x4e')][_0xa065('0x146')](db[_0xa065('0x12')],{'onDelete':'cascade','as':_0xa065('0x12')});db[_0xa065('0x4e')][_0xa065('0x146')](db[_0xa065('0x4d')],{'as':_0xa065('0x169'),'foreignKey':_0xa065('0x174')});db[_0xa065('0x4e')][_0xa065('0x146')](db[_0xa065('0x6e')],{'onDelete':_0xa065('0x10c'),'as':_0xa065('0x163')});db[_0xa065('0x4e')]['belongsTo'](db[_0xa065('0xe4')],{'as':_0xa065('0xe4'),'foreignKey':_0xa065('0x177')});db[_0xa065('0x4e')][_0xa065('0x146')](db[_0xa065('0x4a')],{'as':'Account','foreignKey':_0xa065('0x170')});db[_0xa065('0x12e')]['belongsToMany'](db[_0xa065('0x12')],{'as':_0xa065('0x14b'),'through':_0xa065('0x130')});db[_0xa065('0x12e')][_0xa065('0x121')](db[_0xa065('0xe0')],{'through':_0xa065('0x178'),'as':'Teams'});db[_0xa065('0x51')][_0xa065('0x146')](db[_0xa065('0x4a')],{});db[_0xa065('0x51')][_0xa065('0x146')](db['CmList'],{'as':'List','foreignKey':_0xa065('0x15d')});db[_0xa065('0x51')][_0xa065('0x146')](db[_0xa065('0x6e')],{'as':'Contact','foreignKey':_0xa065('0x155')});db[_0xa065('0x51')][_0xa065('0x146')](db[_0xa065('0x4d')],{});db[_0xa065('0x51')][_0xa065('0x146')](db[_0xa065('0x4e')],{});db[_0xa065('0x51')]['belongsTo'](db[_0xa065('0x12')],{});db['FaxQueueReport'][_0xa065('0x146')](db[_0xa065('0x12e')],{});db[_0xa065('0x53')][_0xa065('0x10f')](db[_0xa065('0x7f')],{'as':_0xa065('0x16f'),'foreignKey':_0xa065('0x179'),'onDelete':_0xa065('0x10c')});db[_0xa065('0x53')][_0xa065('0x10f')](db[_0xa065('0x7d')],{'as':_0xa065('0x15b'),'foreignKey':_0xa065('0x179')});db['SmsAccount'][_0xa065('0x10f')](db[_0xa065('0x58')],{'as':_0xa065('0x14f'),'foreignKey':'SmsAccountId'});db[_0xa065('0x53')][_0xa065('0x10f')](db[_0xa065('0x117')],{'as':_0xa065('0x171')});db['SmsAccount'][_0xa065('0x10f')](db[_0xa065('0x55')],{'as':_0xa065('0x13c')});db['SmsAccount'][_0xa065('0x146')](db[_0xa065('0xed')],{'as':_0xa065('0x15c'),'foreignKey':_0xa065('0x15d')});db[_0xa065('0x53')]['belongsTo'](db[_0xa065('0x147')],{'as':_0xa065('0x148'),'foreignKey':_0xa065('0x149')});db['SmsAccount'][_0xa065('0x121')](db['User'],{'as':_0xa065('0x14b'),'through':'user_has_sms_accounts'});db[_0xa065('0x55')][_0xa065('0x146')](db[_0xa065('0x12')],{'onDelete':_0xa065('0x158')});db[_0xa065('0x55')][_0xa065('0x146')](db[_0xa065('0x5a')],{'onDelete':_0xa065('0x158')});db[_0xa065('0x55')][_0xa065('0x146')](db['SmsAccount'],{'onDelete':_0xa065('0x158')});db['SmsApplication'][_0xa065('0x146')](db[_0xa065('0x82')],{'onDelete':_0xa065('0x158'),'foreignKey':_0xa065('0x16d')});db[_0xa065('0x55')][_0xa065('0x146')](db['Tag'],{'onDelete':_0xa065('0x158'),'foreignKey':_0xa065('0x16e')});db['SmsInteraction'][_0xa065('0x10f')](db[_0xa065('0x58')],{'as':_0xa065('0x14f'),'onDelete':_0xa065('0x10c'),'foreignKey':'SmsInteractionId'});db[_0xa065('0x117')]['belongsTo'](db[_0xa065('0x53')],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x179')});db['SmsInteraction'][_0xa065('0x146')](db[_0xa065('0x6e')],{'as':_0xa065('0x163'),'foreignKey':_0xa065('0x155')});db[_0xa065('0x117')][_0xa065('0x146')](db[_0xa065('0x12')],{'as':_0xa065('0x164'),'foreignKey':'UserId'});db[_0xa065('0x117')][_0xa065('0x121')](db[_0xa065('0x8a')],{'through':_0xa065('0x17a'),'as':_0xa065('0x166')});db[_0xa065('0x117')][_0xa065('0x121')](db[_0xa065('0x8a')],{'through':_0xa065('0x17a'),'as':_0xa065('0x176')});db['SmsInteraction'][_0xa065('0x121')](db[_0xa065('0x12')],{'as':_0xa065('0x167'),'through':_0xa065('0x126'),'foreignKey':_0xa065('0x17b')});db['SmsMessage']['belongsTo'](db[_0xa065('0x12')],{'as':_0xa065('0x12')});db[_0xa065('0x58')][_0xa065('0x146')](db[_0xa065('0x6e')],{'onDelete':_0xa065('0x10c'),'as':'Contact'});db['SmsMessage'][_0xa065('0x146')](db[_0xa065('0x117')],{'onDelete':_0xa065('0x10c'),'as':'Interaction','foreignKey':_0xa065('0x17b')});db['SmsMessage'][_0xa065('0x146')](db['SmsAccount'],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x179')});db[_0xa065('0x5a')][_0xa065('0x121')](db[_0xa065('0x12')],{'as':_0xa065('0x14b'),'through':'UserSmsQueue','foreignKey':_0xa065('0x17c')});db[_0xa065('0x5a')]['belongsToMany'](db['Team'],{'through':_0xa065('0x17d'),'as':'Teams'});db[_0xa065('0x5c')][_0xa065('0x10f')](db[_0xa065('0x7f')],{'as':_0xa065('0x16f'),'foreignKey':_0xa065('0x17e'),'onDelete':_0xa065('0x10c')});db[_0xa065('0x5c')][_0xa065('0x10f')](db[_0xa065('0x7d')],{'as':_0xa065('0x15b'),'foreignKey':_0xa065('0x17e')});db[_0xa065('0x5c')][_0xa065('0x10f')](db['OpenchannelInteraction'],{'as':_0xa065('0x171'),'foreignKey':_0xa065('0x17e')});db[_0xa065('0x5c')][_0xa065('0x10f')](db[_0xa065('0x60')],{'as':_0xa065('0x14f'),'foreignKey':'OpenchannelAccountId'});db[_0xa065('0x5c')][_0xa065('0x10f')](db[_0xa065('0x17f')],{'as':_0xa065('0x13c'),'foreignKey':_0xa065('0x17e')});db[_0xa065('0x5c')][_0xa065('0x146')](db[_0xa065('0xed')],{'as':_0xa065('0x15c'),'foreignKey':_0xa065('0x15d')});db[_0xa065('0x5c')][_0xa065('0x146')](db[_0xa065('0x147')],{'as':_0xa065('0x148'),'foreignKey':_0xa065('0x149')});db['OpenchannelAccount'][_0xa065('0x121')](db[_0xa065('0x12')],{'as':_0xa065('0x14b'),'through':_0xa065('0x180')});db[_0xa065('0x17f')][_0xa065('0x146')](db[_0xa065('0x12')],{'onDelete':_0xa065('0x158')});db[_0xa065('0x17f')][_0xa065('0x146')](db['OpenchannelQueue'],{'onDelete':_0xa065('0x158'),'foreignKey':_0xa065('0x181')});db['OpenchannelApplication'][_0xa065('0x146')](db[_0xa065('0x5c')],{'onDelete':'restrict','foreignKey':_0xa065('0x17e')});db[_0xa065('0x17f')][_0xa065('0x146')](db[_0xa065('0x82')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xa065('0x17f')][_0xa065('0x146')](db[_0xa065('0x8a')],{'onDelete':'restrict','foreignKey':_0xa065('0x16e')});db[_0xa065('0x5e')]['hasMany'](db['OpenchannelMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xa065('0x182')});db[_0xa065('0x5e')][_0xa065('0x146')](db[_0xa065('0x5c')],{'as':_0xa065('0x162'),'foreignKey':'OpenchannelAccountId'});db[_0xa065('0x5e')][_0xa065('0x146')](db['CmContact'],{'as':'Contact','foreignKey':_0xa065('0x155')});db['OpenchannelInteraction'][_0xa065('0x146')](db[_0xa065('0x12')],{'as':_0xa065('0x164'),'foreignKey':_0xa065('0x10d')});db[_0xa065('0x5e')][_0xa065('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':'Tags'});db[_0xa065('0x5e')][_0xa065('0x121')](db[_0xa065('0x8a')],{'through':_0xa065('0x183'),'as':_0xa065('0x176')});db['OpenchannelInteraction'][_0xa065('0x121')](db[_0xa065('0x12')],{'as':_0xa065('0x167'),'through':_0xa065('0x184'),'foreignKey':_0xa065('0x182')});db[_0xa065('0x60')][_0xa065('0x146')](db['User'],{'onDelete':_0xa065('0x10c'),'as':_0xa065('0x12')});db[_0xa065('0x60')][_0xa065('0x146')](db[_0xa065('0x6e')],{'onDelete':_0xa065('0x10c'),'as':_0xa065('0x163')});db['OpenchannelMessage'][_0xa065('0x146')](db['OpenchannelInteraction'],{'onDelete':_0xa065('0x10c'),'as':_0xa065('0x169'),'foreignKey':'OpenchannelInteractionId'});db[_0xa065('0x60')][_0xa065('0x146')](db['Attachment'],{'as':_0xa065('0xe4'),'foreignKey':_0xa065('0x177')});db[_0xa065('0x60')][_0xa065('0x146')](db['OpenchannelAccount'],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x17e')});db[_0xa065('0x61')][_0xa065('0x121')](db[_0xa065('0x12')],{'as':_0xa065('0x14b'),'through':_0xa065('0x35'),'foreignKey':_0xa065('0x181')});db[_0xa065('0x61')][_0xa065('0x121')](db[_0xa065('0xe0')],{'through':_0xa065('0x185'),'as':_0xa065('0x14c')});db[_0xa065('0x62')][_0xa065('0x10f')](db[_0xa065('0x7f')],{'as':_0xa065('0x16f'),'foreignKey':_0xa065('0x16a'),'onDelete':_0xa065('0x10c')});db['ChatWebsite'][_0xa065('0x10f')](db[_0xa065('0x7d')],{'as':_0xa065('0x15b'),'foreignKey':_0xa065('0x16a')});db[_0xa065('0x62')][_0xa065('0x10f')](db[_0xa065('0x186')],{'as':'ProactiveActions'});db[_0xa065('0x62')][_0xa065('0x10f')](db[_0xa065('0x115')],{'as':_0xa065('0x171')});db[_0xa065('0x62')][_0xa065('0x10f')](db['ChatApplication'],{'as':_0xa065('0x13c')});db[_0xa065('0x62')]['hasMany'](db['ChatMessage'],{'as':'Messages'});db['ChatWebsite']['belongsTo'](db[_0xa065('0xed')],{'as':_0xa065('0x15c'),'foreignKey':'ListId'});db[_0xa065('0x62')][_0xa065('0x146')](db['Interval'],{'as':'Interval','foreignKey':_0xa065('0x16d')});db[_0xa065('0x62')][_0xa065('0x146')](db[_0xa065('0x3d')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xa065('0x62')][_0xa065('0x146')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xa065('0x149')});db['ChatWebsite'][_0xa065('0x121')](db['User'],{'as':_0xa065('0x14b'),'through':'user_has_chat_websites'});db[_0xa065('0x64')][_0xa065('0x146')](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0xa065('0x146')](db[_0xa065('0xed')],{'as':'List','foreignKey':_0xa065('0x15d')});db['OpenchannelQueueReport'][_0xa065('0x146')](db[_0xa065('0x6e')],{'as':'Contact','foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0xa065('0x146')](db[_0xa065('0x5e')],{});db['OpenchannelQueueReport'][_0xa065('0x146')](db[_0xa065('0x60')],{});db[_0xa065('0x64')][_0xa065('0x146')](db[_0xa065('0x12')],{});db[_0xa065('0x64')][_0xa065('0x146')](db[_0xa065('0x61')],{});db[_0xa065('0x187')]['belongsTo'](db[_0xa065('0x12')],{'as':'Agent','foreignKey':_0xa065('0x10d'),'onDelete':'restrict'});db[_0xa065('0x187')][_0xa065('0x146')](db[_0xa065('0x12d')],{'as':'Queue','foreignKey':_0xa065('0x188'),'onDelete':_0xa065('0x158')});db[_0xa065('0x187')]['belongsTo'](db[_0xa065('0x62')],{'as':_0xa065('0x189'),'foreignKey':'ChatWebsiteId','onDelete':_0xa065('0x158')});db[_0xa065('0x187')][_0xa065('0x146')](db[_0xa065('0x8a')],{'onDelete':_0xa065('0x158'),'foreignKey':'TagId'});db['ChatInteraction'][_0xa065('0x10f')](db['ChatMessage'],{'as':_0xa065('0x14f'),'onDelete':'cascade','foreignKey':_0xa065('0x18a')});db[_0xa065('0x115')][_0xa065('0x146')](db[_0xa065('0x62')],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x16a')});db['ChatInteraction'][_0xa065('0x146')](db[_0xa065('0x6e')],{'as':_0xa065('0x163'),'foreignKey':_0xa065('0x155')});db[_0xa065('0x115')][_0xa065('0x146')](db[_0xa065('0x12')],{'as':_0xa065('0x164'),'foreignKey':_0xa065('0x10d')});db[_0xa065('0x115')][_0xa065('0x121')](db[_0xa065('0x8a')],{'through':_0xa065('0x18b'),'as':'Tags'});db[_0xa065('0x115')][_0xa065('0x121')](db[_0xa065('0x8a')],{'through':_0xa065('0x18b'),'as':_0xa065('0x176')});db[_0xa065('0x115')][_0xa065('0x121')](db[_0xa065('0x12')],{'as':_0xa065('0x167'),'through':_0xa065('0x18c'),'foreignKey':'ChatInteractionId'});db[_0xa065('0x18d')][_0xa065('0x146')](db[_0xa065('0x12')],{'onDelete':_0xa065('0x10c'),'as':_0xa065('0x12')});db['ChatMessage'][_0xa065('0x146')](db['CmContact'],{'onDelete':_0xa065('0x10c'),'as':_0xa065('0x163'),'foreignKey':_0xa065('0x155')});db[_0xa065('0x18d')][_0xa065('0x146')](db['ChatInteraction'],{'onDelete':_0xa065('0x10c'),'as':_0xa065('0x169'),'foreignKey':_0xa065('0x18a')});db[_0xa065('0x18d')][_0xa065('0x146')](db[_0xa065('0xe4')],{'as':_0xa065('0xe4'),'foreignKey':_0xa065('0x177')});db[_0xa065('0x18d')][_0xa065('0x146')](db[_0xa065('0x62')],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x16a')});db[_0xa065('0x16b')]['hasMany'](db['Attachment'],{'as':_0xa065('0x18e'),'foreignKey':_0xa065('0x16c'),'onDelete':'cascade','hooks':!![]});db[_0xa065('0x16b')][_0xa065('0x146')](db[_0xa065('0x6e')],{'onDelete':'cascade','as':_0xa065('0x163'),'foreignKey':_0xa065('0x155')});db[_0xa065('0x16b')][_0xa065('0x146')](db['ChatWebsite'],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x16a')});db[_0xa065('0x12d')][_0xa065('0x121')](db['User'],{'as':'Agents','through':_0xa065('0x2f'),'hooks':!![]});db[_0xa065('0x12d')][_0xa065('0x121')](db[_0xa065('0xe0')],{'through':_0xa065('0x18f'),'as':_0xa065('0x14c')});db[_0xa065('0x190')][_0xa065('0x10f')](db[_0xa065('0xcb')],{'as':_0xa065('0x14f'),'foreignKey':'ChatGroupId','onDelete':_0xa065('0x10c')});db[_0xa065('0x190')][_0xa065('0x121')](db[_0xa065('0x12')],{'as':_0xa065('0x13e'),'through':_0xa065('0x191')});db[_0xa065('0x186')][_0xa065('0x146')](db[_0xa065('0x62')],{'as':_0xa065('0x189'),'foreignKey':_0xa065('0x16a')});db[_0xa065('0x6c')][_0xa065('0x10f')](db[_0xa065('0x6e')],{'as':_0xa065('0x192'),'foreignKey':'CompanyId'});db[_0xa065('0x6e')]['hasMany'](db[_0xa065('0x193')],{'as':'Phones','foreignKey':_0xa065('0x194')});db[_0xa065('0x6e')]['hasMany'](db[_0xa065('0x13f')],{'as':_0xa065('0x140'),'foreignKey':_0xa065('0x155')});db[_0xa065('0x6e')][_0xa065('0x10f')](db[_0xa065('0x73')],{'as':_0xa065('0x113'),'foreignKey':_0xa065('0x155')});db[_0xa065('0x6e')][_0xa065('0x10f')](db['CmHopperHistory'],{'as':_0xa065('0x141'),'foreignKey':'ContactId'});db['CmContact'][_0xa065('0x10f')](db[_0xa065('0x77')],{'as':_0xa065('0x77'),'foreignKey':'ContactId'});db[_0xa065('0x6e')]['hasMany'](db[_0xa065('0xd0')],{'as':_0xa065('0x195'),'foreignKey':_0xa065('0x155')});db[_0xa065('0x6e')][_0xa065('0x10f')](db[_0xa065('0x5e')],{'as':_0xa065('0x114'),'foreignKey':'ContactId','onDelete':_0xa065('0x158')});db['CmContact'][_0xa065('0x10f')](db[_0xa065('0x115')],{'as':'ChatInteractions','foreignKey':_0xa065('0x155'),'onDelete':_0xa065('0x158')});db[_0xa065('0x6e')][_0xa065('0x10f')](db[_0xa065('0x117')],{'as':_0xa065('0x118'),'foreignKey':_0xa065('0x155'),'onDelete':_0xa065('0x158')});db[_0xa065('0x6e')][_0xa065('0x10f')](db[_0xa065('0x4d')],{'as':_0xa065('0x119'),'foreignKey':_0xa065('0x155'),'onDelete':_0xa065('0x158')});db[_0xa065('0x6e')]['hasMany'](db[_0xa065('0x11a')],{'as':_0xa065('0x11b'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xa065('0x6e')][_0xa065('0x146')](db[_0xa065('0x6c')],{'as':'Company','foreignKey':'CompanyId'});db[_0xa065('0x6e')]['belongsTo'](db[_0xa065('0xed')],{'as':_0xa065('0x15c'),'foreignKey':_0xa065('0x15d'),'onDelete':_0xa065('0x10c')});db['CmContact']['belongsToMany'](db[_0xa065('0x12')],{'as':_0xa065('0x167'),'through':_0xa065('0x122')});db['CmContact'][_0xa065('0x121')](db[_0xa065('0x8a')],{'as':_0xa065('0x166'),'through':_0xa065('0x196')});db[_0xa065('0x6e')][_0xa065('0x121')](db[_0xa065('0x8a')],{'through':_0xa065('0x196'),'as':'ThroughTags'});db['CmHopper'][_0xa065('0x10f')](db[_0xa065('0x8f')],{'as':'AdditionalPhones','foreignKey':_0xa065('0x197')});db['CmHopper'][_0xa065('0x146')](db[_0xa065('0x6e')],{'as':'Contact','foreignKey':_0xa065('0x155'),'onDelete':_0xa065('0x10c')});db[_0xa065('0x13f')][_0xa065('0x146')](db[_0xa065('0xed')],{'as':_0xa065('0x15c'),'foreignKey':_0xa065('0x15d'),'onDelete':_0xa065('0x10c')});db[_0xa065('0x13f')][_0xa065('0x146')](db[_0xa065('0x12')],{'as':_0xa065('0x198'),'foreignKey':'UserId'});db[_0xa065('0x13f')]['belongsTo'](db['VoiceQueue'],{'as':_0xa065('0x199'),'foreignKey':_0xa065('0x142'),'onDelete':_0xa065('0x10c')});db[_0xa065('0x13f')][_0xa065('0x146')](db[_0xa065('0x19a')],{'as':'Campaign','foreignKey':_0xa065('0x19b'),'onDelete':_0xa065('0x10c')});db[_0xa065('0x13f')][_0xa065('0x146')](db[_0xa065('0x12')],{'as':_0xa065('0x164'),'foreignKey':_0xa065('0x19c')});db[_0xa065('0x71')][_0xa065('0x146')](db[_0xa065('0x6e')],{'as':'Contact','foreignKey':_0xa065('0x155'),'onDelete':'cascade'});db[_0xa065('0x71')][_0xa065('0x146')](db['CmList'],{'as':_0xa065('0x15c'),'foreignKey':_0xa065('0x15d'),'onDelete':_0xa065('0x10c')});db[_0xa065('0x71')][_0xa065('0x146')](db[_0xa065('0x1b')],{'as':_0xa065('0x199'),'foreignKey':_0xa065('0x142'),'onDelete':_0xa065('0x10c')});db[_0xa065('0x71')][_0xa065('0x146')](db[_0xa065('0x19a')],{'as':_0xa065('0x19a'),'foreignKey':_0xa065('0x19b'),'onDelete':_0xa065('0x10c')});db[_0xa065('0x7b')]['hasMany'](db[_0xa065('0x19d')],{'as':{'plural':'All','singular':_0xa065('0x19e')},'foreignKey':_0xa065('0x19f'),'onDelete':_0xa065('0x10c'),'hooks':!![]});db['Automation'][_0xa065('0x10f')](db['Condition'],{'as':{'plural':_0xa065('0x1a0'),'singular':'OneAny'},'foreignKey':_0xa065('0x1a1'),'onDelete':_0xa065('0x10c'),'hooks':!![]});db[_0xa065('0x7b')][_0xa065('0x10f')](db[_0xa065('0x7a')],{'as':_0xa065('0x1a2'),'foreignKey':_0xa065('0x1a3'),'onDelete':_0xa065('0x10c'),'hooks':!![]});db[_0xa065('0x7f')][_0xa065('0x10f')](db[_0xa065('0x7f')],{'as':'Dispositions','foreignKey':_0xa065('0x1a4'),'onDelete':'cascade'});db[_0xa065('0x82')][_0xa065('0x10f')](db['Interval'],{'as':_0xa065('0x1a5'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0xa065('0x82')][_0xa065('0x10f')](db[_0xa065('0x111')],{'as':'Extensions','foreignKey':_0xa065('0x16d'),'onDelete':_0xa065('0x158')});db['Interval'][_0xa065('0x10f')](db[_0xa065('0x43')],{'as':_0xa065('0x1a6'),'foreignKey':_0xa065('0x16d')});db[_0xa065('0x82')][_0xa065('0x10f')](db[_0xa065('0x187')],{'as':_0xa065('0x1a7'),'foreignKey':'IntervalId'});db[_0xa065('0x82')][_0xa065('0x10f')](db[_0xa065('0x172')],{'as':_0xa065('0x1a8'),'foreignKey':_0xa065('0x16d')});db[_0xa065('0x82')]['hasMany'](db[_0xa065('0x55')],{'as':_0xa065('0x1a9'),'foreignKey':_0xa065('0x16d')});db['Schedule'][_0xa065('0x146')](db[_0xa065('0x3d')],{});db[_0xa065('0x1aa')][_0xa065('0x146')](db[_0xa065('0x99')],{'foreignKey':_0xa065('0x1ab')});db[_0xa065('0x1aa')]['belongsTo'](db[_0xa065('0x1ac')],{'foreignKey':_0xa065('0x1ad')});db['Sound'][_0xa065('0x121')](db[_0xa065('0x19')],{'as':_0xa065('0x1ae'),'through':'moh_has_sounds','onDelete':_0xa065('0x158')});db['Tag'][_0xa065('0x121')](db['CmContact'],{'through':_0xa065('0x196')});db[_0xa065('0x8a')][_0xa065('0x121')](db[_0xa065('0x115')],{'through':_0xa065('0x18b')});db['Tag']['belongsToMany'](db[_0xa065('0x11a')],{'through':_0xa065('0x165')});db[_0xa065('0x8a')][_0xa065('0x121')](db[_0xa065('0x117')],{'through':'sms_interaction_has_tags'});db[_0xa065('0x8a')]['belongsToMany'](db[_0xa065('0x4d')],{'through':'fax_interaction_has_tags'});db[_0xa065('0x8a')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0xa065('0x183')});db[_0xa065('0x8a')]['belongsToMany'](db[_0xa065('0xfa')],{'through':'whatsapp_interaction_has_tags'});db['CmContactHasItem'][_0xa065('0x146')](db[_0xa065('0x8c')],{'as':'ItemType','foreignKey':_0xa065('0x1af')});db['CmHopperAdditionalPhone'][_0xa065('0x146')](db[_0xa065('0x13f')],{'as':_0xa065('0x1b0'),'foreignKey':_0xa065('0x197')});db[_0xa065('0x193')]['belongsTo'](db[_0xa065('0x6e')],{'as':'Contact','foreignKey':_0xa065('0x194')});db[_0xa065('0x1b1')]['hasMany'](db[_0xa065('0x19d')],{'as':{'plural':_0xa065('0x1b2'),'singular':_0xa065('0x1b3')},'foreignKey':_0xa065('0x1b4'),'onDelete':_0xa065('0x10c'),'hooks':!![]});db['Trigger'][_0xa065('0x10f')](db['Condition'],{'as':{'plural':_0xa065('0x1b5'),'singular':_0xa065('0x1b6')},'foreignKey':_0xa065('0x1b7'),'onDelete':_0xa065('0x10c'),'hooks':!![]});db[_0xa065('0x1b1')][_0xa065('0x10f')](db['Action'],{'as':_0xa065('0x1a2'),'foreignKey':_0xa065('0x1b8'),'onDelete':_0xa065('0x10c'),'hooks':!![]});db[_0xa065('0x1ac')][_0xa065('0x10f')](db[_0xa065('0x1b9')],{'as':_0xa065('0x1ba'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1ad'),'hooks':!![]});db['AnalyticDefaultReport'][_0xa065('0x10f')](db[_0xa065('0x1b9')],{'as':_0xa065('0x1ba'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1ab')});db[_0xa065('0x1bb')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xa065('0x1ba'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1bc')});db[_0xa065('0x1b9')][_0xa065('0x146')](db[_0xa065('0x1bb')],{'foreignKey':_0xa065('0x1bc')});db[_0xa065('0xa0')][_0xa065('0x10f')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1bd')});db[_0xa065('0x1be')]['hasMany'](db[_0xa065('0xa2')],{'as':_0xa065('0x1bf'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1c0')});db[_0xa065('0x1be')][_0xa065('0x10f')](db['SalesforceField'],{'as':_0xa065('0x1c1'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1c2')});db[_0xa065('0x1be')][_0xa065('0x10f')](db[_0xa065('0xa2')],{'as':'Fields','onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1c3')});db[_0xa065('0x1be')][_0xa065('0x146')](db[_0xa065('0xa0')],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x1bd')});db[_0xa065('0xa2')][_0xa065('0x10f')](db['SalesforceField'],{'as':'Subject','foreignKey':_0xa065('0x1c0')});db['SalesforceField'][_0xa065('0x10f')](db[_0xa065('0xa2')],{'as':_0xa065('0x1c4'),'foreignKey':_0xa065('0x1c2')});db[_0xa065('0xa2')][_0xa065('0x10f')](db['SalesforceField'],{'as':_0xa065('0x1c5'),'foreignKey':_0xa065('0x1c3')});db[_0xa065('0xa2')][_0xa065('0x146')](db['Variable'],{'as':_0xa065('0x94'),'foreignKey':'VariableId'});db[_0xa065('0x1c6')][_0xa065('0x10f')](db[_0xa065('0xa3')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0xa065('0x10f')](db[_0xa065('0xa5')],{'as':_0xa065('0x1bf'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1c0')});db[_0xa065('0xa3')][_0xa065('0x10f')](db[_0xa065('0xa5')],{'as':_0xa065('0x1c1'),'onDelete':_0xa065('0x10c'),'foreignKey':'DescriptionId'});db[_0xa065('0xa3')][_0xa065('0x10f')](db[_0xa065('0xa5')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xa065('0x1c3')});db[_0xa065('0xa3')][_0xa065('0x146')](db[_0xa065('0x1c6')],{'as':'Account','foreignKey':'AccountId'});db['SugarcrmField'][_0xa065('0x10f')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0xa065('0x1c0')});db[_0xa065('0xa5')]['hasMany'](db[_0xa065('0xa5')],{'as':_0xa065('0x1c4'),'foreignKey':_0xa065('0x1c2')});db[_0xa065('0xa5')][_0xa065('0x10f')](db['SugarcrmField'],{'as':'Field','foreignKey':_0xa065('0x1c3')});db[_0xa065('0xa5')][_0xa065('0x146')](db[_0xa065('0x94')],{'as':_0xa065('0x94'),'foreignKey':_0xa065('0x1c7')});db[_0xa065('0xa7')]['hasMany'](db[_0xa065('0xa9')],{'as':_0xa065('0x1c8'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1bd')});db[_0xa065('0xa9')][_0xa065('0x10f')](db['DeskField'],{'as':_0xa065('0x1bf'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1c0')});db[_0xa065('0xa9')]['hasMany'](db[_0xa065('0xab')],{'as':_0xa065('0x1c1'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1c2')});db['DeskConfiguration'][_0xa065('0x10f')](db[_0xa065('0xab')],{'as':_0xa065('0x1ba'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1c3')});db[_0xa065('0xa9')][_0xa065('0x146')](db[_0xa065('0xa7')],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x1bd')});db[_0xa065('0xa9')]['belongsToMany'](db['Tag'],{'through':_0xa065('0x1c9')});db[_0xa065('0xab')][_0xa065('0x10f')](db[_0xa065('0xab')],{'as':_0xa065('0x1ca'),'foreignKey':_0xa065('0x1c0')});db[_0xa065('0xab')][_0xa065('0x10f')](db['DeskField'],{'as':_0xa065('0x1c4'),'foreignKey':_0xa065('0x1c2')});db[_0xa065('0xab')][_0xa065('0x10f')](db[_0xa065('0xab')],{'as':_0xa065('0x1c5'),'foreignKey':_0xa065('0x1c3')});db[_0xa065('0xab')][_0xa065('0x146')](db[_0xa065('0x94')],{'as':_0xa065('0x94'),'foreignKey':_0xa065('0x1c7')});db[_0xa065('0x1cb')][_0xa065('0x10f')](db[_0xa065('0xae')],{'as':_0xa065('0x1c8'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1bd')});db['ZohoConfiguration'][_0xa065('0x10f')](db[_0xa065('0x1cc')],{'as':_0xa065('0x1bf'),'onDelete':_0xa065('0x10c'),'foreignKey':'SubjectId'});db[_0xa065('0xae')][_0xa065('0x10f')](db['ZohoField'],{'as':_0xa065('0x1c1'),'onDelete':_0xa065('0x10c'),'foreignKey':'DescriptionId'});db[_0xa065('0xae')]['hasMany'](db['ZohoField'],{'as':_0xa065('0x1ba'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1c3')});db['ZohoConfiguration'][_0xa065('0x146')](db[_0xa065('0x1cb')],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x1bd')});db['ZohoField'][_0xa065('0x10f')](db[_0xa065('0x1cc')],{'as':_0xa065('0x1ca'),'foreignKey':_0xa065('0x1c0')});db[_0xa065('0x1cc')][_0xa065('0x10f')](db[_0xa065('0x1cc')],{'as':'Description','foreignKey':_0xa065('0x1c2')});db['ZohoField']['hasMany'](db[_0xa065('0x1cc')],{'as':_0xa065('0x1c5'),'foreignKey':'FieldId'});db[_0xa065('0x1cc')][_0xa065('0x146')](db['Variable'],{'as':_0xa065('0x94'),'foreignKey':_0xa065('0x1c7')});db[_0xa065('0xb0')][_0xa065('0x10f')](db[_0xa065('0xb2')],{'as':_0xa065('0x1c8'),'onDelete':'cascade','foreignKey':_0xa065('0x1bd')});db[_0xa065('0xb2')][_0xa065('0x10f')](db[_0xa065('0xb3')],{'as':'Subjects','foreignKey':_0xa065('0x1c0')});db[_0xa065('0xb2')][_0xa065('0x10f')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0xa065('0x1c2')});db[_0xa065('0xb2')]['hasMany'](db['ZendeskField'],{'as':_0xa065('0x1ba'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0xa065('0x146')](db[_0xa065('0xb0')],{'as':_0xa065('0x162'),'foreignKey':'AccountId'});db[_0xa065('0xb2')][_0xa065('0x121')](db[_0xa065('0x8a')],{'through':_0xa065('0x1cd')});db['ZendeskField'][_0xa065('0x10f')](db[_0xa065('0xb3')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xa065('0xb3')][_0xa065('0x10f')](db['ZendeskField'],{'as':'Description','foreignKey':_0xa065('0x1c2')});db[_0xa065('0xb3')][_0xa065('0x10f')](db['ZendeskField'],{'as':_0xa065('0x1c5'),'foreignKey':_0xa065('0x1c3')});db[_0xa065('0xb3')]['belongsTo'](db[_0xa065('0x94')],{'as':'Variable','foreignKey':_0xa065('0x1c7')});db[_0xa065('0xb5')][_0xa065('0x10f')](db['FreshdeskConfiguration'],{'as':_0xa065('0x1c8'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1bd')});db['FreshdeskConfiguration']['hasMany'](db[_0xa065('0xb8')],{'as':_0xa065('0x1bf'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1c0')});db[_0xa065('0xb6')][_0xa065('0x10f')](db['FreshdeskField'],{'as':_0xa065('0x1c1'),'onDelete':_0xa065('0x10c'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0xa065('0x10f')](db['FreshdeskField'],{'as':_0xa065('0x1ba'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1c3')});db[_0xa065('0xb6')][_0xa065('0x146')](db[_0xa065('0xb5')],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x1bd')});db[_0xa065('0xb6')]['belongsToMany'](db['Tag'],{'through':_0xa065('0x1ce')});db[_0xa065('0xb8')][_0xa065('0x10f')](db[_0xa065('0xb8')],{'as':_0xa065('0x1ca'),'foreignKey':_0xa065('0x1c0')});db[_0xa065('0xb8')][_0xa065('0x10f')](db[_0xa065('0xb8')],{'as':_0xa065('0x1c4'),'foreignKey':_0xa065('0x1c2')});db[_0xa065('0xb8')][_0xa065('0x10f')](db[_0xa065('0xb8')],{'as':_0xa065('0x1c5'),'foreignKey':'FieldId'});db['FreshdeskField'][_0xa065('0x146')](db[_0xa065('0x94')],{'as':_0xa065('0x94'),'foreignKey':_0xa065('0x1c7')});db[_0xa065('0xb9')][_0xa065('0x10f')](db[_0xa065('0x1cf')],{'as':_0xa065('0x1c8'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1bd')});db[_0xa065('0x1cf')][_0xa065('0x10f')](db[_0xa065('0x1d0')],{'as':_0xa065('0x1bf'),'foreignKey':_0xa065('0x1c0')});db[_0xa065('0x1cf')]['hasMany'](db[_0xa065('0x1d0')],{'as':_0xa065('0x1c1'),'foreignKey':_0xa065('0x1c2')});db['VtigerConfiguration']['hasMany'](db[_0xa065('0x1d0')],{'as':'Fields','foreignKey':_0xa065('0x1c3')});db[_0xa065('0x1cf')][_0xa065('0x146')](db[_0xa065('0xb9')],{'as':'Account','foreignKey':'AccountId'});db[_0xa065('0x1d0')]['hasMany'](db[_0xa065('0x1d0')],{'as':'Subject','foreignKey':_0xa065('0x1c0')});db[_0xa065('0x1d0')][_0xa065('0x10f')](db[_0xa065('0x1d0')],{'as':'Description','foreignKey':_0xa065('0x1c2')});db[_0xa065('0x1d0')]['hasMany'](db[_0xa065('0x1d0')],{'as':_0xa065('0x1c5'),'foreignKey':_0xa065('0x1c3')});db[_0xa065('0x1d0')][_0xa065('0x146')](db[_0xa065('0x94')],{'as':'Variable','foreignKey':_0xa065('0x1c7')});db[_0xa065('0xbd')]['hasMany'](db['ServicenowConfiguration'],{'as':_0xa065('0x1c8'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1bd')});db[_0xa065('0xbe')]['hasMany'](db[_0xa065('0x1d1')],{'as':'Subjects','foreignKey':_0xa065('0x1c0')});db[_0xa065('0xbe')][_0xa065('0x10f')](db[_0xa065('0x1d1')],{'as':'Descriptions','foreignKey':_0xa065('0x1c2')});db[_0xa065('0xbe')][_0xa065('0x10f')](db[_0xa065('0x1d1')],{'as':'Fields','foreignKey':_0xa065('0x1c3')});db['ServicenowConfiguration']['belongsTo'](db['ServicenowAccount'],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x1bd')});db[_0xa065('0x1d1')]['hasMany'](db[_0xa065('0x1d1')],{'as':_0xa065('0x1ca'),'foreignKey':'SubjectId'});db['ServicenowField'][_0xa065('0x10f')](db['ServicenowField'],{'as':_0xa065('0x1c4'),'foreignKey':'DescriptionId'});db[_0xa065('0x1d1')][_0xa065('0x10f')](db[_0xa065('0x1d1')],{'as':_0xa065('0x1c5'),'foreignKey':'FieldId'});db[_0xa065('0x1d1')]['belongsTo'](db[_0xa065('0x94')],{'as':_0xa065('0x94'),'foreignKey':_0xa065('0x1c7')});db[_0xa065('0xc1')][_0xa065('0x10f')](db[_0xa065('0xc2')],{'as':'Configurations','onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1bd')});db[_0xa065('0xc1')][_0xa065('0x146')](db[_0xa065('0x103')],{'as':_0xa065('0x103'),'foreignKey':_0xa065('0x157')});db['Dynamics365Configuration'][_0xa065('0x10f')](db[_0xa065('0x1d2')],{'as':_0xa065('0x1bf'),'onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1c0')});db[_0xa065('0xc2')]['hasMany'](db[_0xa065('0x1d2')],{'as':_0xa065('0x1c1'),'onDelete':'cascade','foreignKey':_0xa065('0x1c2')});db[_0xa065('0xc2')]['hasMany'](db['Dynamics365Field'],{'as':'Fields','onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x1c3')});db[_0xa065('0xc2')]['belongsTo'](db['Dynamics365Account'],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x1bd')});db[_0xa065('0x1d2')][_0xa065('0x10f')](db[_0xa065('0x1d2')],{'as':_0xa065('0x1ca'),'foreignKey':_0xa065('0x1c0')});db[_0xa065('0x1d2')][_0xa065('0x10f')](db[_0xa065('0x1d2')],{'as':_0xa065('0x1c4'),'foreignKey':_0xa065('0x1c2')});db[_0xa065('0x1d2')]['hasMany'](db[_0xa065('0x1d2')],{'as':'Field','foreignKey':_0xa065('0x1c3')});db['Dynamics365Field'][_0xa065('0x146')](db[_0xa065('0x94')],{'as':_0xa065('0x94'),'foreignKey':_0xa065('0x1c7')});db['FreshsalesAccount'][_0xa065('0x10f')](db[_0xa065('0xc5')],{'as':_0xa065('0x1c8'),'onDelete':_0xa065('0x10c'),'foreignKey':'AccountId'});db[_0xa065('0xc5')][_0xa065('0x10f')](db[_0xa065('0x1d3')],{'as':_0xa065('0x1bf'),'foreignKey':_0xa065('0x1c0')});db['FreshsalesConfiguration'][_0xa065('0x10f')](db[_0xa065('0x1d3')],{'as':_0xa065('0x1c1'),'foreignKey':_0xa065('0x1c2')});db[_0xa065('0xc5')][_0xa065('0x10f')](db[_0xa065('0x1d3')],{'as':_0xa065('0x1ba'),'foreignKey':_0xa065('0x1c3')});db['FreshsalesConfiguration'][_0xa065('0x146')](db[_0xa065('0x1d4')],{'as':_0xa065('0x162'),'foreignKey':'AccountId'});db[_0xa065('0x1d3')][_0xa065('0x10f')](db['FreshsalesField'],{'as':_0xa065('0x1ca'),'foreignKey':_0xa065('0x1c0')});db[_0xa065('0x1d3')]['hasMany'](db[_0xa065('0x1d3')],{'as':_0xa065('0x1c4'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0xa065('0x10f')](db['FreshsalesField'],{'as':_0xa065('0x1c5'),'foreignKey':'FieldId'});db['FreshsalesField'][_0xa065('0x146')](db[_0xa065('0x94')],{'as':'Variable','foreignKey':_0xa065('0x1c7')});db['ChatQueueReport'][_0xa065('0x146')](db[_0xa065('0x62')],{});db[_0xa065('0xca')]['belongsTo'](db[_0xa065('0xed')],{'as':_0xa065('0x15c'),'foreignKey':_0xa065('0x15d')});db[_0xa065('0xca')]['belongsTo'](db[_0xa065('0x6e')],{'as':_0xa065('0x163'),'foreignKey':'ContactId'});db[_0xa065('0xca')][_0xa065('0x146')](db[_0xa065('0x115')],{});db[_0xa065('0xca')][_0xa065('0x146')](db[_0xa065('0x18d')],{});db[_0xa065('0xca')][_0xa065('0x146')](db[_0xa065('0x12')],{});db[_0xa065('0xca')][_0xa065('0x146')](db[_0xa065('0x12d')],{});db[_0xa065('0xcb')][_0xa065('0x146')](db[_0xa065('0x12')],{'onDelete':_0xa065('0x10c'),'foreignKey':'FromId'});db[_0xa065('0xcb')][_0xa065('0x146')](db['User'],{'onDelete':_0xa065('0x10c'),'foreignKey':'ToId'});db[_0xa065('0xd0')][_0xa065('0x10f')](db[_0xa065('0xce')],{'foreignKey':_0xa065('0x1d5'),'onDelete':_0xa065('0x10c')});db[_0xa065('0xd0')][_0xa065('0x10f')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0xa065('0x10c')});db[_0xa065('0xd2')]['belongsTo'](db[_0xa065('0x53')],{});db[_0xa065('0xd2')][_0xa065('0x146')](db[_0xa065('0xed')],{'as':_0xa065('0x15c'),'foreignKey':_0xa065('0x15d')});db[_0xa065('0xd2')]['belongsTo'](db[_0xa065('0x6e')],{'as':_0xa065('0x163'),'foreignKey':'ContactId'});db[_0xa065('0xd2')][_0xa065('0x146')](db[_0xa065('0x117')],{});db['SmsQueueReport'][_0xa065('0x146')](db['SmsMessage'],{});db[_0xa065('0xd2')][_0xa065('0x146')](db['User'],{});db['SmsQueueReport'][_0xa065('0x146')](db[_0xa065('0x5a')],{});db['JscriptyProject'][_0xa065('0x10f')](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db[_0xa065('0xd6')][_0xa065('0x10f')](db[_0xa065('0xce')],{'foreignKey':'ProjectId'});db[_0xa065('0xd6')]['hasMany'](db[_0xa065('0x1d6')],{'foreignKey':_0xa065('0x1d7')});db['SquareProject']['belongsToMany'](db[_0xa065('0x12')],{'as':'Users','through':_0xa065('0x1d8')});db['Team']['belongsToMany'](db[_0xa065('0x12')],{'as':_0xa065('0x14b'),'through':_0xa065('0x124')});db[_0xa065('0xe0')]['belongsToMany'](db[_0xa065('0x1b')],{'through':'TeamVoiceQueue','as':_0xa065('0x128')});db['Team'][_0xa065('0x121')](db[_0xa065('0x12a')],{'through':_0xa065('0x160'),'as':_0xa065('0x12b')});db[_0xa065('0xe0')][_0xa065('0x121')](db['ChatQueue'],{'through':_0xa065('0x18f'),'as':'ChatQueues'});db['Team'][_0xa065('0x121')](db[_0xa065('0x12e')],{'through':_0xa065('0x178'),'as':_0xa065('0x12f')});db[_0xa065('0xe0')]['belongsToMany'](db[_0xa065('0x5a')],{'through':_0xa065('0x17d'),'as':_0xa065('0x131')});db[_0xa065('0xe0')][_0xa065('0x121')](db[_0xa065('0x61')],{'through':_0xa065('0x185'),'as':_0xa065('0x132')});db[_0xa065('0xe0')]['belongsToMany'](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':_0xa065('0x1d9')});db[_0xa065('0xe0')][_0xa065('0x121')](db[_0xa065('0xee')],{'through':'TeamVoicePrefix','as':_0xa065('0x129')});db['Campaign'][_0xa065('0x10f')](db[_0xa065('0x13f')],{'as':'Hoppers','foreignKey':_0xa065('0x19b')});db['Campaign'][_0xa065('0x10f')](db[_0xa065('0x73')],{'as':_0xa065('0x113'),'foreignKey':_0xa065('0x19b')});db[_0xa065('0x19a')]['hasMany'](db[_0xa065('0x75')],{'as':_0xa065('0x141'),'foreignKey':_0xa065('0x19b')});db[_0xa065('0x19a')][_0xa065('0x10f')](db[_0xa065('0x71')],{'as':_0xa065('0x143'),'foreignKey':_0xa065('0x19b')});db[_0xa065('0x19a')][_0xa065('0x146')](db['Trunk'],{'as':_0xa065('0x144'),'foreignKey':_0xa065('0x145')});db[_0xa065('0x19a')][_0xa065('0x146')](db[_0xa065('0x144')],{'as':_0xa065('0x1da'),'foreignKey':_0xa065('0x1db')});db[_0xa065('0x19a')][_0xa065('0x146')](db[_0xa065('0x82')],{'as':'Interval','foreignKey':_0xa065('0x16d')});db[_0xa065('0x19a')][_0xa065('0x146')](db[_0xa065('0xdb')],{'as':_0xa065('0xdb'),'foreignKey':_0xa065('0x1dc')});db[_0xa065('0x19a')]['belongsToMany'](db[_0xa065('0xed')],{'as':_0xa065('0x123'),'through':_0xa065('0x1dd')});db[_0xa065('0x19a')][_0xa065('0x121')](db['CmList'],{'as':_0xa065('0x14d'),'through':_0xa065('0x1de')});db[_0xa065('0xe4')][_0xa065('0x146')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0xa065('0x16c')});db['MailTransferReport'][_0xa065('0x146')](db['MailMessage'],{});db['MailTransferReport'][_0xa065('0x146')](db['MailInteraction'],{});db[_0xa065('0xe7')]['belongsTo'](db[_0xa065('0x3d')],{'foreignKey':_0xa065('0x1df'),'as':_0xa065('0x1e0')});db[_0xa065('0xe7')][_0xa065('0x146')](db['User'],{'foreignKey':_0xa065('0x1e1'),'as':_0xa065('0x1e2')});db[_0xa065('0xe7')][_0xa065('0x146')](db['User'],{'foreignKey':_0xa065('0x1e3'),'as':_0xa065('0x1e4')});db['MailTransferReport'][_0xa065('0x146')](db['MailQueue'],{'foreignKey':_0xa065('0x1e5'),'as':_0xa065('0x1e6')});db[_0xa065('0xe7')]['belongsTo'](db[_0xa065('0x3d')],{'foreignKey':'ToMailAccountId','as':_0xa065('0x1e7')});db[_0xa065('0xe9')]['belongsTo'](db[_0xa065('0x18d')],{});db[_0xa065('0xe9')][_0xa065('0x146')](db[_0xa065('0x115')],{});db[_0xa065('0xe9')]['belongsTo'](db[_0xa065('0x62')],{'foreignKey':_0xa065('0x1e8'),'as':_0xa065('0x1e0')});db[_0xa065('0xe9')][_0xa065('0x146')](db[_0xa065('0x12')],{'foreignKey':_0xa065('0x1e1'),'as':_0xa065('0x1e2')});db['ChatTransferReport'][_0xa065('0x146')](db[_0xa065('0x12')],{'foreignKey':'ToUserId','as':_0xa065('0x1e4')});db[_0xa065('0xe9')][_0xa065('0x146')](db['ChatQueue'],{'foreignKey':_0xa065('0x1e9'),'as':_0xa065('0x1e6')});db[_0xa065('0xe9')]['belongsTo'](db[_0xa065('0x62')],{'foreignKey':'ToChatWebsiteId','as':_0xa065('0x1e7')});db['FaxTransferReport'][_0xa065('0x146')](db[_0xa065('0x4e')],{});db[_0xa065('0x1ea')]['belongsTo'](db[_0xa065('0x4d')],{});db[_0xa065('0x1ea')][_0xa065('0x146')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0xa065('0x1e0')});db[_0xa065('0x1ea')][_0xa065('0x146')](db[_0xa065('0x12')],{'foreignKey':'FromUserId','as':_0xa065('0x1e2')});db[_0xa065('0x1ea')][_0xa065('0x146')](db['User'],{'foreignKey':_0xa065('0x1e3'),'as':_0xa065('0x1e4')});db['FaxTransferReport']['belongsTo'](db[_0xa065('0x12e')],{'foreignKey':'ToFaxQueueId','as':_0xa065('0x1e6')});db[_0xa065('0x1ea')]['belongsTo'](db[_0xa065('0x4a')],{'foreignKey':_0xa065('0x1eb'),'as':'ToAccount'});db[_0xa065('0x1ec')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xa065('0x1ec')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0xa065('0x1ec')]['belongsTo'](db[_0xa065('0x5c')],{'foreignKey':'FromOpenchannelAccountId','as':_0xa065('0x1e0')});db[_0xa065('0x1ec')][_0xa065('0x146')](db['User'],{'foreignKey':_0xa065('0x1e1'),'as':_0xa065('0x1e2')});db[_0xa065('0x1ec')][_0xa065('0x146')](db['User'],{'foreignKey':_0xa065('0x1e3'),'as':_0xa065('0x1e4')});db[_0xa065('0x1ec')][_0xa065('0x146')](db[_0xa065('0x61')],{'foreignKey':_0xa065('0x1ed'),'as':'ToQueue'});db[_0xa065('0x1ec')][_0xa065('0x146')](db[_0xa065('0x5c')],{'foreignKey':_0xa065('0x1ee'),'as':_0xa065('0x1e7')});db[_0xa065('0xec')][_0xa065('0x146')](db[_0xa065('0x58')],{});db[_0xa065('0xec')]['belongsTo'](db[_0xa065('0x117')],{});db[_0xa065('0xec')][_0xa065('0x146')](db[_0xa065('0x53')],{'foreignKey':_0xa065('0x1ef'),'as':_0xa065('0x1e0')});db[_0xa065('0xec')]['belongsTo'](db['User'],{'foreignKey':_0xa065('0x1e1'),'as':_0xa065('0x1e2')});db[_0xa065('0xec')][_0xa065('0x146')](db['User'],{'foreignKey':_0xa065('0x1e3'),'as':_0xa065('0x1e4')});db['SmsTransferReport'][_0xa065('0x146')](db[_0xa065('0x5a')],{'foreignKey':_0xa065('0x1f0'),'as':_0xa065('0x1e6')});db[_0xa065('0xec')][_0xa065('0x146')](db[_0xa065('0x53')],{'foreignKey':_0xa065('0x1f1'),'as':_0xa065('0x1e7')});db[_0xa065('0xed')]['hasMany'](db[_0xa065('0x7f')],{'as':_0xa065('0x16f'),'foreignKey':_0xa065('0x15d'),'onDelete':_0xa065('0x10c')});db[_0xa065('0xed')][_0xa065('0x10f')](db['CmCustomField'],{'as':_0xa065('0x1f2'),'foreignKey':_0xa065('0x15d')});db[_0xa065('0xed')][_0xa065('0x10f')](db[_0xa065('0x6e')],{'as':'Contacts','onDelete':_0xa065('0x10c'),'foreignKey':_0xa065('0x15d')});db[_0xa065('0xed')][_0xa065('0x10f')](db[_0xa065('0x73')],{'as':_0xa065('0x113'),'foreignKey':_0xa065('0x15d')});db[_0xa065('0xed')]['hasMany'](db['CmHopperHistory'],{'as':_0xa065('0x1f3'),'foreignKey':_0xa065('0x15d')});db[_0xa065('0xed')][_0xa065('0x10f')](db[_0xa065('0x77')],{'as':_0xa065('0x77'),'foreignKey':_0xa065('0x15d')});db[_0xa065('0xed')]['belongsToMany'](db[_0xa065('0x1b')],{'as':_0xa065('0x1f4'),'through':_0xa065('0x14a')});db[_0xa065('0xed')][_0xa065('0x121')](db[_0xa065('0x12')],{'as':_0xa065('0x14b'),'through':'cm_user_has_lists'});db[_0xa065('0xee')]['hasMany'](db[_0xa065('0x111')],{'as':_0xa065('0x112'),'onDelete':_0xa065('0x10c')});db[_0xa065('0xee')][_0xa065('0x121')](db[_0xa065('0x12')],{'as':_0xa065('0x14b'),'through':_0xa065('0x108')});db['VoicePrefix']['belongsToMany'](db[_0xa065('0xe0')],{'through':_0xa065('0x106'),'as':_0xa065('0x14c')});db['UserProfile'][_0xa065('0x10f')](db[_0xa065('0x12')],{'as':'Users','foreignKey':_0xa065('0x11f')});db[_0xa065('0xf0')][_0xa065('0x10f')](db['UserProfileSection'],{'as':_0xa065('0x1f5'),'foreignKey':_0xa065('0x11f'),'onDelete':'cascade'});db[_0xa065('0xf2')]['hasMany'](db[_0xa065('0xf4')],{'as':_0xa065('0x1f6'),'foreignKey':_0xa065('0x1f7'),'onDelete':_0xa065('0x10c')});db[_0xa065('0xf7')][_0xa065('0x10f')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xa065('0x1f8'),'onDelete':'cascade'});db[_0xa065('0xf7')][_0xa065('0x10f')](db['CannedAnswer'],{'as':_0xa065('0x15b'),'foreignKey':_0xa065('0x1f8')});db['WhatsappAccount'][_0xa065('0x10f')](db[_0xa065('0xfc')],{'as':_0xa065('0x14f'),'foreignKey':_0xa065('0x1f8')});db[_0xa065('0xf7')][_0xa065('0x10f')](db[_0xa065('0xfa')],{'as':_0xa065('0x171')});db[_0xa065('0xf7')]['hasMany'](db['WhatsappApplication'],{'as':_0xa065('0x13c')});db[_0xa065('0xf7')][_0xa065('0x146')](db[_0xa065('0xed')],{'as':_0xa065('0x15c'),'foreignKey':_0xa065('0x15d')});db[_0xa065('0xf7')][_0xa065('0x146')](db[_0xa065('0x147')],{'as':_0xa065('0x148'),'foreignKey':_0xa065('0x149')});db[_0xa065('0xf7')][_0xa065('0x121')](db[_0xa065('0x12')],{'as':_0xa065('0x14b'),'through':_0xa065('0x1f9')});db[_0xa065('0xf8')][_0xa065('0x146')](db[_0xa065('0x12')],{'onDelete':_0xa065('0x158')});db[_0xa065('0xf8')][_0xa065('0x146')](db['WhatsappQueue'],{'onDelete':_0xa065('0x158')});db['WhatsappApplication'][_0xa065('0x146')](db['WhatsappAccount'],{'onDelete':_0xa065('0x158')});db['WhatsappApplication']['belongsTo'](db[_0xa065('0x82')],{'onDelete':_0xa065('0x158'),'foreignKey':_0xa065('0x16d')});db[_0xa065('0xf8')][_0xa065('0x146')](db['Tag'],{'onDelete':_0xa065('0x158'),'foreignKey':_0xa065('0x16e')});db[_0xa065('0xfa')][_0xa065('0x10f')](db[_0xa065('0xfc')],{'as':_0xa065('0x14f'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db[_0xa065('0xfa')][_0xa065('0x146')](db[_0xa065('0xf7')],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x1f8')});db[_0xa065('0xfa')][_0xa065('0x146')](db[_0xa065('0x6e')],{'as':_0xa065('0x163'),'foreignKey':_0xa065('0x155')});db[_0xa065('0xfa')][_0xa065('0x146')](db[_0xa065('0x12')],{'as':_0xa065('0x164'),'foreignKey':_0xa065('0x10d')});db[_0xa065('0xfa')][_0xa065('0x121')](db[_0xa065('0x8a')],{'through':_0xa065('0x1fa'),'as':_0xa065('0x166')});db[_0xa065('0xfa')]['belongsToMany'](db[_0xa065('0x8a')],{'through':_0xa065('0x1fa'),'as':'ThroughTags'});db['WhatsappInteraction'][_0xa065('0x121')](db[_0xa065('0x12')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0xa065('0x1fb')});db[_0xa065('0xfc')][_0xa065('0x146')](db[_0xa065('0x12')],{'as':_0xa065('0x12')});db['WhatsappMessage']['belongsTo'](db[_0xa065('0x6e')],{'onDelete':_0xa065('0x10c'),'as':_0xa065('0x163')});db['WhatsappMessage'][_0xa065('0x146')](db[_0xa065('0xfa')],{'onDelete':_0xa065('0x10c'),'as':_0xa065('0x169'),'foreignKey':_0xa065('0x1fb')});db[_0xa065('0xfc')][_0xa065('0x146')](db['WhatsappAccount'],{'as':_0xa065('0x162'),'foreignKey':_0xa065('0x1f8')});db[_0xa065('0x1fc')]['belongsTo'](db['WhatsappAccount'],{});db[_0xa065('0x1fc')]['belongsTo'](db[_0xa065('0xed')],{'as':_0xa065('0x15c'),'foreignKey':_0xa065('0x15d')});db[_0xa065('0x1fc')][_0xa065('0x146')](db['CmContact'],{'as':'Contact','foreignKey':_0xa065('0x155')});db[_0xa065('0x1fc')][_0xa065('0x146')](db[_0xa065('0xfa')],{});db[_0xa065('0x1fc')][_0xa065('0x146')](db[_0xa065('0x101')],{});db['WhatsappQueueReport']['belongsTo'](db['WhatsappMessage'],{});db[_0xa065('0x1fc')][_0xa065('0x146')](db[_0xa065('0x12')],{});db[_0xa065('0xff')]['belongsTo'](db[_0xa065('0xfc')],{});db[_0xa065('0xff')][_0xa065('0x146')](db[_0xa065('0xfa')],{});db[_0xa065('0xff')][_0xa065('0x146')](db[_0xa065('0xf7')],{'foreignKey':_0xa065('0x1fd'),'as':_0xa065('0x1e0')});db[_0xa065('0xff')][_0xa065('0x146')](db[_0xa065('0xf7')],{'foreignKey':_0xa065('0x1fe'),'as':_0xa065('0x1e7')});db[_0xa065('0xff')][_0xa065('0x146')](db[_0xa065('0x101')],{'foreignKey':_0xa065('0x1ff'),'as':_0xa065('0x1e6')});db[_0xa065('0xff')][_0xa065('0x146')](db[_0xa065('0x12')],{'foreignKey':_0xa065('0x1e1'),'as':_0xa065('0x1e2')});db[_0xa065('0xff')][_0xa065('0x146')](db[_0xa065('0x12')],{'foreignKey':_0xa065('0x1e3'),'as':_0xa065('0x1e4')});db['WhatsappQueue'][_0xa065('0x121')](db[_0xa065('0x12')],{'as':_0xa065('0x14b'),'through':_0xa065('0x37'),'foreignKey':_0xa065('0x200')});db['WhatsappQueue'][_0xa065('0x121')](db[_0xa065('0xe0')],{'through':_0xa065('0x201'),'as':'Teams'});db[_0xa065('0x109')]['belongsTo'](db[_0xa065('0x12')],{'as':'user','foreignKey':_0xa065('0x10d'),'onDelete':'cascade','hooks':!![]});db[_0xa065('0x103')][_0xa065('0x10b')](db[_0xa065('0xc1')],{'as':_0xa065('0xc1'),'onDelete':_0xa065('0x158')});db[_0xa065('0x103')][_0xa065('0x10b')](db[_0xa065('0x39')],{'as':'Imap','onDelete':_0xa065('0x158')});db[_0xa065('0x103')][_0xa065('0x10b')](db['MailServerOut'],{'as':_0xa065('0x15a'),'onDelete':_0xa065('0x158')});module[_0xa065('0x202')]={'db':db,'dbH':dbH};
\ No newline at end of file
index b09bdd6..a8c5f33 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x541a=['./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/license','./api/license','/api/campaigns','./api/campaign','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','3.0.0','/plugins','route','get','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/sounds'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0x541a,0x1bd));var _0xa541=function(_0x138d06,_0x33edf2){_0x138d06=_0x138d06-0x0;var _0x1a01eb=_0x541a[_0x138d06];return _0x1a01eb;};'use strict';var path=require(_0xa541('0x0'));var express=require(_0xa541('0x1'));var errors=require(_0xa541('0x2'));var config=require(_0xa541('0x3'));var setupLoggers=require(_0xa541('0x4'))['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0xa541('0x5')]=function(_0x10a22b){return setupLoggers(_0x10a22b)[_0xa541('0x6')](function(){_0x10a22b[_0xa541('0x7')](_0xa541('0x8'),require(_0xa541('0x9')));_0x10a22b[_0xa541('0x7')](_0xa541('0xa'),require(_0xa541('0xb')));_0x10a22b[_0xa541('0x7')](_0xa541('0xc'),require('./api/voiceContext'));_0x10a22b['use'](_0xa541('0xd'),require(_0xa541('0xe')));_0x10a22b[_0xa541('0x7')](_0xa541('0xf'),require(_0xa541('0x10')));_0x10a22b[_0xa541('0x7')]('/api/voice/queues',require(_0xa541('0x11')));_0x10a22b['use'](_0xa541('0x12'),require(_0xa541('0x13')));_0x10a22b[_0xa541('0x7')](_0xa541('0x14'),require(_0xa541('0x15')));_0x10a22b[_0xa541('0x7')](_0xa541('0x16'),require(_0xa541('0x17')));_0x10a22b[_0xa541('0x7')]('/api/voice/mails/messages',require(_0xa541('0x18')));_0x10a22b[_0xa541('0x7')](_0xa541('0x19'),require(_0xa541('0x1a')));_0x10a22b[_0xa541('0x7')](_0xa541('0x1b'),require(_0xa541('0x1c')));_0x10a22b[_0xa541('0x7')]('/api/voice/agents/reports',require(_0xa541('0x1d')));_0x10a22b[_0xa541('0x7')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x10a22b['use'](_0xa541('0x1e'),require(_0xa541('0x1f')));_0x10a22b[_0xa541('0x7')](_0xa541('0x20'),require('./api/trunk'));_0x10a22b[_0xa541('0x7')](_0xa541('0x21'),require(_0xa541('0x22')));_0x10a22b[_0xa541('0x7')](_0xa541('0x23'),require(_0xa541('0x24')));_0x10a22b['use'](_0xa541('0x25'),require('./api/mailAccount'));_0x10a22b[_0xa541('0x7')](_0xa541('0x26'),require(_0xa541('0x27')));_0x10a22b[_0xa541('0x7')](_0xa541('0x28'),require(_0xa541('0x29')));_0x10a22b[_0xa541('0x7')](_0xa541('0x2a'),require(_0xa541('0x2b')));_0x10a22b[_0xa541('0x7')](_0xa541('0x2c'),require('./api/mailMessage'));_0x10a22b[_0xa541('0x7')](_0xa541('0x2d'),require(_0xa541('0x2e')));_0x10a22b[_0xa541('0x7')](_0xa541('0x2f'),require(_0xa541('0x30')));_0x10a22b[_0xa541('0x7')](_0xa541('0x31'),require('./api/dashboard'));_0x10a22b[_0xa541('0x7')](_0xa541('0x32'),require('./api/dashboardItem'));_0x10a22b[_0xa541('0x7')](_0xa541('0x33'),require(_0xa541('0x34')));_0x10a22b['use'](_0xa541('0x35'),require(_0xa541('0x36')));_0x10a22b[_0xa541('0x7')](_0xa541('0x37'),require(_0xa541('0x38')));_0x10a22b[_0xa541('0x7')](_0xa541('0x39'),require(_0xa541('0x3a')));_0x10a22b[_0xa541('0x7')](_0xa541('0x3b'),require('./api/faxQueue'));_0x10a22b['use'](_0xa541('0x3c'),require(_0xa541('0x3d')));_0x10a22b[_0xa541('0x7')](_0xa541('0x3e'),require(_0xa541('0x3f')));_0x10a22b[_0xa541('0x7')](_0xa541('0x40'),require('./api/smsApplication'));_0x10a22b['use'](_0xa541('0x41'),require('./api/smsInteraction'));_0x10a22b['use']('/api/sms/messages',require('./api/smsMessage'));_0x10a22b[_0xa541('0x7')]('/api/sms/queues',require(_0xa541('0x42')));_0x10a22b[_0xa541('0x7')](_0xa541('0x43'),require(_0xa541('0x44')));_0x10a22b['use']('/api/openchannel/applications',require(_0xa541('0x45')));_0x10a22b[_0xa541('0x7')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x10a22b['use'](_0xa541('0x46'),require(_0xa541('0x47')));_0x10a22b[_0xa541('0x7')]('/api/openchannel/queues',require(_0xa541('0x48')));_0x10a22b[_0xa541('0x7')](_0xa541('0x49'),require(_0xa541('0x4a')));_0x10a22b[_0xa541('0x7')](_0xa541('0x4b'),require(_0xa541('0x4c')));_0x10a22b['use'](_0xa541('0x4d'),require(_0xa541('0x4e')));_0x10a22b[_0xa541('0x7')]('/api/chat/interactions',require(_0xa541('0x4f')));_0x10a22b[_0xa541('0x7')](_0xa541('0x50'),require('./api/chatMessage'));_0x10a22b[_0xa541('0x7')](_0xa541('0x51'),require(_0xa541('0x52')));_0x10a22b['use']('/api/chat/queues',require(_0xa541('0x53')));_0x10a22b[_0xa541('0x7')](_0xa541('0x54'),require('./api/chatGroup'));_0x10a22b[_0xa541('0x7')]('/api/chat/proactive_actions',require(_0xa541('0x55')));_0x10a22b[_0xa541('0x7')](_0xa541('0x56'),require(_0xa541('0x57')));_0x10a22b['use'](_0xa541('0x58'),require(_0xa541('0x59')));_0x10a22b[_0xa541('0x7')](_0xa541('0x5a'),require(_0xa541('0x5b')));_0x10a22b['use'](_0xa541('0x5c'),require('./api/cmHopperBlack'));_0x10a22b[_0xa541('0x7')]('/api/cm/hopper_final',require(_0xa541('0x5d')));_0x10a22b[_0xa541('0x7')](_0xa541('0x5e'),require(_0xa541('0x5f')));_0x10a22b[_0xa541('0x7')]('/api/cm/custom_fields',require(_0xa541('0x60')));_0x10a22b[_0xa541('0x7')](_0xa541('0x61'),require(_0xa541('0x62')));_0x10a22b[_0xa541('0x7')](_0xa541('0x63'),require(_0xa541('0x64')));_0x10a22b[_0xa541('0x7')]('/api/canned_answers',require(_0xa541('0x65')));_0x10a22b[_0xa541('0x7')](_0xa541('0x66'),require(_0xa541('0x67')));_0x10a22b[_0xa541('0x7')](_0xa541('0x68'),require('./api/condition'));_0x10a22b[_0xa541('0x7')](_0xa541('0x69'),require(_0xa541('0x6a')));_0x10a22b[_0xa541('0x7')](_0xa541('0x6b'),require(_0xa541('0x6c')));_0x10a22b[_0xa541('0x7')]('/api/cdr',require(_0xa541('0x6d')));_0x10a22b[_0xa541('0x7')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x10a22b[_0xa541('0x7')]('/api/schedules',require('./api/schedule'));_0x10a22b['use'](_0xa541('0x6e'),require(_0xa541('0x6f')));_0x10a22b[_0xa541('0x7')](_0xa541('0x70'),require(_0xa541('0x71')));_0x10a22b[_0xa541('0x7')](_0xa541('0x72'),require(_0xa541('0x73')));_0x10a22b[_0xa541('0x7')](_0xa541('0x74'),require(_0xa541('0x75')));_0x10a22b[_0xa541('0x7')](_0xa541('0x76'),require(_0xa541('0x77')));_0x10a22b['use'](_0xa541('0x78'),require(_0xa541('0x79')));_0x10a22b['use']('/api/triggers',require(_0xa541('0x7a')));_0x10a22b[_0xa541('0x7')](_0xa541('0x7b'),require(_0xa541('0x7c')));_0x10a22b['use'](_0xa541('0x7d'),require('./api/integration'));_0x10a22b[_0xa541('0x7')]('/api/integrations/reports',require(_0xa541('0x7e')));_0x10a22b['use'](_0xa541('0x7f'),require(_0xa541('0x80')));_0x10a22b[_0xa541('0x7')](_0xa541('0x81'),require(_0xa541('0x82')));_0x10a22b[_0xa541('0x7')](_0xa541('0x83'),require(_0xa541('0x84')));_0x10a22b[_0xa541('0x7')](_0xa541('0x85'),require('./api/analyticMetric'));_0x10a22b[_0xa541('0x7')](_0xa541('0x86'),require(_0xa541('0x87')));_0x10a22b[_0xa541('0x7')](_0xa541('0x88'),require(_0xa541('0x89')));_0x10a22b['use']('/api/integrations/salesforce/accounts',require(_0xa541('0x8a')));_0x10a22b['use']('/api/integrations/salesforce/configurations',require(_0xa541('0x8b')));_0x10a22b[_0xa541('0x7')](_0xa541('0x8c'),require(_0xa541('0x8d')));_0x10a22b[_0xa541('0x7')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x10a22b[_0xa541('0x7')](_0xa541('0x8e'),require('./api/intSugarcrmConfiguration'));_0x10a22b['use']('/api/integrations/sugarcrm/fields',require(_0xa541('0x8f')));_0x10a22b[_0xa541('0x7')](_0xa541('0x90'),require('./api/intDeskAccount'));_0x10a22b[_0xa541('0x7')](_0xa541('0x91'),require(_0xa541('0x92')));_0x10a22b[_0xa541('0x7')](_0xa541('0x93'),require(_0xa541('0x94')));_0x10a22b['use']('/api/integrations/zoho/accounts',require(_0xa541('0x95')));_0x10a22b[_0xa541('0x7')](_0xa541('0x96'),require('./api/intZohoConfiguration'));_0x10a22b[_0xa541('0x7')]('/api/integrations/zoho/fields',require(_0xa541('0x97')));_0x10a22b[_0xa541('0x7')](_0xa541('0x98'),require(_0xa541('0x99')));_0x10a22b[_0xa541('0x7')](_0xa541('0x9a'),require(_0xa541('0x9b')));_0x10a22b[_0xa541('0x7')]('/api/integrations/zendesk/fields',require(_0xa541('0x9c')));_0x10a22b[_0xa541('0x7')](_0xa541('0x9d'),require(_0xa541('0x9e')));_0x10a22b[_0xa541('0x7')]('/api/integrations/freshdesk/configurations',require(_0xa541('0x9f')));_0x10a22b[_0xa541('0x7')](_0xa541('0xa0'),require(_0xa541('0xa1')));_0x10a22b['use']('/api/integrations/vtiger/accounts',require(_0xa541('0xa2')));_0x10a22b[_0xa541('0x7')](_0xa541('0xa3'),require(_0xa541('0xa4')));_0x10a22b['use'](_0xa541('0xa5'),require(_0xa541('0xa6')));_0x10a22b['use'](_0xa541('0xa7'),require(_0xa541('0xa8')));_0x10a22b[_0xa541('0x7')]('/api/integrations/servicenow/configurations',require(_0xa541('0xa9')));_0x10a22b[_0xa541('0x7')](_0xa541('0xaa'),require(_0xa541('0xab')));_0x10a22b[_0xa541('0x7')](_0xa541('0xac'),require(_0xa541('0xad')));_0x10a22b['use']('/api/integrations/dynamics365/configurations',require(_0xa541('0xae')));_0x10a22b['use'](_0xa541('0xaf'),require(_0xa541('0xb0')));_0x10a22b[_0xa541('0x7')](_0xa541('0xb1'),require(_0xa541('0xb2')));_0x10a22b[_0xa541('0x7')]('/api/integrations/freshsales/configurations',require(_0xa541('0xb3')));_0x10a22b[_0xa541('0x7')](_0xa541('0xb4'),require('./api/intFreshsalesField'));_0x10a22b[_0xa541('0x7')]('/api/networks',require('./api/network'));_0x10a22b[_0xa541('0x7')](_0xa541('0xb5'),require(_0xa541('0xb6')));_0x10a22b[_0xa541('0x7')](_0xa541('0xb7'),require(_0xa541('0xb8')));_0x10a22b['use'](_0xa541('0xb9'),require(_0xa541('0xba')));_0x10a22b[_0xa541('0x7')](_0xa541('0xbb'),require(_0xa541('0xbc')));_0x10a22b[_0xa541('0x7')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x10a22b['use'](_0xa541('0xbd'),require(_0xa541('0xbe')));_0x10a22b[_0xa541('0x7')](_0xa541('0xbf'),require(_0xa541('0xc0')));_0x10a22b[_0xa541('0x7')](_0xa541('0xc1'),require('./api/squareReportDetail'));_0x10a22b[_0xa541('0x7')](_0xa541('0xc2'),require(_0xa541('0xc3')));_0x10a22b[_0xa541('0x7')](_0xa541('0xc4'),require('./api/setting'));_0x10a22b[_0xa541('0x7')](_0xa541('0xc5'),require(_0xa541('0xc6')));_0x10a22b[_0xa541('0x7')](_0xa541('0xc7'),require('./api/squareProject'));_0x10a22b['use'](_0xa541('0xc8'),require(_0xa541('0xc9')));_0x10a22b[_0xa541('0x7')](_0xa541('0xca'),require(_0xa541('0xcb')));_0x10a22b['use']('/api/teams',require('./api/team'));_0x10a22b['use'](_0xa541('0xcc'),require(_0xa541('0xcd')));_0x10a22b[_0xa541('0x7')](_0xa541('0xce'),require(_0xa541('0xcf')));_0x10a22b['use']('/api/migrations',require('./api/migration'));_0x10a22b[_0xa541('0x7')](_0xa541('0xd0'),require(_0xa541('0xd1')));_0x10a22b[_0xa541('0x7')]('/api/plugins',require(_0xa541('0xd2')));_0x10a22b[_0xa541('0x7')](_0xa541('0xd3'),require(_0xa541('0xd4')));_0x10a22b[_0xa541('0x7')](_0xa541('0xd5'),require(_0xa541('0xd6')));_0x10a22b[_0xa541('0x7')]('/api/fax/reports/transfer',require(_0xa541('0xd7')));_0x10a22b[_0xa541('0x7')](_0xa541('0xd8'),require(_0xa541('0xd9')));_0x10a22b[_0xa541('0x7')]('/api/sms/reports/transfer',require(_0xa541('0xda')));_0x10a22b[_0xa541('0x7')](_0xa541('0xdb'),require(_0xa541('0xdc')));_0x10a22b[_0xa541('0x7')](_0xa541('0xdd'),require(_0xa541('0xde')));_0x10a22b[_0xa541('0x7')](_0xa541('0xdf'),require(_0xa541('0xe0')));_0x10a22b['use'](_0xa541('0xe1'),require(_0xa541('0xe2')));_0x10a22b['use']('/api/userProfile/resources',require(_0xa541('0xe3')));_0x10a22b[_0xa541('0x7')]('/api/userNotifications',require(_0xa541('0xe4')));_0x10a22b[_0xa541('0x7')](_0xa541('0xe5'),require(_0xa541('0xe6')));_0x10a22b[_0xa541('0x7')](_0xa541('0xe7'),require('./api/whatsappApplication'));_0x10a22b[_0xa541('0x7')](_0xa541('0xe8'),require(_0xa541('0xe9')));_0x10a22b['use'](_0xa541('0xea'),require(_0xa541('0xeb')));_0x10a22b[_0xa541('0x7')](_0xa541('0xec'),require(_0xa541('0xed')));_0x10a22b[_0xa541('0x7')](_0xa541('0xee'),require(_0xa541('0xef')));_0x10a22b[_0xa541('0x7')](_0xa541('0xf0'),require(_0xa541('0xf1')));_0x10a22b[_0xa541('0x7')](_0xa541('0xf2'),require(_0xa541('0xf3')));_0x10a22b[_0xa541('0x7')](_0xa541('0xf4'),require(_0xa541('0xf5')));_0x10a22b[_0xa541('0x7')](_0xa541('0xf6'),require(_0xa541('0xf7')));_0x10a22b[_0xa541('0x7')](_0xa541('0xf8'),require(_0xa541('0xf9')));_0x10a22b[_0xa541('0x7')](_0xa541('0xfa'),require(_0xa541('0xfb')));_0x10a22b[_0xa541('0x7')]('/api/auth/activedirectory',require(_0xa541('0xfc')));_0x10a22b[_0xa541('0x7')](_0xa541('0xfd'),require(_0xa541('0xfe')));_0x10a22b['use'](_0xa541('0xff'),require(_0xa541('0x100')));_0x10a22b[_0xa541('0x7')](_0xa541('0x101'),require(_0xa541('0x102')));_0x10a22b['use'](_0xa541('0x103'),require(_0xa541('0x104')));_0x10a22b['use'](_0xa541('0x105'),require(_0xa541('0x106')));_0x10a22b[_0xa541('0x7')](_0xa541('0x107'),require('./api/webbar'));_0x10a22b[_0xa541('0x7')]('/api/logs',clientSideLogs);_0x10a22b[_0xa541('0x7')]('/apidoc',express[_0xa541('0x108')](path[_0xa541('0x109')](config[_0xa541('0x10a')],_0xa541('0x10b'))));_0x10a22b['use'](_0xa541('0x10c'),express[_0xa541('0x108')](path['join'](config[_0xa541('0x10a')],_0xa541('0x10c'))));_0x10a22b[_0xa541('0x7')](_0xa541('0x10d'),express['static'](path['join'](config['root'],'/demo')));_0x10a22b[_0xa541('0x7')](_0xa541('0x10e'),express['static'](path[_0xa541('0x109')](config[_0xa541('0x10a')],'snippet',_0xa541('0x10f'))));_0x10a22b[_0xa541('0x7')](_0xa541('0x110'),express['static'](path['join'](config[_0xa541('0x10a')],'/server/files/plugins')));_0x10a22b[_0xa541('0x111')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x10a22b[_0xa541('0x111')]('/*')[_0xa541('0x112')](function(_0x3f0e39,_0x438e4c){_0x438e4c['sendFile'](path[_0xa541('0x113')](_0x10a22b['get'](_0xa541('0x114'))+_0xa541('0x115')));});return _0x10a22b;});};
\ No newline at end of file
+var _0x6d93=['./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','./api/cannedAnswer','/api/conditions','./api/condition','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations'];(function(_0x1c81be,_0x38517f){var _0x3be677=function(_0x46cd36){while(--_0x46cd36){_0x1c81be['push'](_0x1c81be['shift']());}};_0x3be677(++_0x38517f);}(_0x6d93,0x17c));var _0x36d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d93[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x36d9('0x0'));var express=require(_0x36d9('0x1'));var errors=require(_0x36d9('0x2'));var config=require(_0x36d9('0x3'));var setupLoggers=require(_0x36d9('0x4'))[_0x36d9('0x5')];var clientSideLogs=require(_0x36d9('0x6'));exports[_0x36d9('0x7')]=function(_0x296b1c){return setupLoggers(_0x296b1c)[_0x36d9('0x8')](function(){_0x296b1c[_0x36d9('0x9')](_0x36d9('0xa'),require(_0x36d9('0xb')));_0x296b1c[_0x36d9('0x9')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xc'),require(_0x36d9('0xd')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xe'),require(_0x36d9('0xf')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x10'),require(_0x36d9('0x11')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x12'),require(_0x36d9('0x13')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x14'),require('./api/voiceRecording'));_0x296b1c['use']('/api/screen/recordings',require(_0x36d9('0x15')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x16'),require(_0x36d9('0x17')));_0x296b1c[_0x36d9('0x9')]('/api/voice/mails/messages',require(_0x36d9('0x18')));_0x296b1c[_0x36d9('0x9')]('/api/voice/calls/reports',require(_0x36d9('0x19')));_0x296b1c['use'](_0x36d9('0x1a'),require(_0x36d9('0x1b')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x1c'),require(_0x36d9('0x1d')));_0x296b1c[_0x36d9('0x9')]('/api/voice/queues/reports',require(_0x36d9('0x1e')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x1f'),require(_0x36d9('0x20')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x21'),require(_0x36d9('0x22')));_0x296b1c[_0x36d9('0x9')]('/api/voice/transfers/reports',require(_0x36d9('0x23')));_0x296b1c['use'](_0x36d9('0x24'),require('./api/mailServerOut'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x25'),require(_0x36d9('0x26')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x27'),require(_0x36d9('0x28')));_0x296b1c['use'](_0x36d9('0x29'),require(_0x36d9('0x2a')));_0x296b1c['use']('/api/mail/interactions',require('./api/mailInteraction'));_0x296b1c['use'](_0x36d9('0x2b'),require(_0x36d9('0x2c')));_0x296b1c['use'](_0x36d9('0x2d'),require('./api/mailApplication'));_0x296b1c[_0x36d9('0x9')]('/api/mail/reports/queue',require(_0x36d9('0x2e')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x2f'),require(_0x36d9('0x30')));_0x296b1c['use']('/api/dashboards/items',require(_0x36d9('0x31')));_0x296b1c['use']('/api/fax/accounts',require(_0x36d9('0x32')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x33'),require(_0x36d9('0x34')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x35'),require('./api/faxInteraction'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x36'),require(_0x36d9('0x37')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x38'),require(_0x36d9('0x39')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x3a'),require(_0x36d9('0x3b')));_0x296b1c['use'](_0x36d9('0x3c'),require('./api/smsAccount'));_0x296b1c['use'](_0x36d9('0x3d'),require(_0x36d9('0x3e')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x3f'),require('./api/smsInteraction'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x40'),require(_0x36d9('0x41')));_0x296b1c[_0x36d9('0x9')]('/api/sms/queues',require(_0x36d9('0x42')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x43'),require('./api/openchannelAccount'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x44'),require('./api/openchannelApplication'));_0x296b1c['use'](_0x36d9('0x45'),require(_0x36d9('0x46')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x47'),require('./api/openchannelMessage'));_0x296b1c['use'](_0x36d9('0x48'),require('./api/openchannelQueue'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x49'),require(_0x36d9('0x4a')));_0x296b1c['use'](_0x36d9('0x4b'),require(_0x36d9('0x4c')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x4d'),require(_0x36d9('0x4e')));_0x296b1c[_0x36d9('0x9')]('/api/chat/interactions',require('./api/chatInteraction'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x4f'),require(_0x36d9('0x50')));_0x296b1c['use'](_0x36d9('0x51'),require(_0x36d9('0x52')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x53'),require(_0x36d9('0x54')));_0x296b1c['use']('/api/chat/groups',require(_0x36d9('0x55')));_0x296b1c['use'](_0x36d9('0x56'),require(_0x36d9('0x57')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x58'),require('./api/cmCompany'));_0x296b1c['use'](_0x36d9('0x59'),require(_0x36d9('0x5a')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x5b'),require('./api/cmHopper'));_0x296b1c[_0x36d9('0x9')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x5c'),require(_0x36d9('0x5d')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x5e'),require(_0x36d9('0x5f')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x60'),require(_0x36d9('0x61')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x62'),require('./api/action'));_0x296b1c['use'](_0x36d9('0x63'),require(_0x36d9('0x64')));_0x296b1c[_0x36d9('0x9')]('/api/canned_answers',require(_0x36d9('0x65')));_0x296b1c[_0x36d9('0x9')]('/api/dispositions',require('./api/disposition'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x66'),require(_0x36d9('0x67')));_0x296b1c[_0x36d9('0x9')]('/api/intervals',require('./api/interval'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x68'),require('./api/pause'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x69'),require(_0x36d9('0x6a')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x6b'),require('./api/voiceQueuesLog'));_0x296b1c[_0x36d9('0x9')]('/api/schedules',require(_0x36d9('0x6c')));_0x296b1c['use'](_0x36d9('0x6d'),require('./api/sound'));_0x296b1c['use'](_0x36d9('0x6e'),require(_0x36d9('0x6f')));_0x296b1c['use'](_0x36d9('0x70'),require(_0x36d9('0x71')));_0x296b1c['use'](_0x36d9('0x72'),require(_0x36d9('0x73')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x74'),require('./api/cmHopperAdditionalPhone'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x75'),require(_0x36d9('0x76')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x77'),require(_0x36d9('0x78')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x79'),require(_0x36d9('0x7a')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x7b'),require(_0x36d9('0x7c')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x7d'),require('./api/integrationReport'));_0x296b1c['use']('/api/analytics/custom_reports',require(_0x36d9('0x7e')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x7f'),require(_0x36d9('0x80')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x81'),require('./api/analyticExtractedReport'));_0x296b1c[_0x36d9('0x9')]('/api/analytics/metrics',require(_0x36d9('0x82')));_0x296b1c['use'](_0x36d9('0x83'),require('./api/analyticFieldReport'));_0x296b1c['use'](_0x36d9('0x84'),require(_0x36d9('0x85')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x86'),require(_0x36d9('0x87')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x88'),require(_0x36d9('0x89')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x8a'),require('./api/intSalesforceField'));_0x296b1c[_0x36d9('0x9')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x296b1c['use'](_0x36d9('0x8b'),require(_0x36d9('0x8c')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x8d'),require(_0x36d9('0x8e')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x8f'),require(_0x36d9('0x90')));_0x296b1c['use'](_0x36d9('0x91'),require(_0x36d9('0x92')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x93'),require(_0x36d9('0x94')));_0x296b1c['use'](_0x36d9('0x95'),require('./api/intZohoAccount'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x96'),require(_0x36d9('0x97')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x98'),require('./api/intZohoField'));_0x296b1c['use'](_0x36d9('0x99'),require(_0x36d9('0x9a')));_0x296b1c['use'](_0x36d9('0x9b'),require(_0x36d9('0x9c')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x9d'),require('./api/intZendeskField'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x9e'),require('./api/intFreshdeskAccount'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x9f'),require(_0x36d9('0xa0')));_0x296b1c['use']('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x296b1c[_0x36d9('0x9')]('/api/integrations/vtiger/accounts',require(_0x36d9('0xa1')));_0x296b1c['use'](_0x36d9('0xa2'),require(_0x36d9('0xa3')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xa4'),require(_0x36d9('0xa5')));_0x296b1c[_0x36d9('0x9')]('/api/integrations/servicenow/accounts',require(_0x36d9('0xa6')));_0x296b1c[_0x36d9('0x9')]('/api/integrations/servicenow/configurations',require(_0x36d9('0xa7')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xa8'),require('./api/intServicenowField'));_0x296b1c[_0x36d9('0x9')]('/api/integrations/dynamics365/accounts',require(_0x36d9('0xa9')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xaa'),require('./api/intDynamics365Configuration'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xab'),require(_0x36d9('0xac')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xad'),require(_0x36d9('0xae')));_0x296b1c['use'](_0x36d9('0xaf'),require(_0x36d9('0xb0')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xb1'),require(_0x36d9('0xb2')));_0x296b1c[_0x36d9('0x9')]('/api/networks',require(_0x36d9('0xb3')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xb4'),require(_0x36d9('0xb5')));_0x296b1c['use'](_0x36d9('0xb6'),require(_0x36d9('0xb7')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xb8'),require('./api/jscriptyAnswerReport'));_0x296b1c[_0x36d9('0x9')]('/api/jscripty/questions/reports',require(_0x36d9('0xb9')));_0x296b1c[_0x36d9('0x9')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xba'),require(_0x36d9('0xbb')));_0x296b1c['use'](_0x36d9('0xbc'),require(_0x36d9('0xbd')));_0x296b1c[_0x36d9('0x9')]('/api/square/details/reports',require(_0x36d9('0xbe')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xbf'),require(_0x36d9('0xc0')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xc1'),require(_0x36d9('0xc2')));_0x296b1c['use']('/api/square/odbc',require(_0x36d9('0xc3')));_0x296b1c['use'](_0x36d9('0xc4'),require('./api/squareProject'));_0x296b1c['use'](_0x36d9('0xc5'),require(_0x36d9('0xc6')));_0x296b1c[_0x36d9('0x9')]('/api/square/messages',require(_0x36d9('0xc7')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xc8'),require(_0x36d9('0xc9')));_0x296b1c[_0x36d9('0x9')]('/api/license',require(_0x36d9('0xca')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xcb'),require('./api/campaign'));_0x296b1c[_0x36d9('0x9')]('/api/migrations',require('./api/migration'));_0x296b1c['use']('/api/attachments',require(_0x36d9('0xcc')));_0x296b1c['use'](_0x36d9('0xcd'),require('./api/plugin'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xce'),require('./api/mailTransferReport'));_0x296b1c[_0x36d9('0x9')]('/api/chat/reports/transfer',require(_0x36d9('0xcf')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xd0'),require(_0x36d9('0xd1')));_0x296b1c[_0x36d9('0x9')]('/api/openchannel/reports/transfer',require(_0x36d9('0xd2')));_0x296b1c[_0x36d9('0x9')]('/api/sms/reports/transfer',require(_0x36d9('0xd3')));_0x296b1c['use']('/api/cm/lists',require(_0x36d9('0xd4')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xd5'),require(_0x36d9('0xd6')));_0x296b1c['use']('/api/userProfiles',require(_0x36d9('0xd7')));_0x296b1c['use']('/api/userProfile/sections',require(_0x36d9('0xd8')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xd9'),require(_0x36d9('0xda')));_0x296b1c[_0x36d9('0x9')]('/api/userNotifications',require('./api/userNotification'));_0x296b1c['use']('/api/whatsapp/accounts',require(_0x36d9('0xdb')));_0x296b1c['use'](_0x36d9('0xdc'),require('./api/whatsappApplication'));_0x296b1c['use']('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x296b1c[_0x36d9('0x9')]('/api/whatsapp/messages',require(_0x36d9('0xdd')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xde'),require(_0x36d9('0xdf')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xe0'),require(_0x36d9('0xe1')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xe2'),require('./api/whatsappQueue'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xe3'),require('./api/cloudProvider'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xe4'),require('./api/realtime'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xe5'),require(_0x36d9('0xe6')));_0x296b1c['use'](_0x36d9('0xe7'),require(_0x36d9('0xe8')));_0x296b1c['use'](_0x36d9('0xe9'),require(_0x36d9('0xea')));_0x296b1c['use'](_0x36d9('0xeb'),require(_0x36d9('0xec')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xed'),require('./api/jira'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xee'),require('./api/rpc'));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xef'),require('./api/version'));_0x296b1c['use'](_0x36d9('0xf0'),require(_0x36d9('0xf1')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xf2'),require(_0x36d9('0xf3')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xf4'),require(_0x36d9('0xf5')));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xf6'),clientSideLogs);_0x296b1c[_0x36d9('0x9')](_0x36d9('0xf7'),express[_0x36d9('0xf8')](path[_0x36d9('0xf9')](config[_0x36d9('0xfa')],_0x36d9('0xf7'))));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xfb'),express[_0x36d9('0xf8')](path[_0x36d9('0xf9')](config[_0x36d9('0xfa')],_0x36d9('0xfb'))));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xfc'),express['static'](path[_0x36d9('0xf9')](config[_0x36d9('0xfa')],_0x36d9('0xfc'))));_0x296b1c[_0x36d9('0x9')](_0x36d9('0xfd'),express['static'](path[_0x36d9('0xf9')](config[_0x36d9('0xfa')],_0x36d9('0xfe'),_0x36d9('0xff'))));_0x296b1c[_0x36d9('0x9')](_0x36d9('0x100'),express[_0x36d9('0xf8')](path[_0x36d9('0xf9')](config['root'],_0x36d9('0x101'))));_0x296b1c[_0x36d9('0x102')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x36d9('0x103')](errors[0x194]);_0x296b1c[_0x36d9('0x102')]('/*')['get'](function(_0x1db2f1,_0x412c64){_0x412c64[_0x36d9('0x104')](path[_0x36d9('0x105')](_0x296b1c[_0x36d9('0x103')](_0x36d9('0x106'))+'/index.html'));});return _0x296b1c;});};
\ No newline at end of file
index 39facaf..9279e02 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc765=['../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc'];(function(_0x25f2e3,_0x559456){var _0x114124=function(_0x4cebfd){while(--_0x4cebfd){_0x25f2e3['push'](_0x25f2e3['shift']());}};_0x114124(++_0x559456);}(_0xc765,0xf5));var _0x5c76=function(_0x27eb80,_0x11fce3){_0x27eb80=_0x27eb80-0x0;var _0x43e938=_0xc765[_0x27eb80];return _0x43e938;};'use strict';var jayson=require(_0x5c76('0x0'));var _=require(_0x5c76('0x1'));var config=require(_0x5c76('0x2'));exports[_0x5c76('0x3')]=function(){return new Promise(function(_0x316f04,_0x43047d){var _0x181042={};_0x181042=_[_0x5c76('0x4')](_0x181042,require('../api/user/user.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x5')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x6')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x7')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x8')));_0x181042=_['merge'](_0x181042,require(_0x5c76('0x9')));_0x181042=_[_0x5c76('0x4')](_0x181042,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x181042=_['merge'](_0x181042,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x181042=_['merge'](_0x181042,require(_0x5c76('0xa')));_0x181042=_['merge'](_0x181042,require(_0x5c76('0xb')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0xc')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0xd')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0xe')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0xf')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x10')));_0x181042=_['merge'](_0x181042,require('../api/mailInteraction/mailInteraction.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x11')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x12')));_0x181042=_['merge'](_0x181042,require(_0x5c76('0x13')));_0x181042=_['merge'](_0x181042,require('../api/faxAccount/faxAccount.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require('../api/faxApplication/faxApplication.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x14')));_0x181042=_[_0x5c76('0x4')](_0x181042,require('../api/faxMessage/faxMessage.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x15')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x16')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x17')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x18')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x19')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x1a')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x1b')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x1c')));_0x181042=_['merge'](_0x181042,require(_0x5c76('0x1d')));_0x181042=_['merge'](_0x181042,require(_0x5c76('0x1e')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x1f')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x20')));_0x181042=_['merge'](_0x181042,require('../api/chatMessage/chatMessage.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x21')));_0x181042=_[_0x5c76('0x4')](_0x181042,require('../api/cmContact/cmContact.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x22')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x23')));_0x181042=_['merge'](_0x181042,require(_0x5c76('0x24')));_0x181042=_['merge'](_0x181042,require(_0x5c76('0x25')));_0x181042=_['merge'](_0x181042,require(_0x5c76('0x26')));_0x181042=_[_0x5c76('0x4')](_0x181042,require('../api/interval/interval.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require('../api/pause/pause.rpc'));_0x181042=_['merge'](_0x181042,require(_0x5c76('0x27')));_0x181042=_['merge'](_0x181042,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require('../api/template/template.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x28')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x29')));_0x181042=_['merge'](_0x181042,require(_0x5c76('0x2a')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x2b')));_0x181042=_['merge'](_0x181042,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x2c')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x2d')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x2e')));_0x181042=_[_0x5c76('0x4')](_0x181042,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x2f')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x30')));_0x181042=_['merge'](_0x181042,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x31')));_0x181042=_[_0x5c76('0x4')](_0x181042,require('../api/squareReport/squareReport.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x32')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x33')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x34')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x35')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x36')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x37')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x38')));_0x181042=_['merge'](_0x181042,require('../api/plugin/plugin.rpc'));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x39')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x3a')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x3b')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x3c')));_0x181042=_[_0x5c76('0x4')](_0x181042,require(_0x5c76('0x3d')));var _0x376014=jayson[_0x5c76('0x3e')](_0x181042)[_0x5c76('0x3f')]();var _0x20a81a=config[_0x5c76('0x40')][_0x5c76('0x41')]||config[_0x5c76('0x41')]+0x1;var _0x13a400=config[_0x5c76('0x40')]['ip']||_0x5c76('0x42');_0x376014['on'](_0x5c76('0x43'),function(_0x7cdddc){return _0x43047d(_0x7cdddc);});_0x376014[_0x5c76('0x3')](_0x20a81a,_0x13a400,function(){console[_0x5c76('0x44')](_0x5c76('0x45'),_0x13a400,_0x20a81a);require(_0x5c76('0x46'))[_0x5c76('0x47')]();return _0x316f04(_0x5c76('0x48')+_0x13a400+':'+_0x20a81a);});});};
\ No newline at end of file
+var _0x489a=['../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc'];(function(_0x10d575,_0x6edf30){var _0x21ce4a=function(_0x320e92){while(--_0x320e92){_0x10d575['push'](_0x10d575['shift']());}};_0x21ce4a(++_0x6edf30);}(_0x489a,0x66));var _0xa489=function(_0x210ed6,_0x3dffa7){_0x210ed6=_0x210ed6-0x0;var _0x353e65=_0x489a[_0x210ed6];return _0x353e65;};'use strict';var jayson=require(_0xa489('0x0'));var _=require(_0xa489('0x1'));var config=require('../config/environment');exports[_0xa489('0x2')]=function(){return new Promise(function(_0x1d5baf,_0x4e4219){var _0x178628={};_0x178628=_['merge'](_0x178628,require('../api/user/user.rpc'));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x4')));_0x178628=_[_0xa489('0x3')](_0x178628,require('../api/voiceQueue/voiceQueue.rpc'));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x5')));_0x178628=_['merge'](_0x178628,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x178628=_['merge'](_0x178628,require(_0xa489('0x6')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x7')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x8')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x9')));_0x178628=_['merge'](_0x178628,require(_0xa489('0xa')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0xb')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0xc')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0xd')));_0x178628=_['merge'](_0x178628,require(_0xa489('0xe')));_0x178628=_['merge'](_0x178628,require(_0xa489('0xf')));_0x178628=_[_0xa489('0x3')](_0x178628,require('../api/mailInteraction/mailInteraction.rpc'));_0x178628=_[_0xa489('0x3')](_0x178628,require('../api/mailMessage/mailMessage.rpc'));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x10')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x11')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x12')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x13')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x14')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x15')));_0x178628=_[_0xa489('0x3')](_0x178628,require('../api/faxQueue/faxQueue.rpc'));_0x178628=_['merge'](_0x178628,require(_0xa489('0x16')));_0x178628=_['merge'](_0x178628,require('../api/smsAccount/smsAccount.rpc'));_0x178628=_['merge'](_0x178628,require('../api/smsInteraction/smsInteraction.rpc'));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x17')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x18')));_0x178628=_['merge'](_0x178628,require(_0xa489('0x19')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x1a')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x1b')));_0x178628=_[_0xa489('0x3')](_0x178628,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x1c')));_0x178628=_['merge'](_0x178628,require(_0xa489('0x1d')));_0x178628=_['merge'](_0x178628,require(_0xa489('0x1e')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x1f')));_0x178628=_[_0xa489('0x3')](_0x178628,require('../api/cmContact/cmContact.rpc'));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x20')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x21')));_0x178628=_[_0xa489('0x3')](_0x178628,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x22')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x23')));_0x178628=_['merge'](_0x178628,require(_0xa489('0x24')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x25')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x26')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x27')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x28')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x29')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x2a')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x2b')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x2c')));_0x178628=_['merge'](_0x178628,require(_0xa489('0x2d')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x2e')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x2f')));_0x178628=_['merge'](_0x178628,require(_0xa489('0x30')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x31')));_0x178628=_['merge'](_0x178628,require(_0xa489('0x32')));_0x178628=_[_0xa489('0x3')](_0x178628,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x178628=_[_0xa489('0x3')](_0x178628,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x33')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x34')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x35')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x36')));_0x178628=_['merge'](_0x178628,require(_0xa489('0x37')));_0x178628=_['merge'](_0x178628,require(_0xa489('0x38')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x39')));_0x178628=_[_0xa489('0x3')](_0x178628,require('../api/squareRecording/squareRecording.rpc'));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x3a')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x3b')));_0x178628=_[_0xa489('0x3')](_0x178628,require('../api/attachment/attachment.rpc'));_0x178628=_['merge'](_0x178628,require(_0xa489('0x3c')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x3d')));_0x178628=_['merge'](_0x178628,require(_0xa489('0x3e')));_0x178628=_['merge'](_0x178628,require(_0xa489('0x3f')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x40')));_0x178628=_[_0xa489('0x3')](_0x178628,require(_0xa489('0x41')));var _0x440803=jayson['server'](_0x178628)[_0xa489('0x42')]();var _0x55ee0c=config[_0xa489('0x43')][_0xa489('0x44')]||config[_0xa489('0x44')]+0x1;var _0x22f775=config[_0xa489('0x43')]['ip']||_0xa489('0x45');_0x440803['on']('error',function(_0xb22465){return _0x4e4219(_0xb22465);});_0x440803[_0xa489('0x2')](_0x55ee0c,_0x22f775,function(){console[_0xa489('0x46')](_0xa489('0x47'),_0x22f775,_0x55ee0c);require('../config/triggers')[_0xa489('0x48')]();return _0x1d5baf(_0xa489('0x49')+_0x22f775+':'+_0x55ee0c);});});};
\ No newline at end of file
index 8590c76..f6241bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f8d=['toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','substring','520-Invalid','function','no\x20code','result=','indexOf','substr','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','answer','getData','beep','format','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','hangup','setVariable','isBoolean'];(function(_0x5955ed,_0x1d894a){var _0x3c4126=function(_0x1deebd){while(--_0x1deebd){_0x5955ed['push'](_0x5955ed['shift']());}};_0x3c4126(++_0x1d894a);}(_0x9f8d,0xb0));var _0xd9f8=function(_0x58a6b5,_0xc2d1d7){_0x58a6b5=_0x58a6b5-0x0;var _0x4960d9=_0x9f8d[_0x58a6b5];return _0x4960d9;};'use strict';var util=require(_0xd9f8('0x0'));var _=require(_0xd9f8('0x1'));var EventEmitter=require(_0xd9f8('0x2'))[_0xd9f8('0x3')];var AGIReply=require(_0xd9f8('0x4'));var AGIError=require(_0xd9f8('0x5'));function AGIChannel(_0x3e12d6){var _0x3ebc5b=this,_0x2d4d8f=new AGIReply(),_0x42235d=![],_0x6331={};EventEmitter[_0xd9f8('0x6')](_0x3ebc5b);_0x3e12d6[_0xd9f8('0x7')](_0xd9f8('0x8'));_0x3e12d6[_0xd9f8('0x9')](0x8*0x3c*0x3c*0x3e8);_0x2d4d8f[_0xd9f8('0x7')](_0xd9f8('0x8'));_0x2d4d8f['on']('headers',function(_0x327109){for(var _0x5dae2e in _0x327109){_0x3ebc5b[_0x5dae2e]=_0x327109[_0x5dae2e];}_0x3ebc5b[_0xd9f8('0xa')](_0xd9f8('0xb'));});_0x2d4d8f['on'](_0xd9f8('0xc'),function(_0x2c96e5){if(_0x2c96e5[_0xd9f8('0xd')]()=='hangup'){_0x3ebc5b[_0xd9f8('0xa')]('hangup');return;}if(_0x2c96e5[_0xd9f8('0xe')](0x0,0xb)==_0xd9f8('0xf')){_0x42235d=!![];}if(_0x42235d){_0x6331['rx']+=_0x2c96e5+'\x0a';if(_0x2c96e5['search']('520\x20End\x20of\x20proper')!=-0x1){_0x42235d=![];}}else{_0x6331['rx']=_0x2c96e5;}if(_0x42235d){return;}if(typeof _0x6331['cb']==_0xd9f8('0x10')){var _0x1a555e=_0x6331['rx'][_0xd9f8('0xe')](0x0,0x3),_0x514f24=null,_0x22c5c3=null;_0x1a555e=parseInt(_0x1a555e);if(isNaN(_0x1a555e)){_0x6331['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xd9f8('0x11')});return;}if(_0x1a555e!=0xc8){_0x6331['cb'](null,{'code':_0x1a555e,'result':-0x1,'extra':'KO'});return;}_0x514f24=_0x6331['rx']['substring'](0x4)['replace'](_0xd9f8('0x12'),'');if(_0x514f24[_0xd9f8('0x13')]('\x20')!=-0x1){_0x514f24=_0x514f24[_0xd9f8('0x14')](0x0,_0x514f24['indexOf']('\x20'));}if(_['startsWith'](_0x514f24,'-1')){_0x514f24=parseInt(_0x514f24);}_0x22c5c3=_0x6331['rx'][_0xd9f8('0x15')]('\x20');if(_0x22c5c3[_0xd9f8('0x16')]==0x3){_0x22c5c3=_0x22c5c3[0x2]['substring'](0x1,_0x22c5c3[0x2]['length']-0x1);}else if(_0x22c5c3[_0xd9f8('0x16')]>0x3){var _0x22940a=/\((.+)\)/;var _0x249d14=_0x6331['rx'][_0xd9f8('0x17')](_0x22940a);if(_0x249d14){_0x22c5c3=_0x249d14[0x1];}else{_0x22c5c3=null;}}else{_0x22c5c3=null;}_0x6331['cb'](null,{'code':_0x1a555e,'result':_0x514f24,'extra':_0x22c5c3});}});_0x3e12d6['on'](_0xd9f8('0x18'),function(_0x2ac64a){_0x3ebc5b[_0xd9f8('0xa')](_0xd9f8('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x2ac64a[_0xd9f8('0x19')]));});_0x3e12d6['on'](_0xd9f8('0x1a'),function(){_0x3ebc5b[_0xd9f8('0xa')]('close',new AGIError(_0xd9f8('0x1b')));});_0x3e12d6['on']('timeout',function(){_0x3ebc5b[_0xd9f8('0xa')]('timeout',new AGIError(_0xd9f8('0x1c')));_0x3e12d6[_0xd9f8('0x1d')]();});_0x3e12d6[_0xd9f8('0x1e')](_0x2d4d8f);this[_0xd9f8('0x1f')]=function(_0x39eefb,_0x142f6d){var _0x39eefb=_0x39eefb||'',_0x142f6d=typeof _0x142f6d==_0xd9f8('0x10')?_0x142f6d:new Function();_0x6331={'tx':_0x39eefb,'rx':'','cb':_0x142f6d};_0x3e12d6['write'](_0x39eefb+'\x0a');},this['close']=function(){_0x3e12d6[_0xd9f8('0x1d')]();};}util[_0xd9f8('0x20')](AGIChannel,EventEmitter);AGIChannel[_0xd9f8('0x21')][_0xd9f8('0x22')]=function(_0xdf2ed5){return this[_0xd9f8('0x1f')][_0xd9f8('0x23')](this,_0xdf2ed5);};AGIChannel[_0xd9f8('0x21')][_0xd9f8('0x24')]=function(){return this[_0xd9f8('0x22')]('ANSWER');};AGIChannel[_0xd9f8('0x21')][_0xd9f8('0x25')]=function(_0x198922,_0x47d660,_0x2c402b){_0x198922=_0x198922===undefined?_0xd9f8('0x26'):_0x198922;_0x47d660=_0x47d660===undefined?'5':_0x47d660;_0x2c402b=_0x2c402b===undefined?'1':_0x2c402b;return this[_0xd9f8('0x22')](util[_0xd9f8('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x198922,_0x47d660*0x3e8,_0x2c402b));};AGIChannel['prototype']['noop']=function(_0x4d9a49){_0x4d9a49=_0x4d9a49||_0xd9f8('0x28');return this[_0xd9f8('0x22')](util[_0xd9f8('0x27')](_0xd9f8('0x29'),_0x4d9a49));};AGIChannel[_0xd9f8('0x21')][_0xd9f8('0x2a')]=function(_0x4f980f,_0x2e1461){if(_[_0xd9f8('0x2b')](_0x2e1461)){return this['sendRequest'](util[_0xd9f8('0x27')](_0xd9f8('0x2c'),_0x4f980f,_0x2e1461[_0xd9f8('0x2d')](',')));}return this[_0xd9f8('0x22')](util[_0xd9f8('0x27')](_0xd9f8('0x2c'),_0x4f980f,_0x2e1461));};AGIChannel['prototype'][_0xd9f8('0x2e')]=function(_0x5ee077){return this[_0xd9f8('0x22')](util['format'](_0xd9f8('0x2f'),_0x5ee077));};AGIChannel[_0xd9f8('0x21')][_0xd9f8('0x30')]=function(_0x3cc216){return this[_0xd9f8('0x22')](util[_0xd9f8('0x27')](_0xd9f8('0x31'),_0x3cc216));};AGIChannel['prototype'][_0xd9f8('0x32')]=function(_0x96b38e){return this[_0xd9f8('0x22')](util[_0xd9f8('0x27')](_0xd9f8('0x33'),_0x96b38e));};AGIChannel['prototype'][_0xd9f8('0x34')]=function(){return this[_0xd9f8('0x22')]('HANGUP');};AGIChannel[_0xd9f8('0x21')][_0xd9f8('0x35')]=function(_0x26e54c,_0x725237){var _0x191f6a=_[_0xd9f8('0x36')](_0x725237)||_['isNumber'](_0x725237)?_0x725237[_0xd9f8('0x37')]():_0x725237;return this[_0xd9f8('0x22')](util[_0xd9f8('0x27')](_0xd9f8('0x38'),_0x26e54c,_0x191f6a?_0x191f6a[_0xd9f8('0x37')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xd9f8('0x21')][_0xd9f8('0x39')]=function(_0x9a0df9,_0xa3fb5d){return this[_0xd9f8('0x22')](util['format'](_0xd9f8('0x3a'),_0x9a0df9,_0xa3fb5d));};AGIChannel[_0xd9f8('0x21')][_0xd9f8('0x3b')]=function(_0x30b969,_0x23681c){return this[_0xd9f8('0x22')](util['format'](_0xd9f8('0x3c'),_0x30b969,_0x23681c));};AGIChannel[_0xd9f8('0x21')][_0xd9f8('0x3d')]=function(_0x2a5a90,_0x280f63){return this[_0xd9f8('0x22')](util[_0xd9f8('0x27')](_0xd9f8('0x3e'),_0x2a5a90,_0x280f63));};AGIChannel['prototype'][_0xd9f8('0x3f')]=function(_0x12a3ef,_0x5620c4,_0x56e7c9){_0x5620c4=_0x5620c4||this[_0xd9f8('0x40')];_0x56e7c9=_0x56e7c9||0x1;this[_0xd9f8('0x2e')](_0x12a3ef);this['setExtension'](_0x5620c4);this[_0xd9f8('0x32')](_0x56e7c9);return this[_0xd9f8('0x41')](util[_0xd9f8('0x27')]('GOTO\x20%s\x20%s\x20%s',_0x12a3ef,_0x5620c4,_0x56e7c9));};AGIChannel[_0xd9f8('0x21')][_0xd9f8('0x42')]=function(_0x40cb88){return this['sendRequest'](util[_0xd9f8('0x27')](_0xd9f8('0x43'),_0x40cb88));};AGIChannel[_0xd9f8('0x21')][_0xd9f8('0x44')]=function(_0x40f140,_0x193fb6,_0x5badcf,_0x12416f,_0x1c9d87,_0x3997ba){_0x193fb6=_0x193fb6||_0xd9f8('0x45');_0x5badcf=_0x5badcf||'';_0x12416f=_0x12416f===undefined?-0x1:_0x12416f==='-1'?-0x1:_0x12416f*0x3e8;_0x1c9d87=_0x1c9d87===undefined?'':'s='+_0x1c9d87;_0x3997ba=_0x3997ba?_0xd9f8('0x46'):'';return this[_0xd9f8('0x22')](util[_0xd9f8('0x27')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x40f140,_0x193fb6,_0x5badcf,_0x12416f,_0x3997ba,_0x1c9d87));};AGIChannel[_0xd9f8('0x21')][_0xd9f8('0x47')]=function(_0x36515d,_0x59f61d){_0x59f61d=_0x59f61d||'';return this[_0xd9f8('0x22')](util[_0xd9f8('0x27')](_0xd9f8('0x48'),_0x36515d,_0x59f61d));};AGIChannel[_0xd9f8('0x21')][_0xd9f8('0x49')]=function(_0x237558){return this[_0xd9f8('0x2a')](_0xd9f8('0x4a'),_0x237558);};AGIChannel[_0xd9f8('0x21')][_0xd9f8('0x4b')]=function(_0x36ce20){return this[_0xd9f8('0x2a')](_0xd9f8('0x4c'),_0x36ce20);};AGIChannel[_0xd9f8('0x21')][_0xd9f8('0x18')]=function(_0x18bdf3,_0x5c169c){this[_0xd9f8('0x41')](util[_0xd9f8('0x27')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x18bdf3['id'],_0x18bdf3['label'],_0x5c169c));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel;
\ No newline at end of file
+var _0xa7b3=['setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sync','answer','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','join','setContext','SET\x20CONTEXT\x20%s'];(function(_0x5eb666,_0x26d604){var _0x29d1be=function(_0x57ae49){while(--_0x57ae49){_0x5eb666['push'](_0x5eb666['shift']());}};_0x29d1be(++_0x26d604);}(_0xa7b3,0x1ee));var _0x3a7b=function(_0x3b3659,_0xe3b58f){_0x3b3659=_0x3b3659-0x0;var _0x409b41=_0xa7b3[_0x3b3659];return _0x409b41;};'use strict';var util=require('util');var _=require(_0x3a7b('0x0'));var EventEmitter=require(_0x3a7b('0x1'))[_0x3a7b('0x2')];var AGIReply=require(_0x3a7b('0x3'));var AGIError=require(_0x3a7b('0x4'));function AGIChannel(_0x32489b){var _0x2bd76a=this,_0x48fa01=new AGIReply(),_0x29c779=![],_0xac38b6={};EventEmitter['call'](_0x2bd76a);_0x32489b[_0x3a7b('0x5')](_0x3a7b('0x6'));_0x32489b['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x48fa01['setEncoding'](_0x3a7b('0x6'));_0x48fa01['on'](_0x3a7b('0x7'),function(_0x5c0e3c){for(var _0x40e0fe in _0x5c0e3c){_0x2bd76a[_0x40e0fe]=_0x5c0e3c[_0x40e0fe];}_0x2bd76a[_0x3a7b('0x8')]('ready');});_0x48fa01['on'](_0x3a7b('0x9'),function(_0x1c0b50){if(_0x1c0b50[_0x3a7b('0xa')]()==_0x3a7b('0xb')){_0x2bd76a[_0x3a7b('0x8')](_0x3a7b('0xb'));return;}if(_0x1c0b50['substring'](0x0,0xb)==_0x3a7b('0xc')){_0x29c779=!![];}if(_0x29c779){_0xac38b6['rx']+=_0x1c0b50+'\x0a';if(_0x1c0b50[_0x3a7b('0xd')](_0x3a7b('0xe'))!=-0x1){_0x29c779=![];}}else{_0xac38b6['rx']=_0x1c0b50;}if(_0x29c779){return;}if(typeof _0xac38b6['cb']==_0x3a7b('0xf')){var _0x133c7d=_0xac38b6['rx'][_0x3a7b('0x10')](0x0,0x3),_0x4ff3d9=null,_0xf81721=null;_0x133c7d=parseInt(_0x133c7d);if(isNaN(_0x133c7d)){_0xac38b6['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3a7b('0x11')});return;}if(_0x133c7d!=0xc8){_0xac38b6['cb'](null,{'code':_0x133c7d,'result':-0x1,'extra':'KO'});return;}_0x4ff3d9=_0xac38b6['rx'][_0x3a7b('0x10')](0x4)[_0x3a7b('0x12')](_0x3a7b('0x13'),'');if(_0x4ff3d9['indexOf']('\x20')!=-0x1){_0x4ff3d9=_0x4ff3d9[_0x3a7b('0x14')](0x0,_0x4ff3d9[_0x3a7b('0x15')]('\x20'));}if(_[_0x3a7b('0x16')](_0x4ff3d9,'-1')){_0x4ff3d9=parseInt(_0x4ff3d9);}_0xf81721=_0xac38b6['rx'][_0x3a7b('0x17')]('\x20');if(_0xf81721[_0x3a7b('0x18')]==0x3){_0xf81721=_0xf81721[0x2]['substring'](0x1,_0xf81721[0x2]['length']-0x1);}else if(_0xf81721[_0x3a7b('0x18')]>0x3){var _0x9acdea=/\((.+)\)/;var _0x5d4c28=_0xac38b6['rx'][_0x3a7b('0x19')](_0x9acdea);if(_0x5d4c28){_0xf81721=_0x5d4c28[0x1];}else{_0xf81721=null;}}else{_0xf81721=null;}_0xac38b6['cb'](null,{'code':_0x133c7d,'result':_0x4ff3d9,'extra':_0xf81721});}});_0x32489b['on'](_0x3a7b('0x1a'),function(_0x2cf0eb){_0x2bd76a[_0x3a7b('0x8')](_0x3a7b('0x1a'),new AGIError(_0x3a7b('0x1b'),_0x2cf0eb[_0x3a7b('0x1c')]));});_0x32489b['on'](_0x3a7b('0x1d'),function(){_0x2bd76a[_0x3a7b('0x8')]('close',new AGIError(_0x3a7b('0x1e')));});_0x32489b['on'](_0x3a7b('0x1f'),function(){_0x2bd76a[_0x3a7b('0x8')]('timeout',new AGIError(_0x3a7b('0x20')));_0x32489b[_0x3a7b('0x21')]();});_0x32489b[_0x3a7b('0x22')](_0x48fa01);this[_0x3a7b('0x23')]=function(_0x36fd46,_0x129ec7){var _0x36fd46=_0x36fd46||'',_0x129ec7=typeof _0x129ec7==_0x3a7b('0xf')?_0x129ec7:new Function();_0xac38b6={'tx':_0x36fd46,'rx':'','cb':_0x129ec7};_0x32489b['write'](_0x36fd46+'\x0a');},this[_0x3a7b('0x1d')]=function(){_0x32489b[_0x3a7b('0x21')]();};}util[_0x3a7b('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x3a7b('0x25')]['sendRequest']=function(_0x530c57){return this[_0x3a7b('0x23')][_0x3a7b('0x26')](this,_0x530c57);};AGIChannel[_0x3a7b('0x25')][_0x3a7b('0x27')]=function(){return this[_0x3a7b('0x28')](_0x3a7b('0x29'));};AGIChannel[_0x3a7b('0x25')][_0x3a7b('0x2a')]=function(_0x52e077,_0x2c2618,_0x569433){_0x52e077=_0x52e077===undefined?_0x3a7b('0x2b'):_0x52e077;_0x2c2618=_0x2c2618===undefined?'5':_0x2c2618;_0x569433=_0x569433===undefined?'1':_0x569433;return this[_0x3a7b('0x28')](util[_0x3a7b('0x2c')](_0x3a7b('0x2d'),_0x52e077,_0x2c2618*0x3e8,_0x569433));};AGIChannel[_0x3a7b('0x25')][_0x3a7b('0x2e')]=function(_0x18c464){_0x18c464=_0x18c464||_0x3a7b('0x2f');return this['sendRequest'](util['format']('VERBOSE\x20\x22%s\x22',_0x18c464));};AGIChannel[_0x3a7b('0x25')][_0x3a7b('0x30')]=function(_0x5d0997,_0x26dc60){if(_['isArray'](_0x26dc60)){return this[_0x3a7b('0x28')](util[_0x3a7b('0x2c')]('EXEC\x20%s\x20%s',_0x5d0997,_0x26dc60[_0x3a7b('0x31')](',')));}return this[_0x3a7b('0x28')](util['format']('EXEC\x20%s\x20%s',_0x5d0997,_0x26dc60));};AGIChannel['prototype'][_0x3a7b('0x32')]=function(_0x12ee57){return this[_0x3a7b('0x28')](util[_0x3a7b('0x2c')](_0x3a7b('0x33'),_0x12ee57));};AGIChannel[_0x3a7b('0x25')][_0x3a7b('0x34')]=function(_0x381750){return this[_0x3a7b('0x28')](util[_0x3a7b('0x2c')]('SET\x20EXTENSION\x20%s',_0x381750));};AGIChannel[_0x3a7b('0x25')][_0x3a7b('0x35')]=function(_0x2df9fa){return this[_0x3a7b('0x28')](util[_0x3a7b('0x2c')](_0x3a7b('0x36'),_0x2df9fa));};AGIChannel['prototype']['hangup']=function(){return this[_0x3a7b('0x28')](_0x3a7b('0x37'));};AGIChannel['prototype'][_0x3a7b('0x38')]=function(_0x706243,_0x3aeb94){var _0x21bae8=_[_0x3a7b('0x39')](_0x3aeb94)||_[_0x3a7b('0x3a')](_0x3aeb94)?_0x3aeb94[_0x3a7b('0x3b')]():_0x3aeb94;return this[_0x3a7b('0x28')](util[_0x3a7b('0x2c')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x706243,_0x21bae8?_0x21bae8[_0x3a7b('0x3b')]()[_0x3a7b('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3a7b('0x25')][_0x3a7b('0x3c')]=function(_0x3b3c07,_0x397594){return this[_0x3a7b('0x28')](util['format'](_0x3a7b('0x3d'),_0x3b3c07,_0x397594));};AGIChannel[_0x3a7b('0x25')]['sayDigits']=function(_0x54da2a,_0x56a7de){return this[_0x3a7b('0x28')](util[_0x3a7b('0x2c')](_0x3a7b('0x3e'),_0x54da2a,_0x56a7de));};AGIChannel['prototype']['sayPhonetic']=function(_0x3b3b26,_0x129463){return this['sendRequest'](util[_0x3a7b('0x2c')](_0x3a7b('0x3f'),_0x3b3b26,_0x129463));};AGIChannel[_0x3a7b('0x25')][_0x3a7b('0x40')]=function(_0x11bd3b,_0x31b1c3,_0x44bac9){_0x31b1c3=_0x31b1c3||this['extension'];_0x44bac9=_0x44bac9||0x1;this[_0x3a7b('0x32')](_0x11bd3b);this[_0x3a7b('0x34')](_0x31b1c3);this[_0x3a7b('0x35')](_0x44bac9);return this[_0x3a7b('0x2e')](util['format'](_0x3a7b('0x41'),_0x11bd3b,_0x31b1c3,_0x44bac9));};AGIChannel['prototype'][_0x3a7b('0x42')]=function(_0x3230d0){return this[_0x3a7b('0x28')](util[_0x3a7b('0x2c')](_0x3a7b('0x43'),_0x3230d0));};AGIChannel[_0x3a7b('0x25')]['recordFile']=function(_0x1ebfb3,_0x14e883,_0x3ddd59,_0x2684fd,_0x3bd42e,_0x59d41f){_0x14e883=_0x14e883||_0x3a7b('0x44');_0x3ddd59=_0x3ddd59||'';_0x2684fd=_0x2684fd===undefined?-0x1:_0x2684fd==='-1'?-0x1:_0x2684fd*0x3e8;_0x3bd42e=_0x3bd42e===undefined?'':'s='+_0x3bd42e;_0x59d41f=_0x59d41f?_0x3a7b('0x45'):'';return this[_0x3a7b('0x28')](util[_0x3a7b('0x2c')](_0x3a7b('0x46'),_0x1ebfb3,_0x14e883,_0x3ddd59,_0x2684fd,_0x59d41f,_0x3bd42e));};AGIChannel[_0x3a7b('0x25')][_0x3a7b('0x47')]=function(_0x4f4168,_0x6157b2){_0x6157b2=_0x6157b2||'';return this['sendRequest'](util[_0x3a7b('0x2c')](_0x3a7b('0x48'),_0x4f4168,_0x6157b2));};AGIChannel[_0x3a7b('0x25')][_0x3a7b('0x49')]=function(_0x2760b5){return this[_0x3a7b('0x30')]('AGI',_0x2760b5);};AGIChannel[_0x3a7b('0x25')]['wait']=function(_0xfd3656){return this[_0x3a7b('0x30')](_0x3a7b('0x4a'),_0xfd3656);};AGIChannel['prototype'][_0x3a7b('0x1a')]=function(_0x438d29,_0x5e4104){this[_0x3a7b('0x2e')](util[_0x3a7b('0x2c')](_0x3a7b('0x4b'),_0x438d29['id'],_0x438d29[_0x3a7b('0x4c')],_0x5e4104));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3a7b('0x4d')]=AGIChannel;
\ No newline at end of file
index 2653af1..77a5c48 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x58b1=['Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','E_AGI_UNDEFINED','push','format','message','exports','util'];(function(_0x55a2bc,_0x5477e7){var _0x2f6b9a=function(_0x519967){while(--_0x519967){_0x55a2bc['push'](_0x55a2bc['shift']());}};_0x2f6b9a(++_0x5477e7);}(_0x58b1,0x1db));var _0x158b=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0x58b1[_0x188a93];return _0x23b40d;};'use strict';var util=require(_0x158b('0x0'));var error={'E_AGI_UNDEFINED':_0x158b('0x1'),'E_AGI_ARGUMENT_PORT':_0x158b('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x158b('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x158b('0x4'),'E_AGI_SOCKET_ERROR':_0x158b('0x5'),'E_AGI_SOCKET_CLOSE':_0x158b('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x158b('0x7'),'E_AGI_COMMAND_EMPTY':_0x158b('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x259aeb){var _0x259aeb=_0x259aeb||null,_0x353f98=_0x353f98||[],_0x4b2c14=0x1,_0x30f879='';if(!error[_0x259aeb]){_0x259aeb=_0x158b('0x9');}_0x353f98[_0x158b('0xa')](error[_0x259aeb]);while(arguments[_0x4b2c14]){_0x353f98[_0x158b('0xa')](arguments[_0x4b2c14]);_0x4b2c14++;}_0x30f879=util[_0x158b('0xb')]['apply'](util,_0x353f98);this[_0x158b('0xc')]=_0x30f879;this['name']=_0x259aeb;}module[_0x158b('0xd')]=AGIError;
\ No newline at end of file
+var _0x9430=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','push','apply','message','exports','util','Undefined\x20error.','Server\x20closed.'];(function(_0x2b4102,_0x153bbc){var _0x17d30b=function(_0x36615e){while(--_0x36615e){_0x2b4102['push'](_0x2b4102['shift']());}};_0x17d30b(++_0x153bbc);}(_0x9430,0xed));var _0x0943=function(_0x29bfae,_0x25ca8b){_0x29bfae=_0x29bfae-0x0;var _0x226065=_0x9430[_0x29bfae];return _0x226065;};'use strict';var util=require(_0x0943('0x0'));var error={'E_AGI_UNDEFINED':_0x0943('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x0943('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x0943('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x0943('0x4'),'E_AGI_SOCKET_CLOSE':_0x0943('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x0943('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x0943('0x7'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x3c3753){var _0x3c3753=_0x3c3753||null,_0x334a10=_0x334a10||[],_0xa377f1=0x1,_0x189916='';if(!error[_0x3c3753]){_0x3c3753='E_AGI_UNDEFINED';}_0x334a10['push'](error[_0x3c3753]);while(arguments[_0xa377f1]){_0x334a10[_0x0943('0x8')](arguments[_0xa377f1]);_0xa377f1++;}_0x189916=util['format'][_0x0943('0x9')](util,_0x334a10);this[_0x0943('0xa')]=_0x189916;this['name']=_0x3c3753;}module[_0x0943('0xb')]=AGIError;
\ No newline at end of file
index eb0eb14..083ab6d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1903=['localhost','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x1903,0xad));var _0x3190=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1903[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var EventEmitter=require(_0x3190('0x0'))[_0x3190('0x1')];var Redis=require(_0x3190('0x2'));var AGIError=require(_0x3190('0x3'));var config=require(_0x3190('0x4'));config[_0x3190('0x5')]=_[_0x3190('0x6')](config[_0x3190('0x5')],{'host':_0x3190('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe'](_0x3190('0x8'),function(_0x3b337d){if(_0x3b337d)return eventEmitter[_0x3190('0x9')](_0x3190('0xa'),new AGIError(_0x3190('0xb'),_0x3b337d));});sub['on'](_0x3190('0xc'),function(_0x4fe2f6,_0x5b184f){if(_0x4fe2f6!=='agi')return;try{var _0x2b6697=JSON[_0x3190('0xd')](_0x5b184f);eventEmitter['emit'](_0x3190('0xe'),_0x2b6697);}catch(_0x22ac88){eventEmitter[_0x3190('0x9')]('error',new AGIError(_0x3190('0xb'),_0x22ac88));}});module['exports']={'EventEmitter':eventEmitter};
\ No newline at end of file
+var _0x76de=['defaults','localhost','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash','ioredis','./error','redis'];(function(_0x53a34c,_0x25cffd){var _0x3dda74=function(_0x559ccd){while(--_0x559ccd){_0x53a34c['push'](_0x53a34c['shift']());}};_0x3dda74(++_0x25cffd);}(_0x76de,0x6c));var _0xe76d=function(_0x2d3754,_0x2c1957){_0x2d3754=_0x2d3754-0x0;var _0x1078b7=_0x76de[_0x2d3754];return _0x1078b7;};'use strict';var _=require(_0xe76d('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require(_0xe76d('0x1'));var AGIError=require(_0xe76d('0x2'));var config=require('../../config/environment');config[_0xe76d('0x3')]=_[_0xe76d('0x4')](config[_0xe76d('0x3')],{'host':_0xe76d('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xe76d('0x3')]);sub['subscribe'](_0xe76d('0x6'),function(_0x420ce2){if(_0x420ce2)return eventEmitter[_0xe76d('0x7')](_0xe76d('0x8'),new AGIError(_0xe76d('0x9'),_0x420ce2));});sub['on'](_0xe76d('0xa'),function(_0xaf27c1,_0x16605c){if(_0xaf27c1!=='agi')return;try{var _0x56cfb4=JSON[_0xe76d('0xb')](_0x16605c);eventEmitter['emit'](_0xe76d('0xc'),_0x56cfb4);}catch(_0x35b28f){eventEmitter['emit']('error',new AGIError(_0xe76d('0x9'),_0x35b28f));}});module[_0xe76d('0xd')]={'EventEmitter':eventEmitter};
\ No newline at end of file
index bb5afd2..f44c5ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x63ad=['agi','menu','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','getVertex','traverseBFS','info','stop\x20traverse','length','condition','agicommand','default','target','invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','../../../config/logger'];(function(_0x22ea66,_0x30123a){var _0x529757=function(_0x2340e){while(--_0x2340e){_0x22ea66['push'](_0x22ea66['shift']());}};_0x529757(++_0x30123a);}(_0x63ad,0x15e));var _0xd63a=function(_0x1d28ea,_0x1a322e){_0x1d28ea=_0x1d28ea-0x0;var _0x5bd061=_0x63ad[_0x1d28ea];return _0x5bd061;};'use strict';var _=require('lodash');var logger=require(_0xd63a('0x0'))(_0xd63a('0x1'));var verticesWithRetry=[_0xd63a('0x2'),'getdigits','getsecretdigits'];var Graph=function(){this[_0xd63a('0x3')]={};this[_0xd63a('0x4')]={};this[_0xd63a('0x5')]=0x0;};Graph[_0xd63a('0x6')][_0xd63a('0x7')]=function(_0x3af862){this['vertices'][_0x3af862['id']]=_0x3af862;this[_0xd63a('0x4')][_0x3af862['id']]=[];};Graph['prototype'][_0xd63a('0x8')]=function(_0x4ad4eb,_0x11072a,_0x4bb4bc){this[_0xd63a('0x4')][_0x4ad4eb][_0xd63a('0x9')]({'target':_0x11072a,'condition':_0x4bb4bc});this[_0xd63a('0x5')]+=0x1;};Graph['prototype'][_0xd63a('0xa')]=function(){return _['size'](this['vertices']);};Graph[_0xd63a('0x6')]['relations']=function(){return this[_0xd63a('0x5')];};Graph['prototype'][_0xd63a('0xb')]=function(_0x1ffffd){return this[_0xd63a('0x3')][_0x1ffffd];};Graph[_0xd63a('0x6')][_0xd63a('0xc')]=function(_0x5920ab,_0x3e3770){if(!this[_0xd63a('0x3')][_0x5920ab]){return logger[_0xd63a('0xd')]('no\x20vertex\x20found');}var _0x3f4dd7=_0x3e3770(this[_0xd63a('0x3')][_0x5920ab]);if(!_0x3f4dd7){return logger[_0xd63a('0xd')](_0xd63a('0xe'));}if(this[_0xd63a('0x4')][_0x5920ab][_0xd63a('0xf')]===0x0){return logger[_0xd63a('0xd')]('no\x20edge/s\x20available');}for(var _0x3f2673=0x0,_0x1ee407=[],_0x47eb14=![];_0x3f2673<this[_0xd63a('0x4')][_0x5920ab][_0xd63a('0xf')];_0x3f2673+=0x1){if(this[_0xd63a('0x4')][_0x5920ab][_0x3f2673][_0xd63a('0x10')]){_0x1ee407=this['edges'][_0x5920ab][_0x3f2673][_0xd63a('0x10')]['split'](',');for(var _0x130b06=0x0;_0x130b06<_0x1ee407[_0xd63a('0xf')];_0x130b06+=0x1){if(this[_0xd63a('0x3')][_0x5920ab][_0xd63a('0x11')]==='vswitch'&&_0x1ee407[_0x130b06]==='-'){_0x47eb14=this[_0xd63a('0x4')][_0x5920ab][_0x3f2673]['target'];logger['info'](_0xd63a('0x12'),_0x1ee407[_0x130b06],this['edges'][_0x5920ab][_0x3f2673]['target']);}else if(this['vertices'][_0x5920ab][_0xd63a('0x11')]===_0xd63a('0x2')&&_0x1ee407[_0x130b06]==='i'){_0x47eb14=this[_0xd63a('0x4')][_0x5920ab][_0x3f2673][_0xd63a('0x13')];logger[_0xd63a('0xd')](_0xd63a('0x14'),_0x1ee407[_0x130b06],this[_0xd63a('0x4')][_0x5920ab][_0x3f2673]['target']);}if(_0x1ee407[_0x130b06]===_0x3f4dd7){return this[_0xd63a('0xc')](this[_0xd63a('0x4')][_0x5920ab][_0x3f2673][_0xd63a('0x13')],_0x3e3770);}}}else{return this['traverseBFS'](this[_0xd63a('0x4')][_0x5920ab][_0x3f2673][_0xd63a('0x13')],_0x3e3770);}}if(_0x1ee407['length']){if(this[_0xd63a('0x3')][_0x5920ab]['agicommand']===_0xd63a('0x15')){if(_0x47eb14){return this[_0xd63a('0xc')](_0x47eb14,_0x3e3770);}return logger[_0xd63a('0xd')](_0xd63a('0x16'));}else if(_[_0xd63a('0x17')](verticesWithRetry,this[_0xd63a('0x3')][_0x5920ab][_0xd63a('0x11')])){if(_0x3f4dd7==='-'){return logger[_0xd63a('0xd')](_0xd63a('0x18'));}if(_0x47eb14&&_0x3f4dd7!=='t'){return this['traverseBFS'](_0x47eb14,_0x3e3770);}return this['traverseBFS'](_0x5920ab,_0x3e3770);}return logger['info'](_0xd63a('0x19'));}};module[_0xd63a('0x1a')]=Graph;
\ No newline at end of file
+var _0xd0fa=['split','agicommand','vswitch','target','includes','max\x20retry\x20reach','exports','lodash','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','addEdge','push','size','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition'];(function(_0x5254b1,_0x471ede){var _0xfaddd4=function(_0x561207){while(--_0x561207){_0x5254b1['push'](_0x5254b1['shift']());}};_0xfaddd4(++_0x471ede);}(_0xd0fa,0x1ab));var _0xad0f=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xd0fa[_0x20589d];return _0x422de9;};'use strict';var _=require(_0xad0f('0x0'));var logger=require('../../../config/logger')(_0xad0f('0x1'));var verticesWithRetry=[_0xad0f('0x2'),_0xad0f('0x3'),_0xad0f('0x4')];var Graph=function(){this[_0xad0f('0x5')]={};this['edges']={};this[_0xad0f('0x6')]=0x0;};Graph[_0xad0f('0x7')][_0xad0f('0x8')]=function(_0x54fb50){this[_0xad0f('0x5')][_0x54fb50['id']]=_0x54fb50;this[_0xad0f('0x9')][_0x54fb50['id']]=[];};Graph[_0xad0f('0x7')][_0xad0f('0xa')]=function(_0x1309ab,_0xbb18f1,_0xbbc95f){this[_0xad0f('0x9')][_0x1309ab][_0xad0f('0xb')]({'target':_0xbb18f1,'condition':_0xbbc95f});this[_0xad0f('0x6')]+=0x1;};Graph[_0xad0f('0x7')]['size']=function(){return _[_0xad0f('0xc')](this['vertices']);};Graph[_0xad0f('0x7')]['relations']=function(){return this[_0xad0f('0x6')];};Graph[_0xad0f('0x7')][_0xad0f('0xd')]=function(_0x1e512e){return this[_0xad0f('0x5')][_0x1e512e];};Graph[_0xad0f('0x7')][_0xad0f('0xe')]=function(_0x4ca78a,_0x40ae76){if(!this['vertices'][_0x4ca78a]){return logger[_0xad0f('0xf')](_0xad0f('0x10'));}var _0x17fd1e=_0x40ae76(this[_0xad0f('0x5')][_0x4ca78a]);if(!_0x17fd1e){return logger['info'](_0xad0f('0x11'));}if(this[_0xad0f('0x9')][_0x4ca78a]['length']===0x0){return logger[_0xad0f('0xf')](_0xad0f('0x12'));}for(var _0xd82c8=0x0,_0x3bfc43=[],_0x2e0c16=![];_0xd82c8<this[_0xad0f('0x9')][_0x4ca78a][_0xad0f('0x13')];_0xd82c8+=0x1){if(this[_0xad0f('0x9')][_0x4ca78a][_0xd82c8][_0xad0f('0x14')]){_0x3bfc43=this[_0xad0f('0x9')][_0x4ca78a][_0xd82c8]['condition'][_0xad0f('0x15')](',');for(var _0x2db89c=0x0;_0x2db89c<_0x3bfc43['length'];_0x2db89c+=0x1){if(this[_0xad0f('0x5')][_0x4ca78a][_0xad0f('0x16')]===_0xad0f('0x17')&&_0x3bfc43[_0x2db89c]==='-'){_0x2e0c16=this['edges'][_0x4ca78a][_0xd82c8][_0xad0f('0x18')];logger['info']('default',_0x3bfc43[_0x2db89c],this['edges'][_0x4ca78a][_0xd82c8][_0xad0f('0x18')]);}else if(this[_0xad0f('0x5')][_0x4ca78a]['agicommand']===_0xad0f('0x2')&&_0x3bfc43[_0x2db89c]==='i'){_0x2e0c16=this[_0xad0f('0x9')][_0x4ca78a][_0xd82c8][_0xad0f('0x18')];logger['info']('invalid',_0x3bfc43[_0x2db89c],this[_0xad0f('0x9')][_0x4ca78a][_0xd82c8][_0xad0f('0x18')]);}if(_0x3bfc43[_0x2db89c]===_0x17fd1e){return this[_0xad0f('0xe')](this['edges'][_0x4ca78a][_0xd82c8][_0xad0f('0x18')],_0x40ae76);}}}else{return this[_0xad0f('0xe')](this['edges'][_0x4ca78a][_0xd82c8][_0xad0f('0x18')],_0x40ae76);}}if(_0x3bfc43[_0xad0f('0x13')]){if(this['vertices'][_0x4ca78a]['agicommand']===_0xad0f('0x17')){if(_0x2e0c16){return this[_0xad0f('0xe')](_0x2e0c16,_0x40ae76);}return logger[_0xad0f('0xf')]('default\x20on\x20switch\x20not\x20found');}else if(_[_0xad0f('0x19')](verticesWithRetry,this['vertices'][_0x4ca78a]['agicommand'])){if(_0x17fd1e==='-'){return logger[_0xad0f('0xf')](_0xad0f('0x1a'));}if(_0x2e0c16&&_0x17fd1e!=='t'){return this[_0xad0f('0xe')](_0x2e0c16,_0x40ae76);}return this['traverseBFS'](_0x4ca78a,_0x40ae76);}return logger[_0xad0f('0xf')]('condition\x20not\x20found');}};module[_0xad0f('0x1b')]=Graph;
\ No newline at end of file
index 8e881f5..8a97ed3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbb1f=['log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','error','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','catch','indexOf','agi_','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','then','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','port','listening','connection','lodash','syncho','../../config/logger','agi','../../config/license/util','./rpc','./project','EventEmitter','defaults','projectUpdate','stack','deleted','push'];(function(_0xcd0db7,_0x2a28ad){var _0x50ebd4=function(_0x18ae18){while(--_0x18ae18){_0xcd0db7['push'](_0xcd0db7['shift']());}};_0x50ebd4(++_0x2a28ad);}(_0xbb1f,0x197));var _0xfbb1=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0xbb1f[_0x44b3bd];return _0x1efc4a;};'use strict';var _=require(_0xfbb1('0x0'));var syncho=require(_0xfbb1('0x1'));var util=require('util');var config=require('../../config/environment');var logger=require(_0xfbb1('0x2'))(_0xfbb1('0x3'));var utilLicense=require(_0xfbb1('0x4'));var rpc=require(_0xfbb1('0x5'));var Project=require(_0xfbb1('0x6'));var AGIEmitter=require('./events')[_0xfbb1('0x7')];var projects=[];config[_0xfbb1('0x3')]=_[_0xfbb1('0x8')](config[_0xfbb1('0x3')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xfbb1('0x9'),projectUpdateHandler);function connectionHandler(_0x166695){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x166695);agiHandler(_0x166695);}catch(_0x330e39){logger['error'](_0x330e39[_0xfbb1('0xa')]);}});});}function projectUpdateHandler(_0x4487cb){try{var _0xafd293=_['findIndex'](projects,['id',_0x4487cb['id']]);if(_0xafd293>-0x1){if(_0x4487cb[_0xfbb1('0xb')]===!![]){projects['splice'](_0xafd293,0x1);}else{projects[_0xafd293]=_0x4487cb;}}else{projects[_0xfbb1('0xc')](_0x4487cb);}}catch(_0x2e1501){logger['error'](_0x2e1501[_0xfbb1('0xa')]);}}function listeningHandler(){console[_0xfbb1('0xd')](_0xfbb1('0xe'),config[_0xfbb1('0x3')]['port']);logger[_0xfbb1('0xf')](util[_0xfbb1('0x10')](_0xfbb1('0x11'),config[_0xfbb1('0x3')]['ip'],config['agi']['port']));}function errorHandler(_0x40cd7f){if(_0x40cd7f&&_0x40cd7f['name']&&_0x40cd7f[_0xfbb1('0x12')]){logger['error'](util['format'](_0xfbb1('0x13'),_0x40cd7f[_0xfbb1('0x14')],_0x40cd7f[_0xfbb1('0x12')]));}else{logger[_0xfbb1('0x15')](util[_0xfbb1('0x10')](_0xfbb1('0x16'),_0x40cd7f['stack']));}}function closeHandler(){logger['info'](util[_0xfbb1('0x10')](_0xfbb1('0x17'),this[_0xfbb1('0x18')],this[_0xfbb1('0x19')],this[_0xfbb1('0x1a')],this[_0xfbb1('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x1dfa63){logger[_0xfbb1('0x15')](_0x1dfa63[_0xfbb1('0xa')]);}}function timeoutHandler(){logger[_0xfbb1('0xf')](util[_0xfbb1('0x10')](_0xfbb1('0x1c'),this['arg_1'],this[_0xfbb1('0x19')],this['callerid'],this[_0xfbb1('0x1b')],this[_0xfbb1('0x1d')]));}function hangupHandler(){logger['info'](util['format'](_0xfbb1('0x1e'),this['arg_1'],this[_0xfbb1('0x19')],this[_0xfbb1('0x1a')],this[_0xfbb1('0x1b')],this[_0xfbb1('0x1d')]));this[_0xfbb1('0x1f')]=!![];}function createSquareReport(_0x384063,_0x2df0d7){rpc[_0xfbb1('0x20')](_0x384063)['then'](function(_0x1ff7d8){if(_0x2df0d7){_0x2df0d7(null,_0x1ff7d8);}})[_0xfbb1('0x21')](function(_0x584387){if(_0x2df0d7){_0x2df0d7(null,_0x584387);}});}function setChannelVariables(_0x59ebdd){for(var _0x530e4f in _0x59ebdd){if(_0x59ebdd['hasOwnProperty'](_0x530e4f)){if(_0x530e4f[_0xfbb1('0x22')](_0xfbb1('0x23'))===0x0){_0x59ebdd[_0x530e4f['substring'](0x4)]=_0x59ebdd[_0x530e4f];delete _0x59ebdd[_0x530e4f];}}}}function agiHandler(_0x5ab337){logger[_0xfbb1('0x24')](_0xfbb1('0x25'),JSON['stringify'](_0x5ab337,null,0x2));logger['info'](util[_0xfbb1('0x10')](_0xfbb1('0x26'),_0x5ab337[_0xfbb1('0x18')],_0x5ab337[_0xfbb1('0x19')],_0x5ab337[_0xfbb1('0x1a')],_0x5ab337[_0xfbb1('0x1b')],_0x5ab337[_0xfbb1('0x1d')]));_0x5ab337['on']('error',errorHandler);_0x5ab337['on'](_0xfbb1('0x27'),closeHandler);_0x5ab337['on'](_0xfbb1('0x28'),timeoutHandler);_0x5ab337[_0xfbb1('0x1f')]=![];_0x5ab337['on'](_0xfbb1('0x29'),hangupHandler);var _0x58ee0d=_[_0xfbb1('0x2a')](projects,['name',_0x5ab337['arg_1']]);if(!_0x58ee0d)return Project[_0xfbb1('0x2b')](_0x5ab337);if(!_0x58ee0d[_0xfbb1('0x2c')])return Project[_0xfbb1('0x2d')](_0x5ab337);return Project[_0xfbb1('0x2e')](_0x58ee0d,_0x5ab337);}function main(){var _0x152324;return utilLicense[_0xfbb1('0x2f')]()[_0xfbb1('0x30')](function(_0x13f6a6){if(!_0x13f6a6)return;if(_0x13f6a6['voice']){if(_0x13f6a6[_0xfbb1('0x31')]&&_0x13f6a6[_0xfbb1('0x31')]>0x0){logger[_0xfbb1('0xf')](util[_0xfbb1('0x10')](_0xfbb1('0x32'),_0x13f6a6['callysquare']));_0x152324=_0x13f6a6[_0xfbb1('0x31')];}else{logger[_0xfbb1('0xf')](_0xfbb1('0x33'));}}else{logger[_0xfbb1('0xf')](_0xfbb1('0x34'));_0x152324=-0x1;}})[_0xfbb1('0x30')](function(){return Project[_0xfbb1('0x35')]();})['then'](function(_0x179b86){projects=_0x179b86;return;})[_0xfbb1('0x21')](function(_0x37eec5){logger[_0xfbb1('0x15')](_0xfbb1('0x36'),_0x37eec5[_0xfbb1('0xa')]);})[_0xfbb1('0x37')](function(){var _0x104c64=require(_0xfbb1('0x38'))(config['agi'][_0xfbb1('0x39')],config[_0xfbb1('0x3')]['ip'],_0x152324);_0x104c64['on']('error',errorHandler);_0x104c64['on'](_0xfbb1('0x3a'),listeningHandler);_0x104c64['on'](_0xfbb1('0x3b'),connectionHandler);_0x104c64['on']('close',closeHandler);});}main();
\ No newline at end of file
+var _0x28af=['evtHangup','catch','hasOwnProperty','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','initialize','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','lodash','syncho','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','defaults','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','[%s]\x20%s','[ERROR]\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x3b9ea4,_0x387402){var _0x191765=function(_0x599a04){while(--_0x599a04){_0x3b9ea4['push'](_0x3b9ea4['shift']());}};_0x191765(++_0x387402);}(_0x28af,0x1d9));var _0xf28a=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0x28af[_0x285800];return _0x4b809e;};'use strict';var _=require(_0xf28a('0x0'));var syncho=require(_0xf28a('0x1'));var util=require('util');var config=require('../../config/environment');var logger=require(_0xf28a('0x2'))(_0xf28a('0x3'));var utilLicense=require(_0xf28a('0x4'));var rpc=require(_0xf28a('0x5'));var Project=require(_0xf28a('0x6'));var AGIEmitter=require(_0xf28a('0x7'))['EventEmitter'];var projects=[];config[_0xf28a('0x3')]=_[_0xf28a('0x8')](config[_0xf28a('0x3')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xf28a('0x9'),projectUpdateHandler);function connectionHandler(_0xcd0af1){process[_0xf28a('0xa')](function(){syncho(function(){try{setChannelVariables(_0xcd0af1);agiHandler(_0xcd0af1);}catch(_0x428a53){logger[_0xf28a('0xb')](_0x428a53[_0xf28a('0xc')]);}});});}function projectUpdateHandler(_0x413877){try{var _0x33fc02=_[_0xf28a('0xd')](projects,['id',_0x413877['id']]);if(_0x33fc02>-0x1){if(_0x413877[_0xf28a('0xe')]===!![]){projects[_0xf28a('0xf')](_0x33fc02,0x1);}else{projects[_0x33fc02]=_0x413877;}}else{projects['push'](_0x413877);}}catch(_0xd1a8ef){logger[_0xf28a('0xb')](_0xd1a8ef['stack']);}}function listeningHandler(){console['log'](_0xf28a('0x10'),config[_0xf28a('0x3')][_0xf28a('0x11')]);logger[_0xf28a('0x12')](util[_0xf28a('0x13')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config['agi'][_0xf28a('0x11')]));}function errorHandler(_0xc8b788){if(_0xc8b788&&_0xc8b788[_0xf28a('0x14')]&&_0xc8b788[_0xf28a('0x15')]){logger['error'](util['format'](_0xf28a('0x16'),_0xc8b788['name'],_0xc8b788[_0xf28a('0x15')]));}else{logger[_0xf28a('0xb')](util['format'](_0xf28a('0x17'),_0xc8b788[_0xf28a('0xc')]));}}function closeHandler(){logger[_0xf28a('0x12')](util[_0xf28a('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xf28a('0x18')],this[_0xf28a('0x19')],this[_0xf28a('0x1a')],this[_0xf28a('0x1b')],this[_0xf28a('0x1c')]));try{createSquareReport(this);}catch(_0x5763a5){logger[_0xf28a('0xb')](_0x5763a5[_0xf28a('0xc')]);}}function timeoutHandler(){logger[_0xf28a('0x12')](util[_0xf28a('0x13')](_0xf28a('0x1d'),this[_0xf28a('0x18')],this['calleridname'],this[_0xf28a('0x1a')],this[_0xf28a('0x1b')],this[_0xf28a('0x1c')]));}function hangupHandler(){logger[_0xf28a('0x12')](util[_0xf28a('0x13')](_0xf28a('0x1e'),this['arg_1'],this[_0xf28a('0x19')],this['callerid'],this[_0xf28a('0x1b')],this['uniqueid']));this[_0xf28a('0x1f')]=!![];}function createSquareReport(_0x2e8072,_0x183a16){rpc['createSquareReport'](_0x2e8072)['then'](function(_0x53eb33){if(_0x183a16){_0x183a16(null,_0x53eb33);}})[_0xf28a('0x20')](function(_0x1b0591){if(_0x183a16){_0x183a16(null,_0x1b0591);}});}function setChannelVariables(_0x3ce6f4){for(var _0x4737ae in _0x3ce6f4){if(_0x3ce6f4[_0xf28a('0x21')](_0x4737ae)){if(_0x4737ae['indexOf']('agi_')===0x0){_0x3ce6f4[_0x4737ae[_0xf28a('0x22')](0x4)]=_0x3ce6f4[_0x4737ae];delete _0x3ce6f4[_0x4737ae];}}}}function agiHandler(_0xaeb319){logger[_0xf28a('0x23')](_0xf28a('0x24'),JSON[_0xf28a('0x25')](_0xaeb319,null,0x2));logger[_0xf28a('0x12')](util['format'](_0xf28a('0x26'),_0xaeb319[_0xf28a('0x18')],_0xaeb319[_0xf28a('0x19')],_0xaeb319[_0xf28a('0x1a')],_0xaeb319[_0xf28a('0x1b')],_0xaeb319[_0xf28a('0x1c')]));_0xaeb319['on']('error',errorHandler);_0xaeb319['on'](_0xf28a('0x27'),closeHandler);_0xaeb319['on'](_0xf28a('0x28'),timeoutHandler);_0xaeb319[_0xf28a('0x1f')]=![];_0xaeb319['on'](_0xf28a('0x29'),hangupHandler);var _0x589adb=_[_0xf28a('0x2a')](projects,[_0xf28a('0x14'),_0xaeb319[_0xf28a('0x18')]]);if(!_0x589adb)return Project[_0xf28a('0x2b')](_0xaeb319);if(!_0x589adb[_0xf28a('0x2c')])return Project['handleUnpublished'](_0xaeb319);return Project[_0xf28a('0x2d')](_0x589adb,_0xaeb319);}function main(){var _0x32ed23;return utilLicense[_0xf28a('0x2e')]()[_0xf28a('0x2f')](function(_0x1c0d11){if(!_0x1c0d11)return;if(_0x1c0d11[_0xf28a('0x30')]){if(_0x1c0d11[_0xf28a('0x31')]&&_0x1c0d11[_0xf28a('0x31')]>0x0){logger[_0xf28a('0x12')](util['format'](_0xf28a('0x32'),_0x1c0d11[_0xf28a('0x31')]));_0x32ed23=_0x1c0d11[_0xf28a('0x31')];}else{logger['info'](_0xf28a('0x33'));}}else{logger[_0xf28a('0x12')](_0xf28a('0x34'));_0x32ed23=-0x1;}})[_0xf28a('0x2f')](function(){return Project[_0xf28a('0x35')]();})['then'](function(_0x493996){projects=_0x493996;return;})[_0xf28a('0x20')](function(_0x38b701){logger[_0xf28a('0xb')](_0xf28a('0x36'),_0x38b701[_0xf28a('0xc')]);})[_0xf28a('0x37')](function(){var _0x5a8d64=require('./server')(config['agi'][_0xf28a('0x11')],config[_0xf28a('0x3')]['ip'],_0x32ed23);_0x5a8d64['on'](_0xf28a('0xb'),errorHandler);_0x5a8d64['on']('listening',listeningHandler);_0x5a8d64['on']('connection',connectionHandler);_0x5a8d64['on']('close',closeHandler);});}main();
\ No newline at end of file
index 5781a2d..84d726e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9fef=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0x9fef,0x1b4));var _0xf9fe=function(_0x33b627,_0xcd64e0){_0x33b627=_0x33b627-0x0;var _0x531df0=_0x9fef[_0x33b627];return _0x531df0;};'use strict';var BPromise=require(_0xf9fe('0x0'));var jayson=require(_0xf9fe('0x1'));var client=jayson[_0xf9fe('0x2')][_0xf9fe('0x3')]({'port':0x232b});function request(_0x1eef00,_0x4079df){return new BPromise(function(_0x2e1db1,_0x13abfc){return client[_0xf9fe('0x4')](_0x1eef00,_0x4079df)[_0xf9fe('0x5')](function(_0x34512f){if(_0x34512f[_0xf9fe('0x6')]){return _0x13abfc(_0x34512f[_0xf9fe('0x6')][_0xf9fe('0x7')]);}else{return _0x2e1db1(_0x34512f[_0xf9fe('0x8')]);}})[_0xf9fe('0x9')](function(_0xa3455a){return _0x13abfc(_0xa3455a);});});}exports[_0xf9fe('0xa')]=function(_0x3e821e,_0x338c69){return request(_0xf9fe('0xb'),{'account':_0x3e821e,'message':_0x338c69});};
\ No newline at end of file
+var _0x5163=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','result'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5163,0x17f));var _0x3516=function(_0xac6d2f,_0x33cb48){_0xac6d2f=_0xac6d2f-0x0;var _0x1bbc91=_0x5163[_0xac6d2f];return _0x1bbc91;};'use strict';var BPromise=require(_0x3516('0x0'));var jayson=require(_0x3516('0x1'));var client=jayson[_0x3516('0x2')][_0x3516('0x3')]({'port':0x232b});function request(_0x4f2c87,_0x29d635){return new BPromise(function(_0x496359,_0x40db95){return client[_0x3516('0x4')](_0x4f2c87,_0x29d635)['then'](function(_0x3ac668){if(_0x3ac668[_0x3516('0x5')]){return _0x40db95(_0x3ac668[_0x3516('0x5')]['message']);}else{return _0x496359(_0x3ac668[_0x3516('0x6')]);}})[_0x3516('0x7')](function(_0x1f8594){return _0x40db95(_0x1f8594);});});}exports[_0x3516('0x8')]=function(_0x400ebb,_0xf1e594){return request(_0x3516('0x9'),{'account':_0x400ebb,'message':_0xf1e594});};
\ No newline at end of file
index 90c1456..519462b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x63a3=['Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source','target','addEdge','value','mxGraphModel','root','inspect','production','start','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','calleridname','dnid','uniqueid','clear','debug','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','isUndefined','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','traverseBFS','vertex','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','moment','xml2json','util','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','error'];(function(_0x1524d7,_0x47299a){var _0x46212a=function(_0x5ce2fa){while(--_0x5ce2fa){_0x1524d7['push'](_0x1524d7['shift']());}};_0x46212a(++_0x47299a);}(_0x63a3,0xed));var _0x363a=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x63a3[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x363a('0x0'));var moment=require(_0x363a('0x1'));var parser=require(_0x363a('0x2'));var util=require(_0x363a('0x3'));var logger=require('../../config/logger')(_0x363a('0x4'));var rpc=require(_0x363a('0x5'));var mailRpc=require(_0x363a('0x6'));var Graph=require(_0x363a('0x7'));var Vertices=require(_0x363a('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x363a('0x9')]()['catch'](function(_0x4cb5f1){logger[_0x363a('0xa')](_0x363a('0xb'),_0x4cb5f1[_0x363a('0xc')]);return[];});}function addVertex(_0x5a4769,_0x42dde8,_0x20304f){_0x42dde8[_0x363a('0xd')]=_0x20304f;if(_0x42dde8[_0x363a('0xe')](_0x363a('0xf'))){_0x42dde8[_0x363a('0x10')]=parseInt(_0x42dde8[_0x363a('0xf')],0xa);}_0x5a4769[_0x363a('0x11')](_[_0x363a('0x12')](_0x42dde8,_0x363a('0x13')));}function initGraph(_0x75db17,_0x9135b3){var _0x51b54a=new Graph();for(var _0x23385b in _0x75db17){if(_0x75db17[_0x363a('0xe')](_0x23385b)){if(_['isArray'](_0x75db17[_0x23385b])){for(var _0x1501d7=0x0;_0x1501d7<_0x75db17[_0x23385b]['length'];_0x1501d7+=0x1){addVertex(_0x51b54a,_0x75db17[_0x23385b][_0x1501d7],_0x23385b);}}else{addVertex(_0x51b54a,_0x75db17[_0x23385b],_0x23385b);}}}for(var _0x4dff88=0x0;_0x4dff88<_0x9135b3[_0x363a('0x14')];_0x4dff88+=0x1){if(_0x9135b3[_0x4dff88][_0x363a('0x15')]&&_0x9135b3[_0x4dff88][_0x363a('0x16')]){_0x51b54a[_0x363a('0x17')](_0x9135b3[_0x4dff88]['source'],_0x9135b3[_0x4dff88][_0x363a('0x16')],_0x9135b3[_0x4dff88][_0x363a('0x18')]);}}return _0x51b54a;}function getRoot(_0x40037b){return parser['toJson'](_0x40037b,{'object':!![]})[_0x363a('0x19')][_0x363a('0x1a')];}function inspect(_0x149117){return util[_0x363a('0x1b')](_0x149117,{'showHidden':![],'depth':null});}function initialize(_0x2a0c5e,_0x210165){var _0x7d2a75=getRoot(_0x2a0c5e[_0x363a('0x1c')]);if(!_0x7d2a75||!_0x7d2a75[_0x363a('0x1d')])return;var _0x82edae,_0x435757,_0x426545;logger['debug'](_0x363a('0x1a'),JSON[_0x363a('0x1e')](_0x7d2a75,null,0x2));_0x210165[_0x363a('0x1f')]=moment()[_0x363a('0x20')](_0x363a('0x21'));_0x82edae=initGraph(_[_0x363a('0x12')](_0x7d2a75,'mxCell'),_0x7d2a75[_0x363a('0x13')]);_0x435757=new Vertices(_0x210165,rpc,mailRpc);logger['info'](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x210165['arg_1'],_0x210165[_0x363a('0x22')],_0x210165['callerid'],_0x210165[_0x363a('0x23')],_0x210165[_0x363a('0x24')]));_0x82edae['traverseBFS'](_0x7d2a75[_0x363a('0x1d')]['id'],function(_0x1b0f58){try{_0x1b0f58=_0x435757[_0x363a('0x25')](_0x1b0f58);logger[_0x363a('0x26')]('vertex',JSON[_0x363a('0x1e')](_0x1b0f58,null,0x2));if(_0x1b0f58[_0x363a('0xd')]==='gotoc'){logger[_0x363a('0x27')](_0x363a('0x28'));_0x210165['context']=_0x1b0f58[_0x363a('0x29')]||_0x210165['context'];_0x210165['extension']=_0x1b0f58[_0x363a('0x2a')];_0x210165[_0x363a('0x2b')]=_0x1b0f58['priority']?_0x1b0f58[_0x363a('0x2b')]-0x1:0x1;return null;}else if(_0x1b0f58&&_0x435757[_0x1b0f58[_0x363a('0xd')]]){_0x426545=_0x435757[_0x1b0f58['agicommand']](_0x1b0f58);logger['info'](_0x363a('0x2c'),JSON['stringify'](_0x426545,null,0x2));if(_0x426545&&_0x426545[_0x363a('0x2d')]===AGI_CODE_SUCCESS&&_0x426545['result']!==AGI_RESULT_ERROR&&!_0x210165[_0x363a('0x2e')]){logger[_0x363a('0x26')]('response',inspect(_0x426545));return _[_0x363a('0x2f')](_0x426545['result'])?null:_0x426545[_0x363a('0x30')]['toString']();}else{logger[_0x363a('0xa')](_0x363a('0x2c'),inspect(_0x426545));return null;}}else{logger[_0x363a('0xa')](_0x363a('0x31'));return null;}}catch(_0x3da834){logger[_0x363a('0xa')](_0x3da834[_0x363a('0xc')]);return null;}});if(_0x7d2a75[_0x363a('0x32')]){logger['info'](util['format'](_0x363a('0x33'),_0x210165[_0x363a('0x34')],_0x210165[_0x363a('0x22')],_0x210165[_0x363a('0x35')],_0x210165[_0x363a('0x23')],_0x210165[_0x363a('0x24')]));_0x82edae[_0x363a('0x36')](_0x7d2a75['finally']['id'],function(_0x260355){try{_0x260355=_0x435757[_0x363a('0x25')](_0x260355);logger[_0x363a('0x26')](_0x363a('0x37'),JSON[_0x363a('0x1e')](_0x260355,null,0x2));if(_0x260355&&_0x435757[_0x260355[_0x363a('0xd')]]){_0x426545=_0x435757[_0x260355[_0x363a('0xd')]](_0x260355);if(_0x426545){logger[_0x363a('0x26')]('response',inspect(_0x426545));return _[_0x363a('0x2f')](_0x426545[_0x363a('0x30')])?null:_0x426545[_0x363a('0x30')][_0x363a('0x38')]();}else{logger['error']('response',inspect(_0x426545));return null;}}else{logger[_0x363a('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x30504e){logger['error'](_0x30504e['stack']);return null;}});}logger[_0x363a('0x27')](util[_0x363a('0x20')](_0x363a('0x39'),_0x210165[_0x363a('0x34')],_0x210165[_0x363a('0x22')],_0x210165['callerid'],_0x210165[_0x363a('0x23')],_0x210165[_0x363a('0x24')]));logger[_0x363a('0x27')](util[_0x363a('0x20')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x210165[_0x363a('0x29')],_0x210165[_0x363a('0x2a')],parseInt(_0x210165['priority'],0xa)+0x1));_0x210165[_0x363a('0x3a')](_0x210165['context'],_0x210165['extension'],parseInt(_0x210165['priority'],0xa)+0x1);_0x210165[_0x363a('0x3b')]();}function handleNotFound(_0x4b2165){logger[_0x363a('0xa')](util[_0x363a('0x20')](_0x363a('0x3c'),_0x4b2165[_0x363a('0x34')]));_0x4b2165[_0x363a('0x3a')](_0x4b2165[_0x363a('0x29')],_0x4b2165[_0x363a('0x2a')],parseInt(_0x4b2165[_0x363a('0x2b')],0xa)+0x1);_0x4b2165[_0x363a('0x3b')]();}function handleUnpublished(_0x262c3c){logger[_0x363a('0xa')](util['format']('Project\x20%s\x20not\x20published',_0x262c3c['arg_1']));_0x262c3c[_0x363a('0x3a')](_0x262c3c[_0x363a('0x29')],_0x262c3c[_0x363a('0x2a')],parseInt(_0x262c3c[_0x363a('0x2b')],0xa)+0x1);_0x262c3c[_0x363a('0x3b')]();}module[_0x363a('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize};
\ No newline at end of file
+var _0x266e=['source','target','value','inspect','production','start','debug','root','stringify','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','agicommand','gotoc','info','context','extension','priority','response','result','evtHangup','isUndefined','toString','error','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','moment','xml2json','util','../../config/logger','./mailRpc','./graph','./vertices','getSquareProjects','stack','retry','maxRetry','omit','isArray','length'];(function(_0x42ddc5,_0x1b2eea){var _0x43c85f=function(_0x45813b){while(--_0x45813b){_0x42ddc5['push'](_0x42ddc5['shift']());}};_0x43c85f(++_0x1b2eea);}(_0x266e,0xd1));var _0xe266=function(_0x91f712,_0x43e20e){_0x91f712=_0x91f712-0x0;var _0xcc7a42=_0x266e[_0x91f712];return _0xcc7a42;};'use strict';var _=require(_0xe266('0x0'));var moment=require(_0xe266('0x1'));var parser=require(_0xe266('0x2'));var util=require(_0xe266('0x3'));var logger=require(_0xe266('0x4'))('agi');var rpc=require('./rpc');var mailRpc=require(_0xe266('0x5'));var Graph=require(_0xe266('0x6'));var Vertices=require(_0xe266('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xe266('0x8')]()['catch'](function(_0x4abe66){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0x4abe66[_0xe266('0x9')]);return[];});}function addVertex(_0x80c033,_0x4791d1,_0x50faed){_0x4791d1['agicommand']=_0x50faed;if(_0x4791d1['hasOwnProperty'](_0xe266('0xa'))){_0x4791d1[_0xe266('0xb')]=parseInt(_0x4791d1[_0xe266('0xa')],0xa);}_0x80c033['addVertex'](_[_0xe266('0xc')](_0x4791d1,'mxCell'));}function initGraph(_0xcda665,_0xbe697e){var _0x3e5aa4=new Graph();for(var _0x1f8386 in _0xcda665){if(_0xcda665['hasOwnProperty'](_0x1f8386)){if(_[_0xe266('0xd')](_0xcda665[_0x1f8386])){for(var _0x5813b2=0x0;_0x5813b2<_0xcda665[_0x1f8386][_0xe266('0xe')];_0x5813b2+=0x1){addVertex(_0x3e5aa4,_0xcda665[_0x1f8386][_0x5813b2],_0x1f8386);}}else{addVertex(_0x3e5aa4,_0xcda665[_0x1f8386],_0x1f8386);}}}for(var _0x18ee59=0x0;_0x18ee59<_0xbe697e[_0xe266('0xe')];_0x18ee59+=0x1){if(_0xbe697e[_0x18ee59][_0xe266('0xf')]&&_0xbe697e[_0x18ee59][_0xe266('0x10')]){_0x3e5aa4['addEdge'](_0xbe697e[_0x18ee59][_0xe266('0xf')],_0xbe697e[_0x18ee59][_0xe266('0x10')],_0xbe697e[_0x18ee59][_0xe266('0x11')]);}}return _0x3e5aa4;}function getRoot(_0x7e1db6){return parser['toJson'](_0x7e1db6,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x345db0){return util[_0xe266('0x12')](_0x345db0,{'showHidden':![],'depth':null});}function initialize(_0x3e7165,_0x100850){var _0x39f5b4=getRoot(_0x3e7165[_0xe266('0x13')]);if(!_0x39f5b4||!_0x39f5b4[_0xe266('0x14')])return;var _0x338f71,_0x2e79d7,_0x3c129a;logger[_0xe266('0x15')](_0xe266('0x16'),JSON[_0xe266('0x17')](_0x39f5b4,null,0x2));_0x100850['joinAt']=moment()[_0xe266('0x18')](_0xe266('0x19'));_0x338f71=initGraph(_[_0xe266('0xc')](_0x39f5b4,_0xe266('0x1a')),_0x39f5b4[_0xe266('0x1a')]);_0x2e79d7=new Vertices(_0x100850,rpc,mailRpc);logger['info'](util[_0xe266('0x18')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x100850[_0xe266('0x1b')],_0x100850[_0xe266('0x1c')],_0x100850[_0xe266('0x1d')],_0x100850[_0xe266('0x1e')],_0x100850[_0xe266('0x1f')]));_0x338f71[_0xe266('0x20')](_0x39f5b4['start']['id'],function(_0x3eba45){try{_0x3eba45=_0x2e79d7[_0xe266('0x21')](_0x3eba45);logger['debug'](_0xe266('0x22'),JSON[_0xe266('0x17')](_0x3eba45,null,0x2));if(_0x3eba45[_0xe266('0x23')]===_0xe266('0x24')){logger[_0xe266('0x25')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x100850[_0xe266('0x26')]=_0x3eba45['context']||_0x100850[_0xe266('0x26')];_0x100850[_0xe266('0x27')]=_0x3eba45['extension'];_0x100850[_0xe266('0x28')]=_0x3eba45[_0xe266('0x28')]?_0x3eba45['priority']-0x1:0x1;return null;}else if(_0x3eba45&&_0x2e79d7[_0x3eba45[_0xe266('0x23')]]){_0x3c129a=_0x2e79d7[_0x3eba45[_0xe266('0x23')]](_0x3eba45);logger['info'](_0xe266('0x29'),JSON[_0xe266('0x17')](_0x3c129a,null,0x2));if(_0x3c129a&&_0x3c129a['code']===AGI_CODE_SUCCESS&&_0x3c129a[_0xe266('0x2a')]!==AGI_RESULT_ERROR&&!_0x100850[_0xe266('0x2b')]){logger['debug']('response',inspect(_0x3c129a));return _[_0xe266('0x2c')](_0x3c129a[_0xe266('0x2a')])?null:_0x3c129a[_0xe266('0x2a')][_0xe266('0x2d')]();}else{logger[_0xe266('0x2e')](_0xe266('0x29'),inspect(_0x3c129a));return null;}}else{logger[_0xe266('0x2e')](_0xe266('0x2f'));return null;}}catch(_0x27deb5){logger['error'](_0x27deb5[_0xe266('0x9')]);return null;}});if(_0x39f5b4['finally']){logger[_0xe266('0x25')](util[_0xe266('0x18')](_0xe266('0x30'),_0x100850[_0xe266('0x1b')],_0x100850[_0xe266('0x1c')],_0x100850[_0xe266('0x1d')],_0x100850['dnid'],_0x100850[_0xe266('0x1f')]));_0x338f71[_0xe266('0x20')](_0x39f5b4[_0xe266('0x31')]['id'],function(_0x5a7854){try{_0x5a7854=_0x2e79d7[_0xe266('0x21')](_0x5a7854);logger[_0xe266('0x15')](_0xe266('0x22'),JSON[_0xe266('0x17')](_0x5a7854,null,0x2));if(_0x5a7854&&_0x2e79d7[_0x5a7854[_0xe266('0x23')]]){_0x3c129a=_0x2e79d7[_0x5a7854[_0xe266('0x23')]](_0x5a7854);if(_0x3c129a){logger[_0xe266('0x15')](_0xe266('0x29'),inspect(_0x3c129a));return _[_0xe266('0x2c')](_0x3c129a['result'])?null:_0x3c129a[_0xe266('0x2a')]['toString']();}else{logger[_0xe266('0x2e')](_0xe266('0x29'),inspect(_0x3c129a));return null;}}else{logger[_0xe266('0x2e')]('agicommand\x20not\x20found');return null;}}catch(_0x4a6909){logger[_0xe266('0x2e')](_0x4a6909[_0xe266('0x9')]);return null;}});}logger[_0xe266('0x25')](util[_0xe266('0x18')](_0xe266('0x32'),_0x100850[_0xe266('0x1b')],_0x100850[_0xe266('0x1c')],_0x100850[_0xe266('0x1d')],_0x100850[_0xe266('0x1e')],_0x100850['uniqueid']));logger[_0xe266('0x25')](util[_0xe266('0x18')](_0xe266('0x33'),_0x100850['context'],_0x100850[_0xe266('0x27')],parseInt(_0x100850[_0xe266('0x28')],0xa)+0x1));_0x100850[_0xe266('0x34')](_0x100850['context'],_0x100850[_0xe266('0x27')],parseInt(_0x100850[_0xe266('0x28')],0xa)+0x1);_0x100850[_0xe266('0x35')]();}function handleNotFound(_0x2bc335){logger[_0xe266('0x2e')](util[_0xe266('0x18')](_0xe266('0x36'),_0x2bc335[_0xe266('0x1b')]));_0x2bc335[_0xe266('0x34')](_0x2bc335[_0xe266('0x26')],_0x2bc335[_0xe266('0x27')],parseInt(_0x2bc335[_0xe266('0x28')],0xa)+0x1);_0x2bc335['close']();}function handleUnpublished(_0x5c4950){logger[_0xe266('0x2e')](util['format']('Project\x20%s\x20not\x20published',_0x5c4950[_0xe266('0x1b')]));_0x5c4950[_0xe266('0x34')](_0x5c4950['context'],_0x5c4950['extension'],parseInt(_0x5c4950[_0xe266('0x28')],0xa)+0x1);_0x5c4950['close']();}module[_0xe266('0x37')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize};
\ No newline at end of file
index 6a47e7f..8ce5754 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8fde=['_localBuffer','toString','_inBody','indexOf','substring','length','split','slice','trim','headers','emit','line','util','call','prototype','_transform','\x0d\x0a\x0d\x0a'];(function(_0x54c695,_0x5d6677){var _0x3ce06b=function(_0x55bdf1){while(--_0x55bdf1){_0x54c695['push'](_0x54c695['shift']());}};_0x3ce06b(++_0x5d6677);}(_0x8fde,0x1b5));var _0xe8fd=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x8fde[_0x5d2803];return _0xdcad2c;};'use strict';var util=require(_0xe8fd('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0x590e3a){Transform[_0xe8fd('0x1')](this,_0x590e3a);this['_localBuffer']='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xe8fd('0x2')][_0xe8fd('0x3')]=function(_0x1e94e2,_0x4b10c6,_0x2e65ef){var _0xcc4b27='\x0a',_0x306fc2=['\x0a\x0a',_0xe8fd('0x4')],_0x58add0=-0x1,_0x23fbca=-0x1,_0x51f637='',_0x1e0ecd=0x0,_0x3c44fe='',_0x33722b='';this[_0xe8fd('0x5')]+=_0x1e94e2[_0xe8fd('0x6')]();_0x3c44fe=this[_0xe8fd('0x5')];if(!this[_0xe8fd('0x7')]){_0x1e0ecd=0x0;while(_0x306fc2[_0x1e0ecd]){while((_0x23fbca=_0x3c44fe[_0xe8fd('0x8')](_0x306fc2[_0x1e0ecd]))!=-0x1){_0x51f637=_0x306fc2[_0x1e0ecd];_0x33722b=_0x3c44fe['substring'](0x0,_0x23fbca);_0x3c44fe=_0x3c44fe[_0xe8fd('0x9')](_0x23fbca+_0x51f637[_0xe8fd('0xa')]);var _0x5a6293=_0x33722b[_0xe8fd('0xb')](_0xcc4b27),_0xf8dc61=0x0,_0x5638a0={},_0x35cb07='',_0x222e69='',_0x217434=-0x1;while(_0x5a6293[_0xf8dc61]){_0x217434=_0x5a6293[_0xf8dc61][_0xe8fd('0x8')](':');if(_0x217434!=-0x1){_0x35cb07=_0x5a6293[_0xf8dc61][_0xe8fd('0xc')](0x0,_0x217434)[_0xe8fd('0xd')]();_0x222e69=_0x5a6293[_0xf8dc61]['slice'](_0x217434+0x1)[_0xe8fd('0xd')]();if(_0x35cb07[_0xe8fd('0xa')]>0x0){_0x5638a0[_0x35cb07]=_0x222e69;}}else{}_0xf8dc61++;}this['emit'](_0xe8fd('0xe'),_0x5638a0);this[_0xe8fd('0x7')]=!![];}_0x1e0ecd++;}this[_0xe8fd('0x5')]=_0x3c44fe;}else{while((_0x58add0=_0x3c44fe[_0xe8fd('0x8')](_0xcc4b27))!=-0x1){_0x33722b=_0x3c44fe[_0xe8fd('0x9')](0x0,_0x58add0);this[_0xe8fd('0xf')](_0xe8fd('0x10'),_0x33722b);_0x3c44fe=_0x3c44fe[_0xe8fd('0x9')](_0x58add0+_0xcc4b27[_0xe8fd('0xa')]);}this[_0xe8fd('0x5')]=_0x3c44fe;}_0x2e65ef();};module['exports']=AGIReply;
\ No newline at end of file
+var _0x9af1=['split','slice','trim','emit','headers','indexOf','line','length','exports','util','Transform','call','_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','substring'];(function(_0x4dc844,_0x4f8d53){var _0x373caa=function(_0x17f82d){while(--_0x17f82d){_0x4dc844['push'](_0x4dc844['shift']());}};_0x373caa(++_0x4f8d53);}(_0x9af1,0x149));var _0x19af=function(_0x2904b8,_0x253d5d){_0x2904b8=_0x2904b8-0x0;var _0x45010c=_0x9af1[_0x2904b8];return _0x45010c;};'use strict';var util=require(_0x19af('0x0'));var Transform=require('stream')[_0x19af('0x1')];function AGIReply(_0x3d382c){Transform[_0x19af('0x2')](this,_0x3d382c);this[_0x19af('0x3')]='';this['_inBody']=![];}util[_0x19af('0x4')](AGIReply,Transform);AGIReply[_0x19af('0x5')][_0x19af('0x6')]=function(_0x25fa3f,_0x3515ab,_0xb01f94){var _0x4a6104='\x0a',_0x5bd9ae=['\x0a\x0a',_0x19af('0x7')],_0x2ae9f2=-0x1,_0x386b1b=-0x1,_0x13bb7c='',_0x19624f=0x0,_0x76f6d5='',_0x573b44='';this[_0x19af('0x3')]+=_0x25fa3f[_0x19af('0x8')]();_0x76f6d5=this[_0x19af('0x3')];if(!this[_0x19af('0x9')]){_0x19624f=0x0;while(_0x5bd9ae[_0x19624f]){while((_0x386b1b=_0x76f6d5['indexOf'](_0x5bd9ae[_0x19624f]))!=-0x1){_0x13bb7c=_0x5bd9ae[_0x19624f];_0x573b44=_0x76f6d5['substring'](0x0,_0x386b1b);_0x76f6d5=_0x76f6d5[_0x19af('0xa')](_0x386b1b+_0x13bb7c['length']);var _0x4d7da2=_0x573b44[_0x19af('0xb')](_0x4a6104),_0x2b149d=0x0,_0xf938d={},_0x8507='',_0x5e8a3d='',_0x4746ce=-0x1;while(_0x4d7da2[_0x2b149d]){_0x4746ce=_0x4d7da2[_0x2b149d]['indexOf'](':');if(_0x4746ce!=-0x1){_0x8507=_0x4d7da2[_0x2b149d]['slice'](0x0,_0x4746ce)['trim']();_0x5e8a3d=_0x4d7da2[_0x2b149d][_0x19af('0xc')](_0x4746ce+0x1)[_0x19af('0xd')]();if(_0x8507['length']>0x0){_0xf938d[_0x8507]=_0x5e8a3d;}}else{}_0x2b149d++;}this[_0x19af('0xe')](_0x19af('0xf'),_0xf938d);this['_inBody']=!![];}_0x19624f++;}this[_0x19af('0x3')]=_0x76f6d5;}else{while((_0x2ae9f2=_0x76f6d5[_0x19af('0x10')](_0x4a6104))!=-0x1){_0x573b44=_0x76f6d5['substring'](0x0,_0x2ae9f2);this['emit'](_0x19af('0x11'),_0x573b44);_0x76f6d5=_0x76f6d5['substring'](_0x2ae9f2+_0x4a6104[_0x19af('0x12')]);}this[_0x19af('0x3')]=_0x76f6d5;}_0xb01f94();};module[_0x19af('0x13')]=AGIReply;
\ No newline at end of file
index 1ae65f1..a62412e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4ef1=['moment','client','http','request','then','error','message','result','getSquareProjects','GetSquareProjects','name','production','getMailAccountById','ShowMailAccount','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','UnpauseUser','agentLogout','lodash'];(function(_0x337fcf,_0x6c5972){var _0x524a5c=function(_0x34c503){while(--_0x34c503){_0x337fcf['push'](_0x337fcf['shift']());}};_0x524a5c(++_0x6c5972);}(_0x4ef1,0xeb));var _0x14ef=function(_0x5f20f0,_0x4cfb6d){_0x5f20f0=_0x5f20f0-0x0;var _0x16b5a2=_0x4ef1[_0x5f20f0];return _0x16b5a2;};'use strict';var _=require(_0x14ef('0x0'));var moment=require(_0x14ef('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x14ef('0x2')][_0x14ef('0x3')]({'port':0x2329});function request(_0x3c673a,_0x593daa){return new Promise(function(_0x168fd8,_0x43a716){return client[_0x14ef('0x4')](_0x3c673a,_0x593daa)[_0x14ef('0x5')](function(_0x27d703){if(_0x27d703[_0x14ef('0x6')]){return _0x43a716(_0x27d703['error'][_0x14ef('0x7')]);}else{return _0x168fd8(_0x27d703[_0x14ef('0x8')]);}})['catch'](function(_0x4175e7){return _0x43a716(_0x4175e7);});});}exports[_0x14ef('0x9')]=function(){return request(_0x14ef('0xa'),{'options':{'raw':![],'attributes':['id',_0x14ef('0xb'),_0x14ef('0xc')]}});};exports['getSquareProject']=function(_0x16fb7d){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x16fb7d},'attributes':[_0x14ef('0xc')]}});};exports[_0x14ef('0xd')]=function(_0x3198f1){return request(_0x14ef('0xe'),{'options':{'raw':![],'where':{'id':_0x3198f1},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0x14ef('0xf'),'as':_0x14ef('0xf')}]}],'attributes':['id','name',_0x14ef('0x10')],'smtp':!![]}});};exports[_0x14ef('0x11')]=function(_0x3f1553){return request('ShowSquareProject',{'options':{'where':{'id':_0x3f1553},'attributes':[_0x14ef('0xb')]}});};exports[_0x14ef('0x12')]=function(_0x2263f1){return request(_0x14ef('0x13'),{'options':{'where':{'id':_0x2263f1},'attributes':['name']}});};exports[_0x14ef('0x14')]=function(_0x14b857){return request(_0x14ef('0x15'),{'options':{'where':{'id':_0x14b857},'attributes':[_0x14ef('0xb')]}});};exports['getSquareOdbcById']=function(_0x29c767){return request(_0x14ef('0x16'),{'options':{'where':{'id':_0x29c767},'attributes':[_0x14ef('0x17')]}});};exports[_0x14ef('0x18')]=function(_0x42f3cc){return request(_0x14ef('0x19'),{'options':{'where':{'id':_0x42f3cc},'attributes':[_0x14ef('0xb')]}});};exports[_0x14ef('0x1a')]=function(_0x19b2cb){return request(_0x14ef('0x1b'),{'options':{'where':{'phone':_0x19b2cb[_0x14ef('0x1c')]},'attributes':['id']}});};exports[_0x14ef('0x1d')]=function(_0x1fce64){return request(_0x14ef('0x1e'),{'options':{'where':{'id':_0x1fce64},'attributes':['name']}});};exports['getSoundById']=function(_0x2878a9){return request(_0x14ef('0x1f'),{'options':{'where':{'id':_0x2878a9},'attributes':[_0x14ef('0x20')]}});};exports[_0x14ef('0x21')]=function(_0x4686cf){return request(_0x14ef('0x22'),{'options':{'raw':![],'where':{'id':_0x4686cf},'include':[{'model':_0x14ef('0x23'),'as':_0x14ef('0x24')}]}});};exports['getSmsAccountById']=function(_0x477e18){return request('ShowSmsAccount',{'options':{'where':{'id':_0x477e18},'attributes':['id','name']}});};exports[_0x14ef('0x25')]=function(_0xd52011){return request(_0x14ef('0x26'),{'body':_0xd52011});};exports[_0x14ef('0x27')]=function(_0x33e198){return request(_0x14ef('0x28'),{'body':_0x33e198});};exports[_0x14ef('0x29')]=function(_0xce31cc){return request(_0x14ef('0x2a'),{'body':_[_0x14ef('0x2b')](_0xce31cc,{'project_name':_0xce31cc['arg_1'],'prev_project_name':_0xce31cc[_0x14ef('0x2c')]||'','is_subproject':_0xce31cc[_0x14ef('0x2c')]?!![]:![],'leaveAt':moment()[_0x14ef('0x2d')](_0x14ef('0x2e'))})});};exports[_0x14ef('0x2f')]=function(_0x543a94){return request('CreateSquareRecording',{'body':_0x543a94});};exports[_0x14ef('0x30')]=function(_0x49b7bc){return request('CreateSquareMessage',{'body':_0x49b7bc});};exports[_0x14ef('0x31')]=function(_0x40d50d){return request(_0x14ef('0x32'),{'options':{'raw':![],'where':{'phone':_0x40d50d[_0x14ef('0x1c')],'ListId':_0x40d50d[_0x14ef('0x33')]}}})[_0x14ef('0x5')](function(_0x215ffd){if(_0x215ffd){return _0x215ffd;}return request(_0x14ef('0x34'),{'body':_0x40d50d});});};exports['getPauseById']=function(_0x9fa88e){return request(_0x14ef('0x35'),{'options':{'where':{'id':_0x9fa88e},'attributes':[_0x14ef('0xb')]}});};exports[_0x14ef('0x36')]=function(_0x24f6d1,_0x125c03){return request(_0x14ef('0x37'),{'body':{'interface':_0x125c03},'options':{'where':_0x24f6d1}});};exports[_0x14ef('0x38')]=function(_0x7a4b58,_0x461600,_0x14945d){return request('PauseUser',{'body':{'type':_0x461600,'uniqueid':_0x14945d},'options':{'where':_0x7a4b58}});};exports['agentUnpause']=function(_0x217e20){return request(_0x14ef('0x39'),{'body':{},'options':{'where':_0x217e20}});};exports[_0x14ef('0x3a')]=function(_0x18aa9d){return request('LogoutUser',{'body':{},'options':{'where':_0x18aa9d}});};
\ No newline at end of file
+var _0x8e63=['agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','http','request','then','error','message','result','catch','GetSquareProjects','name','production','getSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Interval','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser'];(function(_0x36f361,_0x26f3f0){var _0x36e071=function(_0xe1ab87){while(--_0xe1ab87){_0x36f361['push'](_0x36f361['shift']());}};_0x36e071(++_0x26f3f0);}(_0x8e63,0x7c));var _0x38e6=function(_0x1a9e16,_0x3decb0){_0x1a9e16=_0x1a9e16-0x0;var _0xbae725=_0x8e63[_0x1a9e16];return _0xbae725;};'use strict';var _=require('lodash');var moment=require(_0x38e6('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x38e6('0x1')]({'port':0x2329});function request(_0xb2c68b,_0x1c6de7){return new Promise(function(_0x5e5a71,_0x4c85e7){return client[_0x38e6('0x2')](_0xb2c68b,_0x1c6de7)[_0x38e6('0x3')](function(_0x344a0c){if(_0x344a0c['error']){return _0x4c85e7(_0x344a0c[_0x38e6('0x4')][_0x38e6('0x5')]);}else{return _0x5e5a71(_0x344a0c[_0x38e6('0x6')]);}})[_0x38e6('0x7')](function(_0x51b586){return _0x4c85e7(_0x51b586);});});}exports['getSquareProjects']=function(){return request(_0x38e6('0x8'),{'options':{'raw':![],'attributes':['id',_0x38e6('0x9'),_0x38e6('0xa')]}});};exports[_0x38e6('0xb')]=function(_0x438258){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x438258},'attributes':['production']}});};exports[_0x38e6('0xc')]=function(_0x4c5e34){return request(_0x38e6('0xd'),{'options':{'raw':![],'where':{'id':_0x4c5e34},'include':[{'model':'MailServerOut','as':_0x38e6('0xe'),'include':[{'model':_0x38e6('0xf'),'as':_0x38e6('0xf')}]}],'attributes':['id',_0x38e6('0x9'),_0x38e6('0x10')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x2b4679){return request(_0x38e6('0x11'),{'options':{'where':{'id':_0x2b4679},'attributes':['name']}});};exports[_0x38e6('0x12')]=function(_0xfd7f2){return request(_0x38e6('0x13'),{'options':{'where':{'id':_0xfd7f2},'attributes':[_0x38e6('0x9')]}});};exports[_0x38e6('0x14')]=function(_0x46b525){return request('ShowVariable',{'options':{'where':{'id':_0x46b525},'attributes':[_0x38e6('0x9')]}});};exports[_0x38e6('0x15')]=function(_0x3299c9){return request(_0x38e6('0x16'),{'options':{'where':{'id':_0x3299c9},'attributes':[_0x38e6('0x17')]}});};exports['getUserById']=function(_0x91997a){return request('ShowUser',{'options':{'where':{'id':_0x91997a},'attributes':[_0x38e6('0x9')]}});};exports[_0x38e6('0x18')]=function(_0x57ded4){return request(_0x38e6('0x19'),{'options':{'where':{'phone':_0x57ded4['phone']},'attributes':['id']}});};exports[_0x38e6('0x1a')]=function(_0x521453){return request(_0x38e6('0x1b'),{'options':{'where':{'id':_0x521453},'attributes':[_0x38e6('0x9')]}});};exports[_0x38e6('0x1c')]=function(_0x137e09){return request(_0x38e6('0x1d'),{'options':{'where':{'id':_0x137e09},'attributes':[_0x38e6('0x1e')]}});};exports['getIntervalById']=function(_0x5f3f67){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x5f3f67},'include':[{'model':_0x38e6('0x1f'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x2d995f){return request(_0x38e6('0x20'),{'options':{'where':{'id':_0x2d995f},'attributes':['id',_0x38e6('0x9')]}});};exports[_0x38e6('0x21')]=function(_0x5f5ab2){return request(_0x38e6('0x22'),{'body':_0x5f5ab2});};exports[_0x38e6('0x23')]=function(_0x185922){return request('CreateSquareDetailsReport',{'body':_0x185922});};exports[_0x38e6('0x24')]=function(_0x399b70){return request(_0x38e6('0x25'),{'body':_[_0x38e6('0x26')](_0x399b70,{'project_name':_0x399b70[_0x38e6('0x27')],'prev_project_name':_0x399b70[_0x38e6('0x28')]||'','is_subproject':_0x399b70[_0x38e6('0x28')]?!![]:![],'leaveAt':moment()[_0x38e6('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x38e6('0x2a')]=function(_0x491588){return request(_0x38e6('0x2b'),{'body':_0x491588});};exports[_0x38e6('0x2c')]=function(_0x446ed5){return request(_0x38e6('0x2d'),{'body':_0x446ed5});};exports[_0x38e6('0x2e')]=function(_0x1afc04){return request(_0x38e6('0x2f'),{'options':{'raw':![],'where':{'phone':_0x1afc04['phone'],'ListId':_0x1afc04[_0x38e6('0x30')]}}})[_0x38e6('0x3')](function(_0x48f5a2){if(_0x48f5a2){return _0x48f5a2;}return request(_0x38e6('0x31'),{'body':_0x1afc04});});};exports[_0x38e6('0x32')]=function(_0x526569){return request(_0x38e6('0x33'),{'options':{'where':{'id':_0x526569},'attributes':[_0x38e6('0x9')]}});};exports[_0x38e6('0x34')]=function(_0x3ce1c2,_0xe7489){return request(_0x38e6('0x35'),{'body':{'interface':_0xe7489},'options':{'where':_0x3ce1c2}});};exports[_0x38e6('0x36')]=function(_0x5a5979,_0x220c19,_0x3d231a){return request(_0x38e6('0x37'),{'body':{'type':_0x220c19,'uniqueid':_0x3d231a},'options':{'where':_0x5a5979}});};exports[_0x38e6('0x38')]=function(_0x15232f){return request(_0x38e6('0x39'),{'body':{},'options':{'where':_0x15232f}});};exports[_0x38e6('0x3a')]=function(_0x57d22c){return request(_0x38e6('0x3b'),{'body':{},'options':{'where':_0x57d22c}});};
\ No newline at end of file
index 20e32aa..bb887e8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['exports','./polly','./lex'];(function(_0x49bdde,_0x1f8c97){var _0x3e48b0=function(_0x5ba5cc){while(--_0x5ba5cc){_0x49bdde['push'](_0x49bdde['shift']());}};_0x3e48b0(++_0x1f8c97);}(_0x7a54,0x106));var _0x47a5=function(_0x2c8fc2,_0x160397){_0x2c8fc2=_0x2c8fc2-0x0;var _0x11da41=_0x7a54[_0x2c8fc2];return _0x11da41;};var polly=require(_0x47a5('0x0'));var lex=require(_0x47a5('0x1'));module[_0x47a5('0x2')]={'polly':polly,'lex':lex};
\ No newline at end of file
+var _0xba34=['./lex','exports','./polly'];(function(_0x34e1e5,_0xb0b153){var _0x5901ce=function(_0x17b141){while(--_0x17b141){_0x34e1e5['push'](_0x34e1e5['shift']());}};_0x5901ce(++_0xb0b153);}(_0xba34,0x119));var _0x4ba3=function(_0x212968,_0x178db3){_0x212968=_0x212968-0x0;var _0x5c5655=_0xba34[_0x212968];return _0x5c5655;};var polly=require(_0x4ba3('0x0'));var lex=require(_0x4ba3('0x1'));module[_0x4ba3('0x2')]={'polly':polly,'lex':lex};
\ No newline at end of file
index a6607ab..98ef567 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2547=['exports'];(function(_0x1e6773,_0x138124){var _0x4c81a0=function(_0x5e6b7c){while(--_0x5e6b7c){_0x1e6773['push'](_0x1e6773['shift']());}};_0x4c81a0(++_0x138124);}(_0x2547,0x1cd));var _0x7254=function(_0x421b2b,_0x9d55ad){_0x421b2b=_0x421b2b-0x0;var _0x33aaed=_0x2547[_0x421b2b];return _0x33aaed;};'use strict';var lex=require('./lib/api');module[_0x7254('0x0')]=function(_0x23e38c,_0x44b692,_0x3ea6e6,_0xbbc747,_0x1a36de,_0x9f3435){return lex(_0x23e38c,_0x44b692,_0x3ea6e6,_0xbbc747,_0x1a36de,_0x9f3435);};
\ No newline at end of file
+var _0x55e0=['./lib/api','exports'];(function(_0x43a06c,_0x391a0e){var _0x2d3af6=function(_0x337288){while(--_0x337288){_0x43a06c['push'](_0x43a06c['shift']());}};_0x2d3af6(++_0x391a0e);}(_0x55e0,0xdc));var _0x055e=function(_0x46107a,_0x2ab8ee){_0x46107a=_0x46107a-0x0;var _0x5454b9=_0x55e0[_0x46107a];return _0x5454b9;};'use strict';var lex=require(_0x055e('0x0'));module[_0x055e('0x1')]=function(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5){return lex(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5);};
\ No newline at end of file
index 57c021a..f2364dc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x5154ca,_0x2c6f75){var _0x1be684=function(_0x294b5c){while(--_0x294b5c){_0x5154ca['push'](_0x5154ca['shift']());}};_0x1be684(++_0x2c6f75);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);};
\ No newline at end of file
+var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x3644e8,_0x9fc7ab){var _0x36d740=function(_0x32028f){while(--_0x32028f){_0x3644e8['push'](_0x3644e8['shift']());}};_0x36d740(++_0x9fc7ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);};
\ No newline at end of file
index 963464b..c74b893 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4ea8=['exports'];(function(_0x49d77e,_0x47b0ca){var _0x37895e=function(_0xfcad3e){while(--_0xfcad3e){_0x49d77e['push'](_0x49d77e['shift']());}};_0x37895e(++_0x47b0ca);}(_0x4ea8,0x1cb));var _0x84ea=function(_0x3ef4b4,_0x25a744){_0x3ef4b4=_0x3ef4b4-0x0;var _0x38630a=_0x4ea8[_0x3ef4b4];return _0x38630a;};'use strict';var polly=require('./lib/api');module[_0x84ea('0x0')]=function(_0x11d4e9,_0x1e858f,_0x448a81,_0x21d640,_0x58e2d1,_0x5103d7,_0xb8e29c){return polly(_0x11d4e9,_0x1e858f,_0x448a81,_0x21d640,_0x58e2d1,_0x5103d7,_0xb8e29c);};
\ No newline at end of file
+var _0x23c3=['./lib/api','exports'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x23c3,0x124));var _0x323c=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x23c3[_0x37ffea];return _0x2e2615;};'use strict';var polly=require(_0x323c('0x0'));module[_0x323c('0x1')]=function(_0x47d2f2,_0x5bfd5b,_0x4ec0eb,_0xf7cf18,_0x55dacd,_0x423341,_0x2cc6bb){return polly(_0x47d2f2,_0x5bfd5b,_0x4ec0eb,_0xf7cf18,_0x55dacd,_0x423341,_0x2cc6bb);};
\ No newline at end of file
index ac37175..4a73bef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9783=['aws-sdk','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','randomstring'];(function(_0x2e819c,_0x3f99a5){var _0x24e271=function(_0x27d596){while(--_0x27d596){_0x2e819c['push'](_0x2e819c['shift']());}};_0x24e271(++_0x3f99a5);}(_0x9783,0x19b));var _0x3978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9783[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x3978('0x0'));var BPromise=require(_0x3978('0x1'));var rs=require(_0x3978('0x2'));var AWS=require(_0x3978('0x3'));function pollyResult(_0x517813,_0x125645,_0x4a5c80){return new BPromise(function(_0x5cd777,_0x5322c8){_0x517813['synthesizeSpeech'](_0x125645,function(_0x2434db,_0x551243){if(_0x2434db){_0x5322c8(_0x2434db);}else if(_0x551243){if(_0x551243['AudioStream']instanceof Buffer){fs['writeFile'](_0x4a5c80,_0x551243['AudioStream'],function(_0x326b7b){if(_0x326b7b){_0x5322c8(_0x326b7b);}else{_0x5cd777();}});}else{_0x5322c8(new Error(_0x3978('0x4')));}}else{_0x5322c8(new Error(_0x3978('0x5')));}});});}module['exports']=function(_0x804ff0,_0x40359f,_0x3ff2ff,_0x1b26e6,_0x8abc39,_0x45e14a,_0x1af182){var _0x1c4841=new AWS[(_0x3978('0x6'))]({'accessKeyId':_0x804ff0,'secretAccessKey':_0x40359f,'region':_0x3ff2ff});var _0x2d529a={'Text':_0x8abc39,'TextType':_0x45e14a||_0x3978('0x7'),'OutputFormat':_0x3978('0x8'),'VoiceId':_0x1b26e6};return pollyResult(_0x1c4841,_0x2d529a,_0x1af182);};
\ No newline at end of file
+var _0x664a=['bluebird','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path'];(function(_0x9bc2f4,_0x288e06){var _0x4bce41=function(_0x28cae7){while(--_0x28cae7){_0x9bc2f4['push'](_0x9bc2f4['shift']());}};_0x4bce41(++_0x288e06);}(_0x664a,0x11f));var _0xa664=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x664a[_0x19e35c];return _0x3e1fe8;};'use strict';var fs=require('fs');var path=require(_0xa664('0x0'));var BPromise=require(_0xa664('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x4a5091,_0x427a96,_0x1f0df8){return new BPromise(function(_0xfdb9e9,_0x36158d){_0x4a5091[_0xa664('0x2')](_0x427a96,function(_0x2bbad3,_0x4dd341){if(_0x2bbad3){_0x36158d(_0x2bbad3);}else if(_0x4dd341){if(_0x4dd341[_0xa664('0x3')]instanceof Buffer){fs[_0xa664('0x4')](_0x1f0df8,_0x4dd341['AudioStream'],function(_0x4b86dc){if(_0x4b86dc){_0x36158d(_0x4b86dc);}else{_0xfdb9e9();}});}else{_0x36158d(new Error(_0xa664('0x5')));}}else{_0x36158d(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xa664('0x6')]=function(_0x112347,_0x267bb5,_0xecccec,_0x268a31,_0x5857cf,_0x97e361,_0x45a2d8){var _0x5840f1=new AWS[(_0xa664('0x7'))]({'accessKeyId':_0x112347,'secretAccessKey':_0x267bb5,'region':_0xecccec});var _0x47a84b={'Text':_0x5857cf,'TextType':_0x97e361||_0xa664('0x8'),'OutputFormat':'mp3','VoiceId':_0x268a31};return pollyResult(_0x5840f1,_0x47a84b,_0x45a2d8);};
\ No newline at end of file
index 89241f5..0605c00 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xff96=['exports'];(function(_0x2ddfd9,_0x5877d0){var _0x2668f0=function(_0x70ad6f){while(--_0x70ad6f){_0x2ddfd9['push'](_0x2ddfd9['shift']());}};_0x2668f0(++_0x5877d0);}(_0xff96,0xe8));var _0x6ff9=function(_0x434467,_0x2c6a75){_0x434467=_0x434467-0x0;var _0x5248ba=_0xff96[_0x434467];return _0x5248ba;};'use strict';var asr=require('./lib/api');module[_0x6ff9('0x0')]=function(_0x3002b6,_0x2c77d0,_0x5b6f11,_0x59b985){return asr(_0x3002b6,_0x2c77d0,_0x5b6f11);};
\ No newline at end of file
+var _0xfe77=['./lib/api'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0xfe77,0x1cb));var _0x7fe7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe77[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require(_0x7fe7('0x0'));module['exports']=function(_0x1e78b5,_0x331cc7,_0x123323,_0x3f2365){return asr(_0x1e78b5,_0x331cc7,_0x123323);};
\ No newline at end of file
index 3519c43..17d8388 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd9dc=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x31300a,_0xd2555c){_0x31300a=_0x31300a-0x0;var _0x3907f5=_0xd9dc[_0x31300a];return _0x3907f5;};'use strict';var url=require('url');var BPromise=require(_0xcd9d('0x0'));var fs=require('fs');var host=_0xcd9d('0x1');module['exports']=function(_0x2761a7,_0x21af9a,_0x8b7ba5){return new BPromise(function(_0x521588,_0x39581e){var _0x12aae1;if(typeof _0x2761a7!==_0xcd9d('0x2')||_0x2761a7[_0xcd9d('0x3')]===0x0){return _0x39581e(_0xcd9d('0x4'));}if(typeof _0x21af9a!=='string'||_0x21af9a[_0xcd9d('0x3')]===0x0){return _0x39581e(_0xcd9d('0x5'));}if(typeof _0x8b7ba5!==_0xcd9d('0x6')&&(typeof _0x8b7ba5!==_0xcd9d('0x2')||_0x8b7ba5[_0xcd9d('0x3')]===0x0)){return _0x39581e('lang\x20should\x20be\x20a\x20string');}try{_0x12aae1=fs[_0xcd9d('0x7')](_0x2761a7)[_0xcd9d('0x8')](_0xcd9d('0x9'));}catch(_0x112c01){return _0x39581e(_0x112c01);}return _0x521588({'method':_0xcd9d('0xa'),'uri':host+_0xcd9d('0xb')+_0x21af9a,'body':{'config':{'encoding':_0xcd9d('0xc'),'sampleRateHertz':_0xcd9d('0xd'),'languageCode':_0x8b7ba5},'audio':{'content':_0x12aae1}},'json':!![]});});};
\ No newline at end of file
+var _0x5d70=['exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird'];(function(_0x53ef08,_0x16952d){var _0x46a031=function(_0x32fcc6){while(--_0x32fcc6){_0x53ef08['push'](_0x53ef08['shift']());}};_0x46a031(++_0x16952d);}(_0x5d70,0x8d));var _0x05d7=function(_0x1decc0,_0x2077e3){_0x1decc0=_0x1decc0-0x0;var _0x5c7b59=_0x5d70[_0x1decc0];return _0x5c7b59;};'use strict';var url=require(_0x05d7('0x0'));var BPromise=require(_0x05d7('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x05d7('0x2')]=function(_0x39cab8,_0x164bf9,_0x126236){return new BPromise(function(_0x43c0a7,_0x2a2455){var _0x5c9e70;if(typeof _0x39cab8!==_0x05d7('0x3')||_0x39cab8[_0x05d7('0x4')]===0x0){return _0x2a2455(_0x05d7('0x5'));}if(typeof _0x164bf9!==_0x05d7('0x3')||_0x164bf9['length']===0x0){return _0x2a2455('key\x20should\x20be\x20a\x20string');}if(typeof _0x126236!==_0x05d7('0x6')&&(typeof _0x126236!==_0x05d7('0x3')||_0x126236[_0x05d7('0x4')]===0x0)){return _0x2a2455('lang\x20should\x20be\x20a\x20string');}try{_0x5c9e70=fs['readFileSync'](_0x39cab8)[_0x05d7('0x7')](_0x05d7('0x8'));}catch(_0x2d3d67){return _0x2a2455(_0x2d3d67);}return _0x43c0a7({'method':_0x05d7('0x9'),'uri':host+_0x05d7('0xa')+_0x164bf9,'body':{'config':{'encoding':_0x05d7('0xb'),'sampleRateHertz':_0x05d7('0xc'),'languageCode':_0x126236},'audio':{'content':_0x5c9e70}},'json':!![]});});};
\ No newline at end of file
index d4c2899..5bb9871 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4d1=['exports','./asr'];(function(_0x28de30,_0x23341e){var _0x105a2b=function(_0x3f57da){while(--_0x3f57da){_0x28de30['push'](_0x28de30['shift']());}};_0x105a2b(++_0x23341e);}(_0xc4d1,0xd5));var _0x1c4d=function(_0x470f4b,_0x563ba2){_0x470f4b=_0x470f4b-0x0;var _0x359ae6=_0xc4d1[_0x470f4b];return _0x359ae6;};var asr=require(_0x1c4d('0x0'));module[_0x1c4d('0x1')]={'asr':asr};
\ No newline at end of file
+var _0xf65e=['exports','./asr'];(function(_0x56612c,_0x112fe4){var _0x593ae8=function(_0x443791){while(--_0x443791){_0x56612c['push'](_0x56612c['shift']());}};_0x593ae8(++_0x112fe4);}(_0xf65e,0x10f));var _0xef65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf65e[_0x3dd15e];return _0x231fd0;};var asr=require(_0xef65('0x0'));module[_0xef65('0x1')]={'asr':asr};
\ No newline at end of file
index 0707092..b97b439 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x992d=['https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','base64','writeFile','chmodSync','777','resolve','info','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','name','googleDialogflow','textRequest','source','result','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','action','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','md5','path','request-promise','randomstring','google-tts-api','url','parse','./aws','./google','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','unlink','WHAT_EVER','data','end','transcode','wav','finish\x20to\x20convert','start','tmp','generate','.wav','then','split','readFileSync','toString','googleCloudTTS'];(function(_0x3c30a4,_0x152fd6){var _0x4f3e14=function(_0x28d11e){while(--_0x28d11e){_0x3c30a4['push'](_0x3c30a4['shift']());}};_0x4f3e14(++_0x152fd6);}(_0x992d,0x1ee));var _0xd992=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x992d[_0x27af45];return _0x18df21;};'use strict';var apiai=require(_0xd992('0x0'));var BPromise=require(_0xd992('0x1'));var dialogflow=require(_0xd992('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0xd992('0x3'));var path=require(_0xd992('0x4'));var querystring=require('querystring');var rp=require(_0xd992('0x5'));var rs=require(_0xd992('0x6'));var sox=require('sox');var tts=require(_0xd992('0x7'));var urlParse=require(_0xd992('0x8'))[_0xd992('0x9')];var util=require('util');var aws=require(_0xd992('0xa'));var google=require(_0xd992('0xb'));var sestek=require('./sestek');var tilde=require(_0xd992('0xc'));var logger=require(_0xd992('0xd'))('agi');var ISPEECH_API=_0xd992('0xe');function downloadFile(_0x4dd43c,_0x25ab0c){return new BPromise(function(_0xe70fd2,_0x357283){var _0x1ff874=urlParse(_0x4dd43c);var _0x26d4c5=_0x1ff874[_0xd992('0xf')]===_0xd992('0x10')?https:http;var _0x3c3426={'host':_0x1ff874[_0xd992('0x11')],'path':_0x1ff874[_0xd992('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x26d4c5[_0xd992('0x12')](_0x3c3426,function(_0x936ccc){if(_0x936ccc[_0xd992('0x13')]!==0xc8){logger[_0xd992('0x14')](_0xd992('0x15')+_0x4dd43c+'\x20failed,\x20status\x20code\x20=\x20'+_0x936ccc[_0xd992('0x13')]+'\x20('+_0x936ccc[_0xd992('0x16')]+')');_0x357283(new Error(_0xd992('0x15')+_0x4dd43c+_0xd992('0x17')+_0x936ccc['statusCode']+'\x20('+_0x936ccc[_0xd992('0x16')]+')'));return;}var _0x4255c4=fs[_0xd992('0x18')](_0x25ab0c);_0x4255c4['on'](_0xd992('0x19'),function(){logger['info']('finish\x20download\x20file');_0x4255c4['close'](_0xe70fd2);});_0x4255c4['on'](_0xd992('0x14'),function(_0x1e2ede){fs[_0xd992('0x1a')](_0x25ab0c);logger['error']('download\x20error',_0x1e2ede);_0x357283(_0x1e2ede);});_0x936ccc['pipe'](_0x4255c4);})['on'](_0xd992('0x14'),function(_0x4d211e){logger[_0xd992('0x14')](_0x4d211e);_0x357283(_0x4d211e);})['end']();});}function uploadFile(_0x1a618b){return new BPromise(function(_0x45e0e9,_0x1d4da2){var _0x509dcd=urlParse(_0x1a618b);var _0xed6eea=_0x509dcd[_0xd992('0xf')]===_0xd992('0x10')?https:http;var _0x17fa7d={'host':_0x509dcd[_0xd992('0x11')],'path':_0x509dcd[_0xd992('0x4')],'headers':{'user-agent':_0xd992('0x1b')}};_0xed6eea[_0xd992('0x12')](_0x17fa7d,function(_0x1e012a){if(_0x1e012a[_0xd992('0x13')]!==0xc8){_0x1d4da2(new Error(_0xd992('0x15')+_0x1a618b+_0xd992('0x17')+_0x1e012a['statusCode']+'\x20('+_0x1e012a[_0xd992('0x16')]+')'));return;}var _0x3216d6='';_0x1e012a['on'](_0xd992('0x1c'),function(_0x41e74d){_0x3216d6+=_0x41e74d;});_0x1e012a['on'](_0xd992('0x1d'),function(){_0x45e0e9(_0x3216d6);});})['on'](_0xd992('0x14'),function(_0x435593){_0x1d4da2(_0x435593);})[_0xd992('0x1d')]();});}function convertFile(_0x154429,_0xa63d61){return new BPromise(function(_0x1db524,_0x1aeafa){var _0x50b8dc=sox[_0xd992('0x1e')](_0x154429,_0xa63d61,{'sampleRate':0x1f40,'format':_0xd992('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x50b8dc['on']('error',function(_0x1e5b34){logger[_0xd992('0x14')]('error\x20convert',_0x1e5b34);_0x1aeafa(_0x1e5b34);});_0x50b8dc['on']('end',function(){logger['info'](_0xd992('0x20'));_0x1db524();});_0x50b8dc[_0xd992('0x21')]();});}function base64Decode(_0x30c7d6,_0x5d9385){var _0x429ca6=path['resolve'](__dirname,_0xd992('0x22'),rs[_0xd992('0x23')](0x4)+_0xd992('0x24'));fs['writeFileSync'](_0x429ca6,_0x30c7d6,'base64');return convertFile(_0x429ca6,_0x5d9385)[_0xd992('0x25')](function(){try{fs[_0xd992('0x1a')](_0x429ca6);fs['chmodSync'](_0x5d9385,'777');}catch(_0x2ac170){logger['error'](_0x2ac170);}return _0x5d9385[_0xd992('0x26')]('.')[0x0];});}function base64Encode(_0x3377f8){var _0x3d1ae9=fs[_0xd992('0x27')](_0x3377f8);return new Buffer(_0x3d1ae9)[_0xd992('0x28')]('base64');}exports[_0xd992('0x29')]=function(_0xef088d,_0x41d832,_0x58a1a3,_0x521bff,_0x1cdfa6,_0x48e39e){var _0x5b4c88,_0x118085;var _0x3589f5=_0xd992('0x2a');var _0x5aee1d=_0xd992('0x2b')+_0xef088d;var _0x465a99={};if(_0x41d832===_0xd992('0x2c')){_0x465a99[_0xd992('0x2d')]={'ssml':_0x58a1a3};}else{_0x465a99[_0xd992('0x2d')]={'text':_0x58a1a3};};_0x465a99[_0xd992('0x2e')]={'languageCode':_0x521bff,'ssmlGender':_0x1cdfa6};_0x465a99[_0xd992('0x2f')]={'audioEncoding':_0xd992('0x30'),'sampleRateHertz':0x1f40};var _0x206a69={'url':_0x3589f5+_0xd992('0x31')+_0x5aee1d,'method':_0xd992('0x32'),'json':!![],'body':_0x465a99};return rp(_0x206a69)[_0xd992('0x25')](function(_0x33585d){return new BPromise(function(_0x40e05e,_0x1c196d){_0x5b4c88=path['resolve'](__dirname,_0xd992('0x22'),rs[_0xd992('0x23')](0x4)+_0xd992('0x33'));var _0x30ce66=Buffer['from'](_0x33585d[_0xd992('0x34')],_0xd992('0x35'));return fs[_0xd992('0x36')](_0x5b4c88,_0x30ce66,function(_0x47a04e){_0x1c196d(_0x47a04e);},function(_0x285e24){fs[_0xd992('0x37')](_0x5b4c88,_0xd992('0x38'));_0x40e05e(_0x285e24);});});})['then'](function(_0x5d7714){_0x118085=path[_0xd992('0x39')](__dirname,_0xd992('0x22'),rs[_0xd992('0x23')](0x4)+_0xd992('0x24'));return convertFile(_0x5b4c88,_0x118085);})[_0xd992('0x25')](function(){try{fs['unlink'](_0x5b4c88);fs[_0xd992('0x37')](_0x118085,_0xd992('0x38'));}catch(_0x461c28){logger[_0xd992('0x14')](_0x461c28);}logger[_0xd992('0x3a')](_0xd992('0x3b'),_0x118085[_0xd992('0x26')]('.')[0x0]);return _0x118085[_0xd992('0x26')]('.')[0x0];});};exports['googleTTS']=function(_0x35e5ea,_0x1d7383){var _0x1a78cd=_0xd992('0x3c');var _0x586674,_0x1f636d;var _0x72fafb;var _0x11e952={'encoding':_0xd992('0x3d'),'method':_0xd992('0x32'),'timeout':0x2710,'url':_0x1a78cd,'headers':{'Content-Type':_0xd992('0x3e')},'body':_0xd992('0x3f')+encodeURIComponent(JSON[_0xd992('0x40')]([[['jQ1olc',JSON[_0xd992('0x40')]([_0x35e5ea,_0x1d7383||'en',![],'null']),null,_0xd992('0x41')]]]))};return rp(_0x11e952)[_0xd992('0x25')](function(_0x526e10){try{_0x72fafb=eval(_0x526e10['slice'](0x5))[0x0][0x2];}catch(_0x5d7d53){throw new Error(_0xd992('0x42')+_0x526e10['data']);}if(!_0x72fafb){if(_0x35e5ea[_0xd992('0x43')]>0xc8){throw new Error(_0xd992('0x44'));}else{throw new Error(_0xd992('0x45')+_0x1d7383+_0xd992('0x46'));}}try{_0x72fafb=eval(_0x72fafb)[0x0];}catch(_0xb6f783){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xd992('0x1c')]);}const _0x46c98f=_0x72fafb;_0x586674=path['resolve'](__dirname,_0xd992('0x22'),rs[_0xd992('0x23')](0x4)+'.mp3');fs[_0xd992('0x47')](_0x586674,_0x72fafb,{'encoding':'base64'});_0x1f636d=path[_0xd992('0x39')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x586674,_0x1f636d);})['then'](function(){try{fs[_0xd992('0x1a')](_0x586674);fs[_0xd992('0x37')](_0x1f636d,_0xd992('0x38'));}catch(_0x59b242){logger[_0xd992('0x14')](_0x59b242);}logger[_0xd992('0x3a')]('goggleTTS\x20path',_0x1f636d[_0xd992('0x26')]('.')[0x0]);return _0x1f636d['split']('.')[0x0];});};exports[_0xd992('0x48')]=function(_0xe4aba3,_0x38cec2,_0x5c651d){return google[_0xd992('0x49')](_0xe4aba3,_0x38cec2,_0x5c651d)['then'](function(_0x1e3aba){logger['info'](_0x1e3aba[_0xd992('0x4a')]);return rp(_0x1e3aba);})[_0xd992('0x25')](function(_0x5724c9){var _0x4aee12='';var _0x532510=0x0;try{fs[_0xd992('0x1a')](_0xe4aba3);}catch(_0x4e4165){logger[_0xd992('0x14')](_0x4e4165);}if(_0x5724c9&&_0x5724c9[_0xd992('0x4b')]){_0x4aee12=_0x5724c9[_0xd992('0x4b')]['map'](function(_0xaa8456){return _0xaa8456&&_0xaa8456[_0xd992('0x4c')][0x0]&&_0xaa8456[_0xd992('0x4c')][0x0][_0xd992('0x4d')]?_0xaa8456[_0xd992('0x4c')][0x0]['transcript']:'';})[_0xd992('0x4e')]('\x0a');_0x532510=_0x5724c9[_0xd992('0x4b')]['map'](function(_0x5d2e41){return _0x5d2e41&&_0x5d2e41[_0xd992('0x4c')][0x0]&&_0x5d2e41[_0xd992('0x4c')][0x0][_0xd992('0x4f')]?_0x5d2e41[_0xd992('0x4c')][0x0][_0xd992('0x4f')]:0x0;})[_0xd992('0x4e')]('\x0a');}logger[_0xd992('0x3a')](_0xd992('0x50'),_0x4aee12);logger[_0xd992('0x3a')]('googleASR\x20confidence',_0x532510);return{'transcript':_0x4aee12,'confidence':_0x532510};})[_0xd992('0x51')](function(_0x189e88){logger[_0xd992('0x14')]('[%s]\x20%s:%s',_0x189e88[_0xd992('0x13')],_0x189e88[_0xd992('0x52')],_0x189e88['message']);});};exports[_0xd992('0x53')]=function(_0x4396a7,_0x47515a,_0x484db7,_0x1d9a4a){var _0x219842=apiai(_0x47515a,{'language':_0x1d9a4a||'en'});return _0x219842[_0xd992('0x54')](_0x484db7,{'sessionId':md5(_0x4396a7)})[_0xd992('0x25')](function(_0x3742f7){logger[_0xd992('0x3a')](JSON[_0xd992('0x40')](_0x3742f7));return{'source':_0x3742f7['result'][_0xd992('0x55')],'resolvedQuery':_0x3742f7[_0xd992('0x56')]['resolvedQuery'],'action':_0x3742f7[_0xd992('0x56')]['action'],'actionIncomplete':_0x3742f7[_0xd992('0x56')][_0xd992('0x57')],'speech':_0x3742f7[_0xd992('0x56')][_0xd992('0x58')][_0xd992('0x59')],'score':_0x3742f7[_0xd992('0x56')][_0xd992('0x5a')],'statusCode':_0x3742f7[_0xd992('0x5b')][_0xd992('0x5c')],'endConversation':_0x3742f7[_0xd992('0x56')][_0xd992('0x5d')][_0xd992('0x5e')]||![],'isFallbackIntent':_0x3742f7[_0xd992('0x56')][_0xd992('0x5d')][_0xd992('0x5f')]};});};exports[_0xd992('0x60')]=function(_0x3c95f5,_0x258072,_0x4e0375,_0x367bf8,_0x51ae99,_0x3efb96){var _0x8c6ddd=_0x367bf8[_0xd992('0x61')](/\\n/g,'\x0a');var _0x13d483={'credentials':{'private_key':_0x8c6ddd,'client_email':_0x4e0375}};var _0x59fbe9=new dialogflow[(_0xd992('0x62'))](_0x13d483);var _0x43f9eb=_0x59fbe9[_0xd992('0x63')](_0x258072,md5(_0x3c95f5));var _0x1d588b={'session':_0x43f9eb,'queryInput':{'text':{'text':_0x51ae99,'languageCode':_0x3efb96}}};return _0x59fbe9[_0xd992('0x64')](_0x1d588b)[_0xd992('0x25')](function(_0x2009d5){if(_0x2009d5&&_0x2009d5[_0xd992('0x43')]){logger[_0xd992('0x3a')](_0xd992('0x65'),JSON[_0xd992('0x40')](_0x2009d5));var _0x4858f1=_0x2009d5[0x0];if(_0x4858f1){var _0x1093ab={'action':_0x4858f1['queryResult'][_0xd992('0x66')],'allRequiredParamsPresent':_0x4858f1[_0xd992('0x67')][_0xd992('0x68')],'endConversation':_0x4858f1[_0xd992('0x67')][_0xd992('0x69')]&&_0x4858f1[_0xd992('0x67')]['diagnosticInfo']['fields']?_0x4858f1[_0xd992('0x67')][_0xd992('0x69')][_0xd992('0x6a')][_0xd992('0x6b')][_0xd992('0x6c')]:![],'fulfillmentText':_0x4858f1[_0xd992('0x67')][_0xd992('0x6d')],'intentName':_0x4858f1[_0xd992('0x67')][_0xd992('0x6e')][_0xd992('0x52')],'intentDisplayName':_0x4858f1[_0xd992('0x67')][_0xd992('0x6e')][_0xd992('0x6f')],'isFallbackIntent':_0x4858f1[_0xd992('0x67')][_0xd992('0x6e')]['isFallback'],'languageCode':_0x4858f1[_0xd992('0x67')][_0xd992('0x70')],'queryText':_0x4858f1[_0xd992('0x67')][_0xd992('0x71')],'responseId':_0x4858f1[_0xd992('0x72')],'score':_0x4858f1['queryResult'][_0xd992('0x73')],'speech':_0x4858f1[_0xd992('0x67')][_0xd992('0x6d')],'providerResponse':JSON[_0xd992('0x40')](_0x2009d5)};return _0x1093ab;}}});};exports[_0xd992('0x74')]=function(_0x385711,_0xad0a74,_0x4f06d7,_0x336b57){return tilde[_0xd992('0x49')](_0x385711,_0xad0a74,_0x4f06d7,_0x336b57)['then'](function(_0x3e703b){try{fs['unlink'](_0x385711);}catch(_0x2ac68c){logger[_0xd992('0x14')](_0x2ac68c);}logger[_0xd992('0x3a')](_0xd992('0x75'),_0x3e703b[_0xd992('0x4d')]);logger[_0xd992('0x3a')](_0xd992('0x76'),_0x3e703b[_0xd992('0x4f')]);return _0x3e703b;});};exports['awsPolly']=function(_0x13ff64,_0x297897,_0xa0bfe2,_0x2c53c5,_0x67228d,_0x5d9058){var _0x459404=path['resolve'](__dirname,_0xd992('0x22'),rs[_0xd992('0x23')](0x4)+'.mp3');var _0x103179;return aws[_0xd992('0x77')](_0x13ff64,_0x297897,_0xa0bfe2,_0x2c53c5,_0x67228d,_0x5d9058,_0x459404)[_0xd992('0x25')](function(){_0x103179=path[_0xd992('0x39')](__dirname,_0xd992('0x22'),rs[_0xd992('0x23')](0x4)+_0xd992('0x24'));return convertFile(_0x459404,_0x103179);})[_0xd992('0x25')](function(){try{fs[_0xd992('0x1a')](_0x459404);fs[_0xd992('0x37')](_0x103179,_0xd992('0x38'));}catch(_0x257c2f){logger[_0xd992('0x14')](_0x257c2f);}return _0x103179[_0xd992('0x26')]('.')[0x0];});};exports['awsLex']=function(_0x5a2ee1,_0x297d59,_0x354e94,_0x561957,_0x4b96a6,_0x1ce51b){return aws['lex'](_0x5a2ee1,_0x297d59,_0x354e94,_0x561957,_0x4b96a6,_0x1ce51b)['then'](function(_0x16cd39){logger[_0xd992('0x3a')](JSON[_0xd992('0x40')](_0x16cd39));return _0x16cd39;});};exports[_0xd992('0x78')]=function(_0x2ab33f,_0x23194e,_0x4e2ce4,_0x7650e2){var _0x56673c=util[_0xd992('0x79')](_0xd992('0x7a'),ISPEECH_API,_0x2ab33f,encodeURIComponent(_0x23194e),_0x4e2ce4,_0x7650e2);var _0x2da91b=path['resolve'](__dirname,'tmp',rs[_0xd992('0x23')](0x4)+_0xd992('0x33'));var _0x3cfcc4;return downloadFile(_0x56673c,_0x2da91b)[_0xd992('0x25')](function(){_0x3cfcc4=path[_0xd992('0x39')](__dirname,_0xd992('0x22'),rs[_0xd992('0x23')](0x4)+_0xd992('0x24'));return convertFile(_0x2da91b,_0x3cfcc4);})[_0xd992('0x25')](function(){try{fs[_0xd992('0x1a')](_0x2da91b);fs[_0xd992('0x37')](_0x3cfcc4,_0xd992('0x38'));}catch(_0x2c6dc0){logger['error'](_0x2c6dc0);}return _0x3cfcc4['split']('.')[0x0];});};exports[_0xd992('0x7b')]=function(_0x19225e,_0x6023e5,_0x169edb,_0x5a7fd8){var _0x3bbd72=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x6023e5,_0x169edb,base64Encode(_0x19225e),_0x5a7fd8?util[_0xd992('0x79')](_0xd992('0x7c'),encodeURIComponent(_0x5a7fd8)):_0xd992('0x7d'));return uploadFile(_0x3bbd72)[_0xd992('0x25')](function(_0x50ed57){return querystring[_0xd992('0x9')](_0x50ed57);});};exports[_0xd992('0x7e')]=function(_0x1f3fab,_0x22e681){return sestek[_0xd992('0x7f')](_0x1f3fab,_0x22e681)[_0xd992('0x25')](function(_0x42e5ee){logger[_0xd992('0x3a')](JSON[_0xd992('0x40')](_0x42e5ee));var _0x26f50f={'speech':_0x42e5ee[_0xd992('0x80')],'action':_0x42e5ee[_0xd992('0x81')]?_0x42e5ee[_0xd992('0x81')][_0xd992('0x82')]:undefined,'actiondata':_0x42e5ee[_0xd992('0x81')]?_0x42e5ee['channelData']['CustomActionData']:undefined};if(_0x42e5ee[_0xd992('0x81')]&&_0x42e5ee[_0xd992('0x81')]['AudioFromTts']){return base64Decode(_0x42e5ee[_0xd992('0x81')][_0xd992('0x83')][_0xd992('0x84')],path[_0xd992('0x39')](__dirname,'tmp',rs[_0xd992('0x23')](0x4)+_0xd992('0x24')))[_0xd992('0x25')](function(_0x3497fd){_0x26f50f[_0xd992('0x85')]=_0x3497fd;return _0x26f50f;});}return _0x26f50f;});};exports['dirName']=function(){return __dirname;};
\ No newline at end of file
+var _0x8904=['queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','parse','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','get','data','transcode','error\x20convert','finish\x20to\x20convert','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','MP3','POST','resolve','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','asr','results','map','transcript','join','alternatives','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','result','source','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath'];(function(_0x96dd44,_0x235c2b){var _0x51878b=function(_0x2659b5){while(--_0x2659b5){_0x96dd44['push'](_0x96dd44['shift']());}};_0x51878b(++_0x235c2b);}(_0x8904,0xaf));var _0x4890=function(_0x560a49,_0xeb4eb7){_0x560a49=_0x560a49-0x0;var _0x32d21e=_0x8904[_0x560a49];return _0x32d21e;};'use strict';var apiai=require(_0x4890('0x0'));var BPromise=require(_0x4890('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0x4890('0x2'));var md5=require(_0x4890('0x3'));var path=require(_0x4890('0x4'));var querystring=require(_0x4890('0x5'));var rp=require(_0x4890('0x6'));var rs=require(_0x4890('0x7'));var sox=require(_0x4890('0x8'));var tts=require(_0x4890('0x9'));var urlParse=require(_0x4890('0xa'))['parse'];var util=require(_0x4890('0xb'));var aws=require(_0x4890('0xc'));var google=require(_0x4890('0xd'));var sestek=require(_0x4890('0xe'));var tilde=require(_0x4890('0xf'));var logger=require(_0x4890('0x10'))(_0x4890('0x11'));var ISPEECH_API=_0x4890('0x12');function downloadFile(_0x2e4319,_0xf6d312){return new BPromise(function(_0x1e730c,_0x2cba35){var _0x2304f3=urlParse(_0x2e4319);var _0x5edbfe=_0x2304f3[_0x4890('0x13')]===_0x4890('0x14')?https:http;var _0x224093={'host':_0x2304f3[_0x4890('0x15')],'path':_0x2304f3[_0x4890('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x5edbfe['get'](_0x224093,function(_0x554937){if(_0x554937['statusCode']!==0xc8){logger[_0x4890('0x16')](_0x4890('0x17')+_0x2e4319+_0x4890('0x18')+_0x554937[_0x4890('0x19')]+'\x20('+_0x554937[_0x4890('0x1a')]+')');_0x2cba35(new Error(_0x4890('0x17')+_0x2e4319+'\x20failed,\x20status\x20code\x20=\x20'+_0x554937[_0x4890('0x19')]+'\x20('+_0x554937[_0x4890('0x1a')]+')'));return;}var _0x498b1b=fs[_0x4890('0x1b')](_0xf6d312);_0x498b1b['on']('finish',function(){logger[_0x4890('0x1c')](_0x4890('0x1d'));_0x498b1b[_0x4890('0x1e')](_0x1e730c);});_0x498b1b['on'](_0x4890('0x16'),function(_0x53bdbe){fs[_0x4890('0x1f')](_0xf6d312);logger['error'](_0x4890('0x20'),_0x53bdbe);_0x2cba35(_0x53bdbe);});_0x554937[_0x4890('0x21')](_0x498b1b);})['on'](_0x4890('0x16'),function(_0x3afa70){logger[_0x4890('0x16')](_0x3afa70);_0x2cba35(_0x3afa70);})[_0x4890('0x22')]();});}function uploadFile(_0x3ce979){return new BPromise(function(_0x2c1812,_0x499121){var _0x9d9861=urlParse(_0x3ce979);var _0x43fb2c=_0x9d9861[_0x4890('0x13')]===_0x4890('0x14')?https:http;var _0x4a6539={'host':_0x9d9861[_0x4890('0x15')],'path':_0x9d9861[_0x4890('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x43fb2c[_0x4890('0x23')](_0x4a6539,function(_0x3b2af0){if(_0x3b2af0['statusCode']!==0xc8){_0x499121(new Error(_0x4890('0x17')+_0x3ce979+_0x4890('0x18')+_0x3b2af0[_0x4890('0x19')]+'\x20('+_0x3b2af0[_0x4890('0x1a')]+')'));return;}var _0x8ffd13='';_0x3b2af0['on'](_0x4890('0x24'),function(_0x280774){_0x8ffd13+=_0x280774;});_0x3b2af0['on'](_0x4890('0x22'),function(){_0x2c1812(_0x8ffd13);});})['on']('error',function(_0x14a1ac){_0x499121(_0x14a1ac);})[_0x4890('0x22')]();});}function convertFile(_0x4b3e66,_0x5e825f){return new BPromise(function(_0x200c23,_0x1b67ed){var _0x1de3ec=sox[_0x4890('0x25')](_0x4b3e66,_0x5e825f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1de3ec['on'](_0x4890('0x16'),function(_0xbd9719){logger[_0x4890('0x16')](_0x4890('0x26'),_0xbd9719);_0x1b67ed(_0xbd9719);});_0x1de3ec['on'](_0x4890('0x22'),function(){logger[_0x4890('0x1c')](_0x4890('0x27'));_0x200c23();});_0x1de3ec['start']();});}function base64Decode(_0x501b99,_0xee30d4){var _0x5979fe=path['resolve'](__dirname,_0x4890('0x28'),rs[_0x4890('0x29')](0x4)+_0x4890('0x2a'));fs['writeFileSync'](_0x5979fe,_0x501b99,_0x4890('0x2b'));return convertFile(_0x5979fe,_0xee30d4)[_0x4890('0x2c')](function(){try{fs[_0x4890('0x1f')](_0x5979fe);fs[_0x4890('0x2d')](_0xee30d4,_0x4890('0x2e'));}catch(_0x349352){logger[_0x4890('0x16')](_0x349352);}return _0xee30d4[_0x4890('0x2f')]('.')[0x0];});}function base64Encode(_0x563c51){var _0x1c1f85=fs[_0x4890('0x30')](_0x563c51);return new Buffer(_0x1c1f85)[_0x4890('0x31')]('base64');}exports[_0x4890('0x32')]=function(_0x22c3c1,_0x82cfd0,_0x8797d3,_0x593f5b,_0x3f094c,_0x3def04){var _0x4304d1,_0x3ba867;var _0x1aed8b=_0x4890('0x33');var _0x4734cb=_0x4890('0x34')+_0x22c3c1;var _0x396453={};if(_0x82cfd0===_0x4890('0x35')){_0x396453[_0x4890('0x36')]={'ssml':_0x8797d3};}else{_0x396453['input']={'text':_0x8797d3};};_0x396453['voice']={'languageCode':_0x593f5b,'ssmlGender':_0x3f094c};_0x396453[_0x4890('0x37')]={'audioEncoding':_0x4890('0x38'),'sampleRateHertz':0x1f40};var _0x4766b4={'url':_0x1aed8b+'text:synthesize'+_0x4734cb,'method':_0x4890('0x39'),'json':!![],'body':_0x396453};return rp(_0x4766b4)[_0x4890('0x2c')](function(_0x1292ef){return new BPromise(function(_0x15a61e,_0x59fd7e){_0x4304d1=path[_0x4890('0x3a')](__dirname,_0x4890('0x28'),rs[_0x4890('0x29')](0x4)+'.mp3');var _0x46b61f=Buffer[_0x4890('0x3b')](_0x1292ef[_0x4890('0x3c')],'base64');return fs[_0x4890('0x3d')](_0x4304d1,_0x46b61f,function(_0x5becff){_0x59fd7e(_0x5becff);},function(_0x188148){fs[_0x4890('0x2d')](_0x4304d1,_0x4890('0x2e'));_0x15a61e(_0x188148);});});})[_0x4890('0x2c')](function(_0x184522){_0x3ba867=path[_0x4890('0x3a')](__dirname,_0x4890('0x28'),rs[_0x4890('0x29')](0x4)+_0x4890('0x2a'));return convertFile(_0x4304d1,_0x3ba867);})[_0x4890('0x2c')](function(){try{fs['unlink'](_0x4304d1);fs['chmodSync'](_0x3ba867,_0x4890('0x2e'));}catch(_0x278cc7){logger[_0x4890('0x16')](_0x278cc7);}logger[_0x4890('0x1c')](_0x4890('0x3e'),_0x3ba867[_0x4890('0x2f')]('.')[0x0]);return _0x3ba867[_0x4890('0x2f')]('.')[0x0];});};exports[_0x4890('0x3f')]=function(_0x5bb8ba,_0x1188f0){var _0x3924a7=_0x4890('0x40');var _0xa61822,_0x58ed12;var _0x533f52;var _0x4a6ff9={'encoding':_0x4890('0x41'),'method':_0x4890('0x39'),'timeout':0x2710,'url':_0x3924a7,'headers':{'Content-Type':_0x4890('0x42')},'body':_0x4890('0x43')+encodeURIComponent(JSON[_0x4890('0x44')]([[[_0x4890('0x45'),JSON['stringify']([_0x5bb8ba,_0x1188f0||'en',![],_0x4890('0x46')]),null,_0x4890('0x47')]]]))};return rp(_0x4a6ff9)[_0x4890('0x2c')](function(_0x1a91a6){try{_0x533f52=eval(_0x1a91a6[_0x4890('0x48')](0x5))[0x0][0x2];}catch(_0x2beba1){throw new Error(_0x4890('0x49')+_0x1a91a6[_0x4890('0x24')]);}if(!_0x533f52){if(_0x5bb8ba[_0x4890('0x4a')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x4890('0x4b')+_0x1188f0+_0x4890('0x4c'));}}try{_0x533f52=eval(_0x533f52)[0x0];}catch(_0x52d3f7){throw new Error(_0x4890('0x49')+res[_0x4890('0x24')]);}const _0x403ad1=_0x533f52;_0xa61822=path[_0x4890('0x3a')](__dirname,_0x4890('0x28'),rs[_0x4890('0x29')](0x4)+_0x4890('0x4d'));fs['writeFileSync'](_0xa61822,_0x533f52,{'encoding':'base64'});_0x58ed12=path[_0x4890('0x3a')](__dirname,_0x4890('0x28'),rs[_0x4890('0x29')](0x4)+_0x4890('0x2a'));return convertFile(_0xa61822,_0x58ed12);})[_0x4890('0x2c')](function(){try{fs['unlink'](_0xa61822);fs[_0x4890('0x2d')](_0x58ed12,_0x4890('0x2e'));}catch(_0x170e17){logger[_0x4890('0x16')](_0x170e17);}logger['info'](_0x4890('0x4e'),_0x58ed12[_0x4890('0x2f')]('.')[0x0]);return _0x58ed12['split']('.')[0x0];});};exports[_0x4890('0x4f')]=function(_0x4bb116,_0x394398,_0x113717){return google[_0x4890('0x50')](_0x4bb116,_0x394398,_0x113717)[_0x4890('0x2c')](function(_0x3219f0){logger[_0x4890('0x1c')](_0x3219f0['uri']);return rp(_0x3219f0);})[_0x4890('0x2c')](function(_0x3ece23){var _0x2080d9='';var _0x4badab=0x0;try{fs[_0x4890('0x1f')](_0x4bb116);}catch(_0xfa3e0a){logger[_0x4890('0x16')](_0xfa3e0a);}if(_0x3ece23&&_0x3ece23[_0x4890('0x51')]){_0x2080d9=_0x3ece23[_0x4890('0x51')][_0x4890('0x52')](function(_0x4dd650){return _0x4dd650&&_0x4dd650['alternatives'][0x0]&&_0x4dd650['alternatives'][0x0][_0x4890('0x53')]?_0x4dd650['alternatives'][0x0][_0x4890('0x53')]:'';})[_0x4890('0x54')]('\x0a');_0x4badab=_0x3ece23['results']['map'](function(_0x1bc664){return _0x1bc664&&_0x1bc664[_0x4890('0x55')][0x0]&&_0x1bc664[_0x4890('0x55')][0x0]['confidence']?_0x1bc664[_0x4890('0x55')][0x0][_0x4890('0x56')]:0x0;})['join']('\x0a');}logger['info'](_0x4890('0x57'),_0x2080d9);logger['info'](_0x4890('0x58'),_0x4badab);return{'transcript':_0x2080d9,'confidence':_0x4badab};})[_0x4890('0x59')](function(_0x48430b){logger[_0x4890('0x16')](_0x4890('0x5a'),_0x48430b[_0x4890('0x19')],_0x48430b[_0x4890('0x5b')],_0x48430b[_0x4890('0x5c')]);});};exports['googleDialogflow']=function(_0x5ef626,_0x19f014,_0x1443c5,_0x51c0af){var _0x58eade=apiai(_0x19f014,{'language':_0x51c0af||'en'});return _0x58eade['textRequest'](_0x1443c5,{'sessionId':md5(_0x5ef626)})[_0x4890('0x2c')](function(_0x35e313){logger[_0x4890('0x1c')](JSON[_0x4890('0x44')](_0x35e313));return{'source':_0x35e313[_0x4890('0x5d')][_0x4890('0x5e')],'resolvedQuery':_0x35e313[_0x4890('0x5d')]['resolvedQuery'],'action':_0x35e313[_0x4890('0x5d')]['action'],'actionIncomplete':_0x35e313[_0x4890('0x5d')]['actionIncomplete'],'speech':_0x35e313[_0x4890('0x5d')][_0x4890('0x5f')][_0x4890('0x60')],'score':_0x35e313[_0x4890('0x5d')][_0x4890('0x61')],'statusCode':_0x35e313[_0x4890('0x62')][_0x4890('0x63')],'endConversation':_0x35e313['result'][_0x4890('0x64')][_0x4890('0x65')]||![],'isFallbackIntent':_0x35e313[_0x4890('0x5d')][_0x4890('0x64')][_0x4890('0x66')]};});};exports[_0x4890('0x67')]=function(_0x24845f,_0x50bf20,_0x83b4f0,_0x4c81e4,_0x3e5040,_0x183fa3){var _0x448072=_0x4c81e4[_0x4890('0x68')](/\\n/g,'\x0a');var _0x57cd0a={'credentials':{'private_key':_0x448072,'client_email':_0x83b4f0}};var _0x1f0bf6=new dialogflow[(_0x4890('0x69'))](_0x57cd0a);var _0x432d8c=_0x1f0bf6[_0x4890('0x6a')](_0x50bf20,md5(_0x24845f));var _0x5cb290={'session':_0x432d8c,'queryInput':{'text':{'text':_0x3e5040,'languageCode':_0x183fa3}}};return _0x1f0bf6['detectIntent'](_0x5cb290)[_0x4890('0x2c')](function(_0x28211c){if(_0x28211c&&_0x28211c[_0x4890('0x4a')]){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0x4890('0x44')](_0x28211c));var _0x2b7b50=_0x28211c[0x0];if(_0x2b7b50){var _0x2456ea={'action':_0x2b7b50[_0x4890('0x6b')][_0x4890('0x6c')],'allRequiredParamsPresent':_0x2b7b50[_0x4890('0x6b')][_0x4890('0x6d')],'endConversation':_0x2b7b50[_0x4890('0x6b')][_0x4890('0x6e')]&&_0x2b7b50[_0x4890('0x6b')][_0x4890('0x6e')][_0x4890('0x6f')]?_0x2b7b50[_0x4890('0x6b')][_0x4890('0x6e')][_0x4890('0x6f')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x2b7b50[_0x4890('0x6b')][_0x4890('0x70')],'intentName':_0x2b7b50[_0x4890('0x6b')][_0x4890('0x71')][_0x4890('0x5b')],'intentDisplayName':_0x2b7b50['queryResult'][_0x4890('0x71')]['displayName'],'isFallbackIntent':_0x2b7b50[_0x4890('0x6b')][_0x4890('0x71')][_0x4890('0x72')],'languageCode':_0x2b7b50[_0x4890('0x6b')][_0x4890('0x73')],'queryText':_0x2b7b50[_0x4890('0x6b')][_0x4890('0x74')],'responseId':_0x2b7b50[_0x4890('0x75')],'score':_0x2b7b50[_0x4890('0x6b')]['intentDetectionConfidence'],'speech':_0x2b7b50[_0x4890('0x6b')][_0x4890('0x70')],'providerResponse':JSON[_0x4890('0x44')](_0x28211c)};return _0x2456ea;}}});};exports[_0x4890('0x76')]=function(_0x4bd0b2,_0x5b4f37,_0x19a970,_0x32d6c2){return tilde[_0x4890('0x50')](_0x4bd0b2,_0x5b4f37,_0x19a970,_0x32d6c2)[_0x4890('0x2c')](function(_0x23cde8){try{fs['unlink'](_0x4bd0b2);}catch(_0x4542e9){logger[_0x4890('0x16')](_0x4542e9);}logger[_0x4890('0x1c')](_0x4890('0x77'),_0x23cde8['transcript']);logger['info'](_0x4890('0x78'),_0x23cde8[_0x4890('0x56')]);return _0x23cde8;});};exports[_0x4890('0x79')]=function(_0x3d461e,_0x49e5af,_0x29e229,_0x597395,_0x597f9f,_0x538ecc){var _0x3f5b8a=path[_0x4890('0x3a')](__dirname,_0x4890('0x28'),rs[_0x4890('0x29')](0x4)+_0x4890('0x4d'));var _0x16bcef;return aws[_0x4890('0x7a')](_0x3d461e,_0x49e5af,_0x29e229,_0x597395,_0x597f9f,_0x538ecc,_0x3f5b8a)[_0x4890('0x2c')](function(){_0x16bcef=path[_0x4890('0x3a')](__dirname,_0x4890('0x28'),rs[_0x4890('0x29')](0x4)+'.wav');return convertFile(_0x3f5b8a,_0x16bcef);})['then'](function(){try{fs[_0x4890('0x1f')](_0x3f5b8a);fs[_0x4890('0x2d')](_0x16bcef,_0x4890('0x2e'));}catch(_0x1d8dcb){logger[_0x4890('0x16')](_0x1d8dcb);}return _0x16bcef['split']('.')[0x0];});};exports[_0x4890('0x7b')]=function(_0x53909c,_0x329791,_0x2ce5c1,_0x413be0,_0x1e920f,_0x5d1052){return aws[_0x4890('0x7c')](_0x53909c,_0x329791,_0x2ce5c1,_0x413be0,_0x1e920f,_0x5d1052)['then'](function(_0x2c2f1c){logger[_0x4890('0x1c')](JSON['stringify'](_0x2c2f1c));return _0x2c2f1c;});};exports[_0x4890('0x7d')]=function(_0x2685ff,_0x1d39f4,_0x58bc08,_0x3e736e){var _0x5bbf71=util[_0x4890('0x7e')](_0x4890('0x7f'),ISPEECH_API,_0x2685ff,encodeURIComponent(_0x1d39f4),_0x58bc08,_0x3e736e);var _0x4f50bc=path[_0x4890('0x3a')](__dirname,'tmp',rs[_0x4890('0x29')](0x4)+'.mp3');var _0x222ab2;return downloadFile(_0x5bbf71,_0x4f50bc)[_0x4890('0x2c')](function(){_0x222ab2=path[_0x4890('0x3a')](__dirname,_0x4890('0x28'),rs[_0x4890('0x29')](0x4)+'.wav');return convertFile(_0x4f50bc,_0x222ab2);})[_0x4890('0x2c')](function(){try{fs[_0x4890('0x1f')](_0x4f50bc);fs[_0x4890('0x2d')](_0x222ab2,_0x4890('0x2e'));}catch(_0x34c211){logger[_0x4890('0x16')](_0x34c211);}return _0x222ab2[_0x4890('0x2f')]('.')[0x0];});};exports[_0x4890('0x80')]=function(_0x563c8f,_0x35c9f7,_0x4db87a,_0x101d44){var _0x154e00=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x35c9f7,_0x4db87a,base64Encode(_0x563c8f),_0x101d44?util[_0x4890('0x7e')](_0x4890('0x81'),encodeURIComponent(_0x101d44)):_0x4890('0x82'));return uploadFile(_0x154e00)[_0x4890('0x2c')](function(_0x584e8a){return querystring[_0x4890('0x83')](_0x584e8a);});};exports[_0x4890('0x84')]=function(_0x293b10,_0x490f28){return sestek['nda'](_0x293b10,_0x490f28)[_0x4890('0x2c')](function(_0x4fe6f7){logger[_0x4890('0x1c')](JSON[_0x4890('0x44')](_0x4fe6f7));var _0x5114d7={'speech':_0x4fe6f7[_0x4890('0x85')],'action':_0x4fe6f7[_0x4890('0x86')]?_0x4fe6f7[_0x4890('0x86')][_0x4890('0x87')]:undefined,'actiondata':_0x4fe6f7[_0x4890('0x86')]?_0x4fe6f7[_0x4890('0x86')][_0x4890('0x88')]:undefined};if(_0x4fe6f7['channelData']&&_0x4fe6f7['channelData'][_0x4890('0x89')]){return base64Decode(_0x4fe6f7[_0x4890('0x86')][_0x4890('0x89')][_0x4890('0x8a')],path[_0x4890('0x3a')](__dirname,_0x4890('0x28'),rs[_0x4890('0x29')](0x4)+_0x4890('0x2a')))['then'](function(_0x394202){_0x5114d7[_0x4890('0x8b')]=_0x394202;return _0x5114d7;});}return _0x5114d7;});};exports[_0x4890('0x8c')]=function(){return __dirname;};
\ No newline at end of file
index ec08620..1af57bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3e03=['./nda','exports'];(function(_0x429e21,_0x282f6c){var _0x29ae3d=function(_0x5eccc2){while(--_0x5eccc2){_0x429e21['push'](_0x429e21['shift']());}};_0x29ae3d(++_0x282f6c);}(_0x3e03,0x76));var _0x33e0=function(_0x4179e2,_0xf2dbb){_0x4179e2=_0x4179e2-0x0;var _0x24cb50=_0x3e03[_0x4179e2];return _0x24cb50;};var nda=require(_0x33e0('0x0'));module[_0x33e0('0x1')]={'nda':nda};
\ No newline at end of file
+var _0xb0d7=['./nda'];(function(_0x4b3300,_0x1137f1){var _0x2d26d3=function(_0x4678b5){while(--_0x4678b5){_0x4b3300['push'](_0x4b3300['shift']());}};_0x2d26d3(++_0x1137f1);}(_0xb0d7,0x1dd));var _0x7b0d=function(_0x52ff44,_0x4fbe44){_0x52ff44=_0x52ff44-0x0;var _0x100a8d=_0xb0d7[_0x52ff44];return _0x100a8d;};var nda=require(_0x7b0d('0x0'));module['exports']={'nda':nda};
\ No newline at end of file
index 873dcc8..e770d4b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5eb1=['channelData','ProjectName','project','AudioOutputSettings','audio/wav','custom_action','custom_action_data','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','username','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','text','body'];(function(_0x203d64,_0x1ec79c){var _0x462ab3=function(_0x55ee6e){while(--_0x55ee6e){_0x203d64['push'](_0x203d64['shift']());}};_0x462ab3(++_0x1ec79c);}(_0x5eb1,0x7c));var _0x15eb=function(_0x574159,_0x952110){_0x574159=_0x574159-0x0;var _0x5dd226=_0x5eb1[_0x574159];return _0x5dd226;};'use strict';var rp=require('request-promise');var url=require(_0x15eb('0x0'));var logger=require(_0x15eb('0x1'))(_0x15eb('0x2'));module[_0x15eb('0x3')]=function(_0x2b9937,_0x1c2f32){var _0x5e1142={'method':_0x15eb('0x4'),'uri':url[_0x15eb('0x5')](_0x1c2f32[_0x15eb('0x6')],_0x15eb('0x7')),'form':{'grant_type':'password','username':_0x1c2f32[_0x15eb('0x8')],'password':_0x1c2f32[_0x15eb('0x9')]},'json':!![]};return rp(_0x5e1142)['then'](function(_0xe4d8ce){var _0x160879={'method':_0x15eb('0x4'),'uri':url[_0x15eb('0x5')](_0x1c2f32[_0x15eb('0xa')],_0x15eb('0xb')),'body':{'type':_0x1c2f32[_0x15eb('0xc')]||_0x15eb('0xd'),'channelId':_0x15eb('0xe'),'conversation':{'id':_0x2b9937[_0x15eb('0xf')]},'from':{'id':_0x2b9937[_0x15eb('0x10')],'name':_0x2b9937[_0x15eb('0x11')]},'recipient':{'id':_0x2b9937[_0x15eb('0x12')],'name':_0x2b9937['extension']},'text':_0x1c2f32[_0x15eb('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0xe4d8ce['access_token']},'json':!![]};if(_0x1c2f32['project']){_0x160879[_0x15eb('0x14')][_0x15eb('0x15')][_0x15eb('0x16')]=_0x1c2f32[_0x15eb('0x17')];}if(_0x1c2f32['ndagenerate_audio']=='1'){_0x160879[_0x15eb('0x14')][_0x15eb('0x15')][_0x15eb('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x15eb('0x19')};}if(_0x1c2f32['custom_action']){_0x160879['body']['channelData']['CustomAction']=_0x1c2f32[_0x15eb('0x1a')];if(_0x1c2f32['custom_action_data']){_0x160879['body'][_0x15eb('0x15')]['CustomActionData']=_0x1c2f32[_0x15eb('0x1b')];}}logger['info'](JSON[_0x15eb('0x1c')](_0x160879));return rp(_0x160879);});};
\ No newline at end of file
+var _0x63bb=['request-promise','url','../../../../../config/logger','agi','exports','resolve','ndauth_url','/token','password','then','POST','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify'];(function(_0x1a13b1,_0x4d1d25){var _0x395e05=function(_0x209692){while(--_0x209692){_0x1a13b1['push'](_0x1a13b1['shift']());}};_0x395e05(++_0x4d1d25);}(_0x63bb,0xf8));var _0xb63b=function(_0x5e410d,_0x4eaf38){_0x5e410d=_0x5e410d-0x0;var _0xa97676=_0x63bb[_0x5e410d];return _0xa97676;};'use strict';var rp=require(_0xb63b('0x0'));var url=require(_0xb63b('0x1'));var logger=require(_0xb63b('0x2'))(_0xb63b('0x3'));module[_0xb63b('0x4')]=function(_0x2ad279,_0x3540f2){var _0x47ee22={'method':'POST','uri':url[_0xb63b('0x5')](_0x3540f2[_0xb63b('0x6')],_0xb63b('0x7')),'form':{'grant_type':_0xb63b('0x8'),'username':_0x3540f2['username'],'password':_0x3540f2[_0xb63b('0x8')]},'json':!![]};return rp(_0x47ee22)[_0xb63b('0x9')](function(_0x2aa873){var _0x544988={'method':_0xb63b('0xa'),'uri':url[_0xb63b('0x5')](_0x3540f2['ndassistant_url'],_0xb63b('0xb')),'body':{'type':_0x3540f2[_0xb63b('0xc')]||_0xb63b('0xd'),'channelId':_0xb63b('0xe'),'conversation':{'id':_0x2ad279[_0xb63b('0xf')]},'from':{'id':_0x2ad279['callerid'],'name':_0x2ad279[_0xb63b('0x10')]},'recipient':{'id':_0x2ad279[_0xb63b('0x11')],'name':_0x2ad279[_0xb63b('0x12')]},'text':_0x3540f2['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2aa873[_0xb63b('0x13')]},'json':!![]};if(_0x3540f2[_0xb63b('0x14')]){_0x544988[_0xb63b('0x15')][_0xb63b('0x16')]['ProjectName']=_0x3540f2[_0xb63b('0x14')];}if(_0x3540f2[_0xb63b('0x17')]=='1'){_0x544988[_0xb63b('0x15')][_0xb63b('0x16')][_0xb63b('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb63b('0x19')};}if(_0x3540f2[_0xb63b('0x1a')]){_0x544988['body'][_0xb63b('0x16')]['CustomAction']=_0x3540f2[_0xb63b('0x1a')];if(_0x3540f2[_0xb63b('0x1b')]){_0x544988[_0xb63b('0x15')][_0xb63b('0x16')][_0xb63b('0x1c')]=_0x3540f2['custom_action_data'];}}logger[_0xb63b('0x1d')](JSON[_0xb63b('0x1e')](_0x544988));return rp(_0x544988);});};
\ No newline at end of file
index 42e5509..1da0885 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd4e3=['exports','./lib/api'];(function(_0x394a47,_0x365752){var _0x35fff5=function(_0x2ae6e7){while(--_0x2ae6e7){_0x394a47['push'](_0x394a47['shift']());}};_0x35fff5(++_0x365752);}(_0xd4e3,0x1a1));var _0x3d4e=function(_0x36ddaa,_0x39fd6b){_0x36ddaa=_0x36ddaa-0x0;var _0x100050=_0xd4e3[_0x36ddaa];return _0x100050;};'use strict';var asr=require(_0x3d4e('0x0'));module[_0x3d4e('0x1')]=function(_0x2947d8,_0x49e688,_0x5e2467,_0x1c6c21){return asr(_0x2947d8,_0x49e688,_0x5e2467,_0x1c6c21);};
\ No newline at end of file
+var _0xe4a5=['./lib/api','exports'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0xe4a5,0xa8));var _0x5e4a=function(_0x1d1b12,_0x22604b){_0x1d1b12=_0x1d1b12-0x0;var _0x5f26c8=_0xe4a5[_0x1d1b12];return _0x5f26c8;};'use strict';var asr=require(_0x5e4a('0x0'));module[_0x5e4a('0x1')]=function(_0x2ccc3e,_0x302be5,_0x397f42,_0x50eb56){return asr(_0x2ccc3e,_0x302be5,_0x397f42,_0x50eb56);};
\ No newline at end of file
index 76795de..93a036a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe1fd=['data','close','error','Tilde\x20ASR\x20send\x20error','status','result','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','isNil','open','message','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify'];(function(_0x93a501,_0x23bd22){var _0x2faa70=function(_0x5938b2){while(--_0x5938b2){_0x93a501['push'](_0x93a501['shift']());}};_0x2faa70(++_0x23bd22);}(_0xe1fd,0x195));var _0xde1f=function(_0x52e724,_0xc8045c){_0x52e724=_0x52e724-0x0;var _0x46c0b7=_0xe1fd[_0x52e724];return _0x46c0b7;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xde1f('0x0'));var crypto=require('crypto');var logger=require(_0xde1f('0x1'))(_0xde1f('0x2'));module[_0xde1f('0x3')]=function(_0x56aacb,_0x8a15e,_0x48e0e9,_0x8a5367){return new BPromise(function(_0x7bd3a3,_0x2ccaaa){logger[_0xde1f('0x4')](_0xde1f('0x5'),_0x8a5367||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0xce6896=new WebSocket(_0x8a5367||_0xde1f('0x6'),{'perMessageDeflate':![]});var _0x49533a='';var _0x1748ff='0';var _0x4ade0e='1';var _0x120dd4='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x364c63(_0x417500){var _0x4b3d7c=crypto[_0xde1f('0x7')](_0xde1f('0x8'));_0x4b3d7c[_0xde1f('0x9')](_0x417500);return _0x4b3d7c['digest'](_0xde1f('0xa'));}function _0x56d495(){try{logger[_0xde1f('0x4')](_0xde1f('0xb'));var _0x2a2002=moment()[_0xde1f('0xc')]();var _0x4ceba1=_0x364c63(_0x2a2002+_0x8a15e+_0x48e0e9);_0xce6896[_0xde1f('0xd')](JSON[_0xde1f('0xe')]({'appID':_0x8a15e,'timestamp':_0x2a2002,'appKey':_0x4ceba1}));var _0xab322c=fs['createReadStream'](_0x56aacb);_0xab322c['on'](_0xde1f('0xf'),function(_0x25c026){_0xce6896[_0xde1f('0xd')](_0x25c026);});_0xab322c['on'](_0xde1f('0x10'),function(){_0xce6896[_0xde1f('0xd')]('EOS');});}catch(_0x219b41){logger[_0xde1f('0x11')](_0xde1f('0x12'),JSON['stringify'](_0x219b41));_0xce6896['terminate']();}}function _0x87ecd1(_0x5164f1){try{if(_0x5164f1){var _0x508b0d=JSON['parse'](_0x5164f1);switch(_0x508b0d[_0xde1f('0x13')]){case 0x0:if(_0x508b0d['result']){if(_0x508b0d[_0xde1f('0x14')]['final']){logger[_0xde1f('0x4')]('Tilde\x20ASR\x20hypoteses',JSON[_0xde1f('0xe')](_0x508b0d[_0xde1f('0x14')]['hypotheses']));_0x49533a=_0x508b0d[_0xde1f('0x14')]['hypotheses'][0x0][_0xde1f('0x15')];_0x1748ff=_0x508b0d[_0xde1f('0x14')]['hypotheses'][0x0][_0xde1f('0x16')];_0x4ade0e='0';_0x120dd4=_0xde1f('0x17');_0xce6896['terminate']();}}break;case 0x1:logger[_0xde1f('0x4')](_0xde1f('0x18'));_0x4ade0e='1';_0x120dd4=_0xde1f('0x18');break;case 0x2:logger[_0xde1f('0x4')](_0xde1f('0x19'));_0x4ade0e='2';_0x120dd4='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xde1f('0x4')](_0xde1f('0x1a'));_0x4ade0e='9';_0x120dd4='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xde1f('0x4')](_0xde1f('0x1b'));_0x4ade0e='10';_0x120dd4='Authentication\x20failed.';break;case 0xb:logger[_0xde1f('0x4')](_0xde1f('0x1c'));_0x4ade0e='11';_0x120dd4=_0xde1f('0x1c');}}}catch(_0x34a790){logger[_0xde1f('0x11')](_0xde1f('0x1d'),JSON[_0xde1f('0xe')](_0x34a790));_0xce6896[_0xde1f('0x1e')]();}}function _0x30d64c(){logger[_0xde1f('0x4')](_0xde1f('0x1f'));_0x7bd3a3({'transcript':_0x49533a,'confidence':_0x1748ff,'status':_0x4ade0e,'status_message':_0x120dd4});}function _0x29b69e(_0x354102){logger[_0xde1f('0x11')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xde1f('0x20')](_0x354102)){logger[_0xde1f('0x11')](_['isObject'](_0x354102)?JSON[_0xde1f('0xe')](_0x354102):_0x354102);}}_0xce6896['on'](_0xde1f('0x21'),_0x56d495);_0xce6896['on'](_0xde1f('0x22'),_0x87ecd1);_0xce6896['on'](_0xde1f('0x10'),_0x30d64c);_0xce6896['on']('error',_0x29b69e);});};
\ No newline at end of file
+var _0x6e99=['agi','exports','info','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','moment','crypto','../../../../../../config/logger'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x6e99,0x1b7));var _0x96e9=function(_0x430f8a,_0x3a39cc){_0x430f8a=_0x430f8a-0x0;var _0x379a76=_0x6e99[_0x430f8a];return _0x379a76;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x96e9('0x0'));var crypto=require(_0x96e9('0x1'));var logger=require(_0x96e9('0x2'))(_0x96e9('0x3'));module[_0x96e9('0x4')]=function(_0x173c6d,_0x55f7f4,_0x48c6bb,_0x215f17){return new BPromise(function(_0x297daf,_0x2b6363){logger[_0x96e9('0x5')]('Tilde\x20URI',_0x215f17||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x6bf4dc=new WebSocket(_0x215f17||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x5b5f61='';var _0x3c6024='0';var _0x201c19='1';var _0x4b6ea3=_0x96e9('0x6');function _0x262f5d(_0xf09412){var _0x32d2ed=crypto[_0x96e9('0x7')]('sha1');_0x32d2ed['update'](_0xf09412);return _0x32d2ed[_0x96e9('0x8')]('hex');}function _0x589271(){try{logger[_0x96e9('0x5')](_0x96e9('0x9'));var _0x26c72f=moment()[_0x96e9('0xa')]();var _0x223d82=_0x262f5d(_0x26c72f+_0x55f7f4+_0x48c6bb);_0x6bf4dc[_0x96e9('0xb')](JSON[_0x96e9('0xc')]({'appID':_0x55f7f4,'timestamp':_0x26c72f,'appKey':_0x223d82}));var _0x3bcb07=fs['createReadStream'](_0x173c6d);_0x3bcb07['on'](_0x96e9('0xd'),function(_0x56cb2b){_0x6bf4dc[_0x96e9('0xb')](_0x56cb2b);});_0x3bcb07['on'](_0x96e9('0xe'),function(){_0x6bf4dc['send'](_0x96e9('0xf'));});}catch(_0x80db01){logger[_0x96e9('0x10')](_0x96e9('0x11'),JSON[_0x96e9('0xc')](_0x80db01));_0x6bf4dc[_0x96e9('0x12')]();}}function _0x28e3be(_0x135aec){try{if(_0x135aec){var _0x29ec19=JSON[_0x96e9('0x13')](_0x135aec);switch(_0x29ec19[_0x96e9('0x14')]){case 0x0:if(_0x29ec19[_0x96e9('0x15')]){if(_0x29ec19[_0x96e9('0x15')][_0x96e9('0x16')]){logger[_0x96e9('0x5')](_0x96e9('0x17'),JSON[_0x96e9('0xc')](_0x29ec19[_0x96e9('0x15')][_0x96e9('0x18')]));_0x5b5f61=_0x29ec19[_0x96e9('0x15')][_0x96e9('0x18')][0x0]['transcript'];_0x3c6024=_0x29ec19[_0x96e9('0x15')][_0x96e9('0x18')][0x0][_0x96e9('0x19')];_0x201c19='0';_0x4b6ea3=_0x96e9('0x1a');_0x6bf4dc[_0x96e9('0x12')]();}}break;case 0x1:logger['info'](_0x96e9('0x6'));_0x201c19='1';_0x4b6ea3='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x96e9('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x201c19='2';_0x4b6ea3=_0x96e9('0x1b');break;case 0x9:logger[_0x96e9('0x5')](_0x96e9('0x1c'));_0x201c19='9';_0x4b6ea3=_0x96e9('0x1c');break;case 0xa:logger[_0x96e9('0x5')]('Authentication\x20failed.');_0x201c19='10';_0x4b6ea3='Authentication\x20failed.';break;case 0xb:logger[_0x96e9('0x5')](_0x96e9('0x1d'));_0x201c19='11';_0x4b6ea3='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x59af22){logger[_0x96e9('0x10')](_0x96e9('0x1e'),JSON['stringify'](_0x59af22));_0x6bf4dc['terminate']();}}function _0x2e69e0(){logger['info'](_0x96e9('0x1f'));_0x297daf({'transcript':_0x5b5f61,'confidence':_0x3c6024,'status':_0x201c19,'status_message':_0x4b6ea3});}function _0x716a4b(_0x3a543b){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x96e9('0x20')](_0x3a543b)){logger[_0x96e9('0x10')](_[_0x96e9('0x21')](_0x3a543b)?JSON[_0x96e9('0xc')](_0x3a543b):_0x3a543b);}}_0x6bf4dc['on']('open',_0x589271);_0x6bf4dc['on']('message',_0x28e3be);_0x6bf4dc['on'](_0x96e9('0xe'),_0x2e69e0);_0x6bf4dc['on'](_0x96e9('0x10'),_0x716a4b);});};
\ No newline at end of file
index f289a15..10cb4be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa537=['exports','./asr'];(function(_0x59d073,_0x55b8fc){var _0x46d3df=function(_0x2843bb){while(--_0x2843bb){_0x59d073['push'](_0x59d073['shift']());}};_0x46d3df(++_0x55b8fc);}(_0xa537,0x189));var _0x7a53=function(_0x184061,_0x5cdc0e){_0x184061=_0x184061-0x0;var _0x3a2455=_0xa537[_0x184061];return _0x3a2455;};var asr=require(_0x7a53('0x0'));module[_0x7a53('0x1')]={'asr':asr};
\ No newline at end of file
+var asr=require('./asr');module['exports']={'asr':asr};
\ No newline at end of file
index 4245b8f..8b7c469 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);};
\ No newline at end of file
+var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0xcdfc4f,_0x8a111a){var _0x3f70d1=function(_0xc0f333){while(--_0xc0f333){_0xcdfc4f['push'](_0xcdfc4f['shift']());}};_0x3f70d1(++_0x8a111a);}(_0x34e8,0x12c));var _0x834e=function(_0x47377d,_0x563877){_0x47377d=_0x47377d-0x0;var _0x4a1b8a=_0x34e8[_0x47377d];return _0x4a1b8a;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);};
\ No newline at end of file
index de191ad..d1783dd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc5c0=['FIND\x20AGENT\x20%s\x20BY\x20%s','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','file_id','no\x20file\x20audio\x20found','getData','no\x20find\x20by\x20configured','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','subject','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','join','exports','util','lodash','shelljs','moment','mustache','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','channel','mailRpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','rpc','getVoiceQueueById','getSquareProjectById','then','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','open','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','createSquareRecording','callerid','context','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','error','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','audioEncoding','MP3','googleTTS','restAPI','method','timeout','includes','POST','toUpperCase','rawBody','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','statusCode','statusMessage','message','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','key','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','recursiveNodeIndex','isPlainObject','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','isConfigured','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','url','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','beep','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block'];(function(_0x471016,_0x345c35){var _0x4d9d83=function(_0x1f98c3){while(--_0x1f98c3){_0x471016['push'](_0x471016['shift']());}};_0x4d9d83(++_0x345c35);}(_0xc5c0,0x6c));var _0x0c5c=function(_0x152635,_0x4ba58b){_0x152635=_0x152635-0x0;var _0x4e5b77=_0xc5c0[_0x152635];return _0x4e5b77;};'use strict';var fs=require('fs');var util=require(_0x0c5c('0x0'));var _=require(_0x0c5c('0x1'));var sh=require(_0x0c5c('0x2'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0x0c5c('0x3'));var Mustache=require(_0x0c5c('0x4'));var rp=require('request-promise');var logger=require(_0x0c5c('0x5'))(_0x0c5c('0x6'));var config=require(_0x0c5c('0x7'));var shared=require(_0x0c5c('0x8'));var scripts=require(_0x0c5c('0x9'));var FILES_PATH=_0x0c5c('0xa');var recursiveMapAttributes=[_0x0c5c('0xb'),'rawBody'];var verticesWithRetry=[_0x0c5c('0xc'),_0x0c5c('0xd'),'getsecretdigits'];var AGIVertices=function(_0xe020af,_0x30267c,_0x4145aa){this[_0x0c5c('0xe')]=_0xe020af;this['rpc']=_0x30267c;this[_0x0c5c('0xf')]=_0x4145aa;};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x11')]=function(_0x8afa67,_0x219c19){this['rpc'][_0x0c5c('0x12')](_0x8afa67)['then'](function(_0xb3d35d){_0x219c19(null,_0xb3d35d?_0xb3d35d[_0x0c5c('0x13')]:![]);})[_0x0c5c('0x14')](function(_0x2f9a2f){_0x219c19(_0x2f9a2f);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x15')]=function(_0x2ef42f,_0x35a896){this[_0x0c5c('0x16')][_0x0c5c('0x17')](_0x2ef42f)['then'](function(_0x1c6916){_0x35a896(null,_0x1c6916?_0x1c6916['name']:![]);})['catch'](function(_0x375e9d){_0x35a896(_0x375e9d);});};AGIVertices[_0x0c5c('0x10')]['getSquareProject']=function(_0xbc8d3,_0x5c0be8){this[_0x0c5c('0x16')][_0x0c5c('0x18')](_0xbc8d3)[_0x0c5c('0x19')](function(_0x5b8105){_0x5c0be8(null,_0x5b8105?_0x5b8105[_0x0c5c('0x13')]:![]);})[_0x0c5c('0x14')](function(_0x3f2663){_0x5c0be8(_0x3f2663);});};AGIVertices[_0x0c5c('0x10')]['getSquareOdbc']=function(_0x273a5a,_0x6a821e){this[_0x0c5c('0x16')][_0x0c5c('0x1a')](_0x273a5a)[_0x0c5c('0x19')](function(_0x17af12){_0x6a821e(null,_0x17af12?_0x17af12[_0x0c5c('0x1b')]:![]);})[_0x0c5c('0x14')](function(_0x480efe){_0x6a821e(_0x480efe);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x1c')]=function(_0xeb244e,_0x2cd15f){this[_0x0c5c('0x16')][_0x0c5c('0x1d')](_0xeb244e)['then'](function(_0xb1ea94){_0x2cd15f(null,_0xb1ea94?_0xb1ea94['name']:![]);})[_0x0c5c('0x14')](function(_0x4356fa){_0x2cd15f(_0x4356fa);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x1e')]=function(_0xce6d9c,_0x5e9f61){this[_0x0c5c('0x16')][_0x0c5c('0x1f')](_0xce6d9c)[_0x0c5c('0x19')](function(_0x8477c3){_0x5e9f61(null,_0x8477c3?_0x8477c3[_0x0c5c('0x13')]:![]);})[_0x0c5c('0x14')](function(_0xc4358c){_0x5e9f61(_0xc4358c);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x20')]=function(_0x307e59,_0x302663){var _0x11f7e1=this;this['rpc']['getSoundById'](_0x307e59)[_0x0c5c('0x19')](function(_0x45139f){_0x302663(null,_0x45139f?_0x11f7e1[_0x0c5c('0x21')](_0x45139f[_0x0c5c('0x22')]):![]);})[_0x0c5c('0x14')](function(_0x2a5310){_0x302663(_0x2a5310);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x23')]=function(_0x2ef471,_0x1b88c1){this[_0x0c5c('0x16')][_0x0c5c('0x24')](_0x2ef471)[_0x0c5c('0x19')](function(_0x280983){_0x1b88c1(null,_0x280983?_0x280983:![]);})[_0x0c5c('0x14')](function(_0x408cf6){_0x1b88c1(_0x408cf6);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x25')]=function(_0x3bf481,_0x5821da,_0x5ec408){this[_0x0c5c('0xf')][_0x0c5c('0x25')](_0x3bf481,_0x5821da)['then'](function(){_0x5ec408(null);})[_0x0c5c('0x14')](function(_0x400580){_0x5ec408(_0x400580);});};AGIVertices[_0x0c5c('0x10')]['getIntervals']=function(_0x2864e1,_0x51f5bd){this[_0x0c5c('0x16')]['getIntervalById'](_0x2864e1)[_0x0c5c('0x19')](function(_0x18b722){if(_0x18b722){if(_0x18b722[_0x0c5c('0x26')]){_0x51f5bd(null,[_0x18b722[_0x0c5c('0x27')]]);}else{_0x51f5bd(null,_['map'](_0x18b722[_0x0c5c('0x28')],'interval'));}}else{_0x51f5bd(null,![]);}})['catch'](function(_0x13fde2){_0x51f5bd(_0x13fde2);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x21')]=function(_0x1c4ac3){return util[_0x0c5c('0x29')](_0x0c5c('0x2a'),FILES_PATH,_0x1c4ac3);};AGIVertices[_0x0c5c('0x10')]['getQueryOdbc']=function(_0x367286,_0x39adf7,_0x250459){odbc[_0x0c5c('0x2b')](_0x367286,function(_0x529032){if(_0x529032){logger['error'](_0x0c5c('0x2c'),_0x529032);_0x250459(_0x529032);}else{logger['info'](_0x0c5c('0x2d'));odbc[_0x0c5c('0x2e')](_0x39adf7,function(_0x38079a,_0x523fe7){if(_0x38079a){logger[_0x0c5c('0x2f')](_0x0c5c('0x30'),_0x39adf7);_0x250459(_0x38079a);}else{logger[_0x0c5c('0x2f')](_0x0c5c('0x31'),_0x39adf7);odbc[_0x0c5c('0x32')](function(_0x372042){if(_0x372042){logger['error'](_0x0c5c('0x33'),_0x372042);}_0x250459(null,_0x523fe7);});}});}});};AGIVertices['prototype'][_0x0c5c('0x34')]=function(_0x4d79c9,_0x56e7ee){this[_0x0c5c('0x16')][_0x0c5c('0x35')](_0x4d79c9)[_0x0c5c('0x19')](function(_0x1d22ea){_0x56e7ee(null,_0x1d22ea?_0x1d22ea:![]);})[_0x0c5c('0x14')](function(_0xb6953d){_0x56e7ee(_0xb6953d);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x36')]=function(_0x389b51,_0x29a361){this[_0x0c5c('0x16')][_0x0c5c('0x36')](_0x389b51)[_0x0c5c('0x19')](function(_0x3063be){_0x29a361(null,_0x3063be);})[_0x0c5c('0x14')](function(_0x4ae738){_0x29a361(_0x4ae738);});};AGIVertices[_0x0c5c('0x10')]['createSquareDetailsReport']=function(_0x570364,_0x35bd92,_0x3b528f){this[_0x0c5c('0x16')][_0x0c5c('0x37')]({'uniqueid':this['channel'][_0x0c5c('0x38')],'node':_0x570364[_0x0c5c('0x39')],'application':_0x570364[_0x0c5c('0x3a')],'data':_0x35bd92||null,'project_name':this['channel']['arg_1'],'callerid':this[_0x0c5c('0xe')]['callerid']})['then'](function(_0x1cc2b1){if(_0x3b528f){_0x3b528f(null,_0x1cc2b1);}})[_0x0c5c('0x14')](function(_0x18cb91){if(_0x3b528f){_0x3b528f(_0x18cb91);}});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x3b')]=function(_0xda2ac5,_0x3e8383,_0x1f734d,_0x1f4056){this[_0x0c5c('0x16')][_0x0c5c('0x3b')]({'uniqueid':this[_0x0c5c('0xe')][_0x0c5c('0x38')],'callerid':this['channel'][_0x0c5c('0x3c')],'calleridname':this[_0x0c5c('0xe')]['calleridname'],'context':this[_0x0c5c('0xe')][_0x0c5c('0x3d')],'extension':this[_0x0c5c('0xe')]['extension'],'priority':this[_0x0c5c('0xe')]['priority'],'accountcode':this[_0x0c5c('0xe')][_0x0c5c('0x3e')],'dnid':this[_0x0c5c('0xe')][_0x0c5c('0x3f')],'projectName':this[_0x0c5c('0xe')][_0x0c5c('0x40')],'saveName':_0x3e8383,'filename':_0xda2ac5[_0x0c5c('0x41')]||_0x3e8383,'savePath':_0x1f734d})['then'](function(_0x8fdf31){_0x1f4056(null,_0x8fdf31);})[_0x0c5c('0x14')](function(_0x3493af){_0x1f4056(_0x3493af);});};AGIVertices['prototype'][_0x0c5c('0x42')]=function(_0x5280df,_0x78624a,_0x5d77f5,_0x3ebefa,_0x41864c){this[_0x0c5c('0x16')][_0x0c5c('0x42')]({'uniqueid':this['channel'][_0x0c5c('0x38')],'body':_0x5280df,'direction':_0x78624a,'providerName':_0x5d77f5,'providerResponse':_0x3ebefa})['then'](function(_0x12e634){if(_0x41864c){_0x41864c(null,_0x12e634);}})[_0x0c5c('0x14')](function(_0x4ae933){if(_0x41864c){_0x41864c(_0x4ae933);}});};AGIVertices[_0x0c5c('0x10')]['createCmContact']=function(_0xc7faf8,_0x4811cb){this[_0x0c5c('0x16')][_0x0c5c('0x43')]({'firstName':_['isEmpty'](_0xc7faf8[_0x0c5c('0x13')])||_[_0x0c5c('0x44')](_0xc7faf8['name'])?_0x0c5c('0x45')+Math[_0x0c5c('0x46')]():_0xc7faf8[_0x0c5c('0x13')],'lastName':_[_0x0c5c('0x47')](_0xc7faf8[_0x0c5c('0x48')])||_[_0x0c5c('0x44')](_0xc7faf8[_0x0c5c('0x48')])?null:_0xc7faf8['lastName'],'phone':_0xc7faf8[_0x0c5c('0x49')],'ListId':_0xc7faf8[_0x0c5c('0x4a')],'scheduledat':_0xc7faf8[_0x0c5c('0x4b')],'callbackUniqueid':this['channel'][_0x0c5c('0x38')],'tags':_0x0c5c('0x4c'),'description':'Callback\x20scheduled\x20at\x20'+_0xc7faf8[_0x0c5c('0x4b')][_0x0c5c('0x4d')](),'priority':_0xc7faf8[_0x0c5c('0x4e')]})[_0x0c5c('0x19')](function(_0x5977fd){_0x4811cb(null,_0x5977fd);})[_0x0c5c('0x14')](function(_0x399298){_0x4811cb(_0x399298);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x4f')]=function(_0xb0079e,_0xd2097e){this['rpc'][_0x0c5c('0x50')](_0xb0079e)[_0x0c5c('0x19')](function(_0x2258f2){_0xd2097e(null,_0x2258f2?_0x2258f2[_0x0c5c('0x13')]:![]);})[_0x0c5c('0x14')](function(_0x262e2e){_0xd2097e(_0x262e2e);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x51')]=function(_0x36ad9c,_0x25698b,_0x2abbb5){var _0x469727={'role':'agent'};_0x469727[_0x36ad9c]=this[_0x0c5c('0xe')][_0x0c5c('0x3c')];this[_0x0c5c('0x16')][_0x0c5c('0x51')](_0x469727,_0x25698b,this[_0x0c5c('0xe')][_0x0c5c('0x38')])[_0x0c5c('0x19')](function(_0x516f7b){_0x2abbb5(null,_[_0x0c5c('0x44')](_0x516f7b)?![]:!![]);})[_0x0c5c('0x14')](function(_0x44bdf7){logger['error'](_0x44bdf7);_0x2abbb5(null,![]);});};AGIVertices[_0x0c5c('0x10')]['agentUnpause']=function(_0x535da8,_0xfa8217){var _0x57bc66={'role':_0x0c5c('0x52')};_0x57bc66[_0x535da8]=this[_0x0c5c('0xe')][_0x0c5c('0x3c')];this[_0x0c5c('0x16')][_0x0c5c('0x53')](_0x57bc66)[_0x0c5c('0x19')](function(_0x5a6e8d){_0xfa8217(null,_[_0x0c5c('0x44')](_0x5a6e8d)?![]:!![]);})[_0x0c5c('0x14')](function(_0x1e656b){logger[_0x0c5c('0x54')](_0x1e656b);_0xfa8217(null,![]);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x55')]=function(_0xe5d82c,_0x5d8ee0){var _0x523e9f={'role':_0x0c5c('0x52')};_0x523e9f[_0xe5d82c]=this[_0x0c5c('0xe')][_0x0c5c('0x3c')];this[_0x0c5c('0x16')]['agentLogout'](_0x523e9f)[_0x0c5c('0x19')](function(_0x2e2188){_0x5d8ee0(null,_['isNil'](_0x2e2188)?![]:!![]);})[_0x0c5c('0x14')](function(_0x2aa341){logger['error'](_0x2aa341);_0x5d8ee0(null,![]);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x56')]=function(_0x4acb0c,_0x1de61e){var _0x191317={'role':'agent'};_0x191317[_0x4acb0c]=this[_0x0c5c('0xe')]['callerid'];var _0x53d4c0=_0x4acb0c!=_0x0c5c('0x57')?util[_0x0c5c('0x29')](_0x0c5c('0x58'),'LOCAL',this[_0x0c5c('0xe')][_0x0c5c('0x3c')]):undefined;this[_0x0c5c('0x16')][_0x0c5c('0x56')](_0x191317,_0x53d4c0)['then'](function(_0x93138f){_0x1de61e(null,_[_0x0c5c('0x44')](_0x93138f)?![]:!![]);})[_0x0c5c('0x14')](function(_0x4e9227){logger[_0x0c5c('0x54')](_0x4e9227);_0x1de61e(null,![]);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x59')]=function(_0x5b7150,_0x593137){sh[_0x0c5c('0x5a')](_[_0x0c5c('0x5b')](_0x5b7150),function(_0x2958b0,_0x269eef){var _0x50bfb8=_0x269eef[_0x0c5c('0x5c')](/(\r\n|\n|\r)/gm,'');_0x593137(null,_0x50bfb8);});};AGIVertices['prototype'][_0x0c5c('0x5d')]=function(_0x52150a,_0x239b3a){scripts[_0x0c5c('0x5d')](_0x52150a[_0x0c5c('0x5e')],_0x52150a[_0x0c5c('0x5f')]||_0x0c5c('0x60'),_0x52150a['text'],_0x52150a[_0x0c5c('0x61')]||'en-US',_0x52150a[_0x0c5c('0x62')]||'MALE',_0x52150a[_0x0c5c('0x63')]||_0x0c5c('0x64'))[_0x0c5c('0x19')](function(_0x5ca48e){_0x239b3a(null,_0x5ca48e);})['catch'](function(_0x13c68a){_0x239b3a(_0x13c68a);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x65')]=function(_0x21af5e,_0x1f94ec){scripts[_0x0c5c('0x65')](_0x21af5e[_0x0c5c('0x60')],_0x21af5e['google_tts_language']||'en',0x1)[_0x0c5c('0x19')](function(_0x400d41){_0x1f94ec(null,_0x400d41);})['catch'](function(_0x5ab78f){_0x1f94ec(_0x5ab78f);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x66')]=function(_0xbf4e4d,_0x394e20){var _0x2dd32d={'uri':_0xbf4e4d['url'],'method':_0xbf4e4d[_0x0c5c('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xbf4e4d[_0x0c5c('0x68')])==='number'&&parseInt(_0xbf4e4d['timeout'])>=0x1?parseInt(_0xbf4e4d[_0x0c5c('0x68')])*0x3e8:0x5*0x3e8};if(_[_0x0c5c('0x69')]([_0x0c5c('0x6a'),'PUT'],_0x2dd32d[_0x0c5c('0x67')][_0x0c5c('0x6b')]())){try{_0x2dd32d['body']=_0xbf4e4d[_0x0c5c('0x6c')]?JSON[_0x0c5c('0x6d')](_0xbf4e4d[_0x0c5c('0x6c')]):{};}catch(_0x2b9c37){logger[_0x0c5c('0x54')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2b9c37);}}try{_0x2dd32d[_0x0c5c('0x6e')]=_0xbf4e4d[_0x0c5c('0xb')]?JSON[_0x0c5c('0x6d')](_0xbf4e4d[_0x0c5c('0xb')]):{};}catch(_0xde52e8){logger[_0x0c5c('0x54')](_0x0c5c('0x6f'),_0xde52e8);}if(_0xbf4e4d[_0x0c5c('0x70')]){try{var _0x5f558d=require(_0xbf4e4d[_0x0c5c('0x70')])[_0x0c5c('0x71')](this,_0x2dd32d);_0x2dd32d[_0x0c5c('0x72')]=Mustache['render'](_0xbf4e4d['url'],_0x5f558d,{},['$$','$$']);if(_0x2dd32d[_0x0c5c('0x6e')]){_0x2dd32d[_0x0c5c('0x6e')]=JSON[_0x0c5c('0x6d')](Mustache[_0x0c5c('0x73')](JSON[_0x0c5c('0x74')](_0x2dd32d[_0x0c5c('0x6e')]),_0x5f558d,{},['$$','$$']));}if(_0x2dd32d[_0x0c5c('0x75')]){_0x2dd32d[_0x0c5c('0x75')]=JSON[_0x0c5c('0x6d')](Mustache[_0x0c5c('0x73')](JSON[_0x0c5c('0x74')](_0x2dd32d['body']),_0x5f558d,{},['$$','$$']));}}catch(_0x3d3858){logger[_0x0c5c('0x54')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3d3858);}}rp(_0x2dd32d)[_0x0c5c('0x19')](function(_0x1f01db){var _0x133901={'statusCode':_0x1f01db[_0x0c5c('0x76')]||0xc8,'statusMessage':_0x1f01db[_0x0c5c('0x77')]||'OK','headers':_0x1f01db[_0x0c5c('0x6e')]||{},'body':_0x1f01db['body']||{}};_0x394e20(null,_0x133901);})['catch'](function(_0xbb7b15){var _0x11c315={'statusCode':_0xbb7b15['statusCode']||0x1f4,'statusMessage':_0xbb7b15[_0x0c5c('0x78')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0xbb7b15[_0x0c5c('0x79')]['headers']||{},'body':_0xbb7b15['options']['body']||{}};_0x394e20(null,_0x11c315);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x7a')]=function(_0x59f8a9,_0x2f21b5){scripts[_0x0c5c('0x7a')](this[_0x0c5c('0xe')][_0x0c5c('0x38')],_0x59f8a9['key'],_0x59f8a9[_0x0c5c('0x60')],_0x59f8a9[_0x0c5c('0x7b')]||'en')['then'](function(_0x268ab5){_0x2f21b5(null,_0x268ab5);})[_0x0c5c('0x14')](function(_0x1317ea){_0x2f21b5(_0x1317ea);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x7c')]=function(_0x502895,_0x2b817e){scripts['googleDialogflowV2'](this[_0x0c5c('0xe')][_0x0c5c('0x38')],_0x502895[_0x0c5c('0x7d')],_0x502895[_0x0c5c('0x7e')],_0x502895[_0x0c5c('0x7f')],_0x502895['text'],_0x502895['dialogflowV2_language']||'en')['then'](function(_0x22c289){_0x2b817e(null,_0x22c289);})[_0x0c5c('0x14')](function(_0x2827b6){_0x2b817e(_0x2827b6);});};AGIVertices[_0x0c5c('0x10')]['sestekNDA']=function(_0x1150ea,_0x32cd8c){scripts[_0x0c5c('0x80')](this['channel'],_0x1150ea)['then'](function(_0x513634){_0x32cd8c(null,_0x513634);})[_0x0c5c('0x14')](function(_0xa25cb4){_0x32cd8c(_0xa25cb4);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x81')]=function(_0x506a41,_0x2b6570){scripts[_0x0c5c('0x81')](_0x506a41['key'],_0x506a41[_0x0c5c('0x60')],_0x506a41[_0x0c5c('0x82')]||_0x0c5c('0x83'),_0x506a41['speed'])[_0x0c5c('0x19')](function(_0x1c57d8){_0x2b6570(null,_0x1c57d8);})[_0x0c5c('0x14')](function(_0x112f20){_0x2b6570(_0x112f20);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x84')]=function(_0x5116f6,_0x53e5ad,_0x5c078c){scripts[_0x0c5c('0x84')](_0x53e5ad,_0x5116f6['key'],_0x5116f6['ispeech_asr_language']||_0x0c5c('0x83'),this['isConfigured'](_0x5116f6['model'])?_0x5116f6[_0x0c5c('0x85')]:undefined)[_0x0c5c('0x19')](function(_0x13e638){_0x5c078c(null,_0x13e638);})[_0x0c5c('0x14')](function(_0x253392){_0x5c078c(_0x253392);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x86')]=function(_0x59ccff,_0x30c16f){scripts[_0x0c5c('0x86')](_0x59ccff[_0x0c5c('0x87')],_0x59ccff['aws_secret_access_key'],_0x59ccff[_0x0c5c('0x88')],_0x59ccff[_0x0c5c('0x89')]||_0x0c5c('0x8a'),_0x59ccff[_0x0c5c('0x60')],_0x59ccff[_0x0c5c('0x8b')]||'text')[_0x0c5c('0x19')](function(_0x47be3d){_0x30c16f(null,_0x47be3d);})[_0x0c5c('0x14')](function(_0xb0ef28){_0x30c16f(_0xb0ef28);});};AGIVertices['prototype'][_0x0c5c('0x8c')]=function(_0x1550f0,_0x5f100e){scripts['awsLex'](this[_0x0c5c('0xe')]['uniqueid'],_0x1550f0[_0x0c5c('0x87')],_0x1550f0[_0x0c5c('0x8d')],_0x1550f0[_0x0c5c('0x8e')],_0x1550f0[_0x0c5c('0x60')],_0x1550f0[_0x0c5c('0x8f')])['then'](function(_0x5f5dbf){_0x5f100e(null,_0x5f5dbf);})[_0x0c5c('0x14')](function(_0x552e33){_0x5f100e(_0x552e33);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x90')]=function(_0x3c3201,_0x2ddd87,_0x5969a8){scripts[_0x0c5c('0x90')](_0x2ddd87,_0x3c3201[_0x0c5c('0x91')],_0x3c3201[_0x0c5c('0x92')]||_0x0c5c('0x83'))[_0x0c5c('0x19')](function(_0x336a53){_0x5969a8(null,_0x336a53);})[_0x0c5c('0x14')](function(_0x34a90d){_0x5969a8(_0x34a90d);});};AGIVertices[_0x0c5c('0x10')]['tildeASR']=function(_0xd295dc,_0x2ea8a3,_0x43f87f){scripts[_0x0c5c('0x93')](_0x2ea8a3,_0xd295dc['appid'],_0xd295dc[_0x0c5c('0x94')],_0xd295dc[_0x0c5c('0x72')])[_0x0c5c('0x19')](function(_0x280e17){_0x43f87f(null,_0x280e17);})[_0x0c5c('0x14')](function(_0x31fa8c){_0x43f87f(_0x31fa8c);});};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x95')]=function(_0x407415){var _0x246e74=_[_0x0c5c('0x69')](verticesWithRetry,_0x407415[_0x0c5c('0x3a')])?_0x407415:_[_0x0c5c('0x96')](_0x407415);for(var _0x44675f in _0x246e74){if(_0x246e74[_0x0c5c('0x97')](_0x44675f)){if(_0x246e74[_0x44675f]&&_[_0x0c5c('0x98')](_0x246e74[_0x44675f])){if(_[_0x0c5c('0x69')](recursiveMapAttributes,_0x44675f)){_0x246e74[_0x44675f]=this['replaceObjectAllVariables'](_0x246e74[_0x44675f]);}else{_0x246e74[_0x44675f]=this['replaceAllVariables'](_0x246e74[_0x44675f]);}}}}return _0x246e74;};AGIVertices['prototype'][_0x0c5c('0x99')]=function(_0x50318f){for(var _0x3ee88f in _0x50318f){if(_0x50318f[_0x0c5c('0x97')](_0x3ee88f)){if(_[_0x0c5c('0x9a')](_0x50318f[_0x3ee88f])){this[_0x0c5c('0x99')](_0x50318f[_0x3ee88f]);}else if(_['isArray'](_0x50318f[_0x3ee88f])){for(var _0x14d06d=0x0;_0x14d06d<_0x50318f[_0x3ee88f][_0x0c5c('0x9b')];_0x14d06d++){this[_0x0c5c('0x99')](_0x50318f[_0x3ee88f][_0x14d06d]);}}else if(_[_0x0c5c('0x98')](_0x50318f[_0x3ee88f])){_0x50318f[_0x3ee88f]=this[_0x0c5c('0x9c')](_0x50318f[_0x3ee88f]);}}}};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x9d')]=function(_0x1d8672,_0x16335b){for(var _0xe8e51e in _0x1d8672){if(_0x1d8672['hasOwnProperty'](_0xe8e51e)){if(_['isPlainObject'](_0x1d8672[_0xe8e51e])){if(!_[_0x0c5c('0x47')](_0x1d8672[_0xe8e51e])){this[_0x0c5c('0x9d')](_0x1d8672[_0xe8e51e],util['format'](_0x0c5c('0x9e'),_0x16335b,_0xe8e51e));}}else if(_['isArray'](_0x1d8672[_0xe8e51e])){for(var _0x151c15=0x0;_0x151c15<_0x1d8672[_0xe8e51e][_0x0c5c('0x9b')];_0x151c15++){this['saveRestApiResult'](_0x1d8672[_0xe8e51e][_0x151c15],util['format'](_0x0c5c('0x9e'),_0x16335b,_0xe8e51e+'['+_0x151c15+']'));}}else{if(!_[_0x0c5c('0x44')](_0x1d8672[_0xe8e51e])){this[_0x0c5c('0xe')][_0x0c5c('0x9f')](util[_0x0c5c('0x29')](_0x0c5c('0x9e'),_0x16335b,_0xe8e51e),_0x1d8672[_0xe8e51e]);}}}}};AGIVertices[_0x0c5c('0x10')]['replaceObjectAllVariables']=function(_0x3a1ce9){try{var _0x3bba39=JSON['parse'](_0x3a1ce9);this[_0x0c5c('0x99')](_0x3bba39);return JSON[_0x0c5c('0x74')](_0x3bba39);}catch(_0x5dbeda){return this[_0x0c5c('0x9c')](_0x3a1ce9);}};AGIVertices['prototype'][_0x0c5c('0x9c')]=function(_0x8c1043){var _0x34665c=_0x8c1043[_0x0c5c('0xa0')]('{');for(var _0x3f50de=0x1;_0x3f50de<_0x34665c[_0x0c5c('0x9b')];_0x3f50de+=0x1){var _0x1092e7=_0x34665c[_0x3f50de]['split']('}');if(_0x1092e7[_0x0c5c('0x9b')]>0x1){_0x8c1043=_0x8c1043[_0x0c5c('0xa1')]('{'+_0x1092e7[0x0]+'}',this[_0x0c5c('0xe')][_0x0c5c('0x11')](_0x1092e7[0x0])[_0x0c5c('0xa2')]||_0x1092e7[0x0]);}}if(_0x34665c[_0x0c5c('0x9b')]===0x1){return _0x8c1043[_0x0c5c('0x4d')]();}return this[_0x0c5c('0x9c')](_0x8c1043);};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0xa3')]=function(_0x3012f9,_0x293826){var _0x578b7e=this['channel'][_0x0c5c('0x11')](_0x3012f9);if(_0x578b7e[_0x0c5c('0xa4')]===-0x1){return _0x578b7e;}logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x293826,_0x578b7e[_0x0c5c('0xa2')]));return this[_0x0c5c('0xe')][_0x0c5c('0x9f')](_0x293826,_0x578b7e[_0x0c5c('0xa2')]);};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0xa5')]=function(_0x315efd){return _0x315efd&&_0x315efd!=='0'&&_0x315efd!=='-1'&&_0x315efd!=='';};AGIVertices[_0x0c5c('0x10')]['maxRetry']=function(_0x531298){this[_0x0c5c('0x37')][_0x0c5c('0x71')](this,_0x531298,'-');_0x531298[_0x0c5c('0xa6')]=_0x531298[_0x0c5c('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0xa8')]=function(_0x13b782){logger['info'](util[_0x0c5c('0x29')](_0x0c5c('0xa9'),_0x13b782[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x13b782[_0x0c5c('0x60')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0xab'));}var _0x569f04='\x22'+_0x13b782[_0x0c5c('0x60')]+'\x22';if(this['isConfigured'](_0x13b782[_0x0c5c('0x79')])){_0x569f04+=','+_0x13b782[_0x0c5c('0x79')];}var _0x16d523=this[_0x0c5c('0xe')][_0x0c5c('0x5a')](_0x0c5c('0xac'),_0x569f04);if(_0x16d523[_0x0c5c('0xa4')]===-0x1){return _0x16d523;}return this['channel']['noop'](util[_0x0c5c('0x29')](_0x0c5c('0xad'),_0x569f04));};AGIVertices['prototype'][_0x0c5c('0xae')]=function(_0x49ab62){logger['info'](util['format'](_0x0c5c('0xaf'),_0x49ab62[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x49ab62['grammar'])){return this[_0x0c5c('0xe')]['noop'](_0x0c5c('0xb0'));}var _0x29f7b9=_0x49ab62['grammar'];if(this[_0x0c5c('0xa5')](_0x49ab62[_0x0c5c('0x79')])){_0x29f7b9+=','+_0x49ab62[_0x0c5c('0x79')];}var _0x398b0a=this[_0x0c5c('0xe')][_0x0c5c('0x5a')](_0x0c5c('0xb1'),_0x29f7b9);if(_0x398b0a[_0x0c5c('0xa4')]===-0x1){return _0x398b0a;}var _0x1eadf9=this['getAndSetVariable'](_0x0c5c('0xb2'),_0x0c5c('0xb3'));if(_0x1eadf9['result']===-0x1){return _0x1eadf9;}var _0x631351=this[_0x0c5c('0xa3')](_0x0c5c('0xb4'),'MRCP_RECOG_TRANSCRIPT');if(_0x631351[_0x0c5c('0xa4')]===-0x1){return _0x631351;}var _0x1b0cf7=this[_0x0c5c('0xa3')](_0x0c5c('0xb5'),_0x0c5c('0xb6'));if(_0x1b0cf7['result']===-0x1){return _0x1b0cf7;}return this[_0x0c5c('0xe')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x29f7b9));};AGIVertices['prototype'][_0x0c5c('0x6')]=function(_0x35a7a2){logger['info'](util[_0x0c5c('0x29')](_0x0c5c('0xb7'),_0x35a7a2[_0x0c5c('0x39')]));return this[_0x0c5c('0xe')][_0x0c5c('0x6')]([_0x35a7a2[_0x0c5c('0xb8')],_0x35a7a2['args']]);};AGIVertices[_0x0c5c('0x10')]['answer']=function(_0x191da7){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x191da7[_0x0c5c('0x39')]));if(this[_0x0c5c('0xa5')](_0x191da7[_0x0c5c('0x68')])){logger['info'](util[_0x0c5c('0x29')](_0x0c5c('0xb9'),_0x191da7[_0x0c5c('0x68')]));var _0x302bdc=this[_0x0c5c('0xe')][_0x0c5c('0xba')](_0x191da7[_0x0c5c('0x68')]);if(_0x302bdc['result']===-0x1){return _0x302bdc;}}return this[_0x0c5c('0xe')]['answer']();};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x4c')]=function(_0x1bc05b){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0xbb'),_0x1bc05b['label']));if(!this[_0x0c5c('0xa5')](_0x1bc05b[_0x0c5c('0x4a')])){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x1bc05b,_0x0c5c('0xbc'));}_0x1bc05b[_0x0c5c('0x4b')]=moment();if(this[_0x0c5c('0xa5')](_0x1bc05b[_0x0c5c('0xbd')])){_0x1bc05b[_0x0c5c('0x4b')]=moment()[_0x0c5c('0xbe')](_0x1bc05b[_0x0c5c('0xbd')],_0x0c5c('0xbf'));}if(!this['isConfigured'](_0x1bc05b[_0x0c5c('0x4e')])){_0x1bc05b[_0x0c5c('0x4e')]=0x2;}this[_0x0c5c('0x43')][_0x0c5c('0x71')](this,_0x1bc05b);return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0xc0'),_0x1bc05b[_0x0c5c('0x49')],_0x1bc05b[_0x0c5c('0x4a')],_0x1bc05b['scheduledAt']));};AGIVertices[_0x0c5c('0x10')]['custom_app']=function(_0x201468){logger[_0x0c5c('0x2f')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x201468[_0x0c5c('0x39')]));var _0x4bda47=this[_0x0c5c('0xe')][_0x0c5c('0x5a')](_0x201468[_0x0c5c('0xc1')],_0x201468[_0x0c5c('0x79')]);if(_0x4bda47[_0x0c5c('0xa4')]===-0x1){return _0x4bda47;}return this['channel']['noop'](util['format'](_0x0c5c('0xc2'),_0x201468[_0x0c5c('0xc1')],_0x201468[_0x0c5c('0x79')]));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0xc3')]=function(_0x4e0038){logger['info'](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x4e0038[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x4e0038['text'])){return this['channel'][_0x0c5c('0xaa')](_0x0c5c('0xab'));}var _0x14c856='\x22'+_0x4e0038[_0x0c5c('0x60')]+'\x22';if(this[_0x0c5c('0xa5')](_0x4e0038[_0x0c5c('0x79')])){_0x14c856+=','+_0x4e0038[_0x0c5c('0x79')];}var _0x1a3fbf=this[_0x0c5c('0xe')][_0x0c5c('0x5a')](_0x0c5c('0xac'),_0x14c856);if(_0x1a3fbf[_0x0c5c('0xa4')]===-0x1){return _0x1a3fbf;}return this['channel'][_0x0c5c('0xaa')](util[_0x0c5c('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x14c856));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0xc4')]=function(_0x28910a){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x28910a['label']));if(!this[_0x0c5c('0xa5')](_0x28910a['text'])){return this['channel'][_0x0c5c('0xaa')](_0x0c5c('0xab'));}var _0x1dd015='\x22'+_0x28910a['text']+'\x22';if(this[_0x0c5c('0xa5')](_0x28910a[_0x0c5c('0x79')])){_0x1dd015+=','+_0x28910a[_0x0c5c('0x79')];}var _0x40f0a6=this[_0x0c5c('0xe')]['exec'](_0x0c5c('0xac'),_0x1dd015);if(_0x40f0a6[_0x0c5c('0xa4')]===-0x1){return _0x40f0a6;}return this[_0x0c5c('0xe')]['noop'](util[_0x0c5c('0x29')](_0x0c5c('0xad'),_0x1dd015));};AGIVertices[_0x0c5c('0x10')]['lumenvoxasr']=function(_0x5eb271){logger[_0x0c5c('0x2f')](util['format'](_0x0c5c('0xc5'),_0x5eb271['label']));if(!this[_0x0c5c('0xa5')](_0x5eb271[_0x0c5c('0xc6')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0xb0'));}var _0x5387e4=_0x5eb271['grammar'];if(this['isConfigured'](_0x5eb271[_0x0c5c('0x79')])){_0x5387e4+=','+_0x5eb271['options'];}var _0x2c26c1=this['channel'][_0x0c5c('0x5a')](_0x0c5c('0xb1'),_0x5387e4);if(_0x2c26c1[_0x0c5c('0xa4')]===-0x1){return _0x2c26c1;}var _0xd90de8=this[_0x0c5c('0xa3')](_0x0c5c('0xb2'),'LUMENVOX_ASR_CONFIDENCE');if(_0xd90de8[_0x0c5c('0xa4')]===-0x1){return _0xd90de8;}var _0x3828a1=this['getAndSetVariable'](_0x0c5c('0xb4'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x3828a1[_0x0c5c('0xa4')]===-0x1){return _0x3828a1;}var _0x10c0c4=this['getAndSetVariable'](_0x0c5c('0xb5'),_0x0c5c('0xc7'));if(_0x10c0c4['result']===-0x1){return _0x10c0c4;}return this[_0x0c5c('0xe')]['noop'](util[_0x0c5c('0x29')](_0x0c5c('0xc8'),_0x5387e4));};AGIVertices[_0x0c5c('0x10')]['sestekasr']=function(_0x54892c){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x54892c['label']));if(!this[_0x0c5c('0xa5')](_0x54892c[_0x0c5c('0xc6')])){return this['channel'][_0x0c5c('0xaa')](_0x0c5c('0xb0'));}var _0x2e82ad=_0x54892c[_0x0c5c('0xc6')];if(this[_0x0c5c('0xa5')](_0x54892c['options'])){_0x2e82ad+=','+_0x54892c[_0x0c5c('0x79')];}var _0x35284=this['channel']['exec'](_0x0c5c('0xb1'),_0x2e82ad);if(_0x35284[_0x0c5c('0xa4')]===-0x1){return _0x35284;}var _0x2de8e8=this['getAndSetVariable'](_0x0c5c('0xb2'),_0x0c5c('0xc9'));if(_0x2de8e8[_0x0c5c('0xa4')]===-0x1){return _0x2de8e8;}var _0xfd60bd=this['getAndSetVariable']('RECOG_INPUT()',_0x0c5c('0xca'));if(_0xfd60bd['result']===-0x1){return _0xfd60bd;}var _0x1a4121=this['getAndSetVariable'](_0x0c5c('0xb5'),_0x0c5c('0xcb'));if(_0x1a4121['result']===-0x1){return _0x1a4121;}return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0xc8'),_0x2e82ad));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0xcc')]=function(_0x5c561c){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5c561c[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x5c561c['odbc_id'])){return this[_0x0c5c('0xe')]['error'](_0x5c561c,_0x0c5c('0xcd'));}var _0x3d4d45=this[_0x0c5c('0xce')][_0x0c5c('0x71')](this,_0x5c561c[_0x0c5c('0xcf')]);if(!_0x3d4d45){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x5c561c,_0x0c5c('0xd0'));}if(!this[_0x0c5c('0xa5')](_0x5c561c[_0x0c5c('0x2e')])){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x5c561c,_0x0c5c('0xd1'));}var _0xc7d59c=_0x5c561c[_0x0c5c('0x2e')][_0x0c5c('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0xd2'),_0xc7d59c));var _0x210055=this[_0x0c5c('0xd3')]['sync'](this,_0x3d4d45,_0xc7d59c);this[_0x0c5c('0x37')][_0x0c5c('0x71')](this,_0x5c561c,_0xc7d59c);if(!this[_0x0c5c('0xa5')](_0x5c561c['variable_id'])){return this[_0x0c5c('0xe')]['noop'](_0x0c5c('0xd4'));}var _0x474816=this[_0x0c5c('0x11')][_0x0c5c('0x71')](this,_0x5c561c[_0x0c5c('0xd5')]);if(!_0x474816){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x5c561c,'no\x20variable\x20found');}var _0x23c30f=this;_0x210055[_0x0c5c('0xd6')](function(_0x3e7ce3,_0x4b92b9){Object['keys'](_0x3e7ce3)[_0x0c5c('0xd6')](function(_0x943ac7){_0x23c30f['channel']['setVariable'](util[_0x0c5c('0x29')]('%s[%s][%s]',_0x474816,_0x4b92b9,_0x943ac7),_0x3e7ce3[_0x943ac7]);});});this[_0x0c5c('0xe')]['setVariable'](util[_0x0c5c('0x29')]('%s_ROWS_COUNT',_0x474816),_0x210055[_0x0c5c('0x9b')]);return this[_0x0c5c('0xe')]['noop'](util[_0x0c5c('0x29')](_0x0c5c('0xd7'),_0x474816));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0xd8')]=function(_0x1ab3e2){logger['debug'](util[_0x0c5c('0x29')](_0x0c5c('0xd9'),_0x1ab3e2[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x1ab3e2[_0x0c5c('0xda')])){return this[_0x0c5c('0xe')]['error'](_0x1ab3e2,_0x0c5c('0xdb'));}var _0x13400d=this[_0x0c5c('0x1c')][_0x0c5c('0x71')](this,_0x1ab3e2['sip_id']);if(!_0x13400d){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x1ab3e2,_0x0c5c('0xdc'));}var _0x16e82b=this[_0x0c5c('0xe')][_0x0c5c('0x5a')](_0x0c5c('0xdd'),[util[_0x0c5c('0x29')]('SIP/%s',_0x13400d),_0x1ab3e2[_0x0c5c('0x68')],_0x1ab3e2[_0x0c5c('0xde')],_0x1ab3e2['url']]);if(_0x16e82b[_0x0c5c('0xa4')]===-0x1){return _0x16e82b;}return this['channel'][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0xdf'),'DIAL'));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0xe0')]=function(_0x4c7a90){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0xe1'),_0x4c7a90[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x4c7a90[_0x0c5c('0x91')])){return this['channel'][_0x0c5c('0xaa')]('no\x20key\x20configured');}if(!this[_0x0c5c('0xa5')](_0x4c7a90['text'])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0xab'));}this[_0x0c5c('0xe')][_0x0c5c('0xe2')]=!![];this[_0x0c5c('0x37')](_0x4c7a90);this['createSquareMessage'](_0x4c7a90[_0x0c5c('0x60')],'in','','');this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')]('Trying\x20Dialogflow:\x20%s',_0x4c7a90[_0x0c5c('0x60')]));var _0x4f224b=this[_0x0c5c('0x7a')][_0x0c5c('0x71')](this,_0x4c7a90);if(_0x4f224b){for(var _0x537e8f in _0x4f224b){if(_0x4f224b[_0x0c5c('0x97')](_0x537e8f)){this['channel']['setVariable'](util['format'](_0x0c5c('0xe3'),_0x537e8f[_0x0c5c('0x6b')]()),_0x4f224b[_0x537e8f]);}}this[_0x0c5c('0x42')](_0x4f224b[_0x0c5c('0xe4')],'out',_0x0c5c('0xe0'),'');return this['channel']['noop'](util[_0x0c5c('0x29')](_0x0c5c('0xe5'),_0x4f224b[_0x0c5c('0xe4')]));}return this[_0x0c5c('0xe')]['error'](_0x4c7a90,_0x0c5c('0xe6'));};AGIVertices[_0x0c5c('0x10')]['dialogflowV2']=function(_0x34edeb){logger['info'](util['format'](_0x0c5c('0xe7'),_0x34edeb['label']));if(!this[_0x0c5c('0xa5')](_0x34edeb['dialogflowV2_project_id'])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0xe8'));}if(!this[_0x0c5c('0xa5')](_0x34edeb[_0x0c5c('0x7e')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0xe9'));}if(!this[_0x0c5c('0xa5')](_0x34edeb[_0x0c5c('0x7f')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')]('no\x20private_key\x20configured');}if(!this[_0x0c5c('0xa5')](_0x34edeb[_0x0c5c('0xea')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x34edeb[_0x0c5c('0x60')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0xab'));}this[_0x0c5c('0xe')][_0x0c5c('0xe2')]=!![];this[_0x0c5c('0x37')](_0x34edeb);this[_0x0c5c('0x42')](_0x34edeb[_0x0c5c('0x60')],'in','','');this[_0x0c5c('0xe')]['noop'](util[_0x0c5c('0x29')](_0x0c5c('0xeb'),_0x34edeb[_0x0c5c('0x60')]));var _0x36a255=this[_0x0c5c('0x7c')][_0x0c5c('0x71')](this,_0x34edeb);if(_0x36a255){for(var _0xb58b3d in _0x36a255){if(_0x36a255[_0x0c5c('0x97')](_0xb58b3d)){if(_0xb58b3d!==_0x0c5c('0xec')){this[_0x0c5c('0xe')][_0x0c5c('0x9f')](util['format']('DIALOGFLOW_%s',_0xb58b3d[_0x0c5c('0x6b')]()),_0x36a255[_0xb58b3d]);}}}this[_0x0c5c('0x42')](_0x36a255[_0x0c5c('0xe4')],'out',_0x0c5c('0xed'),_0x36a255[_0x0c5c('0xec')]);return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0xee'),_0x36a255[_0x0c5c('0xe4')]));}return this[_0x0c5c('0xe')]['error'](_0x34edeb,_0x0c5c('0xef'));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0xf0')]=function(_0x1a9ed9){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0xf1'),_0x1a9ed9['label']));if(!this[_0x0c5c('0xa5')](_0x1a9ed9[_0x0c5c('0xf2')])){return this[_0x0c5c('0xe')]['noop'](_0x0c5c('0xf3'));}if(!this['isConfigured'](_0x1a9ed9['username'])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0xf4'));}if(!this[_0x0c5c('0xa5')](_0x1a9ed9[_0x0c5c('0xf5')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')]('no\x20password\x20configured');}if(!this[_0x0c5c('0xa5')](_0x1a9ed9[_0x0c5c('0xf6')])){return this[_0x0c5c('0xe')]['noop'](_0x0c5c('0xab'));}this[_0x0c5c('0xe')][_0x0c5c('0xe2')]=!![];this[_0x0c5c('0x37')](_0x1a9ed9);this[_0x0c5c('0x42')](_0x1a9ed9[_0x0c5c('0x60')],'in','','');this['channel']['noop'](util[_0x0c5c('0x29')](_0x0c5c('0xf7'),_0x1a9ed9[_0x0c5c('0x60')]));var _0x5bf6b8=this[_0x0c5c('0x80')][_0x0c5c('0x71')](this,_0x1a9ed9);if(_0x5bf6b8){for(var _0x91972b in _0x5bf6b8){if(_0x5bf6b8['hasOwnProperty'](_0x91972b)){this[_0x0c5c('0xe')][_0x0c5c('0x9f')](util[_0x0c5c('0x29')](_0x0c5c('0xf8'),_0x91972b['toUpperCase']()),_0x5bf6b8[_0x91972b]);}}this['createSquareMessage'](_0x5bf6b8[_0x0c5c('0xe4')],_0x0c5c('0xf9'),_0x0c5c('0xf0'),'');if(_0x5bf6b8[_0x0c5c('0xfa')]){this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0xfb'),_0x5bf6b8[_0x0c5c('0xfa')]));var _0x2e87d2=this[_0x0c5c('0xe')][_0x0c5c('0xfc')](_0x5bf6b8[_0x0c5c('0xfa')]);try{fs[_0x0c5c('0xfd')](_0x5bf6b8[_0x0c5c('0xfa')]+_0x0c5c('0xfe'));}catch(_0x43a7c6){logger[_0x0c5c('0x54')](_0x43a7c6);}return _0x2e87d2;}else{return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0xff'),_0x5bf6b8[_0x0c5c('0xe4')]));}}return this[_0x0c5c('0xe')]['error'](_0x1a9ed9,_0x0c5c('0x100'));};AGIVertices[_0x0c5c('0x10')]['end']=function(_0x2a57ee){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x101'),_0x2a57ee[_0x0c5c('0x39')]));return this[_0x0c5c('0xe')]['noop'](_0x0c5c('0x102'));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x103')]=function(_0x6c660c){logger[_0x0c5c('0x2f')](util['format'](_0x0c5c('0x104'),_0x6c660c['label']));var _0x1454d5='';if(_0x6c660c[_0x0c5c('0x105')]){if(!this['isConfigured'](_0x6c660c[_0x0c5c('0x105')])){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x6c660c,_0x0c5c('0x106'));}else{var _0x4ade2d=parseInt(_0x6c660c[_0x0c5c('0x105')],0xa);if(isNaN(_0x4ade2d)){_0x1454d5=_0x6c660c[_0x0c5c('0x105')];}else{_0x1454d5=this[_0x0c5c('0x1e')][_0x0c5c('0x71')](this,_0x6c660c[_0x0c5c('0x105')]);if(!_0x1454d5){return this[_0x0c5c('0xe')]['error'](_0x6c660c,'no\x20trunk\x20found');}}}}else if(_0x6c660c[_0x0c5c('0x107')]){_0x1454d5=_0x6c660c[_0x0c5c('0x107')];}else{return this['channel']['error'](_0x6c660c,_0x0c5c('0x106'));}var _0x14b8b8=this[_0x0c5c('0xe')]['exec'](_0x0c5c('0xdd'),[util[_0x0c5c('0x29')](_0x0c5c('0x108'),_0x1454d5,_0x6c660c[_0x0c5c('0x49')]),_0x6c660c[_0x0c5c('0x68')],_0x6c660c['opts'],_0x6c660c[_0x0c5c('0x109')]]);if(_0x14b8b8[_0x0c5c('0xa4')]===-0x1){return _0x14b8b8;}return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util['format']('Executed\x20command\x20%s',_0x0c5c('0xdd')));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x10a')]=function(_0x4e3a63){logger[_0x0c5c('0x2f')](util['format'](_0x0c5c('0x10b'),_0x4e3a63[_0x0c5c('0x39')]));return this['channel'][_0x0c5c('0xaa')]('finally');};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0xd')]=function(_0x4b93fa){logger['info'](util['format'](_0x0c5c('0x10c'),_0x4b93fa[_0x0c5c('0x39')]));if(_0x4b93fa[_0x0c5c('0xa6')]===0x0){return this[_0x0c5c('0xa7')](_0x4b93fa);}_0x4b93fa[_0x0c5c('0xa6')]-=0x1;if(!this['isConfigured'](_0x4b93fa['file_id'])){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x4b93fa,_0x0c5c('0x10d'));}var _0x51f1cc=this[_0x0c5c('0x20')]['sync'](this,_0x4b93fa['file_id']);if(!_0x51f1cc){return this['channel'][_0x0c5c('0x54')](_0x4b93fa,'no\x20file\x20audio\x20found');}if(!this[_0x0c5c('0xa5')](_0x4b93fa[_0x0c5c('0xd5')])){return this['channel']['error'](_0x0c5c('0xd4'));}var _0x1ee3d7=this['channel']['getData'](_0x51f1cc,_0x4b93fa[_0x0c5c('0x10e')],_0x4b93fa[_0x0c5c('0x10f')]);var _0x910507=_0x1ee3d7[_0x0c5c('0xa4')]?_0x1ee3d7[_0x0c5c('0xa4')][_0x0c5c('0x4d')]():'';logger[_0x0c5c('0x2f')](_0x0c5c('0x110'),JSON[_0x0c5c('0x74')](_0x1ee3d7));if(_0x1ee3d7['result']===-0x1){this['createSquareDetailsReport'][_0x0c5c('0x71')](this,_0x4b93fa,_0x910507);return _0x1ee3d7;}else if(_0x1ee3d7[_0x0c5c('0xa2')]===_0x0c5c('0x68')){_0x1ee3d7['result']=_0x910507[_0x0c5c('0x9b')]>=parseInt(_0x4b93fa['mindigit'])?'x':'i';}else{_0x1ee3d7['result']=_0x910507[_0x0c5c('0x9b')]>=parseInt(_0x4b93fa[_0x0c5c('0x111')])&&_0x910507[_0x0c5c('0x9b')]<=parseInt(_0x4b93fa[_0x0c5c('0x10f')])?'x':'i';}var _0x4df5bb=this[_0x0c5c('0x11')][_0x0c5c('0x71')](this,_0x4b93fa[_0x0c5c('0xd5')]);if(!_0x4df5bb){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x4b93fa,_0x0c5c('0x112'));}this[_0x0c5c('0xe')]['setVariable'](_0x4df5bb,_0x910507);if(this[_0x0c5c('0xa5')](_0x4b93fa[_0x0c5c('0x113')])){var _0x40b048=parseInt(_0x4b93fa[_0x0c5c('0x113')],0xa);var _0x2b72dd=rs[_0x0c5c('0x114')]({'charset':'*','length':_0x40b048});var _0x476e85=_0x910507[_0x0c5c('0x9b')];if(_0x476e85>0x0){if(_0x476e85>_0x40b048){this[_0x0c5c('0x37')][_0x0c5c('0x71')](this,_0x4b93fa,_0x4b93fa[_0x0c5c('0x115')]===_0x0c5c('0x116')?_0x2b72dd+_0x910507[_0x0c5c('0x117')](_0x40b048):_0x910507[_0x0c5c('0x117')](0x0,_0x476e85-_0x40b048)+_0x2b72dd);}else{this[_0x0c5c('0x37')][_0x0c5c('0x71')](this,_0x4b93fa,rs[_0x0c5c('0x114')]({'charset':'*','length':_0x476e85}));}}else{this[_0x0c5c('0x37')]['sync'](this,_0x4b93fa,'');}}else{this[_0x0c5c('0x37')][_0x0c5c('0x71')](this,_0x4b93fa,_0x910507);}return _0x1ee3d7;};AGIVertices[_0x0c5c('0x10')]['getsecretdigits']=function(_0x31cbfe){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x31cbfe[_0x0c5c('0x39')]));return this[_0x0c5c('0xd')](_0x31cbfe);};AGIVertices['prototype'][_0x0c5c('0x118')]=function(_0x15d3c8){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x119'),_0x15d3c8['label']));this[_0x0c5c('0x37')]['sync'](this,_0x15d3c8,_0x15d3c8['goalname']);return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util['format'](_0x0c5c('0x11a'),_0x15d3c8[_0x0c5c('0x11b')]));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x11c')]=function(_0x4bc8c5){logger['info'](util[_0x0c5c('0x29')](_0x0c5c('0x11d'),_0x4bc8c5[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x4bc8c5[_0x0c5c('0x87')])||!this[_0x0c5c('0xa5')](_0x4bc8c5[_0x0c5c('0x8d')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0x11e'));}if(!this['isConfigured'](_0x4bc8c5[_0x0c5c('0x60')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')]('no\x20text\x20configured');}this['channel']['noop'](util['format'](_0x0c5c('0x11f'),_0x4bc8c5[_0x0c5c('0x60')]));var _0x4062a4=this[_0x0c5c('0x86')]['sync'](this,_0x4bc8c5);if(_0x4062a4){this[_0x0c5c('0xe')]['noop'](util['format'](_0x0c5c('0x120'),_0x4062a4));var _0x2191f0=this[_0x0c5c('0xe')]['streamFile'](_0x4062a4);try{fs[_0x0c5c('0xfd')](_0x4062a4+_0x0c5c('0xfe'));}catch(_0x23e9c7){logger[_0x0c5c('0x54')](_0x23e9c7);}return _0x2191f0;}return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x4bc8c5,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x0c5c('0x121')]=function(_0x3a2dc3){logger[_0x0c5c('0x2f')](util['format'](_0x0c5c('0x122'),_0x3a2dc3[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x3a2dc3['aws_access_key_id'])||!this[_0x0c5c('0xa5')](_0x3a2dc3['aws_secret_access_key'])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0x11e'));}if(!this['isConfigured'](_0x3a2dc3[_0x0c5c('0x8f')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0x123'));}if(!this['isConfigured'](_0x3a2dc3['text'])){return this[_0x0c5c('0xe')]['noop'](_0x0c5c('0xab'));}this[_0x0c5c('0xe')][_0x0c5c('0xe2')]=!![];this['createSquareDetailsReport'](_0x3a2dc3);this['createSquareMessage'](_0x3a2dc3[_0x0c5c('0x60')],'in','','');this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0x124'),_0x3a2dc3[_0x0c5c('0x60')]));var _0x2ce5cb=this[_0x0c5c('0x8c')][_0x0c5c('0x71')](this,_0x3a2dc3);if(_0x2ce5cb){for(var _0x1f547e in _0x2ce5cb){if(_0x2ce5cb[_0x0c5c('0x97')](_0x1f547e)&&_[_0x0c5c('0x98')](_0x2ce5cb[_0x1f547e])){this[_0x0c5c('0xe')]['setVariable'](util['format'](_0x0c5c('0x125'),_0x1f547e[_0x0c5c('0x6b')]()),_0x2ce5cb[_0x1f547e]);}}if(_['isNil'](_0x2ce5cb['message'])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0x126'));}else{this[_0x0c5c('0x42')](_0x2ce5cb[_0x0c5c('0x78')],_0x0c5c('0xf9'),_0x0c5c('0x127'),'');return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0x128'),_0x2ce5cb[_0x0c5c('0x78')]));}}return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x3a2dc3,_0x0c5c('0x129'));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x12a')]=function(_0x72e489){logger[_0x0c5c('0x2f')](util['format'](_0x0c5c('0x12b'),_0x72e489[_0x0c5c('0x39')],_0x72e489[_0x0c5c('0x68')]));if(!this[_0x0c5c('0xa5')](_0x72e489[_0x0c5c('0x91')])){return this[_0x0c5c('0xe')]['noop'](_0x0c5c('0x12c'));}var _0x2ed6aa=_0x0c5c('0x12d');var _0x3866c8=util['format'](_0x0c5c('0x12e'),FILES_PATH,rs[_0x0c5c('0x114')](0x4));var _0x306cd6=util[_0x0c5c('0x29')](_0x0c5c('0x9e'),_0x3866c8,_0x2ed6aa);var _0x21b770=!![];if(_0x72e489['beep']===_0x0c5c('0x12f')){_0x21b770=![];}var _0x25dca8=this['channel'][_0x0c5c('0x130')](_0x3866c8,_0x2ed6aa,_0x72e489[_0x0c5c('0x131')],_0x72e489[_0x0c5c('0x68')],undefined,_0x21b770);if(_0x25dca8[_0x0c5c('0xa4')]!==-0x1){this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util['format'](_0x0c5c('0x132'),_0x306cd6));var _0x254f79=this[_0x0c5c('0x90')][_0x0c5c('0x71')](this,_0x72e489,_0x306cd6);if(_0x254f79){for(var _0x141e11 in _0x254f79){if(_0x254f79['hasOwnProperty'](_0x141e11)){this['channel'][_0x0c5c('0x9f')](util['format'](_0x0c5c('0x133'),_0x141e11[_0x0c5c('0x6b')]()),_0x254f79[_0x141e11]);}}return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0x134'),JSON[_0x0c5c('0x74')](_0x254f79)));}}return _0x25dca8;};AGIVertices['prototype']['tildeasr']=function(_0x55e82f){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x135'),_0x55e82f['label']));if(!this[_0x0c5c('0xa5')](_0x55e82f[_0x0c5c('0x136')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0x137'));}if(!this[_0x0c5c('0xa5')](_0x55e82f['appsecret'])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')]('no\x20appsecret\x20configured');}var _0x38c117='wav';var _0x2e244f=util[_0x0c5c('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x0c5c('0x114')](0x4));var _0x38a053=util[_0x0c5c('0x29')]('%s.%s',_0x2e244f,_0x38c117);var _0x4b2135=!![];if(_0x55e82f[_0x0c5c('0x138')]===_0x0c5c('0x12f')){_0x4b2135=![];}var _0x29cdf5=this[_0x0c5c('0xe')][_0x0c5c('0x130')](_0x2e244f,_0x38c117,_0x55e82f[_0x0c5c('0x131')],_0x55e82f[_0x0c5c('0x68')],undefined,_0x4b2135);if(_0x29cdf5[_0x0c5c('0xa4')]!==-0x1){this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util['format'](_0x0c5c('0x139'),_0x38a053));var _0x10b8d1=this[_0x0c5c('0x93')]['sync'](this,_0x55e82f,_0x38a053);if(_0x10b8d1){for(var _0xa63139 in _0x10b8d1){if(_0x10b8d1[_0x0c5c('0x97')](_0xa63139)){this[_0x0c5c('0xe')][_0x0c5c('0x9f')](util[_0x0c5c('0x29')]('TILDE_ASR_%s',_0xa63139['toUpperCase']()),_0x10b8d1[_0xa63139]);}}return this[_0x0c5c('0xe')]['noop'](util[_0x0c5c('0x29')]('TildeASR\x20Result\x20%s',JSON[_0x0c5c('0x74')](_0x10b8d1)));}}return _0x29cdf5;};AGIVertices['prototype'][_0x0c5c('0x13a')]=function(_0x57c396){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x13b'),_0x57c396[_0x0c5c('0x39')]));return this[_0x0c5c('0xe')][_0x0c5c('0x13c')](_0x57c396['context'],_0x57c396[_0x0c5c('0x13d')],_0x57c396[_0x0c5c('0x13e')]);};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x13f')]=function(_0x271bda){logger['info'](util[_0x0c5c('0x29')](_0x0c5c('0x140'),_0x271bda['label']));if(!this[_0x0c5c('0xa5')](_0x271bda[_0x0c5c('0x141')])){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x271bda,'no\x20condition\x20configured');}try{var _0x590efc=eval(_0x271bda['condition'])?_0x0c5c('0x142'):_0x0c5c('0x143');this[_0x0c5c('0xe')]['noop'](util[_0x0c5c('0x29')](_0x0c5c('0x144'),_0x271bda[_0x0c5c('0x141')],_0x590efc));return{'code':0xc8,'result':_0x590efc};}catch(_0x4851eb){return{'code':0xc8,'result':_0x0c5c('0x143')};}};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x145')]=function(_0x5be131){logger[_0x0c5c('0x2f')](util['format'](_0x0c5c('0x146'),_0x5be131[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x5be131['interval_id'])){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x5be131,'no\x20interval\x20configured');}var _0x2e61c9=this['getIntervals'][_0x0c5c('0x71')](this,_0x5be131['interval_id']);if(!_0x2e61c9){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x5be131,_0x0c5c('0x147'));}for(var _0x3c4c1e=0x0;_0x3c4c1e<_0x2e61c9[_0x0c5c('0x9b')];_0x3c4c1e+=0x1){var _0x57c544=this[_0x0c5c('0xe')][_0x0c5c('0x11')](util['format'](_0x0c5c('0x148'),_0x2e61c9[_0x3c4c1e]));if(_0x57c544[_0x0c5c('0xa4')]===-0x1){return _0x57c544;}logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x149'),_0x2e61c9[_0x3c4c1e],_0x57c544[_0x0c5c('0xa2')]));if(_0x57c544[_0x0c5c('0xa2')]==='true'){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x149'),_0x2e61c9[_0x3c4c1e],_0x0c5c('0x142')));this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util['format'](_0x0c5c('0x149'),_0x2e61c9[_0x3c4c1e],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x149'),_0x2e61c9[_0x3c4c1e],_0x0c5c('0x143')));this['channel'][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0x149'),_0x2e61c9[_0x3c4c1e],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x0c5c('0x10')]['hangup']=function(_0x216e9b){logger['info'](util[_0x0c5c('0x29')](_0x0c5c('0x14a'),_0x216e9b[_0x0c5c('0x39')]));return this[_0x0c5c('0xe')]['hangup']();};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x14b')]=function(_0x21773c){logger[_0x0c5c('0x2f')](util['format'](_0x0c5c('0x14c'),_0x21773c[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x21773c['key'])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0x12c'));}var _0x25daad=_0x0c5c('0x12d');var _0x2d3a41=util[_0x0c5c('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x0c5c('0x114')](0x4));var _0x27070d=util[_0x0c5c('0x29')]('%s.%s',_0x2d3a41,_0x25daad);var _0x484b4b=!![];if(_0x21773c[_0x0c5c('0x138')]===_0x0c5c('0x12f')){_0x484b4b=![];}var _0x47c11e=this[_0x0c5c('0xe')][_0x0c5c('0x130')](_0x2d3a41,_0x25daad,_0x21773c[_0x0c5c('0x131')],_0x21773c[_0x0c5c('0x68')],undefined,_0x484b4b);if(_0x47c11e[_0x0c5c('0xa4')]!==-0x1){this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util['format'](_0x0c5c('0x14d'),_0x27070d));var _0x4b17d7=this['ispeechASR'][_0x0c5c('0x71')](this,_0x21773c,_0x27070d);if(_0x4b17d7){for(var _0x24358b in _0x4b17d7){if(_0x4b17d7['hasOwnProperty'](_0x24358b)){this[_0x0c5c('0xe')][_0x0c5c('0x9f')](util[_0x0c5c('0x29')](_0x0c5c('0x14e'),_0x24358b[_0x0c5c('0x6b')]()),_0x4b17d7[_0x24358b]);}}return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0x14f'),JSON[_0x0c5c('0x74')](_0x4b17d7)));}}return _0x47c11e;};AGIVertices[_0x0c5c('0x10')]['ispeechtts']=function(_0x12ede1){logger['info'](util[_0x0c5c('0x29')](_0x0c5c('0x150'),_0x12ede1['label']));if(!this[_0x0c5c('0xa5')](_0x12ede1['key'])){return this[_0x0c5c('0xe')]['noop'](_0x0c5c('0x12c'));}if(!this[_0x0c5c('0xa5')](_0x12ede1['text'])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0xab'));}this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util['format'](_0x0c5c('0x151'),_0x12ede1[_0x0c5c('0x60')]));var _0x403441=this[_0x0c5c('0x81')]['sync'](this,_0x12ede1);if(_0x403441){this['channel'][_0x0c5c('0xaa')](util[_0x0c5c('0x29')]('ispeech\x20%s\x20file\x20created',_0x403441));var _0x37b79c=this[_0x0c5c('0xe')][_0x0c5c('0xfc')](_0x403441,_0x12ede1[_0x0c5c('0x131')]);try{fs[_0x0c5c('0xfd')](_0x403441+_0x0c5c('0xfe'));}catch(_0x2af2f8){logger[_0x0c5c('0x54')](_0x2af2f8);}return _0x37b79c;}return this[_0x0c5c('0xe')]['error'](_0x12ede1,_0x0c5c('0x152'));};AGIVertices['prototype'][_0x0c5c('0x153')]=function(_0x199da0){logger[_0x0c5c('0x2f')](util['format'](_0x0c5c('0x154'),_0x199da0[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x199da0['findBy'])){return this['channel'][_0x0c5c('0x54')](_0x199da0,'no\x20find\x20by\x20configured');}logger[_0x0c5c('0x2f')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x0c5c('0xe')][_0x0c5c('0x3c')],_0x199da0[_0x0c5c('0x155')]));var _0x295309=this[_0x0c5c('0x56')][_0x0c5c('0x71')](this,_0x199da0[_0x0c5c('0x155')]);if(_0x295309){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x156'),this['channel'][_0x0c5c('0x3c')],_0x199da0['findBy']));this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x0c5c('0xe')][_0x0c5c('0x3c')],_0x199da0[_0x0c5c('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x157'),this[_0x0c5c('0xe')][_0x0c5c('0x3c')],_0x199da0[_0x0c5c('0x155')]));this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0c5c('0xe')]['callerid'],_0x199da0['findBy']));return{'code':0xc8,'result':_0x0c5c('0x158')};}};AGIVertices[_0x0c5c('0x10')]['logout']=function(_0x462b49){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x159'),_0x462b49['label']));if(!this[_0x0c5c('0xa5')](_0x462b49['findBy'])){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x462b49,'no\x20find\x20by\x20configured');}logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x15a'),this[_0x0c5c('0xe')]['callerid'],_0x462b49[_0x0c5c('0x155')]));var _0x4eb235=this['agentLogout'][_0x0c5c('0x71')](this,_0x462b49[_0x0c5c('0x155')]);if(_0x4eb235){logger['info'](util[_0x0c5c('0x29')](_0x0c5c('0x156'),this[_0x0c5c('0xe')][_0x0c5c('0x3c')],_0x462b49['findBy']));this['channel'][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0x156'),this[_0x0c5c('0xe')][_0x0c5c('0x3c')],_0x462b49[_0x0c5c('0x155')]));return{'code':0xc8,'result':_0x0c5c('0x15b')};}else{logger[_0x0c5c('0x2f')](util['format'](_0x0c5c('0x157'),this[_0x0c5c('0xe')][_0x0c5c('0x3c')],_0x462b49['findBy']));this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0x157'),this[_0x0c5c('0xe')][_0x0c5c('0x3c')],_0x462b49['findBy']));return{'code':0xc8,'result':_0x0c5c('0x158')};}};AGIVertices['prototype'][_0x0c5c('0x15c')]=function(_0x2e32a0){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x15d'),_0x2e32a0[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x2e32a0['operation'])){return this[_0x0c5c('0xe')]['error'](_0x2e32a0,_0x0c5c('0x15e'));}this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0x15f'),_0x2e32a0[_0x0c5c('0x160')]));var _0x352666=eval(_0x2e32a0['operation']);if(!this[_0x0c5c('0xa5')](_0x2e32a0[_0x0c5c('0xd5')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3bb411=this[_0x0c5c('0x11')][_0x0c5c('0x71')](this,_0x2e32a0[_0x0c5c('0xd5')]);if(!_0x3bb411){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x2e32a0,'no\x20variable\x20found');}if(_['isArray'](_0x352666)){var _0x50dd85=this;_0x352666['forEach'](function(_0x313f28,_0x3ae34c){_0x50dd85[_0x0c5c('0xe')][_0x0c5c('0x9f')](util[_0x0c5c('0x29')]('%s[%s]',_0x3bb411,_0x3ae34c),_0x313f28);});return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util['format']('variable\x20%s[key]\x20set',_0x3bb411));}else{return this[_0x0c5c('0xe')]['setVariable'](_0x3bb411,_0x352666);}};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0xc')]=function(_0x420f83){logger[_0x0c5c('0x2f')](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x420f83[_0x0c5c('0x39')]));if(_0x420f83['retry']===0x0){return this[_0x0c5c('0xa7')](_0x420f83);}_0x420f83[_0x0c5c('0xa6')]-=0x1;if(!this[_0x0c5c('0xa5')](_0x420f83[_0x0c5c('0x161')])){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x420f83,'no\x20file\x20audio\x20selected');}var _0xd3f1ed=this[_0x0c5c('0x20')]['sync'](this,_0x420f83[_0x0c5c('0x161')]);if(!_0xd3f1ed){return this[_0x0c5c('0xe')]['error'](_0x420f83,_0x0c5c('0x162'));}var _0x2bdc3f=this[_0x0c5c('0xe')][_0x0c5c('0x163')](_0xd3f1ed,_0x420f83[_0x0c5c('0x10e')],_0x420f83['digit']);var _0x3d09ae=_0x2bdc3f['result'];if(_0x2bdc3f[_0x0c5c('0xa4')]===-0x1){this[_0x0c5c('0x37')][_0x0c5c('0x71')](this,_0x420f83,'-1');return _0x2bdc3f;}else if(_0x2bdc3f[_0x0c5c('0xa2')]==='timeout'){_0x2bdc3f[_0x0c5c('0xa4')]=_0x2bdc3f[_0x0c5c('0xa4')][_0x0c5c('0x9b')]>0x0?_0x2bdc3f[_0x0c5c('0xa4')]:'t';}else if(_[_0x0c5c('0x47')](_0x2bdc3f[_0x0c5c('0xa4')])){_0x2bdc3f[_0x0c5c('0xa4')]='#';_0x3d09ae='#';}if(!this[_0x0c5c('0xa5')](_0x420f83[_0x0c5c('0xd5')])){this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0xd4'));}else{var _0x25f225=this[_0x0c5c('0x11')][_0x0c5c('0x71')](this,_0x420f83[_0x0c5c('0xd5')]);if(!_0x25f225){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x420f83,_0x0c5c('0x112'));}this[_0x0c5c('0xe')][_0x0c5c('0x9f')](_0x25f225,_0x3d09ae);}this[_0x0c5c('0x37')][_0x0c5c('0x71')](this,_0x420f83,_0x3d09ae);return _0x2bdc3f;};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0xaa')]=function(_0x5672f6){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x5672f6[_0x0c5c('0x39')]));return this[_0x0c5c('0xe')]['noop'](_0x5672f6['output']||_0x5672f6['label']);};AGIVertices[_0x0c5c('0x10')]['pause']=function(_0x27fd83){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x27fd83[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x27fd83[_0x0c5c('0x155')])){return this['channel'][_0x0c5c('0x54')](_0x27fd83,_0x0c5c('0x164'));}logger['info'](util[_0x0c5c('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x0c5c('0xe')][_0x0c5c('0x3c')],_0x27fd83[_0x0c5c('0x155')]));var _0x120227=this['getPause'][_0x0c5c('0x71')](this,_0x27fd83[_0x0c5c('0x165')]);var _0x3014c8=this[_0x0c5c('0x51')]['sync'](this,_0x27fd83['findBy'],_0x120227);if(_0x3014c8){logger[_0x0c5c('0x2f')](util['format'](_0x0c5c('0x156'),this['channel'][_0x0c5c('0x3c')],_0x27fd83[_0x0c5c('0x155')]));this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0c5c('0xe')][_0x0c5c('0x3c')],_0x27fd83[_0x0c5c('0x155')]));return{'code':0xc8,'result':_0x0c5c('0x15b')};}else{logger['info'](util['format'](_0x0c5c('0x157'),this['channel'][_0x0c5c('0x3c')],_0x27fd83[_0x0c5c('0x155')]));this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util['format'](_0x0c5c('0x156'),this[_0x0c5c('0xe')]['callerid'],_0x27fd83['findBy']));return{'code':0xc8,'result':_0x0c5c('0x158')};}};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x166')]=function(_0x5c9ea4){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x5c9ea4[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x5c9ea4['file_id'])){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x5c9ea4,'no\x20file\x20audio\x20selected');}var _0x37d375=this[_0x0c5c('0x20')][_0x0c5c('0x71')](this,_0x5c9ea4[_0x0c5c('0x161')]);if(!_0x37d375){return this[_0x0c5c('0xe')]['error'](_0x5c9ea4,'no\x20file\x20audio\x20found');}var _0x1b1dae=this[_0x0c5c('0xe')]['exec'](_0x0c5c('0x167'),[_0x37d375,_0x5c9ea4[_0x0c5c('0xde')]]);if(_0x1b1dae['result']===-0x1){return _0x1b1dae;}return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0xc2'),'PLAYBACK',_0x37d375));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x168')]=function(_0x12d4fb){logger[_0x0c5c('0x2f')](util['format'](_0x0c5c('0x169'),_0x12d4fb[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x12d4fb['queue_id'])){return this['channel'][_0x0c5c('0x54')](_0x12d4fb,_0x0c5c('0x16a'));}var _0x1a8fba='';var _0x171612=parseInt(_0x12d4fb['queue_id'],0xa);if(isNaN(_0x171612)){_0x1a8fba=_0x12d4fb['queue_id'];}else{_0x1a8fba=this[_0x0c5c('0x15')][_0x0c5c('0x71')](this,_0x12d4fb[_0x0c5c('0x16b')]);if(!_0x1a8fba){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x12d4fb,_0x0c5c('0x16c'));}}var _0x5037e6='';if(this[_0x0c5c('0xa5')](_0x12d4fb['file_id'])){var _0x4cab57=this[_0x0c5c('0x20')][_0x0c5c('0x71')](this,_0x12d4fb[_0x0c5c('0x161')]);if(_0x4cab57){_0x5037e6=_0x4cab57;}}this['createSquareDetailsReport'][_0x0c5c('0x71')](this,_0x12d4fb,_0x1a8fba);if(_0x12d4fb[_0x0c5c('0xde')][_0x0c5c('0x16d')]('x')<0x0){_0x12d4fb['opts']+='x';}if(_0x12d4fb[_0x0c5c('0xde')][_0x0c5c('0x16d')]('X')<0x0){_0x12d4fb[_0x0c5c('0xde')]+='X';}this[_0x0c5c('0xe')][_0x0c5c('0x9f')](_0x0c5c('0x16e'),_0x1a8fba?_0x1a8fba[_0x0c5c('0x16f')]():'');var _0x3dd54=this[_0x0c5c('0xe')]['exec'](_0x0c5c('0x170'),[_0x1a8fba,_0x12d4fb[_0x0c5c('0xde')],_0x12d4fb['url'],_0x5037e6,_0x12d4fb['timeout'],_0x12d4fb['agi'],_0x12d4fb[_0x0c5c('0x171')],_0x12d4fb[_0x0c5c('0x172')],'',_0x12d4fb['position']]);if(_0x3dd54['result']===-0x1){return _0x3dd54;}return this['channel'][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0xc2'),_0x0c5c('0x170'),_0x1a8fba));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x173')]=function(_0x515c66){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x515c66[_0x0c5c('0x39')]));var _0x500573=_0x515c66[_0x0c5c('0x174')]||_0x0c5c('0x12d');var _0x13c830=util[_0x0c5c('0x29')](_0x0c5c('0x175'),this['channel'][_0x0c5c('0x38')],rs[_0x0c5c('0x114')](0x5));var _0x3ea20c=util[_0x0c5c('0x29')](_0x0c5c('0x176'),FILES_PATH,_0x13c830,_0x500573);var _0x31a502=util['format'](_0x0c5c('0x12e'),FILES_PATH,_0x13c830);this[_0x0c5c('0x3b')]['sync'](this,_0x515c66,_0x13c830,_0x3ea20c);this[_0x0c5c('0xe')]['setVariable'](_0x0c5c('0x177'),_0x13c830);logger[_0x0c5c('0x2f')](_0x0c5c('0x178'),_0x31a502,_0x500573,_0x515c66['escape_digits'],_0x515c66[_0x0c5c('0x68')]);return this[_0x0c5c('0xe')][_0x0c5c('0x130')](_0x31a502,_0x500573,_0x515c66[_0x0c5c('0x179')],_0x515c66[_0x0c5c('0x68')],undefined,!![]);};AGIVertices['prototype'][_0x0c5c('0x17a')]=function(_0x595a83){logger['info'](util[_0x0c5c('0x29')](_0x0c5c('0x17b'),_0x595a83[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x595a83[_0x0c5c('0x109')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')]('no\x20url\x20configured');}var _0x41f099=this[_0x0c5c('0x66')][_0x0c5c('0x71')](this,_0x595a83);logger[_0x0c5c('0x2f')](util['format']('Response:',util[_0x0c5c('0x17c')](_0x41f099,{'showHidden':![],'depth':null})));if(!this[_0x0c5c('0xa5')](_0x595a83[_0x0c5c('0xd5')])){return this['channel'][_0x0c5c('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x2aec70=this[_0x0c5c('0x11')][_0x0c5c('0x71')](this,_0x595a83[_0x0c5c('0xd5')]);if(!_0x2aec70){return this[_0x0c5c('0xe')]['error'](_0x595a83,_0x0c5c('0x112'));}this[_0x0c5c('0xe')][_0x0c5c('0x9f')](util[_0x0c5c('0x29')](_0x0c5c('0x17d'),_0x2aec70),_0x41f099['statusCode']?_0x41f099['statusCode']:_0x0c5c('0x17e'));this[_0x0c5c('0xe')][_0x0c5c('0x9f')](util['format']('%s_STATUS_MESSAGE',_0x2aec70),_0x41f099[_0x0c5c('0x77')]?_0x41f099['statusMessage']:'OK');if(_0x41f099[_0x0c5c('0x75')]){try{this[_0x0c5c('0x9d')](_0x41f099[_0x0c5c('0x75')],_0x2aec70);}catch(_0x24ef72){logger['error'](util[_0x0c5c('0x29')](_0x0c5c('0x17f'),_0x2aec70));}}return this['channel']['noop'](util[_0x0c5c('0x29')](_0x0c5c('0xd7'),_0x2aec70));};AGIVertices[_0x0c5c('0x10')]['saydigits']=function(_0x3577f6){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x180'),_0x3577f6[_0x0c5c('0x39')]));return this[_0x0c5c('0xe')][_0x0c5c('0x181')](_0x3577f6[_0x0c5c('0x182')][_0x0c5c('0x5c')](/\s+/g,''),_0x3577f6[_0x0c5c('0x179')]);};AGIVertices['prototype']['saynumber']=function(_0x502824){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x183'),_0x502824[_0x0c5c('0x39')]));return this['channel'][_0x0c5c('0x184')](_0x502824[_0x0c5c('0x185')][_0x0c5c('0x5c')](/\s+/g,''),_0x502824['escape_digits']);};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x186')]=function(_0x310d46){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x187'),_0x310d46[_0x0c5c('0x39')]));return this[_0x0c5c('0xe')]['sayPhonetic'](_0x310d46[_0x0c5c('0x60')],_0x310d46[_0x0c5c('0x179')]);};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x188')]=function(_0x1082e5){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x189'),_0x1082e5[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x1082e5[_0x0c5c('0x18a')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0x18b'));}var _0x2118a1=this['getMailAccount']['sync'](this,_0x1082e5['account_id']);if(!_0x2118a1||!_0x2118a1[_0x0c5c('0x18c')]){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x1082e5,_0x0c5c('0x18d'));}var _0x16fc5e={'from':util[_0x0c5c('0x29')](_0x0c5c('0x18e'),_0x2118a1[_0x0c5c('0x13')],_0x2118a1[_0x0c5c('0x18f')]||_0x2118a1['Smtp']['user']),'to':_0x1082e5['to']||'','cc':_0x1082e5['cc']||'','bcc':_0x1082e5['bcc']||'','subject':_0x1082e5[_0x0c5c('0x190')],'html':_0x1082e5[_0x0c5c('0x60')],'text':_0x1082e5['text']};if(this['isConfigured'](_0x1082e5[_0x0c5c('0x191')])){}logger[_0x0c5c('0x192')]('sendMail\x20message',JSON[_0x0c5c('0x74')](_0x16fc5e));this[_0x0c5c('0x37')][_0x0c5c('0x71')](this,_0x1082e5,_0x1082e5[_0x0c5c('0x18a')]);this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0x193'),_0x2118a1[_0x0c5c('0x13')]));this[_0x0c5c('0x25')]['sync'](this,_0x2118a1[_0x0c5c('0x194')],_0x16fc5e);return this['channel'][_0x0c5c('0xaa')](_0x0c5c('0x195'));};AGIVertices[_0x0c5c('0x10')]['sendFax']=function(_0x568569){logger[_0x0c5c('0x2f')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x568569[_0x0c5c('0x39')]));return this[_0x0c5c('0xe')][_0x0c5c('0xaa')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x196')]=function(_0x4c78e2){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x197'),_0x4c78e2['label']));if(!this[_0x0c5c('0xa5')](_0x4c78e2['sms_account_id'])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')]('no\x20sms\x20account\x20configured');}var _0x2ab1d4=this[_0x0c5c('0x34')][_0x0c5c('0x71')](this,_0x4c78e2['sms_account_id']);if(!_0x2ab1d4){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x4c78e2,_0x0c5c('0x198'));}var _0x21b27e={'body':_0x4c78e2[_0x0c5c('0x199')],'phone':_0x4c78e2['to']||'','SmsAccountId':_0x2ab1d4['id']};logger[_0x0c5c('0x192')](_0x0c5c('0x19a'),JSON[_0x0c5c('0x74')](_0x21b27e));this['createSquareDetailsReport'][_0x0c5c('0x71')](this,_0x4c78e2,_0x4c78e2[_0x0c5c('0x19b')]);this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0x19c'),_0x2ab1d4[_0x0c5c('0x13')]));this[_0x0c5c('0x36')]['sync'](this,_0x21b27e);return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0x19d'));};AGIVertices['prototype'][_0x0c5c('0x19e')]=function(_0x45af49){logger[_0x0c5c('0x2f')](util['format'](_0x0c5c('0x19f'),_0x45af49[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x45af49[_0x0c5c('0xd5')])){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x45af49,_0x0c5c('0x1a0'));}var _0x2da7ab=this['getVariable'][_0x0c5c('0x71')](this,_0x45af49[_0x0c5c('0xd5')]);if(!_0x2da7ab){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x45af49,_0x0c5c('0x112'));}return this[_0x0c5c('0xe')][_0x0c5c('0x9f')](_0x2da7ab,_0x45af49[_0x0c5c('0x1a1')]);};AGIVertices['prototype']['start']=function(_0x10defc){logger[_0x0c5c('0x2f')](util['format'](_0x0c5c('0x1a2'),_0x10defc[_0x0c5c('0x39')]));this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0x1a3'));if(_0x10defc['answer']===_0x0c5c('0x1a4')){this['channel']['noop'](_0x0c5c('0x1a5'));return this[_0x0c5c('0xe')][_0x0c5c('0x1a6')]();}return this[_0x0c5c('0xe')]['noop']('Skipped\x20Answer');};AGIVertices[_0x0c5c('0x10')]['subproject']=function(_0x4d2b33){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x1a7'),_0x4d2b33[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x4d2b33[_0x0c5c('0x1a8')])){return this['channel']['error'](_0x4d2b33,_0x0c5c('0x1a9'));}var _0x44097e=this[_0x0c5c('0x1aa')][_0x0c5c('0x71')](this,_0x4d2b33[_0x0c5c('0x1a8')]);if(!this[_0x0c5c('0xa5')](_0x44097e)){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x4d2b33,util[_0x0c5c('0x29')](_0x0c5c('0x1ab'),_0x4d2b33[_0x0c5c('0x1a8')]));}if(_0x44097e===this[_0x0c5c('0xe')][_0x0c5c('0x40')]){return this['channel'][_0x0c5c('0x54')](_0x4d2b33,_0x0c5c('0x1ac'));}this[_0x0c5c('0x37')][_0x0c5c('0x71')](this,_0x4d2b33,_0x44097e);var _0x2c92ac=this[_0x0c5c('0xe')][_0x0c5c('0x5a')](_0x0c5c('0x1ad'),util[_0x0c5c('0x29')](_0x0c5c('0x1ae'),config[_0x0c5c('0x6')][_0x0c5c('0x1af')]||_0x0c5c('0x1b0'),_0x44097e,this['channel'][_0x0c5c('0x40')]));if(_0x2c92ac[_0x0c5c('0xa4')]===-0x1){return _0x2c92ac;}return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')]('Executed\x20command\x20%s\x20%s',_0x0c5c('0x1ad'),_0x44097e));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x1b1')]=function(_0x526a89){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x1b2'),_0x526a89[_0x0c5c('0x39')]));var _0x133291=this[_0x0c5c('0x59')][_0x0c5c('0x71')](this,_0x526a89[_0x0c5c('0xb8')]);this[_0x0c5c('0x37')][_0x0c5c('0x71')](this,_0x526a89,_0x526a89['command']);if(this[_0x0c5c('0xa5')](_0x526a89['variable_id'])){var _0x2f61c1=this[_0x0c5c('0x11')][_0x0c5c('0x71')](this,_0x526a89[_0x0c5c('0xd5')]);if(_0x2f61c1){this['channel'][_0x0c5c('0x9f')](_0x2f61c1,_0x133291);return this['channel']['noop'](util['format'](_0x0c5c('0x1b3'),_0x526a89[_0x0c5c('0xb8')],_0x2f61c1));}}return this['channel'][_0x0c5c('0xaa')](util[_0x0c5c('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x526a89[_0x0c5c('0xb8')]));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x1b4')]=function(_0x583515){logger['info'](util[_0x0c5c('0x29')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x583515[_0x0c5c('0x39')]));_0x583515[_0x0c5c('0x60')]=_0x583515[_0x0c5c('0x60')][_0x0c5c('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0c5c('0xa5')](_0x583515[_0x0c5c('0x5e')])){return this[_0x0c5c('0xe')]['noop'](_0x0c5c('0x1b5'));}if(!this[_0x0c5c('0xa5')](_0x583515[_0x0c5c('0x60')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0xab'));}this[_0x0c5c('0xe')]['noop'](util[_0x0c5c('0x29')](_0x0c5c('0x1b6'),_0x583515[_0x0c5c('0x60')]));var _0x2df63f=this[_0x0c5c('0x5d')][_0x0c5c('0x71')](this,_0x583515);if(_0x2df63f){this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0x1b7'),_0x2df63f));var _0x364c67=this[_0x0c5c('0xe')][_0x0c5c('0xfc')](_0x2df63f);try{fs[_0x0c5c('0xfd')](_0x2df63f+_0x0c5c('0xfe'));}catch(_0x3d2c70){logger[_0x0c5c('0x54')](_0x3d2c70);}return _0x364c67;}return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x583515,_0x0c5c('0x1b8'));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x1b9')]=function(_0x51e5cd){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x1ba'),_0x51e5cd[_0x0c5c('0x39')]));_0x51e5cd['text']=_0x51e5cd['text'][_0x0c5c('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x51e5cd[_0x0c5c('0x60')])){return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](_0x0c5c('0xab'));}this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util[_0x0c5c('0x29')](_0x0c5c('0x1bb'),_0x51e5cd[_0x0c5c('0x60')]));var _0x5427a2=this[_0x0c5c('0x65')][_0x0c5c('0x71')](this,_0x51e5cd);if(_0x5427a2){this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util['format'](_0x0c5c('0x1bc'),_0x5427a2));var _0x418943=this[_0x0c5c('0xe')][_0x0c5c('0xfc')](_0x5427a2);try{fs[_0x0c5c('0xfd')](_0x5427a2+_0x0c5c('0xfe'));}catch(_0x1d134a){logger[_0x0c5c('0x54')](_0x1d134a);}return _0x418943;}return this[_0x0c5c('0xe')]['error'](_0x51e5cd,_0x0c5c('0x1bd'));};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x1be')]=function(_0x1179c4){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x1bf'),_0x1179c4[_0x0c5c('0x39')]));if(!this[_0x0c5c('0xa5')](_0x1179c4[_0x0c5c('0x155')])){return this[_0x0c5c('0xe')]['error'](_0x1179c4,_0x0c5c('0x164'));}logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')](_0x0c5c('0x15a'),this[_0x0c5c('0xe')][_0x0c5c('0x3c')],_0x1179c4['findBy']));var _0x330906=this[_0x0c5c('0x53')][_0x0c5c('0x71')](this,_0x1179c4[_0x0c5c('0x155')]);if(_0x330906){logger['info'](util[_0x0c5c('0x29')](_0x0c5c('0x156'),this['channel'][_0x0c5c('0x3c')],_0x1179c4[_0x0c5c('0x155')]));this[_0x0c5c('0xe')]['noop'](util[_0x0c5c('0x29')](_0x0c5c('0x156'),this[_0x0c5c('0xe')][_0x0c5c('0x3c')],_0x1179c4[_0x0c5c('0x155')]));return{'code':0xc8,'result':_0x0c5c('0x15b')};}else{logger[_0x0c5c('0x2f')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0c5c('0xe')]['callerid'],_0x1179c4['findBy']));this[_0x0c5c('0xe')]['noop'](util[_0x0c5c('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0c5c('0xe')][_0x0c5c('0x3c')],_0x1179c4[_0x0c5c('0x155')]));return{'code':0xc8,'result':_0x0c5c('0x158')};}};AGIVertices[_0x0c5c('0x10')][_0x0c5c('0x1c0')]=function(_0x3f930a){logger[_0x0c5c('0x2f')](util['format'](_0x0c5c('0x1c1'),_0x3f930a['label']));var _0x242e45=this[_0x0c5c('0xe')][_0x0c5c('0x5a')]('VOICEMAIL',[_0x3f930a[_0x0c5c('0x1c2')],_0x3f930a[_0x0c5c('0x79')]]);if(_0x242e45[_0x0c5c('0xa4')]===-0x1){return _0x242e45;}return this[_0x0c5c('0xe')][_0x0c5c('0xaa')](util['format'](_0x0c5c('0xc2'),_0x0c5c('0x1c3'),_0x3f930a[_0x0c5c('0x1c2')]));};AGIVertices['prototype']['vswitch']=function(_0x531da4){logger[_0x0c5c('0x2f')](util[_0x0c5c('0x29')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x531da4['label']));if(!this[_0x0c5c('0xa5')](_0x531da4[_0x0c5c('0xd5')])){return this[_0x0c5c('0xe')][_0x0c5c('0x54')](_0x531da4,_0x0c5c('0x1a0'));}var _0x3e255f=this['getVariable']['sync'](this,_0x531da4[_0x0c5c('0xd5')]);if(!_0x3e255f){return this['channel'][_0x0c5c('0x54')](_0x531da4,_0x0c5c('0x112'));}var _0x4eadfb=this[_0x0c5c('0xe')][_0x0c5c('0x11')](_0x3e255f);return{'code':0xc8,'result':_0x4eadfb[_0x0c5c('0xa2')]?_0x4eadfb[_0x0c5c('0xa2')]:'-'};};String[_0x0c5c('0x10')][_0x0c5c('0xa1')]=function(_0x4cc54f,_0x213463){return this[_0x0c5c('0xa0')](_0x4cc54f)[_0x0c5c('0x1c4')](_0x213463);};module[_0x0c5c('0x1c5')]=AGIVertices;
\ No newline at end of file
+var _0x6b20=['no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','DIALOGFLOW_%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','false','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','beep','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','success','math','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','recordFile','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','email','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','agentUnpause','voicemail','VOICEMAIL','mailbox','vswitch','util','lodash','odbc','moment','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','rpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','getPause','agentPause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','ssmlGender','audioEncoding','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','en-US','model','awsPolly','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_secret_access_key','aws_lex_region','googleASR','tildeASR','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','setVariable','stringify','split','replaceAll','extra','getAndSetVariable','result','info','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','sync','retry','mrcpsynth','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_INPUT()','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id'];(function(_0x442e81,_0x582bfd){var _0x257603=function(_0x298f22){while(--_0x298f22){_0x442e81['push'](_0x442e81['shift']());}};_0x257603(++_0x582bfd);}(_0x6b20,0xd1));var _0x06b2=function(_0x173c28,_0x9cd0e){_0x173c28=_0x173c28-0x0;var _0x28e311=_0x6b20[_0x173c28];return _0x28e311;};'use strict';var fs=require('fs');var util=require(_0x06b2('0x0'));var _=require(_0x06b2('0x1'));var sh=require('shelljs');var odbc=require(_0x06b2('0x2'))();var rs=require('randomstring');var moment=require(_0x06b2('0x3'));var Mustache=require(_0x06b2('0x4'));var rp=require(_0x06b2('0x5'));var logger=require('../../config/logger')(_0x06b2('0x6'));var config=require(_0x06b2('0x7'));var shared=require(_0x06b2('0x8'));var scripts=require(_0x06b2('0x9'));var FILES_PATH=_0x06b2('0xa');var recursiveMapAttributes=[_0x06b2('0xb'),_0x06b2('0xc')];var verticesWithRetry=['menu',_0x06b2('0xd'),_0x06b2('0xe')];var AGIVertices=function(_0x315223,_0x58538a,_0x37ace0){this['channel']=_0x315223;this[_0x06b2('0xf')]=_0x58538a;this['mailRpc']=_0x37ace0;};AGIVertices['prototype'][_0x06b2('0x10')]=function(_0x255cc5,_0x59fc97){this[_0x06b2('0xf')][_0x06b2('0x11')](_0x255cc5)[_0x06b2('0x12')](function(_0x368889){_0x59fc97(null,_0x368889?_0x368889[_0x06b2('0x13')]:![]);})[_0x06b2('0x14')](function(_0x3039c9){_0x59fc97(_0x3039c9);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x16')]=function(_0x28f9f3,_0xa81f11){this[_0x06b2('0xf')][_0x06b2('0x17')](_0x28f9f3)['then'](function(_0x325cde){_0xa81f11(null,_0x325cde?_0x325cde[_0x06b2('0x13')]:![]);})[_0x06b2('0x14')](function(_0x3830e9){_0xa81f11(_0x3830e9);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x18')]=function(_0x4b148c,_0x17e69b){this[_0x06b2('0xf')]['getSquareProjectById'](_0x4b148c)[_0x06b2('0x12')](function(_0x594b48){_0x17e69b(null,_0x594b48?_0x594b48['name']:![]);})[_0x06b2('0x14')](function(_0x1b4ab0){_0x17e69b(_0x1b4ab0);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x19')]=function(_0x4c4e21,_0x288801){this[_0x06b2('0xf')][_0x06b2('0x1a')](_0x4c4e21)[_0x06b2('0x12')](function(_0xe28985){_0x288801(null,_0xe28985?_0xe28985[_0x06b2('0x1b')]:![]);})[_0x06b2('0x14')](function(_0x5ca622){_0x288801(_0x5ca622);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x1c')]=function(_0xb05f65,_0x208384){this['rpc']['getUserById'](_0xb05f65)[_0x06b2('0x12')](function(_0xb5231e){_0x208384(null,_0xb5231e?_0xb5231e['name']:![]);})[_0x06b2('0x14')](function(_0x5e40f2){_0x208384(_0x5e40f2);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x1d')]=function(_0x2a0645,_0x593d3a){this[_0x06b2('0xf')][_0x06b2('0x1e')](_0x2a0645)[_0x06b2('0x12')](function(_0x1a94dc){_0x593d3a(null,_0x1a94dc?_0x1a94dc[_0x06b2('0x13')]:![]);})['catch'](function(_0xbb00ea){_0x593d3a(_0xbb00ea);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x1f')]=function(_0x1a99c1,_0x1976ac){var _0x3e7cd4=this;this['rpc'][_0x06b2('0x20')](_0x1a99c1)[_0x06b2('0x12')](function(_0x2720fa){_0x1976ac(null,_0x2720fa?_0x3e7cd4[_0x06b2('0x21')](_0x2720fa[_0x06b2('0x22')]):![]);})[_0x06b2('0x14')](function(_0x3668bb){_0x1976ac(_0x3668bb);});};AGIVertices['prototype'][_0x06b2('0x23')]=function(_0x32eeea,_0x1637c2){this[_0x06b2('0xf')][_0x06b2('0x24')](_0x32eeea)[_0x06b2('0x12')](function(_0x401551){_0x1637c2(null,_0x401551?_0x401551:![]);})[_0x06b2('0x14')](function(_0x56d03e){_0x1637c2(_0x56d03e);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x25')]=function(_0x259e3d,_0x438c16,_0x7a7cd7){this[_0x06b2('0x26')][_0x06b2('0x25')](_0x259e3d,_0x438c16)['then'](function(){_0x7a7cd7(null);})['catch'](function(_0x9fd6ef){_0x7a7cd7(_0x9fd6ef);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x27')]=function(_0x47c930,_0x37c798){this[_0x06b2('0xf')][_0x06b2('0x28')](_0x47c930)[_0x06b2('0x12')](function(_0x29ff9d){if(_0x29ff9d){if(_0x29ff9d[_0x06b2('0x29')]){_0x37c798(null,[_0x29ff9d['interval']]);}else{_0x37c798(null,_[_0x06b2('0x2a')](_0x29ff9d[_0x06b2('0x2b')],_0x06b2('0x2c')));}}else{_0x37c798(null,![]);}})['catch'](function(_0x268780){_0x37c798(_0x268780);});};AGIVertices[_0x06b2('0x15')]['getSoundPath']=function(_0x45ea67){return util[_0x06b2('0x2d')](_0x06b2('0x2e'),FILES_PATH,_0x45ea67);};AGIVertices[_0x06b2('0x15')][_0x06b2('0x2f')]=function(_0x3e245e,_0x37b53c,_0x282424){odbc[_0x06b2('0x30')](_0x3e245e,function(_0x3c5b68){if(_0x3c5b68){logger[_0x06b2('0x31')](_0x06b2('0x32'),_0x3c5b68);_0x282424(_0x3c5b68);}else{logger['info'](_0x06b2('0x33'));odbc['query'](_0x37b53c,function(_0x4a4146,_0x44b967){if(_0x4a4146){logger['info'](_0x06b2('0x34'),_0x37b53c);_0x282424(_0x4a4146);}else{logger['info'](_0x06b2('0x35'),_0x37b53c);odbc[_0x06b2('0x36')](function(_0x16182c){if(_0x16182c){logger[_0x06b2('0x31')](_0x06b2('0x37'),_0x16182c);}_0x282424(null,_0x44b967);});}});}});};AGIVertices['prototype'][_0x06b2('0x38')]=function(_0xee3ec6,_0x4d5ebd){this[_0x06b2('0xf')][_0x06b2('0x39')](_0xee3ec6)[_0x06b2('0x12')](function(_0x5f2549){_0x4d5ebd(null,_0x5f2549?_0x5f2549:![]);})[_0x06b2('0x14')](function(_0x41e74e){_0x4d5ebd(_0x41e74e);});};AGIVertices['prototype']['createSmsMessage']=function(_0xe60af8,_0x251338){this[_0x06b2('0xf')][_0x06b2('0x3a')](_0xe60af8)[_0x06b2('0x12')](function(_0x1d174d){_0x251338(null,_0x1d174d);})[_0x06b2('0x14')](function(_0x2ff968){_0x251338(_0x2ff968);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x3b')]=function(_0x1d7750,_0xf9b9e,_0x3af451){this[_0x06b2('0xf')][_0x06b2('0x3b')]({'uniqueid':this[_0x06b2('0x3c')][_0x06b2('0x3d')],'node':_0x1d7750[_0x06b2('0x3e')],'application':_0x1d7750[_0x06b2('0x3f')],'data':_0xf9b9e||null,'project_name':this['channel'][_0x06b2('0x40')],'callerid':this[_0x06b2('0x3c')][_0x06b2('0x41')]})[_0x06b2('0x12')](function(_0x49cd88){if(_0x3af451){_0x3af451(null,_0x49cd88);}})[_0x06b2('0x14')](function(_0x3eaf58){if(_0x3af451){_0x3af451(_0x3eaf58);}});};AGIVertices['prototype'][_0x06b2('0x42')]=function(_0x2e3a85,_0x4bfe6b,_0x3ad4ff,_0xf342f9){this['rpc']['createSquareRecording']({'uniqueid':this['channel'][_0x06b2('0x3d')],'callerid':this[_0x06b2('0x3c')][_0x06b2('0x41')],'calleridname':this[_0x06b2('0x3c')][_0x06b2('0x43')],'context':this['channel']['context'],'extension':this[_0x06b2('0x3c')][_0x06b2('0x44')],'priority':this[_0x06b2('0x3c')][_0x06b2('0x45')],'accountcode':this[_0x06b2('0x3c')][_0x06b2('0x46')],'dnid':this['channel'][_0x06b2('0x47')],'projectName':this[_0x06b2('0x3c')][_0x06b2('0x40')],'saveName':_0x4bfe6b,'filename':_0x2e3a85[_0x06b2('0x48')]||_0x4bfe6b,'savePath':_0x3ad4ff})[_0x06b2('0x12')](function(_0x36a74a){_0xf342f9(null,_0x36a74a);})['catch'](function(_0x2cbdae){_0xf342f9(_0x2cbdae);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x49')]=function(_0x46920d,_0x487341,_0x281acc,_0x17d138,_0x463745){this[_0x06b2('0xf')]['createSquareMessage']({'uniqueid':this[_0x06b2('0x3c')][_0x06b2('0x3d')],'body':_0x46920d,'direction':_0x487341,'providerName':_0x281acc,'providerResponse':_0x17d138})[_0x06b2('0x12')](function(_0x26478c){if(_0x463745){_0x463745(null,_0x26478c);}})[_0x06b2('0x14')](function(_0x37c9cd){if(_0x463745){_0x463745(_0x37c9cd);}});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x4a')]=function(_0x568091,_0x33bc8e){this[_0x06b2('0xf')][_0x06b2('0x4a')]({'firstName':_[_0x06b2('0x4b')](_0x568091[_0x06b2('0x13')])||_[_0x06b2('0x4c')](_0x568091['name'])?'callback_'+Math[_0x06b2('0x4d')]():_0x568091['name'],'lastName':_['isEmpty'](_0x568091[_0x06b2('0x4e')])||_['isNil'](_0x568091[_0x06b2('0x4e')])?null:_0x568091[_0x06b2('0x4e')],'phone':_0x568091[_0x06b2('0x4f')],'ListId':_0x568091[_0x06b2('0x50')],'scheduledat':_0x568091[_0x06b2('0x51')],'callbackUniqueid':this[_0x06b2('0x3c')][_0x06b2('0x3d')],'tags':_0x06b2('0x52'),'description':_0x06b2('0x53')+_0x568091[_0x06b2('0x51')]['toString'](),'priority':_0x568091['callback_priority']})[_0x06b2('0x12')](function(_0x46e4b9){_0x33bc8e(null,_0x46e4b9);})['catch'](function(_0x425dea){_0x33bc8e(_0x425dea);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x54')]=function(_0x36f2a8,_0x5d725f){this['rpc']['getPauseById'](_0x36f2a8)[_0x06b2('0x12')](function(_0x594dbe){_0x5d725f(null,_0x594dbe?_0x594dbe['name']:![]);})[_0x06b2('0x14')](function(_0x30b773){_0x5d725f(_0x30b773);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x55')]=function(_0x2b2de5,_0x388d8b,_0x513650){var _0x119096={'role':_0x06b2('0x56')};_0x119096[_0x2b2de5]=this['channel'][_0x06b2('0x41')];this[_0x06b2('0xf')][_0x06b2('0x55')](_0x119096,_0x388d8b,this[_0x06b2('0x3c')][_0x06b2('0x3d')])[_0x06b2('0x12')](function(_0x285faf){_0x513650(null,_[_0x06b2('0x4c')](_0x285faf)?![]:!![]);})[_0x06b2('0x14')](function(_0x33dd97){logger[_0x06b2('0x31')](_0x33dd97);_0x513650(null,![]);});};AGIVertices[_0x06b2('0x15')]['agentUnpause']=function(_0x3bde5d,_0x188dcc){var _0x514472={'role':_0x06b2('0x56')};_0x514472[_0x3bde5d]=this[_0x06b2('0x3c')][_0x06b2('0x41')];this[_0x06b2('0xf')]['agentUnpause'](_0x514472)[_0x06b2('0x12')](function(_0x3ae0dd){_0x188dcc(null,_[_0x06b2('0x4c')](_0x3ae0dd)?![]:!![]);})['catch'](function(_0x2e376f){logger[_0x06b2('0x31')](_0x2e376f);_0x188dcc(null,![]);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x57')]=function(_0x3a895d,_0x43b907){var _0x1aae55={'role':_0x06b2('0x56')};_0x1aae55[_0x3a895d]=this[_0x06b2('0x3c')]['callerid'];this['rpc']['agentLogout'](_0x1aae55)['then'](function(_0x41a4b8){_0x43b907(null,_['isNil'](_0x41a4b8)?![]:!![]);})[_0x06b2('0x14')](function(_0x3f3f5e){logger[_0x06b2('0x31')](_0x3f3f5e);_0x43b907(null,![]);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x58')]=function(_0x378547,_0x5cd18d){var _0x57e00d={'role':_0x06b2('0x56')};_0x57e00d[_0x378547]=this[_0x06b2('0x3c')]['callerid'];var _0x8a3745=_0x378547!=_0x06b2('0x59')?util[_0x06b2('0x2d')](_0x06b2('0x5a'),_0x06b2('0x5b'),this[_0x06b2('0x3c')]['callerid']):undefined;this[_0x06b2('0xf')]['agentLogin'](_0x57e00d,_0x8a3745)[_0x06b2('0x12')](function(_0x3874da){_0x5cd18d(null,_[_0x06b2('0x4c')](_0x3874da)?![]:!![]);})['catch'](function(_0x2a5e58){logger[_0x06b2('0x31')](_0x2a5e58);_0x5cd18d(null,![]);});};AGIVertices[_0x06b2('0x15')]['shellCommand']=function(_0xc1010,_0x4900d2){sh[_0x06b2('0x5c')](_[_0x06b2('0x5d')](_0xc1010),function(_0x215b25,_0x2957db){var _0x2761a6=_0x2957db[_0x06b2('0x5e')](/(\r\n|\n|\r)/gm,'');_0x4900d2(null,_0x2761a6);});};AGIVertices['prototype'][_0x06b2('0x5f')]=function(_0x711305,_0x8c916e){scripts[_0x06b2('0x5f')](_0x711305['apiKey'],_0x711305[_0x06b2('0x60')]||_0x06b2('0x61'),_0x711305[_0x06b2('0x61')],_0x711305['languageCode']||'en-US',_0x711305[_0x06b2('0x62')]||'MALE',_0x711305[_0x06b2('0x63')]||'MP3')['then'](function(_0x691547){_0x8c916e(null,_0x691547);})[_0x06b2('0x14')](function(_0x4b17d8){_0x8c916e(_0x4b17d8);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x64')]=function(_0x206d66,_0x305c36){scripts[_0x06b2('0x64')](_0x206d66[_0x06b2('0x61')],_0x206d66[_0x06b2('0x65')]||'en',0x1)[_0x06b2('0x12')](function(_0x3018c7){_0x305c36(null,_0x3018c7);})[_0x06b2('0x14')](function(_0x2b16a4){_0x305c36(_0x2b16a4);});};AGIVertices['prototype'][_0x06b2('0x66')]=function(_0x4be314,_0x4a606b){var _0x3257b9={'uri':_0x4be314[_0x06b2('0x67')],'method':_0x4be314['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4be314[_0x06b2('0x68')])===_0x06b2('0x69')&&parseInt(_0x4be314[_0x06b2('0x68')])>=0x1?parseInt(_0x4be314['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x06b2('0x6a')]([_0x06b2('0x6b'),'PUT'],_0x3257b9['method']['toUpperCase']())){try{_0x3257b9['body']=_0x4be314[_0x06b2('0xc')]?JSON['parse'](_0x4be314[_0x06b2('0xc')]):{};}catch(_0x41e050){logger[_0x06b2('0x31')](_0x06b2('0x6c'),_0x41e050);}}try{_0x3257b9[_0x06b2('0x6d')]=_0x4be314[_0x06b2('0xb')]?JSON[_0x06b2('0x6e')](_0x4be314[_0x06b2('0xb')]):{};}catch(_0x12b682){logger[_0x06b2('0x31')](_0x06b2('0x6f'),_0x12b682);}if(_0x4be314[_0x06b2('0x70')]){try{var _0x2c2552=require(_0x4be314['computedVariables'])['sync'](this,_0x3257b9);_0x3257b9[_0x06b2('0x71')]=Mustache[_0x06b2('0x72')](_0x4be314[_0x06b2('0x67')],_0x2c2552,{},['$$','$$']);if(_0x3257b9[_0x06b2('0x6d')]){_0x3257b9[_0x06b2('0x6d')]=JSON[_0x06b2('0x6e')](Mustache['render'](JSON['stringify'](_0x3257b9[_0x06b2('0x6d')]),_0x2c2552,{},['$$','$$']));}if(_0x3257b9[_0x06b2('0x73')]){_0x3257b9[_0x06b2('0x73')]=JSON[_0x06b2('0x6e')](Mustache[_0x06b2('0x72')](JSON['stringify'](_0x3257b9[_0x06b2('0x73')]),_0x2c2552,{},['$$','$$']));}}catch(_0x5569e7){logger['error'](_0x06b2('0x74'),_0x5569e7);}}rp(_0x3257b9)[_0x06b2('0x12')](function(_0x52393b){var _0x5a047c={'statusCode':_0x52393b[_0x06b2('0x75')]||0xc8,'statusMessage':_0x52393b[_0x06b2('0x76')]||'OK','headers':_0x52393b['headers']||{},'body':_0x52393b['body']||{}};_0x4a606b(null,_0x5a047c);})['catch'](function(_0x512415){var _0x3913cb={'statusCode':_0x512415[_0x06b2('0x75')]||0x1f4,'statusMessage':_0x512415[_0x06b2('0x77')]||_0x06b2('0x78'),'headers':_0x512415[_0x06b2('0x79')][_0x06b2('0x6d')]||{},'body':_0x512415[_0x06b2('0x79')][_0x06b2('0x73')]||{}};_0x4a606b(null,_0x3913cb);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x7a')]=function(_0x15eb9a,_0x103ee5){scripts[_0x06b2('0x7a')](this[_0x06b2('0x3c')][_0x06b2('0x3d')],_0x15eb9a[_0x06b2('0x7b')],_0x15eb9a[_0x06b2('0x61')],_0x15eb9a[_0x06b2('0x7c')]||'en')[_0x06b2('0x12')](function(_0x3c74ef){_0x103ee5(null,_0x3c74ef);})[_0x06b2('0x14')](function(_0x7ddad4){_0x103ee5(_0x7ddad4);});};AGIVertices['prototype'][_0x06b2('0x7d')]=function(_0x41734d,_0xe302e0){scripts[_0x06b2('0x7d')](this[_0x06b2('0x3c')][_0x06b2('0x3d')],_0x41734d['dialogflowV2_project_id'],_0x41734d[_0x06b2('0x7e')],_0x41734d[_0x06b2('0x7f')],_0x41734d[_0x06b2('0x61')],_0x41734d[_0x06b2('0x80')]||'en')['then'](function(_0x13d0b9){_0xe302e0(null,_0x13d0b9);})[_0x06b2('0x14')](function(_0x5af6c5){_0xe302e0(_0x5af6c5);});};AGIVertices['prototype'][_0x06b2('0x81')]=function(_0x6be0ff,_0x243c9f){scripts[_0x06b2('0x81')](this[_0x06b2('0x3c')],_0x6be0ff)[_0x06b2('0x12')](function(_0x1f5ad9){_0x243c9f(null,_0x1f5ad9);})['catch'](function(_0x1eff66){_0x243c9f(_0x1eff66);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x82')]=function(_0x4a120c,_0x2e7003){scripts[_0x06b2('0x82')](_0x4a120c['key'],_0x4a120c[_0x06b2('0x61')],_0x4a120c[_0x06b2('0x83')]||'en-US',_0x4a120c[_0x06b2('0x84')])['then'](function(_0x38b058){_0x2e7003(null,_0x38b058);})[_0x06b2('0x14')](function(_0x59edd3){_0x2e7003(_0x59edd3);});};AGIVertices[_0x06b2('0x15')]['ispeechASR']=function(_0x3c1890,_0x26c08d,_0x59acb9){scripts[_0x06b2('0x85')](_0x26c08d,_0x3c1890[_0x06b2('0x7b')],_0x3c1890['ispeech_asr_language']||_0x06b2('0x86'),this['isConfigured'](_0x3c1890[_0x06b2('0x87')])?_0x3c1890[_0x06b2('0x87')]:undefined)['then'](function(_0x50886d){_0x59acb9(null,_0x50886d);})[_0x06b2('0x14')](function(_0x35c66e){_0x59acb9(_0x35c66e);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x88')]=function(_0x277814,_0x3ef258){scripts[_0x06b2('0x88')](_0x277814['aws_access_key_id'],_0x277814['aws_secret_access_key'],_0x277814[_0x06b2('0x89')],_0x277814[_0x06b2('0x8a')]||_0x06b2('0x8b'),_0x277814['text'],_0x277814['aws_text_type']||_0x06b2('0x61'))[_0x06b2('0x12')](function(_0x2aabf7){_0x3ef258(null,_0x2aabf7);})[_0x06b2('0x14')](function(_0x4c6c39){_0x3ef258(_0x4c6c39);});};AGIVertices['prototype'][_0x06b2('0x8c')]=function(_0xea6166,_0x1e00c0){scripts[_0x06b2('0x8c')](this[_0x06b2('0x3c')][_0x06b2('0x3d')],_0xea6166['aws_access_key_id'],_0xea6166[_0x06b2('0x8d')],_0xea6166[_0x06b2('0x8e')],_0xea6166[_0x06b2('0x61')],_0xea6166['aws_bot_name'])[_0x06b2('0x12')](function(_0x2777d7){_0x1e00c0(null,_0x2777d7);})['catch'](function(_0x743ec1){_0x1e00c0(_0x743ec1);});};AGIVertices['prototype'][_0x06b2('0x8f')]=function(_0x56c84d,_0x100d79,_0x43505b){scripts['googleASR'](_0x100d79,_0x56c84d[_0x06b2('0x7b')],_0x56c84d['google_asr_language']||_0x06b2('0x86'))['then'](function(_0x3c606c){_0x43505b(null,_0x3c606c);})[_0x06b2('0x14')](function(_0x201269){_0x43505b(_0x201269);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x90')]=function(_0x2bc9b0,_0x35e547,_0x31c855){scripts['tildeASR'](_0x35e547,_0x2bc9b0['appid'],_0x2bc9b0[_0x06b2('0x91')],_0x2bc9b0[_0x06b2('0x71')])[_0x06b2('0x12')](function(_0x52a892){_0x31c855(null,_0x52a892);})[_0x06b2('0x14')](function(_0x267a6d){_0x31c855(_0x267a6d);});};AGIVertices[_0x06b2('0x15')][_0x06b2('0x92')]=function(_0x5073e0){var _0x4dd847=_[_0x06b2('0x6a')](verticesWithRetry,_0x5073e0[_0x06b2('0x3f')])?_0x5073e0:_['clone'](_0x5073e0);for(var _0x5bac61 in _0x4dd847){if(_0x4dd847[_0x06b2('0x93')](_0x5bac61)){if(_0x4dd847[_0x5bac61]&&_[_0x06b2('0x94')](_0x4dd847[_0x5bac61])){if(_[_0x06b2('0x6a')](recursiveMapAttributes,_0x5bac61)){_0x4dd847[_0x5bac61]=this[_0x06b2('0x95')](_0x4dd847[_0x5bac61]);}else{_0x4dd847[_0x5bac61]=this[_0x06b2('0x96')](_0x4dd847[_0x5bac61]);}}}}return _0x4dd847;};AGIVertices[_0x06b2('0x15')][_0x06b2('0x97')]=function(_0x4e4622){for(var _0x455adb in _0x4e4622){if(_0x4e4622['hasOwnProperty'](_0x455adb)){if(_[_0x06b2('0x98')](_0x4e4622[_0x455adb])){this[_0x06b2('0x97')](_0x4e4622[_0x455adb]);}else if(_[_0x06b2('0x99')](_0x4e4622[_0x455adb])){for(var _0x320c38=0x0;_0x320c38<_0x4e4622[_0x455adb]['length'];_0x320c38++){this[_0x06b2('0x97')](_0x4e4622[_0x455adb][_0x320c38]);}}else if(_['isString'](_0x4e4622[_0x455adb])){_0x4e4622[_0x455adb]=this[_0x06b2('0x96')](_0x4e4622[_0x455adb]);}}}};AGIVertices[_0x06b2('0x15')][_0x06b2('0x9a')]=function(_0x1c8c4f,_0x385196){for(var _0xcad64e in _0x1c8c4f){if(_0x1c8c4f[_0x06b2('0x93')](_0xcad64e)){if(_['isPlainObject'](_0x1c8c4f[_0xcad64e])){if(!_['isEmpty'](_0x1c8c4f[_0xcad64e])){this['saveRestApiResult'](_0x1c8c4f[_0xcad64e],util['format'](_0x06b2('0x9b'),_0x385196,_0xcad64e));}}else if(_['isArray'](_0x1c8c4f[_0xcad64e])){for(var _0x3ee328=0x0;_0x3ee328<_0x1c8c4f[_0xcad64e][_0x06b2('0x9c')];_0x3ee328++){this[_0x06b2('0x9a')](_0x1c8c4f[_0xcad64e][_0x3ee328],util[_0x06b2('0x2d')]('%s.%s',_0x385196,_0xcad64e+'['+_0x3ee328+']'));}}else{if(!_[_0x06b2('0x4c')](_0x1c8c4f[_0xcad64e])){this[_0x06b2('0x3c')][_0x06b2('0x9d')](util[_0x06b2('0x2d')]('%s.%s',_0x385196,_0xcad64e),_0x1c8c4f[_0xcad64e]);}}}}};AGIVertices['prototype'][_0x06b2('0x95')]=function(_0x311d95){try{var _0x4bd7a2=JSON[_0x06b2('0x6e')](_0x311d95);this[_0x06b2('0x97')](_0x4bd7a2);return JSON[_0x06b2('0x9e')](_0x4bd7a2);}catch(_0x4178e6){return this[_0x06b2('0x96')](_0x311d95);}};AGIVertices[_0x06b2('0x15')][_0x06b2('0x96')]=function(_0x217668){var _0x2d7a37=_0x217668[_0x06b2('0x9f')]('{');for(var _0x4b1465=0x1;_0x4b1465<_0x2d7a37[_0x06b2('0x9c')];_0x4b1465+=0x1){var _0x12a3ae=_0x2d7a37[_0x4b1465]['split']('}');if(_0x12a3ae[_0x06b2('0x9c')]>0x1){_0x217668=_0x217668[_0x06b2('0xa0')]('{'+_0x12a3ae[0x0]+'}',this[_0x06b2('0x3c')][_0x06b2('0x10')](_0x12a3ae[0x0])[_0x06b2('0xa1')]||_0x12a3ae[0x0]);}}if(_0x2d7a37[_0x06b2('0x9c')]===0x1){return _0x217668['toString']();}return this[_0x06b2('0x96')](_0x217668);};AGIVertices['prototype'][_0x06b2('0xa2')]=function(_0x4085f1,_0x50953d){var _0x19f03f=this['channel'][_0x06b2('0x10')](_0x4085f1);if(_0x19f03f[_0x06b2('0xa3')]===-0x1){return _0x19f03f;}logger[_0x06b2('0xa4')](util['format'](_0x06b2('0xa5'),_0x50953d,_0x19f03f['extra']));return this[_0x06b2('0x3c')]['setVariable'](_0x50953d,_0x19f03f[_0x06b2('0xa1')]);};AGIVertices['prototype'][_0x06b2('0xa6')]=function(_0x4b9062){return _0x4b9062&&_0x4b9062!=='0'&&_0x4b9062!=='-1'&&_0x4b9062!=='';};AGIVertices[_0x06b2('0x15')][_0x06b2('0xa7')]=function(_0x507e89){this[_0x06b2('0x3b')][_0x06b2('0xa8')](this,_0x507e89,'-');_0x507e89[_0x06b2('0xa9')]=_0x507e89[_0x06b2('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x06b2('0xaa')]=function(_0x464a9c){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x464a9c[_0x06b2('0x3e')]));if(!this['isConfigured'](_0x464a9c[_0x06b2('0x61')])){return this['channel']['noop'](_0x06b2('0xab'));}var _0x3cf76e='\x22'+_0x464a9c[_0x06b2('0x61')]+'\x22';if(this[_0x06b2('0xa6')](_0x464a9c['options'])){_0x3cf76e+=','+_0x464a9c[_0x06b2('0x79')];}var _0x163ace=this[_0x06b2('0x3c')][_0x06b2('0x5c')](_0x06b2('0xac'),_0x3cf76e);if(_0x163ace[_0x06b2('0xa3')]===-0x1){return _0x163ace;}return this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0xae'),_0x3cf76e));};AGIVertices[_0x06b2('0x15')][_0x06b2('0xaf')]=function(_0x2dbb95){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0xb0'),_0x2dbb95[_0x06b2('0x3e')]));if(!this[_0x06b2('0xa6')](_0x2dbb95[_0x06b2('0xb1')])){return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0xb2'));}var _0x5d200a=_0x2dbb95[_0x06b2('0xb1')];if(this[_0x06b2('0xa6')](_0x2dbb95[_0x06b2('0x79')])){_0x5d200a+=','+_0x2dbb95[_0x06b2('0x79')];}var _0xb719a0=this[_0x06b2('0x3c')]['exec'](_0x06b2('0xb3'),_0x5d200a);if(_0xb719a0[_0x06b2('0xa3')]===-0x1){return _0xb719a0;}var _0x1349d1=this[_0x06b2('0xa2')](_0x06b2('0xb4'),_0x06b2('0xb5'));if(_0x1349d1[_0x06b2('0xa3')]===-0x1){return _0x1349d1;}var _0x1d0b85=this[_0x06b2('0xa2')]('RECOG_INPUT()',_0x06b2('0xb6'));if(_0x1d0b85[_0x06b2('0xa3')]===-0x1){return _0x1d0b85;}var _0x4e7380=this['getAndSetVariable']('RECOG_INSTANCE()',_0x06b2('0xb7'));if(_0x4e7380[_0x06b2('0xa3')]===-0x1){return _0x4e7380;}return this[_0x06b2('0x3c')]['noop'](util[_0x06b2('0x2d')](_0x06b2('0xb8'),_0x5d200a));};AGIVertices['prototype'][_0x06b2('0x6')]=function(_0x3eb80c){logger['info'](util[_0x06b2('0x2d')](_0x06b2('0xb9'),_0x3eb80c[_0x06b2('0x3e')]));return this[_0x06b2('0x3c')][_0x06b2('0x6')]([_0x3eb80c[_0x06b2('0xba')],_0x3eb80c[_0x06b2('0xbb')]]);};AGIVertices[_0x06b2('0x15')][_0x06b2('0xbc')]=function(_0x15ee06){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0xbd'),_0x15ee06['label']));if(this[_0x06b2('0xa6')](_0x15ee06[_0x06b2('0x68')])){logger['info'](util[_0x06b2('0x2d')](_0x06b2('0xbe'),_0x15ee06[_0x06b2('0x68')]));var _0x30b1d8=this[_0x06b2('0x3c')][_0x06b2('0xbf')](_0x15ee06[_0x06b2('0x68')]);if(_0x30b1d8[_0x06b2('0xa3')]===-0x1){return _0x30b1d8;}}return this['channel'][_0x06b2('0xbc')]();};AGIVertices[_0x06b2('0x15')][_0x06b2('0x52')]=function(_0x36d05b){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x36d05b[_0x06b2('0x3e')]));if(!this['isConfigured'](_0x36d05b[_0x06b2('0x50')])){return this[_0x06b2('0x3c')]['error'](_0x36d05b,_0x06b2('0xc0'));}_0x36d05b[_0x06b2('0x51')]=moment();if(this[_0x06b2('0xa6')](_0x36d05b[_0x06b2('0xc1')])){_0x36d05b[_0x06b2('0x51')]=moment()['add'](_0x36d05b[_0x06b2('0xc1')],_0x06b2('0xc2'));}if(!this[_0x06b2('0xa6')](_0x36d05b['callback_priority'])){_0x36d05b[_0x06b2('0xc3')]=0x2;}this[_0x06b2('0x4a')][_0x06b2('0xa8')](this,_0x36d05b);return this[_0x06b2('0x3c')]['noop'](util['format'](_0x06b2('0xc4'),_0x36d05b['phone'],_0x36d05b[_0x06b2('0x50')],_0x36d05b[_0x06b2('0x51')]));};AGIVertices[_0x06b2('0x15')][_0x06b2('0xc5')]=function(_0x28d3c0){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0xc6'),_0x28d3c0[_0x06b2('0x3e')]));var _0x5edc79=this[_0x06b2('0x3c')][_0x06b2('0x5c')](_0x28d3c0[_0x06b2('0xc7')],_0x28d3c0[_0x06b2('0x79')]);if(_0x5edc79[_0x06b2('0xa3')]===-0x1){return _0x5edc79;}return this[_0x06b2('0x3c')][_0x06b2('0xad')](util['format'](_0x06b2('0xc8'),_0x28d3c0[_0x06b2('0xc7')],_0x28d3c0[_0x06b2('0x79')]));};AGIVertices[_0x06b2('0x15')][_0x06b2('0xc9')]=function(_0x385ee1){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0xca'),_0x385ee1[_0x06b2('0x3e')]));if(!this['isConfigured'](_0x385ee1[_0x06b2('0x61')])){return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0xab'));}var _0x395d8c='\x22'+_0x385ee1[_0x06b2('0x61')]+'\x22';if(this[_0x06b2('0xa6')](_0x385ee1['options'])){_0x395d8c+=','+_0x385ee1[_0x06b2('0x79')];}var _0x1f5bfb=this[_0x06b2('0x3c')][_0x06b2('0x5c')](_0x06b2('0xac'),_0x395d8c);if(_0x1f5bfb['result']===-0x1){return _0x1f5bfb;}return this['channel'][_0x06b2('0xad')](util['format'](_0x06b2('0xae'),_0x395d8c));};AGIVertices[_0x06b2('0x15')][_0x06b2('0xcb')]=function(_0x2461b1){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0xcc'),_0x2461b1[_0x06b2('0x3e')]));if(!this[_0x06b2('0xa6')](_0x2461b1[_0x06b2('0x61')])){return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0xab'));}var _0x527f75='\x22'+_0x2461b1[_0x06b2('0x61')]+'\x22';if(this[_0x06b2('0xa6')](_0x2461b1['options'])){_0x527f75+=','+_0x2461b1[_0x06b2('0x79')];}var _0xd0505e=this[_0x06b2('0x3c')][_0x06b2('0x5c')](_0x06b2('0xac'),_0x527f75);if(_0xd0505e[_0x06b2('0xa3')]===-0x1){return _0xd0505e;}return this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0xae'),_0x527f75));};AGIVertices[_0x06b2('0x15')][_0x06b2('0xcd')]=function(_0x4f6cbf){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0xce'),_0x4f6cbf[_0x06b2('0x3e')]));if(!this['isConfigured'](_0x4f6cbf[_0x06b2('0xb1')])){return this['channel'][_0x06b2('0xad')]('no\x20grammar\x20configured');}var _0x5686f9=_0x4f6cbf['grammar'];if(this[_0x06b2('0xa6')](_0x4f6cbf[_0x06b2('0x79')])){_0x5686f9+=','+_0x4f6cbf[_0x06b2('0x79')];}var _0x68ca63=this[_0x06b2('0x3c')][_0x06b2('0x5c')](_0x06b2('0xb3'),_0x5686f9);if(_0x68ca63[_0x06b2('0xa3')]===-0x1){return _0x68ca63;}var _0x4f6e1a=this[_0x06b2('0xa2')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x4f6e1a[_0x06b2('0xa3')]===-0x1){return _0x4f6e1a;}var _0x5acb2d=this['getAndSetVariable'](_0x06b2('0xcf'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x5acb2d[_0x06b2('0xa3')]===-0x1){return _0x5acb2d;}var _0x1a2f83=this[_0x06b2('0xa2')](_0x06b2('0xd0'),_0x06b2('0xd1'));if(_0x1a2f83['result']===-0x1){return _0x1a2f83;}return this['channel'][_0x06b2('0xad')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x5686f9));};AGIVertices['prototype'][_0x06b2('0xd2')]=function(_0x1a79ab){logger['info'](util[_0x06b2('0x2d')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x1a79ab['label']));if(!this[_0x06b2('0xa6')](_0x1a79ab[_0x06b2('0xb1')])){return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0xb2'));}var _0x4c5dc9=_0x1a79ab[_0x06b2('0xb1')];if(this[_0x06b2('0xa6')](_0x1a79ab[_0x06b2('0x79')])){_0x4c5dc9+=','+_0x1a79ab[_0x06b2('0x79')];}var _0x502cc8=this[_0x06b2('0x3c')][_0x06b2('0x5c')](_0x06b2('0xb3'),_0x4c5dc9);if(_0x502cc8[_0x06b2('0xa3')]===-0x1){return _0x502cc8;}var _0x586fe7=this['getAndSetVariable'](_0x06b2('0xb4'),_0x06b2('0xd3'));if(_0x586fe7[_0x06b2('0xa3')]===-0x1){return _0x586fe7;}var _0x1ec69c=this['getAndSetVariable'](_0x06b2('0xcf'),_0x06b2('0xd4'));if(_0x1ec69c[_0x06b2('0xa3')]===-0x1){return _0x1ec69c;}var _0x38f108=this['getAndSetVariable'](_0x06b2('0xd0'),_0x06b2('0xd5'));if(_0x38f108['result']===-0x1){return _0x38f108;}return this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0xb8'),_0x4c5dc9));};AGIVertices[_0x06b2('0x15')][_0x06b2('0xd6')]=function(_0x5c26d2){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0xd7'),_0x5c26d2[_0x06b2('0x3e')]));if(!this['isConfigured'](_0x5c26d2[_0x06b2('0xd8')])){return this['channel'][_0x06b2('0x31')](_0x5c26d2,_0x06b2('0xd9'));}var _0x23f152=this[_0x06b2('0x19')]['sync'](this,_0x5c26d2[_0x06b2('0xd8')]);if(!_0x23f152){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x5c26d2,_0x06b2('0xda'));}if(!this[_0x06b2('0xa6')](_0x5c26d2[_0x06b2('0xdb')])){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x5c26d2,_0x06b2('0xdc'));}var _0x37cbb7=_0x5c26d2[_0x06b2('0xdb')][_0x06b2('0x5e')](/(\r\n|\n|\r)/gm,'\x20');this[_0x06b2('0x3c')]['noop'](util[_0x06b2('0x2d')](_0x06b2('0xdd'),_0x37cbb7));var _0x58151f=this['getQueryOdbc'][_0x06b2('0xa8')](this,_0x23f152,_0x37cbb7);this[_0x06b2('0x3b')][_0x06b2('0xa8')](this,_0x5c26d2,_0x37cbb7);if(!this[_0x06b2('0xa6')](_0x5c26d2[_0x06b2('0xde')])){return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0xdf'));}var _0x1ec4a0=this['getVariable'][_0x06b2('0xa8')](this,_0x5c26d2[_0x06b2('0xde')]);if(!_0x1ec4a0){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x5c26d2,_0x06b2('0xe0'));}var _0x5e7b42=this;_0x58151f[_0x06b2('0xe1')](function(_0x21a9f1,_0x4ad342){Object[_0x06b2('0xe2')](_0x21a9f1)['forEach'](function(_0x6ca8c7){_0x5e7b42[_0x06b2('0x3c')]['setVariable'](util[_0x06b2('0x2d')](_0x06b2('0xe3'),_0x1ec4a0,_0x4ad342,_0x6ca8c7),_0x21a9f1[_0x6ca8c7]);});});this[_0x06b2('0x3c')]['setVariable'](util[_0x06b2('0x2d')]('%s_ROWS_COUNT',_0x1ec4a0),_0x58151f[_0x06b2('0x9c')]);return this['channel']['noop'](util[_0x06b2('0x2d')](_0x06b2('0xe4'),_0x1ec4a0));};AGIVertices['prototype'][_0x06b2('0xe5')]=function(_0x214027){logger[_0x06b2('0xe6')](util[_0x06b2('0x2d')](_0x06b2('0xe7'),_0x214027[_0x06b2('0x3e')]));if(!this[_0x06b2('0xa6')](_0x214027[_0x06b2('0xe8')])){return this[_0x06b2('0x3c')]['error'](_0x214027,_0x06b2('0xe9'));}var _0x8b952d=this[_0x06b2('0x1c')][_0x06b2('0xa8')](this,_0x214027[_0x06b2('0xe8')]);if(!_0x8b952d){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x214027,_0x06b2('0xea'));}var _0x50ac97=this[_0x06b2('0x3c')][_0x06b2('0x5c')](_0x06b2('0xeb'),[util['format'](_0x06b2('0xec'),_0x8b952d),_0x214027['timeout'],_0x214027[_0x06b2('0xed')],_0x214027['url']]);if(_0x50ac97['result']===-0x1){return _0x50ac97;}return this['channel']['noop'](util[_0x06b2('0x2d')](_0x06b2('0xee'),_0x06b2('0xeb')));};AGIVertices['prototype']['dialogflow']=function(_0x48e282){logger[_0x06b2('0xa4')](util['format'](_0x06b2('0xef'),_0x48e282['label']));if(!this['isConfigured'](_0x48e282['key'])){return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0xf0'));}if(!this['isConfigured'](_0x48e282[_0x06b2('0x61')])){return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0xab'));}this['channel'][_0x06b2('0xf1')]=!![];this[_0x06b2('0x3b')](_0x48e282);this[_0x06b2('0x49')](_0x48e282[_0x06b2('0x61')],'in','','');this[_0x06b2('0x3c')]['noop'](util['format'](_0x06b2('0xf2'),_0x48e282[_0x06b2('0x61')]));var _0x9cd5af=this['googleDialogflow'][_0x06b2('0xa8')](this,_0x48e282);if(_0x9cd5af){for(var _0xfd7e8f in _0x9cd5af){if(_0x9cd5af[_0x06b2('0x93')](_0xfd7e8f)){this[_0x06b2('0x3c')]['setVariable'](util[_0x06b2('0x2d')]('DIALOGFLOW_%s',_0xfd7e8f[_0x06b2('0xf3')]()),_0x9cd5af[_0xfd7e8f]);}}this[_0x06b2('0x49')](_0x9cd5af[_0x06b2('0xf4')],_0x06b2('0xf5'),_0x06b2('0xf6'),'');return this[_0x06b2('0x3c')][_0x06b2('0xad')](util['format'](_0x06b2('0xf7'),_0x9cd5af['speech']));}return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x48e282,_0x06b2('0xf8'));};AGIVertices['prototype']['dialogflowV2']=function(_0x3c105b){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0xf9'),_0x3c105b[_0x06b2('0x3e')]));if(!this[_0x06b2('0xa6')](_0x3c105b[_0x06b2('0xfa')])){return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0xfb'));}if(!this['isConfigured'](_0x3c105b[_0x06b2('0x7e')])){return this[_0x06b2('0x3c')]['noop'](_0x06b2('0xfc'));}if(!this[_0x06b2('0xa6')](_0x3c105b['private_key'])){return this['channel'][_0x06b2('0xad')](_0x06b2('0xfd'));}if(!this['isConfigured'](_0x3c105b[_0x06b2('0x80')])){return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0xfe'));}if(!this[_0x06b2('0xa6')](_0x3c105b[_0x06b2('0x61')])){return this[_0x06b2('0x3c')]['noop'](_0x06b2('0xab'));}this[_0x06b2('0x3c')][_0x06b2('0xf1')]=!![];this[_0x06b2('0x3b')](_0x3c105b);this[_0x06b2('0x49')](_0x3c105b[_0x06b2('0x61')],'in','','');this['channel']['noop'](util['format']('Trying\x20DialogflowV2:\x20%s',_0x3c105b[_0x06b2('0x61')]));var _0xedb80=this['googleDialogflowV2']['sync'](this,_0x3c105b);if(_0xedb80){for(var _0x30a93b in _0xedb80){if(_0xedb80[_0x06b2('0x93')](_0x30a93b)){if(_0x30a93b!=='providerResponse'){this[_0x06b2('0x3c')][_0x06b2('0x9d')](util['format'](_0x06b2('0xff'),_0x30a93b[_0x06b2('0xf3')]()),_0xedb80[_0x30a93b]);}}}this[_0x06b2('0x49')](_0xedb80[_0x06b2('0xf4')],_0x06b2('0xf5'),'dialogflowV2',_0xedb80[_0x06b2('0x100')]);return this[_0x06b2('0x3c')]['noop'](util[_0x06b2('0x2d')]('DialogflowV2\x20Result\x20%s',_0xedb80['speech']));}return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x3c105b,_0x06b2('0x101'));};AGIVertices[_0x06b2('0x15')][_0x06b2('0x102')]=function(_0x4e60c4){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x4e60c4[_0x06b2('0x3e')]));if(!this[_0x06b2('0xa6')](_0x4e60c4[_0x06b2('0x103')])){return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0x104'));}if(!this['isConfigured'](_0x4e60c4['username'])){return this[_0x06b2('0x3c')]['noop'](_0x06b2('0x105'));}if(!this[_0x06b2('0xa6')](_0x4e60c4[_0x06b2('0x106')])){return this['channel'][_0x06b2('0xad')](_0x06b2('0x107'));}if(!this[_0x06b2('0xa6')](_0x4e60c4[_0x06b2('0x108')])){return this['channel']['noop'](_0x06b2('0xab'));}this[_0x06b2('0x3c')][_0x06b2('0xf1')]=!![];this['createSquareDetailsReport'](_0x4e60c4);this[_0x06b2('0x49')](_0x4e60c4[_0x06b2('0x61')],'in','','');this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x109'),_0x4e60c4[_0x06b2('0x61')]));var _0x51c359=this[_0x06b2('0x81')]['sync'](this,_0x4e60c4);if(_0x51c359){for(var _0x54869e in _0x51c359){if(_0x51c359['hasOwnProperty'](_0x54869e)){this[_0x06b2('0x3c')][_0x06b2('0x9d')](util[_0x06b2('0x2d')](_0x06b2('0x10a'),_0x54869e['toUpperCase']()),_0x51c359[_0x54869e]);}}this['createSquareMessage'](_0x51c359[_0x06b2('0xf4')],'out',_0x06b2('0x102'),'');if(_0x51c359[_0x06b2('0x10b')]){this['channel']['noop'](util[_0x06b2('0x2d')](_0x06b2('0x10c'),_0x51c359['audiofile']));var _0x4f9492=this['channel'][_0x06b2('0x10d')](_0x51c359['audiofile']);try{fs['unlink'](_0x51c359[_0x06b2('0x10b')]+_0x06b2('0x10e'));}catch(_0x5a868e){logger['error'](_0x5a868e);}return _0x4f9492;}else{return this[_0x06b2('0x3c')][_0x06b2('0xad')](util['format']('SestekNDA\x20Result\x20%s',_0x51c359[_0x06b2('0xf4')]));}}return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x4e60c4,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x06b2('0x15')][_0x06b2('0x10f')]=function(_0x2987a9){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x110'),_0x2987a9[_0x06b2('0x3e')]));return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0x10f'));};AGIVertices['prototype'][_0x06b2('0x111')]=function(_0x43056e){logger['info'](util[_0x06b2('0x2d')](_0x06b2('0x112'),_0x43056e[_0x06b2('0x3e')]));var _0x28fe1d='';if(_0x43056e[_0x06b2('0x113')]){if(!this[_0x06b2('0xa6')](_0x43056e['trunk_id'])){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x43056e,_0x06b2('0x114'));}else{var _0x4d8bb3=parseInt(_0x43056e[_0x06b2('0x113')],0xa);if(isNaN(_0x4d8bb3)){_0x28fe1d=_0x43056e[_0x06b2('0x113')];}else{_0x28fe1d=this[_0x06b2('0x1d')]['sync'](this,_0x43056e[_0x06b2('0x113')]);if(!_0x28fe1d){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x43056e,_0x06b2('0x115'));}}}}else if(_0x43056e['trunk_name']){_0x28fe1d=_0x43056e['trunk_name'];}else{return this['channel'][_0x06b2('0x31')](_0x43056e,_0x06b2('0x114'));}var _0x226269=this[_0x06b2('0x3c')]['exec'](_0x06b2('0xeb'),[util[_0x06b2('0x2d')](_0x06b2('0x116'),_0x28fe1d,_0x43056e[_0x06b2('0x4f')]),_0x43056e[_0x06b2('0x68')],_0x43056e['opts'],_0x43056e['url']]);if(_0x226269['result']===-0x1){return _0x226269;}return this[_0x06b2('0x3c')][_0x06b2('0xad')](util['format'](_0x06b2('0xee'),_0x06b2('0xeb')));};AGIVertices[_0x06b2('0x15')]['finally']=function(_0x231a82){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x117'),_0x231a82['label']));return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0x118'));};AGIVertices[_0x06b2('0x15')][_0x06b2('0xd')]=function(_0x5157bc){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x119'),_0x5157bc['label']));if(_0x5157bc['retry']===0x0){return this[_0x06b2('0xa7')](_0x5157bc);}_0x5157bc[_0x06b2('0xa9')]-=0x1;if(!this[_0x06b2('0xa6')](_0x5157bc[_0x06b2('0x11a')])){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x5157bc,_0x06b2('0x11b'));}var _0x44a29b=this[_0x06b2('0x1f')][_0x06b2('0xa8')](this,_0x5157bc[_0x06b2('0x11a')]);if(!_0x44a29b){return this[_0x06b2('0x3c')]['error'](_0x5157bc,_0x06b2('0x11c'));}if(!this['isConfigured'](_0x5157bc[_0x06b2('0xde')])){return this[_0x06b2('0x3c')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x220e48=this['channel'][_0x06b2('0x11d')](_0x44a29b,_0x5157bc['response'],_0x5157bc[_0x06b2('0x11e')]);var _0x359488=_0x220e48['result']?_0x220e48[_0x06b2('0xa3')]['toString']():'';logger['info'](_0x06b2('0x11f'),JSON[_0x06b2('0x9e')](_0x220e48));if(_0x220e48['result']===-0x1){this[_0x06b2('0x3b')]['sync'](this,_0x5157bc,_0x359488);return _0x220e48;}else if(_0x220e48['extra']==='timeout'){_0x220e48['result']=_0x359488['length']>=parseInt(_0x5157bc[_0x06b2('0x120')])?'x':'i';}else{_0x220e48[_0x06b2('0xa3')]=_0x359488[_0x06b2('0x9c')]>=parseInt(_0x5157bc[_0x06b2('0x120')])&&_0x359488['length']<=parseInt(_0x5157bc[_0x06b2('0x11e')])?'x':'i';}var _0x439fe1=this[_0x06b2('0x10')]['sync'](this,_0x5157bc[_0x06b2('0xde')]);if(!_0x439fe1){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x5157bc,'no\x20variable\x20found');}this['channel'][_0x06b2('0x9d')](_0x439fe1,_0x359488);if(this[_0x06b2('0xa6')](_0x5157bc[_0x06b2('0x121')])){var _0x2ef492=parseInt(_0x5157bc[_0x06b2('0x121')],0xa);var _0x56cc6b=rs[_0x06b2('0x122')]({'charset':'*','length':_0x2ef492});var _0x1e7249=_0x359488[_0x06b2('0x9c')];if(_0x1e7249>0x0){if(_0x1e7249>_0x2ef492){this[_0x06b2('0x3b')][_0x06b2('0xa8')](this,_0x5157bc,_0x5157bc[_0x06b2('0x123')]==='first'?_0x56cc6b+_0x359488[_0x06b2('0x124')](_0x2ef492):_0x359488[_0x06b2('0x124')](0x0,_0x1e7249-_0x2ef492)+_0x56cc6b);}else{this[_0x06b2('0x3b')]['sync'](this,_0x5157bc,rs[_0x06b2('0x122')]({'charset':'*','length':_0x1e7249}));}}else{this[_0x06b2('0x3b')][_0x06b2('0xa8')](this,_0x5157bc,'');}}else{this['createSquareDetailsReport'][_0x06b2('0xa8')](this,_0x5157bc,_0x359488);}return _0x220e48;};AGIVertices[_0x06b2('0x15')][_0x06b2('0xe')]=function(_0x200be6){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x125'),_0x200be6[_0x06b2('0x3e')]));return this['getdigits'](_0x200be6);};AGIVertices['prototype']['goal']=function(_0x4a9c45){logger['info'](util[_0x06b2('0x2d')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x4a9c45[_0x06b2('0x3e')]));this[_0x06b2('0x3b')]['sync'](this,_0x4a9c45,_0x4a9c45[_0x06b2('0x126')]);return this['channel'][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x127'),_0x4a9c45['goalname']));};AGIVertices[_0x06b2('0x15')][_0x06b2('0x128')]=function(_0x475fda){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x129'),_0x475fda[_0x06b2('0x3e')]));if(!this[_0x06b2('0xa6')](_0x475fda[_0x06b2('0x12a')])||!this[_0x06b2('0xa6')](_0x475fda['aws_secret_access_key'])){return this[_0x06b2('0x3c')][_0x06b2('0xad')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x06b2('0xa6')](_0x475fda[_0x06b2('0x61')])){return this[_0x06b2('0x3c')][_0x06b2('0xad')]('no\x20text\x20configured');}this['channel']['noop'](util['format']('Trying\x20aws\x20Polly\x20%s',_0x475fda[_0x06b2('0x61')]));var _0x137b3c=this[_0x06b2('0x88')][_0x06b2('0xa8')](this,_0x475fda);if(_0x137b3c){this[_0x06b2('0x3c')]['noop'](util[_0x06b2('0x2d')](_0x06b2('0x12b'),_0x137b3c));var _0x2c5847=this[_0x06b2('0x3c')][_0x06b2('0x10d')](_0x137b3c);try{fs[_0x06b2('0x12c')](_0x137b3c+'.wav');}catch(_0x214aa7){logger[_0x06b2('0x31')](_0x214aa7);}return _0x2c5847;}return this[_0x06b2('0x3c')]['error'](_0x475fda,_0x06b2('0x12d'));};AGIVertices[_0x06b2('0x15')][_0x06b2('0x12e')]=function(_0x1b95e9){logger['info'](util[_0x06b2('0x2d')](_0x06b2('0x12f'),_0x1b95e9['label']));if(!this['isConfigured'](_0x1b95e9[_0x06b2('0x12a')])||!this[_0x06b2('0xa6')](_0x1b95e9[_0x06b2('0x8d')])){return this['channel'][_0x06b2('0xad')](_0x06b2('0x130'));}if(!this[_0x06b2('0xa6')](_0x1b95e9['aws_bot_name'])){return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0x131'));}if(!this[_0x06b2('0xa6')](_0x1b95e9[_0x06b2('0x61')])){return this['channel'][_0x06b2('0xad')](_0x06b2('0xab'));}this[_0x06b2('0x3c')][_0x06b2('0xf1')]=!![];this[_0x06b2('0x3b')](_0x1b95e9);this[_0x06b2('0x49')](_0x1b95e9[_0x06b2('0x61')],'in','','');this[_0x06b2('0x3c')]['noop'](util[_0x06b2('0x2d')](_0x06b2('0x132'),_0x1b95e9[_0x06b2('0x61')]));var _0x5c85e9=this[_0x06b2('0x8c')][_0x06b2('0xa8')](this,_0x1b95e9);if(_0x5c85e9){for(var _0x59c3c9 in _0x5c85e9){if(_0x5c85e9[_0x06b2('0x93')](_0x59c3c9)&&_[_0x06b2('0x94')](_0x5c85e9[_0x59c3c9])){this[_0x06b2('0x3c')]['setVariable'](util[_0x06b2('0x2d')](_0x06b2('0x133'),_0x59c3c9[_0x06b2('0xf3')]()),_0x5c85e9[_0x59c3c9]);}}if(_[_0x06b2('0x4c')](_0x5c85e9[_0x06b2('0x77')])){return this['channel']['noop'](_0x06b2('0x134'));}else{this[_0x06b2('0x49')](_0x5c85e9[_0x06b2('0x77')],_0x06b2('0xf5'),_0x06b2('0x135'),'');return this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x136'),_0x5c85e9[_0x06b2('0x77')]));}}return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x1b95e9,_0x06b2('0x137'));};AGIVertices[_0x06b2('0x15')][_0x06b2('0x138')]=function(_0x322410){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x139'),_0x322410[_0x06b2('0x3e')],_0x322410['timeout']));if(!this[_0x06b2('0xa6')](_0x322410['key'])){return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0xf0'));}var _0x4452ea=_0x06b2('0x13a');var _0x3ffe23=util[_0x06b2('0x2d')](_0x06b2('0x13b'),FILES_PATH,rs[_0x06b2('0x122')](0x4));var _0x1ad178=util[_0x06b2('0x2d')](_0x06b2('0x9b'),_0x3ffe23,_0x4452ea);var _0x1386b9=!![];if(_0x322410['beep']===_0x06b2('0x13c')){_0x1386b9=![];}var _0x5016eb=this[_0x06b2('0x3c')]['recordFile'](_0x3ffe23,_0x4452ea,_0x322410[_0x06b2('0x13d')],_0x322410[_0x06b2('0x68')],undefined,_0x1386b9);if(_0x5016eb[_0x06b2('0xa3')]!==-0x1){this[_0x06b2('0x3c')]['noop'](util[_0x06b2('0x2d')](_0x06b2('0x13e'),_0x1ad178));var _0x2b2fbd=this[_0x06b2('0x8f')][_0x06b2('0xa8')](this,_0x322410,_0x1ad178);if(_0x2b2fbd){for(var _0x2f2b82 in _0x2b2fbd){if(_0x2b2fbd[_0x06b2('0x93')](_0x2f2b82)){this[_0x06b2('0x3c')][_0x06b2('0x9d')](util['format'](_0x06b2('0x13f'),_0x2f2b82[_0x06b2('0xf3')]()),_0x2b2fbd[_0x2f2b82]);}}return this[_0x06b2('0x3c')]['noop'](util[_0x06b2('0x2d')](_0x06b2('0x140'),JSON[_0x06b2('0x9e')](_0x2b2fbd)));}}return _0x5016eb;};AGIVertices[_0x06b2('0x15')]['tildeasr']=function(_0x42784d){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x141'),_0x42784d[_0x06b2('0x3e')]));if(!this['isConfigured'](_0x42784d[_0x06b2('0x142')])){return this['channel'][_0x06b2('0xad')]('no\x20appid\x20configured');}if(!this[_0x06b2('0xa6')](_0x42784d['appsecret'])){return this['channel'][_0x06b2('0xad')]('no\x20appsecret\x20configured');}var _0x5014b8=_0x06b2('0x13a');var _0x55cd89=util[_0x06b2('0x2d')]('%s/recordings/%s',FILES_PATH,rs[_0x06b2('0x122')](0x4));var _0x387f89=util[_0x06b2('0x2d')]('%s.%s',_0x55cd89,_0x5014b8);var _0x48be0b=!![];if(_0x42784d['beep']===_0x06b2('0x13c')){_0x48be0b=![];}var _0x5c7220=this['channel']['recordFile'](_0x55cd89,_0x5014b8,_0x42784d[_0x06b2('0x13d')],_0x42784d[_0x06b2('0x68')],undefined,_0x48be0b);if(_0x5c7220[_0x06b2('0xa3')]!==-0x1){this['channel'][_0x06b2('0xad')](util['format'](_0x06b2('0x143'),_0x387f89));var _0x5f2ee1=this[_0x06b2('0x90')][_0x06b2('0xa8')](this,_0x42784d,_0x387f89);if(_0x5f2ee1){for(var _0x37d5d8 in _0x5f2ee1){if(_0x5f2ee1[_0x06b2('0x93')](_0x37d5d8)){this[_0x06b2('0x3c')]['setVariable'](util[_0x06b2('0x2d')](_0x06b2('0x144'),_0x37d5d8[_0x06b2('0xf3')]()),_0x5f2ee1[_0x37d5d8]);}}return this['channel'][_0x06b2('0xad')](util[_0x06b2('0x2d')]('TildeASR\x20Result\x20%s',JSON[_0x06b2('0x9e')](_0x5f2ee1)));}}return _0x5c7220;};AGIVertices[_0x06b2('0x15')][_0x06b2('0x145')]=function(_0x5653c4){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x146'),_0x5653c4[_0x06b2('0x3e')]));return this[_0x06b2('0x3c')]['continueAt'](_0x5653c4['context'],_0x5653c4['extension'],_0x5653c4['priority']);};AGIVertices[_0x06b2('0x15')]['gotoif']=function(_0x479533){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x147'),_0x479533[_0x06b2('0x3e')]));if(!this['isConfigured'](_0x479533[_0x06b2('0x148')])){return this['channel'][_0x06b2('0x31')](_0x479533,'no\x20condition\x20configured');}try{var _0x18bae6=eval(_0x479533[_0x06b2('0x148')])?_0x06b2('0x149'):'false';this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x14a'),_0x479533[_0x06b2('0x148')],_0x18bae6));return{'code':0xc8,'result':_0x18bae6};}catch(_0x488fdc){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype']['gotoiftime']=function(_0x3fbda8){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x14b'),_0x3fbda8[_0x06b2('0x3e')]));if(!this[_0x06b2('0xa6')](_0x3fbda8['interval_id'])){return this['channel']['error'](_0x3fbda8,_0x06b2('0x14c'));}var _0x386cbe=this[_0x06b2('0x27')][_0x06b2('0xa8')](this,_0x3fbda8[_0x06b2('0x14d')]);if(!_0x386cbe){return this['channel'][_0x06b2('0x31')](_0x3fbda8,_0x06b2('0x14e'));}for(var _0x3bb781=0x0;_0x3bb781<_0x386cbe[_0x06b2('0x9c')];_0x3bb781+=0x1){var _0x47f53a=this[_0x06b2('0x3c')][_0x06b2('0x10')](util[_0x06b2('0x2d')](_0x06b2('0x14f'),_0x386cbe[_0x3bb781]));if(_0x47f53a[_0x06b2('0xa3')]===-0x1){return _0x47f53a;}logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x150'),_0x386cbe[_0x3bb781],_0x47f53a[_0x06b2('0xa1')]));if(_0x47f53a[_0x06b2('0xa1')]==='true'){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x150'),_0x386cbe[_0x3bb781],_0x06b2('0x149')));this['channel'][_0x06b2('0xad')](util[_0x06b2('0x2d')]('IFTIME\x20%s\x20%s',_0x386cbe[_0x3bb781],_0x06b2('0x149')));return{'code':0xc8,'result':_0x06b2('0x149')};}else{logger[_0x06b2('0xa4')](util['format'](_0x06b2('0x150'),_0x386cbe[_0x3bb781],_0x06b2('0x151')));this['channel'][_0x06b2('0xad')](util[_0x06b2('0x2d')]('IFTIME\x20%s\x20%s',_0x386cbe[_0x3bb781],_0x06b2('0x151')));}}return{'code':0xc8,'result':_0x06b2('0x151')};};AGIVertices[_0x06b2('0x15')]['hangup']=function(_0x366f78){logger['info'](util[_0x06b2('0x2d')](_0x06b2('0x152'),_0x366f78[_0x06b2('0x3e')]));return this[_0x06b2('0x3c')][_0x06b2('0x153')]();};AGIVertices[_0x06b2('0x15')][_0x06b2('0x154')]=function(_0x460683){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x155'),_0x460683[_0x06b2('0x3e')]));if(!this['isConfigured'](_0x460683[_0x06b2('0x7b')])){return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0xf0'));}var _0x38c457=_0x06b2('0x13a');var _0x357ebc=util[_0x06b2('0x2d')](_0x06b2('0x13b'),FILES_PATH,rs[_0x06b2('0x122')](0x4));var _0xb4f419=util[_0x06b2('0x2d')](_0x06b2('0x9b'),_0x357ebc,_0x38c457);var _0x39d19c=!![];if(_0x460683[_0x06b2('0x156')]===_0x06b2('0x13c')){_0x39d19c=![];}var _0x4be478=this[_0x06b2('0x3c')]['recordFile'](_0x357ebc,_0x38c457,_0x460683['intKey'],_0x460683[_0x06b2('0x68')],undefined,_0x39d19c);if(_0x4be478[_0x06b2('0xa3')]!==-0x1){this['channel'][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x157'),_0xb4f419));var _0x4e0567=this[_0x06b2('0x85')][_0x06b2('0xa8')](this,_0x460683,_0xb4f419);if(_0x4e0567){for(var _0x3075f8 in _0x4e0567){if(_0x4e0567[_0x06b2('0x93')](_0x3075f8)){this[_0x06b2('0x3c')][_0x06b2('0x9d')](util['format'](_0x06b2('0x158'),_0x3075f8[_0x06b2('0xf3')]()),_0x4e0567[_0x3075f8]);}}return this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x159'),JSON[_0x06b2('0x9e')](_0x4e0567)));}}return _0x4be478;};AGIVertices[_0x06b2('0x15')][_0x06b2('0x15a')]=function(_0x2021db){logger['info'](util['format'](_0x06b2('0x15b'),_0x2021db[_0x06b2('0x3e')]));if(!this[_0x06b2('0xa6')](_0x2021db[_0x06b2('0x7b')])){return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0xf0'));}if(!this['isConfigured'](_0x2021db[_0x06b2('0x61')])){return this['channel'][_0x06b2('0xad')]('no\x20text\x20configured');}this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x15c'),_0x2021db[_0x06b2('0x61')]));var _0x44da5f=this[_0x06b2('0x82')][_0x06b2('0xa8')](this,_0x2021db);if(_0x44da5f){this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x157'),_0x44da5f));var _0x38e157=this[_0x06b2('0x3c')]['streamFile'](_0x44da5f,_0x2021db[_0x06b2('0x13d')]);try{fs[_0x06b2('0x12c')](_0x44da5f+_0x06b2('0x10e'));}catch(_0x56ecf3){logger[_0x06b2('0x31')](_0x56ecf3);}return _0x38e157;}return this[_0x06b2('0x3c')]['error'](_0x2021db,_0x06b2('0x15d'));};AGIVertices['prototype'][_0x06b2('0x15e')]=function(_0x1e7ece){logger['info'](util[_0x06b2('0x2d')](_0x06b2('0x15f'),_0x1e7ece[_0x06b2('0x3e')]));if(!this[_0x06b2('0xa6')](_0x1e7ece['findBy'])){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x1e7ece,'no\x20find\x20by\x20configured');}logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x160'),this[_0x06b2('0x3c')]['callerid'],_0x1e7ece[_0x06b2('0x161')]));var _0x2a56f1=this[_0x06b2('0x58')][_0x06b2('0xa8')](this,_0x1e7ece[_0x06b2('0x161')]);if(_0x2a56f1){logger['info'](util[_0x06b2('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x06b2('0x3c')]['callerid'],_0x1e7ece[_0x06b2('0x161')]));this['channel']['noop'](util[_0x06b2('0x2d')](_0x06b2('0x162'),this[_0x06b2('0x3c')][_0x06b2('0x41')],_0x1e7ece[_0x06b2('0x161')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x06b2('0x2d')](_0x06b2('0x163'),this['channel']['callerid'],_0x1e7ece[_0x06b2('0x161')]));this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x163'),this['channel'][_0x06b2('0x41')],_0x1e7ece[_0x06b2('0x161')]));return{'code':0xc8,'result':_0x06b2('0x164')};}};AGIVertices['prototype'][_0x06b2('0x165')]=function(_0x41a86e){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x166'),_0x41a86e[_0x06b2('0x3e')]));if(!this[_0x06b2('0xa6')](_0x41a86e[_0x06b2('0x161')])){return this['channel'][_0x06b2('0x31')](_0x41a86e,_0x06b2('0x167'));}logger['info'](util[_0x06b2('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x06b2('0x3c')][_0x06b2('0x41')],_0x41a86e[_0x06b2('0x161')]));var _0x403ba0=this[_0x06b2('0x57')][_0x06b2('0xa8')](this,_0x41a86e['findBy']);if(_0x403ba0){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x06b2('0x3c')]['callerid'],_0x41a86e[_0x06b2('0x161')]));this['channel'][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x162'),this['channel'][_0x06b2('0x41')],_0x41a86e['findBy']));return{'code':0xc8,'result':_0x06b2('0x168')};}else{logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x163'),this['channel'][_0x06b2('0x41')],_0x41a86e[_0x06b2('0x161')]));this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x163'),this[_0x06b2('0x3c')][_0x06b2('0x41')],_0x41a86e[_0x06b2('0x161')]));return{'code':0xc8,'result':_0x06b2('0x164')};}};AGIVertices[_0x06b2('0x15')][_0x06b2('0x169')]=function(_0x4199dc){logger[_0x06b2('0xa4')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x4199dc[_0x06b2('0x3e')]));if(!this['isConfigured'](_0x4199dc[_0x06b2('0x16a')])){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x4199dc,_0x06b2('0x16b'));}this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')]('math\x20%s',_0x4199dc[_0x06b2('0x16a')]));var _0x576184=eval(_0x4199dc[_0x06b2('0x16a')]);if(!this['isConfigured'](_0x4199dc[_0x06b2('0xde')])){return this[_0x06b2('0x3c')]['noop'](_0x06b2('0xdf'));}var _0xc18c1f=this[_0x06b2('0x10')]['sync'](this,_0x4199dc[_0x06b2('0xde')]);if(!_0xc18c1f){return this['channel'][_0x06b2('0x31')](_0x4199dc,_0x06b2('0xe0'));}if(_[_0x06b2('0x99')](_0x576184)){var _0x38fb82=this;_0x576184[_0x06b2('0xe1')](function(_0xfd04bb,_0x4501cc){_0x38fb82['channel'][_0x06b2('0x9d')](util['format'](_0x06b2('0x16c'),_0xc18c1f,_0x4501cc),_0xfd04bb);});return this['channel'][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x16d'),_0xc18c1f));}else{return this[_0x06b2('0x3c')][_0x06b2('0x9d')](_0xc18c1f,_0x576184);}};AGIVertices[_0x06b2('0x15')]['menu']=function(_0x24626e){logger[_0x06b2('0xa4')](util['format'](_0x06b2('0x16e'),_0x24626e[_0x06b2('0x3e')]));if(_0x24626e['retry']===0x0){return this['maxRetry'](_0x24626e);}_0x24626e[_0x06b2('0xa9')]-=0x1;if(!this[_0x06b2('0xa6')](_0x24626e[_0x06b2('0x11a')])){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x24626e,_0x06b2('0x11b'));}var _0x4e4507=this[_0x06b2('0x1f')]['sync'](this,_0x24626e[_0x06b2('0x11a')]);if(!_0x4e4507){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x24626e,'no\x20file\x20audio\x20found');}var _0x22f3ab=this[_0x06b2('0x3c')]['getData'](_0x4e4507,_0x24626e[_0x06b2('0x16f')],_0x24626e[_0x06b2('0x170')]);var _0x24f84d=_0x22f3ab[_0x06b2('0xa3')];if(_0x22f3ab[_0x06b2('0xa3')]===-0x1){this[_0x06b2('0x3b')][_0x06b2('0xa8')](this,_0x24626e,'-1');return _0x22f3ab;}else if(_0x22f3ab[_0x06b2('0xa1')]==='timeout'){_0x22f3ab[_0x06b2('0xa3')]=_0x22f3ab[_0x06b2('0xa3')][_0x06b2('0x9c')]>0x0?_0x22f3ab[_0x06b2('0xa3')]:'t';}else if(_[_0x06b2('0x4b')](_0x22f3ab[_0x06b2('0xa3')])){_0x22f3ab[_0x06b2('0xa3')]='#';_0x24f84d='#';}if(!this[_0x06b2('0xa6')](_0x24626e['variable_id'])){this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0xdf'));}else{var _0x4f4d28=this[_0x06b2('0x10')][_0x06b2('0xa8')](this,_0x24626e[_0x06b2('0xde')]);if(!_0x4f4d28){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x24626e,_0x06b2('0xe0'));}this[_0x06b2('0x3c')][_0x06b2('0x9d')](_0x4f4d28,_0x24f84d);}this[_0x06b2('0x3b')][_0x06b2('0xa8')](this,_0x24626e,_0x24f84d);return _0x22f3ab;};AGIVertices[_0x06b2('0x15')]['noop']=function(_0x19909d){logger[_0x06b2('0xa4')](util['format'](_0x06b2('0x171'),_0x19909d[_0x06b2('0x3e')]));return this[_0x06b2('0x3c')]['noop'](_0x19909d[_0x06b2('0x172')]||_0x19909d[_0x06b2('0x3e')]);};AGIVertices[_0x06b2('0x15')][_0x06b2('0x173')]=function(_0x3e9fdb){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x174'),_0x3e9fdb[_0x06b2('0x3e')]));if(!this[_0x06b2('0xa6')](_0x3e9fdb[_0x06b2('0x161')])){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x3e9fdb,_0x06b2('0x167'));}logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x06b2('0x3c')][_0x06b2('0x41')],_0x3e9fdb[_0x06b2('0x161')]));var _0x1e8a8b=this[_0x06b2('0x54')][_0x06b2('0xa8')](this,_0x3e9fdb['pause_id']);var _0x2fa13a=this[_0x06b2('0x55')][_0x06b2('0xa8')](this,_0x3e9fdb['findBy'],_0x1e8a8b);if(_0x2fa13a){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x06b2('0x3c')][_0x06b2('0x41')],_0x3e9fdb[_0x06b2('0x161')]));this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x06b2('0x3c')][_0x06b2('0x41')],_0x3e9fdb[_0x06b2('0x161')]));return{'code':0xc8,'result':_0x06b2('0x168')};}else{logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x163'),this[_0x06b2('0x3c')][_0x06b2('0x41')],_0x3e9fdb['findBy']));this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x162'),this[_0x06b2('0x3c')]['callerid'],_0x3e9fdb['findBy']));return{'code':0xc8,'result':_0x06b2('0x164')};}};AGIVertices[_0x06b2('0x15')][_0x06b2('0x175')]=function(_0x25b9d8){logger['info'](util[_0x06b2('0x2d')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x25b9d8[_0x06b2('0x3e')]));if(!this['isConfigured'](_0x25b9d8[_0x06b2('0x11a')])){return this[_0x06b2('0x3c')]['error'](_0x25b9d8,_0x06b2('0x11b'));}var _0x1bfaf5=this[_0x06b2('0x1f')][_0x06b2('0xa8')](this,_0x25b9d8['file_id']);if(!_0x1bfaf5){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x25b9d8,_0x06b2('0x11c'));}var _0x42b2e2=this[_0x06b2('0x3c')]['exec'](_0x06b2('0x176'),[_0x1bfaf5,_0x25b9d8[_0x06b2('0xed')]]);if(_0x42b2e2[_0x06b2('0xa3')]===-0x1){return _0x42b2e2;}return this['channel'][_0x06b2('0xad')](util[_0x06b2('0x2d')]('Executed\x20command\x20%s\x20%s',_0x06b2('0x176'),_0x1bfaf5));};AGIVertices[_0x06b2('0x15')]['queue']=function(_0x5a8e99){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x177'),_0x5a8e99['label']));if(!this[_0x06b2('0xa6')](_0x5a8e99[_0x06b2('0x178')])){return this[_0x06b2('0x3c')]['error'](_0x5a8e99,_0x06b2('0x179'));}var _0x3b8ba0='';var _0xc646b1=parseInt(_0x5a8e99[_0x06b2('0x178')],0xa);if(isNaN(_0xc646b1)){_0x3b8ba0=_0x5a8e99['queue_id'];}else{_0x3b8ba0=this[_0x06b2('0x16')][_0x06b2('0xa8')](this,_0x5a8e99['queue_id']);if(!_0x3b8ba0){return this['channel'][_0x06b2('0x31')](_0x5a8e99,_0x06b2('0x17a'));}}var _0x17f43f='';if(this[_0x06b2('0xa6')](_0x5a8e99[_0x06b2('0x11a')])){var _0x2f8f8c=this[_0x06b2('0x1f')][_0x06b2('0xa8')](this,_0x5a8e99[_0x06b2('0x11a')]);if(_0x2f8f8c){_0x17f43f=_0x2f8f8c;}}this[_0x06b2('0x3b')][_0x06b2('0xa8')](this,_0x5a8e99,_0x3b8ba0);if(_0x5a8e99[_0x06b2('0xed')][_0x06b2('0x17b')]('x')<0x0){_0x5a8e99[_0x06b2('0xed')]+='x';}if(_0x5a8e99[_0x06b2('0xed')][_0x06b2('0x17b')]('X')<0x0){_0x5a8e99['opts']+='X';}this[_0x06b2('0x3c')]['setVariable'](_0x06b2('0x17c'),_0x3b8ba0?_0x3b8ba0[_0x06b2('0x17d')]():'');var _0x5478d0=this[_0x06b2('0x3c')]['exec'](_0x06b2('0x17e'),[_0x3b8ba0,_0x5a8e99[_0x06b2('0xed')],_0x5a8e99['url'],_0x17f43f,_0x5a8e99[_0x06b2('0x68')],_0x5a8e99[_0x06b2('0x6')],_0x5a8e99['macro'],_0x5a8e99['gosub'],'',_0x5a8e99['position']]);if(_0x5478d0[_0x06b2('0xa3')]===-0x1){return _0x5478d0;}return this[_0x06b2('0x3c')][_0x06b2('0xad')](util['format'](_0x06b2('0xc8'),_0x06b2('0x17e'),_0x3b8ba0));};AGIVertices[_0x06b2('0x15')][_0x06b2('0x17f')]=function(_0x54eaa6){logger[_0x06b2('0xa4')](util['format'](_0x06b2('0x180'),_0x54eaa6[_0x06b2('0x3e')]));var _0x17f3ec=_0x54eaa6[_0x06b2('0x181')]||_0x06b2('0x13a');var _0x25147e=util['format'](_0x06b2('0x182'),this[_0x06b2('0x3c')]['uniqueid'],rs[_0x06b2('0x122')](0x5));var _0x18b620=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x25147e,_0x17f3ec);var _0x364d85=util[_0x06b2('0x2d')]('%s/recordings/%s',FILES_PATH,_0x25147e);this[_0x06b2('0x42')][_0x06b2('0xa8')](this,_0x54eaa6,_0x25147e,_0x18b620);this[_0x06b2('0x3c')][_0x06b2('0x9d')](_0x06b2('0x183'),_0x25147e);logger[_0x06b2('0xa4')](_0x06b2('0x184'),_0x364d85,_0x17f3ec,_0x54eaa6[_0x06b2('0x185')],_0x54eaa6[_0x06b2('0x68')]);return this['channel'][_0x06b2('0x186')](_0x364d85,_0x17f3ec,_0x54eaa6[_0x06b2('0x185')],_0x54eaa6[_0x06b2('0x68')],undefined,!![]);};AGIVertices[_0x06b2('0x15')][_0x06b2('0x187')]=function(_0x31c4a4){logger[_0x06b2('0xa4')](util['format'](_0x06b2('0x188'),_0x31c4a4[_0x06b2('0x3e')]));if(!this[_0x06b2('0xa6')](_0x31c4a4['url'])){return this['channel'][_0x06b2('0xad')](_0x06b2('0x189'));}var _0x165ed7=this[_0x06b2('0x66')][_0x06b2('0xa8')](this,_0x31c4a4);logger['info'](util['format'](_0x06b2('0x18a'),util[_0x06b2('0x18b')](_0x165ed7,{'showHidden':![],'depth':null})));if(!this[_0x06b2('0xa6')](_0x31c4a4[_0x06b2('0xde')])){return this[_0x06b2('0x3c')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x55178f=this[_0x06b2('0x10')][_0x06b2('0xa8')](this,_0x31c4a4['variable_id']);if(!_0x55178f){return this['channel']['error'](_0x31c4a4,'no\x20variable\x20found');}this[_0x06b2('0x3c')][_0x06b2('0x9d')](util['format'](_0x06b2('0x18c'),_0x55178f),_0x165ed7['statusCode']?_0x165ed7[_0x06b2('0x75')]:_0x06b2('0x18d'));this[_0x06b2('0x3c')][_0x06b2('0x9d')](util[_0x06b2('0x2d')](_0x06b2('0x18e'),_0x55178f),_0x165ed7[_0x06b2('0x76')]?_0x165ed7['statusMessage']:'OK');if(_0x165ed7[_0x06b2('0x73')]){try{this['saveRestApiResult'](_0x165ed7[_0x06b2('0x73')],_0x55178f);}catch(_0x4ce225){logger[_0x06b2('0x31')](util['format'](_0x06b2('0x18f'),_0x55178f));}}return this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0xe4'),_0x55178f));};AGIVertices[_0x06b2('0x15')][_0x06b2('0x190')]=function(_0x1d1f27){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x191'),_0x1d1f27[_0x06b2('0x3e')]));return this['channel'][_0x06b2('0x192')](_0x1d1f27[_0x06b2('0x193')]['replace'](/\s+/g,''),_0x1d1f27[_0x06b2('0x185')]);};AGIVertices[_0x06b2('0x15')]['saynumber']=function(_0x3f719e){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x194'),_0x3f719e[_0x06b2('0x3e')]));return this['channel'][_0x06b2('0x195')](_0x3f719e['number']['replace'](/\s+/g,''),_0x3f719e[_0x06b2('0x185')]);};AGIVertices[_0x06b2('0x15')][_0x06b2('0x196')]=function(_0x2b1acc){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x2b1acc[_0x06b2('0x3e')]));return this[_0x06b2('0x3c')][_0x06b2('0x197')](_0x2b1acc['text'],_0x2b1acc['escape_digits']);};AGIVertices[_0x06b2('0x15')][_0x06b2('0x198')]=function(_0x5b3163){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x199'),_0x5b3163[_0x06b2('0x3e')]));if(!this[_0x06b2('0xa6')](_0x5b3163[_0x06b2('0x19a')])){return this['channel']['noop'](_0x06b2('0x19b'));}var _0x513ce2=this[_0x06b2('0x23')][_0x06b2('0xa8')](this,_0x5b3163[_0x06b2('0x19a')]);if(!_0x513ce2||!_0x513ce2[_0x06b2('0x19c')]){return this['channel'][_0x06b2('0x31')](_0x5b3163,'no\x20mail\x20account\x20found');}var _0x192b88={'from':util[_0x06b2('0x2d')]('\x22%s\x22\x20<%s>',_0x513ce2[_0x06b2('0x13')],_0x513ce2[_0x06b2('0x19d')]||_0x513ce2['Smtp'][_0x06b2('0x19e')]),'to':_0x5b3163['to']||'','cc':_0x5b3163['cc']||'','bcc':_0x5b3163[_0x06b2('0x19f')]||'','subject':_0x5b3163[_0x06b2('0x1a0')],'html':_0x5b3163['text'],'text':_0x5b3163[_0x06b2('0x61')]};if(this['isConfigured'](_0x5b3163['template_id'])){}logger[_0x06b2('0xe6')](_0x06b2('0x1a1'),JSON[_0x06b2('0x9e')](_0x192b88));this['createSquareDetailsReport'][_0x06b2('0xa8')](this,_0x5b3163,_0x5b3163[_0x06b2('0x19a')]);this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x1a2'),_0x513ce2[_0x06b2('0x13')]));this['sendMailMessage'][_0x06b2('0xa8')](this,_0x513ce2['smtpOptions'],_0x192b88);return this['channel'][_0x06b2('0xad')](_0x06b2('0x1a3'));};AGIVertices[_0x06b2('0x15')][_0x06b2('0x1a4')]=function(_0x2bd820){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x2bd820[_0x06b2('0x3e')]));return this[_0x06b2('0x3c')]['noop'](_0x06b2('0x1a5'));};AGIVertices[_0x06b2('0x15')]['sendSMS']=function(_0x28a73c){logger['info'](util[_0x06b2('0x2d')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x28a73c[_0x06b2('0x3e')]));if(!this['isConfigured'](_0x28a73c[_0x06b2('0x1a6')])){return this[_0x06b2('0x3c')]['noop'](_0x06b2('0x1a7'));}var _0xa96098=this[_0x06b2('0x38')][_0x06b2('0xa8')](this,_0x28a73c[_0x06b2('0x1a6')]);if(!_0xa96098){return this['channel'][_0x06b2('0x31')](_0x28a73c,_0x06b2('0x1a8'));}var _0x112da4={'body':_0x28a73c[_0x06b2('0x1a9')],'phone':_0x28a73c['to']||'','SmsAccountId':_0xa96098['id']};logger[_0x06b2('0xe6')]('sendSMS\x20message',JSON[_0x06b2('0x9e')](_0x112da4));this[_0x06b2('0x3b')][_0x06b2('0xa8')](this,_0x28a73c,_0x28a73c[_0x06b2('0x1a6')]);this[_0x06b2('0x3c')]['noop'](util[_0x06b2('0x2d')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0xa96098[_0x06b2('0x13')]));this[_0x06b2('0x3a')][_0x06b2('0xa8')](this,_0x112da4);return this[_0x06b2('0x3c')][_0x06b2('0xad')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x06b2('0x15')]['set']=function(_0xc6f033){logger[_0x06b2('0xa4')](util['format'](_0x06b2('0x1aa'),_0xc6f033['label']));if(!this[_0x06b2('0xa6')](_0xc6f033[_0x06b2('0xde')])){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0xc6f033,_0x06b2('0x1ab'));}var _0x394775=this[_0x06b2('0x10')]['sync'](this,_0xc6f033['variable_id']);if(!_0x394775){return this['channel'][_0x06b2('0x31')](_0xc6f033,'no\x20variable\x20found');}return this[_0x06b2('0x3c')][_0x06b2('0x9d')](_0x394775,_0xc6f033[_0x06b2('0x1ac')]);};AGIVertices[_0x06b2('0x15')]['start']=function(_0x32bb9e){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x1ad'),_0x32bb9e[_0x06b2('0x3e')]));this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0x1ae'));if(_0x32bb9e[_0x06b2('0xbc')]===_0x06b2('0x1af')){this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0x1b0'));return this[_0x06b2('0x3c')][_0x06b2('0xbc')]();}return this[_0x06b2('0x3c')][_0x06b2('0xad')](_0x06b2('0x1b1'));};AGIVertices[_0x06b2('0x15')][_0x06b2('0x1b2')]=function(_0x207b08){logger['info'](util[_0x06b2('0x2d')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x207b08['label']));if(!this[_0x06b2('0xa6')](_0x207b08['project_id'])){return this['channel'][_0x06b2('0x31')](_0x207b08,_0x06b2('0x1b3'));}var _0x422a10=this[_0x06b2('0x18')]['sync'](this,_0x207b08[_0x06b2('0x1b4')]);if(!this[_0x06b2('0xa6')](_0x422a10)){return this['channel'][_0x06b2('0x31')](_0x207b08,util[_0x06b2('0x2d')](_0x06b2('0x1b5'),_0x207b08[_0x06b2('0x1b4')]));}if(_0x422a10===this['channel'][_0x06b2('0x40')]){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x207b08,_0x06b2('0x1b6'));}this['createSquareDetailsReport'][_0x06b2('0xa8')](this,_0x207b08,_0x422a10);var _0x26ca06=this[_0x06b2('0x3c')][_0x06b2('0x5c')](_0x06b2('0x1b7'),util[_0x06b2('0x2d')](_0x06b2('0x1b8'),config[_0x06b2('0x6')]['host']||_0x06b2('0x1b9'),_0x422a10,this[_0x06b2('0x3c')]['arg_1']));if(_0x26ca06[_0x06b2('0xa3')]===-0x1){return _0x26ca06;}return this[_0x06b2('0x3c')]['noop'](util[_0x06b2('0x2d')]('Executed\x20command\x20%s\x20%s',_0x06b2('0x1b7'),_0x422a10));};AGIVertices[_0x06b2('0x15')]['system']=function(_0x3742a4){logger[_0x06b2('0xa4')](util['format'](_0x06b2('0x1ba'),_0x3742a4[_0x06b2('0x3e')]));var _0x3161f9=this[_0x06b2('0x1bb')][_0x06b2('0xa8')](this,_0x3742a4[_0x06b2('0xba')]);this[_0x06b2('0x3b')][_0x06b2('0xa8')](this,_0x3742a4,_0x3742a4[_0x06b2('0xba')]);if(this[_0x06b2('0xa6')](_0x3742a4[_0x06b2('0xde')])){var _0x1ab555=this[_0x06b2('0x10')]['sync'](this,_0x3742a4[_0x06b2('0xde')]);if(_0x1ab555){this[_0x06b2('0x3c')][_0x06b2('0x9d')](_0x1ab555,_0x3161f9);return this['channel']['noop'](util[_0x06b2('0x2d')](_0x06b2('0x1bc'),_0x3742a4[_0x06b2('0xba')],_0x1ab555));}}return this['channel'][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x1bd'),_0x3742a4[_0x06b2('0xba')]));};AGIVertices[_0x06b2('0x15')][_0x06b2('0x1be')]=function(_0x4f7a3e){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x1bf'),_0x4f7a3e['label']));_0x4f7a3e[_0x06b2('0x61')]=_0x4f7a3e[_0x06b2('0x61')][_0x06b2('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x06b2('0xa6')](_0x4f7a3e[_0x06b2('0x1c0')])){return this[_0x06b2('0x3c')]['noop']('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x4f7a3e[_0x06b2('0x61')])){return this[_0x06b2('0x3c')]['noop'](_0x06b2('0xab'));}this[_0x06b2('0x3c')]['noop'](util[_0x06b2('0x2d')](_0x06b2('0x1c1'),_0x4f7a3e[_0x06b2('0x61')]));var _0x53c0d5=this[_0x06b2('0x5f')][_0x06b2('0xa8')](this,_0x4f7a3e);if(_0x53c0d5){this[_0x06b2('0x3c')]['noop'](util[_0x06b2('0x2d')](_0x06b2('0x1c2'),_0x53c0d5));var _0x7943b6=this['channel'][_0x06b2('0x10d')](_0x53c0d5);try{fs[_0x06b2('0x12c')](_0x53c0d5+_0x06b2('0x10e'));}catch(_0x204f7c){logger[_0x06b2('0x31')](_0x204f7c);}return _0x7943b6;}return this[_0x06b2('0x3c')]['error'](_0x4f7a3e,_0x06b2('0x1c3'));};AGIVertices[_0x06b2('0x15')][_0x06b2('0x1c4')]=function(_0x8a4674){logger['info'](util[_0x06b2('0x2d')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x8a4674[_0x06b2('0x3e')]));_0x8a4674[_0x06b2('0x61')]=_0x8a4674['text'][_0x06b2('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x06b2('0xa6')](_0x8a4674[_0x06b2('0x61')])){return this[_0x06b2('0x3c')][_0x06b2('0xad')]('no\x20text\x20configured');}this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')]('Trying\x20Google\x20TTS\x20%s',_0x8a4674['text']));var _0x315269=this[_0x06b2('0x64')]['sync'](this,_0x8a4674);if(_0x315269){this[_0x06b2('0x3c')][_0x06b2('0xad')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x315269));var _0x3a9aaa=this[_0x06b2('0x3c')][_0x06b2('0x10d')](_0x315269);try{fs[_0x06b2('0x12c')](_0x315269+_0x06b2('0x10e'));}catch(_0x32a3fd){logger[_0x06b2('0x31')](_0x32a3fd);}return _0x3a9aaa;}return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x8a4674,_0x06b2('0x1c5'));};AGIVertices[_0x06b2('0x15')]['unpause']=function(_0x21817c){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x1c6'),_0x21817c['label']));if(!this[_0x06b2('0xa6')](_0x21817c[_0x06b2('0x161')])){return this[_0x06b2('0x3c')]['error'](_0x21817c,'no\x20find\x20by\x20configured');}logger[_0x06b2('0xa4')](util['format'](_0x06b2('0x160'),this['channel'][_0x06b2('0x41')],_0x21817c[_0x06b2('0x161')]));var _0x3494ef=this[_0x06b2('0x1c7')][_0x06b2('0xa8')](this,_0x21817c[_0x06b2('0x161')]);if(_0x3494ef){logger['info'](util[_0x06b2('0x2d')](_0x06b2('0x162'),this[_0x06b2('0x3c')]['callerid'],_0x21817c['findBy']));this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x162'),this[_0x06b2('0x3c')][_0x06b2('0x41')],_0x21817c['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')](_0x06b2('0x163'),this[_0x06b2('0x3c')][_0x06b2('0x41')],_0x21817c[_0x06b2('0x161')]));this[_0x06b2('0x3c')][_0x06b2('0xad')](util[_0x06b2('0x2d')](_0x06b2('0x163'),this[_0x06b2('0x3c')][_0x06b2('0x41')],_0x21817c['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x06b2('0x1c8')]=function(_0x1eb0d4){logger['info'](util[_0x06b2('0x2d')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x1eb0d4[_0x06b2('0x3e')]));var _0x8d7c9=this[_0x06b2('0x3c')][_0x06b2('0x5c')](_0x06b2('0x1c9'),[_0x1eb0d4['mailbox'],_0x1eb0d4[_0x06b2('0x79')]]);if(_0x8d7c9[_0x06b2('0xa3')]===-0x1){return _0x8d7c9;}return this[_0x06b2('0x3c')][_0x06b2('0xad')](util['format'](_0x06b2('0xc8'),_0x06b2('0x1c9'),_0x1eb0d4[_0x06b2('0x1ca')]));};AGIVertices[_0x06b2('0x15')][_0x06b2('0x1cb')]=function(_0x5b81d5){logger[_0x06b2('0xa4')](util[_0x06b2('0x2d')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x5b81d5['label']));if(!this['isConfigured'](_0x5b81d5[_0x06b2('0xde')])){return this[_0x06b2('0x3c')][_0x06b2('0x31')](_0x5b81d5,_0x06b2('0x1ab'));}var _0x503fb5=this['getVariable'][_0x06b2('0xa8')](this,_0x5b81d5[_0x06b2('0xde')]);if(!_0x503fb5){return this[_0x06b2('0x3c')]['error'](_0x5b81d5,_0x06b2('0xe0'));}var _0x3ea767=this['channel'][_0x06b2('0x10')](_0x503fb5);return{'code':0xc8,'result':_0x3ea767[_0x06b2('0xa1')]?_0x3ea767['extra']:'-'};};String[_0x06b2('0x15')][_0x06b2('0xa0')]=function(_0x3713eb,_0x1bc1b7){return this[_0x06b2('0x9f')](_0x3713eb)['join'](_0x1bc1b7);};module['exports']=AGIVertices;
\ No newline at end of file
index 02e9511..a85a0de 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa261=['prototype','startAcw','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','voicePause','attended','destlinkedid','savePause','info','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','milliseconds','diff','seconds'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa261,0x96));var _0x1a26=function(_0x5ee26f,_0x5872c4){_0x5ee26f=_0x5ee26f-0x0;var _0x5c6956=_0xa261[_0x5ee26f];return _0x5c6956;};'use strict';var util=require(_0x1a26('0x0'));var _=require(_0x1a26('0x1'));var moment=require(_0x1a26('0x2'));var ami=require(_0x1a26('0x3'));var logger=require(_0x1a26('0x4'))(_0x1a26('0x5'));var RpcUser=require(_0x1a26('0x6'));var RpcVoiceAgentReport=require(_0x1a26('0x7'));function Acw(_0x459a86){this[_0x1a26('0x8')]=_0x459a86[_0x1a26('0x8')];this[_0x1a26('0x9')]=_0x459a86[_0x1a26('0x9')];this[_0x1a26('0xa')]=_0x459a86['timers'];this[_0x1a26('0xb')]={};ami['on'](_0x1a26('0xc'),this[_0x1a26('0xd')][_0x1a26('0xe')](this));ami['on'](_0x1a26('0xf'),this[_0x1a26('0x10')][_0x1a26('0xe')](this));ami['on']('hangup',this[_0x1a26('0x11')][_0x1a26('0xe')](this));ami['on'](_0x1a26('0x12'),this[_0x1a26('0x13')][_0x1a26('0xe')](this));ami['on']('attendedtransfer',this[_0x1a26('0x14')][_0x1a26('0xe')](this));ami['on'](_0x1a26('0x15'),this['syncBlindTransfer'][_0x1a26('0xe')](this));ami['on'](_0x1a26('0x16'),this['syncAgentConnectPreview'][_0x1a26('0xe')](this));}function getDiff(_0x264f71){var _0x57c162=moment()[_0x1a26('0x17')](0x0);var _0x4f8683=moment(_0x264f71)[_0x1a26('0x17')](0x0);return _0x57c162[_0x1a26('0x18')](_0x4f8683,_0x1a26('0x19'));}Acw[_0x1a26('0x1a')][_0x1a26('0x1b')]=function(_0x2e8a16){try{var _0x213f2f=this;var _0x568579=this['channels'][_0x2e8a16][_0x1a26('0x1c')];var _0x21a87c=this[_0x1a26('0xb')][_0x2e8a16][_0x1a26('0x1d')];var _0x3c9d72=this[_0x1a26('0x8')][_0x21a87c];var _0x9d719d=![];var _0x2664f9=_0x1a26('0x1e');if(_0x3c9d72[_0x1a26('0x1f')]){if(_0x3c9d72['mandatoryDispositionPause'][_0x1a26('0x20')]){_0x9d719d=!![];_0x2664f9=_0x3c9d72[_0x1a26('0x21')][_0x1a26('0x20')];}}ami[_0x1a26('0x22')]({'action':_0x1a26('0x23'),'interface':_0x568579,'paused':!![],'reason':_0x2664f9})[_0x1a26('0x24')](function(_0x1d3fb2){if(_0x213f2f[_0x1a26('0x9')][_0x568579]){return RpcUser['getAgent'](_0x213f2f[_0x1a26('0x9')][_0x568579]['id'])[_0x1a26('0x24')](function(_0x2e6a32){if(_0x2e6a32&&!_0x2e6a32[_0x1a26('0x25')]){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x2e8a16,_0x568579,_0x21a87c);var _0x3582ea=_0x213f2f[_0x1a26('0xb')][_0x2e8a16][_0x1a26('0x26')]&&_0x213f2f[_0x1a26('0xb')][_0x2e8a16][_0x1a26('0x27')]?_0x213f2f[_0x1a26('0xb')][_0x2e8a16][_0x1a26('0x27')]:_0x2e8a16;return RpcUser[_0x1a26('0x28')](_0x213f2f[_0x1a26('0x9')][_0x568579],_0x2664f9,_0x3582ea)[_0x1a26('0x24')](function(_0x24f95f){if(!_0x9d719d){_0x213f2f[_0x1a26('0xa')][_0x568579]={};logger[_0x1a26('0x29')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2e8a16,_0x213f2f[_0x1a26('0x8')][_0x21a87c][_0x1a26('0x2a')],_0x568579,_0x21a87c);_0x213f2f[_0x1a26('0xa')][_0x568579][_0x1a26('0x2b')]=setTimeout(_0x213f2f[_0x1a26('0x2c')][_0x1a26('0xe')](_0x213f2f,_0x568579),_0x213f2f[_0x1a26('0x8')][_0x21a87c]['acwTimeout']*0x3e8);_0x213f2f[_0x1a26('0xa')][_0x568579]['lastPauseAt']=moment()[_0x1a26('0x2d')](_0x1a26('0x2e'));_0x213f2f[_0x1a26('0xa')][_0x568579][_0x1a26('0x2f')]=_0x2e8a16;_0x213f2f[_0x1a26('0xa')][_0x568579][_0x1a26('0x1d')]=_0x21a87c;_0x213f2f[_0x1a26('0xa')][_0x568579][_0x1a26('0x30')]=function(){var _0x5bdf3d=getDiff(_0x213f2f['timers'][_0x568579]['lastPauseAt']);clearTimeout(_0x213f2f[_0x1a26('0xa')][_0x568579][_0x1a26('0x2b')]);_0x213f2f['timers'][_0x568579][_0x1a26('0x2b')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x5bdf3d},_0x213f2f[_0x1a26('0xa')][_0x568579][_0x1a26('0x2f')],_0x568579)[_0x1a26('0x24')](function(_0x274b05){logger[_0x1a26('0x29')](_0x1a26('0x31'),_0x2e8a16,_0x5bdf3d,_0x274b05);})[_0x1a26('0x32')](function(_0x4e1064){logger[_0x1a26('0x33')](_0x1a26('0x34'),_0x2e8a16,_0x4e1064);});delete _0x213f2f[_0x1a26('0xa')][_0x568579];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x2e8a16,_0x568579,_0x21a87c);}});}})['catch'](function(_0x26daec){logger[_0x1a26('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2e8a16,_0x213f2f['voiceQueues'][_0x21a87c][_0x1a26('0x2a')],_0x568579,_0x21a87c);})[_0x1a26('0x35')](function(){delete _0x213f2f[_0x1a26('0xb')][_0x2e8a16];});}catch(_0x1cf88a){logger[_0x1a26('0x33')](_0x1a26('0x36'),_0x1cf88a[_0x1a26('0x37')]);}};Acw[_0x1a26('0x1a')][_0x1a26('0x2c')]=function(_0x3985ca){try{var _0x4853bf=this;if(_0x4853bf[_0x1a26('0xa')][_0x3985ca]){_0x4853bf['timers'][_0x3985ca][_0x1a26('0x2b')]=![];var _0x5460b4=_0x4853bf[_0x1a26('0xa')][_0x3985ca][_0x1a26('0x2f')];var _0x231c10=_0x4853bf[_0x1a26('0xa')][_0x3985ca][_0x1a26('0x1d')];var _0x3c1633=_0x4853bf[_0x1a26('0x8')][_0x231c10][_0x1a26('0x2a')];logger[_0x1a26('0x29')](_0x1a26('0x38'),_0x5460b4,_0x3985ca);RpcUser[_0x1a26('0x39')](this[_0x1a26('0x9')][_0x3985ca]);RpcVoiceAgentReport[_0x1a26('0x3a')]({'acwtime':_0x3c1633,'agentacw':!![]},_0x5460b4,_0x3985ca)[_0x1a26('0x24')](function(_0x101bae){logger[_0x1a26('0x29')](_0x1a26('0x31'),_0x5460b4,_0x3c1633,_0x101bae);})[_0x1a26('0x32')](function(_0x551248){logger[_0x1a26('0x33')](_0x1a26('0x34'),_0x5460b4,_0x551248);});}else{logger[_0x1a26('0x33')](_0x1a26('0x3b'),_0x3985ca);if(_0x4853bf[_0x1a26('0xa')]){logger['info'](_0x1a26('0x3c'),JSON[_0x1a26('0x3d')](_0x4853bf[_0x1a26('0xa')]));}}}catch(_0x449413){logger[_0x1a26('0x33')](_0x1a26('0x3e'),_0x449413[_0x1a26('0x37')]);}};Acw['prototype']['syncAgentConnect']=function(_0x2ecac0){try{if(this[_0x1a26('0x8')][_0x2ecac0[_0x1a26('0x1d')]]&&(this[_0x1a26('0x8')][_0x2ecac0[_0x1a26('0x1d')]][_0x1a26('0x5')]||this[_0x1a26('0x8')][_0x2ecac0[_0x1a26('0x1d')]][_0x1a26('0x1f')])){if(this[_0x1a26('0x9')][_0x2ecac0[_0x1a26('0x1c')]]){this[_0x1a26('0xb')][_0x2ecac0[_0x1a26('0x2f')]]={'queue':_0x2ecac0[_0x1a26('0x1d')],'interface':_0x2ecac0[_0x1a26('0x1c')],'destlinkedid':_0x2ecac0[_0x1a26('0x27')]};}}}catch(_0x3f4e41){logger[_0x1a26('0x33')](_0x1a26('0x3f'),_0x3f4e41[_0x1a26('0x37')]);}};Acw[_0x1a26('0x1a')][_0x1a26('0x40')]=function(_0x1d2381){try{if(this[_0x1a26('0x8')][_0x1d2381['queue']]&&(this[_0x1a26('0x8')][_0x1d2381['queue']][_0x1a26('0x5')]||this[_0x1a26('0x8')][_0x1d2381['queue']][_0x1a26('0x1f')])){if(this[_0x1a26('0x9')][_0x1d2381[_0x1a26('0x1c')]]){this[_0x1a26('0xb')][_0x1d2381[_0x1a26('0x2f')]]={'queue':_0x1d2381[_0x1a26('0x1d')],'interface':_0x1d2381[_0x1a26('0x1c')]};}}}catch(_0x209b1c){logger['error'](_0x1a26('0x41'),_0x209b1c[_0x1a26('0x37')]);}};Acw['prototype'][_0x1a26('0x10')]=function(_0x5783bd){try{if(this['channels'][_0x5783bd[_0x1a26('0x2f')]]&&_[_0x1a26('0x42')](this['channels'][_0x5783bd[_0x1a26('0x2f')]][_0x1a26('0x26')])){logger[_0x1a26('0x29')]('[%s][HANGUP:UNIQUEID]',_0x5783bd['uniqueid']);this['startAcw'](_0x5783bd['uniqueid']);}else if(this['channels'][_0x5783bd['linkedid']]&&_[_0x1a26('0x42')](this[_0x1a26('0xb')][_0x5783bd[_0x1a26('0x43')]][_0x1a26('0x26')])){logger[_0x1a26('0x29')](_0x1a26('0x44'),_0x5783bd[_0x1a26('0x43')]);this[_0x1a26('0x1b')](_0x5783bd[_0x1a26('0x43')]);}}catch(_0x57f63c){logger[_0x1a26('0x33')](_0x1a26('0x45'),_0x57f63c[_0x1a26('0x37')]);}};Acw[_0x1a26('0x1a')][_0x1a26('0x11')]=function(_0x5d5de5){try{if(this[_0x1a26('0xb')][_0x5d5de5['uniqueid']]&&this[_0x1a26('0xb')][_0x5d5de5[_0x1a26('0x2f')]][_0x1a26('0x26')]){logger[_0x1a26('0x29')](_0x1a26('0x46'),_0x5d5de5[_0x1a26('0x2f')]);this['startAcw'](_0x5d5de5[_0x1a26('0x2f')]);}else if(this[_0x1a26('0xb')][_0x5d5de5[_0x1a26('0x43')]]&&this[_0x1a26('0xb')][_0x5d5de5['linkedid']][_0x1a26('0x26')]){logger[_0x1a26('0x29')](_0x1a26('0x47'),_0x5d5de5[_0x1a26('0x43')]);this[_0x1a26('0x1b')](_0x5d5de5['linkedid']);}}catch(_0x57cd07){logger['error'](_0x1a26('0x48'),_0x57cd07[_0x1a26('0x37')]);}};Acw[_0x1a26('0x1a')]['syncAttendedTransfer']=function(_0x1831a5){try{if(!_[_0x1a26('0x49')](this[_0x1a26('0xb')][_0x1831a5[_0x1a26('0x4a')]])){this[_0x1a26('0x1b')](_0x1831a5[_0x1a26('0x4a')]);if(this[_0x1a26('0xb')][_0x1831a5[_0x1a26('0x4b')]]){this[_0x1a26('0xb')][_0x1831a5[_0x1a26('0x4b')]][_0x1a26('0x26')]=!![];this[_0x1a26('0xb')][_0x1831a5[_0x1a26('0x4c')]]=this[_0x1a26('0xb')][_0x1831a5[_0x1a26('0x4b')]];delete this['channels'][_0x1831a5[_0x1a26('0x4b')]];}}else if(!_[_0x1a26('0x49')](this[_0x1a26('0xb')][_0x1831a5['transfertargetuniqueid']])){this[_0x1a26('0x1b')](_0x1831a5[_0x1a26('0x4c')]);if(this[_0x1a26('0xb')][_0x1831a5[_0x1a26('0x4d')]]){this[_0x1a26('0xb')][_0x1831a5[_0x1a26('0x4d')]][_0x1a26('0x26')]=!![];this[_0x1a26('0xb')][_0x1831a5[_0x1a26('0x4a')]]=this[_0x1a26('0xb')][_0x1831a5['origtransfereruniqueid']];delete this[_0x1a26('0xb')][_0x1831a5[_0x1a26('0x4d')]];}}}catch(_0x8e73a2){logger[_0x1a26('0x33')](_0x1a26('0x4e'),_0x8e73a2['message']);}};Acw[_0x1a26('0x1a')][_0x1a26('0x4f')]=function(_0x341e93){try{if(this['channels'][_0x341e93[_0x1a26('0x50')]]){logger[_0x1a26('0x29')](_0x1a26('0x51'),JSON['stringify'](_0x341e93['transfereruniqueid']));this[_0x1a26('0x1b')](_0x341e93[_0x1a26('0x50')]);}else if(this['channels'][_0x341e93['transfererlinkedid']]){logger[_0x1a26('0x29')](_0x1a26('0x52'),JSON[_0x1a26('0x3d')](_0x341e93[_0x1a26('0x53')]));this[_0x1a26('0x1b')](_0x341e93[_0x1a26('0x53')]);}}catch(_0x33fe88){logger[_0x1a26('0x33')](_0x1a26('0x54'),_0x33fe88[_0x1a26('0x37')]);}};Acw[_0x1a26('0x1a')]['syncAgentRingNoAnswer']=function(_0xd61be0){try{if(this[_0x1a26('0x8')][_0xd61be0['queue']]&&this[_0x1a26('0x8')][_0xd61be0[_0x1a26('0x1d')]][_0x1a26('0x55')]===_0x1a26('0x56')){if(this[_0x1a26('0x9')][_0xd61be0[_0x1a26('0x1c')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0xd61be0['uniqueid'],_0xd61be0[_0x1a26('0x1c')],_0xd61be0[_0x1a26('0x1d')]);return RpcUser['savePause'](this['agents'][_0xd61be0[_0x1a26('0x1c')]],'Auto-Pause',_0xd61be0['uniqueid']);}}}catch(_0x479449){logger[_0x1a26('0x33')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x479449['message']);}};module[_0x1a26('0x57')]=Acw;
\ No newline at end of file
+var _0x6a35=['../rpc/voiceAgentReport','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','startAcw','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','voiceQueues','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','util','lodash','moment','../ami','../../../config/logger','acw'];(function(_0x7a78d7,_0x4aa57c){var _0x33a5da=function(_0x1f6cad){while(--_0x1f6cad){_0x7a78d7['push'](_0x7a78d7['shift']());}};_0x33a5da(++_0x4aa57c);}(_0x6a35,0x194));var _0x56a3=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x6a35[_0x2e4e19];return _0x9ba20b;};'use strict';var util=require(_0x56a3('0x0'));var _=require(_0x56a3('0x1'));var moment=require(_0x56a3('0x2'));var ami=require(_0x56a3('0x3'));var logger=require(_0x56a3('0x4'))(_0x56a3('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x56a3('0x6'));function Acw(_0x10ac79){this['voiceQueues']=_0x10ac79['voiceQueues'];this[_0x56a3('0x7')]=_0x10ac79['agents'];this[_0x56a3('0x8')]=_0x10ac79[_0x56a3('0x8')];this[_0x56a3('0x9')]={};ami['on'](_0x56a3('0xa'),this[_0x56a3('0xb')][_0x56a3('0xc')](this));ami['on'](_0x56a3('0xd'),this['syncHangupRequest'][_0x56a3('0xc')](this));ami['on']('hangup',this[_0x56a3('0xe')][_0x56a3('0xc')](this));ami['on']('agentringnoanswer',this[_0x56a3('0xf')]['bind'](this));ami['on']('attendedtransfer',this[_0x56a3('0x10')]['bind'](this));ami['on'](_0x56a3('0x11'),this[_0x56a3('0x12')][_0x56a3('0xc')](this));ami['on'](_0x56a3('0x13'),this['syncAgentConnectPreview'][_0x56a3('0xc')](this));}function getDiff(_0x2b91a8){var _0x1077cf=moment()[_0x56a3('0x14')](0x0);var _0xd64f9=moment(_0x2b91a8)[_0x56a3('0x14')](0x0);return _0x1077cf[_0x56a3('0x15')](_0xd64f9,'seconds');}Acw['prototype'][_0x56a3('0x16')]=function(_0x30c871){try{var _0x5c71b4=this;var _0x4f5fc2=this[_0x56a3('0x9')][_0x30c871][_0x56a3('0x17')];var _0x3e278b=this['channels'][_0x30c871][_0x56a3('0x18')];var _0x5b1052=this['voiceQueues'][_0x3e278b];var _0x3b9db6=![];var _0x11f35c='ACW';if(_0x5b1052[_0x56a3('0x19')]){if(_0x5b1052[_0x56a3('0x1a')][_0x56a3('0x1b')]){_0x3b9db6=!![];_0x11f35c=_0x5b1052[_0x56a3('0x1a')]['name'];}}ami[_0x56a3('0x1c')]({'action':'QueuePause','interface':_0x4f5fc2,'paused':!![],'reason':_0x11f35c})[_0x56a3('0x1d')](function(_0x2e7deb){if(_0x5c71b4[_0x56a3('0x7')][_0x4f5fc2]){return RpcUser['getAgent'](_0x5c71b4[_0x56a3('0x7')][_0x4f5fc2]['id'])['then'](function(_0x5471cd){if(_0x5471cd&&!_0x5471cd[_0x56a3('0x1e')]){logger[_0x56a3('0x1f')](_0x56a3('0x20'),_0x30c871,_0x4f5fc2,_0x3e278b);var _0x14076e=_0x5c71b4['channels'][_0x30c871][_0x56a3('0x21')]&&_0x5c71b4['channels'][_0x30c871][_0x56a3('0x22')]?_0x5c71b4[_0x56a3('0x9')][_0x30c871][_0x56a3('0x22')]:_0x30c871;return RpcUser[_0x56a3('0x23')](_0x5c71b4['agents'][_0x4f5fc2],_0x11f35c,_0x14076e)['then'](function(_0xcb0247){if(!_0x3b9db6){_0x5c71b4['timers'][_0x4f5fc2]={};logger[_0x56a3('0x1f')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x30c871,_0x5c71b4[_0x56a3('0x24')][_0x3e278b][_0x56a3('0x25')],_0x4f5fc2,_0x3e278b);_0x5c71b4[_0x56a3('0x8')][_0x4f5fc2][_0x56a3('0x26')]=setTimeout(_0x5c71b4[_0x56a3('0x27')][_0x56a3('0xc')](_0x5c71b4,_0x4f5fc2),_0x5c71b4[_0x56a3('0x24')][_0x3e278b][_0x56a3('0x25')]*0x3e8);_0x5c71b4[_0x56a3('0x8')][_0x4f5fc2][_0x56a3('0x28')]=moment()[_0x56a3('0x29')](_0x56a3('0x2a'));_0x5c71b4['timers'][_0x4f5fc2]['uniqueid']=_0x30c871;_0x5c71b4[_0x56a3('0x8')][_0x4f5fc2][_0x56a3('0x18')]=_0x3e278b;_0x5c71b4[_0x56a3('0x8')][_0x4f5fc2]['updateAcw']=function(){var _0x17a426=getDiff(_0x5c71b4[_0x56a3('0x8')][_0x4f5fc2][_0x56a3('0x28')]);clearTimeout(_0x5c71b4[_0x56a3('0x8')][_0x4f5fc2][_0x56a3('0x26')]);_0x5c71b4['timers'][_0x4f5fc2]['timer']=![];RpcVoiceAgentReport[_0x56a3('0x2b')]({'acwtime':_0x17a426},_0x5c71b4[_0x56a3('0x8')][_0x4f5fc2][_0x56a3('0x2c')],_0x4f5fc2)[_0x56a3('0x1d')](function(_0x2328d6){logger[_0x56a3('0x1f')](_0x56a3('0x2d'),_0x30c871,_0x17a426,_0x2328d6);})[_0x56a3('0x2e')](function(_0x32aca8){logger[_0x56a3('0x2f')](_0x56a3('0x30'),_0x30c871,_0x32aca8);});delete _0x5c71b4['timers'][_0x4f5fc2];};}});}else{logger[_0x56a3('0x1f')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x30c871,_0x4f5fc2,_0x3e278b);}});}})[_0x56a3('0x2e')](function(_0x161359){logger[_0x56a3('0x2f')](_0x56a3('0x31'),_0x30c871,_0x5c71b4[_0x56a3('0x24')][_0x3e278b][_0x56a3('0x25')],_0x4f5fc2,_0x3e278b);})[_0x56a3('0x32')](function(){delete _0x5c71b4[_0x56a3('0x9')][_0x30c871];});}catch(_0x54927e){logger['error']('[ACW][START]\x20%s',_0x54927e[_0x56a3('0x33')]);}};Acw[_0x56a3('0x34')]['stopAcw']=function(_0x4e0a8f){try{var _0x234a60=this;if(_0x234a60[_0x56a3('0x8')][_0x4e0a8f]){_0x234a60[_0x56a3('0x8')][_0x4e0a8f][_0x56a3('0x26')]=![];var _0x33b22c=_0x234a60[_0x56a3('0x8')][_0x4e0a8f][_0x56a3('0x2c')];var _0x29fc3d=_0x234a60['timers'][_0x4e0a8f][_0x56a3('0x18')];var _0x225843=_0x234a60[_0x56a3('0x24')][_0x29fc3d][_0x56a3('0x25')];logger[_0x56a3('0x1f')](_0x56a3('0x35'),_0x33b22c,_0x4e0a8f);RpcUser[_0x56a3('0x36')](this[_0x56a3('0x7')][_0x4e0a8f]);RpcVoiceAgentReport[_0x56a3('0x2b')]({'acwtime':_0x225843,'agentacw':!![]},_0x33b22c,_0x4e0a8f)[_0x56a3('0x1d')](function(_0x5a422f){logger[_0x56a3('0x1f')](_0x56a3('0x2d'),_0x33b22c,_0x225843,_0x5a422f);})[_0x56a3('0x2e')](function(_0x41067d){logger[_0x56a3('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x33b22c,_0x41067d);});}else{logger[_0x56a3('0x2f')](_0x56a3('0x37'),_0x4e0a8f);if(_0x234a60[_0x56a3('0x8')]){logger['info'](_0x56a3('0x38'),JSON[_0x56a3('0x39')](_0x234a60[_0x56a3('0x8')]));}}}catch(_0x4e83bf){logger[_0x56a3('0x2f')]('[ACW][STOP]\x20%s',_0x4e83bf[_0x56a3('0x33')]);}};Acw['prototype'][_0x56a3('0xb')]=function(_0x4a51a6){try{if(this[_0x56a3('0x24')][_0x4a51a6[_0x56a3('0x18')]]&&(this[_0x56a3('0x24')][_0x4a51a6[_0x56a3('0x18')]]['acw']||this[_0x56a3('0x24')][_0x4a51a6[_0x56a3('0x18')]][_0x56a3('0x19')])){if(this[_0x56a3('0x7')][_0x4a51a6[_0x56a3('0x17')]]){this[_0x56a3('0x9')][_0x4a51a6['uniqueid']]={'queue':_0x4a51a6[_0x56a3('0x18')],'interface':_0x4a51a6[_0x56a3('0x17')],'destlinkedid':_0x4a51a6[_0x56a3('0x22')]};}}}catch(_0x46111a){logger[_0x56a3('0x2f')]('[ACW][syncAgentConnect]\x20%s',_0x46111a['message']);}};Acw['prototype'][_0x56a3('0x3a')]=function(_0x192fc0){try{if(this[_0x56a3('0x24')][_0x192fc0[_0x56a3('0x18')]]&&(this[_0x56a3('0x24')][_0x192fc0[_0x56a3('0x18')]][_0x56a3('0x5')]||this[_0x56a3('0x24')][_0x192fc0[_0x56a3('0x18')]]['mandatoryDisposition'])){if(this[_0x56a3('0x7')][_0x192fc0['interface']]){this['channels'][_0x192fc0[_0x56a3('0x2c')]]={'queue':_0x192fc0[_0x56a3('0x18')],'interface':_0x192fc0['interface']};}}}catch(_0x1fd91e){logger[_0x56a3('0x2f')](_0x56a3('0x3b'),_0x1fd91e[_0x56a3('0x33')]);}};Acw['prototype'][_0x56a3('0x3c')]=function(_0x5b4167){try{if(this['channels'][_0x5b4167[_0x56a3('0x2c')]]&&_[_0x56a3('0x3d')](this[_0x56a3('0x9')][_0x5b4167[_0x56a3('0x2c')]][_0x56a3('0x21')])){logger[_0x56a3('0x1f')](_0x56a3('0x3e'),_0x5b4167[_0x56a3('0x2c')]);this[_0x56a3('0x16')](_0x5b4167[_0x56a3('0x2c')]);}else if(this['channels'][_0x5b4167[_0x56a3('0x3f')]]&&_[_0x56a3('0x3d')](this[_0x56a3('0x9')][_0x5b4167['linkedid']][_0x56a3('0x21')])){logger[_0x56a3('0x1f')](_0x56a3('0x40'),_0x5b4167[_0x56a3('0x3f')]);this[_0x56a3('0x16')](_0x5b4167['linkedid']);}}catch(_0x2000f0){logger[_0x56a3('0x2f')](_0x56a3('0x41'),_0x2000f0[_0x56a3('0x33')]);}};Acw[_0x56a3('0x34')][_0x56a3('0xe')]=function(_0x1cf7f5){try{if(this[_0x56a3('0x9')][_0x1cf7f5[_0x56a3('0x2c')]]&&this[_0x56a3('0x9')][_0x1cf7f5[_0x56a3('0x2c')]][_0x56a3('0x21')]){logger[_0x56a3('0x1f')](_0x56a3('0x42'),_0x1cf7f5[_0x56a3('0x2c')]);this[_0x56a3('0x16')](_0x1cf7f5[_0x56a3('0x2c')]);}else if(this[_0x56a3('0x9')][_0x1cf7f5[_0x56a3('0x3f')]]&&this[_0x56a3('0x9')][_0x1cf7f5[_0x56a3('0x3f')]][_0x56a3('0x21')]){logger[_0x56a3('0x1f')](_0x56a3('0x43'),_0x1cf7f5[_0x56a3('0x3f')]);this[_0x56a3('0x16')](_0x1cf7f5[_0x56a3('0x3f')]);}}catch(_0x33856f){logger[_0x56a3('0x2f')]('[ACW][syncHangup]\x20%s',_0x33856f['message']);}};Acw['prototype'][_0x56a3('0x10')]=function(_0x123dc9){try{if(!_[_0x56a3('0x44')](this[_0x56a3('0x9')][_0x123dc9[_0x56a3('0x45')]])){this[_0x56a3('0x16')](_0x123dc9[_0x56a3('0x45')]);if(this[_0x56a3('0x9')][_0x123dc9['secondtransfereruniqueid']]){this[_0x56a3('0x9')][_0x123dc9[_0x56a3('0x46')]][_0x56a3('0x21')]=!![];this[_0x56a3('0x9')][_0x123dc9[_0x56a3('0x47')]]=this[_0x56a3('0x9')][_0x123dc9[_0x56a3('0x46')]];delete this[_0x56a3('0x9')][_0x123dc9[_0x56a3('0x46')]];}}else if(!_[_0x56a3('0x44')](this[_0x56a3('0x9')][_0x123dc9['transfertargetuniqueid']])){this[_0x56a3('0x16')](_0x123dc9[_0x56a3('0x47')]);if(this['channels'][_0x123dc9[_0x56a3('0x48')]]){this[_0x56a3('0x9')][_0x123dc9[_0x56a3('0x48')]][_0x56a3('0x21')]=!![];this[_0x56a3('0x9')][_0x123dc9[_0x56a3('0x45')]]=this[_0x56a3('0x9')][_0x123dc9['origtransfereruniqueid']];delete this[_0x56a3('0x9')][_0x123dc9[_0x56a3('0x48')]];}}}catch(_0x59d97b){logger[_0x56a3('0x2f')](_0x56a3('0x49'),_0x59d97b[_0x56a3('0x33')]);}};Acw[_0x56a3('0x34')]['syncBlindTransfer']=function(_0x21da93){try{if(this[_0x56a3('0x9')][_0x21da93['transfereruniqueid']]){logger[_0x56a3('0x1f')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x56a3('0x39')](_0x21da93[_0x56a3('0x4a')]));this['startAcw'](_0x21da93[_0x56a3('0x4a')]);}else if(this['channels'][_0x21da93[_0x56a3('0x4b')]]){logger['info'](_0x56a3('0x4c'),JSON[_0x56a3('0x39')](_0x21da93['transfererlinkedid']));this[_0x56a3('0x16')](_0x21da93[_0x56a3('0x4b')]);}}catch(_0x2cffb0){logger[_0x56a3('0x2f')](_0x56a3('0x4d'),_0x2cffb0[_0x56a3('0x33')]);}};Acw[_0x56a3('0x34')][_0x56a3('0xf')]=function(_0x541d69){try{if(this['voiceQueues'][_0x541d69[_0x56a3('0x18')]]&&this['voiceQueues'][_0x541d69[_0x56a3('0x18')]][_0x56a3('0x4e')]===_0x56a3('0x4f')){if(this[_0x56a3('0x7')][_0x541d69[_0x56a3('0x17')]]){logger[_0x56a3('0x1f')](_0x56a3('0x50'),_0x541d69['uniqueid'],_0x541d69[_0x56a3('0x17')],_0x541d69[_0x56a3('0x18')]);return RpcUser['savePause'](this[_0x56a3('0x7')][_0x541d69[_0x56a3('0x17')]],'Auto-Pause',_0x541d69['uniqueid']);}}}catch(_0x12c45e){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x12c45e[_0x56a3('0x33')]);}};module[_0x56a3('0x51')]=Acw;
\ No newline at end of file
index 0d6b60d..6115cb2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x757a=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','exports','bluebird','moment','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList'];(function(_0x4d7d40,_0xb7b2a8){var _0xfac4c4=function(_0x29c939){while(--_0x29c939){_0x4d7d40['push'](_0x4d7d40['shift']());}};_0xfac4c4(++_0xb7b2a8);}(_0x757a,0xde));var _0xa757=function(_0x5bc4d8,_0x1a1da3){_0x5bc4d8=_0x5bc4d8-0x0;var _0x5506ae=_0x757a[_0x5bc4d8];return _0x5506ae;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')(_0xa757('0x2'));var config=require(_0xa757('0x3'));var ami=new Manager(config[_0xa757('0x4')][_0xa757('0x5')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')]['username'],config[_0xa757('0x4')][_0xa757('0x6')],!![]);ami['keepConnected']();ami[_0xa757('0x7')]=BPromise[_0xa757('0x8')](ami[_0xa757('0x9')]);function error(_0x1a95ee){logger[_0xa757('0xa')](util['format'](_0xa757('0xb'),config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x1a95ee,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa757('0x4')]['ip'],config['asterisk']['port']));}ami[_0xa757('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xa757('0xf')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x10')});};};ami[_0xa757('0x11')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x12')});};};ami[_0xa757('0x13')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x14')});};};ami[_0xa757('0x15')]=function(){return function(){return ami['Action']({'action':_0xa757('0x16')});};};function connect(_0x44eab8){logger[_0xa757('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));ami[_0xa757('0x18')]('error',error);ami[_0xa757('0x18')]('close',close);}ami['on'](_0xa757('0x19'),connect);ami['on'](_0xa757('0x1a'),function(_0x14014c){logger[_0xa757('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x14014c,![],null)));});ami['on'](_0xa757('0x1b'),function(_0x21f1af){logger[_0xa757('0x17')](util['format'](_0xa757('0x1c'),config['asterisk'][_0xa757('0xc')],config['asterisk']['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));return BPromise[_0xa757('0x1d')]()['then'](ami[_0xa757('0xe')]())[_0xa757('0x1e')](ami[_0xa757('0xf')]())[_0xa757('0x1e')](ami['actionSipPeerStatus']())[_0xa757('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0xfdf69d){logger['error'](_0xa757('0x1f'),util[_0xa757('0xd')](_0xfdf69d,{'showHidden':![],'depth':null}));});});ami['once'](_0xa757('0xa'),error);ami['once'](_0xa757('0x20'),close);module[_0xa757('0x21')]=ami;
\ No newline at end of file
+var _0x757a=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','exports','bluebird','moment','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList'];(function(_0x2ad39d,_0x4168dc){var _0x29495f=function(_0x3d8b7f){while(--_0x3d8b7f){_0x2ad39d['push'](_0x2ad39d['shift']());}};_0x29495f(++_0x4168dc);}(_0x757a,0xde));var _0xa757=function(_0x2059c2,_0x454e54){_0x2059c2=_0x2059c2-0x0;var _0x5e032c=_0x757a[_0x2059c2];return _0x5e032c;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')(_0xa757('0x2'));var config=require(_0xa757('0x3'));var ami=new Manager(config[_0xa757('0x4')][_0xa757('0x5')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')]['username'],config[_0xa757('0x4')][_0xa757('0x6')],!![]);ami['keepConnected']();ami[_0xa757('0x7')]=BPromise[_0xa757('0x8')](ami[_0xa757('0x9')]);function error(_0x1a95ee){logger[_0xa757('0xa')](util['format'](_0xa757('0xb'),config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x1a95ee,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa757('0x4')]['ip'],config['asterisk']['port']));}ami[_0xa757('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xa757('0xf')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x10')});};};ami[_0xa757('0x11')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x12')});};};ami[_0xa757('0x13')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x14')});};};ami[_0xa757('0x15')]=function(){return function(){return ami['Action']({'action':_0xa757('0x16')});};};function connect(_0x44eab8){logger[_0xa757('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));ami[_0xa757('0x18')]('error',error);ami[_0xa757('0x18')]('close',close);}ami['on'](_0xa757('0x19'),connect);ami['on'](_0xa757('0x1a'),function(_0x14014c){logger[_0xa757('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x14014c,![],null)));});ami['on'](_0xa757('0x1b'),function(_0x21f1af){logger[_0xa757('0x17')](util['format'](_0xa757('0x1c'),config['asterisk'][_0xa757('0xc')],config['asterisk']['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));return BPromise[_0xa757('0x1d')]()['then'](ami[_0xa757('0xe')]())[_0xa757('0x1e')](ami[_0xa757('0xf')]())[_0xa757('0x1e')](ami['actionSipPeerStatus']())[_0xa757('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0xfdf69d){logger['error'](_0xa757('0x1f'),util[_0xa757('0xd')](_0xfdf69d,{'showHidden':![],'depth':null}));});});ami['once'](_0xa757('0xa'),error);ami['once'](_0xa757('0x20'),close);module[_0xa757('0x21')]=ami;
\ No newline at end of file
index 84ff936..5989517 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x70e0,0x17b));var _0x070e=function(_0x29126b,_0x3fe389){_0x29126b=_0x29126b-0x0;var _0xe087cf=_0x70e0[_0x29126b];return _0xe087cf;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client;
\ No newline at end of file
+var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0xb7e7,0x121));var _0x7b7e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb7e7[_0x31e29a];return _0x32d892;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client;
\ No newline at end of file
index e46ce50..73f97e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x46ec=['number','moment','isNil','string','uniqueid','name','phone','Contact','firstName','lastName','queue','active','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x46ec,0x104));var _0xc46e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x46ec[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xc46e('0x0'));function checkNameSurname(_0x282709,_0x4996d3,_0x47a095){var _0x144246='';if(!_[_0xc46e('0x1')](_0x4996d3)&&_0xc46e('0x2')===typeof _0x4996d3){_0x144246+=_0x4996d3;}if(!_[_0xc46e('0x1')](_0x47a095)&&_0xc46e('0x2')===typeof _0x47a095){_0x144246+='\x20'+_0x47a095;}if(_0x144246!==''){return _0x144246;}return _0x282709;}function Action(_0x1d4c2e,_0x3ac329,_0x5d8cc5){this['voiceQueue']=_0x1d4c2e;this[_0xc46e('0x3')]=_0x5d8cc5||undefined;this[_0xc46e('0x4')]=checkNameSurname(_0x3ac329['Contact'][_0xc46e('0x5')],_0x3ac329[_0xc46e('0x6')][_0xc46e('0x7')],_0x3ac329[_0xc46e('0x6')][_0xc46e('0x8')]);this['number']=_0x3ac329['phone'];this[_0xc46e('0x9')]=_0x1d4c2e[_0xc46e('0x4')];this['active']=_0x3ac329[_0xc46e('0xa')]||![];this['type']=_0x1d4c2e['type'];this['dialQueueTimeout']=_0x1d4c2e['dialQueueTimeout']||0x3;this[_0xc46e('0xb')]=_0x3ac329[_0xc46e('0xb')];this['countbusyretry']=_0x3ac329['countbusyretry'];this[_0xc46e('0xc')]=_0x3ac329['countcongestionretry'];this[_0xc46e('0xd')]=_0x3ac329[_0xc46e('0xd')];this[_0xc46e('0xe')]=_0x3ac329[_0xc46e('0xe')];this[_0xc46e('0xf')]=_0x3ac329[_0xc46e('0xf')];this['countabandonedretry']=_0x3ac329[_0xc46e('0x10')];this[_0xc46e('0x11')]=_0x3ac329[_0xc46e('0x11')];this[_0xc46e('0x12')]=_0x3ac329[_0xc46e('0x12')];this[_0xc46e('0x13')]=_0x3ac329[_0xc46e('0x13')];this['ListId']=_0x3ac329['ListId'];this[_0xc46e('0x14')]=_0x3ac329[_0xc46e('0x14')];this[_0xc46e('0x15')]=_0x3ac329[_0xc46e('0x15')];this[_0xc46e('0x16')]=_0x3ac329[_0xc46e('0x16')];this['idHopper']=_0x3ac329['id'];this['ContactFirstName']=_0x3ac329[_0xc46e('0x6')][_0xc46e('0x7')]||'';this[_0xc46e('0x17')]=moment()[_0xc46e('0x18')](_0xc46e('0x19'));this[_0xc46e('0x1a')]=_0x3ac329[_0xc46e('0x1a')];this['callbackuniqueid']=_0x3ac329[_0xc46e('0x1b')];this[_0xc46e('0x1c')]=_0x3ac329[_0xc46e('0x1c')];this['recallme']=_0x3ac329[_0xc46e('0x1d')];this['originatecalleridnum']='';this[_0xc46e('0x1e')]='';}Action[_0xc46e('0x1f')][_0xc46e('0x20')]=function(){return util[_0xc46e('0x18')](_0xc46e('0x21'),this[_0xc46e('0x4')],this[_0xc46e('0x22')]['dialCutDigit']>0x0?this['number']['substring'](this['voiceQueue'][_0xc46e('0x23')]):this[_0xc46e('0x24')]);};Action[_0xc46e('0x1f')]['getQueue']=function(){return this['queue'];};module['exports']=Action;
\ No newline at end of file
+var _0x38a6=['voiceQueue','uniqueid','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','getQueue','exports','lodash','moment','isNil','string'];(function(_0x7873de,_0x4237ad){var _0x141d6a=function(_0x58ee26){while(--_0x58ee26){_0x7873de['push'](_0x7873de['shift']());}};_0x141d6a(++_0x4237ad);}(_0x38a6,0x129));var _0x638a=function(_0x47f95d,_0x490621){_0x47f95d=_0x47f95d-0x0;var _0x380897=_0x38a6[_0x47f95d];return _0x380897;};'use strict';var util=require('util');var _=require(_0x638a('0x0'));var moment=require(_0x638a('0x1'));function checkNameSurname(_0x368132,_0x528f72,_0x5358e7){var _0x8bd550='';if(!_[_0x638a('0x2')](_0x528f72)&&'string'===typeof _0x528f72){_0x8bd550+=_0x528f72;}if(!_[_0x638a('0x2')](_0x5358e7)&&_0x638a('0x3')===typeof _0x5358e7){_0x8bd550+='\x20'+_0x5358e7;}if(_0x8bd550!==''){return _0x8bd550;}return _0x368132;}function Action(_0x422fb4,_0x398459,_0x1bb94d){this[_0x638a('0x4')]=_0x422fb4;this[_0x638a('0x5')]=_0x1bb94d||undefined;this[_0x638a('0x6')]=checkNameSurname(_0x398459[_0x638a('0x7')][_0x638a('0x8')],_0x398459[_0x638a('0x7')]['firstName'],_0x398459[_0x638a('0x7')][_0x638a('0x9')]);this[_0x638a('0xa')]=_0x398459[_0x638a('0x8')];this[_0x638a('0xb')]=_0x422fb4[_0x638a('0x6')];this[_0x638a('0xc')]=_0x398459['active']||![];this[_0x638a('0xd')]=_0x422fb4[_0x638a('0xd')];this[_0x638a('0xe')]=_0x422fb4['dialQueueTimeout']||0x3;this['scheduledat']=_0x398459['scheduledat'];this[_0x638a('0xf')]=_0x398459[_0x638a('0xf')];this[_0x638a('0x10')]=_0x398459[_0x638a('0x10')];this[_0x638a('0x11')]=_0x398459[_0x638a('0x11')];this[_0x638a('0x12')]=_0x398459[_0x638a('0x12')];this[_0x638a('0x13')]=_0x398459[_0x638a('0x13')];this[_0x638a('0x14')]=_0x398459[_0x638a('0x14')];this['countmachineretry']=_0x398459['countmachineretry'];this['countagentrejectretry']=_0x398459[_0x638a('0x15')];this[_0x638a('0x16')]=_0x398459[_0x638a('0x16')];this[_0x638a('0x17')]=_0x398459[_0x638a('0x17')];this[_0x638a('0x18')]=_0x398459[_0x638a('0x18')];this['VoiceQueueId']=_0x398459[_0x638a('0x19')];this[_0x638a('0x1a')]=_0x398459[_0x638a('0x1a')];this[_0x638a('0x1b')]=_0x398459['id'];this[_0x638a('0x1c')]=_0x398459[_0x638a('0x7')]['firstName']||'';this['starttime']=moment()[_0x638a('0x1d')](_0x638a('0x1e'));this['callback']=_0x398459['callback'];this[_0x638a('0x1f')]=_0x398459[_0x638a('0x1f')];this['callbackat']=_0x398459[_0x638a('0x20')];this[_0x638a('0x21')]=_0x398459[_0x638a('0x21')];this[_0x638a('0x22')]='';this[_0x638a('0x23')]='';}Action[_0x638a('0x24')][_0x638a('0x25')]=function(){return util['format'](_0x638a('0x26'),this['name'],this[_0x638a('0x4')]['dialCutDigit']>0x0?this[_0x638a('0xa')][_0x638a('0x27')](this['voiceQueue'][_0x638a('0x28')]):this[_0x638a('0xa')]);};Action[_0x638a('0x24')][_0x638a('0x29')]=function(){return this[_0x638a('0xb')];};module[_0x638a('0x2a')]=Action;
\ No newline at end of file
index eb93a7f..11cc991 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3557=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','callback','callbackuniqueid'];(function(_0x3ceeb0,_0x4a9e2f){var _0x115b31=function(_0x53a275){while(--_0x53a275){_0x3ceeb0['push'](_0x3ceeb0['shift']());}};_0x115b31(++_0x4a9e2f);}(_0x3557,0x137));var _0x7355=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0x3557[_0x187718];return _0x29ddf4;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x7355('0x0'));function getSeconds(_0x3b7092,_0x2258c3){var _0x1d54a7=moment(_0x3b7092)[_0x7355('0x1')](0x0);var _0xaed40c=moment(_0x2258c3)[_0x7355('0x1')](0x0);return _0x1d54a7[_0x7355('0x2')](_0xaed40c,_0x7355('0x3'));}function AgentComplete(_0x5be033,_0x2cf19a){this['state']=0x4;this[_0x7355('0x4')]=_0x7355('0x5');this[_0x7355('0x6')]=_0x5be033[_0x7355('0x6')];this[_0x7355('0x7')]=_0x5be033[_0x7355('0x7')];this[_0x7355('0x8')]=_0x5be033[_0x7355('0x7')]==='outbound'?_0x7355('0x9'):_0x5be033[_0x7355('0x7')];this['countbusyretry']=_0x5be033[_0x7355('0xa')];this[_0x7355('0xb')]=_0x5be033['countcongestionretry'];this[_0x7355('0xc')]=_0x5be033[_0x7355('0xc')];this[_0x7355('0xd')]=_0x5be033[_0x7355('0xa')]+_0x5be033[_0x7355('0xb')]+_0x5be033['countnoanswerretry']+_0x5be033['countnosuchnumberretry']+_0x5be033[_0x7355('0xe')]+_0x5be033[_0x7355('0xf')]+_0x5be033[_0x7355('0x10')]+_0x5be033[_0x7355('0x11')];this[_0x7355('0x12')]=_0x5be033[_0x7355('0x12')];this[_0x7355('0xe')]=_0x5be033[_0x7355('0xe')];this[_0x7355('0xf')]=_0x5be033['countabandonedretry'];this[_0x7355('0x10')]=_0x5be033[_0x7355('0x10')];this['countagentrejectretry']=_0x5be033['countagentrejectretry'];this[_0x7355('0x13')]=_0x2cf19a['uniqueid'];this['calleridname']=_0x5be033['name'];this[_0x7355('0x14')]=_0x5be033[_0x7355('0x15')];this[_0x7355('0x16')]=_0x5be033[_0x7355('0x16')];this[_0x7355('0x17')]=_0x5be033['responsetime'];this[_0x7355('0x18')]=_0x5be033['answertime'];this[_0x7355('0x19')]=moment()['format'](_0x7355('0x1a'));this['ringtime']=getSeconds(_0x5be033['responsetime'],_0x5be033[_0x7355('0x16')]);this[_0x7355('0x1b')]=getSeconds(_0x5be033[_0x7355('0x18')],_0x5be033[_0x7355('0x17')]);this[_0x7355('0x1c')]=getSeconds(this[_0x7355('0x19')],_0x5be033[_0x7355('0x18')]);this[_0x7355('0x9')]=_0x2cf19a[_0x7355('0x9')];this[_0x7355('0x1d')]=_0x2cf19a[_0x7355('0x1d')];this[_0x7355('0x1e')]=_0x2cf19a[_0x7355('0x1e')];this[_0x7355('0x1f')]=_0x5be033[_0x7355('0x1f')];this[_0x7355('0x20')]=_0x5be033['callbackuniqueid'];this[_0x7355('0x21')]=_0x5be033[_0x7355('0x21')];this['recallme']=_0x5be033[_0x7355('0x22')];this['ContactId']=_0x5be033[_0x7355('0x23')];this[_0x7355('0x24')]=_0x5be033[_0x7355('0x24')];this[_0x7355('0x25')]=_0x5be033[_0x7355('0x25')];this[_0x7355('0x26')]=_0x5be033['VoiceQueueId'];this[_0x7355('0x27')]=_0x5be033['CampaignId'];this[_0x7355('0x28')]=_0x5be033[_0x7355('0x28')]||'';this[_0x7355('0x29')]=_0x5be033[_0x7355('0x29')]||'';}module[_0x7355('0x2a')]=AgentComplete;
\ No newline at end of file
+var _0x45c6=['reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','ringtime','talktime','membername'];(function(_0x1853ca,_0x2c4280){var _0x1e74a5=function(_0x5108f8){while(--_0x5108f8){_0x1853ca['push'](_0x1853ca['shift']());}};_0x1e74a5(++_0x2c4280);}(_0x45c6,0x93));var _0x645c=function(_0x554a21,_0x45dd4c){_0x554a21=_0x554a21-0x0;var _0x4ae579=_0x45c6[_0x554a21];return _0x4ae579;};'use strict';var util=require(_0x645c('0x0'));var _=require(_0x645c('0x1'));var moment=require(_0x645c('0x2'));function getSeconds(_0x5e9899,_0x17c330){var _0x29cdf9=moment(_0x5e9899)[_0x645c('0x3')](0x0);var _0x2ef5a3=moment(_0x17c330)['milliseconds'](0x0);return _0x29cdf9[_0x645c('0x4')](_0x2ef5a3,'seconds');}function AgentComplete(_0x15fce3,_0x4ceeb8){this[_0x645c('0x5')]=0x4;this[_0x645c('0x6')]=_0x645c('0x7');this[_0x645c('0x8')]=_0x15fce3[_0x645c('0x8')];this[_0x645c('0x9')]=_0x15fce3[_0x645c('0x9')];this['campaigntype']=_0x15fce3[_0x645c('0x9')]===_0x645c('0xa')?_0x645c('0xb'):_0x15fce3[_0x645c('0x9')];this[_0x645c('0xc')]=_0x15fce3['countbusyretry'];this[_0x645c('0xd')]=_0x15fce3['countcongestionretry'];this[_0x645c('0xe')]=_0x15fce3[_0x645c('0xe')];this[_0x645c('0xf')]=_0x15fce3[_0x645c('0xc')]+_0x15fce3['countcongestionretry']+_0x15fce3[_0x645c('0xe')]+_0x15fce3['countnosuchnumberretry']+_0x15fce3[_0x645c('0x10')]+_0x15fce3[_0x645c('0x11')]+_0x15fce3[_0x645c('0x12')]+_0x15fce3[_0x645c('0x13')];this[_0x645c('0x14')]=_0x15fce3[_0x645c('0x14')];this[_0x645c('0x10')]=_0x15fce3['countdropretry'];this[_0x645c('0x11')]=_0x15fce3[_0x645c('0x11')];this['countmachineretry']=_0x15fce3['countmachineretry'];this[_0x645c('0x13')]=_0x15fce3[_0x645c('0x13')];this[_0x645c('0x15')]=_0x4ceeb8['uniqueid'];this[_0x645c('0x16')]=_0x15fce3[_0x645c('0x17')];this[_0x645c('0x18')]=_0x15fce3[_0x645c('0x19')];this['starttime']=_0x15fce3[_0x645c('0x1a')];this['responsetime']=_0x15fce3[_0x645c('0x1b')];this[_0x645c('0x1c')]=_0x15fce3[_0x645c('0x1c')];this['endtime']=moment()[_0x645c('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x645c('0x1e')]=getSeconds(_0x15fce3[_0x645c('0x1b')],_0x15fce3[_0x645c('0x1a')]);this['holdtime']=getSeconds(_0x15fce3[_0x645c('0x1c')],_0x15fce3[_0x645c('0x1b')]);this[_0x645c('0x1f')]=getSeconds(this['endtime'],_0x15fce3[_0x645c('0x1c')]);this[_0x645c('0xb')]=_0x4ceeb8[_0x645c('0xb')];this[_0x645c('0x20')]=_0x4ceeb8['membername'];this['reason']=_0x4ceeb8[_0x645c('0x21')];this[_0x645c('0x22')]=_0x15fce3['callback'];this[_0x645c('0x23')]=_0x15fce3[_0x645c('0x23')];this[_0x645c('0x24')]=_0x15fce3[_0x645c('0x24')];this[_0x645c('0x25')]=_0x15fce3[_0x645c('0x25')];this['ContactId']=_0x15fce3[_0x645c('0x26')];this[_0x645c('0x27')]=_0x15fce3[_0x645c('0x27')];this[_0x645c('0x28')]=_0x15fce3['UserId'];this[_0x645c('0x29')]=_0x15fce3[_0x645c('0x29')];this['CampaignId']=_0x15fce3[_0x645c('0x2a')];this[_0x645c('0x2b')]=_0x15fce3[_0x645c('0x2b')]||'';this['originatecalleridname']=_0x15fce3['originatecalleridname']||'';}module[_0x645c('0x2c')]=AgentComplete;
\ No newline at end of file
index bafb715..b6e2d4a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5178=['queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry'];(function(_0x4f53a6,_0x582ff5){var _0x30e4b7=function(_0x1aaf04){while(--_0x1aaf04){_0x4f53a6['push'](_0x4f53a6['shift']());}};_0x30e4b7(++_0x582ff5);}(_0x5178,0x171));var _0x8517=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5178[_0x1facfa];return _0x9ec701;};'use strict';var util=require('util');var _=require(_0x8517('0x0'));var moment=require(_0x8517('0x1'));function getSeconds(_0x27662b,_0x2dc28f){var _0x38d5b3=moment(_0x27662b)['milliseconds'](0x0);var _0x483381=moment(_0x2dc28f)[_0x8517('0x2')](0x0);return _0x38d5b3[_0x8517('0x3')](_0x483381,'seconds');}function Final(_0xd4b0){this['uniqueid']=_0xd4b0[_0x8517('0x4')];this[_0x8517('0x5')]=_0xd4b0[_0x8517('0x5')];this[_0x8517('0x6')]=_0xd4b0[_0x8517('0x6')];this['campaigntype']=_0xd4b0[_0x8517('0x6')]==='outbound'?'queue':_0xd4b0[_0x8517('0x6')];this[_0x8517('0x7')]=_0xd4b0['countbusyretry'];this[_0x8517('0x8')]=_0xd4b0[_0x8517('0x8')];this[_0x8517('0x9')]=_0xd4b0[_0x8517('0x9')];this[_0x8517('0xa')]=_0xd4b0[_0x8517('0x7')]+_0xd4b0[_0x8517('0x8')]+_0xd4b0[_0x8517('0x9')]+_0xd4b0['countnosuchnumberretry']+_0xd4b0[_0x8517('0xb')]+_0xd4b0[_0x8517('0xc')]+_0xd4b0[_0x8517('0xd')]+_0xd4b0[_0x8517('0xe')];this[_0x8517('0xf')]=_0xd4b0['countnosuchnumberretry'];this[_0x8517('0xb')]=_0xd4b0[_0x8517('0xb')];this[_0x8517('0xc')]=_0xd4b0[_0x8517('0xc')];this[_0x8517('0xd')]=_0xd4b0[_0x8517('0xd')];this[_0x8517('0xe')]=_0xd4b0[_0x8517('0xe')];this[_0x8517('0x10')]=_0xd4b0[_0x8517('0x10')];this[_0x8517('0x11')]=_0xd4b0[_0x8517('0x11')];this['calleridnum']=_0xd4b0[_0x8517('0x12')];this[_0x8517('0x13')]=_0xd4b0[_0x8517('0x13')];this[_0x8517('0x14')]=_0xd4b0[_0x8517('0x14')];this[_0x8517('0x15')]=_0xd4b0[_0x8517('0x14')];this['ringtime']=_0xd4b0[_0x8517('0x16')]||0x0;this['holdtime']=_0xd4b0['holdtime']||0x0;this[_0x8517('0x17')]=_0xd4b0[_0x8517('0x17')]||0x0;this[_0x8517('0x18')]=_0xd4b0[_0x8517('0x18')];this[_0x8517('0x19')]=_0xd4b0[_0x8517('0x19')];this['callbackat']=_0xd4b0['callbackat'];this[_0x8517('0x1a')]=_0xd4b0[_0x8517('0x1a')];this[_0x8517('0x1b')]=_0xd4b0[_0x8517('0x1b')];this[_0x8517('0x1c')]=_0xd4b0[_0x8517('0x1c')];this['UserId']=_0xd4b0[_0x8517('0x1d')];this[_0x8517('0x1e')]=_0xd4b0['VoiceQueueId'];this[_0x8517('0x1f')]=_0xd4b0[_0x8517('0x1f')];this[_0x8517('0x20')]=_0xd4b0['originatecalleridnum']||'';this[_0x8517('0x21')]=_0xd4b0['originatecalleridname']||'';}module[_0x8517('0x22')]=Final;
\ No newline at end of file
+var _0x7f42=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','uniqueid'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x7f42,0x1dd));var _0x27f4=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7f42[_0x199572];return _0x13cfa3;};'use strict';var util=require(_0x27f4('0x0'));var _=require('lodash');var moment=require(_0x27f4('0x1'));function getSeconds(_0xd1035c,_0x48e553){var _0x66342a=moment(_0xd1035c)['milliseconds'](0x0);var _0x10627e=moment(_0x48e553)['milliseconds'](0x0);return _0x66342a[_0x27f4('0x2')](_0x10627e,'seconds');}function Final(_0xe8eabe){this['uniqueid']=_0xe8eabe[_0x27f4('0x3')];this[_0x27f4('0x4')]=_0xe8eabe[_0x27f4('0x4')];this[_0x27f4('0x5')]=_0xe8eabe[_0x27f4('0x5')];this[_0x27f4('0x6')]=_0xe8eabe[_0x27f4('0x5')]===_0x27f4('0x7')?_0x27f4('0x8'):_0xe8eabe[_0x27f4('0x5')];this[_0x27f4('0x9')]=_0xe8eabe[_0x27f4('0x9')];this[_0x27f4('0xa')]=_0xe8eabe[_0x27f4('0xa')];this[_0x27f4('0xb')]=_0xe8eabe[_0x27f4('0xb')];this[_0x27f4('0xc')]=_0xe8eabe[_0x27f4('0x9')]+_0xe8eabe['countcongestionretry']+_0xe8eabe['countnoanswerretry']+_0xe8eabe[_0x27f4('0xd')]+_0xe8eabe[_0x27f4('0xe')]+_0xe8eabe[_0x27f4('0xf')]+_0xe8eabe[_0x27f4('0x10')]+_0xe8eabe[_0x27f4('0x11')];this[_0x27f4('0xd')]=_0xe8eabe[_0x27f4('0xd')];this[_0x27f4('0xe')]=_0xe8eabe['countdropretry'];this['countabandonedretry']=_0xe8eabe[_0x27f4('0xf')];this[_0x27f4('0x10')]=_0xe8eabe[_0x27f4('0x10')];this[_0x27f4('0x11')]=_0xe8eabe['countagentrejectretry'];this[_0x27f4('0x8')]=_0xe8eabe[_0x27f4('0x8')];this[_0x27f4('0x12')]=_0xe8eabe['calleridname'];this[_0x27f4('0x13')]=_0xe8eabe[_0x27f4('0x13')];this[_0x27f4('0x14')]=_0xe8eabe['starttime'];this[_0x27f4('0x15')]=_0xe8eabe[_0x27f4('0x15')];this['endtime']=_0xe8eabe['responsetime'];this[_0x27f4('0x16')]=_0xe8eabe[_0x27f4('0x16')]||0x0;this[_0x27f4('0x17')]=_0xe8eabe[_0x27f4('0x17')]||0x0;this[_0x27f4('0x18')]=_0xe8eabe[_0x27f4('0x18')]||0x0;this[_0x27f4('0x19')]=_0xe8eabe[_0x27f4('0x19')];this[_0x27f4('0x1a')]=_0xe8eabe[_0x27f4('0x1a')];this[_0x27f4('0x1b')]=_0xe8eabe[_0x27f4('0x1b')];this[_0x27f4('0x1c')]=_0xe8eabe[_0x27f4('0x1c')];this[_0x27f4('0x1d')]=_0xe8eabe['ContactId'];this[_0x27f4('0x1e')]=_0xe8eabe[_0x27f4('0x1e')];this[_0x27f4('0x1f')]=_0xe8eabe[_0x27f4('0x1f')];this[_0x27f4('0x20')]=_0xe8eabe[_0x27f4('0x20')];this[_0x27f4('0x21')]=_0xe8eabe[_0x27f4('0x21')];this[_0x27f4('0x22')]=_0xe8eabe[_0x27f4('0x22')]||'';this[_0x27f4('0x23')]=_0xe8eabe[_0x27f4('0x23')]||'';}module[_0x27f4('0x24')]=Final;
\ No newline at end of file
index fe3deb2..87dcc77 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeaeb=['type','campaigntype','outbound','countbusyretry','countglobal','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','IVR','reason','callback','callbackat','recallme','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','diff','statedesc','scheduledat'];(function(_0x4d9318,_0x559c91){var _0x24bf6c=function(_0x2ea684){while(--_0x2ea684){_0x4d9318['push'](_0x4d9318['shift']());}};_0x24bf6c(++_0x559c91);}(_0xeaeb,0xc7));var _0xbeae=function(_0x1d432d,_0x401149){_0x1d432d=_0x1d432d-0x0;var _0x338acb=_0xeaeb[_0x1d432d];return _0x338acb;};'use strict';var util=require(_0xbeae('0x0'));var _=require(_0xbeae('0x1'));var moment=require('moment');function getSeconds(_0x30f82d,_0x3551a2){var _0x5cb5a3=moment(_0x30f82d)[_0xbeae('0x2')](0x0);var _0x4115b1=moment(_0x3551a2)['milliseconds'](0x0);return _0x5cb5a3[_0xbeae('0x3')](_0x4115b1,'seconds');}function Hangup(_0x3b14b9,_0x1b5310){this['state']=0x4;this[_0xbeae('0x4')]='Answer';this[_0xbeae('0x5')]=_0x3b14b9[_0xbeae('0x5')];this[_0xbeae('0x6')]=_0x3b14b9[_0xbeae('0x6')];this[_0xbeae('0x7')]=_0x3b14b9['type']===_0xbeae('0x8')?'queue':_0x3b14b9[_0xbeae('0x6')];this[_0xbeae('0x9')]=_0x3b14b9[_0xbeae('0x9')];this['countcongestionretry']=_0x3b14b9['countcongestionretry'];this['countnoanswerretry']=_0x3b14b9['countnoanswerretry'];this[_0xbeae('0xa')]=_0x3b14b9[_0xbeae('0x9')]+_0x3b14b9[_0xbeae('0xb')]+_0x3b14b9[_0xbeae('0xc')]+_0x3b14b9[_0xbeae('0xd')]+_0x3b14b9['countdropretry']+_0x3b14b9[_0xbeae('0xe')]+_0x3b14b9['countmachineretry']+_0x3b14b9[_0xbeae('0xf')];this[_0xbeae('0xd')]=_0x3b14b9[_0xbeae('0xd')];this[_0xbeae('0x10')]=_0x3b14b9[_0xbeae('0x10')];this[_0xbeae('0xe')]=_0x3b14b9['countabandonedretry'];this[_0xbeae('0x11')]=_0x3b14b9[_0xbeae('0x11')];this[_0xbeae('0xf')]=_0x3b14b9[_0xbeae('0xf')];this[_0xbeae('0x12')]=_0x1b5310[_0xbeae('0x12')];this[_0xbeae('0x13')]=_0x3b14b9['name'];this[_0xbeae('0x14')]=_0x3b14b9[_0xbeae('0x15')];this[_0xbeae('0x16')]=_0x3b14b9[_0xbeae('0x16')];this['responsetime']=_0x3b14b9[_0xbeae('0x17')];this[_0xbeae('0x18')]=moment()[_0xbeae('0x19')](_0xbeae('0x1a'));this[_0xbeae('0x1b')]=getSeconds(_0x3b14b9[_0xbeae('0x17')],_0x3b14b9[_0xbeae('0x16')]);this[_0xbeae('0x1c')]=0x0;this[_0xbeae('0x1d')]=getSeconds(this['endtime'],_0x3b14b9['responsetime']);this['queue']=_0x3b14b9[_0xbeae('0x1e')];this[_0xbeae('0x1f')]=_0xbeae('0x20');this[_0xbeae('0x21')]=_0x1b5310['cause-txt'];this[_0xbeae('0x22')]=_0x3b14b9[_0xbeae('0x22')];this['callbackuniqueid']=_0x3b14b9['callbackuniqueid'];this[_0xbeae('0x23')]=_0x3b14b9[_0xbeae('0x23')];this[_0xbeae('0x24')]=_0x3b14b9['recallme'];this['ContactId']=_0x3b14b9['ContactId'];this['ListId']=_0x3b14b9['ListId'];this[_0xbeae('0x25')]=_0x3b14b9[_0xbeae('0x25')];this[_0xbeae('0x26')]=_0x3b14b9['VoiceQueueId'];this[_0xbeae('0x27')]=_0x3b14b9[_0xbeae('0x27')];}module[_0xbeae('0x28')]=Hangup;
\ No newline at end of file
+var _0xf8ba=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','endtime','membername','IVR','reason','cause-txt'];(function(_0x2e26b6,_0x2e6a38){var _0x2e6b22=function(_0x421a9f){while(--_0x421a9f){_0x2e26b6['push'](_0x2e26b6['shift']());}};_0x2e6b22(++_0x2e6a38);}(_0xf8ba,0x13e));var _0xaf8b=function(_0x5e847c,_0x373db5){_0x5e847c=_0x5e847c-0x0;var _0x4dd394=_0xf8ba[_0x5e847c];return _0x4dd394;};'use strict';var util=require('util');var _=require(_0xaf8b('0x0'));var moment=require(_0xaf8b('0x1'));function getSeconds(_0x1cc561,_0xd2ee12){var _0x411dc=moment(_0x1cc561)[_0xaf8b('0x2')](0x0);var _0x105109=moment(_0xd2ee12)[_0xaf8b('0x2')](0x0);return _0x411dc['diff'](_0x105109,'seconds');}function Hangup(_0x37a9a5,_0xa96d7d){this['state']=0x4;this[_0xaf8b('0x3')]=_0xaf8b('0x4');this[_0xaf8b('0x5')]=_0x37a9a5[_0xaf8b('0x5')];this[_0xaf8b('0x6')]=_0x37a9a5['type'];this[_0xaf8b('0x7')]=_0x37a9a5[_0xaf8b('0x6')]===_0xaf8b('0x8')?_0xaf8b('0x9'):_0x37a9a5['type'];this[_0xaf8b('0xa')]=_0x37a9a5[_0xaf8b('0xa')];this[_0xaf8b('0xb')]=_0x37a9a5[_0xaf8b('0xb')];this[_0xaf8b('0xc')]=_0x37a9a5[_0xaf8b('0xc')];this[_0xaf8b('0xd')]=_0x37a9a5[_0xaf8b('0xa')]+_0x37a9a5[_0xaf8b('0xb')]+_0x37a9a5[_0xaf8b('0xc')]+_0x37a9a5['countnosuchnumberretry']+_0x37a9a5['countdropretry']+_0x37a9a5['countabandonedretry']+_0x37a9a5[_0xaf8b('0xe')]+_0x37a9a5['countagentrejectretry'];this[_0xaf8b('0xf')]=_0x37a9a5[_0xaf8b('0xf')];this[_0xaf8b('0x10')]=_0x37a9a5[_0xaf8b('0x10')];this[_0xaf8b('0x11')]=_0x37a9a5[_0xaf8b('0x11')];this[_0xaf8b('0xe')]=_0x37a9a5[_0xaf8b('0xe')];this[_0xaf8b('0x12')]=_0x37a9a5[_0xaf8b('0x12')];this[_0xaf8b('0x13')]=_0xa96d7d[_0xaf8b('0x13')];this[_0xaf8b('0x14')]=_0x37a9a5[_0xaf8b('0x15')];this[_0xaf8b('0x16')]=_0x37a9a5[_0xaf8b('0x17')];this[_0xaf8b('0x18')]=_0x37a9a5[_0xaf8b('0x18')];this[_0xaf8b('0x19')]=_0x37a9a5['responsetime'];this['endtime']=moment()[_0xaf8b('0x1a')](_0xaf8b('0x1b'));this[_0xaf8b('0x1c')]=getSeconds(_0x37a9a5[_0xaf8b('0x19')],_0x37a9a5[_0xaf8b('0x18')]);this['holdtime']=0x0;this['talktime']=getSeconds(this[_0xaf8b('0x1d')],_0x37a9a5[_0xaf8b('0x19')]);this[_0xaf8b('0x9')]=_0x37a9a5['queue'];this[_0xaf8b('0x1e')]=_0xaf8b('0x1f');this[_0xaf8b('0x20')]=_0xa96d7d[_0xaf8b('0x21')];this[_0xaf8b('0x22')]=_0x37a9a5[_0xaf8b('0x22')];this['callbackuniqueid']=_0x37a9a5[_0xaf8b('0x23')];this[_0xaf8b('0x24')]=_0x37a9a5[_0xaf8b('0x24')];this['recallme']=_0x37a9a5[_0xaf8b('0x25')];this[_0xaf8b('0x26')]=_0x37a9a5[_0xaf8b('0x26')];this[_0xaf8b('0x27')]=_0x37a9a5['ListId'];this[_0xaf8b('0x28')]=_0x37a9a5[_0xaf8b('0x28')];this[_0xaf8b('0x29')]=_0x37a9a5[_0xaf8b('0x29')];this[_0xaf8b('0x2a')]=_0x37a9a5[_0xaf8b('0x2a')];}module[_0xaf8b('0x2b')]=Hangup;
\ No newline at end of file
index d6d45b8..c118776 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xddb5=['lodash','moment','milliseconds','diff','seconds','uniqueid','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xddb5,0x120));var _0x5ddb=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xddb5[_0x2f5ac5];return _0x37c9a8;};'use strict';var util=require('util');var _=require(_0x5ddb('0x0'));var moment=require(_0x5ddb('0x1'));function getSeconds(_0xe58d5,_0x57036e){var _0x380956=moment(_0xe58d5)[_0x5ddb('0x2')](0x0);var _0x5142a1=moment(_0x57036e)[_0x5ddb('0x2')](0x0);return _0x380956[_0x5ddb('0x3')](_0x5142a1,_0x5ddb('0x4'));}function History(_0x34bdc2){this['uniqueid']=_0x34bdc2[_0x5ddb('0x5')];this['scheduledat']=_0x34bdc2['scheduledat']||undefined;this['type']=_0x34bdc2[_0x5ddb('0x6')];this['campaigntype']=_0x34bdc2[_0x5ddb('0x6')]==='outbound'?_0x5ddb('0x7'):_0x34bdc2[_0x5ddb('0x6')];this[_0x5ddb('0x8')]=_0x34bdc2['countbusyretry'];this[_0x5ddb('0x9')]=_0x34bdc2['countcongestionretry'];this['countnoanswerretry']=_0x34bdc2[_0x5ddb('0xa')];this[_0x5ddb('0xb')]=_0x34bdc2[_0x5ddb('0x8')]+_0x34bdc2[_0x5ddb('0x9')]+_0x34bdc2[_0x5ddb('0xa')]+_0x34bdc2[_0x5ddb('0xc')]+_0x34bdc2['countdropretry']+_0x34bdc2[_0x5ddb('0xd')]+_0x34bdc2[_0x5ddb('0xe')]+_0x34bdc2[_0x5ddb('0xf')];this[_0x5ddb('0xc')]=_0x34bdc2['countnosuchnumberretry'];this[_0x5ddb('0x10')]=_0x34bdc2[_0x5ddb('0x10')];this[_0x5ddb('0xd')]=_0x34bdc2[_0x5ddb('0xd')];this['countmachineretry']=_0x34bdc2[_0x5ddb('0xe')];this['countagentrejectretry']=_0x34bdc2[_0x5ddb('0xf')];this[_0x5ddb('0x7')]=_0x34bdc2['queue'];this[_0x5ddb('0x11')]=_0x34bdc2[_0x5ddb('0x12')];this['calleridnum']=_0x34bdc2[_0x5ddb('0x13')];this[_0x5ddb('0x14')]=_0x34bdc2[_0x5ddb('0x14')];this[_0x5ddb('0x15')]=_0x34bdc2[_0x5ddb('0x15')];this[_0x5ddb('0x16')]=_0x34bdc2[_0x5ddb('0x15')];this[_0x5ddb('0x17')]=getSeconds(_0x34bdc2[_0x5ddb('0x15')],_0x34bdc2[_0x5ddb('0x14')]);this['holdtime']=0x0;this[_0x5ddb('0x18')]=0x0;this[_0x5ddb('0x19')]=_0x34bdc2['callback'];this[_0x5ddb('0x1a')]=_0x34bdc2[_0x5ddb('0x1a')];this[_0x5ddb('0x1b')]=_0x34bdc2[_0x5ddb('0x1b')];this[_0x5ddb('0x1c')]=_0x34bdc2[_0x5ddb('0x1c')];this['ContactId']=_0x34bdc2[_0x5ddb('0x1d')];this['ListId']=_0x34bdc2[_0x5ddb('0x1e')];this[_0x5ddb('0x1f')]=_0x34bdc2[_0x5ddb('0x1f')];this[_0x5ddb('0x20')]=_0x34bdc2[_0x5ddb('0x20')];this[_0x5ddb('0x21')]=_0x34bdc2[_0x5ddb('0x21')];this[_0x5ddb('0x22')]=_0x34bdc2['originatecalleridnum']||'';this['originatecalleridname']=_0x34bdc2[_0x5ddb('0x23')]||'';}module['exports']=History;
\ No newline at end of file
+var _0xac90=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','endtime','ringtime','responsetime','holdtime','callback','callbackuniqueid'];(function(_0x5d1faa,_0x482950){var _0x24c20b=function(_0x372ead){while(--_0x372ead){_0x5d1faa['push'](_0x5d1faa['shift']());}};_0x24c20b(++_0x482950);}(_0xac90,0x1d1));var _0x0ac9=function(_0x1ef551,_0x3d29ef){_0x1ef551=_0x1ef551-0x0;var _0x391087=_0xac90[_0x1ef551];return _0x391087;};'use strict';var util=require(_0x0ac9('0x0'));var _=require(_0x0ac9('0x1'));var moment=require(_0x0ac9('0x2'));function getSeconds(_0x4fe41c,_0xecbaa8){var _0x1e67b6=moment(_0x4fe41c)['milliseconds'](0x0);var _0x47207f=moment(_0xecbaa8)['milliseconds'](0x0);return _0x1e67b6['diff'](_0x47207f,_0x0ac9('0x3'));}function History(_0xb8924){this[_0x0ac9('0x4')]=_0xb8924['uniqueid'];this[_0x0ac9('0x5')]=_0xb8924[_0x0ac9('0x5')]||undefined;this[_0x0ac9('0x6')]=_0xb8924[_0x0ac9('0x6')];this[_0x0ac9('0x7')]=_0xb8924[_0x0ac9('0x6')]===_0x0ac9('0x8')?_0x0ac9('0x9'):_0xb8924[_0x0ac9('0x6')];this['countbusyretry']=_0xb8924[_0x0ac9('0xa')];this['countcongestionretry']=_0xb8924[_0x0ac9('0xb')];this['countnoanswerretry']=_0xb8924[_0x0ac9('0xc')];this['countglobal']=_0xb8924[_0x0ac9('0xa')]+_0xb8924['countcongestionretry']+_0xb8924['countnoanswerretry']+_0xb8924[_0x0ac9('0xd')]+_0xb8924[_0x0ac9('0xe')]+_0xb8924[_0x0ac9('0xf')]+_0xb8924[_0x0ac9('0x10')]+_0xb8924['countagentrejectretry'];this[_0x0ac9('0xd')]=_0xb8924[_0x0ac9('0xd')];this[_0x0ac9('0xe')]=_0xb8924['countdropretry'];this['countabandonedretry']=_0xb8924[_0x0ac9('0xf')];this[_0x0ac9('0x10')]=_0xb8924['countmachineretry'];this[_0x0ac9('0x11')]=_0xb8924[_0x0ac9('0x11')];this[_0x0ac9('0x9')]=_0xb8924[_0x0ac9('0x9')];this[_0x0ac9('0x12')]=_0xb8924[_0x0ac9('0x13')];this[_0x0ac9('0x14')]=_0xb8924[_0x0ac9('0x15')];this[_0x0ac9('0x16')]=_0xb8924[_0x0ac9('0x16')];this['responsetime']=_0xb8924['responsetime'];this[_0x0ac9('0x17')]=_0xb8924['responsetime'];this[_0x0ac9('0x18')]=getSeconds(_0xb8924[_0x0ac9('0x19')],_0xb8924['starttime']);this[_0x0ac9('0x1a')]=0x0;this['talktime']=0x0;this[_0x0ac9('0x1b')]=_0xb8924[_0x0ac9('0x1b')];this[_0x0ac9('0x1c')]=_0xb8924[_0x0ac9('0x1c')];this[_0x0ac9('0x1d')]=_0xb8924[_0x0ac9('0x1d')];this['recallme']=_0xb8924[_0x0ac9('0x1e')];this[_0x0ac9('0x1f')]=_0xb8924['ContactId'];this[_0x0ac9('0x20')]=_0xb8924[_0x0ac9('0x20')];this[_0x0ac9('0x21')]=_0xb8924[_0x0ac9('0x21')];this[_0x0ac9('0x22')]=_0xb8924[_0x0ac9('0x22')];this[_0x0ac9('0x23')]=_0xb8924[_0x0ac9('0x23')];this[_0x0ac9('0x24')]=_0xb8924[_0x0ac9('0x24')]||'';this['originatecalleridname']=_0xb8924[_0x0ac9('0x25')]||'';}module['exports']=History;
\ No newline at end of file
index 856ce1d..215c43c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x292b=['custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','dialPredictiveInterval','startMethodPredictive','recalculate\x20predictive\x20at','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','check\x20failure','floor','erlangCallToSecond','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','RUNNING','[actionOriginate]\x20','Contact.phone','loggerHandler','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','syncQueueSummary','defaults','redis','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./final','./agentComplete','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','startPredictive','ivrOriginated','queueBookedRR','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','custom:queuesummarycomplete','hangup','syncHangup','syncNewExten','varset','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','type','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','preview','string','\x22\x22\x20<>','debug','inspect','error','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','IS_DISACTIVED','state','endtime','[uniqueid]','clearZombieChannels','actions','[actions]','undefined','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','[countReScheduled]\x20','checkIsBlackList','catch','[checkIsBlackList]\x20','resolve','verifyAdditionalPhones','swapAdditionalPhones','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','pick','ListId','UserId','VoiceQueueId','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','statedesc','HangupInAMD','membername','custom:amd','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','AMD','countmachineretry','emit','amd','[syncAgentComplete][createHistory][0]','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','CampaignId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countglobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','reason19\x20machine....','createStateFinal','add','YYYY-MM-DD\x20HH:mm:ss','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','Unknow','syncAgentComplete','reason','agent','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedMaxRetry','ContactId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','strategy','locked','stateinterface','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','paused','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','INTERVAL_IS_NULL','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','command','iftime\x20%s,%s','interval','true','content','indexOf','all','some','INTERVAL_IS_OVERTIME','Global:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','booked','method\x20not\x20recognized','handleIvr','dialMethod','loggedIn','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','launchHandleIvr','\x5cw{0,','pow','replace','random','match','originate','voiceQueue\x20is\x20undefine','phone','\x22agi://%s/square,%s\x22','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','NONE','dialer','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','object','[callProgressDetecting]','entity\x20is\x20undefine','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer'];(function(_0x12cf7b,_0x4a6592){var _0x46da25=function(_0x1e0a46){while(--_0x1e0a46){_0x12cf7b['push'](_0x12cf7b['shift']());}};_0x46da25(++_0x4a6592);}(_0x292b,0x64));var _0xb292=function(_0x1098db,_0x39ba6b){_0x1098db=_0x1098db-0x0;var _0x14f090=_0x292b[_0x1098db];return _0x14f090;};'use strict';var util=require(_0xb292('0x0'));var _=require(_0xb292('0x1'));var BPromise=require(_0xb292('0x2'));var uuid=require(_0xb292('0x3'));var moment=require(_0xb292('0x4'));var rr=require('rr');var md5=require(_0xb292('0x5'));var Redis=require(_0xb292('0x6'));var ut=require(_0xb292('0x7'));var config=require(_0xb292('0x8'));var logger=require(_0xb292('0x9'))('dialer');var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0xb292('0x9'))(_0xb292('0xa'));var loggerPredictiveCalls=require(_0xb292('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xb292('0x9'))(_0xb292('0xb'));var ami=require('../ami');config['redis']=_[_0xb292('0xc')](config[_0xb292('0xd')],{'host':_0xb292('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb292('0xd')]));var cmHopper=require(_0xb292('0xf'));var cmHopperHistory=require(_0xb292('0x10'));var cmHopperFinal=require(_0xb292('0x11'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0xb292('0x12'));var voiceQueueRt=require(_0xb292('0x13'));var RpcSetting=require(_0xb292('0x14'));var Action=require(_0xb292('0x15'));var History=require('./history');var Final=require(_0xb292('0x16'));var AgentComplete=require(_0xb292('0x17'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process['env'][_0xb292('0x18')]||_0xb292('0x19');var strategy={'rrmemory':_0xb292('0x1a'),'roundrobin':_0xb292('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xb292('0x1c')][_0xb292('0x1d')]=function(_0x18b43c){this['tail']=this[_0xb292('0x1e')]?this[_0xb292('0x1e')][_0xb292('0x1f')](_0x18b43c):_0x18b43c();};function Dialer(_0x3d38f4,_0x183287){this[_0xb292('0x20')]=new Sequence();this['preview']=_0x183287;this[_0xb292('0x21')]=_0x3d38f4[_0xb292('0x21')];this[_0xb292('0x22')]=_0x3d38f4[_0xb292('0x22')];this[_0xb292('0x23')]=_0x3d38f4[_0xb292('0x23')];this[_0xb292('0x24')]=_0x3d38f4['trunks'];this[_0xb292('0x25')]=config[_0xb292('0x25')]||0x2;this[_0xb292('0x26')]={};this['actions']={};this[_0xb292('0x27')]={};this[_0xb292('0x28')]={};this['optionPredictive']={};this[_0xb292('0x29')]={};this['startProgressive']={};this[_0xb292('0x2a')]={};this['queueBooked']={};this[_0xb292('0x2b')]={};ami['on']('agentconnect',this[_0xb292('0x2c')]['bind'](this));ami['on'](_0xb292('0x2d'),this[_0xb292('0x2e')][_0xb292('0x2f')](this));ami['on'](_0xb292('0x30'),this[_0xb292('0x31')][_0xb292('0x2f')](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on']('custom:queuesummary',this[_0xb292('0xb')][_0xb292('0x2f')](this));ami['on'](_0xb292('0x32'),this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0xb292('0x33'),this[_0xb292('0x34')]['bind'](this));ami['on']('newexten',this[_0xb292('0x35')][_0xb292('0x2f')](this));ami['on'](_0xb292('0x36'),this['syncVarSet'][_0xb292('0x2f')](this));ami['on']('queuemember',this[_0xb292('0x37')][_0xb292('0x2f')](this));ami['on'](_0xb292('0x38'),this[_0xb292('0x39')][_0xb292('0x2f')](this));this[_0xb292('0x3a')]();this[_0xb292('0x3b')]();RpcSetting['getSettings']()[_0xb292('0x3c')](function(_0x139626){previewRecallmeReminderInterval=_0x139626[_0xb292('0x3d')];});}function isNotNull(_0x26c2a8){return _0x26c2a8!==null&&!_['isUndefined'](_0x26c2a8);}function checkIsLoggedIn(_0x234fdc,_0x110384){return function(){if(_0x110384<=0x0){_0x234fdc[_0xb292('0x3e')]=_0xb292('0x3f');throw _0x234fdc[_0xb292('0x40')]+_0xb292('0x41');}};}function isActive(_0x32f62e){return _0x32f62e;}function checkIsActive(_0x1c3662,_0x31dc62){return function(){if(!isActive(_0x31dc62)){_0x1c3662[_0xb292('0x3e')]=_0xb292('0x42');throw _0x1c3662['name']+_0xb292('0x43');}};}function checkInterval(_0x23fe0e){return function(){if(!isNotNull(_0x23fe0e[_0xb292('0x44')])){_0x23fe0e[_0xb292('0x3e')]='INTERVAL_IS_NULL';throw _0x23fe0e['name']+_0xb292('0x45');}if(!isNotNull(_0x23fe0e[_0xb292('0x44')][_0xb292('0x46')])){_0x23fe0e[_0xb292('0x3e')]='INTERVAL_IS_NULL';throw _0x23fe0e['name']+_0xb292('0x45');}if(!isNotNull(_[_0xb292('0x47')](_0x23fe0e[_0xb292('0x44')][_0xb292('0x46')]))){_0x23fe0e[_0xb292('0x3e')]='INTERVAL_IS_NULL';throw _0x23fe0e[_0xb292('0x40')]+_0xb292('0x45');}};}function msgResponse(_0xed9ab7,_0x335d9c,_0x3ccbe7){return{'action':_0xed9ab7,'response':_0x335d9c,'message':_0x3ccbe7,'stack':_0x3ccbe7};}function myreject(_0x55b2a7){return function(_0xb5317f){return _0x55b2a7(msgResponse(_0xb292('0x48'),_0xb292('0x49'),JSON[_0xb292('0x4a')](_0xb5317f)));};}function getSeconds(_0xb0680c,_0x1a9186){var _0x307805=moment(_0xb0680c)['milliseconds'](0x0);var _0x40d82c=moment(_0x1a9186)[_0xb292('0x4b')](0x0);return _0x307805[_0xb292('0x4c')](_0x40d82c,_0xb292('0x4d'));}function emit(_0x34476b,_0x4bb78f,_0x1756c3){io['to'](_0x34476b)['emit'](_0x4bb78f,_0x1756c3);}function emitVoiceQueueSummary(_0x248bfb){if(_0x248bfb[_0xb292('0x4e')]==='outbound'){var _0x26c92b={'id':_0x248bfb['id'],'name':_0x248bfb[_0xb292('0x40')],'strategy':_0x248bfb['strategy'],'answered':_0x248bfb[_0xb292('0x4f')],'available':_0x248bfb[_0xb292('0x50')],'loggedIn':_0x248bfb['loggedIn'],'pTalking':_0x248bfb[_0xb292('0x51')],'sumBillable':_0x248bfb[_0xb292('0x52')],'sumDuration':_0x248bfb[_0xb292('0x53')],'sumHoldTime':_0x248bfb[_0xb292('0x54')]||0x0,'talking':_0x248bfb[_0xb292('0x55')],'total':_0x248bfb[_0xb292('0x56')],'type':_0x248bfb['type'],'unmanaged':_0x248bfb[_0xb292('0x57')],'abandoned':_0x248bfb[_0xb292('0x58')],'waiting':_0x248bfb['waiting'],'loggedInDb':_0x248bfb[_0xb292('0x59')],'dialActive':_0x248bfb[_0xb292('0x5a')],'dialMethod':_0x248bfb['dialMethod'],'dialOriginateCallerIdName':_0x248bfb[_0xb292('0x5b')],'dialOriginateCallerIdNumber':_0x248bfb[_0xb292('0x5c')],'dialOriginateTimeout':_0x248bfb[_0xb292('0x5d')],'dialPrefix':_0x248bfb[_0xb292('0x5e')],'outboundAnswerAgiCallsDay':_0x248bfb[_0xb292('0x5f')],'outboundAnswerCallsDay':_0x248bfb[_0xb292('0x60')],'outboundBlacklistCallsDay':_0x248bfb['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x248bfb[_0xb292('0x61')],'outboundCongestionCallsDay':_0x248bfb[_0xb292('0x62')],'outboundDropCallsDayACS':_0x248bfb[_0xb292('0x63')],'outboundDropCallsDayCallersExit':_0x248bfb[_0xb292('0x64')],'outboundDropCallsDayTimeout':_0x248bfb[_0xb292('0x65')],'outboundNoAnswerCallsDay':_0x248bfb['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x248bfb[_0xb292('0x66')],'outboundOriginateFailureCallsDay':_0x248bfb[_0xb292('0x67')],'outboundReCallsDay':_0x248bfb[_0xb292('0x68')],'outboundRejectCallsDay':_0x248bfb['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x248bfb[_0xb292('0x69')],'predictiveIntervalAnsweredCalls':_0x248bfb[_0xb292('0x6a')],'predictiveIntervalAvgHoldtime':_0x248bfb[_0xb292('0x6b')],'predictiveIntervalAvgTalktime':_0x248bfb[_0xb292('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0x248bfb[_0xb292('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0x248bfb[_0xb292('0x6e')],'predictiveIntervalErlangCalls':_0x248bfb[_0xb292('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x248bfb[_0xb292('0x70')],'predictiveIntervalHitRate':_0x248bfb[_0xb292('0x71')],'predictiveIntervalMultiplicativeFactor':_0x248bfb[_0xb292('0x72')],'predictiveIntervalPauses':_0x248bfb[_0xb292('0x73')],'predictiveIntervalAvailable':_0x248bfb[_0xb292('0x74')],'predictiveIntervalTotalCalls':_0x248bfb['predictiveIntervalTotalCalls'],'message':_0x248bfb['message'],'originated':_0x248bfb[_0xb292('0x75')],'erlangCalls':_0x248bfb[_0xb292('0x76')],'erlangCallToSecond':_0x248bfb['erlangCallToSecond'],'erlangAbandonmentRate':_0x248bfb[_0xb292('0x77')],'erlangBusyFactor':_0x248bfb[_0xb292('0x78')],'startPredictive':_0x248bfb[_0xb292('0x29')],'startProgressive':_0x248bfb[_0xb292('0x79')]};if(_0x248bfb[_0xb292('0x7a')]){_0x26c92b[_0xb292('0x7a')]={'id':_0x248bfb[_0xb292('0x7a')]['id'],'name':_0x248bfb[_0xb292('0x7a')][_0xb292('0x40')],'active':_0x248bfb[_0xb292('0x7a')][_0xb292('0x7b')],'callerid':_0x248bfb['Trunk'][_0xb292('0x7c')]};}if(_0x248bfb['Interval']){_0x26c92b['Interval']={'id':_0x248bfb[_0xb292('0x44')]['id'],'name':_0x248bfb[_0xb292('0x44')]['name']};}var _0x49482f=md5(JSON[_0xb292('0x4a')](_0x26c92b));if(_0x248bfb['md5']!==_0x49482f){_0x248bfb[_0xb292('0x5')]=_0x49482f;emit(util[_0xb292('0x7d')]('voice:queue:%s',_0x26c92b[_0xb292('0x40')]),_0xb292('0x7e'),_0x26c92b);}}}function emitCampaignSummary(_0x3b84e5){if(_0x3b84e5['type']===_0xb292('0x7f')){emit(util[_0xb292('0x7d')](_0xb292('0x80'),_0x3b84e5[_0xb292('0x40')]),_0xb292('0x81'),_0x3b84e5);}}function checkGetDataPredictive(_0x37c820){if(isNotNull(_0x37c820)&&!_[_0xb292('0x47')](_0x37c820)){loggerPredictive[_0xb292('0x82')](_0xb292('0x83'));loggerPredictive[_0xb292('0x82')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37c820[_0xb292('0x84')]);loggerPredictive['info'](_0xb292('0x85'),_0x37c820[_0xb292('0x6a')]);loggerPredictive['info'](_0xb292('0x86'),_0x37c820[_0xb292('0x6e')]);loggerPredictive[_0xb292('0x82')](_0xb292('0x87'),_0x37c820[_0xb292('0x6d')]);loggerPredictive[_0xb292('0x82')](_0xb292('0x88'),_0x37c820[_0xb292('0x6b')]);loggerPredictive[_0xb292('0x82')](_0xb292('0x89'),_0x37c820[_0xb292('0x6c')]);loggerPredictive['info'](_0xb292('0x8a'));if(_0x37c820[_0xb292('0x84')]>0x0){if(!_[_0xb292('0x8b')](_0x37c820[_0xb292('0x6c')])&&_0x37c820[_0xb292('0x6c')]>0x0){return!![];}loggerPredictive[_0xb292('0x82')](_0xb292('0x8c'));if(!_[_0xb292('0x8b')](_0x37c820[_0xb292('0x6b')])&&_0x37c820[_0xb292('0x6b')]>0x0){return!![];}loggerPredictive[_0xb292('0x82')](_0xb292('0x8d'));}else{loggerPredictive[_0xb292('0x82')](_0xb292('0x8e'));}}else{loggerPredictive['info'](_0xb292('0x8f'));}return![];}function mergeDataErlangB(_0x11ab13){return function(_0x768951){loggerPredictive[_0xb292('0x82')](_0xb292('0x90'));loggerPredictive[_0xb292('0x82')](_0xb292('0x91'),_0x768951['erlangCalls']);loggerPredictive[_0xb292('0x82')](_0xb292('0x92'),_0x768951['erlangCallToSecond']);loggerPredictive[_0xb292('0x82')](_0xb292('0x93'),_0x768951['erlangAbandonmentRate']);loggerPredictive[_0xb292('0x82')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x768951[_0xb292('0x78')]);loggerPredictive['info'](_0xb292('0x93'),_0x768951[_0xb292('0x77')]);loggerPredictive[_0xb292('0x82')](_0xb292('0x8a'));_[_0xb292('0x94')](_0x11ab13,_0x768951);};}function getDiff(_0x5cf371){var _0x14b00b=moment()[_0xb292('0x4b')](0x0);var _0x24da67=moment(_0x5cf371)['milliseconds'](0x0);return _0x14b00b[_0xb292('0x4c')](_0x24da67,'seconds');}function ifInterval(_0x4f05fc,_0x5cf20a){if(_['isUndefined'](_0x5cf20a)){return![];}return getDiff(_0x5cf20a)<_0x4f05fc*0x3c;}function freeVariablesPredictive(_0x553e36){if(isNotNull(_0x553e36)){if(!_[_0xb292('0x8b')](_0x553e36[_0xb292('0x79')])){_0x553e36[_0xb292('0x79')]=undefined;loggerPredictive[_0xb292('0x82')](_0x553e36['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xb292('0x8b')](_0x553e36[_0xb292('0x29')])){_0x553e36[_0xb292('0x29')]=undefined;loggerPredictive[_0xb292('0x82')](_0x553e36[_0xb292('0x40')],_0xb292('0x95'));}if(!_[_0xb292('0x8b')](_0x553e36[_0xb292('0x96')])){clearInterval(_0x553e36[_0xb292('0x96')]);_0x553e36[_0xb292('0x96')]=undefined;loggerPredictive['info'](_0x553e36['name'],_0xb292('0x97'));}}}function erlangb(_0x2e6036,_0x48a2bc){if(_0x48a2bc===0x0){return 0x0;}var _0x12b152=0x1;for(var _0x2411fe=0x1;_0x2411fe<=_0x48a2bc;_0x2411fe+=0x1){_0x12b152=0x1+_0x12b152*_0x2411fe/_0x2e6036;}return 0x1/_0x12b152;}function isVoiceQueueOutbound(_0x58fd8d){return _0x58fd8d===_0xb292('0x98');}function isNotPreview(_0x8943a5){return _0x8943a5!==_0xb292('0x99');}function isCampaignIvr(_0x5e6620){return _0x5e6620===_0xb292('0x7f');}function getCallerId(_0x20e955,_0x14eb32,_0x31548b){if(!_['isUndefined'](_0x31548b)&&typeof _0x31548b===_0xb292('0x9a')&&!_['isEmpty'](_0x31548b)){if(!_[_0xb292('0x8b')](_0x14eb32)&&typeof _0x14eb32==='string'&&!_[_0xb292('0x47')](_0x14eb32)){return util[_0xb292('0x7d')]('\x22%s\x22\x20<%s>',_0x14eb32,_0x31548b);}return util[_0xb292('0x7d')]('\x22%s\x22\x20<%s>',_0x31548b,_0x31548b);}if(!_[_0xb292('0x8b')](_0x20e955)&&typeof _0x20e955===_0xb292('0x9a')&&!_[_0xb292('0x47')](_0x20e955)){return _0x20e955;}return _0xb292('0x9b');}function loggerCatchQueueSummary(_0x2a9edc,_0x13f7ca){return function(_0xc6a0bc){freeVariablesPredictive(_0x13f7ca);emitVoiceQueueSummary(_0x13f7ca);emitCampaignSummary(_0x13f7ca);loggerSyncQueueSummary[_0xb292('0x9c')](_0x2a9edc,util[_0xb292('0x9d')](_0xc6a0bc,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x216a2c,_0x107d18){return function(_0x5b48f3){loggerPredictive['error'](_0x107d18['name'],_0x216a2c);loggerPredictive[_0xb292('0x9e')](_0x5b48f3[_0xb292('0x9f')]);freeVariablesPredictive(_0x107d18);};}function loggerCatch(_0x553d22){return function(_0x43d5ea){logger[_0xb292('0x9e')](_0x553d22,util[_0xb292('0x9d')](_0x43d5ea,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3ce46b){return _0x3ce46b&&!_[_0xb292('0x8b')](_0x3ce46b)&&_0x3ce46b[_0xb292('0xa0')]>0x0;}function decremetOriginate(_0x404f9f){if(!_[_0xb292('0x8b')](_0x404f9f)&&_0x404f9f!==null){if(typeof _0x404f9f['originated']!=='undefined'){if(_0x404f9f[_0xb292('0x75')]>0x0){_0x404f9f[_0xb292('0x75')]-=0x1;}else{logger[_0xb292('0x9e')](_0xb292('0xa1'));}}}else{logger['error'](_0xb292('0xa2'));}}function checkContactLowerLimitOriginate(_0x56b1a8,_0x34d649,_0x2ce730){if(_0x34d649>_0x2ce730){for(var _0x7f5627=0x0;_0x7f5627<_0x34d649-_0x2ce730;_0x7f5627+=0x1){decremetOriginate(_0x56b1a8);}}}function loggerGetContactDialer(_0x25a5f9,_0x198aa1,_0x5b8448){return function(_0x3c1ee3){checkContactLowerLimitOriginate(_0x198aa1,_0x5b8448,0x0);logger[_0xb292('0x9e')](_0x25a5f9,util[_0xb292('0x9d')](_0x3c1ee3,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x54ffe3){return function(_0x177143){if(isNotNull(_0x177143)&&isNotNull(_0x177143[0x0])){if(_0x177143[0x0][_0xb292('0xa3')]>0x0){_0x54ffe3[_0xb292('0x3e')]=_0xb292('0xa4');logger[_0xb292('0x82')](_0xb292('0xa5')+_0x54ffe3[_0xb292('0x40')],_0x177143[0x0][_0xb292('0xa3')],_0xb292('0xa6'));}else{_0x54ffe3['message']=_0xb292('0xa7');logger[_0xb292('0x82')](_0xb292('0xa8')+_0x54ffe3[_0xb292('0x40')]);}}};}function notSendMessagesQueue(_0x56553b){if(_0x56553b[_0xb292('0xa9')]){freeVariablesPredictive(_0x56553b);if(_0x56553b[_0xb292('0x75')]===0x0&&_0x56553b['talking']===0x0&&_0x56553b[_0xb292('0xaa')]===0x0&&(_0x56553b['pTalking']||0x0)===0x0){_0x56553b[_0xb292('0xa9')]=![];_0x56553b[_0xb292('0x50')]=0x0;_0x56553b[_0xb292('0x3e')]=_0xb292('0x42');loggerSyncQueueSummary[_0xb292('0x9c')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x56553b[_0xb292('0x40')],_0xb292('0xab'));}else{_0x56553b[_0xb292('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xb292('0x9c')](_0xb292('0xac'),_0x56553b[_0xb292('0x40')],_0xb292('0xad'));}emitVoiceQueueSummary(_0x56553b);}}function notSendMessagesCampaign(_0x35b5be){if(_0x35b5be['sendMessageOneNotActive']){if(_0x35b5be['originated']===0x0){_0x35b5be['sendMessageOneNotActive']=![];_0x35b5be[_0xb292('0x3e')]=_0xb292('0x42');loggerSyncQueueSummary[_0xb292('0x9c')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x35b5be['name'],_0xb292('0xab'));}else{_0x35b5be['message']=_0xb292('0xae');loggerSyncQueueSummary[_0xb292('0x9c')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x35b5be[_0xb292('0x40')],_0xb292('0xad'));}emitCampaignSummary(_0x35b5be);}}function createObjHistory(_0x305af1,_0x19dd38,_0x2ee8cc,_0x435804,_0x6d6971){_0x305af1['message']=_0x2ee8cc;var _0xff1e24=new Action(_0x305af1,_0x19dd38);var _0x5f145a=new History(_0xff1e24);_0x5f145a[_0xb292('0xaf')]=_0x435804;_0x5f145a['statedesc']=_0x6d6971;_0x5f145a[_0xb292('0xb0')]=_0xff1e24['starttime'];return _0x5f145a;}Dialer[_0xb292('0x1c')][_0xb292('0x3b')]=function(){var _0x246f10=this;setInterval(function(){_0x246f10['clearZombieChannels'](_0x246f10['uniqueId'],_0xb292('0xb1'));_0x246f10[_0xb292('0xb2')](_0x246f10[_0xb292('0xb3')],_0xb292('0xb4'));},0x32c8);};Dialer[_0xb292('0x1c')][_0xb292('0xb2')]=function(_0x9ff286,_0x1845a3){var _0x1283ef=this;for(var _0x4adf3a in _0x9ff286){if(typeof _0x9ff286[_0x4adf3a]!==_0xb292('0xb5')){this[_0xb292('0x20')]['enqueue'](function(){if(!_[_0xb292('0xb6')](_0x9ff286[_0x4adf3a])){return ami[_0xb292('0xb7')]({'action':_0xb292('0xb8'),'channel':_0x9ff286[_0x4adf3a][_0xb292('0xb9')]})['catch'](function(_0x5dbc97){if(_0x5dbc97[_0xb292('0x3e')]===_0xb292('0xba')){setTimeout(function(){if(_0x9ff286[_0x4adf3a]&&_0x9ff286[_0x4adf3a]['type']!=='ivr'){_0x1283ef[_0xb292('0xbb')](_0x1283ef['voiceQueues'][_0x9ff286[_0x4adf3a][_0xb292('0xbc')]]);logger[_0xb292('0x9e')]('[Dialer][checkChannel]',_0x1845a3,_0x4adf3a,_0x9ff286[_0x4adf3a][_0xb292('0xbc')]);delete _0x9ff286[_0x4adf3a];}if(_0x9ff286[_0x4adf3a]&&_0x9ff286[_0x4adf3a][_0xb292('0x4e')]===_0xb292('0x7f')){_0x1283ef[_0xb292('0xbb')](_0x1283ef[_0xb292('0x22')][_0x9ff286[_0x4adf3a][_0xb292('0xbc')]]);logger['error'](_0xb292('0xbd'),_0x1845a3,_0x4adf3a,_0x9ff286[_0x4adf3a][_0xb292('0xbc')]);delete _0x9ff286[_0x4adf3a];}},0x2328);}});}});}}};Dialer['prototype'][_0xb292('0xbe')]=function(_0x496770){return BPromise['resolve']()[_0xb292('0x3c')](cmHopper[_0xb292('0xbe')](_0x496770))['catch'](loggerCatch(_0xb292('0xbf')));};Dialer['prototype'][_0xb292('0xc0')]=function(_0x173213){return BPromise['resolve']()[_0xb292('0x3c')](cmHopperBlack[_0xb292('0xc0')](_0x173213))[_0xb292('0xc1')](loggerCatch(_0xb292('0xc2')));};Dialer[_0xb292('0x1c')]['verifyAdditionalPhones']=function(_0x587914,_0x556b50,_0x5ac25a){return BPromise[_0xb292('0xc3')]()[_0xb292('0x3c')](cmHopperAdditionalPhone[_0xb292('0xc4')](_0x587914,_0x556b50,_0x5ac25a))['catch'](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0xb292('0x1c')][_0xb292('0xc5')]=function(_0x579519,_0x1435fe,_0x505016){return BPromise[_0xb292('0xc3')]()[_0xb292('0x3c')](cmHopperAdditionalPhone[_0xb292('0xc5')](_0x579519,_0x1435fe,_0x505016))[_0xb292('0xc1')](loggerCatch('[swapAdditionalPhone]\x20'));};Dialer[_0xb292('0x1c')][_0xb292('0xc6')]=function(_0x42c150){return BPromise['resolve']()['then'](cmHopperBlack[_0xb292('0xc6')](_0x42c150))[_0xb292('0xc1')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xb292('0x1c')][_0xb292('0xc7')]=function(_0x5693e3){return BPromise[_0xb292('0xc3')]()[_0xb292('0x3c')](cmHopperHistory[_0xb292('0xc8')](_0x5693e3))[_0xb292('0xc1')](loggerCatch(_0xb292('0xc9')));};Dialer[_0xb292('0x1c')][_0xb292('0xca')]=function(_0x513f87){return BPromise[_0xb292('0xc3')]()[_0xb292('0x3c')](cmHopper[_0xb292('0xca')](_0x513f87))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xb292('0x1c')][_0xb292('0xcb')]=function(_0x463b44,_0x32606c,_0x52d6f2){return BPromise[_0xb292('0xc3')]()[_0xb292('0x3c')](cmHopper[_0xb292('0xcb')](_0x463b44,_0x32606c,_0x52d6f2))[_0xb292('0xc1')](loggerCatch(_0xb292('0xcc')));};Dialer[_0xb292('0x1c')][_0xb292('0xcd')]=function(_0x29d158,_0x9dea18,_0xd45669,_0x5af590,_0x2cc15e){return BPromise['resolve']()[_0xb292('0x3c')](cmHopper[_0xb292('0xcd')](_0x29d158,_0x9dea18,_0xd45669,_0x5af590))['catch'](function(_0x34f530){_0x2cc15e[_0xb292('0xce')]-=_0xd45669;_0x2cc15e[_0xb292('0xce')]=_0x2cc15e[_0xb292('0xce')]>0x0?_0x2cc15e[_0xb292('0xce')]:0x0;loggerCatch(_0xb292('0xcf'))(_0x34f530);});};Dialer[_0xb292('0x1c')][_0xb292('0xd0')]=function(_0x5ab6c0,_0x2f09cd,_0x2b1e1f,_0x4e96fa){return BPromise[_0xb292('0xc3')]()[_0xb292('0x3c')](cmHopper[_0xb292('0xd0')](_0x5ab6c0,_0x2f09cd,_0x2b1e1f))['catch'](function(_0x2cbf10){_0x4e96fa[_0xb292('0xce')]-=_0x2f09cd;_0x4e96fa[_0xb292('0xce')]=_0x4e96fa[_0xb292('0xce')]>0x0?_0x4e96fa['temp']:0x0;loggerCatch(_0xb292('0xd1'))(_0x2cbf10);});};Dialer[_0xb292('0x1c')][_0xb292('0xd2')]=function(_0x92257b){return BPromise[_0xb292('0xc3')]()[_0xb292('0x3c')](voiceQueueRt[_0xb292('0xd2')](_0x92257b))[_0xb292('0xc1')](loggerCatch(_0xb292('0xd3')));};Dialer[_0xb292('0x1c')][_0xb292('0xd4')]=function(_0x4d82c1){return BPromise[_0xb292('0xc3')]()[_0xb292('0x3c')](cmHopper[_0xb292('0xd4')](_0x4d82c1))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xb292('0x1c')][_0xb292('0xd5')]=function(_0x2909de){return BPromise[_0xb292('0xc3')]()[_0xb292('0x3c')](cmHopperHistory[_0xb292('0xd5')](_0x2909de))['catch'](loggerCatch('[createHistory]\x20'));};Dialer[_0xb292('0x1c')][_0xb292('0xbb')]=function(_0x5dc0a4){if(!_['isUndefined'](_0x5dc0a4)&&_0x5dc0a4!==null){if(typeof _0x5dc0a4[_0xb292('0x75')]!==_0xb292('0xb5')){if(_0x5dc0a4[_0xb292('0x75')]>0x0){_0x5dc0a4[_0xb292('0x75')]-=0x1;}else{logger[_0xb292('0x9e')](_0xb292('0xd6'));}}}else{logger[_0xb292('0x9e')](_0xb292('0xd7'));}};Dialer[_0xb292('0x1c')]['loggerHandler']=function(_0x3bdb83,_0x2f4592){var _0x4acac8=this;return function(_0x2287f4){_0x4acac8[_0xb292('0xbb')](_0x2f4592);logger['error'](_0x3bdb83,util['inspect'](_0x2287f4,{'showHidden':![],'depth':null}));};};Dialer[_0xb292('0x1c')][_0xb292('0xd8')]=function(_0x41b28b,_0x4680f9,_0x3ca8ee){var _0xc828d2={'state':0x19,'statedesc':_0xb292('0xd9')};this[_0xb292('0xbb')](_0x4680f9);this[_0xb292('0xda')](_[_0xb292('0x94')](_0xc828d2,_[_0xb292('0xdb')](_0x3ca8ee,['ContactId',_0xb292('0xdc'),_0xb292('0xdd'),_0xb292('0xde'),'CampaignId'])),'[emptyContact][createHistory]',_0xb292('0xdf'));logger['error'](_0x41b28b);};Dialer[_0xb292('0x1c')][_0xb292('0xe0')]=function(_0x36ee2d){return _0x36ee2d===_0xb292('0xe1');};Dialer[_0xb292('0x1c')][_0xb292('0xe2')]=function(_0x43e66b){return!_[_0xb292('0x8b')](_0x43e66b)&&_0x43e66b&&!_[_0xb292('0x8b')](_0x43e66b[_0xb292('0x40')])&&!_[_0xb292('0x8b')](_0x43e66b[_0xb292('0x7b')])&&_0x43e66b[_0xb292('0x7b')]&&(this['trunks'][util[_0xb292('0x7d')](_0xb292('0xe3'),_0x43e66b[_0xb292('0x40')])][_0xb292('0xb8')]===_0xb292('0xe4')||this[_0xb292('0x24')][util[_0xb292('0x7d')]('SIP/%s',_0x43e66b[_0xb292('0x40')])][_0xb292('0xb8')]===_0xb292('0xe5'));};Dialer['prototype'][_0xb292('0xda')]=function(_0x1d659a,_0x421533,_0xef99c5){this[_0xb292('0xd5')](_0x1d659a)[_0xb292('0xc1')](loggerCatch(_0x421533));this[_0xb292('0xd4')](_0x1d659a)[_0xb292('0xc1')](loggerCatch(_0xef99c5));};Dialer[_0xb292('0x1c')]['syncVarSet']=function(_0x11835f){var _0x27543b=this[_0xb292('0x28')][_0x11835f[_0xb292('0xe6')]];var _0x480c10;if(!_[_0xb292('0xb6')](_0x11835f)&&!_[_0xb292('0xb6')](_0x11835f[_0xb292('0xe7')])&&!_[_0xb292('0xb6')](_0x11835f[_0xb292('0xe7')][_0xb292('0xe8')])&&_0x11835f[_0xb292('0xe9')]===_0xb292('0xea')&&_0x27543b){if(_0x27543b[_0xb292('0x4e')]!==_0xb292('0x7f')&&this[_0xb292('0x21')][_0x27543b[_0xb292('0xbc')]][_0xb292('0xeb')]&&_0x11835f['value']===_0xb292('0xec')){delete this['uniqueId'][_0x11835f[_0xb292('0xe6')]];this[_0xb292('0xbb')](this[_0xb292('0x21')][_0x27543b[_0xb292('0xbc')]]);this[_0xb292('0x21')][_0x27543b['queue']][_0xb292('0x60')]+=0x1;this[_0xb292('0x21')][_0x27543b['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x480c10=new Hangup(_0x27543b,_0x11835f);_0x480c10[_0xb292('0xaf')]=0x12;_0x480c10[_0xb292('0xed')]=_0xb292('0xee');_0x480c10[_0xb292('0xef')]='AMD';ami['emit'](_0xb292('0xf0'),ut[_0xb292('0xf1')](_0x480c10,'amd'));this[_0xb292('0xda')](_0x480c10,_0xb292('0xf2'),_0xb292('0xf3'));}if(_0x27543b[_0xb292('0x4e')]!==_0xb292('0x7f')&&this[_0xb292('0x21')][_0x27543b[_0xb292('0xbc')]][_0xb292('0xeb')]&&_0x11835f[_0xb292('0xf4')]===_0xb292('0xf5')){var _0x15302a=this;return new BPromise(function(_0x113753,_0x4a6174){delete _0x15302a[_0xb292('0x28')][_0x11835f[_0xb292('0xe6')]];_0x15302a[_0xb292('0xbb')](_0x15302a[_0xb292('0x21')][_0x27543b[_0xb292('0xbc')]]);_0x15302a[_0xb292('0x21')][_0x27543b['queue']][_0xb292('0x60')]+=0x1;_0x15302a[_0xb292('0x21')][_0x27543b[_0xb292('0xbc')]][_0xb292('0x5f')]+=0x1;var _0x4b9e4f=_0x15302a[_0xb292('0x21')][_0x27543b[_0xb292('0xbc')]];var _0x22ae4f=new Hangup(_0x27543b,_0x11835f);_0x22ae4f[_0xb292('0xaf')]=0x13;_0x22ae4f[_0xb292('0xed')]='Machine';_0x22ae4f[_0xb292('0xef')]=_0xb292('0xf6');_0x22ae4f[_0xb292('0xf7')]+=0x1;_0x22ae4f['countglobal']+=0x1;_0x22ae4f['amd']=!![];ami[_0xb292('0xf8')](_0xb292('0xf0'),ut[_0xb292('0xf1')](_0x22ae4f,_0xb292('0xf9')));_0x15302a[_0xb292('0xd5')](_0x22ae4f)[_0xb292('0xc1')](loggerCatch(_0xb292('0xfa')));if(_0x22ae4f['countbusyretry']+_0x22ae4f['countcongestionretry']+_0x22ae4f['countnoanswerretry']+_0x22ae4f[_0xb292('0xfb')]+_0x22ae4f[_0xb292('0xfc')]+_0x22ae4f[_0xb292('0xfd')]+_0x22ae4f[_0xb292('0xf7')]+_0x22ae4f['countagentrejectretry']>=_0x4b9e4f[_0xb292('0xfe')]){_0x15302a[_0xb292('0xff')](_0x22ae4f,_0x113753,_0x4a6174,'reason19\x20machine....');}else{if(_0x22ae4f[_0xb292('0xf7')]>=_0x4b9e4f[_0xb292('0x100')]){_0x15302a['createStateFinal'](_0x22ae4f,_0x113753,_0x4a6174,_0xb292('0x101'));}else{_0x15302a['rescheduleContact']({'active':![],'countmachineretry':_0x22ae4f['countmachineretry'],'scheduledat':moment()['add'](_0x4b9e4f[_0xb292('0x102')],_0xb292('0x103'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x22ae4f['ContactId'],'ListId':_0x22ae4f[_0xb292('0xdc')],'VoiceQueueId':_0x22ae4f[_0xb292('0xde')]||undefined,'CampaignId':_0x22ae4f[_0xb292('0x104')]||undefined})[_0xb292('0xc1')](loggerCatch(_0xb292('0x105')));_0x113753({'reschedule':0x1});}}});}if(_0x27543b[_0xb292('0x4e')]===_0xb292('0x7f')&&this[_0xb292('0x22')][_0x27543b['queue']]['dialAMDActive']&&_0x11835f[_0xb292('0xf4')]===_0xb292('0xec')){delete this[_0xb292('0x28')][_0x11835f[_0xb292('0xe6')]];this['updateOriginated'](this[_0xb292('0x22')][_0x27543b[_0xb292('0xbc')]]);_0x480c10=new Hangup(_0x27543b,_0x11835f);_0x480c10[_0xb292('0xaf')]=0x12;_0x480c10[_0xb292('0xed')]=_0xb292('0xee');_0x480c10[_0xb292('0xef')]='AMD';ami[_0xb292('0xf8')](_0xb292('0xf0'),ut[_0xb292('0xf1')](_0x480c10,_0xb292('0xf9')));this[_0xb292('0xda')](_0x480c10,_0xb292('0x106'),_0xb292('0x107'));}if(_0x27543b[_0xb292('0x4e')]===_0xb292('0x7f')&&this['campaigns'][_0x27543b[_0xb292('0xbc')]][_0xb292('0xeb')]&&_0x11835f['value']===_0xb292('0xf5')){var _0x15302a=this;return new BPromise(function(_0x23c5ea,_0xe4e920){delete _0x15302a[_0xb292('0x28')][_0x11835f['uniqueid']];_0x15302a[_0xb292('0xbb')](_0x15302a[_0xb292('0x22')][_0x27543b[_0xb292('0xbc')]]);_0x15302a[_0xb292('0x22')][_0x27543b[_0xb292('0xbc')]][_0xb292('0x60')]+=0x1;_0x15302a[_0xb292('0x22')][_0x27543b[_0xb292('0xbc')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x320bc3=_0x15302a['campaigns'][_0x27543b[_0xb292('0xbc')]];var _0x1dc329=new Hangup(_0x27543b,_0x11835f);_0x1dc329[_0xb292('0xaf')]=0x13;_0x1dc329[_0xb292('0xed')]=_0xb292('0x108');_0x1dc329[_0xb292('0xef')]=_0xb292('0xf6');_0x1dc329['countmachineretry']+=0x1;_0x1dc329[_0xb292('0x109')]+=0x1;_0x1dc329['amd']=!![];ami[_0xb292('0xf8')](_0xb292('0xf0'),ut[_0xb292('0xf1')](_0x1dc329,'amd'));_0x15302a[_0xb292('0xd5')](_0x1dc329)[_0xb292('0xc1')](loggerCatch(_0xb292('0xfa')));if(_0x1dc329[_0xb292('0x10a')]+_0x1dc329[_0xb292('0x10b')]+_0x1dc329[_0xb292('0x10c')]+_0x1dc329[_0xb292('0xfb')]+_0x1dc329[_0xb292('0xfc')]+_0x1dc329['countabandonedretry']+_0x1dc329[_0xb292('0xf7')]+_0x1dc329[_0xb292('0x10d')]>=_0x320bc3[_0xb292('0xfe')]){_0x15302a[_0xb292('0xff')](_0x1dc329,_0x23c5ea,_0xe4e920,_0xb292('0x10e'));}else{if(_0x1dc329['countmachineretry']>=_0x320bc3[_0xb292('0x100')]){_0x15302a[_0xb292('0x10f')](_0x1dc329,_0x23c5ea,_0xe4e920,_0xb292('0x101'));}else{_0x15302a[_0xb292('0xca')]({'active':![],'countmachineretry':_0x1dc329[_0xb292('0xf7')],'scheduledat':moment()[_0xb292('0x110')](_0x320bc3[_0xb292('0x102')],_0xb292('0x103'))[_0xb292('0x7d')](_0xb292('0x111')),'ContactId':_0x1dc329['ContactId'],'ListId':_0x1dc329[_0xb292('0xdc')],'VoiceQueueId':_0x1dc329[_0xb292('0xde')]||undefined,'CampaignId':_0x1dc329[_0xb292('0x104')]||undefined})['catch'](loggerCatch(_0xb292('0x105')));_0x23c5ea({'reschedule':0x1});}}});}}};Dialer[_0xb292('0x1c')]['syncHangup']=function(_0x312912){var _0x12dfb9=this['uniqueId'][_0x312912[_0xb292('0xe6')]];var _0x5ada61=this;var _0x394da6;if(_0x12dfb9&&_0x12dfb9[_0xb292('0x4e')]===_0xb292('0x7f')){delete this[_0xb292('0x28')][_0x312912[_0xb292('0xe6')]];this[_0xb292('0xbb')](this[_0xb292('0x22')][_0x12dfb9[_0xb292('0xbc')]]);this['campaigns'][_0x12dfb9[_0xb292('0xbc')]]['ivrAnswerCallsDay']+=0x1;_0x394da6=new Hangup(_0x12dfb9,_0x312912);this[_0xb292('0xd5')](_0x394da6)['catch'](loggerCatch(_0xb292('0x112')));this[_0xb292('0xd4')](_0x394da6)[_0xb292('0xc1')](loggerCatch('[syncHangupIvr]'));}if(_0x12dfb9&&_0x12dfb9[_0xb292('0x4e')]!==_0xb292('0x7f')&&isNotNull(this[_0xb292('0x21')][_0x12dfb9[_0xb292('0xbc')]][_0xb292('0x113')])){delete this['uniqueId'][_0x312912['uniqueid']];this[_0xb292('0xbb')](this[_0xb292('0x21')][_0x12dfb9[_0xb292('0xbc')]]);this[_0xb292('0x21')][_0x12dfb9[_0xb292('0xbc')]]['outboundAnswerCallsDay']+=0x1;this[_0xb292('0x21')][_0x12dfb9[_0xb292('0xbc')]][_0xb292('0x5f')]+=0x1;_0x394da6=new Hangup(_0x12dfb9,_0x312912);_0x394da6['state']=0x10;_0x394da6['statedesc']=_0xb292('0x114');_0x394da6[_0xb292('0xef')]=_0xb292('0x115');this[_0xb292('0xd5')](_0x394da6)[_0xb292('0xc1')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x394da6)[_0xb292('0xc1')](loggerCatch(_0xb292('0x116')));}if(_0x12dfb9&&_0x12dfb9[_0xb292('0x4e')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x12dfb9[_0xb292('0xbc')]][_0xb292('0x113')])){delete this[_0xb292('0x28')][_0x312912[_0xb292('0xe6')]];this[_0xb292('0xbb')](this['voiceQueues'][_0x12dfb9[_0xb292('0xbc')]]);this['voiceQueues'][_0x12dfb9[_0xb292('0xbc')]][_0xb292('0x69')]+=0x1;_0x394da6=new Hangup(_0x12dfb9,_0x312912);_0x394da6[_0xb292('0xaf')]=0xc;_0x394da6[_0xb292('0xed')]=_0x312912['cause-txt'];_0x394da6[_0xb292('0xef')]=_0xb292('0x117');this[_0xb292('0xd5')](_0x394da6)[_0xb292('0xc1')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xb292('0xd4')](_0x394da6)[_0xb292('0xc1')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0xb292('0x118')]=function(_0x15a370){var _0x4c0c5a=this['uniqueId'][_0x15a370[_0xb292('0xe6')]];var _0x4b9741=this;if(this['voiceQueues'][_0x15a370[_0xb292('0xbc')]]){if(_0x4c0c5a&&_0x4c0c5a[_0xb292('0x4e')]!=='ivr'){delete this[_0xb292('0x28')][_0x15a370[_0xb292('0xe6')]];this[_0xb292('0x21')][_0x15a370[_0xb292('0xbc')]][_0xb292('0x60')]+=0x1;var _0xecfdf7=new AgentComplete(_0x4c0c5a,_0x15a370);if(_0x15a370[_0xb292('0x119')]===_0xb292('0x11a')){_0xecfdf7[_0xb292('0x11b')]=this['voiceQueues'][_0x15a370[_0xb292('0xbc')]]['dialQueueProject2']&&this[_0xb292('0x21')][_0x15a370[_0xb292('0xbc')]]['dialAgiAfterHangupAgent']?moment()['format'](_0xb292('0x111')):undefined;}this[_0xb292('0xd5')](_0xecfdf7)[_0xb292('0xc1')](loggerCatch(_0xb292('0x11c')));this[_0xb292('0xd4')](_0xecfdf7)[_0xb292('0xc1')](loggerCatch(_0xb292('0x11d')));}}};Dialer[_0xb292('0x1c')]['syncAgentConnect']=function(_0xcd9305){if(this[_0xb292('0x21')][_0xcd9305[_0xb292('0xbc')]]){if(this['uniqueId'][_0xcd9305[_0xb292('0xe6')]]&&this[_0xb292('0x28')][_0xcd9305['uniqueid']][_0xb292('0x4e')]!=='ivr'){this[_0xb292('0xbb')](this[_0xb292('0x21')][_0xcd9305[_0xb292('0xbc')]]);this[_0xb292('0x28')][_0xcd9305[_0xb292('0xe6')]][_0xb292('0x11e')]=moment()[_0xb292('0x7d')](_0xb292('0x111'));}}};Dialer[_0xb292('0x1c')][_0xb292('0x11f')]=function(_0x42074f,_0x453927){this['createHistory'](_0x42074f)['catch'](loggerCatch(_0xb292('0x11c')));if(_0x453927==0x0){this[_0xb292('0xd4')](_0x42074f)[_0xb292('0xc1')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xb292('0x1c')]['syncQueueCallerAbandon']=function(_0xc3ed31){var _0x2106b0=this[_0xb292('0x28')][_0xc3ed31[_0xb292('0xe6')]];var _0x120845=this;var _0x253f2f=![];var _0x4e2f58;var _0x4674ea;if(this[_0xb292('0x21')][_0xc3ed31['queue']]){if(_0x2106b0&&_0x2106b0['type']!==_0xb292('0x7f')){delete this[_0xb292('0x28')][_0xc3ed31[_0xb292('0xe6')]];this['updateOriginated'](this[_0xb292('0x21')][_0xc3ed31[_0xb292('0xbc')]]);_0x2106b0['droptime']=moment()[_0xb292('0x7d')](_0xb292('0x111'));var _0x44dc6b=new QueueCallerAbandon(_0x2106b0,_0xc3ed31);if(getSeconds(_0x2106b0['droptime'],_0x2106b0[_0xb292('0x120')])>=_0x2106b0[_0xb292('0x121')]){this[_0xb292('0x21')][_0xc3ed31[_0xb292('0xbc')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xb292('0x21')][_0xc3ed31[_0xb292('0xbc')]][_0xb292('0x65')]+=0x1;this[_0xb292('0x21')][_0xc3ed31[_0xb292('0xbc')]][_0xb292('0x70')]+=0x1;_0x44dc6b[_0xb292('0xaf')]=0xa;_0x44dc6b[_0xb292('0xed')]=_0xb292('0x122');_0x44dc6b[_0xb292('0x123')]=_0xb292('0x124');_0x44dc6b[_0xb292('0x11b')]=this[_0xb292('0x21')][_0xc3ed31['queue']]['dialQueueProject2']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x44dc6b['countdropretry']+=0x1;_0x44dc6b[_0xb292('0x109')]+=0x1;_0x4e2f58=this['voiceQueues'][_0xc3ed31['queue']][_0xb292('0x125')];_0x4674ea=this[_0xb292('0x21')][_0xc3ed31[_0xb292('0xbc')]][_0xb292('0x126')];_0x120845[_0xb292('0xc4')](_0x44dc6b,_0x44dc6b['state'],_0x2106b0[_0xb292('0x127')])['then'](function(_0x500f61){_0x253f2f=_0x500f61[_0xb292('0x128')]==0x1;if(_0x44dc6b['countdropretry']>=_0x120845[_0xb292('0x21')][_0xc3ed31[_0xb292('0xbc')]]['dialDropMaxRetry']){_0x120845[_0xb292('0x11f')](_0x44dc6b,_0x500f61[_0xb292('0x128')]);}else{_0x120845['rescheduleContact']({'active':![],'countdropretry':_0x44dc6b['countdropretry'],'scheduledat':moment()[_0xb292('0x110')](_0x120845[_0xb292('0x21')][_0xc3ed31['queue']]['dialDropRetryFrequency'],_0xb292('0x103'))[_0xb292('0x7d')](_0xb292('0x111')),'ContactId':_0x2106b0['ContactId'],'ListId':_0x2106b0[_0xb292('0xdc')],'VoiceQueueId':_0x2106b0[_0xb292('0xde')]||undefined,'CampaignId':_0x2106b0['CampaignId']||undefined})[_0xb292('0xc1')](loggerCatch('[rescheduleContact][Drop]'));var _0x297f74=new History(_0x44dc6b);_0x297f74[_0xb292('0xaf')]=0xa;_0x297f74[_0xb292('0xed')]=_0xb292('0x122');_0x297f74[_0xb292('0x129')]=moment()['format'](_0xb292('0x111'));_0x297f74[_0xb292('0xb0')]=_0x297f74[_0xb292('0x129')];_0x297f74[_0xb292('0x12a')]=_0x44dc6b[_0xb292('0x12a')];_0x297f74[_0xb292('0x12b')]=_0x44dc6b[_0xb292('0x12b')];_0x120845[_0xb292('0xd5')](_0x297f74)['catch'](loggerCatch(_0xb292('0x12c')));}})[_0xb292('0x3c')](function(_0x56bcbe){if(_0x253f2f)_0x120845[_0xb292('0xc5')](_0x44dc6b,_0x4e2f58,_0x4674ea)['then'](function(_0x2b3299){return 0x1;});});}else{this[_0xb292('0x21')][_0xc3ed31[_0xb292('0xbc')]][_0xb292('0x6d')]+=0x1;this[_0xb292('0x21')][_0xc3ed31[_0xb292('0xbc')]][_0xb292('0x64')]+=0x1;_0x44dc6b[_0xb292('0xaf')]=0xb;_0x44dc6b[_0xb292('0xed')]='Abandoned';_0x44dc6b[_0xb292('0x123')]=_0xb292('0x12d');_0x44dc6b[_0xb292('0xfd')]+=0x1;_0x44dc6b[_0xb292('0x109')]+=0x1;_0x4e2f58=this[_0xb292('0x21')][_0xc3ed31['queue']]['dialAbandonedRetryFrequency'];_0x4674ea=this[_0xb292('0x21')][_0xc3ed31[_0xb292('0xbc')]][_0xb292('0x126')];_0x120845[_0xb292('0xc4')](_0x44dc6b,_0x44dc6b[_0xb292('0xaf')],_0x2106b0[_0xb292('0x127')])['then'](function(_0x251550){if(_0x44dc6b[_0xb292('0xfd')]>=_0x120845['voiceQueues'][_0xc3ed31['queue']][_0xb292('0x12e')]){_0x120845[_0xb292('0x11f')](_0x44dc6b,_0x251550[_0xb292('0x128')]);}else{_0x120845[_0xb292('0xca')]({'active':![],'countabandonedretry':_0x44dc6b[_0xb292('0xfd')],'scheduledat':moment()[_0xb292('0x110')](_0x120845[_0xb292('0x21')][_0xc3ed31[_0xb292('0xbc')]]['dialAbandonedRetryFrequency'],_0xb292('0x103'))[_0xb292('0x7d')](_0xb292('0x111')),'ContactId':_0x2106b0[_0xb292('0x12f')],'ListId':_0x2106b0['ListId'],'VoiceQueueId':_0x2106b0[_0xb292('0xde')]||undefined,'CampaignId':_0x2106b0[_0xb292('0x104')]||undefined})[_0xb292('0xc1')](loggerCatch(_0xb292('0x130')));var _0x3ec700=new History(_0x44dc6b);_0x3ec700[_0xb292('0xaf')]=0xb;_0x3ec700[_0xb292('0xed')]='Abandoned';_0x3ec700[_0xb292('0x129')]=moment()[_0xb292('0x7d')](_0xb292('0x111'));_0x3ec700['endtime']=_0x3ec700[_0xb292('0x129')];_0x3ec700['calleridname']=_0x44dc6b[_0xb292('0x12a')];_0x3ec700[_0xb292('0x12b')]=_0x44dc6b[_0xb292('0x12b')];_0x120845[_0xb292('0xd5')](_0x3ec700)['catch'](loggerCatch(_0xb292('0x131')));}})[_0xb292('0x3c')](function(_0x1557c5){if(_0x253f2f)_0x120845[_0xb292('0xc5')](_0x44dc6b,_0x4e2f58,_0x4674ea)['then'](function(_0x308195){return 0x1;});});}}}};Dialer[_0xb292('0x1c')][_0xb292('0x35')]=function(_0x49083e){if(this['actions'][_0x49083e[_0xb292('0xe6')]]){this[_0xb292('0xb3')][_0x49083e[_0xb292('0xe6')]]['channel']=_0x49083e['channel'];}if(this[_0xb292('0x28')][_0x49083e['uniqueid']]){this[_0xb292('0x28')][_0x49083e['uniqueid']][_0xb292('0xb9')]=_0x49083e['channel'];}};Dialer[_0xb292('0x1c')][_0xb292('0x37')]=function(_0x40bb47){if(strategy[this[_0xb292('0x21')][this[_0xb292('0xb3')][_0x40bb47[_0xb292('0x132')]][_0xb292('0xbc')]][_0xb292('0x133')]]===_0xb292('0x1b')){if(this[_0xb292('0xb3')][_0x40bb47['actionid']]&&_['isNil'](this[_0xb292('0xb3')][_0x40bb47['actionid']][_0xb292('0x134')])&&_0x40bb47[_0xb292('0xb8')]==='1'&&_0x40bb47['paused']==='0'){if(this[_0xb292('0x23')][_0x40bb47[_0xb292('0x135')]]){if(!this[_0xb292('0x23')][_0x40bb47[_0xb292('0x135')]]['locked']){this[_0xb292('0x23')][_0x40bb47[_0xb292('0x135')]][_0xb292('0x134')]=!![];this[_0xb292('0xb3')][_0x40bb47[_0xb292('0x132')]][_0xb292('0x134')]=!![];this[_0xb292('0xb3')][_0x40bb47[_0xb292('0x132')]][_0xb292('0x135')]=_0x40bb47['stateinterface'];}}}}else if((strategy[this[_0xb292('0x21')][this[_0xb292('0xb3')][_0x40bb47['actionid']][_0xb292('0xbc')]]['strategy']]||'rrmemory')===_0xb292('0x1a')){if(this[_0xb292('0xb3')][_0x40bb47[_0xb292('0x132')]]){if(this[_0xb292('0x23')][_0x40bb47[_0xb292('0x135')]]){this[_0xb292('0xb3')][_0x40bb47[_0xb292('0x132')]]['stateinterface']=_0x40bb47[_0xb292('0x135')];if(_[_0xb292('0xb6')](this[_0xb292('0x136')][this[_0xb292('0xb3')][_0x40bb47[_0xb292('0x132')]][_0xb292('0xbc')]])){this[_0xb292('0x136')][this[_0xb292('0xb3')][_0x40bb47[_0xb292('0x132')]]['queue']]=[];}this[_0xb292('0x136')][this[_0xb292('0xb3')][_0x40bb47[_0xb292('0x132')]][_0xb292('0xbc')]][_0xb292('0x137')](_[_0xb292('0x94')](_[_0xb292('0xdb')](this[_0xb292('0xb3')][_0x40bb47[_0xb292('0x132')]],[_0xb292('0x138'),_0xb292('0x135')]),{'status':_0x40bb47[_0xb292('0xb8')],'paused':_0x40bb47['paused']}));}}}};function unlockQueueStatus(_0x8bae75,_0x5b0a3b){setTimeout(function(){if(_[_0xb292('0x8b')](_0x8bae75[_0xb292('0x139')])){loggerBooked[_0xb292('0x9e')](_0xb292('0x13a'),_0x5b0a3b);}_0x8bae75['queueStatusComplete']=!![];loggerBooked[_0xb292('0x82')](_0xb292('0x13b'),_0x5b0a3b,JSON['stringify'](_['pick'](_0x8bae75,[_0xb292('0x40'),_0xb292('0x139')])));},0x1f3);}Dialer[_0xb292('0x1c')][_0xb292('0x39')]=function(_0x37e2d0){var _0x4f63dd=this;var _0x162842=_0x4f63dd[_0xb292('0x21')][_0x4f63dd[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]];if(strategy[this['voiceQueues'][this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]][_0xb292('0x133')]]===_0xb292('0x1b')){if(this[_0xb292('0xb3')][_0x37e2d0['actionid']]&&this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]]['stateinterface']){this[_0xb292('0x99')][_0xb292('0x13c')](this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0x138')],this[_0xb292('0xb3')][_0x37e2d0['actionid']][_0xb292('0x135')])[_0xb292('0xc1')](function(_0x608d0c){logger[_0xb292('0x9e')](_0xb292('0x13d'),util[_0xb292('0x9d')](_0x608d0c,{'showHidden':![],'depth':null}));})['finally'](function(){_0x4f63dd[_0xb292('0xbb')](_0x4f63dd[_0xb292('0x21')][_0x4f63dd['actions'][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]]);_0x4f63dd[_0xb292('0x23')][_0x4f63dd['actions'][_0x37e2d0[_0xb292('0x132')]][_0xb292('0x135')]][_0xb292('0x134')]=![];delete _0x4f63dd[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]];unlockQueueStatus(_0x162842);});}else{this[_0xb292('0xbb')](this[_0xb292('0x21')][this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]]);this[_0xb292('0xca')]({'active':![],'ContactId':this['actions'][_0x37e2d0[_0xb292('0x132')]][_0xb292('0x12f')],'ListId':this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xdc')],'VoiceQueueId':this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xde')]||undefined,'CampaignId':this['actions'][_0x37e2d0['actionid']][_0xb292('0x104')]||undefined})['catch'](loggerCatch(_0xb292('0x13e')));delete this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]];unlockQueueStatus(_0x162842);}}else if((strategy[this[_0xb292('0x21')][this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]]['strategy']]||_0xb292('0x1a'))==='rrmemory'){var _0x366839;if(this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]]&&!_[_0xb292('0x47')](this['queueBooked'][this[_0xb292('0xb3')][_0x37e2d0['actionid']]['queue']])){if(this[_0xb292('0x2b')][_0x4f63dd[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]]){this[_0xb292('0x2b')][_0x4f63dd[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]]=this[_0xb292('0x2b')][this[_0xb292('0xb3')][_0x37e2d0['actionid']][_0xb292('0xbc')]]?this[_0xb292('0x2b')][this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]]:this['queueBooked'][this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]]?this[_0xb292('0x136')][this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]][_0xb292('0x13f')]||0x0:0x0;}this[_0xb292('0x136')][this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]]['_rr']=this[_0xb292('0x2b')][this[_0xb292('0xb3')][_0x37e2d0['actionid']]['queue']];for(var _0x3e6b8c=0x0;_0x3e6b8c<this[_0xb292('0x136')][this['actions'][_0x37e2d0[_0xb292('0x132')]]['queue']][_0xb292('0xa0')];_0x3e6b8c+=0x1){_0x366839=rr(this[_0xb292('0x136')][this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]]);this[_0xb292('0x2b')][_0x4f63dd['actions'][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]]=this[_0xb292('0x136')][this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]]['_rr'];if(_0x366839[_0xb292('0xb8')]==='1'&&_0x366839[_0xb292('0x140')]==='0'){break;}}if(!_['isNil'](_0x366839)){this[_0xb292('0x23')][_0x366839[_0xb292('0x135')]][_0xb292('0x141')]=_[_0xb292('0x8b')](this[_0xb292('0x23')][_0x366839[_0xb292('0x135')]][_0xb292('0x141')])?!![]:this[_0xb292('0x23')][_0x366839[_0xb292('0x135')]]['unlockRR'];}loggerBooked['info'](_0xb292('0x142'),_0x37e2d0[_0xb292('0x132')],_0xb292('0x143'),JSON[_0xb292('0x4a')](_[_0xb292('0xdb')](this[_0xb292('0x23')][_0x366839[_0xb292('0x135')]],['name',_0xb292('0x141')])),'contactAgent-idHopper:\x20',JSON[_0xb292('0x4a')](_0x366839['idHopper']));if(!_[_0xb292('0xb6')](_0x366839)&&_0x366839[_0xb292('0xb8')]==='1'&&_0x366839[_0xb292('0x140')]==='0'&&this['agents'][_0x366839[_0xb292('0x135')]][_0xb292('0x141')]){this['agents'][_0x366839[_0xb292('0x135')]][_0xb292('0x141')]=![];this['queueBooked'][_0x4f63dd['actions'][_0x37e2d0['actionid']][_0xb292('0xbc')]]=[];this[_0xb292('0x99')][_0xb292('0x13c')](_0x366839[_0xb292('0x138')],_0x366839[_0xb292('0x135')])[_0xb292('0xc1')](function(_0x217a64){logger[_0xb292('0x9e')](_0xb292('0x13d'),util['inspect'](_0x217a64,{'showHidden':![],'depth':null}));})[_0xb292('0x1f')](function(){_0x4f63dd[_0xb292('0xbb')](_0x4f63dd[_0xb292('0x21')][_0x4f63dd[_0xb292('0xb3')][_0x37e2d0['actionid']][_0xb292('0xbc')]]);setTimeout(function(){_0x4f63dd[_0xb292('0x23')][_0x366839[_0xb292('0x135')]]['unlockRR']=!![];loggerBooked['info'](_0xb292('0x144'),_0x37e2d0[_0xb292('0x132')],_0xb292('0x143'),JSON[_0xb292('0x4a')](_[_0xb292('0xdb')](_0x4f63dd[_0xb292('0x23')][_0x366839[_0xb292('0x135')]],['name','unlockRR'])),_0xb292('0x145'),JSON[_0xb292('0x4a')](_0x366839[_0xb292('0x138')]));},0xc7);delete _0x4f63dd['actions'][_0x37e2d0[_0xb292('0x132')]];unlockQueueStatus(_0x162842,_0x37e2d0[_0xb292('0x132')]);});}else{loggerBooked[_0xb292('0x82')](_0xb292('0x146'));this[_0xb292('0xbb')](this['voiceQueues'][this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]]['ContactId'],'ListId':this['actions'][_0x37e2d0[_0xb292('0x132')]]['ListId'],'VoiceQueueId':this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xde')]||undefined,'CampaignId':this[_0xb292('0xb3')][_0x37e2d0['actionid']][_0xb292('0x104')]||undefined})[_0xb292('0xc1')](loggerCatch(_0xb292('0x13e')));delete this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]];unlockQueueStatus(_0x162842);}}else{loggerBooked[_0xb292('0x82')](_0xb292('0x147'));this[_0xb292('0xbb')](this['voiceQueues'][this['actions'][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0x12f')],'ListId':this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xdc')],'VoiceQueueId':this['actions'][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xde')]||undefined,'CampaignId':this[_0xb292('0xb3')][_0x37e2d0['actionid']]['CampaignId']||undefined})[_0xb292('0xc1')](loggerCatch(_0xb292('0x148')));delete this[_0xb292('0xb3')][_0x37e2d0['actionid']];unlockQueueStatus(_0x162842);}}else{loggerBooked['info'](_0xb292('0x149'));this['updateOriginated'](this[_0xb292('0x21')][this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]][_0xb292('0xbc')]]);this[_0xb292('0xca')]({'active':![],'ContactId':this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]]['ContactId'],'ListId':this[_0xb292('0xb3')][_0x37e2d0[_0xb292('0x132')]]['ListId'],'VoiceQueueId':this[_0xb292('0xb3')][_0x37e2d0['actionid']][_0xb292('0xde')]||undefined,'CampaignId':this[_0xb292('0xb3')][_0x37e2d0['actionid']][_0xb292('0x104')]||undefined})['catch'](loggerCatch(_0xb292('0x14a')));delete this['actions'][_0x37e2d0[_0xb292('0x132')]];unlockQueueStatus(_0x162842);}};Dialer[_0xb292('0x1c')][_0xb292('0x3a')]=function(){var _0xb67975=this;return BPromise[_0xb292('0xc3')]()[_0xb292('0x3c')](cmHopper[_0xb292('0x14b')]({}))[_0xb292('0x3c')](function(){setInterval(function(){_0xb67975[_0xb292('0x14c')]();},0x3e8);});};Dialer[_0xb292('0x1c')][_0xb292('0x14d')]=function(_0x46d2f7){var _0x153270=this;return function(){if(!_0x153270[_0xb292('0xe2')](_0x46d2f7['Trunk'])){if(!_0x153270['isTrunkReachable'](_0x46d2f7[_0xb292('0x14e')])){_0x46d2f7['message']=_0xb292('0x14f');throw _0x46d2f7[_0xb292('0x40')]+_0xb292('0x150');}}};};Dialer[_0xb292('0x1c')][_0xb292('0x151')]=function(_0xc2584b,_0x4df6ba,_0x160324,_0x2cb864){var _0x4b850b=this;return function(){var _0x4ab3a5=!![];return _0x4b850b['ifTime'](_0xc2584b,_0x4df6ba,_0x160324,_0x2cb864,_0x4ab3a5);};};Dialer['prototype'][_0xb292('0x152')]=function(_0x4029d3,_0x1897e9,_0x1e11f5,_0x3cae52){var _0x524405=this;return function(){var _0x21a2ee=![];return _0x524405[_0xb292('0x153')](_0x4029d3[_0xb292('0x46')],_0x1897e9,_0x1e11f5,_0x3cae52,_0x21a2ee);};};Dialer['prototype'][_0xb292('0x153')]=function(_0x5bc1b5,_0x5738cc,_0x5b69a5,_0x20d64a,_0x1e13a0){var _0x130feb=[];return new BPromise(function(_0x2aa87d,_0x8dbbfe){if(!isNotNull(_0x5bc1b5)){_0x20d64a[_0xb292('0x3e')]=_0xb292('0x154');return _0x8dbbfe(msgResponse('ifTime',_0xb292('0x155'),_0x5b69a5+_0xb292('0x156')));}if(_[_0xb292('0x47')](_0x5bc1b5)){_0x20d64a[_0xb292('0x3e')]=_0xb292('0x157');return _0x8dbbfe(msgResponse(_0xb292('0x153'),_0xb292('0x155'),_0x5b69a5+_0xb292('0x158')));}if(_0x5738cc&&_['isUndefined'](config[_0xb292('0x159')][_0x5738cc])){_0x20d64a[_0xb292('0x3e')]=_0xb292('0x15a');return _0x8dbbfe(msgResponse(_0xb292('0x153'),_0xb292('0x155'),_0x5b69a5+'\x20Timezone\x20unknow\x20'+_0x5738cc));}if(_[_0xb292('0x15b')](_0x5bc1b5)){for(var _0x4e0bf2=0x0;_0x4e0bf2<_0x5bc1b5[_0xb292('0xa0')];_0x4e0bf2+=0x1){_0x130feb['push'](ami[_0xb292('0xb7')]({'action':_0xb292('0x15c'),'command':util[_0xb292('0x7d')](_0xb292('0x15d'),_0x5bc1b5[_0x4e0bf2][_0xb292('0x15e')],!_[_0xb292('0x8b')](config['timezones'][_0x5738cc])?_0x5738cc:'')})['then'](function(_0x41f13f){return _0x41f13f['content']['indexOf'](_0xb292('0x15f'))>=0x0;})[_0xb292('0xc1')](myreject(_0x8dbbfe)));}}else{_0x130feb[_0xb292('0x137')](ami[_0xb292('0xb7')]({'action':_0xb292('0x15c'),'command':util['format'](_0xb292('0x15d'),_0x5bc1b5,!_[_0xb292('0x8b')](config['timezones'][_0x5738cc])?_0x5738cc:'')})[_0xb292('0x3c')](function(_0x1d0d67){return _0x1d0d67[_0xb292('0x160')][_0xb292('0x161')](_0xb292('0x15f'))>=0x0;})[_0xb292('0xc1')](myreject(_0x8dbbfe)));}BPromise[_0xb292('0x162')](_0x130feb)['then'](function(_0x4fc4ab){var _0x22bfc8=_[_0xb292('0x163')](_0x4fc4ab);if(_0x22bfc8){return _0x2aa87d(_0x22bfc8);}else{_0x20d64a[_0xb292('0x3e')]=_0x1e13a0?'GLOBAL_INTERVAL_IS_OVERTIME':_0xb292('0x164');return _0x8dbbfe(msgResponse('[ifTime][promiseAll]',_0xb292('0x155'),_0xb292('0x165')+_0x1e13a0+'\x20'+_0x5b69a5+'\x20Interval\x20is\x20overtime:\x20'+util[_0xb292('0x9d')](_0x5bc1b5,{'showHidden':![],'depth':null})+_0xb292('0x166')+_0x5738cc));}})[_0xb292('0xc1')](function(_0x38659c){return _0x8dbbfe(msgResponse(_0xb292('0x153'),_0xb292('0x155'),JSON[_0xb292('0x4a')](_0x38659c)));});});};Dialer[_0xb292('0x1c')]['checkDialMethod']=function(_0x46b384){var _0x4c847c=this;return function(){switch(_0x46b384['dialMethod']){case _0xb292('0x167'):freeVariablesPredictive(_0x46b384);_0x4c847c[_0xb292('0x168')](_0x46b384,0x1);break;case _0xb292('0x169'):freeVariablesPredictive(_0x46b384);_0x4c847c[_0xb292('0x168')](_0x46b384,_0x46b384[_0xb292('0x16a')]);break;case _0xb292('0xa'):_0x4c847c['predictive'](_0x46b384);break;case _0xb292('0x16b'):freeVariablesPredictive(_0x46b384);_0x4c847c[_0xb292('0x168')](_0x46b384,0x1);break;default:freeVariablesPredictive(_0x46b384);logger[_0xb292('0x9e')]('Queue',_0x46b384['name'],_0xb292('0x16c'));}};};Dialer[_0xb292('0x1c')]['launchHandleIvr']=function(_0x5980fa){var _0x2b2623=this;return function(){_0x2b2623[_0xb292('0x16d')](_0x5980fa);};};Dialer[_0xb292('0x1c')]['syncQueueSummary']=function(_0x41e5bb){var _0x85f193=this;if(isNotPreview(_0x41e5bb[_0xb292('0x16e')])){if(isVoiceQueueOutbound(_0x41e5bb[_0xb292('0x4e')])&&isActive(_0x41e5bb[_0xb292('0x5a')])){_0x41e5bb[_0xb292('0xa9')]=!![];BPromise['resolve']()[_0xb292('0x3c')](checkIsLoggedIn(_0x41e5bb,_0x41e5bb[_0xb292('0x16f')]))[_0xb292('0x3c')](checkIsActive(_0x41e5bb,_0x41e5bb[_0xb292('0x5a')]))['then'](checkInterval(_0x41e5bb))[_0xb292('0x3c')](_0x85f193[_0xb292('0x14d')](_0x41e5bb))[_0xb292('0x3c')](_0x85f193['checkIfTime'](_0x41e5bb[_0xb292('0x170')],_0x41e5bb[_0xb292('0x171')],_0x41e5bb[_0xb292('0x40')],_0x41e5bb))[_0xb292('0x3c')](_0x85f193[_0xb292('0x152')](_0x41e5bb[_0xb292('0x44')],_0x41e5bb['dialTimezone'],_0x41e5bb[_0xb292('0x40')],_0x41e5bb))[_0xb292('0x3c')](_0x85f193[_0xb292('0x172')](_0x41e5bb))[_0xb292('0xc1')](loggerCatchQueueSummary(_0xb292('0x173'),_0x41e5bb));}else{notSendMessagesQueue(_0x41e5bb);}}else{freeVariablesPredictive(_0x41e5bb);}};Dialer[_0xb292('0x1c')][_0xb292('0x174')]=_[_0xb292('0x175')](function(){var _0x555ef7=_[_0xb292('0x176')](this[_0xb292('0x21')],function(_0x4c6386){return _0x4c6386[_0xb292('0x177')];});var _0x2a8a1e=_[_0xb292('0x176')](this[_0xb292('0x23')],function(_0x4ea884){return _0x4ea884[_0xb292('0x178')]&&_0x4ea884[_0xb292('0xb8')]==='reachable';});if(_0x555ef7[_0xb292('0xa0')]>0x0&&_0x2a8a1e[_0xb292('0xa0')]>0x0){return BPromise['resolve']()[_0xb292('0x3c')](cmHopper[_0xb292('0x179')](_[_0xb292('0x17a')](_0x555ef7,'id'),previewRecallmeReminderInterval,_[_0xb292('0x17a')](_0x2a8a1e,'id')))[_0xb292('0x3c')](function(_0x2c934c){for(var _0x37a4ad=0x0;_0x37a4ad<_0x2c934c[_0xb292('0xa0')];_0x37a4ad++){var _0x35e799=_0x2c934c[_0x37a4ad][_0xb292('0x17b')][_0xb292('0x40')];if(_0x35e799)io['to'](util[_0xb292('0x7d')](_0xb292('0x17c'),_0x35e799))[_0xb292('0xf8')](_0xb292('0x17d'),{'hopper':_0x2c934c[_0x37a4ad]});}})[_0xb292('0xc1')](function(_0x25cc57){logger[_0xb292('0x9e')](_0xb292('0x17e'),_0x25cc57);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xb292('0x1c')]['syncCampaigns']=function(){var _0x3b4c76=this;var _0xa94d08;for(var _0x4b1b6e in this[_0xb292('0x22')]){if(typeof this[_0xb292('0x22')][_0x4b1b6e]!==_0xb292('0xb5')){_0xa94d08=this[_0xb292('0x22')][_0x4b1b6e];if(isCampaignIvr(_0xa94d08[_0xb292('0x4e')])&&isActive(_0xa94d08[_0xb292('0x7b')])){_0xa94d08[_0xb292('0xa9')]=!![];BPromise[_0xb292('0xc3')]()[_0xb292('0x3c')](checkIsActive(_0xa94d08,_0xa94d08[_0xb292('0x7b')]))[_0xb292('0x3c')](checkInterval(_0xa94d08))[_0xb292('0x3c')](_0x3b4c76[_0xb292('0x14d')](_0xa94d08))[_0xb292('0x3c')](_0x3b4c76[_0xb292('0x151')](_0xa94d08[_0xb292('0x170')],_0xa94d08[_0xb292('0x171')],_0xa94d08[_0xb292('0x40')],_0xa94d08))[_0xb292('0x3c')](_0x3b4c76[_0xb292('0x152')](_0xa94d08['Interval'],_0xa94d08[_0xb292('0x171')],_0xa94d08['name'],_0xa94d08))[_0xb292('0x3c')](_0x3b4c76[_0xb292('0x17f')](_0xa94d08))[_0xb292('0xc1')](loggerCatchQueueSummary('[syncCampaigns]',_0xa94d08));}else{notSendMessagesCampaign(_0xa94d08);}}}};function getCallerIdRandom(_0x5922b3,_0x151830){var _0x241c83;var _0x18d0be;var _0x35868f;if(_0x151830<=0x0){_0x151830=0x1;}_0x241c83=new RegExp(_0xb292('0x180')+_0x151830+'}$');_0x18d0be=Math['pow'](0xa,_0x151830-0x1);_0x35868f=Math[_0xb292('0x181')](0xa,_0x151830)-0x1;return util[_0xb292('0x7d')]('%s',_[_0xb292('0x182')](_0x5922b3,_0x241c83,_[_0xb292('0x183')](_0x18d0be,_0x35868f)));}function extractCalleridName(_0x19d882){var _0x17c9e8=_0x19d882[_0xb292('0x184')](/"(.*?)"/);return _0x17c9e8?_0x17c9e8[0x1]:_0x19d882;}function extractCalleridNumber(_0x232745){var _0x27f5ec=_0x232745[_0xb292('0x184')](/<(.*?)>/);return _0x27f5ec?_0x27f5ec[0x1]:_0x232745;}Dialer[_0xb292('0x1c')]['actionOriginate']=function(_0x20ad8f,_0x593705){var _0xaa7026=this;var _0x575645=uuid['v4']();this[_0xb292('0xb3')][_0x575645]=new Action(_0x20ad8f,_0x593705,_0x575645);return new BPromise(function(_0x19fa93,_0x432e5a){if(_[_0xb292('0x8b')](_0x20ad8f)&&typeof _0x20ad8f!=='object'){return _0x432e5a(msgResponse(_0xb292('0x185'),_0xb292('0x155'),_0xb292('0x186')));}if(_[_0xb292('0x8b')](_0x593705[_0xb292('0x187')])||_0x593705[_0xb292('0x187')]===null){return _0x432e5a(msgResponse(_0xb292('0x185'),_0xb292('0x155'),'contact\x20is\x20undefine'));}var _0x11eb7c={'XMD-CALLERID':_0xaa7026[_0xb292('0xb3')][_0x575645]['getCaller'](),'XMD-AGI':_0x20ad8f[_0xb292('0x113')]?util[_0xb292('0x7d')](_0xb292('0x188'),ipAgi,_0x20ad8f[_0xb292('0x113')]):'NONE','XMD-AGIAFTER':_0x20ad8f['dialQueueProject2']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x20ad8f[_0xb292('0x189')]):'NONE','XMD-QUEUE':_0x20ad8f[_0xb292('0x4e')]===_0xb292('0x98')?util[_0xb292('0x7d')](_0xb292('0x18a'),_0x20ad8f[_0xb292('0x40')],_0x20ad8f[_0xb292('0x18b')]||'',_0x20ad8f['dialAgiAfterHangupAgent']?'c':'',_0x20ad8f[_0xb292('0x121')]||0x3):_0xb292('0x18c'),'XMD-CONTACTID':_0x593705[_0xb292('0x12f')],'XMD-CDRTYPE':_0xb292('0x18d'),'CALLERID(all)':_0xaa7026[_0xb292('0xb3')][_0x575645][_0xb292('0x18e')](),'XMD-AMD':_0x20ad8f[_0xb292('0xeb')]?_0xb292('0x18f'):_0xb292('0x18c'),'XMD-DESTINATION':_0xb292('0xea')};if(_0x20ad8f[_0xb292('0xeb')]){_0x11eb7c[_0xb292('0x190')]=_0x20ad8f['dialAMDInitialSilence']||0x9c4;_0x11eb7c[_0xb292('0x191')]=_0x20ad8f['dialAMDGreeting']||0x5dc;_0x11eb7c['XMD-AMDAFTERGREETINGSILENCE']=_0x20ad8f[_0xb292('0x192')]||0x320;_0x11eb7c[_0xb292('0x193')]=_0x20ad8f[_0xb292('0x194')]||0x1388;_0x11eb7c[_0xb292('0x195')]=_0x20ad8f[_0xb292('0x196')]||0x64;_0x11eb7c[_0xb292('0x197')]=_0x20ad8f[_0xb292('0x198')]||0x32;_0x11eb7c[_0xb292('0x199')]=_0x20ad8f[_0xb292('0x19a')]||0x3;_0x11eb7c[_0xb292('0x19b')]=_0x20ad8f[_0xb292('0x19c')]||0x100;_0x11eb7c[_0xb292('0x19d')]=_0x20ad8f['dialAMDMaximumWordLength']||0x1388;}if(_0x20ad8f[_0xb292('0x4e')]===_0xb292('0x98')){_0x11eb7c[_0xb292('0x19e')]=_0x593705[_0xb292('0xde')];}else{_0x11eb7c[_0xb292('0x19f')]=_0x593705[_0xb292('0x104')];}for(var _0x22cc50 in _0x593705[_0xb292('0x1a0')]){if(typeof _0x593705[_0xb292('0x1a0')][_0x22cc50]!==_0xb292('0xb5')){if(isNotNull(_0x593705['Contact'][_0x22cc50])&&_0x22cc50!=='id'&&_0x22cc50!==_0xb292('0x1a1')&&_0x22cc50!==_0xb292('0x1a2')&&_0x22cc50!==_0xb292('0x1a3')){_0x11eb7c[util['format'](_0xb292('0x1a4'),'XMD-',_['toUpper'](_0x22cc50))]=_0x593705['Contact'][_0x22cc50];}}}var _0x27e04e=_0xaa7026[_0xb292('0xe2')](_0x20ad8f[_0xb292('0x7a')])?getCallerId(_0x20ad8f[_0xb292('0x7a')][_0xb292('0x7c')],_0x20ad8f[_0xb292('0x5b')],_0x20ad8f[_0xb292('0x1a5')]>0x0?getCallerIdRandom(_0x20ad8f['dialOriginateCallerIdNumber'],_0x20ad8f[_0xb292('0x1a5')]):_0x20ad8f[_0xb292('0x5c')]):getCallerId(_[_0xb292('0xb6')](_0x20ad8f[_0xb292('0x14e')])?_0x20ad8f[_0xb292('0x7a')][_0xb292('0x7c')]:_0x20ad8f['TrunkBackup']['callerid'],_0x20ad8f[_0xb292('0x5b')],_0x20ad8f[_0xb292('0x1a5')]>0x0?getCallerIdRandom(_0x20ad8f[_0xb292('0x5c')],_0x20ad8f['dialRandomLastDigitCallerIdNumber']):_0x20ad8f[_0xb292('0x5c')]);if(_0x27e04e){_0x11eb7c[_0xb292('0x1a6')]=_0xaa7026['actions'][_0x575645][_0xb292('0x1a7')]=extractCalleridName(_0x27e04e);_0x11eb7c[_0xb292('0x1a8')]=_0x593705[_0xb292('0x187')];}return ami['Action']({'actionid':_0x575645,'action':_0xb292('0x185'),'channel':_0xaa7026[_0xb292('0xe2')](_0x20ad8f[_0xb292('0x7a')])?util[_0xb292('0x7d')](_0xb292('0x1a9'),_0x20ad8f[_0xb292('0x7a')][_0xb292('0x40')],isNotNull(_0x20ad8f[_0xb292('0x5e')])?_0x20ad8f[_0xb292('0x5e')][_0xb292('0x1aa')]()||'':'',_0x20ad8f[_0xb292('0x1ab')]>0x0?_0x593705[_0xb292('0x187')][_0xb292('0x1ac')](_0x20ad8f[_0xb292('0x1ab')]):_0x593705['phone']):util['format'](_0xb292('0x1a9'),_[_0xb292('0xb6')](_0x20ad8f[_0xb292('0x14e')])?_0x20ad8f['Trunk']['name']:_0x20ad8f[_0xb292('0x14e')]['name'],isNotNull(_0x20ad8f['dialPrefix'])?_0x20ad8f[_0xb292('0x5e')]['trim']()||'':'',_0x20ad8f[_0xb292('0x1ab')]>0x0?_0x593705[_0xb292('0x187')][_0xb292('0x1ac')](_0x20ad8f['dialCutDigit']):_0x593705[_0xb292('0x187')]),'callerid':_0x27e04e,'Exten':_0xb292('0xea'),'Context':'from-sip','Priority':'1','variable':_0x11eb7c,'timeout':(_0x20ad8f[_0xb292('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x575645})[_0xb292('0x3c')](function(_0x8e2767){return _0x19fa93(_0x8e2767);})[_0xb292('0xc1')](function(_0x370823){_0x20ad8f[_0xb292('0x67')]+=0x1;var _0x1b2705=new History(_0xaa7026[_0xb292('0xb3')][_0x575645]);logger[_0xb292('0x9e')](util[_0xb292('0x7d')](_0xb292('0x1ad'),JSON['stringify'](_0x370823)));_0x1b2705[_0xb292('0xaf')]=0xe;_0x1b2705['statedesc']=_0xb292('0x1ae');_0x1b2705[_0xb292('0x129')]=moment()['format'](_0xb292('0x111'));_0x1b2705[_0xb292('0xb0')]=_0x1b2705['starttime'];_0xaa7026[_0xb292('0xd5')](_0x1b2705)['catch'](loggerCatch('[originate][error]'));_0xaa7026[_0xb292('0xd4')](_0x1b2705)[_0xb292('0xc1')](loggerCatch('[originate][error]'))[_0xb292('0x1f')](function(){delete _0xaa7026[_0xb292('0xb3')][_0x575645];return _0x432e5a(msgResponse(_0xb292('0x185'),_0xb292('0x49'),_0xb292('0x1af')));});});});};Dialer[_0xb292('0x1c')][_0xb292('0x31')]=function(_0x27a549){var _0xa4fe43=this['actions'][_0x27a549[_0xb292('0x132')]];if(_0xa4fe43){delete this[_0xb292('0xb3')][_0x27a549[_0xb292('0x132')]];_0xa4fe43[_0xb292('0x120')]=moment()[_0xb292('0x7d')](_0xb292('0x111'));var _0xac5975=_0xa4fe43[_0xb292('0x4e')]===_0xb292('0x7f')?this[_0xb292('0x22')][_0xa4fe43[_0xb292('0xbc')]]:this[_0xb292('0x21')][_0xa4fe43[_0xb292('0x1b0')]()];if(!this[_0xb292('0xe0')](_0x27a549[_0xb292('0x1b1')])){this[_0xb292('0xbb')](_0xac5975);return this[_0xb292('0x1b2')](_0xa4fe43,_0xac5975,_0x27a549)['catch'](loggerCatch(_0xb292('0x1b3')));}this[_0xb292('0x28')][_0x27a549[_0xb292('0xe6')]]=_0xa4fe43;}};Dialer[_0xb292('0x1c')][_0xb292('0x1b4')]=function(_0x256930,_0x86de5b,_0xadd2e1){var _0x3bac76=new History(_0x86de5b);if(_0x3bac76[_0xb292('0x10a')]+_0x3bac76['countcongestionretry']+_0x3bac76[_0xb292('0x10c')]+_0x3bac76[_0xb292('0xfb')]+_0x3bac76['countdropretry']+_0x3bac76[_0xb292('0xfd')]+_0x3bac76['countmachineretry']+_0x3bac76[_0xb292('0x10d')]>=_0xadd2e1[_0xb292('0xfe')]-0x1){return!![];}switch(_0x256930){case 0x3:if(_0x3bac76['countnoanswerretry']>=_0xadd2e1[_0xb292('0x1b5')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x3bac76['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xb292('0x110')](_0xadd2e1[_0xb292('0x1b6')],_0xb292('0x103'))[_0xb292('0x7d')](_0xb292('0x111')),'ContactId':_0x3bac76[_0xb292('0x12f')],'ListId':_0x3bac76[_0xb292('0xdc')],'VoiceQueueId':_0x3bac76[_0xb292('0xde')]||undefined,'CampaignId':_0x3bac76['CampaignId']||undefined})[_0xb292('0xc1')](loggerCatch(_0xb292('0x1b7')));break;case 0x5:if(_0x3bac76['countbusyretry']>=_0xadd2e1[_0xb292('0x1b8')]-0x1){return!![];}this[_0xb292('0xca')]({'active':![],'countbusyretry':_0x3bac76[_0xb292('0x10a')]+=0x1,'scheduledat':moment()[_0xb292('0x110')](_0xadd2e1[_0xb292('0x1b9')],_0xb292('0x103'))[_0xb292('0x7d')](_0xb292('0x111')),'ContactId':_0x3bac76[_0xb292('0x12f')],'ListId':_0x3bac76[_0xb292('0xdc')],'VoiceQueueId':_0x3bac76[_0xb292('0xde')]||undefined,'CampaignId':_0x3bac76[_0xb292('0x104')]||undefined})[_0xb292('0xc1')](loggerCatch(_0xb292('0x1ba')));break;case 0x8:if(_0x3bac76[_0xb292('0x10b')]>=_0xadd2e1[_0xb292('0x1bb')]-0x1){return!![];}this[_0xb292('0xca')]({'active':![],'countcongestionretry':_0x3bac76[_0xb292('0x10b')]+=0x1,'scheduledat':moment()[_0xb292('0x110')](_0xadd2e1[_0xb292('0x1bc')],_0xb292('0x103'))[_0xb292('0x7d')](_0xb292('0x111')),'ContactId':_0x3bac76[_0xb292('0x12f')],'ListId':_0x3bac76['ListId'],'VoiceQueueId':_0x3bac76[_0xb292('0xde')]||undefined,'CampaignId':_0x3bac76[_0xb292('0x104')]||undefined})[_0xb292('0xc1')](loggerCatch(_0xb292('0x1bd')));break;case 0x0:if(_0x3bac76[_0xb292('0xfb')]>=_0xadd2e1[_0xb292('0x1be')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x3bac76['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xb292('0x110')](_0xadd2e1[_0xb292('0x1bf')],_0xb292('0x103'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3bac76['ContactId'],'ListId':_0x3bac76[_0xb292('0xdc')],'VoiceQueueId':_0x3bac76[_0xb292('0xde')]||undefined,'CampaignId':_0x3bac76[_0xb292('0x104')]||undefined})['catch'](loggerCatch(_0xb292('0x1c0')));}break;case 0xa:if(_0x3bac76[_0xb292('0xfc')]>=_0xadd2e1['dialDropMaxRetry']-0x1){return!![];}this[_0xb292('0xca')]({'active':![],'countdropretry':_0x3bac76[_0xb292('0xfc')]+=0x1,'scheduledat':moment()[_0xb292('0x110')](_0xadd2e1[_0xb292('0x125')],_0xb292('0x103'))[_0xb292('0x7d')](_0xb292('0x111')),'ContactId':_0x3bac76[_0xb292('0x12f')],'ListId':_0x3bac76['ListId'],'VoiceQueueId':_0x3bac76['VoiceQueueId']||undefined,'CampaignId':_0x3bac76[_0xb292('0x104')]||undefined})[_0xb292('0xc1')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x3bac76[_0xb292('0xfd')]>=_0xadd2e1[_0xb292('0x12e')]-0x1){return!![];}this[_0xb292('0xca')]({'active':![],'countabandonedretry':_0x3bac76[_0xb292('0xfd')]+=0x1,'scheduledat':moment()[_0xb292('0x110')](_0xadd2e1[_0xb292('0x1c1')],_0xb292('0x103'))[_0xb292('0x7d')](_0xb292('0x111')),'ContactId':_0x3bac76['ContactId'],'ListId':_0x3bac76[_0xb292('0xdc')],'VoiceQueueId':_0x3bac76[_0xb292('0xde')]||undefined,'CampaignId':_0x3bac76[_0xb292('0x104')]||undefined})['catch'](loggerCatch(_0xb292('0x130')));break;case 0x13:if(_0x3bac76[_0xb292('0xf7')]>=_0xadd2e1[_0xb292('0x100')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x3bac76[_0xb292('0xf7')]+=0x1,'scheduledat':moment()[_0xb292('0x110')](_0xadd2e1[_0xb292('0x102')],_0xb292('0x103'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3bac76[_0xb292('0x12f')],'ListId':_0x3bac76[_0xb292('0xdc')],'VoiceQueueId':_0x3bac76['VoiceQueueId']||undefined,'CampaignId':_0x3bac76[_0xb292('0x104')]||undefined})[_0xb292('0xc1')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x3bac76[_0xb292('0x10d')]>=_0xadd2e1[_0xb292('0x1c2')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x3bac76[_0xb292('0x10d')]+=0x1,'scheduledat':moment()[_0xb292('0x110')](_0xadd2e1[_0xb292('0x1c3')],'minutes')[_0xb292('0x7d')](_0xb292('0x111')),'ContactId':_0x3bac76['ContactId'],'ListId':_0x3bac76[_0xb292('0xdc')],'VoiceQueueId':_0x3bac76[_0xb292('0xde')]||undefined,'CampaignId':_0x3bac76[_0xb292('0x104')]||undefined})[_0xb292('0xc1')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xb292('0x1c')]['callProgressDetecting']=function(_0x49edd3,_0xa3ba2a,_0x5ab4b5){var _0x1e6c9e=this;var _0x22a862=new History(_0x49edd3);var _0x264744=![];var _0x3c8cb1;var _0x360c44;return new BPromise(function(_0x44bba9,_0x25a2a6){if(_[_0xb292('0x8b')](_0xa3ba2a)&&typeof _0xa3ba2a!==_0xb292('0x1c4')){return _0x25a2a6(msgResponse(_0xb292('0x1c5'),'Failure',_0xb292('0x1c6')));}if(_[_0xb292('0x8b')](_0x5ab4b5)&&typeof _0x5ab4b5!==_0xb292('0x1c4')){return _0x25a2a6(msgResponse(_0xb292('0x1c5'),_0xb292('0x155'),'evt\x20is\x20undefine'));}_0x1e6c9e[_0xb292('0xc4')](_0x22a862,_0x5ab4b5[_0xb292('0x119')],_0xa3ba2a)[_0xb292('0x3c')](function(_0x138de5){if(_0x138de5[_0xb292('0x128')]==0x1)_0x264744=!![];switch(_0x5ab4b5[_0xb292('0x119')]){case'0':_0xa3ba2a[_0xb292('0x66')]+=0x1;_0x22a862['state']=0x0;_0x22a862[_0xb292('0xed')]='NoSuchNumber';_0x22a862[_0xb292('0xfb')]+=0x1;_0x22a862[_0xb292('0x109')]+=0x1;ami[_0xb292('0xf8')](_0xb292('0x1c7'),ut['buildObj'](_0x49edd3,'nosuchnumber'));_0x3c8cb1=_0xa3ba2a[_0xb292('0x1bf')];_0x360c44=_0xa3ba2a[_0xb292('0x126')];_0x1e6c9e['createHistory'](_0x22a862)[_0xb292('0xc1')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1e6c9e[_0xb292('0x1b4')](0x0,_0x49edd3,_0xa3ba2a)&&!_0x264744){if(_0x22a862['countnosuchnumberretry']>=_0xa3ba2a[_0xb292('0x1be')]){_0x1e6c9e[_0xb292('0x10f')](_0x22a862,_0x44bba9,_0x25a2a6,_0xb292('0x1c8'));}else{_0x1e6c9e[_0xb292('0xff')](_0x22a862,_0x44bba9,_0x25a2a6,_0xb292('0x1c8'));}}break;case'3':_0xa3ba2a['outboundNoAnswerCallsDay']+=0x1;_0x22a862[_0xb292('0xaf')]=0x3;_0x22a862[_0xb292('0xed')]=_0xb292('0x1c9');_0x22a862['countnoanswerretry']+=0x1;_0x22a862[_0xb292('0x109')]+=0x1;ami[_0xb292('0xf8')](_0xb292('0x1ca'),ut[_0xb292('0xf1')](_0x49edd3,_0xb292('0x1cb')));_0x3c8cb1=_0xa3ba2a[_0xb292('0x1b6')];_0x360c44=_0xa3ba2a[_0xb292('0x126')];_0x1e6c9e[_0xb292('0xd5')](_0x22a862)[_0xb292('0xc1')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1e6c9e['checkRetriveMax'](0x3,_0x49edd3,_0xa3ba2a)&&!_0x264744){if(_0x22a862[_0xb292('0x10c')]>=_0xa3ba2a[_0xb292('0x1b5')]){_0x1e6c9e[_0xb292('0x10f')](_0x22a862,_0x44bba9,_0x25a2a6,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1e6c9e[_0xb292('0xff')](_0x22a862,_0x44bba9,_0x25a2a6,_0xb292('0x1cc'));}}break;case'5':_0xa3ba2a['outboundBusyCallsDay']+=0x1;_0x22a862[_0xb292('0xaf')]=0x5;_0x22a862['statedesc']=_0xb292('0x1cd');_0x22a862[_0xb292('0x10a')]+=0x1;_0x22a862[_0xb292('0x109')]+=0x1;ami[_0xb292('0xf8')](_0xb292('0x1ce'),ut[_0xb292('0xf1')](_0x49edd3,_0xb292('0x1cf')));_0x3c8cb1=_0xa3ba2a[_0xb292('0x1b9')];_0x360c44=_0xa3ba2a[_0xb292('0x126')];_0x1e6c9e[_0xb292('0xd5')](_0x22a862)[_0xb292('0xc1')](loggerCatch(_0xb292('0x1d0')));if(_0x1e6c9e[_0xb292('0x1b4')](0x5,_0x49edd3,_0xa3ba2a)&&!_0x264744){if(_0x22a862['countbusyretry']>=_0xa3ba2a['dialBusyMaxRetry']){_0x1e6c9e[_0xb292('0x10f')](_0x22a862,_0x44bba9,_0x25a2a6,_0xb292('0x1d1'));}else{_0x1e6c9e['stateGlobal'](_0x22a862,_0x44bba9,_0x25a2a6,_0xb292('0x1d1'));}}break;case'8':_0xa3ba2a['outboundCongestionCallsDay']+=0x1;_0x22a862[_0xb292('0xaf')]=0x8;_0x22a862[_0xb292('0xed')]=_0xb292('0x1d2');_0x22a862[_0xb292('0x10b')]+=0x1;_0x22a862[_0xb292('0x109')]+=0x1;_0x3c8cb1=_0xa3ba2a[_0xb292('0x1bc')];_0x360c44=_0xa3ba2a[_0xb292('0x126')];ami['emit'](_0xb292('0x1d3'),ut[_0xb292('0xf1')](_0x49edd3,_0xb292('0x1d4')));_0x1e6c9e[_0xb292('0xd5')](_0x22a862)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x1e6c9e['checkRetriveMax'](0x8,_0x49edd3,_0xa3ba2a)&&!_0x264744){if(_0x22a862['countcongestionretry']>=_0xa3ba2a['dialCongestionMaxRetry']){_0x1e6c9e[_0xb292('0x10f')](_0x22a862,_0x44bba9,_0x25a2a6,_0xb292('0x1d5'));}else{_0x1e6c9e['stateGlobal'](_0x22a862,_0x44bba9,_0x25a2a6,'reason\x208\x20congestion');}}break;case'11':_0xa3ba2a[_0xb292('0x1d6')]+=0x1;_0x22a862[_0xb292('0xaf')]=0xb;_0x22a862[_0xb292('0xed')]=_0xb292('0x1d7');_0x22a862[_0xb292('0xfd')]+=0x1;_0x22a862[_0xb292('0x109')]+=0x1;_0x3c8cb1=_0xa3ba2a[_0xb292('0x1c1')];_0x360c44=_0xa3ba2a['callAdditionalPhoneAfterMin'];_0x1e6c9e['createHistory'](_0x22a862)[_0xb292('0xc1')](loggerCatch(_0xb292('0x131')));if(_0x1e6c9e[_0xb292('0x1b4')](0xb,_0x49edd3,_0xa3ba2a)&&!_0x264744){if(_0x22a862[_0xb292('0xfd')]>=_0xa3ba2a[_0xb292('0x12e')]){_0x1e6c9e[_0xb292('0x10f')](_0x22a862,_0x44bba9,_0x25a2a6,_0xb292('0x1d8'));}else{_0x1e6c9e['stateGlobal'](_0x22a862,_0x44bba9,_0x25a2a6,_0xb292('0x1d8'));}}break;case'20':_0xa3ba2a[_0xb292('0x1d9')]+=0x1;_0x22a862[_0xb292('0xaf')]=0x14;_0x22a862[_0xb292('0xed')]='AgentReject';_0x22a862[_0xb292('0x10d')]+=0x1;_0x22a862[_0xb292('0x109')]+=0x1;_0x3c8cb1=_0xa3ba2a['dialAgentRejectRetryFrequency'];_0x360c44=_0xa3ba2a[_0xb292('0x126')];ami[_0xb292('0xf8')](_0xb292('0x1da'),ut[_0xb292('0xf1')](_0x49edd3,_0xb292('0x1db')));_0x1e6c9e[_0xb292('0xd5')](_0x22a862)[_0xb292('0xc1')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x1e6c9e['checkRetriveMax'](0x14,_0x49edd3,_0xa3ba2a)&&!_0x264744){if(_0x22a862['countagentrejectretry']>=_0xa3ba2a[_0xb292('0x1c2')]){_0x1e6c9e['createStateFinal'](_0x22a862,_0x44bba9,_0x25a2a6,_0xb292('0x1dc'));}else{_0x1e6c9e[_0xb292('0xff')](_0x22a862,_0x44bba9,_0x25a2a6,_0xb292('0x1dc'));}}break;default:_0xa3ba2a[_0xb292('0x69')]+=0x1;_0x22a862[_0xb292('0xaf')]=0xc;_0x22a862[_0xb292('0xed')]=_0x5ab4b5[_0xb292('0x119')];_0x3c8cb1=_0xa3ba2a['dialAgentRejectRetryFrequency'];_0x360c44=_0xa3ba2a[_0xb292('0x126')];_0x1e6c9e[_0xb292('0xd5')](_0x22a862)[_0xb292('0xc1')](loggerCatch(_0xb292('0x1dd')));if(_0x1e6c9e['checkRetriveMax'](_0x5ab4b5[_0xb292('0x119')],_0x49edd3,_0xa3ba2a)&&!_0x264744){if(_0x22a862[_0xb292('0x10a')]+_0x22a862[_0xb292('0x10b')]+_0x22a862[_0xb292('0x10c')]+_0x22a862['countnosuchnumberretry']+_0x22a862[_0xb292('0xfc')]+_0x22a862[_0xb292('0xfd')]+_0x22a862[_0xb292('0xf7')]+_0x22a862[_0xb292('0x10d')]>=_0xa3ba2a['dialGlobalMaxRetry']){_0x1e6c9e[_0xb292('0xff')](_0x22a862,_0x44bba9,_0x25a2a6,_0x5ab4b5[_0xb292('0x119')]);}else{_0x1e6c9e[_0xb292('0x10f')](_0x22a862,_0x44bba9,_0x25a2a6,_0x5ab4b5[_0xb292('0x119')]);}}}})[_0xb292('0x3c')](function(_0x505e7c){if(_0x264744){_0x1e6c9e[_0xb292('0xc5')](_0x22a862,_0x3c8cb1,_0x360c44)[_0xb292('0x3c')](function(_0x5517e6){return _0x44bba9(0x1);});}});});};Dialer['prototype'][_0xb292('0xff')]=function(_0x1a350a,_0x28a0e8,_0x8c36db,_0x48cd90){var _0x40d6d2=new Final(_0x1a350a);_0x40d6d2[_0xb292('0xaf')]=0xf;_0x40d6d2[_0xb292('0xed')]=_0xb292('0x1de');this['createStateFinal'](_0x40d6d2,_0x28a0e8,_0x8c36db,_0x48cd90);};Dialer['prototype'][_0xb292('0x10f')]=function(_0x54421e,_0x4d3150,_0x42e721,_0x28761b){this['moveContactManagedDialer'](_0x54421e)[_0xb292('0x3c')](function(){return _0x4d3150(msgResponse(_0xb292('0x1c5'),'Success',_0x28761b));})[_0xb292('0xc1')](function(){return _0x42e721(msgResponse(_0xb292('0x1df'),_0xb292('0x155'),'contact\x20not\x20moved'));});};Dialer[_0xb292('0x1c')][_0xb292('0xa')]=function(_0x39c16e){var _0x266d0f=_0x39c16e[_0xb292('0x1e0')]/0x64;var _0x3108f0=_0x39c16e[_0xb292('0x65')]/(_0x39c16e[_0xb292('0x65')]+_0x39c16e['outboundAnswerCallsDay']);var _0x2ead2a=Math[_0xb292('0x1e1')](_0x39c16e[_0xb292('0x74')]*(_0x39c16e['predictiveIntervalMaxThreshold']/0x64));var _0x492176=Math[_0xb292('0x1e1')](_0x39c16e[_0xb292('0x74')]*(_0x39c16e[_0xb292('0x1e2')]/0x64));var _0x33a0d0=_0x39c16e[_0xb292('0x50')]+_0x39c16e[_0xb292('0x55')];var _0x3ce8ec=Math['floor'](_0x39c16e[_0xb292('0x76')]*_0x39c16e[_0xb292('0x77')]*_0x39c16e[_0xb292('0x71')]*_0x39c16e['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x39c16e['startProgressive'])){if(!_['isUndefined'](_0x39c16e['startPredictive'])){_0x39c16e[_0xb292('0x29')]=undefined;loggerPredictive[_0xb292('0x9e')](_0xb292('0x1e3'),_0xb292('0x1e4'));}if(!_[_0xb292('0x8b')](_0x39c16e[_0xb292('0x96')])){loggerPredictive[_0xb292('0x9e')](_0xb292('0x1e3'),_0xb292('0x1e5'));clearInterval(_0x39c16e[_0xb292('0x96')]);_0x39c16e[_0xb292('0x96')]=undefined;}_0x39c16e[_0xb292('0x79')]=moment()['format'](_0xb292('0x111'));loggerPredictive[_0xb292('0x82')](_0x39c16e[_0xb292('0x40')],_0xb292('0x1e6'),_0x39c16e[_0xb292('0x79')]);this['handlePower'](_0x39c16e,0x1);}else if(ifInterval(_0x39c16e['dialPredictiveInterval'],_0x39c16e[_0xb292('0x79')])){this['handlePower'](_0x39c16e,0x1);loggerPredictiveCalls[_0xb292('0x82')](_0xb292('0x1e7'),_0x39c16e['startProgressive'],_0x39c16e['name']);_0x39c16e[_0xb292('0x76')]=0x0;_0x39c16e['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x266d0f<_0x3108f0&&_0x39c16e[_0xb292('0x1e8')]===_0xb292('0x1e9')){freeVariablesPredictive(_0x39c16e);loggerPredictive[_0xb292('0x82')](_0xb292('0x1ea'),_0xb292('0x1eb'),_0x3108f0,_0xb292('0x79'),_0x39c16e[_0xb292('0x40')]);}else if(_0x3ce8ec<_0x39c16e['predictiveIntervalErlangCallsDroppedCalls']&&_0x39c16e['dialPredictiveOptimization']===_0xb292('0x1e9')){freeVariablesPredictive(_0x39c16e);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x3ce8ec,_0xb292('0x1ec'),_0x39c16e[_0xb292('0x70')],_0xb292('0x79'),_0x39c16e['name']);}else if(!ifInterval(_0x39c16e['dialPredictiveInterval'],_0x39c16e[_0xb292('0x79')])&&_[_0xb292('0x8b')](_0x39c16e['startPredictive'])&&!_[_0xb292('0x8b')](_0x39c16e['startProgressive'])){_0x39c16e['startPredictive']=moment()[_0xb292('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x39c16e['name'],_0xb292('0x1ed'),_0x39c16e['startPredictive']);this['averageHandleTime'](_0x39c16e[_0xb292('0x1ee')])[_0xb292('0x3c')](this['getDataPredictive'](_0x39c16e))[_0xb292('0x3c')](mergeDataErlangB(_0x39c16e))[_0xb292('0x3c')](this[_0xb292('0x1ef')](_0x39c16e))[_0xb292('0xc1')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x39c16e));}else if(!ifInterval(_0x39c16e[_0xb292('0x1ee')],_0x39c16e[_0xb292('0x29')])){_0x39c16e[_0xb292('0x70')]=0x0;_0x39c16e['startPredictive']=moment()[_0xb292('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xb292('0x82')](_0x39c16e[_0xb292('0x40')],_0xb292('0x1f0'),_0x39c16e[_0xb292('0x29')]);clearInterval(_0x39c16e[_0xb292('0x96')]);_0x39c16e[_0xb292('0x96')]=undefined;this[_0xb292('0xc7')](_0x39c16e[_0xb292('0x1ee')])[_0xb292('0x3c')](this[_0xb292('0x1f1')](_0x39c16e))[_0xb292('0x3c')](mergeDataErlangB(_0x39c16e))['then'](this[_0xb292('0x1ef')](_0x39c16e))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x39c16e));}else if(_0x39c16e[_0xb292('0x74')]&&_0x33a0d0<_0x39c16e[_0xb292('0x74')]-_0x492176){freeVariablesPredictive(_0x39c16e);loggerPredictive['info'](_0x39c16e[_0xb292('0x40')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x33a0d0,')\x20are\x20less\x20than\x20threshold\x20(',_0x39c16e[_0xb292('0x74')],'-',_0x492176,'=',_0x39c16e[_0xb292('0x74')]-_0x492176,')');}else if(_0x39c16e['predictiveIntervalAvailable']&&_0x33a0d0>_0x39c16e[_0xb292('0x74')]+_0x2ead2a){freeVariablesPredictive(_0x39c16e);loggerPredictive[_0xb292('0x82')](_0x39c16e[_0xb292('0x40')],_0xb292('0x1f2'),_0x33a0d0,')\x20are\x20more\x20than\x20threshold\x20(',_0x39c16e['predictiveIntervalAvailable'],'+',_0x2ead2a,'=',_0x39c16e[_0xb292('0x74')]+_0x2ead2a,')');}};Dialer[_0xb292('0x1c')][_0xb292('0x1f1')]=function(_0x12cbaa){var _0x43308a=this;return function(_0x507d59){return new BPromise(function(_0x945611,_0x597029){_[_0xb292('0x94')](_0x12cbaa,_0x507d59[0x0]);if(checkGetDataPredictive(_0x507d59[0x0])){var _0x524500=_0x12cbaa[_0xb292('0x74')]=_0x12cbaa[_0xb292('0x55')]+_0x12cbaa['available'];var _0x445a27=_0x12cbaa[_0xb292('0x1ee')]*0x3c;var _0x42f1cf=_0x507d59[0x0][_0xb292('0x6c')]+_0x507d59[0x0][_0xb292('0x6b')];var _0x171e47=(_0x507d59[0x0][_0xb292('0x6a')]+_0x507d59[0x0][_0xb292('0x6e')]+_0x507d59[0x0][_0xb292('0x6d')])/_0x507d59[0x0][_0xb292('0x84')];_0x12cbaa[_0xb292('0x71')]=_0x171e47>0x0?_0x171e47:0x1;switch(_0x12cbaa[_0xb292('0x1e8')]){case'dropRate':var _0x5b2d70=_0x12cbaa['dialPredictiveOptimizationPercentage']/0x64;return _0x43308a['abandonmentRate'](_0x524500,_0x445a27,_0x42f1cf,_0x171e47,_0x5b2d70)['then'](function(_0x321a06){return _0x945611(_0x321a06);});case _0xb292('0x1f3'):var _0x4da302=_0x12cbaa['dialPredictiveOptimizationPercentage']/0x64;return _0x43308a[_0xb292('0x1f4')](_0x524500,_0x445a27,_0x42f1cf,_0x171e47,_0x4da302)[_0xb292('0x3c')](function(_0xbfd27b){return _0x945611(_0xbfd27b);});default:return _0x597029(msgResponse(_0xb292('0x1f5'),_0xb292('0x155'),_0xb292('0x1f6')));}}else{return _0x597029(msgResponse('[getDataPredictive]',_0xb292('0x155'),'check\x20failure'));}});};};Dialer[_0xb292('0x1c')][_0xb292('0x1f7')]=function(_0x4265a8){var _0x2a4c5b=this;return function(_0x18e73c){return new BPromise(function(_0x447f25,_0x199c94){_['merge'](_0x4265a8,_0x18e73c[0x0]);if(checkGetDataPredictive(_0x18e73c[0x0])){loggerPredictive[_0xb292('0x82')](JSON[_0xb292('0x4a')](_0x18e73c[0x0]));if(_0x4265a8[_0xb292('0x1e8')]===_0xb292('0x1e9')){return _0x2a4c5b[_0xb292('0xd2')](_0x4265a8['id'])[_0xb292('0x3c')](function(_0xc2ccf7){var _0x456f42=_0x4265a8[_0xb292('0x16f')]-_0xc2ccf7[0x0][_0xb292('0x1f8')];var _0x3abe11=_0x4265a8[_0xb292('0x1ee')]*0x3c;var _0x5a3eaf=_0x18e73c[0x0]['predictiveIntervalAvgTalktime']+_0x18e73c[0x0]['predictiveIntervalAvgHoldtime'];var _0x2db199=(_0x18e73c[0x0][_0xb292('0x6a')]+_0x18e73c[0x0][_0xb292('0x6e')]+_0x18e73c[0x0][_0xb292('0x6d')])/_0x18e73c[0x0]['predictiveIntervalTotalCalls'];var _0x5b7d32=_0x4265a8[_0xb292('0x1e0')]/0x64;_0x4265a8[_0xb292('0x73')]=_0xc2ccf7[0x0]['outboundQueuePauses']||0x0;_0x4265a8[_0xb292('0x71')]=_0x2db199>0x0?_0x2db199:0x1;return _0x2a4c5b[_0xb292('0x1f9')](_0x456f42,_0x3abe11,_0x5a3eaf,_0x2db199,_0x5b7d32);})[_0xb292('0x3c')](function(_0xc80fc1){return _0x447f25(_0xc80fc1);})[_0xb292('0xc1')](function(_0xf30e8c){return _0x199c94(msgResponse('[CatchErlangB]',_0xb292('0x155'),JSON[_0xb292('0x4a')](_0xf30e8c)));});}if(_0x4265a8[_0xb292('0x1e8')]===_0xb292('0x1f3')){return _0x2a4c5b[_0xb292('0xd2')](_0x4265a8['id'])[_0xb292('0x3c')](function(_0x55f89a){var _0x3ff067=_0x4265a8['loggedIn']-_0x55f89a[0x0][_0xb292('0x1f8')];var _0x3457ca=_0x4265a8['dialPredictiveInterval']*0x3c;var _0x34c27e=_0x18e73c[0x0][_0xb292('0x6c')]+_0x18e73c[0x0][_0xb292('0x6b')];var _0x1c5a38=(_0x18e73c[0x0][_0xb292('0x6a')]+_0x18e73c[0x0][_0xb292('0x6e')]+_0x18e73c[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x18e73c[0x0][_0xb292('0x84')];var _0x47a527=_0x4265a8[_0xb292('0x1e0')]/0x64;_0x4265a8[_0xb292('0x73')]=_0x55f89a[0x0][_0xb292('0x1f8')]||0x0;_0x4265a8[_0xb292('0x71')]=_0x1c5a38>0x0?_0x1c5a38:0x1;return _0x2a4c5b[_0xb292('0x1f4')](_0x3ff067,_0x3457ca,_0x34c27e,_0x1c5a38,_0x47a527);})[_0xb292('0x3c')](function(_0x10221e){return _0x447f25(_0x10221e);})['catch'](function(_0x41ee54){return _0x199c94(msgResponse(_0xb292('0x1fa'),_0xb292('0x155'),JSON['stringify'](_0x41ee54)));});}}else{return _0x199c94(msgResponse('[getDataPredictive]',_0xb292('0x155'),_0xb292('0x1fb')));}});};};Dialer[_0xb292('0x1c')][_0xb292('0x1ef')]=function(_0x132610){var _0x27b7cb=this;return function(){var _0x41c35e=0x0;var _0xa4b213=Math[_0xb292('0x1fc')](_0x132610[_0xb292('0x1fd')]*0x3e8);if(_0xa4b213>0x0){_0xa4b213=_0xa4b213<0x64?0x64:_0xa4b213;loggerPredictive[_0xb292('0x82')](_0x132610['name'],_0xb292('0x1fe'),_0xa4b213,'milliseconds');_0x132610[_0xb292('0x96')]=setInterval(function(){_0x27b7cb[_0xb292('0x96')](_0x132610);loggerPredictiveCalls['info']('[handlePredictive]',_0x41c35e+=0x1);},_0xa4b213);}else{loggerPredictive[_0xb292('0x82')](_0x132610[_0xb292('0x40')],_0xb292('0x1ff'));}};};Dialer['prototype'][_0xb292('0x200')]=function(_0x300280,_0x20baf4){var _0x56dd1a=this;return function(_0x58bce9){if(_[_0xb292('0x47')](_0x58bce9)){if(_[_0xb292('0xb6')](_0x20baf4[_0xb292('0xdd')])||!_0x20baf4[_0xb292('0x201')]){if(_0x300280['dialMethod']===_0xb292('0x16b')){_0x300280[_0xb292('0x139')]=_['isUndefined'](_0x300280['queueStatusComplete'])?!![]:_0x300280['queueStatusComplete'];var _0x253b27=uuid['v4']();_0x56dd1a[_0xb292('0xb3')][_0x253b27]=new Action(_0x300280,_0x20baf4,_0x253b27);loggerBooked[_0xb292('0x82')](_0xb292('0x202'),_0x253b27,_0xb292('0x203'),JSON['stringify'](_0x300280[_0xb292('0x139')]),_0xb292('0x204'),_0x300280[_0xb292('0x40')]);if(_0x300280[_0xb292('0x139')]){_0x300280[_0xb292('0x139')]=![];_0x56dd1a[_0xb292('0x136')][_0x56dd1a[_0xb292('0xb3')][_0x253b27][_0xb292('0xbc')]]=[];ami[_0xb292('0xb7')]({'actionid':_0x253b27,'action':_0xb292('0x205'),'queue':_0x300280[_0xb292('0x40')]})['catch'](function(){_0x56dd1a['updateOriginated'](_0x300280);_0x56dd1a[_0xb292('0xca')]({'active':![],'ContactId':_0x56dd1a['actions'][_0x253b27][_0xb292('0x12f')],'ListId':_0x56dd1a[_0xb292('0xb3')][_0x253b27][_0xb292('0xdc')],'VoiceQueueId':_0x56dd1a['actions'][_0x253b27]['VoiceQueueId']||undefined,'CampaignId':_0x56dd1a[_0xb292('0xb3')][_0x253b27][_0xb292('0x104')]||undefined})['catch'](loggerCatch(_0xb292('0x206')));delete _0x56dd1a['actions'][_0x253b27];});}else{loggerBooked['info'](_0xb292('0x207'),JSON[_0xb292('0x4a')](_0x300280[_0xb292('0x139')]),_0xb292('0x204'),_0x300280['name']);_0x56dd1a['updateOriginated'](_0x300280);_0x56dd1a['rescheduleContact']({'active':![],'ContactId':_0x56dd1a['actions'][_0x253b27][_0xb292('0x12f')],'ListId':_0x56dd1a[_0xb292('0xb3')][_0x253b27][_0xb292('0xdc')],'VoiceQueueId':_0x56dd1a['actions'][_0x253b27][_0xb292('0xde')]||undefined,'CampaignId':_0x56dd1a[_0xb292('0xb3')][_0x253b27]['CampaignId']||undefined})[_0xb292('0xc1')](loggerCatch(_0xb292('0x206')));delete _0x56dd1a[_0xb292('0xb3')][_0x253b27];}}else{return _0x56dd1a['actionOriginate'](_0x300280,_0x20baf4);}}else{if(getDiff(_0x20baf4['scheduledat'])<_0x300280['dialRecallMeTimeout']*0x3c){if(_0x20baf4[_0xb292('0x17b')]&&!_0x20baf4['Agent']['voicePause']){_0x56dd1a[_0xb292('0x99')][_0xb292('0x13c')](_0x20baf4['id'])[_0xb292('0x1f')](function(){_0x56dd1a[_0xb292('0xbb')](_0x300280);});}else{_0x56dd1a[_0xb292('0xcb')]({'active':![]},_0x20baf4['id'],0x1)[_0xb292('0x1f')](function(){_0x56dd1a[_0xb292('0xbb')](_0x300280);});}}else{_0x300280['outboundReCallsDay']+=0x1;_0x56dd1a[_0xb292('0xbb')](_0x300280);if(_0x300280['dialRecallInQueue']){_0x56dd1a[_0xb292('0xca')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x20baf4[_0xb292('0x12f')],'ListId':_0x20baf4[_0xb292('0xdc')],'VoiceQueueId':_0x20baf4[_0xb292('0xde')]||undefined,'CampaignId':_0x20baf4['CampaignId']||undefined})[_0xb292('0xc1')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x56dd1a['createHistory'](createObjHistory(_0x300280,_0x20baf4,_0xb292('0x208'),0x17,_0xb292('0x209')))[_0xb292('0xc1')](loggerCatch(_0xb292('0x20a')));}else{_0x56dd1a[_0xb292('0xda')](createObjHistory(_0x300280,_0x20baf4,_0xb292('0x20b'),0x16,'RecallFailedTimeout'),_0xb292('0x20c'),'[Originate][HistoryRecallClose]');}}}}else{_0x300280['outboundBlacklistCallsDay']+=0x1;_0x56dd1a[_0xb292('0xda')](createObjHistory(_0x300280,_0x20baf4,_0xb292('0x20d'),0xd,_0xb292('0x20e')),_0xb292('0x20f'),_0xb292('0x210'));throw _0xb292('0x211');}};};Dialer[_0xb292('0x1c')][_0xb292('0x16d')]=function(_0x33f1b1){var _0x11a615=this;var _0x1a51e7=_0x33f1b1[_0xb292('0x212')]-_0x33f1b1[_0xb292('0x75')]-_0x33f1b1['temp'];emitCampaignSummary(_0x33f1b1);if(_0x1a51e7>0x0){if(_0x1a51e7>this[_0xb292('0x25')]){_0x1a51e7=this[_0xb292('0x25')];}_0x33f1b1[_0xb292('0xce')]+=_0x1a51e7;this[_0xb292('0xd0')](_0x33f1b1['id'],_0x1a51e7,_0x33f1b1[_0xb292('0x213')],_0x33f1b1)[_0xb292('0x3c')](function(_0x3f8574){_0x33f1b1[_0xb292('0xce')]-=_0x1a51e7;_0x33f1b1[_0xb292('0xce')]=_0x33f1b1[_0xb292('0xce')]>0x0?_0x33f1b1[_0xb292('0xce')]:0x0;if(!checkContactEmpty(_0x3f8574)){_0x33f1b1['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xb292('0x82')]('[getContactCampaign2][Empty]'+_0x33f1b1['name']);}else{_0x33f1b1['originated']+=_0x3f8574[_0xb292('0xa0')];_0x33f1b1[_0xb292('0x3e')]=_0xb292('0x214');for(var _0x13f362=0x0;_0x13f362<_0x3f8574[_0xb292('0xa0')];_0x13f362+=0x1){_0x33f1b1['ivrTotalCallsDays']+=0x1;if(_[_0xb292('0xb6')](_0x3f8574[_0x13f362])||_[_0xb292('0xb6')](_0x3f8574[_0x13f362][_0xb292('0x1a0')])||_[_0xb292('0xb6')](_0x3f8574[_0x13f362][_0xb292('0x187')])){_0x11a615[_0xb292('0xd8')](_0xb292('0x215'),_0x33f1b1,_0x3f8574[_0x13f362]);}else{_0x11a615[_0xb292('0xc6')](_[_0xb292('0xdb')](_0x3f8574[_0x13f362],['CampaignId',_0xb292('0x216')]))[_0xb292('0x3c')](_0x11a615[_0xb292('0x200')](_0x33f1b1,_0x3f8574[_0x13f362]))[_0xb292('0xc1')](_0x11a615[_0xb292('0x217')]('[actionOriginateIvr]\x20',_0x33f1b1));}}}})['catch'](loggerGetContactDialer(_0xb292('0x218'),_0x33f1b1,_0x1a51e7));}};Dialer[_0xb292('0x1c')][_0xb292('0x168')]=function(_0x4dd93e,_0x2e65a2){var _0x498401=this;var _0x3afc37=[];var _0x29434b=_0x2e65a2>=0x1?_0x2e65a2:0x1;if(_0x4dd93e[_0xb292('0x16e')]===_0xb292('0x16b')){_0x29434b=0x1;}var _0x1575d3=Math['floor'](_0x4dd93e[_0xb292('0x50')]*_0x29434b)-_0x4dd93e[_0xb292('0x75')]-_0x4dd93e[_0xb292('0xce')];emitVoiceQueueSummary(_0x4dd93e);if(_0x4dd93e[_0xb292('0x219')]>0x0){var _0x5b65c0=_0x4dd93e[_0xb292('0x219')]-_0x4dd93e['originated']-_0x4dd93e[_0xb292('0x55')]-_0x4dd93e['temp']-_0x4dd93e[_0xb292('0x51')];if(_0x1575d3>_0x5b65c0){_0x1575d3=_0x5b65c0;}}if(_0x1575d3>0x0){if(_0x4dd93e[_0xb292('0x16e')]===_0xb292('0x16b')){_0x1575d3=0x1;}if(_0x1575d3>this[_0xb292('0x25')]){_0x1575d3=this['maxNumberOriginate'];}_0x4dd93e[_0xb292('0xce')]+=_0x1575d3;for(var _0x5f2b53 in this['agents']){if(typeof this[_0xb292('0x23')][_0x5f2b53]!==_0xb292('0xb5')){if(this[_0xb292('0x23')][_0x5f2b53][_0xb292('0xaf')]===_0xb292('0x21a')&&this[_0xb292('0x23')][_0x5f2b53][_0xb292('0xb8')]===_0xb292('0xe4')){_0x3afc37['push'](this[_0xb292('0x23')][_0x5f2b53]['id']);}}}this[_0xb292('0xcd')](_0x4dd93e['id'],_0x3afc37,_0x1575d3,_0x4dd93e[_0xb292('0x213')],_0x4dd93e)[_0xb292('0x3c')](function(_0x303ee0){_0x4dd93e[_0xb292('0xce')]-=_0x1575d3;_0x4dd93e[_0xb292('0xce')]=_0x4dd93e[_0xb292('0xce')]>0x0?_0x4dd93e['temp']:0x0;if(!checkContactEmpty(_0x303ee0)){_0x498401[_0xb292('0xbe')](_0x4dd93e)[_0xb292('0x3c')](sendMessageReschedule(_0x4dd93e))['catch'](loggerCatch(_0xb292('0xbf')));}else{_0x4dd93e['originated']+=_0x303ee0[_0xb292('0xa0')];_0x4dd93e[_0xb292('0x3e')]=_0x4dd93e[_0xb292('0x16e')]==='booked'?_0xb292('0x18f'):_0xb292('0x214');for(var _0x3680c0=0x0;_0x3680c0<_0x303ee0['length'];_0x3680c0+=0x1){if(_[_0xb292('0xb6')](_0x303ee0[_0x3680c0])||_['isNil'](_0x303ee0[_0x3680c0][_0xb292('0x1a0')])||_[_0xb292('0xb6')](_0x303ee0[_0x3680c0][_0xb292('0x187')])){_0x498401[_0xb292('0xd8')](_0xb292('0x215'),_0x4dd93e,_0x303ee0[_0x3680c0]);}else{_0x498401[_0xb292('0xc0')](_[_0xb292('0xdb')](_0x303ee0[_0x3680c0],[_0xb292('0xde'),_0xb292('0x216')]))['then'](_0x498401[_0xb292('0x200')](_0x4dd93e,_0x303ee0[_0x3680c0]))[_0xb292('0xc1')](_0x498401[_0xb292('0x217')](_0xb292('0x215'),_0x4dd93e));}}}})[_0xb292('0xc1')](loggerGetContactDialer(_0xb292('0x21b'),_0x4dd93e,_0x1575d3));}};Dialer[_0xb292('0x1c')]['handlePredictive']=function(_0x460179){if(_0x460179[_0xb292('0x219')]>0x0){var _0x2a9318=_0x460179['dialLimitQueue']-_0x460179['originated']-_0x460179[_0xb292('0x55')];if(_0x2a9318>0x0){this[_0xb292('0x21c')](_0x460179);}else{loggerPredictiveCalls['info'](_0xb292('0x21d'));}}else{this[_0xb292('0x21c')](_0x460179);}};Dialer[_0xb292('0x1c')][_0xb292('0x21c')]=function(_0x29148c){var _0x1249e4=this;var _0x57f167=[];_0x29148c[_0xb292('0x75')]+=0x1;for(var _0x2c3d71 in this[_0xb292('0x23')]){if(typeof this[_0xb292('0x23')][_0x2c3d71]!==_0xb292('0xb5')){if(this['agents'][_0x2c3d71][_0xb292('0xaf')]==='not_inuse'&&this[_0xb292('0x23')][_0x2c3d71][_0xb292('0xb8')]==='reachable'){_0x57f167[_0xb292('0x137')](this[_0xb292('0x23')][_0x2c3d71]['id']);}}}this[_0xb292('0xcd')](_0x29148c['id'],_0x57f167,0x1,_0x29148c[_0xb292('0x213')],_0x29148c)[_0xb292('0x3c')](function(_0x2ad8f5){if(!checkContactEmpty(_0x2ad8f5)){checkContactLowerLimitOriginate(_0x29148c,0x1,0x0);_0x1249e4[_0xb292('0xbe')](_0x29148c)[_0xb292('0x3c')](sendMessageReschedule(_0x29148c))[_0xb292('0xc1')](loggerCatch(_0xb292('0xbf')));}else{_0x29148c[_0xb292('0x3e')]=_0xb292('0x214');if(_[_0xb292('0xb6')](_0x2ad8f5[0x0])||_[_0xb292('0xb6')](_0x2ad8f5[0x0][_0xb292('0x1a0')])||_[_0xb292('0xb6')](_0x2ad8f5[0x0][_0xb292('0x187')])){_0x1249e4['emptyContact']('[actionOriginate]\x20',_0x29148c,_0x2ad8f5[0x0]);}else{_0x1249e4[_0xb292('0xc0')](_[_0xb292('0xdb')](_0x2ad8f5[0x0],['VoiceQueueId',_0xb292('0x216')]))['then'](_0x1249e4[_0xb292('0x200')](_0x29148c,_0x2ad8f5[0x0]))['catch'](_0x1249e4['loggerHandler'](_0xb292('0x21e'),_0x29148c));}}})['catch'](loggerGetContactDialer(_0xb292('0x21f'),_0x29148c,0x1));emitVoiceQueueSummary(_0x29148c);};Dialer['prototype']['abandonmentRate']=function(_0x1d7cef,_0x585bda,_0x53d666,_0x4b8409,_0x516374,_0x544ab1){loggerPredictive[_0xb292('0x82')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xb292('0x82')](_0xb292('0x220'),_0x1d7cef);loggerPredictive[_0xb292('0x82')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x585bda);loggerPredictive[_0xb292('0x82')](_0xb292('0x221'),_0x53d666);loggerPredictive[_0xb292('0x82')](_0xb292('0x222'),_0x4b8409);loggerPredictive[_0xb292('0x82')](_0xb292('0x223'),_0x516374);loggerPredictive[_0xb292('0x82')](_0xb292('0x8a'));return new BPromise(function(_0x7dc13c,_0x35e1ca){if(_0x1d7cef<=0x0||isNaN(_0x1d7cef)){return _0x35e1ca(msgResponse(_0xb292('0x224'),_0xb292('0x49'),_0xb292('0x225')+_0x1d7cef));}if(_0x53d666<=0x0||isNaN(_0x53d666)){return _0x35e1ca(msgResponse(_0xb292('0x224'),_0xb292('0x49'),_0xb292('0x226')+_0x53d666));}if(_0x4b8409<=0x0||isNaN(_0x4b8409)){return _0x35e1ca(msgResponse(_0xb292('0x224'),_0xb292('0x49'),'p\x20=\x20'+_0x4b8409));}if(_0x585bda<=0x0||isNaN(_0x585bda)){return _0x35e1ca(msgResponse(_0xb292('0x224'),_0xb292('0x49'),_0xb292('0x227')+_0x585bda));}if(_0x516374<=0x0||isNaN(_0x516374)){return _0x35e1ca(msgResponse(_0xb292('0x224'),'Error',_0xb292('0x228')+_0x516374));}_0x544ab1=_0x544ab1||0x0;var _0x5c008a=0x1/_0x53d666;var _0x2111f4=0x0;var _0x1fbd40=0x0;var _0x5025b4=0x0;var _0xa49c8f=0x0;for(var _0x1e4a35=0x0;_0x5025b4<_0x516374;_0x1e4a35+=0x1){_0x1fbd40=_0x1e4a35/_0x585bda;_0x2111f4=(_0x4b8409*_0x1fbd40+_0x544ab1)/_0x5c008a;_0x5025b4=erlangb(_0x2111f4,_0x1d7cef);_0xa49c8f=_0x2111f4/_0x1d7cef*(0x1-erlangb(_0x2111f4,_0x1d7cef));}return _0x7dc13c({'erlangCalls':_0x1e4a35,'erlangCallToSecond':_0x585bda/_0x1e4a35,'erlangAbandonmentRate':_0x5025b4,'erlangBusyFactor':_0xa49c8f});});};Dialer[_0xb292('0x1c')][_0xb292('0x1f4')]=function(_0x4293ad,_0x35fa98,_0x4d2ddc,_0x53ff6c,_0x21b099,_0x1ee34c){loggerPredictive[_0xb292('0x82')](_0xb292('0x229'));loggerPredictive[_0xb292('0x82')](_0xb292('0x220'),_0x4293ad);loggerPredictive[_0xb292('0x82')](_0xb292('0x22a'),_0x35fa98);loggerPredictive[_0xb292('0x82')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d2ddc);loggerPredictive['info'](_0xb292('0x222'),_0x53ff6c);loggerPredictive[_0xb292('0x82')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x21b099);loggerPredictive[_0xb292('0x82')]('---------------------------');return new BPromise(function(_0x351499,_0x516c17){if(_0x4293ad<=0x0||isNaN(_0x4293ad)){return _0x516c17(msgResponse(_0xb292('0x22b'),_0xb292('0x49'),'m\x20=\x20'+_0x4293ad));}if(_0x4d2ddc<=0x0||isNaN(_0x4d2ddc)){return _0x516c17(msgResponse(_0xb292('0x22b'),_0xb292('0x49'),_0xb292('0x226')+_0x4d2ddc));}if(_0x53ff6c<=0x0||isNaN(_0x53ff6c)){return _0x516c17(msgResponse(_0xb292('0x22b'),'Error','p\x20=\x20'+_0x53ff6c));}if(_0x35fa98<=0x0||isNaN(_0x35fa98)){return _0x516c17(msgResponse(_0xb292('0x22b'),_0xb292('0x49'),_0xb292('0x227')+_0x35fa98));}if(_0x21b099<=0x0||isNaN(_0x21b099)){return _0x516c17(msgResponse(_0xb292('0x22b'),'Error',_0xb292('0x22c')+_0x21b099));}_0x1ee34c=_0x1ee34c||0x0;var _0x3a7dff=0x1/_0x4d2ddc;var _0x31858c=0x0;var _0x3d9a0f=0x0;var _0x516054=0x0;var _0x9b5bc5=0x0;for(var _0x3c3f43=0x0;_0x9b5bc5<_0x21b099;_0x3c3f43+=0x1){_0x3d9a0f=_0x3c3f43/_0x35fa98;_0x31858c=(_0x53ff6c*_0x3d9a0f+_0x1ee34c)/_0x3a7dff;_0x516054=erlangb(_0x31858c,_0x4293ad);_0x9b5bc5=_0x31858c/_0x4293ad*(0x1-erlangb(_0x31858c,_0x4293ad));}return _0x351499({'erlangCalls':_0x3c3f43,'erlangCallToSecond':_0x35fa98/_0x3c3f43,'erlangAbandonmentRate':_0x516054,'erlangBusyFactor':_0x9b5bc5});});};module[_0xb292('0x22d')]=Dialer;
\ No newline at end of file
+var _0x2750=['countmachineretry','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','Machine','stateGlobal','reason19\x20machine....','ContactId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','[syncHangupIvr]','cause-txt','Unknow','reason','agent','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','agiafterat','dialQueueProject2','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridnum','[syncAgentComplete][createHistory][10]','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','calleridname','[syncAgentComplete][createHistory][11]','actions','actionid','locked','paused','stateinterface','rrmemory','queueBooked','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','preview','run','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','interval','content','indexOf','true','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','launchHandleIvr','handleIvr','dialGlobalInterval','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','online','reachable','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','replace','random','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','dialNoSuchNumberMaxRetry','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','dialAbandonedMaxRetry','reason\x2011\x20abandoned','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','averageHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','outboundQueuePauses','[CatchErlangB]','floor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkContactBlack','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','[actionOriginate]\x20','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','util','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','../rpc/voiceQueueRt','../rpc/setting','./action','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','tail','finally','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBookedRR','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','type','outbound','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','talking','total','unmanaged','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','voice:queue:%s','voice_queue:save','ivr','format','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','startProgressive','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','error','stack','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','available','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','endtime','starttime','[uniqueid]','clearZombieChannels','[actions]','undefined','sequence','enqueue','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','countReScheduled','[countReScheduled]\x20','checkIsBlackList','catch','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','pick','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','SIP/%s','unmonitored','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','statedesc','HangupInAMD','membername','AMD','emit','custom:amd','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE'];(function(_0x4a13db,_0x912364){var _0x3bdc9e=function(_0x2f3ed9){while(--_0x2f3ed9){_0x4a13db['push'](_0x4a13db['shift']());}};_0x3bdc9e(++_0x912364);}(_0x2750,0x13b));var _0x0275=function(_0x1b18c7,_0x1116f4){_0x1b18c7=_0x1b18c7-0x0;var _0x3140c4=_0x2750[_0x1b18c7];return _0x3140c4;};'use strict';var util=require(_0x0275('0x0'));var _=require('lodash');var BPromise=require(_0x0275('0x1'));var uuid=require(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var rr=require('rr');var md5=require(_0x0275('0x4'));var Redis=require(_0x0275('0x5'));var ut=require(_0x0275('0x6'));var config=require(_0x0275('0x7'));var logger=require(_0x0275('0x8'))(_0x0275('0x9'));var loggerBooked=require(_0x0275('0x8'))('booked');var loggerPredictive=require(_0x0275('0x8'))(_0x0275('0xa'));var loggerPredictiveCalls=require(_0x0275('0x8'))(_0x0275('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x0275('0xc'));var ami=require(_0x0275('0xd'));config[_0x0275('0xe')]=_['defaults'](config['redis'],{'host':_0x0275('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0275('0xe')]));var cmHopper=require(_0x0275('0x10'));var cmHopperHistory=require(_0x0275('0x11'));var cmHopperFinal=require(_0x0275('0x12'));var cmHopperAdditionalPhone=require(_0x0275('0x13'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x0275('0x14'));var RpcSetting=require(_0x0275('0x15'));var Action=require(_0x0275('0x16'));var History=require('./history');var Final=require('./final');var AgentComplete=require(_0x0275('0x17'));var QueueCallerAbandon=require(_0x0275('0x18'));var Hangup=require(_0x0275('0x19'));var ipAgi=process[_0x0275('0x1a')][_0x0275('0x1b')]||_0x0275('0x1c');var strategy={'rrmemory':'rrmemory','roundrobin':_0x0275('0x1d')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x0275('0x1e')]['enqueue']=function(_0x6344fc){this[_0x0275('0x1f')]=this['tail']?this[_0x0275('0x1f')][_0x0275('0x20')](_0x6344fc):_0x6344fc();};function Dialer(_0x4a5578,_0x5e7466){this['sequence']=new Sequence();this['preview']=_0x5e7466;this['voiceQueues']=_0x4a5578[_0x0275('0x21')];this[_0x0275('0x22')]=_0x4a5578[_0x0275('0x22')];this['agents']=_0x4a5578[_0x0275('0x23')];this[_0x0275('0x24')]=_0x4a5578[_0x0275('0x24')];this['maxNumberOriginate']=config[_0x0275('0x25')]||0x2;this[_0x0275('0x26')]={};this['actions']={};this['contactsId']={};this[_0x0275('0x27')]={};this[_0x0275('0x28')]={};this[_0x0275('0x29')]={};this['startProgressive']={};this[_0x0275('0x2a')]={};this['queueBooked']={};this[_0x0275('0x2b')]={};ami['on']('agentconnect',this[_0x0275('0x2c')][_0x0275('0x2d')](this));ami['on']('queuecallerabandon',this[_0x0275('0x2e')][_0x0275('0x2d')](this));ami['on'](_0x0275('0x2f'),this['syncOriginateResponse'][_0x0275('0x2d')](this));ami['on'](_0x0275('0x30'),this[_0x0275('0x31')][_0x0275('0x2d')](this));ami['on'](_0x0275('0x32'),this[_0x0275('0xc')]['bind'](this));ami['on'](_0x0275('0x33'),this[_0x0275('0x34')][_0x0275('0x2d')](this));ami['on'](_0x0275('0x35'),this[_0x0275('0x36')]['bind'](this));ami['on'](_0x0275('0x37'),this[_0x0275('0x38')][_0x0275('0x2d')](this));ami['on'](_0x0275('0x39'),this[_0x0275('0x3a')]['bind'](this));ami['on'](_0x0275('0x3b'),this[_0x0275('0x3c')][_0x0275('0x2d')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0x0275('0x2d')](this));this[_0x0275('0x3d')]();this['loopClearZombieChannels']();RpcSetting[_0x0275('0x3e')]()[_0x0275('0x3f')](function(_0x4378dd){previewRecallmeReminderInterval=_0x4378dd[_0x0275('0x40')];});}function isNotNull(_0x5d763d){return _0x5d763d!==null&&!_[_0x0275('0x41')](_0x5d763d);}function checkIsLoggedIn(_0x86940b,_0x3bba47){return function(){if(_0x3bba47<=0x0){_0x86940b[_0x0275('0x42')]='AGENTS_NOT_LOGGED';throw _0x86940b[_0x0275('0x43')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x2cc5df){return _0x2cc5df;}function checkIsActive(_0x4ead8e,_0x26aae0){return function(){if(!isActive(_0x26aae0)){_0x4ead8e[_0x0275('0x42')]='NOT_ACTIVE';throw _0x4ead8e[_0x0275('0x43')]+_0x0275('0x44');}};}function checkInterval(_0x1575be){return function(){if(!isNotNull(_0x1575be[_0x0275('0x45')])){_0x1575be['message']=_0x0275('0x46');throw _0x1575be[_0x0275('0x43')]+_0x0275('0x47');}if(!isNotNull(_0x1575be[_0x0275('0x45')][_0x0275('0x48')])){_0x1575be['message']=_0x0275('0x46');throw _0x1575be[_0x0275('0x43')]+_0x0275('0x47');}if(!isNotNull(_[_0x0275('0x49')](_0x1575be[_0x0275('0x45')][_0x0275('0x48')]))){_0x1575be[_0x0275('0x42')]=_0x0275('0x46');throw _0x1575be[_0x0275('0x43')]+_0x0275('0x47');}};}function msgResponse(_0xb3264e,_0x5b47bc,_0x2e9ba0){return{'action':_0xb3264e,'response':_0x5b47bc,'message':_0x2e9ba0,'stack':_0x2e9ba0};}function myreject(_0xa93bae){return function(_0xc7d2fe){return _0xa93bae(msgResponse(_0x0275('0x4a'),_0x0275('0x4b'),JSON[_0x0275('0x4c')](_0xc7d2fe)));};}function getSeconds(_0x1a2424,_0x28631b){var _0x34cbe3=moment(_0x1a2424)[_0x0275('0x4d')](0x0);var _0x124e7d=moment(_0x28631b)[_0x0275('0x4d')](0x0);return _0x34cbe3[_0x0275('0x4e')](_0x124e7d,_0x0275('0x4f'));}function emit(_0x5b5606,_0x3c81fc,_0x1cc40d){io['to'](_0x5b5606)['emit'](_0x3c81fc,_0x1cc40d);}function emitVoiceQueueSummary(_0x31d0ab){if(_0x31d0ab[_0x0275('0x50')]===_0x0275('0x51')){var _0xe72991={'id':_0x31d0ab['id'],'name':_0x31d0ab[_0x0275('0x43')],'strategy':_0x31d0ab[_0x0275('0x52')],'answered':_0x31d0ab[_0x0275('0x53')],'available':_0x31d0ab['available'],'loggedIn':_0x31d0ab[_0x0275('0x54')],'pTalking':_0x31d0ab[_0x0275('0x55')],'sumBillable':_0x31d0ab[_0x0275('0x56')],'sumDuration':_0x31d0ab[_0x0275('0x57')],'sumHoldTime':_0x31d0ab['sumHoldTime']||0x0,'talking':_0x31d0ab[_0x0275('0x58')],'total':_0x31d0ab[_0x0275('0x59')],'type':_0x31d0ab[_0x0275('0x50')],'unmanaged':_0x31d0ab[_0x0275('0x5a')],'abandoned':_0x31d0ab['abandoned'],'waiting':_0x31d0ab[_0x0275('0x5b')],'loggedInDb':_0x31d0ab['loggedInDb'],'dialActive':_0x31d0ab[_0x0275('0x5c')],'dialMethod':_0x31d0ab[_0x0275('0x5d')],'dialOriginateCallerIdName':_0x31d0ab[_0x0275('0x5e')],'dialOriginateCallerIdNumber':_0x31d0ab[_0x0275('0x5f')],'dialOriginateTimeout':_0x31d0ab['dialOriginateTimeout'],'dialPrefix':_0x31d0ab[_0x0275('0x60')],'outboundAnswerAgiCallsDay':_0x31d0ab[_0x0275('0x61')],'outboundAnswerCallsDay':_0x31d0ab['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x31d0ab[_0x0275('0x62')],'outboundBusyCallsDay':_0x31d0ab[_0x0275('0x63')],'outboundCongestionCallsDay':_0x31d0ab[_0x0275('0x64')],'outboundDropCallsDayACS':_0x31d0ab['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x31d0ab[_0x0275('0x65')],'outboundDropCallsDayTimeout':_0x31d0ab[_0x0275('0x66')],'outboundNoAnswerCallsDay':_0x31d0ab['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x31d0ab[_0x0275('0x67')],'outboundOriginateFailureCallsDay':_0x31d0ab[_0x0275('0x68')],'outboundReCallsDay':_0x31d0ab[_0x0275('0x69')],'outboundRejectCallsDay':_0x31d0ab[_0x0275('0x6a')],'outboundUnknownCallsDay':_0x31d0ab[_0x0275('0x6b')],'predictiveIntervalAnsweredCalls':_0x31d0ab[_0x0275('0x6c')],'predictiveIntervalAvgHoldtime':_0x31d0ab[_0x0275('0x6d')],'predictiveIntervalAvgTalktime':_0x31d0ab[_0x0275('0x6e')],'predictiveIntervalDroppedCallsCallersExit':_0x31d0ab[_0x0275('0x6f')],'predictiveIntervalDroppedCallsTimeout':_0x31d0ab[_0x0275('0x70')],'predictiveIntervalErlangCalls':_0x31d0ab[_0x0275('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0x31d0ab['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x31d0ab[_0x0275('0x72')],'predictiveIntervalMultiplicativeFactor':_0x31d0ab[_0x0275('0x73')],'predictiveIntervalPauses':_0x31d0ab[_0x0275('0x74')],'predictiveIntervalAvailable':_0x31d0ab[_0x0275('0x75')],'predictiveIntervalTotalCalls':_0x31d0ab[_0x0275('0x76')],'message':_0x31d0ab[_0x0275('0x42')],'originated':_0x31d0ab[_0x0275('0x77')],'erlangCalls':_0x31d0ab[_0x0275('0x78')],'erlangCallToSecond':_0x31d0ab[_0x0275('0x79')],'erlangAbandonmentRate':_0x31d0ab[_0x0275('0x7a')],'erlangBusyFactor':_0x31d0ab[_0x0275('0x7b')],'startPredictive':_0x31d0ab['startPredictive'],'startProgressive':_0x31d0ab['startProgressive']};if(_0x31d0ab[_0x0275('0x7c')]){_0xe72991[_0x0275('0x7c')]={'id':_0x31d0ab[_0x0275('0x7c')]['id'],'name':_0x31d0ab[_0x0275('0x7c')][_0x0275('0x43')],'active':_0x31d0ab['Trunk'][_0x0275('0x7d')],'callerid':_0x31d0ab['Trunk'][_0x0275('0x7e')]};}if(_0x31d0ab[_0x0275('0x45')]){_0xe72991[_0x0275('0x45')]={'id':_0x31d0ab[_0x0275('0x45')]['id'],'name':_0x31d0ab['Interval'][_0x0275('0x43')]};}var _0x5f5dda=md5(JSON['stringify'](_0xe72991));if(_0x31d0ab['md5']!==_0x5f5dda){_0x31d0ab[_0x0275('0x4')]=_0x5f5dda;emit(util['format'](_0x0275('0x7f'),_0xe72991[_0x0275('0x43')]),_0x0275('0x80'),_0xe72991);}}}function emitCampaignSummary(_0x36971e){if(_0x36971e[_0x0275('0x50')]===_0x0275('0x81')){emit(util[_0x0275('0x82')]('campaign:ivr:%s',_0x36971e[_0x0275('0x43')]),'campaign:save',_0x36971e);}}function checkGetDataPredictive(_0x66dca4){if(isNotNull(_0x66dca4)&&!_[_0x0275('0x49')](_0x66dca4)){loggerPredictive[_0x0275('0x83')](_0x0275('0x84'));loggerPredictive[_0x0275('0x83')](_0x0275('0x85'),_0x66dca4[_0x0275('0x76')]);loggerPredictive[_0x0275('0x83')](_0x0275('0x86'),_0x66dca4[_0x0275('0x6c')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x66dca4[_0x0275('0x70')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x66dca4[_0x0275('0x6f')]);loggerPredictive[_0x0275('0x83')](_0x0275('0x87'),_0x66dca4[_0x0275('0x6d')]);loggerPredictive[_0x0275('0x83')](_0x0275('0x88'),_0x66dca4['predictiveIntervalAvgTalktime']);loggerPredictive[_0x0275('0x83')](_0x0275('0x89'));if(_0x66dca4[_0x0275('0x76')]>0x0){if(!_[_0x0275('0x41')](_0x66dca4[_0x0275('0x6e')])&&_0x66dca4[_0x0275('0x6e')]>0x0){return!![];}loggerPredictive['info'](_0x0275('0x8a'));if(!_[_0x0275('0x41')](_0x66dca4['predictiveIntervalAvgHoldtime'])&&_0x66dca4[_0x0275('0x6d')]>0x0){return!![];}loggerPredictive['info'](_0x0275('0x8b'));}else{loggerPredictive[_0x0275('0x83')](_0x0275('0x8c'));}}else{loggerPredictive[_0x0275('0x83')](_0x0275('0x8d'));}return![];}function mergeDataErlangB(_0x7749c4){return function(_0x30ad5b){loggerPredictive[_0x0275('0x83')](_0x0275('0x8e'));loggerPredictive[_0x0275('0x83')](_0x0275('0x8f'),_0x30ad5b['erlangCalls']);loggerPredictive[_0x0275('0x83')](_0x0275('0x90'),_0x30ad5b[_0x0275('0x79')]);loggerPredictive['info'](_0x0275('0x91'),_0x30ad5b[_0x0275('0x7a')]);loggerPredictive['info'](_0x0275('0x92'),_0x30ad5b['erlangBusyFactor']);loggerPredictive[_0x0275('0x83')](_0x0275('0x91'),_0x30ad5b[_0x0275('0x7a')]);loggerPredictive[_0x0275('0x83')]('---------------------------');_[_0x0275('0x93')](_0x7749c4,_0x30ad5b);};}function getDiff(_0x59947e){var _0x2a4f8d=moment()[_0x0275('0x4d')](0x0);var _0x4e3763=moment(_0x59947e)[_0x0275('0x4d')](0x0);return _0x2a4f8d[_0x0275('0x4e')](_0x4e3763,'seconds');}function ifInterval(_0x1a6806,_0x2bb5a8){if(_['isUndefined'](_0x2bb5a8)){return![];}return getDiff(_0x2bb5a8)<_0x1a6806*0x3c;}function freeVariablesPredictive(_0x5da84a){if(isNotNull(_0x5da84a)){if(!_[_0x0275('0x41')](_0x5da84a[_0x0275('0x94')])){_0x5da84a['startProgressive']=undefined;loggerPredictive['info'](_0x5da84a[_0x0275('0x43')],_0x0275('0x95'));}if(!_[_0x0275('0x41')](_0x5da84a[_0x0275('0x29')])){_0x5da84a[_0x0275('0x29')]=undefined;loggerPredictive[_0x0275('0x83')](_0x5da84a[_0x0275('0x43')],_0x0275('0x96'));}if(!_['isUndefined'](_0x5da84a[_0x0275('0x97')])){clearInterval(_0x5da84a[_0x0275('0x97')]);_0x5da84a[_0x0275('0x97')]=undefined;loggerPredictive[_0x0275('0x83')](_0x5da84a[_0x0275('0x43')],_0x0275('0x98'));}}}function erlangb(_0x51feee,_0x1a4b01){if(_0x1a4b01===0x0){return 0x0;}var _0x566ca4=0x1;for(var _0x422ff4=0x1;_0x422ff4<=_0x1a4b01;_0x422ff4+=0x1){_0x566ca4=0x1+_0x566ca4*_0x422ff4/_0x51feee;}return 0x1/_0x566ca4;}function isVoiceQueueOutbound(_0x287429){return _0x287429===_0x0275('0x51');}function isNotPreview(_0x37a0c2){return _0x37a0c2!=='preview';}function isCampaignIvr(_0x38d006){return _0x38d006===_0x0275('0x81');}function getCallerId(_0x2fb691,_0xea7016,_0x324001){if(!_[_0x0275('0x41')](_0x324001)&&typeof _0x324001===_0x0275('0x99')&&!_[_0x0275('0x49')](_0x324001)){if(!_[_0x0275('0x41')](_0xea7016)&&typeof _0xea7016==='string'&&!_['isEmpty'](_0xea7016)){return util['format'](_0x0275('0x9a'),_0xea7016,_0x324001);}return util[_0x0275('0x82')](_0x0275('0x9a'),_0x324001,_0x324001);}if(!_['isUndefined'](_0x2fb691)&&typeof _0x2fb691===_0x0275('0x99')&&!_[_0x0275('0x49')](_0x2fb691)){return _0x2fb691;}return _0x0275('0x9b');}function loggerCatchQueueSummary(_0x25a131,_0x342075){return function(_0x55890d){freeVariablesPredictive(_0x342075);emitVoiceQueueSummary(_0x342075);emitCampaignSummary(_0x342075);loggerSyncQueueSummary[_0x0275('0x9c')](_0x25a131,util['inspect'](_0x55890d,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x207483,_0x1afd8b){return function(_0x46514f){loggerPredictive[_0x0275('0x9d')](_0x1afd8b['name'],_0x207483);loggerPredictive[_0x0275('0x9d')](_0x46514f[_0x0275('0x9e')]);freeVariablesPredictive(_0x1afd8b);};}function loggerCatch(_0x3c14e1){return function(_0x54c490){logger[_0x0275('0x9d')](_0x3c14e1,util[_0x0275('0x9f')](_0x54c490,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2906ba){return _0x2906ba&&!_[_0x0275('0x41')](_0x2906ba)&&_0x2906ba[_0x0275('0xa0')]>0x0;}function decremetOriginate(_0x2aebe1){if(!_[_0x0275('0x41')](_0x2aebe1)&&_0x2aebe1!==null){if(typeof _0x2aebe1[_0x0275('0x77')]!=='undefined'){if(_0x2aebe1['originated']>0x0){_0x2aebe1['originated']-=0x1;}else{logger[_0x0275('0x9d')](_0x0275('0xa1'));}}}else{logger[_0x0275('0x9d')](_0x0275('0xa2'));}}function checkContactLowerLimitOriginate(_0xb336b0,_0x5abf4e,_0x5c273e){if(_0x5abf4e>_0x5c273e){for(var _0x55d769=0x0;_0x55d769<_0x5abf4e-_0x5c273e;_0x55d769+=0x1){decremetOriginate(_0xb336b0);}}}function loggerGetContactDialer(_0x4820b0,_0x46d110,_0x4b3d73){return function(_0x158000){checkContactLowerLimitOriginate(_0x46d110,_0x4b3d73,0x0);logger[_0x0275('0x9d')](_0x4820b0,util[_0x0275('0x9f')](_0x158000,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x34f4b8){return function(_0x4207d5){if(isNotNull(_0x4207d5)&&isNotNull(_0x4207d5[0x0])){if(_0x4207d5[0x0][_0x0275('0xa3')]>0x0){_0x34f4b8[_0x0275('0x42')]=_0x0275('0xa4');logger[_0x0275('0x83')](_0x0275('0xa5')+_0x34f4b8[_0x0275('0x43')],_0x4207d5[0x0][_0x0275('0xa3')],_0x0275('0xa6'));}else{_0x34f4b8[_0x0275('0x42')]=_0x0275('0xa7');logger[_0x0275('0x83')](_0x0275('0xa8')+_0x34f4b8[_0x0275('0x43')]);}}};}function notSendMessagesQueue(_0x39a22e){if(_0x39a22e[_0x0275('0xa9')]){freeVariablesPredictive(_0x39a22e);if(_0x39a22e[_0x0275('0x77')]===0x0&&_0x39a22e['talking']===0x0&&_0x39a22e[_0x0275('0x5b')]===0x0&&(_0x39a22e[_0x0275('0x55')]||0x0)===0x0){_0x39a22e[_0x0275('0xa9')]=![];_0x39a22e[_0x0275('0xaa')]=0x0;_0x39a22e[_0x0275('0x42')]=_0x0275('0xab');loggerSyncQueueSummary['debug'](_0x0275('0xac'),_0x39a22e[_0x0275('0x43')],'is\x20not\x20active');}else{_0x39a22e[_0x0275('0x42')]=_0x0275('0xad');loggerSyncQueueSummary[_0x0275('0x9c')](_0x0275('0xac'),_0x39a22e['name'],_0x0275('0xae'));}emitVoiceQueueSummary(_0x39a22e);}}function notSendMessagesCampaign(_0x2aabcc){if(_0x2aabcc['sendMessageOneNotActive']){if(_0x2aabcc[_0x0275('0x77')]===0x0){_0x2aabcc['sendMessageOneNotActive']=![];_0x2aabcc[_0x0275('0x42')]=_0x0275('0xab');loggerSyncQueueSummary['debug'](_0x0275('0xaf'),_0x2aabcc[_0x0275('0x43')],_0x0275('0xb0'));}else{_0x2aabcc[_0x0275('0x42')]=_0x0275('0xad');loggerSyncQueueSummary[_0x0275('0x9c')](_0x0275('0xaf'),_0x2aabcc['name'],_0x0275('0xae'));}emitCampaignSummary(_0x2aabcc);}}function createObjHistory(_0x14b3ed,_0x4b2b20,_0x1268f0,_0x48c38b,_0x5e9cb5){_0x14b3ed[_0x0275('0x42')]=_0x1268f0;var _0x5f1de8=new Action(_0x14b3ed,_0x4b2b20);var _0x4504bd=new History(_0x5f1de8);_0x4504bd[_0x0275('0xb1')]=_0x48c38b;_0x4504bd['statedesc']=_0x5e9cb5;_0x4504bd[_0x0275('0xb2')]=_0x5f1de8[_0x0275('0xb3')];return _0x4504bd;}Dialer[_0x0275('0x1e')]['loopClearZombieChannels']=function(){var _0x11099f=this;setInterval(function(){_0x11099f['clearZombieChannels'](_0x11099f[_0x0275('0x27')],_0x0275('0xb4'));_0x11099f[_0x0275('0xb5')](_0x11099f['actions'],_0x0275('0xb6'));},0x32c8);};Dialer[_0x0275('0x1e')][_0x0275('0xb5')]=function(_0x301d91,_0x226294){var _0x13f251=this;for(var _0x5393aa in _0x301d91){if(typeof _0x301d91[_0x5393aa]!==_0x0275('0xb7')){this[_0x0275('0xb8')][_0x0275('0xb9')](function(){if(!_['isNil'](_0x301d91[_0x5393aa])){return ami[_0x0275('0xba')]({'action':_0x0275('0xbb'),'channel':_0x301d91[_0x5393aa][_0x0275('0xbc')]})['catch'](function(_0x7f2cd6){if(_0x7f2cd6[_0x0275('0x42')]===_0x0275('0xbd')){setTimeout(function(){if(_0x301d91[_0x5393aa]&&_0x301d91[_0x5393aa]['type']!==_0x0275('0x81')){_0x13f251[_0x0275('0xbe')](_0x13f251[_0x0275('0x21')][_0x301d91[_0x5393aa][_0x0275('0xbf')]]);logger[_0x0275('0x9d')](_0x0275('0xc0'),_0x226294,_0x5393aa,_0x301d91[_0x5393aa][_0x0275('0xbf')]);delete _0x301d91[_0x5393aa];}if(_0x301d91[_0x5393aa]&&_0x301d91[_0x5393aa]['type']==='ivr'){_0x13f251[_0x0275('0xbe')](_0x13f251[_0x0275('0x22')][_0x301d91[_0x5393aa][_0x0275('0xbf')]]);logger[_0x0275('0x9d')](_0x0275('0xc1'),_0x226294,_0x5393aa,_0x301d91[_0x5393aa][_0x0275('0xbf')]);delete _0x301d91[_0x5393aa];}},0x2328);}});}});}}};Dialer[_0x0275('0x1e')]['countReScheduled']=function(_0x16f14c){return BPromise[_0x0275('0xc2')]()['then'](cmHopper[_0x0275('0xc3')](_0x16f14c))['catch'](loggerCatch(_0x0275('0xc4')));};Dialer[_0x0275('0x1e')][_0x0275('0xc5')]=function(_0xcbb28c){return BPromise[_0x0275('0xc2')]()[_0x0275('0x3f')](cmHopperBlack['checkIsBlackList'](_0xcbb28c))[_0x0275('0xc6')](loggerCatch(_0x0275('0xc7')));};Dialer[_0x0275('0x1e')][_0x0275('0xc8')]=function(_0x731555,_0x419d2d,_0x54bb81){return BPromise[_0x0275('0xc2')]()[_0x0275('0x3f')](cmHopperAdditionalPhone[_0x0275('0xc8')](_0x731555,_0x419d2d,_0x54bb81))[_0x0275('0xc6')](loggerCatch(_0x0275('0xc9')));};Dialer['prototype'][_0x0275('0xca')]=function(_0x4ef31e,_0x29e6d9,_0x431683){return BPromise[_0x0275('0xc2')]()[_0x0275('0x3f')](cmHopperAdditionalPhone[_0x0275('0xca')](_0x4ef31e,_0x29e6d9,_0x431683))[_0x0275('0xc6')](loggerCatch(_0x0275('0xcb')));};Dialer[_0x0275('0x1e')][_0x0275('0xcc')]=function(_0x622ab){return BPromise['resolve']()[_0x0275('0x3f')](cmHopperBlack[_0x0275('0xcc')](_0x622ab))['catch'](loggerCatch(_0x0275('0xcd')));};Dialer[_0x0275('0x1e')]['averageHandleTime']=function(_0xd4029f){return BPromise['resolve']()[_0x0275('0x3f')](cmHopperHistory[_0x0275('0xce')](_0xd4029f))[_0x0275('0xc6')](loggerCatch(_0x0275('0xcf')));};Dialer[_0x0275('0x1e')][_0x0275('0xd0')]=function(_0x5e35d8){return BPromise[_0x0275('0xc2')]()[_0x0275('0x3f')](cmHopper[_0x0275('0xd0')](_0x5e35d8))['catch'](loggerCatch(_0x0275('0xd1')));};Dialer[_0x0275('0x1e')][_0x0275('0xd2')]=function(_0x3474d3,_0x559ced,_0x1c58dc){return BPromise[_0x0275('0xc2')]()[_0x0275('0x3f')](cmHopper[_0x0275('0xd2')](_0x3474d3,_0x559ced,_0x1c58dc))[_0x0275('0xc6')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x0275('0x1e')][_0x0275('0xd3')]=function(_0x3cd09e,_0x2efda2,_0x2669a1,_0x1fb8de,_0x189ac0){return BPromise[_0x0275('0xc2')]()[_0x0275('0x3f')](cmHopper[_0x0275('0xd3')](_0x3cd09e,_0x2efda2,_0x2669a1,_0x1fb8de))['catch'](function(_0x284b52){_0x189ac0[_0x0275('0xd4')]-=_0x2669a1;_0x189ac0[_0x0275('0xd4')]=_0x189ac0[_0x0275('0xd4')]>0x0?_0x189ac0[_0x0275('0xd4')]:0x0;loggerCatch(_0x0275('0xd5'))(_0x284b52);});};Dialer[_0x0275('0x1e')][_0x0275('0xd6')]=function(_0x2efa00,_0x31c81d,_0xd97c1,_0x1a7972){return BPromise[_0x0275('0xc2')]()[_0x0275('0x3f')](cmHopper[_0x0275('0xd6')](_0x2efa00,_0x31c81d,_0xd97c1))[_0x0275('0xc6')](function(_0x199709){_0x1a7972[_0x0275('0xd4')]-=_0x31c81d;_0x1a7972[_0x0275('0xd4')]=_0x1a7972[_0x0275('0xd4')]>0x0?_0x1a7972[_0x0275('0xd4')]:0x0;loggerCatch(_0x0275('0xd7'))(_0x199709);});};Dialer[_0x0275('0x1e')][_0x0275('0xd8')]=function(_0x4463b1){return BPromise[_0x0275('0xc2')]()['then'](voiceQueueRt[_0x0275('0xd8')](_0x4463b1))['catch'](loggerCatch(_0x0275('0xd9')));};Dialer[_0x0275('0x1e')]['moveContactManagedDialer']=function(_0x5300a3){return BPromise[_0x0275('0xc2')]()[_0x0275('0x3f')](cmHopper[_0x0275('0xda')](_0x5300a3))[_0x0275('0xc6')](loggerCatch(_0x0275('0xdb')));};Dialer[_0x0275('0x1e')][_0x0275('0xdc')]=function(_0x9a1017){return BPromise[_0x0275('0xc2')]()[_0x0275('0x3f')](cmHopperHistory[_0x0275('0xdc')](_0x9a1017))['catch'](loggerCatch(_0x0275('0xdd')));};Dialer[_0x0275('0x1e')]['updateOriginated']=function(_0x6e10ba){if(!_[_0x0275('0x41')](_0x6e10ba)&&_0x6e10ba!==null){if(typeof _0x6e10ba['originated']!=='undefined'){if(_0x6e10ba[_0x0275('0x77')]>0x0){_0x6e10ba[_0x0275('0x77')]-=0x1;}else{logger[_0x0275('0x9d')](_0x0275('0xde'));}}}else{logger[_0x0275('0x9d')](_0x0275('0xdf'));}};Dialer[_0x0275('0x1e')][_0x0275('0xe0')]=function(_0x5c6330,_0x465049){var _0xb7c127=this;return function(_0x779b27){_0xb7c127['updateOriginated'](_0x465049);logger[_0x0275('0x9d')](_0x5c6330,util[_0x0275('0x9f')](_0x779b27,{'showHidden':![],'depth':null}));};};Dialer[_0x0275('0x1e')][_0x0275('0xe1')]=function(_0xa34adf,_0x8df603,_0x1bdaf9){var _0x2ae345={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x8df603);this[_0x0275('0xe2')](_['merge'](_0x2ae345,_[_0x0275('0xe3')](_0x1bdaf9,['ContactId','ListId',_0x0275('0xe4'),_0x0275('0xe5'),_0x0275('0xe6')])),_0x0275('0xe7'),_0x0275('0xe8'));logger[_0x0275('0x9d')](_0xa34adf);};Dialer['prototype'][_0x0275('0xe9')]=function(_0x4be783){return _0x4be783===_0x0275('0xea');};Dialer['prototype']['isTrunkReachable']=function(_0x16dd79){return!_[_0x0275('0x41')](_0x16dd79)&&_0x16dd79&&!_[_0x0275('0x41')](_0x16dd79['name'])&&!_[_0x0275('0x41')](_0x16dd79[_0x0275('0x7d')])&&_0x16dd79[_0x0275('0x7d')]&&(this['trunks'][util['format']('SIP/%s',_0x16dd79['name'])][_0x0275('0xbb')]==='reachable'||this[_0x0275('0x24')][util['format'](_0x0275('0xeb'),_0x16dd79['name'])][_0x0275('0xbb')]===_0x0275('0xec'));};Dialer['prototype']['saveInDb']=function(_0x236e84,_0x435d50,_0x339b1d){this[_0x0275('0xdc')](_0x236e84)[_0x0275('0xc6')](loggerCatch(_0x435d50));this['moveContactManagedDialer'](_0x236e84)[_0x0275('0xc6')](loggerCatch(_0x339b1d));};Dialer[_0x0275('0x1e')][_0x0275('0x3a')]=function(_0x5cd702){var _0x340ec6=this[_0x0275('0x27')][_0x5cd702[_0x0275('0xed')]];var _0x1d8c42;if(!_[_0x0275('0xee')](_0x5cd702)&&!_[_0x0275('0xee')](_0x5cd702[_0x0275('0xef')])&&!_[_0x0275('0xee')](_0x5cd702[_0x0275('0xef')][_0x0275('0xf0')])&&_0x5cd702[_0x0275('0xf1')]===_0x0275('0xf2')&&_0x340ec6){if(_0x340ec6[_0x0275('0x50')]!==_0x0275('0x81')&&this[_0x0275('0x21')][_0x340ec6[_0x0275('0xbf')]][_0x0275('0xf3')]&&_0x5cd702[_0x0275('0xf4')]===_0x0275('0xf5')){delete this['uniqueId'][_0x5cd702['uniqueid']];this[_0x0275('0xbe')](this[_0x0275('0x21')][_0x340ec6[_0x0275('0xbf')]]);this[_0x0275('0x21')][_0x340ec6['queue']][_0x0275('0xf6')]+=0x1;this[_0x0275('0x21')][_0x340ec6[_0x0275('0xbf')]][_0x0275('0x61')]+=0x1;_0x1d8c42=new Hangup(_0x340ec6,_0x5cd702);_0x1d8c42[_0x0275('0xb1')]=0x12;_0x1d8c42[_0x0275('0xf7')]=_0x0275('0xf8');_0x1d8c42[_0x0275('0xf9')]=_0x0275('0xfa');ami[_0x0275('0xfb')](_0x0275('0xfc'),ut['buildObj'](_0x1d8c42,_0x0275('0xfd')));this[_0x0275('0xe2')](_0x1d8c42,_0x0275('0xfe'),_0x0275('0xff'));}if(_0x340ec6[_0x0275('0x50')]!==_0x0275('0x81')&&this[_0x0275('0x21')][_0x340ec6[_0x0275('0xbf')]]['dialAMDActive']&&_0x5cd702['value']===_0x0275('0x100')){var _0x335a2c=this;return new BPromise(function(_0x294422,_0x5459d2){delete _0x335a2c['uniqueId'][_0x5cd702[_0x0275('0xed')]];_0x335a2c[_0x0275('0xbe')](_0x335a2c[_0x0275('0x21')][_0x340ec6[_0x0275('0xbf')]]);_0x335a2c[_0x0275('0x21')][_0x340ec6[_0x0275('0xbf')]][_0x0275('0xf6')]+=0x1;_0x335a2c[_0x0275('0x21')][_0x340ec6[_0x0275('0xbf')]][_0x0275('0x61')]+=0x1;var _0x5885dc=_0x335a2c['voiceQueues'][_0x340ec6[_0x0275('0xbf')]];var _0x8d82a2=new Hangup(_0x340ec6,_0x5cd702);_0x8d82a2['state']=0x13;_0x8d82a2[_0x0275('0xf7')]='Machine';_0x8d82a2[_0x0275('0xf9')]='AMD';_0x8d82a2[_0x0275('0x101')]+=0x1;_0x8d82a2[_0x0275('0x102')]+=0x1;_0x8d82a2['amd']=!![];ami[_0x0275('0xfb')](_0x0275('0xfc'),ut[_0x0275('0x103')](_0x8d82a2,_0x0275('0xfd')));_0x335a2c['createHistory'](_0x8d82a2)[_0x0275('0xc6')](loggerCatch(_0x0275('0x104')));if(_0x8d82a2['countbusyretry']+_0x8d82a2['countcongestionretry']+_0x8d82a2[_0x0275('0x105')]+_0x8d82a2[_0x0275('0x106')]+_0x8d82a2[_0x0275('0x107')]+_0x8d82a2[_0x0275('0x108')]+_0x8d82a2[_0x0275('0x101')]+_0x8d82a2[_0x0275('0x109')]>=_0x5885dc[_0x0275('0x10a')]){_0x335a2c['stateGlobal'](_0x8d82a2,_0x294422,_0x5459d2,'reason19\x20machine....');}else{if(_0x8d82a2['countmachineretry']>=_0x5885dc[_0x0275('0x10b')]){_0x335a2c[_0x0275('0x10c')](_0x8d82a2,_0x294422,_0x5459d2,_0x0275('0x10d'));}else{_0x335a2c[_0x0275('0xd0')]({'active':![],'countmachineretry':_0x8d82a2[_0x0275('0x101')],'scheduledat':moment()[_0x0275('0x10e')](_0x5885dc[_0x0275('0x10f')],_0x0275('0x110'))[_0x0275('0x82')](_0x0275('0x111')),'ContactId':_0x8d82a2['ContactId'],'ListId':_0x8d82a2[_0x0275('0x112')],'VoiceQueueId':_0x8d82a2[_0x0275('0xe5')]||undefined,'CampaignId':_0x8d82a2[_0x0275('0xe6')]||undefined})[_0x0275('0xc6')](loggerCatch(_0x0275('0x113')));_0x294422({'reschedule':0x1});}}});}if(_0x340ec6[_0x0275('0x50')]==='ivr'&&this['campaigns'][_0x340ec6[_0x0275('0xbf')]][_0x0275('0xf3')]&&_0x5cd702[_0x0275('0xf4')]===_0x0275('0xf5')){delete this['uniqueId'][_0x5cd702[_0x0275('0xed')]];this['updateOriginated'](this[_0x0275('0x22')][_0x340ec6['queue']]);_0x1d8c42=new Hangup(_0x340ec6,_0x5cd702);_0x1d8c42[_0x0275('0xb1')]=0x12;_0x1d8c42[_0x0275('0xf7')]=_0x0275('0xf8');_0x1d8c42[_0x0275('0xf9')]=_0x0275('0xfa');ami[_0x0275('0xfb')](_0x0275('0xfc'),ut[_0x0275('0x103')](_0x1d8c42,_0x0275('0xfd')));this['saveInDb'](_0x1d8c42,_0x0275('0x114'),'[syncHangupInAMDIvr]');}if(_0x340ec6[_0x0275('0x50')]==='ivr'&&this[_0x0275('0x22')][_0x340ec6['queue']][_0x0275('0xf3')]&&_0x5cd702['value']===_0x0275('0x100')){var _0x335a2c=this;return new BPromise(function(_0x523ea0,_0xe0a20d){delete _0x335a2c['uniqueId'][_0x5cd702[_0x0275('0xed')]];_0x335a2c['updateOriginated'](_0x335a2c[_0x0275('0x22')][_0x340ec6[_0x0275('0xbf')]]);_0x335a2c['campaigns'][_0x340ec6[_0x0275('0xbf')]][_0x0275('0xf6')]+=0x1;_0x335a2c[_0x0275('0x22')][_0x340ec6[_0x0275('0xbf')]][_0x0275('0x61')]+=0x1;var _0x2c0c12=_0x335a2c[_0x0275('0x22')][_0x340ec6[_0x0275('0xbf')]];var _0x1a3ac2=new Hangup(_0x340ec6,_0x5cd702);_0x1a3ac2[_0x0275('0xb1')]=0x13;_0x1a3ac2['statedesc']=_0x0275('0x115');_0x1a3ac2['membername']=_0x0275('0xfa');_0x1a3ac2[_0x0275('0x101')]+=0x1;_0x1a3ac2[_0x0275('0x102')]+=0x1;_0x1a3ac2[_0x0275('0xfd')]=!![];ami[_0x0275('0xfb')]('custom:amd',ut[_0x0275('0x103')](_0x1a3ac2,'amd'));_0x335a2c[_0x0275('0xdc')](_0x1a3ac2)['catch'](loggerCatch(_0x0275('0x104')));if(_0x1a3ac2['countbusyretry']+_0x1a3ac2['countcongestionretry']+_0x1a3ac2[_0x0275('0x105')]+_0x1a3ac2[_0x0275('0x106')]+_0x1a3ac2[_0x0275('0x107')]+_0x1a3ac2[_0x0275('0x108')]+_0x1a3ac2[_0x0275('0x101')]+_0x1a3ac2[_0x0275('0x109')]>=_0x2c0c12[_0x0275('0x10a')]){_0x335a2c[_0x0275('0x116')](_0x1a3ac2,_0x523ea0,_0xe0a20d,_0x0275('0x117'));}else{if(_0x1a3ac2[_0x0275('0x101')]>=_0x2c0c12['dialMachineMaxRetry']){_0x335a2c[_0x0275('0x10c')](_0x1a3ac2,_0x523ea0,_0xe0a20d,_0x0275('0x10d'));}else{_0x335a2c[_0x0275('0xd0')]({'active':![],'countmachineretry':_0x1a3ac2[_0x0275('0x101')],'scheduledat':moment()[_0x0275('0x10e')](_0x2c0c12['dialMachineRetryFrequency'],_0x0275('0x110'))['format'](_0x0275('0x111')),'ContactId':_0x1a3ac2[_0x0275('0x118')],'ListId':_0x1a3ac2[_0x0275('0x112')],'VoiceQueueId':_0x1a3ac2[_0x0275('0xe5')]||undefined,'CampaignId':_0x1a3ac2[_0x0275('0xe6')]||undefined})[_0x0275('0xc6')](loggerCatch('[rescheduleContact][Machine]'));_0x523ea0({'reschedule':0x1});}}});}}};Dialer[_0x0275('0x1e')]['syncHangup']=function(_0x1d81ab){var _0x4c6b34=this[_0x0275('0x27')][_0x1d81ab[_0x0275('0xed')]];var _0xe8be3f=this;var _0x1d772d;if(_0x4c6b34&&_0x4c6b34['type']===_0x0275('0x81')){delete this[_0x0275('0x27')][_0x1d81ab[_0x0275('0xed')]];this[_0x0275('0xbe')](this[_0x0275('0x22')][_0x4c6b34['queue']]);this['campaigns'][_0x4c6b34[_0x0275('0xbf')]][_0x0275('0x119')]+=0x1;_0x1d772d=new Hangup(_0x4c6b34,_0x1d81ab);this[_0x0275('0xdc')](_0x1d772d)['catch'](loggerCatch(_0x0275('0x11a')));this[_0x0275('0xda')](_0x1d772d)[_0x0275('0xc6')](loggerCatch('[syncHangupIvr]'));}if(_0x4c6b34&&_0x4c6b34[_0x0275('0x50')]!==_0x0275('0x81')&&isNotNull(this[_0x0275('0x21')][_0x4c6b34[_0x0275('0xbf')]][_0x0275('0x11b')])){delete this[_0x0275('0x27')][_0x1d81ab[_0x0275('0xed')]];this[_0x0275('0xbe')](this[_0x0275('0x21')][_0x4c6b34[_0x0275('0xbf')]]);this['voiceQueues'][_0x4c6b34[_0x0275('0xbf')]]['outboundAnswerCallsDay']+=0x1;this[_0x0275('0x21')][_0x4c6b34[_0x0275('0xbf')]][_0x0275('0x61')]+=0x1;_0x1d772d=new Hangup(_0x4c6b34,_0x1d81ab);_0x1d772d['state']=0x10;_0x1d772d[_0x0275('0xf7')]=_0x0275('0x11c');_0x1d772d[_0x0275('0xf9')]='AGI';this[_0x0275('0xdc')](_0x1d772d)['catch'](loggerCatch(_0x0275('0x11a')));this[_0x0275('0xda')](_0x1d772d)[_0x0275('0xc6')](loggerCatch(_0x0275('0x11d')));}if(_0x4c6b34&&_0x4c6b34[_0x0275('0x50')]!==_0x0275('0x81')&&!isNotNull(this[_0x0275('0x21')][_0x4c6b34['queue']][_0x0275('0x11b')])){delete this[_0x0275('0x27')][_0x1d81ab['uniqueid']];this['updateOriginated'](this[_0x0275('0x21')][_0x4c6b34['queue']]);this['voiceQueues'][_0x4c6b34[_0x0275('0xbf')]][_0x0275('0x6b')]+=0x1;_0x1d772d=new Hangup(_0x4c6b34,_0x1d81ab);_0x1d772d[_0x0275('0xb1')]=0xc;_0x1d772d[_0x0275('0xf7')]=_0x1d81ab[_0x0275('0x11e')];_0x1d772d[_0x0275('0xf9')]=_0x0275('0x11f');this[_0x0275('0xdc')](_0x1d772d)[_0x0275('0xc6')](loggerCatch(_0x0275('0x11a')));this[_0x0275('0xda')](_0x1d772d)[_0x0275('0xc6')](loggerCatch(_0x0275('0x11d')));}};Dialer[_0x0275('0x1e')][_0x0275('0x31')]=function(_0x502e39){var _0x1231b0=this[_0x0275('0x27')][_0x502e39[_0x0275('0xed')]];var _0x171286=this;if(this[_0x0275('0x21')][_0x502e39['queue']]){if(_0x1231b0&&_0x1231b0['type']!==_0x0275('0x81')){delete this[_0x0275('0x27')][_0x502e39[_0x0275('0xed')]];this['voiceQueues'][_0x502e39[_0x0275('0xbf')]]['outboundAnswerCallsDay']+=0x1;var _0x3bb691=new AgentComplete(_0x1231b0,_0x502e39);if(_0x502e39[_0x0275('0x120')]===_0x0275('0x121')){_0x3bb691['agiafterat']=this[_0x0275('0x21')][_0x502e39[_0x0275('0xbf')]]['dialQueueProject2']&&this['voiceQueues'][_0x502e39[_0x0275('0xbf')]][_0x0275('0x122')]?moment()[_0x0275('0x82')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x0275('0xdc')](_0x3bb691)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x0275('0xda')](_0x3bb691)[_0x0275('0xc6')](loggerCatch(_0x0275('0x123')));}}};Dialer[_0x0275('0x1e')][_0x0275('0x2c')]=function(_0x234e23){if(this[_0x0275('0x21')][_0x234e23[_0x0275('0xbf')]]){if(this['uniqueId'][_0x234e23[_0x0275('0xed')]]&&this[_0x0275('0x27')][_0x234e23[_0x0275('0xed')]][_0x0275('0x50')]!=='ivr'){this['updateOriginated'](this[_0x0275('0x21')][_0x234e23[_0x0275('0xbf')]]);this['uniqueId'][_0x234e23[_0x0275('0xed')]][_0x0275('0x124')]=moment()[_0x0275('0x82')](_0x0275('0x111'));}}};Dialer[_0x0275('0x1e')][_0x0275('0x125')]=function(_0xcb3d4,_0x45ddbd){this[_0x0275('0xdc')](_0xcb3d4)[_0x0275('0xc6')](loggerCatch(_0x0275('0x126')));if(_0x45ddbd==0x0){this[_0x0275('0xda')](_0xcb3d4)[_0x0275('0xc6')](loggerCatch(_0x0275('0x127')));}};Dialer[_0x0275('0x1e')][_0x0275('0x2e')]=function(_0x5d4c95){var _0x483631=this[_0x0275('0x27')][_0x5d4c95[_0x0275('0xed')]];var _0x4dfae3=this;var _0x36707d=![];var _0x898756;var _0x36a38e;if(this[_0x0275('0x21')][_0x5d4c95[_0x0275('0xbf')]]){if(_0x483631&&_0x483631[_0x0275('0x50')]!=='ivr'){delete this[_0x0275('0x27')][_0x5d4c95[_0x0275('0xed')]];this['updateOriginated'](this['voiceQueues'][_0x5d4c95[_0x0275('0xbf')]]);_0x483631[_0x0275('0x128')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x409a16=new QueueCallerAbandon(_0x483631,_0x5d4c95);if(getSeconds(_0x483631['droptime'],_0x483631[_0x0275('0x129')])>=_0x483631[_0x0275('0x12a')]){this[_0x0275('0x21')][_0x5d4c95[_0x0275('0xbf')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x0275('0x21')][_0x5d4c95[_0x0275('0xbf')]][_0x0275('0x66')]+=0x1;this['voiceQueues'][_0x5d4c95[_0x0275('0xbf')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x409a16[_0x0275('0xb1')]=0xa;_0x409a16[_0x0275('0xf7')]=_0x0275('0x12b');_0x409a16['dropreason']=_0x0275('0x12c');_0x409a16[_0x0275('0x12d')]=this[_0x0275('0x21')][_0x5d4c95[_0x0275('0xbf')]][_0x0275('0x12e')]?moment()[_0x0275('0x82')](_0x0275('0x111')):undefined;_0x409a16[_0x0275('0x107')]+=0x1;_0x409a16[_0x0275('0x102')]+=0x1;_0x898756=this[_0x0275('0x21')][_0x5d4c95[_0x0275('0xbf')]]['dialDropRetryFrequency'];_0x36a38e=this[_0x0275('0x21')][_0x5d4c95[_0x0275('0xbf')]][_0x0275('0x12f')];_0x4dfae3[_0x0275('0xc8')](_0x409a16,_0x409a16['state'],_0x483631[_0x0275('0x130')])[_0x0275('0x3f')](function(_0xd1311a){_0x36707d=_0xd1311a[_0x0275('0x131')]==0x1;if(_0x409a16['countdropretry']>=_0x4dfae3[_0x0275('0x21')][_0x5d4c95[_0x0275('0xbf')]][_0x0275('0x132')]){_0x4dfae3['queueCallerAbandonCreateState'](_0x409a16,_0xd1311a[_0x0275('0x131')]);}else{_0x4dfae3[_0x0275('0xd0')]({'active':![],'countdropretry':_0x409a16[_0x0275('0x107')],'scheduledat':moment()[_0x0275('0x10e')](_0x4dfae3[_0x0275('0x21')][_0x5d4c95[_0x0275('0xbf')]][_0x0275('0x133')],_0x0275('0x110'))[_0x0275('0x82')](_0x0275('0x111')),'ContactId':_0x483631['ContactId'],'ListId':_0x483631[_0x0275('0x112')],'VoiceQueueId':_0x483631[_0x0275('0xe5')]||undefined,'CampaignId':_0x483631['CampaignId']||undefined})[_0x0275('0xc6')](loggerCatch(_0x0275('0x134')));var _0x43ba6f=new History(_0x409a16);_0x43ba6f[_0x0275('0xb1')]=0xa;_0x43ba6f[_0x0275('0xf7')]=_0x0275('0x12b');_0x43ba6f[_0x0275('0xb3')]=moment()[_0x0275('0x82')](_0x0275('0x111'));_0x43ba6f[_0x0275('0xb2')]=_0x43ba6f[_0x0275('0xb3')];_0x43ba6f['calleridname']=_0x409a16['calleridname'];_0x43ba6f[_0x0275('0x135')]=_0x409a16['calleridnum'];_0x4dfae3[_0x0275('0xdc')](_0x43ba6f)[_0x0275('0xc6')](loggerCatch(_0x0275('0x136')));}})[_0x0275('0x3f')](function(_0x55fd92){if(_0x36707d)_0x4dfae3[_0x0275('0xca')](_0x409a16,_0x898756,_0x36a38e)[_0x0275('0x3f')](function(_0x371733){return 0x1;});});}else{this[_0x0275('0x21')][_0x5d4c95[_0x0275('0xbf')]][_0x0275('0x6f')]+=0x1;this[_0x0275('0x21')][_0x5d4c95[_0x0275('0xbf')]][_0x0275('0x65')]+=0x1;_0x409a16[_0x0275('0xb1')]=0xb;_0x409a16[_0x0275('0xf7')]='Abandoned';_0x409a16[_0x0275('0x137')]=_0x0275('0x138');_0x409a16[_0x0275('0x108')]+=0x1;_0x409a16['countglobal']+=0x1;_0x898756=this[_0x0275('0x21')][_0x5d4c95[_0x0275('0xbf')]][_0x0275('0x139')];_0x36a38e=this['voiceQueues'][_0x5d4c95[_0x0275('0xbf')]][_0x0275('0x12f')];_0x4dfae3[_0x0275('0xc8')](_0x409a16,_0x409a16['state'],_0x483631[_0x0275('0x130')])['then'](function(_0x52baef){if(_0x409a16['countabandonedretry']>=_0x4dfae3[_0x0275('0x21')][_0x5d4c95[_0x0275('0xbf')]]['dialAbandonedMaxRetry']){_0x4dfae3[_0x0275('0x125')](_0x409a16,_0x52baef[_0x0275('0x131')]);}else{_0x4dfae3[_0x0275('0xd0')]({'active':![],'countabandonedretry':_0x409a16[_0x0275('0x108')],'scheduledat':moment()[_0x0275('0x10e')](_0x4dfae3[_0x0275('0x21')][_0x5d4c95[_0x0275('0xbf')]][_0x0275('0x139')],_0x0275('0x110'))['format'](_0x0275('0x111')),'ContactId':_0x483631[_0x0275('0x118')],'ListId':_0x483631[_0x0275('0x112')],'VoiceQueueId':_0x483631[_0x0275('0xe5')]||undefined,'CampaignId':_0x483631[_0x0275('0xe6')]||undefined})[_0x0275('0xc6')](loggerCatch(_0x0275('0x13a')));var _0x6af717=new History(_0x409a16);_0x6af717['state']=0xb;_0x6af717['statedesc']=_0x0275('0x13b');_0x6af717[_0x0275('0xb3')]=moment()[_0x0275('0x82')](_0x0275('0x111'));_0x6af717[_0x0275('0xb2')]=_0x6af717[_0x0275('0xb3')];_0x6af717[_0x0275('0x13c')]=_0x409a16['calleridname'];_0x6af717[_0x0275('0x135')]=_0x409a16[_0x0275('0x135')];_0x4dfae3[_0x0275('0xdc')](_0x6af717)['catch'](loggerCatch(_0x0275('0x13d')));}})[_0x0275('0x3f')](function(_0x5583b0){if(_0x36707d)_0x4dfae3[_0x0275('0xca')](_0x409a16,_0x898756,_0x36a38e)[_0x0275('0x3f')](function(_0x4f0ab5){return 0x1;});});}}}};Dialer[_0x0275('0x1e')][_0x0275('0x38')]=function(_0x15afe6){if(this['actions'][_0x15afe6['uniqueid']]){this['actions'][_0x15afe6[_0x0275('0xed')]][_0x0275('0xbc')]=_0x15afe6[_0x0275('0xbc')];}if(this[_0x0275('0x27')][_0x15afe6[_0x0275('0xed')]]){this[_0x0275('0x27')][_0x15afe6[_0x0275('0xed')]][_0x0275('0xbc')]=_0x15afe6[_0x0275('0xbc')];}};Dialer['prototype'][_0x0275('0x3c')]=function(_0x559eb3){if(strategy[this[_0x0275('0x21')][this[_0x0275('0x13e')][_0x559eb3[_0x0275('0x13f')]][_0x0275('0xbf')]][_0x0275('0x52')]]==='roundrobin'){if(this['actions'][_0x559eb3['actionid']]&&_[_0x0275('0xee')](this[_0x0275('0x13e')][_0x559eb3[_0x0275('0x13f')]][_0x0275('0x140')])&&_0x559eb3[_0x0275('0xbb')]==='1'&&_0x559eb3[_0x0275('0x141')]==='0'){if(this[_0x0275('0x23')][_0x559eb3[_0x0275('0x142')]]){if(!this[_0x0275('0x23')][_0x559eb3[_0x0275('0x142')]]['locked']){this[_0x0275('0x23')][_0x559eb3[_0x0275('0x142')]][_0x0275('0x140')]=!![];this[_0x0275('0x13e')][_0x559eb3[_0x0275('0x13f')]][_0x0275('0x140')]=!![];this[_0x0275('0x13e')][_0x559eb3['actionid']][_0x0275('0x142')]=_0x559eb3[_0x0275('0x142')];}}}}else if((strategy[this[_0x0275('0x21')][this[_0x0275('0x13e')][_0x559eb3[_0x0275('0x13f')]][_0x0275('0xbf')]][_0x0275('0x52')]]||_0x0275('0x143'))===_0x0275('0x143')){if(this[_0x0275('0x13e')][_0x559eb3['actionid']]){if(this[_0x0275('0x23')][_0x559eb3[_0x0275('0x142')]]){this['actions'][_0x559eb3[_0x0275('0x13f')]][_0x0275('0x142')]=_0x559eb3[_0x0275('0x142')];if(_[_0x0275('0xee')](this[_0x0275('0x144')][this[_0x0275('0x13e')][_0x559eb3['actionid']][_0x0275('0xbf')]])){this['queueBooked'][this[_0x0275('0x13e')][_0x559eb3[_0x0275('0x13f')]][_0x0275('0xbf')]]=[];}this[_0x0275('0x144')][this[_0x0275('0x13e')][_0x559eb3['actionid']]['queue']][_0x0275('0x145')](_['merge'](_[_0x0275('0xe3')](this['actions'][_0x559eb3['actionid']],[_0x0275('0x146'),_0x0275('0x142')]),{'status':_0x559eb3[_0x0275('0xbb')],'paused':_0x559eb3[_0x0275('0x141')]}));}}}};function unlockQueueStatus(_0x27aa24,_0x5e157e){setTimeout(function(){if(_[_0x0275('0x41')](_0x27aa24[_0x0275('0x147')])){loggerBooked[_0x0275('0x9d')]('[unlockQueueStatus][undefined]',_0x5e157e);}_0x27aa24['queueStatusComplete']=!![];loggerBooked[_0x0275('0x83')](_0x0275('0x148'),_0x5e157e,JSON[_0x0275('0x4c')](_[_0x0275('0xe3')](_0x27aa24,[_0x0275('0x43'),_0x0275('0x147')])));},0x1f3);}Dialer[_0x0275('0x1e')][_0x0275('0x149')]=function(_0x21b475){var _0x455dd5=this;var _0x4fd2c9=_0x455dd5['voiceQueues'][_0x455dd5['actions'][_0x21b475[_0x0275('0x13f')]][_0x0275('0xbf')]];if(strategy[this[_0x0275('0x21')][this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0xbf')]][_0x0275('0x52')]]===_0x0275('0x1d')){if(this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]]&&this['actions'][_0x21b475[_0x0275('0x13f')]][_0x0275('0x142')]){this[_0x0275('0x14a')][_0x0275('0x14b')](this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0x146')],this['actions'][_0x21b475['actionid']][_0x0275('0x142')])[_0x0275('0xc6')](function(_0x39c2c8){logger[_0x0275('0x9d')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x0275('0x9f')](_0x39c2c8,{'showHidden':![],'depth':null}));})[_0x0275('0x20')](function(){_0x455dd5[_0x0275('0xbe')](_0x455dd5['voiceQueues'][_0x455dd5[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0xbf')]]);_0x455dd5[_0x0275('0x23')][_0x455dd5[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0x142')]][_0x0275('0x140')]=![];delete _0x455dd5[_0x0275('0x13e')][_0x21b475['actionid']];unlockQueueStatus(_0x4fd2c9);});}else{this[_0x0275('0xbe')](this[_0x0275('0x21')][this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0xbf')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0x118')],'ListId':this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0x112')],'VoiceQueueId':this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0xe5')]||undefined,'CampaignId':this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0xe6')]||undefined})[_0x0275('0xc6')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x21b475['actionid']];unlockQueueStatus(_0x4fd2c9);}}else if((strategy[this[_0x0275('0x21')][this[_0x0275('0x13e')][_0x21b475['actionid']]['queue']]['strategy']]||_0x0275('0x143'))===_0x0275('0x143')){var _0x6fd129;if(this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]]&&!_[_0x0275('0x49')](this[_0x0275('0x144')][this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0xbf')]])){if(this[_0x0275('0x2b')][_0x455dd5[_0x0275('0x13e')][_0x21b475['actionid']][_0x0275('0xbf')]]){this[_0x0275('0x2b')][_0x455dd5['actions'][_0x21b475[_0x0275('0x13f')]]['queue']]=this[_0x0275('0x2b')][this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0xbf')]]?this[_0x0275('0x2b')][this[_0x0275('0x13e')][_0x21b475['actionid']][_0x0275('0xbf')]]:this['queueBooked'][this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0xbf')]]?this[_0x0275('0x144')][this['actions'][_0x21b475[_0x0275('0x13f')]][_0x0275('0xbf')]][_0x0275('0x14c')]||0x0:0x0;}this[_0x0275('0x144')][this[_0x0275('0x13e')][_0x21b475['actionid']]['queue']]['_rr']=this[_0x0275('0x2b')][this['actions'][_0x21b475[_0x0275('0x13f')]][_0x0275('0xbf')]];for(var _0x3c0109=0x0;_0x3c0109<this[_0x0275('0x144')][this['actions'][_0x21b475[_0x0275('0x13f')]]['queue']]['length'];_0x3c0109+=0x1){_0x6fd129=rr(this[_0x0275('0x144')][this['actions'][_0x21b475['actionid']][_0x0275('0xbf')]]);this[_0x0275('0x2b')][_0x455dd5['actions'][_0x21b475['actionid']][_0x0275('0xbf')]]=this[_0x0275('0x144')][this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0xbf')]][_0x0275('0x14c')];if(_0x6fd129[_0x0275('0xbb')]==='1'&&_0x6fd129[_0x0275('0x141')]==='0'){break;}}if(!_[_0x0275('0xee')](_0x6fd129)){this[_0x0275('0x23')][_0x6fd129[_0x0275('0x142')]][_0x0275('0x14d')]=_[_0x0275('0x41')](this[_0x0275('0x23')][_0x6fd129['stateinterface']][_0x0275('0x14d')])?!![]:this[_0x0275('0x23')][_0x6fd129['stateinterface']][_0x0275('0x14d')];}loggerBooked[_0x0275('0x83')]('[booked][RR]',_0x21b475[_0x0275('0x13f')],_0x0275('0x14e'),JSON['stringify'](_['pick'](this[_0x0275('0x23')][_0x6fd129[_0x0275('0x142')]],[_0x0275('0x43'),_0x0275('0x14d')])),_0x0275('0x14f'),JSON[_0x0275('0x4c')](_0x6fd129[_0x0275('0x146')]));if(!_['isNil'](_0x6fd129)&&_0x6fd129[_0x0275('0xbb')]==='1'&&_0x6fd129[_0x0275('0x141')]==='0'&&this[_0x0275('0x23')][_0x6fd129['stateinterface']][_0x0275('0x14d')]){this[_0x0275('0x23')][_0x6fd129['stateinterface']]['unlockRR']=![];this[_0x0275('0x144')][_0x455dd5['actions'][_0x21b475[_0x0275('0x13f')]][_0x0275('0xbf')]]=[];this[_0x0275('0x14a')]['run'](_0x6fd129[_0x0275('0x146')],_0x6fd129[_0x0275('0x142')])[_0x0275('0xc6')](function(_0x11651b){logger['error'](_0x0275('0x150'),util[_0x0275('0x9f')](_0x11651b,{'showHidden':![],'depth':null}));})[_0x0275('0x20')](function(){_0x455dd5[_0x0275('0xbe')](_0x455dd5[_0x0275('0x21')][_0x455dd5[_0x0275('0x13e')][_0x21b475['actionid']][_0x0275('0xbf')]]);setTimeout(function(){_0x455dd5[_0x0275('0x23')][_0x6fd129['stateinterface']][_0x0275('0x14d')]=!![];loggerBooked['info'](_0x0275('0x151'),_0x21b475[_0x0275('0x13f')],_0x0275('0x14e'),JSON[_0x0275('0x4c')](_[_0x0275('0xe3')](_0x455dd5[_0x0275('0x23')][_0x6fd129[_0x0275('0x142')]],[_0x0275('0x43'),'unlockRR'])),'contactAgent-idHopper:\x20',JSON[_0x0275('0x4c')](_0x6fd129[_0x0275('0x146')]));},0xc7);delete _0x455dd5[_0x0275('0x13e')][_0x21b475['actionid']];unlockQueueStatus(_0x4fd2c9,_0x21b475['actionid']);});}else{loggerBooked['info'](_0x0275('0x152'));this['updateOriginated'](this['voiceQueues'][this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0xbf')]]);this[_0x0275('0xd0')]({'active':![],'ContactId':this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0x118')],'ListId':this[_0x0275('0x13e')][_0x21b475['actionid']][_0x0275('0x112')],'VoiceQueueId':this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x21b475[_0x0275('0x13f')]][_0x0275('0xe6')]||undefined})[_0x0275('0xc6')](loggerCatch(_0x0275('0x153')));delete this[_0x0275('0x13e')][_0x21b475['actionid']];unlockQueueStatus(_0x4fd2c9);}}else{loggerBooked[_0x0275('0x83')](_0x0275('0x154'));this[_0x0275('0xbe')](this[_0x0275('0x21')][this[_0x0275('0x13e')][_0x21b475['actionid']]['queue']]);this[_0x0275('0xd0')]({'active':![],'ContactId':this[_0x0275('0x13e')][_0x21b475['actionid']]['ContactId'],'ListId':this[_0x0275('0x13e')][_0x21b475['actionid']][_0x0275('0x112')],'VoiceQueueId':this[_0x0275('0x13e')][_0x21b475['actionid']][_0x0275('0xe5')]||undefined,'CampaignId':this['actions'][_0x21b475['actionid']][_0x0275('0xe6')]||undefined})[_0x0275('0xc6')](loggerCatch(_0x0275('0x155')));delete this[_0x0275('0x13e')][_0x21b475['actionid']];unlockQueueStatus(_0x4fd2c9);}}else{loggerBooked[_0x0275('0x83')](_0x0275('0x156'));this[_0x0275('0xbe')](this[_0x0275('0x21')][this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]]['queue']]);this[_0x0275('0xd0')]({'active':![],'ContactId':this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]][_0x0275('0x118')],'ListId':this['actions'][_0x21b475['actionid']][_0x0275('0x112')],'VoiceQueueId':this[_0x0275('0x13e')][_0x21b475['actionid']][_0x0275('0xe5')]||undefined,'CampaignId':this[_0x0275('0x13e')][_0x21b475['actionid']][_0x0275('0xe6')]||undefined})[_0x0275('0xc6')](loggerCatch(_0x0275('0x157')));delete this[_0x0275('0x13e')][_0x21b475[_0x0275('0x13f')]];unlockQueueStatus(_0x4fd2c9);}};Dialer[_0x0275('0x1e')][_0x0275('0x3d')]=function(){var _0x55ddc7=this;return BPromise[_0x0275('0xc2')]()[_0x0275('0x3f')](cmHopper[_0x0275('0x158')]({}))[_0x0275('0x3f')](function(){setInterval(function(){_0x55ddc7[_0x0275('0x159')]();},0x3e8);});};Dialer[_0x0275('0x1e')]['checkIsTrunkReachable']=function(_0x575f31){var _0x430f00=this;return function(){if(!_0x430f00[_0x0275('0x15a')](_0x575f31[_0x0275('0x7c')])){if(!_0x430f00[_0x0275('0x15a')](_0x575f31[_0x0275('0x15b')])){_0x575f31[_0x0275('0x42')]=_0x0275('0x15c');throw _0x575f31[_0x0275('0x43')]+_0x0275('0x15d');}}};};Dialer[_0x0275('0x1e')][_0x0275('0x15e')]=function(_0x3461c6,_0x52cf8b,_0x58731a,_0x2ede06){var _0x2baddb=this;return function(){var _0x41595e=!![];return _0x2baddb['ifTime'](_0x3461c6,_0x52cf8b,_0x58731a,_0x2ede06,_0x41595e);};};Dialer[_0x0275('0x1e')][_0x0275('0x15f')]=function(_0x5b13d8,_0xb56dd9,_0x6d64ae,_0xd71d1c){var _0x42fd17=this;return function(){var _0x2c1222=![];return _0x42fd17[_0x0275('0x160')](_0x5b13d8[_0x0275('0x48')],_0xb56dd9,_0x6d64ae,_0xd71d1c,_0x2c1222);};};Dialer[_0x0275('0x1e')]['ifTime']=function(_0x3d83d8,_0x2b0976,_0x4689a9,_0x5743bc,_0x1e4e7b){var _0x3ecff0=[];return new BPromise(function(_0x56a2a0,_0x17dce5){if(!isNotNull(_0x3d83d8)){_0x5743bc[_0x0275('0x42')]=_0x0275('0x46');return _0x17dce5(msgResponse(_0x0275('0x160'),_0x0275('0x161'),_0x4689a9+_0x0275('0x162')));}if(_[_0x0275('0x49')](_0x3d83d8)){_0x5743bc[_0x0275('0x42')]=_0x0275('0x163');return _0x17dce5(msgResponse(_0x0275('0x160'),_0x0275('0x161'),_0x4689a9+'\x20Intervals\x20is\x20empty\x20'));}if(_0x2b0976&&_['isUndefined'](config[_0x0275('0x164')][_0x2b0976])){_0x5743bc['message']=_0x0275('0x165');return _0x17dce5(msgResponse(_0x0275('0x160'),_0x0275('0x161'),_0x4689a9+_0x0275('0x166')+_0x2b0976));}if(_[_0x0275('0x167')](_0x3d83d8)){for(var _0x33312e=0x0;_0x33312e<_0x3d83d8[_0x0275('0xa0')];_0x33312e+=0x1){_0x3ecff0[_0x0275('0x145')](ami[_0x0275('0xba')]({'action':_0x0275('0x168'),'command':util[_0x0275('0x82')]('iftime\x20%s,%s',_0x3d83d8[_0x33312e][_0x0275('0x169')],!_[_0x0275('0x41')](config[_0x0275('0x164')][_0x2b0976])?_0x2b0976:'')})[_0x0275('0x3f')](function(_0x55e13d){return _0x55e13d[_0x0275('0x16a')][_0x0275('0x16b')]('true')>=0x0;})[_0x0275('0xc6')](myreject(_0x17dce5)));}}else{_0x3ecff0[_0x0275('0x145')](ami[_0x0275('0xba')]({'action':_0x0275('0x168'),'command':util[_0x0275('0x82')]('iftime\x20%s,%s',_0x3d83d8,!_['isUndefined'](config['timezones'][_0x2b0976])?_0x2b0976:'')})['then'](function(_0x538750){return _0x538750[_0x0275('0x16a')]['indexOf'](_0x0275('0x16c'))>=0x0;})['catch'](myreject(_0x17dce5)));}BPromise[_0x0275('0x16d')](_0x3ecff0)[_0x0275('0x3f')](function(_0x195cac){var _0x14d8aa=_[_0x0275('0x16e')](_0x195cac);if(_0x14d8aa){return _0x56a2a0(_0x14d8aa);}else{_0x5743bc[_0x0275('0x42')]=_0x1e4e7b?'GLOBAL_INTERVAL_IS_OVERTIME':_0x0275('0x16f');return _0x17dce5(msgResponse(_0x0275('0x170'),_0x0275('0x161'),'Global:\x20'+_0x1e4e7b+'\x20'+_0x4689a9+_0x0275('0x171')+util['inspect'](_0x3d83d8,{'showHidden':![],'depth':null})+_0x0275('0x172')+_0x2b0976));}})[_0x0275('0xc6')](function(_0x13a692){return _0x17dce5(msgResponse(_0x0275('0x160'),'Failure',JSON[_0x0275('0x4c')](_0x13a692)));});});};Dialer[_0x0275('0x1e')][_0x0275('0x173')]=function(_0x449803){var _0x316f5f=this;return function(){switch(_0x449803[_0x0275('0x5d')]){case _0x0275('0x174'):freeVariablesPredictive(_0x449803);_0x316f5f[_0x0275('0x175')](_0x449803,0x1);break;case _0x0275('0x176'):freeVariablesPredictive(_0x449803);_0x316f5f[_0x0275('0x175')](_0x449803,_0x449803[_0x0275('0x177')]);break;case _0x0275('0xa'):_0x316f5f['predictive'](_0x449803);break;case _0x0275('0x178'):freeVariablesPredictive(_0x449803);_0x316f5f[_0x0275('0x175')](_0x449803,0x1);break;default:freeVariablesPredictive(_0x449803);logger[_0x0275('0x9d')](_0x0275('0x179'),_0x449803['name'],'method\x20not\x20recognized');}};};Dialer[_0x0275('0x1e')][_0x0275('0x17a')]=function(_0x4b685d){var _0x40b257=this;return function(){_0x40b257[_0x0275('0x17b')](_0x4b685d);};};Dialer[_0x0275('0x1e')][_0x0275('0xc')]=function(_0x19a071){var _0x3fc14e=this;if(isNotPreview(_0x19a071[_0x0275('0x5d')])){if(isVoiceQueueOutbound(_0x19a071[_0x0275('0x50')])&&isActive(_0x19a071[_0x0275('0x5c')])){_0x19a071['sendMessageOneNotActive']=!![];BPromise[_0x0275('0xc2')]()[_0x0275('0x3f')](checkIsLoggedIn(_0x19a071,_0x19a071[_0x0275('0x54')]))['then'](checkIsActive(_0x19a071,_0x19a071[_0x0275('0x5c')]))['then'](checkInterval(_0x19a071))[_0x0275('0x3f')](_0x3fc14e['checkIsTrunkReachable'](_0x19a071))[_0x0275('0x3f')](_0x3fc14e[_0x0275('0x15e')](_0x19a071[_0x0275('0x17c')],_0x19a071['dialTimezone'],_0x19a071[_0x0275('0x43')],_0x19a071))[_0x0275('0x3f')](_0x3fc14e[_0x0275('0x15f')](_0x19a071[_0x0275('0x45')],_0x19a071['dialTimezone'],_0x19a071['name'],_0x19a071))[_0x0275('0x3f')](_0x3fc14e[_0x0275('0x173')](_0x19a071))[_0x0275('0xc6')](loggerCatchQueueSummary(_0x0275('0x17d'),_0x19a071));}else{notSendMessagesQueue(_0x19a071);}}else{freeVariablesPredictive(_0x19a071);}};Dialer['prototype']['syncQueueSummaryComplete']=_[_0x0275('0x17e')](function(){var _0xf7d89a=_[_0x0275('0x17f')](this[_0x0275('0x21')],function(_0x3a3968){return _0x3a3968[_0x0275('0x180')];});var _0x4d54d4=_[_0x0275('0x17f')](this[_0x0275('0x23')],function(_0x4dd961){return _0x4dd961[_0x0275('0x181')]&&_0x4dd961[_0x0275('0xbb')]===_0x0275('0x182');});if(_0xf7d89a[_0x0275('0xa0')]>0x0&&_0x4d54d4[_0x0275('0xa0')]>0x0){return BPromise[_0x0275('0xc2')]()[_0x0275('0x3f')](cmHopper['handlePreviewRecallNotifications'](_[_0x0275('0x183')](_0xf7d89a,'id'),previewRecallmeReminderInterval,_[_0x0275('0x183')](_0x4d54d4,'id')))['then'](function(_0x250812){for(var _0x40db1b=0x0;_0x40db1b<_0x250812[_0x0275('0xa0')];_0x40db1b++){var _0x9a079e=_0x250812[_0x40db1b][_0x0275('0x184')][_0x0275('0x43')];if(_0x9a079e)io['to'](util[_0x0275('0x82')]('user:%s',_0x9a079e))[_0x0275('0xfb')](_0x0275('0x185'),{'hopper':_0x250812[_0x40db1b]});}})[_0x0275('0xc6')](function(_0x4b3fa1){logger[_0x0275('0x9d')](_0x0275('0x186'),_0x4b3fa1);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x0275('0x1e')][_0x0275('0x159')]=function(){var _0x422e8b=this;var _0xf5d0a4;for(var _0x3df4e0 in this[_0x0275('0x22')]){if(typeof this[_0x0275('0x22')][_0x3df4e0]!==_0x0275('0xb7')){_0xf5d0a4=this[_0x0275('0x22')][_0x3df4e0];if(isCampaignIvr(_0xf5d0a4[_0x0275('0x50')])&&isActive(_0xf5d0a4[_0x0275('0x7d')])){_0xf5d0a4[_0x0275('0xa9')]=!![];BPromise[_0x0275('0xc2')]()[_0x0275('0x3f')](checkIsActive(_0xf5d0a4,_0xf5d0a4[_0x0275('0x7d')]))[_0x0275('0x3f')](checkInterval(_0xf5d0a4))['then'](_0x422e8b['checkIsTrunkReachable'](_0xf5d0a4))[_0x0275('0x3f')](_0x422e8b[_0x0275('0x15e')](_0xf5d0a4[_0x0275('0x17c')],_0xf5d0a4[_0x0275('0x187')],_0xf5d0a4['name'],_0xf5d0a4))[_0x0275('0x3f')](_0x422e8b[_0x0275('0x15f')](_0xf5d0a4[_0x0275('0x45')],_0xf5d0a4[_0x0275('0x187')],_0xf5d0a4[_0x0275('0x43')],_0xf5d0a4))[_0x0275('0x3f')](_0x422e8b['launchHandleIvr'](_0xf5d0a4))[_0x0275('0xc6')](loggerCatchQueueSummary(_0x0275('0x188'),_0xf5d0a4));}else{notSendMessagesCampaign(_0xf5d0a4);}}}};function getCallerIdRandom(_0x3b908f,_0x48c99a){var _0x343ca4;var _0x280907;var _0x51f540;if(_0x48c99a<=0x0){_0x48c99a=0x1;}_0x343ca4=new RegExp(_0x0275('0x189')+_0x48c99a+'}$');_0x280907=Math[_0x0275('0x18a')](0xa,_0x48c99a-0x1);_0x51f540=Math[_0x0275('0x18a')](0xa,_0x48c99a)-0x1;return util['format']('%s',_[_0x0275('0x18b')](_0x3b908f,_0x343ca4,_[_0x0275('0x18c')](_0x280907,_0x51f540)));}function extractCalleridName(_0x31c03b){var _0x519b02=_0x31c03b['match'](/"(.*?)"/);return _0x519b02?_0x519b02[0x1]:_0x31c03b;}function extractCalleridNumber(_0x2800f1){var _0x166328=_0x2800f1['match'](/<(.*?)>/);return _0x166328?_0x166328[0x1]:_0x2800f1;}Dialer[_0x0275('0x1e')]['actionOriginate']=function(_0x443498,_0x959212){var _0x114476=this;var _0x271212=uuid['v4']();this['actions'][_0x271212]=new Action(_0x443498,_0x959212,_0x271212);return new BPromise(function(_0x20768a,_0x2925c2){if(_[_0x0275('0x41')](_0x443498)&&typeof _0x443498!==_0x0275('0x18d')){return _0x2925c2(msgResponse(_0x0275('0x18e'),_0x0275('0x161'),_0x0275('0x18f')));}if(_[_0x0275('0x41')](_0x959212[_0x0275('0x190')])||_0x959212[_0x0275('0x190')]===null){return _0x2925c2(msgResponse(_0x0275('0x18e'),_0x0275('0x161'),_0x0275('0x191')));}var _0x263a89={'XMD-CALLERID':_0x114476[_0x0275('0x13e')][_0x271212][_0x0275('0x192')](),'XMD-AGI':_0x443498[_0x0275('0x11b')]?util[_0x0275('0x82')](_0x0275('0x193'),ipAgi,_0x443498[_0x0275('0x11b')]):_0x0275('0x194'),'XMD-AGIAFTER':_0x443498[_0x0275('0x12e')]?util[_0x0275('0x82')](_0x0275('0x193'),ipAgi,_0x443498['dialQueueProject2']):_0x0275('0x194'),'XMD-QUEUE':_0x443498[_0x0275('0x50')]==='outbound'?util[_0x0275('0x82')](_0x0275('0x195'),_0x443498[_0x0275('0x43')],_0x443498[_0x0275('0x196')]||'',_0x443498['dialAgiAfterHangupAgent']?'c':'',_0x443498[_0x0275('0x12a')]||0x3):_0x0275('0x194'),'XMD-CONTACTID':_0x959212[_0x0275('0x118')],'XMD-CDRTYPE':_0x0275('0x9'),'CALLERID(all)':_0x114476[_0x0275('0x13e')][_0x271212][_0x0275('0x192')](),'XMD-AMD':_0x443498[_0x0275('0xf3')]?_0x0275('0x197'):_0x0275('0x194'),'XMD-DESTINATION':_0x0275('0xf2')};if(_0x443498['dialAMDActive']){_0x263a89['XMD-AMDINITIALSILENCE']=_0x443498[_0x0275('0x198')]||0x9c4;_0x263a89['XMD-AMDGREETING']=_0x443498[_0x0275('0x199')]||0x5dc;_0x263a89[_0x0275('0x19a')]=_0x443498[_0x0275('0x19b')]||0x320;_0x263a89[_0x0275('0x19c')]=_0x443498[_0x0275('0x19d')]||0x1388;_0x263a89['XMD-AMDMINWORDLENGTH']=_0x443498[_0x0275('0x19e')]||0x64;_0x263a89[_0x0275('0x19f')]=_0x443498[_0x0275('0x1a0')]||0x32;_0x263a89['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x443498[_0x0275('0x1a1')]||0x3;_0x263a89[_0x0275('0x1a2')]=_0x443498[_0x0275('0x1a3')]||0x100;_0x263a89[_0x0275('0x1a4')]=_0x443498['dialAMDMaximumWordLength']||0x1388;}if(_0x443498[_0x0275('0x50')]===_0x0275('0x51')){_0x263a89[_0x0275('0x1a5')]=_0x959212[_0x0275('0xe5')];}else{_0x263a89[_0x0275('0x1a6')]=_0x959212['CampaignId'];}for(var _0x3203d8 in _0x959212['Contact']){if(typeof _0x959212[_0x0275('0x1a7')][_0x3203d8]!==_0x0275('0xb7')){if(isNotNull(_0x959212['Contact'][_0x3203d8])&&_0x3203d8!=='id'&&_0x3203d8!==_0x0275('0x1a8')&&_0x3203d8!==_0x0275('0x1a9')&&_0x3203d8!=='updatedAt'){_0x263a89[util['format']('%s%s','XMD-',_[_0x0275('0x1aa')](_0x3203d8))]=_0x959212[_0x0275('0x1a7')][_0x3203d8];}}}var _0x36e777=_0x114476[_0x0275('0x15a')](_0x443498[_0x0275('0x7c')])?getCallerId(_0x443498[_0x0275('0x7c')][_0x0275('0x7e')],_0x443498[_0x0275('0x5e')],_0x443498[_0x0275('0x1ab')]>0x0?getCallerIdRandom(_0x443498[_0x0275('0x5f')],_0x443498['dialRandomLastDigitCallerIdNumber']):_0x443498['dialOriginateCallerIdNumber']):getCallerId(_[_0x0275('0xee')](_0x443498[_0x0275('0x15b')])?_0x443498[_0x0275('0x7c')][_0x0275('0x7e')]:_0x443498[_0x0275('0x15b')][_0x0275('0x7e')],_0x443498[_0x0275('0x5e')],_0x443498[_0x0275('0x1ab')]>0x0?getCallerIdRandom(_0x443498['dialOriginateCallerIdNumber'],_0x443498[_0x0275('0x1ab')]):_0x443498[_0x0275('0x5f')]);if(_0x36e777){_0x263a89[_0x0275('0x1ac')]=_0x114476['actions'][_0x271212][_0x0275('0x1ad')]=extractCalleridName(_0x36e777);_0x263a89['XMD-ORIGINATECALLERIDNUM']=_0x959212[_0x0275('0x190')];}return ami[_0x0275('0xba')]({'actionid':_0x271212,'action':_0x0275('0x18e'),'channel':_0x114476[_0x0275('0x15a')](_0x443498[_0x0275('0x7c')])?util[_0x0275('0x82')](_0x0275('0x1ae'),_0x443498[_0x0275('0x7c')][_0x0275('0x43')],isNotNull(_0x443498[_0x0275('0x60')])?_0x443498[_0x0275('0x60')][_0x0275('0x1af')]()||'':'',_0x443498[_0x0275('0x1b0')]>0x0?_0x959212[_0x0275('0x190')][_0x0275('0x1b1')](_0x443498[_0x0275('0x1b0')]):_0x959212['phone']):util[_0x0275('0x82')]('SIP/%s/%s%s',_[_0x0275('0xee')](_0x443498[_0x0275('0x15b')])?_0x443498['Trunk'][_0x0275('0x43')]:_0x443498[_0x0275('0x15b')][_0x0275('0x43')],isNotNull(_0x443498[_0x0275('0x60')])?_0x443498[_0x0275('0x60')][_0x0275('0x1af')]()||'':'',_0x443498[_0x0275('0x1b0')]>0x0?_0x959212[_0x0275('0x190')][_0x0275('0x1b1')](_0x443498[_0x0275('0x1b0')]):_0x959212['phone']),'callerid':_0x36e777,'Exten':_0x0275('0xf2'),'Context':_0x0275('0x1b2'),'Priority':'1','variable':_0x263a89,'timeout':(_0x443498['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x271212})['then'](function(_0x4fc2cd){return _0x20768a(_0x4fc2cd);})['catch'](function(_0x3338b1){_0x443498[_0x0275('0x68')]+=0x1;var _0x279826=new History(_0x114476[_0x0275('0x13e')][_0x271212]);logger[_0x0275('0x9d')](util[_0x0275('0x82')](_0x0275('0x1b3'),JSON[_0x0275('0x4c')](_0x3338b1)));_0x279826[_0x0275('0xb1')]=0xe;_0x279826[_0x0275('0xf7')]=_0x0275('0x1b4');_0x279826[_0x0275('0xb3')]=moment()[_0x0275('0x82')]('YYYY-MM-DD\x20HH:mm:ss');_0x279826[_0x0275('0xb2')]=_0x279826[_0x0275('0xb3')];_0x114476['createHistory'](_0x279826)[_0x0275('0xc6')](loggerCatch(_0x0275('0x1b5')));_0x114476['moveContactManagedDialer'](_0x279826)['catch'](loggerCatch(_0x0275('0x1b5')))[_0x0275('0x20')](function(){delete _0x114476[_0x0275('0x13e')][_0x271212];return _0x2925c2(msgResponse(_0x0275('0x18e'),'Error',_0x0275('0x1b6')));});});});};Dialer['prototype'][_0x0275('0x1b7')]=function(_0x291054){var _0x1f248f=this[_0x0275('0x13e')][_0x291054[_0x0275('0x13f')]];if(_0x1f248f){delete this[_0x0275('0x13e')][_0x291054[_0x0275('0x13f')]];_0x1f248f[_0x0275('0x129')]=moment()[_0x0275('0x82')]('YYYY-MM-DD\x20HH:mm:ss');var _0x44c3ae=_0x1f248f[_0x0275('0x50')]===_0x0275('0x81')?this['campaigns'][_0x1f248f['queue']]:this[_0x0275('0x21')][_0x1f248f[_0x0275('0x1b8')]()];if(!this[_0x0275('0xe9')](_0x291054[_0x0275('0x1b9')])){this[_0x0275('0xbe')](_0x44c3ae);return this[_0x0275('0x1ba')](_0x1f248f,_0x44c3ae,_0x291054)[_0x0275('0xc6')](loggerCatch(_0x0275('0x1bb')));}this[_0x0275('0x27')][_0x291054[_0x0275('0xed')]]=_0x1f248f;}};Dialer['prototype'][_0x0275('0x1bc')]=function(_0x150aaf,_0x12947c,_0x1e8b3a){var _0x2db53c=new History(_0x12947c);if(_0x2db53c[_0x0275('0x1bd')]+_0x2db53c[_0x0275('0x1be')]+_0x2db53c[_0x0275('0x105')]+_0x2db53c[_0x0275('0x106')]+_0x2db53c[_0x0275('0x107')]+_0x2db53c[_0x0275('0x108')]+_0x2db53c['countmachineretry']+_0x2db53c[_0x0275('0x109')]>=_0x1e8b3a['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x150aaf){case 0x3:if(_0x2db53c['countnoanswerretry']>=_0x1e8b3a[_0x0275('0x1bf')]-0x1){return!![];}this[_0x0275('0xd0')]({'active':![],'countnoanswerretry':_0x2db53c['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x0275('0x10e')](_0x1e8b3a[_0x0275('0x1c0')],'minutes')[_0x0275('0x82')](_0x0275('0x111')),'ContactId':_0x2db53c['ContactId'],'ListId':_0x2db53c[_0x0275('0x112')],'VoiceQueueId':_0x2db53c[_0x0275('0xe5')]||undefined,'CampaignId':_0x2db53c[_0x0275('0xe6')]||undefined})[_0x0275('0xc6')](loggerCatch(_0x0275('0x1c1')));break;case 0x5:if(_0x2db53c['countbusyretry']>=_0x1e8b3a[_0x0275('0x1c2')]-0x1){return!![];}this[_0x0275('0xd0')]({'active':![],'countbusyretry':_0x2db53c[_0x0275('0x1bd')]+=0x1,'scheduledat':moment()[_0x0275('0x10e')](_0x1e8b3a[_0x0275('0x1c3')],_0x0275('0x110'))[_0x0275('0x82')](_0x0275('0x111')),'ContactId':_0x2db53c[_0x0275('0x118')],'ListId':_0x2db53c[_0x0275('0x112')],'VoiceQueueId':_0x2db53c[_0x0275('0xe5')]||undefined,'CampaignId':_0x2db53c[_0x0275('0xe6')]||undefined})['catch'](loggerCatch(_0x0275('0x1c4')));break;case 0x8:if(_0x2db53c['countcongestionretry']>=_0x1e8b3a[_0x0275('0x1c5')]-0x1){return!![];}this[_0x0275('0xd0')]({'active':![],'countcongestionretry':_0x2db53c[_0x0275('0x1be')]+=0x1,'scheduledat':moment()[_0x0275('0x10e')](_0x1e8b3a[_0x0275('0x1c6')],_0x0275('0x110'))[_0x0275('0x82')](_0x0275('0x111')),'ContactId':_0x2db53c[_0x0275('0x118')],'ListId':_0x2db53c[_0x0275('0x112')],'VoiceQueueId':_0x2db53c[_0x0275('0xe5')]||undefined,'CampaignId':_0x2db53c['CampaignId']||undefined})[_0x0275('0xc6')](loggerCatch(_0x0275('0x1c7')));break;case 0x0:if(_0x2db53c[_0x0275('0x106')]>=_0x1e8b3a['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x0275('0xd0')]({'active':![],'countnosuchnumberretry':_0x2db53c[_0x0275('0x106')]+=0x1,'scheduledat':moment()[_0x0275('0x10e')](_0x1e8b3a[_0x0275('0x1c8')],_0x0275('0x110'))[_0x0275('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2db53c[_0x0275('0x118')],'ListId':_0x2db53c['ListId'],'VoiceQueueId':_0x2db53c[_0x0275('0xe5')]||undefined,'CampaignId':_0x2db53c[_0x0275('0xe6')]||undefined})[_0x0275('0xc6')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x2db53c['countdropretry']>=_0x1e8b3a[_0x0275('0x132')]-0x1){return!![];}this[_0x0275('0xd0')]({'active':![],'countdropretry':_0x2db53c[_0x0275('0x107')]+=0x1,'scheduledat':moment()[_0x0275('0x10e')](_0x1e8b3a[_0x0275('0x133')],_0x0275('0x110'))[_0x0275('0x82')](_0x0275('0x111')),'ContactId':_0x2db53c[_0x0275('0x118')],'ListId':_0x2db53c[_0x0275('0x112')],'VoiceQueueId':_0x2db53c[_0x0275('0xe5')]||undefined,'CampaignId':_0x2db53c[_0x0275('0xe6')]||undefined})[_0x0275('0xc6')](loggerCatch(_0x0275('0x134')));break;case 0xb:if(_0x2db53c['countabandonedretry']>=_0x1e8b3a['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x0275('0xd0')]({'active':![],'countabandonedretry':_0x2db53c[_0x0275('0x108')]+=0x1,'scheduledat':moment()['add'](_0x1e8b3a[_0x0275('0x139')],_0x0275('0x110'))[_0x0275('0x82')](_0x0275('0x111')),'ContactId':_0x2db53c[_0x0275('0x118')],'ListId':_0x2db53c[_0x0275('0x112')],'VoiceQueueId':_0x2db53c['VoiceQueueId']||undefined,'CampaignId':_0x2db53c['CampaignId']||undefined})['catch'](loggerCatch(_0x0275('0x13a')));break;case 0x13:if(_0x2db53c['countmachineretry']>=_0x1e8b3a[_0x0275('0x10b')]-0x1){return!![];}this[_0x0275('0xd0')]({'active':![],'countmachineretry':_0x2db53c[_0x0275('0x101')]+=0x1,'scheduledat':moment()[_0x0275('0x10e')](_0x1e8b3a['dialMachineRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2db53c['ContactId'],'ListId':_0x2db53c[_0x0275('0x112')],'VoiceQueueId':_0x2db53c['VoiceQueueId']||undefined,'CampaignId':_0x2db53c[_0x0275('0xe6')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x2db53c[_0x0275('0x109')]>=_0x1e8b3a[_0x0275('0x1c9')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x2db53c['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x0275('0x10e')](_0x1e8b3a['dialAgentRejectRetryFrequency'],_0x0275('0x110'))[_0x0275('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2db53c[_0x0275('0x118')],'ListId':_0x2db53c[_0x0275('0x112')],'VoiceQueueId':_0x2db53c[_0x0275('0xe5')]||undefined,'CampaignId':_0x2db53c[_0x0275('0xe6')]||undefined})[_0x0275('0xc6')](loggerCatch(_0x0275('0x1ca')));break;default:return!![];}};Dialer[_0x0275('0x1e')][_0x0275('0x1ba')]=function(_0x52deaf,_0x40ef78,_0x2705fa){var _0x576461=this;var _0x4ce3bc=new History(_0x52deaf);var _0x881db1=![];var _0x115062;var _0x1f81ed;return new BPromise(function(_0xc2c916,_0x345f33){if(_[_0x0275('0x41')](_0x40ef78)&&typeof _0x40ef78!==_0x0275('0x18d')){return _0x345f33(msgResponse('[callProgressDetecting]','Failure','entity\x20is\x20undefine'));}if(_['isUndefined'](_0x2705fa)&&typeof _0x2705fa!=='object'){return _0x345f33(msgResponse(_0x0275('0x1cb'),_0x0275('0x161'),_0x0275('0x1cc')));}_0x576461[_0x0275('0xc8')](_0x4ce3bc,_0x2705fa[_0x0275('0x120')],_0x40ef78)[_0x0275('0x3f')](function(_0x46e356){if(_0x46e356[_0x0275('0x131')]==0x1)_0x881db1=!![];switch(_0x2705fa[_0x0275('0x120')]){case'0':_0x40ef78['outboundNoSuchCallsDay']+=0x1;_0x4ce3bc[_0x0275('0xb1')]=0x0;_0x4ce3bc['statedesc']=_0x0275('0x1cd');_0x4ce3bc[_0x0275('0x106')]+=0x1;_0x4ce3bc[_0x0275('0x102')]+=0x1;ami['emit'](_0x0275('0x1ce'),ut[_0x0275('0x103')](_0x52deaf,'nosuchnumber'));_0x115062=_0x40ef78[_0x0275('0x1c8')];_0x1f81ed=_0x40ef78[_0x0275('0x12f')];_0x576461[_0x0275('0xdc')](_0x4ce3bc)[_0x0275('0xc6')](loggerCatch(_0x0275('0x104')));if(_0x576461[_0x0275('0x1bc')](0x0,_0x52deaf,_0x40ef78)&&!_0x881db1){if(_0x4ce3bc[_0x0275('0x106')]>=_0x40ef78[_0x0275('0x1cf')]){_0x576461[_0x0275('0x10c')](_0x4ce3bc,_0xc2c916,_0x345f33,'reason\x200\x20no\x20such\x20number....');}else{_0x576461[_0x0275('0x116')](_0x4ce3bc,_0xc2c916,_0x345f33,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x40ef78[_0x0275('0x1d0')]+=0x1;_0x4ce3bc['state']=0x3;_0x4ce3bc[_0x0275('0xf7')]=_0x0275('0x1d1');_0x4ce3bc['countnoanswerretry']+=0x1;_0x4ce3bc['countglobal']+=0x1;ami['emit'](_0x0275('0x1d2'),ut['buildObj'](_0x52deaf,_0x0275('0x1d3')));_0x115062=_0x40ef78['dialNoAnswerRetryFrequency'];_0x1f81ed=_0x40ef78[_0x0275('0x12f')];_0x576461[_0x0275('0xdc')](_0x4ce3bc)[_0x0275('0xc6')](loggerCatch(_0x0275('0x1d4')));if(_0x576461[_0x0275('0x1bc')](0x3,_0x52deaf,_0x40ef78)&&!_0x881db1){if(_0x4ce3bc[_0x0275('0x105')]>=_0x40ef78[_0x0275('0x1bf')]){_0x576461[_0x0275('0x10c')](_0x4ce3bc,_0xc2c916,_0x345f33,'reason\x203\x20ringing\x20no\x20answer');}else{_0x576461[_0x0275('0x116')](_0x4ce3bc,_0xc2c916,_0x345f33,_0x0275('0x1d5'));}}break;case'5':_0x40ef78[_0x0275('0x63')]+=0x1;_0x4ce3bc[_0x0275('0xb1')]=0x5;_0x4ce3bc[_0x0275('0xf7')]='Busy';_0x4ce3bc[_0x0275('0x1bd')]+=0x1;_0x4ce3bc['countglobal']+=0x1;ami[_0x0275('0xfb')](_0x0275('0x1d6'),ut['buildObj'](_0x52deaf,_0x0275('0x1d7')));_0x115062=_0x40ef78['dialBusyRetryFrequency'];_0x1f81ed=_0x40ef78['callAdditionalPhoneAfterMin'];_0x576461[_0x0275('0xdc')](_0x4ce3bc)[_0x0275('0xc6')](loggerCatch(_0x0275('0x1d8')));if(_0x576461[_0x0275('0x1bc')](0x5,_0x52deaf,_0x40ef78)&&!_0x881db1){if(_0x4ce3bc[_0x0275('0x1bd')]>=_0x40ef78['dialBusyMaxRetry']){_0x576461[_0x0275('0x10c')](_0x4ce3bc,_0xc2c916,_0x345f33,_0x0275('0x1d9'));}else{_0x576461[_0x0275('0x116')](_0x4ce3bc,_0xc2c916,_0x345f33,_0x0275('0x1d9'));}}break;case'8':_0x40ef78[_0x0275('0x64')]+=0x1;_0x4ce3bc[_0x0275('0xb1')]=0x8;_0x4ce3bc[_0x0275('0xf7')]='Congestion';_0x4ce3bc['countcongestionretry']+=0x1;_0x4ce3bc[_0x0275('0x102')]+=0x1;_0x115062=_0x40ef78[_0x0275('0x1c6')];_0x1f81ed=_0x40ef78[_0x0275('0x12f')];ami[_0x0275('0xfb')](_0x0275('0x1da'),ut[_0x0275('0x103')](_0x52deaf,'congestion'));_0x576461[_0x0275('0xdc')](_0x4ce3bc)[_0x0275('0xc6')](loggerCatch(_0x0275('0x1db')));if(_0x576461[_0x0275('0x1bc')](0x8,_0x52deaf,_0x40ef78)&&!_0x881db1){if(_0x4ce3bc[_0x0275('0x1be')]>=_0x40ef78['dialCongestionMaxRetry']){_0x576461[_0x0275('0x10c')](_0x4ce3bc,_0xc2c916,_0x345f33,_0x0275('0x1dc'));}else{_0x576461[_0x0275('0x116')](_0x4ce3bc,_0xc2c916,_0x345f33,_0x0275('0x1dc'));}}break;case'11':_0x40ef78['outboundAbandonedCallsDay']+=0x1;_0x4ce3bc['state']=0xb;_0x4ce3bc[_0x0275('0xf7')]=_0x0275('0x13b');_0x4ce3bc[_0x0275('0x108')]+=0x1;_0x4ce3bc[_0x0275('0x102')]+=0x1;_0x115062=_0x40ef78['dialAbandonedRetryFrequency'];_0x1f81ed=_0x40ef78[_0x0275('0x12f')];_0x576461[_0x0275('0xdc')](_0x4ce3bc)[_0x0275('0xc6')](loggerCatch(_0x0275('0x13d')));if(_0x576461[_0x0275('0x1bc')](0xb,_0x52deaf,_0x40ef78)&&!_0x881db1){if(_0x4ce3bc[_0x0275('0x108')]>=_0x40ef78[_0x0275('0x1dd')]){_0x576461[_0x0275('0x10c')](_0x4ce3bc,_0xc2c916,_0x345f33,_0x0275('0x1de'));}else{_0x576461[_0x0275('0x116')](_0x4ce3bc,_0xc2c916,_0x345f33,_0x0275('0x1de'));}}break;case'20':_0x40ef78[_0x0275('0x6a')]+=0x1;_0x4ce3bc[_0x0275('0xb1')]=0x14;_0x4ce3bc[_0x0275('0xf7')]=_0x0275('0x1df');_0x4ce3bc[_0x0275('0x109')]+=0x1;_0x4ce3bc[_0x0275('0x102')]+=0x1;_0x115062=_0x40ef78[_0x0275('0x1e0')];_0x1f81ed=_0x40ef78[_0x0275('0x12f')];ami[_0x0275('0xfb')](_0x0275('0x1e1'),ut[_0x0275('0x103')](_0x52deaf,_0x0275('0x1e2')));_0x576461['createHistory'](_0x4ce3bc)[_0x0275('0xc6')](loggerCatch(_0x0275('0x1e3')));if(_0x576461[_0x0275('0x1bc')](0x14,_0x52deaf,_0x40ef78)&&!_0x881db1){if(_0x4ce3bc[_0x0275('0x109')]>=_0x40ef78[_0x0275('0x1c9')]){_0x576461[_0x0275('0x10c')](_0x4ce3bc,_0xc2c916,_0x345f33,'reason\x2020\x20agentreject');}else{_0x576461[_0x0275('0x116')](_0x4ce3bc,_0xc2c916,_0x345f33,_0x0275('0x1e4'));}}break;default:_0x40ef78[_0x0275('0x6b')]+=0x1;_0x4ce3bc[_0x0275('0xb1')]=0xc;_0x4ce3bc['statedesc']=_0x2705fa[_0x0275('0x120')];_0x115062=_0x40ef78[_0x0275('0x1e0')];_0x1f81ed=_0x40ef78[_0x0275('0x12f')];_0x576461['createHistory'](_0x4ce3bc)[_0x0275('0xc6')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x576461[_0x0275('0x1bc')](_0x2705fa[_0x0275('0x120')],_0x52deaf,_0x40ef78)&&!_0x881db1){if(_0x4ce3bc[_0x0275('0x1bd')]+_0x4ce3bc[_0x0275('0x1be')]+_0x4ce3bc['countnoanswerretry']+_0x4ce3bc[_0x0275('0x106')]+_0x4ce3bc[_0x0275('0x107')]+_0x4ce3bc[_0x0275('0x108')]+_0x4ce3bc[_0x0275('0x101')]+_0x4ce3bc[_0x0275('0x109')]>=_0x40ef78[_0x0275('0x10a')]){_0x576461[_0x0275('0x116')](_0x4ce3bc,_0xc2c916,_0x345f33,_0x2705fa['reason']);}else{_0x576461['createStateFinal'](_0x4ce3bc,_0xc2c916,_0x345f33,_0x2705fa[_0x0275('0x120')]);}}}})[_0x0275('0x3f')](function(_0x50a3f0){if(_0x881db1){_0x576461['swapAdditionalPhones'](_0x4ce3bc,_0x115062,_0x1f81ed)[_0x0275('0x3f')](function(_0x34c1f6){return _0xc2c916(0x1);});}});});};Dialer['prototype'][_0x0275('0x116')]=function(_0x287945,_0xcf9af5,_0x3bb6fa,_0xff1890){var _0x9f861c=new Final(_0x287945);_0x9f861c['state']=0xf;_0x9f861c[_0x0275('0xf7')]=_0x0275('0x1e5');this[_0x0275('0x10c')](_0x9f861c,_0xcf9af5,_0x3bb6fa,_0xff1890);};Dialer[_0x0275('0x1e')]['createStateFinal']=function(_0x3a8711,_0x279503,_0x5b72b7,_0x289daa){this[_0x0275('0xda')](_0x3a8711)[_0x0275('0x3f')](function(){return _0x279503(msgResponse(_0x0275('0x1cb'),'Success',_0x289daa));})[_0x0275('0xc6')](function(){return _0x5b72b7(msgResponse(_0x0275('0x1e6'),_0x0275('0x161'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0x0275('0xa')]=function(_0x6271fa){var _0x2bb8df=_0x6271fa[_0x0275('0x1e7')]/0x64;var _0x3322ed=_0x6271fa[_0x0275('0x66')]/(_0x6271fa[_0x0275('0x66')]+_0x6271fa[_0x0275('0xf6')]);var _0x9f8f69=Math[_0x0275('0x1e8')](_0x6271fa['predictiveIntervalAvailable']*(_0x6271fa[_0x0275('0x1e9')]/0x64));var _0x1ec9e6=Math[_0x0275('0x1e8')](_0x6271fa[_0x0275('0x75')]*(_0x6271fa[_0x0275('0x1ea')]/0x64));var _0x23fe9b=_0x6271fa[_0x0275('0xaa')]+_0x6271fa[_0x0275('0x58')];var _0x6b70e7=Math['floor'](_0x6271fa[_0x0275('0x78')]*_0x6271fa['erlangAbandonmentRate']*_0x6271fa['predictiveIntervalHitRate']*_0x6271fa[_0x0275('0x73')]);if(_['isUndefined'](_0x6271fa[_0x0275('0x94')])){if(!_[_0x0275('0x41')](_0x6271fa[_0x0275('0x29')])){_0x6271fa['startPredictive']=undefined;loggerPredictive[_0x0275('0x9d')](_0x0275('0x1eb'),_0x0275('0x1ec'));}if(!_['isUndefined'](_0x6271fa[_0x0275('0x97')])){loggerPredictive[_0x0275('0x9d')]('[startMethodPredictive][StartProgressive]',_0x0275('0x1ed'));clearInterval(_0x6271fa[_0x0275('0x97')]);_0x6271fa[_0x0275('0x97')]=undefined;}_0x6271fa[_0x0275('0x94')]=moment()[_0x0275('0x82')](_0x0275('0x111'));loggerPredictive['info'](_0x6271fa['name'],_0x0275('0x1ee'),_0x6271fa[_0x0275('0x94')]);this['handlePower'](_0x6271fa,0x1);}else if(ifInterval(_0x6271fa[_0x0275('0x1ef')],_0x6271fa[_0x0275('0x94')])){this['handlePower'](_0x6271fa,0x1);loggerPredictiveCalls[_0x0275('0x83')](_0x0275('0x1f0'),_0x6271fa[_0x0275('0x94')],_0x6271fa[_0x0275('0x43')]);_0x6271fa[_0x0275('0x78')]=0x0;_0x6271fa[_0x0275('0x1f1')]=0x0;}else if(_0x2bb8df<_0x3322ed&&_0x6271fa[_0x0275('0x1f2')]===_0x0275('0x1f3')){freeVariablesPredictive(_0x6271fa);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x0275('0x1f4'),_0x3322ed,'startProgressive',_0x6271fa[_0x0275('0x43')]);}else if(_0x6b70e7<_0x6271fa['predictiveIntervalErlangCallsDroppedCalls']&&_0x6271fa[_0x0275('0x1f2')]===_0x0275('0x1f3')){freeVariablesPredictive(_0x6271fa);loggerPredictive[_0x0275('0x83')](_0x0275('0x1f5'),'Max\x20Drop\x20',_0x6b70e7,'Drop\x20in\x20this\x20interval',_0x6271fa[_0x0275('0x1f1')],_0x0275('0x94'),_0x6271fa[_0x0275('0x43')]);}else if(!ifInterval(_0x6271fa[_0x0275('0x1ef')],_0x6271fa['startProgressive'])&&_[_0x0275('0x41')](_0x6271fa[_0x0275('0x29')])&&!_[_0x0275('0x41')](_0x6271fa['startProgressive'])){_0x6271fa[_0x0275('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0275('0x83')](_0x6271fa['name'],'started\x20in\x20predictive\x20at',_0x6271fa[_0x0275('0x29')]);this['averageHandleTime'](_0x6271fa['dialPredictiveInterval'])['then'](this[_0x0275('0x1f6')](_0x6271fa))['then'](mergeDataErlangB(_0x6271fa))[_0x0275('0x3f')](this[_0x0275('0x1f7')](_0x6271fa))[_0x0275('0xc6')](loggerCatchPredictive(_0x0275('0x1f8'),_0x6271fa));}else if(!ifInterval(_0x6271fa[_0x0275('0x1ef')],_0x6271fa['startPredictive'])){_0x6271fa[_0x0275('0x1f1')]=0x0;_0x6271fa[_0x0275('0x29')]=moment()[_0x0275('0x82')](_0x0275('0x111'));loggerPredictive[_0x0275('0x83')](_0x6271fa[_0x0275('0x43')],_0x0275('0x1f9'),_0x6271fa[_0x0275('0x29')]);clearInterval(_0x6271fa['handlePredictive']);_0x6271fa[_0x0275('0x97')]=undefined;this[_0x0275('0x1fa')](_0x6271fa[_0x0275('0x1ef')])['then'](this['getDataPredictive'](_0x6271fa))[_0x0275('0x3f')](mergeDataErlangB(_0x6271fa))[_0x0275('0x3f')](this[_0x0275('0x1f7')](_0x6271fa))[_0x0275('0xc6')](loggerCatchPredictive(_0x0275('0x1fb'),_0x6271fa));}else if(_0x6271fa['predictiveIntervalAvailable']&&_0x23fe9b<_0x6271fa[_0x0275('0x75')]-_0x1ec9e6){freeVariablesPredictive(_0x6271fa);loggerPredictive[_0x0275('0x83')](_0x6271fa[_0x0275('0x43')],_0x0275('0x1fc'),_0x23fe9b,_0x0275('0x1fd'),_0x6271fa['predictiveIntervalAvailable'],'-',_0x1ec9e6,'=',_0x6271fa[_0x0275('0x75')]-_0x1ec9e6,')');}else if(_0x6271fa[_0x0275('0x75')]&&_0x23fe9b>_0x6271fa[_0x0275('0x75')]+_0x9f8f69){freeVariablesPredictive(_0x6271fa);loggerPredictive[_0x0275('0x83')](_0x6271fa['name'],_0x0275('0x1fc'),_0x23fe9b,_0x0275('0x1fe'),_0x6271fa[_0x0275('0x75')],'+',_0x9f8f69,'=',_0x6271fa[_0x0275('0x75')]+_0x9f8f69,')');}};Dialer[_0x0275('0x1e')][_0x0275('0x1f6')]=function(_0x1551de){var _0x57c719=this;return function(_0x5a99a1){return new BPromise(function(_0x1c6ddb,_0x19660b){_[_0x0275('0x93')](_0x1551de,_0x5a99a1[0x0]);if(checkGetDataPredictive(_0x5a99a1[0x0])){var _0x323acd=_0x1551de[_0x0275('0x75')]=_0x1551de[_0x0275('0x58')]+_0x1551de[_0x0275('0xaa')];var _0x40300e=_0x1551de[_0x0275('0x1ef')]*0x3c;var _0x1a95b5=_0x5a99a1[0x0][_0x0275('0x6e')]+_0x5a99a1[0x0][_0x0275('0x6d')];var _0x37e898=(_0x5a99a1[0x0]['predictiveIntervalAnsweredCalls']+_0x5a99a1[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5a99a1[0x0][_0x0275('0x6f')])/_0x5a99a1[0x0][_0x0275('0x76')];_0x1551de[_0x0275('0x72')]=_0x37e898>0x0?_0x37e898:0x1;switch(_0x1551de[_0x0275('0x1f2')]){case _0x0275('0x1f3'):var _0x3f636f=_0x1551de[_0x0275('0x1e7')]/0x64;return _0x57c719[_0x0275('0x1ff')](_0x323acd,_0x40300e,_0x1a95b5,_0x37e898,_0x3f636f)['then'](function(_0x19d98a){return _0x1c6ddb(_0x19d98a);});case _0x0275('0x200'):var _0x38c558=_0x1551de['dialPredictiveOptimizationPercentage']/0x64;return _0x57c719[_0x0275('0x201')](_0x323acd,_0x40300e,_0x1a95b5,_0x37e898,_0x38c558)[_0x0275('0x3f')](function(_0x5566da){return _0x1c6ddb(_0x5566da);});default:return _0x19660b(msgResponse('[getDataPredictive]',_0x0275('0x161'),_0x0275('0x202')));}}else{return _0x19660b(msgResponse(_0x0275('0x203'),'Failure',_0x0275('0x204')));}});};};Dialer[_0x0275('0x1e')]['getDataPredictiveOld']=function(_0x1f9641){var _0x46efb8=this;return function(_0x4d3ecc){return new BPromise(function(_0x3bd280,_0x3da185){_[_0x0275('0x93')](_0x1f9641,_0x4d3ecc[0x0]);if(checkGetDataPredictive(_0x4d3ecc[0x0])){loggerPredictive[_0x0275('0x83')](JSON[_0x0275('0x4c')](_0x4d3ecc[0x0]));if(_0x1f9641[_0x0275('0x1f2')]===_0x0275('0x1f3')){return _0x46efb8[_0x0275('0xd8')](_0x1f9641['id'])[_0x0275('0x3f')](function(_0x413d6f){var _0x5d8f52=_0x1f9641[_0x0275('0x54')]-_0x413d6f[0x0][_0x0275('0x205')];var _0x47abea=_0x1f9641['dialPredictiveInterval']*0x3c;var _0x128ee5=_0x4d3ecc[0x0]['predictiveIntervalAvgTalktime']+_0x4d3ecc[0x0][_0x0275('0x6d')];var _0x312c39=(_0x4d3ecc[0x0]['predictiveIntervalAnsweredCalls']+_0x4d3ecc[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4d3ecc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4d3ecc[0x0][_0x0275('0x76')];var _0x9028ee=_0x1f9641['dialPredictiveOptimizationPercentage']/0x64;_0x1f9641[_0x0275('0x74')]=_0x413d6f[0x0][_0x0275('0x205')]||0x0;_0x1f9641[_0x0275('0x72')]=_0x312c39>0x0?_0x312c39:0x1;return _0x46efb8[_0x0275('0x1ff')](_0x5d8f52,_0x47abea,_0x128ee5,_0x312c39,_0x9028ee);})['then'](function(_0x1847d0){return _0x3bd280(_0x1847d0);})[_0x0275('0xc6')](function(_0x136b97){return _0x3da185(msgResponse(_0x0275('0x206'),_0x0275('0x161'),JSON[_0x0275('0x4c')](_0x136b97)));});}if(_0x1f9641[_0x0275('0x1f2')]===_0x0275('0x200')){return _0x46efb8[_0x0275('0xd8')](_0x1f9641['id'])[_0x0275('0x3f')](function(_0x442114){var _0x565f59=_0x1f9641[_0x0275('0x54')]-_0x442114[0x0][_0x0275('0x205')];var _0x41331b=_0x1f9641['dialPredictiveInterval']*0x3c;var _0x2160c2=_0x4d3ecc[0x0][_0x0275('0x6e')]+_0x4d3ecc[0x0][_0x0275('0x6d')];var _0x5e488f=(_0x4d3ecc[0x0][_0x0275('0x6c')]+_0x4d3ecc[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4d3ecc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4d3ecc[0x0][_0x0275('0x76')];var _0x5f5b36=_0x1f9641[_0x0275('0x1e7')]/0x64;_0x1f9641[_0x0275('0x74')]=_0x442114[0x0][_0x0275('0x205')]||0x0;_0x1f9641[_0x0275('0x72')]=_0x5e488f>0x0?_0x5e488f:0x1;return _0x46efb8[_0x0275('0x201')](_0x565f59,_0x41331b,_0x2160c2,_0x5e488f,_0x5f5b36);})[_0x0275('0x3f')](function(_0x4f7f02){return _0x3bd280(_0x4f7f02);})[_0x0275('0xc6')](function(_0x57078c){return _0x3da185(msgResponse(_0x0275('0x206'),_0x0275('0x161'),JSON[_0x0275('0x4c')](_0x57078c)));});}}else{return _0x3da185(msgResponse(_0x0275('0x203'),_0x0275('0x161'),_0x0275('0x204')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x5d32d3){var _0x473a80=this;return function(){var _0x1d9467=0x0;var _0x4d9e13=Math[_0x0275('0x207')](_0x5d32d3[_0x0275('0x79')]*0x3e8);if(_0x4d9e13>0x0){_0x4d9e13=_0x4d9e13<0x64?0x64:_0x4d9e13;loggerPredictive['info'](_0x5d32d3[_0x0275('0x43')],'one\x20call\x20every:',_0x4d9e13,_0x0275('0x4d'));_0x5d32d3[_0x0275('0x97')]=setInterval(function(){_0x473a80[_0x0275('0x97')](_0x5d32d3);loggerPredictiveCalls[_0x0275('0x83')](_0x0275('0x208'),_0x1d9467+=0x1);},_0x4d9e13);}else{loggerPredictive[_0x0275('0x83')](_0x5d32d3[_0x0275('0x43')],_0x0275('0x209'));}};};Dialer[_0x0275('0x1e')]['checkContactBlack']=function(_0x47fe73,_0x2a2ffa){var _0x30a397=this;return function(_0xa84ec){if(_[_0x0275('0x49')](_0xa84ec)){if(_[_0x0275('0xee')](_0x2a2ffa[_0x0275('0xe4')])||!_0x2a2ffa[_0x0275('0x20a')]){if(_0x47fe73[_0x0275('0x5d')]===_0x0275('0x178')){_0x47fe73['queueStatusComplete']=_[_0x0275('0x41')](_0x47fe73['queueStatusComplete'])?!![]:_0x47fe73[_0x0275('0x147')];var _0x26a61d=uuid['v4']();_0x30a397['actions'][_0x26a61d]=new Action(_0x47fe73,_0x2a2ffa,_0x26a61d);loggerBooked['info'](_0x0275('0x20b'),_0x26a61d,_0x0275('0x20c'),JSON['stringify'](_0x47fe73['queueStatusComplete']),_0x0275('0x20d'),_0x47fe73[_0x0275('0x43')]);if(_0x47fe73[_0x0275('0x147')]){_0x47fe73[_0x0275('0x147')]=![];_0x30a397['queueBooked'][_0x30a397[_0x0275('0x13e')][_0x26a61d][_0x0275('0xbf')]]=[];ami[_0x0275('0xba')]({'actionid':_0x26a61d,'action':_0x0275('0x20e'),'queue':_0x47fe73['name']})[_0x0275('0xc6')](function(){_0x30a397[_0x0275('0xbe')](_0x47fe73);_0x30a397[_0x0275('0xd0')]({'active':![],'ContactId':_0x30a397[_0x0275('0x13e')][_0x26a61d][_0x0275('0x118')],'ListId':_0x30a397[_0x0275('0x13e')][_0x26a61d][_0x0275('0x112')],'VoiceQueueId':_0x30a397[_0x0275('0x13e')][_0x26a61d][_0x0275('0xe5')]||undefined,'CampaignId':_0x30a397['actions'][_0x26a61d][_0x0275('0xe6')]||undefined})[_0x0275('0xc6')](loggerCatch(_0x0275('0x20f')));delete _0x30a397[_0x0275('0x13e')][_0x26a61d];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x0275('0x4c')](_0x47fe73[_0x0275('0x147')]),_0x0275('0x20d'),_0x47fe73[_0x0275('0x43')]);_0x30a397[_0x0275('0xbe')](_0x47fe73);_0x30a397[_0x0275('0xd0')]({'active':![],'ContactId':_0x30a397[_0x0275('0x13e')][_0x26a61d][_0x0275('0x118')],'ListId':_0x30a397['actions'][_0x26a61d][_0x0275('0x112')],'VoiceQueueId':_0x30a397['actions'][_0x26a61d][_0x0275('0xe5')]||undefined,'CampaignId':_0x30a397[_0x0275('0x13e')][_0x26a61d][_0x0275('0xe6')]||undefined})['catch'](loggerCatch(_0x0275('0x20f')));delete _0x30a397[_0x0275('0x13e')][_0x26a61d];}}else{return _0x30a397[_0x0275('0x210')](_0x47fe73,_0x2a2ffa);}}else{if(getDiff(_0x2a2ffa[_0x0275('0x211')])<_0x47fe73['dialRecallMeTimeout']*0x3c){if(_0x2a2ffa[_0x0275('0x184')]&&!_0x2a2ffa[_0x0275('0x184')][_0x0275('0x212')]){_0x30a397[_0x0275('0x14a')][_0x0275('0x14b')](_0x2a2ffa['id'])[_0x0275('0x20')](function(){_0x30a397['updateOriginated'](_0x47fe73);});}else{_0x30a397['unlockContact']({'active':![]},_0x2a2ffa['id'],0x1)[_0x0275('0x20')](function(){_0x30a397[_0x0275('0xbe')](_0x47fe73);});}}else{_0x47fe73[_0x0275('0x69')]+=0x1;_0x30a397['updateOriginated'](_0x47fe73);if(_0x47fe73[_0x0275('0x213')]){_0x30a397['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2a2ffa[_0x0275('0x118')],'ListId':_0x2a2ffa[_0x0275('0x112')],'VoiceQueueId':_0x2a2ffa['VoiceQueueId']||undefined,'CampaignId':_0x2a2ffa[_0x0275('0xe6')]||undefined})[_0x0275('0xc6')](loggerCatch(_0x0275('0x214')));_0x30a397[_0x0275('0xdc')](createObjHistory(_0x47fe73,_0x2a2ffa,_0x0275('0x215'),0x17,_0x0275('0x216')))[_0x0275('0xc6')](loggerCatch(_0x0275('0x217')));}else{_0x30a397[_0x0275('0xe2')](createObjHistory(_0x47fe73,_0x2a2ffa,_0x0275('0x218'),0x16,'RecallFailedTimeout'),_0x0275('0x219'),'[Originate][HistoryRecallClose]');}}}}else{_0x47fe73[_0x0275('0x62')]+=0x1;_0x30a397[_0x0275('0xe2')](createObjHistory(_0x47fe73,_0x2a2ffa,_0x0275('0x21a'),0xd,_0x0275('0x21b')),_0x0275('0x21c'),_0x0275('0x21d'));throw _0x0275('0x21e');}};};Dialer[_0x0275('0x1e')][_0x0275('0x17b')]=function(_0x4ffa1c){var _0x3a7873=this;var _0x538c5a=_0x4ffa1c[_0x0275('0x21f')]-_0x4ffa1c[_0x0275('0x77')]-_0x4ffa1c[_0x0275('0xd4')];emitCampaignSummary(_0x4ffa1c);if(_0x538c5a>0x0){if(_0x538c5a>this[_0x0275('0x25')]){_0x538c5a=this[_0x0275('0x25')];}_0x4ffa1c[_0x0275('0xd4')]+=_0x538c5a;this['getContactDialerIvr'](_0x4ffa1c['id'],_0x538c5a,_0x4ffa1c[_0x0275('0x220')],_0x4ffa1c)[_0x0275('0x3f')](function(_0x3b8744){_0x4ffa1c[_0x0275('0xd4')]-=_0x538c5a;_0x4ffa1c[_0x0275('0xd4')]=_0x4ffa1c[_0x0275('0xd4')]>0x0?_0x4ffa1c['temp']:0x0;if(!checkContactEmpty(_0x3b8744)){_0x4ffa1c[_0x0275('0x42')]=_0x0275('0xa7');logger[_0x0275('0x83')](_0x0275('0x221')+_0x4ffa1c[_0x0275('0x43')]);}else{_0x4ffa1c[_0x0275('0x77')]+=_0x3b8744['length'];_0x4ffa1c[_0x0275('0x42')]=_0x0275('0x222');for(var _0x50bd24=0x0;_0x50bd24<_0x3b8744[_0x0275('0xa0')];_0x50bd24+=0x1){_0x4ffa1c[_0x0275('0x223')]+=0x1;if(_[_0x0275('0xee')](_0x3b8744[_0x50bd24])||_[_0x0275('0xee')](_0x3b8744[_0x50bd24][_0x0275('0x1a7')])||_['isNil'](_0x3b8744[_0x50bd24][_0x0275('0x190')])){_0x3a7873[_0x0275('0xe1')]('[actionOriginate]\x20',_0x4ffa1c,_0x3b8744[_0x50bd24]);}else{_0x3a7873[_0x0275('0xcc')](_[_0x0275('0xe3')](_0x3b8744[_0x50bd24],[_0x0275('0xe6'),'Contact.phone']))[_0x0275('0x3f')](_0x3a7873[_0x0275('0x224')](_0x4ffa1c,_0x3b8744[_0x50bd24]))[_0x0275('0xc6')](_0x3a7873[_0x0275('0xe0')](_0x0275('0x225'),_0x4ffa1c));}}}})[_0x0275('0xc6')](loggerGetContactDialer('[getContactCampaign2]',_0x4ffa1c,_0x538c5a));}};Dialer['prototype']['handlePower']=function(_0x2df64c,_0x1339ee){var _0x1a4e94=this;var _0xd20704=[];var _0x25ead7=_0x1339ee>=0x1?_0x1339ee:0x1;if(_0x2df64c[_0x0275('0x5d')]==='booked'){_0x25ead7=0x1;}var _0x2de5be=Math[_0x0275('0x207')](_0x2df64c['available']*_0x25ead7)-_0x2df64c['originated']-_0x2df64c[_0x0275('0xd4')];emitVoiceQueueSummary(_0x2df64c);if(_0x2df64c[_0x0275('0x226')]>0x0){var _0x1933ab=_0x2df64c['dialLimitQueue']-_0x2df64c[_0x0275('0x77')]-_0x2df64c[_0x0275('0x58')]-_0x2df64c[_0x0275('0xd4')]-_0x2df64c[_0x0275('0x55')];if(_0x2de5be>_0x1933ab){_0x2de5be=_0x1933ab;}}if(_0x2de5be>0x0){if(_0x2df64c['dialMethod']===_0x0275('0x178')){_0x2de5be=0x1;}if(_0x2de5be>this[_0x0275('0x25')]){_0x2de5be=this['maxNumberOriginate'];}_0x2df64c[_0x0275('0xd4')]+=_0x2de5be;for(var _0x404557 in this[_0x0275('0x23')]){if(typeof this[_0x0275('0x23')][_0x404557]!==_0x0275('0xb7')){if(this[_0x0275('0x23')][_0x404557][_0x0275('0xb1')]===_0x0275('0x227')&&this[_0x0275('0x23')][_0x404557][_0x0275('0xbb')]===_0x0275('0x182')){_0xd20704[_0x0275('0x145')](this[_0x0275('0x23')][_0x404557]['id']);}}}this[_0x0275('0xd3')](_0x2df64c['id'],_0xd20704,_0x2de5be,_0x2df64c[_0x0275('0x220')],_0x2df64c)[_0x0275('0x3f')](function(_0x14a05c){_0x2df64c[_0x0275('0xd4')]-=_0x2de5be;_0x2df64c[_0x0275('0xd4')]=_0x2df64c['temp']>0x0?_0x2df64c[_0x0275('0xd4')]:0x0;if(!checkContactEmpty(_0x14a05c)){_0x1a4e94[_0x0275('0xc3')](_0x2df64c)['then'](sendMessageReschedule(_0x2df64c))[_0x0275('0xc6')](loggerCatch(_0x0275('0xc4')));}else{_0x2df64c[_0x0275('0x77')]+=_0x14a05c[_0x0275('0xa0')];_0x2df64c[_0x0275('0x42')]=_0x2df64c[_0x0275('0x5d')]===_0x0275('0x178')?_0x0275('0x197'):_0x0275('0x222');for(var _0x45b19f=0x0;_0x45b19f<_0x14a05c[_0x0275('0xa0')];_0x45b19f+=0x1){if(_[_0x0275('0xee')](_0x14a05c[_0x45b19f])||_['isNil'](_0x14a05c[_0x45b19f][_0x0275('0x1a7')])||_[_0x0275('0xee')](_0x14a05c[_0x45b19f][_0x0275('0x190')])){_0x1a4e94[_0x0275('0xe1')](_0x0275('0x228'),_0x2df64c,_0x14a05c[_0x45b19f]);}else{_0x1a4e94[_0x0275('0xc5')](_[_0x0275('0xe3')](_0x14a05c[_0x45b19f],[_0x0275('0xe5'),'Contact.phone']))[_0x0275('0x3f')](_0x1a4e94[_0x0275('0x224')](_0x2df64c,_0x14a05c[_0x45b19f]))[_0x0275('0xc6')](_0x1a4e94[_0x0275('0xe0')](_0x0275('0x228'),_0x2df64c));}}}})[_0x0275('0xc6')](loggerGetContactDialer('[getContactDialer2]',_0x2df64c,_0x2de5be));}};Dialer[_0x0275('0x1e')][_0x0275('0x97')]=function(_0x4b365a){if(_0x4b365a[_0x0275('0x226')]>0x0){var _0x365ec3=_0x4b365a[_0x0275('0x226')]-_0x4b365a[_0x0275('0x77')]-_0x4b365a[_0x0275('0x58')];if(_0x365ec3>0x0){this[_0x0275('0x229')](_0x4b365a);}else{loggerPredictiveCalls[_0x0275('0x83')](_0x0275('0x22a'));}}else{this[_0x0275('0x229')](_0x4b365a);}};Dialer['prototype'][_0x0275('0x229')]=function(_0x2de1fa){var _0x284001=this;var _0x2ab322=[];_0x2de1fa[_0x0275('0x77')]+=0x1;for(var _0x1dab0c in this[_0x0275('0x23')]){if(typeof this[_0x0275('0x23')][_0x1dab0c]!=='undefined'){if(this[_0x0275('0x23')][_0x1dab0c][_0x0275('0xb1')]===_0x0275('0x227')&&this[_0x0275('0x23')][_0x1dab0c][_0x0275('0xbb')]===_0x0275('0x182')){_0x2ab322[_0x0275('0x145')](this['agents'][_0x1dab0c]['id']);}}}this[_0x0275('0xd3')](_0x2de1fa['id'],_0x2ab322,0x1,_0x2de1fa['dialOrderByScheduledAt'],_0x2de1fa)[_0x0275('0x3f')](function(_0x4eaac6){if(!checkContactEmpty(_0x4eaac6)){checkContactLowerLimitOriginate(_0x2de1fa,0x1,0x0);_0x284001[_0x0275('0xc3')](_0x2de1fa)[_0x0275('0x3f')](sendMessageReschedule(_0x2de1fa))['catch'](loggerCatch(_0x0275('0xc4')));}else{_0x2de1fa['message']=_0x0275('0x222');if(_[_0x0275('0xee')](_0x4eaac6[0x0])||_[_0x0275('0xee')](_0x4eaac6[0x0][_0x0275('0x1a7')])||_['isNil'](_0x4eaac6[0x0][_0x0275('0x190')])){_0x284001[_0x0275('0xe1')](_0x0275('0x228'),_0x2de1fa,_0x4eaac6[0x0]);}else{_0x284001[_0x0275('0xc5')](_[_0x0275('0xe3')](_0x4eaac6[0x0],[_0x0275('0xe5'),'Contact.phone']))[_0x0275('0x3f')](_0x284001[_0x0275('0x224')](_0x2de1fa,_0x4eaac6[0x0]))['catch'](_0x284001[_0x0275('0xe0')](_0x0275('0x22b'),_0x2de1fa));}}})[_0x0275('0xc6')](loggerGetContactDialer(_0x0275('0x22c'),_0x2de1fa,0x1));emitVoiceQueueSummary(_0x2de1fa);};Dialer['prototype'][_0x0275('0x1ff')]=function(_0x5f05be,_0x5b7503,_0x242bfe,_0x3bc1ad,_0x2c4523,_0x22f535){loggerPredictive['info'](_0x0275('0x22d'));loggerPredictive[_0x0275('0x83')](_0x0275('0x22e'),_0x5f05be);loggerPredictive[_0x0275('0x83')](_0x0275('0x22f'),_0x5b7503);loggerPredictive[_0x0275('0x83')](_0x0275('0x230'),_0x242bfe);loggerPredictive[_0x0275('0x83')](_0x0275('0x231'),_0x3bc1ad);loggerPredictive[_0x0275('0x83')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2c4523);loggerPredictive[_0x0275('0x83')](_0x0275('0x89'));return new BPromise(function(_0x4448ad,_0x284382){if(_0x5f05be<=0x0||isNaN(_0x5f05be)){return _0x284382(msgResponse(_0x0275('0x232'),_0x0275('0x4b'),_0x0275('0x233')+_0x5f05be));}if(_0x242bfe<=0x0||isNaN(_0x242bfe)){return _0x284382(msgResponse(_0x0275('0x232'),_0x0275('0x4b'),_0x0275('0x234')+_0x242bfe));}if(_0x3bc1ad<=0x0||isNaN(_0x3bc1ad)){return _0x284382(msgResponse(_0x0275('0x232'),_0x0275('0x4b'),_0x0275('0x235')+_0x3bc1ad));}if(_0x5b7503<=0x0||isNaN(_0x5b7503)){return _0x284382(msgResponse('[abandonmentRate]',_0x0275('0x4b'),_0x0275('0x236')+_0x5b7503));}if(_0x2c4523<=0x0||isNaN(_0x2c4523)){return _0x284382(msgResponse(_0x0275('0x232'),'Error',_0x0275('0x237')+_0x2c4523));}_0x22f535=_0x22f535||0x0;var _0x271ccd=0x1/_0x242bfe;var _0x4f0774=0x0;var _0x5441eb=0x0;var _0x97f787=0x0;var _0x55c488=0x0;for(var _0x122079=0x0;_0x97f787<_0x2c4523;_0x122079+=0x1){_0x5441eb=_0x122079/_0x5b7503;_0x4f0774=(_0x3bc1ad*_0x5441eb+_0x22f535)/_0x271ccd;_0x97f787=erlangb(_0x4f0774,_0x5f05be);_0x55c488=_0x4f0774/_0x5f05be*(0x1-erlangb(_0x4f0774,_0x5f05be));}return _0x4448ad({'erlangCalls':_0x122079,'erlangCallToSecond':_0x5b7503/_0x122079,'erlangAbandonmentRate':_0x97f787,'erlangBusyFactor':_0x55c488});});};Dialer[_0x0275('0x1e')]['busyFactor']=function(_0x36436f,_0x12cd27,_0xb0b7c3,_0x111fd2,_0xa3489b,_0x36c107){loggerPredictive[_0x0275('0x83')](_0x0275('0x238'));loggerPredictive['info'](_0x0275('0x22e'),_0x36436f);loggerPredictive[_0x0275('0x83')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x12cd27);loggerPredictive[_0x0275('0x83')](_0x0275('0x230'),_0xb0b7c3);loggerPredictive[_0x0275('0x83')](_0x0275('0x231'),_0x111fd2);loggerPredictive[_0x0275('0x83')](_0x0275('0x239'),_0xa3489b);loggerPredictive['info'](_0x0275('0x89'));return new BPromise(function(_0x27c635,_0x2a661b){if(_0x36436f<=0x0||isNaN(_0x36436f)){return _0x2a661b(msgResponse(_0x0275('0x23a'),_0x0275('0x4b'),'m\x20=\x20'+_0x36436f));}if(_0xb0b7c3<=0x0||isNaN(_0xb0b7c3)){return _0x2a661b(msgResponse(_0x0275('0x23a'),_0x0275('0x4b'),_0x0275('0x234')+_0xb0b7c3));}if(_0x111fd2<=0x0||isNaN(_0x111fd2)){return _0x2a661b(msgResponse(_0x0275('0x23a'),_0x0275('0x4b'),_0x0275('0x235')+_0x111fd2));}if(_0x12cd27<=0x0||isNaN(_0x12cd27)){return _0x2a661b(msgResponse('[busyFactor]','Error',_0x0275('0x236')+_0x12cd27));}if(_0xa3489b<=0x0||isNaN(_0xa3489b)){return _0x2a661b(msgResponse(_0x0275('0x23a'),_0x0275('0x4b'),_0x0275('0x23b')+_0xa3489b));}_0x36c107=_0x36c107||0x0;var _0x3e1852=0x1/_0xb0b7c3;var _0x3f6c47=0x0;var _0x2aa310=0x0;var _0x2f6b4e=0x0;var _0x9014e1=0x0;for(var _0x35952c=0x0;_0x9014e1<_0xa3489b;_0x35952c+=0x1){_0x2aa310=_0x35952c/_0x12cd27;_0x3f6c47=(_0x111fd2*_0x2aa310+_0x36c107)/_0x3e1852;_0x2f6b4e=erlangb(_0x3f6c47,_0x36436f);_0x9014e1=_0x3f6c47/_0x36436f*(0x1-erlangb(_0x3f6c47,_0x36436f));}return _0x27c635({'erlangCalls':_0x35952c,'erlangCallToSecond':_0x12cd27/_0x35952c,'erlangAbandonmentRate':_0x2f6b4e,'erlangBusyFactor':_0x9014e1});});};module['exports']=Dialer;
\ No newline at end of file
index c0e0b9e..7e744bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5ad8=['responsetime','droptime','endtime','ringtime','membername','connectedlinename','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x414815,_0x3b9381){var _0x143e0d=function(_0xa131da){while(--_0xa131da){_0x414815['push'](_0x414815['shift']());}};_0x143e0d(++_0x3b9381);}(_0x5ad8,0xa9));var _0x85ad=function(_0x44088c,_0x9ebb81){_0x44088c=_0x44088c-0x0;var _0x3dda70=_0x5ad8[_0x44088c];return _0x3dda70;};'use strict';var util=require(_0x85ad('0x0'));var _=require(_0x85ad('0x1'));var moment=require('moment');function getSeconds(_0x5ec585,_0x5278c4){var _0x4a20f6=moment(_0x5ec585)[_0x85ad('0x2')](0x0);var _0x4cc9cd=moment(_0x5278c4)[_0x85ad('0x2')](0x0);return _0x4a20f6['diff'](_0x4cc9cd,'seconds');}function QueueCallerAbandon(_0x153aaa,_0xa5ed5c){this[_0x85ad('0x3')]=_0x153aaa['scheduledat'];this[_0x85ad('0x4')]=_0x153aaa[_0x85ad('0x4')];this['campaigntype']=_0x153aaa[_0x85ad('0x4')]==='outbound'?_0x85ad('0x5'):_0x153aaa[_0x85ad('0x4')];this[_0x85ad('0x6')]=_0x153aaa['countbusyretry'];this[_0x85ad('0x7')]=_0x153aaa[_0x85ad('0x7')];this['countnoanswerretry']=_0x153aaa[_0x85ad('0x8')];this[_0x85ad('0x9')]=_0x153aaa[_0x85ad('0x6')]+_0x153aaa['countcongestionretry']+_0x153aaa[_0x85ad('0x8')]+_0x153aaa[_0x85ad('0xa')]+_0x153aaa[_0x85ad('0xb')]+_0x153aaa['countabandonedretry']+_0x153aaa[_0x85ad('0xc')]+_0x153aaa[_0x85ad('0xd')];this['countnosuchnumberretry']=_0x153aaa[_0x85ad('0xa')];this[_0x85ad('0xb')]=_0x153aaa[_0x85ad('0xb')];this[_0x85ad('0xe')]=_0x153aaa[_0x85ad('0xe')];this[_0x85ad('0xc')]=_0x153aaa['countmachineretry'];this['countagentrejectretry']=_0x153aaa[_0x85ad('0xd')];this[_0x85ad('0xf')]=_0xa5ed5c['uniqueid'];this[_0x85ad('0x10')]=_0x153aaa[_0x85ad('0x11')];this[_0x85ad('0x12')]=_0x153aaa[_0x85ad('0x13')];this[_0x85ad('0x14')]=_0x153aaa[_0x85ad('0x14')];this[_0x85ad('0x15')]=_0x153aaa[_0x85ad('0x15')];this[_0x85ad('0x16')]=_0x153aaa['droptime'];this[_0x85ad('0x17')]=this[_0x85ad('0x16')];this[_0x85ad('0x18')]=getSeconds(_0x153aaa['responsetime'],_0x153aaa[_0x85ad('0x14')]);this['holdtime']=getSeconds(this['droptime'],_0x153aaa[_0x85ad('0x15')]);this['talktime']=0x0;this[_0x85ad('0x5')]=_0xa5ed5c[_0x85ad('0x5')];this[_0x85ad('0x19')]=_0xa5ed5c[_0x85ad('0x1a')];this['reason']=_0xa5ed5c['reason'];this[_0x85ad('0x1b')]=_0x153aaa['callback'];this[_0x85ad('0x1c')]=_0x153aaa['callbackuniqueid'];this[_0x85ad('0x1d')]=_0x153aaa[_0x85ad('0x1d')];this[_0x85ad('0x1e')]=_0x153aaa['recallme'];this[_0x85ad('0x1f')]=_0x153aaa[_0x85ad('0x1f')];this['ListId']=_0x153aaa[_0x85ad('0x20')];this['UserId']=_0x153aaa[_0x85ad('0x21')];this['VoiceQueueId']=_0x153aaa[_0x85ad('0x22')];this[_0x85ad('0x23')]=_0x153aaa['CampaignId'];this[_0x85ad('0x24')]=_0x153aaa[_0x85ad('0x24')]||'';this['originatecalleridname']=_0x153aaa[_0x85ad('0x25')]||'';}module['exports']=QueueCallerAbandon;
\ No newline at end of file
+var _0xcc9f=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc9f,0x1a4));var _0xfcc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc9f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xfcc9('0x0'));var _=require(_0xfcc9('0x1'));var moment=require('moment');function getSeconds(_0x35ac56,_0x402dc3){var _0xdf8b79=moment(_0x35ac56)[_0xfcc9('0x2')](0x0);var _0x150a92=moment(_0x402dc3)[_0xfcc9('0x2')](0x0);return _0xdf8b79[_0xfcc9('0x3')](_0x150a92,_0xfcc9('0x4'));}function QueueCallerAbandon(_0x55f3e4,_0xa70584){this[_0xfcc9('0x5')]=_0x55f3e4['scheduledat'];this[_0xfcc9('0x6')]=_0x55f3e4[_0xfcc9('0x6')];this['campaigntype']=_0x55f3e4[_0xfcc9('0x6')]===_0xfcc9('0x7')?_0xfcc9('0x8'):_0x55f3e4['type'];this['countbusyretry']=_0x55f3e4[_0xfcc9('0x9')];this[_0xfcc9('0xa')]=_0x55f3e4[_0xfcc9('0xa')];this[_0xfcc9('0xb')]=_0x55f3e4[_0xfcc9('0xb')];this['countglobal']=_0x55f3e4[_0xfcc9('0x9')]+_0x55f3e4[_0xfcc9('0xa')]+_0x55f3e4[_0xfcc9('0xb')]+_0x55f3e4['countnosuchnumberretry']+_0x55f3e4[_0xfcc9('0xc')]+_0x55f3e4['countabandonedretry']+_0x55f3e4[_0xfcc9('0xd')]+_0x55f3e4[_0xfcc9('0xe')];this[_0xfcc9('0xf')]=_0x55f3e4['countnosuchnumberretry'];this[_0xfcc9('0xc')]=_0x55f3e4[_0xfcc9('0xc')];this['countabandonedretry']=_0x55f3e4[_0xfcc9('0x10')];this['countmachineretry']=_0x55f3e4['countmachineretry'];this[_0xfcc9('0xe')]=_0x55f3e4['countagentrejectretry'];this[_0xfcc9('0x11')]=_0xa70584[_0xfcc9('0x11')];this[_0xfcc9('0x12')]=_0x55f3e4[_0xfcc9('0x13')];this['calleridnum']=_0x55f3e4['number'];this[_0xfcc9('0x14')]=_0x55f3e4[_0xfcc9('0x14')];this[_0xfcc9('0x15')]=_0x55f3e4[_0xfcc9('0x15')];this[_0xfcc9('0x16')]=_0x55f3e4[_0xfcc9('0x16')];this[_0xfcc9('0x17')]=this[_0xfcc9('0x16')];this[_0xfcc9('0x18')]=getSeconds(_0x55f3e4[_0xfcc9('0x15')],_0x55f3e4[_0xfcc9('0x14')]);this[_0xfcc9('0x19')]=getSeconds(this[_0xfcc9('0x16')],_0x55f3e4[_0xfcc9('0x15')]);this['talktime']=0x0;this[_0xfcc9('0x8')]=_0xa70584[_0xfcc9('0x8')];this[_0xfcc9('0x1a')]=_0xa70584[_0xfcc9('0x1b')];this[_0xfcc9('0x1c')]=_0xa70584[_0xfcc9('0x1c')];this['callback']=_0x55f3e4[_0xfcc9('0x1d')];this[_0xfcc9('0x1e')]=_0x55f3e4[_0xfcc9('0x1e')];this[_0xfcc9('0x1f')]=_0x55f3e4[_0xfcc9('0x1f')];this[_0xfcc9('0x20')]=_0x55f3e4[_0xfcc9('0x20')];this['ContactId']=_0x55f3e4[_0xfcc9('0x21')];this[_0xfcc9('0x22')]=_0x55f3e4[_0xfcc9('0x22')];this[_0xfcc9('0x23')]=_0x55f3e4[_0xfcc9('0x23')];this[_0xfcc9('0x24')]=_0x55f3e4['VoiceQueueId'];this[_0xfcc9('0x25')]=_0x55f3e4[_0xfcc9('0x25')];this[_0xfcc9('0x26')]=_0x55f3e4[_0xfcc9('0x26')]||'';this[_0xfcc9('0x27')]=_0x55f3e4[_0xfcc9('0x27')]||'';}module[_0xfcc9('0x28')]=QueueCallerAbandon;
\ No newline at end of file
index 68255b0..eb1313d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x53e5cc,_0xf0b227){var _0x4c2958=function(_0x220506){while(--_0x220506){_0x53e5cc['push'](_0x53e5cc['shift']());}};_0x4c2958(++_0xf0b227);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action;
\ No newline at end of file
+var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x43da16,_0x34739d){var _0x361218=function(_0x49c983){while(--_0x49c983){_0x43da16['push'](_0x43da16['shift']());}};_0x361218(++_0x34739d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action;
\ No newline at end of file
index 0b5b9b6..0443825 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5187=['catch','error','\x20notify\x20','\x20receiveFax\x20','merge','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','moment','path','tiff2pdf','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x5187,0x124));var _0x7518=function(_0x246f0c,_0x39f734){_0x246f0c=_0x246f0c-0x0;var _0x30fe50=_0x5187[_0x246f0c];return _0x30fe50;};'use strict';var util=require(_0x7518('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x7518('0x1'));var path=require(_0x7518('0x2'));var tiff2pdf=require(_0x7518('0x3'));var gs=require('./util/gs');var logger=require(_0x7518('0x4'))(_0x7518('0x5'));var ami=require('../ami');var rpcDb=require(_0x7518('0x6'));var Channel=require(_0x7518('0x7'));var ut=require(_0x7518('0x8'));var Action=require(_0x7518('0x9'));var faxAccount=require(_0x7518('0xa'));var attachment=require(_0x7518('0xb'));var faxMessage=require(_0x7518('0xc'));function Fax(_0x2bad9f){this[_0x7518('0xd')]={};this['faxAccounts']=_0x2bad9f[_0x7518('0xe')];this[_0x7518('0xf')]=_0x2bad9f[_0x7518('0xf')];this[_0x7518('0x10')]={};ami['on'](_0x7518('0x11'),this[_0x7518('0x12')][_0x7518('0x13')](this));ami['on'](_0x7518('0x14'),this[_0x7518('0x15')][_0x7518('0x13')](this));ami['on'](_0x7518('0x16'),this[_0x7518('0x17')][_0x7518('0x13')](this));ami['on'](_0x7518('0x18'),this['syncNewExten'][_0x7518('0x13')](this));ami['on'](_0x7518('0x19'),this[_0x7518('0x1a')][_0x7518('0x13')](this));ami['on'](_0x7518('0x1b'),this[_0x7518('0x1c')][_0x7518('0x13')](this));ami['on'](_0x7518('0x1d'),this[_0x7518('0x1e')][_0x7518('0x13')](this));ami['on'](_0x7518('0x1f'),this[_0x7518('0x20')][_0x7518('0x13')](this));}Fax[_0x7518('0x21')]['syncNewchannel']=function(_0x5c1430){if(_0x5c1430[_0x7518('0x22')]===_0x7518('0x23')){for(var _0x160574 in this[_0x7518('0xe')]){if(this[_0x7518('0xe')][_0x7518('0x24')](_0x160574)){if(_0x5c1430[_0x7518('0x25')]===this[_0x7518('0xe')][_0x160574]['localstationid']){this[_0x7518('0xd')][_0x5c1430[_0x7518('0x26')]]={};this['channels'][_0x5c1430['uniqueid']][_0x7518('0x27')]=_0x5c1430['channel'];this[_0x7518('0xd')][_0x5c1430[_0x7518('0x26')]]['id']=this[_0x7518('0xe')][_0x160574]['id'];this[_0x7518('0xd')][_0x5c1430['uniqueid']][_0x7518('0x28')]=this[_0x7518('0xe')][_0x160574][_0x7518('0x28')];logger[_0x7518('0x29')](_0x5c1430[_0x7518('0x26')],_0x7518('0x2a'));}}}}if(this[_0x7518('0x10')][_0x5c1430[_0x7518('0x26')]]){this[_0x7518('0xd')][_0x5c1430['uniqueid']]={};this[_0x7518('0xd')][_0x5c1430['uniqueid']]['channel']=_0x5c1430[_0x7518('0x27')];logger[_0x7518('0x29')](_0x5c1430['uniqueid'],_0x7518('0x2a'));}};Fax[_0x7518('0x21')]['syncVarSet']=function(_0x469e9f){if(this[_0x7518('0xd')][_0x469e9f['uniqueid']]){for(var _0x44e3e9 in _0x469e9f[_0x7518('0x2b')]){if(_0x469e9f[_0x7518('0x2b')][_0x7518('0x24')](_0x44e3e9)){this['channels'][_0x469e9f['uniqueid']][_0x44e3e9]=_0x469e9f['value'];}}}};Fax['prototype'][_0x7518('0x17')]=function(_0x15576a){if(this['channels'][_0x15576a[_0x7518('0x26')]]){this[_0x7518('0xd')][_0x15576a[_0x7518('0x26')]][_0x7518('0x2c')]=_0x15576a[_0x7518('0x2c')];this[_0x7518('0xd')][_0x15576a[_0x7518('0x26')]][_0x7518('0x2d')]=_0x15576a[_0x7518('0x2d')];}};Fax[_0x7518('0x21')]['syncNewExten']=function(_0x41817b){if(this['channels'][_0x41817b['uniqueid']]){for(var _0x71e2f5 in _0x41817b[_0x7518('0x2b')]){if(_0x41817b[_0x7518('0x2b')][_0x7518('0x24')](_0x71e2f5)){this[_0x7518('0xd')][_0x41817b[_0x7518('0x26')]][_0x71e2f5]=_0x41817b[_0x7518('0x2e')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x4cdfce){if(this[_0x7518('0xd')][_0x4cdfce[_0x7518('0x26')]]){this['channels'][_0x4cdfce[_0x7518('0x26')]][_0x7518('0x2f')]=_0x4cdfce[_0x7518('0x2f')];this['channels'][_0x4cdfce['uniqueid']][_0x7518('0x30')]=_0x4cdfce[_0x7518('0x30')];this['channels'][_0x4cdfce[_0x7518('0x26')]][_0x7518('0x31')]=_0x4cdfce[_0x7518('0x31')];this[_0x7518('0xd')][_0x4cdfce[_0x7518('0x26')]][_0x7518('0x32')]=_0x4cdfce[_0x7518('0x32')];logger[_0x7518('0x29')](_0x4cdfce[_0x7518('0x26')],_0x7518('0x33'));}};Fax[_0x7518('0x21')]['syncReceiveFax']=function(_0x5c7f36){var _0x2dddfa=this;if(this[_0x7518('0xd')][_0x5c7f36[_0x7518('0x26')]]){var _0x26a4a0=this[_0x7518('0xd')][_0x5c7f36['uniqueid']]['id'];this[_0x7518('0xd')][_0x5c7f36['uniqueid']][_0x7518('0x34')]=_0x5c7f36[_0x7518('0x34')];this[_0x7518('0xd')][_0x5c7f36[_0x7518('0x26')]][_0x7518('0x35')]=_0x5c7f36[_0x7518('0x35')];this['channels'][_0x5c7f36['uniqueid']][_0x7518('0x31')]=_0x5c7f36[_0x7518('0x31')];this[_0x7518('0xd')][_0x5c7f36[_0x7518('0x26')]][_0x7518('0x36')]=_0x5c7f36[_0x7518('0x36')];this[_0x7518('0xd')][_0x5c7f36[_0x7518('0x26')]][_0x7518('0x37')]=_0x5c7f36[_0x7518('0x37')];this[_0x7518('0xd')][_0x5c7f36['uniqueid']][_0x7518('0x32')]=_0x5c7f36['filename'];this[_0x7518('0xd')][_0x5c7f36['uniqueid']][_0x7518('0x38')]=_0x5c7f36[_0x7518('0x38')];if(this[_0x7518('0xd')][_0x5c7f36[_0x7518('0x26')]][_0x7518('0x35')]>0x0){tiff2pdf(_0x5c7f36[_0x7518('0x32')],_0x7518('0x39'),function(_0x14328d){logger[_0x7518('0x29')](_0x5c7f36['uniqueid'],_0x7518('0x3a'),_0x14328d[_0x7518('0x3b')]);attachment[_0x7518('0x3c')]({'name':path[_0x7518('0x3d')](_0x5c7f36['filename'])[_0x7518('0x28')],'basename':path['parse'](_0x5c7f36[_0x7518('0x32')])[_0x7518('0x28')]+_0x7518('0x3e'),'type':_0x7518('0x3f')})[_0x7518('0x40')](function(_0x377f91){faxAccount['notify'](_0x26a4a0,{'from':_0x5c7f36[_0x7518('0x38')],'mapKey':_0x7518('0x5'),'body':path[_0x7518('0x3d')](_0x5c7f36[_0x7518('0x32')])['name']+_0x7518('0x3e'),'AttachmentId':_0x377f91['id']})[_0x7518('0x41')](function(_0x240025){logger[_0x7518('0x42')](_0x5c7f36[_0x7518('0x26')],_0x7518('0x43'),JSON['stringify'](_0x240025));});})['catch'](function(_0x40eb9d){logger[_0x7518('0x42')](_0x5c7f36[_0x7518('0x26')],_0x7518('0x44'),JSON['stringify'](_0x40eb9d));});});}logger[_0x7518('0x29')](_0x5c7f36[_0x7518('0x26')],'\x20receiveFax\x20');}};Fax[_0x7518('0x21')]['syncOriginateResponse']=function(_0x302b01){if(this[_0x7518('0x10')][_0x302b01[_0x7518('0x26')]]){_[_0x7518('0x45')](this[_0x7518('0xd')][_0x302b01['uniqueid']],_['pick'](_0x302b01,['response',_0x7518('0x46')]));}};function updateStatus(_0x9509d2){if(_0x9509d2['AttachmentId']){faxMessage['update'](_0x9509d2[_0x7518('0x47')],{'failMessage':_0x7518('0x48')})[_0x7518('0x40')](function(_0x172555){ut[_0x7518('0x49')]('[Fax][Message][Error][Updated]',_0x172555);})['catch'](function(_0x576f5c){ut[_0x7518('0x49')](_0x7518('0x4a'),_0x576f5c);});}else{ut['logger'](_0x7518('0x4b'));}}Fax['prototype'][_0x7518('0x4c')]=function(_0x2259a4,_0x35aa1f,_0x4b1e10){var _0x343339=this;var _0x894833={};if(_0x35aa1f){_0x894833={'read':_0x35aa1f};}else{_0x894833={'failMessage':_0x4b1e10};}if(this[_0x7518('0x10')][_0x2259a4][_0x7518('0x47')]){faxMessage[_0x7518('0x4d')](this[_0x7518('0x10')][_0x2259a4][_0x7518('0x47')],_0x894833)[_0x7518('0x40')](function(_0x4f3aaf){ut['logger'](_0x7518('0x4e'),_0x4f3aaf);})[_0x7518('0x41')](function(_0x44035b){ut[_0x7518('0x49')](_0x7518('0x4f'),_0x44035b);})['finally'](function(){delete _0x343339[_0x7518('0xd')][_0x2259a4];delete _0x343339[_0x7518('0x10')][_0x2259a4];});}else{ut[_0x7518('0x49')](_0x7518('0x50'));delete this[_0x7518('0xd')][_0x2259a4];delete this[_0x7518('0x10')][_0x2259a4];}};Fax[_0x7518('0x21')][_0x7518('0x1e')]=function(_0x8ddec8){var _0x309778=this;if(this[_0x7518('0xd')][_0x8ddec8[_0x7518('0x26')]]){if(this[_0x7518('0x10')][_0x8ddec8[_0x7518('0x26')]]){this[_0x7518('0xd')][_0x8ddec8[_0x7518('0x26')]]['id']=this[_0x7518('0x10')][_0x8ddec8[_0x7518('0x26')]]['id'];this['channels'][_0x8ddec8[_0x7518('0x26')]][_0x7518('0x28')]=this[_0x7518('0x10')][_0x8ddec8[_0x7518('0x26')]]['name'];}logger[_0x7518('0x29')](_0x8ddec8[_0x7518('0x26')],this[_0x7518('0x10')][_0x8ddec8['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x7518('0x51'),JSON['stringify'](this['channels'][_0x8ddec8[_0x7518('0x26')]]));if(this[_0x7518('0x10')][_0x8ddec8[_0x7518('0x26')]]){if(this[_0x7518('0xd')][_0x8ddec8[_0x7518('0x26')]][_0x7518('0x52')]>0x0&&this[_0x7518('0xd')][_0x8ddec8[_0x7518('0x26')]][_0x7518('0x19')]===_0x7518('0x53')){this[_0x7518('0x4c')](_0x8ddec8[_0x7518('0x26')],!![]);}else{this[_0x7518('0x4c')](_0x8ddec8['uniqueid'],![],this['channels'][_0x8ddec8[_0x7518('0x26')]][_0x7518('0x54')]?_0x7518('0x55')+this[_0x7518('0xd')][_0x8ddec8['uniqueid']][_0x7518('0x54')]:_0x7518('0x56'));}}}};Fax[_0x7518('0x21')][_0x7518('0x57')]=function(_0x477de2){var _0x4811e8=this;return new BPromise(function(_0x4c47fa,_0x3a11b0){_0x4811e8['execOriginate'](_0x477de2,_0x4811e8[_0x7518('0xe')][_0x477de2[_0x7518('0x58')]])[_0x7518('0x40')](function(_0xb5bc5){ut[_0x7518('0x49')]('[Fax][execOriginate][success]',_0xb5bc5);_0x4c47fa(ut[_0x7518('0x3b')]('Fax\x20received'));})['catch'](function(_0x3e62cb){ut[_0x7518('0x49')](_0x7518('0x59'),_0x3e62cb);updateStatus(_0x477de2);_0x3a11b0(ut[_0x7518('0x3b')](_0x7518('0x5a')));});});};Fax[_0x7518('0x21')]['checkAfterSend']=function(_0x544b9c){var _0x1d3e13=this;return new BPromise(function(_0x53322d,_0x597933){var _0x403a43=_0x1d3e13[_0x7518('0x5b')](_0x1d3e13['faxAccounts'][_0x544b9c['FaxAccountId']][_0x7518('0x5c')],_0x544b9c);if(_0x403a43[_0x7518('0x5d')]){_0x53322d(ut[_0x7518('0x3b')](_0x7518('0x5e')));}else{_0x597933(ut['message'](_0x403a43[_0x7518('0x3b')]));}});};function originate(_0x26d151,_0x12cafd,_0x203dcd){return new BPromise(function(_0x119a64,_0x4c4520){if(_0x203dcd){var _0x3869f4=util[_0x7518('0x5f')](_0x7518('0x60'),path[_0x7518('0x3d')](_0x26d151[_0x7518('0x2')])[_0x7518('0x28')],_0x26d151[_0x7518('0x2')]);gs[_0x7518('0x61')](_0x3869f4)[_0x7518('0x40')](function(){_0x26d151[_0x7518('0x2')]=util[_0x7518('0x5f')](_0x7518('0x62'),path[_0x7518('0x3d')](_0x26d151[_0x7518('0x2')])[_0x7518('0x63')],path[_0x7518('0x3d')](_0x26d151[_0x7518('0x2')])[_0x7518('0x28')]);_0x12cafd[_0x7518('0x64')]=_0x26d151[_0x7518('0x2')];ut[_0x7518('0x49')](_0x7518('0x65'),'');ami[_0x7518('0x66')](ut[_0x7518('0x67')](_0x26d151,_0x12cafd))['then'](function(_0x2bba68){_0x119a64(_0x2bba68);})[_0x7518('0x41')](function(_0x8bc627){_0x4c4520(_0x8bc627);});})[_0x7518('0x41')](function(_0x68681f){_0x4c4520(_0x68681f);});}else{ami[_0x7518('0x66')](ut[_0x7518('0x67')](_0x26d151,_0x12cafd))[_0x7518('0x40')](function(_0x3f249c){_0x119a64(_0x3f249c);})[_0x7518('0x41')](function(_0x26d236){_0x4c4520(_0x26d236);});}});}Fax[_0x7518('0x21')][_0x7518('0x68')]=function(_0x5ecfbc,_0x3e7852){var _0x1c8caf=this;return new BPromise(function(_0x2bd3e3,_0x6458e5){var _0x5eaa40=uuid['v4']();var _0x3fd3c3=ut['addVariables'](_0x5ecfbc,_0x3e7852);_0x1c8caf[_0x7518('0x10')][_0x5eaa40]=new Action(_0x5eaa40,_0x3e7852,_0x5ecfbc);var _0x516f1b=_0x1c8caf[_0x7518('0x10')][_0x5eaa40];if(path[_0x7518('0x3d')](_0x5ecfbc[_0x7518('0x2')])['ext']===_0x7518('0x3e')){originate(_0x516f1b,_0x3fd3c3,!![])[_0x7518('0x40')](function(_0x17954c){_0x2bd3e3(_0x17954c);})['catch'](function(_0x49d177){_0x6458e5(_0x49d177);});}else{originate(_0x516f1b,_0x3fd3c3,![])['then'](function(_0x2e34a5){_0x2bd3e3(_0x2e34a5);})[_0x7518('0x41')](function(_0xa8ae1a){_0x6458e5(_0xa8ae1a);});}});};Fax[_0x7518('0x21')][_0x7518('0x69')]=function(_0x4557d6){return!_['isNil'](_0x4557d6)&&!_['isNil'](_0x4557d6[_0x7518('0x28')])&&!_[_0x7518('0x6a')](_0x4557d6[_0x7518('0x6b')])&&_0x4557d6[_0x7518('0x6b')]&&!_[_0x7518('0x6a')](this[_0x7518('0xf')][util['format'](_0x7518('0x6c'),_0x4557d6[_0x7518('0x28')])])&&!_[_0x7518('0x6a')](this['trunks'][util[_0x7518('0x5f')](_0x7518('0x6c'),_0x4557d6[_0x7518('0x28')])][_0x7518('0x30')])&&(this[_0x7518('0xf')][util[_0x7518('0x5f')](_0x7518('0x6c'),_0x4557d6[_0x7518('0x28')])][_0x7518('0x30')]===_0x7518('0x6d')||this[_0x7518('0xf')][util[_0x7518('0x5f')](_0x7518('0x6c'),_0x4557d6[_0x7518('0x28')])][_0x7518('0x30')]===_0x7518('0x6e'));};Fax[_0x7518('0x21')]['checkTrunk']=function(_0x1484f9,_0x129e14){if(!this[_0x7518('0x69')](_0x1484f9)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x7518('0x6a')](_0x1484f9)?'':_0x1484f9[_0x7518('0x28')]+_0x7518('0x6f'));return{'isValid':![],'message':_0x7518('0x70')};}if(_[_0x7518('0x6a')](_0x129e14['fax'])){ut['logger'](_0x7518('0x71'),JSON['stringify'](_0x129e14));return{'isValid':![],'message':_0x7518('0x72')};}if(_['isNil'](_0x129e14['path'])){ut[_0x7518('0x49')](_0x7518('0x73'),JSON['stringify'](_0x129e14));return{'isValid':![],'message':_0x7518('0x74')};}return{'isValid':!![],'message':_0x7518('0x75')};};module[_0x7518('0x76')]=Fax;
\ No newline at end of file
+var _0xda99=['syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','message','create','parse','.pdf','application/pdf','\x20notify\x20','stringify','catch','error','\x20receiveFax\x20','merge','pick','response','AttachmentId','then','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','update','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','FaxAccountId','Trunk','Trunk\x20Reachable','format','path','execute','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','uuid','moment','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup'];(function(_0x5f8af1,_0xf3ba33){var _0x411e24=function(_0x4df0a1){while(--_0x4df0a1){_0x5f8af1['push'](_0x5f8af1['shift']());}};_0x411e24(++_0xf3ba33);}(_0xda99,0xbe));var _0x9da9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda99[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x9da9('0x0'));var BPromise=require('bluebird');var uuid=require(_0x9da9('0x1'));var moment=require(_0x9da9('0x2'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0x9da9('0x3'))(_0x9da9('0x4'));var ami=require(_0x9da9('0x5'));var rpcDb=require(_0x9da9('0x6'));var Channel=require(_0x9da9('0x7'));var ut=require(_0x9da9('0x8'));var Action=require(_0x9da9('0x9'));var faxAccount=require(_0x9da9('0xa'));var attachment=require(_0x9da9('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x292441){this[_0x9da9('0xc')]={};this[_0x9da9('0xd')]=_0x292441[_0x9da9('0xd')];this[_0x9da9('0xe')]=_0x292441[_0x9da9('0xe')];this[_0x9da9('0xf')]={};ami['on'](_0x9da9('0x10'),this[_0x9da9('0x11')][_0x9da9('0x12')](this));ami['on'](_0x9da9('0x13'),this[_0x9da9('0x14')][_0x9da9('0x12')](this));ami['on'](_0x9da9('0x15'),this[_0x9da9('0x16')][_0x9da9('0x12')](this));ami['on'](_0x9da9('0x17'),this[_0x9da9('0x18')][_0x9da9('0x12')](this));ami['on']('faxstatus',this[_0x9da9('0x19')]['bind'](this));ami['on'](_0x9da9('0x1a'),this[_0x9da9('0x1b')][_0x9da9('0x12')](this));ami['on'](_0x9da9('0x1c'),this[_0x9da9('0x1d')][_0x9da9('0x12')](this));ami['on']('originateresponse',this[_0x9da9('0x1e')][_0x9da9('0x12')](this));}Fax[_0x9da9('0x1f')][_0x9da9('0x11')]=function(_0x558948){if(_0x558948['context']===_0x9da9('0x20')){for(var _0x451e6b in this[_0x9da9('0xd')]){if(this[_0x9da9('0xd')][_0x9da9('0x21')](_0x451e6b)){if(_0x558948[_0x9da9('0x22')]===this[_0x9da9('0xd')][_0x451e6b][_0x9da9('0x23')]){this[_0x9da9('0xc')][_0x558948[_0x9da9('0x24')]]={};this[_0x9da9('0xc')][_0x558948['uniqueid']][_0x9da9('0x25')]=_0x558948[_0x9da9('0x25')];this[_0x9da9('0xc')][_0x558948['uniqueid']]['id']=this[_0x9da9('0xd')][_0x451e6b]['id'];this[_0x9da9('0xc')][_0x558948[_0x9da9('0x24')]][_0x9da9('0x26')]=this[_0x9da9('0xd')][_0x451e6b][_0x9da9('0x26')];logger['info'](_0x558948[_0x9da9('0x24')],_0x9da9('0x27'));}}}}if(this[_0x9da9('0xf')][_0x558948[_0x9da9('0x24')]]){this['channels'][_0x558948[_0x9da9('0x24')]]={};this['channels'][_0x558948[_0x9da9('0x24')]]['channel']=_0x558948[_0x9da9('0x25')];logger[_0x9da9('0x28')](_0x558948[_0x9da9('0x24')],'\x20syncNewchannel\x20');}};Fax[_0x9da9('0x1f')][_0x9da9('0x14')]=function(_0x2016d7){if(this['channels'][_0x2016d7[_0x9da9('0x24')]]){for(var _0x386a4e in _0x2016d7['variable']){if(_0x2016d7[_0x9da9('0x29')][_0x9da9('0x21')](_0x386a4e)){this[_0x9da9('0xc')][_0x2016d7['uniqueid']][_0x386a4e]=_0x2016d7[_0x9da9('0x2a')];}}}};Fax[_0x9da9('0x1f')][_0x9da9('0x16')]=function(_0x2bbc0a){if(this['channels'][_0x2bbc0a[_0x9da9('0x24')]]){this['channels'][_0x2bbc0a[_0x9da9('0x24')]][_0x9da9('0x2b')]=_0x2bbc0a[_0x9da9('0x2b')];this[_0x9da9('0xc')][_0x2bbc0a['uniqueid']][_0x9da9('0x2c')]=_0x2bbc0a[_0x9da9('0x2c')];}};Fax[_0x9da9('0x1f')]['syncNewExten']=function(_0x45cc3c){if(this[_0x9da9('0xc')][_0x45cc3c['uniqueid']]){for(var _0x3409db in _0x45cc3c[_0x9da9('0x29')]){if(_0x45cc3c[_0x9da9('0x29')]['hasOwnProperty'](_0x3409db)){this['channels'][_0x45cc3c['uniqueid']][_0x3409db]=_0x45cc3c[_0x9da9('0x2a')];}}}};Fax[_0x9da9('0x1f')]['syncFaxStatus']=function(_0x1883e3){if(this['channels'][_0x1883e3[_0x9da9('0x24')]]){this[_0x9da9('0xc')][_0x1883e3[_0x9da9('0x24')]][_0x9da9('0x2d')]=_0x1883e3['operation'];this[_0x9da9('0xc')][_0x1883e3[_0x9da9('0x24')]][_0x9da9('0x2e')]=_0x1883e3[_0x9da9('0x2e')];this[_0x9da9('0xc')][_0x1883e3[_0x9da9('0x24')]][_0x9da9('0x23')]=_0x1883e3[_0x9da9('0x23')];this[_0x9da9('0xc')][_0x1883e3[_0x9da9('0x24')]][_0x9da9('0x2f')]=_0x1883e3[_0x9da9('0x2f')];logger[_0x9da9('0x28')](_0x1883e3[_0x9da9('0x24')],_0x9da9('0x30'));}};Fax[_0x9da9('0x1f')]['syncReceiveFax']=function(_0x4f117e){var _0xae7eb5=this;if(this[_0x9da9('0xc')][_0x4f117e[_0x9da9('0x24')]]){var _0x4706c6=this[_0x9da9('0xc')][_0x4f117e[_0x9da9('0x24')]]['id'];this['channels'][_0x4f117e[_0x9da9('0x24')]][_0x9da9('0x31')]=_0x4f117e[_0x9da9('0x31')];this['channels'][_0x4f117e['uniqueid']]['pagestransferred']=_0x4f117e[_0x9da9('0x32')];this['channels'][_0x4f117e[_0x9da9('0x24')]]['localstationid']=_0x4f117e['localstationid'];this[_0x9da9('0xc')][_0x4f117e[_0x9da9('0x24')]][_0x9da9('0x33')]=_0x4f117e[_0x9da9('0x33')];this['channels'][_0x4f117e['uniqueid']][_0x9da9('0x34')]=_0x4f117e[_0x9da9('0x34')];this[_0x9da9('0xc')][_0x4f117e[_0x9da9('0x24')]][_0x9da9('0x2f')]=_0x4f117e[_0x9da9('0x2f')];this[_0x9da9('0xc')][_0x4f117e[_0x9da9('0x24')]][_0x9da9('0x35')]=_0x4f117e[_0x9da9('0x35')];if(this['channels'][_0x4f117e['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x4f117e['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x169f62){logger[_0x9da9('0x28')](_0x4f117e[_0x9da9('0x24')],'\x20result\x20conversion\x20file\x20',_0x169f62[_0x9da9('0x36')]);attachment[_0x9da9('0x37')]({'name':path[_0x9da9('0x38')](_0x4f117e[_0x9da9('0x2f')])[_0x9da9('0x26')],'basename':path[_0x9da9('0x38')](_0x4f117e[_0x9da9('0x2f')])['name']+_0x9da9('0x39'),'type':_0x9da9('0x3a')})['then'](function(_0x5e1ec6){faxAccount['notify'](_0x4706c6,{'from':_0x4f117e['calleridnum'],'mapKey':_0x9da9('0x4'),'body':path[_0x9da9('0x38')](_0x4f117e[_0x9da9('0x2f')])['name']+_0x9da9('0x39'),'AttachmentId':_0x5e1ec6['id']})['catch'](function(_0x1fac64){logger['error'](_0x4f117e[_0x9da9('0x24')],_0x9da9('0x3b'),JSON[_0x9da9('0x3c')](_0x1fac64));});})[_0x9da9('0x3d')](function(_0x7f0141){logger[_0x9da9('0x3e')](_0x4f117e[_0x9da9('0x24')],_0x9da9('0x3f'),JSON[_0x9da9('0x3c')](_0x7f0141));});});}logger['info'](_0x4f117e[_0x9da9('0x24')],_0x9da9('0x3f'));}};Fax[_0x9da9('0x1f')][_0x9da9('0x1e')]=function(_0x437c0a){if(this['actions'][_0x437c0a[_0x9da9('0x24')]]){_[_0x9da9('0x40')](this[_0x9da9('0xc')][_0x437c0a['uniqueid']],_[_0x9da9('0x41')](_0x437c0a,[_0x9da9('0x42'),'reason']));}};function updateStatus(_0x2e81b5){if(_0x2e81b5[_0x9da9('0x43')]){faxMessage['update'](_0x2e81b5['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x9da9('0x44')](function(_0x2f762d){ut[_0x9da9('0x45')]('[Fax][Message][Error][Updated]',_0x2f762d);})[_0x9da9('0x3d')](function(_0x174e5b){ut[_0x9da9('0x45')](_0x9da9('0x46'),_0x174e5b);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x9da9('0x1f')][_0x9da9('0x47')]=function(_0x1e685e,_0x4077d5,_0x329cd3){var _0x26ed63=this;var _0x30fd9c={};if(_0x4077d5){_0x30fd9c={'read':_0x4077d5};}else{_0x30fd9c={'failMessage':_0x329cd3};}if(this[_0x9da9('0xf')][_0x1e685e][_0x9da9('0x43')]){faxMessage[_0x9da9('0x48')](this[_0x9da9('0xf')][_0x1e685e][_0x9da9('0x43')],_0x30fd9c)[_0x9da9('0x44')](function(_0x21d38e){ut[_0x9da9('0x45')](_0x9da9('0x49'),_0x21d38e);})[_0x9da9('0x3d')](function(_0x5b81fc){ut[_0x9da9('0x45')]('[Fax][Message][NoUpdate1]',_0x5b81fc);})[_0x9da9('0x4a')](function(){delete _0x26ed63[_0x9da9('0xc')][_0x1e685e];delete _0x26ed63[_0x9da9('0xf')][_0x1e685e];});}else{ut[_0x9da9('0x45')](_0x9da9('0x4b'));delete this['channels'][_0x1e685e];delete this[_0x9da9('0xf')][_0x1e685e];}};Fax['prototype'][_0x9da9('0x1d')]=function(_0x3dc838){var _0x36e56a=this;if(this['channels'][_0x3dc838[_0x9da9('0x24')]]){if(this[_0x9da9('0xf')][_0x3dc838['uniqueid']]){this[_0x9da9('0xc')][_0x3dc838['uniqueid']]['id']=this[_0x9da9('0xf')][_0x3dc838[_0x9da9('0x24')]]['id'];this['channels'][_0x3dc838['uniqueid']][_0x9da9('0x26')]=this[_0x9da9('0xf')][_0x3dc838['uniqueid']][_0x9da9('0x26')];}logger[_0x9da9('0x28')](_0x3dc838[_0x9da9('0x24')],this['actions'][_0x3dc838['uniqueid']]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0x9da9('0xc')][_0x3dc838['uniqueid']]));if(this[_0x9da9('0xf')][_0x3dc838[_0x9da9('0x24')]]){if(this[_0x9da9('0xc')][_0x3dc838[_0x9da9('0x24')]]['faxpages']>0x0&&this[_0x9da9('0xc')][_0x3dc838[_0x9da9('0x24')]]['faxstatus']===_0x9da9('0x4c')){this[_0x9da9('0x47')](_0x3dc838[_0x9da9('0x24')],!![]);}else{this[_0x9da9('0x47')](_0x3dc838[_0x9da9('0x24')],![],this['channels'][_0x3dc838['uniqueid']][_0x9da9('0x4d')]?_0x9da9('0x4e')+this[_0x9da9('0xc')][_0x3dc838[_0x9da9('0x24')]]['faxstatusstring']:_0x9da9('0x4f'));}}}};Fax[_0x9da9('0x1f')][_0x9da9('0x50')]=function(_0x4d65da){var _0x17e300=this;return new BPromise(function(_0x531d36,_0x4e26cf){_0x17e300[_0x9da9('0x51')](_0x4d65da,_0x17e300[_0x9da9('0xd')][_0x4d65da['FaxAccountId']])[_0x9da9('0x44')](function(_0x3deaad){ut['logger'](_0x9da9('0x52'),_0x3deaad);_0x531d36(ut[_0x9da9('0x36')](_0x9da9('0x53')));})[_0x9da9('0x3d')](function(_0x542456){ut[_0x9da9('0x45')](_0x9da9('0x54'),_0x542456);updateStatus(_0x4d65da);_0x4e26cf(ut[_0x9da9('0x36')]('Fax\x20failed'));});});};Fax[_0x9da9('0x1f')][_0x9da9('0x55')]=function(_0x3a64b2){var _0x284728=this;return new BPromise(function(_0x1992fa,_0x4ae511){var _0x318a85=_0x284728[_0x9da9('0x56')](_0x284728[_0x9da9('0xd')][_0x3a64b2[_0x9da9('0x57')]][_0x9da9('0x58')],_0x3a64b2);if(_0x318a85['isValid']){_0x1992fa(ut[_0x9da9('0x36')](_0x9da9('0x59')));}else{_0x4ae511(ut['message'](_0x318a85[_0x9da9('0x36')]));}});};function originate(_0x3a7111,_0x42ad1b,_0x32e8ff){return new BPromise(function(_0x35bcf0,_0x2974e0){if(_0x32e8ff){var _0x54e6e4=util[_0x9da9('0x5a')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0x3a7111[_0x9da9('0x5b')])['name'],_0x3a7111[_0x9da9('0x5b')]);gs[_0x9da9('0x5c')](_0x54e6e4)['then'](function(){_0x3a7111[_0x9da9('0x5b')]=util[_0x9da9('0x5a')](_0x9da9('0x5d'),path[_0x9da9('0x38')](_0x3a7111['path'])['dir'],path[_0x9da9('0x38')](_0x3a7111[_0x9da9('0x5b')])[_0x9da9('0x26')]);_0x42ad1b['XMF-PATH']=_0x3a7111[_0x9da9('0x5b')];ut[_0x9da9('0x45')](_0x9da9('0x5e'),'');ami[_0x9da9('0x5f')](ut['variablesAction'](_0x3a7111,_0x42ad1b))[_0x9da9('0x44')](function(_0x315993){_0x35bcf0(_0x315993);})[_0x9da9('0x3d')](function(_0x1dcf41){_0x2974e0(_0x1dcf41);});})[_0x9da9('0x3d')](function(_0x274b9a){_0x2974e0(_0x274b9a);});}else{ami[_0x9da9('0x5f')](ut[_0x9da9('0x60')](_0x3a7111,_0x42ad1b))[_0x9da9('0x44')](function(_0x5d8753){_0x35bcf0(_0x5d8753);})[_0x9da9('0x3d')](function(_0x204a42){_0x2974e0(_0x204a42);});}});}Fax[_0x9da9('0x1f')][_0x9da9('0x51')]=function(_0x2235c5,_0x47356b){var _0xe3ac6f=this;return new BPromise(function(_0x2f4517,_0x557f2c){var _0x166b1b=uuid['v4']();var _0x1bb340=ut[_0x9da9('0x61')](_0x2235c5,_0x47356b);_0xe3ac6f[_0x9da9('0xf')][_0x166b1b]=new Action(_0x166b1b,_0x47356b,_0x2235c5);var _0x5e06db=_0xe3ac6f[_0x9da9('0xf')][_0x166b1b];if(path['parse'](_0x2235c5['path'])[_0x9da9('0x62')]===_0x9da9('0x39')){originate(_0x5e06db,_0x1bb340,!![])[_0x9da9('0x44')](function(_0x1f01ad){_0x2f4517(_0x1f01ad);})['catch'](function(_0x196138){_0x557f2c(_0x196138);});}else{originate(_0x5e06db,_0x1bb340,![])[_0x9da9('0x44')](function(_0xb5cb57){_0x2f4517(_0xb5cb57);})['catch'](function(_0x421409){_0x557f2c(_0x421409);});}});};Fax[_0x9da9('0x1f')][_0x9da9('0x63')]=function(_0x2a861c){return!_[_0x9da9('0x64')](_0x2a861c)&&!_['isNil'](_0x2a861c[_0x9da9('0x26')])&&!_[_0x9da9('0x64')](_0x2a861c[_0x9da9('0x65')])&&_0x2a861c[_0x9da9('0x65')]&&!_[_0x9da9('0x64')](this[_0x9da9('0xe')][util[_0x9da9('0x5a')](_0x9da9('0x66'),_0x2a861c[_0x9da9('0x26')])])&&!_[_0x9da9('0x64')](this[_0x9da9('0xe')][util[_0x9da9('0x5a')](_0x9da9('0x66'),_0x2a861c[_0x9da9('0x26')])]['status'])&&(this[_0x9da9('0xe')][util[_0x9da9('0x5a')]('SIP/%s',_0x2a861c[_0x9da9('0x26')])][_0x9da9('0x2e')]==='reachable'||this[_0x9da9('0xe')][util['format'](_0x9da9('0x66'),_0x2a861c[_0x9da9('0x26')])][_0x9da9('0x2e')]===_0x9da9('0x67'));};Fax[_0x9da9('0x1f')][_0x9da9('0x56')]=function(_0x439d7e,_0x455102){if(!this[_0x9da9('0x63')](_0x439d7e)){ut[_0x9da9('0x45')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x9da9('0x64')](_0x439d7e)?'':_0x439d7e[_0x9da9('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x9da9('0x68')};}if(_[_0x9da9('0x64')](_0x455102[_0x9da9('0x4')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x9da9('0x3c')](_0x455102));return{'isValid':![],'message':_0x9da9('0x69')};}if(_[_0x9da9('0x64')](_0x455102[_0x9da9('0x5b')])){ut[_0x9da9('0x45')](_0x9da9('0x6a'),JSON['stringify'](_0x455102));return{'isValid':![],'message':_0x9da9('0x6b')};}return{'isValid':!![],'message':_0x9da9('0x6c')};};module[_0x9da9('0x6d')]=Fax;
\ No newline at end of file
index 1a97969..1d07c79 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1f9e=['catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','error','inspect','notify','resolve','then'];(function(_0x1dcf17,_0x452038){var _0x572f42=function(_0xba55c8){while(--_0xba55c8){_0x1dcf17['push'](_0x1dcf17['shift']());}};_0x572f42(++_0x452038);}(_0x1f9e,0xe6));var _0xe1f9=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0x1f9e[_0x5d30b4];return _0x1acfb8;};'use strict';var util=require(_0xe1f9('0x0'));var BPromise=require(_0xe1f9('0x1'));var logger=require(_0xe1f9('0x2'))(_0xe1f9('0x3'));var _=require(_0xe1f9('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x245a13){return function(_0x132eb9){logger[_0xe1f9('0x5')](_0x245a13,util[_0xe1f9('0x6')](_0x132eb9,{'showHidden':![],'depth':null}));};}exports[_0xe1f9('0x7')]=function(_0x40c60e,_0x4201be){return BPromise[_0xe1f9('0x8')]()[_0xe1f9('0x9')](faxAccount['notify'](_0x40c60e,_0x4201be))[_0xe1f9('0xa')](loggerCatch(_0xe1f9('0xb')));};
\ No newline at end of file
+var _0x4025=['../../../config/logger','preview','error','notify','resolve','catch','util','bluebird'];(function(_0xa337f7,_0xbaf917){var _0xde2ed=function(_0x10cdb5){while(--_0x10cdb5){_0xa337f7['push'](_0xa337f7['shift']());}};_0xde2ed(++_0xbaf917);}(_0x4025,0x7e));var _0x5402=function(_0x3109eb,_0x3fa2f4){_0x3109eb=_0x3109eb-0x0;var _0x598e1e=_0x4025[_0x3109eb];return _0x598e1e;};'use strict';var util=require(_0x5402('0x0'));var BPromise=require(_0x5402('0x1'));var logger=require(_0x5402('0x2'))(_0x5402('0x3'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x197d6a){return function(_0x3ebfe7){logger[_0x5402('0x4')](_0x197d6a,util['inspect'](_0x3ebfe7,{'showHidden':![],'depth':null}));};}exports[_0x5402('0x5')]=function(_0x30049f,_0x2eafc2){return BPromise[_0x5402('0x6')]()['then'](faxAccount[_0x5402('0x5')](_0x30049f,_0x2eafc2))[_0x5402('0x7')](loggerCatch('[Notify]\x20'));};
\ No newline at end of file
index 37091bb..f489fe7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x003d=['Exec\x20gs','\x20Error\x20:','inspect','util','bluebird','exec','execute','info'];(function(_0x46e427,_0xdad9a8){var _0x127b35=function(_0x21e292){while(--_0x21e292){_0x46e427['push'](_0x46e427['shift']());}};_0x127b35(++_0xdad9a8);}(_0x003d,0x1b3));var _0xd003=function(_0x506a8e,_0x25134a){_0x506a8e=_0x506a8e-0x0;var _0x1586a7=_0x003d[_0x506a8e];return _0x1586a7;};'use strict';var util=require(_0xd003('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xd003('0x1'));var exec=require('child_process')[_0xd003('0x2')];exports[_0xd003('0x3')]=function(_0x19b217){return new BPromise(function(_0x1572d1,_0x2d8d8f){exec(_0x19b217,function(_0x309f98,_0x5c6f30,_0x4b4f8b){logger[_0xd003('0x4')](_0xd003('0x5'),_0x5c6f30);if(_0x309f98){logger[_0xd003('0x4')](_0xd003('0x5'),_0xd003('0x6'),util[_0xd003('0x7')](_0x309f98,{'showHidden':![],'depth':null}),_0x5c6f30,_0x4b4f8b);_0x2d8d8f(_0x309f98);}_0x1572d1(_0x5c6f30);});});};
\ No newline at end of file
+var _0x775a=['exec','execute','info','Exec\x20gs','\x20Error\x20:','util','fax','bluebird'];(function(_0x32ca7f,_0x28ac85){var _0x4ca229=function(_0x599ab0){while(--_0x599ab0){_0x32ca7f['push'](_0x32ca7f['shift']());}};_0x4ca229(++_0x28ac85);}(_0x775a,0x165));var _0xa775=function(_0x59f676,_0x4d8c87){_0x59f676=_0x59f676-0x0;var _0x528c08=_0x775a[_0x59f676];return _0x528c08;};'use strict';var util=require(_0xa775('0x0'));var logger=require('../../../../config/logger')(_0xa775('0x1'));var BPromise=require(_0xa775('0x2'));var exec=require('child_process')[_0xa775('0x3')];exports[_0xa775('0x4')]=function(_0x509875){return new BPromise(function(_0x36d1b0,_0x57e73c){exec(_0x509875,function(_0xb51751,_0xdb1faf,_0x4ae4cd){logger[_0xa775('0x5')](_0xa775('0x6'),_0xdb1faf);if(_0xb51751){logger[_0xa775('0x5')]('Exec\x20gs',_0xa775('0x7'),util['inspect'](_0xb51751,{'showHidden':![],'depth':null}),_0xdb1faf,_0x4ae4cd);_0x57e73c(_0xb51751);}_0x36d1b0(_0xdb1faf);});});};
\ No newline at end of file
index 4c5e154..9354369 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3aae=['\x22%s\x22\x20<%s>','headerinfo','util','moment','../../../../config/logger','fax','logger','info','inspect','addVariables','ecm','minrate','maxrate','format','modem','faxdetect','localstationid','path','uniqueid','xcally-motion-fax','from-sip'];(function(_0x98d4a9,_0x3571ac){var _0x4d3ee1=function(_0x4940dc){while(--_0x4940dc){_0x98d4a9['push'](_0x98d4a9['shift']());}};_0x4d3ee1(++_0x3571ac);}(_0x3aae,0x167));var _0xe3aa=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3aae[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0xe3aa('0x0'));var _=require('lodash');var moment=require(_0xe3aa('0x1'));var logger=require(_0xe3aa('0x2'))(_0xe3aa('0x3'));exports['message']=function(_0x296809){return{'message':_0x296809};};exports[_0xe3aa('0x4')]=function(_0x52a5c3,_0x2dc963){logger[_0xe3aa('0x5')](_0x52a5c3,util[_0xe3aa('0x6')](_0x2dc963,{'showHidden':![],'depth':null}));};exports[_0xe3aa('0x7')]=function(_0x360863,_0x309e53){var _0x8e274e={'XMF-ECM':_0x309e53[_0xe3aa('0x8')],'XMF-HEADERINFO':_0x309e53['headerinfo'],'XMF-MINRATE':_0x309e53[_0xe3aa('0x9')],'XMF-MAXRATE':_0x309e53[_0xe3aa('0xa')],'XMF-MODEM':util[_0xe3aa('0xb')]('\x22%s\x22',_0x309e53[_0xe3aa('0xc')]),'XMF-GATEWAY':_0x309e53['gateway'],'XMF-FAXDETECT':_0x309e53[_0xe3aa('0xd')],'XMF-T38TIMEOUT':_0x309e53['t38timeout'],'XMF-LOCALSTATIONID':_0x309e53[_0xe3aa('0xe')],'XMF-PATH':_0x360863[_0xe3aa('0xf')]};return _0x8e274e;};exports['variablesAction']=function(_0x23bd5a,_0x447514){return{'actionid':_0x23bd5a[_0xe3aa('0x10')],'action':'originate','channel':_0x23bd5a['channel'],'Exten':_0xe3aa('0x11'),'Context':_0xe3aa('0x12'),'Priority':'1','callerid':util[_0xe3aa('0xb')](_0xe3aa('0x13'),_0x23bd5a[_0xe3aa('0x14')]?_0x23bd5a[_0xe3aa('0x14')]:'',_0x23bd5a[_0xe3aa('0xe')]),'variable':_0x447514,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x23bd5a['uniqueid']};};
\ No newline at end of file
+var _0xd493=['modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','util','moment','../../../../config/logger','fax','message','logger','inspect','ecm','headerinfo','maxrate','\x22%s\x22'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xd493,0xe5));var _0x3d49=function(_0x2ef88c,_0x26005e){_0x2ef88c=_0x2ef88c-0x0;var _0x3dd6d7=_0xd493[_0x2ef88c];return _0x3dd6d7;};'use strict';var util=require(_0x3d49('0x0'));var _=require('lodash');var moment=require(_0x3d49('0x1'));var logger=require(_0x3d49('0x2'))(_0x3d49('0x3'));exports[_0x3d49('0x4')]=function(_0x21565f){return{'message':_0x21565f};};exports[_0x3d49('0x5')]=function(_0x28e01b,_0x41ae42){logger['info'](_0x28e01b,util[_0x3d49('0x6')](_0x41ae42,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x34df43,_0x17076e){var _0x1a9dfd={'XMF-ECM':_0x17076e[_0x3d49('0x7')],'XMF-HEADERINFO':_0x17076e[_0x3d49('0x8')],'XMF-MINRATE':_0x17076e['minrate'],'XMF-MAXRATE':_0x17076e[_0x3d49('0x9')],'XMF-MODEM':util['format'](_0x3d49('0xa'),_0x17076e[_0x3d49('0xb')]),'XMF-GATEWAY':_0x17076e[_0x3d49('0xc')],'XMF-FAXDETECT':_0x17076e[_0x3d49('0xd')],'XMF-T38TIMEOUT':_0x17076e[_0x3d49('0xe')],'XMF-LOCALSTATIONID':_0x17076e[_0x3d49('0xf')],'XMF-PATH':_0x34df43['path']};return _0x1a9dfd;};exports[_0x3d49('0x10')]=function(_0x1e2f4e,_0x39176b){return{'actionid':_0x1e2f4e[_0x3d49('0x11')],'action':_0x3d49('0x12'),'channel':_0x1e2f4e[_0x3d49('0x13')],'Exten':_0x3d49('0x14'),'Context':_0x3d49('0x15'),'Priority':'1','callerid':util[_0x3d49('0x16')](_0x3d49('0x17'),_0x1e2f4e[_0x3d49('0x8')]?_0x1e2f4e[_0x3d49('0x8')]:'',_0x1e2f4e[_0x3d49('0xf')]),'variable':_0x39176b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1e2f4e['uniqueid']};};
\ No newline at end of file
index 0395ed3..4599b36 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2b79=['initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','listen','catch','[index.js][main]','util','moment','./server','./realtime','./trigger','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','hour','get','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2b79,0x187));var _0x92b7=function(_0x3eb630,_0x552586){_0x3eb630=_0x3eb630-0x0;var _0x1b840d=_0x2b79[_0x3eb630];return _0x1b840d;};'use strict';var BPromise=require('bluebird');var util=require(_0x92b7('0x0'));var moment=require(_0x92b7('0x1'));var server=require(_0x92b7('0x2'));var Realtime=require(_0x92b7('0x3'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0x92b7('0x4'));var Dialer=require('./dialer');var Preview=require(_0x92b7('0x5'));var Fax=require('./fax');var user=require(_0x92b7('0x6'));var voiceQueue=require(_0x92b7('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x92b7('0x8'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x92b7('0x9'));var cmHopperHistory=require(_0x92b7('0xa'));var campaign=require(_0x92b7('0xb'));var voiceExtension=require(_0x92b7('0xc'));var faxAccount=require(_0x92b7('0xd'));var zendesk=require(_0x92b7('0xe'));var salesforce=require(_0x92b7('0xf'));var sugarcrm=require(_0x92b7('0x10'));var freshdesk=require(_0x92b7('0x11'));var desk=require(_0x92b7('0x12'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x92b7('0x13'));var freshsales=require(_0x92b7('0x14'));var servicenow=require(_0x92b7('0x15'));var dynamics365=require(_0x92b7('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x92b7('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x92b7('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x92b7('0x19')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x92b7('0x1a')](user[_0x92b7('0x1b')]())['then'](realtime[_0x92b7('0x1c')]())[_0x92b7('0x1a')](user['getTelephones']())['then'](realtime[_0x92b7('0x1d')]())[_0x92b7('0x1a')](trunk[_0x92b7('0x1e')]())[_0x92b7('0x1a')](realtime[_0x92b7('0x1f')]())[_0x92b7('0x1a')](voiceQueue[_0x92b7('0x20')]())[_0x92b7('0x1a')](realtime[_0x92b7('0x21')]())[_0x92b7('0x1a')](trigger[_0x92b7('0x22')]())['then'](realtime[_0x92b7('0x23')]())[_0x92b7('0x1a')](template[_0x92b7('0x24')]())[_0x92b7('0x1a')](realtime[_0x92b7('0x25')]())[_0x92b7('0x1a')](zendesk[_0x92b7('0x26')]())['then'](realtime['initZendeskAccounts']())[_0x92b7('0x1a')](salesforce[_0x92b7('0x27')]())[_0x92b7('0x1a')](realtime[_0x92b7('0x28')]())['then'](sugarcrm[_0x92b7('0x29')]())[_0x92b7('0x1a')](realtime[_0x92b7('0x2a')]())[_0x92b7('0x1a')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x92b7('0x2b')]())[_0x92b7('0x1a')](desk[_0x92b7('0x2c')]())['then'](realtime['initDeskAccounts']())[_0x92b7('0x1a')](zoho[_0x92b7('0x2d')]())[_0x92b7('0x1a')](realtime[_0x92b7('0x2e')]())[_0x92b7('0x1a')](vtiger['getVtigerAccounts']())[_0x92b7('0x1a')](realtime[_0x92b7('0x2f')]())[_0x92b7('0x1a')](freshsales[_0x92b7('0x30')]())[_0x92b7('0x1a')](realtime[_0x92b7('0x31')]())[_0x92b7('0x1a')](servicenow[_0x92b7('0x32')]())['then'](realtime[_0x92b7('0x33')]())[_0x92b7('0x1a')](dynamics365[_0x92b7('0x34')]())[_0x92b7('0x1a')](realtime['initDynamics365Accounts']())[_0x92b7('0x1a')](campaign['getCampaigns']())[_0x92b7('0x1a')](realtime[_0x92b7('0x35')]())[_0x92b7('0x1a')](voiceExtension[_0x92b7('0x36')]())[_0x92b7('0x1a')](realtime[_0x92b7('0x37')]())[_0x92b7('0x1a')](faxAccount[_0x92b7('0x38')]())[_0x92b7('0x1a')](realtime[_0x92b7('0x39')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x92b7('0x1a')](voiceQueueReport[_0x92b7('0x3a')]())[_0x92b7('0x1a')](realtime[_0x92b7('0x3b')]())[_0x92b7('0x1a')](cmHopperHistory[_0x92b7('0x3c')]())[_0x92b7('0x1a')](realtime[_0x92b7('0x3d')]())[_0x92b7('0x1a')](cmHopperHistory[_0x92b7('0x3e')]())['then'](realtime[_0x92b7('0x3f')]())['then'](voiceCallReport[_0x92b7('0x40')]())['then'](realtime[_0x92b7('0x41')]())['catch'](function(_0x4bd921){logger[_0x92b7('0x42')](_0x92b7('0x43'),util['inspect'](_0x4bd921,{'showHidden':![],'depth':null}));});}function main(){return server[_0x92b7('0x44')](realtime,preview,fax)[_0x92b7('0x1a')](function(_0x588338){return initRealtime();})[_0x92b7('0x1a')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x92b7('0x45')](function(_0x29e240){logger[_0x92b7('0x42')](_0x92b7('0x46'),util['inspect'](_0x29e240,{'showHidden':![],'depth':null}));});}main();
\ No newline at end of file
+var _0x5ead=['getTrunks','initTrunks','initVoiceQueues','initTriggers','getTemplates','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','catch','[index.js][main]','bluebird','util','moment','./server','./trigger','./dialer','./preview','./fax','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','hour','get','then','getAgents','initAgents','getTelephones'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0x5ead,0xeb));var _0xd5ea=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5ead[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0xd5ea('0x0'));var util=require(_0xd5ea('0x1'));var moment=require(_0xd5ea('0x2'));var server=require(_0xd5ea('0x3'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0xd5ea('0x4'));var Dialer=require(_0xd5ea('0x5'));var Preview=require(_0xd5ea('0x6'));var Fax=require(_0xd5ea('0x7'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xd5ea('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0xd5ea('0x9'));var template=require(_0xd5ea('0xa'));var cmHopperHistory=require(_0xd5ea('0xb'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xd5ea('0xc'));var faxAccount=require(_0xd5ea('0xd'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xd5ea('0xe'));var sugarcrm=require(_0xd5ea('0xf'));var freshdesk=require(_0xd5ea('0x10'));var desk=require(_0xd5ea('0x11'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xd5ea('0x12'));var freshsales=require(_0xd5ea('0x13'));var servicenow=require(_0xd5ea('0x14'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xd5ea('0x15'))(_0xd5ea('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xd5ea('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xd5ea('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xd5ea('0x19')](user[_0xd5ea('0x1a')]())[_0xd5ea('0x19')](realtime[_0xd5ea('0x1b')]())[_0xd5ea('0x19')](user[_0xd5ea('0x1c')]())[_0xd5ea('0x19')](realtime['initTelephones']())['then'](trunk[_0xd5ea('0x1d')]())[_0xd5ea('0x19')](realtime[_0xd5ea('0x1e')]())[_0xd5ea('0x19')](voiceQueue['getVoiceQueues']())[_0xd5ea('0x19')](realtime[_0xd5ea('0x1f')]())[_0xd5ea('0x19')](trigger['getTriggers']())[_0xd5ea('0x19')](realtime[_0xd5ea('0x20')]())[_0xd5ea('0x19')](template[_0xd5ea('0x21')]())[_0xd5ea('0x19')](realtime['initTemplates']())[_0xd5ea('0x19')](zendesk['getZendeskAccounts']())['then'](realtime[_0xd5ea('0x22')]())[_0xd5ea('0x19')](salesforce['getSalesforceAccounts']())['then'](realtime[_0xd5ea('0x23')]())['then'](sugarcrm[_0xd5ea('0x24')]())[_0xd5ea('0x19')](realtime[_0xd5ea('0x25')]())['then'](freshdesk[_0xd5ea('0x26')]())[_0xd5ea('0x19')](realtime[_0xd5ea('0x27')]())[_0xd5ea('0x19')](desk[_0xd5ea('0x28')]())[_0xd5ea('0x19')](realtime['initDeskAccounts']())[_0xd5ea('0x19')](zoho[_0xd5ea('0x29')]())['then'](realtime[_0xd5ea('0x2a')]())[_0xd5ea('0x19')](vtiger[_0xd5ea('0x2b')]())[_0xd5ea('0x19')](realtime[_0xd5ea('0x2c')]())['then'](freshsales[_0xd5ea('0x2d')]())[_0xd5ea('0x19')](realtime[_0xd5ea('0x2e')]())['then'](servicenow[_0xd5ea('0x2f')]())['then'](realtime['initServicenowAccounts']())['then'](dynamics365['getDynamics365Accounts']())['then'](realtime[_0xd5ea('0x30')]())['then'](campaign[_0xd5ea('0x31')]())[_0xd5ea('0x19')](realtime['initCampaigns']())['then'](voiceExtension[_0xd5ea('0x32')]())['then'](realtime[_0xd5ea('0x33')]())[_0xd5ea('0x19')](faxAccount[_0xd5ea('0x34')]())[_0xd5ea('0x19')](realtime['initFaxAccounts']())[_0xd5ea('0x19')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xd5ea('0x19')](voiceQueueReport[_0xd5ea('0x35')]())[_0xd5ea('0x19')](realtime[_0xd5ea('0x36')]())[_0xd5ea('0x19')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xd5ea('0x19')](realtime[_0xd5ea('0x37')]())['then'](cmHopperHistory[_0xd5ea('0x38')]())[_0xd5ea('0x19')](realtime[_0xd5ea('0x39')]())['then'](voiceCallReport[_0xd5ea('0x3a')]())[_0xd5ea('0x19')](realtime[_0xd5ea('0x3b')]())['catch'](function(_0x57e5c8){logger[_0xd5ea('0x3c')](_0xd5ea('0x3d'),util[_0xd5ea('0x3e')](_0x57e5c8,{'showHidden':![],'depth':null}));});}function main(){return server[_0xd5ea('0x3f')](realtime,preview,fax)[_0xd5ea('0x19')](function(_0x117fc8){return initRealtime();})['then'](function(){return initParams();})[_0xd5ea('0x19')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xd5ea('0x40')](function(_0x260795){logger['error'](_0xd5ea('0x41'),util[_0xd5ea('0x3e')](_0x260795,{'showHidden':![],'depth':null}));});}main();
\ No newline at end of file
index ea65bab..4df2bca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f8b6c,_0x2bf49a){_0x3f8b6c=_0x3f8b6c-0x0;var _0x8ad953=_0xedd9[_0x3f8b6c];return _0x8ad953;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('0x25')]=Agent;
\ No newline at end of file
+var _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x3303fb,_0x1266dd){var _0x71a686=function(_0x2c7537){while(--_0x2c7537){_0x3303fb['push'](_0x3303fb['shift']());}};_0x71a686(++_0x1266dd);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent;
\ No newline at end of file
index f408a1b..9ab4eaa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8017=['ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated'];(function(_0x213544,_0x44761f){var _0x40cb44=function(_0x260127){while(--_0x260127){_0x213544['push'](_0x213544['shift']());}};_0x40cb44(++_0x44761f);}(_0x8017,0x128));var _0x7801=function(_0x5de214,_0x107e9d){_0x5de214=_0x5de214-0x0;var _0x4df627=_0x8017[_0x5de214];return _0x4df627;};'use strict';function Campaign(_0x460b8e){this['id']=_0x460b8e['id']||0x0;this['name']=_0x460b8e[_0x7801('0x0')]||'';this[_0x7801('0x1')]=_0x460b8e[_0x7801('0x1')]||_0x7801('0x2');this[_0x7801('0x3')]=0x0;this['temp']=0x0;this[_0x7801('0x4')]=0x0;this[_0x7801('0x5')]=0x0;this['message']='';this[_0x7801('0x6')]=!![];this[_0x7801('0x7')]=_0x460b8e[_0x7801('0x7')];this[_0x7801('0x8')]=_0x460b8e['limitCalls'];this['dialTimezone']=_0x460b8e[_0x7801('0x9')]||null;this[_0x7801('0xa')]=_0x460b8e[_0x7801('0xa')]?_0x460b8e[_0x7801('0xa')]:null;this[_0x7801('0xb')]=_0x460b8e[_0x7801('0xb')];this[_0x7801('0xc')]=_0x460b8e['dialOriginateCallerIdNumber'];this[_0x7801('0xd')]=_0x460b8e[_0x7801('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x460b8e[_0x7801('0xe')];this['dialCongestionRetryFrequency']=_0x460b8e[_0x7801('0xf')];this['dialBusyMaxRetry']=_0x460b8e['dialBusyMaxRetry'];this[_0x7801('0x10')]=_0x460b8e['dialBusyRetryFrequency'];this[_0x7801('0x11')]=_0x460b8e[_0x7801('0x11')];this[_0x7801('0x12')]=_0x460b8e['dialNoAnswerRetryFrequency'];this[_0x7801('0x13')]=_0x460b8e[_0x7801('0x13')];this[_0x7801('0x14')]=_0x460b8e[_0x7801('0x14')]||0x3;this[_0x7801('0x15')]=_0x460b8e[_0x7801('0x15')]||0x96;this[_0x7801('0x16')]=_0x460b8e[_0x7801('0x16')]||0x3;this[_0x7801('0x17')]=_0x460b8e[_0x7801('0x17')]||0x96;this[_0x7801('0x18')]=_0x460b8e['dialAbandonedMaxRetry']||0x3;this[_0x7801('0x19')]=_0x460b8e[_0x7801('0x19')]||0x96;this[_0x7801('0x1a')]=_0x460b8e[_0x7801('0x1a')]||0x3;this[_0x7801('0x1b')]=_0x460b8e[_0x7801('0x1b')]||0x96;this[_0x7801('0x1c')]=_0x460b8e['dialAgentRejectMaxRetry']||0x3;this[_0x7801('0x1d')]=_0x460b8e['dialAgentRejectRetryFrequency']||0x96;this[_0x7801('0x1e')]=_0x460b8e[_0x7801('0x1e')]||_0x7801('0x1f');this[_0x7801('0x20')]=_0x460b8e['dialPrefix']||undefined;this[_0x7801('0x21')]=_0x460b8e['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x460b8e[_0x7801('0x22')]||undefined;this[_0x7801('0x23')]=_0x460b8e[_0x7801('0x23')]?_0x460b8e[_0x7801('0x23')]:undefined;this[_0x7801('0x24')]=_0x460b8e['Trunk']?_0x460b8e[_0x7801('0x24')]:undefined;this[_0x7801('0x25')]=_0x460b8e['Interval']?_0x460b8e[_0x7801('0x25')]:undefined;this[_0x7801('0x26')]=_0x460b8e[_0x7801('0x26')]?_0x460b8e[_0x7801('0x26')]:undefined;this[_0x7801('0x27')]=_0x460b8e[_0x7801('0x26')]?_0x460b8e[_0x7801('0x26')][_0x7801('0x0')]:undefined;this[_0x7801('0x28')]=_0x460b8e['dialAMDActive']||![];this[_0x7801('0x29')]=_0x460b8e[_0x7801('0x29')];this['dialAMDGreeting']=_0x460b8e[_0x7801('0x2a')];this[_0x7801('0x2b')]=_0x460b8e[_0x7801('0x2b')];this['dialAMDTotalAnalysisTime']=_0x460b8e[_0x7801('0x2c')];this[_0x7801('0x2d')]=_0x460b8e[_0x7801('0x2d')];this['dialAMDBetweenWordsSilence']=_0x460b8e[_0x7801('0x2e')];this[_0x7801('0x2f')]=_0x460b8e['dialAMDMaximumNumberOfWords'];this[_0x7801('0x30')]=_0x460b8e[_0x7801('0x30')];this[_0x7801('0x31')]=_0x460b8e['dialAMDMaximumWordLength'];}module['exports']=Campaign;
\ No newline at end of file
+var _0x759e=['dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence'];(function(_0x5b0635,_0x509bf1){var _0x502113=function(_0x439bd7){while(--_0x439bd7){_0x5b0635['push'](_0x5b0635['shift']());}};_0x502113(++_0x509bf1);}(_0x759e,0xc2));var _0xe759=function(_0x508ea6,_0x2fb8f0){_0x508ea6=_0x508ea6-0x0;var _0x2382ab=_0x759e[_0x508ea6];return _0x2382ab;};'use strict';function Campaign(_0x402633){this['id']=_0x402633['id']||0x0;this['name']=_0x402633[_0xe759('0x0')]||'';this[_0xe759('0x1')]=_0x402633[_0xe759('0x1')]||'campaign';this[_0xe759('0x2')]=0x0;this[_0xe759('0x3')]=0x0;this[_0xe759('0x4')]=0x0;this[_0xe759('0x5')]=0x0;this['message']='';this[_0xe759('0x6')]=!![];this['active']=_0x402633['active'];this[_0xe759('0x7')]=_0x402633[_0xe759('0x7')];this['dialTimezone']=_0x402633[_0xe759('0x8')]||null;this[_0xe759('0x9')]=_0x402633[_0xe759('0x9')]?_0x402633[_0xe759('0x9')]:null;this[_0xe759('0xa')]=_0x402633['dialOriginateCallerIdName'];this[_0xe759('0xb')]=_0x402633[_0xe759('0xb')];this[_0xe759('0xc')]=_0x402633['dialOriginateTimeout']||0x1e;this[_0xe759('0xd')]=_0x402633[_0xe759('0xd')];this[_0xe759('0xe')]=_0x402633[_0xe759('0xe')];this[_0xe759('0xf')]=_0x402633[_0xe759('0xf')];this[_0xe759('0x10')]=_0x402633[_0xe759('0x10')];this[_0xe759('0x11')]=_0x402633[_0xe759('0x11')];this['dialNoAnswerRetryFrequency']=_0x402633[_0xe759('0x12')];this[_0xe759('0x13')]=_0x402633[_0xe759('0x13')];this['dialNoSuchNumberMaxRetry']=_0x402633['dialNoSuchNumberMaxRetry']||0x3;this[_0xe759('0x14')]=_0x402633[_0xe759('0x14')]||0x96;this[_0xe759('0x15')]=_0x402633[_0xe759('0x15')]||0x3;this[_0xe759('0x16')]=_0x402633[_0xe759('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x402633[_0xe759('0x17')]||0x3;this[_0xe759('0x18')]=_0x402633[_0xe759('0x18')]||0x96;this[_0xe759('0x19')]=_0x402633[_0xe759('0x19')]||0x3;this['dialMachineRetryFrequency']=_0x402633['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x402633[_0xe759('0x1a')]||0x3;this[_0xe759('0x1b')]=_0x402633['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x402633[_0xe759('0x1c')]||_0xe759('0x1d');this[_0xe759('0x1e')]=_0x402633[_0xe759('0x1e')]||undefined;this[_0xe759('0x1f')]=_0x402633[_0xe759('0x1f')]||undefined;this[_0xe759('0x20')]=_0x402633[_0xe759('0x20')]||undefined;this['TrunkBackup']=_0x402633['TrunkBackup']?_0x402633[_0xe759('0x21')]:undefined;this[_0xe759('0x22')]=_0x402633[_0xe759('0x22')]?_0x402633[_0xe759('0x22')]:undefined;this[_0xe759('0x23')]=_0x402633[_0xe759('0x23')]?_0x402633[_0xe759('0x23')]:undefined;this[_0xe759('0x24')]=_0x402633[_0xe759('0x24')]?_0x402633['SquareProject']:undefined;this[_0xe759('0x25')]=_0x402633[_0xe759('0x24')]?_0x402633[_0xe759('0x24')][_0xe759('0x0')]:undefined;this['dialAMDActive']=_0x402633['dialAMDActive']||![];this[_0xe759('0x26')]=_0x402633[_0xe759('0x26')];this[_0xe759('0x27')]=_0x402633[_0xe759('0x27')];this[_0xe759('0x28')]=_0x402633[_0xe759('0x28')];this[_0xe759('0x29')]=_0x402633[_0xe759('0x29')];this[_0xe759('0x2a')]=_0x402633[_0xe759('0x2a')];this[_0xe759('0x2b')]=_0x402633[_0xe759('0x2b')];this[_0xe759('0x2c')]=_0x402633[_0xe759('0x2c')];this[_0xe759('0x2d')]=_0x402633['dialAMDSilenceThreshold'];this[_0xe759('0x2e')]=_0x402633[_0xe759('0x2e')];}module['exports']=Campaign;
\ No newline at end of file
index 07c5661..124956b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a02=['duration','holdtime','type','tag','disposition','monitorFilename','queue','transferconnectedlinenum','transferType','mohtime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata'];(function(_0xcb8b1,_0x282b32){var _0x231a5a=function(_0x498ed6){while(--_0x498ed6){_0xcb8b1['push'](_0xcb8b1['shift']());}};_0x231a5a(++_0x282b32);}(_0x7a02,0x1ba));var _0x27a0=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x7a02[_0x220f3f];return _0x1f170e;};'use strict';function Channel(){this['starttime']=null;this[_0x27a0('0x0')]='';this[_0x27a0('0x1')]='';this[_0x27a0('0x2')]=0x0;this[_0x27a0('0x3')]='';this[_0x27a0('0x4')]=undefined;this['connectedlinename']=undefined;this[_0x27a0('0x5')]=0x0;this[_0x27a0('0x6')]='';this[_0x27a0('0x7')]=0x0;this[_0x27a0('0x8')]=0x0;this[_0x27a0('0x9')]=0x0;this[_0x27a0('0xa')]=![];this[_0x27a0('0xb')]=null;this[_0x27a0('0xc')]=null;this[_0x27a0('0xd')]=![];this[_0x27a0('0xe')]=![];this[_0x27a0('0xf')]='';this[_0x27a0('0x10')]='';this[_0x27a0('0x11')]=0x0;this['billableseconds']=0x0;this[_0x27a0('0x12')]=0x0;this[_0x27a0('0x13')]=null;this[_0x27a0('0x14')]=null;this[_0x27a0('0x15')]=null;this['monitor']=![];this[_0x27a0('0x16')]=null;this[_0x27a0('0x17')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0x27a0('0x18')]=undefined;this[_0x27a0('0x19')]=undefined;this[_0x27a0('0x1a')]=0x0;}module['exports']=Channel;
\ No newline at end of file
+var _0x8969=['monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','answertime','endtime','unmanaged','lastapplication','lastdata','duration','holdtime','type','disposition'];(function(_0x40f9a0,_0x3458cc){var _0x3e3144=function(_0x1f8fce){while(--_0x1f8fce){_0x40f9a0['push'](_0x40f9a0['shift']());}};_0x3e3144(++_0x3458cc);}(_0x8969,0x130));var _0x9896=function(_0x3a47a1,_0x31cd8b){_0x3a47a1=_0x3a47a1-0x0;var _0x234c6c=_0x8969[_0x3a47a1];return _0x234c6c;};'use strict';function Channel(){this[_0x9896('0x0')]=null;this['channel']='';this[_0x9896('0x1')]='';this[_0x9896('0x2')]=0x0;this[_0x9896('0x3')]='';this[_0x9896('0x4')]=undefined;this[_0x9896('0x5')]=undefined;this[_0x9896('0x6')]=0x0;this[_0x9896('0x7')]='';this['uniqueid']=0x0;this[_0x9896('0x8')]=0x0;this['exten']=0x0;this['answered']=![];this[_0x9896('0x9')]=null;this[_0x9896('0xa')]=null;this[_0x9896('0xb')]=![];this['abandoned']=![];this[_0x9896('0xc')]='';this[_0x9896('0xd')]='';this[_0x9896('0xe')]=0x0;this['billableseconds']=0x0;this[_0x9896('0xf')]=0x0;this[_0x9896('0x10')]=null;this['tag']=null;this[_0x9896('0x11')]=null;this[_0x9896('0x12')]=![];this['monitorFilename']=null;this[_0x9896('0x13')]=null;this[_0x9896('0x14')]=[];this[_0x9896('0x15')]=undefined;this[_0x9896('0x16')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module['exports']=Channel;
\ No newline at end of file
index dc8b296..12f347f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8a8d=['serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x8a8d,0x183));var _0xd8a8=function(_0x1706b2,_0x502b1b){_0x1706b2=_0x1706b2-0x0;var _0x3a9be3=_0x8a8d[_0x1706b2];return _0x3a9be3;};'use strict';function DeskAccount(_0x4ae52e){this['id']=_0x4ae52e['id']||0x0;this[_0xd8a8('0x0')]=_0x4ae52e[_0xd8a8('0x0')]||'';this['username']=_0x4ae52e['username']||'';this[_0xd8a8('0x1')]=_0x4ae52e[_0xd8a8('0x1')]||'';this[_0xd8a8('0x2')]=_0x4ae52e['authType']||'';this[_0xd8a8('0x3')]=_0x4ae52e['password']||'';this[_0xd8a8('0x4')]=_0x4ae52e[_0xd8a8('0x4')]||'';this[_0xd8a8('0x5')]=_0x4ae52e['consumerSecret']||'';this[_0xd8a8('0x6')]=_0x4ae52e['token']||'';this[_0xd8a8('0x7')]=_0x4ae52e['tokenSecret']||'';this[_0xd8a8('0x8')]=_0x4ae52e[_0xd8a8('0x8')]||'';this['serverUrl']=_0x4ae52e[_0xd8a8('0x9')]||'';this[_0xd8a8('0xa')]=_0x4ae52e['Configurations']||{};}module[_0xd8a8('0xb')]=DeskAccount;
\ No newline at end of file
+var _0x346d=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0xf0609f,_0x73e34d){var _0x4e5791=function(_0x24979b){while(--_0x24979b){_0xf0609f['push'](_0xf0609f['shift']());}};_0x4e5791(++_0x73e34d);}(_0x346d,0xa4));var _0xd346=function(_0x36ca99,_0x1416c6){_0x36ca99=_0x36ca99-0x0;var _0x1d7cba=_0x346d[_0x36ca99];return _0x1d7cba;};'use strict';function DeskAccount(_0x1f4288){this['id']=_0x1f4288['id']||0x0;this[_0xd346('0x0')]=_0x1f4288[_0xd346('0x0')]||'';this[_0xd346('0x1')]=_0x1f4288[_0xd346('0x1')]||'';this[_0xd346('0x2')]=_0x1f4288[_0xd346('0x2')]||'';this['authType']=_0x1f4288[_0xd346('0x3')]||'';this[_0xd346('0x4')]=_0x1f4288[_0xd346('0x4')]||'';this[_0xd346('0x5')]=_0x1f4288['consumerKey']||'';this[_0xd346('0x6')]=_0x1f4288[_0xd346('0x6')]||'';this[_0xd346('0x7')]=_0x1f4288[_0xd346('0x7')]||'';this[_0xd346('0x8')]=_0x1f4288[_0xd346('0x8')]||'';this['type']=_0x1f4288[_0xd346('0x9')]||'';this[_0xd346('0xa')]=_0x1f4288[_0xd346('0xa')]||'';this[_0xd346('0xb')]=_0x1f4288[_0xd346('0xb')]||{};}module[_0xd346('0xc')]=DeskAccount;
\ No newline at end of file
index e8d6bdf..5e68279 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7f3a=['clientSecret','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f3a,0x1db));var _0xa7f3=function(_0x4b0625,_0x884bcc){_0x4b0625=_0x4b0625-0x0;var _0x269dd5=_0x7f3a[_0x4b0625];return _0x269dd5;};'use strict';function Dynamics365Account(_0x531396){this['id']=_0x531396['id']||0x0;this[_0xa7f3('0x0')]=_0x531396[_0xa7f3('0x0')]||'';this['username']=_0x531396[_0xa7f3('0x1')]||'';this[_0xa7f3('0x2')]=_0x531396[_0xa7f3('0x2')]||'';this[_0xa7f3('0x3')]=_0x531396[_0xa7f3('0x3')]||'';this[_0xa7f3('0x4')]=_0x531396[_0xa7f3('0x4')]||'';this['clientId']=_0x531396['clientId']||'';this[_0xa7f3('0x5')]=_0x531396[_0xa7f3('0x5')]||{};this['serverUrl']=_0x531396['serverUrl']||'';this['modernAuthentication']=_0x531396[_0xa7f3('0x6')]||![];this[_0xa7f3('0x7')]=_0x531396[_0xa7f3('0x7')]||{};this[_0xa7f3('0x8')]=_0x531396[_0xa7f3('0x8')]||{};}module[_0xa7f3('0x9')]=Dynamics365Account;
\ No newline at end of file
+var _0x7988=['Configurations','CloudProvider','exports','name','username','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication'];(function(_0x138fb9,_0x6dc0a9){var _0x1f1b83=function(_0x25e057){while(--_0x25e057){_0x138fb9['push'](_0x138fb9['shift']());}};_0x1f1b83(++_0x6dc0a9);}(_0x7988,0x92));var _0x8798=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0x7988[_0x2caaef];return _0xd011f8;};'use strict';function Dynamics365Account(_0x148e9e){this['id']=_0x148e9e['id']||0x0;this[_0x8798('0x0')]=_0x148e9e[_0x8798('0x0')]||'';this[_0x8798('0x1')]=_0x148e9e[_0x8798('0x1')]||'';this['password']=_0x148e9e['password']||'';this[_0x8798('0x2')]=_0x148e9e[_0x8798('0x2')]||'';this[_0x8798('0x3')]=_0x148e9e[_0x8798('0x3')]||'';this['clientId']=_0x148e9e[_0x8798('0x4')]||'';this[_0x8798('0x5')]=_0x148e9e[_0x8798('0x5')]||{};this[_0x8798('0x6')]=_0x148e9e[_0x8798('0x6')]||'';this[_0x8798('0x7')]=_0x148e9e['modernAuthentication']||![];this[_0x8798('0x8')]=_0x148e9e[_0x8798('0x8')]||{};this[_0x8798('0x9')]=_0x148e9e['CloudProvider']||{};}module[_0x8798('0xa')]=Dynamics365Account;
\ No newline at end of file
index 0180b04..a5bb332 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2026=['maxrate','modem','v17,v27,v29','gateway','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid'];(function(_0x5499d9,_0x1abd4f){var _0x52054c=function(_0x2205bc){while(--_0x2205bc){_0x5499d9['push'](_0x5499d9['shift']());}};_0x52054c(++_0x1abd4f);}(_0x2026,0xfb));var _0x6202=function(_0x346318,_0x2cabc6){_0x346318=_0x346318-0x0;var _0x36836e=_0x2026[_0x346318];return _0x36836e;};'use strict';function FaxAccount(_0x171083){this['id']=_0x171083['id']||0x0;this[_0x6202('0x0')]=_0x171083[_0x6202('0x0')]||'';this['description']=_0x171083[_0x6202('0x1')];this[_0x6202('0x2')]=_0x171083[_0x6202('0x2')];this['headerinfo']=_0x171083[_0x6202('0x3')];this[_0x6202('0x4')]=_0x171083['localstationid'];this['minrate']=_0x171083['minrate']||0x960;this[_0x6202('0x5')]=_0x171083['maxrate']||0x3840;this[_0x6202('0x6')]=_0x171083[_0x6202('0x6')]||_0x6202('0x7');this[_0x6202('0x8')]=_0x171083[_0x6202('0x8')]||'no';this['faxdetect']=_0x171083['faxdetect']||'no';this[_0x6202('0x9')]=_0x171083['t38timeout']||0x1388;this[_0x6202('0xa')]=_0x171083[_0x6202('0xa')]||_0x6202('0xb');this['Trunk']=_0x171083[_0x6202('0xc')]?_0x171083[_0x6202('0xc')]:undefined;this[_0x6202('0xd')]=_0x171083[_0x6202('0xd')];this[_0x6202('0xe')]=_0x171083[_0x6202('0xe')];}module[_0x6202('0xf')]=FaxAccount;
\ No newline at end of file
+var _0x1390=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','key','name','description'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0x1390,0x7e));var _0x0139=function(_0x4dc6a9,_0x4730c2){_0x4dc6a9=_0x4dc6a9-0x0;var _0x58758e=_0x1390[_0x4dc6a9];return _0x58758e;};'use strict';function FaxAccount(_0x560126){this['id']=_0x560126['id']||0x0;this[_0x0139('0x0')]=_0x560126[_0x0139('0x0')]||'';this[_0x0139('0x1')]=_0x560126['description'];this[_0x0139('0x2')]=_0x560126['ecm'];this[_0x0139('0x3')]=_0x560126[_0x0139('0x3')];this[_0x0139('0x4')]=_0x560126[_0x0139('0x4')];this['minrate']=_0x560126[_0x0139('0x5')]||0x960;this[_0x0139('0x6')]=_0x560126[_0x0139('0x6')]||0x3840;this[_0x0139('0x7')]=_0x560126[_0x0139('0x7')]||_0x0139('0x8');this['gateway']=_0x560126[_0x0139('0x9')]||'no';this['faxdetect']=_0x560126[_0x0139('0xa')]||'no';this[_0x0139('0xb')]=_0x560126['t38timeout']||0x1388;this['tech']=_0x560126[_0x0139('0xc')]||_0x0139('0xd');this[_0x0139('0xe')]=_0x560126['Trunk']?_0x560126[_0x0139('0xe')]:undefined;this['ListId']=_0x560126['ListId'];this[_0x0139('0xf')]=_0x560126[_0x0139('0xf')];}module['exports']=FaxAccount;
\ No newline at end of file
index 873770d..f84e0a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe406=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x372931,_0x2e21ea){var _0x1353c0=function(_0x3bfc57){while(--_0x3bfc57){_0x372931['push'](_0x372931['shift']());}};_0x1353c0(++_0x2e21ea);}(_0xe406,0x16d));var _0x6e40=function(_0x12984d,_0x1ab607){_0x12984d=_0x12984d-0x0;var _0x2b156f=_0xe406[_0x12984d];return _0x2b156f;};'use strict';function FreshdeskAccount(_0x2e50c8){this['id']=_0x2e50c8['id']||0x0;this[_0x6e40('0x0')]=_0x2e50c8[_0x6e40('0x0')]||'';this[_0x6e40('0x1')]=_0x2e50c8['username']||'';this[_0x6e40('0x2')]=_0x2e50c8[_0x6e40('0x3')]||'';this[_0x6e40('0x4')]=_0x2e50c8[_0x6e40('0x4')]||'';this['serverUrl']=_0x2e50c8[_0x6e40('0x5')]||'';this[_0x6e40('0x6')]=_0x2e50c8[_0x6e40('0x6')]||{};}module[_0x6e40('0x7')]=FreshdeskAccount;
\ No newline at end of file
+var _0x5147=['apiKey','token','remoteUri','serverUrl','Configurations','exports','username'];(function(_0xf2aa5a,_0x236702){var _0x438f97=function(_0x268691){while(--_0x268691){_0xf2aa5a['push'](_0xf2aa5a['shift']());}};_0x438f97(++_0x236702);}(_0x5147,0xae));var _0x7514=function(_0x1995ce,_0x23e51c){_0x1995ce=_0x1995ce-0x0;var _0x28c3ba=_0x5147[_0x1995ce];return _0x28c3ba;};'use strict';function FreshdeskAccount(_0x1b19cb){this['id']=_0x1b19cb['id']||0x0;this['name']=_0x1b19cb['name']||'';this[_0x7514('0x0')]=_0x1b19cb[_0x7514('0x0')]||'';this[_0x7514('0x1')]=_0x1b19cb[_0x7514('0x2')]||'';this['remoteUri']=_0x1b19cb[_0x7514('0x3')]||'';this[_0x7514('0x4')]=_0x1b19cb[_0x7514('0x4')]||'';this[_0x7514('0x5')]=_0x1b19cb[_0x7514('0x5')]||{};}module[_0x7514('0x6')]=FreshdeskAccount;
\ No newline at end of file
index 10cacbb..c32530f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe49a=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1de43c,_0xaa29de){var _0x296d3e=function(_0x50b76f){while(--_0x50b76f){_0x1de43c['push'](_0x1de43c['shift']());}};_0x296d3e(++_0xaa29de);}(_0xe49a,0xd7));var _0xae49=function(_0x2f49df,_0x518919){_0x2f49df=_0x2f49df-0x0;var _0x1ec090=_0xe49a[_0x2f49df];return _0x1ec090;};'use strict';function FreshsalesAccount(_0x5a2668){this['id']=_0x5a2668['id']||0x0;this[_0xae49('0x0')]=_0x5a2668[_0xae49('0x0')]||'';this[_0xae49('0x1')]=_0x5a2668[_0xae49('0x1')]||'';this[_0xae49('0x2')]=_0x5a2668[_0xae49('0x3')]||'';this[_0xae49('0x4')]=_0x5a2668['remoteUri']||'';this[_0xae49('0x5')]=_0x5a2668[_0xae49('0x5')]||'';this[_0xae49('0x6')]=_0x5a2668['Configurations']||{};}module[_0xae49('0x7')]=FreshsalesAccount;
\ No newline at end of file
+var _0x5bd7=['apiKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0xed6261,_0x1f0ee2){var _0x4de7a5=function(_0x2783d6){while(--_0x2783d6){_0xed6261['push'](_0xed6261['shift']());}};_0x4de7a5(++_0x1f0ee2);}(_0x5bd7,0x12a));var _0x75bd=function(_0x79e316,_0x38e778){_0x79e316=_0x79e316-0x0;var _0xb8b436=_0x5bd7[_0x79e316];return _0xb8b436;};'use strict';function FreshsalesAccount(_0x8ef36f){this['id']=_0x8ef36f['id']||0x0;this[_0x75bd('0x0')]=_0x8ef36f[_0x75bd('0x0')]||'';this[_0x75bd('0x1')]=_0x8ef36f['username']||'';this[_0x75bd('0x2')]=_0x8ef36f['token']||'';this[_0x75bd('0x3')]=_0x8ef36f[_0x75bd('0x3')]||'';this['serverUrl']=_0x8ef36f[_0x75bd('0x4')]||'';this[_0x75bd('0x5')]=_0x8ef36f[_0x75bd('0x5')]||{};}module['exports']=FreshsalesAccount;
\ No newline at end of file
index bd9a409..a862037 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbc0f=['accountcode','exten','holdtime','assigned','motionChannel','voice','variables','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum'];(function(_0x3f58de,_0x3810d8){var _0x1a317a=function(_0x16a43f){while(--_0x16a43f){_0x3f58de['push'](_0x3f58de['shift']());}};_0x1a317a(++_0x3810d8);}(_0xbc0f,0x16f));var _0xfbc0=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xbc0f[_0x5f09c5];return _0x426ad9;};'use strict';function QueueReport(){this[_0xfbc0('0x0')]=_0xfbc0('0x1');this[_0xfbc0('0x2')]='';this['calleridnum']='';this[_0xfbc0('0x3')]='';this[_0xfbc0('0x4')]='';this[_0xfbc0('0x5')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this['count']=0x1;this[_0xfbc0('0x6')]=![];this[_0xfbc0('0x7')]=null;this['queuecallercomplete']=![];this[_0xfbc0('0x8')]=null;this['queuecallerexit']=![];this[_0xfbc0('0x9')]=null;this[_0xfbc0('0xa')]=0x1;this[_0xfbc0('0xb')]='';this[_0xfbc0('0xc')]='';this['connectedlinename']='';this[_0xfbc0('0xd')]='';this['context']='';this[_0xfbc0('0xe')]='';this['priority']='';this[_0xfbc0('0xf')]=0x0;this[_0xfbc0('0x10')]=![];this['lastAssignedTo']='';this[_0xfbc0('0x11')]=_0xfbc0('0x12');this['mohtime']=0x0;this[_0xfbc0('0x13')]={};}module['exports']=QueueReport;
\ No newline at end of file
+var _0x11b7=['queuecallerabandon','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','accountcode','context','exten','priority','holdtime','lastAssignedTo','motionChannel','variables','exports','type','uniqueid','queue','queuecallerleaveAt','position','count'];(function(_0xc3b793,_0x1d43c5){var _0x2bfee7=function(_0x4f9aeb){while(--_0x4f9aeb){_0xc3b793['push'](_0xc3b793['shift']());}};_0x2bfee7(++_0x1d43c5);}(_0x11b7,0x135));var _0x711b=function(_0x282dc3,_0x43256d){_0x282dc3=_0x282dc3-0x0;var _0x3b3305=_0x11b7[_0x282dc3];return _0x3b3305;};'use strict';function QueueReport(){this[_0x711b('0x0')]='inbound';this[_0x711b('0x1')]='';this['calleridnum']='';this['calleridname']='';this[_0x711b('0x2')]='';this['queuecallerjoinAt']=null;this[_0x711b('0x3')]=null;this[_0x711b('0x4')]=0x1;this[_0x711b('0x5')]=0x1;this[_0x711b('0x6')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x711b('0x7')]=null;this['queuecallerexit']=![];this[_0x711b('0x8')]=null;this[_0x711b('0x9')]=0x1;this[_0x711b('0xa')]='';this[_0x711b('0xb')]='';this['connectedlinename']='';this[_0x711b('0xc')]='';this[_0x711b('0xd')]='';this[_0x711b('0xe')]='';this[_0x711b('0xf')]='';this[_0x711b('0x10')]=0x0;this['assigned']=![];this[_0x711b('0x11')]='';this[_0x711b('0x12')]='voice';this['mohtime']=0x0;this[_0x711b('0x13')]={};}module[_0x711b('0x14')]=QueueReport;
\ No newline at end of file
index 9c7cee2..001c130 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb01a=['Configurations','exports','username','remoteUri','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0xb2ce11,_0x15d04a){var _0x286fd0=function(_0x170086){while(--_0x170086){_0xb2ce11['push'](_0xb2ce11['shift']());}};_0x286fd0(++_0x15d04a);}(_0xb01a,0x124));var _0xab01=function(_0x677920,_0x1e3e6a){_0x677920=_0x677920-0x0;var _0x1c593b=_0xb01a[_0x677920];return _0x1c593b;};'use strict';function SalesforceAccount(_0x4b59b5){this['id']=_0x4b59b5['id']||0x0;this['name']=_0x4b59b5['name']||'';this[_0xab01('0x0')]=_0x4b59b5[_0xab01('0x0')]||'';this['remoteUri']=_0x4b59b5[_0xab01('0x1')]||'';this['password']=_0x4b59b5['password']||'';this[_0xab01('0x2')]=_0x4b59b5['clientId']||'';this[_0xab01('0x3')]=_0x4b59b5[_0xab01('0x3')]||'';this[_0xab01('0x4')]=_0x4b59b5[_0xab01('0x4')]||'';this[_0xab01('0x5')]=_0x4b59b5[_0xab01('0x5')]||_0xab01('0x6');this[_0xab01('0x7')]=_0x4b59b5['serverUrl']||'';this[_0xab01('0x8')]=_0x4b59b5[_0xab01('0x8')]||{};}module[_0xab01('0x9')]=SalesforceAccount;
\ No newline at end of file
+var _0x64bc=['password','clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x14b87e,_0x52655a){var _0x272f13=function(_0x18f669){while(--_0x18f669){_0x14b87e['push'](_0x14b87e['shift']());}};_0x272f13(++_0x52655a);}(_0x64bc,0x16f));var _0xc64b=function(_0x490eba,_0x518ea9){_0x490eba=_0x490eba-0x0;var _0x37ac7b=_0x64bc[_0x490eba];return _0x37ac7b;};'use strict';function SalesforceAccount(_0xb532d7){this['id']=_0xb532d7['id']||0x0;this[_0xc64b('0x0')]=_0xb532d7['name']||'';this[_0xc64b('0x1')]=_0xb532d7[_0xc64b('0x1')]||'';this['remoteUri']=_0xb532d7[_0xc64b('0x2')]||'';this[_0xc64b('0x3')]=_0xb532d7[_0xc64b('0x3')]||'';this['clientId']=_0xb532d7['clientId']||'';this[_0xc64b('0x4')]=_0xb532d7[_0xc64b('0x4')]||'';this[_0xc64b('0x5')]=_0xb532d7['securityToken']||'';this[_0xc64b('0x6')]=_0xb532d7['type']||'integrationTab';this['serverUrl']=_0xb532d7[_0xc64b('0x7')]||'';this[_0xc64b('0x8')]=_0xb532d7[_0xc64b('0x8')]||{};}module[_0xc64b('0x9')]=SalesforceAccount;
\ No newline at end of file
index b14cecd..4fbf6cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc705=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x323e3b,_0x47e32e){var _0x8bbd1=function(_0x47979f){while(--_0x47979f){_0x323e3b['push'](_0x323e3b['shift']());}};_0x8bbd1(++_0x47e32e);}(_0xc705,0x88));var _0x5c70=function(_0x3e478c,_0x152670){_0x3e478c=_0x3e478c-0x0;var _0x29ef89=_0xc705[_0x3e478c];return _0x29ef89;};'use strict';function ServicenowAccount(_0x29fec8){this['id']=_0x29fec8['id']||0x0;this[_0x5c70('0x0')]=_0x29fec8[_0x5c70('0x0')]||'';this[_0x5c70('0x1')]=_0x29fec8[_0x5c70('0x1')]||'';this[_0x5c70('0x2')]=_0x29fec8[_0x5c70('0x2')]||'';this[_0x5c70('0x3')]=_0x29fec8[_0x5c70('0x3')]||'';this[_0x5c70('0x4')]=_0x29fec8['serverUrl']||'';this[_0x5c70('0x5')]=_0x29fec8['Configurations']||{};}module[_0x5c70('0x6')]=ServicenowAccount;
\ No newline at end of file
+var _0xae33=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x5cf63f,_0x3ce54f){var _0x33c478=function(_0x3a0a1e){while(--_0x3a0a1e){_0x5cf63f['push'](_0x5cf63f['shift']());}};_0x33c478(++_0x3ce54f);}(_0xae33,0x9f));var _0x3ae3=function(_0xd783ea,_0x2dce1c){_0xd783ea=_0xd783ea-0x0;var _0x4caacb=_0xae33[_0xd783ea];return _0x4caacb;};'use strict';function ServicenowAccount(_0x3bd5fb){this['id']=_0x3bd5fb['id']||0x0;this['name']=_0x3bd5fb[_0x3ae3('0x0')]||'';this['username']=_0x3bd5fb[_0x3ae3('0x1')]||'';this[_0x3ae3('0x2')]=_0x3bd5fb[_0x3ae3('0x2')]||'';this[_0x3ae3('0x3')]=_0x3bd5fb[_0x3ae3('0x3')]||'';this[_0x3ae3('0x4')]=_0x3bd5fb['serverUrl']||'';this[_0x3ae3('0x5')]=_0x3bd5fb[_0x3ae3('0x5')]||{};}module[_0x3ae3('0x6')]=ServicenowAccount;
\ No newline at end of file
index 38cac93..5c07884 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbade=['Configurations','exports','name','username','password','serverUrl'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbade,0xa4));var _0xebad=function(_0x148c09,_0x4fd39f){_0x148c09=_0x148c09-0x0;var _0x18e613=_0xbade[_0x148c09];return _0x18e613;};'use strict';function SugarcrmAccount(_0x1c53e7){this['id']=_0x1c53e7['id']||0x0;this[_0xebad('0x0')]=_0x1c53e7[_0xebad('0x0')]||'';this[_0xebad('0x1')]=_0x1c53e7[_0xebad('0x1')]||'';this['password']=_0x1c53e7[_0xebad('0x2')]||'';this['remoteUri']=_0x1c53e7['remoteUri']||'';this[_0xebad('0x3')]=_0x1c53e7[_0xebad('0x3')]||'';this[_0xebad('0x4')]=_0x1c53e7[_0xebad('0x4')]||{};}module[_0xebad('0x5')]=SugarcrmAccount;
\ No newline at end of file
+var _0x7021=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x37a4d1,_0x537bda){var _0x11cc8c=function(_0x3a3307){while(--_0x3a3307){_0x37a4d1['push'](_0x37a4d1['shift']());}};_0x11cc8c(++_0x537bda);}(_0x7021,0x136));var _0x1702=function(_0x9e1faa,_0x425b76){_0x9e1faa=_0x9e1faa-0x0;var _0xdc2c21=_0x7021[_0x9e1faa];return _0xdc2c21;};'use strict';function SugarcrmAccount(_0x4e9e3e){this['id']=_0x4e9e3e['id']||0x0;this['name']=_0x4e9e3e[_0x1702('0x0')]||'';this[_0x1702('0x1')]=_0x4e9e3e[_0x1702('0x1')]||'';this[_0x1702('0x2')]=_0x4e9e3e[_0x1702('0x2')]||'';this[_0x1702('0x3')]=_0x4e9e3e[_0x1702('0x3')]||'';this[_0x1702('0x4')]=_0x4e9e3e['serverUrl']||'';this['Configurations']=_0x4e9e3e[_0x1702('0x5')]||{};}module[_0x1702('0x6')]=SugarcrmAccount;
\ No newline at end of file
index f41a79d..f5d353c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3aa2=['name','accountcode','unknown','stateTime','exports'];(function(_0x97530,_0x2c41f3){var _0x2daca5=function(_0x387a39){while(--_0x387a39){_0x97530['push'](_0x97530['shift']());}};_0x2daca5(++_0x2c41f3);}(_0x3aa2,0x13b));var _0x23aa=function(_0x542f45,_0x37468a){_0x542f45=_0x542f45-0x0;var _0x38c609=_0x3aa2[_0x542f45];return _0x38c609;};'use strict';function Telephone(_0x298239){this['id']=_0x298239['id']||0x0;this[_0x23aa('0x0')]=_0x298239['name']||'';this[_0x23aa('0x1')]=_0x298239['accountcode']||'';this['state']=_0x23aa('0x2');this[_0x23aa('0x3')]=0x0;this['status']=_0x23aa('0x2');this['address']='';}module[_0x23aa('0x4')]=Telephone;
\ No newline at end of file
+var _0x49aa=['name','accountcode','state','unknown','stateTime','status','exports'];(function(_0x18dd23,_0x1ca58d){var _0x22eb36=function(_0x48be88){while(--_0x48be88){_0x18dd23['push'](_0x18dd23['shift']());}};_0x22eb36(++_0x1ca58d);}(_0x49aa,0x173));var _0xa49a=function(_0x57e83f,_0x36ceef){_0x57e83f=_0x57e83f-0x0;var _0x18e5c7=_0x49aa[_0x57e83f];return _0x18e5c7;};'use strict';function Telephone(_0x13988e){this['id']=_0x13988e['id']||0x0;this[_0xa49a('0x0')]=_0x13988e[_0xa49a('0x0')]||'';this['accountcode']=_0x13988e[_0xa49a('0x1')]||'';this[_0xa49a('0x2')]=_0xa49a('0x3');this[_0xa49a('0x4')]=0x0;this[_0xa49a('0x5')]=_0xa49a('0x3');this['address']='';}module[_0xa49a('0x6')]=Telephone;
\ No newline at end of file
index 264b9fc..1a269e7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['name','html'];(function(_0x54c013,_0x50528d){var _0x67c0ad=function(_0x1bb211){while(--_0x1bb211){_0x54c013['push'](_0x54c013['shift']());}};_0x67c0ad(++_0x50528d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3732e1,_0x304dc1){_0x3732e1=_0x3732e1-0x0;var _0x51e120=_0xb10b[_0x3732e1];return _0x51e120;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template;
\ No newline at end of file
+var _0xa9e0=['exports','name'];(function(_0x20bb65,_0x4562d){var _0x52a6e2=function(_0x386a51){while(--_0x386a51){_0x20bb65['push'](_0x20bb65['shift']());}};_0x52a6e2(++_0x4562d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template;
\ No newline at end of file
index 47347fe..116656c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x199b03,_0x43572c){var _0x34e426=function(_0x297ae0){while(--_0x297ae0){_0x199b03['push'](_0x199b03['shift']());}};_0x34e426(++_0x43572c);}(_0xda3f,0xec));var _0xfda3=function(_0xff7a9c,_0x12f1d4){_0xff7a9c=_0xff7a9c-0x0;var _0x1ecd8b=_0xda3f[_0xff7a9c];return _0x1ecd8b;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger;
\ No newline at end of file
+var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger;
\ No newline at end of file
index 6c4c207..3b4d91b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xef8a=['active','name','state','unknown','stateTime','status','registry','indexOf','host','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser'];(function(_0x49192e,_0x4739a3){var _0x4ba592=function(_0x38072b){while(--_0x38072b){_0x49192e['push'](_0x49192e['shift']());}};_0x4ba592(++_0x4739a3);}(_0xef8a,0xa0));var _0xaef8=function(_0x1c6089,_0x3816e2){_0x1c6089=_0x1c6089-0x0;var _0x4d97c1=_0xef8a[_0x1c6089];return _0x4d97c1;};'use strict';function Trunk(_0x41f193){this['id']=_0x41f193['id']||0x0;this['active']=_0x41f193[_0xaef8('0x0')]||![];this[_0xaef8('0x1')]=_0x41f193['name']||'';this[_0xaef8('0x2')]=_0xaef8('0x3');this[_0xaef8('0x4')]=0x0;this[_0xaef8('0x5')]='unknown';this[_0xaef8('0x6')]=_0x41f193[_0xaef8('0x6')]&&_0x41f193[_0xaef8('0x6')][_0xaef8('0x7')](':')?_0x41f193[_0xaef8('0x6')]['split'](':')[0x0]:'';this[_0xaef8('0x8')]='';this['port']='';this[_0xaef8('0x9')]='';this[_0xaef8('0xa')]='';this[_0xaef8('0xb')]='';this[_0xaef8('0xc')]=_0xaef8('0x3');this[_0xaef8('0xd')]='';this[_0xaef8('0xe')]='';this[_0xaef8('0xf')]=_0x41f193['defaultuser']||'';}module['exports']=Trunk;
\ No newline at end of file
+var _0xa50b=['active','name','unknown','stateTime','registry','split','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports'];(function(_0x581478,_0x5812d2){var _0x1dc36a=function(_0x5a6bb6){while(--_0x5a6bb6){_0x581478['push'](_0x581478['shift']());}};_0x1dc36a(++_0x5812d2);}(_0xa50b,0xf0));var _0xba50=function(_0x33a79a,_0x35937a){_0x33a79a=_0x33a79a-0x0;var _0xac24e5=_0xa50b[_0x33a79a];return _0xac24e5;};'use strict';function Trunk(_0x240487){this['id']=_0x240487['id']||0x0;this['active']=_0x240487[_0xba50('0x0')]||![];this['name']=_0x240487[_0xba50('0x1')]||'';this['state']=_0xba50('0x2');this[_0xba50('0x3')]=0x0;this['status']=_0xba50('0x2');this[_0xba50('0x4')]=_0x240487[_0xba50('0x4')]&&_0x240487[_0xba50('0x4')]['indexOf'](':')?_0x240487[_0xba50('0x4')][_0xba50('0x5')](':')[0x0]:'';this['host']='';this[_0xba50('0x6')]='';this[_0xba50('0x7')]='';this[_0xba50('0x8')]='';this[_0xba50('0x9')]='';this[_0xba50('0xa')]=_0xba50('0x2');this[_0xba50('0xb')]='';this[_0xba50('0xc')]='';this[_0xba50('0xd')]=_0x240487[_0xba50('0xd')]||'';}module[_0xba50('0xe')]=Trunk;
\ No newline at end of file
index db6b8e9..cc6d9b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ee5=['mandatoryDisposition','recordingFormat','none'];(function(_0x45a897,_0x4a51c7){var _0x2808bd=function(_0xb9fdc3){while(--_0xb9fdc3){_0x45a897['push'](_0x45a897['shift']());}};_0x2808bd(++_0x4a51c7);}(_0x1ee5,0x1ba));var _0x51ee=function(_0x42d346,_0x1900b6){_0x42d346=_0x42d346-0x0;var _0x5be7cb=_0x1ee5[_0x42d346];return _0x5be7cb;};'use strict';function voiceExtension(_0x37bd4c){this['id']=_0x37bd4c['id']||0x0;this['exten']=_0x37bd4c['exten']||'';this[_0x51ee('0x0')]=_0x37bd4c['recordingFormat']||_0x51ee('0x1');this[_0x51ee('0x2')]=_0x37bd4c[_0x51ee('0x2')]||![];}module['exports']=voiceExtension;
\ No newline at end of file
+var _0x8eb4=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x23a17d,_0x250c33){var _0x2726bd=function(_0xa58d7a){while(--_0xa58d7a){_0x23a17d['push'](_0x23a17d['shift']());}};_0x2726bd(++_0x250c33);}(_0x8eb4,0x18a));var _0x48eb=function(_0xe5b349,_0x5f06e4){_0xe5b349=_0xe5b349-0x0;var _0x26b0ad=_0x8eb4[_0xe5b349];return _0x26b0ad;};'use strict';function voiceExtension(_0xa96a5d){this['id']=_0xa96a5d['id']||0x0;this[_0x48eb('0x0')]=_0xa96a5d[_0x48eb('0x0')]||'';this[_0x48eb('0x1')]=_0xa96a5d[_0x48eb('0x1')]||_0x48eb('0x2');this[_0x48eb('0x3')]=_0xa96a5d[_0x48eb('0x3')]||![];}module[_0x48eb('0x4')]=voiceExtension;
\ No newline at end of file
index aff571e..5291541 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x16e6=['acw','acwTimeout','autopause','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','talking','total','answered','sumDuration','sumHoldTime','unmanaged','available'];(function(_0x1dcfa9,_0x272413){var _0x5bae1f=function(_0x57e130){while(--_0x57e130){_0x1dcfa9['push'](_0x1dcfa9['shift']());}};_0x5bae1f(++_0x272413);}(_0x16e6,0x1d5));var _0x616e=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0x16e6[_0x310d10];return _0x1fb8af;};'use strict';var statusDesc=[_0x616e('0x0'),'not_inuse','inuse',_0x616e('0x1'),_0x616e('0x2'),_0x616e('0x3'),_0x616e('0x4'),_0x616e('0x5'),_0x616e('0x6')];var monitorFormat={'wav':_0x616e('0x7'),'wav49':_0x616e('0x8'),'gsm':_0x616e('0x9')};var strategy={'rrmemory':_0x616e('0xa'),'roundrobin':_0x616e('0xb')};function VoiceQueue(_0x18913d){this['id']=_0x18913d['id']||0x0;this[_0x616e('0xc')]=_0x18913d[_0x616e('0xc')]||'';this[_0x616e('0xd')]=_0x18913d[_0x616e('0xd')]||'';this[_0x616e('0xe')]=_0x18913d['type']||_0x616e('0xf');this['waiting']=0x0;this[_0x616e('0x10')]=0x0;this[_0x616e('0x11')]=0x0;this[_0x616e('0x12')]=0x0;this[_0x616e('0x13')]=0x0;this[_0x616e('0x14')]=0x0;this['sumBillable']=0x0;this[_0x616e('0x15')]=0x0;this['abandoned']=0x0;this['loggedIn']=0x0;this[_0x616e('0x16')]=0x0;this[_0x616e('0x17')]=_0x18913d[_0x616e('0x17')]||![];this[_0x616e('0x18')]=_0x18913d[_0x616e('0x18')]||0xa;this[_0x616e('0x19')]=_0x18913d[_0x616e('0x19')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0x616e('0x1a')]=0x0;this[_0x616e('0x1b')]=0x0;this[_0x616e('0x1c')]=_0x18913d[_0x616e('0x1c')]||null;this[_0x616e('0x1d')]=_0x18913d[_0x616e('0x1d')]?_0x18913d[_0x616e('0x1d')]:null;this['dialActive']=_0x18913d[_0x616e('0x1e')];this[_0x616e('0x1f')]=_0x18913d[_0x616e('0x1f')]||_0x616e('0x20');this[_0x616e('0x21')]=_0x18913d['dialLimitChannel']||0x0;this[_0x616e('0x22')]=_0x18913d[_0x616e('0x22')]||0x0;this['dialPowerLevel']=_0x18913d[_0x616e('0x23')]||0x1;this[_0x616e('0x24')]=_0x18913d['dialPredictiveOptimization']||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x18913d['dialPredictiveOptimizationPercentage']||0.03;this[_0x616e('0x25')]=_0x18913d['dialPredictiveInterval']||0x258;this[_0x616e('0x26')]=_0x18913d[_0x616e('0x26')]||'anonymous';this[_0x616e('0x27')]=_0x18913d[_0x616e('0x27')]||_0x616e('0x28');this['dialOriginateTimeout']=_0x18913d[_0x616e('0x29')]||0x1e;this['dialQueueOptions']=_0x18913d[_0x616e('0x2a')]||_0x616e('0x2b');this[_0x616e('0x2c')]=_0x18913d[_0x616e('0x2c')]||0x3;this[_0x616e('0x2d')]=_0x18913d[_0x616e('0x2d')]||undefined;this[_0x616e('0x2e')]=_0x18913d[_0x616e('0x2e')]||0x3;this['dialCongestionRetryFrequency']=_0x18913d[_0x616e('0x2f')]||0x96;this['dialBusyMaxRetry']=_0x18913d[_0x616e('0x30')]||0x3;this[_0x616e('0x31')]=_0x18913d[_0x616e('0x31')]||0x96;this[_0x616e('0x32')]=_0x18913d['dialNoAnswerMaxRetry']||0x3;this[_0x616e('0x33')]=_0x18913d[_0x616e('0x33')]||0x96;this[_0x616e('0x34')]=_0x18913d[_0x616e('0x34')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x18913d[_0x616e('0x35')]||0x96;this['dialDropMaxRetry']=_0x18913d['dialDropMaxRetry']||0x3;this[_0x616e('0x36')]=_0x18913d[_0x616e('0x36')]||0x96;this[_0x616e('0x37')]=_0x18913d[_0x616e('0x37')]||0x3;this[_0x616e('0x38')]=_0x18913d[_0x616e('0x38')]||0x96;this[_0x616e('0x39')]=_0x18913d[_0x616e('0x39')]||0x3;this[_0x616e('0x3a')]=_0x18913d['dialMachineRetryFrequency']||0x96;this[_0x616e('0x3b')]=_0x18913d[_0x616e('0x3b')]||0x3;this[_0x616e('0x3c')]=_0x18913d[_0x616e('0x3c')]||0x96;this['callAdditionalPhoneAfterMin']=_0x18913d['callAdditionalPhoneAfterMin']||0x3;this[_0x616e('0x3d')]=_0x18913d[_0x616e('0x3d')]||0x4;this['Trunk']=_0x18913d['Trunk']?_0x18913d[_0x616e('0x3e')]:undefined;this[_0x616e('0x3f')]=_0x18913d['TrunkBackup']?_0x18913d['TrunkBackup']:undefined;this[_0x616e('0x40')]=_0x18913d[_0x616e('0x40')]||undefined;this['Interval']=_0x18913d[_0x616e('0x41')]?_0x18913d['Interval']:undefined;this['dialOrderByScheduledAt']=_0x18913d['dialOrderByScheduledAt']||_0x616e('0x42');this[_0x616e('0x43')]=_0x18913d[_0x616e('0x43')]||undefined;this[_0x616e('0x44')]=_0x18913d[_0x616e('0x44')]||undefined;this[_0x616e('0x45')]=strategy[_0x18913d['strategy']]||_0x616e('0xa');this['queueStatusComplete']=!![];this[_0x616e('0x46')]=_0x18913d['dialAMDActive']||![];this[_0x616e('0x47')]=_0x18913d[_0x616e('0x47')];this[_0x616e('0x48')]=_0x18913d[_0x616e('0x48')];this[_0x616e('0x49')]=_0x18913d[_0x616e('0x49')];this[_0x616e('0x4a')]=_0x18913d[_0x616e('0x4a')];this[_0x616e('0x4b')]=_0x18913d[_0x616e('0x4b')];this[_0x616e('0x4c')]=_0x18913d[_0x616e('0x4c')];this[_0x616e('0x4d')]=_0x18913d[_0x616e('0x4d')];this['dialAMDSilenceThreshold']=_0x18913d[_0x616e('0x4e')];this['dialAMDMaximumWordLength']=_0x18913d[_0x616e('0x4f')];this[_0x616e('0x50')]=0x0;this['pTalking']=0x0;this['timeout']=_0x18913d[_0x616e('0x51')];this[_0x616e('0x52')]=0x0;this[_0x616e('0x53')]=0x0;this[_0x616e('0x54')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x616e('0x55')]=0x0;this[_0x616e('0x56')]=0x0;this[_0x616e('0x57')]=0x0;this[_0x616e('0x58')]=0x0;this[_0x616e('0x59')]=0x0;this[_0x616e('0x5a')]=0x0;this[_0x616e('0x5b')]=0x0;this[_0x616e('0x5c')]=0x0;this[_0x616e('0x5d')]=undefined;this[_0x616e('0x5e')]=undefined;this[_0x616e('0x5f')]=undefined;this[_0x616e('0x60')]=1.05;this[_0x616e('0x61')]=0x0;this[_0x616e('0x62')]=0x0;this[_0x616e('0x63')]=0x0;this[_0x616e('0x64')]=0x0;this[_0x616e('0x65')]=0x0;this[_0x616e('0x66')]=0x0;this[_0x616e('0x67')]=0x0;this[_0x616e('0x68')]=0x0;this['predictiveIntervalMaxThreshold']=_0x18913d[_0x616e('0x69')]||0x14;this[_0x616e('0x6a')]=_0x18913d[_0x616e('0x69')]||0xa;this[_0x616e('0x6b')]=0x0;this[_0x616e('0x6c')]=0x0;this[_0x616e('0x6d')]=0x1;this[_0x616e('0x6e')]=0x0;this['erlangCallToSecond']=0x0;this[_0x616e('0x6f')]=0x0;this[_0x616e('0x70')]=0x0;this['dialRecallMeTimeout']=_0x18913d[_0x616e('0x71')]||0x1e;this[_0x616e('0x72')]=_0x18913d['dialRecallInQueue']||![];this[_0x616e('0x73')]=!!_0x18913d[_0x616e('0x73')]||![];this[_0x616e('0x74')]=!!_0x18913d[_0x616e('0x74')]||![];this[_0x616e('0x75')]=_0x18913d['dialQueueProject2']||undefined;this[_0x616e('0x76')]=_0x18913d[_0x616e('0x76')]||![];this[_0x616e('0x77')]=_0x18913d[_0x616e('0x77')]||![];this[_0x616e('0xd')]=monitorFormat[_0x18913d[_0x616e('0xd')]]?monitorFormat[_0x18913d[_0x616e('0xd')]]:undefined;this[_0x616e('0x78')]=_0x18913d[_0x616e('0x78')]||![];this['mandatoryDispositionPause']=_0x18913d[_0x616e('0x79')]?_0x18913d[_0x616e('0x79')]:undefined;}module[_0x616e('0x7a')]=VoiceQueue;
\ No newline at end of file
+var _0xbfb6=['answered','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','unavailable','ringing','ringinuse','onhold','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','total'];(function(_0x2b4899,_0x231ad7){var _0x342e13=function(_0x57b6f8){while(--_0x57b6f8){_0x2b4899['push'](_0x2b4899['shift']());}};_0x342e13(++_0x231ad7);}(_0xbfb6,0x1bf));var _0x6bfb=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbfb6[_0x57b54c];return _0x59cc19;};'use strict';var statusDesc=[_0x6bfb('0x0'),'not_inuse',_0x6bfb('0x1'),_0x6bfb('0x2'),'invalid',_0x6bfb('0x3'),_0x6bfb('0x4'),_0x6bfb('0x5'),_0x6bfb('0x6')];var monitorFormat={'wav':'wav','wav49':_0x6bfb('0x7'),'gsm':_0x6bfb('0x8')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x6bfb('0x9')};function VoiceQueue(_0x2be9be){this['id']=_0x2be9be['id']||0x0;this[_0x6bfb('0xa')]=_0x2be9be[_0x6bfb('0xa')]||'';this[_0x6bfb('0xb')]=_0x2be9be[_0x6bfb('0xb')]||'';this[_0x6bfb('0xc')]=_0x2be9be[_0x6bfb('0xc')]||_0x6bfb('0xd');this[_0x6bfb('0xe')]=0x0;this[_0x6bfb('0xf')]=0x0;this[_0x6bfb('0x10')]=0x0;this[_0x6bfb('0x11')]=0x0;this['sumDuration']=0x0;this[_0x6bfb('0x12')]=0x0;this[_0x6bfb('0x13')]=0x0;this[_0x6bfb('0x14')]=0x0;this['abandoned']=0x0;this[_0x6bfb('0x15')]=0x0;this[_0x6bfb('0x16')]=0x0;this[_0x6bfb('0x17')]=_0x2be9be[_0x6bfb('0x17')]||![];this[_0x6bfb('0x18')]=_0x2be9be[_0x6bfb('0x18')]||0xa;this[_0x6bfb('0x19')]=_0x2be9be[_0x6bfb('0x19')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0x6bfb('0x1a')]=0x0;this[_0x6bfb('0x1b')]=0x0;this['dialTimezone']=_0x2be9be[_0x6bfb('0x1c')]||null;this[_0x6bfb('0x1d')]=_0x2be9be[_0x6bfb('0x1d')]?_0x2be9be[_0x6bfb('0x1d')]:null;this[_0x6bfb('0x1e')]=_0x2be9be[_0x6bfb('0x1e')];this['dialMethod']=_0x2be9be[_0x6bfb('0x1f')]||_0x6bfb('0x20');this[_0x6bfb('0x21')]=_0x2be9be[_0x6bfb('0x21')]||0x0;this[_0x6bfb('0x22')]=_0x2be9be[_0x6bfb('0x22')]||0x0;this[_0x6bfb('0x23')]=_0x2be9be[_0x6bfb('0x23')]||0x1;this[_0x6bfb('0x24')]=_0x2be9be[_0x6bfb('0x24')]||_0x6bfb('0x25');this['dialPredictiveOptimizationPercentage']=_0x2be9be[_0x6bfb('0x26')]||0.03;this[_0x6bfb('0x27')]=_0x2be9be['dialPredictiveInterval']||0x258;this[_0x6bfb('0x28')]=_0x2be9be[_0x6bfb('0x28')]||_0x6bfb('0x29');this['dialOriginateCallerIdNumber']=_0x2be9be[_0x6bfb('0x2a')]||_0x6bfb('0x29');this['dialOriginateTimeout']=_0x2be9be['dialOriginateTimeout']||0x1e;this[_0x6bfb('0x2b')]=_0x2be9be[_0x6bfb('0x2b')]||_0x6bfb('0x2c');this[_0x6bfb('0x2d')]=_0x2be9be[_0x6bfb('0x2d')]||0x3;this['dialQueueProject']=_0x2be9be[_0x6bfb('0x2e')]||undefined;this[_0x6bfb('0x2f')]=_0x2be9be[_0x6bfb('0x2f')]||0x3;this[_0x6bfb('0x30')]=_0x2be9be[_0x6bfb('0x30')]||0x96;this['dialBusyMaxRetry']=_0x2be9be[_0x6bfb('0x31')]||0x3;this['dialBusyRetryFrequency']=_0x2be9be[_0x6bfb('0x32')]||0x96;this[_0x6bfb('0x33')]=_0x2be9be['dialNoAnswerMaxRetry']||0x3;this[_0x6bfb('0x34')]=_0x2be9be[_0x6bfb('0x34')]||0x96;this[_0x6bfb('0x35')]=_0x2be9be[_0x6bfb('0x35')]||0x3;this[_0x6bfb('0x36')]=_0x2be9be[_0x6bfb('0x36')]||0x96;this[_0x6bfb('0x37')]=_0x2be9be[_0x6bfb('0x37')]||0x3;this[_0x6bfb('0x38')]=_0x2be9be['dialDropRetryFrequency']||0x96;this[_0x6bfb('0x39')]=_0x2be9be[_0x6bfb('0x39')]||0x3;this[_0x6bfb('0x3a')]=_0x2be9be[_0x6bfb('0x3a')]||0x96;this['dialMachineMaxRetry']=_0x2be9be[_0x6bfb('0x3b')]||0x3;this[_0x6bfb('0x3c')]=_0x2be9be[_0x6bfb('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0x2be9be[_0x6bfb('0x3d')]||0x3;this[_0x6bfb('0x3e')]=_0x2be9be[_0x6bfb('0x3e')]||0x96;this['callAdditionalPhoneAfterMin']=_0x2be9be['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x2be9be['dialGlobalMaxRetry']||0x4;this[_0x6bfb('0x3f')]=_0x2be9be['Trunk']?_0x2be9be['Trunk']:undefined;this['TrunkBackup']=_0x2be9be[_0x6bfb('0x40')]?_0x2be9be[_0x6bfb('0x40')]:undefined;this[_0x6bfb('0x41')]=_0x2be9be[_0x6bfb('0x41')]||undefined;this['Interval']=_0x2be9be[_0x6bfb('0x42')]?_0x2be9be[_0x6bfb('0x42')]:undefined;this['dialOrderByScheduledAt']=_0x2be9be[_0x6bfb('0x43')]||_0x6bfb('0x44');this[_0x6bfb('0x45')]=_0x2be9be[_0x6bfb('0x45')]||undefined;this[_0x6bfb('0x46')]=_0x2be9be[_0x6bfb('0x46')]||undefined;this[_0x6bfb('0x47')]=strategy[_0x2be9be[_0x6bfb('0x47')]]||_0x6bfb('0x48');this['queueStatusComplete']=!![];this[_0x6bfb('0x49')]=_0x2be9be['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x2be9be[_0x6bfb('0x4a')];this[_0x6bfb('0x4b')]=_0x2be9be[_0x6bfb('0x4b')];this[_0x6bfb('0x4c')]=_0x2be9be[_0x6bfb('0x4c')];this[_0x6bfb('0x4d')]=_0x2be9be[_0x6bfb('0x4d')];this[_0x6bfb('0x4e')]=_0x2be9be[_0x6bfb('0x4e')];this['dialAMDBetweenWordsSilence']=_0x2be9be[_0x6bfb('0x4f')];this[_0x6bfb('0x50')]=_0x2be9be['dialAMDMaximumNumberOfWords'];this[_0x6bfb('0x51')]=_0x2be9be['dialAMDSilenceThreshold'];this[_0x6bfb('0x52')]=_0x2be9be[_0x6bfb('0x52')];this['outboundRejectCallsDay']=0x0;this[_0x6bfb('0x53')]=0x0;this['timeout']=_0x2be9be['timeout'];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x6bfb('0x54')]=0x0;this[_0x6bfb('0x55')]=0x0;this[_0x6bfb('0x56')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x6bfb('0x57')]=0x0;this[_0x6bfb('0x58')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x6bfb('0x59')]=0x0;this[_0x6bfb('0x5a')]=0x0;this[_0x6bfb('0x5b')]=0x0;this[_0x6bfb('0x5c')]=0x0;this[_0x6bfb('0x5d')]=undefined;this['startPredictive']=undefined;this[_0x6bfb('0x5e')]=undefined;this[_0x6bfb('0x5f')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x6bfb('0x60')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x6bfb('0x61')]=0x0;this[_0x6bfb('0x62')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x6bfb('0x63')]=0x0;this['predictiveIntervalMaxThreshold']=_0x2be9be[_0x6bfb('0x64')]||0x14;this[_0x6bfb('0x65')]=_0x2be9be[_0x6bfb('0x64')]||0xa;this[_0x6bfb('0x66')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x6bfb('0x67')]=0x0;this['erlangCallToSecond']=0x0;this[_0x6bfb('0x68')]=0x0;this[_0x6bfb('0x69')]=0x0;this[_0x6bfb('0x6a')]=_0x2be9be[_0x6bfb('0x6a')]||0x1e;this[_0x6bfb('0x6b')]=_0x2be9be[_0x6bfb('0x6b')]||![];this[_0x6bfb('0x6c')]=!!_0x2be9be[_0x6bfb('0x6c')]||![];this['dialPreviewRecallmeReminder']=!!_0x2be9be[_0x6bfb('0x6d')]||![];this[_0x6bfb('0x6e')]=_0x2be9be[_0x6bfb('0x6e')]||undefined;this[_0x6bfb('0x6f')]=_0x2be9be['dialAgiAfterHangupClient']||![];this[_0x6bfb('0x70')]=_0x2be9be[_0x6bfb('0x70')]||![];this[_0x6bfb('0xb')]=monitorFormat[_0x2be9be[_0x6bfb('0xb')]]?monitorFormat[_0x2be9be[_0x6bfb('0xb')]]:undefined;this[_0x6bfb('0x71')]=_0x2be9be['mandatoryDisposition']||![];this[_0x6bfb('0x72')]=_0x2be9be[_0x6bfb('0x72')]?_0x2be9be[_0x6bfb('0x72')]:undefined;}module[_0x6bfb('0x73')]=VoiceQueue;
\ No newline at end of file
index d446273..bd4d47b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1a0c=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x1a0c,0xc0));var _0xc1a0=function(_0x1be181,_0x29d354){_0x1be181=_0x1be181-0x0;var _0x2f46d3=_0x1a0c[_0x1be181];return _0x2f46d3;};'use strict';function VtigerAccount(_0x145a6d){this['id']=_0x145a6d['id']||0x0;this[_0xc1a0('0x0')]=_0x145a6d['name']||'';this[_0xc1a0('0x1')]=_0x145a6d[_0xc1a0('0x1')]||'';this['accessKey']=_0x145a6d[_0xc1a0('0x2')]||'';this[_0xc1a0('0x3')]=_0x145a6d[_0xc1a0('0x3')]||'';this[_0xc1a0('0x4')]=_0x145a6d['serverUrl']||'';this[_0xc1a0('0x5')]=_0x145a6d['Configurations']||{};}module[_0xc1a0('0x6')]=VtigerAccount;
\ No newline at end of file
+var _0x1b8f=['Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1b8f,0x152));var _0xf1b8=function(_0x36560b,_0x348cba){_0x36560b=_0x36560b-0x0;var _0x1fb0ae=_0x1b8f[_0x36560b];return _0x1fb0ae;};'use strict';function VtigerAccount(_0x122cd1){this['id']=_0x122cd1['id']||0x0;this['name']=_0x122cd1[_0xf1b8('0x0')]||'';this[_0xf1b8('0x1')]=_0x122cd1[_0xf1b8('0x1')]||'';this[_0xf1b8('0x2')]=_0x122cd1[_0xf1b8('0x2')]||'';this[_0xf1b8('0x3')]=_0x122cd1[_0xf1b8('0x3')]||'';this['serverUrl']=_0x122cd1['serverUrl']||'';this['Configurations']=_0x122cd1[_0xf1b8('0x4')]||{};}module[_0xf1b8('0x5')]=VtigerAccount;
\ No newline at end of file
index 4e06515..a259d4b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e45=['authType','type','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x18f1b7,_0x442100){var _0x1a82bb=function(_0x7a30ba){while(--_0x7a30ba){_0x18f1b7['push'](_0x18f1b7['shift']());}};_0x1a82bb(++_0x442100);}(_0x8e45,0x69));var _0x58e4=function(_0x4e0fa0,_0x2e7783){_0x4e0fa0=_0x4e0fa0-0x0;var _0xa10030=_0x8e45[_0x4e0fa0];return _0xa10030;};'use strict';function ZendeskAccount(_0x2779ad){this['id']=_0x2779ad['id']||0x0;this[_0x58e4('0x0')]=_0x2779ad['name']||'';this['username']=_0x2779ad[_0x58e4('0x1')]||'';this[_0x58e4('0x2')]=_0x2779ad[_0x58e4('0x2')]||'';this[_0x58e4('0x3')]=_0x2779ad[_0x58e4('0x3')]||'';this[_0x58e4('0x4')]=_0x2779ad[_0x58e4('0x4')]||'';this[_0x58e4('0x5')]=_0x2779ad[_0x58e4('0x5')]||'';this[_0x58e4('0x6')]=_0x2779ad[_0x58e4('0x6')]||'integrationTab';this[_0x58e4('0x7')]=_0x2779ad['serverUrl']||'';this[_0x58e4('0x8')]=_0x2779ad[_0x58e4('0x8')]||{};}module[_0x58e4('0x9')]=ZendeskAccount;
\ No newline at end of file
+var _0x4915=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4915,0xe3));var _0x5491=function(_0x4e7af4,_0x758572){_0x4e7af4=_0x4e7af4-0x0;var _0x2548f1=_0x4915[_0x4e7af4];return _0x2548f1;};'use strict';function ZendeskAccount(_0x3cd956){this['id']=_0x3cd956['id']||0x0;this[_0x5491('0x0')]=_0x3cd956[_0x5491('0x0')]||'';this[_0x5491('0x1')]=_0x3cd956[_0x5491('0x1')]||'';this[_0x5491('0x2')]=_0x3cd956[_0x5491('0x2')]||'';this[_0x5491('0x3')]=_0x3cd956[_0x5491('0x3')]||'';this[_0x5491('0x4')]=_0x3cd956[_0x5491('0x4')]||'';this[_0x5491('0x5')]=_0x3cd956[_0x5491('0x5')]||'';this['type']=_0x3cd956[_0x5491('0x6')]||_0x5491('0x7');this[_0x5491('0x8')]=_0x3cd956[_0x5491('0x8')]||'';this[_0x5491('0x9')]=_0x3cd956['Configurations']||{};}module[_0x5491('0xa')]=ZendeskAccount;
\ No newline at end of file
index 0d342c1..8855536 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x89c2=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x5d302a,_0xb11d6e){var _0x3752d6=function(_0x401642){while(--_0x401642){_0x5d302a['push'](_0x5d302a['shift']());}};_0x3752d6(++_0xb11d6e);}(_0x89c2,0x95));var _0x289c=function(_0x45cd2a,_0x56b7b4){_0x45cd2a=_0x45cd2a-0x0;var _0x3bb615=_0x89c2[_0x45cd2a];return _0x3bb615;};'use strict';function ZohoAccount(_0x4b7c7d){this['id']=_0x4b7c7d['id']||0x0;this[_0x289c('0x0')]=_0x4b7c7d[_0x289c('0x0')]||'';this[_0x289c('0x1')]=_0x4b7c7d[_0x289c('0x1')]||'';this[_0x289c('0x2')]=_0x4b7c7d[_0x289c('0x2')]||'';this['zone']=_0x4b7c7d[_0x289c('0x3')]||'';this['clientId']=_0x4b7c7d[_0x289c('0x4')]||'';this[_0x289c('0x5')]=_0x4b7c7d[_0x289c('0x5')]||'';this[_0x289c('0x6')]=_0x4b7c7d['serverUrl']||'';this[_0x289c('0x7')]=_0x4b7c7d['code']||'';this[_0x289c('0x8')]=_0x4b7c7d[_0x289c('0x8')]||'';this[_0x289c('0x9')]=_0x4b7c7d[_0x289c('0x9')]||{};}module[_0x289c('0xa')]=ZohoAccount;
\ No newline at end of file
+var _0xe108=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x507208,_0x34f2fd){var _0x5edbac=function(_0x196170){while(--_0x196170){_0x507208['push'](_0x507208['shift']());}};_0x5edbac(++_0x34f2fd);}(_0xe108,0xaa));var _0x8e10=function(_0x318f1f,_0x4a62d9){_0x318f1f=_0x318f1f-0x0;var _0x99ce5f=_0xe108[_0x318f1f];return _0x99ce5f;};'use strict';function ZohoAccount(_0x5eec49){this['id']=_0x5eec49['id']||0x0;this[_0x8e10('0x0')]=_0x5eec49[_0x8e10('0x0')]||'';this[_0x8e10('0x1')]=_0x5eec49[_0x8e10('0x1')]||'';this[_0x8e10('0x2')]=_0x5eec49['host']||'';this['zone']=_0x5eec49[_0x8e10('0x3')]||'';this[_0x8e10('0x4')]=_0x5eec49[_0x8e10('0x4')]||'';this[_0x8e10('0x5')]=_0x5eec49['clientSecret']||'';this[_0x8e10('0x6')]=_0x5eec49['serverUrl']||'';this[_0x8e10('0x7')]=_0x5eec49[_0x8e10('0x7')]||'';this[_0x8e10('0x8')]=_0x5eec49[_0x8e10('0x8')]||'';this[_0x8e10('0x9')]=_0x5eec49[_0x8e10('0x9')]||{};}module[_0x8e10('0xa')]=ZohoAccount;
\ No newline at end of file
index 833a5d1..85e6d6e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf61e=['phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','Contact','firstName','lastName','active','calleridnum'];(function(_0x5bcddc,_0x288f93){var _0x578229=function(_0x277e20){while(--_0x277e20){_0x5bcddc['push'](_0x5bcddc['shift']());}};_0x578229(++_0x288f93);}(_0xf61e,0x191));var _0xef61=function(_0x3772a9,_0x3fd58c){_0x3772a9=_0x3772a9-0x0;var _0x401397=_0xf61e[_0x3772a9];return _0x401397;};'use strict';var util=require(_0xef61('0x0'));var _=require(_0xef61('0x1'));var moment=require(_0xef61('0x2'));function checkNameSurname(_0xcf15bd,_0x205269,_0xeccd26){var _0x3613e6='';if(!_[_0xef61('0x3')](_0x205269)&&_0xef61('0x4')===typeof _0x205269){_0x3613e6+=_0x205269;}if(!_[_0xef61('0x3')](_0xeccd26)&&_0xef61('0x4')===typeof _0xeccd26){_0x3613e6+='\x20'+_0xeccd26;}if(_0x3613e6!==''){return _0x3613e6;}return _0xcf15bd;}function Action(_0x45a18d,_0x5b00b2,_0x9e17f4,_0x3e2f79,_0x4f0cc5){this[_0xef61('0x5')]=_0x9e17f4||undefined;this[_0xef61('0x6')]=_0x45a18d['id'];this[_0xef61('0x7')]=_0x5b00b2['name'];this['type']=_0x5b00b2[_0xef61('0x8')];this[_0xef61('0x9')]=_0xef61('0x7');this[_0xef61('0xa')]=![];this[_0xef61('0xb')]=_[_0xef61('0x3')](_0x45a18d[_0xef61('0xc')])?undefined:_0x45a18d[_0xef61('0xc')][_0xef61('0xd')];this[_0xef61('0xe')]=this[_0xef61('0xb')]?util[_0xef61('0xf')](_0xef61('0x10'),this[_0xef61('0xb')]):_0x3e2f79||undefined;this['calleridname']=checkNameSurname(_0x45a18d[_0xef61('0x11')]['phone'],_0x45a18d[_0xef61('0x11')][_0xef61('0x12')],_0x45a18d[_0xef61('0x11')][_0xef61('0x13')]);this['active']=_0x45a18d[_0xef61('0x14')]||![];this[_0xef61('0x15')]=_0x45a18d[_0xef61('0x16')];this[_0xef61('0x17')]=_0x45a18d['scheduledat'];this[_0xef61('0x18')]=_0x45a18d[_0xef61('0x18')]||0x0;this['countcongestionretry']=_0x45a18d[_0xef61('0x19')]||0x0;this[_0xef61('0x1a')]=_0x45a18d[_0xef61('0x1a')]||0x0;this[_0xef61('0x1b')]=(_0x45a18d[_0xef61('0x18')]||0x0)+(_0x45a18d[_0xef61('0x19')]||0x0)+(_0x45a18d[_0xef61('0x1a')]||0x0)+(_0x45a18d['countnosuchnumberretry']||0x0)+(_0x45a18d[_0xef61('0x1c')]||0x0)+(_0x45a18d[_0xef61('0x1d')]||0x0)+(_0x45a18d['countmachineretry']||0x0)+(_0x45a18d[_0xef61('0x1e')]||0x0);this[_0xef61('0x1f')]=_0x45a18d[_0xef61('0x1f')]||0x0;this[_0xef61('0x1c')]=_0x45a18d[_0xef61('0x1c')]||0x0;this[_0xef61('0x1d')]=_0x45a18d[_0xef61('0x1d')]||0x0;this['countmachineretry']=_0x45a18d['countmachineretry']||0x0;this[_0xef61('0x1e')]=_0x45a18d['countagentrejectretry']||0x0;this[_0xef61('0x20')]=_0x45a18d['callback'];this['callbackuniqueid']=_0x45a18d[_0xef61('0x21')];this['callbackat']=_0x45a18d['callbackat'];this[_0xef61('0x22')]=_0x45a18d[_0xef61('0x22')];this[_0xef61('0x23')]=_0x45a18d[_0xef61('0x23')];this['ListId']=_0x45a18d[_0xef61('0x24')];this['UserId']=_[_0xef61('0x3')](_0x45a18d[_0xef61('0xc')])?_0x45a18d[_0xef61('0x25')]:_0x45a18d[_0xef61('0xc')]['id'];this[_0xef61('0x26')]=_0x45a18d[_0xef61('0x26')];this[_0xef61('0x27')]='';this[_0xef61('0x28')]='';}Action[_0xef61('0x29')][_0xef61('0x2a')]=function(){return util[_0xef61('0xf')](_0xef61('0x2b'),this[_0xef61('0x2c')],this[_0xef61('0x2d')]);};module[_0xef61('0x2e')]=Action;
\ No newline at end of file
+var _0x160f=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util','lodash','moment','isNil','string','uniqueid','type','campaigntype','queue','Agent','channelAgent','membername','format','SIP/%s','Contact','firstName','lastName','active','calleridnum','phone','scheduledat'];(function(_0x2e8abe,_0x3504a7){var _0x2838f9=function(_0x5581c2){while(--_0x5581c2){_0x2e8abe['push'](_0x2e8abe['shift']());}};_0x2838f9(++_0x3504a7);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xf160('0x0'));var _=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));function checkNameSurname(_0x2966aa,_0x5bf9e1,_0x4513f1){var _0x2fb414='';if(!_[_0xf160('0x3')](_0x5bf9e1)&&_0xf160('0x4')===typeof _0x5bf9e1){_0x2fb414+=_0x5bf9e1;}if(!_[_0xf160('0x3')](_0x4513f1)&&_0xf160('0x4')===typeof _0x4513f1){_0x2fb414+='\x20'+_0x4513f1;}if(_0x2fb414!==''){return _0x2fb414;}return _0x2966aa;}function Action(_0x4a6f3d,_0x311d63,_0x11902f,_0x49fe49,_0x59440e){this[_0xf160('0x5')]=_0x11902f||undefined;this['idContact']=_0x4a6f3d['id'];this['queue']=_0x311d63['name'];this[_0xf160('0x6')]=_0x311d63[_0xf160('0x6')];this[_0xf160('0x7')]=_0xf160('0x8');this['dialAnswer']=![];this['membername']=_[_0xf160('0x3')](_0x4a6f3d[_0xf160('0x9')])?undefined:_0x4a6f3d[_0xf160('0x9')]['name'];this[_0xf160('0xa')]=this[_0xf160('0xb')]?util[_0xf160('0xc')](_0xf160('0xd'),this[_0xf160('0xb')]):_0x49fe49||undefined;this['calleridname']=checkNameSurname(_0x4a6f3d[_0xf160('0xe')]['phone'],_0x4a6f3d[_0xf160('0xe')][_0xf160('0xf')],_0x4a6f3d[_0xf160('0xe')][_0xf160('0x10')]);this[_0xf160('0x11')]=_0x4a6f3d[_0xf160('0x11')]||![];this[_0xf160('0x12')]=_0x4a6f3d[_0xf160('0x13')];this[_0xf160('0x14')]=_0x4a6f3d['scheduledat'];this[_0xf160('0x15')]=_0x4a6f3d[_0xf160('0x15')]||0x0;this[_0xf160('0x16')]=_0x4a6f3d[_0xf160('0x16')]||0x0;this['countnoanswerretry']=_0x4a6f3d[_0xf160('0x17')]||0x0;this['countglobal']=(_0x4a6f3d[_0xf160('0x15')]||0x0)+(_0x4a6f3d[_0xf160('0x16')]||0x0)+(_0x4a6f3d[_0xf160('0x17')]||0x0)+(_0x4a6f3d[_0xf160('0x18')]||0x0)+(_0x4a6f3d[_0xf160('0x19')]||0x0)+(_0x4a6f3d[_0xf160('0x1a')]||0x0)+(_0x4a6f3d[_0xf160('0x1b')]||0x0)+(_0x4a6f3d[_0xf160('0x1c')]||0x0);this[_0xf160('0x18')]=_0x4a6f3d['countnosuchnumberretry']||0x0;this[_0xf160('0x19')]=_0x4a6f3d[_0xf160('0x19')]||0x0;this[_0xf160('0x1a')]=_0x4a6f3d['countabandonedretry']||0x0;this[_0xf160('0x1b')]=_0x4a6f3d[_0xf160('0x1b')]||0x0;this[_0xf160('0x1c')]=_0x4a6f3d[_0xf160('0x1c')]||0x0;this[_0xf160('0x1d')]=_0x4a6f3d[_0xf160('0x1d')];this[_0xf160('0x1e')]=_0x4a6f3d['callbackuniqueid'];this[_0xf160('0x1f')]=_0x4a6f3d[_0xf160('0x1f')];this[_0xf160('0x20')]=_0x4a6f3d[_0xf160('0x20')];this['ContactId']=_0x4a6f3d[_0xf160('0x21')];this[_0xf160('0x22')]=_0x4a6f3d['ListId'];this['UserId']=_[_0xf160('0x3')](_0x4a6f3d[_0xf160('0x9')])?_0x4a6f3d[_0xf160('0x23')]:_0x4a6f3d['Agent']['id'];this[_0xf160('0x24')]=_0x4a6f3d[_0xf160('0x24')];this[_0xf160('0x25')]='';this[_0xf160('0x26')]='';}Action[_0xf160('0x27')][_0xf160('0x28')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['calleridname'],this[_0xf160('0x29')]);};module[_0xf160('0x2a')]=Action;
\ No newline at end of file
index 5983d20..79aea0b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6aa7=['syncOriginateResponse','actionid','lookAgent','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','transfer','[syncHangup][talking][transfer]','destuniqueid','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','defaults','redis','localhost','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','bind','syncHangup','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','type','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCallToSecond','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','DEACTIVATED','hasOwnProperty','booked','outbound','clearZombieChannels','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','catch','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','ANSWER','responsetime','answertime','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','rescheduleContact','incrementPreviewCounters','countglobal','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','CANCEL','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countagentrejectretry','swapAdditionalPhones','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','decrementTalkink','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','execRun','unlock','unlockContact','getContactPreview','validateContact','isValid','checkIsBlackList','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Queue','Empty\x20Campaign','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','campaign\x20Name:\x20','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','trim','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]'];(function(_0x2c84ba,_0xef209b){var _0x166f38=function(_0x26790b){while(--_0x26790b){_0x2c84ba['push'](_0x2c84ba['shift']());}};_0x166f38(++_0xef209b);}(_0x6aa7,0x178));var _0x76aa=function(_0x1ad4c1,_0x4be44b){_0x1ad4c1=_0x1ad4c1-0x0;var _0x5533f3=_0x6aa7[_0x1ad4c1];return _0x5533f3;};'use strict';var util=require(_0x76aa('0x0'));var _=require('lodash');var BPromise=require(_0x76aa('0x1'));var uuid=require(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var md5=require(_0x76aa('0x4'));var Redis=require('ioredis');var config=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x76aa('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x76aa('0x9'));var Action=require(_0x76aa('0xa'));var ut=require(_0x76aa('0xb'));config['redis']=_[_0x76aa('0xc')](config[_0x76aa('0xd')],{'host':_0x76aa('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x76aa('0xd')]));var Sequence=function(){};Sequence[_0x76aa('0xf')][_0x76aa('0x10')]=function(_0x16cb50){this[_0x76aa('0x11')]=this[_0x76aa('0x11')]?this[_0x76aa('0x11')][_0x76aa('0x12')](_0x16cb50):_0x16cb50();};function Preview(_0xd6327){this[_0x76aa('0x13')]=new Sequence();this['campaignsPreview']=_0xd6327[_0x76aa('0x14')];this['trunks']=_0xd6327[_0x76aa('0x15')];this[_0x76aa('0x16')]={};this[_0x76aa('0x17')]=_0xd6327[_0x76aa('0x17')];this[_0x76aa('0x18')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x76aa('0x19')](this));ami['on']('hangup',this[_0x76aa('0x1a')][_0x76aa('0x19')](this));ami['on']('hanguprequest',this[_0x76aa('0x1b')]['bind'](this));ami['on'](_0x76aa('0x1c'),this['syncDialEnd'][_0x76aa('0x19')](this));ami['on'](_0x76aa('0x1d'),this[_0x76aa('0x1e')][_0x76aa('0x19')](this));ami['on'](_0x76aa('0x1f'),this[_0x76aa('0x20')]['bind'](this));ami['on']('attendedtransfer',this[_0x76aa('0x21')][_0x76aa('0x19')](this));ami['on'](_0x76aa('0x22'),this[_0x76aa('0x23')][_0x76aa('0x19')](this));this[_0x76aa('0x24')](this[_0x76aa('0x25')]);}function emit(_0x2eaf48,_0x385157,_0x5990c1){io['to'](_0x2eaf48)[_0x76aa('0x26')](_0x385157,_0x5990c1);}function emitCampaignPreview(_0x21064c){if(_0x21064c[_0x76aa('0x27')]==='outbound'){var _0x41463a={'id':_0x21064c['id'],'name':_0x21064c[_0x76aa('0x28')],'strategy':_0x21064c[_0x76aa('0x29')],'answered':_0x21064c[_0x76aa('0x2a')],'available':_0x21064c[_0x76aa('0x2b')],'loggedIn':_0x21064c[_0x76aa('0x2c')],'pTalking':_0x21064c[_0x76aa('0x2d')],'sumBillable':_0x21064c[_0x76aa('0x2e')],'sumDuration':_0x21064c[_0x76aa('0x2f')],'sumHoldTime':_0x21064c[_0x76aa('0x30')]||0x0,'talking':_0x21064c[_0x76aa('0x31')],'total':_0x21064c[_0x76aa('0x32')],'type':_0x21064c[_0x76aa('0x27')],'unmanaged':_0x21064c['unmanaged'],'abandoned':_0x21064c[_0x76aa('0x33')],'waiting':_0x21064c[_0x76aa('0x34')],'loggedInDb':_0x21064c[_0x76aa('0x35')],'dialActive':_0x21064c[_0x76aa('0x36')],'dialMethod':_0x21064c[_0x76aa('0x37')],'dialOriginateCallerIdName':_0x21064c[_0x76aa('0x38')],'dialOriginateCallerIdNumber':_0x21064c[_0x76aa('0x39')],'dialOriginateTimeout':_0x21064c[_0x76aa('0x3a')],'dialPrefix':_0x21064c[_0x76aa('0x3b')],'outboundAnswerAgiCallsDay':_0x21064c[_0x76aa('0x3c')],'outboundAnswerCallsDay':_0x21064c['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x21064c[_0x76aa('0x3d')],'outboundBusyCallsDay':_0x21064c['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x21064c[_0x76aa('0x3e')],'outboundDropCallsDayACS':_0x21064c[_0x76aa('0x3f')],'outboundDropCallsDayCallersExit':_0x21064c[_0x76aa('0x40')],'outboundDropCallsDayTimeout':_0x21064c[_0x76aa('0x41')],'outboundNoAnswerCallsDay':_0x21064c[_0x76aa('0x42')],'outboundNoSuchCallsDay':_0x21064c[_0x76aa('0x43')],'outboundOriginateFailureCallsDay':_0x21064c[_0x76aa('0x44')],'outboundReCallsDay':_0x21064c[_0x76aa('0x45')],'outboundRejectCallsDay':_0x21064c[_0x76aa('0x46')],'outboundUnknownCallsDay':_0x21064c[_0x76aa('0x47')],'outboundAbandonedCallsDay':_0x21064c['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x21064c[_0x76aa('0x48')],'predictiveIntervalAvgHoldtime':_0x21064c[_0x76aa('0x49')],'predictiveIntervalAvgTalktime':_0x21064c[_0x76aa('0x4a')],'predictiveIntervalDroppedCallsCallersExit':_0x21064c[_0x76aa('0x4b')],'predictiveIntervalDroppedCallsTimeout':_0x21064c[_0x76aa('0x4c')],'predictiveIntervalErlangCalls':_0x21064c[_0x76aa('0x4d')],'predictiveIntervalErlangCallsDroppedCalls':_0x21064c[_0x76aa('0x4e')],'predictiveIntervalHitRate':_0x21064c['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x21064c[_0x76aa('0x4f')],'predictiveIntervalPauses':_0x21064c[_0x76aa('0x50')],'predictiveIntervalAvailable':_0x21064c['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x21064c[_0x76aa('0x51')],'message':_0x21064c['message'],'originated':_0x21064c[_0x76aa('0x52')],'erlangCalls':_0x21064c['erlangCalls'],'erlangCallToSecond':_0x21064c[_0x76aa('0x53')],'erlangAbandonmentRate':_0x21064c['erlangAbandonmentRate'],'erlangBusyFactor':_0x21064c['erlangBusyFactor'],'startPredictive':_0x21064c[_0x76aa('0x54')],'startProgressive':_0x21064c[_0x76aa('0x55')]};if(_0x21064c[_0x76aa('0x56')]){_0x41463a[_0x76aa('0x56')]={'id':_0x21064c['Trunk']['id'],'name':_0x21064c['Trunk'][_0x76aa('0x28')],'active':_0x21064c[_0x76aa('0x56')][_0x76aa('0x57')],'callerid':_0x21064c[_0x76aa('0x56')][_0x76aa('0x58')]};}if(_0x21064c['Interval']){_0x41463a[_0x76aa('0x59')]={'id':_0x21064c['Interval']['id'],'name':_0x21064c['Interval'][_0x76aa('0x28')]};}var _0x36d64e=md5(JSON[_0x76aa('0x5a')](_0x41463a));if(_0x21064c[_0x76aa('0x4')]!==_0x36d64e){_0x21064c['md5']=_0x36d64e;emit(util[_0x76aa('0x5b')](_0x76aa('0x5c'),_0x41463a[_0x76aa('0x28')]),'voice_queue:save',_0x41463a);}}}function emitVoiceQueueChannelRemove(_0x113770){logger[_0x76aa('0x5d')](_0x76aa('0x5e'),JSON[_0x76aa('0x5a')](_0x113770));emit(util[_0x76aa('0x5b')](_0x76aa('0x5c'),_0x113770[_0x76aa('0x28')]),_0x76aa('0x5f'),_0x113770);io[_0x76aa('0x26')]('voice_queue_presence:remove',_0x113770);}function notSendMessagesQueue(_0x1525cb){if(_0x1525cb[_0x76aa('0x60')]){if(_0x1525cb[_0x76aa('0x52')]===0x0&&_0x1525cb[_0x76aa('0x2d')]===0x0){_0x1525cb[_0x76aa('0x60')]=![];_0x1525cb[_0x76aa('0x2b')]=0x0;_0x1525cb['paused']=0x0;_0x1525cb['message']=_0x76aa('0x61');ut[_0x76aa('0x62')](_0x76aa('0x63'),_0x1525cb[_0x76aa('0x28')]+'\x20is\x20not\x20active');}else{_0x1525cb[_0x76aa('0x64')]=_0x76aa('0x65');ut[_0x76aa('0x62')](_0x76aa('0x63'),_0x1525cb[_0x76aa('0x28')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x1525cb);}}Preview[_0x76aa('0xf')]['loopCampaigns']=function(){var _0xbb3136=this;setInterval(function(){_0xbb3136['syncCampaigns']();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x144f0a=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x5be7ce in _0x144f0a){if(_0x144f0a[_0x76aa('0x66')](_0x5be7ce)&&(_0x144f0a[_0x5be7ce][_0x76aa('0x37')]===_0x76aa('0x7')||_0x144f0a[_0x5be7ce][_0x76aa('0x37')]===_0x76aa('0x67'))&&_0x144f0a[_0x5be7ce]['type']===_0x76aa('0x68')){if(this[_0x76aa('0x18')]>0x7){this[_0x76aa('0x18')]=0x0;this[_0x76aa('0x69')]();}}if(_0x144f0a[_0x76aa('0x66')](_0x5be7ce)&&_0x144f0a[_0x5be7ce]['dialMethod']===_0x76aa('0x7')&&_0x144f0a[_0x5be7ce][_0x76aa('0x27')]==='outbound'){if(_0x144f0a[_0x5be7ce][_0x76aa('0x36')]){this['setMessage'](_0x144f0a[_0x5be7ce]);if(_0x144f0a[_0x5be7ce][_0x76aa('0x6a')])this[_0x76aa('0x6b')](_0x144f0a[_0x5be7ce]);}else{notSendMessagesQueue(_0x144f0a[_0x5be7ce]);}}}};Preview[_0x76aa('0xf')][_0x76aa('0x6c')]=function(_0x2d0bc4){var _0x3e0315=this;this[_0x76aa('0x13')][_0x76aa('0x10')](function(){if(!_[_0x76aa('0x6d')](_0x3e0315[_0x76aa('0x16')][_0x2d0bc4])){loggerAction['info'](_0x76aa('0x6e'),_0x2d0bc4,'Queue',_0x3e0315[_0x76aa('0x16')][_0x2d0bc4][_0x76aa('0x6f')],_0x76aa('0x70'),JSON[_0x76aa('0x5a')](_0x3e0315['campaignsPreview'][_0x3e0315['actions'][_0x2d0bc4][_0x76aa('0x6f')]]['originated']),_0x76aa('0x71'),JSON[_0x76aa('0x5a')](_0x3e0315[_0x76aa('0x25')][_0x3e0315[_0x76aa('0x16')][_0x2d0bc4][_0x76aa('0x6f')]][_0x76aa('0x2d')]),JSON['stringify'](_0x3e0315['actions'][_0x2d0bc4][_0x76aa('0x72')]),JSON[_0x76aa('0x5a')](_[_0x76aa('0x73')](_0x3e0315[_0x76aa('0x16')][_0x2d0bc4],[_0x76aa('0x74'),_0x76aa('0x75'),'VoiceQueueId',_0x76aa('0x76')])));return ami[_0x76aa('0x77')]({'action':_0x76aa('0x78'),'channel':_0x3e0315['actions'][_0x2d0bc4][_0x76aa('0x79')]})['catch'](function(_0x2a663a){if(_0x2a663a['message']===_0x76aa('0x7a')){setTimeout(function(){if(_0x3e0315[_0x76aa('0x16')][_0x2d0bc4]){ut[_0x76aa('0x7b')](_0x3e0315[_0x76aa('0x25')][_0x3e0315[_0x76aa('0x16')][_0x2d0bc4][_0x76aa('0x6f')]],_0x76aa('0x7c'));if(_0x3e0315['actions'][_0x2d0bc4][_0x76aa('0x72')]===!![]){ut['decrementTalkink'](_0x3e0315[_0x76aa('0x25')][_0x3e0315[_0x76aa('0x16')][_0x2d0bc4][_0x76aa('0x6f')]],_0x76aa('0x7c'));ut[_0x76aa('0x7d')](_0x76aa('0x7e')+_0x2d0bc4,_0x3e0315[_0x76aa('0x16')][_0x2d0bc4]['queue']);}ut[_0x76aa('0x7d')](_0x76aa('0x7f')+_0x2d0bc4,_0x3e0315[_0x76aa('0x16')][_0x2d0bc4][_0x76aa('0x6f')]);delete _0x3e0315['actions'][_0x2d0bc4];}},0x2328);}});}});};Preview[_0x76aa('0xf')][_0x76aa('0x69')]=function(){var _0x8dc601=this;loggerAction[_0x76aa('0x5d')](_0x76aa('0x80'),_[_0x76aa('0x81')](this['actions']));for(var _0x295b2c in this[_0x76aa('0x16')]){if(_0x8dc601[_0x76aa('0x16')][_0x76aa('0x66')](_0x295b2c)){_0x8dc601[_0x76aa('0x6c')](_0x295b2c);}}};Preview[_0x76aa('0xf')][_0x76aa('0x6b')]=function(_0x51893b){var _0x4910fb=this;rpcDb[_0x76aa('0x82')](_0x51893b['id'],ut[_0x76aa('0x83')](this['agents']))[_0x76aa('0x84')](function(_0x1e6f3c){if(!_['isNil'](_0x1e6f3c)){for(var _0x3354b6=0x0;_0x3354b6<_0x1e6f3c[_0x76aa('0x85')];_0x3354b6+=0x1){if(ut[_0x76aa('0x86')](_0x1e6f3c[_0x3354b6][_0x76aa('0x87')])<_0x51893b[_0x76aa('0x88')]*0x3c){if(_0x1e6f3c[_0x3354b6][_0x76aa('0x89')]&&!_0x1e6f3c[_0x3354b6][_0x76aa('0x89')][_0x76aa('0x8a')]){_0x4910fb[_0x76aa('0x8b')](_0x1e6f3c[_0x3354b6]['id'])['then'](ut[_0x76aa('0x8c')]('[RecallMe]'))[_0x76aa('0x8d')](ut[_0x76aa('0x8c')](_0x76aa('0x8e')));}else{rpcDb[_0x76aa('0x8f')](_0x1e6f3c[_0x3354b6]['id']);}}else{var _0x343cf1=new Action(_0x1e6f3c[_0x3354b6],_0x51893b);_0x343cf1[_0x76aa('0x90')]=moment()[_0x76aa('0x5b')](_0x76aa('0x91'));_0x51893b[_0x76aa('0x45')]+=0x1;ut['logCustomer'](_0x343cf1,0x17,_0x76aa('0x92'));if(_0x51893b[_0x76aa('0x93')]){rpcDb[_0x76aa('0x94')](ut[_0x76aa('0x95')](_0x1e6f3c[_0x3354b6]));rpcDb[_0x76aa('0x96')](_0x343cf1,_0x76aa('0x97'));}else{ut[_0x76aa('0x98')](_0x343cf1,0x16,_0x76aa('0x99'));rpcDb['createCustomerHistory'](_0x343cf1,_0x76aa('0x9a'));rpcDb['createCustomerFinal'](_0x343cf1,_0x76aa('0x9a'));}}}}})[_0x76aa('0x8d')](ut[_0x76aa('0x8c')](_0x76aa('0x9b')));};Preview[_0x76aa('0xf')][_0x76aa('0x9c')]=function(_0x2bfb46){_0x2bfb46['sendMessageOneNotActive']=!![];if(ut[_0x76aa('0x9d')](_0x2bfb46[_0x76aa('0x2c')])){_0x2bfb46['message']='AGENTS_NOT_LOGGED';}else if(!ut[_0x76aa('0x9e')](_0x2bfb46[_0x76aa('0x36')])){_0x2bfb46['message']=_0x76aa('0x61');}else if(!this[_0x76aa('0x9f')](_0x2bfb46[_0x76aa('0x56')])){if(!this['isTrunkReachable'](_0x2bfb46[_0x76aa('0xa0')])){_0x2bfb46['message']=_0x76aa('0xa1');}else{_0x2bfb46[_0x76aa('0x64')]=_0x76aa('0xa2');}}else{_0x2bfb46[_0x76aa('0x64')]='ACTIVE';}emitCampaignPreview(_0x2bfb46);};Preview['prototype'][_0x76aa('0xa3')]=function(_0x4dfeb3,_0x2a8fd3,_0x28feb2){var _0x368a95=this;var _0x43a2af=this[_0x76aa('0x16')][_0x2a8fd3];var _0x30837c=this[_0x76aa('0x25')][_0x43a2af[_0x76aa('0x6f')]];var _0xa19c1c;var _0x54390f=![];var _0x7d02e7=0x2;var _0x1eadee=0x3;if(_0x30837c){switch(_0x28feb2){case'1':_0x30837c[_0x76aa('0x43')]+=0x1;_0x43a2af[_0x76aa('0xa4')]+=0x1;_0x43a2af['countglobal']=ut['totalGlobal'](_0x43a2af);ut['logCustomer'](_0x43a2af,0x0,_0x76aa('0xa5'));ami['emit'](_0x76aa('0xa6'),ut[_0x76aa('0xa7')](_0x43a2af,_0x76aa('0xa8')));rpcDb[_0x76aa('0x96')](_0x43a2af,'[callProgressDetectingCustomer][logNoSuch]');_0x368a95[_0x76aa('0xa9')](_0x43a2af,'0',_0x30837c)['then'](function(_0x358aa7){_0x54390f=_0x358aa7[_0x76aa('0xaa')]==0x1;_0x7d02e7=_0x30837c[_0x76aa('0xab')];_0x1eadee=_0x30837c[_0x76aa('0xac')];if(!_0x54390f){if(ut[_0x76aa('0xad')](_0x43a2af)>=_0x30837c['dialGlobalMaxRetry']){_0xa19c1c=ut[_0x76aa('0xae')](_0x43a2af,0xf,_0x76aa('0xaf'));rpcDb[_0x76aa('0xb0')](_0xa19c1c,_0x76aa('0xb1'));}else{if(_0x43a2af[_0x76aa('0xa4')]>=_0x30837c[_0x76aa('0xb2')]){rpcDb[_0x76aa('0xb0')](_0x43a2af,_0x76aa('0xb1'));}else{rpcDb['rescheduleContact'](ut[_0x76aa('0xb3')](_0x43a2af,_0x76aa('0xa4'),_0x30837c['dialNoSuchNumberRetryFrequency']),_0x43a2af[_0x76aa('0xb4')],_0x43a2af[_0x76aa('0xb5')]);}}delete this[_0x76aa('0x16')][_0x4dfeb3[_0x76aa('0xb6')]];}else{_0x43a2af[_0x76aa('0xa4')]++;logger[_0x76aa('0x5d')](_0x76aa('0xb7'),_0x43a2af['countnosuchnumberretry']);logger[_0x76aa('0x5d')]('id',_0x43a2af['idContact']);_0x368a95['incrementPreviewCounters']({'id':_0x43a2af[_0x76aa('0xb8')],'field':{'countnosuchnumberretry':_0x43a2af[_0x76aa('0xa4')]}})['then'](function(){_0x368a95['swapAdditionalPhones'](_0x43a2af,_0x7d02e7,_0x1eadee)[_0x76aa('0x84')](function(){});});}});break;case _0x76aa('0xb9'):var _0xd4cbe1=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x43a2af[_0x76aa('0xba')]=_0xd4cbe1;_0x43a2af[_0x76aa('0xbb')]=_0xd4cbe1;_0x43a2af[_0x76aa('0x72')]=!![];_0x30837c['pTalking']+=0x1;logger[_0x76aa('0x5d')]('[syncHangup][talking][increment]',_0x43a2af[_0x76aa('0xbc')],_0x76aa('0xbd'),_0x30837c[_0x76aa('0x28')],_0x76aa('0x71'),_0x30837c[_0x76aa('0x2d')]);ami['emit']('custom:agentconnect',ut[_0x76aa('0xa7')](_0x43a2af,_0x76aa('0xbe'),this[_0x76aa('0x25')][_0x43a2af['queue']]));if(_0x30837c[_0x76aa('0xbf')]){ami[_0x76aa('0x26')](_0x76aa('0xc0'),ut[_0x76aa('0xc1')](_0x43a2af));}break;case'16':ami[_0x76aa('0x26')]('custom:agentcomplete',ut[_0x76aa('0xa7')](_0x43a2af,'complete',this[_0x76aa('0x25')][_0x43a2af[_0x76aa('0x6f')]]));emitVoiceQueueChannelRemove(ut[_0x76aa('0xa7')](_0x43a2af,_0x76aa('0xc2')));_0x30837c[_0x76aa('0xc3')]+=0x1;_0x30837c[_0x76aa('0x32')]+=0x1;_0x30837c['answered']+=0x1;ut['decrementTalkink'](_0x30837c,'[16]');_0x43a2af['countglobal']=ut['totalGlobal'](_0x43a2af);ut[_0x76aa('0x98')](_0x43a2af,0x4,_0x76aa('0xc4'));rpcDb['createCustomerHistory'](_0x43a2af,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x43a2af,_0x76aa('0xc5'));rpcDb[_0x76aa('0xc6')](_0x43a2af);_0x30837c[_0x76aa('0x2f')]+=_0x43a2af['talktime'];_0x30837c['sumBillable']+=_0x43a2af[_0x76aa('0xc7')];logger[_0x76aa('0x5d')](_0x76aa('0xc8'),_0x43a2af[_0x76aa('0xbc')],_0x76aa('0xbd'),_0x30837c['name'],'pTalking:\x20',_0x30837c[_0x76aa('0x2d')]);delete this['actions'][_0x4dfeb3['linkedid']];break;case'BUSY':_0x30837c[_0x76aa('0xc9')]+=0x1;_0x43a2af[_0x76aa('0xca')]+=0x1;_0x43a2af['countglobal']=ut[_0x76aa('0xad')](_0x43a2af);ut[_0x76aa('0x98')](_0x43a2af,0x5,'Busy');_0x7d02e7=_0x30837c[_0x76aa('0xcb')];_0x1eadee=_0x30837c[_0x76aa('0xac')];ami[_0x76aa('0x26')](_0x76aa('0xcc'),ut[_0x76aa('0xa7')](_0x43a2af,_0x76aa('0xcd')));rpcDb[_0x76aa('0x96')](_0x43a2af,_0x76aa('0xce'));_0x368a95[_0x76aa('0xa9')](_0x43a2af,'5',_0x30837c)['then'](function(_0x84bc91){_0x54390f=_0x84bc91[_0x76aa('0xaa')]==0x1;if(!_0x54390f){if(ut['totalGlobal'](_0x43a2af)>=_0x30837c[_0x76aa('0xcf')]){_0xa19c1c=ut[_0x76aa('0xae')](_0x43a2af,0xf,_0x76aa('0xaf'));rpcDb['createCustomerFinal'](_0xa19c1c,_0x76aa('0xd0'));}else{if(_0x43a2af[_0x76aa('0xca')]>=_0x30837c['dialBusyMaxRetry']){rpcDb[_0x76aa('0xb0')](_0x43a2af,_0x76aa('0xce'));}else{rpcDb[_0x76aa('0xd1')](ut['scheduledAt'](_0x43a2af,_0x76aa('0xca'),_0x30837c[_0x76aa('0xcb')]),_0x43a2af['unlockAgent'],_0x43a2af['activeContact']);}}}else{_0x43a2af['countbusyretry']++;_0x368a95[_0x76aa('0xd2')]({'id':_0x43a2af[_0x76aa('0xb8')],'field':{'countbusyretry':_0x43a2af[_0x76aa('0xca')]}})[_0x76aa('0x84')](function(){_0x368a95['swapAdditionalPhones'](_0x43a2af,_0x7d02e7,_0x1eadee)['then'](function(){});});}});break;case'NOANSWER':_0x30837c[_0x76aa('0x42')]+=0x1;_0x43a2af['countnoanswerretry']+=0x1;_0x43a2af[_0x76aa('0xd3')]=ut[_0x76aa('0xad')](_0x43a2af);ut['logCustomer'](_0x43a2af,0x3,_0x76aa('0xd4'));_0x7d02e7=_0x30837c[_0x76aa('0xd5')];_0x1eadee=_0x30837c['callAdditionalPhoneAfterMin'];ami[_0x76aa('0x26')](_0x76aa('0xd6'),ut[_0x76aa('0xa7')](_0x43a2af,_0x76aa('0xd7')));rpcDb[_0x76aa('0x96')](_0x43a2af,_0x76aa('0xd8'));_0x368a95['verifyAdditionalPhones'](_0x43a2af,'3',_0x30837c)[_0x76aa('0x84')](function(_0x4f5ded){_0x54390f=_0x4f5ded['additional']==0x1;if(!_0x54390f){if(ut['totalGlobal'](_0x43a2af)>=_0x30837c['dialGlobalMaxRetry']){_0xa19c1c=ut['cloneAction'](_0x43a2af,0xf,_0x76aa('0xaf'));rpcDb[_0x76aa('0xb0')](_0xa19c1c,_0x76aa('0xd9'));}else{if(_0x43a2af[_0x76aa('0xda')]>=_0x30837c['dialNoAnswerMaxRetry']){rpcDb[_0x76aa('0xb0')](_0x43a2af,_0x76aa('0xd8'));}else{rpcDb[_0x76aa('0xd1')](ut[_0x76aa('0xb3')](_0x43a2af,_0x76aa('0xda'),_0x30837c['dialNoAnswerRetryFrequency']),_0x43a2af[_0x76aa('0xb4')],_0x43a2af[_0x76aa('0xb5')]);}}}else{_0x43a2af[_0x76aa('0xda')]++;_0x368a95[_0x76aa('0xd2')]({'id':_0x43a2af[_0x76aa('0xb8')],'field':{'countnoanswerretry':_0x43a2af[_0x76aa('0xda')]}})[_0x76aa('0x84')](function(){_0x368a95['swapAdditionalPhones'](_0x43a2af,_0x7d02e7,_0x1eadee)[_0x76aa('0x84')](function(){});});}});break;case _0x76aa('0xdb'):_0x30837c['outboundCongestionCallsDay']+=0x1;_0x43a2af['countcongestionretry']+=0x1;_0x43a2af[_0x76aa('0xd3')]=ut[_0x76aa('0xad')](_0x43a2af);ut['logCustomer'](_0x43a2af,0x8,_0x76aa('0xdc'));_0x7d02e7=_0x30837c['dialCongestionRetryFrequency'];_0x1eadee=_0x30837c[_0x76aa('0xac')];ami['emit'](_0x76aa('0xdd'),ut[_0x76aa('0xa7')](_0x43a2af,_0x76aa('0xde')));rpcDb[_0x76aa('0x96')](_0x43a2af,_0x76aa('0xdf'));_0x368a95['verifyAdditionalPhones'](_0x43a2af,'8',_0x30837c)[_0x76aa('0x84')](function(_0x54bfd7){_0x54390f=_0x54bfd7[_0x76aa('0xaa')]==0x1;if(!_0x54390f){if(ut[_0x76aa('0xad')](_0x43a2af)>=_0x30837c['dialGlobalMaxRetry']){_0xa19c1c=ut['cloneAction'](_0x43a2af,0xf,_0x76aa('0xaf'));rpcDb[_0x76aa('0xb0')](_0xa19c1c,_0x76aa('0xe0'));}else{if(_0x43a2af[_0x76aa('0xe1')]>=_0x30837c['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x43a2af,_0x76aa('0xdf'));}else{rpcDb['rescheduleContact'](ut[_0x76aa('0xb3')](_0x43a2af,'countcongestionretry',_0x30837c[_0x76aa('0xcb')]),_0x43a2af[_0x76aa('0xb4')],_0x43a2af['activeContact']);}}}else{_0x43a2af[_0x76aa('0xe1')]++;_0x368a95['incrementPreviewCounters']({'id':_0x43a2af['idContact'],'field':{'countcongestionretry':_0x43a2af[_0x76aa('0xe1')]}})[_0x76aa('0x84')](function(){_0x368a95['swapAdditionalPhones'](_0x43a2af,_0x7d02e7,_0x1eadee)[_0x76aa('0x84')](function(){});});}});break;case _0x76aa('0xe2'):_0x30837c[_0x76aa('0x46')]+=0x1;_0x43a2af['countagentrejectretry']+=0x1;_0x43a2af[_0x76aa('0xd3')]=ut[_0x76aa('0xad')](_0x43a2af);ut[_0x76aa('0x98')](_0x43a2af,0x14,_0x76aa('0xe3'));_0x7d02e7=_0x30837c[_0x76aa('0xe4')];_0x1eadee=_0x30837c[_0x76aa('0xac')];ami[_0x76aa('0x26')](_0x76aa('0xe5'),ut[_0x76aa('0xa7')](_0x43a2af,_0x76aa('0xe6')));rpcDb[_0x76aa('0x96')](_0x43a2af,_0x76aa('0xe7'));_0x368a95['verifyAdditionalPhones'](_0x43a2af,'20',_0x30837c)[_0x76aa('0x84')](function(_0x2e69b3){_0x54390f=_0x2e69b3['additional']==0x1;if(!_0x54390f){if(ut[_0x76aa('0xad')](_0x43a2af)>=_0x30837c[_0x76aa('0xcf')]){_0xa19c1c=ut['cloneAction'](_0x43a2af,0x14,'AgentReject');rpcDb[_0x76aa('0xb0')](_0xa19c1c,_0x76aa('0xe8'));}else{if(_0x43a2af['countagentrejectretry']>=_0x30837c[_0x76aa('0xe9')]){rpcDb[_0x76aa('0xb0')](_0x43a2af,_0x76aa('0xe8'));}else{rpcDb['rescheduleContact'](ut[_0x76aa('0xb3')](_0x43a2af,_0x76aa('0xea'),_0x30837c['dialAgentRejectRetryFrequency']),_0x43a2af[_0x76aa('0xb4')],_0x43a2af[_0x76aa('0xb5')]);}}}else{_0x43a2af[_0x76aa('0xda')]++;_0x368a95[_0x76aa('0xd2')]({'id':_0x43a2af[_0x76aa('0xb8')],'field':{'countnoanswerretry':_0x43a2af[_0x76aa('0xda')]}})['then'](function(){_0x368a95[_0x76aa('0xeb')](_0x43a2af,_0x7d02e7,_0x1eadee)['then'](function(){});});}});break;case _0x76aa('0xec'):_0x30837c[_0x76aa('0xed')]+=0x1;_0x43a2af[_0x76aa('0xee')]+=0x1;_0x43a2af['countglobal']=ut['totalGlobal'](_0x43a2af);ut[_0x76aa('0x98')](_0x43a2af,0xb,_0x76aa('0xef'));rpcDb[_0x76aa('0x96')](_0x43a2af,_0x76aa('0xf0'));_0x368a95[_0x76aa('0xa9')](_0x43a2af,'11',_0x30837c)[_0x76aa('0x84')](function(_0x4f7dd4){_0x54390f=_0x4f7dd4['additional']==0x1;if(!_0x54390f){if(ut[_0x76aa('0xad')](_0x43a2af)>=_0x30837c[_0x76aa('0xcf')]){_0xa19c1c=ut[_0x76aa('0xae')](_0x43a2af,0xf,_0x76aa('0xaf'));rpcDb['createCustomerFinal'](_0xa19c1c,_0x76aa('0xf0'));}else{if(_0x43a2af['countabandonedetry']>=_0x30837c['dialAbandonedMaxRety']){rpcDb[_0x76aa('0xb0')](_0x43a2af,_0x76aa('0xf0'));}else{rpcDb[_0x76aa('0xd1')](ut['scheduledAt'](_0x43a2af,_0x76aa('0xee'),_0x30837c[_0x76aa('0xf1')]),_0x43a2af[_0x76aa('0xb4')],_0x43a2af[_0x76aa('0xb5')]);}}}else{_0x43a2af[_0x76aa('0xda')]++;_0x368a95[_0x76aa('0xd2')]({'id':_0x43a2af[_0x76aa('0xb8')],'field':{'countnoanswerretry':_0x43a2af['countnoanswerretry']}})[_0x76aa('0x84')](function(){_0x368a95[_0x76aa('0xeb')](_0x43a2af,_0x7d02e7,_0x1eadee)[_0x76aa('0x84')](function(){});});}});break;case'18':_0x30837c[_0x76aa('0x47')]+=0x1;_0x43a2af[_0x76aa('0xf2')]+=0x1;_0x43a2af[_0x76aa('0xd3')]=ut['totalGlobal'](_0x43a2af);ut[_0x76aa('0x98')](_0x43a2af,0x12,_0x4dfeb3[_0x76aa('0xf3')]||_0x4dfeb3[_0x76aa('0xf4')]);ami[_0x76aa('0x26')]('custom:amd',ut[_0x76aa('0xa7')](_0x43a2af,_0x76aa('0xf5')));rpcDb[_0x76aa('0x96')](_0x43a2af,_0x76aa('0xf6'));_0x368a95[_0x76aa('0xa9')](_0x43a2af,'18',_0x30837c)['then'](function(_0x203bc2){_0x54390f=_0x203bc2[_0x76aa('0xaa')]==0x1;if(!_0x54390f){if(ut['totalGlobal'](_0x43a2af)>=_0x30837c['dialGlobalMaxRetry']){_0xa19c1c=ut[_0x76aa('0xae')](_0x43a2af,0x12,_0x76aa('0xaf'));rpcDb[_0x76aa('0xb0')](_0xa19c1c,_0x76aa('0xf6'));}else{rpcDb[_0x76aa('0xb0')](_0x43a2af,_0x76aa('0xf6'));}}else{_0x43a2af['countnoanswerretry']++;_0x368a95[_0x76aa('0xd2')]({'id':_0x43a2af[_0x76aa('0xb8')],'field':{'countnoanswerretry':_0x43a2af[_0x76aa('0xda')]}})[_0x76aa('0x84')](function(){_0x368a95[_0x76aa('0xeb')](_0x43a2af,_0x7d02e7,_0x1eadee)[_0x76aa('0x84')](function(){});});}});delete this['actions'][_0x4dfeb3[_0x76aa('0xb6')]];break;case'19':_0x30837c[_0x76aa('0x47')]+=0x1;_0x43a2af[_0x76aa('0xd3')]=ut[_0x76aa('0xad')](_0x43a2af);ut[_0x76aa('0x98')](_0x43a2af,0x13,_0x4dfeb3[_0x76aa('0xf3')]||_0x4dfeb3['dialstatus']);ami[_0x76aa('0x26')]('custom:amd',ut[_0x76aa('0xa7')](_0x43a2af,'amd'));rpcDb[_0x76aa('0x96')](_0x43a2af,_0x76aa('0xf7'));_0x368a95['verifyAdditionalPhones'](_0x43a2af,'18',_0x30837c)[_0x76aa('0x84')](function(_0x85a254){_0x54390f=_0x85a254[_0x76aa('0xaa')]==0x1;if(!_0x54390f){if(ut['totalGlobal'](_0x43a2af)>=_0x30837c[_0x76aa('0xcf')]){_0xa19c1c=ut[_0x76aa('0xae')](_0x43a2af,0xf,'Global');rpcDb[_0x76aa('0xb0')](_0xa19c1c,_0x76aa('0xf7'));}else{rpcDb[_0x76aa('0xb0')](_0x43a2af,_0x76aa('0xf7'));}}else{_0x43a2af[_0x76aa('0xda')]++;_0x368a95[_0x76aa('0xd2')]({'id':_0x43a2af['idContact'],'field':{'countnoanswerretry':_0x43a2af[_0x76aa('0xda')]}})[_0x76aa('0x84')](function(){_0x368a95[_0x76aa('0xeb')](_0x43a2af,_0x7d02e7,_0x1eadee)[_0x76aa('0x84')](function(){});});}});delete this[_0x76aa('0x16')][_0x4dfeb3[_0x76aa('0xb6')]];break;default:if(_0x43a2af[_0x76aa('0x72')]){ut[_0x76aa('0xf8')](_0x30837c,_0x76aa('0xf9'));ut[_0x76aa('0x7d')](_0x76aa('0xfa')+_0x30837c['name'],_0x4dfeb3);}_0x30837c[_0x76aa('0x47')]+=0x1;_0x43a2af[_0x76aa('0xd3')]=ut[_0x76aa('0xad')](_0x43a2af);ut[_0x76aa('0x98')](_0x43a2af,0xc,_0x4dfeb3[_0x76aa('0xf3')]||_0x4dfeb3[_0x76aa('0xf4')]);_0x7d02e7=_0x30837c[_0x76aa('0xe4')];_0x1eadee=_0x30837c[_0x76aa('0xac')];rpcDb['createCustomerHistory'](_0x43a2af,_0x76aa('0xfb'));_0x368a95['verifyAdditionalPhones'](_0x43a2af,'20',_0x30837c)[_0x76aa('0x84')](function(_0xae171){_0x54390f=_0xae171[_0x76aa('0xaa')]==0x1;if(!_0x54390f){if(ut['totalGlobal'](_0x43a2af)>=_0x30837c[_0x76aa('0xcf')]){_0xa19c1c=ut[_0x76aa('0xae')](_0x43a2af,0xf,_0x76aa('0xaf'));rpcDb[_0x76aa('0xb0')](_0xa19c1c,_0x76aa('0xfc'));}else{rpcDb['createCustomerFinal'](_0x43a2af,_0x76aa('0xfc'));}delete this['actions'][_0x4dfeb3[_0x76aa('0xb6')]];}else{_0x368a95[_0x76aa('0xeb')](_0x43a2af,_0x7d02e7,_0x1eadee)['then'](function(_0x172866){});}});}if(!(_0x43a2af[_0x76aa('0x72')]&&_0x28feb2==='16')){ut[_0x76aa('0x7b')](_0x30837c,_0x76aa('0xfd'));logger[_0x76aa('0x5d')](_0x76aa('0xfe'),_0x43a2af[_0x76aa('0xbc')],_0x76aa('0xbd'),_0x30837c['name'],_0x76aa('0x70'),_0x30837c[_0x76aa('0x52')]);}if(_0x28feb2!==_0x76aa('0xb9')){delete this[_0x76aa('0x16')][_0x4dfeb3[_0x76aa('0xb6')]];delete this[_0x76aa('0x16')][_0x4dfeb3[_0x76aa('0xff')]];}}};Preview[_0x76aa('0xf')]['callProgressDetectingAgent']=function(_0x37331b,_0x28a40a,_0x13d96a){if(_['isUndefined'](_0x28a40a)&&_0x76aa('0x100')!==typeof _0x28a40a){return;}if(_[_0x76aa('0x101')](_0x13d96a)&&_0x76aa('0x100')!==typeof _0x13d96a){return;}switch(_0x13d96a[_0x76aa('0x102')]){case'0':ut[_0x76aa('0x103')](_0x37331b,0x0,'NoSuchNumber');rpcDb[_0x76aa('0x104')](_0x37331b,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x76aa('0x103')](_0x37331b,0x3,_0x76aa('0xd4'));rpcDb[_0x76aa('0x104')](_0x37331b,_0x76aa('0x105'));break;case'5':ut[_0x76aa('0x103')](_0x37331b,0x5,'Busy');rpcDb[_0x76aa('0x104')](_0x37331b,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x76aa('0x103')](_0x37331b,0x8,_0x76aa('0xdc'));rpcDb[_0x76aa('0x104')](_0x37331b,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x76aa('0x103')](_0x37331b,0x16,'AnswerAGI');rpcDb[_0x76aa('0x104')](_0x37331b,_0x76aa('0x106'));break;default:ut[_0x76aa('0x103')](_0x37331b,0xc,_0x13d96a[_0x76aa('0x102')]);rpcDb[_0x76aa('0x104')](_0x37331b,_0x76aa('0x107'));}ut['updateOriginated'](_0x28a40a,_0x76aa('0x108'));logger[_0x76aa('0x5d')](_0x76aa('0x109'),_0x37331b[_0x76aa('0xbc')],_0x76aa('0xbd'),_0x28a40a[_0x76aa('0x28')],_0x76aa('0x70'),_0x28a40a[_0x76aa('0x52')]);delete this[_0x76aa('0x16')][_0x37331b[_0x76aa('0xbc')]];};Preview[_0x76aa('0xf')][_0x76aa('0xa9')]=function(_0x17e02c,_0x1f187c,_0x347f45){return BPromise[_0x76aa('0x10a')]()[_0x76aa('0x84')](cmHopperAdditionalPhone[_0x76aa('0xa9')](_0x17e02c,_0x1f187c,_0x347f45))['catch'](logger[_0x76aa('0x5d')]('[verifyAdditionalPhone]\x20'));};Preview[_0x76aa('0xf')][_0x76aa('0xeb')]=function(_0x4a093b,_0x191435,_0x5305f1){return BPromise[_0x76aa('0x10a')]()[_0x76aa('0x84')](cmHopperAdditionalPhone[_0x76aa('0xeb')](_0x4a093b,_0x191435,_0x5305f1))['catch'](logger[_0x76aa('0x5d')]('[swapAdditionalPhone]\x20'));};Preview['prototype'][_0x76aa('0xd2')]=function(_0x5a06b0){return BPromise[_0x76aa('0x10a')]()['then'](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x5a06b0))[_0x76aa('0x8d')](logger[_0x76aa('0x5d')](_0x76aa('0x10b')));};Preview[_0x76aa('0xf')][_0x76aa('0x10c')]=function(_0x357f87,_0x434634,_0x3fd2e2,_0x334615,_0x167f5c){var _0x43e020=this;return new BPromise(function(_0x2769c6,_0x903d98){if(_[_0x76aa('0x6d')](_0x434634)||_['isNil'](_0x434634[_0x76aa('0x10d')])||_[_0x76aa('0x6d')](_0x434634[_0x76aa('0x10e')])||_[_0x76aa('0x6d')](_0x434634['VoiceQueueId'])){_0x903d98(ut[_0x76aa('0x64')]('Contact\x20is\x20undefined',_0x334615,_0x167f5c));return;}var _0x3c556c=uuid['v4']();var _0x4dc018=_0x43e020[_0x76aa('0x25')][_0x434634['Queue'][_0x76aa('0x28')]];var _0x490090=_0x3fd2e2?_0x43e020[_0x76aa('0x17')][_0x3fd2e2]['id']:undefined;_0x43e020['actions'][_0x3c556c]=new Action(_0x434634,_0x4dc018,_0x3c556c,_0x3fd2e2,_0x490090);var _0xa473c7=_0x43e020[_0x76aa('0x16')][_0x3c556c];_0xa473c7['unlockAgent']=_0x334615;_0xa473c7[_0x76aa('0xb5')]=_0x167f5c;_0xa473c7['lookAgent']=_0x3fd2e2;if(_[_0x76aa('0x10f')](_0x357f87)){_0x43e020['execCall'](_0xa473c7,_0x4dc018,_0x434634,_0x3fd2e2)[_0x76aa('0x84')](function(_0x5648ab){logger['info'](_0x76aa('0x110'),_0x76aa('0x111')+_0xa473c7[_0x76aa('0x6f')]+_0x76aa('0x112')+_0xa473c7[_0x76aa('0xb8')],JSON[_0x76aa('0x5a')](_0x5648ab));ami[_0x76aa('0x26')](_0x76aa('0x113'),ut[_0x76aa('0xa7')](_0xa473c7,_0x76aa('0x114'),_0x43e020['campaignsPreview'][_0xa473c7[_0x76aa('0x6f')]]));_0x2769c6(ut[_0x76aa('0x64')](_0x76aa('0x115')));})[_0x76aa('0x8d')](function(_0x1db1ce){ut[_0x76aa('0x62')](_0x76aa('0x116'),_0x1db1ce);_0x903d98(ut[_0x76aa('0x64')](_0x76aa('0x117'),_0x334615,_0x167f5c));});}else{_0x4dc018[_0x76aa('0x3d')]+=0x1;ut[_0x76aa('0x118')](_0xa473c7);rpcDb[_0x76aa('0x119')](_0xa473c7,_0x76aa('0x11a'));delete _0x43e020[_0x76aa('0x16')][_0x3c556c];_0x903d98(ut['message']('Contact\x20in\x20black\x20List',_0x334615,_0x167f5c));}});};Preview[_0x76aa('0xf')][_0x76aa('0x9f')]=function(_0x2630f8){return!_['isNil'](_0x2630f8)&&!_['isNil'](_0x2630f8[_0x76aa('0x28')])&&!_[_0x76aa('0x6d')](_0x2630f8[_0x76aa('0x57')])&&_0x2630f8['active']&&!_[_0x76aa('0x6d')](this[_0x76aa('0x15')][util['format']('SIP/%s',_0x2630f8['name'])])&&!_[_0x76aa('0x6d')](this[_0x76aa('0x15')][util[_0x76aa('0x5b')]('SIP/%s',_0x2630f8[_0x76aa('0x28')])][_0x76aa('0x78')])&&(this['trunks'][util['format'](_0x76aa('0x11b'),_0x2630f8[_0x76aa('0x28')])][_0x76aa('0x78')]==='reachable'||this[_0x76aa('0x15')][util[_0x76aa('0x5b')]('SIP/%s',_0x2630f8[_0x76aa('0x28')])][_0x76aa('0x78')]==='unmonitored');};Preview[_0x76aa('0xf')][_0x76aa('0x8b')]=function(_0x4b0d8a,_0x2b9978){var _0x4df504=this;return new BPromise(function(_0x54fdb8,_0x159215){_0x4df504[_0x76aa('0x11c')](_0x4b0d8a,_0x2b9978)[_0x76aa('0x84')](function(_0x131c5e){_0x54fdb8(_[_0x76aa('0x73')](_0x131c5e,[_0x76aa('0x64')]));})[_0x76aa('0x8d')](function(_0x159a87){if(_0x159a87[_0x76aa('0x11d')]){rpcDb[_0x76aa('0x11e')](_0x4b0d8a);}if(_0x159a87['active']){rpcDb['disableContact'](_0x4b0d8a);}_0x159215(_[_0x76aa('0x73')](_0x159a87,[_0x76aa('0x64')]));});});};Preview[_0x76aa('0xf')][_0x76aa('0x11c')]=function(_0x1436e8,_0x2c396f){var _0x498278=this;return new BPromise(function(_0x395b34,_0x139553){var _0x17f15e,_0x29fbf6;rpcDb[_0x76aa('0x11f')](_0x1436e8)[_0x76aa('0x84')](function(_0x1c8cf5){if(!_['isNil'](_0x1c8cf5[0x0])){_0x29fbf6=_0x1c8cf5[0x0]['recallme']?![]:!![];_0x17f15e=_0x1c8cf5[0x0]['recallme']?!![]:![];_0x17f15e=_0x2c396f?!![]:_0x17f15e;}var _0x369b1b=_0x498278[_0x76aa('0x120')](_0x1c8cf5);if(_0x369b1b[_0x76aa('0x121')]){rpcDb[_0x76aa('0x122')](_[_0x76aa('0x73')](_0x1c8cf5[0x0],['VoiceQueueId','phone']))[_0x76aa('0x84')](function(_0x2c6127){_0x498278[_0x76aa('0x10c')](_0x2c6127,_0x1c8cf5[0x0],_0x2c396f,_0x29fbf6,_0x17f15e)[_0x76aa('0x84')](function(_0xe6e51a){_0x395b34(_0xe6e51a);})['catch'](function(_0x349c64){_0x139553(_0x349c64);});})['catch'](function(_0x278be5){ut['logger']('[Preview][checkIsBlackList]',_0x278be5);_0x139553(ut[_0x76aa('0x64')]('Call\x20unsuccessful',_0x29fbf6,_0x17f15e));});}else{_0x139553(ut[_0x76aa('0x64')](_0x369b1b[_0x76aa('0x64')],_0x29fbf6,_0x17f15e));}})[_0x76aa('0x8d')](function(_0x2ab1b7){ut[_0x76aa('0x62')](_0x76aa('0x123'),_0x2ab1b7);_0x139553(ut[_0x76aa('0x64')](_0x76aa('0x124'),![],!![]));});});};Preview['prototype'][_0x76aa('0x120')]=function(_0x37fba1){if(_[_0x76aa('0x6d')](_0x37fba1)||_[_0x76aa('0x10f')](_0x37fba1)||!_[_0x76aa('0x6d')](_0x37fba1[0x0]['Agent'])&&_[_0x76aa('0x6d')](_0x37fba1[0x0]['Agent'][_0x76aa('0x28')])){ut['logger'](_0x76aa('0x125'),_0x37fba1);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2fba73=this['campaignsPreview'][_0x37fba1[0x0][_0x76aa('0x126')][_0x76aa('0x28')]];_0x2fba73[_0x76aa('0x64')]='ACTIVE';if(_['isNil'](_0x2fba73)){ut[_0x76aa('0x62')]('[Preview][validateContact][Empty\x20Campaign]',_0x2fba73);return{'isValid':![],'message':_0x76aa('0x127')};}if(!this[_0x76aa('0x9f')](_0x2fba73[_0x76aa('0x56')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20'+_0x2fba73['name']+_0x76aa('0x128'));if(!this[_0x76aa('0x9f')](_0x2fba73[_0x76aa('0xa0')])){ut[_0x76aa('0x62')](_0x76aa('0x129'),_0x2fba73[_0x76aa('0x28')]+_0x76aa('0x12a'));return{'isValid':![],'message':_0x76aa('0x12b')};}}if(!ut[_0x76aa('0x9e')](_0x2fba73[_0x76aa('0x36')])){ut[_0x76aa('0x62')](_0x76aa('0x12c'),_0x2fba73[_0x76aa('0x28')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x76aa('0x12d')+_0x2fba73['name']+_0x76aa('0x12e')};}return{'isValid':!![],'message':_0x76aa('0x12f')};};Preview[_0x76aa('0xf')][_0x76aa('0x130')]=function(_0x654c1b,_0x117def,_0x1aab2f,_0x23fe4f){var _0x2c4744=this;return new BPromise(function(_0x1bdc5c,_0x1ae06a){var _0x50f9a4=_0x654c1b['uniqueid'];var _0x319ded=_0x2c4744[_0x76aa('0x9f')](_0x117def['Trunk'])?util[_0x76aa('0x5b')](_0x76aa('0x131'),_0x117def[_0x76aa('0x56')][_0x76aa('0x28')],_[_0x76aa('0x6d')](_0x117def[_0x76aa('0x3b')])?'':_0x117def[_0x76aa('0x3b')]['trim']()||'',_0x117def[_0x76aa('0x132')]>0x0?_0x1aab2f[_0x76aa('0x10e')]['substring'](_0x117def['dialCutDigit']):_0x1aab2f[_0x76aa('0x10e')]):util[_0x76aa('0x5b')](_0x76aa('0x131'),_[_0x76aa('0x6d')](_0x117def[_0x76aa('0xa0')])?_0x117def[_0x76aa('0x56')][_0x76aa('0x28')]:_0x117def[_0x76aa('0xa0')][_0x76aa('0x28')],_[_0x76aa('0x6d')](_0x117def[_0x76aa('0x3b')])?'':_0x117def[_0x76aa('0x3b')][_0x76aa('0x133')]()||'',_0x117def['dialCutDigit']>0x0?_0x1aab2f['phone'][_0x76aa('0x134')](_0x117def[_0x76aa('0x132')]):_0x1aab2f[_0x76aa('0x10e')]);var _0x2affc8=_0x2c4744['isTrunkReachable'](_0x117def['Trunk'])?ut[_0x76aa('0x135')](_0x117def[_0x76aa('0x56')][_0x76aa('0x58')],_0x117def['dialOriginateCallerIdName'],_0x117def['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x117def[_0x76aa('0x39')],_0x117def['dialRandomLastDigitCallerIdNumber']):_0x117def[_0x76aa('0x39')]):ut[_0x76aa('0x135')](_[_0x76aa('0x6d')](_0x117def[_0x76aa('0xa0')])?_0x117def[_0x76aa('0x56')][_0x76aa('0x58')]:_0x117def[_0x76aa('0xa0')][_0x76aa('0x58')],_0x117def[_0x76aa('0x38')],_0x117def[_0x76aa('0x136')]>0x0?ut[_0x76aa('0x137')](_0x117def[_0x76aa('0x39')],_0x117def[_0x76aa('0x136')]):_0x117def[_0x76aa('0x39')]);if(_0x2affc8){_0x654c1b[_0x76aa('0x138')]=ut[_0x76aa('0x139')](_0x2affc8);_0x654c1b['originatecalleridnum']=ut[_0x76aa('0x13a')](_0x2affc8);}var _0x5e8cec=ut[_0x76aa('0x13b')](_0x117def,_0x1aab2f,_0x319ded,_0x2affc8,_0x50f9a4,_0x654c1b);_['merge'](_0x654c1b,ut[_0x76aa('0x13c')](_0x5e8cec));_0x654c1b['starttime']=moment()[_0x76aa('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');ami['Action'](ut[_0x76aa('0x13d')](_0x654c1b,_0x117def,_0x5e8cec,_0x654c1b[_0x76aa('0xb5')],_0x23fe4f))[_0x76aa('0x84')](function(_0x44668d){_0x117def[_0x76aa('0x52')]+=0x1;logger[_0x76aa('0x5d')]('[originated][increment]',_0x50f9a4,_0x76aa('0xbd'),_0x117def[_0x76aa('0x28')],_0x76aa('0x70'),_0x117def[_0x76aa('0x52')]);_0x1bdc5c(_0x44668d);})['catch'](function(_0x3655dd){ut[_0x76aa('0x103')](_0x654c1b,0xe,_0x76aa('0x13e'));rpcDb[_0x76aa('0x104')](_0x654c1b,_0x76aa('0x13f'));_0x1ae06a(_0x3655dd);});});};Preview[_0x76aa('0xf')][_0x76aa('0x1e')]=function(_0x1a6de3){if(this[_0x76aa('0x16')][_0x1a6de3[_0x76aa('0xb6')]]){this[_0x76aa('0x16')][_0x1a6de3[_0x76aa('0xb6')]]['channel']=_0x1a6de3['channel'];}};Preview[_0x76aa('0xf')][_0x76aa('0x140')]=function(_0x31900c){var _0x37c09b=this;var _0x2969d3=this[_0x76aa('0x16')][_0x31900c[_0x76aa('0x141')]];if(_0x2969d3){if(_0x2969d3[_0x76aa('0x142')]&&this[_0x76aa('0x17')][_0x2969d3[_0x76aa('0x142')]]){ut[_0x76aa('0x143')](_0x2969d3,this['agents'][_0x2969d3[_0x76aa('0x142')]]['name'],this[_0x76aa('0x17')][_0x2969d3[_0x76aa('0x142')]]['id']);}var _0x278bac=_[_0x76aa('0x144')](_0x2969d3);_0x278bac[_0x76aa('0xba')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x3056ad=_0x37c09b['campaignsPreview'][_0x2969d3[_0x76aa('0x6f')]];if(ut[_0x76aa('0x145')](_0x31900c[_0x76aa('0x146')])){if(_0x2969d3[_0x76aa('0xb4')]){rpcDb[_0x76aa('0x11e')](_0x2969d3['idContact']);}if(_0x2969d3['activeContact']){rpcDb[_0x76aa('0x8f')](_0x2969d3[_0x76aa('0xb8')]);}ami[_0x76aa('0x26')](_0x76aa('0x147'),ut[_0x76aa('0xa7')](_0x2969d3,_0x76aa('0x148'),this[_0x76aa('0x25')][_0x2969d3[_0x76aa('0x6f')]]));this[_0x76aa('0x149')](_0x278bac,_0x3056ad,_0x31900c);}else{_0x2969d3[_0x76aa('0x90')]=moment()['format'](_0x76aa('0x91'));ut[_0x76aa('0x103')](_0x278bac,0x4,'Answer');rpcDb[_0x76aa('0x104')](_0x278bac,_0x76aa('0x14a'));}}};Preview[_0x76aa('0xf')][_0x76aa('0x1a')]=function(_0x1a5297){var _0x487c28=this;var _0x44bfb3=this['actions'][_0x1a5297[_0x76aa('0xb6')]];var _0x32d853;if(_0x44bfb3){_0x32d853=this[_0x76aa('0x25')][_0x44bfb3[_0x76aa('0x6f')]];logger['info'](_0x76aa('0x14b'),_0x1a5297[_0x76aa('0xb6')],_0x76aa('0xbd'),_0x32d853[_0x76aa('0x28')],_0x76aa('0x71'),_0x32d853[_0x76aa('0x2d')]);}if(this[_0x76aa('0x16')][_0x1a5297[_0x76aa('0xb6')]]&&_0x1a5297[_0x76aa('0xb6')]!==_0x1a5297[_0x76aa('0xbc')]){if(_0x1a5297[_0x76aa('0x14c')]==='16'&&this[_0x76aa('0x16')][_0x1a5297[_0x76aa('0xb6')]][_0x76aa('0x72')]){this['callProgressDetectingCustomer'](_0x1a5297,_0x1a5297['linkedid'],_0x1a5297[_0x76aa('0x14c')]);}else if(this[_0x76aa('0x16')][_0x1a5297['linkedid']][_0x76aa('0x72')]){logger['info'](_0x76aa('0x14d'),_0x1a5297[_0x76aa('0xb6')],_0x1a5297[_0x76aa('0x14c')],_0x76aa('0xbd'),_0x32d853[_0x76aa('0x28')],_0x76aa('0x71'),_0x32d853[_0x76aa('0x2d')]);this[_0x76aa('0xa3')](_0x1a5297,_0x1a5297['linkedid'],_0x1a5297[_0x76aa('0x14c')]);}}else if(_0x44bfb3&&_[_0x76aa('0x6d')](_0x44bfb3['statedesc'])&&_0x32d853['dialQueueProject']&&_0x1a5297[_0x76aa('0xb6')]===_0x1a5297[_0x76aa('0xbc')]&&_[_0x76aa('0x6d')](_0x1a5297[_0x76aa('0x102')])&&_0x1a5297[_0x76aa('0x14c')]==='16'&&_0x1a5297['channelstate']==='6'&&_[_0x76aa('0x101')](_0x44bfb3['transfer'])){if(_0x44bfb3[_0x76aa('0xb4')]){rpcDb[_0x76aa('0x11e')](_0x44bfb3[_0x76aa('0xb8')]);}if(_0x44bfb3[_0x76aa('0xb5')]){rpcDb[_0x76aa('0x8f')](_0x44bfb3[_0x76aa('0xb8')]);}_0x1a5297[_0x76aa('0x102')]='22';this[_0x76aa('0x149')](_0x44bfb3,_0x32d853,_0x1a5297);}else if(_0x44bfb3&&_0x44bfb3[_0x76aa('0x14e')]){if(_0x1a5297[_0x76aa('0x14c')]==='16'&&this[_0x76aa('0x16')][_0x1a5297[_0x76aa('0xb6')]][_0x76aa('0x72')]){logger['info'](_0x76aa('0x14f'),_0x1a5297['linkedid'],_0x1a5297['cause'],'\x20Queue',_0x32d853[_0x76aa('0x28')],'pTalking:\x20',_0x32d853['pTalking']);this['callProgressDetectingCustomer'](_0x1a5297,_0x1a5297['linkedid'],_0x1a5297[_0x76aa('0x14c')]);}else if(this[_0x76aa('0x16')][_0x1a5297['linkedid']][_0x76aa('0x72')]){logger[_0x76aa('0x5d')](_0x76aa('0x14d'),_0x1a5297['linkedid'],_0x1a5297['cause'],'\x20Queue',_0x32d853[_0x76aa('0x28')],'pTalking:\x20',_0x32d853[_0x76aa('0x2d')]);this[_0x76aa('0xa3')](_0x1a5297,_0x1a5297['linkedid'],_0x1a5297[_0x76aa('0x14c')]);}}};Preview[_0x76aa('0xf')]['syncDialEnd']=function(_0x2b10fd){if(this[_0x76aa('0x16')][_0x2b10fd[_0x76aa('0xff')]]&&_0x2b10fd[_0x76aa('0xff')]!==_0x2b10fd[_0x76aa('0x150')]){this[_0x76aa('0xa3')](_0x2b10fd,_0x2b10fd[_0x76aa('0xff')],_0x2b10fd[_0x76aa('0xf4')]);}};Preview['prototype'][_0x76aa('0x1b')]=function(_0x9e4831){if(this[_0x76aa('0x16')][_0x9e4831[_0x76aa('0xb6')]]&&_0x9e4831[_0x76aa('0xb6')]!==_0x9e4831[_0x76aa('0xbc')]&&!this[_0x76aa('0x16')][_0x9e4831[_0x76aa('0xb6')]][_0x76aa('0x72')]){if(_0x9e4831[_0x76aa('0x14c')]==='1'){this['callProgressDetectingCustomer'](_0x9e4831,_0x9e4831[_0x76aa('0xb6')],_0x9e4831[_0x76aa('0x14c')]);}}};Preview[_0x76aa('0xf')]['addVariable']=function(_0x5baab3,_0x5bd9f1,_0x1592d0){if(this[_0x76aa('0x16')][_0x5baab3]){if(_['isNil'](this[_0x76aa('0x16')][_0x5baab3]['variables'])){this['actions'][_0x5baab3][_0x76aa('0x151')]={};}this[_0x76aa('0x16')][_0x5baab3]['variables'][_0x5bd9f1]=_0x1592d0;}};Preview[_0x76aa('0xf')][_0x76aa('0x20')]=function(_0x60ba1f){try{if(!_['isNil'](_0x60ba1f)){if(ut[_0x76aa('0x152')](_[_0x76aa('0x153')](_0x60ba1f[_0x76aa('0x154')])[0x0])){this[_0x76aa('0x155')](_0x60ba1f[_0x76aa('0xbc')],_[_0x76aa('0x153')](_0x60ba1f[_0x76aa('0x154')])[0x0],_0x60ba1f[_0x76aa('0x156')]);}}}catch(_0x472573){logger[_0x76aa('0x157')](_0x76aa('0x158'),util['inspect'](_0x472573,{'showHidden':![],'depth':null}));}};Preview[_0x76aa('0xf')][_0x76aa('0x21')]=function(_0xf0c2e9){if(_0xf0c2e9){if(this['actions'][_0xf0c2e9['transfertargetlinkedid']]){this[_0x76aa('0x16')][_0xf0c2e9[_0x76aa('0x159')]][_0x76aa('0x14e')]=!![];}}};Preview['prototype'][_0x76aa('0x23')]=function(_0x38fcbf){if(_0x38fcbf){if(this[_0x76aa('0x16')][_0x38fcbf[_0x76aa('0x15a')]]){this[_0x76aa('0x16')][_0x38fcbf[_0x76aa('0x15a')]][_0x76aa('0x14e')]=!![];}}};module[_0x76aa('0x15b')]=Preview;
\ No newline at end of file
+var _0x8ef6=['setMessage','dialPreviewAutoRecallMe','recallMe','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','pick','contactId','UserId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','format','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','createCustomerHistory','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','YYYY-MM-DD\x20HH:mm:ss','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','complete','[16]','talktime','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','incrementPreviewCounters','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','swapAdditionalPhones','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','Contact','phone','Contact\x20is\x20undefined','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','run','execRun','unlockContact','disableContact','getContactPreview','recallme','validateContact','checkIsBlackList','VoiceQueueId','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','toLowerVariables','starttime','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','dialQueueProject','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','variables','syncVarSet','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','preview','actionPreview','../rpc/cmHopperAdditionalPhone','./action','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','varset','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','message','originated','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','name','active','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','clearZombieChannels','outbound'];(function(_0x1032f4,_0x1a98cb){var _0x4a4581=function(_0x1184e7){while(--_0x1184e7){_0x1032f4['push'](_0x1032f4['shift']());}};_0x4a4581(++_0x1a98cb);}(_0x8ef6,0xf2));var _0x68ef=function(_0xeae898,_0x1f5001){_0xeae898=_0xeae898-0x0;var _0x58616e=_0x8ef6[_0xeae898];return _0x58616e;};'use strict';var util=require(_0x68ef('0x0'));var _=require(_0x68ef('0x1'));var BPromise=require(_0x68ef('0x2'));var uuid=require(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var md5=require(_0x68ef('0x5'));var Redis=require(_0x68ef('0x6'));var config=require('../../../config/environment');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var loggerAction=require(_0x68ef('0x7'))(_0x68ef('0x9'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x68ef('0xa'));var Action=require(_0x68ef('0xb'));var ut=require(_0x68ef('0xc'));config['redis']=_[_0x68ef('0xd')](config[_0x68ef('0xe')],{'host':_0x68ef('0xf'),'port':0x18eb});var io=require(_0x68ef('0x10'))(new Redis(config[_0x68ef('0xe')]));var Sequence=function(){};Sequence[_0x68ef('0x11')][_0x68ef('0x12')]=function(_0x23da00){this[_0x68ef('0x13')]=this[_0x68ef('0x13')]?this[_0x68ef('0x13')][_0x68ef('0x14')](_0x23da00):_0x23da00();};function Preview(_0x582a79){this[_0x68ef('0x15')]=new Sequence();this[_0x68ef('0x16')]=_0x582a79[_0x68ef('0x17')];this[_0x68ef('0x18')]=_0x582a79[_0x68ef('0x18')];this[_0x68ef('0x19')]={};this['agents']=_0x582a79[_0x68ef('0x1a')];this[_0x68ef('0x1b')]=0x0;ami['on'](_0x68ef('0x1c'),this['syncOriginateResponse'][_0x68ef('0x1d')](this));ami['on'](_0x68ef('0x1e'),this[_0x68ef('0x1f')]['bind'](this));ami['on'](_0x68ef('0x20'),this[_0x68ef('0x21')][_0x68ef('0x1d')](this));ami['on'](_0x68ef('0x22'),this['syncDialEnd'][_0x68ef('0x1d')](this));ami['on']('newexten',this['syncNewExten'][_0x68ef('0x1d')](this));ami['on'](_0x68ef('0x23'),this['syncVarSet']['bind'](this));ami['on'](_0x68ef('0x24'),this[_0x68ef('0x25')][_0x68ef('0x1d')](this));ami['on']('blindtransfer',this[_0x68ef('0x26')][_0x68ef('0x1d')](this));this[_0x68ef('0x27')](this['campaignsPreview']);}function emit(_0x3c46d4,_0x3be4c0,_0x5af19f){io['to'](_0x3c46d4)[_0x68ef('0x28')](_0x3be4c0,_0x5af19f);}function emitCampaignPreview(_0xf4760f){if(_0xf4760f[_0x68ef('0x29')]==='outbound'){var _0x59723c={'id':_0xf4760f['id'],'name':_0xf4760f['name'],'strategy':_0xf4760f[_0x68ef('0x2a')],'answered':_0xf4760f[_0x68ef('0x2b')],'available':_0xf4760f[_0x68ef('0x2c')],'loggedIn':_0xf4760f[_0x68ef('0x2d')],'pTalking':_0xf4760f[_0x68ef('0x2e')],'sumBillable':_0xf4760f[_0x68ef('0x2f')],'sumDuration':_0xf4760f[_0x68ef('0x30')],'sumHoldTime':_0xf4760f[_0x68ef('0x31')]||0x0,'talking':_0xf4760f[_0x68ef('0x32')],'total':_0xf4760f[_0x68ef('0x33')],'type':_0xf4760f['type'],'unmanaged':_0xf4760f[_0x68ef('0x34')],'abandoned':_0xf4760f['abandoned'],'waiting':_0xf4760f['waiting'],'loggedInDb':_0xf4760f['loggedInDb'],'dialActive':_0xf4760f[_0x68ef('0x35')],'dialMethod':_0xf4760f[_0x68ef('0x36')],'dialOriginateCallerIdName':_0xf4760f[_0x68ef('0x37')],'dialOriginateCallerIdNumber':_0xf4760f[_0x68ef('0x38')],'dialOriginateTimeout':_0xf4760f['dialOriginateTimeout'],'dialPrefix':_0xf4760f['dialPrefix'],'outboundAnswerAgiCallsDay':_0xf4760f[_0x68ef('0x39')],'outboundAnswerCallsDay':_0xf4760f[_0x68ef('0x3a')],'outboundBlacklistCallsDay':_0xf4760f[_0x68ef('0x3b')],'outboundBusyCallsDay':_0xf4760f[_0x68ef('0x3c')],'outboundCongestionCallsDay':_0xf4760f[_0x68ef('0x3d')],'outboundDropCallsDayACS':_0xf4760f[_0x68ef('0x3e')],'outboundDropCallsDayCallersExit':_0xf4760f[_0x68ef('0x3f')],'outboundDropCallsDayTimeout':_0xf4760f[_0x68ef('0x40')],'outboundNoAnswerCallsDay':_0xf4760f['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xf4760f[_0x68ef('0x41')],'outboundOriginateFailureCallsDay':_0xf4760f[_0x68ef('0x42')],'outboundReCallsDay':_0xf4760f[_0x68ef('0x43')],'outboundRejectCallsDay':_0xf4760f['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0xf4760f[_0x68ef('0x44')],'outboundAbandonedCallsDay':_0xf4760f['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0xf4760f[_0x68ef('0x45')],'predictiveIntervalAvgHoldtime':_0xf4760f[_0x68ef('0x46')],'predictiveIntervalAvgTalktime':_0xf4760f['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0xf4760f['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0xf4760f[_0x68ef('0x47')],'predictiveIntervalErlangCalls':_0xf4760f[_0x68ef('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0xf4760f['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xf4760f[_0x68ef('0x49')],'predictiveIntervalMultiplicativeFactor':_0xf4760f[_0x68ef('0x4a')],'predictiveIntervalPauses':_0xf4760f[_0x68ef('0x4b')],'predictiveIntervalAvailable':_0xf4760f[_0x68ef('0x4c')],'predictiveIntervalTotalCalls':_0xf4760f['predictiveIntervalTotalCalls'],'message':_0xf4760f[_0x68ef('0x4d')],'originated':_0xf4760f[_0x68ef('0x4e')],'erlangCalls':_0xf4760f['erlangCalls'],'erlangCallToSecond':_0xf4760f[_0x68ef('0x4f')],'erlangAbandonmentRate':_0xf4760f['erlangAbandonmentRate'],'erlangBusyFactor':_0xf4760f[_0x68ef('0x50')],'startPredictive':_0xf4760f[_0x68ef('0x51')],'startProgressive':_0xf4760f['startProgressive']};if(_0xf4760f[_0x68ef('0x52')]){_0x59723c['Trunk']={'id':_0xf4760f[_0x68ef('0x52')]['id'],'name':_0xf4760f['Trunk'][_0x68ef('0x53')],'active':_0xf4760f[_0x68ef('0x52')][_0x68ef('0x54')],'callerid':_0xf4760f['Trunk'][_0x68ef('0x55')]};}if(_0xf4760f['Interval']){_0x59723c[_0x68ef('0x56')]={'id':_0xf4760f['Interval']['id'],'name':_0xf4760f[_0x68ef('0x56')][_0x68ef('0x53')]};}var _0x102df9=md5(JSON[_0x68ef('0x57')](_0x59723c));if(_0xf4760f[_0x68ef('0x5')]!==_0x102df9){_0xf4760f[_0x68ef('0x5')]=_0x102df9;emit(util['format'](_0x68ef('0x58'),_0x59723c[_0x68ef('0x53')]),_0x68ef('0x59'),_0x59723c);}}}function emitVoiceQueueChannelRemove(_0x52a8b9){logger[_0x68ef('0x5a')](_0x68ef('0x5b'),JSON[_0x68ef('0x57')](_0x52a8b9));emit(util['format']('voice:queue:%s',_0x52a8b9[_0x68ef('0x53')]),_0x68ef('0x5c'),_0x52a8b9);io[_0x68ef('0x28')](_0x68ef('0x5d'),_0x52a8b9);}function notSendMessagesQueue(_0x401459){if(_0x401459[_0x68ef('0x5e')]){if(_0x401459[_0x68ef('0x4e')]===0x0&&_0x401459['pTalking']===0x0){_0x401459[_0x68ef('0x5e')]=![];_0x401459[_0x68ef('0x2c')]=0x0;_0x401459[_0x68ef('0x5f')]=0x0;_0x401459[_0x68ef('0x4d')]='NOT_ACTIVE';ut[_0x68ef('0x60')](_0x68ef('0x61'),_0x401459[_0x68ef('0x53')]+_0x68ef('0x62'));}else{_0x401459[_0x68ef('0x4d')]=_0x68ef('0x63');ut['logger'](_0x68ef('0x61'),_0x401459[_0x68ef('0x53')]+_0x68ef('0x64'));}emitCampaignPreview(_0x401459);}}Preview[_0x68ef('0x11')][_0x68ef('0x27')]=function(){var _0x32d5c3=this;setInterval(function(){_0x32d5c3[_0x68ef('0x65')]();},0x7cf);};Preview[_0x68ef('0x11')][_0x68ef('0x65')]=function(){var _0x531096=this[_0x68ef('0x16')];this[_0x68ef('0x1b')]+=0x1;for(var _0x3609c8 in _0x531096){if(_0x531096[_0x68ef('0x66')](_0x3609c8)&&(_0x531096[_0x3609c8][_0x68ef('0x36')]===_0x68ef('0x8')||_0x531096[_0x3609c8][_0x68ef('0x36')]==='booked')&&_0x531096[_0x3609c8][_0x68ef('0x29')]==='outbound'){if(this[_0x68ef('0x1b')]>0x7){this[_0x68ef('0x1b')]=0x0;this[_0x68ef('0x67')]();}}if(_0x531096[_0x68ef('0x66')](_0x3609c8)&&_0x531096[_0x3609c8]['dialMethod']===_0x68ef('0x8')&&_0x531096[_0x3609c8]['type']===_0x68ef('0x68')){if(_0x531096[_0x3609c8]['dialActive']){this[_0x68ef('0x69')](_0x531096[_0x3609c8]);if(_0x531096[_0x3609c8][_0x68ef('0x6a')])this[_0x68ef('0x6b')](_0x531096[_0x3609c8]);}else{notSendMessagesQueue(_0x531096[_0x3609c8]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x4044d5){var _0x399055=this;this['sequence']['enqueue'](function(){if(!_['isNil'](_0x399055[_0x68ef('0x19')][_0x4044d5])){loggerAction[_0x68ef('0x5a')](_0x68ef('0x6c'),_0x4044d5,_0x68ef('0x6d'),_0x399055[_0x68ef('0x19')][_0x4044d5]['queue'],'originated:\x20',JSON[_0x68ef('0x57')](_0x399055[_0x68ef('0x16')][_0x399055[_0x68ef('0x19')][_0x4044d5][_0x68ef('0x6e')]]['originated']),_0x68ef('0x6f'),JSON[_0x68ef('0x57')](_0x399055[_0x68ef('0x16')][_0x399055[_0x68ef('0x19')][_0x4044d5]['queue']]['pTalking']),JSON[_0x68ef('0x57')](_0x399055[_0x68ef('0x19')][_0x4044d5]['dialAnswer']),JSON[_0x68ef('0x57')](_[_0x68ef('0x70')](_0x399055[_0x68ef('0x19')][_0x4044d5],[_0x68ef('0x71'),_0x68ef('0x72'),'VoiceQueueId',_0x68ef('0x73')])));return ami[_0x68ef('0x74')]({'action':_0x68ef('0x75'),'channel':_0x399055['actions'][_0x4044d5][_0x68ef('0x76')]})[_0x68ef('0x77')](function(_0x2c6863){if(_0x2c6863['message']===_0x68ef('0x78')){setTimeout(function(){if(_0x399055['actions'][_0x4044d5]){ut['updateOriginated'](_0x399055[_0x68ef('0x16')][_0x399055['actions'][_0x4044d5][_0x68ef('0x6e')]],_0x68ef('0x79'));if(_0x399055[_0x68ef('0x19')][_0x4044d5][_0x68ef('0x7a')]===!![]){ut[_0x68ef('0x7b')](_0x399055[_0x68ef('0x16')][_0x399055[_0x68ef('0x19')][_0x4044d5][_0x68ef('0x6e')]],_0x68ef('0x79'));ut[_0x68ef('0x7c')]('[Dialer][checkChannel][pTalking][Preview]'+_0x4044d5,_0x399055['actions'][_0x4044d5][_0x68ef('0x6e')]);}ut[_0x68ef('0x7c')](_0x68ef('0x7d')+_0x4044d5,_0x399055[_0x68ef('0x19')][_0x4044d5][_0x68ef('0x6e')]);delete _0x399055[_0x68ef('0x19')][_0x4044d5];}},0x2328);}});}});};Preview[_0x68ef('0x11')][_0x68ef('0x67')]=function(){var _0x40c784=this;loggerAction['info']('[action]',_[_0x68ef('0x7e')](this['actions']));for(var _0x459b21 in this['actions']){if(_0x40c784[_0x68ef('0x19')][_0x68ef('0x66')](_0x459b21)){_0x40c784['clearZombieChannel'](_0x459b21);}}};Preview[_0x68ef('0x11')]['recallMe']=function(_0x407c6d){var _0x15c1ee=this;rpcDb[_0x68ef('0x7f')](_0x407c6d['id'],ut[_0x68ef('0x80')](this[_0x68ef('0x1a')]))[_0x68ef('0x81')](function(_0x5c347c){if(!_[_0x68ef('0x82')](_0x5c347c)){for(var _0x1f770f=0x0;_0x1f770f<_0x5c347c[_0x68ef('0x83')];_0x1f770f+=0x1){if(ut[_0x68ef('0x84')](_0x5c347c[_0x1f770f][_0x68ef('0x85')])<_0x407c6d[_0x68ef('0x86')]*0x3c){if(_0x5c347c[_0x1f770f]['Agent']&&!_0x5c347c[_0x1f770f][_0x68ef('0x87')][_0x68ef('0x88')]){_0x15c1ee['run'](_0x5c347c[_0x1f770f]['id'])[_0x68ef('0x81')](ut[_0x68ef('0x89')](_0x68ef('0x8a')))['catch'](ut[_0x68ef('0x89')]('[RecallMe]'));}else{rpcDb['disableContact'](_0x5c347c[_0x1f770f]['id']);}}else{var _0x3e5cca=new Action(_0x5c347c[_0x1f770f],_0x407c6d);_0x3e5cca['starttime']=moment()[_0x68ef('0x8b')]('YYYY-MM-DD\x20HH:mm:ss');_0x407c6d[_0x68ef('0x43')]+=0x1;ut[_0x68ef('0x8c')](_0x3e5cca,0x17,_0x68ef('0x8d'));if(_0x407c6d[_0x68ef('0x8e')]){rpcDb[_0x68ef('0x8f')](ut[_0x68ef('0x90')](_0x5c347c[_0x1f770f]));rpcDb['createCustomerHistory'](_0x3e5cca,_0x68ef('0x91'));}else{ut['logCustomer'](_0x3e5cca,0x16,_0x68ef('0x92'));rpcDb['createCustomerHistory'](_0x3e5cca,_0x68ef('0x93'));rpcDb[_0x68ef('0x94')](_0x3e5cca,_0x68ef('0x93'));}}}}})[_0x68ef('0x77')](ut[_0x68ef('0x89')](_0x68ef('0x95')));};Preview[_0x68ef('0x11')]['setMessage']=function(_0x3ea4e7){_0x3ea4e7[_0x68ef('0x5e')]=!![];if(ut[_0x68ef('0x96')](_0x3ea4e7[_0x68ef('0x2d')])){_0x3ea4e7[_0x68ef('0x4d')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x68ef('0x97')](_0x3ea4e7['dialActive'])){_0x3ea4e7[_0x68ef('0x4d')]='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x3ea4e7[_0x68ef('0x52')])){if(!this[_0x68ef('0x98')](_0x3ea4e7[_0x68ef('0x99')])){_0x3ea4e7[_0x68ef('0x4d')]='TRUNK_IS_NOT_REACHABLE';}else{_0x3ea4e7[_0x68ef('0x4d')]='ACTIVE';}}else{_0x3ea4e7[_0x68ef('0x4d')]=_0x68ef('0x9a');}emitCampaignPreview(_0x3ea4e7);};Preview[_0x68ef('0x11')]['callProgressDetectingCustomer']=function(_0x541e35,_0x3e74d2,_0x1092f8){var _0x24d7f7=this;var _0x454c6f=this['actions'][_0x3e74d2];var _0x335ba8=this[_0x68ef('0x16')][_0x454c6f[_0x68ef('0x6e')]];var _0x21b104;var _0x5089b3=![];var _0x3f56a7=0x2;var _0x53a601=0x3;if(_0x335ba8){switch(_0x1092f8){case'1':_0x335ba8[_0x68ef('0x41')]+=0x1;_0x454c6f[_0x68ef('0x9b')]+=0x1;_0x454c6f[_0x68ef('0x9c')]=ut[_0x68ef('0x9d')](_0x454c6f);ut[_0x68ef('0x8c')](_0x454c6f,0x0,'NoSuchNumber');ami[_0x68ef('0x28')](_0x68ef('0x9e'),ut[_0x68ef('0x9f')](_0x454c6f,'nosuchnumber'));rpcDb[_0x68ef('0xa0')](_0x454c6f,'[callProgressDetectingCustomer][logNoSuch]');_0x24d7f7[_0x68ef('0xa1')](_0x454c6f,'0',_0x335ba8)['then'](function(_0x4c70c0){_0x5089b3=_0x4c70c0[_0x68ef('0xa2')]==0x1;_0x3f56a7=_0x335ba8[_0x68ef('0xa3')];_0x53a601=_0x335ba8[_0x68ef('0xa4')];if(!_0x5089b3){if(ut[_0x68ef('0x9d')](_0x454c6f)>=_0x335ba8['dialGlobalMaxRetry']){_0x21b104=ut[_0x68ef('0xa5')](_0x454c6f,0xf,_0x68ef('0xa6'));rpcDb[_0x68ef('0x94')](_0x21b104,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x454c6f[_0x68ef('0x9b')]>=_0x335ba8[_0x68ef('0xa7')]){rpcDb[_0x68ef('0x94')](_0x454c6f,_0x68ef('0xa8'));}else{rpcDb[_0x68ef('0xa9')](ut[_0x68ef('0xaa')](_0x454c6f,_0x68ef('0x9b'),_0x335ba8[_0x68ef('0xa3')]),_0x454c6f[_0x68ef('0xab')],_0x454c6f[_0x68ef('0xac')]);}}delete this[_0x68ef('0x19')][_0x541e35[_0x68ef('0xad')]];}else{_0x454c6f['countnosuchnumberretry']++;logger[_0x68ef('0x5a')](_0x68ef('0xae'),_0x454c6f['countnosuchnumberretry']);logger['info']('id',_0x454c6f[_0x68ef('0xaf')]);_0x24d7f7['incrementPreviewCounters']({'id':_0x454c6f[_0x68ef('0xaf')],'field':{'countnosuchnumberretry':_0x454c6f[_0x68ef('0x9b')]}})['then'](function(){_0x24d7f7['swapAdditionalPhones'](_0x454c6f,_0x3f56a7,_0x53a601)[_0x68ef('0x81')](function(){});});}});break;case'ANSWER':var _0x279059=moment()['format'](_0x68ef('0xb0'));_0x454c6f['responsetime']=_0x279059;_0x454c6f[_0x68ef('0xb1')]=_0x279059;_0x454c6f[_0x68ef('0x7a')]=!![];_0x335ba8['pTalking']+=0x1;logger[_0x68ef('0x5a')](_0x68ef('0xb2'),_0x454c6f[_0x68ef('0xb3')],_0x68ef('0xb4'),_0x335ba8['name'],_0x68ef('0x6f'),_0x335ba8[_0x68ef('0x2e')]);ami['emit'](_0x68ef('0xb5'),ut[_0x68ef('0x9f')](_0x454c6f,_0x68ef('0xb6'),this['campaignsPreview'][_0x454c6f[_0x68ef('0x6e')]]));if(_0x335ba8['acw']){ami[_0x68ef('0x28')](_0x68ef('0xb7'),ut['buildAcw'](_0x454c6f));}break;case'16':ami['emit']('custom:agentcomplete',ut['buildObj'](_0x454c6f,_0x68ef('0xb8'),this[_0x68ef('0x16')][_0x454c6f[_0x68ef('0x6e')]]));emitVoiceQueueChannelRemove(ut[_0x68ef('0x9f')](_0x454c6f,_0x68ef('0xb8')));_0x335ba8[_0x68ef('0x3a')]+=0x1;_0x335ba8[_0x68ef('0x33')]+=0x1;_0x335ba8[_0x68ef('0x2b')]+=0x1;ut[_0x68ef('0x7b')](_0x335ba8,_0x68ef('0xb9'));_0x454c6f[_0x68ef('0x9c')]=ut[_0x68ef('0x9d')](_0x454c6f);ut[_0x68ef('0x8c')](_0x454c6f,0x4,'Answer');rpcDb[_0x68ef('0xa0')](_0x454c6f,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x68ef('0x94')](_0x454c6f,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x454c6f);_0x335ba8[_0x68ef('0x30')]+=_0x454c6f[_0x68ef('0xba')];_0x335ba8[_0x68ef('0x2f')]+=_0x454c6f[_0x68ef('0xba')];logger['info']('[syncHangup][talking][decrement]',_0x454c6f[_0x68ef('0xb3')],_0x68ef('0xb4'),_0x335ba8[_0x68ef('0x53')],'pTalking:\x20',_0x335ba8[_0x68ef('0x2e')]);delete this[_0x68ef('0x19')][_0x541e35[_0x68ef('0xad')]];break;case _0x68ef('0xbb'):_0x335ba8['outboundBusyCallsDay']+=0x1;_0x454c6f[_0x68ef('0xbc')]+=0x1;_0x454c6f[_0x68ef('0x9c')]=ut[_0x68ef('0x9d')](_0x454c6f);ut[_0x68ef('0x8c')](_0x454c6f,0x5,_0x68ef('0xbd'));_0x3f56a7=_0x335ba8[_0x68ef('0xbe')];_0x53a601=_0x335ba8['callAdditionalPhoneAfterMin'];ami[_0x68ef('0x28')]('custom:agentbusy',ut[_0x68ef('0x9f')](_0x454c6f,_0x68ef('0xbf')));rpcDb[_0x68ef('0xa0')](_0x454c6f,_0x68ef('0xc0'));_0x24d7f7['verifyAdditionalPhones'](_0x454c6f,'5',_0x335ba8)[_0x68ef('0x81')](function(_0x4c47ab){_0x5089b3=_0x4c47ab[_0x68ef('0xa2')]==0x1;if(!_0x5089b3){if(ut[_0x68ef('0x9d')](_0x454c6f)>=_0x335ba8['dialGlobalMaxRetry']){_0x21b104=ut['cloneAction'](_0x454c6f,0xf,_0x68ef('0xa6'));rpcDb['createCustomerFinal'](_0x21b104,_0x68ef('0xc1'));}else{if(_0x454c6f['countbusyretry']>=_0x335ba8[_0x68ef('0xc2')]){rpcDb[_0x68ef('0x94')](_0x454c6f,_0x68ef('0xc0'));}else{rpcDb[_0x68ef('0xa9')](ut[_0x68ef('0xaa')](_0x454c6f,_0x68ef('0xbc'),_0x335ba8['dialBusyRetryFrequency']),_0x454c6f[_0x68ef('0xab')],_0x454c6f[_0x68ef('0xac')]);}}}else{_0x454c6f[_0x68ef('0xbc')]++;_0x24d7f7[_0x68ef('0xc3')]({'id':_0x454c6f[_0x68ef('0xaf')],'field':{'countbusyretry':_0x454c6f[_0x68ef('0xbc')]}})[_0x68ef('0x81')](function(){_0x24d7f7['swapAdditionalPhones'](_0x454c6f,_0x3f56a7,_0x53a601)[_0x68ef('0x81')](function(){});});}});break;case _0x68ef('0xc4'):_0x335ba8[_0x68ef('0xc5')]+=0x1;_0x454c6f[_0x68ef('0xc6')]+=0x1;_0x454c6f[_0x68ef('0x9c')]=ut[_0x68ef('0x9d')](_0x454c6f);ut[_0x68ef('0x8c')](_0x454c6f,0x3,_0x68ef('0xc7'));_0x3f56a7=_0x335ba8[_0x68ef('0xc8')];_0x53a601=_0x335ba8['callAdditionalPhoneAfterMin'];ami[_0x68ef('0x28')]('custom:agentnoanswer',ut['buildObj'](_0x454c6f,'noanswer'));rpcDb[_0x68ef('0xa0')](_0x454c6f,_0x68ef('0xc9'));_0x24d7f7[_0x68ef('0xa1')](_0x454c6f,'3',_0x335ba8)['then'](function(_0x5aa209){_0x5089b3=_0x5aa209['additional']==0x1;if(!_0x5089b3){if(ut[_0x68ef('0x9d')](_0x454c6f)>=_0x335ba8[_0x68ef('0xca')]){_0x21b104=ut[_0x68ef('0xa5')](_0x454c6f,0xf,_0x68ef('0xa6'));rpcDb[_0x68ef('0x94')](_0x21b104,_0x68ef('0xcb'));}else{if(_0x454c6f['countnoanswerretry']>=_0x335ba8[_0x68ef('0xcc')]){rpcDb[_0x68ef('0x94')](_0x454c6f,_0x68ef('0xc9'));}else{rpcDb[_0x68ef('0xa9')](ut['scheduledAt'](_0x454c6f,_0x68ef('0xc6'),_0x335ba8[_0x68ef('0xc8')]),_0x454c6f[_0x68ef('0xab')],_0x454c6f[_0x68ef('0xac')]);}}}else{_0x454c6f[_0x68ef('0xc6')]++;_0x24d7f7[_0x68ef('0xc3')]({'id':_0x454c6f[_0x68ef('0xaf')],'field':{'countnoanswerretry':_0x454c6f[_0x68ef('0xc6')]}})['then'](function(){_0x24d7f7[_0x68ef('0xcd')](_0x454c6f,_0x3f56a7,_0x53a601)[_0x68ef('0x81')](function(){});});}});break;case'CONGESTION':_0x335ba8[_0x68ef('0x3d')]+=0x1;_0x454c6f[_0x68ef('0xce')]+=0x1;_0x454c6f[_0x68ef('0x9c')]=ut[_0x68ef('0x9d')](_0x454c6f);ut[_0x68ef('0x8c')](_0x454c6f,0x8,_0x68ef('0xcf'));_0x3f56a7=_0x335ba8[_0x68ef('0xd0')];_0x53a601=_0x335ba8[_0x68ef('0xa4')];ami[_0x68ef('0x28')](_0x68ef('0xd1'),ut[_0x68ef('0x9f')](_0x454c6f,_0x68ef('0xd2')));rpcDb[_0x68ef('0xa0')](_0x454c6f,_0x68ef('0xd3'));_0x24d7f7[_0x68ef('0xa1')](_0x454c6f,'8',_0x335ba8)[_0x68ef('0x81')](function(_0x468130){_0x5089b3=_0x468130[_0x68ef('0xa2')]==0x1;if(!_0x5089b3){if(ut['totalGlobal'](_0x454c6f)>=_0x335ba8[_0x68ef('0xca')]){_0x21b104=ut[_0x68ef('0xa5')](_0x454c6f,0xf,_0x68ef('0xa6'));rpcDb[_0x68ef('0x94')](_0x21b104,_0x68ef('0xd4'));}else{if(_0x454c6f['countcongestionretry']>=_0x335ba8[_0x68ef('0xd5')]){rpcDb[_0x68ef('0x94')](_0x454c6f,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x68ef('0xa9')](ut['scheduledAt'](_0x454c6f,'countcongestionretry',_0x335ba8['dialBusyRetryFrequency']),_0x454c6f['unlockAgent'],_0x454c6f[_0x68ef('0xac')]);}}}else{_0x454c6f['countcongestionretry']++;_0x24d7f7[_0x68ef('0xc3')]({'id':_0x454c6f['idContact'],'field':{'countcongestionretry':_0x454c6f['countcongestionretry']}})['then'](function(){_0x24d7f7[_0x68ef('0xcd')](_0x454c6f,_0x3f56a7,_0x53a601)[_0x68ef('0x81')](function(){});});}});break;case _0x68ef('0xd6'):_0x335ba8[_0x68ef('0xd7')]+=0x1;_0x454c6f[_0x68ef('0xd8')]+=0x1;_0x454c6f['countglobal']=ut[_0x68ef('0x9d')](_0x454c6f);ut[_0x68ef('0x8c')](_0x454c6f,0x14,_0x68ef('0xd9'));_0x3f56a7=_0x335ba8[_0x68ef('0xda')];_0x53a601=_0x335ba8['callAdditionalPhoneAfterMin'];ami[_0x68ef('0x28')]('custom:agentreject',ut['buildObj'](_0x454c6f,'agentreject'));rpcDb[_0x68ef('0xa0')](_0x454c6f,_0x68ef('0xdb'));_0x24d7f7[_0x68ef('0xa1')](_0x454c6f,'20',_0x335ba8)[_0x68ef('0x81')](function(_0x38bad5){_0x5089b3=_0x38bad5[_0x68ef('0xa2')]==0x1;if(!_0x5089b3){if(ut[_0x68ef('0x9d')](_0x454c6f)>=_0x335ba8[_0x68ef('0xca')]){_0x21b104=ut[_0x68ef('0xa5')](_0x454c6f,0x14,_0x68ef('0xd9'));rpcDb[_0x68ef('0x94')](_0x21b104,_0x68ef('0xdc'));}else{if(_0x454c6f['countagentrejectretry']>=_0x335ba8['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x454c6f,_0x68ef('0xdc'));}else{rpcDb[_0x68ef('0xa9')](ut[_0x68ef('0xaa')](_0x454c6f,'countagentrejectretry',_0x335ba8[_0x68ef('0xda')]),_0x454c6f['unlockAgent'],_0x454c6f[_0x68ef('0xac')]);}}}else{_0x454c6f[_0x68ef('0xc6')]++;_0x24d7f7[_0x68ef('0xc3')]({'id':_0x454c6f['idContact'],'field':{'countnoanswerretry':_0x454c6f[_0x68ef('0xc6')]}})[_0x68ef('0x81')](function(){_0x24d7f7['swapAdditionalPhones'](_0x454c6f,_0x3f56a7,_0x53a601)[_0x68ef('0x81')](function(){});});}});break;case _0x68ef('0xdd'):_0x335ba8[_0x68ef('0xde')]+=0x1;_0x454c6f[_0x68ef('0xdf')]+=0x1;_0x454c6f[_0x68ef('0x9c')]=ut[_0x68ef('0x9d')](_0x454c6f);ut[_0x68ef('0x8c')](_0x454c6f,0xb,'Abandoned');rpcDb[_0x68ef('0xa0')](_0x454c6f,_0x68ef('0xe0'));_0x24d7f7[_0x68ef('0xa1')](_0x454c6f,'11',_0x335ba8)[_0x68ef('0x81')](function(_0x424e46){_0x5089b3=_0x424e46[_0x68ef('0xa2')]==0x1;if(!_0x5089b3){if(ut[_0x68ef('0x9d')](_0x454c6f)>=_0x335ba8[_0x68ef('0xca')]){_0x21b104=ut[_0x68ef('0xa5')](_0x454c6f,0xf,_0x68ef('0xa6'));rpcDb['createCustomerFinal'](_0x21b104,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x454c6f[_0x68ef('0xe1')]>=_0x335ba8['dialAbandonedMaxRety']){rpcDb[_0x68ef('0x94')](_0x454c6f,_0x68ef('0xe0'));}else{rpcDb[_0x68ef('0xa9')](ut[_0x68ef('0xaa')](_0x454c6f,_0x68ef('0xdf'),_0x335ba8['dialAbandonedRetryFrequency']),_0x454c6f[_0x68ef('0xab')],_0x454c6f[_0x68ef('0xac')]);}}}else{_0x454c6f[_0x68ef('0xc6')]++;_0x24d7f7[_0x68ef('0xc3')]({'id':_0x454c6f['idContact'],'field':{'countnoanswerretry':_0x454c6f['countnoanswerretry']}})[_0x68ef('0x81')](function(){_0x24d7f7[_0x68ef('0xcd')](_0x454c6f,_0x3f56a7,_0x53a601)[_0x68ef('0x81')](function(){});});}});break;case'18':_0x335ba8[_0x68ef('0x44')]+=0x1;_0x454c6f[_0x68ef('0xe2')]+=0x1;_0x454c6f[_0x68ef('0x9c')]=ut[_0x68ef('0x9d')](_0x454c6f);ut[_0x68ef('0x8c')](_0x454c6f,0x12,_0x541e35[_0x68ef('0xe3')]||_0x541e35[_0x68ef('0xe4')]);ami[_0x68ef('0x28')]('custom:amd',ut[_0x68ef('0x9f')](_0x454c6f,_0x68ef('0xe5')));rpcDb[_0x68ef('0xa0')](_0x454c6f,_0x68ef('0xe6'));_0x24d7f7[_0x68ef('0xa1')](_0x454c6f,'18',_0x335ba8)[_0x68ef('0x81')](function(_0x11247b){_0x5089b3=_0x11247b[_0x68ef('0xa2')]==0x1;if(!_0x5089b3){if(ut[_0x68ef('0x9d')](_0x454c6f)>=_0x335ba8[_0x68ef('0xca')]){_0x21b104=ut['cloneAction'](_0x454c6f,0x12,'Global');rpcDb[_0x68ef('0x94')](_0x21b104,_0x68ef('0xe6'));}else{rpcDb[_0x68ef('0x94')](_0x454c6f,_0x68ef('0xe6'));}}else{_0x454c6f[_0x68ef('0xc6')]++;_0x24d7f7[_0x68ef('0xc3')]({'id':_0x454c6f[_0x68ef('0xaf')],'field':{'countnoanswerretry':_0x454c6f['countnoanswerretry']}})[_0x68ef('0x81')](function(){_0x24d7f7[_0x68ef('0xcd')](_0x454c6f,_0x3f56a7,_0x53a601)[_0x68ef('0x81')](function(){});});}});delete this[_0x68ef('0x19')][_0x541e35['linkedid']];break;case'19':_0x335ba8[_0x68ef('0x44')]+=0x1;_0x454c6f['countglobal']=ut[_0x68ef('0x9d')](_0x454c6f);ut[_0x68ef('0x8c')](_0x454c6f,0x13,_0x541e35[_0x68ef('0xe3')]||_0x541e35['dialstatus']);ami['emit'](_0x68ef('0xe7'),ut['buildObj'](_0x454c6f,_0x68ef('0xe5')));rpcDb['createCustomerHistory'](_0x454c6f,_0x68ef('0xe8'));_0x24d7f7[_0x68ef('0xa1')](_0x454c6f,'18',_0x335ba8)['then'](function(_0x4a172f){_0x5089b3=_0x4a172f[_0x68ef('0xa2')]==0x1;if(!_0x5089b3){if(ut[_0x68ef('0x9d')](_0x454c6f)>=_0x335ba8['dialGlobalMaxRetry']){_0x21b104=ut[_0x68ef('0xa5')](_0x454c6f,0xf,_0x68ef('0xa6'));rpcDb[_0x68ef('0x94')](_0x21b104,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x454c6f,_0x68ef('0xe8'));}}else{_0x454c6f['countnoanswerretry']++;_0x24d7f7[_0x68ef('0xc3')]({'id':_0x454c6f[_0x68ef('0xaf')],'field':{'countnoanswerretry':_0x454c6f[_0x68ef('0xc6')]}})[_0x68ef('0x81')](function(){_0x24d7f7[_0x68ef('0xcd')](_0x454c6f,_0x3f56a7,_0x53a601)[_0x68ef('0x81')](function(){});});}});delete this['actions'][_0x541e35['linkedid']];break;default:if(_0x454c6f[_0x68ef('0x7a')]){ut[_0x68ef('0x7b')](_0x335ba8,_0x68ef('0xe9'));ut[_0x68ef('0x7c')](_0x68ef('0xea')+_0x335ba8['name'],_0x541e35);}_0x335ba8[_0x68ef('0x44')]+=0x1;_0x454c6f[_0x68ef('0x9c')]=ut[_0x68ef('0x9d')](_0x454c6f);ut[_0x68ef('0x8c')](_0x454c6f,0xc,_0x541e35[_0x68ef('0xe3')]||_0x541e35[_0x68ef('0xe4')]);_0x3f56a7=_0x335ba8[_0x68ef('0xda')];_0x53a601=_0x335ba8[_0x68ef('0xa4')];rpcDb['createCustomerHistory'](_0x454c6f,_0x68ef('0xeb'));_0x24d7f7[_0x68ef('0xa1')](_0x454c6f,'20',_0x335ba8)[_0x68ef('0x81')](function(_0x1d8123){_0x5089b3=_0x1d8123[_0x68ef('0xa2')]==0x1;if(!_0x5089b3){if(ut[_0x68ef('0x9d')](_0x454c6f)>=_0x335ba8['dialGlobalMaxRetry']){_0x21b104=ut[_0x68ef('0xa5')](_0x454c6f,0xf,_0x68ef('0xa6'));rpcDb[_0x68ef('0x94')](_0x21b104,_0x68ef('0xec'));}else{rpcDb[_0x68ef('0x94')](_0x454c6f,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x68ef('0x19')][_0x541e35[_0x68ef('0xad')]];}else{_0x24d7f7['swapAdditionalPhones'](_0x454c6f,_0x3f56a7,_0x53a601)['then'](function(_0x222b76){});}});}if(!(_0x454c6f[_0x68ef('0x7a')]&&_0x1092f8==='16')){ut[_0x68ef('0xed')](_0x335ba8,'[callProgressDetectingCustomer]');logger['info'](_0x68ef('0xee'),_0x454c6f[_0x68ef('0xb3')],_0x68ef('0xb4'),_0x335ba8[_0x68ef('0x53')],_0x68ef('0xef'),_0x335ba8[_0x68ef('0x4e')]);}if(_0x1092f8!==_0x68ef('0xf0')){delete this[_0x68ef('0x19')][_0x541e35[_0x68ef('0xad')]];delete this[_0x68ef('0x19')][_0x541e35[_0x68ef('0xf1')]];}}};Preview[_0x68ef('0x11')][_0x68ef('0xf2')]=function(_0x10148c,_0x5dde24,_0x525fc7){if(_[_0x68ef('0xf3')](_0x5dde24)&&_0x68ef('0xf4')!==typeof _0x5dde24){return;}if(_[_0x68ef('0xf3')](_0x525fc7)&&_0x68ef('0xf4')!==typeof _0x525fc7){return;}switch(_0x525fc7['reason']){case'0':ut[_0x68ef('0xf5')](_0x10148c,0x0,_0x68ef('0xf6'));rpcDb['createAgentHistory'](_0x10148c,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x68ef('0xf5')](_0x10148c,0x3,_0x68ef('0xc7'));rpcDb[_0x68ef('0xf7')](_0x10148c,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x68ef('0xf5')](_0x10148c,0x5,_0x68ef('0xbd'));rpcDb[_0x68ef('0xf7')](_0x10148c,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x68ef('0xf5')](_0x10148c,0x8,'Congestion');rpcDb[_0x68ef('0xf7')](_0x10148c,_0x68ef('0xf8'));break;case'22':ut['logAgent'](_0x10148c,0x16,_0x68ef('0xf9'));rpcDb[_0x68ef('0xf7')](_0x10148c,_0x68ef('0xfa'));break;default:ut[_0x68ef('0xf5')](_0x10148c,0xc,_0x525fc7[_0x68ef('0xfb')]);rpcDb[_0x68ef('0xf7')](_0x10148c,_0x68ef('0xf8'));}ut[_0x68ef('0xed')](_0x5dde24,_0x68ef('0xfc'));logger['info'](_0x68ef('0xfd'),_0x10148c[_0x68ef('0xb3')],_0x68ef('0xb4'),_0x5dde24[_0x68ef('0x53')],_0x68ef('0xef'),_0x5dde24[_0x68ef('0x4e')]);delete this[_0x68ef('0x19')][_0x10148c['uniqueid']];};Preview['prototype'][_0x68ef('0xa1')]=function(_0x47c3c8,_0x11fba7,_0x158e68){return BPromise[_0x68ef('0xfe')]()[_0x68ef('0x81')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x47c3c8,_0x11fba7,_0x158e68))[_0x68ef('0x77')](logger[_0x68ef('0x5a')](_0x68ef('0xff')));};Preview['prototype'][_0x68ef('0xcd')]=function(_0xe82f3a,_0x4af131,_0x3c3933){return BPromise[_0x68ef('0xfe')]()['then'](cmHopperAdditionalPhone['swapAdditionalPhones'](_0xe82f3a,_0x4af131,_0x3c3933))['catch'](logger[_0x68ef('0x5a')](_0x68ef('0x100')));};Preview[_0x68ef('0x11')][_0x68ef('0xc3')]=function(_0xd4e347){return BPromise[_0x68ef('0xfe')]()[_0x68ef('0x81')](cmHopperAdditionalPhone[_0x68ef('0xc3')](_0xd4e347))[_0x68ef('0x77')](logger['info'](_0x68ef('0x101')));};Preview[_0x68ef('0x11')]['checkInBlack']=function(_0x30c2ea,_0x2374fa,_0x42ebee,_0x5f5c40,_0x19e0fe){var _0x574794=this;return new BPromise(function(_0x4649f9,_0xd88db0){if(_[_0x68ef('0x82')](_0x2374fa)||_[_0x68ef('0x82')](_0x2374fa[_0x68ef('0x102')])||_[_0x68ef('0x82')](_0x2374fa[_0x68ef('0x103')])||_[_0x68ef('0x82')](_0x2374fa['VoiceQueueId'])){_0xd88db0(ut[_0x68ef('0x4d')](_0x68ef('0x104'),_0x5f5c40,_0x19e0fe));return;}var _0x48fee3=uuid['v4']();var _0x132b9d=_0x574794[_0x68ef('0x16')][_0x2374fa[_0x68ef('0x6d')][_0x68ef('0x53')]];var _0x2b1686=_0x42ebee?_0x574794['agents'][_0x42ebee]['id']:undefined;_0x574794[_0x68ef('0x19')][_0x48fee3]=new Action(_0x2374fa,_0x132b9d,_0x48fee3,_0x42ebee,_0x2b1686);var _0x2b6b86=_0x574794[_0x68ef('0x19')][_0x48fee3];_0x2b6b86[_0x68ef('0xab')]=_0x5f5c40;_0x2b6b86[_0x68ef('0xac')]=_0x19e0fe;_0x2b6b86['lookAgent']=_0x42ebee;if(_[_0x68ef('0x105')](_0x30c2ea)){_0x574794['execCall'](_0x2b6b86,_0x132b9d,_0x2374fa,_0x42ebee)['then'](function(_0x1121ac){logger[_0x68ef('0x5a')](_0x68ef('0x106'),_0x68ef('0x107')+_0x2b6b86[_0x68ef('0x6e')]+_0x68ef('0x108')+_0x2b6b86[_0x68ef('0xaf')],JSON[_0x68ef('0x57')](_0x1121ac));ami['emit'](_0x68ef('0x109'),ut[_0x68ef('0x9f')](_0x2b6b86,_0x68ef('0x10a'),_0x574794[_0x68ef('0x16')][_0x2b6b86[_0x68ef('0x6e')]]));_0x4649f9(ut[_0x68ef('0x4d')](_0x68ef('0x10b')));})[_0x68ef('0x77')](function(_0x31ac9f){ut[_0x68ef('0x60')](_0x68ef('0x10c'),_0x31ac9f);_0xd88db0(ut[_0x68ef('0x4d')]('Call\x20failed',_0x5f5c40,_0x19e0fe));});}else{_0x132b9d[_0x68ef('0x3b')]+=0x1;ut[_0x68ef('0x10d')](_0x2b6b86);rpcDb[_0x68ef('0x10e')](_0x2b6b86,_0x68ef('0x10f'));delete _0x574794['actions'][_0x48fee3];_0xd88db0(ut[_0x68ef('0x4d')](_0x68ef('0x110'),_0x5f5c40,_0x19e0fe));}});};Preview[_0x68ef('0x11')]['isTrunkReachable']=function(_0x13ddbb){return!_['isNil'](_0x13ddbb)&&!_[_0x68ef('0x82')](_0x13ddbb[_0x68ef('0x53')])&&!_[_0x68ef('0x82')](_0x13ddbb[_0x68ef('0x54')])&&_0x13ddbb[_0x68ef('0x54')]&&!_['isNil'](this['trunks'][util['format'](_0x68ef('0x111'),_0x13ddbb[_0x68ef('0x53')])])&&!_['isNil'](this[_0x68ef('0x18')][util[_0x68ef('0x8b')](_0x68ef('0x111'),_0x13ddbb[_0x68ef('0x53')])][_0x68ef('0x75')])&&(this[_0x68ef('0x18')][util[_0x68ef('0x8b')](_0x68ef('0x111'),_0x13ddbb[_0x68ef('0x53')])][_0x68ef('0x75')]===_0x68ef('0x112')||this[_0x68ef('0x18')][util[_0x68ef('0x8b')](_0x68ef('0x111'),_0x13ddbb[_0x68ef('0x53')])][_0x68ef('0x75')]==='unmonitored');};Preview[_0x68ef('0x11')][_0x68ef('0x113')]=function(_0x4ad915,_0x2626b2){var _0x1774a9=this;return new BPromise(function(_0x1cad84,_0xe945ae){_0x1774a9[_0x68ef('0x114')](_0x4ad915,_0x2626b2)[_0x68ef('0x81')](function(_0x3459c1){_0x1cad84(_['pick'](_0x3459c1,['message']));})[_0x68ef('0x77')](function(_0x5e1fd8){if(_0x5e1fd8['unlock']){rpcDb[_0x68ef('0x115')](_0x4ad915);}if(_0x5e1fd8['active']){rpcDb[_0x68ef('0x116')](_0x4ad915);}_0xe945ae(_['pick'](_0x5e1fd8,[_0x68ef('0x4d')]));});});};Preview[_0x68ef('0x11')][_0x68ef('0x114')]=function(_0x1f6c27,_0x1d4af7){var _0x16fedd=this;return new BPromise(function(_0x4352a3,_0x31012a){var _0x5abfc3,_0x6a5adb;rpcDb[_0x68ef('0x117')](_0x1f6c27)[_0x68ef('0x81')](function(_0x3dd5f7){if(!_[_0x68ef('0x82')](_0x3dd5f7[0x0])){_0x6a5adb=_0x3dd5f7[0x0][_0x68ef('0x118')]?![]:!![];_0x5abfc3=_0x3dd5f7[0x0][_0x68ef('0x118')]?!![]:![];_0x5abfc3=_0x1d4af7?!![]:_0x5abfc3;}var _0x1a0eb0=_0x16fedd[_0x68ef('0x119')](_0x3dd5f7);if(_0x1a0eb0['isValid']){rpcDb[_0x68ef('0x11a')](_[_0x68ef('0x70')](_0x3dd5f7[0x0],[_0x68ef('0x11b'),'phone']))[_0x68ef('0x81')](function(_0x190452){_0x16fedd[_0x68ef('0x11c')](_0x190452,_0x3dd5f7[0x0],_0x1d4af7,_0x6a5adb,_0x5abfc3)[_0x68ef('0x81')](function(_0x2adfe7){_0x4352a3(_0x2adfe7);})[_0x68ef('0x77')](function(_0x3768ff){_0x31012a(_0x3768ff);});})[_0x68ef('0x77')](function(_0x5eca36){ut[_0x68ef('0x60')](_0x68ef('0x11d'),_0x5eca36);_0x31012a(ut[_0x68ef('0x4d')](_0x68ef('0x11e'),_0x6a5adb,_0x5abfc3));});}else{_0x31012a(ut[_0x68ef('0x4d')](_0x1a0eb0[_0x68ef('0x4d')],_0x6a5adb,_0x5abfc3));}})['catch'](function(_0x1c9d13){ut[_0x68ef('0x60')]('[Preview][getContactPreview]',_0x1c9d13);_0x31012a(ut[_0x68ef('0x4d')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x68ef('0x11')][_0x68ef('0x119')]=function(_0x461e5d){if(_[_0x68ef('0x82')](_0x461e5d)||_[_0x68ef('0x105')](_0x461e5d)||!_[_0x68ef('0x82')](_0x461e5d[0x0][_0x68ef('0x87')])&&_[_0x68ef('0x82')](_0x461e5d[0x0][_0x68ef('0x87')][_0x68ef('0x53')])){ut[_0x68ef('0x60')](_0x68ef('0x11f'),_0x461e5d);return{'isValid':![],'message':_0x68ef('0x120')};}var _0x4df31f=this[_0x68ef('0x16')][_0x461e5d[0x0][_0x68ef('0x6d')][_0x68ef('0x53')]];_0x4df31f[_0x68ef('0x4d')]='ACTIVE';if(_[_0x68ef('0x82')](_0x4df31f)){ut[_0x68ef('0x60')](_0x68ef('0x121'),_0x4df31f);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x68ef('0x98')](_0x4df31f[_0x68ef('0x52')])){ut[_0x68ef('0x60')](_0x68ef('0x122'),_0x68ef('0x123')+_0x4df31f[_0x68ef('0x53')]+_0x68ef('0x124'));if(!this['isTrunkReachable'](_0x4df31f['TrunkBackup'])){ut[_0x68ef('0x60')](_0x68ef('0x122'),_0x4df31f['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x68ef('0x125')};}}if(!ut[_0x68ef('0x97')](_0x4df31f[_0x68ef('0x35')])){ut[_0x68ef('0x60')](_0x68ef('0x126'),_0x4df31f[_0x68ef('0x53')]+_0x68ef('0x127'));return{'isValid':![],'message':_0x68ef('0x123')+_0x4df31f['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x68ef('0x128')};};Preview[_0x68ef('0x11')][_0x68ef('0x129')]=function(_0x5b62bf,_0xd9e1c2,_0x3dfd7c,_0x10309d){var _0x2e96fa=this;return new BPromise(function(_0x535c5c,_0x4a4947){var _0x3717c4=_0x5b62bf[_0x68ef('0xb3')];var _0x24d10e=_0x2e96fa['isTrunkReachable'](_0xd9e1c2[_0x68ef('0x52')])?util[_0x68ef('0x8b')](_0x68ef('0x12a'),_0xd9e1c2[_0x68ef('0x52')][_0x68ef('0x53')],_[_0x68ef('0x82')](_0xd9e1c2[_0x68ef('0x12b')])?'':_0xd9e1c2[_0x68ef('0x12b')][_0x68ef('0x12c')]()||'',_0xd9e1c2['dialCutDigit']>0x0?_0x3dfd7c[_0x68ef('0x103')][_0x68ef('0x12d')](_0xd9e1c2['dialCutDigit']):_0x3dfd7c[_0x68ef('0x103')]):util[_0x68ef('0x8b')](_0x68ef('0x12a'),_[_0x68ef('0x82')](_0xd9e1c2['TrunkBackup'])?_0xd9e1c2[_0x68ef('0x52')][_0x68ef('0x53')]:_0xd9e1c2[_0x68ef('0x99')]['name'],_[_0x68ef('0x82')](_0xd9e1c2['dialPrefix'])?'':_0xd9e1c2['dialPrefix']['trim']()||'',_0xd9e1c2[_0x68ef('0x12e')]>0x0?_0x3dfd7c[_0x68ef('0x103')]['substring'](_0xd9e1c2[_0x68ef('0x12e')]):_0x3dfd7c['phone']);var _0x579baf=_0x2e96fa[_0x68ef('0x98')](_0xd9e1c2[_0x68ef('0x52')])?ut[_0x68ef('0x12f')](_0xd9e1c2[_0x68ef('0x52')][_0x68ef('0x55')],_0xd9e1c2[_0x68ef('0x37')],_0xd9e1c2[_0x68ef('0x130')]>0x0?ut[_0x68ef('0x131')](_0xd9e1c2[_0x68ef('0x38')],_0xd9e1c2[_0x68ef('0x130')]):_0xd9e1c2[_0x68ef('0x38')]):ut['getCallerId'](_[_0x68ef('0x82')](_0xd9e1c2[_0x68ef('0x99')])?_0xd9e1c2['Trunk'][_0x68ef('0x55')]:_0xd9e1c2['TrunkBackup'][_0x68ef('0x55')],_0xd9e1c2[_0x68ef('0x37')],_0xd9e1c2[_0x68ef('0x130')]>0x0?ut['getCallerIdRandom'](_0xd9e1c2[_0x68ef('0x38')],_0xd9e1c2[_0x68ef('0x130')]):_0xd9e1c2[_0x68ef('0x38')]);if(_0x579baf){_0x5b62bf[_0x68ef('0x132')]=ut[_0x68ef('0x133')](_0x579baf);_0x5b62bf[_0x68ef('0x134')]=ut['extractCalleridNumber'](_0x579baf);}var _0x5e4ec4=ut[_0x68ef('0x135')](_0xd9e1c2,_0x3dfd7c,_0x24d10e,_0x579baf,_0x3717c4,_0x5b62bf);_['merge'](_0x5b62bf,ut[_0x68ef('0x136')](_0x5e4ec4));_0x5b62bf[_0x68ef('0x137')]=moment()[_0x68ef('0x8b')](_0x68ef('0xb0'));ami[_0x68ef('0x74')](ut[_0x68ef('0x138')](_0x5b62bf,_0xd9e1c2,_0x5e4ec4,_0x5b62bf[_0x68ef('0xac')],_0x10309d))[_0x68ef('0x81')](function(_0x4d4bfa){_0xd9e1c2[_0x68ef('0x4e')]+=0x1;logger[_0x68ef('0x5a')](_0x68ef('0x139'),_0x3717c4,'\x20Queue',_0xd9e1c2[_0x68ef('0x53')],_0x68ef('0xef'),_0xd9e1c2[_0x68ef('0x4e')]);_0x535c5c(_0x4d4bfa);})[_0x68ef('0x77')](function(_0x3e2883){ut[_0x68ef('0xf5')](_0x5b62bf,0xe,_0x68ef('0x13a'));rpcDb[_0x68ef('0xf7')](_0x5b62bf,_0x68ef('0x13b'));_0x4a4947(_0x3e2883);});});};Preview['prototype']['syncNewExten']=function(_0x307741){if(this[_0x68ef('0x19')][_0x307741['linkedid']]){this[_0x68ef('0x19')][_0x307741[_0x68ef('0xad')]]['channel']=_0x307741['channel'];}};Preview['prototype']['syncOriginateResponse']=function(_0x3d5384){var _0x4d5174=this;var _0x41388a=this['actions'][_0x3d5384[_0x68ef('0x13c')]];if(_0x41388a){if(_0x41388a[_0x68ef('0x13d')]&&this['agents'][_0x41388a['lookAgent']]){ut['logLookAgent'](_0x41388a,this[_0x68ef('0x1a')][_0x41388a[_0x68ef('0x13d')]][_0x68ef('0x53')],this['agents'][_0x41388a[_0x68ef('0x13d')]]['id']);}var _0x4898ad=_[_0x68ef('0x13e')](_0x41388a);_0x4898ad['responsetime']=moment()[_0x68ef('0x8b')](_0x68ef('0xb0'));var _0x35db11=_0x4d5174[_0x68ef('0x16')][_0x41388a[_0x68ef('0x6e')]];if(ut[_0x68ef('0x13f')](_0x3d5384[_0x68ef('0x140')])){if(_0x41388a['unlockAgent']){rpcDb[_0x68ef('0x115')](_0x41388a[_0x68ef('0xaf')]);}if(_0x41388a[_0x68ef('0xac')]){rpcDb[_0x68ef('0x116')](_0x41388a[_0x68ef('0xaf')]);}ami[_0x68ef('0x28')](_0x68ef('0x141'),ut['buildObj'](_0x41388a,_0x68ef('0x142'),this[_0x68ef('0x16')][_0x41388a[_0x68ef('0x6e')]]));this[_0x68ef('0xf2')](_0x4898ad,_0x35db11,_0x3d5384);}else{_0x41388a[_0x68ef('0x137')]=moment()[_0x68ef('0x8b')](_0x68ef('0xb0'));ut[_0x68ef('0xf5')](_0x4898ad,0x4,_0x68ef('0x143'));rpcDb[_0x68ef('0xf7')](_0x4898ad,_0x68ef('0x144'));}}};Preview[_0x68ef('0x11')]['syncHangup']=function(_0x253b31){var _0x14b845=this;var _0x2ea696=this[_0x68ef('0x19')][_0x253b31['linkedid']];var _0x4cd1df;if(_0x2ea696){_0x4cd1df=this['campaignsPreview'][_0x2ea696[_0x68ef('0x6e')]];logger[_0x68ef('0x5a')](_0x68ef('0x145'),_0x253b31[_0x68ef('0xad')],'\x20Queue',_0x4cd1df['name'],'pTalking:\x20',_0x4cd1df[_0x68ef('0x2e')]);}if(this[_0x68ef('0x19')][_0x253b31[_0x68ef('0xad')]]&&_0x253b31['linkedid']!==_0x253b31[_0x68ef('0xb3')]){if(_0x253b31[_0x68ef('0x146')]==='16'&&this[_0x68ef('0x19')][_0x253b31[_0x68ef('0xad')]][_0x68ef('0x7a')]){this[_0x68ef('0x147')](_0x253b31,_0x253b31[_0x68ef('0xad')],_0x253b31['cause']);}else if(this[_0x68ef('0x19')][_0x253b31[_0x68ef('0xad')]][_0x68ef('0x7a')]){logger[_0x68ef('0x5a')](_0x68ef('0x148'),_0x253b31['linkedid'],_0x253b31[_0x68ef('0x146')],_0x68ef('0xb4'),_0x4cd1df['name'],_0x68ef('0x6f'),_0x4cd1df[_0x68ef('0x2e')]);this[_0x68ef('0x147')](_0x253b31,_0x253b31[_0x68ef('0xad')],_0x253b31['cause']);}}else if(_0x2ea696&&_[_0x68ef('0x82')](_0x2ea696['statedesc'])&&_0x4cd1df[_0x68ef('0x149')]&&_0x253b31[_0x68ef('0xad')]===_0x253b31[_0x68ef('0xb3')]&&_['isNil'](_0x253b31[_0x68ef('0xfb')])&&_0x253b31[_0x68ef('0x146')]==='16'&&_0x253b31['channelstate']==='6'&&_['isUndefined'](_0x2ea696[_0x68ef('0x14a')])){if(_0x2ea696[_0x68ef('0xab')]){rpcDb['unlockContact'](_0x2ea696['idContact']);}if(_0x2ea696[_0x68ef('0xac')]){rpcDb[_0x68ef('0x116')](_0x2ea696[_0x68ef('0xaf')]);}_0x253b31[_0x68ef('0xfb')]='22';this[_0x68ef('0xf2')](_0x2ea696,_0x4cd1df,_0x253b31);}else if(_0x2ea696&&_0x2ea696[_0x68ef('0x14a')]){if(_0x253b31[_0x68ef('0x146')]==='16'&&this['actions'][_0x253b31[_0x68ef('0xad')]][_0x68ef('0x7a')]){logger[_0x68ef('0x5a')](_0x68ef('0x14b'),_0x253b31[_0x68ef('0xad')],_0x253b31[_0x68ef('0x146')],_0x68ef('0xb4'),_0x4cd1df[_0x68ef('0x53')],_0x68ef('0x6f'),_0x4cd1df[_0x68ef('0x2e')]);this[_0x68ef('0x147')](_0x253b31,_0x253b31[_0x68ef('0xad')],_0x253b31[_0x68ef('0x146')]);}else if(this[_0x68ef('0x19')][_0x253b31[_0x68ef('0xad')]]['dialAnswer']){logger['info'](_0x68ef('0x148'),_0x253b31[_0x68ef('0xad')],_0x253b31[_0x68ef('0x146')],_0x68ef('0xb4'),_0x4cd1df['name'],_0x68ef('0x6f'),_0x4cd1df[_0x68ef('0x2e')]);this['callProgressDetectingCustomer'](_0x253b31,_0x253b31['linkedid'],_0x253b31['cause']);}}};Preview[_0x68ef('0x11')][_0x68ef('0x14c')]=function(_0x276b34){if(this['actions'][_0x276b34[_0x68ef('0xf1')]]&&_0x276b34['destlinkedid']!==_0x276b34[_0x68ef('0x14d')]){this[_0x68ef('0x147')](_0x276b34,_0x276b34[_0x68ef('0xf1')],_0x276b34[_0x68ef('0xe4')]);}};Preview[_0x68ef('0x11')][_0x68ef('0x21')]=function(_0x3d9e49){if(this[_0x68ef('0x19')][_0x3d9e49[_0x68ef('0xad')]]&&_0x3d9e49[_0x68ef('0xad')]!==_0x3d9e49[_0x68ef('0xb3')]&&!this[_0x68ef('0x19')][_0x3d9e49['linkedid']][_0x68ef('0x7a')]){if(_0x3d9e49[_0x68ef('0x146')]==='1'){this[_0x68ef('0x147')](_0x3d9e49,_0x3d9e49[_0x68ef('0xad')],_0x3d9e49[_0x68ef('0x146')]);}}};Preview[_0x68ef('0x11')]['addVariable']=function(_0x29a5ab,_0x26b50b,_0x5925cd){if(this[_0x68ef('0x19')][_0x29a5ab]){if(_['isNil'](this['actions'][_0x29a5ab][_0x68ef('0x14e')])){this['actions'][_0x29a5ab][_0x68ef('0x14e')]={};}this[_0x68ef('0x19')][_0x29a5ab][_0x68ef('0x14e')][_0x26b50b]=_0x5925cd;}};Preview[_0x68ef('0x11')][_0x68ef('0x14f')]=function(_0x189e26){try{if(!_[_0x68ef('0x82')](_0x189e26)){if(ut[_0x68ef('0x150')](_[_0x68ef('0x151')](_0x189e26[_0x68ef('0x152')])[0x0])){this[_0x68ef('0x153')](_0x189e26[_0x68ef('0xb3')],_[_0x68ef('0x151')](_0x189e26[_0x68ef('0x152')])[0x0],_0x189e26[_0x68ef('0x154')]);}}}catch(_0x8ad499){logger[_0x68ef('0x155')](_0x68ef('0x156'),util[_0x68ef('0x157')](_0x8ad499,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x3f702d){if(_0x3f702d){if(this[_0x68ef('0x19')][_0x3f702d[_0x68ef('0x158')]]){this[_0x68ef('0x19')][_0x3f702d[_0x68ef('0x158')]][_0x68ef('0x14a')]=!![];}}};Preview['prototype'][_0x68ef('0x26')]=function(_0x172cb3){if(_0x172cb3){if(this[_0x68ef('0x19')][_0x172cb3[_0x68ef('0x159')]]){this[_0x68ef('0x19')][_0x172cb3['transfererlinkedid']]['transfer']=!![];}}};module[_0x68ef('0x15a')]=Preview;
\ No newline at end of file
index 71b7545..d3f53df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbb11=['queuecallerjoinAt','queuecallerleaveAt','endtime','connectedlinename','membername','context','exten','holdtime','assigned','COMPLETED','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridname','queue'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xbb11,0xd2));var _0x1bb1=function(_0x178528,_0x5d9dac){_0x178528=_0x178528-0x0;var _0x33cbcf=_0xbb11[_0x178528];return _0x33cbcf;};'use strict';var util=require('util');var BPromise=require(_0x1bb1('0x0'));var logger=require(_0x1bb1('0x1'))('preview');var _=require('lodash');var cmHopper=require(_0x1bb1('0x2'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x1bb1('0x3'));var voiceQueueRt=require(_0x1bb1('0x4'));var agentReportPreview=require(_0x1bb1('0x5'));var voiceQueueReport=require(_0x1bb1('0x6'));function loggerCatch(_0x2fda27){return function(_0x39a01d){logger[_0x1bb1('0x7')](_0x2fda27,util[_0x1bb1('0x8')](_0x39a01d,{'showHidden':![],'depth':null}));};}function create(_0x151167){return BPromise[_0x1bb1('0x9')]()[_0x1bb1('0xa')](cmHopperHistory[_0x1bb1('0xb')](_0x151167))[_0x1bb1('0xc')](loggerCatch(_0x1bb1('0xd')));}function createAgent(_0x3fff56){return BPromise[_0x1bb1('0x9')]()[_0x1bb1('0xa')](agentReportPreview['createHistory'](_0x3fff56))[_0x1bb1('0xc')](loggerCatch(_0x1bb1('0xd')));}function moveContact(_0x19d53e){return BPromise['resolve']()['then'](cmHopper[_0x1bb1('0xe')](_0x19d53e,!![]))[_0x1bb1('0xc')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x1bb1('0xf')]=function(_0x55db25){return BPromise[_0x1bb1('0x9')]()[_0x1bb1('0xa')](cmHopperBlack['checkIsBlackList'](_0x55db25))[_0x1bb1('0xc')](loggerCatch(_0x1bb1('0x10')));};exports[_0x1bb1('0x11')]=function(_0x32e49f){return BPromise['resolve']()[_0x1bb1('0xa')](cmHopper[_0x1bb1('0x11')](_0x32e49f))[_0x1bb1('0xc')](loggerCatch(_0x1bb1('0x12')));};exports['createHistory']=function(_0x52674d,_0x12ab5a){create(_0x52674d)[_0x1bb1('0xc')](loggerCatch(_0x12ab5a));moveContact(_0x52674d)[_0x1bb1('0xc')](loggerCatch(_0x12ab5a));};exports[_0x1bb1('0x13')]=function(_0x4cec57,_0x3fc281){createAgent(_0x4cec57)[_0x1bb1('0xc')](loggerCatch(_0x3fc281));};exports[_0x1bb1('0x14')]=function(_0x42715a,_0x5752d0){create(_0x42715a)['catch'](loggerCatch(_0x5752d0));};exports[_0x1bb1('0x15')]=function(_0x49aaf2,_0x4b145a){moveContact(_0x49aaf2)[_0x1bb1('0xc')](loggerCatch(_0x4b145a));};exports[_0x1bb1('0x16')]=function(_0x567ff4,_0x2ae000,_0xda57d9){if(_0x2ae000){_0x567ff4[_0x1bb1('0x17')]=null;}if(_0xda57d9){_0x567ff4[_0x1bb1('0x18')]=![];}return BPromise[_0x1bb1('0x9')]()[_0x1bb1('0xa')](cmHopper[_0x1bb1('0x16')](_0x567ff4))[_0x1bb1('0xc')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x1bb1('0x19')]=function(_0x2b305f){return BPromise[_0x1bb1('0x9')]()[_0x1bb1('0xa')](cmHopper[_0x1bb1('0x19')](_0x2b305f))[_0x1bb1('0xc')](loggerCatch(_0x1bb1('0x1a')));};exports[_0x1bb1('0x1b')]=function(_0x17ee1a){return BPromise[_0x1bb1('0x9')]()[_0x1bb1('0xa')](cmHopper[_0x1bb1('0x1b')]({'UserId':null},_0x17ee1a,0x1))[_0x1bb1('0xc')](loggerCatch(_0x1bb1('0x1c')));};exports['disableContact']=function(_0xba5f2f){return BPromise[_0x1bb1('0x9')]()[_0x1bb1('0xa')](cmHopper[_0x1bb1('0x1b')]({'active':![]},_0xba5f2f,0x1))[_0x1bb1('0xc')](loggerCatch(_0x1bb1('0x1d')));};exports[_0x1bb1('0x1e')]=function(_0x34d254){var _0x10818b={};_0x10818b[_0x1bb1('0x1f')]=_0x34d254[_0x1bb1('0x1f')];_0x10818b[_0x1bb1('0x20')]=_0x34d254['uniqueid'];_0x10818b['calleridnum']=_0x34d254['calleridnum'];_0x10818b[_0x1bb1('0x21')]=_0x34d254['calleridname'];_0x10818b[_0x1bb1('0x22')]=_0x34d254[_0x1bb1('0x22')];_0x10818b[_0x1bb1('0x23')]=_0x34d254['answertime'];_0x10818b[_0x1bb1('0x24')]=_0x34d254['answertime'];_0x10818b['queuecallercomplete']=0x1;_0x10818b['queuecallercompleteAt']=_0x34d254[_0x1bb1('0x25')];_0x10818b[_0x1bb1('0x26')]=_0x34d254[_0x1bb1('0x27')];_0x10818b[_0x1bb1('0x28')]='from-sip';_0x10818b[_0x1bb1('0x29')]='xcally-motion-preview';_0x10818b[_0x1bb1('0x2a')]=0x0;_0x10818b[_0x1bb1('0x2b')]=0x1;_0x10818b['lastAssignedTo']=_0x34d254['membername'];_0x10818b['queuecallerexitreason']=_0x1bb1('0x2c');return BPromise[_0x1bb1('0x9')]()[_0x1bb1('0xa')](voiceQueueReport['create'](_0x10818b))[_0x1bb1('0xc')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x1bb1('0x2d')]=function(_0x2030a2,_0x5a9a21){return BPromise[_0x1bb1('0x9')]()['then'](cmHopper[_0x1bb1('0x2d')](_0x2030a2,_0x5a9a21))['catch'](loggerCatch(_0x1bb1('0x2e')));};exports[_0x1bb1('0x2f')]=function(_0x244c20){return BPromise[_0x1bb1('0x9')]()[_0x1bb1('0xa')](cmHopper['rescheduleContact'](_0x244c20,!![],!![]))['catch'](loggerCatch(_0x1bb1('0x30')));};
\ No newline at end of file
+var _0x4f61=['[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueReport','error','inspect','then','createHistory','resolve','catch','moveContactManagedDialer','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','from-sip','exten','xcally-motion-preview','holdtime','assigned','membername','queuecallerexitreason','COMPLETED','create'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4f61,0x103));var _0x14f6=function(_0x15eac7,_0x435856){_0x15eac7=_0x15eac7-0x0;var _0xfbbfc=_0x4f61[_0x15eac7];return _0xfbbfc;};'use strict';var util=require(_0x14f6('0x0'));var BPromise=require(_0x14f6('0x1'));var logger=require(_0x14f6('0x2'))('preview');var _=require(_0x14f6('0x3'));var cmHopper=require(_0x14f6('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x14f6('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x14f6('0x6'));function loggerCatch(_0x266a74){return function(_0x326d8c){logger[_0x14f6('0x7')](_0x266a74,util[_0x14f6('0x8')](_0x326d8c,{'showHidden':![],'depth':null}));};}function create(_0x10d6ba){return BPromise['resolve']()[_0x14f6('0x9')](cmHopperHistory[_0x14f6('0xa')](_0x10d6ba))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x316c34){return BPromise[_0x14f6('0xb')]()[_0x14f6('0x9')](agentReportPreview[_0x14f6('0xa')](_0x316c34))[_0x14f6('0xc')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x756a24){return BPromise[_0x14f6('0xb')]()[_0x14f6('0x9')](cmHopper[_0x14f6('0xd')](_0x756a24,!![]))[_0x14f6('0xc')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x14f6('0xe')]=function(_0x282e39){return BPromise[_0x14f6('0xb')]()[_0x14f6('0x9')](cmHopperBlack['checkIsBlackList'](_0x282e39))[_0x14f6('0xc')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x14f6('0xf')]=function(_0x9060ef){return BPromise['resolve']()[_0x14f6('0x9')](cmHopper[_0x14f6('0xf')](_0x9060ef))[_0x14f6('0xc')](loggerCatch(_0x14f6('0x10')));};exports['createHistory']=function(_0x4c6726,_0xb5c272){create(_0x4c6726)[_0x14f6('0xc')](loggerCatch(_0xb5c272));moveContact(_0x4c6726)[_0x14f6('0xc')](loggerCatch(_0xb5c272));};exports[_0x14f6('0x11')]=function(_0x43449a,_0x3bb91b){createAgent(_0x43449a)[_0x14f6('0xc')](loggerCatch(_0x3bb91b));};exports[_0x14f6('0x12')]=function(_0x4db6f3,_0x554db7){create(_0x4db6f3)['catch'](loggerCatch(_0x554db7));};exports['createCustomerFinal']=function(_0x4da88e,_0x3c2df3){moveContact(_0x4da88e)[_0x14f6('0xc')](loggerCatch(_0x3c2df3));};exports[_0x14f6('0x13')]=function(_0x5dc059,_0x564479,_0x595acd){if(_0x564479){_0x5dc059[_0x14f6('0x14')]=null;}if(_0x595acd){_0x5dc059['active']=![];}return BPromise[_0x14f6('0xb')]()['then'](cmHopper[_0x14f6('0x13')](_0x5dc059))[_0x14f6('0xc')](loggerCatch(_0x14f6('0x15')));};exports['countReScheduled']=function(_0x926ab4){return BPromise[_0x14f6('0xb')]()[_0x14f6('0x9')](cmHopper[_0x14f6('0x16')](_0x926ab4))['catch'](loggerCatch(_0x14f6('0x17')));};exports[_0x14f6('0x18')]=function(_0x2919f3){return BPromise[_0x14f6('0xb')]()[_0x14f6('0x9')](cmHopper[_0x14f6('0x18')]({'UserId':null},_0x2919f3,0x1))[_0x14f6('0xc')](loggerCatch(_0x14f6('0x19')));};exports['disableContact']=function(_0x462dbb){return BPromise[_0x14f6('0xb')]()[_0x14f6('0x9')](cmHopper[_0x14f6('0x18')]({'active':![]},_0x462dbb,0x1))[_0x14f6('0xc')](loggerCatch(_0x14f6('0x1a')));};exports[_0x14f6('0x1b')]=function(_0x19ccb0){var _0x489a74={};_0x489a74[_0x14f6('0x1c')]=_0x19ccb0[_0x14f6('0x1c')];_0x489a74[_0x14f6('0x1d')]=_0x19ccb0[_0x14f6('0x1d')];_0x489a74[_0x14f6('0x1e')]=_0x19ccb0[_0x14f6('0x1e')];_0x489a74[_0x14f6('0x1f')]=_0x19ccb0[_0x14f6('0x1f')];_0x489a74[_0x14f6('0x20')]=_0x19ccb0['queue'];_0x489a74[_0x14f6('0x21')]=_0x19ccb0[_0x14f6('0x22')];_0x489a74['queuecallerleaveAt']=_0x19ccb0[_0x14f6('0x22')];_0x489a74[_0x14f6('0x23')]=0x1;_0x489a74[_0x14f6('0x24')]=_0x19ccb0['endtime'];_0x489a74[_0x14f6('0x25')]=_0x19ccb0['membername'];_0x489a74['context']=_0x14f6('0x26');_0x489a74[_0x14f6('0x27')]=_0x14f6('0x28');_0x489a74[_0x14f6('0x29')]=0x0;_0x489a74[_0x14f6('0x2a')]=0x1;_0x489a74['lastAssignedTo']=_0x19ccb0[_0x14f6('0x2b')];_0x489a74[_0x14f6('0x2c')]=_0x14f6('0x2d');return BPromise[_0x14f6('0xb')]()['then'](voiceQueueReport[_0x14f6('0x2e')](_0x489a74))[_0x14f6('0xc')](loggerCatch(_0x14f6('0x2f')));};exports[_0x14f6('0x30')]=function(_0x4d768d,_0xd6d0c4){return BPromise['resolve']()[_0x14f6('0x9')](cmHopper['getContactRecallMe'](_0x4d768d,_0xd6d0c4))[_0x14f6('0xc')](loggerCatch(_0x14f6('0x31')));};exports['rescheduleContactInQueue']=function(_0x3c5fb0){return BPromise[_0x14f6('0xb')]()[_0x14f6('0x9')](cmHopper[_0x14f6('0x13')](_0x3c5fb0,!![],!![]))['catch'](loggerCatch(_0x14f6('0x32')));};
\ No newline at end of file
index 58c3bf7..460ecb2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb593=['not_inuse','status','push','getDiff','milliseconds','diff','createBody','filterKey','idContact','type','campaigntype','dialAnswer','membername','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','extractCalleridName','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','seconds','error','inspect','info','getCallerId','isUndefined','string','format','\x22%s\x22\x20<%s>','isEmpty','\x22\x22\x20<>','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','%s%s','XMD-','toUpper','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','originate','channelAgent','timeout','uniqueid','totalGlobal','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','motionChannel','mandatoryDisposition','buildAcw'];(function(_0x385d9c,_0x4beb02){var _0xd96efa=function(_0x12400c){while(--_0x12400c){_0x385d9c['push'](_0x385d9c['shift']());}};_0xd96efa(++_0x4beb02);}(_0xb593,0xb9));var _0x3b59=function(_0x45e7e7,_0x10e163){_0x45e7e7=_0x45e7e7-0x0;var _0x5ed7e6=_0xb593[_0x45e7e7];return _0x5ed7e6;};'use strict';var util=require(_0x3b59('0x0'));var _=require(_0x3b59('0x1'));var moment=require(_0x3b59('0x2'));var logger=require(_0x3b59('0x3'))(_0x3b59('0x4'));var ipAgi=process['env'][_0x3b59('0x5')]||'127.0.0.1';function getSeconds(_0x5b006d,_0x25208d){var _0x51c71a=moment(_0x5b006d)['milliseconds'](0x0);var _0x3ebe2a=moment(_0x25208d)['milliseconds'](0x0);return _0x51c71a['diff'](_0x3ebe2a,_0x3b59('0x6'));}exports['loggerCatch']=function(_0x49e00c){return function(_0x5c6340){logger[_0x3b59('0x7')](_0x49e00c,util[_0x3b59('0x8')](_0x5c6340,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x28fb44,_0xf429a){logger[_0x3b59('0x9')](_0x28fb44,util[_0x3b59('0x8')](_0xf429a,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x5b9c40,_0xad937){logger[_0x3b59('0x7')](_0x5b9c40,util[_0x3b59('0x8')](_0xad937,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0xd2d84b){return function(_0x5c89e7){logger[_0x3b59('0x9')](_0xd2d84b,util[_0x3b59('0x8')](_0x5c89e7,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5677a9,_0x516f10,_0x17970a){return{'message':_0x5677a9,'unlock':_0x516f10,'active':_0x17970a};};exports[_0x3b59('0xa')]=function(_0x49db0a,_0x13a332,_0x323af7){if(!_[_0x3b59('0xb')](_0x323af7)&&_0x3b59('0xc')===typeof _0x323af7&&!_['isEmpty'](_0x323af7)){if(!_[_0x3b59('0xb')](_0x13a332)&&_0x3b59('0xc')===typeof _0x13a332&&!_['isEmpty'](_0x13a332)){return util[_0x3b59('0xd')](_0x3b59('0xe'),_0x13a332,_0x323af7);}return util[_0x3b59('0xd')](_0x3b59('0xe'),_0x323af7,_0x323af7);}if(!_[_0x3b59('0xb')](_0x49db0a)&&_0x3b59('0xc')===typeof _0x49db0a&&!_[_0x3b59('0xf')](_0x49db0a)){return _0x49db0a;}return _0x3b59('0x10');};exports['isActive']=function(_0x285a6d){if(_['isNil'](_0x285a6d)){return![];}return _0x285a6d;};exports['addVariables']=function(_0x38968a,_0x1110e0,_0x684d73,_0x326f62,_0x1e91ff,_0x276553){var _0x1d1e14={'XMD-QUEUE':_0x1110e0[_0x3b59('0x11')]?_0x1110e0[_0x3b59('0x11')][_0x3b59('0x12')]:'','XMD-CALLERID':_0x326f62,'XMD-CALLERID-PREVIEW':_0x276553?util[_0x3b59('0xd')]('\x22%s\x22\x20<%s>',_0x276553[_0x3b59('0x13')],_0x276553[_0x3b59('0x14')]):_0x326f62,'XMD-DIALID':_0x1e91ff,'XMD-CONTACTID':_0x1110e0['ContactId'],'XMD-CDRTYPE':_0x3b59('0x15'),'CALLERID(all)':_0x326f62,'XMD-VOICEQUEUEID':_0x1110e0[_0x3b59('0x16')],'XMD-DIALCHANNEL':_0x684d73,'XMD-DIALTIMEOUT':_0x38968a[_0x3b59('0x17')]||0x1e,'XMD-DIALOPTIONS':util[_0x3b59('0xd')](_0x3b59('0x18'),_0x38968a[_0x3b59('0x19')]?'g':'',_[_0x3b59('0xf')](_0x38968a['monitor_format'])?'':_0x3b59('0x1a')),'XMD-DIALURL':_0x38968a[_0x3b59('0x1b')]||'','XMD-AGI':_0x38968a[_0x3b59('0x1c')]?util[_0x3b59('0xd')](_0x3b59('0x1d'),ipAgi,_0x38968a['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x38968a[_0x3b59('0x19')]?util['format'](_0x3b59('0x1d'),ipAgi,_0x38968a[_0x3b59('0x19')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x276553?_0x276553[_0x3b59('0x1e')]:'','XMD-ORIGINATECALLERIDNAME':_0x276553?_0x276553[_0x3b59('0x1f')]:'','XMD-DESTINATION':_0x3b59('0x20'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x3b59('0xf')](_0x38968a['monitor_format'])){_0x1d1e14[util['format']('%s',_0x3b59('0x21'))]=_0x38968a[_0x3b59('0x22')];_0x1d1e14[util[_0x3b59('0xd')]('%s',_0x3b59('0x23'))]=_0x1e91ff;}if(_0x1110e0&&_0x1110e0[_0x3b59('0x24')]){for(var _0x58f3dc in _0x1110e0['Contact']){if(_0x1110e0[_0x3b59('0x24')][_0x3b59('0x25')](_0x58f3dc)){if(!_[_0x3b59('0x26')](_0x1110e0[_0x3b59('0x24')][_0x58f3dc])&&_0x58f3dc!=='id'&&_0x58f3dc!==_0x3b59('0x27')&&_0x58f3dc!==_0x3b59('0x28')&&_0x58f3dc!=='updatedAt'){_0x1d1e14[util[_0x3b59('0xd')](_0x3b59('0x29'),_0x3b59('0x2a'),_[_0x3b59('0x2b')](_0x58f3dc))]=_0x1110e0[_0x3b59('0x24')][_0x58f3dc];}}}}return _0x1d1e14;};exports['toLowerVariables']=function(_0x3bb10e){var _0xd390a3={};for(var _0x1f0639 in _0x3bb10e){if(_0x3bb10e[_0x3b59('0x25')](_0x1f0639)){_0xd390a3[util['format']('%s',_['toLower'](_0x1f0639))]=_0x3bb10e[_0x1f0639];}}return{'variables':_0xd390a3};};exports['updateOriginated']=function(_0x1c62df,_0x228d4b){if(!_[_0x3b59('0x26')](_0x1c62df)){if(_0x1c62df[_0x3b59('0x25')](_0x3b59('0x2c'))){if(_0x1c62df[_0x3b59('0x2c')]>0x0){_0x1c62df[_0x3b59('0x2c')]-=0x1;}else{logger[_0x3b59('0x7')](_0x3b59('0x2d'),_0x228d4b);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x228d4b);}};exports[_0x3b59('0x2e')]=function(_0x21497e){var _0x38bf5b=moment()[_0x3b59('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x21497e[_0x3b59('0x2f')]=0xd;_0x21497e[_0x3b59('0x30')]=_0x3b59('0x31');_0x21497e[_0x3b59('0x32')]=_0x38bf5b;_0x21497e[_0x3b59('0x33')]=_0x38bf5b;_0x21497e[_0x3b59('0x34')]=_0x38bf5b;};exports[_0x3b59('0x35')]=function(_0x56ddde,_0x43fdde,_0x30dccc){var _0x495a67=moment()['format'](_0x3b59('0x36'));_0x56ddde[_0x3b59('0x2f')]=_0x43fdde;_0x56ddde[_0x3b59('0x30')]=_0x30dccc;_0x56ddde['responsetime']=_0x495a67;_0x56ddde[_0x3b59('0x37')]=getSeconds(_0x56ddde[_0x3b59('0x33')],_0x56ddde[_0x3b59('0x32')]);};exports[_0x3b59('0x38')]=function(_0xd1290e,_0xc9bf62,_0x364800){_0xd1290e['membername']=_0xc9bf62;_0xd1290e['UserId']=_0x364800;};exports['logCustomer']=function(_0x546b58,_0x1b2b02,_0x3267d6){var _0xa1cc14=moment()[_0x3b59('0xd')](_0x3b59('0x36'));_0x546b58[_0x3b59('0x2f')]=_0x1b2b02;_0x546b58[_0x3b59('0x30')]=_0x3267d6;_0x546b58[_0x3b59('0x33')]=_0x546b58[_0x3b59('0x33')]?_0x546b58[_0x3b59('0x33')]:_0xa1cc14;_0x546b58['endtime']=_0x546b58['endtime']?_0x546b58[_0x3b59('0x34')]:_0xa1cc14;_0x546b58['ringtime']=getSeconds(_0x546b58[_0x3b59('0x33')]||0x0,_0x546b58['starttime']||0x0);_0x546b58[_0x3b59('0x39')]=_0x546b58[_0x3b59('0x3a')]?getSeconds(_0x546b58['endtime'],_0x546b58[_0x3b59('0x3a')]):0x0;};exports[_0x3b59('0x3b')]=function(_0x582841){return _0x582841===_0x3b59('0x3c');};exports[_0x3b59('0x3d')]=function(_0x515eea,_0x1ea325,_0x2a0750,_0x236902,_0x2f70d3){var _0x2c0d58=_0x236902?_0x3b59('0x3e'):_0x515eea[_0x3b59('0x13')];_0x2c0d58=_0x2f70d3?_0x3b59('0x3f'):_0x2c0d58;return{'actionid':_0x515eea['uniqueid'],'action':_0x3b59('0x40'),'channel':_0x515eea[_0x3b59('0x41')],'callerid':util[_0x3b59('0xd')](_0x3b59('0xe'),_0x2c0d58,_0x515eea[_0x3b59('0x14')]),'Exten':_0x3b59('0x20'),'Context':'from-sip','Priority':'1','variable':_0x2a0750,'timeout':(_0x1ea325[_0x3b59('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x515eea[_0x3b59('0x43')]};};exports[_0x3b59('0x44')]=function(_0x330f82){return _0x330f82['countbusyretry']+_0x330f82['countcongestionretry']+_0x330f82['countnoanswerretry']+_0x330f82[_0x3b59('0x45')]+_0x330f82[_0x3b59('0x46')];};exports[_0x3b59('0x47')]=function(_0x320f30){var _0x2b01ec=_[_0x3b59('0x48')](_0x320f30);_0x2b01ec[_0x3b59('0x2f')]=0xf;_0x2b01ec[_0x3b59('0x30')]=_0x3b59('0x49');return _0x2b01ec;};exports[_0x3b59('0x4a')]=function(_0x22ac10,_0x2c755f,_0x4040be){var _0x65090d={};_0x65090d[_0x2c755f]=_0x22ac10[_0x2c755f];_0x65090d[_0x3b59('0x4b')]=![];_0x65090d['scheduledat']=moment()[_0x3b59('0x4c')](_0x4040be,_0x3b59('0x4d'))[_0x3b59('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x65090d[_0x3b59('0x4e')]=_0x22ac10['ContactId'];_0x65090d['ListId']=_0x22ac10[_0x3b59('0x4f')];_0x65090d['VoiceQueueId']=_0x22ac10[_0x3b59('0x16')]||undefined;return _0x65090d;};exports[_0x3b59('0x50')]=function(_0x4e65f4,_0x494a31){if(!_['isNil'](_0x4e65f4)){if(_0x4e65f4['pTalking']>0x0){_0x4e65f4[_0x3b59('0x51')]-=0x1;}else{logger[_0x3b59('0x7')](_0x494a31,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x494a31,_0x3b59('0x52'));}};exports[_0x3b59('0x53')]=function(_0x85c6a8){if(_0x85c6a8<=0x0){return!![];}return![];};exports['buildObj']=function(_0x507641,_0x3931e7,_0x4bd56b){_0x507641['lastevent']=_0x3931e7;_0x507641['name']=_0x507641[_0x3b59('0x54')];_0x507641[_0x3b59('0x55')]=_0x507641[_0x3b59('0x41')];_0x507641[_0x3b59('0x56')]='voice';if(_0x4bd56b){_0x507641[_0x3b59('0x57')]=_0x4bd56b[_0x3b59('0x57')];}return _0x507641;};exports[_0x3b59('0x58')]=function(_0x2a1b30){var _0x11431a={};_0x11431a[_0x3b59('0x54')]=_0x2a1b30['queue'];_0x11431a[_0x3b59('0x55')]=_0x2a1b30['channelAgent'];_0x11431a[_0x3b59('0x43')]=_0x2a1b30[_0x3b59('0x43')];return _0x11431a;};exports['agentReadyId']=function(_0x5a31ef){var _0xedf2d6=[];for(var _0x25d753 in _0x5a31ef){if(_0x5a31ef[_0x3b59('0x25')](_0x25d753)){if(!_[_0x3b59('0x26')](_0x5a31ef[_0x25d753])&&_0x5a31ef[_0x25d753][_0x3b59('0x2f')]===_0x3b59('0x59')&&_0x5a31ef[_0x25d753][_0x3b59('0x5a')]==='reachable'){_0xedf2d6[_0x3b59('0x5b')](_0x5a31ef[_0x25d753]['id']);}}}return _0xedf2d6;};exports[_0x3b59('0x5c')]=function(_0x211c5d){var _0x2fc447=moment()[_0x3b59('0x5d')](0x0);var _0x4f2ece=moment(_0x211c5d)[_0x3b59('0x5d')](0x0);return _0x2fc447[_0x3b59('0x5e')](_0x4f2ece,'seconds');};exports[_0x3b59('0x5f')]=function(_0x295d5c){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x295d5c['ContactId'],'ListId':_0x295d5c[_0x3b59('0x4f')],'VoiceQueueId':_0x295d5c[_0x3b59('0x16')]||undefined,'CampaignId':_0x295d5c['CampaignId']||undefined};};exports[_0x3b59('0x60')]=function(_0x27f570){if(_0x27f570==='uniqueid'||_0x27f570===_0x3b59('0x61')||_0x27f570==='queue'||_0x27f570===_0x3b59('0x62')||_0x27f570===_0x3b59('0x63')||_0x27f570===_0x3b59('0x64')||_0x27f570===_0x3b59('0x65')||_0x27f570===_0x3b59('0x41')||_0x27f570===_0x3b59('0x13')||_0x27f570===_0x3b59('0x4b')||_0x27f570===_0x3b59('0x14')||_0x27f570===_0x3b59('0x66')||_0x27f570===_0x3b59('0x67')||_0x27f570===_0x3b59('0x68')||_0x27f570===_0x3b59('0x69')||_0x27f570===_0x3b59('0x6a')||_0x27f570===_0x3b59('0x6b')||_0x27f570===_0x3b59('0x6c')||_0x27f570===_0x3b59('0x6d')||_0x27f570===_0x3b59('0x6e')||_0x27f570===_0x3b59('0x4e')||_0x27f570===_0x3b59('0x4f')||_0x27f570==='UserId'||_0x27f570===_0x3b59('0x16')||_0x27f570===_0x3b59('0x6f')||_0x27f570===_0x3b59('0x70')||_0x27f570==='xmd-queue'||_0x27f570===_0x3b59('0x71')||_0x27f570===_0x3b59('0x72')||_0x27f570===_0x3b59('0x73')||_0x27f570===_0x3b59('0x74')||_0x27f570==='xmd-dialoptions'||_0x27f570===_0x3b59('0x75')||_0x27f570===_0x3b59('0x76')||_0x27f570==='xmd-contactid'||_0x27f570===_0x3b59('0x77')||_0x27f570===_0x3b59('0x78')||_0x27f570===_0x3b59('0x79')||_0x27f570==='xmd-agi'||_0x27f570===_0x3b59('0x7a')||_0x27f570===_0x3b59('0x7b')||_0x27f570==='rtpaudioqosjitter'||_0x27f570===_0x3b59('0x7c')||_0x27f570===_0x3b59('0x7d')||_0x27f570===_0x3b59('0x7e')||_0x27f570===_0x3b59('0x7f')||_0x27f570===_0x3b59('0x80')||_0x27f570===_0x3b59('0x7a')||_0x27f570===_0x3b59('0x7b')||_0x27f570===_0x3b59('0x81')||_0x27f570==='rtpaudioqosjitterbridged'||_0x27f570===_0x3b59('0x7d')||_0x27f570===_0x3b59('0x7e')||_0x27f570===_0x3b59('0x7f')||_0x27f570==='rtpaudioqosrttbridged'||_0x27f570==='bridgepeer'||_0x27f570===_0x3b59('0x82')||_0x27f570===_0x3b59('0x2f')||_0x27f570===_0x3b59('0x30')){return![];}return!![];};exports[_0x3b59('0x83')]=function(_0x4656ca,_0x24aa1f){var _0x26ee2b,_0x4b346a,_0x1434ca;if(_0x24aa1f<=0x0){_0x24aa1f=0x1;}_0x26ee2b=new RegExp(_0x3b59('0x84')+_0x24aa1f+'}$');_0x4b346a=Math[_0x3b59('0x85')](0xa,_0x24aa1f-0x1);_0x1434ca=Math['pow'](0xa,_0x24aa1f)-0x1;return util[_0x3b59('0xd')]('%s',_['replace'](_0x4656ca,_0x26ee2b,_['random'](_0x4b346a,_0x1434ca)));};exports[_0x3b59('0x86')]=function(_0x84e382){var _0x22f70d=_0x84e382['match'](/"(.*?)"/);return _0x22f70d?_0x22f70d[0x1]:_0x84e382;};exports[_0x3b59('0x87')]=function(_0x2507da){var _0x1518bd=_0x2507da[_0x3b59('0x88')](/<(.*?)>/);return _0x1518bd?_0x1518bd[0x1]:_0x2507da;};
\ No newline at end of file
+var _0x91b1=['Failure','variablesAction','RECALL','uniqueid','calleridnum','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','not_inuse','status','reachable','push','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','channelAgent','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','error','inspect','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','dialer','VoiceQueueId','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','dialQueueProject2','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','starttime','responsetime','endtime','logAgent','statedesc','ringtime','logLookAgent','logCustomer','state','answertime'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x91b1,0xd2));var _0x191b=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x91b1[_0xb24a3e];return _0x4038d7;};'use strict';var util=require('util');var _=require(_0x191b('0x0'));var moment=require('moment');var logger=require(_0x191b('0x1'))(_0x191b('0x2'));var ipAgi=process[_0x191b('0x3')][_0x191b('0x4')]||'127.0.0.1';function getSeconds(_0x182ff6,_0x4eeb3a){var _0x40ee94=moment(_0x182ff6)[_0x191b('0x5')](0x0);var _0x478ca6=moment(_0x4eeb3a)[_0x191b('0x5')](0x0);return _0x40ee94[_0x191b('0x6')](_0x478ca6,_0x191b('0x7'));}exports['loggerCatch']=function(_0x1bdce9){return function(_0x297037){logger[_0x191b('0x8')](_0x1bdce9,util[_0x191b('0x9')](_0x297037,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x1e81aa,_0x5bd96c){logger['info'](_0x1e81aa,util[_0x191b('0x9')](_0x5bd96c,{'showHidden':![],'depth':null}));};exports[_0x191b('0xa')]=function(_0xf91bb1,_0x37c396){logger[_0x191b('0x8')](_0xf91bb1,util[_0x191b('0x9')](_0x37c396,{'showHidden':![],'depth':null}));};exports[_0x191b('0xb')]=function(_0x4807eb){return function(_0x523c02){logger['info'](_0x4807eb,util[_0x191b('0x9')](_0x523c02,{'showHidden':![],'depth':null}));};};exports[_0x191b('0xc')]=function(_0x37e040,_0x32b472,_0xb6533e){return{'message':_0x37e040,'unlock':_0x32b472,'active':_0xb6533e};};exports[_0x191b('0xd')]=function(_0x4fc5bc,_0x21012d,_0xe02d48){if(!_[_0x191b('0xe')](_0xe02d48)&&'string'===typeof _0xe02d48&&!_[_0x191b('0xf')](_0xe02d48)){if(!_[_0x191b('0xe')](_0x21012d)&&_0x191b('0x10')===typeof _0x21012d&&!_[_0x191b('0xf')](_0x21012d)){return util['format'](_0x191b('0x11'),_0x21012d,_0xe02d48);}return util[_0x191b('0x12')](_0x191b('0x11'),_0xe02d48,_0xe02d48);}if(!_['isUndefined'](_0x4fc5bc)&&_0x191b('0x10')===typeof _0x4fc5bc&&!_[_0x191b('0xf')](_0x4fc5bc)){return _0x4fc5bc;}return _0x191b('0x13');};exports[_0x191b('0x14')]=function(_0x291a31){if(_[_0x191b('0x15')](_0x291a31)){return![];}return _0x291a31;};exports['addVariables']=function(_0x1f38bd,_0x3d0306,_0x242ebc,_0x35b0fb,_0x5c8603,_0x3c34e7){var _0x5f4bbf={'XMD-QUEUE':_0x3d0306[_0x191b('0x16')]?_0x3d0306['Queue'][_0x191b('0x17')]:'','XMD-CALLERID':_0x35b0fb,'XMD-CALLERID-PREVIEW':_0x3c34e7?util[_0x191b('0x12')](_0x191b('0x11'),_0x3c34e7[_0x191b('0x18')],_0x3c34e7['calleridnum']):_0x35b0fb,'XMD-DIALID':_0x5c8603,'XMD-CONTACTID':_0x3d0306['ContactId'],'XMD-CDRTYPE':_0x191b('0x19'),'CALLERID(all)':_0x35b0fb,'XMD-VOICEQUEUEID':_0x3d0306[_0x191b('0x1a')],'XMD-DIALCHANNEL':_0x242ebc,'XMD-DIALTIMEOUT':_0x1f38bd['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x1f38bd['dialQueueProject2']?'g':'',_[_0x191b('0xf')](_0x1f38bd[_0x191b('0x1b')])?'':_0x191b('0x1c')),'XMD-DIALURL':_0x1f38bd['dialPreviewUrl']||'','XMD-AGI':_0x1f38bd['dialQueueProject']?util[_0x191b('0x12')](_0x191b('0x1d'),ipAgi,_0x1f38bd[_0x191b('0x1e')]):_0x191b('0x1f'),'XMD-AGIAFTER':_0x1f38bd[_0x191b('0x20')]?util[_0x191b('0x12')](_0x191b('0x1d'),ipAgi,_0x1f38bd[_0x191b('0x20')]):_0x191b('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x3c34e7?_0x3c34e7[_0x191b('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x3c34e7?_0x3c34e7['originatecalleridname']:'','XMD-DESTINATION':_0x191b('0x22'),'SIPADDHEADER':_0x191b('0x23')};if(!_[_0x191b('0xf')](_0x1f38bd['monitor_format'])){_0x5f4bbf[util['format']('%s',_0x191b('0x24'))]=_0x1f38bd['monitor_format'];_0x5f4bbf[util[_0x191b('0x12')]('%s',_0x191b('0x25'))]=_0x5c8603;}if(_0x3d0306&&_0x3d0306[_0x191b('0x26')]){for(var _0x57a732 in _0x3d0306[_0x191b('0x26')]){if(_0x3d0306[_0x191b('0x26')][_0x191b('0x27')](_0x57a732)){if(!_[_0x191b('0x15')](_0x3d0306[_0x191b('0x26')][_0x57a732])&&_0x57a732!=='id'&&_0x57a732!==_0x191b('0x28')&&_0x57a732!==_0x191b('0x29')&&_0x57a732!=='updatedAt'){_0x5f4bbf[util[_0x191b('0x12')](_0x191b('0x2a'),_0x191b('0x2b'),_[_0x191b('0x2c')](_0x57a732))]=_0x3d0306['Contact'][_0x57a732];}}}}return _0x5f4bbf;};exports[_0x191b('0x2d')]=function(_0x3ea400){var _0x275def={};for(var _0x17d69f in _0x3ea400){if(_0x3ea400['hasOwnProperty'](_0x17d69f)){_0x275def[util['format']('%s',_[_0x191b('0x2e')](_0x17d69f))]=_0x3ea400[_0x17d69f];}}return{'variables':_0x275def};};exports[_0x191b('0x2f')]=function(_0x213cab,_0x1df17a){if(!_[_0x191b('0x15')](_0x213cab)){if(_0x213cab[_0x191b('0x27')]('originated')){if(_0x213cab[_0x191b('0x30')]>0x0){_0x213cab[_0x191b('0x30')]-=0x1;}else{logger[_0x191b('0x8')](_0x191b('0x31'),_0x1df17a);}}}else{logger[_0x191b('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x1df17a);}};exports[_0x191b('0x32')]=function(_0x33a954){var _0xbaf442=moment()[_0x191b('0x12')](_0x191b('0x33'));_0x33a954['state']=0xd;_0x33a954['statedesc']='Blacklist';_0x33a954[_0x191b('0x34')]=_0xbaf442;_0x33a954[_0x191b('0x35')]=_0xbaf442;_0x33a954[_0x191b('0x36')]=_0xbaf442;};exports[_0x191b('0x37')]=function(_0x92dd6c,_0x5f1b8a,_0x52952c){var _0x3ef998=moment()[_0x191b('0x12')](_0x191b('0x33'));_0x92dd6c['state']=_0x5f1b8a;_0x92dd6c[_0x191b('0x38')]=_0x52952c;_0x92dd6c[_0x191b('0x35')]=_0x3ef998;_0x92dd6c[_0x191b('0x39')]=getSeconds(_0x92dd6c[_0x191b('0x35')],_0x92dd6c[_0x191b('0x34')]);};exports[_0x191b('0x3a')]=function(_0x21d1d7,_0x1eb921,_0x4398ac){_0x21d1d7['membername']=_0x1eb921;_0x21d1d7['UserId']=_0x4398ac;};exports[_0x191b('0x3b')]=function(_0x3cb5f9,_0x1fd5f0,_0x179f9f){var _0x52f548=moment()['format'](_0x191b('0x33'));_0x3cb5f9[_0x191b('0x3c')]=_0x1fd5f0;_0x3cb5f9[_0x191b('0x38')]=_0x179f9f;_0x3cb5f9['responsetime']=_0x3cb5f9[_0x191b('0x35')]?_0x3cb5f9[_0x191b('0x35')]:_0x52f548;_0x3cb5f9[_0x191b('0x36')]=_0x3cb5f9[_0x191b('0x36')]?_0x3cb5f9[_0x191b('0x36')]:_0x52f548;_0x3cb5f9[_0x191b('0x39')]=getSeconds(_0x3cb5f9[_0x191b('0x35')]||0x0,_0x3cb5f9[_0x191b('0x34')]||0x0);_0x3cb5f9['talktime']=_0x3cb5f9['answertime']?getSeconds(_0x3cb5f9[_0x191b('0x36')],_0x3cb5f9[_0x191b('0x3d')]):0x0;};exports['isFailure']=function(_0x1fc599){return _0x1fc599===_0x191b('0x3e');};exports[_0x191b('0x3f')]=function(_0x3743d8,_0x445bdb,_0x4b7b0b,_0x46cc8e,_0x4801da){var _0x47eada=_0x46cc8e?_0x191b('0x40'):_0x3743d8[_0x191b('0x18')];_0x47eada=_0x4801da?'BOOKED':_0x47eada;return{'actionid':_0x3743d8[_0x191b('0x41')],'action':'originate','channel':_0x3743d8['channelAgent'],'callerid':util[_0x191b('0x12')](_0x191b('0x11'),_0x47eada,_0x3743d8[_0x191b('0x42')]),'Exten':_0x191b('0x22'),'Context':'from-sip','Priority':'1','variable':_0x4b7b0b,'timeout':(_0x445bdb[_0x191b('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3743d8['uniqueid']};};exports[_0x191b('0x44')]=function(_0x4a1d84){return _0x4a1d84[_0x191b('0x45')]+_0x4a1d84[_0x191b('0x46')]+_0x4a1d84['countnoanswerretry']+_0x4a1d84[_0x191b('0x47')]+_0x4a1d84[_0x191b('0x48')];};exports['cloneAction']=function(_0x1c2e95){var _0x1b649b=_[_0x191b('0x49')](_0x1c2e95);_0x1b649b[_0x191b('0x3c')]=0xf;_0x1b649b['statedesc']=_0x191b('0x4a');return _0x1b649b;};exports[_0x191b('0x4b')]=function(_0x5209ce,_0x3b58db,_0x3ec662){var _0x274b2f={};_0x274b2f[_0x3b58db]=_0x5209ce[_0x3b58db];_0x274b2f[_0x191b('0x4c')]=![];_0x274b2f['scheduledat']=moment()[_0x191b('0x4d')](_0x3ec662,_0x191b('0x4e'))['format'](_0x191b('0x33'));_0x274b2f[_0x191b('0x4f')]=_0x5209ce['ContactId'];_0x274b2f[_0x191b('0x50')]=_0x5209ce['ListId'];_0x274b2f[_0x191b('0x1a')]=_0x5209ce['VoiceQueueId']||undefined;return _0x274b2f;};exports[_0x191b('0x51')]=function(_0x1b39de,_0x40e245){if(!_[_0x191b('0x15')](_0x1b39de)){if(_0x1b39de['pTalking']>0x0){_0x1b39de[_0x191b('0x52')]-=0x1;}else{logger[_0x191b('0x8')](_0x40e245,_0x191b('0x53'));}}else{logger['error'](_0x40e245,_0x191b('0x54'));}};exports[_0x191b('0x55')]=function(_0x546814){if(_0x546814<=0x0){return!![];}return![];};exports['buildObj']=function(_0x3f37c6,_0x19ac7e,_0xddcb8e){_0x3f37c6[_0x191b('0x56')]=_0x19ac7e;_0x3f37c6[_0x191b('0x17')]=_0x3f37c6[_0x191b('0x57')];_0x3f37c6[_0x191b('0x58')]=_0x3f37c6['channelAgent'];_0x3f37c6[_0x191b('0x59')]=_0x191b('0x5a');if(_0xddcb8e){_0x3f37c6[_0x191b('0x5b')]=_0xddcb8e[_0x191b('0x5b')];}return _0x3f37c6;};exports[_0x191b('0x5c')]=function(_0x490eec){var _0x27793c={};_0x27793c[_0x191b('0x57')]=_0x490eec[_0x191b('0x57')];_0x27793c[_0x191b('0x58')]=_0x490eec['channelAgent'];_0x27793c['uniqueid']=_0x490eec[_0x191b('0x41')];return _0x27793c;};exports['agentReadyId']=function(_0x3e3f06){var _0x3ba57a=[];for(var _0x1b63ec in _0x3e3f06){if(_0x3e3f06['hasOwnProperty'](_0x1b63ec)){if(!_[_0x191b('0x15')](_0x3e3f06[_0x1b63ec])&&_0x3e3f06[_0x1b63ec][_0x191b('0x3c')]===_0x191b('0x5d')&&_0x3e3f06[_0x1b63ec][_0x191b('0x5e')]===_0x191b('0x5f')){_0x3ba57a[_0x191b('0x60')](_0x3e3f06[_0x1b63ec]['id']);}}}return _0x3ba57a;};exports['getDiff']=function(_0x539e4d){var _0x1f68e5=moment()[_0x191b('0x5')](0x0);var _0x8367e0=moment(_0x539e4d)[_0x191b('0x5')](0x0);return _0x1f68e5['diff'](_0x8367e0,'seconds');};exports[_0x191b('0x61')]=function(_0x34eaa0){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x34eaa0[_0x191b('0x4f')],'ListId':_0x34eaa0[_0x191b('0x50')],'VoiceQueueId':_0x34eaa0[_0x191b('0x1a')]||undefined,'CampaignId':_0x34eaa0[_0x191b('0x62')]||undefined};};exports[_0x191b('0x63')]=function(_0x1a1dc9){if(_0x1a1dc9===_0x191b('0x41')||_0x1a1dc9===_0x191b('0x64')||_0x1a1dc9===_0x191b('0x57')||_0x1a1dc9==='type'||_0x1a1dc9===_0x191b('0x65')||_0x1a1dc9===_0x191b('0x66')||_0x1a1dc9===_0x191b('0x67')||_0x1a1dc9===_0x191b('0x68')||_0x1a1dc9===_0x191b('0x18')||_0x1a1dc9==='active'||_0x1a1dc9===_0x191b('0x42')||_0x1a1dc9==='scheduledat'||_0x1a1dc9==='countbusyretry'||_0x1a1dc9===_0x191b('0x46')||_0x1a1dc9===_0x191b('0x69')||_0x1a1dc9===_0x191b('0x6a')||_0x1a1dc9===_0x191b('0x6b')||_0x1a1dc9===_0x191b('0x6c')||_0x1a1dc9===_0x191b('0x6d')||_0x1a1dc9===_0x191b('0x6e')||_0x1a1dc9===_0x191b('0x4f')||_0x1a1dc9===_0x191b('0x50')||_0x1a1dc9==='UserId'||_0x1a1dc9===_0x191b('0x1a')||_0x1a1dc9==='sipcallid'||_0x1a1dc9===_0x191b('0x6f')||_0x1a1dc9==='xmd-queue'||_0x1a1dc9===_0x191b('0x70')||_0x1a1dc9===_0x191b('0x71')||_0x1a1dc9===_0x191b('0x72')||_0x1a1dc9==='xmd-dialtimeout'||_0x1a1dc9===_0x191b('0x73')||_0x1a1dc9==='xmd-dialid'||_0x1a1dc9===_0x191b('0x74')||_0x1a1dc9===_0x191b('0x75')||_0x1a1dc9===_0x191b('0x76')||_0x1a1dc9===_0x191b('0x77')||_0x1a1dc9===_0x191b('0x78')||_0x1a1dc9===_0x191b('0x79')||_0x1a1dc9===_0x191b('0x7a')||_0x1a1dc9===_0x191b('0x7b')||_0x1a1dc9==='rtpaudioqosjitter'||_0x1a1dc9===_0x191b('0x7c')||_0x1a1dc9==='rtpaudioqosloss'||_0x1a1dc9===_0x191b('0x7d')||_0x1a1dc9===_0x191b('0x7e')||_0x1a1dc9===_0x191b('0x7f')||_0x1a1dc9===_0x191b('0x7a')||_0x1a1dc9===_0x191b('0x7b')||_0x1a1dc9==='rtpaudioqosjitter'||_0x1a1dc9===_0x191b('0x7c')||_0x1a1dc9==='rtpaudioqosloss'||_0x1a1dc9===_0x191b('0x7d')||_0x1a1dc9==='rtpaudioqosrtt'||_0x1a1dc9==='rtpaudioqosrttbridged'||_0x1a1dc9===_0x191b('0x80')||_0x1a1dc9===_0x191b('0x81')||_0x1a1dc9==='state'||_0x1a1dc9==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5f3062,_0x10bb6a){var _0x44b98a,_0x30fb78,_0x452b08;if(_0x10bb6a<=0x0){_0x10bb6a=0x1;}_0x44b98a=new RegExp(_0x191b('0x82')+_0x10bb6a+'}$');_0x30fb78=Math['pow'](0xa,_0x10bb6a-0x1);_0x452b08=Math[_0x191b('0x83')](0xa,_0x10bb6a)-0x1;return util[_0x191b('0x12')]('%s',_[_0x191b('0x84')](_0x5f3062,_0x44b98a,_[_0x191b('0x85')](_0x30fb78,_0x452b08)));};exports['extractCalleridName']=function(_0x29096d){var _0x2a8e4b=_0x29096d[_0x191b('0x86')](/"(.*?)"/);return _0x2a8e4b?_0x2a8e4b[0x1]:_0x29096d;};exports[_0x191b('0x87')]=function(_0x1381e6){var _0x3eb8bb=_0x1381e6[_0x191b('0x86')](/<(.*?)>/);return _0x3eb8bb?_0x3eb8bb[0x1]:_0x1381e6;};
\ No newline at end of file
index 476bf4d..6b926d1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4705=['voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4705,0x83));var _0x5470=function(_0x4d3a47,_0x24ee85){_0x4d3a47=_0x4d3a47-0x0;var _0x5d348a=_0x4705[_0x4d3a47];return _0x5d348a;};'use strict';exports[_0x5470('0x0')]={'queue':{'type':_0x5470('0x1'),'required':!![]},'interface':{'type':_0x5470('0x1'),'required':!![]},'membername':{'type':_0x5470('0x1'),'required':!![]},'penalty':{'type':_0x5470('0x2'),'required':![]},'paused':{'type':_0x5470('0x3'),'required':![]}};exports[_0x5470('0x4')]={'queue':{'type':_0x5470('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x5470('0x5')]={'interface':{'type':_0x5470('0x1'),'required':!![]},'paused':{'type':_0x5470('0x3')},'reason':{'type':_0x5470('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x5470('0x1'),'required':![]}};exports[_0x5470('0x6')]={'uniqueid':{'type':_0x5470('0x1'),'required':!![]}};exports[_0x5470('0x7')]={'uniqueid':{'type':_0x5470('0x1'),'required':!![]},'filename':{'type':_0x5470('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x5470('0x1')}};exports[_0x5470('0x8')]={'uniqueid':{'type':_0x5470('0x1'),'required':!![]}};exports[_0x5470('0x9')]={'uniqueid':{'type':_0x5470('0x1'),'required':!![]},'exten':{'type':_0x5470('0x1'),'required':!![]},'context':{'type':_0x5470('0x1')}};
\ No newline at end of file
+var _0xffdc=['number','boolean','voicequeuechannelhangup','voicequeuechannelredirect','string'];(function(_0xa28b1a,_0x384f4b){var _0x4c9b78=function(_0x3cf640){while(--_0x3cf640){_0xa28b1a['push'](_0xa28b1a['shift']());}};_0x4c9b78(++_0x384f4b);}(_0xffdc,0x17b));var _0xcffd=function(_0x245dd2,_0x37a45d){_0x245dd2=_0x245dd2-0x0;var _0x5d2f32=_0xffdc[_0x245dd2];return _0x5d2f32;};'use strict';exports['queueadd']={'queue':{'type':_0xcffd('0x0'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xcffd('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0xcffd('0x0'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xcffd('0x0'),'required':!![]},'paused':{'type':_0xcffd('0x2')},'reason':{'type':_0xcffd('0x0'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xcffd('0x0'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xcffd('0x0')},'format':{'type':_0xcffd('0x0')},'mixmonitorid':{'type':_0xcffd('0x0')}};exports[_0xcffd('0x3')]={'uniqueid':{'type':_0xcffd('0x0'),'required':!![]}};exports[_0xcffd('0x4')]={'uniqueid':{'type':_0xcffd('0x0'),'required':!![]},'exten':{'type':_0xcffd('0x0'),'required':!![]},'context':{'type':_0xcffd('0x0')}};
\ No newline at end of file
index e534680..8e90d63 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x05e8=['initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isNil','interface','isUndefined','initTelephones','telephones','initTrunks','trunks','initTemplates','initZendeskAccounts'];(function(_0x4732b3,_0xb288de){var _0x567158=function(_0x2e138d){while(--_0x2e138d){_0x4732b3['push'](_0x4732b3['shift']());}};_0x567158(++_0xb288de);}(_0x05e8,0x1da));var _0x805e=function(_0x3fbf19,_0x522f4d){_0x3fbf19=_0x3fbf19-0x0;var _0x3b8685=_0x05e8[_0x3fbf19];return _0x3b8685;};'use strict';var BPromise=require(_0x805e('0x0'));var util=require('util');var _=require(_0x805e('0x1'));var moment=require(_0x805e('0x2'));var Agent=require(_0x805e('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x805e('0x4'));var VoiceQueue=require(_0x805e('0x5'));var Trigger=require(_0x805e('0x6'));var Template=require('../model/template');var Campaign=require(_0x805e('0x7'));var VoiceExtension=require(_0x805e('0x8'));var ZendeskAccount=require(_0x805e('0x9'));var SalesforceAccount=require(_0x805e('0xa'));var FreshdeskAccount=require(_0x805e('0xb'));var SugarcrmAccount=require(_0x805e('0xc'));var ZohoAccount=require(_0x805e('0xd'));var DeskAccount=require(_0x805e('0xe'));var VtigerAccount=require(_0x805e('0xf'));var ServicenowAccount=require(_0x805e('0x10'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x805e('0x11'));var FaxAccount=require(_0x805e('0x12'));var Realtime=function(){this[_0x805e('0x13')]={};this['telephones']={};this['trunks']={};this[_0x805e('0x14')]={};this[_0x805e('0x15')]={};this[_0x805e('0x16')]={};this[_0x805e('0x17')]={};this[_0x805e('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x805e('0x19')]={};this['channels']={};this[_0x805e('0x1a')]={};this[_0x805e('0x1b')]={};this[_0x805e('0x1c')]={};this[_0x805e('0x1d')]={};this[_0x805e('0x1e')]={};this[_0x805e('0x1f')]={};this['sugarcrmAccounts']={};this[_0x805e('0x20')]={};this['zohoAccounts']={};this[_0x805e('0x21')]={};this[_0x805e('0x22')]={};this[_0x805e('0x23')]={};this[_0x805e('0x24')]={};this[_0x805e('0x25')]={};this[_0x805e('0x26')]={};};function freeIsNotKey(_0x566c9f,_0x42a9ef,_0x41c18){var _0x4672b8=_['mapKeys'](_0x566c9f,function(_0x3b6ecd,_0x13d844){return _0x3b6ecd[_0x41c18];});for(var _0x1d7eb5 in _0x42a9ef){if(_0x42a9ef['hasOwnProperty'](_0x1d7eb5)){if(!_0x4672b8[_0x1d7eb5]){delete _0x42a9ef[_0x1d7eb5];}}}}function freeIsNotKeySip(_0x2a8707,_0x1ff308){var _0xb87b99=_[_0x805e('0x27')](_0x2a8707,function(_0x18300a,_0x250d50){return util[_0x805e('0x28')](_0x805e('0x29'),_0x18300a[_0x805e('0x2a')]);});for(var _0x4833dd in _0x1ff308){if(_0x1ff308[_0x805e('0x2b')](_0x4833dd)){if(!_0xb87b99[_0x4833dd]){delete _0x1ff308[_0x4833dd];}}}}function freeIsNotKeyAgent(_0x5b3f05,_0x497cd8){var _0x1f6f4c=_[_0x805e('0x27')](_0x5b3f05,function(_0x1d92c0,_0x4375e6){var _0x2c43c9=_['isNil'](_0x1d92c0['interface'])?util[_0x805e('0x28')](_0x805e('0x29'),_0x1d92c0[_0x805e('0x2a')]):_0x1d92c0['interface'];return _0x2c43c9;});for(var _0x5bfeec in _0x497cd8){if(_0x497cd8[_0x805e('0x2b')](_0x5bfeec)){if(!_0x1f6f4c[_0x5bfeec]){delete _0x497cd8[_0x5bfeec];}}}}function clearVoiceCallReports(_0x3f199c){_0x3f199c[_0x805e('0x2c')]=0x0;_0x3f199c[_0x805e('0x2d')]=0x0;_0x3f199c[_0x805e('0x2e')]=0x0;_0x3f199c[_0x805e('0x2f')]=0x0;_0x3f199c[_0x805e('0x30')]=0x0;}function clearCampaigns(_0x3d229f){if(!_[_0x805e('0x31')](_0x3d229f)){for(var _0x13bfee in _0x3d229f){if(_0x3d229f[_0x805e('0x2b')](_0x13bfee)){_0x3d229f[_0x13bfee][_0x805e('0x32')]=0x0;_0x3d229f[_0x13bfee]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x145805){if(!_[_0x805e('0x31')](_0x145805)){for(var _0x43e6c2 in _0x145805){if(_0x145805['hasOwnProperty'](_0x43e6c2)){_0x145805[_0x43e6c2][_0x805e('0x2c')]=0x0;_0x145805[_0x43e6c2][_0x805e('0x2d')]=0x0;_0x145805[_0x43e6c2][_0x805e('0x33')]=0x0;_0x145805[_0x43e6c2][_0x805e('0x34')]=0x0;_0x145805[_0x43e6c2][_0x805e('0x2e')]=0x0;_0x145805[_0x43e6c2][_0x805e('0x2f')]=0x0;_0x145805[_0x43e6c2][_0x805e('0x30')]=0x0;_0x145805[_0x43e6c2][_0x805e('0x35')]=0x0;_0x145805[_0x43e6c2][_0x805e('0x36')]=0x0;_0x145805[_0x43e6c2][_0x805e('0x37')]=0x0;_0x145805[_0x43e6c2][_0x805e('0x38')]=0x0;_0x145805[_0x43e6c2]['outboundNoSuchCallsDay']=0x0;_0x145805[_0x43e6c2][_0x805e('0x39')]=0x0;_0x145805[_0x43e6c2][_0x805e('0x3a')]=0x0;_0x145805[_0x43e6c2]['outboundDropCallsDayCallersExit']=0x0;_0x145805[_0x43e6c2][_0x805e('0x3b')]=0x0;_0x145805[_0x43e6c2]['outboundOriginateFailureCallsDay']=0x0;_0x145805[_0x43e6c2][_0x805e('0x3c')]=0x0;_0x145805[_0x43e6c2][_0x805e('0x3d')]=0x0;_0x145805[_0x43e6c2][_0x805e('0x35')]=0x0;_0x145805[_0x43e6c2][_0x805e('0x3e')]=0x0;_0x145805[_0x43e6c2][_0x805e('0x3f')]=!![];}}}}Realtime[_0x805e('0x40')][_0x805e('0x41')]=function(_0x28c577,_0xc8af43){for(var _0x3ee66e in _0xc8af43){if(_0x28c577[_0x805e('0x2b')](_0x3ee66e)){_0x28c577[_0x3ee66e]=_0xc8af43[_0x3ee66e];}}};Realtime['prototype']['initAgents']=function(){var _0x19c310=this;return function(_0x3849db){if(_0x3849db){freeIsNotKeyAgent(_0x3849db,_0x19c310[_0x805e('0x13')]);for(var _0x17961e=0x0,_0x552219={},_0x6acae8={};_0x17961e<_0x3849db[_0x805e('0x42')];_0x17961e+=0x1){_0x552219=_0x3849db[_0x17961e];var _0x59a282=_[_0x805e('0x43')](_0x552219['interface'])?util[_0x805e('0x28')](_0x805e('0x29'),_0x552219[_0x805e('0x2a')]):_0x552219[_0x805e('0x44')];if(_[_0x805e('0x45')](_0x19c310[_0x805e('0x13')][_0x59a282])){_0x19c310['agents'][_0x59a282]=new Agent(_0x552219);}else{_0x19c310[_0x805e('0x41')](_0x19c310[_0x805e('0x13')][_0x59a282],_0x552219);}}}return _0x19c310[_0x805e('0x13')];};};Realtime['prototype'][_0x805e('0x46')]=function(){var _0xef3b8=this;return function(_0x5a48b4){if(_0x5a48b4){freeIsNotKeySip(_0x5a48b4,_0xef3b8[_0x805e('0x47')]);for(var _0x2b288f=0x0,_0x2af452={},_0xdd9262={};_0x2b288f<_0x5a48b4[_0x805e('0x42')];_0x2b288f+=0x1){_0x2af452=_0x5a48b4[_0x2b288f];if(_[_0x805e('0x45')](_0xef3b8[_0x805e('0x47')][util[_0x805e('0x28')]('SIP/%s',_0x2af452[_0x805e('0x2a')])])){_0xef3b8[_0x805e('0x47')][util['format'](_0x805e('0x29'),_0x2af452[_0x805e('0x2a')])]=new Telephone(_0x2af452);}else{_0xef3b8[_0x805e('0x41')](_0xef3b8['telephones'][util[_0x805e('0x28')]('SIP/%s',_0x2af452['name'])],_0x2af452);}}}return _0xef3b8[_0x805e('0x47')];};};Realtime[_0x805e('0x40')][_0x805e('0x48')]=function(){var _0x379480=this;return function(_0x1c2dc7){if(_0x1c2dc7){freeIsNotKeySip(_0x1c2dc7,_0x379480[_0x805e('0x49')]);for(var _0x8d9322=0x0,_0x412961={},_0xe5c548={};_0x8d9322<_0x1c2dc7[_0x805e('0x42')];_0x8d9322+=0x1){_0x412961=_0x1c2dc7[_0x8d9322];if(_['isUndefined'](_0x379480['trunks'][util[_0x805e('0x28')]('SIP/%s',_0x412961[_0x805e('0x2a')])])){_0x379480[_0x805e('0x49')][util[_0x805e('0x28')](_0x805e('0x29'),_0x412961[_0x805e('0x2a')])]=new Trunk(_0x412961);}else{_0x379480['mergeFromDatabase'](_0x379480[_0x805e('0x49')][util[_0x805e('0x28')](_0x805e('0x29'),_0x412961[_0x805e('0x2a')])],_0x412961);}}}return _0x379480['trunks'];};};Realtime[_0x805e('0x40')]['initVoiceQueues']=function(){var _0x590db2=this;return function(_0x5b1813){if(_0x5b1813){freeIsNotKey(_0x5b1813,_0x590db2[_0x805e('0x14')],_0x805e('0x2a'));for(var _0x389132=0x0,_0x65d299={},_0x1e1b97={};_0x389132<_0x5b1813[_0x805e('0x42')];_0x389132+=0x1){_0x65d299=_0x5b1813[_0x389132];if(_[_0x805e('0x45')](_0x590db2[_0x805e('0x14')][_0x65d299[_0x805e('0x2a')]])){_0x590db2[_0x805e('0x14')][_0x65d299[_0x805e('0x2a')]]=new VoiceQueue(_0x65d299);}else{_0x590db2[_0x805e('0x41')](_0x590db2[_0x805e('0x14')][_0x65d299[_0x805e('0x2a')]],_0x65d299);}}}return _0x590db2[_0x805e('0x14')];};};Realtime[_0x805e('0x40')]['initTriggers']=function(){var _0x79b0a8=this;return function(_0x5a5cd8){if(_0x5a5cd8){freeIsNotKey(_0x5a5cd8,_0x79b0a8[_0x805e('0x15')],'id');for(var _0x9edb12=0x0,_0x3d7654={},_0x33f21a={};_0x9edb12<_0x5a5cd8[_0x805e('0x42')];_0x9edb12+=0x1){_0x3d7654=_0x5a5cd8[_0x9edb12];if(_[_0x805e('0x45')](_0x79b0a8[_0x805e('0x15')][_0x3d7654['id']])){_0x79b0a8[_0x805e('0x15')][_0x3d7654['id']]=new Trigger(_0x3d7654);}else{_0x79b0a8[_0x805e('0x41')](_0x79b0a8[_0x805e('0x15')][_0x3d7654['id']],_0x3d7654);}}}return _0x79b0a8['triggers'];};};Realtime['prototype'][_0x805e('0x4a')]=function(){var _0x29ea41=this;return function(_0x167e79){if(_0x167e79){freeIsNotKey(_0x167e79,_0x29ea41['templates'],'id');for(var _0x20ab19=0x0,_0x514ff2={},_0x59c07e={};_0x20ab19<_0x167e79['length'];_0x20ab19+=0x1){_0x514ff2=_0x167e79[_0x20ab19];if(_[_0x805e('0x45')](_0x29ea41[_0x805e('0x17')][_0x514ff2['id']])){_0x29ea41[_0x805e('0x17')][_0x514ff2['id']]=new Template(_0x514ff2);}else{_0x29ea41['mergeFromDatabase'](_0x29ea41[_0x805e('0x17')][_0x514ff2['id']],_0x514ff2);}}}return _0x29ea41[_0x805e('0x17')];};};Realtime['prototype'][_0x805e('0x4b')]=function(){var _0x5362e6=this;return function(_0x2aa8c3){if(_0x2aa8c3){freeIsNotKey(_0x2aa8c3,_0x5362e6['zendeskAccounts'],'id');for(var _0x5a39ee=0x0,_0x4ec41f={},_0x1b1bfa={};_0x5a39ee<_0x2aa8c3['length'];_0x5a39ee+=0x1){_0x4ec41f=_0x2aa8c3[_0x5a39ee];if(_['isUndefined'](_0x5362e6[_0x805e('0x1e')][_0x4ec41f['id']])){_0x5362e6[_0x805e('0x1e')][_0x4ec41f['id']]=new ZendeskAccount(_0x4ec41f);}else{_0x5362e6[_0x805e('0x41')](_0x5362e6[_0x805e('0x1e')][_0x4ec41f['id']],_0x4ec41f);}}}return _0x5362e6['zendeskAccounts'];};};Realtime[_0x805e('0x40')][_0x805e('0x4c')]=function(){var _0x19593d=this;return function(_0x18f0b4){if(_0x18f0b4){freeIsNotKey(_0x18f0b4,_0x19593d[_0x805e('0x1f')],'id');for(var _0x29beee=0x0,_0x45cba9={},_0x4702d6={};_0x29beee<_0x18f0b4[_0x805e('0x42')];_0x29beee+=0x1){_0x45cba9=_0x18f0b4[_0x29beee];if(_[_0x805e('0x45')](_0x19593d[_0x805e('0x1f')][_0x45cba9['id']])){_0x19593d[_0x805e('0x1f')][_0x45cba9['id']]=new SalesforceAccount(_0x45cba9);}else{_0x19593d[_0x805e('0x41')](_0x19593d[_0x805e('0x1f')][_0x45cba9['id']],_0x45cba9);}}}return _0x19593d[_0x805e('0x1f')];};};Realtime[_0x805e('0x40')][_0x805e('0x4d')]=function(){var _0x23d443=this;return function(_0x88ec3f){if(_0x88ec3f){freeIsNotKey(_0x88ec3f,_0x23d443[_0x805e('0x20')],'id');for(var _0x9cd325=0x0,_0x4d445f={},_0x49bbd0={};_0x9cd325<_0x88ec3f[_0x805e('0x42')];_0x9cd325+=0x1){_0x4d445f=_0x88ec3f[_0x9cd325];if(_[_0x805e('0x45')](_0x23d443[_0x805e('0x20')][_0x4d445f['id']])){_0x23d443[_0x805e('0x20')][_0x4d445f['id']]=new FreshdeskAccount(_0x4d445f);}else{_0x23d443[_0x805e('0x41')](_0x23d443[_0x805e('0x20')][_0x4d445f['id']],_0x4d445f);}}}return _0x23d443[_0x805e('0x20')];};};Realtime[_0x805e('0x40')][_0x805e('0x4e')]=function(){var _0xb0b6c3=this;return function(_0x441e4a){if(_0x441e4a){freeIsNotKey(_0x441e4a,_0xb0b6c3[_0x805e('0x4f')],'id');for(var _0x4b2c13=0x0,_0x1e738e={},_0x138a10={};_0x4b2c13<_0x441e4a[_0x805e('0x42')];_0x4b2c13+=0x1){_0x1e738e=_0x441e4a[_0x4b2c13];if(_[_0x805e('0x45')](_0xb0b6c3['zohoAccounts'][_0x1e738e['id']])){_0xb0b6c3[_0x805e('0x4f')][_0x1e738e['id']]=new ZohoAccount(_0x1e738e);}else{_0xb0b6c3[_0x805e('0x41')](_0xb0b6c3['zohoAccounts'][_0x1e738e['id']],_0x1e738e);}}}return _0xb0b6c3[_0x805e('0x4f')];};};Realtime[_0x805e('0x40')][_0x805e('0x50')]=function(){var _0x2886b6=this;return function(_0x1027cd){if(_0x1027cd){freeIsNotKey(_0x1027cd,_0x2886b6[_0x805e('0x21')],'id');for(var _0xb156ac=0x0,_0x49fbd9={},_0x1bb38a={};_0xb156ac<_0x1027cd['length'];_0xb156ac+=0x1){_0x49fbd9=_0x1027cd[_0xb156ac];if(_['isUndefined'](_0x2886b6['deskAccounts'][_0x49fbd9['id']])){_0x2886b6[_0x805e('0x21')][_0x49fbd9['id']]=new DeskAccount(_0x49fbd9);}else{_0x2886b6['mergeFromDatabase'](_0x2886b6[_0x805e('0x21')][_0x49fbd9['id']],_0x49fbd9);}}}return _0x2886b6[_0x805e('0x21')];};};Realtime['prototype'][_0x805e('0x51')]=function(){var _0x2b122f=this;return function(_0x3cd627){if(_0x3cd627){freeIsNotKey(_0x3cd627,_0x2b122f['sugarcrmAccounts'],'id');for(var _0x3868b8=0x0,_0x450555={},_0x51bcd9={};_0x3868b8<_0x3cd627[_0x805e('0x42')];_0x3868b8+=0x1){_0x450555=_0x3cd627[_0x3868b8];if(_['isUndefined'](_0x2b122f[_0x805e('0x52')][_0x450555['id']])){_0x2b122f[_0x805e('0x52')][_0x450555['id']]=new SugarcrmAccount(_0x450555);}else{_0x2b122f[_0x805e('0x41')](_0x2b122f[_0x805e('0x52')][_0x450555['id']],_0x450555);}}}return _0x2b122f[_0x805e('0x52')];};};Realtime['prototype'][_0x805e('0x53')]=function(){var _0x3a1f2e=this;return function(_0x5a59e1){if(_0x5a59e1){freeIsNotKey(_0x5a59e1,_0x3a1f2e[_0x805e('0x22')],'id');for(var _0x10b7ca=0x0,_0x285db9={},_0x365570={};_0x10b7ca<_0x5a59e1[_0x805e('0x42')];_0x10b7ca+=0x1){_0x285db9=_0x5a59e1[_0x10b7ca];if(_[_0x805e('0x45')](_0x3a1f2e[_0x805e('0x22')][_0x285db9['id']])){_0x3a1f2e['vtigerAccounts'][_0x285db9['id']]=new VtigerAccount(_0x285db9);}else{_0x3a1f2e[_0x805e('0x41')](_0x3a1f2e[_0x805e('0x22')][_0x285db9['id']],_0x285db9);}}}return _0x3a1f2e[_0x805e('0x22')];};};Realtime[_0x805e('0x40')][_0x805e('0x54')]=function(){var _0x50359a=this;return function(_0x41c35a){if(_0x41c35a){freeIsNotKey(_0x41c35a,_0x50359a[_0x805e('0x23')],'id');for(var _0x242559=0x0,_0x58c79d={},_0x387f35={};_0x242559<_0x41c35a[_0x805e('0x42')];_0x242559+=0x1){_0x58c79d=_0x41c35a[_0x242559];if(_[_0x805e('0x45')](_0x50359a[_0x805e('0x23')][_0x58c79d['id']])){_0x50359a[_0x805e('0x23')][_0x58c79d['id']]=new ServicenowAccount(_0x58c79d);}else{_0x50359a[_0x805e('0x41')](_0x50359a[_0x805e('0x23')][_0x58c79d['id']],_0x58c79d);}}}return _0x50359a['servicenowAccounts'];};};Realtime[_0x805e('0x40')]['initDynamics365Accounts']=function(){var _0x830811=this;return function(_0x3563f9){if(_0x3563f9){freeIsNotKey(_0x3563f9,_0x830811[_0x805e('0x24')],'id');for(var _0x53639a=0x0,_0x384359={},_0xb7d258={};_0x53639a<_0x3563f9[_0x805e('0x42')];_0x53639a+=0x1){_0x384359=_0x3563f9[_0x53639a];if(_['isUndefined'](_0x830811[_0x805e('0x24')][_0x384359['id']])){_0x830811[_0x805e('0x24')][_0x384359['id']]=new Dynamics365Account(_0x384359);}else{_0x830811[_0x805e('0x41')](_0x830811[_0x805e('0x24')][_0x384359['id']],_0x384359);}}}return _0x830811[_0x805e('0x24')];};};Realtime[_0x805e('0x40')][_0x805e('0x55')]=function(){var _0x31154e=this;return function(_0x1d1c81){if(_0x1d1c81){freeIsNotKey(_0x1d1c81,_0x31154e[_0x805e('0x25')],'id');for(var _0x51cea4=0x0,_0x2c28a0={},_0x443cfa={};_0x51cea4<_0x1d1c81[_0x805e('0x42')];_0x51cea4+=0x1){_0x2c28a0=_0x1d1c81[_0x51cea4];if(_[_0x805e('0x45')](_0x31154e[_0x805e('0x25')][_0x2c28a0['id']])){_0x31154e[_0x805e('0x25')][_0x2c28a0['id']]=new FreshsalesAccount(_0x2c28a0);}else{_0x31154e[_0x805e('0x41')](_0x31154e[_0x805e('0x25')][_0x2c28a0['id']],_0x2c28a0);}}}return _0x31154e[_0x805e('0x25')];};};Realtime[_0x805e('0x40')][_0x805e('0x56')]=function(){var _0x1172e3=this;return function(_0x5dc9d4){for(var _0x3e6f73=0x0;_0x3e6f73<_0x5dc9d4[_0x805e('0x42')];_0x3e6f73+=0x1){_[_0x805e('0x57')](_0x1172e3[_0x805e('0x14')][_0x5dc9d4[_0x3e6f73][_0x805e('0x2a')]],_0x5dc9d4[_0x3e6f73]);}return _0x1172e3['voiceQueues'];};};Realtime['prototype'][_0x805e('0x58')]=function(){var _0x39040f=this;return function(_0x36f20d){clearVoiceQueues(_0x39040f[_0x805e('0x14')]);if(_0x36f20d){_0x36f20d=_['groupBy'](_0x36f20d,_0x805e('0x59'));for(var _0xe6e7ac in _0x36f20d){if(_0x36f20d[_0x805e('0x2b')](_0xe6e7ac)){var _0x91f5a1={};for(var _0x9c0e36=0x0;_0x9c0e36<_0x36f20d[_0xe6e7ac][_0x805e('0x42')];_0x9c0e36+=0x1){var _0x3b6c52=_0x36f20d[_0xe6e7ac][_0x9c0e36][_0x805e('0x5a')];if(_0x39040f[_0x805e('0x14')][_0x3b6c52]){if(_0x36f20d[_0xe6e7ac][_0x9c0e36][_0x805e('0x5b')]){_0x39040f['voiceQueues'][_0x3b6c52][_0x805e('0x33')]+=0x1;}if(_0x36f20d[_0xe6e7ac][_0x9c0e36][_0x805e('0x5c')]){_0x39040f[_0x805e('0x14')][_0x3b6c52][_0x805e('0x34')]+=0x1;}_0x39040f['voiceQueues'][_0x3b6c52][_0x805e('0x2e')]+=moment(_0x36f20d[_0xe6e7ac][_0x9c0e36]['queuecallerleaveAt'])[_0x805e('0x5d')](moment(_0x36f20d[_0xe6e7ac][_0x9c0e36][_0x805e('0x5e')]),_0x805e('0x5f'))||0x0;if(_0x9c0e36===_0x36f20d[_0xe6e7ac][_0x805e('0x42')]-0x1){_0x39040f[_0x805e('0x14')][_0x3b6c52][_0x805e('0x2f')]+=moment(_0x36f20d[_0xe6e7ac][_0x9c0e36][_0x805e('0x60')]||_0x36f20d[_0xe6e7ac][_0x9c0e36][_0x805e('0x61')]||_0x36f20d[_0xe6e7ac][_0x9c0e36]['queuecallerexitAt'])[_0x805e('0x5d')](moment(_0x36f20d[_0xe6e7ac][_0x9c0e36][_0x805e('0x5e')]),_0x805e('0x5f'))||0x0;_0x39040f[_0x805e('0x14')][_0x3b6c52][_0x805e('0x2c')]+=0x1;if(_0x36f20d[_0xe6e7ac][_0x9c0e36][_0x805e('0x62')]){_0x39040f['voiceQueues'][_0x3b6c52]['answered']+=0x1;_0x39040f['voiceQueues'][_0x3b6c52][_0x805e('0x30')]+=moment(_0x36f20d[_0xe6e7ac][_0x9c0e36][_0x805e('0x60')])['diff'](moment(_0x36f20d[_0xe6e7ac][_0x9c0e36][_0x805e('0x63')]),_0x805e('0x5f'))||0x0;}}else{_0x39040f[_0x805e('0x14')][_0x3b6c52]['sumDuration']+=_0x39040f[_0x805e('0x14')][_0x3b6c52][_0x805e('0x2e')]||0x0;}}}}}}return _0x39040f[_0x805e('0x14')];};};Realtime[_0x805e('0x40')][_0x805e('0x64')]=function(){var _0x182a5d=this;return function(_0x2c6477){clearVoiceCallReports(_0x182a5d[_0x805e('0x18')]);if(_0x2c6477){for(var _0x1e74b3=0x0;_0x1e74b3<_0x2c6477[_0x805e('0x42')];_0x1e74b3+=0x1){_0x182a5d[_0x805e('0x18')][_0x805e('0x2c')]+=0x1;_0x182a5d[_0x805e('0x18')]['sumDuration']+=_0x2c6477[_0x1e74b3][_0x805e('0x65')];if(_0x2c6477[_0x1e74b3][_0x805e('0x66')]===_0x805e('0x67')){_0x182a5d[_0x805e('0x18')][_0x805e('0x2d')]+=0x1;_0x182a5d[_0x805e('0x18')]['sumHoldTime']+=_0x2c6477[_0x1e74b3][_0x805e('0x65')]-_0x2c6477[_0x1e74b3][_0x805e('0x68')]||0x0;_0x182a5d[_0x805e('0x18')][_0x805e('0x30')]+=_0x2c6477[_0x1e74b3]['billableseconds'];}}}return _0x182a5d[_0x805e('0x18')];};};Realtime[_0x805e('0x40')][_0x805e('0x69')]=function(){var _0x40fb63=this;return function(_0x51b9be){if(_0x51b9be){freeIsNotKey(_0x51b9be,_0x40fb63[_0x805e('0x16')],_0x805e('0x2a'));for(var _0x280dd3=0x0,_0x27c164={};_0x280dd3<_0x51b9be['length'];_0x280dd3+=0x1){_0x27c164=_0x51b9be[_0x280dd3];if(_[_0x805e('0x45')](_0x40fb63[_0x805e('0x16')][_0x27c164[_0x805e('0x2a')]])){_0x40fb63[_0x805e('0x16')][_0x27c164[_0x805e('0x2a')]]=new Campaign(_0x27c164);}else{_0x40fb63['mergeFromDatabase'](_0x40fb63['campaigns'][_0x27c164[_0x805e('0x2a')]],_0x27c164);_0x40fb63[_0x805e('0x16')][_0x27c164[_0x805e('0x2a')]]['dialQueueProject']=_0x27c164['SquareProject']?_0x27c164[_0x805e('0x6a')][_0x805e('0x2a')]:undefined;}}}return _0x40fb63[_0x805e('0x16')];};};Realtime['prototype'][_0x805e('0x6b')]=function(){var _0x31abcd=this;return function(_0x14f679){if(_0x14f679){freeIsNotKey(_0x14f679,_0x31abcd['voiceExtensions'],'id');for(var _0x163b47=0x0,_0x1498ef={};_0x163b47<_0x14f679[_0x805e('0x42')];_0x163b47+=0x1){_0x1498ef=_0x14f679[_0x163b47];if(_['isUndefined'](_0x31abcd[_0x805e('0x19')][_0x1498ef['id']])){_0x31abcd[_0x805e('0x19')][_0x1498ef['id']]=new VoiceExtension(_0x1498ef);}else{_0x31abcd[_0x805e('0x41')](_0x31abcd[_0x805e('0x19')][_0x1498ef['id']],_0x1498ef);}}}return _0x31abcd[_0x805e('0x19')];};};Realtime[_0x805e('0x40')][_0x805e('0x6c')]=function(){var _0xc30642=this;return function(_0x5eec32){clearCampaigns(_0xc30642[_0x805e('0x16')]);for(var _0xce6782=0x0;_0xce6782<_0x5eec32[_0x805e('0x42')];_0xce6782+=0x1){_[_0x805e('0x57')](_0xc30642[_0x805e('0x16')][_0x5eec32[_0xce6782][_0x805e('0x2a')]],_0x5eec32[_0xce6782]);}return _0xc30642[_0x805e('0x16')];};};Realtime[_0x805e('0x40')][_0x805e('0x6d')]=function(){var _0x3117d6=this;return function(_0x1c368f){if(_0x1c368f){freeIsNotKey(_0x1c368f,_0x3117d6[_0x805e('0x26')],'id');for(var _0x360270=0x0,_0x469f95={},_0x1a9e37={};_0x360270<_0x1c368f[_0x805e('0x42')];_0x360270+=0x1){_0x469f95=_0x1c368f[_0x360270];if(_[_0x805e('0x45')](_0x3117d6[_0x805e('0x26')][_0x469f95['id']])){_0x3117d6[_0x805e('0x26')][_0x469f95['id']]=new FaxAccount(_0x469f95);}else{_0x3117d6[_0x805e('0x41')](_0x3117d6['faxAccounts'][_0x469f95['id']],_0x469f95);}}}return _0x3117d6[_0x805e('0x26')];};};module['exports']=Realtime;
\ No newline at end of file
+var _0xc8cf=['SquareProject','initVoiceExtensions','merge','initFaxAccounts','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','mergeFromDatabase','prototype','initAgents','isUndefined','initTelephones','length','initTriggers','initTemplates','initZendeskAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initVoiceQueueHopperHistory','initVoiceQueueReports','uniqueid','queue','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','duration','ANSWERED','billableseconds'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc8cf,0x1a0));var _0xfc8c=function(_0x3044e7,_0x4391b7){_0x3044e7=_0x3044e7-0x0;var _0x2f4929=_0xc8cf[_0x3044e7];return _0x2f4929;};'use strict';var BPromise=require(_0xfc8c('0x0'));var util=require('util');var _=require(_0xfc8c('0x1'));var moment=require(_0xfc8c('0x2'));var Agent=require(_0xfc8c('0x3'));var Telephone=require(_0xfc8c('0x4'));var Trunk=require(_0xfc8c('0x5'));var VoiceQueue=require(_0xfc8c('0x6'));var Trigger=require(_0xfc8c('0x7'));var Template=require(_0xfc8c('0x8'));var Campaign=require(_0xfc8c('0x9'));var VoiceExtension=require(_0xfc8c('0xa'));var ZendeskAccount=require(_0xfc8c('0xb'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xfc8c('0xc'));var ZohoAccount=require(_0xfc8c('0xd'));var DeskAccount=require(_0xfc8c('0xe'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xfc8c('0xf'));var Dynamics365Account=require(_0xfc8c('0x10'));var FreshsalesAccount=require(_0xfc8c('0x11'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xfc8c('0x12')]={};this[_0xfc8c('0x13')]={};this[_0xfc8c('0x14')]={};this[_0xfc8c('0x15')]={};this[_0xfc8c('0x16')]={};this[_0xfc8c('0x17')]={};this[_0xfc8c('0x18')]={};this[_0xfc8c('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xfc8c('0x1a')]={};this[_0xfc8c('0x1b')]={};this[_0xfc8c('0x1c')]={};this[_0xfc8c('0x1d')]={};this['timers']={};this['settings']={};this[_0xfc8c('0x1e')]={};this[_0xfc8c('0x1f')]={};this[_0xfc8c('0x20')]={};this[_0xfc8c('0x21')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xfc8c('0x22')]={};this[_0xfc8c('0x23')]={};this['dynamics365Accounts']={};this[_0xfc8c('0x24')]={};this[_0xfc8c('0x25')]={};};function freeIsNotKey(_0x4a9ac7,_0x3a32d4,_0x363e4b){var _0x403a10=_[_0xfc8c('0x26')](_0x4a9ac7,function(_0x3462f8,_0x4cd22b){return _0x3462f8[_0x363e4b];});for(var _0x4090da in _0x3a32d4){if(_0x3a32d4[_0xfc8c('0x27')](_0x4090da)){if(!_0x403a10[_0x4090da]){delete _0x3a32d4[_0x4090da];}}}}function freeIsNotKeySip(_0x254fd3,_0x58f8c4){var _0x497a80=_['mapKeys'](_0x254fd3,function(_0x534b7d,_0x42304c){return util[_0xfc8c('0x28')](_0xfc8c('0x29'),_0x534b7d[_0xfc8c('0x2a')]);});for(var _0x3810cf in _0x58f8c4){if(_0x58f8c4[_0xfc8c('0x27')](_0x3810cf)){if(!_0x497a80[_0x3810cf]){delete _0x58f8c4[_0x3810cf];}}}}function freeIsNotKeyAgent(_0x344e9d,_0x367551){var _0x4e7ceb=_['mapKeys'](_0x344e9d,function(_0x33311e,_0x1186de){var _0x2be63f=_[_0xfc8c('0x2b')](_0x33311e[_0xfc8c('0x2c')])?util[_0xfc8c('0x28')](_0xfc8c('0x29'),_0x33311e[_0xfc8c('0x2a')]):_0x33311e[_0xfc8c('0x2c')];return _0x2be63f;});for(var _0x4bab29 in _0x367551){if(_0x367551[_0xfc8c('0x27')](_0x4bab29)){if(!_0x4e7ceb[_0x4bab29]){delete _0x367551[_0x4bab29];}}}}function clearVoiceCallReports(_0x22838a){_0x22838a[_0xfc8c('0x2d')]=0x0;_0x22838a[_0xfc8c('0x2e')]=0x0;_0x22838a[_0xfc8c('0x2f')]=0x0;_0x22838a[_0xfc8c('0x30')]=0x0;_0x22838a[_0xfc8c('0x31')]=0x0;}function clearCampaigns(_0x574b0c){if(!_[_0xfc8c('0x32')](_0x574b0c)){for(var _0x1a8c97 in _0x574b0c){if(_0x574b0c[_0xfc8c('0x27')](_0x1a8c97)){_0x574b0c[_0x1a8c97][_0xfc8c('0x33')]=0x0;_0x574b0c[_0x1a8c97]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x42dce9){if(!_[_0xfc8c('0x32')](_0x42dce9)){for(var _0x541e2f in _0x42dce9){if(_0x42dce9[_0xfc8c('0x27')](_0x541e2f)){_0x42dce9[_0x541e2f][_0xfc8c('0x2d')]=0x0;_0x42dce9[_0x541e2f]['answered']=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x34')]=0x0;_0x42dce9[_0x541e2f]['abandoned']=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x2f')]=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x30')]=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x31')]=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x35')]=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x36')]=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x37')]=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x38')]=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x39')]=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x3a')]=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x3b')]=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x3c')]=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x3d')]=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x3e')]=0x0;_0x42dce9[_0x541e2f]['outboundRejectCallsDay']=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x3f')]=0x0;_0x42dce9[_0x541e2f][_0xfc8c('0x35')]=0x0;_0x42dce9[_0x541e2f]['outboundAnswerCallsDay']=0x0;_0x42dce9[_0x541e2f]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0xfc8c('0x40')]=function(_0x4a5e94,_0x44ec35){for(var _0x548cac in _0x44ec35){if(_0x4a5e94[_0xfc8c('0x27')](_0x548cac)){_0x4a5e94[_0x548cac]=_0x44ec35[_0x548cac];}}};Realtime[_0xfc8c('0x41')][_0xfc8c('0x42')]=function(){var _0x10e35c=this;return function(_0x5d8b65){if(_0x5d8b65){freeIsNotKeyAgent(_0x5d8b65,_0x10e35c[_0xfc8c('0x12')]);for(var _0x2403d8=0x0,_0x415a87={},_0x5557ca={};_0x2403d8<_0x5d8b65['length'];_0x2403d8+=0x1){_0x415a87=_0x5d8b65[_0x2403d8];var _0x44ee52=_[_0xfc8c('0x2b')](_0x415a87['interface'])?util[_0xfc8c('0x28')](_0xfc8c('0x29'),_0x415a87[_0xfc8c('0x2a')]):_0x415a87[_0xfc8c('0x2c')];if(_[_0xfc8c('0x43')](_0x10e35c[_0xfc8c('0x12')][_0x44ee52])){_0x10e35c[_0xfc8c('0x12')][_0x44ee52]=new Agent(_0x415a87);}else{_0x10e35c[_0xfc8c('0x40')](_0x10e35c[_0xfc8c('0x12')][_0x44ee52],_0x415a87);}}}return _0x10e35c[_0xfc8c('0x12')];};};Realtime[_0xfc8c('0x41')][_0xfc8c('0x44')]=function(){var _0x1f8e0b=this;return function(_0x58fa20){if(_0x58fa20){freeIsNotKeySip(_0x58fa20,_0x1f8e0b['telephones']);for(var _0x23e01e=0x0,_0x35db22={},_0x27966a={};_0x23e01e<_0x58fa20[_0xfc8c('0x45')];_0x23e01e+=0x1){_0x35db22=_0x58fa20[_0x23e01e];if(_['isUndefined'](_0x1f8e0b[_0xfc8c('0x13')][util[_0xfc8c('0x28')](_0xfc8c('0x29'),_0x35db22[_0xfc8c('0x2a')])])){_0x1f8e0b[_0xfc8c('0x13')][util['format'](_0xfc8c('0x29'),_0x35db22[_0xfc8c('0x2a')])]=new Telephone(_0x35db22);}else{_0x1f8e0b['mergeFromDatabase'](_0x1f8e0b[_0xfc8c('0x13')][util[_0xfc8c('0x28')](_0xfc8c('0x29'),_0x35db22['name'])],_0x35db22);}}}return _0x1f8e0b['telephones'];};};Realtime[_0xfc8c('0x41')]['initTrunks']=function(){var _0x1183ec=this;return function(_0x36defc){if(_0x36defc){freeIsNotKeySip(_0x36defc,_0x1183ec[_0xfc8c('0x14')]);for(var _0x27b22b=0x0,_0x34e16a={},_0x389573={};_0x27b22b<_0x36defc[_0xfc8c('0x45')];_0x27b22b+=0x1){_0x34e16a=_0x36defc[_0x27b22b];if(_['isUndefined'](_0x1183ec['trunks'][util[_0xfc8c('0x28')](_0xfc8c('0x29'),_0x34e16a[_0xfc8c('0x2a')])])){_0x1183ec['trunks'][util['format'](_0xfc8c('0x29'),_0x34e16a['name'])]=new Trunk(_0x34e16a);}else{_0x1183ec['mergeFromDatabase'](_0x1183ec[_0xfc8c('0x14')][util['format'](_0xfc8c('0x29'),_0x34e16a[_0xfc8c('0x2a')])],_0x34e16a);}}}return _0x1183ec[_0xfc8c('0x14')];};};Realtime[_0xfc8c('0x41')]['initVoiceQueues']=function(){var _0x3393a4=this;return function(_0x1620b6){if(_0x1620b6){freeIsNotKey(_0x1620b6,_0x3393a4['voiceQueues'],_0xfc8c('0x2a'));for(var _0x2a278a=0x0,_0x3afd08={},_0x85340c={};_0x2a278a<_0x1620b6[_0xfc8c('0x45')];_0x2a278a+=0x1){_0x3afd08=_0x1620b6[_0x2a278a];if(_[_0xfc8c('0x43')](_0x3393a4['voiceQueues'][_0x3afd08[_0xfc8c('0x2a')]])){_0x3393a4[_0xfc8c('0x15')][_0x3afd08[_0xfc8c('0x2a')]]=new VoiceQueue(_0x3afd08);}else{_0x3393a4[_0xfc8c('0x40')](_0x3393a4[_0xfc8c('0x15')][_0x3afd08[_0xfc8c('0x2a')]],_0x3afd08);}}}return _0x3393a4[_0xfc8c('0x15')];};};Realtime[_0xfc8c('0x41')][_0xfc8c('0x46')]=function(){var _0x18c0d1=this;return function(_0x1d3133){if(_0x1d3133){freeIsNotKey(_0x1d3133,_0x18c0d1[_0xfc8c('0x16')],'id');for(var _0x3793af=0x0,_0x2180b9={},_0x4aec18={};_0x3793af<_0x1d3133[_0xfc8c('0x45')];_0x3793af+=0x1){_0x2180b9=_0x1d3133[_0x3793af];if(_[_0xfc8c('0x43')](_0x18c0d1[_0xfc8c('0x16')][_0x2180b9['id']])){_0x18c0d1[_0xfc8c('0x16')][_0x2180b9['id']]=new Trigger(_0x2180b9);}else{_0x18c0d1[_0xfc8c('0x40')](_0x18c0d1['triggers'][_0x2180b9['id']],_0x2180b9);}}}return _0x18c0d1[_0xfc8c('0x16')];};};Realtime['prototype'][_0xfc8c('0x47')]=function(){var _0x48c860=this;return function(_0xb2812a){if(_0xb2812a){freeIsNotKey(_0xb2812a,_0x48c860[_0xfc8c('0x18')],'id');for(var _0x506838=0x0,_0x51322d={},_0x158a48={};_0x506838<_0xb2812a[_0xfc8c('0x45')];_0x506838+=0x1){_0x51322d=_0xb2812a[_0x506838];if(_[_0xfc8c('0x43')](_0x48c860[_0xfc8c('0x18')][_0x51322d['id']])){_0x48c860['templates'][_0x51322d['id']]=new Template(_0x51322d);}else{_0x48c860[_0xfc8c('0x40')](_0x48c860[_0xfc8c('0x18')][_0x51322d['id']],_0x51322d);}}}return _0x48c860[_0xfc8c('0x18')];};};Realtime[_0xfc8c('0x41')][_0xfc8c('0x48')]=function(){var _0x30abaa=this;return function(_0x56cbf6){if(_0x56cbf6){freeIsNotKey(_0x56cbf6,_0x30abaa[_0xfc8c('0x1e')],'id');for(var _0x184183=0x0,_0x124115={},_0x6987e0={};_0x184183<_0x56cbf6['length'];_0x184183+=0x1){_0x124115=_0x56cbf6[_0x184183];if(_[_0xfc8c('0x43')](_0x30abaa[_0xfc8c('0x1e')][_0x124115['id']])){_0x30abaa[_0xfc8c('0x1e')][_0x124115['id']]=new ZendeskAccount(_0x124115);}else{_0x30abaa['mergeFromDatabase'](_0x30abaa[_0xfc8c('0x1e')][_0x124115['id']],_0x124115);}}}return _0x30abaa['zendeskAccounts'];};};Realtime[_0xfc8c('0x41')]['initSalesforceAccounts']=function(){var _0x1b21b6=this;return function(_0x32dd84){if(_0x32dd84){freeIsNotKey(_0x32dd84,_0x1b21b6[_0xfc8c('0x1f')],'id');for(var _0x48244d=0x0,_0x564af7={},_0x166f49={};_0x48244d<_0x32dd84[_0xfc8c('0x45')];_0x48244d+=0x1){_0x564af7=_0x32dd84[_0x48244d];if(_[_0xfc8c('0x43')](_0x1b21b6[_0xfc8c('0x1f')][_0x564af7['id']])){_0x1b21b6['salesforceAccounts'][_0x564af7['id']]=new SalesforceAccount(_0x564af7);}else{_0x1b21b6['mergeFromDatabase'](_0x1b21b6[_0xfc8c('0x1f')][_0x564af7['id']],_0x564af7);}}}return _0x1b21b6['salesforceAccounts'];};};Realtime[_0xfc8c('0x41')][_0xfc8c('0x49')]=function(){var _0x1981a3=this;return function(_0x143a77){if(_0x143a77){freeIsNotKey(_0x143a77,_0x1981a3['freshdeskAccounts'],'id');for(var _0x3046e4=0x0,_0x38f3a5={},_0xfd88de={};_0x3046e4<_0x143a77[_0xfc8c('0x45')];_0x3046e4+=0x1){_0x38f3a5=_0x143a77[_0x3046e4];if(_['isUndefined'](_0x1981a3[_0xfc8c('0x21')][_0x38f3a5['id']])){_0x1981a3[_0xfc8c('0x21')][_0x38f3a5['id']]=new FreshdeskAccount(_0x38f3a5);}else{_0x1981a3[_0xfc8c('0x40')](_0x1981a3[_0xfc8c('0x21')][_0x38f3a5['id']],_0x38f3a5);}}}return _0x1981a3[_0xfc8c('0x21')];};};Realtime[_0xfc8c('0x41')][_0xfc8c('0x4a')]=function(){var _0x1d7bc3=this;return function(_0xeb68c7){if(_0xeb68c7){freeIsNotKey(_0xeb68c7,_0x1d7bc3[_0xfc8c('0x4b')],'id');for(var _0x256116=0x0,_0x252cfc={},_0x5a637b={};_0x256116<_0xeb68c7['length'];_0x256116+=0x1){_0x252cfc=_0xeb68c7[_0x256116];if(_[_0xfc8c('0x43')](_0x1d7bc3['zohoAccounts'][_0x252cfc['id']])){_0x1d7bc3['zohoAccounts'][_0x252cfc['id']]=new ZohoAccount(_0x252cfc);}else{_0x1d7bc3['mergeFromDatabase'](_0x1d7bc3[_0xfc8c('0x4b')][_0x252cfc['id']],_0x252cfc);}}}return _0x1d7bc3[_0xfc8c('0x4b')];};};Realtime[_0xfc8c('0x41')][_0xfc8c('0x4c')]=function(){var _0x33db07=this;return function(_0x321bf5){if(_0x321bf5){freeIsNotKey(_0x321bf5,_0x33db07[_0xfc8c('0x4d')],'id');for(var _0x17e1cc=0x0,_0x34030a={},_0x25764d={};_0x17e1cc<_0x321bf5['length'];_0x17e1cc+=0x1){_0x34030a=_0x321bf5[_0x17e1cc];if(_[_0xfc8c('0x43')](_0x33db07[_0xfc8c('0x4d')][_0x34030a['id']])){_0x33db07['deskAccounts'][_0x34030a['id']]=new DeskAccount(_0x34030a);}else{_0x33db07[_0xfc8c('0x40')](_0x33db07[_0xfc8c('0x4d')][_0x34030a['id']],_0x34030a);}}}return _0x33db07[_0xfc8c('0x4d')];};};Realtime[_0xfc8c('0x41')][_0xfc8c('0x4e')]=function(){var _0x2ebfcd=this;return function(_0x438e9a){if(_0x438e9a){freeIsNotKey(_0x438e9a,_0x2ebfcd[_0xfc8c('0x20')],'id');for(var _0xbe540d=0x0,_0xa14248={},_0x499dcc={};_0xbe540d<_0x438e9a[_0xfc8c('0x45')];_0xbe540d+=0x1){_0xa14248=_0x438e9a[_0xbe540d];if(_[_0xfc8c('0x43')](_0x2ebfcd[_0xfc8c('0x20')][_0xa14248['id']])){_0x2ebfcd[_0xfc8c('0x20')][_0xa14248['id']]=new SugarcrmAccount(_0xa14248);}else{_0x2ebfcd[_0xfc8c('0x40')](_0x2ebfcd[_0xfc8c('0x20')][_0xa14248['id']],_0xa14248);}}}return _0x2ebfcd[_0xfc8c('0x20')];};};Realtime[_0xfc8c('0x41')][_0xfc8c('0x4f')]=function(){var _0x230976=this;return function(_0x45fe93){if(_0x45fe93){freeIsNotKey(_0x45fe93,_0x230976[_0xfc8c('0x22')],'id');for(var _0x11fabb=0x0,_0x18a138={},_0x1fdf98={};_0x11fabb<_0x45fe93['length'];_0x11fabb+=0x1){_0x18a138=_0x45fe93[_0x11fabb];if(_[_0xfc8c('0x43')](_0x230976[_0xfc8c('0x22')][_0x18a138['id']])){_0x230976[_0xfc8c('0x22')][_0x18a138['id']]=new VtigerAccount(_0x18a138);}else{_0x230976[_0xfc8c('0x40')](_0x230976[_0xfc8c('0x22')][_0x18a138['id']],_0x18a138);}}}return _0x230976[_0xfc8c('0x22')];};};Realtime[_0xfc8c('0x41')][_0xfc8c('0x50')]=function(){var _0x169221=this;return function(_0x3994bf){if(_0x3994bf){freeIsNotKey(_0x3994bf,_0x169221[_0xfc8c('0x23')],'id');for(var _0x343fb1=0x0,_0x20c1ba={},_0x2a23cf={};_0x343fb1<_0x3994bf[_0xfc8c('0x45')];_0x343fb1+=0x1){_0x20c1ba=_0x3994bf[_0x343fb1];if(_['isUndefined'](_0x169221[_0xfc8c('0x23')][_0x20c1ba['id']])){_0x169221[_0xfc8c('0x23')][_0x20c1ba['id']]=new ServicenowAccount(_0x20c1ba);}else{_0x169221[_0xfc8c('0x40')](_0x169221['servicenowAccounts'][_0x20c1ba['id']],_0x20c1ba);}}}return _0x169221[_0xfc8c('0x23')];};};Realtime['prototype'][_0xfc8c('0x51')]=function(){var _0x1cc917=this;return function(_0x3432a7){if(_0x3432a7){freeIsNotKey(_0x3432a7,_0x1cc917[_0xfc8c('0x52')],'id');for(var _0x20bb1e=0x0,_0x4c01c1={},_0x363afd={};_0x20bb1e<_0x3432a7[_0xfc8c('0x45')];_0x20bb1e+=0x1){_0x4c01c1=_0x3432a7[_0x20bb1e];if(_[_0xfc8c('0x43')](_0x1cc917[_0xfc8c('0x52')][_0x4c01c1['id']])){_0x1cc917[_0xfc8c('0x52')][_0x4c01c1['id']]=new Dynamics365Account(_0x4c01c1);}else{_0x1cc917['mergeFromDatabase'](_0x1cc917['dynamics365Accounts'][_0x4c01c1['id']],_0x4c01c1);}}}return _0x1cc917[_0xfc8c('0x52')];};};Realtime[_0xfc8c('0x41')]['initFreshsalesAccounts']=function(){var _0x4cbfed=this;return function(_0x2c7048){if(_0x2c7048){freeIsNotKey(_0x2c7048,_0x4cbfed[_0xfc8c('0x24')],'id');for(var _0x206444=0x0,_0x25ea89={},_0x40e38b={};_0x206444<_0x2c7048[_0xfc8c('0x45')];_0x206444+=0x1){_0x25ea89=_0x2c7048[_0x206444];if(_[_0xfc8c('0x43')](_0x4cbfed[_0xfc8c('0x24')][_0x25ea89['id']])){_0x4cbfed[_0xfc8c('0x24')][_0x25ea89['id']]=new FreshsalesAccount(_0x25ea89);}else{_0x4cbfed[_0xfc8c('0x40')](_0x4cbfed[_0xfc8c('0x24')][_0x25ea89['id']],_0x25ea89);}}}return _0x4cbfed[_0xfc8c('0x24')];};};Realtime[_0xfc8c('0x41')][_0xfc8c('0x53')]=function(){var _0x4d95f0=this;return function(_0x1274a2){for(var _0x47abc3=0x0;_0x47abc3<_0x1274a2[_0xfc8c('0x45')];_0x47abc3+=0x1){_['merge'](_0x4d95f0['voiceQueues'][_0x1274a2[_0x47abc3][_0xfc8c('0x2a')]],_0x1274a2[_0x47abc3]);}return _0x4d95f0[_0xfc8c('0x15')];};};Realtime[_0xfc8c('0x41')][_0xfc8c('0x54')]=function(){var _0x1f7e5d=this;return function(_0x2b42ff){clearVoiceQueues(_0x1f7e5d['voiceQueues']);if(_0x2b42ff){_0x2b42ff=_['groupBy'](_0x2b42ff,_0xfc8c('0x55'));for(var _0x7e51dd in _0x2b42ff){if(_0x2b42ff[_0xfc8c('0x27')](_0x7e51dd)){var _0x54a128={};for(var _0x404d99=0x0;_0x404d99<_0x2b42ff[_0x7e51dd][_0xfc8c('0x45')];_0x404d99+=0x1){var _0x362e35=_0x2b42ff[_0x7e51dd][_0x404d99][_0xfc8c('0x56')];if(_0x1f7e5d[_0xfc8c('0x15')][_0x362e35]){if(_0x2b42ff[_0x7e51dd][_0x404d99]['queuecallerexit']){_0x1f7e5d[_0xfc8c('0x15')][_0x362e35][_0xfc8c('0x34')]+=0x1;}if(_0x2b42ff[_0x7e51dd][_0x404d99]['queuecallerabandon']){_0x1f7e5d[_0xfc8c('0x15')][_0x362e35]['abandoned']+=0x1;}_0x1f7e5d[_0xfc8c('0x15')][_0x362e35][_0xfc8c('0x2f')]+=moment(_0x2b42ff[_0x7e51dd][_0x404d99]['queuecallerleaveAt'])[_0xfc8c('0x57')](moment(_0x2b42ff[_0x7e51dd][_0x404d99][_0xfc8c('0x58')]),_0xfc8c('0x59'))||0x0;if(_0x404d99===_0x2b42ff[_0x7e51dd]['length']-0x1){_0x1f7e5d[_0xfc8c('0x15')][_0x362e35]['sumDuration']+=moment(_0x2b42ff[_0x7e51dd][_0x404d99][_0xfc8c('0x5a')]||_0x2b42ff[_0x7e51dd][_0x404d99][_0xfc8c('0x5b')]||_0x2b42ff[_0x7e51dd][_0x404d99][_0xfc8c('0x5c')])[_0xfc8c('0x57')](moment(_0x2b42ff[_0x7e51dd][_0x404d99]['queuecallerjoinAt']),_0xfc8c('0x59'))||0x0;_0x1f7e5d['voiceQueues'][_0x362e35][_0xfc8c('0x2d')]+=0x1;if(_0x2b42ff[_0x7e51dd][_0x404d99][_0xfc8c('0x5d')]){_0x1f7e5d['voiceQueues'][_0x362e35][_0xfc8c('0x2e')]+=0x1;_0x1f7e5d['voiceQueues'][_0x362e35][_0xfc8c('0x31')]+=moment(_0x2b42ff[_0x7e51dd][_0x404d99][_0xfc8c('0x5a')])['diff'](moment(_0x2b42ff[_0x7e51dd][_0x404d99][_0xfc8c('0x5e')]),_0xfc8c('0x59'))||0x0;}}else{_0x1f7e5d['voiceQueues'][_0x362e35]['sumDuration']+=_0x1f7e5d[_0xfc8c('0x15')][_0x362e35][_0xfc8c('0x2f')]||0x0;}}}}}}return _0x1f7e5d['voiceQueues'];};};Realtime[_0xfc8c('0x41')][_0xfc8c('0x5f')]=function(){var _0x4e3050=this;return function(_0x200405){clearVoiceCallReports(_0x4e3050[_0xfc8c('0x19')]);if(_0x200405){for(var _0x106a90=0x0;_0x106a90<_0x200405[_0xfc8c('0x45')];_0x106a90+=0x1){_0x4e3050[_0xfc8c('0x19')]['total']+=0x1;_0x4e3050[_0xfc8c('0x19')][_0xfc8c('0x30')]+=_0x200405[_0x106a90][_0xfc8c('0x60')];if(_0x200405[_0x106a90]['disposition']===_0xfc8c('0x61')){_0x4e3050[_0xfc8c('0x19')][_0xfc8c('0x2e')]+=0x1;_0x4e3050[_0xfc8c('0x19')][_0xfc8c('0x2f')]+=_0x200405[_0x106a90][_0xfc8c('0x60')]-_0x200405[_0x106a90]['billableseconds']||0x0;_0x4e3050[_0xfc8c('0x19')][_0xfc8c('0x31')]+=_0x200405[_0x106a90][_0xfc8c('0x62')];}}}return _0x4e3050[_0xfc8c('0x19')];};};Realtime[_0xfc8c('0x41')]['initCampaigns']=function(){var _0x4a4f7e=this;return function(_0x593905){if(_0x593905){freeIsNotKey(_0x593905,_0x4a4f7e[_0xfc8c('0x17')],_0xfc8c('0x2a'));for(var _0xca5886=0x0,_0x5e83fc={};_0xca5886<_0x593905[_0xfc8c('0x45')];_0xca5886+=0x1){_0x5e83fc=_0x593905[_0xca5886];if(_[_0xfc8c('0x43')](_0x4a4f7e[_0xfc8c('0x17')][_0x5e83fc[_0xfc8c('0x2a')]])){_0x4a4f7e[_0xfc8c('0x17')][_0x5e83fc['name']]=new Campaign(_0x5e83fc);}else{_0x4a4f7e[_0xfc8c('0x40')](_0x4a4f7e[_0xfc8c('0x17')][_0x5e83fc[_0xfc8c('0x2a')]],_0x5e83fc);_0x4a4f7e[_0xfc8c('0x17')][_0x5e83fc['name']]['dialQueueProject']=_0x5e83fc[_0xfc8c('0x63')]?_0x5e83fc['SquareProject'][_0xfc8c('0x2a')]:undefined;}}}return _0x4a4f7e['campaigns'];};};Realtime[_0xfc8c('0x41')][_0xfc8c('0x64')]=function(){var _0xc780a6=this;return function(_0x256c80){if(_0x256c80){freeIsNotKey(_0x256c80,_0xc780a6['voiceExtensions'],'id');for(var _0x198268=0x0,_0x44e3f4={};_0x198268<_0x256c80[_0xfc8c('0x45')];_0x198268+=0x1){_0x44e3f4=_0x256c80[_0x198268];if(_[_0xfc8c('0x43')](_0xc780a6[_0xfc8c('0x1a')][_0x44e3f4['id']])){_0xc780a6[_0xfc8c('0x1a')][_0x44e3f4['id']]=new VoiceExtension(_0x44e3f4);}else{_0xc780a6[_0xfc8c('0x40')](_0xc780a6[_0xfc8c('0x1a')][_0x44e3f4['id']],_0x44e3f4);}}}return _0xc780a6['voiceExtensions'];};};Realtime[_0xfc8c('0x41')]['initCampaignHopperHistory']=function(){var _0x1a9782=this;return function(_0x1df101){clearCampaigns(_0x1a9782['campaigns']);for(var _0x1290b0=0x0;_0x1290b0<_0x1df101[_0xfc8c('0x45')];_0x1290b0+=0x1){_[_0xfc8c('0x65')](_0x1a9782[_0xfc8c('0x17')][_0x1df101[_0x1290b0]['name']],_0x1df101[_0x1290b0]);}return _0x1a9782[_0xfc8c('0x17')];};};Realtime[_0xfc8c('0x41')][_0xfc8c('0x66')]=function(){var _0x39693c=this;return function(_0xe834c2){if(_0xe834c2){freeIsNotKey(_0xe834c2,_0x39693c[_0xfc8c('0x25')],'id');for(var _0x54c140=0x0,_0x535fb2={},_0x479830={};_0x54c140<_0xe834c2['length'];_0x54c140+=0x1){_0x535fb2=_0xe834c2[_0x54c140];if(_['isUndefined'](_0x39693c[_0xfc8c('0x25')][_0x535fb2['id']])){_0x39693c[_0xfc8c('0x25')][_0x535fb2['id']]=new FaxAccount(_0x535fb2);}else{_0x39693c[_0xfc8c('0x40')](_0x39693c[_0xfc8c('0x25')][_0x535fb2['id']],_0x535fb2);}}}return _0x39693c[_0xfc8c('0x25')];};};module['exports']=Realtime;
\ No newline at end of file
index 5c53945..da4a3d3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8526=['getCallType','split','calleridnum','outbound','internal','voiceCallReport','destination','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','channel','destinationchannel','\x22%s\x22\x20<%s>','calleridname','transfers','transfereelinkedid','uniqueid','linkedid','type','UserId','monitor','monitors','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','blindTransfer','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','bind','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','isNil','name','interface','format','SIP/%s','voiceQueueReport','length','connectedlinenum','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys'];(function(_0x5637dc,_0x3cb05d){var _0x3f4168=function(_0x5c0121){while(--_0x5c0121){_0x5637dc['push'](_0x5637dc['shift']());}};_0x3f4168(++_0x3cb05d);}(_0x8526,0x1a5));var _0x6852=function(_0x428b42,_0x41091b){_0x428b42=_0x428b42-0x0;var _0x22d99e=_0x8526[_0x428b42];return _0x22d99e;};'use strict';var _=require(_0x6852('0x0'));var moment=require(_0x6852('0x1'));var util=require(_0x6852('0x2'));var config=require(_0x6852('0x3'));var ami=require(_0x6852('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x6852('0x5'));var RpcVoiceTransferReport=require(_0x6852('0x6'));var VoiceQueueReport=require(_0x6852('0x7'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x6852('0x8'));var VoiceDialReport=require(_0x6852('0x9'));var UserReport=require(_0x6852('0xa'));function Report(_0x14e665){this[_0x6852('0xb')]=_0x14e665;this[_0x6852('0xc')]=_0x14e665[_0x6852('0xc')];this[_0x6852('0xd')]=_0x14e665[_0x6852('0xd')];}Report[_0x6852('0xe')][_0x6852('0xf')]=function(_0x4ff95f){var _0x397fee=new VoiceQueueReport(this[_0x6852('0xb')]);var _0x2ae74f=new VoiceAgentReport(this[_0x6852('0xb')]);var _0x5ce79c=new VoiceDialReport(this[_0x6852('0xb')]);var _0x41b58d=new VoiceCallReport(this['realtime']);var _0x339630=new UserReport(this[_0x6852('0xb')]);if(config[_0x6852('0x10')]&&config['xdr'][_0x6852('0x11')]){ami['on'](_0x6852('0x12'),this['voiceQueueReport']['bind'](this));ami['on'](_0x6852('0x13'),this['voiceCallReport']['bind'](this));ami['on'](_0x6852('0x14'),this[_0x6852('0x15')][_0x6852('0x16')](this));ami['on'](_0x6852('0x17'),this[_0x6852('0x18')]['bind'](this));ami['on'](_0x6852('0x19'),this['blindTransfer'][_0x6852('0x16')](this));ami['on'](_0x6852('0x1a'),this[_0x6852('0x1b')][_0x6852('0x16')](this));}};Report[_0x6852('0xe')][_0x6852('0x1c')]=function(_0x30cfcc){var _0x22e319;_0x22e319=_[_0x6852('0x1d')](this[_0x6852('0xc')],function(_0x39aad4){return _0x39aad4[_0x6852('0x1e')]==_0x30cfcc||_0x39aad4['name']==_0x30cfcc;});if(_[_0x6852('0x1f')](_0x22e319)){var _0x90ccde=_[_0x6852('0x1d')](this[_0x6852('0xd')],function(_0x4a1754){return _0x4a1754['accountcode']==_0x30cfcc||_0x4a1754[_0x6852('0x20')]==_0x30cfcc;});if(_0x90ccde){_0x22e319=_[_0x6852('0x1d')](this['agents'],function(_0x2331b2){return _0x2331b2[_0x6852('0x21')]==util[_0x6852('0x22')](_0x6852('0x23'),_0x90ccde[_0x6852('0x20')]);});}}return _0x22e319;};Report[_0x6852('0xe')][_0x6852('0x24')]=function(_0x475860){for(var _0x50c2b7=0x0;_0x50c2b7<_0x475860[_0x6852('0x25')];_0x50c2b7+=0x1){var _0xe43cdb=this[_0x6852('0x1c')](_0x475860[_0x50c2b7][_0x6852('0x26')]);if(_0xe43cdb){_0x475860[_0x50c2b7][_0x6852('0x1e')]=_0xe43cdb[_0x6852('0x1e')];_0x475860[_0x50c2b7]['assigned']=!![];_0x475860[_0x50c2b7][_0x6852('0x27')]=_0xe43cdb['name'];_0x475860[_0x50c2b7][_0x6852('0x21')]=_[_0x6852('0x1f')](_0xe43cdb[_0x6852('0x21')])?util[_0x6852('0x22')](_0x6852('0x23'),_0xe43cdb['name']):_0xe43cdb[_0x6852('0x21')];if(_0x475860[_0x50c2b7][_0x6852('0x28')]){_0x475860[_0x50c2b7][_0x6852('0x29')]=moment()[_0x6852('0x22')](_0x6852('0x2a'));}if(_0x475860[_0x50c2b7][_0x6852('0x2b')]){_0x475860[_0x50c2b7][_0x6852('0x2c')]=moment()[_0x6852('0x22')](_0x6852('0x2a'));}RpcMemberReport[_0x6852('0x24')](_0x475860[_0x50c2b7]);}RpcVoiceQueueReport[_0x6852('0x2d')](_0x475860[_0x50c2b7]);}};function extractCalleridNumber(_0x50dcbe){var _0xfa2d58=_0x50dcbe[_0x6852('0x2e')](/<(.*?)>/);return _0xfa2d58?_0xfa2d58[0x1]:_0x50dcbe;}Report['prototype'][_0x6852('0x2f')]=function(_0xe14ee6){for(var _0x386b99=0x0;_0x386b99<Object[_0x6852('0x30')](this[_0x6852('0xc')])[_0x6852('0x25')];_0x386b99++){var _0x4d803a=Object[_0x6852('0x30')](this[_0x6852('0xc')])[_0x386b99];var _0x5dfc7b=this['agents'][_0x4d803a];if(_0x5dfc7b[_0x6852('0x1e')]===Number(_0xe14ee6))return _0x5dfc7b;}return null;};Report['prototype'][_0x6852('0x31')]=function(_0x1a64cb){var _0x3915aa=_0x1a64cb['channel'][_0x6852('0x32')]('-')[0x0];var _0x50ba9f=this[_0x6852('0xc')][_0x3915aa];if(!_0x50ba9f)_0x50ba9f=this[_0x6852('0x2f')](_0x1a64cb[_0x6852('0x33')]);return!_0x50ba9f?_0x6852('0x34'):_0x6852('0x35');};Report['prototype'][_0x6852('0x36')]=function(_0x261384){_0x261384[_0x6852('0x37')]=_0x261384[_0x6852('0x37')]||_0x261384['exten'];if(_0x261384['type']==_0x6852('0x38')){_0x261384[_0x6852('0x39')]=_0x6852('0x3a');_0x261384['lastdata']=_0x261384[_0x6852('0x3a')];if(_0x261384[_0x6852('0x3b')]==_0x6852('0x3c')){_0x261384[_0x6852('0x1e')]='';_0x261384['destination']=extractCalleridNumber(_0x261384[_0x6852('0x3d')]);}else if(_0x261384[_0x6852('0x3b')]==_0x6852('0x3e')){if(_0x261384[_0x6852('0x37')]==_0x6852('0x3f')){_0x261384[_0x6852('0x37')]=extractCalleridNumber(_0x261384[_0x6852('0x40')]);_0x261384[_0x6852('0x33')]=_0x261384[_0x6852('0x41')];_0x261384['destinationchannel']=[_0x261384['channel'],_0x261384[_0x6852('0x42')]=_0x261384[_0x6852('0x43')]][0x0];_0x261384[_0x6852('0x3d')]=_0x261384[_0x6852('0x40')];}else{_0x261384[_0x6852('0x37')]=_0x261384['calleridnum'];_0x261384[_0x6852('0x33')]=_0x261384[_0x6852('0x41')];if(_0x261384['disposition']=='ANSWERED'){_0x261384[_0x6852('0x1e')]=_0x261384[_0x6852('0x26')];}else{_0x261384[_0x6852('0x1e')]='';}}}}else{_0x261384[_0x6852('0x3d')]=util[_0x6852('0x22')](_0x6852('0x44'),_0x261384[_0x6852('0x45')],_0x261384[_0x6852('0x33')]);}if(RpcVoiceTransferReport['transfers'][_0x261384['linkedid']]){var _0x3f17b2=RpcVoiceTransferReport[_0x6852('0x46')][_0x261384['linkedid']];_0x3f17b2[_0x6852('0x47')]=_0x261384[_0x6852('0x48')];RpcVoiceTransferReport['blindTransfer'](_0x3f17b2);delete RpcVoiceTransferReport[_0x6852('0x46')][_0x261384[_0x6852('0x49')]];}if(_[_0x6852('0x1f')](_0x261384[_0x6852('0x4a')])){_0x261384['type']=this[_0x6852('0x31')](_0x261384);}if(_[_0x6852('0x1f')](_0x261384[_0x6852('0x4b')])){var _0x3f92e8=_0x261384['channel']['split']('-')[0x0];var _0x291cd1=this[_0x6852('0xc')][_0x3f92e8];if(!_0x291cd1)_0x291cd1=this['getAgentByInternal'](_0x261384['accountcode']);if(_0x291cd1){_0x261384[_0x6852('0x4b')]=_0x291cd1['id'];_0x261384['membername']=_0x291cd1[_0x6852('0x20')];}}RpcVoiceCallReport[_0x6852('0x2d')](_0x261384);if(_0x261384[_0x6852('0x4c')]){for(var _0x43f905=0x0;_0x43f905<_0x261384['monitors'][_0x6852('0x25')];_0x43f905+=0x1){_0x261384['monitorFilename']=_0x261384[_0x6852('0x4d')][_0x43f905]['filename'];_0x261384[_0x6852('0x4e')]=_0x261384['monitors'][_0x43f905][_0x6852('0x4e')];if(_0x261384[_0x6852('0x4f')]==_0x6852('0x3f')){_0x261384[_0x6852('0x33')]=_0x261384[_0x6852('0x26')];_0x261384['calleridname']=_0x261384[_0x6852('0x50')];_0x261384['connectedlinenum']=_0x261384[_0x6852('0x1e')];_0x261384[_0x6852('0x50')]=_0x261384[_0x6852('0x51')];_0x261384['exten']=_0x261384[_0x6852('0x41')];}else if(_0x261384['exten']==_0x6852('0x52')){_0x261384[_0x6852('0x33')]=_0x261384[_0x6852('0x37')];_0x261384[_0x6852('0x4f')]=_0x261384[_0x6852('0x41')];}RpcVoiceRecording['create'](_0x261384);}}};Report[_0x6852('0xe')][_0x6852('0x15')]=function(_0x3b4153){if(_[_0x6852('0x53')](_0x3b4153)){_0x3b4153[_0x6852('0x54')](function(_0x22f010){RpcVoiceAgentReport['create'](_0x22f010);});}else{RpcVoiceAgentReport[_0x6852('0x2d')](_0x3b4153);}};Report[_0x6852('0xe')][_0x6852('0x18')]=function(_0x352812){RpcVoiceDialReport[_0x6852('0x2d')](_0x352812);var _0x44092f;var _0x5e0767;var _0x1b8293=_0x352812[_0x6852('0x42')];if(_['startsWith'](_0x1b8293,_0x6852('0x55'))){_0x5e0767=_0x1b8293[_0x6852('0x56')](_0x1b8293['indexOf']('/')+0x1,_0x1b8293[_0x6852('0x57')]('@'));_0x44092f=_['find'](this[_0x6852('0xc')],function(_0x54dece){return _0x54dece[_0x6852('0x58')]==_0x5e0767||_0x54dece[_0x6852('0x59')]==_0x5e0767||_0x54dece[_0x6852('0x1e')]==_0x5e0767;});}else{_0x5e0767=_0x1b8293[_0x6852('0x56')](_0x1b8293[_0x6852('0x57')]('/')+0x1,_0x1b8293[_0x6852('0x5a')]('-'));_0x44092f=this[_0x6852('0x1c')](_0x5e0767);}if(_0x44092f){_0x352812[_0x6852('0x21')]=_[_0x6852('0x1f')](_0x44092f['interface'])?util['format'](_0x6852('0x23'),_0x44092f[_0x6852('0x20')]):_0x44092f['interface'];_0x352812[_0x6852('0x51')]=_0x44092f[_0x6852('0x20')];_0x352812[_0x6852('0x1e')]=_0x44092f[_0x6852('0x1e')];RpcMemberReport['voiceDialReport'](_0x352812);}};Report['prototype'][_0x6852('0x5b')]=function(_0xd2bd7d){RpcVoiceTransferReport[_0x6852('0x46')][_0xd2bd7d[_0x6852('0x5c')]]=_0xd2bd7d;};Report[_0x6852('0xe')][_0x6852('0x1b')]=function(_0x4784ed){RpcVoiceTransferReport['attendedTransfer'](_0x4784ed);};module[_0x6852('0x5d')]=Report;
\ No newline at end of file
+var _0x96d7=['voiceDialReport','blindTransfer','attendedTransfer','findAgent','name','isNil','find','accountcode','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','interface','format','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','keys','calleridnum','outbound','internal','destination','exten','type','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','callerid','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','split','getAgentByInternal','UserId','membername','monitors','monitorFilename','filename','createdAt','connectedlinename','voiceAgentReport','isArray','startsWith','mobile','lastIndexOf','exports','lodash','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport'];(function(_0xbbaee8,_0x18ce89){var _0x30d62c=function(_0x811791){while(--_0x811791){_0xbbaee8['push'](_0xbbaee8['shift']());}};_0x30d62c(++_0x18ce89);}(_0x96d7,0x13f));var _0x796d=function(_0x4430f0,_0x29fbce){_0x4430f0=_0x4430f0-0x0;var _0x4e0390=_0x96d7[_0x4430f0];return _0x4e0390;};'use strict';var _=require(_0x796d('0x0'));var moment=require('moment');var util=require(_0x796d('0x1'));var config=require(_0x796d('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x796d('0x3'));var RpcVoiceCallReport=require(_0x796d('0x4'));var RpcVoiceDialReport=require(_0x796d('0x5'));var RpcMemberReport=require(_0x796d('0x6'));var RpcVoiceQueueReport=require(_0x796d('0x7'));var RpcVoiceRecording=require(_0x796d('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x796d('0x9'));var VoiceCallReport=require(_0x796d('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x796d('0xb'));var UserReport=require(_0x796d('0xc'));function Report(_0x5a8a7a){this[_0x796d('0xd')]=_0x5a8a7a;this['agents']=_0x5a8a7a[_0x796d('0xe')];this[_0x796d('0xf')]=_0x5a8a7a[_0x796d('0xf')];}Report[_0x796d('0x10')][_0x796d('0x11')]=function(_0x562c80){var _0x2fbea2=new VoiceQueueReport(this[_0x796d('0xd')]);var _0x27b1ca=new VoiceAgentReport(this[_0x796d('0xd')]);var _0x214072=new VoiceDialReport(this['realtime']);var _0x2c4a2d=new VoiceCallReport(this[_0x796d('0xd')]);var _0x20a72f=new UserReport(this['realtime']);if(config['xdr']&&config[_0x796d('0x12')]['disabled']){ami['on'](_0x796d('0x13'),this[_0x796d('0x14')][_0x796d('0x15')](this));ami['on']('custom:voiceCallReport',this[_0x796d('0x16')][_0x796d('0x15')](this));ami['on'](_0x796d('0x17'),this['voiceAgentReport']['bind'](this));ami['on'](_0x796d('0x18'),this[_0x796d('0x19')][_0x796d('0x15')](this));ami['on']('blindtransfer',this[_0x796d('0x1a')]['bind'](this));ami['on']('attendedtransfer',this[_0x796d('0x1b')]['bind'](this));}};Report[_0x796d('0x10')][_0x796d('0x1c')]=function(_0x5ec3bf){var _0x26fd77;_0x26fd77=_['find'](this[_0x796d('0xe')],function(_0x279453){return _0x279453['accountcode']==_0x5ec3bf||_0x279453[_0x796d('0x1d')]==_0x5ec3bf;});if(_[_0x796d('0x1e')](_0x26fd77)){var _0x492a25=_[_0x796d('0x1f')](this[_0x796d('0xf')],function(_0x4b02aa){return _0x4b02aa[_0x796d('0x20')]==_0x5ec3bf||_0x4b02aa[_0x796d('0x1d')]==_0x5ec3bf;});if(_0x492a25){_0x26fd77=_[_0x796d('0x1f')](this[_0x796d('0xe')],function(_0x3b49ad){return _0x3b49ad['interface']==util['format'](_0x796d('0x21'),_0x492a25[_0x796d('0x1d')]);});}}return _0x26fd77;};Report[_0x796d('0x10')][_0x796d('0x14')]=function(_0x3848b2){for(var _0x125942=0x0;_0x125942<_0x3848b2[_0x796d('0x22')];_0x125942+=0x1){var _0x3e517d=this[_0x796d('0x1c')](_0x3848b2[_0x125942][_0x796d('0x23')]);if(_0x3e517d){_0x3848b2[_0x125942][_0x796d('0x20')]=_0x3e517d['accountcode'];_0x3848b2[_0x125942][_0x796d('0x24')]=!![];_0x3848b2[_0x125942][_0x796d('0x25')]=_0x3e517d[_0x796d('0x1d')];_0x3848b2[_0x125942][_0x796d('0x26')]=_[_0x796d('0x1e')](_0x3e517d[_0x796d('0x26')])?util[_0x796d('0x27')]('SIP/%s',_0x3e517d[_0x796d('0x1d')]):_0x3e517d['interface'];if(_0x3848b2[_0x125942]['queuecallercomplete']){_0x3848b2[_0x125942]['queuecallercompleteAt']=moment()[_0x796d('0x27')](_0x796d('0x28'));}if(_0x3848b2[_0x125942][_0x796d('0x29')]){_0x3848b2[_0x125942][_0x796d('0x2a')]=moment()['format'](_0x796d('0x28'));}RpcMemberReport[_0x796d('0x14')](_0x3848b2[_0x125942]);}RpcVoiceQueueReport[_0x796d('0x2b')](_0x3848b2[_0x125942]);}};function extractCalleridNumber(_0x4dec42){var _0x56d8b0=_0x4dec42[_0x796d('0x2c')](/<(.*?)>/);return _0x56d8b0?_0x56d8b0[0x1]:_0x4dec42;}Report[_0x796d('0x10')]['getAgentByInternal']=function(_0x450a27){for(var _0x11d155=0x0;_0x11d155<Object['keys'](this['agents'])[_0x796d('0x22')];_0x11d155++){var _0x2004b3=Object[_0x796d('0x2d')](this['agents'])[_0x11d155];var _0x3bad6f=this[_0x796d('0xe')][_0x2004b3];if(_0x3bad6f[_0x796d('0x20')]===Number(_0x450a27))return _0x3bad6f;}return null;};Report[_0x796d('0x10')]['getCallType']=function(_0x315d46){var _0x36375d=_0x315d46['channel']['split']('-')[0x0];var _0x1b9d05=this['agents'][_0x36375d];if(!_0x1b9d05)_0x1b9d05=this['getAgentByInternal'](_0x315d46[_0x796d('0x2e')]);return!_0x1b9d05?_0x796d('0x2f'):_0x796d('0x30');};Report[_0x796d('0x10')][_0x796d('0x16')]=function(_0x158c05){_0x158c05[_0x796d('0x31')]=_0x158c05['destination']||_0x158c05[_0x796d('0x32')];if(_0x158c05[_0x796d('0x33')]=='dialer'){_0x158c05['lastapplication']=_0x796d('0x34');_0x158c05[_0x796d('0x35')]=_0x158c05[_0x796d('0x34')];if(_0x158c05[_0x796d('0x36')]==_0x796d('0x37')){_0x158c05[_0x796d('0x20')]='';_0x158c05['destination']=extractCalleridNumber(_0x158c05['callerid']);}else if(_0x158c05[_0x796d('0x36')]==_0x796d('0x38')){if(_0x158c05[_0x796d('0x31')]==_0x796d('0x39')){_0x158c05[_0x796d('0x31')]=extractCalleridNumber(_0x158c05['calleridpreview']);_0x158c05['calleridnum']=_0x158c05[_0x796d('0x3a')];_0x158c05[_0x796d('0x3b')]=[_0x158c05[_0x796d('0x3c')],_0x158c05[_0x796d('0x3c')]=_0x158c05[_0x796d('0x3b')]][0x0];_0x158c05['callerid']=_0x158c05[_0x796d('0x3d')];}else{_0x158c05[_0x796d('0x31')]=_0x158c05[_0x796d('0x2e')];_0x158c05['calleridnum']=_0x158c05[_0x796d('0x3a')];if(_0x158c05[_0x796d('0x3e')]=='ANSWERED'){_0x158c05['accountcode']=_0x158c05[_0x796d('0x23')];}else{_0x158c05[_0x796d('0x20')]='';}}}}else{_0x158c05[_0x796d('0x3f')]=util[_0x796d('0x27')](_0x796d('0x40'),_0x158c05[_0x796d('0x41')],_0x158c05[_0x796d('0x2e')]);}if(RpcVoiceTransferReport[_0x796d('0x42')][_0x158c05[_0x796d('0x43')]]){var _0x38a578=RpcVoiceTransferReport[_0x796d('0x42')][_0x158c05[_0x796d('0x43')]];_0x38a578[_0x796d('0x44')]=_0x158c05[_0x796d('0x45')];RpcVoiceTransferReport[_0x796d('0x1a')](_0x38a578);delete RpcVoiceTransferReport['transfers'][_0x158c05[_0x796d('0x43')]];}if(_[_0x796d('0x1e')](_0x158c05[_0x796d('0x33')])){_0x158c05[_0x796d('0x33')]=this[_0x796d('0x46')](_0x158c05);}if(_[_0x796d('0x1e')](_0x158c05['UserId'])){var _0x29dd3c=_0x158c05['channel'][_0x796d('0x47')]('-')[0x0];var _0x52afc9=this[_0x796d('0xe')][_0x29dd3c];if(!_0x52afc9)_0x52afc9=this[_0x796d('0x48')](_0x158c05[_0x796d('0x20')]);if(_0x52afc9){_0x158c05[_0x796d('0x49')]=_0x52afc9['id'];_0x158c05[_0x796d('0x4a')]=_0x52afc9[_0x796d('0x1d')];}}RpcVoiceCallReport[_0x796d('0x2b')](_0x158c05);if(_0x158c05['monitor']){for(var _0x116c6c=0x0;_0x116c6c<_0x158c05[_0x796d('0x4b')][_0x796d('0x22')];_0x116c6c+=0x1){_0x158c05[_0x796d('0x4c')]=_0x158c05[_0x796d('0x4b')][_0x116c6c][_0x796d('0x4d')];_0x158c05[_0x796d('0x4e')]=_0x158c05[_0x796d('0x4b')][_0x116c6c]['createdAt'];if(_0x158c05['exten']==_0x796d('0x39')){_0x158c05[_0x796d('0x2e')]=_0x158c05[_0x796d('0x23')];_0x158c05[_0x796d('0x41')]=_0x158c05[_0x796d('0x4f')];_0x158c05[_0x796d('0x23')]=_0x158c05[_0x796d('0x20')];_0x158c05[_0x796d('0x4f')]=_0x158c05[_0x796d('0x4a')];_0x158c05[_0x796d('0x32')]=_0x158c05[_0x796d('0x3a')];}else if(_0x158c05['exten']=='xcally-motion-dialer'){_0x158c05[_0x796d('0x2e')]=_0x158c05[_0x796d('0x31')];_0x158c05['exten']=_0x158c05['originatecalleridnum'];}RpcVoiceRecording[_0x796d('0x2b')](_0x158c05);}}};Report[_0x796d('0x10')][_0x796d('0x50')]=function(_0x255fc9){if(_[_0x796d('0x51')](_0x255fc9)){_0x255fc9['forEach'](function(_0x5e61fe){RpcVoiceAgentReport[_0x796d('0x2b')](_0x5e61fe);});}else{RpcVoiceAgentReport['create'](_0x255fc9);}};Report[_0x796d('0x10')]['voiceDialReport']=function(_0x28b714){RpcVoiceDialReport['create'](_0x28b714);var _0x2a4422;var _0xfc2471;var _0x131c97=_0x28b714[_0x796d('0x3c')];if(_[_0x796d('0x52')](_0x131c97,'Local')){_0xfc2471=_0x131c97['substring'](_0x131c97['indexOf']('/')+0x1,_0x131c97['indexOf']('@'));_0x2a4422=_[_0x796d('0x1f')](this['agents'],function(_0x2b0243){return _0x2b0243[_0x796d('0x53')]==_0xfc2471||_0x2b0243['phone']==_0xfc2471||_0x2b0243[_0x796d('0x20')]==_0xfc2471;});}else{_0xfc2471=_0x131c97['substring'](_0x131c97['indexOf']('/')+0x1,_0x131c97[_0x796d('0x54')]('-'));_0x2a4422=this['findAgent'](_0xfc2471);}if(_0x2a4422){_0x28b714[_0x796d('0x26')]=_['isNil'](_0x2a4422[_0x796d('0x26')])?util[_0x796d('0x27')](_0x796d('0x21'),_0x2a4422['name']):_0x2a4422['interface'];_0x28b714[_0x796d('0x4a')]=_0x2a4422['name'];_0x28b714['accountcode']=_0x2a4422['accountcode'];RpcMemberReport[_0x796d('0x19')](_0x28b714);}};Report[_0x796d('0x10')][_0x796d('0x1a')]=function(_0x42d885){RpcVoiceTransferReport[_0x796d('0x42')][_0x42d885['transfererlinkedid']]=_0x42d885;};Report['prototype'][_0x796d('0x1b')]=function(_0x175a51){RpcVoiceTransferReport[_0x796d('0x1b')](_0x175a51);};module[_0x796d('0x55')]=Report;
\ No newline at end of file
index a525642..f3f3f34 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc0f5=['redis','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','peerstatus','syncRealtimeShow','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','resolve','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','stateRegistry','state','event','format','trunk:%s','name','trunk:save','syncDeviceState','info','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','updateStatusRealtime','telephone:%s','telephone:save','toNumber','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','find','mobile','phone','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','defaults','localhost','socket.io-emitter'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc0f5,0xd5));var _0x5c0f=function(_0x553224,_0x11ba53){_0x553224=_0x553224-0x0;var _0x4f95e5=_0xc0f5[_0x553224];return _0x4f95e5;};'use strict';var _=require(_0x5c0f('0x0'));var moment=require(_0x5c0f('0x1'));var util=require(_0x5c0f('0x2'));var Redis=require(_0x5c0f('0x3'));var BPromise=require(_0x5c0f('0x4'));var config=require(_0x5c0f('0x5'));var logger=require(_0x5c0f('0x6'))(_0x5c0f('0x7'));var ami=require(_0x5c0f('0x8'));config['redis']=_[_0x5c0f('0x9')](config['redis'],{'host':_0x5c0f('0xa'),'port':0x18eb});var io=require(_0x5c0f('0xb'))(new Redis(config[_0x5c0f('0xc')]));function UserReport(_0x4d8562){this[_0x5c0f('0xd')]=_0x4d8562[_0x5c0f('0xd')];this[_0x5c0f('0xe')]=_0x4d8562[_0x5c0f('0xe')];this[_0x5c0f('0xf')]=_0x4d8562[_0x5c0f('0xf')];ami['on'](_0x5c0f('0x10'),this[_0x5c0f('0x11')][_0x5c0f('0x12')](this));ami['on'](_0x5c0f('0x13'),this['syncRegistry']['bind'](this));ami['on'](_0x5c0f('0x14'),this['syncDeviceState']['bind'](this));ami['on'](_0x5c0f('0x15'),this['syncPeerStatus'][_0x5c0f('0x12')](this));return this[_0x5c0f('0x16')]();}function showSipRegistrations(){Promise['resolve']()[_0x5c0f('0x17')](ami[_0x5c0f('0x18')]())[_0x5c0f('0x19')](function(_0x3913e0){logger[_0x5c0f('0x1a')](_0x5c0f('0x1b'),util[_0x5c0f('0x1c')](_0x3913e0,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x5c0f('0x1d')]()[_0x5c0f('0x17')](ami['actionDeviceStateList']())[_0x5c0f('0x19')](function(_0x382f85){logger[_0x5c0f('0x1a')](_0x5c0f('0x1e'),util[_0x5c0f('0x1c')](_0x382f85,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()['then'](ami[_0x5c0f('0x1f')]())[_0x5c0f('0x19')](function(_0x33c0c3){logger[_0x5c0f('0x1a')](_0x5c0f('0x20'),util[_0x5c0f('0x1c')](_0x33c0c3,{'showHidden':![],'depth':null}));});}UserReport[_0x5c0f('0x21')][_0x5c0f('0x16')]=function(){setInterval(function(){BPromise[_0x5c0f('0x1d')]()[_0x5c0f('0x17')](showSipRegistrations())[_0x5c0f('0x17')](listDeviceStates())[_0x5c0f('0x17')](showPeersStatus());},0x32c8);};UserReport[_0x5c0f('0x21')][_0x5c0f('0x22')]=function(_0x4a5fe8){return _0x4a5fe8!==null&&!_[_0x5c0f('0x23')](_0x4a5fe8);};UserReport[_0x5c0f('0x21')][_0x5c0f('0x24')]=function(_0x39d8c6,_0x1f99d3,_0x13d9ea){io['to'](_0x39d8c6)[_0x5c0f('0x24')](_0x1f99d3,_0x13d9ea);};UserReport[_0x5c0f('0x21')][_0x5c0f('0x11')]=function(_0x303910){try{if(this[_0x5c0f('0x22')](_0x303910)){logger['info'](_0x5c0f('0x25'),_0x303910[_0x5c0f('0x26')],_0x303910['state']);logger[_0x5c0f('0x27')]('[userReport][registry]',util[_0x5c0f('0x1c')](_0x303910,{'showHidden':![],'depth':null}));var _0xa70417=_['find'](this['trunks'],{'defaultuser':_0x303910['username']});if(_0xa70417){_0x303910[_0x5c0f('0x28')]=_0x303910[_0x5c0f('0x29')];_['merge'](_0xa70417,_['omit'](_0x303910,[_0x5c0f('0x2a'),'actionid','username',_0x5c0f('0x29')]));logger[_0x5c0f('0x27')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0xa70417,{'showHidden':![],'depth':null}));this[_0x5c0f('0x24')](util[_0x5c0f('0x2b')](_0x5c0f('0x2c'),_0xa70417[_0x5c0f('0x2d')]),_0x5c0f('0x2e'),_0xa70417);}}}catch(_0x2820c7){logger[_0x5c0f('0x1a')]('[userReport][registry]',util[_0x5c0f('0x1c')](_0x2820c7,{'showHidden':![],'depth':null}));}};UserReport[_0x5c0f('0x21')][_0x5c0f('0x2f')]=function(_0x1308d6){try{if(this[_0x5c0f('0x22')](_0x1308d6)){logger[_0x5c0f('0x30')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x1308d6[_0x5c0f('0x31')],_0x1308d6[_0x5c0f('0x29')]);logger[_0x5c0f('0x27')](_0x5c0f('0x32'),util[_0x5c0f('0x1c')](_0x1308d6,{'showHidden':![],'depth':null}));if(this['agents'][_0x1308d6[_0x5c0f('0x31')]]){if(!this['agents'][_0x1308d6[_0x5c0f('0x31')]][_0x5c0f('0x33')]||_0x1308d6[_0x5c0f('0x29')][_0x5c0f('0x34')]()==_0x5c0f('0x35')){this[_0x5c0f('0xe')][_0x1308d6[_0x5c0f('0x31')]][_0x5c0f('0x33')]=![];if(this[_0x5c0f('0xe')][_0x1308d6[_0x5c0f('0x31')]]['state']!==_0x1308d6[_0x5c0f('0x29')]['toLowerCase']()){this[_0x5c0f('0xe')][_0x1308d6[_0x5c0f('0x31')]][_0x5c0f('0x36')]=_['toNumber'](moment()[_0x5c0f('0x2b')]('x'));}this[_0x5c0f('0xe')][_0x1308d6[_0x5c0f('0x31')]][_0x5c0f('0x29')]=_0x1308d6[_0x5c0f('0x29')]['toLowerCase']();this[_0x5c0f('0xe')][_0x1308d6[_0x5c0f('0x31')]][_0x5c0f('0x37')](_0x1308d6);}}else if(this['telephones'][_0x1308d6[_0x5c0f('0x31')]]){if(this[_0x5c0f('0xf')][_0x1308d6['device']][_0x5c0f('0x29')]!==_0x1308d6['state'][_0x5c0f('0x34')]()){this['telephones'][_0x1308d6['device']][_0x5c0f('0x36')]=_['toNumber'](moment()[_0x5c0f('0x2b')]('x'));}this[_0x5c0f('0xf')][_0x1308d6[_0x5c0f('0x31')]][_0x5c0f('0x29')]=_0x1308d6['state'][_0x5c0f('0x34')]();logger[_0x5c0f('0x27')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x5c0f('0x1c')](this[_0x5c0f('0xf')][_0x1308d6[_0x5c0f('0x31')]],{'showHidden':![],'depth':null}));this[_0x5c0f('0x24')](util[_0x5c0f('0x2b')](_0x5c0f('0x38'),this[_0x5c0f('0xf')][_0x1308d6[_0x5c0f('0x31')]]['name']),_0x5c0f('0x39'),this[_0x5c0f('0xf')][_0x1308d6[_0x5c0f('0x31')]]);}else if(this[_0x5c0f('0xd')][_0x1308d6['device']]){if(this['trunks'][_0x1308d6['device']][_0x5c0f('0x29')]!==_0x1308d6[_0x5c0f('0x29')][_0x5c0f('0x34')]()){this[_0x5c0f('0xd')][_0x1308d6['device']][_0x5c0f('0x36')]=_[_0x5c0f('0x3a')](moment()[_0x5c0f('0x2b')]('x'));}this[_0x5c0f('0xd')][_0x1308d6['device']]['state']=_0x1308d6['state']['toLowerCase']();logger[_0x5c0f('0x27')](_0x5c0f('0x3b'),util[_0x5c0f('0x1c')](this[_0x5c0f('0xd')][_0x1308d6[_0x5c0f('0x31')]],{'showHidden':![],'depth':null}));this[_0x5c0f('0x24')](util[_0x5c0f('0x2b')](_0x5c0f('0x2c'),this[_0x5c0f('0xd')][_0x1308d6['device']][_0x5c0f('0x2d')]),_0x5c0f('0x2e'),this[_0x5c0f('0xd')][_0x1308d6[_0x5c0f('0x31')]]);}else if(_[_0x5c0f('0x3c')](_0x1308d6[_0x5c0f('0x31')],_0x5c0f('0x3d'))){var _0x8ddb81=_0x1308d6[_0x5c0f('0x31')];var _0x1a24c6=_0x8ddb81[_0x5c0f('0x3e')](_0x8ddb81[_0x5c0f('0x3f')]('/')+0x1,_0x8ddb81[_0x5c0f('0x3f')]('@'));var _0x19fed8=_[_0x5c0f('0x40')](this[_0x5c0f('0xe')],function(_0x16317c){return _0x16317c[_0x5c0f('0x41')]==_0x1a24c6||_0x16317c[_0x5c0f('0x42')]==_0x1a24c6||_0x16317c['accountcode']==_0x1a24c6;});if(_0x19fed8){if(_0x19fed8[_0x5c0f('0x29')]!==_0x1308d6[_0x5c0f('0x29')][_0x5c0f('0x34')]()){_0x19fed8[_0x5c0f('0x36')]=_[_0x5c0f('0x3a')](moment()[_0x5c0f('0x2b')]('x'));}_0x19fed8[_0x5c0f('0x29')]=_0x1308d6['state'][_0x5c0f('0x34')]();_0x19fed8[_0x5c0f('0x33')]=!![];_0x19fed8[_0x5c0f('0x37')](_0x1308d6);}}}}catch(_0x4f4734){logger[_0x5c0f('0x1a')](_0x5c0f('0x32'),util[_0x5c0f('0x1c')](_0x4f4734,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x5c0f('0x43')]=function(_0x229e4e){try{if(this[_0x5c0f('0x22')](_0x229e4e)&&this[_0x5c0f('0x22')](_0x229e4e[_0x5c0f('0x15')])){logger[_0x5c0f('0x30')](_0x5c0f('0x44'),_0x229e4e[_0x5c0f('0x45')],_0x229e4e[_0x5c0f('0x46')],_0x229e4e[_0x5c0f('0x15')]);logger['debug'](_0x5c0f('0x47'),util[_0x5c0f('0x1c')](_0x229e4e,{'showHidden':![],'depth':null}));if(this[_0x5c0f('0xe')][_0x229e4e[_0x5c0f('0x45')]]){if(!this[_0x5c0f('0xe')][_0x229e4e[_0x5c0f('0x45')]][_0x5c0f('0x33')]||_0x229e4e['peerstatus'][_0x5c0f('0x34')]()=='registered'){this['agents'][_0x229e4e[_0x5c0f('0x45')]][_0x5c0f('0x33')]=![];this[_0x5c0f('0xe')][_0x229e4e[_0x5c0f('0x45')]][_0x5c0f('0x48')]=_0x229e4e[_0x5c0f('0x15')][_0x5c0f('0x34')]();this['agents'][_0x229e4e[_0x5c0f('0x45')]]['address']=_0x229e4e[_0x5c0f('0x46')];this[_0x5c0f('0xe')][_0x229e4e[_0x5c0f('0x45')]][_0x5c0f('0x37')](_0x229e4e);}}else if(this[_0x5c0f('0xf')][_0x229e4e[_0x5c0f('0x45')]]){this[_0x5c0f('0xf')][_0x229e4e[_0x5c0f('0x45')]][_0x5c0f('0x48')]=_0x229e4e[_0x5c0f('0x15')][_0x5c0f('0x34')]();this[_0x5c0f('0xf')][_0x229e4e[_0x5c0f('0x45')]]['address']=_0x229e4e[_0x5c0f('0x46')];logger[_0x5c0f('0x27')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x5c0f('0x1c')](this[_0x5c0f('0xf')][_0x229e4e[_0x5c0f('0x45')]],{'showHidden':![],'depth':null}));this[_0x5c0f('0x24')](util[_0x5c0f('0x2b')]('telephone:%s',this[_0x5c0f('0xf')][_0x229e4e[_0x5c0f('0x45')]][_0x5c0f('0x2d')]),_0x5c0f('0x39'),this['telephones'][_0x229e4e[_0x5c0f('0x45')]]);}else if(this[_0x5c0f('0xd')][_0x229e4e[_0x5c0f('0x45')]]){this['trunks'][_0x229e4e['peer']][_0x5c0f('0x48')]=_0x229e4e[_0x5c0f('0x15')][_0x5c0f('0x34')]();this[_0x5c0f('0xd')][_0x229e4e[_0x5c0f('0x45')]][_0x5c0f('0x46')]=_0x229e4e[_0x5c0f('0x46')];logger[_0x5c0f('0x27')](_0x5c0f('0x49'),util[_0x5c0f('0x1c')](this['trunks'][_0x229e4e[_0x5c0f('0x45')]],{'showHidden':![],'depth':null}));this['emit'](util['format']('trunk:%s',this[_0x5c0f('0xd')][_0x229e4e[_0x5c0f('0x45')]][_0x5c0f('0x2d')]),'trunk:save',this[_0x5c0f('0xd')][_0x229e4e[_0x5c0f('0x45')]]);}}}catch(_0x2d4d66){logger['error'](_0x5c0f('0x47'),util[_0x5c0f('0x1c')](_0x2d4d66,{'showHidden':![],'depth':null}));}};module[_0x5c0f('0x4a')]=UserReport;
\ No newline at end of file
+var _0xe444=['syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','toNumber','updateStatusRealtime','telephones','format','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','stateTime','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','peerstatus','registered','status','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','registryentry','syncRegistry','bind','registry','devicestatechange','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','actionSipPeerStatus','catch','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','trunk:save'];(function(_0x37de50,_0x27f82a){var _0x2c37dc=function(_0x325186){while(--_0x325186){_0x37de50['push'](_0x37de50['shift']());}};_0x2c37dc(++_0x27f82a);}(_0xe444,0x1b5));var _0x4e44=function(_0x23d0ec,_0x25c028){_0x23d0ec=_0x23d0ec-0x0;var _0x1ef7d2=_0xe444[_0x23d0ec];return _0x1ef7d2;};'use strict';var _=require(_0x4e44('0x0'));var moment=require(_0x4e44('0x1'));var util=require(_0x4e44('0x2'));var Redis=require(_0x4e44('0x3'));var BPromise=require(_0x4e44('0x4'));var config=require(_0x4e44('0x5'));var logger=require('../../../config/logger')(_0x4e44('0x6'));var ami=require(_0x4e44('0x7'));config[_0x4e44('0x8')]=_[_0x4e44('0x9')](config['redis'],{'host':_0x4e44('0xa'),'port':0x18eb});var io=require(_0x4e44('0xb'))(new Redis(config[_0x4e44('0x8')]));function UserReport(_0x3113de){this[_0x4e44('0xc')]=_0x3113de[_0x4e44('0xc')];this[_0x4e44('0xd')]=_0x3113de[_0x4e44('0xd')];this['telephones']=_0x3113de['telephones'];ami['on'](_0x4e44('0xe'),this[_0x4e44('0xf')][_0x4e44('0x10')](this));ami['on'](_0x4e44('0x11'),this[_0x4e44('0xf')][_0x4e44('0x10')](this));ami['on'](_0x4e44('0x12'),this['syncDeviceState']['bind'](this));ami['on']('peerstatus',this[_0x4e44('0x13')][_0x4e44('0x10')](this));return this[_0x4e44('0x14')]();}function showSipRegistrations(){Promise[_0x4e44('0x15')]()[_0x4e44('0x16')](ami[_0x4e44('0x17')]())['catch'](function(_0x17352c){logger[_0x4e44('0x18')](_0x4e44('0x19'),util[_0x4e44('0x1a')](_0x17352c,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x4e44('0x15')]()[_0x4e44('0x16')](ami[_0x4e44('0x1b')]())['catch'](function(_0x5fc1ba){logger['error']('[userReport][devicestatelist]',util[_0x4e44('0x1a')](_0x5fc1ba,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x4e44('0x15')]()['then'](ami[_0x4e44('0x1c')]())[_0x4e44('0x1d')](function(_0x2bfc32){logger[_0x4e44('0x18')](_0x4e44('0x1e'),util[_0x4e44('0x1a')](_0x2bfc32,{'showHidden':![],'depth':null}));});}UserReport[_0x4e44('0x1f')][_0x4e44('0x14')]=function(){setInterval(function(){BPromise['resolve']()[_0x4e44('0x16')](showSipRegistrations())[_0x4e44('0x16')](listDeviceStates())[_0x4e44('0x16')](showPeersStatus());},0x32c8);};UserReport[_0x4e44('0x1f')][_0x4e44('0x20')]=function(_0x2a0298){return _0x2a0298!==null&&!_[_0x4e44('0x21')](_0x2a0298);};UserReport['prototype'][_0x4e44('0x22')]=function(_0x28752f,_0x54ea18,_0x632887){io['to'](_0x28752f)[_0x4e44('0x22')](_0x54ea18,_0x632887);};UserReport[_0x4e44('0x1f')]['syncRegistry']=function(_0x1c39c7){try{if(this[_0x4e44('0x20')](_0x1c39c7)){logger[_0x4e44('0x23')](_0x4e44('0x24'),_0x1c39c7[_0x4e44('0x25')],_0x1c39c7[_0x4e44('0x26')]);logger[_0x4e44('0x27')](_0x4e44('0x28'),util[_0x4e44('0x1a')](_0x1c39c7,{'showHidden':![],'depth':null}));var _0x4bf66a=_[_0x4e44('0x29')](this['trunks'],{'defaultuser':_0x1c39c7[_0x4e44('0x25')]});if(_0x4bf66a){_0x1c39c7['stateRegistry']=_0x1c39c7[_0x4e44('0x26')];_['merge'](_0x4bf66a,_[_0x4e44('0x2a')](_0x1c39c7,[_0x4e44('0x2b'),_0x4e44('0x2c'),_0x4e44('0x25'),_0x4e44('0x26')]));logger['debug'](_0x4e44('0x2d'),util[_0x4e44('0x1a')](_0x4bf66a,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x4e44('0x2e'),_0x4bf66a[_0x4e44('0x2f')]),_0x4e44('0x30'),_0x4bf66a);}}}catch(_0x47fd13){logger[_0x4e44('0x18')]('[userReport][registry]',util['inspect'](_0x47fd13,{'showHidden':![],'depth':null}));}};UserReport[_0x4e44('0x1f')][_0x4e44('0x31')]=function(_0x460200){try{if(this[_0x4e44('0x20')](_0x460200)){logger['info'](_0x4e44('0x32'),_0x460200[_0x4e44('0x33')],_0x460200[_0x4e44('0x26')]);logger[_0x4e44('0x27')]('[userReport][devicestatechange]',util[_0x4e44('0x1a')](_0x460200,{'showHidden':![],'depth':null}));if(this[_0x4e44('0xd')][_0x460200[_0x4e44('0x33')]]){if(!this[_0x4e44('0xd')][_0x460200[_0x4e44('0x33')]][_0x4e44('0x34')]||_0x460200[_0x4e44('0x26')][_0x4e44('0x35')]()==_0x4e44('0x36')){this[_0x4e44('0xd')][_0x460200[_0x4e44('0x33')]][_0x4e44('0x34')]=![];if(this[_0x4e44('0xd')][_0x460200['device']][_0x4e44('0x26')]!==_0x460200['state'][_0x4e44('0x35')]()){this['agents'][_0x460200[_0x4e44('0x33')]]['stateTime']=_[_0x4e44('0x37')](moment()['format']('x'));}this[_0x4e44('0xd')][_0x460200[_0x4e44('0x33')]][_0x4e44('0x26')]=_0x460200[_0x4e44('0x26')][_0x4e44('0x35')]();this[_0x4e44('0xd')][_0x460200[_0x4e44('0x33')]][_0x4e44('0x38')](_0x460200);}}else if(this[_0x4e44('0x39')][_0x460200[_0x4e44('0x33')]]){if(this[_0x4e44('0x39')][_0x460200[_0x4e44('0x33')]][_0x4e44('0x26')]!==_0x460200[_0x4e44('0x26')]['toLowerCase']()){this[_0x4e44('0x39')][_0x460200[_0x4e44('0x33')]]['stateTime']=_[_0x4e44('0x37')](moment()[_0x4e44('0x3a')]('x'));}this['telephones'][_0x460200['device']]['state']=_0x460200[_0x4e44('0x26')][_0x4e44('0x35')]();logger[_0x4e44('0x27')](_0x4e44('0x3b'),util['inspect'](this[_0x4e44('0x39')][_0x460200[_0x4e44('0x33')]],{'showHidden':![],'depth':null}));this[_0x4e44('0x22')](util[_0x4e44('0x3a')]('telephone:%s',this[_0x4e44('0x39')][_0x460200[_0x4e44('0x33')]][_0x4e44('0x2f')]),_0x4e44('0x3c'),this[_0x4e44('0x39')][_0x460200['device']]);}else if(this[_0x4e44('0xc')][_0x460200[_0x4e44('0x33')]]){if(this['trunks'][_0x460200[_0x4e44('0x33')]][_0x4e44('0x26')]!==_0x460200[_0x4e44('0x26')][_0x4e44('0x35')]()){this[_0x4e44('0xc')][_0x460200['device']][_0x4e44('0x3d')]=_[_0x4e44('0x37')](moment()[_0x4e44('0x3a')]('x'));}this[_0x4e44('0xc')][_0x460200[_0x4e44('0x33')]][_0x4e44('0x26')]=_0x460200[_0x4e44('0x26')][_0x4e44('0x35')]();logger[_0x4e44('0x27')](_0x4e44('0x3e'),util['inspect'](this[_0x4e44('0xc')][_0x460200[_0x4e44('0x33')]],{'showHidden':![],'depth':null}));this[_0x4e44('0x22')](util[_0x4e44('0x3a')](_0x4e44('0x2e'),this[_0x4e44('0xc')][_0x460200[_0x4e44('0x33')]]['name']),_0x4e44('0x30'),this[_0x4e44('0xc')][_0x460200[_0x4e44('0x33')]]);}else if(_[_0x4e44('0x3f')](_0x460200[_0x4e44('0x33')],_0x4e44('0x40'))){var _0x64b6d5=_0x460200[_0x4e44('0x33')];var _0xeef02a=_0x64b6d5[_0x4e44('0x41')](_0x64b6d5[_0x4e44('0x42')]('/')+0x1,_0x64b6d5[_0x4e44('0x42')]('@'));var _0x2b5dca=_[_0x4e44('0x29')](this['agents'],function(_0x45dd94){return _0x45dd94[_0x4e44('0x43')]==_0xeef02a||_0x45dd94[_0x4e44('0x44')]==_0xeef02a||_0x45dd94[_0x4e44('0x45')]==_0xeef02a;});if(_0x2b5dca){if(_0x2b5dca['state']!==_0x460200['state'][_0x4e44('0x35')]()){_0x2b5dca[_0x4e44('0x3d')]=_[_0x4e44('0x37')](moment()[_0x4e44('0x3a')]('x'));}_0x2b5dca[_0x4e44('0x26')]=_0x460200[_0x4e44('0x26')][_0x4e44('0x35')]();_0x2b5dca[_0x4e44('0x34')]=!![];_0x2b5dca[_0x4e44('0x38')](_0x460200);}}}}catch(_0x457e03){logger[_0x4e44('0x18')](_0x4e44('0x46'),util[_0x4e44('0x1a')](_0x457e03,{'showHidden':![],'depth':null}));}};UserReport[_0x4e44('0x1f')][_0x4e44('0x13')]=function(_0x4aa0e3){try{if(this[_0x4e44('0x20')](_0x4aa0e3)&&this[_0x4e44('0x20')](_0x4aa0e3['peerstatus'])){logger[_0x4e44('0x23')](_0x4e44('0x47'),_0x4aa0e3[_0x4e44('0x48')],_0x4aa0e3[_0x4e44('0x49')],_0x4aa0e3[_0x4e44('0x4a')]);logger[_0x4e44('0x27')]('[userReport][peerstatus]',util[_0x4e44('0x1a')](_0x4aa0e3,{'showHidden':![],'depth':null}));if(this[_0x4e44('0xd')][_0x4aa0e3[_0x4e44('0x48')]]){if(!this[_0x4e44('0xd')][_0x4aa0e3[_0x4e44('0x48')]]['local']||_0x4aa0e3[_0x4e44('0x4a')][_0x4e44('0x35')]()==_0x4e44('0x4b')){this[_0x4e44('0xd')][_0x4aa0e3[_0x4e44('0x48')]][_0x4e44('0x34')]=![];this[_0x4e44('0xd')][_0x4aa0e3[_0x4e44('0x48')]][_0x4e44('0x4c')]=_0x4aa0e3[_0x4e44('0x4a')][_0x4e44('0x35')]();this[_0x4e44('0xd')][_0x4aa0e3[_0x4e44('0x48')]][_0x4e44('0x49')]=_0x4aa0e3[_0x4e44('0x49')];this[_0x4e44('0xd')][_0x4aa0e3[_0x4e44('0x48')]][_0x4e44('0x38')](_0x4aa0e3);}}else if(this[_0x4e44('0x39')][_0x4aa0e3[_0x4e44('0x48')]]){this[_0x4e44('0x39')][_0x4aa0e3[_0x4e44('0x48')]][_0x4e44('0x4c')]=_0x4aa0e3['peerstatus'][_0x4e44('0x35')]();this[_0x4e44('0x39')][_0x4aa0e3[_0x4e44('0x48')]][_0x4e44('0x49')]=_0x4aa0e3[_0x4e44('0x49')];logger[_0x4e44('0x27')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x4e44('0x39')][_0x4aa0e3[_0x4e44('0x48')]],{'showHidden':![],'depth':null}));this[_0x4e44('0x22')](util[_0x4e44('0x3a')](_0x4e44('0x4d'),this[_0x4e44('0x39')][_0x4aa0e3[_0x4e44('0x48')]]['name']),_0x4e44('0x3c'),this[_0x4e44('0x39')][_0x4aa0e3['peer']]);}else if(this[_0x4e44('0xc')][_0x4aa0e3['peer']]){this[_0x4e44('0xc')][_0x4aa0e3[_0x4e44('0x48')]][_0x4e44('0x4c')]=_0x4aa0e3[_0x4e44('0x4a')][_0x4e44('0x35')]();this[_0x4e44('0xc')][_0x4aa0e3[_0x4e44('0x48')]][_0x4e44('0x49')]=_0x4aa0e3['address'];logger[_0x4e44('0x27')](_0x4e44('0x4e'),util[_0x4e44('0x1a')](this[_0x4e44('0xc')][_0x4aa0e3[_0x4e44('0x48')]],{'showHidden':![],'depth':null}));this[_0x4e44('0x22')](util[_0x4e44('0x3a')]('trunk:%s',this['trunks'][_0x4aa0e3[_0x4e44('0x48')]]['name']),'trunk:save',this['trunks'][_0x4aa0e3[_0x4e44('0x48')]]);}}}catch(_0x158e5f){logger[_0x4e44('0x18')](_0x4e44('0x4f'),util[_0x4e44('0x1a')](_0x158e5f,{'showHidden':![],'depth':null}));}};module[_0x4e44('0x50')]=UserReport;
\ No newline at end of file
index 9c54060..4bb7bc8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1b18=['acwTimeout','agentacw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','variable','value','keys','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','memberinterface','memberpenalty','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','transfer','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','substring','onhold','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','../../../config/environment','ami','redis','localhost','channels','voiceChannels','voiceQueues','agents','agentcalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','syncAgentCalled','isNotNull','info','uniqueid','debug','inspect','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','variables','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','membername','user:called','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','routealias','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime'];(function(_0x374819,_0x1e49e3){var _0x59b987=function(_0x4cc378){while(--_0x4cc378){_0x374819['push'](_0x374819['shift']());}};_0x59b987(++_0x1e49e3);}(_0x1b18,0x165));var _0x81b1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1b18[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x81b1('0x0'));var moment=require(_0x81b1('0x1'));var util=require(_0x81b1('0x2'));var Redis=require('ioredis');var config=require(_0x81b1('0x3'));var logger=require('../../../config/logger')(_0x81b1('0x4'));var ami=require('../ami');config[_0x81b1('0x5')]=_['defaults'](config[_0x81b1('0x5')],{'host':_0x81b1('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x42b3da){this[_0x81b1('0x7')]={};this[_0x81b1('0x8')]=_0x42b3da[_0x81b1('0x7')];this[_0x81b1('0x9')]=_0x42b3da[_0x81b1('0x9')];this['agents']=_0x42b3da[_0x81b1('0xa')];this['variables']={};ami['on'](_0x81b1('0xb'),this['syncAgentCalled'][_0x81b1('0xc')](this));ami['on'](_0x81b1('0xd'),this[_0x81b1('0xe')]['bind'](this));ami['on'](_0x81b1('0xf'),this[_0x81b1('0x10')][_0x81b1('0xc')](this));ami['on']('queuecallerabandon',this[_0x81b1('0x11')][_0x81b1('0xc')](this));ami['on'](_0x81b1('0x12'),this[_0x81b1('0x13')][_0x81b1('0xc')](this));ami['on']('varset',this['syncVarSet'][_0x81b1('0xc')](this));ami['on'](_0x81b1('0x14'),this[_0x81b1('0x15')][_0x81b1('0xc')](this));ami['on'](_0x81b1('0x16'),this[_0x81b1('0x17')][_0x81b1('0xc')](this));ami['on'](_0x81b1('0x18'),this['syncMusicOnHoldStop'][_0x81b1('0xc')](this));ami['on'](_0x81b1('0x19'),this['syncAttendedTransfer'][_0x81b1('0xc')](this));ami['on'](_0x81b1('0x1a'),this[_0x81b1('0x1b')]['bind'](this));}VoiceAgentReport[_0x81b1('0x1c')][_0x81b1('0x1d')]=function(_0x4f4b7c,_0x126cf1,_0x39c44a){io['to'](_0x4f4b7c)[_0x81b1('0x1d')](_0x126cf1,_0x39c44a);};VoiceAgentReport['prototype']['isNotNull']=function(_0x2bd9f3){return _0x2bd9f3!==null&&!_[_0x81b1('0x1e')](_0x2bd9f3);};VoiceAgentReport[_0x81b1('0x1c')][_0x81b1('0x1f')]=function(_0x32e9df){try{if(this[_0x81b1('0x20')](_0x32e9df)){logger[_0x81b1('0x21')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x32e9df[_0x81b1('0x22')],_0x32e9df['membername'],_0x32e9df['destuniqueid']);logger[_0x81b1('0x23')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x32e9df[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x32e9df,{'showHidden':![],'depth':null}));if(_[_0x81b1('0x1e')](this[_0x81b1('0x7')][_0x32e9df[_0x81b1('0x22')]])){this['channels'][_0x32e9df[_0x81b1('0x22')]]={};}if(_['isUndefined'](this[_0x81b1('0x7')][_0x32e9df[_0x81b1('0x22')]][_0x32e9df[_0x81b1('0x25')]])){this[_0x81b1('0x7')][_0x32e9df[_0x81b1('0x22')]][_0x32e9df[_0x81b1('0x25')]]={'agentcalledAt':moment()[_0x81b1('0x26')](_0x81b1('0x27')),'lastevent':_0x81b1('0x28'),'mandatoryDisposition':this['voiceQueues'][_0x32e9df[_0x81b1('0x29')]]?this[_0x81b1('0x9')][_0x32e9df[_0x81b1('0x29')]][_0x81b1('0x2a')]||![]:![],'type':this[_0x81b1('0x9')][_0x32e9df[_0x81b1('0x29')]]?this[_0x81b1('0x9')][_0x32e9df[_0x81b1('0x29')]][_0x81b1('0x2b')]||'inbound':_0x81b1('0x2c'),'variables':this[_0x81b1('0x2d')][_0x32e9df['uniqueid']],'motionChannel':'voice'};}_[_0x81b1('0x2e')](this[_0x81b1('0x7')][_0x32e9df[_0x81b1('0x22')]][_0x32e9df[_0x81b1('0x25')]],_[_0x81b1('0x2f')](_0x32e9df,[_0x81b1('0x30'),_0x81b1('0x31')]));logger['debug'](_0x81b1('0x32'),_0x32e9df[_0x81b1('0x22')],util['inspect'](this['channels'][_0x32e9df[_0x81b1('0x22')]][_0x32e9df[_0x81b1('0x25')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcalled',this[_0x81b1('0x7')][_0x32e9df[_0x81b1('0x22')]][_0x32e9df['destuniqueid']]);var _0xd05940={'id':this[_0x81b1('0xa')][_0x32e9df['interface']]['id'],'calleridnum':this[_0x81b1('0x7')][_0x32e9df[_0x81b1('0x22')]][_0x32e9df[_0x81b1('0x25')]][_0x81b1('0x33')],'queue':this[_0x81b1('0x7')][_0x32e9df['uniqueid']][_0x32e9df[_0x81b1('0x25')]][_0x81b1('0x29')],'variables':this[_0x81b1('0x7')][_0x32e9df[_0x81b1('0x22')]][_0x32e9df[_0x81b1('0x25')]]['variables']};logger['debug'](_0x81b1('0x34'),_0x32e9df[_0x81b1('0x22')],util[_0x81b1('0x24')](_0xd05940,{'showHidden':![],'depth':null}));this['emit'](util[_0x81b1('0x26')]('user:%s',_0x32e9df[_0x81b1('0x35')]),_0x81b1('0x36'),_0xd05940);}}catch(_0x566290){logger['error']('[%s][voiceAgentReport][agentcalled]',_0x32e9df[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x566290,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x81b1('0x1c')]['syncAgentConnect']=function(_0xfb02d5){try{if(this['isNotNull'](_0xfb02d5)){if(this[_0x81b1('0x7')][_0xfb02d5['uniqueid']]){logger[_0x81b1('0x23')](_0x81b1('0x37'),_0xfb02d5[_0x81b1('0x22')],util[_0x81b1('0x24')](_0xfb02d5,{'showHidden':![],'depth':null}));for(var _0x4c3fd2 in this[_0x81b1('0x7')][_0xfb02d5[_0x81b1('0x22')]]){if(this[_0x81b1('0x7')][_0xfb02d5['uniqueid']][_0x81b1('0x38')](_0x4c3fd2)){if(_0xfb02d5[_0x81b1('0x25')]===_0x4c3fd2){logger['info'](_0x81b1('0x39'),_0xfb02d5[_0x81b1('0x22')],_0xfb02d5[_0x81b1('0x35')],_0xfb02d5[_0x81b1('0x25')]);this[_0x81b1('0x7')][_0xfb02d5['uniqueid']][_0x4c3fd2][_0x81b1('0x3a')]=moment()[_0x81b1('0x26')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x81b1('0x7')][_0xfb02d5[_0x81b1('0x22')]][_0x4c3fd2][_0x81b1('0x3b')]=_0xfb02d5[_0x81b1('0x3b')];this['channels'][_0xfb02d5['uniqueid']][_0x4c3fd2][_0x81b1('0x3c')]=_0xfb02d5[_0x81b1('0x3c')];this['channels'][_0xfb02d5[_0x81b1('0x22')]][_0x4c3fd2][_0x81b1('0x3d')]=_0xfb02d5[_0x81b1('0x3d')];this['channels'][_0xfb02d5['uniqueid']][_0x4c3fd2]['destchannelstatedesc']=_0xfb02d5[_0x81b1('0x3e')];this[_0x81b1('0x7')][_0xfb02d5[_0x81b1('0x22')]][_0x4c3fd2][_0x81b1('0x3f')]=_0xfb02d5[_0x81b1('0x3f')];this[_0x81b1('0x7')][_0xfb02d5['uniqueid']][_0x4c3fd2][_0x81b1('0x40')]='connect';if(this[_0x81b1('0x8')][this[_0x81b1('0x7')][_0xfb02d5[_0x81b1('0x22')]][_0x4c3fd2][_0x81b1('0x22')]]){var _0x545dab=this[_0x81b1('0x8')][this[_0x81b1('0x7')][_0xfb02d5['uniqueid']][_0x4c3fd2]['uniqueid']][_0x81b1('0x41')];this[_0x81b1('0x7')][_0xfb02d5[_0x81b1('0x22')]][_0x4c3fd2][_0x81b1('0x41')]=_0x545dab;_0xfb02d5['routealias']=_0x545dab;}_['merge'](this[_0x81b1('0xa')][_0xfb02d5[_0x81b1('0x42')]],_[_0x81b1('0x43')](_0xfb02d5,['queue',_0x81b1('0x44'),_0x81b1('0x41')]));logger[_0x81b1('0x23')](_0x81b1('0x45'),_0xfb02d5[_0x81b1('0x22')],util[_0x81b1('0x24')](this[_0x81b1('0x7')][_0xfb02d5[_0x81b1('0x22')]][_0xfb02d5['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x81b1('0x1d')](_0x81b1('0x46'),this[_0x81b1('0x7')][_0xfb02d5[_0x81b1('0x22')]][_0xfb02d5[_0x81b1('0x25')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0xfb02d5[_0x81b1('0x22')],util[_0x81b1('0x24')](this[_0x81b1('0x7')][_0xfb02d5[_0x81b1('0x22')]][_0xfb02d5[_0x81b1('0x25')]],{'showHidden':![],'depth':null}));this[_0x81b1('0x1d')](util[_0x81b1('0x26')](_0x81b1('0x47'),_0xfb02d5[_0x81b1('0x35')]),_0x81b1('0x48'),this[_0x81b1('0x7')][_0xfb02d5[_0x81b1('0x22')]][_0xfb02d5['destuniqueid']]);}else if(!this['channels'][_0xfb02d5[_0x81b1('0x22')]][_0x4c3fd2][_0x81b1('0xf')]&&!this[_0x81b1('0x7')][_0xfb02d5[_0x81b1('0x22')]][_0x4c3fd2][_0x81b1('0x12')]){logger[_0x81b1('0x21')](_0x81b1('0x49'),_0xfb02d5[_0x81b1('0x22')],this[_0x81b1('0x7')][_0xfb02d5[_0x81b1('0x22')]][_0x4c3fd2][_0x81b1('0x35')],_0x4c3fd2);this[_0x81b1('0x7')][_0xfb02d5['uniqueid']][_0x4c3fd2][_0x81b1('0xf')]=!![];this[_0x81b1('0x7')][_0xfb02d5[_0x81b1('0x22')]][_0x4c3fd2][_0x81b1('0x4a')]=moment()['format'](_0x81b1('0x27'));this[_0x81b1('0x7')][_0xfb02d5[_0x81b1('0x22')]][_0x4c3fd2]['answeredelsewheredestinationuniqueid']=_0xfb02d5[_0x81b1('0x25')];this[_0x81b1('0x7')][_0xfb02d5[_0x81b1('0x22')]][_0x4c3fd2][_0x81b1('0x4b')]=_0xfb02d5['membername'];this['channels'][_0xfb02d5[_0x81b1('0x22')]][_0x4c3fd2]['lastevent']=_0x81b1('0x4c');this[_0x81b1('0x7')][_0xfb02d5['uniqueid']][_0x4c3fd2][_0x81b1('0x4d')]=_0x81b1('0x4c');logger['debug'](_0x81b1('0x4e'),_0xfb02d5[_0x81b1('0x22')],util['inspect'](this['channels'][_0xfb02d5[_0x81b1('0x22')]][_0x4c3fd2],{'showHidden':![],'depth':null}));ami[_0x81b1('0x1d')]('custom:agentansweredelsewhere',this[_0x81b1('0x7')][_0xfb02d5[_0x81b1('0x22')]][_0x4c3fd2]);}}}}}}catch(_0x58864a){logger[_0x81b1('0x4f')](_0x81b1('0x50'),_0xfb02d5[_0x81b1('0x22')],util['inspect'](_0x58864a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x81b1('0x1c')]['syncAgentRingNoAnswer']=function(_0x4ffb42){try{if(this[_0x81b1('0x20')](_0x4ffb42)){logger[_0x81b1('0x23')](_0x81b1('0x51'),_0x4ffb42[_0x81b1('0x22')],util['inspect'](_0x4ffb42,{'showHidden':![],'depth':null}));if(this['channels'][_0x4ffb42[_0x81b1('0x22')]]&&this[_0x81b1('0x7')][_0x4ffb42[_0x81b1('0x22')]][_0x4ffb42['destuniqueid']]){logger[_0x81b1('0x21')](_0x81b1('0x52'),_0x4ffb42[_0x81b1('0x22')],_0x4ffb42[_0x81b1('0x35')],_0x4ffb42[_0x81b1('0x25')]);this[_0x81b1('0x7')][_0x4ffb42['uniqueid']][_0x4ffb42[_0x81b1('0x25')]][_0x81b1('0xf')]=!![];this[_0x81b1('0x7')][_0x4ffb42[_0x81b1('0x22')]][_0x4ffb42[_0x81b1('0x25')]][_0x81b1('0x4a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x81b1('0x7')][_0x4ffb42[_0x81b1('0x22')]][_0x4ffb42[_0x81b1('0x25')]][_0x81b1('0x40')]=_0x81b1('0x53');this[_0x81b1('0x7')][_0x4ffb42[_0x81b1('0x22')]][_0x4ffb42[_0x81b1('0x25')]]['reason']=_0x81b1('0x53');logger[_0x81b1('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x4ffb42[_0x81b1('0x22')],util[_0x81b1('0x24')](this[_0x81b1('0x7')][_0x4ffb42[_0x81b1('0x22')]][_0x4ffb42[_0x81b1('0x25')]],{'showHidden':![],'depth':null}));ami[_0x81b1('0x1d')](_0x81b1('0x54'),this[_0x81b1('0x7')][_0x4ffb42['uniqueid']][_0x4ffb42['destuniqueid']]);}}}catch(_0x241182){logger[_0x81b1('0x4f')](_0x81b1('0x55'),_0x4ffb42['uniqueid'],util['inspect'](_0x241182,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x81b1('0x1c')]['syncQueueCallerAbandon']=function(_0x3d25b0){try{if(this['isNotNull'](_0x3d25b0)){logger[_0x81b1('0x23')](_0x81b1('0x56'),_0x3d25b0[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x3d25b0,{'showHidden':![],'depth':null}));if(this['channels'][_0x3d25b0[_0x81b1('0x22')]]){for(var _0x407a24 in this[_0x81b1('0x7')][_0x3d25b0[_0x81b1('0x22')]]){if(this[_0x81b1('0x7')][_0x3d25b0[_0x81b1('0x22')]][_0x81b1('0x38')](_0x407a24)&&!this[_0x81b1('0x7')][_0x3d25b0[_0x81b1('0x22')]][_0x407a24]['agentringnoanswer']&&!this[_0x81b1('0x7')][_0x3d25b0[_0x81b1('0x22')]][_0x407a24][_0x81b1('0x12')]){logger[_0x81b1('0x21')](_0x81b1('0x57'),_0x3d25b0[_0x81b1('0x22')],this[_0x81b1('0x7')][_0x3d25b0[_0x81b1('0x22')]][_0x407a24][_0x81b1('0x35')],_0x407a24);this[_0x81b1('0x7')][_0x3d25b0[_0x81b1('0x22')]][_0x407a24][_0x81b1('0xf')]=!![];this[_0x81b1('0x7')][_0x3d25b0[_0x81b1('0x22')]][_0x407a24][_0x81b1('0x4a')]=moment()[_0x81b1('0x26')](_0x81b1('0x27'));this[_0x81b1('0x7')][_0x3d25b0[_0x81b1('0x22')]][_0x407a24][_0x81b1('0x40')]=_0x81b1('0x58');this[_0x81b1('0x7')][_0x3d25b0[_0x81b1('0x22')]][_0x407a24][_0x81b1('0x4d')]='abandoned';logger[_0x81b1('0x23')](_0x81b1('0x59'),_0x3d25b0[_0x81b1('0x22')],util[_0x81b1('0x24')](this['channels'][_0x3d25b0['uniqueid']][_0x407a24],{'showHidden':![],'depth':null}));ami[_0x81b1('0x1d')](_0x81b1('0x5a'),this['channels'][_0x3d25b0[_0x81b1('0x22')]][_0x407a24]);}}}}}catch(_0x5eb785){logger[_0x81b1('0x4f')](_0x81b1('0x5b'),_0x3d25b0[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x5eb785,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x81b1('0x1c')][_0x81b1('0x13')]=function(_0x5a9a4a){try{if(this[_0x81b1('0x20')](_0x5a9a4a)){logger[_0x81b1('0x23')](_0x81b1('0x5c'),_0x5a9a4a[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x5a9a4a,{'showHidden':![],'depth':null}));if(this[_0x81b1('0x7')][_0x5a9a4a[_0x81b1('0x22')]]){for(var _0x46c83d in this[_0x81b1('0x7')][_0x5a9a4a[_0x81b1('0x22')]]){if(this[_0x81b1('0x7')][_0x5a9a4a[_0x81b1('0x22')]][_0x81b1('0x38')](_0x46c83d)){if(this[_0x81b1('0x7')][_0x5a9a4a[_0x81b1('0x22')]][_0x46c83d]['agentconnectAt']&&!this[_0x81b1('0x7')][_0x5a9a4a[_0x81b1('0x22')]][_0x46c83d][_0x81b1('0x12')]){logger[_0x81b1('0x21')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5a9a4a['uniqueid'],this['channels'][_0x5a9a4a[_0x81b1('0x22')]][_0x46c83d]['membername'],_0x46c83d);this['channels'][_0x5a9a4a[_0x81b1('0x22')]][_0x46c83d]['agentcomplete']=!![];this[_0x81b1('0x7')][_0x5a9a4a[_0x81b1('0x22')]][_0x46c83d][_0x81b1('0x5d')]=moment()['format'](_0x81b1('0x27'));this[_0x81b1('0x7')][_0x5a9a4a['uniqueid']][_0x46c83d][_0x81b1('0x40')]=_0x81b1('0x5e');this['channels'][_0x5a9a4a['uniqueid']][_0x46c83d][_0x81b1('0x4d')]=_0x5a9a4a['reason']=='transfer'?_0x81b1('0x5f'):_0x5a9a4a[_0x81b1('0x4d')];this[_0x81b1('0x7')][_0x5a9a4a[_0x81b1('0x22')]][_0x46c83d][_0x81b1('0x60')]=_0x5a9a4a[_0x81b1('0x60')];if(this[_0x81b1('0x9')][_0x5a9a4a[_0x81b1('0x29')]]&&this[_0x81b1('0x9')][_0x5a9a4a['queue']][_0x81b1('0x61')]){this[_0x81b1('0x7')][_0x5a9a4a[_0x81b1('0x22')]][_0x46c83d][_0x81b1('0x62')]=this[_0x81b1('0x9')][_0x5a9a4a[_0x81b1('0x29')]][_0x81b1('0x63')];this[_0x81b1('0x7')][_0x5a9a4a[_0x81b1('0x22')]][_0x46c83d][_0x81b1('0x64')]=!![];}this['agents'][_0x5a9a4a[_0x81b1('0x42')]]=_[_0x81b1('0x2f')](this[_0x81b1('0xa')][_0x5a9a4a[_0x81b1('0x42')]],[_0x81b1('0x29'),_0x81b1('0x44')]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x5a9a4a['uniqueid'],util[_0x81b1('0x24')](this[_0x81b1('0x7')][_0x5a9a4a['uniqueid']][_0x46c83d],{'showHidden':![],'depth':null}));ami[_0x81b1('0x1d')](_0x81b1('0x65'),this['channels'][_0x5a9a4a[_0x81b1('0x22')]][_0x46c83d]);logger[_0x81b1('0x23')](_0x81b1('0x66'),_0x5a9a4a[_0x81b1('0x22')],util[_0x81b1('0x24')]({'id':this[_0x81b1('0xa')][_0x5a9a4a[_0x81b1('0x42')]]['id'],'destaccountcode':_0x5a9a4a[_0x81b1('0x67')]},{'showHidden':![],'depth':null}));this[_0x81b1('0x1d')](util[_0x81b1('0x26')](_0x81b1('0x47'),_0x5a9a4a['membername']),_0x81b1('0x68'),{'id':this['agents'][_0x5a9a4a[_0x81b1('0x42')]]['id'],'destaccountcode':_0x5a9a4a[_0x81b1('0x67')]});}}}}}}catch(_0x52a952){logger[_0x81b1('0x4f')](_0x81b1('0x69'),_0x5a9a4a[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x52a952,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x81b1('0x1c')][_0x81b1('0x6a')]=function(_0x18b5d1){try{if(this[_0x81b1('0x20')](_0x18b5d1)){logger[_0x81b1('0x23')](_0x81b1('0x6b'),_0x18b5d1[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x18b5d1,{'showHidden':![],'depth':null}));this[_0x81b1('0x6c')](_0x18b5d1['uniqueid'],_['keys'](_0x18b5d1[_0x81b1('0x6d')])[0x0],_0x18b5d1[_0x81b1('0x6e')]);if(this[_0x81b1('0x7')][_0x18b5d1['uniqueid']]){for(var _0x4f31c7 in this[_0x81b1('0x7')][_0x18b5d1[_0x81b1('0x22')]]){if(this['channels'][_0x18b5d1[_0x81b1('0x22')]][_0x81b1('0x38')](_0x4f31c7)){logger[_0x81b1('0x21')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x18b5d1[_0x81b1('0x22')],_0x4f31c7,_[_0x81b1('0x6f')](_0x18b5d1[_0x81b1('0x6d')])[0x0],_0x18b5d1[_0x81b1('0x6e')]);if(_[_0x81b1('0x1e')](this['channels'][_0x18b5d1[_0x81b1('0x22')]][_0x4f31c7]['variables'])){this[_0x81b1('0x7')][_0x18b5d1['uniqueid']][_0x4f31c7][_0x81b1('0x2d')]={};}this[_0x81b1('0x7')][_0x18b5d1[_0x81b1('0x22')]][_0x4f31c7][_0x81b1('0x2d')]=this['variables'][_0x18b5d1[_0x81b1('0x22')]];}}}}}catch(_0x383aea){logger['error'](_0x81b1('0x70'),_0x18b5d1[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x383aea,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x81b1('0x1c')][_0x81b1('0x6c')]=function(_0x5ef9ac,_0x57ce8e,_0x180dbf){var _0x5de7f0=[_0x81b1('0x71'),_0x81b1('0x72'),_0x81b1('0x73'),'rtpaudioqosjitterbridged',_0x81b1('0x74'),'rtpaudioqoslossbridged',_0x81b1('0x75'),'rtpaudioqosrttbridged',_0x81b1('0x76'),_0x81b1('0x77'),_0x81b1('0x78'),'bridgepvtcallid','membercalls','memberdynamic',_0x81b1('0x79'),'memberlastcall',_0x81b1('0x35'),_0x81b1('0x7a'),_0x81b1('0x7b')];if(!_[_0x81b1('0x7c')](_0x57ce8e)&&!_['includes'](_0x5de7f0,_0x57ce8e)){if(_[_0x81b1('0x1e')](this[_0x81b1('0x2d')][_0x5ef9ac])){this[_0x81b1('0x2d')][_0x5ef9ac]={};}this[_0x81b1('0x2d')][_0x5ef9ac][_0x57ce8e]=_0x180dbf;}};VoiceAgentReport[_0x81b1('0x1c')]['syncHangup']=function(_0x264c69){try{if(this['isNotNull'](_0x264c69)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x264c69[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x264c69,{'showHidden':![],'depth':null}));if(this['channels'][_0x264c69[_0x81b1('0x22')]]){for(var _0x3db965 in this[_0x81b1('0x7')][_0x264c69[_0x81b1('0x22')]]){if(this[_0x81b1('0x7')][_0x264c69[_0x81b1('0x22')]]['hasOwnProperty'](_0x3db965)){if(this[_0x81b1('0x7')][_0x264c69[_0x81b1('0x22')]][_0x3db965][_0x81b1('0x4d')]=='transfer'&&this[_0x81b1('0x7')][_0x264c69['uniqueid']][_0x3db965]['agentcomplete']){logger['info'](_0x81b1('0x7d'),_0x264c69[_0x81b1('0x22')],_0x3db965);this[_0x81b1('0x7')][_0x264c69[_0x81b1('0x22')]][_0x3db965][_0x81b1('0x5d')]=moment()[_0x81b1('0x26')](_0x81b1('0x27'));}}}logger['debug'](_0x81b1('0x7e'),_0x264c69['uniqueid'],util[_0x81b1('0x24')](_[_0x81b1('0x7f')](this[_0x81b1('0x7')][_0x264c69[_0x81b1('0x22')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x81b1('0x80'),_[_0x81b1('0x7f')](this[_0x81b1('0x7')][_0x264c69['uniqueid']]));delete this[_0x81b1('0x7')][_0x264c69[_0x81b1('0x22')]];}if(this[_0x81b1('0x2d')][_0x264c69[_0x81b1('0x22')]]){delete this[_0x81b1('0x2d')][_0x264c69[_0x81b1('0x22')]];}}}catch(_0x3568cd){logger[_0x81b1('0x4f')](_0x81b1('0x81'),_0x264c69[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x3568cd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x81b1('0x1c')][_0x81b1('0x82')]=function(_0xa3442e){try{if(this['isNotNull'](_0xa3442e)){logger[_0x81b1('0x23')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0xa3442e[_0x81b1('0x22')],util[_0x81b1('0x24')](_0xa3442e,{'showHidden':![],'depth':null}));if(this[_0x81b1('0x7')][_0xa3442e[_0x81b1('0x83')]]){for(var _0x2b43fc in this[_0x81b1('0x7')][_0xa3442e['transfereeuniqueid']]){if(this[_0x81b1('0x7')][_0xa3442e[_0x81b1('0x83')]]['hasOwnProperty'](_0x2b43fc)){if(_0xa3442e[_0x81b1('0x84')]===_0x2b43fc){logger[_0x81b1('0x21')](_0x81b1('0x85'),_0xa3442e[_0x81b1('0x22')],this[_0x81b1('0x7')][_0xa3442e['transfereeuniqueid']][_0x2b43fc][_0x81b1('0x35')],_0x2b43fc);var _0x8ae2da=moment();this[_0x81b1('0x7')][_0xa3442e[_0x81b1('0x83')]][_0x2b43fc][_0x81b1('0x12')]=!![];this['channels'][_0xa3442e[_0x81b1('0x83')]][_0x2b43fc][_0x81b1('0x5d')]=moment()[_0x81b1('0x26')](_0x81b1('0x27'));this['channels'][_0xa3442e[_0x81b1('0x83')]][_0x2b43fc]['lastevent']=_0x81b1('0x5e');this[_0x81b1('0x7')][_0xa3442e[_0x81b1('0x83')]][_0x2b43fc][_0x81b1('0x4d')]=_0x81b1('0x86');this[_0x81b1('0x7')][_0xa3442e['transfereeuniqueid']][_0x2b43fc]['talktime']=_0x8ae2da[_0x81b1('0x87')](this['channels'][_0xa3442e['transfereeuniqueid']][_0x2b43fc][_0x81b1('0x3a')],_0x81b1('0x88'));}}}}if(this['channels'][_0xa3442e[_0x81b1('0x89')]]){var _0x56510f=this[_0x81b1('0x7')][_0xa3442e[_0x81b1('0x89')]];this[_0x81b1('0x7')][_0xa3442e[_0x81b1('0x89')]]=this['channels'][_0xa3442e[_0x81b1('0x83')]];this[_0x81b1('0x7')][_0xa3442e[_0x81b1('0x83')]]=_0x56510f;}}}catch(_0x443dc8){logger[_0x81b1('0x4f')](_0x81b1('0x8a'),_0xa3442e[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x443dc8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x81b1('0x1c')][_0x81b1('0x1b')]=function(_0x5ddc23){try{if(this[_0x81b1('0x20')](_0x5ddc23)){logger['debug'](_0x81b1('0x8b'),_0x5ddc23[_0x81b1('0x22')],util['inspect'](_0x5ddc23,{'showHidden':![],'depth':null}));if(this[_0x81b1('0x7')][_0x5ddc23[_0x81b1('0x83')]]){for(var _0x385883 in this['channels'][_0x5ddc23[_0x81b1('0x83')]]){if(this['channels'][_0x5ddc23['transfereeuniqueid']][_0x81b1('0x38')](_0x385883)){if(_0x5ddc23[_0x81b1('0x8c')]===_0x385883){logger['info'](_0x81b1('0x8d'),_0x5ddc23[_0x81b1('0x22')],this[_0x81b1('0x7')][_0x5ddc23['transfereeuniqueid']][_0x385883][_0x81b1('0x35')],_0x385883);var _0x453306=moment();this[_0x81b1('0x7')][_0x5ddc23[_0x81b1('0x83')]][_0x385883][_0x81b1('0x12')]=!![];this[_0x81b1('0x7')][_0x5ddc23[_0x81b1('0x83')]][_0x385883][_0x81b1('0x5d')]=_0x453306;this['channels'][_0x5ddc23[_0x81b1('0x83')]][_0x385883][_0x81b1('0x40')]='complete';this[_0x81b1('0x7')][_0x5ddc23[_0x81b1('0x83')]][_0x385883][_0x81b1('0x4d')]='transfer';this[_0x81b1('0x7')][_0x5ddc23['transfereeuniqueid']][_0x385883][_0x81b1('0x60')]=_0x453306[_0x81b1('0x87')](this[_0x81b1('0x7')][_0x5ddc23['transfereeuniqueid']][_0x385883][_0x81b1('0x3a')],_0x81b1('0x88'));}}}}}}catch(_0x5699a6){logger[_0x81b1('0x4f')](_0x81b1('0x8e'),_0x5ddc23[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x5699a6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x81b1('0x1c')][_0x81b1('0x17')]=function(_0x5f4346){var _0x2f3cb6='';try{if(this['isNotNull'](_0x5f4346)){logger[_0x81b1('0x23')](_0x81b1('0x8f'),_0x5f4346[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x5f4346,{'showHidden':![],'depth':null}));if(_0x5f4346[_0x81b1('0x90')]){_0x2f3cb6=_0x5f4346[_0x81b1('0x90')]['substring'](0x0,_0x5f4346[_0x81b1('0x90')][_0x81b1('0x91')]('-'));if(this[_0x81b1('0xa')][_0x2f3cb6]){logger[_0x81b1('0x21')](_0x81b1('0x92'),_0x5f4346['uniqueid'],_0x2f3cb6);this['agents'][_0x2f3cb6]['onhold']=!![];}}}}catch(_0x5e830d){logger[_0x81b1('0x4f')](_0x81b1('0x93'),_0x5f4346[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x5e830d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0x4f35c6){var _0x45d0a4='';try{if(this[_0x81b1('0x20')](_0x4f35c6)){logger[_0x81b1('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x4f35c6[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x4f35c6,{'showHidden':![],'depth':null}));if(_0x4f35c6[_0x81b1('0x90')]){_0x45d0a4=_0x4f35c6[_0x81b1('0x90')][_0x81b1('0x94')](0x0,_0x4f35c6[_0x81b1('0x90')][_0x81b1('0x91')]('-'));if(this[_0x81b1('0xa')][_0x45d0a4]){logger['info']('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x4f35c6['uniqueid'],_0x45d0a4);this[_0x81b1('0xa')][_0x45d0a4][_0x81b1('0x95')]=![];}}}}catch(_0x28f56d){logger['error'](_0x81b1('0x96'),_0x4f35c6[_0x81b1('0x22')],util[_0x81b1('0x24')](_0x28f56d,{'showHidden':![],'depth':null}));}};module[_0x81b1('0x97')]=VoiceAgentReport;
\ No newline at end of file
+var _0xfb17=['[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipuri','bridgepeer','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','onhold','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','prototype','emit','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','debug','uniqueid','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','agentconnectAt','connectedlinename','connectedlinenum','destchannelstatedesc','holdtime','lastevent','connect','voiceChannels','routealias','pick','destconnectedlinenum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xfb17,0xd8));var _0x7fb1=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfb17[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x7fb1('0x0'));var moment=require(_0x7fb1('0x1'));var util=require(_0x7fb1('0x2'));var Redis=require(_0x7fb1('0x3'));var config=require(_0x7fb1('0x4'));var logger=require(_0x7fb1('0x5'))('ami');var ami=require(_0x7fb1('0x6'));config[_0x7fb1('0x7')]=_[_0x7fb1('0x8')](config[_0x7fb1('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x7fb1('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x4bfcbc){this[_0x7fb1('0xa')]={};this['voiceChannels']=_0x4bfcbc[_0x7fb1('0xa')];this[_0x7fb1('0xb')]=_0x4bfcbc[_0x7fb1('0xb')];this[_0x7fb1('0xc')]=_0x4bfcbc[_0x7fb1('0xc')];this[_0x7fb1('0xd')]={};ami['on'](_0x7fb1('0xe'),this[_0x7fb1('0xf')][_0x7fb1('0x10')](this));ami['on'](_0x7fb1('0x11'),this['syncAgentConnect'][_0x7fb1('0x10')](this));ami['on'](_0x7fb1('0x12'),this[_0x7fb1('0x13')]['bind'](this));ami['on']('queuecallerabandon',this[_0x7fb1('0x14')]['bind'](this));ami['on'](_0x7fb1('0x15'),this[_0x7fb1('0x16')][_0x7fb1('0x10')](this));ami['on']('varset',this[_0x7fb1('0x17')][_0x7fb1('0x10')](this));ami['on'](_0x7fb1('0x18'),this[_0x7fb1('0x19')][_0x7fb1('0x10')](this));ami['on'](_0x7fb1('0x1a'),this['syncMusicOnHoldStart'][_0x7fb1('0x10')](this));ami['on'](_0x7fb1('0x1b'),this[_0x7fb1('0x1c')][_0x7fb1('0x10')](this));ami['on'](_0x7fb1('0x1d'),this[_0x7fb1('0x1e')][_0x7fb1('0x10')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x7fb1('0x10')](this));}VoiceAgentReport[_0x7fb1('0x1f')][_0x7fb1('0x20')]=function(_0x2cc95e,_0x12ef7f,_0x376699){io['to'](_0x2cc95e)[_0x7fb1('0x20')](_0x12ef7f,_0x376699);};VoiceAgentReport[_0x7fb1('0x1f')][_0x7fb1('0x21')]=function(_0x276199){return _0x276199!==null&&!_[_0x7fb1('0x22')](_0x276199);};VoiceAgentReport['prototype'][_0x7fb1('0xf')]=function(_0x4c5206){try{if(this[_0x7fb1('0x21')](_0x4c5206)){logger['info'](_0x7fb1('0x23'),_0x4c5206['uniqueid'],_0x4c5206[_0x7fb1('0x24')],_0x4c5206[_0x7fb1('0x25')]);logger[_0x7fb1('0x26')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x4c5206[_0x7fb1('0x27')],util[_0x7fb1('0x28')](_0x4c5206,{'showHidden':![],'depth':null}));if(_[_0x7fb1('0x22')](this[_0x7fb1('0xa')][_0x4c5206[_0x7fb1('0x27')]])){this[_0x7fb1('0xa')][_0x4c5206['uniqueid']]={};}if(_[_0x7fb1('0x22')](this[_0x7fb1('0xa')][_0x4c5206[_0x7fb1('0x27')]][_0x4c5206[_0x7fb1('0x25')]])){this[_0x7fb1('0xa')][_0x4c5206[_0x7fb1('0x27')]][_0x4c5206[_0x7fb1('0x25')]]={'agentcalledAt':moment()[_0x7fb1('0x29')](_0x7fb1('0x2a')),'lastevent':_0x7fb1('0x2b'),'mandatoryDisposition':this[_0x7fb1('0xb')][_0x4c5206[_0x7fb1('0x2c')]]?this[_0x7fb1('0xb')][_0x4c5206[_0x7fb1('0x2c')]][_0x7fb1('0x2d')]||![]:![],'type':this[_0x7fb1('0xb')][_0x4c5206[_0x7fb1('0x2c')]]?this[_0x7fb1('0xb')][_0x4c5206[_0x7fb1('0x2c')]][_0x7fb1('0x2e')]||'inbound':'inbound','variables':this[_0x7fb1('0xd')][_0x4c5206[_0x7fb1('0x27')]],'motionChannel':'voice'};}_[_0x7fb1('0x2f')](this['channels'][_0x4c5206[_0x7fb1('0x27')]][_0x4c5206['destuniqueid']],_[_0x7fb1('0x30')](_0x4c5206,[_0x7fb1('0x31'),_0x7fb1('0x32')]));logger['debug'](_0x7fb1('0x33'),_0x4c5206[_0x7fb1('0x27')],util[_0x7fb1('0x28')](this[_0x7fb1('0xa')][_0x4c5206[_0x7fb1('0x27')]][_0x4c5206['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x7fb1('0x20')](_0x7fb1('0x34'),this['channels'][_0x4c5206['uniqueid']][_0x4c5206[_0x7fb1('0x25')]]);var _0x53a12d={'id':this[_0x7fb1('0xc')][_0x4c5206[_0x7fb1('0x35')]]['id'],'calleridnum':this['channels'][_0x4c5206[_0x7fb1('0x27')]][_0x4c5206['destuniqueid']][_0x7fb1('0x36')],'queue':this[_0x7fb1('0xa')][_0x4c5206['uniqueid']][_0x4c5206[_0x7fb1('0x25')]]['queue'],'variables':this[_0x7fb1('0xa')][_0x4c5206[_0x7fb1('0x27')]][_0x4c5206['destuniqueid']][_0x7fb1('0xd')]};logger[_0x7fb1('0x26')](_0x7fb1('0x37'),_0x4c5206[_0x7fb1('0x27')],util['inspect'](_0x53a12d,{'showHidden':![],'depth':null}));this[_0x7fb1('0x20')](util['format'](_0x7fb1('0x38'),_0x4c5206[_0x7fb1('0x24')]),_0x7fb1('0x39'),_0x53a12d);}}catch(_0x481717){logger[_0x7fb1('0x3a')](_0x7fb1('0x3b'),_0x4c5206[_0x7fb1('0x27')],util['inspect'](_0x481717,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7fb1('0x1f')][_0x7fb1('0x3c')]=function(_0x43afbc){try{if(this[_0x7fb1('0x21')](_0x43afbc)){if(this[_0x7fb1('0xa')][_0x43afbc['uniqueid']]){logger[_0x7fb1('0x26')](_0x7fb1('0x3d'),_0x43afbc['uniqueid'],util[_0x7fb1('0x28')](_0x43afbc,{'showHidden':![],'depth':null}));for(var _0x2905ad in this[_0x7fb1('0xa')][_0x43afbc['uniqueid']]){if(this[_0x7fb1('0xa')][_0x43afbc['uniqueid']]['hasOwnProperty'](_0x2905ad)){if(_0x43afbc[_0x7fb1('0x25')]===_0x2905ad){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x43afbc[_0x7fb1('0x27')],_0x43afbc['membername'],_0x43afbc[_0x7fb1('0x25')]);this[_0x7fb1('0xa')][_0x43afbc['uniqueid']][_0x2905ad][_0x7fb1('0x3e')]=moment()[_0x7fb1('0x29')](_0x7fb1('0x2a'));this[_0x7fb1('0xa')][_0x43afbc[_0x7fb1('0x27')]][_0x2905ad]['connectedlinename']=_0x43afbc[_0x7fb1('0x3f')];this['channels'][_0x43afbc['uniqueid']][_0x2905ad]['connectedlinenum']=_0x43afbc[_0x7fb1('0x40')];this[_0x7fb1('0xa')][_0x43afbc[_0x7fb1('0x27')]][_0x2905ad]['destchannelstate']=_0x43afbc['destchannelstate'];this[_0x7fb1('0xa')][_0x43afbc[_0x7fb1('0x27')]][_0x2905ad][_0x7fb1('0x41')]=_0x43afbc['destchannelstatedesc'];this[_0x7fb1('0xa')][_0x43afbc[_0x7fb1('0x27')]][_0x2905ad][_0x7fb1('0x42')]=_0x43afbc['holdtime'];this[_0x7fb1('0xa')][_0x43afbc[_0x7fb1('0x27')]][_0x2905ad][_0x7fb1('0x43')]=_0x7fb1('0x44');if(this['voiceChannels'][this[_0x7fb1('0xa')][_0x43afbc[_0x7fb1('0x27')]][_0x2905ad][_0x7fb1('0x27')]]){var _0x50e856=this[_0x7fb1('0x45')][this['channels'][_0x43afbc[_0x7fb1('0x27')]][_0x2905ad]['uniqueid']][_0x7fb1('0x46')];this[_0x7fb1('0xa')][_0x43afbc[_0x7fb1('0x27')]][_0x2905ad][_0x7fb1('0x46')]=_0x50e856;_0x43afbc[_0x7fb1('0x46')]=_0x50e856;}_[_0x7fb1('0x2f')](this[_0x7fb1('0xc')][_0x43afbc[_0x7fb1('0x35')]],_[_0x7fb1('0x47')](_0x43afbc,[_0x7fb1('0x2c'),_0x7fb1('0x48'),'routealias']));logger[_0x7fb1('0x26')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x43afbc[_0x7fb1('0x27')],util[_0x7fb1('0x28')](this['channels'][_0x43afbc[_0x7fb1('0x27')]][_0x43afbc['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x7fb1('0x20')]('custom:agentconnect',this[_0x7fb1('0xa')][_0x43afbc['uniqueid']][_0x43afbc[_0x7fb1('0x25')]]);logger['debug'](_0x7fb1('0x49'),_0x43afbc['uniqueid'],util[_0x7fb1('0x28')](this['channels'][_0x43afbc[_0x7fb1('0x27')]][_0x43afbc[_0x7fb1('0x25')]],{'showHidden':![],'depth':null}));this[_0x7fb1('0x20')](util[_0x7fb1('0x29')]('user:%s',_0x43afbc['membername']),'user:agentconnect',this['channels'][_0x43afbc[_0x7fb1('0x27')]][_0x43afbc['destuniqueid']]);}else if(!this[_0x7fb1('0xa')][_0x43afbc['uniqueid']][_0x2905ad][_0x7fb1('0x12')]&&!this[_0x7fb1('0xa')][_0x43afbc['uniqueid']][_0x2905ad][_0x7fb1('0x15')]){logger[_0x7fb1('0x4a')](_0x7fb1('0x4b'),_0x43afbc[_0x7fb1('0x27')],this[_0x7fb1('0xa')][_0x43afbc[_0x7fb1('0x27')]][_0x2905ad]['membername'],_0x2905ad);this[_0x7fb1('0xa')][_0x43afbc[_0x7fb1('0x27')]][_0x2905ad]['agentringnoanswer']=!![];this[_0x7fb1('0xa')][_0x43afbc['uniqueid']][_0x2905ad][_0x7fb1('0x4c')]=moment()[_0x7fb1('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7fb1('0xa')][_0x43afbc[_0x7fb1('0x27')]][_0x2905ad]['answeredelsewheredestinationuniqueid']=_0x43afbc[_0x7fb1('0x25')];this['channels'][_0x43afbc[_0x7fb1('0x27')]][_0x2905ad][_0x7fb1('0x4d')]=_0x43afbc[_0x7fb1('0x24')];this[_0x7fb1('0xa')][_0x43afbc[_0x7fb1('0x27')]][_0x2905ad][_0x7fb1('0x43')]=_0x7fb1('0x4e');this[_0x7fb1('0xa')][_0x43afbc['uniqueid']][_0x2905ad][_0x7fb1('0x4f')]=_0x7fb1('0x4e');logger['debug'](_0x7fb1('0x50'),_0x43afbc[_0x7fb1('0x27')],util['inspect'](this[_0x7fb1('0xa')][_0x43afbc['uniqueid']][_0x2905ad],{'showHidden':![],'depth':null}));ami[_0x7fb1('0x20')]('custom:agentansweredelsewhere',this['channels'][_0x43afbc[_0x7fb1('0x27')]][_0x2905ad]);}}}}}}catch(_0x24abbc){logger[_0x7fb1('0x3a')](_0x7fb1('0x51'),_0x43afbc[_0x7fb1('0x27')],util['inspect'](_0x24abbc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7fb1('0x1f')][_0x7fb1('0x13')]=function(_0x7f5033){try{if(this[_0x7fb1('0x21')](_0x7f5033)){logger[_0x7fb1('0x26')](_0x7fb1('0x52'),_0x7f5033[_0x7fb1('0x27')],util[_0x7fb1('0x28')](_0x7f5033,{'showHidden':![],'depth':null}));if(this[_0x7fb1('0xa')][_0x7f5033[_0x7fb1('0x27')]]&&this['channels'][_0x7f5033['uniqueid']][_0x7f5033[_0x7fb1('0x25')]]){logger[_0x7fb1('0x4a')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x7f5033['uniqueid'],_0x7f5033[_0x7fb1('0x24')],_0x7f5033[_0x7fb1('0x25')]);this['channels'][_0x7f5033['uniqueid']][_0x7f5033[_0x7fb1('0x25')]][_0x7fb1('0x12')]=!![];this['channels'][_0x7f5033[_0x7fb1('0x27')]][_0x7f5033['destuniqueid']]['agentringnoanswerAt']=moment()[_0x7fb1('0x29')](_0x7fb1('0x2a'));this[_0x7fb1('0xa')][_0x7f5033[_0x7fb1('0x27')]][_0x7f5033['destuniqueid']][_0x7fb1('0x43')]=_0x7fb1('0x53');this[_0x7fb1('0xa')][_0x7f5033[_0x7fb1('0x27')]][_0x7f5033[_0x7fb1('0x25')]][_0x7fb1('0x4f')]=_0x7fb1('0x53');logger[_0x7fb1('0x26')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x7f5033[_0x7fb1('0x27')],util[_0x7fb1('0x28')](this[_0x7fb1('0xa')][_0x7f5033[_0x7fb1('0x27')]][_0x7f5033['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x7fb1('0x20')]('custom:agentringnoanswer',this['channels'][_0x7f5033[_0x7fb1('0x27')]][_0x7f5033[_0x7fb1('0x25')]]);}}}catch(_0x4ed505){logger['error'](_0x7fb1('0x54'),_0x7f5033[_0x7fb1('0x27')],util[_0x7fb1('0x28')](_0x4ed505,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7fb1('0x1f')]['syncQueueCallerAbandon']=function(_0x22e16d){try{if(this[_0x7fb1('0x21')](_0x22e16d)){logger['debug'](_0x7fb1('0x55'),_0x22e16d[_0x7fb1('0x27')],util[_0x7fb1('0x28')](_0x22e16d,{'showHidden':![],'depth':null}));if(this[_0x7fb1('0xa')][_0x22e16d[_0x7fb1('0x27')]]){for(var _0x681bae in this['channels'][_0x22e16d[_0x7fb1('0x27')]]){if(this[_0x7fb1('0xa')][_0x22e16d[_0x7fb1('0x27')]][_0x7fb1('0x56')](_0x681bae)&&!this[_0x7fb1('0xa')][_0x22e16d[_0x7fb1('0x27')]][_0x681bae][_0x7fb1('0x12')]&&!this[_0x7fb1('0xa')][_0x22e16d[_0x7fb1('0x27')]][_0x681bae][_0x7fb1('0x15')]){logger[_0x7fb1('0x4a')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x22e16d[_0x7fb1('0x27')],this['channels'][_0x22e16d['uniqueid']][_0x681bae][_0x7fb1('0x24')],_0x681bae);this['channels'][_0x22e16d[_0x7fb1('0x27')]][_0x681bae][_0x7fb1('0x12')]=!![];this[_0x7fb1('0xa')][_0x22e16d[_0x7fb1('0x27')]][_0x681bae][_0x7fb1('0x4c')]=moment()[_0x7fb1('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7fb1('0xa')][_0x22e16d[_0x7fb1('0x27')]][_0x681bae]['lastevent']=_0x7fb1('0x57');this[_0x7fb1('0xa')][_0x22e16d[_0x7fb1('0x27')]][_0x681bae][_0x7fb1('0x4f')]=_0x7fb1('0x57');logger[_0x7fb1('0x26')](_0x7fb1('0x58'),_0x22e16d[_0x7fb1('0x27')],util['inspect'](this[_0x7fb1('0xa')][_0x22e16d[_0x7fb1('0x27')]][_0x681bae],{'showHidden':![],'depth':null}));ami[_0x7fb1('0x20')](_0x7fb1('0x59'),this['channels'][_0x22e16d['uniqueid']][_0x681bae]);}}}}}catch(_0x4bc2bb){logger[_0x7fb1('0x3a')](_0x7fb1('0x5a'),_0x22e16d['uniqueid'],util[_0x7fb1('0x28')](_0x4bc2bb,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7fb1('0x16')]=function(_0x429584){try{if(this[_0x7fb1('0x21')](_0x429584)){logger['debug'](_0x7fb1('0x5b'),_0x429584[_0x7fb1('0x27')],util[_0x7fb1('0x28')](_0x429584,{'showHidden':![],'depth':null}));if(this[_0x7fb1('0xa')][_0x429584[_0x7fb1('0x27')]]){for(var _0x579d97 in this[_0x7fb1('0xa')][_0x429584[_0x7fb1('0x27')]]){if(this[_0x7fb1('0xa')][_0x429584[_0x7fb1('0x27')]][_0x7fb1('0x56')](_0x579d97)){if(this[_0x7fb1('0xa')][_0x429584[_0x7fb1('0x27')]][_0x579d97][_0x7fb1('0x3e')]&&!this[_0x7fb1('0xa')][_0x429584[_0x7fb1('0x27')]][_0x579d97][_0x7fb1('0x15')]){logger[_0x7fb1('0x4a')](_0x7fb1('0x5c'),_0x429584[_0x7fb1('0x27')],this[_0x7fb1('0xa')][_0x429584[_0x7fb1('0x27')]][_0x579d97][_0x7fb1('0x24')],_0x579d97);this[_0x7fb1('0xa')][_0x429584[_0x7fb1('0x27')]][_0x579d97][_0x7fb1('0x15')]=!![];this[_0x7fb1('0xa')][_0x429584[_0x7fb1('0x27')]][_0x579d97][_0x7fb1('0x5d')]=moment()[_0x7fb1('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x429584['uniqueid']][_0x579d97][_0x7fb1('0x43')]=_0x7fb1('0x5e');this[_0x7fb1('0xa')][_0x429584[_0x7fb1('0x27')]][_0x579d97][_0x7fb1('0x4f')]=_0x429584[_0x7fb1('0x4f')]==_0x7fb1('0x5f')?'agent':_0x429584['reason'];this[_0x7fb1('0xa')][_0x429584['uniqueid']][_0x579d97][_0x7fb1('0x60')]=_0x429584[_0x7fb1('0x60')];if(this[_0x7fb1('0xb')][_0x429584[_0x7fb1('0x2c')]]&&this[_0x7fb1('0xb')][_0x429584['queue']][_0x7fb1('0x61')]){this['channels'][_0x429584[_0x7fb1('0x27')]][_0x579d97][_0x7fb1('0x62')]=this[_0x7fb1('0xb')][_0x429584[_0x7fb1('0x2c')]]['acwTimeout'];this[_0x7fb1('0xa')][_0x429584['uniqueid']][_0x579d97][_0x7fb1('0x63')]=!![];}this[_0x7fb1('0xc')][_0x429584[_0x7fb1('0x35')]]=_[_0x7fb1('0x30')](this[_0x7fb1('0xc')][_0x429584[_0x7fb1('0x35')]],[_0x7fb1('0x2c'),'destconnectedlinenum']);logger[_0x7fb1('0x26')](_0x7fb1('0x64'),_0x429584[_0x7fb1('0x27')],util[_0x7fb1('0x28')](this[_0x7fb1('0xa')][_0x429584[_0x7fb1('0x27')]][_0x579d97],{'showHidden':![],'depth':null}));ami[_0x7fb1('0x20')](_0x7fb1('0x65'),this[_0x7fb1('0xa')][_0x429584['uniqueid']][_0x579d97]);logger[_0x7fb1('0x26')](_0x7fb1('0x66'),_0x429584[_0x7fb1('0x27')],util[_0x7fb1('0x28')]({'id':this[_0x7fb1('0xc')][_0x429584[_0x7fb1('0x35')]]['id'],'destaccountcode':_0x429584[_0x7fb1('0x67')]},{'showHidden':![],'depth':null}));this[_0x7fb1('0x20')](util[_0x7fb1('0x29')](_0x7fb1('0x38'),_0x429584[_0x7fb1('0x24')]),_0x7fb1('0x68'),{'id':this[_0x7fb1('0xc')][_0x429584[_0x7fb1('0x35')]]['id'],'destaccountcode':_0x429584[_0x7fb1('0x67')]});}}}}}}catch(_0x30acb6){logger['error']('[%s][voiceAgentReport][agentcomplete]',_0x429584[_0x7fb1('0x27')],util['inspect'](_0x30acb6,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7fb1('0x17')]=function(_0x52504d){try{if(this['isNotNull'](_0x52504d)){logger[_0x7fb1('0x26')]('[%s][voiceAgentReport][varset]\x20event:',_0x52504d[_0x7fb1('0x27')],util['inspect'](_0x52504d,{'showHidden':![],'depth':null}));this[_0x7fb1('0x69')](_0x52504d[_0x7fb1('0x27')],_[_0x7fb1('0x6a')](_0x52504d[_0x7fb1('0x6b')])[0x0],_0x52504d['value']);if(this['channels'][_0x52504d[_0x7fb1('0x27')]]){for(var _0x428524 in this[_0x7fb1('0xa')][_0x52504d[_0x7fb1('0x27')]]){if(this['channels'][_0x52504d['uniqueid']][_0x7fb1('0x56')](_0x428524)){logger[_0x7fb1('0x4a')](_0x7fb1('0x6c'),_0x52504d[_0x7fb1('0x27')],_0x428524,_[_0x7fb1('0x6a')](_0x52504d[_0x7fb1('0x6b')])[0x0],_0x52504d[_0x7fb1('0x6d')]);if(_[_0x7fb1('0x22')](this[_0x7fb1('0xa')][_0x52504d[_0x7fb1('0x27')]][_0x428524][_0x7fb1('0xd')])){this[_0x7fb1('0xa')][_0x52504d[_0x7fb1('0x27')]][_0x428524][_0x7fb1('0xd')]={};}this[_0x7fb1('0xa')][_0x52504d[_0x7fb1('0x27')]][_0x428524][_0x7fb1('0xd')]=this[_0x7fb1('0xd')][_0x52504d[_0x7fb1('0x27')]];}}}}}catch(_0x5ea6bd){logger[_0x7fb1('0x3a')](_0x7fb1('0x6e'),_0x52504d[_0x7fb1('0x27')],util['inspect'](_0x5ea6bd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7fb1('0x69')]=function(_0x2de842,_0x58a665,_0x1b1dbc){var _0x1fd729=['rtpaudioqos',_0x7fb1('0x6f'),_0x7fb1('0x70'),'rtpaudioqosjitterbridged',_0x7fb1('0x71'),_0x7fb1('0x72'),'rtpaudioqosrtt',_0x7fb1('0x73'),'sipcallid',_0x7fb1('0x74'),_0x7fb1('0x75'),'bridgepvtcallid','membercalls','memberdynamic',_0x7fb1('0x76'),_0x7fb1('0x77'),_0x7fb1('0x24'),_0x7fb1('0x78'),_0x7fb1('0x79')];if(!_[_0x7fb1('0x7a')](_0x58a665)&&!_[_0x7fb1('0x7b')](_0x1fd729,_0x58a665)){if(_[_0x7fb1('0x22')](this[_0x7fb1('0xd')][_0x2de842])){this[_0x7fb1('0xd')][_0x2de842]={};}this[_0x7fb1('0xd')][_0x2de842][_0x58a665]=_0x1b1dbc;}};VoiceAgentReport[_0x7fb1('0x1f')][_0x7fb1('0x19')]=function(_0x6f01b8){try{if(this[_0x7fb1('0x21')](_0x6f01b8)){logger[_0x7fb1('0x26')]('[%s][voiceAgentReport][hangup]\x20event:',_0x6f01b8[_0x7fb1('0x27')],util['inspect'](_0x6f01b8,{'showHidden':![],'depth':null}));if(this['channels'][_0x6f01b8[_0x7fb1('0x27')]]){for(var _0x17800f in this[_0x7fb1('0xa')][_0x6f01b8['uniqueid']]){if(this[_0x7fb1('0xa')][_0x6f01b8[_0x7fb1('0x27')]][_0x7fb1('0x56')](_0x17800f)){if(this['channels'][_0x6f01b8[_0x7fb1('0x27')]][_0x17800f][_0x7fb1('0x4f')]==_0x7fb1('0x5f')&&this[_0x7fb1('0xa')][_0x6f01b8[_0x7fb1('0x27')]][_0x17800f][_0x7fb1('0x15')]){logger[_0x7fb1('0x4a')](_0x7fb1('0x7c'),_0x6f01b8[_0x7fb1('0x27')],_0x17800f);this[_0x7fb1('0xa')][_0x6f01b8[_0x7fb1('0x27')]][_0x17800f]['agentcompleteAt']=moment()['format'](_0x7fb1('0x2a'));}}}logger[_0x7fb1('0x26')](_0x7fb1('0x7d'),_0x6f01b8[_0x7fb1('0x27')],util[_0x7fb1('0x28')](_[_0x7fb1('0x7e')](this[_0x7fb1('0xa')][_0x6f01b8[_0x7fb1('0x27')]]),{'showHidden':![],'depth':null}));ami[_0x7fb1('0x20')](_0x7fb1('0x7f'),_[_0x7fb1('0x7e')](this[_0x7fb1('0xa')][_0x6f01b8[_0x7fb1('0x27')]]));delete this[_0x7fb1('0xa')][_0x6f01b8[_0x7fb1('0x27')]];}if(this[_0x7fb1('0xd')][_0x6f01b8[_0x7fb1('0x27')]]){delete this[_0x7fb1('0xd')][_0x6f01b8[_0x7fb1('0x27')]];}}}catch(_0x4afeb6){logger[_0x7fb1('0x3a')](_0x7fb1('0x80'),_0x6f01b8[_0x7fb1('0x27')],util[_0x7fb1('0x28')](_0x4afeb6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7fb1('0x1f')][_0x7fb1('0x1e')]=function(_0xc4ea67){try{if(this[_0x7fb1('0x21')](_0xc4ea67)){logger[_0x7fb1('0x26')](_0x7fb1('0x81'),_0xc4ea67[_0x7fb1('0x27')],util[_0x7fb1('0x28')](_0xc4ea67,{'showHidden':![],'depth':null}));if(this[_0x7fb1('0xa')][_0xc4ea67[_0x7fb1('0x82')]]){for(var _0x43c3c3 in this['channels'][_0xc4ea67[_0x7fb1('0x82')]]){if(this['channels'][_0xc4ea67['transfereeuniqueid']][_0x7fb1('0x56')](_0x43c3c3)){if(_0xc4ea67[_0x7fb1('0x83')]===_0x43c3c3){logger['info'](_0x7fb1('0x84'),_0xc4ea67[_0x7fb1('0x27')],this[_0x7fb1('0xa')][_0xc4ea67['transfereeuniqueid']][_0x43c3c3][_0x7fb1('0x24')],_0x43c3c3);var _0x55bd45=moment();this['channels'][_0xc4ea67[_0x7fb1('0x82')]][_0x43c3c3]['agentcomplete']=!![];this[_0x7fb1('0xa')][_0xc4ea67[_0x7fb1('0x82')]][_0x43c3c3]['agentcompleteAt']=moment()[_0x7fb1('0x29')](_0x7fb1('0x2a'));this[_0x7fb1('0xa')][_0xc4ea67['transfereeuniqueid']][_0x43c3c3][_0x7fb1('0x43')]=_0x7fb1('0x5e');this['channels'][_0xc4ea67[_0x7fb1('0x82')]][_0x43c3c3][_0x7fb1('0x4f')]=_0x7fb1('0x5f');this[_0x7fb1('0xa')][_0xc4ea67[_0x7fb1('0x82')]][_0x43c3c3]['talktime']=_0x55bd45['diff'](this[_0x7fb1('0xa')][_0xc4ea67['transfereeuniqueid']][_0x43c3c3][_0x7fb1('0x3e')],_0x7fb1('0x85'));}}}}if(this[_0x7fb1('0xa')][_0xc4ea67[_0x7fb1('0x86')]]){var _0x52a7dc=this[_0x7fb1('0xa')][_0xc4ea67[_0x7fb1('0x86')]];this[_0x7fb1('0xa')][_0xc4ea67[_0x7fb1('0x86')]]=this['channels'][_0xc4ea67['transfereeuniqueid']];this[_0x7fb1('0xa')][_0xc4ea67[_0x7fb1('0x82')]]=_0x52a7dc;}}}catch(_0x46a7fc){logger[_0x7fb1('0x3a')]('[%s][voiceAgentReport][attendedtransfer]',_0xc4ea67[_0x7fb1('0x27')],util['inspect'](_0x46a7fc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7fb1('0x1f')][_0x7fb1('0x87')]=function(_0x4c1a31){try{if(this[_0x7fb1('0x21')](_0x4c1a31)){logger[_0x7fb1('0x26')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x4c1a31[_0x7fb1('0x27')],util[_0x7fb1('0x28')](_0x4c1a31,{'showHidden':![],'depth':null}));if(this[_0x7fb1('0xa')][_0x4c1a31['transfereeuniqueid']]){for(var _0x3c65b1 in this[_0x7fb1('0xa')][_0x4c1a31[_0x7fb1('0x82')]]){if(this['channels'][_0x4c1a31[_0x7fb1('0x82')]]['hasOwnProperty'](_0x3c65b1)){if(_0x4c1a31[_0x7fb1('0x88')]===_0x3c65b1){logger['info'](_0x7fb1('0x89'),_0x4c1a31[_0x7fb1('0x27')],this['channels'][_0x4c1a31[_0x7fb1('0x82')]][_0x3c65b1][_0x7fb1('0x24')],_0x3c65b1);var _0xc18415=moment();this[_0x7fb1('0xa')][_0x4c1a31[_0x7fb1('0x82')]][_0x3c65b1][_0x7fb1('0x15')]=!![];this[_0x7fb1('0xa')][_0x4c1a31[_0x7fb1('0x82')]][_0x3c65b1]['agentcompleteAt']=_0xc18415;this[_0x7fb1('0xa')][_0x4c1a31[_0x7fb1('0x82')]][_0x3c65b1][_0x7fb1('0x43')]=_0x7fb1('0x5e');this['channels'][_0x4c1a31[_0x7fb1('0x82')]][_0x3c65b1][_0x7fb1('0x4f')]=_0x7fb1('0x5f');this[_0x7fb1('0xa')][_0x4c1a31[_0x7fb1('0x82')]][_0x3c65b1][_0x7fb1('0x60')]=_0xc18415[_0x7fb1('0x8a')](this['channels'][_0x4c1a31['transfereeuniqueid']][_0x3c65b1][_0x7fb1('0x3e')],_0x7fb1('0x85'));}}}}}}catch(_0x2f097b){logger[_0x7fb1('0x3a')](_0x7fb1('0x8b'),_0x4c1a31[_0x7fb1('0x27')],util[_0x7fb1('0x28')](_0x2f097b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7fb1('0x1f')][_0x7fb1('0x8c')]=function(_0x4d59bd){var _0xd45962='';try{if(this[_0x7fb1('0x21')](_0x4d59bd)){logger[_0x7fb1('0x26')](_0x7fb1('0x8d'),_0x4d59bd['uniqueid'],util[_0x7fb1('0x28')](_0x4d59bd,{'showHidden':![],'depth':null}));if(_0x4d59bd[_0x7fb1('0x8e')]){_0xd45962=_0x4d59bd[_0x7fb1('0x8e')][_0x7fb1('0x8f')](0x0,_0x4d59bd[_0x7fb1('0x8e')][_0x7fb1('0x90')]('-'));if(this[_0x7fb1('0xc')][_0xd45962]){logger[_0x7fb1('0x4a')](_0x7fb1('0x91'),_0x4d59bd[_0x7fb1('0x27')],_0xd45962);this[_0x7fb1('0xc')][_0xd45962]['onhold']=!![];}}}}catch(_0x5b6279){logger[_0x7fb1('0x3a')](_0x7fb1('0x92'),_0x4d59bd[_0x7fb1('0x27')],util[_0x7fb1('0x28')](_0x5b6279,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7fb1('0x1f')][_0x7fb1('0x1c')]=function(_0x314c68){var _0x1a493a='';try{if(this[_0x7fb1('0x21')](_0x314c68)){logger[_0x7fb1('0x26')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x314c68['uniqueid'],util[_0x7fb1('0x28')](_0x314c68,{'showHidden':![],'depth':null}));if(_0x314c68['channel']){_0x1a493a=_0x314c68[_0x7fb1('0x8e')]['substring'](0x0,_0x314c68[_0x7fb1('0x8e')]['lastIndexOf']('-'));if(this[_0x7fb1('0xc')][_0x1a493a]){logger[_0x7fb1('0x4a')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x314c68[_0x7fb1('0x27')],_0x1a493a);this[_0x7fb1('0xc')][_0x1a493a][_0x7fb1('0x93')]=![];}}}}catch(_0x9f1988){logger[_0x7fb1('0x3a')](_0x7fb1('0x94'),_0x314c68[_0x7fb1('0x27')],util[_0x7fb1('0x28')](_0x9f1988,{'showHidden':![],'depth':null}));}};module[_0x7fb1('0x95')]=VoiceAgentReport;
\ No newline at end of file
index 72a4354..30137e6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4830=['calleridpreview','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','holdtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','undefined','getSettings','then','stopRecordingOnTransfer','resolve','Action','catch','finally','emit','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][attendedtransfer]','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfercalleridnum','transfereecalleridnum','BLIND','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','lodash','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','set','queue','agi','dial','playback','NO\x20ANSWER','FAILED','redis','defaults','localhost','channels','agents','syncNewExten','newexten','newchannel','syncNewChannel','bind','newstate','syncNewState','varset','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','linkedid','isUndefined','merge','pick','keys','from-sip','split','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','channel','name','user:agentconnect','accountcode','error','[%s][voiceCallReport][newcallerid]','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','blindTransfers','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','disposition','toNumber','channelstate','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','appdata','applicationdata','startsWith','CDR(routeAlias)','starttime','subtract','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','type','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','diff','connectedlinename','destinationchannel','UserId','routealias','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s'];(function(_0x3f6207,_0x3ab70c){var _0x44c7c6=function(_0x484862){while(--_0x484862){_0x3f6207['push'](_0x3f6207['shift']());}};_0x44c7c6(++_0x3ab70c);}(_0x4830,0xf9));var _0x0483=function(_0x10bde3,_0x12bea7){_0x10bde3=_0x10bde3-0x0;var _0x29ddf7=_0x4830[_0x10bde3];return _0x29ddf7;};'use strict';var _=require(_0x0483('0x0'));var moment=require('moment');var util=require('util');var path=require(_0x0483('0x1'));var Redis=require(_0x0483('0x2'));var config=require(_0x0483('0x3'));var logger=require(_0x0483('0x4'))(_0x0483('0x5'));var ami=require(_0x0483('0x6'));var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var applications=[_0x0483('0x7'),_0x0483('0x8'),_0x0483('0x9'),_0x0483('0xa'),_0x0483('0xb'),'voicemail'];var dispositions=[_0x0483('0xc'),_0x0483('0xd'),'FAILED',_0x0483('0xc'),_0x0483('0xc'),_0x0483('0xc'),'ANSWERED','BUSY',_0x0483('0xd'),_0x0483('0xd'),_0x0483('0xd')];config[_0x0483('0xe')]=_[_0x0483('0xf')](config[_0x0483('0xe')],{'host':_0x0483('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x126d93){this['channels']=_0x126d93[_0x0483('0x11')];this[_0x0483('0x12')]=_0x126d93['agents'];this['blindTransfers']={};ami['on']('coreshowchannel',this[_0x0483('0x13')]['bind'](this));ami['on'](_0x0483('0x14'),this[_0x0483('0x13')]['bind'](this));ami['on'](_0x0483('0x15'),this[_0x0483('0x16')][_0x0483('0x17')](this));ami['on'](_0x0483('0x18'),this[_0x0483('0x19')][_0x0483('0x17')](this));ami['on'](_0x0483('0x1a'),this['syncVarSet'][_0x0483('0x17')](this));ami['on'](_0x0483('0x1b'),this[_0x0483('0x1c')][_0x0483('0x17')](this));ami['on']('newcallerid',this[_0x0483('0x1d')][_0x0483('0x17')](this));ami['on'](_0x0483('0x1e'),this[_0x0483('0x1f')][_0x0483('0x17')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x0483('0x17')](this));ami['on']('musiconholdstart',this[_0x0483('0x20')][_0x0483('0x17')](this));ami['on'](_0x0483('0x21'),this[_0x0483('0x22')][_0x0483('0x17')](this));try{logger[_0x0483('0x23')](_0x0483('0x24'));ami[_0x0483('0x25')]();}catch(_0x25a037){logger['error'](_0x0483('0x26'),util[_0x0483('0x27')](_0x25a037,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x0483('0x28')]['isNotNull']=function(_0x499cdf){return _0x499cdf!==null&&!_['isUndefined'](_0x499cdf);};VoiceCallReport['prototype']['emit']=function(_0x427608,_0x4b73b0,_0x5884bf){io['to'](_0x427608)['emit'](_0x4b73b0,_0x5884bf);};VoiceCallReport[_0x0483('0x28')][_0x0483('0x1d')]=function(_0x5deb3a){try{if(this['isNotNull'](_0x5deb3a)){logger[_0x0483('0x23')](_0x0483('0x29'),_0x5deb3a[_0x0483('0x2a')],_0x5deb3a[_0x0483('0x2b')],_0x5deb3a[_0x0483('0x2c')]);logger[_0x0483('0x2d')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x5deb3a[_0x0483('0x2a')],util[_0x0483('0x27')](_0x5deb3a,{'showHidden':![],'depth':null}));if(_0x5deb3a[_0x0483('0x2a')]===_0x5deb3a[_0x0483('0x2e')]){if(!_[_0x0483('0x2f')](this[_0x0483('0x11')][_0x5deb3a['uniqueid']])){_[_0x0483('0x30')](this[_0x0483('0x11')][_0x5deb3a[_0x0483('0x2a')]],_[_0x0483('0x31')](_0x5deb3a,_[_0x0483('0x32')](this['channels'][_0x5deb3a[_0x0483('0x2a')]])));}}if(_0x5deb3a['context']===_0x0483('0x33')){if(this[_0x0483('0x12')][_0x5deb3a['channel'][_0x0483('0x34')]('-')[0x0]]){if(_0x5deb3a['exten']==_0x0483('0x35')){this['agents'][_0x5deb3a['channel'][_0x0483('0x34')]('-')[0x0]][_0x0483('0x36')]=_0x5deb3a[_0x0483('0x37')];this['emit'](util[_0x0483('0x38')]('user:%s',this[_0x0483('0x12')][_0x5deb3a[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]][_0x0483('0x3a')]),_0x0483('0x3b'),{'destaccountcode':this['agents'][_0x5deb3a['channel'][_0x0483('0x34')]('-')[0x0]][_0x0483('0x3c')],'destconnectedlinenum':_0x5deb3a[_0x0483('0x37')]});}}}}}catch(_0xa11e92){logger[_0x0483('0x3d')](_0x0483('0x3e'),_0x5deb3a[_0x0483('0x2a')],util['inspect'](_0xa11e92,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0483('0x28')][_0x0483('0x16')]=function(_0xe42569){try{if(this[_0x0483('0x3f')](_0xe42569)){logger[_0x0483('0x2d')](_0x0483('0x40'),_0xe42569[_0x0483('0x2a')],util[_0x0483('0x27')](_0xe42569,{'showHidden':![],'depth':null}));if(this[_0x0483('0x11')][_0xe42569[_0x0483('0x2a')]])return;if(_0xe42569[_0x0483('0x39')]===_0x0483('0x41'))return;if(_0xe42569[_0x0483('0x2a')]!==_0xe42569['linkedid']&&!this[_0x0483('0x42')][_0xe42569[_0x0483('0x2e')]])return;logger[_0x0483('0x23')](_0x0483('0x43'),_0xe42569[_0x0483('0x2a')],_0xe42569['context'],_0xe42569[_0x0483('0x44')]);this['channels'][_0xe42569[_0x0483('0x2a')]]=new Channel();this['channels'][_0xe42569['uniqueid']]['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0483('0x11')][_0xe42569[_0x0483('0x2a')]][_0x0483('0x45')]=dispositions[_[_0x0483('0x46')](_0xe42569[_0x0483('0x47')])];_['merge'](this[_0x0483('0x11')][_0xe42569[_0x0483('0x2a')]],_[_0x0483('0x31')](_0xe42569,_[_0x0483('0x32')](this['channels'][_0xe42569[_0x0483('0x2a')]])));if(_0xe42569['context']===_0x0483('0x33')){if(this[_0x0483('0x12')][_0xe42569[_0x0483('0x39')]['split']('-')[0x0]]){if(_[_0x0483('0x2f')](this[_0x0483('0x12')][_0xe42569['channel'][_0x0483('0x34')]('-')[0x0]][_0x0483('0x36')])){this['agents'][_0xe42569['channel'][_0x0483('0x34')]('-')[0x0]][_0x0483('0x36')]=_0xe42569[_0x0483('0x44')];logger[_0x0483('0x2d')](_0x0483('0x48'),_0xe42569[_0x0483('0x2a')],util[_0x0483('0x27')]({'id':this['agents'][_0xe42569[_0x0483('0x39')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x0483('0x12')][_0xe42569[_0x0483('0x39')]['split']('-')[0x0]][_0x0483('0x3c')],'destconnectedlinenum':_0xe42569[_0x0483('0x44')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x0483('0x38')](_0x0483('0x49'),this[_0x0483('0x12')][_0xe42569[_0x0483('0x39')]['split']('-')[0x0]][_0x0483('0x3a')]),'user:agentconnect',{'id':this[_0x0483('0x12')][_0xe42569[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0xe42569[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0xe42569[_0x0483('0x44')]});}}}}}catch(_0x4b04e6){logger[_0x0483('0x3d')](_0x0483('0x4a'),_0xe42569[_0x0483('0x2a')],util[_0x0483('0x27')](_0x4b04e6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0483('0x28')]['syncNewExten']=function(_0x5c8083){try{if(this[_0x0483('0x3f')](_0x5c8083)){logger[_0x0483('0x2d')](_0x0483('0x4b'),_0x5c8083[_0x0483('0x2a')],util[_0x0483('0x27')](_0x5c8083,{'showHidden':![],'depth':null}));if(_0x5c8083['channel']==='OutgoingSpoolFailed'||_0x5c8083['exten']==='h')return;if(_0x5c8083['uniqueid']===_0x5c8083[_0x0483('0x2e')]||this[_0x0483('0x42')][_0x5c8083[_0x0483('0x2e')]]){_0x5c8083['application']=_0x5c8083[_0x0483('0x4c')][_0x0483('0x4d')]();_0x5c8083['applicationdata']=_0x5c8083[_0x0483('0x4e')]||_0x5c8083[_0x0483('0x4f')];if(_0x5c8083[_0x0483('0x4e')]&&!_0x5c8083[_0x0483('0x4e')][_0x0483('0x50')](_0x0483('0x51'))&&_0x5c8083[_0x0483('0x4c')]!==_0x0483('0x8')){_0x5c8083['applicationdata']=_0x5c8083['applicationdata']['toLowerCase']();}logger[_0x0483('0x23')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x5c8083[_0x0483('0x2a')],_0x5c8083[_0x0483('0x4c')],_0x5c8083['applicationdata']);if(_[_0x0483('0x2f')](this[_0x0483('0x11')][_0x5c8083[_0x0483('0x2a')]])){this[_0x0483('0x11')][_0x5c8083[_0x0483('0x2a')]]=new Channel();this[_0x0483('0x11')][_0x5c8083[_0x0483('0x2a')]][_0x0483('0x52')]=_0x5c8083['duration']?moment()[_0x0483('0x53')](moment[_0x0483('0x54')](_0x5c8083['duration'])['seconds'](),_0x0483('0x55'))[_0x0483('0x38')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x0483('0x38')](_0x0483('0x56'));this[_0x0483('0x11')][_0x5c8083['uniqueid']]['disposition']=_0x0483('0xc');}_['merge'](this[_0x0483('0x11')][_0x5c8083['uniqueid']],_[_0x0483('0x31')](_0x5c8083,_[_0x0483('0x32')](this[_0x0483('0x11')][_0x5c8083[_0x0483('0x2a')]])));if(_[_0x0483('0x57')](applications,_0x5c8083[_0x0483('0x4c')])){this[_0x0483('0x11')][_0x5c8083[_0x0483('0x2a')]][_0x0483('0x58')]=_0x5c8083['application'];this[_0x0483('0x11')][_0x5c8083['uniqueid']][_0x0483('0x59')]=_0x5c8083['applicationdata'];if(_0x5c8083[_0x0483('0x4c')]===_0x0483('0x7')&&_[_0x0483('0x50')](_0x5c8083[_0x0483('0x4f')]['toLowerCase'](),'cdr(')){var _0x473ad0=_0x5c8083['applicationdata'][_0x0483('0x34')]('=');var _0x52477a=_0x473ad0[0x0][_0x0483('0x4d')]()['match'](/cdr\((.*)\)/);if(_0x52477a){if(_0x52477a[0x1]===_0x0483('0x5a')&&!_['isNil'](this[_0x0483('0x11')][_0x5c8083[_0x0483('0x2a')]][_0x52477a[0x1]]))return;this[_0x0483('0x11')][_0x5c8083['uniqueid']][_0x52477a[0x1]]=_0x473ad0[0x1];}}else if(_0x5c8083['application']===_0x0483('0x8')){this['channels'][_0x5c8083['uniqueid']][_0x0483('0x8')]=_0x5c8083['applicationdata']['split'](',')[0x0];}}}}}catch(_0x381c27){logger['error']('[%s][voiceCallReport][newexten]',_0x5c8083['uniqueid'],util['inspect'](_0x381c27,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0483('0x28')][_0x0483('0x19')]=function(_0x4e6cbe){try{if(this['isNotNull'](_0x4e6cbe)){logger['info'](_0x0483('0x5b'),_0x4e6cbe[_0x0483('0x2a')],_0x4e6cbe[_0x0483('0x2e')],_0x4e6cbe[_0x0483('0x2b')],_0x4e6cbe[_0x0483('0x2c')]);logger['debug'](_0x0483('0x5c'),_0x4e6cbe[_0x0483('0x2a')],util[_0x0483('0x27')](_0x4e6cbe,{'showHidden':![],'depth':null}));if(_0x4e6cbe[_0x0483('0x47')]!=='6')return;if(_0x4e6cbe[_0x0483('0x2a')]!==_0x4e6cbe[_0x0483('0x2e')]){var _0x110b6f=moment();if(this['channels'][_0x4e6cbe['linkedid']]){if(!this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2e')]][_0x0483('0x5d')]){this['channels'][_0x4e6cbe['linkedid']]['answered']=!![];this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2e')]][_0x0483('0x5e')]=_0x110b6f[_0x0483('0x38')](_0x0483('0x56'));if(this['channels'][_0x4e6cbe[_0x0483('0x2e')]][_0x0483('0x52')]){this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2e')]]['holdtime']=_0x110b6f[_0x0483('0x5f')](this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2e')]][_0x0483('0x52')],_0x0483('0x55'));}}this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2e')]]['linkedid']=_0x4e6cbe[_0x0483('0x2a')];if(_0x4e6cbe[_0x0483('0x2c')]!=='xcally-motion-preview'){this[_0x0483('0x11')][_0x4e6cbe['linkedid']][_0x0483('0x37')]=_0x4e6cbe[_0x0483('0x2c')];}this[_0x0483('0x11')][_0x4e6cbe['linkedid']][_0x0483('0x60')]=_0x4e6cbe[_0x0483('0x2b')];this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2e')]][_0x0483('0x61')]=_0x4e6cbe['channel'];this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2e')]]['disposition']=dispositions[_[_0x0483('0x46')](_0x4e6cbe[_0x0483('0x47')])];if(this[_0x0483('0x12')][_0x4e6cbe['channel'][_0x0483('0x34')]('-')[0x0]]){this['channels'][_0x4e6cbe[_0x0483('0x2e')]][_0x0483('0x62')]=this[_0x0483('0x12')][_0x4e6cbe['channel'][_0x0483('0x34')]('-')[0x0]]['id'];this['channels'][_0x4e6cbe[_0x0483('0x2e')]]['membername']=this['agents'][_0x4e6cbe[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]][_0x0483('0x3a')];}}if(this['channels'][_0x4e6cbe[_0x0483('0x2a')]]){if(!this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2a')]][_0x0483('0x5d')]){this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2a')]]['answered']=!![];this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2a')]][_0x0483('0x5e')]=_0x110b6f[_0x0483('0x38')](_0x0483('0x56'));if(this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2a')]]['starttime']){this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2a')]]['holdtime']=_0x110b6f[_0x0483('0x5f')](this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2a')]][_0x0483('0x52')],'seconds');}}if(_0x4e6cbe['calleridnum']!==_0x0483('0x35')){this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2a')]][_0x0483('0x37')]=_0x4e6cbe[_0x0483('0x2c')];}this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2a')]][_0x0483('0x60')]=_0x4e6cbe[_0x0483('0x2b')];this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2a')]][_0x0483('0x61')]=_0x4e6cbe['channel'];this['channels'][_0x4e6cbe[_0x0483('0x2a')]][_0x0483('0x45')]=dispositions[_[_0x0483('0x46')](_0x4e6cbe[_0x0483('0x47')])];}}else{if(this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2a')]]){if(this['agents'][_0x4e6cbe[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]]){this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2a')]][_0x0483('0x62')]=this[_0x0483('0x12')][_0x4e6cbe[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]]['id'];this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2a')]]['membername']=this[_0x0483('0x12')][_0x4e6cbe[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]]['name'];}}}if(_0x4e6cbe['context']===_0x0483('0x33')){if(this[_0x0483('0x12')][_0x4e6cbe[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]]){this['agents'][_0x4e6cbe['channel']['split']('-')[0x0]][_0x0483('0x36')]=_0x4e6cbe[_0x0483('0x44')];var _0x23b3fd,_0xed92ee;if(this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2a')]]){_0x23b3fd=this[_0x0483('0x11')][_0x4e6cbe[_0x0483('0x2a')]][_0x0483('0x63')];_0xed92ee=this[_0x0483('0x11')][_0x4e6cbe['uniqueid']][_0x0483('0x8')];}else if(this['channels'][_0x4e6cbe['linkedid']]){_0x23b3fd=this['channels'][_0x4e6cbe[_0x0483('0x2e')]][_0x0483('0x63')];_0xed92ee=this[_0x0483('0x11')][_0x4e6cbe['linkedid']]['queue'];}this['agents'][_0x4e6cbe['channel'][_0x0483('0x34')]('-')[0x0]][_0x0483('0x8')]=_0xed92ee;this['agents'][_0x4e6cbe[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]][_0x0483('0x63')]=_0x23b3fd;logger[_0x0483('0x2d')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x4e6cbe['uniqueid'],util['inspect']({'id':this[_0x0483('0x12')][_0x4e6cbe[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]]['id'],'destaccountcode':this[_0x0483('0x12')][_0x4e6cbe['channel'][_0x0483('0x34')]('-')[0x0]][_0x0483('0x3c')],'destconnectedlinenum':_0x4e6cbe[_0x0483('0x44')],'routealias':_0x23b3fd,'queue':_0xed92ee||undefined},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x0483('0x49'),this[_0x0483('0x12')][_0x4e6cbe[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]][_0x0483('0x3a')]),_0x0483('0x3b'),{'id':this[_0x0483('0x12')][_0x4e6cbe[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0x0483('0x12')][_0x4e6cbe['channel'][_0x0483('0x34')]('-')[0x0]][_0x0483('0x3c')],'destconnectedlinenum':_0x4e6cbe[_0x0483('0x44')],'routealias':_0x23b3fd,'queue':_0xed92ee||undefined});}}}}catch(_0x5688f5){logger['error'](_0x0483('0x64'),_0x4e6cbe['uniqueid'],util[_0x0483('0x27')](_0x5688f5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0483('0x28')][_0x0483('0x65')]=function(_0x5412dd,_0x22fa04){try{if(this[_0x0483('0x11')][_0x5412dd]){logger['info']('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x5412dd,_0x22fa04);this['channels'][_0x5412dd][_0x0483('0x66')]=!![];if(_[_0x0483('0x67')](_0x22fa04,_0x0483('0x68'))){_0x22fa04=_0x22fa04[_0x0483('0x69')](_0x0483('0x68'),_0x0483('0x6a'));}this[_0x0483('0x11')][_0x5412dd][_0x0483('0x6b')]=_0x22fa04;var _0x2cd8e6=_['find'](this[_0x0483('0x11')][_0x5412dd][_0x0483('0x6c')],{'filename':_0x22fa04});if(_[_0x0483('0x6d')](_0x2cd8e6)){this[_0x0483('0x11')][_0x5412dd][_0x0483('0x6c')][_0x0483('0x6e')]({'filename':_0x22fa04,'createdAt':moment()[_0x0483('0x38')](_0x0483('0x56')),'mixmonitorid':'','status':_0x0483('0x6f')});}}}catch(_0x3e9920){logger[_0x0483('0x3d')](_0x0483('0x70'),_0x5412dd,util[_0x0483('0x27')](_0x3e9920,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0483('0x28')][_0x0483('0x71')]=function(_0x45bf34){try{if(this[_0x0483('0x3f')](_0x45bf34)){logger[_0x0483('0x2d')](_0x0483('0x72'),_0x45bf34['uniqueid'],util['inspect'](_0x45bf34,{'showHidden':![],'depth':null}));if(this['channels'][_0x45bf34['uniqueid']]&&_0x45bf34[_0x0483('0x39')]!=_0x0483('0x41')){if(this[_0x0483('0x3f')](_0x45bf34[_0x0483('0x73')])){if(this['isNotNull'](_0x45bf34[_0x0483('0x73')][_0x0483('0x74')])){logger[_0x0483('0x23')](_0x0483('0x75'),_0x45bf34[_0x0483('0x2a')],_0x45bf34['value']);this[_0x0483('0x65')](_0x45bf34[_0x0483('0x2a')],_0x45bf34[_0x0483('0x76')]);}else if(this[_0x0483('0x3f')](_0x45bf34[_0x0483('0x73')][_0x0483('0x77')])){logger[_0x0483('0x23')](_0x0483('0x78'),_0x45bf34[_0x0483('0x2a')],_0x45bf34[_0x0483('0x76')]);this['channels'][_0x45bf34[_0x0483('0x2a')]][_0x0483('0x2c')]=_0x45bf34[_0x0483('0x76')];}else if(this[_0x0483('0x3f')](_0x45bf34[_0x0483('0x73')][_0x0483('0x79')])){logger[_0x0483('0x23')](_0x0483('0x7a'),_0x45bf34[_0x0483('0x2a')],_0x45bf34[_0x0483('0x76')]);this[_0x0483('0x11')][_0x45bf34[_0x0483('0x2a')]][_0x0483('0x7b')]=_0x45bf34[_0x0483('0x76')];}else if(this[_0x0483('0x3f')](_0x45bf34[_0x0483('0x73')]['xmd-cdrtype'])){logger[_0x0483('0x23')](_0x0483('0x7c'),_0x45bf34[_0x0483('0x2a')],_0x45bf34[_0x0483('0x76')]);this[_0x0483('0x11')][_0x45bf34[_0x0483('0x2a')]][_0x0483('0x5a')]=_0x45bf34[_0x0483('0x76')];}else if(this[_0x0483('0x3f')](_0x45bf34[_0x0483('0x73')][_0x0483('0x7d')])){logger[_0x0483('0x23')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x45bf34[_0x0483('0x2a')],_0x45bf34[_0x0483('0x76')][_0x0483('0x34')](',')[0x0]);this[_0x0483('0x11')][_0x45bf34[_0x0483('0x2a')]]['queue']=_0x45bf34[_0x0483('0x76')][_0x0483('0x34')](',')[0x0];}else if(this[_0x0483('0x3f')](_0x45bf34[_0x0483('0x73')][_0x0483('0x7e')])){logger[_0x0483('0x23')](_0x0483('0x7f'),_0x45bf34['uniqueid'],_0x45bf34[_0x0483('0x76')]);this[_0x0483('0x11')][_0x45bf34[_0x0483('0x2a')]][_0x0483('0x80')]=_0x45bf34[_0x0483('0x76')];}else if(this['isNotNull'](_0x45bf34[_0x0483('0x73')][_0x0483('0x81')])){logger[_0x0483('0x23')](_0x0483('0x82'),_0x45bf34['uniqueid'],_0x45bf34[_0x0483('0x76')]);this['channels'][_0x45bf34['uniqueid']]['destination']=_0x45bf34['value'];}else if(this[_0x0483('0x3f')](_0x45bf34[_0x0483('0x73')][_0x0483('0x83')])){logger['info'](_0x0483('0x84'),_0x45bf34[_0x0483('0x2a')],_0x45bf34[_0x0483('0x76')]);this[_0x0483('0x11')][_0x45bf34[_0x0483('0x2a')]][_0x0483('0x85')]=_0x45bf34['value'];}else if(this['isNotNull'](_0x45bf34['variable']['xmcs-queue'])){logger[_0x0483('0x23')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x45bf34[_0x0483('0x2a')],_0x45bf34[_0x0483('0x76')]);this[_0x0483('0x11')][_0x45bf34['uniqueid']][_0x0483('0x8')]=_0x45bf34[_0x0483('0x76')];}else if(this['isNotNull'](_0x45bf34[_0x0483('0x73')][_0x0483('0x86')])){logger['info'](_0x0483('0x87'),_0x45bf34['uniqueid'],_0x45bf34['value']);this[_0x0483('0x11')][_0x45bf34['uniqueid']][_0x0483('0x88')]=_0x45bf34[_0x0483('0x76')];}}}else if(this['isNotNull'](_0x45bf34[_0x0483('0x73')][_0x0483('0x74')])){if(_0x45bf34[_0x0483('0x76')]){var _0x589284=path[_0x0483('0x89')](_0x45bf34['value'])[_0x0483('0x3a')];logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x589284,_0x45bf34[_0x0483('0x76')]);this[_0x0483('0x65')](_0x589284,_0x45bf34['value']);}}else if(this[_0x0483('0x11')][_0x45bf34[_0x0483('0x2e')]]){if(this['isNotNull'](_0x45bf34[_0x0483('0x73')])){if(this[_0x0483('0x3f')](_0x45bf34[_0x0483('0x73')][_0x0483('0x86')])){logger['info'](_0x0483('0x87'),_0x45bf34['linkedid'],_0x45bf34['value']);this[_0x0483('0x11')][_0x45bf34[_0x0483('0x2e')]][_0x0483('0x8a')]=_0x45bf34['value'];}}}}}catch(_0x1d0e48){logger[_0x0483('0x3d')]('[%s][voiceCallReport][varset]',_0x45bf34[_0x0483('0x2a')],util[_0x0483('0x27')](_0x1d0e48,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0483('0x1c')]=function(_0x25f71b){try{if(this[_0x0483('0x3f')](_0x25f71b)){logger['debug'](_0x0483('0x8b'),_0x25f71b[_0x0483('0x2a')],util[_0x0483('0x27')](_0x25f71b,{'showHidden':![],'depth':null}));if(this[_0x0483('0x42')][_0x25f71b[_0x0483('0x2e')]]){if(this['channels'][this['blindTransfers'][_0x25f71b[_0x0483('0x2e')]][_0x0483('0x2e')]]){this[_0x0483('0x11')][this[_0x0483('0x42')][_0x25f71b[_0x0483('0x2e')]][_0x0483('0x2e')]]['uniqueid']=_0x25f71b[_0x0483('0x2a')];this[_0x0483('0x11')][this['blindTransfers'][_0x25f71b['linkedid']][_0x0483('0x2e')]][_0x0483('0x5d')]=this[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]][_0x0483('0x5d')];this[_0x0483('0x11')][this[_0x0483('0x42')][_0x25f71b[_0x0483('0x2e')]]['linkedid']]['answertime']=this[_0x0483('0x11')][_0x25f71b['uniqueid']][_0x0483('0x5e')];this[_0x0483('0x11')][this[_0x0483('0x42')][_0x25f71b[_0x0483('0x2e')]][_0x0483('0x2e')]][_0x0483('0x61')]=this[_0x0483('0x11')][this['blindTransfers'][_0x25f71b[_0x0483('0x2e')]][_0x0483('0x2e')]][_0x0483('0x39')];this['channels'][this[_0x0483('0x42')][_0x25f71b[_0x0483('0x2e')]][_0x0483('0x2e')]][_0x0483('0x45')]=this[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]]['disposition'];this['channels'][_0x25f71b[_0x0483('0x2a')]]=this[_0x0483('0x11')][this[_0x0483('0x42')][_0x25f71b[_0x0483('0x2e')]][_0x0483('0x2e')]];delete this['channels'][this[_0x0483('0x42')][_0x25f71b[_0x0483('0x2e')]][_0x0483('0x2e')]];}else if(this[_0x0483('0x11')][this[_0x0483('0x42')][_0x25f71b[_0x0483('0x2e')]]['uniqueid']]){this['channels'][this[_0x0483('0x42')][_0x25f71b[_0x0483('0x2e')]][_0x0483('0x2a')]][_0x0483('0x2a')]=[this['channels'][this['blindTransfers'][_0x25f71b['linkedid']]['uniqueid']][_0x0483('0x2e')],this[_0x0483('0x11')][this[_0x0483('0x42')][_0x25f71b[_0x0483('0x2e')]][_0x0483('0x2a')]]['linkedid']=this[_0x0483('0x11')][this[_0x0483('0x42')][_0x25f71b[_0x0483('0x2e')]][_0x0483('0x2a')]][_0x0483('0x2a')]][0x0];this[_0x0483('0x11')][this[_0x0483('0x42')][_0x25f71b['linkedid']][_0x0483('0x2a')]][_0x0483('0x5d')]=this[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]][_0x0483('0x5d')];this[_0x0483('0x11')][this['blindTransfers'][_0x25f71b[_0x0483('0x2e')]][_0x0483('0x2a')]][_0x0483('0x5e')]=this[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]][_0x0483('0x5e')];this[_0x0483('0x11')][this['blindTransfers'][_0x25f71b[_0x0483('0x2e')]][_0x0483('0x2a')]][_0x0483('0x61')]=this['channels'][this[_0x0483('0x42')][_0x25f71b[_0x0483('0x2e')]]['uniqueid']][_0x0483('0x39')];this[_0x0483('0x11')][this[_0x0483('0x42')][_0x25f71b[_0x0483('0x2e')]][_0x0483('0x2a')]][_0x0483('0x45')]=this[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]][_0x0483('0x45')];this[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]]=this[_0x0483('0x11')][this[_0x0483('0x42')][_0x25f71b[_0x0483('0x2e')]][_0x0483('0x2a')]];delete this[_0x0483('0x11')][this[_0x0483('0x42')][_0x25f71b['linkedid']][_0x0483('0x2a')]];}}if(this[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]]){logger[_0x0483('0x23')](_0x0483('0x8c'),_0x25f71b['uniqueid'],_0x25f71b[_0x0483('0x8d')]);var _0x2b7850=moment();this[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]]['endtime']=_0x2b7850['format'](_0x0483('0x56'));this[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]][_0x0483('0x54')]=_0x2b7850[_0x0483('0x5f')](this['channels'][_0x25f71b[_0x0483('0x2a')]]['starttime'],_0x0483('0x55'));if(this[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]][_0x0483('0x5d')]){this[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]][_0x0483('0x8e')]=_0x2b7850[_0x0483('0x5f')](this[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]]['answertime'],_0x0483('0x55'));this[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]][_0x0483('0x8f')]=this[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]][_0x0483('0x54')]-this[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]][_0x0483('0x8e')];}if(_0x25f71b['context']===_0x0483('0x33')){if(this[_0x0483('0x12')][_0x25f71b[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]]){this[_0x0483('0x12')][_0x25f71b['channel'][_0x0483('0x34')]('-')[0x0]]=_[_0x0483('0x90')](this[_0x0483('0x12')][_0x25f71b[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]],[_0x0483('0x36')]);logger['debug'](_0x0483('0x91'),_0x25f71b[_0x0483('0x2a')],util[_0x0483('0x27')]({'id':this[_0x0483('0x12')][_0x25f71b[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]]['id'],'destaccountcode':this[_0x0483('0x12')][_0x25f71b[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this['emit'](util[_0x0483('0x38')](_0x0483('0x49'),this[_0x0483('0x12')][_0x25f71b['channel'][_0x0483('0x34')]('-')[0x0]][_0x0483('0x3a')]),_0x0483('0x92'),{'id':this[_0x0483('0x12')][_0x25f71b[_0x0483('0x39')][_0x0483('0x34')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x25f71b[_0x0483('0x39')]['split']('-')[0x0]]['accountcode']});for(var _0x3e0ee9=0x0;_0x3e0ee9<Object['keys'](this['agents'])[_0x0483('0x93')];_0x3e0ee9++){var _0x1ea1da=Object[_0x0483('0x32')](this['agents'])[_0x3e0ee9];var _0x500a60=this[_0x0483('0x12')][_0x1ea1da];if(_0x500a60[_0x0483('0x3c')]===Number(_0x25f71b[_0x0483('0x37')])){this['emit'](util[_0x0483('0x38')](_0x0483('0x49'),_0x500a60['name']),'user:agentcomplete',{'id':_0x500a60['id'],'destaccountcode':_0x500a60[_0x0483('0x3c')],'transfer':this[_0x0483('0x11')][_0x25f71b['uniqueid']]['transferType']});break;}}}}var _0xc06c74=this;Promise['resolve']()['then'](function(){var _0x22363a=_0xc06c74['channels'][_0x25f71b[_0x0483('0x2a')]];if(typeof _0x22363a[_0x0483('0x94')]===_0x0483('0x95'))return;if(_['isEmpty'](_0x22363a['monitors']))return;return RpcSetting[_0x0483('0x96')]()[_0x0483('0x97')](function(_0x409fe0){if(!_0x409fe0[_0x0483('0x98')])return;return Promise[_0x0483('0x99')]()[_0x0483('0x97')](function(){return ami[_0x0483('0x9a')]({'action':'StopMixMonitor','channel':_0x22363a[_0x0483('0x39')]})[_0x0483('0x9b')](function(){});})['then'](function(){return ami[_0x0483('0x9a')]({'action':'StopMixMonitor','channel':_0x22363a[_0x0483('0x61')]})[_0x0483('0x9b')](function(){})[_0x0483('0x9c')](function(){var _0x22f893=_0xc06c74[_0x0483('0x12')][_0x22363a[_0x0483('0x61')]['split']('-')[0x0]];if(!_0x22f893)return;io[_0x0483('0x9d')](_0x0483('0x9e'),{'agentId':_0x22f893['id'],'uniqueid':_0x22363a[_0x0483('0x2a')]});});});});})[_0x0483('0x97')](function(){if(_0x25f71b[_0x0483('0x9f')]===_0x0483('0xa0')){_0xc06c74['blindTransfers'][_0x25f71b['uniqueid']]=_0x25f71b;}else{if(_0xc06c74['channels'][_0x25f71b[_0x0483('0x2a')]][_0x0483('0x5a')]==='outbound'&&_0xc06c74[_0x0483('0x42')][_0x25f71b[_0x0483('0x2a')]]){_0xc06c74['channels'][_0x25f71b['uniqueid']][_0x0483('0x2a')]=[_0xc06c74[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]][_0x0483('0x2e')],_0xc06c74[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]][_0x0483('0x2e')]=_0xc06c74[_0x0483('0x11')][_0x25f71b['uniqueid']][_0x0483('0x2a')]][0x0];delete _0xc06c74[_0x0483('0x42')][_0x25f71b[_0x0483('0x2a')]];}}logger['debug'](_0x0483('0xa1'),_0x25f71b['uniqueid'],util['inspect'](_0xc06c74[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]],{'showHidden':![],'depth':null}));ami[_0x0483('0x9d')](_0x0483('0xa2'),_0xc06c74[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]]);delete _0xc06c74[_0x0483('0x11')][_0x25f71b[_0x0483('0x2a')]];});}}}catch(_0x1feef5){logger[_0x0483('0x3d')]('[%s][voiceCallReport][hangup]',_0x25f71b['uniqueid'],util['inspect'](_0x1feef5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0483('0x28')]['syncAttendedTransfer']=function(_0x485a65){try{if(this[_0x0483('0x3f')](_0x485a65)){logger['info']('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x485a65[_0x0483('0x2a')],_0x485a65[_0x0483('0xa3')],_0x485a65[_0x0483('0xa4')]);logger[_0x0483('0x2d')](_0x0483('0xa5'),_0x485a65['uniqueid'],util[_0x0483('0x27')](_0x485a65,{'showHidden':![],'depth':null}));var _0x5eb508;if(this[_0x0483('0x11')][_0x485a65['transfereeuniqueid']]){this['channels'][_0x485a65[_0x0483('0xa6')]]['transfercalleridnum']=_0x485a65['origtransferercalleridnum'];this[_0x0483('0x11')][_0x485a65[_0x0483('0xa6')]][_0x0483('0xa7')]=_0x485a65['transfertargetcalleridnum'];if(this[_0x0483('0x11')][_0x485a65[_0x0483('0xa8')]]){_0x5eb508=this['channels'][_0x485a65['secondtransfereruniqueid']];this[_0x0483('0x11')][_0x485a65[_0x0483('0xa8')]]=this[_0x0483('0x11')][_0x485a65['transfereeuniqueid']];this[_0x0483('0x11')][_0x485a65[_0x0483('0xa6')]]=_0x5eb508;}this[_0x0483('0x11')][_0x485a65[_0x0483('0xa8')]][_0x0483('0x94')]=_0x0483('0xa9');}else if(this[_0x0483('0x11')][_0x485a65[_0x0483('0xaa')]]){this[_0x0483('0x11')][_0x485a65[_0x0483('0xaa')]]['transfercalleridnum']=_0x485a65[_0x0483('0xa3')];this['channels'][_0x485a65[_0x0483('0xaa')]][_0x0483('0xa7')]=_0x485a65[_0x0483('0xa4')];if(this['channels'][_0x485a65['origtransfereruniqueid']]){_0x5eb508=this['channels'][_0x485a65[_0x0483('0xab')]];this['channels'][_0x485a65[_0x0483('0xab')]]=this[_0x0483('0x11')][_0x485a65[_0x0483('0xaa')]];this[_0x0483('0x11')][_0x485a65['transfertargetuniqueid']]=_0x5eb508;}this[_0x0483('0x11')][_0x485a65[_0x0483('0xaa')]][_0x0483('0x94')]=_0x0483('0xa9');}if((this[_0x0483('0x11')][_0x485a65['origtransfereruniqueid']]||this[_0x0483('0x11')][_0x485a65[_0x0483('0xac')]])&&this[_0x0483('0x11')][_0x485a65['secondtransfereruniqueid']]){var _0x3d9d99=_[_0x0483('0xad')]([this[_0x0483('0x11')][_0x485a65[_0x0483('0xab')]],this[_0x0483('0x11')][_0x485a65['origtransfererlinkedid']],this[_0x0483('0x11')][_0x485a65[_0x0483('0xa8')]]],function(_0x3b37fc){return _0x3b37fc&&_0x3b37fc[_0x0483('0x5a')]==='outbound'&&_0x3b37fc[_0x0483('0xae')];});if(_0x3d9d99){if(this[_0x0483('0x11')][_0x485a65[_0x0483('0xab')]])this['channels'][_0x485a65[_0x0483('0xab')]][_0x0483('0x94')]=_0x0483('0xa9');if(this[_0x0483('0x11')][_0x485a65['origtransfererlinkedid']])this['channels'][_0x485a65['origtransfererlinkedid']]['transferType']=_0x0483('0xa9');this[_0x0483('0x11')][_0x485a65[_0x0483('0xa8')]]['transferType']=_0x0483('0xa9');}}}}catch(_0x52219b){logger[_0x0483('0x3d')](_0x0483('0xaf'),_0x485a65[_0x0483('0x2a')],util[_0x0483('0x27')](_0x52219b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0483('0x28')]['syncBlindTransfer']=function(_0x5df846){try{if(this[_0x0483('0x3f')](_0x5df846)){logger[_0x0483('0x23')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x5df846[_0x0483('0x2a')],_0x5df846['transfereecalleridnum'],_0x5df846[_0x0483('0xb0')]);logger[_0x0483('0x2d')](_0x0483('0xb1'),_0x5df846['uniqueid'],util[_0x0483('0x27')](_0x5df846,{'showHidden':![],'depth':null}));if(this[_0x0483('0x11')][_0x5df846[_0x0483('0xa6')]]){this[_0x0483('0x11')][_0x5df846[_0x0483('0xa6')]][_0x0483('0xb2')]=_0x5df846[_0x0483('0xb3')];this[_0x0483('0x11')][_0x5df846[_0x0483('0xa6')]][_0x0483('0xa7')]=_0x5df846[_0x0483('0xb0')];this[_0x0483('0x11')][_0x5df846[_0x0483('0xa6')]][_0x0483('0x94')]=_0x0483('0xb4');this[_0x0483('0x1c')]({'event':'BlindTransfer','uniqueid':_0x5df846[_0x0483('0xa6')],'linkedid':_0x5df846[_0x0483('0xb5')],'context':_0x5df846['context'],'channel':_0x5df846['transfererchannel']});}else{this[_0x0483('0x11')][_0x5df846[_0x0483('0xb5')]]['transferType']='BLIND';this['syncHangup']({'event':_0x0483('0xa0'),'uniqueid':_0x5df846['transfereruniqueid'],'linkedid':_0x5df846['transfereeuniqueid'],'context':_0x5df846['context'],'channel':_0x5df846['transfererchannel']});}}}catch(_0x5d2f20){logger[_0x0483('0x3d')](_0x0483('0xb6'),_0x5df846[_0x0483('0x2a')],util[_0x0483('0x27')](_0x5d2f20,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0483('0x28')][_0x0483('0x20')]=function(_0x407340){try{if(this[_0x0483('0x3f')](_0x407340)){logger['debug'](_0x0483('0xb7'),_0x407340[_0x0483('0x2a')],util[_0x0483('0x27')](_0x407340,{'showHidden':![],'depth':null}));if(this[_0x0483('0x11')][_0x407340[_0x0483('0x2a')]]){if(!_['isNil'](this[_0x0483('0x11')][_0x407340[_0x0483('0x2a')]][_0x0483('0x5e')])){this[_0x0483('0x11')][_0x407340[_0x0483('0x2a')]][_0x0483('0xb8')]=moment()[_0x0483('0x38')](_0x0483('0x56'));logger['info'](_0x0483('0xb9'),_0x407340[_0x0483('0x2a')],this[_0x0483('0x11')][_0x407340['uniqueid']]['mohstarttime']);}}}}catch(_0x556a09){logger[_0x0483('0x3d')](_0x0483('0xba'),_0x407340[_0x0483('0x2a')],util[_0x0483('0x27')](_0x556a09,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0483('0x28')]['syncMusicOnHoldStop']=function(_0x3823da){try{if(this[_0x0483('0x3f')](_0x3823da)){logger[_0x0483('0x2d')](_0x0483('0xbb'),_0x3823da[_0x0483('0x2a')],util[_0x0483('0x27')](_0x3823da,{'showHidden':![],'depth':null}));if(this[_0x0483('0x11')][_0x3823da[_0x0483('0x2a')]]){if(!_[_0x0483('0x6d')](this['channels'][_0x3823da[_0x0483('0x2a')]][_0x0483('0xb8')])){this[_0x0483('0x11')][_0x3823da[_0x0483('0x2a')]][_0x0483('0xbc')]+=moment()[_0x0483('0xbd')](0x0)['diff'](this[_0x0483('0x11')][_0x3823da[_0x0483('0x2a')]]['mohstarttime'],'seconds');logger['info'](_0x0483('0xbe'),_0x3823da[_0x0483('0x2a')],this[_0x0483('0x11')][_0x3823da['uniqueid']][_0x0483('0xbc')]);delete this[_0x0483('0x11')][_0x3823da[_0x0483('0x2a')]]['mohstarttime'];}}}}catch(_0xbe7abc){logger[_0x0483('0x3d')]('[%s][voiceCallReport][musiconholdstop]',_0x3823da['uniqueid'],util[_0x0483('0x27')](_0xbe7abc,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport;
\ No newline at end of file
+var _0x826a=['[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','BlindTransfer','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','moment','path','../../../config/environment','../../../config/logger','ami','../ami','../rpc/setting','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','syncNewChannel','bind','newstate','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','merge','pick','context','from-sip','split','exten','destconnectedlinenum','connectedlinenum','format','channel','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','user:%s','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','disposition','keys','lastapplication','lastdata','startsWith','cdr(','match','type','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinename','membername','UserId','routealias','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','syncHangup','destinationchannel','cause-txt','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','isEmpty','getSettings','then','stopRecordingOnTransfer','StopMixMonitor','catch','finally','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum'];(function(_0x1df5a5,_0x2ad100){var _0x14790e=function(_0x5afe3e){while(--_0x5afe3e){_0x1df5a5['push'](_0x1df5a5['shift']());}};_0x14790e(++_0x2ad100);}(_0x826a,0x1aa));var _0xa826=function(_0x3078d4,_0x175165){_0x3078d4=_0x3078d4-0x0;var _0x533f8c=_0x826a[_0x3078d4];return _0x533f8c;};'use strict';var _=require('lodash');var moment=require(_0xa826('0x0'));var util=require('util');var path=require(_0xa826('0x1'));var Redis=require('ioredis');var config=require(_0xa826('0x2'));var logger=require(_0xa826('0x3'))(_0xa826('0x4'));var ami=require(_0xa826('0x5'));var Channel=require('../model/channel');var RpcSetting=require(_0xa826('0x6'));var applications=[_0xa826('0x7'),_0xa826('0x8'),_0xa826('0x9'),_0xa826('0xa'),_0xa826('0xb'),_0xa826('0xc')];var dispositions=[_0xa826('0xd'),_0xa826('0xe'),_0xa826('0xe'),_0xa826('0xd'),_0xa826('0xd'),_0xa826('0xd'),_0xa826('0xf'),_0xa826('0x10'),_0xa826('0xe'),'FAILED',_0xa826('0xe')];config['redis']=_[_0xa826('0x11')](config[_0xa826('0x12')],{'host':_0xa826('0x13'),'port':0x18eb});var io=require(_0xa826('0x14'))(new Redis(config[_0xa826('0x12')]));function VoiceCallReport(_0x40838f){this[_0xa826('0x15')]=_0x40838f['channels'];this[_0xa826('0x16')]=_0x40838f['agents'];this[_0xa826('0x17')]={};ami['on'](_0xa826('0x18'),this['syncNewExten']['bind'](this));ami['on']('newexten',this[_0xa826('0x19')]['bind'](this));ami['on']('newchannel',this[_0xa826('0x1a')][_0xa826('0x1b')](this));ami['on'](_0xa826('0x1c'),this['syncNewState'][_0xa826('0x1b')](this));ami['on'](_0xa826('0x1d'),this[_0xa826('0x1e')][_0xa826('0x1b')](this));ami['on'](_0xa826('0x1f'),this['syncHangup'][_0xa826('0x1b')](this));ami['on'](_0xa826('0x20'),this[_0xa826('0x21')]['bind'](this));ami['on']('attendedtransfer',this[_0xa826('0x22')][_0xa826('0x1b')](this));ami['on'](_0xa826('0x23'),this[_0xa826('0x24')][_0xa826('0x1b')](this));ami['on']('musiconholdstart',this[_0xa826('0x25')][_0xa826('0x1b')](this));ami['on'](_0xa826('0x26'),this['syncMusicOnHoldStop']['bind'](this));try{logger[_0xa826('0x27')](_0xa826('0x28'));ami[_0xa826('0x29')]();}catch(_0x4eb4f3){logger[_0xa826('0x2a')](_0xa826('0x2b'),util[_0xa826('0x2c')](_0x4eb4f3,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xa826('0x2d')][_0xa826('0x2e')]=function(_0x4d6909){return _0x4d6909!==null&&!_[_0xa826('0x2f')](_0x4d6909);};VoiceCallReport['prototype'][_0xa826('0x30')]=function(_0x174f16,_0x51de9a,_0xfc0448){io['to'](_0x174f16)[_0xa826('0x30')](_0x51de9a,_0xfc0448);};VoiceCallReport[_0xa826('0x2d')][_0xa826('0x21')]=function(_0x1107a4){try{if(this[_0xa826('0x2e')](_0x1107a4)){logger[_0xa826('0x27')](_0xa826('0x31'),_0x1107a4[_0xa826('0x32')],_0x1107a4[_0xa826('0x33')],_0x1107a4[_0xa826('0x34')]);logger[_0xa826('0x35')](_0xa826('0x36'),_0x1107a4[_0xa826('0x32')],util[_0xa826('0x2c')](_0x1107a4,{'showHidden':![],'depth':null}));if(_0x1107a4[_0xa826('0x32')]===_0x1107a4['linkedid']){if(!_[_0xa826('0x2f')](this['channels'][_0x1107a4[_0xa826('0x32')]])){_[_0xa826('0x37')](this[_0xa826('0x15')][_0x1107a4[_0xa826('0x32')]],_[_0xa826('0x38')](_0x1107a4,_['keys'](this['channels'][_0x1107a4[_0xa826('0x32')]])));}}if(_0x1107a4[_0xa826('0x39')]===_0xa826('0x3a')){if(this[_0xa826('0x16')][_0x1107a4['channel'][_0xa826('0x3b')]('-')[0x0]]){if(_0x1107a4[_0xa826('0x3c')]=='xcally-motion-preview'){this[_0xa826('0x16')][_0x1107a4['channel'][_0xa826('0x3b')]('-')[0x0]][_0xa826('0x3d')]=_0x1107a4[_0xa826('0x3e')];this[_0xa826('0x30')](util[_0xa826('0x3f')]('user:%s',this[_0xa826('0x16')][_0x1107a4[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]][_0xa826('0x41')]),_0xa826('0x42'),{'destaccountcode':this[_0xa826('0x16')][_0x1107a4[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]][_0xa826('0x43')],'destconnectedlinenum':_0x1107a4[_0xa826('0x3e')]});}}}}}catch(_0xd82ea2){logger['error'](_0xa826('0x44'),_0x1107a4['uniqueid'],util[_0xa826('0x2c')](_0xd82ea2,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa826('0x1a')]=function(_0x2bae70){try{if(this[_0xa826('0x2e')](_0x2bae70)){logger[_0xa826('0x35')](_0xa826('0x45'),_0x2bae70[_0xa826('0x32')],util[_0xa826('0x2c')](_0x2bae70,{'showHidden':![],'depth':null}));if(this[_0xa826('0x15')][_0x2bae70[_0xa826('0x32')]])return;if(_0x2bae70[_0xa826('0x40')]===_0xa826('0x46'))return;if(_0x2bae70[_0xa826('0x32')]!==_0x2bae70['linkedid']&&!this[_0xa826('0x17')][_0x2bae70[_0xa826('0x47')]])return;logger[_0xa826('0x27')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x2bae70[_0xa826('0x32')],_0x2bae70[_0xa826('0x39')],_0x2bae70['exten']);this[_0xa826('0x15')][_0x2bae70['uniqueid']]=new Channel();this['channels'][_0x2bae70[_0xa826('0x32')]][_0xa826('0x48')]=moment()[_0xa826('0x3f')](_0xa826('0x49'));this[_0xa826('0x15')][_0x2bae70[_0xa826('0x32')]]['disposition']=dispositions[_[_0xa826('0x4a')](_0x2bae70[_0xa826('0x4b')])];_[_0xa826('0x37')](this[_0xa826('0x15')][_0x2bae70[_0xa826('0x32')]],_[_0xa826('0x38')](_0x2bae70,_['keys'](this[_0xa826('0x15')][_0x2bae70[_0xa826('0x32')]])));if(_0x2bae70[_0xa826('0x39')]===_0xa826('0x3a')){if(this[_0xa826('0x16')][_0x2bae70['channel'][_0xa826('0x3b')]('-')[0x0]]){if(_[_0xa826('0x2f')](this[_0xa826('0x16')][_0x2bae70[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]][_0xa826('0x3d')])){this[_0xa826('0x16')][_0x2bae70[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]][_0xa826('0x3d')]=_0x2bae70[_0xa826('0x3c')];logger[_0xa826('0x35')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x2bae70[_0xa826('0x32')],util[_0xa826('0x2c')]({'id':this[_0xa826('0x16')][_0x2bae70['channel'][_0xa826('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0xa826('0x16')][_0x2bae70[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]][_0xa826('0x43')],'destconnectedlinenum':_0x2bae70['exten']},{'showHidden':![],'depth':null}));this[_0xa826('0x30')](util[_0xa826('0x3f')](_0xa826('0x4c'),this[_0xa826('0x16')][_0x2bae70[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]][_0xa826('0x41')]),'user:agentconnect',{'id':this[_0xa826('0x16')][_0x2bae70['channel']['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x2bae70[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]][_0xa826('0x43')],'destconnectedlinenum':_0x2bae70[_0xa826('0x3c')]});}}}}}catch(_0x491cb4){logger[_0xa826('0x2a')]('[%s][voiceCallReport][newchannel]',_0x2bae70['uniqueid'],util[_0xa826('0x2c')](_0x491cb4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa826('0x2d')]['syncNewExten']=function(_0x349fc4){try{if(this[_0xa826('0x2e')](_0x349fc4)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x349fc4['uniqueid'],util['inspect'](_0x349fc4,{'showHidden':![],'depth':null}));if(_0x349fc4['channel']==='OutgoingSpoolFailed'||_0x349fc4['exten']==='h')return;if(_0x349fc4[_0xa826('0x32')]===_0x349fc4['linkedid']||this[_0xa826('0x17')][_0x349fc4['linkedid']]){_0x349fc4[_0xa826('0x4d')]=_0x349fc4[_0xa826('0x4d')][_0xa826('0x4e')]();_0x349fc4[_0xa826('0x4f')]=_0x349fc4[_0xa826('0x50')]||_0x349fc4['applicationdata'];if(_0x349fc4[_0xa826('0x50')]&&!_0x349fc4['appdata']['startsWith'](_0xa826('0x51'))&&_0x349fc4[_0xa826('0x4d')]!=='queue'){_0x349fc4[_0xa826('0x4f')]=_0x349fc4[_0xa826('0x4f')][_0xa826('0x4e')]();}logger['info'](_0xa826('0x52'),_0x349fc4[_0xa826('0x32')],_0x349fc4[_0xa826('0x4d')],_0x349fc4[_0xa826('0x4f')]);if(_[_0xa826('0x2f')](this[_0xa826('0x15')][_0x349fc4[_0xa826('0x32')]])){this[_0xa826('0x15')][_0x349fc4['uniqueid']]=new Channel();this[_0xa826('0x15')][_0x349fc4[_0xa826('0x32')]][_0xa826('0x48')]=_0x349fc4[_0xa826('0x53')]?moment()[_0xa826('0x54')](moment['duration'](_0x349fc4[_0xa826('0x53')])[_0xa826('0x55')](),_0xa826('0x55'))['format'](_0xa826('0x49')):moment()[_0xa826('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa826('0x15')][_0x349fc4[_0xa826('0x32')]][_0xa826('0x56')]=_0xa826('0xd');}_[_0xa826('0x37')](this[_0xa826('0x15')][_0x349fc4[_0xa826('0x32')]],_[_0xa826('0x38')](_0x349fc4,_[_0xa826('0x57')](this[_0xa826('0x15')][_0x349fc4[_0xa826('0x32')]])));if(_['includes'](applications,_0x349fc4[_0xa826('0x4d')])){this[_0xa826('0x15')][_0x349fc4[_0xa826('0x32')]][_0xa826('0x58')]=_0x349fc4[_0xa826('0x4d')];this[_0xa826('0x15')][_0x349fc4[_0xa826('0x32')]][_0xa826('0x59')]=_0x349fc4['applicationdata'];if(_0x349fc4[_0xa826('0x4d')]===_0xa826('0x7')&&_[_0xa826('0x5a')](_0x349fc4['applicationdata'][_0xa826('0x4e')](),_0xa826('0x5b'))){var _0x2827cc=_0x349fc4['applicationdata']['split']('=');var _0x459a40=_0x2827cc[0x0][_0xa826('0x4e')]()[_0xa826('0x5c')](/cdr\((.*)\)/);if(_0x459a40){if(_0x459a40[0x1]===_0xa826('0x5d')&&!_['isNil'](this[_0xa826('0x15')][_0x349fc4[_0xa826('0x32')]][_0x459a40[0x1]]))return;this[_0xa826('0x15')][_0x349fc4[_0xa826('0x32')]][_0x459a40[0x1]]=_0x2827cc[0x1];}}else if(_0x349fc4[_0xa826('0x4d')]===_0xa826('0x8')){this[_0xa826('0x15')][_0x349fc4[_0xa826('0x32')]][_0xa826('0x8')]=_0x349fc4['applicationdata']['split'](',')[0x0];}}}}}catch(_0x5d257b){logger['error'](_0xa826('0x5e'),_0x349fc4[_0xa826('0x32')],util[_0xa826('0x2c')](_0x5d257b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa826('0x2d')][_0xa826('0x5f')]=function(_0x23541c){try{if(this['isNotNull'](_0x23541c)){logger[_0xa826('0x27')](_0xa826('0x60'),_0x23541c[_0xa826('0x32')],_0x23541c['linkedid'],_0x23541c[_0xa826('0x33')],_0x23541c[_0xa826('0x34')]);logger[_0xa826('0x35')](_0xa826('0x61'),_0x23541c[_0xa826('0x32')],util[_0xa826('0x2c')](_0x23541c,{'showHidden':![],'depth':null}));if(_0x23541c[_0xa826('0x4b')]!=='6')return;if(_0x23541c[_0xa826('0x32')]!==_0x23541c[_0xa826('0x47')]){var _0x609ddf=moment();if(this[_0xa826('0x15')][_0x23541c[_0xa826('0x47')]]){if(!this[_0xa826('0x15')][_0x23541c[_0xa826('0x47')]][_0xa826('0x62')]){this['channels'][_0x23541c[_0xa826('0x47')]]['answered']=!![];this[_0xa826('0x15')][_0x23541c['linkedid']][_0xa826('0x63')]=_0x609ddf['format'](_0xa826('0x49'));if(this[_0xa826('0x15')][_0x23541c[_0xa826('0x47')]]['starttime']){this['channels'][_0x23541c['linkedid']][_0xa826('0x64')]=_0x609ddf[_0xa826('0x65')](this[_0xa826('0x15')][_0x23541c['linkedid']][_0xa826('0x48')],_0xa826('0x55'));}}this[_0xa826('0x15')][_0x23541c[_0xa826('0x47')]]['linkedid']=_0x23541c[_0xa826('0x32')];if(_0x23541c[_0xa826('0x34')]!==_0xa826('0x66')){this[_0xa826('0x15')][_0x23541c[_0xa826('0x47')]]['connectedlinenum']=_0x23541c['calleridnum'];}this[_0xa826('0x15')][_0x23541c[_0xa826('0x47')]][_0xa826('0x67')]=_0x23541c[_0xa826('0x33')];this[_0xa826('0x15')][_0x23541c['linkedid']]['destinationchannel']=_0x23541c[_0xa826('0x40')];this[_0xa826('0x15')][_0x23541c[_0xa826('0x47')]][_0xa826('0x56')]=dispositions[_[_0xa826('0x4a')](_0x23541c[_0xa826('0x4b')])];if(this['agents'][_0x23541c[_0xa826('0x40')]['split']('-')[0x0]]){this[_0xa826('0x15')][_0x23541c[_0xa826('0x47')]]['UserId']=this[_0xa826('0x16')][_0x23541c['channel'][_0xa826('0x3b')]('-')[0x0]]['id'];this['channels'][_0x23541c[_0xa826('0x47')]][_0xa826('0x68')]=this[_0xa826('0x16')][_0x23541c[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]][_0xa826('0x41')];}}if(this['channels'][_0x23541c['uniqueid']]){if(!this[_0xa826('0x15')][_0x23541c['uniqueid']][_0xa826('0x62')]){this[_0xa826('0x15')][_0x23541c[_0xa826('0x32')]]['answered']=!![];this[_0xa826('0x15')][_0x23541c[_0xa826('0x32')]][_0xa826('0x63')]=_0x609ddf[_0xa826('0x3f')](_0xa826('0x49'));if(this['channels'][_0x23541c[_0xa826('0x32')]][_0xa826('0x48')]){this[_0xa826('0x15')][_0x23541c[_0xa826('0x32')]][_0xa826('0x64')]=_0x609ddf[_0xa826('0x65')](this[_0xa826('0x15')][_0x23541c[_0xa826('0x32')]][_0xa826('0x48')],_0xa826('0x55'));}}if(_0x23541c['calleridnum']!==_0xa826('0x66')){this[_0xa826('0x15')][_0x23541c['uniqueid']]['connectedlinenum']=_0x23541c[_0xa826('0x34')];}this[_0xa826('0x15')][_0x23541c['uniqueid']][_0xa826('0x67')]=_0x23541c[_0xa826('0x33')];this[_0xa826('0x15')][_0x23541c[_0xa826('0x32')]]['destinationchannel']=_0x23541c['channel'];this[_0xa826('0x15')][_0x23541c[_0xa826('0x32')]]['disposition']=dispositions[_[_0xa826('0x4a')](_0x23541c[_0xa826('0x4b')])];}}else{if(this[_0xa826('0x15')][_0x23541c[_0xa826('0x32')]]){if(this[_0xa826('0x16')][_0x23541c[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]]){this[_0xa826('0x15')][_0x23541c['uniqueid']][_0xa826('0x69')]=this[_0xa826('0x16')][_0x23541c[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]]['id'];this['channels'][_0x23541c[_0xa826('0x32')]][_0xa826('0x68')]=this[_0xa826('0x16')][_0x23541c[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]][_0xa826('0x41')];}}}if(_0x23541c[_0xa826('0x39')]==='from-sip'){if(this[_0xa826('0x16')][_0x23541c[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]]){this[_0xa826('0x16')][_0x23541c[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]]['destconnectedlinenum']=_0x23541c[_0xa826('0x3c')];var _0x43de97,_0x2436e2;if(this['channels'][_0x23541c[_0xa826('0x32')]]){_0x43de97=this[_0xa826('0x15')][_0x23541c[_0xa826('0x32')]][_0xa826('0x6a')];_0x2436e2=this['channels'][_0x23541c[_0xa826('0x32')]][_0xa826('0x8')];}else if(this['channels'][_0x23541c[_0xa826('0x47')]]){_0x43de97=this['channels'][_0x23541c[_0xa826('0x47')]][_0xa826('0x6a')];_0x2436e2=this[_0xa826('0x15')][_0x23541c[_0xa826('0x47')]][_0xa826('0x8')];}logger[_0xa826('0x35')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x23541c[_0xa826('0x32')],util[_0xa826('0x2c')]({'id':this[_0xa826('0x16')][_0x23541c[_0xa826('0x40')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xa826('0x16')][_0x23541c[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]][_0xa826('0x43')],'destconnectedlinenum':_0x23541c[_0xa826('0x3c')],'routealias':_0x43de97,'queue':_0x2436e2||undefined},{'showHidden':![],'depth':null}));this[_0xa826('0x30')](util[_0xa826('0x3f')](_0xa826('0x4c'),this['agents'][_0x23541c['channel'][_0xa826('0x3b')]('-')[0x0]][_0xa826('0x41')]),_0xa826('0x42'),{'id':this[_0xa826('0x16')][_0x23541c[_0xa826('0x40')]['split']('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this['agents'][_0x23541c[_0xa826('0x40')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x23541c[_0xa826('0x3c')],'routealias':_0x43de97,'queue':_0x2436e2||undefined});}}}}catch(_0x4755ff){logger[_0xa826('0x2a')](_0xa826('0x6b'),_0x23541c['uniqueid'],util['inspect'](_0x4755ff,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa826('0x2d')][_0xa826('0x6c')]=function(_0x2ee12f,_0x3bc26e){try{if(this[_0xa826('0x15')][_0x2ee12f]){logger[_0xa826('0x27')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x2ee12f,_0x3bc26e);this[_0xa826('0x15')][_0x2ee12f][_0xa826('0x6d')]=!![];if(_[_0xa826('0x6e')](_0x3bc26e,_0xa826('0x6f'))){_0x3bc26e=_0x3bc26e[_0xa826('0x70')]('.wav49',_0xa826('0x71'));}this['channels'][_0x2ee12f][_0xa826('0x72')]=_0x3bc26e;var _0x1ad497=_[_0xa826('0x73')](this[_0xa826('0x15')][_0x2ee12f][_0xa826('0x74')],{'filename':_0x3bc26e});if(_[_0xa826('0x75')](_0x1ad497)){this[_0xa826('0x15')][_0x2ee12f][_0xa826('0x74')]['push']({'filename':_0x3bc26e,'createdAt':moment()[_0xa826('0x3f')](_0xa826('0x49')),'mixmonitorid':'','status':_0xa826('0x76')});}}}catch(_0x2d1711){logger[_0xa826('0x2a')](_0xa826('0x77'),_0x2ee12f,util[_0xa826('0x2c')](_0x2d1711,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa826('0x2d')][_0xa826('0x1e')]=function(_0x1bf3ea){try{if(this[_0xa826('0x2e')](_0x1bf3ea)){logger['debug'](_0xa826('0x78'),_0x1bf3ea[_0xa826('0x32')],util[_0xa826('0x2c')](_0x1bf3ea,{'showHidden':![],'depth':null}));if(this[_0xa826('0x15')][_0x1bf3ea[_0xa826('0x32')]]&&_0x1bf3ea[_0xa826('0x40')]!='OutgoingSpoolFailed'){if(this[_0xa826('0x2e')](_0x1bf3ea[_0xa826('0x79')])){if(this[_0xa826('0x2e')](_0x1bf3ea['variable'][_0xa826('0x7a')])){logger['info'](_0xa826('0x7b'),_0x1bf3ea[_0xa826('0x32')],_0x1bf3ea['value']);this['syncMixMonitorFilename'](_0x1bf3ea[_0xa826('0x32')],_0x1bf3ea[_0xa826('0x7c')]);}else if(this['isNotNull'](_0x1bf3ea['variable'][_0xa826('0x7d')])){logger['info'](_0xa826('0x7e'),_0x1bf3ea['uniqueid'],_0x1bf3ea['value']);this[_0xa826('0x15')][_0x1bf3ea['uniqueid']][_0xa826('0x34')]=_0x1bf3ea['value'];}else if(this[_0xa826('0x2e')](_0x1bf3ea['variable']['xmd-callerid'])){logger[_0xa826('0x27')](_0xa826('0x7f'),_0x1bf3ea['uniqueid'],_0x1bf3ea[_0xa826('0x7c')]);this['channels'][_0x1bf3ea[_0xa826('0x32')]][_0xa826('0x80')]=_0x1bf3ea['value'];}else if(this['isNotNull'](_0x1bf3ea['variable']['xmd-cdrtype'])){logger[_0xa826('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x1bf3ea[_0xa826('0x32')],_0x1bf3ea[_0xa826('0x7c')]);this[_0xa826('0x15')][_0x1bf3ea['uniqueid']][_0xa826('0x5d')]=_0x1bf3ea[_0xa826('0x7c')];}else if(this[_0xa826('0x2e')](_0x1bf3ea[_0xa826('0x79')]['xmd-queue'])){logger[_0xa826('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x1bf3ea[_0xa826('0x32')],_0x1bf3ea[_0xa826('0x7c')][_0xa826('0x3b')](',')[0x0]);this[_0xa826('0x15')][_0x1bf3ea[_0xa826('0x32')]][_0xa826('0x8')]=_0x1bf3ea[_0xa826('0x7c')][_0xa826('0x3b')](',')[0x0];}else if(this[_0xa826('0x2e')](_0x1bf3ea[_0xa826('0x79')][_0xa826('0x81')])){logger[_0xa826('0x27')](_0xa826('0x82'),_0x1bf3ea[_0xa826('0x32')],_0x1bf3ea['value']);this[_0xa826('0x15')][_0x1bf3ea['uniqueid']][_0xa826('0x83')]=_0x1bf3ea[_0xa826('0x7c')];}else if(this[_0xa826('0x2e')](_0x1bf3ea[_0xa826('0x79')][_0xa826('0x84')])){logger[_0xa826('0x27')](_0xa826('0x85'),_0x1bf3ea[_0xa826('0x32')],_0x1bf3ea[_0xa826('0x7c')]);this[_0xa826('0x15')][_0x1bf3ea[_0xa826('0x32')]][_0xa826('0x86')]=_0x1bf3ea['value'];}else if(this[_0xa826('0x2e')](_0x1bf3ea[_0xa826('0x79')][_0xa826('0x87')])){logger['info'](_0xa826('0x88'),_0x1bf3ea[_0xa826('0x32')],_0x1bf3ea[_0xa826('0x7c')]);this['channels'][_0x1bf3ea[_0xa826('0x32')]][_0xa826('0x89')]=_0x1bf3ea[_0xa826('0x7c')];}else if(this[_0xa826('0x2e')](_0x1bf3ea[_0xa826('0x79')][_0xa826('0x8a')])){logger[_0xa826('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x1bf3ea[_0xa826('0x32')],_0x1bf3ea[_0xa826('0x7c')]);this[_0xa826('0x15')][_0x1bf3ea[_0xa826('0x32')]][_0xa826('0x8')]=_0x1bf3ea[_0xa826('0x7c')];}else if(this[_0xa826('0x2e')](_0x1bf3ea[_0xa826('0x79')][_0xa826('0x8b')])){logger[_0xa826('0x27')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x1bf3ea[_0xa826('0x32')],_0x1bf3ea[_0xa826('0x7c')]);this['channels'][_0x1bf3ea[_0xa826('0x32')]][_0xa826('0x8c')]=_0x1bf3ea[_0xa826('0x7c')];}}}else if(this['isNotNull'](_0x1bf3ea[_0xa826('0x79')][_0xa826('0x7a')])){if(_0x1bf3ea[_0xa826('0x7c')]){var _0x24190a=path[_0xa826('0x8d')](_0x1bf3ea[_0xa826('0x7c')])['name'];logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x24190a,_0x1bf3ea[_0xa826('0x7c')]);this[_0xa826('0x6c')](_0x24190a,_0x1bf3ea['value']);}}else if(this['channels'][_0x1bf3ea[_0xa826('0x47')]]){if(this[_0xa826('0x2e')](_0x1bf3ea[_0xa826('0x79')])){if(this[_0xa826('0x2e')](_0x1bf3ea[_0xa826('0x79')][_0xa826('0x8b')])){logger[_0xa826('0x27')](_0xa826('0x8e'),_0x1bf3ea[_0xa826('0x47')],_0x1bf3ea['value']);this[_0xa826('0x15')][_0x1bf3ea[_0xa826('0x47')]][_0xa826('0x8f')]=_0x1bf3ea[_0xa826('0x7c')];}}}}}catch(_0x6fed86){logger['error']('[%s][voiceCallReport][varset]',_0x1bf3ea[_0xa826('0x32')],util[_0xa826('0x2c')](_0x6fed86,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa826('0x90')]=function(_0x265609){try{if(this['isNotNull'](_0x265609)){logger[_0xa826('0x35')]('[%s][voiceCallReport][hangup]\x20event:',_0x265609['uniqueid'],util['inspect'](_0x265609,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x265609[_0xa826('0x47')]]){if(this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609[_0xa826('0x47')]][_0xa826('0x47')]]){this['channels'][this['blindTransfers'][_0x265609[_0xa826('0x47')]][_0xa826('0x47')]][_0xa826('0x32')]=_0x265609['uniqueid'];this['channels'][this[_0xa826('0x17')][_0x265609[_0xa826('0x47')]]['linkedid']]['answered']=this[_0xa826('0x15')][_0x265609[_0xa826('0x32')]]['answered'];this[_0xa826('0x15')][this['blindTransfers'][_0x265609[_0xa826('0x47')]][_0xa826('0x47')]][_0xa826('0x63')]=this['channels'][_0x265609[_0xa826('0x32')]]['answertime'];this[_0xa826('0x15')][this['blindTransfers'][_0x265609[_0xa826('0x47')]][_0xa826('0x47')]]['destinationchannel']=this['channels'][this[_0xa826('0x17')][_0x265609['linkedid']][_0xa826('0x47')]][_0xa826('0x40')];this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609[_0xa826('0x47')]][_0xa826('0x47')]]['disposition']=this[_0xa826('0x15')][_0x265609['uniqueid']][_0xa826('0x56')];this['channels'][_0x265609[_0xa826('0x32')]]=this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609[_0xa826('0x47')]][_0xa826('0x47')]];delete this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609[_0xa826('0x47')]][_0xa826('0x47')]];}else if(this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609[_0xa826('0x47')]][_0xa826('0x32')]]){this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609[_0xa826('0x47')]][_0xa826('0x32')]][_0xa826('0x32')]=[this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609[_0xa826('0x47')]]['uniqueid']][_0xa826('0x47')],this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609[_0xa826('0x47')]][_0xa826('0x32')]][_0xa826('0x47')]=this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609['linkedid']][_0xa826('0x32')]][_0xa826('0x32')]][0x0];this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609[_0xa826('0x47')]]['uniqueid']]['answered']=this['channels'][_0x265609[_0xa826('0x32')]][_0xa826('0x62')];this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609['linkedid']]['uniqueid']][_0xa826('0x63')]=this[_0xa826('0x15')][_0x265609[_0xa826('0x32')]]['answertime'];this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609['linkedid']][_0xa826('0x32')]][_0xa826('0x91')]=this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609[_0xa826('0x47')]][_0xa826('0x32')]][_0xa826('0x40')];this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609[_0xa826('0x47')]][_0xa826('0x32')]][_0xa826('0x56')]=this[_0xa826('0x15')][_0x265609[_0xa826('0x32')]][_0xa826('0x56')];this['channels'][_0x265609['uniqueid']]=this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609[_0xa826('0x47')]]['uniqueid']];delete this[_0xa826('0x15')][this[_0xa826('0x17')][_0x265609['linkedid']][_0xa826('0x32')]];}}if(this['channels'][_0x265609[_0xa826('0x32')]]){logger[_0xa826('0x27')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x265609[_0xa826('0x32')],_0x265609[_0xa826('0x92')]);var _0x2a0423=moment();this[_0xa826('0x15')][_0x265609[_0xa826('0x32')]]['endtime']=_0x2a0423['format'](_0xa826('0x49'));this[_0xa826('0x15')][_0x265609['uniqueid']][_0xa826('0x53')]=_0x2a0423[_0xa826('0x65')](this[_0xa826('0x15')][_0x265609[_0xa826('0x32')]]['starttime'],'seconds');if(this[_0xa826('0x15')][_0x265609[_0xa826('0x32')]][_0xa826('0x62')]){this[_0xa826('0x15')][_0x265609[_0xa826('0x32')]][_0xa826('0x93')]=_0x2a0423[_0xa826('0x65')](this[_0xa826('0x15')][_0x265609[_0xa826('0x32')]]['answertime'],_0xa826('0x55'));this[_0xa826('0x15')][_0x265609[_0xa826('0x32')]][_0xa826('0x64')]=this[_0xa826('0x15')][_0x265609[_0xa826('0x32')]]['duration']-this[_0xa826('0x15')][_0x265609[_0xa826('0x32')]][_0xa826('0x93')];}if(_0x265609[_0xa826('0x39')]===_0xa826('0x3a')){if(this[_0xa826('0x16')][_0x265609['channel'][_0xa826('0x3b')]('-')[0x0]]){this[_0xa826('0x16')][_0x265609[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]]=_['omit'](this['agents'][_0x265609['channel'][_0xa826('0x3b')]('-')[0x0]],[_0xa826('0x3d')]);logger[_0xa826('0x35')](_0xa826('0x94'),_0x265609['uniqueid'],util[_0xa826('0x2c')]({'id':this[_0xa826('0x16')][_0x265609['channel'][_0xa826('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0xa826('0x16')][_0x265609[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]][_0xa826('0x43')]},{'showHidden':![],'depth':null}));this[_0xa826('0x30')](util[_0xa826('0x3f')](_0xa826('0x4c'),this['agents'][_0x265609[_0xa826('0x40')]['split']('-')[0x0]][_0xa826('0x41')]),_0xa826('0x95'),{'id':this[_0xa826('0x16')][_0x265609[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0xa826('0x16')][_0x265609[_0xa826('0x40')][_0xa826('0x3b')]('-')[0x0]][_0xa826('0x43')]});for(var _0x4a86c8=0x0;_0x4a86c8<Object[_0xa826('0x57')](this[_0xa826('0x16')])[_0xa826('0x96')];_0x4a86c8++){var _0x389893=Object['keys'](this['agents'])[_0x4a86c8];var _0x49c909=this[_0xa826('0x16')][_0x389893];if(_0x49c909[_0xa826('0x43')]===Number(_0x265609[_0xa826('0x3e')])){this[_0xa826('0x30')](util[_0xa826('0x3f')](_0xa826('0x4c'),_0x49c909[_0xa826('0x41')]),_0xa826('0x95'),{'id':_0x49c909['id'],'destaccountcode':_0x49c909['accountcode'],'transfer':this[_0xa826('0x15')][_0x265609['uniqueid']][_0xa826('0x97')]});break;}}}}var _0x4d1337=this;Promise[_0xa826('0x98')]()['then'](function(){var _0x9b8ec0=_0x4d1337[_0xa826('0x15')][_0x265609['uniqueid']];if(typeof _0x9b8ec0[_0xa826('0x97')]==='undefined')return;if(_[_0xa826('0x99')](_0x9b8ec0['monitors']))return;return RpcSetting[_0xa826('0x9a')]()[_0xa826('0x9b')](function(_0x41d9a2){if(!_0x41d9a2[_0xa826('0x9c')])return;return Promise[_0xa826('0x98')]()[_0xa826('0x9b')](function(){return ami['Action']({'action':_0xa826('0x9d'),'channel':_0x9b8ec0['channel']})['catch'](function(){});})[_0xa826('0x9b')](function(){return ami['Action']({'action':'StopMixMonitor','channel':_0x9b8ec0['destinationchannel']})[_0xa826('0x9e')](function(){})[_0xa826('0x9f')](function(){var _0xd4bf5f=_0x4d1337[_0xa826('0x16')][_0x9b8ec0[_0xa826('0x91')]['split']('-')[0x0]];if(!_0xd4bf5f)return;io[_0xa826('0x30')](_0xa826('0xa0'),{'agentId':_0xd4bf5f['id'],'uniqueid':_0x9b8ec0['uniqueid']});});});});})[_0xa826('0x9b')](function(){if(_0x265609[_0xa826('0xa1')]==='BlindTransfer'){_0x4d1337[_0xa826('0x17')][_0x265609[_0xa826('0x32')]]=_0x265609;}else{if(_0x4d1337[_0xa826('0x15')][_0x265609[_0xa826('0x32')]]['type']===_0xa826('0xa2')&&_0x4d1337[_0xa826('0x17')][_0x265609[_0xa826('0x32')]]){_0x4d1337['channels'][_0x265609[_0xa826('0x32')]][_0xa826('0x32')]=[_0x4d1337[_0xa826('0x15')][_0x265609[_0xa826('0x32')]][_0xa826('0x47')],_0x4d1337[_0xa826('0x15')][_0x265609[_0xa826('0x32')]]['linkedid']=_0x4d1337['channels'][_0x265609['uniqueid']][_0xa826('0x32')]][0x0];delete _0x4d1337[_0xa826('0x17')][_0x265609['uniqueid']];}}logger[_0xa826('0x35')](_0xa826('0xa3'),_0x265609[_0xa826('0x32')],util['inspect'](_0x4d1337[_0xa826('0x15')][_0x265609[_0xa826('0x32')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceCallReport',_0x4d1337[_0xa826('0x15')][_0x265609[_0xa826('0x32')]]);delete _0x4d1337['channels'][_0x265609[_0xa826('0x32')]];});}}}catch(_0x149ec5){logger[_0xa826('0x2a')](_0xa826('0xa4'),_0x265609[_0xa826('0x32')],util[_0xa826('0x2c')](_0x149ec5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa826('0x2d')]['syncAttendedTransfer']=function(_0x2ebe9c){try{if(this[_0xa826('0x2e')](_0x2ebe9c)){logger[_0xa826('0x27')](_0xa826('0xa5'),_0x2ebe9c[_0xa826('0x32')],_0x2ebe9c[_0xa826('0xa6')],_0x2ebe9c[_0xa826('0xa7')]);logger['debug'](_0xa826('0xa8'),_0x2ebe9c[_0xa826('0x32')],util[_0xa826('0x2c')](_0x2ebe9c,{'showHidden':![],'depth':null}));var _0x179f34;if(this['channels'][_0x2ebe9c['transfereeuniqueid']]){this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xa9')]]['transfercalleridnum']=_0x2ebe9c['origtransferercalleridnum'];this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xa9')]][_0xa826('0xaa')]=_0x2ebe9c[_0xa826('0xa7')];if(this['channels'][_0x2ebe9c[_0xa826('0xab')]]){_0x179f34=this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xab')]];this['channels'][_0x2ebe9c[_0xa826('0xab')]]=this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xa9')]];this['channels'][_0x2ebe9c[_0xa826('0xa9')]]=_0x179f34;}this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xab')]][_0xa826('0x97')]='ATTENDED';}else if(this[_0xa826('0x15')][_0x2ebe9c['transfertargetuniqueid']]){this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xac')]][_0xa826('0xad')]=_0x2ebe9c[_0xa826('0xa6')];this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xac')]][_0xa826('0xaa')]=_0x2ebe9c[_0xa826('0xa7')];if(this[_0xa826('0x15')][_0x2ebe9c['origtransfereruniqueid']]){_0x179f34=this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xae')]];this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xae')]]=this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xac')]];this['channels'][_0x2ebe9c[_0xa826('0xac')]]=_0x179f34;}this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xac')]][_0xa826('0x97')]=_0xa826('0xaf');}if((this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xae')]]||this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xb0')]])&&this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xab')]]){var _0x473fa6=_[_0xa826('0xb1')]([this['channels'][_0x2ebe9c[_0xa826('0xae')]],this['channels'][_0x2ebe9c[_0xa826('0xb0')]],this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xab')]]],function(_0x5cb763){return _0x5cb763&&_0x5cb763[_0xa826('0x5d')]===_0xa826('0xa2')&&_0x5cb763[_0xa826('0xb2')];});if(_0x473fa6){if(this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xae')]])this[_0xa826('0x15')][_0x2ebe9c['origtransfereruniqueid']][_0xa826('0x97')]=_0xa826('0xaf');if(this[_0xa826('0x15')][_0x2ebe9c[_0xa826('0xb0')]])this[_0xa826('0x15')][_0x2ebe9c['origtransfererlinkedid']][_0xa826('0x97')]=_0xa826('0xaf');this[_0xa826('0x15')][_0x2ebe9c['secondtransfereruniqueid']][_0xa826('0x97')]=_0xa826('0xaf');}}}}catch(_0x5ef34f){logger[_0xa826('0x2a')](_0xa826('0xb3'),_0x2ebe9c[_0xa826('0x32')],util[_0xa826('0x2c')](_0x5ef34f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa826('0x2d')][_0xa826('0x24')]=function(_0x412107){try{if(this[_0xa826('0x2e')](_0x412107)){logger[_0xa826('0x27')](_0xa826('0xb4'),_0x412107[_0xa826('0x32')],_0x412107[_0xa826('0xb5')],_0x412107[_0xa826('0xb6')]);logger[_0xa826('0x35')](_0xa826('0xb7'),_0x412107[_0xa826('0x32')],util['inspect'](_0x412107,{'showHidden':![],'depth':null}));if(this[_0xa826('0x15')][_0x412107[_0xa826('0xa9')]]){this['channels'][_0x412107['transfereeuniqueid']][_0xa826('0xad')]=_0x412107[_0xa826('0xb5')];this['channels'][_0x412107[_0xa826('0xa9')]][_0xa826('0xaa')]=_0x412107['extension'];this[_0xa826('0x15')][_0x412107[_0xa826('0xa9')]][_0xa826('0x97')]=_0xa826('0xb8');this[_0xa826('0x90')]({'event':_0xa826('0xb9'),'uniqueid':_0x412107['transfereeuniqueid'],'linkedid':_0x412107['transfereruniqueid'],'context':_0x412107['context'],'channel':_0x412107[_0xa826('0xba')]});}else{this[_0xa826('0x15')][_0x412107[_0xa826('0xbb')]][_0xa826('0x97')]='BLIND';this[_0xa826('0x90')]({'event':_0xa826('0xb9'),'uniqueid':_0x412107['transfereruniqueid'],'linkedid':_0x412107[_0xa826('0xa9')],'context':_0x412107[_0xa826('0x39')],'channel':_0x412107[_0xa826('0xba')]});}}}catch(_0x464b01){logger[_0xa826('0x2a')](_0xa826('0xbc'),_0x412107['uniqueid'],util[_0xa826('0x2c')](_0x464b01,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa826('0x25')]=function(_0x3f9b28){try{if(this[_0xa826('0x2e')](_0x3f9b28)){logger[_0xa826('0x35')](_0xa826('0xbd'),_0x3f9b28[_0xa826('0x32')],util[_0xa826('0x2c')](_0x3f9b28,{'showHidden':![],'depth':null}));if(this[_0xa826('0x15')][_0x3f9b28[_0xa826('0x32')]]){if(!_[_0xa826('0x75')](this[_0xa826('0x15')][_0x3f9b28[_0xa826('0x32')]][_0xa826('0x63')])){this[_0xa826('0x15')][_0x3f9b28[_0xa826('0x32')]][_0xa826('0xbe')]=moment()[_0xa826('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xa826('0x27')](_0xa826('0xbf'),_0x3f9b28[_0xa826('0x32')],this[_0xa826('0x15')][_0x3f9b28['uniqueid']][_0xa826('0xbe')]);}}}}catch(_0x527cc4){logger[_0xa826('0x2a')](_0xa826('0xc0'),_0x3f9b28[_0xa826('0x32')],util[_0xa826('0x2c')](_0x527cc4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa826('0x2d')][_0xa826('0xc1')]=function(_0x41bc57){try{if(this['isNotNull'](_0x41bc57)){logger[_0xa826('0x35')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x41bc57['uniqueid'],util[_0xa826('0x2c')](_0x41bc57,{'showHidden':![],'depth':null}));if(this[_0xa826('0x15')][_0x41bc57[_0xa826('0x32')]]){if(!_[_0xa826('0x75')](this['channels'][_0x41bc57['uniqueid']]['mohstarttime'])){this[_0xa826('0x15')][_0x41bc57['uniqueid']][_0xa826('0xc2')]+=moment()[_0xa826('0xc3')](0x0)['diff'](this[_0xa826('0x15')][_0x41bc57[_0xa826('0x32')]][_0xa826('0xbe')],_0xa826('0x55'));logger['info'](_0xa826('0xc4'),_0x41bc57['uniqueid'],this[_0xa826('0x15')][_0x41bc57[_0xa826('0x32')]][_0xa826('0xc2')]);delete this[_0xa826('0x15')][_0x41bc57[_0xa826('0x32')]][_0xa826('0xbe')];}}}}catch(_0x2ef89a){logger['error']('[%s][voiceCallReport][musiconholdstop]',_0x41bc57[_0xa826('0x32')],util[_0xa826('0x2c')](_0x2ef89a,{'showHidden':![],'depth':null}));}};module[_0xa826('0xc5')]=VoiceCallReport;
\ No newline at end of file
index 9dc30c7..361de60 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfdbd=['appdata','startsWith','cdr(','application','match','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','channels','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','inspect','applications','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','dialstatus','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialend]','addVariable','keys','variable','outboundrouteid','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','duration','starttime','seconds','complete','total','holdtime','diff','billableseconds','sumHoldTime','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','set','applicationdata'];(function(_0x459350,_0x38c4d3){var _0x2f4f45=function(_0x1a0107){while(--_0x1a0107){_0x459350['push'](_0x459350['shift']());}};_0x2f4f45(++_0x38c4d3);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x5814ca,_0x3b6713){_0x5814ca=_0x5814ca-0x0;var _0xeb1833=_0xfdbd[_0x5814ca];return _0xeb1833;};'use strict';var _=require(_0xdfdb('0x0'));var moment=require(_0xdfdb('0x1'));var util=require(_0xdfdb('0x2'));var Redis=require(_0xdfdb('0x3'));var config=require(_0xdfdb('0x4'));var logger=require(_0xdfdb('0x5'))(_0xdfdb('0x6'));var ami=require(_0xdfdb('0x7'));config[_0xdfdb('0x8')]=_['defaults'](config[_0xdfdb('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xdfdb('0x9'))(new Redis(config[_0xdfdb('0x8')]));function VoiceDialReport(_0x489f19){this['channels']=_0x489f19['outboundChannels'];this[_0xdfdb('0xa')]=_0x489f19[_0xdfdb('0xa')];this['applications']={};this[_0xdfdb('0xb')]={};ami['on'](_0xdfdb('0xc'),this[_0xdfdb('0xd')][_0xdfdb('0xe')](this));ami['on'](_0xdfdb('0xf'),this[_0xdfdb('0x10')][_0xdfdb('0xe')](this));ami['on']('varset',this[_0xdfdb('0x11')][_0xdfdb('0xe')](this));ami['on']('hangup',this[_0xdfdb('0x12')][_0xdfdb('0xe')](this));}VoiceDialReport[_0xdfdb('0x13')][_0xdfdb('0x14')]=function(_0x2a95f1){return _0x2a95f1!==null&&!_[_0xdfdb('0x15')](_0x2a95f1);};VoiceDialReport[_0xdfdb('0x13')][_0xdfdb('0x16')]=function(_0x51162f,_0x48a66a,_0x2c44dc){io['to'](_0x51162f)['emit'](_0x48a66a,_0x2c44dc);};VoiceDialReport[_0xdfdb('0x13')][_0xdfdb('0xd')]=function(_0x11a56a){try{if(this[_0xdfdb('0x14')](_0x11a56a)){logger[_0xdfdb('0x17')](_0xdfdb('0x18'),_0x11a56a['uniqueid'],util['inspect'](_0x11a56a,{'showHidden':![],'depth':null}));if(this[_0xdfdb('0x19')][_0x11a56a[_0xdfdb('0x1a')]]){_[_0xdfdb('0x1b')](this['channels'][_0x11a56a[_0xdfdb('0x1a')]],{'starttime':moment()[_0xdfdb('0x1c')](_0xdfdb('0x1d')),'lastevent':_0xdfdb('0x1e'),'interface':_0x11a56a[_0xdfdb('0x1f')][_0xdfdb('0x20')](0x0,_0x11a56a[_0xdfdb('0x1f')][_0xdfdb('0x21')]('-')),'membername':_0x11a56a['channel'][_0xdfdb('0x20')](_0x11a56a[_0xdfdb('0x1f')][_0xdfdb('0x21')]('/')+0x1,_0x11a56a['channel'][_0xdfdb('0x21')]('-'))},_[_0xdfdb('0x22')](_0x11a56a,[_0xdfdb('0x23'),'privilege']));logger[_0xdfdb('0x24')](_0xdfdb('0x25'),_0x11a56a[_0xdfdb('0x1a')],this['channels'][_0x11a56a[_0xdfdb('0x1a')]]['membername'],this[_0xdfdb('0x19')][_0x11a56a[_0xdfdb('0x1a')]][_0xdfdb('0x26')]);logger[_0xdfdb('0x17')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x11a56a[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this[_0xdfdb('0x19')][_0x11a56a[_0xdfdb('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0xdfdb('0x28')][_0x11a56a[_0xdfdb('0x1a')]])_['merge'](this[_0xdfdb('0x19')][_0x11a56a[_0xdfdb('0x1a')]],this[_0xdfdb('0x28')][_0x11a56a['uniqueid']]);this[_0xdfdb('0x16')]('voice:outbound',_0xdfdb('0x29'),this[_0xdfdb('0x19')][_0x11a56a[_0xdfdb('0x1a')]]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x11a56a[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this[_0xdfdb('0x19')][_0x11a56a[_0xdfdb('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xdfdb('0x16')](_0xdfdb('0x2a'),this['channels'][_0x11a56a[_0xdfdb('0x1a')]]);}}}catch(_0x364805){logger[_0xdfdb('0x2b')](_0xdfdb('0x2c'),_0x11a56a[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](_0x364805,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdfdb('0x13')][_0xdfdb('0x10')]=function(_0x68398d){try{if(this[_0xdfdb('0x14')](_0x68398d)){logger[_0xdfdb('0x17')]('[%s][voiceDialReport][dialend]\x20event:',_0x68398d['uniqueid'],util[_0xdfdb('0x27')](_0x68398d,{'showHidden':![],'depth':null}));if(this['channels'][_0x68398d[_0xdfdb('0x1a')]]){this[_0xdfdb('0x19')][_0x68398d[_0xdfdb('0x1a')]][_0xdfdb('0x2d')]=_0x68398d['dialstatus'];if(_0x68398d[_0xdfdb('0x2d')]==='ANSWER'){this[_0xdfdb('0x19')][_0x68398d[_0xdfdb('0x1a')]][_0xdfdb('0x2e')]=_0x68398d[_0xdfdb('0x2e')];this[_0xdfdb('0x19')][_0x68398d[_0xdfdb('0x1a')]]['connectedlinename']=_0x68398d[_0xdfdb('0x2f')];this[_0xdfdb('0x19')][_0x68398d['uniqueid']][_0xdfdb('0x30')]=moment()[_0xdfdb('0x1c')](_0xdfdb('0x1d'));this[_0xdfdb('0x19')][_0x68398d[_0xdfdb('0x1a')]][_0xdfdb('0x31')]=_0xdfdb('0x32');logger[_0xdfdb('0x24')](_0xdfdb('0x33'),_0x68398d[_0xdfdb('0x1a')],_0x68398d[_0xdfdb('0x1f')]['substring'](_0x68398d[_0xdfdb('0x1f')][_0xdfdb('0x21')]('/')+0x1,_0x68398d[_0xdfdb('0x1f')][_0xdfdb('0x21')]('-')));logger[_0xdfdb('0x17')](_0xdfdb('0x34'),_0x68398d[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this['channels'][_0x68398d['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xdfdb('0x16')](_0xdfdb('0x35'),this[_0xdfdb('0x19')][_0x68398d[_0xdfdb('0x1a')]]);}logger[_0xdfdb('0x17')](_0xdfdb('0x36'),_0x68398d[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this[_0xdfdb('0x19')][_0x68398d['uniqueid']],{'showHidden':![],'depth':null}));this[_0xdfdb('0x16')](_0xdfdb('0x37'),_0xdfdb('0x29'),this[_0xdfdb('0x19')][_0x68398d[_0xdfdb('0x1a')]]);}}}catch(_0x5a1bee){logger[_0xdfdb('0x2b')](_0xdfdb('0x38'),_0x68398d[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](_0x5a1bee,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdfdb('0x13')]['syncVarSet']=function(_0x1d7a3a){try{if(this[_0xdfdb('0x14')](_0x1d7a3a)){logger[_0xdfdb('0x17')]('[%s][voiceDialReport][varset]\x20event:',_0x1d7a3a[_0xdfdb('0x1a')],util['inspect'](_0x1d7a3a,{'showHidden':![],'depth':null}));this[_0xdfdb('0x39')](_0x1d7a3a['uniqueid'],_[_0xdfdb('0x3a')](_0x1d7a3a[_0xdfdb('0x3b')])[0x0],_0x1d7a3a['value']);if(this[_0xdfdb('0x14')](_0x1d7a3a['variable'])&&this[_0xdfdb('0x14')](_0x1d7a3a[_0xdfdb('0x3b')][_0xdfdb('0x3c')])){if(_[_0xdfdb('0x15')](this[_0xdfdb('0x19')][_0x1d7a3a['uniqueid']])){this['channels'][_0x1d7a3a[_0xdfdb('0x1a')]]={'routeId':_0x1d7a3a[_0xdfdb('0x3d')],'variables':this['variables'][_0x1d7a3a[_0xdfdb('0x1a')]],'motionChannel':'voice'};logger[_0xdfdb('0x24')](_0xdfdb('0x3e'),_0x1d7a3a[_0xdfdb('0x1a')],_0x1d7a3a[_0xdfdb('0x3b')][_0xdfdb('0x3c')],_[_0xdfdb('0x3a')](_0x1d7a3a[_0xdfdb('0x3b')])[0x0],_0x1d7a3a[_0xdfdb('0x3d')]);logger[_0xdfdb('0x17')](_0xdfdb('0x3f'),_0x1d7a3a[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this[_0xdfdb('0x19')][_0x1d7a3a[_0xdfdb('0x1a')]],{'showHidden':![],'depth':null}));this[_0xdfdb('0x16')](_0xdfdb('0x37'),'voice_outbound_channel:save',this['channels'][_0x1d7a3a[_0xdfdb('0x1a')]]);}}}}catch(_0x1aff71){logger[_0xdfdb('0x2b')]('[%s][voiceDialReport][varset]',_0x1d7a3a[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](_0x1aff71,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdfdb('0x13')][_0xdfdb('0x39')]=function(_0x5a0e29,_0x2b83c5,_0x7ab4d9){var _0x5446f6=[_0xdfdb('0x40'),_0xdfdb('0x41'),_0xdfdb('0x42'),_0xdfdb('0x43'),_0xdfdb('0x44'),_0xdfdb('0x45'),_0xdfdb('0x46'),_0xdfdb('0x47'),_0xdfdb('0x48'),'sipuri',_0xdfdb('0x49'),'bridgepvtcallid',_0xdfdb('0x4a'),_0xdfdb('0x4b'),_0xdfdb('0x4c'),_0xdfdb('0x4d'),_0xdfdb('0x4e'),_0xdfdb('0x4f'),_0xdfdb('0x50')];if(!_['isNil'](_0x2b83c5)&&!_[_0xdfdb('0x51')](_0x5446f6,_0x2b83c5)){if(_[_0xdfdb('0x15')](this[_0xdfdb('0xb')][_0x5a0e29])){this[_0xdfdb('0xb')][_0x5a0e29]={};}this[_0xdfdb('0xb')][_0x5a0e29][_0x2b83c5]=_0x7ab4d9;}};VoiceDialReport['prototype'][_0xdfdb('0x12')]=function(_0x4df3b6){try{if(this[_0xdfdb('0x14')](_0x4df3b6)){logger[_0xdfdb('0x17')](_0xdfdb('0x52'),_0x4df3b6[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](_0x4df3b6,{'showHidden':![],'depth':null}));if(this['channels'][_0x4df3b6[_0xdfdb('0x1a')]]){logger[_0xdfdb('0x24')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x4df3b6[_0xdfdb('0x1a')],_0x4df3b6[_0xdfdb('0x53')]);this[_0xdfdb('0x19')][_0x4df3b6['uniqueid']][_0xdfdb('0x54')]=moment()[_0xdfdb('0x1c')](_0xdfdb('0x1d'));this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]][_0xdfdb('0x55')]=moment(this['channels'][_0x4df3b6['uniqueid']][_0xdfdb('0x54')])['diff'](this['channels'][_0x4df3b6['uniqueid']][_0xdfdb('0x56')],_0xdfdb('0x57'));this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]][_0xdfdb('0x31')]=_0xdfdb('0x58');this[_0xdfdb('0xa')][_0xdfdb('0x59')]+=0x1;if(this[_0xdfdb('0x19')][_0x4df3b6['uniqueid']]['answertime']){this[_0xdfdb('0xa')]['answered']+=0x1;this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]][_0xdfdb('0x5a')]=moment(this['channels'][_0x4df3b6[_0xdfdb('0x1a')]][_0xdfdb('0x30')])[_0xdfdb('0x5b')](this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]][_0xdfdb('0x56')],_0xdfdb('0x57'));this[_0xdfdb('0x19')][_0x4df3b6['uniqueid']][_0xdfdb('0x5c')]=moment(this[_0xdfdb('0x19')][_0x4df3b6['uniqueid']][_0xdfdb('0x54')])[_0xdfdb('0x5b')](this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]]['answertime'],'seconds');this[_0xdfdb('0xa')][_0xdfdb('0x5d')]+=this['channels'][_0x4df3b6[_0xdfdb('0x1a')]][_0xdfdb('0x5a')]||0x0;this[_0xdfdb('0xa')]['sumBillable']+=this['channels'][_0x4df3b6[_0xdfdb('0x1a')]][_0xdfdb('0x5c')];}this['outbound']['sumDuration']+=this[_0xdfdb('0x19')][_0x4df3b6['uniqueid']]['duration'];logger[_0xdfdb('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x4df3b6[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this['channels'][_0x4df3b6['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xdfdb('0x16')](_0xdfdb('0x5e'),this['channels'][_0x4df3b6[_0xdfdb('0x1a')]]);logger[_0xdfdb('0x17')](_0xdfdb('0x5f'),_0x4df3b6[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this['channels'][_0x4df3b6['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xdfdb('0x16')](_0xdfdb('0x60'),this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]]);logger[_0xdfdb('0x17')](_0xdfdb('0x61'),_0x4df3b6['uniqueid'],util[_0xdfdb('0x27')](this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]],{'showHidden':![],'depth':null}));this[_0xdfdb('0x16')](_0xdfdb('0x37'),_0xdfdb('0x62'),this[_0xdfdb('0xa')]);logger[_0xdfdb('0x24')](_0xdfdb('0x63'),JSON[_0xdfdb('0x64')](this['channels'][_0x4df3b6[_0xdfdb('0x1a')]]));logger[_0xdfdb('0x17')](_0xdfdb('0x65'),_0x4df3b6[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](this['channels'][_0x4df3b6[_0xdfdb('0x1a')]],{'showHidden':![],'depth':null}));this[_0xdfdb('0x16')](_0xdfdb('0x37'),_0xdfdb('0x66'),this['channels'][_0x4df3b6[_0xdfdb('0x1a')]]);delete this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x1a')]];}else if(this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x67')]]){this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x67')]][_0xdfdb('0x1a')]=this[_0xdfdb('0x19')][_0x4df3b6[_0xdfdb('0x67')]][_0xdfdb('0x68')];}if(this['variables'][_0x4df3b6[_0xdfdb('0x1a')]]){delete this[_0xdfdb('0xb')][_0x4df3b6['uniqueid']];}}}catch(_0x28d4ac){logger[_0xdfdb('0x2b')](_0xdfdb('0x69'),_0x4df3b6['uniqueid'],util['inspect'](_0x28d4ac,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xdfdb('0x6a')]=function(_0x465565){try{if(this[_0xdfdb('0x14')](_0x465565)){logger[_0xdfdb('0x17')](_0xdfdb('0x6b'),_0x465565[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](_0x465565,{'showHidden':![],'depth':null}));if(_0x465565['application'][_0xdfdb('0x6c')]()===_0xdfdb('0x6d')){_0x465565[_0xdfdb('0x6e')]=(_0x465565[_0xdfdb('0x6f')]||_0x465565[_0xdfdb('0x6e')])[_0xdfdb('0x6c')]();if(_[_0xdfdb('0x70')](_0x465565['applicationdata'],_0xdfdb('0x71'))){if(_[_0xdfdb('0x15')](this[_0xdfdb('0x28')][_0x465565[_0xdfdb('0x1a')]]))this[_0xdfdb('0x28')][_0x465565['uniqueid']]={};logger[_0xdfdb('0x24')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x465565[_0xdfdb('0x1a')],_0x465565[_0xdfdb('0x72')],_0x465565[_0xdfdb('0x6e')]);var _0x30eea1=_0x465565[_0xdfdb('0x6e')]['split']('=');var _0x3361b1=_0x30eea1[0x0][_0xdfdb('0x73')](/cdr\((.*)\)/);if(_0x3361b1)this['applications'][_0x465565['uniqueid']][_0x3361b1[0x1]]=_0x30eea1[0x1];}}}}catch(_0x284439){logger['error']('[%s][voiceDialReport][newexten]',_0x465565[_0xdfdb('0x1a')],util[_0xdfdb('0x27')](_0x284439,{'showHidden':![],'depth':null}));}};module[_0xdfdb('0x74')]=VoiceDialReport;
\ No newline at end of file
+var _0x9957=['starttime','complete','answertime','holdtime','billableseconds','seconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','syncHangup','prototype','isNotNull','isUndefined','emit','debug','uniqueid','merge','format','channel','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','applications','voice:outbound','voice_outbound_channel:save','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','substring','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','addVariable','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff'];(function(_0x53807d,_0x4a90a8){var _0x501207=function(_0xea7078){while(--_0xea7078){_0x53807d['push'](_0x53807d['shift']());}};_0x501207(++_0x4a90a8);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var moment=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var Redis=require(_0x7995('0x3'));var config=require('../../../config/environment');var logger=require(_0x7995('0x4'))(_0x7995('0x5'));var ami=require(_0x7995('0x6'));config[_0x7995('0x7')]=_['defaults'](config[_0x7995('0x7')],{'host':_0x7995('0x8'),'port':0x18eb});var io=require(_0x7995('0x9'))(new Redis(config[_0x7995('0x7')]));function VoiceDialReport(_0xbda126){this[_0x7995('0xa')]=_0xbda126['outboundChannels'];this[_0x7995('0xb')]=_0xbda126[_0x7995('0xb')];this['applications']={};this[_0x7995('0xc')]={};ami['on'](_0x7995('0xd'),this[_0x7995('0xe')][_0x7995('0xf')](this));ami['on'](_0x7995('0x10'),this[_0x7995('0x11')][_0x7995('0xf')](this));ami['on']('varset',this[_0x7995('0x12')][_0x7995('0xf')](this));ami['on']('hangup',this[_0x7995('0x13')][_0x7995('0xf')](this));}VoiceDialReport[_0x7995('0x14')][_0x7995('0x15')]=function(_0x281576){return _0x281576!==null&&!_[_0x7995('0x16')](_0x281576);};VoiceDialReport[_0x7995('0x14')]['emit']=function(_0x58f5ad,_0x2b4e94,_0x2233dd){io['to'](_0x58f5ad)[_0x7995('0x17')](_0x2b4e94,_0x2233dd);};VoiceDialReport[_0x7995('0x14')][_0x7995('0xe')]=function(_0x1a5310){try{if(this[_0x7995('0x15')](_0x1a5310)){logger[_0x7995('0x18')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x1a5310[_0x7995('0x19')],util['inspect'](_0x1a5310,{'showHidden':![],'depth':null}));if(this[_0x7995('0xa')][_0x1a5310[_0x7995('0x19')]]){_[_0x7995('0x1a')](this[_0x7995('0xa')][_0x1a5310[_0x7995('0x19')]],{'starttime':moment()[_0x7995('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0x1a5310[_0x7995('0x1c')]['substring'](0x0,_0x1a5310['channel'][_0x7995('0x1d')]('-')),'membername':_0x1a5310[_0x7995('0x1c')]['substring'](_0x1a5310[_0x7995('0x1c')]['lastIndexOf']('/')+0x1,_0x1a5310['channel'][_0x7995('0x1d')]('-'))},_[_0x7995('0x1e')](_0x1a5310,[_0x7995('0x1f'),_0x7995('0x20')]));logger[_0x7995('0x21')](_0x7995('0x22'),_0x1a5310['uniqueid'],this[_0x7995('0xa')][_0x1a5310[_0x7995('0x19')]][_0x7995('0x23')],this[_0x7995('0xa')][_0x1a5310[_0x7995('0x19')]][_0x7995('0x24')]);logger[_0x7995('0x18')](_0x7995('0x25'),_0x1a5310['uniqueid'],util[_0x7995('0x26')](this[_0x7995('0xa')][_0x1a5310[_0x7995('0x19')]],{'showHidden':![],'depth':null}));if(this[_0x7995('0x27')][_0x1a5310[_0x7995('0x19')]])_[_0x7995('0x1a')](this['channels'][_0x1a5310[_0x7995('0x19')]],this['applications'][_0x1a5310[_0x7995('0x19')]]);this[_0x7995('0x17')](_0x7995('0x28'),_0x7995('0x29'),this[_0x7995('0xa')][_0x1a5310['uniqueid']]);logger[_0x7995('0x18')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x1a5310[_0x7995('0x19')],util[_0x7995('0x26')](this[_0x7995('0xa')][_0x1a5310['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:dialbegin',this[_0x7995('0xa')][_0x1a5310[_0x7995('0x19')]]);}}}catch(_0x327a81){logger[_0x7995('0x2a')](_0x7995('0x2b'),_0x1a5310[_0x7995('0x19')],util['inspect'](_0x327a81,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x7995('0x11')]=function(_0x5524af){try{if(this[_0x7995('0x15')](_0x5524af)){logger[_0x7995('0x18')](_0x7995('0x2c'),_0x5524af[_0x7995('0x19')],util[_0x7995('0x26')](_0x5524af,{'showHidden':![],'depth':null}));if(this['channels'][_0x5524af[_0x7995('0x19')]]){this[_0x7995('0xa')][_0x5524af['uniqueid']]['dialstatus']=_0x5524af['dialstatus'];if(_0x5524af[_0x7995('0x2d')]===_0x7995('0x2e')){this['channels'][_0x5524af[_0x7995('0x19')]]['connectedlinenum']=_0x5524af[_0x7995('0x2f')];this[_0x7995('0xa')][_0x5524af[_0x7995('0x19')]]['connectedlinename']=_0x5524af['connectedlinename'];this[_0x7995('0xa')][_0x5524af['uniqueid']]['answertime']=moment()[_0x7995('0x1b')](_0x7995('0x30'));this['channels'][_0x5524af[_0x7995('0x19')]][_0x7995('0x31')]=_0x7995('0x32');logger[_0x7995('0x21')](_0x7995('0x33'),_0x5524af['uniqueid'],_0x5524af[_0x7995('0x1c')][_0x7995('0x34')](_0x5524af[_0x7995('0x1c')][_0x7995('0x1d')]('/')+0x1,_0x5524af['channel'][_0x7995('0x1d')]('-')));logger[_0x7995('0x18')](_0x7995('0x35'),_0x5524af[_0x7995('0x19')],util[_0x7995('0x26')](this[_0x7995('0xa')][_0x5524af['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x7995('0x17')](_0x7995('0x36'),this[_0x7995('0xa')][_0x5524af[_0x7995('0x19')]]);}logger[_0x7995('0x18')](_0x7995('0x37'),_0x5524af[_0x7995('0x19')],util[_0x7995('0x26')](this[_0x7995('0xa')][_0x5524af[_0x7995('0x19')]],{'showHidden':![],'depth':null}));this[_0x7995('0x17')](_0x7995('0x28'),_0x7995('0x29'),this['channels'][_0x5524af['uniqueid']]);}}}catch(_0x334dff){logger[_0x7995('0x2a')]('[%s][voiceDialReport][dialend]',_0x5524af['uniqueid'],util[_0x7995('0x26')](_0x334dff,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x23da6b){try{if(this[_0x7995('0x15')](_0x23da6b)){logger[_0x7995('0x18')]('[%s][voiceDialReport][varset]\x20event:',_0x23da6b[_0x7995('0x19')],util['inspect'](_0x23da6b,{'showHidden':![],'depth':null}));this[_0x7995('0x38')](_0x23da6b['uniqueid'],_['keys'](_0x23da6b[_0x7995('0x39')])[0x0],_0x23da6b[_0x7995('0x3a')]);if(this[_0x7995('0x15')](_0x23da6b[_0x7995('0x39')])&&this['isNotNull'](_0x23da6b[_0x7995('0x39')][_0x7995('0x3b')])){if(_[_0x7995('0x16')](this[_0x7995('0xa')][_0x23da6b['uniqueid']])){this['channels'][_0x23da6b[_0x7995('0x19')]]={'routeId':_0x23da6b['value'],'variables':this[_0x7995('0xc')][_0x23da6b['uniqueid']],'motionChannel':_0x7995('0x3c')};logger['info'](_0x7995('0x3d'),_0x23da6b[_0x7995('0x19')],_0x23da6b['variable'][_0x7995('0x3b')],_[_0x7995('0x3e')](_0x23da6b[_0x7995('0x39')])[0x0],_0x23da6b[_0x7995('0x3a')]);logger['debug'](_0x7995('0x3f'),_0x23da6b[_0x7995('0x19')],util[_0x7995('0x26')](this['channels'][_0x23da6b[_0x7995('0x19')]],{'showHidden':![],'depth':null}));this[_0x7995('0x17')](_0x7995('0x28'),_0x7995('0x29'),this[_0x7995('0xa')][_0x23da6b['uniqueid']]);}}}}catch(_0x1a5cec){logger[_0x7995('0x2a')]('[%s][voiceDialReport][varset]',_0x23da6b[_0x7995('0x19')],util['inspect'](_0x1a5cec,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7995('0x14')][_0x7995('0x38')]=function(_0x1afab4,_0x30e220,_0xddf537){var _0x14b537=[_0x7995('0x40'),'rtpaudioqosbridged',_0x7995('0x41'),_0x7995('0x42'),_0x7995('0x43'),'rtpaudioqoslossbridged',_0x7995('0x44'),_0x7995('0x45'),_0x7995('0x46'),'sipuri','bridgepeer','bridgepvtcallid',_0x7995('0x47'),_0x7995('0x48'),'memberinterface',_0x7995('0x49'),_0x7995('0x23'),_0x7995('0x4a'),_0x7995('0x4b')];if(!_[_0x7995('0x4c')](_0x30e220)&&!_['includes'](_0x14b537,_0x30e220)){if(_[_0x7995('0x16')](this['variables'][_0x1afab4])){this[_0x7995('0xc')][_0x1afab4]={};}this[_0x7995('0xc')][_0x1afab4][_0x30e220]=_0xddf537;}};VoiceDialReport[_0x7995('0x14')]['syncHangup']=function(_0x5e1f34){try{if(this['isNotNull'](_0x5e1f34)){logger['debug'](_0x7995('0x4d'),_0x5e1f34[_0x7995('0x19')],util[_0x7995('0x26')](_0x5e1f34,{'showHidden':![],'depth':null}));if(this[_0x7995('0xa')][_0x5e1f34[_0x7995('0x19')]]){logger[_0x7995('0x21')](_0x7995('0x4e'),_0x5e1f34[_0x7995('0x19')],_0x5e1f34[_0x7995('0x4f')]);this[_0x7995('0xa')][_0x5e1f34[_0x7995('0x19')]][_0x7995('0x50')]=moment()[_0x7995('0x1b')](_0x7995('0x30'));this[_0x7995('0xa')][_0x5e1f34[_0x7995('0x19')]][_0x7995('0x51')]=moment(this[_0x7995('0xa')][_0x5e1f34[_0x7995('0x19')]]['endtime'])[_0x7995('0x52')](this[_0x7995('0xa')][_0x5e1f34[_0x7995('0x19')]][_0x7995('0x53')],'seconds');this['channels'][_0x5e1f34[_0x7995('0x19')]][_0x7995('0x31')]=_0x7995('0x54');this[_0x7995('0xb')]['total']+=0x1;if(this[_0x7995('0xa')][_0x5e1f34[_0x7995('0x19')]][_0x7995('0x55')]){this[_0x7995('0xb')]['answered']+=0x1;this['channels'][_0x5e1f34[_0x7995('0x19')]][_0x7995('0x56')]=moment(this[_0x7995('0xa')][_0x5e1f34[_0x7995('0x19')]][_0x7995('0x55')])[_0x7995('0x52')](this[_0x7995('0xa')][_0x5e1f34[_0x7995('0x19')]][_0x7995('0x53')],'seconds');this[_0x7995('0xa')][_0x5e1f34[_0x7995('0x19')]][_0x7995('0x57')]=moment(this[_0x7995('0xa')][_0x5e1f34['uniqueid']]['endtime'])[_0x7995('0x52')](this[_0x7995('0xa')][_0x5e1f34['uniqueid']][_0x7995('0x55')],_0x7995('0x58'));this[_0x7995('0xb')][_0x7995('0x59')]+=this[_0x7995('0xa')][_0x5e1f34['uniqueid']][_0x7995('0x56')]||0x0;this['outbound'][_0x7995('0x5a')]+=this[_0x7995('0xa')][_0x5e1f34[_0x7995('0x19')]][_0x7995('0x57')];}this[_0x7995('0xb')][_0x7995('0x5b')]+=this[_0x7995('0xa')][_0x5e1f34[_0x7995('0x19')]][_0x7995('0x51')];logger[_0x7995('0x18')](_0x7995('0x5c'),_0x5e1f34[_0x7995('0x19')],util['inspect'](this[_0x7995('0xa')][_0x5e1f34[_0x7995('0x19')]],{'showHidden':![],'depth':null}));ami[_0x7995('0x17')](_0x7995('0x5d'),this[_0x7995('0xa')][_0x5e1f34['uniqueid']]);logger['debug'](_0x7995('0x5e'),_0x5e1f34[_0x7995('0x19')],util[_0x7995('0x26')](this[_0x7995('0xa')][_0x5e1f34['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x7995('0x17')]('custom:dialend',this['channels'][_0x5e1f34[_0x7995('0x19')]]);logger[_0x7995('0x18')](_0x7995('0x5f'),_0x5e1f34[_0x7995('0x19')],util[_0x7995('0x26')](this[_0x7995('0xa')][_0x5e1f34[_0x7995('0x19')]],{'showHidden':![],'depth':null}));this[_0x7995('0x17')](_0x7995('0x28'),_0x7995('0x60'),this['outbound']);logger[_0x7995('0x21')](_0x7995('0x61'),JSON[_0x7995('0x62')](this['channels'][_0x5e1f34[_0x7995('0x19')]]));logger[_0x7995('0x18')](_0x7995('0x63'),_0x5e1f34[_0x7995('0x19')],util[_0x7995('0x26')](this[_0x7995('0xa')][_0x5e1f34[_0x7995('0x19')]],{'showHidden':![],'depth':null}));this[_0x7995('0x17')](_0x7995('0x28'),_0x7995('0x64'),this[_0x7995('0xa')][_0x5e1f34['uniqueid']]);delete this['channels'][_0x5e1f34[_0x7995('0x19')]];}else if(this[_0x7995('0xa')][_0x5e1f34[_0x7995('0x65')]]){this[_0x7995('0xa')][_0x5e1f34['linkedid']][_0x7995('0x19')]=this[_0x7995('0xa')][_0x5e1f34['linkedid']]['destuniqueid'];}if(this[_0x7995('0xc')][_0x5e1f34[_0x7995('0x19')]]){delete this['variables'][_0x5e1f34[_0x7995('0x19')]];}}}catch(_0x5b1cba){logger[_0x7995('0x2a')](_0x7995('0x66'),_0x5e1f34['uniqueid'],util['inspect'](_0x5b1cba,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7995('0x14')]['syncNewExten']=function(_0x31b9e6){try{if(this[_0x7995('0x15')](_0x31b9e6)){logger[_0x7995('0x18')](_0x7995('0x67'),_0x31b9e6[_0x7995('0x19')],util[_0x7995('0x26')](_0x31b9e6,{'showHidden':![],'depth':null}));if(_0x31b9e6[_0x7995('0x68')][_0x7995('0x69')]()===_0x7995('0x6a')){_0x31b9e6[_0x7995('0x6b')]=(_0x31b9e6[_0x7995('0x6c')]||_0x31b9e6[_0x7995('0x6b')])[_0x7995('0x69')]();if(_[_0x7995('0x6d')](_0x31b9e6[_0x7995('0x6b')],_0x7995('0x6e'))){if(_[_0x7995('0x16')](this[_0x7995('0x27')][_0x31b9e6[_0x7995('0x19')]]))this[_0x7995('0x27')][_0x31b9e6[_0x7995('0x19')]]={};logger[_0x7995('0x21')](_0x7995('0x6f'),_0x31b9e6[_0x7995('0x19')],_0x31b9e6[_0x7995('0x68')],_0x31b9e6[_0x7995('0x6b')]);var _0x2f7f51=_0x31b9e6[_0x7995('0x6b')]['split']('=');var _0x3fdb4b=_0x2f7f51[0x0][_0x7995('0x70')](/cdr\((.*)\)/);if(_0x3fdb4b)this['applications'][_0x31b9e6['uniqueid']][_0x3fdb4b[0x1]]=_0x2f7f51[0x1];}}}}catch(_0x15e8d1){logger[_0x7995('0x2a')](_0x7995('0x71'),_0x31b9e6[_0x7995('0x19')],util[_0x7995('0x26')](_0x15e8d1,{'showHidden':![],'depth':null}));}};module[_0x7995('0x72')]=VoiceDialReport;
\ No newline at end of file
index 45c1b14..d53acb2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0547=['answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','isUndefined','queues','[voiceQueueReport][queues]','then','[voiceQueueReport][queuesummary]','syncQueueSummary','isNotNull','queue','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','waiting','toNumber','loggedin','talking','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','queuecallercomplete','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','assigned','membername','transfer','startsWith','toLowerCase','local/','linkedid','queuecallerexitAt','add','seconds','transfertype','FORWARD','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','reason','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][agentcomplete]','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','variable','queuestatus','queuecallerexit','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','value','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','handleHangup','length','abandoned','diff','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','syncHangup','[%s][voiceQueueReport][hangup]','cause-txt','transferid','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transferuniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','syncNewExten','application','set','applicationdata','appdata','CDR(routeAlias)','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','[%s][voiceQueueReport][newexten]','lodash','moment','util','md5','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','queueReports','agents','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','fullybooted','syncFullyBooted','musiconholdstart','musiconholdstop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','queueStatusComplete','unlockRR','prototype','clearZombieChannels','channels','switch','Action','status','channel','catch','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','emit','voice:queue:%s','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','ATTENDEDTRANSFER','format','name','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','strategy'];(function(_0x2cc60a,_0x5c86eb){var _0x4e5823=function(_0x99decb){while(--_0x99decb){_0x2cc60a['push'](_0x2cc60a['shift']());}};_0x4e5823(++_0x5c86eb);}(_0x0547,0xa4));var _0x7054=function(_0x554398,_0x303252){_0x554398=_0x554398-0x0;var _0x32b830=_0x0547[_0x554398];return _0x32b830;};'use strict';var _=require(_0x7054('0x0'));var moment=require(_0x7054('0x1'));var util=require(_0x7054('0x2'));var md5=require(_0x7054('0x3'));var Redis=require(_0x7054('0x4'));var config=require(_0x7054('0x5'));var logger=require('../../../config/logger')(_0x7054('0x6'));var ami=require(_0x7054('0x7'));var QueueReport=require('../model/queueReport');config[_0x7054('0x8')]=_[_0x7054('0x9')](config[_0x7054('0x8')],{'host':_0x7054('0xa'),'port':0x18eb});var io=require(_0x7054('0xb'))(new Redis(config[_0x7054('0x8')]));var Sequence=function(){};Sequence['prototype'][_0x7054('0xc')]=function(_0x20d93b){this[_0x7054('0xd')]=this[_0x7054('0xd')]?this[_0x7054('0xd')][_0x7054('0xe')](_0x20d93b):_0x20d93b();};function VoiceQueueReport(_0x452085){this[_0x7054('0xf')]=new Sequence();this[_0x7054('0x10')]={};this[_0x7054('0x11')]=_0x452085[_0x7054('0x11')];this['channels']=_0x452085[_0x7054('0x12')];this[_0x7054('0x13')]=_0x452085['voiceQueues'];this[_0x7054('0x14')]=!![];this[_0x7054('0x15')]=_0x452085['campaigns'];this[_0x7054('0x16')]={};ami['on'](_0x7054('0x17'),this['syncQueueSummary']['bind'](this));ami['on'](_0x7054('0x18'),this[_0x7054('0x19')][_0x7054('0x1a')](this));ami['on'](_0x7054('0x1b'),this[_0x7054('0x1c')]['bind'](this));ami['on'](_0x7054('0x1d'),this[_0x7054('0x1e')][_0x7054('0x1a')](this));ami['on']('queuecallerleave',this[_0x7054('0x1f')][_0x7054('0x1a')](this));ami['on'](_0x7054('0x20'),this[_0x7054('0x21')]['bind'](this));ami['on'](_0x7054('0x22'),this[_0x7054('0x23')][_0x7054('0x1a')](this));ami['on'](_0x7054('0x24'),this['syncVarSet'][_0x7054('0x1a')](this));ami['on'](_0x7054('0x25'),this['syncHangup']['bind'](this));ami['on'](_0x7054('0x26'),this[_0x7054('0x27')][_0x7054('0x1a')](this));ami['on'](_0x7054('0x28'),this['syncMusicOnHoldStart'][_0x7054('0x1a')](this));ami['on'](_0x7054('0x29'),this['syncMusicOnHoldStop']['bind'](this));ami['on']('attendedtransfer',this[_0x7054('0x2a')][_0x7054('0x1a')](this));ami['on'](_0x7054('0x2b'),this[_0x7054('0x2c')]['bind'](this));this[_0x7054('0x2d')]();this[_0x7054('0x2e')]();}function clearChannels(_0x307b0d){if(!_['isEmpty'](_0x307b0d)){for(var _0x49c17b in _0x307b0d){if(_0x307b0d['hasOwnProperty'](_0x49c17b)){delete _0x307b0d[_0x49c17b];}}}}function clearCampaigns(_0x3fc9a7){if(!_[_0x7054('0x2f')](_0x3fc9a7)){for(var _0x1ebfc9 in _0x3fc9a7){if(_0x3fc9a7[_0x7054('0x30')](_0x1ebfc9)){_0x3fc9a7[_0x1ebfc9]['originated']=0x0;}}}}function clearVoiceQueues(_0x1b8511){if(!_['isEmpty'](_0x1b8511)){for(var _0x15a492 in _0x1b8511){if(_0x1b8511[_0x7054('0x30')](_0x15a492)){_0x1b8511[_0x15a492][_0x7054('0x31')]=0x0;_0x1b8511[_0x15a492]['talking']=0x0;_0x1b8511[_0x15a492][_0x7054('0x32')]=0x0;_0x1b8511[_0x15a492]['waiting']=0x0;_0x1b8511[_0x15a492][_0x7054('0x33')]=!![];}}}}function clearAgentBooked(_0x32adda){if(!_[_0x7054('0x2f')](_0x32adda)){for(var _0x50db09 in _0x32adda){if(_0x32adda[_0x7054('0x30')](_0x50db09)){_0x32adda[_0x50db09][_0x7054('0x34')]=!![];}}}}VoiceQueueReport[_0x7054('0x35')][_0x7054('0x36')]=function(){var _0x127033=this;for(var _0x448e0e in this[_0x7054('0x37')]){if(this[_0x7054('0x37')][_0x7054('0x30')](_0x448e0e)&&!this['channels'][_0x448e0e][_0x7054('0x38')]){this[_0x7054('0xf')][_0x7054('0xc')](function(){if(!_['isNil'](_0x127033[_0x7054('0x37')][_0x448e0e])){return ami[_0x7054('0x39')]({'action':_0x7054('0x3a'),'channel':_0x127033[_0x7054('0x37')][_0x448e0e][_0x7054('0x3b')]})[_0x7054('0x3c')](function(_0x5305d9){if(_0x5305d9['message']===_0x7054('0x3d')){setTimeout(function(){if(_0x127033[_0x7054('0x37')][_0x448e0e]){delete _0x127033['channels'][_0x448e0e];logger[_0x7054('0x3e')](_0x7054('0x3f'),_0x448e0e,util[_0x7054('0x40')](_0x5305d9,{'showHidden':![],'depth':null}));}if(_0x127033[_0x7054('0x10')][_0x448e0e]){delete _0x127033[_0x7054('0x10')][_0x448e0e];logger[_0x7054('0x3e')]('[%s][voiceQueueReport][checkQueueReport]',_0x448e0e,util['inspect'](_0x5305d9,{'showHidden':![],'depth':null}));}if(_0x127033['variables'][_0x448e0e]){delete _0x127033[_0x7054('0x16')][_0x448e0e];logger[_0x7054('0x3e')](_0x7054('0x41'),_0x448e0e,util[_0x7054('0x40')](_0x5305d9,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x7054('0x35')]['syncFullyBooted']=function(){logger[_0x7054('0x3e')](_0x7054('0x42'));clearChannels(this[_0x7054('0x37')]);this['clearQueueReport'](this[_0x7054('0x10')]);clearAgentBooked(this[_0x7054('0x11')]);clearVoiceQueues(this[_0x7054('0x13')]);clearCampaigns(this[_0x7054('0x15')]);};VoiceQueueReport['prototype'][_0x7054('0x43')]=function(_0x138261){var _0x424934=this;if(!_[_0x7054('0x2f')](_0x138261)){for(var _0x5636a3 in _0x138261){if(_0x138261[_0x7054('0x30')](_0x5636a3)){_0x424934[_0x7054('0x44')](_0x138261[_0x5636a3],_0x7054('0x45'));delete _0x138261[_0x5636a3];}}}};VoiceQueueReport[_0x7054('0x35')]['emit']=function(_0x48408c,_0xa7060a,_0x22e54a){io['to'](_0x48408c)['emit'](_0xa7060a,_0x22e54a);};VoiceQueueReport[_0x7054('0x35')][_0x7054('0x46')]=function(_0x2db079,_0x140688){logger[_0x7054('0x47')](_0x7054('0x48')+_0x140688+_0x7054('0x49'),_0x2db079['uniqueid'],util['inspect'](_0x2db079,{'showHidden':![],'depth':null}));this[_0x7054('0x4a')](util['format'](_0x7054('0x4b'),_0x2db079['name']),_0x7054('0x4c'),_0x2db079);io['emit']('voice_queue_presence:save',_0x2db079);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x43df72,_0x5ade69){logger['debug'](_0x7054('0x48')+_0x5ade69+_0x7054('0x4d'),_0x43df72[_0x7054('0x4e')],util[_0x7054('0x40')](_0x43df72,{'showHidden':![],'depth':null}));if(_0x43df72['queuecallerexitreason']===_0x7054('0x4f'))return;this[_0x7054('0x4a')](util[_0x7054('0x50')](_0x7054('0x4b'),_0x43df72[_0x7054('0x51')]),_0x7054('0x52'),_0x43df72);io['emit'](_0x7054('0x53'),_0x43df72);};VoiceQueueReport[_0x7054('0x35')][_0x7054('0x54')]=function(_0x46ae5e,_0x43fc2b){if(_0x46ae5e[_0x7054('0x55')]===_0x7054('0x56')){var _0x1f2901={'id':_0x46ae5e['id'],'name':_0x46ae5e[_0x7054('0x51')],'strategy':_0x46ae5e[_0x7054('0x57')],'answered':_0x46ae5e[_0x7054('0x58')],'available':_0x46ae5e[_0x7054('0x59')],'loggedIn':_0x46ae5e[_0x7054('0x5a')],'pTalking':_0x46ae5e[_0x7054('0x32')],'sumBillable':_0x46ae5e[_0x7054('0x5b')],'sumDuration':_0x46ae5e[_0x7054('0x5c')],'sumHoldTime':_0x46ae5e[_0x7054('0x5d')]||0x0,'talking':_0x46ae5e['talking'],'total':_0x46ae5e[_0x7054('0x5e')],'type':_0x46ae5e[_0x7054('0x55')],'unmanaged':_0x46ae5e[_0x7054('0x5f')],'abandoned':_0x46ae5e['abandoned'],'waiting':_0x46ae5e['waiting']};if(_0x46ae5e['Trunk']){_0x1f2901[_0x7054('0x60')]={'id':_0x46ae5e[_0x7054('0x60')]['id'],'name':_0x46ae5e['Trunk']['name'],'active':_0x46ae5e[_0x7054('0x60')][_0x7054('0x61')],'callerid':_0x46ae5e[_0x7054('0x60')][_0x7054('0x62')]};}if(_0x46ae5e[_0x7054('0x63')]){_0x1f2901[_0x7054('0x63')]={'id':_0x46ae5e['Interval']['id'],'name':_0x46ae5e[_0x7054('0x63')][_0x7054('0x51')]};}var _0x5d5188=md5(JSON[_0x7054('0x64')](_0x1f2901));if(_0x46ae5e['md5']!==_0x5d5188){_0x46ae5e[_0x7054('0x3')]=_0x5d5188;logger['debug'](_0x7054('0x65')+_0x43fc2b+_0x7054('0x66'),util[_0x7054('0x40')](_0x1f2901,{'showHidden':![],'depth':null}));this[_0x7054('0x4a')](util['format'](_0x7054('0x4b'),_0x1f2901['name']),'voice_queue:save',_0x1f2901);}}};VoiceQueueReport[_0x7054('0x35')]['isNotNull']=function(_0x3e7a83){return _0x3e7a83!==null&&!_[_0x7054('0x67')](_0x3e7a83);};VoiceQueueReport[_0x7054('0x35')][_0x7054('0x2e')]=function(){var _0x38883a=this;setInterval(function(){_0x38883a[_0x7054('0x36')]();ami[_0x7054('0x39')]({'action':_0x7054('0x68')})['catch'](function(_0x5ee13d){logger[_0x7054('0x3e')](_0x7054('0x69'),util['inspect'](_0x5ee13d,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x7054('0x35')]['loopQueueSummary']=function(){var _0x397fdd=this;setInterval(function(){if(_0x397fdd[_0x7054('0x14')]){return ami['Action']({'action':_0x7054('0x17')})[_0x7054('0x6a')](function(){_0x397fdd['flagQueueSummary']=![];})[_0x7054('0x3c')](function(_0x120df1){logger[_0x7054('0x3e')](_0x7054('0x6b'),util[_0x7054('0x40')](_0x120df1,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x7054('0x35')][_0x7054('0x6c')]=function(_0x3e4ee8){try{if(this[_0x7054('0x6d')](_0x3e4ee8)&&this[_0x7054('0x6d')](_0x3e4ee8[_0x7054('0x6e')])){logger[_0x7054('0x47')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x7054('0x40')](_0x3e4ee8,{'showHidden':![],'depth':null}));if(this[_0x7054('0x13')][_0x3e4ee8[_0x7054('0x6e')]]){logger[_0x7054('0x6f')](_0x7054('0x70'),_0x3e4ee8[_0x7054('0x6e')]);var _0x126ed1=_[_0x7054('0x71')](this[_0x7054('0x37')],_0x7054('0x6e'))[_0x3e4ee8[_0x7054('0x6e')]]||0x0;var _0x4b1e73=_0x126ed1-_0x3e4ee8[_0x7054('0x72')];if(this[_0x7054('0x13')][_0x3e4ee8[_0x7054('0x6e')]][_0x7054('0x73')]!==_[_0x7054('0x74')](_0x3e4ee8['callers'])||this[_0x7054('0x13')][_0x3e4ee8[_0x7054('0x6e')]]['loggedIn']!==_[_0x7054('0x74')](_0x3e4ee8[_0x7054('0x75')])||this['voiceQueues'][_0x3e4ee8[_0x7054('0x6e')]]['available']!==_['toNumber'](_0x3e4ee8[_0x7054('0x59')])||this[_0x7054('0x13')][_0x3e4ee8[_0x7054('0x6e')]]['talking']!==_0x4b1e73){this[_0x7054('0x13')][_0x3e4ee8[_0x7054('0x6e')]][_0x7054('0x73')]=_[_0x7054('0x74')](_0x3e4ee8['callers']);this[_0x7054('0x13')][_0x3e4ee8[_0x7054('0x6e')]]['loggedIn']=_[_0x7054('0x74')](_0x3e4ee8['loggedin']);this[_0x7054('0x13')][_0x3e4ee8[_0x7054('0x6e')]][_0x7054('0x59')]=_['toNumber'](_0x3e4ee8[_0x7054('0x59')]);this[_0x7054('0x13')][_0x3e4ee8[_0x7054('0x6e')]][_0x7054('0x76')]=_0x4b1e73>0x0?_0x4b1e73:0x0;this[_0x7054('0x13')][_0x3e4ee8[_0x7054('0x6e')]][_0x7054('0x76')]=this[_0x7054('0x13')][_0x3e4ee8['queue']][_0x7054('0x76')]>_['toNumber'](_0x3e4ee8[_0x7054('0x75')])?_['toNumber'](_0x3e4ee8[_0x7054('0x75')]):this[_0x7054('0x13')][_0x3e4ee8[_0x7054('0x6e')]][_0x7054('0x76')];this[_0x7054('0x54')](this[_0x7054('0x13')][_0x3e4ee8[_0x7054('0x6e')]],_0x7054('0x17'));}logger[_0x7054('0x47')](_0x7054('0x77'),util[_0x7054('0x40')](this[_0x7054('0x13')][_0x3e4ee8[_0x7054('0x6e')]],{'showHidden':![],'depth':null}));ami[_0x7054('0x4a')](_0x7054('0x78'),this[_0x7054('0x13')][_0x3e4ee8[_0x7054('0x6e')]]);}}}catch(_0x53f3ec){logger[_0x7054('0x3e')](_0x7054('0x6b'),util[_0x7054('0x40')](_0x53f3ec,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7054('0x35')][_0x7054('0x19')]=function(_0x174492){logger['debug'](_0x7054('0x79'),util['inspect'](_0x174492,{'showHidden':![],'depth':null}));ami[_0x7054('0x4a')](_0x7054('0x7a'),{});this['flagQueueSummary']=!![];};VoiceQueueReport[_0x7054('0x35')]['syncQueueCallerJoin']=function(_0x36c473){try{if(this['isNotNull'](_0x36c473)){logger[_0x7054('0x47')](_0x7054('0x7b'),_0x36c473[_0x7054('0x4e')],util[_0x7054('0x40')](_0x36c473,{'showHidden':![],'depth':null}));if(_[_0x7054('0x67')](this[_0x7054('0x10')][_0x36c473[_0x7054('0x4e')]]))this[_0x7054('0x10')][_0x36c473['uniqueid']]=[];if(_[_0x7054('0x67')](this['channels'][_0x36c473[_0x7054('0x4e')]]))this[_0x7054('0x37')][_0x36c473['uniqueid']]={};var _0x4032e2=new QueueReport();_0x4032e2[_0x7054('0x51')]=_0x36c473[_0x7054('0x6e')];_0x4032e2[_0x7054('0x55')]=this[_0x7054('0x13')][_0x4032e2[_0x7054('0x51')]]&&this['voiceQueues'][_0x4032e2[_0x7054('0x51')]][_0x7054('0x55')]?this[_0x7054('0x13')][_0x4032e2[_0x7054('0x51')]][_0x7054('0x55')]||'inbound':_0x7054('0x56');_0x4032e2[_0x7054('0x6e')]=_0x36c473[_0x7054('0x6e')];_0x4032e2[_0x7054('0x7c')]=moment()['format'](_0x7054('0x7d'));_0x4032e2[_0x7054('0x7e')]=_0x36c473[_0x7054('0x7e')];_0x4032e2[_0x7054('0x7f')]=_0x36c473[_0x7054('0x7f')];_0x4032e2[_0x7054('0x4e')]=_0x36c473[_0x7054('0x4e')];_0x4032e2[_0x7054('0x80')]=this[_0x7054('0x37')][_0x36c473[_0x7054('0x4e')]]['routealias'];logger[_0x7054('0x6f')](_0x7054('0x81'),_0x4032e2['name'],_0x4032e2[_0x7054('0x55')]);_[_0x7054('0x82')](_0x4032e2,_[_0x7054('0x83')](_0x36c473,_[_0x7054('0x84')](_0x4032e2)));this['queueReports'][_0x36c473['uniqueid']][_0x7054('0x85')](_0x4032e2);this['channels'][_0x36c473[_0x7054('0x4e')]]=_0x4032e2;this[_0x7054('0x46')](_0x4032e2,_0x7054('0x1b'));}}catch(_0x340ed0){logger['error'](_0x7054('0x7b'),_0x36c473[_0x7054('0x4e')],util[_0x7054('0x40')](_0x340ed0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0xc8b6d5){try{if(this[_0x7054('0x6d')](_0xc8b6d5)){logger[_0x7054('0x47')](_0x7054('0x86'),_0xc8b6d5[_0x7054('0x4e')],util['inspect'](_0xc8b6d5,{'showHidden':![],'depth':null}));if(this[_0x7054('0x10')][_0xc8b6d5[_0x7054('0x4e')]]){var _0x2663d1=_[_0x7054('0x87')](this[_0x7054('0x10')][_0xc8b6d5['uniqueid']]);_0x2663d1['queuecallercomplete']=![];_0x2663d1[_0x7054('0x88')]=null;_0x2663d1[_0x7054('0x89')]=_0xc8b6d5[_0x7054('0x89')];_0x2663d1[_0x7054('0x8a')]=_0xc8b6d5[_0x7054('0x8a')];_0x2663d1[_0x7054('0x1d')]=!![];_0x2663d1[_0x7054('0x8b')]=moment()[_0x7054('0x50')](_0x7054('0x7d'));_0x2663d1[_0x7054('0x8c')]=_0x7054('0x8d');_0x2663d1['lastAssignedTo']=null;logger[_0x7054('0x6f')](_0x7054('0x8e'),_0x2663d1[_0x7054('0x51')],_0x2663d1['type']);this[_0x7054('0x37')][_0xc8b6d5[_0x7054('0x4e')]]=_0x2663d1;this[_0x7054('0x44')](_0x2663d1,'queuecallerabandon');}}}catch(_0x15aa52){logger[_0x7054('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0xc8b6d5[_0x7054('0x4e')],util[_0x7054('0x40')](_0x15aa52,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7054('0x35')][_0x7054('0x1f')]=function(_0x17163b){try{if(this[_0x7054('0x6d')](_0x17163b)){logger['debug'](_0x7054('0x8f'),_0x17163b[_0x7054('0x4e')],util[_0x7054('0x40')](_0x17163b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x17163b['uniqueid']]){var _0x35b151=_[_0x7054('0x87')](this['queueReports'][_0x17163b[_0x7054('0x4e')]]);_0x35b151[_0x7054('0x90')]=moment()['format'](_0x7054('0x7d'));_0x35b151[_0x7054('0x91')]=_0x17163b['connectedlinenum'];_0x35b151[_0x7054('0x92')]=_0x17163b[_0x7054('0x92')];logger['info'](_0x7054('0x93'),_0x35b151[_0x7054('0x51')],_0x35b151['type'],_0x17163b['connectedlinenum'],_0x17163b['connectedlinename']);this[_0x7054('0x37')][_0x17163b['uniqueid']]=_0x35b151;this[_0x7054('0x46')](_0x35b151,'queuecallerleave');}}}catch(_0x5b9ab7){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x17163b['uniqueid'],util[_0x7054('0x40')](_0x5b9ab7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7054('0x35')][_0x7054('0x23')]=function(_0x3196f7){try{if(this[_0x7054('0x6d')](_0x3196f7)){logger[_0x7054('0x47')](_0x7054('0x94'),_0x3196f7['uniqueid'],util['inspect'](_0x3196f7,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3196f7[_0x7054('0x4e')]]){var _0x5ec83f=_['last'](this[_0x7054('0x10')][_0x3196f7[_0x7054('0x4e')]]);_0x5ec83f[_0x7054('0x95')]=!![];_0x5ec83f['queuecallerexitreason']=_0x7054('0x96');logger[_0x7054('0x6f')](_0x7054('0x97'),_0x5ec83f[_0x7054('0x51')],_0x5ec83f[_0x7054('0x55')]);}}}catch(_0x106e8c){logger['error'](_0x7054('0x94'),_0x3196f7['uniqueid'],util['inspect'](_0x106e8c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7054('0x35')][_0x7054('0x21')]=function(_0x1da306){try{if(this[_0x7054('0x6d')](_0x1da306)){logger[_0x7054('0x47')]('[%s][voiceQueueReport][agentcomplete]',_0x1da306[_0x7054('0x4e')],util['inspect'](_0x1da306,{'showHidden':![],'depth':null}));if(this[_0x7054('0x10')][_0x1da306[_0x7054('0x4e')]]){var _0x478ee8=_['last'](this[_0x7054('0x10')][_0x1da306[_0x7054('0x4e')]]);_0x478ee8[_0x7054('0x1d')]=![];_0x478ee8[_0x7054('0x8b')]=null;_0x478ee8[_0x7054('0x98')]=!![];_0x478ee8['lastAssignedTo']=_0x1da306[_0x7054('0x99')];_0x478ee8[_0x7054('0x89')]=_0x1da306[_0x7054('0x89')];_0x478ee8[_0x7054('0x95')]=!![];_0x478ee8['queuecallerexit']=![];_0x478ee8['queuecallerexitAt']=null;if(!_0x478ee8[_0x7054('0x9a')]){if(_0x1da306['reason']==_0x7054('0x9a')){_0x478ee8[_0x7054('0x8c')]='COMPLETED';logger[_0x7054('0x6f')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x478ee8['name'],_0x478ee8[_0x7054('0x55')]);}else{if(_[_0x7054('0x9b')](_0x1da306[_0x7054('0x3b')][_0x7054('0x9c')](),_0x7054('0x9d'))){if(this[_0x7054('0x10')][_0x1da306['linkedid']]){var _0x202cf4=_[_0x7054('0x87')](this[_0x7054('0x10')][_0x1da306[_0x7054('0x9e')]]);_0x202cf4[_0x7054('0x95')]=![];_0x202cf4['queuecallerexit']=!![];_0x202cf4[_0x7054('0x9f')]=moment(_0x478ee8[_0x7054('0x7c')])[_0x7054('0xa0')](_0x1da306[_0x7054('0x89')],_0x7054('0xa1'))['format'](_0x7054('0x7d'));_0x202cf4['queuecallerexitreason']='FORWARDTRANSFER';_0x202cf4[_0x7054('0x9a')]=!![];_0x202cf4[_0x7054('0xa2')]=_0x7054('0xa3');_0x202cf4[_0x7054('0xa4')]=_0x1da306[_0x7054('0xa5')];_0x202cf4['transferuniqueid']=_0x1da306[_0x7054('0x4e')];logger[_0x7054('0x6f')](_0x7054('0xa6'),_0x202cf4[_0x7054('0x51')],_0x202cf4[_0x7054('0x55')]);var _0x1f4c4d=this['queueReports'][_0x1da306[_0x7054('0x9e')]];this[_0x7054('0x10')][_0x1da306[_0x7054('0x9e')]]=this['queueReports'][_0x1da306[_0x7054('0x4e')]];this[_0x7054('0x10')][_0x1da306[_0x7054('0x4e')]]=_0x1f4c4d;}}else{_0x478ee8[_0x7054('0x8c')]=_0x7054('0xa7')+_0x1da306[_0x7054('0xa8')][_0x7054('0xa9')]();logger[_0x7054('0x6f')](_0x7054('0xaa'),_0x478ee8[_0x7054('0x51')],_0x478ee8[_0x7054('0x55')],_0x478ee8['queuecallerexitreason']);}}}this[_0x7054('0x37')][_0x1da306[_0x7054('0x4e')]]=_0x478ee8;this['emitVoiceQueueChannelRemove'](_0x478ee8,_0x7054('0x20'));}}}catch(_0x52fab0){logger[_0x7054('0x3e')](_0x7054('0xab'),_0x1da306[_0x7054('0x4e')],util['inspect'](_0x52fab0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7054('0x35')][_0x7054('0xac')]=function(_0x3970ab){try{if(this[_0x7054('0x6d')](_0x3970ab)){logger[_0x7054('0x47')](_0x7054('0xad'),_0x3970ab['uniqueid'],util['inspect'](_0x3970ab,{'showHidden':![],'depth':null}));this[_0x7054('0xae')](_0x3970ab[_0x7054('0x4e')],_[_0x7054('0x84')](_0x3970ab['variable'])[0x0],_0x3970ab['value']);if(this['queueReports'][_0x3970ab[_0x7054('0x4e')]]){var _0x50d826=_[_0x7054('0x87')](this[_0x7054('0x10')][_0x3970ab[_0x7054('0x4e')]]);if(_0x50d826){if(this['isNotNull'](_0x3970ab[_0x7054('0xaf')])&&this[_0x7054('0x6d')](_0x3970ab['variable'][_0x7054('0xb0')])){switch(_0x3970ab['value']){case'CONTINUE':_0x50d826[_0x7054('0xb1')]=![];_0x50d826[_0x7054('0x9f')]=null;break;case _0x7054('0xb2'):_0x50d826[_0x7054('0xb3')]=_0x7054('0xb4');_0x50d826[_0x7054('0xb1')]=!![];_0x50d826[_0x7054('0x9f')]=moment()[_0x7054('0x50')](_0x7054('0x7d'));_0x50d826['queuecallerleaveAt']=moment()[_0x7054('0x50')](_0x7054('0x7d'));logger[_0x7054('0x47')](_0x7054('0xb5'),_0x3970ab[_0x7054('0x4e')],util[_0x7054('0x40')](_0x50d826,{'showHidden':![],'depth':null}));ami[_0x7054('0x4a')](_0x7054('0xb6'),_0x50d826);break;default:_0x50d826[_0x7054('0xb1')]=!![];_0x50d826[_0x7054('0x9f')]=moment()['format'](_0x7054('0x7d'));_0x50d826[_0x7054('0x90')]=moment()[_0x7054('0x50')](_0x7054('0x7d'));}_0x50d826[_0x7054('0x1d')]=![];_0x50d826[_0x7054('0x8b')]=null;_0x50d826['queuecallerexitreason']=_0x3970ab[_0x7054('0xb7')];this[_0x7054('0x37')][_0x3970ab['uniqueid']]=_0x50d826;this[_0x7054('0x44')](_0x50d826,_0x7054('0x24'));}else if(this['isNotNull'](_0x3970ab[_0x7054('0xaf')])&&this['isNotNull'](_0x3970ab['variable']['queueposition'])){if(!_0x50d826[_0x7054('0x1d')]){_0x50d826[_0x7054('0xb1')]=!![];_0x50d826['queuecallerexitAt']=moment()['format'](_0x7054('0x7d'));_0x50d826['queuecallerexitreason']='EXITWITHKEY';_0x50d826['queuecallerleaveAt']=moment()[_0x7054('0x50')](_0x7054('0x7d'));this[_0x7054('0x37')][_0x3970ab[_0x7054('0x4e')]]=_0x50d826;}}logger[_0x7054('0x6f')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x3970ab[_0x7054('0x4e')],_0x50d826[_0x7054('0x51')],_0x50d826['type'],_[_0x7054('0x84')](_0x3970ab['variable'])[0x0],_0x3970ab[_0x7054('0xb7')]);_0x50d826[_0x7054('0x16')]=this[_0x7054('0x16')][_0x3970ab['uniqueid']];}}}}catch(_0x31ffff){logger['error'](_0x7054('0xad'),_0x3970ab[_0x7054('0x4e')],util[_0x7054('0x40')](_0x31ffff,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7054('0x35')][_0x7054('0xae')]=function(_0x44427d,_0x2a21b1,_0x19739c){var _0x418da4=['rtpaudioqos',_0x7054('0xb8'),_0x7054('0xb9'),_0x7054('0xba'),_0x7054('0xbb'),_0x7054('0xbc'),_0x7054('0xbd'),_0x7054('0xbe'),_0x7054('0xbf'),_0x7054('0xc0'),_0x7054('0xc1'),_0x7054('0xc2'),_0x7054('0xc3'),_0x7054('0xc4'),_0x7054('0xc5'),_0x7054('0xc6'),_0x7054('0x99'),_0x7054('0xc7'),'memberrealtime'];if(!_[_0x7054('0xc8')](_0x2a21b1)&&!_[_0x7054('0xc9')](_0x418da4,_0x2a21b1)){if(_[_0x7054('0x67')](this['variables'][_0x44427d])){this[_0x7054('0x16')][_0x44427d]={};}this['variables'][_0x44427d][_0x2a21b1]=_0x19739c;}};VoiceQueueReport[_0x7054('0x35')][_0x7054('0xca')]=function(_0x2ba8a5,_0xb7070c,_0x51b322){var _0x17de7e={};for(var _0x5e29a2=0x0;_0x5e29a2<this['queueReports'][_0x2ba8a5][_0x7054('0xcb')];_0x5e29a2+=0x1){_0x17de7e=this[_0x7054('0x10')][_0x2ba8a5][_0x5e29a2];if(this[_0x7054('0x13')][_0x17de7e[_0x7054('0x6e')]]){if(_0x17de7e[_0x7054('0xb1')]&&_0x17de7e[_0x7054('0x9a')]!=!![]){this[_0x7054('0x13')][_0x17de7e['queue']]['unmanaged']+=0x1;}if(_0x17de7e[_0x7054('0x1d')]){this[_0x7054('0x13')][_0x17de7e[_0x7054('0x6e')]][_0x7054('0xcc')]+=0x1;}this[_0x7054('0x13')][_0x17de7e['queue']][_0x7054('0x5d')]+=moment(_0x17de7e[_0x7054('0x90')])[_0x7054('0xcd')](_0x17de7e[_0x7054('0x7c')],'seconds')||0x0;if(_0x5e29a2===this[_0x7054('0x10')][_0x2ba8a5][_0x7054('0xcb')]-0x1){this[_0x7054('0x13')][_0x17de7e['queue']][_0x7054('0x5c')]+=moment()[_0x7054('0xce')](0x0)[_0x7054('0xcd')](_0x17de7e['queuecallerjoinAt'],_0x7054('0xa1'));this[_0x7054('0x13')][_0x17de7e[_0x7054('0x6e')]][_0x7054('0x5e')]+=0x1;if(_0x17de7e[_0x7054('0x95')]){this[_0x7054('0x13')][_0x17de7e['queue']][_0x7054('0x58')]+=0x1;this[_0x7054('0x13')][_0x17de7e[_0x7054('0x6e')]]['sumBillable']+=moment()[_0x7054('0xce')](0x0)[_0x7054('0xcd')](_0x17de7e[_0x7054('0x90')],_0x7054('0xa1'));_0x17de7e[_0x7054('0x88')]=moment()['format'](_0x7054('0x7d'));_0x17de7e['queuecallerexit']=![];_0x17de7e[_0x7054('0x9f')]=null;}if(_0x17de7e[_0x7054('0xb1')]&&_0x17de7e[_0x7054('0x9a')]!=!![]){_0x17de7e[_0x7054('0xb3')]=_0x7054('0x5f');logger[_0x7054('0x47')](_0x7054('0xcf'),_0x2ba8a5,util['inspect'](_0x17de7e,{'showHidden':![],'depth':null}));ami[_0x7054('0x4a')](_0x7054('0xd0'),_0x17de7e);}if(_0x17de7e['queuecallerabandon']){_0x17de7e[_0x7054('0xb3')]=_0x7054('0xcc');logger[_0x7054('0x47')](_0x7054('0xd1'),_0x2ba8a5,util['inspect'](_0x17de7e,{'showHidden':![],'depth':null}));ami[_0x7054('0x4a')](_0x7054('0xd2'),_0x17de7e);}}else{this[_0x7054('0x13')][_0x17de7e[_0x7054('0x6e')]][_0x7054('0x5c')]+=this[_0x7054('0x13')][_0x17de7e['queue']]['sumHoldTime'];}logger[_0x7054('0x6f')](_0x7054('0xd3'),_0x2ba8a5,_0x17de7e[_0x7054('0x51')],_0x17de7e['type'],_0xb7070c);if(_0x51b322&&_0x17de7e['queuecallerexitreason']===_0x7054('0x4f')){_0x17de7e[_0x7054('0x8c')]='COMPLETEDBYAGENT';}this[_0x7054('0x37')][_0x2ba8a5]=_0x17de7e;this[_0x7054('0x44')](_0x17de7e,_0x7054('0x25'));this['emitVoiceQueueSummary'](this['voiceQueues'][_0x17de7e['queue']],'hangup');}}logger[_0x7054('0x47')](_0x7054('0xd4'),_0x2ba8a5,util[_0x7054('0x40')](this[_0x7054('0x10')][_0x2ba8a5],{'showHidden':![],'depth':null}));ami['emit'](_0x7054('0xd5'),this[_0x7054('0x10')][_0x2ba8a5]);if(_0x17de7e['queuecallerexitreason']===_0x7054('0x4f'))return;delete this[_0x7054('0x10')][_0x2ba8a5];delete this[_0x7054('0x37')][_0x2ba8a5];if(this['variables'][_0x2ba8a5]){delete this['variables'][_0x2ba8a5];}};VoiceQueueReport[_0x7054('0x35')][_0x7054('0xd6')]=function(_0x51a022){try{if(this[_0x7054('0x6d')](_0x51a022)){logger[_0x7054('0x47')](_0x7054('0xd7'),_0x51a022[_0x7054('0x4e')],util['inspect'](_0x51a022,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x51a022[_0x7054('0x4e')]]){return this[_0x7054('0xca')](_0x51a022[_0x7054('0x4e')],_0x51a022[_0x7054('0xd8')]);}if(this[_0x7054('0x10')][_0x51a022[_0x7054('0x9e')]]){if(_0x51a022['cause']==='21'){return;}return this[_0x7054('0xca')](_0x51a022[_0x7054('0x9e')],_0x51a022[_0x7054('0xd8')],!![]);}var _0x3e77bd=Object[_0x7054('0x84')](this['queueReports']);for(var _0x47de4c=0x0;_0x47de4c<_0x3e77bd[_0x7054('0xcb')];_0x47de4c++){var _0x5ebec1=_['last'](this[_0x7054('0x10')][_0x3e77bd[_0x47de4c]]);if(_0x5ebec1&&_0x5ebec1[_0x7054('0xd9')]===_0x51a022['uniqueid']){return this[_0x7054('0xca')](_0x5ebec1[_0x7054('0x4e')],_0x51a022['cause-txt'],!![]);}}}}catch(_0x1c1902){logger[_0x7054('0x3e')](_0x7054('0xd7'),_0x51a022['uniqueid'],util[_0x7054('0x40')](_0x1c1902,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAttendedTransfer']=function(_0x1b00f2){try{if(this[_0x7054('0x6d')](_0x1b00f2)){logger[_0x7054('0x47')](_0x7054('0xda'),_0x1b00f2[_0x7054('0x4e')],util[_0x7054('0x40')](_0x1b00f2,{'showHidden':![],'depth':null}));var _0x42ddee;var _0x32090e;var _0x4946b1;if(this[_0x7054('0x10')][_0x1b00f2[_0x7054('0xdb')]]){_0x42ddee=_[_0x7054('0x87')](this[_0x7054('0x10')][_0x1b00f2[_0x7054('0xdb')]]);_0x42ddee[_0x7054('0xa4')]=_0x1b00f2[_0x7054('0xdc')];_0x42ddee['transferuniqueid']=_0x1b00f2['secondtransfereruniqueid'];_0x42ddee[_0x7054('0x8c')]='ATTENDEDTRANSFER';_0x42ddee[_0x7054('0x9a')]=!![];_0x42ddee['transfertype']='ATTENDED';if(this[_0x7054('0x10')][_0x1b00f2[_0x7054('0xdd')]]){_0x4946b1=this[_0x7054('0x10')][_0x1b00f2[_0x7054('0xdd')]];this[_0x7054('0x10')][_0x1b00f2['secondtransfereruniqueid']]=this[_0x7054('0x10')][_0x1b00f2['transfereeuniqueid']];this['queueReports'][_0x1b00f2[_0x7054('0xdb')]]=_0x4946b1;_0x32090e=_[_0x7054('0x87')](this[_0x7054('0x10')][_0x1b00f2[_0x7054('0xdb')]]);_0x32090e[_0x7054('0x38')]=!![];}logger['info'](_0x7054('0xde'),_0x1b00f2[_0x7054('0x4e')],_0x42ddee[_0x7054('0x51')],_0x42ddee['type'],_0x42ddee['transferexten'],_0x42ddee[_0x7054('0xdf')]);}else if(this[_0x7054('0x10')][_0x1b00f2['transfertargetuniqueid']]){_0x42ddee=_['last'](this[_0x7054('0x10')][_0x1b00f2[_0x7054('0xe0')]]);_0x42ddee[_0x7054('0xa4')]=_0x1b00f2[_0x7054('0xe1')];_0x42ddee[_0x7054('0xdf')]=_0x1b00f2[_0x7054('0xe2')];_0x42ddee['queuecallerexitreason']=_0x7054('0x4f');_0x42ddee['transfer']=!![];_0x42ddee['transfertype']=_0x7054('0xe3');if(this['queueReports'][_0x1b00f2['origtransfereruniqueid']]){_0x4946b1=this['queueReports'][_0x1b00f2[_0x7054('0xe2')]];this[_0x7054('0x10')][_0x1b00f2[_0x7054('0xe2')]]=this['queueReports'][_0x1b00f2[_0x7054('0xe0')]];this[_0x7054('0x10')][_0x1b00f2[_0x7054('0xe0')]]=_0x4946b1;_0x32090e=_['last'](this[_0x7054('0x10')][_0x1b00f2[_0x7054('0xe0')]]);_0x32090e['switch']=!![];}logger['info'](_0x7054('0xde'),_0x1b00f2[_0x7054('0x4e')],_0x42ddee['name'],_0x42ddee[_0x7054('0x55')],_0x42ddee[_0x7054('0xa4')],_0x42ddee['transferuniqueid']);}else if(this[_0x7054('0x10')][_0x1b00f2['origtransfereruniqueid']]){_0x42ddee=_[_0x7054('0x87')](this[_0x7054('0x10')][_0x1b00f2[_0x7054('0xe2')]]);_0x42ddee[_0x7054('0xa4')]=_0x1b00f2['origtransfererexten'];_0x42ddee[_0x7054('0xdf')]=_0x1b00f2['origtransfereruniqueid'];_0x42ddee[_0x7054('0x8c')]=_0x7054('0x4f');_0x42ddee[_0x7054('0x9a')]=!![];_0x42ddee[_0x7054('0xa2')]=_0x7054('0xe3');_0x42ddee[_0x7054('0x38')]=!![];_0x42ddee[_0x7054('0xd9')]=_0x1b00f2[_0x7054('0xdb')];}else if(this[_0x7054('0x10')][_0x1b00f2[_0x7054('0xdd')]]){_0x42ddee=_['last'](this[_0x7054('0x10')][_0x1b00f2[_0x7054('0xdd')]]);_0x42ddee[_0x7054('0xa4')]=_0x1b00f2[_0x7054('0xdc')];_0x42ddee[_0x7054('0xdf')]=_0x1b00f2['secondtransfereruniqueid'];_0x42ddee['queuecallerexitreason']='ATTENDEDTRANSFER';_0x42ddee['transfer']=!![];_0x42ddee[_0x7054('0xa2')]='ATTENDED';_0x42ddee[_0x7054('0x38')]=!![];_0x42ddee[_0x7054('0xd9')]=_0x1b00f2[_0x7054('0xe0')];}}}catch(_0x39d05a){logger[_0x7054('0x3e')](_0x7054('0xda'),_0x1b00f2['uniqueid'],util[_0x7054('0x40')](_0x39d05a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7054('0x35')][_0x7054('0x2c')]=function(_0x1a20a9){try{if(this[_0x7054('0x6d')](_0x1a20a9)){logger['debug']('[%s][voiceQueueReport][blindtransfer]',_0x1a20a9[_0x7054('0x4e')],util[_0x7054('0x40')](_0x1a20a9,{'showHidden':![],'depth':null}));if(this[_0x7054('0x10')][_0x1a20a9['transfereeuniqueid']]){var _0x579b07=_['last'](this[_0x7054('0x10')][_0x1a20a9[_0x7054('0xdb')]]);_0x579b07[_0x7054('0x8c')]=_0x7054('0xe4');_0x579b07[_0x7054('0x9a')]=!![];_0x579b07[_0x7054('0xa2')]=_0x7054('0xe5');_0x579b07[_0x7054('0xa4')]=_0x1a20a9[_0x7054('0xe6')];_0x579b07[_0x7054('0xdf')]=_0x1a20a9[_0x7054('0xdb')];logger['info'](_0x7054('0xe7'),_0x1a20a9['uniqueid'],_0x579b07['name'],_0x579b07[_0x7054('0x55')],_0x579b07[_0x7054('0xa4')],_0x579b07['transferuniqueid']);this['syncHangup']({'event':_0x7054('0xe8'),'uniqueid':_0x1a20a9['transfereeuniqueid'],'context':_0x1a20a9[_0x7054('0xe9')],'channel':_0x1a20a9[_0x7054('0xea')]});}}}catch(_0x6ad4f5){logger['error'](_0x7054('0xeb'),_0x1a20a9[_0x7054('0x4e')],util[_0x7054('0x40')](_0x6ad4f5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7054('0x35')][_0x7054('0xec')]=function(_0x4387b0){try{if(this[_0x7054('0x6d')](_0x4387b0)){logger[_0x7054('0x47')](_0x7054('0xed'),_0x4387b0[_0x7054('0x4e')],util[_0x7054('0x40')](_0x4387b0,{'showHidden':![],'depth':null}));if(this[_0x7054('0x10')][_0x4387b0['uniqueid']]){var _0x1fee4d=_[_0x7054('0x87')](this['queueReports'][_0x4387b0[_0x7054('0x4e')]]);if(!_[_0x7054('0xc8')](_0x1fee4d[_0x7054('0x90')])){_0x1fee4d[_0x7054('0xee')]=moment()['format'](_0x7054('0x7d'));logger[_0x7054('0x6f')](_0x7054('0xef'),_0x4387b0[_0x7054('0x4e')],_0x1fee4d[_0x7054('0xee')]);}}}}catch(_0x1e8bfa){logger[_0x7054('0x3e')](_0x7054('0xed'),_0x4387b0[_0x7054('0x4e')],util[_0x7054('0x40')](_0x1e8bfa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7054('0x35')][_0x7054('0xf0')]=function(_0x4453bb){try{if(this[_0x7054('0x6d')](_0x4453bb)){logger['debug'](_0x7054('0xf1'),_0x4453bb[_0x7054('0x4e')],util[_0x7054('0x40')](_0x4453bb,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4453bb[_0x7054('0x4e')]]){var _0x56c1ad=_[_0x7054('0x87')](this[_0x7054('0x10')][_0x4453bb['uniqueid']]);if(!_[_0x7054('0xc8')](_0x56c1ad[_0x7054('0xee')])){_0x56c1ad['mohtime']+=moment()[_0x7054('0xce')](0x0)[_0x7054('0xcd')](_0x56c1ad[_0x7054('0xee')],'seconds');logger[_0x7054('0x6f')]('[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s',_0x4453bb[_0x7054('0x4e')],_0x56c1ad[_0x7054('0xf2')]);delete _0x56c1ad['mohstarttime'];}}}}catch(_0x4b54a6){logger[_0x7054('0x3e')]('[%s][voiceQueueReport][musiconholdstop]',_0x4453bb[_0x7054('0x4e')],util[_0x7054('0x40')](_0x4b54a6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7054('0x35')][_0x7054('0xf3')]=function(_0x3a3bc3){try{if(this[_0x7054('0x6d')](_0x3a3bc3)){logger[_0x7054('0x47')]('[%s][voiceQueueReport][newexten]\x20event:',_0x3a3bc3[_0x7054('0x4e')],util[_0x7054('0x40')](_0x3a3bc3,{'showHidden':![],'depth':null}));if(_0x3a3bc3[_0x7054('0xf4')][_0x7054('0x9c')]()===_0x7054('0xf5')){_0x3a3bc3[_0x7054('0xf6')]=_0x3a3bc3[_0x7054('0xf7')]&&_0x3a3bc3[_0x7054('0xf7')][_0x7054('0x9b')](_0x7054('0xf8'))?_0x3a3bc3['appdata']:(_0x3a3bc3[_0x7054('0xf7')]||_0x3a3bc3[_0x7054('0xf6')])['toLowerCase']();if(_['startsWith'](_0x3a3bc3[_0x7054('0xf6')]['toLowerCase'](),_0x7054('0xf9'))){logger[_0x7054('0x6f')](_0x7054('0xfa'),_0x3a3bc3[_0x7054('0x4e')],_0x3a3bc3[_0x7054('0xf4')],_0x3a3bc3[_0x7054('0xf6')]);if(_['isUndefined'](this[_0x7054('0x37')][_0x3a3bc3[_0x7054('0x4e')]]))this[_0x7054('0x37')][_0x3a3bc3[_0x7054('0x4e')]]={};var _0x12165b=_0x3a3bc3[_0x7054('0xf6')]['split']('=');var _0x278d58=_0x12165b[0x0][_0x7054('0x9c')]()['match'](/cdr\((.*)\)/);if(_0x278d58)this[_0x7054('0x37')][_0x3a3bc3[_0x7054('0x4e')]][_0x278d58[0x1]]=_0x12165b[0x1];}}}}catch(_0x476ccf){logger[_0x7054('0x3e')](_0x7054('0xfb'),_0x3a3bc3[_0x7054('0x4e')],util[_0x7054('0x40')](_0x476ccf,{'showHidden':![],'depth':null}));}};module['exports']=VoiceQueueReport;
\ No newline at end of file
+var _0xe167=['custom:timeout','queuecallerleaveAt','queueposition','EXITWITHKEY','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','handleHangup','length','diff','queuecallercompleteAt','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','hangup','[%s][voiceQueueReport][hangup]','cause','cause-txt','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfereruniqueid','ATTENDED','switch','transfertargetuniqueid','origtransfereruniqueid','origtransfererexten','transferid','secondtransfererexten','BLINDTRANSFER','BLIND','extension','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','milliseconds','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','startsWith','CDR(routeAlias)','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','exports','lodash','util','md5','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','voiceQueues','campaigns','queuesummary','syncQueueSummary','bind','queuesummarycomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','syncAgentConnect','varset','syncVarSet','syncHangup','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','attendedtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','unlockRR','isNil','status','channel','catch','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','[%s][voiceQueueReport][checkQueueReport]','inspect','variables','[%s][voiceQueueReport][checkVariables]','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','name','voice_queue_channel:save','voice_queue_presence:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][','voice_queue:save','isNotNull','isUndefined','clearZombieChannels','Action','queues','[voiceQueueReport][queues]','then','flagQueueSummary','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','talking','custom:queuesummary','syncQueueSummaryComplete','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','uniqueid','queuecallerjoinAt','position','count','routealias','info','merge','pick','keys','push','emitVoiceQueueChannelSave','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]','queuecallercomplete','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','last','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','connectedlinename','[%s][voiceQueueReport][queuecallerleave]','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','membername','holdtime','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','linkedid','queuecallerexitAt','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','value','variable','queuestatus','CONTINUE','queuecallerexit','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xe167,0x133));var _0x7e16=function(_0x176d50,_0x21da23){_0x176d50=_0x176d50-0x0;var _0x3673e1=_0xe167[_0x176d50];return _0x3673e1;};'use strict';var _=require(_0x7e16('0x0'));var moment=require('moment');var util=require(_0x7e16('0x1'));var md5=require(_0x7e16('0x2'));var Redis=require(_0x7e16('0x3'));var config=require(_0x7e16('0x4'));var logger=require(_0x7e16('0x5'))(_0x7e16('0x6'));var ami=require(_0x7e16('0x7'));var QueueReport=require(_0x7e16('0x8'));config[_0x7e16('0x9')]=_[_0x7e16('0xa')](config[_0x7e16('0x9')],{'host':_0x7e16('0xb'),'port':0x18eb});var io=require(_0x7e16('0xc'))(new Redis(config[_0x7e16('0x9')]));var Sequence=function(){};Sequence[_0x7e16('0xd')][_0x7e16('0xe')]=function(_0x1ed3a4){this[_0x7e16('0xf')]=this[_0x7e16('0xf')]?this[_0x7e16('0xf')][_0x7e16('0x10')](_0x1ed3a4):_0x1ed3a4();};function VoiceQueueReport(_0x27cff7){this[_0x7e16('0x11')]=new Sequence();this[_0x7e16('0x12')]={};this[_0x7e16('0x13')]=_0x27cff7[_0x7e16('0x13')];this[_0x7e16('0x14')]=_0x27cff7['queueChannels'];this[_0x7e16('0x15')]=_0x27cff7[_0x7e16('0x15')];this['flagQueueSummary']=!![];this[_0x7e16('0x16')]=_0x27cff7[_0x7e16('0x16')];this['variables']={};ami['on'](_0x7e16('0x17'),this[_0x7e16('0x18')][_0x7e16('0x19')](this));ami['on'](_0x7e16('0x1a'),this['syncQueueSummaryComplete'][_0x7e16('0x19')](this));ami['on'](_0x7e16('0x1b'),this[_0x7e16('0x1c')][_0x7e16('0x19')](this));ami['on'](_0x7e16('0x1d'),this['syncQueueCallerAbandon'][_0x7e16('0x19')](this));ami['on'](_0x7e16('0x1e'),this[_0x7e16('0x1f')]['bind'](this));ami['on'](_0x7e16('0x20'),this['syncAgentComplete']['bind'](this));ami['on'](_0x7e16('0x21'),this[_0x7e16('0x22')][_0x7e16('0x19')](this));ami['on'](_0x7e16('0x23'),this[_0x7e16('0x24')]['bind'](this));ami['on']('hangup',this[_0x7e16('0x25')]['bind'](this));ami['on']('fullybooted',this[_0x7e16('0x26')][_0x7e16('0x19')](this));ami['on'](_0x7e16('0x27'),this[_0x7e16('0x28')][_0x7e16('0x19')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x7e16('0x19')](this));ami['on'](_0x7e16('0x29'),this['syncAttendedTransfer'][_0x7e16('0x19')](this));ami['on']('blindtransfer',this[_0x7e16('0x2a')][_0x7e16('0x19')](this));this[_0x7e16('0x2b')]();this[_0x7e16('0x2c')]();}function clearChannels(_0x476b18){if(!_[_0x7e16('0x2d')](_0x476b18)){for(var _0x50697a in _0x476b18){if(_0x476b18[_0x7e16('0x2e')](_0x50697a)){delete _0x476b18[_0x50697a];}}}}function clearCampaigns(_0x1b4955){if(!_['isEmpty'](_0x1b4955)){for(var _0x108c07 in _0x1b4955){if(_0x1b4955[_0x7e16('0x2e')](_0x108c07)){_0x1b4955[_0x108c07][_0x7e16('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x5e12ec){if(!_[_0x7e16('0x2d')](_0x5e12ec)){for(var _0x8b5419 in _0x5e12ec){if(_0x5e12ec[_0x7e16('0x2e')](_0x8b5419)){_0x5e12ec[_0x8b5419][_0x7e16('0x2f')]=0x0;_0x5e12ec[_0x8b5419]['talking']=0x0;_0x5e12ec[_0x8b5419][_0x7e16('0x30')]=0x0;_0x5e12ec[_0x8b5419][_0x7e16('0x31')]=0x0;_0x5e12ec[_0x8b5419][_0x7e16('0x32')]=!![];}}}}function clearAgentBooked(_0x4d425c){if(!_[_0x7e16('0x2d')](_0x4d425c)){for(var _0x169eb6 in _0x4d425c){if(_0x4d425c[_0x7e16('0x2e')](_0x169eb6)){_0x4d425c[_0x169eb6][_0x7e16('0x33')]=!![];}}}}VoiceQueueReport[_0x7e16('0xd')]['clearZombieChannels']=function(){var _0x1a0a10=this;for(var _0x4e7c16 in this[_0x7e16('0x14')]){if(this[_0x7e16('0x14')][_0x7e16('0x2e')](_0x4e7c16)&&!this[_0x7e16('0x14')][_0x4e7c16]['switch']){this[_0x7e16('0x11')]['enqueue'](function(){if(!_[_0x7e16('0x34')](_0x1a0a10[_0x7e16('0x14')][_0x4e7c16])){return ami['Action']({'action':_0x7e16('0x35'),'channel':_0x1a0a10['channels'][_0x4e7c16][_0x7e16('0x36')]})[_0x7e16('0x37')](function(_0x42b842){if(_0x42b842['message']===_0x7e16('0x38')){setTimeout(function(){if(_0x1a0a10[_0x7e16('0x14')][_0x4e7c16]){delete _0x1a0a10['channels'][_0x4e7c16];logger[_0x7e16('0x39')](_0x7e16('0x3a'),_0x4e7c16,util['inspect'](_0x42b842,{'showHidden':![],'depth':null}));}if(_0x1a0a10[_0x7e16('0x12')][_0x4e7c16]){delete _0x1a0a10[_0x7e16('0x12')][_0x4e7c16];logger['error'](_0x7e16('0x3b'),_0x4e7c16,util[_0x7e16('0x3c')](_0x42b842,{'showHidden':![],'depth':null}));}if(_0x1a0a10['variables'][_0x4e7c16]){delete _0x1a0a10[_0x7e16('0x3d')][_0x4e7c16];logger[_0x7e16('0x39')](_0x7e16('0x3e'),_0x4e7c16,util[_0x7e16('0x3c')](_0x42b842,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0x7e16('0x39')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x7e16('0x14')]);this[_0x7e16('0x3f')](this[_0x7e16('0x12')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x7e16('0x15')]);clearCampaigns(this[_0x7e16('0x16')]);};VoiceQueueReport[_0x7e16('0xd')][_0x7e16('0x3f')]=function(_0x10a32b){var _0x469f44=this;if(!_['isEmpty'](_0x10a32b)){for(var _0x39a0cc in _0x10a32b){if(_0x10a32b[_0x7e16('0x2e')](_0x39a0cc)){_0x469f44[_0x7e16('0x40')](_0x10a32b[_0x39a0cc],_0x7e16('0x41'));delete _0x10a32b[_0x39a0cc];}}}};VoiceQueueReport[_0x7e16('0xd')][_0x7e16('0x42')]=function(_0x4737db,_0x4fc784,_0x5de706){io['to'](_0x4737db)[_0x7e16('0x42')](_0x4fc784,_0x5de706);};VoiceQueueReport['prototype']['emitVoiceQueueChannelSave']=function(_0x49c3b1,_0x19eb76){logger['debug'](_0x7e16('0x43')+_0x19eb76+_0x7e16('0x44'),_0x49c3b1['uniqueid'],util[_0x7e16('0x3c')](_0x49c3b1,{'showHidden':![],'depth':null}));this['emit'](util[_0x7e16('0x45')]('voice:queue:%s',_0x49c3b1[_0x7e16('0x46')]),_0x7e16('0x47'),_0x49c3b1);io['emit'](_0x7e16('0x48'),_0x49c3b1);};VoiceQueueReport[_0x7e16('0xd')][_0x7e16('0x40')]=function(_0x352a7f,_0x1f4def){logger[_0x7e16('0x49')]('[%s][voiceQueueReport]['+_0x1f4def+_0x7e16('0x4a'),_0x352a7f['uniqueid'],util[_0x7e16('0x3c')](_0x352a7f,{'showHidden':![],'depth':null}));if(_0x352a7f[_0x7e16('0x4b')]===_0x7e16('0x4c'))return;this[_0x7e16('0x42')](util['format'](_0x7e16('0x4d'),_0x352a7f[_0x7e16('0x46')]),_0x7e16('0x4e'),_0x352a7f);io[_0x7e16('0x42')](_0x7e16('0x4f'),_0x352a7f);};VoiceQueueReport[_0x7e16('0xd')][_0x7e16('0x50')]=function(_0xd1faa5,_0x177dfa){if(_0xd1faa5[_0x7e16('0x51')]===_0x7e16('0x52')){var _0x3365ee={'id':_0xd1faa5['id'],'name':_0xd1faa5[_0x7e16('0x46')],'strategy':_0xd1faa5[_0x7e16('0x53')],'answered':_0xd1faa5[_0x7e16('0x54')],'available':_0xd1faa5[_0x7e16('0x55')],'loggedIn':_0xd1faa5[_0x7e16('0x56')],'pTalking':_0xd1faa5[_0x7e16('0x30')],'sumBillable':_0xd1faa5[_0x7e16('0x57')],'sumDuration':_0xd1faa5[_0x7e16('0x58')],'sumHoldTime':_0xd1faa5[_0x7e16('0x59')]||0x0,'talking':_0xd1faa5['talking'],'total':_0xd1faa5['total'],'type':_0xd1faa5[_0x7e16('0x51')],'unmanaged':_0xd1faa5[_0x7e16('0x5a')],'abandoned':_0xd1faa5[_0x7e16('0x5b')],'waiting':_0xd1faa5[_0x7e16('0x31')]};if(_0xd1faa5[_0x7e16('0x5c')]){_0x3365ee[_0x7e16('0x5c')]={'id':_0xd1faa5['Trunk']['id'],'name':_0xd1faa5[_0x7e16('0x5c')][_0x7e16('0x46')],'active':_0xd1faa5[_0x7e16('0x5c')][_0x7e16('0x5d')],'callerid':_0xd1faa5[_0x7e16('0x5c')][_0x7e16('0x5e')]};}if(_0xd1faa5[_0x7e16('0x5f')]){_0x3365ee['Interval']={'id':_0xd1faa5['Interval']['id'],'name':_0xd1faa5[_0x7e16('0x5f')]['name']};}var _0x46db17=md5(JSON[_0x7e16('0x60')](_0x3365ee));if(_0xd1faa5[_0x7e16('0x2')]!==_0x46db17){_0xd1faa5[_0x7e16('0x2')]=_0x46db17;logger[_0x7e16('0x49')](_0x7e16('0x61')+_0x177dfa+']\x20sending\x20voice_queue:save\x20event:',util[_0x7e16('0x3c')](_0x3365ee,{'showHidden':![],'depth':null}));this['emit'](util[_0x7e16('0x45')]('voice:queue:%s',_0x3365ee[_0x7e16('0x46')]),_0x7e16('0x62'),_0x3365ee);}}};VoiceQueueReport['prototype'][_0x7e16('0x63')]=function(_0x540a0d){return _0x540a0d!==null&&!_[_0x7e16('0x64')](_0x540a0d);};VoiceQueueReport[_0x7e16('0xd')][_0x7e16('0x2c')]=function(){var _0x35444f=this;setInterval(function(){_0x35444f[_0x7e16('0x65')]();ami[_0x7e16('0x66')]({'action':_0x7e16('0x67')})[_0x7e16('0x37')](function(_0x38aca9){logger[_0x7e16('0x39')](_0x7e16('0x68'),util[_0x7e16('0x3c')](_0x38aca9,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x7e16('0xd')]['loopQueueSummary']=function(){var _0x3ce27f=this;setInterval(function(){if(_0x3ce27f['flagQueueSummary']){return ami[_0x7e16('0x66')]({'action':_0x7e16('0x17')})[_0x7e16('0x69')](function(){_0x3ce27f[_0x7e16('0x6a')]=![];})[_0x7e16('0x37')](function(_0x3c12bf){logger[_0x7e16('0x39')](_0x7e16('0x6b'),util['inspect'](_0x3c12bf,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x7e16('0x18')]=function(_0x2df739){try{if(this[_0x7e16('0x63')](_0x2df739)&&this[_0x7e16('0x63')](_0x2df739[_0x7e16('0x6c')])){logger['debug'](_0x7e16('0x6d'),util[_0x7e16('0x3c')](_0x2df739,{'showHidden':![],'depth':null}));if(this[_0x7e16('0x15')][_0x2df739[_0x7e16('0x6c')]]){logger['info'](_0x7e16('0x6e'),_0x2df739[_0x7e16('0x6c')]);var _0x5fbb6c=_[_0x7e16('0x6f')](this[_0x7e16('0x14')],_0x7e16('0x6c'))[_0x2df739[_0x7e16('0x6c')]]||0x0;var _0x3b65d6=_0x5fbb6c-_0x2df739[_0x7e16('0x70')];if(this[_0x7e16('0x15')][_0x2df739[_0x7e16('0x6c')]][_0x7e16('0x31')]!==_[_0x7e16('0x71')](_0x2df739[_0x7e16('0x70')])||this[_0x7e16('0x15')][_0x2df739[_0x7e16('0x6c')]]['loggedIn']!==_['toNumber'](_0x2df739[_0x7e16('0x72')])||this[_0x7e16('0x15')][_0x2df739['queue']][_0x7e16('0x55')]!==_[_0x7e16('0x71')](_0x2df739['available'])||this['voiceQueues'][_0x2df739[_0x7e16('0x6c')]][_0x7e16('0x73')]!==_0x3b65d6){this[_0x7e16('0x15')][_0x2df739[_0x7e16('0x6c')]]['waiting']=_[_0x7e16('0x71')](_0x2df739[_0x7e16('0x70')]);this[_0x7e16('0x15')][_0x2df739[_0x7e16('0x6c')]][_0x7e16('0x56')]=_[_0x7e16('0x71')](_0x2df739['loggedin']);this[_0x7e16('0x15')][_0x2df739[_0x7e16('0x6c')]][_0x7e16('0x55')]=_[_0x7e16('0x71')](_0x2df739[_0x7e16('0x55')]);this['voiceQueues'][_0x2df739[_0x7e16('0x6c')]]['talking']=_0x3b65d6>0x0?_0x3b65d6:0x0;this[_0x7e16('0x15')][_0x2df739[_0x7e16('0x6c')]][_0x7e16('0x73')]=this['voiceQueues'][_0x2df739['queue']][_0x7e16('0x73')]>_[_0x7e16('0x71')](_0x2df739[_0x7e16('0x72')])?_[_0x7e16('0x71')](_0x2df739['loggedin']):this[_0x7e16('0x15')][_0x2df739[_0x7e16('0x6c')]][_0x7e16('0x73')];this[_0x7e16('0x50')](this[_0x7e16('0x15')][_0x2df739[_0x7e16('0x6c')]],_0x7e16('0x17'));}logger[_0x7e16('0x49')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x7e16('0x3c')](this[_0x7e16('0x15')][_0x2df739[_0x7e16('0x6c')]],{'showHidden':![],'depth':null}));ami[_0x7e16('0x42')](_0x7e16('0x74'),this[_0x7e16('0x15')][_0x2df739[_0x7e16('0x6c')]]);}}}catch(_0x37428d){logger[_0x7e16('0x39')](_0x7e16('0x6b'),util[_0x7e16('0x3c')](_0x37428d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e16('0xd')][_0x7e16('0x75')]=function(_0x4bcce7){logger['debug'](_0x7e16('0x76'),util['inspect'](_0x4bcce7,{'showHidden':![],'depth':null}));ami['emit']('custom:queuesummarycomplete',{});this[_0x7e16('0x6a')]=!![];};VoiceQueueReport[_0x7e16('0xd')][_0x7e16('0x1c')]=function(_0x7abbb9){try{if(this[_0x7e16('0x63')](_0x7abbb9)){logger[_0x7e16('0x49')](_0x7e16('0x77'),_0x7abbb9[_0x7e16('0x78')],util[_0x7e16('0x3c')](_0x7abbb9,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x7abbb9['uniqueid']]))this['queueReports'][_0x7abbb9[_0x7e16('0x78')]]=[];if(_[_0x7e16('0x64')](this[_0x7e16('0x14')][_0x7abbb9[_0x7e16('0x78')]]))this[_0x7e16('0x14')][_0x7abbb9[_0x7e16('0x78')]]={};var _0x24f822=new QueueReport();_0x24f822[_0x7e16('0x46')]=_0x7abbb9['queue'];_0x24f822[_0x7e16('0x51')]=this['voiceQueues'][_0x24f822[_0x7e16('0x46')]]&&this[_0x7e16('0x15')][_0x24f822[_0x7e16('0x46')]][_0x7e16('0x51')]?this[_0x7e16('0x15')][_0x24f822[_0x7e16('0x46')]][_0x7e16('0x51')]||_0x7e16('0x52'):'inbound';_0x24f822[_0x7e16('0x6c')]=_0x7abbb9[_0x7e16('0x6c')];_0x24f822[_0x7e16('0x79')]=moment()[_0x7e16('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x24f822[_0x7e16('0x7a')]=_0x7abbb9[_0x7e16('0x7a')];_0x24f822[_0x7e16('0x7b')]=_0x7abbb9[_0x7e16('0x7b')];_0x24f822[_0x7e16('0x78')]=_0x7abbb9['uniqueid'];_0x24f822[_0x7e16('0x7c')]=this[_0x7e16('0x14')][_0x7abbb9[_0x7e16('0x78')]][_0x7e16('0x7c')];logger[_0x7e16('0x7d')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x24f822[_0x7e16('0x46')],_0x24f822[_0x7e16('0x51')]);_[_0x7e16('0x7e')](_0x24f822,_[_0x7e16('0x7f')](_0x7abbb9,_[_0x7e16('0x80')](_0x24f822)));this[_0x7e16('0x12')][_0x7abbb9[_0x7e16('0x78')]][_0x7e16('0x81')](_0x24f822);this[_0x7e16('0x14')][_0x7abbb9[_0x7e16('0x78')]]=_0x24f822;this[_0x7e16('0x82')](_0x24f822,'queuecallerjoin');}}catch(_0x26f4c2){logger[_0x7e16('0x39')](_0x7e16('0x77'),_0x7abbb9[_0x7e16('0x78')],util[_0x7e16('0x3c')](_0x26f4c2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7e16('0x83')]=function(_0x4d6935){try{if(this[_0x7e16('0x63')](_0x4d6935)){logger[_0x7e16('0x49')](_0x7e16('0x84'),_0x4d6935[_0x7e16('0x78')],util[_0x7e16('0x3c')](_0x4d6935,{'showHidden':![],'depth':null}));if(this[_0x7e16('0x12')][_0x4d6935[_0x7e16('0x78')]]){var _0x5b7167=_['last'](this[_0x7e16('0x12')][_0x4d6935[_0x7e16('0x78')]]);_0x5b7167[_0x7e16('0x85')]=![];_0x5b7167['queuecallercompleteAt']=null;_0x5b7167['holdtime']=_0x4d6935['holdtime'];_0x5b7167[_0x7e16('0x86')]=_0x4d6935[_0x7e16('0x86')];_0x5b7167[_0x7e16('0x1d')]=!![];_0x5b7167[_0x7e16('0x87')]=moment()[_0x7e16('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x5b7167[_0x7e16('0x4b')]=_0x7e16('0x88');_0x5b7167[_0x7e16('0x89')]=null;logger[_0x7e16('0x7d')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x5b7167[_0x7e16('0x46')],_0x5b7167[_0x7e16('0x51')]);this['channels'][_0x4d6935['uniqueid']]=_0x5b7167;this[_0x7e16('0x40')](_0x5b7167,'queuecallerabandon');}}}catch(_0x7bfd7f){logger[_0x7e16('0x39')](_0x7e16('0x84'),_0x4d6935[_0x7e16('0x78')],util[_0x7e16('0x3c')](_0x7bfd7f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e16('0xd')][_0x7e16('0x1f')]=function(_0x33ade3){try{if(this[_0x7e16('0x63')](_0x33ade3)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x33ade3['uniqueid'],util[_0x7e16('0x3c')](_0x33ade3,{'showHidden':![],'depth':null}));if(this[_0x7e16('0x12')][_0x33ade3[_0x7e16('0x78')]]){var _0x4cbfb4=_[_0x7e16('0x8a')](this['queueReports'][_0x33ade3[_0x7e16('0x78')]]);_0x4cbfb4['queuecallerleaveAt']=moment()[_0x7e16('0x45')](_0x7e16('0x8b'));_0x4cbfb4['connectedlinenum']=_0x33ade3[_0x7e16('0x8c')];_0x4cbfb4[_0x7e16('0x8d')]=_0x33ade3[_0x7e16('0x8d')];logger[_0x7e16('0x7d')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4cbfb4['name'],_0x4cbfb4[_0x7e16('0x51')],_0x33ade3[_0x7e16('0x8c')],_0x33ade3[_0x7e16('0x8d')]);this[_0x7e16('0x14')][_0x33ade3[_0x7e16('0x78')]]=_0x4cbfb4;this[_0x7e16('0x82')](_0x4cbfb4,_0x7e16('0x1e'));}}}catch(_0x159073){logger[_0x7e16('0x39')](_0x7e16('0x8e'),_0x33ade3[_0x7e16('0x78')],util[_0x7e16('0x3c')](_0x159073,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e16('0xd')]['syncAgentConnect']=function(_0x9b991a){try{if(this[_0x7e16('0x63')](_0x9b991a)){logger[_0x7e16('0x49')]('[%s][voiceQueueReport][agentconnect]',_0x9b991a[_0x7e16('0x78')],util[_0x7e16('0x3c')](_0x9b991a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x9b991a['uniqueid']]){var _0x3b9a84=_[_0x7e16('0x8a')](this[_0x7e16('0x12')][_0x9b991a[_0x7e16('0x78')]]);_0x3b9a84['queuecallercomplete']=!![];_0x3b9a84['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x7e16('0x7d')](_0x7e16('0x8f'),_0x3b9a84['name'],_0x3b9a84[_0x7e16('0x51')]);}}}catch(_0x45904e){logger[_0x7e16('0x39')]('[%s][voiceQueueReport][agentconnect]',_0x9b991a[_0x7e16('0x78')],util['inspect'](_0x45904e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e16('0xd')][_0x7e16('0x90')]=function(_0x45ac9d){try{if(this[_0x7e16('0x63')](_0x45ac9d)){logger['debug'](_0x7e16('0x91'),_0x45ac9d[_0x7e16('0x78')],util[_0x7e16('0x3c')](_0x45ac9d,{'showHidden':![],'depth':null}));if(this[_0x7e16('0x12')][_0x45ac9d[_0x7e16('0x78')]]){var _0x47e37c=_[_0x7e16('0x8a')](this[_0x7e16('0x12')][_0x45ac9d[_0x7e16('0x78')]]);_0x47e37c[_0x7e16('0x1d')]=![];_0x47e37c[_0x7e16('0x87')]=null;_0x47e37c['assigned']=!![];_0x47e37c[_0x7e16('0x89')]=_0x45ac9d[_0x7e16('0x92')];_0x47e37c[_0x7e16('0x93')]=_0x45ac9d[_0x7e16('0x93')];_0x47e37c['queuecallercomplete']=!![];_0x47e37c['queuecallerexit']=![];_0x47e37c['queuecallerexitAt']=null;if(!_0x47e37c[_0x7e16('0x94')]){if(_0x45ac9d[_0x7e16('0x95')]=='transfer'){_0x47e37c['queuecallerexitreason']=_0x7e16('0x96');logger['info'](_0x7e16('0x97'),_0x47e37c[_0x7e16('0x46')],_0x47e37c[_0x7e16('0x51')]);}else{if(_['startsWith'](_0x45ac9d[_0x7e16('0x36')][_0x7e16('0x98')](),'local/')){if(this['queueReports'][_0x45ac9d[_0x7e16('0x99')]]){var _0x4885b5=_['last'](this[_0x7e16('0x12')][_0x45ac9d[_0x7e16('0x99')]]);_0x4885b5[_0x7e16('0x85')]=![];_0x4885b5['queuecallerexit']=!![];_0x4885b5[_0x7e16('0x9a')]=moment(_0x47e37c['queuecallerjoinAt'])['add'](_0x45ac9d[_0x7e16('0x93')],_0x7e16('0x9b'))[_0x7e16('0x45')](_0x7e16('0x8b'));_0x4885b5[_0x7e16('0x4b')]=_0x7e16('0x9c');_0x4885b5[_0x7e16('0x94')]=!![];_0x4885b5[_0x7e16('0x9d')]=_0x7e16('0x9e');_0x4885b5[_0x7e16('0x9f')]=_0x45ac9d[_0x7e16('0xa0')];_0x4885b5[_0x7e16('0xa1')]=_0x45ac9d[_0x7e16('0x78')];logger[_0x7e16('0x7d')](_0x7e16('0xa2'),_0x4885b5[_0x7e16('0x46')],_0x4885b5['type']);var _0x2eecaf=this[_0x7e16('0x12')][_0x45ac9d['linkedid']];this[_0x7e16('0x12')][_0x45ac9d[_0x7e16('0x99')]]=this[_0x7e16('0x12')][_0x45ac9d[_0x7e16('0x78')]];this[_0x7e16('0x12')][_0x45ac9d[_0x7e16('0x78')]]=_0x2eecaf;}}else{_0x47e37c[_0x7e16('0x4b')]='COMPLETEDBY'+_0x45ac9d[_0x7e16('0x95')][_0x7e16('0xa3')]();logger['info'](_0x7e16('0xa4'),_0x47e37c['name'],_0x47e37c['type'],_0x47e37c[_0x7e16('0x4b')]);}}}this['channels'][_0x45ac9d[_0x7e16('0x78')]]=_0x47e37c;this['emitVoiceQueueChannelRemove'](_0x47e37c,_0x7e16('0x20'));}}}catch(_0x3afc58){logger[_0x7e16('0x39')](_0x7e16('0x91'),_0x45ac9d[_0x7e16('0x78')],util[_0x7e16('0x3c')](_0x3afc58,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e16('0xd')][_0x7e16('0x24')]=function(_0x5873f6){try{if(this[_0x7e16('0x63')](_0x5873f6)){logger['debug'](_0x7e16('0xa5'),_0x5873f6[_0x7e16('0x78')],util[_0x7e16('0x3c')](_0x5873f6,{'showHidden':![],'depth':null}));this['addVariable'](_0x5873f6['uniqueid'],_[_0x7e16('0x80')](_0x5873f6['variable'])[0x0],_0x5873f6[_0x7e16('0xa6')]);if(this[_0x7e16('0x12')][_0x5873f6['uniqueid']]){var _0x3b8ec1=_[_0x7e16('0x8a')](this[_0x7e16('0x12')][_0x5873f6[_0x7e16('0x78')]]);if(_0x3b8ec1){if(this[_0x7e16('0x63')](_0x5873f6[_0x7e16('0xa7')])&&this[_0x7e16('0x63')](_0x5873f6[_0x7e16('0xa7')][_0x7e16('0xa8')])){switch(_0x5873f6[_0x7e16('0xa6')]){case _0x7e16('0xa9'):_0x3b8ec1[_0x7e16('0xaa')]=![];_0x3b8ec1[_0x7e16('0x9a')]=null;break;case'TIMEOUT':_0x3b8ec1['lastevent']=_0x7e16('0xab');_0x3b8ec1['queuecallerexit']=!![];_0x3b8ec1[_0x7e16('0x9a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3b8ec1['queuecallerleaveAt']=moment()[_0x7e16('0x45')](_0x7e16('0x8b'));logger['debug'](_0x7e16('0xac'),_0x5873f6[_0x7e16('0x78')],util[_0x7e16('0x3c')](_0x3b8ec1,{'showHidden':![],'depth':null}));ami[_0x7e16('0x42')](_0x7e16('0xad'),_0x3b8ec1);break;default:_0x3b8ec1[_0x7e16('0xaa')]=!![];_0x3b8ec1[_0x7e16('0x9a')]=moment()['format'](_0x7e16('0x8b'));_0x3b8ec1[_0x7e16('0xae')]=moment()['format'](_0x7e16('0x8b'));}_0x3b8ec1[_0x7e16('0x1d')]=![];_0x3b8ec1[_0x7e16('0x87')]=null;_0x3b8ec1['queuecallerexitreason']=_0x5873f6[_0x7e16('0xa6')];this[_0x7e16('0x14')][_0x5873f6['uniqueid']]=_0x3b8ec1;this[_0x7e16('0x40')](_0x3b8ec1,_0x7e16('0x23'));}else if(this[_0x7e16('0x63')](_0x5873f6['variable'])&&this['isNotNull'](_0x5873f6['variable'][_0x7e16('0xaf')])){if(!_0x3b8ec1['queuecallerabandon']){_0x3b8ec1['queuecallerexit']=!![];_0x3b8ec1[_0x7e16('0x9a')]=moment()[_0x7e16('0x45')](_0x7e16('0x8b'));_0x3b8ec1[_0x7e16('0x4b')]=_0x7e16('0xb0');_0x3b8ec1[_0x7e16('0xae')]=moment()[_0x7e16('0x45')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5873f6[_0x7e16('0x78')]]=_0x3b8ec1;}}logger[_0x7e16('0x7d')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x5873f6[_0x7e16('0x78')],_0x3b8ec1[_0x7e16('0x46')],_0x3b8ec1[_0x7e16('0x51')],_[_0x7e16('0x80')](_0x5873f6[_0x7e16('0xa7')])[0x0],_0x5873f6[_0x7e16('0xa6')]);_0x3b8ec1[_0x7e16('0x3d')]=this[_0x7e16('0x3d')][_0x5873f6[_0x7e16('0x78')]];}}}}catch(_0x49301c){logger[_0x7e16('0x39')](_0x7e16('0xa5'),_0x5873f6['uniqueid'],util[_0x7e16('0x3c')](_0x49301c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7e16('0xb1')]=function(_0x2911c,_0x1c4358,_0x25f7de){var _0x7c2c1d=['rtpaudioqos',_0x7e16('0xb2'),_0x7e16('0xb3'),_0x7e16('0xb4'),_0x7e16('0xb5'),'rtpaudioqoslossbridged',_0x7e16('0xb6'),'rtpaudioqosrttbridged',_0x7e16('0xb7'),_0x7e16('0xb8'),_0x7e16('0xb9'),_0x7e16('0xba'),_0x7e16('0xbb'),_0x7e16('0xbc'),_0x7e16('0xbd'),_0x7e16('0xbe'),_0x7e16('0x92'),_0x7e16('0xbf'),_0x7e16('0xc0')];if(!_[_0x7e16('0x34')](_0x1c4358)&&!_['includes'](_0x7c2c1d,_0x1c4358)){if(_[_0x7e16('0x64')](this[_0x7e16('0x3d')][_0x2911c])){this[_0x7e16('0x3d')][_0x2911c]={};}this[_0x7e16('0x3d')][_0x2911c][_0x1c4358]=_0x25f7de;}};VoiceQueueReport[_0x7e16('0xd')][_0x7e16('0xc1')]=function(_0xb7464f,_0x10ac5d,_0x4e19cd){var _0x4421e2={};for(var _0x33574a=0x0;_0x33574a<this['queueReports'][_0xb7464f][_0x7e16('0xc2')];_0x33574a+=0x1){_0x4421e2=this['queueReports'][_0xb7464f][_0x33574a];if(this[_0x7e16('0x15')][_0x4421e2[_0x7e16('0x6c')]]){if(_0x4421e2[_0x7e16('0xaa')]&&_0x4421e2[_0x7e16('0x94')]!=!![]){this[_0x7e16('0x15')][_0x4421e2['queue']]['unmanaged']+=0x1;}if(_0x4421e2[_0x7e16('0x1d')]){this[_0x7e16('0x15')][_0x4421e2['queue']][_0x7e16('0x5b')]+=0x1;}this[_0x7e16('0x15')][_0x4421e2[_0x7e16('0x6c')]]['sumHoldTime']+=moment(_0x4421e2[_0x7e16('0xae')])[_0x7e16('0xc3')](_0x4421e2[_0x7e16('0x79')],_0x7e16('0x9b'))||0x0;if(_0x33574a===this[_0x7e16('0x12')][_0xb7464f][_0x7e16('0xc2')]-0x1){this[_0x7e16('0x15')][_0x4421e2[_0x7e16('0x6c')]][_0x7e16('0x58')]+=moment()['milliseconds'](0x0)[_0x7e16('0xc3')](_0x4421e2[_0x7e16('0x79')],_0x7e16('0x9b'));this[_0x7e16('0x15')][_0x4421e2[_0x7e16('0x6c')]]['total']+=0x1;if(_0x4421e2['queuecallercomplete']){this['voiceQueues'][_0x4421e2['queue']][_0x7e16('0x54')]+=0x1;this[_0x7e16('0x15')][_0x4421e2[_0x7e16('0x6c')]][_0x7e16('0x57')]+=moment()['milliseconds'](0x0)[_0x7e16('0xc3')](_0x4421e2[_0x7e16('0xae')],'seconds');_0x4421e2[_0x7e16('0xc4')]=moment()[_0x7e16('0x45')](_0x7e16('0x8b'));_0x4421e2[_0x7e16('0xaa')]=![];_0x4421e2[_0x7e16('0x9a')]=null;}if(_0x4421e2[_0x7e16('0xaa')]&&_0x4421e2[_0x7e16('0x94')]!=!![]){_0x4421e2[_0x7e16('0xc5')]=_0x7e16('0x5a');logger[_0x7e16('0x49')]('[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:',_0xb7464f,util[_0x7e16('0x3c')](_0x4421e2,{'showHidden':![],'depth':null}));ami['emit']('custom:queuecallerunmanaged',_0x4421e2);}if(_0x4421e2['queuecallerabandon']){_0x4421e2[_0x7e16('0xc5')]=_0x7e16('0x5b');logger[_0x7e16('0x49')](_0x7e16('0xc6'),_0xb7464f,util[_0x7e16('0x3c')](_0x4421e2,{'showHidden':![],'depth':null}));ami['emit']('custom:queuecallerabandon',_0x4421e2);}}else{this[_0x7e16('0x15')][_0x4421e2[_0x7e16('0x6c')]]['sumDuration']+=this[_0x7e16('0x15')][_0x4421e2[_0x7e16('0x6c')]][_0x7e16('0x59')];}logger[_0x7e16('0x7d')](_0x7e16('0xc7'),_0xb7464f,_0x4421e2['name'],_0x4421e2[_0x7e16('0x51')],_0x10ac5d);if(_0x4e19cd&&_0x4421e2[_0x7e16('0x4b')]===_0x7e16('0x4c')){_0x4421e2[_0x7e16('0x4b')]='COMPLETEDBYAGENT';}this[_0x7e16('0x14')][_0xb7464f]=_0x4421e2;this[_0x7e16('0x40')](_0x4421e2,_0x7e16('0xc8'));this[_0x7e16('0x50')](this[_0x7e16('0x15')][_0x4421e2[_0x7e16('0x6c')]],_0x7e16('0xc8'));}}logger['debug']('[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:',_0xb7464f,util[_0x7e16('0x3c')](this[_0x7e16('0x12')][_0xb7464f],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceQueueReport',this['queueReports'][_0xb7464f]);if(_0x4421e2[_0x7e16('0x4b')]===_0x7e16('0x4c'))return;delete this['queueReports'][_0xb7464f];delete this['channels'][_0xb7464f];if(this['variables'][_0xb7464f]){delete this[_0x7e16('0x3d')][_0xb7464f];}};VoiceQueueReport['prototype'][_0x7e16('0x25')]=function(_0x3a5df6){try{if(this['isNotNull'](_0x3a5df6)){logger[_0x7e16('0x49')](_0x7e16('0xc9'),_0x3a5df6['uniqueid'],util[_0x7e16('0x3c')](_0x3a5df6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3a5df6[_0x7e16('0x78')]]){return this[_0x7e16('0xc1')](_0x3a5df6[_0x7e16('0x78')],_0x3a5df6['cause-txt']);}if(this['queueReports'][_0x3a5df6[_0x7e16('0x99')]]){if(_0x3a5df6[_0x7e16('0xca')]==='21'){return;}return this[_0x7e16('0xc1')](_0x3a5df6[_0x7e16('0x99')],_0x3a5df6[_0x7e16('0xcb')],!![]);}var _0x181fa4=Object[_0x7e16('0x80')](this[_0x7e16('0x12')]);for(var _0x3316dd=0x0;_0x3316dd<_0x181fa4['length'];_0x3316dd++){var _0x2c0185=_['last'](this['queueReports'][_0x181fa4[_0x3316dd]]);if(_0x2c0185&&_0x2c0185['transferid']===_0x3a5df6[_0x7e16('0x78')]){return this['handleHangup'](_0x2c0185['uniqueid'],_0x3a5df6[_0x7e16('0xcb')],!![]);}}}}catch(_0x388a61){logger['error'](_0x7e16('0xc9'),_0x3a5df6['uniqueid'],util[_0x7e16('0x3c')](_0x388a61,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e16('0xd')][_0x7e16('0xcc')]=function(_0x21dfdb){try{if(this[_0x7e16('0x63')](_0x21dfdb)){logger[_0x7e16('0x49')](_0x7e16('0xcd'),_0x21dfdb[_0x7e16('0x78')],util['inspect'](_0x21dfdb,{'showHidden':![],'depth':null}));var _0x3dc977;var _0x44fc8f;var _0xd40b2a;if(this[_0x7e16('0x12')][_0x21dfdb['transfereeuniqueid']]){_0x3dc977=_[_0x7e16('0x8a')](this[_0x7e16('0x12')][_0x21dfdb[_0x7e16('0xce')]]);_0x3dc977[_0x7e16('0x9f')]=_0x21dfdb['secondtransfererexten'];_0x3dc977[_0x7e16('0xa1')]=_0x21dfdb[_0x7e16('0xcf')];_0x3dc977['queuecallerexitreason']=_0x7e16('0x4c');_0x3dc977['transfer']=!![];_0x3dc977['transfertype']=_0x7e16('0xd0');if(this['queueReports'][_0x21dfdb['secondtransfereruniqueid']]){_0xd40b2a=this['queueReports'][_0x21dfdb['secondtransfereruniqueid']];this['queueReports'][_0x21dfdb['secondtransfereruniqueid']]=this[_0x7e16('0x12')][_0x21dfdb[_0x7e16('0xce')]];this[_0x7e16('0x12')][_0x21dfdb['transfereeuniqueid']]=_0xd40b2a;_0x44fc8f=_[_0x7e16('0x8a')](this['queueReports'][_0x21dfdb['transfereeuniqueid']]);_0x44fc8f[_0x7e16('0xd1')]=!![];}logger[_0x7e16('0x7d')]('[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s',_0x21dfdb[_0x7e16('0x78')],_0x3dc977['name'],_0x3dc977[_0x7e16('0x51')],_0x3dc977[_0x7e16('0x9f')],_0x3dc977[_0x7e16('0xa1')]);}else if(this[_0x7e16('0x12')][_0x21dfdb[_0x7e16('0xd2')]]){_0x3dc977=_[_0x7e16('0x8a')](this[_0x7e16('0x12')][_0x21dfdb[_0x7e16('0xd2')]]);_0x3dc977['transferexten']=_0x21dfdb['origtransfererexten'];_0x3dc977[_0x7e16('0xa1')]=_0x21dfdb[_0x7e16('0xd3')];_0x3dc977[_0x7e16('0x4b')]=_0x7e16('0x4c');_0x3dc977['transfer']=!![];_0x3dc977[_0x7e16('0x9d')]='ATTENDED';if(this[_0x7e16('0x12')][_0x21dfdb[_0x7e16('0xd3')]]){_0xd40b2a=this[_0x7e16('0x12')][_0x21dfdb['origtransfereruniqueid']];this['queueReports'][_0x21dfdb['origtransfereruniqueid']]=this[_0x7e16('0x12')][_0x21dfdb['transfertargetuniqueid']];this[_0x7e16('0x12')][_0x21dfdb[_0x7e16('0xd2')]]=_0xd40b2a;_0x44fc8f=_[_0x7e16('0x8a')](this['queueReports'][_0x21dfdb['transfertargetuniqueid']]);_0x44fc8f[_0x7e16('0xd1')]=!![];}logger[_0x7e16('0x7d')]('[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s',_0x21dfdb['uniqueid'],_0x3dc977['name'],_0x3dc977[_0x7e16('0x51')],_0x3dc977[_0x7e16('0x9f')],_0x3dc977[_0x7e16('0xa1')]);}else if(this[_0x7e16('0x12')][_0x21dfdb[_0x7e16('0xd3')]]){_0x3dc977=_[_0x7e16('0x8a')](this[_0x7e16('0x12')][_0x21dfdb[_0x7e16('0xd3')]]);_0x3dc977[_0x7e16('0x9f')]=_0x21dfdb[_0x7e16('0xd4')];_0x3dc977['transferuniqueid']=_0x21dfdb[_0x7e16('0xd3')];_0x3dc977[_0x7e16('0x4b')]=_0x7e16('0x4c');_0x3dc977['transfer']=!![];_0x3dc977[_0x7e16('0x9d')]='ATTENDED';_0x3dc977[_0x7e16('0xd1')]=!![];_0x3dc977[_0x7e16('0xd5')]=_0x21dfdb['transfereeuniqueid'];}else if(this[_0x7e16('0x12')][_0x21dfdb[_0x7e16('0xcf')]]){_0x3dc977=_['last'](this[_0x7e16('0x12')][_0x21dfdb[_0x7e16('0xcf')]]);_0x3dc977['transferexten']=_0x21dfdb[_0x7e16('0xd6')];_0x3dc977[_0x7e16('0xa1')]=_0x21dfdb[_0x7e16('0xcf')];_0x3dc977[_0x7e16('0x4b')]=_0x7e16('0x4c');_0x3dc977['transfer']=!![];_0x3dc977['transfertype']=_0x7e16('0xd0');_0x3dc977['switch']=!![];_0x3dc977[_0x7e16('0xd5')]=_0x21dfdb[_0x7e16('0xd2')];}}}catch(_0x295af2){logger[_0x7e16('0x39')](_0x7e16('0xcd'),_0x21dfdb[_0x7e16('0x78')],util[_0x7e16('0x3c')](_0x295af2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e16('0xd')]['syncBlindTransfer']=function(_0x5a858e){try{if(this['isNotNull'](_0x5a858e)){logger[_0x7e16('0x49')]('[%s][voiceQueueReport][blindtransfer]',_0x5a858e['uniqueid'],util[_0x7e16('0x3c')](_0x5a858e,{'showHidden':![],'depth':null}));if(this[_0x7e16('0x12')][_0x5a858e[_0x7e16('0xce')]]){var _0x334593=_[_0x7e16('0x8a')](this[_0x7e16('0x12')][_0x5a858e['transfereeuniqueid']]);_0x334593[_0x7e16('0x4b')]=_0x7e16('0xd7');_0x334593[_0x7e16('0x94')]=!![];_0x334593[_0x7e16('0x9d')]=_0x7e16('0xd8');_0x334593[_0x7e16('0x9f')]=_0x5a858e[_0x7e16('0xd9')];_0x334593['transferuniqueid']=_0x5a858e[_0x7e16('0xce')];logger[_0x7e16('0x7d')]('[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s',_0x5a858e[_0x7e16('0x78')],_0x334593[_0x7e16('0x46')],_0x334593[_0x7e16('0x51')],_0x334593[_0x7e16('0x9f')],_0x334593[_0x7e16('0xa1')]);this[_0x7e16('0x25')]({'event':'BlindTransfer','uniqueid':_0x5a858e[_0x7e16('0xce')],'context':_0x5a858e['context'],'channel':_0x5a858e[_0x7e16('0xda')]});}}}catch(_0x46a902){logger[_0x7e16('0x39')]('[%s][voiceQueueReport][blindtransfer]',_0x5a858e[_0x7e16('0x78')],util['inspect'](_0x46a902,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e16('0xd')]['syncMusicOnHoldStart']=function(_0x40d027){try{if(this[_0x7e16('0x63')](_0x40d027)){logger[_0x7e16('0x49')](_0x7e16('0xdb'),_0x40d027[_0x7e16('0x78')],util[_0x7e16('0x3c')](_0x40d027,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x40d027[_0x7e16('0x78')]]){var _0x1d6769=_[_0x7e16('0x8a')](this[_0x7e16('0x12')][_0x40d027[_0x7e16('0x78')]]);if(!_['isNil'](_0x1d6769[_0x7e16('0xae')])){_0x1d6769['mohstarttime']=moment()[_0x7e16('0x45')]('YYYY-MM-DD\x20HH:mm:ss');logger['info'](_0x7e16('0xdc'),_0x40d027[_0x7e16('0x78')],_0x1d6769[_0x7e16('0xdd')]);}}}}catch(_0x2c3490){logger[_0x7e16('0x39')](_0x7e16('0xdb'),_0x40d027[_0x7e16('0x78')],util[_0x7e16('0x3c')](_0x2c3490,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e16('0xd')][_0x7e16('0xde')]=function(_0x41e0f7){try{if(this['isNotNull'](_0x41e0f7)){logger[_0x7e16('0x49')](_0x7e16('0xdf'),_0x41e0f7['uniqueid'],util[_0x7e16('0x3c')](_0x41e0f7,{'showHidden':![],'depth':null}));if(this[_0x7e16('0x12')][_0x41e0f7['uniqueid']]){var _0x53027f=_[_0x7e16('0x8a')](this[_0x7e16('0x12')][_0x41e0f7[_0x7e16('0x78')]]);if(!_[_0x7e16('0x34')](_0x53027f[_0x7e16('0xdd')])){_0x53027f[_0x7e16('0xe0')]+=moment()[_0x7e16('0xe1')](0x0)['diff'](_0x53027f['mohstarttime'],_0x7e16('0x9b'));logger[_0x7e16('0x7d')](_0x7e16('0xe2'),_0x41e0f7['uniqueid'],_0x53027f['mohtime']);delete _0x53027f['mohstarttime'];}}}}catch(_0x4f982f){logger[_0x7e16('0x39')]('[%s][voiceQueueReport][musiconholdstop]',_0x41e0f7[_0x7e16('0x78')],util['inspect'](_0x4f982f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e16('0xd')]['syncNewExten']=function(_0x24604e){try{if(this['isNotNull'](_0x24604e)){logger[_0x7e16('0x49')](_0x7e16('0xe3'),_0x24604e[_0x7e16('0x78')],util[_0x7e16('0x3c')](_0x24604e,{'showHidden':![],'depth':null}));if(_0x24604e[_0x7e16('0xe4')]['toLowerCase']()===_0x7e16('0xe5')){_0x24604e[_0x7e16('0xe6')]=_0x24604e[_0x7e16('0xe7')]&&_0x24604e['appdata'][_0x7e16('0xe8')](_0x7e16('0xe9'))?_0x24604e[_0x7e16('0xe7')]:(_0x24604e[_0x7e16('0xe7')]||_0x24604e[_0x7e16('0xe6')])[_0x7e16('0x98')]();if(_[_0x7e16('0xe8')](_0x24604e[_0x7e16('0xe6')][_0x7e16('0x98')](),_0x7e16('0xea'))){logger[_0x7e16('0x7d')](_0x7e16('0xeb'),_0x24604e[_0x7e16('0x78')],_0x24604e[_0x7e16('0xe4')],_0x24604e[_0x7e16('0xe6')]);if(_[_0x7e16('0x64')](this[_0x7e16('0x14')][_0x24604e[_0x7e16('0x78')]]))this[_0x7e16('0x14')][_0x24604e[_0x7e16('0x78')]]={};var _0x2d1b7a=_0x24604e['applicationdata'][_0x7e16('0xec')]('=');var _0x43e0e7=_0x2d1b7a[0x0][_0x7e16('0x98')]()[_0x7e16('0xed')](/cdr\((.*)\)/);if(_0x43e0e7)this[_0x7e16('0x14')][_0x24604e['uniqueid']][_0x43e0e7[0x1]]=_0x2d1b7a[0x1];}}}}catch(_0x495fb9){logger['error'](_0x7e16('0xee'),_0x24604e[_0x7e16('0x78')],util['inspect'](_0x495fb9,{'showHidden':![],'depth':null}));}};module[_0x7e16('0xef')]=VoiceQueueReport;
\ No newline at end of file
index 4c16344..7ad8075 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x234b=['queue','Request','CreateReportAgentPreview','../client','createHistory','campaign'];(function(_0x412187,_0x1c4a0b){var _0xa40290=function(_0x7593f6){while(--_0x7593f6){_0x412187['push'](_0x412187['shift']());}};_0xa40290(++_0x1c4a0b);}(_0x234b,0xe1));var _0xb234=function(_0x125e4d,_0x13d34a){_0x125e4d=_0x125e4d-0x0;var _0x1c610d=_0x234b[_0x125e4d];return _0x1c610d;};'use strict';var client=require(_0xb234('0x0'));exports[_0xb234('0x1')]=function(_0x5cefe4){return function(){_0x5cefe4[_0xb234('0x2')]=_0x5cefe4[_0xb234('0x3')];return client[_0xb234('0x4')](_0xb234('0x5'),{'body':_0x5cefe4,'log':_0xb234('0x5')});};};
\ No newline at end of file
+var _0x43e2=['campaign','Request','CreateReportAgentPreview','createHistory'];(function(_0x1d4943,_0x513567){var _0x55478=function(_0x51ec75){while(--_0x51ec75){_0x1d4943['push'](_0x1d4943['shift']());}};_0x55478(++_0x513567);}(_0x43e2,0x1db));var _0x243e=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x43e2[_0xcd0918];return _0x250704;};'use strict';var client=require('../client');exports[_0x243e('0x0')]=function(_0x5aaf0e){return function(){_0x5aaf0e[_0x243e('0x1')]=_0x5aaf0e['queue'];return client[_0x243e('0x2')](_0x243e('0x3'),{'body':_0x5aaf0e,'log':_0x243e('0x3')});};};
\ No newline at end of file
index bbe88df..68e3bc4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfbb2=['Request','CreateAttachment','../client','create'];(function(_0x1773d8,_0x551063){var _0x33914b=function(_0x34d431){while(--_0x34d431){_0x1773d8['push'](_0x1773d8['shift']());}};_0x33914b(++_0x551063);}(_0xfbb2,0xae));var _0x2fbb=function(_0x455e82,_0x522f6f){_0x455e82=_0x455e82-0x0;var _0x2d0520=_0xfbb2[_0x455e82];return _0x2d0520;};'use strict';var client=require(_0x2fbb('0x0'));exports[_0x2fbb('0x1')]=function(_0x2dd363){return client[_0x2fbb('0x2')]('CreateAttachment',{'body':_0x2dd363,'log':_0x2fbb('0x3')});};
\ No newline at end of file
+var _0x3d55=['CreateAttachment','../client','create','Request'];(function(_0xc95967,_0x53d059){var _0x13a4fd=function(_0x46308e){while(--_0x46308e){_0xc95967['push'](_0xc95967['shift']());}};_0x13a4fd(++_0x53d059);}(_0x3d55,0x141));var _0x53d5=function(_0xd6165e,_0x2195e1){_0xd6165e=_0xd6165e-0x0;var _0x207e4f=_0x3d55[_0xd6165e];return _0x207e4f;};'use strict';var client=require(_0x53d5('0x0'));exports[_0x53d5('0x1')]=function(_0x245136){return client[_0x53d5('0x2')](_0x53d5('0x3'),{'body':_0x245136,'log':_0x53d5('0x3')});};
\ No newline at end of file
index 778534d..d17db0f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x326f=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialPrefix','Trunk','callerid','TrunkBackup','Interval','Intervals','SquareProject','../client','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName'];(function(_0x19ed30,_0x2ac8d4){var _0x12e894=function(_0x78a614){while(--_0x78a614){_0x19ed30['push'](_0x19ed30['shift']());}};_0x12e894(++_0x2ac8d4);}(_0x326f,0xd1));var _0xf326=function(_0xb2f66b,_0x1e4b1d){_0xb2f66b=_0xb2f66b-0x0;var _0x256cf5=_0x326f[_0xb2f66b];return _0x256cf5;};'use strict';var client=require(_0xf326('0x0'));exports['getCampaigns']=function(){return function(){return client['Request'](_0xf326('0x1'),{'options':{'raw':![],'attributes':['id',_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa'),'dialBusyMaxRetry',_0xf326('0xb'),_0xf326('0xc'),_0xf326('0xd'),_0xf326('0xe'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xf326('0xf'),_0xf326('0x10'),_0xf326('0x11'),_0xf326('0x12'),_0xf326('0x13'),'dialAgentRejectMaxRetry',_0xf326('0x14'),'dialTimezone',_0xf326('0x15'),'dialAMDActive',_0xf326('0x16'),'dialAMDGreeting',_0xf326('0x17'),_0xf326('0x18'),'dialAMDMinWordLength',_0xf326('0x19'),_0xf326('0x1a'),_0xf326('0x1b'),_0xf326('0x1c'),'dialOrderByScheduledAt',_0xf326('0x1d'),'dialRandomLastDigitCallerIdNumber','dialCutDigit'],'include':[{'model':_0xf326('0x1e'),'as':_0xf326('0x1e'),'attributes':['id',_0xf326('0x2'),_0xf326('0x1f'),_0xf326('0x4')]},{'model':_0xf326('0x1e'),'as':_0xf326('0x20'),'attributes':['id',_0xf326('0x2'),'callerid',_0xf326('0x4')]},{'model':_0xf326('0x21'),'as':_0xf326('0x21'),'attributes':['id',_0xf326('0x2')],'include':[{'model':_0xf326('0x21'),'as':_0xf326('0x22'),'attributes':['id','name','interval']}]},{'model':'SquareProject','as':_0xf326('0x23'),'attributes':['id',_0xf326('0x2')]}]},'log':'getCampaign'});};};
\ No newline at end of file
+var _0x1261=['Interval','interval','SquareProject','getCampaign','getCampaigns','Request','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','TrunkBackup','callerid'];(function(_0x50df42,_0x48915e){var _0x1f6305=function(_0x98c33b){while(--_0x98c33b){_0x50df42['push'](_0x50df42['shift']());}};_0x1f6305(++_0x48915e);}(_0x1261,0x144));var _0x1126=function(_0x170f4c,_0x4a4c80){_0x170f4c=_0x170f4c-0x0;var _0x52eedd=_0x1261[_0x170f4c];return _0x52eedd;};'use strict';var client=require('../client');exports[_0x1126('0x0')]=function(){return function(){return client[_0x1126('0x1')](_0x1126('0x2'),{'options':{'raw':![],'attributes':['id',_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x1126('0xa'),_0x1126('0xb'),'dialNoAnswerMaxRetry',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'dialDropRetryFrequency',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'dialMachineRetryFrequency',_0x1126('0x14'),'dialAgentRejectRetryFrequency','dialTimezone',_0x1126('0x15'),'dialAMDActive',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'dialOrderByScheduledAt','dialPrefix',_0x1126('0x1f'),_0x1126('0x20')],'include':[{'model':_0x1126('0x21'),'as':'Trunk','attributes':['id',_0x1126('0x3'),'callerid',_0x1126('0x5')]},{'model':_0x1126('0x21'),'as':_0x1126('0x22'),'attributes':['id','name',_0x1126('0x23'),_0x1126('0x5')]},{'model':'Interval','as':'Interval','attributes':['id',_0x1126('0x3')],'include':[{'model':_0x1126('0x24'),'as':'Intervals','attributes':['id','name',_0x1126('0x25')]}]},{'model':'SquareProject','as':_0x1126('0x26'),'attributes':['id',_0x1126('0x3')]}]},'log':_0x1126('0x27')});};};
\ No newline at end of file
index 8a70ddb..5a85548 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe83f=['getContacts','GetCmContact','createContact','Request','CreateCmContact'];(function(_0x200ded,_0x5cfa0e){var _0x4ed4a0=function(_0x17f1dd){while(--_0x17f1dd){_0x200ded['push'](_0x200ded['shift']());}};_0x4ed4a0(++_0x5cfa0e);}(_0xe83f,0xb6));var _0xfe83=function(_0x4503b5,_0x966a4c){_0x4503b5=_0x4503b5-0x0;var _0x237549=_0xe83f[_0x4503b5];return _0x237549;};'use strict';var client=require('../client');exports[_0xfe83('0x0')]=function(_0x56a89b){return function(){return client[_0xfe83('0x1')](_0xfe83('0x2'),{'body':_0x56a89b,'log':_0xfe83('0x2')});};};exports[_0xfe83('0x3')]=function(_0x2af0e1){return function(){return client['Request'](_0xfe83('0x4'),{'options':_0x2af0e1,'log':'GetCmContact'});};};
\ No newline at end of file
+var _0x3c7f=['Request','CreateCmContact','getContacts','GetCmContact','../client','createContact'];(function(_0x197dd6,_0x31297f){var _0xbd82a4=function(_0x52c895){while(--_0x52c895){_0x197dd6['push'](_0x197dd6['shift']());}};_0xbd82a4(++_0x31297f);}(_0x3c7f,0x1c0));var _0xf3c7=function(_0x5888d4,_0x12ca9f){_0x5888d4=_0x5888d4-0x0;var _0x177bd5=_0x3c7f[_0x5888d4];return _0x177bd5;};'use strict';var client=require(_0xf3c7('0x0'));exports[_0xf3c7('0x1')]=function(_0x2d87e0){return function(){return client[_0xf3c7('0x2')](_0xf3c7('0x3'),{'body':_0x2d87e0,'log':_0xf3c7('0x3')});};};exports[_0xf3c7('0x4')]=function(_0x128cab){return function(){return client[_0xf3c7('0x2')](_0xf3c7('0x5'),{'options':_0x128cab,'log':_0xf3c7('0x5')});};};
\ No newline at end of file
index 184ccb0..51d0200 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d6f=['UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','priority','DESC','GetContactDialer','getContactDialerIvr','scheduledat','GetContactDialerIvr','moveContactManagedDialer','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','Agent','name','Queue','unlockContact','GetContactRecallMe','User','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','CmContact','Contact','getCmHopper','updateContacts'];(function(_0x3fd27c,_0x291768){var _0x35f210=function(_0x29aa78){while(--_0x29aa78){_0x3fd27c['push'](_0x3fd27c['shift']());}};_0x35f210(++_0x291768);}(_0x6d6f,0x14f));var _0xf6d6=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0x6d6f[_0x37c07d];return _0x10dadc;};'use strict';var client=require(_0xf6d6('0x0'));var moment=require(_0xf6d6('0x1'));exports[_0xf6d6('0x2')]=function(_0x13dece,_0x5f3c76){return function(){return client[_0xf6d6('0x3')](_0xf6d6('0x4'),{'options':{'where':{'VoiceQueueId':_0x13dece},'include':[{'model':_0xf6d6('0x5'),'as':_0xf6d6('0x6')}],'limit':_0x5f3c76,'raw':![]},'log':_0xf6d6('0x7')});};};exports[_0xf6d6('0x8')]=function(_0x579b55,_0x73263a,_0x2cb749){return function(){return client[_0xf6d6('0x3')](_0xf6d6('0x9'),{'body':_0x579b55,'options':{'where':{'VoiceQueueId':_0x73263a,'scheduledat':{'$lte':moment()[_0xf6d6('0xa')](_0xf6d6('0xb'))}},'limit':_0x2cb749},'log':_0xf6d6('0x9')});};};exports[_0xf6d6('0xc')]=function(_0x1def04){return function(){return client[_0xf6d6('0x3')](_0xf6d6('0x9'),{'body':_0x1def04,'options':{'where':{'ContactId':_0x1def04[_0xf6d6('0xd')],'ListId':_0x1def04[_0xf6d6('0xe')],'VoiceQueueId':_0x1def04[_0xf6d6('0xf')],'CampaignId':_0x1def04[_0xf6d6('0x10')]}},'log':_0xf6d6('0xc')});};};exports[_0xf6d6('0x11')]=function(_0x455db0,_0x5a29cd,_0x29cdb1){return function(){return client[_0xf6d6('0x3')](_0xf6d6('0x12'),{'options':{'where':{'VoiceQueueId':_0x455db0,'ListId':_0x5a29cd,'ContactId':_0x29cdb1}},'log':_0xf6d6('0x12')});};};exports[_0xf6d6('0x13')]=function(_0x1f1a92,_0x433c42,_0x5562e6,_0x69100f){return function(){return client[_0xf6d6('0x3')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1f1a92,'active':![],'scheduledat':{'$lte':moment()['format'](_0xf6d6('0xb'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x433c42}}]},'order':[[_0xf6d6('0x14'),_0xf6d6('0x15')],['scheduledat',_0x69100f],['id','ASC']],'raw':!![],'limit':_0x5562e6},'log':_0xf6d6('0x16')});};};exports[_0xf6d6('0x17')]=function(_0x5653be,_0x503378,_0x386bad){return function(){return client[_0xf6d6('0x3')](_0xf6d6('0x16'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5653be,'active':![],'scheduledat':{'$lte':moment()[_0xf6d6('0xa')](_0xf6d6('0xb'))}},'include':[{'model':'CmContact','as':_0xf6d6('0x6')}],'order':[[_0xf6d6('0x14'),_0xf6d6('0x15')],[_0xf6d6('0x18'),_0x386bad],['id','ASC']],'raw':!![],'limit':_0x503378},'log':_0xf6d6('0x19')});};};exports[_0xf6d6('0x1a')]=function(_0x22dac4,_0x24001c){return function(){_0x22dac4['campaign']=_0x22dac4['queue'];return client[_0xf6d6('0x3')]('MoveContactManagedDialer',{'body':_0x22dac4,'options':{'where':{'ContactId':_0x22dac4[_0xf6d6('0xd')],'ListId':_0x22dac4[_0xf6d6('0xe')],'VoiceQueueId':_0x22dac4[_0xf6d6('0xf')],'CampaignId':_0x22dac4[_0xf6d6('0x10')],'active':_0x24001c?undefined:!![]}},'log':'MoveContactManagedDialer'});};};exports[_0xf6d6('0x1b')]=function(_0x45c761){return function(){return client[_0xf6d6('0x3')](_0xf6d6('0x1c'),{'options':{'where':{'VoiceQueueId':_0x45c761['id']?_0x45c761['id']||null:null}},'log':_0xf6d6('0x1b')});};};exports[_0xf6d6('0x1d')]=function(_0x3970ed){return function(){return client[_0xf6d6('0x3')](_0xf6d6('0x1e'),{'options':{'where':{'id':_0x3970ed},'include':[{'model':'CmContact','as':'Contact'},{'model':'User','as':_0xf6d6('0x1f'),'attributes':['id',_0xf6d6('0x20')]},{'model':'VoiceQueue','as':_0xf6d6('0x21'),'attributes':['id',_0xf6d6('0x20')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0xf6d6('0x22')]=function(_0x5ff91,_0x213ab6,_0xd204e8){return function(){return client[_0xf6d6('0x3')]('UpdateCmHopper',{'body':_0x5ff91,'options':{'where':{'id':_0x213ab6},'limit':_0xd204e8},'log':_0xf6d6('0x9')});};};exports['getContactRecallMe']=function(_0x355829,_0x44bb94){return function(){return client[_0xf6d6('0x3')](_0xf6d6('0x23'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x355829,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xf6d6('0xa')](_0xf6d6('0xb'))},'UserId':{'$in':_0x44bb94}},'order':[[_0xf6d6('0x14'),'DESC'],[_0xf6d6('0x18'),_0xf6d6('0x15')],['id','ASC']],'include':[{'model':_0xf6d6('0x5'),'as':_0xf6d6('0x6')},{'model':_0xf6d6('0x24'),'as':_0xf6d6('0x1f'),'attributes':['id',_0xf6d6('0x20'),_0xf6d6('0x25')]}],'group':_0xf6d6('0x26'),'raw':!![]},'log':'GetContactDialer'});};};exports[_0xf6d6('0x27')]=function(_0x12f355){return function(){return client[_0xf6d6('0x3')](_0xf6d6('0x28'),{'body':_0x12f355,'options':{},'log':_0xf6d6('0x28')});};};exports[_0xf6d6('0x29')]=function(_0x863f1f,_0xe40fc7,_0x165cef){return function(){return client['Request'](_0xf6d6('0x2a'),{'body':{'where':{'voiceQueueIds':_0x863f1f,'interval':_0xe40fc7,'availableAgentsIds':_0x165cef}},'log':_0xf6d6('0x29')});};};
\ No newline at end of file
+var _0x60a7=['format','ListId','VoiceQueueId','CampaignId','rescheduleContact','DestroyCmHopper','YYYY-MM-DD\x20HH:mm:ss','priority','scheduledat','ASC','GetContactDialer','CmContact','DESC','GetContactDialerIvr','moveContactManagedDialer','campaign','MoveContactManagedDialer','ContactId','countReScheduled','CountReScheduled','getContactPreview','User','Agent','name','VoiceQueue','Queue','getContactRecallMe','GetContactRecallMe','voicePause','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','Contact','UpdateCmHopper'];(function(_0x50cb4f,_0x1d94ed){var _0x263a0f=function(_0x527625){while(--_0x527625){_0x50cb4f['push'](_0x50cb4f['shift']());}};_0x263a0f(++_0x1d94ed);}(_0x60a7,0x10a));var _0x760a=function(_0x5b7aad,_0x20f6ca){_0x5b7aad=_0x5b7aad-0x0;var _0x3831ac=_0x60a7[_0x5b7aad];return _0x3831ac;};'use strict';var client=require(_0x760a('0x0'));var moment=require(_0x760a('0x1'));exports[_0x760a('0x2')]=function(_0x425bfd,_0xb07e98){return function(){return client[_0x760a('0x3')](_0x760a('0x4'),{'options':{'where':{'VoiceQueueId':_0x425bfd},'include':[{'model':'CmContact','as':_0x760a('0x5')}],'limit':_0xb07e98,'raw':![]},'log':'getCmHopper'});};};exports['updateContacts']=function(_0x5fa4ef,_0x47c7df,_0x371d34){return function(){return client[_0x760a('0x3')](_0x760a('0x6'),{'body':_0x5fa4ef,'options':{'where':{'VoiceQueueId':_0x47c7df,'scheduledat':{'$lte':moment()[_0x760a('0x7')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x371d34},'log':_0x760a('0x6')});};};exports['rescheduleContact']=function(_0x2cfbc9){return function(){return client['Request']('UpdateCmHopper',{'body':_0x2cfbc9,'options':{'where':{'ContactId':_0x2cfbc9['ContactId'],'ListId':_0x2cfbc9[_0x760a('0x8')],'VoiceQueueId':_0x2cfbc9[_0x760a('0x9')],'CampaignId':_0x2cfbc9[_0x760a('0xa')]}},'log':_0x760a('0xb')});};};exports['destroyContact']=function(_0x525cd9,_0x5a7f85,_0x2d176f){return function(){return client[_0x760a('0x3')](_0x760a('0xc'),{'options':{'where':{'VoiceQueueId':_0x525cd9,'ListId':_0x5a7f85,'ContactId':_0x2d176f}},'log':'DestroyCmHopper'});};};exports['getContactDialer']=function(_0x57385b,_0x46b79a,_0xbf2957,_0x5e1cda){return function(){return client[_0x760a('0x3')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x57385b,'active':![],'scheduledat':{'$lte':moment()[_0x760a('0x7')](_0x760a('0xd'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x46b79a}}]},'order':[[_0x760a('0xe'),'DESC'],[_0x760a('0xf'),_0x5e1cda],['id',_0x760a('0x10')]],'raw':!![],'limit':_0xbf2957},'log':'GetContactDialer'});};};exports['getContactDialerIvr']=function(_0x1cdd04,_0x1f57bc,_0x108a28){return function(){return client[_0x760a('0x3')](_0x760a('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x1cdd04,'active':![],'scheduledat':{'$lte':moment()[_0x760a('0x7')](_0x760a('0xd'))}},'include':[{'model':_0x760a('0x12'),'as':_0x760a('0x5')}],'order':[[_0x760a('0xe'),_0x760a('0x13')],[_0x760a('0xf'),_0x108a28],['id',_0x760a('0x10')]],'raw':!![],'limit':_0x1f57bc},'log':_0x760a('0x14')});};};exports[_0x760a('0x15')]=function(_0x25fc6c,_0x51ac48){return function(){_0x25fc6c[_0x760a('0x16')]=_0x25fc6c['queue'];return client['Request'](_0x760a('0x17'),{'body':_0x25fc6c,'options':{'where':{'ContactId':_0x25fc6c[_0x760a('0x18')],'ListId':_0x25fc6c[_0x760a('0x8')],'VoiceQueueId':_0x25fc6c[_0x760a('0x9')],'CampaignId':_0x25fc6c['CampaignId'],'active':_0x51ac48?undefined:!![]}},'log':'MoveContactManagedDialer'});};};exports[_0x760a('0x19')]=function(_0x5d0046){return function(){return client[_0x760a('0x3')](_0x760a('0x1a'),{'options':{'where':{'VoiceQueueId':_0x5d0046['id']?_0x5d0046['id']||null:null}},'log':'countReScheduled'});};};exports[_0x760a('0x1b')]=function(_0xc3ef4){return function(){return client[_0x760a('0x3')]('GetCmHopperPreview',{'options':{'where':{'id':_0xc3ef4},'include':[{'model':'CmContact','as':'Contact'},{'model':_0x760a('0x1c'),'as':_0x760a('0x1d'),'attributes':['id',_0x760a('0x1e')]},{'model':_0x760a('0x1f'),'as':_0x760a('0x20'),'attributes':['id',_0x760a('0x1e')]}],'raw':!![]},'log':'getCmHopper'});};};exports['unlockContact']=function(_0x3b51e0,_0x44f22c,_0x267ca1){return function(){return client[_0x760a('0x3')](_0x760a('0x6'),{'body':_0x3b51e0,'options':{'where':{'id':_0x44f22c},'limit':_0x267ca1},'log':'UpdateCmHopper'});};};exports[_0x760a('0x21')]=function(_0x1d349c,_0x5bb69d){return function(){return client[_0x760a('0x3')](_0x760a('0x22'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1d349c,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x760a('0x7')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x5bb69d}},'order':[[_0x760a('0xe'),_0x760a('0x13')],[_0x760a('0xf'),_0x760a('0x13')],['id','ASC']],'include':[{'model':_0x760a('0x12'),'as':_0x760a('0x5')},{'model':_0x760a('0x1c'),'as':_0x760a('0x1d'),'attributes':['id','name',_0x760a('0x23')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0x760a('0x11')});};};exports[_0x760a('0x24')]=function(_0x3ee8ac){return function(){return client[_0x760a('0x3')](_0x760a('0x25'),{'body':_0x3ee8ac,'options':{},'log':_0x760a('0x25')});};};exports['handlePreviewRecallNotifications']=function(_0x950cdf,_0x2dc537,_0x179957){return function(){return client[_0x760a('0x3')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x950cdf,'interval':_0x2dc537,'availableAgentsIds':_0x179957}},'log':_0x760a('0x26')});};};
\ No newline at end of file
index 7553066..c33c9b8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8f6c=['IncrementPreviewCounters','../client','verifyAdditionalPhones','VerifyAdditionalPhones','swapAdditionalPhones','Request','SwapAdditionalPhones','incrementPreviewCounters'];(function(_0x9dc8be,_0x1bab69){var _0x115701=function(_0x5d563c){while(--_0x5d563c){_0x9dc8be['push'](_0x9dc8be['shift']());}};_0x115701(++_0x1bab69);}(_0x8f6c,0x111));var _0xc8f6=function(_0x3da431,_0x573276){_0x3da431=_0x3da431-0x0;var _0x21ac96=_0x8f6c[_0x3da431];return _0x21ac96;};'use strict';var client=require(_0xc8f6('0x0'));var moment=require('moment');exports[_0xc8f6('0x1')]=function(_0x2e9880,_0x517179,_0x5a859b){return function(){return client['Request'](_0xc8f6('0x2'),{'body':_0x2e9880,'reason':_0x517179,'entity':_0x5a859b,'log':_0xc8f6('0x2')});};};exports[_0xc8f6('0x3')]=function(_0x22ccd1,_0x360182,_0x297ccb){return function(){return client[_0xc8f6('0x4')](_0xc8f6('0x5'),{'body':_0x22ccd1,'duration':_0x360182,'waitTime':_0x297ccb,'log':_0xc8f6('0x5')});};};exports[_0xc8f6('0x6')]=function(_0x19f19d){return function(){return client[_0xc8f6('0x4')](_0xc8f6('0x7'),{'body':_0x19f19d,'log':_0xc8f6('0x7')});};};
\ No newline at end of file
+var _0x2313=['swapAdditionalPhones','SwapAdditionalPhones','IncrementPreviewCounters','../client','moment','verifyAdditionalPhones','Request','VerifyAdditionalPhones'];(function(_0x38ba99,_0x3292f1){var _0x49a7cf=function(_0x5c61aa){while(--_0x5c61aa){_0x38ba99['push'](_0x38ba99['shift']());}};_0x49a7cf(++_0x3292f1);}(_0x2313,0x73));var _0x3231=function(_0x745b80,_0x39639d){_0x745b80=_0x745b80-0x0;var _0xfda862=_0x2313[_0x745b80];return _0xfda862;};'use strict';var client=require(_0x3231('0x0'));var moment=require(_0x3231('0x1'));exports[_0x3231('0x2')]=function(_0x8a286f,_0x11b6ff,_0x546c14){return function(){return client[_0x3231('0x3')](_0x3231('0x4'),{'body':_0x8a286f,'reason':_0x11b6ff,'entity':_0x546c14,'log':_0x3231('0x4')});};};exports[_0x3231('0x5')]=function(_0x3d0783,_0x3e68da,_0x4565b2){return function(){return client[_0x3231('0x3')](_0x3231('0x6'),{'body':_0x3d0783,'duration':_0x3e68da,'waitTime':_0x4565b2,'log':_0x3231('0x6')});};};exports['incrementPreviewCounters']=function(_0x50dd9a){return function(){return client['Request'](_0x3231('0x7'),{'body':_0x50dd9a,'log':_0x3231('0x7')});};};
\ No newline at end of file
index 7314b10..e03da8e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfbb4=['GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList','Request'];(function(_0x5a9210,_0x397b90){var _0x2b29ce=function(_0x4ef39a){while(--_0x4ef39a){_0x5a9210['push'](_0x5a9210['shift']());}};_0x2b29ce(++_0x397b90);}(_0xfbb4,0x114));var _0x4fbb=function(_0x545422,_0x5a30c4){_0x545422=_0x545422-0x0;var _0x118183=_0xfbb4[_0x545422];return _0x118183;};'use strict';var client=require(_0x4fbb('0x0'));exports[_0x4fbb('0x1')]=function(_0x595cc4){return function(){return client[_0x4fbb('0x2')](_0x4fbb('0x3'),{'options':{'where':{'VoiceQueueId':_0x595cc4[_0x4fbb('0x4')],'phone':_0x595cc4[_0x4fbb('0x5')]},'raw':![]},'log':'GetCmHopperBlack'});};};exports[_0x4fbb('0x6')]=function(_0x35db71){return function(){return client[_0x4fbb('0x2')](_0x4fbb('0x3'),{'options':{'where':{'CampaignId':_0x35db71[_0x4fbb('0x7')],'phone':_0x35db71[_0x4fbb('0x5')]},'raw':![]},'log':_0x4fbb('0x8')});};};
\ No newline at end of file
+var _0x1ab4=['GetCmHopperBlackIvr','../client','checkIsBlackList','GetCmHopperBlack','phone','Request'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0x1ab4,0x1db));var _0x41ab=function(_0xbfcf73,_0x339fb4){_0xbfcf73=_0xbfcf73-0x0;var _0x39b02c=_0x1ab4[_0xbfcf73];return _0x39b02c;};'use strict';var client=require(_0x41ab('0x0'));exports[_0x41ab('0x1')]=function(_0x525340){return function(){return client['Request'](_0x41ab('0x2'),{'options':{'where':{'VoiceQueueId':_0x525340['VoiceQueueId'],'phone':_0x525340[_0x41ab('0x3')]},'raw':![]},'log':_0x41ab('0x2')});};};exports['checkIsBlackListIvr']=function(_0x1ed91e){return function(){return client[_0x41ab('0x4')]('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x1ed91e['CampaignId'],'phone':_0x1ed91e[_0x41ab('0x3')]},'raw':![]},'log':_0x41ab('0x5')});};};
\ No newline at end of file
index 9b44a7e..31387cc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa99a=['../client','createContact','campaign','queue','CreateCmHopperFinal'];(function(_0x1d4056,_0x42f892){var _0x569dbb=function(_0x23b1d0){while(--_0x23b1d0){_0x1d4056['push'](_0x1d4056['shift']());}};_0x569dbb(++_0x42f892);}(_0xa99a,0x181));var _0xaa99=function(_0x26868b,_0xec76e0){_0x26868b=_0x26868b-0x0;var _0x255749=_0xa99a[_0x26868b];return _0x255749;};'use strict';var client=require(_0xaa99('0x0'));exports[_0xaa99('0x1')]=function(_0x1153a4){return function(){_0x1153a4[_0xaa99('0x2')]=_0x1153a4[_0xaa99('0x3')];return client['Request'](_0xaa99('0x4'),{'body':_0x1153a4,'log':'CreateCmHopperFinal'});};};
\ No newline at end of file
+var _0x9038=['campaign','queue','Request','CreateCmHopperFinal','createContact'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x9038,0x194));var _0x8903=function(_0x5786b0,_0x10dd5f){_0x5786b0=_0x5786b0-0x0;var _0x2bb34e=_0x9038[_0x5786b0];return _0x2bb34e;};'use strict';var client=require('../client');exports[_0x8903('0x0')]=function(_0x4c111b){return function(){_0x4c111b[_0x8903('0x1')]=_0x4c111b[_0x8903('0x2')];return client[_0x8903('0x3')]('CreateCmHopperFinal',{'body':_0x4c111b,'log':_0x8903('0x4')});};};
\ No newline at end of file
index 4af7e08..1f62257 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x94c0=['../client','moment','queue','CreateCmHopperHistory','avgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','Request','startOf','day','endOf','GetVoiceQueueHopperHistory','getCampaignHopperHistory','GetCampaignHopperHistory','ivr'];(function(_0x1a8aec,_0x777be4){var _0x197e0b=function(_0x2f7680){while(--_0x2f7680){_0x1a8aec['push'](_0x1a8aec['shift']());}};_0x197e0b(++_0x777be4);}(_0x94c0,0x1c8));var _0x094c=function(_0x2445e2,_0xc4a747){_0x2445e2=_0x2445e2-0x0;var _0x1e5736=_0x94c0[_0x2445e2];return _0x1e5736;};'use strict';var client=require(_0x094c('0x0'));var moment=require(_0x094c('0x1'));exports['createHistory']=function(_0x192b57){return function(){_0x192b57['campaign']=_0x192b57[_0x094c('0x2')];return client['Request'](_0x094c('0x3'),{'body':_0x192b57,'log':_0x094c('0x3')});};};exports[_0x094c('0x4')]=function(_0x11046a){return function(){return client['Request']('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0x094c('0x5')](_0x11046a,_0x094c('0x6'))[_0x094c('0x7')](_0x094c('0x8')),moment()[_0x094c('0x7')](_0x094c('0x8'))]}},'raw':![]},'log':_0x094c('0x9')});};};exports[_0x094c('0xa')]=function(_0x1da181){return function(){return client[_0x094c('0xb')]('GetVoiceQueueHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x094c('0xc')](_0x094c('0xd'))[_0x094c('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x094c('0xe')](_0x094c('0xd'))[_0x094c('0x7')](_0x094c('0x8'))]},'campaigntype':_0x094c('0x2')},'raw':![]},'log':_0x094c('0xf')});};};exports[_0x094c('0x10')]=function(_0x13e844){return function(){return client[_0x094c('0xb')](_0x094c('0x11'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x094c('0xc')](_0x094c('0xd'))[_0x094c('0x7')](_0x094c('0x8')),moment()['endOf'](_0x094c('0xd'))[_0x094c('0x7')](_0x094c('0x8'))]},'campaigntype':_0x094c('0x12')},'raw':![]},'log':_0x094c('0x11')});};};
\ No newline at end of file
+var _0x2821=['YYYY-MM-DD\x20HH:mm:ss','format','GetVoiceQueueHopperHistory','startOf','day','endOf','GetCampaignHopperHistory','../client','campaign','queue','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime'];(function(_0x52aa65,_0x355243){var _0x195f1d=function(_0x3dcaac){while(--_0x3dcaac){_0x52aa65['push'](_0x52aa65['shift']());}};_0x195f1d(++_0x355243);}(_0x2821,0x13b));var _0x1282=function(_0x17b868,_0x5aa988){_0x17b868=_0x17b868-0x0;var _0x261c08=_0x2821[_0x17b868];return _0x261c08;};'use strict';var client=require(_0x1282('0x0'));var moment=require('moment');exports['createHistory']=function(_0x3f63ad){return function(){_0x3f63ad[_0x1282('0x1')]=_0x3f63ad[_0x1282('0x2')];return client[_0x1282('0x3')](_0x1282('0x4'),{'body':_0x3f63ad,'log':_0x1282('0x4')});};};exports[_0x1282('0x5')]=function(_0x28b5ce){return function(){return client[_0x1282('0x3')](_0x1282('0x6'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x28b5ce,'minutes')['format'](_0x1282('0x7')),moment()[_0x1282('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]}},'raw':![]},'log':'GetCmHopperHistory'});};};exports['getVoiceQueueHopperHistory']=function(_0x229ee6){return function(){return client[_0x1282('0x3')](_0x1282('0x9'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x1282('0xa')](_0x1282('0xb'))[_0x1282('0x8')](_0x1282('0x7')),moment()[_0x1282('0xc')]('day')['format'](_0x1282('0x7'))]},'campaigntype':_0x1282('0x2')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports['getCampaignHopperHistory']=function(_0x44474e){return function(){return client[_0x1282('0x3')](_0x1282('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x1282('0xa')](_0x1282('0xb'))[_0x1282('0x8')](_0x1282('0x7')),moment()['endOf'](_0x1282('0xb'))[_0x1282('0x8')](_0x1282('0x7'))]},'campaigntype':'ivr'},'raw':![]},'log':_0x1282('0xd')});};};
\ No newline at end of file
index 6ebcd9b..f7cdc81 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d4b=['gateway','faxdetect','t38timeout','tech','ListId','key','Trunk','callerid','active','getFaxAccount','notify','../client','getFaxAccounts','Request','name','description','localstationid','minrate','maxrate','modem'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d4b,0xbf));var _0xb6d4=function(_0x1ee7a6,_0x30ff9d){_0x1ee7a6=_0x1ee7a6-0x0;var _0x2e1aa6=_0x6d4b[_0x1ee7a6];return _0x2e1aa6;};'use strict';var client=require(_0xb6d4('0x0'));exports[_0xb6d4('0x1')]=function(){return function(){return client[_0xb6d4('0x2')]('GetFaxAccount',{'options':{'raw':![],'attributes':['id',_0xb6d4('0x3'),_0xb6d4('0x4'),'ecm','headerinfo',_0xb6d4('0x5'),_0xb6d4('0x6'),_0xb6d4('0x7'),_0xb6d4('0x8'),_0xb6d4('0x9'),_0xb6d4('0xa'),_0xb6d4('0xb'),_0xb6d4('0xc'),'TrunkId',_0xb6d4('0xd'),_0xb6d4('0xe')],'include':[{'model':_0xb6d4('0xf'),'as':_0xb6d4('0xf'),'attributes':['id',_0xb6d4('0x3'),_0xb6d4('0x10'),_0xb6d4('0x11')]}]},'log':_0xb6d4('0x12')});};};exports[_0xb6d4('0x13')]=function(_0x14d8ce,_0x56bdae){return client['Request']('NotifyFaxAccount',{'account':{'id':_0x14d8ce},'body':_0x56bdae,'log':'NotifyFaxAccount'});};
\ No newline at end of file
+var _0x91b6=['localstationid','minrate','maxrate','modem','t38timeout','tech','ListId','key','Trunk','name','callerid','active','getFaxAccount','Request','NotifyFaxAccount','../client','getFaxAccounts','GetFaxAccount','ecm','headerinfo'];(function(_0x1f06ea,_0x1b06ab){var _0x4858f4=function(_0x55e5d9){while(--_0x55e5d9){_0x1f06ea['push'](_0x1f06ea['shift']());}};_0x4858f4(++_0x1b06ab);}(_0x91b6,0x18b));var _0x691b=function(_0x119a9d,_0x25e31c){_0x119a9d=_0x119a9d-0x0;var _0x5e9792=_0x91b6[_0x119a9d];return _0x5e9792;};'use strict';var client=require(_0x691b('0x0'));exports[_0x691b('0x1')]=function(){return function(){return client['Request'](_0x691b('0x2'),{'options':{'raw':![],'attributes':['id','name','description',_0x691b('0x3'),_0x691b('0x4'),_0x691b('0x5'),_0x691b('0x6'),_0x691b('0x7'),_0x691b('0x8'),'gateway','faxdetect',_0x691b('0x9'),_0x691b('0xa'),'TrunkId',_0x691b('0xb'),_0x691b('0xc')],'include':[{'model':_0x691b('0xd'),'as':_0x691b('0xd'),'attributes':['id',_0x691b('0xe'),_0x691b('0xf'),_0x691b('0x10')]}]},'log':_0x691b('0x11')});};};exports['notify']=function(_0x3a4377,_0x14f286){return client[_0x691b('0x12')](_0x691b('0x13'),{'account':{'id':_0x3a4377},'body':_0x14f286,'log':_0x691b('0x13')});};
\ No newline at end of file
index ebc7bdd..805d65f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2238=['update','Request','UpdateFaxMessage'];(function(_0x4b4865,_0xb43449){var _0x190dc2=function(_0x2b41f7){while(--_0x2b41f7){_0x4b4865['push'](_0x4b4865['shift']());}};_0x190dc2(++_0xb43449);}(_0x2238,0x159));var _0x8223=function(_0x51cbb5,_0x4b2a81){_0x51cbb5=_0x51cbb5-0x0;var _0x433088=_0x2238[_0x51cbb5];return _0x433088;};'use strict';var client=require('../client');exports[_0x8223('0x0')]=function(_0x58851b,_0x1344b9){return client[_0x8223('0x1')](_0x8223('0x2'),{'body':_0x1344b9,'options':{'where':{'AttachmentId':_0x58851b}},'log':_0x8223('0x2')});};
\ No newline at end of file
+var _0x6363=['UpdateFaxMessage','update'];(function(_0x113e32,_0x5339f0){var _0x4ff939=function(_0x2be9ca){while(--_0x2be9ca){_0x113e32['push'](_0x113e32['shift']());}};_0x4ff939(++_0x5339f0);}(_0x6363,0x1c7));var _0x3636=function(_0x12c20a,_0x18abf0){_0x12c20a=_0x12c20a-0x0;var _0x55e99e=_0x6363[_0x12c20a];return _0x55e99e;};'use strict';var client=require('../client');exports[_0x3636('0x0')]=function(_0x14fe36,_0x295493){return client['Request']('UpdateFaxMessage',{'body':_0x295493,'options':{'where':{'AttachmentId':_0x14fe36}},'log':_0x3636('0x1')});};
\ No newline at end of file
index 42373b5..1745efc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x48f4=['keyContent','Variable','Fields','idField','nameField','customField','Tag','Tags','GetDeskAccount','../../client','getDeskAccounts','Request','name','password','remoteUri','type','serverUrl','DeskConfiguration','Configurations','DeskField','Subjects','content','variableName','Descriptions','key','keyType'];(function(_0x598bc1,_0x263fb6){var _0x4fadf3=function(_0x2b07a2){while(--_0x2b07a2){_0x598bc1['push'](_0x598bc1['shift']());}};_0x4fadf3(++_0x263fb6);}(_0x48f4,0xa5));var _0x448f=function(_0x5dd181,_0x1eac8b){_0x5dd181=_0x5dd181-0x0;var _0x27cc98=_0x48f4[_0x5dd181];return _0x27cc98;};'use strict';var client=require(_0x448f('0x0'));exports[_0x448f('0x1')]=function(){return function(_0x1ba7fc){return client[_0x448f('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0x448f('0x3'),'description','username',_0x448f('0x4'),_0x448f('0x5'),'authType',_0x448f('0x6'),_0x448f('0x7')],'include':[{'model':_0x448f('0x8'),'as':_0x448f('0x9'),'attributes':['id',_0x448f('0x3')],'include':[{'model':_0x448f('0xa'),'as':_0x448f('0xb'),'attributes':['id',_0x448f('0x6'),_0x448f('0xc'),_0x448f('0xd')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x448f('0x3')]}]},{'model':_0x448f('0xa'),'as':_0x448f('0xe'),'attributes':['id',_0x448f('0x6'),'content',_0x448f('0xf'),_0x448f('0x10'),_0x448f('0x11'),'variableName'],'include':[{'model':_0x448f('0x12'),'as':_0x448f('0x12'),'attributes':['id','name']}]},{'model':_0x448f('0xa'),'as':_0x448f('0x13'),'attributes':['id','type',_0x448f('0xc'),_0x448f('0x14'),_0x448f('0x15'),_0x448f('0x16'),_0x448f('0xd')],'include':[{'model':_0x448f('0x12'),'as':_0x448f('0x12'),'attributes':['id',_0x448f('0x3')]}]},{'model':_0x448f('0x17'),'as':_0x448f('0x18'),'attributes':['id','name']}]}]},'log':_0x448f('0x19')});};};
\ No newline at end of file
+var _0x1154=['key','keyType','keyContent','DeskField','Fields','idField','variableName','Tag','Tags','getDeskAccounts','Request','name','description','username','password','remoteUri','authType','type','serverUrl','DeskConfiguration','Configurations','Variable','Descriptions','content'];(function(_0x344116,_0x1f061a){var _0x118832=function(_0x3f3599){while(--_0x3f3599){_0x344116['push'](_0x344116['shift']());}};_0x118832(++_0x1f061a);}(_0x1154,0x159));var _0x4115=function(_0x405dea,_0x26afea){_0x405dea=_0x405dea-0x0;var _0x168986=_0x1154[_0x405dea];return _0x168986;};'use strict';var client=require('../../client');exports[_0x4115('0x0')]=function(){return function(_0x395c3f){return client[_0x4115('0x1')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0x4115('0x2'),_0x4115('0x3'),_0x4115('0x4'),_0x4115('0x5'),_0x4115('0x6'),_0x4115('0x7'),_0x4115('0x8'),_0x4115('0x9')],'include':[{'model':_0x4115('0xa'),'as':_0x4115('0xb'),'attributes':['id',_0x4115('0x2')],'include':[{'model':'DeskField','as':'Subjects','attributes':['id','type','content','variableName'],'include':[{'model':_0x4115('0xc'),'as':_0x4115('0xc'),'attributes':['id',_0x4115('0x2')]}]},{'model':'DeskField','as':_0x4115('0xd'),'attributes':['id','type',_0x4115('0xe'),_0x4115('0xf'),_0x4115('0x10'),_0x4115('0x11'),'variableName'],'include':[{'model':_0x4115('0xc'),'as':_0x4115('0xc'),'attributes':['id','name']}]},{'model':_0x4115('0x12'),'as':_0x4115('0x13'),'attributes':['id',_0x4115('0x8'),_0x4115('0xe'),_0x4115('0x14'),'nameField','customField',_0x4115('0x15')],'include':[{'model':_0x4115('0xc'),'as':_0x4115('0xc'),'attributes':['id','name']}]},{'model':_0x4115('0x16'),'as':_0x4115('0x17'),'attributes':['id',_0x4115('0x2')]}]}]},'log':'GetDeskAccount'});};};
\ No newline at end of file
index f38802e..faf9635 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb7e7=['GetDynamics365Account','username','remoteUri','tenantId','clientId','description','modernAuthentication','Dynamics365Configuration','name','ticketType','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','content','variableName','Variable','Descriptions','type','keyType','keyContent','Fields','idField','CloudProvider','data2','data5','data7','../../client'];(function(_0x324af5,_0x440a6e){var _0x2d037c=function(_0x557dc1){while(--_0x557dc1){_0x324af5['push'](_0x324af5['shift']());}};_0x2d037c(++_0x440a6e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb7e7[_0x4ea69d];return _0x5318e0;};'use strict';var client=require(_0x7b7e('0x0'));exports['getDynamics365Accounts']=function(){return function(_0x40e269){return client['Request'](_0x7b7e('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x7b7e('0x2'),'password',_0x7b7e('0x3'),_0x7b7e('0x4'),_0x7b7e('0x5'),'clientSecret','serverUrl',_0x7b7e('0x6'),_0x7b7e('0x7')],'include':[{'model':_0x7b7e('0x8'),'as':'Configurations','attributes':['id',_0x7b7e('0x9'),_0x7b7e('0xa'),_0x7b7e('0xb'),_0x7b7e('0xc'),_0x7b7e('0xd')],'include':[{'model':_0x7b7e('0xe'),'as':_0x7b7e('0xf'),'attributes':['id','type',_0x7b7e('0x10'),_0x7b7e('0x11')],'include':[{'model':_0x7b7e('0x12'),'as':_0x7b7e('0x12'),'attributes':['id',_0x7b7e('0x9')]}]},{'model':_0x7b7e('0xe'),'as':_0x7b7e('0x13'),'attributes':['id',_0x7b7e('0x14'),_0x7b7e('0x10'),'key',_0x7b7e('0x15'),_0x7b7e('0x16'),'variableName'],'include':[{'model':_0x7b7e('0x12'),'as':'Variable','attributes':['id','name']}]},{'model':_0x7b7e('0xe'),'as':_0x7b7e('0x17'),'attributes':['id',_0x7b7e('0x14'),_0x7b7e('0x10'),_0x7b7e('0x18'),'nameField','customField',_0x7b7e('0x11')],'include':[{'model':_0x7b7e('0x12'),'as':_0x7b7e('0x12'),'attributes':['id',_0x7b7e('0x9')]}]}]},{'model':_0x7b7e('0x19'),'as':_0x7b7e('0x19'),'attributes':['id',_0x7b7e('0x1a'),_0x7b7e('0x1b'),_0x7b7e('0x1c')]}]},'log':_0x7b7e('0x1')});};};
\ No newline at end of file
+var _0x065e=['additionalSearchContact','openNewTab','Dynamics365Field','type','content','variableName','Variable','key','keyContent','Fields','idField','nameField','customField','CloudProvider','data2','data5','data7','../../client','GetDynamics365Account','name','username','tenantId','clientId','serverUrl','description','modernAuthentication','Configurations','ticketType','moduleCreate'];(function(_0x545a60,_0x5210f8){var _0x2e06f3=function(_0x5a96d8){while(--_0x5a96d8){_0x545a60['push'](_0x545a60['shift']());}};_0x2e06f3(++_0x5210f8);}(_0x065e,0x1a7));var _0xe065=function(_0x4998eb,_0xbae7c7){_0x4998eb=_0x4998eb-0x0;var _0x525a74=_0x065e[_0x4998eb];return _0x525a74;};'use strict';var client=require(_0xe065('0x0'));exports['getDynamics365Accounts']=function(){return function(_0x549f09){return client['Request'](_0xe065('0x1'),{'options':{'raw':![],'attributes':['id',_0xe065('0x2'),_0xe065('0x3'),'password','remoteUri',_0xe065('0x4'),_0xe065('0x5'),'clientSecret',_0xe065('0x6'),_0xe065('0x7'),_0xe065('0x8')],'include':[{'model':'Dynamics365Configuration','as':_0xe065('0x9'),'attributes':['id','name',_0xe065('0xa'),_0xe065('0xb'),_0xe065('0xc'),_0xe065('0xd')],'include':[{'model':_0xe065('0xe'),'as':'Subjects','attributes':['id',_0xe065('0xf'),_0xe065('0x10'),_0xe065('0x11')],'include':[{'model':_0xe065('0x12'),'as':_0xe065('0x12'),'attributes':['id',_0xe065('0x2')]}]},{'model':'Dynamics365Field','as':'Descriptions','attributes':['id',_0xe065('0xf'),_0xe065('0x10'),_0xe065('0x13'),'keyType',_0xe065('0x14'),_0xe065('0x11')],'include':[{'model':_0xe065('0x12'),'as':_0xe065('0x12'),'attributes':['id',_0xe065('0x2')]}]},{'model':'Dynamics365Field','as':_0xe065('0x15'),'attributes':['id',_0xe065('0xf'),_0xe065('0x10'),_0xe065('0x16'),_0xe065('0x17'),_0xe065('0x18'),_0xe065('0x11')],'include':[{'model':'Variable','as':_0xe065('0x12'),'attributes':['id',_0xe065('0x2')]}]}]},{'model':'CloudProvider','as':_0xe065('0x19'),'attributes':['id',_0xe065('0x1a'),_0xe065('0x1b'),_0xe065('0x1c')]}]},'log':_0xe065('0x1')});};};
\ No newline at end of file
index e0463d3..a77ce76 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa571=['name','username','serverUrl','Configurations','Tag','FreshdeskField','Subjects','content','variableName','Variable','Descriptions','type','key','keyType','keyContent','nameField','../../client','getFreshdeskAccounts','Request'];(function(_0x460f81,_0x553431){var _0x423f0d=function(_0x267a6b){while(--_0x267a6b){_0x460f81['push'](_0x460f81['shift']());}};_0x423f0d(++_0x553431);}(_0xa571,0x107));var _0x1a57=function(_0xcce6b4,_0xbb6e1c){_0xcce6b4=_0xcce6b4-0x0;var _0xba54ca=_0xa571[_0xcce6b4];return _0xba54ca;};'use strict';var client=require(_0x1a57('0x0'));exports[_0x1a57('0x1')]=function(){return function(_0x206f1b){return client[_0x1a57('0x2')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id',_0x1a57('0x3'),_0x1a57('0x4'),'apiKey','remoteUri',_0x1a57('0x5')],'include':[{'model':'FreshdeskConfiguration','as':_0x1a57('0x6'),'attributes':['id',_0x1a57('0x3')],'include':[{'model':_0x1a57('0x7'),'attributes':['id',_0x1a57('0x3')]},{'model':_0x1a57('0x8'),'as':_0x1a57('0x9'),'attributes':['id','type',_0x1a57('0xa'),_0x1a57('0xb')],'include':[{'model':_0x1a57('0xc'),'as':'Variable','attributes':['id',_0x1a57('0x3')]}]},{'model':_0x1a57('0x8'),'as':_0x1a57('0xd'),'attributes':['id',_0x1a57('0xe'),_0x1a57('0xa'),_0x1a57('0xf'),_0x1a57('0x10'),_0x1a57('0x11'),'variableName'],'include':[{'model':'Variable','as':_0x1a57('0xc'),'attributes':['id',_0x1a57('0x3')]}]},{'model':_0x1a57('0x8'),'as':'Fields','attributes':['id',_0x1a57('0xe'),_0x1a57('0xa'),'idField',_0x1a57('0x12'),'customField',_0x1a57('0xb')],'include':[{'model':_0x1a57('0xc'),'as':_0x1a57('0xc'),'attributes':['id',_0x1a57('0x3')]}]}]}]},'log':'GetFreshdeskAccount'});};};
\ No newline at end of file
+var _0x4c71=['type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','apiKey','serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects'];(function(_0x16972f,_0x24951d){var _0x3e2509=function(_0x52339a){while(--_0x52339a){_0x16972f['push'](_0x16972f['shift']());}};_0x3e2509(++_0x24951d);}(_0x4c71,0x12b));var _0x14c7=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x4c71[_0x2064e5];return _0x21a233;};'use strict';var client=require(_0x14c7('0x0'));exports[_0x14c7('0x1')]=function(){return function(_0x581a30){return client[_0x14c7('0x2')](_0x14c7('0x3'),{'options':{'raw':![],'attributes':['id',_0x14c7('0x4'),_0x14c7('0x5'),_0x14c7('0x6'),'remoteUri',_0x14c7('0x7')],'include':[{'model':_0x14c7('0x8'),'as':_0x14c7('0x9'),'attributes':['id',_0x14c7('0x4')],'include':[{'model':_0x14c7('0xa'),'attributes':['id','name']},{'model':_0x14c7('0xb'),'as':_0x14c7('0xc'),'attributes':['id',_0x14c7('0xd'),_0x14c7('0xe'),_0x14c7('0xf')],'include':[{'model':'Variable','as':_0x14c7('0x10'),'attributes':['id','name']}]},{'model':_0x14c7('0xb'),'as':_0x14c7('0x11'),'attributes':['id','type',_0x14c7('0xe'),_0x14c7('0x12'),_0x14c7('0x13'),_0x14c7('0x14'),_0x14c7('0xf')],'include':[{'model':_0x14c7('0x10'),'as':'Variable','attributes':['id','name']}]},{'model':_0x14c7('0xb'),'as':_0x14c7('0x15'),'attributes':['id',_0x14c7('0xd'),_0x14c7('0xe'),_0x14c7('0x16'),_0x14c7('0x17'),'customField','variableName'],'include':[{'model':_0x14c7('0x10'),'as':_0x14c7('0x10'),'attributes':['id','name']}]}]}]},'log':_0x14c7('0x3')});};};
\ No newline at end of file
index 7382b60..2ce61e6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0f4d=['remoteUri','serverUrl','FreshsalesConfiguration','Configurations','Subjects','type','variableName','Variable','FreshsalesField','content','key','GetFreshsalesccount','Request','name','username','apiKey'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x53697c,_0x17fdc8){_0x53697c=_0x53697c-0x0;var _0x3c96cd=_0x0f4d[_0x53697c];return _0x3c96cd;};'use strict';var client=require('../../client');exports['getFreshsalesAccounts']=function(){return function(_0x54da22){return client[_0xd0f4('0x0')]('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0xd0f4('0x1'),_0xd0f4('0x2'),_0xd0f4('0x3'),_0xd0f4('0x4'),_0xd0f4('0x5')],'include':[{'model':_0xd0f4('0x6'),'as':_0xd0f4('0x7'),'attributes':['id',_0xd0f4('0x1')],'include':[{'model':'FreshsalesField','as':_0xd0f4('0x8'),'attributes':['id',_0xd0f4('0x9'),'content',_0xd0f4('0xa')],'include':[{'model':_0xd0f4('0xb'),'as':'Variable','attributes':['id',_0xd0f4('0x1')]}]},{'model':_0xd0f4('0xc'),'as':'Descriptions','attributes':['id',_0xd0f4('0x9'),_0xd0f4('0xd'),_0xd0f4('0xe'),'keyType','keyContent',_0xd0f4('0xa')],'include':[{'model':_0xd0f4('0xb'),'as':_0xd0f4('0xb'),'attributes':['id',_0xd0f4('0x1')]}]}]}]},'log':_0xd0f4('0xf')});};};
\ No newline at end of file
+var _0x292c=['../../client','Request','GetFreshsalesAccount','name','username','remoteUri','Configurations','FreshsalesField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','GetFreshsalesccount'];(function(_0x4b6778,_0x505a76){var _0x22dbb9=function(_0x4881eb){while(--_0x4881eb){_0x4b6778['push'](_0x4b6778['shift']());}};_0x22dbb9(++_0x505a76);}(_0x292c,0x66));var _0xc292=function(_0x52b24f,_0xca062d){_0x52b24f=_0x52b24f-0x0;var _0x46ea6b=_0x292c[_0x52b24f];return _0x46ea6b;};'use strict';var client=require(_0xc292('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x286dcb){return client[_0xc292('0x1')](_0xc292('0x2'),{'options':{'raw':![],'attributes':['id',_0xc292('0x3'),_0xc292('0x4'),'apiKey',_0xc292('0x5'),'serverUrl'],'include':[{'model':'FreshsalesConfiguration','as':_0xc292('0x6'),'attributes':['id',_0xc292('0x3')],'include':[{'model':_0xc292('0x7'),'as':_0xc292('0x8'),'attributes':['id',_0xc292('0x9'),_0xc292('0xa'),_0xc292('0xb')],'include':[{'model':_0xc292('0xc'),'as':_0xc292('0xc'),'attributes':['id',_0xc292('0x3')]}]},{'model':'FreshsalesField','as':_0xc292('0xd'),'attributes':['id',_0xc292('0x9'),_0xc292('0xa'),_0xc292('0xe'),_0xc292('0xf'),'keyContent',_0xc292('0xb')],'include':[{'model':_0xc292('0xc'),'as':_0xc292('0xc'),'attributes':['id',_0xc292('0x3')]}]}]}]},'log':_0xc292('0x10')});};};
\ No newline at end of file
index 28d6e75..141ca49 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4502=['Subjects','Variable','Descriptions','name','Fields','GetSalesforceAccount','../../client','getSalesforceAccounts','username','password','clientId','clientSecret','securityToken','serverUrl','type','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','SalesforceField'];(function(_0x25aa2c,_0x16b20a){var _0x3ba334=function(_0x4759db){while(--_0x4759db){_0x25aa2c['push'](_0x25aa2c['shift']());}};_0x3ba334(++_0x16b20a);}(_0x4502,0xa0));var _0x2450=function(_0x2a3b4d,_0x4ea8e8){_0x2a3b4d=_0x2a3b4d-0x0;var _0x1c16da=_0x4502[_0x2a3b4d];return _0x1c16da;};'use strict';var client=require(_0x2450('0x0'));exports[_0x2450('0x1')]=function(){return function(_0x42076b){return client['Request']('GetSalesforceAccount',{'options':{'raw':![],'attributes':['id','name',_0x2450('0x2'),_0x2450('0x3'),'remoteUri',_0x2450('0x4'),_0x2450('0x5'),_0x2450('0x6'),_0x2450('0x7'),_0x2450('0x8')],'include':[{'model':'SalesforceConfiguration','as':_0x2450('0x9'),'attributes':['id','name',_0x2450('0xa'),_0x2450('0xb'),_0x2450('0xc'),_0x2450('0xd'),_0x2450('0xe'),'additionalSearchContact','additionalSearchLead'],'include':[{'model':_0x2450('0xf'),'as':_0x2450('0x10'),'include':[{'model':_0x2450('0x11'),'as':_0x2450('0x11'),'attributes':['id','name']}]},{'model':_0x2450('0xf'),'as':_0x2450('0x12'),'include':[{'model':_0x2450('0x11'),'as':_0x2450('0x11'),'attributes':['id',_0x2450('0x13')]}]},{'model':_0x2450('0xf'),'as':_0x2450('0x14'),'include':[{'model':'Variable','as':_0x2450('0x11'),'attributes':['id',_0x2450('0x13')]}]}]}]},'log':_0x2450('0x15')});};};
\ No newline at end of file
+var _0x0825=['Fields','../../client','getSalesforceAccounts','GetSalesforceAccount','name','password','remoteUri','clientId','clientSecret','securityToken','serverUrl','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','Descriptions'];(function(_0x43886a,_0x38fcf0){var _0x54adb7=function(_0x32f062){while(--_0x32f062){_0x43886a['push'](_0x43886a['shift']());}};_0x54adb7(++_0x38fcf0);}(_0x0825,0x1e4));var _0x5082=function(_0x40cc9f,_0x105496){_0x40cc9f=_0x40cc9f-0x0;var _0x5895c9=_0x0825[_0x40cc9f];return _0x5895c9;};'use strict';var client=require(_0x5082('0x0'));exports[_0x5082('0x1')]=function(){return function(_0x5889f4){return client['Request'](_0x5082('0x2'),{'options':{'raw':![],'attributes':['id',_0x5082('0x3'),'username',_0x5082('0x4'),_0x5082('0x5'),_0x5082('0x6'),_0x5082('0x7'),_0x5082('0x8'),_0x5082('0x9'),'type'],'include':[{'model':'SalesforceConfiguration','as':'Configurations','attributes':['id',_0x5082('0x3'),_0x5082('0xa'),_0x5082('0xb'),_0x5082('0xc'),_0x5082('0xd'),'additionalSearchAccount',_0x5082('0xe'),_0x5082('0xf')],'include':[{'model':_0x5082('0x10'),'as':_0x5082('0x11'),'include':[{'model':_0x5082('0x12'),'as':_0x5082('0x12'),'attributes':['id',_0x5082('0x3')]}]},{'model':_0x5082('0x10'),'as':_0x5082('0x13'),'include':[{'model':_0x5082('0x12'),'as':_0x5082('0x12'),'attributes':['id',_0x5082('0x3')]}]},{'model':_0x5082('0x10'),'as':_0x5082('0x14'),'include':[{'model':_0x5082('0x12'),'as':'Variable','attributes':['id',_0x5082('0x3')]}]}]}]},'log':_0x5082('0x2')});};};
\ No newline at end of file
index 413f614..337dd03 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f8a=['Configurations','ServicenowField','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','idField','nameField','../../client','getServicenowAccounts','Request','name','description','username','password','email','remoteUri','serverUrl','ServicenowConfiguration'];(function(_0x3f0fcc,_0x2b6ce1){var _0x64185=function(_0x488434){while(--_0x488434){_0x3f0fcc['push'](_0x3f0fcc['shift']());}};_0x64185(++_0x2b6ce1);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x482393,_0x355061){_0x482393=_0x482393-0x0;var _0x4c07ae=_0x3f8a[_0x482393];return _0x4c07ae;};'use strict';var client=require(_0xa3f8('0x0'));exports[_0xa3f8('0x1')]=function(){return function(_0x29d753){return client[_0xa3f8('0x2')]('GetServicenowAccount',{'options':{'raw':![],'attributes':['id',_0xa3f8('0x3'),_0xa3f8('0x4'),_0xa3f8('0x5'),_0xa3f8('0x6'),_0xa3f8('0x7'),_0xa3f8('0x8'),_0xa3f8('0x9')],'include':[{'model':_0xa3f8('0xa'),'as':_0xa3f8('0xb'),'attributes':['id',_0xa3f8('0x3')],'include':[{'model':_0xa3f8('0xc'),'as':_0xa3f8('0xd'),'attributes':['id',_0xa3f8('0xe'),_0xa3f8('0xf'),_0xa3f8('0x10')],'include':[{'model':_0xa3f8('0x11'),'as':_0xa3f8('0x11'),'attributes':['id','name']}]},{'model':_0xa3f8('0xc'),'as':_0xa3f8('0x12'),'attributes':['id',_0xa3f8('0xe'),_0xa3f8('0xf'),'key',_0xa3f8('0x13'),_0xa3f8('0x14'),_0xa3f8('0x10')],'include':[{'model':_0xa3f8('0x11'),'as':_0xa3f8('0x11'),'attributes':['id',_0xa3f8('0x3')]}]},{'model':_0xa3f8('0xc'),'as':_0xa3f8('0x15'),'attributes':['id',_0xa3f8('0xe'),_0xa3f8('0xf'),_0xa3f8('0x16'),_0xa3f8('0x17'),'customField',_0xa3f8('0x10')],'include':[{'model':_0xa3f8('0x11'),'as':_0xa3f8('0x11'),'attributes':['id',_0xa3f8('0x3')]}]}]}]},'log':'GetServicenowkAccount'});};};
\ No newline at end of file
+var _0x524e=['name','description','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','Request','GetServicenowAccount'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x524e,0x15e));var _0xe524=function(_0xd5a16f,_0x4a61de){_0xd5a16f=_0xd5a16f-0x0;var _0x1ee6d7=_0x524e[_0xd5a16f];return _0x1ee6d7;};'use strict';var client=require('../../client');exports['getServicenowAccounts']=function(){return function(_0x353d8a){return client[_0xe524('0x0')](_0xe524('0x1'),{'options':{'raw':![],'attributes':['id',_0xe524('0x2'),_0xe524('0x3'),_0xe524('0x4'),_0xe524('0x5'),_0xe524('0x6'),_0xe524('0x7'),_0xe524('0x8')],'include':[{'model':'ServicenowConfiguration','as':_0xe524('0x9'),'attributes':['id',_0xe524('0x2')],'include':[{'model':_0xe524('0xa'),'as':'Subjects','attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0xd')],'include':[{'model':_0xe524('0xe'),'as':_0xe524('0xe'),'attributes':['id',_0xe524('0x2')]}]},{'model':_0xe524('0xa'),'as':_0xe524('0xf'),'attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0x10'),_0xe524('0x11'),_0xe524('0x12'),_0xe524('0xd')],'include':[{'model':_0xe524('0xe'),'as':_0xe524('0xe'),'attributes':['id','name']}]},{'model':'ServicenowField','as':_0xe524('0x13'),'attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0x14'),_0xe524('0x15'),'customField',_0xe524('0xd')],'include':[{'model':'Variable','as':_0xe524('0xe'),'attributes':['id',_0xe524('0x2')]}]}]}]},'log':'GetServicenowkAccount'});};};
\ No newline at end of file
index 1bb25a6..97e299e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x57ca=['name','username','password','remoteUri','SugarcrmConfiguration','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','nameField','getSugarcrmAccounts','GetSugarcrmAccount'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x57ca,0x108));var _0xa57c=function(_0x15d374,_0x2518e2){_0x15d374=_0x15d374-0x0;var _0x5f2271=_0x57ca[_0x15d374];return _0x5f2271;};'use strict';var client=require('../../client');exports[_0xa57c('0x0')]=function(){return function(_0x4ad696){return client['Request'](_0xa57c('0x1'),{'options':{'raw':![],'attributes':['id',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),'serverUrl'],'include':[{'model':_0xa57c('0x6'),'as':_0xa57c('0x7'),'attributes':['id',_0xa57c('0x2')],'include':[{'model':_0xa57c('0x8'),'as':_0xa57c('0x9'),'attributes':['id',_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc')],'include':[{'model':'Variable','as':_0xa57c('0xd'),'attributes':['id','name']}]},{'model':_0xa57c('0x8'),'as':_0xa57c('0xe'),'attributes':['id','type',_0xa57c('0xb'),'key',_0xa57c('0xf'),_0xa57c('0x10'),'variableName'],'include':[{'model':_0xa57c('0xd'),'as':'Variable','attributes':['id',_0xa57c('0x2')]}]},{'model':_0xa57c('0x8'),'as':_0xa57c('0x11'),'attributes':['id',_0xa57c('0xa'),_0xa57c('0xb'),'idField',_0xa57c('0x12'),'customField',_0xa57c('0xc')],'include':[{'model':_0xa57c('0xd'),'as':_0xa57c('0xd'),'attributes':['id',_0xa57c('0x2')]}]}]}]},'log':_0xa57c('0x1')});};};
\ No newline at end of file
+var _0x0b0e=['Configurations','SugarcrmField','Subjects','variableName','Variable','Descriptions','type','key','keyType','Fields','content','idField','customField','../../client','GetSugarcrmAccount','name','username','password','remoteUri','serverUrl','SugarcrmConfiguration'];(function(_0x3e9787,_0x4b4cf6){var _0x3d33c7=function(_0x396c6d){while(--_0x396c6d){_0x3e9787['push'](_0x3e9787['shift']());}};_0x3d33c7(++_0x4b4cf6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0x0b0e[_0x274638];return _0x5755df;};'use strict';var client=require(_0xe0b0('0x0'));exports['getSugarcrmAccounts']=function(){return function(_0xc416e3){return client['Request'](_0xe0b0('0x1'),{'options':{'raw':![],'attributes':['id',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6')],'include':[{'model':_0xe0b0('0x7'),'as':_0xe0b0('0x8'),'attributes':['id',_0xe0b0('0x2')],'include':[{'model':_0xe0b0('0x9'),'as':_0xe0b0('0xa'),'attributes':['id','type','content',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]},{'model':'SugarcrmField','as':_0xe0b0('0xd'),'attributes':['id',_0xe0b0('0xe'),'content',_0xe0b0('0xf'),_0xe0b0('0x10'),'keyContent',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id','name']}]},{'model':_0xe0b0('0x9'),'as':_0xe0b0('0x11'),'attributes':['id',_0xe0b0('0xe'),_0xe0b0('0x12'),_0xe0b0('0x13'),'nameField',_0xe0b0('0x14'),_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]}]}]},'log':'GetSugarcrmAccount'});};};
\ No newline at end of file
index 899a523..d371acd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb991=['variableName','Variable','key','keyType','keyContent','Fields','nameField','customField','GetVtigerAccount','getVtigerAccounts','Request','name','description','username','accessKey','remoteUri','VtigerConfiguration','Configurations','VtigerField','Subjects','type','content'];(function(_0x56f40d,_0x13a5f6){var _0x566666=function(_0x59cdd2){while(--_0x59cdd2){_0x56f40d['push'](_0x56f40d['shift']());}};_0x566666(++_0x13a5f6);}(_0xb991,0xcf));var _0x1b99=function(_0x374ccf,_0xa945c4){_0x374ccf=_0x374ccf-0x0;var _0x443cde=_0xb991[_0x374ccf];return _0x443cde;};'use strict';var client=require('../../client');exports[_0x1b99('0x0')]=function(){return function(_0x31365d){return client[_0x1b99('0x1')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id',_0x1b99('0x2'),_0x1b99('0x3'),_0x1b99('0x4'),_0x1b99('0x5'),_0x1b99('0x6'),'serverUrl'],'include':[{'model':_0x1b99('0x7'),'as':_0x1b99('0x8'),'attributes':['id',_0x1b99('0x2')],'include':[{'model':_0x1b99('0x9'),'as':_0x1b99('0xa'),'attributes':['id',_0x1b99('0xb'),_0x1b99('0xc'),_0x1b99('0xd')],'include':[{'model':_0x1b99('0xe'),'as':_0x1b99('0xe'),'attributes':['id',_0x1b99('0x2')]}]},{'model':_0x1b99('0x9'),'as':'Descriptions','attributes':['id','type','content',_0x1b99('0xf'),_0x1b99('0x10'),_0x1b99('0x11'),_0x1b99('0xd')],'include':[{'model':_0x1b99('0xe'),'as':_0x1b99('0xe'),'attributes':['id',_0x1b99('0x2')]}]},{'model':_0x1b99('0x9'),'as':_0x1b99('0x12'),'attributes':['id',_0x1b99('0xb'),_0x1b99('0xc'),'idField',_0x1b99('0x13'),_0x1b99('0x14'),'variableName'],'include':[{'model':_0x1b99('0xe'),'as':_0x1b99('0xe'),'attributes':['id','name']}]}]}]},'log':_0x1b99('0x15')});};};
\ No newline at end of file
+var _0xacbf=['serverUrl','Configurations','Subjects','type','content','variableName','Variable','VtigerField','Descriptions','key','keyType','keyContent','Fields','idField','customField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','accessKey','remoteUri'];(function(_0xa27f21,_0x99f637){var _0x1d0e5d=function(_0x32aa68){while(--_0x32aa68){_0xa27f21['push'](_0xa27f21['shift']());}};_0x1d0e5d(++_0x99f637);}(_0xacbf,0x1bf));var _0xfacb=function(_0x3a42dd,_0x30611d){_0x3a42dd=_0x3a42dd-0x0;var _0x4b0798=_0xacbf[_0x3a42dd];return _0x4b0798;};'use strict';var client=require(_0xfacb('0x0'));exports[_0xfacb('0x1')]=function(){return function(_0xd4617a){return client[_0xfacb('0x2')](_0xfacb('0x3'),{'options':{'raw':![],'attributes':['id',_0xfacb('0x4'),_0xfacb('0x5'),_0xfacb('0x6'),_0xfacb('0x7'),_0xfacb('0x8'),_0xfacb('0x9')],'include':[{'model':'VtigerConfiguration','as':_0xfacb('0xa'),'attributes':['id',_0xfacb('0x4')],'include':[{'model':'VtigerField','as':_0xfacb('0xb'),'attributes':['id',_0xfacb('0xc'),_0xfacb('0xd'),_0xfacb('0xe')],'include':[{'model':'Variable','as':_0xfacb('0xf'),'attributes':['id',_0xfacb('0x4')]}]},{'model':_0xfacb('0x10'),'as':_0xfacb('0x11'),'attributes':['id','type',_0xfacb('0xd'),_0xfacb('0x12'),_0xfacb('0x13'),_0xfacb('0x14'),_0xfacb('0xe')],'include':[{'model':_0xfacb('0xf'),'as':_0xfacb('0xf'),'attributes':['id',_0xfacb('0x4')]}]},{'model':_0xfacb('0x10'),'as':_0xfacb('0x15'),'attributes':['id','type',_0xfacb('0xd'),_0xfacb('0x16'),'nameField',_0xfacb('0x17'),_0xfacb('0xe')],'include':[{'model':'Variable','as':_0xfacb('0xf'),'attributes':['id',_0xfacb('0x4')]}]}]}]},'log':_0xfacb('0x3')});};};
\ No newline at end of file
index 5f8d958..57dd526 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc8a8=['Variable','Descriptions','type','key','keyType','keyContent','Fields','idField','nameField','customField','../../client','getZendeskAccounts','GetZendeskAccount','name','username','password','token','remoteUri','serverUrl','ZendeskConfiguration','Configurations','Tag','ZendeskField','Subjects','content','variableName'];(function(_0x37c006,_0x1f647a){var _0x3f306e=function(_0x48de6a){while(--_0x48de6a){_0x37c006['push'](_0x37c006['shift']());}};_0x3f306e(++_0x1f647a);}(_0xc8a8,0x176));var _0x8c8a=function(_0x409fb8,_0x5ab3d3){_0x409fb8=_0x409fb8-0x0;var _0x278270=_0xc8a8[_0x409fb8];return _0x278270;};'use strict';var client=require(_0x8c8a('0x0'));exports[_0x8c8a('0x1')]=function(){return function(_0x5de6a8){return client['Request'](_0x8c8a('0x2'),{'options':{'raw':![],'attributes':['id',_0x8c8a('0x3'),_0x8c8a('0x4'),_0x8c8a('0x5'),_0x8c8a('0x6'),_0x8c8a('0x7'),'authType',_0x8c8a('0x8'),'type'],'include':[{'model':_0x8c8a('0x9'),'as':_0x8c8a('0xa'),'attributes':['id',_0x8c8a('0x3')],'include':[{'model':_0x8c8a('0xb'),'attributes':['id','name']},{'model':_0x8c8a('0xc'),'as':_0x8c8a('0xd'),'attributes':['id','type',_0x8c8a('0xe'),_0x8c8a('0xf')],'include':[{'model':_0x8c8a('0x10'),'as':'Variable','attributes':['id',_0x8c8a('0x3')]}]},{'model':'ZendeskField','as':_0x8c8a('0x11'),'attributes':['id',_0x8c8a('0x12'),_0x8c8a('0xe'),_0x8c8a('0x13'),_0x8c8a('0x14'),_0x8c8a('0x15'),_0x8c8a('0xf')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x8c8a('0x3')]}]},{'model':'ZendeskField','as':_0x8c8a('0x16'),'attributes':['id',_0x8c8a('0x12'),_0x8c8a('0xe'),_0x8c8a('0x17'),_0x8c8a('0x18'),_0x8c8a('0x19'),_0x8c8a('0xf')],'include':[{'model':_0x8c8a('0x10'),'as':_0x8c8a('0x10'),'attributes':['id',_0x8c8a('0x3')]}]}]}]},'log':_0x8c8a('0x2')});};};
\ No newline at end of file
+var _0x944e=['remoteUri','authType','serverUrl','type','Tag','ZendeskField','content','Variable','key','keyContent','variableName','Fields','idField','nameField','customField','../../client','getZendeskAccounts','GetZendeskAccount','name','username','password','token'];(function(_0x5f0338,_0x399fce){var _0x7ae04a=function(_0x55416c){while(--_0x55416c){_0x5f0338['push'](_0x5f0338['shift']());}};_0x7ae04a(++_0x399fce);}(_0x944e,0x7d));var _0xe944=function(_0x1e605b,_0x20db11){_0x1e605b=_0x1e605b-0x0;var _0x3d1be8=_0x944e[_0x1e605b];return _0x3d1be8;};'use strict';var client=require(_0xe944('0x0'));exports[_0xe944('0x1')]=function(){return function(_0xa45b6d){return client['Request'](_0xe944('0x2'),{'options':{'raw':![],'attributes':['id',_0xe944('0x3'),_0xe944('0x4'),_0xe944('0x5'),_0xe944('0x6'),_0xe944('0x7'),_0xe944('0x8'),_0xe944('0x9'),_0xe944('0xa')],'include':[{'model':'ZendeskConfiguration','as':'Configurations','attributes':['id',_0xe944('0x3')],'include':[{'model':_0xe944('0xb'),'attributes':['id',_0xe944('0x3')]},{'model':_0xe944('0xc'),'as':'Subjects','attributes':['id',_0xe944('0xa'),_0xe944('0xd'),'variableName'],'include':[{'model':_0xe944('0xe'),'as':_0xe944('0xe'),'attributes':['id','name']}]},{'model':_0xe944('0xc'),'as':'Descriptions','attributes':['id',_0xe944('0xa'),_0xe944('0xd'),_0xe944('0xf'),'keyType',_0xe944('0x10'),_0xe944('0x11')],'include':[{'model':'Variable','as':_0xe944('0xe'),'attributes':['id',_0xe944('0x3')]}]},{'model':_0xe944('0xc'),'as':_0xe944('0x12'),'attributes':['id',_0xe944('0xa'),_0xe944('0xd'),_0xe944('0x13'),_0xe944('0x14'),_0xe944('0x15'),_0xe944('0x11')],'include':[{'model':'Variable','as':_0xe944('0xe'),'attributes':['id',_0xe944('0x3')]}]}]}]},'log':'GetZendeskAccount'});};};
\ No newline at end of file
index 2be1831..e20744b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa091=['refreshToken','Configurations','name','moduleCreate','ZohoField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','customField','../../client','getZohoAccounts','Request','GetZohoAccount','description','host','zone','clientId','serverUrl','code'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0xa091,0x1e4));var _0x1a09=function(_0x1389e3,_0x2ed4bd){_0x1389e3=_0x1389e3-0x0;var _0x3f6873=_0xa091[_0x1389e3];return _0x3f6873;};'use strict';var client=require(_0x1a09('0x0'));exports[_0x1a09('0x1')]=function(){return function(_0x5421bf){return client[_0x1a09('0x2')](_0x1a09('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x1a09('0x4'),_0x1a09('0x5'),_0x1a09('0x6'),_0x1a09('0x7'),'clientSecret',_0x1a09('0x8'),_0x1a09('0x9'),_0x1a09('0xa')],'include':[{'model':'ZohoConfiguration','as':_0x1a09('0xb'),'attributes':['id',_0x1a09('0xc'),_0x1a09('0xd'),'moduleSearch',_0x1a09('0x4')],'include':[{'model':_0x1a09('0xe'),'as':_0x1a09('0xf'),'attributes':['id',_0x1a09('0x10'),_0x1a09('0x11'),_0x1a09('0x12')],'include':[{'model':_0x1a09('0x13'),'as':_0x1a09('0x13'),'attributes':['id',_0x1a09('0xc')]}]},{'model':_0x1a09('0xe'),'as':_0x1a09('0x14'),'attributes':['id',_0x1a09('0x10'),_0x1a09('0x11'),_0x1a09('0x15'),_0x1a09('0x16'),_0x1a09('0x17'),'variableName'],'include':[{'model':'Variable','as':_0x1a09('0x13'),'attributes':['id',_0x1a09('0xc')]}]},{'model':_0x1a09('0xe'),'as':_0x1a09('0x18'),'attributes':['id',_0x1a09('0x10'),_0x1a09('0x11'),'idField','nameField',_0x1a09('0x19'),'variableName'],'include':[{'model':_0x1a09('0x13'),'as':'Variable','attributes':['id',_0x1a09('0xc')]}]}]}]},'log':'GetZohoAccount'});};};
\ No newline at end of file
+var _0x93f3=['Variable','type','keyType','keyContent','idField','customField','GetZohoAccount','getZohoAccounts','Request','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','moduleSearch','ZohoField','Subjects','content','variableName'];(function(_0x190c9f,_0x1c29e7){var _0x2151b8=function(_0x157e2c){while(--_0x157e2c){_0x190c9f['push'](_0x190c9f['shift']());}};_0x2151b8(++_0x1c29e7);}(_0x93f3,0x19f));var _0x393f=function(_0x55bebf,_0x54ea14){_0x55bebf=_0x55bebf-0x0;var _0x5bc959=_0x93f3[_0x55bebf];return _0x5bc959;};'use strict';var client=require('../../client');exports[_0x393f('0x0')]=function(){return function(_0x4fca6a){return client[_0x393f('0x1')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0x393f('0x2'),_0x393f('0x3'),_0x393f('0x4'),_0x393f('0x5'),_0x393f('0x6'),_0x393f('0x7'),_0x393f('0x8'),_0x393f('0x9'),_0x393f('0xa')],'include':[{'model':_0x393f('0xb'),'as':'Configurations','attributes':['id',_0x393f('0x2'),'moduleCreate',_0x393f('0xc'),'description'],'include':[{'model':_0x393f('0xd'),'as':_0x393f('0xe'),'attributes':['id','type',_0x393f('0xf'),_0x393f('0x10')],'include':[{'model':_0x393f('0x11'),'as':_0x393f('0x11'),'attributes':['id',_0x393f('0x2')]}]},{'model':_0x393f('0xd'),'as':'Descriptions','attributes':['id',_0x393f('0x12'),_0x393f('0xf'),'key',_0x393f('0x13'),_0x393f('0x14'),_0x393f('0x10')],'include':[{'model':'Variable','as':_0x393f('0x11'),'attributes':['id',_0x393f('0x2')]}]},{'model':_0x393f('0xd'),'as':'Fields','attributes':['id',_0x393f('0x12'),_0x393f('0xf'),_0x393f('0x15'),'nameField',_0x393f('0x16'),_0x393f('0x10')],'include':[{'model':_0x393f('0x11'),'as':_0x393f('0x11'),'attributes':['id',_0x393f('0x2')]}]}]}]},'log':_0x393f('0x17')});};};
\ No newline at end of file
index d2501cf..8cd6638 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x21c1=['voiceDialReport','membername','starttime','endtime','outbound','dialstring','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','exten','queue','agent','toNumber','accountcode'];(function(_0x30781e,_0x48457f){var _0x22da8c=function(_0x80a5c7){while(--_0x80a5c7){_0x30781e['push'](_0x30781e['shift']());}};_0x22da8c(++_0x48457f);}(_0x21c1,0x128));var _0x121c=function(_0x5d9030,_0x26a000){_0x5d9030=_0x5d9030-0x0;var _0x52ed22=_0x21c1[_0x5d9030];return _0x52ed22;};'use strict';var moment=require(_0x121c('0x0'));var _=require(_0x121c('0x1'));var util=require(_0x121c('0x2'));var client=require('../client');exports[_0x121c('0x3')]=function(_0x55e73c){var _0x50162c=_0x55e73c[_0x121c('0x4')]||_0x55e73c[_0x121c('0x5')];return client[_0x121c('0x6')](_0x121c('0x7'),{'body':{'channel':_0x121c('0x8'),'membername':_0x55e73c[_0x121c('0x9')],'interface':_['isNil'](_0x55e73c[_0x121c('0xa')])?util[_0x121c('0xb')](_0x121c('0xc'),_0x55e73c[_0x121c('0x9')]):_0x55e73c[_0x121c('0xa')],'type':_0x121c('0xd'),'enterAt':_0x55e73c[_0x121c('0xe')],'exitAt':_0x50162c,'duration':moment(_0x50162c)[_0x121c('0xf')](_0x55e73c[_0x121c('0xe')],_0x121c('0x10')),'data1':_0x121c('0x11'),'data2':_0x55e73c['calleridnum'],'data3':_0x55e73c[_0x121c('0x12')],'data4':null,'data5':_0x55e73c[_0x121c('0x13')],'role':_0x121c('0x14'),'internal':_0x55e73c['accountcode']?_[_0x121c('0x15')](_0x55e73c[_0x121c('0x16')]):undefined,'uniqueid':_0x55e73c['uniqueid']},'log':_0x121c('0x7')});};exports[_0x121c('0x17')]=function(_0x386f41){return client['Request'](_0x121c('0x7'),{'body':{'channel':_0x121c('0x8'),'membername':_0x386f41[_0x121c('0x18')],'interface':_0x386f41['interface'],'type':'TALKING','enterAt':_0x386f41[_0x121c('0x19')],'exitAt':_0x386f41[_0x121c('0x1a')],'duration':moment(_0x386f41[_0x121c('0x1a')])[_0x121c('0xf')](_0x386f41[_0x121c('0x19')],_0x121c('0x10'))>=0x0?moment(_0x386f41[_0x121c('0x1a')])[_0x121c('0xf')](_0x386f41[_0x121c('0x19')],_0x121c('0x10')):null,'data1':_0x121c('0x1b'),'data2':_0x386f41[_0x121c('0x16')],'data3':_0x386f41['exten'],'data4':_0x386f41[_0x121c('0x1c')]||null,'role':_0x121c('0x14'),'internal':_0x386f41[_0x121c('0x16')]?_[_0x121c('0x15')](_0x386f41[_0x121c('0x16')]):undefined,'uniqueid':_0x386f41['uniqueid']},'log':_0x121c('0x7')});};
\ No newline at end of file
+var _0xf6c2=['agent','accountcode','uniqueid','CreateMemberReport','voiceDialReport','starttime','endtime','dialstring','toNumber','lodash','util','voiceQueueReport','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf6c2,0x175));var _0x2f6c=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xf6c2[_0xaa0309];return _0x5de7ce;};'use strict';var moment=require('moment');var _=require(_0x2f6c('0x0'));var util=require(_0x2f6c('0x1'));var client=require('../client');exports[_0x2f6c('0x2')]=function(_0x4b53cd){var _0xf8def2=_0x4b53cd['queuecallercompleteAt']||_0x4b53cd[_0x2f6c('0x3')];return client[_0x2f6c('0x4')]('CreateMemberReport',{'body':{'channel':_0x2f6c('0x5'),'membername':_0x4b53cd[_0x2f6c('0x6')],'interface':_[_0x2f6c('0x7')](_0x4b53cd[_0x2f6c('0x8')])?util[_0x2f6c('0x9')](_0x2f6c('0xa'),_0x4b53cd[_0x2f6c('0x6')]):_0x4b53cd['interface'],'type':_0x2f6c('0xb'),'enterAt':_0x4b53cd[_0x2f6c('0xc')],'exitAt':_0xf8def2,'duration':moment(_0xf8def2)[_0x2f6c('0xd')](_0x4b53cd[_0x2f6c('0xc')],_0x2f6c('0xe')),'data1':_0x2f6c('0xf'),'data2':_0x4b53cd[_0x2f6c('0x10')],'data3':_0x4b53cd[_0x2f6c('0x11')],'data4':null,'data5':_0x4b53cd[_0x2f6c('0x12')],'role':_0x2f6c('0x13'),'internal':_0x4b53cd[_0x2f6c('0x14')]?_['toNumber'](_0x4b53cd[_0x2f6c('0x14')]):undefined,'uniqueid':_0x4b53cd[_0x2f6c('0x15')]},'log':_0x2f6c('0x16')});};exports[_0x2f6c('0x17')]=function(_0x3f4bf7){return client['Request'](_0x2f6c('0x16'),{'body':{'channel':'voice','membername':_0x3f4bf7['membername'],'interface':_0x3f4bf7[_0x2f6c('0x8')],'type':_0x2f6c('0xb'),'enterAt':_0x3f4bf7[_0x2f6c('0x18')],'exitAt':_0x3f4bf7[_0x2f6c('0x19')],'duration':moment(_0x3f4bf7[_0x2f6c('0x19')])[_0x2f6c('0xd')](_0x3f4bf7[_0x2f6c('0x18')],'seconds')>=0x0?moment(_0x3f4bf7[_0x2f6c('0x19')])[_0x2f6c('0xd')](_0x3f4bf7[_0x2f6c('0x18')],_0x2f6c('0xe')):null,'data1':'outbound','data2':_0x3f4bf7[_0x2f6c('0x14')],'data3':_0x3f4bf7[_0x2f6c('0x11')],'data4':_0x3f4bf7[_0x2f6c('0x1a')]||null,'role':'agent','internal':_0x3f4bf7[_0x2f6c('0x14')]?_[_0x2f6c('0x1b')](_0x3f4bf7[_0x2f6c('0x14')]):undefined,'uniqueid':_0x3f4bf7['uniqueid']},'log':_0x2f6c('0x16')});};
\ No newline at end of file
index 6888667..b111fa6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c9b=['Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','getSettings'];(function(_0x46f80d,_0x414059){var _0x1e5e21=function(_0x547295){while(--_0x547295){_0x46f80d['push'](_0x46f80d['shift']());}};_0x1e5e21(++_0x414059);}(_0x9c9b,0x194));var _0xb9c9=function(_0x47ae6a,_0x154609){_0x47ae6a=_0x47ae6a-0x0;var _0x41d160=_0x9c9b[_0x47ae6a];return _0x41d160;};'use strict';var client=require('../client');exports[_0xb9c9('0x0')]=function(){return client[_0xb9c9('0x1')](_0xb9c9('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb9c9('0x3'),_0xb9c9('0x4')]},'log':'GetSettings'});};
\ No newline at end of file
+var _0x4bde=['GetSettings','../client','getSettings','Request','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x5100b9,_0x3c1182){var _0x71d686=function(_0x424b93){while(--_0x424b93){_0x5100b9['push'](_0x5100b9['shift']());}};_0x71d686(++_0x3c1182);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x3abad5,_0x209bb4){_0x3abad5=_0x3abad5-0x0;var _0x326afe=_0x4bde[_0x3abad5];return _0x326afe;};'use strict';var client=require(_0xe4bd('0x0'));exports[_0xe4bd('0x1')]=function(){return client[_0xe4bd('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe4bd('0x3'),_0xe4bd('0x4')]},'log':_0xe4bd('0x5')});};
\ No newline at end of file
index 327cee6..9950713 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e7a=['Request','GetTemplate','getTemplates'];(function(_0x57752a,_0x1df213){var _0x43a8cc=function(_0x1fc9d8){while(--_0x1fc9d8){_0x57752a['push'](_0x57752a['shift']());}};_0x43a8cc(++_0x1df213);}(_0x8e7a,0x1ac));var _0xa8e7=function(_0x51cdac,_0x31a853){_0x51cdac=_0x51cdac-0x0;var _0x4f664d=_0x8e7a[_0x51cdac];return _0x4f664d;};'use strict';var client=require('../client');exports[_0xa8e7('0x0')]=function(_0x8626da){return function(_0x57c531){return client[_0xa8e7('0x1')](_0xa8e7('0x2'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':_0xa8e7('0x2')});};};
\ No newline at end of file
+var _0x410c=['Request','GetTemplate','../client','getTemplates'];(function(_0x1c9cfb,_0x4efc3b){var _0x32436a=function(_0x6836da){while(--_0x6836da){_0x1c9cfb['push'](_0x1c9cfb['shift']());}};_0x32436a(++_0x4efc3b);}(_0x410c,0x1b2));var _0xc410=function(_0x15728c,_0x39c9ce){_0x15728c=_0x15728c-0x0;var _0x112daa=_0x410c[_0x15728c];return _0x112daa;};'use strict';var client=require(_0xc410('0x0'));exports[_0xc410('0x1')]=function(_0x1337ef){return function(_0x5f18b4){return client[_0xc410('0x2')](_0xc410('0x3'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':_0xc410('0x3')});};};
\ No newline at end of file
index 1550b87..cd85ea1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd9d0=['data5','data6','data7','GetTrigger','../client','getTriggers','Request','name','channel','status','Condition','field','operator','value','Actions','action','data1','data3','data4'];(function(_0x2a4a43,_0x285971){var _0x3ec399=function(_0xd7631e){while(--_0xd7631e){_0x2a4a43['push'](_0x2a4a43['shift']());}};_0x3ec399(++_0x285971);}(_0xd9d0,0xd5));var _0x0d9d=function(_0x3727a9,_0x1c2edb){_0x3727a9=_0x3727a9-0x0;var _0xa16806=_0xd9d0[_0x3727a9];return _0xa16806;};'use strict';var client=require(_0x0d9d('0x0'));exports[_0x0d9d('0x1')]=function(_0xd56231){return function(_0x26f164){return client[_0x0d9d('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x0d9d('0x3'),_0x0d9d('0x4'),_0x0d9d('0x5')],'include':[{'model':_0x0d9d('0x6'),'as':'AllConditions','attributes':['id',_0x0d9d('0x7'),_0x0d9d('0x8'),_0x0d9d('0x9')]},{'model':_0x0d9d('0x6'),'as':'AnyConditions','attributes':['id',_0x0d9d('0x7'),_0x0d9d('0x8'),_0x0d9d('0x9')]},{'model':'Action','as':_0x0d9d('0xa'),'attributes':['id',_0x0d9d('0xb'),_0x0d9d('0xc'),'data2',_0x0d9d('0xd'),_0x0d9d('0xe'),_0x0d9d('0xf'),_0x0d9d('0x10'),_0x0d9d('0x11')]}]},'log':_0x0d9d('0x12')});};};
\ No newline at end of file
+var _0xd9ef=['value','Action','Actions','action','data1','data2','data3','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','field','operator','Condition'];(function(_0x3ee7e8,_0x4fdcbd){var _0x79f152=function(_0x46852e){while(--_0x46852e){_0x3ee7e8['push'](_0x3ee7e8['shift']());}};_0x79f152(++_0x4fdcbd);}(_0xd9ef,0xc7));var _0xfd9e=function(_0x276fae,_0x1424c1){_0x276fae=_0x276fae-0x0;var _0x132c7e=_0xd9ef[_0x276fae];return _0x132c7e;};'use strict';var client=require(_0xfd9e('0x0'));exports[_0xfd9e('0x1')]=function(_0x251c06){return function(_0x2e5fa8){return client[_0xfd9e('0x2')](_0xfd9e('0x3'),{'options':{'raw':![],'attributes':['id',_0xfd9e('0x4'),_0xfd9e('0x5'),_0xfd9e('0x6')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xfd9e('0x7'),_0xfd9e('0x8'),'value']},{'model':_0xfd9e('0x9'),'as':'AnyConditions','attributes':['id','field',_0xfd9e('0x8'),_0xfd9e('0xa')]},{'model':_0xfd9e('0xb'),'as':_0xfd9e('0xc'),'attributes':['id',_0xfd9e('0xd'),_0xfd9e('0xe'),_0xfd9e('0xf'),_0xfd9e('0x10'),'data4','data5',_0xfd9e('0x11'),_0xfd9e('0x12')]}]},'log':_0xfd9e('0x3')});};};
\ No newline at end of file
index a5b3b9c..a80dfce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xad3f=['registry','getTrunks','Request','GetTrunk'];(function(_0x2520ca,_0x4ecb53){var _0x1a1db8=function(_0x3ec41b){while(--_0x3ec41b){_0x2520ca['push'](_0x2520ca['shift']());}};_0x1a1db8(++_0x4ecb53);}(_0xad3f,0x189));var _0xfad3=function(_0x1a2d42,_0x5e628a){_0x1a2d42=_0x1a2d42-0x0;var _0x5a7a38=_0xad3f[_0x1a2d42];return _0x5a7a38;};'use strict';var client=require('../client');exports[_0xfad3('0x0')]=function(_0x135a58){return function(_0x2e7c4e){return client[_0xfad3('0x1')](_0xfad3('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xfad3('0x3'),'defaultuser']},'log':_0xfad3('0x2')});};};
\ No newline at end of file
+var _0xf097=['getTrunks','Request','GetTrunk','name','../client'];(function(_0x575f51,_0x344291){var _0x517fba=function(_0x90512f){while(--_0x90512f){_0x575f51['push'](_0x575f51['shift']());}};_0x517fba(++_0x344291);}(_0xf097,0x1b2));var _0x7f09=function(_0x5eb5ce,_0xeb9b44){_0x5eb5ce=_0x5eb5ce-0x0;var _0xaa7cf8=_0xf097[_0x5eb5ce];return _0xaa7cf8;};'use strict';var client=require(_0x7f09('0x0'));exports[_0x7f09('0x1')]=function(_0x2950ab){return function(_0x19a07e){return client[_0x7f09('0x2')](_0x7f09('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7f09('0x4'),'registry','defaultuser']},'log':'GetTrunk'});};};
\ No newline at end of file
index 5a4a84a..165457e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x40c734,_0x316834){var _0x281e96=function(_0x155e41){while(--_0x155e41){_0x40c734['push'](_0x40c734['shift']());}};_0x281e96(++_0x316834);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});};
\ No newline at end of file
+var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x4f4d3e,_0x274a37){var _0xc11e12=function(_0x5a2da1){while(--_0x5a2da1){_0x4f4d3e['push'](_0x4f4d3e['shift']());}};_0xc11e12(++_0x274a37);}(_0xedd9,0xfc));var _0x9edd=function(_0x2ed474,_0x685826){_0x2ed474=_0x2ed474-0x0;var _0x4be574=_0xedd9[_0x2ed474];return _0x4be574;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});};
\ No newline at end of file
index e2983b0..8278746 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5ae0=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x1a174b,_0x1495ae){var _0x140b43=function(_0x52f87f){while(--_0x52f87f){_0x1a174b['push'](_0x1a174b['shift']());}};_0x140b43(++_0x1495ae);}(_0x5ae0,0x109));var _0x05ae=function(_0x48fef1,_0x28c7f6){_0x48fef1=_0x48fef1-0x0;var _0xe804ac=_0x5ae0[_0x48fef1];return _0xe804ac;};'use strict';var client=require(_0x05ae('0x0'));exports['create']=function(_0x441137){return client[_0x05ae('0x1')](_0x05ae('0x2'),{'body':_0x441137,'log':_0x05ae('0x2')});};exports[_0x05ae('0x3')]=function(_0x5b9a9d,_0x28c8d4,_0x1aad57){return client[_0x05ae('0x1')]('UpdateVoiceAgentReport',{'body':_0x5b9a9d,'options':{'where':{'uniqueid':_0x28c8d4,'interface':_0x1aad57,'agentcomplete':!![]}},'log':_0x05ae('0x4')});};
\ No newline at end of file
+var _0x16d6=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create'];(function(_0x34b6aa,_0x5ddd29){var _0x3ead29=function(_0x53979c){while(--_0x53979c){_0x34b6aa['push'](_0x34b6aa['shift']());}};_0x3ead29(++_0x5ddd29);}(_0x16d6,0xc1));var _0x616d=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0x16d6[_0x2d4661];return _0x42ed1e;};'use strict';var client=require(_0x616d('0x0'));exports[_0x616d('0x1')]=function(_0xe26aee){return client[_0x616d('0x2')](_0x616d('0x3'),{'body':_0xe26aee,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x4f4948,_0x3dab9d,_0x18f161){return client[_0x616d('0x2')](_0x616d('0x4'),{'body':_0x4f4948,'options':{'where':{'uniqueid':_0x3dab9d,'interface':_0x18f161,'agentcomplete':!![]}},'log':_0x616d('0x4')});};
\ No newline at end of file
index d7988b7..63af4f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0560=['GetVoiceCallReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','billableseconds','GetVoiceCallReports','moment','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports'];(function(_0x497a61,_0x2a54a1){var _0x9ad30e=function(_0x5d6c14){while(--_0x5d6c14){_0x497a61['push'](_0x497a61['shift']());}};_0x9ad30e(++_0x2a54a1);}(_0x0560,0x82));var _0x0056=function(_0x28c4f0,_0x13fc31){_0x28c4f0=_0x28c4f0-0x0;var _0x1dceec=_0x0560[_0x28c4f0];return _0x1dceec;};'use strict';var moment=require(_0x0056('0x0'));var util=require('util');var _=require('lodash');var client=require(_0x0056('0x1'));exports[_0x0056('0x2')]=function(_0x238ee0){return client[_0x0056('0x3')](_0x0056('0x4'),{'body':_[_0x0056('0x5')](_0x238ee0,{'source':_0x238ee0[_0x0056('0x6')],'destinationcontext':_0x238ee0[_0x0056('0x7')],'callerid':_0x238ee0[_0x0056('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x0056('0x4')});};exports[_0x0056('0x9')]=function(){return function(){return client[_0x0056('0x3')](_0x0056('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x0056('0xb')]('day')[_0x0056('0xc')](_0x0056('0xd')),moment()[_0x0056('0xe')](_0x0056('0xf'))[_0x0056('0xc')](_0x0056('0xd'))]}},'attributes':[_0x0056('0x10'),_0x0056('0x11'),'duration',_0x0056('0x12')]},'log':_0x0056('0x13')});};};
\ No newline at end of file
+var _0xc38f=['disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x26d61f,_0x59709e){var _0x365b54=function(_0x358938){while(--_0x358938){_0x26d61f['push'](_0x26d61f['shift']());}};_0x365b54(++_0x59709e);}(_0xc38f,0x1e4));var _0xfc38=function(_0x1e963c,_0x144e11){_0x1e963c=_0x1e963c-0x0;var _0x50b88e=_0xc38f[_0x1e963c];return _0x50b88e;};'use strict';var moment=require(_0xfc38('0x0'));var util=require(_0xfc38('0x1'));var _=require(_0xfc38('0x2'));var client=require(_0xfc38('0x3'));exports[_0xfc38('0x4')]=function(_0x14ce7d){return client[_0xfc38('0x5')](_0xfc38('0x6'),{'body':_['merge'](_0x14ce7d,{'source':_0x14ce7d[_0xfc38('0x7')],'destinationcontext':_0x14ce7d[_0xfc38('0x8')],'callerid':_0x14ce7d[_0xfc38('0x9')],'amaflags':_0xfc38('0xa')}),'log':_0xfc38('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xfc38('0x5')](_0xfc38('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xfc38('0xc')](_0xfc38('0xd'))[_0xfc38('0xe')](_0xfc38('0xf')),moment()['endOf']('day')[_0xfc38('0xe')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0xfc38('0x10'),_0xfc38('0x11'),_0xfc38('0x12')]},'log':_0xfc38('0x13')});};};
\ No newline at end of file
index a58fd0b..32447b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd270=['create','Request','CreateVoiceDialReport','../client'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd270,0x117));var _0x0d27=function(_0x3e1b9a,_0x117df4){_0x3e1b9a=_0x3e1b9a-0x0;var _0x346f3c=_0xd270[_0x3e1b9a];return _0x346f3c;};'use strict';var client=require(_0x0d27('0x0'));exports[_0x0d27('0x1')]=function(_0x3ea96c){return client[_0x0d27('0x2')](_0x0d27('0x3'),{'body':_0x3ea96c,'log':_0x0d27('0x3')});};
\ No newline at end of file
+var _0x4f97=['CreateVoiceDialReport','../client','create'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0x4f97,0x16f));var _0x74f9=function(_0x1d9ef5,_0x2251a1){_0x1d9ef5=_0x1d9ef5-0x0;var _0x2a9f7a=_0x4f97[_0x1d9ef5];return _0x2a9f7a;};'use strict';var client=require(_0x74f9('0x0'));exports[_0x74f9('0x1')]=function(_0x5532c8){return client['Request'](_0x74f9('0x2'),{'body':_0x5532c8,'log':_0x74f9('0x2')});};
\ No newline at end of file
index 6e6c34b..19d7e02 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc6fe=['GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x195ad4,_0x3881a4){var _0x31f327=function(_0x322546){while(--_0x322546){_0x195ad4['push'](_0x195ad4['shift']());}};_0x31f327(++_0x3881a4);}(_0xc6fe,0xbc));var _0xec6f=function(_0x2131af,_0x126c82){_0x2131af=_0x2131af-0x0;var _0x47edb8=_0xc6fe[_0x2131af];return _0x47edb8;};'use strict';var client=require(_0xec6f('0x0'));exports[_0xec6f('0x1')]=function(){return function(){return client['Request'](_0xec6f('0x2'),{'options':{'raw':!![],'attributes':['id',_0xec6f('0x3'),_0xec6f('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};};
\ No newline at end of file
+var _0x0834=['Request','GetVoiceExtension'];(function(_0x478a60,_0x43cfc5){var _0x4021b7=function(_0x26d7de){while(--_0x26d7de){_0x478a60['push'](_0x478a60['shift']());}};_0x4021b7(++_0x43cfc5);}(_0x0834,0x18e));var _0x4083=function(_0x117381,_0x32bfa9){_0x117381=_0x117381-0x0;var _0x112485=_0x0834[_0x117381];return _0x112485;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x4083('0x0')](_0x4083('0x1'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};};
\ No newline at end of file
index ae0ce55..b500379 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x51d9=['mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','name','TrunkBackup','Interval','interval','../client','getVoiceQueues','acwTimeout','autopause','type','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency'];(function(_0x229c7d,_0x50f608){var _0x5023f8=function(_0x517f0c){while(--_0x517f0c){_0x229c7d['push'](_0x229c7d['shift']());}};_0x5023f8(++_0x50f608);}(_0x51d9,0x8e));var _0x951d=function(_0x5f17db,_0x3d8701){_0x5f17db=_0x5f17db-0x0;var _0x4c0a30=_0x51d9[_0x5f17db];return _0x4c0a30;};'use strict';var client=require(_0x951d('0x0'));exports[_0x951d('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name','acw',_0x951d('0x2'),_0x951d('0x3'),'monitor_format',_0x951d('0x4'),'dialActive',_0x951d('0x5'),'dialLimitChannel',_0x951d('0x6'),_0x951d('0x7'),_0x951d('0x8'),_0x951d('0x9'),_0x951d('0xa'),_0x951d('0xb'),_0x951d('0xc'),_0x951d('0xd'),_0x951d('0xe'),'dialQueueTimeout',_0x951d('0xf'),'dialCongestionMaxRetry',_0x951d('0x10'),_0x951d('0x11'),_0x951d('0x12'),_0x951d('0x13'),_0x951d('0x14'),_0x951d('0x15'),_0x951d('0x16'),_0x951d('0x17'),'dialPrefix',_0x951d('0x18'),_0x951d('0x19'),'dialAMDInitialSilence',_0x951d('0x1a'),_0x951d('0x1b'),_0x951d('0x1c'),_0x951d('0x1d'),_0x951d('0x1e'),_0x951d('0x1f'),'dialAMDSilenceThreshold',_0x951d('0x20'),_0x951d('0x21'),_0x951d('0x22'),_0x951d('0x23'),_0x951d('0x24'),_0x951d('0x25'),_0x951d('0x26'),'dialQueueProject2','monitor_format',_0x951d('0x27'),_0x951d('0x28'),_0x951d('0x29'),_0x951d('0x2a'),'dialNoSuchNumberRetryFrequency',_0x951d('0x2b'),_0x951d('0x2c'),_0x951d('0x2d'),'dialAbandonedRetryFrequency',_0x951d('0x2e'),_0x951d('0x2f'),_0x951d('0x30'),_0x951d('0x31'),_0x951d('0x32'),_0x951d('0x33'),_0x951d('0x34'),_0x951d('0x35'),_0x951d('0x36'),_0x951d('0x37')],'include':[{'model':'Trunk','as':_0x951d('0x38'),'attributes':['id','name',_0x951d('0x39'),_0x951d('0x3a')]},{'model':_0x951d('0x3b'),'as':'mandatoryDispositionPause','attributes':['id',_0x951d('0x3c')]},{'model':_0x951d('0x38'),'as':_0x951d('0x3d'),'attributes':['id',_0x951d('0x3c'),_0x951d('0x39'),'active']},{'model':_0x951d('0x3e'),'as':_0x951d('0x3e'),'attributes':['id',_0x951d('0x3c')],'include':[{'model':_0x951d('0x3e'),'as':'Intervals','attributes':['id',_0x951d('0x3c'),_0x951d('0x3f')]}]}]},'log':'getVoiceQueues'});};};
\ No newline at end of file
+var _0x13a2=['interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Pause','Trunk','TrunkBackup','active','Interval'];(function(_0xc353a4,_0x2f294d){var _0x460243=function(_0x225df5){while(--_0x225df5){_0xc353a4['push'](_0xc353a4['shift']());}};_0x460243(++_0x2f294d);}(_0x13a2,0x175));var _0x213a=function(_0x559a0b,_0x57edef){_0x559a0b=_0x559a0b-0x0;var _0x396a2a=_0x13a2[_0x559a0b];return _0x396a2a;};'use strict';var client=require(_0x213a('0x0'));exports[_0x213a('0x1')]=function(){return function(){return client[_0x213a('0x2')](_0x213a('0x3'),{'options':{'raw':![],'attributes':['id',_0x213a('0x4'),_0x213a('0x5'),_0x213a('0x6'),_0x213a('0x7'),_0x213a('0x8'),'type','dialActive','dialMethod',_0x213a('0x9'),_0x213a('0xa'),_0x213a('0xb'),_0x213a('0xc'),_0x213a('0xd'),'dialPredictiveInterval',_0x213a('0xe'),_0x213a('0xf'),_0x213a('0x10'),_0x213a('0x11'),_0x213a('0x12'),_0x213a('0x13'),'dialCongestionMaxRetry',_0x213a('0x14'),_0x213a('0x15'),_0x213a('0x16'),_0x213a('0x17'),_0x213a('0x18'),_0x213a('0x19'),_0x213a('0x1a'),_0x213a('0x1b'),_0x213a('0x1c'),'dialCheckDuplicateType',_0x213a('0x1d'),'dialAMDInitialSilence','dialAMDGreeting',_0x213a('0x1e'),_0x213a('0x1f'),_0x213a('0x20'),_0x213a('0x21'),_0x213a('0x22'),_0x213a('0x23'),_0x213a('0x24'),_0x213a('0x25'),_0x213a('0x26'),'dialRecallInQueue',_0x213a('0x27'),_0x213a('0x28'),'dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy',_0x213a('0x29'),_0x213a('0x2a'),_0x213a('0x2b'),'dialNoSuchNumberRetryFrequency',_0x213a('0x2c'),_0x213a('0x2d'),_0x213a('0x2e'),_0x213a('0x2f'),_0x213a('0x30'),_0x213a('0x31'),_0x213a('0x32'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0x213a('0x33'),_0x213a('0x34'),_0x213a('0x35'),_0x213a('0x36'),_0x213a('0x37')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x213a('0x4'),'callerid','active']},{'model':_0x213a('0x38'),'as':'mandatoryDispositionPause','attributes':['id',_0x213a('0x4')]},{'model':_0x213a('0x39'),'as':_0x213a('0x3a'),'attributes':['id',_0x213a('0x4'),'callerid',_0x213a('0x3b')]},{'model':_0x213a('0x3c'),'as':_0x213a('0x3c'),'attributes':['id','name'],'include':[{'model':_0x213a('0x3c'),'as':'Intervals','attributes':['id',_0x213a('0x4'),_0x213a('0x3d')]}]}]},'log':_0x213a('0x1')});};};
\ No newline at end of file
index c275e0c..b87f18d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x387cdb,_0x279317){var _0x37cd56=function(_0x501462){while(--_0x501462){_0x387cdb['push'](_0x387cdb['shift']());}};_0x37cd56(++_0x279317);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};};
\ No newline at end of file
+var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0xf9eb08,_0x2bbcec){var _0x5f82cc=function(_0x2ae319){while(--_0x2ae319){_0xf9eb08['push'](_0xf9eb08['shift']());}};_0x5f82cc(++_0x2bbcec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};};
\ No newline at end of file
index 7af1dfa..681b9d0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe83f=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0xd2e2ab,_0x2440cf){var _0x1703a2=function(_0x23deba){while(--_0x23deba){_0xd2e2ab['push'](_0xd2e2ab['shift']());}};_0x1703a2(++_0x2440cf);}(_0xe83f,0xce));var _0xfe83=function(_0x22095d,_0x235455){_0x22095d=_0x22095d-0x0;var _0x4c3ff5=_0xe83f[_0x22095d];return _0x4c3ff5;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x3eeeec){return function(){return client[_0xfe83('0x0')](_0xfe83('0x1'),{'options':{'where':{'VoiceQueueId':_0x3eeeec,'paused':!![]},'raw':!![]},'log':_0xfe83('0x2')});};};
\ No newline at end of file
+var _0x411a=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x408771,_0x4d657e){var _0x1b59bd=function(_0x1b4b56){while(--_0x1b4b56){_0x408771['push'](_0x408771['shift']());}};_0x1b59bd(++_0x4d657e);}(_0x411a,0xf3));var _0xa411=function(_0x479650,_0x2bee99){_0x479650=_0x479650-0x0;var _0x26b288=_0x411a[_0x479650];return _0x26b288;};'use strict';var client=require(_0xa411('0x0'));exports['getVoiceQueueRtPauses']=function(_0x7790a2){return function(){return client[_0xa411('0x1')](_0xa411('0x2'),{'options':{'where':{'VoiceQueueId':_0x7790a2,'paused':!![]},'raw':!![]},'log':_0xa411('0x3')});};};
\ No newline at end of file
index f32af05..fedfad8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x29015d,_0x38b088){var _0x16e896=function(_0x5b4617){while(--_0x5b4617){_0x29015d['push'](_0x29015d['shift']());}};_0x16e896(++_0x38b088);}(_0x7a54,0x106));var _0x47a5=function(_0x1a09d2,_0x2a3aa2){_0x1a09d2=_0x1a09d2-0x0;var _0x56fefb=_0x7a54[_0x1a09d2];return _0x56fefb;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});};
\ No newline at end of file
+var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x28c03a,_0xdc3a24){var _0x177602=function(_0x3b2525){while(--_0x3b2525){_0x28c03a['push'](_0x28c03a['shift']());}};_0x177602(++_0xdc3a24);}(_0x7a54,0x106));var _0x47a5=function(_0x2d8ee2,_0x3ac801){_0x2d8ee2=_0x2d8ee2-0x0;var _0x2071eb=_0x7a54[_0x2d8ee2];return _0x2071eb;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});};
\ No newline at end of file
index d593a9a..549848a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0567=['transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridnum'];(function(_0x56f1c4,_0x37fe7f){var _0xa30a8f=function(_0x5e38ab){while(--_0x5e38ab){_0x56f1c4['push'](_0x56f1c4['shift']());}};_0xa30a8f(++_0x37fe7f);}(_0x0567,0x185));var _0x7056=function(_0x54b2ba,_0x2bfc82){_0x54b2ba=_0x54b2ba-0x0;var _0x55538d=_0x0567[_0x54b2ba];return _0x55538d;};'use strict';var client=require(_0x7056('0x0'));exports[_0x7056('0x1')]={};exports[_0x7056('0x2')]=function(_0x4a03c2){return client[_0x7056('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x4a03c2[_0x7056('0x4')],'transfererchannel':_0x4a03c2[_0x7056('0x5')],'transferercalleridnum':_0x4a03c2[_0x7056('0x6')],'transferercalleridname':_0x4a03c2[_0x7056('0x7')],'transfererconnectedlinenum':_0x4a03c2[_0x7056('0x8')],'transfererconnectedlinename':_0x4a03c2['transfererconnectedlinename'],'transfereraccountcode':_0x4a03c2[_0x7056('0x9')],'transferercontext':_0x4a03c2[_0x7056('0xa')],'transfererexten':_0x4a03c2['transfererexten'],'transfererlinkedid':_0x4a03c2[_0x7056('0xb')],'transfereechannel':_0x4a03c2[_0x7056('0xc')],'transfereecalleridnum':_0x4a03c2[_0x7056('0xd')],'transfereecalleridname':_0x4a03c2['transfereecalleridname'],'transfereeconnectedlinenum':_0x4a03c2[_0x7056('0xe')],'transfereeconnectedlinename':_0x4a03c2[_0x7056('0xf')],'transfereeaccountcode':_0x4a03c2[_0x7056('0x10')],'transfereecontext':_0x4a03c2['transfereecontext'],'transfereeexten':_0x4a03c2[_0x7056('0x11')],'transfereelinkedid':_0x4a03c2[_0x7056('0x12')],'isexternal':_0x4a03c2[_0x7056('0x13')],'context':_0x4a03c2[_0x7056('0x14')],'extension':_0x4a03c2[_0x7056('0x15')],'type':_0x7056('0x16')},'log':_0x7056('0x17')});};exports[_0x7056('0x18')]=function(_0x25e354){return client[_0x7056('0x3')](_0x7056('0x17'),{'body':{'result':_0x25e354[_0x7056('0x4')],'transfererchannel':_0x25e354[_0x7056('0x19')],'transferercalleridnum':_0x25e354['origtransferercalleridnum'],'transferercalleridname':_0x25e354[_0x7056('0x1a')],'transfererconnectedlinenum':_0x25e354['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x25e354[_0x7056('0x1b')],'transfereraccountcode':_0x25e354['origtransfereraccountcode'],'transferercontext':_0x25e354['secondtransferercontext'],'transfererexten':_0x25e354['secondtransfererexten'],'transfererlinkedid':_0x25e354['origtransfererlinkedid'],'transfereechannel':_0x25e354[_0x7056('0x1c')],'transfereecalleridnum':_0x25e354[_0x7056('0x1d')],'transfereecalleridname':_0x25e354[_0x7056('0x1e')],'transfereeconnectedlinenum':_0x25e354['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x25e354['transfertargetconnectedlinename'],'transfereeaccountcode':_0x25e354['transfertargetaccountcode'],'transfereecontext':_0x25e354[_0x7056('0x1f')],'transfereeexten':_0x25e354[_0x7056('0x20')],'transfereelinkedid':_0x25e354[_0x7056('0x21')],'isexternal':_0x25e354[_0x7056('0x13')],'context':_0x25e354['origtransferercontext'],'extension':_0x25e354[_0x7056('0x22')],'type':_0x7056('0x23')},'log':_0x7056('0x17')});};
\ No newline at end of file
+var _0xcbc8=['transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinenum','transfererexten'];(function(_0x574507,_0x1a65ef){var _0x1b6c24=function(_0x11811e){while(--_0x11811e){_0x574507['push'](_0x574507['shift']());}};_0x1b6c24(++_0x1a65ef);}(_0xcbc8,0xc4));var _0x8cbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcbc8[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x8cbc('0x0'));exports['transfers']={};exports[_0x8cbc('0x1')]=function(_0x5d5872){return client[_0x8cbc('0x2')](_0x8cbc('0x3'),{'body':{'result':_0x5d5872[_0x8cbc('0x4')],'transfererchannel':_0x5d5872['transfererchannel'],'transferercalleridnum':_0x5d5872['transferercalleridnum'],'transferercalleridname':_0x5d5872[_0x8cbc('0x5')],'transfererconnectedlinenum':_0x5d5872[_0x8cbc('0x6')],'transfererconnectedlinename':_0x5d5872['transfererconnectedlinename'],'transfereraccountcode':_0x5d5872['transfereraccountcode'],'transferercontext':_0x5d5872['transferercontext'],'transfererexten':_0x5d5872[_0x8cbc('0x7')],'transfererlinkedid':_0x5d5872[_0x8cbc('0x8')],'transfereechannel':_0x5d5872[_0x8cbc('0x9')],'transfereecalleridnum':_0x5d5872[_0x8cbc('0xa')],'transfereecalleridname':_0x5d5872[_0x8cbc('0xb')],'transfereeconnectedlinenum':_0x5d5872['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x5d5872['transfereeconnectedlinename'],'transfereeaccountcode':_0x5d5872[_0x8cbc('0xc')],'transfereecontext':_0x5d5872[_0x8cbc('0xd')],'transfereeexten':_0x5d5872[_0x8cbc('0xe')],'transfereelinkedid':_0x5d5872[_0x8cbc('0xf')],'isexternal':_0x5d5872[_0x8cbc('0x10')],'context':_0x5d5872[_0x8cbc('0x11')],'extension':_0x5d5872[_0x8cbc('0x12')],'type':_0x8cbc('0x13')},'log':_0x8cbc('0x3')});};exports[_0x8cbc('0x14')]=function(_0x311f2e){return client[_0x8cbc('0x2')](_0x8cbc('0x3'),{'body':{'result':_0x311f2e[_0x8cbc('0x4')],'transfererchannel':_0x311f2e['origtransfererchannel'],'transferercalleridnum':_0x311f2e[_0x8cbc('0x15')],'transferercalleridname':_0x311f2e[_0x8cbc('0x16')],'transfererconnectedlinenum':_0x311f2e[_0x8cbc('0x17')],'transfererconnectedlinename':_0x311f2e[_0x8cbc('0x18')],'transfereraccountcode':_0x311f2e['origtransfereraccountcode'],'transferercontext':_0x311f2e['secondtransferercontext'],'transfererexten':_0x311f2e[_0x8cbc('0x19')],'transfererlinkedid':_0x311f2e[_0x8cbc('0x1a')],'transfereechannel':_0x311f2e['transfertargetchannel'],'transfereecalleridnum':_0x311f2e['transfertargetcalleridnum'],'transfereecalleridname':_0x311f2e['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x311f2e[_0x8cbc('0x1b')],'transfereeconnectedlinename':_0x311f2e[_0x8cbc('0x1c')],'transfereeaccountcode':_0x311f2e[_0x8cbc('0x1d')],'transfereecontext':_0x311f2e['transfertargetcontext'],'transfereeexten':_0x311f2e[_0x8cbc('0x1e')],'transfereelinkedid':_0x311f2e[_0x8cbc('0x1f')],'isexternal':_0x311f2e['isexternal'],'context':_0x311f2e[_0x8cbc('0x20')],'extension':_0x311f2e[_0x8cbc('0x21')],'type':'attended'},'log':_0x8cbc('0x3')});};
\ No newline at end of file
index 07e3e82..e33342d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f2f=['active','callerid','Interval','push','length','omit','values','channels','join','find','uniqueid','filename','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','voicechannel','validate','map','StopMixMonitor','destinationchannel','status','stop','wav','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','voicequeuechannelhangup','Redirect','exten','context','agents','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','../../../config/environment','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','pause','QueuePause','error','asterisk','username','ami\x20disconnected','pick','keys','module','action','Reload','Action','then','message','catch','isConnected','command','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk'];(function(_0x2baff4,_0x9e7e5){var _0x3bf2f7=function(_0x49ca6b){while(--_0x49ca6b){_0x2baff4['push'](_0x2baff4['shift']());}};_0x3bf2f7(++_0x9e7e5);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x6f2f[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var moment=require('moment');var config=require(_0xf6f2('0x2'));var properties=require('../properties');var ami=require('../ami');exports[_0xf6f2('0x3')]=function(_0x305bb,_0x18de32,_0x5ba2fb){return new Promise(function(_0x5c540a,_0x1123bb){var _0x1c94ad={'QueuePause':function(_0x26cd28){return new Promise(function(_0x774922){var _0x15a71c=util[_0xf6f2('0x4')](_0xf6f2('0x5'),_0xf6f2('0x6'),_0x26cd28[_0xf6f2('0x7')]);if(_0x305bb[_0xf6f2('0x8')]&&_0x305bb['timers'][_0x15a71c]&&_0x305bb[_0xf6f2('0x8')][_0x15a71c][_0xf6f2('0x9')]){_0x305bb[_0xf6f2('0x8')][_0x15a71c][_0xf6f2('0xa')]();}if(_0x305bb['agents'][_0x15a71c]){_0x305bb['agents'][_0x15a71c]['updateStatusRealtime']({'statePause':_0x26cd28[_0xf6f2('0xb')]?!![]:![]});}_0x774922({'code':0xc8,'message':_0xf6f2('0xc')});});},'Reload':function(_0x131a18){var _0x4afa2=this;return new Promise(function(_0x1626ce,_0x2ed4b5){if(ami['isConnected']()==![]){return _0x2ed4b5(_0x4afa2[_0xf6f2('0xd')](0x1f4,[config[_0xf6f2('0xe')]['ip'],config[_0xf6f2('0xe')][_0xf6f2('0xf')],_0xf6f2('0x10')]['join']('\x20')));}_0x131a18=_[_0xf6f2('0x11')](_0x131a18,_[_0xf6f2('0x12')](properties[_0xf6f2('0x13')]));_0x131a18[_0xf6f2('0x14')]=_0xf6f2('0x15');return ami[_0xf6f2('0x16')](_0x131a18)[_0xf6f2('0x17')](function(_0x4441f3){_0x1626ce({'code':0xc8,'message':_0x4441f3[_0xf6f2('0x18')]});})[_0xf6f2('0x19')](function(_0x400055){_0x2ed4b5(_0x4afa2[_0xf6f2('0xd')](0x1f5,_0x400055[_0xf6f2('0x18')]));});});},'Command':function(_0x1b11ea){var _0xb05611=this;return new Promise(function(_0x537b35,_0x4de8bd){if(ami[_0xf6f2('0x1a')]()==![]){return _0x4de8bd(_0xb05611['error'](0x1f4,[config[_0xf6f2('0xe')]['ip'],config[_0xf6f2('0xe')][_0xf6f2('0xf')],_0xf6f2('0x10')]['join']('\x20')));}_0x1b11ea=_[_0xf6f2('0x11')](_0x1b11ea,_0xf6f2('0x1b'));_0x1b11ea[_0xf6f2('0x14')]=_0xf6f2('0x1c');return ami['Action'](_0x1b11ea)[_0xf6f2('0x17')](function(_0x54cb23){_0x537b35({'code':0xc8,'message':_0x54cb23[_0xf6f2('0x1d')]});})['catch'](function(_0x1e33c){_0x4de8bd(_0xb05611[_0xf6f2('0xd')](0x1f5,_0x1e33c['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x196d4f){var _0x3e751a=[];for(var _0x3b0ed5 in _0x305bb[_0xf6f2('0x1e')]){if(_0x305bb[_0xf6f2('0x1e')][_0xf6f2('0x1f')](_0x3b0ed5)){var _0x3304ec=_0x305bb[_0xf6f2('0x1e')][_0x3b0ed5];var _0x5dac6a={'id':_0x3304ec['id'],'name':_0x3304ec[_0xf6f2('0x7')],'strategy':_0x3304ec[_0xf6f2('0x20')],'answered':_0x3304ec[_0xf6f2('0x21')],'available':_0x3304ec[_0xf6f2('0x22')],'loggedIn':_0x3304ec[_0xf6f2('0x23')],'pTalking':_0x3304ec[_0xf6f2('0x24')],'sumBillable':_0x3304ec[_0xf6f2('0x25')],'sumDuration':_0x3304ec[_0xf6f2('0x26')],'sumHoldTime':_0x3304ec[_0xf6f2('0x27')]||0x0,'talking':_0x3304ec[_0xf6f2('0x28')],'total':_0x3304ec[_0xf6f2('0x29')],'type':_0x3304ec['type'],'unmanaged':_0x3304ec[_0xf6f2('0x2a')],'abandoned':_0x3304ec[_0xf6f2('0x2b')],'waiting':_0x3304ec[_0xf6f2('0x2c')],'loggedInDb':_0x3304ec[_0xf6f2('0x2d')]};if(_0x3304ec[_0xf6f2('0x2e')]===_0xf6f2('0x2f')){_0x5dac6a[_0xf6f2('0x30')]=_0x3304ec[_0xf6f2('0x30')];_0x5dac6a[_0xf6f2('0x31')]=_0x3304ec[_0xf6f2('0x31')];_0x5dac6a[_0xf6f2('0x32')]=_0x3304ec[_0xf6f2('0x32')];_0x5dac6a['dialOriginateCallerIdNumber']=_0x3304ec[_0xf6f2('0x33')];_0x5dac6a[_0xf6f2('0x34')]=_0x3304ec[_0xf6f2('0x34')];_0x5dac6a[_0xf6f2('0x35')]=_0x3304ec[_0xf6f2('0x35')];_0x5dac6a[_0xf6f2('0x36')]=_0x3304ec[_0xf6f2('0x36')];_0x5dac6a[_0xf6f2('0x37')]=_0x3304ec[_0xf6f2('0x37')];_0x5dac6a[_0xf6f2('0x38')]=_0x3304ec[_0xf6f2('0x38')];_0x5dac6a[_0xf6f2('0x39')]=_0x3304ec[_0xf6f2('0x39')];_0x5dac6a['outboundBusyCallsDay']=_0x3304ec['outboundBusyCallsDay'];_0x5dac6a['outboundCongestionCallsDay']=_0x3304ec[_0xf6f2('0x3a')];_0x5dac6a[_0xf6f2('0x3b')]=_0x3304ec['outboundDropCallsDayACS'];_0x5dac6a['outboundDropCallsDayCallersExit']=_0x3304ec[_0xf6f2('0x3c')];_0x5dac6a[_0xf6f2('0x3d')]=_0x3304ec[_0xf6f2('0x3d')];_0x5dac6a[_0xf6f2('0x3e')]=_0x3304ec[_0xf6f2('0x3e')];_0x5dac6a[_0xf6f2('0x3f')]=_0x3304ec['outboundNoSuchCallsDay'];_0x5dac6a[_0xf6f2('0x40')]=_0x3304ec['outboundOriginateFailureCallsDay'];_0x5dac6a[_0xf6f2('0x41')]=_0x3304ec[_0xf6f2('0x41')];_0x5dac6a[_0xf6f2('0x42')]=_0x3304ec[_0xf6f2('0x42')];_0x5dac6a['outboundUnknownCallsDay']=_0x3304ec[_0xf6f2('0x43')];_0x5dac6a[_0xf6f2('0x44')]=_0x3304ec[_0xf6f2('0x44')];_0x5dac6a['predictiveIntervalAvgHoldtime']=_0x3304ec[_0xf6f2('0x45')];_0x5dac6a[_0xf6f2('0x46')]=_0x3304ec[_0xf6f2('0x46')];_0x5dac6a['predictiveIntervalDroppedCallsCallersExit']=_0x3304ec[_0xf6f2('0x47')];_0x5dac6a['predictiveIntervalDroppedCallsTimeout']=_0x3304ec[_0xf6f2('0x48')];_0x5dac6a[_0xf6f2('0x49')]=_0x3304ec[_0xf6f2('0x49')];_0x5dac6a['predictiveIntervalErlangCallsDroppedCalls']=_0x3304ec[_0xf6f2('0x4a')];_0x5dac6a[_0xf6f2('0x4b')]=_0x3304ec[_0xf6f2('0x4b')];_0x5dac6a[_0xf6f2('0x4c')]=_0x3304ec[_0xf6f2('0x4c')];_0x5dac6a['predictiveIntervalPauses']=_0x3304ec[_0xf6f2('0x4d')];_0x5dac6a[_0xf6f2('0x4e')]=_0x3304ec[_0xf6f2('0x4e')];_0x5dac6a[_0xf6f2('0x4f')]=_0x3304ec[_0xf6f2('0x4f')];_0x5dac6a[_0xf6f2('0x18')]=_0x3304ec[_0xf6f2('0x18')];_0x5dac6a['originated']=_0x3304ec[_0xf6f2('0x50')];_0x5dac6a[_0xf6f2('0x51')]=_0x3304ec[_0xf6f2('0x51')];_0x5dac6a['erlangCallToSecond']=_0x3304ec[_0xf6f2('0x52')];_0x5dac6a[_0xf6f2('0x53')]=_0x3304ec[_0xf6f2('0x53')];_0x5dac6a[_0xf6f2('0x54')]=_0x3304ec[_0xf6f2('0x54')];_0x5dac6a['startPredictive']=_0x3304ec[_0xf6f2('0x55')];_0x5dac6a[_0xf6f2('0x56')]=_0x3304ec[_0xf6f2('0x56')];}if(_0x3304ec[_0xf6f2('0x57')]){_0x5dac6a[_0xf6f2('0x57')]={'id':_0x3304ec['Trunk']['id'],'name':_0x3304ec[_0xf6f2('0x57')]['name'],'active':_0x3304ec[_0xf6f2('0x57')][_0xf6f2('0x58')],'callerid':_0x3304ec[_0xf6f2('0x57')][_0xf6f2('0x59')]};}if(_0x3304ec[_0xf6f2('0x5a')]){_0x5dac6a[_0xf6f2('0x5a')]={'id':_0x3304ec[_0xf6f2('0x5a')]['id'],'name':_0x3304ec[_0xf6f2('0x5a')][_0xf6f2('0x7')]};}_0x3e751a[_0xf6f2('0x5b')](_0x5dac6a);}}_0x196d4f({'count':_0x3e751a[_0xf6f2('0x5c')],'rows':_0x3e751a});});},'UpdateVoiceQueue':function(_0x4cddb3){return new Promise(function(_0x904241,_0x349a55){var _0x1f0c37=_['find'](_0x305bb['voiceQueues'],{'id':parseInt(_0x4cddb3['id'])});var _0x590f24=_[_0xf6f2('0x5d')](_0x4cddb3,['id']);if(_0x1f0c37){for(var _0x139eb3 in _0x590f24){if(typeof _0x590f24[_0x139eb3]!=='undefined'&&typeof _0x1f0c37[_0x139eb3]!=='undefined'){_0x1f0c37[_0x139eb3]=_0x590f24[_0x139eb3];}}_0x904241(_0x1f0c37);}else{_0x349a55();}});},'VoiceChannels':function(){return new Promise(function(_0x1021b4){var _0x119777=_[_0xf6f2('0x5e')](_0x305bb[_0xf6f2('0x5f')]);_0x1021b4({'count':_0x119777[_0xf6f2('0x5c')],'rows':_0x119777});});},'VoiceChannelMixMonitor':function(_0xd413d3){var _0x5e863e=this;return new Promise(function(_0x5b4737,_0x5daa2c){if(ami['isConnected']()==![]){return _0x5daa2c(_0x5e863e[_0xf6f2('0xd')](0x1f4,[config['asterisk']['ip'],config[_0xf6f2('0xe')][_0xf6f2('0xf')],_0xf6f2('0x10')][_0xf6f2('0x60')]('\x20')));}var _0x28da53=schema(properties['voicechannel'])['validate'](_0xd413d3);if(_0x28da53[_0xf6f2('0x5c')]>0x0){return _0x5daa2c(_0x5e863e['error'](0x1f4,_['map'](_0x28da53,_0xf6f2('0x18'))[_0xf6f2('0x60')](',\x20')));}var _0x16f341=_[_0xf6f2('0x61')](_0x305bb[_0xf6f2('0x5f')],{'uniqueid':_0xd413d3[_0xf6f2('0x62')]});if(_0x16f341&&_0x16f341['channel']){var _0x443277=util[_0xf6f2('0x4')]('%s.%s',_0xd413d3[_0xf6f2('0x63')]||_0xd413d3[_0xf6f2('0x62')],_0xd413d3[_0xf6f2('0x4')]||'wav');return ami[_0xf6f2('0x16')]({'action':_0xf6f2('0x64'),'channel':_0x16f341[_0xf6f2('0x65')],'file':_0x443277,'options':_0xf6f2('0x66')})[_0xf6f2('0x17')](function(_0x17531b){var _0x418db5=_[_0xf6f2('0x61')](_0x16f341[_0xf6f2('0x67')],{'filename':_0xf6f2('0x68')+_0x443277[_0xf6f2('0x69')]()});if(_['isNil'](_0x418db5)){_0x16f341[_0xf6f2('0x67')][_0xf6f2('0x5b')]({'filename':_0xf6f2('0x68')+_0x443277[_0xf6f2('0x69')](),'createdAt':moment()[_0xf6f2('0x4')](_0xf6f2('0x6a')),'mixmonitorid':_0x17531b[_0xf6f2('0x6b')],'status':_0xf6f2('0x6c')});}else{_0x418db5[_0xf6f2('0x6b')]=_0x17531b[_0xf6f2('0x6b')];_0x418db5['status']=_0xf6f2('0x6c');}_0x5b4737({'code':0xc8,'message':[_0xd413d3[_0xf6f2('0x62')],'MixMonitor\x20Success',_0x17531b[_0xf6f2('0x6b')]]['join']('\x20'),'mixmonitorid':_0x17531b['mixmonitorid']});})[_0xf6f2('0x19')](function(_0xa7e7a5){_0x5daa2c(_0x5e863e[_0xf6f2('0xd')](0x1f5,[_0xd413d3[_0xf6f2('0x62')],_0xa7e7a5[_0xf6f2('0x18')][_0xf6f2('0x69')]()][_0xf6f2('0x60')]('\x20')));});}else{return _0x5daa2c(_0x5e863e[_0xf6f2('0xd')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x24ce43){var _0x58d54b=this;return new Promise(function(_0x2efa18,_0x4bceba){if(ami[_0xf6f2('0x1a')]()==![]){return _0x4bceba(_0x58d54b[_0xf6f2('0xd')](0x1f4,[config[_0xf6f2('0xe')]['ip'],config[_0xf6f2('0xe')]['username'],_0xf6f2('0x10')][_0xf6f2('0x60')]('\x20')));}var _0x52d278=schema(properties[_0xf6f2('0x6d')])[_0xf6f2('0x6e')](_0x24ce43);if(_0x52d278['length']>0x0){return _0x4bceba(_0x58d54b[_0xf6f2('0xd')](0x1f4,_[_0xf6f2('0x6f')](_0x52d278,_0xf6f2('0x18'))[_0xf6f2('0x60')](',\x20')));}var _0x136109=_[_0xf6f2('0x61')](_0x305bb[_0xf6f2('0x5f')],{'uniqueid':_0x24ce43[_0xf6f2('0x62')]});if(_0x136109){return Promise['resolve']()[_0xf6f2('0x17')](function(){if(_0x136109[_0xf6f2('0x65')]){return ami['Action']({'action':_0xf6f2('0x70'),'channel':_0x136109['channel'],'mixmonitorid':_0x24ce43['mixmonitorid']})[_0xf6f2('0x19')](function(){});}})[_0xf6f2('0x17')](function(){if(_0x136109[_0xf6f2('0x71')]){return ami['Action']({'action':_0xf6f2('0x70'),'channel':_0x136109[_0xf6f2('0x71')],'mixmonitorid':_0x24ce43[_0xf6f2('0x6b')]})[_0xf6f2('0x19')](function(){});}})['then'](function(){var _0x4fa755=_[_0xf6f2('0x61')](_0x136109[_0xf6f2('0x67')],{'mixmonitorid':_0x24ce43[_0xf6f2('0x6b')]});if(_0x4fa755){_0x4fa755[_0xf6f2('0x72')]=_0xf6f2('0x73');}})[_0xf6f2('0x17')](function(){var _0x28da97=util[_0xf6f2('0x4')]('%s.%s',_0x24ce43[_0xf6f2('0x63')]||_0x24ce43['uniqueid'],_0x24ce43[_0xf6f2('0x4')]||_0xf6f2('0x74'));var _0x48144b=_[_0xf6f2('0x61')](_0x136109['monitors'],{'filename':_0xf6f2('0x68')+_0x28da97[_0xf6f2('0x69')]()});if(_0x48144b){_0x48144b['status']=_0xf6f2('0x73');}})[_0xf6f2('0x17')](function(){_0x2efa18({'code':0xc8,'message':[_0x24ce43[_0xf6f2('0x62')],_0xf6f2('0x75')][_0xf6f2('0x60')]('\x20')});})['catch'](function(_0x2875e9){_0x4bceba(_0x58d54b[_0xf6f2('0xd')](0x1f5,[_0x24ce43[_0xf6f2('0x62')],_0x2875e9[_0xf6f2('0x18')]['toLowerCase']()][_0xf6f2('0x60')]('\x20')));});}else{return _0x4bceba(_0x58d54b[_0xf6f2('0xd')](0x1f5,_0xf6f2('0x76')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x554126){var _0x55be67=_[_0xf6f2('0x5e')](_0x305bb[_0xf6f2('0x77')]);_0x554126({'count':_0x55be67[_0xf6f2('0x5c')],'rows':_0x55be67});});},'VoiceQueuesChannel':function(_0x526452){var _0xacbd57=this;return new Promise(function(_0x69ab02,_0x3341c4){var _0x5a2ad6=schema(properties[_0xf6f2('0x78')])[_0xf6f2('0x6e')](_0x526452);if(_0x5a2ad6[_0xf6f2('0x5c')]>0x0){return _0x3341c4(_0xacbd57[_0xf6f2('0xd')](0x1f4,_['map'](_0x5a2ad6,_0xf6f2('0x18'))[_0xf6f2('0x60')](',\x20')));}var _0x48bfa8=_[_0xf6f2('0x61')](_0x305bb[_0xf6f2('0x77')],{'uniqueid':_0x526452[_0xf6f2('0x62')]});if(_0x48bfa8){_0x69ab02(_0x48bfa8);}else{return _0x3341c4(_0xacbd57['error'](0x1f5,_0xf6f2('0x76')));}});},'VoiceQueuesChannelHangup':function(_0x16c2da){var _0x3c2151=this;return new Promise(function(_0x366a72,_0x1a7187){if(ami[_0xf6f2('0x1a')]()==![]){return _0x1a7187(_0x3c2151[_0xf6f2('0xd')](0x1f4,[config[_0xf6f2('0xe')]['ip'],config[_0xf6f2('0xe')][_0xf6f2('0xf')],_0xf6f2('0x10')][_0xf6f2('0x60')]('\x20')));}var _0xfe7e86=schema(properties[_0xf6f2('0x79')])[_0xf6f2('0x6e')](_0x16c2da);if(_0xfe7e86[_0xf6f2('0x5c')]>0x0){return _0x1a7187(_0x3c2151[_0xf6f2('0xd')](0x1f4,_[_0xf6f2('0x6f')](_0xfe7e86,_0xf6f2('0x18'))[_0xf6f2('0x60')](',\x20')));}var _0x1ca182=_[_0xf6f2('0x61')](_0x305bb['queueChannels'],{'uniqueid':_0x16c2da[_0xf6f2('0x62')]});if(_0x1ca182&&_0x1ca182[_0xf6f2('0x65')]){return ami[_0xf6f2('0x16')]({'action':'Hangup','channel':_0x1ca182['channel']})['then'](function(_0x9a46b8){_0x366a72({'code':0xc8,'message':[_0x16c2da[_0xf6f2('0x62')],_0x9a46b8[_0xf6f2('0x18')][_0xf6f2('0x69')]()][_0xf6f2('0x60')]('\x20')});})[_0xf6f2('0x19')](function(_0x9529f8){_0x1a7187(_0x3c2151[_0xf6f2('0xd')](0x1f5,[_0x16c2da[_0xf6f2('0x62')],_0x9529f8[_0xf6f2('0x18')][_0xf6f2('0x69')]()]['join']('\x20')));});}else{return _0x1a7187(_0x3c2151[_0xf6f2('0xd')](0x1f5,_0xf6f2('0x76')));}});},'VoiceQueuesChannelRedirect':function(_0x154c67){var _0x1bca27=this;return new Promise(function(_0x2546da,_0x59d615){if(ami['isConnected']()==![]){return _0x59d615(_0x1bca27[_0xf6f2('0xd')](0x1f4,[config[_0xf6f2('0xe')]['ip'],config['asterisk'][_0xf6f2('0xf')],_0xf6f2('0x10')][_0xf6f2('0x60')]('\x20')));}var _0x53163a=schema(properties['voicequeuechannelredirect'])[_0xf6f2('0x6e')](_0x154c67);if(_0x53163a[_0xf6f2('0x5c')]>0x0){return _0x59d615(_0x1bca27[_0xf6f2('0xd')](0x1f4,_['map'](_0x53163a,_0xf6f2('0x18'))[_0xf6f2('0x60')](',\x20')));}var _0x1154ed=_[_0xf6f2('0x61')](_0x305bb['queueChannels'],{'uniqueid':_0x154c67[_0xf6f2('0x62')]});if(_0x1154ed&&_0x1154ed[_0xf6f2('0x65')]){return ami['Action']({'action':_0xf6f2('0x7a'),'channel':_0x1154ed[_0xf6f2('0x65')],'exten':_0x154c67[_0xf6f2('0x7b')],'context':_0x154c67[_0xf6f2('0x7c')]||_0x1154ed[_0xf6f2('0x7c')],'priority':0x1})[_0xf6f2('0x17')](function(_0x502f45){_0x2546da({'code':0xc8,'message':[_0x154c67[_0xf6f2('0x62')],_0x502f45[_0xf6f2('0x18')][_0xf6f2('0x69')]()][_0xf6f2('0x60')]('\x20')});})[_0xf6f2('0x19')](function(_0x4f6066){_0x59d615(_0x1bca27[_0xf6f2('0xd')](0x1f5,[_0x154c67[_0xf6f2('0x62')],_0x4f6066[_0xf6f2('0x18')][_0xf6f2('0x69')]()][_0xf6f2('0x60')]('\x20')));});}else{return _0x59d615(_0x1bca27[_0xf6f2('0xd')](0x1f5,_0xf6f2('0x76')));}});},'Agents':function(_0x6ae32e){return new Promise(function(_0x5a80f0){var _0x52252b=_['values'](_0x305bb[_0xf6f2('0x7d')]);if(_0x6ae32e&&_0x6ae32e['id']){var _0x170c4a=_['find'](_0x52252b,function(_0xd54d4c){return _0xd54d4c['id']===_0x6ae32e['id'];});_0x5a80f0(_0x170c4a);}else{_0x5a80f0({'count':_0x52252b[_0xf6f2('0x5c')],'rows':_0x52252b});}});},'Telephones':function(){return new Promise(function(_0x248e4c){var _0x335614=_[_0xf6f2('0x5e')](_0x305bb[_0xf6f2('0x7e')]);_0x248e4c({'count':_0x335614[_0xf6f2('0x5c')],'rows':_0x335614});});},'Trunks':function(){return new Promise(function(_0x1519a2){var _0x4b5450=_['values'](_0x305bb[_0xf6f2('0x7f')]);_0x1519a2({'count':_0x4b5450[_0xf6f2('0x5c')],'rows':_0x4b5450});});},'OutboundChannels':function(){return new Promise(function(_0x2b066a){var _0x526de5=_[_0xf6f2('0x5e')](_0x305bb[_0xf6f2('0x80')]);_0x2b066a({'count':_0x526de5[_0xf6f2('0x5c')],'rows':_0x526de5});});},'Outbound':function(){return new Promise(function(_0x4d3d45){_0x4d3d45(_0x305bb[_0xf6f2('0x2f')]);});},'Campaigns':function(){return new Promise(function(_0x2bed16){var _0x57db72=_['values'](_0x305bb[_0xf6f2('0x81')]);_0x2bed16({'count':_0x57db72['length'],'rows':_0x57db72});});},'VoiceQueuesPreview':function(_0x11f4c0){var _0x2592d3=this;return new Promise(function(_0xc84042,_0x514576){_0x18de32[_0xf6f2('0x82')](_0x11f4c0['id'])[_0xf6f2('0x17')](function(_0x610f95){_0xc84042({'code':0xc8,'message':_0x610f95[_0xf6f2('0x18')]});})[_0xf6f2('0x19')](function(_0x352cc2){_0x514576(_0x2592d3[_0xf6f2('0xd')](0x1f4,_0x352cc2[_0xf6f2('0x18')]));});});},'EventManager':function(_0x2c4c53){var _0x4e34d4=this;return new Promise(function(_0x1deeec,_0x3c5925){if(!_0x2c4c53['event']){return _0x3c5925(_0x4e34d4[_0xf6f2('0xd')](0x1f4,_0xf6f2('0x83')));}ami[_0xf6f2('0x84')](_0xf6f2('0x85')+_0x2c4c53[_0xf6f2('0x86')],_0x2c4c53['message']);_0x1deeec({'code':0xc8,'message':_0x2c4c53});});},'FaxAccounts':function(){return new Promise(function(_0x4aa904){var _0x5efe32=_[_0xf6f2('0x5e')](_0x305bb['faxAccounts']);_0x4aa904({'count':_0x5efe32['length'],'rows':_0x5efe32});});},'SendFax':function(_0x5638bc){var _0x27daa2=this;return new Promise(function(_0x551869,_0x294ff6){_0x5ba2fb['send'](_0x5638bc)[_0xf6f2('0x17')](function(_0xbba734){_0x551869({'code':0xc8,'message':_0xbba734[_0xf6f2('0x18')]});})['catch'](function(_0x12fdbb){_0x294ff6(_0x27daa2[_0xf6f2('0xd')](0x1f4,_0x12fdbb[_0xf6f2('0x18')]));});});},'CheckAfterSend':function(_0x347442){var _0x58e1a8=this;return new Promise(function(_0x8ddfd4,_0x58539f){_0x5ba2fb['checkAfterSend'](_0x347442)['then'](function(_0x56cdfd){_0x8ddfd4({'code':0xc8,'message':_0x56cdfd['message']});})[_0xf6f2('0x19')](function(_0x237bd4){_0x58539f(_0x58e1a8[_0xf6f2('0xd')](0x1f4,_0x237bd4['message']));});});}};var _0x23925a=jayson['server'](_0x1c94ad)[_0xf6f2('0x87')]();_0x23925a['on'](_0xf6f2('0xd'),function(_0x4a692a){return _0x1123bb(_0x4a692a);});_0x23925a[_0xf6f2('0x3')](0x232a,_0xf6f2('0x88'),function(){console['log'](_0xf6f2('0x89'),0x232a);return _0x5c540a(_0xf6f2('0x8a')+0x232a);});});};
\ No newline at end of file
+var _0x9fe7=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','find','omit','values','channels','uniqueid','channel','%s.%s','filename','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','voicechannel','resolve','Action','StopMixMonitor','stop','wav','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicequeuechannel','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','outbound','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','validate','moment','../../../config/environment','../properties','listen','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','ami\x20disconnected','join','keys','module','action','Reload','then','message','catch','isConnected','pick','command','Command','voiceQueues','strategy','answered','available','sumBillable','sumHoldTime','abandoned','waiting','type','dialActive','dialMethod','dialOriginateCallerIdName'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9fe7,0x1df));var _0x79fe=function(_0x52ceba,_0x1d3cb6){_0x52ceba=_0x52ceba-0x0;var _0x4112a2=_0x9fe7[_0x52ceba];return _0x4112a2;};'use strict';var _=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var jayson=require('jayson/promise');var schema=require(_0x79fe('0x2'));var BPromise=require('bluebird');var moment=require(_0x79fe('0x3'));var config=require(_0x79fe('0x4'));var properties=require(_0x79fe('0x5'));var ami=require('../ami');exports[_0x79fe('0x6')]=function(_0x627ec4,_0x14e975,_0x4af9f6){return new BPromise(function(_0x3cec9c,_0x2a5aef){var _0x2ba246={'QueuePause':function(_0x4c8314){return new Promise(function(_0x24faa0,_0x264323){var _0x29b317=util[_0x79fe('0x7')](_0x79fe('0x8'),'SIP',_0x4c8314[_0x79fe('0x9')]);if(_0x627ec4[_0x79fe('0xa')]&&_0x627ec4['timers'][_0x29b317]&&_0x627ec4[_0x79fe('0xa')][_0x29b317][_0x79fe('0xb')]){_0x627ec4[_0x79fe('0xa')][_0x29b317][_0x79fe('0xc')]();}if(_0x627ec4['agents'][_0x29b317]){_0x627ec4[_0x79fe('0xd')][_0x29b317][_0x79fe('0xe')]({'statePause':_0x4c8314[_0x79fe('0xf')]?!![]:![]});}_0x24faa0({'code':0xc8,'message':_0x79fe('0x10')});});},'Reload':function(_0x1a83f2){var _0x260734=this;return new Promise(function(_0x42bbe4,_0x1abd7f){if(ami['isConnected']()==![]){return _0x1abd7f(_0x260734[_0x79fe('0x11')](0x1f4,[config[_0x79fe('0x12')]['ip'],config[_0x79fe('0x12')][_0x79fe('0x13')],_0x79fe('0x14')][_0x79fe('0x15')]('\x20')));}_0x1a83f2=_['pick'](_0x1a83f2,_[_0x79fe('0x16')](properties[_0x79fe('0x17')]));_0x1a83f2[_0x79fe('0x18')]=_0x79fe('0x19');return ami['Action'](_0x1a83f2)[_0x79fe('0x1a')](function(_0x16f93a){_0x42bbe4({'code':0xc8,'message':_0x16f93a[_0x79fe('0x1b')]});})[_0x79fe('0x1c')](function(_0x536641){_0x1abd7f(_0x260734['error'](0x1f5,_0x536641[_0x79fe('0x1b')]));});});},'Command':function(_0x1a1224){var _0x25e51f=this;return new Promise(function(_0x4bca4d,_0x891611){if(ami[_0x79fe('0x1d')]()==![]){return _0x891611(_0x25e51f[_0x79fe('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x79fe('0x12')]['username'],_0x79fe('0x14')][_0x79fe('0x15')]('\x20')));}_0x1a1224=_[_0x79fe('0x1e')](_0x1a1224,_0x79fe('0x1f'));_0x1a1224[_0x79fe('0x18')]=_0x79fe('0x20');return ami['Action'](_0x1a1224)['then'](function(_0x107641){_0x4bca4d({'code':0xc8,'message':_0x107641['content']});})[_0x79fe('0x1c')](function(_0x3721bc){_0x891611(_0x25e51f['error'](0x1f5,_0x3721bc['message']));});});},'VoiceQueues':function(_0x454e93){return new Promise(function(_0x321778,_0x59339b){var _0x46d93d=[];for(var _0x1c1f74 in _0x627ec4['voiceQueues']){if(_0x627ec4['voiceQueues']['hasOwnProperty'](_0x1c1f74)){var _0x3720fa=_0x627ec4[_0x79fe('0x21')][_0x1c1f74];var _0x36ead5={'id':_0x3720fa['id'],'name':_0x3720fa['name'],'strategy':_0x3720fa[_0x79fe('0x22')],'answered':_0x3720fa[_0x79fe('0x23')],'available':_0x3720fa[_0x79fe('0x24')],'loggedIn':_0x3720fa['loggedIn'],'pTalking':_0x3720fa['pTalking'],'sumBillable':_0x3720fa[_0x79fe('0x25')],'sumDuration':_0x3720fa['sumDuration'],'sumHoldTime':_0x3720fa[_0x79fe('0x26')]||0x0,'talking':_0x3720fa['talking'],'total':_0x3720fa['total'],'type':_0x3720fa['type'],'unmanaged':_0x3720fa['unmanaged'],'abandoned':_0x3720fa[_0x79fe('0x27')],'waiting':_0x3720fa[_0x79fe('0x28')],'loggedInDb':_0x3720fa['loggedInDb']};if(_0x3720fa[_0x79fe('0x29')]==='outbound'){_0x36ead5[_0x79fe('0x2a')]=_0x3720fa[_0x79fe('0x2a')];_0x36ead5[_0x79fe('0x2b')]=_0x3720fa[_0x79fe('0x2b')];_0x36ead5[_0x79fe('0x2c')]=_0x3720fa['dialOriginateCallerIdName'];_0x36ead5[_0x79fe('0x2d')]=_0x3720fa[_0x79fe('0x2d')];_0x36ead5[_0x79fe('0x2e')]=_0x3720fa[_0x79fe('0x2e')];_0x36ead5[_0x79fe('0x2f')]=_0x3720fa[_0x79fe('0x2f')];_0x36ead5['temp']=_0x3720fa[_0x79fe('0x30')];_0x36ead5[_0x79fe('0x31')]=_0x3720fa[_0x79fe('0x31')];_0x36ead5[_0x79fe('0x32')]=_0x3720fa[_0x79fe('0x32')];_0x36ead5[_0x79fe('0x33')]=_0x3720fa['outboundBlacklistCallsDay'];_0x36ead5[_0x79fe('0x34')]=_0x3720fa['outboundBusyCallsDay'];_0x36ead5[_0x79fe('0x35')]=_0x3720fa['outboundCongestionCallsDay'];_0x36ead5[_0x79fe('0x36')]=_0x3720fa['outboundDropCallsDayACS'];_0x36ead5[_0x79fe('0x37')]=_0x3720fa[_0x79fe('0x37')];_0x36ead5[_0x79fe('0x38')]=_0x3720fa['outboundDropCallsDayTimeout'];_0x36ead5[_0x79fe('0x39')]=_0x3720fa[_0x79fe('0x39')];_0x36ead5[_0x79fe('0x3a')]=_0x3720fa[_0x79fe('0x3a')];_0x36ead5[_0x79fe('0x3b')]=_0x3720fa['outboundOriginateFailureCallsDay'];_0x36ead5['outboundReCallsDay']=_0x3720fa[_0x79fe('0x3c')];_0x36ead5['outboundRejectCallsDay']=_0x3720fa[_0x79fe('0x3d')];_0x36ead5[_0x79fe('0x3e')]=_0x3720fa['outboundUnknownCallsDay'];_0x36ead5[_0x79fe('0x3f')]=_0x3720fa[_0x79fe('0x3f')];_0x36ead5[_0x79fe('0x40')]=_0x3720fa[_0x79fe('0x40')];_0x36ead5[_0x79fe('0x41')]=_0x3720fa[_0x79fe('0x41')];_0x36ead5['predictiveIntervalDroppedCallsCallersExit']=_0x3720fa[_0x79fe('0x42')];_0x36ead5[_0x79fe('0x43')]=_0x3720fa[_0x79fe('0x43')];_0x36ead5[_0x79fe('0x44')]=_0x3720fa['predictiveIntervalErlangCalls'];_0x36ead5[_0x79fe('0x45')]=_0x3720fa['predictiveIntervalErlangCallsDroppedCalls'];_0x36ead5[_0x79fe('0x46')]=_0x3720fa['predictiveIntervalHitRate'];_0x36ead5[_0x79fe('0x47')]=_0x3720fa['predictiveIntervalMultiplicativeFactor'];_0x36ead5[_0x79fe('0x48')]=_0x3720fa[_0x79fe('0x48')];_0x36ead5['predictiveIntervalAvailable']=_0x3720fa['predictiveIntervalAvailable'];_0x36ead5[_0x79fe('0x49')]=_0x3720fa[_0x79fe('0x49')];_0x36ead5[_0x79fe('0x1b')]=_0x3720fa[_0x79fe('0x1b')];_0x36ead5['originated']=_0x3720fa['originated'];_0x36ead5[_0x79fe('0x4a')]=_0x3720fa[_0x79fe('0x4a')];_0x36ead5[_0x79fe('0x4b')]=_0x3720fa[_0x79fe('0x4b')];_0x36ead5[_0x79fe('0x4c')]=_0x3720fa[_0x79fe('0x4c')];_0x36ead5[_0x79fe('0x4d')]=_0x3720fa[_0x79fe('0x4d')];_0x36ead5['startPredictive']=_0x3720fa[_0x79fe('0x4e')];_0x36ead5[_0x79fe('0x4f')]=_0x3720fa[_0x79fe('0x4f')];}if(_0x3720fa[_0x79fe('0x50')]){_0x36ead5[_0x79fe('0x50')]={'id':_0x3720fa[_0x79fe('0x50')]['id'],'name':_0x3720fa['Trunk'][_0x79fe('0x9')],'active':_0x3720fa[_0x79fe('0x50')][_0x79fe('0x51')],'callerid':_0x3720fa[_0x79fe('0x50')][_0x79fe('0x52')]};}if(_0x3720fa[_0x79fe('0x53')]){_0x36ead5['Interval']={'id':_0x3720fa[_0x79fe('0x53')]['id'],'name':_0x3720fa[_0x79fe('0x53')][_0x79fe('0x9')]};}_0x46d93d['push'](_0x36ead5);}}_0x321778({'count':_0x46d93d[_0x79fe('0x54')],'rows':_0x46d93d});});},'UpdateVoiceQueue':function(_0x563b71){return new Promise(function(_0x569c78,_0x28068f){var _0x379272=_[_0x79fe('0x55')](_0x627ec4['voiceQueues'],{'id':parseInt(_0x563b71['id'])});var _0x2aebbc=_[_0x79fe('0x56')](_0x563b71,['id']);if(_0x379272){for(var _0x42c5af in _0x2aebbc){if(typeof _0x2aebbc[_0x42c5af]!=='undefined'&&typeof _0x379272[_0x42c5af]!=='undefined'){_0x379272[_0x42c5af]=_0x2aebbc[_0x42c5af];}}_0x569c78(_0x379272);}else{_0x28068f();}});},'VoiceChannels':function(_0x4b904d){return new Promise(function(_0x205d67,_0x1594ce){var _0xd5de03=_[_0x79fe('0x57')](_0x627ec4[_0x79fe('0x58')]);_0x205d67({'count':_0xd5de03[_0x79fe('0x54')],'rows':_0xd5de03});});},'VoiceChannelMixMonitor':function(_0x23f270){var _0x2b46ad=this;return new Promise(function(_0x5a1779,_0x41f153){if(ami[_0x79fe('0x1d')]()==![]){return _0x41f153(_0x2b46ad['error'](0x1f4,[config[_0x79fe('0x12')]['ip'],config['asterisk'][_0x79fe('0x13')],_0x79fe('0x14')][_0x79fe('0x15')]('\x20')));}var _0x1761d7=schema(properties['voicechannel'])[_0x79fe('0x2')](_0x23f270);if(_0x1761d7[_0x79fe('0x54')]>0x0){return _0x41f153(_0x2b46ad[_0x79fe('0x11')](0x1f4,_['map'](_0x1761d7,'message')[_0x79fe('0x15')](',\x20')));}var _0x1ce058=_['find'](_0x627ec4[_0x79fe('0x58')],{'uniqueid':_0x23f270[_0x79fe('0x59')]});if(_0x1ce058&&_0x1ce058[_0x79fe('0x5a')]){var _0xeb0195=util['format'](_0x79fe('0x5b'),_0x23f270[_0x79fe('0x5c')]||_0x23f270[_0x79fe('0x59')],_0x23f270['format']||'wav');return ami['Action']({'action':'MixMonitor','channel':_0x1ce058['channel'],'file':_0xeb0195,'options':_0x79fe('0x5d')})[_0x79fe('0x1a')](function(_0x4f0ca8){var _0x1ccd76=_[_0x79fe('0x55')](_0x1ce058[_0x79fe('0x5e')],{'filename':'/var/spool/asterisk/monitor/'+_0xeb0195['toLowerCase']()});if(_['isNil'](_0x1ccd76)){_0x1ce058[_0x79fe('0x5e')]['push']({'filename':_0x79fe('0x5f')+_0xeb0195[_0x79fe('0x60')](),'createdAt':moment()[_0x79fe('0x7')](_0x79fe('0x61')),'mixmonitorid':_0x4f0ca8[_0x79fe('0x62')],'status':_0x79fe('0x63')});}else{_0x1ccd76[_0x79fe('0x62')]=_0x4f0ca8[_0x79fe('0x62')];_0x1ccd76[_0x79fe('0x64')]=_0x79fe('0x63');}_0x5a1779({'code':0xc8,'message':[_0x23f270[_0x79fe('0x59')],'MixMonitor\x20Success',_0x4f0ca8[_0x79fe('0x62')]][_0x79fe('0x15')]('\x20'),'mixmonitorid':_0x4f0ca8['mixmonitorid']});})[_0x79fe('0x1c')](function(_0x5eca77){_0x41f153(_0x2b46ad[_0x79fe('0x11')](0x1f5,[_0x23f270[_0x79fe('0x59')],_0x5eca77['message'][_0x79fe('0x60')]()]['join']('\x20')));});}else{return _0x41f153(_0x2b46ad[_0x79fe('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x5ef724){var _0x492ac1=this;return new Promise(function(_0x9728b9,_0x272272){if(ami[_0x79fe('0x1d')]()==![]){return _0x272272(_0x492ac1[_0x79fe('0x11')](0x1f4,[config[_0x79fe('0x12')]['ip'],config[_0x79fe('0x12')][_0x79fe('0x13')],_0x79fe('0x14')][_0x79fe('0x15')]('\x20')));}var _0x562f29=schema(properties[_0x79fe('0x65')])[_0x79fe('0x2')](_0x5ef724);if(_0x562f29[_0x79fe('0x54')]>0x0){return _0x272272(_0x492ac1[_0x79fe('0x11')](0x1f4,_['map'](_0x562f29,_0x79fe('0x1b'))['join'](',\x20')));}var _0x24da87=_['find'](_0x627ec4[_0x79fe('0x58')],{'uniqueid':_0x5ef724[_0x79fe('0x59')]});if(_0x24da87){return BPromise[_0x79fe('0x66')]()[_0x79fe('0x1a')](function(){if(_0x24da87['channel']){return ami[_0x79fe('0x67')]({'action':_0x79fe('0x68'),'channel':_0x24da87[_0x79fe('0x5a')],'mixmonitorid':_0x5ef724[_0x79fe('0x62')]})['catch'](function(_0x9e880c){});}})[_0x79fe('0x1a')](function(){if(_0x24da87['destinationchannel']){return ami[_0x79fe('0x67')]({'action':'StopMixMonitor','channel':_0x24da87['destinationchannel'],'mixmonitorid':_0x5ef724[_0x79fe('0x62')]})[_0x79fe('0x1c')](function(_0x60161c){});}})['then'](function(_0x58adb7){var _0x21fda0=_['find'](_0x24da87['monitors'],{'mixmonitorid':_0x5ef724[_0x79fe('0x62')]});if(_0x21fda0){_0x21fda0[_0x79fe('0x64')]=_0x79fe('0x69');}})[_0x79fe('0x1a')](function(){var _0x54b3fb=util[_0x79fe('0x7')](_0x79fe('0x5b'),_0x5ef724[_0x79fe('0x5c')]||_0x5ef724[_0x79fe('0x59')],_0x5ef724['format']||_0x79fe('0x6a'));var _0x36e157=_['find'](_0x24da87[_0x79fe('0x5e')],{'filename':_0x79fe('0x5f')+_0x54b3fb[_0x79fe('0x60')]()});if(_0x36e157){_0x36e157[_0x79fe('0x64')]=_0x79fe('0x69');}})[_0x79fe('0x1a')](function(){_0x9728b9({'code':0xc8,'message':[_0x5ef724[_0x79fe('0x59')],_0x79fe('0x6b')][_0x79fe('0x15')]('\x20')});})[_0x79fe('0x1c')](function(_0x35ea01){_0x272272(_0x492ac1['error'](0x1f5,[_0x5ef724[_0x79fe('0x59')],_0x35ea01[_0x79fe('0x1b')][_0x79fe('0x60')]()][_0x79fe('0x15')]('\x20')));});}else{return _0x272272(_0x492ac1[_0x79fe('0x11')](0x1f5,_0x79fe('0x6c')));}});},'VoiceQueuesChannels':function(_0x177777){return new Promise(function(_0x492d92,_0xdf3368){var _0x238d57=_[_0x79fe('0x57')](_0x627ec4['queueChannels']);_0x492d92({'count':_0x238d57['length'],'rows':_0x238d57});});},'VoiceQueuesChannel':function(_0x5e7a6e){var _0x4cec0c=this;return new Promise(function(_0x16525f,_0x485b00){var _0x31440b=schema(properties[_0x79fe('0x6d')])[_0x79fe('0x2')](_0x5e7a6e);if(_0x31440b[_0x79fe('0x54')]>0x0){return _0x485b00(_0x4cec0c[_0x79fe('0x11')](0x1f4,_['map'](_0x31440b,_0x79fe('0x1b'))['join'](',\x20')));}var _0x234f4d=_[_0x79fe('0x55')](_0x627ec4[_0x79fe('0x6e')],{'uniqueid':_0x5e7a6e[_0x79fe('0x59')]});if(_0x234f4d){_0x16525f(_0x234f4d);}else{return _0x485b00(_0x4cec0c[_0x79fe('0x11')](0x1f5,_0x79fe('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x467f5b){var _0x54bd13=this;return new Promise(function(_0x24d539,_0x50c361){if(ami[_0x79fe('0x1d')]()==![]){return _0x50c361(_0x54bd13[_0x79fe('0x11')](0x1f4,[config[_0x79fe('0x12')]['ip'],config['asterisk'][_0x79fe('0x13')],_0x79fe('0x14')][_0x79fe('0x15')]('\x20')));}var _0x46f42a=schema(properties['voicequeuechannelhangup'])[_0x79fe('0x2')](_0x467f5b);if(_0x46f42a[_0x79fe('0x54')]>0x0){return _0x50c361(_0x54bd13[_0x79fe('0x11')](0x1f4,_['map'](_0x46f42a,_0x79fe('0x1b'))[_0x79fe('0x15')](',\x20')));}var _0x3db2ed=_[_0x79fe('0x55')](_0x627ec4[_0x79fe('0x6e')],{'uniqueid':_0x467f5b[_0x79fe('0x59')]});if(_0x3db2ed&&_0x3db2ed[_0x79fe('0x5a')]){return ami[_0x79fe('0x67')]({'action':_0x79fe('0x6f'),'channel':_0x3db2ed['channel']})[_0x79fe('0x1a')](function(_0x5122c8){_0x24d539({'code':0xc8,'message':[_0x467f5b[_0x79fe('0x59')],_0x5122c8[_0x79fe('0x1b')][_0x79fe('0x60')]()][_0x79fe('0x15')]('\x20')});})[_0x79fe('0x1c')](function(_0x5d6035){_0x50c361(_0x54bd13[_0x79fe('0x11')](0x1f5,[_0x467f5b['uniqueid'],_0x5d6035[_0x79fe('0x1b')][_0x79fe('0x60')]()]['join']('\x20')));});}else{return _0x50c361(_0x54bd13[_0x79fe('0x11')](0x1f5,_0x79fe('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x18262c){var _0x256035=this;return new Promise(function(_0x1b370f,_0x5490ff){if(ami[_0x79fe('0x1d')]()==![]){return _0x5490ff(_0x256035[_0x79fe('0x11')](0x1f4,[config[_0x79fe('0x12')]['ip'],config[_0x79fe('0x12')][_0x79fe('0x13')],_0x79fe('0x14')][_0x79fe('0x15')]('\x20')));}var _0x24c6ad=schema(properties[_0x79fe('0x70')])[_0x79fe('0x2')](_0x18262c);if(_0x24c6ad['length']>0x0){return _0x5490ff(_0x256035[_0x79fe('0x11')](0x1f4,_['map'](_0x24c6ad,_0x79fe('0x1b'))['join'](',\x20')));}var _0x38cb89=_[_0x79fe('0x55')](_0x627ec4[_0x79fe('0x6e')],{'uniqueid':_0x18262c[_0x79fe('0x59')]});if(_0x38cb89&&_0x38cb89[_0x79fe('0x5a')]){return ami['Action']({'action':_0x79fe('0x71'),'channel':_0x38cb89[_0x79fe('0x5a')],'exten':_0x18262c[_0x79fe('0x72')],'context':_0x18262c[_0x79fe('0x73')]||_0x38cb89['context'],'priority':0x1})[_0x79fe('0x1a')](function(_0x4c25b1){_0x1b370f({'code':0xc8,'message':[_0x18262c[_0x79fe('0x59')],_0x4c25b1[_0x79fe('0x1b')][_0x79fe('0x60')]()][_0x79fe('0x15')]('\x20')});})[_0x79fe('0x1c')](function(_0x55e65a){_0x5490ff(_0x256035[_0x79fe('0x11')](0x1f5,[_0x18262c['uniqueid'],_0x55e65a[_0x79fe('0x1b')][_0x79fe('0x60')]()]['join']('\x20')));});}else{return _0x5490ff(_0x256035[_0x79fe('0x11')](0x1f5,_0x79fe('0x6c')));}});},'Agents':function(_0x19c444){return new Promise(function(_0x3aa36b,_0x40392a){var _0x41bb50=_['values'](_0x627ec4['agents']);_0x3aa36b({'count':_0x41bb50[_0x79fe('0x54')],'rows':_0x41bb50});});},'Telephones':function(_0x141661){return new Promise(function(_0x1034a5,_0x550501){var _0xfde41e=_[_0x79fe('0x57')](_0x627ec4[_0x79fe('0x74')]);_0x1034a5({'count':_0xfde41e[_0x79fe('0x54')],'rows':_0xfde41e});});},'Trunks':function(_0x285e73){return new Promise(function(_0x4ccda7,_0x3fbb0e){var _0xfb2ee6=_[_0x79fe('0x57')](_0x627ec4['trunks']);_0x4ccda7({'count':_0xfb2ee6[_0x79fe('0x54')],'rows':_0xfb2ee6});});},'OutboundChannels':function(_0x187a5a){return new Promise(function(_0x3362a6,_0x175ee6){var _0x5c00c6=_[_0x79fe('0x57')](_0x627ec4[_0x79fe('0x75')]);_0x3362a6({'count':_0x5c00c6['length'],'rows':_0x5c00c6});});},'Outbound':function(_0x40a2ba){return new Promise(function(_0x125940,_0x227a97){_0x125940(_0x627ec4[_0x79fe('0x76')]);});},'Campaigns':function(_0x4887c4){return new Promise(function(_0x56c8d2,_0x345c7f){var _0x3ad4b7=_['values'](_0x627ec4['campaigns']);_0x56c8d2({'count':_0x3ad4b7['length'],'rows':_0x3ad4b7});});},'VoiceQueuesPreview':function(_0x381d08){var _0x309ef2=this;return new Promise(function(_0xd783c9,_0x32aae7){_0x14e975[_0x79fe('0x77')](_0x381d08['id'])['then'](function(_0x3521ff){_0xd783c9({'code':0xc8,'message':_0x3521ff[_0x79fe('0x1b')]});})['catch'](function(_0x39d0a7){_0x32aae7(_0x309ef2['error'](0x1f4,_0x39d0a7['message']));});});},'EventManager':function(_0x4662f8){var _0x359773=this;return new Promise(function(_0x13cf1a,_0x2fe027){if(!_0x4662f8[_0x79fe('0x78')]){return _0x2fe027(_0x359773[_0x79fe('0x11')](0x1f4,_0x79fe('0x79')));}ami[_0x79fe('0x7a')](_0x79fe('0x7b')+_0x4662f8[_0x79fe('0x78')],_0x4662f8[_0x79fe('0x1b')]);_0x13cf1a({'code':0xc8,'message':_0x4662f8});});},'FaxAccounts':function(_0x57a104){return new Promise(function(_0x56eff3,_0x245b77){var _0x1562da=_[_0x79fe('0x57')](_0x627ec4[_0x79fe('0x7c')]);_0x56eff3({'count':_0x1562da[_0x79fe('0x54')],'rows':_0x1562da});});},'SendFax':function(_0x2beaf4){var _0x3e910e=this;return new Promise(function(_0x3390b2,_0x5ce655){_0x4af9f6[_0x79fe('0x7d')](_0x2beaf4)[_0x79fe('0x1a')](function(_0x25ce8d){_0x3390b2({'code':0xc8,'message':_0x25ce8d[_0x79fe('0x1b')]});})['catch'](function(_0xfcbd13){_0x5ce655(_0x3e910e['error'](0x1f4,_0xfcbd13[_0x79fe('0x1b')]));});});},'CheckAfterSend':function(_0x482d04){var _0x46151b=this;return new Promise(function(_0x44b212,_0x1d0b25){_0x4af9f6[_0x79fe('0x7e')](_0x482d04)[_0x79fe('0x1a')](function(_0x37d301){_0x44b212({'code':0xc8,'message':_0x37d301['message']});})['catch'](function(_0x2837b7){_0x1d0b25(_0x46151b[_0x79fe('0x11')](0x1f4,_0x2837b7[_0x79fe('0x1b')]));});});}};var _0x182e01=jayson[_0x79fe('0x7f')](_0x2ba246)['http']();_0x182e01['on'](_0x79fe('0x11'),function(_0x4e6725){return _0x2a5aef(_0x4e6725);});_0x182e01['listen'](0x232a,_0x79fe('0x80'),function(){console['log'](_0x79fe('0x81'),0x232a);return _0x3cec9c(_0x79fe('0x82')+0x232a);});});};
\ No newline at end of file
index ac2aafa..4617d64 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbbf0=['mobile','fax','createdAt','scheduledAt','resolve','then','getContacts','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','<unknown>','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','util','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xbbf0,0x17b));var _0x0bbf=function(_0x48ea3e,_0x4d7c11){_0x48ea3e=_0x48ea3e-0x0;var _0x20d074=_0xbbf0[_0x48ea3e];return _0x20d074;};'use strict';var _=require(_0x0bbf('0x0'));var BPromise=require(_0x0bbf('0x1'));var Redis=require('ioredis');var util=require(_0x0bbf('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x0bbf('0x3'));config['redis']=_[_0x0bbf('0x4')](config[_0x0bbf('0x5')],{'host':_0x0bbf('0x6'),'port':0x18eb});var io=require(_0x0bbf('0x7'))(new Redis(config[_0x0bbf('0x5')]));function emit(_0x5e21c4,_0x2b4b5f,_0x39eba5,_0x35e1a7,_0x486788){logger['info'](_0x0bbf('0x8'),_0x5e21c4,_0x2b4b5f['id'],_0x39eba5,_0x35e1a7,JSON[_0x0bbf('0x9')](_0x486788));io['to'](_0x39eba5)[_0x0bbf('0xa')](_0x35e1a7,_0x486788);}exports[_0x0bbf('0xb')]=function(_0x5f4822,_0x32148a,_0x2b60bf,_0x5f4f4e){var _0x45aec0,_0x5a91e3;var _0x16a614={};var _0x487a1a;var _0x5274cf=Number(_0x2b60bf['data1']);var _0x14f3e5=_0x2b60bf['data2']?Boolean(Number(_0x2b60bf[_0x0bbf('0xc')])):![];var _0x31a7a9;var _0x44ea6d=![];if(!_[_0x0bbf('0xd')](_0x2b60bf[_0x0bbf('0xe')])){if(_0x2b60bf[_0x0bbf('0xe')]=='1')_0x44ea6d=!![];}if(!_0x44ea6d){if(_0x5f4f4e[_0x0bbf('0xf')]){_0x16a614['id']=_0x5f4f4e[_0x0bbf('0xf')];}}if(!_0x16a614['id']){_0x16a614[_0x0bbf('0x10')]=_0x5274cf;_0x31a7a9=_0x2b60bf[_0x0bbf('0x11')]&&_0x2b60bf[_0x0bbf('0x11')]!=='0'?_0x2b60bf[_0x0bbf('0x11')][_0x0bbf('0x12')](','):[_0x0bbf('0x13')];_0x16a614[_0x0bbf('0x14')]=_[_0x0bbf('0x15')](_0x31a7a9,function(_0x1ae4ad){var _0x3535f4={};_0x3535f4[_0x1ae4ad]=_0x5f4f4e[_0x0bbf('0x16')]?_0x5f4f4e[_0x0bbf('0x17')]:_0x5f4f4e[_0x0bbf('0x18')];return _0x3535f4;});_0x487a1a=_0x5f4f4e[_0x0bbf('0x16')]?_0x5f4f4e[_0x0bbf('0x17')]:_0x5f4f4e[_0x0bbf('0x18')];}var _0x37c80a=['id',_0x0bbf('0x19'),_0x0bbf('0x1a'),_0x0bbf('0x13'),_0x0bbf('0x1b'),_0x0bbf('0x1c'),_0x0bbf('0x10'),_0x0bbf('0x1d'),_0x0bbf('0x1e'),'updatedAt'];var _0x5b5615=_['union'](_0x37c80a,_0x31a7a9);BPromise[_0x0bbf('0x1f')]()[_0x0bbf('0x20')](cmContactRpc[_0x0bbf('0x21')]({'attributes':_0x5b5615,'where':_0x16a614,'phone':_0x487a1a}))['then'](function(_0x4ff261){_0x5a91e3=_0x4ff261;if(!_[_0x0bbf('0x22')](_0x5a91e3)){if(_0x5a91e3[_0x0bbf('0x23')]===0x1){_0x45aec0=_0x5a91e3[0x0];logger[_0x0bbf('0x24')](_0x0bbf('0x25'),_0x5f4f4e[_0x0bbf('0x26')],_0x32148a['id'],_0x45aec0['id']);}else{logger[_0x0bbf('0x24')](_0x0bbf('0x27'),_0x5f4f4e[_0x0bbf('0x26')],_0x32148a['id'],_['map'](_0x5a91e3,'id')[_0x0bbf('0x28')](','));}return;}else{logger['info'](_0x0bbf('0x29'),_0x5f4f4e['uniqueid'],_0x32148a['id']);var _0x20ea74={'ListId':_0x5274cf};var _0x13947a=_0x2b60bf[_0x0bbf('0x2a')]&&_0x2b60bf[_0x0bbf('0x2a')]!=='0'?_0x2b60bf[_0x0bbf('0x2a')]:_0x0bbf('0x13');if(_0x14f3e5){logger[_0x0bbf('0x24')](_0x0bbf('0x2b'),_0x5f4f4e['uniqueid'],_0x32148a['id']);_0x20ea74[_0x13947a]=_['isNil'](_0x5f4f4e[_0x0bbf('0x16')])?_0x5f4f4e[_0x0bbf('0x18')]:_0x5f4f4e[_0x0bbf('0x17')];if(_[_0x0bbf('0xd')](_0x5f4f4e[_0x0bbf('0x16')])){_0x20ea74[_0x0bbf('0x19')]=_0x5f4f4e[_0x0bbf('0x2c')]&&_0x5f4f4e[_0x0bbf('0x2c')]!=='<unknown>'?_0x5f4f4e[_0x0bbf('0x2c')]:_0x0bbf('0x2d');}else{_0x20ea74[_0x0bbf('0x19')]=_0x5f4f4e['destcalleridname']&&_0x5f4f4e[_0x0bbf('0x2e')]!==_0x0bbf('0x2f')?_0x5f4f4e[_0x0bbf('0x2e')]:'Unknown';}return BPromise[_0x0bbf('0x1f')]()[_0x0bbf('0x20')](cmContactRpc[_0x0bbf('0x30')](_0x20ea74))[_0x0bbf('0x20')](function(_0x50fc2a){_0x45aec0=_0x50fc2a;_0x5a91e3[_0x0bbf('0x31')](_0x50fc2a);if(_0x45aec0){logger['info'](_0x0bbf('0x32'),_0x5f4f4e['uniqueid'],_0x32148a['id'],_0x45aec0['id']);}return;});}else{logger[_0x0bbf('0x24')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x5f4f4e['uniqueid'],_0x32148a['id']);_0x20ea74[_0x13947a]=_[_0x0bbf('0xd')](_0x5f4f4e[_0x0bbf('0x16')])?_0x5f4f4e[_0x0bbf('0x18')]:_0x5f4f4e['destcalleridnum'];if(_['isNil'](_0x5f4f4e[_0x0bbf('0x16')])){_0x20ea74[_0x0bbf('0x19')]=_0x5f4f4e[_0x0bbf('0x2c')]&&_0x5f4f4e['calleridname']!==_0x0bbf('0x2f')?_0x5f4f4e[_0x0bbf('0x2c')]:_0x0bbf('0x2d');}else{_0x20ea74[_0x0bbf('0x19')]=_0x5f4f4e[_0x0bbf('0x2e')]&&_0x5f4f4e['destcalleridname']!==_0x0bbf('0x2f')?_0x5f4f4e[_0x0bbf('0x2e')]:'Unknown';}_0x45aec0=_0x20ea74;_0x5a91e3['push'](_0x20ea74);return;}}})[_0x0bbf('0x20')](function(){if(_0x5f4822){emit(_0x5f4f4e[_0x0bbf('0x26')],_0x32148a,util[_0x0bbf('0x33')](_0x0bbf('0x34'),_0x5f4822[_0x0bbf('0x35')]),util['format'](_0x0bbf('0x36'),_0x2b60bf[_0x0bbf('0x37')][_0x0bbf('0x38')]()),{'evt':_[_0x0bbf('0x39')](_0x5f4f4e,{'autoCreate':_0x14f3e5}),'contact':_0x45aec0===undefined?{}:_0x45aec0,'contacts':_0x5a91e3[_0x0bbf('0x23')]===0x0?undefined:_0x5a91e3});}});};
\ No newline at end of file
+var _0x176a=['xmd-contactid','ListId','data3','split','$or','map','routeId','calleridnum','firstName','lastName','mobile','fax','createdAt','updatedAt','union','resolve','then','length','uniqueid','join','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','<unknown>','destcalleridname','createContact','Unknown','push','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','isNil','data5'];(function(_0x85d18,_0x188691){var _0x5879d3=function(_0x484956){while(--_0x484956){_0x85d18['push'](_0x85d18['shift']());}};_0x5879d3(++_0x188691);}(_0x176a,0x8a));var _0xa176=function(_0x55b762,_0x3cf757){_0x55b762=_0x55b762-0x0;var _0x3cd949=_0x176a[_0x55b762];return _0x3cd949;};'use strict';var _=require(_0xa176('0x0'));var BPromise=require('bluebird');var Redis=require('ioredis');var util=require('util');var config=require(_0xa176('0x1'));var logger=require(_0xa176('0x2'))('trigger');var cmContactRpc=require(_0xa176('0x3'));config[_0xa176('0x4')]=_[_0xa176('0x5')](config[_0xa176('0x4')],{'host':_0xa176('0x6'),'port':0x18eb});var io=require(_0xa176('0x7'))(new Redis(config[_0xa176('0x4')]));function emit(_0x1826bd,_0x1d51ee,_0x34a3c6,_0x11c5a6,_0x463f90){logger[_0xa176('0x8')](_0xa176('0x9'),_0x1826bd,_0x1d51ee['id'],_0x34a3c6,_0x11c5a6,JSON['stringify'](_0x463f90));io['to'](_0x34a3c6)[_0xa176('0xa')](_0x11c5a6,_0x463f90);}exports[_0xa176('0xb')]=function(_0x338989,_0x20f01e,_0x53a756,_0x2b4418){var _0x2f9386,_0x5d8b09;var _0x5e5dd7={};var _0x31cc24;var _0xd3a21e=Number(_0x53a756[_0xa176('0xc')]);var _0x187aab=_0x53a756['data2']?Boolean(Number(_0x53a756['data2'])):![];var _0x2dc825;var _0x1d6f36=![];if(!_[_0xa176('0xd')](_0x53a756[_0xa176('0xe')])){if(_0x53a756['data5']=='1')_0x1d6f36=!![];}if(!_0x1d6f36){if(_0x2b4418['xmd-contactid']){_0x5e5dd7['id']=_0x2b4418[_0xa176('0xf')];}}if(!_0x5e5dd7['id']){_0x5e5dd7[_0xa176('0x10')]=_0xd3a21e;_0x2dc825=_0x53a756[_0xa176('0x11')]&&_0x53a756[_0xa176('0x11')]!=='0'?_0x53a756['data3'][_0xa176('0x12')](','):['phone'];_0x5e5dd7[_0xa176('0x13')]=_[_0xa176('0x14')](_0x2dc825,function(_0x39a536){var _0x38cad2={};_0x38cad2[_0x39a536]=_0x2b4418[_0xa176('0x15')]?_0x2b4418['destcalleridnum']:_0x2b4418[_0xa176('0x16')];return _0x38cad2;});_0x31cc24=_0x2b4418['routeId']?_0x2b4418['destcalleridnum']:_0x2b4418['calleridnum'];}var _0x17abdc=['id',_0xa176('0x17'),_0xa176('0x18'),'phone',_0xa176('0x19'),_0xa176('0x1a'),_0xa176('0x10'),_0xa176('0x1b'),'scheduledAt',_0xa176('0x1c')];var _0x42e28c=_[_0xa176('0x1d')](_0x17abdc,_0x2dc825);BPromise[_0xa176('0x1e')]()[_0xa176('0x1f')](cmContactRpc['getContacts']({'attributes':_0x42e28c,'where':_0x5e5dd7,'phone':_0x31cc24}))['then'](function(_0x6f1748){_0x5d8b09=_0x6f1748;if(!_['isEmpty'](_0x5d8b09)){if(_0x5d8b09[_0xa176('0x20')]===0x1){_0x2f9386=_0x5d8b09[0x0];logger[_0xa176('0x8')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x2b4418[_0xa176('0x21')],_0x20f01e['id'],_0x2f9386['id']);}else{logger[_0xa176('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x2b4418['uniqueid'],_0x20f01e['id'],_[_0xa176('0x14')](_0x5d8b09,'id')[_0xa176('0x22')](','));}return;}else{logger[_0xa176('0x8')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x2b4418[_0xa176('0x21')],_0x20f01e['id']);var _0xd23a52={'ListId':_0xd3a21e};var _0x2cec17=_0x53a756[_0xa176('0x23')]&&_0x53a756['data4']!=='0'?_0x53a756[_0xa176('0x23')]:_0xa176('0x24');if(_0x187aab){logger[_0xa176('0x8')](_0xa176('0x25'),_0x2b4418['uniqueid'],_0x20f01e['id']);_0xd23a52[_0x2cec17]=_['isNil'](_0x2b4418[_0xa176('0x15')])?_0x2b4418[_0xa176('0x16')]:_0x2b4418['destcalleridnum'];if(_[_0xa176('0xd')](_0x2b4418[_0xa176('0x15')])){_0xd23a52[_0xa176('0x17')]=_0x2b4418[_0xa176('0x26')]&&_0x2b4418['calleridname']!==_0xa176('0x27')?_0x2b4418['calleridname']:'Unknown';}else{_0xd23a52[_0xa176('0x17')]=_0x2b4418[_0xa176('0x28')]&&_0x2b4418[_0xa176('0x28')]!=='<unknown>'?_0x2b4418['destcalleridname']:'Unknown';}return BPromise[_0xa176('0x1e')]()['then'](cmContactRpc[_0xa176('0x29')](_0xd23a52))[_0xa176('0x1f')](function(_0x568771){_0x2f9386=_0x568771;_0x5d8b09['push'](_0x568771);if(_0x2f9386){logger[_0xa176('0x8')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x2b4418[_0xa176('0x21')],_0x20f01e['id'],_0x2f9386['id']);}return;});}else{logger[_0xa176('0x8')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x2b4418[_0xa176('0x21')],_0x20f01e['id']);_0xd23a52[_0x2cec17]=_[_0xa176('0xd')](_0x2b4418['routeId'])?_0x2b4418['calleridnum']:_0x2b4418['destcalleridnum'];if(_[_0xa176('0xd')](_0x2b4418[_0xa176('0x15')])){_0xd23a52[_0xa176('0x17')]=_0x2b4418[_0xa176('0x26')]&&_0x2b4418[_0xa176('0x26')]!==_0xa176('0x27')?_0x2b4418[_0xa176('0x26')]:_0xa176('0x2a');}else{_0xd23a52[_0xa176('0x17')]=_0x2b4418['destcalleridname']&&_0x2b4418[_0xa176('0x28')]!=='<unknown>'?_0x2b4418['destcalleridname']:_0xa176('0x2a');}_0x2f9386=_0xd23a52;_0x5d8b09[_0xa176('0x2b')](_0xd23a52);return;}}})['then'](function(){if(_0x338989){emit(_0x2b4418[_0xa176('0x21')],_0x20f01e,util[_0xa176('0x2c')](_0xa176('0x2d'),_0x338989[_0xa176('0x2e')]),util[_0xa176('0x2c')](_0xa176('0x2f'),_0x53a756[_0xa176('0x30')][_0xa176('0x31')]()),{'evt':_[_0xa176('0x32')](_0x2b4418,{'autoCreate':_0x187aab}),'contact':_0x2f9386===undefined?{}:_0x2f9386,'contacts':_0x5d8b09[_0xa176('0x20')]===0x0?undefined:_0x5d8b09});}});};
\ No newline at end of file
index e031462..d1f4c90 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d4b=['voice','checkTriggers','agents','interface','triggers','hasOwnProperty','status','variables','Actions','action','toLowerCase','contactmanager','motionbar','TemplateId','data2','html','uri','buildUri','data3','isNil','data4','location','windowWidth','data5','800','data6','winApplication','render','winArguments','format','user:%s','trigger:%s:%s','data1','merge','jscripty','name','trigger:%s','queue','routeId','exec','script','query','search','replace','checkTrigger','AllConditions','length','checkConditions','channel','some','AnyConditions','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','membername','lastevent','null','substatus','offlineMessage','created','exports','util','lodash','url','ioredis','./urlforward','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','popup','winapp','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','prototype','emit','info','stringify','motionChannel','undefined'];(function(_0xe39ca1,_0x147cc9){var _0x200d2c=function(_0x43023a){while(--_0x43023a){_0xe39ca1['push'](_0xe39ca1['shift']());}};_0x200d2c(++_0x147cc9);}(_0x6d4b,0xbf));var _0xb6d4=function(_0x4ed3ac,_0x3d7b90){_0x4ed3ac=_0x4ed3ac-0x0;var _0x1ea925=_0x6d4b[_0x4ed3ac];return _0x1ea925;};'use strict';var util=require(_0xb6d4('0x0'));var _=require(_0xb6d4('0x1'));var url=require(_0xb6d4('0x2'));var Mustache=require('mustache');var Redis=require(_0xb6d4('0x3'));var urlforward=require(_0xb6d4('0x4'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require(_0xb6d4('0x5'));var config=require(_0xb6d4('0x6'));var logger=require(_0xb6d4('0x7'))(_0xb6d4('0x8'));var ami=require(_0xb6d4('0x9'));config[_0xb6d4('0xa')]=_[_0xb6d4('0xb')](config[_0xb6d4('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xb6d4('0xc'))(new Redis(config[_0xb6d4('0xa')]));var operators={'equals':function(_0x3907c5,_0x3e07cc){return _0x3907c5==_0x3e07cc;},'not_equals':function(_0x2effac,_0x1d54fb){return _0x2effac!=_0x1d54fb;}};var barAndWebActions=[_0xb6d4('0xd'),_0xb6d4('0x2'),_0xb6d4('0xe')];function Trigger(_0x14d8ce){this['triggers']=_0x14d8ce['triggers'];this['agents']=_0x14d8ce['agents'];this[_0xb6d4('0xf')]=_0x14d8ce['voiceQueues'];this[_0xb6d4('0x10')]=_0x14d8ce[_0xb6d4('0x10')];this[_0xb6d4('0x11')]=_0x14d8ce[_0xb6d4('0x11')];this['zendeskAccounts']=_0x14d8ce[_0xb6d4('0x12')];this[_0xb6d4('0x13')]=_0x14d8ce['freshdeskAccounts'];this[_0xb6d4('0x14')]=_0x14d8ce['salesforceAccounts'];this[_0xb6d4('0x15')]=_0x14d8ce[_0xb6d4('0x15')];this[_0xb6d4('0x16')]=_0x14d8ce[_0xb6d4('0x16')];this[_0xb6d4('0x17')]=_0x14d8ce[_0xb6d4('0x17')];this[_0xb6d4('0x18')]=_0x14d8ce['vtigerAccounts'];this[_0xb6d4('0x19')]=_0x14d8ce[_0xb6d4('0x19')];this[_0xb6d4('0x1a')]=_0x14d8ce[_0xb6d4('0x1a')];this[_0xb6d4('0x1b')]=_0x14d8ce[_0xb6d4('0x1b')];this[_0xb6d4('0x1c')]={'zendesk':this[_0xb6d4('0x12')],'salesforce':this[_0xb6d4('0x14')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xb6d4('0x16')],'desk':this[_0xb6d4('0x17')],'vtiger':this[_0xb6d4('0x18')],'dynamics365':this[_0xb6d4('0x1a')],'freshsales':this[_0xb6d4('0x1b')],'servicenow':this['servicenowAccounts']};ami['on'](_0xb6d4('0x1d'),this[_0xb6d4('0x1e')][_0xb6d4('0x1f')](this));ami['on']('custom:agentconnect',this[_0xb6d4('0x1e')]['bind'](this));ami['on']('custom:agentringnoanswer',this[_0xb6d4('0x1e')][_0xb6d4('0x1f')](this));ami['on']('custom:agentcomplete',this['syncCustomEvent'][_0xb6d4('0x1f')](this));ami['on'](_0xb6d4('0x20'),this[_0xb6d4('0x1e')][_0xb6d4('0x1f')](this));ami['on'](_0xb6d4('0x21'),this[_0xb6d4('0x1e')][_0xb6d4('0x1f')](this));ami['on'](_0xb6d4('0x22'),this[_0xb6d4('0x1e')][_0xb6d4('0x1f')](this));ami['on'](_0xb6d4('0x23'),this[_0xb6d4('0x1e')]['bind'](this));ami['on'](_0xb6d4('0x24'),this[_0xb6d4('0x1e')]['bind'](this));ami['on'](_0xb6d4('0x25'),this['syncCustomEvent'][_0xb6d4('0x1f')](this));ami['on'](_0xb6d4('0x26'),this[_0xb6d4('0x1e')][_0xb6d4('0x1f')](this));ami['on'](_0xb6d4('0x27'),this[_0xb6d4('0x1e')][_0xb6d4('0x1f')](this));ami['on'](_0xb6d4('0x28'),this['syncAgentDial'][_0xb6d4('0x1f')](this));ami['on'](_0xb6d4('0x29'),this[_0xb6d4('0x2a')]['bind'](this));ami['on'](_0xb6d4('0x2b'),this[_0xb6d4('0x2a')]['bind'](this));ami['on'](_0xb6d4('0x2c'),this[_0xb6d4('0x1e')][_0xb6d4('0x1f')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent']['bind'](this));ami['on'](_0xb6d4('0x2d'),this[_0xb6d4('0x1e')][_0xb6d4('0x1f')](this));ami['on'](_0xb6d4('0x2e'),this[_0xb6d4('0x1e')][_0xb6d4('0x1f')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent'][_0xb6d4('0x1f')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent']['bind'](this));ami['on']('custom:rejectmessage',this[_0xb6d4('0x1e')][_0xb6d4('0x1f')](this));ami['on']('custom:offlineMessage',this[_0xb6d4('0x1e')]['bind'](this));}Trigger[_0xb6d4('0x2f')][_0xb6d4('0x30')]=function(_0x389943,_0x2ac83f,_0x274ebd){logger[_0xb6d4('0x31')](_0x389943,_0x2ac83f,JSON[_0xb6d4('0x32')](_0x274ebd));io['to'](_0x389943)['emit'](_0x2ac83f,_0x274ebd);};Trigger[_0xb6d4('0x2f')][_0xb6d4('0x1e')]=function(_0x2ed1c7){var _0x577a92=_['clone'](_0x2ed1c7);if(typeof _0x577a92[_0xb6d4('0x33')]===_0xb6d4('0x34')){_0x577a92[_0xb6d4('0x33')]=_0xb6d4('0x35');}this[_0xb6d4('0x36')](_0x577a92);};Trigger['prototype'][_0xb6d4('0x2a')]=function(_0x54639e){if(this[_0xb6d4('0x37')][_0x54639e[_0xb6d4('0x38')]]){this[_0xb6d4('0x1e')](_0x54639e);}};Trigger['prototype'][_0xb6d4('0x36')]=function(_0x54917a){var _0x47b851;for(var _0x1ed581 in this[_0xb6d4('0x39')]){if(this[_0xb6d4('0x39')][_0xb6d4('0x3a')](_0x1ed581)){if(this[_0xb6d4('0x39')][_0x1ed581][_0xb6d4('0x3b')]){_0x47b851=this['checkTrigger'](this[_0xb6d4('0x39')][_0x1ed581],_0x54917a);if(_0x47b851){_['merge'](_0x54917a,_0x54917a[_0xb6d4('0x3c')]);for(var _0x4d0783=0x0,_0xa8b4cb,_0x6e1ea0,_0x7e9a87;_0x4d0783<this[_0xb6d4('0x39')][_0x1ed581][_0xb6d4('0x3d')]['length'];_0x4d0783+=0x1){_0xa8b4cb=this[_0xb6d4('0x39')][_0x1ed581]['Actions'][_0x4d0783];if(this[_0xb6d4('0x37')][_0x54917a[_0xb6d4('0x38')]]){switch(_0xa8b4cb[_0xb6d4('0x3e')][_0xb6d4('0x3f')]()){case _0xb6d4('0x40'):break;case _0xb6d4('0x41'):case'browser':var _0x3b97f8={};switch(barAndWebActions[_0xa8b4cb['data1']]){case _0xb6d4('0xd'):_0x3b97f8[_0xb6d4('0x42')]=_0xa8b4cb[_0xb6d4('0x43')];_0x3b97f8[_0xb6d4('0x44')]=this[_0xb6d4('0x10')][_0xa8b4cb[_0xb6d4('0x43')]]?Mustache['render'](this['templates'][_0xa8b4cb[_0xb6d4('0x43')]]['html'],_0x54917a):'template\x20not\x20found';break;case _0xb6d4('0x2'):_0x3b97f8[_0xb6d4('0x45')]=this[_0xb6d4('0x46')](_0xa8b4cb['data2'],_0x54917a,_['isNil'](_0xa8b4cb[_0xb6d4('0x47')])?!![]:parseInt(_0xa8b4cb[_0xb6d4('0x47')],0xa));if(_[_0xb6d4('0x48')](_0xa8b4cb[_0xb6d4('0x49')])){_0x3b97f8[_0xb6d4('0x4a')]='0';}else{_0x3b97f8['uriLocation']=_0xa8b4cb[_0xb6d4('0x49')];_0x3b97f8[_0xb6d4('0x4b')]=_[_0xb6d4('0x48')](_0xa8b4cb[_0xb6d4('0x4c')])?_0xb6d4('0x4d'):_0xa8b4cb[_0xb6d4('0x4c')];_0x3b97f8['windowHeight']=_['isNil'](_0xa8b4cb[_0xb6d4('0x4e')])?'600':_0xa8b4cb['data6'];}break;case _0xb6d4('0xe'):_0x3b97f8[_0xb6d4('0x4f')]=_0xa8b4cb[_0xb6d4('0x43')]?Mustache[_0xb6d4('0x50')](_0xa8b4cb[_0xb6d4('0x43')],_0x54917a):'';_0x3b97f8[_0xb6d4('0x51')]=_0xa8b4cb[_0xb6d4('0x47')]?Mustache['render'](_0xa8b4cb[_0xb6d4('0x47')],_0x54917a):'';break;}this[_0xb6d4('0x30')](util[_0xb6d4('0x52')](_0xb6d4('0x53'),this['agents'][_0x54917a['interface']]['name']),util['format'](_0xb6d4('0x54'),_0xa8b4cb['action'][_0xb6d4('0x3f')](),barAndWebActions[_0xa8b4cb[_0xb6d4('0x55')]]),_[_0xb6d4('0x56')](_0x3b97f8,_0x54917a));break;case _0xb6d4('0x57'):this[_0xb6d4('0x30')](util[_0xb6d4('0x52')]('user:%s',this['agents'][_0x54917a[_0xb6d4('0x38')]][_0xb6d4('0x58')]),util['format'](_0xb6d4('0x59'),_0xa8b4cb[_0xb6d4('0x3e')][_0xb6d4('0x3f')]()),_[_0xb6d4('0x56')]({'ProjectId':parseInt(_0xa8b4cb[_0xb6d4('0x55')],0xa)},_0x54917a));break;default:this['emit'](util['format']('user:%s',this[_0xb6d4('0x37')][_0x54917a[_0xb6d4('0x38')]][_0xb6d4('0x58')]),util[_0xb6d4('0x52')](_0xb6d4('0x59'),_0xa8b4cb['action'][_0xb6d4('0x3f')]()),_['merge']({},_0xa8b4cb,_0x54917a));}}switch(_0xa8b4cb[_0xb6d4('0x3e')][_0xb6d4('0x3f')]()){case _0xb6d4('0x40'):cmContact['exec'](this[_0xb6d4('0x37')][_0x54917a[_0xb6d4('0x38')]],this['triggers'][_0x1ed581],_0xa8b4cb,_0x54917a);break;case'integration':integration['exec'](_0xa8b4cb,_0x54917a,this['accounts'],this[_0xb6d4('0x37')][_0x54917a['interface']],this[_0xb6d4('0xf')][_0x54917a[_0xb6d4('0x5a')]],this['voiceExtensions'][_0x54917a[_0xb6d4('0x5b')]]);break;case'urlforward':urlforward[_0xb6d4('0x5c')](_0xa8b4cb,_0x54917a);break;case _0xb6d4('0x5d'):script[_0xb6d4('0x5c')](_0xa8b4cb,_0x54917a);break;}}}}}}};Trigger[_0xb6d4('0x2f')][_0xb6d4('0x46')]=function(_0x5ead9c,_0x21c517,_0x25e207){var _0x2124c2=url['parse'](Mustache[_0xb6d4('0x50')](_0x5ead9c,_0x21c517),!![]);if(_0x25e207){_['merge'](_0x2124c2[_0xb6d4('0x5e')],_0x21c517);}delete _0x2124c2[_0xb6d4('0x5f')];var _0x58aaef=url[_0xb6d4('0x52')](_0x2124c2);_0x58aaef=_0x58aaef[_0xb6d4('0x60')](/\/\?/g,'?');return _0x58aaef;};Trigger[_0xb6d4('0x2f')][_0xb6d4('0x61')]=function(_0x54aa86,_0x580dbd){var _0x1f89e0=!![];var _0x418aae=!![];var _0x4bd896=![];if(_0x54aa86['channel']===_0x580dbd[_0xb6d4('0x33')]){_0x4bd896=!![];}if(_0x54aa86[_0xb6d4('0x62')][_0xb6d4('0x63')]){_0x1f89e0=_['every'](_0x54aa86['AllConditions'],this[_0xb6d4('0x64')](_0x580dbd,_0x54aa86[_0xb6d4('0x65')]));}if(_0x54aa86['AnyConditions'][_0xb6d4('0x63')]){_0x418aae=_[_0xb6d4('0x66')](_0x54aa86[_0xb6d4('0x67')],this[_0xb6d4('0x64')](_0x580dbd,_0x54aa86[_0xb6d4('0x65')]));}return _0x4bd896&&_0x1f89e0&&_0x418aae;};Trigger[_0xb6d4('0x2f')][_0xb6d4('0x64')]=function(_0x428f7a,_0x468be1){return function(_0x23c56a){switch(_0x23c56a[_0xb6d4('0x68')]){case _0xb6d4('0x69'):if(_0x428f7a[_0xb6d4('0x65')]===_0x468be1){if(_0x468be1===_0xb6d4('0x6a')){return _0x428f7a[_0xb6d4('0x6b')]?operators[_0x23c56a[_0xb6d4('0x6c')]](Number(_0x23c56a[_0xb6d4('0x6d')]),_0x428f7a[_0xb6d4('0x6b')]):![];}else{return _0x428f7a[_[_0xb6d4('0x6e')](_0x468be1)+'AccountId']?operators[_0x23c56a[_0xb6d4('0x6c')]](Number(_0x23c56a[_0xb6d4('0x6d')]),_0x428f7a[_[_0xb6d4('0x6e')](_0x468be1)+_0xb6d4('0x6f')]):![];}}break;case _0xb6d4('0x70'):case _0xb6d4('0x71'):if(_0x428f7a[_0xb6d4('0x65')]===_0x468be1){return _0x428f7a[_0xb6d4('0x72')]?operators[_0x23c56a[_0xb6d4('0x6c')]](_0x23c56a['value'],_0x428f7a[_0xb6d4('0x72')]):![];}break;case _0xb6d4('0x5a'):return _0x428f7a[_0xb6d4('0x5a')]?operators[_0x23c56a[_0xb6d4('0x6c')]](_0x23c56a['value'],_0x428f7a[_0xb6d4('0x5a')]):![];case'agent':return _0x428f7a[_0xb6d4('0x73')]?operators[_0x23c56a['operator']](_0x23c56a['value'],_0x428f7a[_0xb6d4('0x73')]):![];case _0xb6d4('0x74'):return _0x428f7a[_0xb6d4('0x74')]?operators[_0x23c56a[_0xb6d4('0x6c')]](_0x23c56a['value'],_0x428f7a[_0xb6d4('0x74')]):![];case _0xb6d4('0x5b'):return _0x428f7a[_0xb6d4('0x5b')]?operators[_0x23c56a[_0xb6d4('0x6c')]](_0x23c56a[_0xb6d4('0x6d')],_0x428f7a[_0xb6d4('0x5b')]):![];case'mailSubstatus':if(_0x23c56a['value']===_0xb6d4('0x75'))_0x23c56a[_0xb6d4('0x6d')]=null;return typeof _0x428f7a['substatus']!=='undefined'?operators[_0x23c56a[_0xb6d4('0x6c')]](_0x23c56a[_0xb6d4('0x6d')],_0x428f7a[_0xb6d4('0x76')]):![];case _0xb6d4('0x77'):if(_0x428f7a[_0xb6d4('0x65')]===_0x468be1){return _0x23c56a[_0xb6d4('0x6d')]===_0xb6d4('0x78')&&_0x23c56a[_0xb6d4('0x6c')]==='equals'?!![]:![];}break;}return![];};};module[_0xb6d4('0x79')]=Trigger;
\ No newline at end of file
+var _0x77e6=['render','user:%s','name','trigger:%s:%s','data1','jscripty','format','trigger:%s','exec','integration','routeId','urlforward','script','parse','query','AllConditions','every','checkConditions','AnyConditions','some','channel','field','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','queue','agent','membername','lastevent','null','substatus','offlineMessage','created','equals','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','../ami','defaults','socket.io-emitter','redis','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','motionChannel','undefined','checkTriggers','interface','status','checkTrigger','merge','variables','length','action','toLowerCase','contactmanager','motionbar','browser','popup','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','isNil','data3','location','windowWidth','data5','800','data6','600'];(function(_0x299d7e,_0x1abf1d){var _0x4fd937=function(_0x1a0e58){while(--_0x1a0e58){_0x299d7e['push'](_0x299d7e['shift']());}};_0x4fd937(++_0x1abf1d);}(_0x77e6,0x1a6));var _0x677e=function(_0x3e6919,_0x5a6fbe){_0x3e6919=_0x3e6919-0x0;var _0x1a873a=_0x77e6[_0x3e6919];return _0x1a873a;};'use strict';var util=require(_0x677e('0x0'));var _=require(_0x677e('0x1'));var url=require(_0x677e('0x2'));var Mustache=require(_0x677e('0x3'));var Redis=require(_0x677e('0x4'));var urlforward=require(_0x677e('0x5'));var integration=require(_0x677e('0x6'));var cmContact=require(_0x677e('0x7'));var script=require('./script');var config=require(_0x677e('0x8'));var logger=require(_0x677e('0x9'))('trigger');var ami=require(_0x677e('0xa'));config['redis']=_[_0x677e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x677e('0xc'))(new Redis(config[_0x677e('0xd')]));var operators={'equals':function(_0x28d41e,_0x285c1c){return _0x28d41e==_0x285c1c;},'not_equals':function(_0x552931,_0x206305){return _0x552931!=_0x206305;}};var barAndWebActions=['popup',_0x677e('0x2'),_0x677e('0xe')];function Trigger(_0x1e4fd9){this[_0x677e('0xf')]=_0x1e4fd9[_0x677e('0xf')];this[_0x677e('0x10')]=_0x1e4fd9[_0x677e('0x10')];this[_0x677e('0x11')]=_0x1e4fd9[_0x677e('0x11')];this[_0x677e('0x12')]=_0x1e4fd9[_0x677e('0x12')];this[_0x677e('0x13')]=_0x1e4fd9[_0x677e('0x13')];this[_0x677e('0x14')]=_0x1e4fd9['zendeskAccounts'];this['freshdeskAccounts']=_0x1e4fd9['freshdeskAccounts'];this[_0x677e('0x15')]=_0x1e4fd9[_0x677e('0x15')];this[_0x677e('0x16')]=_0x1e4fd9[_0x677e('0x16')];this[_0x677e('0x17')]=_0x1e4fd9[_0x677e('0x17')];this[_0x677e('0x18')]=_0x1e4fd9[_0x677e('0x18')];this[_0x677e('0x19')]=_0x1e4fd9[_0x677e('0x19')];this[_0x677e('0x1a')]=_0x1e4fd9[_0x677e('0x1a')];this['dynamics365Accounts']=_0x1e4fd9[_0x677e('0x1b')];this[_0x677e('0x1c')]=_0x1e4fd9[_0x677e('0x1c')];this[_0x677e('0x1d')]={'zendesk':this[_0x677e('0x14')],'salesforce':this[_0x677e('0x15')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x677e('0x16')],'zoho':this['zohoAccounts'],'desk':this[_0x677e('0x18')],'vtiger':this[_0x677e('0x19')],'dynamics365':this[_0x677e('0x1b')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x677e('0x1a')]};ami['on'](_0x677e('0x1e'),this[_0x677e('0x1f')][_0x677e('0x20')](this));ami['on'](_0x677e('0x21'),this[_0x677e('0x1f')][_0x677e('0x20')](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent']['bind'](this));ami['on'](_0x677e('0x22'),this[_0x677e('0x1f')][_0x677e('0x20')](this));ami['on'](_0x677e('0x23'),this[_0x677e('0x1f')][_0x677e('0x20')](this));ami['on'](_0x677e('0x24'),this[_0x677e('0x1f')][_0x677e('0x20')](this));ami['on'](_0x677e('0x25'),this['syncCustomEvent']['bind'](this));ami['on'](_0x677e('0x26'),this[_0x677e('0x1f')]['bind'](this));ami['on'](_0x677e('0x27'),this[_0x677e('0x1f')][_0x677e('0x20')](this));ami['on'](_0x677e('0x28'),this[_0x677e('0x1f')][_0x677e('0x20')](this));ami['on']('custom:queuecallerabandon',this[_0x677e('0x1f')][_0x677e('0x20')](this));ami['on'](_0x677e('0x29'),this[_0x677e('0x1f')][_0x677e('0x20')](this));ami['on'](_0x677e('0x2a'),this[_0x677e('0x2b')][_0x677e('0x20')](this));ami['on'](_0x677e('0x2c'),this['syncAgentDial'][_0x677e('0x20')](this));ami['on'](_0x677e('0x2d'),this[_0x677e('0x2b')][_0x677e('0x20')](this));ami['on'](_0x677e('0x2e'),this[_0x677e('0x1f')][_0x677e('0x20')](this));ami['on'](_0x677e('0x2f'),this[_0x677e('0x1f')][_0x677e('0x20')](this));ami['on']('custom:substatus',this[_0x677e('0x1f')][_0x677e('0x20')](this));ami['on'](_0x677e('0x30'),this[_0x677e('0x1f')][_0x677e('0x20')](this));ami['on'](_0x677e('0x31'),this['syncCustomEvent'][_0x677e('0x20')](this));ami['on'](_0x677e('0x32'),this[_0x677e('0x1f')]['bind'](this));ami['on'](_0x677e('0x33'),this[_0x677e('0x1f')][_0x677e('0x20')](this));ami['on'](_0x677e('0x34'),this[_0x677e('0x1f')]['bind'](this));}Trigger[_0x677e('0x35')][_0x677e('0x36')]=function(_0x3514d6,_0x1fc871,_0x548b22){logger[_0x677e('0x37')](_0x3514d6,_0x1fc871,JSON[_0x677e('0x38')](_0x548b22));io['to'](_0x3514d6)[_0x677e('0x36')](_0x1fc871,_0x548b22);};Trigger['prototype']['syncCustomEvent']=function(_0x6abc77){var _0x5d2290=_['clone'](_0x6abc77);if(typeof _0x5d2290[_0x677e('0x39')]===_0x677e('0x3a')){_0x5d2290['motionChannel']='voice';}this[_0x677e('0x3b')](_0x5d2290);};Trigger[_0x677e('0x35')]['syncAgentDial']=function(_0x5a7d72){if(this[_0x677e('0x10')][_0x5a7d72[_0x677e('0x3c')]]){this[_0x677e('0x1f')](_0x5a7d72);}};Trigger['prototype'][_0x677e('0x3b')]=function(_0x39f5d6){var _0x38db14;for(var _0x45c6ce in this[_0x677e('0xf')]){if(this['triggers']['hasOwnProperty'](_0x45c6ce)){if(this[_0x677e('0xf')][_0x45c6ce][_0x677e('0x3d')]){_0x38db14=this[_0x677e('0x3e')](this[_0x677e('0xf')][_0x45c6ce],_0x39f5d6);if(_0x38db14){_[_0x677e('0x3f')](_0x39f5d6,_0x39f5d6[_0x677e('0x40')]);for(var _0x1b9a35=0x0,_0x149039,_0x78202e,_0x270867;_0x1b9a35<this['triggers'][_0x45c6ce]['Actions'][_0x677e('0x41')];_0x1b9a35+=0x1){_0x149039=this[_0x677e('0xf')][_0x45c6ce]['Actions'][_0x1b9a35];if(this[_0x677e('0x10')][_0x39f5d6['interface']]){switch(_0x149039[_0x677e('0x42')][_0x677e('0x43')]()){case _0x677e('0x44'):break;case _0x677e('0x45'):case _0x677e('0x46'):var _0x1a34d8={};switch(barAndWebActions[_0x149039['data1']]){case _0x677e('0x47'):_0x1a34d8[_0x677e('0x48')]=_0x149039[_0x677e('0x49')];_0x1a34d8[_0x677e('0x4a')]=this[_0x677e('0x12')][_0x149039[_0x677e('0x49')]]?Mustache['render'](this[_0x677e('0x12')][_0x149039['data2']][_0x677e('0x4a')],_0x39f5d6):_0x677e('0x4b');break;case _0x677e('0x2'):_0x1a34d8[_0x677e('0x4c')]=this[_0x677e('0x4d')](_0x149039[_0x677e('0x49')],_0x39f5d6,_[_0x677e('0x4e')](_0x149039[_0x677e('0x4f')])?!![]:parseInt(_0x149039[_0x677e('0x4f')],0xa));if(_[_0x677e('0x4e')](_0x149039['data4'])){_0x1a34d8[_0x677e('0x50')]='0';}else{_0x1a34d8['uriLocation']=_0x149039['data4'];_0x1a34d8[_0x677e('0x51')]=_[_0x677e('0x4e')](_0x149039[_0x677e('0x52')])?_0x677e('0x53'):_0x149039[_0x677e('0x52')];_0x1a34d8['windowHeight']=_[_0x677e('0x4e')](_0x149039[_0x677e('0x54')])?_0x677e('0x55'):_0x149039[_0x677e('0x54')];}break;case _0x677e('0xe'):_0x1a34d8['winApplication']=_0x149039[_0x677e('0x49')]?Mustache[_0x677e('0x56')](_0x149039[_0x677e('0x49')],_0x39f5d6):'';_0x1a34d8['winArguments']=_0x149039[_0x677e('0x4f')]?Mustache['render'](_0x149039[_0x677e('0x4f')],_0x39f5d6):'';break;}this['emit'](util['format'](_0x677e('0x57'),this[_0x677e('0x10')][_0x39f5d6[_0x677e('0x3c')]][_0x677e('0x58')]),util['format'](_0x677e('0x59'),_0x149039[_0x677e('0x42')]['toLowerCase'](),barAndWebActions[_0x149039[_0x677e('0x5a')]]),_[_0x677e('0x3f')](_0x1a34d8,_0x39f5d6));break;case _0x677e('0x5b'):this[_0x677e('0x36')](util[_0x677e('0x5c')]('user:%s',this[_0x677e('0x10')][_0x39f5d6['interface']]['name']),util[_0x677e('0x5c')]('trigger:%s',_0x149039[_0x677e('0x42')][_0x677e('0x43')]()),_[_0x677e('0x3f')]({'ProjectId':parseInt(_0x149039[_0x677e('0x5a')],0xa)},_0x39f5d6));break;default:this[_0x677e('0x36')](util[_0x677e('0x5c')](_0x677e('0x57'),this['agents'][_0x39f5d6['interface']]['name']),util[_0x677e('0x5c')](_0x677e('0x5d'),_0x149039[_0x677e('0x42')][_0x677e('0x43')]()),_[_0x677e('0x3f')]({},_0x149039,_0x39f5d6));}}switch(_0x149039[_0x677e('0x42')]['toLowerCase']()){case _0x677e('0x44'):cmContact[_0x677e('0x5e')](this['agents'][_0x39f5d6[_0x677e('0x3c')]],this['triggers'][_0x45c6ce],_0x149039,_0x39f5d6);break;case _0x677e('0x5f'):integration[_0x677e('0x5e')](_0x149039,_0x39f5d6,this[_0x677e('0x1d')],this[_0x677e('0x10')][_0x39f5d6['interface']],this[_0x677e('0x11')][_0x39f5d6['queue']],this[_0x677e('0x13')][_0x39f5d6[_0x677e('0x60')]]);break;case _0x677e('0x61'):urlforward[_0x677e('0x5e')](_0x149039,_0x39f5d6);break;case _0x677e('0x62'):script['exec'](_0x149039,_0x39f5d6);break;}}}}}}};Trigger[_0x677e('0x35')][_0x677e('0x4d')]=function(_0x3c1e10,_0x5544d6,_0x3182a1){var _0x8c6495=url[_0x677e('0x63')](Mustache[_0x677e('0x56')](_0x3c1e10,_0x5544d6),!![]);if(_0x3182a1){_[_0x677e('0x3f')](_0x8c6495[_0x677e('0x64')],_0x5544d6);}delete _0x8c6495['search'];var _0x10fdf6=url['format'](_0x8c6495);_0x10fdf6=_0x10fdf6['replace'](/\/\?/g,'?');return _0x10fdf6;};Trigger[_0x677e('0x35')]['checkTrigger']=function(_0x5ddc5f,_0x69c67c){var _0x50c688=!![];var _0x2affc1=!![];var _0xa0df7d=![];if(_0x5ddc5f['channel']===_0x69c67c[_0x677e('0x39')]){_0xa0df7d=!![];}if(_0x5ddc5f[_0x677e('0x65')][_0x677e('0x41')]){_0x50c688=_[_0x677e('0x66')](_0x5ddc5f[_0x677e('0x65')],this[_0x677e('0x67')](_0x69c67c,_0x5ddc5f['channel']));}if(_0x5ddc5f[_0x677e('0x68')][_0x677e('0x41')]){_0x2affc1=_[_0x677e('0x69')](_0x5ddc5f['AnyConditions'],this[_0x677e('0x67')](_0x69c67c,_0x5ddc5f[_0x677e('0x6a')]));}return _0xa0df7d&&_0x50c688&&_0x2affc1;};Trigger[_0x677e('0x35')][_0x677e('0x67')]=function(_0x2298c8,_0x14a637){return function(_0x1bc37f){switch(_0x1bc37f[_0x677e('0x6b')]){case'account':if(_0x2298c8[_0x677e('0x6a')]===_0x14a637){if(_0x14a637===_0x677e('0x6c')){return _0x2298c8[_0x677e('0x6d')]?operators[_0x1bc37f[_0x677e('0x6e')]](Number(_0x1bc37f[_0x677e('0x6f')]),_0x2298c8['ChatWebsiteId']):![];}else{return _0x2298c8[_[_0x677e('0x70')](_0x14a637)+_0x677e('0x71')]?operators[_0x1bc37f[_0x677e('0x6e')]](Number(_0x1bc37f[_0x677e('0x6f')]),_0x2298c8[_['upperFirst'](_0x14a637)+_0x677e('0x71')]):![];}}break;case _0x677e('0x72'):case _0x677e('0x73'):if(_0x2298c8[_0x677e('0x6a')]===_0x14a637){return _0x2298c8[_0x677e('0x74')]?operators[_0x1bc37f[_0x677e('0x6e')]](_0x1bc37f[_0x677e('0x6f')],_0x2298c8[_0x677e('0x74')]):![];}break;case _0x677e('0x75'):return _0x2298c8[_0x677e('0x75')]?operators[_0x1bc37f[_0x677e('0x6e')]](_0x1bc37f['value'],_0x2298c8['queue']):![];case _0x677e('0x76'):return _0x2298c8[_0x677e('0x77')]?operators[_0x1bc37f[_0x677e('0x6e')]](_0x1bc37f[_0x677e('0x6f')],_0x2298c8[_0x677e('0x77')]):![];case _0x677e('0x78'):return _0x2298c8['lastevent']?operators[_0x1bc37f[_0x677e('0x6e')]](_0x1bc37f[_0x677e('0x6f')],_0x2298c8[_0x677e('0x78')]):![];case _0x677e('0x60'):return _0x2298c8[_0x677e('0x60')]?operators[_0x1bc37f[_0x677e('0x6e')]](_0x1bc37f['value'],_0x2298c8[_0x677e('0x60')]):![];case'mailSubstatus':if(_0x1bc37f['value']===_0x677e('0x79'))_0x1bc37f['value']=null;return typeof _0x2298c8[_0x677e('0x7a')]!=='undefined'?operators[_0x1bc37f['operator']](_0x1bc37f[_0x677e('0x6f')],_0x2298c8['substatus']):![];case _0x677e('0x7b'):if(_0x2298c8[_0x677e('0x6a')]===_0x14a637){return _0x1bc37f['value']===_0x677e('0x7c')&&_0x1bc37f[_0x677e('0x6e')]===_0x677e('0x7d')?!![]:![];}break;}return![];};};module[_0x677e('0x7e')]=Trigger;
\ No newline at end of file
index 5337b1a..ab0493c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x2da79a,_0x4e4ead){var _0x57001a=function(_0x4725e3){while(--_0x4725e3){_0x2da79a['push'](_0x2da79a['shift']());}};_0x57001a(++_0x4e4ead);}(_0x3e74,0x175));var _0x43e7=function(_0x3636f9,_0x3b4d03){_0x3636f9=_0x3636f9-0x0;var _0x1e19c2=_0x3e74[_0x3636f9];return _0x1e19c2;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});};
\ No newline at end of file
+var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x543ecd,_0x1bc4d5){var _0x286419=function(_0x45407e){while(--_0x45407e){_0x543ecd['push'](_0x543ecd['shift']());}};_0x286419(++_0x1bc4d5);}(_0x814b,0x1a2));var _0xb814=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0x814b[_0x546aaf];return _0x1cbf6d;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});};
\ No newline at end of file
index 1a8a26e..ace7c6a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x07f2=[']\x20Agent\x20found\x20','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','length','userId','outbound','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','telephone1','contacts?$select=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','picklist','type','nameField','customField','indexOf','content','incidents','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','assign','ticketType','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data5','POST','clientId','clientSecret','catch','error',']\x20Wrong\x20credentials!','message','then','GET','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','internalemailaddress','isdisabled','toUpperCase'];(function(_0x3196c1,_0x5566ea){var _0x2eacbc=function(_0x251b4f){while(--_0x251b4f){_0x3196c1['push'](_0x3196c1['shift']());}};_0x2eacbc(++_0x5566ea);}(_0x07f2,0xb6));var _0x207f=function(_0x460b9a,_0x3c5dc6){_0x460b9a=_0x460b9a-0x0;var _0xc888d6=_0x07f2[_0x460b9a];return _0xc888d6;};'use strict';var _=require(_0x207f('0x0'));var rp=require(_0x207f('0x1'));var util=require(_0x207f('0x2'));var intUtil=require('./util');var md5=require(_0x207f('0x3'));var Redis=require(_0x207f('0x4'));var logger=require(_0x207f('0x5'))(_0x207f('0x6'));var config=require(_0x207f('0x7'));config[_0x207f('0x8')]=_[_0x207f('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x207f('0xa'))(new Redis(config[_0x207f('0x8')]));function getAuthToken(_0x281f2a,_0x2b29b5,_0x4516b4){if(_0x281f2a[_0x207f('0xb')]){_0x281f2a[_0x207f('0xc')]=_0x281f2a[_0x207f('0xd')][_0x207f('0xe')];_0x281f2a[_0x207f('0xf')]=_0x281f2a['CloudProvider']['data2'];return Promise['resolve'](_0x281f2a['CloudProvider'][_0x207f('0x10')]);}var _0x505dd9={'method':_0x207f('0x11'),'uri':_0x2b29b5,'form':{'client_id':_0x281f2a[_0x207f('0x12')],'resource':_0x281f2a['remoteUri'],'username':_0x281f2a['username'],'password':_0x281f2a['password'],'grant_type':'password','client_secret':_0x281f2a[_0x207f('0x13')]},'json':!![]};return rp(_0x505dd9)['then'](function(_0x8fa02){return _0x8fa02['access_token'];})[_0x207f('0x14')](function(_0x3e61a4){logger[_0x207f('0x15')]('['+[_0x4516b4['toUpperCase']()]+_0x207f('0x16'));return _0x3e61a4[_0x207f('0x17')];});}function getUser(_0x5daa2f,_0x42b7dd,_0x42dd71,_0x263ba5,_0x2505a6,_0x515758){return new Promise(function(_0x5823b8,_0x190cbf){return getAuthToken(_0x42b7dd,_0x263ba5,_0x515758)[_0x207f('0x18')](function(_0x19b79d){var _0x17dcb4={'method':_0x207f('0x19'),'uri':_0x2505a6+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x207f('0x1a')+_0x19b79d,'OData-Version':_0x207f('0x1b')},'json':!![]};return rp(_0x17dcb4);})[_0x207f('0x18')](function(_0x242f6d){var _0x31f728=_0x242f6d[_0x207f('0x1c')];var _0xc2f81=![];var _0x57aed2=null;if(!_[_0x207f('0x1d')](_0x42dd71)){if(intUtil[_0x207f('0x1e')](_0x42dd71[_0x207f('0x1f')])){_0x5daa2f[_0x207f('0x20')]=_0x42dd71[_0x207f('0x1f')];for(_0x57aed2=0x0;_0x57aed2<_0x31f728['length'];_0x57aed2++){if(_0x31f728[_0x57aed2][_0x207f('0x21')]===_0x42dd71[_0x207f('0x1f')]&&!_0x31f728[_0x57aed2][_0x207f('0x22')]){_0xc2f81=!![];logger['info']('['+[_0x515758[_0x207f('0x23')]()]+_0x207f('0x24')+_0x31f728[_0x57aed2][_0x207f('0x25')]+'!');_0x5daa2f['userId']=_0x31f728[_0x57aed2][_0x207f('0x25')];}}}}if(!_0xc2f81){logger[_0x207f('0x26')]('['+[_0x515758[_0x207f('0x23')]()]+_0x207f('0x27'));_0x5daa2f['userEmail']=_0x42b7dd[_0x207f('0x28')];for(_0x57aed2=0x0;_0x57aed2<_0x31f728[_0x207f('0x29')];_0x57aed2++){if(_0x31f728[_0x57aed2][_0x207f('0x21')]===_0x42b7dd['username']){_0x5daa2f[_0x207f('0x2a')]=_0x31f728[_0x57aed2][_0x207f('0x25')];}}}_0x5823b8(_0x5daa2f);})[_0x207f('0x14')](function(_0x3d7921){_0x190cbf(_0x3d7921[_0x207f('0x17')]);});});}function createEndUser(_0x48cbd3,_0x31b912,_0x3ccfab,_0x59a21f,_0x2e5a7a,_0x48f027,_0x449e59){return new Promise(function(_0x23d5f9,_0x50cadd){return getAuthToken(_0x31b912,_0x3ccfab,_0x48f027)['then'](function(_0x43b5c4){var _0x380047=_0x48f027['toLowerCase']()===_0x207f('0x2b')?_0x2e5a7a['destcalleridnum']:_0x2e5a7a[_0x207f('0x2c')];var _0x3cb582={'method':_0x207f('0x11'),'uri':_0x59a21f+_0x207f('0x2d'),'body':{'fullname':_0x380047,'firstname':_0x380047,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x207f('0x2e')+_0x48cbd3[_0x207f('0x2a')]+')'},'headers':{'Authorization':_0x207f('0x1a')+_0x43b5c4,'OData-Version':_0x207f('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x3cb582[_0x207f('0x2f')][_0x449e59]=_0x380047;return rp(_0x3cb582);})[_0x207f('0x18')](function(_0x318a6c){var _0x411a1c=_0x318a6c[_0x207f('0x30')][_0x207f('0x31')];var _0x4ac211=_0x411a1c[_0x207f('0x32')](_0x411a1c[_0x207f('0x33')]('(')+0x1,_0x411a1c[_0x207f('0x33')](')'));_0x48cbd3[_0x207f('0x34')]=_0x4ac211;_0x23d5f9(_0x48cbd3);})['catch'](function(_0x532908){_0x50cadd(_0x532908[_0x207f('0x17')]);});});}function getEndUser(_0x1102dc,_0x4888e4,_0x248212,_0x4f9fe3,_0x415057,_0x181a65,_0x19c668,_0x3b692e){var _0x200ca7=_0x181a65[_0x207f('0x35')]()===_0x207f('0x2b')?_0x415057['destcalleridnum']:_0x415057[_0x207f('0x2c')];return getAuthToken(_0x4888e4,_0x248212,_0x181a65)[_0x207f('0x18')](function(_0x5695cf){_0x3b692e=_0x3b692e?_0x3b692e:_0x207f('0x36');var _0x1e1a83={'method':_0x207f('0x19'),'uri':_0x4f9fe3+_0x207f('0x37')+_0x3b692e+'&$filter='+_0x3b692e+_0x207f('0x38')+_0x200ca7[_0x207f('0x39')]('+',_0x207f('0x3a'))+'\x27','headers':{'Authorization':_0x207f('0x1a')+_0x5695cf,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1e1a83);})[_0x207f('0x18')](function(_0x5b2dd3){var _0x44c3c9=![];if(!_0x5b2dd3)return _0x44c3c9;var _0x1db1bb=_0x5b2dd3[_0x207f('0x1c')];for(var _0x3bfc38=0x0;_0x3bfc38<_0x1db1bb['length'];_0x3bfc38++){if(_0x1db1bb[_0x3bfc38][_0x3b692e]===_0x200ca7){_0x44c3c9=!![];_0x1102dc[_0x207f('0x34')]=_0x1db1bb[_0x3bfc38][_0x207f('0x3b')];}}return _0x44c3c9;})[_0x207f('0x18')](function(_0x30d447){if(_0x30d447)return _0x1102dc;if(_0x19c668===_0x207f('0x3c')){logger[_0x207f('0x26')]('['+[_0x181a65[_0x207f('0x23')]()]+_0x207f('0x3d'));return _0x1102dc;}return createEndUser(_0x1102dc,_0x4888e4,_0x248212,_0x4f9fe3,_0x415057,_0x181a65,_0x3b692e)['then'](function(_0x46db65){logger[_0x207f('0x26')]('['+[_0x181a65[_0x207f('0x23')]()]+_0x207f('0x3e'),_0x46db65[_0x207f('0x34')]);return _0x46db65;});});}function getCustomFields(_0x48906d,_0x301082,_0x2ec741){var _0x5763d6={};if(_0x48906d[_0x207f('0x29')]>0x0){_['forEach'](_0x48906d,function(_0x2a2155){if(_[_0x207f('0x3f')](['string',_0x207f('0x40')],_0x2a2155[_0x207f('0x41')])&&_0x2a2155[_0x207f('0x42')]&&!_0x2a2155[_0x207f('0x43')]){var _0x1e9343=_0x2a2155['idField'][_0x207f('0x35')]();var _0x5736f4=_0x1e9343[_0x207f('0x32')](0x0,_0x1e9343['indexOf']('_'));var _0x3240ae=_0x1e9343[_0x207f('0x32')](_0x1e9343[_0x207f('0x44')]('_')+0x1);if(_0x5736f4===_0x2ec741){_0x5763d6[_0x3240ae]=_0x2a2155[_0x207f('0x45')];}}});}return _0x5763d6;}function getTicket(_0x4c4256,_0x37126b,_0x503d6f,_0x26d6ea,_0x1449c6,_0x5f24f3,_0x3e7cde){return new Promise(function(_0x1604e9,_0x5d8449){var _0x3de070;return getAuthToken(_0x37126b,_0x503d6f,_0x3e7cde)[_0x207f('0x18')](function(_0x3b9856){if(_0x5f24f3['ticketType']==='incident'){_0x3de070={'method':_0x207f('0x11'),'uri':_0x26d6ea+_0x207f('0x46'),'body':Object['assign']({},{'title':intUtil[_0x207f('0x47')](_0x5f24f3[_0x207f('0x48')],_0x1449c6,'\x20'),'description':intUtil[_0x207f('0x47')](_0x5f24f3[_0x207f('0x49')],_0x1449c6,'\x0a'),'customerid_contact@odata.bind':_0x4c4256['enduserId']?_0x207f('0x4a')+_0x4c4256[_0x207f('0x34')]+')':undefined,'ownerid@odata.bind':_0x207f('0x2e')+_0x4c4256[_0x207f('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x5f24f3[_0x207f('0x4b')],_0x1449c6,_0x5f24f3['ticketType'])),'headers':{'Authorization':_0x207f('0x1a')+_0x3b9856,'OData-Version':_0x207f('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5f24f3['ticketType']===_0x207f('0x4c')){var _0x5376eb=_0x4c4256[_0x207f('0x34')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x4c4256[_0x207f('0x2a')]+')','participationtypemask':_0x4c4256[_0x207f('0x4d')]===_0x207f('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x207f('0x4a')+_0x4c4256[_0x207f('0x34')]+')','participationtypemask':_0x4c4256[_0x207f('0x4d')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x207f('0x2e')+_0x4c4256[_0x207f('0x2a')]+')','participationtypemask':_0x4c4256['callDirection']==='queue'?0x2:0x1}];_0x3de070={'method':_0x207f('0x11'),'uri':_0x26d6ea+_0x207f('0x4f'),'body':Object[_0x207f('0x50')]({},{'subject':intUtil[_0x207f('0x47')](_0x5f24f3[_0x207f('0x48')],_0x1449c6,'\x20'),'phonenumber':String(_0x1449c6[_0x207f('0x2c')]),'description':intUtil[_0x207f('0x47')](_0x5f24f3[_0x207f('0x49')],_0x1449c6,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4c4256[_0x207f('0x34')]?'/contacts('+_0x4c4256[_0x207f('0x34')]+')':undefined,'ownerid@odata.bind':_0x207f('0x2e')+_0x4c4256['userId']+')','directioncode':_0x4c4256[_0x207f('0x4d')]===_0x207f('0x4e')?![]:!![],'phonecall_activity_parties':_0x5376eb},getCustomFields(_0x5f24f3[_0x207f('0x4b')],_0x1449c6,_0x5f24f3[_0x207f('0x51')])),'headers':{'Authorization':'Bearer\x20'+_0x3b9856,'OData-Version':_0x207f('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3de070);})['then'](function(_0x3de405){var _0x535cda=_0x3de405[_0x207f('0x30')]['odata-entityid'];var _0x3c1cb7=_0x535cda[_0x207f('0x32')](_0x535cda[_0x207f('0x33')]('(')+0x1,_0x535cda[_0x207f('0x33')](')'));_0x4c4256['ticketId']=_0x3c1cb7;_0x1604e9(_0x4c4256);})[_0x207f('0x14')](function(_0x36bd71){_0x5d8449(_0x36bd71[_0x207f('0x17')]);});});}function emit(_0x4ee642,_0x217145,_0x14b3fb,_0x1b104b){var _0xf8c95b={'uri':util['format'](_0x207f('0x52'),_0x4ee642,_0x14b3fb,_0x1b104b)};io['to'](util[_0x207f('0x53')]('user:%s',_0x217145))['emit'](_0x207f('0x54'),_0xf8c95b);}exports['cs']=function(_0x17d0e2,_0xf74f58,_0x423a06,_0xf145a0,_0x15d0c4,_0x336f41,_0x442f9f,_0x14e699){var _0x57feef={};_0x336f41[_0x207f('0xc')]=_0x336f41[_0x207f('0xb')]?intUtil[_0x207f('0x55')](_0x336f41['CloudProvider']['data7']):intUtil['stripTrailingSlash'](_0x336f41[_0x207f('0xc')]);_0x336f41['serverUrl']=intUtil[_0x207f('0x55')](_0x336f41[_0x207f('0x56')]);_0x57feef[_0x207f('0x4d')]=_0x14e699===_0x207f('0x4e')||_0x14e699===_0x207f('0x57')?_0x207f('0x4e'):'outbound';var _0x4b0a76=_0x336f41['modernAuthentication']?util[_0x207f('0x53')](_0x207f('0x58'),_0x336f41['CloudProvider'][_0x207f('0xe')]):util[_0x207f('0x53')](_0x207f('0x58'),_0x336f41['remoteUri']);var _0x15831f=util[_0x207f('0x53')](_0x207f('0x59'),_0x336f41[_0x207f('0xf')]);var _0xec0e43=util['format'](_0x207f('0x5a'),_0x336f41[_0x207f('0x56')],_0xf74f58['uniqueid'],md5(_0xf74f58[_0x207f('0x5b')]));if(_0x15d0c4&&_0x15d0c4['monitor_format']){logger['info'](_0x207f('0x5c'),'Recording\x20is\x20enabled!');_0xf74f58[_0x207f('0x5d')]=_0xec0e43;}else if(_0x442f9f&&_0x442f9f['recordingFormat']&&_0x442f9f[_0x207f('0x5e')]!==_0x207f('0x5f')){logger['info']('[OUTBOUND]',_0x207f('0x60'));_0xf74f58[_0x207f('0x5d')]=_0xec0e43;}else{_0xf74f58[_0x207f('0x5d')]='';}return getUser(_0x57feef,_0x336f41,_0xf145a0,_0x15831f,_0x4b0a76,_0x14e699)[_0x207f('0x18')](function(_0x1f775e){logger[_0x207f('0x26')]('['+_0x14e699[_0x207f('0x23')]()+_0x207f('0x61'),_0x1f775e[_0x207f('0x2a')]);logger['info']('['+_0x14e699[_0x207f('0x23')]()+_0x207f('0x62'),_0x1f775e[_0x207f('0x20')]);return getEndUser(_0x1f775e,_0x336f41,_0x15831f,_0x4b0a76,_0xf74f58,_0x14e699,_0x423a06[_0x207f('0x63')],_0x423a06[_0x207f('0x64')]);})[_0x207f('0x18')](function(_0x168538){logger['info']('['+_0x14e699[_0x207f('0x23')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x168538[_0x207f('0x34')]);logger[_0x207f('0x26')]('['+_0x14e699[_0x207f('0x23')]()+_0x207f('0x65'),_0xf74f58[_0x207f('0x2c')]);return getTicket(_0x168538,_0x336f41,_0x15831f,_0x4b0a76,_0xf74f58,_0x423a06,_0x14e699);})[_0x207f('0x18')](function(_0x29e32a){logger[_0x207f('0x26')](util[_0x207f('0x53')]('['+_0x14e699['toUpperCase']()+_0x207f('0x66'),_0x423a06['ticketType'],_0x29e32a[_0x207f('0x67')]));logger['info'](util[_0x207f('0x53')]('['+_0x14e699['toUpperCase']()+_0x207f('0x68'),_0x14e699));if(_0x14e699!=='unmanaged'&&_0x423a06['openNewTab']){logger[_0x207f('0x26')]('['+_0x14e699[_0x207f('0x23')]()+']',_0x207f('0x69'));emit(_0x336f41['remoteUri'],_0xf145a0[_0x207f('0x6a')],_0x423a06[_0x207f('0x51')],_0x29e32a[_0x207f('0x67')]);}})[_0x207f('0x14')](function(_0x991dae){logger['error']('['+_0x14e699['toUpperCase']()+_0x207f('0x6b'),_0x991dae[_0x207f('0x17')]);console[_0x207f('0x15')](_0x207f('0x6c'),_0x991dae);});};
\ No newline at end of file
+var _0x5ab4=['contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','idField','indexOf','ticketType','incident','incidents','assign','getString','Fields','phonecall','callDirection','queue','/contacts(','phonecalls','Subjects','Descriptions','ticketId','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20Call\x20direction:\x20%s','openNewTab',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','resolve','CloudProvider','clientId','username','password','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','value','isNil','userEmail','email','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','catch','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0x5ab4,0x105));var _0x45ab=function(_0x5acf5e,_0x5d9eed){_0x5acf5e=_0x5acf5e-0x0;var _0x965d88=_0x5ab4[_0x5acf5e];return _0x965d88;};'use strict';var _=require(_0x45ab('0x0'));var rp=require(_0x45ab('0x1'));var util=require(_0x45ab('0x2'));var intUtil=require(_0x45ab('0x3'));var md5=require('md5');var Redis=require('ioredis');var logger=require(_0x45ab('0x4'))(_0x45ab('0x5'));var config=require(_0x45ab('0x6'));config[_0x45ab('0x7')]=_[_0x45ab('0x8')](config['redis'],{'host':_0x45ab('0x9'),'port':0x18eb});var io=require(_0x45ab('0xa'))(new Redis(config[_0x45ab('0x7')]));function getAuthToken(_0x2e3c2a,_0x4cfbf4,_0x56d5f2){if(_0x2e3c2a[_0x45ab('0xb')]){_0x2e3c2a[_0x45ab('0xc')]=_0x2e3c2a['CloudProvider'][_0x45ab('0xd')];_0x2e3c2a[_0x45ab('0xe')]=_0x2e3c2a['CloudProvider']['data2'];return Promise[_0x45ab('0xf')](_0x2e3c2a[_0x45ab('0x10')]['data5']);}var _0x58815d={'method':'POST','uri':_0x4cfbf4,'form':{'client_id':_0x2e3c2a[_0x45ab('0x11')],'resource':_0x2e3c2a[_0x45ab('0xc')],'username':_0x2e3c2a[_0x45ab('0x12')],'password':_0x2e3c2a[_0x45ab('0x13')],'grant_type':'password','client_secret':_0x2e3c2a['clientSecret']},'json':!![]};return rp(_0x58815d)[_0x45ab('0x14')](function(_0x4215ce){return _0x4215ce[_0x45ab('0x15')];})['catch'](function(_0x44b2da){logger[_0x45ab('0x16')]('['+[_0x56d5f2[_0x45ab('0x17')]()]+_0x45ab('0x18'));return _0x44b2da[_0x45ab('0x19')];});}function getUser(_0x28e895,_0x54a4d7,_0x3ab103,_0x290033,_0x43cc19,_0xe3ea59){return new Promise(function(_0x58354c,_0xc662f4){return getAuthToken(_0x54a4d7,_0x290033,_0xe3ea59)[_0x45ab('0x14')](function(_0x56437e){var _0x1850d5={'method':_0x45ab('0x1a'),'uri':_0x43cc19+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x45ab('0x1b')+_0x56437e,'OData-Version':_0x45ab('0x1c')},'json':!![]};return rp(_0x1850d5);})['then'](function(_0x5c9886){var _0x4813cf=_0x5c9886[_0x45ab('0x1d')];var _0x26c03c=![];var _0x1bc349=null;if(!_[_0x45ab('0x1e')](_0x3ab103)){if(intUtil['validateEmail'](_0x3ab103['email'])){_0x28e895[_0x45ab('0x1f')]=_0x3ab103[_0x45ab('0x20')];for(_0x1bc349=0x0;_0x1bc349<_0x4813cf[_0x45ab('0x21')];_0x1bc349++){if(_0x4813cf[_0x1bc349][_0x45ab('0x22')]===_0x3ab103[_0x45ab('0x20')]&&!_0x4813cf[_0x1bc349][_0x45ab('0x23')]){_0x26c03c=!![];logger['info']('['+[_0xe3ea59[_0x45ab('0x17')]()]+_0x45ab('0x24')+_0x4813cf[_0x1bc349][_0x45ab('0x25')]+'!');_0x28e895[_0x45ab('0x26')]=_0x4813cf[_0x1bc349]['systemuserid'];}}}}if(!_0x26c03c){logger[_0x45ab('0x27')]('['+[_0xe3ea59[_0x45ab('0x17')]()]+_0x45ab('0x28'));_0x28e895['userEmail']=_0x54a4d7['username'];for(_0x1bc349=0x0;_0x1bc349<_0x4813cf[_0x45ab('0x21')];_0x1bc349++){if(_0x4813cf[_0x1bc349][_0x45ab('0x22')]===_0x54a4d7['username']){_0x28e895['userId']=_0x4813cf[_0x1bc349][_0x45ab('0x25')];}}}_0x58354c(_0x28e895);})['catch'](function(_0x1fa0b6){_0xc662f4(_0x1fa0b6[_0x45ab('0x19')]);});});}function createEndUser(_0x44e4ac,_0x5b843f,_0x3eb628,_0x54d6e6,_0x1ff963,_0x203ae0,_0x4b595f){return new Promise(function(_0x4301cb,_0xaddd44){return getAuthToken(_0x5b843f,_0x3eb628,_0x203ae0)['then'](function(_0x3c4e98){var _0x4e96da=_0x203ae0[_0x45ab('0x29')]()===_0x45ab('0x2a')?_0x1ff963[_0x45ab('0x2b')]:_0x1ff963[_0x45ab('0x2c')];var _0x5a0e2e={'method':_0x45ab('0x2d'),'uri':_0x54d6e6+_0x45ab('0x2e'),'body':{'fullname':_0x4e96da,'firstname':_0x4e96da,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x45ab('0x2f')+_0x44e4ac[_0x45ab('0x26')]+')'},'headers':{'Authorization':_0x45ab('0x1b')+_0x3c4e98,'OData-Version':_0x45ab('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x5a0e2e[_0x45ab('0x30')][_0x4b595f]=_0x4e96da;return rp(_0x5a0e2e);})[_0x45ab('0x14')](function(_0x23ee9c){var _0x384310=_0x23ee9c[_0x45ab('0x31')][_0x45ab('0x32')];var _0x137fef=_0x384310[_0x45ab('0x33')](_0x384310['lastIndexOf']('(')+0x1,_0x384310[_0x45ab('0x34')](')'));_0x44e4ac[_0x45ab('0x35')]=_0x137fef;_0x4301cb(_0x44e4ac);})[_0x45ab('0x36')](function(_0x18902f){_0xaddd44(_0x18902f[_0x45ab('0x19')]);});});}function getEndUser(_0x1867c2,_0x713929,_0x415aa6,_0x2526c7,_0x43db12,_0x16f20e,_0x495836,_0x148d1c){var _0x18037b=_0x16f20e[_0x45ab('0x29')]()===_0x45ab('0x2a')?_0x43db12[_0x45ab('0x2b')]:_0x43db12[_0x45ab('0x2c')];return getAuthToken(_0x713929,_0x415aa6,_0x16f20e)[_0x45ab('0x14')](function(_0x32df11){_0x148d1c=_0x148d1c?_0x148d1c:_0x45ab('0x37');var _0xaa94f2={'method':_0x45ab('0x1a'),'uri':_0x2526c7+'contacts?$select='+_0x148d1c+_0x45ab('0x38')+_0x148d1c+_0x45ab('0x39')+_0x18037b[_0x45ab('0x3a')]('+',_0x45ab('0x3b'))+'\x27','headers':{'Authorization':_0x45ab('0x1b')+_0x32df11,'If-None-Match':null,'OData-Version':_0x45ab('0x1c')},'json':!![]};return rp(_0xaa94f2);})[_0x45ab('0x14')](function(_0x26102e){var _0xd7acd0=![];if(!_0x26102e)return _0xd7acd0;var _0x4e50f4=_0x26102e[_0x45ab('0x1d')];for(var _0x284cf6=0x0;_0x284cf6<_0x4e50f4['length'];_0x284cf6++){if(_0x4e50f4[_0x284cf6][_0x148d1c]===_0x18037b){_0xd7acd0=!![];_0x1867c2[_0x45ab('0x35')]=_0x4e50f4[_0x284cf6][_0x45ab('0x3c')];}}return _0xd7acd0;})[_0x45ab('0x14')](function(_0x2b53b1){if(_0x2b53b1)return _0x1867c2;if(_0x495836==='nothing'){logger['info']('['+[_0x16f20e[_0x45ab('0x17')]()]+_0x45ab('0x3d'));return _0x1867c2;}return createEndUser(_0x1867c2,_0x713929,_0x415aa6,_0x2526c7,_0x43db12,_0x16f20e,_0x148d1c)['then'](function(_0xdada0b){logger[_0x45ab('0x27')]('['+[_0x16f20e[_0x45ab('0x17')]()]+_0x45ab('0x3e'),_0xdada0b[_0x45ab('0x35')]);return _0xdada0b;});});}function getCustomFields(_0x5e33d6,_0x595a91,_0x4cc9df){var _0x2a021d={};if(_0x5e33d6[_0x45ab('0x21')]>0x0){_[_0x45ab('0x3f')](_0x5e33d6,function(_0x9e70c9){if(_[_0x45ab('0x40')]([_0x45ab('0x41'),'picklist'],_0x9e70c9[_0x45ab('0x42')])&&_0x9e70c9[_0x45ab('0x43')]&&!_0x9e70c9[_0x45ab('0x44')]){var _0x19727=_0x9e70c9[_0x45ab('0x45')][_0x45ab('0x29')]();var _0x5b4f3c=_0x19727[_0x45ab('0x33')](0x0,_0x19727[_0x45ab('0x46')]('_'));var _0xcc17b0=_0x19727[_0x45ab('0x33')](_0x19727[_0x45ab('0x46')]('_')+0x1);if(_0x5b4f3c===_0x4cc9df){_0x2a021d[_0xcc17b0]=_0x9e70c9['content'];}}});}return _0x2a021d;}function getTicket(_0x461adb,_0x3cc61e,_0x34a4d6,_0x5afff2,_0xfe96d0,_0x1135ac,_0x3e8b5e){return new Promise(function(_0x42a212,_0x5b47d3){var _0x5423f5;return getAuthToken(_0x3cc61e,_0x34a4d6,_0x3e8b5e)['then'](function(_0x46c44c){if(_0x1135ac[_0x45ab('0x47')]===_0x45ab('0x48')){_0x5423f5={'method':'POST','uri':_0x5afff2+_0x45ab('0x49'),'body':Object[_0x45ab('0x4a')]({},{'title':intUtil[_0x45ab('0x4b')](_0x1135ac['Subjects'],_0xfe96d0,'\x20'),'description':intUtil[_0x45ab('0x4b')](_0x1135ac['Descriptions'],_0xfe96d0,'\x0a'),'customerid_contact@odata.bind':_0x461adb[_0x45ab('0x35')]?'/contacts('+_0x461adb[_0x45ab('0x35')]+')':undefined,'ownerid@odata.bind':_0x45ab('0x2f')+_0x461adb['userId']+')','caseorigincode':'1'},getCustomFields(_0x1135ac[_0x45ab('0x4c')],_0xfe96d0,_0x1135ac['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x46c44c,'OData-Version':_0x45ab('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1135ac[_0x45ab('0x47')]===_0x45ab('0x4d')){var _0x12c2f7=_0x461adb[_0x45ab('0x35')]?[{'partyid_systemuser@odata.bind':_0x45ab('0x2f')+_0x461adb[_0x45ab('0x26')]+')','participationtypemask':_0x461adb[_0x45ab('0x4e')]===_0x45ab('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x45ab('0x50')+_0x461adb['enduserId']+')','participationtypemask':_0x461adb[_0x45ab('0x4e')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x45ab('0x2f')+_0x461adb['userId']+')','participationtypemask':_0x461adb['callDirection']===_0x45ab('0x4f')?0x2:0x1}];_0x5423f5={'method':_0x45ab('0x2d'),'uri':_0x5afff2+_0x45ab('0x51'),'body':Object[_0x45ab('0x4a')]({},{'subject':intUtil['getString'](_0x1135ac[_0x45ab('0x52')],_0xfe96d0,'\x20'),'phonenumber':String(_0xfe96d0[_0x45ab('0x2c')]),'description':intUtil[_0x45ab('0x4b')](_0x1135ac[_0x45ab('0x53')],_0xfe96d0,'\x0a'),'regardingobjectid_contact@odata.bind':_0x461adb[_0x45ab('0x35')]?'/contacts('+_0x461adb['enduserId']+')':undefined,'ownerid@odata.bind':_0x45ab('0x2f')+_0x461adb[_0x45ab('0x26')]+')','directioncode':_0x461adb[_0x45ab('0x4e')]===_0x45ab('0x4f')?![]:!![],'phonecall_activity_parties':_0x12c2f7},getCustomFields(_0x1135ac[_0x45ab('0x4c')],_0xfe96d0,_0x1135ac[_0x45ab('0x47')])),'headers':{'Authorization':_0x45ab('0x1b')+_0x46c44c,'OData-Version':_0x45ab('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5423f5);})[_0x45ab('0x14')](function(_0x51441a){var _0x90555=_0x51441a['headers']['odata-entityid'];var _0x2d8577=_0x90555[_0x45ab('0x33')](_0x90555[_0x45ab('0x34')]('(')+0x1,_0x90555[_0x45ab('0x34')](')'));_0x461adb[_0x45ab('0x54')]=_0x2d8577;_0x42a212(_0x461adb);})['catch'](function(_0xedca08){_0x5b47d3(_0xedca08[_0x45ab('0x19')]);});});}function emit(_0x39ee29,_0x2931fe,_0x389ba4,_0x140195){var _0x58af16={'uri':util[_0x45ab('0x55')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x39ee29,_0x389ba4,_0x140195)};io['to'](util['format'](_0x45ab('0x56'),_0x2931fe))['emit'](_0x45ab('0x57'),_0x58af16);}exports['cs']=function(_0x3807e3,_0x3925cd,_0x5cb830,_0xe6a9f5,_0x36f804,_0xfa96e6,_0x44716a,_0x3e980a){var _0x121e71={};_0xfa96e6[_0x45ab('0xc')]=_0xfa96e6[_0x45ab('0xb')]?intUtil[_0x45ab('0x58')](_0xfa96e6[_0x45ab('0x10')][_0x45ab('0xd')]):intUtil[_0x45ab('0x58')](_0xfa96e6[_0x45ab('0xc')]);_0xfa96e6[_0x45ab('0x59')]=intUtil[_0x45ab('0x58')](_0xfa96e6[_0x45ab('0x59')]);_0x121e71[_0x45ab('0x4e')]=_0x3e980a===_0x45ab('0x4f')||_0x3e980a===_0x45ab('0x5a')?_0x45ab('0x4f'):_0x45ab('0x2a');var _0x3b61ca=_0xfa96e6[_0x45ab('0xb')]?util[_0x45ab('0x55')](_0x45ab('0x5b'),_0xfa96e6[_0x45ab('0x10')][_0x45ab('0xd')]):util[_0x45ab('0x55')](_0x45ab('0x5b'),_0xfa96e6[_0x45ab('0xc')]);var _0x2d049c=util[_0x45ab('0x55')]('https://login.microsoftonline.com/%s/oauth2/token',_0xfa96e6[_0x45ab('0xe')]);var _0x3b2675=util[_0x45ab('0x55')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xfa96e6[_0x45ab('0x59')],_0x3925cd[_0x45ab('0x5c')],md5(_0x3925cd[_0x45ab('0x5c')]));if(_0x36f804&&_0x36f804[_0x45ab('0x5d')]){logger[_0x45ab('0x27')](_0x45ab('0x5e'),_0x45ab('0x5f'));_0x3925cd[_0x45ab('0x60')]=_0x3b2675;}else if(_0x44716a&&_0x44716a[_0x45ab('0x61')]&&_0x44716a[_0x45ab('0x61')]!==_0x45ab('0x62')){logger[_0x45ab('0x27')](_0x45ab('0x63'),_0x45ab('0x5f'));_0x3925cd['recordingURL']=_0x3b2675;}else{_0x3925cd['recordingURL']='';}return getUser(_0x121e71,_0xfa96e6,_0xe6a9f5,_0x2d049c,_0x3b61ca,_0x3e980a)['then'](function(_0x36ab58){logger[_0x45ab('0x27')]('['+_0x3e980a['toUpperCase']()+_0x45ab('0x64'),_0x36ab58[_0x45ab('0x26')]);logger[_0x45ab('0x27')]('['+_0x3e980a[_0x45ab('0x17')]()+_0x45ab('0x65'),_0x36ab58['userEmail']);return getEndUser(_0x36ab58,_0xfa96e6,_0x2d049c,_0x3b61ca,_0x3925cd,_0x3e980a,_0x5cb830['moduleCreate'],_0x5cb830[_0x45ab('0x66')]);})[_0x45ab('0x14')](function(_0xc11ee5){logger[_0x45ab('0x27')]('['+_0x3e980a[_0x45ab('0x17')]()+_0x45ab('0x67'),_0xc11ee5['enduserId']);logger[_0x45ab('0x27')]('['+_0x3e980a[_0x45ab('0x17')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x3925cd[_0x45ab('0x2c')]);return getTicket(_0xc11ee5,_0xfa96e6,_0x2d049c,_0x3b61ca,_0x3925cd,_0x5cb830,_0x3e980a);})['then'](function(_0x2b4094){logger[_0x45ab('0x27')](util['format']('['+_0x3e980a[_0x45ab('0x17')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x5cb830['ticketType'],_0x2b4094['ticketId']));logger[_0x45ab('0x27')](util['format']('['+_0x3e980a[_0x45ab('0x17')]()+_0x45ab('0x68'),_0x3e980a));if(_0x3e980a!==_0x45ab('0x5a')&&_0x5cb830[_0x45ab('0x69')]){logger[_0x45ab('0x27')]('['+_0x3e980a[_0x45ab('0x17')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0xfa96e6['remoteUri'],_0xe6a9f5['name'],_0x5cb830['ticketType'],_0x2b4094['ticketId']);}})[_0x45ab('0x36')](function(_0x506292){logger[_0x45ab('0x16')]('['+_0x3e980a[_0x45ab('0x17')]()+_0x45ab('0x6a'),_0x506292[_0x45ab('0x19')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x506292);});};
\ No newline at end of file
index 96a6079..acba9b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdf12=['Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','POST','then','%s/api/v2/agents','remoteUri','Agent\x20found!','find','contact','email','format','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','forEach','string','picklist','type','nameField','customField','toLowerCase','includes','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','user:%s','trigger:browser:url','catch','unmanaged','lastevent','lodash','request-promise','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','merge','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','Descriptions','<br>','Tags','name'];(function(_0x5bb4f7,_0x41a0ec){var _0x5c3cb6=function(_0xf1b5bb){while(--_0xf1b5bb){_0x5bb4f7['push'](_0x5bb4f7['shift']());}};_0x5c3cb6(++_0x41a0ec);}(_0xdf12,0xfe));var _0x2df1=function(_0x201c65,_0x4b985c){_0x201c65=_0x201c65-0x0;var _0x35b044=_0xdf12[_0x201c65];return _0x35b044;};'use strict';var _=require(_0x2df1('0x0'));var rp=require(_0x2df1('0x1'));var md5=require('md5');var util=require(_0x2df1('0x2'));var Redis=require('ioredis');var intUtil=require(_0x2df1('0x3'));var config=require(_0x2df1('0x4'));var logger=require(_0x2df1('0x5'))(_0x2df1('0x6'));config[_0x2df1('0x7')]=_[_0x2df1('0x8')](config[_0x2df1('0x7')],{'host':_0x2df1('0x9'),'port':0x18eb});var io=require(_0x2df1('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0x2df1('0xb'),'Accept':_0x2df1('0xb')};function emit(_0x30c4fd,_0x57170b,_0x5820ef){io['to'](_0x30c4fd)['emit'](_0x57170b,_0x5820ef);}function getTicket(_0x4af593,_0x147041,_0x3bde03,_0x3893e9,_0xc7d77d){logger[_0x2df1('0xc')]('Creating\x20new\x20ticket...');var _0x1fbe50=_[_0x2df1('0xd')]({'responder_id':_0x147041['id'],'requester_id':_0x3bde03['id'],'name':util['format'](_0x2df1('0xe'),_0xc7d77d[_0x2df1('0xf')]),'phone':_0xc7d77d[_0x2df1('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x3893e9[_0x2df1('0x11')],_0xc7d77d,'\x20'),'description':intUtil['getString'](_0x3893e9[_0x2df1('0x12')],_0xc7d77d,_0x2df1('0x13')),'tags':getTags(_0x3893e9[_0x2df1('0x14')],_0x2df1('0x15'))},getCustomFields(_0x3893e9[_0x2df1('0x16')],_0xc7d77d));_0x1fbe50['custom_fields']=_[_0x2df1('0x17')](_[_0x2df1('0x18')](_0x1fbe50[_0x2df1('0x19')],'id'),_0x2df1('0x1a'));return request({'uri':util['format'](_0x2df1('0x1b'),_0x4af593['remoteUri']),'method':_0x2df1('0x1c'),'body':_0x1fbe50})[_0x2df1('0x1d')](function(_0x5a14de){logger[_0x2df1('0xc')]('Ticket\x20created!');return _0x5a14de;});}function getUser(_0x3bd320,_0x9ecd93){if(intUtil['validateEmail'](_0x9ecd93)){return request({'uri':util['format'](_0x2df1('0x1e'),_0x3bd320[_0x2df1('0x1f')]),'qs':{'email':_0x9ecd93}})[_0x2df1('0x1d')](function(_0x559c19){if(_0x559c19['length']){logger[_0x2df1('0xc')](_0x2df1('0x20'));return _[_0x2df1('0x21')](_0x559c19,function(_0x2bf4f2){return _0x2bf4f2[_0x2df1('0x22')][_0x2df1('0x23')]===_0x9ecd93;});}else{logger[_0x2df1('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2df1('0x24')](_0x2df1('0x25'),_0x3bd320[_0x2df1('0x1f')])})[_0x2df1('0x1d')](function(_0x2df617){logger[_0x2df1('0xc')](_0x2df1('0x26'));return _0x2df617;});}});}else{logger[_0x2df1('0xc')](_0x2df1('0x27'));return request({'uri':util[_0x2df1('0x24')](_0x2df1('0x25'),_0x3bd320['remoteUri'])})[_0x2df1('0x1d')](function(_0x108578){logger[_0x2df1('0xc')](_0x2df1('0x26'));return _0x108578;});}}function getEndUser(_0x23000a,_0x3fffd3,_0x1396ec){logger['info'](_0x2df1('0x28'),_0x1396ec);return request({'uri':util[_0x2df1('0x24')]('%s/api/v2/contacts',_0x23000a[_0x2df1('0x1f')]),'qs':{'phone':_0x1396ec}})[_0x2df1('0x1d')](function(_0x19741e){if(_0x19741e[_0x2df1('0x29')]){logger[_0x2df1('0xc')]('Enduser\x20found!');return _[_0x2df1('0x21')](_0x19741e,{'phone':_0x1396ec});}else{logger['info'](_0x2df1('0x2a'));return request({'uri':util[_0x2df1('0x24')]('%s/api/v2/contacts',_0x23000a[_0x2df1('0x1f')]),'method':'POST','body':{'name':_0x3fffd3,'phone':_0x1396ec}})[_0x2df1('0x1d')](function(_0x39e049){logger[_0x2df1('0xc')]('Enduser\x20created.');return _0x39e049;});}});}function getAuth(_0x33c143){return util[_0x2df1('0x24')](_0x2df1('0x2b'),new Buffer(_0x33c143['apiKey']+':X')[_0x2df1('0x2c')](_0x2df1('0x2d')));}function request(_0x3ff353){logger[_0x2df1('0x2e')](_0x2df1('0x2f'),JSON[_0x2df1('0x30')](_0x3ff353));return rp(_['defaults'](_0x3ff353,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3adb01,_0x22afff){var _0x495f36=[];if(_0x3adb01&&_0x3adb01[_0x2df1('0x29')]>0x0){_0x495f36=_[_0x2df1('0x31')](_0x3adb01,_0x22afff);}return _0x495f36;}function getCustomFields(_0x303338,_0xc8a142){var _0x3fb646=[];var _0x32fd39={'custom_fields':[]};if(_0x303338[_0x2df1('0x29')]>0x0){_[_0x2df1('0x32')](_0x303338,function(_0x5a8f87){if(_['includes']([_0x2df1('0x33'),_0x2df1('0x34')],_0x5a8f87[_0x2df1('0x35')])&&_0x5a8f87[_0x2df1('0x36')]&&!_0x5a8f87[_0x2df1('0x37')]){_0x32fd39[_0x5a8f87['nameField'][_0x2df1('0x38')]()]=_0x5a8f87['content'][_0x2df1('0x2c')]();}else if(_[_0x2df1('0x39')]([_0x2df1('0x33'),_0x2df1('0x34')],_0x5a8f87[_0x2df1('0x35')])&&_0x5a8f87[_0x2df1('0x3a')]&&_0x5a8f87[_0x2df1('0x37')]){_0x32fd39[_0x2df1('0x19')][_0x2df1('0x3b')]({'id':_0x5a8f87['idField'],'value':_0x5a8f87['content']['toString']()});}else if(_0x5a8f87[_0x2df1('0x35')]===_0x2df1('0x3c')&&_0x5a8f87['variableName']&&_0x5a8f87[_0x2df1('0x3a')]&&_0x5a8f87[_0x2df1('0x37')]){_0xc8a142[_0x5a8f87['variableName']]&&_0x32fd39['custom_fields'][_0x2df1('0x3b')]({'id':_0x5a8f87[_0x2df1('0x3a')],'value':_0xc8a142[_0x5a8f87[_0x2df1('0x3d')]]['toString']()});}else if(_0x5a8f87[_0x2df1('0x35')]===_0x2df1('0x3e')&&_0x5a8f87[_0x2df1('0x3f')]&&_0x5a8f87[_0x2df1('0x3f')][_0x2df1('0x15')]&&_0x5a8f87[_0x2df1('0x3a')]&&_0x5a8f87[_0x2df1('0x37')]){_0xc8a142[_0x5a8f87[_0x2df1('0x3f')]['name'][_0x2df1('0x38')]()]&&_0x32fd39['custom_fields'][_0x2df1('0x3b')]({'id':_0x5a8f87['idField'],'value':_0xc8a142[_0x5a8f87[_0x2df1('0x3f')]['name']['toLowerCase']()][_0x2df1('0x2c')]()});}});}return _0x32fd39;}exports[_0x2df1('0x40')]=function(_0x4f66a2,_0x4563a4,_0x5cfd22,_0x369c2c,_0x172464,_0x3dbde1){var _0x3869d3,_0x421cbd;_0x3dbde1[_0x2df1('0x1f')]=intUtil[_0x2df1('0x41')](_0x3dbde1[_0x2df1('0x1f')]);_0x3dbde1[_0x2df1('0x42')]=intUtil[_0x2df1('0x41')](_0x3dbde1['serverUrl']);if(_0x172464&&_0x172464[_0x2df1('0x43')]){logger[_0x2df1('0xc')](_0x2df1('0x44'),_0x2df1('0x45'));_0x4563a4[_0x2df1('0x46')]=util['format'](_0x2df1('0x47'),_0x3dbde1[_0x2df1('0x42')],_0x4563a4[_0x2df1('0x48')],md5(_0x4563a4['uniqueid']));}else{_0x4563a4[_0x2df1('0x46')]='';}headers[_0x2df1('0x49')]=getAuth(_0x3dbde1);return getUser(_0x3dbde1,_0x369c2c['email'])[_0x2df1('0x1d')](function(_0xbfd2b7){_0x3869d3=_0xbfd2b7;logger[_0x2df1('0xc')](_0x2df1('0x4a'),_0x3869d3['id']);return getEndUser(_0x3dbde1,_0x4563a4['calleridname'],_0x4563a4['calleridnum']);})[_0x2df1('0x1d')](function(_0x3f3791){_0x421cbd=_0x3f3791;logger[_0x2df1('0xc')](_0x2df1('0x4b'),_0x421cbd['id']);return getTicket(_0x3dbde1,_0x3869d3,_0x421cbd,_0x5cfd22,_0x4563a4);})[_0x2df1('0x1d')](function(_0x1bc39e){if(_0x1bc39e&&_0x1bc39e['id']){logger[_0x2df1('0xc')](_0x2df1('0x4c'));logger[_0x2df1('0xc')](_0x2df1('0x4d'),_0x1bc39e['id']);logger[_0x2df1('0xc')](_0x2df1('0x44'),_0x2df1('0x4e'));emit(util[_0x2df1('0x24')]('user:%s',_0x369c2c['name']),'trigger:browser:url',{'uri':util[_0x2df1('0x24')](_0x2df1('0x4f'),_0x3dbde1[_0x2df1('0x1f')],_0x1bc39e['id'])});}})['catch'](function(_0x1c36f6){logger[_0x2df1('0x50')](_0x2df1('0x44'),JSON[_0x2df1('0x30')](_0x1c36f6));});};exports[_0x2df1('0x51')]=function(_0x46d0fe,_0x42b129,_0xaf3bc7,_0x47ce54,_0x2730c2,_0x31555b,_0x1912a6){var _0x4f673c,_0x1a01ca;_0x31555b[_0x2df1('0x1f')]=intUtil[_0x2df1('0x41')](_0x31555b['remoteUri']);_0x31555b[_0x2df1('0x42')]=intUtil[_0x2df1('0x41')](_0x31555b[_0x2df1('0x42')]);if(_0x1912a6&&_0x1912a6['recordingFormat']&&_0x1912a6[_0x2df1('0x52')]!==_0x2df1('0x53')){logger[_0x2df1('0xc')](_0x2df1('0x54'),_0x2df1('0x45'));_0x42b129[_0x2df1('0x46')]=util[_0x2df1('0x24')](_0x2df1('0x47'),_0x31555b[_0x2df1('0x42')],_0x42b129[_0x2df1('0x48')],md5(_0x42b129['uniqueid']));}headers['Authorization']=getAuth(_0x31555b);return getUser(_0x31555b,_0x47ce54[_0x2df1('0x23')])[_0x2df1('0x1d')](function(_0x384c49){_0x4f673c=_0x384c49;logger[_0x2df1('0xc')](_0x2df1('0x4a'),_0x4f673c['id']);return getEndUser(_0x31555b,_0x42b129[_0x2df1('0x55')],_0x42b129[_0x2df1('0x56')]);})[_0x2df1('0x1d')](function(_0x59d4fd){_0x1a01ca=_0x59d4fd;logger['info'](_0x2df1('0x4b'),_0x1a01ca['id']);return getTicket(_0x31555b,_0x4f673c,_0x1a01ca,_0xaf3bc7,_0x42b129);})[_0x2df1('0x1d')](function(_0x597c91){if(_0x597c91&&_0x597c91['id']){logger[_0x2df1('0xc')](_0x2df1('0x4c'));logger[_0x2df1('0xc')](_0x2df1('0x4d'),_0x597c91['id']);logger[_0x2df1('0xc')](_0x2df1('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x2df1('0x57'),_0x47ce54[_0x2df1('0x15')]),_0x2df1('0x58'),{'uri':util[_0x2df1('0x24')](_0x2df1('0x4f'),_0x31555b[_0x2df1('0x1f')],_0x597c91['id'])});}})[_0x2df1('0x59')](function(_0x5cc180){logger[_0x2df1('0x50')]('[OUTBOUND]',JSON[_0x2df1('0x30')](_0x5cc180));});};exports[_0x2df1('0x5a')]=function(_0x39dbdb,_0x469e1c,_0x59c7f1,_0x27e44a,_0x9883e0,_0x121231){var _0x79ccb4,_0x26c2c7;_0x121231[_0x2df1('0x1f')]=intUtil[_0x2df1('0x41')](_0x121231[_0x2df1('0x1f')]);_0x121231[_0x2df1('0x42')]=intUtil['stripTrailingSlash'](_0x121231[_0x2df1('0x42')]);if(_0x9883e0&&_0x9883e0[_0x2df1('0x43')]){logger[_0x2df1('0xc')]('['+_0x469e1c[_0x2df1('0x5b')]['toUpperCase']()+']',_0x2df1('0x45'));_0x469e1c[_0x2df1('0x46')]=util['format'](_0x2df1('0x47'),_0x121231[_0x2df1('0x42')],_0x469e1c[_0x2df1('0x48')],md5(_0x469e1c[_0x2df1('0x48')]));}else{_0x469e1c[_0x2df1('0x46')]='';}headers[_0x2df1('0x49')]=getAuth(_0x121231);return getUser(_0x121231,'')['then'](function(_0x4252b6){_0x79ccb4=_0x4252b6;logger['info'](_0x2df1('0x4a'),_0x79ccb4['id']);return getEndUser(_0x121231,_0x469e1c[_0x2df1('0xf')],_0x469e1c['calleridnum']);})[_0x2df1('0x1d')](function(_0x3fd686){_0x26c2c7=_0x3fd686;logger[_0x2df1('0xc')](_0x2df1('0x4b'),_0x26c2c7['id']);return getTicket(_0x121231,_0x79ccb4,_0x26c2c7,_0x59c7f1,_0x469e1c);})['then'](function(_0x438129){if(_0x438129){logger[_0x2df1('0xc')](_0x2df1('0x4c'));logger[_0x2df1('0xc')]('The\x20Ticket\x20ID\x20is:',_0x438129['id']);}})['catch'](function(_0x262238){logger[_0x2df1('0x50')]('['+_0x469e1c['lastevent']['toUpperCase']()+']',JSON[_0x2df1('0x30')](_0x262238));});};
\ No newline at end of file
+var _0x9a86=['contact','email','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','stringify','map','forEach','includes','string','type','customField','nameField','content','picklist','idField','variableName','customVariable','Variable','name','toLowerCase','push','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridnum','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','freshdesk','defaults','redis','socket.io-emitter','emit','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','Fields','custom_fields','mapValues','%s/api/v2/tickets','remoteUri','POST','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find'];(function(_0x50f4e9,_0x463507){var _0x504e05=function(_0x183497){while(--_0x183497){_0x50f4e9['push'](_0x50f4e9['shift']());}};_0x504e05(++_0x463507);}(_0x9a86,0x1ea));var _0x69a8=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x9a86[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0x69a8('0x0'));var rp=require(_0x69a8('0x1'));var md5=require(_0x69a8('0x2'));var util=require(_0x69a8('0x3'));var Redis=require(_0x69a8('0x4'));var intUtil=require(_0x69a8('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x69a8('0x6'));config['redis']=_[_0x69a8('0x7')](config[_0x69a8('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x69a8('0x9'))(new Redis(config[_0x69a8('0x8')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x239ed5,_0x2d9c71,_0x191cf2){io['to'](_0x239ed5)[_0x69a8('0xa')](_0x2d9c71,_0x191cf2);}function getTicket(_0x36f9aa,_0x5f151f,_0x2c2ef5,_0x4e104d,_0x596804){logger['info'](_0x69a8('0xb'));var _0x3c5f96=_[_0x69a8('0xc')]({'responder_id':_0x5f151f['id'],'requester_id':_0x2c2ef5['id'],'name':util[_0x69a8('0xd')]('Caller\x20-\x20%s',_0x596804[_0x69a8('0xe')]),'phone':_0x596804[_0x69a8('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x69a8('0x10')](_0x4e104d[_0x69a8('0x11')],_0x596804,'\x20'),'description':intUtil[_0x69a8('0x10')](_0x4e104d[_0x69a8('0x12')],_0x596804,'<br>'),'tags':getTags(_0x4e104d['Tags'],'name')},getCustomFields(_0x4e104d[_0x69a8('0x13')],_0x596804));_0x3c5f96[_0x69a8('0x14')]=_[_0x69a8('0x15')](_['keyBy'](_0x3c5f96['custom_fields'],'id'),'value');return request({'uri':util['format'](_0x69a8('0x16'),_0x36f9aa[_0x69a8('0x17')]),'method':_0x69a8('0x18'),'body':_0x3c5f96})['then'](function(_0x289ea5){logger[_0x69a8('0x19')](_0x69a8('0x1a'));return _0x289ea5;});}function getUser(_0x339101,_0x3ef4b6){if(intUtil[_0x69a8('0x1b')](_0x3ef4b6)){return request({'uri':util[_0x69a8('0xd')](_0x69a8('0x1c'),_0x339101[_0x69a8('0x17')]),'qs':{'email':_0x3ef4b6}})['then'](function(_0x47f2d3){if(_0x47f2d3[_0x69a8('0x1d')]){logger[_0x69a8('0x19')](_0x69a8('0x1e'));return _[_0x69a8('0x1f')](_0x47f2d3,function(_0x2fae32){return _0x2fae32[_0x69a8('0x20')][_0x69a8('0x21')]===_0x3ef4b6;});}else{logger[_0x69a8('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x69a8('0xd')]('%s/api/v2/agents/me',_0x339101[_0x69a8('0x17')])})[_0x69a8('0x22')](function(_0x138862){logger[_0x69a8('0x19')](_0x69a8('0x23'));return _0x138862;});}});}else{logger[_0x69a8('0x19')](_0x69a8('0x24'));return request({'uri':util[_0x69a8('0xd')](_0x69a8('0x25'),_0x339101['remoteUri'])})[_0x69a8('0x22')](function(_0x4fa2f9){logger[_0x69a8('0x19')](_0x69a8('0x23'));return _0x4fa2f9;});}}function getEndUser(_0xb55be3,_0x32eb92,_0x6513ba){logger[_0x69a8('0x19')]('Searching\x20enduser\x20with\x20phone',_0x6513ba);return request({'uri':util[_0x69a8('0xd')](_0x69a8('0x26'),_0xb55be3[_0x69a8('0x17')]),'qs':{'phone':_0x6513ba}})[_0x69a8('0x22')](function(_0x4eeca4){if(_0x4eeca4[_0x69a8('0x1d')]){logger[_0x69a8('0x19')](_0x69a8('0x27'));return _[_0x69a8('0x1f')](_0x4eeca4,{'phone':_0x6513ba});}else{logger[_0x69a8('0x19')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x69a8('0xd')](_0x69a8('0x26'),_0xb55be3[_0x69a8('0x17')]),'method':_0x69a8('0x18'),'body':{'name':_0x32eb92,'phone':_0x6513ba}})[_0x69a8('0x22')](function(_0x41dd47){logger[_0x69a8('0x19')](_0x69a8('0x28'));return _0x41dd47;});}});}function getAuth(_0x5c1e70){return util['format'](_0x69a8('0x29'),new Buffer(_0x5c1e70[_0x69a8('0x2a')]+':X')[_0x69a8('0x2b')](_0x69a8('0x2c')));}function request(_0x53e888){logger[_0x69a8('0x2d')]('[HTTP]',JSON[_0x69a8('0x2e')](_0x53e888));return rp(_[_0x69a8('0x7')](_0x53e888,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3aaaa3,_0x3391a3){var _0x2aea09=[];if(_0x3aaaa3&&_0x3aaaa3[_0x69a8('0x1d')]>0x0){_0x2aea09=_[_0x69a8('0x2f')](_0x3aaaa3,_0x3391a3);}return _0x2aea09;}function getCustomFields(_0x1ed9d7,_0x27132e){var _0x4f08aa=[];var _0x5395f6={'custom_fields':[]};if(_0x1ed9d7[_0x69a8('0x1d')]>0x0){_[_0x69a8('0x30')](_0x1ed9d7,function(_0x3a92f8){if(_[_0x69a8('0x31')]([_0x69a8('0x32'),'picklist'],_0x3a92f8[_0x69a8('0x33')])&&_0x3a92f8['nameField']&&!_0x3a92f8[_0x69a8('0x34')]){_0x5395f6[_0x3a92f8[_0x69a8('0x35')]['toLowerCase']()]=_0x3a92f8[_0x69a8('0x36')]['toString']();}else if(_[_0x69a8('0x31')](['string',_0x69a8('0x37')],_0x3a92f8[_0x69a8('0x33')])&&_0x3a92f8[_0x69a8('0x38')]&&_0x3a92f8['customField']){_0x5395f6[_0x69a8('0x14')]['push']({'id':_0x3a92f8[_0x69a8('0x38')],'value':_0x3a92f8[_0x69a8('0x36')][_0x69a8('0x2b')]()});}else if(_0x3a92f8[_0x69a8('0x33')]==='variable'&&_0x3a92f8['variableName']&&_0x3a92f8[_0x69a8('0x38')]&&_0x3a92f8[_0x69a8('0x34')]){_0x27132e[_0x3a92f8[_0x69a8('0x39')]]&&_0x5395f6[_0x69a8('0x14')]['push']({'id':_0x3a92f8[_0x69a8('0x38')],'value':_0x27132e[_0x3a92f8[_0x69a8('0x39')]][_0x69a8('0x2b')]()});}else if(_0x3a92f8['type']===_0x69a8('0x3a')&&_0x3a92f8['Variable']&&_0x3a92f8[_0x69a8('0x3b')][_0x69a8('0x3c')]&&_0x3a92f8[_0x69a8('0x38')]&&_0x3a92f8['customField']){_0x27132e[_0x3a92f8[_0x69a8('0x3b')]['name'][_0x69a8('0x3d')]()]&&_0x5395f6['custom_fields'][_0x69a8('0x3e')]({'id':_0x3a92f8['idField'],'value':_0x27132e[_0x3a92f8[_0x69a8('0x3b')][_0x69a8('0x3c')][_0x69a8('0x3d')]()][_0x69a8('0x2b')]()});}});}return _0x5395f6;}exports[_0x69a8('0x3f')]=function(_0x15db10,_0x30af76,_0x160788,_0x197f47,_0x37b504,_0x4a4c7d){var _0x33105e,_0x4cdbea;_0x4a4c7d['remoteUri']=intUtil[_0x69a8('0x40')](_0x4a4c7d[_0x69a8('0x17')]);_0x4a4c7d[_0x69a8('0x41')]=intUtil['stripTrailingSlash'](_0x4a4c7d[_0x69a8('0x41')]);if(_0x37b504&&_0x37b504['monitor_format']){logger[_0x69a8('0x19')](_0x69a8('0x42'),_0x69a8('0x43'));_0x30af76[_0x69a8('0x44')]=util[_0x69a8('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a4c7d[_0x69a8('0x41')],_0x30af76['uniqueid'],md5(_0x30af76[_0x69a8('0x45')]));}else{_0x30af76[_0x69a8('0x44')]='';}headers['Authorization']=getAuth(_0x4a4c7d);return getUser(_0x4a4c7d,_0x197f47[_0x69a8('0x21')])[_0x69a8('0x22')](function(_0x3b1c43){_0x33105e=_0x3b1c43;logger['info'](_0x69a8('0x46'),_0x33105e['id']);return getEndUser(_0x4a4c7d,_0x30af76['calleridname'],_0x30af76[_0x69a8('0xf')]);})[_0x69a8('0x22')](function(_0x48ae0b){_0x4cdbea=_0x48ae0b;logger[_0x69a8('0x19')](_0x69a8('0x47'),_0x4cdbea['id']);return getTicket(_0x4a4c7d,_0x33105e,_0x4cdbea,_0x160788,_0x30af76);})['then'](function(_0x261ecb){if(_0x261ecb&&_0x261ecb['id']){logger[_0x69a8('0x19')](_0x69a8('0x1a'));logger[_0x69a8('0x19')](_0x69a8('0x48'),_0x261ecb['id']);logger[_0x69a8('0x19')](_0x69a8('0x42'),_0x69a8('0x49'));emit(util[_0x69a8('0xd')]('user:%s',_0x197f47[_0x69a8('0x3c')]),'trigger:browser:url',{'uri':util[_0x69a8('0xd')](_0x69a8('0x4a'),_0x4a4c7d[_0x69a8('0x17')],_0x261ecb['id'])});}})[_0x69a8('0x4b')](function(_0x249e37){logger[_0x69a8('0x4c')](_0x69a8('0x42'),JSON[_0x69a8('0x2e')](_0x249e37));});};exports['outbound']=function(_0x3ebc0f,_0x3c8c1a,_0x3d6e0f,_0x4cc05a,_0x1204df,_0x32fb32,_0x338f83){var _0x2ee334,_0x41772b;_0x32fb32[_0x69a8('0x17')]=intUtil[_0x69a8('0x40')](_0x32fb32[_0x69a8('0x17')]);_0x32fb32[_0x69a8('0x41')]=intUtil[_0x69a8('0x40')](_0x32fb32[_0x69a8('0x41')]);if(_0x338f83&&_0x338f83[_0x69a8('0x4d')]&&_0x338f83[_0x69a8('0x4d')]!==_0x69a8('0x4e')){logger[_0x69a8('0x19')](_0x69a8('0x4f'),_0x69a8('0x43'));_0x3c8c1a[_0x69a8('0x44')]=util['format'](_0x69a8('0x50'),_0x32fb32['serverUrl'],_0x3c8c1a[_0x69a8('0x45')],md5(_0x3c8c1a[_0x69a8('0x45')]));}headers[_0x69a8('0x51')]=getAuth(_0x32fb32);return getUser(_0x32fb32,_0x4cc05a[_0x69a8('0x21')])['then'](function(_0x4e9c5b){_0x2ee334=_0x4e9c5b;logger[_0x69a8('0x19')]('The\x20User\x20ID\x20is:',_0x2ee334['id']);return getEndUser(_0x32fb32,_0x3c8c1a['destcalleridname'],_0x3c8c1a[_0x69a8('0x52')]);})[_0x69a8('0x22')](function(_0x5e4369){_0x41772b=_0x5e4369;logger[_0x69a8('0x19')]('The\x20Enduser\x20ID\x20is:',_0x41772b['id']);return getTicket(_0x32fb32,_0x2ee334,_0x41772b,_0x3d6e0f,_0x3c8c1a);})[_0x69a8('0x22')](function(_0x370256){if(_0x370256&&_0x370256['id']){logger[_0x69a8('0x19')](_0x69a8('0x1a'));logger[_0x69a8('0x19')](_0x69a8('0x48'),_0x370256['id']);logger['info']('[OUTBOUND]',_0x69a8('0x49'));emit(util[_0x69a8('0xd')]('user:%s',_0x4cc05a[_0x69a8('0x3c')]),_0x69a8('0x53'),{'uri':util[_0x69a8('0xd')](_0x69a8('0x4a'),_0x32fb32[_0x69a8('0x17')],_0x370256['id'])});}})[_0x69a8('0x4b')](function(_0x12a4c2){logger[_0x69a8('0x4c')](_0x69a8('0x4f'),JSON[_0x69a8('0x2e')](_0x12a4c2));});};exports[_0x69a8('0x54')]=function(_0x21addc,_0x10268f,_0x3c5b19,_0x597932,_0x4b0dbc,_0x183ecf){var _0xebeee6,_0x34804f;_0x183ecf['remoteUri']=intUtil[_0x69a8('0x40')](_0x183ecf[_0x69a8('0x17')]);_0x183ecf[_0x69a8('0x41')]=intUtil[_0x69a8('0x40')](_0x183ecf[_0x69a8('0x41')]);if(_0x4b0dbc&&_0x4b0dbc['monitor_format']){logger['info']('['+_0x10268f[_0x69a8('0x55')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x10268f[_0x69a8('0x44')]=util['format'](_0x69a8('0x50'),_0x183ecf['serverUrl'],_0x10268f['uniqueid'],md5(_0x10268f['uniqueid']));}else{_0x10268f[_0x69a8('0x44')]='';}headers[_0x69a8('0x51')]=getAuth(_0x183ecf);return getUser(_0x183ecf,'')['then'](function(_0x215055){_0xebeee6=_0x215055;logger[_0x69a8('0x19')](_0x69a8('0x46'),_0xebeee6['id']);return getEndUser(_0x183ecf,_0x10268f['calleridname'],_0x10268f[_0x69a8('0xf')]);})[_0x69a8('0x22')](function(_0x5a272d){_0x34804f=_0x5a272d;logger[_0x69a8('0x19')]('The\x20Enduser\x20ID\x20is:',_0x34804f['id']);return getTicket(_0x183ecf,_0xebeee6,_0x34804f,_0x3c5b19,_0x10268f);})[_0x69a8('0x22')](function(_0x1e765b){if(_0x1e765b){logger[_0x69a8('0x19')]('Ticket\x20created!');logger[_0x69a8('0x19')]('The\x20Ticket\x20ID\x20is:',_0x1e765b['id']);}})['catch'](function(_0x6dad5d){logger[_0x69a8('0x4c')]('['+_0x10268f[_0x69a8('0x55')][_0x69a8('0x56')]()+']',JSON['stringify'](_0x6dad5d));});};
\ No newline at end of file
index 631e73a..0979340 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xae85=['socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','toUpperCase','message','/api/selector/owners','agentEmail','userEmail','User\x20found:','userId','Admin\x20selected','/api/lookup?q=','&f=','find','contacts','catch','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','error','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','ticketId','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','moment','ioredis','../../../../config/logger','freshsales','redis','defaults'];(function(_0x1de595,_0x275776){var _0x411cc3=function(_0x4d3a45){while(--_0x4d3a45){_0x1de595['push'](_0x1de595['shift']());}};_0x411cc3(++_0x275776);}(_0xae85,0x1d1));var _0x5ae8=function(_0xf0d1c1,_0x529ac4){_0xf0d1c1=_0xf0d1c1-0x0;var _0xa9c7af=_0xae85[_0xf0d1c1];return _0xa9c7af;};'use strict';var _=require(_0x5ae8('0x0'));var rp=require(_0x5ae8('0x1'));var md5=require(_0x5ae8('0x2'));var util=require('util');var moment=require(_0x5ae8('0x3'));var Promise=require('bluebird');var Redis=require(_0x5ae8('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x5ae8('0x5'))(_0x5ae8('0x6'));config[_0x5ae8('0x7')]=_[_0x5ae8('0x8')](config[_0x5ae8('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x5ae8('0x9'))(new Redis(config[_0x5ae8('0x7')]));function getAdminId(_0x53f60c,_0x2ebf2f,_0x5f4daf,_0x3fda69){return new Promise(function(_0x2f8505,_0x417270){var _0x34094a=![];var _0x6ea562={'method':_0x5ae8('0xa'),'uri':_0x3fda69+'/api/selector/owners','json':!![]};_0x6ea562[_0x5ae8('0xb')]=_0x5f4daf;logger[_0x5ae8('0xc')](_0x5ae8('0xd'));return rp(_0x6ea562)[_0x5ae8('0xe')](function(_0x54b05e){if(_0x54b05e){var _0x25f875=_0x54b05e['users'];var _0x4bc6e4=null;for(_0x4bc6e4=0x0;_0x4bc6e4<_0x25f875['length'];_0x4bc6e4++){if(_0x25f875[_0x4bc6e4][_0x5ae8('0xf')]===_0x53f60c[_0x5ae8('0x10')]){_0x53f60c[_0x5ae8('0x11')]=_0x25f875[_0x4bc6e4]['id'];_0x34094a=!![];}}if(_0x34094a){logger['info'](_0x5ae8('0x12'),_0x53f60c[_0x5ae8('0x11')]);_0x2f8505(_0x53f60c);}else{_0x417270({'statusCode':0x194,'message':_0x5ae8('0x13')});}}else{_0x417270({'statusCode':0x194,'message':_0x5ae8('0x13')});}})['catch'](function(_0x3748c0){logger['error']('['+[_0x2ebf2f[_0x5ae8('0x14')]()]+']',_0x3748c0[_0x5ae8('0x15')]);_0x417270(_0x3748c0);});});}function getUser(_0xa58dfc,_0x19de8d,_0x4070d2){return function(_0x21003c){return new Promise(function(_0x36cee3,_0x1f223d){var _0x10eeb6={'method':_0x5ae8('0xa'),'uri':_0x4070d2+_0x5ae8('0x16'),'json':!![]};_0x10eeb6[_0x5ae8('0xb')]=_0x19de8d;logger[_0x5ae8('0xc')]('Getting\x20user\x20list');return rp(_0x10eeb6)[_0x5ae8('0xe')](function(_0x232a94){if(_0x232a94){var _0x14ba31=_0x232a94['users'];var _0x532ca6=![];var _0x70ed94=null;if(_0x21003c[_0x5ae8('0x17')]!==null){logger[_0x5ae8('0xc')]('Getting\x20user\x20with\x20email',_0x21003c[_0x5ae8('0x17')]);_0x21003c[_0x5ae8('0x18')]=_0x21003c[_0x5ae8('0x17')];for(_0x70ed94=0x0;_0x70ed94<_0x14ba31['length'];_0x70ed94++){if(_0x14ba31[_0x70ed94][_0x5ae8('0xf')]===_0x21003c[_0x5ae8('0x17')]){_0x532ca6=!![];_0x21003c['userId']=_0x14ba31[_0x70ed94]['id'];logger['info'](_0x5ae8('0x19'),_0x21003c[_0x5ae8('0x1a')]);}}}if(!_0x532ca6){logger['info'](_0x5ae8('0x1b'));_0x21003c[_0x5ae8('0x18')]=_0x21003c['adminEmail'];_0x21003c[_0x5ae8('0x1a')]=_0x21003c[_0x5ae8('0x11')];_0x532ca6=!![];}if(_0x532ca6){_0x36cee3(_0x21003c);}else{_0x1f223d({'statusCode':0x194,'message':_0x5ae8('0x13')});}}else{_0x1f223d({'statusCode':0x194,'message':_0x5ae8('0x13')});}})['catch'](function(_0x2a8682){logger['error']('['+[_0xa58dfc['toUpperCase']()]+']',_0x2a8682[_0x5ae8('0x15')]);_0x1f223d(_0x2a8682);});});};}function searchContact(_0x449535,_0x38e494,_0x1666b1,_0x402b53){return new Promise(function(_0x6b8d6c,_0x17c361){var _0x522e45={'method':_0x5ae8('0xa'),'headers':_0x38e494,'uri':_0x449535+_0x5ae8('0x1c')+_0x402b53+_0x5ae8('0x1d')+_0x1666b1+'&entities=contact','json':!![]};rp(_0x522e45)[_0x5ae8('0xe')](function(_0x5a9cc1){var _0x33a7f3=_[_0x5ae8('0x1e')](_0x5a9cc1[_0x5ae8('0x1f')][_0x5ae8('0x1f')],[_0x1666b1,_0x402b53]);_0x6b8d6c(_0x33a7f3);})[_0x5ae8('0x20')](function(_0x4b755a){_0x17c361(_0x4b755a);});});}function getEndUser(_0x4f10dc,_0x1309a3,_0x4217b4){return function(_0x3ee20e){return new Promise(function(_0x3e408b,_0x12e155){logger[_0x5ae8('0xc')](util['format'](_0x5ae8('0x21'),_0x3ee20e[_0x5ae8('0x22')]));searchContact(_0x4217b4,_0x1309a3,_0x5ae8('0x23'),_0x3ee20e[_0x5ae8('0x22')])[_0x5ae8('0xe')](function(_0x28e796){if(_0x28e796){_0x3ee20e['endUserId']=_0x28e796['id'];logger[_0x5ae8('0xc')]('Contact\x20found\x20mobile_number:',_0x3ee20e[_0x5ae8('0x24')]);return _0x3e408b(_0x3ee20e);}searchContact(_0x4217b4,_0x1309a3,'work_number',_0x3ee20e[_0x5ae8('0x22')])[_0x5ae8('0xe')](function(_0xf1947){if(_0xf1947){_0x3ee20e[_0x5ae8('0x24')]=_0xf1947['id'];logger[_0x5ae8('0xc')](_0x5ae8('0x25'),_0x3ee20e['endUserId']);return _0x3e408b(_0x3ee20e);}createEndUser(_0x3ee20e,_0x4f10dc,_0x1309a3,_0x4217b4)[_0x5ae8('0xe')](function(_0x23a5d4){logger[_0x5ae8('0xc')](_0x5ae8('0x26'),_0x23a5d4[_0x5ae8('0x24')]);return _0x3e408b(_0x23a5d4);});});})[_0x5ae8('0x20')](function(_0x3b20a4){_0x12e155(_0x3b20a4);});});};}function createEndUser(_0x16a1e4,_0x298ebb,_0x26d570,_0x540da3){return new Promise(function(_0x44df97,_0x2d7c6e){var _0x7f7371=moment();var _0x17a679={'method':_0x5ae8('0x27'),'uri':_0x540da3+_0x5ae8('0x28'),'body':{'contact':{'last_name':_0x16a1e4[_0x5ae8('0x22')],'work_number':_0x16a1e4[_0x5ae8('0x22')],'mobile_number':_0x16a1e4[_0x5ae8('0x22')],'owner_id':_0x16a1e4[_0x5ae8('0x1a')],'created_at':_0x7f7371[_0x5ae8('0x29')](_0x5ae8('0x2a'))}},'json':!![]};_0x17a679[_0x5ae8('0xb')]=_0x26d570;logger[_0x5ae8('0xc')](_0x5ae8('0x2b'));return rp(_0x17a679)[_0x5ae8('0xe')](function(_0x1d1e66){_0x16a1e4[_0x5ae8('0x24')]=_0x1d1e66[_0x5ae8('0x2c')]['id'];_0x44df97(_0x16a1e4);})[_0x5ae8('0x20')](function(_0x45450a){logger[_0x5ae8('0x2d')]('['+[_0x298ebb[_0x5ae8('0x14')]()]+']',_0x45450a[_0x5ae8('0x15')]);_0x2d7c6e(_0x45450a[_0x5ae8('0x15')]);});});}function getTicket(_0x163b2f,_0x13fe8b,_0x3ed748,_0x36e04b,_0x20296e){return function(_0xadcb34){logger[_0x5ae8('0xc')](_0x5ae8('0x2e'));return new Promise(function(_0x28b16a,_0x219e4a){var _0x5324d2=moment();var _0x2a12c8={'method':_0x5ae8('0x27'),'uri':_0x3ed748+_0x5ae8('0x2f'),'body':{'title':intUtil['getString'](_0x36e04b[_0x5ae8('0x30')],_0x20296e,'\x20'),'description':intUtil[_0x5ae8('0x31')](_0x36e04b[_0x5ae8('0x32')],_0x20296e,'\x0a'),'owner_id':_0xadcb34[_0x5ae8('0x1a')],'creater_id':_0xadcb34[_0x5ae8('0x11')],'targetable_id':_0xadcb34[_0x5ae8('0x24')],'targetable_type':_0x5ae8('0x33'),'created_at':_0x5324d2['format'](_0x5ae8('0x2a')),'due_date':_0x5324d2['add'](0x1e,'m')[_0x5ae8('0x29')](_0x5ae8('0x2a'))},'json':!![]};_0x2a12c8[_0x5ae8('0xb')]=_0x13fe8b;return rp(_0x2a12c8)['then'](function(_0x243fb9){_0xadcb34[_0x5ae8('0x34')]=_0x243fb9['task']['id'];logger[_0x5ae8('0xc')](_0x5ae8('0x35'),_0xadcb34[_0x5ae8('0x34')]);_0x28b16a(_0xadcb34);})[_0x5ae8('0x20')](function(_0x3c28a8){logger[_0x5ae8('0x2d')]('['+[_0x163b2f['toUpperCase']()]+']',_0x3c28a8[_0x5ae8('0x15')]);_0x219e4a(_0x3c28a8[_0x5ae8('0x15')]);});});};}function emit(_0x26e494,_0xf6fe6f,_0x277024){var _0xe3754e={'uri':_0x26e494+'/contacts/'+_0x277024};io['to'](util[_0x5ae8('0x29')](_0x5ae8('0x36'),_0xf6fe6f))[_0x5ae8('0x37')](_0x5ae8('0x38'),_0xe3754e);}exports['cs']=function(_0x171155,_0x545830,_0x133666,_0x5a4ec4,_0x11eda8,_0x51de61,_0x5409a3,_0x1f3116){var _0x4fd924={};var _0x33fe27={'Authorization':_0x5ae8('0x39')+_0x51de61[_0x5ae8('0x3a')]};_0x51de61[_0x5ae8('0x3b')]=intUtil[_0x5ae8('0x3c')](_0x51de61[_0x5ae8('0x3b')]);_0x51de61[_0x5ae8('0x3d')]=intUtil[_0x5ae8('0x3c')](_0x51de61[_0x5ae8('0x3d')]);var _0x33a000=_0x51de61[_0x5ae8('0x3b')];_0x4fd924[_0x5ae8('0x10')]=_0x51de61[_0x5ae8('0x3e')];_0x4fd924[_0x5ae8('0x22')]=_0x1f3116[_0x5ae8('0x3f')]()===_0x5ae8('0x40')?_0x545830[_0x5ae8('0x41')]:_0x545830[_0x5ae8('0x42')];_0x4fd924['callDirection']=_0x1f3116==='queue'||_0x1f3116==='unmanaged'?'queue':'outbound';if(_0x5a4ec4){_0x4fd924['agentEmail']=_0x5a4ec4[_0x5ae8('0xf')];}var _0x5d977b=util[_0x5ae8('0x29')](_0x5ae8('0x43'),_0x51de61[_0x5ae8('0x3d')],_0x545830[_0x5ae8('0x44')],md5(_0x545830[_0x5ae8('0x44')]));if(_0x11eda8&&_0x11eda8[_0x5ae8('0x45')]){logger[_0x5ae8('0xc')](_0x5ae8('0x46'),_0x5ae8('0x47'));_0x545830[_0x5ae8('0x48')]=_0x5d977b;}else if(_0x5409a3&&_0x5409a3['recordingFormat']&&_0x5409a3[_0x5ae8('0x49')]!=='none'){logger['info'](_0x5ae8('0x4a'),_0x5ae8('0x47'));_0x545830['recordingURL']=_0x5d977b;}else{_0x545830[_0x5ae8('0x48')]='';}return getAdminId(_0x4fd924,_0x1f3116,_0x33fe27,_0x33a000)['then'](getUser(_0x1f3116,_0x33fe27,_0x33a000))['then'](getEndUser(_0x1f3116,_0x33fe27,_0x33a000))[_0x5ae8('0xe')](getTicket(_0x1f3116,_0x33fe27,_0x33a000,_0x133666,_0x545830))['then'](function(_0x46b9f3){logger[_0x5ae8('0xc')](util[_0x5ae8('0x29')](_0x5ae8('0x4b'),_0x46b9f3[_0x5ae8('0x34')]));if(_0x1f3116!==_0x5ae8('0x4c')){logger[_0x5ae8('0xc')]('['+[_0x1f3116[_0x5ae8('0x14')]()]+']',_0x5ae8('0x4d'));emit(_0x33a000,_0x5a4ec4['name'],_0x46b9f3[_0x5ae8('0x24')]);}})[_0x5ae8('0x20')](function(_0x42a0b4){logger[_0x5ae8('0x2d')]('['+[_0x1f3116[_0x5ae8('0x14')]()]+_0x5ae8('0x4e'),util['inspect'](_0x42a0b4,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
+var _0xe313=['user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name','inspect','lodash','md5','util','moment','./util','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','/api/selector/owners','headers','then','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','email','userId','User\x20found:','Admin\x20selected','userEmail','adminEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','/contacts/'];(function(_0x933bc9,_0x5de877){var _0x56c9a7=function(_0x4f87e0){while(--_0x4f87e0){_0x933bc9['push'](_0x933bc9['shift']());}};_0x56c9a7(++_0x5de877);}(_0xe313,0xbb));var _0x3e31=function(_0x3bc4a5,_0x31c8c2){_0x3bc4a5=_0x3bc4a5-0x0;var _0x19eebf=_0xe313[_0x3bc4a5];return _0x19eebf;};'use strict';var _=require(_0x3e31('0x0'));var rp=require('request-promise');var md5=require(_0x3e31('0x1'));var util=require(_0x3e31('0x2'));var moment=require(_0x3e31('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0x3e31('0x4'));var config=require('../../../../config/environment');var logger=require(_0x3e31('0x5'))(_0x3e31('0x6'));config[_0x3e31('0x7')]=_['defaults'](config['redis'],{'host':_0x3e31('0x8'),'port':0x18eb});var io=require(_0x3e31('0x9'))(new Redis(config[_0x3e31('0x7')]));function getAdminId(_0xbebddd,_0x11d23e,_0x15f587,_0x2b5b9b){return new Promise(function(_0x13871e,_0x6770d4){var _0x5aa140=![];var _0x194ecc={'method':'GET','uri':_0x2b5b9b+_0x3e31('0xa'),'json':!![]};_0x194ecc[_0x3e31('0xb')]=_0x15f587;logger['info']('Getting\x20admin\x20information');return rp(_0x194ecc)[_0x3e31('0xc')](function(_0x1fc849){if(_0x1fc849){var _0x4c1dfa=_0x1fc849['users'];var _0x1e2820=null;for(_0x1e2820=0x0;_0x1e2820<_0x4c1dfa['length'];_0x1e2820++){if(_0x4c1dfa[_0x1e2820]['email']===_0xbebddd['adminEmail']){_0xbebddd[_0x3e31('0xd')]=_0x4c1dfa[_0x1e2820]['id'];_0x5aa140=!![];}}if(_0x5aa140){logger[_0x3e31('0xe')](_0x3e31('0xf'),_0xbebddd[_0x3e31('0xd')]);_0x13871e(_0xbebddd);}else{_0x6770d4({'statusCode':0x194,'message':_0x3e31('0x10')});}}else{_0x6770d4({'statusCode':0x194,'message':_0x3e31('0x10')});}})[_0x3e31('0x11')](function(_0x14cfb8){logger[_0x3e31('0x12')]('['+[_0x11d23e[_0x3e31('0x13')]()]+']',_0x14cfb8[_0x3e31('0x14')]);_0x6770d4(_0x14cfb8);});});}function getUser(_0x2dae17,_0x20239f,_0x15d698){return function(_0x52711a){return new Promise(function(_0x4f0dc6,_0x406517){var _0x284f7c={'method':_0x3e31('0x15'),'uri':_0x15d698+_0x3e31('0xa'),'json':!![]};_0x284f7c[_0x3e31('0xb')]=_0x20239f;logger[_0x3e31('0xe')](_0x3e31('0x16'));return rp(_0x284f7c)['then'](function(_0x2a4169){if(_0x2a4169){var _0x1b1752=_0x2a4169[_0x3e31('0x17')];var _0x5276b5=![];var _0x5c1f94=null;if(_0x52711a[_0x3e31('0x18')]!==null){logger[_0x3e31('0xe')](_0x3e31('0x19'),_0x52711a[_0x3e31('0x18')]);_0x52711a['userEmail']=_0x52711a[_0x3e31('0x18')];for(_0x5c1f94=0x0;_0x5c1f94<_0x1b1752['length'];_0x5c1f94++){if(_0x1b1752[_0x5c1f94][_0x3e31('0x1a')]===_0x52711a[_0x3e31('0x18')]){_0x5276b5=!![];_0x52711a[_0x3e31('0x1b')]=_0x1b1752[_0x5c1f94]['id'];logger['info'](_0x3e31('0x1c'),_0x52711a[_0x3e31('0x1b')]);}}}if(!_0x5276b5){logger[_0x3e31('0xe')](_0x3e31('0x1d'));_0x52711a[_0x3e31('0x1e')]=_0x52711a[_0x3e31('0x1f')];_0x52711a[_0x3e31('0x1b')]=_0x52711a['adminId'];_0x5276b5=!![];}if(_0x5276b5){_0x4f0dc6(_0x52711a);}else{_0x406517({'statusCode':0x194,'message':_0x3e31('0x10')});}}else{_0x406517({'statusCode':0x194,'message':_0x3e31('0x10')});}})[_0x3e31('0x11')](function(_0x26ccb4){logger[_0x3e31('0x12')]('['+[_0x2dae17['toUpperCase']()]+']',_0x26ccb4[_0x3e31('0x14')]);_0x406517(_0x26ccb4);});});};}function searchContact(_0x5245dc,_0x5d5bc2,_0x5b2a3e,_0x5e4985){return new Promise(function(_0x58d560,_0x50f76e){var _0x20c33a={'method':'GET','headers':_0x5d5bc2,'uri':_0x5245dc+_0x3e31('0x20')+_0x5e4985+_0x3e31('0x21')+_0x5b2a3e+_0x3e31('0x22'),'json':!![]};rp(_0x20c33a)[_0x3e31('0xc')](function(_0x2b2e5c){var _0x3de82f=_[_0x3e31('0x23')](_0x2b2e5c[_0x3e31('0x24')]['contacts'],[_0x5b2a3e,_0x5e4985]);_0x58d560(_0x3de82f);})[_0x3e31('0x11')](function(_0x581dd6){_0x50f76e(_0x581dd6);});});}function getEndUser(_0x5be174,_0xf3c7b1,_0x29627){return function(_0x42bbc4){return new Promise(function(_0x145ca1,_0x48d2b5){logger[_0x3e31('0xe')](util[_0x3e31('0x25')](_0x3e31('0x26'),_0x42bbc4[_0x3e31('0x27')]));searchContact(_0x29627,_0xf3c7b1,'mobile_number',_0x42bbc4[_0x3e31('0x27')])[_0x3e31('0xc')](function(_0x434848){if(_0x434848){_0x42bbc4[_0x3e31('0x28')]=_0x434848['id'];logger[_0x3e31('0xe')](_0x3e31('0x29'),_0x42bbc4[_0x3e31('0x28')]);return _0x145ca1(_0x42bbc4);}searchContact(_0x29627,_0xf3c7b1,'work_number',_0x42bbc4[_0x3e31('0x27')])[_0x3e31('0xc')](function(_0x409f87){if(_0x409f87){_0x42bbc4[_0x3e31('0x28')]=_0x409f87['id'];logger['info'](_0x3e31('0x2a'),_0x42bbc4[_0x3e31('0x28')]);return _0x145ca1(_0x42bbc4);}createEndUser(_0x42bbc4,_0x5be174,_0xf3c7b1,_0x29627)[_0x3e31('0xc')](function(_0x3421b7){logger['info'](_0x3e31('0x2b'),_0x3421b7[_0x3e31('0x28')]);return _0x145ca1(_0x3421b7);});});})[_0x3e31('0x11')](function(_0x21bc06){_0x48d2b5(_0x21bc06);});});};}function createEndUser(_0x22773c,_0x194d95,_0x8a019f,_0x163368){return new Promise(function(_0x421415,_0x590a9b){var _0x577e7a=moment();var _0x10c7ee={'method':_0x3e31('0x2c'),'uri':_0x163368+_0x3e31('0x2d'),'body':{'contact':{'last_name':_0x22773c[_0x3e31('0x27')],'work_number':_0x22773c[_0x3e31('0x27')],'mobile_number':_0x22773c[_0x3e31('0x27')],'owner_id':_0x22773c['userId'],'created_at':_0x577e7a['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x10c7ee[_0x3e31('0xb')]=_0x8a019f;logger[_0x3e31('0xe')](_0x3e31('0x2e'));return rp(_0x10c7ee)[_0x3e31('0xc')](function(_0x164d84){_0x22773c[_0x3e31('0x28')]=_0x164d84[_0x3e31('0x2f')]['id'];_0x421415(_0x22773c);})['catch'](function(_0x5c82d0){logger[_0x3e31('0x12')]('['+[_0x194d95[_0x3e31('0x13')]()]+']',_0x5c82d0[_0x3e31('0x14')]);_0x590a9b(_0x5c82d0['message']);});});}function getTicket(_0x418730,_0x332e01,_0x472f38,_0x4db362,_0x4b30cc){return function(_0x741fec){logger[_0x3e31('0xe')](_0x3e31('0x30'));return new Promise(function(_0x578dfb,_0x5cf052){var _0x227f60=moment();var _0x3f7fa7={'method':_0x3e31('0x2c'),'uri':_0x472f38+_0x3e31('0x31'),'body':{'title':intUtil[_0x3e31('0x32')](_0x4db362['Subjects'],_0x4b30cc,'\x20'),'description':intUtil[_0x3e31('0x32')](_0x4db362['Descriptions'],_0x4b30cc,'\x0a'),'owner_id':_0x741fec['userId'],'creater_id':_0x741fec['adminId'],'targetable_id':_0x741fec[_0x3e31('0x28')],'targetable_type':_0x3e31('0x33'),'created_at':_0x227f60[_0x3e31('0x25')](_0x3e31('0x34')),'due_date':_0x227f60[_0x3e31('0x35')](0x1e,'m')['format'](_0x3e31('0x34'))},'json':!![]};_0x3f7fa7[_0x3e31('0xb')]=_0x332e01;return rp(_0x3f7fa7)['then'](function(_0x4235f4){_0x741fec[_0x3e31('0x36')]=_0x4235f4['task']['id'];logger[_0x3e31('0xe')]('Task\x20created:',_0x741fec[_0x3e31('0x36')]);_0x578dfb(_0x741fec);})[_0x3e31('0x11')](function(_0x5ca431){logger[_0x3e31('0x12')]('['+[_0x418730[_0x3e31('0x13')]()]+']',_0x5ca431['message']);_0x5cf052(_0x5ca431['message']);});});};}function emit(_0x2dc2bf,_0x43a41a,_0x3ea397){var _0x9dc30={'uri':_0x2dc2bf+_0x3e31('0x37')+_0x3ea397};io['to'](util['format'](_0x3e31('0x38'),_0x43a41a))[_0x3e31('0x39')]('trigger:browser:url',_0x9dc30);}exports['cs']=function(_0x16ae23,_0x562590,_0x2f72ba,_0x242b2b,_0x1e6bfb,_0x375619,_0xd5b908,_0x131716){var _0x21eae4={};var _0x28e9d6={'Authorization':_0x3e31('0x3a')+_0x375619[_0x3e31('0x3b')]};_0x375619[_0x3e31('0x3c')]=intUtil[_0x3e31('0x3d')](_0x375619['remoteUri']);_0x375619[_0x3e31('0x3e')]=intUtil[_0x3e31('0x3d')](_0x375619[_0x3e31('0x3e')]);var _0x36c664=_0x375619[_0x3e31('0x3c')];_0x21eae4[_0x3e31('0x1f')]=_0x375619[_0x3e31('0x3f')];_0x21eae4[_0x3e31('0x27')]=_0x131716[_0x3e31('0x40')]()===_0x3e31('0x41')?_0x562590['destcalleridnum']:_0x562590[_0x3e31('0x42')];_0x21eae4[_0x3e31('0x43')]=_0x131716===_0x3e31('0x44')||_0x131716===_0x3e31('0x45')?_0x3e31('0x44'):'outbound';if(_0x242b2b){_0x21eae4[_0x3e31('0x18')]=_0x242b2b[_0x3e31('0x1a')];}var _0x5bb34b=util[_0x3e31('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x375619[_0x3e31('0x3e')],_0x562590[_0x3e31('0x46')],md5(_0x562590['uniqueid']));if(_0x1e6bfb&&_0x1e6bfb[_0x3e31('0x47')]){logger[_0x3e31('0xe')](_0x3e31('0x48'),_0x3e31('0x49'));_0x562590[_0x3e31('0x4a')]=_0x5bb34b;}else if(_0xd5b908&&_0xd5b908['recordingFormat']&&_0xd5b908[_0x3e31('0x4b')]!==_0x3e31('0x4c')){logger[_0x3e31('0xe')](_0x3e31('0x4d'),'Recording\x20is\x20enabled!');_0x562590[_0x3e31('0x4a')]=_0x5bb34b;}else{_0x562590[_0x3e31('0x4a')]='';}return getAdminId(_0x21eae4,_0x131716,_0x28e9d6,_0x36c664)['then'](getUser(_0x131716,_0x28e9d6,_0x36c664))[_0x3e31('0xc')](getEndUser(_0x131716,_0x28e9d6,_0x36c664))['then'](getTicket(_0x131716,_0x28e9d6,_0x36c664,_0x2f72ba,_0x562590))[_0x3e31('0xc')](function(_0x15bc38){logger[_0x3e31('0xe')](util['format'](_0x3e31('0x4e'),_0x15bc38[_0x3e31('0x36')]));if(_0x131716!==_0x3e31('0x45')){logger[_0x3e31('0xe')]('['+[_0x131716[_0x3e31('0x13')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x36c664,_0x242b2b[_0x3e31('0x4f')],_0x15bc38[_0x3e31('0x28')]);}})[_0x3e31('0x11')](function(_0x18115e){logger[_0x3e31('0x12')]('['+[_0x131716[_0x3e31('0x13')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x3e31('0x50')](_0x18115e,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
index 28ee4bd..a194155 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb067=['outbound','freshdesk','zoho','desk','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId'];(function(_0x200535,_0x1499e8){var _0x39d3ba=function(_0x115d4a){while(--_0x115d4a){_0x200535['push'](_0x200535['shift']());}};_0x39d3ba(++_0x1499e8);}(_0xb067,0xc1));var _0x7b06=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb067[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x7b06('0x0'));var zendesk=require(_0x7b06('0x1'));var salesforce=require(_0x7b06('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x7b06('0x3'));var zoho=require('./zoho');var desk=require(_0x7b06('0x4'));var vtiger=require(_0x7b06('0x5'));var servicenow=require(_0x7b06('0x6'));var dynamics365=require(_0x7b06('0x7'));var freshsales=require(_0x7b06('0x8'));var integrations=[_0x7b06('0x9'),_0x7b06('0xa'),'sugarcrm','freshdesk','zoho','desk',_0x7b06('0xb'),_0x7b06('0xc'),_0x7b06('0xd'),_0x7b06('0xe')];exports['exec']=function(_0x54d12f,_0x13d5b1,_0xea7f2c,_0x6ea271,_0x450e4f,_0xd83678){if(_0xea7f2c){if(_[_0x7b06('0xf')](integrations,_0x54d12f[_0x7b06('0x10')][_0x7b06('0x11')]())){try{var _0x5c426c=null;var _0x450000='';var _0x5eeba5=_0xea7f2c[_0x54d12f[_0x7b06('0x10')]['toLowerCase']()];if(_0x5eeba5){var _0x1387f8=_0x5eeba5[_0x54d12f[_0x7b06('0x12')]];if(_0x1387f8){var _0x5235b1=_[_0x7b06('0x13')](_0x1387f8[_0x7b06('0x14')],{'id':parseInt(_0x54d12f['data3'],0xa)});if(_0x5235b1){if(_0x6ea271){if(_0x450e4f&&_0x13d5b1[_0x7b06('0x15')]){_0x450000=_0x7b06('0x15');}else if(_0x13d5b1[_0x7b06('0x16')]){_0x450000=_0x7b06('0x17');}else{console['log']('EVENT\x20UNKNOWN',_0x13d5b1);}}else{_0x450000='unmanaged';}switch(_0x54d12f['data1'][_0x7b06('0x11')]()){case _0x7b06('0x9'):zendesk[_0x450000](_0x54d12f,_0x13d5b1,_0x5235b1,_0x6ea271,_0x450e4f,_0x1387f8,_0xd83678);break;case _0x7b06('0xa'):salesforce[_0x450000](_0x54d12f,_0x13d5b1,_0x5235b1,_0x6ea271,_0x450e4f,_0x1387f8,_0xd83678);break;case'sugarcrm':sugarcrm[_0x450000](_0x54d12f,_0x13d5b1,_0x5235b1,_0x6ea271,_0x450e4f,_0x1387f8,_0xd83678);break;case _0x7b06('0x18'):freshdesk[_0x450000](_0x54d12f,_0x13d5b1,_0x5235b1,_0x6ea271,_0x450e4f,_0x1387f8,_0xd83678);break;case _0x7b06('0x19'):zoho[_0x450000](_0x54d12f,_0x13d5b1,_0x5235b1,_0x6ea271,_0x450e4f,_0x1387f8,_0xd83678);break;case _0x7b06('0x1a'):desk[_0x450000](_0x54d12f,_0x13d5b1,_0x5235b1,_0x6ea271,_0x450e4f,_0x1387f8,_0xd83678);break;case _0x7b06('0xb'):vtiger[_0x450000](_0x54d12f,_0x13d5b1,_0x5235b1,_0x6ea271,_0x450e4f,_0x1387f8,_0xd83678);break;case _0x7b06('0xd'):freshsales['cs'](_0x54d12f,_0x13d5b1,_0x5235b1,_0x6ea271,_0x450e4f,_0x1387f8,_0xd83678,_0x450000);break;case _0x7b06('0xe'):servicenow['cs'](_0x54d12f,_0x13d5b1,_0x5235b1,_0x6ea271,_0x450e4f,_0x1387f8,_0xd83678,_0x450000);break;case _0x7b06('0xc'):dynamics365['cs'](_0x54d12f,_0x13d5b1,_0x5235b1,_0x6ea271,_0x450e4f,_0x1387f8,_0xd83678,_0x450000);break;default:console[_0x7b06('0x1b')](_0x7b06('0x1c'));}}else{_0x5c426c=require(_0x7b06('0x1d'))(_0x54d12f[_0x7b06('0x10')][_0x7b06('0x11')]());_0x5c426c[_0x7b06('0x1e')](_0x7b06('0x1f'),util[_0x7b06('0x20')](_0x7b06('0x21'),_0x54d12f[_0x7b06('0x10')][_0x7b06('0x11')](),_0x54d12f[_0x7b06('0x22')]));}}else{_0x5c426c=require(_0x7b06('0x1d'))(_0x54d12f[_0x7b06('0x10')]['toLowerCase']());_0x5c426c[_0x7b06('0x1e')](_0x7b06('0x1f'),util[_0x7b06('0x20')](_0x7b06('0x23'),_0x54d12f[_0x7b06('0x10')][_0x7b06('0x11')](),_0x54d12f[_0x7b06('0x12')]));}}else{}}catch(_0x41c653){console[_0x7b06('0x1e')](_0x41c653);}}}};
\ No newline at end of file
+var _0x5f83=['util','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','salesforce','sugarcrm','zoho','desk','vtiger','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','log','EVENT\x20UNKNOWN','unmanaged','zendesk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash'];(function(_0x3d4bb4,_0xad79e4){var _0x38e3e0=function(_0xdcd8d5){while(--_0xdcd8d5){_0x3d4bb4['push'](_0x3d4bb4['shift']());}};_0x38e3e0(++_0xad79e4);}(_0x5f83,0x8f));var _0x35f8=function(_0x240883,_0x502d5a){_0x240883=_0x240883-0x0;var _0x2bc9ab=_0x5f83[_0x240883];return _0x2bc9ab;};'use strict';var _=require(_0x35f8('0x0'));var util=require(_0x35f8('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x35f8('0x2'));var sugarcrm=require(_0x35f8('0x3'));var freshdesk=require(_0x35f8('0x4'));var zoho=require('./zoho');var desk=require(_0x35f8('0x5'));var vtiger=require(_0x35f8('0x6'));var servicenow=require(_0x35f8('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x35f8('0x8'));var integrations=['zendesk',_0x35f8('0x9'),_0x35f8('0xa'),'freshdesk',_0x35f8('0xb'),_0x35f8('0xc'),_0x35f8('0xd'),'dynamics365','freshsales',_0x35f8('0xe')];exports[_0x35f8('0xf')]=function(_0x2f0198,_0x295e33,_0x538c5d,_0x8c1352,_0x1dbc41,_0x24ca4c){if(_0x538c5d){if(_[_0x35f8('0x10')](integrations,_0x2f0198[_0x35f8('0x11')][_0x35f8('0x12')]())){try{var _0x21bd7e=null;var _0x572a43='';var _0x5e8fba=_0x538c5d[_0x2f0198['data1'][_0x35f8('0x12')]()];if(_0x5e8fba){var _0x37dfc5=_0x5e8fba[_0x2f0198[_0x35f8('0x13')]];if(_0x37dfc5){var _0xed8424=_[_0x35f8('0x14')](_0x37dfc5[_0x35f8('0x15')],{'id':parseInt(_0x2f0198[_0x35f8('0x16')],0xa)});if(_0xed8424){if(_0x8c1352){if(_0x1dbc41&&_0x295e33[_0x35f8('0x17')]){_0x572a43=_0x35f8('0x17');}else if(_0x295e33['routeId']){_0x572a43='outbound';}else{console[_0x35f8('0x18')](_0x35f8('0x19'),_0x295e33);}}else{_0x572a43=_0x35f8('0x1a');}switch(_0x2f0198[_0x35f8('0x11')][_0x35f8('0x12')]()){case _0x35f8('0x1b'):zendesk[_0x572a43](_0x2f0198,_0x295e33,_0xed8424,_0x8c1352,_0x1dbc41,_0x37dfc5,_0x24ca4c);break;case _0x35f8('0x9'):salesforce[_0x572a43](_0x2f0198,_0x295e33,_0xed8424,_0x8c1352,_0x1dbc41,_0x37dfc5,_0x24ca4c);break;case _0x35f8('0xa'):sugarcrm[_0x572a43](_0x2f0198,_0x295e33,_0xed8424,_0x8c1352,_0x1dbc41,_0x37dfc5,_0x24ca4c);break;case'freshdesk':freshdesk[_0x572a43](_0x2f0198,_0x295e33,_0xed8424,_0x8c1352,_0x1dbc41,_0x37dfc5,_0x24ca4c);break;case'zoho':zoho[_0x572a43](_0x2f0198,_0x295e33,_0xed8424,_0x8c1352,_0x1dbc41,_0x37dfc5,_0x24ca4c);break;case _0x35f8('0xc'):desk[_0x572a43](_0x2f0198,_0x295e33,_0xed8424,_0x8c1352,_0x1dbc41,_0x37dfc5,_0x24ca4c);break;case'vtiger':vtiger[_0x572a43](_0x2f0198,_0x295e33,_0xed8424,_0x8c1352,_0x1dbc41,_0x37dfc5,_0x24ca4c);break;case _0x35f8('0x1c'):freshsales['cs'](_0x2f0198,_0x295e33,_0xed8424,_0x8c1352,_0x1dbc41,_0x37dfc5,_0x24ca4c,_0x572a43);break;case'servicenow':servicenow['cs'](_0x2f0198,_0x295e33,_0xed8424,_0x8c1352,_0x1dbc41,_0x37dfc5,_0x24ca4c,_0x572a43);break;case _0x35f8('0x1d'):dynamics365['cs'](_0x2f0198,_0x295e33,_0xed8424,_0x8c1352,_0x1dbc41,_0x37dfc5,_0x24ca4c,_0x572a43);break;default:console[_0x35f8('0x18')](_0x35f8('0x1e'));}}else{_0x21bd7e=require(_0x35f8('0x1f'))(_0x2f0198[_0x35f8('0x11')][_0x35f8('0x12')]());_0x21bd7e[_0x35f8('0x20')](_0x35f8('0x21'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x2f0198[_0x35f8('0x11')][_0x35f8('0x12')](),_0x2f0198[_0x35f8('0x16')]));}}else{_0x21bd7e=require(_0x35f8('0x1f'))(_0x2f0198['data1'][_0x35f8('0x12')]());_0x21bd7e[_0x35f8('0x20')](_0x35f8('0x21'),util[_0x35f8('0x22')](_0x35f8('0x23'),_0x2f0198[_0x35f8('0x11')][_0x35f8('0x12')](),_0x2f0198[_0x35f8('0x13')]));}}else{}}catch(_0x5285cf){console[_0x35f8('0x20')](_0x5285cf);}}}};
\ No newline at end of file
index 6149594..3c16451 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x23f4=['recordingURL','uniqueid','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','ticketType','create','isNil','validateEmail','User','find','execute','then','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','Contact','length','additionalSearchLead','$or','Lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','LastName','<unknown>','Company','No\x20Company','forEach','includes','string','picklist','idField','variable','variableName','customVariable','Variable','name','toString','password','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!'];(function(_0x22da41,_0x433755){var _0x24e7f0=function(_0x5ec3bc){while(--_0x5ec3bc){_0x22da41['push'](_0x22da41['shift']());}};_0x24e7f0(++_0x433755);}(_0x23f4,0x1b6));var _0x423f=function(_0x3d538d,_0x19109e){_0x3d538d=_0x3d538d-0x0;var _0x2f542a=_0x23f4[_0x3d538d];return _0x2f542a;};'use strict';var _=require(_0x423f('0x0'));var rp=require(_0x423f('0x1'));var moment=require(_0x423f('0x2'));var BPromise=require(_0x423f('0x3'));var md5=require(_0x423f('0x4'));var jsforce=require(_0x423f('0x5'));var util=require(_0x423f('0x6'));var Redis=require('ioredis');var intUtil=require(_0x423f('0x7'));var config=require('../../../../config/environment');var logger=require(_0x423f('0x8'))(_0x423f('0x9'));config[_0x423f('0xa')]=_[_0x423f('0xb')](config[_0x423f('0xa')],{'host':_0x423f('0xc'),'port':0x18eb});var io=require(_0x423f('0xd'))(new Redis(config[_0x423f('0xa')]));function emit(_0x5e0883,_0x2f1622,_0x507b96){io['to'](_0x5e0883)[_0x423f('0xe')](_0x2f1622,_0x507b96);}function getTicket(_0x5675af,_0x3f0779,_0xbdb77a,_0x58c0ff,_0x2188ea,_0x529354,_0xea7151,_0xa810db){var _0x3fa63b=Object[_0x423f('0xf')]({},{'OwnerId':_0x3f0779['id'],'Subject':intUtil['getString'](_0x58c0ff['Subjects'],_0x2188ea,'\x20'),'Description':intUtil[_0x423f('0x10')](_0x58c0ff[_0x423f('0x11')],_0x2188ea,'\x0a')},getCustomFields(_0x529354,_0x2188ea));if(_0xbdb77a){if(_0x58c0ff['ticketType']===_0x423f('0x12')){_0x3fa63b[_0x423f('0x13')]=moment[_0x423f('0x14')]();_0x3fa63b[_0x423f('0x15')]=![];_0x3fa63b[_0x423f('0x16')]=![];if(_0xbdb77a[_0x423f('0x17')]===_0x423f('0x18')||_0xbdb77a[_0x423f('0x17')]===_0x423f('0x19')){_0x3fa63b[_0x423f('0x1a')]=_0xbdb77a['id'];}else if(_0xbdb77a[_0x423f('0x17')]===_0x423f('0x1b')){_0x3fa63b[_0x423f('0x1c')]=_0xbdb77a['id'];}}else if(_0x58c0ff['ticketType']==='Case'){if(_0xbdb77a[_0x423f('0x17')]===_0x423f('0x18')){_0x3fa63b[_0x423f('0x1d')]=_0xbdb77a['id'];}else if(_0xbdb77a['endUserType']===_0x423f('0x1b')){_0x3fa63b[_0x423f('0x1e')]=_0xbdb77a['id'];}else if(_0xbdb77a[_0x423f('0x17')]==='lead'&&_0x58c0ff[_0x423f('0x1f')]){_0x3fa63b[_0x58c0ff['leadId']]=_0xbdb77a['id'];}else{logger[_0x423f('0x20')](_0x423f('0x21'));}}}return _0xea7151[_0x423f('0x22')](_0x58c0ff[_0x423f('0x23')])[_0x423f('0x24')](_0x3fa63b);}function getUser(_0x55d5e1,_0x56b8cb,_0x4cdef5){if(!_[_0x423f('0x25')](_0x56b8cb)&&intUtil[_0x423f('0x26')](_0x56b8cb)){var _0x2fdf7a={'Email':_0x56b8cb};var _0x286516={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4cdef5[_0x423f('0x22')](_0x423f('0x27'))[_0x423f('0x28')](_0x2fdf7a,_0x286516)[_0x423f('0x29')]()[_0x423f('0x2a')](function(_0x25cfa4){if(_0x25cfa4['length']){var _0x379358=_[_0x423f('0x28')](_0x25cfa4,function(_0x4e5c4d){return _0x4e5c4d[_0x423f('0x2b')]===_0x56b8cb;});if(_0x379358){logger[_0x423f('0x20')](_0x423f('0x2c'),_0x56b8cb);return BPromise['resolve']({'id':_0x379358['Id'],'name':_0x379358[_0x423f('0x2d')]});}}else{logger[_0x423f('0x20')](_0x423f('0x2e'),_0x56b8cb);return _0x4cdef5['identity']()['then'](function(_0x4b5807){return BPromise[_0x423f('0x2f')]({'id':_0x4b5807[_0x423f('0x30')],'name':_0x4b5807[_0x423f('0x31')]});});}});}else{logger[_0x423f('0x20')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x56b8cb);return _0x4cdef5[_0x423f('0x32')]()[_0x423f('0x2a')](function(_0x1a2468){return BPromise['resolve']({'id':_0x1a2468[_0x423f('0x30')],'name':_0x1a2468[_0x423f('0x31')]});});}}function getEndUser(_0x42799f,_0x30d097,_0x1170b4,_0x18928a,_0x38faa9){var _0xe25db9={'$or':{'Phone':_0x18928a}};var _0x231acc={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x423f('0x2f')]()['then'](function(){logger[_0x423f('0x20')](_0x423f('0x33'),_0x18928a,_0x30d097[_0x423f('0x34')]);switch(_0x30d097[_0x423f('0x34')]){case'contact_lead':var _0x10d7c2=_[_0x423f('0x35')](_0xe25db9);if(_0x30d097[_0x423f('0x36')]){var _0x3832bb={};_0x3832bb[_0x30d097[_0x423f('0x36')]]=_0x18928a;_[_0x423f('0x37')](_0x10d7c2['$or'],_0x3832bb);}return _0x38faa9[_0x423f('0x22')](_0x423f('0x38'))[_0x423f('0x28')](_0x10d7c2,_0x231acc)[_0x423f('0x29')]()[_0x423f('0x2a')](function(_0x4f3fc3){if(_0x4f3fc3&&_0x4f3fc3[_0x423f('0x39')]){return _0x4f3fc3;}else{var _0x196a34=_[_0x423f('0x35')](_0xe25db9);if(_0x30d097['additionalSearchLead']){var _0x178b85={};_0x178b85[_0x30d097[_0x423f('0x3a')]]=_0x18928a;_[_0x423f('0x37')](_0x196a34[_0x423f('0x3b')],_0x178b85);}return _0x38faa9[_0x423f('0x22')](_0x423f('0x3c'))[_0x423f('0x28')](_0x196a34,_0x231acc);}});case'account_contact_lead':var _0x40fe3c=_[_0x423f('0x35')](_0xe25db9);if(_0x30d097[_0x423f('0x3d')]){var _0x3832bb={};_0x3832bb[_0x30d097['additionalSearchAccount']]=_0x18928a;_[_0x423f('0x37')](_0x40fe3c[_0x423f('0x3b')],_0x3832bb);}return _0x38faa9[_0x423f('0x22')](_0x423f('0x3e'))[_0x423f('0x28')](_0x40fe3c,_0x231acc)['execute']()['then'](function(_0x436ad4){if(_0x436ad4&&_0x436ad4[_0x423f('0x39')]){return _0x436ad4;}else{var _0x2eb748=_[_0x423f('0x35')](_0xe25db9);if(_0x30d097[_0x423f('0x36')]){var _0x4d9d0c={};_0x4d9d0c[_0x30d097['additionalSearchContact']]=_0x18928a;_[_0x423f('0x37')](_0x2eb748[_0x423f('0x3b')],_0x4d9d0c);}return _0x38faa9['sobject']('Contact')[_0x423f('0x28')](_0x2eb748,_0x231acc)[_0x423f('0x2a')](function(_0x547500){if(_0x547500&&_0x547500[_0x423f('0x39')]){return _0x547500;}else{var _0x44d8c4=_['cloneDeep'](_0xe25db9);if(_0x30d097[_0x423f('0x3a')]){var _0x53f009={};_0x53f009[_0x30d097[_0x423f('0x3a')]]=_0x18928a;_[_0x423f('0x37')](_0x44d8c4['$or'],_0x53f009);}return _0x38faa9[_0x423f('0x22')](_0x423f('0x3c'))[_0x423f('0x28')](_0x44d8c4,_0x231acc);}});}});case _0x423f('0x18'):var _0x10d7c2=_[_0x423f('0x35')](_0xe25db9);if(_0x30d097[_0x423f('0x36')]){var _0x3832bb={};_0x3832bb[_0x30d097[_0x423f('0x36')]]=_0x18928a;_[_0x423f('0x37')](_0x10d7c2[_0x423f('0x3b')],_0x3832bb);}return _0x38faa9[_0x423f('0x22')](_0x423f('0x38'))[_0x423f('0x28')](_0x10d7c2,_0x231acc)[_0x423f('0x29')]();case'lead':var _0x3829fd=_['cloneDeep'](_0xe25db9);if(_0x30d097['additionalSearchLead']){var _0x3832bb={};_0x3832bb[_0x30d097[_0x423f('0x3a')]]=_0x18928a;_[_0x423f('0x37')](_0x3829fd['$or'],_0x3832bb);}return _0x38faa9[_0x423f('0x22')](_0x423f('0x3c'))[_0x423f('0x28')](_0x3829fd,_0x231acc);case'account':var _0x40fe3c=_[_0x423f('0x35')](_0xe25db9);if(_0x30d097[_0x423f('0x3d')]){var _0x3832bb={};_0x3832bb[_0x30d097['additionalSearchAccount']]=_0x18928a;_[_0x423f('0x37')](_0x40fe3c[_0x423f('0x3b')],_0x3832bb);}return _0x38faa9[_0x423f('0x22')](_0x423f('0x3e'))[_0x423f('0x28')](_0x40fe3c,_0x231acc);default:return null;}})['then'](function(_0xd28e3){if(_0xd28e3&&_0xd28e3[_0x423f('0x39')]){var _0x3bb7f1=_[_0x423f('0x3f')](_0xd28e3);if(_0x3bb7f1){return BPromise['resolve']({'id':_0x3bb7f1['Id'],'name':_0x3bb7f1[_0x423f('0x2d')],'phone':_0x3bb7f1[_0x423f('0x40')],'endUserType':_0x3bb7f1[_0x423f('0x41')][_0x423f('0x42')][_0x423f('0x43')]()});}}})[_0x423f('0x2a')](function(_0x10dbcb){if(_0x10dbcb){logger[_0x423f('0x20')](_0x423f('0x44'),_0x10dbcb['endUserType'],_0x18928a);return BPromise['resolve'](_0x10dbcb);}else{logger[_0x423f('0x20')](_0x423f('0x45'),_0x18928a);var _0x4331b8={'Phone':_0x18928a};if(_0x30d097[_0x423f('0x46')]){if(_0x30d097[_0x423f('0x46')]===_0x423f('0x18')){logger[_0x423f('0x20')](_0x423f('0x47'),_0x18928a,_0x30d097[_0x423f('0x46')]);_0x4331b8['LastName']=_0x1170b4!=='<unknown>'?_0x1170b4:util[_0x423f('0x48')](_0x423f('0x49'),_0x18928a);}else if(_0x30d097['moduleCreate']===_0x423f('0x19')){logger[_0x423f('0x20')](_0x423f('0x47'),_0x18928a,_0x30d097[_0x423f('0x46')]);_0x4331b8[_0x423f('0x4a')]=_0x1170b4!==_0x423f('0x4b')?_0x1170b4:util[_0x423f('0x48')](_0x423f('0x49'),_0x18928a);_0x4331b8[_0x423f('0x4c')]=_0x423f('0x4d');}else if(_0x30d097['moduleCreate']===_0x423f('0x1b')){logger[_0x423f('0x20')](_0x423f('0x47'),_0x18928a,_0x30d097[_0x423f('0x46')]);_0x4331b8[_0x423f('0x2d')]=_0x1170b4!==_0x423f('0x4b')?_0x1170b4:util[_0x423f('0x48')](_0x423f('0x49'),_0x18928a);}else{return null;}}return _0x38faa9[_0x423f('0x22')](_['upperFirst'](_0x30d097[_0x423f('0x46')]))['create'](_0x4331b8)[_0x423f('0x2a')](function(_0x1a765a){return BPromise[_0x423f('0x2f')]({'id':_0x1a765a['id'],'endUserType':_0x30d097[_0x423f('0x46')]});});}});}function getCustomFields(_0x5a2740,_0x2bb031){var _0x135ee0={};if(_0x5a2740[_0x423f('0x39')]>0x0){_[_0x423f('0x4e')](_0x5a2740,function(_0x306e37){if(_[_0x423f('0x4f')]([_0x423f('0x50'),_0x423f('0x51')],_0x306e37['type'])&&_0x306e37[_0x423f('0x52')]){_0x135ee0[_0x306e37[_0x423f('0x52')]]=_0x306e37['content']['toString']();}else if(_0x306e37[_0x423f('0x42')]===_0x423f('0x53')&&_0x306e37[_0x423f('0x54')]&&_0x306e37[_0x423f('0x52')]){_0x2bb031[_0x306e37[_0x423f('0x54')]]&&(_0x135ee0[_0x306e37[_0x423f('0x52')]]=_0x2bb031[_0x306e37['variableName']]['toString']());}else if(_0x306e37[_0x423f('0x42')]===_0x423f('0x55')&&_0x306e37[_0x423f('0x56')]&&_0x306e37[_0x423f('0x56')][_0x423f('0x57')]&&_0x306e37[_0x423f('0x52')]){_0x2bb031[_0x306e37[_0x423f('0x56')][_0x423f('0x57')][_0x423f('0x43')]()]&&(_0x135ee0[_0x306e37[_0x423f('0x52')]]=_0x2bb031[_0x306e37[_0x423f('0x56')][_0x423f('0x57')][_0x423f('0x43')]()][_0x423f('0x58')]());}});}return _0x135ee0;}function getConnection(_0x53c878){var _0xdda234=_0x53c878[_0x423f('0x59')]['concat'](_0x53c878['securityToken']);var _0x448575=new jsforce[(_0x423f('0x5a'))]({'oauth2':{'loginUrl':_0x53c878[_0x423f('0x5b')]||_0x423f('0x5c'),'clientId':_0x53c878[_0x423f('0x5d')],'clientSecret':_0x53c878[_0x423f('0x5e')]}});return _0x448575[_0x423f('0x5f')](_0x53c878['username'],_0xdda234)['then'](function(){logger[_0x423f('0x20')](_0x423f('0x60'));return _0x448575;});}exports['queue']=function(_0x157e9e,_0x47eb0e,_0x439946,_0x2d31d8,_0x4ba7cd,_0x5f0c10){var _0x30d172,_0x1560a2,_0x4e2082,_0x3e9ab3;_0x5f0c10[_0x423f('0x61')]=intUtil[_0x423f('0x62')](_0x5f0c10[_0x423f('0x61')]);_0x5f0c10['remoteUri']=intUtil['stripTrailingSlash'](_0x5f0c10['remoteUri']);if(_0x4ba7cd&&_0x4ba7cd[_0x423f('0x63')]){logger['info'](_0x423f('0x64'),_0x423f('0x65'));_0x47eb0e[_0x423f('0x66')]=util[_0x423f('0x48')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5f0c10[_0x423f('0x61')],_0x47eb0e[_0x423f('0x67')],md5(_0x47eb0e[_0x423f('0x67')]));}else{_0x47eb0e[_0x423f('0x66')]='';}return getConnection(_0x5f0c10)[_0x423f('0x2a')](function(_0x55ff3d){_0x3e9ab3=_0x55ff3d;return getUser(_0x5f0c10,_0x2d31d8['email'],_0x3e9ab3);})['then'](function(_0x3497bc){_0x30d172=_0x3497bc;return getEndUser(_0x5f0c10,_0x439946,_0x47eb0e[_0x423f('0x68')],_0x47eb0e[_0x423f('0x69')],_0x3e9ab3);})[_0x423f('0x2a')](function(_0x8cdc6){_0x1560a2=_0x8cdc6;return getTicket(_0x5f0c10,_0x30d172,_0x1560a2,_0x439946,_0x47eb0e,_0x439946[_0x423f('0x6a')],_0x3e9ab3,_0x423f('0x6b'));})[_0x423f('0x2a')](function(_0x1fb3c8){_0x4e2082=_0x1fb3c8;logger[_0x423f('0x20')](_0x423f('0x6c'),_0x4e2082['id']);logger[_0x423f('0x20')](_0x423f('0x6d'),_0x4e2082['id'],_0x2d31d8[_0x423f('0x57')],_0x5f0c10[_0x423f('0x42')]);switch(_0x5f0c10[_0x423f('0x42')]){case'integrationTab':emit(util[_0x423f('0x48')](_0x423f('0x6e'),_0x2d31d8[_0x423f('0x57')]),_0x423f('0x6f'),{'recordId':_0x4e2082['id']});break;case'newTab':emit(util['format'](_0x423f('0x6e'),_0x2d31d8[_0x423f('0x57')]),_0x423f('0x70'),{'uri':util[_0x423f('0x48')](_0x423f('0x71'),_0x3e9ab3[_0x423f('0x72')],_0x4e2082['id'])});break;default:logger[_0x423f('0x73')](_0x423f('0x74'));}})[_0x423f('0x75')](function(_0x5d1349){logger[_0x423f('0x73')](_0x423f('0x64'),_0x5d1349);});};exports[_0x423f('0x76')]=function(_0x484533,_0x816fc5,_0x1e0753,_0x59f592,_0x222172,_0x48f242,_0x3ffa2b){var _0x1e06d8,_0xe565c7,_0x2f2848,_0x294c07;_0x48f242['serverUrl']=intUtil['stripTrailingSlash'](_0x48f242[_0x423f('0x61')]);_0x48f242[_0x423f('0x5b')]=intUtil['stripTrailingSlash'](_0x48f242['remoteUri']);if(_0x3ffa2b&&_0x3ffa2b[_0x423f('0x77')]&&_0x3ffa2b['recordingFormat']!==_0x423f('0x78')){logger[_0x423f('0x20')](_0x423f('0x79'),'Recording\x20is\x20enabled!');_0x816fc5['recordingURL']=util[_0x423f('0x48')](_0x423f('0x7a'),_0x48f242['serverUrl'],_0x816fc5[_0x423f('0x67')],md5(_0x816fc5['uniqueid']));}return getConnection(_0x48f242)[_0x423f('0x2a')](function(_0x313fb7){_0x294c07=_0x313fb7;return getUser(_0x48f242,_0x59f592['email'],_0x294c07);})[_0x423f('0x2a')](function(_0x49ead5){_0x1e06d8=_0x49ead5;return getEndUser(_0x48f242,_0x1e0753,_0x816fc5[_0x423f('0x7b')],_0x816fc5[_0x423f('0x7c')],_0x294c07);})['then'](function(_0x4062e4){_0xe565c7=_0x4062e4;return getTicket(_0x48f242,_0x1e06d8,_0xe565c7,_0x1e0753,_0x816fc5,_0x1e0753[_0x423f('0x6a')],_0x294c07,'outbound');})[_0x423f('0x2a')](function(_0x1d1c8e){_0x2f2848=_0x1d1c8e;logger[_0x423f('0x20')](_0x423f('0x7d'),_0x2f2848['id']);logger[_0x423f('0x20')](_0x423f('0x7e'),_0x2f2848['id'],_0x59f592[_0x423f('0x57')],_0x48f242[_0x423f('0x42')]);switch(_0x48f242[_0x423f('0x42')]){case _0x423f('0x7f'):emit(util['format'](_0x423f('0x6e'),_0x59f592[_0x423f('0x57')]),_0x423f('0x6f'),{'recordId':_0x2f2848['id']});break;case _0x423f('0x80'):emit(util[_0x423f('0x48')](_0x423f('0x6e'),_0x59f592[_0x423f('0x57')]),'trigger:browser:url',{'uri':util['format'](_0x423f('0x71'),_0x294c07[_0x423f('0x72')],_0x2f2848['id'])});break;default:logger['error'](_0x423f('0x79'),_0x423f('0x81'));}})['catch'](function(_0x5b5f02){logger[_0x423f('0x73')]('[OUTBOUND]',_0x5b5f02);});};exports[_0x423f('0x82')]=function(_0x2eba29,_0x2b2638,_0x58f66c,_0x377950,_0x6acdb,_0x42e3fb){var _0x1d1ed3,_0x5f52f1,_0x3554cd,_0x3949cc;_0x42e3fb[_0x423f('0x61')]=intUtil['stripTrailingSlash'](_0x42e3fb[_0x423f('0x61')]);_0x42e3fb[_0x423f('0x5b')]=intUtil[_0x423f('0x62')](_0x42e3fb[_0x423f('0x5b')]);if(_0x6acdb&&_0x6acdb[_0x423f('0x63')]){logger['info']('['+_0x2b2638[_0x423f('0x83')][_0x423f('0x84')]()+']',_0x423f('0x65'));_0x2b2638[_0x423f('0x66')]=util[_0x423f('0x48')](_0x423f('0x7a'),_0x42e3fb['serverUrl'],_0x2b2638['uniqueid'],md5(_0x2b2638['uniqueid']));}else{_0x2b2638[_0x423f('0x66')]='';}return getConnection(_0x42e3fb)['then'](function(_0x450407){_0x3949cc=_0x450407;if(!_[_0x423f('0x25')](_0x377950)){return getUser(_0x42e3fb,_0x377950[_0x423f('0x57')],_0x3949cc);}else{return getUser(_0x42e3fb,null,_0x3949cc);}})[_0x423f('0x2a')](function(_0x9ff4a8){_0x1d1ed3=_0x9ff4a8;return getEndUser(_0x42e3fb,_0x58f66c,_0x2b2638[_0x423f('0x68')],_0x2b2638[_0x423f('0x69')],_0x3949cc);})['then'](function(_0x3f3c36){_0x5f52f1=_0x3f3c36;return getTicket(_0x42e3fb,_0x1d1ed3,_0x5f52f1,_0x58f66c,_0x2b2638,_0x58f66c[_0x423f('0x6a')],_0x3949cc);})['then'](function(_0x428132){_0x3554cd=_0x428132;logger[_0x423f('0x20')]('['+_0x2b2638[_0x423f('0x83')][_0x423f('0x84')]()+_0x423f('0x85'),_0x3554cd['id']);logger[_0x423f('0x20')]('['+_0x2b2638[_0x423f('0x83')][_0x423f('0x84')]()+_0x423f('0x86'),_0x42e3fb[_0x423f('0x42')]);})[_0x423f('0x75')](function(_0x3209c6){logger[_0x423f('0x73')]('['+_0x2b2638[_0x423f('0x83')]['toUpperCase']()+']',_0x3209c6);});};
\ No newline at end of file
+var _0x2b4b=['ticketType','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','account','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','then','length','find','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','Lead','additionalSearchAccount','Account','first','Name','Phone','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Caller\x20-\x20%s','LastName','<unknown>','format','Company','upperFirst','forEach','includes','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','password','securityToken','remoteUri','https://login.salesforce.com','clientId','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','email','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','md5','jsforce','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','getString','Descriptions'];(function(_0x4a9a1c,_0x25e250){var _0x10fe5f=function(_0x2a22cd){while(--_0x2a22cd){_0x4a9a1c['push'](_0x4a9a1c['shift']());}};_0x10fe5f(++_0x25e250);}(_0x2b4b,0x1ce));var _0xb2b4=function(_0x130cd2,_0x42b509){_0x130cd2=_0x130cd2-0x0;var _0x3662a1=_0x2b4b[_0x130cd2];return _0x3662a1;};'use strict';var _=require(_0xb2b4('0x0'));var rp=require('request-promise');var moment=require(_0xb2b4('0x1'));var BPromise=require('bluebird');var md5=require(_0xb2b4('0x2'));var jsforce=require(_0xb2b4('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xb2b4('0x4'));var config=require(_0xb2b4('0x5'));var logger=require(_0xb2b4('0x6'))(_0xb2b4('0x7'));config[_0xb2b4('0x8')]=_['defaults'](config['redis'],{'host':_0xb2b4('0x9'),'port':0x18eb});var io=require(_0xb2b4('0xa'))(new Redis(config[_0xb2b4('0x8')]));function emit(_0x116d8f,_0x4c965,_0x13ca71){io['to'](_0x116d8f)[_0xb2b4('0xb')](_0x4c965,_0x13ca71);}function getTicket(_0xfbf12,_0x5b0b61,_0x4d227c,_0xdd8855,_0x34b12f,_0x20b5b4,_0x510481,_0x6a8b0e){var _0xf01739=Object['assign']({},{'OwnerId':_0x5b0b61['id'],'Subject':intUtil[_0xb2b4('0xc')](_0xdd8855['Subjects'],_0x34b12f,'\x20'),'Description':intUtil[_0xb2b4('0xc')](_0xdd8855[_0xb2b4('0xd')],_0x34b12f,'\x0a')},getCustomFields(_0x20b5b4,_0x34b12f));if(_0x4d227c){if(_0xdd8855[_0xb2b4('0xe')]==='Task'){_0xf01739[_0xb2b4('0xf')]=moment['utc']();_0xf01739[_0xb2b4('0x10')]=![];_0xf01739[_0xb2b4('0x11')]=![];if(_0x4d227c[_0xb2b4('0x12')]===_0xb2b4('0x13')||_0x4d227c[_0xb2b4('0x12')]===_0xb2b4('0x14')){_0xf01739['WhoId']=_0x4d227c['id'];}else if(_0x4d227c[_0xb2b4('0x12')]===_0xb2b4('0x15')){_0xf01739['WhatId']=_0x4d227c['id'];}}else if(_0xdd8855['ticketType']===_0xb2b4('0x16')){if(_0x4d227c[_0xb2b4('0x12')]===_0xb2b4('0x13')){_0xf01739[_0xb2b4('0x17')]=_0x4d227c['id'];}else if(_0x4d227c[_0xb2b4('0x12')]===_0xb2b4('0x15')){_0xf01739[_0xb2b4('0x18')]=_0x4d227c['id'];}else if(_0x4d227c['endUserType']===_0xb2b4('0x14')&&_0xdd8855[_0xb2b4('0x19')]){_0xf01739[_0xdd8855['leadId']]=_0x4d227c['id'];}else{logger[_0xb2b4('0x1a')](_0xb2b4('0x1b'));}}}return _0x510481[_0xb2b4('0x1c')](_0xdd8855[_0xb2b4('0xe')])[_0xb2b4('0x1d')](_0xf01739);}function getUser(_0x2583fb,_0x3c97c5,_0x1172ef){if(!_[_0xb2b4('0x1e')](_0x3c97c5)&&intUtil['validateEmail'](_0x3c97c5)){var _0x39d845={'Email':_0x3c97c5};var _0xd7c3cf={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1172ef[_0xb2b4('0x1c')]('User')['find'](_0x39d845,_0xd7c3cf)['execute']()[_0xb2b4('0x1f')](function(_0x2f6a7e){if(_0x2f6a7e[_0xb2b4('0x20')]){var _0x2c372e=_[_0xb2b4('0x21')](_0x2f6a7e,function(_0x1bad04){return _0x1bad04[_0xb2b4('0x22')]===_0x3c97c5;});if(_0x2c372e){logger['info'](_0xb2b4('0x23'),_0x3c97c5);return BPromise[_0xb2b4('0x24')]({'id':_0x2c372e['Id'],'name':_0x2c372e['Name']});}}else{logger[_0xb2b4('0x1a')](_0xb2b4('0x25'),_0x3c97c5);return _0x1172ef[_0xb2b4('0x26')]()[_0xb2b4('0x1f')](function(_0x29540b){return BPromise['resolve']({'id':_0x29540b['user_id'],'name':_0x29540b[_0xb2b4('0x27')]});});}});}else{logger[_0xb2b4('0x1a')](_0xb2b4('0x25'),_0x3c97c5);return _0x1172ef[_0xb2b4('0x26')]()[_0xb2b4('0x1f')](function(_0x28f096){return BPromise[_0xb2b4('0x24')]({'id':_0x28f096[_0xb2b4('0x28')],'name':_0x28f096[_0xb2b4('0x27')]});});}}function getEndUser(_0x36c3cf,_0x901408,_0x33859a,_0x4c0b14,_0xf65dc6){var _0x5ac09f={'$or':{'Phone':_0x4c0b14}};var _0x3bfc77={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb2b4('0x24')]()[_0xb2b4('0x1f')](function(){logger[_0xb2b4('0x1a')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x4c0b14,_0x901408[_0xb2b4('0x29')]);switch(_0x901408[_0xb2b4('0x29')]){case _0xb2b4('0x2a'):var _0x3a5e9b=_[_0xb2b4('0x2b')](_0x5ac09f);if(_0x901408['additionalSearchContact']){var _0x30ce47={};_0x30ce47[_0x901408[_0xb2b4('0x2c')]]=_0x4c0b14;_[_0xb2b4('0x2d')](_0x3a5e9b[_0xb2b4('0x2e')],_0x30ce47);}return _0xf65dc6[_0xb2b4('0x1c')](_0xb2b4('0x2f'))[_0xb2b4('0x21')](_0x3a5e9b,_0x3bfc77)[_0xb2b4('0x30')]()[_0xb2b4('0x1f')](function(_0x150b1d){if(_0x150b1d&&_0x150b1d[_0xb2b4('0x20')]){return _0x150b1d;}else{var _0x179619=_[_0xb2b4('0x2b')](_0x5ac09f);if(_0x901408[_0xb2b4('0x31')]){var _0x3cdbba={};_0x3cdbba[_0x901408['additionalSearchLead']]=_0x4c0b14;_[_0xb2b4('0x2d')](_0x179619[_0xb2b4('0x2e')],_0x3cdbba);}return _0xf65dc6[_0xb2b4('0x1c')](_0xb2b4('0x32'))[_0xb2b4('0x21')](_0x179619,_0x3bfc77);}});case'account_contact_lead':var _0x16b80d=_[_0xb2b4('0x2b')](_0x5ac09f);if(_0x901408[_0xb2b4('0x33')]){var _0x30ce47={};_0x30ce47[_0x901408[_0xb2b4('0x33')]]=_0x4c0b14;_[_0xb2b4('0x2d')](_0x16b80d[_0xb2b4('0x2e')],_0x30ce47);}return _0xf65dc6['sobject'](_0xb2b4('0x34'))[_0xb2b4('0x21')](_0x16b80d,_0x3bfc77)[_0xb2b4('0x30')]()[_0xb2b4('0x1f')](function(_0x1c7e80){if(_0x1c7e80&&_0x1c7e80[_0xb2b4('0x20')]){return _0x1c7e80;}else{var _0x30e499=_[_0xb2b4('0x2b')](_0x5ac09f);if(_0x901408['additionalSearchContact']){var _0x1e08ac={};_0x1e08ac[_0x901408[_0xb2b4('0x2c')]]=_0x4c0b14;_[_0xb2b4('0x2d')](_0x30e499[_0xb2b4('0x2e')],_0x1e08ac);}return _0xf65dc6[_0xb2b4('0x1c')](_0xb2b4('0x2f'))[_0xb2b4('0x21')](_0x30e499,_0x3bfc77)['then'](function(_0x111427){if(_0x111427&&_0x111427[_0xb2b4('0x20')]){return _0x111427;}else{var _0x32caaf=_['cloneDeep'](_0x5ac09f);if(_0x901408[_0xb2b4('0x31')]){var _0x23bd7e={};_0x23bd7e[_0x901408['additionalSearchLead']]=_0x4c0b14;_[_0xb2b4('0x2d')](_0x32caaf['$or'],_0x23bd7e);}return _0xf65dc6[_0xb2b4('0x1c')]('Lead')[_0xb2b4('0x21')](_0x32caaf,_0x3bfc77);}});}});case _0xb2b4('0x13'):var _0x3a5e9b=_[_0xb2b4('0x2b')](_0x5ac09f);if(_0x901408[_0xb2b4('0x2c')]){var _0x30ce47={};_0x30ce47[_0x901408[_0xb2b4('0x2c')]]=_0x4c0b14;_[_0xb2b4('0x2d')](_0x3a5e9b[_0xb2b4('0x2e')],_0x30ce47);}return _0xf65dc6['sobject']('Contact')[_0xb2b4('0x21')](_0x3a5e9b,_0x3bfc77)['execute']();case _0xb2b4('0x14'):var _0xde1fcc=_[_0xb2b4('0x2b')](_0x5ac09f);if(_0x901408[_0xb2b4('0x31')]){var _0x30ce47={};_0x30ce47[_0x901408[_0xb2b4('0x31')]]=_0x4c0b14;_[_0xb2b4('0x2d')](_0xde1fcc[_0xb2b4('0x2e')],_0x30ce47);}return _0xf65dc6[_0xb2b4('0x1c')]('Lead')[_0xb2b4('0x21')](_0xde1fcc,_0x3bfc77);case _0xb2b4('0x15'):var _0x16b80d=_[_0xb2b4('0x2b')](_0x5ac09f);if(_0x901408['additionalSearchAccount']){var _0x30ce47={};_0x30ce47[_0x901408[_0xb2b4('0x33')]]=_0x4c0b14;_[_0xb2b4('0x2d')](_0x16b80d[_0xb2b4('0x2e')],_0x30ce47);}return _0xf65dc6[_0xb2b4('0x1c')](_0xb2b4('0x34'))[_0xb2b4('0x21')](_0x16b80d,_0x3bfc77);default:return null;}})[_0xb2b4('0x1f')](function(_0x51144c){if(_0x51144c&&_0x51144c[_0xb2b4('0x20')]){var _0x3b1b90=_[_0xb2b4('0x35')](_0x51144c);if(_0x3b1b90){return BPromise[_0xb2b4('0x24')]({'id':_0x3b1b90['Id'],'name':_0x3b1b90[_0xb2b4('0x36')],'phone':_0x3b1b90[_0xb2b4('0x37')],'endUserType':_0x3b1b90['attributes']['type'][_0xb2b4('0x38')]()});}}})[_0xb2b4('0x1f')](function(_0x4b1da6){if(_0x4b1da6){logger[_0xb2b4('0x1a')](_0xb2b4('0x39'),_0x4b1da6['endUserType'],_0x4c0b14);return BPromise['resolve'](_0x4b1da6);}else{logger['info'](_0xb2b4('0x3a'),_0x4c0b14);var _0x1c31a8={'Phone':_0x4c0b14};if(_0x901408[_0xb2b4('0x3b')]){if(_0x901408[_0xb2b4('0x3b')]===_0xb2b4('0x13')){logger['info'](_0xb2b4('0x3c'),_0x4c0b14,_0x901408[_0xb2b4('0x3b')]);_0x1c31a8['LastName']=_0x33859a!=='<unknown>'?_0x33859a:util['format'](_0xb2b4('0x3d'),_0x4c0b14);}else if(_0x901408[_0xb2b4('0x3b')]==='lead'){logger[_0xb2b4('0x1a')](_0xb2b4('0x3c'),_0x4c0b14,_0x901408[_0xb2b4('0x3b')]);_0x1c31a8[_0xb2b4('0x3e')]=_0x33859a!==_0xb2b4('0x3f')?_0x33859a:util[_0xb2b4('0x40')]('Caller\x20-\x20%s',_0x4c0b14);_0x1c31a8[_0xb2b4('0x41')]='No\x20Company';}else if(_0x901408[_0xb2b4('0x3b')]==='account'){logger['info'](_0xb2b4('0x3c'),_0x4c0b14,_0x901408[_0xb2b4('0x3b')]);_0x1c31a8[_0xb2b4('0x36')]=_0x33859a!=='<unknown>'?_0x33859a:util['format'](_0xb2b4('0x3d'),_0x4c0b14);}else{return null;}}return _0xf65dc6['sobject'](_[_0xb2b4('0x42')](_0x901408[_0xb2b4('0x3b')]))[_0xb2b4('0x1d')](_0x1c31a8)[_0xb2b4('0x1f')](function(_0x422eb3){return BPromise[_0xb2b4('0x24')]({'id':_0x422eb3['id'],'endUserType':_0x901408['moduleCreate']});});}});}function getCustomFields(_0x2dcc20,_0xeed260){var _0x2a0e99={};if(_0x2dcc20[_0xb2b4('0x20')]>0x0){_[_0xb2b4('0x43')](_0x2dcc20,function(_0x40e816){if(_[_0xb2b4('0x44')](['string',_0xb2b4('0x45')],_0x40e816[_0xb2b4('0x46')])&&_0x40e816[_0xb2b4('0x47')]){_0x2a0e99[_0x40e816[_0xb2b4('0x47')]]=_0x40e816['content'][_0xb2b4('0x48')]();}else if(_0x40e816['type']===_0xb2b4('0x49')&&_0x40e816['variableName']&&_0x40e816[_0xb2b4('0x47')]){_0xeed260[_0x40e816[_0xb2b4('0x4a')]]&&(_0x2a0e99[_0x40e816[_0xb2b4('0x47')]]=_0xeed260[_0x40e816['variableName']]['toString']());}else if(_0x40e816['type']===_0xb2b4('0x4b')&&_0x40e816[_0xb2b4('0x4c')]&&_0x40e816[_0xb2b4('0x4c')][_0xb2b4('0x4d')]&&_0x40e816[_0xb2b4('0x47')]){_0xeed260[_0x40e816[_0xb2b4('0x4c')][_0xb2b4('0x4d')]['toLowerCase']()]&&(_0x2a0e99[_0x40e816['idField']]=_0xeed260[_0x40e816[_0xb2b4('0x4c')][_0xb2b4('0x4d')][_0xb2b4('0x38')]()][_0xb2b4('0x48')]());}});}return _0x2a0e99;}function getConnection(_0x4efd30){var _0x73e63d=_0x4efd30[_0xb2b4('0x4e')]['concat'](_0x4efd30[_0xb2b4('0x4f')]);var _0x38904f=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4efd30[_0xb2b4('0x50')]||_0xb2b4('0x51'),'clientId':_0x4efd30[_0xb2b4('0x52')],'clientSecret':_0x4efd30['clientSecret']}});return _0x38904f['login'](_0x4efd30[_0xb2b4('0x53')],_0x73e63d)[_0xb2b4('0x1f')](function(){logger[_0xb2b4('0x1a')](_0xb2b4('0x54'));return _0x38904f;});}exports[_0xb2b4('0x55')]=function(_0x4a61b7,_0x454ac1,_0x55eac9,_0x49308b,_0x4e583b,_0x2dc95b){var _0x2fdd6b,_0x574286,_0x54a4c8,_0x37daf2;_0x2dc95b[_0xb2b4('0x56')]=intUtil[_0xb2b4('0x57')](_0x2dc95b[_0xb2b4('0x56')]);_0x2dc95b[_0xb2b4('0x50')]=intUtil[_0xb2b4('0x57')](_0x2dc95b['remoteUri']);if(_0x4e583b&&_0x4e583b['monitor_format']){logger['info']('[QUEUE]',_0xb2b4('0x58'));_0x454ac1[_0xb2b4('0x59')]=util[_0xb2b4('0x40')](_0xb2b4('0x5a'),_0x2dc95b[_0xb2b4('0x56')],_0x454ac1[_0xb2b4('0x5b')],md5(_0x454ac1[_0xb2b4('0x5b')]));}else{_0x454ac1[_0xb2b4('0x59')]='';}return getConnection(_0x2dc95b)[_0xb2b4('0x1f')](function(_0x224998){_0x37daf2=_0x224998;return getUser(_0x2dc95b,_0x49308b['email'],_0x37daf2);})[_0xb2b4('0x1f')](function(_0x23ba2a){_0x2fdd6b=_0x23ba2a;return getEndUser(_0x2dc95b,_0x55eac9,_0x454ac1[_0xb2b4('0x5c')],_0x454ac1[_0xb2b4('0x5d')],_0x37daf2);})['then'](function(_0x307eaf){_0x574286=_0x307eaf;return getTicket(_0x2dc95b,_0x2fdd6b,_0x574286,_0x55eac9,_0x454ac1,_0x55eac9['Fields'],_0x37daf2,_0xb2b4('0x55'));})[_0xb2b4('0x1f')](function(_0x11eb9d){_0x54a4c8=_0x11eb9d;logger[_0xb2b4('0x1a')](_0xb2b4('0x5e'),_0x54a4c8['id']);logger['info'](_0xb2b4('0x5f'),_0x54a4c8['id'],_0x49308b[_0xb2b4('0x4d')],_0x2dc95b[_0xb2b4('0x46')]);switch(_0x2dc95b[_0xb2b4('0x46')]){case'integrationTab':emit(util[_0xb2b4('0x40')]('user:%s',_0x49308b[_0xb2b4('0x4d')]),_0xb2b4('0x60'),{'recordId':_0x54a4c8['id']});break;case _0xb2b4('0x61'):emit(util['format'](_0xb2b4('0x62'),_0x49308b[_0xb2b4('0x4d')]),_0xb2b4('0x63'),{'uri':util['format'](_0xb2b4('0x64'),_0x37daf2[_0xb2b4('0x65')],_0x54a4c8['id'])});break;default:logger[_0xb2b4('0x66')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xb2b4('0x67')](function(_0x412c27){logger[_0xb2b4('0x66')](_0xb2b4('0x68'),_0x412c27);});};exports[_0xb2b4('0x69')]=function(_0x50abb8,_0x598b85,_0x46fc70,_0x40b806,_0x578a59,_0x20b8e4,_0x116dd1){var _0xfee56,_0x5b21aa,_0x5aab60,_0x5c42e4;_0x20b8e4[_0xb2b4('0x56')]=intUtil[_0xb2b4('0x57')](_0x20b8e4[_0xb2b4('0x56')]);_0x20b8e4['remoteUri']=intUtil[_0xb2b4('0x57')](_0x20b8e4['remoteUri']);if(_0x116dd1&&_0x116dd1[_0xb2b4('0x6a')]&&_0x116dd1[_0xb2b4('0x6a')]!=='none'){logger[_0xb2b4('0x1a')](_0xb2b4('0x6b'),'Recording\x20is\x20enabled!');_0x598b85[_0xb2b4('0x59')]=util[_0xb2b4('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20b8e4['serverUrl'],_0x598b85[_0xb2b4('0x5b')],md5(_0x598b85[_0xb2b4('0x5b')]));}return getConnection(_0x20b8e4)['then'](function(_0x1b1eb7){_0x5c42e4=_0x1b1eb7;return getUser(_0x20b8e4,_0x40b806[_0xb2b4('0x6c')],_0x5c42e4);})[_0xb2b4('0x1f')](function(_0x1dd6c0){_0xfee56=_0x1dd6c0;return getEndUser(_0x20b8e4,_0x46fc70,_0x598b85[_0xb2b4('0x6d')],_0x598b85['destcalleridnum'],_0x5c42e4);})['then'](function(_0x40918c){_0x5b21aa=_0x40918c;return getTicket(_0x20b8e4,_0xfee56,_0x5b21aa,_0x46fc70,_0x598b85,_0x46fc70[_0xb2b4('0x6e')],_0x5c42e4,'outbound');})[_0xb2b4('0x1f')](function(_0x147f3b){_0x5aab60=_0x147f3b;logger[_0xb2b4('0x1a')](_0xb2b4('0x6f'),_0x5aab60['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5aab60['id'],_0x40b806[_0xb2b4('0x4d')],_0x20b8e4[_0xb2b4('0x46')]);switch(_0x20b8e4[_0xb2b4('0x46')]){case _0xb2b4('0x70'):emit(util[_0xb2b4('0x40')](_0xb2b4('0x62'),_0x40b806[_0xb2b4('0x4d')]),_0xb2b4('0x60'),{'recordId':_0x5aab60['id']});break;case _0xb2b4('0x61'):emit(util[_0xb2b4('0x40')]('user:%s',_0x40b806[_0xb2b4('0x4d')]),_0xb2b4('0x63'),{'uri':util[_0xb2b4('0x40')](_0xb2b4('0x64'),_0x5c42e4['instanceUrl'],_0x5aab60['id'])});break;default:logger[_0xb2b4('0x66')](_0xb2b4('0x6b'),_0xb2b4('0x71'));}})['catch'](function(_0x565f5e){logger[_0xb2b4('0x66')](_0xb2b4('0x6b'),_0x565f5e);});};exports[_0xb2b4('0x72')]=function(_0x3482cf,_0x2c10cf,_0x15aa5a,_0x471bb0,_0x4e9b5f,_0x2f84bd){var _0xe8edb2,_0xf85abe,_0x5c7f7c,_0x5f0754;_0x2f84bd[_0xb2b4('0x56')]=intUtil[_0xb2b4('0x57')](_0x2f84bd[_0xb2b4('0x56')]);_0x2f84bd[_0xb2b4('0x50')]=intUtil[_0xb2b4('0x57')](_0x2f84bd[_0xb2b4('0x50')]);if(_0x4e9b5f&&_0x4e9b5f['monitor_format']){logger[_0xb2b4('0x1a')]('['+_0x2c10cf[_0xb2b4('0x73')]['toUpperCase']()+']',_0xb2b4('0x58'));_0x2c10cf[_0xb2b4('0x59')]=util[_0xb2b4('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f84bd[_0xb2b4('0x56')],_0x2c10cf['uniqueid'],md5(_0x2c10cf['uniqueid']));}else{_0x2c10cf[_0xb2b4('0x59')]='';}return getConnection(_0x2f84bd)['then'](function(_0x58f4cb){_0x5f0754=_0x58f4cb;if(!_[_0xb2b4('0x1e')](_0x471bb0)){return getUser(_0x2f84bd,_0x471bb0[_0xb2b4('0x4d')],_0x5f0754);}else{return getUser(_0x2f84bd,null,_0x5f0754);}})[_0xb2b4('0x1f')](function(_0xfa2a4f){_0xe8edb2=_0xfa2a4f;return getEndUser(_0x2f84bd,_0x15aa5a,_0x2c10cf[_0xb2b4('0x5c')],_0x2c10cf[_0xb2b4('0x5d')],_0x5f0754);})['then'](function(_0x19aae2){_0xf85abe=_0x19aae2;return getTicket(_0x2f84bd,_0xe8edb2,_0xf85abe,_0x15aa5a,_0x2c10cf,_0x15aa5a[_0xb2b4('0x6e')],_0x5f0754);})[_0xb2b4('0x1f')](function(_0x44a2a0){_0x5c7f7c=_0x44a2a0;logger[_0xb2b4('0x1a')]('['+_0x2c10cf[_0xb2b4('0x73')][_0xb2b4('0x74')]()+_0xb2b4('0x75'),_0x5c7f7c['id']);logger[_0xb2b4('0x1a')]('['+_0x2c10cf[_0xb2b4('0x73')][_0xb2b4('0x74')]()+_0xb2b4('0x76'),_0x2f84bd[_0xb2b4('0x46')]);})[_0xb2b4('0x67')](function(_0x11ab6a){logger['error']('['+_0x2c10cf['lastevent']['toUpperCase']()+']',_0x11ab6a);});};
\ No newline at end of file
index ab4873b..832ba84 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfcc2=['endUserNumber','user','System','],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','picklist','type','nameField','customField','toLowerCase','content','toString','string','idField','variableName','Variable','outbound','POST','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketNumber',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','emit','username','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20ServiceNow\x20integration','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminId','],\x20getUser\x20crm','catch','adminEmail','sys_user?'];(function(_0x3f170c,_0x5326d5){var _0x2f4a69=function(_0x195f2f){while(--_0x195f2f){_0x3f170c['push'](_0x3f170c['shift']());}};_0x2f4a69(++_0x5326d5);}(_0xfcc2,0xac));var _0x2fcc=function(_0x64bfd5,_0x26eed5){_0x64bfd5=_0x64bfd5-0x0;var _0x4f191e=_0xfcc2[_0x64bfd5];return _0x4f191e;};'use strict';var _=require('lodash');var Promise=require(_0x2fcc('0x0'));var rp=require(_0x2fcc('0x1'));var util=require(_0x2fcc('0x2'));var md5=require(_0x2fcc('0x3'));var Redis=require(_0x2fcc('0x4'));var intUtil=require(_0x2fcc('0x5'));var config=require(_0x2fcc('0x6'));var logger=require(_0x2fcc('0x7'))(_0x2fcc('0x8'));config[_0x2fcc('0x9')]=_['defaults'](config[_0x2fcc('0x9')],{'host':_0x2fcc('0xa'),'port':0x18eb});var io=require(_0x2fcc('0xb'))(new Redis(config['redis']));function getAdminUser(_0xc9f709,_0x5d0390,_0x22032a,_0x54dae5,_0x2291e5,_0x567040){return new Promise(function(_0x294a2d,_0x3faf8e){var _0x5a5ba0={'method':_0x2fcc('0xc'),'uri':_0x54dae5+_0x2fcc('0xd')+'&'+_0x2291e5+'&'+_0x567040,'auth':_0x5d0390,'json':!![]};return rp(_0x5a5ba0)[_0x2fcc('0xe')](function(_0x3997c9){if(_0x3997c9[_0x2fcc('0xf')][_0x2fcc('0x10')]>0x0){_0x22032a['adminId']=_0x3997c9[_0x2fcc('0xf')][0x0][_0x2fcc('0x11')];}logger[_0x2fcc('0x12')]('['+[_0xc9f709[_0x2fcc('0x13')]()]+_0x2fcc('0x14'),_0x22032a);_0x294a2d(_0x22032a);})['catch'](function(_0x31cfe5){logger[_0x2fcc('0x15')]('['+[_0xc9f709['toUpperCase']()]+']',_0x31cfe5[_0x2fcc('0x16')]);_0x3faf8e(_0x31cfe5['message']);});});}function getUser(_0x3484ab,_0x36949f,_0xafc7d8,_0x47344a,_0x73076){return function(_0x3aff87){logger[_0x2fcc('0x12')]('['+[_0x3484ab[_0x2fcc('0x13')]()]+_0x2fcc('0x17'),_0x3aff87);return new Promise(function(_0x56112e,_0x5c0d1f){if(intUtil[_0x2fcc('0x18')](_0x3aff87[_0x2fcc('0x19')])){var _0x27627e={'method':_0x2fcc('0xc'),'uri':_0xafc7d8+_0x2fcc('0x1a')+_0x3aff87[_0x2fcc('0x19')]+'&'+_0x47344a+'&'+_0x73076,'auth':_0x36949f,'json':!![]};logger['info']('['+[_0x3484ab[_0x2fcc('0x13')]()]+_0x2fcc('0x1b'),_0x27627e);return rp(_0x27627e)['then'](function(_0x4edb5f){logger[_0x2fcc('0x12')]('['+[_0x3484ab[_0x2fcc('0x13')]()]+_0x2fcc('0x1c'),_0x4edb5f);if(_0x4edb5f[_0x2fcc('0xf')][_0x2fcc('0x10')]>0x0&&String(_0x4edb5f[_0x2fcc('0xf')][0x0]['active'])===_0x2fcc('0x1d')){_0x3aff87[_0x2fcc('0x1e')]=_0x4edb5f[_0x2fcc('0xf')][0x0][_0x2fcc('0x11')];}else{_0x3aff87[_0x2fcc('0x1e')]=_0x3aff87[_0x2fcc('0x1f')];_0x3aff87[_0x2fcc('0x19')]=_0x3aff87['adminEmail'];}logger['info']('['+[_0x3484ab[_0x2fcc('0x13')]()]+_0x2fcc('0x20'),_0x3aff87);_0x56112e(_0x3aff87);})[_0x2fcc('0x21')](function(_0x5576e2){logger[_0x2fcc('0x15')]('['+[_0x3484ab[_0x2fcc('0x13')]()]+']',_0x5576e2[_0x2fcc('0x16')]);_0x5c0d1f(_0x5576e2[_0x2fcc('0x16')]);});}else{logger[_0x2fcc('0x12')]('['+[_0x3484ab[_0x2fcc('0x13')]()]+']\x20using\x20admin\x20profile');_0x3aff87[_0x2fcc('0x1e')]=_0x3aff87[_0x2fcc('0x1f')];_0x3aff87['userEmail']=_0x3aff87[_0x2fcc('0x22')];_0x56112e(_0x3aff87);}});};}function createEndUser(_0x39b4a5,_0x3c02a1,_0x355f93,_0x109c7b,_0x44d233){logger['info']('['+[_0x39b4a5['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x355f93);return new Promise(function(_0x2e4379,_0x5d036d){var _0x5766ee={'method':'POST','uri':_0x109c7b+_0x2fcc('0x23')+_0x44d233,'body':{'user_name':_0x355f93[_0x2fcc('0x24')],'roles':_0x2fcc('0x25'),'first_name':_0x355f93['endUserNumber'],'active':_0x2fcc('0x1d'),'date_format':_0x2fcc('0x26'),'phone':_0x355f93['endUserNumber']},'auth':_0x3c02a1,'json':!![]};return rp(_0x5766ee)[_0x2fcc('0xe')](function(_0xd27923){logger[_0x2fcc('0x12')]('['+[_0x39b4a5['toUpperCase']()]+_0x2fcc('0x27'),_0xd27923[_0x2fcc('0xf')]);_0x355f93['endUserId']=_0xd27923['result'][_0x2fcc('0x11')];_0x2e4379(_0x355f93);})[_0x2fcc('0x21')](function(_0x46120f){logger[_0x2fcc('0x15')]('['+[_0x39b4a5['toUpperCase']()]+']',_0x46120f[_0x2fcc('0x16')]);_0x5d036d(_0x46120f[_0x2fcc('0x16')]);});});}function getEndUser(_0x25d35b,_0x53df1c,_0x48d780,_0x989d45,_0x5806a7){return function(_0x398899){logger[_0x2fcc('0x12')]('['+[_0x25d35b[_0x2fcc('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x398899);return new Promise(function(_0x17936e,_0x5b6546){var _0x4da180={'method':_0x2fcc('0xc'),'uri':_0x48d780+_0x2fcc('0x28')+_0x398899['endUserNumber']+'&'+_0x989d45+'&'+_0x5806a7,'auth':_0x53df1c,'json':!![]};return rp(_0x4da180)['then'](function(_0x52369e){if(_0x52369e[_0x2fcc('0xf')]['length']>0x0){_0x398899[_0x2fcc('0x29')]=_0x52369e[_0x2fcc('0xf')][0x0]['sys_id'];logger[_0x2fcc('0x12')]('['+[_0x25d35b[_0x2fcc('0x13')]()]+_0x2fcc('0x2a'),_0x398899);_0x17936e(_0x398899);}else{return createEndUser(_0x25d35b,_0x53df1c,_0x398899,_0x48d780,_0x989d45)[_0x2fcc('0xe')](function(_0x4378c7){logger[_0x2fcc('0x12')]('['+[_0x25d35b[_0x2fcc('0x13')]()]+_0x2fcc('0x2b'),_0x4378c7);_0x17936e(_0x4378c7);});}})['catch'](function(_0xe4a776){logger[_0x2fcc('0x15')]('['+[_0x25d35b[_0x2fcc('0x13')]()]+']',_0xe4a776[_0x2fcc('0x16')]);_0x5b6546(_0xe4a776['message']);});});};}function getCustomFields(_0x592b74,_0x2f4ba3){var _0x1ea74e={};if(_0x592b74[_0x2fcc('0x10')]>0x0){_[_0x2fcc('0x2c')](_0x592b74,function(_0x51d0ce){if(_['includes'](['string',_0x2fcc('0x2d')],_0x51d0ce[_0x2fcc('0x2e')])&&_0x51d0ce[_0x2fcc('0x2f')]&&!_0x51d0ce[_0x2fcc('0x30')]){_0x1ea74e[_0x51d0ce[_0x2fcc('0x2f')][_0x2fcc('0x31')]()]=_0x51d0ce[_0x2fcc('0x32')][_0x2fcc('0x33')]();}else if(_['includes']([_0x2fcc('0x34'),_0x2fcc('0x2d')],_0x51d0ce[_0x2fcc('0x2e')])&&_0x51d0ce[_0x2fcc('0x35')]&&_0x51d0ce[_0x2fcc('0x30')]){_0x1ea74e[_0x51d0ce['idField'][_0x2fcc('0x31')]()]=_0x51d0ce['content']['toString']();}else if(_0x51d0ce[_0x2fcc('0x2e')]==='variable'&&_0x51d0ce[_0x2fcc('0x36')]&&_0x51d0ce[_0x2fcc('0x35')]&&_0x51d0ce['customField']){_0x1ea74e[_0x51d0ce[_0x2fcc('0x35')][_0x2fcc('0x31')]()]=_0x2f4ba3[_0x51d0ce[_0x2fcc('0x36')]][_0x2fcc('0x33')]();}else if(_0x51d0ce[_0x2fcc('0x2e')]==='customVariable'&&_0x51d0ce[_0x2fcc('0x37')]&&_0x51d0ce[_0x2fcc('0x37')]['name']&&_0x51d0ce[_0x2fcc('0x35')]&&_0x51d0ce[_0x2fcc('0x30')]){_0x1ea74e[_0x51d0ce[_0x2fcc('0x35')][_0x2fcc('0x31')]()]=_0x2f4ba3[_0x51d0ce[_0x2fcc('0x37')]['name']['toLowerCase']()][_0x2fcc('0x33')]();}});}return _0x1ea74e;}function getTicket(_0x56cdd8,_0xa4cd4c,_0x590842,_0x421ef0,_0x5e946d,_0x107e31){return function(_0x58261d){logger['info']('['+[_0x56cdd8[_0x2fcc('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x58261d);return new Promise(function(_0x3e9e17,_0x438b22){var _0x1640c1=_0x56cdd8['toLowerCase']()===_0x2fcc('0x38')?_0x58261d[_0x2fcc('0x1e')]:_0x58261d[_0x2fcc('0x29')];var _0x1b7667={'method':_0x2fcc('0x39'),'uri':_0x590842+_0x2fcc('0x3a')+'?'+_0x107e31,'body':Object['assign']({},{'active':'true','caller_id':_0x1640c1,'assigned_to':_0x58261d['userId'],'short_description':intUtil[_0x2fcc('0x3b')](_0x421ef0[_0x2fcc('0x3c')],_0x5e946d,'\x20'),'description':intUtil[_0x2fcc('0x3b')](_0x421ef0[_0x2fcc('0x3d')],_0x5e946d,'\x0a')},getCustomFields(_0x421ef0[_0x2fcc('0x3e')],_0x5e946d)),'auth':_0xa4cd4c,'json':!![]};return rp(_0x1b7667)[_0x2fcc('0xe')](function(_0x462026){logger[_0x2fcc('0x12')]('['+[_0x56cdd8['toUpperCase']()]+_0x2fcc('0x3f'),_0x462026['result']);_0x58261d[_0x2fcc('0x40')]=_0x462026[_0x2fcc('0xf')][_0x2fcc('0x11')];_0x58261d['ticketNumber']=_0x462026[_0x2fcc('0xf')][_0x2fcc('0x41')];logger[_0x2fcc('0x12')]('['+[_0x56cdd8[_0x2fcc('0x13')]()]+_0x2fcc('0x42'),_0x58261d);_0x3e9e17(_0x58261d);})[_0x2fcc('0x21')](function(_0xd1139d){logger[_0x2fcc('0x15')]('['+[_0x56cdd8[_0x2fcc('0x13')]()]+']',_0xd1139d[_0x2fcc('0x16')]);_0x438b22(_0xd1139d[_0x2fcc('0x16')]);});});};}function createRemoteTag(_0x20b616,_0x48f6cc,_0x40643e,_0x17b078){return new Promise(function(_0x4fc3e2,_0x4ab62e){var _0x3dc681={'method':_0x2fcc('0x39'),'uri':_0x40643e+_0x2fcc('0x43')+'?'+_0x17b078,'body':{'short_description':_0x20b616,'global':!![],'active':!![],'name':_0x20b616},'auth':_0x48f6cc,'json':!![]};return rp(_0x3dc681)[_0x2fcc('0xe')](function(_0x30d71c){var _0x3a3588=_0x30d71c[_0x2fcc('0xf')]['sys_id'];_0x4fc3e2(_0x3a3588);});});}function getRemoteTag(_0x3a3641,_0x357624,_0x6d7f57,_0x35bfd2,_0x131d89){return new Promise(function(_0x319517,_0x421b56){var _0x1f2bd6={'method':_0x2fcc('0xc'),'uri':_0x6d7f57+_0x2fcc('0x43')+_0x2fcc('0x44')+_0x3a3641+'&'+_0x35bfd2,'auth':_0x357624,'json':!![]};return rp(_0x1f2bd6)['then'](function(_0x32cade){if(_0x32cade['result'][_0x2fcc('0x10')]>0x0){var _0x569c22=_0x32cade[_0x2fcc('0xf')][0x0]['sys_id'];_0x319517(_0x569c22);}else{return createRemoteTag(_0x3a3641,_0x357624,_0x6d7f57,_0x35bfd2)['then'](function(_0x34d276){_0x319517(_0x34d276);});}});});}function assignTagToIncident(_0x2e2279,_0xaf70b6,_0x977de8,_0x3daf0d,_0x15ac48){return new Promise(function(_0x1203d6,_0x3cbe64){var _0x28b038={'method':_0x2fcc('0x39'),'uri':_0x977de8+_0x2fcc('0x45')+'?'+_0x15ac48,'body':{'label':_0x2e2279,'table':_0x2fcc('0x3a'),'id_type':_0x2fcc('0x46'),'table_key':_0x3daf0d[_0x2fcc('0x40')],'title':'Incident\x20-\x20'+_0x3daf0d[_0x2fcc('0x47')],'id_display':_0x3daf0d[_0x2fcc('0x47')]},'auth':_0xaf70b6,'json':!![]};return rp(_0x28b038)[_0x2fcc('0xe')](function(_0xe370d7){_0x1203d6();})[_0x2fcc('0x21')](function(){_0x1203d6();});});}function manageTags(_0x52ccd4,_0x52f1ad,_0x2d5c0e,_0x15b7ff,_0x331bbf,_0x394ce6,_0x588028){return new Promise(function(_0xd9944a,_0x9eef16){var _0x191288=[];_0x52f1ad[_0x2fcc('0x2c')](function(_0x5a15e9){_0x191288['push'](getRemoteTag(_0x5a15e9,_0x2d5c0e,_0x15b7ff,_0x394ce6,_0x588028));});return Promise['all'](_0x191288)[_0x2fcc('0xe')](function(_0x559a8e){if(_0x559a8e['length']){logger['info']('['+[_0x52ccd4[_0x2fcc('0x13')]()]+_0x2fcc('0x48'),_0x559a8e);var _0x342396=[];_0x559a8e[_0x2fcc('0x2c')](function(_0x42684e){_0x342396[_0x2fcc('0x49')](assignTagToIncident(_0x42684e,_0x2d5c0e,_0x15b7ff,_0x331bbf,_0x394ce6));});return Promise[_0x2fcc('0x4a')](_0x342396)['then'](function(){_0xd9944a();})['catch'](function(){_0xd9944a();});}else{_0xd9944a();}});});}function getTags(_0x21e416,_0x1cf8b6,_0x26acc9,_0x3d58e8,_0x23fadf,_0x25797d){return function(_0x3de168){return new Promise(function(_0x5de539,_0x39aa67){var _0x3ecacd=[];var _0x1e9d59=_0x3d58e8['Tags'];if(_0x1e9d59&&_0x1e9d59[_0x2fcc('0x10')]>0x0){_0x3ecacd=_['map'](_0x1e9d59,'name');}if(_0x3ecacd[_0x2fcc('0x10')]>0x0){return manageTags(_0x21e416,_0x3ecacd,_0x1cf8b6,_0x26acc9,_0x3de168,_0x23fadf,_0x25797d)[_0x2fcc('0xe')](function(){_0x5de539(_0x3de168);});}else{_0x5de539(_0x3de168);}});};}function emit(_0x6f34be,_0x152612,_0x1fe178){var _0x55eb96=_0x2fcc('0x4b')+_0x2fcc('0x4c')+_0x2fcc('0x4d')+_0x2fcc('0x4e');var _0x275474={'uri':_0x6f34be+_0x2fcc('0x4f')+_0x1fe178+_0x55eb96};io['to'](util['format']('user:%s',_0x152612))[_0x2fcc('0x50')]('trigger:browser:url',_0x275474);}exports['cs']=function(_0x3e4b5a,_0x55518e,_0x164da3,_0xac71fa,_0x401ab0,_0x62f560,_0x104270,_0x5df973){var _0x4ffa50={};var _0x33857d={'user':_0x62f560[_0x2fcc('0x51')],'pass':_0x62f560['password']};var _0x242a2f='sysparm_limit=1';var _0x24234e=_0x2fcc('0x52');_0x62f560[_0x2fcc('0x53')]=intUtil[_0x2fcc('0x54')](_0x62f560[_0x2fcc('0x53')]);_0x62f560[_0x2fcc('0x55')]=intUtil[_0x2fcc('0x54')](_0x62f560[_0x2fcc('0x55')]);var _0x6cb0a7=util['format'](_0x2fcc('0x56'),_0x62f560['remoteUri']);_0x4ffa50[_0x2fcc('0x19')]=!_[_0x2fcc('0x57')](_0xac71fa)?_0xac71fa['email']:null;_0x4ffa50['adminEmail']=_0x62f560[_0x2fcc('0x58')];_0x4ffa50['endUserNumber']=_0x5df973[_0x2fcc('0x31')]()===_0x2fcc('0x38')?_0x55518e[_0x2fcc('0x59')]:_0x55518e[_0x2fcc('0x5a')];_0x4ffa50[_0x2fcc('0x5b')]=_0x5df973===_0x2fcc('0x5c')||_0x5df973===_0x2fcc('0x5d')?_0x2fcc('0x5c'):'outbound';var _0xdf4529=util[_0x2fcc('0x5e')](_0x2fcc('0x5f'),_0x62f560[_0x2fcc('0x55')],_0x55518e[_0x2fcc('0x60')],md5(_0x55518e[_0x2fcc('0x60')]));if(_0x401ab0&&_0x401ab0['monitor_format']){logger['info']('[QUEUE]',_0x2fcc('0x61'));_0x55518e[_0x2fcc('0x62')]=_0xdf4529;}else if(_0x104270&&_0x104270[_0x2fcc('0x63')]&&_0x104270[_0x2fcc('0x63')]!==_0x2fcc('0x64')){logger[_0x2fcc('0x12')]('[OUTBOUND]',_0x2fcc('0x61'));_0x55518e[_0x2fcc('0x62')]=_0xdf4529;}else{_0x55518e[_0x2fcc('0x62')]='';}return getAdminUser(_0x5df973,_0x33857d,_0x4ffa50,_0x6cb0a7,_0x24234e,_0x242a2f)[_0x2fcc('0xe')](getUser(_0x5df973,_0x33857d,_0x6cb0a7,_0x24234e,_0x242a2f))[_0x2fcc('0xe')](getEndUser(_0x5df973,_0x33857d,_0x6cb0a7,_0x24234e,_0x242a2f))[_0x2fcc('0xe')](getTicket(_0x5df973,_0x33857d,_0x6cb0a7,_0x164da3,_0x55518e,_0x24234e))[_0x2fcc('0xe')](function(_0x173c05){logger['info'](util[_0x2fcc('0x5e')](_0x2fcc('0x65'),_0x173c05[_0x2fcc('0x40')]));logger[_0x2fcc('0x12')](util[_0x2fcc('0x5e')]('call\x20direction:\x20%s',_0x5df973));if(_0x5df973!=='unmanaged'){logger[_0x2fcc('0x12')]('['+[_0x5df973[_0x2fcc('0x13')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x62f560[_0x2fcc('0x53')],_0xac71fa[_0x2fcc('0x66')],_0x173c05['ticketId']);}})['catch'](function(_0x17c2c4){logger[_0x2fcc('0x15')]('['+[_0x5df973[_0x2fcc('0x13')]()]+_0x2fcc('0x67'),util['inspect'](_0x17c2c4,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
+var _0xd9b7=['calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','active','userId','adminEmail','catch','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','sys_id','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variable','toString','customVariable','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','true','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','name','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','email','destcalleridnum'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd9b7,0xf2));var _0x7d9b=function(_0x39ec09,_0x5a028b){_0x39ec09=_0x39ec09-0x0;var _0x61bd9b=_0xd9b7[_0x39ec09];return _0x61bd9b;};'use strict';var _=require(_0x7d9b('0x0'));var Promise=require(_0x7d9b('0x1'));var rp=require(_0x7d9b('0x2'));var util=require(_0x7d9b('0x3'));var md5=require(_0x7d9b('0x4'));var Redis=require(_0x7d9b('0x5'));var intUtil=require('./util');var config=require(_0x7d9b('0x6'));var logger=require(_0x7d9b('0x7'))(_0x7d9b('0x8'));config[_0x7d9b('0x9')]=_[_0x7d9b('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7d9b('0xb'))(new Redis(config[_0x7d9b('0x9')]));function getAdminUser(_0x3163ee,_0x3010eb,_0x1917dc,_0x388fc6,_0x34b98e,_0x1efd1d){return new Promise(function(_0x397da2,_0x3f5f68){var _0x2b9541={'method':_0x7d9b('0xc'),'uri':_0x388fc6+_0x7d9b('0xd')+'&'+_0x34b98e+'&'+_0x1efd1d,'auth':_0x3010eb,'json':!![]};return rp(_0x2b9541)[_0x7d9b('0xe')](function(_0x3295fa){if(_0x3295fa[_0x7d9b('0xf')]['length']>0x0){_0x1917dc[_0x7d9b('0x10')]=_0x3295fa[_0x7d9b('0xf')][0x0]['sys_id'];}logger[_0x7d9b('0x11')]('['+[_0x3163ee[_0x7d9b('0x12')]()]+_0x7d9b('0x13'),_0x1917dc);_0x397da2(_0x1917dc);})['catch'](function(_0x5131ff){logger['error']('['+[_0x3163ee['toUpperCase']()]+']',_0x5131ff['message']);_0x3f5f68(_0x5131ff[_0x7d9b('0x14')]);});});}function getUser(_0x147143,_0x1aab86,_0x123027,_0x4e4c24,_0x41ebd4){return function(_0x398910){logger[_0x7d9b('0x11')]('['+[_0x147143[_0x7d9b('0x12')]()]+_0x7d9b('0x15'),_0x398910);return new Promise(function(_0x49e870,_0x3b8d02){if(intUtil[_0x7d9b('0x16')](_0x398910[_0x7d9b('0x17')])){var _0x64d4aa={'method':_0x7d9b('0xc'),'uri':_0x123027+_0x7d9b('0x18')+_0x398910[_0x7d9b('0x17')]+'&'+_0x4e4c24+'&'+_0x41ebd4,'auth':_0x1aab86,'json':!![]};logger[_0x7d9b('0x11')]('['+[_0x147143['toUpperCase']()]+_0x7d9b('0x19'),_0x64d4aa);return rp(_0x64d4aa)[_0x7d9b('0xe')](function(_0x248d35){logger[_0x7d9b('0x11')]('['+[_0x147143[_0x7d9b('0x12')]()]+'],\x20getUser\x20entity',_0x248d35);if(_0x248d35[_0x7d9b('0xf')][_0x7d9b('0x1a')]>0x0&&String(_0x248d35[_0x7d9b('0xf')][0x0][_0x7d9b('0x1b')])==='true'){_0x398910[_0x7d9b('0x1c')]=_0x248d35[_0x7d9b('0xf')][0x0]['sys_id'];}else{_0x398910[_0x7d9b('0x1c')]=_0x398910[_0x7d9b('0x10')];_0x398910[_0x7d9b('0x17')]=_0x398910[_0x7d9b('0x1d')];}logger['info']('['+[_0x147143[_0x7d9b('0x12')]()]+'],\x20getUser\x20crm',_0x398910);_0x49e870(_0x398910);})[_0x7d9b('0x1e')](function(_0x35eb6a){logger[_0x7d9b('0x1f')]('['+[_0x147143[_0x7d9b('0x12')]()]+']',_0x35eb6a[_0x7d9b('0x14')]);_0x3b8d02(_0x35eb6a['message']);});}else{logger[_0x7d9b('0x11')]('['+[_0x147143[_0x7d9b('0x12')]()]+_0x7d9b('0x20'));_0x398910[_0x7d9b('0x1c')]=_0x398910[_0x7d9b('0x10')];_0x398910[_0x7d9b('0x17')]=_0x398910['adminEmail'];_0x49e870(_0x398910);}});};}function createEndUser(_0x2630be,_0x104996,_0xc0ce34,_0xb57e8,_0x274d2f){logger[_0x7d9b('0x11')]('['+[_0x2630be[_0x7d9b('0x12')]()]+_0x7d9b('0x21'),_0xc0ce34);return new Promise(function(_0x1b3544,_0x15047f){var _0x3bc017={'method':_0x7d9b('0x22'),'uri':_0xb57e8+'sys_user?'+_0x274d2f,'body':{'user_name':_0xc0ce34[_0x7d9b('0x23')],'roles':_0x7d9b('0x24'),'first_name':_0xc0ce34['endUserNumber'],'active':'true','date_format':_0x7d9b('0x25'),'phone':_0xc0ce34['endUserNumber']},'auth':_0x104996,'json':!![]};return rp(_0x3bc017)[_0x7d9b('0xe')](function(_0x3ee5a5){logger[_0x7d9b('0x11')]('['+[_0x2630be[_0x7d9b('0x12')]()]+'],\x20EndUser\x20schema',_0x3ee5a5[_0x7d9b('0xf')]);_0xc0ce34['endUserId']=_0x3ee5a5[_0x7d9b('0xf')][_0x7d9b('0x26')];_0x1b3544(_0xc0ce34);})[_0x7d9b('0x1e')](function(_0x285276){logger[_0x7d9b('0x1f')]('['+[_0x2630be[_0x7d9b('0x12')]()]+']',_0x285276['message']);_0x15047f(_0x285276[_0x7d9b('0x14')]);});});}function getEndUser(_0x3c59fb,_0x21c9cc,_0x4ca5a4,_0x155d3a,_0x4c1cc5){return function(_0x2ed566){logger[_0x7d9b('0x11')]('['+[_0x3c59fb[_0x7d9b('0x12')]()]+_0x7d9b('0x27'),_0x2ed566);return new Promise(function(_0x59a3bd,_0x10bc1f){var _0x2e0a41={'method':'GET','uri':_0x4ca5a4+_0x7d9b('0x28')+_0x2ed566['endUserNumber']+'&'+_0x155d3a+'&'+_0x4c1cc5,'auth':_0x21c9cc,'json':!![]};return rp(_0x2e0a41)[_0x7d9b('0xe')](function(_0x2843df){if(_0x2843df[_0x7d9b('0xf')]['length']>0x0){_0x2ed566[_0x7d9b('0x29')]=_0x2843df[_0x7d9b('0xf')][0x0][_0x7d9b('0x26')];logger[_0x7d9b('0x11')]('['+[_0x3c59fb[_0x7d9b('0x12')]()]+_0x7d9b('0x2a'),_0x2ed566);_0x59a3bd(_0x2ed566);}else{return createEndUser(_0x3c59fb,_0x21c9cc,_0x2ed566,_0x4ca5a4,_0x155d3a)['then'](function(_0x4efad2){logger[_0x7d9b('0x11')]('['+[_0x3c59fb[_0x7d9b('0x12')]()]+_0x7d9b('0x2b'),_0x4efad2);_0x59a3bd(_0x4efad2);});}})[_0x7d9b('0x1e')](function(_0xb8a29d){logger[_0x7d9b('0x1f')]('['+[_0x3c59fb[_0x7d9b('0x12')]()]+']',_0xb8a29d['message']);_0x10bc1f(_0xb8a29d[_0x7d9b('0x14')]);});});};}function getCustomFields(_0x47f494,_0x4fb53e){var _0x3300ef={};if(_0x47f494['length']>0x0){_[_0x7d9b('0x2c')](_0x47f494,function(_0x5b485c){if(_[_0x7d9b('0x2d')]([_0x7d9b('0x2e'),_0x7d9b('0x2f')],_0x5b485c[_0x7d9b('0x30')])&&_0x5b485c[_0x7d9b('0x31')]&&!_0x5b485c[_0x7d9b('0x32')]){_0x3300ef[_0x5b485c['nameField'][_0x7d9b('0x33')]()]=_0x5b485c[_0x7d9b('0x34')]['toString']();}else if(_[_0x7d9b('0x2d')]([_0x7d9b('0x2e'),'picklist'],_0x5b485c[_0x7d9b('0x30')])&&_0x5b485c[_0x7d9b('0x35')]&&_0x5b485c[_0x7d9b('0x32')]){_0x3300ef[_0x5b485c[_0x7d9b('0x35')][_0x7d9b('0x33')]()]=_0x5b485c[_0x7d9b('0x34')]['toString']();}else if(_0x5b485c[_0x7d9b('0x30')]===_0x7d9b('0x36')&&_0x5b485c['variableName']&&_0x5b485c[_0x7d9b('0x35')]&&_0x5b485c[_0x7d9b('0x32')]){_0x3300ef[_0x5b485c[_0x7d9b('0x35')]['toLowerCase']()]=_0x4fb53e[_0x5b485c['variableName']][_0x7d9b('0x37')]();}else if(_0x5b485c[_0x7d9b('0x30')]===_0x7d9b('0x38')&&_0x5b485c[_0x7d9b('0x39')]&&_0x5b485c[_0x7d9b('0x39')]['name']&&_0x5b485c['idField']&&_0x5b485c[_0x7d9b('0x32')]){_0x3300ef[_0x5b485c[_0x7d9b('0x35')][_0x7d9b('0x33')]()]=_0x4fb53e[_0x5b485c[_0x7d9b('0x39')]['name'][_0x7d9b('0x33')]()][_0x7d9b('0x37')]();}});}return _0x3300ef;}function getTicket(_0x506a3b,_0x54f780,_0x1051e0,_0x2b4eca,_0x5e22f5,_0x1fc0f4){return function(_0x449a8b){logger[_0x7d9b('0x11')]('['+[_0x506a3b[_0x7d9b('0x12')]()]+_0x7d9b('0x3a'),_0x449a8b);return new Promise(function(_0x228cc0,_0xbd7025){var _0x499751=_0x506a3b[_0x7d9b('0x33')]()===_0x7d9b('0x3b')?_0x449a8b['userId']:_0x449a8b[_0x7d9b('0x29')];var _0x380890={'method':_0x7d9b('0x22'),'uri':_0x1051e0+_0x7d9b('0x3c')+'?'+_0x1fc0f4,'body':Object['assign']({},{'active':_0x7d9b('0x3d'),'caller_id':_0x499751,'assigned_to':_0x449a8b[_0x7d9b('0x1c')],'short_description':intUtil['getString'](_0x2b4eca[_0x7d9b('0x3e')],_0x5e22f5,'\x20'),'description':intUtil[_0x7d9b('0x3f')](_0x2b4eca[_0x7d9b('0x40')],_0x5e22f5,'\x0a')},getCustomFields(_0x2b4eca[_0x7d9b('0x41')],_0x5e22f5)),'auth':_0x54f780,'json':!![]};return rp(_0x380890)[_0x7d9b('0xe')](function(_0x4c44a1){logger['info']('['+[_0x506a3b[_0x7d9b('0x12')]()]+_0x7d9b('0x42'),_0x4c44a1[_0x7d9b('0xf')]);_0x449a8b[_0x7d9b('0x43')]=_0x4c44a1[_0x7d9b('0xf')][_0x7d9b('0x26')];_0x449a8b[_0x7d9b('0x44')]=_0x4c44a1['result'][_0x7d9b('0x45')];logger[_0x7d9b('0x11')]('['+[_0x506a3b[_0x7d9b('0x12')]()]+_0x7d9b('0x46'),_0x449a8b);_0x228cc0(_0x449a8b);})[_0x7d9b('0x1e')](function(_0x35bbe3){logger[_0x7d9b('0x1f')]('['+[_0x506a3b[_0x7d9b('0x12')]()]+']',_0x35bbe3[_0x7d9b('0x14')]);_0xbd7025(_0x35bbe3[_0x7d9b('0x14')]);});});};}function createRemoteTag(_0x34a7a6,_0x11a220,_0x1fc8cf,_0x2aff1f){return new Promise(function(_0x8bdd2e,_0x1a2ecf){var _0x3b5630={'method':'POST','uri':_0x1fc8cf+'label'+'?'+_0x2aff1f,'body':{'short_description':_0x34a7a6,'global':!![],'active':!![],'name':_0x34a7a6},'auth':_0x11a220,'json':!![]};return rp(_0x3b5630)[_0x7d9b('0xe')](function(_0x1da022){var _0x1410ac=_0x1da022[_0x7d9b('0xf')][_0x7d9b('0x26')];_0x8bdd2e(_0x1410ac);});});}function getRemoteTag(_0x12470e,_0x1129fb,_0x1619fe,_0x247d5a,_0x55675e){return new Promise(function(_0x53bc2a,_0x3fbbe6){var _0x4660af={'method':'GET','uri':_0x1619fe+'label'+_0x7d9b('0x47')+_0x12470e+'&'+_0x247d5a,'auth':_0x1129fb,'json':!![]};return rp(_0x4660af)[_0x7d9b('0xe')](function(_0x505938){if(_0x505938[_0x7d9b('0xf')][_0x7d9b('0x1a')]>0x0){var _0x47becd=_0x505938['result'][0x0][_0x7d9b('0x26')];_0x53bc2a(_0x47becd);}else{return createRemoteTag(_0x12470e,_0x1129fb,_0x1619fe,_0x247d5a)[_0x7d9b('0xe')](function(_0x128f08){_0x53bc2a(_0x128f08);});}});});}function assignTagToIncident(_0x5cb9fb,_0x3d5e5d,_0x7f93b5,_0x2372ed,_0x444ec3){return new Promise(function(_0x5cbc61,_0x3007b9){var _0x3e98bc={'method':_0x7d9b('0x22'),'uri':_0x7f93b5+_0x7d9b('0x48')+'?'+_0x444ec3,'body':{'label':_0x5cb9fb,'table':_0x7d9b('0x3c'),'id_type':_0x7d9b('0x49'),'table_key':_0x2372ed[_0x7d9b('0x43')],'title':_0x7d9b('0x4a')+_0x2372ed['ticketNumber'],'id_display':_0x2372ed[_0x7d9b('0x44')]},'auth':_0x3d5e5d,'json':!![]};return rp(_0x3e98bc)['then'](function(_0x417e18){_0x5cbc61();})[_0x7d9b('0x1e')](function(){_0x5cbc61();});});}function manageTags(_0x117dc7,_0x1c059d,_0x2ba107,_0x1c99ad,_0x4c7ea1,_0x29fc8c,_0x269042){return new Promise(function(_0x23b661,_0x487cbe){var _0x312c29=[];_0x1c059d[_0x7d9b('0x2c')](function(_0x5bfba1){_0x312c29[_0x7d9b('0x4b')](getRemoteTag(_0x5bfba1,_0x2ba107,_0x1c99ad,_0x29fc8c,_0x269042));});return Promise[_0x7d9b('0x4c')](_0x312c29)[_0x7d9b('0xe')](function(_0x13147e){if(_0x13147e[_0x7d9b('0x1a')]){logger[_0x7d9b('0x11')]('['+[_0x117dc7[_0x7d9b('0x12')]()]+_0x7d9b('0x4d'),_0x13147e);var _0x4fcad8=[];_0x13147e[_0x7d9b('0x2c')](function(_0x268d9f){_0x4fcad8[_0x7d9b('0x4b')](assignTagToIncident(_0x268d9f,_0x2ba107,_0x1c99ad,_0x4c7ea1,_0x29fc8c));});return Promise['all'](_0x4fcad8)['then'](function(){_0x23b661();})[_0x7d9b('0x1e')](function(){_0x23b661();});}else{_0x23b661();}});});}function getTags(_0x58cb99,_0x32a0a4,_0x42653a,_0x3d4635,_0x348cf7,_0x221e27){return function(_0x160da6){return new Promise(function(_0x4cf304,_0x186b57){var _0x210846=[];var _0x396f1f=_0x3d4635[_0x7d9b('0x4e')];if(_0x396f1f&&_0x396f1f['length']>0x0){_0x210846=_[_0x7d9b('0x4f')](_0x396f1f,_0x7d9b('0x50'));}if(_0x210846[_0x7d9b('0x1a')]>0x0){return manageTags(_0x58cb99,_0x210846,_0x32a0a4,_0x42653a,_0x160da6,_0x348cf7,_0x221e27)[_0x7d9b('0xe')](function(){_0x4cf304(_0x160da6);});}else{_0x4cf304(_0x160da6);}});};}function emit(_0xa719d6,_0x34ab10,_0x30b416){var _0x3f961d=_0x7d9b('0x51')+_0x7d9b('0x52')+_0x7d9b('0x53')+'%255EORDERBYDESCnumber';var _0x59d4f7={'uri':_0xa719d6+_0x7d9b('0x54')+_0x30b416+_0x3f961d};io['to'](util[_0x7d9b('0x55')]('user:%s',_0x34ab10))[_0x7d9b('0x56')](_0x7d9b('0x57'),_0x59d4f7);}exports['cs']=function(_0x54dbc6,_0x331e86,_0x226fe4,_0x39a065,_0x550a2a,_0x1e38a7,_0x190679,_0x15f309){var _0x39f7ed={};var _0xe3cfcd={'user':_0x1e38a7[_0x7d9b('0x58')],'pass':_0x1e38a7[_0x7d9b('0x59')]};var _0x5553d9=_0x7d9b('0x5a');var _0xb59a94=_0x7d9b('0x5b');_0x1e38a7[_0x7d9b('0x5c')]=intUtil[_0x7d9b('0x5d')](_0x1e38a7[_0x7d9b('0x5c')]);_0x1e38a7['serverUrl']=intUtil[_0x7d9b('0x5d')](_0x1e38a7['serverUrl']);var _0x287218=util[_0x7d9b('0x55')](_0x7d9b('0x5e'),_0x1e38a7[_0x7d9b('0x5c')]);_0x39f7ed[_0x7d9b('0x17')]=!_['isNil'](_0x39a065)?_0x39a065[_0x7d9b('0x5f')]:null;_0x39f7ed[_0x7d9b('0x1d')]=_0x1e38a7[_0x7d9b('0x5f')];_0x39f7ed['endUserNumber']=_0x15f309[_0x7d9b('0x33')]()==='outbound'?_0x331e86[_0x7d9b('0x60')]:_0x331e86[_0x7d9b('0x61')];_0x39f7ed[_0x7d9b('0x62')]=_0x15f309===_0x7d9b('0x63')||_0x15f309===_0x7d9b('0x64')?_0x7d9b('0x63'):_0x7d9b('0x3b');var _0x2f9c52=util[_0x7d9b('0x55')](_0x7d9b('0x65'),_0x1e38a7[_0x7d9b('0x66')],_0x331e86[_0x7d9b('0x67')],md5(_0x331e86['uniqueid']));if(_0x550a2a&&_0x550a2a[_0x7d9b('0x68')]){logger[_0x7d9b('0x11')]('[QUEUE]',_0x7d9b('0x69'));_0x331e86[_0x7d9b('0x6a')]=_0x2f9c52;}else if(_0x190679&&_0x190679[_0x7d9b('0x6b')]&&_0x190679[_0x7d9b('0x6b')]!==_0x7d9b('0x6c')){logger['info']('[OUTBOUND]',_0x7d9b('0x69'));_0x331e86[_0x7d9b('0x6a')]=_0x2f9c52;}else{_0x331e86[_0x7d9b('0x6a')]='';}return getAdminUser(_0x15f309,_0xe3cfcd,_0x39f7ed,_0x287218,_0xb59a94,_0x5553d9)[_0x7d9b('0xe')](getUser(_0x15f309,_0xe3cfcd,_0x287218,_0xb59a94,_0x5553d9))[_0x7d9b('0xe')](getEndUser(_0x15f309,_0xe3cfcd,_0x287218,_0xb59a94,_0x5553d9))[_0x7d9b('0xe')](getTicket(_0x15f309,_0xe3cfcd,_0x287218,_0x226fe4,_0x331e86,_0xb59a94))[_0x7d9b('0xe')](function(_0x8abe81){logger['info'](util[_0x7d9b('0x55')](_0x7d9b('0x6d'),_0x8abe81[_0x7d9b('0x43')]));logger[_0x7d9b('0x11')](util[_0x7d9b('0x55')](_0x7d9b('0x6e'),_0x15f309));if(_0x15f309!==_0x7d9b('0x64')){logger['info']('['+[_0x15f309[_0x7d9b('0x12')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x1e38a7['remoteUri'],_0x39a065[_0x7d9b('0x50')],_0x8abe81[_0x7d9b('0x43')]);}})[_0x7d9b('0x1e')](function(_0x114eb5){logger[_0x7d9b('0x1f')]('['+[_0x15f309[_0x7d9b('0x12')]()]+_0x7d9b('0x6f'),util[_0x7d9b('0x70')](_0x114eb5,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
index 9b3e4ed..7d76ece 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x455d=['request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','emit','getString','Subjects','assigned_user_id','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','direction','forEach','variableName','push','idField','JSON','Basic\x20%s','apiKey','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','stringify','format','user_name','then','entry_list','length','find','name_value_list','value','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','<unknown>','Caller\x20-\x20%s','debug','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','toString','variable','customVariable','Variable','POST','login','username','password','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','trigger:browser:url','catch','[QUEUE]','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridname','destcalleridnum','Outbound','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','[OUTBOUND]','unmanaged','lastevent','toUpperCase','Inbound','lodash'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x455d,0xed));var _0xd455=function(_0x39f566,_0x30705e){_0x39f566=_0x39f566-0x0;var _0x480e3b=_0x455d[_0x39f566];return _0x480e3b;};'use strict';var _=require(_0xd455('0x0'));var rp=require(_0xd455('0x1'));var BPromise=require(_0xd455('0x2'));var md5=require(_0xd455('0x3'));var util=require('util');var Redis=require(_0xd455('0x4'));var intUtil=require(_0xd455('0x5'));var config=require(_0xd455('0x6'));var logger=require('../../../../config/logger')(_0xd455('0x7'));config[_0xd455('0x8')]=_['defaults'](config['redis'],{'host':_0xd455('0x9'),'port':0x18eb});var io=require(_0xd455('0xa'))(new Redis(config[_0xd455('0x8')]));var def={'method':'POST','json':!![]};function emit(_0x44eddf,_0x11d6c0,_0x34611b){io['to'](_0x44eddf)[_0xd455('0xb')](_0x11d6c0,_0x34611b);}function getTicket(_0x980600,_0x2e2697,_0xff596f,_0x314cdd,_0x20c237,_0x414e1f,_0x28bd1d,_0x2abf2c){logger['info']('Creating\x20new\x20ticket...');var _0x1eb161=new Date();var _0x584320=[{'name':'name','value':intUtil[_0xd455('0xc')](_0x314cdd[_0xd455('0xd')],_0x20c237,'\x20')},{'name':_0xd455('0xe'),'value':_0x2e2697['id']},{'name':'created_by','value':_0x2e2697['id']},{'name':'description','value':intUtil[_0xd455('0xc')](_0x314cdd['Descriptions'],_0x20c237,'\x0a')},{'name':'date_start','value':_0x1eb161[_0xd455('0xf')]()[_0xd455('0x10')](0x0,0x13)[_0xd455('0x11')]('T','\x20')},{'name':_0xd455('0x12'),'value':'0'},{'name':_0xd455('0x13'),'value':'15'},{'name':_0xd455('0x14'),'value':_0xff596f['id']},{'name':_0xd455('0x15'),'value':_0xd455('0x16')},{'name':_0xd455('0x17'),'value':_0xff596f[_0xd455('0x18')]},{'name':_0xd455('0x19'),'value':_0x2abf2c}];if(_0x414e1f['length']){_[_0xd455('0x1a')](_0x414e1f,function(_0x25d218){if(_0x20c237[_0x25d218[_0xd455('0x1b')]]){_0x584320[_0xd455('0x1c')]({'name':_0x25d218[_0xd455('0x1d')],'value':_0x20c237[_0x25d218[_0xd455('0x1b')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xd455('0x1e'),'response_type':_0xd455('0x1e'),'rest_data':JSON['stringify']({'session':_0x28bd1d['id'],'module_name':'Calls','name_value_list':_0x584320})}});}function getAuth(_0x11e0d4){return util['format'](_0xd455('0x1f'),new Buffer(_0x11e0d4[_0xd455('0x20')]+':X')['toString']('base64'));}function getServerInfo(_0x18bf5c){return request({'form':{'method':_0xd455('0x21'),'input_type':'JSON','response_type':_0xd455('0x1e'),'rest_data':JSON['stringify']({'session':_0x18bf5c['id']})}});}function getUser(_0x4ef48f,_0x24dcd5,_0x507bb7){if(!_[_0xd455('0x22')](_0x24dcd5)){logger[_0xd455('0x23')](_0xd455('0x24'),_0x24dcd5);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xd455('0x25')]({'session':_0x507bb7['id'],'module_name':'Employees','query':util[_0xd455('0x26')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x24dcd5),'order_by':'','offset':'0','select_fields':['id','name',_0xd455('0x27')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd455('0x28')](function(_0x54a25b){if(_0x54a25b[_0xd455('0x29')][_0xd455('0x2a')]){var _0x3c1f28=_[_0xd455('0x2b')](_0x54a25b[_0xd455('0x29')],function(_0x9ce2ab){return _0x9ce2ab[_0xd455('0x2c')][_0xd455('0x27')][_0xd455('0x2d')]===_0x24dcd5;});if(_0x3c1f28){logger[_0xd455('0x23')]('Agent\x20found!');return BPromise[_0xd455('0x2e')]({'id':_0x3c1f28[_0xd455('0x2c')]['id'][_0xd455('0x2d')],'name':_0x3c1f28['name_value_list'][_0xd455('0x18')][_0xd455('0x2d')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x507bb7['name_value_list'][_0xd455('0x2f')][_0xd455('0x2d')],'name':_0x507bb7[_0xd455('0x2c')][_0xd455('0x27')][_0xd455('0x2d')]});});}else{logger[_0xd455('0x23')](_0xd455('0x30'));return BPromise[_0xd455('0x2e')]({'id':_0x507bb7[_0xd455('0x2c')][_0xd455('0x2f')][_0xd455('0x2d')],'name':_0x507bb7[_0xd455('0x2c')]['user_name']['value']});}}function getEndUser(_0x117277,_0x1fcbc6,_0x1315fc,_0x44dbf1){logger[_0xd455('0x23')](_0xd455('0x31'),_0x1315fc);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xd455('0x1e'),'rest_data':JSON[_0xd455('0x25')]({'session':_0x44dbf1['id'],'module_name':_0xd455('0x16'),'query':util[_0xd455('0x26')](_0xd455('0x32'),_0x1315fc),'order_by':'','offset':'0','select_fields':['id',_0xd455('0x18'),_0xd455('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd455('0x28')](function(_0x14ef55){if(_0x14ef55[_0xd455('0x29')]['length']){var _0x10df06=_[_0xd455('0x2b')](_0x14ef55[_0xd455('0x29')],function(_0x3d8dc7){return _0x3d8dc7[_0xd455('0x2c')][_0xd455('0x33')][_0xd455('0x2d')]===_0x1315fc;});if(_0x10df06){logger['info'](_0xd455('0x34'));return BPromise[_0xd455('0x2e')]({'id':_0x10df06[_0xd455('0x2c')]['id']['value'],'name':_0x10df06['name_value_list']['name'][_0xd455('0x2d')],'phone':_0x10df06[_0xd455('0x2c')][_0xd455('0x33')][_0xd455('0x2d')]});}}else{logger['info'](_0xd455('0x35'));return request({'form':{'method':'set_entry','input_type':_0xd455('0x1e'),'response_type':_0xd455('0x1e'),'rest_data':JSON[_0xd455('0x25')]({'session':_0x44dbf1['id'],'module_name':'Contacts','name_value_list':[{'name':_0xd455('0x36'),'value':_0x1fcbc6!==_0xd455('0x37')?_0x1fcbc6:util['format'](_0xd455('0x38'),_0x1315fc)},{'name':_0xd455('0x33'),'value':_0x1315fc}]})}})[_0xd455('0x28')](function(_0x1bb499){logger[_0xd455('0x23')]('Enduser\x20created.');return BPromise[_0xd455('0x2e')]({'id':_0x1bb499['id'],'name':_0x1bb499['entry_list'][_0xd455('0x36')][_0xd455('0x2d')],'phone':_0x1bb499[_0xd455('0x29')]['phone_home'][_0xd455('0x2d')]});});}});}function request(_0x514315){logger[_0xd455('0x39')]('[HTTP]',JSON[_0xd455('0x25')](_0x514315));return rp(_[_0xd455('0x3a')](def,_0x514315));}function getTags(_0x1ddf3f,_0x45ccb8){var _0x1ad846=[];if(_0x1ddf3f&&_0x1ddf3f[_0xd455('0x2a')]>0x0){_0x1ad846=_[_0xd455('0x3b')](_0x1ddf3f,_0x45ccb8);}return _0x1ad846;}function getCustomFields(_0x14227a,_0x495ba7){var _0x42ed14=[];var _0x1d9133={'custom_fields':[]};if(_0x14227a[_0xd455('0x2a')]>0x0){_[_0xd455('0x1a')](_0x14227a,function(_0x5597a2){if(_0x5597a2[_0xd455('0x3c')]===_0xd455('0x3d')&&_0x5597a2[_0xd455('0x3e')]&&!_0x5597a2[_0xd455('0x3f')]){_0x1d9133[_0x5597a2['nameField'][_0xd455('0x40')]()]=_0x5597a2[_0xd455('0x41')]['toString']();}else if(_0x5597a2[_0xd455('0x3c')]===_0xd455('0x3d')&&_0x5597a2[_0xd455('0x1d')]&&_0x5597a2[_0xd455('0x3f')]){_0x1d9133[_0xd455('0x42')][_0xd455('0x1c')]({'id':_0x5597a2[_0xd455('0x1d')],'value':_0x5597a2['content'][_0xd455('0x43')]()});}else if(_0x5597a2['type']===_0xd455('0x44')&&_0x5597a2['variableName']&&_0x5597a2[_0xd455('0x1d')]&&_0x5597a2[_0xd455('0x3f')]){_0x495ba7[_0x5597a2[_0xd455('0x1b')]]&&_0x1d9133[_0xd455('0x42')][_0xd455('0x1c')]({'id':_0x5597a2[_0xd455('0x1d')],'value':_0x495ba7[_0x5597a2['variableName']][_0xd455('0x43')]()});}else if(_0x5597a2[_0xd455('0x3c')]===_0xd455('0x45')&&_0x5597a2[_0xd455('0x46')]&&_0x5597a2[_0xd455('0x46')]['name']&&_0x5597a2[_0xd455('0x1d')]&&_0x5597a2[_0xd455('0x3f')]){_0x495ba7[_0x5597a2['Variable'][_0xd455('0x18')][_0xd455('0x40')]()]&&_0x1d9133['custom_fields'][_0xd455('0x1c')]({'id':_0x5597a2['idField'],'value':_0x495ba7[_0x5597a2[_0xd455('0x46')][_0xd455('0x18')]['toLowerCase']()][_0xd455('0x43')]()});}});}return _0x1d9133;}function getConnection(_0x3114d3){return request({'method':_0xd455('0x47'),'form':{'method':_0xd455('0x48'),'input_type':_0xd455('0x1e'),'response_type':_0xd455('0x1e'),'rest_data':JSON[_0xd455('0x25')]({'user_auth':{'user_name':_0x3114d3[_0xd455('0x49')],'password':_0x3114d3[_0xd455('0x4a')],'encryption':'PLAIN'},'application':_0xd455('0x4b')})}})[_0xd455('0x28')](function(_0x4182ba){var _0x218b4a=_0x4182ba;if(_0x218b4a['id']){def[_0xd455('0x4c')]=_0x218b4a['id'];return BPromise['resolve'](_0x218b4a);}else{throw new Error(util[_0xd455('0x26')]('Account\x20%d\x20is\x20not\x20valid',_0x3114d3['id']));}});}function setRelationship(_0x1514f3,_0xc12cf3,_0x324af7,_0x316a72){return request({'form':{'method':_0xd455('0x4d'),'input_type':_0xd455('0x1e'),'response_type':_0xd455('0x1e'),'rest_data':JSON[_0xd455('0x25')]({'session':_0x1514f3['id'],'module_name':'Calls','module_id':_0x324af7['id'],'link_field_name':_0x316a72,'related_ids':[_0xc12cf3['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xd455('0x4e')]=function(_0x53ece5,_0xfd5d4d,_0x31578d,_0x4057ec,_0x2991cb,_0x548616){var _0x3d9d5c,_0x190f89,_0x3a4582,_0x1b99dc;_0x548616[_0xd455('0x4f')]=intUtil[_0xd455('0x50')](_0x548616[_0xd455('0x4f')]);_0x548616[_0xd455('0x51')]=intUtil[_0xd455('0x50')](_0x548616[_0xd455('0x51')]);def[_0xd455('0x52')]=util[_0xd455('0x26')](_0xd455('0x53'),_0x548616[_0xd455('0x4f')]);if(_0x2991cb&&_0x2991cb[_0xd455('0x54')]){logger[_0xd455('0x23')]('[QUEUE]',_0xd455('0x55'));_0xfd5d4d[_0xd455('0x56')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x548616[_0xd455('0x51')],_0xfd5d4d['uniqueid'],md5(_0xfd5d4d['uniqueid']));}else{_0xfd5d4d[_0xd455('0x56')]='';}return getConnection(_0x548616)[_0xd455('0x28')](function(_0x29f4c1){_0x1b99dc=_0x29f4c1;return getUser(_0x548616,_0x4057ec['name'],_0x1b99dc);})[_0xd455('0x28')](function(_0x568c8b){_0x3d9d5c=_0x568c8b;logger[_0xd455('0x23')](_0xd455('0x57'),_0x3d9d5c['id']);return getEndUser(_0x548616,_0xfd5d4d[_0xd455('0x58')],_0xfd5d4d[_0xd455('0x59')],_0x1b99dc);})['then'](function(_0x470e6b){_0x190f89=_0x470e6b;logger['info'](_0xd455('0x5a'),_0x190f89['id']);return getTicket(_0x548616,_0x3d9d5c,_0x190f89,_0x31578d,_0xfd5d4d,_0x31578d[_0xd455('0x5b')],_0x1b99dc,'Inbound');})['then'](function(_0x279995){_0x3a4582=_0x279995;logger[_0xd455('0x23')](_0xd455('0x5c'));logger[_0xd455('0x23')](_0xd455('0x5d'),_0x3a4582['id']);return setRelationship(_0x1b99dc,_0x3d9d5c,_0x3a4582,_0xd455('0x5e'));})[_0xd455('0x28')](function(){return setRelationship(_0x1b99dc,_0x190f89,_0x3a4582,_0xd455('0x5f'));})[_0xd455('0x28')](function(){return getServerInfo(_0x1b99dc);})[_0xd455('0x28')](function(_0x26aa66){var _0xf898fb=parseInt(_0x26aa66[_0xd455('0x60')][_0xd455('0x61')](0x0));var _0x5d2604=util[_0xd455('0x26')](_0xd455('0x62'),_0x548616[_0xd455('0x4f')],_0x3a4582['id']);if(_0xf898fb>0x6){_0x5d2604=util[_0xd455('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x548616[_0xd455('0x4f')],_0x3a4582['id']);}logger[_0xd455('0x23')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd455('0x26')](_0xd455('0x63'),_0x4057ec[_0xd455('0x18')]),_0xd455('0x64'),{'uri':_0x5d2604});})[_0xd455('0x65')](function(_0x40a9c2){logger['error'](_0xd455('0x66'),JSON[_0xd455('0x25')](_0x40a9c2));});};exports[_0xd455('0x67')]=function(_0x3ae468,_0x273fa8,_0x2480f1,_0x18d45a,_0x2cff8c,_0x5c7bea,_0x22eb00){var _0x464ccc,_0x43a7d5,_0x569318,_0x46053b;_0x5c7bea[_0xd455('0x4f')]=intUtil['stripTrailingSlash'](_0x5c7bea[_0xd455('0x4f')]);_0x5c7bea[_0xd455('0x51')]=intUtil[_0xd455('0x50')](_0x5c7bea['serverUrl']);def['uri']=util[_0xd455('0x26')](_0xd455('0x53'),_0x5c7bea[_0xd455('0x4f')]);if(_0x22eb00&&_0x22eb00['recordingFormat']&&_0x22eb00[_0xd455('0x68')]!==_0xd455('0x69')){logger[_0xd455('0x23')]('[OUTBOUND]',_0xd455('0x55'));_0x273fa8['recordingURL']=util[_0xd455('0x26')](_0xd455('0x6a'),_0x5c7bea[_0xd455('0x51')],_0x273fa8['uniqueid'],md5(_0x273fa8[_0xd455('0x6b')]));}return getConnection(_0x5c7bea)['then'](function(_0x55efc0){_0x46053b=_0x55efc0;return getUser(_0x5c7bea,_0x18d45a[_0xd455('0x18')],_0x46053b);})['then'](function(_0x125aad){_0x464ccc=_0x125aad;logger[_0xd455('0x23')](_0xd455('0x57'),_0x464ccc['id']);return getEndUser(_0x5c7bea,_0x273fa8[_0xd455('0x6c')],_0x273fa8[_0xd455('0x6d')],_0x46053b);})[_0xd455('0x28')](function(_0x4a5f1b){_0x43a7d5=_0x4a5f1b;logger[_0xd455('0x23')](_0xd455('0x5a'),_0x43a7d5['id']);return getTicket(_0x5c7bea,_0x464ccc,_0x43a7d5,_0x2480f1,_0x273fa8,_0x2480f1[_0xd455('0x5b')],_0x46053b,_0xd455('0x6e'));})[_0xd455('0x28')](function(_0x4ec733){_0x569318=_0x4ec733;logger[_0xd455('0x23')](_0xd455('0x5c'));logger[_0xd455('0x23')](_0xd455('0x5d'),_0x569318['id']);return setRelationship(_0x46053b,_0x464ccc,_0x569318,_0xd455('0x5e'));})[_0xd455('0x28')](function(){return setRelationship(_0x46053b,_0x43a7d5,_0x569318,_0xd455('0x5f'));})[_0xd455('0x28')](function(){return getServerInfo(_0x46053b);})[_0xd455('0x28')](function(_0x328c34){var _0xdac1f1=parseInt(_0x328c34['version'][_0xd455('0x61')](0x0));var _0x4ac88b=util[_0xd455('0x26')](_0xd455('0x62'),_0x5c7bea[_0xd455('0x4f')],_0x569318['id']);if(_0xdac1f1>0x6){_0x4ac88b=util[_0xd455('0x26')](_0xd455('0x6f'),_0x5c7bea[_0xd455('0x4f')],_0x569318['id']);}logger[_0xd455('0x23')]('[OUTBOUND]',_0xd455('0x70'));emit(util[_0xd455('0x26')](_0xd455('0x63'),_0x18d45a['name']),'trigger:browser:url',{'uri':_0x4ac88b});})[_0xd455('0x65')](function(_0x336fe0){logger[_0xd455('0x71')](_0xd455('0x72'),JSON[_0xd455('0x25')](_0x336fe0));});};exports[_0xd455('0x73')]=function(_0x54a599,_0x48493b,_0x48ac30,_0x1b2ce9,_0x2aa15d,_0x460309){var _0x19fb37,_0x38b9ab,_0x1db4e3,_0x15db30;_0x460309[_0xd455('0x4f')]=intUtil[_0xd455('0x50')](_0x460309[_0xd455('0x4f')]);_0x460309[_0xd455('0x51')]=intUtil['stripTrailingSlash'](_0x460309[_0xd455('0x51')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x460309[_0xd455('0x4f')]);if(_0x2aa15d&&_0x2aa15d['monitor_format']){logger[_0xd455('0x23')]('['+_0x48493b[_0xd455('0x74')][_0xd455('0x75')]()+']',_0xd455('0x55'));_0x48493b['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x460309[_0xd455('0x51')],_0x48493b[_0xd455('0x6b')],md5(_0x48493b[_0xd455('0x6b')]));}else{_0x48493b['recordingURL']='';}return getConnection(_0x460309)[_0xd455('0x28')](function(_0x20fd9e){_0x15db30=_0x20fd9e;if(!_[_0xd455('0x22')](_0x1b2ce9)){return getUser(_0x460309,_0x1b2ce9[_0xd455('0x18')],_0x15db30);}else{return getUser(_0x460309,null,_0x15db30);}})[_0xd455('0x28')](function(_0x3d713c){_0x19fb37=_0x3d713c;logger[_0xd455('0x23')](_0xd455('0x57'),_0x19fb37['id']);return getEndUser(_0x460309,_0x48493b[_0xd455('0x58')],_0x48493b[_0xd455('0x59')],_0x15db30);})['then'](function(_0xda6bb0){_0x38b9ab=_0xda6bb0;logger[_0xd455('0x23')](_0xd455('0x5a'),_0x38b9ab['id']);return getTicket(_0x460309,_0x19fb37,_0x38b9ab,_0x48ac30,_0x48493b,_0x48ac30[_0xd455('0x5b')],_0x15db30,_0xd455('0x76'));})[_0xd455('0x28')](function(_0x26f0f5){_0x1db4e3=_0x26f0f5;logger[_0xd455('0x23')]('Ticket\x20created!');logger[_0xd455('0x23')](_0xd455('0x5d'),_0x1db4e3['id']);return setRelationship(_0x15db30,_0x19fb37,_0x1db4e3,_0xd455('0x5e'));})[_0xd455('0x28')](function(){return setRelationship(_0x15db30,_0x38b9ab,_0x1db4e3,_0xd455('0x5f'));})[_0xd455('0x28')](function(){return getServerInfo(_0x15db30);})[_0xd455('0x65')](function(_0xdcfed9){logger[_0xd455('0x71')]('['+_0x48493b[_0xd455('0x74')][_0xd455('0x75')]()+']',JSON['stringify'](_0xdcfed9));});};
\ No newline at end of file
+var _0xf66c=['user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','set_entry','first_name','<unknown>','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','forEach','type','string','nameField','customField','toLowerCase','content','variable','custom_fields','customVariable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','set_relationship','serverUrl','stripTrailingSlash','uri','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/service/v4_1/rest.php','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','assigned_user_id','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200'];(function(_0xa8977f,_0x49a2ce){var _0x170155=function(_0x18c2e7){while(--_0x18c2e7){_0xa8977f['push'](_0xa8977f['shift']());}};_0x170155(++_0x49a2ce);}(_0xf66c,0x1bf));var _0xcf66=function(_0x17229f,_0x5293aa){_0x17229f=_0x17229f-0x0;var _0x499dec=_0xf66c[_0x17229f];return _0x499dec;};'use strict';var _=require(_0xcf66('0x0'));var rp=require(_0xcf66('0x1'));var BPromise=require(_0xcf66('0x2'));var md5=require(_0xcf66('0x3'));var util=require(_0xcf66('0x4'));var Redis=require(_0xcf66('0x5'));var intUtil=require(_0xcf66('0x6'));var config=require(_0xcf66('0x7'));var logger=require(_0xcf66('0x8'))('sugarcrm');config['redis']=_['defaults'](config[_0xcf66('0x9')],{'host':_0xcf66('0xa'),'port':0x18eb});var io=require(_0xcf66('0xb'))(new Redis(config[_0xcf66('0x9')]));var def={'method':_0xcf66('0xc'),'json':!![]};function emit(_0xf38c7e,_0x405631,_0x2fd81b){io['to'](_0xf38c7e)[_0xcf66('0xd')](_0x405631,_0x2fd81b);}function getTicket(_0x12f4fc,_0x2b7038,_0x2a2750,_0x31ca06,_0x17d7f1,_0x1d7b07,_0x2e68cf,_0x163baa){logger['info'](_0xcf66('0xe'));var _0x2f2ee7=new Date();var _0x7b948b=[{'name':_0xcf66('0xf'),'value':intUtil[_0xcf66('0x10')](_0x31ca06['Subjects'],_0x17d7f1,'\x20')},{'name':_0xcf66('0x11'),'value':_0x2b7038['id']},{'name':'created_by','value':_0x2b7038['id']},{'name':_0xcf66('0x12'),'value':intUtil['getString'](_0x31ca06[_0xcf66('0x13')],_0x17d7f1,'\x0a')},{'name':_0xcf66('0x14'),'value':_0x2f2ee7[_0xcf66('0x15')]()[_0xcf66('0x16')](0x0,0x13)[_0xcf66('0x17')]('T','\x20')},{'name':_0xcf66('0x18'),'value':'0'},{'name':_0xcf66('0x19'),'value':'15'},{'name':_0xcf66('0x1a'),'value':_0x2a2750['id']},{'name':'parent_type','value':_0xcf66('0x1b')},{'name':_0xcf66('0x1c'),'value':_0x2a2750[_0xcf66('0xf')]},{'name':_0xcf66('0x1d'),'value':_0x163baa}];if(_0x1d7b07[_0xcf66('0x1e')]){_['forEach'](_0x1d7b07,function(_0x559f83){if(_0x17d7f1[_0x559f83[_0xcf66('0x1f')]]){_0x7b948b[_0xcf66('0x20')]({'name':_0x559f83[_0xcf66('0x21')],'value':_0x17d7f1[_0x559f83[_0xcf66('0x1f')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xcf66('0x22'),'response_type':_0xcf66('0x22'),'rest_data':JSON[_0xcf66('0x23')]({'session':_0x2e68cf['id'],'module_name':_0xcf66('0x24'),'name_value_list':_0x7b948b})}});}function getAuth(_0xf6e6e1){return util[_0xcf66('0x25')](_0xcf66('0x26'),new Buffer(_0xf6e6e1[_0xcf66('0x27')]+':X')[_0xcf66('0x28')](_0xcf66('0x29')));}function getServerInfo(_0x1e9d57){return request({'form':{'method':_0xcf66('0x2a'),'input_type':'JSON','response_type':_0xcf66('0x22'),'rest_data':JSON['stringify']({'session':_0x1e9d57['id']})}});}function getUser(_0x454998,_0x267722,_0x27f79f){if(!_[_0xcf66('0x2b')](_0x267722)){logger[_0xcf66('0x2c')](_0xcf66('0x2d'),_0x267722);return request({'form':{'method':_0xcf66('0x2e'),'input_type':_0xcf66('0x22'),'response_type':_0xcf66('0x22'),'rest_data':JSON[_0xcf66('0x23')]({'session':_0x27f79f['id'],'module_name':_0xcf66('0x2f'),'query':util[_0xcf66('0x25')](_0xcf66('0x30'),_0x267722),'order_by':'','offset':'0','select_fields':['id',_0xcf66('0xf'),_0xcf66('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcf66('0x32')](function(_0x215bfa){if(_0x215bfa[_0xcf66('0x33')]['length']){var _0x269066=_[_0xcf66('0x34')](_0x215bfa[_0xcf66('0x33')],function(_0x57f40b){return _0x57f40b[_0xcf66('0x35')][_0xcf66('0x31')][_0xcf66('0x36')]===_0x267722;});if(_0x269066){logger[_0xcf66('0x2c')](_0xcf66('0x37'));return BPromise[_0xcf66('0x38')]({'id':_0x269066['name_value_list']['id'][_0xcf66('0x36')],'name':_0x269066['name_value_list'][_0xcf66('0xf')][_0xcf66('0x36')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xcf66('0x38')]({'id':_0x27f79f[_0xcf66('0x35')][_0xcf66('0x39')][_0xcf66('0x36')],'name':_0x27f79f['name_value_list'][_0xcf66('0x31')]['value']});});}else{logger[_0xcf66('0x2c')](_0xcf66('0x3a'));return BPromise[_0xcf66('0x38')]({'id':_0x27f79f['name_value_list']['user_id']['value'],'name':_0x27f79f[_0xcf66('0x35')]['user_name'][_0xcf66('0x36')]});}}function getEndUser(_0x4e5fa9,_0x450154,_0x3f73ff,_0x54fb72){logger[_0xcf66('0x2c')](_0xcf66('0x3b'),_0x3f73ff);return request({'form':{'method':'get_entry_list','input_type':_0xcf66('0x22'),'response_type':_0xcf66('0x22'),'rest_data':JSON[_0xcf66('0x23')]({'session':_0x54fb72['id'],'module_name':_0xcf66('0x1b'),'query':util[_0xcf66('0x25')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x3f73ff),'order_by':'','offset':'0','select_fields':['id',_0xcf66('0xf'),_0xcf66('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2786d8){if(_0x2786d8[_0xcf66('0x33')][_0xcf66('0x1e')]){var _0x10717c=_[_0xcf66('0x34')](_0x2786d8[_0xcf66('0x33')],function(_0x343b7c){return _0x343b7c[_0xcf66('0x35')][_0xcf66('0x3c')]['value']===_0x3f73ff;});if(_0x10717c){logger[_0xcf66('0x2c')](_0xcf66('0x3d'));return BPromise['resolve']({'id':_0x10717c[_0xcf66('0x35')]['id'][_0xcf66('0x36')],'name':_0x10717c[_0xcf66('0x35')][_0xcf66('0xf')][_0xcf66('0x36')],'phone':_0x10717c['name_value_list'][_0xcf66('0x3c')]['value']});}}else{logger[_0xcf66('0x2c')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xcf66('0x3e'),'input_type':_0xcf66('0x22'),'response_type':_0xcf66('0x22'),'rest_data':JSON['stringify']({'session':_0x54fb72['id'],'module_name':'Contacts','name_value_list':[{'name':_0xcf66('0x3f'),'value':_0x450154!==_0xcf66('0x40')?_0x450154:util['format'](_0xcf66('0x41'),_0x3f73ff)},{'name':_0xcf66('0x3c'),'value':_0x3f73ff}]})}})[_0xcf66('0x32')](function(_0x9ea106){logger['info'](_0xcf66('0x42'));return BPromise['resolve']({'id':_0x9ea106['id'],'name':_0x9ea106[_0xcf66('0x33')][_0xcf66('0x3f')][_0xcf66('0x36')],'phone':_0x9ea106[_0xcf66('0x33')][_0xcf66('0x3c')]['value']});});}});}function request(_0x5a6572){logger[_0xcf66('0x43')]('[HTTP]',JSON[_0xcf66('0x23')](_0x5a6572));return rp(_[_0xcf66('0x44')](def,_0x5a6572));}function getTags(_0x20b8cd,_0x417674){var _0x5626d9=[];if(_0x20b8cd&&_0x20b8cd[_0xcf66('0x1e')]>0x0){_0x5626d9=_[_0xcf66('0x45')](_0x20b8cd,_0x417674);}return _0x5626d9;}function getCustomFields(_0x13cec7,_0x11edd6){var _0x17db66=[];var _0x57b961={'custom_fields':[]};if(_0x13cec7['length']>0x0){_[_0xcf66('0x46')](_0x13cec7,function(_0x301056){if(_0x301056[_0xcf66('0x47')]===_0xcf66('0x48')&&_0x301056[_0xcf66('0x49')]&&!_0x301056[_0xcf66('0x4a')]){_0x57b961[_0x301056[_0xcf66('0x49')][_0xcf66('0x4b')]()]=_0x301056[_0xcf66('0x4c')][_0xcf66('0x28')]();}else if(_0x301056['type']===_0xcf66('0x48')&&_0x301056[_0xcf66('0x21')]&&_0x301056[_0xcf66('0x4a')]){_0x57b961['custom_fields']['push']({'id':_0x301056[_0xcf66('0x21')],'value':_0x301056['content'][_0xcf66('0x28')]()});}else if(_0x301056[_0xcf66('0x47')]===_0xcf66('0x4d')&&_0x301056[_0xcf66('0x1f')]&&_0x301056[_0xcf66('0x21')]&&_0x301056[_0xcf66('0x4a')]){_0x11edd6[_0x301056[_0xcf66('0x1f')]]&&_0x57b961[_0xcf66('0x4e')]['push']({'id':_0x301056[_0xcf66('0x21')],'value':_0x11edd6[_0x301056['variableName']][_0xcf66('0x28')]()});}else if(_0x301056[_0xcf66('0x47')]===_0xcf66('0x4f')&&_0x301056[_0xcf66('0x50')]&&_0x301056[_0xcf66('0x50')][_0xcf66('0xf')]&&_0x301056['idField']&&_0x301056['customField']){_0x11edd6[_0x301056[_0xcf66('0x50')][_0xcf66('0xf')][_0xcf66('0x4b')]()]&&_0x57b961[_0xcf66('0x4e')]['push']({'id':_0x301056[_0xcf66('0x21')],'value':_0x11edd6[_0x301056[_0xcf66('0x50')][_0xcf66('0xf')][_0xcf66('0x4b')]()][_0xcf66('0x28')]()});}});}return _0x57b961;}function getConnection(_0x2810e2){return request({'method':'POST','form':{'method':_0xcf66('0x51'),'input_type':'JSON','response_type':_0xcf66('0x22'),'rest_data':JSON[_0xcf66('0x23')]({'user_auth':{'user_name':_0x2810e2[_0xcf66('0x52')],'password':_0x2810e2['password'],'encryption':_0xcf66('0x53')},'application':_0xcf66('0x54')})}})['then'](function(_0x495035){var _0x832aad=_0x495035;if(_0x832aad['id']){def['sessionID']=_0x832aad['id'];return BPromise[_0xcf66('0x38')](_0x832aad);}else{throw new Error(util[_0xcf66('0x25')]('Account\x20%d\x20is\x20not\x20valid',_0x2810e2['id']));}});}function setRelationship(_0x2efb4c,_0x275f51,_0x280138,_0x5973ed){return request({'form':{'method':_0xcf66('0x55'),'input_type':_0xcf66('0x22'),'response_type':_0xcf66('0x22'),'rest_data':JSON['stringify']({'session':_0x2efb4c['id'],'module_name':_0xcf66('0x24'),'module_id':_0x280138['id'],'link_field_name':_0x5973ed,'related_ids':[_0x275f51['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x4aa932,_0xa0ade8,_0x30ad73,_0x5e2d7,_0x132f32,_0x48d6f4){var _0x1a3cad,_0x1e1ce1,_0x2c32ab,_0x3a7295;_0x48d6f4['remoteUri']=intUtil['stripTrailingSlash'](_0x48d6f4['remoteUri']);_0x48d6f4[_0xcf66('0x56')]=intUtil[_0xcf66('0x57')](_0x48d6f4[_0xcf66('0x56')]);def[_0xcf66('0x58')]=util[_0xcf66('0x25')]('%s/service/v4_1/rest.php',_0x48d6f4[_0xcf66('0x59')]);if(_0x132f32&&_0x132f32[_0xcf66('0x5a')]){logger[_0xcf66('0x2c')](_0xcf66('0x5b'),_0xcf66('0x5c'));_0xa0ade8['recordingURL']=util[_0xcf66('0x25')](_0xcf66('0x5d'),_0x48d6f4[_0xcf66('0x56')],_0xa0ade8[_0xcf66('0x5e')],md5(_0xa0ade8[_0xcf66('0x5e')]));}else{_0xa0ade8[_0xcf66('0x5f')]='';}return getConnection(_0x48d6f4)[_0xcf66('0x32')](function(_0xfd091d){_0x3a7295=_0xfd091d;return getUser(_0x48d6f4,_0x5e2d7[_0xcf66('0xf')],_0x3a7295);})['then'](function(_0x806298){_0x1a3cad=_0x806298;logger['info'](_0xcf66('0x60'),_0x1a3cad['id']);return getEndUser(_0x48d6f4,_0xa0ade8[_0xcf66('0x61')],_0xa0ade8[_0xcf66('0x62')],_0x3a7295);})[_0xcf66('0x32')](function(_0x420324){_0x1e1ce1=_0x420324;logger['info'](_0xcf66('0x63'),_0x1e1ce1['id']);return getTicket(_0x48d6f4,_0x1a3cad,_0x1e1ce1,_0x30ad73,_0xa0ade8,_0x30ad73[_0xcf66('0x64')],_0x3a7295,_0xcf66('0x65'));})[_0xcf66('0x32')](function(_0x4be609){_0x2c32ab=_0x4be609;logger[_0xcf66('0x2c')](_0xcf66('0x66'));logger['info'](_0xcf66('0x67'),_0x2c32ab['id']);return setRelationship(_0x3a7295,_0x1a3cad,_0x2c32ab,_0xcf66('0x68'));})['then'](function(){return setRelationship(_0x3a7295,_0x1e1ce1,_0x2c32ab,_0xcf66('0x69'));})['then'](function(){return getServerInfo(_0x3a7295);})['then'](function(_0x1244a4){var _0x3ec79e=parseInt(_0x1244a4[_0xcf66('0x6a')][_0xcf66('0x6b')](0x0));var _0x261265=util['format'](_0xcf66('0x6c'),_0x48d6f4[_0xcf66('0x59')],_0x2c32ab['id']);if(_0x3ec79e>0x6){_0x261265=util[_0xcf66('0x25')](_0xcf66('0x6d'),_0x48d6f4[_0xcf66('0x59')],_0x2c32ab['id']);}logger[_0xcf66('0x2c')](_0xcf66('0x5b'),_0xcf66('0x6e'));emit(util[_0xcf66('0x25')](_0xcf66('0x6f'),_0x5e2d7[_0xcf66('0xf')]),_0xcf66('0x70'),{'uri':_0x261265});})['catch'](function(_0xe36e1c){logger['error']('[QUEUE]',JSON[_0xcf66('0x23')](_0xe36e1c));});};exports['outbound']=function(_0x3dd3e9,_0x208199,_0x1278da,_0x17b18a,_0xd51532,_0x47c06f,_0x4adf82){var _0x244b3f,_0x1c565f,_0x5615a4,_0x2ecf6a;_0x47c06f[_0xcf66('0x59')]=intUtil[_0xcf66('0x57')](_0x47c06f[_0xcf66('0x59')]);_0x47c06f[_0xcf66('0x56')]=intUtil[_0xcf66('0x57')](_0x47c06f[_0xcf66('0x56')]);def[_0xcf66('0x58')]=util['format'](_0xcf66('0x71'),_0x47c06f[_0xcf66('0x59')]);if(_0x4adf82&&_0x4adf82[_0xcf66('0x72')]&&_0x4adf82[_0xcf66('0x72')]!==_0xcf66('0x73')){logger['info']('[OUTBOUND]',_0xcf66('0x5c'));_0x208199[_0xcf66('0x5f')]=util[_0xcf66('0x25')](_0xcf66('0x5d'),_0x47c06f[_0xcf66('0x56')],_0x208199[_0xcf66('0x5e')],md5(_0x208199['uniqueid']));}return getConnection(_0x47c06f)[_0xcf66('0x32')](function(_0x538a5c){_0x2ecf6a=_0x538a5c;return getUser(_0x47c06f,_0x17b18a['name'],_0x2ecf6a);})[_0xcf66('0x32')](function(_0xffbf91){_0x244b3f=_0xffbf91;logger[_0xcf66('0x2c')]('The\x20User\x20ID\x20is:',_0x244b3f['id']);return getEndUser(_0x47c06f,_0x208199[_0xcf66('0x74')],_0x208199[_0xcf66('0x75')],_0x2ecf6a);})[_0xcf66('0x32')](function(_0x3dc606){_0x1c565f=_0x3dc606;logger[_0xcf66('0x2c')]('The\x20Enduser\x20ID\x20is:',_0x1c565f['id']);return getTicket(_0x47c06f,_0x244b3f,_0x1c565f,_0x1278da,_0x208199,_0x1278da[_0xcf66('0x64')],_0x2ecf6a,_0xcf66('0x76'));})[_0xcf66('0x32')](function(_0xdcfa8e){_0x5615a4=_0xdcfa8e;logger[_0xcf66('0x2c')]('Ticket\x20created!');logger[_0xcf66('0x2c')](_0xcf66('0x67'),_0x5615a4['id']);return setRelationship(_0x2ecf6a,_0x244b3f,_0x5615a4,'users');})['then'](function(){return setRelationship(_0x2ecf6a,_0x1c565f,_0x5615a4,_0xcf66('0x69'));})['then'](function(){return getServerInfo(_0x2ecf6a);})[_0xcf66('0x32')](function(_0x22eed3){var _0x6aaee0=parseInt(_0x22eed3[_0xcf66('0x6a')][_0xcf66('0x6b')](0x0));var _0x20a14e=util[_0xcf66('0x25')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x47c06f[_0xcf66('0x59')],_0x5615a4['id']);if(_0x6aaee0>0x6){_0x20a14e=util[_0xcf66('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x47c06f['remoteUri'],_0x5615a4['id']);}logger['info'](_0xcf66('0x77'),_0xcf66('0x6e'));emit(util['format'](_0xcf66('0x6f'),_0x17b18a[_0xcf66('0xf')]),_0xcf66('0x70'),{'uri':_0x20a14e});})['catch'](function(_0x2d8b01){logger[_0xcf66('0x78')](_0xcf66('0x77'),JSON[_0xcf66('0x23')](_0x2d8b01));});};exports[_0xcf66('0x79')]=function(_0x32ee05,_0x3c3648,_0x586e70,_0x3775ac,_0x4f3387,_0x39db62){var _0x4e1bf4,_0x512f2c,_0x5ced3c,_0x2220f7;_0x39db62['remoteUri']=intUtil['stripTrailingSlash'](_0x39db62[_0xcf66('0x59')]);_0x39db62[_0xcf66('0x56')]=intUtil[_0xcf66('0x57')](_0x39db62[_0xcf66('0x56')]);def['uri']=util['format'](_0xcf66('0x71'),_0x39db62[_0xcf66('0x59')]);if(_0x4f3387&&_0x4f3387['monitor_format']){logger[_0xcf66('0x2c')]('['+_0x3c3648['lastevent']['toUpperCase']()+']',_0xcf66('0x5c'));_0x3c3648['recordingURL']=util[_0xcf66('0x25')](_0xcf66('0x5d'),_0x39db62[_0xcf66('0x56')],_0x3c3648[_0xcf66('0x5e')],md5(_0x3c3648[_0xcf66('0x5e')]));}else{_0x3c3648[_0xcf66('0x5f')]='';}return getConnection(_0x39db62)[_0xcf66('0x32')](function(_0x3a8fd9){_0x2220f7=_0x3a8fd9;if(!_[_0xcf66('0x2b')](_0x3775ac)){return getUser(_0x39db62,_0x3775ac[_0xcf66('0xf')],_0x2220f7);}else{return getUser(_0x39db62,null,_0x2220f7);}})['then'](function(_0x514cfa){_0x4e1bf4=_0x514cfa;logger[_0xcf66('0x2c')](_0xcf66('0x60'),_0x4e1bf4['id']);return getEndUser(_0x39db62,_0x3c3648[_0xcf66('0x61')],_0x3c3648['calleridnum'],_0x2220f7);})['then'](function(_0x3b0111){_0x512f2c=_0x3b0111;logger[_0xcf66('0x2c')]('The\x20Enduser\x20ID\x20is:',_0x512f2c['id']);return getTicket(_0x39db62,_0x4e1bf4,_0x512f2c,_0x586e70,_0x3c3648,_0x586e70[_0xcf66('0x64')],_0x2220f7,_0xcf66('0x65'));})[_0xcf66('0x32')](function(_0x3f46dc){_0x5ced3c=_0x3f46dc;logger[_0xcf66('0x2c')](_0xcf66('0x66'));logger['info'](_0xcf66('0x67'),_0x5ced3c['id']);return setRelationship(_0x2220f7,_0x4e1bf4,_0x5ced3c,'users');})[_0xcf66('0x32')](function(){return setRelationship(_0x2220f7,_0x512f2c,_0x5ced3c,_0xcf66('0x69'));})[_0xcf66('0x32')](function(){return getServerInfo(_0x2220f7);})['catch'](function(_0x26228b){logger[_0xcf66('0x78')]('['+_0x3c3648[_0xcf66('0x7a')][_0xcf66('0x7b')]()+']',JSON[_0xcf66('0x23')](_0x26228b));});};
\ No newline at end of file
index 263198b..7bd2962 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc187=['content','variableName','toString','Variable','name','toLowerCase','keyValue','string','key','%s:\x20%s','keyType','customVariable','format','join','slice','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','push'];(function(_0x157214,_0x1e126c){var _0x1b4a57=function(_0x29bb52){while(--_0x29bb52){_0x157214['push'](_0x157214['shift']());}};_0x1b4a57(++_0x1e126c);}(_0xc187,0x17f));var _0x7c18=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xc187[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x7c18('0x0'));var util=require(_0x7c18('0x1'));exports[_0x7c18('0x2')]=function(_0x5ad121,_0x4c64dd,_0x46489e){var _0x5f2cbf=[];if(_0x5ad121[_0x7c18('0x3')]>0x0){var _0x214ce1=_[_0x7c18('0x4')](_0x5ad121,['id']);for(var _0x22bd9c=0x0;_0x22bd9c<_0x214ce1[_0x7c18('0x3')];_0x22bd9c++){var _0x268a3c=_0x214ce1[_0x22bd9c];if(_0x268a3c[_0x7c18('0x5')]==='string'){_0x5f2cbf[_0x7c18('0x6')](_0x268a3c[_0x7c18('0x7')]);}else if(_0x268a3c['type']==='variable'&&_0x268a3c[_0x7c18('0x8')]){_0x4c64dd[_0x268a3c[_0x7c18('0x8')]]&&_0x5f2cbf['push'](_0x4c64dd[_0x268a3c[_0x7c18('0x8')]][_0x7c18('0x9')]());}else if(_0x268a3c['type']==='customVariable'&&_0x268a3c[_0x7c18('0xa')]&&_0x268a3c[_0x7c18('0xa')][_0x7c18('0xb')]){_0x4c64dd[_0x268a3c[_0x7c18('0xa')][_0x7c18('0xb')][_0x7c18('0xc')]()]&&_0x5f2cbf[_0x7c18('0x6')](_0x4c64dd[_0x268a3c[_0x7c18('0xa')][_0x7c18('0xb')][_0x7c18('0xc')]()][_0x7c18('0x9')]());}else if(_0x268a3c['type']===_0x7c18('0xd')){if(_0x268a3c['keyType']===_0x7c18('0xe')&&_0x268a3c[_0x7c18('0xf')]){_0x5f2cbf[_0x7c18('0x6')](util['format'](_0x7c18('0x10'),_0x268a3c[_0x7c18('0xf')],_0x268a3c['keyContent']));}else if(_0x268a3c[_0x7c18('0x11')]==='variable'&&_0x268a3c[_0x7c18('0x8')]&&_0x268a3c[_0x7c18('0xf')]){_0x4c64dd[_0x268a3c[_0x7c18('0x8')]]&&_0x5f2cbf['push'](util['format'](_0x7c18('0x10'),_0x268a3c[_0x7c18('0xf')],_0x4c64dd[_0x268a3c[_0x7c18('0x8')]]));}else if(_0x268a3c[_0x7c18('0x11')]===_0x7c18('0x12')&&_0x268a3c['Variable']&&_0x268a3c['Variable'][_0x7c18('0xb')]&&_0x268a3c[_0x7c18('0xf')]){_0x4c64dd[_0x268a3c['Variable'][_0x7c18('0xb')]['toLowerCase']()]&&_0x5f2cbf['push'](util[_0x7c18('0x13')](_0x7c18('0x10'),_0x268a3c[_0x7c18('0xf')],_0x4c64dd[_0x268a3c[_0x7c18('0xa')][_0x7c18('0xb')][_0x7c18('0xc')]()]));}}}}return _0x5f2cbf[_0x7c18('0x14')](_0x46489e);};exports['stripTrailingSlash']=function(_0x13f465){var _0x37956a=_0x13f465[_0x7c18('0x15')](-0x1);if(_0x37956a==='/'){_0x13f465=_0x13f465['substring'](0x0,_0x13f465[_0x7c18('0x16')](_0x37956a));}return _0x13f465;};exports[_0x7c18('0x17')]=function(_0x48201d){if(!_[_0x7c18('0x18')](_0x48201d)&&_0x48201d!==''){var _0x259050=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x259050[_0x7c18('0x19')](String(_0x48201d)[_0x7c18('0xc')]());}else{return![];}};
\ No newline at end of file
+var _0x4023=['variableName','customVariable','Variable','name','toLowerCase','push','keyValue','keyType','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','getString','sortBy','length','string','content','type','variable'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4023,0x7f));var _0x3402=function(_0x306a6a,_0x17db37){_0x306a6a=_0x306a6a-0x0;var _0xb6967b=_0x4023[_0x306a6a];return _0xb6967b;};'use strict';var _=require(_0x3402('0x0'));var util=require('util');exports[_0x3402('0x1')]=function(_0x4a15e8,_0x1a10c0,_0x5e0004){var _0x13bb08=[];if(_0x4a15e8['length']>0x0){var _0x18fb36=_[_0x3402('0x2')](_0x4a15e8,['id']);for(var _0x52a1f0=0x0;_0x52a1f0<_0x18fb36[_0x3402('0x3')];_0x52a1f0++){var _0x33bdce=_0x18fb36[_0x52a1f0];if(_0x33bdce['type']===_0x3402('0x4')){_0x13bb08['push'](_0x33bdce[_0x3402('0x5')]);}else if(_0x33bdce[_0x3402('0x6')]===_0x3402('0x7')&&_0x33bdce[_0x3402('0x8')]){_0x1a10c0[_0x33bdce[_0x3402('0x8')]]&&_0x13bb08['push'](_0x1a10c0[_0x33bdce[_0x3402('0x8')]]['toString']());}else if(_0x33bdce['type']===_0x3402('0x9')&&_0x33bdce[_0x3402('0xa')]&&_0x33bdce[_0x3402('0xa')][_0x3402('0xb')]){_0x1a10c0[_0x33bdce[_0x3402('0xa')][_0x3402('0xb')][_0x3402('0xc')]()]&&_0x13bb08[_0x3402('0xd')](_0x1a10c0[_0x33bdce['Variable'][_0x3402('0xb')][_0x3402('0xc')]()]['toString']());}else if(_0x33bdce[_0x3402('0x6')]===_0x3402('0xe')){if(_0x33bdce[_0x3402('0xf')]===_0x3402('0x4')&&_0x33bdce[_0x3402('0x10')]){_0x13bb08['push'](util[_0x3402('0x11')]('%s:\x20%s',_0x33bdce['key'],_0x33bdce[_0x3402('0x12')]));}else if(_0x33bdce[_0x3402('0xf')]===_0x3402('0x7')&&_0x33bdce[_0x3402('0x8')]&&_0x33bdce[_0x3402('0x10')]){_0x1a10c0[_0x33bdce[_0x3402('0x8')]]&&_0x13bb08[_0x3402('0xd')](util['format'](_0x3402('0x13'),_0x33bdce[_0x3402('0x10')],_0x1a10c0[_0x33bdce[_0x3402('0x8')]]));}else if(_0x33bdce[_0x3402('0xf')]===_0x3402('0x9')&&_0x33bdce[_0x3402('0xa')]&&_0x33bdce['Variable'][_0x3402('0xb')]&&_0x33bdce['key']){_0x1a10c0[_0x33bdce[_0x3402('0xa')][_0x3402('0xb')]['toLowerCase']()]&&_0x13bb08[_0x3402('0xd')](util['format'](_0x3402('0x13'),_0x33bdce[_0x3402('0x10')],_0x1a10c0[_0x33bdce['Variable'][_0x3402('0xb')][_0x3402('0xc')]()]));}}}}return _0x13bb08[_0x3402('0x14')](_0x5e0004);};exports[_0x3402('0x15')]=function(_0x1842cb){var _0x55a65f=_0x1842cb['slice'](-0x1);if(_0x55a65f==='/'){_0x1842cb=_0x1842cb[_0x3402('0x16')](0x0,_0x1842cb[_0x3402('0x17')](_0x55a65f));}return _0x1842cb;};exports[_0x3402('0x18')]=function(_0x3b0391){if(!_[_0x3402('0x19')](_0x3b0391)&&_0x3b0391!==''){var _0x146c38=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x146c38[_0x3402('0x1a')](String(_0x3b0391)['toLowerCase']());}else{return![];}};
\ No newline at end of file
index b9acc32..aa5194c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x20fced,_0x26ea15){var _0x3c2268=function(_0x5c7f94){while(--_0x5c7f94){_0x20fced['push'](_0x20fced['shift']());}};_0x3c2268(++_0x26ea15);}(_0xe706,0xa3));var _0x6e70=function(_0x5db0ef,_0x5a6459){_0x5db0ef=_0x5db0ef-0x0;var _0x514e1e=_0xe706[_0x5db0ef];return _0x514e1e;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});};
\ No newline at end of file
+var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x5b15e9,_0x7b2d16){var _0x360b12=function(_0x3bf18e){while(--_0x3bf18e){_0x5b15e9['push'](_0x5b15e9['shift']());}};_0x360b12(++_0x7b2d16);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});};
\ No newline at end of file
index 568aa56..9216f29 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x28a4=['zendesk','defaults','localhost','socket.io-emitter','redis','emit','application/json','info','%s/tickets.json','remoteUri','POST','Tags','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','debug','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','push','idField','variable','variableName','custom_fields','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','inspect','outbound','recordingFormat','none','email','destcalleridnum','[OUTBOUND]','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','Recording\x20is\x20enabled!','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','./util','../../../../config/environment'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x28a4,0x1bb));var _0x428a=function(_0x4ae2fb,_0x1c1c67){_0x4ae2fb=_0x4ae2fb-0x0;var _0x4f5268=_0x28a4[_0x4ae2fb];return _0x4f5268;};'use strict';var _=require('lodash');var rp=require(_0x428a('0x0'));var md5=require(_0x428a('0x1'));var util=require(_0x428a('0x2'));var Redis=require('ioredis');var intUtil=require(_0x428a('0x3'));var config=require(_0x428a('0x4'));var logger=require('../../../../config/logger')(_0x428a('0x5'));config['redis']=_[_0x428a('0x6')](config['redis'],{'host':_0x428a('0x7'),'port':0x18eb});var io=require(_0x428a('0x8'))(new Redis(config[_0x428a('0x9')]));function emit(_0x4177de,_0x2301de,_0x3c2914){io['to'](_0x4177de)[_0x428a('0xa')](_0x2301de,_0x3c2914);}var headers={'Content-Type':_0x428a('0xb'),'Accept':_0x428a('0xb')};function getTicket(_0x46f813,_0x5ea2ff,_0x12cb2a,_0x1c0b93,_0x1298b2){logger[_0x428a('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x428a('0xd'),_0x46f813[_0x428a('0xe')]),'method':_0x428a('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x12cb2a['id'],'submitter_id':_0x5ea2ff?_0x5ea2ff['id']:undefined,'assignee_id':_0x5ea2ff?_0x5ea2ff['id']:undefined,'tags':getTags(_0x1c0b93[_0x428a('0x10')],'name'),'subject':intUtil[_0x428a('0x11')](_0x1c0b93['Subjects'],_0x1298b2,'\x20'),'description':intUtil[_0x428a('0x11')](_0x1c0b93[_0x428a('0x12')],_0x1298b2,'\x0a'),'comment':{'public':![],'body':intUtil[_0x428a('0x11')](_0x1c0b93[_0x428a('0x12')],_0x1298b2,'\x0a')}},getCustomFields(_0x1c0b93[_0x428a('0x13')],_0x1298b2))}})[_0x428a('0x14')](function(_0x3c306b){logger[_0x428a('0xc')](_0x428a('0x15'));return _0x3c306b[_0x428a('0x16')];});}function getUser(_0x53f475,_0x1e4a38){if(intUtil[_0x428a('0x17')](_0x1e4a38)){logger[_0x428a('0xc')](_0x428a('0x18'),_0x1e4a38);return request({'uri':util[_0x428a('0x19')]('%s/search.json',_0x53f475['remoteUri']),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x1e4a38)}})['then'](function(_0x1e6917){if(_0x1e6917[_0x428a('0x1a')]){logger[_0x428a('0xc')](_0x428a('0x1b'));return _[_0x428a('0x1c')](_0x1e6917[_0x428a('0x1d')],{'email':_0x1e4a38,'role':_0x428a('0x1e')});}else{logger[_0x428a('0xc')](_0x428a('0x1f'));return request({'uri':util['format'](_0x428a('0x20'),_0x53f475[_0x428a('0xe')])})[_0x428a('0x14')](function(_0x5d8024){logger[_0x428a('0xc')](_0x428a('0x21'));return _0x5d8024[_0x428a('0x22')];});}});}else{logger[_0x428a('0xc')](_0x428a('0x1f'));return request({'uri':util[_0x428a('0x19')]('%s/users/me.json',_0x53f475[_0x428a('0xe')])})['then'](function(_0x1b0df2){logger[_0x428a('0xc')](_0x428a('0x21'));return _0x1b0df2[_0x428a('0x22')];});}}function getEndUser(_0x3fd1c3,_0xd25212,_0x4d09de){logger[_0x428a('0xc')](_0x428a('0x23'),_0x4d09de);return request({'uri':util['format']('%s/search.json',_0x3fd1c3['remoteUri']),'qs':{'query':util[_0x428a('0x19')](_0x428a('0x24'),_0x4d09de)}})[_0x428a('0x14')](function(_0x4654ee){var _0x36bc6d;if(_0x4654ee[_0x428a('0x1d')]['length']){_0x4654ee[_0x428a('0x1d')]=_[_0x428a('0x25')](_0x4654ee[_0x428a('0x1d')],{'suspended':![],'role':_0x428a('0x26')});if(_0x4654ee[_0x428a('0x1d')][_0x428a('0x27')]){_0x36bc6d=_[_0x428a('0x28')](_0x4654ee['results']);}}if(_0x36bc6d){logger[_0x428a('0xc')](_0x428a('0x29'));return _0x36bc6d;}else{logger[_0x428a('0xc')](_0x428a('0x2a'));return request({'uri':util[_0x428a('0x19')](_0x428a('0x2b'),_0x3fd1c3[_0x428a('0xe')]),'method':_0x428a('0xf'),'body':{'user':{'role':'end-user','name':util[_0x428a('0x19')](_0x428a('0x2c'),_0xd25212||_0x4d09de),'phone':_0x4d09de}}})[_0x428a('0x14')](function(_0x59b7b9){logger[_0x428a('0xc')](_0x428a('0x2d'));return _0x59b7b9['user'];});}});}function getAuth(_0x4ee2c0){var _0x1985c9;if(_0x4ee2c0[_0x428a('0x2e')]===_0x428a('0x2f')){_0x1985c9=util[_0x428a('0x19')](_0x428a('0x30'),_0x4ee2c0['username'],_0x4ee2c0[_0x428a('0x2f')]);}else if(_0x4ee2c0[_0x428a('0x2e')]==='token'){_0x1985c9=util[_0x428a('0x19')]('%s/token:%s',_0x4ee2c0[_0x428a('0x31')],_0x4ee2c0[_0x428a('0x32')]);}return util['format'](_0x428a('0x33'),new Buffer(_0x1985c9)[_0x428a('0x34')]('base64'));}function request(_0x14ecc7){logger[_0x428a('0x35')]('[HTTP]',JSON[_0x428a('0x36')](_0x14ecc7));return rp(_[_0x428a('0x6')](_0x14ecc7,{'method':_0x428a('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x33ccdc,_0x494694){var _0x48ee13=[];if(_0x33ccdc&&_0x33ccdc[_0x428a('0x27')]>0x0){_0x48ee13=_[_0x428a('0x38')](_0x33ccdc,_0x494694);}return _0x48ee13;}function getCustomFields(_0x4baf76,_0x21a388){var _0x47a2e9=[];var _0x3e6c3f={'custom_fields':[]};if(_0x4baf76['length']>0x0){_[_0x428a('0x39')](_0x4baf76,function(_0x287648){if(_[_0x428a('0x3a')]([_0x428a('0x3b'),_0x428a('0x3c')],_0x287648[_0x428a('0x3d')])&&_0x287648[_0x428a('0x3e')]&&!_0x287648[_0x428a('0x3f')]){_0x3e6c3f[_0x287648['nameField'][_0x428a('0x40')]()]=_0x287648[_0x428a('0x41')][_0x428a('0x34')]();}else if(_[_0x428a('0x3a')]([_0x428a('0x3b'),_0x428a('0x3c')],_0x287648[_0x428a('0x3d')])&&_0x287648['idField']&&_0x287648['customField']){_0x3e6c3f['custom_fields'][_0x428a('0x42')]({'id':_0x287648[_0x428a('0x43')],'value':_0x287648[_0x428a('0x41')]['toString']()});}else if(_0x287648[_0x428a('0x3d')]===_0x428a('0x44')&&_0x287648['variableName']&&_0x287648[_0x428a('0x43')]&&_0x287648['customField']){_0x21a388[_0x287648[_0x428a('0x45')]]&&_0x3e6c3f[_0x428a('0x46')][_0x428a('0x42')]({'id':_0x287648[_0x428a('0x43')],'value':_0x21a388[_0x287648[_0x428a('0x45')]][_0x428a('0x34')]()});}else if(_0x287648['type']==='customVariable'&&_0x287648[_0x428a('0x47')]&&_0x287648[_0x428a('0x47')][_0x428a('0x48')]&&_0x287648[_0x428a('0x43')]&&_0x287648[_0x428a('0x3f')]){_0x21a388[_0x287648[_0x428a('0x47')][_0x428a('0x48')][_0x428a('0x40')]()]&&_0x3e6c3f['custom_fields'][_0x428a('0x42')]({'id':_0x287648[_0x428a('0x43')],'value':_0x21a388[_0x287648[_0x428a('0x47')][_0x428a('0x48')][_0x428a('0x40')]()][_0x428a('0x34')]()});}});}return _0x3e6c3f;}exports[_0x428a('0x49')]=function(_0x608baf,_0x310185,_0x4f3228,_0x499d9,_0x3b9ed0,_0x1c263b){var _0x3f0386,_0x1d206c;_0x1c263b[_0x428a('0xe')]=intUtil[_0x428a('0x4a')](_0x1c263b[_0x428a('0xe')]);_0x1c263b[_0x428a('0x4b')]=intUtil[_0x428a('0x4a')](_0x1c263b[_0x428a('0x4b')]);if(_0x3b9ed0&&_0x3b9ed0[_0x428a('0x4c')]){logger[_0x428a('0xc')](_0x428a('0x4d'),'Recording\x20is\x20enabled!');_0x310185[_0x428a('0x4e')]=util[_0x428a('0x19')](_0x428a('0x4f'),_0x1c263b[_0x428a('0x4b')],_0x310185['uniqueid'],md5(_0x310185[_0x428a('0x50')]));}else{_0x310185[_0x428a('0x4e')]='';}headers[_0x428a('0x51')]=getAuth(_0x1c263b);return getUser(_0x1c263b,_0x499d9['email'])[_0x428a('0x14')](function(_0x24d4fe){_0x3f0386=_0x24d4fe;logger[_0x428a('0xc')](_0x428a('0x52'),_0x3f0386['id']);return getEndUser(_0x1c263b,_0x310185[_0x428a('0x53')],_0x310185['calleridnum']);})['then'](function(_0x273e42){_0x1d206c=_0x273e42;logger[_0x428a('0xc')](_0x428a('0x54'),_0x1d206c['id']);return getTicket(_0x1c263b,_0x3f0386,_0x1d206c,_0x4f3228,_0x310185);})[_0x428a('0x14')](function(_0x3d8242){if(_0x3d8242){logger[_0x428a('0xc')](_0x428a('0x55'),_0x3d8242['id']);switch(_0x1c263b[_0x428a('0x3d')]){case _0x428a('0x56'):logger['info'](_0x428a('0x4d'),_0x428a('0x57'));return request({'uri':util[_0x428a('0x19')](_0x428a('0x58'),_0x1c263b[_0x428a('0xe')],_0x3f0386['id'],_0x3d8242['id']),'method':_0x428a('0xf')});case _0x428a('0x59'):logger[_0x428a('0xc')](_0x428a('0x4d'),_0x428a('0x5a'));emit(util[_0x428a('0x19')](_0x428a('0x5b'),_0x499d9['name']),'trigger:browser:url',{'uri':util[_0x428a('0x19')](_0x428a('0x5c'),_0x1c263b[_0x428a('0xe')]['replace'](_0x428a('0x5d'),''),_0x3d8242['id'])});break;default:logger['error'](_0x428a('0x4d'),_0x428a('0x5e'));}}})[_0x428a('0x5f')](function(_0x56705e){logger[_0x428a('0x60')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x428a('0x61')](_0x56705e,{'showHidden':!![],'depth':null}));});};exports[_0x428a('0x62')]=function(_0x2c9df5,_0x3362ec,_0x40aed,_0x5210cb,_0x19ea7c,_0x1fb2df,_0x4f1a45){var _0x4b3d09,_0x5877c6;_0x1fb2df['remoteUri']=intUtil[_0x428a('0x4a')](_0x1fb2df[_0x428a('0xe')]);_0x1fb2df[_0x428a('0x4b')]=intUtil[_0x428a('0x4a')](_0x1fb2df[_0x428a('0x4b')]);if(_0x4f1a45&&_0x4f1a45['recordingFormat']&&_0x4f1a45[_0x428a('0x63')]!==_0x428a('0x64')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3362ec[_0x428a('0x4e')]=util[_0x428a('0x19')](_0x428a('0x4f'),_0x1fb2df['serverUrl'],_0x3362ec[_0x428a('0x50')],md5(_0x3362ec[_0x428a('0x50')]));}headers[_0x428a('0x51')]=getAuth(_0x1fb2df);return getUser(_0x1fb2df,_0x5210cb[_0x428a('0x65')])[_0x428a('0x14')](function(_0x442869){_0x4b3d09=_0x442869;logger[_0x428a('0xc')](_0x428a('0x52'),_0x4b3d09['id']);return getEndUser(_0x1fb2df,_0x3362ec['destcalleridname'],_0x3362ec[_0x428a('0x66')]);})[_0x428a('0x14')](function(_0x1a9c53){_0x5877c6=_0x1a9c53;logger['info'](_0x428a('0x54'),_0x5877c6['id']);return getTicket(_0x1fb2df,_0x4b3d09,_0x5877c6,_0x40aed,_0x3362ec);})[_0x428a('0x14')](function(_0x165d68){if(_0x165d68){logger[_0x428a('0xc')]('The\x20Ticket\x20ID\x20is:',_0x165d68['id']);switch(_0x1fb2df['type']){case'integrationTab':logger[_0x428a('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x428a('0x19')](_0x428a('0x58'),_0x1fb2df[_0x428a('0xe')],_0x4b3d09['id'],_0x165d68['id']),'method':_0x428a('0xf')});case'newTab':logger['info'](_0x428a('0x67'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x428a('0x19')]('user:%s',_0x5210cb['name']),'trigger:browser:url',{'uri':util[_0x428a('0x19')]('%s/agent/tickets/%s',_0x1fb2df[_0x428a('0xe')][_0x428a('0x68')](_0x428a('0x5d'),''),_0x165d68['id'])});break;default:logger['error'](_0x428a('0x67'),_0x428a('0x5e'));}}})[_0x428a('0x5f')](function(_0x2a635a){logger[_0x428a('0x60')](_0x428a('0x69'),util[_0x428a('0x61')](_0x2a635a,{'showHidden':!![],'depth':null}));});};exports[_0x428a('0x6a')]=function(_0x53e9f4,_0x3d3f5c,_0x398155,_0x5af576,_0x4c8a83,_0x100cc0){var _0x497edc,_0x3cae94;_0x100cc0[_0x428a('0xe')]=intUtil[_0x428a('0x4a')](_0x100cc0[_0x428a('0xe')]);_0x100cc0['serverUrl']=intUtil['stripTrailingSlash'](_0x100cc0[_0x428a('0x4b')]);if(_0x4c8a83&&_0x4c8a83[_0x428a('0x4c')]){logger['info']('['+_0x3d3f5c['lastevent'][_0x428a('0x6b')]()+']',_0x428a('0x6c'));_0x3d3f5c[_0x428a('0x4e')]=util[_0x428a('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x100cc0[_0x428a('0x4b')],_0x3d3f5c['uniqueid'],md5(_0x3d3f5c[_0x428a('0x50')]));}else{_0x3d3f5c[_0x428a('0x4e')]='';}headers['Authorization']=getAuth(_0x100cc0);return getUser(_0x100cc0)[_0x428a('0x14')](function(_0x33cfb4){_0x497edc=_0x33cfb4;logger[_0x428a('0xc')](_0x428a('0x52'),_0x497edc['id']);return getEndUser(_0x100cc0,_0x3d3f5c[_0x428a('0x53')],_0x3d3f5c[_0x428a('0x6d')]);})[_0x428a('0x14')](function(_0x4291f9){_0x3cae94=_0x4291f9;logger[_0x428a('0xc')]('The\x20Enduser\x20ID\x20is:',_0x3cae94['id']);return getTicket(_0x100cc0,_0x497edc,_0x3cae94,_0x398155,_0x3d3f5c);})['then'](function(_0x377659){if(_0x377659){logger['info'](_0x428a('0x55'),_0x377659['id']);}})[_0x428a('0x5f')](function(_0x7c841e){logger[_0x428a('0x60')]('['+_0x3d3f5c[_0x428a('0x6e')][_0x428a('0x6b')]()+']'+_0x428a('0x6f'),util['inspect'](_0x7c841e,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
+var _0x7350=['Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','calleridnum','lastevent','lodash','request-promise','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','%s/token:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','picklist','nameField','toLowerCase','content','string','type','customField','custom_fields','push','idField','variable','variableName','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0x7350,0x1ec));var _0x0735=function(_0x30913c,_0x272183){_0x30913c=_0x30913c-0x0;var _0x4a6354=_0x7350[_0x30913c];return _0x4a6354;};'use strict';var _=require(_0x0735('0x0'));var rp=require(_0x0735('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0735('0x2'));var config=require('../../../../config/environment');var logger=require(_0x0735('0x3'))('zendesk');config[_0x0735('0x4')]=_[_0x0735('0x5')](config[_0x0735('0x4')],{'host':_0x0735('0x6'),'port':0x18eb});var io=require(_0x0735('0x7'))(new Redis(config[_0x0735('0x4')]));function emit(_0x40ab85,_0xa1edf5,_0x4400a3){io['to'](_0x40ab85)[_0x0735('0x8')](_0xa1edf5,_0x4400a3);}var headers={'Content-Type':_0x0735('0x9'),'Accept':_0x0735('0x9')};function getTicket(_0x4b1e15,_0x470e2e,_0xa307c3,_0x59e6b0,_0x46a734){logger[_0x0735('0xa')](_0x0735('0xb'));return request({'uri':util[_0x0735('0xc')]('%s/tickets.json',_0x4b1e15[_0x0735('0xd')]),'method':_0x0735('0xe'),'body':{'ticket':_[_0x0735('0xf')]({'requester_id':_0xa307c3['id'],'submitter_id':_0x470e2e?_0x470e2e['id']:undefined,'assignee_id':_0x470e2e?_0x470e2e['id']:undefined,'tags':getTags(_0x59e6b0[_0x0735('0x10')],'name'),'subject':intUtil[_0x0735('0x11')](_0x59e6b0[_0x0735('0x12')],_0x46a734,'\x20'),'description':intUtil[_0x0735('0x11')](_0x59e6b0[_0x0735('0x13')],_0x46a734,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0735('0x11')](_0x59e6b0[_0x0735('0x13')],_0x46a734,'\x0a')}},getCustomFields(_0x59e6b0[_0x0735('0x14')],_0x46a734))}})[_0x0735('0x15')](function(_0x36767d){logger[_0x0735('0xa')]('Ticket\x20created!');return _0x36767d[_0x0735('0x16')];});}function getUser(_0x2f75df,_0x1301ab){if(intUtil[_0x0735('0x17')](_0x1301ab)){logger[_0x0735('0xa')]('Getting\x20agent\x20with\x20email',_0x1301ab);return request({'uri':util[_0x0735('0xc')](_0x0735('0x18'),_0x2f75df['remoteUri']),'qs':{'query':util[_0x0735('0xc')](_0x0735('0x19'),_0x1301ab)}})[_0x0735('0x15')](function(_0x56f685){if(_0x56f685[_0x0735('0x1a')]){logger[_0x0735('0xa')](_0x0735('0x1b'));return _[_0x0735('0x1c')](_0x56f685[_0x0735('0x1d')],{'email':_0x1301ab,'role':_0x0735('0x1e')});}else{logger['info'](_0x0735('0x1f'));return request({'uri':util['format'](_0x0735('0x20'),_0x2f75df[_0x0735('0xd')])})[_0x0735('0x15')](function(_0x52fcdc){logger[_0x0735('0xa')]('Admin\x20account\x20selected.');return _0x52fcdc[_0x0735('0x21')];});}});}else{logger['info'](_0x0735('0x1f'));return request({'uri':util['format'](_0x0735('0x20'),_0x2f75df[_0x0735('0xd')])})[_0x0735('0x15')](function(_0x27283d){logger[_0x0735('0xa')]('Admin\x20account\x20selected.');return _0x27283d[_0x0735('0x21')];});}}function getEndUser(_0x555c3c,_0x1340b4,_0x4cd3ff){logger[_0x0735('0xa')]('Searching\x20enduser\x20with\x20phone',_0x4cd3ff);return request({'uri':util[_0x0735('0xc')](_0x0735('0x18'),_0x555c3c[_0x0735('0xd')]),'qs':{'query':util[_0x0735('0xc')](_0x0735('0x22'),_0x4cd3ff)}})[_0x0735('0x15')](function(_0xfd414c){var _0x889859;if(_0xfd414c[_0x0735('0x1d')]['length']){_0xfd414c[_0x0735('0x1d')]=_[_0x0735('0x23')](_0xfd414c[_0x0735('0x1d')],{'suspended':![],'role':_0x0735('0x24')});if(_0xfd414c[_0x0735('0x1d')][_0x0735('0x25')]){_0x889859=_[_0x0735('0x26')](_0xfd414c[_0x0735('0x1d')]);}}if(_0x889859){logger[_0x0735('0xa')](_0x0735('0x27'));return _0x889859;}else{logger[_0x0735('0xa')](_0x0735('0x28'));return request({'uri':util[_0x0735('0xc')]('%s/users.json',_0x555c3c[_0x0735('0xd')]),'method':_0x0735('0xe'),'body':{'user':{'role':_0x0735('0x24'),'name':util[_0x0735('0xc')](_0x0735('0x29'),_0x1340b4||_0x4cd3ff),'phone':_0x4cd3ff}}})[_0x0735('0x15')](function(_0x1d1a72){logger['info'](_0x0735('0x2a'));return _0x1d1a72[_0x0735('0x21')];});}});}function getAuth(_0x8bfae){var _0x12b3ae;if(_0x8bfae[_0x0735('0x2b')]==='password'){_0x12b3ae=util['format'](_0x0735('0x2c'),_0x8bfae[_0x0735('0x2d')],_0x8bfae[_0x0735('0x2e')]);}else if(_0x8bfae[_0x0735('0x2b')]==='token'){_0x12b3ae=util[_0x0735('0xc')](_0x0735('0x2f'),_0x8bfae[_0x0735('0x2d')],_0x8bfae[_0x0735('0x30')]);}return util[_0x0735('0xc')](_0x0735('0x31'),new Buffer(_0x12b3ae)[_0x0735('0x32')](_0x0735('0x33')));}function request(_0x27ba37){logger[_0x0735('0x34')](_0x0735('0x35'),JSON[_0x0735('0x36')](_0x27ba37));return rp(_[_0x0735('0x5')](_0x27ba37,{'method':_0x0735('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x201bbb,_0x27e9ef){var _0x5a2dd9=[];if(_0x201bbb&&_0x201bbb['length']>0x0){_0x5a2dd9=_[_0x0735('0x38')](_0x201bbb,_0x27e9ef);}return _0x5a2dd9;}function getCustomFields(_0x4b54e1,_0x2fe18c){var _0x420193=[];var _0x3baaa6={'custom_fields':[]};if(_0x4b54e1[_0x0735('0x25')]>0x0){_[_0x0735('0x39')](_0x4b54e1,function(_0x296cc2){if(_[_0x0735('0x3a')](['string',_0x0735('0x3b')],_0x296cc2['type'])&&_0x296cc2['nameField']&&!_0x296cc2['customField']){_0x3baaa6[_0x296cc2[_0x0735('0x3c')][_0x0735('0x3d')]()]=_0x296cc2[_0x0735('0x3e')]['toString']();}else if(_[_0x0735('0x3a')]([_0x0735('0x3f'),_0x0735('0x3b')],_0x296cc2[_0x0735('0x40')])&&_0x296cc2['idField']&&_0x296cc2[_0x0735('0x41')]){_0x3baaa6[_0x0735('0x42')][_0x0735('0x43')]({'id':_0x296cc2[_0x0735('0x44')],'value':_0x296cc2[_0x0735('0x3e')][_0x0735('0x32')]()});}else if(_0x296cc2[_0x0735('0x40')]===_0x0735('0x45')&&_0x296cc2['variableName']&&_0x296cc2[_0x0735('0x44')]&&_0x296cc2[_0x0735('0x41')]){_0x2fe18c[_0x296cc2[_0x0735('0x46')]]&&_0x3baaa6['custom_fields'][_0x0735('0x43')]({'id':_0x296cc2[_0x0735('0x44')],'value':_0x2fe18c[_0x296cc2[_0x0735('0x46')]][_0x0735('0x32')]()});}else if(_0x296cc2[_0x0735('0x40')]==='customVariable'&&_0x296cc2[_0x0735('0x47')]&&_0x296cc2[_0x0735('0x47')][_0x0735('0x48')]&&_0x296cc2[_0x0735('0x44')]&&_0x296cc2[_0x0735('0x41')]){_0x2fe18c[_0x296cc2[_0x0735('0x47')][_0x0735('0x48')][_0x0735('0x3d')]()]&&_0x3baaa6[_0x0735('0x42')][_0x0735('0x43')]({'id':_0x296cc2['idField'],'value':_0x2fe18c[_0x296cc2[_0x0735('0x47')]['name'][_0x0735('0x3d')]()]['toString']()});}});}return _0x3baaa6;}exports[_0x0735('0x49')]=function(_0x26ba1a,_0x44766b,_0x15f449,_0x3b4e2f,_0x1c5804,_0x207a0d){var _0x2d2d04,_0x421629;_0x207a0d[_0x0735('0xd')]=intUtil['stripTrailingSlash'](_0x207a0d['remoteUri']);_0x207a0d[_0x0735('0x4a')]=intUtil[_0x0735('0x4b')](_0x207a0d[_0x0735('0x4a')]);if(_0x1c5804&&_0x1c5804[_0x0735('0x4c')]){logger[_0x0735('0xa')](_0x0735('0x4d'),_0x0735('0x4e'));_0x44766b[_0x0735('0x4f')]=util[_0x0735('0xc')](_0x0735('0x50'),_0x207a0d[_0x0735('0x4a')],_0x44766b[_0x0735('0x51')],md5(_0x44766b[_0x0735('0x51')]));}else{_0x44766b[_0x0735('0x4f')]='';}headers['Authorization']=getAuth(_0x207a0d);return getUser(_0x207a0d,_0x3b4e2f[_0x0735('0x52')])[_0x0735('0x15')](function(_0x58d611){_0x2d2d04=_0x58d611;logger['info']('The\x20User\x20ID\x20is:',_0x2d2d04['id']);return getEndUser(_0x207a0d,_0x44766b[_0x0735('0x53')],_0x44766b['calleridnum']);})[_0x0735('0x15')](function(_0x31fb95){_0x421629=_0x31fb95;logger['info'](_0x0735('0x54'),_0x421629['id']);return getTicket(_0x207a0d,_0x2d2d04,_0x421629,_0x15f449,_0x44766b);})[_0x0735('0x15')](function(_0xe2318){if(_0xe2318){logger[_0x0735('0xa')](_0x0735('0x55'),_0xe2318['id']);switch(_0x207a0d['type']){case _0x0735('0x56'):logger['info'](_0x0735('0x4d'),_0x0735('0x57'));return request({'uri':util[_0x0735('0xc')](_0x0735('0x58'),_0x207a0d['remoteUri'],_0x2d2d04['id'],_0xe2318['id']),'method':_0x0735('0xe')});case _0x0735('0x59'):logger[_0x0735('0xa')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0735('0xc')](_0x0735('0x5a'),_0x3b4e2f[_0x0735('0x48')]),_0x0735('0x5b'),{'uri':util['format']('%s/agent/tickets/%s',_0x207a0d[_0x0735('0xd')][_0x0735('0x5c')](_0x0735('0x5d'),''),_0xe2318['id'])});break;default:logger[_0x0735('0x5e')](_0x0735('0x4d'),_0x0735('0x5f'));}}})[_0x0735('0x60')](function(_0x3d39eb){logger[_0x0735('0x5e')](_0x0735('0x61'),util[_0x0735('0x62')](_0x3d39eb,{'showHidden':!![],'depth':null}));});};exports[_0x0735('0x63')]=function(_0xe4a750,_0x465c67,_0x172b35,_0x485d79,_0x46c9c2,_0x5b7fcd,_0x57c783){var _0x4bab11,_0x42a6fd;_0x5b7fcd[_0x0735('0xd')]=intUtil[_0x0735('0x4b')](_0x5b7fcd[_0x0735('0xd')]);_0x5b7fcd[_0x0735('0x4a')]=intUtil['stripTrailingSlash'](_0x5b7fcd[_0x0735('0x4a')]);if(_0x57c783&&_0x57c783[_0x0735('0x64')]&&_0x57c783['recordingFormat']!==_0x0735('0x65')){logger[_0x0735('0xa')](_0x0735('0x66'),_0x0735('0x4e'));_0x465c67['recordingURL']=util[_0x0735('0xc')](_0x0735('0x50'),_0x5b7fcd[_0x0735('0x4a')],_0x465c67[_0x0735('0x51')],md5(_0x465c67['uniqueid']));}headers[_0x0735('0x67')]=getAuth(_0x5b7fcd);return getUser(_0x5b7fcd,_0x485d79[_0x0735('0x52')])[_0x0735('0x15')](function(_0x43e1bd){_0x4bab11=_0x43e1bd;logger[_0x0735('0xa')](_0x0735('0x68'),_0x4bab11['id']);return getEndUser(_0x5b7fcd,_0x465c67[_0x0735('0x69')],_0x465c67[_0x0735('0x6a')]);})[_0x0735('0x15')](function(_0x4009e9){_0x42a6fd=_0x4009e9;logger[_0x0735('0xa')](_0x0735('0x54'),_0x42a6fd['id']);return getTicket(_0x5b7fcd,_0x4bab11,_0x42a6fd,_0x172b35,_0x465c67);})[_0x0735('0x15')](function(_0x487d81){if(_0x487d81){logger[_0x0735('0xa')](_0x0735('0x55'),_0x487d81['id']);switch(_0x5b7fcd[_0x0735('0x40')]){case'integrationTab':logger[_0x0735('0xa')](_0x0735('0x66'),_0x0735('0x57'));return request({'uri':util[_0x0735('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5b7fcd[_0x0735('0xd')],_0x4bab11['id'],_0x487d81['id']),'method':_0x0735('0xe')});case _0x0735('0x59'):logger[_0x0735('0xa')](_0x0735('0x66'),_0x0735('0x6b'));emit(util['format'](_0x0735('0x5a'),_0x485d79[_0x0735('0x48')]),_0x0735('0x5b'),{'uri':util[_0x0735('0xc')](_0x0735('0x6c'),_0x5b7fcd[_0x0735('0xd')][_0x0735('0x5c')](_0x0735('0x5d'),''),_0x487d81['id'])});break;default:logger[_0x0735('0x5e')](_0x0735('0x66'),_0x0735('0x5f'));}}})[_0x0735('0x60')](function(_0x124ed0){logger[_0x0735('0x5e')](_0x0735('0x6d'),util[_0x0735('0x62')](_0x124ed0,{'showHidden':!![],'depth':null}));});};exports[_0x0735('0x6e')]=function(_0x5aacea,_0x419bf6,_0x4e2fa8,_0x23448a,_0x497fe4,_0x13d968){var _0x1abd1b,_0x21f200;_0x13d968[_0x0735('0xd')]=intUtil[_0x0735('0x4b')](_0x13d968[_0x0735('0xd')]);_0x13d968[_0x0735('0x4a')]=intUtil[_0x0735('0x4b')](_0x13d968[_0x0735('0x4a')]);if(_0x497fe4&&_0x497fe4[_0x0735('0x4c')]){logger[_0x0735('0xa')]('['+_0x419bf6['lastevent'][_0x0735('0x6f')]()+']',_0x0735('0x4e'));_0x419bf6[_0x0735('0x4f')]=util[_0x0735('0xc')](_0x0735('0x50'),_0x13d968[_0x0735('0x4a')],_0x419bf6[_0x0735('0x51')],md5(_0x419bf6[_0x0735('0x51')]));}else{_0x419bf6[_0x0735('0x4f')]='';}headers['Authorization']=getAuth(_0x13d968);return getUser(_0x13d968)[_0x0735('0x15')](function(_0x5eba32){_0x1abd1b=_0x5eba32;logger[_0x0735('0xa')](_0x0735('0x68'),_0x1abd1b['id']);return getEndUser(_0x13d968,_0x419bf6[_0x0735('0x53')],_0x419bf6[_0x0735('0x70')]);})['then'](function(_0x389a47){_0x21f200=_0x389a47;logger[_0x0735('0xa')](_0x0735('0x54'),_0x21f200['id']);return getTicket(_0x13d968,_0x1abd1b,_0x21f200,_0x4e2fa8,_0x419bf6);})['then'](function(_0x3ff3c9){if(_0x3ff3c9){logger[_0x0735('0xa')]('The\x20Ticket\x20ID\x20is:',_0x3ff3c9['id']);}})[_0x0735('0x60')](function(_0x54fc86){logger[_0x0735('0x5e')]('['+_0x419bf6[_0x0735('0x71')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x0735('0x62')](_0x54fc86,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
index 15cabd0..8ac8e42 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0541=['https://crm.','recordingFormat','none','destcalleridnum','Outbound','/crm/EntityInfo.do?module=Calls&id=','[OUTBOUND]','unmanaged','toUpperCase','lodash','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','debug','[HTTP]','stringify','forEach','includes','string','picklist','idField','content','toString','variable','variableName','type','Variable','name','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','expires_in','seconds','catch','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','code','SUCCESS','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Creating\x20new\x20call...','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','format','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Called','connect','Call_Result','rejected','abandoned','Abandoned','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','details','err','stack','log','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x0541,0xa2));var _0x1054=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0x0541[_0x4c4042];return _0xbd10dc;};'use strict';var _=require(_0x1054('0x0'));var rp=require(_0x1054('0x1'));var md5=require('md5');var util=require(_0x1054('0x2'));var intUtil=require(_0x1054('0x3'));var moment=require(_0x1054('0x4'));var Redis=require(_0x1054('0x5'));var BPromise=require(_0x1054('0x6'));var config=require(_0x1054('0x7'));var logger=require(_0x1054('0x8'))('zoho');config[_0x1054('0x9')]=_[_0x1054('0xa')](config[_0x1054('0x9')],{'host':_0x1054('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1054('0x9')]));function emit(_0x10f429,_0x3f9462,_0x227a09){io['to'](_0x10f429)[_0x1054('0xc')](_0x3f9462,_0x227a09);}function request(_0x3c2ff8){logger[_0x1054('0xd')](_0x1054('0xe'),JSON[_0x1054('0xf')](_0x3c2ff8));return rp(_0x3c2ff8);}function getCustomFields(_0x1a6999,_0x1edfd6){var _0x391a06={};if(_0x1a6999['length']>0x0){_[_0x1054('0x10')](_0x1a6999,function(_0x556ed0){if(_[_0x1054('0x11')]([_0x1054('0x12'),_0x1054('0x13')],_0x556ed0['type'])&&_0x556ed0[_0x1054('0x14')]){_0x391a06[_0x556ed0[_0x1054('0x14')]]=_0x556ed0[_0x1054('0x15')][_0x1054('0x16')]();}else if(_0x556ed0['type']===_0x1054('0x17')&&_0x556ed0[_0x1054('0x18')]&&_0x556ed0[_0x1054('0x14')]&&_0x1edfd6[_0x556ed0[_0x1054('0x18')]]){_0x391a06[_0x556ed0[_0x1054('0x14')]]=_0x1edfd6[_0x556ed0['variableName']]['toString']();}else if(_0x556ed0[_0x1054('0x19')]==='customVariable'&&_0x556ed0[_0x1054('0x1a')]&&_0x556ed0[_0x1054('0x1a')]['name']&&_0x556ed0[_0x1054('0x14')]&&_0x1edfd6[_0x556ed0[_0x1054('0x1a')][_0x1054('0x1b')]['toLowerCase']()]){_0x391a06[_0x556ed0[_0x1054('0x14')]]=_0x1edfd6[_0x556ed0['Variable'][_0x1054('0x1b')]['toLowerCase']()][_0x1054('0x16')]();}});}return _0x391a06;}function getName(_0x4d02ff){if(_0x4d02ff[_0x1054('0x1c')]('\x20')>0x0){var _0x33b571=_0x4d02ff[_0x1054('0x1d')](/ (.+)/);if(_0x33b571[0x1]){return _0x33b571;}}return[_0x4d02ff,_0x4d02ff];}var accountsTokens={};function getAccessToken(_0x18968d){return new Promise(function(_0xa4e6af,_0x541b8f){if(!_['isNil'](accountsTokens[_0x18968d['id']])&&!_[_0x1054('0x1e')](accountsTokens[_0x18968d['id']][_0x1054('0x1f')])){if(moment()[_0x1054('0x20')](accountsTokens[_0x18968d['id']]['expires_in'])){_0xa4e6af(accountsTokens[_0x18968d['id']][_0x1054('0x1f')]);}}var _0x18e0f0;switch(_0x18968d[_0x1054('0x21')]){case'US':_0x18e0f0=_0x1054('0x22');break;case'AU':_0x18e0f0=_0x1054('0x23');break;case'EU':_0x18e0f0='https://accounts.zoho.eu';break;case'IN':_0x18e0f0=_0x1054('0x24');break;case'CN':_0x18e0f0='https://accounts.zoho.com.cn';break;default:_0x18e0f0=_0x1054('0x25');break;}var _0x477e63={'method':_0x1054('0x26'),'uri':_0x18e0f0+_0x1054('0x27'),'qs':{'refresh_token':_0x18968d[_0x1054('0x28')],'client_id':_0x18968d[_0x1054('0x29')],'client_secret':_0x18968d[_0x1054('0x2a')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x477e63)[_0x1054('0x2b')](function(_0x53209a){accountsTokens[_0x18968d['id']]={'access_token':_0x53209a[_0x1054('0x1f')],'expires_in':moment()[_0x1054('0x2c')](_0x53209a[_0x1054('0x2d')],_0x1054('0x2e'))};_0xa4e6af(_0x53209a['access_token']);})[_0x1054('0x2f')](function(_0x5a54fb){logger['error'](_0x1054('0x30'),_0x5a54fb['stack']);_0x541b8f(_0x5a54fb);});});}function getUser(_0x539a25,_0x426cc4,_0x15bffd,_0x10e2a0){logger[_0x1054('0x31')](_0x1054('0x32'));return request({'method':_0x1054('0x33'),'uri':util['format'](_0x1054('0x34'),_0x426cc4),'qs':{'type':_0x1054('0x35')},'headers':{'Authorization':_0x1054('0x36')+_0x539a25},'json':!![]})[_0x1054('0x2b')](function(_0x2ccc16){if(_0x2ccc16['users']){var _0x229f75=-0x1;if(_[_0x1054('0x37')](_0x2ccc16[_0x1054('0x38')])){if(!_[_0x1054('0x1e')](_0x10e2a0)){_0x229f75=_[_0x1054('0x39')](_0x2ccc16[_0x1054('0x38')],function(_0x346499){return _0x346499[_0x1054('0x3a')]===_0x10e2a0;});}if(_0x229f75>=0x0){logger[_0x1054('0x31')]('Agent\x20found!');}else{logger['info'](_0x1054('0x3b'));_0x229f75=_[_0x1054('0x39')](_0x2ccc16['users'],function(_0x65c8fc){return _0x65c8fc[_0x1054('0x3c')][_0x1054('0x1b')]===_0x1054('0x3d');});}return _0x2ccc16[_0x1054('0x38')][_0x229f75];}else{if(_0x2ccc16[_0x1054('0x3e')]['profile']['name']===_0x1054('0x3d')){logger[_0x1054('0x31')](_0x1054('0x3b'));user=_0x2ccc16[_0x1054('0x3e')];return user;}else{logger[_0x1054('0x3f')](_0x1054('0x40'),JSON[_0x1054('0xf')](_0x2ccc16));throw new Error(_0x1054('0x41')+JSON[_0x1054('0xf')](_0x2ccc16));}}}else{logger[_0x1054('0x3f')]('The\x20failing\x20result\x20is',JSON[_0x1054('0xf')](_0x2ccc16));throw new Error(_0x1054('0x41')+JSON[_0x1054('0xf')](_0x2ccc16));}})[_0x1054('0x2f')](function(_0x10d11d){console[_0x1054('0x3f')](_0x10d11d);});}function getZohoUser(_0x55b63f,_0x100e8c){return new BPromise(function(_0x2a9297,_0x5c780c){request(_0x55b63f)[_0x1054('0x2b')](function(_0x28fb99){var _0x9edfd2=null;if(_0x28fb99){_0x9edfd2=_0x28fb99['data'][0x0];_0x9edfd2[_0x1054('0x42')]=_0x100e8c;}_0x2a9297(_0x9edfd2);})[_0x1054('0x2f')](function(_0x3ae8c7){_0x5c780c(_0x3ae8c7);});});}function createEndUser(_0x1c6f33,_0x8f2e9a,_0x16ca4e,_0x12cbba,_0x42b0a3,_0x261201){var _0x16ca4e=getName(_0x16ca4e);return request({'method':_0x1054('0x26'),'uri':'https://www.zohoapis.'+_0x8f2e9a+_0x1054('0x43')+_[_0x1054('0x44')](_0x261201[_0x1054('0x45')])+'s','body':{'data':[{'Last_Name':_0x16ca4e[0x1],'First_Name':_0x16ca4e[0x0],'Phone':_0x12cbba,'Owner':{'name':!_[_0x1054('0x1e')](_0x42b0a3[_0x1054('0x46')]['name'])?_0x42b0a3[_0x1054('0x46')][_0x1054('0x1b')]:!_['isNil'](_0x42b0a3[_0x1054('0x47')])?_0x42b0a3['first_name']+'\x20'+_0x42b0a3[_0x1054('0x48')]:_0x42b0a3[_0x1054('0x48')],'id':_0x42b0a3['id']}}]},'headers':{'Authorization':_0x1054('0x36')+_0x1c6f33},'json':!![]})['then'](function(_0x5ae45e){if(_0x5ae45e&&_0x5ae45e[_0x1054('0x49')][0x0][_0x1054('0x4a')]===_0x1054('0x4b')){var _0x21eb40=_0x5ae45e[_0x1054('0x49')][0x0]['details'];_0x21eb40['enduserType']=_[_0x1054('0x44')](_0x261201[_0x1054('0x45')])+'s';return _0x21eb40;}logger['error'](_0x1054('0x40'),JSON[_0x1054('0xf')](data));throw new Error('Error:\x20'+JSON[_0x1054('0xf')](data));})[_0x1054('0x2f')](function(_0x1769a9){console['log'](_0x1054('0x4c'),_0x1769a9);});}function getEndUser(_0x50f016,_0x356516,_0x56afaa,_0x1da90a,_0x4a3283,_0x16ada8,_0x57f485){var _0x47e9fa={'method':_0x1054('0x33'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x50f016},'json':!![]};switch(_0x57f485[_0x1054('0x4d')]){case _0x1054('0x4e'):_0x47e9fa[_0x1054('0x4f')]=_0x1054('0x50')+_0x356516+_0x1054('0x51')+_0x4a3283+'))';return getZohoUser(_0x47e9fa,_0x1054('0x52'))[_0x1054('0x2b')](function(_0x52aa08){if(_0x52aa08)return _0x52aa08;_0x47e9fa[_0x1054('0x4f')]=_0x1054('0x50')+_0x356516+_0x1054('0x53')+_0x4a3283+'))';return getZohoUser(_0x47e9fa,_0x1054('0x54'))[_0x1054('0x2b')](function(_0x6e8385){if(_0x6e8385)return _0x6e8385;if(_0x57f485[_0x1054('0x45')]!=_0x1054('0x55')){return createEndUser(_0x50f016,_0x356516,_0x1da90a,_0x4a3283,_0x16ada8,_0x57f485);}else{return{};}});});break;case'contact':_0x47e9fa[_0x1054('0x4f')]=_0x1054('0x50')+_0x356516+_0x1054('0x51')+_0x4a3283+'))';return getZohoUser(_0x47e9fa,_0x1054('0x52'))[_0x1054('0x2b')](function(_0xfb500c){if(_0xfb500c)return _0xfb500c;if(_0x57f485['moduleCreate']!=_0x1054('0x55')){return createEndUser(_0x50f016,_0x356516,_0x1da90a,_0x4a3283,_0x16ada8,_0x57f485);}else{return{};}});break;case'lead':_0x47e9fa[_0x1054('0x4f')]=_0x1054('0x50')+_0x356516+_0x1054('0x53')+_0x4a3283+'))';return getZohoUser(_0x47e9fa,_0x1054('0x54'))['then'](function(_0x53e07c){if(_0x53e07c)return _0x53e07c;if(_0x57f485[_0x1054('0x45')]!=_0x1054('0x55')){return createEndUser(_0x50f016,_0x356516,_0x1da90a,_0x4a3283,_0x16ada8,_0x57f485);}else{return{};}});break;}}function getCall(_0x381557,_0xdd1949,_0x32a7aa,_0x11f08a,_0x523a8a,_0x2edc2d,_0x1f755b,_0x4c3717){logger[_0x1054('0x31')](_0x1054('0x56'));var _0x156ad4={};_0x156ad4['Owner']={'name':!_['isNil'](_0x11f08a[_0x1054('0x46')][_0x1054('0x1b')])&&!_[_0x1054('0x1e')](_0x11f08a[_0x1054('0x3c')][_0x1054('0x1b')])&&_0x11f08a[_0x1054('0x3c')][_0x1054('0x1b')]==='administrator'?_0x11f08a['role']['name']:!_[_0x1054('0x1e')](_0x11f08a['first_name'])?_0x11f08a[_0x1054('0x47')]+'\x20'+_0x11f08a['last_name']:_0x11f08a['last_name'],'id':_0x11f08a['id']};_0x156ad4[_0x1054('0x57')]=intUtil[_0x1054('0x58')](_0x2edc2d[_0x1054('0x59')],_0x1f755b,'\x20');_0x156ad4[_0x1054('0x5a')]=intUtil['getString'](_0x2edc2d[_0x1054('0x5b')],_0x1f755b,'\x0a');if(_0x523a8a[_0x1054('0x42')]===_0x1054('0x52')){_0x156ad4[_0x1054('0x5c')]={'name':!_[_0x1054('0x1e')](_0x523a8a[_0x1054('0x5d')])?_0x523a8a[_0x1054('0x5d')]:!_[_0x1054('0x1e')](_0x523a8a[_0x1054('0x5e')])?_0x523a8a[_0x1054('0x5e')]+'\x20'+_0x523a8a[_0x1054('0x5f')]:_0x523a8a[_0x1054('0x5f')],'id':_0x523a8a['id']};}if(_0x523a8a[_0x1054('0x42')]===_0x1054('0x54')){_0x156ad4[_0x1054('0x60')]={'name':!_['isNil'](_0x523a8a[_0x1054('0x5d')])?_0x523a8a[_0x1054('0x5d')]:!_['isNil'](_0x523a8a['First_Name'])?_0x523a8a['First_Name']+'\x20'+_0x523a8a[_0x1054('0x5f')]:_0x523a8a['Last_Name'],'id':_0x523a8a['id']};_0x156ad4[_0x1054('0x61')]=_[_0x1054('0x44')](_0x523a8a[_0x1054('0x42')]);}if(_0x1f755b[_0x1054('0x62')]){_0x156ad4[_0x1054('0x63')]=moment['utc'](parseInt(_0x1f755b[_0x1054('0x62')])*0x3e8)[_0x1054('0x64')](_0x1054('0x65'));}else if(_0x1f755b['answertime']&&_0x1f755b[_0x1054('0x66')]){_0x156ad4['Call_Duration']=moment['utc'](moment(_0x1f755b['endtime'],_0x1054('0x67'))[_0x1054('0x68')](moment(_0x1f755b[_0x1054('0x69')],_0x1054('0x67'))))['format'](_0x1054('0x65'));}switch(_0x1f755b[_0x1054('0x6a')]){case _0x1054('0x6b'):_0x156ad4['Call_Result']=_0x1054('0x6c');break;case'complete':case _0x1054('0x6d'):_0x156ad4[_0x1054('0x6e')]='Answered';break;case _0x1054('0x6f'):_0x156ad4[_0x1054('0x6e')]='Rejected';break;case _0x1054('0x70'):_0x156ad4['Call_Result']=_0x1054('0x71');break;case'timeout':_0x156ad4[_0x1054('0x6e')]='Timeout';default:}_0x156ad4[_0x1054('0x72')]=(_0x4c3717===_0x1054('0x73')?moment(_0x1f755b[_0x1054('0x69')])[_0x1054('0x64')](_0x1054('0x67')):moment(_0x1f755b[_0x1054('0x74')])[_0x1054('0x64')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x1054('0x64')](_0x1054('0x67'));_0x156ad4[_0x1054('0x75')]=_0x4c3717||_0x1054('0x76');_0x156ad4=_['merge'](_0x156ad4,getCustomFields(_0x2edc2d[_0x1054('0x77')],_0x1f755b));return request({'method':'POST','uri':_0x1054('0x50')+_0xdd1949+_0x1054('0x78'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x381557},'body':{'data':[_0x156ad4]},'json':!![]})[_0x1054('0x2b')](function(_0x5b1783){if(_0x5b1783&&_0x5b1783[_0x1054('0x49')][0x0]['code']==='SUCCESS'){logger[_0x1054('0x31')]('Call\x20created!');return{'id':_0x5b1783['data'][0x0][_0x1054('0x79')]['id']};}})[_0x1054('0x2f')](function(_0x25caa2){logger['info'](_0x1054('0x7a'),_0x25caa2[_0x1054('0x7b')]);console[_0x1054('0x7c')](_0x1054('0x7a'),_0x25caa2);});}exports[_0x1054('0x7d')]=function(_0x4da516,_0x5222ab,_0x187dfa,_0x1d7318,_0x497847,_0x2a20e4){var _0x3743cf,_0x5c1fc4,_0x328139;_0x2a20e4['host']=intUtil[_0x1054('0x7e')](_0x2a20e4[_0x1054('0x7f')]);_0x2a20e4['serverUrl']=intUtil['stripTrailingSlash'](_0x2a20e4[_0x1054('0x80')]);if(_0x497847&&_0x497847[_0x1054('0x81')]){logger['info'](_0x1054('0x82'),_0x1054('0x83'));_0x5222ab[_0x1054('0x84')]=_0x2a20e4[_0x1054('0x80')]+_0x1054('0x85')+_0x5222ab[_0x1054('0x86')]+_0x1054('0x87')+md5(_0x5222ab['uniqueid']);}else{_0x5222ab[_0x1054('0x84')]='';}var _0x23074f=_0x2a20e4[_0x1054('0x7f')]===_0x1054('0x88')?'eu':_0x1054('0x89');return getAccessToken(_0x2a20e4)[_0x1054('0x2b')](function(_0x3bfeac){_0x328139=_0x3bfeac;return getUser(_0x328139,_0x23074f,_0x2a20e4,_0x1d7318['email']);})[_0x1054('0x2b')](function(_0x2d2398){_0x3743cf=_0x2d2398;logger[_0x1054('0x31')](_0x1054('0x8a'),_0x3743cf['id']);return getEndUser(_0x328139,_0x23074f,_0x2a20e4,_0x5222ab[_0x1054('0x8b')],_0x5222ab[_0x1054('0x8c')],_0x3743cf,_0x187dfa);})[_0x1054('0x2b')](function(_0xd03eef){_0x5c1fc4=_0xd03eef;return getCall(_0x328139,_0x23074f,_0x2a20e4,_0x3743cf,_0x5c1fc4,_0x187dfa,_0x5222ab,'Inbound');})[_0x1054('0x2b')](function(_0x16f480){if(_0x16f480){logger[_0x1054('0x31')](_0x1054('0x8d'),_0x16f480['id']);logger[_0x1054('0x31')](_0x1054('0x82'),_0x1054('0x8e'));emit(util[_0x1054('0x64')](_0x1054('0x8f'),_0x1d7318[_0x1054('0x1b')]),'trigger:browser:url',{'uri':_0x1054('0x90')+_0x2a20e4[_0x1054('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x16f480['id']});}})[_0x1054('0x2f')](function(_0x5afb4e){logger['error']('[QUEUE]',JSON[_0x1054('0xf')](_0x5afb4e));});};exports[_0x1054('0x73')]=function(_0x12898a,_0x5686ca,_0x53ab40,_0x3edd6c,_0x290e3d,_0x5becb8,_0x1cd360){var _0x13c8c7,_0x1bf036,_0xe63ec8;_0x5becb8['host']=intUtil[_0x1054('0x7e')](_0x5becb8[_0x1054('0x7f')]);_0x5becb8[_0x1054('0x80')]=intUtil[_0x1054('0x7e')](_0x5becb8[_0x1054('0x80')]);if(_0x1cd360&&_0x1cd360[_0x1054('0x91')]&&_0x1cd360[_0x1054('0x91')]!==_0x1054('0x92')){logger[_0x1054('0x31')]('[OUTBOUND]',_0x1054('0x83'));_0x5686ca[_0x1054('0x84')]=_0x5becb8[_0x1054('0x80')]+_0x1054('0x85')+_0x5686ca[_0x1054('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x5686ca[_0x1054('0x86')]);}var _0x23ef73=_0x5becb8[_0x1054('0x7f')]===_0x1054('0x88')?'eu':_0x1054('0x89');return getAccessToken(_0x5becb8)[_0x1054('0x2b')](function(_0x5774b5){_0xe63ec8=_0x5774b5;return getUser(_0xe63ec8,_0x23ef73,_0x5becb8,_0x3edd6c[_0x1054('0x3a')]);})[_0x1054('0x2b')](function(_0x38a9df){_0x13c8c7=_0x38a9df;logger[_0x1054('0x31')](_0x1054('0x8a'),_0x13c8c7['id']);return getEndUser(_0xe63ec8,_0x23ef73,_0x5becb8,_0x5686ca['destcalleridname'],_0x5686ca[_0x1054('0x93')],_0x13c8c7,_0x53ab40);})[_0x1054('0x2b')](function(_0x11ea4b){_0x1bf036=_0x11ea4b;return getCall(_0xe63ec8,_0x23ef73,_0x5becb8,_0x13c8c7,_0x1bf036,_0x53ab40,_0x5686ca,_0x1054('0x94'));})[_0x1054('0x2b')](function(_0x4ac090){if(_0x4ac090){logger[_0x1054('0x31')]('The\x20Call\x20ID\x20is:',_0x4ac090['id']);logger['info']('[OUTBOUND]',_0x1054('0x8e'));emit(util[_0x1054('0x64')](_0x1054('0x8f'),_0x3edd6c[_0x1054('0x1b')]),'trigger:browser:url',{'uri':'https://crm.'+_0x5becb8[_0x1054('0x7f')]+_0x1054('0x95')+_0x4ac090['id']});}})[_0x1054('0x2f')](function(_0xd4e1c1){logger[_0x1054('0x3f')](_0x1054('0x96'),JSON[_0x1054('0xf')](_0xd4e1c1));});};exports[_0x1054('0x97')]=function(_0x253a24,_0x157e64,_0x4bf2c1,_0x3b5ab5,_0x469713,_0x2d1d56){var _0x2e9617,_0x28a261,_0x221890;_0x2d1d56[_0x1054('0x7f')]=intUtil[_0x1054('0x7e')](_0x2d1d56[_0x1054('0x7f')]);_0x2d1d56[_0x1054('0x80')]=intUtil[_0x1054('0x7e')](_0x2d1d56[_0x1054('0x80')]);if(_0x469713&&_0x469713[_0x1054('0x81')]){logger[_0x1054('0x31')]('['+_0x157e64[_0x1054('0x6a')]['toUpperCase']()+']',_0x1054('0x83'));_0x157e64[_0x1054('0x84')]=_0x2d1d56[_0x1054('0x80')]+_0x1054('0x85')+_0x157e64['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x157e64[_0x1054('0x86')]);}else{_0x157e64['recordingURL']='';}var _0x12fd53=_0x2d1d56[_0x1054('0x7f')]==='zoho.eu'?'eu':_0x1054('0x89');return getAccessToken(_0x2d1d56)['then'](function(_0x4e5523){_0x221890=_0x4e5523;return getUser(_0x221890,_0x12fd53,_0x2d1d56);})[_0x1054('0x2b')](function(_0x494ce6){_0x2e9617=_0x494ce6;logger[_0x1054('0x31')](_0x1054('0x8a'),_0x2e9617['id']);return getEndUser(_0x221890,_0x12fd53,_0x2d1d56,_0x157e64[_0x1054('0x8b')],_0x157e64[_0x1054('0x8c')],_0x2e9617,_0x4bf2c1);})[_0x1054('0x2b')](function(_0x208203){_0x28a261=_0x208203;return getCall(_0x221890,_0x12fd53,_0x2d1d56,_0x2e9617,_0x28a261,_0x4bf2c1,_0x157e64,_0x1054('0x76'));})[_0x1054('0x2b')](function(_0x5977d3){if(_0x5977d3){logger[_0x1054('0x31')](_0x1054('0x8d'),_0x5977d3['id']);}})[_0x1054('0x2f')](function(_0x1e2107){logger['error']('['+_0x157e64['lastevent'][_0x1054('0x98')]()+']',JSON[_0x1054('0xf')](_0x1e2107));});};
\ No newline at end of file
+var _0x349a=['Leads','nothing','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','First_Name','What_Id','Full_Name','Last_Name','$se_module','talktime','Call_Duration','mm:ss','answertime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','lastevent','Called','connect','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','Call_Type','Inbound','merge','Fields','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','email','The\x20User\x20ID\x20is:','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','none','[OUTBOUND]','zoho.eu','destcalleridname','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','calleridnum','lodash','md5','util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','forEach','includes','type','idField','content','toString','variable','variableName','name','Variable','toLowerCase','indexOf','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','refreshToken','clientId','clientSecret','refresh_token','then','seconds','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','The\x20failing\x20result\x20is','catch','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','role','first_name','last_name','code','SUCCESS','details','startCase','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x349a,0xd8));var _0xa349=function(_0x1f1837,_0x4b304e){_0x1f1837=_0x1f1837-0x0;var _0x25ab57=_0x349a[_0x1f1837];return _0x25ab57;};'use strict';var _=require(_0xa349('0x0'));var rp=require('request-promise');var md5=require(_0xa349('0x1'));var util=require(_0xa349('0x2'));var intUtil=require('./util');var moment=require(_0xa349('0x3'));var Redis=require('ioredis');var BPromise=require(_0xa349('0x4'));var config=require(_0xa349('0x5'));var logger=require(_0xa349('0x6'))(_0xa349('0x7'));config[_0xa349('0x8')]=_[_0xa349('0x9')](config[_0xa349('0x8')],{'host':_0xa349('0xa'),'port':0x18eb});var io=require(_0xa349('0xb'))(new Redis(config[_0xa349('0x8')]));function emit(_0x45bb57,_0x39e1be,_0x3e389a){io['to'](_0x45bb57)[_0xa349('0xc')](_0x39e1be,_0x3e389a);}function request(_0x389ad0){logger[_0xa349('0xd')]('[HTTP]',JSON[_0xa349('0xe')](_0x389ad0));return rp(_0x389ad0);}function getCustomFields(_0x21acaf,_0x6a957f){var _0x2993ff={};if(_0x21acaf['length']>0x0){_[_0xa349('0xf')](_0x21acaf,function(_0x4080c3){if(_[_0xa349('0x10')](['string','picklist'],_0x4080c3[_0xa349('0x11')])&&_0x4080c3[_0xa349('0x12')]){_0x2993ff[_0x4080c3[_0xa349('0x12')]]=_0x4080c3[_0xa349('0x13')][_0xa349('0x14')]();}else if(_0x4080c3[_0xa349('0x11')]===_0xa349('0x15')&&_0x4080c3[_0xa349('0x16')]&&_0x4080c3[_0xa349('0x12')]&&_0x6a957f[_0x4080c3[_0xa349('0x16')]]){_0x2993ff[_0x4080c3['idField']]=_0x6a957f[_0x4080c3[_0xa349('0x16')]][_0xa349('0x14')]();}else if(_0x4080c3['type']==='customVariable'&&_0x4080c3['Variable']&&_0x4080c3['Variable'][_0xa349('0x17')]&&_0x4080c3['idField']&&_0x6a957f[_0x4080c3[_0xa349('0x18')][_0xa349('0x17')][_0xa349('0x19')]()]){_0x2993ff[_0x4080c3[_0xa349('0x12')]]=_0x6a957f[_0x4080c3[_0xa349('0x18')]['name'][_0xa349('0x19')]()]['toString']();}});}return _0x2993ff;}function getName(_0x56e3a1){if(_0x56e3a1[_0xa349('0x1a')]('\x20')>0x0){var _0x32229d=_0x56e3a1['split'](/ (.+)/);if(_0x32229d[0x1]){return _0x32229d;}}return[_0x56e3a1,_0x56e3a1];}var accountsTokens={};function getAccessToken(_0x4f5716){return new Promise(function(_0x1dce36,_0xebdfdb){if(!_[_0xa349('0x1b')](accountsTokens[_0x4f5716['id']])&&!_[_0xa349('0x1b')](accountsTokens[_0x4f5716['id']][_0xa349('0x1c')])){if(moment()['isBefore'](accountsTokens[_0x4f5716['id']][_0xa349('0x1d')])){_0x1dce36(accountsTokens[_0x4f5716['id']]['access_token']);}}var _0x28f120;switch(_0x4f5716['zone']){case'US':_0x28f120=_0xa349('0x1e');break;case'AU':_0x28f120=_0xa349('0x1f');break;case'EU':_0x28f120=_0xa349('0x20');break;case'IN':_0x28f120='https://accounts.zoho.in';break;case'CN':_0x28f120=_0xa349('0x21');break;default:_0x28f120=_0xa349('0x20');break;}var _0x390bfb={'method':'POST','uri':_0x28f120+'/oauth/v2/token','qs':{'refresh_token':_0x4f5716[_0xa349('0x22')],'client_id':_0x4f5716[_0xa349('0x23')],'client_secret':_0x4f5716[_0xa349('0x24')],'grant_type':_0xa349('0x25')},'json':!![]};return rp(_0x390bfb)[_0xa349('0x26')](function(_0x1362c4){accountsTokens[_0x4f5716['id']]={'access_token':_0x1362c4['access_token'],'expires_in':moment()['add'](_0x1362c4[_0xa349('0x1d')],_0xa349('0x27'))};_0x1dce36(_0x1362c4[_0xa349('0x1c')]);})['catch'](function(_0x49c049){logger[_0xa349('0x28')](_0xa349('0x29'),_0x49c049[_0xa349('0x2a')]);_0xebdfdb(_0x49c049);});});}function getUser(_0x39704c,_0x2e4e08,_0x92d3ca,_0x433158){logger['info'](_0xa349('0x2b'));return request({'method':_0xa349('0x2c'),'uri':util['format'](_0xa349('0x2d'),_0x2e4e08),'qs':{'type':_0xa349('0x2e')},'headers':{'Authorization':_0xa349('0x2f')+_0x39704c},'json':!![]})[_0xa349('0x26')](function(_0x5d51c9){if(_0x5d51c9[_0xa349('0x30')]){var _0x3215d1=-0x1;if(_[_0xa349('0x31')](_0x5d51c9[_0xa349('0x30')])){if(!_[_0xa349('0x1b')](_0x433158)){_0x3215d1=_[_0xa349('0x32')](_0x5d51c9[_0xa349('0x30')],function(_0xca35bc){return _0xca35bc['email']===_0x433158;});}if(_0x3215d1>=0x0){logger[_0xa349('0x33')](_0xa349('0x34'));}else{logger[_0xa349('0x33')](_0xa349('0x35'));_0x3215d1=_['findIndex'](_0x5d51c9[_0xa349('0x30')],function(_0x65ef67){return _0x65ef67[_0xa349('0x36')][_0xa349('0x17')]==='Administrator';});}return _0x5d51c9[_0xa349('0x30')][_0x3215d1];}else{if(_0x5d51c9[_0xa349('0x37')]['profile']['name']==='Administrator'){logger['info']('Using\x20the\x20admin\x20account!');user=_0x5d51c9[_0xa349('0x37')];return user;}else{logger[_0xa349('0x28')](_0xa349('0x38'),JSON[_0xa349('0xe')](_0x5d51c9));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xa349('0xe')](_0x5d51c9));}}}else{logger[_0xa349('0x28')]('The\x20failing\x20result\x20is',JSON[_0xa349('0xe')](_0x5d51c9));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xa349('0xe')](_0x5d51c9));}})[_0xa349('0x39')](function(_0x5e263a){console[_0xa349('0x28')](_0x5e263a);});}function getZohoUser(_0x508524,_0x43faa5){return new BPromise(function(_0x2491c3,_0x3c8f2b){request(_0x508524)['then'](function(_0x4b73da){var _0x25f639=null;if(_0x4b73da){_0x25f639=_0x4b73da[_0xa349('0x3a')][0x0];_0x25f639[_0xa349('0x3b')]=_0x43faa5;}_0x2491c3(_0x25f639);})['catch'](function(_0x41beac){_0x3c8f2b(_0x41beac);});});}function createEndUser(_0x594c9e,_0x5b1572,_0x5c42c0,_0x257064,_0xae901,_0xace705){var _0x5c42c0=getName(_0x5c42c0);return request({'method':_0xa349('0x3c'),'uri':_0xa349('0x3d')+_0x5b1572+_0xa349('0x3e')+_['startCase'](_0xace705['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5c42c0[0x1],'First_Name':_0x5c42c0[0x0],'Phone':_0x257064,'Owner':{'name':!_[_0xa349('0x1b')](_0xae901[_0xa349('0x3f')][_0xa349('0x17')])?_0xae901[_0xa349('0x3f')][_0xa349('0x17')]:!_[_0xa349('0x1b')](_0xae901[_0xa349('0x40')])?_0xae901[_0xa349('0x40')]+'\x20'+_0xae901['last_name']:_0xae901[_0xa349('0x41')],'id':_0xae901['id']}}]},'headers':{'Authorization':_0xa349('0x2f')+_0x594c9e},'json':!![]})[_0xa349('0x26')](function(_0x5ee5a8){if(_0x5ee5a8&&_0x5ee5a8[_0xa349('0x3a')][0x0][_0xa349('0x42')]===_0xa349('0x43')){var _0x553393=_0x5ee5a8[_0xa349('0x3a')][0x0][_0xa349('0x44')];_0x553393[_0xa349('0x3b')]=_[_0xa349('0x45')](_0xace705[_0xa349('0x46')])+'s';return _0x553393;}logger['error'](_0xa349('0x38'),JSON[_0xa349('0xe')](data));throw new Error(_0xa349('0x47')+JSON[_0xa349('0xe')](data));})[_0xa349('0x39')](function(_0x2cd74c){console[_0xa349('0x48')](_0xa349('0x49'),_0x2cd74c);});}function getEndUser(_0x4da885,_0x538546,_0x2b7aaf,_0x2a3346,_0x2d4c1c,_0x5424d4,_0x38880a){var _0x2c56fd={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4da885},'json':!![]};switch(_0x38880a[_0xa349('0x4a')]){case _0xa349('0x4b'):_0x2c56fd['uri']=_0xa349('0x3d')+_0x538546+_0xa349('0x4c')+_0x2d4c1c+'))';return getZohoUser(_0x2c56fd,_0xa349('0x4d'))[_0xa349('0x26')](function(_0x3c2af2){if(_0x3c2af2)return _0x3c2af2;_0x2c56fd[_0xa349('0x4e')]=_0xa349('0x3d')+_0x538546+_0xa349('0x4f')+_0x2d4c1c+'))';return getZohoUser(_0x2c56fd,_0xa349('0x50'))[_0xa349('0x26')](function(_0x14fc81){if(_0x14fc81)return _0x14fc81;if(_0x38880a['moduleCreate']!=_0xa349('0x51')){return createEndUser(_0x4da885,_0x538546,_0x2a3346,_0x2d4c1c,_0x5424d4,_0x38880a);}else{return{};}});});break;case'contact':_0x2c56fd['uri']=_0xa349('0x3d')+_0x538546+_0xa349('0x4c')+_0x2d4c1c+'))';return getZohoUser(_0x2c56fd,_0xa349('0x4d'))[_0xa349('0x26')](function(_0x1062d8){if(_0x1062d8)return _0x1062d8;if(_0x38880a['moduleCreate']!=_0xa349('0x51')){return createEndUser(_0x4da885,_0x538546,_0x2a3346,_0x2d4c1c,_0x5424d4,_0x38880a);}else{return{};}});break;case'lead':_0x2c56fd[_0xa349('0x4e')]=_0xa349('0x3d')+_0x538546+_0xa349('0x4f')+_0x2d4c1c+'))';return getZohoUser(_0x2c56fd,_0xa349('0x50'))['then'](function(_0xe73b69){if(_0xe73b69)return _0xe73b69;if(_0x38880a[_0xa349('0x46')]!=_0xa349('0x51')){return createEndUser(_0x4da885,_0x538546,_0x2a3346,_0x2d4c1c,_0x5424d4,_0x38880a);}else{return{};}});break;}}function getCall(_0x516882,_0x5462f6,_0x3d8638,_0x553ec7,_0x30b2ac,_0x3e3734,_0x5b6e42,_0x5e303d){logger[_0xa349('0x33')](_0xa349('0x52'));var _0x455b4a={};_0x455b4a[_0xa349('0x53')]={'name':!_['isNil'](_0x553ec7[_0xa349('0x3f')]['name'])&&!_['isNil'](_0x553ec7['profile'][_0xa349('0x17')])&&_0x553ec7[_0xa349('0x36')][_0xa349('0x17')]===_0xa349('0x54')?_0x553ec7[_0xa349('0x3f')]['name']:!_[_0xa349('0x1b')](_0x553ec7[_0xa349('0x40')])?_0x553ec7[_0xa349('0x40')]+'\x20'+_0x553ec7['last_name']:_0x553ec7[_0xa349('0x41')],'id':_0x553ec7['id']};_0x455b4a[_0xa349('0x55')]=intUtil[_0xa349('0x56')](_0x3e3734[_0xa349('0x57')],_0x5b6e42,'\x20');_0x455b4a[_0xa349('0x58')]=intUtil['getString'](_0x3e3734['Descriptions'],_0x5b6e42,'\x0a');if(_0x30b2ac['enduserType']===_0xa349('0x4d')){_0x455b4a['Who_Id']={'name':!_[_0xa349('0x1b')](_0x30b2ac['Full_Name'])?_0x30b2ac['Full_Name']:!_[_0xa349('0x1b')](_0x30b2ac[_0xa349('0x59')])?_0x30b2ac[_0xa349('0x59')]+'\x20'+_0x30b2ac['Last_Name']:_0x30b2ac['Last_Name'],'id':_0x30b2ac['id']};}if(_0x30b2ac[_0xa349('0x3b')]===_0xa349('0x50')){_0x455b4a[_0xa349('0x5a')]={'name':!_[_0xa349('0x1b')](_0x30b2ac['Full_Name'])?_0x30b2ac[_0xa349('0x5b')]:!_[_0xa349('0x1b')](_0x30b2ac[_0xa349('0x59')])?_0x30b2ac[_0xa349('0x59')]+'\x20'+_0x30b2ac[_0xa349('0x5c')]:_0x30b2ac[_0xa349('0x5c')],'id':_0x30b2ac['id']};_0x455b4a[_0xa349('0x5d')]=_[_0xa349('0x45')](_0x30b2ac['enduserType']);}if(_0x5b6e42[_0xa349('0x5e')]){_0x455b4a[_0xa349('0x5f')]=moment['utc'](parseInt(_0x5b6e42[_0xa349('0x5e')])*0x3e8)['format'](_0xa349('0x60'));}else if(_0x5b6e42[_0xa349('0x61')]&&_0x5b6e42['endtime']){_0x455b4a['Call_Duration']=moment[_0xa349('0x62')](moment(_0x5b6e42['endtime'],_0xa349('0x63'))[_0xa349('0x64')](moment(_0x5b6e42[_0xa349('0x65')],_0xa349('0x63'))))[_0xa349('0x66')](_0xa349('0x60'));}switch(_0x5b6e42[_0xa349('0x67')]){case'called':_0x455b4a['Call_Result']=_0xa349('0x68');break;case'complete':case _0xa349('0x69'):_0x455b4a[_0xa349('0x6a')]=_0xa349('0x6b');break;case _0xa349('0x6c'):_0x455b4a['Call_Result']=_0xa349('0x6d');break;case _0xa349('0x6e'):_0x455b4a['Call_Result']=_0xa349('0x6f');break;case _0xa349('0x70'):_0x455b4a[_0xa349('0x6a')]=_0xa349('0x71');default:}_0x455b4a['Call_Start_Time']=(_0x5e303d===_0xa349('0x72')?moment(_0x5b6e42[_0xa349('0x65')])[_0xa349('0x66')](_0xa349('0x63')):moment(_0x5b6e42['agentcalledAt'])[_0xa349('0x66')](_0xa349('0x63')))||moment()[_0xa349('0x66')](_0xa349('0x63'));_0x455b4a[_0xa349('0x73')]=_0x5e303d||_0xa349('0x74');_0x455b4a=_[_0xa349('0x75')](_0x455b4a,getCustomFields(_0x3e3734[_0xa349('0x76')],_0x5b6e42));return request({'method':'POST','uri':_0xa349('0x3d')+_0x5462f6+'/crm/v2/Calls','headers':{'Authorization':_0xa349('0x2f')+_0x516882},'body':{'data':[_0x455b4a]},'json':!![]})['then'](function(_0x46cfc7){if(_0x46cfc7&&_0x46cfc7[_0xa349('0x3a')][0x0][_0xa349('0x42')]===_0xa349('0x43')){logger[_0xa349('0x33')](_0xa349('0x77'));return{'id':_0x46cfc7[_0xa349('0x3a')][0x0]['details']['id']};}})['catch'](function(_0x59e056){logger[_0xa349('0x33')](_0xa349('0x78'),_0x59e056[_0xa349('0x2a')]);console['log'](_0xa349('0x78'),_0x59e056);});}exports['queue']=function(_0x5932a5,_0x47db0f,_0x1366dc,_0x2ebd6b,_0x24080e,_0xb8be82){var _0x547850,_0x33c1ae,_0x9c38f0;_0xb8be82[_0xa349('0x79')]=intUtil[_0xa349('0x7a')](_0xb8be82[_0xa349('0x79')]);_0xb8be82[_0xa349('0x7b')]=intUtil[_0xa349('0x7a')](_0xb8be82[_0xa349('0x7b')]);if(_0x24080e&&_0x24080e[_0xa349('0x7c')]){logger[_0xa349('0x33')](_0xa349('0x7d'),_0xa349('0x7e'));_0x47db0f[_0xa349('0x7f')]=_0xb8be82['serverUrl']+_0xa349('0x80')+_0x47db0f[_0xa349('0x81')]+_0xa349('0x82')+md5(_0x47db0f[_0xa349('0x81')]);}else{_0x47db0f[_0xa349('0x7f')]='';}var _0x4e8454=_0xb8be82[_0xa349('0x79')]==='zoho.eu'?'eu':_0xa349('0x83');return getAccessToken(_0xb8be82)['then'](function(_0x2ceba6){_0x9c38f0=_0x2ceba6;return getUser(_0x9c38f0,_0x4e8454,_0xb8be82,_0x2ebd6b[_0xa349('0x84')]);})[_0xa349('0x26')](function(_0x79cbea){_0x547850=_0x79cbea;logger[_0xa349('0x33')](_0xa349('0x85'),_0x547850['id']);return getEndUser(_0x9c38f0,_0x4e8454,_0xb8be82,_0x47db0f['calleridname'],_0x47db0f['calleridnum'],_0x547850,_0x1366dc);})[_0xa349('0x26')](function(_0x362827){_0x33c1ae=_0x362827;return getCall(_0x9c38f0,_0x4e8454,_0xb8be82,_0x547850,_0x33c1ae,_0x1366dc,_0x47db0f,_0xa349('0x74'));})['then'](function(_0x4eeadb){if(_0x4eeadb){logger[_0xa349('0x33')](_0xa349('0x86'),_0x4eeadb['id']);logger[_0xa349('0x33')](_0xa349('0x7d'),_0xa349('0x87'));emit(util[_0xa349('0x66')](_0xa349('0x88'),_0x2ebd6b[_0xa349('0x17')]),_0xa349('0x89'),{'uri':'https://crm.'+_0xb8be82[_0xa349('0x79')]+'/crm/EntityInfo.do?module=Calls&id='+_0x4eeadb['id']});}})[_0xa349('0x39')](function(_0x4bf7a9){logger['error'](_0xa349('0x7d'),JSON['stringify'](_0x4bf7a9));});};exports[_0xa349('0x72')]=function(_0x5dcae2,_0x323343,_0x579b07,_0x315259,_0x2cac0b,_0x52f7ce,_0x43ab6e){var _0x4aaa32,_0x3e6807,_0x3f1e16;_0x52f7ce['host']=intUtil[_0xa349('0x7a')](_0x52f7ce[_0xa349('0x79')]);_0x52f7ce[_0xa349('0x7b')]=intUtil[_0xa349('0x7a')](_0x52f7ce[_0xa349('0x7b')]);if(_0x43ab6e&&_0x43ab6e[_0xa349('0x8a')]&&_0x43ab6e[_0xa349('0x8a')]!==_0xa349('0x8b')){logger[_0xa349('0x33')](_0xa349('0x8c'),_0xa349('0x7e'));_0x323343['recordingURL']=_0x52f7ce[_0xa349('0x7b')]+'/api/voice/recordings/'+_0x323343[_0xa349('0x81')]+'/downloads?type=uniqueid&token='+md5(_0x323343[_0xa349('0x81')]);}var _0x414a2e=_0x52f7ce[_0xa349('0x79')]===_0xa349('0x8d')?'eu':'com';return getAccessToken(_0x52f7ce)[_0xa349('0x26')](function(_0x2eb265){_0x3f1e16=_0x2eb265;return getUser(_0x3f1e16,_0x414a2e,_0x52f7ce,_0x315259['email']);})['then'](function(_0x5241ba){_0x4aaa32=_0x5241ba;logger[_0xa349('0x33')](_0xa349('0x85'),_0x4aaa32['id']);return getEndUser(_0x3f1e16,_0x414a2e,_0x52f7ce,_0x323343[_0xa349('0x8e')],_0x323343['destcalleridnum'],_0x4aaa32,_0x579b07);})[_0xa349('0x26')](function(_0x3bd657){_0x3e6807=_0x3bd657;return getCall(_0x3f1e16,_0x414a2e,_0x52f7ce,_0x4aaa32,_0x3e6807,_0x579b07,_0x323343,'Outbound');})[_0xa349('0x26')](function(_0x291d0b){if(_0x291d0b){logger[_0xa349('0x33')](_0xa349('0x86'),_0x291d0b['id']);logger['info']('[OUTBOUND]',_0xa349('0x87'));emit(util['format'](_0xa349('0x88'),_0x315259[_0xa349('0x17')]),'trigger:browser:url',{'uri':_0xa349('0x8f')+_0x52f7ce[_0xa349('0x79')]+_0xa349('0x90')+_0x291d0b['id']});}})[_0xa349('0x39')](function(_0x3bea85){logger[_0xa349('0x28')](_0xa349('0x8c'),JSON[_0xa349('0xe')](_0x3bea85));});};exports[_0xa349('0x91')]=function(_0x5f024d,_0x1a6a81,_0x123fc8,_0x209ee3,_0x43ed42,_0x1e7fa1){var _0x190ab5,_0x11cca0,_0x2bd704;_0x1e7fa1['host']=intUtil[_0xa349('0x7a')](_0x1e7fa1[_0xa349('0x79')]);_0x1e7fa1[_0xa349('0x7b')]=intUtil[_0xa349('0x7a')](_0x1e7fa1['serverUrl']);if(_0x43ed42&&_0x43ed42[_0xa349('0x7c')]){logger['info']('['+_0x1a6a81[_0xa349('0x67')][_0xa349('0x92')]()+']',_0xa349('0x7e'));_0x1a6a81[_0xa349('0x7f')]=_0x1e7fa1['serverUrl']+_0xa349('0x80')+_0x1a6a81[_0xa349('0x81')]+_0xa349('0x82')+md5(_0x1a6a81[_0xa349('0x81')]);}else{_0x1a6a81[_0xa349('0x7f')]='';}var _0x5483e9=_0x1e7fa1[_0xa349('0x79')]===_0xa349('0x8d')?'eu':_0xa349('0x83');return getAccessToken(_0x1e7fa1)['then'](function(_0x613ed){_0x2bd704=_0x613ed;return getUser(_0x2bd704,_0x5483e9,_0x1e7fa1);})['then'](function(_0x284270){_0x190ab5=_0x284270;logger[_0xa349('0x33')](_0xa349('0x85'),_0x190ab5['id']);return getEndUser(_0x2bd704,_0x5483e9,_0x1e7fa1,_0x1a6a81['calleridname'],_0x1a6a81[_0xa349('0x93')],_0x190ab5,_0x123fc8);})['then'](function(_0x5eb3f6){_0x11cca0=_0x5eb3f6;return getCall(_0x2bd704,_0x5483e9,_0x1e7fa1,_0x190ab5,_0x11cca0,_0x123fc8,_0x1a6a81,'Inbound');})['then'](function(_0x1e3015){if(_0x1e3015){logger[_0xa349('0x33')](_0xa349('0x86'),_0x1e3015['id']);}})[_0xa349('0x39')](function(_0x4cfec2){logger[_0xa349('0x28')]('['+_0x1a6a81[_0xa349('0x67')][_0xa349('0x92')]()+']',JSON[_0xa349('0xe')](_0x4cfec2));});};
\ No newline at end of file
index ac09c1c..633ba88 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa960=['mustache','../../../../config/logger','trigger','exec','data2','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa960,0x15b));var _0x0a96=function(_0x7831,_0x232c46){_0x7831=_0x7831-0x0;var _0x3bf910=_0xa960[_0x7831];return _0x3bf910;};'use strict';var util=require('util');var sh=require(_0x0a96('0x0'));var Mustache=require(_0x0a96('0x1'));var logger=require(_0x0a96('0x2'))(_0x0a96('0x3'));exports[_0x0a96('0x4')]=function(_0x188a39,_0x4540e5){var _0x3e7b2f=_0x188a39['data2']?_0x188a39[_0x0a96('0x5')]:'Script';var _0x41a2f0=_0x188a39[_0x0a96('0x6')]?Mustache['render'](_0x188a39['data3'],_0x4540e5):_0x4540e5;sh[_0x0a96('0x4')](_0x41a2f0,function(_0x3e93bc,_0x581c87,_0xfd2c87){if(_0x3e93bc!==0x0){logger[_0x0a96('0x7')](util[_0x0a96('0x8')](_0x0a96('0x9'),_0x3e7b2f,_0x41a2f0,_0x3e93bc,_0xfd2c87));}else{logger[_0x0a96('0xa')](util[_0x0a96('0x8')](_0x0a96('0xb'),_0x3e7b2f,_0x41a2f0,_0x581c87));}});};
\ No newline at end of file
+var _0xa43d=['Script','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2'];(function(_0x5dfb47,_0x5b158c){var _0x48c85a=function(_0x5d9ccf){while(--_0x5d9ccf){_0x5dfb47['push'](_0x5dfb47['shift']());}};_0x48c85a(++_0x5b158c);}(_0xa43d,0x7e));var _0xda43=function(_0x1fef34,_0x457d7f){_0x1fef34=_0x1fef34-0x0;var _0x11063b=_0xa43d[_0x1fef34];return _0x11063b;};'use strict';var util=require(_0xda43('0x0'));var sh=require(_0xda43('0x1'));var Mustache=require(_0xda43('0x2'));var logger=require(_0xda43('0x3'))('trigger');exports[_0xda43('0x4')]=function(_0x3cf461,_0x1ebebf){var _0x318b5f=_0x3cf461[_0xda43('0x5')]?_0x3cf461['data2']:_0xda43('0x6');var _0x7f3804=_0x3cf461[_0xda43('0x7')]?Mustache['render'](_0x3cf461['data3'],_0x1ebebf):_0x1ebebf;sh['exec'](_0x7f3804,function(_0x20fe3d,_0x398be1,_0x3d64d9){if(_0x20fe3d!==0x0){logger[_0xda43('0x8')](util['format'](_0xda43('0x9'),_0x318b5f,_0x7f3804,_0x20fe3d,_0x3d64d9));}else{logger['info'](util['format'](_0xda43('0xa'),_0x318b5f,_0x7f3804,_0x398be1));}});};
\ No newline at end of file
index 4863e7d..a7ae16c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x902d=['statusCode','catch','name','message','request-promise','util','mustache','trigger','data1','render','data5','headers','parse','error','stack','toUpperCase','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s'];(function(_0x169f9b,_0x50ef4e){var _0x574c74=function(_0x4aeb48){while(--_0x4aeb48){_0x169f9b['push'](_0x169f9b['shift']());}};_0x574c74(++_0x50ef4e);}(_0x902d,0xa4));var _0xd902=function(_0x1bf429,_0x4ff2ba){_0x1bf429=_0x1bf429-0x0;var _0x2437e8=_0x902d[_0x1bf429];return _0x2437e8;};'use strict';var rp=require(_0xd902('0x0'));var util=require(_0xd902('0x1'));var _=require('lodash');var Mustache=require(_0xd902('0x2'));var logger=require('../../../../config/logger')(_0xd902('0x3'));exports['exec']=function(_0x2e065f,_0x460b4b){var _0x51f843,_0x38b396;var _0x42692b={'method':_0x2e065f[_0xd902('0x4')]['toUpperCase'](),'uri':Mustache[_0xd902('0x5')](_0x2e065f['data2'],_0x460b4b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2e065f['data5'])==='number'&&parseInt(_0x2e065f[_0xd902('0x6')])>=0x1&&parseInt(_0x2e065f[_0xd902('0x6')])<=0xa?parseInt(_0x2e065f[_0xd902('0x6')])*0x3e8:0x5*0x3e8};try{_0x42692b[_0xd902('0x7')]=_0x2e065f['data6']?JSON[_0xd902('0x8')](Mustache[_0xd902('0x5')](_0x2e065f['data6'],_0x460b4b)):{};}catch(_0x50831e){logger[_0xd902('0x9')](_0x50831e[_0xd902('0xa')]);}switch(_0x2e065f[_0xd902('0x4')][_0xd902('0xb')]()){case'GET':case _0xd902('0xc'):_0x51f843=null;_0x42692b['qs']=_0x460b4b;break;case _0xd902('0xd'):case _0xd902('0xe'):if(_0x2e065f[_0xd902('0xf')]){try{_0x51f843=JSON[_0xd902('0x8')](Mustache[_0xd902('0x5')](_0x2e065f[_0xd902('0xf')],_0x460b4b));_0x42692b[_0xd902('0x10')]=_0x51f843;}catch(_0x3a8a33){logger[_0xd902('0x9')](_0x3a8a33['stack']);logger['error'](_0xd902('0x11'));}}else{_0x51f843=_0x460b4b;_0x42692b[_0xd902('0x10')]=_0x51f843;}break;}logger[_0xd902('0x12')](util[_0xd902('0x13')](_0xd902('0x14'),_0x2e065f[_0xd902('0x4')],_0x2e065f[_0xd902('0x15')],JSON[_0xd902('0x16')](_0x42692b)));rp(_0x42692b)[_0xd902('0x17')](function(_0x8240d){_0x51f843=!_[_0xd902('0x18')](_0x51f843)?_0xd902('0x19')+_0x51f843:'';_0x38b396=typeof _0x8240d['body']===_0xd902('0x1a')?JSON[_0xd902('0x16')](_0x8240d[_0xd902('0x10')]):_0x8240d[_0xd902('0x10')];logger[_0xd902('0x12')](util[_0xd902('0x13')](_0xd902('0x1b'),_0x2e065f[_0xd902('0x4')],_0x2e065f[_0xd902('0x15')],_0x8240d[_0xd902('0x1c')],_0x38b396));})[_0xd902('0x1d')](function(_0x1a92dc){logger['error'](util[_0xd902('0x13')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x2e065f[_0xd902('0x4')],_0x2e065f['data2'],_0x1a92dc[_0xd902('0x1c')],_0x1a92dc[_0xd902('0x1e')],_0x1a92dc[_0xd902('0x1f')]));});};
\ No newline at end of file
+var _0x6781=['trigger','exec','data1','toUpperCase','data2','data5','number','parse','render','data6','error','stack','GET','POST','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','body','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','statusCode','name','util','lodash','mustache','../../../../config/logger'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0x6781,0x146));var _0x1678=function(_0xc6276e,_0x2001a8){_0xc6276e=_0xc6276e-0x0;var _0x4aa0b3=_0x6781[_0xc6276e];return _0x4aa0b3;};'use strict';var rp=require('request-promise');var util=require(_0x1678('0x0'));var _=require(_0x1678('0x1'));var Mustache=require(_0x1678('0x2'));var logger=require(_0x1678('0x3'))(_0x1678('0x4'));exports[_0x1678('0x5')]=function(_0x8971f8,_0x28f623){var _0x418407,_0x57c12e;var _0x17ec68={'method':_0x8971f8[_0x1678('0x6')][_0x1678('0x7')](),'uri':Mustache['render'](_0x8971f8[_0x1678('0x8')],_0x28f623),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x8971f8[_0x1678('0x9')])===_0x1678('0xa')&&parseInt(_0x8971f8[_0x1678('0x9')])>=0x1&&parseInt(_0x8971f8['data5'])<=0xa?parseInt(_0x8971f8[_0x1678('0x9')])*0x3e8:0x5*0x3e8};try{_0x17ec68['headers']=_0x8971f8['data6']?JSON[_0x1678('0xb')](Mustache[_0x1678('0xc')](_0x8971f8[_0x1678('0xd')],_0x28f623)):{};}catch(_0x120e9c){logger[_0x1678('0xe')](_0x120e9c[_0x1678('0xf')]);}switch(_0x8971f8[_0x1678('0x6')]['toUpperCase']()){case _0x1678('0x10'):case'DELETE':_0x418407=null;_0x17ec68['qs']=_0x28f623;break;case _0x1678('0x11'):case'PUT':if(_0x8971f8[_0x1678('0x12')]){try{_0x418407=JSON[_0x1678('0xb')](Mustache[_0x1678('0xc')](_0x8971f8[_0x1678('0x12')],_0x28f623));_0x17ec68['body']=_0x418407;}catch(_0x491d85){logger[_0x1678('0xe')](_0x491d85[_0x1678('0xf')]);logger[_0x1678('0xe')](_0x1678('0x13'));}}else{_0x418407=_0x28f623;_0x17ec68['body']=_0x418407;}break;}logger[_0x1678('0x14')](util[_0x1678('0x15')](_0x1678('0x16'),_0x8971f8['data1'],_0x8971f8[_0x1678('0x8')],JSON[_0x1678('0x17')](_0x17ec68)));rp(_0x17ec68)[_0x1678('0x18')](function(_0x414ba3){_0x418407=!_[_0x1678('0x19')](_0x418407)?_0x1678('0x1a')+_0x418407:'';_0x57c12e=typeof _0x414ba3[_0x1678('0x1b')]===_0x1678('0x1c')?JSON[_0x1678('0x17')](_0x414ba3[_0x1678('0x1b')]):_0x414ba3['body'];logger[_0x1678('0x14')](util[_0x1678('0x15')](_0x1678('0x1d'),_0x8971f8[_0x1678('0x6')],_0x8971f8['data2'],_0x414ba3['statusCode'],_0x57c12e));})[_0x1678('0x1e')](function(_0x2b225d){logger[_0x1678('0xe')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x8971f8[_0x1678('0x6')],_0x8971f8[_0x1678('0x8')],_0x2b225d[_0x1678('0x1f')],_0x2b225d[_0x1678('0x20')],_0x2b225d['message']));});};
\ No newline at end of file
index 39867f2..82b9d6e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7145=['message','catch','exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','request','then','rpc','error'];(function(_0x4d064e,_0x2a3668){var _0x5505d2=function(_0x2d6c58){while(--_0x2d6c58){_0x4d064e['push'](_0x4d064e['shift']());}};_0x5505d2(++_0x2a3668);}(_0x7145,0xd3));var _0x5714=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7145[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x5714('0x0'));var BPromise=require(_0x5714('0x1'));var logger=require(_0x5714('0x2'))(_0x5714('0x3'));var client=jayson['client'][_0x5714('0x4')]({'port':0x2329});client[_0x5714('0x5')]=function(_0x13a6b2,_0x1a5228){return new BPromise(function(_0x40918a,_0x29807a){return client[_0x5714('0x6')](_0x13a6b2,_0x1a5228)[_0x5714('0x7')](function(_0x554b6f){logger['debug'](_0x5714('0x8'),_0x5714('0x3'),_0x13a6b2,_0x1a5228,_0x554b6f);if(_0x554b6f[_0x5714('0x9')]){logger['error'](_0x5714('0x8'),'routing',_0x13a6b2,_0x554b6f[_0x5714('0x9')][_0x5714('0xa')],_0x1a5228);return _0x29807a(_0x554b6f[_0x5714('0x9')][_0x5714('0xa')]);}else{return _0x40918a(_0x554b6f['result']);}})[_0x5714('0xb')](function(_0x1f89f8){logger[_0x5714('0x9')](_0x5714('0x8'),_0x5714('0x3'),_0x13a6b2,_0x1f89f8,_0x1a5228);return _0x29807a(_0x1f89f8);});});};module[_0x5714('0xc')]=client;
\ No newline at end of file
+var _0x51c9=['routing','error','message','result','catch','jayson/promise','bluebird','../../config/logger','client','Request','request','then','debug','rpc'];(function(_0x3723db,_0x34c162){var _0x3727ca=function(_0x29ee4c){while(--_0x29ee4c){_0x3723db['push'](_0x3723db['shift']());}};_0x3727ca(++_0x34c162);}(_0x51c9,0x17f));var _0x951c=function(_0x1ab71e,_0x5bfcfc){_0x1ab71e=_0x1ab71e-0x0;var _0x18458b=_0x51c9[_0x1ab71e];return _0x18458b;};'use strict';var jayson=require(_0x951c('0x0'));var BPromise=require(_0x951c('0x1'));var logger=require(_0x951c('0x2'))('routing');var client=jayson[_0x951c('0x3')]['http']({'port':0x2329});client[_0x951c('0x4')]=function(_0x2971f1,_0x4f8667){return new BPromise(function(_0x2be7e1,_0x152656){return client[_0x951c('0x5')](_0x2971f1,_0x4f8667)[_0x951c('0x6')](function(_0xc0a71){logger[_0x951c('0x7')](_0x951c('0x8'),_0x951c('0x9'),_0x2971f1,_0x4f8667,_0xc0a71);if(_0xc0a71['error']){logger[_0x951c('0xa')](_0x951c('0x8'),_0x951c('0x9'),_0x2971f1,_0xc0a71[_0x951c('0xa')][_0x951c('0xb')],_0x4f8667);return _0x152656(_0xc0a71[_0x951c('0xa')]['message']);}else{return _0x2be7e1(_0xc0a71[_0x951c('0xc')]);}})[_0x951c('0xd')](function(_0x4e6543){logger[_0x951c('0xa')](_0x951c('0x8'),_0x951c('0x9'),_0x2971f1,_0x4e6543,_0x4f8667);return _0x152656(_0x4e6543);});});};module['exports']=client;
\ No newline at end of file
index 0d804ea..8c2130e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34fe=['email','resolve','then','getMailAccounts','initMailAccounts','refresh','listen','getSettings','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x9b88d2,_0x4e2b16){var _0x2d1083=function(_0x56c9fc){while(--_0x56c9fc){_0x9b88d2['push'](_0x9b88d2['shift']());}};_0x2d1083(++_0x4e2b16);}(_0x34fe,0xf8));var _0xe34f=function(_0x1e6664,_0x1a40d9){_0x1e6664=_0x1e6664-0x0;var _0x2c15cf=_0x34fe[_0x1e6664];return _0x2c15cf;};'use strict';var server=require(_0xe34f('0x0'));var Realtime=require(_0xe34f('0x1'));var EmailChannel=require(_0xe34f('0x2'));var mailAccount=require(_0xe34f('0x3'));var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0xe34f('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xe34f('0x5')]()[_0xe34f('0x6')](mailAccount[_0xe34f('0x7')]())[_0xe34f('0x6')](realtime[_0xe34f('0x8')]())[_0xe34f('0x6')](function(){email[_0xe34f('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xe34f('0xa')](realtime,email)[_0xe34f('0x6')](function(){return initRealtime();})[_0xe34f('0x6')](function(){return setting[_0xe34f('0xb')]();})[_0xe34f('0x6')](function(_0x4878f7){return setInterval(initRealtime,_0x4878f7['loginMailFrequency']*0x3e8);})['catch'](function(_0x1fb170){logger[_0xe34f('0xc')](_0xe34f('0xd'),_0x1fb170);});}main();
\ No newline at end of file
+var _0x61ee=['mailAccounts','listen','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve','then','initMailAccounts'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x61ee,0x155));var _0xe61e=function(_0x43576f,_0x1356ed){_0x43576f=_0x43576f-0x0;var _0x4d2466=_0x61ee[_0x43576f];return _0x4d2466;};'use strict';var server=require(_0xe61e('0x0'));var Realtime=require(_0xe61e('0x1'));var EmailChannel=require(_0xe61e('0x2'));var mailAccount=require(_0xe61e('0x3'));var setting=require(_0xe61e('0x4'));var logger=require('../../config/logger')(_0xe61e('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xe61e('0x6')]()[_0xe61e('0x7')](mailAccount['getMailAccounts']())['then'](realtime[_0xe61e('0x8')]())['then'](function(){email['refresh'](realtime[_0xe61e('0x9')]);return realtime;});}function main(){return server[_0xe61e('0xa')](realtime,email)[_0xe61e('0x7')](function(){return initRealtime();})[_0xe61e('0x7')](function(){return setting['getSettings']();})[_0xe61e('0x7')](function(_0x871a38){return setInterval(initRealtime,_0x871a38[_0xe61e('0xb')]*0x3e8);})[_0xe61e('0xc')](function(_0x430427){logger['error'](_0xe61e('0xd'),_0x430427);});}main();
\ No newline at end of file
index 344092b..7743915 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x01b6=['name','active','Imap','total','isNil','stringify','mailAccount:update','hasOwnProperty','service','provider','handleImapEmail','bind','end','error','handleImapError','disabled','messageStatus','status','connected','messages','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','catch','exports','lodash','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit'];(function(_0x2a9202,_0x5e68cb){var _0x316625=function(_0x4ae297){while(--_0x4ae297){_0x2a9202['push'](_0x2a9202['shift']());}};_0x316625(++_0x5e68cb);}(_0x01b6,0x8d));var _0x601b=function(_0x4d6298,_0x502f6b){_0x4d6298=_0x4d6298-0x0;var _0x57ccf0=_0x01b6[_0x4d6298];return _0x57ccf0;};'use strict';var _=require(_0x601b('0x0'));var moment=require('moment');var BPromise=require(_0x601b('0x1'));var md5=require(_0x601b('0x2'));var Redis=require(_0x601b('0x3'));var config=require(_0x601b('0x4'));var logger=require('../../../config/logger')(_0x601b('0x5'));config[_0x601b('0x6')]=_[_0x601b('0x7')](config[_0x601b('0x6')],{'host':_0x601b('0x8'),'port':0x18eb});var io=require(_0x601b('0x9'))(new Redis(config[_0x601b('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x601b('0xa'));var mailAccount=require(_0x601b('0xb'));var md5Accounts={};function EmailChannel(_0x556f07){logger[_0x601b('0xc')]('start\x20email\x20channel');this['mailAccounts']=_0x556f07[_0x601b('0xd')];this[_0x601b('0xe')]={};this[_0x601b('0xf')]=new EmailSmtp();}EmailChannel[_0x601b('0x10')][_0x601b('0x11')]=function(_0x5b19ad){var _0x4cacb4=this[_0x601b('0xd')][_0x5b19ad];var _0x11a46e={'id':_0x4cacb4['id'],'name':_0x4cacb4[_0x601b('0x12')],'key':_0x4cacb4['key'],'active':_0x4cacb4[_0x601b('0x13')],'Imap':{'status':_0x4cacb4[_0x601b('0x14')]['status'],'messageStatus':_0x4cacb4[_0x601b('0x14')]['messageStatus'],'total':_0x4cacb4[_0x601b('0x14')][_0x601b('0x15')]}};if(_[_0x601b('0x16')](md5Accounts[_0x5b19ad])){md5Accounts[_0x5b19ad]={};}var _0x135522=md5(JSON[_0x601b('0x17')](_0x11a46e));if(md5Accounts[_0x5b19ad][_0x601b('0x2')]!==_0x135522){md5Accounts[_0x5b19ad][_0x601b('0x2')]=_0x135522;io[_0x601b('0x11')](_0x601b('0x18'),_0x11a46e);}};EmailChannel[_0x601b('0x10')]['refresh']=function(_0xe4c236){for(var _0x5895d1 in _0xe4c236){if(_0xe4c236[_0x601b('0x19')](_0x5895d1)){if(_0xe4c236[_0x5895d1]['Imap']&&_0xe4c236[_0x5895d1][_0x601b('0x13')]){var _0x593a01=_0xe4c236[_0x5895d1][_0x601b('0x14')];if(!_0x593a01['service']&&_0xe4c236[_0x5895d1]['provider']!=='custom')_0x593a01[_0x601b('0x1a')]=_0xe4c236[_0x5895d1][_0x601b('0x1b')];if(!this[_0x601b('0xe')][_0x601b('0x19')](_0x593a01['id'])){this[_0x601b('0xe')][_0x593a01['id']]=new EmailImap(_0x593a01,_0xe4c236[_0x5895d1]['email']);this['imapAccounts'][_0x593a01['id']]['on']('box',this['handleImapBox']['bind'](this,_0x5895d1));this[_0x601b('0xe')][_0x593a01['id']]['on'](_0x601b('0x5'),this[_0x601b('0x1c')][_0x601b('0x1d')](this,_0x5895d1));this['imapAccounts'][_0x593a01['id']]['on'](_0x601b('0x1e'),this['handleImapEnd']['bind'](this,_0x5895d1));this[_0x601b('0xe')][_0x593a01['id']]['on'](_0x601b('0x1f'),this[_0x601b('0x20')][_0x601b('0x1d')](this,_0x5895d1));}}else{if(_[_0x601b('0x16')](this[_0x601b('0xd')][_0x5895d1][_0x601b('0x14')])){this[_0x601b('0xd')][_0x5895d1][_0x601b('0x14')]={};}this[_0x601b('0xd')][_0x5895d1][_0x601b('0x14')]['status']=_0x601b('0x21');this[_0x601b('0xd')][_0x5895d1][_0x601b('0x14')][_0x601b('0x22')]='';this[_0x601b('0x11')](_0x5895d1);}}}};EmailChannel[_0x601b('0x10')]['handleImapBox']=function(_0x3eba24,_0x5c8374){if(this[_0x601b('0xd')][_0x3eba24]){this[_0x601b('0xd')][_0x3eba24][_0x601b('0x14')][_0x601b('0x23')]=_0x601b('0x24');this[_0x601b('0xd')][_0x3eba24][_0x601b('0x14')][_0x601b('0x22')]=_0x5c8374[_0x601b('0x12')];if(_0x5c8374[_0x601b('0x25')]){this['mailAccounts'][_0x3eba24][_0x601b('0x14')][_0x601b('0x15')]=_0x5c8374[_0x601b('0x25')]['total'];}return this[_0x601b('0x11')](_0x3eba24);}};EmailChannel[_0x601b('0x10')][_0x601b('0x1c')]=function(_0x53fd92,_0xaec0b1){logger[_0x601b('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0xaec0b1[_0x601b('0x26')],_0xaec0b1[_0x601b('0x27')],_0xaec0b1[_0x601b('0x28')],_0x53fd92);if(this['mailAccounts'][_0x53fd92]){return mailAccount[_0x601b('0x29')](_0x53fd92,_0xaec0b1)[_0x601b('0x2a')](function(_0x2d99b5){if(_0x2d99b5){logger['info'](_0x601b('0x2b'));}})['catch'](function(_0x266dc6){logger[_0x601b('0x1f')](_0x601b('0x2c'),JSON[_0x601b('0x17')](_0x266dc6));});}};EmailChannel[_0x601b('0x10')]['handleImapEnd']=function(_0x4693a5){if(this[_0x601b('0xd')][_0x4693a5]&&this['mailAccounts'][_0x4693a5]['Imap']){if(this[_0x601b('0xe')][this[_0x601b('0xd')][_0x4693a5][_0x601b('0x14')]['id']]){delete this[_0x601b('0xe')][this['mailAccounts'][_0x4693a5][_0x601b('0x14')]['id']];}this['mailAccounts'][_0x4693a5]['Imap'][_0x601b('0x2d')]=moment();this['emit'](_0x4693a5);}};EmailChannel[_0x601b('0x10')]['handleImapError']=function(_0x111436,_0x1acf49){if(this[_0x601b('0xd')][_0x111436]){this[_0x601b('0xd')][_0x111436][_0x601b('0x14')][_0x601b('0x23')]=_0x601b('0x1f');this[_0x601b('0xd')][_0x111436][_0x601b('0x14')]['messageStatus']=_0x1acf49;return this['emit'](_0x111436);}};EmailChannel[_0x601b('0x10')][_0x601b('0x2e')]=function(_0x32ac84,_0x2f3e66){return this[_0x601b('0xf')][_0x601b('0x2f')](_0x32ac84,_0x2f3e66);};EmailChannel[_0x601b('0x10')][_0x601b('0x30')]=function(_0x5970d6){var _0xcfc240=this;if(this['mailAccounts'][_0x5970d6['id']]){if(_[_0x601b('0x16')](this[_0x601b('0xd')][_0x5970d6['id']][_0x601b('0x31')])){this[_0x601b('0xd')][_0x5970d6['id']][_0x601b('0x31')]={};}this['mailAccounts'][_0x5970d6['id']][_0x601b('0x31')][_0x601b('0x2d')]=moment();return new BPromise(function(_0x5bc121,_0x4dc197){return _0xcfc240[_0x601b('0xf')][_0x601b('0x32')](_0x5970d6)[_0x601b('0x2a')](function(_0x3a163b){_0xcfc240[_0x601b('0xd')][_0x5970d6['id']][_0x601b('0x31')][_0x601b('0x23')]='verified';_0xcfc240[_0x601b('0xd')][_0x5970d6['id']]['Smtp'][_0x601b('0x22')]='';_0xcfc240[_0x601b('0x11')](_0x5970d6['id']);_0x5bc121(_0x3a163b);})[_0x601b('0x33')](function(_0xa9ad3a){_0xcfc240['mailAccounts'][_0x5970d6['id']]['Smtp'][_0x601b('0x23')]=_0x601b('0x1f');_0xcfc240[_0x601b('0xd')][_0x5970d6['id']][_0x601b('0x31')][_0x601b('0x22')]=_0xa9ad3a;_0xcfc240[_0x601b('0x11')](_0x5970d6['id']);_0x4dc197(_0xa9ad3a);});});}return this[_0x601b('0xf')][_0x601b('0x32')](_0x5970d6);};module[_0x601b('0x34')]=EmailChannel;
\ No newline at end of file
+var _0x0eee=['defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','active','Imap','status','messageStatus','total','stringify','mailAccount:update','hasOwnProperty','service','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','Smtp','lastSync','verify','then','verified','exports','lodash','bluebird','md5','ioredis','../../../config/logger','email','redis'];(function(_0x4446fe,_0x2ae626){var _0x43f10c=function(_0x1b3766){while(--_0x1b3766){_0x4446fe['push'](_0x4446fe['shift']());}};_0x43f10c(++_0x2ae626);}(_0x0eee,0xd9));var _0xe0ee=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x0eee[_0x1ccbcc];return _0x1e873f;};'use strict';var _=require(_0xe0ee('0x0'));var moment=require('moment');var BPromise=require(_0xe0ee('0x1'));var md5=require(_0xe0ee('0x2'));var Redis=require(_0xe0ee('0x3'));var config=require('../../../config/environment');var logger=require(_0xe0ee('0x4'))(_0xe0ee('0x5'));config[_0xe0ee('0x6')]=_[_0xe0ee('0x7')](config[_0xe0ee('0x6')],{'host':_0xe0ee('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe0ee('0x6')]));var EmailImap=require(_0xe0ee('0x9'));var EmailSmtp=require(_0xe0ee('0xa'));var mailAccount=require(_0xe0ee('0xb'));var md5Accounts={};function EmailChannel(_0x1487b7){logger[_0xe0ee('0xc')](_0xe0ee('0xd'));this[_0xe0ee('0xe')]=_0x1487b7[_0xe0ee('0xe')];this[_0xe0ee('0xf')]={};this[_0xe0ee('0x10')]=new EmailSmtp();}EmailChannel[_0xe0ee('0x11')][_0xe0ee('0x12')]=function(_0x477961){var _0x23a96a=this['mailAccounts'][_0x477961];var _0x4f6302={'id':_0x23a96a['id'],'name':_0x23a96a['name'],'key':_0x23a96a['key'],'active':_0x23a96a[_0xe0ee('0x13')],'Imap':{'status':_0x23a96a[_0xe0ee('0x14')][_0xe0ee('0x15')],'messageStatus':_0x23a96a[_0xe0ee('0x14')][_0xe0ee('0x16')],'total':_0x23a96a[_0xe0ee('0x14')][_0xe0ee('0x17')]}};if(_['isNil'](md5Accounts[_0x477961])){md5Accounts[_0x477961]={};}var _0xeed17f=md5(JSON[_0xe0ee('0x18')](_0x4f6302));if(md5Accounts[_0x477961][_0xe0ee('0x2')]!==_0xeed17f){md5Accounts[_0x477961][_0xe0ee('0x2')]=_0xeed17f;io[_0xe0ee('0x12')](_0xe0ee('0x19'),_0x4f6302);}};EmailChannel[_0xe0ee('0x11')]['refresh']=function(_0x75e76f){for(var _0xffa49f in _0x75e76f){if(_0x75e76f[_0xe0ee('0x1a')](_0xffa49f)){if(_0x75e76f[_0xffa49f][_0xe0ee('0x14')]&&_0x75e76f[_0xffa49f][_0xe0ee('0x13')]){var _0x3c6709=_0x75e76f[_0xffa49f][_0xe0ee('0x14')];if(!_0x3c6709[_0xe0ee('0x1b')]&&_0x75e76f[_0xffa49f]['provider']!=='custom')_0x3c6709[_0xe0ee('0x1b')]=_0x75e76f[_0xffa49f]['provider'];if(!this['imapAccounts']['hasOwnProperty'](_0x3c6709['id'])){this[_0xe0ee('0xf')][_0x3c6709['id']]=new EmailImap(_0x3c6709,_0x75e76f[_0xffa49f][_0xe0ee('0x5')]);this[_0xe0ee('0xf')][_0x3c6709['id']]['on'](_0xe0ee('0x1c'),this[_0xe0ee('0x1d')][_0xe0ee('0x1e')](this,_0xffa49f));this[_0xe0ee('0xf')][_0x3c6709['id']]['on'](_0xe0ee('0x5'),this[_0xe0ee('0x1f')]['bind'](this,_0xffa49f));this[_0xe0ee('0xf')][_0x3c6709['id']]['on'](_0xe0ee('0x20'),this[_0xe0ee('0x21')][_0xe0ee('0x1e')](this,_0xffa49f));this[_0xe0ee('0xf')][_0x3c6709['id']]['on'](_0xe0ee('0x22'),this[_0xe0ee('0x23')]['bind'](this,_0xffa49f));}}else{if(_[_0xe0ee('0x24')](this[_0xe0ee('0xe')][_0xffa49f][_0xe0ee('0x14')])){this[_0xe0ee('0xe')][_0xffa49f][_0xe0ee('0x14')]={};}this[_0xe0ee('0xe')][_0xffa49f][_0xe0ee('0x14')][_0xe0ee('0x15')]='disabled';this[_0xe0ee('0xe')][_0xffa49f]['Imap']['messageStatus']='';this[_0xe0ee('0x12')](_0xffa49f);}}}};EmailChannel[_0xe0ee('0x11')][_0xe0ee('0x1d')]=function(_0x1e1c17,_0x2cc976){if(this[_0xe0ee('0xe')][_0x1e1c17]){this['mailAccounts'][_0x1e1c17][_0xe0ee('0x14')]['status']=_0xe0ee('0x25');this['mailAccounts'][_0x1e1c17][_0xe0ee('0x14')][_0xe0ee('0x16')]=_0x2cc976[_0xe0ee('0x26')];if(_0x2cc976[_0xe0ee('0x27')]){this[_0xe0ee('0xe')][_0x1e1c17][_0xe0ee('0x14')][_0xe0ee('0x17')]=_0x2cc976[_0xe0ee('0x27')]['total'];}return this[_0xe0ee('0x12')](_0x1e1c17);}};EmailChannel['prototype'][_0xe0ee('0x1f')]=function(_0x4a4f90,_0x1a958c){logger[_0xe0ee('0xc')](_0xe0ee('0x28'),_0x1a958c[_0xe0ee('0x29')],_0x1a958c[_0xe0ee('0x2a')],_0x1a958c[_0xe0ee('0x2b')],_0x4a4f90);if(this[_0xe0ee('0xe')][_0x4a4f90]){return mailAccount[_0xe0ee('0x2c')](_0x4a4f90,_0x1a958c)['then'](function(_0x22bdb1){if(_0x22bdb1){logger[_0xe0ee('0xc')](_0xe0ee('0x2d'));}})[_0xe0ee('0x2e')](function(_0x487a85){logger[_0xe0ee('0x22')](_0xe0ee('0x2f'),JSON[_0xe0ee('0x18')](_0x487a85));});}};EmailChannel['prototype'][_0xe0ee('0x21')]=function(_0x242d18){if(this['mailAccounts'][_0x242d18]&&this['mailAccounts'][_0x242d18][_0xe0ee('0x14')]){if(this[_0xe0ee('0xf')][this[_0xe0ee('0xe')][_0x242d18][_0xe0ee('0x14')]['id']]){delete this[_0xe0ee('0xf')][this[_0xe0ee('0xe')][_0x242d18][_0xe0ee('0x14')]['id']];}this['mailAccounts'][_0x242d18]['Imap']['lastSync']=moment();this[_0xe0ee('0x12')](_0x242d18);}};EmailChannel[_0xe0ee('0x11')][_0xe0ee('0x23')]=function(_0x5da36e,_0x3cf4f4){if(this[_0xe0ee('0xe')][_0x5da36e]){this[_0xe0ee('0xe')][_0x5da36e][_0xe0ee('0x14')]['status']=_0xe0ee('0x22');this[_0xe0ee('0xe')][_0x5da36e][_0xe0ee('0x14')][_0xe0ee('0x16')]=_0x3cf4f4;return this[_0xe0ee('0x12')](_0x5da36e);}};EmailChannel[_0xe0ee('0x11')][_0xe0ee('0x30')]=function(_0x32fe11,_0x2c3d30){return this[_0xe0ee('0x10')][_0xe0ee('0x31')](_0x32fe11,_0x2c3d30);};EmailChannel[_0xe0ee('0x11')]['verifySmtp']=function(_0x572dc1){var _0x5e5a7d=this;if(this[_0xe0ee('0xe')][_0x572dc1['id']]){if(_[_0xe0ee('0x24')](this[_0xe0ee('0xe')][_0x572dc1['id']][_0xe0ee('0x32')])){this[_0xe0ee('0xe')][_0x572dc1['id']][_0xe0ee('0x32')]={};}this['mailAccounts'][_0x572dc1['id']][_0xe0ee('0x32')][_0xe0ee('0x33')]=moment();return new BPromise(function(_0x36b105,_0x4ad623){return _0x5e5a7d[_0xe0ee('0x10')][_0xe0ee('0x34')](_0x572dc1)[_0xe0ee('0x35')](function(_0x1920b7){_0x5e5a7d[_0xe0ee('0xe')][_0x572dc1['id']][_0xe0ee('0x32')][_0xe0ee('0x15')]=_0xe0ee('0x36');_0x5e5a7d[_0xe0ee('0xe')][_0x572dc1['id']][_0xe0ee('0x32')][_0xe0ee('0x16')]='';_0x5e5a7d[_0xe0ee('0x12')](_0x572dc1['id']);_0x36b105(_0x1920b7);})['catch'](function(_0x200229){_0x5e5a7d['mailAccounts'][_0x572dc1['id']][_0xe0ee('0x32')]['status']=_0xe0ee('0x22');_0x5e5a7d[_0xe0ee('0xe')][_0x572dc1['id']][_0xe0ee('0x32')][_0xe0ee('0x16')]=_0x200229;_0x5e5a7d[_0xe0ee('0x12')](_0x572dc1['id']);_0x4ad623(_0x200229);});});}return this[_0xe0ee('0x10')][_0xe0ee('0x34')](_0x572dc1);};module[_0xe0ee('0x37')]=EmailChannel;
\ No newline at end of file
index b085d67..0cbd30e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf69c=['required','openBox','handleOpenBox','emit','readUnseen','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','handleCloseBox','body','attributes','handleMessageEnd','handleMessageBody','handleMessageAttributes','handleSimpleParser','parser','handleFetchError','handleEnd','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','mailparser','iconv','events','./utils','email','mailbox','INBOX','getAccount','account','ready','handleReady','bind','once','end','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xf69c,0x151));var _0xcf69=function(_0x2a6b55,_0x572485){_0x2a6b55=_0x2a6b55-0x0;var _0x3dd7fd=_0xf69c[_0x2a6b55];return _0x3dd7fd;};'use strict';var _=require(_0xcf69('0x0'));var util=require('util');var Imap=require(_0xcf69('0x1'));var simpleParser=require(_0xcf69('0x2'))['simpleParser'];var Iconv=require(_0xcf69('0x3'))['Iconv'];var EventEmitter=require(_0xcf69('0x4'))['EventEmitter'];var utils=require(_0xcf69('0x5'));var logger=require('../../../config/logger')(_0xcf69('0x6'));function EmailImap(_0x168197,_0x225c65){this[_0xcf69('0x7')]=_0xcf69('0x8');this['account']=this[_0xcf69('0x9')](_0x168197,_0x225c65);this[_0xcf69('0x1')]=new Imap(this[_0xcf69('0xa')]);this[_0xcf69('0x1')]['once'](_0xcf69('0xb'),this[_0xcf69('0xc')][_0xcf69('0xd')](this));this[_0xcf69('0x1')][_0xcf69('0xe')](_0xcf69('0xf'),this['handleEnd'][_0xcf69('0xd')](this));this['imap']['on'](_0xcf69('0x10'),this[_0xcf69('0x11')][_0xcf69('0xd')](this));this[_0xcf69('0x1')][_0xcf69('0x12')]();}util[_0xcf69('0x13')](EmailImap,EventEmitter);EmailImap[_0xcf69('0x14')][_0xcf69('0x9')]=function(_0x537a1c,_0x585164){var _0x5c66b6={'connTimeout':_0x537a1c['connTimeout']?_0x537a1c[_0xcf69('0x15')]*0x3e8:0x2710,'authTimeout':_0x537a1c['authTimeout']?_0x537a1c[_0xcf69('0x16')]*0x3e8:0x1388};if(_0x537a1c[_0xcf69('0x17')]){_0x5c66b6[_0xcf69('0x18')]=_0x537a1c[_0xcf69('0x18')];_0x5c66b6['email']=_0x585164||_0x537a1c[_0xcf69('0x18')]||_0xcf69('0x19');if(_0x537a1c['modernAuthentication']){_0x5c66b6['xoauth2']=utils[_0xcf69('0x1a')](_0x537a1c[_0xcf69('0x1b')][_0xcf69('0x1c')],_0x537a1c[_0xcf69('0x18')]);}else{_0x5c66b6[_0xcf69('0x1d')]=_0x537a1c[_0xcf69('0x1d')];}}else{if(_0x537a1c[_0xcf69('0x1e')]){_0x5c66b6[_0xcf69('0x18')]=_0x537a1c['user'];_0x5c66b6[_0xcf69('0x1d')]=_0x537a1c['password'];}}_0x5c66b6[_0xcf69('0x1f')]=_0x537a1c[_0xcf69('0x1f')];_0x5c66b6[_0xcf69('0x20')]=_0x537a1c[_0xcf69('0x20')]||0x3e1;if(_0x537a1c[_0xcf69('0x21')]){_0x5c66b6[_0xcf69('0x21')]=!![];}else{_0x5c66b6[_0xcf69('0x21')]=![];_0x5c66b6[_0xcf69('0x22')]=_0xcf69('0x23');}return _0x5c66b6;};EmailImap[_0xcf69('0x14')][_0xcf69('0xc')]=function(){this[_0xcf69('0x1')][_0xcf69('0x24')](this[_0xcf69('0x7')],![],this[_0xcf69('0x25')]['bind'](this));};EmailImap[_0xcf69('0x14')][_0xcf69('0x25')]=function(_0x183067,_0x278ce3){if(_0x183067){this[_0xcf69('0x11')](_0x183067,!![]);}else{this[_0xcf69('0x26')]('box',_0x278ce3);this['readUnseen']();}};EmailImap[_0xcf69('0x14')]['handleCloseBox']=function(_0x2f723f){if(_0x2f723f){this[_0xcf69('0x11')](_0x2f723f,!![]);}else{this[_0xcf69('0x1')][_0xcf69('0xf')]();}};EmailImap[_0xcf69('0x14')][_0xcf69('0x27')]=function(){this[_0xcf69('0x1')][_0xcf69('0x28')](['UNSEEN'],this['handleReadUnseen'][_0xcf69('0xd')](this));};EmailImap[_0xcf69('0x14')][_0xcf69('0x29')]=function(_0x415d69,_0x539f6e){if(_0x415d69){this[_0xcf69('0x11')](_0x415d69,!![]);}else{if(_0x539f6e[_0xcf69('0x2a')]){try{var _0x7a011b=this[_0xcf69('0x1')][_0xcf69('0x2b')](_0x539f6e,{'bodies':'','markSeen':!![]});_0x7a011b['on'](_0xcf69('0x2c'),this[_0xcf69('0x2d')][_0xcf69('0xd')](this));_0x7a011b[_0xcf69('0xe')](_0xcf69('0x10'),this['handleFetchError'][_0xcf69('0xd')](this));_0x7a011b['once'](_0xcf69('0xf'),this[_0xcf69('0x2e')][_0xcf69('0xd')](this));}catch(_0x191699){logger[_0xcf69('0x10')](_0x191699);}}else{this[_0xcf69('0x1')][_0xcf69('0x2f')](!![],this[_0xcf69('0x30')][_0xcf69('0xd')](this));}}};EmailImap[_0xcf69('0x14')]['handleFetchMessage']=function(_0x2753fe){_0x2753fe['on'](_0xcf69('0x31'),this['handleMessageBody'][_0xcf69('0xd')](this));_0x2753fe['once'](_0xcf69('0x32'),this['handleMessageAttributes']['bind'](this));_0x2753fe[_0xcf69('0xe')](_0xcf69('0xf'),this[_0xcf69('0x33')][_0xcf69('0xd')](this));};EmailImap[_0xcf69('0x14')][_0xcf69('0x34')]=function(_0x5aa1e0){simpleParser(_0x5aa1e0,{'Iconv':Iconv},this['handleSimpleParser'][_0xcf69('0xd')](this));};EmailImap[_0xcf69('0x14')][_0xcf69('0x35')]=function(){};EmailImap[_0xcf69('0x14')][_0xcf69('0x33')]=function(){};EmailImap[_0xcf69('0x14')][_0xcf69('0x36')]=function(_0x2d7e52,_0x3d4eec){if(_0x2d7e52){logger[_0xcf69('0x10')](_0x2d7e52);}else{var _0x236fc2=this;utils[_0xcf69('0x37')](this[_0xcf69('0xa')],_0x3d4eec,function(_0x21c41f){_0x236fc2[_0xcf69('0x26')](_0xcf69('0x6'),_0x21c41f);});}};EmailImap[_0xcf69('0x14')][_0xcf69('0x2e')]=function(){this[_0xcf69('0x1')][_0xcf69('0x2f')](!![],this[_0xcf69('0x30')]['bind'](this));};EmailImap['prototype'][_0xcf69('0x38')]=function(_0x35c5ea){this[_0xcf69('0x11')](_0x35c5ea);this[_0xcf69('0x1')]['closeBox'](!![],this[_0xcf69('0x30')][_0xcf69('0xd')](this));};EmailImap[_0xcf69('0x14')][_0xcf69('0x39')]=function(){this[_0xcf69('0x26')]('end');};EmailImap[_0xcf69('0x14')][_0xcf69('0x11')]=function(_0x4ba119,_0x2196c1){logger[_0xcf69('0x10')](_0xcf69('0x11'),this['account'][_0xcf69('0x6')],JSON['stringify'](_0x4ba119));var _0x2254a8='';if(_0x4ba119){if(_0x4ba119[_0xcf69('0x3a')]){_0x2254a8=_0x4ba119['textCode'];}else{for(var _0x4d90db in _0x4ba119){if(_0x4ba119[_0xcf69('0x3b')](_0x4d90db)){_0x2254a8+=_[_0xcf69('0x3c')](_0x4d90db)+':\x20'+_0x4ba119[_0x4d90db]+'\x0a';}}}}if(_0x2196c1){this[_0xcf69('0x1')]['end']();}else{this['emit'](_0xcf69('0x10'),_0x2254a8);this[_0xcf69('0x26')]('end');}};module[_0xcf69('0x3d')]=EmailImap;
\ No newline at end of file
+var _0xee2c=['imap','mailparser','simpleParser','iconv','EventEmitter','./utils','email','mailbox','INBOX','account','once','ready','handleReady','bind','end','handleEnd','error','prototype','getAccount','connTimeout','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','handleError','search','handleReadUnseen','length','message','handleFetchEnd','closeBox','body','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xee2c,0x1c7));var _0xcee2=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xee2c[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xcee2('0x0'));var util=require('util');var Imap=require(_0xcee2('0x1'));var simpleParser=require(_0xcee2('0x2'))[_0xcee2('0x3')];var Iconv=require(_0xcee2('0x4'))['Iconv'];var EventEmitter=require('events')[_0xcee2('0x5')];var utils=require(_0xcee2('0x6'));var logger=require('../../../config/logger')(_0xcee2('0x7'));function EmailImap(_0x409944,_0x12fa86){this[_0xcee2('0x8')]=_0xcee2('0x9');this['account']=this['getAccount'](_0x409944,_0x12fa86);this[_0xcee2('0x1')]=new Imap(this[_0xcee2('0xa')]);this[_0xcee2('0x1')][_0xcee2('0xb')](_0xcee2('0xc'),this[_0xcee2('0xd')][_0xcee2('0xe')](this));this[_0xcee2('0x1')]['once'](_0xcee2('0xf'),this[_0xcee2('0x10')][_0xcee2('0xe')](this));this[_0xcee2('0x1')]['on'](_0xcee2('0x11'),this['handleError'][_0xcee2('0xe')](this));this['imap']['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xcee2('0x12')][_0xcee2('0x13')]=function(_0x2afc56,_0x347a97){var _0x54a718={'connTimeout':_0x2afc56[_0xcee2('0x14')]?_0x2afc56[_0xcee2('0x14')]*0x3e8:0x2710,'authTimeout':_0x2afc56[_0xcee2('0x15')]?_0x2afc56[_0xcee2('0x15')]*0x3e8:0x1388};if(_0x2afc56[_0xcee2('0x16')]){_0x54a718[_0xcee2('0x17')]=_0x2afc56[_0xcee2('0x17')];_0x54a718[_0xcee2('0x7')]=_0x347a97||_0x2afc56[_0xcee2('0x17')]||'anonymous@xcally.com';if(_0x2afc56[_0xcee2('0x18')]){_0x54a718['xoauth2']=utils[_0xcee2('0x19')](_0x2afc56[_0xcee2('0x1a')][_0xcee2('0x1b')],_0x2afc56[_0xcee2('0x17')]);}else{_0x54a718['password']=_0x2afc56[_0xcee2('0x1c')];}}else{if(_0x2afc56[_0xcee2('0x1d')]){_0x54a718[_0xcee2('0x17')]=_0x2afc56[_0xcee2('0x17')];_0x54a718[_0xcee2('0x1c')]=_0x2afc56[_0xcee2('0x1c')];}}_0x54a718[_0xcee2('0x1e')]=_0x2afc56[_0xcee2('0x1e')];_0x54a718[_0xcee2('0x1f')]=_0x2afc56[_0xcee2('0x1f')]||0x3e1;if(_0x2afc56[_0xcee2('0x20')]){_0x54a718['tls']=!![];}else{_0x54a718[_0xcee2('0x20')]=![];_0x54a718[_0xcee2('0x21')]='required';}return _0x54a718;};EmailImap['prototype'][_0xcee2('0xd')]=function(){this['imap'][_0xcee2('0x22')](this[_0xcee2('0x8')],![],this[_0xcee2('0x23')]['bind'](this));};EmailImap['prototype'][_0xcee2('0x23')]=function(_0x2ccc9c,_0x22789d){if(_0x2ccc9c){this['handleError'](_0x2ccc9c,!![]);}else{this[_0xcee2('0x24')]('box',_0x22789d);this[_0xcee2('0x25')]();}};EmailImap[_0xcee2('0x12')][_0xcee2('0x26')]=function(_0x21bc84){if(_0x21bc84){this[_0xcee2('0x27')](_0x21bc84,!![]);}else{this[_0xcee2('0x1')][_0xcee2('0xf')]();}};EmailImap[_0xcee2('0x12')][_0xcee2('0x25')]=function(){this[_0xcee2('0x1')][_0xcee2('0x28')](['UNSEEN'],this[_0xcee2('0x29')][_0xcee2('0xe')](this));};EmailImap[_0xcee2('0x12')]['handleReadUnseen']=function(_0x2f07e9,_0x117342){if(_0x2f07e9){this['handleError'](_0x2f07e9,!![]);}else{if(_0x117342[_0xcee2('0x2a')]){try{var _0x25ead9=this['imap']['fetch'](_0x117342,{'bodies':'','markSeen':!![]});_0x25ead9['on'](_0xcee2('0x2b'),this['handleFetchMessage']['bind'](this));_0x25ead9[_0xcee2('0xb')](_0xcee2('0x11'),this['handleFetchError'][_0xcee2('0xe')](this));_0x25ead9[_0xcee2('0xb')](_0xcee2('0xf'),this[_0xcee2('0x2c')][_0xcee2('0xe')](this));}catch(_0x150660){logger[_0xcee2('0x11')](_0x150660);}}else{this[_0xcee2('0x1')][_0xcee2('0x2d')](!![],this[_0xcee2('0x26')][_0xcee2('0xe')](this));}}};EmailImap[_0xcee2('0x12')]['handleFetchMessage']=function(_0x4775ba){_0x4775ba['on'](_0xcee2('0x2e'),this['handleMessageBody'][_0xcee2('0xe')](this));_0x4775ba[_0xcee2('0xb')]('attributes',this[_0xcee2('0x2f')][_0xcee2('0xe')](this));_0x4775ba[_0xcee2('0xb')]('end',this[_0xcee2('0x30')][_0xcee2('0xe')](this));};EmailImap[_0xcee2('0x12')][_0xcee2('0x31')]=function(_0x352df6){simpleParser(_0x352df6,{'Iconv':Iconv},this[_0xcee2('0x32')]['bind'](this));};EmailImap[_0xcee2('0x12')][_0xcee2('0x2f')]=function(){};EmailImap[_0xcee2('0x12')]['handleMessageEnd']=function(){};EmailImap[_0xcee2('0x12')]['handleSimpleParser']=function(_0x594eab,_0x42c307){if(_0x594eab){logger[_0xcee2('0x11')](_0x594eab);}else{var _0x16ae5c=this;utils[_0xcee2('0x33')](this[_0xcee2('0xa')],_0x42c307,function(_0x2eb529){_0x16ae5c['emit']('email',_0x2eb529);});}};EmailImap['prototype'][_0xcee2('0x2c')]=function(){this['imap'][_0xcee2('0x2d')](!![],this[_0xcee2('0x26')]['bind'](this));};EmailImap[_0xcee2('0x12')]['handleFetchError']=function(_0x54d75a){this[_0xcee2('0x27')](_0x54d75a);this[_0xcee2('0x1')]['closeBox'](!![],this['handleCloseBox'][_0xcee2('0xe')](this));};EmailImap[_0xcee2('0x12')][_0xcee2('0x10')]=function(){this[_0xcee2('0x24')](_0xcee2('0xf'));};EmailImap[_0xcee2('0x12')][_0xcee2('0x27')]=function(_0x4243d4,_0x377b2f){logger['error'](_0xcee2('0x27'),this[_0xcee2('0xa')][_0xcee2('0x7')],JSON[_0xcee2('0x34')](_0x4243d4));var _0x4bad7b='';if(_0x4243d4){if(_0x4243d4[_0xcee2('0x35')]){_0x4bad7b=_0x4243d4[_0xcee2('0x35')];}else{for(var _0x207764 in _0x4243d4){if(_0x4243d4[_0xcee2('0x36')](_0x207764)){_0x4bad7b+=_[_0xcee2('0x37')](_0x207764)+':\x20'+_0x4243d4[_0x207764]+'\x0a';}}}}if(_0x377b2f){this[_0xcee2('0x1')][_0xcee2('0xf')]();}else{this[_0xcee2('0x24')](_0xcee2('0x11'),_0x4bad7b);this['emit'](_0xcee2('0xf'));}};module[_0xcee2('0x38')]=EmailImap;
\ No newline at end of file
index 0bbd5be..303854f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x37bb=['createTransport','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','use','compile','sendMail','toString','verify'];(function(_0xd13cad,_0xea397a){var _0xc744f2=function(_0x770ba1){while(--_0x770ba1){_0xd13cad['push'](_0xd13cad['shift']());}};_0xc744f2(++_0xea397a);}(_0x37bb,0x98));var _0xb37b=function(_0x1ac959,_0x4d7833){_0x1ac959=_0x1ac959-0x0;var _0x10d04d=_0x37bb[_0x1ac959];return _0x10d04d;};'use strict';var nodemailer=require(_0xb37b('0x0'));var inlineBase64=require(_0xb37b('0x1'));function EmailSmtp(){}EmailSmtp[_0xb37b('0x2')]['send']=function(_0x2209b6,_0x20041a){return new Promise(function(_0x54b5af,_0x1c7408){var _0x273d49=nodemailer['createTransport'](_0x2209b6);_0x273d49[_0xb37b('0x3')](_0xb37b('0x4'),inlineBase64());_0x273d49[_0xb37b('0x5')](_0x20041a,function(_0x4e233c,_0x555c9b){if(_0x4e233c){_0x1c7408(_0x4e233c[_0xb37b('0x6')]());}else{_0x54b5af(_0x555c9b);}});});};EmailSmtp['prototype'][_0xb37b('0x7')]=function(_0x29463d){return new Promise(function(_0x34f951,_0x11ab97){var _0x38896d=nodemailer[_0xb37b('0x8')](_0x29463d);_0x38896d[_0xb37b('0x7')](function(_0x346cb8,_0x39230e){if(_0x346cb8){_0x11ab97(_0x346cb8[_0xb37b('0x6')]());}else{if(_0x39230e){_0x34f951(_0x39230e);}else{_0x11ab97('Not\x20verifired');}}});});};module[_0xb37b('0x9')]=EmailSmtp;
\ No newline at end of file
+var _0x70d5=['nodemailer-plugin-inline-base64','prototype','send','createTransport','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer'];(function(_0x2159e6,_0x55c285){var _0x355dbb=function(_0x31dfa8){while(--_0x31dfa8){_0x2159e6['push'](_0x2159e6['shift']());}};_0x355dbb(++_0x55c285);}(_0x70d5,0x112));var _0x570d=function(_0x4e5e6c,_0x959eb4){_0x4e5e6c=_0x4e5e6c-0x0;var _0xcf9053=_0x70d5[_0x4e5e6c];return _0xcf9053;};'use strict';var nodemailer=require(_0x570d('0x0'));var inlineBase64=require(_0x570d('0x1'));function EmailSmtp(){}EmailSmtp[_0x570d('0x2')][_0x570d('0x3')]=function(_0x30f77,_0x4e0dd3){return new Promise(function(_0x5e640a,_0x5a64c3){var _0x4c30cf=nodemailer[_0x570d('0x4')](_0x30f77);_0x4c30cf['use'](_0x570d('0x5'),inlineBase64());_0x4c30cf[_0x570d('0x6')](_0x4e0dd3,function(_0x1de59b,_0x27d573){if(_0x1de59b){_0x5a64c3(_0x1de59b[_0x570d('0x7')]());}else{_0x5e640a(_0x27d573);}});});};EmailSmtp['prototype']['verify']=function(_0x13dcb0){return new Promise(function(_0x3f172d,_0x266d03){var _0x10008e=nodemailer[_0x570d('0x4')](_0x13dcb0);_0x10008e[_0x570d('0x8')](function(_0xd6101c,_0x93f85b){if(_0xd6101c){_0x266d03(_0xd6101c[_0x570d('0x7')]());}else{if(_0x93f85b){_0x3f172d(_0x93f85b);}else{_0x266d03(_0x570d('0x9'));}}});});};module[_0x570d('0xa')]=EmailSmtp;
\ No newline at end of file
index 5b23548..c93a57a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4061=['content','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','<p>Empty\x20message</p>','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','util','../../../config/logger','email','head','value','address','anonymous','name','substring','indexOf','split','length','slice','Anonymous','pop','isEmpty','generate','@xcally.com','html','replace','includes','<img','attachments','forEach','push','_SRC','_IMG','<span\x20style=font-weight:bold>\x20[Attachment:\x20','\x20]</span>','body','textAsHtml','<a\x20target=\x22_blank\x22\x20','message','originCc','originTo','bcc','attach','type','attachment','format','now','join','server/files/attachments/','writeFileSync'];(function(_0x1c4cef,_0x391ad0){var _0xe2316a=function(_0xb20560){while(--_0xb20560){_0x1c4cef['push'](_0x1c4cef['shift']());}};_0xe2316a(++_0x391ad0);}(_0x4061,0xb2));var _0x1406=function(_0x37a9b3,_0x332372){_0x37a9b3=_0x37a9b3-0x0;var _0xa36219=_0x4061[_0x37a9b3];return _0xa36219;};'use strict';var _=require(_0x1406('0x0'));var moment=require(_0x1406('0x1'));var random=require(_0x1406('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x1406('0x3'));var tnef=require('node-tnef');var logger=require(_0x1406('0x4'))(_0x1406('0x5'));var config=require('../../../config/environment');function getAddress(_0x1b9915){var _0xec7818=_[_0x1406('0x6')](_0x1b9915[_0x1406('0x7')]);return _0xec7818&&_0xec7818[_0x1406('0x8')]?_0xec7818['address']:_0x1406('0x9')+random['generate'](0x6)+'@xcally.com';}function getFirstName(_0x5c8efb){var _0x4433d1=_['head'](_0x5c8efb[_0x1406('0x7')]);if(_0x4433d1&&_0x4433d1['name']){if(_0x4433d1['name']==_0x4433d1[_0x1406('0x8')]){return _0x4433d1[_0x1406('0xa')][_0x1406('0xb')](0x0,_0x4433d1['name'][_0x1406('0xc')]('@'));}var _0x3c17f7=_0x4433d1[_0x1406('0xa')][_0x1406('0xd')](/\s+/);return _0x3c17f7[_0x1406('0xe')]>0x1?_0x3c17f7[_0x1406('0xf')](0x0,-0x1)['join']('\x20'):_0x4433d1[_0x1406('0xa')];}return _0x1406('0x10');}function getLastName(_0x184bd3){var _0x11264d=_[_0x1406('0x6')](_0x184bd3[_0x1406('0x7')]);if(_0x11264d&&_0x11264d[_0x1406('0xa')]){var _0x213630=_0x11264d[_0x1406('0xa')][_0x1406('0xd')](/\s+/);return _0x213630[_0x1406('0xe')]>0x1?_0x213630[_0x1406('0x11')]():'';}return'';}function getMails(_0x59e095,_0x5f23b0){var _0x34b766='';for(var _0x460c3c=0x0;_0x460c3c<_0x5f23b0[_0x1406('0x7')][_0x1406('0xe')];_0x460c3c+=0x1){if(_0x5f23b0[_0x1406('0x7')][_0x460c3c][_0x1406('0x8')]!==_0x59e095){if(!_[_0x1406('0x12')](_0x34b766)){_0x34b766+=',';}_0x34b766+=_0x5f23b0['value'][_0x460c3c][_0x1406('0xa')]||_0x5f23b0[_0x1406('0x7')][_0x460c3c][_0x1406('0x8')]||'';_0x34b766+='\x20<';_0x34b766+=_0x5f23b0[_0x1406('0x7')][_0x460c3c]['address']?_0x5f23b0['value'][_0x460c3c]['address']:_0x1406('0x9')+random[_0x1406('0x13')](0x6)+_0x1406('0x14');_0x34b766+='>';}}return _0x34b766;}function parseEmail(_0x3864a0,_0x1909af,_0x577490){if(_0x1909af[_0x1406('0x15')]){var _0xfc06db=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;while(_0xfc06db['test'](_0x1909af['html'])){_0x1909af[_0x1406('0x15')]=_0x1909af[_0x1406('0x15')][_0x1406('0x16')](_0xfc06db,'');}if(_0x1909af[_0x1406('0x15')][_0x1406('0x17')](_0x1406('0x18'))){var _0x3fd24e=[];_0x1909af[_0x1406('0x19')][_0x1406('0x1a')](_0xb55514=>{_0x3fd24e[_0x1406('0x1b')](_0xb55514['filename']);});var _0x394aef=/<img.*? _SRC(.*?)[^>]+>/g;var _0x1bfb9a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x55a81c=_0x1909af[_0x1406('0x15')][_0x1406('0x16')](_0x1bfb9a,_0x1406('0x1c'));var _0x4e28aa=_0x55a81c[_0x1406('0x16')](_0x394aef,'_IMG');for(let _0x4f5e2b=0x0;_0x4f5e2b<_0x3fd24e[_0x1406('0xe')];_0x4f5e2b++){var _0x4bbd2f=_0x4e28aa[_0x1406('0x16')](_0x1406('0x1d'),_0x1406('0x1e')+_0x3fd24e[_0x4f5e2b]+_0x1406('0x1f'));_0x4e28aa=_0x4bbd2f;}_0x1909af[_0x1406('0x15')]=_0x4e28aa;}_0x577490[_0x1406('0x20')]=_0x1909af[_0x1406('0x15')];}else{_0x577490[_0x1406('0x20')]=_0x1909af[_0x1406('0x21')];}if(_0x577490['body']){_0x577490[_0x1406('0x20')]=_0x577490[_0x1406('0x20')][_0x1406('0x16')](/<a\s+/gi,_0x1406('0x22'));}if(_0x1909af['to']){_0x577490[_0x1406('0x23')]['originTo']=getMails(null,_0x1909af['to']);var _0x15dd83=getMails(_0x3864a0[_0x1406('0x5')],_0x1909af['to']);if(!_[_0x1406('0x12')](_0x15dd83)){_0x577490[_0x1406('0x23')]['cc']+=_0x15dd83;}}if(_0x1909af['cc']){_0x577490['message'][_0x1406('0x24')]=getMails(null,_0x1909af['cc']);var _0xfea936=getMails(_0x3864a0['email'],_0x1909af['cc']);if(!_[_0x1406('0x12')](_0xfea936)){if(!_['isEmpty'](_0x577490['message']['cc'])){_0x577490['message']['cc']+=',';}_0x577490[_0x1406('0x23')]['cc']+=_0xfea936;}}if(!_[_0x1406('0x17')](_0x577490[_0x1406('0x23')][_0x1406('0x25')],_0x3864a0['email'])&&!_['includes'](_0x577490[_0x1406('0x23')][_0x1406('0x24')],_0x3864a0[_0x1406('0x5')])){_0x577490[_0x1406('0x23')][_0x1406('0x26')]=_0x3864a0[_0x1406('0x5')];}if(_0x1909af['attachments']&&_0x1909af[_0x1406('0x19')][_0x1406('0xe')]){_0x577490[_0x1406('0x23')][_0x1406('0x27')]=_0x1909af['attachments']['length'];for(var _0x556b1c=0x0,_0x5031f4,_0x255bdf,_0x3041e1;_0x556b1c<_0x1909af[_0x1406('0x19')][_0x1406('0xe')];_0x556b1c+=0x1){if(_0x1909af['attachments'][_0x556b1c][_0x1406('0x28')]===_0x1406('0x29')){_0x3041e1=_0x1909af[_0x1406('0x19')][_0x556b1c]['filename']||'attachment-'+_0x556b1c;_0x5031f4=util[_0x1406('0x2a')]('%s-%s',Date[_0x1406('0x2b')](),_0x3041e1);_0x255bdf=path[_0x1406('0x2c')](config['root'],_0x1406('0x2d'),_0x5031f4);fs[_0x1406('0x2e')](_0x255bdf,_0x1909af[_0x1406('0x19')][_0x556b1c][_0x1406('0x2f')]);_0x577490[_0x1406('0x23')][_0x1406('0x19')][_0x1406('0x1b')]({'name':_0x3041e1,'basename':_0x5031f4,'type':_0x1909af[_0x1406('0x19')][_0x556b1c][_0x1406('0x30')],'filepath':_0x255bdf});}}}if(_0x1909af['headerLines']&&_0x1909af[_0x1406('0x31')]['length']>0x0){var _0x2c9bce=['Auto-Submitted:\x20auto-replied',_0x1406('0x32'),_0x1406('0x33')];for(var _0xbeffab=0x0;_0xbeffab<_0x1909af[_0x1406('0x31')]['length'];_0xbeffab++){var _0x49a466=_['indexOf'](_0x2c9bce,_0x1909af[_0x1406('0x31')][_0xbeffab][_0x1406('0x34')]);if(_0x49a466>=0x0){_0x577490['isAutoreply']=!![];}}}return _0x577490;}exports[_0x1406('0x35')]=function(_0x2dafbc,_0x20dda3,_0x276b6c){var _0x1a07b6={'from':getAddress(_0x20dda3[_0x1406('0x36')]),'firstName':getFirstName(_0x20dda3['from']),'lastName':getLastName(_0x20dda3[_0x1406('0x36')]),'mapKey':_0x1406('0x5'),'message':{'from':getMails(_0x2dafbc[_0x1406('0x5')],_0x20dda3[_0x1406('0x36')]),'to':_0x2dafbc[_0x1406('0x5')],'cc':'','subject':_0x20dda3[_0x1406('0x37')]||'','messageId':_0x20dda3[_0x1406('0x38')],'inReplyTo':_0x20dda3[_0x1406('0x39')],'sentAt':moment(_0x20dda3[_0x1406('0x3a')])['format'](_0x1406('0x3b')),'attach':![],'attachments':[]}};if(!_0x20dda3['html']&&!_0x20dda3[_0x1406('0x21')]){var _0x3ed2d5=_[_0x1406('0x3c')](_0x20dda3[_0x1406('0x19')],{'contentType':'application/ms-tnef'});if(_0x3ed2d5[_0x1406('0xe')]){logger[_0x1406('0x3d')](util[_0x1406('0x2a')](_0x1406('0x3e'),_0x20dda3[_0x1406('0x38')]));tnef[_0x1406('0x3f')](_[_0x1406('0x40')](_0x3ed2d5)[_0x1406('0x2f')],function(_0x5c97a2,_0x3b28b2){if(_0x3b28b2){_0x20dda3[_0x1406('0x15')]=_0x3b28b2[_0x1406('0x41')]||_0x1406('0x42');if(_0x3b28b2[_0x1406('0x43')]){for(var _0x69c411=0x0;_0x69c411<_0x3b28b2['Attachments'][_0x1406('0xe')];_0x69c411++){var _0x3415a1=_0x3b28b2[_0x1406('0x43')][_0x69c411];_0x1a07b6[_0x1406('0x23')][_0x1406('0x19')][_0x1406('0x1b')]({'filename':_0x3415a1[_0x1406('0x44')],'content':Buffer[_0x1406('0x36')](_0x3415a1[_0x1406('0x45')])});}}}_0x276b6c(parseEmail(_0x2dafbc,_0x20dda3,_0x1a07b6));});}else{_0x20dda3[_0x1406('0x15')]=_0x1406('0x42');_0x276b6c(parseEmail(_0x2dafbc,_0x20dda3,_0x1a07b6));}}else{_0x276b6c(parseEmail(_0x2dafbc,_0x20dda3,_0x1a07b6));}};exports[_0x1406('0x46')]=function(_0x5aed89,_0x116fbb){var _0xd2c50c=[_0x1406('0x47')+(_0x116fbb||''),_0x1406('0x48')+_0x5aed89,'',''];return Buffer['from'](_0xd2c50c[_0x1406('0x2c')]('\ 1'),_0x1406('0x49'))[_0x1406('0x4a')]('base64');};
\ No newline at end of file
+var _0x49c2=['Anonymous','pop','isEmpty','anonymous','html','test','replace','includes','<img','attachments','push','filename','_SRC','_IMG','<span\x20style=font-weight:bold>\x20[Attachment:\x20','\x20]</span>','body','textAsHtml','<a\x20target=\x22_blank\x22\x20','originTo','email','originCc','message','bcc','attach','attachment','%s-%s','now','join','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','date','YYYY-MM-DD\x20HH:mm:ss','filter','info','format','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','<p>Empty\x20message</p>','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','moment','randomstring','path','util','node-tnef','../../../config/environment','head','address','generate','@xcally.com','value','name','indexOf','split','length'];(function(_0x32b312,_0x4e3f0f){var _0x313368=function(_0x29143f){while(--_0x29143f){_0x32b312['push'](_0x32b312['shift']());}};_0x313368(++_0x4e3f0f);}(_0x49c2,0x16d));var _0x249c=function(_0x23c550,_0x7e41c4){_0x23c550=_0x23c550-0x0;var _0x5635b1=_0x49c2[_0x23c550];return _0x5635b1;};'use strict';var _=require('lodash');var moment=require(_0x249c('0x0'));var random=require(_0x249c('0x1'));var fs=require('fs');var path=require(_0x249c('0x2'));var util=require(_0x249c('0x3'));var tnef=require(_0x249c('0x4'));var logger=require('../../../config/logger')('email');var config=require(_0x249c('0x5'));function getAddress(_0x3ce53a){var _0x2160d5=_[_0x249c('0x6')](_0x3ce53a['value']);return _0x2160d5&&_0x2160d5[_0x249c('0x7')]?_0x2160d5[_0x249c('0x7')]:'anonymous'+random[_0x249c('0x8')](0x6)+_0x249c('0x9');}function getFirstName(_0x4f45b5){var _0x29b3d1=_[_0x249c('0x6')](_0x4f45b5[_0x249c('0xa')]);if(_0x29b3d1&&_0x29b3d1['name']){if(_0x29b3d1[_0x249c('0xb')]==_0x29b3d1[_0x249c('0x7')]){return _0x29b3d1[_0x249c('0xb')]['substring'](0x0,_0x29b3d1[_0x249c('0xb')][_0x249c('0xc')]('@'));}var _0x51075b=_0x29b3d1[_0x249c('0xb')][_0x249c('0xd')](/\s+/);return _0x51075b[_0x249c('0xe')]>0x1?_0x51075b['slice'](0x0,-0x1)['join']('\x20'):_0x29b3d1[_0x249c('0xb')];}return _0x249c('0xf');}function getLastName(_0x2c8890){var _0x36fc65=_['head'](_0x2c8890[_0x249c('0xa')]);if(_0x36fc65&&_0x36fc65['name']){var _0x1486e1=_0x36fc65[_0x249c('0xb')][_0x249c('0xd')](/\s+/);return _0x1486e1[_0x249c('0xe')]>0x1?_0x1486e1[_0x249c('0x10')]():'';}return'';}function getMails(_0xcf611,_0x2d00f3){var _0x575aca='';for(var _0x33c82c=0x0;_0x33c82c<_0x2d00f3['value']['length'];_0x33c82c+=0x1){if(_0x2d00f3['value'][_0x33c82c][_0x249c('0x7')]!==_0xcf611){if(!_[_0x249c('0x11')](_0x575aca)){_0x575aca+=',';}_0x575aca+=_0x2d00f3['value'][_0x33c82c]['name']||_0x2d00f3[_0x249c('0xa')][_0x33c82c]['address']||'';_0x575aca+='\x20<';_0x575aca+=_0x2d00f3[_0x249c('0xa')][_0x33c82c][_0x249c('0x7')]?_0x2d00f3['value'][_0x33c82c][_0x249c('0x7')]:_0x249c('0x12')+random[_0x249c('0x8')](0x6)+'@xcally.com';_0x575aca+='>';}}return _0x575aca;}function parseEmail(_0x7cd744,_0x466bf2,_0x2dd8cf){if(_0x466bf2[_0x249c('0x13')]){var _0x2c38fe=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;while(_0x2c38fe[_0x249c('0x14')](_0x466bf2[_0x249c('0x13')])){_0x466bf2['html']=_0x466bf2[_0x249c('0x13')][_0x249c('0x15')](_0x2c38fe,'');}if(_0x466bf2[_0x249c('0x13')][_0x249c('0x16')](_0x249c('0x17'))){var _0xe740=[];_0x466bf2[_0x249c('0x18')]['forEach'](_0x38bece=>{_0xe740[_0x249c('0x19')](_0x38bece[_0x249c('0x1a')]);});var _0x4968d7=/<img.*? _SRC(.*?)[^>]+>/g;var _0x1f0993=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x53456a=_0x466bf2[_0x249c('0x13')][_0x249c('0x15')](_0x1f0993,_0x249c('0x1b'));var _0x3a67ed=_0x53456a['replace'](_0x4968d7,_0x249c('0x1c'));for(let _0x2e5628=0x0;_0x2e5628<_0xe740['length'];_0x2e5628++){var _0x53052b=_0x3a67ed[_0x249c('0x15')](_0x249c('0x1c'),_0x249c('0x1d')+_0xe740[_0x2e5628]+_0x249c('0x1e'));_0x3a67ed=_0x53052b;}_0x466bf2[_0x249c('0x13')]=_0x3a67ed;}_0x2dd8cf['body']=_0x466bf2['html'];}else{_0x2dd8cf[_0x249c('0x1f')]=_0x466bf2[_0x249c('0x20')];}if(_0x2dd8cf[_0x249c('0x1f')]){_0x2dd8cf[_0x249c('0x1f')]=_0x2dd8cf['body'][_0x249c('0x15')](/<a\s+/gi,_0x249c('0x21'));}if(_0x466bf2['to']){_0x2dd8cf['message'][_0x249c('0x22')]=getMails(null,_0x466bf2['to']);var _0x11cf8c=getMails(_0x7cd744[_0x249c('0x23')],_0x466bf2['to']);if(!_[_0x249c('0x11')](_0x11cf8c)){_0x2dd8cf['message']['cc']+=_0x11cf8c;}}if(_0x466bf2['cc']){_0x2dd8cf['message'][_0x249c('0x24')]=getMails(null,_0x466bf2['cc']);var _0x28edd3=getMails(_0x7cd744[_0x249c('0x23')],_0x466bf2['cc']);if(!_[_0x249c('0x11')](_0x28edd3)){if(!_['isEmpty'](_0x2dd8cf[_0x249c('0x25')]['cc'])){_0x2dd8cf[_0x249c('0x25')]['cc']+=',';}_0x2dd8cf[_0x249c('0x25')]['cc']+=_0x28edd3;}}if(!_[_0x249c('0x16')](_0x2dd8cf[_0x249c('0x25')][_0x249c('0x22')],_0x7cd744['email'])&&!_[_0x249c('0x16')](_0x2dd8cf[_0x249c('0x25')][_0x249c('0x24')],_0x7cd744[_0x249c('0x23')])){_0x2dd8cf[_0x249c('0x25')][_0x249c('0x26')]=_0x7cd744[_0x249c('0x23')];}if(_0x466bf2[_0x249c('0x18')]&&_0x466bf2[_0x249c('0x18')][_0x249c('0xe')]){_0x2dd8cf[_0x249c('0x25')][_0x249c('0x27')]=_0x466bf2['attachments'][_0x249c('0xe')];for(var _0x5a46af=0x0,_0x34bca0,_0x41d3d1,_0x3ca625;_0x5a46af<_0x466bf2['attachments'][_0x249c('0xe')];_0x5a46af+=0x1){if(_0x466bf2[_0x249c('0x18')][_0x5a46af]['type']===_0x249c('0x28')){_0x3ca625=_0x466bf2[_0x249c('0x18')][_0x5a46af]['filename']||'attachment-'+_0x5a46af;_0x34bca0=util['format'](_0x249c('0x29'),Date[_0x249c('0x2a')](),_0x3ca625);_0x41d3d1=path[_0x249c('0x2b')](config[_0x249c('0x2c')],_0x249c('0x2d'),_0x34bca0);fs[_0x249c('0x2e')](_0x41d3d1,_0x466bf2[_0x249c('0x18')][_0x5a46af][_0x249c('0x2f')]);_0x2dd8cf[_0x249c('0x25')][_0x249c('0x18')][_0x249c('0x19')]({'name':_0x3ca625,'basename':_0x34bca0,'type':_0x466bf2[_0x249c('0x18')][_0x5a46af][_0x249c('0x30')],'filepath':_0x41d3d1});}}}if(_0x466bf2[_0x249c('0x31')]&&_0x466bf2[_0x249c('0x31')][_0x249c('0xe')]>0x0){var _0x52ed85=['Auto-Submitted:\x20auto-replied',_0x249c('0x32'),_0x249c('0x33')];for(var _0xcd5ab5=0x0;_0xcd5ab5<_0x466bf2[_0x249c('0x31')][_0x249c('0xe')];_0xcd5ab5++){var _0xcbef00=_[_0x249c('0xc')](_0x52ed85,_0x466bf2[_0x249c('0x31')][_0xcd5ab5][_0x249c('0x34')]);if(_0xcbef00>=0x0){_0x2dd8cf[_0x249c('0x35')]=!![];}}}return _0x2dd8cf;}exports[_0x249c('0x36')]=function(_0x28729f,_0xdf1322,_0x5bb975){var _0x454565={'from':getAddress(_0xdf1322[_0x249c('0x37')]),'firstName':getFirstName(_0xdf1322[_0x249c('0x37')]),'lastName':getLastName(_0xdf1322[_0x249c('0x37')]),'mapKey':'email','message':{'from':getMails(_0x28729f[_0x249c('0x23')],_0xdf1322[_0x249c('0x37')]),'to':_0x28729f[_0x249c('0x23')],'cc':'','subject':_0xdf1322[_0x249c('0x38')]||'','messageId':_0xdf1322['messageId'],'inReplyTo':_0xdf1322['inReplyTo'],'sentAt':moment(_0xdf1322[_0x249c('0x39')])['format'](_0x249c('0x3a')),'attach':![],'attachments':[]}};if(!_0xdf1322['html']&&!_0xdf1322[_0x249c('0x20')]){var _0x1dcce7=_[_0x249c('0x3b')](_0xdf1322['attachments'],{'contentType':'application/ms-tnef'});if(_0x1dcce7['length']){logger[_0x249c('0x3c')](util[_0x249c('0x3d')](_0x249c('0x3e'),_0xdf1322[_0x249c('0x3f')]));tnef[_0x249c('0x40')](_[_0x249c('0x41')](_0x1dcce7)[_0x249c('0x2f')],function(_0x5b9163,_0x4600d3){if(_0x4600d3){_0xdf1322[_0x249c('0x13')]=_0x4600d3[_0x249c('0x42')]||_0x249c('0x43');if(_0x4600d3[_0x249c('0x44')]){for(var _0x6f187d=0x0;_0x6f187d<_0x4600d3['Attachments']['length'];_0x6f187d++){var _0x5876e9=_0x4600d3[_0x249c('0x44')][_0x6f187d];_0x454565['message'][_0x249c('0x18')]['push']({'filename':_0x5876e9[_0x249c('0x45')],'content':Buffer['from'](_0x5876e9[_0x249c('0x46')])});}}}_0x5bb975(parseEmail(_0x28729f,_0xdf1322,_0x454565));});}else{_0xdf1322['html']=_0x249c('0x43');_0x5bb975(parseEmail(_0x28729f,_0xdf1322,_0x454565));}}else{_0x5bb975(parseEmail(_0x28729f,_0xdf1322,_0x454565));}};exports[_0x249c('0x47')]=function(_0xbaf5f2,_0x59715e){var _0x17ce23=[_0x249c('0x48')+(_0x59715e||''),_0x249c('0x49')+_0xbaf5f2,'',''];return Buffer[_0x249c('0x37')](_0x17ce23[_0x249c('0x2b')]('\ 1'),_0x249c('0x4a'))[_0x249c('0x4b')]('base64');};
\ No newline at end of file
index 5372651..ce0bd24 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfe3f=['Smtp','exports','name','Service','key','SERV','active','Imap'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe3f,0x16a));var _0xffe3=function(_0x1baf7e,_0x3d4ef8){_0x1baf7e=_0x1baf7e-0x0;var _0x19c0a9=_0xfe3f[_0x1baf7e];return _0x19c0a9;};'use strict';var _=require('lodash');function MailAccount(_0x29077b){this['id']=_0x29077b['id']||0x0;this[_0xffe3('0x0')]=_0x29077b['name']||_0xffe3('0x1');this[_0xffe3('0x2')]=_0x29077b[_0xffe3('0x2')]||_0xffe3('0x3');this['active']=_0x29077b[_0xffe3('0x4')]||![];this[_0xffe3('0x5')]=_0x29077b[_0xffe3('0x5')]||[];this[_0xffe3('0x6')]=_0x29077b['Smtp']||[];}module[_0xffe3('0x7')]=MailAccount;
\ No newline at end of file
+var _0x1e69=['active','Imap','Smtp','exports','name','Service','key'];(function(_0xe3ead5,_0x25851d){var _0x42668f=function(_0x431ca5){while(--_0x431ca5){_0xe3ead5['push'](_0xe3ead5['shift']());}};_0x42668f(++_0x25851d);}(_0x1e69,0x9e));var _0x91e6=function(_0x2cc548,_0x1c4c49){_0x2cc548=_0x2cc548-0x0;var _0x1e08c3=_0x1e69[_0x2cc548];return _0x1e08c3;};'use strict';var _=require('lodash');function MailAccount(_0x25ba0d){this['id']=_0x25ba0d['id']||0x0;this['name']=_0x25ba0d[_0x91e6('0x0')]||_0x91e6('0x1');this[_0x91e6('0x2')]=_0x25ba0d['key']||'SERV';this[_0x91e6('0x3')]=_0x25ba0d[_0x91e6('0x3')]||![];this[_0x91e6('0x4')]=_0x25ba0d[_0x91e6('0x4')]||[];this[_0x91e6('0x5')]=_0x25ba0d[_0x91e6('0x5')]||[];}module[_0x91e6('0x6')]=MailAccount;
\ No newline at end of file
index 4ffc7a3..9098e5d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe0f8=['merge','exports','hasOwnProperty','prototype','initMailAccounts','mailAccounts'];(function(_0x47838c,_0x584d33){var _0x407ecd=function(_0x4a8a4e){while(--_0x4a8a4e){_0x47838c['push'](_0x47838c['shift']());}};_0x407ecd(++_0x584d33);}(_0xe0f8,0x6e));var _0x8e0f=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xe0f8[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x1f542f,_0xcba86,_0x31f933){var _0x46edaa=_['mapKeys'](_0x1f542f,function(_0x2aedf1,_0x2d17b0){return _0x2aedf1[_0x31f933];});for(var _0x43fc87 in _0xcba86){if(_0xcba86[_0x8e0f('0x0')](_0x43fc87)){if(!_0x46edaa[_0x43fc87]){delete _0xcba86[_0x43fc87];}}}}Realtime[_0x8e0f('0x1')]['mergeFromDatabase']=function(_0x1df5b0,_0xbcb8bb){for(var _0x48a356 in _0xbcb8bb){if(_0x1df5b0['hasOwnProperty'](_0x48a356)){_0x1df5b0[_0x48a356]=_0xbcb8bb[_0x48a356];}}};Realtime['prototype'][_0x8e0f('0x2')]=function(){var _0x236e1=this;return function(_0x7b477d){if(_0x7b477d){freeIsNotKey(_0x7b477d,_0x236e1[_0x8e0f('0x3')],'id');for(var _0x46cca2=0x0,_0x1b0f09={},_0xf94035={};_0x46cca2<_0x7b477d['length'];_0x46cca2+=0x1){_0x1b0f09=_0x7b477d[_0x46cca2];if(_['isUndefined'](_0x236e1[_0x8e0f('0x3')][_0x1b0f09['id']])){_0x236e1[_0x8e0f('0x3')][_0x1b0f09['id']]=new MailAccount(_0x1b0f09);}else{_[_0x8e0f('0x4')](_0x236e1['mailAccounts'][_0x1b0f09['id']],_0x1b0f09);}}}return _0x236e1['mailAccounts'];};};module[_0x8e0f('0x5')]=Realtime;
\ No newline at end of file
+var _0x9332=['initMailAccounts','isUndefined','mailAccounts','exports','../model/mailAccount','hasOwnProperty','mergeFromDatabase','prototype'];(function(_0x361bb7,_0xad826e){var _0x1743ad=function(_0x4eb2a9){while(--_0x4eb2a9){_0x361bb7['push'](_0x361bb7['shift']());}};_0x1743ad(++_0xad826e);}(_0x9332,0xe4));var _0x2933=function(_0x280e77,_0x20fbee){_0x280e77=_0x280e77-0x0;var _0x2d574d=_0x9332[_0x280e77];return _0x2d574d;};'use strict';var _=require('lodash');var MailAccount=require(_0x2933('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x560909,_0x330f3d,_0x2d776f){var _0x4b183f=_['mapKeys'](_0x560909,function(_0x442a5a,_0x199a92){return _0x442a5a[_0x2d776f];});for(var _0x40fda2 in _0x330f3d){if(_0x330f3d[_0x2933('0x1')](_0x40fda2)){if(!_0x4b183f[_0x40fda2]){delete _0x330f3d[_0x40fda2];}}}}Realtime['prototype'][_0x2933('0x2')]=function(_0x4dd972,_0x4924f0){for(var _0x33be39 in _0x4924f0){if(_0x4dd972[_0x2933('0x1')](_0x33be39)){_0x4dd972[_0x33be39]=_0x4924f0[_0x33be39];}}};Realtime[_0x2933('0x3')][_0x2933('0x4')]=function(){var _0x2fcc8a=this;return function(_0x5421e4){if(_0x5421e4){freeIsNotKey(_0x5421e4,_0x2fcc8a['mailAccounts'],'id');for(var _0xe047b6=0x0,_0x27bc31={},_0x1512c2={};_0xe047b6<_0x5421e4['length'];_0xe047b6+=0x1){_0x27bc31=_0x5421e4[_0xe047b6];if(_[_0x2933('0x5')](_0x2fcc8a[_0x2933('0x6')][_0x27bc31['id']])){_0x2fcc8a[_0x2933('0x6')][_0x27bc31['id']]=new MailAccount(_0x27bc31);}else{_['merge'](_0x2fcc8a['mailAccounts'][_0x27bc31['id']],_0x27bc31);}}}return _0x2fcc8a[_0x2933('0x6')];};};module[_0x2933('0x7')]=Realtime;
\ No newline at end of file
index d2cba8b..8823b4f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3837=['name','type','data5','MailServerOut','Smtp','getMailAccount','notify','Request','NotifyMailAccount','getMailAccounts','GetMailAccount','provider','service','email','active','key','MailServerIn','Imap','CloudProvider'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0x3837,0x1d1));var _0x7383=function(_0x5f25a8,_0x3514c7){_0x5f25a8=_0x5f25a8-0x0;var _0x30fc86=_0x3837[_0x5f25a8];return _0x30fc86;};'use strict';var client=require('../client');exports[_0x7383('0x0')]=function(){return function(){return client['Request'](_0x7383('0x1'),{'options':{'attributes':['id','name',_0x7383('0x2'),_0x7383('0x3'),_0x7383('0x4'),_0x7383('0x5'),_0x7383('0x6'),'ListId','TemplateId'],'raw':![],'include':[{'model':_0x7383('0x7'),'as':_0x7383('0x8'),'include':[{'model':_0x7383('0x9'),'attributes':['id',_0x7383('0xa'),_0x7383('0x3'),_0x7383('0xb'),_0x7383('0xc')],'as':'CloudProvider'}]},{'model':_0x7383('0xd'),'as':_0x7383('0xe'),'include':[{'model':_0x7383('0x9'),'attributes':['id',_0x7383('0xa'),_0x7383('0x3'),_0x7383('0xb'),_0x7383('0xc')],'as':'CloudProvider'}]}]},'log':_0x7383('0xf')});};};exports[_0x7383('0x10')]=function(_0x1d2221,_0x3c29dc){return client[_0x7383('0x11')](_0x7383('0x12'),{'account':{'id':_0x1d2221},'body':_0x3c29dc,'log':_0x7383('0x12')});};
\ No newline at end of file
+var _0xdb28=['provider','service','email','active','key','TemplateId','MailServerIn','name','type','data5','CloudProvider','MailServerOut','Smtp','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount'];(function(_0x372786,_0x287ce6){var _0x3ba245=function(_0x273076){while(--_0x273076){_0x372786['push'](_0x372786['shift']());}};_0x3ba245(++_0x287ce6);}(_0xdb28,0x106));var _0x8db2=function(_0x1b086b,_0x16d278){_0x1b086b=_0x1b086b-0x0;var _0x3a2632=_0xdb28[_0x1b086b];return _0x3a2632;};'use strict';var client=require(_0x8db2('0x0'));exports[_0x8db2('0x1')]=function(){return function(){return client[_0x8db2('0x2')](_0x8db2('0x3'),{'options':{'attributes':['id','name',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'ListId',_0x8db2('0x9')],'raw':![],'include':[{'model':_0x8db2('0xa'),'as':'Imap','include':[{'model':'CloudProvider','attributes':['id',_0x8db2('0xb'),_0x8db2('0x5'),_0x8db2('0xc'),_0x8db2('0xd')],'as':_0x8db2('0xe')}]},{'model':_0x8db2('0xf'),'as':_0x8db2('0x10'),'include':[{'model':'CloudProvider','attributes':['id',_0x8db2('0xb'),_0x8db2('0x5'),_0x8db2('0xc'),'data5'],'as':_0x8db2('0xe')}]}]},'log':_0x8db2('0x11')});};};exports['notify']=function(_0x41beda,_0x3b2faa){return client[_0x8db2('0x2')](_0x8db2('0x12'),{'account':{'id':_0x41beda},'body':_0x3b2faa,'log':_0x8db2('0x12')});};
\ No newline at end of file
index 1621f7e..783c4a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7f15=['getSettings','ShowSetting','loginMailFrequency','../client'];(function(_0x4579d4,_0x668edd){var _0x1ff39e=function(_0x565aee){while(--_0x565aee){_0x4579d4['push'](_0x4579d4['shift']());}};_0x1ff39e(++_0x668edd);}(_0x7f15,0x1e7));var _0x57f1=function(_0x800fe4,_0x3c8a09){_0x800fe4=_0x800fe4-0x0;var _0x263632=_0x7f15[_0x800fe4];return _0x263632;};'use strict';var client=require(_0x57f1('0x0'));exports[_0x57f1('0x1')]=function(){return client['Request'](_0x57f1('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x57f1('0x3')]},'log':'GetSettings'});};
\ No newline at end of file
+var _0x2b1b=['getSettings','loginMailFrequency'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0x2b1b,0x1c4));var _0xb2b1=function(_0x1cbf89,_0x535ef7){_0x1cbf89=_0x1cbf89-0x0;var _0x58e0cf=_0x2b1b[_0x1cbf89];return _0x58e0cf;};'use strict';var client=require('../client');exports[_0xb2b1('0x0')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb2b1('0x1')]},'log':'GetSettings'});};
\ No newline at end of file
index 0c196ce..59ab80e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});};
\ No newline at end of file
+var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});};
\ No newline at end of file
index d4ad9e9..266629e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3305=['listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','lodash','http','express','ioredis','../../config/environment','timeout','listen','socket.io','websocket','localhost','adapter','../../config/express','once'];(function(_0x4eab11,_0x420bfb){var _0x417a63=function(_0x35f378){while(--_0x35f378){_0x4eab11['push'](_0x4eab11['shift']());}};_0x417a63(++_0x420bfb);}(_0x3305,0x169));var _0x5330=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3305[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x5330('0x0'));var http=require(_0x5330('0x1'));var express=require(_0x5330('0x2'));var sticky=require('sticky-session');var Redis=require(_0x5330('0x3'));var config=require(_0x5330('0x4'));var app=express();var server=http['createServer'](app);server[_0x5330('0x5')]=0xdbba0;if(sticky[_0x5330('0x6')](server,config['port'])){var socketio=require(_0x5330('0x7'))(server,{'transports':[_0x5330('0x8'),'polling']});config['redis']=_['defaults'](config['redis'],{'host':_0x5330('0x9'),'port':0x18eb});socketio[_0x5330('0xa')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require('../../config/triggers')['default']();require('../../config/socketio')['default'](socketio);require(_0x5330('0xb'))['default'](app);require('../../routes')['default'](app);}else{server[_0x5330('0xc')](_0x5330('0xd'),function(){console[_0x5330('0xe')](_0x5330('0xf'),config[_0x5330('0x10')]);});}exports=module['exports']=app;
\ No newline at end of file
+var _0x333e=['ioredis','../../config/environment','createServer','listen','port','socket.io','websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','http','express','sticky-session'];(function(_0xe859a3,_0x32f351){var _0x5dbf55=function(_0x3c068f){while(--_0x3c068f){_0xe859a3['push'](_0xe859a3['shift']());}};_0x5dbf55(++_0x32f351);}(_0x333e,0xe3));var _0xe333=function(_0x536128,_0x205e2b){_0x536128=_0x536128-0x0;var _0x19eb75=_0x333e[_0x536128];return _0x19eb75;};'use strict';var _=require('lodash');var http=require(_0xe333('0x0'));var express=require(_0xe333('0x1'));var sticky=require(_0xe333('0x2'));var Redis=require(_0xe333('0x3'));var config=require(_0xe333('0x4'));var app=express();var server=http[_0xe333('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0xe333('0x6')](server,config[_0xe333('0x7')])){var socketio=require(_0xe333('0x8'))(server,{'transports':[_0xe333('0x9'),_0xe333('0xa')]});config[_0xe333('0xb')]=_[_0xe333('0xc')](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0xe333('0xd')](require(_0xe333('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xe333('0xb')])}));require(_0xe333('0xf'))[_0xe333('0x10')]();require('../../config/socketio')[_0xe333('0x10')](socketio);require(_0xe333('0x11'))[_0xe333('0x10')](app);require(_0xe333('0x12'))['default'](app);}else{server[_0xe333('0x13')](_0xe333('0x14'),function(){console[_0xe333('0x15')](_0xe333('0x16'),config[_0xe333('0x7')]);});}exports=module['exports']=app;
\ No newline at end of file
index c3e65f4..83927fa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb45a=['client','http','Request','request','then','debug','rpc','routing','error','message','result','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x4780e6,_0x5bc117){var _0x354c58=function(_0xa6808c){while(--_0xa6808c){_0x4780e6['push'](_0x4780e6['shift']());}};_0x354c58(++_0x5bc117);}(_0xb45a,0x10b));var _0xab45=function(_0x12f4af,_0x4a2bb9){_0x12f4af=_0x12f4af-0x0;var _0x4c4d50=_0xb45a[_0x12f4af];return _0x4c4d50;};'use strict';var jayson=require(_0xab45('0x0'));var BPromise=require(_0xab45('0x1'));var logger=require(_0xab45('0x2'))('routing');var client=jayson[_0xab45('0x3')][_0xab45('0x4')]({'port':0x2329});client[_0xab45('0x5')]=function(_0xa65b7,_0x33065b){return new BPromise(function(_0x289f1f,_0x57adac){return client[_0xab45('0x6')](_0xa65b7,_0x33065b)[_0xab45('0x7')](function(_0x1a1fd6){logger[_0xab45('0x8')](_0xab45('0x9'),_0xab45('0xa'),_0xa65b7,_0x33065b,_0x1a1fd6);if(_0x1a1fd6[_0xab45('0xb')]){logger[_0xab45('0xb')](_0xab45('0x9'),_0xab45('0xa'),_0xa65b7,_0x1a1fd6[_0xab45('0xb')][_0xab45('0xc')],_0x33065b);return _0x57adac(_0x1a1fd6[_0xab45('0xb')][_0xab45('0xc')]);}else{return _0x289f1f(_0x1a1fd6[_0xab45('0xd')]);}})['catch'](function(_0x329f2b){logger[_0xab45('0xb')]('rpc',_0xab45('0xa'),_0xa65b7,_0x329f2b,_0x33065b);return _0x57adac(_0x329f2b);});});};module[_0xab45('0xe')]=client;
\ No newline at end of file
+var _0x02bd=['catch','exports','bluebird','../../config/logger','routing','client','Request','then','debug','rpc','error','message','result'];(function(_0x1bd658,_0x324a17){var _0xef0278=function(_0x46ef49){while(--_0x46ef49){_0x1bd658['push'](_0x1bd658['shift']());}};_0xef0278(++_0x324a17);}(_0x02bd,0xab));var _0xd02b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x02bd[_0x19950b];return _0x3c6b41;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xd02b('0x0'));var logger=require(_0xd02b('0x1'))(_0xd02b('0x2'));var client=jayson[_0xd02b('0x3')]['http']({'port':0x2329});client[_0xd02b('0x4')]=function(_0x4fea99,_0x466152){return new BPromise(function(_0x4dc599,_0x45df72){return client['request'](_0x4fea99,_0x466152)[_0xd02b('0x5')](function(_0x5020b5){logger[_0xd02b('0x6')](_0xd02b('0x7'),_0xd02b('0x2'),_0x4fea99,_0x466152,_0x5020b5);if(_0x5020b5[_0xd02b('0x8')]){logger[_0xd02b('0x8')](_0xd02b('0x7'),_0xd02b('0x2'),_0x4fea99,_0x5020b5[_0xd02b('0x8')][_0xd02b('0x9')],_0x466152);return _0x45df72(_0x5020b5[_0xd02b('0x8')][_0xd02b('0x9')]);}else{return _0x4dc599(_0x5020b5[_0xd02b('0xa')]);}})[_0xd02b('0xb')](function(_0x3cd830){logger[_0xd02b('0x8')](_0xd02b('0x7'),_0xd02b('0x2'),_0x4fea99,_0x3cd830,_0x466152);return _0x45df72(_0x3cd830);});});};module[_0xd02b('0xc')]=client;
\ No newline at end of file
index 63fce37..2e8a257 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x939d=['initSmsQueues','getMailQueues','initFaxQueues','listen','catch','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','initOpenchannelQueues','initChatQueues'];(function(_0x2823fd,_0x5dfcc1){var _0x2f100e=function(_0x125039){while(--_0x125039){_0x2823fd['push'](_0x2823fd['shift']());}};_0x2f100e(++_0x5dfcc1);}(_0x939d,0x14f));var _0xd939=function(_0x3bcdd8,_0x2a47d8){_0x3bcdd8=_0x3bcdd8-0x0;var _0x36d66b=_0x939d[_0x3bcdd8];return _0x36d66b;};'use strict';var BPromise=require(_0xd939('0x0'));var server=require(_0xd939('0x1'));var Realtime=require(_0xd939('0x2'));var user=require(_0xd939('0x3'));var interval=require(_0xd939('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xd939('0x5'));var mailQueue=require(_0xd939('0x6'));var faxQueue=require(_0xd939('0x7'));var whatsappQueue=require(_0xd939('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xd939('0x9')]()[_0xd939('0xa')](user[_0xd939('0xb')]())[_0xd939('0xa')](realtime[_0xd939('0xc')]())[_0xd939('0xa')](interval[_0xd939('0xd')]())[_0xd939('0xa')](realtime[_0xd939('0xe')]())[_0xd939('0xa')](openchannelQueue['getOpenchannelQueues']())[_0xd939('0xa')](realtime[_0xd939('0xf')]())[_0xd939('0xa')](chatQueue['getChatQueues']())[_0xd939('0xa')](realtime[_0xd939('0x10')]())[_0xd939('0xa')](smsQueue['getSmsQueues']())['then'](realtime[_0xd939('0x11')]())[_0xd939('0xa')](mailQueue[_0xd939('0x12')]())[_0xd939('0xa')](realtime['initMailQueues']())['then'](faxQueue['getFaxQueues']())[_0xd939('0xa')](realtime[_0xd939('0x13')]())[_0xd939('0xa')](whatsappQueue['getWhatsappQueues']())[_0xd939('0xa')](realtime['initWhatsappQueues']())[_0xd939('0xa')](function(){return realtime;});}function main(){return server[_0xd939('0x14')](realtime)[_0xd939('0xa')](function(_0x4a5473){return initRealtime();})[_0xd939('0xa')](function(_0x491b21){return setInterval(initRealtime,0x1388);})[_0xd939('0x15')](function(_0x5320dd){console['log'](_0x5320dd);});}main();
\ No newline at end of file
+var _0x1ff7=['./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','getOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue'];(function(_0x3c3d59,_0x369b04){var _0x25d467=function(_0x991667){while(--_0x991667){_0x3c3d59['push'](_0x3c3d59['shift']());}};_0x25d467(++_0x369b04);}(_0x1ff7,0x19c));var _0x71ff=function(_0x2fbdb4,_0xb0e63d){_0x2fbdb4=_0x2fbdb4-0x0;var _0x44b033=_0x1ff7[_0x2fbdb4];return _0x44b033;};'use strict';var BPromise=require(_0x71ff('0x0'));var server=require(_0x71ff('0x1'));var Realtime=require(_0x71ff('0x2'));var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require(_0x71ff('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x71ff('0x4'));var mailQueue=require(_0x71ff('0x5'));var faxQueue=require(_0x71ff('0x6'));var whatsappQueue=require(_0x71ff('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x71ff('0x8')]()[_0x71ff('0x9')](user[_0x71ff('0xa')]())[_0x71ff('0x9')](realtime['initAgents']())[_0x71ff('0x9')](interval[_0x71ff('0xb')]())[_0x71ff('0x9')](realtime['initIntervals']())[_0x71ff('0x9')](openchannelQueue[_0x71ff('0xc')]())[_0x71ff('0x9')](realtime['initOpenchannelQueues']())['then'](chatQueue['getChatQueues']())['then'](realtime[_0x71ff('0xd')]())[_0x71ff('0x9')](smsQueue[_0x71ff('0xe')]())['then'](realtime[_0x71ff('0xf')]())[_0x71ff('0x9')](mailQueue[_0x71ff('0x10')]())[_0x71ff('0x9')](realtime['initMailQueues']())[_0x71ff('0x9')](faxQueue[_0x71ff('0x11')]())[_0x71ff('0x9')](realtime[_0x71ff('0x12')]())[_0x71ff('0x9')](whatsappQueue['getWhatsappQueues']())[_0x71ff('0x9')](realtime[_0x71ff('0x13')]())[_0x71ff('0x9')](function(){return realtime;});}function main(){return server[_0x71ff('0x14')](realtime)[_0x71ff('0x9')](function(_0x4fcbfb){return initRealtime();})['then'](function(_0x5ee2bb){return setInterval(initRealtime,0x1388);})[_0x71ff('0x15')](function(_0x12e34c){console['log'](_0x12e34c);});}main();
\ No newline at end of file
index 09fd7d6..16b2f47 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x60fb10,_0xd27019){var _0x1de1ef=function(_0x3e0eda){while(--_0x3e0eda){_0x60fb10['push'](_0x60fb10['shift']());}};_0x1de1ef(++_0xd27019);}(_0x326f,0xd1));var _0xf326=function(_0x2c10fb,_0x82c254){_0x2c10fb=_0x2c10fb-0x0;var _0x5b909b=_0x326f[_0x2c10fb];return _0x5b909b;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine;
\ No newline at end of file
+var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x4a7389,_0xa99bd9){var _0x246ee8=function(_0x29cbb0){while(--_0x29cbb0){_0x4a7389['push'](_0x4a7389['shift']());}};_0x246ee8(++_0xa99bd9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x5fc3[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine;
\ No newline at end of file
index 5bd5d3a..433c5d9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x397e=['request','error','result','catch','SendMail','jayson/promise','client'];(function(_0x2aa922,_0x5335c4){var _0x4d9469=function(_0x33e4f6){while(--_0x33e4f6){_0x2aa922['push'](_0x2aa922['shift']());}};_0x4d9469(++_0x5335c4);}(_0x397e,0x139));var _0xe397=function(_0x5dee2a,_0x47d02a){_0x5dee2a=_0x5dee2a-0x0;var _0x31e98e=_0x397e[_0x5dee2a];return _0x31e98e;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xe397('0x0'));var client=jayson[_0xe397('0x1')]['http']({'port':0x232b});function request(_0x46cec4,_0x4cdee5){return new BPromise(function(_0x17f652,_0x4e6857){return client[_0xe397('0x2')](_0x46cec4,_0x4cdee5)['then'](function(_0x4ec7bf){if(_0x4ec7bf[_0xe397('0x3')]){return _0x4e6857(_0x4ec7bf[_0xe397('0x3')]['message']);}else{return _0x17f652(_0x4ec7bf[_0xe397('0x4')]);}})[_0xe397('0x5')](function(_0x3222f8){return _0x4e6857(_0x3222f8);});});}exports['sendMailMessage']=function(_0xc4cfd7,_0xb0585d){return request(_0xe397('0x6'),{'account':_0xc4cfd7,'message':_0xb0585d});};
\ No newline at end of file
+var _0xae96=['bluebird','jayson/promise','error','result','catch','sendMailMessage','SendMail'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xae96,0xfc));var _0x6ae9=function(_0x2dd268,_0x20af9){_0x2dd268=_0x2dd268-0x0;var _0xd65986=_0xae96[_0x2dd268];return _0xd65986;};'use strict';var BPromise=require(_0x6ae9('0x0'));var jayson=require(_0x6ae9('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x2db1f7,_0x1ec32c){return new BPromise(function(_0x4b8fe5,_0x21d35e){return client['request'](_0x2db1f7,_0x1ec32c)['then'](function(_0x42f6b2){if(_0x42f6b2[_0x6ae9('0x2')]){return _0x21d35e(_0x42f6b2[_0x6ae9('0x2')]['message']);}else{return _0x4b8fe5(_0x42f6b2[_0x6ae9('0x3')]);}})[_0x6ae9('0x4')](function(_0x2a4c0b){return _0x21d35e(_0x2a4c0b);});});}exports[_0x6ae9('0x5')]=function(_0x41208c,_0x365db3){return request(_0x6ae9('0x6'),{'account':_0x41208c,'message':_0x365db3});};
\ No newline at end of file
index d2f8b8f..f005c12 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf5c4=['mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','Capacity','CurrentCapacity','maxcapacity','working','mail','chat','openchannel','whatsapp','length','Status','StatusTime','toNumber','format','smsStatusTime','busy','stringify','emit','exports','lodash','moment','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity'];(function(_0x32f306,_0x26019e){var _0x4115b2=function(_0x2af679){while(--_0x2af679){_0x32f306['push'](_0x32f306['shift']());}};_0x4115b2(++_0x26019e);}(_0xf5c4,0x1c4));var _0x4f5c=function(_0x42c784,_0x5e25c9){_0x42c784=_0x42c784-0x0;var _0x5889d3=_0xf5c4[_0x42c784];return _0x5889d3;};'use strict';var _=require(_0x4f5c('0x0'));var moment=require(_0x4f5c('0x1'));var md5=require(_0x4f5c('0x2'));var Redis=require('ioredis');var config=require(_0x4f5c('0x3'));config['redis']=_['defaults'](config[_0x4f5c('0x4')],{'host':_0x4f5c('0x5'),'port':0x18eb});var io=require(_0x4f5c('0x6'))(new Redis(config[_0x4f5c('0x4')]));function Agent(_0x1c6c45){this['id']=_0x1c6c45['id']||0x0;this['name']=_0x1c6c45[_0x4f5c('0x7')]||'';this[_0x4f5c('0x8')]=_0x1c6c45['online']||!![];this[_0x4f5c('0x9')]=_0x1c6c45[_0x4f5c('0x9')]||![];this[_0x4f5c('0xa')]=_0x1c6c45[_0x4f5c('0xa')]||![];this[_0x4f5c('0xb')]=_0x1c6c45['mailPause']||![];this[_0x4f5c('0xc')]=_0x1c6c45['faxPause']||![];this[_0x4f5c('0xd')]=_0x1c6c45[_0x4f5c('0xd')]||![];this['openchannelPause']=_0x1c6c45[_0x4f5c('0xe')]||![];this[_0x4f5c('0xf')]=_0x4f5c('0x10');this[_0x4f5c('0x11')]=0x0;this[_0x4f5c('0x12')]=_0x1c6c45[_0x4f5c('0x12')]||0x0;this[_0x4f5c('0x13')]=0x0;this[_0x4f5c('0x14')]=_0x4f5c('0x10');this[_0x4f5c('0x15')]=0x0;this[_0x4f5c('0x16')]=_0x1c6c45[_0x4f5c('0x16')]||0x0;this[_0x4f5c('0x17')]=0x0;this[_0x4f5c('0x18')]=_0x4f5c('0x10');this[_0x4f5c('0x19')]=0x0;this[_0x4f5c('0x1a')]=_0x1c6c45[_0x4f5c('0x1a')]||0x0;this[_0x4f5c('0x1b')]=0x0;this[_0x4f5c('0x1c')]=_0x4f5c('0x10');this['smsStatusTime']=0x0;this[_0x4f5c('0x1d')]=_0x1c6c45[_0x4f5c('0x1d')]||0x0;this[_0x4f5c('0x1e')]=0x0;this[_0x4f5c('0x1f')]='unknown';this[_0x4f5c('0x20')]=0x0;this['whatsappCapacity']=_0x1c6c45[_0x4f5c('0x21')]||0x0;this[_0x4f5c('0x22')]=0x0;this['openchannelStatus']=_0x4f5c('0x10');this[_0x4f5c('0x23')]=0x0;this[_0x4f5c('0x24')]=_0x1c6c45[_0x4f5c('0x24')]||0x0;this[_0x4f5c('0x25')]=0x0;this['busy']=![];this[_0x4f5c('0x26')]=undefined;this[_0x4f5c('0x2')]='';this[_0x4f5c('0x27')]();}Agent[_0x4f5c('0x28')]['getChannelStatus']=function(_0x1b5bc0){if(this[_0x1b5bc0+'CurrentCapacity']>0x0){if(this[_0x1b5bc0+_0x4f5c('0x29')]>0x0&&this[_0x1b5bc0+_0x4f5c('0x2a')]>=this[_0x1b5bc0+_0x4f5c('0x29')]){return _0x4f5c('0x2b');}else{return _0x4f5c('0x2c');}}else{return'idle';}};Agent['prototype'][_0x4f5c('0x27')]=function(){var _0x552539=[_0x4f5c('0x2d'),_0x4f5c('0x2e'),_0x4f5c('0x2f'),'fax','sms',_0x4f5c('0x30')];for(var _0x26662c=0x0;_0x26662c<_0x552539[_0x4f5c('0x31')];_0x26662c+=0x1){var _0x47c752=this['getChannelStatus'](_0x552539[_0x26662c]);if(this[_0x552539[_0x26662c]+_0x4f5c('0x32')]!==_0x47c752){this[_0x552539[_0x26662c]+_0x4f5c('0x33')]=_[_0x4f5c('0x34')](moment()[_0x4f5c('0x35')]('x'));}this[_0x552539[_0x26662c]+_0x4f5c('0x32')]=_0x47c752;}var _0x4af8a1={'id':this['id'],'name':this[_0x4f5c('0x7')],'online':this[_0x4f5c('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0x4f5c('0xa')],'mailPause':this[_0x4f5c('0xb')],'smsPause':this[_0x4f5c('0xd')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x4f5c('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x4f5c('0x12')],'chatCurrentCapacity':this[_0x4f5c('0x13')],'mailStatus':this[_0x4f5c('0x14')],'mailStatusTime':this[_0x4f5c('0x15')],'mailCapacity':this[_0x4f5c('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x4f5c('0x18')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x4f5c('0x1a')],'faxCurrentCapacity':this[_0x4f5c('0x1b')],'smsStatus':this[_0x4f5c('0x1c')],'smsStatusTime':this[_0x4f5c('0x36')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x4f5c('0x1f')],'whatsappStatusTime':this[_0x4f5c('0x20')],'whatsappCapacity':this[_0x4f5c('0x21')],'whatsappCurrentCapacity':this[_0x4f5c('0x22')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x4f5c('0x23')],'openchannelCapacity':this[_0x4f5c('0x24')],'openchannelCurrentCapacity':this[_0x4f5c('0x25')],'busy':this[_0x4f5c('0x37')],'busyQueue':this[_0x4f5c('0x26')]};var _0x363b76=md5(JSON[_0x4f5c('0x38')](_0x4af8a1));if(this['md5']!==_0x363b76){this[_0x4f5c('0x2')]=_0x363b76;io[_0x4f5c('0x39')]('user:save',_0x4af8a1);}};module[_0x4f5c('0x3a')]=Agent;
\ No newline at end of file
+var _0x7957=['openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','mail','chat','openchannel','fax','sms','Status','toNumber','format','chatCurrentCapacity','mailStatus','faxCurrentCapacity','whatsappCurrentCapacity','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','mailStatusTime','mailCapacity','faxStatus','unknown','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatusTime','openchannelCapacity'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7957,0x8b));var _0x7795=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x7957[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0x7795('0x0'));var moment=require(_0x7795('0x1'));var md5=require(_0x7795('0x2'));var Redis=require(_0x7795('0x3'));var config=require(_0x7795('0x4'));config[_0x7795('0x5')]=_[_0x7795('0x6')](config[_0x7795('0x5')],{'host':_0x7795('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x4dc804){this['id']=_0x4dc804['id']||0x0;this[_0x7795('0x8')]=_0x4dc804[_0x7795('0x8')]||'';this[_0x7795('0x9')]=_0x4dc804[_0x7795('0x9')]||!![];this['voicePause']=_0x4dc804[_0x7795('0xa')]||![];this['chatPause']=_0x4dc804[_0x7795('0xb')]||![];this[_0x7795('0xc')]=_0x4dc804[_0x7795('0xc')]||![];this[_0x7795('0xd')]=_0x4dc804[_0x7795('0xd')]||![];this[_0x7795('0xe')]=_0x4dc804[_0x7795('0xe')]||![];this[_0x7795('0xf')]=_0x4dc804[_0x7795('0xf')]||![];this[_0x7795('0x10')]='unknown';this[_0x7795('0x11')]=0x0;this[_0x7795('0x12')]=_0x4dc804['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']='unknown';this[_0x7795('0x13')]=0x0;this[_0x7795('0x14')]=_0x4dc804[_0x7795('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x7795('0x15')]=_0x7795('0x16');this['faxStatusTime']=0x0;this[_0x7795('0x17')]=_0x4dc804['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0x7795('0x18')]=_0x7795('0x16');this['smsStatusTime']=0x0;this['smsCapacity']=_0x4dc804[_0x7795('0x19')]||0x0;this[_0x7795('0x1a')]=0x0;this[_0x7795('0x1b')]=_0x7795('0x16');this[_0x7795('0x1c')]=0x0;this['whatsappCapacity']=_0x4dc804[_0x7795('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']='unknown';this[_0x7795('0x1e')]=0x0;this['openchannelCapacity']=_0x4dc804[_0x7795('0x1f')]||0x0;this[_0x7795('0x20')]=0x0;this[_0x7795('0x21')]=![];this[_0x7795('0x22')]=undefined;this['md5']='';this[_0x7795('0x23')]();}Agent[_0x7795('0x24')][_0x7795('0x25')]=function(_0x2af269){if(this[_0x2af269+_0x7795('0x26')]>0x0){if(this[_0x2af269+_0x7795('0x27')]>0x0&&this[_0x2af269+_0x7795('0x26')]>=this[_0x2af269+_0x7795('0x27')]){return _0x7795('0x28');}else{return'working';}}else{return'idle';}};Agent[_0x7795('0x24')][_0x7795('0x23')]=function(){var _0x522277=[_0x7795('0x29'),_0x7795('0x2a'),_0x7795('0x2b'),_0x7795('0x2c'),_0x7795('0x2d'),'whatsapp'];for(var _0x3bca65=0x0;_0x3bca65<_0x522277['length'];_0x3bca65+=0x1){var _0x1db8b8=this[_0x7795('0x25')](_0x522277[_0x3bca65]);if(this[_0x522277[_0x3bca65]+_0x7795('0x2e')]!==_0x1db8b8){this[_0x522277[_0x3bca65]+'StatusTime']=_[_0x7795('0x2f')](moment()[_0x7795('0x30')]('x'));}this[_0x522277[_0x3bca65]+_0x7795('0x2e')]=_0x1db8b8;}var _0x4f78b0={'id':this['id'],'name':this[_0x7795('0x8')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x7795('0xb')],'mailPause':this[_0x7795('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x7795('0xd')],'openchannelPause':this[_0x7795('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x7795('0x11')],'chatCapacity':this[_0x7795('0x12')],'chatCurrentCapacity':this[_0x7795('0x31')],'mailStatus':this[_0x7795('0x32')],'mailStatusTime':this[_0x7795('0x13')],'mailCapacity':this[_0x7795('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x7795('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x7795('0x17')],'faxCurrentCapacity':this[_0x7795('0x33')],'smsStatus':this[_0x7795('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x7795('0x19')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x7795('0x1b')],'whatsappStatusTime':this[_0x7795('0x1c')],'whatsappCapacity':this[_0x7795('0x1d')],'whatsappCurrentCapacity':this[_0x7795('0x34')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x7795('0x1e')],'openchannelCapacity':this[_0x7795('0x1f')],'openchannelCurrentCapacity':this[_0x7795('0x20')],'busy':this[_0x7795('0x21')],'busyQueue':this[_0x7795('0x22')]};var _0x1276b0=md5(JSON[_0x7795('0x35')](_0x4f78b0));if(this[_0x7795('0x2')]!==_0x1276b0){this[_0x7795('0x2')]=_0x1276b0;io[_0x7795('0x36')](_0x7795('0x37'),_0x4f78b0);}};module[_0x7795('0x38')]=Agent;
\ No newline at end of file
index 56ec528..d271801 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7e5a=['map','loggedIn','paused','length','online','chatPause','available','waiting','format','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr'];(function(_0x2d48e1,_0x1fb6f6){var _0x2edb4e=function(_0x522c62){while(--_0x522c62){_0x2d48e1['push'](_0x2d48e1['shift']());}};_0x2edb4e(++_0x1fb6f6);}(_0x7e5a,0x167));var _0xa7e5=function(_0x58a0a9,_0x47e2d6){_0x58a0a9=_0x58a0a9-0x0;var _0x29992b=_0x7e5a[_0x58a0a9];return _0x29992b;};'use strict';var _=require(_0xa7e5('0x0'));var md5=require(_0xa7e5('0x1'));var util=require(_0xa7e5('0x2'));var Redis=require(_0xa7e5('0x3'));var config=require(_0xa7e5('0x4'));config[_0xa7e5('0x5')]=_[_0xa7e5('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa7e5('0x7'))(new Redis(config[_0xa7e5('0x5')]));function ChatQueue(_0x174f45){this['id']=_0x174f45['id']||0x0;this[_0xa7e5('0x8')]=_0x174f45[_0xa7e5('0x8')]||'';this[_0xa7e5('0x9')]=_0x174f45[_0xa7e5('0x9')]||0xa;this[_0xa7e5('0xa')]=_0x174f45[_0xa7e5('0xa')]||_0xa7e5('0xb');this[_0xa7e5('0xc')]=_0x174f45[_0xa7e5('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xa7e5('0x1')]='';this[_0xa7e5('0xd')]();this[_0xa7e5('0xe')]();}ChatQueue[_0xa7e5('0xf')][_0xa7e5('0xd')]=function(){var _0x8b94fc=this[_0xa7e5('0x10')][_0xa7e5('0x11')];this[_0xa7e5('0x10')]=_[_0xa7e5('0x12')](this[_0xa7e5('0xc')],'id');this['mapAgentsId'][_0xa7e5('0x11')]=_0x8b94fc;};ChatQueue[_0xa7e5('0xf')]['updateRealtime']=function(){this[_0xa7e5('0x13')]=0x0;this[_0xa7e5('0x14')]=0x0;for(var _0x950f02=0x0;_0x950f02<this['Agents'][_0xa7e5('0x15')];_0x950f02+=0x1){if(this[_0xa7e5('0xc')][_0x950f02][_0xa7e5('0x16')]){this[_0xa7e5('0x13')]+=0x1;}if(this[_0xa7e5('0xc')][_0x950f02][_0xa7e5('0x17')]){this[_0xa7e5('0x14')]+=0x1;}}this['available']=this[_0xa7e5('0x13')]-this[_0xa7e5('0x14')];this[_0xa7e5('0x18')]=this[_0xa7e5('0x18')]>=0x0?this[_0xa7e5('0x18')]:0x0;var _0xeb5f7={'id':this['id'],'available':this[_0xa7e5('0x18')],'loggedIn':this[_0xa7e5('0x13')],'name':this[_0xa7e5('0x8')],'paused':this[_0xa7e5('0x14')],'waiting':this[_0xa7e5('0x19')]};var _0x33b5cd=md5(JSON['stringify'](_0xeb5f7));if(this[_0xa7e5('0x1')]!==_0x33b5cd){this[_0xa7e5('0x1')]=_0x33b5cd;io['to'](util[_0xa7e5('0x1a')]('chat:queue:%s',_0xeb5f7[_0xa7e5('0x8')]))['emit'](_0xa7e5('0x1b'),_0xeb5f7);}};module[_0xa7e5('0x1c')]=ChatQueue;
\ No newline at end of file
+var _0xf0e3=['ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','chatPause','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0xf0e3,0xf5));var _0x3f0e=function(_0x36ad97,_0x58f25a){_0x36ad97=_0x36ad97-0x0;var _0x5533b1=_0xf0e3[_0x36ad97];return _0x5533b1;};'use strict';var _=require(_0x3f0e('0x0'));var md5=require(_0x3f0e('0x1'));var util=require(_0x3f0e('0x2'));var Redis=require(_0x3f0e('0x3'));var config=require('../../../config/environment');config[_0x3f0e('0x4')]=_['defaults'](config['redis'],{'host':_0x3f0e('0x5'),'port':0x18eb});var io=require(_0x3f0e('0x6'))(new Redis(config[_0x3f0e('0x4')]));function ChatQueue(_0x32d86b){this['id']=_0x32d86b['id']||0x0;this[_0x3f0e('0x7')]=_0x32d86b[_0x3f0e('0x7')]||'';this[_0x3f0e('0x8')]=_0x32d86b[_0x3f0e('0x8')]||0xa;this[_0x3f0e('0x9')]=_0x32d86b[_0x3f0e('0x9')]||_0x3f0e('0xa');this['Agents']=_0x32d86b[_0x3f0e('0xb')];this[_0x3f0e('0xc')]={};this['waiting']=0x0;this[_0x3f0e('0x1')]='';this[_0x3f0e('0xd')]();this[_0x3f0e('0xe')]();}ChatQueue[_0x3f0e('0xf')]['updateRouting']=function(){var _0x913b3a=this[_0x3f0e('0xc')]['_rr'];this[_0x3f0e('0xc')]=_[_0x3f0e('0x10')](this[_0x3f0e('0xb')],'id');this[_0x3f0e('0xc')][_0x3f0e('0x11')]=_0x913b3a;};ChatQueue['prototype']['updateRealtime']=function(){this[_0x3f0e('0x12')]=0x0;this[_0x3f0e('0x13')]=0x0;for(var _0x1f6b90=0x0;_0x1f6b90<this[_0x3f0e('0xb')][_0x3f0e('0x14')];_0x1f6b90+=0x1){if(this[_0x3f0e('0xb')][_0x1f6b90][_0x3f0e('0x15')]){this[_0x3f0e('0x12')]+=0x1;}if(this[_0x3f0e('0xb')][_0x1f6b90][_0x3f0e('0x16')]){this[_0x3f0e('0x13')]+=0x1;}}this[_0x3f0e('0x17')]=this[_0x3f0e('0x12')]-this[_0x3f0e('0x13')];this[_0x3f0e('0x17')]=this[_0x3f0e('0x17')]>=0x0?this['available']:0x0;var _0x558295={'id':this['id'],'available':this[_0x3f0e('0x17')],'loggedIn':this[_0x3f0e('0x12')],'name':this[_0x3f0e('0x7')],'paused':this[_0x3f0e('0x13')],'waiting':this[_0x3f0e('0x18')]};var _0x436151=md5(JSON[_0x3f0e('0x19')](_0x558295));if(this[_0x3f0e('0x1')]!==_0x436151){this[_0x3f0e('0x1')]=_0x436151;io['to'](util[_0x3f0e('0x1a')](_0x3f0e('0x1b'),_0x558295['name']))[_0x3f0e('0x1c')](_0x3f0e('0x1d'),_0x558295);}};module[_0x3f0e('0x1e')]=ChatQueue;
\ No newline at end of file
index 1c04fe3..7958f03 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6af6=['localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','loggedIn','length','online','faxPause','paused','available','waiting','stringify','format','fax:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0x6af6,0x1f1));var _0x66af=function(_0x3e993f,_0x289a74){_0x3e993f=_0x3e993f-0x0;var _0x7629b7=_0x6af6[_0x3e993f];return _0x7629b7;};'use strict';var _=require(_0x66af('0x0'));var md5=require(_0x66af('0x1'));var util=require(_0x66af('0x2'));var Redis=require(_0x66af('0x3'));var config=require(_0x66af('0x4'));config['redis']=_[_0x66af('0x5')](config[_0x66af('0x6')],{'host':_0x66af('0x7'),'port':0x18eb});var io=require(_0x66af('0x8'))(new Redis(config['redis']));function FaxQueue(_0x4ad61d){this['id']=_0x4ad61d['id']||0x0;this[_0x66af('0x9')]=_0x4ad61d['name']||'';this['timeout']=_0x4ad61d[_0x66af('0xa')]||0xa;this[_0x66af('0xb')]=_0x4ad61d[_0x66af('0xb')]||'beepall';this['Agents']=_0x4ad61d[_0x66af('0xc')];this[_0x66af('0xd')]={};this['waiting']=0x0;this[_0x66af('0x1')]='';this[_0x66af('0xe')]();this[_0x66af('0xf')]();}FaxQueue['prototype']['updateRouting']=function(){var _0xf63ef7=this[_0x66af('0xd')]['_rr'];this[_0x66af('0xd')]=_['map'](this[_0x66af('0xc')],'id');this[_0x66af('0xd')]['_rr']=_0xf63ef7;};FaxQueue['prototype']['updateRealtime']=function(){this[_0x66af('0x10')]=0x0;this['paused']=0x0;for(var _0x22d788=0x0;_0x22d788<this[_0x66af('0xc')][_0x66af('0x11')];_0x22d788+=0x1){if(this[_0x66af('0xc')][_0x22d788][_0x66af('0x12')]){this[_0x66af('0x10')]+=0x1;}if(this[_0x66af('0xc')][_0x22d788][_0x66af('0x13')]){this[_0x66af('0x14')]+=0x1;}}this['available']=this['loggedIn']-this[_0x66af('0x14')];this[_0x66af('0x15')]=this[_0x66af('0x15')]>=0x0?this[_0x66af('0x15')]:0x0;var _0x57ca04={'id':this['id'],'available':this['available'],'loggedIn':this[_0x66af('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x66af('0x16')]};var _0x3de9b7=md5(JSON[_0x66af('0x17')](_0x57ca04));if(this['md5']!==_0x3de9b7){this[_0x66af('0x1')]=_0x3de9b7;io['to'](util[_0x66af('0x18')](_0x66af('0x19'),_0x57ca04[_0x66af('0x9')]))[_0x66af('0x1a')]('fax_queue:save',_0x57ca04);}};module[_0x66af('0x1b')]=FaxQueue;
\ No newline at end of file
+var _0x5128=['length','faxPause','available','format','fax:queue:%s','fax_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused'];(function(_0x2d3005,_0x2f77f7){var _0x59fa64=function(_0x2b5000){while(--_0x2b5000){_0x2d3005['push'](_0x2d3005['shift']());}};_0x59fa64(++_0x2f77f7);}(_0x5128,0xb5));var _0x8512=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x5128[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0x8512('0x0'));var md5=require(_0x8512('0x1'));var util=require('util');var Redis=require(_0x8512('0x2'));var config=require(_0x8512('0x3'));config['redis']=_[_0x8512('0x4')](config[_0x8512('0x5')],{'host':_0x8512('0x6'),'port':0x18eb});var io=require(_0x8512('0x7'))(new Redis(config['redis']));function FaxQueue(_0x15c6ae){this['id']=_0x15c6ae['id']||0x0;this[_0x8512('0x8')]=_0x15c6ae['name']||'';this[_0x8512('0x9')]=_0x15c6ae[_0x8512('0x9')]||0xa;this[_0x8512('0xa')]=_0x15c6ae[_0x8512('0xa')]||_0x8512('0xb');this[_0x8512('0xc')]=_0x15c6ae[_0x8512('0xc')];this[_0x8512('0xd')]={};this[_0x8512('0xe')]=0x0;this[_0x8512('0x1')]='';this[_0x8512('0xf')]();this[_0x8512('0x10')]();}FaxQueue[_0x8512('0x11')][_0x8512('0xf')]=function(){var _0x1e7d56=this['mapAgentsId'][_0x8512('0x12')];this[_0x8512('0xd')]=_[_0x8512('0x13')](this[_0x8512('0xc')],'id');this[_0x8512('0xd')]['_rr']=_0x1e7d56;};FaxQueue['prototype']['updateRealtime']=function(){this[_0x8512('0x14')]=0x0;this[_0x8512('0x15')]=0x0;for(var _0x233d31=0x0;_0x233d31<this[_0x8512('0xc')][_0x8512('0x16')];_0x233d31+=0x1){if(this[_0x8512('0xc')][_0x233d31]['online']){this[_0x8512('0x14')]+=0x1;}if(this[_0x8512('0xc')][_0x233d31][_0x8512('0x17')]){this['paused']+=0x1;}}this[_0x8512('0x18')]=this[_0x8512('0x14')]-this[_0x8512('0x15')];this['available']=this['available']>=0x0?this['available']:0x0;var _0x3ddca2={'id':this['id'],'available':this[_0x8512('0x18')],'loggedIn':this[_0x8512('0x14')],'name':this[_0x8512('0x8')],'paused':this[_0x8512('0x15')],'waiting':this['waiting']};var _0x200c69=md5(JSON['stringify'](_0x3ddca2));if(this['md5']!==_0x200c69){this[_0x8512('0x1')]=_0x200c69;io['to'](util[_0x8512('0x19')](_0x8512('0x1a'),_0x3ddca2['name']))['emit'](_0x8512('0x1b'),_0x3ddca2);}};module[_0x8512('0x1c')]=FaxQueue;
\ No newline at end of file
index 0251926..0fe20bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc486=['exports','name','Intervals'];(function(_0x403742,_0x3a695a){var _0x2462e5=function(_0x3334ea){while(--_0x3334ea){_0x403742['push'](_0x403742['shift']());}};_0x2462e5(++_0x3a695a);}(_0xc486,0xf4));var _0x6c48=function(_0x1aa8e4,_0x422beb){_0x1aa8e4=_0x1aa8e4-0x0;var _0x335a4d=_0xc486[_0x1aa8e4];return _0x335a4d;};'use strict';function Interval(_0x31771c){this['id']=_0x31771c['id']||0x0;this[_0x6c48('0x0')]=_0x31771c[_0x6c48('0x0')]||'';this['Intervals']=_0x31771c[_0x6c48('0x1')]||{};}module[_0x6c48('0x2')]=Interval;
\ No newline at end of file
+var _0x01f7=['Intervals','exports','name'];(function(_0x38891a,_0x421328){var _0x1e0ef7=function(_0x51f160){while(--_0x51f160){_0x38891a['push'](_0x38891a['shift']());}};_0x1e0ef7(++_0x421328);}(_0x01f7,0x95));var _0x701f=function(_0x5457a1,_0x2478b3){_0x5457a1=_0x5457a1-0x0;var _0x52ad60=_0x01f7[_0x5457a1];return _0x52ad60;};'use strict';function Interval(_0x4bcfe3){this['id']=_0x4bcfe3['id']||0x0;this[_0x701f('0x0')]=_0x4bcfe3[_0x701f('0x0')]||'';this[_0x701f('0x1')]=_0x4bcfe3[_0x701f('0x1')]||{};}module[_0x701f('0x2')]=Interval;
\ No newline at end of file
index 00cda76..6aab76d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb91e=['online','loggedIn','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','_rr','prototype','updateRealtime','paused','length'];(function(_0x4cbfd1,_0x131420){var _0x55c634=function(_0x4400a5){while(--_0x4400a5){_0x4cbfd1['push'](_0x4cbfd1['shift']());}};_0x55c634(++_0x131420);}(_0xb91e,0x79));var _0xeb91=function(_0x432893,_0x228946){_0x432893=_0x432893-0x0;var _0x58bb0b=_0xb91e[_0x432893];return _0x58bb0b;};'use strict';var _=require(_0xeb91('0x0'));var md5=require(_0xeb91('0x1'));var util=require(_0xeb91('0x2'));var Redis=require(_0xeb91('0x3'));var config=require('../../../config/environment');config[_0xeb91('0x4')]=_['defaults'](config[_0xeb91('0x4')],{'host':_0xeb91('0x5'),'port':0x18eb});var io=require(_0xeb91('0x6'))(new Redis(config['redis']));function MailQueue(_0x3f14cd){this['id']=_0x3f14cd['id']||0x0;this[_0xeb91('0x7')]=_0x3f14cd[_0xeb91('0x7')]||'';this['timeout']=_0x3f14cd[_0xeb91('0x8')]||0xa;this[_0xeb91('0x9')]=_0x3f14cd[_0xeb91('0x9')]||_0xeb91('0xa');this[_0xeb91('0xb')]=_0x3f14cd[_0xeb91('0xb')];this[_0xeb91('0xc')]={};this['waiting']=0x0;this[_0xeb91('0x1')]='';this[_0xeb91('0xd')]();this['updateRealtime']();}MailQueue['prototype']['updateRouting']=function(){var _0x59627f=this[_0xeb91('0xc')]['_rr'];this[_0xeb91('0xc')]=_['map'](this['Agents'],'id');this[_0xeb91('0xc')][_0xeb91('0xe')]=_0x59627f;};MailQueue[_0xeb91('0xf')][_0xeb91('0x10')]=function(){this['loggedIn']=0x0;this[_0xeb91('0x11')]=0x0;for(var _0xccc99a=0x0;_0xccc99a<this[_0xeb91('0xb')][_0xeb91('0x12')];_0xccc99a+=0x1){if(this[_0xeb91('0xb')][_0xccc99a][_0xeb91('0x13')]){this[_0xeb91('0x14')]+=0x1;}if(this[_0xeb91('0xb')][_0xccc99a]['mailPause']){this[_0xeb91('0x11')]+=0x1;}}this['available']=this[_0xeb91('0x14')]-this[_0xeb91('0x11')];this[_0xeb91('0x15')]=this['available']>=0x0?this['available']:0x0;var _0x59758d={'id':this['id'],'available':this[_0xeb91('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x7122e2=md5(JSON[_0xeb91('0x16')](_0x59758d));if(this[_0xeb91('0x1')]!==_0x7122e2){this[_0xeb91('0x1')]=_0x7122e2;io['to'](util[_0xeb91('0x17')](_0xeb91('0x18'),_0x59758d[_0xeb91('0x7')]))[_0xeb91('0x19')](_0xeb91('0x1a'),_0x59758d);}};module[_0xeb91('0x1b')]=MailQueue;
\ No newline at end of file
+var _0x751a=['exports','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save'];(function(_0x2df8a8,_0x2b22be){var _0x11b21b=function(_0x4ec001){while(--_0x4ec001){_0x2df8a8['push'](_0x2df8a8['shift']());}};_0x11b21b(++_0x2b22be);}(_0x751a,0x1bb));var _0xa751=function(_0x373096,_0x4d37aa){_0x373096=_0x373096-0x0;var _0x14a6d0=_0x751a[_0x373096];return _0x14a6d0;};'use strict';var _=require('lodash');var md5=require(_0xa751('0x0'));var util=require('util');var Redis=require(_0xa751('0x1'));var config=require(_0xa751('0x2'));config[_0xa751('0x3')]=_['defaults'](config[_0xa751('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xa751('0x4'))(new Redis(config['redis']));function MailQueue(_0x4bb06d){this['id']=_0x4bb06d['id']||0x0;this[_0xa751('0x5')]=_0x4bb06d['name']||'';this[_0xa751('0x6')]=_0x4bb06d[_0xa751('0x6')]||0xa;this[_0xa751('0x7')]=_0x4bb06d[_0xa751('0x7')]||'beepall';this['Agents']=_0x4bb06d[_0xa751('0x8')];this[_0xa751('0x9')]={};this[_0xa751('0xa')]=0x0;this['md5']='';this['updateRouting']();this[_0xa751('0xb')]();}MailQueue[_0xa751('0xc')][_0xa751('0xd')]=function(){var _0x34d03b=this[_0xa751('0x9')][_0xa751('0xe')];this[_0xa751('0x9')]=_['map'](this[_0xa751('0x8')],'id');this['mapAgentsId'][_0xa751('0xe')]=_0x34d03b;};MailQueue[_0xa751('0xc')][_0xa751('0xb')]=function(){this[_0xa751('0xf')]=0x0;this[_0xa751('0x10')]=0x0;for(var _0x3a875b=0x0;_0x3a875b<this['Agents'][_0xa751('0x11')];_0x3a875b+=0x1){if(this['Agents'][_0x3a875b]['online']){this['loggedIn']+=0x1;}if(this[_0xa751('0x8')][_0x3a875b][_0xa751('0x12')]){this[_0xa751('0x10')]+=0x1;}}this[_0xa751('0x13')]=this[_0xa751('0xf')]-this[_0xa751('0x10')];this[_0xa751('0x13')]=this['available']>=0x0?this[_0xa751('0x13')]:0x0;var _0x57f9e0={'id':this['id'],'available':this[_0xa751('0x13')],'loggedIn':this[_0xa751('0xf')],'name':this[_0xa751('0x5')],'paused':this[_0xa751('0x10')],'waiting':this[_0xa751('0xa')]};var _0x5c3411=md5(JSON[_0xa751('0x14')](_0x57f9e0));if(this['md5']!==_0x5c3411){this[_0xa751('0x0')]=_0x5c3411;io['to'](util[_0xa751('0x15')](_0xa751('0x16'),_0x57f9e0[_0xa751('0x5')]))[_0xa751('0x17')](_0xa751('0x18'),_0x57f9e0);}};module[_0xa751('0x19')]=MailQueue;
\ No newline at end of file
index de30d14..f3468b4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0x1261,0x144));var _0x1126=function(_0x4f2ee2,_0x1828cd){_0x4f2ee2=_0x4f2ee2-0x0;var _0x3b87d9=_0x1261[_0x4f2ee2];return _0x3b87d9;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0<this['Agents'][_0x1126('0x16')];_0x53a8f0+=0x1){if(this[_0x1126('0xc')][_0x53a8f0][_0x1126('0x17')]){this['loggedIn']+=0x1;}if(this[_0x1126('0xc')][_0x53a8f0]['openchannelPause']){this[_0x1126('0x15')]+=0x1;}}this[_0x1126('0x18')]=this[_0x1126('0x14')]-this['paused'];this[_0x1126('0x18')]=this[_0x1126('0x18')]>=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue;
\ No newline at end of file
+var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xc4aa[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0<this[_0xac4a('0xa')][_0xac4a('0x13')];_0x3b71c0+=0x1){if(this[_0xac4a('0xa')][_0x3b71c0][_0xac4a('0x14')]){this[_0xac4a('0x11')]+=0x1;}if(this[_0xac4a('0xa')][_0x3b71c0]['openchannelPause']){this[_0xac4a('0x12')]+=0x1;}}this[_0xac4a('0x15')]=this[_0xac4a('0x11')]-this[_0xac4a('0x12')];this[_0xac4a('0x15')]=this[_0xac4a('0x15')]>=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue;
\ No newline at end of file
index 957a0f0..1e088da 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x87f8=['updateRouting','updateRealtime','prototype','map','paused','length','loggedIn','smsPause','available','waiting','stringify','sms:queue:%s','sms_queue:save','exports','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','md5'];(function(_0x153e38,_0x465d0e){var _0xd36399=function(_0x24dce9){while(--_0x24dce9){_0x153e38['push'](_0x153e38['shift']());}};_0xd36399(++_0x465d0e);}(_0x87f8,0x152));var _0x887f=function(_0xb28e6f,_0x2f2a79){_0xb28e6f=_0xb28e6f-0x0;var _0x4d47be=_0x87f8[_0xb28e6f];return _0x4d47be;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x887f('0x0'));var config=require(_0x887f('0x1'));config['redis']=_[_0x887f('0x2')](config['redis'],{'host':_0x887f('0x3'),'port':0x18eb});var io=require(_0x887f('0x4'))(new Redis(config[_0x887f('0x5')]));function SmsQueue(_0x2d4cec){this['id']=_0x2d4cec['id']||0x0;this['name']=_0x2d4cec[_0x887f('0x6')]||'';this[_0x887f('0x7')]=_0x2d4cec[_0x887f('0x7')]||0xa;this[_0x887f('0x8')]=_0x2d4cec[_0x887f('0x8')]||_0x887f('0x9');this[_0x887f('0xa')]=_0x2d4cec['Agents'];this[_0x887f('0xb')]={};this['waiting']=0x0;this[_0x887f('0xc')]='';this[_0x887f('0xd')]();this[_0x887f('0xe')]();}SmsQueue[_0x887f('0xf')]['updateRouting']=function(){var _0x12383f=this[_0x887f('0xb')]['_rr'];this['mapAgentsId']=_[_0x887f('0x10')](this[_0x887f('0xa')],'id');this[_0x887f('0xb')]['_rr']=_0x12383f;};SmsQueue[_0x887f('0xf')][_0x887f('0xe')]=function(){this['loggedIn']=0x0;this[_0x887f('0x11')]=0x0;for(var _0x58152e=0x0;_0x58152e<this['Agents'][_0x887f('0x12')];_0x58152e+=0x1){if(this[_0x887f('0xa')][_0x58152e]['online']){this[_0x887f('0x13')]+=0x1;}if(this[_0x887f('0xa')][_0x58152e][_0x887f('0x14')]){this['paused']+=0x1;}}this[_0x887f('0x15')]=this[_0x887f('0x13')]-this['paused'];this[_0x887f('0x15')]=this[_0x887f('0x15')]>=0x0?this[_0x887f('0x15')]:0x0;var _0x3d3b0c={'id':this['id'],'available':this[_0x887f('0x15')],'loggedIn':this[_0x887f('0x13')],'name':this[_0x887f('0x6')],'paused':this[_0x887f('0x11')],'waiting':this[_0x887f('0x16')]};var _0x3964d6=md5(JSON[_0x887f('0x17')](_0x3d3b0c));if(this[_0x887f('0xc')]!==_0x3964d6){this[_0x887f('0xc')]=_0x3964d6;io['to'](util['format'](_0x887f('0x18'),_0x3d3b0c[_0x887f('0x6')]))['emit'](_0x887f('0x19'),_0x3d3b0c);}};module[_0x887f('0x1a')]=SmsQueue;
\ No newline at end of file
+var _0xe812=['stringify','sms:queue:%s','emit','sms_queue:save','exports','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','smsPause','paused','available','waiting'];(function(_0x1428d9,_0xded63c){var _0x438019=function(_0x31c37d){while(--_0x31c37d){_0x1428d9['push'](_0x1428d9['shift']());}};_0x438019(++_0xded63c);}(_0xe812,0x1f2));var _0x2e81=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe812[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var md5=require(_0x2e81('0x0'));var util=require(_0x2e81('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x2e81('0x2')]=_[_0x2e81('0x3')](config['redis'],{'host':_0x2e81('0x4'),'port':0x18eb});var io=require(_0x2e81('0x5'))(new Redis(config['redis']));function SmsQueue(_0x1a0274){this['id']=_0x1a0274['id']||0x0;this[_0x2e81('0x6')]=_0x1a0274['name']||'';this[_0x2e81('0x7')]=_0x1a0274[_0x2e81('0x7')]||0xa;this[_0x2e81('0x8')]=_0x1a0274['strategy']||_0x2e81('0x9');this[_0x2e81('0xa')]=_0x1a0274[_0x2e81('0xa')];this[_0x2e81('0xb')]={};this['waiting']=0x0;this[_0x2e81('0x0')]='';this[_0x2e81('0xc')]();this[_0x2e81('0xd')]();}SmsQueue[_0x2e81('0xe')][_0x2e81('0xc')]=function(){var _0x3cbca8=this[_0x2e81('0xb')][_0x2e81('0xf')];this[_0x2e81('0xb')]=_[_0x2e81('0x10')](this[_0x2e81('0xa')],'id');this['mapAgentsId'][_0x2e81('0xf')]=_0x3cbca8;};SmsQueue[_0x2e81('0xe')]['updateRealtime']=function(){this[_0x2e81('0x11')]=0x0;this['paused']=0x0;for(var _0x2a4411=0x0;_0x2a4411<this[_0x2e81('0xa')][_0x2e81('0x12')];_0x2a4411+=0x1){if(this[_0x2e81('0xa')][_0x2a4411][_0x2e81('0x13')]){this[_0x2e81('0x11')]+=0x1;}if(this['Agents'][_0x2a4411][_0x2e81('0x14')]){this[_0x2e81('0x15')]+=0x1;}}this['available']=this[_0x2e81('0x11')]-this['paused'];this[_0x2e81('0x16')]=this[_0x2e81('0x16')]>=0x0?this['available']:0x0;var _0x402992={'id':this['id'],'available':this[_0x2e81('0x16')],'loggedIn':this[_0x2e81('0x11')],'name':this[_0x2e81('0x6')],'paused':this[_0x2e81('0x15')],'waiting':this[_0x2e81('0x17')]};var _0x1f5419=md5(JSON[_0x2e81('0x18')](_0x402992));if(this[_0x2e81('0x0')]!==_0x1f5419){this[_0x2e81('0x0')]=_0x1f5419;io['to'](util['format'](_0x2e81('0x19'),_0x402992[_0x2e81('0x6')]))[_0x2e81('0x1a')](_0x2e81('0x1b'),_0x402992);}};module[_0x2e81('0x1c')]=SmsQueue;
\ No newline at end of file
index 1052a12..c8b923f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd71d=['online','available','waiting','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','lodash','md5','ioredis','defaults','socket.io-emitter','redis','name','timeout','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused'];(function(_0x66b9f9,_0x32d667){var _0x241ce9=function(_0x2b3426){while(--_0x2b3426){_0x66b9f9['push'](_0x66b9f9['shift']());}};_0x241ce9(++_0x32d667);}(_0xd71d,0xdf));var _0xdd71=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xd71d[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xdd71('0x0'));var md5=require(_0xdd71('0x1'));var util=require('util');var Redis=require(_0xdd71('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xdd71('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xdd71('0x4'))(new Redis(config[_0xdd71('0x5')]));function WhatsappQueue(_0x48bde5){this['id']=_0x48bde5['id']||0x0;this[_0xdd71('0x6')]=_0x48bde5[_0xdd71('0x6')]||'';this['timeout']=_0x48bde5[_0xdd71('0x7')]||0xa;this['strategy']=_0x48bde5['strategy']||_0xdd71('0x8');this['Agents']=_0x48bde5[_0xdd71('0x9')];this[_0xdd71('0xa')]={};this['waiting']=0x0;this[_0xdd71('0x1')]='';this[_0xdd71('0xb')]();this[_0xdd71('0xc')]();}WhatsappQueue[_0xdd71('0xd')]['updateRouting']=function(){var _0x5a764e=this['mapAgentsId'][_0xdd71('0xe')];this[_0xdd71('0xa')]=_['map'](this[_0xdd71('0x9')],'id');this[_0xdd71('0xa')][_0xdd71('0xe')]=_0x5a764e;};WhatsappQueue[_0xdd71('0xd')][_0xdd71('0xc')]=function(){this[_0xdd71('0xf')]=0x0;this[_0xdd71('0x10')]=0x0;for(var _0x523404=0x0;_0x523404<this['Agents']['length'];_0x523404+=0x1){if(this['Agents'][_0x523404][_0xdd71('0x11')]){this[_0xdd71('0xf')]+=0x1;}if(this[_0xdd71('0x9')][_0x523404]['whatsappPause']){this[_0xdd71('0x10')]+=0x1;}}this[_0xdd71('0x12')]=this[_0xdd71('0xf')]-this[_0xdd71('0x10')];this[_0xdd71('0x12')]=this['available']>=0x0?this[_0xdd71('0x12')]:0x0;var _0x461612={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xdd71('0x6')],'paused':this[_0xdd71('0x10')],'waiting':this[_0xdd71('0x13')]};var _0x1c0d7a=md5(JSON[_0xdd71('0x14')](_0x461612));if(this[_0xdd71('0x1')]!==_0x1c0d7a){this[_0xdd71('0x1')]=_0x1c0d7a;io['to'](util[_0xdd71('0x15')](_0xdd71('0x16'),_0x461612[_0xdd71('0x6')]))['emit'](_0xdd71('0x17'),_0x461612);}};module['exports']=WhatsappQueue;
\ No newline at end of file
+var _0xe21b=['md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','whatsappPause','paused','available','stringify','exports'];(function(_0x16c229,_0xb682d0){var _0x1622d1=function(_0x3d98d4){while(--_0x3d98d4){_0x16c229['push'](_0x16c229['shift']());}};_0x1622d1(++_0xb682d0);}(_0xe21b,0x1f4));var _0xbe21=function(_0x111537,_0x22e4f8){_0x111537=_0x111537-0x0;var _0x12aeda=_0xe21b[_0x111537];return _0x12aeda;};'use strict';var _=require('lodash');var md5=require(_0xbe21('0x0'));var util=require(_0xbe21('0x1'));var Redis=require('ioredis');var config=require(_0xbe21('0x2'));config[_0xbe21('0x3')]=_[_0xbe21('0x4')](config[_0xbe21('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xbe21('0x5'))(new Redis(config[_0xbe21('0x3')]));function WhatsappQueue(_0x497ce8){this['id']=_0x497ce8['id']||0x0;this[_0xbe21('0x6')]=_0x497ce8[_0xbe21('0x6')]||'';this[_0xbe21('0x7')]=_0x497ce8[_0xbe21('0x7')]||0xa;this['strategy']=_0x497ce8[_0xbe21('0x8')]||'beepall';this[_0xbe21('0x9')]=_0x497ce8[_0xbe21('0x9')];this[_0xbe21('0xa')]={};this[_0xbe21('0xb')]=0x0;this[_0xbe21('0x0')]='';this[_0xbe21('0xc')]();this[_0xbe21('0xd')]();}WhatsappQueue[_0xbe21('0xe')][_0xbe21('0xc')]=function(){var _0xcf1883=this[_0xbe21('0xa')][_0xbe21('0xf')];this['mapAgentsId']=_[_0xbe21('0x10')](this['Agents'],'id');this['mapAgentsId'][_0xbe21('0xf')]=_0xcf1883;};WhatsappQueue['prototype'][_0xbe21('0xd')]=function(){this[_0xbe21('0x11')]=0x0;this['paused']=0x0;for(var _0x4cb86c=0x0;_0x4cb86c<this[_0xbe21('0x9')][_0xbe21('0x12')];_0x4cb86c+=0x1){if(this[_0xbe21('0x9')][_0x4cb86c][_0xbe21('0x13')]){this[_0xbe21('0x11')]+=0x1;}if(this['Agents'][_0x4cb86c][_0xbe21('0x14')]){this[_0xbe21('0x15')]+=0x1;}}this['available']=this[_0xbe21('0x11')]-this['paused'];this[_0xbe21('0x16')]=this[_0xbe21('0x16')]>=0x0?this[_0xbe21('0x16')]:0x0;var _0x104dc9={'id':this['id'],'available':this[_0xbe21('0x16')],'loggedIn':this[_0xbe21('0x11')],'name':this['name'],'paused':this[_0xbe21('0x15')],'waiting':this['waiting']};var _0x2178ae=md5(JSON[_0xbe21('0x17')](_0x104dc9));if(this[_0xbe21('0x0')]!==_0x2178ae){this[_0xbe21('0x0')]=_0x2178ae;io['to'](util['format']('whatsapp:queue:%s',_0x104dc9[_0xbe21('0x6')]))['emit']('whatsapp_queue:save',_0x104dc9);}};module[_0xbe21('0x18')]=WhatsappQueue;
\ No newline at end of file
index e999a50..e45590d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x3ad572,_0x3de744){var _0x2acefc=function(_0x30b6ac){while(--_0x30b6ac){_0x3ad572['push'](_0x3ad572['shift']());}};_0x2acefc(++_0x3de744);}(_0xb10b,0x12a));var _0xbb10=function(_0x203cf5,_0x8421e0){_0x203cf5=_0x203cf5-0x0;var _0x17a51d=_0xb10b[_0x203cf5];return _0x17a51d;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime;
\ No newline at end of file
+var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime;
\ No newline at end of file
index ac18267..c79493d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3e2b=['Request','AddTagsToChatInteraction','addTagsToChatInteraction','update','updateChatInteraction','addTags'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3e2b,0x105));var _0xb3e2=function(_0x52ecb6,_0x15f704){_0x52ecb6=_0x52ecb6-0x0;var _0x9a5482=_0x3e2b[_0x52ecb6];return _0x9a5482;};'use strict';var client=require('../client');exports[_0xb3e2('0x0')]=function(_0x25079b,_0x4092c8){return client['Request']('UpdateChatInteraction',{'body':_0x4092c8,'options':{'where':{'id':_0x25079b}},'log':_0xb3e2('0x1')});};exports[_0xb3e2('0x2')]=function(_0x4a557f,_0x4fa03f){return client[_0xb3e2('0x3')](_0xb3e2('0x4'),{'body':_0x4fa03f,'options':{'where':{'id':_0x4a557f}},'log':_0xb3e2('0x5')});};
\ No newline at end of file
+var _0xf705=['AddTagsToChatInteraction','../client','Request','updateChatInteraction'];(function(_0x38a5c1,_0x3320d6){var _0x24b80c=function(_0x228c0a){while(--_0x228c0a){_0x38a5c1['push'](_0x38a5c1['shift']());}};_0x24b80c(++_0x3320d6);}(_0xf705,0x11d));var _0x5f70=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xf705[_0x46698a];return _0x356db0;};'use strict';var client=require(_0x5f70('0x0'));exports['update']=function(_0x1e251c,_0x21f1d5){return client[_0x5f70('0x1')]('UpdateChatInteraction',{'body':_0x21f1d5,'options':{'where':{'id':_0x1e251c}},'log':_0x5f70('0x2')});};exports['addTags']=function(_0x20d7c7,_0x112f91){return client['Request'](_0x5f70('0x3'),{'body':_0x112f91,'options':{'where':{'id':_0x20d7c7}},'log':'addTagsToChatInteraction'});};
\ No newline at end of file
index 99c38cd..58a99a5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6613=['../client','CreateChatMessage','createChatMessage'];(function(_0x1cfe2b,_0x19e427){var _0x418712=function(_0x27da17){while(--_0x27da17){_0x1cfe2b['push'](_0x1cfe2b['shift']());}};_0x418712(++_0x19e427);}(_0x6613,0x126));var _0x3661=function(_0x21569b,_0x564254){_0x21569b=_0x21569b-0x0;var _0x52e8a0=_0x6613[_0x21569b];return _0x52e8a0;};'use strict';var client=require(_0x3661('0x0'));exports['create']=function(_0x43fb35){return client['Request'](_0x3661('0x1'),{'body':_0x43fb35,'log':_0x3661('0x2')});};
\ No newline at end of file
+var _0xfe61=['CreateChatMessage','create','Request'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfe61,0x16f));var _0x1fe6=function(_0x11477f,_0x55099c){_0x11477f=_0x11477f-0x0;var _0x393ce5=_0xfe61[_0x11477f];return _0x393ce5;};'use strict';var client=require('../client');exports[_0x1fe6('0x0')]=function(_0x49aa00){return client[_0x1fe6('0x1')](_0x1fe6('0x2'),{'body':_0x49aa00,'log':'createChatMessage'});};
\ No newline at end of file
index a060d16..8161113 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x57cf=['User','Agents','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x57cf,0x11b));var _0xf57c=function(_0x46ef1d,_0x24926){_0x46ef1d=_0x46ef1d-0x0;var _0x49ce69=_0x57cf[_0x46ef1d];return _0x49ce69;};'use strict';var client=require(_0xf57c('0x0'));exports[_0xf57c('0x1')]=function(){return function(){return client[_0xf57c('0x2')](_0xf57c('0x3'),{'options':{'raw':![],'attributes':['id',_0xf57c('0x4'),_0xf57c('0x5'),_0xf57c('0x6')],'include':[{'model':_0xf57c('0x7'),'as':_0xf57c('0x8'),'attributes':['id',_0xf57c('0x4'),'online',_0xf57c('0x9')]}]},'log':'getChatQueues'});};};
\ No newline at end of file
+var _0x818f=['User','Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout'];(function(_0x497d84,_0x4fad8d){var _0x28b334=function(_0xf9fa69){while(--_0xf9fa69){_0x497d84['push'](_0x497d84['shift']());}};_0x28b334(++_0x4fad8d);}(_0x818f,0x1da));var _0xf818=function(_0x145001,_0x25c9bf){_0x145001=_0x145001-0x0;var _0x465219=_0x818f[_0x145001];return _0x465219;};'use strict';var client=require(_0xf818('0x0'));exports[_0xf818('0x1')]=function(){return function(){return client[_0xf818('0x2')](_0xf818('0x3'),{'options':{'raw':![],'attributes':['id',_0xf818('0x4'),_0xf818('0x5'),'strategy'],'include':[{'model':_0xf818('0x6'),'as':_0xf818('0x7'),'attributes':['id',_0xf818('0x4'),_0xf818('0x8'),_0xf818('0x9')]}]},'log':_0xf818('0x1')});};};
\ No newline at end of file
index 6bb4e08..7662aab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc770=['DESC','../client','create','CreateChatQueueReport','update','Request','UpdateChatQueueReport'];(function(_0xee42f6,_0xd60860){var _0xc41138=function(_0x578b7f){while(--_0x578b7f){_0xee42f6['push'](_0xee42f6['shift']());}};_0xc41138(++_0xd60860);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0c77('0x0'));exports[_0x0c77('0x1')]=function(_0x51f3fd){return client['Request'](_0x0c77('0x2'),{'body':_0x51f3fd,'log':_0x0c77('0x2')});};exports[_0x0c77('0x3')]=function(_0x23ae87,_0xdcfb07){return client[_0x0c77('0x4')](_0x0c77('0x5'),{'body':_0xdcfb07,'options':{'where':{'uniqueid':_0x23ae87},'order':[['id',_0x0c77('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});};
\ No newline at end of file
+var _0x3c7b=['../client','create','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x52542c,_0x1f9526){var _0x12c8f0=function(_0x7c4434){while(--_0x7c4434){_0x52542c['push'](_0x52542c['shift']());}};_0x12c8f0(++_0x1f9526);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x4da28c,_0x2b3658){_0x4da28c=_0x4da28c-0x0;var _0x1a2120=_0x3c7b[_0x4da28c];return _0x1a2120;};'use strict';var client=require(_0xb3c7('0x0'));exports[_0xb3c7('0x1')]=function(_0xc43ced){return client[_0xb3c7('0x2')](_0xb3c7('0x3'),{'body':_0xc43ced,'log':'CreateChatQueueReport'});};exports['update']=function(_0x500bea,_0x5b34ef){return client[_0xb3c7('0x2')](_0xb3c7('0x4'),{'body':_0x5b34ef,'options':{'where':{'uniqueid':_0x500bea},'order':[['id','DESC']],'limit':0x1},'log':_0xb3c7('0x4')});};
\ No newline at end of file
index efdeb1d..3ac5696 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x4ef72a,_0x32610c){var _0x510eb8=function(_0x5a4ce9){while(--_0x5a4ce9){_0x4ef72a['push'](_0x4ef72a['shift']());}};_0x510eb8(++_0x32610c);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});};
\ No newline at end of file
+var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x39fd11,_0x5d7883){var _0x302799=function(_0x4a0615){while(--_0x4a0615){_0x39fd11['push'](_0x39fd11['shift']());}};_0x302799(++_0x5d7883);}(_0x7a54,0x106));var _0x47a5=function(_0x51bb9d,_0x13e08f){_0x51bb9d=_0x51bb9d-0x0;var _0x217c08=_0x7a54[_0x51bb9d];return _0x217c08;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});};
\ No newline at end of file
index b3f8aa2..0d2f0fa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x92d2=['create','CreateFaxMessage','../client'];(function(_0x3e9aa2,_0x71de94){var _0x533cb9=function(_0x258a25){while(--_0x258a25){_0x3e9aa2['push'](_0x3e9aa2['shift']());}};_0x533cb9(++_0x71de94);}(_0x92d2,0x11f));var _0x292d=function(_0x730ad8,_0x20eea1){_0x730ad8=_0x730ad8-0x0;var _0x40a276=_0x92d2[_0x730ad8];return _0x40a276;};'use strict';var client=require(_0x292d('0x0'));exports[_0x292d('0x1')]=function(_0x1c547f){return client['Request'](_0x292d('0x2'),{'body':_0x1c547f,'log':'createFaxMessage'});};
\ No newline at end of file
+var _0x57dd=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x435e53,_0x1018b8){var _0x31cdae=function(_0xca012d){while(--_0xca012d){_0x435e53['push'](_0x435e53['shift']());}};_0x31cdae(++_0x1018b8);}(_0x57dd,0x185));var _0xd57d=function(_0x1ae306,_0x3137c0){_0x1ae306=_0x1ae306-0x0;var _0x1f409f=_0x57dd[_0x1ae306];return _0x1f409f;};'use strict';var client=require(_0xd57d('0x0'));exports[_0xd57d('0x1')]=function(_0x51911c){return client[_0xd57d('0x2')](_0xd57d('0x3'),{'body':_0x51911c,'log':_0xd57d('0x4')});};
\ No newline at end of file
index fde13f2..aea25ff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x26d4=['GetFaxQueue','name','timeout','strategy','User','faxPause','../client','getFaxQueues','Request'];(function(_0x9661a4,_0x4d02ad){var _0x2c46ee=function(_0xbc3ca5){while(--_0xbc3ca5){_0x9661a4['push'](_0x9661a4['shift']());}};_0x2c46ee(++_0x4d02ad);}(_0x26d4,0x1c8));var _0x426d=function(_0x37ab4f,_0x31f186){_0x37ab4f=_0x37ab4f-0x0;var _0x4ba6cc=_0x26d4[_0x37ab4f];return _0x4ba6cc;};'use strict';var client=require(_0x426d('0x0'));exports[_0x426d('0x1')]=function(){return function(){return client[_0x426d('0x2')](_0x426d('0x3'),{'options':{'raw':![],'attributes':['id',_0x426d('0x4'),_0x426d('0x5'),_0x426d('0x6')],'include':[{'model':_0x426d('0x7'),'as':'Agents','attributes':['id','name','online',_0x426d('0x8')]}]},'log':_0x426d('0x1')});};};
\ No newline at end of file
+var _0x2d2a=['User','Agents','name','online','getFaxQueues','../client','Request'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x2d2a,0xf3));var _0xa2d2=function(_0xfe1cb1,_0x307dd2){_0xfe1cb1=_0xfe1cb1-0x0;var _0x109af2=_0x2d2a[_0xfe1cb1];return _0x109af2;};'use strict';var client=require(_0xa2d2('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xa2d2('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0xa2d2('0x2'),'as':_0xa2d2('0x3'),'attributes':['id',_0xa2d2('0x4'),_0xa2d2('0x5'),'faxPause']}]},'log':_0xa2d2('0x6')});};};
\ No newline at end of file
index 72bcd7c..5d39969 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3b16=['create','Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client'];(function(_0x2c8350,_0x5126ed){var _0x4d5530=function(_0x42b164){while(--_0x42b164){_0x2c8350['push'](_0x2c8350['shift']());}};_0x4d5530(++_0x5126ed);}(_0x3b16,0x1c1));var _0x63b1=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3b16[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x63b1('0x0'));exports[_0x63b1('0x1')]=function(_0x438d15){return client[_0x63b1('0x2')](_0x63b1('0x3'),{'body':_0x438d15,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x5a5f62,_0x3681f9){return client['Request'](_0x63b1('0x4'),{'body':_0x3681f9,'options':{'where':{'uniqueid':_0x5a5f62},'order':[['id',_0x63b1('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});};
\ No newline at end of file
+var _0x452c=['Request','CreateFaxQueueReport','update','DESC','../client'];(function(_0x36dbd0,_0x3b4fe6){var _0x2b3d6b=function(_0x5b9eac){while(--_0x5b9eac){_0x36dbd0['push'](_0x36dbd0['shift']());}};_0x2b3d6b(++_0x3b4fe6);}(_0x452c,0x72));var _0xc452=function(_0x5a29bf,_0xc8da9){_0x5a29bf=_0x5a29bf-0x0;var _0x4b25c6=_0x452c[_0x5a29bf];return _0x4b25c6;};'use strict';var client=require(_0xc452('0x0'));exports['create']=function(_0x402c16){return client[_0xc452('0x1')](_0xc452('0x2'),{'body':_0x402c16,'log':'CreateFaxQueueReport'});};exports[_0xc452('0x3')]=function(_0x54a169,_0x53b923){return client[_0xc452('0x1')]('UpdateFaxQueueReport',{'body':_0x53b923,'options':{'where':{'uniqueid':_0x54a169},'order':[['id',_0xc452('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});};
\ No newline at end of file
index 7042cb2..3a358d0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1fe3=['../client','getIntervals','Request','GetInterval','name','Intervals','interval'];(function(_0x2f12e7,_0x5c556c){var _0x55227f=function(_0x1e0608){while(--_0x1e0608){_0x2f12e7['push'](_0x2f12e7['shift']());}};_0x55227f(++_0x5c556c);}(_0x1fe3,0x93));var _0x31fe=function(_0x406209,_0x2d6019){_0x406209=_0x406209-0x0;var _0x53b961=_0x1fe3[_0x406209];return _0x53b961;};'use strict';var client=require(_0x31fe('0x0'));exports[_0x31fe('0x1')]=function(){return function(){return client[_0x31fe('0x2')](_0x31fe('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x31fe('0x4')],'include':[{'model':'Interval','as':_0x31fe('0x5'),'attributes':['id','name',_0x31fe('0x6')]}]},'log':'getIntervals'});};};
\ No newline at end of file
+var _0x86b9=['getIntervals','name','Intervals','interval','../client'];(function(_0x136290,_0x3e6b8f){var _0x290e92=function(_0x4095d6){while(--_0x4095d6){_0x136290['push'](_0x136290['shift']());}};_0x290e92(++_0x3e6b8f);}(_0x86b9,0x1c6));var _0x986b=function(_0xb56705,_0x45c970){_0xb56705=_0xb56705-0x0;var _0x5eb94a=_0x86b9[_0xb56705];return _0x5eb94a;};'use strict';var client=require(_0x986b('0x0'));exports[_0x986b('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x986b('0x2')],'include':[{'model':'Interval','as':_0x986b('0x3'),'attributes':['id',_0x986b('0x2'),_0x986b('0x4')]}]},'log':'getIntervals'});};};
\ No newline at end of file
index 9dbe9d0..7681cd1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x781d=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x309879,_0x29f94a){var _0x480e63=function(_0x8ec1b0){while(--_0x8ec1b0){_0x309879['push'](_0x309879['shift']());}};_0x480e63(++_0x29f94a);}(_0x781d,0x14a));var _0xd781=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x781d[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0xd781('0x0'));exports[_0xd781('0x1')]=function(_0x596ba2,_0x5c1007){return client[_0xd781('0x2')](_0xd781('0x3'),{'body':_0x5c1007,'options':{'where':{'id':_0x596ba2}},'log':_0xd781('0x4')});};exports[_0xd781('0x5')]=function(_0xfd915d,_0x42258e){return client[_0xd781('0x2')](_0xd781('0x6'),{'body':_0x42258e,'options':{'where':{'id':_0xfd915d}},'log':_0xd781('0x7')});};
\ No newline at end of file
+var _0x160f=['UpdateMailInteraction','updateMailInteraction','addTags','Request','addTagsToChatInteraction','../client','update'];(function(_0x5ccb02,_0x3588fb){var _0x52a833=function(_0x1b61d5){while(--_0x1b61d5){_0x5ccb02['push'](_0x5ccb02['shift']());}};_0x52a833(++_0x3588fb);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf160('0x0'));exports[_0xf160('0x1')]=function(_0x2d4cde,_0x2966aa){return client['Request'](_0xf160('0x2'),{'body':_0x2966aa,'options':{'where':{'id':_0x2d4cde}},'log':_0xf160('0x3')});};exports[_0xf160('0x4')]=function(_0x3b2d7b,_0x194331){return client[_0xf160('0x5')]('AddTagsToMailInteraction',{'body':_0x194331,'options':{'where':{'id':_0x3b2d7b}},'log':_0xf160('0x6')});};
\ No newline at end of file
index d1bd331..f5b5bd4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9fd8=['../client','Request','createMailMessage'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x9fd8,0x1dd));var _0x89fd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9fd8[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x89fd('0x0'));exports['create']=function(_0x5547e7){return client[_0x89fd('0x1')]('CreateMailMessage',{'body':_0x5547e7,'log':_0x89fd('0x2')});};
\ No newline at end of file
+var _0xa5c4=['createMailMessage','create','Request'];(function(_0x15d05b,_0x493bf8){var _0x2b3a80=function(_0x24addc){while(--_0x24addc){_0x15d05b['push'](_0x15d05b['shift']());}};_0x2b3a80(++_0x493bf8);}(_0xa5c4,0x142));var _0x4a5c=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0xa5c4[_0x297eea];return _0x1c42d2;};'use strict';var client=require('../client');exports[_0x4a5c('0x0')]=function(_0xf7ce86){return client[_0x4a5c('0x1')]('CreateMailMessage',{'body':_0xf7ce86,'log':_0x4a5c('0x2')});};
\ No newline at end of file
index 5000ae7..da6e905 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x77a4=['getMailQueues','name','timeout','strategy','Agents','online','mailPause','../client'];(function(_0x1c80bd,_0x5e7ecd){var _0x553e25=function(_0x23941e){while(--_0x23941e){_0x1c80bd['push'](_0x1c80bd['shift']());}};_0x553e25(++_0x5e7ecd);}(_0x77a4,0x9f));var _0x477a=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0x77a4[_0x1a595a];return _0x33f008;};'use strict';var client=require(_0x477a('0x0'));exports[_0x477a('0x1')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x477a('0x2'),_0x477a('0x3'),_0x477a('0x4')],'include':[{'model':'User','as':_0x477a('0x5'),'attributes':['id',_0x477a('0x2'),_0x477a('0x6'),_0x477a('0x7')]}]},'log':'getMailQueues'});};};
\ No newline at end of file
+var _0xdd7b=['online','mailPause','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents'];(function(_0x4085c1,_0x2fb536){var _0x4bbbc3=function(_0x442406){while(--_0x442406){_0x4085c1['push'](_0x4085c1['shift']());}};_0x4bbbc3(++_0x2fb536);}(_0xdd7b,0x1a6));var _0xbdd7=function(_0x3d99af,_0x4dcc64){_0x3d99af=_0x3d99af-0x0;var _0x3cb04a=_0xdd7b[_0x3d99af];return _0x3cb04a;};'use strict';var client=require('../client');exports[_0xbdd7('0x0')]=function(){return function(){return client[_0xbdd7('0x1')](_0xbdd7('0x2'),{'options':{'raw':![],'attributes':['id',_0xbdd7('0x3'),_0xbdd7('0x4'),_0xbdd7('0x5')],'include':[{'model':_0xbdd7('0x6'),'as':_0xbdd7('0x7'),'attributes':['id','name',_0xbdd7('0x8'),_0xbdd7('0x9')]}]},'log':_0xbdd7('0x0')});};};
\ No newline at end of file
index 60ed066..e17daad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e97=['UpdateMailQueueReport','../client','create','Request','CreateMailQueueReport'];(function(_0x285201,_0xacb09c){var _0x3b3e7a=function(_0x5b8dab){while(--_0x5b8dab){_0x285201['push'](_0x285201['shift']());}};_0x3b3e7a(++_0xacb09c);}(_0x5e97,0x1cd));var _0x75e9=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x5e97[_0x1035c1];return _0x308d67;};'use strict';var client=require(_0x75e9('0x0'));exports[_0x75e9('0x1')]=function(_0x1bfeaa){return client[_0x75e9('0x2')](_0x75e9('0x3'),{'body':_0x1bfeaa,'log':_0x75e9('0x3')});};exports['update']=function(_0x16ec5d,_0x4ba269){return client[_0x75e9('0x2')](_0x75e9('0x4'),{'body':_0x4ba269,'options':{'where':{'uniqueid':_0x16ec5d},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});};
\ No newline at end of file
+var _0xff1b=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client'];(function(_0x2247ab,_0x3f4162){var _0x430062=function(_0x591dd7){while(--_0x591dd7){_0x2247ab['push'](_0x2247ab['shift']());}};_0x430062(++_0x3f4162);}(_0xff1b,0x143));var _0xbff1=function(_0x15821d,_0x3d3029){_0x15821d=_0x15821d-0x0;var _0x5e443c=_0xff1b[_0x15821d];return _0x5e443c;};'use strict';var client=require(_0xbff1('0x0'));exports[_0xbff1('0x1')]=function(_0x1f1350){return client[_0xbff1('0x2')](_0xbff1('0x3'),{'body':_0x1f1350,'log':_0xbff1('0x3')});};exports[_0xbff1('0x4')]=function(_0x2abac4,_0x2d2a09){return client[_0xbff1('0x2')](_0xbff1('0x5'),{'body':_0x2d2a09,'options':{'where':{'uniqueid':_0x2abac4},'order':[['id','DESC']],'limit':0x1},'log':_0xbff1('0x5')});};
\ No newline at end of file
index 15f2af4..a602e62 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3006=['addTagsToChatInteraction','Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x1bcbcb,_0x24fb3b){var _0x39aa62=function(_0x189a7e){while(--_0x189a7e){_0x1bcbcb['push'](_0x1bcbcb['shift']());}};_0x39aa62(++_0x24fb3b);}(_0x3006,0x100));var _0x6300=function(_0x455460,_0x305d23){_0x455460=_0x455460-0x0;var _0x107e32=_0x3006[_0x455460];return _0x107e32;};'use strict';var client=require('../client');exports['update']=function(_0x14dbc5,_0x47b408){return client[_0x6300('0x0')]('UpdateOpenchannelInteraction',{'body':_0x47b408,'options':{'where':{'id':_0x14dbc5}},'log':_0x6300('0x1')});};exports[_0x6300('0x2')]=function(_0x531c07,_0x9097fa){return client[_0x6300('0x0')](_0x6300('0x3'),{'body':_0x9097fa,'options':{'where':{'id':_0x531c07}},'log':_0x6300('0x4')});};
\ No newline at end of file
+var _0xef68=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction'];(function(_0x4af8cf,_0x51a87c){var _0x1cb78d=function(_0x49de71){while(--_0x49de71){_0x4af8cf['push'](_0x4af8cf['shift']());}};_0x1cb78d(++_0x51a87c);}(_0xef68,0xf6));var _0x8ef6=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xef68[_0x11005e];return _0x29338f;};'use strict';var client=require(_0x8ef6('0x0'));exports[_0x8ef6('0x1')]=function(_0x52f7ec,_0x36ae76){return client[_0x8ef6('0x2')](_0x8ef6('0x3'),{'body':_0x36ae76,'options':{'where':{'id':_0x52f7ec}},'log':_0x8ef6('0x4')});};exports['addTags']=function(_0x1b5bdd,_0x535fa2){return client[_0x8ef6('0x2')](_0x8ef6('0x5'),{'body':_0x535fa2,'options':{'where':{'id':_0x1b5bdd}},'log':_0x8ef6('0x6')});};
\ No newline at end of file
index 47346a6..27fc485 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7507=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x2ef33b,_0x5a9a4f){var _0x4cb388=function(_0x200df1){while(--_0x200df1){_0x2ef33b['push'](_0x2ef33b['shift']());}};_0x4cb388(++_0x5a9a4f);}(_0x7507,0x68));var _0x7750=function(_0x255c72,_0x13a5e2){_0x255c72=_0x255c72-0x0;var _0x3d2922=_0x7507[_0x255c72];return _0x3d2922;};'use strict';var client=require(_0x7750('0x0'));exports[_0x7750('0x1')]=function(_0xb01d75){return client[_0x7750('0x2')](_0x7750('0x3'),{'body':_0xb01d75,'log':_0x7750('0x4')});};
\ No newline at end of file
+var _0x354d=['createOpenchannelMessage','../client'];(function(_0x2efc94,_0x4f64c3){var _0xa2bdf7=function(_0x1502bb){while(--_0x1502bb){_0x2efc94['push'](_0x2efc94['shift']());}};_0xa2bdf7(++_0x4f64c3);}(_0x354d,0x1b5));var _0xd354=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x354d[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require(_0xd354('0x0'));exports['create']=function(_0x42dc86){return client['Request']('CreateOpenchannelMessage',{'body':_0x42dc86,'log':_0xd354('0x1')});};
\ No newline at end of file
index 0edaf07..7217257 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x11e9=['openchannelPause','getOpenchannelQueues','GetOpenchannelQueue','timeout','strategy','User'];(function(_0x2348e4,_0x2d7f13){var _0x42bfd0=function(_0x26dcdb){while(--_0x26dcdb){_0x2348e4['push'](_0x2348e4['shift']());}};_0x42bfd0(++_0x2d7f13);}(_0x11e9,0x169));var _0x911e=function(_0x31d862,_0x88724d){_0x31d862=_0x31d862-0x0;var _0x974c28=_0x11e9[_0x31d862];return _0x974c28;};'use strict';var client=require('../client');exports[_0x911e('0x0')]=function(){return function(){return client['Request'](_0x911e('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x911e('0x2'),_0x911e('0x3')],'include':[{'model':_0x911e('0x4'),'as':'Agents','attributes':['id','name','online',_0x911e('0x5')]}]},'log':'getOpenchannelQueues'});};};
\ No newline at end of file
+var _0x2c8d=['name','timeout','strategy','User','Agents','online','getOpenchannelQueues','Request'];(function(_0x32f6b9,_0x2d4aa9){var _0x267d52=function(_0x10f74f){while(--_0x10f74f){_0x32f6b9['push'](_0x32f6b9['shift']());}};_0x267d52(++_0x2d4aa9);}(_0x2c8d,0x1a6));var _0xd2c8=function(_0x51f79f,_0x210964){_0x51f79f=_0x51f79f-0x0;var _0x1eca59=_0x2c8d[_0x51f79f];return _0x1eca59;};'use strict';var client=require('../client');exports[_0xd2c8('0x0')]=function(){return function(){return client[_0xd2c8('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xd2c8('0x2'),_0xd2c8('0x3'),_0xd2c8('0x4')],'include':[{'model':_0xd2c8('0x5'),'as':_0xd2c8('0x6'),'attributes':['id',_0xd2c8('0x2'),_0xd2c8('0x7'),'openchannelPause']}]},'log':_0xd2c8('0x0')});};};
\ No newline at end of file
index d8434f4..4ca3314 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd9f1=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','create','Request'];(function(_0x283b70,_0x2befa8){var _0x27ee85=function(_0x3e1206){while(--_0x3e1206){_0x283b70['push'](_0x283b70['shift']());}};_0x27ee85(++_0x2befa8);}(_0xd9f1,0xb7));var _0x1d9f=function(_0x334b5a,_0x1b39ce){_0x334b5a=_0x334b5a-0x0;var _0x5a57aa=_0xd9f1[_0x334b5a];return _0x5a57aa;};'use strict';var client=require('../client');exports[_0x1d9f('0x0')]=function(_0x338e30){return client[_0x1d9f('0x1')]('CreateOpenchannelQueueReport',{'body':_0x338e30,'log':_0x1d9f('0x2')});};exports['update']=function(_0x1d8d9f,_0x11cd0d){return client[_0x1d9f('0x1')](_0x1d9f('0x3'),{'body':_0x11cd0d,'options':{'where':{'uniqueid':_0x1d8d9f},'order':[['id',_0x1d9f('0x4')]],'limit':0x1},'log':_0x1d9f('0x3')});};
\ No newline at end of file
+var _0xa0d9=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x328586,_0x1f0d3a){var _0x4725f2=function(_0x330fa0){while(--_0x330fa0){_0x328586['push'](_0x328586['shift']());}};_0x4725f2(++_0x1f0d3a);}(_0xa0d9,0x1e0));var _0x9a0d=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0xa0d9[_0x5a4400];return _0xf9b532;};'use strict';var client=require(_0x9a0d('0x0'));exports[_0x9a0d('0x1')]=function(_0x5c7504){return client[_0x9a0d('0x2')](_0x9a0d('0x3'),{'body':_0x5c7504,'log':_0x9a0d('0x3')});};exports[_0x9a0d('0x4')]=function(_0x4d98c1,_0x435a86){return client[_0x9a0d('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x435a86,'options':{'where':{'uniqueid':_0x4d98c1},'order':[['id','DESC']],'limit':0x1},'log':_0x9a0d('0x5')});};
\ No newline at end of file
index 885948c..724dcb5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x535f=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x535f,0x111));var _0xf535=function(_0x58ed0e,_0x5040e2){_0x58ed0e=_0x58ed0e-0x0;var _0x2dabdc=_0x535f[_0x58ed0e];return _0x2dabdc;};'use strict';var client=require('../client');exports[_0xf535('0x0')]=function(_0x1ef4bf,_0x496ab4){return client[_0xf535('0x1')](_0xf535('0x2'),{'body':_0x496ab4,'options':{'where':{'id':_0x1ef4bf}},'log':_0xf535('0x3')});};exports[_0xf535('0x4')]=function(_0x4ff0b3,_0xd1ee93){return client[_0xf535('0x1')](_0xf535('0x5'),{'body':_0xd1ee93,'options':{'where':{'id':_0x4ff0b3}},'log':_0xf535('0x6')});};
\ No newline at end of file
+var _0x2427=['addTags','AddTagsToSmsInteraction','../client','update','UpdateSmsInteraction'];(function(_0x4a50ab,_0x9330c6){var _0x37bbeb=function(_0x22bbf3){while(--_0x22bbf3){_0x4a50ab['push'](_0x4a50ab['shift']());}};_0x37bbeb(++_0x9330c6);}(_0x2427,0x165));var _0x7242=function(_0x4211b1,_0x1530d7){_0x4211b1=_0x4211b1-0x0;var _0x3778aa=_0x2427[_0x4211b1];return _0x3778aa;};'use strict';var client=require(_0x7242('0x0'));exports[_0x7242('0x1')]=function(_0x4c1fcb,_0x8a792){return client['Request'](_0x7242('0x2'),{'body':_0x8a792,'options':{'where':{'id':_0x4c1fcb}},'log':'updateSmsInteraction'});};exports[_0x7242('0x3')]=function(_0x12766a,_0x226e44){return client['Request'](_0x7242('0x4'),{'body':_0x226e44,'options':{'where':{'id':_0x12766a}},'log':'addTagsToSmsInteraction'});};
\ No newline at end of file
index 039b674..0789107 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2a49=['Request','createSmsMessage','../client','create'];(function(_0x2a8807,_0x36e6eb){var _0x36fe02=function(_0x47acf1){while(--_0x47acf1){_0x2a8807['push'](_0x2a8807['shift']());}};_0x36fe02(++_0x36e6eb);}(_0x2a49,0x1e6));var _0x92a4=function(_0xebe385,_0x2e6050){_0xebe385=_0xebe385-0x0;var _0x579244=_0x2a49[_0xebe385];return _0x579244;};'use strict';var client=require(_0x92a4('0x0'));exports[_0x92a4('0x1')]=function(_0x12d204){return client[_0x92a4('0x2')]('CreateSmsMessage',{'body':_0x12d204,'log':_0x92a4('0x3')});};
\ No newline at end of file
+var _0x8213=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x539148,_0x1d0d09){var _0x537729=function(_0x46d3d5){while(--_0x46d3d5){_0x539148['push'](_0x539148['shift']());}};_0x537729(++_0x1d0d09);}(_0x8213,0x11f));var _0x3821=function(_0x4b3b60,_0x5176f6){_0x4b3b60=_0x4b3b60-0x0;var _0x2476e3=_0x8213[_0x4b3b60];return _0x2476e3;};'use strict';var client=require(_0x3821('0x0'));exports[_0x3821('0x1')]=function(_0x5dbd98){return client[_0x3821('0x2')](_0x3821('0x3'),{'body':_0x5dbd98,'log':_0x3821('0x4')});};
\ No newline at end of file
index f985184..bea4cef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x5b5895,_0x25dfa4){var _0x1f0b63=function(_0x36994c){while(--_0x36994c){_0x5b5895['push'](_0x5b5895['shift']());}};_0x1f0b63(++_0x25dfa4);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};};
\ No newline at end of file
+var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x59145a,_0x1f60f1){var _0xf04d7=function(_0x247581){while(--_0x247581){_0x59145a['push'](_0x59145a['shift']());}};_0xf04d7(++_0x1f60f1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};};
\ No newline at end of file
index b9e385d..05e120f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x1c012d,_0x549b4a){var _0x5428e4=function(_0x349c2f){while(--_0x349c2f){_0x1c012d['push'](_0x1c012d['shift']());}};_0x5428e4(++_0x549b4a);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});};
\ No newline at end of file
+var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x247a65,_0x21a2b5){var _0x6f625=function(_0x53ecc1){while(--_0x53ecc1){_0x247a65['push'](_0x247a65['shift']());}};_0x6f625(++_0x21a2b5);}(_0x34e8,0x12c));var _0x834e=function(_0x261a82,_0x10e96a){_0x261a82=_0x261a82-0x0;var _0x213c6a=_0x34e8[_0x261a82];return _0x213c6a;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});};
\ No newline at end of file
index 0727b22..82ad2df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x16457c,_0x1e0a3d){var _0x58a87b=function(_0x1ac3a7){while(--_0x1ac3a7){_0x16457c['push'](_0x16457c['shift']());}};_0x58a87b(++_0x1e0a3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};};
\ No newline at end of file
+var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x5820a9,_0x4cb7b0){var _0x2321b1=function(_0x29f597){while(--_0x29f597){_0x5820a9['push'](_0x5820a9['shift']());}};_0x2321b1(++_0x4cb7b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};};
\ No newline at end of file
index 7cf69bd..e393427 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a2f=['update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0xfe2fda,_0x13de91){var _0x4b9305=function(_0xc0e096){while(--_0xc0e096){_0xfe2fda['push'](_0xfe2fda['shift']());}};_0x4b9305(++_0x13de91);}(_0x7a2f,0x99));var _0xf7a2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a2f[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xf7a2('0x0'));exports[_0xf7a2('0x1')]=function(_0x4bc887,_0x296ad3){return client[_0xf7a2('0x2')](_0xf7a2('0x3'),{'body':_0x296ad3,'options':{'where':{'id':_0x4bc887}},'log':'updateWhatsappInteraction'});};exports[_0xf7a2('0x4')]=function(_0xc47429,_0x25b3e0){return client[_0xf7a2('0x2')](_0xf7a2('0x5'),{'body':_0x25b3e0,'options':{'where':{'id':_0xc47429}},'log':_0xf7a2('0x6')});};
\ No newline at end of file
+var _0xb7f0=['addTagsToWhatsappInteraction','../client','update','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x461c39,_0x2ffc4e){_0x461c39=_0x461c39-0x0;var _0x149a9b=_0xb7f0[_0x461c39];return _0x149a9b;};'use strict';var client=require(_0x0b7f('0x0'));exports[_0x0b7f('0x1')]=function(_0x6640b,_0x405325){return client['Request']('UpdateWhatsappInteraction',{'body':_0x405325,'options':{'where':{'id':_0x6640b}},'log':_0x0b7f('0x2')});};exports[_0x0b7f('0x3')]=function(_0x228377,_0x188ea8){return client[_0x0b7f('0x4')](_0x0b7f('0x5'),{'body':_0x188ea8,'options':{'where':{'id':_0x228377}},'log':_0x0b7f('0x6')});};
\ No newline at end of file
index 97aeee2..4b312f3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6eee=['create','Request','CreateWhatsappMessage','../client'];(function(_0x2cf227,_0xcb70f5){var _0x4cfd52=function(_0x24e81c){while(--_0x24e81c){_0x2cf227['push'](_0x2cf227['shift']());}};_0x4cfd52(++_0xcb70f5);}(_0x6eee,0xfb));var _0xe6ee=function(_0x15b58b,_0x270745){_0x15b58b=_0x15b58b-0x0;var _0x3563e9=_0x6eee[_0x15b58b];return _0x3563e9;};'use strict';var client=require(_0xe6ee('0x0'));exports[_0xe6ee('0x1')]=function(_0x575108){return client[_0xe6ee('0x2')](_0xe6ee('0x3'),{'body':_0x575108,'log':'createWhatsappMessage'});};
\ No newline at end of file
+var _0xf2aa=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x41c05e,_0x597110){var _0x14e5f3=function(_0x7c139c){while(--_0x7c139c){_0x41c05e['push'](_0x41c05e['shift']());}};_0x14e5f3(++_0x597110);}(_0xf2aa,0x1cf));var _0xaf2a=function(_0x2e4dfa,_0x13c01e){_0x2e4dfa=_0x2e4dfa-0x0;var _0x502308=_0xf2aa[_0x2e4dfa];return _0x502308;};'use strict';var client=require(_0xaf2a('0x0'));exports[_0xaf2a('0x1')]=function(_0x23c50d){return client[_0xaf2a('0x2')](_0xaf2a('0x3'),{'body':_0x23c50d,'log':_0xaf2a('0x4')});};
\ No newline at end of file
index 84b7a81..f772766 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe82f=['online','getWhatsappQueues','GetWhatsappQueue','name','timeout','User'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe82f,0x199));var _0xfe82=function(_0x206471,_0x5a51bd){_0x206471=_0x206471-0x0;var _0x46c467=_0xe82f[_0x206471];return _0x46c467;};'use strict';var client=require('../client');exports[_0xfe82('0x0')]=function(){return function(){return client['Request'](_0xfe82('0x1'),{'options':{'raw':![],'attributes':['id',_0xfe82('0x2'),_0xfe82('0x3'),'strategy'],'include':[{'model':_0xfe82('0x4'),'as':'Agents','attributes':['id',_0xfe82('0x2'),_0xfe82('0x5'),'whatsappPause']}]},'log':_0xfe82('0x0')});};};
\ No newline at end of file
+var _0x2d19=['Agents','online','whatsappPause','getWhatsappQueues','GetWhatsappQueue','name'];(function(_0x5df35c,_0x2ab072){var _0x5233be=function(_0x52649a){while(--_0x52649a){_0x5df35c['push'](_0x5df35c['shift']());}};_0x5233be(++_0x2ab072);}(_0x2d19,0xa5));var _0x92d1=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0x2d19[_0xd336fa];return _0x3370b1;};'use strict';var client=require('../client');exports[_0x92d1('0x0')]=function(){return function(){return client['Request'](_0x92d1('0x1'),{'options':{'raw':![],'attributes':['id',_0x92d1('0x2'),'timeout','strategy'],'include':[{'model':'User','as':_0x92d1('0x3'),'attributes':['id',_0x92d1('0x2'),_0x92d1('0x4'),_0x92d1('0x5')]}]},'log':_0x92d1('0x0')});};};
\ No newline at end of file
index e3bc7c9..0ea66ef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4c98=['create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','DESC'];(function(_0x1cf856,_0x4fd783){var _0x4afe99=function(_0x28fe15){while(--_0x28fe15){_0x1cf856['push'](_0x1cf856['shift']());}};_0x4afe99(++_0x4fd783);}(_0x4c98,0xf6));var _0x84c9=function(_0x19aa4a,_0x443a1a){_0x19aa4a=_0x19aa4a-0x0;var _0x7363aa=_0x4c98[_0x19aa4a];return _0x7363aa;};'use strict';var client=require('../client');exports[_0x84c9('0x0')]=function(_0x4a16e6){return client['Request'](_0x84c9('0x1'),{'body':_0x4a16e6,'log':_0x84c9('0x1')});};exports[_0x84c9('0x2')]=function(_0x763195,_0x1fa641){return client[_0x84c9('0x3')](_0x84c9('0x4'),{'body':_0x1fa641,'options':{'where':{'uniqueid':_0x763195},'order':[['id',_0x84c9('0x5')]],'limit':0x1},'log':_0x84c9('0x4')});};
\ No newline at end of file
+var _0xbbdd=['DESC','UpdateWhatsappQueueReport','../client','Request','CreateWhatsappQueueReport','update'];(function(_0x2d79fc,_0x83fc34){var _0x2e0cc0=function(_0x248ddb){while(--_0x248ddb){_0x2d79fc['push'](_0x2d79fc['shift']());}};_0x2e0cc0(++_0x83fc34);}(_0xbbdd,0x86));var _0xdbbd=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xbbdd[_0x45bf86];return _0x1f02b7;};'use strict';var client=require(_0xdbbd('0x0'));exports['create']=function(_0x5a3bd5){return client[_0xdbbd('0x1')]('CreateWhatsappQueueReport',{'body':_0x5a3bd5,'log':_0xdbbd('0x2')});};exports[_0xdbbd('0x3')]=function(_0x355e26,_0x59c1ed){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x59c1ed,'options':{'where':{'uniqueid':_0x355e26},'order':[['id',_0xdbbd('0x4')]],'limit':0x1},'log':_0xdbbd('0x5')});};
\ No newline at end of file
index 821d9e1..b2cafa8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9f5=['find','agents','timeout','createQueue','atimeout','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','error','log','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','validate','length','[%s][AGENT]\x20%s','map','message','join','stop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9f5,0x1bf));var _0x5a9f=function(_0x43d2f6,_0x36a669){_0x43d2f6=_0x43d2f6-0x0;var _0x5f2e1f=_0xa9f5[_0x43d2f6];return _0x5f2e1f;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x5a9f('0x0'));var seqqueue=require(_0x5a9f('0x1'));var logger=require(_0x5a9f('0x2'))(_0x5a9f('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x5a9f('0x4'),'required':!![],'message':_0x5a9f('0x5')},'timeout':{'type':_0x5a9f('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x228552,_0x49eccc,_0x5b8064){return logger[_0x5a9f('0x7')](util[_0x5a9f('0x8')](_0x5a9f('0x9'),_0x228552,_0x49eccc['name'],_0x5b8064));}function handleFindAgent(_0x530949){return function(_0x2fb043){return _0x2fb043[_0x5a9f('0xa')]['toLowerCase']()===_0x530949['toLowerCase']();};}exports['consequence']=function(_0x3611d3,_0x24c6a6,_0x31fb3b,_0x27e5f7){return function(_0xa7c850){try{var _0x3b84af={'name':_0x24c6a6[0x0],'timeout':_0x24c6a6[0x1]};var _0x180cd2=queue[_0x5a9f('0xb')](_0x3b84af,{'typecast':!![]});if(_0x180cd2[_0x5a9f('0xc')]){logger['error'](_0x5a9f('0xd'),_0x3611d3,_[_0x5a9f('0xe')](_0x180cd2,_0x5a9f('0xf'))[_0x5a9f('0x10')](',\x20'));_0xa7c850[_0x5a9f('0x11')]();}else{var _0x590910=_[_0x5a9f('0x12')](_0x31fb3b[_0x5a9f('0x13')],handleFindAgent(_0x3b84af[_0x5a9f('0xa')]));if(_0x590910){var _0x467e48=(_0x3b84af[_0x5a9f('0x14')]||0xa)*0x3e8;var _0x5c0fda,_0x33d1b4;var _0x1634c7=seqqueue[_0x5a9f('0x15')](_0x467e48);_0x1634c7['id']=_0x3611d3;_0x1634c7[_0x5a9f('0x16')]=_0x467e48;_0x1634c7['channel']=_0x27e5f7['channel'];writeLog(_0x3611d3,_0x590910,util[_0x5a9f('0x8')]('START:%s',_0x467e48));_0x31fb3b[_0x5a9f('0x17')][_0x3611d3]['on']('end',function(){logger['info'](_0x5a9f('0x18'),_0x3611d3);clearTimeout(_0x33d1b4);_0x33d1b4=undefined;_0x1634c7['close']();if(_0x31fb3b[_0x5a9f('0x17')][_0x3611d3]){delete _0x31fb3b['rules'][_0x3611d3];}_0xa7c850['stop']();});_0x31fb3b[_0x5a9f('0x17')][_0x3611d3]['on']('complete',function(){if(_0x31fb3b[_0x5a9f('0x17')][_0x3611d3]){delete _0x31fb3b[_0x5a9f('0x17')][_0x3611d3];}});_0x33d1b4=setTimeout(function(){logger[_0x5a9f('0x7')](_0x5a9f('0x19'),_0x3611d3);clearTimeout(_0x33d1b4);_0x1634c7[_0x5a9f('0x1a')]();_0xa7c850[_0x5a9f('0x1b')]();},_0x467e48);strategy[_0x5a9f('0x1c')](_0x1634c7,_0x590910,_0x31fb3b,_0x27e5f7);}else{logger[_0x5a9f('0x1d')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x3611d3,_0x3b84af[_0x5a9f('0xa')]);_0xa7c850[_0x5a9f('0x11')]();}}}catch(_0x16db65){console[_0x5a9f('0x1e')](_0x16db65);logger[_0x5a9f('0x1d')]('[%s][QUEUE]\x20%s',_0x3611d3,_0x16db65['stack']);_0xa7c850['stop']();}};};
\ No newline at end of file
+var _0x667d=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','../../../../config/logger','routing'];(function(_0x23fbc1,_0x20d496){var _0x1d6859=function(_0x27a884){while(--_0x27a884){_0x23fbc1['push'](_0x23fbc1['shift']());}};_0x1d6859(++_0x20d496);}(_0x667d,0x1b5));var _0xd667=function(_0x25bd22,_0x2ccf27){_0x25bd22=_0x25bd22-0x0;var _0x2909fd=_0x667d[_0x25bd22];return _0x2909fd;};'use strict';var schema=require(_0xd667('0x0'));var _=require(_0xd667('0x1'));var util=require('util');var seqqueue=require(_0xd667('0x2'));var logger=require(_0xd667('0x3'))(_0xd667('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0xd667('0x5')},'timeout':{'type':_0xd667('0x6'),'message':_0xd667('0x7')}});function writeLog(_0x1f9874,_0x10a50a,_0x5625e5){return logger[_0xd667('0x8')](util[_0xd667('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1f9874,_0x10a50a[_0xd667('0xa')],_0x5625e5));}function handleFindAgent(_0xc8133f){return function(_0x1f1877){return _0x1f1877[_0xd667('0xa')][_0xd667('0xb')]()===_0xc8133f[_0xd667('0xb')]();};}exports[_0xd667('0xc')]=function(_0xc44032,_0x12ce83,_0x188fa2,_0x466ca4){return function(_0x4c1b9f){try{var _0x83f53={'name':_0x12ce83[0x0],'timeout':_0x12ce83[0x1]};var _0x41f293=queue[_0xd667('0x0')](_0x83f53,{'typecast':!![]});if(_0x41f293[_0xd667('0xd')]){logger[_0xd667('0xe')](_0xd667('0xf'),_0xc44032,_[_0xd667('0x10')](_0x41f293,_0xd667('0x11'))['join'](',\x20'));_0x4c1b9f[_0xd667('0x12')]();}else{var _0x205b6b=_['find'](_0x188fa2[_0xd667('0x13')],handleFindAgent(_0x83f53[_0xd667('0xa')]));if(_0x205b6b){var _0x40b756=(_0x83f53[_0xd667('0x14')]||0xa)*0x3e8;var _0x7b53b5,_0x2f33a5;var _0x1c6bfa=seqqueue[_0xd667('0x15')](_0x40b756);_0x1c6bfa['id']=_0xc44032;_0x1c6bfa[_0xd667('0x16')]=_0x40b756;_0x1c6bfa['channel']=_0x466ca4[_0xd667('0x17')];writeLog(_0xc44032,_0x205b6b,util['format'](_0xd667('0x18'),_0x40b756));_0x188fa2[_0xd667('0x19')][_0xc44032]['on']('end',function(){logger[_0xd667('0x8')](_0xd667('0x1a'),_0xc44032);clearTimeout(_0x2f33a5);_0x2f33a5=undefined;_0x1c6bfa[_0xd667('0x1b')]();if(_0x188fa2['rules'][_0xc44032]){delete _0x188fa2['rules'][_0xc44032];}_0x4c1b9f['stop']();});_0x188fa2[_0xd667('0x19')][_0xc44032]['on'](_0xd667('0x1c'),function(){if(_0x188fa2[_0xd667('0x19')][_0xc44032]){delete _0x188fa2[_0xd667('0x19')][_0xc44032];}});_0x2f33a5=setTimeout(function(){logger[_0xd667('0x8')](_0xd667('0x1d'),_0xc44032);clearTimeout(_0x2f33a5);_0x1c6bfa['close']();_0x4c1b9f[_0xd667('0x1e')]();},_0x40b756);strategy['agent'](_0x1c6bfa,_0x205b6b,_0x188fa2,_0x466ca4);}else{logger['error'](_0xd667('0x1f'),_0xc44032,_0x83f53[_0xd667('0xa')]);_0x4c1b9f[_0xd667('0x12')]();}}}catch(_0x1418ce){console[_0xd667('0x20')](_0x1418ce);logger[_0xd667('0xe')]('[%s][QUEUE]\x20%s',_0xc44032,_0x1418ce[_0xd667('0x21')]);_0x4c1b9f['stop']();}};};
\ No newline at end of file
index 7954369..3f5daae 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd835=['routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','out','channel','sms','whatsapp','interaction','phone','chat','upperFirst','body','create','then','catch','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','toString','postText','error','message','providerName','dialogState','Failed','lodash','aws-sdk','./utils','../../../../config/logger'];(function(_0x2136cb,_0x5c7bb1){var _0x3f6117=function(_0x2a8f93){while(--_0x2a8f93){_0x2136cb['push'](_0x2136cb['shift']());}};_0x3f6117(++_0x5c7bb1);}(_0xd835,0x114));var _0x5d83=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0xd835[_0x3815c2];return _0x271f88;};'use strict';var _=require(_0x5d83('0x0'));var moment=require('moment');var AWS=require(_0x5d83('0x1'));var utils=require(_0x5d83('0x2'));var logger=require(_0x5d83('0x3'))(_0x5d83('0x4'));var rpc={'chatMessage':require(_0x5d83('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x5d83('0x6')),'smsMessage':require(_0x5d83('0x7')),'faxMessage':require(_0x5d83('0x8')),'whatsappMessage':require(_0x5d83('0x9'))};exports['consequence']=function(_0x3acfc8,_0x4d191e){return function(_0x199f16){try{if(!_[_0x5d83('0xa')](this['interaction'][_0x5d83('0xb')])){logger[_0x5d83('0xc')](_0x5d83('0xd'),_0x3acfc8,_0x5d83('0xe'));return _0x199f16[_0x5d83('0xf')]();}var _0x569cc7={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5d83('0x10')};if(this[_0x5d83('0x11')]===_0x5d83('0x12')||this[_0x5d83('0x11')]===_0x5d83('0x13')){_0x569cc7['phone']=this[_0x5d83('0x14')][_0x5d83('0x15')];}var _0x55ef2c=this[_0x5d83('0x11')];if(_0x55ef2c===_0x5d83('0x16')){_0x569cc7['ChatWebsiteId']=this['account']['id'];}else{_0x569cc7[_[_0x5d83('0x17')](_0x55ef2c)+'AccountId']=this['account']['id'];}_0x569cc7[_[_0x5d83('0x17')](_0x55ef2c)+'InteractionId']=this[_0x5d83('0x14')]['id'];if(this['interaction']['created']){var _0x78b195=_0x4d191e[0x4];if(!_['isEmpty'](_0x78b195)){_0x569cc7[_0x5d83('0x18')]=utils['getMustacheRender'](_0x78b195,this);return rpc[_0x55ef2c+'Message'][_0x5d83('0x19')](_0x569cc7)[_0x5d83('0x1a')](function(_0x40ea50){logger[_0x5d83('0xc')](_0x5d83('0xd'),_0x3acfc8,_0x569cc7[_0x5d83('0x18')]);})[_0x5d83('0x1b')](function(_0x2ded88){logger['error']('[%s][AMAZONLEX]\x20%s',_0x3acfc8,JSON[_0x5d83('0x1c')](_0x2ded88));})[_0x5d83('0x1d')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3acfc8);_0x199f16[_0x5d83('0x1e')]();});}else{logger[_0x5d83('0xc')](_0x5d83('0x1f'),_0x3acfc8);_0x199f16['stop']();}}else{var _0x322b4f=this;var _0x4b3df4=new AWS[(_0x5d83('0x20'))]({'accessKeyId':_0x4d191e[0x0],'secretAccessKey':_0x4d191e[0x1],'region':_0x4d191e[0x2]});var _0x315d60={'botAlias':'$LATEST','botName':_0x4d191e[0x3],'inputText':this['message']['body'],'userId':this[_0x5d83('0x11')]+':'+this[_0x5d83('0x14')]['id'][_0x5d83('0x21')]()};_0x4b3df4[_0x5d83('0x22')](_0x315d60,function(_0x56ea2e,_0x29d622){if(_0x56ea2e){logger[_0x5d83('0x23')]('[%s][AMAZONLEX]\x20%s',_0x3acfc8,_0x56ea2e['message']);_0x199f16['next']();}else if(_0x29d622&&_0x29d622[_0x5d83('0x24')]){_0x322b4f[_0x5d83('0x18')]['amazonlex']=_0x29d622;_0x569cc7['body']=_0x29d622['message'];_0x569cc7[_0x5d83('0x25')]='amazonlex';_0x569cc7['providerResponse']=JSON[_0x5d83('0x1c')](_0x29d622);return rpc[_0x55ef2c+'Message'][_0x5d83('0x19')](_0x569cc7)[_0x5d83('0x1a')](function(_0x554a03){logger[_0x5d83('0xc')]('[%s][AMAZONLEX]\x20%s',_0x3acfc8,_0x569cc7[_0x5d83('0x18')]);if(_0x29d622[_0x5d83('0x26')]==_0x5d83('0x27')){_0x199f16[_0x5d83('0xf')]();}else{_0x199f16[_0x5d83('0x1e')]();}})[_0x5d83('0x1b')](function(_0x27db66){logger[_0x5d83('0x23')](_0x5d83('0xd'),_0x3acfc8,JSON[_0x5d83('0x1c')](_0x27db66));_0x199f16[_0x5d83('0xf')]();});}else{_0x199f16[_0x5d83('0xf')]();}});}}catch(_0x2655f9){logger[_0x5d83('0x23')]('[%s][AMAZONLEX]\x20%s',_0x3acfc8,JSON[_0x5d83('0x1c')](_0x2655f9));_0x199f16[_0x5d83('0x1e')]();}};};
\ No newline at end of file
+var _0x291c=['stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','error'];(function(_0x26d22d,_0x3ee820){var _0x2a9571=function(_0x186ece){while(--_0x186ece){_0x26d22d['push'](_0x26d22d['shift']());}};_0x2a9571(++_0x3ee820);}(_0x291c,0x75));var _0xc291=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x291c[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xc291('0x0'));var moment=require('moment');var AWS=require(_0xc291('0x1'));var utils=require(_0xc291('0x2'));var logger=require(_0xc291('0x3'))('routing');var rpc={'chatMessage':require(_0xc291('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc291('0x5')),'smsMessage':require(_0xc291('0x6')),'faxMessage':require(_0xc291('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xc291('0x8')]=function(_0x293e0d,_0x535f33){return function(_0x2d0d3c){try{if(!_[_0xc291('0x9')](this[_0xc291('0xa')][_0xc291('0xb')])){logger[_0xc291('0xc')]('[%s][AMAZONLEX]\x20%s',_0x293e0d,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2d0d3c[_0xc291('0xd')]();}var _0x2bb061={'ContactId':this[_0xc291('0xe')]['id'],'sentAt':moment()[_0xc291('0xf')](_0xc291('0x10')),'direction':'out'};if(this[_0xc291('0x11')]===_0xc291('0x12')||this['channel']==='whatsapp'){_0x2bb061[_0xc291('0x13')]=this['interaction'][_0xc291('0x13')];}var _0x14bebb=this[_0xc291('0x11')];if(_0x14bebb===_0xc291('0x14')){_0x2bb061[_0xc291('0x15')]=this[_0xc291('0x16')]['id'];}else{_0x2bb061[_[_0xc291('0x17')](_0x14bebb)+_0xc291('0x18')]=this['account']['id'];}_0x2bb061[_[_0xc291('0x17')](_0x14bebb)+_0xc291('0x19')]=this[_0xc291('0xa')]['id'];if(this['interaction'][_0xc291('0x1a')]){var _0x12287d=_0x535f33[0x4];if(!_[_0xc291('0x1b')](_0x12287d)){_0x2bb061[_0xc291('0x1c')]=utils[_0xc291('0x1d')](_0x12287d,this);return rpc[_0x14bebb+_0xc291('0x1e')][_0xc291('0x1f')](_0x2bb061)[_0xc291('0x20')](function(_0x225ef4){logger[_0xc291('0xc')](_0xc291('0x21'),_0x293e0d,_0x2bb061[_0xc291('0x1c')]);})[_0xc291('0x22')](function(_0x528a5e){logger[_0xc291('0x23')](_0xc291('0x21'),_0x293e0d,JSON[_0xc291('0x24')](_0x528a5e));})[_0xc291('0x25')](function(){logger[_0xc291('0xc')](_0xc291('0x26'),_0x293e0d);_0x2d0d3c[_0xc291('0x27')]();});}else{logger['info'](_0xc291('0x28'),_0x293e0d);_0x2d0d3c[_0xc291('0x27')]();}}else{var _0x4e160f=this;var _0x20a08d=new AWS[(_0xc291('0x29'))]({'accessKeyId':_0x535f33[0x0],'secretAccessKey':_0x535f33[0x1],'region':_0x535f33[0x2]});var _0x172703={'botAlias':_0xc291('0x2a'),'botName':_0x535f33[0x3],'inputText':this[_0xc291('0x2b')][_0xc291('0x1c')],'userId':this['channel']+':'+this[_0xc291('0xa')]['id'][_0xc291('0x2c')]()};_0x20a08d[_0xc291('0x2d')](_0x172703,function(_0x260895,_0x8ef9c2){if(_0x260895){logger['error'](_0xc291('0x21'),_0x293e0d,_0x260895[_0xc291('0x2b')]);_0x2d0d3c['next']();}else if(_0x8ef9c2&&_0x8ef9c2['message']){_0x4e160f[_0xc291('0x1c')][_0xc291('0x2e')]=_0x8ef9c2;_0x2bb061[_0xc291('0x1c')]=_0x8ef9c2[_0xc291('0x2b')];_0x2bb061[_0xc291('0x2f')]=_0xc291('0x2e');_0x2bb061[_0xc291('0x30')]=JSON[_0xc291('0x24')](_0x8ef9c2);return rpc[_0x14bebb+'Message']['create'](_0x2bb061)[_0xc291('0x20')](function(_0x1c8a64){logger[_0xc291('0xc')]('[%s][AMAZONLEX]\x20%s',_0x293e0d,_0x2bb061[_0xc291('0x1c')]);if(_0x8ef9c2[_0xc291('0x31')]==_0xc291('0x32')){_0x2d0d3c[_0xc291('0xd')]();}else{_0x2d0d3c[_0xc291('0x27')]();}})[_0xc291('0x22')](function(_0x69df4e){logger['error'](_0xc291('0x21'),_0x293e0d,JSON[_0xc291('0x24')](_0x69df4e));_0x2d0d3c['next']();});}else{_0x2d0d3c[_0xc291('0xd')]();}});}}catch(_0x183b92){logger['error'](_0xc291('0x21'),_0x293e0d,JSON[_0xc291('0x24')](_0x183b92));_0x2d0d3c[_0xc291('0x27')]();}};};
\ No newline at end of file
index 5f76c33..b7f0b7d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8119=['consequence','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','inReplyTo','messageId','replace','<div\x20id=\x22xm-mail-content\x22','<div','auto-replied','All','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','catch','finally','resolve','update','stringify','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x8119,0xc1));var _0x9811=function(_0x1d8cb0,_0x4135e1){_0x1d8cb0=_0x1d8cb0-0x0;var _0x113ba1=_0x8119[_0x1d8cb0];return _0x113ba1;};'use strict';var _=require(_0x9811('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0x9811('0x1'))(_0x9811('0x2'));var rpc={'chatMessage':require(_0x9811('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9811('0x4')),'smsMessage':require(_0x9811('0x5')),'faxMessage':require(_0x9811('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x9811('0x7')),'mailInteraction':require(_0x9811('0x8')),'smsInteraction':require(_0x9811('0x9')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x9811('0xa'))};var mailRpc=require('../../mailRpc');exports[_0x9811('0xb')]=function(_0x5529d6,_0x1b04b1,_0x55e9ce,_0x215e51){return function(_0x61675b){try{var _0x126c8e=this['channel'];if(_0x126c8e===_0x9811('0xc')&&_0x215e51[_0x9811('0xd')][_0x9811('0xe')]){logger[_0x9811('0xf')](_0x9811('0x10'),_0x5529d6,_0x9811('0x11'));return _0x61675b[_0x9811('0x12')]();}if(_0x1b04b1[0x0]==='1'&&(_[_0x9811('0x13')](this['interaction']['created'])||!this[_0x9811('0x14')][_0x9811('0x15')])){logger[_0x9811('0xf')](_0x9811('0x10'),_0x5529d6,_0x9811('0x16'));return _0x61675b[_0x9811('0x12')]();}if(_0x1b04b1[0x0]==='2'&&this[_0x9811('0x14')][_0x9811('0x17')]){logger['info'](_0x9811('0x18'),_0x5529d6,_0x9811('0x19'));return _0x61675b[_0x9811('0x12')]();}var _0x141214={'ContactId':this[_0x9811('0x1a')]['id'],'sentAt':moment()[_0x9811('0x1b')](_0x9811('0x1c')),'direction':_0x9811('0x1d')};if(this[_0x9811('0x1e')]===_0x9811('0xc')){_0x141214[_0x9811('0xd')]=utils[_0x9811('0x1f')](_0x1b04b1[0x2],this);}else{_0x141214[_0x9811('0xd')]=utils['getMustacheRender'](_0x1b04b1[0x1],this);}if(this['message']){_0x141214['to']=this[_0x9811('0x20')][_0x9811('0x21')]||'';if(this['channel']===_0x9811('0xc')&&_0x1b04b1[0x1]==='1'){_0x141214['cc']=this[_0x9811('0x20')]['cc']||'';}_0x141214[_0x9811('0x21')]=this[_0x9811('0x20')]['to']||'';_0x141214['phone']=this[_0x9811('0x20')][_0x9811('0x22')]||'';_0x141214[_0x9811('0x23')]=!![];if(this['message'][_0x9811('0x24')]){_0x141214[_0x9811('0x24')]='';_0x141214[_0x9811('0x24')]+=_[_0x9811('0x25')](this[_0x9811('0x20')][_0x9811('0x24')],_0x9811('0x26'))?'':_0x9811('0x27');_0x141214[_0x9811('0x24')]+=this[_0x9811('0x20')][_0x9811('0x24')];}}if(this[_0x9811('0x1e')]===_0x9811('0x28')){_0x141214[_0x9811('0x29')]=this['account']['id'];}else{_0x141214[_[_0x9811('0x2a')](this[_0x9811('0x1e')])+_0x9811('0x2b')]=this[_0x9811('0x2c')]['id'];}_0x141214[_[_0x9811('0x2a')](this[_0x9811('0x1e')])+_0x9811('0x2d')]=this[_0x9811('0x14')]['id'];var _0x5b2080=this['interaction'];if(rpc[this[_0x9811('0x1e')]+'Message']){if(this[_0x9811('0x1e')]==='mail'){_0x141214[_0x9811('0x2e')]=this[_0x9811('0x20')][_0x9811('0x2f')];_0x141214['html']='<div\x20id=\x22xm-mail-content\x22>'+_[_0x9811('0x30')](_0x141214[_0x9811('0xd')],_0x9811('0x31'),_0x9811('0x32'))+'</div>';_0x141214['headers']={'Auto-Submitted':_0x9811('0x33'),'X-Auto-Response-Suppress':_0x9811('0x34'),'Precedence':'auto_reply'};return mailRpc[_0x9811('0x35')](this[_0x9811('0x2c')][_0x9811('0x36')],_0x141214)[_0x9811('0x37')](function(_0x5dd4d6){logger[_0x9811('0xf')](_0x9811('0x38'),_0x5529d6);_0x141214[_0x9811('0x2f')]=_0x5dd4d6[_0x9811('0x20')][_0x9811('0x2f')];return rpc[_0x126c8e+_0x9811('0x39')][_0x9811('0x3a')](_0x141214);})[_0x9811('0x37')](function(_0x461ce8){logger[_0x9811('0xf')]('[%s][AUTOREPLY]\x20%s',_0x5529d6,JSON['stringify'](_0x461ce8));})[_0x9811('0x3b')](function(_0x4d9c71){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x5529d6,JSON['stringify'](_0x4d9c71));})[_0x9811('0x3c')](function(){Promise[_0x9811('0x3d')]()[_0x9811('0x37')](function(){if(_0x1b04b1[0x0]!=='2'||_0x5b2080[_0x9811('0x17')])return;return rpc[_0x126c8e+'Interaction'][_0x9811('0x3e')](_0x5b2080['id'],{'autoreplyExecuted':!![]})[_0x9811('0x37')](function(_0x49615c){logger['info'](_0x9811('0x18'),_0x5529d6,JSON[_0x9811('0x3f')](_0x49615c));})[_0x9811('0x3b')](function(_0x5a0fce){logger[_0x9811('0x40')](_0x9811('0x41'),_0x5529d6,JSON[_0x9811('0x3f')](_0x5a0fce));});})[_0x9811('0x37')](function(){_0x61675b[_0x9811('0x12')]();});});}else{return rpc[this[_0x9811('0x1e')]+_0x9811('0x39')][_0x9811('0x3a')](_0x141214)['then'](function(){logger[_0x9811('0xf')](_0x9811('0x10'),_0x5529d6,_0x141214['body']);})['catch'](function(_0x344de7){logger[_0x9811('0x40')](_0x9811('0x10'),_0x5529d6,JSON[_0x9811('0x3f')](_0x344de7));})[_0x9811('0x3c')](function(){Promise[_0x9811('0x3d')]()[_0x9811('0x37')](function(){if(_0x1b04b1[0x0]!=='2'||_0x5b2080[_0x9811('0x17')])return;return rpc[_0x126c8e+_0x9811('0x42')][_0x9811('0x3e')](_0x5b2080['id'],{'autoreplyExecuted':!![]})[_0x9811('0x37')](function(_0x4af583){logger[_0x9811('0xf')](_0x9811('0x18'),_0x5529d6,JSON['stringify'](_0x4af583));})[_0x9811('0x3b')](function(_0x1183f2){logger[_0x9811('0x40')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5529d6,JSON[_0x9811('0x3f')](_0x1183f2));});})[_0x9811('0x37')](function(){_0x61675b[_0x9811('0x12')]();});});}}}catch(_0x14f367){logger[_0x9811('0x40')](_0x9811('0x10'),_0x5529d6,JSON[_0x9811('0x3f')](_0x14f367));_0x61675b[_0x9811('0x43')]();}};};
\ No newline at end of file
+var _0x679d=['isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','channel','phone','read','subject','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','Message','messageId','html','<div\x20id=\x22xm-mail-content\x22>','replace','<div\x20id=\x22xm-mail-content\x22','<div','</div>','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next'];(function(_0x98f588,_0x5176a5){var _0x4ae56e=function(_0x1a901b){while(--_0x1a901b){_0x98f588['push'](_0x98f588['shift']());}};_0x4ae56e(++_0x5176a5);}(_0x679d,0xb6));var _0xd679=function(_0x39d187,_0x2c445e){_0x39d187=_0x39d187-0x0;var _0x628a8c=_0x679d[_0x39d187];return _0x628a8c;};'use strict';var _=require(_0xd679('0x0'));var moment=require('moment');var utils=require(_0xd679('0x1'));var logger=require('../../../../config/logger')(_0xd679('0x2'));var rpc={'chatMessage':require(_0xd679('0x3')),'openchannelMessage':require(_0xd679('0x4')),'mailMessage':require(_0xd679('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd679('0x6')),'whatsappMessage':require(_0xd679('0x7')),'chatInteraction':require(_0xd679('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xd679('0x9')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xd679('0xa')),'whatsappInteraction':require(_0xd679('0xb'))};var mailRpc=require('../../mailRpc');exports[_0xd679('0xc')]=function(_0x1794a6,_0x2610b7,_0x440985,_0x1a9258){return function(_0x1a7c85){try{var _0x3e658c=this['channel'];if(_0x3e658c===_0xd679('0xd')&&_0x1a9258['body'][_0xd679('0xe')]){logger[_0xd679('0xf')](_0xd679('0x10'),_0x1794a6,_0xd679('0x11'));return _0x1a7c85[_0xd679('0x12')]();}if(_0x2610b7[0x0]==='1'&&(_[_0xd679('0x13')](this[_0xd679('0x14')][_0xd679('0x15')])||!this['interaction']['created'])){logger['info'](_0xd679('0x10'),_0x1794a6,_0xd679('0x16'));return _0x1a7c85[_0xd679('0x12')]();}if(_0x2610b7[0x0]==='2'&&this['interaction'][_0xd679('0x17')]){logger[_0xd679('0xf')](_0xd679('0x18'),_0x1794a6,_0xd679('0x19'));return _0x1a7c85[_0xd679('0x12')]();}var _0x286baa={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xd679('0x1a')),'direction':_0xd679('0x1b')};if(this['channel']==='mail'){_0x286baa[_0xd679('0x1c')]=utils[_0xd679('0x1d')](_0x2610b7[0x2],this);}else{_0x286baa[_0xd679('0x1c')]=utils[_0xd679('0x1d')](_0x2610b7[0x1],this);}if(this[_0xd679('0x1e')]){_0x286baa['to']=this[_0xd679('0x1e')]['from']||'';if(this[_0xd679('0x1f')]==='mail'&&_0x2610b7[0x1]==='1'){_0x286baa['cc']=this[_0xd679('0x1e')]['cc']||'';}_0x286baa['from']=this['message']['to']||'';_0x286baa[_0xd679('0x20')]=this[_0xd679('0x1e')]['phone']||'';_0x286baa[_0xd679('0x21')]=!![];if(this[_0xd679('0x1e')][_0xd679('0x22')]){_0x286baa[_0xd679('0x22')]='';_0x286baa[_0xd679('0x22')]+=_['startsWith'](this['message']['subject'],_0xd679('0x23'))?'':_0xd679('0x24');_0x286baa['subject']+=this['message'][_0xd679('0x22')];}}if(this[_0xd679('0x1f')]==='chat'){_0x286baa[_0xd679('0x25')]=this[_0xd679('0x26')]['id'];}else{_0x286baa[_[_0xd679('0x27')](this['channel'])+_0xd679('0x28')]=this[_0xd679('0x26')]['id'];}_0x286baa[_[_0xd679('0x27')](this[_0xd679('0x1f')])+'InteractionId']=this[_0xd679('0x14')]['id'];var _0xc8ba9e=this[_0xd679('0x14')];if(rpc[this[_0xd679('0x1f')]+_0xd679('0x29')]){if(this[_0xd679('0x1f')]==='mail'){_0x286baa['inReplyTo']=this[_0xd679('0x1e')][_0xd679('0x2a')];_0x286baa[_0xd679('0x2b')]=_0xd679('0x2c')+_[_0xd679('0x2d')](_0x286baa[_0xd679('0x1c')],_0xd679('0x2e'),_0xd679('0x2f'))+_0xd679('0x30');_0x286baa[_0xd679('0x31')]={'Auto-Submitted':_0xd679('0x32'),'X-Auto-Response-Suppress':_0xd679('0x33'),'Precedence':_0xd679('0x34')};return mailRpc[_0xd679('0x35')](this[_0xd679('0x26')][_0xd679('0x36')],_0x286baa)[_0xd679('0x37')](function(_0x5c85c0){logger[_0xd679('0xf')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x1794a6);_0x286baa[_0xd679('0x2a')]=_0x5c85c0[_0xd679('0x1e')][_0xd679('0x2a')];return rpc[_0x3e658c+'Message'][_0xd679('0x38')](_0x286baa);})[_0xd679('0x37')](function(_0x4eb578){logger[_0xd679('0xf')](_0xd679('0x10'),_0x1794a6,JSON[_0xd679('0x39')](_0x4eb578));})[_0xd679('0x3a')](function(_0x343eb6){logger[_0xd679('0x3b')](_0xd679('0x3c'),_0x1794a6,JSON['stringify'](_0x343eb6));})[_0xd679('0x3d')](function(){Promise[_0xd679('0x3e')]()[_0xd679('0x37')](function(){if(_0x2610b7[0x0]!=='2'||_0xc8ba9e[_0xd679('0x17')])return;return rpc[_0x3e658c+_0xd679('0x3f')][_0xd679('0x40')](_0xc8ba9e['id'],{'autoreplyExecuted':!![]})[_0xd679('0x37')](function(_0x979a6b){logger[_0xd679('0xf')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1794a6,JSON[_0xd679('0x39')](_0x979a6b));})[_0xd679('0x3a')](function(_0x5c6b1c){logger[_0xd679('0x3b')](_0xd679('0x41'),_0x1794a6,JSON[_0xd679('0x39')](_0x5c6b1c));});})['then'](function(){_0x1a7c85[_0xd679('0x12')]();});});}else{return rpc[this[_0xd679('0x1f')]+_0xd679('0x29')][_0xd679('0x38')](_0x286baa)['then'](function(){logger['info'](_0xd679('0x10'),_0x1794a6,_0x286baa[_0xd679('0x1c')]);})[_0xd679('0x3a')](function(_0x53b8fe){logger[_0xd679('0x3b')](_0xd679('0x10'),_0x1794a6,JSON['stringify'](_0x53b8fe));})[_0xd679('0x3d')](function(){Promise[_0xd679('0x3e')]()[_0xd679('0x37')](function(){if(_0x2610b7[0x0]!=='2'||_0xc8ba9e['autoreplyExecuted'])return;return rpc[_0x3e658c+_0xd679('0x3f')][_0xd679('0x40')](_0xc8ba9e['id'],{'autoreplyExecuted':!![]})[_0xd679('0x37')](function(_0x31987f){logger[_0xd679('0xf')](_0xd679('0x18'),_0x1794a6,JSON[_0xd679('0x39')](_0x31987f));})['catch'](function(_0x426254){logger[_0xd679('0x3b')](_0xd679('0x41'),_0x1794a6,JSON[_0xd679('0x39')](_0x426254));});})[_0xd679('0x37')](function(){_0x1a7c85[_0xd679('0x12')]();});});}}}catch(_0x981329){logger[_0xd679('0x3b')](_0xd679('0x10'),_0x1794a6,JSON['stringify'](_0x981329));_0x1a7c85[_0xd679('0x42')]();}};};
\ No newline at end of file
index b7019dc..83df99e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x22d4=['Interaction','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel'];(function(_0x382ab0,_0x3a759d){var _0x2fff4d=function(_0x2627cc){while(--_0x2627cc){_0x382ab0['push'](_0x382ab0['shift']());}};_0x2fff4d(++_0x3a759d);}(_0x22d4,0x9b));var _0x422d=function(_0xed9c99,_0x2217b1){_0xed9c99=_0xed9c99-0x0;var _0x5443a1=_0x22d4[_0xed9c99];return _0x5443a1;};'use strict';var moment=require(_0x422d('0x0'));var logger=require('../../../../config/logger')(_0x422d('0x1'));var rpc={'chatInteraction':require(_0x422d('0x2')),'openchannelInteraction':require(_0x422d('0x3')),'smsInteraction':require(_0x422d('0x4')),'mailInteraction':require(_0x422d('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x422d('0x6'))};exports[_0x422d('0x7')]=function(_0x5a2fc7,_0x3d2792,_0x498586,_0x38327a){return function(_0x4d8931){try{logger[_0x422d('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x5a2fc7,_0x3d2792[0x0]);var _0x28452d={'closed':0x1,'closedAt':moment()[_0x422d('0x9')](_0x422d('0xa')),'closeReason':_0x422d('0xb'),'disposition':_0x3d2792[0x0]};if(rpc[_0x38327a[_0x422d('0xc')]+_0x422d('0xd')]){rpc[_0x38327a[_0x422d('0xc')]+_0x422d('0xd')]['update'](_0x38327a[_0x422d('0xe')]['id'],_0x28452d)['then'](function(_0x25f1da){logger[_0x422d('0x8')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x5a2fc7,_0x38327a['interaction']['id']);})[_0x422d('0xf')](function(_0x2d6e10){logger[_0x422d('0x10')](_0x422d('0x11'),_0x5a2fc7,JSON[_0x422d('0x12')](_0x2d6e10));})[_0x422d('0x13')](function(){_0x4d8931[_0x422d('0x14')]();});}}catch(_0x1600ad){logger[_0x422d('0x10')]('[%s][CLOSE]\x20%s',_0x5a2fc7,JSON[_0x422d('0x12')](_0x1600ad));_0x4d8931['stop']();}};};
\ No newline at end of file
+var _0x9313=['routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','stop','moment','../../../../config/logger'];(function(_0x34300a,_0x575f68){var _0x5dff0b=function(_0x16bcba){while(--_0x16bcba){_0x34300a['push'](_0x34300a['shift']());}};_0x5dff0b(++_0x575f68);}(_0x9313,0xc4));var _0x3931=function(_0x346665,_0x1041b7){_0x346665=_0x346665-0x0;var _0x16f527=_0x9313[_0x346665];return _0x16f527;};'use strict';var moment=require(_0x3931('0x0'));var logger=require(_0x3931('0x1'))(_0x3931('0x2'));var rpc={'chatInteraction':require(_0x3931('0x3')),'openchannelInteraction':require(_0x3931('0x4')),'smsInteraction':require(_0x3931('0x5')),'mailInteraction':require(_0x3931('0x6')),'faxInteraction':require(_0x3931('0x7')),'whatsappInteraction':require(_0x3931('0x8'))};exports['consequence']=function(_0x456ab8,_0x3f48ee,_0x20e128,_0x4dddcd){return function(_0x5253eb){try{logger[_0x3931('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x456ab8,_0x3f48ee[0x0]);var _0x163864={'closed':0x1,'closedAt':moment()[_0x3931('0xa')](_0x3931('0xb')),'closeReason':'system','disposition':_0x3f48ee[0x0]};if(rpc[_0x4dddcd[_0x3931('0xc')]+_0x3931('0xd')]){rpc[_0x4dddcd[_0x3931('0xc')]+_0x3931('0xd')][_0x3931('0xe')](_0x4dddcd[_0x3931('0xf')]['id'],_0x163864)[_0x3931('0x10')](function(_0x3427b3){logger[_0x3931('0x9')](_0x3931('0x11'),_0x456ab8,_0x4dddcd[_0x3931('0xf')]['id']);})['catch'](function(_0x4ede01){logger[_0x3931('0x12')](_0x3931('0x13'),_0x456ab8,JSON['stringify'](_0x4ede01));})['finally'](function(){_0x5253eb['stop']();});}}catch(_0x273c16){logger[_0x3931('0x12')](_0x3931('0x13'),_0x456ab8,JSON[_0x3931('0x14')](_0x273c16));_0x5253eb[_0x3931('0x15')]();}};};
\ No newline at end of file
index b679f70..60ebf52 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeff8=['consequence','isNil','interaction','UserId','info','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','body','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','stop','lodash','moment','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage'];(function(_0x5a2e1e,_0x49df96){var _0x2477ae=function(_0x285ae5){while(--_0x285ae5){_0x5a2e1e['push'](_0x5a2e1e['shift']());}};_0x2477ae(++_0x49df96);}(_0xeff8,0x186));var _0x8eff=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xeff8[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require(_0x8eff('0x0'));var moment=require(_0x8eff('0x1'));var apiai=require('apiai-promise');var md5=require(_0x8eff('0x2'));var utils=require(_0x8eff('0x3'));var logger=require(_0x8eff('0x4'))('routing');var rpc={'chatMessage':require(_0x8eff('0x5')),'openchannelMessage':require(_0x8eff('0x6')),'mailMessage':require(_0x8eff('0x7')),'smsMessage':require(_0x8eff('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x8eff('0x9'))};exports[_0x8eff('0xa')]=function(_0x3409bc,_0x323b2){return function(_0x491f01){try{if(!_[_0x8eff('0xb')](this[_0x8eff('0xc')][_0x8eff('0xd')])){logger[_0x8eff('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x3409bc,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x491f01[_0x8eff('0xf')]();}var _0x430b45={'ContactId':this[_0x8eff('0x10')]['id'],'sentAt':moment()['format'](_0x8eff('0x11')),'direction':_0x8eff('0x12')};if(this['channel']===_0x8eff('0x13')||this[_0x8eff('0x14')]==='whatsapp'){_0x430b45['phone']=this[_0x8eff('0xc')][_0x8eff('0x15')];}var _0xfa12bb=this[_0x8eff('0x14')];if(_0xfa12bb===_0x8eff('0x16')){_0x430b45['ChatWebsiteId']=this[_0x8eff('0x17')]['id'];}else{_0x430b45[_[_0x8eff('0x18')](_0xfa12bb)+_0x8eff('0x19')]=this[_0x8eff('0x17')]['id'];}_0x430b45[_[_0x8eff('0x18')](_0xfa12bb)+_0x8eff('0x1a')]=this[_0x8eff('0xc')]['id'];if(this[_0x8eff('0xc')][_0x8eff('0x1b')]){var _0x427902=_0x323b2[0x2];if(!_[_0x8eff('0x1c')](_0x427902)){_0x430b45['body']=utils[_0x8eff('0x1d')](_0x427902,this);return rpc[_0xfa12bb+_0x8eff('0x1e')][_0x8eff('0x1f')](_0x430b45)[_0x8eff('0x20')](function(_0x2cd7c5){logger[_0x8eff('0xe')](_0x8eff('0x21'),_0x3409bc,_0x430b45[_0x8eff('0x22')]);})[_0x8eff('0x23')](function(_0x198ee9){logger[_0x8eff('0x24')](_0x8eff('0x21'),_0x3409bc,JSON[_0x8eff('0x25')](_0x198ee9));})[_0x8eff('0x26')](function(){logger[_0x8eff('0xe')](_0x8eff('0x27'),_0x3409bc);_0x491f01['stop']();});}else{logger[_0x8eff('0xe')](_0x8eff('0x28'),_0x3409bc);_0x491f01['stop']();}}else{var _0x1c4ad3=this;var _0x5ea31f=apiai(_0x323b2[0x0],{'language':_0x323b2[0x1]||'en'});return _0x5ea31f[_0x8eff('0x29')](this[_0x8eff('0x2a')][_0x8eff('0x22')],{'sessionId':md5(this[_0x8eff('0xc')]['id'])})[_0x8eff('0x20')](function(_0x4e891c){_0x1c4ad3[_0x8eff('0x22')][_0x8eff('0x2b')]=_0x4e891c;_0x430b45['body']=_0x4e891c[_0x8eff('0x2c')][_0x8eff('0x2d')][_0x8eff('0x2e')];_0x430b45[_0x8eff('0x2f')]=_0x8eff('0x2b');_0x430b45[_0x8eff('0x30')]=JSON[_0x8eff('0x25')](_0x4e891c);return rpc[_0xfa12bb+_0x8eff('0x1e')]['create'](_0x430b45)[_0x8eff('0x20')](function(_0x323ffa){logger[_0x8eff('0xe')](_0x8eff('0x21'),_0x3409bc,_0x430b45[_0x8eff('0x22')]);if(_0x4e891c[_0x8eff('0x2c')]['metadata']['endConversation']){_0x491f01[_0x8eff('0xf')]();}else{_0x491f01[_0x8eff('0x31')]();}})[_0x8eff('0x23')](function(_0x5ce071){logger[_0x8eff('0x24')](_0x8eff('0x21'),_0x3409bc,JSON[_0x8eff('0x25')](_0x5ce071));_0x491f01[_0x8eff('0xf')]();});})[_0x8eff('0x23')](function(_0x2c5727){logger[_0x8eff('0x24')](_0x8eff('0x21'),_0x3409bc,_0x2c5727[_0x8eff('0x2a')]);_0x491f01[_0x8eff('0xf')]();});}}catch(_0xf3ee6){logger[_0x8eff('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x3409bc,JSON[_0x8eff('0x25')](_0xf3ee6));_0x491f01[_0x8eff('0x31')]();}};};
\ No newline at end of file
+var _0x02ca=['create','then','metadata','endConversation','lodash','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','out','channel','sms','phone','interaction','chat','ChatWebsiteId','account','AccountId','InteractionId','created','isEmpty','getMustacheRender','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','message','body','dialogflow','result','fulfillment','providerResponse','Message'];(function(_0x1ab698,_0x17d01f){var _0x316c3a=function(_0x3cce8f){while(--_0x3cce8f){_0x1ab698['push'](_0x1ab698['shift']());}};_0x316c3a(++_0x17d01f);}(_0x02ca,0x97));var _0xa02c=function(_0x18e0d1,_0xbca4cb){_0x18e0d1=_0x18e0d1-0x0;var _0x58db41=_0x02ca[_0x18e0d1];return _0x58db41;};'use strict';var _=require(_0xa02c('0x0'));var moment=require('moment');var apiai=require(_0xa02c('0x1'));var md5=require(_0xa02c('0x2'));var utils=require(_0xa02c('0x3'));var logger=require(_0xa02c('0x4'))('routing');var rpc={'chatMessage':require(_0xa02c('0x5')),'openchannelMessage':require(_0xa02c('0x6')),'mailMessage':require(_0xa02c('0x7')),'smsMessage':require(_0xa02c('0x8')),'faxMessage':require(_0xa02c('0x9')),'whatsappMessage':require(_0xa02c('0xa'))};exports[_0xa02c('0xb')]=function(_0x29c64a,_0x2c87ec){return function(_0x2b96c5){try{if(!_[_0xa02c('0xc')](this['interaction'][_0xa02c('0xd')])){logger[_0xa02c('0xe')](_0xa02c('0xf'),_0x29c64a,_0xa02c('0x10'));return _0x2b96c5[_0xa02c('0x11')]();}var _0x565373={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa02c('0x12')};if(this[_0xa02c('0x13')]===_0xa02c('0x14')||this[_0xa02c('0x13')]==='whatsapp'){_0x565373[_0xa02c('0x15')]=this[_0xa02c('0x16')][_0xa02c('0x15')];}var _0x44faff=this['channel'];if(_0x44faff===_0xa02c('0x17')){_0x565373[_0xa02c('0x18')]=this[_0xa02c('0x19')]['id'];}else{_0x565373[_['upperFirst'](_0x44faff)+_0xa02c('0x1a')]=this[_0xa02c('0x19')]['id'];}_0x565373[_['upperFirst'](_0x44faff)+_0xa02c('0x1b')]=this[_0xa02c('0x16')]['id'];if(this['interaction'][_0xa02c('0x1c')]){var _0x2eef88=_0x2c87ec[0x2];if(!_[_0xa02c('0x1d')](_0x2eef88)){_0x565373['body']=utils[_0xa02c('0x1e')](_0x2eef88,this);return rpc[_0x44faff+'Message']['create'](_0x565373)['then'](function(_0x3fcc66){logger[_0xa02c('0xe')](_0xa02c('0xf'),_0x29c64a,_0x565373['body']);})[_0xa02c('0x1f')](function(_0x566266){logger[_0xa02c('0x20')](_0xa02c('0xf'),_0x29c64a,JSON[_0xa02c('0x21')](_0x566266));})[_0xa02c('0x22')](function(){logger['info'](_0xa02c('0x23'),_0x29c64a);_0x2b96c5['stop']();});}else{logger[_0xa02c('0xe')](_0xa02c('0x24'),_0x29c64a);_0x2b96c5[_0xa02c('0x25')]();}}else{var _0x5b10b4=this;var _0x4787c7=apiai(_0x2c87ec[0x0],{'language':_0x2c87ec[0x1]||'en'});return _0x4787c7['textRequest'](this[_0xa02c('0x26')][_0xa02c('0x27')],{'sessionId':md5(this[_0xa02c('0x16')]['id'])})['then'](function(_0x4ba050){_0x5b10b4[_0xa02c('0x27')][_0xa02c('0x28')]=_0x4ba050;_0x565373[_0xa02c('0x27')]=_0x4ba050[_0xa02c('0x29')][_0xa02c('0x2a')]['speech'];_0x565373['providerName']=_0xa02c('0x28');_0x565373[_0xa02c('0x2b')]=JSON[_0xa02c('0x21')](_0x4ba050);return rpc[_0x44faff+_0xa02c('0x2c')][_0xa02c('0x2d')](_0x565373)[_0xa02c('0x2e')](function(_0x279d79){logger[_0xa02c('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x29c64a,_0x565373[_0xa02c('0x27')]);if(_0x4ba050[_0xa02c('0x29')][_0xa02c('0x2f')][_0xa02c('0x30')]){_0x2b96c5[_0xa02c('0x11')]();}else{_0x2b96c5[_0xa02c('0x25')]();}})[_0xa02c('0x1f')](function(_0x1dfc2c){logger[_0xa02c('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x29c64a,JSON[_0xa02c('0x21')](_0x1dfc2c));_0x2b96c5[_0xa02c('0x11')]();});})[_0xa02c('0x1f')](function(_0x4de1ac){logger['error'](_0xa02c('0xf'),_0x29c64a,_0x4de1ac[_0xa02c('0x26')]);_0x2b96c5[_0xa02c('0x11')]();});}}catch(_0x169bef){logger[_0xa02c('0x20')](_0xa02c('0xf'),_0x29c64a,JSON[_0xa02c('0x21')](_0x169bef));_0x2b96c5[_0xa02c('0x25')]();}};};
\ No newline at end of file
index 9af2efc..0f75620 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe8a4=['format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','SessionsClient','sessionPath','message','length','dialogflowV2','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','queryResult','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','intentDetectionConfidence','providerResponse','fulfillmentText','catch','lodash','md5','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','then','[%s][DIALOGFLOWV2]\x20%s','error','stringify','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next'];(function(_0x3ddb2,_0x386ec3){var _0x41cc1f=function(_0x13e620){while(--_0x13e620){_0x3ddb2['push'](_0x3ddb2['shift']());}};_0x41cc1f(++_0x386ec3);}(_0xe8a4,0x158));var _0x4e8a=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xe8a4[_0x543084];return _0x306a57;};'use strict';var _=require(_0x4e8a('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x4e8a('0x1'));var moment=require('moment');var Promise=require(_0x4e8a('0x2'));var logger=require(_0x4e8a('0x3'))(_0x4e8a('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x4e8a('0x5')),'openchannelMessage':require(_0x4e8a('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x4e8a('0x7')),'faxMessage':require(_0x4e8a('0x8')),'whatsappMessage':require(_0x4e8a('0x9'))};function createMessage(_0x2ab997,_0x8d77a4,_0x164ed1,_0x690bf0){return new Promise(function(_0x14bbb3,_0x246d69){var _0x35cae7=_['clone'](_0x164ed1);_0x35cae7[_0x4e8a('0xa')]=_0x690bf0;return rpc[_0x8d77a4+_0x4e8a('0xb')][_0x4e8a('0xc')](_0x35cae7)[_0x4e8a('0xd')](function(){logger['info'](_0x4e8a('0xe'),_0x2ab997,_0x35cae7[_0x4e8a('0xa')]);_0x14bbb3();})['catch'](function(_0x4458a9){logger[_0x4e8a('0xf')](_0x4e8a('0xe'),_0x2ab997,JSON[_0x4e8a('0x10')](_0x4458a9));_0x246d69(_0x4458a9);});});}exports['consequence']=function(_0x2cf142,_0x4f04d5){return function(_0x39be1d){try{if(!_[_0x4e8a('0x11')](this[_0x4e8a('0x12')]['UserId'])){logger[_0x4e8a('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x2cf142,_0x4e8a('0x14'));return _0x39be1d[_0x4e8a('0x15')]();}var _0x61acb9={'ContactId':this['contact']['id'],'sentAt':moment()[_0x4e8a('0x16')](_0x4e8a('0x17')),'direction':_0x4e8a('0x18')};if(this[_0x4e8a('0x19')]==='sms'||this[_0x4e8a('0x19')]==='whatsapp'){_0x61acb9[_0x4e8a('0x1a')]=this[_0x4e8a('0x12')][_0x4e8a('0x1a')];}var _0x29772b=this[_0x4e8a('0x19')];if(_0x29772b===_0x4e8a('0x1b')){_0x61acb9[_0x4e8a('0x1c')]=this[_0x4e8a('0x1d')]['id'];}else{_0x61acb9[_[_0x4e8a('0x1e')](_0x29772b)+'AccountId']=this['account']['id'];}_0x61acb9[_['upperFirst'](_0x29772b)+_0x4e8a('0x1f')]=this[_0x4e8a('0x12')]['id'];if(this[_0x4e8a('0x12')][_0x4e8a('0x20')]){var _0x14d68b=_0x4f04d5[0x4];if(!_['isEmpty'](_0x14d68b)){_0x61acb9['body']=utils['getMustacheRender'](_0x14d68b,this);return rpc[_0x29772b+'Message'][_0x4e8a('0xc')](_0x61acb9)[_0x4e8a('0xd')](function(_0x2a8948){logger['info'](_0x4e8a('0xe'),_0x2cf142,_0x61acb9[_0x4e8a('0xa')]);})['catch'](function(_0x47045b){logger[_0x4e8a('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x2cf142,JSON[_0x4e8a('0x10')](_0x47045b));})['finally'](function(){logger[_0x4e8a('0x13')](_0x4e8a('0x21'),_0x2cf142);_0x39be1d[_0x4e8a('0x22')]();});}else{logger[_0x4e8a('0x13')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2cf142);_0x39be1d['stop']();}}else{var _0x27a048=this;var _0x31bbe1=_0x4f04d5[0x2]['replace'](/\\n/g,'\x0a');var _0x3339ee={'credentials':{'private_key':_0x31bbe1,'client_email':_0x4f04d5[0x1]}};var _0x48d20d=new dialogflow[(_0x4e8a('0x23'))](_0x3339ee);var _0x5766c5=_0x48d20d[_0x4e8a('0x24')](_0x4f04d5[0x0],md5(_0x27a048[_0x4e8a('0x12')]['id']));var _0x46b68b={'session':_0x5766c5,'queryInput':{'text':{'text':_0x27a048[_0x4e8a('0x25')][_0x4e8a('0xa')],'languageCode':_0x4f04d5[0x3]||'en'}}};return _0x48d20d['detectIntent'](_0x46b68b)['then'](function(_0x4ba037){if(_0x4ba037&&_0x4ba037[_0x4e8a('0x26')]){_0x27a048[_0x4e8a('0xa')][_0x4e8a('0x27')]=_0x4ba037;var _0x550a35=_0x4ba037[0x0];var _0x3ebc0c=_0x550a35['queryResult'][_0x4e8a('0x28')]&&_0x550a35['queryResult']['diagnosticInfo']['fields']?_0x550a35['queryResult'][_0x4e8a('0x28')][_0x4e8a('0x29')][_0x4e8a('0x2a')][_0x4e8a('0x2b')]:![];_0x27a048[_0x4e8a('0xa')][_0x4e8a('0x2c')]=_0x550a35[_0x4e8a('0x2d')][_0x4e8a('0x2e')];_0x27a048['body'][_0x4e8a('0x2f')]=_0x550a35['queryResult'][_0x4e8a('0x30')];_0x27a048[_0x4e8a('0xa')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x550a35[_0x4e8a('0x2d')]['diagnosticInfo']&&_0x550a35[_0x4e8a('0x2d')][_0x4e8a('0x28')][_0x4e8a('0x29')]?_0x550a35[_0x4e8a('0x2d')]['diagnosticInfo']['fields']['end_conversation'][_0x4e8a('0x2b')]:![];_0x27a048['body'][_0x4e8a('0x31')]=_0x550a35[_0x4e8a('0x2d')][_0x4e8a('0x32')]['name'];_0x27a048[_0x4e8a('0xa')][_0x4e8a('0x33')]=_0x550a35[_0x4e8a('0x2d')][_0x4e8a('0x32')][_0x4e8a('0x34')];_0x27a048[_0x4e8a('0xa')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x550a35['queryResult']['intent'][_0x4e8a('0x35')];_0x27a048[_0x4e8a('0xa')][_0x4e8a('0x36')]=_0x550a35[_0x4e8a('0x2d')][_0x4e8a('0x37')];_0x27a048[_0x4e8a('0xa')][_0x4e8a('0x38')]=_0x550a35[_0x4e8a('0x2d')]['queryText'];_0x27a048['body']['DIALOGFLOWV2_SCORE']=_0x550a35['queryResult'][_0x4e8a('0x39')];_0x61acb9['providerName']=_0x4e8a('0x27');_0x61acb9[_0x4e8a('0x3a')]=JSON[_0x4e8a('0x10')](_0x4ba037);var _0x5de916=[];for(var _0x2bb45d=0x0;_0x2bb45d<_0x4ba037[_0x4e8a('0x26')];_0x2bb45d++){var _0x570605=_0x4ba037[_0x2bb45d];if(_0x570605&&_0x570605[_0x4e8a('0x2d')]&&_0x570605[_0x4e8a('0x2d')]['fulfillmentText']){_0x5de916['push'](createMessage(_0x2cf142,_0x29772b,_0x61acb9,_0x570605[_0x4e8a('0x2d')][_0x4e8a('0x3b')]));}}return Promise['all'](_0x5de916)[_0x4e8a('0xd')](function(){if(_0x3ebc0c){_0x39be1d[_0x4e8a('0x15')]();}else{_0x39be1d[_0x4e8a('0x22')]();}})[_0x4e8a('0x3c')](function(_0x213653){logger[_0x4e8a('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x2cf142,JSON[_0x4e8a('0x10')](_0x213653));_0x39be1d['next']();});}})[_0x4e8a('0x3c')](function(_0x21e2b9){logger['error'](_0x4e8a('0xe'),_0x2cf142,_0x21e2b9[_0x4e8a('0x25')]);_0x39be1d[_0x4e8a('0x15')]();});}}catch(_0x11f409){logger[_0x4e8a('0xf')](_0x4e8a('0xe'),_0x2cf142,JSON[_0x4e8a('0x10')](_0x11f409));_0x39be1d['stop']();}};};
\ No newline at end of file
+var _0xd9e9=['chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','getMustacheRender','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','push','lodash','dialogflow','md5','moment','bluebird','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','whatsapp','phone','channel'];(function(_0x3f1230,_0x3da84c){var _0x4f06c9=function(_0x1091a1){while(--_0x1091a1){_0x3f1230['push'](_0x3f1230['shift']());}};_0x4f06c9(++_0x3da84c);}(_0xd9e9,0xba));var _0x9d9e=function(_0x39d149,_0x4df951){_0x39d149=_0x39d149-0x0;var _0xe7add6=_0xd9e9[_0x39d149];return _0xe7add6;};'use strict';var _=require(_0x9d9e('0x0'));var dialogflow=require(_0x9d9e('0x1'));var md5=require(_0x9d9e('0x2'));var moment=require(_0x9d9e('0x3'));var Promise=require(_0x9d9e('0x4'));var logger=require('../../../../config/logger')('routing');var utils=require('./utils');var rpc={'chatMessage':require(_0x9d9e('0x5')),'openchannelMessage':require(_0x9d9e('0x6')),'mailMessage':require(_0x9d9e('0x7')),'smsMessage':require(_0x9d9e('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x9d9e('0x9'))};function createMessage(_0x1d07ca,_0x1ac784,_0x32030b,_0x2ddca1){return new Promise(function(_0x1aec01,_0x499cbc){var _0x2d8446=_[_0x9d9e('0xa')](_0x32030b);_0x2d8446[_0x9d9e('0xb')]=_0x2ddca1;return rpc[_0x1ac784+_0x9d9e('0xc')][_0x9d9e('0xd')](_0x2d8446)[_0x9d9e('0xe')](function(){logger[_0x9d9e('0xf')](_0x9d9e('0x10'),_0x1d07ca,_0x2d8446[_0x9d9e('0xb')]);_0x1aec01();})['catch'](function(_0x2e8121){logger[_0x9d9e('0x11')](_0x9d9e('0x10'),_0x1d07ca,JSON[_0x9d9e('0x12')](_0x2e8121));_0x499cbc(_0x2e8121);});});}exports[_0x9d9e('0x13')]=function(_0x1e4241,_0x5f5089){return function(_0x50b5bb){try{if(!_['isNil'](this['interaction'][_0x9d9e('0x14')])){logger[_0x9d9e('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x1e4241,_0x9d9e('0x15'));return _0x50b5bb[_0x9d9e('0x16')]();}var _0x3abc39={'ContactId':this[_0x9d9e('0x17')]['id'],'sentAt':moment()[_0x9d9e('0x18')](_0x9d9e('0x19')),'direction':_0x9d9e('0x1a')};if(this['channel']==='sms'||this['channel']===_0x9d9e('0x1b')){_0x3abc39[_0x9d9e('0x1c')]=this['interaction']['phone'];}var _0x46dc05=this[_0x9d9e('0x1d')];if(_0x46dc05===_0x9d9e('0x1e')){_0x3abc39[_0x9d9e('0x1f')]=this[_0x9d9e('0x20')]['id'];}else{_0x3abc39[_[_0x9d9e('0x21')](_0x46dc05)+_0x9d9e('0x22')]=this['account']['id'];}_0x3abc39[_['upperFirst'](_0x46dc05)+_0x9d9e('0x23')]=this[_0x9d9e('0x24')]['id'];if(this[_0x9d9e('0x24')][_0x9d9e('0x25')]){var _0x57f332=_0x5f5089[0x4];if(!_[_0x9d9e('0x26')](_0x57f332)){_0x3abc39[_0x9d9e('0xb')]=utils[_0x9d9e('0x27')](_0x57f332,this);return rpc[_0x46dc05+_0x9d9e('0xc')][_0x9d9e('0xd')](_0x3abc39)[_0x9d9e('0xe')](function(_0x1fb244){logger['info'](_0x9d9e('0x10'),_0x1e4241,_0x3abc39['body']);})[_0x9d9e('0x28')](function(_0x39af78){logger['error'](_0x9d9e('0x10'),_0x1e4241,JSON[_0x9d9e('0x12')](_0x39af78));})[_0x9d9e('0x29')](function(){logger[_0x9d9e('0xf')](_0x9d9e('0x2a'),_0x1e4241);_0x50b5bb['stop']();});}else{logger[_0x9d9e('0xf')](_0x9d9e('0x2b'),_0x1e4241);_0x50b5bb[_0x9d9e('0x2c')]();}}else{var _0x56864e=this;var _0x10ee42=_0x5f5089[0x2][_0x9d9e('0x2d')](/\\n/g,'\x0a');var _0x4da313={'credentials':{'private_key':_0x10ee42,'client_email':_0x5f5089[0x1]}};var _0x419b51=new dialogflow[(_0x9d9e('0x2e'))](_0x4da313);var _0x383492=_0x419b51['sessionPath'](_0x5f5089[0x0],md5(_0x56864e[_0x9d9e('0x24')]['id']));var _0x36766c={'session':_0x383492,'queryInput':{'text':{'text':_0x56864e[_0x9d9e('0x2f')][_0x9d9e('0xb')],'languageCode':_0x5f5089[0x3]||'en'}}};return _0x419b51[_0x9d9e('0x30')](_0x36766c)[_0x9d9e('0xe')](function(_0xa66a03){if(_0xa66a03&&_0xa66a03[_0x9d9e('0x31')]){_0x56864e[_0x9d9e('0xb')][_0x9d9e('0x32')]=_0xa66a03;var _0x60f07=_0xa66a03[0x0];var _0x305a6a=_0x60f07[_0x9d9e('0x33')]['diagnosticInfo']&&_0x60f07[_0x9d9e('0x33')][_0x9d9e('0x34')][_0x9d9e('0x35')]?_0x60f07[_0x9d9e('0x33')]['diagnosticInfo'][_0x9d9e('0x35')][_0x9d9e('0x36')][_0x9d9e('0x37')]:![];_0x56864e['body'][_0x9d9e('0x38')]=_0x60f07[_0x9d9e('0x33')]['action'];_0x56864e[_0x9d9e('0xb')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x60f07['queryResult'][_0x9d9e('0x39')];_0x56864e[_0x9d9e('0xb')][_0x9d9e('0x3a')]=_0x60f07['queryResult'][_0x9d9e('0x34')]&&_0x60f07[_0x9d9e('0x33')][_0x9d9e('0x34')][_0x9d9e('0x35')]?_0x60f07['queryResult'][_0x9d9e('0x34')]['fields'][_0x9d9e('0x36')][_0x9d9e('0x37')]:![];_0x56864e[_0x9d9e('0xb')][_0x9d9e('0x3b')]=_0x60f07['queryResult'][_0x9d9e('0x3c')][_0x9d9e('0x3d')];_0x56864e['body'][_0x9d9e('0x3e')]=_0x60f07[_0x9d9e('0x33')][_0x9d9e('0x3c')][_0x9d9e('0x3f')];_0x56864e[_0x9d9e('0xb')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x60f07[_0x9d9e('0x33')][_0x9d9e('0x3c')][_0x9d9e('0x40')];_0x56864e[_0x9d9e('0xb')]['DIALOGFLOWV2_LANGUAGECODE']=_0x60f07[_0x9d9e('0x33')][_0x9d9e('0x41')];_0x56864e[_0x9d9e('0xb')][_0x9d9e('0x42')]=_0x60f07[_0x9d9e('0x33')]['queryText'];_0x56864e[_0x9d9e('0xb')][_0x9d9e('0x43')]=_0x60f07['queryResult'][_0x9d9e('0x44')];_0x3abc39['providerName']='dialogflowV2';_0x3abc39[_0x9d9e('0x45')]=JSON['stringify'](_0xa66a03);var _0x248153=[];for(var _0x1031db=0x0;_0x1031db<_0xa66a03[_0x9d9e('0x31')];_0x1031db++){var _0x22b8f9=_0xa66a03[_0x1031db];if(_0x22b8f9&&_0x22b8f9['queryResult']&&_0x22b8f9[_0x9d9e('0x33')][_0x9d9e('0x46')]){_0x248153[_0x9d9e('0x47')](createMessage(_0x1e4241,_0x46dc05,_0x3abc39,_0x22b8f9['queryResult'][_0x9d9e('0x46')]));}}return Promise['all'](_0x248153)[_0x9d9e('0xe')](function(){if(_0x305a6a){_0x50b5bb['next']();}else{_0x50b5bb['stop']();}})[_0x9d9e('0x28')](function(_0x4cec66){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x1e4241,JSON[_0x9d9e('0x12')](_0x4cec66));_0x50b5bb[_0x9d9e('0x16')]();});}})[_0x9d9e('0x28')](function(_0x2bd110){logger['error'](_0x9d9e('0x10'),_0x1e4241,_0x2bd110[_0x9d9e('0x2f')]);_0x50b5bb[_0x9d9e('0x16')]();});}}catch(_0xdee73f){logger[_0x9d9e('0x11')](_0x9d9e('0x10'),_0x1e4241,JSON['stringify'](_0xdee73f));_0x50b5bb[_0x9d9e('0x2c')]();}};};
\ No newline at end of file
index f99a386..bfe8ce6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9687=['priorityFalse','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stop','stringify','validate','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue'];(function(_0x1a62bb,_0x157e87){var _0x4ade6f=function(_0x5662d6){while(--_0x5662d6){_0x1a62bb['push'](_0x1a62bb['shift']());}};_0x4ade6f(++_0x157e87);}(_0x9687,0x19f));var _0x7968=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9687[_0x20a584];return _0x4b41a8;};'use strict';var schema=require(_0x7968('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x7968('0x1'));var logger=require(_0x7968('0x2'))(_0x7968('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x7968('0x4')},'priorityTrue':{'type':_0x7968('0x5'),'message':_0x7968('0x6')},'priorityFalse':{'type':_0x7968('0x5'),'message':_0x7968('0x7')}});exports[_0x7968('0x8')]=function(_0x1a7c4e,_0x2b3f9d){return function(_0x3b3837){try{var _0x5b53cc={'condition':htmlToText[_0x7968('0x9')](utils[_0x7968('0xa')](_0x2b3f9d[0x0],this),{'wordwrap':![]})[_0x7968('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2b3f9d[0x1],'priorityFalse':_0x2b3f9d[0x2]};var _0x576ac0=gotoif[_0x7968('0x0')](_0x5b53cc,{'typecast':!![]});if(_0x576ac0[_0x7968('0xc')]){logger[_0x7968('0xd')](_0x7968('0xe'),_0x1a7c4e,_[_0x7968('0xf')](_0x576ac0,_0x7968('0x10'))[_0x7968('0x11')](',\x20'));_0x3b3837['stop']();}else{try{var _0x4a2165=eval('('+_0x5b53cc[_0x7968('0x12')]+')');var _0x224958=_0x4a2165?_0x5b53cc[_0x7968('0x13')]:_0x5b53cc[_0x7968('0x14')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1a7c4e,_0x5b53cc['condition'],_0x4a2165,_0x224958||_0x7968('0x15'));if(_0x224958){var _0x51a0e8=_[_0x7968('0x16')](_0x3b3837['rules'](),{'p':_0x224958});if(_0x51a0e8>=0x0){logger[_0x7968('0x17')](_0x7968('0x18'),_0x1a7c4e,_0x224958||_0x7968('0x15'),_0x51a0e8);_0x3b3837[_0x7968('0x15')](_0x51a0e8);}else{logger['info'](_0x7968('0x19'),_0x1a7c4e,_0x224958||'next');_0x3b3837['stop']();}}else{_0x3b3837['next']();}}catch(_0x593dfe){logger[_0x7968('0xd')](_0x7968('0x1a'),_0x1a7c4e,_0x593dfe[_0x7968('0x10')]);_0x3b3837[_0x7968('0x1b')]();}}}catch(_0x5ad191){logger[_0x7968('0xd')](_0x7968('0xe'),_0x1a7c4e,JSON[_0x7968('0x1c')](_0x5ad191));_0x3b3837[_0x7968('0x1b')]();}};};
\ No newline at end of file
+var _0x6be5=['[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x2601e0,_0x12a636){var _0x578e64=function(_0x5d65dc){while(--_0x5d65dc){_0x2601e0['push'](_0x2601e0['shift']());}};_0x578e64(++_0x12a636);}(_0x6be5,0x94));var _0x56be=function(_0x2e24c7,_0x52191c){_0x2e24c7=_0x2e24c7-0x0;var _0x48be94=_0x6be5[_0x2e24c7];return _0x48be94;};'use strict';var schema=require(_0x56be('0x0'));var _=require(_0x56be('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x56be('0x2'));var logger=require('../../../../config/logger')(_0x56be('0x3'));var gotoif=schema({'condition':{'type':_0x56be('0x4'),'required':!![],'message':_0x56be('0x5')},'priorityTrue':{'type':'number','message':_0x56be('0x6')},'priorityFalse':{'type':_0x56be('0x7'),'message':_0x56be('0x8')}});exports[_0x56be('0x9')]=function(_0x30b74a,_0x37d0d4){return function(_0x384fdc){try{var _0x4a65d2={'condition':htmlToText['fromString'](utils[_0x56be('0xa')](_0x37d0d4[0x0],this),{'wordwrap':![]})[_0x56be('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x37d0d4[0x1],'priorityFalse':_0x37d0d4[0x2]};var _0x15ef44=gotoif[_0x56be('0x0')](_0x4a65d2,{'typecast':!![]});if(_0x15ef44[_0x56be('0xc')]){logger[_0x56be('0xd')](_0x56be('0xe'),_0x30b74a,_[_0x56be('0xf')](_0x15ef44,'message')[_0x56be('0x10')](',\x20'));_0x384fdc[_0x56be('0x11')]();}else{try{var _0x1572ed=eval('('+_0x4a65d2[_0x56be('0x12')]+')');var _0x857f54=_0x1572ed?_0x4a65d2[_0x56be('0x13')]:_0x4a65d2[_0x56be('0x14')];logger[_0x56be('0x15')](_0x56be('0x16'),_0x30b74a,_0x4a65d2['condition'],_0x1572ed,_0x857f54||_0x56be('0x17'));if(_0x857f54){var _0x44adcf=_[_0x56be('0x18')](_0x384fdc['rules'](),{'p':_0x857f54});if(_0x44adcf>=0x0){logger[_0x56be('0x15')](_0x56be('0x19'),_0x30b74a,_0x857f54||'next',_0x44adcf);_0x384fdc[_0x56be('0x17')](_0x44adcf);}else{logger['info'](_0x56be('0x1a'),_0x30b74a,_0x857f54||_0x56be('0x17'));_0x384fdc['stop']();}}else{_0x384fdc[_0x56be('0x17')]();}}catch(_0x162d10){logger[_0x56be('0xd')](_0x56be('0x1b'),_0x30b74a,_0x162d10['message']);_0x384fdc[_0x56be('0x11')]();}}}catch(_0x245c86){logger[_0x56be('0xd')](_0x56be('0xe'),_0x30b74a,JSON[_0x56be('0x1c')](_0x245c86));_0x384fdc[_0x56be('0x11')]();}};};
\ No newline at end of file
index f540e39..b0982f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd2c2=['[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','error','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules'];(function(_0x583f89,_0x98c0bf){var _0x1c2395=function(_0x59d0d7){while(--_0x59d0d7){_0x583f89['push'](_0x583f89['shift']());}};_0x1c2395(++_0x98c0bf);}(_0xd2c2,0x15a));var _0x2d2c=function(_0x9a33b9,_0x1a785e){_0x9a33b9=_0x9a33b9-0x0;var _0x177e4b=_0xd2c2[_0x9a33b9];return _0x177e4b;};'use strict';var schema=require(_0x2d2c('0x0'));var _=require('lodash');var logger=require(_0x2d2c('0x1'))(_0x2d2c('0x2'));var gotop=schema({'priority':{'type':_0x2d2c('0x3'),'required':!![],'message':_0x2d2c('0x4')}});exports['consequence']=function(_0x4c1146,_0x3f06d4){return function(_0x23aacb){try{var _0x3c8ef3={'priority':_0x3f06d4[0x0]};var _0x1bd6f8=gotop['validate'](_0x3c8ef3,{'typecast':!![]});if(_0x1bd6f8['length']){logger[_0x2d2c('0x5')]('[%s][GOTOP]\x20%s',_0x4c1146,_[_0x2d2c('0x6')](_0x1bd6f8,_0x2d2c('0x7'))[_0x2d2c('0x8')](',\x20'));_0x23aacb[_0x2d2c('0x9')]();}else{logger[_0x2d2c('0xa')](_0x2d2c('0xb'),_0x4c1146,_0x3c8ef3['priority']);if(_0x3c8ef3[_0x2d2c('0xc')]){var _0x53422b=_[_0x2d2c('0xd')](_0x23aacb[_0x2d2c('0xe')](),{'p':_0x3c8ef3[_0x2d2c('0xc')]});if(_0x53422b>=0x0){logger[_0x2d2c('0xa')](_0x2d2c('0xf'),_0x4c1146,_0x3c8ef3[_0x2d2c('0xc')]||_0x2d2c('0x10'),_0x53422b);_0x23aacb['next'](_0x53422b);}else{logger[_0x2d2c('0xa')](_0x2d2c('0x11'),_0x4c1146,_0x3c8ef3[_0x2d2c('0xc')]||_0x2d2c('0x10'));_0x23aacb[_0x2d2c('0x9')]();}}else{_0x23aacb[_0x2d2c('0x10')]();}}}catch(_0x299666){logger[_0x2d2c('0x5')]('[%s][GOTOP]\x20%s',_0x4c1146,JSON[_0x2d2c('0x12')](_0x299666));_0x23aacb[_0x2d2c('0x9')]();}};};
\ No newline at end of file
+var _0x6804=['stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map'];(function(_0x45e0f6,_0x534744){var _0x1a8262=function(_0x1b108b){while(--_0x1b108b){_0x45e0f6['push'](_0x45e0f6['shift']());}};_0x1a8262(++_0x534744);}(_0x6804,0x1e5));var _0x4680=function(_0x5e95b1,_0x4844ae){_0x5e95b1=_0x5e95b1-0x0;var _0x1a895e=_0x6804[_0x5e95b1];return _0x1a895e;};'use strict';var schema=require(_0x4680('0x0'));var _=require('lodash');var logger=require(_0x4680('0x1'))(_0x4680('0x2'));var gotop=schema({'priority':{'type':_0x4680('0x3'),'required':!![],'message':_0x4680('0x4')}});exports[_0x4680('0x5')]=function(_0x3f6c9d,_0x3fb3c3){return function(_0x3c5278){try{var _0x1ebb60={'priority':_0x3fb3c3[0x0]};var _0x5d183e=gotop[_0x4680('0x0')](_0x1ebb60,{'typecast':!![]});if(_0x5d183e[_0x4680('0x6')]){logger['error'](_0x4680('0x7'),_0x3f6c9d,_[_0x4680('0x8')](_0x5d183e,'message')['join'](',\x20'));_0x3c5278[_0x4680('0x9')]();}else{logger[_0x4680('0xa')](_0x4680('0xb'),_0x3f6c9d,_0x1ebb60[_0x4680('0xc')]);if(_0x1ebb60[_0x4680('0xc')]){var _0x301a6d=_['findIndex'](_0x3c5278[_0x4680('0xd')](),{'p':_0x1ebb60[_0x4680('0xc')]});if(_0x301a6d>=0x0){logger['info'](_0x4680('0xe'),_0x3f6c9d,_0x1ebb60[_0x4680('0xc')]||_0x4680('0xf'),_0x301a6d);_0x3c5278[_0x4680('0xf')](_0x301a6d);}else{logger[_0x4680('0xa')](_0x4680('0x10'),_0x3f6c9d,_0x1ebb60['priority']||'next');_0x3c5278[_0x4680('0x9')]();}}else{_0x3c5278['next']();}}}catch(_0x1b320c){logger[_0x4680('0x11')](_0x4680('0x7'),_0x3f6c9d,JSON[_0x4680('0x12')](_0x1b320c));_0x3c5278[_0x4680('0x9')]();}};};
\ No newline at end of file
index 8cd5c2f..d52ad00 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x65c9=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','stringify','stop','error','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x1d37bf,_0x3d229d){var _0x46dae8=function(_0x415f6c){while(--_0x415f6c){_0x1d37bf['push'](_0x1d37bf['shift']());}};_0x46dae8(++_0x3d229d);}(_0x65c9,0x182));var _0x965c=function(_0x321fae,_0x36041a){_0x321fae=_0x321fae-0x0;var _0xd9d256=_0x65c9[_0x321fae];return _0xd9d256;};'use strict';var _=require(_0x965c('0x0'));var utils=require(_0x965c('0x1'));var logger=require('../../../../config/logger')(_0x965c('0x2'));var rpc={'chatMessage':require(_0x965c('0x3')),'openchannelMessage':require(_0x965c('0x4')),'mailMessage':require(_0x965c('0x5')),'smsMessage':require(_0x965c('0x6')),'faxMessage':require(_0x965c('0x7')),'whatsappMessage':require(_0x965c('0x8'))};exports[_0x965c('0x9')]=function(_0x34f559,_0xbda9ee){return function(_0xb9c834){try{var _0x849260={'body':utils['getMustacheRender'](_0xbda9ee[0x0],this),'ContactId':this[_0x965c('0xa')]['id']};if(this[_0x965c('0xb')]===_0x965c('0xc')){_0x849260[_0x965c('0xd')]=this[_0x965c('0xe')]['id'];}else{_0x849260[_[_0x965c('0xf')](this[_0x965c('0xb')])+'AccountId']=this[_0x965c('0xe')]['id'];}_0x849260[_[_0x965c('0xf')](this[_0x965c('0xb')])+_0x965c('0x10')]=this[_0x965c('0x11')]['id'];if(rpc[this[_0x965c('0xb')]+_0x965c('0x12')]){return rpc[this[_0x965c('0xb')]+_0x965c('0x12')][_0x965c('0x13')](_0x849260)[_0x965c('0x14')](function(_0x1d5cb4){logger[_0x965c('0x15')](_0x965c('0x16'),_0x34f559,_0x849260['body']);_0xb9c834[_0x965c('0x17')]();})[_0x965c('0x18')](function(_0x2901f7){logger['error'](_0x965c('0x16'),_0x34f559,JSON[_0x965c('0x19')](_0x2901f7));_0xb9c834[_0x965c('0x1a')]();});}}catch(_0x4f61de){logger[_0x965c('0x1b')]('[%s][MESSAGE]\x20%s',_0x34f559,JSON['stringify'](_0x4f61de));_0xb9c834['stop']();}};};
\ No newline at end of file
+var _0x25e1=['chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel'];(function(_0x5c097e,_0x26c3b3){var _0x3290ee=function(_0x1898f3){while(--_0x1898f3){_0x5c097e['push'](_0x5c097e['shift']());}};_0x3290ee(++_0x26c3b3);}(_0x25e1,0x1d0));var _0x125e=function(_0x413520,_0x457d8b){_0x413520=_0x413520-0x0;var _0x248495=_0x25e1[_0x413520];return _0x248495;};'use strict';var _=require(_0x125e('0x0'));var utils=require('./utils');var logger=require(_0x125e('0x1'))(_0x125e('0x2'));var rpc={'chatMessage':require(_0x125e('0x3')),'openchannelMessage':require(_0x125e('0x4')),'mailMessage':require(_0x125e('0x5')),'smsMessage':require(_0x125e('0x6')),'faxMessage':require(_0x125e('0x7')),'whatsappMessage':require(_0x125e('0x8'))};exports[_0x125e('0x9')]=function(_0x3079b1,_0x2b16c4){return function(_0x158400){try{var _0x29b9a2={'body':utils[_0x125e('0xa')](_0x2b16c4[0x0],this),'ContactId':this['contact']['id']};if(this[_0x125e('0xb')]===_0x125e('0xc')){_0x29b9a2[_0x125e('0xd')]=this[_0x125e('0xe')]['id'];}else{_0x29b9a2[_['upperFirst'](this[_0x125e('0xb')])+'AccountId']=this[_0x125e('0xe')]['id'];}_0x29b9a2[_[_0x125e('0xf')](this[_0x125e('0xb')])+_0x125e('0x10')]=this[_0x125e('0x11')]['id'];if(rpc[this[_0x125e('0xb')]+'Message']){return rpc[this[_0x125e('0xb')]+_0x125e('0x12')][_0x125e('0x13')](_0x29b9a2)[_0x125e('0x14')](function(_0x431a45){logger[_0x125e('0x15')](_0x125e('0x16'),_0x3079b1,_0x29b9a2[_0x125e('0x17')]);_0x158400[_0x125e('0x18')]();})['catch'](function(_0x312f61){logger[_0x125e('0x19')](_0x125e('0x16'),_0x3079b1,JSON[_0x125e('0x1a')](_0x312f61));_0x158400[_0x125e('0x1b')]();});}}catch(_0x54ec1e){logger[_0x125e('0x19')](_0x125e('0x16'),_0x3079b1,JSON[_0x125e('0x1a')](_0x54ec1e));_0x158400[_0x125e('0x1b')]();}};};
\ No newline at end of file
index 3f44be8..916b88d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8948=['getMustacheRender','next','error','stringify','stop','./utils','routing','consequence'];(function(_0x35045f,_0xf8ca18){var _0xb70c6a=function(_0x2a0463){while(--_0x2a0463){_0x35045f['push'](_0x35045f['shift']());}};_0xb70c6a(++_0xf8ca18);}(_0x8948,0x13d));var _0x8894=function(_0x25d93b,_0x8c1373){_0x25d93b=_0x25d93b-0x0;var _0x346a28=_0x8948[_0x25d93b];return _0x346a28;};'use strict';var utils=require(_0x8894('0x0'));var logger=require('../../../../config/logger')(_0x8894('0x1'));exports[_0x8894('0x2')]=function(_0xbbc5f1,_0x952507){return function(_0xda61ac){try{logger['info']('[%s][NOOP]\x20%s',_0xbbc5f1,utils[_0x8894('0x3')](_0x952507[0x0],this));_0xda61ac[_0x8894('0x4')]();}catch(_0x13a810){logger[_0x8894('0x5')]('[%s][NOOP]\x20%s',_0xbbc5f1,JSON[_0x8894('0x6')](_0x13a810));_0xda61ac[_0x8894('0x7')]();}};};
\ No newline at end of file
+var _0x63d7=['getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x37638f,_0x53c883){var _0x5d4217=function(_0x3cbd4c){while(--_0x3cbd4c){_0x37638f['push'](_0x37638f['shift']());}};_0x5d4217(++_0x53c883);}(_0x63d7,0xe1));var _0x763d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x63d7[_0x13d07a];return _0x5ee0ee;};'use strict';var utils=require(_0x763d('0x0'));var logger=require(_0x763d('0x1'))(_0x763d('0x2'));exports[_0x763d('0x3')]=function(_0x265bef,_0x358804){return function(_0x5e383b){try{logger[_0x763d('0x4')](_0x763d('0x5'),_0x265bef,utils[_0x763d('0x6')](_0x358804[0x0],this));_0x5e383b[_0x763d('0x7')]();}catch(_0x1215be){logger[_0x763d('0x8')](_0x763d('0x5'),_0x265bef,JSON[_0x763d('0x9')](_0x1215be));_0x5e383b[_0x763d('0xa')]();}};};
\ No newline at end of file
index a567ef7..f92ac40 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0ffa=['message','chat','AccountId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','catch','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','stop','find','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','moment','../../../../config/environment','routing','redis','defaults','queue_id','account','queue','from','joinAt','emit','%sQueuesWaitingInteractions','pick','format','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId'];(function(_0x217875,_0x24e634){var _0x2ae231=function(_0x384dbe){while(--_0x384dbe){_0x217875['push'](_0x217875['shift']());}};_0x2ae231(++_0x24e634);}(_0x0ffa,0x107));var _0xa0ff=function(_0x3d8515,_0x107bd1){_0x3d8515=_0x3d8515-0x0;var _0x3b3b3e=_0x0ffa[_0x3d8515];return _0x3b3b3e;};'use strict';var schema=require(_0xa0ff('0x0'));var _=require(_0xa0ff('0x1'));var util=require('util');var seqqueue=require(_0xa0ff('0x2'));var moment=require(_0xa0ff('0x3'));var Redis=require('ioredis');var config=require(_0xa0ff('0x4'));var logger=require('../../../../config/logger')(_0xa0ff('0x5'));var strategy=require('./strategy');config[_0xa0ff('0x6')]=_[_0xa0ff('0x7')](config[_0xa0ff('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa0ff('0x6')]));var attributes=['id',_0xa0ff('0x8'),_0xa0ff('0x9'),_0xa0ff('0xa'),_0xa0ff('0xb'),_0xa0ff('0xc')];function emit(_0x14d8a1,_0x2138de,_0x52d1c8){io['to'](_0x14d8a1)[_0xa0ff('0xd')](_0x2138de,_0x52d1c8);}function emitChannelQueueInteraction(_0x395f01,_0x4a2149,_0x2c0f2b,_0x200da7,_0x5813b4,_0x24fab6,_0x57cc45,_0x2c6d6c){var _0xa5febb=_['clone'](_0x2c0f2b);_0xa5febb[_0xa0ff('0x8')]=_0x2c6d6c;_0xa5febb[_0xa0ff('0xa')]=_0x4a2149;_0xa5febb['account']=_0x200da7;_0xa5febb['id']=_0x5813b4;if(_0x24fab6){_0x57cc45[util['format'](_0xa0ff('0xe'),_0x395f01)][_0x5813b4]=_[_0xa0ff('0xf')](_0xa5febb,attributes);}else{delete _0x57cc45[util[_0xa0ff('0x10')](_0xa0ff('0xe'),_0x395f01)][_0x5813b4];}emit(util[_0xa0ff('0x10')]('%s:queue:%s',_0x395f01,_0x4a2149),util[_0xa0ff('0x10')](_0xa0ff('0x11'),_0x395f01,_0x24fab6?'save':_0xa0ff('0x12')),_[_0xa0ff('0xf')](_0xa5febb,attributes));}var rpc={'openchannelQueueReport':require(_0xa0ff('0x13')),'mailQueueReport':require(_0xa0ff('0x14')),'chatQueueReport':require(_0xa0ff('0x15')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xa0ff('0x16')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0xa0ff('0x17')},'timeout':{'type':_0xa0ff('0x18'),'message':_0xa0ff('0x19')}});function startRouting(_0x5d8b3d,_0x2c4978,_0xaaa591,_0x1c87ae){if(_0x5d8b3d&&_0x2c4978&&_0xaaa591){_0x2c4978[_0xa0ff('0x1a')]+=0x1;var _0x2c3a49={'uniqueid':_0x5d8b3d,'from':_0xaaa591[_0xa0ff('0x1b')]?_0xaaa591[_0xa0ff('0x1b')][_0xa0ff('0xb')]:'','joinAt':moment()[_0xa0ff('0x10')](_0xa0ff('0x1c')),'ContactId':_0xaaa591[_0xa0ff('0x1d')]?_0xaaa591['contact']['id']:null,'ListId':_0xaaa591[_0xa0ff('0x1e')]?_0xaaa591[_0xa0ff('0x1e')]['id']:null};_0x2c3a49[_[_0xa0ff('0x1f')](_0xaaa591[_0xa0ff('0x20')])+_0xa0ff('0x21')]=_0x2c4978['id']||null;_0x2c3a49[_[_0xa0ff('0x1f')](_0xaaa591[_0xa0ff('0x20')])+_0xa0ff('0x22')]=_0xaaa591[_0xa0ff('0x23')]?_0xaaa591['interaction']['id']:null;_0x2c3a49[_['upperFirst'](_0xaaa591[_0xa0ff('0x20')])+_0xa0ff('0x24')]=_0xaaa591['message']?_0xaaa591[_0xa0ff('0x25')]['id']:null;_0x2c3a49[_['upperFirst'](_0xaaa591['channel'])+(_0xaaa591['channel']!==_0xa0ff('0x26')?_0xa0ff('0x27'):'WebsiteId')]=_0xaaa591[_0xa0ff('0x9')]?_0xaaa591[_0xa0ff('0x9')]['id']:null;logger['info'](util[_0xa0ff('0x10')](_0xa0ff('0x28'),_0x5d8b3d,_0x2c4978[_0xa0ff('0x29')]));emitChannelQueueInteraction(_0xaaa591[_0xa0ff('0x20')],_0x2c4978[_0xa0ff('0x29')],_0x2c3a49,_0xaaa591['account']['name'],_0xaaa591['message']['id'],!![],_0x1c87ae,_0x2c4978['id']);if(rpc[_0xaaa591[_0xa0ff('0x20')]+_0xa0ff('0x2a')]){return rpc[_0xaaa591['channel']+_0xa0ff('0x2a')][_0xa0ff('0x2b')](_0x2c3a49)['catch'](function(_0x13fc2d){logger[_0xa0ff('0x2c')](_0xa0ff('0x2d'));});}}}function stopRouting(_0x51672b,_0x5bf54a,_0x38d67c,_0x44c24f){if(_0x51672b&&_0x5bf54a){_0x5bf54a[_0xa0ff('0x1a')]-=0x1;var _0x862a={'leaveAt':moment()['format'](_0xa0ff('0x1c')),'acceptAt':moment()['format'](_0xa0ff('0x1c')),'reason':_0xa0ff('0x2e')};logger[_0xa0ff('0x2f')](util[_0xa0ff('0x10')](_0xa0ff('0x30'),_0x51672b,_0x5bf54a[_0xa0ff('0x29')]));emitChannelQueueInteraction(_0x38d67c['channel'],_0x5bf54a[_0xa0ff('0x29')],_0x38d67c[_0xa0ff('0x1b')],_0x38d67c[_0xa0ff('0x9')][_0xa0ff('0x29')],_0x38d67c[_0xa0ff('0x25')]['id'],![],_0x44c24f,_0x5bf54a['id']);if(rpc[_0x38d67c[_0xa0ff('0x20')]+_0xa0ff('0x2a')]){return rpc[_0x38d67c[_0xa0ff('0x20')]+_0xa0ff('0x2a')][_0xa0ff('0x31')](_0x51672b,_0x862a)[_0xa0ff('0x32')](function(_0x20c464){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0xe1555f,_0x1878cc,_0x1dab42,_0x185175){if(_0xe1555f&&_0x1878cc){_0x1878cc[_0xa0ff('0x1a')]-=0x1;var _0x1b5d7f={'leaveAt':moment()['format'](_0xa0ff('0x1c')),'exitAt':moment()[_0xa0ff('0x10')](_0xa0ff('0x1c')),'reason':_0xa0ff('0x33')};logger[_0xa0ff('0x2f')](util[_0xa0ff('0x10')](_0xa0ff('0x34'),_0xe1555f,_0x1878cc[_0xa0ff('0x29')]));emitChannelQueueInteraction(_0x1dab42[_0xa0ff('0x20')],_0x1878cc['name'],_0x1dab42[_0xa0ff('0x1b')],_0x1dab42[_0xa0ff('0x9')]['name'],_0x1dab42[_0xa0ff('0x25')]['id'],![],_0x185175);if(rpc[_0x1dab42['channel']+_0xa0ff('0x2a')]){return rpc[_0x1dab42[_0xa0ff('0x20')]+_0xa0ff('0x2a')][_0xa0ff('0x31')](_0xe1555f,_0x1b5d7f)[_0xa0ff('0x32')](function(_0x21da9d){logger[_0xa0ff('0x2c')](_0xa0ff('0x35'));});}}}function handleFindQueue(_0x435661){return function(_0x58773e){return _0x58773e[_0xa0ff('0x29')][_0xa0ff('0x36')]()===_0x435661[_0xa0ff('0x36')]();};}exports[_0xa0ff('0x37')]=function(_0x4d12bd,_0x5a5ba4,_0x2e182f,_0x1bb340){return function(_0x17a48d){try{var _0x167d35={'name':_0x5a5ba4[0x0],'timeout':_0x5a5ba4[0x1]};var _0xfdc19a=queue['validate'](_0x167d35,{'typecast':!![]});if(_0xfdc19a['length']){logger[_0xa0ff('0x2c')](_0xa0ff('0x38'),_0x4d12bd,_[_0xa0ff('0x39')](_0xfdc19a,_0xa0ff('0x25'))['join'](',\x20'));_0x17a48d[_0xa0ff('0x3a')]();}else{var _0xef6ad1=_[_0xa0ff('0x3b')](_0x2e182f[_0x1bb340[_0xa0ff('0x20')]+_0xa0ff('0x3c')],handleFindQueue(_0x167d35[_0xa0ff('0x29')]));if(_0xef6ad1){startRouting(_0x4d12bd,_0xef6ad1,_0x1bb340,_0x2e182f);var _0x37a271=(_0xef6ad1[_0xa0ff('0x33')]||0xa)*0x3e8;var _0x354923=(_0x167d35[_0xa0ff('0x33')]||0x14)*0x3e8;var _0x28096d,_0xeedbae;if(_0x37a271>_0x354923){_0x354923=_0x37a271;}var _0x24b156=seqqueue[_0xa0ff('0x3d')](_0x37a271);_0x24b156['id']=_0x4d12bd;_0x24b156[_0xa0ff('0x3e')]=_0x37a271;_0x24b156[_0xa0ff('0x3f')]=_0x354923;_0x24b156[_0xa0ff('0x20')]=_0x1bb340[_0xa0ff('0x20')];_0x2e182f[_0xa0ff('0x40')][_0x4d12bd]['on']('end',function(){logger[_0xa0ff('0x2f')](_0xa0ff('0x41'),_0x4d12bd);stopRouting(_0x4d12bd,_0xef6ad1,_0x1bb340,_0x2e182f);clearTimeout(_0x28096d);_0x28096d=undefined;_0x24b156[_0xa0ff('0x42')](!![]);if(_0x2e182f[_0xa0ff('0x40')][_0x4d12bd]){delete _0x2e182f[_0xa0ff('0x40')][_0x4d12bd];}_0x17a48d['stop']();});_0x2e182f[_0xa0ff('0x40')][_0x4d12bd]['on'](_0xa0ff('0x43'),function(){if(_0x2e182f[_0xa0ff('0x40')][_0x4d12bd]){delete _0x2e182f['rules'][_0x4d12bd];}});_0x28096d=setTimeout(function(){logger[_0xa0ff('0x2f')](_0xa0ff('0x44'),_0x4d12bd);endRouting(_0x4d12bd,_0xef6ad1,_0x1bb340,_0x2e182f);clearTimeout(_0x28096d);_0x24b156['close'](!![]);_0x17a48d[_0xa0ff('0x45')]();},_0x354923);switch(_0xef6ad1[_0xa0ff('0x46')]){case _0xa0ff('0x47'):strategy[_0xa0ff('0x47')](_0x24b156,_0xef6ad1,_0x2e182f,_0x1bb340);break;default:strategy['beepall'](_0x24b156,_0xef6ad1,_0x2e182f,_0x1bb340);}}else{logger[_0xa0ff('0x2c')](_0xa0ff('0x48'),_0x4d12bd,_0x167d35[_0xa0ff('0x29')]);_0x17a48d[_0xa0ff('0x3a')]();}}}catch(_0x2ec329){console[_0xa0ff('0x49')](_0x2ec329);logger[_0xa0ff('0x2c')](_0xa0ff('0x38'),_0x4d12bd,_0x2ec329[_0xa0ff('0x4a')]);_0x17a48d[_0xa0ff('0x3a')]();}};};
\ No newline at end of file
+var _0x9153=['../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','waiting','body','from','contact','list','upperFirst','QueueId','channel','interaction','MessageId','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','message','QueueReport','create','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','update','catch','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/logger','routing','./strategy','redis','queue_id','account','queue','joinAt','emit','clone','pick','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0x9153,0xd8));var _0x3915=function(_0x4ed075,_0x3afcd0){_0x4ed075=_0x4ed075-0x0;var _0x5dfafc=_0x9153[_0x4ed075];return _0x5dfafc;};'use strict';var schema=require(_0x3915('0x0'));var _=require(_0x3915('0x1'));var util=require(_0x3915('0x2'));var seqqueue=require(_0x3915('0x3'));var moment=require(_0x3915('0x4'));var Redis=require(_0x3915('0x5'));var config=require('../../../../config/environment');var logger=require(_0x3915('0x6'))(_0x3915('0x7'));var strategy=require(_0x3915('0x8'));config[_0x3915('0x9')]=_['defaults'](config[_0x3915('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3915('0x9')]));var attributes=['id',_0x3915('0xa'),_0x3915('0xb'),_0x3915('0xc'),'from',_0x3915('0xd')];function emit(_0x50e0a4,_0x510897,_0x3287c3){io['to'](_0x50e0a4)[_0x3915('0xe')](_0x510897,_0x3287c3);}function emitChannelQueueInteraction(_0x46bdb0,_0x3f5a4a,_0x192a79,_0xd22a28,_0x431067,_0x1068d3,_0x1389cb,_0x42bc84){var _0x4d3877=_[_0x3915('0xf')](_0x192a79);_0x4d3877[_0x3915('0xa')]=_0x42bc84;_0x4d3877['queue']=_0x3f5a4a;_0x4d3877[_0x3915('0xb')]=_0xd22a28;_0x4d3877['id']=_0x431067;if(_0x1068d3){_0x1389cb[util['format']('%sQueuesWaitingInteractions',_0x46bdb0)][_0x431067]=_[_0x3915('0x10')](_0x4d3877,attributes);}else{delete _0x1389cb[util[_0x3915('0x11')](_0x3915('0x12'),_0x46bdb0)][_0x431067];}emit(util[_0x3915('0x11')]('%s:queue:%s',_0x46bdb0,_0x3f5a4a),util[_0x3915('0x11')](_0x3915('0x13'),_0x46bdb0,_0x1068d3?_0x3915('0x14'):_0x3915('0x15')),_[_0x3915('0x10')](_0x4d3877,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x3915('0x16')),'chatQueueReport':require(_0x3915('0x17')),'smsQueueReport':require(_0x3915('0x18')),'faxQueueReport':require(_0x3915('0x19')),'whatsappQueueReport':require(_0x3915('0x1a'))};var queue=schema({'name':{'type':_0x3915('0x1b'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x3915('0x1c'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x596773,_0x519d30,_0x27c8b3,_0x42af5a){if(_0x596773&&_0x519d30&&_0x27c8b3){_0x519d30[_0x3915('0x1d')]+=0x1;var _0x55e896={'uniqueid':_0x596773,'from':_0x27c8b3[_0x3915('0x1e')]?_0x27c8b3['body'][_0x3915('0x1f')]:'','joinAt':moment()[_0x3915('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x27c8b3[_0x3915('0x20')]?_0x27c8b3[_0x3915('0x20')]['id']:null,'ListId':_0x27c8b3[_0x3915('0x21')]?_0x27c8b3[_0x3915('0x21')]['id']:null};_0x55e896[_[_0x3915('0x22')](_0x27c8b3['channel'])+_0x3915('0x23')]=_0x519d30['id']||null;_0x55e896[_['upperFirst'](_0x27c8b3[_0x3915('0x24')])+'InteractionId']=_0x27c8b3[_0x3915('0x25')]?_0x27c8b3[_0x3915('0x25')]['id']:null;_0x55e896[_[_0x3915('0x22')](_0x27c8b3[_0x3915('0x24')])+_0x3915('0x26')]=_0x27c8b3['message']?_0x27c8b3['message']['id']:null;_0x55e896[_[_0x3915('0x22')](_0x27c8b3[_0x3915('0x24')])+(_0x27c8b3[_0x3915('0x24')]!==_0x3915('0x27')?_0x3915('0x28'):_0x3915('0x29'))]=_0x27c8b3['account']?_0x27c8b3['account']['id']:null;logger[_0x3915('0x2a')](util['format'](_0x3915('0x2b'),_0x596773,_0x519d30[_0x3915('0x2c')]));emitChannelQueueInteraction(_0x27c8b3[_0x3915('0x24')],_0x519d30[_0x3915('0x2c')],_0x55e896,_0x27c8b3['account'][_0x3915('0x2c')],_0x27c8b3[_0x3915('0x2d')]['id'],!![],_0x42af5a,_0x519d30['id']);if(rpc[_0x27c8b3['channel']+_0x3915('0x2e')]){return rpc[_0x27c8b3[_0x3915('0x24')]+_0x3915('0x2e')][_0x3915('0x2f')](_0x55e896)['catch'](function(_0x47c587){logger[_0x3915('0x30')](_0x3915('0x31'));});}}}function stopRouting(_0x5f42d1,_0x3007e2,_0x49ae37,_0x4b4bf4){if(_0x5f42d1&&_0x3007e2){_0x3007e2[_0x3915('0x1d')]-=0x1;var _0x4de8fc={'leaveAt':moment()[_0x3915('0x11')](_0x3915('0x32')),'acceptAt':moment()[_0x3915('0x11')](_0x3915('0x32')),'reason':_0x3915('0x33')};logger[_0x3915('0x2a')](util[_0x3915('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x5f42d1,_0x3007e2[_0x3915('0x2c')]));emitChannelQueueInteraction(_0x49ae37['channel'],_0x3007e2[_0x3915('0x2c')],_0x49ae37[_0x3915('0x1e')],_0x49ae37[_0x3915('0xb')][_0x3915('0x2c')],_0x49ae37[_0x3915('0x2d')]['id'],![],_0x4b4bf4,_0x3007e2['id']);if(rpc[_0x49ae37['channel']+_0x3915('0x2e')]){return rpc[_0x49ae37['channel']+_0x3915('0x2e')][_0x3915('0x34')](_0x5f42d1,_0x4de8fc)[_0x3915('0x35')](function(_0x331352){logger[_0x3915('0x30')]('update\x20queue\x20report');});}}}function endRouting(_0x3b620a,_0x5e00ba,_0x1f77e6,_0x201185){if(_0x3b620a&&_0x5e00ba){_0x5e00ba[_0x3915('0x1d')]-=0x1;var _0x20bf05={'leaveAt':moment()[_0x3915('0x11')](_0x3915('0x32')),'exitAt':moment()[_0x3915('0x11')](_0x3915('0x32')),'reason':_0x3915('0x36')};logger[_0x3915('0x2a')](util[_0x3915('0x11')](_0x3915('0x37'),_0x3b620a,_0x5e00ba[_0x3915('0x2c')]));emitChannelQueueInteraction(_0x1f77e6[_0x3915('0x24')],_0x5e00ba[_0x3915('0x2c')],_0x1f77e6[_0x3915('0x1e')],_0x1f77e6[_0x3915('0xb')][_0x3915('0x2c')],_0x1f77e6['message']['id'],![],_0x201185);if(rpc[_0x1f77e6[_0x3915('0x24')]+_0x3915('0x2e')]){return rpc[_0x1f77e6[_0x3915('0x24')]+_0x3915('0x2e')][_0x3915('0x34')](_0x3b620a,_0x20bf05)['catch'](function(_0x2d07f0){logger[_0x3915('0x30')](_0x3915('0x38'));});}}}function handleFindQueue(_0x13acde){return function(_0x5114df){return _0x5114df[_0x3915('0x2c')]['toLowerCase']()===_0x13acde[_0x3915('0x39')]();};}exports[_0x3915('0x3a')]=function(_0x5b885f,_0x588cf7,_0x3e166f,_0x59aa9b){return function(_0x3d5093){try{var _0xca63f4={'name':_0x588cf7[0x0],'timeout':_0x588cf7[0x1]};var _0x1d689b=queue[_0x3915('0x0')](_0xca63f4,{'typecast':!![]});if(_0x1d689b['length']){logger[_0x3915('0x30')](_0x3915('0x3b'),_0x5b885f,_[_0x3915('0x3c')](_0x1d689b,'message')[_0x3915('0x3d')](',\x20'));_0x3d5093[_0x3915('0x3e')]();}else{var _0x294dcd=_[_0x3915('0x3f')](_0x3e166f[_0x59aa9b[_0x3915('0x24')]+_0x3915('0x40')],handleFindQueue(_0xca63f4[_0x3915('0x2c')]));if(_0x294dcd){startRouting(_0x5b885f,_0x294dcd,_0x59aa9b,_0x3e166f);var _0x424c6c=(_0x294dcd[_0x3915('0x36')]||0xa)*0x3e8;var _0x271052=(_0xca63f4[_0x3915('0x36')]||0x14)*0x3e8;var _0x8d63c5,_0x4fa4d4;if(_0x424c6c>_0x271052){_0x271052=_0x424c6c;}var _0xde2d41=seqqueue[_0x3915('0x41')](_0x424c6c);_0xde2d41['id']=_0x5b885f;_0xde2d41[_0x3915('0x42')]=_0x424c6c;_0xde2d41['qtimeout']=_0x271052;_0xde2d41[_0x3915('0x24')]=_0x59aa9b['channel'];_0x3e166f[_0x3915('0x43')][_0x5b885f]['on'](_0x3915('0x44'),function(){logger[_0x3915('0x2a')](_0x3915('0x45'),_0x5b885f);stopRouting(_0x5b885f,_0x294dcd,_0x59aa9b,_0x3e166f);clearTimeout(_0x8d63c5);_0x8d63c5=undefined;_0xde2d41['close'](!![]);if(_0x3e166f[_0x3915('0x43')][_0x5b885f]){delete _0x3e166f[_0x3915('0x43')][_0x5b885f];}_0x3d5093[_0x3915('0x3e')]();});_0x3e166f['rules'][_0x5b885f]['on'](_0x3915('0x46'),function(){if(_0x3e166f[_0x3915('0x43')][_0x5b885f]){delete _0x3e166f['rules'][_0x5b885f];}});_0x8d63c5=setTimeout(function(){logger['info'](_0x3915('0x47'),_0x5b885f);endRouting(_0x5b885f,_0x294dcd,_0x59aa9b,_0x3e166f);clearTimeout(_0x8d63c5);_0xde2d41[_0x3915('0x48')](!![]);_0x3d5093[_0x3915('0x49')]();},_0x271052);switch(_0x294dcd[_0x3915('0x4a')]){case _0x3915('0x4b'):strategy[_0x3915('0x4b')](_0xde2d41,_0x294dcd,_0x3e166f,_0x59aa9b);break;default:strategy[_0x3915('0x4c')](_0xde2d41,_0x294dcd,_0x3e166f,_0x59aa9b);}}else{logger[_0x3915('0x30')](_0x3915('0x4d'),_0x5b885f,_0xca63f4[_0x3915('0x2c')]);_0x3d5093[_0x3915('0x3e')]();}}}catch(_0x572ec4){console[_0x3915('0x4e')](_0x572ec4);logger[_0x3915('0x30')](_0x3915('0x3b'),_0x5b885f,_0x572ec4[_0x3915('0x4f')]);_0x3d5093[_0x3915('0x3e')]();}};};
\ No newline at end of file
index 6109660..0e0b0c4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc0cf=['writeLog','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','handleTimeout','timeout','bind','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','showNotification','notificationId','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue'];(function(_0x3ee2ee,_0x12d6a9){var _0x2f5834=function(_0x58a1e4){while(--_0x58a1e4){_0x3ee2ee['push'](_0x3ee2ee['shift']());}};_0x2f5834(++_0x12d6a9);}(_0xc0cf,0x83));var _0xfc0c=function(_0x5402ee,_0x23d559){_0x5402ee=_0x5402ee-0x0;var _0x4d7246=_0xc0cf[_0x5402ee];return _0x4d7246;};'use strict';var _=require('lodash');var uuid=require(_0xfc0c('0x0'));var util=require(_0xfc0c('0x1'));var logger=require(_0xfc0c('0x2'))(_0xfc0c('0x3'));var Agent=function(_0x19c75f,_0x324bd1,_0x310e06,_0x3e581d){this['notificationId']=uuid['v4']();this[_0xfc0c('0x4')]=_0x19c75f;this[_0xfc0c('0x5')]=_0x324bd1;this[_0xfc0c('0x6')]=_0x310e06;this[_0xfc0c('0x3')]=_0x3e581d;this['squeue'][_0xfc0c('0x7')](this[_0xfc0c('0x8')]['bind'](this),this[_0xfc0c('0x9')]['bind'](this));this['squeue']['on'](_0xfc0c('0xa'),this['handleTimeout'][_0xfc0c('0xb')](this));this[_0xfc0c('0x4')]['on'](_0xfc0c('0xc'),this[_0xfc0c('0xd')][_0xfc0c('0xb')](this));};Agent[_0xfc0c('0xe')]['push']=function(){this[_0xfc0c('0x4')]['push'](this['handleRun']['bind'](this),this[_0xfc0c('0x9')]['bind'](this));};Agent[_0xfc0c('0xe')][_0xfc0c('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0xfc0c('0xe')][_0xfc0c('0x8')]=function(){logger[_0xfc0c('0xf')](_0xfc0c('0x10'),this['squeue']['id'],this[_0xfc0c('0x5')]['id']);if(_[_0xfc0c('0x11')](this[_0xfc0c('0x6')][_0xfc0c('0x12')][this[_0xfc0c('0x5')]['id']])){logger['debug'](_0xfc0c('0x13'),this['squeue']['id'],this[_0xfc0c('0x5')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0xfc0c('0x3')][_0xfc0c('0x14')]||util[_0xfc0c('0x15')](this[_0xfc0c('0x4')]['id'],this[_0xfc0c('0x6')]['agents'][this[_0xfc0c('0x5')]['id']],this[_0xfc0c('0x4')]['channel'],![])){this[_0xfc0c('0x6')][_0xfc0c('0x12')][this[_0xfc0c('0x5')]['id']][_0xfc0c('0x16')]=!![];this[_0xfc0c('0x6')][_0xfc0c('0x12')][this[_0xfc0c('0x5')]['id']]['busyQueue']=undefined;util[_0xfc0c('0x17')](this[_0xfc0c('0x18')],this[_0xfc0c('0x4')]['id'],this[_0xfc0c('0x6')][_0xfc0c('0x12')][this[_0xfc0c('0x5')]['id']],null,this[_0xfc0c('0x3')]);util['writeLog'](this[_0xfc0c('0x4')]['id'],this[_0xfc0c('0x6')][_0xfc0c('0x12')][this[_0xfc0c('0x5')]['id']],_0xfc0c('0x19')+(this[_0xfc0c('0x3')][_0xfc0c('0x14')]?':FORCED':''));}else{logger[_0xfc0c('0xf')](_0xfc0c('0x1a'),this[_0xfc0c('0x4')]['id'],this[_0xfc0c('0x5')]['id']);setTimeout(this[_0xfc0c('0x7')][_0xfc0c('0xb')](this),0x3e8);}}};Agent[_0xfc0c('0xe')]['handleTimeout']=function(_0x2745da){if(_[_0xfc0c('0x11')](this['realtime'][_0xfc0c('0x12')][this['agent']['id']])){return logger[_0xfc0c('0xf')](_0xfc0c('0x13'),this[_0xfc0c('0x4')]['id'],this[_0xfc0c('0x5')]['id']);}else{logger[_0xfc0c('0xf')](_0xfc0c('0x1b'),this['squeue']['id'],this[_0xfc0c('0x5')]['id']);util['hideNotification'](this[_0xfc0c('0x18')],this[_0xfc0c('0x4')]['id'],this[_0xfc0c('0x6')]['agents'][this['agent']['id']],null,this[_0xfc0c('0x3')]);this[_0xfc0c('0x6')][_0xfc0c('0x12')][this[_0xfc0c('0x5')]['id']][_0xfc0c('0x16')]=![];this[_0xfc0c('0x6')][_0xfc0c('0x12')][this[_0xfc0c('0x5')]['id']][_0xfc0c('0x1c')]=undefined;util[_0xfc0c('0x1d')](this[_0xfc0c('0x4')]['id'],this['realtime'][_0xfc0c('0x12')][this[_0xfc0c('0x5')]['id']],_0x2745da?'STOP':_0xfc0c('0x1e'));}if(!_0x2745da){setTimeout(this[_0xfc0c('0x7')][_0xfc0c('0xb')](this),0x3e8);}};function agent(_0x40e771,_0x4fe8d6,_0xa931c2,_0x14bf82){return new Agent(_0x40e771,_0x4fe8d6,_0xa931c2,_0x14bf82);}module[_0xfc0c('0x1f')]=agent;
\ No newline at end of file
+var _0x1f25=['handleRun','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','bind','handleTimeout','timeout','handleDrained','prototype','push'];(function(_0x17c614,_0x21f536){var _0x3365bd=function(_0x60692){while(--_0x60692){_0x17c614['push'](_0x17c614['shift']());}};_0x3365bd(++_0x21f536);}(_0x1f25,0x147));var _0x51f2=function(_0x307a57,_0x145391){_0x307a57=_0x307a57-0x0;var _0xd3b060=_0x1f25[_0x307a57];return _0xd3b060;};'use strict';var _=require(_0x51f2('0x0'));var uuid=require(_0x51f2('0x1'));var util=require(_0x51f2('0x2'));var logger=require(_0x51f2('0x3'))(_0x51f2('0x4'));var Agent=function(_0x306723,_0x370d31,_0xa10ae0,_0x50c7cb){this['notificationId']=uuid['v4']();this[_0x51f2('0x5')]=_0x306723;this[_0x51f2('0x6')]=_0x370d31;this[_0x51f2('0x7')]=_0xa10ae0;this[_0x51f2('0x4')]=_0x50c7cb;this[_0x51f2('0x5')]['push'](this['handleRun'][_0x51f2('0x8')](this),this[_0x51f2('0x9')][_0x51f2('0x8')](this));this[_0x51f2('0x5')]['on'](_0x51f2('0xa'),this[_0x51f2('0x9')][_0x51f2('0x8')](this));this[_0x51f2('0x5')]['on']('drained',this[_0x51f2('0xb')][_0x51f2('0x8')](this));};Agent[_0x51f2('0xc')][_0x51f2('0xd')]=function(){this[_0x51f2('0x5')][_0x51f2('0xd')](this['handleRun'][_0x51f2('0x8')](this),this[_0x51f2('0x9')][_0x51f2('0x8')](this));};Agent[_0x51f2('0xc')][_0x51f2('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0x51f2('0xc')][_0x51f2('0xe')]=function(){logger[_0x51f2('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x51f2('0x5')]['id'],this[_0x51f2('0x6')]['id']);if(_['isNil'](this[_0x51f2('0x7')]['agents'][this[_0x51f2('0x6')]['id']])){logger[_0x51f2('0xf')](_0x51f2('0x10'),this[_0x51f2('0x5')]['id'],this[_0x51f2('0x6')]['id']);setTimeout(this[_0x51f2('0xd')][_0x51f2('0x8')](this),0x3e8);}else{if(this[_0x51f2('0x4')][_0x51f2('0x11')]||util[_0x51f2('0x12')](this[_0x51f2('0x5')]['id'],this[_0x51f2('0x7')][_0x51f2('0x13')][this[_0x51f2('0x6')]['id']],this['squeue'][_0x51f2('0x14')],![])){this[_0x51f2('0x7')][_0x51f2('0x13')][this[_0x51f2('0x6')]['id']][_0x51f2('0x15')]=!![];this['realtime']['agents'][this[_0x51f2('0x6')]['id']][_0x51f2('0x16')]=undefined;util[_0x51f2('0x17')](this[_0x51f2('0x18')],this['squeue']['id'],this[_0x51f2('0x7')][_0x51f2('0x13')][this[_0x51f2('0x6')]['id']],null,this[_0x51f2('0x4')]);util[_0x51f2('0x19')](this[_0x51f2('0x5')]['id'],this[_0x51f2('0x7')]['agents'][this[_0x51f2('0x6')]['id']],_0x51f2('0x1a')+(this[_0x51f2('0x4')]['forcedOwnership']?_0x51f2('0x1b'):''));}else{logger[_0x51f2('0xf')](_0x51f2('0x1c'),this['squeue']['id'],this[_0x51f2('0x6')]['id']);setTimeout(this[_0x51f2('0xd')][_0x51f2('0x8')](this),0x3e8);}}};Agent[_0x51f2('0xc')][_0x51f2('0x9')]=function(_0x1ec088){if(_['isNil'](this['realtime']['agents'][this[_0x51f2('0x6')]['id']])){return logger[_0x51f2('0xf')](_0x51f2('0x10'),this[_0x51f2('0x5')]['id'],this['agent']['id']);}else{logger[_0x51f2('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0x51f2('0x6')]['id']);util['hideNotification'](this['notificationId'],this[_0x51f2('0x5')]['id'],this[_0x51f2('0x7')][_0x51f2('0x13')][this[_0x51f2('0x6')]['id']],null,this[_0x51f2('0x4')]);this[_0x51f2('0x7')][_0x51f2('0x13')][this[_0x51f2('0x6')]['id']][_0x51f2('0x15')]=![];this['realtime'][_0x51f2('0x13')][this[_0x51f2('0x6')]['id']][_0x51f2('0x16')]=undefined;util['writeLog'](this[_0x51f2('0x5')]['id'],this[_0x51f2('0x7')]['agents'][this['agent']['id']],_0x1ec088?_0x51f2('0x1d'):_0x51f2('0x1e'));}if(!_0x1ec088){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x20d375,_0x5963f1,_0xd67bcf,_0x165f38){return new Agent(_0x20d375,_0x5963f1,_0xd67bcf,_0x165f38);}module['exports']=agent;
\ No newline at end of file
index 02dd6e0..4c1f77b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf46a=['Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','writeLog','busy','busyQueue','name','showNotification','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','exports','lodash','./util','../../../../../config/logger','notificationId','squeue','queue','realtime','routing','push','handleRun','bind','handleTimeout','drained','prototype','handleDrained','isNil'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf46a,0xa4));var _0xaf46=function(_0x376138,_0x161530){_0x376138=_0x376138-0x0;var _0x1eca5f=_0xf46a[_0x376138];return _0x1eca5f;};'use strict';var _=require(_0xaf46('0x0'));var uuid=require('uuid');var util=require(_0xaf46('0x1'));var logger=require(_0xaf46('0x2'))('routing');var Beepall=function(_0xf4ff9e,_0x3a7936,_0x53059e,_0x14a6b6){this[_0xaf46('0x3')]=uuid['v4']();this[_0xaf46('0x4')]=_0xf4ff9e;this[_0xaf46('0x5')]=_0x3a7936;this[_0xaf46('0x6')]=_0x53059e;this[_0xaf46('0x7')]=_0x14a6b6;this[_0xaf46('0x4')][_0xaf46('0x8')](this[_0xaf46('0x9')][_0xaf46('0xa')](this),this[_0xaf46('0xb')]['bind'](this));this[_0xaf46('0x4')]['on']('timeout',this['handleTimeout']['bind'](this));this[_0xaf46('0x4')]['on'](_0xaf46('0xc'),this['handleDrained'][_0xaf46('0xa')](this));};Beepall[_0xaf46('0xd')][_0xaf46('0x8')]=function(){this['squeue'][_0xaf46('0x8')](this['handleRun'][_0xaf46('0xa')](this),this['handleTimeout'][_0xaf46('0xa')](this));};Beepall['prototype'][_0xaf46('0xe')]=function(){this[_0xaf46('0xb')](!![]);};Beepall[_0xaf46('0xd')][_0xaf46('0x9')]=function(){var _0x453a9a=!![];if(!_[_0xaf46('0xf')](this[_0xaf46('0x5')])&&!_[_0xaf46('0xf')](this['queue']['Agents'])&&this['queue'][_0xaf46('0x10')]['length']>0x0){for(var _0x498720=0x0,_0x1d91ca;_0x498720<this[_0xaf46('0x5')]['Agents'][_0xaf46('0x11')];_0x498720+=0x1){_0x1d91ca=this[_0xaf46('0x5')][_0xaf46('0x10')][_0x498720]['id'];if(_[_0xaf46('0xf')](this[_0xaf46('0x6')][_0xaf46('0x12')][_0x1d91ca])){logger['debug'](_0xaf46('0x13'),this[_0xaf46('0x4')]['id'],_0x1d91ca);}else{if(util['isAgentAvailable'](this[_0xaf46('0x4')]['id'],this[_0xaf46('0x6')]['agents'][_0x1d91ca],this['squeue']['channel'],!![])){_0x453a9a=![];util[_0xaf46('0x14')](this[_0xaf46('0x4')]['id'],this['realtime'][_0xaf46('0x12')][_0x1d91ca],'RINGING');this[_0xaf46('0x6')][_0xaf46('0x12')][_0x1d91ca][_0xaf46('0x15')]=!![];this[_0xaf46('0x6')][_0xaf46('0x12')][_0x1d91ca][_0xaf46('0x16')]=this[_0xaf46('0x5')][_0xaf46('0x17')];util[_0xaf46('0x18')](this[_0xaf46('0x3')],this['squeue']['id'],this['realtime'][_0xaf46('0x12')][_0x1d91ca],this[_0xaf46('0x5')],this[_0xaf46('0x7')]);}}}if(_0x453a9a){logger[_0xaf46('0x19')](_0xaf46('0x1a'),this[_0xaf46('0x4')]['id']);setTimeout(this[_0xaf46('0x8')][_0xaf46('0xa')](this),0x3e8);}}else{logger['debug'](_0xaf46('0x1b'),this[_0xaf46('0x4')]['id']);setTimeout(this['push'][_0xaf46('0xa')](this),0x3e8);}};Beepall[_0xaf46('0xd')][_0xaf46('0xb')]=function(_0x9bc6ef){if(!_[_0xaf46('0xf')](this[_0xaf46('0x5')])&&!_['isNil'](this[_0xaf46('0x5')][_0xaf46('0x10')])){for(var _0x5eb4e1=0x0,_0x7bd7f3;_0x5eb4e1<this[_0xaf46('0x5')][_0xaf46('0x10')][_0xaf46('0x11')];_0x5eb4e1+=0x1){_0x7bd7f3=this[_0xaf46('0x5')][_0xaf46('0x10')][_0x5eb4e1]['id'];if(_[_0xaf46('0xf')](this[_0xaf46('0x6')][_0xaf46('0x12')][_0x7bd7f3])){logger[_0xaf46('0x19')](_0xaf46('0x13'),this['squeue']['id'],_0x7bd7f3);}else{util[_0xaf46('0x1c')](this['notificationId'],this[_0xaf46('0x4')]['id'],this[_0xaf46('0x6')][_0xaf46('0x12')][_0x7bd7f3],this[_0xaf46('0x5')],this['routing']);util[_0xaf46('0x14')](this[_0xaf46('0x4')]['id'],this[_0xaf46('0x6')][_0xaf46('0x12')][_0x7bd7f3],_0x9bc6ef?'STOP':'TIMEOUT');this[_0xaf46('0x6')][_0xaf46('0x12')][_0x7bd7f3][_0xaf46('0x15')]=![];this[_0xaf46('0x6')]['agents'][_0x7bd7f3][_0xaf46('0x16')]=undefined;}}}if(!_0x9bc6ef){setTimeout(this[_0xaf46('0x8')][_0xaf46('0xa')](this),0x3e8);}};function beepall(_0x106e17,_0x207d14,_0x1674c0,_0x4b5fa9){return new Beepall(_0x106e17,_0x207d14,_0x1674c0,_0x4b5fa9);}module[_0xaf46('0x1d')]=beepall;
\ No newline at end of file
+var _0xfbac=['busy','busyQueue','showNotification','[%s][QUEUE]\x20EMPTY','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','isNil','queue','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','realtime','channel','writeLog','RINGING'];(function(_0x16dbcd,_0x274516){var _0x34706e=function(_0x43433d){while(--_0x43433d){_0x16dbcd['push'](_0x16dbcd['shift']());}};_0x34706e(++_0x274516);}(_0xfbac,0x167));var _0xcfba=function(_0x4ed312,_0x4c6728){_0x4ed312=_0x4ed312-0x0;var _0x46b671=_0xfbac[_0x4ed312];return _0x46b671;};'use strict';var _=require('lodash');var uuid=require(_0xcfba('0x0'));var util=require(_0xcfba('0x1'));var logger=require(_0xcfba('0x2'))(_0xcfba('0x3'));var Beepall=function(_0x9aacde,_0x59384a,_0x54c2c5,_0x4c3f1b){this[_0xcfba('0x4')]=uuid['v4']();this[_0xcfba('0x5')]=_0x9aacde;this['queue']=_0x59384a;this['realtime']=_0x54c2c5;this[_0xcfba('0x3')]=_0x4c3f1b;this['squeue'][_0xcfba('0x6')](this['handleRun'][_0xcfba('0x7')](this),this[_0xcfba('0x8')]['bind'](this));this[_0xcfba('0x5')]['on'](_0xcfba('0x9'),this[_0xcfba('0x8')][_0xcfba('0x7')](this));this[_0xcfba('0x5')]['on'](_0xcfba('0xa'),this[_0xcfba('0xb')][_0xcfba('0x7')](this));};Beepall[_0xcfba('0xc')][_0xcfba('0x6')]=function(){this[_0xcfba('0x5')][_0xcfba('0x6')](this['handleRun']['bind'](this),this[_0xcfba('0x8')][_0xcfba('0x7')](this));};Beepall['prototype'][_0xcfba('0xb')]=function(){this[_0xcfba('0x8')](!![]);};Beepall[_0xcfba('0xc')][_0xcfba('0xd')]=function(){var _0x2333ee=!![];if(!_[_0xcfba('0xe')](this[_0xcfba('0xf')])&&!_[_0xcfba('0xe')](this[_0xcfba('0xf')][_0xcfba('0x10')])&&this[_0xcfba('0xf')][_0xcfba('0x10')][_0xcfba('0x11')]>0x0){for(var _0x5bff45=0x0,_0x670b69;_0x5bff45<this[_0xcfba('0xf')][_0xcfba('0x10')][_0xcfba('0x11')];_0x5bff45+=0x1){_0x670b69=this[_0xcfba('0xf')][_0xcfba('0x10')][_0x5bff45]['id'];if(_[_0xcfba('0xe')](this['realtime'][_0xcfba('0x12')][_0x670b69])){logger[_0xcfba('0x13')](_0xcfba('0x14'),this['squeue']['id'],_0x670b69);}else{if(util['isAgentAvailable'](this[_0xcfba('0x5')]['id'],this[_0xcfba('0x15')][_0xcfba('0x12')][_0x670b69],this[_0xcfba('0x5')][_0xcfba('0x16')],!![])){_0x2333ee=![];util[_0xcfba('0x17')](this['squeue']['id'],this[_0xcfba('0x15')]['agents'][_0x670b69],_0xcfba('0x18'));this[_0xcfba('0x15')]['agents'][_0x670b69][_0xcfba('0x19')]=!![];this[_0xcfba('0x15')][_0xcfba('0x12')][_0x670b69][_0xcfba('0x1a')]=this['queue']['name'];util[_0xcfba('0x1b')](this[_0xcfba('0x4')],this[_0xcfba('0x5')]['id'],this['realtime'][_0xcfba('0x12')][_0x670b69],this['queue'],this[_0xcfba('0x3')]);}}}if(_0x2333ee){logger['debug']('[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY',this[_0xcfba('0x5')]['id']);setTimeout(this[_0xcfba('0x6')]['bind'](this),0x3e8);}}else{logger[_0xcfba('0x13')](_0xcfba('0x1c'),this[_0xcfba('0x5')]['id']);setTimeout(this[_0xcfba('0x6')][_0xcfba('0x7')](this),0x3e8);}};Beepall[_0xcfba('0xc')][_0xcfba('0x8')]=function(_0x4585ec){if(!_['isNil'](this[_0xcfba('0xf')])&&!_['isNil'](this['queue'][_0xcfba('0x10')])){for(var _0x4ecd3c=0x0,_0x2ec629;_0x4ecd3c<this['queue'][_0xcfba('0x10')][_0xcfba('0x11')];_0x4ecd3c+=0x1){_0x2ec629=this[_0xcfba('0xf')][_0xcfba('0x10')][_0x4ecd3c]['id'];if(_[_0xcfba('0xe')](this[_0xcfba('0x15')][_0xcfba('0x12')][_0x2ec629])){logger[_0xcfba('0x13')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],_0x2ec629);}else{util['hideNotification'](this[_0xcfba('0x4')],this[_0xcfba('0x5')]['id'],this['realtime'][_0xcfba('0x12')][_0x2ec629],this['queue'],this[_0xcfba('0x3')]);util[_0xcfba('0x17')](this[_0xcfba('0x5')]['id'],this[_0xcfba('0x15')][_0xcfba('0x12')][_0x2ec629],_0x4585ec?_0xcfba('0x1d'):_0xcfba('0x1e'));this[_0xcfba('0x15')]['agents'][_0x2ec629][_0xcfba('0x19')]=![];this[_0xcfba('0x15')][_0xcfba('0x12')][_0x2ec629][_0xcfba('0x1a')]=undefined;}}}if(!_0x4585ec){setTimeout(this[_0xcfba('0x6')][_0xcfba('0x7')](this),0x3e8);}};function beepall(_0x564e0a,_0x5db29a,_0x17ec93,_0xc57ce){return new Beepall(_0x564e0a,_0x5db29a,_0x17ec93,_0xc57ce);}module[_0xcfba('0x1f')]=beepall;
\ No newline at end of file
index 6303355..fe72c07 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc8c5=['./rrmemory','./beepall','./agent','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc8c5,0x9f));var _0x5c8c=function(_0x1f951b,_0x654997){_0x1f951b=_0x1f951b-0x0;var _0x503af0=_0xc8c5[_0x1f951b];return _0x503af0;};'use strict';module[_0x5c8c('0x0')]={'rrmemory':require(_0x5c8c('0x1')),'beepall':require(_0x5c8c('0x2')),'agent':require(_0x5c8c('0x3'))};
\ No newline at end of file
+var _0x8657=['exports','./rrmemory'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0x8657,0x150));var _0x7865=function(_0x3b244e,_0x5eeb08){_0x3b244e=_0x3b244e-0x0;var _0x7831cd=_0x8657[_0x3b244e];return _0x7831cd;};'use strict';module[_0x7865('0x0')]={'rrmemory':require(_0x7865('0x1')),'beepall':require('./beepall'),'agent':require('./agent')};
\ No newline at end of file
index cd8ec5b..dbf198f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d14=['../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','bind','handleTimeout','module','timeout','drained','handleDrained','prototype','handleRun','handleCheckReject','isAgentAvailable','agents','channel','debug','agentId','done','mapAgentsId','[%s][QUEUE]\x20try\x20with\x20%s','isNil','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','busy','busyQueue','showNotification','writeLog','RINGING','intervals','[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s','[%s][QUEUE]\x20timeout\x20with\x20%s','exports','lodash','uuid'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x7d14,0x6d));var _0x47d1=function(_0x2e8bd9,_0x26d4d8){_0x2e8bd9=_0x2e8bd9-0x0;var _0x184eeb=_0x7d14[_0x2e8bd9];return _0x184eeb;};'use strict';var rr=require('rr');var _=require(_0x47d1('0x0'));var uuid=require(_0x47d1('0x1'));var util=require('./util');var logger=require(_0x47d1('0x2'))(_0x47d1('0x3'));var RRMemory=function(_0x21f244,_0x8645d1,_0x5723fc,_0x37d8f2){this[_0x47d1('0x4')]=uuid['v4']();this[_0x47d1('0x5')]=_0x21f244;this[_0x47d1('0x6')]=_0x8645d1;this[_0x47d1('0x7')]=_0x5723fc;this['routing']=_0x37d8f2;this['intervals']={};this['squeue'][_0x47d1('0x8')](this['handleRun'][_0x47d1('0x9')](this),this[_0x47d1('0xa')][_0x47d1('0x9')](this),this[_0x47d1('0xb')]);this[_0x47d1('0x5')]['on'](_0x47d1('0xc'),this[_0x47d1('0xa')][_0x47d1('0x9')](this));this[_0x47d1('0x5')]['on'](_0x47d1('0xd'),this[_0x47d1('0xe')][_0x47d1('0x9')](this));};RRMemory[_0x47d1('0xf')]['push']=function(){this[_0x47d1('0x5')][_0x47d1('0x8')](this[_0x47d1('0x10')][_0x47d1('0x9')](this),this[_0x47d1('0xa')][_0x47d1('0x9')](this));};RRMemory[_0x47d1('0xf')][_0x47d1('0xe')]=function(){this[_0x47d1('0xa')](!![]);};RRMemory[_0x47d1('0xf')][_0x47d1('0x11')]=function(_0x2ff94f){if(util[_0x47d1('0x12')](this[_0x47d1('0x5')]['id'],this[_0x47d1('0x7')][_0x47d1('0x13')][this['agentId']],this['squeue'][_0x47d1('0x14')],!![])){logger[_0x47d1('0x15')]('[%s][QUEUE]\x20available\x20again\x20%s',this[_0x47d1('0x5')]['id'],this['agentId']);clearInterval(this['intervals'][this[_0x47d1('0x16')]]);_0x2ff94f[_0x47d1('0x17')]();setTimeout(this[_0x47d1('0x8')][_0x47d1('0x9')](this),0x3e8);}};RRMemory['prototype'][_0x47d1('0x10')]=function(_0x58452c){this[_0x47d1('0x16')]=rr(this[_0x47d1('0x6')][_0x47d1('0x18')]);logger['debug'](_0x47d1('0x19'),this[_0x47d1('0x5')]['id'],this[_0x47d1('0x16')]);if(_[_0x47d1('0x1a')](this['realtime'][_0x47d1('0x13')][this[_0x47d1('0x16')]])){logger[_0x47d1('0x15')](_0x47d1('0x1b'),this['squeue']['id'],this[_0x47d1('0x16')]);_0x58452c[_0x47d1('0x17')]();setTimeout(this['push'][_0x47d1('0x9')](this),0x3e8);}else{if(util[_0x47d1('0x12')](this[_0x47d1('0x5')]['id'],this[_0x47d1('0x7')][_0x47d1('0x13')][this['agentId']],this[_0x47d1('0x5')]['channel'],!![])){this['realtime'][_0x47d1('0x13')][this[_0x47d1('0x16')]][_0x47d1('0x1c')]=!![];this[_0x47d1('0x7')][_0x47d1('0x13')][this[_0x47d1('0x16')]][_0x47d1('0x1d')]=this[_0x47d1('0x6')]['name'];util[_0x47d1('0x1e')](this['notificationId'],this[_0x47d1('0x5')]['id'],this[_0x47d1('0x7')][_0x47d1('0x13')][this[_0x47d1('0x16')]],this[_0x47d1('0x6')],this[_0x47d1('0x3')]);util[_0x47d1('0x1f')](this[_0x47d1('0x5')]['id'],this['realtime']['agents'][this[_0x47d1('0x16')]],_0x47d1('0x20'));this[_0x47d1('0x21')][this['agentId']]=setInterval(this[_0x47d1('0x11')][_0x47d1('0x9')](this,_0x58452c),0x3e8);}else{logger[_0x47d1('0x15')](_0x47d1('0x22'),this[_0x47d1('0x5')]['id'],this['agentId']);_0x58452c[_0x47d1('0x17')]();setTimeout(this[_0x47d1('0x8')][_0x47d1('0x9')](this),0x3e8);}}};RRMemory[_0x47d1('0xf')][_0x47d1('0xa')]=function(_0x14a726){logger[_0x47d1('0x15')](_0x47d1('0x23'),this[_0x47d1('0x5')]['id'],this[_0x47d1('0x16')]);if(_['isNil'](this['realtime']['agents'][this[_0x47d1('0x16')]])){logger[_0x47d1('0x15')](_0x47d1('0x1b'),this[_0x47d1('0x5')]['id'],this['agentId']);}else{clearInterval(this[_0x47d1('0x21')][this[_0x47d1('0x16')]]);util['hideNotification'](this[_0x47d1('0x4')],this['squeue']['id'],this[_0x47d1('0x7')][_0x47d1('0x13')][this['agentId']],this[_0x47d1('0x6')],this[_0x47d1('0x3')]);util[_0x47d1('0x1f')](this[_0x47d1('0x5')]['id'],this[_0x47d1('0x7')]['agents'][this[_0x47d1('0x16')]],'TIMEOUT');this[_0x47d1('0x7')][_0x47d1('0x13')][this[_0x47d1('0x16')]][_0x47d1('0x1c')]=![];this[_0x47d1('0x7')][_0x47d1('0x13')][this[_0x47d1('0x16')]][_0x47d1('0x1d')]=undefined;}if(!_0x14a726){setTimeout(this[_0x47d1('0x8')][_0x47d1('0x9')](this),0x3e8);}};function rrmemory(_0x36f1e4,_0x33543c,_0xd23fb5,_0x302786){return new RRMemory(_0x36f1e4,_0x33543c,_0xd23fb5,_0x302786);}module[_0x47d1('0x24')]=rrmemory;
\ No newline at end of file
+var _0x9962=['[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busy','busyQueue','RINGING','[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s','hideNotification','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','queue','realtime','intervals','squeue','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','handleCheckReject','isAgentAvailable','agents','agentId','debug','[%s][QUEUE]\x20available\x20again\x20%s','mapAgentsId','[%s][QUEUE]\x20try\x20with\x20%s','isNil'];(function(_0xe7341f,_0x16036b){var _0x40ea84=function(_0x49b220){while(--_0x49b220){_0xe7341f['push'](_0xe7341f['shift']());}};_0x40ea84(++_0x16036b);}(_0x9962,0xb8));var _0x2996=function(_0x10ada0,_0x527375){_0x10ada0=_0x10ada0-0x0;var _0x35f2ea=_0x9962[_0x10ada0];return _0x35f2ea;};'use strict';var rr=require('rr');var _=require(_0x2996('0x0'));var uuid=require('uuid');var util=require(_0x2996('0x1'));var logger=require(_0x2996('0x2'))(_0x2996('0x3'));var RRMemory=function(_0x5e1ca3,_0x2a9e9a,_0x58947a,_0x4221bb){this[_0x2996('0x4')]=uuid['v4']();this['squeue']=_0x5e1ca3;this[_0x2996('0x5')]=_0x2a9e9a;this[_0x2996('0x6')]=_0x58947a;this['routing']=_0x4221bb;this[_0x2996('0x7')]={};this[_0x2996('0x8')][_0x2996('0x9')](this[_0x2996('0xa')][_0x2996('0xb')](this),this['handleTimeout'][_0x2996('0xb')](this),this['module']);this[_0x2996('0x8')]['on'](_0x2996('0xc'),this[_0x2996('0xd')][_0x2996('0xb')](this));this['squeue']['on'](_0x2996('0xe'),this[_0x2996('0xf')][_0x2996('0xb')](this));};RRMemory[_0x2996('0x10')]['push']=function(){this[_0x2996('0x8')][_0x2996('0x9')](this[_0x2996('0xa')][_0x2996('0xb')](this),this['handleTimeout'][_0x2996('0xb')](this));};RRMemory['prototype'][_0x2996('0xf')]=function(){this[_0x2996('0xd')](!![]);};RRMemory['prototype'][_0x2996('0x11')]=function(_0x1a7cc4){if(util[_0x2996('0x12')](this[_0x2996('0x8')]['id'],this[_0x2996('0x6')][_0x2996('0x13')][this[_0x2996('0x14')]],this['squeue']['channel'],!![])){logger[_0x2996('0x15')](_0x2996('0x16'),this['squeue']['id'],this['agentId']);clearInterval(this[_0x2996('0x7')][this[_0x2996('0x14')]]);_0x1a7cc4['done']();setTimeout(this[_0x2996('0x9')][_0x2996('0xb')](this),0x3e8);}};RRMemory[_0x2996('0x10')][_0x2996('0xa')]=function(_0x289748){this[_0x2996('0x14')]=rr(this[_0x2996('0x5')][_0x2996('0x17')]);logger[_0x2996('0x15')](_0x2996('0x18'),this['squeue']['id'],this[_0x2996('0x14')]);if(_[_0x2996('0x19')](this[_0x2996('0x6')][_0x2996('0x13')][this[_0x2996('0x14')]])){logger['debug'](_0x2996('0x1a'),this[_0x2996('0x8')]['id'],this[_0x2996('0x14')]);_0x289748['done']();setTimeout(this[_0x2996('0x9')][_0x2996('0xb')](this),0x3e8);}else{if(util[_0x2996('0x12')](this['squeue']['id'],this[_0x2996('0x6')][_0x2996('0x13')][this[_0x2996('0x14')]],this['squeue'][_0x2996('0x1b')],!![])){this[_0x2996('0x6')]['agents'][this[_0x2996('0x14')]][_0x2996('0x1c')]=!![];this[_0x2996('0x6')][_0x2996('0x13')][this['agentId']][_0x2996('0x1d')]=this[_0x2996('0x5')]['name'];util['showNotification'](this[_0x2996('0x4')],this['squeue']['id'],this[_0x2996('0x6')][_0x2996('0x13')][this[_0x2996('0x14')]],this[_0x2996('0x5')],this['routing']);util['writeLog'](this[_0x2996('0x8')]['id'],this[_0x2996('0x6')][_0x2996('0x13')][this[_0x2996('0x14')]],_0x2996('0x1e'));this[_0x2996('0x7')][this[_0x2996('0x14')]]=setInterval(this[_0x2996('0x11')]['bind'](this,_0x289748),0x3e8);}else{logger[_0x2996('0x15')](_0x2996('0x1f'),this['squeue']['id'],this[_0x2996('0x14')]);_0x289748['done']();setTimeout(this[_0x2996('0x9')][_0x2996('0xb')](this),0x3e8);}}};RRMemory[_0x2996('0x10')]['handleTimeout']=function(_0x5b5b46){logger[_0x2996('0x15')]('[%s][QUEUE]\x20timeout\x20with\x20%s',this[_0x2996('0x8')]['id'],this[_0x2996('0x14')]);if(_['isNil'](this[_0x2996('0x6')][_0x2996('0x13')][this[_0x2996('0x14')]])){logger[_0x2996('0x15')](_0x2996('0x1a'),this[_0x2996('0x8')]['id'],this['agentId']);}else{clearInterval(this['intervals'][this[_0x2996('0x14')]]);util[_0x2996('0x20')](this[_0x2996('0x4')],this[_0x2996('0x8')]['id'],this[_0x2996('0x6')][_0x2996('0x13')][this['agentId']],this[_0x2996('0x5')],this[_0x2996('0x3')]);util['writeLog'](this['squeue']['id'],this[_0x2996('0x6')][_0x2996('0x13')][this['agentId']],_0x2996('0x21'));this[_0x2996('0x6')][_0x2996('0x13')][this[_0x2996('0x14')]][_0x2996('0x1c')]=![];this[_0x2996('0x6')][_0x2996('0x13')][this[_0x2996('0x14')]]['busyQueue']=undefined;}if(!_0x5b5b46){setTimeout(this[_0x2996('0x9')][_0x2996('0xb')](this),0x3e8);}};function rrmemory(_0x3c59bf,_0x4b11e3,_0x43a8fb,_0x4d825e){return new RRMemory(_0x3c59bf,_0x4b11e3,_0x43a8fb,_0x4d825e);}module[_0x2996('0x22')]=rrmemory;
\ No newline at end of file
index aadd8d5..bbd0a72 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdbf5=['notificationShake','body','queue','getMustacheRender','account','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','message','format','notification:%s','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','util','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','user:%s','name','emit','user:save','\x20interaction','notificationSound'];(function(_0x4948f6,_0x203cdd){var _0x387ac2=function(_0x5d0a59){while(--_0x5d0a59){_0x4948f6['push'](_0x4948f6['shift']());}};_0x387ac2(++_0x203cdd);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2ec4a,_0x359f49){_0x2ec4a=_0x2ec4a-0x0;var _0x10ff41=_0xdbf5[_0x2ec4a];return _0x10ff41;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var utils=require('../utils');var Redis=require('ioredis');var config=require(_0x5dbf('0x1'));var logger=require(_0x5dbf('0x2'))(_0x5dbf('0x3'));config[_0x5dbf('0x4')]=_[_0x5dbf('0x5')](config[_0x5dbf('0x4')],{'host':_0x5dbf('0x6'),'port':0x18eb});var io=require(_0x5dbf('0x7'))(new Redis(config[_0x5dbf('0x4')]));function sendNotification(_0x3f8222,_0x209b7d,_0x88128e,_0x93e657,_0x52b039,_0x134810){io['to'](util['format'](_0x5dbf('0x8'),_0x93e657[_0x5dbf('0x9')]))[_0x5dbf('0xa')](_0x5dbf('0xb'),_0x93e657);var _0x4efed3=_0x134810||{};var _0xe3ddb7=_0x88128e['split']('.');var _0x5433f4={'uniqueid':_0x209b7d,'channel':_0xe3ddb7[0x0],'id':_0xe3ddb7[0x1],'title':_0xe3ddb7[0x0]+_0x5dbf('0xc'),'interactionId':_0xe3ddb7[0x2],'queue':_0x52b039?_0x52b039['name']:null,'sound':_0x4efed3['account'][_0x5dbf('0xd')],'shake':_0x4efed3['account'][_0x5dbf('0xe')]};try{if(!_0x4efed3[_0x5dbf('0xf')]){_0x4efed3[_0x5dbf('0xf')]={};}if(_0x52b039){_0x4efed3[_0x5dbf('0xf')][_0x5dbf('0x10')]=_0x52b039;}else if(_0x4efed3['body']['queue']){delete _0x4efed3[_0x5dbf('0xf')][_0x5dbf('0x10')];}_0x5433f4['msg']=utils[_0x5dbf('0x11')](_0x4efed3[_0x5dbf('0x12')][_0x5dbf('0x13')],_0x4efed3);}catch(_0x2dfa44){_0x5433f4[_0x5dbf('0x14')]=_0x5dbf('0x15');logger[_0x5dbf('0x16')](util['format']('[%s][QUEUE]\x20%s',_0x209b7d,_0x2dfa44[_0x5dbf('0x17')]));}io['to'](util[_0x5dbf('0x18')](_0x5dbf('0x8'),_0x93e657[_0x5dbf('0x9')]))[_0x5dbf('0xa')](util['format'](_0x5dbf('0x19'),_0x3f8222?'save':'remove'),_0x5433f4);}function writeLog(_0x577ca2,_0x23d1e7,_0x3cedac){return logger[_0x5dbf('0x1a')](util[_0x5dbf('0x18')](_0x5dbf('0x1b'),_0x577ca2,_0x23d1e7['name'],_0x3cedac));}exports[_0x5dbf('0x1c')]=function(_0x58e9ac,_0xb68f92,_0x11cc67,_0x14d133){if(_0xb68f92[_0x5dbf('0x1d')]){writeLog(_0x58e9ac,_0xb68f92,_0x5dbf('0x1e'));return![];}if(!_0xb68f92[_0x5dbf('0x1f')]){writeLog(_0x58e9ac,_0xb68f92,'OFFLINE');return![];}if(_0xb68f92[_0x11cc67+_0x5dbf('0x20')]){writeLog(_0x58e9ac,_0xb68f92,_0x5dbf('0x21'));return![];}if(_0x14d133&&_0xb68f92[_0x5dbf('0x22')](_0x11cc67+_0x5dbf('0x23'))&&_0xb68f92[_0x5dbf('0x22')](_0x11cc67+_0x5dbf('0x24'))){if(_0xb68f92[_0x11cc67+_0x5dbf('0x23')]>0x0&&_0xb68f92[_0x11cc67+_0x5dbf('0x24')]>=_0xb68f92[_0x11cc67+_0x5dbf('0x23')]){writeLog(_0x58e9ac,_0xb68f92,_0x11cc67[_0x5dbf('0x25')]()+_0x5dbf('0x26'));return![];}}return!![];};exports[_0x5dbf('0x27')]=function(_0x3f9e60,_0x407741,_0x729d8f,_0x17f135,_0x466985){return sendNotification(!![],_0x3f9e60,_0x407741,_0x729d8f,_0x17f135,_0x466985);};exports[_0x5dbf('0x28')]=function(_0x159e61,_0x22ec42,_0x6a9757,_0x471027,_0x21cd00){return sendNotification(![],_0x159e61,_0x22ec42,_0x6a9757,_0x471027,_0x21cd00);};exports['writeLog']=writeLog;
\ No newline at end of file
+var _0x3eea=['PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','lodash','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','name','user:save','\x20interaction','notificationSound','account','notificationShake','body','queue','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','user:%s','emit','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE','Pause'];(function(_0x208970,_0x657852){var _0x1b7d7e=function(_0x30f64f){while(--_0x30f64f){_0x208970['push'](_0x208970['shift']());}};_0x1b7d7e(++_0x657852);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x3551e9,_0x12dee0){_0x3551e9=_0x3551e9-0x0;var _0x5419da=_0x3eea[_0x3551e9];return _0x5419da;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var utils=require(_0xa3ee('0x1'));var Redis=require(_0xa3ee('0x2'));var config=require(_0xa3ee('0x3'));var logger=require(_0xa3ee('0x4'))(_0xa3ee('0x5'));config[_0xa3ee('0x6')]=_[_0xa3ee('0x7')](config[_0xa3ee('0x6')],{'host':_0xa3ee('0x8'),'port':0x18eb});var io=require(_0xa3ee('0x9'))(new Redis(config[_0xa3ee('0x6')]));function sendNotification(_0x5776bb,_0x538bf9,_0x4183ee,_0x4e4588,_0x37a3f0,_0x56f37b){io['to'](util[_0xa3ee('0xa')]('user:%s',_0x4e4588[_0xa3ee('0xb')]))['emit'](_0xa3ee('0xc'),_0x4e4588);var _0x1a3ab0=_0x56f37b||{};var _0x188966=_0x4183ee['split']('.');var _0x3e5ac2={'uniqueid':_0x538bf9,'channel':_0x188966[0x0],'id':_0x188966[0x1],'title':_0x188966[0x0]+_0xa3ee('0xd'),'interactionId':_0x188966[0x2],'queue':_0x37a3f0?_0x37a3f0['name']:null,'sound':_0x1a3ab0['account'][_0xa3ee('0xe')],'shake':_0x1a3ab0[_0xa3ee('0xf')][_0xa3ee('0x10')]};try{if(!_0x1a3ab0[_0xa3ee('0x11')]){_0x1a3ab0['body']={};}if(_0x37a3f0){_0x1a3ab0[_0xa3ee('0x11')]['queue']=_0x37a3f0;}else if(_0x1a3ab0[_0xa3ee('0x11')][_0xa3ee('0x12')]){delete _0x1a3ab0[_0xa3ee('0x11')][_0xa3ee('0x12')];}_0x3e5ac2['msg']=utils[_0xa3ee('0x13')](_0x1a3ab0[_0xa3ee('0xf')]['notificationTemplate'],_0x1a3ab0);}catch(_0x5358aa){_0x3e5ac2['msg']=_0xa3ee('0x14');logger[_0xa3ee('0x15')](util[_0xa3ee('0xa')](_0xa3ee('0x16'),_0x538bf9,_0x5358aa['message']));}io['to'](util[_0xa3ee('0xa')](_0xa3ee('0x17'),_0x4e4588[_0xa3ee('0xb')]))[_0xa3ee('0x18')](util[_0xa3ee('0xa')]('notification:%s',_0x5776bb?_0xa3ee('0x19'):_0xa3ee('0x1a')),_0x3e5ac2);}function writeLog(_0x35fbb2,_0xad8187,_0x216b7d){return logger[_0xa3ee('0x1b')](util['format'](_0xa3ee('0x1c'),_0x35fbb2,_0xad8187[_0xa3ee('0xb')],_0x216b7d));}exports['isAgentAvailable']=function(_0x3a7cd3,_0x4e7f32,_0x2fab5,_0x29df43){if(_0x4e7f32[_0xa3ee('0x1d')]){writeLog(_0x3a7cd3,_0x4e7f32,_0xa3ee('0x1e'));return![];}if(!_0x4e7f32[_0xa3ee('0x1f')]){writeLog(_0x3a7cd3,_0x4e7f32,_0xa3ee('0x20'));return![];}if(_0x4e7f32[_0x2fab5+_0xa3ee('0x21')]){writeLog(_0x3a7cd3,_0x4e7f32,_0xa3ee('0x22'));return![];}if(_0x29df43&&_0x4e7f32[_0xa3ee('0x23')](_0x2fab5+_0xa3ee('0x24'))&&_0x4e7f32['hasOwnProperty'](_0x2fab5+_0xa3ee('0x25'))){if(_0x4e7f32[_0x2fab5+_0xa3ee('0x24')]>0x0&&_0x4e7f32[_0x2fab5+_0xa3ee('0x25')]>=_0x4e7f32[_0x2fab5+_0xa3ee('0x24')]){writeLog(_0x3a7cd3,_0x4e7f32,_0x2fab5[_0xa3ee('0x26')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xa3ee('0x27')]=function(_0x1b766e,_0x146493,_0xd9a7f8,_0x42e97c,_0xa9e4d6){return sendNotification(!![],_0x1b766e,_0x146493,_0xd9a7f8,_0x42e97c,_0xa9e4d6);};exports[_0xa3ee('0x28')]=function(_0x30b12b,_0xea54fe,_0x298cb4,_0x59c6f9,_0x5ba571){return sendNotification(![],_0x30b12b,_0xea54fe,_0x298cb4,_0x59c6f9,_0x5ba571);};exports['writeLog']=writeLog;
\ No newline at end of file
index eb4d032..c43db65 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0137=['getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','error','isObject','stringify','validate','lodash','./utils','../../../../config/logger','routing','string','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x4a9765,_0x132c30){var _0x1484fa=function(_0x851ce9){while(--_0x851ce9){_0x4a9765['push'](_0x4a9765['shift']());}};_0x1484fa(++_0x132c30);}(_0x0137,0xa4));var _0x7013=function(_0x4bf0bc,_0x2c6490){_0x4bf0bc=_0x4bf0bc-0x0;var _0x223837=_0x0137[_0x4bf0bc];return _0x223837;};'use strict';var schema=require(_0x7013('0x0'));var sh=require('shelljs');var _=require(_0x7013('0x1'));var utils=require(_0x7013('0x2'));var logger=require(_0x7013('0x3'))(_0x7013('0x4'));var system=schema({'command':{'type':_0x7013('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x232446,_0x379a2d){return function(_0xc5ad00){try{var _0x3e2683={'command':_0x379a2d[0x0]};var _0x49568=system['validate'](_0x3e2683,{'typecast':!![]});if(_0x49568['length']){logger['error'](_0x7013('0x6'),_0x232446,_[_0x7013('0x7')](_0x49568,_0x7013('0x8'))['join'](',\x20'));logger[_0x7013('0x9')](_0x7013('0xa'),_0x232446);_0xc5ad00['next']();}else{var _0x261625=this;var _0x1b42e2=utils[_0x7013('0xb')](_0x379a2d[0x0],this);logger[_0x7013('0x9')](_0x7013('0xc'),_0x232446,_0x1b42e2);sh[_0x7013('0xd')](_[_0x7013('0xe')](_0x1b42e2),function(_0x53656f,_0x3c54b2){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x232446,_0x53656f);if(_0x53656f==0x0){var _0x27fde5=_0x3c54b2[_0x7013('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0x7013('0x10')](_0x379a2d[0x1])||_[_0x7013('0x11')](_0x379a2d[0x1])){logger[_0x7013('0x9')](_0x7013('0x12'),_0x232446);_0x261625[_0x7013('0x13')][_0x379a2d[0x1]]=_0x27fde5;}else{logger['info'](_0x7013('0x14'),_0x232446,_0x379a2d[0x1],_0x27fde5);_0x261625[_0x7013('0x13')][_0x379a2d[0x1]]=_0x27fde5;}}_0xc5ad00[_0x7013('0x15')]();});}}catch(_0x435743){logger[_0x7013('0x16')](_0x7013('0x6'),_0x232446,_[_0x7013('0x17')](_0x435743)?JSON[_0x7013('0x18')](_0x435743):_0x435743);logger['info'](_0x7013('0xa'),_0x232446);_0xc5ad00['next']();}};};
\ No newline at end of file
+var _0x5383=['[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','validate','shelljs','lodash','./utils','routing','string','consequence','length','error','[%s][SYSTEM]\x20%s','message','join','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim'];(function(_0x2569d,_0x4a391c){var _0x42be96=function(_0x255a03){while(--_0x255a03){_0x2569d['push'](_0x2569d['shift']());}};_0x42be96(++_0x4a391c);}(_0x5383,0x85));var _0x3538=function(_0xe12668,_0xb7999){_0xe12668=_0xe12668-0x0;var _0x8403b=_0x5383[_0xe12668];return _0x8403b;};'use strict';var schema=require(_0x3538('0x0'));var sh=require(_0x3538('0x1'));var _=require(_0x3538('0x2'));var utils=require(_0x3538('0x3'));var logger=require('../../../../config/logger')(_0x3538('0x4'));var system=schema({'command':{'type':_0x3538('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x3538('0x6')]=function(_0x5b9c7e,_0x4f6120){return function(_0x5fe854){try{var _0x4c8352={'command':_0x4f6120[0x0]};var _0x446bd6=system[_0x3538('0x0')](_0x4c8352,{'typecast':!![]});if(_0x446bd6[_0x3538('0x7')]){logger[_0x3538('0x8')](_0x3538('0x9'),_0x5b9c7e,_['map'](_0x446bd6,_0x3538('0xa'))[_0x3538('0xb')](',\x20'));logger[_0x3538('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5b9c7e);_0x5fe854['next']();}else{var _0x54abcc=this;var _0x566cb4=utils[_0x3538('0xd')](_0x4f6120[0x0],this);logger['info'](_0x3538('0xe'),_0x5b9c7e,_0x566cb4);sh[_0x3538('0xf')](_[_0x3538('0x10')](_0x566cb4),function(_0x5329bb,_0x4e1910){logger['info'](_0x3538('0x11'),_0x5b9c7e,_0x5329bb);if(_0x5329bb==0x0){var _0x488a7f=_0x4e1910['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x3538('0x12')](_0x4f6120[0x1])||_[_0x3538('0x13')](_0x4f6120[0x1])){logger[_0x3538('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x5b9c7e);_0x54abcc[_0x3538('0x14')][_0x4f6120[0x1]]=_0x488a7f;}else{logger[_0x3538('0xc')](_0x3538('0x15'),_0x5b9c7e,_0x4f6120[0x1],_0x488a7f);_0x54abcc[_0x3538('0x14')][_0x4f6120[0x1]]=_0x488a7f;}}_0x5fe854['next']();});}}catch(_0x13e7c1){logger['error'](_0x3538('0x9'),_0x5b9c7e,_['isObject'](_0x13e7c1)?JSON[_0x3538('0x16')](_0x13e7c1):_0x13e7c1);logger[_0x3538('0xc')](_0x3538('0x17'),_0x5b9c7e);_0x5fe854[_0x3538('0x18')]();}};};
\ No newline at end of file
index 1849b23..94d6044 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1e09=['finally','isObject','validate','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','join','info','next','channel','Interaction','addTags','interaction','then','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x2164c2,_0x42cee5){var _0x24e7db=function(_0x356c86){while(--_0x356c86){_0x2164c2['push'](_0x2164c2['shift']());}};_0x24e7db(++_0x42cee5);}(_0x1e09,0x13a));var _0x91e0=function(_0x54a524,_0x1b8282){_0x54a524=_0x54a524-0x0;var _0x11c524=_0x1e09[_0x54a524];return _0x11c524;};'use strict';var schema=require(_0x91e0('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x91e0('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x91e0('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x91e0('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x91e0('0x4'),'required':!![],'message':_0x91e0('0x5')}});exports[_0x91e0('0x6')]=function(_0x461a78,_0xf9201b,_0x3033d3,_0x85aa41){return function(_0x279b69){try{var _0x89f057={'tag':_0xf9201b[0x0]};var _0x30b41f=tag['validate'](_0x89f057,{'typecast':!![]});if(_0x30b41f['length']){logger[_0x91e0('0x7')](_0x91e0('0x8'),_0x461a78,_[_0x91e0('0x9')](_0x30b41f,_0x91e0('0xa'))[_0x91e0('0xb')](',\x20'));logger[_0x91e0('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x461a78);_0x279b69[_0x91e0('0xd')]();}else{var _0x3cc775={'ids':[_0xf9201b[0x0]]};if(rpc[_0x85aa41[_0x91e0('0xe')]+'Interaction']){rpc[_0x85aa41[_0x91e0('0xe')]+_0x91e0('0xf')][_0x91e0('0x10')](_0x85aa41[_0x91e0('0x11')]['id'],_0x3cc775)[_0x91e0('0x12')](function(_0x5047dd){logger[_0x91e0('0xc')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x461a78,_0xf9201b[0x1],_0x85aa41[_0x91e0('0xe')],_0x85aa41[_0x91e0('0x11')]['id']);})[_0x91e0('0x13')](function(_0x272060){logger[_0x91e0('0x7')](_0x91e0('0x8'),_0x461a78,JSON[_0x91e0('0x14')](_0x272060));logger['info'](_0x91e0('0x15'),_0x461a78);})[_0x91e0('0x16')](function(){_0x279b69[_0x91e0('0xd')]();});}}}catch(_0x331913){logger[_0x91e0('0x7')](_0x91e0('0x8'),_0x461a78,_[_0x91e0('0x17')](_0x331913)?JSON[_0x91e0('0x14')](_0x331913):_0x331913);logger[_0x91e0('0xc')](_0x91e0('0x15'),_0x461a78);_0x279b69[_0x91e0('0xd')]();}};};
\ No newline at end of file
+var _0x45b0=['message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','info','catch','stringify','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','length','error','[%s][TAG]\x20%s','map'];(function(_0x3cabe1,_0x17adcd){var _0x2faaa1=function(_0x25c0e3){while(--_0x25c0e3){_0x3cabe1['push'](_0x3cabe1['shift']());}};_0x2faaa1(++_0x17adcd);}(_0x45b0,0x136));var _0x045b=function(_0x576b1b,_0x5eab79){_0x576b1b=_0x576b1b-0x0;var _0xd44b08=_0x45b0[_0x576b1b];return _0xd44b08;};'use strict';var schema=require(_0x045b('0x0'));var _=require(_0x045b('0x1'));var rpc={'chatInteraction':require(_0x045b('0x2')),'openchannelInteraction':require(_0x045b('0x3')),'smsInteraction':require(_0x045b('0x4')),'mailInteraction':require(_0x045b('0x5')),'faxInteraction':require(_0x045b('0x6')),'whatsappInteraction':require(_0x045b('0x7'))};var logger=require('../../../../config/logger')(_0x045b('0x8'));var tag=schema({'tag':{'type':_0x045b('0x9'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x1e28e7,_0x5033c8,_0x4ea392,_0x40e89f){return function(_0x456611){try{var _0x450c0d={'tag':_0x5033c8[0x0]};var _0xd7ed77=tag['validate'](_0x450c0d,{'typecast':!![]});if(_0xd7ed77[_0x045b('0xa')]){logger[_0x045b('0xb')](_0x045b('0xc'),_0x1e28e7,_[_0x045b('0xd')](_0xd7ed77,_0x045b('0xe'))[_0x045b('0xf')](',\x20'));logger['info'](_0x045b('0x10'),_0x1e28e7);_0x456611[_0x045b('0x11')]();}else{var _0x5df04f={'ids':[_0x5033c8[0x0]]};if(rpc[_0x40e89f[_0x045b('0x12')]+'Interaction']){rpc[_0x40e89f[_0x045b('0x12')]+_0x045b('0x13')][_0x045b('0x14')](_0x40e89f[_0x045b('0x15')]['id'],_0x5df04f)[_0x045b('0x16')](function(_0x2c6cf9){logger[_0x045b('0x17')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x1e28e7,_0x5033c8[0x1],_0x40e89f['channel'],_0x40e89f[_0x045b('0x15')]['id']);})[_0x045b('0x18')](function(_0x13432c){logger[_0x045b('0xb')](_0x045b('0xc'),_0x1e28e7,JSON[_0x045b('0x19')](_0x13432c));logger[_0x045b('0x17')](_0x045b('0x10'),_0x1e28e7);})[_0x045b('0x1a')](function(){_0x456611[_0x045b('0x11')]();});}}}catch(_0x531404){logger['error'](_0x045b('0xc'),_0x1e28e7,_['isObject'](_0x531404)?JSON[_0x045b('0x19')](_0x531404):_0x531404);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1e28e7);_0x456611[_0x045b('0x11')]();}};};
\ No newline at end of file
index cd83596..a1d7bda 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c14=['params','stringify','POST','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','method','login'];(function(_0x46ec3e,_0x57bb9c){var _0x33beda=function(_0x302e33){while(--_0x302e33){_0x46ec3e['push'](_0x46ec3e['shift']());}};_0x33beda(++_0x57bb9c);}(_0x1c14,0x7d));var _0x41c1=function(_0x31eae7,_0x5d53ac){_0x31eae7=_0x31eae7-0x0;var _0x5833c6=_0x1c14[_0x31eae7];return _0x5833c6;};'use strict';var rp=require(_0x41c1('0x0'));var logger=require(_0x41c1('0x1'))(_0x41c1('0x2'));var _=require(_0x41c1('0x3'));var arr=[];exports[_0x41c1('0x4')]=function(_0x470f09,_0x2ea6c3){return function(_0x2d5802){var _0x72db03=_0x2ea6c3[0xa];var _0x38c985=_0x2ea6c3[0xb];var _0x161c7b=_0x2ea6c3[0xc];var _0x3e4895=_0x2ea6c3[0xd];var _0x116e34=_0x2ea6c3[0xe];var _0x4c7a95=_0x2ea6c3[0xf][_0x41c1('0x5')](/\n/g,_0x41c1('0x6'));var _0x1953f2=_0x2ea6c3[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x41c1('0x7')](_0x38c985)){arr[_0x41c1('0x8')](_0x38c985);var _0xb23a17=_0x2ea6c3[0x3];var _0x4b65b3=_0x2ea6c3[0x4];var _0x15b84d=_0x2ea6c3[0x1];var _0x1f807c=_0x2ea6c3[0x0];var _0x293d22={};_0x293d22[_0x41c1('0x9')]=_0x2ea6c3[0x8]+_0x41c1('0xa')+_0x161c7b+'|'+_0x72db03+'|'+_0x3e4895+'|'+_0x38c985+'|'+_0x116e34;_0x293d22[_0x41c1('0xb')]=_0x2ea6c3[0x7]+_0x41c1('0xa')+_0x161c7b+'|'+_0x72db03+'|'+_0x3e4895+'|'+_0x38c985+'|'+_0x116e34+'|'+_0x4c7a95+'|'+_0x1953f2;_0x293d22[_0x41c1('0xc')]=_0x2ea6c3[0x9];var _0x476113={};_0x476113['jsonrpc']='2.0';_0x476113[_0x41c1('0xd')]=_0x41c1('0xe');var _0x20f139=[];_0x20f139['push'](_0x2ea6c3[0x2]);_0x20f139[_0x41c1('0x8')](_0x2ea6c3[0x5]);_0x20f139['push'](_0x2ea6c3[0x6]);_0x476113[_0x41c1('0xf')]=_0x20f139;_0x476113['id']=0x1;var _0x4004f4=JSON[_0x41c1('0x10')](_0x476113);var _0x48ae14={'encoding':'utf8','method':_0x41c1('0x11'),'timeout':0x2710,'url':_0xb23a17,'headers':{'Content-Type':_0x41c1('0x12')},'body':_0x4004f4};return rp(_0x48ae14)[_0x41c1('0x13')](function(_0x310df3){const _0x4b3c1f=JSON[_0x41c1('0x14')](_0x310df3);if(!_0x4b3c1f['result'][_0x41c1('0x15')]){throw new Error(_0x41c1('0x16'));}var _0x1eb589=_0x38c985;var _0x188771=_0x41c1('0x17')+_0x15b84d+_0x41c1('0x18')+_0x1f807c+_0x41c1('0x19')+_0x1eb589+_0x41c1('0x1a')+JSON[_0x41c1('0x10')](_0x293d22);var _0x5d911a=_0x4b65b3+'?'+_0x188771;return rp(_0x5d911a);})[_0x41c1('0x13')](function(_0x581078){logger[_0x41c1('0x1b')](_0x41c1('0x1c'),_0x470f09,_0x581078);_0x2d5802[_0x41c1('0x1d')]();})[_0x41c1('0x1e')](function(_0x5a315a){logger[_0x41c1('0x1f')]('[%s][TVOX]\x20%s',_0x470f09,_[_0x41c1('0x20')](_0x5a315a)?JSON[_0x41c1('0x10')](_0x5a315a):_0x5a315a);_0x2d5802[_0x41c1('0x1d')]();});}else{logger[_0x41c1('0x1b')](_0x41c1('0x21'),_0x470f09);_0x2d5802[_0x41c1('0x22')]();}};};
\ No newline at end of file
+var _0x7a60=['push','params','stringify','utf8','POST','parse','result','logged','channelId=','&serviceId=','&sessionId=','&data=','then','info','stop','catch','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method'];(function(_0x17f9f4,_0x212dda){var _0x4dc32c=function(_0x1ed46d){while(--_0x1ed46d){_0x17f9f4['push'](_0x17f9f4['shift']());}};_0x4dc32c(++_0x212dda);}(_0x7a60,0x189));var _0x07a6=function(_0x385d22,_0xe28a3a){_0x385d22=_0x385d22-0x0;var _0x4c6a94=_0x7a60[_0x385d22];return _0x4c6a94;};'use strict';var rp=require(_0x07a6('0x0'));var logger=require(_0x07a6('0x1'))(_0x07a6('0x2'));var _=require(_0x07a6('0x3'));var arr=[];exports[_0x07a6('0x4')]=function(_0x5c8f36,_0xadde8d){return function(_0x5b1dd1){var _0x319923=_0xadde8d[0xa];var _0x4bf533=_0xadde8d[0xb];var _0x564d4d=_0xadde8d[0xc];var _0x5104be=_0xadde8d[0xd];var _0x3394a8=_0xadde8d[0xe];var _0x350618=_0xadde8d[0xf][_0x07a6('0x5')](/\n/g,_0x07a6('0x6'));var _0x18a469=_0xadde8d[0x10][_0x07a6('0x5')](/\n/g,'\x20');if(!arr[_0x07a6('0x7')](_0x4bf533)){arr['push'](_0x4bf533);var _0x325a93=_0xadde8d[0x3];var _0x2fc4f8=_0xadde8d[0x4];var _0x24497a=_0xadde8d[0x1];var _0x3cd612=_0xadde8d[0x0];var _0x1e5098={};_0x1e5098[_0x07a6('0x8')]=_0xadde8d[0x8]+_0x07a6('0x9')+_0x564d4d+'|'+_0x319923+'|'+_0x5104be+'|'+_0x4bf533+'|'+_0x3394a8;_0x1e5098[_0x07a6('0xa')]=_0xadde8d[0x7]+_0x07a6('0x9')+_0x564d4d+'|'+_0x319923+'|'+_0x5104be+'|'+_0x4bf533+'|'+_0x3394a8+'|'+_0x350618+'|'+_0x18a469;_0x1e5098[_0x07a6('0xb')]=_0xadde8d[0x9];var _0x2de456={};_0x2de456[_0x07a6('0xc')]=_0x07a6('0xd');_0x2de456[_0x07a6('0xe')]='login';var _0x4f88bc=[];_0x4f88bc['push'](_0xadde8d[0x2]);_0x4f88bc['push'](_0xadde8d[0x5]);_0x4f88bc[_0x07a6('0xf')](_0xadde8d[0x6]);_0x2de456[_0x07a6('0x10')]=_0x4f88bc;_0x2de456['id']=0x1;var _0x25fae6=JSON[_0x07a6('0x11')](_0x2de456);var _0x4f5c29={'encoding':_0x07a6('0x12'),'method':_0x07a6('0x13'),'timeout':0x2710,'url':_0x325a93,'headers':{'Content-Type':'application/json-rpc'},'body':_0x25fae6};return rp(_0x4f5c29)['then'](function(_0x4d79af){const _0x44c9cc=JSON[_0x07a6('0x14')](_0x4d79af);if(!_0x44c9cc[_0x07a6('0x15')][_0x07a6('0x16')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x78a02=_0x4bf533;var _0x108721=_0x07a6('0x17')+_0x24497a+_0x07a6('0x18')+_0x3cd612+_0x07a6('0x19')+_0x78a02+_0x07a6('0x1a')+JSON['stringify'](_0x1e5098);var _0x48d491=_0x2fc4f8+'?'+_0x108721;return rp(_0x48d491);})[_0x07a6('0x1b')](function(_0x20c5b1){logger[_0x07a6('0x1c')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x5c8f36,_0x20c5b1);_0x5b1dd1[_0x07a6('0x1d')]();})[_0x07a6('0x1e')](function(_0x5c212f){logger[_0x07a6('0x1f')]('[%s][TVOX]\x20%s',_0x5c8f36,_[_0x07a6('0x20')](_0x5c212f)?JSON[_0x07a6('0x11')](_0x5c212f):_0x5c212f);_0x5b1dd1[_0x07a6('0x1d')]();});}else{logger['info'](_0x07a6('0x21'),_0x5c8f36);_0x5b1dd1['next']();}};};
\ No newline at end of file
index b6d3ebb..b82b622 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x882cf2,_0x434f39){var _0x265b3a=function(_0x3b0794){while(--_0x3b0794){_0x882cf2['push'](_0x882cf2['shift']());}};_0x265b3a(++_0x434f39);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}};
\ No newline at end of file
+var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x54640c,_0x30144b){var _0x9a462a=function(_0x21abdb){while(--_0x21abdb){_0x54640c['push'](_0x54640c['shift']());}};_0x9a462a(++_0x30144b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}};
\ No newline at end of file
index 2a50319..92f3792 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7980=['autoreply','appdata','split','mail','push','slice','length','dialogflowv2','amazonlex','tag','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','./interval','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agents','agent','busy','busyQueue','message','emit','end','QueueReport','update','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','map','interval','listen','rules','channel','interaction','applications','isArray','existsSync','join','app','.js'];(function(_0x432213,_0xa252f3){var _0x404ba5=function(_0x1b7b80){while(--_0x1b7b80){_0x432213['push'](_0x432213['shift']());}};_0x404ba5(++_0xa252f3);}(_0x7980,0xab));var _0x0798=function(_0x262dc3,_0x3b4b50){_0x262dc3=_0x262dc3-0x0;var _0x5701fc=_0x7980[_0x262dc3];return _0x5701fc;};'use strict';var _=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var path=require(_0x0798('0x2'));var fs=require('fs');var jayson=require(_0x0798('0x3'));var BPromise=require(_0x0798('0x4'));var utils=require('./applications/utils');var logger=require(_0x0798('0x5'))(_0x0798('0x6'));var rpc={'openchannelQueueReport':require(_0x0798('0x7')),'mailQueueReport':require(_0x0798('0x8')),'chatQueueReport':require(_0x0798('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x0798('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x0798('0xb'));function getId(_0x34f808,_0x467859,_0x54da10){return util['format'](_0x0798('0xc'),_0x34f808,_0x467859||0x0,_0x54da10||0x0);}function getIntervals(_0x3a04e1,_0x301a55){var _0x1601f2=[];if(!_[_0x0798('0xd')](_0x301a55[_0x0798('0xe')])&&!_[_0x0798('0xd')](_0x3a04e1[_0x301a55[_0x0798('0xe')]])&&!_[_0x0798('0xd')](_0x3a04e1[_0x301a55[_0x0798('0xe')]]['Intervals'])){_0x1601f2=_[_0x0798('0xf')](_0x3a04e1[_0x301a55[_0x0798('0xe')]]['Intervals'],'interval');}else if(!_[_0x0798('0xd')](_0x301a55[_0x0798('0x10')])){_0x1601f2=[_0x301a55[_0x0798('0x10')]];}return _0x1601f2;}exports[_0x0798('0x11')]=function(_0x36dd52){_0x36dd52[_0x0798('0x12')]={};return new BPromise(function(_0xfd88af,_0x5f1640){var _0x486bcf={'Start':function(_0x62452c){var _0x112362=this;return new Promise(function(_0x47be56,_0x555c45){if(_0x62452c){try{var _0x21c30b=[];var _0x45cae6=getId(_0x62452c[_0x0798('0x13')],_0x62452c['message']?_0x62452c['message']['id']:0x0,_0x62452c[_0x0798('0x14')]?_0x62452c['interaction']['id']:0x0);if(_0x62452c[_0x0798('0x15')]&&_[_0x0798('0x16')](_0x62452c[_0x0798('0x15')])&&_0x62452c[_0x0798('0x15')]['length']){for(var _0x487fb3=0x0;_0x487fb3<_0x62452c[_0x0798('0x15')]['length'];_0x487fb3+=0x1){var _0xd2a2a=_0x62452c[_0x0798('0x15')][_0x487fb3];if(fs[_0x0798('0x17')](path[_0x0798('0x18')](__dirname,_0x0798('0x15'),_0xd2a2a[_0x0798('0x19')]+_0x0798('0x1a')))){var _0x212ad5=[];switch(_0xd2a2a[_0x0798('0x19')]['toLowerCase']()){case _0x0798('0x1b'):var _0x35c141=_0xd2a2a[_0x0798('0x1c')][_0x0798('0x1d')](',');if(_0x62452c[_0x0798('0x13')]===_0x0798('0x1e')){_0x212ad5['push'](_0x35c141[0x0]);_0x212ad5[_0x0798('0x1f')](_0x35c141[0x1]);_0x212ad5[_0x0798('0x1f')](_0x35c141[_0x0798('0x20')](0x2,_0x35c141[_0x0798('0x21')])[_0x0798('0x18')](','));}else{_0x212ad5[_0x0798('0x1f')](_0x35c141[0x0]);_0x212ad5['push'](_0x35c141[_0x0798('0x20')](0x1,_0x35c141[_0x0798('0x21')])[_0x0798('0x18')](','));}break;case'dialogflow':var _0x4bc3f3=_0xd2a2a['appdata']['split'](',');_0x212ad5[_0x0798('0x1f')](_0x4bc3f3[0x0]);_0x212ad5[_0x0798('0x1f')](_0x4bc3f3[0x1]);_0x212ad5[_0x0798('0x1f')](_0x4bc3f3[_0x0798('0x20')](0x2,_0x4bc3f3[_0x0798('0x21')])[_0x0798('0x18')](','));break;case _0x0798('0x22'):var _0x23e770=_0xd2a2a['appdata'][_0x0798('0x1d')](',');_0x212ad5['push'](_0x23e770[0x0]);_0x212ad5['push'](_0x23e770[0x1]);_0x212ad5[_0x0798('0x1f')](_0x23e770[0x2]);_0x212ad5['push'](_0x23e770[0x3]);_0x212ad5[_0x0798('0x1f')](_0x23e770['slice'](0x4,_0x23e770[_0x0798('0x21')])[_0x0798('0x18')](','));break;case _0x0798('0x23'):var _0x29ca18=_0xd2a2a[_0x0798('0x1c')][_0x0798('0x1d')](',');_0x212ad5[_0x0798('0x1f')](_0x29ca18[0x0]);_0x212ad5[_0x0798('0x1f')](_0x29ca18[0x1]);_0x212ad5[_0x0798('0x1f')](_0x29ca18[0x2]);_0x212ad5[_0x0798('0x1f')](_0x29ca18[0x3]);_0x212ad5[_0x0798('0x1f')](_0x29ca18[_0x0798('0x20')](0x4,_0x29ca18['length'])[_0x0798('0x18')](','));break;case'message':_0x212ad5['push'](_0xd2a2a[_0x0798('0x1c')]);break;case _0x0798('0x24'):_0x212ad5['push'](_0xd2a2a['TagId']);_0x212ad5[_0x0798('0x1f')](_0xd2a2a[_0x0798('0x1c')]);break;case _0x0798('0x25'):var _0xade271=utils[_0x0798('0x26')](_0x62452c[_0x0798('0x27')]['notificationTemplate'],_0x62452c);var _0x551418=_0xd2a2a[_0x0798('0x1c')][_0x0798('0x1d')](',');_0x212ad5[_0x0798('0x1f')](_0x551418[0x0]);_0x212ad5['push'](_0x551418[0x1]);_0x212ad5['push'](_0x551418[0x2]);_0x212ad5['push'](_0x551418[0x3]);_0x212ad5[_0x0798('0x1f')](_0x551418[0x4]);_0x212ad5[_0x0798('0x1f')](_0x551418[0x5]);_0x212ad5[_0x0798('0x1f')](_0x551418[0x6]);_0x212ad5[_0x0798('0x1f')](_0x551418[0x7]);_0x212ad5[_0x0798('0x1f')](_0x551418[0x8]);_0x212ad5[_0x0798('0x1f')](_0x551418[0x9]);_0x212ad5[_0x0798('0x1f')](_0x551418[0xa]);_0x212ad5[_0x0798('0x1f')](_0x62452c['interaction']['id']);_0x212ad5[_0x0798('0x1f')](_0x62452c['message']['id']);_0x212ad5[_0x0798('0x1f')](_0xd2a2a[_0x0798('0x28')]);_0x212ad5[_0x0798('0x1f')](_0x62452c['interaction'][_0x0798('0x29')]);_0x212ad5['push'](_0x62452c[_0x0798('0x2a')][_0x0798('0x2a')]);_0x212ad5[_0x0798('0x1f')](_0xade271);break;default:_0x212ad5=_['isNil'](_0xd2a2a[_0x0798('0x1c')])?[]:_0xd2a2a[_0x0798('0x1c')]['split'](',');}var _0xddc73b={'id':util['format']('%s:%s:%s',_0x45cae6,_0xd2a2a['id'],_0xd2a2a[_0x0798('0x19')]),'condition':require(_0x0798('0x2b'))['condition'](_0x45cae6,getIntervals(_0x36dd52['intervals'],_0xd2a2a),_0x36dd52),'consequence':require(_0x0798('0x2c')+_0xd2a2a[_0x0798('0x19')])[_0x0798('0x2d')](_0x45cae6,_0x212ad5,_0x36dd52,_0x62452c),'p':_0xd2a2a[_0x0798('0x2e')]||0x0};logger[_0x0798('0x2f')](_0x0798('0x30'),_0xddc73b['id'],_0x0798('0x31'),getIntervals(_0x36dd52['intervals'],_0xd2a2a)[_0x0798('0x18')](_0x0798('0x32')));_0x21c30b[_0x0798('0x1f')](_0xddc73b);}else{logger[_0x0798('0x33')](_0x0798('0x34'),path[_0x0798('0x18')](__dirname,'applications',_0xd2a2a[_0x0798('0x19')]+_0x0798('0x1a')));}}_0x36dd52[_0x0798('0x12')][_0x45cae6]=new RuleEngine(_0x21c30b);_0x36dd52[_0x0798('0x12')][_0x45cae6][_0x0798('0x35')](_0x62452c,function(_0xecc618){logger[_0x0798('0x2f')](_0x0798('0x36'),JSON[_0x0798('0x37')](_0xecc618[_0x0798('0x38')]));if(_0x36dd52[_0x0798('0x12')][_0x45cae6]){_0x36dd52[_0x0798('0x12')][_0x45cae6]['emit'](_0x0798('0x39'));}});return _0x47be56({'code':0xc8,'message':_0x62452c});}else{logger[_0x0798('0x2f')](_0x0798('0x3a'));return _0x47be56({'code':0xc8,'message':_0x62452c});}}catch(_0x19c10b){logger['error'](_0x19c10b['stack']);return _0x555c45(_0x112362[_0x0798('0x33')](0x1f4,_0x19c10b));}}return _0x555c45(_0x0798('0x3b'));});},'AcceptMessage':function(_0x1db8bd){var _0x39c6d8=this;return new Promise(function(_0x598001,_0x21c28c){if(_0x1db8bd['agent']&&_0x1db8bd['agent']['id']){if(_0x36dd52[_0x0798('0x3c')][_0x1db8bd[_0x0798('0x3d')]['id']]){_0x36dd52[_0x0798('0x3c')][_0x1db8bd[_0x0798('0x3d')]['id']][_0x0798('0x3e')]=![];_0x36dd52[_0x0798('0x3c')][_0x1db8bd[_0x0798('0x3d')]['id']][_0x0798('0x3f')]=undefined;}}if(_0x1db8bd[_0x0798('0x40')]&&_0x1db8bd['message']['id']){try{var _0x258d09=getId(_0x1db8bd['channel'],_0x1db8bd[_0x0798('0x40')]?_0x1db8bd[_0x0798('0x40')]['id']:0x0,_0x1db8bd[_0x0798('0x14')]?_0x1db8bd['interaction']['id']:0x0);if(_0x36dd52[_0x0798('0x12')][_0x258d09]){_0x36dd52[_0x0798('0x12')][_0x258d09][_0x0798('0x41')](_0x0798('0x42'));if(rpc[_0x1db8bd['channel']+_0x0798('0x43')]){rpc[_0x1db8bd[_0x0798('0x13')]+_0x0798('0x43')][_0x0798('0x44')](_0x258d09,{'UserId':_0x1db8bd[_0x0798('0x40')]['UserId']})[_0x0798('0x45')](function(){logger[_0x0798('0x33')](_0x0798('0x46'));});}}return _0x598001({'code':0xc8,'message':_0x1db8bd});}catch(_0x10173d){logger[_0x0798('0x33')](_0x10173d[_0x0798('0x47')]);return _0x21c28c(_0x39c6d8[_0x0798('0x33')](0x1f4,_0x10173d));}}logger[_0x0798('0x33')](_0x0798('0x48'));return _0x21c28c(_0x39c6d8['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x450fb2){var _0x499073=this;return new Promise(function(_0x375f11,_0x17967e){if(_0x450fb2[_0x0798('0x3d')]&&_0x450fb2[_0x0798('0x3d')]['id']){try{if(_0x36dd52[_0x0798('0x3c')][_0x450fb2['agent']['id']]){_0x36dd52[_0x0798('0x3c')][_0x450fb2['agent']['id']][_0x0798('0x3e')]=![];_0x36dd52[_0x0798('0x3c')][_0x450fb2[_0x0798('0x3d')]['id']]['busyQueue']=undefined;}return _0x375f11({'code':0xc8,'message':_0x450fb2});}catch(_0x4d16da){logger['error'](_0x4d16da[_0x0798('0x47')]);return _0x17967e(_0x499073['error'](0x1f4,_0x4d16da));}}logger['error'](_0x0798('0x48'));return _0x17967e(_0x499073[_0x0798('0x33')](0x1f4,_0x0798('0x48')));});},'AbandonInteraction':function(_0x499580){var _0x7fe667=this;return new Promise(function(_0x46532d,_0x359a4d){if(_0x499580[_0x0798('0x13')]&&_0x499580['interaction']&&_0x499580['interaction']['id']){try{var _0x136a1f=getId(_0x499580[_0x0798('0x13')],_0x499580[_0x0798('0x40')]?_0x499580['message']['id']:0x0,_0x499580['interaction']?_0x499580[_0x0798('0x14')]['id']:0x0);if(_0x36dd52[_0x0798('0x12')][_0x136a1f]){_0x36dd52[_0x0798('0x12')][_0x136a1f][_0x0798('0x41')](_0x0798('0x42'));}return _0x46532d({'code':0xc8,'message':_0x499580});}catch(_0xce8a72){logger[_0x0798('0x33')](_0xce8a72[_0x0798('0x47')]);return _0x359a4d(_0x7fe667['error'](0x1f4,_0xce8a72));}}logger[_0x0798('0x33')](_0x0798('0x48'));return _0x359a4d(_0x7fe667['error'](0x1f4,_0x0798('0x48')));});},'AgentCapacity':function(_0x6fdcac){var _0x57ddec=this;return new Promise(function(_0xaf3329,_0x390a75){if(_0x36dd52[_0x0798('0x3c')][_0x0798('0x49')](_0x6fdcac['id'])){for(var _0x458a4e in _0x6fdcac['capacity']){if(_0x6fdcac[_0x0798('0x4a')][_0x0798('0x49')](_0x458a4e)){if(_0x36dd52[_0x0798('0x3c')][_0x6fdcac['id']]['hasOwnProperty'](_0x458a4e+_0x0798('0x4b'))){_0x36dd52['agents'][_0x6fdcac['id']][_0x458a4e+_0x0798('0x4b')]=parseInt(_0x6fdcac[_0x0798('0x4a')][_0x458a4e],0xa);}}}_0x36dd52[_0x0798('0x3c')][_0x6fdcac['id']][_0x0798('0x4c')]();return _0xaf3329({'code':0xc8,'message':_0x36dd52[_0x0798('0x3c')][_0x6fdcac['id']]});}else{return _0x390a75(_0x57ddec[_0x0798('0x33')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x3cc8bd){return new Promise(function(_0xae453a){var _0x63d0c9=_[_0x0798('0x4d')](_0x36dd52['agents']);if(_0x3cc8bd&&_0x3cc8bd['id']){var _0x230a30=_[_0x0798('0x4e')](_0x63d0c9,function(_0x841053){return _0x841053['id']===_0x3cc8bd['id'];});_0xae453a(_0x230a30);}else{_0xae453a({'count':_0x63d0c9[_0x0798('0x21')],'rows':_0x63d0c9});}});},'ChatQueues':function(){return new Promise(function(_0x1339c0){var _0x523a2b=[];for(var _0x3ad6d9 in _0x36dd52[_0x0798('0x4f')]){if(_0x36dd52['chatQueues'][_0x0798('0x49')](_0x3ad6d9)){var _0x2d7c96=_0x36dd52[_0x0798('0x4f')][_0x3ad6d9];var _0x4fcdb4={'id':_0x2d7c96['id'],'available':_0x2d7c96[_0x0798('0x50')],'loggedIn':_0x2d7c96[_0x0798('0x51')],'name':_0x2d7c96[_0x0798('0x52')],'paused':_0x2d7c96[_0x0798('0x53')],'waiting':_0x2d7c96[_0x0798('0x54')]};_0x523a2b[_0x0798('0x1f')](_0x4fcdb4);}}_0x1339c0({'count':_0x523a2b[_0x0798('0x21')],'rows':_0x523a2b});});},'MailQueues':function(){return new Promise(function(_0x41b369){var _0x4a4853=[];for(var _0x316762 in _0x36dd52[_0x0798('0x55')]){if(_0x36dd52[_0x0798('0x55')][_0x0798('0x49')](_0x316762)){var _0x4ad8a1=_0x36dd52[_0x0798('0x55')][_0x316762];var _0x2952bc={'id':_0x4ad8a1['id'],'available':_0x4ad8a1[_0x0798('0x50')],'loggedIn':_0x4ad8a1[_0x0798('0x51')],'name':_0x4ad8a1[_0x0798('0x52')],'paused':_0x4ad8a1[_0x0798('0x53')],'waiting':_0x4ad8a1[_0x0798('0x54')]};_0x4a4853[_0x0798('0x1f')](_0x2952bc);}}_0x41b369({'count':_0x4a4853['length'],'rows':_0x4a4853});});},'OpenchannelQueues':function(){return new Promise(function(_0x24aa99){var _0x4d594f=[];for(var _0x91ce58 in _0x36dd52[_0x0798('0x56')]){if(_0x36dd52[_0x0798('0x56')]['hasOwnProperty'](_0x91ce58)){var _0x1fad8c=_0x36dd52[_0x0798('0x56')][_0x91ce58];var _0x540703={'id':_0x1fad8c['id'],'available':_0x1fad8c[_0x0798('0x50')],'loggedIn':_0x1fad8c['loggedIn'],'name':_0x1fad8c['name'],'paused':_0x1fad8c[_0x0798('0x53')],'waiting':_0x1fad8c[_0x0798('0x54')]};_0x4d594f[_0x0798('0x1f')](_0x540703);}}_0x24aa99({'count':_0x4d594f[_0x0798('0x21')],'rows':_0x4d594f});});},'SmsQueues':function(){return new Promise(function(_0x4b568e){var _0x3ebb8e=[];for(var _0x110c12 in _0x36dd52[_0x0798('0x57')]){if(_0x36dd52[_0x0798('0x57')][_0x0798('0x49')](_0x110c12)){var _0x4011c8=_0x36dd52[_0x0798('0x57')][_0x110c12];var _0x4db2b6={'id':_0x4011c8['id'],'available':_0x4011c8['available'],'loggedIn':_0x4011c8['loggedIn'],'name':_0x4011c8[_0x0798('0x52')],'paused':_0x4011c8[_0x0798('0x53')],'waiting':_0x4011c8[_0x0798('0x54')]};_0x3ebb8e[_0x0798('0x1f')](_0x4db2b6);}}_0x4b568e({'count':_0x3ebb8e['length'],'rows':_0x3ebb8e});});},'FaxQueues':function(){return new Promise(function(_0x427c38){var _0x13ccdf=[];for(var _0x5a4cb5 in _0x36dd52[_0x0798('0x58')]){if(_0x36dd52['faxQueues'][_0x0798('0x49')](_0x5a4cb5)){var _0x4c7804=_0x36dd52[_0x0798('0x58')][_0x5a4cb5];var _0x40d15a={'id':_0x4c7804['id'],'available':_0x4c7804[_0x0798('0x50')],'loggedIn':_0x4c7804[_0x0798('0x51')],'name':_0x4c7804[_0x0798('0x52')],'paused':_0x4c7804[_0x0798('0x53')],'waiting':_0x4c7804[_0x0798('0x54')]};_0x13ccdf[_0x0798('0x1f')](_0x40d15a);}}_0x427c38({'count':_0x13ccdf['length'],'rows':_0x13ccdf});});},'WhatsappQueues':function(){return new Promise(function(_0x2ce725){var _0x47e5bd=[];for(var _0x24b8cb in _0x36dd52[_0x0798('0x59')]){if(_0x36dd52['whatsappQueues'][_0x0798('0x49')](_0x24b8cb)){var _0x739177=_0x36dd52['whatsappQueues'][_0x24b8cb];var _0x110edc={'id':_0x739177['id'],'available':_0x739177['available'],'loggedIn':_0x739177[_0x0798('0x51')],'name':_0x739177[_0x0798('0x52')],'paused':_0x739177[_0x0798('0x53')],'waiting':_0x739177['waiting']};_0x47e5bd[_0x0798('0x1f')](_0x110edc);}}_0x2ce725({'count':_0x47e5bd[_0x0798('0x21')],'rows':_0x47e5bd});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3ad2fd){var _0x156068=_['values'](_0x36dd52[_0x0798('0x5a')]);_0x3ad2fd({'count':_0x156068[_0x0798('0x21')],'rows':_0x156068});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2c8e3e){var _0x1c9a79=_[_0x0798('0x4d')](_0x36dd52[_0x0798('0x5b')]);_0x2c8e3e({'count':_0x1c9a79['length'],'rows':_0x1c9a79});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4bd39e){var _0x46561b=_[_0x0798('0x4d')](_0x36dd52[_0x0798('0x5c')]);_0x4bd39e({'count':_0x46561b[_0x0798('0x21')],'rows':_0x46561b});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x56e0c6){var _0xf0aa35=_['values'](_0x36dd52['smsQueuesWaitingInteractions']);_0x56e0c6({'count':_0xf0aa35[_0x0798('0x21')],'rows':_0xf0aa35});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x28698d){var _0x49fe11=_[_0x0798('0x4d')](_0x36dd52[_0x0798('0x5d')]);_0x28698d({'count':_0x49fe11[_0x0798('0x21')],'rows':_0x49fe11});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xaa4b1d){var _0x3dbdff=_[_0x0798('0x4d')](_0x36dd52['whatsappQueuesWaitingInteractions']);_0xaa4b1d({'count':_0x3dbdff[_0x0798('0x21')],'rows':_0x3dbdff});});}};var _0x20e2e3=jayson[_0x0798('0x5e')](_0x486bcf)[_0x0798('0x5f')]();_0x20e2e3['on'](_0x0798('0x33'),function(_0x194669){logger['error'](JSON[_0x0798('0x37')](_0x194669));return _0x5f1640(_0x194669);});_0x20e2e3[_0x0798('0x11')](0x232c,_0x0798('0x60'),function(){console[_0x0798('0x61')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0xfd88af(_0x0798('0x62')+0x232c);});});};
\ No newline at end of file
+var _0x57f8=['routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','IntervalId','isNil','Intervals','map','interval','rules','channel','message','interaction','applications','isArray','length','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','join','dialogflow','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','agent','agents','busyQueue','end','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','mailQueues','paused','openchannelQueues','waiting','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/environment','../../../config/logger'];(function(_0x4782e7,_0x5e6055){var _0x3e48f9=function(_0x2e8ed6){while(--_0x2e8ed6){_0x4782e7['push'](_0x4782e7['shift']());}};_0x3e48f9(++_0x5e6055);}(_0x57f8,0x198));var _0x857f=function(_0x2d69a4,_0x32935e){_0x2d69a4=_0x2d69a4-0x0;var _0xe0705b=_0x57f8[_0x2d69a4];return _0xe0705b;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var path=require(_0x857f('0x1'));var fs=require('fs');var jayson=require(_0x857f('0x2'));var BPromise=require(_0x857f('0x3'));var uuid=require(_0x857f('0x4'));var utils=require(_0x857f('0x5'));var config=require(_0x857f('0x6'));var logger=require(_0x857f('0x7'))(_0x857f('0x8'));var rpc={'openchannelQueueReport':require(_0x857f('0x9')),'mailQueueReport':require(_0x857f('0xa')),'chatQueueReport':require(_0x857f('0xb')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x857f('0xc')),'whatsappQueueReport':require(_0x857f('0xd'))};var RuleEngine=require(_0x857f('0xe'));function getId(_0x577fc3,_0x5f6a66,_0x135855){return util[_0x857f('0xf')]('%s.%s.%s',_0x577fc3,_0x5f6a66||0x0,_0x135855||0x0);}function getIntervals(_0x1e306e,_0x2ef315){var _0x370126=[];if(!_['isNil'](_0x2ef315[_0x857f('0x10')])&&!_[_0x857f('0x11')](_0x1e306e[_0x2ef315[_0x857f('0x10')]])&&!_[_0x857f('0x11')](_0x1e306e[_0x2ef315[_0x857f('0x10')]][_0x857f('0x12')])){_0x370126=_[_0x857f('0x13')](_0x1e306e[_0x2ef315['IntervalId']][_0x857f('0x12')],_0x857f('0x14'));}else if(!_[_0x857f('0x11')](_0x2ef315[_0x857f('0x14')])){_0x370126=[_0x2ef315[_0x857f('0x14')]];}return _0x370126;}exports['listen']=function(_0x4bc590){_0x4bc590[_0x857f('0x15')]={};return new BPromise(function(_0x5f27b2,_0x1fafbe){var _0x4ac81f={'Start':function(_0x1d47bf){var _0x134a4f=this;return new Promise(function(_0x5c3a69,_0x27e8f1){if(_0x1d47bf){try{var _0x29b251=[];var _0xdf14fe=getId(_0x1d47bf[_0x857f('0x16')],_0x1d47bf[_0x857f('0x17')]?_0x1d47bf[_0x857f('0x17')]['id']:0x0,_0x1d47bf[_0x857f('0x18')]?_0x1d47bf[_0x857f('0x18')]['id']:0x0);if(_0x1d47bf[_0x857f('0x19')]&&_[_0x857f('0x1a')](_0x1d47bf[_0x857f('0x19')])&&_0x1d47bf['applications'][_0x857f('0x1b')]){for(var _0x1e8fd4=0x0;_0x1e8fd4<_0x1d47bf['applications'][_0x857f('0x1b')];_0x1e8fd4+=0x1){var _0x11df55=_0x1d47bf[_0x857f('0x19')][_0x1e8fd4];if(fs['existsSync'](path['join'](__dirname,_0x857f('0x19'),_0x11df55[_0x857f('0x1c')]+_0x857f('0x1d')))){var _0x4fa031=[];switch(_0x11df55[_0x857f('0x1c')][_0x857f('0x1e')]()){case _0x857f('0x1f'):var _0x483bb7=_0x11df55[_0x857f('0x20')][_0x857f('0x21')](',');if(_0x1d47bf['channel']===_0x857f('0x22')){_0x4fa031[_0x857f('0x23')](_0x483bb7[0x0]);_0x4fa031[_0x857f('0x23')](_0x483bb7[0x1]);_0x4fa031[_0x857f('0x23')](_0x483bb7[_0x857f('0x24')](0x2,_0x483bb7[_0x857f('0x1b')])[_0x857f('0x25')](','));}else{_0x4fa031[_0x857f('0x23')](_0x483bb7[0x0]);_0x4fa031[_0x857f('0x23')](_0x483bb7[_0x857f('0x24')](0x1,_0x483bb7[_0x857f('0x1b')])[_0x857f('0x25')](','));}break;case _0x857f('0x26'):var _0x46761e=_0x11df55['appdata'][_0x857f('0x21')](',');_0x4fa031[_0x857f('0x23')](_0x46761e[0x0]);_0x4fa031[_0x857f('0x23')](_0x46761e[0x1]);_0x4fa031[_0x857f('0x23')](_0x46761e['slice'](0x2,_0x46761e[_0x857f('0x1b')])['join'](','));break;case _0x857f('0x27'):var _0x234048=_0x11df55[_0x857f('0x20')][_0x857f('0x21')](',');_0x4fa031[_0x857f('0x23')](_0x234048[0x0]);_0x4fa031[_0x857f('0x23')](_0x234048[0x1]);_0x4fa031[_0x857f('0x23')](_0x234048[0x2]);_0x4fa031[_0x857f('0x23')](_0x234048[0x3]);_0x4fa031[_0x857f('0x23')](_0x234048[_0x857f('0x24')](0x4,_0x234048[_0x857f('0x1b')])[_0x857f('0x25')](','));break;case _0x857f('0x28'):var _0x5d0317=_0x11df55[_0x857f('0x20')][_0x857f('0x21')](',');_0x4fa031['push'](_0x5d0317[0x0]);_0x4fa031[_0x857f('0x23')](_0x5d0317[0x1]);_0x4fa031[_0x857f('0x23')](_0x5d0317[0x2]);_0x4fa031['push'](_0x5d0317[0x3]);_0x4fa031[_0x857f('0x23')](_0x5d0317[_0x857f('0x24')](0x4,_0x5d0317['length'])[_0x857f('0x25')](','));break;case _0x857f('0x17'):_0x4fa031[_0x857f('0x23')](_0x11df55[_0x857f('0x20')]);break;case'tag':_0x4fa031['push'](_0x11df55[_0x857f('0x29')]);_0x4fa031[_0x857f('0x23')](_0x11df55['appdata']);break;case _0x857f('0x2a'):var _0x4d3a87=utils[_0x857f('0x2b')](_0x1d47bf[_0x857f('0x2c')][_0x857f('0x2d')],_0x1d47bf);var _0x438ff1=_0x11df55[_0x857f('0x20')]['split'](',');_0x4fa031['push'](_0x438ff1[0x0]);_0x4fa031[_0x857f('0x23')](_0x438ff1[0x1]);_0x4fa031['push'](_0x438ff1[0x2]);_0x4fa031[_0x857f('0x23')](_0x438ff1[0x3]);_0x4fa031[_0x857f('0x23')](_0x438ff1[0x4]);_0x4fa031[_0x857f('0x23')](_0x438ff1[0x5]);_0x4fa031['push'](_0x438ff1[0x6]);_0x4fa031[_0x857f('0x23')](_0x438ff1[0x7]);_0x4fa031[_0x857f('0x23')](_0x438ff1[0x8]);_0x4fa031[_0x857f('0x23')](_0x438ff1[0x9]);_0x4fa031[_0x857f('0x23')](_0x438ff1[0xa]);_0x4fa031[_0x857f('0x23')](_0x1d47bf[_0x857f('0x18')]['id']);_0x4fa031[_0x857f('0x23')](_0x1d47bf['message']['id']);_0x4fa031[_0x857f('0x23')](_0x11df55[_0x857f('0x2e')]);_0x4fa031[_0x857f('0x23')](_0x1d47bf[_0x857f('0x18')][_0x857f('0x2f')]);_0x4fa031[_0x857f('0x23')](_0x1d47bf[_0x857f('0x30')]['body']);_0x4fa031[_0x857f('0x23')](_0x4d3a87);break;default:_0x4fa031=_[_0x857f('0x11')](_0x11df55[_0x857f('0x20')])?[]:_0x11df55[_0x857f('0x20')][_0x857f('0x21')](',');}var _0x1c119f={'id':util['format'](_0x857f('0x31'),_0xdf14fe,_0x11df55['id'],_0x11df55[_0x857f('0x1c')]),'condition':require(_0x857f('0x32'))[_0x857f('0x33')](_0xdf14fe,getIntervals(_0x4bc590[_0x857f('0x34')],_0x11df55),_0x4bc590),'consequence':require(_0x857f('0x35')+_0x11df55[_0x857f('0x1c')])[_0x857f('0x36')](_0xdf14fe,_0x4fa031,_0x4bc590,_0x1d47bf),'p':_0x11df55['priority']||0x0};logger[_0x857f('0x37')](_0x857f('0x38'),_0x1c119f['id'],_0x857f('0x39'),getIntervals(_0x4bc590[_0x857f('0x34')],_0x11df55)[_0x857f('0x25')](_0x857f('0x3a')));_0x29b251[_0x857f('0x23')](_0x1c119f);}else{logger[_0x857f('0x3b')](_0x857f('0x3c'),path[_0x857f('0x25')](__dirname,_0x857f('0x19'),_0x11df55[_0x857f('0x1c')]+_0x857f('0x1d')));}}_0x4bc590[_0x857f('0x15')][_0xdf14fe]=new RuleEngine(_0x29b251);_0x4bc590['rules'][_0xdf14fe][_0x857f('0x3d')](_0x1d47bf,function(_0x5b2baa){logger[_0x857f('0x37')](_0x857f('0x3e'),JSON[_0x857f('0x3f')](_0x5b2baa[_0x857f('0x40')]));if(_0x4bc590[_0x857f('0x15')][_0xdf14fe]){_0x4bc590[_0x857f('0x15')][_0xdf14fe][_0x857f('0x41')](_0x857f('0x42'));}});return _0x5c3a69({'code':0xc8,'message':_0x1d47bf});}else{logger[_0x857f('0x37')](_0x857f('0x43'));return _0x5c3a69({'code':0xc8,'message':_0x1d47bf});}}catch(_0xc5a81d){logger['error'](_0xc5a81d['stack']);return _0x27e8f1(_0x134a4f[_0x857f('0x3b')](0x1f4,_0xc5a81d));}}return _0x27e8f1('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2da9ff){var _0x52f82c=this;return new Promise(function(_0x3a9a87,_0x3cf4ed){if(_0x2da9ff[_0x857f('0x44')]&&_0x2da9ff[_0x857f('0x44')]['id']){if(_0x4bc590[_0x857f('0x45')][_0x2da9ff[_0x857f('0x44')]['id']]){_0x4bc590[_0x857f('0x45')][_0x2da9ff[_0x857f('0x44')]['id']]['busy']=![];_0x4bc590[_0x857f('0x45')][_0x2da9ff[_0x857f('0x44')]['id']][_0x857f('0x46')]=undefined;}}if(_0x2da9ff[_0x857f('0x17')]&&_0x2da9ff['message']['id']){try{var _0x2dcaab=getId(_0x2da9ff[_0x857f('0x16')],_0x2da9ff[_0x857f('0x17')]?_0x2da9ff[_0x857f('0x17')]['id']:0x0,_0x2da9ff[_0x857f('0x18')]?_0x2da9ff['interaction']['id']:0x0);if(_0x4bc590[_0x857f('0x15')][_0x2dcaab]){_0x4bc590[_0x857f('0x15')][_0x2dcaab]['emit'](_0x857f('0x47'));if(rpc[_0x2da9ff[_0x857f('0x16')]+'QueueReport']){rpc[_0x2da9ff[_0x857f('0x16')]+'QueueReport'][_0x857f('0x48')](_0x2dcaab,{'UserId':_0x2da9ff[_0x857f('0x17')][_0x857f('0x49')]})[_0x857f('0x4a')](function(_0x58bf27){logger[_0x857f('0x3b')](_0x857f('0x4b'));});}}return _0x3a9a87({'code':0xc8,'message':_0x2da9ff});}catch(_0x2d9364){logger[_0x857f('0x3b')](_0x2d9364[_0x857f('0x4c')]);return _0x3cf4ed(_0x52f82c['error'](0x1f4,_0x2d9364));}}logger[_0x857f('0x3b')](_0x857f('0x4d'));return _0x3cf4ed(_0x52f82c[_0x857f('0x3b')](0x1f4,_0x857f('0x4d')));});},'RejectMessage':function(_0x3e24a5){var _0x9edee5=this;return new Promise(function(_0x12712a,_0x59164a){if(_0x3e24a5[_0x857f('0x44')]&&_0x3e24a5[_0x857f('0x44')]['id']){try{if(_0x4bc590[_0x857f('0x45')][_0x3e24a5[_0x857f('0x44')]['id']]){_0x4bc590[_0x857f('0x45')][_0x3e24a5[_0x857f('0x44')]['id']]['busy']=![];_0x4bc590[_0x857f('0x45')][_0x3e24a5[_0x857f('0x44')]['id']][_0x857f('0x46')]=undefined;}return _0x12712a({'code':0xc8,'message':_0x3e24a5});}catch(_0x2778ac){logger[_0x857f('0x3b')](_0x2778ac[_0x857f('0x4c')]);return _0x59164a(_0x9edee5[_0x857f('0x3b')](0x1f4,_0x2778ac));}}logger[_0x857f('0x3b')]('message\x20is\x20empty');return _0x59164a(_0x9edee5['error'](0x1f4,_0x857f('0x4d')));});},'AbandonInteraction':function(_0x477653){var _0x14b2ff=this;return new Promise(function(_0x3800d6,_0x3c4e0a){if(_0x477653[_0x857f('0x16')]&&_0x477653['interaction']&&_0x477653[_0x857f('0x18')]['id']){try{var _0x237739=getId(_0x477653['channel'],_0x477653[_0x857f('0x17')]?_0x477653['message']['id']:0x0,_0x477653[_0x857f('0x18')]?_0x477653[_0x857f('0x18')]['id']:0x0);if(_0x4bc590['rules'][_0x237739]){_0x4bc590[_0x857f('0x15')][_0x237739][_0x857f('0x41')](_0x857f('0x47'));}return _0x3800d6({'code':0xc8,'message':_0x477653});}catch(_0x464208){logger[_0x857f('0x3b')](_0x464208[_0x857f('0x4c')]);return _0x3c4e0a(_0x14b2ff[_0x857f('0x3b')](0x1f4,_0x464208));}}logger[_0x857f('0x3b')]('message\x20is\x20empty');return _0x3c4e0a(_0x14b2ff[_0x857f('0x3b')](0x1f4,_0x857f('0x4d')));});},'AgentCapacity':function(_0x29ebb3){var _0x7cc7f7=this;return new Promise(function(_0x3c612f,_0xdfda34){if(_0x4bc590[_0x857f('0x45')][_0x857f('0x4e')](_0x29ebb3['id'])){for(var _0x109e60 in _0x29ebb3[_0x857f('0x4f')]){if(_0x29ebb3[_0x857f('0x4f')]['hasOwnProperty'](_0x109e60)){if(_0x4bc590[_0x857f('0x45')][_0x29ebb3['id']][_0x857f('0x4e')](_0x109e60+_0x857f('0x50'))){_0x4bc590[_0x857f('0x45')][_0x29ebb3['id']][_0x109e60+'CurrentCapacity']=parseInt(_0x29ebb3[_0x857f('0x4f')][_0x109e60],0xa);}}}_0x4bc590['agents'][_0x29ebb3['id']][_0x857f('0x51')]();return _0x3c612f({'code':0xc8,'message':_0x4bc590[_0x857f('0x45')][_0x29ebb3['id']]});}else{return _0xdfda34(_0x7cc7f7[_0x857f('0x3b')](0x1f4,_0x857f('0x52')));}});},'Agents':function(_0x541a65){return new Promise(function(_0x4bbc67,_0x11c82c){var _0x3ee981=_[_0x857f('0x53')](_0x4bc590['agents']);_0x4bbc67({'count':_0x3ee981[_0x857f('0x1b')],'rows':_0x3ee981});});},'ChatQueues':function(_0x5e42bc){return new Promise(function(_0x5b505,_0x1d6c1c){var _0x1bde49=[];for(var _0x47fa5a in _0x4bc590['chatQueues']){if(_0x4bc590[_0x857f('0x54')][_0x857f('0x4e')](_0x47fa5a)){var _0x207dfc=_0x4bc590[_0x857f('0x54')][_0x47fa5a];var _0x41f9d8={'id':_0x207dfc['id'],'available':_0x207dfc[_0x857f('0x55')],'loggedIn':_0x207dfc[_0x857f('0x56')],'name':_0x207dfc[_0x857f('0x57')],'paused':_0x207dfc['paused'],'waiting':_0x207dfc['waiting']};_0x1bde49[_0x857f('0x23')](_0x41f9d8);}}_0x5b505({'count':_0x1bde49[_0x857f('0x1b')],'rows':_0x1bde49});});},'MailQueues':function(_0x3f144e){return new Promise(function(_0x2bd366,_0x43ca9b){var _0xa9a92c=[];for(var _0x54c8d1 in _0x4bc590[_0x857f('0x58')]){if(_0x4bc590[_0x857f('0x58')][_0x857f('0x4e')](_0x54c8d1)){var _0xeac958=_0x4bc590[_0x857f('0x58')][_0x54c8d1];var _0x1d4c10={'id':_0xeac958['id'],'available':_0xeac958[_0x857f('0x55')],'loggedIn':_0xeac958[_0x857f('0x56')],'name':_0xeac958[_0x857f('0x57')],'paused':_0xeac958[_0x857f('0x59')],'waiting':_0xeac958['waiting']};_0xa9a92c[_0x857f('0x23')](_0x1d4c10);}}_0x2bd366({'count':_0xa9a92c['length'],'rows':_0xa9a92c});});},'OpenchannelQueues':function(_0x5ec513){return new Promise(function(_0x35cd3e,_0x48e588){var _0x5e5fd9=[];for(var _0x2e2cf3 in _0x4bc590['openchannelQueues']){if(_0x4bc590[_0x857f('0x5a')]['hasOwnProperty'](_0x2e2cf3)){var _0x19ad99=_0x4bc590[_0x857f('0x5a')][_0x2e2cf3];var _0x28eb51={'id':_0x19ad99['id'],'available':_0x19ad99[_0x857f('0x55')],'loggedIn':_0x19ad99['loggedIn'],'name':_0x19ad99[_0x857f('0x57')],'paused':_0x19ad99[_0x857f('0x59')],'waiting':_0x19ad99[_0x857f('0x5b')]};_0x5e5fd9[_0x857f('0x23')](_0x28eb51);}}_0x35cd3e({'count':_0x5e5fd9[_0x857f('0x1b')],'rows':_0x5e5fd9});});},'SmsQueues':function(_0x80feb){return new Promise(function(_0x195760,_0x5c50bd){var _0x54e75d=[];for(var _0x2fa49e in _0x4bc590[_0x857f('0x5c')]){if(_0x4bc590[_0x857f('0x5c')][_0x857f('0x4e')](_0x2fa49e)){var _0x43ca7e=_0x4bc590[_0x857f('0x5c')][_0x2fa49e];var _0x4c1f30={'id':_0x43ca7e['id'],'available':_0x43ca7e[_0x857f('0x55')],'loggedIn':_0x43ca7e[_0x857f('0x56')],'name':_0x43ca7e[_0x857f('0x57')],'paused':_0x43ca7e['paused'],'waiting':_0x43ca7e['waiting']};_0x54e75d[_0x857f('0x23')](_0x4c1f30);}}_0x195760({'count':_0x54e75d['length'],'rows':_0x54e75d});});},'FaxQueues':function(_0x4b07c5){return new Promise(function(_0x1a2b4a,_0x112dc4){var _0x590b36=[];for(var _0x334d6a in _0x4bc590[_0x857f('0x5d')]){if(_0x4bc590['faxQueues'][_0x857f('0x4e')](_0x334d6a)){var _0x21cc84=_0x4bc590[_0x857f('0x5d')][_0x334d6a];var _0x2398df={'id':_0x21cc84['id'],'available':_0x21cc84[_0x857f('0x55')],'loggedIn':_0x21cc84[_0x857f('0x56')],'name':_0x21cc84[_0x857f('0x57')],'paused':_0x21cc84[_0x857f('0x59')],'waiting':_0x21cc84[_0x857f('0x5b')]};_0x590b36[_0x857f('0x23')](_0x2398df);}}_0x1a2b4a({'count':_0x590b36[_0x857f('0x1b')],'rows':_0x590b36});});},'WhatsappQueues':function(_0x17522d){return new Promise(function(_0x4e1094,_0x4e7a85){var _0x5426d5=[];for(var _0x474b85 in _0x4bc590[_0x857f('0x5e')]){if(_0x4bc590[_0x857f('0x5e')][_0x857f('0x4e')](_0x474b85)){var _0x348931=_0x4bc590[_0x857f('0x5e')][_0x474b85];var _0x1ddd3b={'id':_0x348931['id'],'available':_0x348931['available'],'loggedIn':_0x348931[_0x857f('0x56')],'name':_0x348931['name'],'paused':_0x348931[_0x857f('0x59')],'waiting':_0x348931['waiting']};_0x5426d5['push'](_0x1ddd3b);}}_0x4e1094({'count':_0x5426d5[_0x857f('0x1b')],'rows':_0x5426d5});});},'ChatQueuesWaitingInteractions':function(_0x4d3d9f){return new Promise(function(_0x160a02,_0x1445c4){var _0x3d6561=_['values'](_0x4bc590[_0x857f('0x5f')]);_0x160a02({'count':_0x3d6561[_0x857f('0x1b')],'rows':_0x3d6561});});},'MailQueuesWaitingInteractions':function(_0x25e148){return new Promise(function(_0x18e1cb,_0x3c67bd){var _0x8a1d41=_[_0x857f('0x53')](_0x4bc590[_0x857f('0x60')]);_0x18e1cb({'count':_0x8a1d41[_0x857f('0x1b')],'rows':_0x8a1d41});});},'OpenchannelQueuesWaitingInteractions':function(_0x53a75d){return new Promise(function(_0x1f29e5,_0x32c841){var _0x126f19=_[_0x857f('0x53')](_0x4bc590['openchannelQueuesWaitingInteractions']);_0x1f29e5({'count':_0x126f19[_0x857f('0x1b')],'rows':_0x126f19});});},'SmsQueuesWaitingInteractions':function(_0x59cdfb){return new Promise(function(_0x2c7262,_0x2ff709){var _0x15df2f=_[_0x857f('0x53')](_0x4bc590['smsQueuesWaitingInteractions']);_0x2c7262({'count':_0x15df2f[_0x857f('0x1b')],'rows':_0x15df2f});});},'FaxQueuesWaitingInteractions':function(_0x4974cf){return new Promise(function(_0x56f7a4,_0x4050b3){var _0xb0986b=_['values'](_0x4bc590['faxQueuesWaitingInteractions']);_0x56f7a4({'count':_0xb0986b[_0x857f('0x1b')],'rows':_0xb0986b});});},'WhatsappQueuesWaitingInteractions':function(_0x3be826){return new Promise(function(_0x210201,_0x1b5af4){var _0x48157a=_[_0x857f('0x53')](_0x4bc590[_0x857f('0x61')]);_0x210201({'count':_0x48157a[_0x857f('0x1b')],'rows':_0x48157a});});}};var _0x39b66a=jayson[_0x857f('0x62')](_0x4ac81f)['http']();_0x39b66a['on']('error',function(_0x35092a){logger['error'](JSON['stringify'](_0x35092a));return _0x1fafbe(_0x35092a);});_0x39b66a[_0x857f('0x63')](0x232c,_0x857f('0x64'),function(){console[_0x857f('0x65')](_0x857f('0x66'),0x232c);return _0x5f27b2(_0x857f('0x67')+0x232c);});});};
\ No newline at end of file
index 8e34811..a045fcf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8625=['../../../config/logger','routing','http','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','lodash'];(function(_0x5effcf,_0x47af59){var _0x4d123c=function(_0x24aaef){while(--_0x24aaef){_0x5effcf['push'](_0x5effcf['shift']());}};_0x4d123c(++_0x47af59);}(_0x8625,0xbc));var _0x5862=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x8625[_0x342baa];return _0x1208f3;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x5862('0x0'));var logger=require(_0x5862('0x1'))(_0x5862('0x2'));var client=jayson['client'][_0x5862('0x3')]({'port':0x232a});function request(_0x2acc24,_0x2fc1e4){return new BPromise(function(_0x1b3b7c,_0x2e12a0){return client[_0x5862('0x4')](_0x2acc24,_0x2fc1e4)[_0x5862('0x5')](function(_0x4137a7){if(_0x4137a7[_0x5862('0x6')]){return _0x2e12a0(_0x4137a7[_0x5862('0x6')][_0x5862('0x7')]);}else{return _0x1b3b7c(_0x4137a7['result']);}})[_0x5862('0x8')](function(_0x2f5e88){return _0x2e12a0(_0x2f5e88);});});}exports[_0x5862('0x9')]=function(_0x2281be,_0x5d40fa,_0x564417){return function(_0x14b8ec){if(_0x564417[_0x5862('0xa')]&&!_0x564417[_0x5862('0xa')][_0x2281be]){logger[_0x5862('0xb')](_0x5862('0xc'),_0x2281be);return _0x14b8ec[_0x5862('0xd')]();}var _0x56cfb8=[];for(var _0x3badf5=0x0;_0x3badf5<_0x5d40fa[_0x5862('0xe')];_0x3badf5+=0x1){_0x56cfb8['push'](request(_0x5862('0xf'),{'command':util[_0x5862('0x10')](_0x5862('0x11'),_0x5d40fa[_0x3badf5])})[_0x5862('0x5')](function(_0x34ed9c){return _0x34ed9c&&_0x34ed9c[_0x5862('0x7')]&&_0x34ed9c[_0x5862('0x7')][_0x5862('0x12')](_0x5862('0x13'))>=0x0?!![]:![];})[_0x5862('0x8')](function(_0x2378c0){logger['error'](_0x5862('0x14'),_0x2281be,_0x5d40fa[_0x3badf5]);}));}BPromise[_0x5862('0x15')](_0x56cfb8)[_0x5862('0x5')](function(_0xe66ee5){var _0x5c5092=_['some'](_0xe66ee5);logger['info'](_0x5862('0x16'),_0x2281be,_0x5d40fa[_0x5862('0x17')](_0x5862('0x18')),_0x5c5092);_0x14b8ec[_0x5862('0x19')](_0x5c5092);})[_0x5862('0x8')](function(_0x57b3e0){console['log'](_0x57b3e0);logger['error'](_0x5862('0x16'),_0x2281be,_0x5d40fa[_0x5862('0x17')]('\x20|\x20'),_0x57b3e0[_0x5862('0x1a')]);_0x14b8ec['stop']();});};};
\ No newline at end of file
+var _0x2ba5=['Command','iftime\x20%s','indexOf','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','bluebird','jayson/promise','lodash','../../../config/logger','client','http','request','then','error','message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push'];(function(_0x552c27,_0x478dc2){var _0x2a0922=function(_0x22617c){while(--_0x22617c){_0x552c27['push'](_0x552c27['shift']());}};_0x2a0922(++_0x478dc2);}(_0x2ba5,0x19f));var _0x52ba=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0x2ba5[_0x495e9f];return _0xb249d2;};'use strict';var util=require('util');var BPromise=require(_0x52ba('0x0'));var jayson=require(_0x52ba('0x1'));var _=require(_0x52ba('0x2'));var logger=require(_0x52ba('0x3'))('routing');var client=jayson[_0x52ba('0x4')][_0x52ba('0x5')]({'port':0x232a});function request(_0x3f52f2,_0x28bf73){return new BPromise(function(_0x39f745,_0x20a836){return client[_0x52ba('0x6')](_0x3f52f2,_0x28bf73)[_0x52ba('0x7')](function(_0x4d71df){if(_0x4d71df['error']){return _0x20a836(_0x4d71df[_0x52ba('0x8')][_0x52ba('0x9')]);}else{return _0x39f745(_0x4d71df[_0x52ba('0xa')]);}})[_0x52ba('0xb')](function(_0x8c10f){return _0x20a836(_0x8c10f);});});}exports['condition']=function(_0x548a6b,_0x2efe88,_0x39ebe9){return function(_0x5015b4){if(_0x39ebe9['rules']&&!_0x39ebe9[_0x52ba('0xc')][_0x548a6b]){logger[_0x52ba('0xd')](_0x52ba('0xe'),_0x548a6b);return _0x5015b4[_0x52ba('0xf')]();}var _0x509d30=[];for(var _0x12fe1e=0x0;_0x12fe1e<_0x2efe88['length'];_0x12fe1e+=0x1){_0x509d30[_0x52ba('0x10')](request(_0x52ba('0x11'),{'command':util['format'](_0x52ba('0x12'),_0x2efe88[_0x12fe1e])})[_0x52ba('0x7')](function(_0x317175){return _0x317175&&_0x317175[_0x52ba('0x9')]&&_0x317175[_0x52ba('0x9')][_0x52ba('0x13')]('true')>=0x0?!![]:![];})[_0x52ba('0xb')](function(_0x46d280){logger[_0x52ba('0x8')]('[%s][INTERVAL]\x20%s',_0x548a6b,_0x2efe88[_0x12fe1e]);}));}BPromise[_0x52ba('0x14')](_0x509d30)[_0x52ba('0x7')](function(_0x3e36b5){var _0x1271d5=_['some'](_0x3e36b5);logger[_0x52ba('0xd')](_0x52ba('0x15'),_0x548a6b,_0x2efe88[_0x52ba('0x16')](_0x52ba('0x17')),_0x1271d5);_0x5015b4[_0x52ba('0x18')](_0x1271d5);})[_0x52ba('0xb')](function(_0x35c65a){console[_0x52ba('0x19')](_0x35c65a);logger[_0x52ba('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x548a6b,_0x2efe88[_0x52ba('0x16')]('\x20|\x20'),_0x35c65a[_0x52ba('0x1a')]);_0x5015b4['stop']();});};};
\ No newline at end of file
index eb5aff0..32247a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6cb4=['[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','interface','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','agentacw','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','agentcompleteAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','transfer','blind','transferexten','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfertype','secondtransfererexten','transfertargetuniqueid','hangup','cause'];(function(_0x1aa03c,_0x3427f1){var _0x1df291=function(_0x55de33){while(--_0x55de33){_0x1aa03c['push'](_0x1aa03c['shift']());}};_0x1df291(++_0x3427f1);}(_0x6cb4,0xff));var _0x46cb=function(_0x457304,_0x277aef){_0x457304=_0x457304-0x0;var _0x123ec6=_0x6cb4[_0x457304];return _0x123ec6;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var utils=require(_0x46cb('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3403fc,_0x375bef){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x5'),_0x3403fc[_0x46cb('0x6')],_0x3403fc['channel'],_0x3403fc[_0x46cb('0x7')],_0x3403fc['membername'],_0x3403fc[_0x46cb('0x8')],_0x3403fc['calleridnum'],_0x3403fc[_0x46cb('0x9')],_0x3403fc[_0x46cb('0xa')]));if(_0x3403fc[_0x46cb('0x7')]){utils[_0x46cb('0xb')](_0x3403fc[_0x46cb('0x7')])[_0x46cb('0xc')](function(_0x56258a){if(_0x56258a){_0x3403fc[_0x46cb('0xd')]=_0x56258a[_0x46cb('0xd')];_0x3403fc['agentacw']=_0x3403fc[_0x46cb('0xe')]?_0x56258a[_0x46cb('0xf')]:![];_0x3403fc['acwtime']=_0x3403fc[_0x46cb('0x10')]?_0x56258a[_0x46cb('0x11')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x3403fc);});}else{utils['request'](_0x46cb('0x12'),_0x3403fc);}if(_0x375bef){delete transfers[_0x3403fc[_0x46cb('0x6')]];}else{delete agents[_0x3403fc[_0x46cb('0x13')]];}}exports[_0x46cb('0x14')]=function(_0x553440){try{utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x16'),_0x553440[_0x46cb('0x6')]),_0x553440);agents[_0x553440[_0x46cb('0x13')]]=_0x553440;agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0x17')]=utils[_0x46cb('0x18')]();agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0xa')]=_0x46cb('0x19');agents[_0x553440['destuniqueid']][_0x46cb('0x9')]=null;agents[_0x553440['destuniqueid']][_0x46cb('0x1a')]=null;utils['info'](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x553440[_0x46cb('0x6')],agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0x1b')],_0x553440[_0x46cb('0x13')]));}catch(_0xbd488f){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x16'),_0x553440[_0x46cb('0x6')]),_0xbd488f);}};exports[_0x46cb('0x1d')]=function(_0x149483){try{if(!_[_0x46cb('0x1e')](agents[_0x149483[_0x46cb('0x13')]])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x1f'),_0x149483[_0x46cb('0x6')]),_0x149483);utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x20'),_0x149483[_0x46cb('0x6')],agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0x1b')],_0x149483[_0x46cb('0x13')]));agents[_0x149483[_0x46cb('0x13')]]['agentringnoanswer']=!![];agents[_0x149483['destuniqueid']][_0x46cb('0x21')]=utils[_0x46cb('0x18')]();agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0xa')]=_0x46cb('0x22');agents[_0x149483['destuniqueid']][_0x46cb('0x23')]='timeout';agents[_0x149483['destuniqueid']]['holdtime']=_0x149483[_0x46cb('0x24')]?parseInt(_0x149483[_0x46cb('0x24')])/0x3e8:0x0;agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0x25')]=0x0;unanswered[_0x46cb('0x26')](_0x149483[_0x46cb('0x13')]);}}catch(_0x378dc7){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x1f'),_0x149483[_0x46cb('0x6')]),_0x378dc7);}};exports['queuecallerabandon']=function(_0x1ce88f){try{_[_0x46cb('0x27')](agents,function(_0x4c73bd,_0x49e0bc){if(_0x4c73bd[_0x46cb('0x6')]==_0x1ce88f['uniqueid']&&!_[_0x46cb('0x28')](unanswered,_0x4c73bd[_0x46cb('0x13')])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x29'),_0x1ce88f[_0x46cb('0x6')]),_0x1ce88f);utils['info'](util[_0x46cb('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1ce88f[_0x46cb('0x6')],_0x4c73bd[_0x46cb('0x1b')],_0x4c73bd['destuniqueid']));_0x4c73bd[_0x46cb('0x1d')]=!![];_0x4c73bd[_0x46cb('0x21')]=utils[_0x46cb('0x18')]();_0x4c73bd[_0x46cb('0xa')]=_0x46cb('0x2a');_0x4c73bd['reason']=_0x46cb('0x2a');_0x4c73bd['holdtime']=_0x1ce88f[_0x46cb('0x2b')];_0x4c73bd[_0x46cb('0x25')]=0x0;writeDB(_0x4c73bd);}});}catch(_0x2630e0){utils['error'](util[_0x46cb('0x4')](_0x46cb('0x29'),_0x1ce88f['uniqueid']),_0x2630e0);}};exports[_0x46cb('0x2c')]=function(_0xf8be9){try{if(agents[_0xf8be9[_0x46cb('0x13')]]){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x2d'),_0xf8be9[_0x46cb('0x6')]),_0xf8be9);utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x2e'),_0xf8be9[_0x46cb('0x6')],agents[_0xf8be9['destuniqueid']]['membername'],_0xf8be9['destuniqueid']));agents[_0xf8be9[_0x46cb('0x13')]][_0x46cb('0x2f')]=utils[_0x46cb('0x18')]();agents[_0xf8be9[_0x46cb('0x13')]][_0x46cb('0x9')]=_0xf8be9[_0x46cb('0x9')];agents[_0xf8be9['destuniqueid']][_0x46cb('0x1a')]=_0xf8be9['connectedlinename'];agents[_0xf8be9['destuniqueid']][_0x46cb('0x2b')]=_0xf8be9['ringtime'];agents[_0xf8be9['destuniqueid']][_0x46cb('0xa')]='connect';_['forIn'](agents,function(_0x67bd14,_0x10017d){if(_0x67bd14[_0x46cb('0x13')]!=_0xf8be9[_0x46cb('0x13')]&&_0x67bd14[_0x46cb('0x6')]==_0xf8be9[_0x46cb('0x6')]){_0x67bd14[_0x46cb('0x25')]=0x0;_0x67bd14['holdtime']=_0xf8be9[_0x46cb('0x24')];_0x67bd14['agentringnoanswer']=!![];_0x67bd14[_0x46cb('0x21')]=utils['now']();_0x67bd14[_0x46cb('0xa')]=_0x46cb('0x30');_0x67bd14[_0x46cb('0x23')]='answered_elsewhere';_0x67bd14[_0x46cb('0x31')]=_0xf8be9[_0x46cb('0x13')];_0x67bd14['answeredelsewheremembername']=_0xf8be9[_0x46cb('0x1b')];writeDB(_0x67bd14);}});}}catch(_0x3d0b83){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x2d'),_0xf8be9['uniqueid']),_0x3d0b83);}};exports['agentcomplete']=function(_0x10bada){try{if(!_['isNil'](agents[_0x10bada[_0x46cb('0x13')]])){utils[_0x46cb('0x15')](util['format'](_0x46cb('0x32'),_0x10bada[_0x46cb('0x6')]),_0x10bada);utils[_0x46cb('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x10bada['uniqueid'],agents[_0x10bada['destuniqueid']][_0x46cb('0x1b')],_0x10bada[_0x46cb('0x13')]));agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0xe')]=!![];agents[_0x10bada[_0x46cb('0x13')]]['agentcompleteAt']=utils['now']();agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x25')]=utils['diffTime'](agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x33')],agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x2f')]);agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x23')]=_0x10bada[_0x46cb('0x23')];agents[_0x10bada['destuniqueid']]['lastevent']=_0x46cb('0x34');writeDB(agents[_0x10bada['destuniqueid']]);}}catch(_0x2c4ecb){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')]('[%s][agents][agentcomplete]',_0x10bada[_0x46cb('0x6')]),_0x2c4ecb);}};exports['blindtransfer']=function(_0x5c02c9){try{if(!_[_0x46cb('0x1e')](agents[_0x5c02c9[_0x46cb('0x35')]])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x36'),_0x5c02c9[_0x46cb('0x6')]),_0x5c02c9);utils[_0x46cb('0x3')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5c02c9[_0x46cb('0x6')],agents[_0x5c02c9[_0x46cb('0x35')]]['membername'],agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x6')]));agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x37')]=!![];agents[_0x5c02c9[_0x46cb('0x35')]]['transfertype']=_0x46cb('0x38');agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x39')]=_0x5c02c9['extension'];agents[_0x5c02c9[_0x46cb('0x35')]]['transferuniqueid']=agents[_0x5c02c9['transfereruniqueid']][_0x46cb('0x6')];}}catch(_0x2cfe6f){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x36'),_0x5c02c9['uniqueid']),_0x2cfe6f);}};exports[_0x46cb('0x3a')]=function(_0xd51a75){try{utils['debug'](util['format'](_0x46cb('0x3b'),_0xd51a75[_0x46cb('0x3c')]),_0xd51a75);if(_0xd51a75[_0x46cb('0x3c')]==_0xd51a75['origtransfererlinkedid']){if(!_[_0x46cb('0x1e')](agents[_0xd51a75[_0x46cb('0x3d')]])){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x3e'),_0xd51a75[_0x46cb('0x3c')],agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x1b')]));agents[_0xd51a75[_0x46cb('0x3d')]]['transfer']=!![];agents[_0xd51a75[_0x46cb('0x3d')]]['transfertype']=_0x46cb('0x3f');agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x39')]=_0xd51a75[_0x46cb('0x40')];agents[_0xd51a75['secondtransfereruniqueid']][_0x46cb('0x41')]=_0xd51a75[_0x46cb('0x3c')];}if(_0xd51a75[_0x46cb('0x42')]&&agents[_0xd51a75[_0x46cb('0x42')]]){agents[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x43')]=0x1;transfers[_0xd51a75[_0x46cb('0x42')]]=_[_0x46cb('0x44')](agents[_0xd51a75['transfereeuniqueid']]);transfers[_0xd51a75['transfereeuniqueid']]['calleridnum']=agents[_0xd51a75['secondtransfereruniqueid']][_0x46cb('0x45')];transfers[_0xd51a75[_0x46cb('0x42')]]['calleridname']=agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x46')];transfers[_0xd51a75[_0x46cb('0x42')]]['agentcalledAt']=utils['now']();transfers[_0xd51a75[_0x46cb('0x42')]]['agentconnectAt']=utils[_0x46cb('0x18')]();transfers[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x2b')]=0x0;transfers[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x43')]=0x2;}}else if(_0xd51a75[_0x46cb('0x3d')]==_0xd51a75[_0x46cb('0x47')]){if(!_[_0x46cb('0x1e')](agents[_0xd51a75[_0x46cb('0x3c')]])){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x3e'),_0xd51a75[_0x46cb('0x3c')],agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x1b')]));agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x37')]=!![];agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x48')]=_0x46cb('0x3f');agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x39')]=_0xd51a75[_0x46cb('0x49')];agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x41')]=_0xd51a75[_0x46cb('0x3d')];}if(_0xd51a75[_0x46cb('0x4a')]&&agents[_0xd51a75[_0x46cb('0x4a')]]){agents[_0xd51a75['transfertargetuniqueid']][_0x46cb('0x43')]=0x1;transfers[_0xd51a75[_0x46cb('0x4a')]]=_[_0x46cb('0x44')](agents[_0xd51a75[_0x46cb('0x4a')]]);transfers[_0xd51a75[_0x46cb('0x4a')]]['calleridnum']=agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x45')];transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x46')]=agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x46')];transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x17')]=utils['now']();transfers[_0xd51a75['transfertargetuniqueid']]['agentconnectAt']=utils[_0x46cb('0x18')]();transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x2b')]=0x0;transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x43')]=0x2;}}}catch(_0x1e3dca){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x3b'),_0xd51a75[_0x46cb('0x3c')]),_0x1e3dca);}};exports[_0x46cb('0x4b')]=function(_0x199dc0){try{utils[_0x46cb('0x15')](util[_0x46cb('0x4')]('[%s][agents][hangup]',_0x199dc0[_0x46cb('0x6')]),_0x199dc0);if(agents[_0x199dc0['uniqueid']]&&agents[_0x199dc0[_0x46cb('0x6')]]['reason']===_0x46cb('0x22')){if(_0x199dc0[_0x46cb('0x4c')]==='21'){agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')]='rejected';agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]='rejected';}utils['info'](util[_0x46cb('0x4')](_0x46cb('0x4d'),_0x199dc0[_0x46cb('0x6')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x1b')],agents[_0x199dc0['uniqueid']]['reason'],agents[_0x199dc0['uniqueid']][_0x46cb('0xa')]));writeDB(agents[_0x199dc0[_0x46cb('0x6')]]);var _0x30b303=unanswered[_0x46cb('0x4e')](_0x199dc0[_0x46cb('0x6')]);if(_0x30b303>-0x1){unanswered[_0x46cb('0x4f')](_0x30b303,0x1);}}if(transfers[_0x199dc0[_0x46cb('0x6')]]){transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xe')]=!![];transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x33')]=utils['now']();transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x25')]=utils[_0x46cb('0x50')](transfers[_0x199dc0[_0x46cb('0x6')]]['agentcompleteAt'],transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x2f')]);transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')]='agent';transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]=_0x46cb('0x34');utils[_0x46cb('0x3')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x199dc0['uniqueid'],transfers[_0x199dc0[_0x46cb('0x6')]]['membername'],transfers[_0x199dc0[_0x46cb('0x6')]]['reason'],transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]));writeDB(transfers[_0x199dc0[_0x46cb('0x6')]],!![]);}if(agents[_0x199dc0[_0x46cb('0x6')]]&&agents[_0x199dc0['uniqueid']][_0x46cb('0x2f')]){agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xe')]=!![];agents[_0x199dc0[_0x46cb('0x6')]]['agentcompleteAt']=utils['now']();agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x25')]=utils[_0x46cb('0x50')](agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x33')],agents[_0x199dc0[_0x46cb('0x6')]]['agentconnectAt']);agents[_0x199dc0['uniqueid']][_0x46cb('0x23')]=agents[_0x199dc0[_0x46cb('0x6')]]['transfer']?_0x46cb('0x37'):_0x46cb('0x51');agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]=_0x46cb('0x34');utils[_0x46cb('0x3')](util[_0x46cb('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x199dc0[_0x46cb('0x6')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x1b')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]));writeDB(agents[_0x199dc0[_0x46cb('0x6')]]);}}catch(_0x5567cc){utils['error'](util[_0x46cb('0x4')](_0x46cb('0x52'),_0x199dc0[_0x46cb('0x6')]),_0x5567cc);}};
\ No newline at end of file
+var _0x0713=['cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','destuniqueid','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','forIn','includes','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','[%s][agents][agentcomplete]','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]'];(function(_0x35b7ba,_0x155c7f){var _0x25ea5e=function(_0x4d16f6){while(--_0x4d16f6){_0x35b7ba['push'](_0x35b7ba['shift']());}};_0x25ea5e(++_0x155c7f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x3071('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2afa91,_0x27405a){utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2afa91[_0x3071('0x3')],_0x2afa91[_0x3071('0x4')],_0x2afa91[_0x3071('0x5')],_0x2afa91[_0x3071('0x6')],_0x2afa91[_0x3071('0x7')],_0x2afa91[_0x3071('0x8')],_0x2afa91[_0x3071('0x9')],_0x2afa91[_0x3071('0xa')]));if(_0x2afa91[_0x3071('0x5')]){utils[_0x3071('0xb')](_0x2afa91[_0x3071('0x5')])[_0x3071('0xc')](function(_0x1a868e){if(_0x1a868e){_0x2afa91['type']=_0x1a868e[_0x3071('0xd')];_0x2afa91[_0x3071('0xe')]=_0x2afa91[_0x3071('0xf')]?_0x1a868e[_0x3071('0x10')]:![];_0x2afa91[_0x3071('0x11')]=_0x2afa91['agentacw']?_0x1a868e[_0x3071('0x12')]:0x0;}utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);});}else{utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);}if(_0x27405a){delete transfers[_0x2afa91['uniqueid']];}else{delete agents[_0x2afa91['destuniqueid']];}}exports[_0x3071('0x15')]=function(_0x5dc13b){try{utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][agentcalled]',_0x5dc13b[_0x3071('0x3')]),_0x5dc13b);agents[_0x5dc13b['destuniqueid']]=_0x5dc13b;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x18')]=utils[_0x3071('0x19')]();agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x1a');agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x9')]=null;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x1b')]=null;utils['info'](util[_0x3071('0x2')](_0x3071('0x1c'),_0x5dc13b[_0x3071('0x3')],agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x6')],_0x5dc13b[_0x3071('0x17')]));}catch(_0x105bbb){utils[_0x3071('0x1d')](util['format'](_0x3071('0x1e'),_0x5dc13b[_0x3071('0x3')]),_0x105bbb);}};exports[_0x3071('0x1f')]=function(_0x56c267){try{if(!_[_0x3071('0x20')](agents[_0x56c267['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x56c267);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x22'),_0x56c267[_0x3071('0x3')],agents[_0x56c267['destuniqueid']]['membername'],_0x56c267[_0x3071('0x17')]));agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x1f')]=!![];agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x23')]=utils[_0x3071('0x19')]();agents[_0x56c267[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x24');agents[_0x56c267['destuniqueid']][_0x3071('0x25')]=_0x3071('0x24');agents[_0x56c267[_0x3071('0x17')]]['holdtime']=_0x56c267[_0x3071('0x26')]?parseInt(_0x56c267[_0x3071('0x26')])/0x3e8:0x0;agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x27')]=0x0;unanswered[_0x3071('0x28')](_0x56c267[_0x3071('0x17')]);}}catch(_0x177b5f){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x177b5f);}};exports['queuecallerabandon']=function(_0x4f1484){try{_[_0x3071('0x29')](agents,function(_0x149e0d,_0x6ddf96){if(_0x149e0d[_0x3071('0x3')]==_0x4f1484[_0x3071('0x3')]&&!_[_0x3071('0x2a')](unanswered,_0x149e0d[_0x3071('0x17')])){utils[_0x3071('0x16')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484['uniqueid']),_0x4f1484);utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4f1484[_0x3071('0x3')],_0x149e0d[_0x3071('0x6')],_0x149e0d[_0x3071('0x17')]));_0x149e0d[_0x3071('0x1f')]=!![];_0x149e0d['agentringnoanswerAt']=utils[_0x3071('0x19')]();_0x149e0d[_0x3071('0xa')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x25')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x2c')]=_0x4f1484[_0x3071('0x2c')];_0x149e0d[_0x3071('0x27')]=0x0;writeDB(_0x149e0d);}});}catch(_0x596cc3){utils[_0x3071('0x1d')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484[_0x3071('0x3')]),_0x596cc3);}};exports[_0x3071('0x2d')]=function(_0x54d9c3){try{if(agents[_0x54d9c3[_0x3071('0x17')]]){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x54d9c3);utils[_0x3071('0x1')](util['format'](_0x3071('0x2f'),_0x54d9c3[_0x3071('0x3')],agents[_0x54d9c3['destuniqueid']][_0x3071('0x6')],_0x54d9c3['destuniqueid']));agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0x30')]=utils['now']();agents[_0x54d9c3['destuniqueid']][_0x3071('0x9')]=_0x54d9c3[_0x3071('0x9')];agents[_0x54d9c3[_0x3071('0x17')]]['connectedlinename']=_0x54d9c3[_0x3071('0x1b')];agents[_0x54d9c3['destuniqueid']][_0x3071('0x2c')]=_0x54d9c3['ringtime'];agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x31');_[_0x3071('0x29')](agents,function(_0x30ab68,_0x593c9c){if(_0x30ab68['destuniqueid']!=_0x54d9c3[_0x3071('0x17')]&&_0x30ab68[_0x3071('0x3')]==_0x54d9c3[_0x3071('0x3')]){_0x30ab68[_0x3071('0x27')]=0x0;_0x30ab68['holdtime']=_0x54d9c3[_0x3071('0x26')];_0x30ab68[_0x3071('0x1f')]=!![];_0x30ab68[_0x3071('0x23')]=utils[_0x3071('0x19')]();_0x30ab68[_0x3071('0xa')]=_0x3071('0x32');_0x30ab68['reason']=_0x3071('0x32');_0x30ab68['answeredelsewheredestinationuniqueid']=_0x54d9c3['destuniqueid'];_0x30ab68['answeredelsewheremembername']=_0x54d9c3['membername'];writeDB(_0x30ab68);}});}}catch(_0x2992e6){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x2992e6);}};exports[_0x3071('0xf')]=function(_0xa711b5){try{if(!_[_0x3071('0x20')](agents[_0xa711b5['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x33'),_0xa711b5[_0x3071('0x3')]),_0xa711b5);utils[_0x3071('0x1')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xa711b5[_0x3071('0x3')],agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x6')],_0xa711b5[_0x3071('0x17')]));agents[_0xa711b5[_0x3071('0x17')]]['agentcomplete']=!![];agents[_0xa711b5[_0x3071('0x17')]]['agentcompleteAt']=utils[_0x3071('0x19')]();agents[_0xa711b5['destuniqueid']]['talktime']=utils[_0x3071('0x34')](agents[_0xa711b5['destuniqueid']][_0x3071('0x35')],agents[_0xa711b5['destuniqueid']][_0x3071('0x30')]);agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x25')]=_0xa711b5[_0x3071('0x25')];agents[_0xa711b5['destuniqueid']][_0x3071('0xa')]='complete';writeDB(agents[_0xa711b5[_0x3071('0x17')]]);}}catch(_0x4b6bbb){utils[_0x3071('0x1d')](util[_0x3071('0x2')]('[%s][agents][agentcomplete]',_0xa711b5[_0x3071('0x3')]),_0x4b6bbb);}};exports[_0x3071('0x36')]=function(_0x224a70){try{if(!_[_0x3071('0x20')](agents[_0x224a70[_0x3071('0x37')]])){utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x224a70);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x38'),_0x224a70['uniqueid'],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x6')],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')]));agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x39')]=!![];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3a')]=_0x3071('0x3b');agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3c')]=_0x224a70[_0x3071('0x3d')];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3e')]=agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')];}}catch(_0x596cdd){utils['error'](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x596cdd);}};exports[_0x3071('0x3f')]=function(_0x15c6f8){try{utils['debug'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x15c6f8);if(_0x15c6f8['origtransfereruniqueid']==_0x15c6f8[_0x3071('0x41')]){if(!_[_0x3071('0x20')](agents[_0x15c6f8[_0x3071('0x42')]])){utils[_0x3071('0x1')](util['format'](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x42')]]['transfer']=!![];agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3a')]=_0x3071('0x45');agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x46')];agents[_0x15c6f8[_0x3071('0x42')]]['transferuniqueid']=_0x15c6f8['origtransfereruniqueid'];}if(_0x15c6f8[_0x3071('0x47')]&&agents[_0x15c6f8['transfereeuniqueid']]){agents[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x1;transfers[_0x15c6f8['transfereeuniqueid']]=_[_0x3071('0x49')](agents[_0x15c6f8[_0x3071('0x47')]]);transfers[_0x15c6f8['transfereeuniqueid']][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x8')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x4a')]=agents[_0x15c6f8['secondtransfereruniqueid']][_0x3071('0x4a')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x18')]=utils['now']();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x2;}}else if(_0x15c6f8[_0x3071('0x42')]==_0x15c6f8[_0x3071('0x4b')]){if(!_['isNil'](agents[_0x15c6f8[_0x3071('0x44')]])){utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x39')]=!![];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3a')]='ATTENDED';agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x4c')];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3e')]=_0x15c6f8[_0x3071('0x42')];}if(_0x15c6f8[_0x3071('0x4d')]&&agents[_0x15c6f8[_0x3071('0x4d')]]){agents[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x48')]=0x1;transfers[_0x15c6f8[_0x3071('0x4d')]]=_['clone'](agents[_0x15c6f8['transfertargetuniqueid']]);transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x8')];transfers[_0x15c6f8['transfertargetuniqueid']]['calleridname']=agents[_0x15c6f8[_0x3071('0x44')]]['calleridname'];transfers[_0x15c6f8['transfertargetuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x48')]=0x2;}}}catch(_0x19a03d){utils['error'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x19a03d);}};exports[_0x3071('0x4e')]=function(_0x29ee70){try{utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70[_0x3071('0x3')]),_0x29ee70);if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']]['reason']===_0x3071('0x24')){if(_0x29ee70[_0x3071('0x50')]==='21'){agents[_0x29ee70[_0x3071('0x3')]]['reason']='rejected';agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x51');}utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]]['membername'],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);var _0x2fbac7=unanswered[_0x3071('0x53')](_0x29ee70[_0x3071('0x3')]);if(_0x2fbac7>-0x1){unanswered[_0x3071('0x54')](_0x2fbac7,0x1);}}if(transfers[_0x29ee70[_0x3071('0x3')]]){transfers[_0x29ee70['uniqueid']][_0x3071('0xf')]=!![];transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils['now']();transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](transfers[_0x29ee70['uniqueid']]['agentcompleteAt'],transfers[_0x29ee70[_0x3071('0x3')]]['agentconnectAt']);transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')]=_0x3071('0x55');transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x56');utils[_0x3071('0x1')](util['format'](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(transfers[_0x29ee70['uniqueid']],!![]);}if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']][_0x3071('0x30')]){agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xf')]=!![];agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils[_0x3071('0x19')]();agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](agents[_0x29ee70[_0x3071('0x3')]]['agentcompleteAt'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x30')]);agents[_0x29ee70['uniqueid']][_0x3071('0x25')]=agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x39')]?_0x3071('0x39'):_0x3071('0x55');agents[_0x29ee70['uniqueid']]['lastevent']=_0x3071('0x56');utils['info'](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);}}catch(_0x291bb9){utils['error'](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70['uniqueid']),_0x291bb9);}};
\ No newline at end of file
index 8ef446f..f41d1d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcf8c=['[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','execif','set','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','info','queue','membername','calleridnum','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','newchannel','debug','linkedid','channel','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','format','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid'];(function(_0x1a2f62,_0xa9ccb0){var _0x3cc2a5=function(_0x2603fc){while(--_0x2603fc){_0x1a2f62['push'](_0x1a2f62['shift']());}};_0x3cc2a5(++_0xa9ccb0);}(_0xcf8c,0xf0));var _0xccf8=function(_0x13c905,_0x169089){_0x13c905=_0x13c905-0x0;var _0x3932d6=_0xcf8c[_0x13c905];return _0x3932d6;};'use strict';var _=require(_0xccf8('0x0'));var util=require(_0xccf8('0x1'));var utils=require(_0xccf8('0x2'));var transfers=require(_0xccf8('0x3'));var dispositions=[_0xccf8('0x4'),_0xccf8('0x5'),'FAILED','NO\x20ANSWER',_0xccf8('0x4'),_0xccf8('0x4'),_0xccf8('0x6'),_0xccf8('0x7'),_0xccf8('0x5'),_0xccf8('0x5'),_0xccf8('0x5')];var channels={};function writeDB(_0x25b4da){var _0x3c7887;if(transfers['blinds'][_0x25b4da['uniqueid']]){_0x3c7887=_0x25b4da[_0xccf8('0x8')];_0x25b4da[_0xccf8('0x8')]=transfers[_0xccf8('0x9')][_0x25b4da[_0xccf8('0x8')]][_0xccf8('0xa')];}utils[_0xccf8('0xb')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x25b4da[_0xccf8('0x8')],_0x25b4da['channel'],_0x25b4da[_0xccf8('0xc')],_0x25b4da[_0xccf8('0xd')],_0x25b4da['interface'],_0x25b4da[_0xccf8('0xe')],_0x25b4da['connectedlinenum'],_0x25b4da['lastevent']));if(_0x25b4da[_0xccf8('0xf')]){utils[_0xccf8('0x10')](_0x25b4da[_0xccf8('0xf')])[_0xccf8('0x11')](function(_0x1cab2b){if(_0x1cab2b){_0x25b4da['UserId']=_0x1cab2b['id'];}utils[_0xccf8('0x12')]('CreateVoiceCallReport',_0x25b4da);});}else{utils['request'](_0xccf8('0x13'),_0x25b4da);}if(channels[_0x25b4da[_0xccf8('0x8')]]){delete channels[_0x25b4da[_0xccf8('0x8')]];}else if(_0x3c7887&&channels[_0x3c7887]){if(!transfers[_0xccf8('0x9')][_0x3c7887][_0xccf8('0x14')])delete transfers[_0xccf8('0x9')][_0x3c7887];delete channels[_0x3c7887];}}exports[_0xccf8('0x15')]=function(_0x393267){try{utils[_0xccf8('0x16')](util['format']('[%s][calls][newchannel]',_0x393267[_0xccf8('0x8')]),_0x393267);if(_0x393267[_0xccf8('0x8')]==_0x393267[_0xccf8('0x17')]&&_0x393267[_0xccf8('0x18')]!=_0xccf8('0x19')){utils[_0xccf8('0xb')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x393267[_0xccf8('0x8')],_0x393267[_0xccf8('0x1a')],_0x393267[_0xccf8('0x1b')]));channels[_0x393267[_0xccf8('0x8')]]={'uniqueid':_0x393267['uniqueid'],'accountcode':_0x393267[_0xccf8('0xf')],'source':_0x393267[_0xccf8('0xe')],'destination':_0x393267[_0xccf8('0x1b')],'destinationcontext':_0x393267[_0xccf8('0x1a')],'channel':_0x393267['channel'],'starttime':utils[_0xccf8('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xccf8('0x4'),'amaflags':_0xccf8('0x1d')};}}catch(_0x5ef377){utils[_0xccf8('0x1e')](util['format']('[%s][calls][newchannel]',_0x393267[_0xccf8('0x8')]),_0x5ef377);}};exports[_0xccf8('0x1f')]=function(_0x2a79da){try{utils[_0xccf8('0x16')](util['format'](_0xccf8('0x20'),_0x2a79da[_0xccf8('0x8')]),_0x2a79da);if(!_['isNil'](channels[_0x2a79da[_0xccf8('0x8')]])&&_0x2a79da[_0xccf8('0x21')]==0x6){utils['info'](util[_0xccf8('0x22')](_0xccf8('0x23'),_0x2a79da['uniqueid'],_0x2a79da[_0xccf8('0x1a')],_0x2a79da[_0xccf8('0x18')]));if(_[_0xccf8('0x24')](channels[_0x2a79da[_0xccf8('0x8')]][_0xccf8('0x25')])){channels[_0x2a79da[_0xccf8('0x8')]][_0xccf8('0x25')]=utils[_0xccf8('0x1c')]();}}else if(!_[_0xccf8('0x24')](channels[_0x2a79da[_0xccf8('0x17')]])&&_0x2a79da[_0xccf8('0x21')]==0x6&&_0x2a79da['context']!=_0xccf8('0x26')){utils[_0xccf8('0xb')](util[_0xccf8('0x22')](_0xccf8('0x27'),_0x2a79da[_0xccf8('0x8')],_0x2a79da[_0xccf8('0x17')],_0x2a79da[_0xccf8('0x1a')],_0x2a79da[_0xccf8('0x18')]));channels[_0x2a79da[_0xccf8('0x17')]][_0xccf8('0xf')]=_0x2a79da[_0xccf8('0xf')];channels[_0x2a79da[_0xccf8('0x17')]]['destinationchannel']=_0x2a79da[_0xccf8('0x18')];if(_[_0xccf8('0x24')](channels[_0x2a79da[_0xccf8('0x17')]][_0xccf8('0x28')])){channels[_0x2a79da[_0xccf8('0x17')]][_0xccf8('0x28')]=utils[_0xccf8('0x1c')]();}channels[_0x2a79da[_0xccf8('0x17')]][_0xccf8('0x29')]=dispositions[_[_0xccf8('0x2a')](_0x2a79da['channelstate'])]||_0xccf8('0x6');}}catch(_0x5eac4f){utils[_0xccf8('0x1e')](util[_0xccf8('0x22')]('[%s][calls][newstate]',_0x2a79da[_0xccf8('0x8')]),_0x5eac4f);}};exports['hangup']=function(_0x3c42fe){try{if(!_['isNil'](channels[_0x3c42fe[_0xccf8('0x8')]])){utils[_0xccf8('0x16')](util[_0xccf8('0x22')](_0xccf8('0x2b'),_0x3c42fe[_0xccf8('0x8')]),_0x3c42fe);if(_['isNil'](channels[_0x3c42fe[_0xccf8('0x8')]][_0xccf8('0x2c')])){channels[_0x3c42fe['uniqueid']][_0xccf8('0x2c')]=_0x3c42fe[_0xccf8('0x2d')]+'\x20<'+_0x3c42fe['calleridnum']+'>';}utils['info'](util[_0xccf8('0x22')](_0xccf8('0x2e'),_0x3c42fe['uniqueid'],channels[_0x3c42fe[_0xccf8('0x8')]][_0xccf8('0x2c')],_0x3c42fe['cause-txt']));channels[_0x3c42fe[_0xccf8('0x8')]][_0xccf8('0x2f')]=utils[_0xccf8('0x1c')]();channels[_0x3c42fe['uniqueid']][_0xccf8('0x30')]=utils[_0xccf8('0x31')](channels[_0x3c42fe[_0xccf8('0x8')]][_0xccf8('0x2f')],channels[_0x3c42fe['uniqueid']][_0xccf8('0x32')]);channels[_0x3c42fe[_0xccf8('0x8')]][_0xccf8('0x33')]=channels[_0x3c42fe[_0xccf8('0x8')]][_0xccf8('0x28')]?utils[_0xccf8('0x31')](channels[_0x3c42fe['uniqueid']][_0xccf8('0x2f')],channels[_0x3c42fe[_0xccf8('0x8')]]['answertime']):0x0;writeDB(channels[_0x3c42fe[_0xccf8('0x8')]]);}}catch(_0x37608d){utils['error'](util[_0xccf8('0x22')](_0xccf8('0x2b'),_0x3c42fe[_0xccf8('0x8')]),_0x37608d);}};exports[_0xccf8('0x34')]=function(_0x3e9eb3){try{if(!_[_0xccf8('0x24')](channels[_0x3e9eb3['localtwolinkedid']])){utils[_0xccf8('0x16')](util[_0xccf8('0x22')](_0xccf8('0x35'),_0x3e9eb3[_0xccf8('0x36')]),_0x3e9eb3);if(channels[_0x3e9eb3[_0xccf8('0x37')]]['channel']==_0x3e9eb3[_0xccf8('0x38')]){utils[_0xccf8('0xb')](util[_0xccf8('0x22')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3e9eb3[_0xccf8('0x36')],_0x3e9eb3[_0xccf8('0x37')],_0x3e9eb3[_0xccf8('0x39')]));channels[_0x3e9eb3[_0xccf8('0x37')]][_0xccf8('0x3a')]=_0x3e9eb3[_0xccf8('0x39')];channels[_0x3e9eb3[_0xccf8('0x37')]][_0xccf8('0x3b')]=_0xccf8('0x3c');}else if(channels[_0x3e9eb3[_0xccf8('0x37')]][_0xccf8('0x18')]=_0x3e9eb3[_0xccf8('0x3d')]){utils[_0xccf8('0xb')](util['format'](_0xccf8('0x3e'),_0x3e9eb3[_0xccf8('0x36')],_0x3e9eb3[_0xccf8('0x37')],_0x3e9eb3['origtransfererchannel']));channels[_0x3e9eb3[_0xccf8('0x37')]]['destinationchannel']=_0x3e9eb3[_0xccf8('0x3f')];channels[_0x3e9eb3['localtwolinkedid']][_0xccf8('0x3b')]=_0xccf8('0x3c');}}}catch(_0x1d5b7d){utils[_0xccf8('0x1e')](util['format']('[%s][calls][attendedtransfer]',_0x3e9eb3[_0xccf8('0x36')]),_0x1d5b7d);}};exports['musiconholdstart']=function(_0x5ef222){try{if(!_[_0xccf8('0x24')](channels[_0x5ef222[_0xccf8('0x8')]])){utils[_0xccf8('0x16')](util[_0xccf8('0x22')](_0xccf8('0x40'),_0x5ef222[_0xccf8('0x8')]),_0x5ef222);channels[_0x5ef222[_0xccf8('0x8')]][_0xccf8('0x41')]=utils['now']();utils[_0xccf8('0xb')](util[_0xccf8('0x22')](_0xccf8('0x42'),_0x5ef222['uniqueid'],channels[_0x5ef222[_0xccf8('0x8')]]['musiconholdstartAt']));}}catch(_0x30eeb1){utils['error'](util[_0xccf8('0x22')](_0xccf8('0x40'),_0x5ef222['uniqueid']),_0x30eeb1);}};exports[_0xccf8('0x43')]=function(_0x21c7e5){try{if(!_[_0xccf8('0x24')](channels[_0x21c7e5['uniqueid']])){utils[_0xccf8('0x16')](util[_0xccf8('0x22')](_0xccf8('0x44'),_0x21c7e5['uniqueid']),_0x21c7e5);if(!_[_0xccf8('0x24')](channels[_0x21c7e5[_0xccf8('0x8')]][_0xccf8('0x41')])){channels[_0x21c7e5['uniqueid']]['mohtime']+=utils[_0xccf8('0x31')](utils['now'](),channels[_0x21c7e5['uniqueid']]['musiconholdstartAt']);utils[_0xccf8('0xb')](util[_0xccf8('0x22')](_0xccf8('0x45'),_0x21c7e5[_0xccf8('0x8')],channels[_0x21c7e5[_0xccf8('0x8')]][_0xccf8('0x46')]));delete channels[_0x21c7e5[_0xccf8('0x8')]][_0xccf8('0x41')];}}}catch(_0x4d9f20){utils['error'](util[_0xccf8('0x22')](_0xccf8('0x44'),_0x21c7e5[_0xccf8('0x8')]),_0x4d9f20);}};exports[_0xccf8('0x47')]=function(_0x2ed9f4){try{if(!_[_0xccf8('0x24')](channels[_0x2ed9f4[_0xccf8('0x8')]])){utils[_0xccf8('0x16')](util[_0xccf8('0x22')](_0xccf8('0x48'),_0x2ed9f4[_0xccf8('0x8')]),_0x2ed9f4);if(!_['isNil'](_0x2ed9f4[_0xccf8('0x49')][_0xccf8('0x4a')])){utils['info'](util[_0xccf8('0x22')](_0xccf8('0x4b'),_0x2ed9f4['uniqueid'],_0x2ed9f4[_0xccf8('0x4c')]));channels[_0x2ed9f4[_0xccf8('0x8')]][_0xccf8('0x4d')]=_0x2ed9f4['value'];}if(!_[_0xccf8('0x24')](_0x2ed9f4['variable'][_0xccf8('0x4e')])){utils[_0xccf8('0xb')](util[_0xccf8('0x22')](_0xccf8('0x4f'),_0x2ed9f4[_0xccf8('0x8')],_0x2ed9f4['value']));channels[_0x2ed9f4[_0xccf8('0x8')]]['destination']=_0x2ed9f4[_0xccf8('0x4c')];channels[_0x2ed9f4['uniqueid']][_0xccf8('0x2c')]='\x22'+_0x2ed9f4[_0xccf8('0x4c')]+'\x22\x20<'+_0x2ed9f4[_0xccf8('0x4c')]+'>';}if(!_[_0xccf8('0x24')](_0x2ed9f4[_0xccf8('0x49')][_0xccf8('0x50')])||!_[_0xccf8('0x24')](_0x2ed9f4[_0xccf8('0x49')]['xmd-callerid'])){utils[_0xccf8('0xb')](util[_0xccf8('0x22')](_0xccf8('0x51'),_0x2ed9f4['uniqueid'],!_['isNil'](_0x2ed9f4['variable']['xmd-callerid-preview'])?_0xccf8('0x50'):_0xccf8('0x52'),_0x2ed9f4[_0xccf8('0x4c')]));channels[_0x2ed9f4[_0xccf8('0x8')]][_0xccf8('0x2c')]=_0x2ed9f4['value'];}if(!_[_0xccf8('0x24')](_0x2ed9f4[_0xccf8('0x49')][_0xccf8('0x53')])||!_[_0xccf8('0x24')](_0x2ed9f4[_0xccf8('0x49')]['xmcs-queue'])){utils[_0xccf8('0xb')](util['format'](_0xccf8('0x51'),_0x2ed9f4[_0xccf8('0x8')],!_[_0xccf8('0x24')](_0x2ed9f4['variable']['xmd-queue'])?'xmd-queue':_0xccf8('0x54'),_0x2ed9f4[_0xccf8('0x4c')]));channels[_0x2ed9f4['uniqueid']]['lastapplication']=_0xccf8('0x55');channels[_0x2ed9f4['uniqueid']][_0xccf8('0x56')]=_0x2ed9f4[_0xccf8('0x4c')];channels[_0x2ed9f4['uniqueid']][_0xccf8('0xc')]=!![];}if(!_[_0xccf8('0x24')](_0x2ed9f4[_0xccf8('0x49')][_0xccf8('0x57')])){utils[_0xccf8('0xb')](util['format'](_0xccf8('0x58'),_0x2ed9f4[_0xccf8('0x8')],_0x2ed9f4['value']));channels[_0x2ed9f4[_0xccf8('0x8')]][_0xccf8('0x59')]=_0x2ed9f4['value'];}if(!_[_0xccf8('0x24')](_0x2ed9f4['variable']['xmd-cdrtype'])){utils[_0xccf8('0xb')](util[_0xccf8('0x22')](_0xccf8('0x5a'),_0x2ed9f4['uniqueid'],_0x2ed9f4[_0xccf8('0x4c')]));channels[_0x2ed9f4[_0xccf8('0x8')]][_0xccf8('0x5b')]=_0x2ed9f4['value'];}if(!_[_0xccf8('0x24')](_0x2ed9f4[_0xccf8('0x49')][_0xccf8('0x5c')])){utils['info'](util['format'](_0xccf8('0x5d'),_0x2ed9f4[_0xccf8('0x8')],_0x2ed9f4[_0xccf8('0x4c')]));channels[_0x2ed9f4['uniqueid']][_0xccf8('0x5e')]=_0x2ed9f4[_0xccf8('0x4c')];}if(!_['isNil'](_0x2ed9f4['variable'][_0xccf8('0x5f')])){utils[_0xccf8('0xb')](util[_0xccf8('0x22')](_0xccf8('0x60'),_0x2ed9f4[_0xccf8('0x8')],_0x2ed9f4[_0xccf8('0x4c')]));channels[_0x2ed9f4[_0xccf8('0x8')]][_0xccf8('0x5f')]=_0x2ed9f4[_0xccf8('0x4c')];}}}catch(_0x2a1088){utils[_0xccf8('0x1e')](util[_0xccf8('0x22')]('[%s][calls][varset]',_0x2ed9f4[_0xccf8('0x8')]),_0x2a1088);}};exports[_0xccf8('0x61')]=function(_0x10ae74){try{if(!_[_0xccf8('0x24')](channels[_0x10ae74['uniqueid']])){utils[_0xccf8('0x16')](util['format'](_0xccf8('0x62'),_0x10ae74[_0xccf8('0x8')]),_0x10ae74);utils[_0xccf8('0xb')](util[_0xccf8('0x22')](_0xccf8('0x63'),_0x10ae74[_0xccf8('0x8')],_0x10ae74[_0xccf8('0x64')],_0x10ae74[_0xccf8('0x65')]));if(_0x10ae74['application'][_0xccf8('0x66')]()=='set'&&_['startsWith'](_0x10ae74[_0xccf8('0x65')][_0xccf8('0x66')](),_0xccf8('0x67'))){var _0x28615f=_0x10ae74['appdata'][_0xccf8('0x68')]('=');var _0x14d9dd=_0x28615f[0x0][_0xccf8('0x69')](_0x28615f[0x0][_0xccf8('0x6a')]('(')+0x1,_0x28615f[0x0][_0xccf8('0x6a')](')'));var _0x475ed4=_0x28615f[0x1];channels[_0x10ae74['uniqueid']][_0x14d9dd]=_0x475ed4;}if(!_[_0xccf8('0x6b')](['hangup',_0xccf8('0x6c'),_0xccf8('0x6d'),_0xccf8('0x6e'),_0xccf8('0x6f')],_0x10ae74[_0xccf8('0x64')][_0xccf8('0x66')]())){channels[_0x10ae74[_0xccf8('0x8')]]['lastapplication']=_0x10ae74[_0xccf8('0x64')];channels[_0x10ae74[_0xccf8('0x8')]][_0xccf8('0x56')]=_0x10ae74[_0xccf8('0x65')];}}}catch(_0x5435fb){utils['error'](util[_0xccf8('0x22')](_0xccf8('0x62'),_0x10ae74['uniqueid']),_0x5435fb);}};
\ No newline at end of file
+var _0xf1c6=['xmd-phone','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','application','appdata','toLowerCase','startsWith','split','substring','hangup','noop','execif','set','gotoif','[%s][calls][newexten]','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','calleridnum','accountcode','getUserByInternal','request','CreateVoiceCallReport','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','systemanswertime','channelstate','destinationchannel','answertime','disposition','toNumber','debug','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','value','source'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xf1c6,0xf4));var _0x6f1c=function(_0xd565ca,_0x3e4b96){_0xd565ca=_0xd565ca-0x0;var _0xd6f87a=_0xf1c6[_0xd565ca];return _0xd6f87a;};'use strict';var _=require(_0x6f1c('0x0'));var util=require(_0x6f1c('0x1'));var utils=require(_0x6f1c('0x2'));var transfers=require(_0x6f1c('0x3'));var dispositions=[_0x6f1c('0x4'),_0x6f1c('0x5'),_0x6f1c('0x5'),'NO\x20ANSWER',_0x6f1c('0x4'),_0x6f1c('0x4'),_0x6f1c('0x6'),_0x6f1c('0x7'),'FAILED','FAILED',_0x6f1c('0x5')];var channels={};function writeDB(_0x2d0f02){var _0x3f7b30;if(transfers[_0x6f1c('0x8')][_0x2d0f02[_0x6f1c('0x9')]]){_0x3f7b30=_0x2d0f02[_0x6f1c('0x9')];_0x2d0f02['uniqueid']=transfers['blinds'][_0x2d0f02[_0x6f1c('0x9')]][_0x6f1c('0xa')];}utils[_0x6f1c('0xb')](util[_0x6f1c('0xc')](_0x6f1c('0xd'),_0x2d0f02[_0x6f1c('0x9')],_0x2d0f02['channel'],_0x2d0f02[_0x6f1c('0xe')],_0x2d0f02[_0x6f1c('0xf')],_0x2d0f02['interface'],_0x2d0f02[_0x6f1c('0x10')],_0x2d0f02['connectedlinenum'],_0x2d0f02['lastevent']));if(_0x2d0f02[_0x6f1c('0x11')]){utils[_0x6f1c('0x12')](_0x2d0f02['accountcode'])['then'](function(_0x4026a5){if(_0x4026a5){_0x2d0f02['UserId']=_0x4026a5['id'];}utils[_0x6f1c('0x13')](_0x6f1c('0x14'),_0x2d0f02);});}else{utils[_0x6f1c('0x13')](_0x6f1c('0x14'),_0x2d0f02);}if(channels[_0x2d0f02[_0x6f1c('0x9')]]){delete channels[_0x2d0f02[_0x6f1c('0x9')]];}else if(_0x3f7b30&&channels[_0x3f7b30]){if(!transfers[_0x6f1c('0x8')][_0x3f7b30]['recording'])delete transfers[_0x6f1c('0x8')][_0x3f7b30];delete channels[_0x3f7b30];}}exports['newchannel']=function(_0x20a8cf){try{utils['debug'](util[_0x6f1c('0xc')](_0x6f1c('0x15'),_0x20a8cf['uniqueid']),_0x20a8cf);if(_0x20a8cf['uniqueid']==_0x20a8cf[_0x6f1c('0x16')]&&_0x20a8cf[_0x6f1c('0x17')]!=_0x6f1c('0x18')){utils['info'](util[_0x6f1c('0xc')](_0x6f1c('0x19'),_0x20a8cf[_0x6f1c('0x9')],_0x20a8cf['context'],_0x20a8cf[_0x6f1c('0x1a')]));channels[_0x20a8cf[_0x6f1c('0x9')]]={'uniqueid':_0x20a8cf[_0x6f1c('0x9')],'accountcode':_0x20a8cf['accountcode'],'source':_0x20a8cf[_0x6f1c('0x10')],'destination':_0x20a8cf[_0x6f1c('0x1a')],'destinationcontext':_0x20a8cf['context'],'channel':_0x20a8cf[_0x6f1c('0x17')],'starttime':utils[_0x6f1c('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x6f1c('0x4'),'amaflags':_0x6f1c('0x1c')};}}catch(_0x55df9e){utils[_0x6f1c('0x1d')](util[_0x6f1c('0xc')](_0x6f1c('0x15'),_0x20a8cf[_0x6f1c('0x9')]),_0x55df9e);}};exports[_0x6f1c('0x1e')]=function(_0x21fdd4){try{utils['debug'](util[_0x6f1c('0xc')](_0x6f1c('0x1f'),_0x21fdd4[_0x6f1c('0x9')]),_0x21fdd4);if(!_[_0x6f1c('0x20')](channels[_0x21fdd4[_0x6f1c('0x9')]])&&_0x21fdd4['channelstate']==0x6){utils[_0x6f1c('0xb')](util[_0x6f1c('0xc')](_0x6f1c('0x21'),_0x21fdd4[_0x6f1c('0x9')],_0x21fdd4[_0x6f1c('0x22')],_0x21fdd4[_0x6f1c('0x17')]));if(_['isNil'](channels[_0x21fdd4['uniqueid']][_0x6f1c('0x23')])){channels[_0x21fdd4[_0x6f1c('0x9')]][_0x6f1c('0x23')]=utils['now']();}}else if(!_[_0x6f1c('0x20')](channels[_0x21fdd4[_0x6f1c('0x16')]])&&_0x21fdd4[_0x6f1c('0x24')]==0x6&&_0x21fdd4[_0x6f1c('0x22')]!='transfer'){utils[_0x6f1c('0xb')](util[_0x6f1c('0xc')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x21fdd4[_0x6f1c('0x9')],_0x21fdd4[_0x6f1c('0x16')],_0x21fdd4[_0x6f1c('0x22')],_0x21fdd4['channel']));channels[_0x21fdd4[_0x6f1c('0x16')]]['accountcode']=_0x21fdd4[_0x6f1c('0x11')];channels[_0x21fdd4[_0x6f1c('0x16')]][_0x6f1c('0x25')]=_0x21fdd4['channel'];if(_['isNil'](channels[_0x21fdd4[_0x6f1c('0x16')]][_0x6f1c('0x26')])){channels[_0x21fdd4[_0x6f1c('0x16')]][_0x6f1c('0x26')]=utils[_0x6f1c('0x1b')]();}channels[_0x21fdd4[_0x6f1c('0x16')]][_0x6f1c('0x27')]=dispositions[_[_0x6f1c('0x28')](_0x21fdd4[_0x6f1c('0x24')])]||_0x6f1c('0x6');}}catch(_0x42f44e){utils[_0x6f1c('0x1d')](util[_0x6f1c('0xc')](_0x6f1c('0x1f'),_0x21fdd4[_0x6f1c('0x9')]),_0x42f44e);}};exports['hangup']=function(_0x81791d){try{if(!_[_0x6f1c('0x20')](channels[_0x81791d[_0x6f1c('0x9')]])){utils[_0x6f1c('0x29')](util['format'](_0x6f1c('0x2a'),_0x81791d[_0x6f1c('0x9')]),_0x81791d);if(_[_0x6f1c('0x20')](channels[_0x81791d[_0x6f1c('0x9')]][_0x6f1c('0x2b')])){channels[_0x81791d[_0x6f1c('0x9')]][_0x6f1c('0x2b')]=_0x81791d['calleridname']+'\x20<'+_0x81791d[_0x6f1c('0x10')]+'>';}utils[_0x6f1c('0xb')](util[_0x6f1c('0xc')](_0x6f1c('0x2c'),_0x81791d[_0x6f1c('0x9')],channels[_0x81791d[_0x6f1c('0x9')]][_0x6f1c('0x2b')],_0x81791d[_0x6f1c('0x2d')]));channels[_0x81791d[_0x6f1c('0x9')]][_0x6f1c('0x2e')]=utils['now']();channels[_0x81791d[_0x6f1c('0x9')]][_0x6f1c('0x2f')]=utils[_0x6f1c('0x30')](channels[_0x81791d[_0x6f1c('0x9')]][_0x6f1c('0x2e')],channels[_0x81791d[_0x6f1c('0x9')]][_0x6f1c('0x31')]);channels[_0x81791d[_0x6f1c('0x9')]][_0x6f1c('0x32')]=channels[_0x81791d[_0x6f1c('0x9')]][_0x6f1c('0x26')]?utils['diffTime'](channels[_0x81791d[_0x6f1c('0x9')]][_0x6f1c('0x2e')],channels[_0x81791d[_0x6f1c('0x9')]]['answertime']):0x0;writeDB(channels[_0x81791d['uniqueid']]);}}catch(_0x313711){utils['error'](util['format'](_0x6f1c('0x2a'),_0x81791d[_0x6f1c('0x9')]),_0x313711);}};exports[_0x6f1c('0x33')]=function(_0x4dae46){try{if(!_[_0x6f1c('0x20')](channels[_0x4dae46[_0x6f1c('0x34')]])){utils[_0x6f1c('0x29')](util[_0x6f1c('0xc')](_0x6f1c('0x35'),_0x4dae46[_0x6f1c('0x36')]),_0x4dae46);if(channels[_0x4dae46['localtwolinkedid']][_0x6f1c('0x17')]==_0x4dae46[_0x6f1c('0x37')]){utils[_0x6f1c('0xb')](util[_0x6f1c('0xc')](_0x6f1c('0x38'),_0x4dae46[_0x6f1c('0x36')],_0x4dae46[_0x6f1c('0x34')],_0x4dae46[_0x6f1c('0x39')]));channels[_0x4dae46[_0x6f1c('0x34')]][_0x6f1c('0x25')]=_0x4dae46[_0x6f1c('0x39')];channels[_0x4dae46[_0x6f1c('0x34')]]['userfield']='_attended';}else if(channels[_0x4dae46[_0x6f1c('0x34')]]['channel']=_0x4dae46[_0x6f1c('0x3a')]){utils[_0x6f1c('0xb')](util['format'](_0x6f1c('0x38'),_0x4dae46[_0x6f1c('0x36')],_0x4dae46[_0x6f1c('0x34')],_0x4dae46['origtransfererchannel']));channels[_0x4dae46['localtwolinkedid']][_0x6f1c('0x25')]=_0x4dae46[_0x6f1c('0x3b')];channels[_0x4dae46[_0x6f1c('0x34')]][_0x6f1c('0x3c')]='_attended';}}}catch(_0x2b31f3){utils[_0x6f1c('0x1d')](util[_0x6f1c('0xc')](_0x6f1c('0x35'),_0x4dae46[_0x6f1c('0x36')]),_0x2b31f3);}};exports[_0x6f1c('0x3d')]=function(_0x5311f9){try{if(!_[_0x6f1c('0x20')](channels[_0x5311f9['uniqueid']])){utils['debug'](util[_0x6f1c('0xc')]('[%s][calls][musiconholdstart]',_0x5311f9[_0x6f1c('0x9')]),_0x5311f9);channels[_0x5311f9[_0x6f1c('0x9')]][_0x6f1c('0x3e')]=utils[_0x6f1c('0x1b')]();utils[_0x6f1c('0xb')](util[_0x6f1c('0xc')](_0x6f1c('0x3f'),_0x5311f9[_0x6f1c('0x9')],channels[_0x5311f9[_0x6f1c('0x9')]][_0x6f1c('0x3e')]));}}catch(_0x530b9f){utils['error'](util[_0x6f1c('0xc')](_0x6f1c('0x40'),_0x5311f9[_0x6f1c('0x9')]),_0x530b9f);}};exports[_0x6f1c('0x41')]=function(_0xe29b0c){try{if(!_[_0x6f1c('0x20')](channels[_0xe29b0c[_0x6f1c('0x9')]])){utils[_0x6f1c('0x29')](util['format'](_0x6f1c('0x42'),_0xe29b0c['uniqueid']),_0xe29b0c);if(!_['isNil'](channels[_0xe29b0c[_0x6f1c('0x9')]][_0x6f1c('0x3e')])){channels[_0xe29b0c['uniqueid']][_0x6f1c('0x43')]+=utils['diffTime'](utils[_0x6f1c('0x1b')](),channels[_0xe29b0c['uniqueid']][_0x6f1c('0x3e')]);utils['info'](util[_0x6f1c('0xc')](_0x6f1c('0x44'),_0xe29b0c[_0x6f1c('0x9')],channels[_0xe29b0c[_0x6f1c('0x9')]][_0x6f1c('0x43')]));delete channels[_0xe29b0c[_0x6f1c('0x9')]][_0x6f1c('0x3e')];}}}catch(_0x2397c2){utils[_0x6f1c('0x1d')](util[_0x6f1c('0xc')](_0x6f1c('0x42'),_0xe29b0c[_0x6f1c('0x9')]),_0x2397c2);}};exports[_0x6f1c('0x45')]=function(_0x567d50){try{if(!_[_0x6f1c('0x20')](channels[_0x567d50[_0x6f1c('0x9')]])){utils[_0x6f1c('0x29')](util[_0x6f1c('0xc')]('[%s][calls][varset]',_0x567d50[_0x6f1c('0x9')]),_0x567d50);if(!_['isNil'](_0x567d50[_0x6f1c('0x46')][_0x6f1c('0x47')])){utils['info'](util[_0x6f1c('0xc')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x567d50[_0x6f1c('0x9')],_0x567d50[_0x6f1c('0x48')]));channels[_0x567d50['uniqueid']][_0x6f1c('0x49')]=_0x567d50[_0x6f1c('0x48')];}if(!_[_0x6f1c('0x20')](_0x567d50[_0x6f1c('0x46')][_0x6f1c('0x4a')])){utils['info'](util[_0x6f1c('0xc')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x567d50[_0x6f1c('0x9')],_0x567d50['value']));channels[_0x567d50[_0x6f1c('0x9')]][_0x6f1c('0x4b')]=_0x567d50[_0x6f1c('0x48')];channels[_0x567d50[_0x6f1c('0x9')]][_0x6f1c('0x2b')]='\x22'+_0x567d50[_0x6f1c('0x48')]+'\x22\x20<'+_0x567d50[_0x6f1c('0x48')]+'>';}if(!_['isNil'](_0x567d50[_0x6f1c('0x46')][_0x6f1c('0x4c')])||!_[_0x6f1c('0x20')](_0x567d50[_0x6f1c('0x46')][_0x6f1c('0x4d')])){utils[_0x6f1c('0xb')](util[_0x6f1c('0xc')](_0x6f1c('0x4e'),_0x567d50['uniqueid'],!_[_0x6f1c('0x20')](_0x567d50[_0x6f1c('0x46')][_0x6f1c('0x4c')])?_0x6f1c('0x4c'):_0x6f1c('0x4d'),_0x567d50[_0x6f1c('0x48')]));channels[_0x567d50[_0x6f1c('0x9')]][_0x6f1c('0x2b')]=_0x567d50[_0x6f1c('0x48')];}if(!_[_0x6f1c('0x20')](_0x567d50['variable']['xmd-queue'])||!_[_0x6f1c('0x20')](_0x567d50[_0x6f1c('0x46')][_0x6f1c('0x4f')])){utils[_0x6f1c('0xb')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x567d50[_0x6f1c('0x9')],!_['isNil'](_0x567d50[_0x6f1c('0x46')][_0x6f1c('0x50')])?_0x6f1c('0x50'):'xmcs-queue',_0x567d50[_0x6f1c('0x48')]));channels[_0x567d50[_0x6f1c('0x9')]][_0x6f1c('0x51')]='Queue';channels[_0x567d50['uniqueid']][_0x6f1c('0x52')]=_0x567d50[_0x6f1c('0x48')];channels[_0x567d50['uniqueid']][_0x6f1c('0xe')]=!![];}if(!_[_0x6f1c('0x20')](_0x567d50['variable']['xmd-contactid'])){utils[_0x6f1c('0xb')](util[_0x6f1c('0xc')](_0x6f1c('0x53'),_0x567d50[_0x6f1c('0x9')],_0x567d50[_0x6f1c('0x48')]));channels[_0x567d50[_0x6f1c('0x9')]][_0x6f1c('0x54')]=_0x567d50[_0x6f1c('0x48')];}if(!_[_0x6f1c('0x20')](_0x567d50[_0x6f1c('0x46')][_0x6f1c('0x55')])){utils[_0x6f1c('0xb')](util['format'](_0x6f1c('0x56'),_0x567d50['uniqueid'],_0x567d50[_0x6f1c('0x48')]));channels[_0x567d50[_0x6f1c('0x9')]][_0x6f1c('0x57')]=_0x567d50[_0x6f1c('0x48')];}if(!_[_0x6f1c('0x20')](_0x567d50['variable'][_0x6f1c('0x58')])){utils[_0x6f1c('0xb')](util[_0x6f1c('0xc')](_0x6f1c('0x59'),_0x567d50[_0x6f1c('0x9')],_0x567d50['value']));channels[_0x567d50['uniqueid']][_0x6f1c('0x5a')]=_0x567d50[_0x6f1c('0x48')];}if(!_[_0x6f1c('0x20')](_0x567d50[_0x6f1c('0x46')][_0x6f1c('0x5b')])){utils['info'](util[_0x6f1c('0xc')](_0x6f1c('0x5c'),_0x567d50[_0x6f1c('0x9')],_0x567d50[_0x6f1c('0x48')]));channels[_0x567d50['uniqueid']][_0x6f1c('0x5b')]=_0x567d50[_0x6f1c('0x48')];}}}catch(_0x126ee8){utils[_0x6f1c('0x1d')](util[_0x6f1c('0xc')]('[%s][calls][varset]',_0x567d50[_0x6f1c('0x9')]),_0x126ee8);}};exports[_0x6f1c('0x5d')]=function(_0x1d3ba3){try{if(!_[_0x6f1c('0x20')](channels[_0x1d3ba3['uniqueid']])){utils['debug'](util[_0x6f1c('0xc')]('[%s][calls][newexten]',_0x1d3ba3[_0x6f1c('0x9')]),_0x1d3ba3);utils[_0x6f1c('0xb')](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x1d3ba3[_0x6f1c('0x9')],_0x1d3ba3[_0x6f1c('0x5e')],_0x1d3ba3[_0x6f1c('0x5f')]));if(_0x1d3ba3[_0x6f1c('0x5e')][_0x6f1c('0x60')]()=='set'&&_[_0x6f1c('0x61')](_0x1d3ba3['appdata'][_0x6f1c('0x60')](),'cdr')){var _0x575412=_0x1d3ba3[_0x6f1c('0x5f')][_0x6f1c('0x62')]('=');var _0x5c964f=_0x575412[0x0][_0x6f1c('0x63')](_0x575412[0x0]['lastIndexOf']('(')+0x1,_0x575412[0x0]['lastIndexOf'](')'));var _0x57329c=_0x575412[0x1];channels[_0x1d3ba3[_0x6f1c('0x9')]][_0x5c964f]=_0x57329c;}if(!_['includes']([_0x6f1c('0x64'),_0x6f1c('0x65'),_0x6f1c('0x66'),_0x6f1c('0x67'),_0x6f1c('0x68')],_0x1d3ba3[_0x6f1c('0x5e')]['toLowerCase']())){channels[_0x1d3ba3[_0x6f1c('0x9')]][_0x6f1c('0x51')]=_0x1d3ba3['application'];channels[_0x1d3ba3[_0x6f1c('0x9')]]['lastdata']=_0x1d3ba3[_0x6f1c('0x5f')];}}}catch(_0x40a84f){utils[_0x6f1c('0x1d')](util[_0x6f1c('0xc')](_0x6f1c('0x69'),_0x1d3ba3[_0x6f1c('0x9')]),_0x40a84f);}};
\ No newline at end of file
index 1b3bf92..a073bd5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x79c0=['error','[core]\x20error','[core]\x20close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x371139,_0x4acb71){var _0x3f4ffe=function(_0x1388df){while(--_0x1388df){_0x371139['push'](_0x371139['shift']());}};_0x3f4ffe(++_0x4acb71);}(_0x79c0,0x82));var _0x079c=function(_0x48b6a7,_0x451757){_0x48b6a7=_0x48b6a7-0x0;var _0xed8730=_0x79c0[_0x48b6a7];return _0xed8730;};'use strict';var utils=require(_0x079c('0x0'));exports['connect']=function(){utils[_0x079c('0x1')](_0x079c('0x2'));};exports[_0x079c('0x3')]=function(){utils[_0x079c('0x1')](_0x079c('0x4'));};exports['fullybooted']=function(){utils[_0x079c('0x1')]('[core]\x20fullybooted');};exports[_0x079c('0x5')]=function(_0xf0dcb6){utils[_0x079c('0x5')](_0x079c('0x6'),_0xf0dcb6);};exports['close']=function(){utils[_0x079c('0x1')](_0x079c('0x7'));};exports[_0x079c('0x8')]=function(_0x5b488d){};
\ No newline at end of file
+var _0x2359=['managerevent','./utils','connect','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','[core]\x20error','close','[core]\x20close'];(function(_0xec32e0,_0x517bb8){var _0x5e4714=function(_0x3758b7){while(--_0x3758b7){_0xec32e0['push'](_0xec32e0['shift']());}};_0x5e4714(++_0x517bb8);}(_0x2359,0xf1));var _0x9235=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2359[_0x19e35c];return _0x3e1fe8;};'use strict';var utils=require(_0x9235('0x0'));exports[_0x9235('0x1')]=function(){utils[_0x9235('0x2')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0x9235('0x2')](_0x9235('0x3'));};exports[_0x9235('0x4')]=function(){utils[_0x9235('0x2')](_0x9235('0x5'));};exports['error']=function(_0x571132){utils['error'](_0x9235('0x6'),_0x571132);};exports[_0x9235('0x7')]=function(){utils[_0x9235('0x2')](_0x9235('0x8'));};exports[_0x9235('0x9')]=function(_0x45fd36){};
\ No newline at end of file
index f95a3e7..805f51a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x642f=['lastevent','called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','diffTime','endtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','starttime','now'];(function(_0x3a9278,_0x9005e7){var _0x309087=function(_0x36e10f){while(--_0x36e10f){_0x3a9278['push'](_0x3a9278['shift']());}};_0x309087(++_0x9005e7);}(_0x642f,0x1ef));var _0xf642=function(_0x349fa1,_0x55c5ba){_0x349fa1=_0x349fa1-0x0;var _0x51b795=_0x642f[_0x349fa1];return _0x51b795;};'use strict';var _=require(_0xf642('0x0'));var util=require(_0xf642('0x1'));var utils=require(_0xf642('0x2'));var dials={};function writeDB(_0x41e2cc){utils[_0xf642('0x3')](util[_0xf642('0x4')](_0xf642('0x5'),_0x41e2cc['uniqueid'],_0x41e2cc[_0xf642('0x6')],_0x41e2cc['dialstring'],_0x41e2cc[_0xf642('0x7')],_0x41e2cc[_0xf642('0x8')],_0x41e2cc[_0xf642('0x9')]));utils[_0xf642('0xa')](_0xf642('0xb'),_0x41e2cc);delete dials[_0x41e2cc[_0xf642('0xc')]];}exports[_0xf642('0xd')]=function(_0x478983){try{utils[_0xf642('0xe')](util[_0xf642('0x4')](_0xf642('0xf'),_0x478983[_0xf642('0xc')]),_0x478983);utils[_0xf642('0x3')](util[_0xf642('0x4')](_0xf642('0x10'),_0x478983['uniqueid'],_0x478983['application'],_0x478983[_0xf642('0x11')]));if(_0x478983[_0xf642('0x12')][_0xf642('0x13')]()==_0xf642('0x14')&&_[_0xf642('0x15')](_0x478983[_0xf642('0x11')][_0xf642('0x13')](),_0xf642('0x16'))){var _0x271264=_0x478983[_0xf642('0x11')][_0xf642('0x17')]('=');dials[_0x478983[_0xf642('0xc')]]={'routeId':_0x271264[0x1]};}}catch(_0x3b48d2){utils[_0xf642('0x18')](util[_0xf642('0x4')](_0xf642('0xf'),_0x478983[_0xf642('0xc')]),_0x3b48d2);}};exports[_0xf642('0x19')]=function(_0x211cda){try{utils[_0xf642('0xe')](util[_0xf642('0x4')](_0xf642('0x1a'),_0x211cda[_0xf642('0xc')]),_0x211cda);if(!_['isNil'](_0x211cda[_0xf642('0x1b')][_0xf642('0x1c')])){utils[_0xf642('0x3')](util[_0xf642('0x4')](_0xf642('0x1d'),_0x211cda[_0xf642('0xc')],_0x211cda[_0xf642('0x1e')]));dials[_0x211cda['uniqueid']]={'routeId':_0x211cda[_0xf642('0x1e')]};}}catch(_0x12260f){utils['error'](util[_0xf642('0x4')](_0xf642('0x1a'),_0x211cda[_0xf642('0xc')]),_0x12260f);}};exports[_0xf642('0x1f')]=function(_0x3748fb){try{if(!_[_0xf642('0x20')](dials[_0x3748fb['uniqueid']])){utils[_0xf642('0xe')](util[_0xf642('0x4')]('[%s][dials][dialbegin]',_0x3748fb[_0xf642('0xc')]),_0x3748fb);dials[_0x3748fb[_0xf642('0xc')]]=_['assign'](dials[_0x3748fb[_0xf642('0xc')]],_0x3748fb);dials[_0x3748fb[_0xf642('0xc')]][_0xf642('0x21')]=utils[_0xf642('0x22')]();dials[_0x3748fb[_0xf642('0xc')]][_0xf642('0x23')]=_0xf642('0x24');utils[_0xf642('0x3')](util[_0xf642('0x4')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x3748fb[_0xf642('0xc')],dials[_0x3748fb[_0xf642('0xc')]][_0xf642('0x21')]));}}catch(_0x49f73a){utils['error'](util[_0xf642('0x4')](_0xf642('0x25'),_0x3748fb['uniqueid']),_0x49f73a);}};exports[_0xf642('0x26')]=function(_0x17a80b){try{if(!_[_0xf642('0x20')](dials[_0x17a80b['uniqueid']])){utils[_0xf642('0xe')](util[_0xf642('0x4')](_0xf642('0x27'),_0x17a80b[_0xf642('0xc')]),_0x17a80b);dials[_0x17a80b['uniqueid']][_0xf642('0x9')]=_0x17a80b['dialstatus'];if(_0x17a80b[_0xf642('0x9')]==_0xf642('0x28')){dials[_0x17a80b[_0xf642('0xc')]]=_[_0xf642('0x29')](dials[_0x17a80b[_0xf642('0xc')]],_0x17a80b);dials[_0x17a80b['uniqueid']][_0xf642('0x2a')]=utils[_0xf642('0x22')]();dials[_0x17a80b[_0xf642('0xc')]][_0xf642('0x23')]=_0xf642('0x2b');utils[_0xf642('0x3')](util['format'](_0xf642('0x2c'),_0x17a80b[_0xf642('0xc')],_0x17a80b[_0xf642('0x9')],dials[_0x17a80b[_0xf642('0xc')]][_0xf642('0x2a')]));}else{utils[_0xf642('0x3')](util[_0xf642('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x17a80b[_0xf642('0xc')],_0x17a80b[_0xf642('0x9')]));}}}catch(_0xf9edbf){utils[_0xf642('0x18')](util[_0xf642('0x4')](_0xf642('0x27'),_0x17a80b[_0xf642('0xc')]),_0xf9edbf);}};exports[_0xf642('0x2d')]=function(_0x3b40f1){try{if(!_['isNil'](dials[_0x3b40f1[_0xf642('0xc')]])){utils[_0xf642('0xe')](util[_0xf642('0x4')](_0xf642('0x2e'),_0x3b40f1['uniqueid']),_0x3b40f1);utils[_0xf642('0x3')](util[_0xf642('0x4')](_0xf642('0x2f'),_0x3b40f1['uniqueid'],_0x3b40f1[_0xf642('0x7')],_0x3b40f1['calleridname'],_0x3b40f1[_0xf642('0x30')]));dials[_0x3b40f1[_0xf642('0xc')]]=_[_0xf642('0x29')](dials[_0x3b40f1['uniqueid']],{'endtime':utils[_0xf642('0x22')](),'lastevent':_0xf642('0x31')});dials[_0x3b40f1['uniqueid']][_0xf642('0x32')]=utils[_0xf642('0x33')](dials[_0x3b40f1[_0xf642('0xc')]][_0xf642('0x34')],dials[_0x3b40f1[_0xf642('0xc')]][_0xf642('0x21')]);dials[_0x3b40f1[_0xf642('0xc')]]['holdtime']=utils[_0xf642('0x33')](dials[_0x3b40f1[_0xf642('0xc')]][_0xf642('0x2a')]||dials[_0x3b40f1[_0xf642('0xc')]][_0xf642('0x34')],dials[_0x3b40f1[_0xf642('0xc')]]['starttime']);dials[_0x3b40f1[_0xf642('0xc')]]['billableseconds']=dials[_0x3b40f1['uniqueid']][_0xf642('0x2a')]?utils[_0xf642('0x33')](dials[_0x3b40f1[_0xf642('0xc')]][_0xf642('0x34')],dials[_0x3b40f1['uniqueid']][_0xf642('0x2a')]):0x0;writeDB(dials[_0x3b40f1['uniqueid']]);}}catch(_0x11867f){utils['error'](util[_0xf642('0x4')](_0xf642('0x2e'),_0x3b40f1['uniqueid']),_0x11867f);}};
\ No newline at end of file
+var _0x6bc7=['variable','outboundrouteid','error','dialbegin','assign','starttime','now','lastevent','called','dialend','ANSWER','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','split','debug','[%s][dials][varset]','isNil'];(function(_0x2d6c1f,_0x48a29d){var _0x5f3140=function(_0x20c0d9){while(--_0x20c0d9){_0x2d6c1f['push'](_0x2d6c1f['shift']());}};_0x5f3140(++_0x48a29d);}(_0x6bc7,0x1a0));var _0x76bc=function(_0x59987a,_0x399e11){_0x59987a=_0x59987a-0x0;var _0x460646=_0x6bc7[_0x59987a];return _0x460646;};'use strict';var _=require(_0x76bc('0x0'));var util=require(_0x76bc('0x1'));var utils=require(_0x76bc('0x2'));var dials={};function writeDB(_0x2d0c44){utils[_0x76bc('0x3')](util['format'](_0x76bc('0x4'),_0x2d0c44[_0x76bc('0x5')],_0x2d0c44[_0x76bc('0x6')],_0x2d0c44[_0x76bc('0x7')],_0x2d0c44[_0x76bc('0x8')],_0x2d0c44[_0x76bc('0x9')],_0x2d0c44[_0x76bc('0xa')]));utils['request'](_0x76bc('0xb'),_0x2d0c44);delete dials[_0x2d0c44[_0x76bc('0x5')]];}exports[_0x76bc('0xc')]=function(_0x410d9f){try{utils['debug'](util[_0x76bc('0xd')](_0x76bc('0xe'),_0x410d9f[_0x76bc('0x5')]),_0x410d9f);utils[_0x76bc('0x3')](util[_0x76bc('0xd')](_0x76bc('0xf'),_0x410d9f[_0x76bc('0x5')],_0x410d9f[_0x76bc('0x10')],_0x410d9f[_0x76bc('0x11')]));if(_0x410d9f[_0x76bc('0x10')]['toLowerCase']()==_0x76bc('0x12')&&_[_0x76bc('0x13')](_0x410d9f['appdata'][_0x76bc('0x14')](),'cdr(routeid)')){var _0x271301=_0x410d9f[_0x76bc('0x11')][_0x76bc('0x15')]('=');dials[_0x410d9f[_0x76bc('0x5')]]={'routeId':_0x271301[0x1]};}}catch(_0x319f81){utils['error'](util[_0x76bc('0xd')](_0x76bc('0xe'),_0x410d9f['uniqueid']),_0x319f81);}};exports['varset']=function(_0x1bc334){try{utils[_0x76bc('0x16')](util['format'](_0x76bc('0x17'),_0x1bc334[_0x76bc('0x5')]),_0x1bc334);if(!_[_0x76bc('0x18')](_0x1bc334[_0x76bc('0x19')][_0x76bc('0x1a')])){utils[_0x76bc('0x3')](util[_0x76bc('0xd')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x1bc334[_0x76bc('0x5')],_0x1bc334['value']));dials[_0x1bc334[_0x76bc('0x5')]]={'routeId':_0x1bc334['value']};}}catch(_0x4dc64b){utils[_0x76bc('0x1b')](util[_0x76bc('0xd')](_0x76bc('0x17'),_0x1bc334[_0x76bc('0x5')]),_0x4dc64b);}};exports[_0x76bc('0x1c')]=function(_0x4d3dc6){try{if(!_['isNil'](dials[_0x4d3dc6['uniqueid']])){utils[_0x76bc('0x16')](util[_0x76bc('0xd')]('[%s][dials][dialbegin]',_0x4d3dc6[_0x76bc('0x5')]),_0x4d3dc6);dials[_0x4d3dc6[_0x76bc('0x5')]]=_[_0x76bc('0x1d')](dials[_0x4d3dc6['uniqueid']],_0x4d3dc6);dials[_0x4d3dc6[_0x76bc('0x5')]][_0x76bc('0x1e')]=utils[_0x76bc('0x1f')]();dials[_0x4d3dc6['uniqueid']][_0x76bc('0x20')]=_0x76bc('0x21');utils[_0x76bc('0x3')](util[_0x76bc('0xd')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x4d3dc6[_0x76bc('0x5')],dials[_0x4d3dc6['uniqueid']][_0x76bc('0x1e')]));}}catch(_0x465a34){utils[_0x76bc('0x1b')](util[_0x76bc('0xd')]('[%s][dials][dialbegin]',_0x4d3dc6[_0x76bc('0x5')]),_0x465a34);}};exports[_0x76bc('0x22')]=function(_0x4a4da4){try{if(!_[_0x76bc('0x18')](dials[_0x4a4da4['uniqueid']])){utils[_0x76bc('0x16')](util[_0x76bc('0xd')]('[%s][dials][dialend]',_0x4a4da4[_0x76bc('0x5')]),_0x4a4da4);dials[_0x4a4da4[_0x76bc('0x5')]]['dialstatus']=_0x4a4da4[_0x76bc('0xa')];if(_0x4a4da4[_0x76bc('0xa')]==_0x76bc('0x23')){dials[_0x4a4da4[_0x76bc('0x5')]]=_[_0x76bc('0x1d')](dials[_0x4a4da4[_0x76bc('0x5')]],_0x4a4da4);dials[_0x4a4da4['uniqueid']]['answertime']=utils[_0x76bc('0x1f')]();dials[_0x4a4da4[_0x76bc('0x5')]][_0x76bc('0x20')]='connect';utils[_0x76bc('0x3')](util[_0x76bc('0xd')](_0x76bc('0x24'),_0x4a4da4[_0x76bc('0x5')],_0x4a4da4[_0x76bc('0xa')],dials[_0x4a4da4[_0x76bc('0x5')]][_0x76bc('0x25')]));}else{utils['info'](util[_0x76bc('0xd')]('[%s][dials][dialend]\x20dialstatus:%s',_0x4a4da4[_0x76bc('0x5')],_0x4a4da4[_0x76bc('0xa')]));}}}catch(_0x259bf6){utils[_0x76bc('0x1b')](util['format'](_0x76bc('0x26'),_0x4a4da4['uniqueid']),_0x259bf6);}};exports[_0x76bc('0x27')]=function(_0x1d3d6a){try{if(!_[_0x76bc('0x18')](dials[_0x1d3d6a['uniqueid']])){utils[_0x76bc('0x16')](util['format'](_0x76bc('0x28'),_0x1d3d6a[_0x76bc('0x5')]),_0x1d3d6a);utils['info'](util['format'](_0x76bc('0x29'),_0x1d3d6a[_0x76bc('0x5')],_0x1d3d6a[_0x76bc('0x8')],_0x1d3d6a[_0x76bc('0x2a')],_0x1d3d6a['cause-txt']));dials[_0x1d3d6a[_0x76bc('0x5')]]=_[_0x76bc('0x1d')](dials[_0x1d3d6a[_0x76bc('0x5')]],{'endtime':utils[_0x76bc('0x1f')](),'lastevent':_0x76bc('0x2b')});dials[_0x1d3d6a[_0x76bc('0x5')]][_0x76bc('0x2c')]=utils[_0x76bc('0x2d')](dials[_0x1d3d6a[_0x76bc('0x5')]][_0x76bc('0x2e')],dials[_0x1d3d6a['uniqueid']][_0x76bc('0x1e')]);dials[_0x1d3d6a[_0x76bc('0x5')]][_0x76bc('0x2f')]=utils[_0x76bc('0x2d')](dials[_0x1d3d6a['uniqueid']][_0x76bc('0x25')]||dials[_0x1d3d6a[_0x76bc('0x5')]][_0x76bc('0x2e')],dials[_0x1d3d6a[_0x76bc('0x5')]][_0x76bc('0x1e')]);dials[_0x1d3d6a[_0x76bc('0x5')]][_0x76bc('0x30')]=dials[_0x1d3d6a[_0x76bc('0x5')]][_0x76bc('0x25')]?utils[_0x76bc('0x2d')](dials[_0x1d3d6a[_0x76bc('0x5')]][_0x76bc('0x2e')],dials[_0x1d3d6a[_0x76bc('0x5')]]['answertime']):0x0;writeDB(dials[_0x1d3d6a[_0x76bc('0x5')]]);}}catch(_0x1d0b04){utils[_0x76bc('0x1b')](util['format'](_0x76bc('0x28'),_0x1d3d6a[_0x76bc('0x5')]),_0x1d0b04);}};
\ No newline at end of file
index 2701cd9..25e5f3a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1eb4=['disabled','env','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','debug','[%s][index][devicestatechange]','device','devicestatechange','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr'];(function(_0x2234c2,_0x5e6b2b){var _0x36c10d=function(_0xab2f10){while(--_0xab2f10){_0x2234c2['push'](_0x2234c2['shift']());}};_0x36c10d(++_0x5e6b2b);}(_0x1eb4,0x114));var _0x41eb=function(_0x150d5e,_0x5a86fb){_0x150d5e=_0x150d5e-0x0;var _0x23b9a1=_0x1eb4[_0x150d5e];return _0x23b9a1;};var AsteriskManager=require(_0x41eb('0x0'));var config=require(_0x41eb('0x1'));var utils=require(_0x41eb('0x2'));var util=require('util');var isXDREnabled=config[_0x41eb('0x3')]&&config[_0x41eb('0x3')][_0x41eb('0x4')]?!config[_0x41eb('0x3')][_0x41eb('0x4')]:!![];var isProduction=config[_0x41eb('0x5')]==='production'||![];var isLocalAsterisk=config[_0x41eb('0x3')]&&config['xdr'][_0x41eb('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x41eb('0x7')][_0x41eb('0x8')],config[_0x41eb('0x7')]['ip'],config[_0x41eb('0x7')][_0x41eb('0x9')],config[_0x41eb('0x7')][_0x41eb('0xa')],!![]);ami[_0x41eb('0xb')]();if(!isXDREnabled){utils[_0x41eb('0xc')](_0x41eb('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x41eb('0xc')](_0x41eb('0xe'));}else{var agents=require('./agents.controller');var calls=require(_0x41eb('0xf'));var queues=require(_0x41eb('0x10'));var recordings=require(_0x41eb('0x11'));var members=require('./members.controller');var dials=require(_0x41eb('0x12'));var transfers=require(_0x41eb('0x13'));var core=require('./core.controller');ami['on']('connect',core[_0x41eb('0x14')]);ami['on'](_0x41eb('0x15'),core[_0x41eb('0x15')]);ami['on'](_0x41eb('0x16'),core[_0x41eb('0x16')]);ami['on'](_0x41eb('0x17'),core[_0x41eb('0x17')]);ami['on'](_0x41eb('0x18'),core[_0x41eb('0x18')]);ami['on']('managerevent',core['managerevent']);ami['on']('devicestatechange',function(_0x463322){try{utils[_0x41eb('0x19')](util['format'](_0x41eb('0x1a'),_0x463322[_0x41eb('0x1b')]),_0x463322);members[_0x41eb('0x1c')](_0x463322);}catch(_0x4238ea){utils['error'](util[_0x41eb('0x1d')]('[%s][index][devicestatechange]',_0x463322[_0x41eb('0x1b')]),_0x4238ea);}});ami['on'](_0x41eb('0x1e'),function(_0x476716){try{utils[_0x41eb('0x19')](util[_0x41eb('0x1d')](_0x41eb('0x1f'),_0x476716[_0x41eb('0x20')]),_0x476716);agents['agentcalled'](_0x476716);}catch(_0x3844d9){utils[_0x41eb('0x17')](util[_0x41eb('0x1d')](_0x41eb('0x1f'),_0x476716[_0x41eb('0x20')]),_0x3844d9);}});ami['on'](_0x41eb('0x21'),function(_0x3bc985){try{utils[_0x41eb('0x19')](util[_0x41eb('0x1d')](_0x41eb('0x22'),_0x3bc985['uniqueid']),_0x3bc985);agents['agentringnoanswer'](_0x3bc985);}catch(_0x1c74cd){utils['error'](util[_0x41eb('0x1d')]('[%s][index][agentringnoanswer]',_0x3bc985[_0x41eb('0x20')]),_0x1c74cd);}});ami['on'](_0x41eb('0x23'),function(_0x45bb78){try{utils[_0x41eb('0x19')](util[_0x41eb('0x1d')]('[%s][index][agentconnect]',_0x45bb78[_0x41eb('0x20')]),_0x45bb78);agents[_0x41eb('0x23')](_0x45bb78);queues[_0x41eb('0x23')](_0x45bb78);}catch(_0x1b2b00){utils[_0x41eb('0x17')](util[_0x41eb('0x1d')](_0x41eb('0x24'),_0x45bb78[_0x41eb('0x20')]),_0x1b2b00);}});ami['on']('agentcomplete',function(_0x5bc8b6){try{utils[_0x41eb('0x19')](util[_0x41eb('0x1d')](_0x41eb('0x25'),_0x5bc8b6[_0x41eb('0x20')]),_0x5bc8b6);agents[_0x41eb('0x26')](_0x5bc8b6);queues['agentcomplete'](_0x5bc8b6);members[_0x41eb('0x26')](_0x5bc8b6);}catch(_0x462b6a){utils[_0x41eb('0x17')](util['format'](_0x41eb('0x25'),_0x5bc8b6['uniqueid']),_0x462b6a);}});ami['on']('queuecallerabandon',function(_0x103026){try{utils['debug'](util[_0x41eb('0x1d')](_0x41eb('0x27'),_0x103026[_0x41eb('0x20')]),_0x103026);agents['queuecallerabandon'](_0x103026);queues[_0x41eb('0x28')](_0x103026);}catch(_0x40f412){utils[_0x41eb('0x17')](util[_0x41eb('0x1d')](_0x41eb('0x27'),_0x103026[_0x41eb('0x20')]),_0x40f412);}});ami['on'](_0x41eb('0x29'),function(_0x2c4b19){try{utils[_0x41eb('0x19')](util['format'](_0x41eb('0x2a'),_0x2c4b19[_0x41eb('0x20')]),_0x2c4b19);queues[_0x41eb('0x29')](_0x2c4b19);recordings['queuecallerjoin'](_0x2c4b19);}catch(_0x1f759f){utils[_0x41eb('0x17')](util[_0x41eb('0x1d')](_0x41eb('0x2a'),_0x2c4b19[_0x41eb('0x20')]),_0x1f759f);}});ami['on'](_0x41eb('0x2b'),function(_0x2edc02){try{utils[_0x41eb('0x19')](util[_0x41eb('0x1d')](_0x41eb('0x2c'),_0x2edc02[_0x41eb('0x20')]),_0x2edc02);queues['queuecallerleave'](_0x2edc02);}catch(_0x57f43e){utils['error'](util[_0x41eb('0x1d')]('[%s][index][queuecallerleave]',_0x2edc02[_0x41eb('0x20')]),_0x57f43e);}});ami['on'](_0x41eb('0x2d'),function(_0x365cab){try{utils[_0x41eb('0x19')](util[_0x41eb('0x1d')](_0x41eb('0x2e'),_0x365cab[_0x41eb('0x20')]),_0x365cab);queues['musiconholdstart'](_0x365cab);calls['musiconholdstart'](_0x365cab);}catch(_0x20c340){utils[_0x41eb('0x17')](util[_0x41eb('0x1d')](_0x41eb('0x2e'),_0x365cab[_0x41eb('0x20')]),_0x20c340);}});ami['on'](_0x41eb('0x2f'),function(_0x1a0ba8){try{utils[_0x41eb('0x19')](util[_0x41eb('0x1d')](_0x41eb('0x30'),_0x1a0ba8['uniqueid']),_0x1a0ba8);queues['musiconholdstop'](_0x1a0ba8);calls[_0x41eb('0x2f')](_0x1a0ba8);}catch(_0x31edf0){utils[_0x41eb('0x17')](util['format'](_0x41eb('0x30'),_0x1a0ba8[_0x41eb('0x20')]),_0x31edf0);}});ami['on'](_0x41eb('0x31'),function(_0x31948a){try{utils['debug'](util[_0x41eb('0x1d')](_0x41eb('0x32'),_0x31948a[_0x41eb('0x20')]),_0x31948a);calls[_0x41eb('0x31')](_0x31948a);recordings[_0x41eb('0x31')](_0x31948a);}catch(_0x3536b5){utils['error'](util['format'](_0x41eb('0x32'),_0x31948a[_0x41eb('0x20')]),_0x3536b5);}});ami['on'](_0x41eb('0x33'),function(_0x264f2e){try{utils['debug'](util[_0x41eb('0x1d')]('[%s][index][hangup]',_0x264f2e['uniqueid']),_0x264f2e);calls['hangup'](_0x264f2e);recordings[_0x41eb('0x33')](_0x264f2e);dials[_0x41eb('0x33')](_0x264f2e);agents['hangup'](_0x264f2e);queues['hangup'](_0x264f2e);}catch(_0x4aaf57){utils['error'](util[_0x41eb('0x1d')](_0x41eb('0x34'),_0x264f2e['uniqueid']),_0x4aaf57);}});ami['on'](_0x41eb('0x35'),function(_0xc90b31){try{utils[_0x41eb('0x19')](util['format'](_0x41eb('0x36'),_0xc90b31[_0x41eb('0x20')]),_0xc90b31);members[_0x41eb('0x35')](_0xc90b31);}catch(_0x1b56d2){utils[_0x41eb('0x17')](util[_0x41eb('0x1d')](_0x41eb('0x36'),_0xc90b31[_0x41eb('0x20')]),_0x1b56d2);}});ami['on']('blindtransfer',function(_0x400ed9){try{utils[_0x41eb('0x19')](util[_0x41eb('0x1d')](_0x41eb('0x37'),_0x400ed9['uniqueid']),_0x400ed9);queues[_0x41eb('0x38')](_0x400ed9);agents[_0x41eb('0x38')](_0x400ed9);transfers['blindtransfer'](_0x400ed9);recordings[_0x41eb('0x38')](_0x400ed9);}catch(_0x3ab26a){utils['error'](util['format'](_0x41eb('0x37'),_0x400ed9[_0x41eb('0x20')]),_0x3ab26a);}});ami['on'](_0x41eb('0x39'),function(_0x444af8){try{utils[_0x41eb('0x19')](util['format'](_0x41eb('0x3a'),_0x444af8[_0x41eb('0x3b')]),_0x444af8);queues[_0x41eb('0x39')](_0x444af8);transfers[_0x41eb('0x39')](_0x444af8);agents[_0x41eb('0x39')](_0x444af8);calls[_0x41eb('0x39')](_0x444af8);}catch(_0x502034){utils[_0x41eb('0x17')](util[_0x41eb('0x1d')](_0x41eb('0x3a'),_0x444af8[_0x41eb('0x3b')]),_0x502034);}});ami['on'](_0x41eb('0x3c'),function(_0x45d165){try{utils[_0x41eb('0x19')](util[_0x41eb('0x1d')]('[%s][index][varset]',_0x45d165['uniqueid']),_0x45d165);queues['varset'](_0x45d165);recordings[_0x41eb('0x3c')](_0x45d165);calls[_0x41eb('0x3c')](_0x45d165);dials['varset'](_0x45d165);}catch(_0x10067e){utils[_0x41eb('0x17')](util[_0x41eb('0x1d')](_0x41eb('0x3d'),_0x45d165[_0x41eb('0x20')]),_0x10067e);}});ami['on']('newexten',function(_0x50ab13){try{utils['debug'](util[_0x41eb('0x1d')](_0x41eb('0x3e'),_0x50ab13[_0x41eb('0x20')]),_0x50ab13);calls[_0x41eb('0x3f')](_0x50ab13);recordings[_0x41eb('0x3f')](_0x50ab13);dials[_0x41eb('0x3f')](_0x50ab13);}catch(_0xb2dd45){utils[_0x41eb('0x17')](util['format']('[%s][index][newexten]',_0x50ab13[_0x41eb('0x20')]),_0xb2dd45);}});ami['on'](_0x41eb('0x40'),function(_0x309d69){try{utils[_0x41eb('0x19')](util[_0x41eb('0x1d')](_0x41eb('0x41'),_0x309d69[_0x41eb('0x20')]),_0x309d69);calls[_0x41eb('0x40')](_0x309d69);recordings['newchannel'](_0x309d69);}catch(_0x20c509){utils[_0x41eb('0x17')](util['format'](_0x41eb('0x41'),_0x309d69['uniqueid']),_0x20c509);}});ami['on'](_0x41eb('0x42'),function(_0x3ca890){try{utils[_0x41eb('0x19')](util['format'](_0x41eb('0x43'),_0x3ca890[_0x41eb('0x20')]),_0x3ca890);dials['dialbegin'](_0x3ca890);}catch(_0x48806c){utils[_0x41eb('0x17')](util['format']('[%s]dialbegin',_0x3ca890['uniqueid']),_0x48806c);}});ami['on'](_0x41eb('0x44'),function(_0x53e96c){try{utils['debug'](util[_0x41eb('0x1d')](_0x41eb('0x45'),_0x53e96c[_0x41eb('0x20')]),_0x53e96c);dials[_0x41eb('0x44')](_0x53e96c);}catch(_0x5db5ec){utils['error'](util['format'](_0x41eb('0x45'),_0x53e96c[_0x41eb('0x20')]),_0x5db5ec);}});}
\ No newline at end of file
+var _0x33b1=['./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','[%s][index][devicestatechange]','device','devicestatechange','format','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','util','xdr','disabled','env','local','port','asterisk','username','password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller'];(function(_0x60d2b2,_0x5a86b4){var _0x56e963=function(_0x4d9654){while(--_0x4d9654){_0x60d2b2['push'](_0x60d2b2['shift']());}};_0x56e963(++_0x5a86b4);}(_0x33b1,0x14c));var _0x133b=function(_0x257377,_0x20b8f2){_0x257377=_0x257377-0x0;var _0x119ff8=_0x33b1[_0x257377];return _0x119ff8;};var AsteriskManager=require(_0x133b('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0x133b('0x1'));var isXDREnabled=config[_0x133b('0x2')]&&config[_0x133b('0x2')][_0x133b('0x3')]?!config[_0x133b('0x2')][_0x133b('0x3')]:!![];var isProduction=config[_0x133b('0x4')]==='production'||![];var isLocalAsterisk=config[_0x133b('0x2')]&&config[_0x133b('0x2')][_0x133b('0x5')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x133b('0x6')],config[_0x133b('0x7')]['ip'],config[_0x133b('0x7')][_0x133b('0x8')],config[_0x133b('0x7')][_0x133b('0x9')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x133b('0xa')](_0x133b('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x133b('0xa')](_0x133b('0xc'));}else{var agents=require(_0x133b('0xd'));var calls=require(_0x133b('0xe'));var queues=require(_0x133b('0xf'));var recordings=require(_0x133b('0x10'));var members=require(_0x133b('0x11'));var dials=require(_0x133b('0x12'));var transfers=require(_0x133b('0x13'));var core=require(_0x133b('0x14'));ami['on'](_0x133b('0x15'),core[_0x133b('0x15')]);ami['on'](_0x133b('0x16'),core[_0x133b('0x16')]);ami['on']('fullybooted',core[_0x133b('0x17')]);ami['on']('error',core[_0x133b('0x18')]);ami['on'](_0x133b('0x19'),core['close']);ami['on'](_0x133b('0x1a'),core[_0x133b('0x1a')]);ami['on']('devicestatechange',function(_0x3f78ef){try{utils[_0x133b('0x1b')](util['format'](_0x133b('0x1c'),_0x3f78ef[_0x133b('0x1d')]),_0x3f78ef);members[_0x133b('0x1e')](_0x3f78ef);}catch(_0x24817a){utils[_0x133b('0x18')](util[_0x133b('0x1f')](_0x133b('0x1c'),_0x3f78ef[_0x133b('0x1d')]),_0x24817a);}});ami['on']('agentcalled',function(_0x409896){try{utils[_0x133b('0x1b')](util[_0x133b('0x1f')](_0x133b('0x20'),_0x409896[_0x133b('0x21')]),_0x409896);agents['agentcalled'](_0x409896);}catch(_0x151e04){utils['error'](util[_0x133b('0x1f')]('[%s][index][agentcalled]',_0x409896['uniqueid']),_0x151e04);}});ami['on']('agentringnoanswer',function(_0x13eacb){try{utils['debug'](util['format']('[%s][index][agentringnoanswer]',_0x13eacb[_0x133b('0x21')]),_0x13eacb);agents[_0x133b('0x22')](_0x13eacb);}catch(_0x56652c){utils[_0x133b('0x18')](util[_0x133b('0x1f')](_0x133b('0x23'),_0x13eacb[_0x133b('0x21')]),_0x56652c);}});ami['on'](_0x133b('0x24'),function(_0x50590e){try{utils[_0x133b('0x1b')](util[_0x133b('0x1f')](_0x133b('0x25'),_0x50590e[_0x133b('0x21')]),_0x50590e);agents[_0x133b('0x24')](_0x50590e);queues['agentconnect'](_0x50590e);}catch(_0x58729d){utils['error'](util['format']('[%s][index][agentconnect]',_0x50590e['uniqueid']),_0x58729d);}});ami['on'](_0x133b('0x26'),function(_0x51e364){try{utils[_0x133b('0x1b')](util[_0x133b('0x1f')](_0x133b('0x27'),_0x51e364[_0x133b('0x21')]),_0x51e364);agents[_0x133b('0x26')](_0x51e364);queues[_0x133b('0x26')](_0x51e364);members[_0x133b('0x26')](_0x51e364);}catch(_0x373b8b){utils[_0x133b('0x18')](util['format']('[%s][index][agentcomplete]',_0x51e364[_0x133b('0x21')]),_0x373b8b);}});ami['on']('queuecallerabandon',function(_0x100bca){try{utils['debug'](util[_0x133b('0x1f')]('[%s][index][queuecallerabandon]',_0x100bca[_0x133b('0x21')]),_0x100bca);agents[_0x133b('0x28')](_0x100bca);queues['queuecallerabandon'](_0x100bca);}catch(_0x579d47){utils[_0x133b('0x18')](util['format'](_0x133b('0x29'),_0x100bca[_0x133b('0x21')]),_0x579d47);}});ami['on'](_0x133b('0x2a'),function(_0x4e65cc){try{utils['debug'](util[_0x133b('0x1f')](_0x133b('0x2b'),_0x4e65cc[_0x133b('0x21')]),_0x4e65cc);queues[_0x133b('0x2a')](_0x4e65cc);recordings['queuecallerjoin'](_0x4e65cc);}catch(_0x52f1c8){utils[_0x133b('0x18')](util['format'](_0x133b('0x2b'),_0x4e65cc[_0x133b('0x21')]),_0x52f1c8);}});ami['on']('queuecallerleave',function(_0x51397e){try{utils['debug'](util[_0x133b('0x1f')](_0x133b('0x2c'),_0x51397e['uniqueid']),_0x51397e);queues['queuecallerleave'](_0x51397e);}catch(_0x43d074){utils[_0x133b('0x18')](util[_0x133b('0x1f')](_0x133b('0x2c'),_0x51397e[_0x133b('0x21')]),_0x43d074);}});ami['on'](_0x133b('0x2d'),function(_0x1421e6){try{utils['debug'](util['format']('[%s][index][musiconholdstart]',_0x1421e6[_0x133b('0x21')]),_0x1421e6);queues[_0x133b('0x2d')](_0x1421e6);calls[_0x133b('0x2d')](_0x1421e6);}catch(_0x178c05){utils[_0x133b('0x18')](util[_0x133b('0x1f')](_0x133b('0x2e'),_0x1421e6[_0x133b('0x21')]),_0x178c05);}});ami['on']('musiconholdstop',function(_0x25249b){try{utils[_0x133b('0x1b')](util[_0x133b('0x1f')]('[%s][index][musiconholdstop]',_0x25249b[_0x133b('0x21')]),_0x25249b);queues[_0x133b('0x2f')](_0x25249b);calls[_0x133b('0x2f')](_0x25249b);}catch(_0x4595d1){utils['error'](util[_0x133b('0x1f')](_0x133b('0x30'),_0x25249b[_0x133b('0x21')]),_0x4595d1);}});ami['on'](_0x133b('0x31'),function(_0x485950){try{utils[_0x133b('0x1b')](util['format'](_0x133b('0x32'),_0x485950['uniqueid']),_0x485950);calls[_0x133b('0x31')](_0x485950);recordings['newstate'](_0x485950);}catch(_0x432c4d){utils[_0x133b('0x18')](util[_0x133b('0x1f')](_0x133b('0x32'),_0x485950[_0x133b('0x21')]),_0x432c4d);}});ami['on']('hangup',function(_0x1a37e3){try{utils[_0x133b('0x1b')](util[_0x133b('0x1f')](_0x133b('0x33'),_0x1a37e3[_0x133b('0x21')]),_0x1a37e3);calls[_0x133b('0x34')](_0x1a37e3);recordings[_0x133b('0x34')](_0x1a37e3);dials['hangup'](_0x1a37e3);agents[_0x133b('0x34')](_0x1a37e3);queues[_0x133b('0x34')](_0x1a37e3);}catch(_0x5d3d81){utils['error'](util[_0x133b('0x1f')](_0x133b('0x33'),_0x1a37e3[_0x133b('0x21')]),_0x5d3d81);}});ami['on'](_0x133b('0x35'),function(_0x136348){try{utils['debug'](util[_0x133b('0x1f')](_0x133b('0x36'),_0x136348[_0x133b('0x21')]),_0x136348);members['cdr'](_0x136348);}catch(_0x1fd79a){utils[_0x133b('0x18')](util['format'](_0x133b('0x36'),_0x136348[_0x133b('0x21')]),_0x1fd79a);}});ami['on'](_0x133b('0x37'),function(_0x3bcaac){try{utils[_0x133b('0x1b')](util['format'](_0x133b('0x38'),_0x3bcaac[_0x133b('0x21')]),_0x3bcaac);queues[_0x133b('0x37')](_0x3bcaac);agents[_0x133b('0x37')](_0x3bcaac);transfers[_0x133b('0x37')](_0x3bcaac);recordings[_0x133b('0x37')](_0x3bcaac);}catch(_0x475dd8){utils[_0x133b('0x18')](util[_0x133b('0x1f')]('[%s][index][blindtransfer]',_0x3bcaac[_0x133b('0x21')]),_0x475dd8);}});ami['on'](_0x133b('0x39'),function(_0x90e2c5){try{utils[_0x133b('0x1b')](util[_0x133b('0x1f')](_0x133b('0x3a'),_0x90e2c5[_0x133b('0x3b')]),_0x90e2c5);queues[_0x133b('0x39')](_0x90e2c5);transfers[_0x133b('0x39')](_0x90e2c5);agents[_0x133b('0x39')](_0x90e2c5);calls['attendedtransfer'](_0x90e2c5);}catch(_0x2defcc){utils[_0x133b('0x18')](util[_0x133b('0x1f')](_0x133b('0x3a'),_0x90e2c5[_0x133b('0x3b')]),_0x2defcc);}});ami['on']('varset',function(_0x559045){try{utils[_0x133b('0x1b')](util[_0x133b('0x1f')]('[%s][index][varset]',_0x559045[_0x133b('0x21')]),_0x559045);queues['varset'](_0x559045);recordings[_0x133b('0x3c')](_0x559045);calls[_0x133b('0x3c')](_0x559045);dials['varset'](_0x559045);}catch(_0x192fd1){utils[_0x133b('0x18')](util[_0x133b('0x1f')](_0x133b('0x3d'),_0x559045[_0x133b('0x21')]),_0x192fd1);}});ami['on'](_0x133b('0x3e'),function(_0x4f71da){try{utils[_0x133b('0x1b')](util[_0x133b('0x1f')]('[%s][index][newexten]',_0x4f71da['uniqueid']),_0x4f71da);calls['newexten'](_0x4f71da);recordings[_0x133b('0x3e')](_0x4f71da);dials[_0x133b('0x3e')](_0x4f71da);}catch(_0xd23cf3){utils[_0x133b('0x18')](util[_0x133b('0x1f')]('[%s][index][newexten]',_0x4f71da[_0x133b('0x21')]),_0xd23cf3);}});ami['on'](_0x133b('0x3f'),function(_0x591b47){try{utils[_0x133b('0x1b')](util[_0x133b('0x1f')](_0x133b('0x40'),_0x591b47[_0x133b('0x21')]),_0x591b47);calls['newchannel'](_0x591b47);recordings[_0x133b('0x3f')](_0x591b47);}catch(_0x30a4f8){utils[_0x133b('0x18')](util[_0x133b('0x1f')](_0x133b('0x40'),_0x591b47[_0x133b('0x21')]),_0x30a4f8);}});ami['on'](_0x133b('0x41'),function(_0x5957ba){try{utils[_0x133b('0x1b')](util['format'](_0x133b('0x42'),_0x5957ba[_0x133b('0x21')]),_0x5957ba);dials[_0x133b('0x41')](_0x5957ba);}catch(_0x480c58){utils[_0x133b('0x18')](util['format'](_0x133b('0x43'),_0x5957ba[_0x133b('0x21')]),_0x480c58);}});ami['on'](_0x133b('0x44'),function(_0x3f4af0){try{utils[_0x133b('0x1b')](util[_0x133b('0x1f')](_0x133b('0x45'),_0x3f4af0[_0x133b('0x21')]),_0x3f4af0);dials[_0x133b('0x44')](_0x3f4af0);}catch(_0x349ff5){utils[_0x133b('0x18')](util[_0x133b('0x1f')](_0x133b('0x45'),_0x3f4af0[_0x133b('0x21')]),_0x349ff5);}});}
\ No newline at end of file
index 2e5e4a1..9e18c71 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5636=['now','isNil','exitAt','duration','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','split','assign','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','info','format','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','request','CreateMemberReport','internal','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING'];(function(_0x3594ac,_0xc84174){var _0x4dda19=function(_0xf0fe12){while(--_0xf0fe12){_0x3594ac['push'](_0x3594ac['shift']());}};_0x4dda19(++_0xc84174);}(_0x5636,0x102));var _0x6563=function(_0x13d76a,_0x4e572c){_0x13d76a=_0x13d76a-0x0;var _0x4d259f=_0x5636[_0x13d76a];return _0x4d259f;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x44872c){utils[_0x6563('0x2')](util[_0x6563('0x3')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x44872c[_0x6563('0x4')],_0x44872c[_0x6563('0x5')],_0x44872c[_0x6563('0x6')],_0x44872c[_0x6563('0x7')],_0x44872c[_0x6563('0x8')],_0x44872c[_0x6563('0x9')]));if(_0x44872c[_0x6563('0x5')]){utils[_0x6563('0xa')](_0x44872c[_0x6563('0x5')])[_0x6563('0xb')](function(_0x11a7a9){if(_0x11a7a9){_0x44872c[_0x6563('0x8')]=_0x11a7a9[_0x6563('0xc')];_0x44872c['internal']=_0x11a7a9['internal'];utils[_0x6563('0xd')](_0x6563('0xe'),_0x44872c);}else{utils['getUserByName'](_0x44872c['interface']['split']('/')[0x1])[_0x6563('0xb')](function(_0x111d38){if(_0x111d38){_0x44872c[_0x6563('0x8')]=_0x111d38[_0x6563('0xc')];_0x44872c[_0x6563('0xf')]=_0x111d38[_0x6563('0xf')];utils[_0x6563('0xd')](_0x6563('0xe'),_0x44872c);}});}})[_0x6563('0x10')](function(_0x51aeca){utils[_0x6563('0x11')](util['format'](_0x6563('0x12'),_0x44872c[_0x6563('0x4')]),_0x51aeca);});}delete members[_0x44872c[_0x6563('0x5')]];}function startsWith(_0x10d08c,_0x5af5d0){return _[_0x6563('0x13')](_0x10d08c,function(_0x11baa2){return _[_0x6563('0x14')](_0x5af5d0,_0x11baa2);});}exports[_0x6563('0x15')]=function(_0x4e7282){try{utils[_0x6563('0x16')](util['format']('[%s][members][devicestatechange]',members[_0x4e7282['device']]?members[_0x4e7282[_0x6563('0x17')]]['uniqueid']:_0x4e7282['device']),_0x4e7282);utils[_0x6563('0x2')](util[_0x6563('0x3')](_0x6563('0x18'),members[_0x4e7282[_0x6563('0x17')]]?members[_0x4e7282[_0x6563('0x17')]][_0x6563('0x4')]:_0x4e7282[_0x6563('0x17')],_0x4e7282[_0x6563('0x19')],_0x4e7282[_0x6563('0x17')]));switch(_0x4e7282['state']){case _0x6563('0x1a'):case _0x6563('0x1b'):if(!startsWith(exclude,_0x4e7282[_0x6563('0x17')])){members[_0x4e7282['device']]={'channel':_0x6563('0x1c'),'interface':_0x4e7282['device'],'type':_0x6563('0x1d'),'enterAt':utils[_0x6563('0x1e')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x6563('0x1f')](members[_0x4e7282['device']])){members[_0x4e7282[_0x6563('0x17')]][_0x6563('0x20')]=utils[_0x6563('0x1e')]();members[_0x4e7282['device']][_0x6563('0x21')]=utils['diffTime'](members[_0x4e7282[_0x6563('0x17')]][_0x6563('0x20')],members[_0x4e7282['device']][_0x6563('0x22')]);if(members[_0x4e7282[_0x6563('0x17')]]['uniqueid']){writeDB(members[_0x4e7282[_0x6563('0x17')]]);}}break;default:break;}}catch(_0x5b03a7){utils[_0x6563('0x11')](util['format']('[%s][members][devicestatechange]',members[_0x4e7282[_0x6563('0x17')]]?members[_0x4e7282[_0x6563('0x17')]][_0x6563('0x4')]:_0x4e7282[_0x6563('0x17')]),_0x5b03a7);}};exports[_0x6563('0x23')]=function(_0x4b4d3b){try{if(!_[_0x6563('0x1f')](members[_0x4b4d3b['interface']])){utils['debug'](util[_0x6563('0x3')](_0x6563('0x24'),_0x4b4d3b[_0x6563('0x4')]),_0x4b4d3b);utils[_0x6563('0x2')](util[_0x6563('0x3')](_0x6563('0x25'),_0x4b4d3b[_0x6563('0x4')],_0x4b4d3b[_0x6563('0x5')],_0x4b4d3b[_0x6563('0x26')]));members[_0x4b4d3b[_0x6563('0x5')]]=_['assign'](members[_0x4b4d3b[_0x6563('0x5')]],{'data4':_0x4b4d3b[_0x6563('0x26')],'uniqueid':_0x4b4d3b[_0x6563('0x4')]});}}catch(_0x1558fb){utils[_0x6563('0x11')](util[_0x6563('0x3')](_0x6563('0x24'),_0x4b4d3b['uniqueid']),_0x1558fb);}};exports[_0x6563('0x27')]=function(_0x147810){try{utils[_0x6563('0x16')](util[_0x6563('0x3')](_0x6563('0x28'),_0x147810[_0x6563('0x4')]),_0x147810);if(_0x147810['channel']){var _0x30ab30=_0x147810[_0x6563('0x6')][_0x6563('0x29')]('-')[0x0];if(!_[_0x6563('0x1f')](members[_0x30ab30])){members[_0x30ab30]=_[_0x6563('0x2a')](members[_0x30ab30],{'data1':members[_0x30ab30][_0x6563('0x2b')]||_0x147810[_0x6563('0x9')],'data2':members[_0x30ab30]['data2']||_0x147810[_0x6563('0x2c')],'data3':members[_0x30ab30][_0x6563('0x2d')]||_0x147810['destination'],'uniqueid':members[_0x30ab30][_0x6563('0x4')]||_0x147810[_0x6563('0x4')]});utils['info'](util['format'](_0x6563('0x2e'),_0x147810[_0x6563('0x4')],members[_0x30ab30][_0x6563('0x2b')],members[_0x30ab30][_0x6563('0x7')],members[_0x30ab30]['data3']));if(members[_0x30ab30][_0x6563('0x20')]){writeDB(members[_0x30ab30]);}}}if(_0x147810[_0x6563('0x2f')]){var _0x577875=_0x147810[_0x6563('0x2f')][_0x6563('0x29')]('-')[0x0];if(!_[_0x6563('0x1f')](members[_0x577875])){members[_0x577875]=_[_0x6563('0x2a')](members[_0x577875],{'data1':members[_0x577875][_0x6563('0x2b')]||_0x147810[_0x6563('0x9')],'data2':members[_0x577875][_0x6563('0x7')]||_0x147810[_0x6563('0x2c')],'data3':members[_0x577875][_0x6563('0x2d')]||_0x147810['destination'],'uniqueid':members[_0x577875][_0x6563('0x4')]||_0x147810[_0x6563('0x4')]});utils[_0x6563('0x2')](util[_0x6563('0x3')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x147810['uniqueid'],members[_0x577875][_0x6563('0x2b')],members[_0x577875][_0x6563('0x7')],members[_0x577875][_0x6563('0x2d')]));if(members[_0x577875]['exitAt']){writeDB(members[_0x577875]);}}}}catch(_0x3eadab){utils['error'](util[_0x6563('0x3')](_0x6563('0x28'),_0x147810['uniqueid']),_0x3eadab);}};
\ No newline at end of file
+var _0x826b=['channel','data1','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','data2','then','membername','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','[%s][members][writeDB]','some','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','uniqueid','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','exitAt','diffTime','enterAt','[%s][members][devicestatechange]','isNil','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]'];(function(_0x2214fa,_0x31d0f0){var _0x5a2280=function(_0x3a76b5){while(--_0x3a76b5){_0x2214fa['push'](_0x2214fa['shift']());}};_0x5a2280(++_0x31d0f0);}(_0x826b,0xdc));var _0xb826=function(_0x27d9f4,_0x388f1e){_0x27d9f4=_0x27d9f4-0x0;var _0x3861cd=_0x826b[_0x27d9f4];return _0x3861cd;};'use strict';var _=require(_0xb826('0x0'));var util=require(_0xb826('0x1'));var utils=require(_0xb826('0x2'));var members={};var exclude=[_0xb826('0x3'),_0xb826('0x4')];function writeDB(_0x304a4b){utils['info'](util[_0xb826('0x5')](_0xb826('0x6'),_0x304a4b['uniqueid'],_0x304a4b[_0xb826('0x7')],_0x304a4b['channel'],_0x304a4b[_0xb826('0x8')],_0x304a4b['membername'],_0x304a4b['type']));if(_0x304a4b[_0xb826('0x7')]){utils['getUserByInterface'](_0x304a4b[_0xb826('0x7')])[_0xb826('0x9')](function(_0x4d1cf8){if(_0x4d1cf8){_0x304a4b[_0xb826('0xa')]=_0x4d1cf8[_0xb826('0xb')];_0x304a4b[_0xb826('0xc')]=_0x4d1cf8[_0xb826('0xc')];utils[_0xb826('0xd')]('CreateMemberReport',_0x304a4b);}else{utils[_0xb826('0xe')](_0x304a4b[_0xb826('0x7')][_0xb826('0xf')]('/')[0x1])[_0xb826('0x9')](function(_0x3c2cfb){if(_0x3c2cfb){_0x304a4b[_0xb826('0xa')]=_0x3c2cfb[_0xb826('0xb')];_0x304a4b[_0xb826('0xc')]=_0x3c2cfb[_0xb826('0xc')];utils['request'](_0xb826('0x10'),_0x304a4b);}});}})[_0xb826('0x11')](function(_0x4f97a6){utils[_0xb826('0x12')](util[_0xb826('0x5')](_0xb826('0x13'),_0x304a4b['uniqueid']),_0x4f97a6);});}delete members[_0x304a4b[_0xb826('0x7')]];}function startsWith(_0x289a53,_0x2d5eb8){return _[_0xb826('0x14')](_0x289a53,function(_0x1540bc){return _['startsWith'](_0x2d5eb8,_0x1540bc);});}exports[_0xb826('0x15')]=function(_0x472187){try{utils[_0xb826('0x16')](util['format']('[%s][members][devicestatechange]',members[_0x472187[_0xb826('0x17')]]?members[_0x472187[_0xb826('0x17')]]['uniqueid']:_0x472187['device']),_0x472187);utils['info'](util['format'](_0xb826('0x18'),members[_0x472187[_0xb826('0x17')]]?members[_0x472187[_0xb826('0x17')]][_0xb826('0x19')]:_0x472187[_0xb826('0x17')],_0x472187[_0xb826('0x1a')],_0x472187[_0xb826('0x17')]));switch(_0x472187['state']){case'INUSE':case _0xb826('0x1b'):if(!startsWith(exclude,_0x472187[_0xb826('0x17')])){members[_0x472187['device']]={'channel':_0xb826('0x1c'),'interface':_0x472187[_0xb826('0x17')],'type':_0xb826('0x1d'),'enterAt':utils[_0xb826('0x1e')](),'role':_0xb826('0x1f')};}break;case _0xb826('0x20'):if(!_['isNil'](members[_0x472187[_0xb826('0x17')]])){members[_0x472187[_0xb826('0x17')]][_0xb826('0x21')]=utils[_0xb826('0x1e')]();members[_0x472187[_0xb826('0x17')]]['duration']=utils[_0xb826('0x22')](members[_0x472187[_0xb826('0x17')]]['exitAt'],members[_0x472187[_0xb826('0x17')]][_0xb826('0x23')]);if(members[_0x472187[_0xb826('0x17')]][_0xb826('0x19')]){writeDB(members[_0x472187[_0xb826('0x17')]]);}}break;default:break;}}catch(_0x22d1f9){utils[_0xb826('0x12')](util['format'](_0xb826('0x24'),members[_0x472187['device']]?members[_0x472187[_0xb826('0x17')]][_0xb826('0x19')]:_0x472187[_0xb826('0x17')]),_0x22d1f9);}};exports['agentcomplete']=function(_0x475c94){try{if(!_[_0xb826('0x25')](members[_0x475c94[_0xb826('0x7')]])){utils[_0xb826('0x16')](util[_0xb826('0x5')]('[%s][members][agentcomplete]',_0x475c94[_0xb826('0x19')]),_0x475c94);utils[_0xb826('0x26')](util[_0xb826('0x5')](_0xb826('0x27'),_0x475c94[_0xb826('0x19')],_0x475c94[_0xb826('0x7')],_0x475c94[_0xb826('0x28')]));members[_0x475c94['interface']]=_[_0xb826('0x29')](members[_0x475c94[_0xb826('0x7')]],{'data4':_0x475c94[_0xb826('0x28')],'uniqueid':_0x475c94[_0xb826('0x19')]});}}catch(_0x4b8940){utils[_0xb826('0x12')](util['format'](_0xb826('0x2a'),_0x475c94['uniqueid']),_0x4b8940);}};exports[_0xb826('0x2b')]=function(_0x3293d2){try{utils[_0xb826('0x16')](util[_0xb826('0x5')](_0xb826('0x2c'),_0x3293d2[_0xb826('0x19')]),_0x3293d2);if(_0x3293d2[_0xb826('0x2d')]){var _0x182b9e=_0x3293d2[_0xb826('0x2d')][_0xb826('0xf')]('-')[0x0];if(!_[_0xb826('0x25')](members[_0x182b9e])){members[_0x182b9e]=_['assign'](members[_0x182b9e],{'data1':members[_0x182b9e][_0xb826('0x2e')]||_0x3293d2[_0xb826('0x2f')],'data2':members[_0x182b9e]['data2']||_0x3293d2[_0xb826('0x30')],'data3':members[_0x182b9e][_0xb826('0x31')]||_0x3293d2[_0xb826('0x32')],'uniqueid':members[_0x182b9e][_0xb826('0x19')]||_0x3293d2['uniqueid']});utils[_0xb826('0x26')](util[_0xb826('0x5')](_0xb826('0x33'),_0x3293d2[_0xb826('0x19')],members[_0x182b9e][_0xb826('0x2e')],members[_0x182b9e][_0xb826('0x8')],members[_0x182b9e][_0xb826('0x31')]));if(members[_0x182b9e][_0xb826('0x21')]){writeDB(members[_0x182b9e]);}}}if(_0x3293d2[_0xb826('0x34')]){var _0x1fc05d=_0x3293d2['destinationchannel']['split']('-')[0x0];if(!_['isNil'](members[_0x1fc05d])){members[_0x1fc05d]=_['assign'](members[_0x1fc05d],{'data1':members[_0x1fc05d][_0xb826('0x2e')]||_0x3293d2[_0xb826('0x2f')],'data2':members[_0x1fc05d][_0xb826('0x8')]||_0x3293d2[_0xb826('0x30')],'data3':members[_0x1fc05d]['data3']||_0x3293d2[_0xb826('0x32')],'uniqueid':members[_0x1fc05d][_0xb826('0x19')]||_0x3293d2[_0xb826('0x19')]});utils['info'](util[_0xb826('0x5')](_0xb826('0x33'),_0x3293d2['uniqueid'],members[_0x1fc05d]['data1'],members[_0x1fc05d][_0xb826('0x8')],members[_0x1fc05d][_0xb826('0x31')]));if(members[_0x1fc05d][_0xb826('0x21')]){writeDB(members[_0x1fc05d]);}}}}catch(_0x4d1326){utils['error'](util[_0xb826('0x5')](_0xb826('0x2c'),_0x3293d2[_0xb826('0x19')]),_0x4d1326);}};
\ No newline at end of file
index ea93251..ef86123 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x25bd=['[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','type','CreateVoiceQueueReport','request','transfereduniqueid','debug','format','[%s][queues][queuecallerjoin]','uniqueid','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercompleteAt','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','variable','queuestatus','value','toUpperCase','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','queuecallerabandonAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','membername','destaccountcode','[%s][queues][agentconnect]','[%s][queues][agentcomplete]','assigned','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils'];(function(_0xf351e0,_0x213fc9){var _0x5ba9ed=function(_0x35cc9d){while(--_0x35cc9d){_0xf351e0['push'](_0xf351e0['shift']());}};_0x5ba9ed(++_0x213fc9);}(_0x25bd,0xc5));var _0xd25b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25bd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd25b('0x0'));var util=require(_0xd25b('0x1'));var utils=require(_0xd25b('0x2'));var queues={};function writeDB(_0x2a58e9){utils['info'](util['format'](_0xd25b('0x3'),_0x2a58e9['uniqueid'],_0x2a58e9[_0xd25b('0x4')],_0x2a58e9[_0xd25b('0x5')],_0x2a58e9[_0xd25b('0x6')],_0x2a58e9['calleridnum'],_0x2a58e9[_0xd25b('0x7')],_0x2a58e9[_0xd25b('0x8')]));if(_0x2a58e9[_0xd25b('0x5')]){utils[_0xd25b('0x9')](_0x2a58e9[_0xd25b('0x5')])['then'](function(_0x1b328a){if(_0x1b328a){_0x2a58e9['type']=_0x1b328a[_0xd25b('0xa')];}utils['request'](_0xd25b('0xb'),_0x2a58e9);});}else{utils[_0xd25b('0xc')](_0xd25b('0xb'),_0x2a58e9);}if(_0x2a58e9[_0xd25b('0xd')]){delete queues[_0x2a58e9['transfereduniqueid']];}else{delete queues[_0x2a58e9['uniqueid']];}}exports['queuecallerjoin']=function(_0x24842e){try{utils[_0xd25b('0xe')](util[_0xd25b('0xf')](_0xd25b('0x10'),_0x24842e[_0xd25b('0x11')]),_0x24842e);utils[_0xd25b('0x12')](util[_0xd25b('0xf')](_0xd25b('0x13'),_0x24842e[_0xd25b('0x11')],_0x24842e['queue'],_0x24842e[_0xd25b('0x14')]));queues[_0x24842e[_0xd25b('0x11')]]=_[_0xd25b('0x15')](_0x24842e,{'originalposition':_0x24842e[_0xd25b('0x14')],'queuecallerjoinAt':utils[_0xd25b('0x16')](),'mohtime':0x0});}catch(_0x4acfea){utils[_0xd25b('0x17')](util[_0xd25b('0xf')](_0xd25b('0x10'),_0x24842e[_0xd25b('0x11')]),_0x4acfea);}};exports[_0xd25b('0x18')]=function(_0x4d1ceb){try{if(!_[_0xd25b('0x19')](queues[_0x4d1ceb[_0xd25b('0x11')]])){utils[_0xd25b('0xe')](util['format'](_0xd25b('0x1a'),_0x4d1ceb[_0xd25b('0x11')]),_0x4d1ceb);if(queues[_0x4d1ceb[_0xd25b('0x11')]]['queuecallerleaveAt']){if(!queues[_0x4d1ceb[_0xd25b('0x11')]][_0xd25b('0x1b')]&&!queues[_0x4d1ceb[_0xd25b('0x11')]][_0xd25b('0x1c')]){queues[_0x4d1ceb[_0xd25b('0x11')]]['queuecallercomplete']=!![];queues[_0x4d1ceb[_0xd25b('0x11')]][_0xd25b('0x1d')]=utils[_0xd25b('0x16')]();queues[_0x4d1ceb['uniqueid']]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0xd25b('0x12')](util[_0xd25b('0xf')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x4d1ceb[_0xd25b('0x11')],queues[_0x4d1ceb[_0xd25b('0x11')]][_0xd25b('0x1e')],queues[_0x4d1ceb[_0xd25b('0x11')]]['queuecallerexitreason']));writeDB(queues[_0x4d1ceb['uniqueid']]);}else if(queues[_0x4d1ceb[_0xd25b('0x11')]][_0xd25b('0xd')]){utils[_0xd25b('0x12')](util['format'](_0xd25b('0x1f'),_0x4d1ceb[_0xd25b('0x11')],queues[_0x4d1ceb[_0xd25b('0x11')]][_0xd25b('0x1e')],queues[_0x4d1ceb[_0xd25b('0x11')]][_0xd25b('0xd')]));queues[queues[_0x4d1ceb[_0xd25b('0x11')]][_0xd25b('0xd')]]=queues[_0x4d1ceb[_0xd25b('0x11')]];queues[queues[_0x4d1ceb['uniqueid']]['transfereduniqueid']][_0xd25b('0x20')]=0x2;delete queues[_0x4d1ceb[_0xd25b('0x11')]];}}}catch(_0x45c6f4){utils[_0xd25b('0x17')](util[_0xd25b('0xf')](_0xd25b('0x1a'),_0x4d1ceb[_0xd25b('0x11')]),_0x45c6f4);}};exports['varset']=function(_0x469ac8){try{utils[_0xd25b('0xe')](util[_0xd25b('0xf')]('[%s][queues][varset]',_0x469ac8[_0xd25b('0x11')]),_0x469ac8);if(!_[_0xd25b('0x19')](_0x469ac8[_0xd25b('0x21')][_0xd25b('0x22')])&&_0x469ac8[_0xd25b('0x23')][_0xd25b('0x24')]()!=='CONTINUE'){if(!_[_0xd25b('0x19')](queues[_0x469ac8[_0xd25b('0x11')]])){queues[_0x469ac8[_0xd25b('0x11')]]['queuecallerabandon']=![];queues[_0x469ac8[_0xd25b('0x11')]]['queuecallerabandonAt']=null;queues[_0x469ac8[_0xd25b('0x11')]][_0xd25b('0x1c')]=!![];queues[_0x469ac8[_0xd25b('0x11')]][_0xd25b('0x25')]=utils[_0xd25b('0x16')]();queues[_0x469ac8['uniqueid']][_0xd25b('0x8')]=_0x469ac8['value'][_0xd25b('0x24')]();utils[_0xd25b('0x12')](util[_0xd25b('0xf')](_0xd25b('0x26'),_0x469ac8[_0xd25b('0x11')],queues[_0x469ac8['uniqueid']][_0xd25b('0x1e')],_0x469ac8[_0xd25b('0x23')],queues[_0x469ac8[_0xd25b('0x11')]]['queuecallerexitreason']));writeDB(queues[_0x469ac8[_0xd25b('0x11')]]);}}else if(!_[_0xd25b('0x19')](_0x469ac8[_0xd25b('0x21')]['queueposition'])){if(!_['isNil'](queues[_0x469ac8[_0xd25b('0x11')]])&&!queues[_0x469ac8[_0xd25b('0x11')]][_0xd25b('0x1b')]){queues[_0x469ac8[_0xd25b('0x11')]]['queuecallerabandon']=![];queues[_0x469ac8['uniqueid']]['queuecallerabandonAt']=null;queues[_0x469ac8[_0xd25b('0x11')]][_0xd25b('0x1c')]=!![];queues[_0x469ac8['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x469ac8[_0xd25b('0x11')]][_0xd25b('0x8')]='EXITWITHKEY';utils['info'](util[_0xd25b('0xf')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x469ac8[_0xd25b('0x11')],queues[_0x469ac8[_0xd25b('0x11')]][_0xd25b('0x1e')],_0x469ac8['value'],queues[_0x469ac8['uniqueid']][_0xd25b('0x8')]));}}}catch(_0x30d44f){utils['error'](util['format'](_0xd25b('0x27'),_0x469ac8[_0xd25b('0x11')]),_0x30d44f);}};exports[_0xd25b('0x1b')]=function(_0x4cf6a1){try{if(!_[_0xd25b('0x19')](queues[_0x4cf6a1['uniqueid']])){utils[_0xd25b('0xe')](util[_0xd25b('0xf')]('[%s][queues][queuecallerabandon]',_0x4cf6a1[_0xd25b('0x11')]),_0x4cf6a1);queues[_0x4cf6a1[_0xd25b('0x11')]][_0xd25b('0x1c')]=![];queues[_0x4cf6a1[_0xd25b('0x11')]][_0xd25b('0x25')]=null;queues[_0x4cf6a1['uniqueid']][_0xd25b('0x1b')]=!![];queues[_0x4cf6a1[_0xd25b('0x11')]][_0xd25b('0x28')]=utils[_0xd25b('0x16')]();queues[_0x4cf6a1[_0xd25b('0x11')]][_0xd25b('0x8')]=_0xd25b('0x29');utils[_0xd25b('0x12')](util[_0xd25b('0xf')](_0xd25b('0x2a'),_0x4cf6a1[_0xd25b('0x11')],queues[_0x4cf6a1[_0xd25b('0x11')]][_0xd25b('0x1e')],queues[_0x4cf6a1['uniqueid']][_0xd25b('0x8')]));}}catch(_0x6d61ad){utils[_0xd25b('0x17')](util[_0xd25b('0xf')](_0xd25b('0x2b'),_0x4cf6a1[_0xd25b('0x11')]),_0x6d61ad);}};exports[_0xd25b('0x2c')]=function(_0x5c8bc7){try{if(!_[_0xd25b('0x19')](queues[_0x5c8bc7[_0xd25b('0x11')]])){utils[_0xd25b('0xe')](util[_0xd25b('0xf')](_0xd25b('0x2d'),_0x5c8bc7['uniqueid']),_0x5c8bc7);utils[_0xd25b('0x12')](util[_0xd25b('0xf')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5c8bc7[_0xd25b('0x11')],queues[_0x5c8bc7[_0xd25b('0x11')]]['name'],_0x5c8bc7[_0xd25b('0x2e')],_0x5c8bc7[_0xd25b('0x2f')]));queues[_0x5c8bc7['uniqueid']]['queuecallerleave']=!![];queues[_0x5c8bc7[_0xd25b('0x11')]]['queuecallerleaveAt']=utils[_0xd25b('0x16')]();queues[_0x5c8bc7[_0xd25b('0x11')]][_0xd25b('0x30')]=utils[_0xd25b('0x31')](queues[_0x5c8bc7['uniqueid']][_0xd25b('0x32')],queues[_0x5c8bc7[_0xd25b('0x11')]][_0xd25b('0x33')]);queues[_0x5c8bc7[_0xd25b('0x11')]][_0xd25b('0x14')]=_0x5c8bc7[_0xd25b('0x14')];queues[_0x5c8bc7['uniqueid']][_0xd25b('0x34')]=_0x5c8bc7[_0xd25b('0x34')];queues[_0x5c8bc7[_0xd25b('0x11')]][_0xd25b('0x2e')]=_0x5c8bc7[_0xd25b('0x2e')];queues[_0x5c8bc7['uniqueid']][_0xd25b('0x2f')]=_0x5c8bc7[_0xd25b('0x2f')];}}catch(_0x12c74a){utils[_0xd25b('0x17')](util['format'](_0xd25b('0x2d'),_0x5c8bc7[_0xd25b('0x11')]),_0x12c74a);}};exports['agentconnect']=function(_0x12f0e0){try{if(!_[_0xd25b('0x19')](queues[_0x12f0e0['uniqueid']])){utils['debug'](util[_0xd25b('0xf')]('[%s][queues][agentconnect]',_0x12f0e0['uniqueid']),_0x12f0e0);utils[_0xd25b('0x12')](util[_0xd25b('0xf')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x12f0e0[_0xd25b('0x11')],queues[_0x12f0e0[_0xd25b('0x11')]][_0xd25b('0x1e')],_0x12f0e0[_0xd25b('0x35')],_0x12f0e0[_0xd25b('0x36')]));queues[_0x12f0e0[_0xd25b('0x11')]][_0xd25b('0x1b')]=![];queues[_0x12f0e0[_0xd25b('0x11')]][_0xd25b('0x1b')]=![];queues[_0x12f0e0['uniqueid']][_0xd25b('0x28')]=null;queues[_0x12f0e0[_0xd25b('0x11')]][_0xd25b('0x1c')]=![];queues[_0x12f0e0['uniqueid']][_0xd25b('0x8')]=null;queues[_0x12f0e0[_0xd25b('0x11')]][_0xd25b('0x25')]=null;queues[_0x12f0e0['uniqueid']]['assigned']=!![];queues[_0x12f0e0[_0xd25b('0x11')]][_0xd25b('0x7')]=_0x12f0e0[_0xd25b('0x36')];queues[_0x12f0e0[_0xd25b('0x11')]][_0xd25b('0x6')]=_0x12f0e0['membername'];}}catch(_0x37e061){utils[_0xd25b('0x17')](util[_0xd25b('0xf')](_0xd25b('0x37'),_0x12f0e0[_0xd25b('0x11')]),_0x37e061);}};exports['agentcomplete']=function(_0x4459ed){try{if(!_[_0xd25b('0x19')](queues[_0x4459ed['uniqueid']])){if(queues[_0x4459ed['uniqueid']]['queuecallerleaveAt']){utils['debug'](util[_0xd25b('0xf')](_0xd25b('0x38'),_0x4459ed[_0xd25b('0x11')]),_0x4459ed);queues[_0x4459ed[_0xd25b('0x11')]][_0xd25b('0x1b')]=![];queues[_0x4459ed[_0xd25b('0x11')]][_0xd25b('0x1b')]=![];queues[_0x4459ed[_0xd25b('0x11')]][_0xd25b('0x28')]=null;queues[_0x4459ed[_0xd25b('0x11')]][_0xd25b('0x1c')]=![];queues[_0x4459ed[_0xd25b('0x11')]]['queuecallerexitAt']=null;queues[_0x4459ed[_0xd25b('0x11')]][_0xd25b('0x39')]=!![];queues[_0x4459ed[_0xd25b('0x11')]][_0xd25b('0x6')]=_0x4459ed[_0xd25b('0x35')];queues[_0x4459ed['uniqueid']][_0xd25b('0x3a')]=!![];queues[_0x4459ed[_0xd25b('0x11')]][_0xd25b('0x1d')]=utils[_0xd25b('0x16')]();if(_0x4459ed[_0xd25b('0x3b')]==_0xd25b('0x3c')){if(!queues[_0x4459ed[_0xd25b('0x11')]][_0xd25b('0x3c')]){queues[_0x4459ed['uniqueid']]['queuecallerexitreason']=_0xd25b('0x3d');}}else{queues[_0x4459ed['uniqueid']][_0xd25b('0x8')]=_0xd25b('0x3e')+_0x4459ed[_0xd25b('0x3b')][_0xd25b('0x24')]();}utils[_0xd25b('0x12')](util['format'](_0xd25b('0x3f'),_0x4459ed[_0xd25b('0x11')],queues[_0x4459ed['uniqueid']][_0xd25b('0x1e')],_0x4459ed[_0xd25b('0x35')],queues[_0x4459ed[_0xd25b('0x11')]]['queuecallerexitreason']));writeDB(queues[_0x4459ed[_0xd25b('0x11')]]);}}}catch(_0x3151a3){utils[_0xd25b('0x17')](util[_0xd25b('0xf')](_0xd25b('0x38'),_0x4459ed['uniqueid']),_0x3151a3);}};exports['blindtransfer']=function(_0x5ad54a){try{if(!_[_0xd25b('0x19')](queues[_0x5ad54a['transfereeuniqueid']])){utils['debug'](util[_0xd25b('0xf')]('[%s][queues][blindtransfer]',_0x5ad54a[_0xd25b('0x11')]),_0x5ad54a);queues[_0x5ad54a['transfereeuniqueid']][_0xd25b('0x3c')]=!![];queues[_0x5ad54a[_0xd25b('0x40')]][_0xd25b('0x41')]=_0xd25b('0x42');queues[_0x5ad54a[_0xd25b('0x40')]]['transferexten']=_0x5ad54a[_0xd25b('0x43')];queues[_0x5ad54a[_0xd25b('0x40')]][_0xd25b('0x44')]=_0x5ad54a['transfereeuniqueid'];queues[_0x5ad54a['transfereeuniqueid']][_0xd25b('0x8')]=_0xd25b('0x45');utils[_0xd25b('0x12')](util[_0xd25b('0xf')](_0xd25b('0x46'),_0x5ad54a[_0xd25b('0x11')],queues[_0x5ad54a[_0xd25b('0x40')]]['name'],_0x5ad54a['transfereeuniqueid'],_0x5ad54a[_0xd25b('0x43')]));}}catch(_0x4377e5){utils['error'](util[_0xd25b('0xf')]('[%s][queues][blindtransfer]',_0x5ad54a[_0xd25b('0x11')]),_0x4377e5);}};exports[_0xd25b('0x47')]=function(_0xccca34){try{utils[_0xd25b('0xe')](util['format'](_0xd25b('0x48'),_0xccca34[_0xd25b('0x49')]),_0xccca34);if(_0xccca34[_0xd25b('0x49')]==_0xccca34['origtransfererlinkedid']){if(!_['isNil'](queues[_0xccca34['secondtransfererlinkedid']])){utils[_0xd25b('0x12')](util[_0xd25b('0xf')](_0xd25b('0x4a'),_0xccca34[_0xd25b('0x49')],queues[_0xccca34[_0xd25b('0x4b')]][_0xd25b('0x1e')],_0xccca34[_0xd25b('0x4c')]));queues[_0xccca34[_0xd25b('0x4b')]]['transfer']=!![];queues[_0xccca34['secondtransfererlinkedid']][_0xd25b('0x41')]=_0xd25b('0x4d');queues[_0xccca34[_0xd25b('0x4b')]][_0xd25b('0x4e')]=_0xccca34['origtransfererexten'];queues[_0xccca34[_0xd25b('0x4b')]][_0xd25b('0x44')]=_0xccca34[_0xd25b('0x49')];queues[_0xccca34[_0xd25b('0x4b')]][_0xd25b('0x8')]=_0xd25b('0x4f');}if(!_[_0xd25b('0x19')](queues[_0xccca34[_0xd25b('0x50')]])){if(_0xccca34[_0xd25b('0x51')]&&queues[_0xccca34[_0xd25b('0x51')]]){queues[_0xccca34[_0xd25b('0x51')]][_0xd25b('0x20')]=0x1;queues[_0xccca34[_0xd25b('0x40')]]=_['clone'](queues[_0xccca34['transfereelinkedid']]);queues[_0xccca34[_0xd25b('0x40')]][_0xd25b('0xd')]=_0xccca34[_0xd25b('0x52')];queues[_0xccca34[_0xd25b('0x40')]]['queuecallerenterreason']=0x2;queues[_0xccca34['transfereeuniqueid']][_0xd25b('0x53')]=queues[_0xccca34[_0xd25b('0x4b')]]['calleridnum'];queues[_0xccca34['transfereeuniqueid']][_0xd25b('0x54')]=queues[_0xccca34['secondtransfererlinkedid']]['calleridname'];queues[_0xccca34[_0xd25b('0x40')]][_0xd25b('0x33')]=utils[_0xd25b('0x16')]();queues[_0xccca34[_0xd25b('0x40')]][_0xd25b('0x32')]=utils[_0xd25b('0x16')]();queues[_0xccca34[_0xd25b('0x40')]]['holdtime']=0x0;queues[_0xccca34['transfereeuniqueid']]['mohtime']=0x0;utils[_0xd25b('0x12')](util['format'](_0xd25b('0x55'),_0xccca34[_0xd25b('0x49')],queues[_0xccca34[_0xd25b('0x40')]][_0xd25b('0x1e')],queues[_0xccca34['transfereeuniqueid']][_0xd25b('0x53')],queues[_0xccca34[_0xd25b('0x40')]][_0xd25b('0x54')]));}else{utils[_0xd25b('0x12')](util[_0xd25b('0xf')](_0xd25b('0x56'),_0xccca34['origtransfereruniqueid'],queues[_0xccca34['origtransfererlinkedid']][_0xd25b('0x1e')],_0xccca34[_0xd25b('0x4b')]));queues[_0xccca34[_0xd25b('0x50')]][_0xd25b('0xd')]=_0xccca34[_0xd25b('0x4b')];}}}else if(_0xccca34[_0xd25b('0x57')]==_0xccca34[_0xd25b('0x4b')]){if(!_[_0xd25b('0x19')](queues[_0xccca34[_0xd25b('0x50')]])){utils[_0xd25b('0x12')](util[_0xd25b('0xf')](_0xd25b('0x58'),_0xccca34['origtransfereruniqueid'],queues[_0xccca34[_0xd25b('0x50')]][_0xd25b('0x1e')],_0xccca34[_0xd25b('0x57')],_0xccca34[_0xd25b('0x59')]));queues[_0xccca34[_0xd25b('0x50')]]['transfer']=!![];queues[_0xccca34[_0xd25b('0x50')]][_0xd25b('0x41')]=_0xd25b('0x4d');queues[_0xccca34[_0xd25b('0x50')]]['transferexten']=_0xccca34[_0xd25b('0x59')];queues[_0xccca34[_0xd25b('0x50')]]['transferuniqueid']=_0xccca34[_0xd25b('0x57')];queues[_0xccca34[_0xd25b('0x50')]]['queuecallerexitreason']=_0xd25b('0x4f');}if(!_[_0xd25b('0x19')](queues[_0xccca34[_0xd25b('0x4b')]])){if(_0xccca34[_0xd25b('0x5a')]&&queues[_0xccca34[_0xd25b('0x5a')]]){queues[_0xccca34[_0xd25b('0x5a')]][_0xd25b('0x20')]=0x1;queues[_0xccca34[_0xd25b('0x52')]]=_[_0xd25b('0x5b')](queues[_0xccca34['transfertargetlinkedid']]);queues[_0xccca34[_0xd25b('0x52')]][_0xd25b('0xd')]=_0xccca34[_0xd25b('0x52')];queues[_0xccca34[_0xd25b('0x52')]][_0xd25b('0x20')]=0x2;queues[_0xccca34[_0xd25b('0x52')]][_0xd25b('0x53')]=queues[_0xccca34[_0xd25b('0x50')]][_0xd25b('0x53')];queues[_0xccca34[_0xd25b('0x52')]][_0xd25b('0x54')]=queues[_0xccca34[_0xd25b('0x50')]][_0xd25b('0x54')];queues[_0xccca34[_0xd25b('0x52')]][_0xd25b('0x33')]=utils[_0xd25b('0x16')]();queues[_0xccca34[_0xd25b('0x52')]][_0xd25b('0x32')]=utils[_0xd25b('0x16')]();queues[_0xccca34['transfertargetuniqueid']][_0xd25b('0x30')]=0x0;queues[_0xccca34[_0xd25b('0x52')]][_0xd25b('0x5c')]=0x0;utils['info'](util[_0xd25b('0xf')](_0xd25b('0x5d'),_0xccca34[_0xd25b('0x49')],queues[_0xccca34[_0xd25b('0x52')]]['name'],queues[_0xccca34[_0xd25b('0x52')]]['transfereduniqueid'],queues[_0xccca34[_0xd25b('0x52')]]['calleridnum'],queues[_0xccca34[_0xd25b('0x52')]][_0xd25b('0x54')]));}else{utils[_0xd25b('0x12')](util[_0xd25b('0xf')](_0xd25b('0x56'),_0xccca34[_0xd25b('0x49')],queues[_0xccca34['secondtransfererlinkedid']][_0xd25b('0x1e')],_0xccca34[_0xd25b('0x50')]));queues[_0xccca34[_0xd25b('0x4b')]][_0xd25b('0xd')]=_0xccca34[_0xd25b('0x50')];}}}}catch(_0x128373){utils[_0xd25b('0x17')](util[_0xd25b('0xf')](_0xd25b('0x48'),_0xccca34[_0xd25b('0x49')]),_0x128373);}};exports['musiconholdstart']=function(_0x4a1cbe){try{if(!_['isNil'](queues[_0x4a1cbe['uniqueid']])){utils['debug'](util[_0xd25b('0xf')]('[%s][queues][musiconholdstart]',_0x4a1cbe[_0xd25b('0x11')]),_0x4a1cbe);queues[_0x4a1cbe['uniqueid']][_0xd25b('0x5e')]=utils[_0xd25b('0x16')]();utils[_0xd25b('0x12')](util[_0xd25b('0xf')](_0xd25b('0x5f'),_0x4a1cbe[_0xd25b('0x11')],queues[_0x4a1cbe[_0xd25b('0x11')]]['name'],queues[_0x4a1cbe[_0xd25b('0x11')]]['musiconholdstartAt']));}}catch(_0x56665c){utils[_0xd25b('0x17')](util['format'](_0xd25b('0x60'),_0x4a1cbe[_0xd25b('0x11')]),_0x56665c);}};exports[_0xd25b('0x61')]=function(_0x104a96){try{if(!_[_0xd25b('0x19')](queues[_0x104a96['uniqueid']])){if(!_[_0xd25b('0x19')](queues[_0x104a96[_0xd25b('0x11')]][_0xd25b('0x5e')])){utils[_0xd25b('0xe')](util[_0xd25b('0xf')](_0xd25b('0x62'),_0x104a96[_0xd25b('0x11')]),_0x104a96);queues[_0x104a96[_0xd25b('0x11')]][_0xd25b('0x5c')]+=utils[_0xd25b('0x31')](utils[_0xd25b('0x16')](),queues[_0x104a96[_0xd25b('0x11')]][_0xd25b('0x5e')]);utils[_0xd25b('0x12')](util[_0xd25b('0xf')](_0xd25b('0x63'),_0x104a96[_0xd25b('0x11')],queues[_0x104a96[_0xd25b('0x11')]]['name'],queues[_0x104a96['uniqueid']][_0xd25b('0x5c')]));delete queues[_0x104a96['uniqueid']][_0xd25b('0x5e')];}}}catch(_0x4eaea3){utils['error'](util[_0xd25b('0xf')](_0xd25b('0x62'),_0x104a96[_0xd25b('0x11')]),_0x4eaea3);}};
\ No newline at end of file
+var _0xacb5=['debug','[%s][queues][hangup]','queuecallerabandon','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','isNil','queuecallerabandonAt','queuecallerexit','value','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','queuecallercompleteAt','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','accountcode','queuecallerexitreason','type','CreateVoiceQueueReport','request','transfereduniqueid','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xacb5,0x1e4));var _0x5acb=function(_0x16f77c,_0x5256b1){_0x16f77c=_0x16f77c-0x0;var _0x78986e=_0xacb5[_0x16f77c];return _0x78986e;};'use strict';var _=require(_0x5acb('0x0'));var util=require('util');var utils=require(_0x5acb('0x1'));var queues={};function writeDB(_0x5b03d1){utils['info'](util[_0x5acb('0x2')](_0x5acb('0x3'),_0x5b03d1[_0x5acb('0x4')],_0x5b03d1[_0x5acb('0x5')],_0x5b03d1[_0x5acb('0x6')],_0x5b03d1['lastAssignedTo'],_0x5b03d1['calleridnum'],_0x5b03d1[_0x5acb('0x7')],_0x5b03d1[_0x5acb('0x8')]));if(_0x5b03d1['queue']){utils['getVoiceQueueByName'](_0x5b03d1['queue'])['then'](function(_0x229fce){if(_0x229fce){_0x5b03d1[_0x5acb('0x9')]=_0x229fce[_0x5acb('0x9')];}utils['request'](_0x5acb('0xa'),_0x5b03d1);});}else{utils[_0x5acb('0xb')](_0x5acb('0xa'),_0x5b03d1);}if(_0x5b03d1[_0x5acb('0xc')]){delete queues[_0x5b03d1[_0x5acb('0xc')]];}else{delete queues[_0x5b03d1[_0x5acb('0x4')]];}}exports['queuecallerjoin']=function(_0x1fd4aa){try{utils['debug'](util['format'](_0x5acb('0xd'),_0x1fd4aa[_0x5acb('0x4')]),_0x1fd4aa);utils[_0x5acb('0xe')](util[_0x5acb('0x2')](_0x5acb('0xf'),_0x1fd4aa[_0x5acb('0x4')],_0x1fd4aa[_0x5acb('0x6')],_0x1fd4aa[_0x5acb('0x10')]));queues[_0x1fd4aa[_0x5acb('0x4')]]=_[_0x5acb('0x11')](_0x1fd4aa,{'originalposition':_0x1fd4aa[_0x5acb('0x10')],'queuecallerjoinAt':utils[_0x5acb('0x12')](),'mohtime':0x0});}catch(_0x12a3d1){utils[_0x5acb('0x13')](util[_0x5acb('0x2')](_0x5acb('0xd'),_0x1fd4aa[_0x5acb('0x4')]),_0x12a3d1);}};exports[_0x5acb('0x14')]=function(_0x242e82){try{if(!_['isNil'](queues[_0x242e82['uniqueid']])){utils[_0x5acb('0x15')](util[_0x5acb('0x2')](_0x5acb('0x16'),_0x242e82[_0x5acb('0x4')]),_0x242e82);if(queues[_0x242e82[_0x5acb('0x4')]]['queuecallerleaveAt']){if(!queues[_0x242e82[_0x5acb('0x4')]][_0x5acb('0x17')]&&!queues[_0x242e82[_0x5acb('0x4')]]['queuecallerexit']){queues[_0x242e82['uniqueid']][_0x5acb('0x18')]=!![];queues[_0x242e82['uniqueid']]['queuecallercompleteAt']=utils[_0x5acb('0x12')]();queues[_0x242e82[_0x5acb('0x4')]][_0x5acb('0x8')]=_0x5acb('0x19');}utils[_0x5acb('0xe')](util[_0x5acb('0x2')](_0x5acb('0x1a'),_0x242e82[_0x5acb('0x4')],queues[_0x242e82[_0x5acb('0x4')]][_0x5acb('0x1b')],queues[_0x242e82[_0x5acb('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x242e82[_0x5acb('0x4')]]);}else if(queues[_0x242e82[_0x5acb('0x4')]]['transfereduniqueid']){utils[_0x5acb('0xe')](util[_0x5acb('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x242e82[_0x5acb('0x4')],queues[_0x242e82[_0x5acb('0x4')]]['name'],queues[_0x242e82[_0x5acb('0x4')]][_0x5acb('0xc')]));queues[queues[_0x242e82[_0x5acb('0x4')]]['transfereduniqueid']]=queues[_0x242e82[_0x5acb('0x4')]];queues[queues[_0x242e82[_0x5acb('0x4')]][_0x5acb('0xc')]][_0x5acb('0x1c')]=0x2;delete queues[_0x242e82[_0x5acb('0x4')]];}}}catch(_0x4991d9){utils[_0x5acb('0x13')](util[_0x5acb('0x2')]('[%s][queues][hangup]',_0x242e82['uniqueid']),_0x4991d9);}};exports['varset']=function(_0x148430){try{utils[_0x5acb('0x15')](util[_0x5acb('0x2')](_0x5acb('0x1d'),_0x148430[_0x5acb('0x4')]),_0x148430);if(!_['isNil'](_0x148430[_0x5acb('0x1e')][_0x5acb('0x1f')])&&_0x148430['value'][_0x5acb('0x20')]()!==_0x5acb('0x21')){if(!_[_0x5acb('0x22')](queues[_0x148430['uniqueid']])){queues[_0x148430[_0x5acb('0x4')]][_0x5acb('0x17')]=![];queues[_0x148430[_0x5acb('0x4')]][_0x5acb('0x23')]=null;queues[_0x148430[_0x5acb('0x4')]][_0x5acb('0x24')]=!![];queues[_0x148430['uniqueid']]['queuecallerexitAt']=utils[_0x5acb('0x12')]();queues[_0x148430['uniqueid']][_0x5acb('0x8')]=_0x148430[_0x5acb('0x25')][_0x5acb('0x20')]();utils['info'](util[_0x5acb('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x148430[_0x5acb('0x4')],queues[_0x148430[_0x5acb('0x4')]][_0x5acb('0x1b')],_0x148430['value'],queues[_0x148430['uniqueid']][_0x5acb('0x8')]));writeDB(queues[_0x148430['uniqueid']]);}}else if(!_[_0x5acb('0x22')](_0x148430['variable'][_0x5acb('0x26')])){if(!_[_0x5acb('0x22')](queues[_0x148430[_0x5acb('0x4')]])&&!queues[_0x148430[_0x5acb('0x4')]]['queuecallerabandon']){queues[_0x148430['uniqueid']]['queuecallerabandon']=![];queues[_0x148430[_0x5acb('0x4')]][_0x5acb('0x23')]=null;queues[_0x148430[_0x5acb('0x4')]][_0x5acb('0x24')]=!![];queues[_0x148430[_0x5acb('0x4')]][_0x5acb('0x27')]=utils[_0x5acb('0x12')]();queues[_0x148430['uniqueid']][_0x5acb('0x8')]=_0x5acb('0x28');utils['info'](util['format'](_0x5acb('0x29'),_0x148430[_0x5acb('0x4')],queues[_0x148430[_0x5acb('0x4')]][_0x5acb('0x1b')],_0x148430[_0x5acb('0x25')],queues[_0x148430[_0x5acb('0x4')]][_0x5acb('0x8')]));}}}catch(_0x2179f7){utils[_0x5acb('0x13')](util['format'](_0x5acb('0x1d'),_0x148430['uniqueid']),_0x2179f7);}};exports[_0x5acb('0x17')]=function(_0x435d67){try{if(!_[_0x5acb('0x22')](queues[_0x435d67[_0x5acb('0x4')]])){utils[_0x5acb('0x15')](util[_0x5acb('0x2')](_0x5acb('0x2a'),_0x435d67[_0x5acb('0x4')]),_0x435d67);queues[_0x435d67[_0x5acb('0x4')]][_0x5acb('0x24')]=![];queues[_0x435d67['uniqueid']][_0x5acb('0x27')]=null;queues[_0x435d67[_0x5acb('0x4')]]['queuecallerabandon']=!![];queues[_0x435d67[_0x5acb('0x4')]][_0x5acb('0x23')]=utils[_0x5acb('0x12')]();queues[_0x435d67[_0x5acb('0x4')]][_0x5acb('0x8')]=_0x5acb('0x2b');utils[_0x5acb('0xe')](util[_0x5acb('0x2')](_0x5acb('0x2c'),_0x435d67[_0x5acb('0x4')],queues[_0x435d67['uniqueid']][_0x5acb('0x1b')],queues[_0x435d67['uniqueid']][_0x5acb('0x8')]));}}catch(_0x5cbba8){utils['error'](util[_0x5acb('0x2')](_0x5acb('0x2a'),_0x435d67[_0x5acb('0x4')]),_0x5cbba8);}};exports[_0x5acb('0x2d')]=function(_0x2e0847){try{if(!_[_0x5acb('0x22')](queues[_0x2e0847[_0x5acb('0x4')]])){utils[_0x5acb('0x15')](util[_0x5acb('0x2')](_0x5acb('0x2e'),_0x2e0847[_0x5acb('0x4')]),_0x2e0847);utils[_0x5acb('0xe')](util[_0x5acb('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2e0847[_0x5acb('0x4')],queues[_0x2e0847[_0x5acb('0x4')]][_0x5acb('0x1b')],_0x2e0847['connectedlinenum'],_0x2e0847[_0x5acb('0x2f')]));queues[_0x2e0847[_0x5acb('0x4')]][_0x5acb('0x2d')]=!![];queues[_0x2e0847['uniqueid']][_0x5acb('0x30')]=utils[_0x5acb('0x12')]();queues[_0x2e0847[_0x5acb('0x4')]][_0x5acb('0x31')]=utils[_0x5acb('0x32')](queues[_0x2e0847[_0x5acb('0x4')]][_0x5acb('0x30')],queues[_0x2e0847[_0x5acb('0x4')]][_0x5acb('0x33')]);queues[_0x2e0847['uniqueid']]['position']=_0x2e0847['position'];queues[_0x2e0847['uniqueid']]['count']=_0x2e0847[_0x5acb('0x34')];queues[_0x2e0847[_0x5acb('0x4')]]['connectedlinenum']=_0x2e0847[_0x5acb('0x35')];queues[_0x2e0847[_0x5acb('0x4')]]['connectedlinename']=_0x2e0847[_0x5acb('0x2f')];}}catch(_0xb25ffa){utils[_0x5acb('0x13')](util[_0x5acb('0x2')](_0x5acb('0x2e'),_0x2e0847[_0x5acb('0x4')]),_0xb25ffa);}};exports[_0x5acb('0x36')]=function(_0x101a38){try{if(!_[_0x5acb('0x22')](queues[_0x101a38[_0x5acb('0x4')]])){utils['debug'](util[_0x5acb('0x2')]('[%s][queues][agentconnect]',_0x101a38[_0x5acb('0x4')]),_0x101a38);utils[_0x5acb('0xe')](util['format'](_0x5acb('0x37'),_0x101a38['uniqueid'],queues[_0x101a38[_0x5acb('0x4')]][_0x5acb('0x1b')],_0x101a38[_0x5acb('0x38')],_0x101a38[_0x5acb('0x39')]));queues[_0x101a38[_0x5acb('0x4')]][_0x5acb('0x17')]=![];queues[_0x101a38[_0x5acb('0x4')]][_0x5acb('0x17')]=![];queues[_0x101a38[_0x5acb('0x4')]][_0x5acb('0x23')]=null;queues[_0x101a38[_0x5acb('0x4')]][_0x5acb('0x24')]=![];queues[_0x101a38[_0x5acb('0x4')]]['queuecallerexitreason']=null;queues[_0x101a38['uniqueid']][_0x5acb('0x27')]=null;queues[_0x101a38['uniqueid']]['assigned']=!![];queues[_0x101a38[_0x5acb('0x4')]]['accountcode']=_0x101a38['destaccountcode'];queues[_0x101a38['uniqueid']]['lastAssignedTo']=_0x101a38[_0x5acb('0x38')];}}catch(_0x4ec36d){utils[_0x5acb('0x13')](util[_0x5acb('0x2')]('[%s][queues][agentconnect]',_0x101a38[_0x5acb('0x4')]),_0x4ec36d);}};exports[_0x5acb('0x3a')]=function(_0x1f1590){try{if(!_[_0x5acb('0x22')](queues[_0x1f1590[_0x5acb('0x4')]])){if(queues[_0x1f1590[_0x5acb('0x4')]][_0x5acb('0x30')]){utils[_0x5acb('0x15')](util[_0x5acb('0x2')](_0x5acb('0x3b'),_0x1f1590[_0x5acb('0x4')]),_0x1f1590);queues[_0x1f1590[_0x5acb('0x4')]][_0x5acb('0x17')]=![];queues[_0x1f1590[_0x5acb('0x4')]][_0x5acb('0x17')]=![];queues[_0x1f1590[_0x5acb('0x4')]][_0x5acb('0x23')]=null;queues[_0x1f1590['uniqueid']][_0x5acb('0x24')]=![];queues[_0x1f1590['uniqueid']][_0x5acb('0x27')]=null;queues[_0x1f1590[_0x5acb('0x4')]][_0x5acb('0x3c')]=!![];queues[_0x1f1590['uniqueid']]['lastAssignedTo']=_0x1f1590[_0x5acb('0x38')];queues[_0x1f1590[_0x5acb('0x4')]][_0x5acb('0x18')]=!![];queues[_0x1f1590[_0x5acb('0x4')]][_0x5acb('0x3d')]=utils[_0x5acb('0x12')]();if(_0x1f1590['reason']=='transfer'){if(!queues[_0x1f1590[_0x5acb('0x4')]][_0x5acb('0x3e')]){queues[_0x1f1590[_0x5acb('0x4')]][_0x5acb('0x8')]=_0x5acb('0x3f');}}else{queues[_0x1f1590[_0x5acb('0x4')]][_0x5acb('0x8')]=_0x5acb('0x40')+_0x1f1590['reason'][_0x5acb('0x20')]();}utils[_0x5acb('0xe')](util[_0x5acb('0x2')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x1f1590['uniqueid'],queues[_0x1f1590['uniqueid']]['name'],_0x1f1590['membername'],queues[_0x1f1590[_0x5acb('0x4')]][_0x5acb('0x8')]));writeDB(queues[_0x1f1590[_0x5acb('0x4')]]);}}}catch(_0xb6f77a){utils[_0x5acb('0x13')](util['format'](_0x5acb('0x3b'),_0x1f1590[_0x5acb('0x4')]),_0xb6f77a);}};exports[_0x5acb('0x41')]=function(_0x361e22){try{if(!_[_0x5acb('0x22')](queues[_0x361e22[_0x5acb('0x42')]])){utils[_0x5acb('0x15')](util[_0x5acb('0x2')](_0x5acb('0x43'),_0x361e22[_0x5acb('0x4')]),_0x361e22);queues[_0x361e22[_0x5acb('0x42')]][_0x5acb('0x3e')]=!![];queues[_0x361e22['transfereeuniqueid']][_0x5acb('0x44')]='BLIND';queues[_0x361e22[_0x5acb('0x42')]][_0x5acb('0x45')]=_0x361e22[_0x5acb('0x46')];queues[_0x361e22['transfereeuniqueid']][_0x5acb('0x47')]=_0x361e22['transfereeuniqueid'];queues[_0x361e22[_0x5acb('0x42')]][_0x5acb('0x8')]=_0x5acb('0x48');utils['info'](util['format'](_0x5acb('0x49'),_0x361e22['uniqueid'],queues[_0x361e22[_0x5acb('0x42')]][_0x5acb('0x1b')],_0x361e22[_0x5acb('0x42')],_0x361e22[_0x5acb('0x46')]));}}catch(_0x5e6a46){utils['error'](util[_0x5acb('0x2')](_0x5acb('0x43'),_0x361e22[_0x5acb('0x4')]),_0x5e6a46);}};exports[_0x5acb('0x4a')]=function(_0x56ab92){try{utils[_0x5acb('0x15')](util['format'](_0x5acb('0x4b'),_0x56ab92[_0x5acb('0x4c')]),_0x56ab92);if(_0x56ab92[_0x5acb('0x4c')]==_0x56ab92['origtransfererlinkedid']){if(!_[_0x5acb('0x22')](queues[_0x56ab92[_0x5acb('0x4d')]])){utils[_0x5acb('0xe')](util[_0x5acb('0x2')](_0x5acb('0x4e'),_0x56ab92[_0x5acb('0x4c')],queues[_0x56ab92[_0x5acb('0x4d')]][_0x5acb('0x1b')],_0x56ab92[_0x5acb('0x4f')]));queues[_0x56ab92[_0x5acb('0x4d')]]['transfer']=!![];queues[_0x56ab92[_0x5acb('0x4d')]]['transfertype']=_0x5acb('0x50');queues[_0x56ab92[_0x5acb('0x4d')]]['transferexten']=_0x56ab92[_0x5acb('0x4f')];queues[_0x56ab92[_0x5acb('0x4d')]][_0x5acb('0x47')]=_0x56ab92[_0x5acb('0x4c')];queues[_0x56ab92[_0x5acb('0x4d')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x5acb('0x22')](queues[_0x56ab92[_0x5acb('0x51')]])){if(_0x56ab92['transfereelinkedid']&&queues[_0x56ab92[_0x5acb('0x52')]]){queues[_0x56ab92['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x56ab92[_0x5acb('0x42')]]=_[_0x5acb('0x53')](queues[_0x56ab92['transfereelinkedid']]);queues[_0x56ab92['transfereeuniqueid']]['transfereduniqueid']=_0x56ab92[_0x5acb('0x54')];queues[_0x56ab92[_0x5acb('0x42')]][_0x5acb('0x1c')]=0x2;queues[_0x56ab92[_0x5acb('0x42')]][_0x5acb('0x55')]=queues[_0x56ab92['secondtransfererlinkedid']][_0x5acb('0x55')];queues[_0x56ab92[_0x5acb('0x42')]][_0x5acb('0x56')]=queues[_0x56ab92[_0x5acb('0x4d')]]['calleridname'];queues[_0x56ab92[_0x5acb('0x42')]]['queuecallerjoinAt']=utils[_0x5acb('0x12')]();queues[_0x56ab92['transfereeuniqueid']][_0x5acb('0x30')]=utils[_0x5acb('0x12')]();queues[_0x56ab92['transfereeuniqueid']][_0x5acb('0x31')]=0x0;queues[_0x56ab92[_0x5acb('0x42')]][_0x5acb('0x57')]=0x0;utils[_0x5acb('0xe')](util['format'](_0x5acb('0x58'),_0x56ab92[_0x5acb('0x4c')],queues[_0x56ab92['transfereeuniqueid']][_0x5acb('0x1b')],queues[_0x56ab92[_0x5acb('0x42')]][_0x5acb('0x55')],queues[_0x56ab92[_0x5acb('0x42')]]['calleridname']));}else{utils[_0x5acb('0xe')](util['format'](_0x5acb('0x59'),_0x56ab92[_0x5acb('0x4c')],queues[_0x56ab92[_0x5acb('0x51')]]['name'],_0x56ab92['secondtransfererlinkedid']));queues[_0x56ab92['origtransfererlinkedid']][_0x5acb('0xc')]=_0x56ab92[_0x5acb('0x4d')];}}}else if(_0x56ab92[_0x5acb('0x5a')]==_0x56ab92[_0x5acb('0x4d')]){if(!_['isNil'](queues[_0x56ab92[_0x5acb('0x51')]])){utils[_0x5acb('0xe')](util[_0x5acb('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x56ab92[_0x5acb('0x4c')],queues[_0x56ab92[_0x5acb('0x51')]][_0x5acb('0x1b')],_0x56ab92[_0x5acb('0x5a')],_0x56ab92[_0x5acb('0x5b')]));queues[_0x56ab92[_0x5acb('0x51')]]['transfer']=!![];queues[_0x56ab92[_0x5acb('0x51')]][_0x5acb('0x44')]='ATTENDED';queues[_0x56ab92[_0x5acb('0x51')]][_0x5acb('0x45')]=_0x56ab92[_0x5acb('0x5b')];queues[_0x56ab92[_0x5acb('0x51')]]['transferuniqueid']=_0x56ab92[_0x5acb('0x5a')];queues[_0x56ab92[_0x5acb('0x51')]][_0x5acb('0x8')]=_0x5acb('0x5c');}if(!_[_0x5acb('0x22')](queues[_0x56ab92[_0x5acb('0x4d')]])){if(_0x56ab92[_0x5acb('0x5d')]&&queues[_0x56ab92[_0x5acb('0x5d')]]){queues[_0x56ab92[_0x5acb('0x5d')]][_0x5acb('0x1c')]=0x1;queues[_0x56ab92[_0x5acb('0x54')]]=_[_0x5acb('0x53')](queues[_0x56ab92['transfertargetlinkedid']]);queues[_0x56ab92[_0x5acb('0x54')]]['transfereduniqueid']=_0x56ab92[_0x5acb('0x54')];queues[_0x56ab92[_0x5acb('0x54')]]['queuecallerenterreason']=0x2;queues[_0x56ab92[_0x5acb('0x54')]][_0x5acb('0x55')]=queues[_0x56ab92[_0x5acb('0x51')]]['calleridnum'];queues[_0x56ab92['transfertargetuniqueid']][_0x5acb('0x56')]=queues[_0x56ab92[_0x5acb('0x51')]][_0x5acb('0x56')];queues[_0x56ab92[_0x5acb('0x54')]][_0x5acb('0x33')]=utils[_0x5acb('0x12')]();queues[_0x56ab92[_0x5acb('0x54')]][_0x5acb('0x30')]=utils[_0x5acb('0x12')]();queues[_0x56ab92[_0x5acb('0x54')]][_0x5acb('0x31')]=0x0;queues[_0x56ab92[_0x5acb('0x54')]]['mohtime']=0x0;utils[_0x5acb('0xe')](util['format'](_0x5acb('0x5e'),_0x56ab92[_0x5acb('0x4c')],queues[_0x56ab92[_0x5acb('0x54')]][_0x5acb('0x1b')],queues[_0x56ab92['transfertargetuniqueid']][_0x5acb('0xc')],queues[_0x56ab92[_0x5acb('0x54')]][_0x5acb('0x55')],queues[_0x56ab92[_0x5acb('0x54')]][_0x5acb('0x56')]));}else{utils[_0x5acb('0xe')](util[_0x5acb('0x2')](_0x5acb('0x59'),_0x56ab92[_0x5acb('0x4c')],queues[_0x56ab92[_0x5acb('0x4d')]]['name'],_0x56ab92[_0x5acb('0x51')]));queues[_0x56ab92['secondtransfererlinkedid']][_0x5acb('0xc')]=_0x56ab92[_0x5acb('0x51')];}}}}catch(_0x35b978){utils['error'](util['format']('[%s][queues][attendedtransfer]',_0x56ab92[_0x5acb('0x4c')]),_0x35b978);}};exports[_0x5acb('0x5f')]=function(_0x4ea3f6){try{if(!_[_0x5acb('0x22')](queues[_0x4ea3f6[_0x5acb('0x4')]])){utils[_0x5acb('0x15')](util['format']('[%s][queues][musiconholdstart]',_0x4ea3f6[_0x5acb('0x4')]),_0x4ea3f6);queues[_0x4ea3f6['uniqueid']][_0x5acb('0x60')]=utils[_0x5acb('0x12')]();utils[_0x5acb('0xe')](util[_0x5acb('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x4ea3f6[_0x5acb('0x4')],queues[_0x4ea3f6[_0x5acb('0x4')]][_0x5acb('0x1b')],queues[_0x4ea3f6['uniqueid']]['musiconholdstartAt']));}}catch(_0x3577f5){utils[_0x5acb('0x13')](util[_0x5acb('0x2')](_0x5acb('0x61'),_0x4ea3f6['uniqueid']),_0x3577f5);}};exports[_0x5acb('0x62')]=function(_0x137b93){try{if(!_['isNil'](queues[_0x137b93[_0x5acb('0x4')]])){if(!_[_0x5acb('0x22')](queues[_0x137b93['uniqueid']][_0x5acb('0x60')])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x137b93['uniqueid']),_0x137b93);queues[_0x137b93[_0x5acb('0x4')]][_0x5acb('0x57')]+=utils[_0x5acb('0x32')](utils[_0x5acb('0x12')](),queues[_0x137b93['uniqueid']][_0x5acb('0x60')]);utils['info'](util[_0x5acb('0x2')](_0x5acb('0x63'),_0x137b93[_0x5acb('0x4')],queues[_0x137b93[_0x5acb('0x4')]][_0x5acb('0x1b')],queues[_0x137b93[_0x5acb('0x4')]][_0x5acb('0x57')]));delete queues[_0x137b93[_0x5acb('0x4')]][_0x5acb('0x60')];}}}catch(_0x5dcae5){utils[_0x5acb('0x13')](util[_0x5acb('0x2')](_0x5acb('0x64'),_0x137b93[_0x5acb('0x4')]),_0x5dcae5);}};
\ No newline at end of file
index fa39895..159d08b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2242=['.WAV','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','appdata','application','toLowerCase','set','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','./transfers.controller','format','[%s][recordings][writeDB]','blinds','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','debug','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49'];(function(_0xa7ac,_0x2807e4){var _0x5b42ae=function(_0x549804){while(--_0x549804){_0xa7ac['push'](_0xa7ac['shift']());}};_0x5b42ae(++_0x2807e4);}(_0x2242,0x64));var _0x2224=function(_0x1d56f2,_0x13b3f9){_0x1d56f2=_0x1d56f2-0x0;var _0x319225=_0x2242[_0x1d56f2];return _0x319225;};'use strict';var _=require(_0x2224('0x0'));var util=require('util');var utils=require('./utils');var transfers=require(_0x2224('0x1'));var recordings={};function writeDB(_0x1c9cf0){var _0x24104d;utils['info'](util[_0x2224('0x2')](_0x2224('0x3'),_0x1c9cf0['uniqueid']));if(transfers[_0x2224('0x4')][_0x1c9cf0['uniqueid']]){_0x24104d=_0x1c9cf0['uniqueid'];_0x1c9cf0[_0x2224('0x5')]=transfers[_0x2224('0x4')][_0x1c9cf0[_0x2224('0x5')]][_0x2224('0x6')];}if(_0x1c9cf0[_0x2224('0x7')]){utils[_0x2224('0x8')](_0x1c9cf0[_0x2224('0x7')])['then'](function(_0x5e912d){if(_0x5e912d){_0x1c9cf0['membername']=_0x5e912d['name'];_0x1c9cf0['UserId']=_0x5e912d['id'];}utils[_0x2224('0x9')](_0x2224('0xa'),_0x1c9cf0);});}else{utils[_0x2224('0x9')](_0x2224('0xa'),_0x1c9cf0);}if(_0x24104d)delete transfers[_0x2224('0x4')][_0x24104d];}exports[_0x2224('0xb')]=function(_0x5528c3){try{utils['debug'](util['format'](_0x2224('0xc'),_0x5528c3[_0x2224('0x5')]),_0x5528c3);if(_0x5528c3['uniqueid']==_0x5528c3[_0x2224('0xd')]){utils[_0x2224('0xe')](util[_0x2224('0x2')](_0x2224('0xf'),_0x5528c3[_0x2224('0x5')],_0x5528c3[_0x2224('0x10')],_0x5528c3['exten']));recordings[_0x5528c3['uniqueid']]={'uniqueid':_0x5528c3['uniqueid'],'accountcode':_0x5528c3['accountcode'],'exten':_0x5528c3[_0x2224('0x11')],'context':_0x5528c3[_0x2224('0x10')],'channel':_0x5528c3[_0x2224('0x12')],'monitors':[]};}}catch(_0x528006){utils[_0x2224('0x13')](util[_0x2224('0x2')](_0x2224('0xc'),_0x5528c3[_0x2224('0x5')]),_0x528006);}};exports[_0x2224('0x14')]=function(_0x2dfe61){try{utils[_0x2224('0x15')](util[_0x2224('0x2')]('[%s][recordings][newstate]',_0x2dfe61[_0x2224('0x5')]),_0x2dfe61);if(!_[_0x2224('0x16')](recordings[_0x2dfe61[_0x2224('0x5')]])&&_0x2dfe61[_0x2224('0x17')]==0x6){utils[_0x2224('0xe')](util[_0x2224('0x2')](_0x2224('0x18'),_0x2dfe61[_0x2224('0x5')],_0x2dfe61[_0x2224('0x10')],_0x2dfe61[_0x2224('0x12')]));}else if(!_[_0x2224('0x16')](recordings[_0x2dfe61[_0x2224('0xd')]])&&_0x2dfe61[_0x2224('0x17')]==0x6&&_0x2dfe61[_0x2224('0x10')]!=_0x2224('0x19')){utils['info'](util[_0x2224('0x2')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2dfe61['uniqueid'],_0x2dfe61[_0x2224('0xd')],_0x2dfe61['context'],_0x2dfe61[_0x2224('0x12')]));recordings[_0x2dfe61[_0x2224('0xd')]][_0x2224('0x7')]=_0x2dfe61[_0x2224('0x7')];}}catch(_0x2902f2){utils[_0x2224('0x13')](util[_0x2224('0x2')](_0x2224('0x1a'),_0x2dfe61[_0x2224('0x5')]),_0x2902f2);}};exports[_0x2224('0x1b')]=function(_0x46495b){try{if(!_['isNil'](_0x46495b[_0x2224('0x1c')])&&!_[_0x2224('0x16')](_0x46495b[_0x2224('0x1c')][_0x2224('0x1d')])){utils['debug'](util['format']('[%s][recordings][varset]',_0x46495b['uniqueid']),_0x46495b);utils[_0x2224('0xe')](util[_0x2224('0x2')](_0x2224('0x1e'),_0x46495b[_0x2224('0x5')],_0x46495b[_0x2224('0x1c')],_0x46495b[_0x2224('0x1f')]));if(_[_0x2224('0x20')](_0x46495b[_0x2224('0x1f')],_0x2224('0x21'))){_0x46495b['value']=_0x46495b[_0x2224('0x1f')]['replace'](_0x2224('0x21'),_0x2224('0x22'));}if(recordings[_0x46495b['linkedid']]){var _0xb6e6b=_[_0x2224('0x23')](recordings[_0x46495b[_0x2224('0xd')]][_0x2224('0x24')],{'value':_0x46495b[_0x2224('0x1f')]});if(_[_0x2224('0x16')](_0xb6e6b)){recordings[_0x46495b[_0x2224('0xd')]]['monitors'][_0x2224('0x25')]({'value':_0x46495b[_0x2224('0x1f')]});}}}}catch(_0x3c0d46){utils[_0x2224('0x13')](util[_0x2224('0x2')](_0x2224('0x26'),_0x46495b['uniqueid']),_0x3c0d46);}};exports[_0x2224('0x27')]=function(_0x40481f){try{if(!_[_0x2224('0x16')](recordings[_0x40481f['uniqueid']])){utils['debug'](util['format'](_0x2224('0x28'),_0x40481f[_0x2224('0x5')]),_0x40481f);utils[_0x2224('0xe')](util[_0x2224('0x2')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x40481f[_0x2224('0x5')],_0x40481f[_0x2224('0x29')],_0x40481f[_0x2224('0x2a')],_0x40481f[_0x2224('0x2b')]));recordings[_0x40481f[_0x2224('0x5')]][_0x2224('0x29')]=_0x40481f[_0x2224('0x29')];recordings[_0x40481f[_0x2224('0x5')]][_0x2224('0x2a')]=_0x40481f[_0x2224('0x2a')];recordings[_0x40481f[_0x2224('0x5')]][_0x2224('0x2c')]=_0x40481f['connectedlinenum'];recordings[_0x40481f[_0x2224('0x5')]][_0x2224('0x2d')]=_0x40481f[_0x2224('0x2d')];if(recordings[_0x40481f[_0x2224('0x5')]][_0x2224('0x2e')]==_0x2224('0x2f')&&recordings[_0x40481f['uniqueid']]['accountcode']){recordings[_0x40481f[_0x2224('0x5')]]['connectedlinenum']=recordings[_0x40481f[_0x2224('0x5')]][_0x2224('0x7')];recordings[_0x40481f[_0x2224('0x5')]][_0x2224('0x2d')]='';}recordings[_0x40481f[_0x2224('0x5')]]['monitors'][_0x2224('0x30')](function(_0xe8ffbc){var _0x31a94c=_['clone'](recordings[_0x40481f[_0x2224('0x5')]]);_0x31a94c[_0x2224('0x1f')]=_0xe8ffbc['value'];writeDB(_0x31a94c);});delete recordings[_0x40481f[_0x2224('0x5')]];}}catch(_0x2744b8){utils['error'](util[_0x2224('0x2')](_0x2224('0x28'),_0x40481f[_0x2224('0x5')]),_0x2744b8);}};exports[_0x2224('0x31')]=function(_0x33cbca){try{if(!_[_0x2224('0x16')](recordings[_0x33cbca[_0x2224('0x5')]])){utils[_0x2224('0x15')](util['format']('[%s][recordings][newexten]',_0x33cbca['uniqueid']),_0x33cbca);utils[_0x2224('0xe')](util[_0x2224('0x2')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x33cbca[_0x2224('0x5')],_0x33cbca['application'],_0x33cbca[_0x2224('0x32')]));if(_0x33cbca[_0x2224('0x33')][_0x2224('0x34')]()==_0x2224('0x35')&&_['startsWith'](_0x33cbca[_0x2224('0x32')]['toLowerCase'](),_0x2224('0x36'))){var _0x19050e=_0x33cbca['appdata'][_0x2224('0x37')]('=');var _0x1bb061=_0x19050e[0x0][_0x2224('0x38')](_0x19050e[0x0][_0x2224('0x39')]('(')+0x1,_0x19050e[0x0][_0x2224('0x39')](')'));var _0x59ca02=_0x19050e[0x1];recordings[_0x33cbca[_0x2224('0x5')]][_0x1bb061]=_0x59ca02;}}}catch(_0x289022){utils['error'](util['format'](_0x2224('0x3a'),_0x33cbca[_0x2224('0x5')]),_0x289022);}};exports['queuecallerjoin']=function(_0x20e48a){try{if(!_[_0x2224('0x16')](recordings[_0x20e48a[_0x2224('0x5')]])){utils[_0x2224('0x15')](util[_0x2224('0x2')](_0x2224('0x3b'),_0x20e48a['uniqueid']),_0x20e48a);utils[_0x2224('0xe')](util[_0x2224('0x2')](_0x2224('0x3c'),_0x20e48a[_0x2224('0x5')],_0x20e48a[_0x2224('0x3d')]));recordings[_0x20e48a[_0x2224('0x5')]][_0x2224('0x3d')]=_0x20e48a[_0x2224('0x3d')];}}catch(_0x34dc11){utils['error'](util[_0x2224('0x2')]('[%s][recordings][queuecallerjoin]',_0x20e48a[_0x2224('0x5')]),_0x34dc11);}};exports['blindtransfer']=function(_0x18837b){try{utils[_0x2224('0x15')](util[_0x2224('0x2')](_0x2224('0x3e'),_0x18837b[_0x2224('0x5')]),_0x18837b);utils[_0x2224('0xe')](util[_0x2224('0x2')](_0x2224('0x3f'),_0x18837b['uniqueid'],_0x18837b['transferercalleridnum'],_0x18837b['transferercalleridname'],_0x18837b[_0x2224('0x40')],_0x18837b[_0x2224('0x41')]));if(recordings[_0x18837b['transfereruniqueid']]&&transfers[_0x2224('0x4')][_0x18837b[_0x2224('0x42')]]){transfers[_0x2224('0x4')][_0x18837b[_0x2224('0x42')]]['recording']=!![];}}catch(_0x30786b){utils['error'](util[_0x2224('0x2')]('[%s][recordings][blindtransfer]',_0x18837b[_0x2224('0x5')]),_0x30786b);}};
\ No newline at end of file
+var _0x3477=['context','exten','error','newstate','debug','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinename','type','connectedlinenum','forEach','clone','newexten','application','set','startsWith','appdata','toLowerCase','split','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','info','format','[%s][recordings][writeDB]','uniqueid','blinds','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3477,0xba));var _0x7347=function(_0x19f186,_0x1760ef){_0x19f186=_0x19f186-0x0;var _0x480589=_0x3477[_0x19f186];return _0x480589;};'use strict';var _=require(_0x7347('0x0'));var util=require(_0x7347('0x1'));var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x23273a){var _0x54eed3;utils[_0x7347('0x2')](util[_0x7347('0x3')](_0x7347('0x4'),_0x23273a[_0x7347('0x5')]));if(transfers[_0x7347('0x6')][_0x23273a['uniqueid']]){_0x54eed3=_0x23273a[_0x7347('0x5')];_0x23273a[_0x7347('0x5')]=transfers[_0x7347('0x6')][_0x23273a['uniqueid']]['transfereeuniqueid'];}if(_0x23273a['accountcode']){utils[_0x7347('0x7')](_0x23273a[_0x7347('0x8')])[_0x7347('0x9')](function(_0x57d891){if(_0x57d891){_0x23273a[_0x7347('0xa')]=_0x57d891[_0x7347('0xb')];_0x23273a[_0x7347('0xc')]=_0x57d891['id'];}utils[_0x7347('0xd')](_0x7347('0xe'),_0x23273a);});}else{utils[_0x7347('0xd')](_0x7347('0xe'),_0x23273a);}if(_0x54eed3)delete transfers[_0x7347('0x6')][_0x54eed3];}exports['newchannel']=function(_0x3f24da){try{utils['debug'](util[_0x7347('0x3')](_0x7347('0xf'),_0x3f24da[_0x7347('0x5')]),_0x3f24da);if(_0x3f24da[_0x7347('0x5')]==_0x3f24da[_0x7347('0x10')]){utils[_0x7347('0x2')](util[_0x7347('0x3')](_0x7347('0x11'),_0x3f24da[_0x7347('0x5')],_0x3f24da[_0x7347('0x12')],_0x3f24da['exten']));recordings[_0x3f24da['uniqueid']]={'uniqueid':_0x3f24da[_0x7347('0x5')],'accountcode':_0x3f24da[_0x7347('0x8')],'exten':_0x3f24da[_0x7347('0x13')],'context':_0x3f24da['context'],'channel':_0x3f24da['channel'],'monitors':[]};}}catch(_0xeedfd1){utils[_0x7347('0x14')](util[_0x7347('0x3')](_0x7347('0xf'),_0x3f24da[_0x7347('0x5')]),_0xeedfd1);}};exports[_0x7347('0x15')]=function(_0x51b991){try{utils[_0x7347('0x16')](util[_0x7347('0x3')](_0x7347('0x17'),_0x51b991[_0x7347('0x5')]),_0x51b991);if(!_[_0x7347('0x18')](recordings[_0x51b991[_0x7347('0x5')]])&&_0x51b991['channelstate']==0x6){utils[_0x7347('0x2')](util[_0x7347('0x3')](_0x7347('0x19'),_0x51b991[_0x7347('0x5')],_0x51b991[_0x7347('0x12')],_0x51b991[_0x7347('0x1a')]));}else if(!_[_0x7347('0x18')](recordings[_0x51b991[_0x7347('0x10')]])&&_0x51b991[_0x7347('0x1b')]==0x6&&_0x51b991['context']!=_0x7347('0x1c')){utils[_0x7347('0x2')](util[_0x7347('0x3')](_0x7347('0x1d'),_0x51b991[_0x7347('0x5')],_0x51b991[_0x7347('0x10')],_0x51b991[_0x7347('0x12')],_0x51b991[_0x7347('0x1a')]));recordings[_0x51b991[_0x7347('0x10')]][_0x7347('0x8')]=_0x51b991[_0x7347('0x8')];}}catch(_0x1c75b3){utils[_0x7347('0x14')](util['format'](_0x7347('0x17'),_0x51b991[_0x7347('0x5')]),_0x1c75b3);}};exports['varset']=function(_0x4627f5){try{if(!_[_0x7347('0x18')](_0x4627f5[_0x7347('0x1e')])&&!_[_0x7347('0x18')](_0x4627f5[_0x7347('0x1e')][_0x7347('0x1f')])){utils['debug'](util[_0x7347('0x3')](_0x7347('0x20'),_0x4627f5[_0x7347('0x5')]),_0x4627f5);utils[_0x7347('0x2')](util[_0x7347('0x3')](_0x7347('0x21'),_0x4627f5[_0x7347('0x5')],_0x4627f5[_0x7347('0x1e')],_0x4627f5[_0x7347('0x22')]));if(_[_0x7347('0x23')](_0x4627f5[_0x7347('0x22')],'.wav49')){_0x4627f5[_0x7347('0x22')]=_0x4627f5['value'][_0x7347('0x24')](_0x7347('0x25'),_0x7347('0x26'));}if(recordings[_0x4627f5[_0x7347('0x10')]]){var _0x1433db=_[_0x7347('0x27')](recordings[_0x4627f5[_0x7347('0x10')]]['monitors'],{'value':_0x4627f5[_0x7347('0x22')]});if(_[_0x7347('0x18')](_0x1433db)){recordings[_0x4627f5[_0x7347('0x10')]]['monitors']['push']({'value':_0x4627f5[_0x7347('0x22')]});}}}}catch(_0x44862a){utils[_0x7347('0x14')](util['format']('[%s][recordings][varset]',_0x4627f5['uniqueid']),_0x44862a);}};exports[_0x7347('0x28')]=function(_0x29e945){try{if(!_[_0x7347('0x18')](recordings[_0x29e945[_0x7347('0x5')]])){utils[_0x7347('0x16')](util['format'](_0x7347('0x29'),_0x29e945[_0x7347('0x5')]),_0x29e945);utils[_0x7347('0x2')](util['format'](_0x7347('0x2a'),_0x29e945['uniqueid'],_0x29e945[_0x7347('0x2b')],_0x29e945[_0x7347('0x2c')],_0x29e945['cause-txt']));recordings[_0x29e945['uniqueid']]['calleridnum']=_0x29e945[_0x7347('0x2b')];recordings[_0x29e945['uniqueid']][_0x7347('0x2c')]=_0x29e945['calleridname'];recordings[_0x29e945[_0x7347('0x5')]]['connectedlinenum']=_0x29e945['connectedlinenum'];recordings[_0x29e945[_0x7347('0x5')]][_0x7347('0x2d')]=_0x29e945[_0x7347('0x2d')];if(recordings[_0x29e945[_0x7347('0x5')]][_0x7347('0x2e')]=='outbound'&&recordings[_0x29e945['uniqueid']][_0x7347('0x8')]){recordings[_0x29e945[_0x7347('0x5')]][_0x7347('0x2f')]=recordings[_0x29e945[_0x7347('0x5')]][_0x7347('0x8')];recordings[_0x29e945[_0x7347('0x5')]][_0x7347('0x2d')]='';}recordings[_0x29e945['uniqueid']]['monitors'][_0x7347('0x30')](function(_0x153d6a){var _0x28c6f4=_[_0x7347('0x31')](recordings[_0x29e945[_0x7347('0x5')]]);_0x28c6f4[_0x7347('0x22')]=_0x153d6a[_0x7347('0x22')];writeDB(_0x28c6f4);});delete recordings[_0x29e945[_0x7347('0x5')]];}}catch(_0x49f235){utils[_0x7347('0x14')](util[_0x7347('0x3')]('[%s][recordings][hangup]',_0x29e945[_0x7347('0x5')]),_0x49f235);}};exports[_0x7347('0x32')]=function(_0x1d6b61){try{if(!_[_0x7347('0x18')](recordings[_0x1d6b61['uniqueid']])){utils[_0x7347('0x16')](util[_0x7347('0x3')]('[%s][recordings][newexten]',_0x1d6b61['uniqueid']),_0x1d6b61);utils[_0x7347('0x2')](util[_0x7347('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x1d6b61[_0x7347('0x5')],_0x1d6b61[_0x7347('0x33')],_0x1d6b61['appdata']));if(_0x1d6b61['application']['toLowerCase']()==_0x7347('0x34')&&_[_0x7347('0x35')](_0x1d6b61[_0x7347('0x36')][_0x7347('0x37')](),'cdr')){var _0x4f6ee5=_0x1d6b61['appdata'][_0x7347('0x38')]('=');var _0x25439c=_0x4f6ee5[0x0]['substring'](_0x4f6ee5[0x0][_0x7347('0x39')]('(')+0x1,_0x4f6ee5[0x0][_0x7347('0x39')](')'));var _0x15d5d3=_0x4f6ee5[0x1];recordings[_0x1d6b61[_0x7347('0x5')]][_0x25439c]=_0x15d5d3;}}}catch(_0x53f8bc){utils[_0x7347('0x14')](util[_0x7347('0x3')](_0x7347('0x3a'),_0x1d6b61[_0x7347('0x5')]),_0x53f8bc);}};exports[_0x7347('0x3b')]=function(_0x3eaf9e){try{if(!_[_0x7347('0x18')](recordings[_0x3eaf9e['uniqueid']])){utils[_0x7347('0x16')](util[_0x7347('0x3')](_0x7347('0x3c'),_0x3eaf9e['uniqueid']),_0x3eaf9e);utils['info'](util[_0x7347('0x3')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x3eaf9e[_0x7347('0x5')],_0x3eaf9e[_0x7347('0x3d')]));recordings[_0x3eaf9e[_0x7347('0x5')]]['queue']=_0x3eaf9e[_0x7347('0x3d')];}}catch(_0x50b480){utils[_0x7347('0x14')](util['format']('[%s][recordings][queuecallerjoin]',_0x3eaf9e[_0x7347('0x5')]),_0x50b480);}};exports[_0x7347('0x3e')]=function(_0x46e10e){try{utils[_0x7347('0x16')](util[_0x7347('0x3')](_0x7347('0x3f'),_0x46e10e[_0x7347('0x5')]),_0x46e10e);utils['info'](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x46e10e[_0x7347('0x5')],_0x46e10e['transferercalleridnum'],_0x46e10e[_0x7347('0x40')],_0x46e10e[_0x7347('0x41')],_0x46e10e[_0x7347('0x42')]));if(recordings[_0x46e10e[_0x7347('0x43')]]&&transfers[_0x7347('0x6')][_0x46e10e[_0x7347('0x43')]]){transfers[_0x7347('0x6')][_0x46e10e[_0x7347('0x43')]]['recording']=!![];}}catch(_0x42ea7a){utils[_0x7347('0x14')](util[_0x7347('0x3')](_0x7347('0x3f'),_0x46e10e[_0x7347('0x5')]),_0x42ea7a);}};
\ No newline at end of file
index 6565d49..5b0e365 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x997f=['transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]','info','transferercalleridnum','transferercalleridname','transfereecalleridname','type','transfereruniqueid','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x997f,0x130));var _0xf997=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x997f[_0x4a3898];return _0x25ceb0;};'use strict';var _=require('lodash');var util=require(_0xf997('0x0'));var utils=require(_0xf997('0x1'));function writeDB(_0x2c2273){utils['info'](util[_0xf997('0x2')](_0xf997('0x3'),_0x2c2273['type']===_0xf997('0x4')?_0x2c2273[_0xf997('0x5')]:_0x2c2273[_0xf997('0x6')],_0x2c2273['type']));utils['request'](_0xf997('0x7'),_0x2c2273);}exports[_0xf997('0x8')]={};exports[_0xf997('0x9')]=function(_0x88a4fe){try{utils['debug'](util[_0xf997('0x2')](_0xf997('0xa'),_0x88a4fe[_0xf997('0x6')]),_0x88a4fe);utils[_0xf997('0xb')](util[_0xf997('0x2')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x88a4fe[_0xf997('0x6')],_0x88a4fe[_0xf997('0xc')],_0x88a4fe[_0xf997('0xd')],_0x88a4fe['transfereecalleridnum'],_0x88a4fe[_0xf997('0xe')]));_0x88a4fe[_0xf997('0xf')]='blind';exports[_0xf997('0x8')][_0x88a4fe[_0xf997('0x10')]]=_0x88a4fe;writeDB(_0x88a4fe);}catch(_0x1d2de2){utils[_0xf997('0x11')](util[_0xf997('0x2')](_0xf997('0xa'),_0x88a4fe['uniqueid']),_0x1d2de2);}};exports[_0xf997('0x12')]=function(_0x5f3382){try{utils[_0xf997('0x13')](util['format'](_0xf997('0x14'),_0x5f3382[_0xf997('0x5')]),_0x5f3382);utils['info'](util[_0xf997('0x2')](_0xf997('0x15'),_0x5f3382[_0xf997('0x5')],_0x5f3382['origtransferercalleridnum'],_0x5f3382[_0xf997('0x16')],_0x5f3382[_0xf997('0x17')],_0x5f3382[_0xf997('0x18')]));_0x5f3382=_[_0xf997('0x19')](_0x5f3382,{'transfererchannel':_0x5f3382[_0xf997('0x1a')],'transferercalleridnum':_0x5f3382[_0xf997('0x1b')],'transferercalleridname':_0x5f3382[_0xf997('0x16')],'transfererconnectedlinenum':_0x5f3382[_0xf997('0x1c')],'transfererconnectedlinename':_0x5f3382[_0xf997('0x1d')],'transfereraccountcode':_0x5f3382['origtransfereraccountcode'],'transferercontext':_0x5f3382[_0xf997('0x1e')],'transfererexten':_0x5f3382['secondtransfererexten'],'transfererlinkedid':_0x5f3382[_0xf997('0x1f')],'context':_0x5f3382[_0xf997('0x20')],'extension':_0x5f3382[_0xf997('0x21')],'type':'attended'});if(_[_0xf997('0x22')](_0x5f3382[_0xf997('0x23')])){_0x5f3382=_['assign'](_0x5f3382,{'transfereechannel':_0x5f3382[_0xf997('0x24')],'transfereecalleridnum':_0x5f3382['transfertargetcalleridnum'],'transfereecalleridname':_0x5f3382['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5f3382[_0xf997('0x25')],'transfereeconnectedlinename':_0x5f3382[_0xf997('0x26')],'transfereeaccountcode':_0x5f3382[_0xf997('0x27')],'transfereecontext':_0x5f3382[_0xf997('0x28')],'transfereeexten':_0x5f3382[_0xf997('0x29')],'transfereelinkedid':_0x5f3382[_0xf997('0x2a')]});}writeDB(_0x5f3382);}catch(_0x36a4a){utils[_0xf997('0x11')](util[_0xf997('0x2')](_0xf997('0x14'),_0x5f3382[_0xf997('0x5')]),_0x36a4a);}};
\ No newline at end of file
+var _0x2281=['origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','transfereechannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','error','[%s][transfers][attendedtransfer]','lodash','util','info','format','type','attended','origtransfereruniqueid','uniqueid','request','blinds','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','attendedtransfer','origtransferercalleridnum'];(function(_0x156340,_0x585040){var _0xe7ad9f=function(_0x3d33d3){while(--_0x3d33d3){_0x156340['push'](_0x156340['shift']());}};_0xe7ad9f(++_0x585040);}(_0x2281,0x1da));var _0x1228=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2281[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1228('0x0'));var util=require(_0x1228('0x1'));var utils=require('./utils');function writeDB(_0x33ffe5){utils[_0x1228('0x2')](util[_0x1228('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x33ffe5[_0x1228('0x4')]===_0x1228('0x5')?_0x33ffe5[_0x1228('0x6')]:_0x33ffe5[_0x1228('0x7')],_0x33ffe5[_0x1228('0x4')]));utils[_0x1228('0x8')]('CreateVoiceTransferReport',_0x33ffe5);}exports[_0x1228('0x9')]={};exports['blindtransfer']=function(_0x29904c){try{utils[_0x1228('0xa')](util[_0x1228('0x3')](_0x1228('0xb'),_0x29904c[_0x1228('0x7')]),_0x29904c);utils[_0x1228('0x2')](util[_0x1228('0x3')](_0x1228('0xc'),_0x29904c[_0x1228('0x7')],_0x29904c[_0x1228('0xd')],_0x29904c[_0x1228('0xe')],_0x29904c[_0x1228('0xf')],_0x29904c[_0x1228('0x10')]));_0x29904c[_0x1228('0x4')]=_0x1228('0x11');exports['blinds'][_0x29904c['transfereruniqueid']]=_0x29904c;writeDB(_0x29904c);}catch(_0xb10f8e){utils['error'](util['format'](_0x1228('0xb'),_0x29904c['uniqueid']),_0xb10f8e);}};exports[_0x1228('0x12')]=function(_0x4f8e26){try{utils['debug'](util[_0x1228('0x3')]('[%s][transfers][attendedtransfer]',_0x4f8e26[_0x1228('0x6')]),_0x4f8e26);utils[_0x1228('0x2')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4f8e26[_0x1228('0x6')],_0x4f8e26[_0x1228('0x13')],_0x4f8e26[_0x1228('0x14')],_0x4f8e26[_0x1228('0x15')],_0x4f8e26[_0x1228('0x16')]));_0x4f8e26=_[_0x1228('0x17')](_0x4f8e26,{'transfererchannel':_0x4f8e26[_0x1228('0x18')],'transferercalleridnum':_0x4f8e26[_0x1228('0x13')],'transferercalleridname':_0x4f8e26[_0x1228('0x14')],'transfererconnectedlinenum':_0x4f8e26[_0x1228('0x19')],'transfererconnectedlinename':_0x4f8e26[_0x1228('0x1a')],'transfereraccountcode':_0x4f8e26['origtransfereraccountcode'],'transferercontext':_0x4f8e26[_0x1228('0x1b')],'transfererexten':_0x4f8e26[_0x1228('0x1c')],'transfererlinkedid':_0x4f8e26[_0x1228('0x1d')],'context':_0x4f8e26['origtransferercontext'],'extension':_0x4f8e26[_0x1228('0x1e')],'type':_0x1228('0x5')});if(_['isNil'](_0x4f8e26[_0x1228('0x1f')])){_0x4f8e26=_[_0x1228('0x17')](_0x4f8e26,{'transfereechannel':_0x4f8e26['transfertargetchannel'],'transfereecalleridnum':_0x4f8e26[_0x1228('0x15')],'transfereecalleridname':_0x4f8e26[_0x1228('0x16')],'transfereeconnectedlinenum':_0x4f8e26[_0x1228('0x20')],'transfereeconnectedlinename':_0x4f8e26['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4f8e26[_0x1228('0x21')],'transfereecontext':_0x4f8e26[_0x1228('0x22')],'transfereeexten':_0x4f8e26[_0x1228('0x23')],'transfereelinkedid':_0x4f8e26['transfertargetlinkedid']});}writeDB(_0x4f8e26);}catch(_0x1daff1){utils[_0x1228('0x24')](util[_0x1228('0x3')](_0x1228('0x25'),_0x4f8e26[_0x1228('0x6')]),_0x1daff1);}};
\ No newline at end of file
index 4a12e99..2e36bb7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x65a7=['stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s'];(function(_0x5ec8d1,_0x464975){var _0xcb6dec=function(_0x11a3d7){while(--_0x11a3d7){_0x5ec8d1['push'](_0x5ec8d1['shift']());}};_0xcb6dec(++_0x464975);}(_0x65a7,0x14a));var _0x765a=function(_0x28fe9,_0x5cecc4){_0x28fe9=_0x28fe9-0x0;var _0x284e7e=_0x65a7[_0x28fe9];return _0x284e7e;};'use strict';var BPromise=require(_0x765a('0x0'));var jayson=require(_0x765a('0x1'));var moment=require(_0x765a('0x2'));var util=require(_0x765a('0x3'));var client=jayson[_0x765a('0x4')]['http']({'port':0x2329});var logger=require(_0x765a('0x5'))(_0x765a('0x6'));exports[_0x765a('0x7')]=function(_0x574ac2,_0x503327){logger['info'](_0x574ac2,_0x503327?util[_0x765a('0x8')](_0x503327,{'showHidden':![],'depth':null}):'');};exports[_0x765a('0x9')]=function(_0x562f90,_0x19f779){logger[_0x765a('0x9')](_0x562f90,_0x19f779?util[_0x765a('0x8')](_0x19f779,{'showHidden':![],'depth':null}):'');};exports[_0x765a('0xa')]=function(_0x189560,_0x55ee7d){logger[_0x765a('0xa')](_0x189560,_0x55ee7d?util[_0x765a('0x8')](_0x55ee7d,{'showHidden':![],'depth':null}):'');};exports[_0x765a('0xb')]=function(_0x11c385,_0x1b62f3){return client[_0x765a('0xb')](_0x11c385,{'body':_0x1b62f3})[_0x765a('0xc')](function(_0x583597){logger[_0x765a('0x9')](_0x765a('0xd'),_0x11c385,_0x583597?util[_0x765a('0x8')](_0x583597,{'showHidden':![],'depth':null}):'');})[_0x765a('0xe')](function(_0x1d1be9){logger[_0x765a('0xa')](_0x765a('0xd'),_0x11c385,_0x1d1be9?util[_0x765a('0x8')](_0x1d1be9,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4553cb){return client[_0x765a('0xb')](_0x765a('0xf'),{'options':{'raw':!![],'attributes':['id',_0x765a('0x10'),_0x765a('0x11'),_0x765a('0x12')],'where':_0x4553cb,'limit':0x1}})[_0x765a('0xc')](function(_0x19851d){logger[_0x765a('0x9')](_0x765a('0x13'),JSON[_0x765a('0x14')](_0x4553cb),_0x19851d?util['inspect'](_0x19851d,{'showHidden':![],'depth':null}):'');return _0x19851d[_0x765a('0x15')]['length']?_0x19851d[_0x765a('0x15')][0x0]:null;});}exports[_0x765a('0x16')]=function(_0x3ae997){return new BPromise(function(_0x3b42ca,_0x2dc2c9){if(_0x3ae997){return getUser({'internal':_0x3ae997})[_0x765a('0xc')](function(_0x2ad6ce){logger[_0x765a('0x7')](_0x765a('0x17'),_0x3ae997,_0x2ad6ce?_0x765a('0x18'):_0x765a('0x19'));return _0x3b42ca(_0x2ad6ce);})[_0x765a('0xe')](function(_0x1bdd2a){logger[_0x765a('0xa')](_0x765a('0x1a'),_0x1bdd2a?util[_0x765a('0x8')](_0x1bdd2a,{'showHidden':![],'depth':null}):'');return _0x3b42ca(null);});}return _0x3b42ca(null);});};exports[_0x765a('0x1b')]=function(_0x47203e){return new BPromise(function(_0x4f3545,_0x4d3650){if(_0x47203e){return getUser({'interface':_0x47203e})[_0x765a('0xc')](function(_0x2400ce){logger['info'](_0x765a('0x1c'),_0x47203e,_0x2400ce?'found':_0x765a('0x19'));return _0x4f3545(_0x2400ce);})[_0x765a('0xe')](function(_0x20e069){logger[_0x765a('0xa')](_0x765a('0x1d'),_0x20e069?util[_0x765a('0x8')](_0x20e069,{'showHidden':![],'depth':null}):'');return _0x4f3545(null);});}return _0x4f3545(null);});};exports[_0x765a('0x1e')]=function(_0x2a3ebc){return new BPromise(function(_0x12e821,_0x322ca6){if(_0x2a3ebc){return getUser({'name':_0x2a3ebc})['then'](function(_0x2ef275){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x2a3ebc,_0x2ef275?_0x765a('0x18'):_0x765a('0x19'));return _0x12e821(_0x2ef275);})[_0x765a('0xe')](function(_0x5e7786){logger[_0x765a('0xa')](_0x765a('0x1f'),_0x5e7786?util[_0x765a('0x8')](_0x5e7786,{'showHidden':![],'depth':null}):'');return _0x12e821(null);});}return _0x12e821(null);});};exports['getVoiceQueueByName']=function(_0x3b8a00){return new BPromise(function(_0x2c6289,_0x4b0fea){if(_0x3b8a00){return client['request'](_0x765a('0x20'),{'options':{'raw':!![],'attributes':['id','name','type',_0x765a('0x21'),_0x765a('0x22')],'where':{'name':_0x3b8a00},'limit':0x1}})[_0x765a('0xc')](function(_0x10b701){logger[_0x765a('0x9')](_0x765a('0x23'),_0x3b8a00,_0x10b701?util[_0x765a('0x8')](_0x10b701,{'showHidden':![],'depth':null}):'');logger['info'](_0x765a('0x24'),_0x3b8a00,_0x10b701?_0x765a('0x18'):_0x765a('0x19'));return _0x2c6289(_0x10b701[_0x765a('0x15')][_0x765a('0x25')]?_0x10b701[_0x765a('0x15')][0x0]:null);})[_0x765a('0xe')](function(_0x14c418){logger[_0x765a('0xa')](_0x765a('0x26'),_0x14c418?util['inspect'](_0x14c418,{'showHidden':![],'depth':null}):'');return _0x2c6289(null);});}return _0x2c6289(null);});};exports[_0x765a('0x27')]=function(_0x280a3f,_0x1943e0){return moment(_0x280a3f)[_0x765a('0x28')](_0x1943e0,_0x765a('0x29'))[_0x765a('0x2a')](_0x765a('0x2b'));};exports[_0x765a('0x2c')]=function(_0x5f214e,_0x14ae6c){return moment(_0x5f214e)[_0x765a('0x2d')](_0x14ae6c,_0x765a('0x29'))[_0x765a('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x12c94f,_0x183f7e){return moment(_0x12c94f)['diff'](moment(_0x183f7e),_0x765a('0x29'));};exports[_0x765a('0x2e')]=function(_0x66984,_0x310a4f){return parseInt(_0x66984,0xa)+parseInt(_0x310a4f,0xa);};exports[_0x765a('0x2f')]=function(){return moment()[_0x765a('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x765a('0x30')]=function(_0x45f876,_0x14b01e){if(_0x14b01e){return moment(_0x45f876)[_0x765a('0x30')](_0x14b01e);}return!![];};exports[_0x765a('0x31')]=function(_0x35a254,_0x48fc0f){if(_0x48fc0f){return moment(_0x35a254)[_0x765a('0x31')](_0x48fc0f);}else if(_0x35a254){return!![];}return![];};
\ No newline at end of file
+var _0x4434=['acw','[utils][getVoiceQueueByName]\x20name:%s','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','util','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4434,0x175));var _0x4443=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4434[_0x2641f9];return _0x585741;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x4443('0x0'));var moment=require(_0x4443('0x1'));var util=require(_0x4443('0x2'));var client=jayson['client']['http']({'port':0x2329});var logger=require(_0x4443('0x3'))(_0x4443('0x4'));exports[_0x4443('0x5')]=function(_0x41f8d6,_0x4fe78b){logger[_0x4443('0x5')](_0x41f8d6,_0x4fe78b?util['inspect'](_0x4fe78b,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x2bd78d,_0xa3e76b){logger[_0x4443('0x6')](_0x2bd78d,_0xa3e76b?util[_0x4443('0x7')](_0xa3e76b,{'showHidden':![],'depth':null}):'');};exports[_0x4443('0x8')]=function(_0x31a36e,_0xe32347){logger[_0x4443('0x8')](_0x31a36e,_0xe32347?util[_0x4443('0x7')](_0xe32347,{'showHidden':![],'depth':null}):'');};exports[_0x4443('0x9')]=function(_0x3545c8,_0x5eb29c){return client[_0x4443('0x9')](_0x3545c8,{'body':_0x5eb29c})[_0x4443('0xa')](function(_0x50e927){logger[_0x4443('0x6')](_0x4443('0xb'),_0x3545c8,_0x50e927?util[_0x4443('0x7')](_0x50e927,{'showHidden':![],'depth':null}):'');})[_0x4443('0xc')](function(_0xf90c15){logger['error'](_0x4443('0xb'),_0x3545c8,_0xf90c15?util['inspect'](_0xf90c15,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4e0abe){return client['request'](_0x4443('0xd'),{'options':{'raw':!![],'attributes':['id',_0x4443('0xe'),_0x4443('0xf'),_0x4443('0x10')],'where':_0x4e0abe,'limit':0x1}})[_0x4443('0xa')](function(_0x47b150){logger['debug'](_0x4443('0x11'),JSON[_0x4443('0x12')](_0x4e0abe),_0x47b150?util[_0x4443('0x7')](_0x47b150,{'showHidden':![],'depth':null}):'');return _0x47b150[_0x4443('0x13')][_0x4443('0x14')]?_0x47b150['result'][0x0]:null;});}exports[_0x4443('0x15')]=function(_0x399928){return new BPromise(function(_0x515f62,_0x4d5e70){if(_0x399928){return getUser({'internal':_0x399928})[_0x4443('0xa')](function(_0x1d2460){logger[_0x4443('0x5')](_0x4443('0x16'),_0x399928,_0x1d2460?_0x4443('0x17'):_0x4443('0x18'));return _0x515f62(_0x1d2460);})[_0x4443('0xc')](function(_0x3cdaa0){logger[_0x4443('0x8')](_0x4443('0x19'),_0x3cdaa0?util[_0x4443('0x7')](_0x3cdaa0,{'showHidden':![],'depth':null}):'');return _0x515f62(null);});}return _0x515f62(null);});};exports[_0x4443('0x1a')]=function(_0x18ba69){return new BPromise(function(_0x506e24,_0x416a56){if(_0x18ba69){return getUser({'interface':_0x18ba69})['then'](function(_0x2c9d4f){logger['info'](_0x4443('0x1b'),_0x18ba69,_0x2c9d4f?_0x4443('0x17'):_0x4443('0x18'));return _0x506e24(_0x2c9d4f);})[_0x4443('0xc')](function(_0x5edbfc){logger['error']('[utils][getUserByInterface]',_0x5edbfc?util[_0x4443('0x7')](_0x5edbfc,{'showHidden':![],'depth':null}):'');return _0x506e24(null);});}return _0x506e24(null);});};exports[_0x4443('0x1c')]=function(_0x7e3f8f){return new BPromise(function(_0x5e61d4,_0x26980b){if(_0x7e3f8f){return getUser({'name':_0x7e3f8f})[_0x4443('0xa')](function(_0x4155db){logger[_0x4443('0x5')]('[utils][getUserByName]\x20name:%s\x20%s',_0x7e3f8f,_0x4155db?'found':_0x4443('0x18'));return _0x5e61d4(_0x4155db);})[_0x4443('0xc')](function(_0x430f61){logger[_0x4443('0x8')](_0x4443('0x1d'),_0x430f61?util['inspect'](_0x430f61,{'showHidden':![],'depth':null}):'');return _0x5e61d4(null);});}return _0x5e61d4(null);});};exports[_0x4443('0x1e')]=function(_0x2a5100){return new BPromise(function(_0x4b311d,_0x173b8a){if(_0x2a5100){return client[_0x4443('0x9')](_0x4443('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x4443('0xf'),'type',_0x4443('0x20'),'acwTimeout'],'where':{'name':_0x2a5100},'limit':0x1}})[_0x4443('0xa')](function(_0x256d0e){logger['debug'](_0x4443('0x21'),_0x2a5100,_0x256d0e?util['inspect'](_0x256d0e,{'showHidden':![],'depth':null}):'');logger[_0x4443('0x5')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x2a5100,_0x256d0e?_0x4443('0x17'):_0x4443('0x18'));return _0x4b311d(_0x256d0e[_0x4443('0x13')][_0x4443('0x14')]?_0x256d0e['result'][0x0]:null);})['catch'](function(_0x2f9996){logger[_0x4443('0x8')]('[utils][getVoiceQueueByName]',_0x2f9996?util[_0x4443('0x7')](_0x2f9996,{'showHidden':![],'depth':null}):'');return _0x4b311d(null);});}return _0x4b311d(null);});};exports['addTime']=function(_0x252b79,_0x3bb225){return moment(_0x252b79)['add'](_0x3bb225,_0x4443('0x22'))[_0x4443('0x23')](_0x4443('0x24'));};exports[_0x4443('0x25')]=function(_0x4291bf,_0x1798db){return moment(_0x4291bf)[_0x4443('0x26')](_0x1798db,_0x4443('0x22'))[_0x4443('0x23')](_0x4443('0x24'));};exports[_0x4443('0x27')]=function(_0x1a8695,_0x1f2893){return moment(_0x1a8695)[_0x4443('0x28')](moment(_0x1f2893),_0x4443('0x22'));};exports[_0x4443('0x29')]=function(_0x358b32,_0x35943d){return parseInt(_0x358b32,0xa)+parseInt(_0x35943d,0xa);};exports[_0x4443('0x2a')]=function(){return moment()[_0x4443('0x23')](_0x4443('0x24'));};exports[_0x4443('0x2b')]=function(_0x109ff5,_0x295392){if(_0x295392){return moment(_0x109ff5)[_0x4443('0x2b')](_0x295392);}return!![];};exports[_0x4443('0x2c')]=function(_0x109aab,_0x2525d5){if(_0x2525d5){return moment(_0x109aab)[_0x4443('0x2c')](_0x2525d5);}else if(_0x109aab){return!![];}return![];};
\ No newline at end of file
index 19612c0..cae056a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3bb9=['./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','role','name','client','catch','then','user','no-user','data','timestamp','error','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','statusCode','responseTime','logger','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','url','device','agent_name','test','setupLoggers'];(function(_0x572d96,_0x354aba){var _0x2213c3=function(_0x1840ba){while(--_0x1840ba){_0x572d96['push'](_0x572d96['shift']());}};_0x2213c3(++_0x354aba);}(_0x3bb9,0x150));var _0x93bb=function(_0x4593b3,_0x5284ae){_0x4593b3=_0x4593b3-0x0;var _0x1ac12e=_0x3bb9[_0x4593b3];return _0x1ac12e;};var fs=require('fs-extra');var _=require('lodash');var ewinston=require('express-winston');var path=require('path');var util=require('util');var fileLogger=require(_0x93bb('0x0'))[_0x93bb('0x1')];var safeTemplate=require(_0x93bb('0x2'))[_0x93bb('0x3')];var maskSensitiveData=require(_0x93bb('0x4'))['maskSensitiveData'];function ClientSideLogger(){function _0x575257(_0x4fca12){var _0x43c85d=path[_0x93bb('0x5')](_0x93bb('0x6'),_0x93bb('0x7'),'xcally');var _0x1b2e11=path[_0x93bb('0x5')]('client',_0x4fca12[_0x93bb('0x8')]+'-'+_0x4fca12[_0x93bb('0x9')]);return fs['ensureDir'](path['join'](_0x43c85d,_0x1b2e11))['then'](function(){var _0x495e45=fileLogger(_0x93bb('0xa'),path[_0x93bb('0x5')](_0x43c85d,_0x1b2e11));return _0x495e45;})[_0x93bb('0xb')](function(_0x16f64b){throw _0x16f64b;});}this['log']=function(_0x299907,_0x5bbbe7,_0x49673a,_0x2d0364){return _0x575257(_0x299907['user'])[_0x93bb('0xc')](function(_0x1e98fa){var _0x880118=_0x1e98fa[_0x5bbbe7];return _0x880118;})[_0x93bb('0xc')](function(_0x4a3ee0){var _0x370d26=_0x299907[_0x93bb('0xd')]?_0x299907[_0x93bb('0xd')]['id']:_0x93bb('0xe');var _0x59fa52=_0x2d0364[_0x93bb('0xf')];var _0x4de917=_0x2d0364[_0x93bb('0x10')];var _0x30b410=new Date(Number(_0x4de917));return _0x4a3ee0(_0x370d26,_0x30b410,_0x49673a,_0x59fa52);})[_0x93bb('0xb')](function(_0x2cc76e){fileLogger(_0x93bb('0xa'))[_0x93bb('0x11')](_0x2cc76e);});};}function setupLoggers(_0x7c576f){return new Promise(function(_0x1bbfd4){var _0x30a287=new ClientSideLogger();var _0x1db5fd=fileLogger('api');var _0x742016=fileLogger(_0x93bb('0x12'));_0x7c576f[_0x93bb('0x13')](_0x93bb('0x14'),_0x30a287);_0x7c576f[_0x93bb('0x15')](ewinston['logger']({'winstonInstance':_0x1db5fd,'meta':![],'statusLevels':!![],'msg':function(_0x1961b3,_0x4d3f93){var _0x3ea9eb=_0x93bb('0x16');if(!_[_0x93bb('0x17')](_0x1961b3[_0x93bb('0x18')])){_0x3ea9eb+=_0x93bb('0x19');var _0xcbb3eb=_0x1961b3[_0x93bb('0x18')];maskSensitiveData(_0xcbb3eb);}return safeTemplate(util[_0x93bb('0x1a')](_0x3ea9eb,_0x1961b3[_0x93bb('0x1b')],_0x1961b3[_0x93bb('0x1c')][_0x93bb('0x1d')]?_0x1961b3[_0x93bb('0x1c')][_0x93bb('0x1d')]:_0x1961b3['connection'][_0x93bb('0x1e')]||_0x1961b3['ip'],_0x1961b3['url'],_0x4d3f93[_0x93bb('0x1f')],_0x4d3f93[_0x93bb('0x20')],_0x1961b3[_0x93bb('0xd')]?_0x1961b3['user']['id']:null,_0x1961b3['user']?_0x1961b3[_0x93bb('0xd')]['name']:null,_0x1961b3[_0x93bb('0xd')]?_0x1961b3[_0x93bb('0xd')][_0x93bb('0x8')]:null,_0xcbb3eb?util['inspect'](_0xcbb3eb,![],null):''));}}));_0x7c576f[_0x93bb('0x15')](ewinston[_0x93bb('0x21')]({'winstonInstance':_0x742016,'meta':![],'statusLevels':!![],'msg':function(_0x59d50e,_0xc88eef){var _0x204961='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x59d50e[_0x93bb('0x18')]&&_0x59d50e['body']['device']&&_0x59d50e[_0x93bb('0x18')][_0x93bb('0x22')]){_0x204961=_0x93bb('0x23');}return util['format'](_0x204961,_0x59d50e[_0x93bb('0x1b')],_0x59d50e[_0x93bb('0x1c')][_0x93bb('0x1d')]?_0x59d50e[_0x93bb('0x1c')]['x-forwarded-for']:_0x59d50e[_0x93bb('0x24')]['remoteAddress']||_0x59d50e['ip'],_0x59d50e[_0x93bb('0x25')],_0xc88eef[_0x93bb('0x1f')],_0xc88eef[_0x93bb('0x20')],_0x59d50e[_0x93bb('0xd')]?_0x59d50e[_0x93bb('0xd')]['id']:null,_0x59d50e[_0x93bb('0xd')]?_0x59d50e[_0x93bb('0xd')][_0x93bb('0x9')]:null,_0x59d50e[_0x93bb('0xd')]?_0x59d50e[_0x93bb('0xd')][_0x93bb('0x8')]:null,_0x59d50e['body']&&_0x59d50e[_0x93bb('0x18')][_0x93bb('0x26')]?_0x59d50e[_0x93bb('0x18')][_0x93bb('0x26')]:'other',_0x59d50e[_0x93bb('0x18')]&&_0x59d50e[_0x93bb('0x18')][_0x93bb('0x22')]?_0x59d50e[_0x93bb('0x18')]['agent_id']:'',_0x59d50e[_0x93bb('0x18')]&&_0x59d50e[_0x93bb('0x18')][_0x93bb('0x27')]?_0x59d50e[_0x93bb('0x18')]['agent_name']:'');},'ignoreRoute':function(_0x565610){var _0xdc1700=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xdc1700[_0x93bb('0x28')](_0x565610[_0x93bb('0x25')]);}}));return _0x1bbfd4();});}exports[_0x93bb('0x29')]=setupLoggers;
\ No newline at end of file
+var _0x2987=['no-user','data','timestamp','error','auth','set','client-side-logger','use','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','url','statusCode','inspect','logger','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','responseTime','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','log','xcally','join','client','role','name','ensureDir','then','catch','user'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x2987,0x108));var _0x7298=function(_0x206915,_0x5d88cf){_0x206915=_0x206915-0x0;var _0x446548=_0x2987[_0x206915];return _0x446548;};var fs=require(_0x7298('0x0'));var _=require(_0x7298('0x1'));var ewinston=require(_0x7298('0x2'));var path=require(_0x7298('0x3'));var util=require('util');var fileLogger=require(_0x7298('0x4'))['fileLogger'];var safeTemplate=require(_0x7298('0x5'))[_0x7298('0x6')];var maskSensitiveData=require(_0x7298('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x304f9c(_0x54fa4b){var _0x1d51de=path['join']('/var',_0x7298('0x8'),_0x7298('0x9'));var _0x28e7e0=path[_0x7298('0xa')](_0x7298('0xb'),_0x54fa4b[_0x7298('0xc')]+'-'+_0x54fa4b[_0x7298('0xd')]);return fs[_0x7298('0xe')](path[_0x7298('0xa')](_0x1d51de,_0x28e7e0))[_0x7298('0xf')](function(){var _0x6ef8f1=fileLogger(_0x7298('0xb'),path['join'](_0x1d51de,_0x28e7e0));return _0x6ef8f1;})[_0x7298('0x10')](function(_0x5aec8d){throw _0x5aec8d;});}this[_0x7298('0x8')]=function(_0x467c0a,_0x324e81,_0x152482,_0x1266aa){return _0x304f9c(_0x467c0a[_0x7298('0x11')])[_0x7298('0xf')](function(_0x3037d7){var _0x3ddf12=_0x3037d7[_0x324e81];return _0x3ddf12;})[_0x7298('0xf')](function(_0x13dbaf){var _0x53336d=_0x467c0a[_0x7298('0x11')]?_0x467c0a[_0x7298('0x11')]['id']:_0x7298('0x12');var _0x59d24e=_0x1266aa[_0x7298('0x13')];var _0x19950f=_0x1266aa[_0x7298('0x14')];var _0x47706a=new Date(Number(_0x19950f));return _0x13dbaf(_0x53336d,_0x47706a,_0x152482,_0x59d24e);})['catch'](function(_0xf593db){fileLogger('client')[_0x7298('0x15')](_0xf593db);});};}function setupLoggers(_0x382107){return new Promise(function(_0x55e910){var _0x29c527=new ClientSideLogger();var _0x1dd02f=fileLogger('api');var _0x34e7e4=fileLogger(_0x7298('0x16'));_0x382107[_0x7298('0x17')](_0x7298('0x18'),_0x29c527);_0x382107[_0x7298('0x19')](ewinston['logger']({'winstonInstance':_0x1dd02f,'meta':![],'statusLevels':!![],'msg':function(_0x320e26,_0x5e77f5){var _0x364623='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x7298('0x1a')](_0x320e26[_0x7298('0x1b')])){_0x364623+=_0x7298('0x1c');var _0x10755e=_0x320e26[_0x7298('0x1b')];maskSensitiveData(_0x10755e);}return safeTemplate(util[_0x7298('0x1d')](_0x364623,_0x320e26[_0x7298('0x1e')],_0x320e26[_0x7298('0x1f')][_0x7298('0x20')]?_0x320e26[_0x7298('0x1f')][_0x7298('0x20')]:_0x320e26[_0x7298('0x21')]['remoteAddress']||_0x320e26['ip'],_0x320e26[_0x7298('0x22')],_0x5e77f5[_0x7298('0x23')],_0x5e77f5['responseTime'],_0x320e26[_0x7298('0x11')]?_0x320e26[_0x7298('0x11')]['id']:null,_0x320e26[_0x7298('0x11')]?_0x320e26[_0x7298('0x11')]['name']:null,_0x320e26[_0x7298('0x11')]?_0x320e26[_0x7298('0x11')][_0x7298('0xc')]:null,_0x10755e?util[_0x7298('0x24')](_0x10755e,![],null):''));}}));_0x382107[_0x7298('0x19')](ewinston[_0x7298('0x25')]({'winstonInstance':_0x34e7e4,'meta':![],'statusLevels':!![],'msg':function(_0xc914c,_0x2c3dd1){var _0x4e495e='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0xc914c[_0x7298('0x1b')]&&_0xc914c['body'][_0x7298('0x26')]&&_0xc914c[_0x7298('0x1b')][_0x7298('0x27')]){_0x4e495e=_0x7298('0x28');}return util[_0x7298('0x1d')](_0x4e495e,_0xc914c[_0x7298('0x1e')],_0xc914c['headers'][_0x7298('0x20')]?_0xc914c[_0x7298('0x1f')][_0x7298('0x20')]:_0xc914c[_0x7298('0x21')][_0x7298('0x29')]||_0xc914c['ip'],_0xc914c[_0x7298('0x22')],_0x2c3dd1[_0x7298('0x23')],_0x2c3dd1[_0x7298('0x2a')],_0xc914c[_0x7298('0x11')]?_0xc914c[_0x7298('0x11')]['id']:null,_0xc914c[_0x7298('0x11')]?_0xc914c[_0x7298('0x11')][_0x7298('0xd')]:null,_0xc914c[_0x7298('0x11')]?_0xc914c['user']['role']:null,_0xc914c[_0x7298('0x1b')]&&_0xc914c[_0x7298('0x1b')][_0x7298('0x26')]?_0xc914c[_0x7298('0x1b')]['device']:_0x7298('0x2b'),_0xc914c[_0x7298('0x1b')]&&_0xc914c['body']['agent_id']?_0xc914c[_0x7298('0x1b')][_0x7298('0x27')]:'',_0xc914c[_0x7298('0x1b')]&&_0xc914c[_0x7298('0x1b')][_0x7298('0x2c')]?_0xc914c[_0x7298('0x1b')][_0x7298('0x2c')]:'');},'ignoreRoute':function(_0x2b0e2d){var _0xac0277=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xac0277[_0x7298('0x2d')](_0x2b0e2d['url']);}}));return _0x55e910();});}exports[_0x7298('0x2e')]=setupLoggers;
\ No newline at end of file
index 78c27c7..3cc1677 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xca1d=['keys','length','stringify','level','Logger','transports','Console','warn','%s-%s','error','File','consoleLogger','fileLogger','path','moment','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','join','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xca1d,0x11e));var _0xdca1=function(_0x2575df,_0xece155){_0x2575df=_0x2575df-0x0;var _0x2835a2=_0xca1d[_0x2575df];return _0x2835a2;};'use strict';var path=require(_0xdca1('0x0'));var util=require('util');var moment=require(_0xdca1('0x1'));var winston=require(_0xdca1('0x2'));var config=require(_0xdca1('0x3'));var debugLevel=config['debugLevel']?config[_0xdca1('0x4')][_0xdca1('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xdca1('0x6'),'error':_0xdca1('0x7'),'warn':_0xdca1('0x8'),'info':_0xdca1('0x9'),'print':_0xdca1('0xa'),'success':_0xdca1('0xb'),'http':'gray','verbose':_0xdca1('0xc'),'debug':_0xdca1('0xd'),'silly':_0xdca1('0xe')};winston[_0xdca1('0xf')](XC_LOG_COLORS);function getLogFileName(_0xacc63a,_0x2c0b83,_0x408465){var _0x1fcad7=_0xacc63a||'/var/log/xcally';return path[_0xdca1('0x10')](_0x1fcad7,util[_0xdca1('0x11')]('%s-%s.log',_0x2c0b83,_0x408465));}function formatter(_0x3cd34b,_0x14a687){_0x14a687[_0xdca1('0x12')]=_0x14a687['message'][_0xdca1('0x13')](/@@{/g,_0xdca1('0x14'))[_0xdca1('0x13')](/}@@/g,_0xdca1('0x15'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0xdca1('0x16'),moment()[_0xdca1('0x11')](_0xdca1('0x17')),_0x14a687['level'][_0xdca1('0x18')](),_0x3cd34b,_0x14a687[_0xdca1('0x12')]);}function fileFormat(_0x21abf8,_0x246692){_0x246692[_0xdca1('0x12')]=_0x246692[_0xdca1('0x12')]['replace'](/@@{/g,_0xdca1('0x14'))[_0xdca1('0x13')](/}@@/g,_0xdca1('0x15'))['replace'](/@{/g,'{{')[_0xdca1('0x13')](/}@/g,'}}');var _0x407e73=_0x246692[_0xdca1('0x19')]&&Object[_0xdca1('0x1a')](_0x246692[_0xdca1('0x19')])[_0xdca1('0x1b')]?'\x0a\x09'+JSON[_0xdca1('0x1c')](_0x246692[_0xdca1('0x19')]):'';return util[_0xdca1('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0xdca1('0x17')),_0x246692[_0xdca1('0x1d')]['toUpperCase'](),_0x21abf8,_0x246692[_0xdca1('0x12')],_0x407e73);}function consoleLogger(){var _0x571c16=new winston[(_0xdca1('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xdca1('0x1f'))][(_0xdca1('0x20'))]({'level':_0xdca1('0x21'),'json':![],'formatter':function(_0x3f9a09){return formatter('',_0x3f9a09);}})]});return _0x571c16;}function fileLogger(_0x42fb8,_0x504e95){var _0x52e4ff=new winston[(_0xdca1('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xdca1('0x1f'))]['File']({'name':util[_0xdca1('0x11')](_0xdca1('0x22'),_0x42fb8,_0xdca1('0x23')),'filename':getLogFileName(_0x504e95,_0x42fb8,_0xdca1('0x23')),'level':_0xdca1('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4acdde){return fileFormat(_0x42fb8,_0x4acdde);}}),new winston[(_0xdca1('0x1f'))][(_0xdca1('0x24'))]({'name':util[_0xdca1('0x11')](_0xdca1('0x22'),_0x42fb8,debugLevel),'filename':getLogFileName(_0x504e95,_0x42fb8,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x21858a){return fileFormat(_0x42fb8,_0x21858a);}}),new winston['transports'][(_0xdca1('0x20'))]({'level':_0xdca1('0x21'),'json':![],'formatter':function(_0x547918){return fileFormat(_0x42fb8,_0x547918);}})]});return _0x52e4ff;}exports[_0xdca1('0x25')]=consoleLogger;exports[_0xdca1('0x26')]=fileLogger;
\ No newline at end of file
+var _0x48e7=['bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','Logger','transports','Console','warn','%s-%s','error','File','consoleLogger','path','util','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20magenta'];(function(_0x233ba9,_0x581b20){var _0x3704da=function(_0x1e0009){while(--_0x1e0009){_0x233ba9['push'](_0x233ba9['shift']());}};_0x3704da(++_0x581b20);}(_0x48e7,0xc0));var _0x748e=function(_0x587f69,_0x48a1b1){_0x587f69=_0x587f69-0x0;var _0x28d79b=_0x48e7[_0x587f69];return _0x28d79b;};'use strict';var path=require(_0x748e('0x0'));var util=require(_0x748e('0x1'));var moment=require('moment');var winston=require(_0x748e('0x2'));var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0x748e('0x3')][_0x748e('0x4')]():_0x748e('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x748e('0x6'),'error':_0x748e('0x7'),'warn':_0x748e('0x8'),'info':_0x748e('0x9'),'print':'bold\x20white','success':_0x748e('0xa'),'http':_0x748e('0xb'),'verbose':_0x748e('0xc'),'debug':_0x748e('0xd'),'silly':_0x748e('0xe')};winston[_0x748e('0xf')](XC_LOG_COLORS);function getLogFileName(_0xf5d47b,_0x5f0e53,_0xde1438){var _0x5d1bfa=_0xf5d47b||_0x748e('0x10');return path[_0x748e('0x11')](_0x5d1bfa,util[_0x748e('0x12')](_0x748e('0x13'),_0x5f0e53,_0xde1438));}function formatter(_0x4057d2,_0x305d3f){_0x305d3f['message']=_0x305d3f[_0x748e('0x14')][_0x748e('0x15')](/@@{/g,_0x748e('0x16'))[_0x748e('0x15')](/}@@/g,_0x748e('0x17'))[_0x748e('0x15')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x748e('0x18'),moment()[_0x748e('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),_0x305d3f[_0x748e('0x19')]['toUpperCase'](),_0x4057d2,_0x305d3f[_0x748e('0x14')]);}function fileFormat(_0x4c424a,_0x490e97){_0x490e97[_0x748e('0x14')]=_0x490e97[_0x748e('0x14')][_0x748e('0x15')](/@@{/g,'{{{')[_0x748e('0x15')](/}@@/g,_0x748e('0x17'))[_0x748e('0x15')](/@{/g,'{{')[_0x748e('0x15')](/}@/g,'}}');var _0x57a499=_0x490e97[_0x748e('0x1a')]&&Object[_0x748e('0x1b')](_0x490e97[_0x748e('0x1a')])[_0x748e('0x1c')]?'\x0a\x09'+JSON[_0x748e('0x1d')](_0x490e97[_0x748e('0x1a')]):'';return util[_0x748e('0x12')](_0x748e('0x1e'),moment()[_0x748e('0x12')](_0x748e('0x1f')),_0x490e97[_0x748e('0x19')][_0x748e('0x20')](),_0x4c424a,_0x490e97[_0x748e('0x14')],_0x57a499);}function consoleLogger(){var _0x144533=new winston[(_0x748e('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x748e('0x22'))][(_0x748e('0x23'))]({'level':_0x748e('0x24'),'json':![],'formatter':function(_0xff84f8){return formatter('',_0xff84f8);}})]});return _0x144533;}function fileLogger(_0xe9717d,_0x4b4db2){var _0x14979a=new winston[(_0x748e('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x748e('0x22'))]['File']({'name':util[_0x748e('0x12')](_0x748e('0x25'),_0xe9717d,_0x748e('0x26')),'filename':getLogFileName(_0x4b4db2,_0xe9717d,_0x748e('0x26')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2294b9){return fileFormat(_0xe9717d,_0x2294b9);}}),new winston[(_0x748e('0x22'))][(_0x748e('0x27'))]({'name':util[_0x748e('0x12')](_0x748e('0x25'),_0xe9717d,debugLevel),'filename':getLogFileName(_0x4b4db2,_0xe9717d,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x467c76){return fileFormat(_0xe9717d,_0x467c76);}}),new winston['transports']['Console']({'level':_0x748e('0x24'),'json':![],'formatter':function(_0x300f6c){return fileFormat(_0xe9717d,_0x300f6c);}})]});return _0x14979a;}exports[_0x748e('0x28')]=consoleLogger;exports['fileLogger']=fileLogger;
\ No newline at end of file
index 29c407e..9425fbb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x14a0=['membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','code','accessKey','tenantId','accessToken'];(function(_0x1fe859,_0x43a123){var _0x585d86=function(_0x4e5a34){while(--_0x4e5a34){_0x1fe859['push'](_0x1fe859['shift']());}};_0x585d86(++_0x43a123);}(_0x14a0,0x8e));var _0x014a=function(_0x24f1e6,_0x1f2633){_0x24f1e6=_0x24f1e6-0x0;var _0x1f2d11=_0x14a0[_0x24f1e6];return _0x1f2d11;};var _=require('lodash');var sensitiveFields=[_0x014a('0x0'),_0x014a('0x1'),_0x014a('0x2'),_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),_0x014a('0x6'),'phone','mobile',_0x014a('0x7'),_0x014a('0x8'),_0x014a('0x9'),'clientSecret','securityToken',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'token','channelSecret',_0x014a('0xd'),'accessTokenSecret','authToken','consumerKey','consumerSecret',_0x014a('0xe'),'calleridname',_0x014a('0xf'),_0x014a('0x10'),'vidaooApiKey',_0x014a('0x11'),_0x014a('0x12'),_0x014a('0x13'),_0x014a('0x14'),_0x014a('0x15'),_0x014a('0x16'),_0x014a('0x17'),_0x014a('0x18'),_0x014a('0x19'),_0x014a('0x1a'),_0x014a('0x1b'),_0x014a('0x1c'),'oldPassword'];function maskSensitiveData(_0x130d13){const _0x3cf92f=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x130d13)){for(const _0x3a836f in _0x130d13){if(_[_0x014a('0x1d')](_0x130d13[_0x3a836f])){for(let _0x59a4ea=0x0;_0x59a4ea<_0x130d13[_0x3a836f][_0x014a('0x1e')];_0x59a4ea++){maskSensitiveData(_0x130d13[_0x3a836f][_0x59a4ea]);}}else if(_[_0x014a('0x1f')](_0x130d13[_0x3a836f])){maskSensitiveData(_0x130d13[_0x3a836f]);}else if(_[_0x014a('0x20')](_0x130d13[_0x3a836f])){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](/{{{/g,_0x014a('0x22'))[_0x014a('0x21')](/}}}/g,_0x014a('0x23'))[_0x014a('0x21')](/{{/g,'@{')[_0x014a('0x21')](/}}/g,'}@');if(_[_0x014a('0x24')](sensitiveFields,_0x3a836f)){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](_0x3cf92f,'*');}}}}}module[_0x014a('0x25')][_0x014a('0x26')]=maskSensitiveData;
\ No newline at end of file
+var _0x5f2f=['tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','membername','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','lodash','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','clientSecret','securityToken','code'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3000ee,_0x1f21b7){_0x3000ee=_0x3000ee-0x0;var _0x384c93=_0x5f2f[_0x3000ee];return _0x384c93;};var _=require(_0xf5f2('0x0'));var sensitiveFields=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'phone','mobile',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'accessKey',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'accessToken',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'consumerSecret',_0xf5f2('0x14'),'calleridname','calleridnum',_0xf5f2('0x15'),_0xf5f2('0x16'),'clientEmail',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'accountSid',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21')];function maskSensitiveData(_0x4d97fc){const _0xafe430=/(?!^)[\s\S](?!$)/g;if(_[_0xf5f2('0x22')](_0x4d97fc)){for(const _0x17d656 in _0x4d97fc){if(_[_0xf5f2('0x23')](_0x4d97fc[_0x17d656])){for(let _0x23e23a=0x0;_0x23e23a<_0x4d97fc[_0x17d656][_0xf5f2('0x24')];_0x23e23a++){maskSensitiveData(_0x4d97fc[_0x17d656][_0x23e23a]);}}else if(_[_0xf5f2('0x22')](_0x4d97fc[_0x17d656])){maskSensitiveData(_0x4d97fc[_0x17d656]);}else if(_[_0xf5f2('0x25')](_0x4d97fc[_0x17d656])){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](/{{{/g,_0xf5f2('0x27'))[_0xf5f2('0x26')](/}}}/g,_0xf5f2('0x28'))[_0xf5f2('0x26')](/{{/g,'@{')[_0xf5f2('0x26')](/}}/g,'}@');if(_[_0xf5f2('0x29')](sensitiveFields,_0x17d656)){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](_0xafe430,'*');}}}}}module[_0xf5f2('0x2a')]['maskSensitiveData']=maskSensitiveData;
\ No newline at end of file
index a20abd6..2007f4b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb688=['{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','reduce','exports','safeTemplate'];(function(_0x548a8a,_0x16f528){var _0x2e9401=function(_0x268844){while(--_0x268844){_0x548a8a['push'](_0x548a8a['shift']());}};_0x2e9401(++_0x16f528);}(_0xb688,0xcf));var _0x8b68=function(_0x114e7b,_0x194c66){_0x114e7b=_0x114e7b-0x0;var _0x5a603c=_0xb688[_0x114e7b];return _0x5a603c;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x39c8c5){return _0x39c8c5==='{{'?_0x8b68('0x0'):_0x8b68('0x1');}function safeTemplate(_0x1080e8){var _0x23bbaa=_0x1080e8;if(typeof _0x1080e8===_0x8b68('0x2')){_0x23bbaa=_0x1080e8['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x8b68('0x3')](_0x1080e8)){_0x23bbaa=_0x1080e8[_0x8b68('0x4')](function(_0x30f33d){return safeTemplate(_0x30f33d);});}else if(_[_0x8b68('0x5')](_0x1080e8)){_0x23bbaa=Object['keys'](_0x1080e8)[_0x8b68('0x6')](function(_0x57ee56,_0x37677d){_0x57ee56[_0x37677d]=safeTemplate(_0x1080e8[_0x37677d]);return _0x57ee56;},{});}return _0x23bbaa;}module[_0x8b68('0x7')][_0x8b68('0x8')]=safeTemplate;
\ No newline at end of file
+var _0x2032=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x2032,0xd9));var _0x2203=function(_0x276118,_0x55147c){_0x276118=_0x276118-0x0;var _0x281868=_0x2032[_0x276118];return _0x281868;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2c2259){return _0x2c2259==='{{'?_0x2203('0x0'):_0x2203('0x1');}function safeTemplate(_0x4c28da){var _0x486390=_0x4c28da;if(typeof _0x4c28da===_0x2203('0x2')){_0x486390=_0x4c28da['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2203('0x3')](_0x4c28da)){_0x486390=_0x4c28da[_0x2203('0x4')](function(_0x44ccfd){return safeTemplate(_0x44ccfd);});}else if(_[_0x2203('0x5')](_0x4c28da)){_0x486390=Object[_0x2203('0x6')](_0x4c28da)[_0x2203('0x7')](function(_0x2e0f63,_0x2676aa){_0x2e0f63[_0x2676aa]=safeTemplate(_0x4c28da[_0x2676aa]);return _0x2e0f63;},{});}return _0x486390;}module[_0x2203('0x8')][_0x2203('0x9')]=safeTemplate;
\ No newline at end of file